From efb72f2e7540aa7934a7c76167b29481e1e03da2 Mon Sep 17 00:00:00 2001 From: support Date: Wed, 13 Apr 2022 07:26:10 +0000 Subject: [PATCH] Built motion from commit e2d2a7e0.|2.6.7 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- .../authActiveDirectory.controller.js | 2 +- server/api/authActiveDirectory/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage.events.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- server/api/client-side-logs.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.oauth.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../cmContactHasItem.attributes.js | 2 +- .../cmContactHasItem.controller.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.model.js | 2 +- .../api/cmContactHasItem/cmContactHasItem.rpc.js | 2 +- server/api/cmContactHasItem/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../cmHopperAdditionalPhone.attributes.js | 2 +- .../cmHopperAdditionalPhone.controller.js | 2 +- .../cmHopperAdditionalPhone.model.js | 2 +- .../cmHopperAdditionalPhone.rpc.js | 2 +- server/api/cmHopperAdditionalPhone/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- .../contactItemType/contactItemType.attributes.js | 2 +- .../contactItemType/contactItemType.controller.js | 2 +- .../api/contactItemType/contactItemType.model.js | 2 +- server/api/contactItemType/contactItemType.rpc.js | 2 +- server/api/contactItemType/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.events.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user-setting/index.js | 2 +- server/api/user-setting/user-setting.attributes.js | 2 +- server/api/user-setting/user-setting.controller.js | 2 +- server/api/user-setting/user-setting.events.js | 2 +- server/api/user-setting/user-setting.model.js | 2 +- server/api/user-setting/user-setting.socket.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/import/cm/csvUpdates.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/cloud-provider.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/api.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/events.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/project.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperAdditionalPhone.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/tvox.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- server/utils/client-side-logger.js | 2 +- server/utils/loggers.js | 2 +- server/utils/mask-sensitive-data.js | 2 +- server/utils/safe-template.js | 2 +- 1189 files changed, 1189 insertions(+), 1189 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 3cca874..60ce82b 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-04-13T07:02:39.806Z", + "time": "2022-04-13T07:18:34.336Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7852f35..ebd24f3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-13T07:02:39.806Z", + "time": "2022-04-13T07:18:34.336Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 78ef0e8..dee3e1c 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 _0x3f7d=['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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL','getDataValue','jscripty','urlForward','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x34bedc,_0x5639f9){var _0x247dfd=function(_0x5f3696){while(--_0x5f3696){_0x34bedc['push'](_0x34bedc['shift']());}};_0x247dfd(++_0x5639f9);}(_0x3f7d,0x1f3));var _0xd3f7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f7d[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xd3f7('0x0')]={'name':{'type':Sequelize[_0xd3f7('0x1')],'get':function(_0x1d0e52){return this[_0xd3f7('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0xd3f7('0x3'),_0xd3f7('0x4'),'browser','bot','script']],'msg':_0xd3f7('0x5')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xd3f7('0x6')](0x1000),'comment':_0xd3f7('0x7')},'data2':{'type':Sequelize[_0xd3f7('0x6')](0x1000),'comment':_0xd3f7('0x8')},'data3':{'type':Sequelize[_0xd3f7('0x6')](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[_0xd3f7('0x6')](0x1000),'comments':_0xd3f7('0x9')},'data5':{'type':Sequelize[_0xd3f7('0x6')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xd3f7('0x6')],'comments':_0xd3f7('0xa')},'data7':{'type':Sequelize[_0xd3f7('0xb')],'comments':_0xd3f7('0xc')}}; \ No newline at end of file +var _0xf698=['STRING','contactManager','jscripty','urlForward','bot','script','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]','exports','VIRTUAL','getDataValue','action'];(function(_0x4ff0b7,_0x314e92){var _0x88b6c1=function(_0x83bf70){while(--_0x83bf70){_0x4ff0b7['push'](_0x4ff0b7['shift']());}};_0x88b6c1(++_0x314e92);}(_0xf698,0x194));var _0x8f69=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xf698[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require('sequelize');module[_0x8f69('0x0')]={'name':{'type':Sequelize[_0x8f69('0x1')],'get':function(_0x3a0a14){return this[_0x8f69('0x2')](_0x8f69('0x3'));}},'action':{'type':Sequelize[_0x8f69('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8f69('0x5'),'integration','motionbar',_0x8f69('0x6'),_0x8f69('0x7'),'browser',_0x8f69('0x8'),_0x8f69('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x8f69('0x4')](0x1000),'comment':_0x8f69('0xa')},'data2':{'type':Sequelize[_0x8f69('0x4')](0x1000),'comment':_0x8f69('0xb')},'data3':{'type':Sequelize[_0x8f69('0x4')](0x1000),'comment':_0x8f69('0xc')},'data4':{'type':Sequelize[_0x8f69('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x8f69('0xd')},'data6':{'type':Sequelize[_0x8f69('0x4')],'comments':_0x8f69('0xe')},'data7':{'type':Sequelize[_0x8f69('0xf')],'comments':_0x8f69('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index cb2ad29..c1e1a15 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 _0x537e=['error','stack','name','body','params','catch','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then'];(function(_0x2513ce,_0xf33af6){var _0x19e1e7=function(_0x114ba1){while(--_0x114ba1){_0x2513ce['push'](_0x2513ce['shift']());}};_0x19e1e7(++_0xf33af6);}(_0x537e,0x16f));var _0xe537=function(_0x5dbb9d,_0x46bf5e){_0x5dbb9d=_0x5dbb9d-0x0;var _0xed7899=_0x537e[_0x5dbb9d];return _0xed7899;};'use strict';var emlformat=require(_0xe537('0x0'));var rimraf=require(_0xe537('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe537('0x2'));var rp=require(_0xe537('0x3'));var moment=require('moment');var BPromise=require(_0xe537('0x4'));var Mustache=require(_0xe537('0x5'));var util=require('util');var path=require(_0xe537('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe537('0x7'));var fs=require('fs');var fs_extra=require(_0xe537('0x8'));var _=require(_0xe537('0x9'));var squel=require(_0xe537('0xa'));var crypto=require(_0xe537('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe537('0xc'));var toCsv=require(_0xe537('0xd'));var querystring=require(_0xe537('0xe'));var Papa=require('papaparse');var Redis=require(_0xe537('0xf'));var authService=require(_0xe537('0x10'));var qs=require(_0xe537('0x11'));var as=require(_0xe537('0x12'));var hardwareService=require(_0xe537('0x13'));var logger=require('../../config/logger')(_0xe537('0x14'));var utils=require(_0xe537('0x15'));var config=require(_0xe537('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4473a6,_0x4b2f99){_0x4b2f99=_0x4b2f99||0xcc;return function(_0x3e6996){if(_0x3e6996){return _0x4473a6[_0xe537('0x17')](_0x4b2f99);}return _0x4473a6[_0xe537('0x18')](_0x4b2f99)[_0xe537('0x19')]();};}function respondWithResult(_0xf2739b,_0x107c95){_0x107c95=_0x107c95||0xc8;return function(_0x47a711){if(_0x47a711){return _0xf2739b[_0xe537('0x18')](_0x107c95)['json'](_0x47a711);}};}function respondWithFilteredResult(_0x599d21,_0x1fb0de){return function(_0x51dc56){if(_0x51dc56){var _0x164f61=typeof _0x1fb0de[_0xe537('0x1a')]===_0xe537('0x1b')&&typeof _0x1fb0de[_0xe537('0x1c')]==='undefined';var _0x5ad6c8=_0x51dc56[_0xe537('0x1d')];var _0x568038=_0x164f61?0x0:_0x1fb0de[_0xe537('0x1a')];var _0x46278b=_0x164f61?_0x51dc56[_0xe537('0x1d')]:_0x1fb0de[_0xe537('0x1a')]+_0x1fb0de[_0xe537('0x1c')];var _0x1cc263;if(_0x46278b>=_0x5ad6c8){_0x46278b=_0x5ad6c8;_0x1cc263=0xc8;}else{_0x1cc263=0xce;}_0x599d21[_0xe537('0x18')](_0x1cc263);return _0x599d21[_0xe537('0x1e')](_0xe537('0x1f'),_0x568038+'-'+_0x46278b+'/'+_0x5ad6c8)[_0xe537('0x20')](_0x51dc56);}return null;};}function patchUpdates(_0xcc3a18){return function(_0x4ee31e){try{jsonpatch[_0xe537('0x21')](_0x4ee31e,_0xcc3a18,!![]);}catch(_0x536a03){return BPromise[_0xe537('0x22')](_0x536a03);}return _0x4ee31e['save']();};}function saveUpdates(_0x360bce,_0x1ca5ce){return function(_0x250e34){if(_0x250e34){return _0x250e34[_0xe537('0x23')](_0x360bce)['then'](function(_0x4deba7){return _0x4deba7;});}return null;};}function removeEntity(_0x1e5fc2,_0x40fb9b){return function(_0x2449d1){if(_0x2449d1){return _0x2449d1[_0xe537('0x24')]()[_0xe537('0x25')](function(){_0x1e5fc2['status'](0xcc)[_0xe537('0x19')]();});}};}function handleEntityNotFound(_0xc0ea41,_0x24d3b5){return function(_0x2d3468){if(!_0x2d3468){_0xc0ea41[_0xe537('0x17')](0x194);}return _0x2d3468;};}function handleError(_0x312c69,_0x3f9a75){_0x3f9a75=_0x3f9a75||0x1f4;return function(_0xa1d3f2){logger[_0xe537('0x26')](_0xa1d3f2[_0xe537('0x27')]);if(_0xa1d3f2['name']){delete _0xa1d3f2[_0xe537('0x28')];}_0x312c69[_0xe537('0x18')](_0x3f9a75)['send'](_0xa1d3f2);};}exports[_0xe537('0x23')]=function(_0x491219,_0x47662f){if(_0x491219['body']['id']){delete _0x491219[_0xe537('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0x491219[_0xe537('0x2a')]['id']}})['then'](handleEntityNotFound(_0x47662f,null))[_0xe537('0x25')](saveUpdates(_0x491219[_0xe537('0x29')],null))[_0xe537('0x25')](respondWithResult(_0x47662f,null))[_0xe537('0x2b')](handleError(_0x47662f,null));};exports['destroy']=function(_0x3532a2,_0x1abf24){return db['Action'][_0xe537('0x2c')]({'where':{'id':_0x3532a2['params']['id']}})[_0xe537('0x25')](handleEntityNotFound(_0x1abf24,null))[_0xe537('0x25')](removeEntity(_0x1abf24,null))['catch'](handleError(_0x1abf24,null));}; \ No newline at end of file +var _0x3393=['catch','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','body','Action','find','params'];(function(_0x1b1c1e,_0x117795){var _0x53b916=function(_0xf83ec6){while(--_0xf83ec6){_0x1b1c1e['push'](_0x1b1c1e['shift']());}};_0x53b916(++_0x117795);}(_0x3393,0x19f));var _0x3339=function(_0x1fdd57,_0x43bfc4){_0x1fdd57=_0x1fdd57-0x0;var _0x20c4f2=_0x3393[_0x1fdd57];return _0x20c4f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3339('0x0'));var zipdir=require(_0x3339('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3339('0x2'));var moment=require('moment');var BPromise=require(_0x3339('0x3'));var Mustache=require(_0x3339('0x4'));var util=require(_0x3339('0x5'));var path=require(_0x3339('0x6'));var sox=require(_0x3339('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3339('0x8'));var _=require('lodash');var squel=require(_0x3339('0x9'));var crypto=require('crypto');var jsforce=require(_0x3339('0xa'));var deskjs=require(_0x3339('0xb'));var toCsv=require(_0x3339('0xc'));var querystring=require(_0x3339('0xd'));var Papa=require(_0x3339('0xe'));var Redis=require(_0x3339('0xf'));var authService=require(_0x3339('0x10'));var qs=require(_0x3339('0x11'));var as=require(_0x3339('0x12'));var hardwareService=require(_0x3339('0x13'));var logger=require(_0x3339('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3339('0x15'));var licenseUtil=require(_0x3339('0x16'));var db=require(_0x3339('0x17'))['db'];function respondWithStatusCode(_0x23bfb8,_0x531700){_0x531700=_0x531700||0xcc;return function(_0x531c48){if(_0x531c48){return _0x23bfb8[_0x3339('0x18')](_0x531700);}return _0x23bfb8[_0x3339('0x19')](_0x531700)[_0x3339('0x1a')]();};}function respondWithResult(_0x1999a1,_0x47852c){_0x47852c=_0x47852c||0xc8;return function(_0x1e0744){if(_0x1e0744){return _0x1999a1[_0x3339('0x19')](_0x47852c)[_0x3339('0x1b')](_0x1e0744);}};}function respondWithFilteredResult(_0x2040e9,_0x26d505){return function(_0x542cf9){if(_0x542cf9){var _0x179f12=typeof _0x26d505[_0x3339('0x1c')]===_0x3339('0x1d')&&typeof _0x26d505[_0x3339('0x1e')]===_0x3339('0x1d');var _0x545ca4=_0x542cf9['count'];var _0x4e483b=_0x179f12?0x0:_0x26d505['offset'];var _0x3b8067=_0x179f12?_0x542cf9[_0x3339('0x1f')]:_0x26d505[_0x3339('0x1c')]+_0x26d505[_0x3339('0x1e')];var _0x1757d7;if(_0x3b8067>=_0x545ca4){_0x3b8067=_0x545ca4;_0x1757d7=0xc8;}else{_0x1757d7=0xce;}_0x2040e9['status'](_0x1757d7);return _0x2040e9[_0x3339('0x20')](_0x3339('0x21'),_0x4e483b+'-'+_0x3b8067+'/'+_0x545ca4)[_0x3339('0x1b')](_0x542cf9);}return null;};}function patchUpdates(_0x9feabf){return function(_0x39a9d0){try{jsonpatch[_0x3339('0x22')](_0x39a9d0,_0x9feabf,!![]);}catch(_0x2b79a0){return BPromise['reject'](_0x2b79a0);}return _0x39a9d0[_0x3339('0x23')]();};}function saveUpdates(_0xfe30fe,_0x2590a5){return function(_0x258a7f){if(_0x258a7f){return _0x258a7f[_0x3339('0x24')](_0xfe30fe)[_0x3339('0x25')](function(_0x321786){return _0x321786;});}return null;};}function removeEntity(_0x409a70,_0x47f924){return function(_0x5b16b6){if(_0x5b16b6){return _0x5b16b6[_0x3339('0x26')]()[_0x3339('0x25')](function(){_0x409a70[_0x3339('0x19')](0xcc)[_0x3339('0x1a')]();});}};}function handleEntityNotFound(_0x1efea3,_0x10f065){return function(_0x2431c8){if(!_0x2431c8){_0x1efea3[_0x3339('0x18')](0x194);}return _0x2431c8;};}function handleError(_0x46f1e9,_0x4ebdab){_0x4ebdab=_0x4ebdab||0x1f4;return function(_0x583750){logger['error'](_0x583750['stack']);if(_0x583750[_0x3339('0x27')]){delete _0x583750[_0x3339('0x27')];}_0x46f1e9[_0x3339('0x19')](_0x4ebdab)[_0x3339('0x28')](_0x583750);};}exports['update']=function(_0x506894,_0x12f0c1){if(_0x506894[_0x3339('0x29')]['id']){delete _0x506894[_0x3339('0x29')]['id'];}return db[_0x3339('0x2a')][_0x3339('0x2b')]({'where':{'id':_0x506894[_0x3339('0x2c')]['id']}})[_0x3339('0x25')](handleEntityNotFound(_0x12f0c1,null))[_0x3339('0x25')](saveUpdates(_0x506894[_0x3339('0x29')],null))[_0x3339('0x25')](respondWithResult(_0x12f0c1,null))[_0x3339('0x2d')](handleError(_0x12f0c1,null));};exports['destroy']=function(_0x4e3028,_0x4a6ade){return db['Action'][_0x3339('0x2b')]({'where':{'id':_0x4e3028['params']['id']}})['then'](handleEntityNotFound(_0x4a6ade,null))[_0x3339('0x25')](removeEntity(_0x4a6ade,null))[_0x3339('0x2d')](handleError(_0x4a6ade,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5d785bd..670d7f1 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 _0xbba8=['./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbba8,0x139));var _0x8bba=function(_0x342b1d,_0x58fb84){_0x342b1d=_0x342b1d-0x0;var _0x49c372=_0xbba8[_0x342b1d];return _0x49c372;};'use strict';var _=require(_0x8bba('0x0'));var util=require(_0x8bba('0x1'));var logger=require(_0x8bba('0x2'))(_0x8bba('0x3'));var moment=require(_0x8bba('0x4'));var BPromise=require(_0x8bba('0x5'));var rp=require(_0x8bba('0x6'));var fs=require('fs');var path=require(_0x8bba('0x7'));var rimraf=require(_0x8bba('0x8'));var config=require('../../config/environment');var attributes=require(_0x8bba('0x9'));module[_0x8bba('0xa')]=function(_0x5d751a,_0x2f685a){return _0x5d751a[_0x8bba('0xb')](_0x8bba('0xc'),attributes,{'tableName':_0x8bba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48e7=['define','Action','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports'];(function(_0x56eea7,_0x35cf82){var _0x4b8463=function(_0x502db0){while(--_0x502db0){_0x56eea7['push'](_0x56eea7['shift']());}};_0x4b8463(++_0x35cf82);}(_0x48e7,0x1db));var _0x748e=function(_0x2bde11,_0x380cb7){_0x2bde11=_0x2bde11-0x0;var _0x5da3c9=_0x48e7[_0x2bde11];return _0x5da3c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x748e('0x0'))(_0x748e('0x1'));var moment=require(_0x748e('0x2'));var BPromise=require(_0x748e('0x3'));var rp=require(_0x748e('0x4'));var fs=require('fs');var path=require(_0x748e('0x5'));var rimraf=require('rimraf');var config=require(_0x748e('0x6'));var attributes=require(_0x748e('0x7'));module[_0x748e('0x8')]=function(_0x5d51aa,_0x3f21e7){return _0x5d51aa[_0x748e('0x9')](_0x748e('0xa'),attributes,{'tableName':'tools_actions','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 5ad23d8..13b26c3 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xea9b39,_0x1cf0c2){var _0x489ff4=function(_0xe4c0f2){while(--_0xe4c0f2){_0xea9b39['push'](_0xea9b39['shift']());}};_0x489ff4(++_0x1cf0c2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\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/action/index.js b/server/api/action/index.js index f961bef..115595f 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 _0x9e6c=['../../components/auth/service','./action.controller','put','delete','/:id','isAuthenticated','destroy','connect-timeout','express','fs-extra'];(function(_0x58707e,_0x17d438){var _0x13f7c6=function(_0x4f9e85){while(--_0x4f9e85){_0x58707e['push'](_0x58707e['shift']());}};_0x13f7c6(++_0x17d438);}(_0x9e6c,0x1ab));var _0xc9e6=function(_0x4f857a,_0x5e76c3){_0x4f857a=_0x4f857a-0x0;var _0x562b06=_0x9e6c[_0x4f857a];return _0x562b06;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc9e6('0x0'));var express=require(_0xc9e6('0x1'));var router=express['Router']();var fs_extra=require(_0xc9e6('0x2'));var auth=require(_0xc9e6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc9e6('0x4'));router[_0xc9e6('0x5')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc9e6('0x6')](_0xc9e6('0x7'),auth[_0xc9e6('0x8')](),controller[_0xc9e6('0x9')]);module['exports']=router; \ No newline at end of file +var _0xce2d=['/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','put'];(function(_0x3797ba,_0x2478f2){var _0x55c7fd=function(_0x29d91d){while(--_0x29d91d){_0x3797ba['push'](_0x3797ba['shift']());}};_0x55c7fd(++_0x2478f2);}(_0xce2d,0x19e));var _0xdce2=function(_0x404c20,_0x1e4e2d){_0x404c20=_0x404c20-0x0;var _0x426079=_0xce2d[_0x404c20];return _0x426079;};'use strict';var multer=require(_0xdce2('0x0'));var util=require('util');var path=require(_0xdce2('0x1'));var timeout=require(_0xdce2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdce2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdce2('0x4'));var controller=require('./action.controller');router[_0xdce2('0x5')](_0xdce2('0x6'),auth[_0xdce2('0x7')](),controller[_0xdce2('0x8')]);router[_0xdce2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdce2('0xa')]);module[_0xdce2('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ea9dbb5..2f5f4e2 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 _0x4819=['TEXT','exports','STRING'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x4819,0xcd));var _0x9481=function(_0x14d3cc,_0x567831){_0x14d3cc=_0x14d3cc-0x0;var _0x1f822b=_0x4819[_0x14d3cc];return _0x1f822b;};'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 +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x2be56c,_0xc4fe58){var _0x41846d=function(_0x1ef0cb){while(--_0x1ef0cb){_0x2be56c['push'](_0x2be56c['shift']());}};_0x41846d(++_0xc4fe58);}(_0xe14b,0x93));var _0xbe14=function(_0x11a7d3,_0x100cfb){_0x11a7d3=_0x11a7d3-0x0;var _0x244206=_0xe14b[_0x11a7d3];return _0x244206;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 999f400..8486ff9 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 _0x266a=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','params','join','left_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','right_join','AVG(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','keyBy','metric','replace','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','COUNT(%s)','COUNT(DISTINCT\x20%s)','ROUND(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','undefined','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','end','sendStatus','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type'];(function(_0x19f8b6,_0x2b4e8c){var _0x213ebc=function(_0x40fc8c){while(--_0x40fc8c){_0x19f8b6['push'](_0x19f8b6['shift']());}};_0x213ebc(++_0x2b4e8c);}(_0x266a,0x75));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa266('0x0'));var rimraf=require(_0xa266('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa266('0x2'));var rp=require(_0xa266('0x3'));var moment=require(_0xa266('0x4'));var BPromise=require(_0xa266('0x5'));var Mustache=require('mustache');var util=require(_0xa266('0x6'));var path=require('path');var sox=require(_0xa266('0x7'));var csv=require(_0xa266('0x8'));var ejs=require(_0xa266('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa266('0xa'));var crypto=require(_0xa266('0xb'));var jsforce=require(_0xa266('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa266('0x8'));var querystring=require(_0xa266('0xd'));var Papa=require(_0xa266('0xe'));var Redis=require('ioredis');var authService=require(_0xa266('0xf'));var qs=require(_0xa266('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa266('0x11'));var logger=require(_0xa266('0x12'))(_0xa266('0x13'));var utils=require(_0xa266('0x14'));var config=require(_0xa266('0x15'));var licenseUtil=require(_0xa266('0x16'));var db=require(_0xa266('0x17'))['db'];var dbH=require('../../mysqldb')[_0xa266('0x18')];function respondWithStatusCode(_0x3c235c,_0x2de9fe){_0x2de9fe=_0x2de9fe||0xcc;return function(_0x12c942){if(_0x12c942){return _0x3c235c['sendStatus'](_0x2de9fe);}return _0x3c235c[_0xa266('0x19')](_0x2de9fe)['end']();};}function respondWithResult(_0x1f0f3b,_0x2905dc){_0x2905dc=_0x2905dc||0xc8;return function(_0x47f555){if(_0x47f555){return _0x1f0f3b[_0xa266('0x19')](_0x2905dc)['json'](_0x47f555);}};}function respondWithFilteredResult(_0x248eca,_0x237394){return function(_0x4637e1){if(_0x4637e1){var _0x4bbf80=typeof _0x237394['offset']===_0xa266('0x1a')&&typeof _0x237394['limit']===_0xa266('0x1a');var _0x314810=_0x4637e1[_0xa266('0x1b')];var _0x4715bc=_0x4bbf80?0x0:_0x237394[_0xa266('0x1c')];var _0x3b5aed=_0x4bbf80?_0x4637e1[_0xa266('0x1b')]:_0x237394['offset']+_0x237394['limit'];var _0x2020a5;if(_0x3b5aed>=_0x314810){_0x3b5aed=_0x314810;_0x2020a5=0xc8;}else{_0x2020a5=0xce;}_0x248eca[_0xa266('0x19')](_0x2020a5);return _0x248eca['set'](_0xa266('0x1d'),_0x4715bc+'-'+_0x3b5aed+'/'+_0x314810)[_0xa266('0x1e')](_0x4637e1);}return null;};}function patchUpdates(_0x15d4e0){return function(_0x3a4dd4){try{jsonpatch[_0xa266('0x1f')](_0x3a4dd4,_0x15d4e0,!![]);}catch(_0x5f0787){return BPromise[_0xa266('0x20')](_0x5f0787);}return _0x3a4dd4[_0xa266('0x21')]();};}function saveUpdates(_0x47b308,_0x13af0b){return function(_0x17bc06){if(_0x17bc06){return _0x17bc06[_0xa266('0x22')](_0x47b308)['then'](function(_0x42101a){return _0x42101a;});}return null;};}function removeEntity(_0x30eab8,_0x2898da){return function(_0x2f5c1e){if(_0x2f5c1e){return _0x2f5c1e[_0xa266('0x23')]()[_0xa266('0x24')](function(){var _0x1b2436=_0x2f5c1e[_0xa266('0x25')]({'plain':!![]});var _0xb36ea5=_0xa266('0x26');return db['UserProfileResource'][_0xa266('0x23')]({'where':{'type':_0xb36ea5,'resourceId':_0x1b2436['id']}})['then'](function(){return _0x2f5c1e;});})[_0xa266('0x24')](function(){_0x30eab8[_0xa266('0x19')](0xcc)[_0xa266('0x27')]();});}};}function handleEntityNotFound(_0xb2c4df,_0x38c7c1){return function(_0x2609aa){if(!_0x2609aa){_0xb2c4df[_0xa266('0x28')](0x194);}return _0x2609aa;};}function handleError(_0x10a856,_0x5a0631){_0x5a0631=_0x5a0631||0x1f4;return function(_0xd0850b){logger[_0xa266('0x29')](_0xd0850b[_0xa266('0x2a')]);if(_0xd0850b[_0xa266('0x2b')]){delete _0xd0850b['name'];}_0x10a856['status'](_0x5a0631)[_0xa266('0x2c')](_0xd0850b);};}exports[_0xa266('0x2d')]=function(_0x3e6ca9,_0x310e80){var _0x54eb8f={},_0x47a64d={},_0x56d8bc={'count':0x0,'rows':[]};var _0xe65713=_['map'](db[_0xa266('0x2e')][_0xa266('0x2f')],function(_0x452175){return{'name':_0x452175[_0xa266('0x30')],'type':_0x452175[_0xa266('0x31')][_0xa266('0x32')]};});_0x47a64d[_0xa266('0x33')]=_['map'](_0xe65713,_0xa266('0x2b'));_0x47a64d[_0xa266('0x34')]=_[_0xa266('0x35')](_0x3e6ca9[_0xa266('0x34')]);_0x47a64d[_0xa266('0x36')]=_[_0xa266('0x37')](_0x47a64d[_0xa266('0x33')],_0x47a64d[_0xa266('0x34')]);_0x54eb8f['attributes']=_['intersection'](_0x47a64d['model'],qs[_0xa266('0x38')](_0x3e6ca9[_0xa266('0x34')]['fields']));_0x54eb8f[_0xa266('0x39')]=_0x54eb8f[_0xa266('0x39')][_0xa266('0x3a')]?_0x54eb8f[_0xa266('0x39')]:_0x47a64d[_0xa266('0x33')];if(!_0x3e6ca9[_0xa266('0x34')][_0xa266('0x3b')]('nolimit')){_0x54eb8f['limit']=qs['limit'](_0x3e6ca9[_0xa266('0x34')][_0xa266('0x3c')]);_0x54eb8f[_0xa266('0x1c')]=qs['offset'](_0x3e6ca9[_0xa266('0x34')][_0xa266('0x1c')]);}_0x54eb8f['order']=qs[_0xa266('0x3d')](_0x3e6ca9[_0xa266('0x34')]['sort']);_0x54eb8f[_0xa266('0x3e')]=qs[_0xa266('0x36')](_[_0xa266('0x3f')](_0x3e6ca9['query'],_0x47a64d[_0xa266('0x36')]),_0xe65713);if(_0x3e6ca9[_0xa266('0x34')]['filter']){_0x54eb8f[_0xa266('0x3e')]=_[_0xa266('0x40')](_0x54eb8f[_0xa266('0x3e')],{'$or':_[_0xa266('0x41')](_0xe65713,function(_0x42dc82){if(_0x42dc82[_0xa266('0x31')]!==_0xa266('0x42')){var _0x4eca85={};_0x4eca85[_0x42dc82[_0xa266('0x2b')]]={'$like':'%'+_0x3e6ca9[_0xa266('0x34')][_0xa266('0x43')]+'%'};return _0x4eca85;}})});}_0x54eb8f=_[_0xa266('0x40')]({},_0x54eb8f,_0x3e6ca9[_0xa266('0x44')]);var _0x59bf1b={'where':_0x54eb8f[_0xa266('0x3e')]};return db[_0xa266('0x2e')][_0xa266('0x1b')](_0x59bf1b)[_0xa266('0x24')](function(_0x55b1e0){_0x56d8bc[_0xa266('0x1b')]=_0x55b1e0;if(_0x3e6ca9['query'][_0xa266('0x45')]){_0x54eb8f[_0xa266('0x46')]=[{'all':!![]}];}return db[_0xa266('0x2e')][_0xa266('0x47')](_0x54eb8f);})[_0xa266('0x24')](function(_0x47ea6f){_0x56d8bc['rows']=_0x47ea6f;return _0x56d8bc;})['then'](respondWithFilteredResult(_0x310e80,_0x54eb8f))[_0xa266('0x48')](handleError(_0x310e80,null));};exports[_0xa266('0x49')]=function(_0x22ba5a,_0x482253){var _0x28bbd1={'raw':![],'where':{'id':_0x22ba5a['params']['id']}},_0x2bbed1={};_0x2bbed1[_0xa266('0x33')]=_[_0xa266('0x35')](db[_0xa266('0x2e')][_0xa266('0x2f')]);_0x2bbed1[_0xa266('0x34')]=_['keys'](_0x22ba5a['query']);_0x2bbed1[_0xa266('0x36')]=_[_0xa266('0x37')](_0x2bbed1[_0xa266('0x33')],_0x2bbed1[_0xa266('0x34')]);_0x28bbd1[_0xa266('0x39')]=_['intersection'](_0x2bbed1[_0xa266('0x33')],qs[_0xa266('0x38')](_0x22ba5a[_0xa266('0x34')]['fields']));_0x28bbd1[_0xa266('0x39')]=_0x28bbd1[_0xa266('0x39')][_0xa266('0x3a')]?_0x28bbd1['attributes']:_0x2bbed1[_0xa266('0x33')];if(_0x22ba5a[_0xa266('0x34')]['includeAll']){_0x28bbd1[_0xa266('0x46')]=[{'all':!![]}];}_0x28bbd1=_[_0xa266('0x40')]({},_0x28bbd1,_0x22ba5a[_0xa266('0x44')]);return db[_0xa266('0x2e')][_0xa266('0x4a')](_0x28bbd1)[_0xa266('0x24')](handleEntityNotFound(_0x482253,null))[_0xa266('0x24')](respondWithResult(_0x482253,null))[_0xa266('0x48')](handleError(_0x482253,null));};exports['create']=function(_0x40e2ac,_0x5771a4){return db[_0xa266('0x2e')][_0xa266('0x4b')](_0x40e2ac[_0xa266('0x4c')],{})[_0xa266('0x24')](function(_0x249314){var _0x59bc47=_0x40e2ac[_0xa266('0x4d')][_0xa266('0x25')]({'plain':!![]});if(!_0x59bc47)throw new Error(_0xa266('0x4e'));if(_0x59bc47['role']===_0xa266('0x4d')){var _0x2c39cc=_0x249314[_0xa266('0x25')]({'plain':!![]});var _0x19e289=_0xa266('0x4f');return db[_0xa266('0x50')]['find']({'where':{'name':_0x19e289,'userProfileId':_0x59bc47[_0xa266('0x51')]},'raw':!![]})[_0xa266('0x24')](function(_0x51e51b){if(_0x51e51b&&_0x51e51b[_0xa266('0x52')]===0x0){return db['UserProfileResource'][_0xa266('0x4b')]({'name':_0x2c39cc[_0xa266('0x2b')],'resourceId':_0x2c39cc['id'],'type':'CustomReports','sectionId':_0x51e51b['id']},{})[_0xa266('0x24')](function(){return _0x249314;});}else{return _0x249314;}})['catch'](function(_0x3fb45f){logger[_0xa266('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fb45f);throw _0x3fb45f;});}return _0x249314;})[_0xa266('0x24')](respondWithResult(_0x5771a4,0xc9))[_0xa266('0x48')](handleError(_0x5771a4,null));};exports[_0xa266('0x22')]=function(_0x5883db,_0x2cbaf3){if(_0x5883db[_0xa266('0x4c')]['id']){delete _0x5883db[_0xa266('0x4c')]['id'];}return db[_0xa266('0x2e')][_0xa266('0x4a')]({'where':{'id':_0x5883db[_0xa266('0x53')]['id']}})[_0xa266('0x24')](handleEntityNotFound(_0x2cbaf3,null))[_0xa266('0x24')](saveUpdates(_0x5883db[_0xa266('0x4c')],null))['then'](respondWithResult(_0x2cbaf3,null))[_0xa266('0x48')](handleError(_0x2cbaf3,null));};exports[_0xa266('0x23')]=function(_0xdc5192,_0x44de7a){return db['AnalyticCustomReport'][_0xa266('0x4a')]({'where':{'id':_0xdc5192['params']['id']}})[_0xa266('0x24')](handleEntityNotFound(_0x44de7a,null))[_0xa266('0x24')](removeEntity(_0x44de7a,null))['catch'](handleError(_0x44de7a,null));};exports['preview']=function(_0x57fd41,_0x146621){var _0x1525a5=0xa;var _0x514b9a=[_0xa266('0x54'),_0xa266('0x55'),'right_join',_0xa266('0x56')];var _0x3b87da={'SUM':_0xa266('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa266('0x58'),'MIN':_0xa266('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa266('0x5a'),'GROUP_CONCAT ASC':_0xa266('0x5b'),'GROUP_CONCAT DESC':_0xa266('0x5c')};var _0x2b25a={'SEC_TO_TIME':_0xa266('0x5d'),'DATE':_0xa266('0x5e'),'HOUR':_0xa266('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2d90c8=function(_0x2065b4){return!_['includes']([_0xa266('0x60'),'IS\x20NOT\x20NULL',_0xa266('0x61'),_0xa266('0x62')],_0x2065b4);};var _0x5688c3=function(_0x196ea2){if(!_0x196ea2||!_0x196ea2[_0xa266('0x63')][_0xa266('0x3a')]){return'';}for(var _0x43e521='(',_0x2822c9=0x0;_0x2822c9<_0x196ea2[_0xa266('0x63')][_0xa266('0x3a')];_0x2822c9+=0x1){_0x2822c9>0x0&&(_0x43e521+='\x20'+_0x196ea2[_0xa266('0x64')]+'\x20');_0x43e521+=_0x196ea2['rules'][_0x2822c9]['group']?_0x5688c3(_0x196ea2[_0xa266('0x63')][_0x2822c9][_0xa266('0x65')]):_0x196ea2['rules'][_0x2822c9][_0xa266('0x66')]+'\x20'+_0x196ea2['rules'][_0x2822c9][_0xa266('0x67')]+(_0x2d90c8(_0x196ea2[_0xa266('0x63')][_0x2822c9][_0xa266('0x67')])?'\x20'+_0x196ea2[_0xa266('0x63')][_0x2822c9][_0xa266('0x68')]:'');}return _0x43e521+')';};var _0x291072={'where':{'id':_0x57fd41[_0xa266('0x53')]['id']}},_0x42dfc8,_0x2926fe,_0x47f009,_0x22049a,_0xe90b55;_0x291072=_[_0xa266('0x40')]({},_0x291072,_0x57fd41['options']);return db['AnalyticCustomReport'][_0xa266('0x4a')](_0x291072)[_0xa266('0x24')](function(_0x633e27){if(_0x633e27){_0x42dfc8=_0x633e27;return _0x633e27[_0xa266('0x69')]();}return null;})[_0xa266('0x24')](function(_0x21eedc){if(_0x21eedc){if(!_0x21eedc['length']){throw new db[(_0xa266('0x6a'))][(_0xa266('0x6b'))](_0xa266('0x6c'),0x193);}_0x2926fe=_0x21eedc;return db[_0xa266('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xa266('0x24')](function(_0x1128f4){if(_0x1128f4){_0x47f009=_['keyBy'](_0x1128f4,'id');var _0x1a3fc9;var _0x57191a=squel[_0xa266('0x6e')]();_0x57191a[_0xa266('0x6f')](_0x42dfc8[_0xa266('0x70')]);for(var _0x4c5d90=0x0;_0x4c5d90<_0x2926fe[_0xa266('0x3a')];_0x4c5d90+=0x1){_0x1a3fc9=_0x2926fe[_0x4c5d90][_0xa266('0x71')]?_0x47f009[_0x2926fe[_0x4c5d90]['MetricId']]['metric']:_0x2926fe[_0x4c5d90][_0xa266('0x66')];_0x1a3fc9=_0x2926fe[_0x4c5d90][_0xa266('0x72')]?_['replace'](_0x3b87da[_0x2926fe[_0x4c5d90]['function']],'%s',_0x1a3fc9):_0x1a3fc9;_0x1a3fc9=_0x2926fe[_0x4c5d90]['format']?_['replace'](_0x2b25a[_0x2926fe[_0x4c5d90][_0xa266('0x73')]],'%s',_0x1a3fc9):_0x1a3fc9;if(_0x2926fe[_0x4c5d90][_0xa266('0x74')]){_0x57191a[_0xa266('0x65')](_0x1a3fc9);}_0x2926fe[_0x4c5d90][_0xa266('0x75')]&&_0x57191a[_0xa266('0x76')](_0x1a3fc9,_0x2926fe[_0x4c5d90][_0xa266('0x75')]===_0xa266('0x77')?![]:!![]);_0x57191a[_0xa266('0x66')](_0x1a3fc9,_0x2926fe[_0x4c5d90][_0xa266('0x78')]||_0x1a3fc9);}if(_0x42dfc8[_0xa266('0x79')]){_0x42dfc8[_0xa266('0x79')]=JSON[_0xa266('0x7a')](_0x42dfc8[_0xa266('0x79')]);for(var _0x2af2fa=0x0;_0x2af2fa<_0x42dfc8[_0xa266('0x79')][_0xa266('0x3a')];_0x2af2fa+=0x1){if(_0x42dfc8['joins'][_0x2af2fa]['type']&&_['includes'](_0x514b9a,_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x31')])&&_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x7b')]&&_0x42dfc8['joins'][_0x2af2fa][_0xa266('0x7c')]&&_0x42dfc8[_0xa266('0x79')][_0x2af2fa]['foreignKey']){_0x57191a[_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x31')]](_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x7c')],null,util[_0xa266('0x73')](_0xa266('0x7d'),_0x42dfc8[_0xa266('0x70')],_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x7b')],_0x42dfc8[_0xa266('0x79')][_0x2af2fa][_0xa266('0x7c')],_0x42dfc8['joins'][_0x2af2fa]['foreignKey']));}}}if(_0x42dfc8['conditions']){_0x42dfc8['conditions']=JSON[_0xa266('0x7a')](_0x42dfc8[_0xa266('0x7e')]);_0x57191a['where'](_0x5688c3(_0x42dfc8['conditions'][_0xa266('0x65')]));}_0xe90b55=_0x57191a[_0xa266('0x7f')]();_0x57191a[_0xa266('0x3c')](_0x1525a5);_0x57191a[_0xa266('0x1c')](0x0);logger[_0xa266('0x80')](_0xa266('0x81'),_0x57191a[_0xa266('0x82')]());return dbH['sequelize'][_0xa266('0x34')](_0x57191a['toString'](),{'type':dbH[_0xa266('0x83')][_0xa266('0x84')][_0xa266('0x85')]});}})['then'](respondWithResult(_0x146621,null))[_0xa266('0x48')](handleError(_0x146621,null));};function runReport(_0x222bfd,_0x292a8d,_0x521d21){var _0x13d356=_0x292a8d[_0xa266('0x2b')];var _0x4886ec=0xa;var _0x34eaaf=[_0xa266('0x54'),_0xa266('0x55'),_0xa266('0x86'),_0xa266('0x56')];var _0x895da={'SUM':_0xa266('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa266('0x58'),'MIN':'MIN(%s)','AVG':_0xa266('0x87'),'GROUP_CONCAT':_0xa266('0x5a'),'GROUP_CONCAT ASC':_0xa266('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2f7fd1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xa266('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xa266('0x88')};var _0x5d9e82=function(_0x7b985c){return!_[_0xa266('0x89')]([_0xa266('0x60'),_0xa266('0x8a'),_0xa266('0x61'),_0xa266('0x62')],_0x7b985c);};var _0x41288c=function(_0x3d4eb8){if(!_0x3d4eb8||!_0x3d4eb8[_0xa266('0x63')]['length']){return'';}for(var _0x140e59='(',_0x3270e1=0x0;_0x3270e1<_0x3d4eb8['rules'][_0xa266('0x3a')];_0x3270e1+=0x1){_0x3270e1>0x0&&(_0x140e59+='\x20'+_0x3d4eb8[_0xa266('0x64')]+'\x20');_0x140e59+=_0x3d4eb8['rules'][_0x3270e1]['group']?_0x41288c(_0x3d4eb8[_0xa266('0x63')][_0x3270e1][_0xa266('0x65')]):_0x3d4eb8[_0xa266('0x63')][_0x3270e1]['field']+'\x20'+_0x3d4eb8[_0xa266('0x63')][_0x3270e1][_0xa266('0x67')]+(_0x5d9e82(_0x3d4eb8[_0xa266('0x63')][_0x3270e1][_0xa266('0x67')])?'\x20'+_0x3d4eb8[_0xa266('0x63')][_0x3270e1][_0xa266('0x68')]:'');}return _0x140e59+')';};var _0x1c7310={'where':{'id':_0x222bfd['id']}},_0x4b5d22,_0x1b3020,_0xdf661,_0x58b2fe,_0x4a9915;_0x1c7310=_[_0xa266('0x40')]({},_0x1c7310,_0x521d21);return db[_0xa266('0x2e')]['find'](_0x1c7310)[_0xa266('0x24')](function(_0x184d5b){if(_0x184d5b){_0x4b5d22=_0x184d5b;return _0x184d5b['getFields']();}return null;})['then'](function(_0x1c47c4){if(_0x1c47c4){if(!_0x1c47c4[_0xa266('0x3a')]){throw new db[(_0xa266('0x6a'))]['ValidationErrorItem'](_0xa266('0x6c'),0x193);}_0x1b3020=_0x1c47c4;return db[_0xa266('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5b6d49){if(_0x5b6d49){_0xdf661=_[_0xa266('0x8b')](_0x5b6d49,'id');var _0xdf7c4;var _0x2cb317=squel[_0xa266('0x6e')]();_0x2cb317['from'](_0x4b5d22[_0xa266('0x70')]);for(var _0x1a63e0=0x0;_0x1a63e0<_0x1b3020['length'];_0x1a63e0+=0x1){_0xdf7c4=_0x1b3020[_0x1a63e0][_0xa266('0x71')]?_0xdf661[_0x1b3020[_0x1a63e0][_0xa266('0x71')]][_0xa266('0x8c')]:_0x1b3020[_0x1a63e0]['field'];_0xdf7c4=_0x1b3020[_0x1a63e0][_0xa266('0x72')]?_[_0xa266('0x8d')](_0x895da[_0x1b3020[_0x1a63e0]['function']],'%s',_0xdf7c4):_0xdf7c4;_0xdf7c4=_0x1b3020[_0x1a63e0][_0xa266('0x73')]?_[_0xa266('0x8d')](_0x2f7fd1[_0x1b3020[_0x1a63e0][_0xa266('0x73')]],'%s',_0xdf7c4):_0xdf7c4;if(_0x1b3020[_0x1a63e0]['groupBy']){_0x2cb317[_0xa266('0x65')](_0xdf7c4);}_0x1b3020[_0x1a63e0][_0xa266('0x75')]&&_0x2cb317[_0xa266('0x76')](_0xdf7c4,_0x1b3020[_0x1a63e0][_0xa266('0x75')]===_0xa266('0x77')?![]:!![]);_0x2cb317[_0xa266('0x66')](_0xdf7c4,_0x1b3020[_0x1a63e0]['alias']||_0xdf7c4);}if(_0x4b5d22[_0xa266('0x79')]){_0x4b5d22[_0xa266('0x79')]=JSON['parse'](_0x4b5d22['joins']);for(var _0x5e5912=0x0;_0x5e5912<_0x4b5d22[_0xa266('0x79')]['length'];_0x5e5912+=0x1){if(_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x31')]&&_[_0xa266('0x89')](_0x34eaaf,_0x4b5d22[_0xa266('0x79')][_0x5e5912]['type'])&&_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x7b')]&&_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x7c')]&&_0x4b5d22['joins'][_0x5e5912][_0xa266('0x8e')]){_0x2cb317[_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x31')]](_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x7c')],null,util[_0xa266('0x73')](_0xa266('0x7d'),_0x4b5d22['table'],_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x7b')],_0x4b5d22['joins'][_0x5e5912][_0xa266('0x7c')],_0x4b5d22[_0xa266('0x79')][_0x5e5912][_0xa266('0x8e')]));}}}if(_0x4b5d22[_0xa266('0x7e')]){_0x4b5d22['conditions']=JSON[_0xa266('0x7a')](_0x4b5d22[_0xa266('0x7e')]);_0x2cb317[_0xa266('0x3e')](_0x41288c(_0x4b5d22[_0xa266('0x7e')][_0xa266('0x65')]));}_0x4a9915=_0x2cb317[_0xa266('0x7f')]();_0x2cb317[_0xa266('0x3c')](_0x4886ec);_0x2cb317[_0xa266('0x1c')](0x0);return;}})[_0xa266('0x24')](function(){if(_0x292a8d[_0xa266('0x8f')]===_0xa266('0x90')){return null;}var _0x43887d=_[_0xa266('0x40')](_0x292a8d,{'name':_0x292a8d[_0xa266('0x91')]||_0x292a8d[_0xa266('0x2b')]||_0x4b5d22[_0xa266('0x2b')],'basename':_0x13d356,'savename':util[_0xa266('0x73')](_0xa266('0x92'),_0x292a8d[_0xa266('0x2b')]||_0x4b5d22['name'],require(_0xa266('0x93'))[_0xa266('0x94')](0x4),_0x292a8d['output']||_0xa266('0x95')),'reportId':_0x4b5d22['id'],'reportType':_0xa266('0x96')});return db[_0xa266('0x97')][_0xa266('0x4b')](_0x43887d,{'raw':!![]});})[_0xa266('0x24')](function(_0x2a3fd1){if(_0x4b5d22[_0xa266('0x70')]==='cdr'){_0x4a9915['where'](_0x4b5d22[_0xa266('0x70')]+_0xa266('0x98'),_0x292a8d[_0xa266('0x99')],_0x292a8d[_0xa266('0x9a')]);}else{_0x4a9915[_0xa266('0x3e')](_0x4b5d22[_0xa266('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x292a8d[_0xa266('0x99')],_0x292a8d['endDate']);}if(_0x2a3fd1){logger[_0xa266('0x9b')]('Run\x20Query:',_0x4a9915[_0xa266('0x82')]());require('child_process')[_0xa266('0x9c')](path[_0xa266('0x54')](__dirname,_0xa266('0x9d'),_0x2a3fd1[_0xa266('0x8f')]),[_0x2a3fd1['id'],_0x4a9915['toString'](),path['join'](__dirname,_0xa266('0x9e'),_0x2a3fd1[_0xa266('0x9f')]),_0x13d356]);return _0x2a3fd1;}else{var _0x5972bc=squel[_0xa266('0x6e')]();_0x5972bc[_0xa266('0x6f')]('('+_0x4a9915[_0xa266('0x82')]()+')',_0xa266('0xa0'));_0x5972bc[_0xa266('0x66')](_0xa266('0xa1'),'count');_0x4a9915[_0xa266('0x3c')](_0x292a8d[_0xa266('0x3c')]||_0x4886ec);_0x4a9915[_0xa266('0x1c')](_0x292a8d[_0xa266('0x1c')]||0x0);return dbH[_0xa266('0x83')]['query'](_0x5972bc[_0xa266('0x82')](),{'type':dbH[_0xa266('0x83')]['QueryTypes'][_0xa266('0x85')]})[_0xa266('0x24')](function(_0x484dea){if(!_0x484dea[_0xa266('0x3a')]){_0x58b2fe=0x0;}else{_0x58b2fe=_0x484dea[0x0][_0xa266('0x1b')]||0x0;}return dbH[_0xa266('0x83')][_0xa266('0x34')](_0x4a9915[_0xa266('0x82')](),{'type':dbH[_0xa266('0x83')][_0xa266('0x84')][_0xa266('0x85')]});})[_0xa266('0x24')](function(_0x34fb97){return{'rows':_0x34fb97||[],'count':_0x58b2fe};});}});}exports[_0xa266('0xa2')]=function(_0x3fb948,_0xc8f546){return runReport(_0x3fb948['params'],_0x3fb948['query'],_0x3fb948['options'])[_0xa266('0x24')](respondWithResult(_0xc8f546,null))[_0xa266('0x48')](handleError(_0xc8f546,null));};exports[_0xa266('0xa3')]=runReport;exports[_0xa266('0x34')]=function(_0x487404,_0x4bdbd6){var _0x55bf5b=0xa;var _0x3ac40f=[_0xa266('0x54'),_0xa266('0x55'),'right_join',_0xa266('0x56')];var _0x59cd78={'SUM':_0xa266('0x57'),'COUNT':_0xa266('0xa4'),'COUNT DISTINCT':_0xa266('0xa5'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xa266('0x5a'),'GROUP_CONCAT ASC':_0xa266('0x5b'),'GROUP_CONCAT DESC':_0xa266('0x5c')};var _0x2eadde={'SEC_TO_TIME':_0xa266('0x5d'),'DATE':'DATE(%s)','HOUR':_0xa266('0x5f'),'ROUND':_0xa266('0xa6'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x43ce8f=function(_0x8c4b43){return!_[_0xa266('0x89')]([_0xa266('0x60'),_0xa266('0x8a'),_0xa266('0x61'),_0xa266('0x62')],_0x8c4b43);};var _0x1b7f96=function(_0x478d77){if(!_0x478d77||!_0x478d77[_0xa266('0x63')]['length']){return'';}for(var _0x2ee3ab='(',_0x35608d=0x0;_0x35608d<_0x478d77['rules'][_0xa266('0x3a')];_0x35608d+=0x1){_0x35608d>0x0&&(_0x2ee3ab+='\x20'+_0x478d77['operator']+'\x20');_0x2ee3ab+=_0x478d77[_0xa266('0x63')][_0x35608d]['group']?_0x1b7f96(_0x478d77[_0xa266('0x63')][_0x35608d]['group']):_0x478d77[_0xa266('0x63')][_0x35608d][_0xa266('0x66')]+'\x20'+_0x478d77['rules'][_0x35608d][_0xa266('0x67')]+(_0x43ce8f(_0x478d77[_0xa266('0x63')][_0x35608d][_0xa266('0x67')])?'\x20'+_0x478d77[_0xa266('0x63')][_0x35608d][_0xa266('0x68')]:'');}return _0x2ee3ab+')';};var _0x481e54={'where':{'id':_0x487404[_0xa266('0x53')]['id']}},_0x22e126,_0x312c64,_0x5a7288,_0x30bf50,_0x5ef0ad;_0x481e54=_['merge']({},_0x481e54,_0x487404[_0xa266('0x44')]);return db['AnalyticCustomReport']['find'](_0x481e54)[_0xa266('0x24')](function(_0x208cc1){if(_0x208cc1){_0x22e126=_0x208cc1;return _0x208cc1[_0xa266('0x69')]();}return null;})['then'](function(_0x58ff59){if(_0x58ff59){if(!_0x58ff59[_0xa266('0x3a')]){throw new db['Sequelize'][(_0xa266('0x6b'))](_0xa266('0x6c'),0x193);}_0x312c64=_0x58ff59;return db[_0xa266('0x6d')][_0xa266('0x47')]({'raw':!![]});}return null;})[_0xa266('0x24')](function(_0x5033b1){if(_0x5033b1){_0x5a7288=_[_0xa266('0x8b')](_0x5033b1,'id');var _0x93972d;var _0xd513bf=squel[_0xa266('0x6e')]();_0xd513bf[_0xa266('0x6f')](_0x22e126[_0xa266('0x70')]);for(var _0x21778b=0x0;_0x21778b<_0x312c64[_0xa266('0x3a')];_0x21778b+=0x1){_0x93972d=_0x312c64[_0x21778b][_0xa266('0x71')]?_0x5a7288[_0x312c64[_0x21778b][_0xa266('0x71')]][_0xa266('0x8c')]:_0x312c64[_0x21778b][_0xa266('0x66')];_0x93972d=_0x312c64[_0x21778b][_0xa266('0x72')]?_['replace'](_0x59cd78[_0x312c64[_0x21778b][_0xa266('0x72')]],'%s',_0x93972d):_0x93972d;_0x93972d=_0x312c64[_0x21778b]['format']?_[_0xa266('0x8d')](_0x2eadde[_0x312c64[_0x21778b][_0xa266('0x73')]],'%s',_0x93972d):_0x93972d;if(_0x312c64[_0x21778b]['groupBy']){_0xd513bf[_0xa266('0x65')](_0x93972d);}_0x312c64[_0x21778b][_0xa266('0x75')]&&_0xd513bf[_0xa266('0x76')](_0x93972d,_0x312c64[_0x21778b][_0xa266('0x75')]===_0xa266('0x77')?![]:!![]);_0xd513bf['field'](_0x93972d,_0x312c64[_0x21778b][_0xa266('0x78')]||_0x93972d);}if(_0x22e126[_0xa266('0x79')]){_0x22e126[_0xa266('0x79')]=JSON[_0xa266('0x7a')](_0x22e126[_0xa266('0x79')]);for(var _0x6a9698=0x0;_0x6a9698<_0x22e126[_0xa266('0x79')]['length'];_0x6a9698+=0x1){if(_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x31')]&&_[_0xa266('0x89')](_0x3ac40f,_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x31')])&&_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x7b')]&&_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x7c')]&&_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x8e')]){_0xd513bf[_0x22e126[_0xa266('0x79')][_0x6a9698]['type']](_0x22e126['joins'][_0x6a9698][_0xa266('0x7c')],null,util[_0xa266('0x73')](_0xa266('0x7d'),_0x22e126[_0xa266('0x70')],_0x22e126['joins'][_0x6a9698][_0xa266('0x7b')],_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x7c')],_0x22e126[_0xa266('0x79')][_0x6a9698][_0xa266('0x8e')]));}}}if(_0x22e126['conditions']){_0x22e126[_0xa266('0x7e')]=JSON[_0xa266('0x7a')](_0x22e126[_0xa266('0x7e')]);_0xd513bf[_0xa266('0x3e')](_0x1b7f96(_0x22e126[_0xa266('0x7e')]['group']));}_0x5ef0ad=_0xd513bf[_0xa266('0x7f')]();_0xd513bf[_0xa266('0x3c')](_0x55bf5b);_0xd513bf['offset'](0x0);logger[_0xa266('0x80')]('Limited\x20Query:',_0xd513bf[_0xa266('0x82')]());return dbH[_0xa266('0x83')][_0xa266('0x34')](_0xd513bf['toString'](),{'type':dbH[_0xa266('0x83')]['QueryTypes'][_0xa266('0x85')]});}})[_0xa266('0x24')](function(){return{'sql':_0x5ef0ad[_0xa266('0x82')]()};})[_0xa266('0x24')](respondWithResult(_0x4bdbd6,null))[_0xa266('0x48')](handleError(_0x4bdbd6,null));}; \ No newline at end of file +var _0xfc2e=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','metric','groupBy','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','run','runReport','alias','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','CustomReports','UserProfileResource','destroy','stack','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','AnalyticCustomReport','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Reports','UserProfileSection','userProfileId','autoAssociation','error','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\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone'];(function(_0x3ece35,_0x1fb93c){var _0x35ce47=function(_0x316f60){while(--_0x316f60){_0x3ece35['push'](_0x3ece35['shift']());}};_0x35ce47(++_0x1fb93c);}(_0xfc2e,0x179));var _0xefc2=function(_0x14c4eb,_0x3f0680){_0x14c4eb=_0x14c4eb-0x0;var _0x33574c=_0xfc2e[_0x14c4eb];return _0x33574c;};'use strict';var emlformat=require(_0xefc2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xefc2('0x1'));var rp=require(_0xefc2('0x2'));var moment=require(_0xefc2('0x3'));var BPromise=require(_0xefc2('0x4'));var Mustache=require(_0xefc2('0x5'));var util=require(_0xefc2('0x6'));var path=require(_0xefc2('0x7'));var sox=require(_0xefc2('0x8'));var csv=require(_0xefc2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefc2('0xa'));var _=require(_0xefc2('0xb'));var squel=require('squel');var crypto=require(_0xefc2('0xc'));var jsforce=require(_0xefc2('0xd'));var deskjs=require(_0xefc2('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefc2('0xf'));var Redis=require(_0xefc2('0x10'));var authService=require(_0xefc2('0x11'));var qs=require(_0xefc2('0x12'));var as=require(_0xefc2('0x13'));var hardwareService=require(_0xefc2('0x14'));var logger=require(_0xefc2('0x15'))(_0xefc2('0x16'));var utils=require(_0xefc2('0x17'));var config=require(_0xefc2('0x18'));var licenseUtil=require(_0xefc2('0x19'));var db=require(_0xefc2('0x1a'))['db'];var dbH=require(_0xefc2('0x1a'))['dbH'];function respondWithStatusCode(_0x2c4f33,_0x155690){_0x155690=_0x155690||0xcc;return function(_0x175919){if(_0x175919){return _0x2c4f33[_0xefc2('0x1b')](_0x155690);}return _0x2c4f33[_0xefc2('0x1c')](_0x155690)[_0xefc2('0x1d')]();};}function respondWithResult(_0x1eacce,_0x27e1b6){_0x27e1b6=_0x27e1b6||0xc8;return function(_0x18ad12){if(_0x18ad12){return _0x1eacce[_0xefc2('0x1c')](_0x27e1b6)['json'](_0x18ad12);}};}function respondWithFilteredResult(_0xd11941,_0x10ec63){return function(_0x126ed4){if(_0x126ed4){var _0x273481=typeof _0x10ec63[_0xefc2('0x1e')]==='undefined'&&typeof _0x10ec63[_0xefc2('0x1f')]===_0xefc2('0x20');var _0x38606b=_0x126ed4['count'];var _0x458215=_0x273481?0x0:_0x10ec63[_0xefc2('0x1e')];var _0x165171=_0x273481?_0x126ed4[_0xefc2('0x21')]:_0x10ec63[_0xefc2('0x1e')]+_0x10ec63[_0xefc2('0x1f')];var _0x14364f;if(_0x165171>=_0x38606b){_0x165171=_0x38606b;_0x14364f=0xc8;}else{_0x14364f=0xce;}_0xd11941[_0xefc2('0x1c')](_0x14364f);return _0xd11941[_0xefc2('0x22')](_0xefc2('0x23'),_0x458215+'-'+_0x165171+'/'+_0x38606b)[_0xefc2('0x24')](_0x126ed4);}return null;};}function patchUpdates(_0x3f0cf5){return function(_0xd4ba5c){try{jsonpatch[_0xefc2('0x25')](_0xd4ba5c,_0x3f0cf5,!![]);}catch(_0xe04c93){return BPromise[_0xefc2('0x26')](_0xe04c93);}return _0xd4ba5c[_0xefc2('0x27')]();};}function saveUpdates(_0x1349b8,_0x55090c){return function(_0x4bf9fa){if(_0x4bf9fa){return _0x4bf9fa[_0xefc2('0x28')](_0x1349b8)[_0xefc2('0x29')](function(_0x7add2d){return _0x7add2d;});}return null;};}function removeEntity(_0x2b6ef5,_0x4d5cbe){return function(_0x1ce3a4){if(_0x1ce3a4){return _0x1ce3a4['destroy']()[_0xefc2('0x29')](function(){var _0x143e24=_0x1ce3a4['get']({'plain':!![]});var _0x229958=_0xefc2('0x2a');return db[_0xefc2('0x2b')][_0xefc2('0x2c')]({'where':{'type':_0x229958,'resourceId':_0x143e24['id']}})[_0xefc2('0x29')](function(){return _0x1ce3a4;});})[_0xefc2('0x29')](function(){_0x2b6ef5[_0xefc2('0x1c')](0xcc)[_0xefc2('0x1d')]();});}};}function handleEntityNotFound(_0x3d8cd1,_0x26f056){return function(_0x3041c0){if(!_0x3041c0){_0x3d8cd1[_0xefc2('0x1b')](0x194);}return _0x3041c0;};}function handleError(_0x50deef,_0x4125df){_0x4125df=_0x4125df||0x1f4;return function(_0xd8dc0a){logger['error'](_0xd8dc0a[_0xefc2('0x2d')]);if(_0xd8dc0a['name']){delete _0xd8dc0a['name'];}_0x50deef[_0xefc2('0x1c')](_0x4125df)[_0xefc2('0x2e')](_0xd8dc0a);};}exports[_0xefc2('0x2f')]=function(_0x2e1d86,_0xdd7402){var _0x367814={},_0x150902={},_0x4239d7={'count':0x0,'rows':[]};var _0x3dc9ad=_[_0xefc2('0x30')](db['AnalyticCustomReport'][_0xefc2('0x31')],function(_0x14c30c){return{'name':_0x14c30c[_0xefc2('0x32')],'type':_0x14c30c[_0xefc2('0x33')]['key']};});_0x150902[_0xefc2('0x34')]=_[_0xefc2('0x30')](_0x3dc9ad,_0xefc2('0x35'));_0x150902[_0xefc2('0x36')]=_[_0xefc2('0x37')](_0x2e1d86['query']);_0x150902[_0xefc2('0x38')]=_[_0xefc2('0x39')](_0x150902[_0xefc2('0x34')],_0x150902[_0xefc2('0x36')]);_0x367814[_0xefc2('0x3a')]=_[_0xefc2('0x39')](_0x150902[_0xefc2('0x34')],qs[_0xefc2('0x3b')](_0x2e1d86['query']['fields']));_0x367814[_0xefc2('0x3a')]=_0x367814['attributes'][_0xefc2('0x3c')]?_0x367814[_0xefc2('0x3a')]:_0x150902[_0xefc2('0x34')];if(!_0x2e1d86[_0xefc2('0x36')][_0xefc2('0x3d')](_0xefc2('0x3e'))){_0x367814['limit']=qs['limit'](_0x2e1d86['query']['limit']);_0x367814[_0xefc2('0x1e')]=qs[_0xefc2('0x1e')](_0x2e1d86[_0xefc2('0x36')]['offset']);}_0x367814[_0xefc2('0x3f')]=qs[_0xefc2('0x40')](_0x2e1d86[_0xefc2('0x36')][_0xefc2('0x40')]);_0x367814[_0xefc2('0x41')]=qs[_0xefc2('0x38')](_[_0xefc2('0x42')](_0x2e1d86[_0xefc2('0x36')],_0x150902[_0xefc2('0x38')]),_0x3dc9ad);if(_0x2e1d86[_0xefc2('0x36')][_0xefc2('0x43')]){_0x367814[_0xefc2('0x41')]=_[_0xefc2('0x44')](_0x367814['where'],{'$or':_[_0xefc2('0x30')](_0x3dc9ad,function(_0x2776dd){if(_0x2776dd[_0xefc2('0x33')]!==_0xefc2('0x45')){var _0x5611cd={};_0x5611cd[_0x2776dd['name']]={'$like':'%'+_0x2e1d86['query'][_0xefc2('0x43')]+'%'};return _0x5611cd;}})});}_0x367814=_[_0xefc2('0x44')]({},_0x367814,_0x2e1d86[_0xefc2('0x46')]);var _0x38f41c={'where':_0x367814[_0xefc2('0x41')]};return db['AnalyticCustomReport'][_0xefc2('0x21')](_0x38f41c)[_0xefc2('0x29')](function(_0x32bb0b){_0x4239d7[_0xefc2('0x21')]=_0x32bb0b;if(_0x2e1d86[_0xefc2('0x36')][_0xefc2('0x47')]){_0x367814[_0xefc2('0x48')]=[{'all':!![]}];}return db[_0xefc2('0x49')][_0xefc2('0x4a')](_0x367814);})[_0xefc2('0x29')](function(_0x2ff893){_0x4239d7[_0xefc2('0x4b')]=_0x2ff893;return _0x4239d7;})[_0xefc2('0x29')](respondWithFilteredResult(_0xdd7402,_0x367814))[_0xefc2('0x4c')](handleError(_0xdd7402,null));};exports[_0xefc2('0x4d')]=function(_0x2fba9c,_0x5bea1c){var _0x448359={'raw':![],'where':{'id':_0x2fba9c[_0xefc2('0x4e')]['id']}},_0x22ce92={};_0x22ce92[_0xefc2('0x34')]=_[_0xefc2('0x37')](db['AnalyticCustomReport'][_0xefc2('0x31')]);_0x22ce92[_0xefc2('0x36')]=_[_0xefc2('0x37')](_0x2fba9c[_0xefc2('0x36')]);_0x22ce92['filters']=_[_0xefc2('0x39')](_0x22ce92[_0xefc2('0x34')],_0x22ce92[_0xefc2('0x36')]);_0x448359[_0xefc2('0x3a')]=_['intersection'](_0x22ce92[_0xefc2('0x34')],qs[_0xefc2('0x3b')](_0x2fba9c[_0xefc2('0x36')][_0xefc2('0x3b')]));_0x448359[_0xefc2('0x3a')]=_0x448359[_0xefc2('0x3a')][_0xefc2('0x3c')]?_0x448359[_0xefc2('0x3a')]:_0x22ce92['model'];if(_0x2fba9c[_0xefc2('0x36')][_0xefc2('0x47')]){_0x448359[_0xefc2('0x48')]=[{'all':!![]}];}_0x448359=_[_0xefc2('0x44')]({},_0x448359,_0x2fba9c[_0xefc2('0x46')]);return db[_0xefc2('0x49')][_0xefc2('0x4f')](_0x448359)[_0xefc2('0x29')](handleEntityNotFound(_0x5bea1c,null))[_0xefc2('0x29')](respondWithResult(_0x5bea1c,null))[_0xefc2('0x4c')](handleError(_0x5bea1c,null));};exports[_0xefc2('0x50')]=function(_0x283618,_0xa92c5){return db[_0xefc2('0x49')][_0xefc2('0x50')](_0x283618[_0xefc2('0x51')],{})[_0xefc2('0x29')](function(_0x8e52ca){var _0x2750a4=_0x283618[_0xefc2('0x52')]['get']({'plain':!![]});if(!_0x2750a4)throw new Error(_0xefc2('0x53'));if(_0x2750a4[_0xefc2('0x54')]===_0xefc2('0x52')){var _0x522633=_0x8e52ca[_0xefc2('0x55')]({'plain':!![]});var _0xc519a4=_0xefc2('0x56');return db[_0xefc2('0x57')][_0xefc2('0x4f')]({'where':{'name':_0xc519a4,'userProfileId':_0x2750a4[_0xefc2('0x58')]},'raw':!![]})[_0xefc2('0x29')](function(_0x325159){if(_0x325159&&_0x325159[_0xefc2('0x59')]===0x0){return db['UserProfileResource'][_0xefc2('0x50')]({'name':_0x522633['name'],'resourceId':_0x522633['id'],'type':'CustomReports','sectionId':_0x325159['id']},{})['then'](function(){return _0x8e52ca;});}else{return _0x8e52ca;}})[_0xefc2('0x4c')](function(_0x49b0da){logger[_0xefc2('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49b0da);throw _0x49b0da;});}return _0x8e52ca;})[_0xefc2('0x29')](respondWithResult(_0xa92c5,0xc9))[_0xefc2('0x4c')](handleError(_0xa92c5,null));};exports[_0xefc2('0x28')]=function(_0x266b13,_0x33d2bf){if(_0x266b13[_0xefc2('0x51')]['id']){delete _0x266b13[_0xefc2('0x51')]['id'];}return db[_0xefc2('0x49')][_0xefc2('0x4f')]({'where':{'id':_0x266b13['params']['id']}})[_0xefc2('0x29')](handleEntityNotFound(_0x33d2bf,null))['then'](saveUpdates(_0x266b13[_0xefc2('0x51')],null))[_0xefc2('0x29')](respondWithResult(_0x33d2bf,null))[_0xefc2('0x4c')](handleError(_0x33d2bf,null));};exports[_0xefc2('0x2c')]=function(_0x163e91,_0x44f7a2){return db['AnalyticCustomReport'][_0xefc2('0x4f')]({'where':{'id':_0x163e91['params']['id']}})[_0xefc2('0x29')](handleEntityNotFound(_0x44f7a2,null))['then'](removeEntity(_0x44f7a2,null))[_0xefc2('0x4c')](handleError(_0x44f7a2,null));};exports[_0xefc2('0x5b')]=function(_0x226ca3,_0x179a79){var _0x52e885=0xa;var _0x345644=['join',_0xefc2('0x5c'),_0xefc2('0x5d'),_0xefc2('0x5e')];var _0x1a9381={'SUM':_0xefc2('0x5f'),'COUNT':_0xefc2('0x60'),'COUNT DISTINCT':_0xefc2('0x61'),'MAX':_0xefc2('0x62'),'MIN':_0xefc2('0x63'),'AVG':_0xefc2('0x64'),'GROUP_CONCAT':_0xefc2('0x65'),'GROUP_CONCAT ASC':_0xefc2('0x66'),'GROUP_CONCAT DESC':_0xefc2('0x67')};var _0x29d3a8={'SEC_TO_TIME':_0xefc2('0x68'),'DATE':_0xefc2('0x69'),'HOUR':_0xefc2('0x6a'),'ROUND':_0xefc2('0x6b'),'UNIX_TIMESTAMP':_0xefc2('0x6c')};var _0x41207a=function(_0x41c1f2){return!_[_0xefc2('0x6d')]([_0xefc2('0x6e'),_0xefc2('0x6f'),_0xefc2('0x70'),_0xefc2('0x71')],_0x41c1f2);};var _0xfb9529=function(_0x534ac4){if(!_0x534ac4||!_0x534ac4['rules'][_0xefc2('0x3c')]){return'';}for(var _0x1d2b83='(',_0x6453ee=0x0;_0x6453ee<_0x534ac4[_0xefc2('0x72')][_0xefc2('0x3c')];_0x6453ee+=0x1){_0x6453ee>0x0&&(_0x1d2b83+='\x20'+_0x534ac4[_0xefc2('0x73')]+'\x20');_0x1d2b83+=_0x534ac4['rules'][_0x6453ee][_0xefc2('0x74')]?_0xfb9529(_0x534ac4['rules'][_0x6453ee]['group']):_0x534ac4['rules'][_0x6453ee][_0xefc2('0x75')]+'\x20'+_0x534ac4[_0xefc2('0x72')][_0x6453ee][_0xefc2('0x76')]+(_0x41207a(_0x534ac4[_0xefc2('0x72')][_0x6453ee][_0xefc2('0x76')])?'\x20'+_0x534ac4[_0xefc2('0x72')][_0x6453ee][_0xefc2('0x77')]:'');}return _0x1d2b83+')';};var _0x6254d3={'where':{'id':_0x226ca3[_0xefc2('0x4e')]['id']}},_0x1b13eb,_0x329812,_0x95a907,_0x3fc979,_0x4ad50e;_0x6254d3=_['merge']({},_0x6254d3,_0x226ca3['options']);return db['AnalyticCustomReport'][_0xefc2('0x4f')](_0x6254d3)[_0xefc2('0x29')](function(_0x2763bd){if(_0x2763bd){_0x1b13eb=_0x2763bd;return _0x2763bd[_0xefc2('0x78')]();}return null;})[_0xefc2('0x29')](function(_0x3f969d){if(_0x3f969d){if(!_0x3f969d[_0xefc2('0x3c')]){throw new db[(_0xefc2('0x79'))]['ValidationErrorItem'](_0xefc2('0x7a'),0x193);}_0x329812=_0x3f969d;return db[_0xefc2('0x7b')]['findAll']({'raw':!![]});}return null;})[_0xefc2('0x29')](function(_0x367e8a){if(_0x367e8a){_0x95a907=_[_0xefc2('0x7c')](_0x367e8a,'id');var _0x1d4dc1;var _0x573c4a=squel[_0xefc2('0x7d')]();_0x573c4a[_0xefc2('0x7e')](_0x1b13eb['table']);for(var _0xaeb68a=0x0;_0xaeb68a<_0x329812[_0xefc2('0x3c')];_0xaeb68a+=0x1){_0x1d4dc1=_0x329812[_0xaeb68a][_0xefc2('0x7f')]?_0x95a907[_0x329812[_0xaeb68a]['MetricId']]['metric']:_0x329812[_0xaeb68a]['field'];_0x1d4dc1=_0x329812[_0xaeb68a][_0xefc2('0x80')]?_[_0xefc2('0x81')](_0x1a9381[_0x329812[_0xaeb68a][_0xefc2('0x80')]],'%s',_0x1d4dc1):_0x1d4dc1;_0x1d4dc1=_0x329812[_0xaeb68a]['format']?_[_0xefc2('0x81')](_0x29d3a8[_0x329812[_0xaeb68a][_0xefc2('0x82')]],'%s',_0x1d4dc1):_0x1d4dc1;if(_0x329812[_0xaeb68a]['groupBy']){_0x573c4a[_0xefc2('0x74')](_0x1d4dc1);}_0x329812[_0xaeb68a][_0xefc2('0x83')]&&_0x573c4a[_0xefc2('0x3f')](_0x1d4dc1,_0x329812[_0xaeb68a][_0xefc2('0x83')]===_0xefc2('0x84')?![]:!![]);_0x573c4a[_0xefc2('0x75')](_0x1d4dc1,_0x329812[_0xaeb68a]['alias']||_0x1d4dc1);}if(_0x1b13eb[_0xefc2('0x85')]){_0x1b13eb[_0xefc2('0x85')]=JSON[_0xefc2('0x86')](_0x1b13eb[_0xefc2('0x85')]);for(var _0x4fa9ba=0x0;_0x4fa9ba<_0x1b13eb['joins'][_0xefc2('0x3c')];_0x4fa9ba+=0x1){if(_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x33')]&&_[_0xefc2('0x6d')](_0x345644,_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x33')])&&_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x87')]&&_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x88')]&&_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x89')]){_0x573c4a[_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x33')]](_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x88')],null,util[_0xefc2('0x82')](_0xefc2('0x8a'),_0x1b13eb[_0xefc2('0x8b')],_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x87')],_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x88')],_0x1b13eb[_0xefc2('0x85')][_0x4fa9ba][_0xefc2('0x89')]));}}}if(_0x1b13eb[_0xefc2('0x8c')]){_0x1b13eb[_0xefc2('0x8c')]=JSON['parse'](_0x1b13eb[_0xefc2('0x8c')]);_0x573c4a[_0xefc2('0x41')](_0xfb9529(_0x1b13eb['conditions'][_0xefc2('0x74')]));}_0x4ad50e=_0x573c4a[_0xefc2('0x8d')]();_0x573c4a[_0xefc2('0x1f')](_0x52e885);_0x573c4a[_0xefc2('0x1e')](0x0);logger[_0xefc2('0x8e')](_0xefc2('0x8f'),_0x573c4a[_0xefc2('0x90')]());return dbH[_0xefc2('0x91')][_0xefc2('0x36')](_0x573c4a[_0xefc2('0x90')](),{'type':dbH['sequelize'][_0xefc2('0x92')]['SELECT']});}})[_0xefc2('0x29')](respondWithResult(_0x179a79,null))[_0xefc2('0x4c')](handleError(_0x179a79,null));};function runReport(_0x1d3705,_0x452d6d,_0x3de9d9){var _0x58b088=_0x452d6d[_0xefc2('0x35')];var _0xacfbe0=0xa;var _0xc415e7=[_0xefc2('0x93'),_0xefc2('0x5c'),_0xefc2('0x5d'),_0xefc2('0x5e')];var _0x20c1b1={'SUM':_0xefc2('0x5f'),'COUNT':_0xefc2('0x60'),'COUNT DISTINCT':_0xefc2('0x61'),'MAX':_0xefc2('0x62'),'MIN':_0xefc2('0x63'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xefc2('0x66'),'GROUP_CONCAT DESC':_0xefc2('0x67')};var _0x17abf8={'SEC_TO_TIME':_0xefc2('0x68'),'DATE':_0xefc2('0x69'),'HOUR':_0xefc2('0x6a'),'ROUND':_0xefc2('0x6b'),'UNIX_TIMESTAMP':_0xefc2('0x6c')};var _0x384d11=function(_0x388af2){return!_['includes'](['IS\x20NULL',_0xefc2('0x6f'),_0xefc2('0x70'),'IS\x20NOT\x20EMPTY'],_0x388af2);};var _0x16ed2c=function(_0x5f164b){if(!_0x5f164b||!_0x5f164b[_0xefc2('0x72')]['length']){return'';}for(var _0x4c9c6a='(',_0x299560=0x0;_0x299560<_0x5f164b[_0xefc2('0x72')][_0xefc2('0x3c')];_0x299560+=0x1){_0x299560>0x0&&(_0x4c9c6a+='\x20'+_0x5f164b['operator']+'\x20');_0x4c9c6a+=_0x5f164b[_0xefc2('0x72')][_0x299560][_0xefc2('0x74')]?_0x16ed2c(_0x5f164b['rules'][_0x299560]['group']):_0x5f164b['rules'][_0x299560]['field']+'\x20'+_0x5f164b[_0xefc2('0x72')][_0x299560][_0xefc2('0x76')]+(_0x384d11(_0x5f164b[_0xefc2('0x72')][_0x299560]['condition'])?'\x20'+_0x5f164b['rules'][_0x299560]['value']:'');}return _0x4c9c6a+')';};var _0x3ac346={'where':{'id':_0x1d3705['id']}},_0x84f8fd,_0x3a1365,_0x3fb0e1,_0x3b0adb,_0x3fe19b;_0x3ac346=_[_0xefc2('0x44')]({},_0x3ac346,_0x3de9d9);return db[_0xefc2('0x49')][_0xefc2('0x4f')](_0x3ac346)[_0xefc2('0x29')](function(_0x4c2a61){if(_0x4c2a61){_0x84f8fd=_0x4c2a61;return _0x4c2a61['getFields']();}return null;})[_0xefc2('0x29')](function(_0x10a509){if(_0x10a509){if(!_0x10a509['length']){throw new db[(_0xefc2('0x79'))]['ValidationErrorItem'](_0xefc2('0x7a'),0x193);}_0x3a1365=_0x10a509;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xefc2('0x29')](function(_0x2ff4ac){if(_0x2ff4ac){_0x3fb0e1=_[_0xefc2('0x7c')](_0x2ff4ac,'id');var _0x1464a3;var _0x20623f=squel['select']();_0x20623f[_0xefc2('0x7e')](_0x84f8fd[_0xefc2('0x8b')]);for(var _0x1b8a09=0x0;_0x1b8a09<_0x3a1365[_0xefc2('0x3c')];_0x1b8a09+=0x1){_0x1464a3=_0x3a1365[_0x1b8a09]['MetricId']?_0x3fb0e1[_0x3a1365[_0x1b8a09][_0xefc2('0x7f')]][_0xefc2('0x94')]:_0x3a1365[_0x1b8a09][_0xefc2('0x75')];_0x1464a3=_0x3a1365[_0x1b8a09][_0xefc2('0x80')]?_[_0xefc2('0x81')](_0x20c1b1[_0x3a1365[_0x1b8a09][_0xefc2('0x80')]],'%s',_0x1464a3):_0x1464a3;_0x1464a3=_0x3a1365[_0x1b8a09][_0xefc2('0x82')]?_['replace'](_0x17abf8[_0x3a1365[_0x1b8a09]['format']],'%s',_0x1464a3):_0x1464a3;if(_0x3a1365[_0x1b8a09][_0xefc2('0x95')]){_0x20623f[_0xefc2('0x74')](_0x1464a3);}_0x3a1365[_0x1b8a09][_0xefc2('0x83')]&&_0x20623f[_0xefc2('0x3f')](_0x1464a3,_0x3a1365[_0x1b8a09][_0xefc2('0x83')]===_0xefc2('0x84')?![]:!![]);_0x20623f[_0xefc2('0x75')](_0x1464a3,_0x3a1365[_0x1b8a09]['alias']||_0x1464a3);}if(_0x84f8fd[_0xefc2('0x85')]){_0x84f8fd[_0xefc2('0x85')]=JSON['parse'](_0x84f8fd[_0xefc2('0x85')]);for(var _0x46d745=0x0;_0x46d745<_0x84f8fd[_0xefc2('0x85')][_0xefc2('0x3c')];_0x46d745+=0x1){if(_0x84f8fd[_0xefc2('0x85')][_0x46d745][_0xefc2('0x33')]&&_[_0xefc2('0x6d')](_0xc415e7,_0x84f8fd[_0xefc2('0x85')][_0x46d745][_0xefc2('0x33')])&&_0x84f8fd['joins'][_0x46d745]['parentKey']&&_0x84f8fd['joins'][_0x46d745][_0xefc2('0x88')]&&_0x84f8fd[_0xefc2('0x85')][_0x46d745][_0xefc2('0x89')]){_0x20623f[_0x84f8fd[_0xefc2('0x85')][_0x46d745][_0xefc2('0x33')]](_0x84f8fd[_0xefc2('0x85')][_0x46d745]['foreignTable'],null,util[_0xefc2('0x82')](_0xefc2('0x8a'),_0x84f8fd[_0xefc2('0x8b')],_0x84f8fd['joins'][_0x46d745][_0xefc2('0x87')],_0x84f8fd[_0xefc2('0x85')][_0x46d745]['foreignTable'],_0x84f8fd[_0xefc2('0x85')][_0x46d745]['foreignKey']));}}}if(_0x84f8fd['conditions']){_0x84f8fd[_0xefc2('0x8c')]=JSON[_0xefc2('0x86')](_0x84f8fd[_0xefc2('0x8c')]);_0x20623f[_0xefc2('0x41')](_0x16ed2c(_0x84f8fd['conditions']['group']));}_0x3fe19b=_0x20623f[_0xefc2('0x8d')]();_0x20623f[_0xefc2('0x1f')](_0xacfbe0);_0x20623f['offset'](0x0);return;}})[_0xefc2('0x29')](function(){if(_0x452d6d[_0xefc2('0x96')]==='web'){return null;}var _0x5389c4=_[_0xefc2('0x44')](_0x452d6d,{'name':_0x452d6d[_0xefc2('0x97')]||_0x452d6d[_0xefc2('0x35')]||_0x84f8fd[_0xefc2('0x35')],'basename':_0x58b088,'savename':util[_0xefc2('0x82')](_0xefc2('0x98'),_0x452d6d[_0xefc2('0x35')]||_0x84f8fd[_0xefc2('0x35')],require(_0xefc2('0x99'))[_0xefc2('0x9a')](0x4),_0x452d6d[_0xefc2('0x96')]||_0xefc2('0x9b')),'reportId':_0x84f8fd['id'],'reportType':_0xefc2('0x9c')});return db[_0xefc2('0x9d')]['create'](_0x5389c4,{'raw':!![]});})[_0xefc2('0x29')](function(_0x57403a){if(_0x84f8fd[_0xefc2('0x8b')]===_0xefc2('0x9e')){_0x3fe19b[_0xefc2('0x41')](_0x84f8fd[_0xefc2('0x8b')]+_0xefc2('0x9f'),_0x452d6d[_0xefc2('0xa0')],_0x452d6d[_0xefc2('0xa1')]);}else{_0x3fe19b['where'](_0x84f8fd[_0xefc2('0x8b')]+_0xefc2('0xa2'),_0x452d6d['startDate'],_0x452d6d['endDate']);}if(_0x57403a){logger[_0xefc2('0xa3')](_0xefc2('0xa4'),_0x3fe19b['toString']());require('child_process')['fork'](path[_0xefc2('0x93')](__dirname,_0xefc2('0xa5'),_0x57403a[_0xefc2('0x96')]),[_0x57403a['id'],_0x3fe19b['toString'](),path['join'](__dirname,_0xefc2('0xa6'),_0x57403a['savename']),_0x58b088]);return _0x57403a;}else{var _0x2b5ca5=squel[_0xefc2('0x7d')]();_0x2b5ca5[_0xefc2('0x7e')]('('+_0x3fe19b[_0xefc2('0x90')]()+')',_0xefc2('0xa7'));_0x2b5ca5[_0xefc2('0x75')](_0xefc2('0xa8'),_0xefc2('0x21'));_0x3fe19b['limit'](_0x452d6d['limit']||_0xacfbe0);_0x3fe19b[_0xefc2('0x1e')](_0x452d6d[_0xefc2('0x1e')]||0x0);return dbH['sequelize'][_0xefc2('0x36')](_0x2b5ca5[_0xefc2('0x90')](),{'type':dbH[_0xefc2('0x91')][_0xefc2('0x92')][_0xefc2('0xa9')]})[_0xefc2('0x29')](function(_0xf87033){if(!_0xf87033[_0xefc2('0x3c')]){_0x3b0adb=0x0;}else{_0x3b0adb=_0xf87033[0x0][_0xefc2('0x21')]||0x0;}return dbH[_0xefc2('0x91')]['query'](_0x3fe19b[_0xefc2('0x90')](),{'type':dbH[_0xefc2('0x91')][_0xefc2('0x92')][_0xefc2('0xa9')]});})['then'](function(_0x26f5e1){return{'rows':_0x26f5e1||[],'count':_0x3b0adb};});}});}exports[_0xefc2('0xaa')]=function(_0x4302dd,_0x3dd923){return runReport(_0x4302dd['params'],_0x4302dd['query'],_0x4302dd[_0xefc2('0x46')])[_0xefc2('0x29')](respondWithResult(_0x3dd923,null))[_0xefc2('0x4c')](handleError(_0x3dd923,null));};exports[_0xefc2('0xab')]=runReport;exports[_0xefc2('0x36')]=function(_0x5d864f,_0x30bb3c){var _0x19df3c=0xa;var _0x184717=[_0xefc2('0x93'),'left_join','right_join',_0xefc2('0x5e')];var _0x5c731e={'SUM':_0xefc2('0x5f'),'COUNT':_0xefc2('0x60'),'COUNT DISTINCT':_0xefc2('0x61'),'MAX':_0xefc2('0x62'),'MIN':_0xefc2('0x63'),'AVG':_0xefc2('0x64'),'GROUP_CONCAT':_0xefc2('0x65'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xefc2('0x67')};var _0x284a34={'SEC_TO_TIME':_0xefc2('0x68'),'DATE':_0xefc2('0x69'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xefc2('0x6c')};var _0x2ebc34=function(_0x24502b){return!_[_0xefc2('0x6d')]([_0xefc2('0x6e'),_0xefc2('0x6f'),_0xefc2('0x70'),_0xefc2('0x71')],_0x24502b);};var _0x4ab206=function(_0x413c82){if(!_0x413c82||!_0x413c82[_0xefc2('0x72')][_0xefc2('0x3c')]){return'';}for(var _0x2fe616='(',_0x636229=0x0;_0x636229<_0x413c82[_0xefc2('0x72')][_0xefc2('0x3c')];_0x636229+=0x1){_0x636229>0x0&&(_0x2fe616+='\x20'+_0x413c82['operator']+'\x20');_0x2fe616+=_0x413c82[_0xefc2('0x72')][_0x636229][_0xefc2('0x74')]?_0x4ab206(_0x413c82['rules'][_0x636229]['group']):_0x413c82[_0xefc2('0x72')][_0x636229][_0xefc2('0x75')]+'\x20'+_0x413c82[_0xefc2('0x72')][_0x636229][_0xefc2('0x76')]+(_0x2ebc34(_0x413c82[_0xefc2('0x72')][_0x636229][_0xefc2('0x76')])?'\x20'+_0x413c82['rules'][_0x636229][_0xefc2('0x77')]:'');}return _0x2fe616+')';};var _0x1ef06d={'where':{'id':_0x5d864f[_0xefc2('0x4e')]['id']}},_0x1c75c1,_0x27dfd3,_0x119e48,_0x3d300b,_0x5a2209;_0x1ef06d=_[_0xefc2('0x44')]({},_0x1ef06d,_0x5d864f[_0xefc2('0x46')]);return db[_0xefc2('0x49')][_0xefc2('0x4f')](_0x1ef06d)[_0xefc2('0x29')](function(_0x63a24e){if(_0x63a24e){_0x1c75c1=_0x63a24e;return _0x63a24e[_0xefc2('0x78')]();}return null;})[_0xefc2('0x29')](function(_0x394227){if(_0x394227){if(!_0x394227[_0xefc2('0x3c')]){throw new db[(_0xefc2('0x79'))]['ValidationErrorItem'](_0xefc2('0x7a'),0x193);}_0x27dfd3=_0x394227;return db[_0xefc2('0x7b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3b77d6){if(_0x3b77d6){_0x119e48=_[_0xefc2('0x7c')](_0x3b77d6,'id');var _0x1b3fa8;var _0x42e3d3=squel[_0xefc2('0x7d')]();_0x42e3d3[_0xefc2('0x7e')](_0x1c75c1[_0xefc2('0x8b')]);for(var _0x3a8b51=0x0;_0x3a8b51<_0x27dfd3['length'];_0x3a8b51+=0x1){_0x1b3fa8=_0x27dfd3[_0x3a8b51][_0xefc2('0x7f')]?_0x119e48[_0x27dfd3[_0x3a8b51][_0xefc2('0x7f')]][_0xefc2('0x94')]:_0x27dfd3[_0x3a8b51]['field'];_0x1b3fa8=_0x27dfd3[_0x3a8b51][_0xefc2('0x80')]?_[_0xefc2('0x81')](_0x5c731e[_0x27dfd3[_0x3a8b51][_0xefc2('0x80')]],'%s',_0x1b3fa8):_0x1b3fa8;_0x1b3fa8=_0x27dfd3[_0x3a8b51]['format']?_[_0xefc2('0x81')](_0x284a34[_0x27dfd3[_0x3a8b51][_0xefc2('0x82')]],'%s',_0x1b3fa8):_0x1b3fa8;if(_0x27dfd3[_0x3a8b51]['groupBy']){_0x42e3d3['group'](_0x1b3fa8);}_0x27dfd3[_0x3a8b51][_0xefc2('0x83')]&&_0x42e3d3[_0xefc2('0x3f')](_0x1b3fa8,_0x27dfd3[_0x3a8b51]['orderBy']===_0xefc2('0x84')?![]:!![]);_0x42e3d3[_0xefc2('0x75')](_0x1b3fa8,_0x27dfd3[_0x3a8b51][_0xefc2('0xac')]||_0x1b3fa8);}if(_0x1c75c1['joins']){_0x1c75c1['joins']=JSON[_0xefc2('0x86')](_0x1c75c1['joins']);for(var _0xaa7db8=0x0;_0xaa7db8<_0x1c75c1[_0xefc2('0x85')][_0xefc2('0x3c')];_0xaa7db8+=0x1){if(_0x1c75c1[_0xefc2('0x85')][_0xaa7db8][_0xefc2('0x33')]&&_['includes'](_0x184717,_0x1c75c1[_0xefc2('0x85')][_0xaa7db8][_0xefc2('0x33')])&&_0x1c75c1[_0xefc2('0x85')][_0xaa7db8][_0xefc2('0x87')]&&_0x1c75c1[_0xefc2('0x85')][_0xaa7db8]['foreignTable']&&_0x1c75c1['joins'][_0xaa7db8][_0xefc2('0x89')]){_0x42e3d3[_0x1c75c1['joins'][_0xaa7db8]['type']](_0x1c75c1['joins'][_0xaa7db8][_0xefc2('0x88')],null,util[_0xefc2('0x82')](_0xefc2('0x8a'),_0x1c75c1[_0xefc2('0x8b')],_0x1c75c1['joins'][_0xaa7db8][_0xefc2('0x87')],_0x1c75c1[_0xefc2('0x85')][_0xaa7db8]['foreignTable'],_0x1c75c1[_0xefc2('0x85')][_0xaa7db8][_0xefc2('0x89')]));}}}if(_0x1c75c1[_0xefc2('0x8c')]){_0x1c75c1[_0xefc2('0x8c')]=JSON[_0xefc2('0x86')](_0x1c75c1[_0xefc2('0x8c')]);_0x42e3d3[_0xefc2('0x41')](_0x4ab206(_0x1c75c1[_0xefc2('0x8c')][_0xefc2('0x74')]));}_0x5a2209=_0x42e3d3['clone']();_0x42e3d3[_0xefc2('0x1f')](_0x19df3c);_0x42e3d3[_0xefc2('0x1e')](0x0);logger[_0xefc2('0x8e')](_0xefc2('0x8f'),_0x42e3d3[_0xefc2('0x90')]());return dbH[_0xefc2('0x91')][_0xefc2('0x36')](_0x42e3d3[_0xefc2('0x90')](),{'type':dbH['sequelize'][_0xefc2('0x92')][_0xefc2('0xa9')]});}})[_0xefc2('0x29')](function(){return{'sql':_0x5a2209[_0xefc2('0x90')]()};})[_0xefc2('0x29')](respondWithResult(_0x30bb3c,null))['catch'](handleError(_0x30bb3c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 503360d..a7d9965 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 _0x7c4a=['bluebird','request-promise','path','rimraf','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment'];(function(_0x34dcbd,_0xc673d8){var _0x2eb717=function(_0x563ff1){while(--_0x563ff1){_0x34dcbd['push'](_0x34dcbd['shift']());}};_0x2eb717(++_0xc673d8);}(_0x7c4a,0x110));var _0xa7c4=function(_0x5a6ee4,_0x2e1727){_0x5a6ee4=_0x5a6ee4-0x0;var _0x5906fa=_0x7c4a[_0x5a6ee4];return _0x5906fa;};'use strict';var _=require(_0xa7c4('0x0'));var util=require('util');var logger=require(_0xa7c4('0x1'))(_0xa7c4('0x2'));var moment=require(_0xa7c4('0x3'));var BPromise=require(_0xa7c4('0x4'));var rp=require(_0xa7c4('0x5'));var fs=require('fs');var path=require(_0xa7c4('0x6'));var rimraf=require(_0xa7c4('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0xa7c4('0x8')]=function(_0x2e29f9,_0x477117){return _0x2e29f9[_0xa7c4('0x9')](_0xa7c4('0xa'),attributes,{'tableName':_0xa7c4('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2992=['rimraf','exports','define','AnalyticCustomReport','lodash','util','api','moment'];(function(_0x4d1320,_0x17eed8){var _0x25a98a=function(_0x18787c){while(--_0x18787c){_0x4d1320['push'](_0x4d1320['shift']());}};_0x25a98a(++_0x17eed8);}(_0x2992,0xc4));var _0x2299=function(_0x39dae4,_0x58a305){_0x39dae4=_0x39dae4-0x0;var _0x39ab08=_0x2992[_0x39dae4];return _0x39ab08;};'use strict';var _=require(_0x2299('0x0'));var util=require(_0x2299('0x1'));var logger=require('../../config/logger')(_0x2299('0x2'));var moment=require(_0x2299('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2299('0x4'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x2299('0x5')]=function(_0x5e226f,_0x19fba3){return _0x5e226f[_0x2299('0x6')](_0x2299('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 9ec93cd..cc9005e 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 _0x71d8=['request','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','code','AnalyticCustomReport,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x71d8,0xba));var _0x871d=function(_0x1dfc0f,_0x2bd7c2){_0x1dfc0f=_0x1dfc0f-0x0;var _0x5382ef=_0x71d8[_0x1dfc0f];return _0x5382ef;};'use strict';var _=require(_0x871d('0x0'));var util=require(_0x871d('0x1'));var moment=require(_0x871d('0x2'));var BPromise=require(_0x871d('0x3'));var rs=require(_0x871d('0x4'));var fs=require('fs');var Redis=require(_0x871d('0x5'));var db=require(_0x871d('0x6'))['db'];var utils=require(_0x871d('0x7'));var logger=require('../../config/logger')(_0x871d('0x8'));var config=require(_0x871d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x871d('0xa')][_0x871d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1016d9,_0x27e9d0,_0x2d946c){return new BPromise(function(_0x30a9ac,_0xaa4b73){return client[_0x871d('0xc')](_0x1016d9,_0x2d946c)['then'](function(_0x361d5b){logger[_0x871d('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x27e9d0,_0x871d('0xe'));logger['debug'](_0x871d('0xf'),_0x27e9d0,_0x871d('0xe'),JSON['stringify'](_0x361d5b));if(_0x361d5b['error']){if(_0x361d5b['error'][_0x871d('0x10')]===0x1f4){logger['error'](_0x871d('0x11'),_0x27e9d0,_0x361d5b[_0x871d('0x12')]['message']);return _0xaa4b73(_0x361d5b[_0x871d('0x12')][_0x871d('0x13')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x27e9d0,_0x361d5b['error'][_0x871d('0x13')]);return _0x30a9ac(_0x361d5b[_0x871d('0x12')][_0x871d('0x13')]);}else{logger[_0x871d('0xd')](_0x871d('0x11'),_0x27e9d0,_0x871d('0xe'));_0x30a9ac(_0x361d5b[_0x871d('0x14')][_0x871d('0x13')]);}})[_0x871d('0x15')](function(_0x5ef62f){logger['error'](_0x871d('0x11'),_0x27e9d0,_0x5ef62f);_0xaa4b73(_0x5ef62f);});});} \ No newline at end of file +var _0xe738=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xe738,0x84));var _0x8e73=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xe738[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x8e73('0x0'));var util=require(_0x8e73('0x1'));var moment=require(_0x8e73('0x2'));var BPromise=require(_0x8e73('0x3'));var rs=require(_0x8e73('0x4'));var fs=require('fs');var Redis=require(_0x8e73('0x5'));var db=require(_0x8e73('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e73('0x7'));var config=require(_0x8e73('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e73('0x9')][_0x8e73('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d6a3c,_0x51dd60,_0x15e0e6){return new BPromise(function(_0x1801e6,_0x6bbe69){return client[_0x8e73('0xb')](_0x9d6a3c,_0x15e0e6)[_0x8e73('0xc')](function(_0x3aeac5){logger['info'](_0x8e73('0xd'),_0x51dd60,_0x8e73('0xe'));logger[_0x8e73('0xf')](_0x8e73('0x10'),_0x51dd60,_0x8e73('0xe'),JSON[_0x8e73('0x11')](_0x3aeac5));if(_0x3aeac5[_0x8e73('0x12')]){if(_0x3aeac5[_0x8e73('0x12')]['code']===0x1f4){logger[_0x8e73('0x12')](_0x8e73('0xd'),_0x51dd60,_0x3aeac5['error'][_0x8e73('0x13')]);return _0x6bbe69(_0x3aeac5['error'][_0x8e73('0x13')]);}logger[_0x8e73('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x51dd60,_0x3aeac5[_0x8e73('0x12')]['message']);return _0x1801e6(_0x3aeac5[_0x8e73('0x12')][_0x8e73('0x13')]);}else{logger[_0x8e73('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x51dd60,_0x8e73('0xe'));_0x1801e6(_0x3aeac5[_0x8e73('0x15')][_0x8e73('0x13')]);}})['catch'](function(_0x151f10){logger[_0x8e73('0x12')](_0x8e73('0xd'),_0x51dd60,_0x151f10);_0x6bbe69(_0x151f10);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 96d4ac8..bba4328 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 _0x9bce=['index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x9bce,0x145));var _0xe9bc=function(_0x2a7759,_0x493a69){_0x2a7759=_0x2a7759-0x0;var _0x230e40=_0x9bce[_0x2a7759];return _0x230e40;};'use strict';var multer=require(_0xe9bc('0x0'));var util=require('util');var path=require(_0xe9bc('0x1'));var timeout=require(_0xe9bc('0x2'));var express=require(_0xe9bc('0x3'));var router=express[_0xe9bc('0x4')]();var fs_extra=require(_0xe9bc('0x5'));var auth=require(_0xe9bc('0x6'));var interaction=require(_0xe9bc('0x7'));var config=require(_0xe9bc('0x8'));var controller=require('./analyticCustomReport.controller');router[_0xe9bc('0x9')]('/',auth[_0xe9bc('0xa')](),controller[_0xe9bc('0xb')]);router[_0xe9bc('0x9')](_0xe9bc('0xc'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0xd')]);router[_0xe9bc('0x9')](_0xe9bc('0xe'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0xf')]);router[_0xe9bc('0x9')](_0xe9bc('0x10'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x11')]);router[_0xe9bc('0x9')]('/:id/query',auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x12')]);router[_0xe9bc('0x13')]('/',auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x14')]);router[_0xe9bc('0x15')](_0xe9bc('0xc'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x16')]);router['delete'](_0xe9bc('0xc'),auth[_0xe9bc('0xa')](),controller[_0xe9bc('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6764=['/:id','update','delete','destroy','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','index','isAuthenticated','/:id/preview','/:id/run','run','/:id/query','post','create','put'];(function(_0x59e4ee,_0x1850c3){var _0x48c5df=function(_0xd3f127){while(--_0xd3f127){_0x59e4ee['push'](_0x59e4ee['shift']());}};_0x48c5df(++_0x1850c3);}(_0x6764,0x1d2));var _0x4676=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6764[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require(_0x4676('0x0'));var path=require(_0x4676('0x1'));var timeout=require('connect-timeout');var express=require(_0x4676('0x2'));var router=express['Router']();var fs_extra=require(_0x4676('0x3'));var auth=require(_0x4676('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4676('0x5'));var controller=require(_0x4676('0x6'));router[_0x4676('0x7')]('/',auth['isAuthenticated'](),controller[_0x4676('0x8')]);router[_0x4676('0x7')]('/:id',auth[_0x4676('0x9')](),controller['show']);router['get'](_0x4676('0xa'),auth['isAuthenticated'](),controller['preview']);router[_0x4676('0x7')](_0x4676('0xb'),auth[_0x4676('0x9')](),controller[_0x4676('0xc')]);router[_0x4676('0x7')](_0x4676('0xd'),auth[_0x4676('0x9')](),controller['query']);router[_0x4676('0xe')]('/',auth[_0x4676('0x9')](),controller[_0x4676('0xf')]);router[_0x4676('0x10')](_0x4676('0x11'),auth[_0x4676('0x9')](),controller[_0x4676('0x12')]);router[_0x4676('0x13')]('/:id',auth[_0x4676('0x9')](),controller[_0x4676('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0fdfdf7..fc53f12 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 _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x1bb11e,_0x58fd78){var _0x422492=function(_0x5d8dfd){while(--_0x5d8dfd){_0x1bb11e['push'](_0x1bb11e['shift']());}};_0x422492(++_0x58fd78);}(_0xf494,0x1c6));var _0x4f49=function(_0x3fffdb,_0x18964c){_0x3fffdb=_0x3fffdb-0x0;var _0x5a9235=_0xf494[_0x3fffdb];return _0x5a9235;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ea581,_0x1c50f9){_0x2ea581=_0x2ea581-0x0;var _0x5c9c57=_0x6aa7[_0x2ea581];return _0x5c9c57;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 97f217c..62cb61e 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 _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','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','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2ef3,0xba));var _0x32ef=function(_0xe2c2fc,_0x570a87){_0xe2c2fc=_0xe2c2fc-0x0;var _0x10220b=_0x2ef3[_0xe2c2fc];return _0x10220b;};'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'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));}; \ No newline at end of file +var _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','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','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5cf540,_0x317bb0){_0x5cf540=_0x5cf540-0x0;var _0x1c6c47=_0xdbf5[_0x5cf540];return _0x1c6c47;};'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'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 19ec7e7..03c9e14 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 _0xb822=['define','analytics_default_reports','lodash','util','bluebird','request-promise','path','rimraf','exports'];(function(_0x3ea523,_0x26d75f){var _0x30efde=function(_0x34fb2f){while(--_0x34fb2f){_0x3ea523['push'](_0x3ea523['shift']());}};_0x30efde(++_0x26d75f);}(_0xb822,0x65));var _0x2b82=function(_0x2b3a25,_0x8a65d5){_0x2b3a25=_0x2b3a25-0x0;var _0xed59f5=_0xb822[_0x2b3a25];return _0xed59f5;};'use strict';var _=require(_0x2b82('0x0'));var util=require(_0x2b82('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2b82('0x2'));var rp=require(_0x2b82('0x3'));var fs=require('fs');var path=require(_0x2b82('0x4'));var rimraf=require(_0x2b82('0x5'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x2b82('0x6')]=function(_0x107922,_0x5c1810){return _0x107922[_0x2b82('0x7')]('AnalyticDefaultReport',attributes,{'tableName':_0x2b82('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68ac=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','analytics_default_reports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68ac,0x14a));var _0xc68a=function(_0x4b80f7,_0x4124f5){_0x4b80f7=_0x4b80f7-0x0;var _0x5f5828=_0x68ac[_0x4b80f7];return _0x5f5828;};'use strict';var _=require('lodash');var util=require(_0xc68a('0x0'));var logger=require('../../config/logger')(_0xc68a('0x1'));var moment=require(_0xc68a('0x2'));var BPromise=require(_0xc68a('0x3'));var rp=require(_0xc68a('0x4'));var fs=require('fs');var path=require(_0xc68a('0x5'));var rimraf=require(_0xc68a('0x6'));var config=require(_0xc68a('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xc68a('0x8')]=function(_0x55f195,_0x49e9eb){return _0x55f195[_0xc68a('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0xc68a('0xa'),'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 33f2587..870985b 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 _0xe043=['rpc','../../config/environment','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe043,0x111));var _0x3e04=function(_0x2e6f81,_0x63ab52){_0x2e6f81=_0x2e6f81-0x0;var _0x37440b=_0xe043[_0x2e6f81];return _0x37440b;};'use strict';var _=require(_0x3e04('0x0'));var util=require('util');var moment=require(_0x3e04('0x1'));var BPromise=require(_0x3e04('0x2'));var rs=require(_0x3e04('0x3'));var fs=require('fs');var Redis=require(_0x3e04('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e04('0x5'));var logger=require(_0x3e04('0x6'))(_0x3e04('0x7'));var config=require(_0x3e04('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x54c070,_0x4a57d5,_0x16fdf8){return new BPromise(function(_0x5ed588,_0x5d3179){return client['request'](_0x54c070,_0x16fdf8)[_0x3e04('0x9')](function(_0xecc890){logger[_0x3e04('0xa')](_0x3e04('0xb'),_0x4a57d5,_0x3e04('0xc'));logger[_0x3e04('0xd')](_0x3e04('0xe'),_0x4a57d5,_0x3e04('0xc'),JSON['stringify'](_0xecc890));if(_0xecc890[_0x3e04('0xf')]){if(_0xecc890[_0x3e04('0xf')][_0x3e04('0x10')]===0x1f4){logger[_0x3e04('0xf')](_0x3e04('0xb'),_0x4a57d5,_0xecc890['error'][_0x3e04('0x11')]);return _0x5d3179(_0xecc890[_0x3e04('0xf')][_0x3e04('0x11')]);}logger[_0x3e04('0xf')](_0x3e04('0xb'),_0x4a57d5,_0xecc890[_0x3e04('0xf')][_0x3e04('0x11')]);return _0x5ed588(_0xecc890[_0x3e04('0xf')][_0x3e04('0x11')]);}else{logger[_0x3e04('0xa')](_0x3e04('0xb'),_0x4a57d5,_0x3e04('0xc'));_0x5ed588(_0xecc890[_0x3e04('0x12')][_0x3e04('0x11')]);}})[_0x3e04('0x13')](function(_0x44b9c8){logger[_0x3e04('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a57d5,_0x44b9c8);_0x5d3179(_0x44b9c8);});});} \ No newline at end of file +var _0xe73b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2c9cac,_0x3fee65){var _0x1bc5e2=function(_0x4ef66a){while(--_0x4ef66a){_0x2c9cac['push'](_0x2c9cac['shift']());}};_0x1bc5e2(++_0x3fee65);}(_0xe73b,0x139));var _0xbe73=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0xe73b[_0x1c206c];return _0x188aaa;};'use strict';var _=require(_0xbe73('0x0'));var util=require(_0xbe73('0x1'));var moment=require(_0xbe73('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe73('0x3'));var fs=require('fs');var Redis=require(_0xbe73('0x4'));var db=require(_0xbe73('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe73('0x6'))(_0xbe73('0x7'));var config=require(_0xbe73('0x8'));var jayson=require(_0xbe73('0x9'));var client=jayson[_0xbe73('0xa')][_0xbe73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfc99d0,_0x15d406,_0x282376){return new BPromise(function(_0x115fe5,_0x416781){return client[_0xbe73('0xc')](_0xfc99d0,_0x282376)[_0xbe73('0xd')](function(_0x3ede91){logger[_0xbe73('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x15d406,_0xbe73('0xf'));logger[_0xbe73('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x15d406,_0xbe73('0xf'),JSON['stringify'](_0x3ede91));if(_0x3ede91[_0xbe73('0x11')]){if(_0x3ede91[_0xbe73('0x11')][_0xbe73('0x12')]===0x1f4){logger[_0xbe73('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x15d406,_0x3ede91[_0xbe73('0x11')][_0xbe73('0x13')]);return _0x416781(_0x3ede91[_0xbe73('0x11')][_0xbe73('0x13')]);}logger[_0xbe73('0x11')](_0xbe73('0x14'),_0x15d406,_0x3ede91[_0xbe73('0x11')][_0xbe73('0x13')]);return _0x115fe5(_0x3ede91[_0xbe73('0x11')][_0xbe73('0x13')]);}else{logger[_0xbe73('0xe')](_0xbe73('0x14'),_0x15d406,_0xbe73('0xf'));_0x115fe5(_0x3ede91[_0xbe73('0x15')][_0xbe73('0x13')]);}})[_0xbe73('0x16')](function(_0x4ef1cc){logger[_0xbe73('0x11')](_0xbe73('0x14'),_0x15d406,_0x4ef1cc);_0x416781(_0x4ef1cc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7015c1a..f85b323 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 _0xa6b0=['isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x1ecfcd,_0x1a862c){_0x1ecfcd=_0x1ecfcd-0x0;var _0x4219ef=_0xa6b0[_0x1ecfcd];return _0x4219ef;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x0a6b('0x8')](_0x0a6b('0xe'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x8')](_0x0a6b('0x10'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);router[_0x0a6b('0x12')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x13')]);router[_0x0a6b('0x14')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller['update']);router['delete'](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x15')]);module[_0x0a6b('0x16')]=router; \ No newline at end of file +var _0xf51f=['query','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','/:id/run','run','/:id/query'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf51f,0x19f));var _0xff51=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xf51f[_0x151721];return _0x2deaa7;};'use strict';var multer=require(_0xff51('0x0'));var util=require(_0xff51('0x1'));var path=require('path');var timeout=require(_0xff51('0x2'));var express=require(_0xff51('0x3'));var router=express['Router']();var fs_extra=require(_0xff51('0x4'));var auth=require(_0xff51('0x5'));var interaction=require(_0xff51('0x6'));var config=require(_0xff51('0x7'));var controller=require(_0xff51('0x8'));router[_0xff51('0x9')]('/',auth[_0xff51('0xa')](),controller[_0xff51('0xb')]);router[_0xff51('0x9')](_0xff51('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xff51('0x9')](_0xff51('0xd'),auth[_0xff51('0xa')](),controller['preview']);router[_0xff51('0x9')](_0xff51('0xe'),auth[_0xff51('0xa')](),controller[_0xff51('0xf')]);router['get'](_0xff51('0x10'),auth['isAuthenticated'](),controller[_0xff51('0x11')]);router[_0xff51('0x12')]('/',auth[_0xff51('0xa')](),controller['create']);router[_0xff51('0x13')](_0xff51('0xc'),auth[_0xff51('0xa')](),controller[_0xff51('0x14')]);router[_0xff51('0x15')](_0xff51('0xc'),auth['isAuthenticated'](),controller[_0xff51('0x16')]);module[_0xff51('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b1e6f0e..36fe91e 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 _0xb020=['csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM'];(function(_0x219cca,_0x5963d5){var _0x43e200=function(_0x2185d9){while(--_0x2185d9){_0x219cca['push'](_0x219cca['shift']());}};_0x43e200(++_0x5963d5);}(_0xb020,0x1b8));var _0x0b02=function(_0x1602fb,_0x20b6b3){_0x1602fb=_0x1602fb-0x0;var _0x461831=_0xb020[_0x1602fb];return _0x461831;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0b02('0x0'));module[_0x0b02('0x1')]={'name':{'type':Sequelize[_0x0b02('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0b02('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0b02('0x3')](_0x0b02('0x4'),_0x0b02('0x5'),_0x0b02('0x6')),'allowNull':![],'defaultValue':_0x0b02('0x4')},'savename':{'type':Sequelize[_0x0b02('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0b02('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x0b02('0x2')],'defaultValue':_0x0b02('0x8')},'type':{'type':Sequelize[_0x0b02('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x0b02('0x9')},'reportId':{'type':Sequelize[_0x0b02('0xa')](0xb)[_0x0b02('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0f61=['STRING','ENUM','pdf','csv','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x1bc8bf,_0x14f8ab){var _0x19b26c=function(_0x2da3df){while(--_0x2da3df){_0x1bc8bf['push'](_0x1bc8bf['shift']());}};_0x19b26c(++_0x14f8ab);}(_0x0f61,0xb9));var _0x10f6=function(_0xb3a1f6,_0x523de8){_0xb3a1f6=_0xb3a1f6-0x0;var _0x3ce21a=_0x0f61[_0xb3a1f6];return _0x3ce21a;};'use strict';var Sequelize=require(_0x10f6('0x0'));var moment=require(_0x10f6('0x1'));module['exports']={'name':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x10f6('0x3')]('csv',_0x10f6('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x10f6('0x5')},'savename':{'type':Sequelize[_0x10f6('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x10f6('0x6')]},'endDate':{'type':Sequelize[_0x10f6('0x6')]},'status':{'type':Sequelize[_0x10f6('0x2')],'defaultValue':_0x10f6('0x7')},'type':{'type':Sequelize['ENUM'](_0x10f6('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x10f6('0x8')},'reportId':{'type':Sequelize[_0x10f6('0x9')](0xb)[_0x10f6('0xa')]},'reportType':{'type':Sequelize[_0x10f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4d1bbc5..e48c426 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 _0xce1e=['keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','body','download','basename','output','existsSync','join','server/files/reports','Sequelize','ValidationError','exists','savename','format','%s.%s','toLowerCase','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x5e21d9,_0x50ba0e){var _0xcfd251=function(_0x340fd3){while(--_0x340fd3){_0x5e21d9['push'](_0x5e21d9['shift']());}};_0xcfd251(++_0x50ba0e);}(_0xce1e,0x19a));var _0xece1=function(_0x34335e,_0x4c0e59){_0x34335e=_0x34335e-0x0;var _0xfda1e=_0xce1e[_0x34335e];return _0xfda1e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xece1('0x0'));var rp=require(_0xece1('0x1'));var moment=require(_0xece1('0x2'));var BPromise=require(_0xece1('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xece1('0x4'));var csv=require('to-csv');var ejs=require(_0xece1('0x5'));var fs=require('fs');var fs_extra=require(_0xece1('0x6'));var _=require('lodash');var squel=require(_0xece1('0x7'));var crypto=require(_0xece1('0x8'));var jsforce=require(_0xece1('0x9'));var deskjs=require(_0xece1('0xa'));var toCsv=require(_0xece1('0xb'));var querystring=require('querystring');var Papa=require(_0xece1('0xc'));var Redis=require(_0xece1('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xece1('0xe'));var as=require(_0xece1('0xf'));var hardwareService=require(_0xece1('0x10'));var logger=require(_0xece1('0x11'))(_0xece1('0x12'));var utils=require(_0xece1('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xece1('0x14'))['db'];function respondWithStatusCode(_0x3c31d0,_0xe865ff){_0xe865ff=_0xe865ff||0xcc;return function(_0x23de6d){if(_0x23de6d){return _0x3c31d0[_0xece1('0x15')](_0xe865ff);}return _0x3c31d0[_0xece1('0x16')](_0xe865ff)[_0xece1('0x17')]();};}function respondWithResult(_0x128096,_0x138a87){_0x138a87=_0x138a87||0xc8;return function(_0x588e4d){if(_0x588e4d){return _0x128096[_0xece1('0x16')](_0x138a87)[_0xece1('0x18')](_0x588e4d);}};}function respondWithFilteredResult(_0x9a495d,_0x33660b){return function(_0x563229){if(_0x563229){var _0x5636df=typeof _0x33660b[_0xece1('0x19')]===_0xece1('0x1a')&&typeof _0x33660b['limit']===_0xece1('0x1a');var _0x1b736f=_0x563229[_0xece1('0x1b')];var _0x3e7a49=_0x5636df?0x0:_0x33660b[_0xece1('0x19')];var _0x5d0b60=_0x5636df?_0x563229[_0xece1('0x1b')]:_0x33660b[_0xece1('0x19')]+_0x33660b[_0xece1('0x1c')];var _0x30a194;if(_0x5d0b60>=_0x1b736f){_0x5d0b60=_0x1b736f;_0x30a194=0xc8;}else{_0x30a194=0xce;}_0x9a495d[_0xece1('0x16')](_0x30a194);return _0x9a495d[_0xece1('0x1d')](_0xece1('0x1e'),_0x3e7a49+'-'+_0x5d0b60+'/'+_0x1b736f)[_0xece1('0x18')](_0x563229);}return null;};}function patchUpdates(_0x2a1bcf){return function(_0x36f449){try{jsonpatch[_0xece1('0x1f')](_0x36f449,_0x2a1bcf,!![]);}catch(_0x5ab1e0){return BPromise['reject'](_0x5ab1e0);}return _0x36f449[_0xece1('0x20')]();};}function saveUpdates(_0xfb9fc1,_0x28ee15){return function(_0x42220a){if(_0x42220a){return _0x42220a[_0xece1('0x21')](_0xfb9fc1)[_0xece1('0x22')](function(_0x3c9afd){return _0x3c9afd;});}return null;};}function removeEntity(_0x1de0a3,_0x2afeca){return function(_0x19c135){if(_0x19c135){return _0x19c135['destroy']()[_0xece1('0x22')](function(){var _0x41dbb1=_0x19c135['get']({'plain':!![]});var _0x237c77=_0xece1('0x23');return db[_0xece1('0x24')][_0xece1('0x25')]({'where':{'type':_0x237c77,'resourceId':_0x41dbb1['id']}})[_0xece1('0x22')](function(){return _0x19c135;});})[_0xece1('0x22')](function(){_0x1de0a3[_0xece1('0x16')](0xcc)[_0xece1('0x17')]();});}};}function handleEntityNotFound(_0xf79c8f,_0x260750){return function(_0x242040){if(!_0x242040){_0xf79c8f[_0xece1('0x15')](0x194);}return _0x242040;};}function handleError(_0x53d186,_0x3db120){_0x3db120=_0x3db120||0x1f4;return function(_0x56ef0f){logger[_0xece1('0x26')](_0x56ef0f[_0xece1('0x27')]);if(_0x56ef0f[_0xece1('0x28')]){delete _0x56ef0f[_0xece1('0x28')];}_0x53d186[_0xece1('0x16')](_0x3db120)[_0xece1('0x29')](_0x56ef0f);};}exports['index']=function(_0x1a3e66,_0x2f87e0){var _0x65c4ae={},_0x43aac6={},_0x30e93f={'count':0x0,'rows':[]};var _0x4d2f37=_[_0xece1('0x2a')](db[_0xece1('0x2b')][_0xece1('0x2c')],function(_0x1a3a8f){return{'name':_0x1a3a8f[_0xece1('0x2d')],'type':_0x1a3a8f[_0xece1('0x2e')][_0xece1('0x2f')]};});_0x43aac6[_0xece1('0x30')]=_['map'](_0x4d2f37,'name');_0x43aac6[_0xece1('0x31')]=_[_0xece1('0x32')](_0x1a3e66[_0xece1('0x31')]);_0x43aac6[_0xece1('0x33')]=_[_0xece1('0x34')](_0x43aac6[_0xece1('0x30')],_0x43aac6[_0xece1('0x31')]);_0x65c4ae[_0xece1('0x35')]=_['intersection'](_0x43aac6[_0xece1('0x30')],qs[_0xece1('0x36')](_0x1a3e66[_0xece1('0x31')][_0xece1('0x36')]));_0x65c4ae['attributes']=_0x65c4ae[_0xece1('0x35')]['length']?_0x65c4ae[_0xece1('0x35')]:_0x43aac6[_0xece1('0x30')];if(!_0x1a3e66['query']['hasOwnProperty'](_0xece1('0x37'))){_0x65c4ae['limit']=qs['limit'](_0x1a3e66['query'][_0xece1('0x1c')]);_0x65c4ae[_0xece1('0x19')]=qs['offset'](_0x1a3e66[_0xece1('0x31')]['offset']);}_0x65c4ae[_0xece1('0x38')]=qs['sort'](_0x1a3e66[_0xece1('0x31')][_0xece1('0x39')]);_0x65c4ae['where']=qs[_0xece1('0x33')](_['pick'](_0x1a3e66[_0xece1('0x31')],_0x43aac6[_0xece1('0x33')]),_0x4d2f37);if(_0x1a3e66[_0xece1('0x31')][_0xece1('0x3a')]){_0x65c4ae[_0xece1('0x3b')]=_[_0xece1('0x3c')](_0x65c4ae[_0xece1('0x3b')],{'$or':_[_0xece1('0x2a')](_0x4d2f37,function(_0x3b02e4){if(_0x3b02e4[_0xece1('0x2e')]!==_0xece1('0x3d')){var _0x180ca4={};_0x180ca4[_0x3b02e4['name']]={'$like':'%'+_0x1a3e66[_0xece1('0x31')][_0xece1('0x3a')]+'%'};return _0x180ca4;}})});}_0x65c4ae=_['merge']({},_0x65c4ae,_0x1a3e66[_0xece1('0x3e')]);var _0x428199={'where':_0x65c4ae[_0xece1('0x3b')]};return db[_0xece1('0x2b')][_0xece1('0x1b')](_0x428199)[_0xece1('0x22')](function(_0x257409){_0x30e93f[_0xece1('0x1b')]=_0x257409;if(_0x1a3e66[_0xece1('0x31')][_0xece1('0x3f')]){_0x65c4ae[_0xece1('0x40')]=[{'all':!![]}];}return db[_0xece1('0x2b')][_0xece1('0x41')](_0x65c4ae);})[_0xece1('0x22')](function(_0x57d5a6){_0x30e93f['rows']=_0x57d5a6;return _0x30e93f;})['then'](respondWithFilteredResult(_0x2f87e0,_0x65c4ae))[_0xece1('0x42')](handleError(_0x2f87e0,null));};exports[_0xece1('0x43')]=function(_0x18ac5b,_0x27cc5b){var _0x3a3136={'raw':!![],'where':{'id':_0x18ac5b[_0xece1('0x44')]['id']}},_0x4203a2={};_0x4203a2[_0xece1('0x30')]=_[_0xece1('0x32')](db[_0xece1('0x2b')]['rawAttributes']);_0x4203a2['query']=_[_0xece1('0x32')](_0x18ac5b['query']);_0x4203a2['filters']=_[_0xece1('0x34')](_0x4203a2[_0xece1('0x30')],_0x4203a2[_0xece1('0x31')]);_0x3a3136[_0xece1('0x35')]=_[_0xece1('0x34')](_0x4203a2[_0xece1('0x30')],qs['fields'](_0x18ac5b['query'][_0xece1('0x36')]));_0x3a3136[_0xece1('0x35')]=_0x3a3136[_0xece1('0x35')][_0xece1('0x45')]?_0x3a3136[_0xece1('0x35')]:_0x4203a2[_0xece1('0x30')];if(_0x18ac5b[_0xece1('0x31')][_0xece1('0x3f')]){_0x3a3136[_0xece1('0x40')]=[{'all':!![]}];}_0x3a3136=_[_0xece1('0x3c')]({},_0x3a3136,_0x18ac5b[_0xece1('0x3e')]);return db[_0xece1('0x2b')]['find'](_0x3a3136)[_0xece1('0x22')](handleEntityNotFound(_0x27cc5b,null))[_0xece1('0x22')](respondWithResult(_0x27cc5b,null))[_0xece1('0x42')](handleError(_0x27cc5b,null));};exports['create']=function(_0x16349d,_0x1b33bc){return db['AnalyticExtractedReport'][_0xece1('0x46')](_0x16349d['body'],{})[_0xece1('0x22')](function(_0x40f0d4){var _0x31e799=_0x16349d['user']['get']({'plain':!![]});if(!_0x31e799)throw new Error(_0xece1('0x47'));if(_0x31e799[_0xece1('0x48')]===_0xece1('0x49')){var _0x203501=_0x40f0d4['get']({'plain':!![]});var _0x4d4279='ExtractedReports';return db[_0xece1('0x4a')][_0xece1('0x4b')]({'where':{'name':_0x4d4279,'userProfileId':_0x31e799[_0xece1('0x4c')]},'raw':!![]})[_0xece1('0x22')](function(_0x344c28){if(_0x344c28&&_0x344c28[_0xece1('0x4d')]===0x0){return db['UserProfileResource'][_0xece1('0x46')]({'name':_0x203501[_0xece1('0x28')],'resourceId':_0x203501['id'],'type':_0x344c28[_0xece1('0x28')],'sectionId':_0x344c28['id']},{})[_0xece1('0x22')](function(){return _0x40f0d4;});}else{return _0x40f0d4;}})[_0xece1('0x42')](function(_0x3da0ab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3da0ab);throw _0x3da0ab;});}return _0x40f0d4;})[_0xece1('0x22')](respondWithResult(_0x1b33bc,0xc9))[_0xece1('0x42')](handleError(_0x1b33bc,null));};exports['update']=function(_0x2beb26,_0x3c5222){if(_0x2beb26[_0xece1('0x4e')]['id']){delete _0x2beb26[_0xece1('0x4e')]['id'];}return db['AnalyticExtractedReport'][_0xece1('0x4b')]({'where':{'id':_0x2beb26[_0xece1('0x44')]['id']}})[_0xece1('0x22')](handleEntityNotFound(_0x3c5222,null))[_0xece1('0x22')](saveUpdates(_0x2beb26['body'],null))[_0xece1('0x22')](respondWithResult(_0x3c5222,null))[_0xece1('0x42')](handleError(_0x3c5222,null));};exports['destroy']=function(_0xb7850a,_0x121325){return db[_0xece1('0x2b')][_0xece1('0x4b')]({'where':{'id':_0xb7850a[_0xece1('0x44')]['id']}})[_0xece1('0x22')](handleEntityNotFound(_0x121325,null))[_0xece1('0x22')](removeEntity(_0x121325,null))[_0xece1('0x42')](handleError(_0x121325,null));};exports[_0xece1('0x4f')]=function(_0x32ff33,_0x32b078,_0x58a0ee){return db[_0xece1('0x2b')][_0xece1('0x4b')]({'where':{'id':_0x32ff33[_0xece1('0x44')]['id']},'attributes':[_0xece1('0x28'),_0xece1('0x50'),'savename',_0xece1('0x51')],'raw':!![]})[_0xece1('0x22')](handleEntityNotFound(_0x32b078,null))['then'](function(_0xa5899c){if(_0xa5899c){if(!fs[_0xece1('0x52')](path[_0xece1('0x53')](config['root'],_0xece1('0x54'),_0xa5899c['savename']))){throw new db[(_0xece1('0x55'))][(_0xece1('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x32ff33['query'][_0xece1('0x57')]){return _0x32b078[_0xece1('0x15')](0xc8);}return _0x32b078['download'](path['join'](config['root'],_0xece1('0x54'),_0xa5899c[_0xece1('0x58')]),util[_0xece1('0x59')](_0xece1('0x5a'),_0xa5899c[_0xece1('0x50')]||_0xa5899c['name'],_0xa5899c['output'][_0xece1('0x5b')]()));}})[_0xece1('0x42')](handleError(_0x32b078,null));}; \ No newline at end of file +var _0xd29e=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticExtractedReport','findAll','rows','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','format','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ExtractedReports','stack','name','index','map','fieldName','model','query','keys','filters','intersection'];(function(_0x145fe3,_0x2bfd50){var _0x5f5409=function(_0x368983){while(--_0x368983){_0x145fe3['push'](_0x145fe3['shift']());}};_0x5f5409(++_0x2bfd50);}(_0xd29e,0x19e));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xed29('0x0'));var rimraf=require(_0xed29('0x1'));var zipdir=require(_0xed29('0x2'));var jsonpatch=require(_0xed29('0x3'));var rp=require(_0xed29('0x4'));var moment=require(_0xed29('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed29('0x6'));var util=require(_0xed29('0x7'));var path=require(_0xed29('0x8'));var sox=require(_0xed29('0x9'));var csv=require(_0xed29('0xa'));var ejs=require(_0xed29('0xb'));var fs=require('fs');var fs_extra=require(_0xed29('0xc'));var _=require('lodash');var squel=require(_0xed29('0xd'));var crypto=require(_0xed29('0xe'));var jsforce=require(_0xed29('0xf'));var deskjs=require(_0xed29('0x10'));var toCsv=require(_0xed29('0xa'));var querystring=require('querystring');var Papa=require(_0xed29('0x11'));var Redis=require('ioredis');var authService=require(_0xed29('0x12'));var qs=require(_0xed29('0x13'));var as=require(_0xed29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed29('0x15'));var utils=require(_0xed29('0x16'));var config=require(_0xed29('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xed29('0x18'))['db'];function respondWithStatusCode(_0x1aa108,_0x1bfd64){_0x1bfd64=_0x1bfd64||0xcc;return function(_0x5e2c82){if(_0x5e2c82){return _0x1aa108[_0xed29('0x19')](_0x1bfd64);}return _0x1aa108[_0xed29('0x1a')](_0x1bfd64)[_0xed29('0x1b')]();};}function respondWithResult(_0x506a85,_0xc70d23){_0xc70d23=_0xc70d23||0xc8;return function(_0x2ddea1){if(_0x2ddea1){return _0x506a85[_0xed29('0x1a')](_0xc70d23)[_0xed29('0x1c')](_0x2ddea1);}};}function respondWithFilteredResult(_0x5b2006,_0x563477){return function(_0x2e2493){if(_0x2e2493){var _0x30a177=typeof _0x563477[_0xed29('0x1d')]===_0xed29('0x1e')&&typeof _0x563477[_0xed29('0x1f')]===_0xed29('0x1e');var _0x152cfa=_0x2e2493['count'];var _0xd97380=_0x30a177?0x0:_0x563477[_0xed29('0x1d')];var _0x31d840=_0x30a177?_0x2e2493[_0xed29('0x20')]:_0x563477['offset']+_0x563477['limit'];var _0x1f2c7b;if(_0x31d840>=_0x152cfa){_0x31d840=_0x152cfa;_0x1f2c7b=0xc8;}else{_0x1f2c7b=0xce;}_0x5b2006[_0xed29('0x1a')](_0x1f2c7b);return _0x5b2006[_0xed29('0x21')]('Content-Range',_0xd97380+'-'+_0x31d840+'/'+_0x152cfa)['json'](_0x2e2493);}return null;};}function patchUpdates(_0xd018d3){return function(_0x4994e3){try{jsonpatch[_0xed29('0x22')](_0x4994e3,_0xd018d3,!![]);}catch(_0x13262a){return BPromise[_0xed29('0x23')](_0x13262a);}return _0x4994e3[_0xed29('0x24')]();};}function saveUpdates(_0x3a434c,_0x885ceb){return function(_0x3cf6d1){if(_0x3cf6d1){return _0x3cf6d1[_0xed29('0x25')](_0x3a434c)[_0xed29('0x26')](function(_0x31184b){return _0x31184b;});}return null;};}function removeEntity(_0xd7fa30,_0x476eb1){return function(_0xf7984e){if(_0xf7984e){return _0xf7984e['destroy']()[_0xed29('0x26')](function(){var _0x1542ca=_0xf7984e[_0xed29('0x27')]({'plain':!![]});var _0x41a840=_0xed29('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x41a840,'resourceId':_0x1542ca['id']}})[_0xed29('0x26')](function(){return _0xf7984e;});})[_0xed29('0x26')](function(){_0xd7fa30['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a52f4,_0x2cfb61){return function(_0x413403){if(!_0x413403){_0x4a52f4[_0xed29('0x19')](0x194);}return _0x413403;};}function handleError(_0x540f36,_0x47f7aa){_0x47f7aa=_0x47f7aa||0x1f4;return function(_0x14ed20){logger['error'](_0x14ed20[_0xed29('0x29')]);if(_0x14ed20['name']){delete _0x14ed20[_0xed29('0x2a')];}_0x540f36['status'](_0x47f7aa)['send'](_0x14ed20);};}exports[_0xed29('0x2b')]=function(_0x53cb5b,_0x2849f8){var _0x1bfc5e={},_0x2fef20={},_0x31c557={'count':0x0,'rows':[]};var _0x1f7d48=_[_0xed29('0x2c')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x1df8b4){return{'name':_0x1df8b4[_0xed29('0x2d')],'type':_0x1df8b4['type']['key']};});_0x2fef20[_0xed29('0x2e')]=_[_0xed29('0x2c')](_0x1f7d48,_0xed29('0x2a'));_0x2fef20[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x53cb5b['query']);_0x2fef20[_0xed29('0x31')]=_[_0xed29('0x32')](_0x2fef20[_0xed29('0x2e')],_0x2fef20['query']);_0x1bfc5e[_0xed29('0x33')]=_['intersection'](_0x2fef20[_0xed29('0x2e')],qs[_0xed29('0x34')](_0x53cb5b[_0xed29('0x2f')][_0xed29('0x34')]));_0x1bfc5e[_0xed29('0x33')]=_0x1bfc5e[_0xed29('0x33')]['length']?_0x1bfc5e[_0xed29('0x33')]:_0x2fef20[_0xed29('0x2e')];if(!_0x53cb5b['query'][_0xed29('0x35')](_0xed29('0x36'))){_0x1bfc5e[_0xed29('0x1f')]=qs[_0xed29('0x1f')](_0x53cb5b[_0xed29('0x2f')]['limit']);_0x1bfc5e[_0xed29('0x1d')]=qs[_0xed29('0x1d')](_0x53cb5b['query']['offset']);}_0x1bfc5e[_0xed29('0x37')]=qs[_0xed29('0x38')](_0x53cb5b[_0xed29('0x2f')][_0xed29('0x38')]);_0x1bfc5e[_0xed29('0x39')]=qs[_0xed29('0x31')](_[_0xed29('0x3a')](_0x53cb5b[_0xed29('0x2f')],_0x2fef20[_0xed29('0x31')]),_0x1f7d48);if(_0x53cb5b[_0xed29('0x2f')]['filter']){_0x1bfc5e[_0xed29('0x39')]=_[_0xed29('0x3b')](_0x1bfc5e['where'],{'$or':_[_0xed29('0x2c')](_0x1f7d48,function(_0x324334){if(_0x324334[_0xed29('0x3c')]!==_0xed29('0x3d')){var _0x55b595={};_0x55b595[_0x324334[_0xed29('0x2a')]]={'$like':'%'+_0x53cb5b[_0xed29('0x2f')][_0xed29('0x3e')]+'%'};return _0x55b595;}})});}_0x1bfc5e=_[_0xed29('0x3b')]({},_0x1bfc5e,_0x53cb5b[_0xed29('0x3f')]);var _0x4f66ad={'where':_0x1bfc5e['where']};return db[_0xed29('0x40')]['count'](_0x4f66ad)[_0xed29('0x26')](function(_0x135057){_0x31c557['count']=_0x135057;if(_0x53cb5b[_0xed29('0x2f')]['includeAll']){_0x1bfc5e['include']=[{'all':!![]}];}return db[_0xed29('0x40')][_0xed29('0x41')](_0x1bfc5e);})[_0xed29('0x26')](function(_0x43f99d){_0x31c557[_0xed29('0x42')]=_0x43f99d;return _0x31c557;})[_0xed29('0x26')](respondWithFilteredResult(_0x2849f8,_0x1bfc5e))[_0xed29('0x43')](handleError(_0x2849f8,null));};exports[_0xed29('0x44')]=function(_0x2fb8c2,_0x16a2e7){var _0x528970={'raw':!![],'where':{'id':_0x2fb8c2['params']['id']}},_0x563a36={};_0x563a36[_0xed29('0x2e')]=_[_0xed29('0x30')](db['AnalyticExtractedReport']['rawAttributes']);_0x563a36[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x2fb8c2[_0xed29('0x2f')]);_0x563a36[_0xed29('0x31')]=_[_0xed29('0x32')](_0x563a36[_0xed29('0x2e')],_0x563a36[_0xed29('0x2f')]);_0x528970[_0xed29('0x33')]=_[_0xed29('0x32')](_0x563a36[_0xed29('0x2e')],qs[_0xed29('0x34')](_0x2fb8c2[_0xed29('0x2f')]['fields']));_0x528970[_0xed29('0x33')]=_0x528970['attributes'][_0xed29('0x45')]?_0x528970[_0xed29('0x33')]:_0x563a36[_0xed29('0x2e')];if(_0x2fb8c2[_0xed29('0x2f')][_0xed29('0x46')]){_0x528970['include']=[{'all':!![]}];}_0x528970=_[_0xed29('0x3b')]({},_0x528970,_0x2fb8c2[_0xed29('0x3f')]);return db[_0xed29('0x40')][_0xed29('0x47')](_0x528970)['then'](handleEntityNotFound(_0x16a2e7,null))[_0xed29('0x26')](respondWithResult(_0x16a2e7,null))['catch'](handleError(_0x16a2e7,null));};exports['create']=function(_0x11923e,_0x1e0b66){return db[_0xed29('0x40')][_0xed29('0x48')](_0x11923e[_0xed29('0x49')],{})['then'](function(_0x3d4532){var _0xb6cebe=_0x11923e[_0xed29('0x4a')][_0xed29('0x27')]({'plain':!![]});if(!_0xb6cebe)throw new Error(_0xed29('0x4b'));if(_0xb6cebe[_0xed29('0x4c')]===_0xed29('0x4a')){var _0x23ab87=_0x3d4532['get']({'plain':!![]});var _0x359cca=_0xed29('0x28');return db[_0xed29('0x4d')][_0xed29('0x47')]({'where':{'name':_0x359cca,'userProfileId':_0xb6cebe[_0xed29('0x4e')]},'raw':!![]})[_0xed29('0x26')](function(_0x1d2dd8){if(_0x1d2dd8&&_0x1d2dd8[_0xed29('0x4f')]===0x0){return db['UserProfileResource'][_0xed29('0x48')]({'name':_0x23ab87[_0xed29('0x2a')],'resourceId':_0x23ab87['id'],'type':_0x1d2dd8[_0xed29('0x2a')],'sectionId':_0x1d2dd8['id']},{})[_0xed29('0x26')](function(){return _0x3d4532;});}else{return _0x3d4532;}})['catch'](function(_0x507be){logger[_0xed29('0x50')](_0xed29('0x51'),_0x507be);throw _0x507be;});}return _0x3d4532;})['then'](respondWithResult(_0x1e0b66,0xc9))['catch'](handleError(_0x1e0b66,null));};exports[_0xed29('0x25')]=function(_0x349530,_0x44a6b1){if(_0x349530['body']['id']){delete _0x349530[_0xed29('0x49')]['id'];}return db['AnalyticExtractedReport'][_0xed29('0x47')]({'where':{'id':_0x349530[_0xed29('0x52')]['id']}})[_0xed29('0x26')](handleEntityNotFound(_0x44a6b1,null))['then'](saveUpdates(_0x349530[_0xed29('0x49')],null))[_0xed29('0x26')](respondWithResult(_0x44a6b1,null))['catch'](handleError(_0x44a6b1,null));};exports[_0xed29('0x53')]=function(_0x4cc5be,_0x56dbe5){return db[_0xed29('0x40')][_0xed29('0x47')]({'where':{'id':_0x4cc5be[_0xed29('0x52')]['id']}})['then'](handleEntityNotFound(_0x56dbe5,null))[_0xed29('0x26')](removeEntity(_0x56dbe5,null))[_0xed29('0x43')](handleError(_0x56dbe5,null));};exports[_0xed29('0x54')]=function(_0x3d20bf,_0x59a0ad,_0xa03b0f){return db[_0xed29('0x40')][_0xed29('0x47')]({'where':{'id':_0x3d20bf[_0xed29('0x52')]['id']},'attributes':['name',_0xed29('0x55'),_0xed29('0x56'),_0xed29('0x57')],'raw':!![]})[_0xed29('0x26')](handleEntityNotFound(_0x59a0ad,null))[_0xed29('0x26')](function(_0x5987cd){if(_0x5987cd){if(!fs[_0xed29('0x58')](path['join'](config[_0xed29('0x59')],_0xed29('0x5a'),_0x5987cd[_0xed29('0x56')]))){throw new db[(_0xed29('0x5b'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x3d20bf[_0xed29('0x2f')]['exists']){return _0x59a0ad[_0xed29('0x19')](0xc8);}return _0x59a0ad['download'](path['join'](config[_0xed29('0x59')],_0xed29('0x5a'),_0x5987cd[_0xed29('0x56')]),util[_0xed29('0x5c')]('%s.%s',_0x5987cd[_0xed29('0x55')]||_0x5987cd[_0xed29('0x2a')],_0x5987cd['output']['toLowerCase']()));}})[_0xed29('0x43')](handleError(_0x59a0ad,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index c60569f..2c3f7c1 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 _0xc7b9=['analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticExtractedReport'];(function(_0x28cb1b,_0x484d41){var _0xb09da1=function(_0xf62a6f){while(--_0xf62a6f){_0x28cb1b['push'](_0x28cb1b['shift']());}};_0xb09da1(++_0x484d41);}(_0xc7b9,0x69));var _0x9c7b=function(_0x15d709,_0x5659ab){_0x15d709=_0x15d709-0x0;var _0x458608=_0xc7b9[_0x15d709];return _0x458608;};'use strict';var _=require(_0x9c7b('0x0'));var util=require(_0x9c7b('0x1'));var logger=require(_0x9c7b('0x2'))(_0x9c7b('0x3'));var moment=require(_0x9c7b('0x4'));var BPromise=require(_0x9c7b('0x5'));var rp=require(_0x9c7b('0x6'));var fs=require('fs');var path=require(_0x9c7b('0x7'));var rimraf=require(_0x9c7b('0x8'));var config=require(_0x9c7b('0x9'));var attributes=require('./analyticExtractedReport.attributes');module[_0x9c7b('0xa')]=function(_0x522d11,_0x5dfc97){return _0x522d11['define'](_0x9c7b('0xb'),attributes,{'tableName':_0x9c7b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa83d=['analytics_extracted_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport'];(function(_0x28caf4,_0x797e55){var _0x503f93=function(_0x1dca13){while(--_0x1dca13){_0x28caf4['push'](_0x28caf4['shift']());}};_0x503f93(++_0x797e55);}(_0xa83d,0x115));var _0xda83=function(_0x10cc0f,_0x1b7e31){_0x10cc0f=_0x10cc0f-0x0;var _0x1032f3=_0xa83d[_0x10cc0f];return _0x1032f3;};'use strict';var _=require(_0xda83('0x0'));var util=require(_0xda83('0x1'));var logger=require('../../config/logger')(_0xda83('0x2'));var moment=require(_0xda83('0x3'));var BPromise=require(_0xda83('0x4'));var rp=require(_0xda83('0x5'));var fs=require('fs');var path=require(_0xda83('0x6'));var rimraf=require(_0xda83('0x7'));var config=require(_0xda83('0x8'));var attributes=require(_0xda83('0x9'));module['exports']=function(_0x2e22c1,_0x518c15){return _0x2e22c1['define'](_0xda83('0xa'),attributes,{'tableName':_0xda83('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 8d9436c..3ad9147 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 _0xf4e9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0xfc6e80,_0x34b35b){var _0x16ee58=function(_0x1f446e){while(--_0x1f446e){_0xfc6e80['push'](_0xfc6e80['shift']());}};_0x16ee58(++_0x34b35b);}(_0xf4e9,0x174));var _0x9f4e=function(_0x10ab84,_0x456646){_0x10ab84=_0x10ab84-0x0;var _0x338f26=_0xf4e9[_0x10ab84];return _0x338f26;};'use strict';var _=require(_0x9f4e('0x0'));var util=require(_0x9f4e('0x1'));var moment=require(_0x9f4e('0x2'));var BPromise=require(_0x9f4e('0x3'));var rs=require(_0x9f4e('0x4'));var fs=require('fs');var Redis=require(_0x9f4e('0x5'));var db=require(_0x9f4e('0x6'))['db'];var utils=require(_0x9f4e('0x7'));var logger=require('../../config/logger')(_0x9f4e('0x8'));var config=require(_0x9f4e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9f4e('0xa')][_0x9f4e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fb06,_0x384af9,_0x26387c){return new BPromise(function(_0x45cf1f,_0x2e0549){return client[_0x9f4e('0xc')](_0x13fb06,_0x26387c)['then'](function(_0x589d4f){logger[_0x9f4e('0xd')](_0x9f4e('0xe'),_0x384af9,_0x9f4e('0xf'));logger['debug'](_0x9f4e('0x10'),_0x384af9,_0x9f4e('0xf'),JSON[_0x9f4e('0x11')](_0x589d4f));if(_0x589d4f[_0x9f4e('0x12')]){if(_0x589d4f['error']['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x384af9,_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);return _0x2e0549(_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);}logger[_0x9f4e('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x384af9,_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);return _0x45cf1f(_0x589d4f[_0x9f4e('0x12')][_0x9f4e('0x13')]);}else{logger[_0x9f4e('0xd')](_0x9f4e('0xe'),_0x384af9,_0x9f4e('0xf'));_0x45cf1f(_0x589d4f[_0x9f4e('0x14')][_0x9f4e('0x13')]);}})[_0x9f4e('0x15')](function(_0x50747b){logger[_0x9f4e('0x12')](_0x9f4e('0xe'),_0x384af9,_0x50747b);_0x2e0549(_0x50747b);});});} \ No newline at end of file +var _0x07d2=['request','then','info','request\x20sent','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0xa114d,_0x4db0b6){var _0x18da03=function(_0x571d0f){while(--_0x571d0f){_0xa114d['push'](_0xa114d['shift']());}};_0x18da03(++_0x4db0b6);}(_0x07d2,0x1ed));var _0x207d=function(_0x637a92,_0x33f5b9){_0x637a92=_0x637a92-0x0;var _0x3485c8=_0x07d2[_0x637a92];return _0x3485c8;};'use strict';var _=require(_0x207d('0x0'));var util=require(_0x207d('0x1'));var moment=require(_0x207d('0x2'));var BPromise=require('bluebird');var rs=require(_0x207d('0x3'));var fs=require('fs');var Redis=require(_0x207d('0x4'));var db=require(_0x207d('0x5'))['db'];var utils=require(_0x207d('0x6'));var logger=require(_0x207d('0x7'))('rpc');var config=require(_0x207d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x207d('0x9')][_0x207d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x461f43,_0x4a5da2,_0x2a1ee7){return new BPromise(function(_0x127f53,_0x217605){return client[_0x207d('0xb')](_0x461f43,_0x2a1ee7)[_0x207d('0xc')](function(_0x149a3e){logger[_0x207d('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a5da2,_0x207d('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4a5da2,_0x207d('0xe'),JSON[_0x207d('0xf')](_0x149a3e));if(_0x149a3e[_0x207d('0x10')]){if(_0x149a3e[_0x207d('0x10')]['code']===0x1f4){logger[_0x207d('0x10')](_0x207d('0x11'),_0x4a5da2,_0x149a3e['error'][_0x207d('0x12')]);return _0x217605(_0x149a3e[_0x207d('0x10')]['message']);}logger[_0x207d('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a5da2,_0x149a3e['error'][_0x207d('0x12')]);return _0x127f53(_0x149a3e[_0x207d('0x10')][_0x207d('0x12')]);}else{logger[_0x207d('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a5da2,_0x207d('0xe'));_0x127f53(_0x149a3e[_0x207d('0x13')]['message']);}})[_0x207d('0x14')](function(_0xa7bc5d){logger[_0x207d('0x10')](_0x207d('0x11'),_0x4a5da2,_0xa7bc5d);_0x217605(_0xa7bc5d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4530e0c..6c520f9 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 _0xece6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','create','update','delete','exports','multer'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xece6,0x1c7));var _0x6ece=function(_0x3a4236,_0x1488df){_0x3a4236=_0x3a4236-0x0;var _0x52d615=_0xece6[_0x3a4236];return _0x52d615;};'use strict';var multer=require(_0x6ece('0x0'));var util=require(_0x6ece('0x1'));var path=require(_0x6ece('0x2'));var timeout=require(_0x6ece('0x3'));var express=require(_0x6ece('0x4'));var router=express[_0x6ece('0x5')]();var fs_extra=require(_0x6ece('0x6'));var auth=require(_0x6ece('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6ece('0x8'));var controller=require(_0x6ece('0x9'));router[_0x6ece('0xa')]('/',auth['isAuthenticated'](),controller[_0x6ece('0xb')]);router['get'](_0x6ece('0xc'),auth[_0x6ece('0xd')](),controller[_0x6ece('0xe')]);router[_0x6ece('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ece('0xf')]);router['put'](_0x6ece('0xc'),auth[_0x6ece('0xd')](),controller[_0x6ece('0x10')]);router[_0x6ece('0x11')]('/:id',auth[_0x6ece('0xd')](),controller['destroy']);module[_0x6ece('0x12')]=router; \ No newline at end of file +var _0x100d=['isAuthenticated','/:id','show','download','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x181f30,_0x59e7e0){var _0x175754=function(_0x5f0751){while(--_0x5f0751){_0x181f30['push'](_0x181f30['shift']());}};_0x175754(++_0x59e7e0);}(_0x100d,0xf9));var _0xd100=function(_0xf3414f,_0x4694c8){_0xf3414f=_0xf3414f-0x0;var _0x5e1f96=_0x100d[_0xf3414f];return _0x5e1f96;};'use strict';var multer=require(_0xd100('0x0'));var util=require(_0xd100('0x1'));var path=require(_0xd100('0x2'));var timeout=require(_0xd100('0x3'));var express=require('express');var router=express[_0xd100('0x4')]();var fs_extra=require(_0xd100('0x5'));var auth=require(_0xd100('0x6'));var interaction=require(_0xd100('0x7'));var config=require(_0xd100('0x8'));var controller=require(_0xd100('0x9'));router[_0xd100('0xa')]('/',auth[_0xd100('0xb')](),controller['index']);router[_0xd100('0xa')](_0xd100('0xc'),auth[_0xd100('0xb')](),controller[_0xd100('0xd')]);router[_0xd100('0xa')]('/:id/download',auth[_0xd100('0xb')](),controller[_0xd100('0xe')]);router[_0xd100('0xf')]('/',auth[_0xd100('0xb')](),controller[_0xd100('0x10')]);router['put'](_0xd100('0xc'),auth['isAuthenticated'](),controller[_0xd100('0x11')]);router[_0xd100('0x12')](_0xd100('0xc'),auth[_0xd100('0xb')](),controller[_0xd100('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4357c56..fd819c8 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 _0x9bb2=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x16028e,_0x230823){var _0x523722=function(_0x579545){while(--_0x579545){_0x16028e['push'](_0x16028e['shift']());}};_0x523722(++_0x230823);}(_0x9bb2,0xea));var _0x29bb=function(_0x2353e5,_0x47a641){_0x2353e5=_0x2353e5-0x0;var _0x547ce6=_0x9bb2[_0x2353e5];return _0x547ce6;};'use strict';var Sequelize=require(_0x29bb('0x0'));module[_0x29bb('0x1')]={'field':{'type':Sequelize[_0x29bb('0x2')]},'alias':{'type':Sequelize[_0x29bb('0x3')]},'function':{'type':Sequelize[_0x29bb('0x3')]},'format':{'type':Sequelize[_0x29bb('0x3')]},'groupBy':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x29bb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cfd=['BOOLEAN','sequelize','exports','STRING'];(function(_0x1ff3a0,_0xcc51cd){var _0x115ca0=function(_0x365b2e){while(--_0x365b2e){_0x1ff3a0['push'](_0x1ff3a0['shift']());}};_0x115ca0(++_0xcc51cd);}(_0x0cfd,0x141));var _0xd0cf=function(_0x433c12,_0x281095){_0x433c12=_0x433c12-0x0;var _0x3f681c=_0x0cfd[_0x433c12];return _0x3f681c;};'use strict';var Sequelize=require(_0xd0cf('0x0'));module[_0xd0cf('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd0cf('0x2')]},'function':{'type':Sequelize[_0xd0cf('0x2')]},'format':{'type':Sequelize[_0xd0cf('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xd0cf('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d36fcec..f1c0842 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 _0x24ed=['options','includeAll','include','rows','catch','show','params','keys','intersection','length','find','bulkCreate','body','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x3b1bc6,_0x43460a){var _0x58956a=function(_0x40099b){while(--_0x40099b){_0x3b1bc6['push'](_0x3b1bc6['shift']());}};_0x58956a(++_0x43460a);}(_0x24ed,0x1c6));var _0xd24e=function(_0x3e19b5,_0x14ea5f){_0x3e19b5=_0x3e19b5-0x0;var _0x118485=_0x24ed[_0x3e19b5];return _0x118485;};'use strict';var emlformat=require(_0xd24e('0x0'));var rimraf=require(_0xd24e('0x1'));var zipdir=require(_0xd24e('0x2'));var jsonpatch=require(_0xd24e('0x3'));var rp=require('request-promise');var moment=require(_0xd24e('0x4'));var BPromise=require(_0xd24e('0x5'));var Mustache=require(_0xd24e('0x6'));var util=require(_0xd24e('0x7'));var path=require(_0xd24e('0x8'));var sox=require('sox');var csv=require(_0xd24e('0x9'));var ejs=require(_0xd24e('0xa'));var fs=require('fs');var fs_extra=require(_0xd24e('0xb'));var _=require(_0xd24e('0xc'));var squel=require(_0xd24e('0xd'));var crypto=require(_0xd24e('0xe'));var jsforce=require(_0xd24e('0xf'));var deskjs=require(_0xd24e('0x10'));var toCsv=require(_0xd24e('0x9'));var querystring=require(_0xd24e('0x11'));var Papa=require(_0xd24e('0x12'));var Redis=require(_0xd24e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd24e('0x14'));var as=require(_0xd24e('0x15'));var hardwareService=require(_0xd24e('0x16'));var logger=require(_0xd24e('0x17'))(_0xd24e('0x18'));var utils=require(_0xd24e('0x19'));var config=require(_0xd24e('0x1a'));var licenseUtil=require(_0xd24e('0x1b'));var db=require(_0xd24e('0x1c'))['db'];function respondWithStatusCode(_0xce12c1,_0x1686fc){_0x1686fc=_0x1686fc||0xcc;return function(_0x4c0cde){if(_0x4c0cde){return _0xce12c1[_0xd24e('0x1d')](_0x1686fc);}return _0xce12c1['status'](_0x1686fc)[_0xd24e('0x1e')]();};}function respondWithResult(_0x35a19a,_0x25fd35){_0x25fd35=_0x25fd35||0xc8;return function(_0x4807f7){if(_0x4807f7){return _0x35a19a[_0xd24e('0x1f')](_0x25fd35)['json'](_0x4807f7);}};}function respondWithFilteredResult(_0x22a759,_0x40dc06){return function(_0x1169e4){if(_0x1169e4){var _0x4a52a2=typeof _0x40dc06[_0xd24e('0x20')]==='undefined'&&typeof _0x40dc06[_0xd24e('0x21')]===_0xd24e('0x22');var _0x194e97=_0x1169e4[_0xd24e('0x23')];var _0x50503e=_0x4a52a2?0x0:_0x40dc06[_0xd24e('0x20')];var _0x56acba=_0x4a52a2?_0x1169e4[_0xd24e('0x23')]:_0x40dc06[_0xd24e('0x20')]+_0x40dc06[_0xd24e('0x21')];var _0xbf72c;if(_0x56acba>=_0x194e97){_0x56acba=_0x194e97;_0xbf72c=0xc8;}else{_0xbf72c=0xce;}_0x22a759[_0xd24e('0x1f')](_0xbf72c);return _0x22a759[_0xd24e('0x24')](_0xd24e('0x25'),_0x50503e+'-'+_0x56acba+'/'+_0x194e97)[_0xd24e('0x26')](_0x1169e4);}return null;};}function patchUpdates(_0x39ab1f){return function(_0x22f56c){try{jsonpatch[_0xd24e('0x27')](_0x22f56c,_0x39ab1f,!![]);}catch(_0xd763e8){return BPromise[_0xd24e('0x28')](_0xd763e8);}return _0x22f56c['save']();};}function saveUpdates(_0x12420e,_0x34e8bd){return function(_0x58f0ce){if(_0x58f0ce){return _0x58f0ce[_0xd24e('0x29')](_0x12420e)[_0xd24e('0x2a')](function(_0x3bb50a){return _0x3bb50a;});}return null;};}function removeEntity(_0xa8a29f,_0x3db5ae){return function(_0x5a9f45){if(_0x5a9f45){return _0x5a9f45[_0xd24e('0x2b')]()['then'](function(){_0xa8a29f[_0xd24e('0x1f')](0xcc)[_0xd24e('0x1e')]();});}};}function handleEntityNotFound(_0x4a4fc1,_0x50bf44){return function(_0xfa762f){if(!_0xfa762f){_0x4a4fc1[_0xd24e('0x1d')](0x194);}return _0xfa762f;};}function handleError(_0x15fa99,_0x6ef5c){_0x6ef5c=_0x6ef5c||0x1f4;return function(_0x3fd770){logger[_0xd24e('0x2c')](_0x3fd770[_0xd24e('0x2d')]);if(_0x3fd770[_0xd24e('0x2e')]){delete _0x3fd770[_0xd24e('0x2e')];}_0x15fa99[_0xd24e('0x1f')](_0x6ef5c)[_0xd24e('0x2f')](_0x3fd770);};}exports[_0xd24e('0x30')]=function(_0x49e24d,_0xb68ec1){var _0x47ce9e={},_0x40d1ae={},_0x5c537f={'count':0x0,'rows':[]};var _0x24c9e2=_[_0xd24e('0x31')](db[_0xd24e('0x32')][_0xd24e('0x33')],function(_0x494cdb){return{'name':_0x494cdb[_0xd24e('0x34')],'type':_0x494cdb[_0xd24e('0x35')][_0xd24e('0x36')]};});_0x40d1ae['model']=_[_0xd24e('0x31')](_0x24c9e2,_0xd24e('0x2e'));_0x40d1ae['query']=_['keys'](_0x49e24d['query']);_0x40d1ae['filters']=_['intersection'](_0x40d1ae['model'],_0x40d1ae[_0xd24e('0x37')]);_0x47ce9e[_0xd24e('0x38')]=_['intersection'](_0x40d1ae['model'],qs[_0xd24e('0x39')](_0x49e24d[_0xd24e('0x37')][_0xd24e('0x39')]));_0x47ce9e[_0xd24e('0x38')]=_0x47ce9e[_0xd24e('0x38')]['length']?_0x47ce9e[_0xd24e('0x38')]:_0x40d1ae[_0xd24e('0x3a')];if(!_0x49e24d[_0xd24e('0x37')][_0xd24e('0x3b')](_0xd24e('0x3c'))){_0x47ce9e['limit']=qs[_0xd24e('0x21')](_0x49e24d[_0xd24e('0x37')][_0xd24e('0x21')]);_0x47ce9e[_0xd24e('0x20')]=qs[_0xd24e('0x20')](_0x49e24d[_0xd24e('0x37')][_0xd24e('0x20')]);}_0x47ce9e[_0xd24e('0x3d')]=qs[_0xd24e('0x3e')](_0x49e24d[_0xd24e('0x37')]['sort']);_0x47ce9e[_0xd24e('0x3f')]=qs['filters'](_['pick'](_0x49e24d[_0xd24e('0x37')],_0x40d1ae[_0xd24e('0x40')]),_0x24c9e2);if(_0x49e24d[_0xd24e('0x37')][_0xd24e('0x41')]){_0x47ce9e[_0xd24e('0x3f')]=_[_0xd24e('0x42')](_0x47ce9e[_0xd24e('0x3f')],{'$or':_[_0xd24e('0x31')](_0x24c9e2,function(_0x433075){if(_0x433075['type']!==_0xd24e('0x43')){var _0x3dfac5={};_0x3dfac5[_0x433075['name']]={'$like':'%'+_0x49e24d[_0xd24e('0x37')][_0xd24e('0x41')]+'%'};return _0x3dfac5;}})});}_0x47ce9e=_[_0xd24e('0x42')]({},_0x47ce9e,_0x49e24d[_0xd24e('0x44')]);var _0x5a7baa={'where':_0x47ce9e[_0xd24e('0x3f')]};return db[_0xd24e('0x32')][_0xd24e('0x23')](_0x5a7baa)['then'](function(_0x3a5c3a){_0x5c537f[_0xd24e('0x23')]=_0x3a5c3a;if(_0x49e24d[_0xd24e('0x37')][_0xd24e('0x45')]){_0x47ce9e[_0xd24e('0x46')]=[{'all':!![]}];}return db[_0xd24e('0x32')]['findAll'](_0x47ce9e);})[_0xd24e('0x2a')](function(_0x1b94c2){_0x5c537f[_0xd24e('0x47')]=_0x1b94c2;return _0x5c537f;})[_0xd24e('0x2a')](respondWithFilteredResult(_0xb68ec1,_0x47ce9e))[_0xd24e('0x48')](handleError(_0xb68ec1,null));};exports[_0xd24e('0x49')]=function(_0x12a8ab,_0x9b845d){var _0x41deaa={'raw':![],'where':{'id':_0x12a8ab[_0xd24e('0x4a')]['id']}},_0x38309f={};_0x38309f[_0xd24e('0x3a')]=_[_0xd24e('0x4b')](db[_0xd24e('0x32')][_0xd24e('0x33')]);_0x38309f[_0xd24e('0x37')]=_['keys'](_0x12a8ab['query']);_0x38309f['filters']=_[_0xd24e('0x4c')](_0x38309f['model'],_0x38309f[_0xd24e('0x37')]);_0x41deaa[_0xd24e('0x38')]=_[_0xd24e('0x4c')](_0x38309f[_0xd24e('0x3a')],qs['fields'](_0x12a8ab[_0xd24e('0x37')][_0xd24e('0x39')]));_0x41deaa[_0xd24e('0x38')]=_0x41deaa[_0xd24e('0x38')][_0xd24e('0x4d')]?_0x41deaa[_0xd24e('0x38')]:_0x38309f[_0xd24e('0x3a')];if(_0x12a8ab[_0xd24e('0x37')][_0xd24e('0x45')]){_0x41deaa['include']=[{'all':!![]}];}_0x41deaa=_[_0xd24e('0x42')]({},_0x41deaa,_0x12a8ab[_0xd24e('0x44')]);return db[_0xd24e('0x32')][_0xd24e('0x4e')](_0x41deaa)[_0xd24e('0x2a')](handleEntityNotFound(_0x9b845d,null))[_0xd24e('0x2a')](respondWithResult(_0x9b845d,null))[_0xd24e('0x48')](handleError(_0x9b845d,null));};exports['create']=function(_0x564a80,_0x12ac6a){return db[_0xd24e('0x32')]['create'](_0x564a80['body'],{})[_0xd24e('0x2a')](respondWithResult(_0x12ac6a,0xc9))[_0xd24e('0x48')](handleError(_0x12ac6a,null));};exports[_0xd24e('0x4f')]=function(_0x4b3354,_0x7812cf){return db['AnalyticFieldReport'][_0xd24e('0x4f')](_0x4b3354[_0xd24e('0x50')],{'raw':![],'individualHooks':!![]})[_0xd24e('0x2a')](respondWithResult(_0x7812cf,0xc9))[_0xd24e('0x48')](handleError(_0x7812cf,null));};exports[_0xd24e('0x29')]=function(_0x4700e6,_0x47ec77){if(_0x4700e6[_0xd24e('0x50')]['id']){delete _0x4700e6['body']['id'];}return db[_0xd24e('0x32')][_0xd24e('0x4e')]({'where':{'id':_0x4700e6['params']['id']}})[_0xd24e('0x2a')](handleEntityNotFound(_0x47ec77,null))[_0xd24e('0x2a')](saveUpdates(_0x4700e6[_0xd24e('0x50')],null))[_0xd24e('0x2a')](respondWithResult(_0x47ec77,null))[_0xd24e('0x48')](handleError(_0x47ec77,null));};exports[_0xd24e('0x2b')]=function(_0x5905fd,_0x5c0d7c){return db[_0xd24e('0x32')][_0xd24e('0x4e')]({'where':{'id':_0x5905fd[_0xd24e('0x4a')]['id']}})[_0xd24e('0x2a')](handleEntityNotFound(_0x5c0d7c,null))[_0xd24e('0x2a')](removeEntity(_0x5c0d7c,null))[_0xd24e('0x48')](handleError(_0x5c0d7c,null));};exports['bulkDestroy']=function(_0x4040e8,_0x1dca2f){return db['AnalyticFieldReport'][_0xd24e('0x2b')]({'where':{'id':_0x4040e8[_0xd24e('0x37')][_0xd24e('0x51')]||[]},'raw':![],'individualHooks':!![]})[_0xd24e('0x2a')](respondWithResult(_0x1dca2f,0xcc))[_0xd24e('0x48')](handleError(_0x1dca2f,null));};exports[_0xd24e('0x52')]=function(_0x5c9baa,_0x5082ac,_0x33969f){return db[_0xd24e('0x53')][_0xd24e('0x54')]({'where':{'id':_0x5c9baa[_0xd24e('0x4a')]['id']}})[_0xd24e('0x2a')](handleEntityNotFound(_0x5082ac,null))[_0xd24e('0x2a')](function(_0x44a571){if(_0x44a571){return db['sequelize'][_0xd24e('0x55')](function(_0x36ac80){return db[_0xd24e('0x32')][_0xd24e('0x2b')]({'where':{'CustomReportId':_0x5c9baa['params']['id']},'transaction':_0x36ac80})['then'](function(_0x5a9ab7){var _0x349be1=_[_0xd24e('0x31')](_0x5c9baa[_0xd24e('0x50')],function(_0x4e26e3){delete _0x4e26e3['id'];_0x4e26e3[_0xd24e('0x56')]=_0x5c9baa[_0xd24e('0x4a')]['id'];return _0x4e26e3;});return db[_0xd24e('0x32')][_0xd24e('0x4f')](_0x349be1,{'transaction':_0x36ac80});});})[_0xd24e('0x2a')](function(){return db[_0xd24e('0x32')]['findAll']({'where':{'CustomReportId':_0x5c9baa['params']['id']}});});}})['then'](respondWithResult(_0x5082ac,null))[_0xd24e('0x48')](handleError(_0x5082ac,null));}; \ No newline at end of file +var _0xb6e6=['findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','status','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','findAll','catch','params','include','find','create','bulkCreate','body','bulkDestroy','ids','addFields'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xb6e6,0x180));var _0x6b6e=function(_0x1de8df,_0x46c68f){_0x1de8df=_0x1de8df-0x0;var _0x16661d=_0xb6e6[_0x1de8df];return _0x16661d;};'use strict';var emlformat=require(_0x6b6e('0x0'));var rimraf=require(_0x6b6e('0x1'));var zipdir=require(_0x6b6e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b6e('0x3'));var BPromise=require(_0x6b6e('0x4'));var Mustache=require('mustache');var util=require(_0x6b6e('0x5'));var path=require(_0x6b6e('0x6'));var sox=require('sox');var csv=require(_0x6b6e('0x7'));var ejs=require(_0x6b6e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b6e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b6e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6b6e('0x7'));var querystring=require(_0x6b6e('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b6e('0xc'));var authService=require(_0x6b6e('0xd'));var qs=require(_0x6b6e('0xe'));var as=require(_0x6b6e('0xf'));var hardwareService=require(_0x6b6e('0x10'));var logger=require(_0x6b6e('0x11'))(_0x6b6e('0x12'));var utils=require('../../config/utils');var config=require(_0x6b6e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59164c,_0x5badb7){_0x5badb7=_0x5badb7||0xcc;return function(_0x87cf8e){if(_0x87cf8e){return _0x59164c[_0x6b6e('0x14')](_0x5badb7);}return _0x59164c['status'](_0x5badb7)[_0x6b6e('0x15')]();};}function respondWithResult(_0x5ec087,_0x276d65){_0x276d65=_0x276d65||0xc8;return function(_0x125bce){if(_0x125bce){return _0x5ec087['status'](_0x276d65)[_0x6b6e('0x16')](_0x125bce);}};}function respondWithFilteredResult(_0x35a78a,_0x2c4281){return function(_0x2f9b46){if(_0x2f9b46){var _0x4e8973=typeof _0x2c4281[_0x6b6e('0x17')]===_0x6b6e('0x18')&&typeof _0x2c4281[_0x6b6e('0x19')]===_0x6b6e('0x18');var _0x46051f=_0x2f9b46['count'];var _0x28fd10=_0x4e8973?0x0:_0x2c4281[_0x6b6e('0x17')];var _0x16a4bd=_0x4e8973?_0x2f9b46[_0x6b6e('0x1a')]:_0x2c4281[_0x6b6e('0x17')]+_0x2c4281[_0x6b6e('0x19')];var _0x5f2bc5;if(_0x16a4bd>=_0x46051f){_0x16a4bd=_0x46051f;_0x5f2bc5=0xc8;}else{_0x5f2bc5=0xce;}_0x35a78a['status'](_0x5f2bc5);return _0x35a78a[_0x6b6e('0x1b')](_0x6b6e('0x1c'),_0x28fd10+'-'+_0x16a4bd+'/'+_0x46051f)[_0x6b6e('0x16')](_0x2f9b46);}return null;};}function patchUpdates(_0x11945f){return function(_0x549173){try{jsonpatch['apply'](_0x549173,_0x11945f,!![]);}catch(_0x18d973){return BPromise[_0x6b6e('0x1d')](_0x18d973);}return _0x549173['save']();};}function saveUpdates(_0x5a3510,_0x925188){return function(_0x43434f){if(_0x43434f){return _0x43434f[_0x6b6e('0x1e')](_0x5a3510)[_0x6b6e('0x1f')](function(_0x629bcb){return _0x629bcb;});}return null;};}function removeEntity(_0xc58508,_0x3a7504){return function(_0x11b616){if(_0x11b616){return _0x11b616[_0x6b6e('0x20')]()[_0x6b6e('0x1f')](function(){_0xc58508[_0x6b6e('0x21')](0xcc)[_0x6b6e('0x15')]();});}};}function handleEntityNotFound(_0x1ecf66,_0x1f05cb){return function(_0x11fac8){if(!_0x11fac8){_0x1ecf66['sendStatus'](0x194);}return _0x11fac8;};}function handleError(_0x103aaf,_0x43d6cd){_0x43d6cd=_0x43d6cd||0x1f4;return function(_0x4159e8){logger[_0x6b6e('0x22')](_0x4159e8['stack']);if(_0x4159e8['name']){delete _0x4159e8[_0x6b6e('0x23')];}_0x103aaf[_0x6b6e('0x21')](_0x43d6cd)[_0x6b6e('0x24')](_0x4159e8);};}exports['index']=function(_0x434fc2,_0x1f9170){var _0x265fc1={},_0x14e9e0={},_0x200ecf={'count':0x0,'rows':[]};var _0x529c3f=_[_0x6b6e('0x25')](db['AnalyticFieldReport'][_0x6b6e('0x26')],function(_0x49f272){return{'name':_0x49f272[_0x6b6e('0x27')],'type':_0x49f272['type'][_0x6b6e('0x28')]};});_0x14e9e0[_0x6b6e('0x29')]=_[_0x6b6e('0x25')](_0x529c3f,_0x6b6e('0x23'));_0x14e9e0[_0x6b6e('0x2a')]=_[_0x6b6e('0x2b')](_0x434fc2['query']);_0x14e9e0[_0x6b6e('0x2c')]=_[_0x6b6e('0x2d')](_0x14e9e0[_0x6b6e('0x29')],_0x14e9e0[_0x6b6e('0x2a')]);_0x265fc1[_0x6b6e('0x2e')]=_['intersection'](_0x14e9e0[_0x6b6e('0x29')],qs[_0x6b6e('0x2f')](_0x434fc2['query'][_0x6b6e('0x2f')]));_0x265fc1[_0x6b6e('0x2e')]=_0x265fc1['attributes'][_0x6b6e('0x30')]?_0x265fc1[_0x6b6e('0x2e')]:_0x14e9e0[_0x6b6e('0x29')];if(!_0x434fc2[_0x6b6e('0x2a')][_0x6b6e('0x31')](_0x6b6e('0x32'))){_0x265fc1[_0x6b6e('0x19')]=qs['limit'](_0x434fc2['query']['limit']);_0x265fc1[_0x6b6e('0x17')]=qs[_0x6b6e('0x17')](_0x434fc2['query'][_0x6b6e('0x17')]);}_0x265fc1[_0x6b6e('0x33')]=qs[_0x6b6e('0x34')](_0x434fc2[_0x6b6e('0x2a')]['sort']);_0x265fc1[_0x6b6e('0x35')]=qs['filters'](_['pick'](_0x434fc2['query'],_0x14e9e0[_0x6b6e('0x2c')]),_0x529c3f);if(_0x434fc2['query']['filter']){_0x265fc1[_0x6b6e('0x35')]=_[_0x6b6e('0x36')](_0x265fc1[_0x6b6e('0x35')],{'$or':_[_0x6b6e('0x25')](_0x529c3f,function(_0x384992){if(_0x384992[_0x6b6e('0x37')]!==_0x6b6e('0x38')){var _0x3ca499={};_0x3ca499[_0x384992['name']]={'$like':'%'+_0x434fc2[_0x6b6e('0x2a')][_0x6b6e('0x39')]+'%'};return _0x3ca499;}})});}_0x265fc1=_[_0x6b6e('0x36')]({},_0x265fc1,_0x434fc2[_0x6b6e('0x3a')]);var _0x9f64e9={'where':_0x265fc1[_0x6b6e('0x35')]};return db[_0x6b6e('0x3b')][_0x6b6e('0x1a')](_0x9f64e9)[_0x6b6e('0x1f')](function(_0x19f0b9){_0x200ecf[_0x6b6e('0x1a')]=_0x19f0b9;if(_0x434fc2[_0x6b6e('0x2a')][_0x6b6e('0x3c')]){_0x265fc1['include']=[{'all':!![]}];}return db[_0x6b6e('0x3b')][_0x6b6e('0x3d')](_0x265fc1);})['then'](function(_0x56148f){_0x200ecf['rows']=_0x56148f;return _0x200ecf;})[_0x6b6e('0x1f')](respondWithFilteredResult(_0x1f9170,_0x265fc1))[_0x6b6e('0x3e')](handleError(_0x1f9170,null));};exports['show']=function(_0x1961ef,_0x146884){var _0x17dbf6={'raw':![],'where':{'id':_0x1961ef[_0x6b6e('0x3f')]['id']}},_0x1f9ba5={};_0x1f9ba5['model']=_['keys'](db[_0x6b6e('0x3b')][_0x6b6e('0x26')]);_0x1f9ba5['query']=_['keys'](_0x1961ef[_0x6b6e('0x2a')]);_0x1f9ba5[_0x6b6e('0x2c')]=_['intersection'](_0x1f9ba5['model'],_0x1f9ba5[_0x6b6e('0x2a')]);_0x17dbf6[_0x6b6e('0x2e')]=_[_0x6b6e('0x2d')](_0x1f9ba5[_0x6b6e('0x29')],qs[_0x6b6e('0x2f')](_0x1961ef[_0x6b6e('0x2a')][_0x6b6e('0x2f')]));_0x17dbf6['attributes']=_0x17dbf6[_0x6b6e('0x2e')][_0x6b6e('0x30')]?_0x17dbf6['attributes']:_0x1f9ba5['model'];if(_0x1961ef[_0x6b6e('0x2a')][_0x6b6e('0x3c')]){_0x17dbf6[_0x6b6e('0x40')]=[{'all':!![]}];}_0x17dbf6=_[_0x6b6e('0x36')]({},_0x17dbf6,_0x1961ef[_0x6b6e('0x3a')]);return db[_0x6b6e('0x3b')][_0x6b6e('0x41')](_0x17dbf6)[_0x6b6e('0x1f')](handleEntityNotFound(_0x146884,null))['then'](respondWithResult(_0x146884,null))[_0x6b6e('0x3e')](handleError(_0x146884,null));};exports[_0x6b6e('0x42')]=function(_0x348bb3,_0x4fe95b){return db[_0x6b6e('0x3b')][_0x6b6e('0x42')](_0x348bb3['body'],{})[_0x6b6e('0x1f')](respondWithResult(_0x4fe95b,0xc9))[_0x6b6e('0x3e')](handleError(_0x4fe95b,null));};exports[_0x6b6e('0x43')]=function(_0x43b636,_0x40f676){return db[_0x6b6e('0x3b')][_0x6b6e('0x43')](_0x43b636[_0x6b6e('0x44')],{'raw':![],'individualHooks':!![]})[_0x6b6e('0x1f')](respondWithResult(_0x40f676,0xc9))[_0x6b6e('0x3e')](handleError(_0x40f676,null));};exports['update']=function(_0x2981fb,_0x575eaf){if(_0x2981fb[_0x6b6e('0x44')]['id']){delete _0x2981fb[_0x6b6e('0x44')]['id'];}return db[_0x6b6e('0x3b')][_0x6b6e('0x41')]({'where':{'id':_0x2981fb[_0x6b6e('0x3f')]['id']}})['then'](handleEntityNotFound(_0x575eaf,null))[_0x6b6e('0x1f')](saveUpdates(_0x2981fb['body'],null))[_0x6b6e('0x1f')](respondWithResult(_0x575eaf,null))['catch'](handleError(_0x575eaf,null));};exports[_0x6b6e('0x20')]=function(_0x2bc472,_0x54f8ca){return db['AnalyticFieldReport']['find']({'where':{'id':_0x2bc472['params']['id']}})['then'](handleEntityNotFound(_0x54f8ca,null))[_0x6b6e('0x1f')](removeEntity(_0x54f8ca,null))['catch'](handleError(_0x54f8ca,null));};exports[_0x6b6e('0x45')]=function(_0x510aec,_0x271a21){return db[_0x6b6e('0x3b')][_0x6b6e('0x20')]({'where':{'id':_0x510aec['query'][_0x6b6e('0x46')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x271a21,0xcc))['catch'](handleError(_0x271a21,null));};exports[_0x6b6e('0x47')]=function(_0xf3132c,_0x4d84ec,_0x2ce908){return db['AnalyticCustomReport'][_0x6b6e('0x48')]({'where':{'id':_0xf3132c[_0x6b6e('0x3f')]['id']}})[_0x6b6e('0x1f')](handleEntityNotFound(_0x4d84ec,null))[_0x6b6e('0x1f')](function(_0x5a4a63){if(_0x5a4a63){return db[_0x6b6e('0x49')][_0x6b6e('0x4a')](function(_0x586527){return db[_0x6b6e('0x3b')]['destroy']({'where':{'CustomReportId':_0xf3132c[_0x6b6e('0x3f')]['id']},'transaction':_0x586527})[_0x6b6e('0x1f')](function(_0x4a4b6f){var _0x5660f8=_[_0x6b6e('0x25')](_0xf3132c[_0x6b6e('0x44')],function(_0x3a5e71){delete _0x3a5e71['id'];_0x3a5e71[_0x6b6e('0x4b')]=_0xf3132c[_0x6b6e('0x3f')]['id'];return _0x3a5e71;});return db['AnalyticFieldReport'][_0x6b6e('0x43')](_0x5660f8,{'transaction':_0x586527});});})[_0x6b6e('0x1f')](function(){return db[_0x6b6e('0x3b')][_0x6b6e('0x3d')]({'where':{'CustomReportId':_0xf3132c['params']['id']}});});}})[_0x6b6e('0x1f')](respondWithResult(_0x4d84ec,null))['catch'](handleError(_0x4d84ec,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index db8b4b5..ad5a3f3 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 _0xda1a=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x54b5bc,_0x188e5c){var _0x20971f=function(_0x4eb2e6){while(--_0x4eb2e6){_0x54b5bc['push'](_0x54b5bc['shift']());}};_0x20971f(++_0x188e5c);}(_0xda1a,0x1e7));var _0xada1=function(_0x16ffc6,_0x1ec0f7){_0x16ffc6=_0x16ffc6-0x0;var _0x5631a9=_0xda1a[_0x16ffc6];return _0x5631a9;};'use strict';var _=require(_0xada1('0x0'));var util=require('util');var logger=require(_0xada1('0x1'))(_0xada1('0x2'));var moment=require(_0xada1('0x3'));var BPromise=require('bluebird');var rp=require(_0xada1('0x4'));var fs=require('fs');var path=require(_0xada1('0x5'));var rimraf=require(_0xada1('0x6'));var config=require(_0xada1('0x7'));var attributes=require(_0xada1('0x8'));module[_0xada1('0x9')]=function(_0x5aa589,_0x2410a2){return _0x5aa589[_0xada1('0xa')](_0xada1('0xb'),attributes,{'tableName':_0xada1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a1a=['bluebird','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','api'];(function(_0x5782e2,_0x7d501d){var _0xeece8c=function(_0x179e34){while(--_0x179e34){_0x5782e2['push'](_0x5782e2['shift']());}};_0xeece8c(++_0x7d501d);}(_0x2a1a,0x87));var _0xa2a1=function(_0x1114f4,_0x2f6495){_0x1114f4=_0x1114f4-0x0;var _0x1965ce=_0x2a1a[_0x1114f4];return _0x1965ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa2a1('0x0'));var moment=require('moment');var BPromise=require(_0xa2a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a1('0x2'));var rimraf=require(_0xa2a1('0x3'));var config=require(_0xa2a1('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0xa2a1('0x5')]=function(_0x3dad6e,_0xe41e){return _0x3dad6e[_0xa2a1('0x6')](_0xa2a1('0x7'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 37d4f8e..511c586 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 _0xf74d=['http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x34ca4e,_0x206484){var _0x3d314d=function(_0x2e7319){while(--_0x2e7319){_0x34ca4e['push'](_0x34ca4e['shift']());}};_0x3d314d(++_0x206484);}(_0xf74d,0xf3));var _0xdf74=function(_0x17bafd,_0x46bb80){_0x17bafd=_0x17bafd-0x0;var _0x47c18f=_0xf74d[_0x17bafd];return _0x47c18f;};'use strict';var _=require('lodash');var util=require(_0xdf74('0x0'));var moment=require(_0xdf74('0x1'));var BPromise=require(_0xdf74('0x2'));var rs=require(_0xdf74('0x3'));var fs=require('fs');var Redis=require(_0xdf74('0x4'));var db=require(_0xdf74('0x5'))['db'];var utils=require(_0xdf74('0x6'));var logger=require(_0xdf74('0x7'))(_0xdf74('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf74('0x9'));var client=jayson['client'][_0xdf74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd32da,_0x21b625,_0x22b464){return new BPromise(function(_0x3fcbce,_0x167411){return client[_0xdf74('0xb')](_0xdd32da,_0x22b464)['then'](function(_0x3765d2){logger[_0xdf74('0xc')](_0xdf74('0xd'),_0x21b625,_0xdf74('0xe'));logger[_0xdf74('0xf')](_0xdf74('0x10'),_0x21b625,_0xdf74('0xe'),JSON[_0xdf74('0x11')](_0x3765d2));if(_0x3765d2[_0xdf74('0x12')]){if(_0x3765d2[_0xdf74('0x12')][_0xdf74('0x13')]===0x1f4){logger['error'](_0xdf74('0xd'),_0x21b625,_0x3765d2[_0xdf74('0x12')]['message']);return _0x167411(_0x3765d2[_0xdf74('0x12')][_0xdf74('0x14')]);}logger[_0xdf74('0x12')](_0xdf74('0xd'),_0x21b625,_0x3765d2['error']['message']);return _0x3fcbce(_0x3765d2[_0xdf74('0x12')][_0xdf74('0x14')]);}else{logger[_0xdf74('0xc')](_0xdf74('0xd'),_0x21b625,'request\x20sent');_0x3fcbce(_0x3765d2[_0xdf74('0x15')][_0xdf74('0x14')]);}})[_0xdf74('0x16')](function(_0x542250){logger['error'](_0xdf74('0xd'),_0x21b625,_0x542250);_0x167411(_0x542250);});});} \ No newline at end of file +var _0x69c0=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x536076,_0x4c5460){var _0x246902=function(_0x3101ca){while(--_0x3101ca){_0x536076['push'](_0x536076['shift']());}};_0x246902(++_0x4c5460);}(_0x69c0,0x191));var _0x069c=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x69c0[_0x101134];return _0xc47acc;};'use strict';var _=require(_0x069c('0x0'));var util=require(_0x069c('0x1'));var moment=require(_0x069c('0x2'));var BPromise=require(_0x069c('0x3'));var rs=require(_0x069c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x069c('0x5'))['db'];var utils=require(_0x069c('0x6'));var logger=require(_0x069c('0x7'))(_0x069c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x069c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f3a9a,_0x285446,_0x2f30c4){return new BPromise(function(_0x18cb46,_0x2f8bde){return client['request'](_0x4f3a9a,_0x2f30c4)[_0x069c('0xa')](function(_0x33ec6a){logger[_0x069c('0xb')](_0x069c('0xc'),_0x285446,_0x069c('0xd'));logger[_0x069c('0xe')](_0x069c('0xf'),_0x285446,_0x069c('0xd'),JSON[_0x069c('0x10')](_0x33ec6a));if(_0x33ec6a[_0x069c('0x11')]){if(_0x33ec6a[_0x069c('0x11')]['code']===0x1f4){logger[_0x069c('0x11')](_0x069c('0xc'),_0x285446,_0x33ec6a[_0x069c('0x11')]['message']);return _0x2f8bde(_0x33ec6a[_0x069c('0x11')][_0x069c('0x12')]);}logger[_0x069c('0x11')](_0x069c('0xc'),_0x285446,_0x33ec6a['error'][_0x069c('0x12')]);return _0x18cb46(_0x33ec6a['error'][_0x069c('0x12')]);}else{logger['info'](_0x069c('0xc'),_0x285446,'request\x20sent');_0x18cb46(_0x33ec6a[_0x069c('0x13')][_0x069c('0x12')]);}})[_0x069c('0x14')](function(_0x1d8ef7){logger[_0x069c('0x11')](_0x069c('0xc'),_0x285446,_0x1d8ef7);_0x2f8bde(_0x1d8ef7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ebabeb6..b8920a8 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(_0x1ef7ad,_0xfbe45b){var _0x1346a8=function(_0x2c186c){while(--_0x2c186c){_0x1ef7ad['push'](_0x1ef7ad['shift']());}};_0x1346a8(++_0xfbe45b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x53ba62,_0x4dd6ac){var _0x48ede5=function(_0x37ee72){while(--_0x37ee72){_0x53ba62['push'](_0x53ba62['shift']());}};_0x48ede5(++_0x4dd6ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 5721a3e..9defe83 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 _0x2cae=['exports','STRING','TEXT','sequelize'];(function(_0xb0cb92,_0x59900b){var _0x2ab98c=function(_0x12c2e3){while(--_0x12c2e3){_0xb0cb92['push'](_0xb0cb92['shift']());}};_0x2ab98c(++_0x59900b);}(_0x2cae,0x16b));var _0xe2ca=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x2cae[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xe2ca('0x2')]},'metric':{'type':Sequelize[_0xe2ca('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x720e=['exports','STRING','TEXT','sequelize'];(function(_0x8a74ea,_0x57cb19){var _0x29ae8e=function(_0x4a0b7d){while(--_0x4a0b7d){_0x8a74ea['push'](_0x8a74ea['shift']());}};_0x29ae8e(++_0x57cb19);}(_0x720e,0x1cb));var _0xe720=function(_0x458ed6,_0x504646){_0x458ed6=_0x458ed6-0x0;var _0xa5dfd9=_0x720e[_0x458ed6];return _0xa5dfd9;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'name':{'type':Sequelize[_0xe720('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xe720('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index c07a3c3..db9101d 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 _0x9957=['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','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x2d3ab3,_0x47d90b){var _0x321f9e=function(_0x50a53d){while(--_0x50a53d){_0x2d3ab3['push'](_0x2d3ab3['shift']());}};_0x321f9e(++_0x47d90b);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x1e85db,_0x432aad){var _0x11066d=function(_0x254d3c){while(--_0x254d3c){_0x1e85db['push'](_0x1e85db['shift']());}};_0x11066d(++_0x432aad);}(_0x81bd,0x7c));var _0xd81b=function(_0x305bbf,_0x5647b3){_0x305bbf=_0x305bbf-0x0;var _0x4ed772=_0x81bd[_0x305bbf];return _0x4ed772;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2c137c6..5d9849e 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 _0x85d0=['rimraf','../../config/environment','exports','define','AnalyticMetric','moment','bluebird','request-promise','path'];(function(_0x3073b1,_0x349ef5){var _0x58d884=function(_0x52c47f){while(--_0x52c47f){_0x3073b1['push'](_0x3073b1['shift']());}};_0x58d884(++_0x349ef5);}(_0x85d0,0x164));var _0x085d=function(_0x27e64a,_0x10a2cb){_0x27e64a=_0x27e64a-0x0;var _0x5c5979=_0x85d0[_0x27e64a];return _0x5c5979;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x085d('0x0'));var BPromise=require(_0x085d('0x1'));var rp=require(_0x085d('0x2'));var fs=require('fs');var path=require(_0x085d('0x3'));var rimraf=require(_0x085d('0x4'));var config=require(_0x085d('0x5'));var attributes=require('./analyticMetric.attributes');module[_0x085d('0x6')]=function(_0x5c917f,_0x364f09){return _0x5c917f[_0x085d('0x7')](_0x085d('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00b3=['bluebird','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x3de3d2,_0x383778){var _0x50c718=function(_0x3ef368){while(--_0x3ef368){_0x3de3d2['push'](_0x3de3d2['shift']());}};_0x50c718(++_0x383778);}(_0x00b3,0x157));var _0x300b=function(_0x2b1853,_0x11e731){_0x2b1853=_0x2b1853-0x0;var _0x9673f2=_0x00b3[_0x2b1853];return _0x9673f2;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var logger=require(_0x300b('0x2'))(_0x300b('0x3'));var moment=require(_0x300b('0x4'));var BPromise=require(_0x300b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x300b('0x6'));var rimraf=require(_0x300b('0x7'));var config=require('../../config/environment');var attributes=require(_0x300b('0x8'));module['exports']=function(_0x2bd6ef,_0x345454){return _0x2bd6ef[_0x300b('0x9')](_0x300b('0xa'),attributes,{'tableName':_0x300b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0e90503..c5f0d78 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 _0xcac4=['message','request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticMetric,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x4f01a1,_0x354cf1){var _0x1d0dc5=function(_0x365cf1){while(--_0x365cf1){_0x4f01a1['push'](_0x4f01a1['shift']());}};_0x1d0dc5(++_0x354cf1);}(_0xcac4,0xf6));var _0x4cac=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xcac4[_0x35a274];return _0x40d905;};'use strict';var _=require('lodash');var util=require(_0x4cac('0x0'));var moment=require(_0x4cac('0x1'));var BPromise=require(_0x4cac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4cac('0x3'));var db=require(_0x4cac('0x4'))['db'];var utils=require(_0x4cac('0x5'));var logger=require(_0x4cac('0x6'))(_0x4cac('0x7'));var config=require(_0x4cac('0x8'));var jayson=require(_0x4cac('0x9'));var client=jayson[_0x4cac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf622,_0x1f7307,_0x1d0655){return new BPromise(function(_0x5d70b2,_0x10193e){return client['request'](_0x5cf622,_0x1d0655)[_0x4cac('0xb')](function(_0x5edff4){logger[_0x4cac('0xc')](_0x4cac('0xd'),_0x1f7307,'request\x20sent');logger[_0x4cac('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1f7307,'request\x20sent',JSON[_0x4cac('0xf')](_0x5edff4));if(_0x5edff4[_0x4cac('0x10')]){if(_0x5edff4['error'][_0x4cac('0x11')]===0x1f4){logger[_0x4cac('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1f7307,_0x5edff4['error'][_0x4cac('0x12')]);return _0x10193e(_0x5edff4[_0x4cac('0x10')][_0x4cac('0x12')]);}logger[_0x4cac('0x10')](_0x4cac('0xd'),_0x1f7307,_0x5edff4['error']['message']);return _0x5d70b2(_0x5edff4[_0x4cac('0x10')][_0x4cac('0x12')]);}else{logger[_0x4cac('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x1f7307,_0x4cac('0x13'));_0x5d70b2(_0x5edff4[_0x4cac('0x14')][_0x4cac('0x12')]);}})[_0x4cac('0x15')](function(_0x5e4a57){logger[_0x4cac('0x10')](_0x4cac('0xd'),_0x1f7307,_0x5e4a57);_0x10193e(_0x5e4a57);});});} \ No newline at end of file +var _0x20d6=['request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x6df1f8,_0x303c75){var _0x11aef1=function(_0x5e3c14){while(--_0x5e3c14){_0x6df1f8['push'](_0x6df1f8['shift']());}};_0x11aef1(++_0x303c75);}(_0x20d6,0xa5));var _0x620d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20d6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var moment=require(_0x620d('0x2'));var BPromise=require('bluebird');var rs=require(_0x620d('0x3'));var fs=require('fs');var Redis=require(_0x620d('0x4'));var db=require(_0x620d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x620d('0x6'));var config=require(_0x620d('0x7'));var jayson=require(_0x620d('0x8'));var client=jayson[_0x620d('0x9')][_0x620d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cca49,_0x875caa,_0x309f86){return new BPromise(function(_0x16f17b,_0x58e1df){return client[_0x620d('0xb')](_0x1cca49,_0x309f86)['then'](function(_0x50068c){logger[_0x620d('0xc')](_0x620d('0xd'),_0x875caa,'request\x20sent');logger[_0x620d('0xe')](_0x620d('0xf'),_0x875caa,_0x620d('0x10'),JSON['stringify'](_0x50068c));if(_0x50068c[_0x620d('0x11')]){if(_0x50068c[_0x620d('0x11')][_0x620d('0x12')]===0x1f4){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x875caa,_0x50068c[_0x620d('0x11')][_0x620d('0x13')]);return _0x58e1df(_0x50068c[_0x620d('0x11')][_0x620d('0x13')]);}logger[_0x620d('0x11')](_0x620d('0xd'),_0x875caa,_0x50068c['error'][_0x620d('0x13')]);return _0x16f17b(_0x50068c['error'][_0x620d('0x13')]);}else{logger[_0x620d('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x875caa,_0x620d('0x10'));_0x16f17b(_0x50068c[_0x620d('0x14')][_0x620d('0x13')]);}})[_0x620d('0x15')](function(_0x1d8700){logger[_0x620d('0x11')](_0x620d('0xd'),_0x875caa,_0x1d8700);_0x58e1df(_0x1d8700);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index a60b0ba..169846d 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 _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x277c,0x153));var _0xc277=function(_0x4157de,_0x415cc8){_0x4157de=_0x4157de-0x0;var _0x450fca=_0x277c[_0x4157de];return _0x450fca;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['post']('/',auth[_0xc277('0x9')](),controller[_0xc277('0xc')]);router[_0xc277('0xd')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['delete']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);module[_0xc277('0x11')]=router; \ No newline at end of file +var _0xbd18=['post','put','update','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x4a7be4,_0x3ddcbb){var _0x33c2a3=function(_0x3bb89e){while(--_0x3bb89e){_0x4a7be4['push'](_0x4a7be4['shift']());}};_0x33c2a3(++_0x3ddcbb);}(_0xbd18,0x195));var _0x8bd1=function(_0x380584,_0x14be76){_0x380584=_0x380584-0x0;var _0x3a36b5=_0xbd18[_0x380584];return _0x3a36b5;};'use strict';var multer=require(_0x8bd1('0x0'));var util=require(_0x8bd1('0x1'));var path=require(_0x8bd1('0x2'));var timeout=require('connect-timeout');var express=require(_0x8bd1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8bd1('0x4'));var config=require(_0x8bd1('0x5'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x8bd1('0x6')](),controller[_0x8bd1('0x7')]);router[_0x8bd1('0x8')](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xa')]);router[_0x8bd1('0xb')]('/',auth[_0x8bd1('0x6')](),controller['create']);router[_0x8bd1('0xc')](_0x8bd1('0x9'),auth[_0x8bd1('0x6')](),controller[_0x8bd1('0xd')]);router['delete'](_0x8bd1('0x9'),auth['isAuthenticated'](),controller[_0x8bd1('0xe')]);module[_0x8bd1('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 56faf68..1524e6a 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 _0xa480=['exports'];(function(_0x5144e1,_0x110b6f){var _0x1054ea=function(_0x2fbfa8){while(--_0x2fbfa8){_0x5144e1['push'](_0x5144e1['shift']());}};_0x1054ea(++_0x110b6f);}(_0xa480,0xb3));var _0x0a48=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xa480[_0xd7b0a4];return _0x184e9e;};'use strict';var Sequelize=require('sequelize');module[_0x0a48('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xdf38=['TEXT'];(function(_0x3e14a5,_0x3386dd){var _0x15d478=function(_0x4f0cf7){while(--_0x4f0cf7){_0x3e14a5['push'](_0x3e14a5['shift']());}};_0x15d478(++_0x3386dd);}(_0xdf38,0xa2));var _0x8df3=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xdf38[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x8df3('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b868aa6..068e228 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 _0x6214=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','destroy','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','include','findAll','then','catch','show','params','includeAll','options','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x54cc68,_0x1c438c){var _0x5d47f7=function(_0x3a826a){while(--_0x3a826a){_0x54cc68['push'](_0x54cc68['shift']());}};_0x5d47f7(++_0x1c438c);}(_0x6214,0x7d));var _0x4621=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x6214[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4621('0x0'));var rp=require(_0x4621('0x1'));var moment=require(_0x4621('0x2'));var BPromise=require(_0x4621('0x3'));var Mustache=require('mustache');var util=require(_0x4621('0x4'));var path=require(_0x4621('0x5'));var sox=require(_0x4621('0x6'));var csv=require(_0x4621('0x7'));var ejs=require(_0x4621('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4621('0x9'));var squel=require(_0x4621('0xa'));var crypto=require('crypto');var jsforce=require(_0x4621('0xb'));var deskjs=require(_0x4621('0xc'));var toCsv=require(_0x4621('0x7'));var querystring=require(_0x4621('0xd'));var Papa=require(_0x4621('0xe'));var Redis=require(_0x4621('0xf'));var authService=require(_0x4621('0x10'));var qs=require(_0x4621('0x11'));var as=require(_0x4621('0x12'));var hardwareService=require(_0x4621('0x13'));var logger=require(_0x4621('0x14'))(_0x4621('0x15'));var utils=require('../../config/utils');var config=require(_0x4621('0x16'));var licenseUtil=require(_0x4621('0x17'));var db=require(_0x4621('0x18'))['db'];function respondWithStatusCode(_0x1199aa,_0x22d5fb){_0x22d5fb=_0x22d5fb||0xcc;return function(_0x704d06){if(_0x704d06){return _0x1199aa[_0x4621('0x19')](_0x22d5fb);}return _0x1199aa[_0x4621('0x1a')](_0x22d5fb)['end']();};}function respondWithResult(_0x1ae78b,_0x365889){_0x365889=_0x365889||0xc8;return function(_0x54be9a){if(_0x54be9a){return _0x1ae78b['status'](_0x365889)['json'](_0x54be9a);}};}function respondWithFilteredResult(_0x50a5bf,_0x2fa2a7){return function(_0x2de5bf){if(_0x2de5bf){var _0x40298b=typeof _0x2fa2a7[_0x4621('0x1b')]===_0x4621('0x1c')&&typeof _0x2fa2a7[_0x4621('0x1d')]===_0x4621('0x1c');var _0x3eb0b2=_0x2de5bf[_0x4621('0x1e')];var _0x3354ad=_0x40298b?0x0:_0x2fa2a7['offset'];var _0x46c5e3=_0x40298b?_0x2de5bf[_0x4621('0x1e')]:_0x2fa2a7[_0x4621('0x1b')]+_0x2fa2a7[_0x4621('0x1d')];var _0xa728f1;if(_0x46c5e3>=_0x3eb0b2){_0x46c5e3=_0x3eb0b2;_0xa728f1=0xc8;}else{_0xa728f1=0xce;}_0x50a5bf[_0x4621('0x1a')](_0xa728f1);return _0x50a5bf[_0x4621('0x1f')]('Content-Range',_0x3354ad+'-'+_0x46c5e3+'/'+_0x3eb0b2)['json'](_0x2de5bf);}return null;};}function patchUpdates(_0x185f99){return function(_0x5ed1a2){try{jsonpatch[_0x4621('0x20')](_0x5ed1a2,_0x185f99,!![]);}catch(_0x4f74db){return BPromise[_0x4621('0x21')](_0x4f74db);}return _0x5ed1a2[_0x4621('0x22')]();};}function saveUpdates(_0x15054d,_0x5cd462){return function(_0x5712aa){if(_0x5712aa){return _0x5712aa['update'](_0x15054d)['then'](function(_0x2672b8){return _0x2672b8;});}return null;};}function removeEntity(_0x55b788,_0x1300ee){return function(_0x3d5df4){if(_0x3d5df4){return _0x3d5df4[_0x4621('0x23')]()['then'](function(){_0x55b788[_0x4621('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a34b,_0x562cd8){return function(_0x5ae8ba){if(!_0x5ae8ba){_0x38a34b[_0x4621('0x19')](0x194);}return _0x5ae8ba;};}function handleError(_0x3b5262,_0xef1dbe){_0xef1dbe=_0xef1dbe||0x1f4;return function(_0x28632d){logger[_0x4621('0x24')](_0x28632d[_0x4621('0x25')]);if(_0x28632d[_0x4621('0x26')]){delete _0x28632d[_0x4621('0x26')];}_0x3b5262[_0x4621('0x1a')](_0xef1dbe)[_0x4621('0x27')](_0x28632d);};}exports['index']=function(_0x42fafc,_0x5c7ab6){var _0x297a5b={},_0x3a8b18={},_0x34808e={'count':0x0,'rows':[]};var _0xd0277=_['map'](db[_0x4621('0x28')][_0x4621('0x29')],function(_0x3d4e46){return{'name':_0x3d4e46[_0x4621('0x2a')],'type':_0x3d4e46[_0x4621('0x2b')]['key']};});_0x3a8b18[_0x4621('0x2c')]=_[_0x4621('0x2d')](_0xd0277,_0x4621('0x26'));_0x3a8b18[_0x4621('0x2e')]=_[_0x4621('0x2f')](_0x42fafc[_0x4621('0x2e')]);_0x3a8b18['filters']=_[_0x4621('0x30')](_0x3a8b18[_0x4621('0x2c')],_0x3a8b18[_0x4621('0x2e')]);_0x297a5b[_0x4621('0x31')]=_[_0x4621('0x30')](_0x3a8b18[_0x4621('0x2c')],qs[_0x4621('0x32')](_0x42fafc[_0x4621('0x2e')][_0x4621('0x32')]));_0x297a5b['attributes']=_0x297a5b['attributes'][_0x4621('0x33')]?_0x297a5b[_0x4621('0x31')]:_0x3a8b18['model'];if(!_0x42fafc[_0x4621('0x2e')]['hasOwnProperty'](_0x4621('0x34'))){_0x297a5b[_0x4621('0x1d')]=qs['limit'](_0x42fafc[_0x4621('0x2e')][_0x4621('0x1d')]);_0x297a5b['offset']=qs['offset'](_0x42fafc['query'][_0x4621('0x1b')]);}_0x297a5b[_0x4621('0x35')]=qs[_0x4621('0x36')](_0x42fafc[_0x4621('0x2e')][_0x4621('0x36')]);_0x297a5b[_0x4621('0x37')]=qs[_0x4621('0x38')](_['pick'](_0x42fafc['query'],_0x3a8b18['filters']),_0xd0277);if(_0x42fafc[_0x4621('0x2e')]['filter']){_0x297a5b[_0x4621('0x37')]=_[_0x4621('0x39')](_0x297a5b[_0x4621('0x37')],{'$or':_[_0x4621('0x2d')](_0xd0277,function(_0x55c052){if(_0x55c052[_0x4621('0x2b')]!=='VIRTUAL'){var _0x221fd3={};_0x221fd3[_0x55c052['name']]={'$like':'%'+_0x42fafc[_0x4621('0x2e')]['filter']+'%'};return _0x221fd3;}})});}_0x297a5b=_[_0x4621('0x39')]({},_0x297a5b,_0x42fafc['options']);var _0x21e1ff={'where':_0x297a5b[_0x4621('0x37')]};return db[_0x4621('0x28')]['count'](_0x21e1ff)['then'](function(_0x29fead){_0x34808e[_0x4621('0x1e')]=_0x29fead;if(_0x42fafc[_0x4621('0x2e')]['includeAll']){_0x297a5b[_0x4621('0x3a')]=[{'all':!![]}];}return db[_0x4621('0x28')][_0x4621('0x3b')](_0x297a5b);})[_0x4621('0x3c')](function(_0x18a969){_0x34808e['rows']=_0x18a969;return _0x34808e;})['then'](respondWithFilteredResult(_0x5c7ab6,_0x297a5b))[_0x4621('0x3d')](handleError(_0x5c7ab6,null));};exports[_0x4621('0x3e')]=function(_0x430055,_0xf7e2c5){var _0x3cf976={'raw':!![],'where':{'id':_0x430055[_0x4621('0x3f')]['id']}},_0x566cb7={};_0x566cb7['model']=_['keys'](db[_0x4621('0x28')][_0x4621('0x29')]);_0x566cb7['query']=_[_0x4621('0x2f')](_0x430055[_0x4621('0x2e')]);_0x566cb7[_0x4621('0x38')]=_['intersection'](_0x566cb7['model'],_0x566cb7[_0x4621('0x2e')]);_0x3cf976[_0x4621('0x31')]=_[_0x4621('0x30')](_0x566cb7[_0x4621('0x2c')],qs[_0x4621('0x32')](_0x430055[_0x4621('0x2e')]['fields']));_0x3cf976['attributes']=_0x3cf976[_0x4621('0x31')][_0x4621('0x33')]?_0x3cf976[_0x4621('0x31')]:_0x566cb7[_0x4621('0x2c')];if(_0x430055[_0x4621('0x2e')][_0x4621('0x40')]){_0x3cf976['include']=[{'all':!![]}];}_0x3cf976=_['merge']({},_0x3cf976,_0x430055[_0x4621('0x41')]);return db[_0x4621('0x28')][_0x4621('0x42')](_0x3cf976)[_0x4621('0x3c')](handleEntityNotFound(_0xf7e2c5,null))[_0x4621('0x3c')](respondWithResult(_0xf7e2c5,null))[_0x4621('0x3d')](handleError(_0xf7e2c5,null));};exports['create']=function(_0x41140d,_0x2c6d09){return db[_0x4621('0x28')][_0x4621('0x43')](_0x41140d[_0x4621('0x44')],{})[_0x4621('0x3c')](respondWithResult(_0x2c6d09,0xc9))['catch'](handleError(_0x2c6d09,null));};exports['update']=function(_0x3e1cde,_0x4e6910){if(_0x3e1cde['body']['id']){delete _0x3e1cde['body']['id'];}return db[_0x4621('0x28')][_0x4621('0x42')]({'where':{'id':_0x3e1cde[_0x4621('0x3f')]['id']}})[_0x4621('0x3c')](handleEntityNotFound(_0x4e6910,null))[_0x4621('0x3c')](saveUpdates(_0x3e1cde[_0x4621('0x44')],null))[_0x4621('0x3c')](respondWithResult(_0x4e6910,null))[_0x4621('0x3d')](handleError(_0x4e6910,null));};exports[_0x4621('0x23')]=function(_0x16bbfa,_0x26101b){return db[_0x4621('0x28')][_0x4621('0x42')]({'where':{'id':_0x16bbfa[_0x4621('0x3f')]['id']}})[_0x4621('0x3c')](handleEntityNotFound(_0x26101b,null))[_0x4621('0x3c')](removeEntity(_0x26101b,null))['catch'](handleError(_0x26101b,null));}; \ No newline at end of file +var _0xf24f=['map','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','AnalyticTreeReport','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','stack','send','index'];(function(_0x56f058,_0x21d4db){var _0x3f29bb=function(_0x2c992d){while(--_0x2c992d){_0x56f058['push'](_0x56f058['shift']());}};_0x3f29bb(++_0x21d4db);}(_0xf24f,0xba));var _0xff24=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xf24f[_0x2576d7];return _0x16a08c;};'use strict';var emlformat=require(_0xff24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff24('0x1'));var jsonpatch=require(_0xff24('0x2'));var rp=require(_0xff24('0x3'));var moment=require(_0xff24('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff24('0x5'));var util=require(_0xff24('0x6'));var path=require(_0xff24('0x7'));var sox=require('sox');var csv=require(_0xff24('0x8'));var ejs=require(_0xff24('0x9'));var fs=require('fs');var fs_extra=require(_0xff24('0xa'));var _=require(_0xff24('0xb'));var squel=require(_0xff24('0xc'));var crypto=require(_0xff24('0xd'));var jsforce=require(_0xff24('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff24('0xf'));var Papa=require(_0xff24('0x10'));var Redis=require(_0xff24('0x11'));var authService=require(_0xff24('0x12'));var qs=require(_0xff24('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff24('0x14'));var logger=require('../../config/logger')(_0xff24('0x15'));var utils=require(_0xff24('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xff24('0x17'))['db'];function respondWithStatusCode(_0x57591e,_0x401ce1){_0x401ce1=_0x401ce1||0xcc;return function(_0x269712){if(_0x269712){return _0x57591e[_0xff24('0x18')](_0x401ce1);}return _0x57591e[_0xff24('0x19')](_0x401ce1)[_0xff24('0x1a')]();};}function respondWithResult(_0x436d61,_0x490f00){_0x490f00=_0x490f00||0xc8;return function(_0x10b70f){if(_0x10b70f){return _0x436d61[_0xff24('0x19')](_0x490f00)['json'](_0x10b70f);}};}function respondWithFilteredResult(_0x313f8c,_0x2e9e5d){return function(_0x38106d){if(_0x38106d){var _0x4a0b6b=typeof _0x2e9e5d[_0xff24('0x1b')]===_0xff24('0x1c')&&typeof _0x2e9e5d['limit']===_0xff24('0x1c');var _0x32076b=_0x38106d['count'];var _0x24878f=_0x4a0b6b?0x0:_0x2e9e5d[_0xff24('0x1b')];var _0x3a891a=_0x4a0b6b?_0x38106d[_0xff24('0x1d')]:_0x2e9e5d[_0xff24('0x1b')]+_0x2e9e5d[_0xff24('0x1e')];var _0x52cd3e;if(_0x3a891a>=_0x32076b){_0x3a891a=_0x32076b;_0x52cd3e=0xc8;}else{_0x52cd3e=0xce;}_0x313f8c[_0xff24('0x19')](_0x52cd3e);return _0x313f8c[_0xff24('0x1f')]('Content-Range',_0x24878f+'-'+_0x3a891a+'/'+_0x32076b)[_0xff24('0x20')](_0x38106d);}return null;};}function patchUpdates(_0x41088c){return function(_0x5305f4){try{jsonpatch[_0xff24('0x21')](_0x5305f4,_0x41088c,!![]);}catch(_0x117d22){return BPromise[_0xff24('0x22')](_0x117d22);}return _0x5305f4[_0xff24('0x23')]();};}function saveUpdates(_0x3060cd,_0x472d6d){return function(_0x37d417){if(_0x37d417){return _0x37d417[_0xff24('0x24')](_0x3060cd)[_0xff24('0x25')](function(_0x10fc55){return _0x10fc55;});}return null;};}function removeEntity(_0x1076d6,_0x5b0ec4){return function(_0x30fa72){if(_0x30fa72){return _0x30fa72[_0xff24('0x26')]()[_0xff24('0x25')](function(){_0x1076d6[_0xff24('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f590,_0x2acd35){return function(_0x13687d){if(!_0x13687d){_0x38f590[_0xff24('0x18')](0x194);}return _0x13687d;};}function handleError(_0x5544aa,_0x1b7850){_0x1b7850=_0x1b7850||0x1f4;return function(_0x5c19ea){logger['error'](_0x5c19ea[_0xff24('0x27')]);if(_0x5c19ea['name']){delete _0x5c19ea['name'];}_0x5544aa['status'](_0x1b7850)[_0xff24('0x28')](_0x5c19ea);};}exports[_0xff24('0x29')]=function(_0x3e6cfd,_0x334e16){var _0xa43067={},_0x221337={},_0xe8da4d={'count':0x0,'rows':[]};var _0x44e5f0=_[_0xff24('0x2a')](db['AnalyticTreeReport']['rawAttributes'],function(_0x3f10b1){return{'name':_0x3f10b1[_0xff24('0x2b')],'type':_0x3f10b1[_0xff24('0x2c')][_0xff24('0x2d')]};});_0x221337['model']=_[_0xff24('0x2a')](_0x44e5f0,'name');_0x221337['query']=_[_0xff24('0x2e')](_0x3e6cfd[_0xff24('0x2f')]);_0x221337[_0xff24('0x30')]=_[_0xff24('0x31')](_0x221337[_0xff24('0x32')],_0x221337[_0xff24('0x2f')]);_0xa43067['attributes']=_[_0xff24('0x31')](_0x221337[_0xff24('0x32')],qs[_0xff24('0x33')](_0x3e6cfd[_0xff24('0x2f')]['fields']));_0xa43067[_0xff24('0x34')]=_0xa43067['attributes'][_0xff24('0x35')]?_0xa43067[_0xff24('0x34')]:_0x221337['model'];if(!_0x3e6cfd['query'][_0xff24('0x36')](_0xff24('0x37'))){_0xa43067['limit']=qs[_0xff24('0x1e')](_0x3e6cfd[_0xff24('0x2f')][_0xff24('0x1e')]);_0xa43067[_0xff24('0x1b')]=qs[_0xff24('0x1b')](_0x3e6cfd[_0xff24('0x2f')][_0xff24('0x1b')]);}_0xa43067[_0xff24('0x38')]=qs[_0xff24('0x39')](_0x3e6cfd['query']['sort']);_0xa43067[_0xff24('0x3a')]=qs['filters'](_[_0xff24('0x3b')](_0x3e6cfd[_0xff24('0x2f')],_0x221337[_0xff24('0x30')]),_0x44e5f0);if(_0x3e6cfd[_0xff24('0x2f')][_0xff24('0x3c')]){_0xa43067['where']=_[_0xff24('0x3d')](_0xa43067[_0xff24('0x3a')],{'$or':_[_0xff24('0x2a')](_0x44e5f0,function(_0x2ad086){if(_0x2ad086[_0xff24('0x2c')]!==_0xff24('0x3e')){var _0x1231b7={};_0x1231b7[_0x2ad086[_0xff24('0x3f')]]={'$like':'%'+_0x3e6cfd[_0xff24('0x2f')][_0xff24('0x3c')]+'%'};return _0x1231b7;}})});}_0xa43067=_['merge']({},_0xa43067,_0x3e6cfd['options']);var _0x3f969c={'where':_0xa43067[_0xff24('0x3a')]};return db[_0xff24('0x40')]['count'](_0x3f969c)['then'](function(_0x1673b1){_0xe8da4d['count']=_0x1673b1;if(_0x3e6cfd['query'][_0xff24('0x41')]){_0xa43067[_0xff24('0x42')]=[{'all':!![]}];}return db[_0xff24('0x40')][_0xff24('0x43')](_0xa43067);})[_0xff24('0x25')](function(_0x1f1601){_0xe8da4d[_0xff24('0x44')]=_0x1f1601;return _0xe8da4d;})['then'](respondWithFilteredResult(_0x334e16,_0xa43067))[_0xff24('0x45')](handleError(_0x334e16,null));};exports[_0xff24('0x46')]=function(_0x22173c,_0x2f6940){var _0x2c8a0d={'raw':!![],'where':{'id':_0x22173c['params']['id']}},_0x40c0e3={};_0x40c0e3['model']=_['keys'](db[_0xff24('0x40')]['rawAttributes']);_0x40c0e3[_0xff24('0x2f')]=_[_0xff24('0x2e')](_0x22173c[_0xff24('0x2f')]);_0x40c0e3['filters']=_['intersection'](_0x40c0e3[_0xff24('0x32')],_0x40c0e3['query']);_0x2c8a0d[_0xff24('0x34')]=_['intersection'](_0x40c0e3[_0xff24('0x32')],qs[_0xff24('0x33')](_0x22173c[_0xff24('0x2f')]['fields']));_0x2c8a0d[_0xff24('0x34')]=_0x2c8a0d['attributes'][_0xff24('0x35')]?_0x2c8a0d[_0xff24('0x34')]:_0x40c0e3[_0xff24('0x32')];if(_0x22173c[_0xff24('0x2f')][_0xff24('0x41')]){_0x2c8a0d['include']=[{'all':!![]}];}_0x2c8a0d=_[_0xff24('0x3d')]({},_0x2c8a0d,_0x22173c[_0xff24('0x47')]);return db[_0xff24('0x40')][_0xff24('0x48')](_0x2c8a0d)[_0xff24('0x25')](handleEntityNotFound(_0x2f6940,null))['then'](respondWithResult(_0x2f6940,null))[_0xff24('0x45')](handleError(_0x2f6940,null));};exports['create']=function(_0x2dc879,_0x2d93fc){return db[_0xff24('0x40')][_0xff24('0x49')](_0x2dc879[_0xff24('0x4a')],{})[_0xff24('0x25')](respondWithResult(_0x2d93fc,0xc9))['catch'](handleError(_0x2d93fc,null));};exports[_0xff24('0x24')]=function(_0x1a905,_0x51cc45){if(_0x1a905['body']['id']){delete _0x1a905[_0xff24('0x4a')]['id'];}return db[_0xff24('0x40')]['find']({'where':{'id':_0x1a905[_0xff24('0x4b')]['id']}})[_0xff24('0x25')](handleEntityNotFound(_0x51cc45,null))[_0xff24('0x25')](saveUpdates(_0x1a905[_0xff24('0x4a')],null))[_0xff24('0x25')](respondWithResult(_0x51cc45,null))['catch'](handleError(_0x51cc45,null));};exports[_0xff24('0x26')]=function(_0x466d6b,_0x3f685f){return db[_0xff24('0x40')]['find']({'where':{'id':_0x466d6b['params']['id']}})['then'](handleEntityNotFound(_0x3f685f,null))[_0xff24('0x25')](removeEntity(_0x3f685f,null))[_0xff24('0x45')](handleError(_0x3f685f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 10a2196..2e34c61 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 _0xc985=['analytics_report_trees','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xc985,0x109));var _0x5c98=function(_0x10c86d,_0x1de4a5){_0x10c86d=_0x10c86d-0x0;var _0x45346f=_0xc985[_0x10c86d];return _0x45346f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c98('0x0'))(_0x5c98('0x1'));var moment=require(_0x5c98('0x2'));var BPromise=require('bluebird');var rp=require(_0x5c98('0x3'));var fs=require('fs');var path=require(_0x5c98('0x4'));var rimraf=require(_0x5c98('0x5'));var config=require(_0x5c98('0x6'));var attributes=require(_0x5c98('0x7'));module[_0x5c98('0x8')]=function(_0x44ea87,_0x265437){return _0x44ea87[_0x5c98('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x5c98('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ba4=['api','moment','path','../../config/environment','./analyticTreeReport.attributes','exports','define','util','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ba4,0x6a));var _0x46ba=function(_0x159eda,_0x5f00bb){_0x159eda=_0x159eda-0x0;var _0x3912b6=_0x6ba4[_0x159eda];return _0x3912b6;};'use strict';var _=require('lodash');var util=require(_0x46ba('0x0'));var logger=require(_0x46ba('0x1'))(_0x46ba('0x2'));var moment=require(_0x46ba('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46ba('0x4'));var rimraf=require('rimraf');var config=require(_0x46ba('0x5'));var attributes=require(_0x46ba('0x6'));module[_0x46ba('0x7')]=function(_0xe24d83,_0x4f3b79){return _0xe24d83[_0x46ba('0x8')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 93626d8..725e8b7 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x571fab,_0x165374){var _0x404599=function(_0x3435ba){while(--_0x3435ba){_0x571fab['push'](_0x571fab['shift']());}};_0x404599(++_0x165374);}(_0x5f2f,0x73));var _0xf5f2=function(_0x9c0cff,_0x3d9771){_0x9c0cff=_0x9c0cff-0x0;var _0x36133a=_0x5f2f[_0x9c0cff];return _0x36133a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _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(_0x27198f,_0x34c67a){var _0x3c3994=function(_0xd4f41e){while(--_0xd4f41e){_0x27198f['push'](_0x27198f['shift']());}};_0x3c3994(++_0x34c67a);}(_0xdb28,0x106));var _0x8db2=function(_0x124f98,_0x1aef8f){_0x124f98=_0x124f98-0x0;var _0x1bf14c=_0xdb28[_0x124f98];return _0x1bf14c;};'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 diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 42136c6..1d51746 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 _0x96da=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','put','/:id','delete','exports'];(function(_0x251454,_0x545486){var _0xdf73f4=function(_0xa21ecb){while(--_0xa21ecb){_0x251454['push'](_0x251454['shift']());}};_0xdf73f4(++_0x545486);}(_0x96da,0x156));var _0xa96d=function(_0x20cdd2,_0x24da9b){_0x20cdd2=_0x20cdd2-0x0;var _0x8bd09e=_0x96da[_0x20cdd2];return _0x8bd09e;};'use strict';var multer=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var path=require(_0xa96d('0x2'));var timeout=require(_0xa96d('0x3'));var express=require('express');var router=express[_0xa96d('0x4')]();var fs_extra=require(_0xa96d('0x5'));var auth=require(_0xa96d('0x6'));var interaction=require(_0xa96d('0x7'));var config=require(_0xa96d('0x8'));var controller=require(_0xa96d('0x9'));router[_0xa96d('0xa')]('/',auth[_0xa96d('0xb')](),controller[_0xa96d('0xc')]);router[_0xa96d('0xa')]('/:id',auth[_0xa96d('0xb')](),controller['show']);router[_0xa96d('0xd')]('/',auth[_0xa96d('0xb')](),controller[_0xa96d('0xe')]);router[_0xa96d('0xf')](_0xa96d('0x10'),auth[_0xa96d('0xb')](),controller['update']);router[_0xa96d('0x11')](_0xa96d('0x10'),auth[_0xa96d('0xb')](),controller['destroy']);module[_0xa96d('0x12')]=router; \ No newline at end of file +var _0x07a2=['post','put','/:id','update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x07a2,0x106));var _0x207a=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x07a2[_0x3c59fc];return _0x2b78d4;};'use strict';var multer=require(_0x207a('0x0'));var util=require('util');var path=require(_0x207a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x207a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x207a('0x3'));var interaction=require(_0x207a('0x4'));var config=require(_0x207a('0x5'));var controller=require('./analyticTreeReport.controller');router[_0x207a('0x6')]('/',auth[_0x207a('0x7')](),controller[_0x207a('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x207a('0x9')]);router[_0x207a('0xa')]('/',auth[_0x207a('0x7')](),controller['create']);router[_0x207a('0xb')](_0x207a('0xc'),auth['isAuthenticated'](),controller[_0x207a('0xd')]);router[_0x207a('0xe')](_0x207a('0xc'),auth[_0x207a('0x7')](),controller[_0x207a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a9ba6a5..598d761 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 _0x21d1=['STRING','sequelize','exports'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x21d1,0x1c9));var _0x121d=function(_0x3c0144,_0x50173d){_0x3c0144=_0x3c0144-0x0;var _0x5259eb=_0x21d1[_0x3c0144];return _0x5259eb;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'name':{'type':Sequelize[_0x121d('0x2')]},'basename':{'type':Sequelize[_0x121d('0x2')]},'type':{'type':Sequelize[_0x121d('0x2')]}}; \ No newline at end of file +var _0xaa19=['STRING','sequelize','exports'];(function(_0x2300c7,_0x255f74){var _0x23f720=function(_0x3fea57){while(--_0x3fea57){_0x2300c7['push'](_0x2300c7['shift']());}};_0x23f720(++_0x255f74);}(_0xaa19,0x79));var _0x9aa1=function(_0x360332,_0x1c4a9f){_0x360332=_0x360332-0x0;var _0x57a36f=_0xaa19[_0x360332];return _0x57a36f;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'name':{'type':Sequelize[_0x9aa1('0x2')]},'basename':{'type':Sequelize[_0x9aa1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9d72302..9d63166 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 _0x6142=['length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Attachment','findAll','rows','catch','show','params','fields','find','get','createdAt','updatedAt','body','omit','create','update','file','originalname','filename','mimetype','download','findOne','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes'];(function(_0x1f00f7,_0x469d49){var _0x24d9f3=function(_0x4795ed){while(--_0x4795ed){_0x1f00f7['push'](_0x1f00f7['shift']());}};_0x24d9f3(++_0x469d49);}(_0x6142,0x7a));var _0x2614=function(_0x50f80e,_0xd60660){_0x50f80e=_0x50f80e-0x0;var _0x57c27c=_0x6142[_0x50f80e];return _0x57c27c;};'use strict';var emlformat=require(_0x2614('0x0'));var rimraf=require(_0x2614('0x1'));var zipdir=require(_0x2614('0x2'));var jsonpatch=require(_0x2614('0x3'));var rp=require(_0x2614('0x4'));var moment=require(_0x2614('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2614('0x6'));var util=require(_0x2614('0x7'));var path=require(_0x2614('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2614('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2614('0xa'));var crypto=require(_0x2614('0xb'));var jsforce=require(_0x2614('0xc'));var deskjs=require(_0x2614('0xd'));var toCsv=require(_0x2614('0xe'));var querystring=require(_0x2614('0xf'));var Papa=require(_0x2614('0x10'));var Redis=require(_0x2614('0x11'));var authService=require(_0x2614('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2614('0x13'));var hardwareService=require(_0x2614('0x14'));var logger=require(_0x2614('0x15'))(_0x2614('0x16'));var utils=require(_0x2614('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2614('0x18'))['db'];function respondWithStatusCode(_0x162e02,_0x4144e6){_0x4144e6=_0x4144e6||0xcc;return function(_0x4a36cd){if(_0x4a36cd){return _0x162e02[_0x2614('0x19')](_0x4144e6);}return _0x162e02['status'](_0x4144e6)['end']();};}function respondWithResult(_0x3e7f48,_0x8d10e5){_0x8d10e5=_0x8d10e5||0xc8;return function(_0x4d5503){if(_0x4d5503){return _0x3e7f48['status'](_0x8d10e5)[_0x2614('0x1a')](_0x4d5503);}};}function respondWithFilteredResult(_0x5c93a0,_0x516da7){return function(_0x1c6f01){if(_0x1c6f01){var _0x230e43=typeof _0x516da7[_0x2614('0x1b')]===_0x2614('0x1c')&&typeof _0x516da7['limit']===_0x2614('0x1c');var _0x1cbc67=_0x1c6f01['count'];var _0x5b6f5d=_0x230e43?0x0:_0x516da7['offset'];var _0x4acdcb=_0x230e43?_0x1c6f01[_0x2614('0x1d')]:_0x516da7['offset']+_0x516da7[_0x2614('0x1e')];var _0x179aa5;if(_0x4acdcb>=_0x1cbc67){_0x4acdcb=_0x1cbc67;_0x179aa5=0xc8;}else{_0x179aa5=0xce;}_0x5c93a0[_0x2614('0x1f')](_0x179aa5);return _0x5c93a0[_0x2614('0x20')](_0x2614('0x21'),_0x5b6f5d+'-'+_0x4acdcb+'/'+_0x1cbc67)[_0x2614('0x1a')](_0x1c6f01);}return null;};}function patchUpdates(_0x36c09d){return function(_0x209b9a){try{jsonpatch[_0x2614('0x22')](_0x209b9a,_0x36c09d,!![]);}catch(_0x388b78){return BPromise[_0x2614('0x23')](_0x388b78);}return _0x209b9a[_0x2614('0x24')]();};}function saveUpdates(_0x167bfc,_0x31a04c){return function(_0x11050a){if(_0x11050a){return _0x11050a['update'](_0x167bfc)[_0x2614('0x25')](function(_0x4dedee){return _0x4dedee;});}return null;};}function removeEntity(_0x28ffde,_0x408bb5){return function(_0x3266c4){if(_0x3266c4){return _0x3266c4[_0x2614('0x26')]()[_0x2614('0x25')](function(){_0x28ffde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x137b4b,_0x251168){return function(_0x358ad3){if(!_0x358ad3){_0x137b4b[_0x2614('0x19')](0x194);}return _0x358ad3;};}function handleError(_0x178365,_0x264f9e){_0x264f9e=_0x264f9e||0x1f4;return function(_0x3cc378){logger['error'](_0x3cc378['stack']);if(_0x3cc378[_0x2614('0x27')]){delete _0x3cc378[_0x2614('0x27')];}_0x178365[_0x2614('0x1f')](_0x264f9e)[_0x2614('0x28')](_0x3cc378);};}exports['index']=function(_0x2974e1,_0x1dff24){var _0x429df4={},_0x23bd2c={},_0x418106={'count':0x0,'rows':[]};var _0x35570b=_[_0x2614('0x29')](db['Attachment'][_0x2614('0x2a')],function(_0x1919a7){return{'name':_0x1919a7[_0x2614('0x2b')],'type':_0x1919a7[_0x2614('0x2c')][_0x2614('0x2d')]};});_0x23bd2c['model']=_['map'](_0x35570b,_0x2614('0x27'));_0x23bd2c['query']=_[_0x2614('0x2e')](_0x2974e1['query']);_0x23bd2c[_0x2614('0x2f')]=_[_0x2614('0x30')](_0x23bd2c[_0x2614('0x31')],_0x23bd2c[_0x2614('0x32')]);_0x429df4[_0x2614('0x33')]=_[_0x2614('0x30')](_0x23bd2c[_0x2614('0x31')],qs['fields'](_0x2974e1[_0x2614('0x32')]['fields']));_0x429df4[_0x2614('0x33')]=_0x429df4[_0x2614('0x33')][_0x2614('0x34')]?_0x429df4[_0x2614('0x33')]:_0x23bd2c[_0x2614('0x31')];if(!_0x2974e1['query'][_0x2614('0x35')](_0x2614('0x36'))){_0x429df4[_0x2614('0x1e')]=qs['limit'](_0x2974e1[_0x2614('0x32')]['limit']);_0x429df4['offset']=qs[_0x2614('0x1b')](_0x2974e1[_0x2614('0x32')]['offset']);}_0x429df4['order']=qs[_0x2614('0x37')](_0x2974e1['query']['sort']);_0x429df4[_0x2614('0x38')]=qs[_0x2614('0x2f')](_['pick'](_0x2974e1[_0x2614('0x32')],_0x23bd2c[_0x2614('0x2f')]),_0x35570b);if(_0x2974e1['query'][_0x2614('0x39')]){_0x429df4[_0x2614('0x38')]=_[_0x2614('0x3a')](_0x429df4[_0x2614('0x38')],{'$or':_[_0x2614('0x29')](_0x35570b,function(_0x32d055){if(_0x32d055[_0x2614('0x2c')]!==_0x2614('0x3b')){var _0x246bc0={};_0x246bc0[_0x32d055['name']]={'$like':'%'+_0x2974e1[_0x2614('0x32')][_0x2614('0x39')]+'%'};return _0x246bc0;}})});}_0x429df4=_[_0x2614('0x3a')]({},_0x429df4,_0x2974e1[_0x2614('0x3c')]);var _0x4dd426={'where':_0x429df4[_0x2614('0x38')]};return db['Attachment']['count'](_0x4dd426)[_0x2614('0x25')](function(_0x2c1179){_0x418106[_0x2614('0x1d')]=_0x2c1179;if(_0x2974e1['query'][_0x2614('0x3d')]){_0x429df4[_0x2614('0x3e')]=[{'all':!![]}];}return db[_0x2614('0x3f')][_0x2614('0x40')](_0x429df4);})[_0x2614('0x25')](function(_0xb447d){_0x418106[_0x2614('0x41')]=_0xb447d;return _0x418106;})[_0x2614('0x25')](respondWithFilteredResult(_0x1dff24,_0x429df4))[_0x2614('0x42')](handleError(_0x1dff24,null));};exports[_0x2614('0x43')]=function(_0x52cb73,_0x382d9e){var _0x5abfdd={'raw':!![],'where':{'id':_0x52cb73[_0x2614('0x44')]['id']}},_0x46ba1b={};_0x46ba1b[_0x2614('0x31')]=_[_0x2614('0x2e')](db['Attachment'][_0x2614('0x2a')]);_0x46ba1b['query']=_[_0x2614('0x2e')](_0x52cb73['query']);_0x46ba1b[_0x2614('0x2f')]=_[_0x2614('0x30')](_0x46ba1b[_0x2614('0x31')],_0x46ba1b[_0x2614('0x32')]);_0x5abfdd[_0x2614('0x33')]=_[_0x2614('0x30')](_0x46ba1b['model'],qs[_0x2614('0x45')](_0x52cb73[_0x2614('0x32')][_0x2614('0x45')]));_0x5abfdd[_0x2614('0x33')]=_0x5abfdd[_0x2614('0x33')][_0x2614('0x34')]?_0x5abfdd[_0x2614('0x33')]:_0x46ba1b[_0x2614('0x31')];if(_0x52cb73['query'][_0x2614('0x3d')]){_0x5abfdd['include']=[{'all':!![]}];}_0x5abfdd=_[_0x2614('0x3a')]({},_0x5abfdd,_0x52cb73[_0x2614('0x3c')]);return db[_0x2614('0x3f')][_0x2614('0x46')](_0x5abfdd)[_0x2614('0x25')](handleEntityNotFound(_0x382d9e,null))['then'](respondWithResult(_0x382d9e,null))['catch'](handleError(_0x382d9e,null));};exports['clone']=function(_0x504b6c,_0x11e529){var _0x5026bf={'where':{'id':_0x504b6c[_0x2614('0x44')]['id']}},_0x4477ab={};_0x4477ab['model']=_[_0x2614('0x2e')](db[_0x2614('0x3f')]['rawAttributes']);_0x5026bf[_0x2614('0x33')]=_[_0x2614('0x30')](_0x4477ab[_0x2614('0x31')],qs[_0x2614('0x45')](_0x504b6c[_0x2614('0x32')][_0x2614('0x45')]));_0x5026bf[_0x2614('0x33')]=_0x5026bf[_0x2614('0x33')][_0x2614('0x34')]?_0x5026bf[_0x2614('0x33')]:_0x4477ab[_0x2614('0x31')];if(_0x504b6c['query'][_0x2614('0x3d')]){_0x5026bf['include']=[{'all':!![]}];}_0x5026bf=_[_0x2614('0x3a')]({},_0x5026bf,_0x504b6c[_0x2614('0x3c')]);return db[_0x2614('0x3f')][_0x2614('0x46')](_0x5026bf)[_0x2614('0x25')](handleEntityNotFound(_0x11e529,null))[_0x2614('0x25')](function(_0x97b558){if(_0x97b558){var _0x3a43e8=_0x97b558[_0x2614('0x47')]({'plain':!![]});_0x3a43e8=qs['omit'](_0x3a43e8,['id',_0x2614('0x48'),_0x2614('0x49')]);_0x504b6c[_0x2614('0x4a')]=_[_0x2614('0x4b')](_0x504b6c[_0x2614('0x4a')],['id',_0x2614('0x48'),'updatedAt']);return db[_0x2614('0x3f')][_0x2614('0x4c')](_[_0x2614('0x3a')](_0x3a43e8,_0x504b6c[_0x2614('0x4a')]),{'include':_0x504b6c[_0x2614('0x32')][_0x2614('0x3d')]?[{'all':!![]}]:undefined});}})[_0x2614('0x25')](respondWithResult(_0x11e529,0xc9))['catch'](handleError(_0x11e529,null));};exports[_0x2614('0x4d')]=function(_0x552cb4,_0x2ea789){if(_0x552cb4[_0x2614('0x4a')]['id']){delete _0x552cb4[_0x2614('0x4a')]['id'];}return db[_0x2614('0x3f')][_0x2614('0x46')]({'where':{'id':_0x552cb4[_0x2614('0x44')]['id']}})[_0x2614('0x25')](handleEntityNotFound(_0x2ea789,null))[_0x2614('0x25')](saveUpdates(_0x552cb4['body'],null))[_0x2614('0x25')](respondWithResult(_0x2ea789,null))[_0x2614('0x42')](handleError(_0x2ea789,null));};exports['destroy']=function(_0x53701b,_0x183442){return db[_0x2614('0x3f')]['find']({'where':{'id':_0x53701b[_0x2614('0x44')]['id']}})['then'](handleEntityNotFound(_0x183442,null))[_0x2614('0x25')](removeEntity(_0x183442,null))['catch'](handleError(_0x183442,null));};exports['create']=function(_0x4919bf,_0x3b82ef,_0x48c13d){_0x4919bf[_0x2614('0x4a')][_0x2614('0x27')]=_0x4919bf[_0x2614('0x4e')][_0x2614('0x4f')];_0x4919bf['body']['basename']=_0x4919bf[_0x2614('0x4e')][_0x2614('0x50')];_0x4919bf[_0x2614('0x4a')][_0x2614('0x2c')]=_0x4919bf['file'][_0x2614('0x51')];return db[_0x2614('0x3f')][_0x2614('0x4c')](_0x4919bf[_0x2614('0x4a')])[_0x2614('0x25')](respondWithResult(_0x3b82ef,0xc9))[_0x2614('0x42')](handleError(_0x3b82ef,null));};exports[_0x2614('0x52')]=function(_0x20040b,_0x2fc47b,_0x2555dd){return db[_0x2614('0x3f')][_0x2614('0x53')]({'where':{'id':_0x20040b[_0x2614('0x44')]['id']},'raw':!![]})[_0x2614('0x25')](handleEntityNotFound(_0x2fc47b,null))[_0x2614('0x25')](function(_0xc61289){if(_0xc61289){var _0x55a0cb=_0xc61289['ChatOfflineMessageId']!==null;var _0x240c69=path['join'](config[_0x2614('0x54')],_0x2614('0x55'));if(_0x55a0cb){_0x240c69=path['join'](_0x240c69,'offline-chat/');}var _0x258c2f=path['join'](_0x240c69,_0xc61289[_0x2614('0x56')]);return _0x2fc47b[_0x2614('0x52')](_0x258c2f);}})[_0x2614('0x42')](handleError(_0x2fc47b,null));}; \ No newline at end of file +var _0x59d6=['stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','Attachment','includeAll','find','clone','get','createdAt','body','omit','create','originalname','basename','file','filename','mimetype','download','findOne','server/files/attachments/','join','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error'];(function(_0x2bb5fa,_0x2d5fd7){var _0x327982=function(_0x190d1b){while(--_0x190d1b){_0x2bb5fa['push'](_0x2bb5fa['shift']());}};_0x327982(++_0x2d5fd7);}(_0x59d6,0xe6));var _0x659d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x59d6[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x659d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x659d('0x1'));var jsonpatch=require(_0x659d('0x2'));var rp=require(_0x659d('0x3'));var moment=require(_0x659d('0x4'));var BPromise=require(_0x659d('0x5'));var Mustache=require(_0x659d('0x6'));var util=require(_0x659d('0x7'));var path=require(_0x659d('0x8'));var sox=require(_0x659d('0x9'));var csv=require(_0x659d('0xa'));var ejs=require(_0x659d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x659d('0xc'));var squel=require(_0x659d('0xd'));var crypto=require(_0x659d('0xe'));var jsforce=require(_0x659d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x659d('0x10'));var Redis=require(_0x659d('0x11'));var authService=require(_0x659d('0x12'));var qs=require(_0x659d('0x13'));var as=require(_0x659d('0x14'));var hardwareService=require(_0x659d('0x15'));var logger=require(_0x659d('0x16'))(_0x659d('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x659d('0x18'));var db=require(_0x659d('0x19'))['db'];function respondWithStatusCode(_0x533a8a,_0x106634){_0x106634=_0x106634||0xcc;return function(_0x2e2c0b){if(_0x2e2c0b){return _0x533a8a['sendStatus'](_0x106634);}return _0x533a8a[_0x659d('0x1a')](_0x106634)[_0x659d('0x1b')]();};}function respondWithResult(_0x4e584f,_0xaace1a){_0xaace1a=_0xaace1a||0xc8;return function(_0x12861c){if(_0x12861c){return _0x4e584f[_0x659d('0x1a')](_0xaace1a)[_0x659d('0x1c')](_0x12861c);}};}function respondWithFilteredResult(_0x22fdc6,_0x311a6d){return function(_0x5cdcf2){if(_0x5cdcf2){var _0x4d32b1=typeof _0x311a6d[_0x659d('0x1d')]===_0x659d('0x1e')&&typeof _0x311a6d[_0x659d('0x1f')]===_0x659d('0x1e');var _0x1eb240=_0x5cdcf2[_0x659d('0x20')];var _0xd38704=_0x4d32b1?0x0:_0x311a6d['offset'];var _0x5f6750=_0x4d32b1?_0x5cdcf2['count']:_0x311a6d['offset']+_0x311a6d['limit'];var _0x150a5d;if(_0x5f6750>=_0x1eb240){_0x5f6750=_0x1eb240;_0x150a5d=0xc8;}else{_0x150a5d=0xce;}_0x22fdc6[_0x659d('0x1a')](_0x150a5d);return _0x22fdc6[_0x659d('0x21')](_0x659d('0x22'),_0xd38704+'-'+_0x5f6750+'/'+_0x1eb240)[_0x659d('0x1c')](_0x5cdcf2);}return null;};}function patchUpdates(_0xde4608){return function(_0x5e2f30){try{jsonpatch['apply'](_0x5e2f30,_0xde4608,!![]);}catch(_0x2c4629){return BPromise[_0x659d('0x23')](_0x2c4629);}return _0x5e2f30[_0x659d('0x24')]();};}function saveUpdates(_0x12116a,_0x53b0a0){return function(_0x2ab6bb){if(_0x2ab6bb){return _0x2ab6bb[_0x659d('0x25')](_0x12116a)[_0x659d('0x26')](function(_0x38c631){return _0x38c631;});}return null;};}function removeEntity(_0x160737,_0x534911){return function(_0x3a9d12){if(_0x3a9d12){return _0x3a9d12['destroy']()[_0x659d('0x26')](function(){_0x160737['status'](0xcc)[_0x659d('0x1b')]();});}};}function handleEntityNotFound(_0x4273f5,_0x3b3497){return function(_0xa9bfd1){if(!_0xa9bfd1){_0x4273f5['sendStatus'](0x194);}return _0xa9bfd1;};}function handleError(_0x4f6a02,_0x31d853){_0x31d853=_0x31d853||0x1f4;return function(_0x4a2fcd){logger[_0x659d('0x27')](_0x4a2fcd[_0x659d('0x28')]);if(_0x4a2fcd[_0x659d('0x29')]){delete _0x4a2fcd['name'];}_0x4f6a02[_0x659d('0x1a')](_0x31d853)['send'](_0x4a2fcd);};}exports[_0x659d('0x2a')]=function(_0x2ae69c,_0x1746bf){var _0x37ced9={},_0x4700c8={},_0x13c9c4={'count':0x0,'rows':[]};var _0x10c037=_[_0x659d('0x2b')](db['Attachment'][_0x659d('0x2c')],function(_0x5006f0){return{'name':_0x5006f0[_0x659d('0x2d')],'type':_0x5006f0[_0x659d('0x2e')][_0x659d('0x2f')]};});_0x4700c8[_0x659d('0x30')]=_[_0x659d('0x2b')](_0x10c037,'name');_0x4700c8['query']=_['keys'](_0x2ae69c['query']);_0x4700c8[_0x659d('0x31')]=_[_0x659d('0x32')](_0x4700c8[_0x659d('0x30')],_0x4700c8['query']);_0x37ced9[_0x659d('0x33')]=_[_0x659d('0x32')](_0x4700c8[_0x659d('0x30')],qs[_0x659d('0x34')](_0x2ae69c[_0x659d('0x35')][_0x659d('0x34')]));_0x37ced9[_0x659d('0x33')]=_0x37ced9['attributes'][_0x659d('0x36')]?_0x37ced9[_0x659d('0x33')]:_0x4700c8[_0x659d('0x30')];if(!_0x2ae69c[_0x659d('0x35')][_0x659d('0x37')](_0x659d('0x38'))){_0x37ced9[_0x659d('0x1f')]=qs[_0x659d('0x1f')](_0x2ae69c[_0x659d('0x35')][_0x659d('0x1f')]);_0x37ced9[_0x659d('0x1d')]=qs[_0x659d('0x1d')](_0x2ae69c[_0x659d('0x35')][_0x659d('0x1d')]);}_0x37ced9[_0x659d('0x39')]=qs[_0x659d('0x3a')](_0x2ae69c[_0x659d('0x35')]['sort']);_0x37ced9['where']=qs[_0x659d('0x31')](_[_0x659d('0x3b')](_0x2ae69c[_0x659d('0x35')],_0x4700c8[_0x659d('0x31')]),_0x10c037);if(_0x2ae69c[_0x659d('0x35')][_0x659d('0x3c')]){_0x37ced9[_0x659d('0x3d')]=_[_0x659d('0x3e')](_0x37ced9[_0x659d('0x3d')],{'$or':_[_0x659d('0x2b')](_0x10c037,function(_0x174add){if(_0x174add[_0x659d('0x2e')]!==_0x659d('0x3f')){var _0x42efce={};_0x42efce[_0x174add[_0x659d('0x29')]]={'$like':'%'+_0x2ae69c[_0x659d('0x35')][_0x659d('0x3c')]+'%'};return _0x42efce;}})});}_0x37ced9=_[_0x659d('0x3e')]({},_0x37ced9,_0x2ae69c[_0x659d('0x40')]);var _0xbeeff6={'where':_0x37ced9[_0x659d('0x3d')]};return db['Attachment'][_0x659d('0x20')](_0xbeeff6)['then'](function(_0x1af001){_0x13c9c4[_0x659d('0x20')]=_0x1af001;if(_0x2ae69c[_0x659d('0x35')]['includeAll']){_0x37ced9[_0x659d('0x41')]=[{'all':!![]}];}return db['Attachment'][_0x659d('0x42')](_0x37ced9);})[_0x659d('0x26')](function(_0x512cd1){_0x13c9c4['rows']=_0x512cd1;return _0x13c9c4;})[_0x659d('0x26')](respondWithFilteredResult(_0x1746bf,_0x37ced9))[_0x659d('0x43')](handleError(_0x1746bf,null));};exports[_0x659d('0x44')]=function(_0x558bbe,_0x29b541){var _0x470ac6={'raw':!![],'where':{'id':_0x558bbe[_0x659d('0x45')]['id']}},_0x5bfc0f={};_0x5bfc0f[_0x659d('0x30')]=_[_0x659d('0x46')](db[_0x659d('0x47')][_0x659d('0x2c')]);_0x5bfc0f['query']=_[_0x659d('0x46')](_0x558bbe[_0x659d('0x35')]);_0x5bfc0f[_0x659d('0x31')]=_['intersection'](_0x5bfc0f[_0x659d('0x30')],_0x5bfc0f[_0x659d('0x35')]);_0x470ac6[_0x659d('0x33')]=_[_0x659d('0x32')](_0x5bfc0f[_0x659d('0x30')],qs['fields'](_0x558bbe['query'][_0x659d('0x34')]));_0x470ac6['attributes']=_0x470ac6['attributes'][_0x659d('0x36')]?_0x470ac6[_0x659d('0x33')]:_0x5bfc0f[_0x659d('0x30')];if(_0x558bbe['query'][_0x659d('0x48')]){_0x470ac6['include']=[{'all':!![]}];}_0x470ac6=_[_0x659d('0x3e')]({},_0x470ac6,_0x558bbe['options']);return db[_0x659d('0x47')][_0x659d('0x49')](_0x470ac6)['then'](handleEntityNotFound(_0x29b541,null))['then'](respondWithResult(_0x29b541,null))['catch'](handleError(_0x29b541,null));};exports[_0x659d('0x4a')]=function(_0x277e1b,_0x3044ce){var _0x58fe81={'where':{'id':_0x277e1b[_0x659d('0x45')]['id']}},_0x46e61c={};_0x46e61c[_0x659d('0x30')]=_[_0x659d('0x46')](db[_0x659d('0x47')][_0x659d('0x2c')]);_0x58fe81[_0x659d('0x33')]=_['intersection'](_0x46e61c[_0x659d('0x30')],qs[_0x659d('0x34')](_0x277e1b['query'][_0x659d('0x34')]));_0x58fe81['attributes']=_0x58fe81[_0x659d('0x33')][_0x659d('0x36')]?_0x58fe81['attributes']:_0x46e61c[_0x659d('0x30')];if(_0x277e1b[_0x659d('0x35')][_0x659d('0x48')]){_0x58fe81[_0x659d('0x41')]=[{'all':!![]}];}_0x58fe81=_[_0x659d('0x3e')]({},_0x58fe81,_0x277e1b['options']);return db[_0x659d('0x47')][_0x659d('0x49')](_0x58fe81)[_0x659d('0x26')](handleEntityNotFound(_0x3044ce,null))[_0x659d('0x26')](function(_0x42f4f5){if(_0x42f4f5){var _0x5cf1c1=_0x42f4f5[_0x659d('0x4b')]({'plain':!![]});_0x5cf1c1=qs['omit'](_0x5cf1c1,['id',_0x659d('0x4c'),'updatedAt']);_0x277e1b[_0x659d('0x4d')]=_[_0x659d('0x4e')](_0x277e1b[_0x659d('0x4d')],['id','createdAt','updatedAt']);return db[_0x659d('0x47')][_0x659d('0x4f')](_[_0x659d('0x3e')](_0x5cf1c1,_0x277e1b[_0x659d('0x4d')]),{'include':_0x277e1b['query']['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3044ce,0xc9))[_0x659d('0x43')](handleError(_0x3044ce,null));};exports['update']=function(_0x5e2c84,_0x2b2c77){if(_0x5e2c84[_0x659d('0x4d')]['id']){delete _0x5e2c84[_0x659d('0x4d')]['id'];}return db[_0x659d('0x47')][_0x659d('0x49')]({'where':{'id':_0x5e2c84['params']['id']}})[_0x659d('0x26')](handleEntityNotFound(_0x2b2c77,null))[_0x659d('0x26')](saveUpdates(_0x5e2c84['body'],null))[_0x659d('0x26')](respondWithResult(_0x2b2c77,null))[_0x659d('0x43')](handleError(_0x2b2c77,null));};exports['destroy']=function(_0x25fcf2,_0x2b5c2a){return db[_0x659d('0x47')][_0x659d('0x49')]({'where':{'id':_0x25fcf2[_0x659d('0x45')]['id']}})[_0x659d('0x26')](handleEntityNotFound(_0x2b5c2a,null))[_0x659d('0x26')](removeEntity(_0x2b5c2a,null))['catch'](handleError(_0x2b5c2a,null));};exports[_0x659d('0x4f')]=function(_0x1aede6,_0x3741b3,_0x3b8495){_0x1aede6[_0x659d('0x4d')]['name']=_0x1aede6['file'][_0x659d('0x50')];_0x1aede6['body'][_0x659d('0x51')]=_0x1aede6[_0x659d('0x52')][_0x659d('0x53')];_0x1aede6[_0x659d('0x4d')][_0x659d('0x2e')]=_0x1aede6['file'][_0x659d('0x54')];return db[_0x659d('0x47')][_0x659d('0x4f')](_0x1aede6[_0x659d('0x4d')])[_0x659d('0x26')](respondWithResult(_0x3741b3,0xc9))['catch'](handleError(_0x3741b3,null));};exports[_0x659d('0x55')]=function(_0x1543e2,_0x39b600,_0x1bf993){return db[_0x659d('0x47')][_0x659d('0x56')]({'where':{'id':_0x1543e2[_0x659d('0x45')]['id']},'raw':!![]})[_0x659d('0x26')](handleEntityNotFound(_0x39b600,null))['then'](function(_0x3605cc){if(_0x3605cc){var _0x29f085=_0x3605cc['ChatOfflineMessageId']!==null;var _0x36fff1=path['join'](config['root'],_0x659d('0x57'));if(_0x29f085){_0x36fff1=path[_0x659d('0x58')](_0x36fff1,_0x659d('0x59'));}var _0x50a951=path['join'](_0x36fff1,_0x3605cc[_0x659d('0x51')]);return _0x39b600['download'](_0x50a951);}})[_0x659d('0x43')](handleError(_0x39b600,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5ab677b..2279587 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 _0x846f=['attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Attachment'];(function(_0x20448f,_0x20bb0e){var _0x18c84f=function(_0x2af8c3){while(--_0x2af8c3){_0x20448f['push'](_0x20448f['shift']());}};_0x18c84f(++_0x20bb0e);}(_0x846f,0xb5));var _0xf846=function(_0x40f10e,_0x445ee6){_0x40f10e=_0x40f10e-0x0;var _0x4dc9ca=_0x846f[_0x40f10e];return _0x4dc9ca;};'use strict';var _=require(_0xf846('0x0'));var util=require(_0xf846('0x1'));var logger=require('../../config/logger')(_0xf846('0x2'));var moment=require(_0xf846('0x3'));var BPromise=require(_0xf846('0x4'));var rp=require(_0xf846('0x5'));var fs=require('fs');var path=require(_0xf846('0x6'));var rimraf=require(_0xf846('0x7'));var config=require(_0xf846('0x8'));var attributes=require('./attachment.attributes');module['exports']=function(_0xbc6781,_0x177129){return _0xbc6781[_0xf846('0x9')](_0xf846('0xa'),attributes,{'tableName':_0xf846('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8597=['../../config/environment','./attachment.attributes','exports','define','attachments','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x8597,0xb9));var _0x7859=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x8597[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x7859('0x0'));var util=require('util');var logger=require(_0x7859('0x1'))('api');var moment=require(_0x7859('0x2'));var BPromise=require(_0x7859('0x3'));var rp=require(_0x7859('0x4'));var fs=require('fs');var path=require(_0x7859('0x5'));var rimraf=require(_0x7859('0x6'));var config=require(_0x7859('0x7'));var attributes=require(_0x7859('0x8'));module[_0x7859('0x9')]=function(_0x5cbf87,_0x447cf8){return _0x5cbf87[_0x7859('0xa')]('Attachment',attributes,{'tableName':_0x7859('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 6f49a6b..ca7fba1 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 _0xf290=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','create','body','options','raw','util','bluebird','ioredis'];(function(_0x22e475,_0x55f07a){var _0xc99375=function(_0x105605){while(--_0x105605){_0x22e475['push'](_0x22e475['shift']());}};_0xc99375(++_0x55f07a);}(_0xf290,0xde));var _0x0f29=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xf290[_0x5774be];return _0x4914b4;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Attachment,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['Attachment'][_0x0f29('0x15')](_0x5d72a5[_0x0f29('0x16')],{'raw':_0x5d72a5[_0x0f29('0x17')]?_0x5d72a5[_0x0f29('0x17')][_0x0f29('0x18')]===undefined?!![]:![]:!![]})[_0x0f29('0xa')](function(_0x150271){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger['debug']('CreateAttachment',_0x5d72a5,JSON['stringify'](_0x150271));_0x4ca5e8(_0x150271);})['catch'](function(_0x38a1ce){logger[_0x0f29('0x10')]('CreateAttachment',_0x38a1ce[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994[_0x0f29('0x10')](0x1f4,_0x38a1ce[_0x0f29('0x12')]));});});}; \ No newline at end of file +var _0x3f19=['lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','CreateAttachment','Attachment','options'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x3f19,0xc0));var _0x93f1=function(_0xc9a48e,_0x4d3e72){_0xc9a48e=_0xc9a48e-0x0;var _0x419127=_0x3f19[_0xc9a48e];return _0x419127;};'use strict';var _=require(_0x93f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93f1('0x2'))['db'];var utils=require(_0x93f1('0x3'));var logger=require(_0x93f1('0x4'))(_0x93f1('0x5'));var config=require('../../config/environment');var jayson=require(_0x93f1('0x6'));var client=jayson[_0x93f1('0x7')][_0x93f1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x425c6f,_0x171bf6,_0xdaa92){return new BPromise(function(_0x5d7374,_0x1874da){return client[_0x93f1('0x9')](_0x425c6f,_0xdaa92)[_0x93f1('0xa')](function(_0x240758){logger[_0x93f1('0xb')]('Attachment,\x20%s,\x20%s',_0x171bf6,_0x93f1('0xc'));logger[_0x93f1('0xd')](_0x93f1('0xe'),_0x171bf6,_0x93f1('0xc'),JSON[_0x93f1('0xf')](_0x240758));if(_0x240758[_0x93f1('0x10')]){if(_0x240758[_0x93f1('0x10')][_0x93f1('0x11')]===0x1f4){logger[_0x93f1('0x10')](_0x93f1('0x12'),_0x171bf6,_0x240758['error'][_0x93f1('0x13')]);return _0x1874da(_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);}logger[_0x93f1('0x10')]('Attachment,\x20%s,\x20%s',_0x171bf6,_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);return _0x5d7374(_0x240758[_0x93f1('0x10')][_0x93f1('0x13')]);}else{logger[_0x93f1('0xb')](_0x93f1('0x12'),_0x171bf6,_0x93f1('0xc'));_0x5d7374(_0x240758['result'][_0x93f1('0x13')]);}})[_0x93f1('0x14')](function(_0x3e3afa){logger[_0x93f1('0x10')](_0x93f1('0x12'),_0x171bf6,_0x3e3afa);_0x1874da(_0x3e3afa);});});}exports[_0x93f1('0x15')]=function(_0xaed1b5){var _0xf3d769=this;return new Promise(function(_0x15c213,_0x380e78){return db[_0x93f1('0x16')]['create'](_0xaed1b5['body'],{'raw':_0xaed1b5['options']?_0xaed1b5[_0x93f1('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x93f1('0xa')](function(_0x39ae13){logger[_0x93f1('0xb')](_0x93f1('0x15'),_0xaed1b5);logger['debug'](_0x93f1('0x15'),_0xaed1b5,JSON['stringify'](_0x39ae13));_0x15c213(_0x39ae13);})[_0x93f1('0x14')](function(_0x310e76){logger['error'](_0x93f1('0x15'),_0x310e76['message'],_0xaed1b5);_0x380e78(_0xf3d769['error'](0x1f4,_0x310e76[_0x93f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 087a45e..58ce306 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x366d0d,_0x3adc49){var _0x27483e=function(_0x5d2dc8){while(--_0x5d2dc8){_0x366d0d['push'](_0x366d0d['shift']());}};_0x27483e(++_0x3adc49);}(_0xb10b,0x12a));var _0xbb10=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xb10b[_0x644ecd];return _0x1c66ce;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x0b0e[_0x21d532];return _0x37bda1;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index e45f690..876884b 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 _0x66a4=['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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','online','user','agent','add','clearBlockUser','getLicense','catch','status','send','message','ad-login','signToken','json','use','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error'];(function(_0x332452,_0x36b123){var _0x13f7b5=function(_0x27cf2d){while(--_0x27cf2d){_0x332452['push'](_0x332452['shift']());}};_0x13f7b5(++_0x36b123);}(_0x66a4,0x1af));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require(_0x466a('0x0'));var LocalStrategy=require(_0x466a('0x1'))[_0x466a('0x2')];var moment=require(_0x466a('0x3'));var ActiveDirectory=require(_0x466a('0x4'));var BPromise=require(_0x466a('0x5'));var util=require(_0x466a('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x466a('0x7'));var utils=require(_0x466a('0x8'));var config=require(_0x466a('0x9'));var logger=require(_0x466a('0xa'))(_0x466a('0xb'));function isActiveDirectoryConfigured(_0x374dc5){var _0x3018e4=![];if(typeof _0x374dc5[_0x466a('0xc')]!==_0x466a('0xd')){_0x3018e4=_0x374dc5[_0x466a('0xc')][_0x466a('0xe')]&&_0x374dc5[_0x466a('0xc')][_0x466a('0xf')]&&_0x374dc5[_0x466a('0xc')][_0x466a('0x10')];}return _0x3018e4;}function adAuthenticate(_0x1063d8,_0x8c74d4,_0xfcdc13){return new BPromise(function(_0x497a95,_0x51686a){try{var _0x1908b3=new ActiveDirectory(_0x1063d8);_0x1908b3[_0x466a('0x11')](_0x8c74d4,_0xfcdc13,function(_0x42e5f3,_0xa3e984){if(_0x42e5f3){logger[_0x466a('0x12')](_0x466a('0x13'),_0x8c74d4,util[_0x466a('0x14')](_0x42e5f3,{'showHidden':![],'depth':null}));_0x51686a(_0x466a('0x15'));}else if(!_0xa3e984){logger[_0x466a('0x12')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x8c74d4);_0x51686a(_0x466a('0x15'));}else{_0x497a95(_0xa3e984);}});}catch(_0x4ac296){_0x51686a(_0x4ac296);}});}function ActiveDirectoryAuthenticate(_0x152118,_0x2a4b22,_0x3cfb9e,_0x5c5a4f){var _0x301512,_0x1936d9;if(!isActiveDirectoryConfigured(config)){logger[_0x466a('0x12')](_0x466a('0x16'),_0x2a4b22);return _0x5c5a4f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x466a('0x17')]({'where':{'id':0x1},'attributes':[_0x466a('0x18'),_0x466a('0x19')],'raw':!![]})[_0x466a('0x1a')](function(_0xf6cef0){_0x301512=_0xf6cef0;if(!_0x301512[_0x466a('0x18')]){logger[_0x466a('0x12')](_0x466a('0x1b'),_0x2a4b22);throw new Error(_0x466a('0x15'));}return _0x152118[_0x466a('0x17')]({'attributes':['id',_0x466a('0x1c'),'password',_0x466a('0x1d'),_0x466a('0x1e'),_0x466a('0x1f'),_0x466a('0x20'),_0x466a('0x21'),_0x466a('0x22')],'where':{'name':_0x2a4b22,'role':{'$or':['admin',_0x466a('0x23'),_0x466a('0x24')]},'adSsoEnabled':!![]}});})[_0x466a('0x1a')](function(_0x13e2d1){if(!_0x13e2d1||_0x13e2d1&&_0x13e2d1['name']!==_0x2a4b22){throw new Error(_0x466a('0x15'));}_0x1936d9=_0x13e2d1;var _0x65319b=_0x1936d9[_0x466a('0x1c')]+'@'+config[_0x466a('0xc')][_0x466a('0x10')];return adAuthenticate(config[_0x466a('0xc')],_0x65319b,_0x3cfb9e);})[_0x466a('0x1a')](function(_0x31b8e1){if(_0x1936d9['disabled']){throw new Error(_0x466a('0x15'));}if(_0x301512['blockDuration']>0x0){if(_0x1936d9[_0x466a('0x20')]){if(moment(_0x1936d9[_0x466a('0x21')])[_0x466a('0x25')](_0x301512[_0x466a('0x19')],'minutes')>moment()){throw new Error(_0x466a('0x15'));}return utils[_0x466a('0x26')](_0x1936d9,0x0,![],null)['then'](function(){return utils[_0x466a('0x27')](_0x1936d9);})[_0x466a('0x1a')](function(){return _0x5c5a4f(null,_0x1936d9);});}else{return utils[_0x466a('0x27')](_0x1936d9)[_0x466a('0x1a')](function(){return _0x5c5a4f(null,_0x1936d9);});}}else{return utils[_0x466a('0x27')](_0x1936d9)[_0x466a('0x1a')](function(){return _0x5c5a4f(null,_0x1936d9);});}})[_0x466a('0x28')](function(_0x43b15c){return _0x5c5a4f(null,![],_0x43b15c);});}function handleError(_0x59720d,_0x4143e5,_0x4e610f){return _0x59720d[_0x466a('0x29')](_0x4143e5||0x1f4)[_0x466a('0x2a')]({'message':_0x4e610f?_0x4e610f[_0x466a('0x2b')]||_0x4e610f:''});}exports['login']=function(_0xaa3ce8,_0x29eeeb,_0x4ae307){passport[_0x466a('0x11')](_0x466a('0x2c'),function(_0x293a93,_0x171a34,_0x295e67){var _0x22032e=_0x293a93||_0x295e67;if(_0x22032e){return handleError(_0x29eeeb,0x191,_0x22032e);}if(!_0x171a34){return handleError(_0x29eeeb,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x6fde37={'payload':{'id':_0x171a34['id'],'role':_0x171a34[_0x466a('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0x466a('0x2d')](_0x6fde37)['then'](function(_0x4b329d){_0x29eeeb[_0x466a('0x2e')]({'id':_0x171a34['id'],'token':_0x4b329d,'statusCall':'','isAlreadyLogged':_0x171a34[_0x466a('0x22')]});});}})(_0xaa3ce8,_0x29eeeb,_0x4ae307);};passport[_0x466a('0x2f')](_0x466a('0x2c'),new LocalStrategy({'usernameField':_0x466a('0x1c'),'passwordField':_0x466a('0x30')},function(_0x1fe5df,_0x4441e3,_0x13b12a){return ActiveDirectoryAuthenticate(db[_0x466a('0x31')],_0x1fe5df,_0x4441e3,_0x13b12a);})); \ No newline at end of file +var _0x76cc=['Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blockedAt','admin','user','agent','blockDuration','add','minutes','clearBlockUser','getLicense','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','ad-login','password','User','passport','passport-local','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','error'];(function(_0x2ac0fa,_0x44cb4d){var _0x188843=function(_0x10315d){while(--_0x10315d){_0x2ac0fa['push'](_0x2ac0fa['shift']());}};_0x188843(++_0x44cb4d);}(_0x76cc,0x7e));var _0xc76c=function(_0x23537a,_0x5325af){_0x23537a=_0x23537a-0x0;var _0x3c437e=_0x76cc[_0x23537a];return _0x3c437e;};'use strict';var passport=require(_0xc76c('0x0'));var LocalStrategy=require(_0xc76c('0x1'))['Strategy'];var moment=require(_0xc76c('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xc76c('0x3'));var util=require(_0xc76c('0x4'));var db=require(_0xc76c('0x5'))['db'];var authService=require(_0xc76c('0x6'));var utils=require(_0xc76c('0x7'));var config=require(_0xc76c('0x8'));var logger=require(_0xc76c('0x9'))(_0xc76c('0xa'));function isActiveDirectoryConfigured(_0xfd117){var _0x1e7674=![];if(typeof _0xfd117['activedirectory']!==_0xc76c('0xb')){_0x1e7674=_0xfd117[_0xc76c('0xc')][_0xc76c('0xd')]&&_0xfd117[_0xc76c('0xc')][_0xc76c('0xe')]&&_0xfd117['activedirectory'][_0xc76c('0xf')];}return _0x1e7674;}function adAuthenticate(_0x39e554,_0xfa0bc5,_0x12d52a){return new BPromise(function(_0x3cd9a2,_0x123002){try{var _0x17d79a=new ActiveDirectory(_0x39e554);_0x17d79a[_0xc76c('0x10')](_0xfa0bc5,_0x12d52a,function(_0x5e734b,_0x1cb9fe){if(_0x5e734b){logger[_0xc76c('0x11')](_0xc76c('0x12'),_0xfa0bc5,util['inspect'](_0x5e734b,{'showHidden':![],'depth':null}));_0x123002(_0xc76c('0x13'));}else if(!_0x1cb9fe){logger[_0xc76c('0x11')](_0xc76c('0x14'),_0xfa0bc5);_0x123002(_0xc76c('0x13'));}else{_0x3cd9a2(_0x1cb9fe);}});}catch(_0x2cee37){_0x123002(_0x2cee37);}});}function ActiveDirectoryAuthenticate(_0x1716ce,_0x4031bd,_0x56f8f4,_0x2791b){var _0x68c38,_0x5622b4;if(!isActiveDirectoryConfigured(config)){logger[_0xc76c('0x11')](_0xc76c('0x15'),_0x4031bd);return _0x2791b(null,![],{'message':_0xc76c('0x13')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xc76c('0x16'),'blockDuration'],'raw':!![]})[_0xc76c('0x17')](function(_0x535c0f){_0x68c38=_0x535c0f;if(!_0x68c38['adSsoEnabled']){logger[_0xc76c('0x11')](_0xc76c('0x18'),_0x4031bd);throw new Error(_0xc76c('0x13'));}return _0x1716ce['findOne']({'attributes':['id',_0xc76c('0x19'),'password',_0xc76c('0x1a'),_0xc76c('0x1b'),_0xc76c('0x1c'),'blocked',_0xc76c('0x1d'),'online'],'where':{'name':_0x4031bd,'role':{'$or':[_0xc76c('0x1e'),_0xc76c('0x1f'),_0xc76c('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x53c82b){if(!_0x53c82b||_0x53c82b&&_0x53c82b[_0xc76c('0x19')]!==_0x4031bd){throw new Error(_0xc76c('0x13'));}_0x5622b4=_0x53c82b;var _0x2c3600=_0x5622b4[_0xc76c('0x19')]+'@'+config[_0xc76c('0xc')]['domain'];return adAuthenticate(config[_0xc76c('0xc')],_0x2c3600,_0x56f8f4);})['then'](function(_0x13ac52){if(_0x5622b4[_0xc76c('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x68c38[_0xc76c('0x21')]>0x0){if(_0x5622b4['blocked']){if(moment(_0x5622b4[_0xc76c('0x1d')])[_0xc76c('0x22')](_0x68c38['blockDuration'],_0xc76c('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xc76c('0x24')](_0x5622b4,0x0,![],null)['then'](function(){return utils[_0xc76c('0x25')](_0x5622b4);})[_0xc76c('0x17')](function(){return _0x2791b(null,_0x5622b4);});}else{return utils[_0xc76c('0x25')](_0x5622b4)[_0xc76c('0x17')](function(){return _0x2791b(null,_0x5622b4);});}}else{return utils[_0xc76c('0x25')](_0x5622b4)[_0xc76c('0x17')](function(){return _0x2791b(null,_0x5622b4);});}})['catch'](function(_0x397ed6){return _0x2791b(null,![],_0x397ed6);});}function handleError(_0x36bbe3,_0x952e2a,_0x47b23c){return _0x36bbe3[_0xc76c('0x26')](_0x952e2a||0x1f4)[_0xc76c('0x27')]({'message':_0x47b23c?_0x47b23c[_0xc76c('0x28')]||_0x47b23c:''});}exports[_0xc76c('0x29')]=function(_0x1a9672,_0x1a74cf,_0x499627){passport[_0xc76c('0x10')]('ad-login',function(_0x1b228b,_0x2de349,_0x2b78c5){var _0x2e62b6=_0x1b228b||_0x2b78c5;if(_0x2e62b6){return handleError(_0x1a74cf,0x191,_0x2e62b6);}if(!_0x2de349){return handleError(_0x1a74cf,0x194,{'message':_0xc76c('0x2a')});}else{var _0x1ba843={'payload':{'id':_0x2de349['id'],'role':_0x2de349[_0xc76c('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xc76c('0x2b')](_0x1ba843)['then'](function(_0x2cf460){_0x1a74cf['json']({'id':_0x2de349['id'],'token':_0x2cf460,'statusCall':'','isAlreadyLogged':_0x2de349['online']});});}})(_0x1a9672,_0x1a74cf,_0x499627);};passport[_0xc76c('0x2c')](_0xc76c('0x2d'),new LocalStrategy({'usernameField':_0xc76c('0x19'),'passwordField':_0xc76c('0x2e')},function(_0x4aa0ca,_0x15de52,_0x30a707){return ActiveDirectoryAuthenticate(db[_0xc76c('0x2f')],_0x4aa0ca,_0x15de52,_0x30a707);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index d4c661c..c9a0fe1 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 _0xbe36=['./authActiveDirectory.controller','post','exports','express','Router'];(function(_0x1dc935,_0x3bd481){var _0x3d848d=function(_0x17cf5d){while(--_0x17cf5d){_0x1dc935['push'](_0x1dc935['shift']());}};_0x3d848d(++_0x3bd481);}(_0xbe36,0x17f));var _0x6be3=function(_0x5e2942,_0x2880e4){_0x5e2942=_0x5e2942-0x0;var _0x39c863=_0xbe36[_0x5e2942];return _0x39c863;};'use strict';var express=require(_0x6be3('0x0'));var router=express[_0x6be3('0x1')]();var controller=require(_0x6be3('0x2'));router[_0x6be3('0x3')]('/',controller['login']);module[_0x6be3('0x4')]=router; \ No newline at end of file +var _0x82d0=['./authActiveDirectory.controller','exports','express','Router'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x82d0,0xca));var _0x082d=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x82d0[_0x5a92ad];return _0x2466f8;};'use strict';var express=require(_0x082d('0x0'));var router=express[_0x082d('0x1')]();var controller=require(_0x082d('0x2'));router['post']('/',controller['login']);module[_0x082d('0x3')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 1b9bf8e..e9836f8 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x7a54,0x106));var _0x47a5=function(_0x6da43a,_0x33e5c5){_0x6da43a=_0x6da43a-0x0;var _0xce2c75=_0x7a54[_0x6da43a];return _0xce2c75;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x7a54,0x106));var _0x47a5=function(_0x54b9b9,_0x3475e5){_0x54b9b9=_0x54b9b9-0x0;var _0x5a58f0=_0x7a54[_0x54b9b9];return _0x5a58f0;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0541b94..4dc8a89 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 _0x36c3=['../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router'];(function(_0x1a7c79,_0x361b4f){var _0x5efd76=function(_0x4180bc){while(--_0x4180bc){_0x1a7c79['push'](_0x1a7c79['shift']());}};_0x5efd76(++_0x361b4f);}(_0x36c3,0x69));var _0x336c=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0x36c3[_0x134bfc];return _0x2f4dcc;};'use strict';var express=require(_0x336c('0x0'));var passport=require(_0x336c('0x1'));var router=express[_0x336c('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x336c('0x3'));var authService=require(_0x336c('0x4'));router[_0x336c('0x5')]('/',controller[_0x336c('0x6')]);router[_0x336c('0x5')](_0x336c('0x7'),controller[_0x336c('0x8')],authService[_0x336c('0x9')],userController[_0x336c('0x6')],authService[_0x336c('0xa')]);module[_0x336c('0xb')]=router; \ No newline at end of file +var _0xfada=['isMiddleware','exports','express','passport','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xfada,0x1d2));var _0xafad=function(_0x553558,_0x425d7a){_0x553558=_0x553558-0x0;var _0x48d9a3=_0xfada[_0x553558];return _0x48d9a3;};'use strict';var express=require(_0xafad('0x0'));var passport=require(_0xafad('0x1'));var router=express['Router']();var controller=require(_0xafad('0x2'));var userController=require(_0xafad('0x3'));var authService=require('../../components/auth/service');router[_0xafad('0x4')]('/',controller[_0xafad('0x5')]);router['get']('/callback',controller['callback'],authService[_0xafad('0x6')],userController[_0xafad('0x5')],authService['setTokenCookie']);module[_0xafad('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 21d4d1f..857d70e 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 _0xcea6=['blockDuration','then','name','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','add','getLicense','catch','MailAccount','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','user','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','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','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','find','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','use','util','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts'];(function(_0x24a47b,_0x2dcf13){var _0x47b2ae=function(_0x28f461){while(--_0x28f461){_0x24a47b['push'](_0x24a47b['shift']());}};_0x47b2ae(++_0x2dcf13);}(_0xcea6,0x197));var _0x6cea=function(_0x4a1fa4,_0x19700f){_0x4a1fa4=_0x4a1fa4-0x0;var _0x1e437d=_0xcea6[_0x4a1fa4];return _0x1e437d;};'use strict';var util=require(_0x6cea('0x0'));var passport=require(_0x6cea('0x1'));var LocalStrategy=require('passport-local')[_0x6cea('0x2')];var jayson=require(_0x6cea('0x3'));var _=require(_0x6cea('0x4'));var rs=require('randomstring');var moment=require(_0x6cea('0x5'));var db=require(_0x6cea('0x6'))['db'];var authService=require(_0x6cea('0x7'));var utils=require(_0x6cea('0x8'));var client=jayson['client'][_0x6cea('0x9')]({'port':0x232b});function localAuthenticate(_0x2f8b9e,_0x566129,_0x402a66,_0x3b46e5){var _0x492c69,_0x1545eb;return db[_0x6cea('0xa')][_0x6cea('0xb')]({'where':{'id':0x1},'attributes':[_0x6cea('0xc'),_0x6cea('0xd')],'raw':!![]})[_0x6cea('0xe')](function(_0x583ba4){_0x492c69=_0x583ba4;return _0x2f8b9e[_0x6cea('0xb')]({'attributes':['id',_0x6cea('0xf'),'password','salt','role',_0x6cea('0x10'),_0x6cea('0x11'),_0x6cea('0x12'),_0x6cea('0x13')],'where':{'name':_0x566129,'role':{'$or':[_0x6cea('0x14'),'user',_0x6cea('0x15')]}}});})[_0x6cea('0xe')](function(_0x2d2ce1){if(!_0x2d2ce1||_0x2d2ce1&&_0x2d2ce1[_0x6cea('0xf')]!==_0x566129){throw new Error(_0x6cea('0x16'));}else{_0x1545eb=_0x2d2ce1;return _0x1545eb;}})[_0x6cea('0xe')](function(){_0x1545eb[_0x6cea('0x17')](_0x402a66,function(_0x2f00d8,_0x2fff3f){var _0x21ad2b=_0x1545eb[_0x6cea('0x13')]+0x1;if(_0x2f00d8){return _0x3b46e5(_0x2f00d8);}else if(!_0x2fff3f){if(_0x1545eb[_0x6cea('0x10')]){return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});}else if(_0x492c69['allowedLoginAttempts']>0x0){if(_0x1545eb[_0x6cea('0x11')]){if(_0x492c69[_0x6cea('0xd')]>0x0){if(moment(_0x1545eb[_0x6cea('0x12')])['add'](_0x492c69[_0x6cea('0xd')],_0x6cea('0x18'))>moment()){return _0x3b46e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x1545eb,_0x21ad2b,![],null)[_0x6cea('0xe')](function(){return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});});}}else{return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});}}else{if(_0x21ad2b>=_0x492c69[_0x6cea('0xc')]){return utils[_0x6cea('0x19')](_0x1545eb,0x0,!![],moment())[_0x6cea('0xe')](function(){return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});});}else{return utils['clearBlockUser'](_0x1545eb,_0x21ad2b,![],null)[_0x6cea('0xe')](function(){return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});});}}}else{return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});}}else{if(_0x1545eb['disabled']){return _0x3b46e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x492c69[_0x6cea('0xc')]>0x0){if(_0x1545eb['blocked']){if(_0x492c69[_0x6cea('0xd')]>0x0){if(moment(_0x1545eb['blockedAt'])[_0x6cea('0x1a')](_0x492c69[_0x6cea('0xd')],_0x6cea('0x18'))>moment()){return _0x3b46e5(null,![],{'message':_0x6cea('0x16')});}else{return utils[_0x6cea('0x19')](_0x1545eb,0x0,![],null)[_0x6cea('0xe')](function(){return utils[_0x6cea('0x1b')](_0x1545eb);})[_0x6cea('0xe')](function(){return _0x3b46e5(null,_0x1545eb);});}}else{return _0x3b46e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x6cea('0x19')](_0x1545eb,0x0,![],null)[_0x6cea('0xe')](function(){return utils['getLicense'](_0x1545eb);})[_0x6cea('0xe')](function(){return _0x3b46e5(null,_0x1545eb);})[_0x6cea('0x1c')](function(_0x28d195){return _0x3b46e5(null,![],_0x28d195);});}}else{if(_0x1545eb['blocked']){return _0x3b46e5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x1545eb)[_0x6cea('0xe')](function(){return _0x3b46e5(null,_0x1545eb);});}}}});})[_0x6cea('0x1c')](function(_0x6b5338){return _0x3b46e5(null,![],_0x6b5338);});}function sendServiceMail(_0x502338){return db[_0x6cea('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name',_0x6cea('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x6cea('0x1f'),'include':[{'model':db[_0x6cea('0x20')],'as':_0x6cea('0x20')}]}]})[_0x6cea('0xe')](function(_0x7dd89b){if(!_0x7dd89b){throw new Error(_0x6cea('0x21'));}var _0x20c168=_0x7dd89b[_0x6cea('0x22')]();var _0x1eb93c={'account':_0x20c168,'message':_[_0x6cea('0x23')]({'from':util[_0x6cea('0x24')](_0x6cea('0x25'),_0x7dd89b[_0x6cea('0xf')],_0x7dd89b[_0x6cea('0x1e')]||_0x7dd89b[_0x6cea('0x1f')][_0x6cea('0x26')])},_0x502338)};return client[_0x6cea('0x27')](_0x6cea('0x28'),_0x1eb93c);})['then'](function(_0x3fa1d1){if(_0x3fa1d1['error']){throw new Error(util[_0x6cea('0x24')](_0x6cea('0x29'),_0x3fa1d1['error'][_0x6cea('0x2a')]||JSON[_0x6cea('0x2b')](_0x3fa1d1['error'])));}return!![];});}function handleError(_0x377f3d,_0x371857,_0x37b05c){return _0x377f3d[_0x6cea('0x2c')](_0x371857||0x1f4)[_0x6cea('0x2d')]({'message':_0x37b05c?_0x37b05c['message']||_0x37b05c:''});}exports[_0x6cea('0x2e')]=function(_0x2f333b,_0x344c13,_0x2938a3){passport['authenticate'](_0x6cea('0x2f'),function(_0x5120e8,_0x2596ad,_0x307bc2){var _0x28f899=_0x5120e8||_0x307bc2;if(_0x28f899){return handleError(_0x344c13,0x191,_0x28f899);}if(!_0x2596ad){return handleError(_0x344c13,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x192cf8={'payload':{'id':_0x2596ad['id'],'role':_0x2596ad[_0x6cea('0x30')]},'options':{'expiresIn':0x15180}};return authService[_0x6cea('0x31')](_0x192cf8)[_0x6cea('0xe')](function(_0xc97a42){_0x344c13['json']({'id':_0x2596ad['id'],'token':_0xc97a42,'statusCall':'','isAlreadyLogged':_0x2596ad[_0x6cea('0x32')]});});}})(_0x2f333b,_0x344c13,_0x2938a3);};exports[_0x6cea('0x33')]=function(_0x21bfc0,_0x1ef4f1){if(!_0x21bfc0[_0x6cea('0x34')][_0x6cea('0x1e')]){return handleError(_0x1ef4f1,0x1f4,{'message':_0x6cea('0x35')});}var _0x54ef3e=rs[_0x6cea('0x36')]();_0x21bfc0['body']['email']=_0x21bfc0['body'][_0x6cea('0x1e')]['trim']()[_0x6cea('0x37')]();var _0x2ab073;return db[_0x6cea('0xa')][_0x6cea('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x6cea('0xe')](function(_0x2516f8){_0x2ab073=_0x2516f8;return db[_0x6cea('0x38')]['find']({'where':{'email':_0x21bfc0['body'][_0x6cea('0x1e')]}});})[_0x6cea('0xe')](function(_0xcb832d){if(!_0xcb832d){throw new Error(_0x6cea('0x39'));}if(_0xcb832d['disabled']){throw new Error(_0x6cea('0x3a'));}if(_0xcb832d['blocked']){if(moment(_0xcb832d[_0x6cea('0x12')])[_0x6cea('0x1a')](_0x2ab073[_0x6cea('0xd')],_0x6cea('0x18'))>moment()){throw new Error(_0x6cea('0x3b'));}else{_0xcb832d['blocked']=![];_0xcb832d[_0x6cea('0x12')]=null;}}_0xcb832d[_0x6cea('0x3c')]=_0x54ef3e;_0xcb832d[_0x6cea('0x3d')]=Date[_0x6cea('0x3e')]()+0x36ee80;return _0xcb832d['save']();})[_0x6cea('0xe')](function(){return sendServiceMail({'to':_0x21bfc0[_0x6cea('0x34')]['email'],'subject':_0x6cea('0x3f'),'text':_0x6cea('0x40')+_0x6cea('0x41')+_0x6cea('0x42')+_0x21bfc0[_0x6cea('0x43')][_0x6cea('0x44')]+_0x6cea('0x45')+_0x54ef3e+'\x0a\x0a'+_0x6cea('0x46')});})['then'](function(){_0x1ef4f1[_0x6cea('0x2c')](0xc8)[_0x6cea('0x2d')]({'message':_0x6cea('0x47')});})[_0x6cea('0x1c')](function(_0xfea479){return handleError(_0x1ef4f1,0x1f4,_0xfea479);});};exports[_0x6cea('0x48')]=function(_0x1a99ad,_0x1670c6){return db['User'][_0x6cea('0x49')]({'where':{'resetPasswordToken':_0x1a99ad['params'][_0x6cea('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x6cea('0x3e')]()}}})[_0x6cea('0xe')](function(_0x228a21){if(!_0x228a21){throw new Error(_0x6cea('0x4b'));}return db[_0x6cea('0xa')][_0x6cea('0xb')]({'attributes':['id',_0x6cea('0x4c'),_0x6cea('0x4d'),_0x6cea('0x4e')]})['then'](function(_0x587b72){if(_0x587b72['securePassword'])authService[_0x6cea('0x4f')](_0x1a99ad[_0x6cea('0x34')][_0x6cea('0x50')]);if(!_0x587b72[_0x6cea('0x4d')]||!_0x228a21[_0x6cea('0x51')])return _0x228a21;authService[_0x6cea('0x52')](_0x1a99ad[_0x6cea('0x34')]['password'],_0x228a21['previousPasswords'],_0x587b72[_0x6cea('0x4e')]);return _0x228a21;})[_0x6cea('0xe')](function(){_0x228a21[_0x6cea('0x50')]=_0x1a99ad['body'][_0x6cea('0x50')];_0x228a21[_0x6cea('0x3c')]=null;_0x228a21[_0x6cea('0x3d')]=null;return _0x228a21['save']();});})[_0x6cea('0xe')](function(){_0x1670c6['status'](0xc8)[_0x6cea('0x2d')]({'message':'Password\x20reset!'});})[_0x6cea('0x1c')](function(_0x5beb6e){return handleError(_0x1670c6,0x1f4,_0x5beb6e);});};passport[_0x6cea('0x53')](_0x6cea('0x2f'),new LocalStrategy({'usernameField':_0x6cea('0xf'),'passwordField':_0x6cea('0x50')},function(_0x2e4e69,_0x2e528c,_0x3209b2){return localAuthenticate(db[_0x6cea('0x38')],_0x2e4e69,_0x2e528c,_0x3209b2);})); \ No newline at end of file +var _0x4d28=['toLowerCase','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','then','name','password','role','disabled','blocked','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockDuration','blockedAt','add','minutes','allowedLoginAttempts','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','email','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim'];(function(_0x1b162a,_0x23e566){var _0x433ac3=function(_0x24662b){while(--_0x24662b){_0x1b162a['push'](_0x1b162a['shift']());}};_0x433ac3(++_0x23e566);}(_0x4d28,0x69));var _0x84d2=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0x4d28[_0x4f4c2a];return _0xd15be6;};'use strict';var util=require(_0x84d2('0x0'));var passport=require(_0x84d2('0x1'));var LocalStrategy=require(_0x84d2('0x2'))[_0x84d2('0x3')];var jayson=require(_0x84d2('0x4'));var _=require(_0x84d2('0x5'));var rs=require(_0x84d2('0x6'));var moment=require(_0x84d2('0x7'));var db=require(_0x84d2('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x84d2('0x9'));var client=jayson[_0x84d2('0xa')][_0x84d2('0xb')]({'port':0x232b});function localAuthenticate(_0x3448e3,_0x54065c,_0xd343b2,_0x2c6c66){var _0x4af6ec,_0x4e518f;return db[_0x84d2('0xc')][_0x84d2('0xd')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x84d2('0xe')](function(_0x4d560f){_0x4af6ec=_0x4d560f;return _0x3448e3[_0x84d2('0xd')]({'attributes':['id',_0x84d2('0xf'),_0x84d2('0x10'),'salt',_0x84d2('0x11'),_0x84d2('0x12'),_0x84d2('0x13'),'blockedAt',_0x84d2('0x14')],'where':{'name':_0x54065c,'role':{'$or':[_0x84d2('0x15'),_0x84d2('0x16'),_0x84d2('0x17')]}}});})[_0x84d2('0xe')](function(_0x15f534){if(!_0x15f534||_0x15f534&&_0x15f534[_0x84d2('0xf')]!==_0x54065c){throw new Error(_0x84d2('0x18'));}else{_0x4e518f=_0x15f534;return _0x4e518f;}})[_0x84d2('0xe')](function(){_0x4e518f[_0x84d2('0x19')](_0xd343b2,function(_0xf2bd43,_0x45f702){var _0x2a2630=_0x4e518f[_0x84d2('0x14')]+0x1;if(_0xf2bd43){return _0x2c6c66(_0xf2bd43);}else if(!_0x45f702){if(_0x4e518f[_0x84d2('0x12')]){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}else if(_0x4af6ec['allowedLoginAttempts']>0x0){if(_0x4e518f[_0x84d2('0x13')]){if(_0x4af6ec[_0x84d2('0x1a')]>0x0){if(moment(_0x4e518f[_0x84d2('0x1b')])[_0x84d2('0x1c')](_0x4af6ec[_0x84d2('0x1a')],_0x84d2('0x1d'))>moment()){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}else{return utils['clearBlockUser'](_0x4e518f,_0x2a2630,![],null)[_0x84d2('0xe')](function(){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});});}}else{return _0x2c6c66(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2a2630>=_0x4af6ec[_0x84d2('0x1e')]){return utils['clearBlockUser'](_0x4e518f,0x0,!![],moment())['then'](function(){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});});}else{return utils['clearBlockUser'](_0x4e518f,_0x2a2630,![],null)['then'](function(){return _0x2c6c66(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}}else{if(_0x4e518f[_0x84d2('0x12')]){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}else if(_0x4af6ec['allowedLoginAttempts']>0x0){if(_0x4e518f[_0x84d2('0x13')]){if(_0x4af6ec['blockDuration']>0x0){if(moment(_0x4e518f[_0x84d2('0x1b')])[_0x84d2('0x1c')](_0x4af6ec[_0x84d2('0x1a')],'minutes')>moment()){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}else{return utils[_0x84d2('0x1f')](_0x4e518f,0x0,![],null)[_0x84d2('0xe')](function(){return utils[_0x84d2('0x20')](_0x4e518f);})[_0x84d2('0xe')](function(){return _0x2c6c66(null,_0x4e518f);});}}else{return _0x2c6c66(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x84d2('0x1f')](_0x4e518f,0x0,![],null)[_0x84d2('0xe')](function(){return utils[_0x84d2('0x20')](_0x4e518f);})['then'](function(){return _0x2c6c66(null,_0x4e518f);})[_0x84d2('0x21')](function(_0x40e4fa){return _0x2c6c66(null,![],_0x40e4fa);});}}else{if(_0x4e518f['blocked']){return _0x2c6c66(null,![],{'message':_0x84d2('0x18')});}else{return utils['getLicense'](_0x4e518f)[_0x84d2('0xe')](function(){return _0x2c6c66(null,_0x4e518f);});}}}});})[_0x84d2('0x21')](function(_0x462ff5){return _0x2c6c66(null,![],_0x462ff5);});}function sendServiceMail(_0x7f30f2){return db[_0x84d2('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0x84d2('0xf'),'email'],'include':[{'model':db[_0x84d2('0x23')],'as':_0x84d2('0x24'),'include':[{'model':db['CloudProvider'],'as':_0x84d2('0x25')}]}]})['then'](function(_0x1a3710){if(!_0x1a3710){throw new Error(_0x84d2('0x26'));}var _0x56b2ed=_0x1a3710[_0x84d2('0x27')]();var _0xb6613={'account':_0x56b2ed,'message':_['merge']({'from':util[_0x84d2('0x28')]('\x22%s\x22\x20<%s>',_0x1a3710['name'],_0x1a3710[_0x84d2('0x29')]||_0x1a3710[_0x84d2('0x24')][_0x84d2('0x16')])},_0x7f30f2)};return client[_0x84d2('0x2a')](_0x84d2('0x2b'),_0xb6613);})['then'](function(_0x1397be){if(_0x1397be['error']){throw new Error(util[_0x84d2('0x28')](_0x84d2('0x2c'),_0x1397be[_0x84d2('0x2d')][_0x84d2('0x2e')]||JSON[_0x84d2('0x2f')](_0x1397be[_0x84d2('0x2d')])));}return!![];});}function handleError(_0x19c7ad,_0xa0df91,_0x14cdf5){return _0x19c7ad[_0x84d2('0x30')](_0xa0df91||0x1f4)[_0x84d2('0x31')]({'message':_0x14cdf5?_0x14cdf5[_0x84d2('0x2e')]||_0x14cdf5:''});}exports[_0x84d2('0x32')]=function(_0x5c1bee,_0x9b7f78,_0x5d4db9){passport[_0x84d2('0x19')](_0x84d2('0x33'),function(_0x784753,_0x268414,_0x54171f){var _0x3d49a4=_0x784753||_0x54171f;if(_0x3d49a4){return handleError(_0x9b7f78,0x191,_0x3d49a4);}if(!_0x268414){return handleError(_0x9b7f78,0x194,{'message':_0x84d2('0x34')});}else{var _0x559b08={'payload':{'id':_0x268414['id'],'role':_0x268414[_0x84d2('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x84d2('0x35')](_0x559b08)[_0x84d2('0xe')](function(_0x331432){_0x9b7f78[_0x84d2('0x36')]({'id':_0x268414['id'],'token':_0x331432,'statusCall':'','isAlreadyLogged':_0x268414[_0x84d2('0x37')]});});}})(_0x5c1bee,_0x9b7f78,_0x5d4db9);};exports[_0x84d2('0x38')]=function(_0x5acd68,_0x161313){if(!_0x5acd68['body'][_0x84d2('0x29')]){return handleError(_0x161313,0x1f4,{'message':_0x84d2('0x39')});}var _0x17b1e0=rs[_0x84d2('0x3a')]();_0x5acd68['body'][_0x84d2('0x29')]=_0x5acd68[_0x84d2('0x3b')]['email'][_0x84d2('0x3c')]()[_0x84d2('0x3d')]();var _0x5eba53;return db[_0x84d2('0xc')][_0x84d2('0xd')]({'where':{'id':0x1},'attributes':[_0x84d2('0x1e'),_0x84d2('0x1a')],'raw':!![]})[_0x84d2('0xe')](function(_0x1aa4bb){_0x5eba53=_0x1aa4bb;return db[_0x84d2('0x3e')][_0x84d2('0x3f')]({'where':{'email':_0x5acd68['body']['email']}});})[_0x84d2('0xe')](function(_0x12bdcc){if(!_0x12bdcc){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x12bdcc[_0x84d2('0x12')]){throw new Error(_0x84d2('0x40'));}if(_0x12bdcc[_0x84d2('0x13')]){if(moment(_0x12bdcc[_0x84d2('0x1b')])['add'](_0x5eba53['blockDuration'],'minutes')>moment()){throw new Error(_0x84d2('0x41'));}else{_0x12bdcc['blocked']=![];_0x12bdcc[_0x84d2('0x1b')]=null;}}_0x12bdcc[_0x84d2('0x42')]=_0x17b1e0;_0x12bdcc[_0x84d2('0x43')]=Date['now']()+0x36ee80;return _0x12bdcc['save']();})['then'](function(){return sendServiceMail({'to':_0x5acd68[_0x84d2('0x3b')][_0x84d2('0x29')],'subject':_0x84d2('0x44'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x5acd68[_0x84d2('0x45')][_0x84d2('0x46')]+_0x84d2('0x47')+_0x17b1e0+'\x0a\x0a'+_0x84d2('0x48')});})['then'](function(){_0x161313[_0x84d2('0x30')](0xc8)[_0x84d2('0x31')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x34b822){return handleError(_0x161313,0x1f4,_0x34b822);});};exports[_0x84d2('0x49')]=function(_0x18330a,_0x512d86){return db[_0x84d2('0x3e')][_0x84d2('0x3f')]({'where':{'resetPasswordToken':_0x18330a['params'][_0x84d2('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x84d2('0xe')](function(_0x31b3f3){if(!_0x31b3f3){throw new Error(_0x84d2('0x4b'));}return db[_0x84d2('0xc')][_0x84d2('0xd')]({'attributes':['id','securePassword',_0x84d2('0x4c'),_0x84d2('0x4d')]})['then'](function(_0x2ee224){if(_0x2ee224[_0x84d2('0x4e')])authService[_0x84d2('0x4f')](_0x18330a['body'][_0x84d2('0x10')]);if(!_0x2ee224[_0x84d2('0x4c')]||!_0x31b3f3['previousPasswords'])return _0x31b3f3;authService['validatePasswordHistory'](_0x18330a[_0x84d2('0x3b')][_0x84d2('0x10')],_0x31b3f3[_0x84d2('0x50')],_0x2ee224[_0x84d2('0x4d')]);return _0x31b3f3;})['then'](function(){_0x31b3f3[_0x84d2('0x10')]=_0x18330a['body']['password'];_0x31b3f3[_0x84d2('0x42')]=null;_0x31b3f3['resetPasswordExpires']=null;return _0x31b3f3['save']();});})['then'](function(){_0x512d86[_0x84d2('0x30')](0xc8)['send']({'message':_0x84d2('0x51')});})['catch'](function(_0x1f468d){return handleError(_0x512d86,0x1f4,_0x1f468d);});};passport[_0x84d2('0x52')]('local-login',new LocalStrategy({'usernameField':_0x84d2('0xf'),'passwordField':_0x84d2('0x10')},function(_0x445200,_0x1e3fac,_0x55fcaa){return localAuthenticate(db[_0x84d2('0x3e')],_0x445200,_0x1e3fac,_0x55fcaa);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 23788e8..82f4821 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 _0xcb56=['./authLocal.controller','login','post','forgot','/reset/:token','exports','express','Router'];(function(_0x4bf88e,_0x210215){var _0x4a5d2c=function(_0x3e3632){while(--_0x3e3632){_0x4bf88e['push'](_0x4bf88e['shift']());}};_0x4a5d2c(++_0x210215);}(_0xcb56,0x12e));var _0x6cb5=function(_0x4a22e6,_0x9e47f6){_0x4a22e6=_0x4a22e6-0x0;var _0xe45bd0=_0xcb56[_0x4a22e6];return _0xe45bd0;};'use strict';var express=require(_0x6cb5('0x0'));var router=express[_0x6cb5('0x1')]();var controller=require(_0x6cb5('0x2'));router['post']('/',controller[_0x6cb5('0x3')]);router[_0x6cb5('0x4')]('/forgot',controller[_0x6cb5('0x5')]);router['post'](_0x6cb5('0x6'),controller['reset']);module[_0x6cb5('0x7')]=router; \ No newline at end of file +var _0xe745=['exports','express','Router','./authLocal.controller','post','forgot','/reset/:token','reset'];(function(_0x1d8144,_0x1f7d36){var _0xf429d1=function(_0x12dcfd){while(--_0x12dcfd){_0x1d8144['push'](_0x1d8144['shift']());}};_0xf429d1(++_0x1f7d36);}(_0xe745,0x1a9));var _0x5e74=function(_0x452f41,_0x41e354){_0x452f41=_0x452f41-0x0;var _0x26d4eb=_0xe745[_0x452f41];return _0x26d4eb;};'use strict';var express=require(_0x5e74('0x0'));var router=express[_0x5e74('0x1')]();var controller=require(_0x5e74('0x2'));router[_0x5e74('0x3')]('/',controller['login']);router[_0x5e74('0x3')]('/forgot',controller[_0x5e74('0x4')]);router[_0x5e74('0x3')](_0x5e74('0x5'),controller[_0x5e74('0x6')]);module[_0x5e74('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 48afca9..7341d21 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 _0x7504=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x393569,_0x2aa756){var _0x427c6a=function(_0x55ef5c){while(--_0x55ef5c){_0x393569['push'](_0x393569['shift']());}};_0x427c6a(++_0x2aa756);}(_0x7504,0xf0));var _0x4750=function(_0x416667,_0x381ad4){_0x416667=_0x416667-0x0;var _0x5efe67=_0x7504[_0x416667];return _0x5efe67;};'use strict';var Sequelize=require(_0x4750('0x0'));module[_0x4750('0x1')]={'name':{'type':Sequelize[_0x4750('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4750('0x2')]},'status':{'type':Sequelize[_0x4750('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4750('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xd2b5=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd2b5,0x15e));var _0x5d2b=function(_0x283ea4,_0x192a5b){_0x283ea4=_0x283ea4-0x0;var _0x2445f2=_0xd2b5[_0x283ea4];return _0x2445f2;};'use strict';var Sequelize=require(_0x5d2b('0x0'));module[_0x5d2b('0x1')]={'name':{'type':Sequelize[_0x5d2b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5d2b('0x2')]},'description':{'type':Sequelize[_0x5d2b('0x2')]},'status':{'type':Sequelize[_0x5d2b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5d2b('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 96dd3e7..9e4583e 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 _0x400b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','show','params','keys','include','catch','create','body','find','destroy','addConditions','Condition','ids','omit','getConditions','pick','filter','addActions','Action','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x1a8457,_0x4f323c){var _0x297835=function(_0x2f4635){while(--_0x2f4635){_0x1a8457['push'](_0x1a8457['shift']());}};_0x297835(++_0x4f323c);}(_0x400b,0x99));var _0xb400=function(_0xeb2f65,_0x19d5ed){_0xeb2f65=_0xeb2f65-0x0;var _0x1f4640=_0x400b[_0xeb2f65];return _0x1f4640;};'use strict';var emlformat=require(_0xb400('0x0'));var rimraf=require(_0xb400('0x1'));var zipdir=require(_0xb400('0x2'));var jsonpatch=require(_0xb400('0x3'));var rp=require('request-promise');var moment=require(_0xb400('0x4'));var BPromise=require(_0xb400('0x5'));var Mustache=require(_0xb400('0x6'));var util=require(_0xb400('0x7'));var path=require(_0xb400('0x8'));var sox=require(_0xb400('0x9'));var csv=require(_0xb400('0xa'));var ejs=require(_0xb400('0xb'));var fs=require('fs');var fs_extra=require(_0xb400('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb400('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb400('0xe'));var toCsv=require(_0xb400('0xa'));var querystring=require(_0xb400('0xf'));var Papa=require(_0xb400('0x10'));var Redis=require(_0xb400('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb400('0x12'));var as=require(_0xb400('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb400('0x14'))(_0xb400('0x15'));var utils=require(_0xb400('0x16'));var config=require(_0xb400('0x17'));var licenseUtil=require(_0xb400('0x18'));var db=require(_0xb400('0x19'))['db'];function respondWithStatusCode(_0x15a283,_0x5d907a){_0x5d907a=_0x5d907a||0xcc;return function(_0x11d264){if(_0x11d264){return _0x15a283[_0xb400('0x1a')](_0x5d907a);}return _0x15a283[_0xb400('0x1b')](_0x5d907a)[_0xb400('0x1c')]();};}function respondWithResult(_0x59a1ce,_0x453620){_0x453620=_0x453620||0xc8;return function(_0x25efb4){if(_0x25efb4){return _0x59a1ce[_0xb400('0x1b')](_0x453620)[_0xb400('0x1d')](_0x25efb4);}};}function respondWithFilteredResult(_0x1cd26e,_0x421da4){return function(_0x5b0f6e){if(_0x5b0f6e){var _0x4ac419=typeof _0x421da4[_0xb400('0x1e')]===_0xb400('0x1f')&&typeof _0x421da4[_0xb400('0x20')]===_0xb400('0x1f');var _0x4646d8=_0x5b0f6e[_0xb400('0x21')];var _0x583c5c=_0x4ac419?0x0:_0x421da4[_0xb400('0x1e')];var _0x582475=_0x4ac419?_0x5b0f6e[_0xb400('0x21')]:_0x421da4[_0xb400('0x1e')]+_0x421da4['limit'];var _0xc18381;if(_0x582475>=_0x4646d8){_0x582475=_0x4646d8;_0xc18381=0xc8;}else{_0xc18381=0xce;}_0x1cd26e[_0xb400('0x1b')](_0xc18381);return _0x1cd26e[_0xb400('0x22')](_0xb400('0x23'),_0x583c5c+'-'+_0x582475+'/'+_0x4646d8)['json'](_0x5b0f6e);}return null;};}function patchUpdates(_0x2a00ce){return function(_0x55ca6c){try{jsonpatch[_0xb400('0x24')](_0x55ca6c,_0x2a00ce,!![]);}catch(_0xc098b9){return BPromise[_0xb400('0x25')](_0xc098b9);}return _0x55ca6c['save']();};}function saveUpdates(_0x45e9cd,_0x4246e1){return function(_0x50d3db){if(_0x50d3db){return _0x50d3db[_0xb400('0x26')](_0x45e9cd)[_0xb400('0x27')](function(_0x56984a){return _0x56984a;});}return null;};}function removeEntity(_0x39cc07,_0x5f4037){return function(_0x3c726e){if(_0x3c726e){return _0x3c726e['destroy']()[_0xb400('0x27')](function(){_0x39cc07['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4359e8,_0x3015ca){return function(_0x4555f4){if(!_0x4555f4){_0x4359e8[_0xb400('0x1a')](0x194);}return _0x4555f4;};}function handleError(_0x370ed9,_0x3e2135){_0x3e2135=_0x3e2135||0x1f4;return function(_0x5be7d0){logger[_0xb400('0x28')](_0x5be7d0[_0xb400('0x29')]);if(_0x5be7d0['name']){delete _0x5be7d0[_0xb400('0x2a')];}_0x370ed9[_0xb400('0x1b')](_0x3e2135)['send'](_0x5be7d0);};}exports[_0xb400('0x2b')]=function(_0x385285,_0x16ce53){var _0x357a21={},_0x394b62={},_0x3020bd={'count':0x0,'rows':[]};var _0x2969c9=_[_0xb400('0x2c')](db['Automation'][_0xb400('0x2d')],function(_0x21e422){return{'name':_0x21e422[_0xb400('0x2e')],'type':_0x21e422[_0xb400('0x2f')][_0xb400('0x30')]};});_0x394b62[_0xb400('0x31')]=_[_0xb400('0x2c')](_0x2969c9,_0xb400('0x2a'));_0x394b62['query']=_['keys'](_0x385285[_0xb400('0x32')]);_0x394b62['filters']=_[_0xb400('0x33')](_0x394b62['model'],_0x394b62['query']);_0x357a21[_0xb400('0x34')]=_[_0xb400('0x33')](_0x394b62['model'],qs[_0xb400('0x35')](_0x385285[_0xb400('0x32')][_0xb400('0x35')]));_0x357a21[_0xb400('0x34')]=_0x357a21[_0xb400('0x34')][_0xb400('0x36')]?_0x357a21[_0xb400('0x34')]:_0x394b62[_0xb400('0x31')];if(!_0x385285[_0xb400('0x32')][_0xb400('0x37')](_0xb400('0x38'))){_0x357a21['limit']=qs['limit'](_0x385285['query']['limit']);_0x357a21[_0xb400('0x1e')]=qs[_0xb400('0x1e')](_0x385285[_0xb400('0x32')][_0xb400('0x1e')]);}_0x357a21[_0xb400('0x39')]=qs[_0xb400('0x3a')](_0x385285[_0xb400('0x32')][_0xb400('0x3a')]);_0x357a21[_0xb400('0x3b')]=qs[_0xb400('0x3c')](_['pick'](_0x385285['query'],_0x394b62[_0xb400('0x3c')]),_0x2969c9);if(_0x385285['query']['filter']){_0x357a21['where']=_[_0xb400('0x3d')](_0x357a21[_0xb400('0x3b')],{'$or':_[_0xb400('0x2c')](_0x2969c9,function(_0x31c8e5){if(_0x31c8e5[_0xb400('0x2f')]!==_0xb400('0x3e')){var _0x59e2f0={};_0x59e2f0[_0x31c8e5['name']]={'$like':'%'+_0x385285['query']['filter']+'%'};return _0x59e2f0;}})});}_0x357a21=_[_0xb400('0x3d')]({},_0x357a21,_0x385285[_0xb400('0x3f')]);var _0x37d45b={'where':_0x357a21[_0xb400('0x3b')]};return db[_0xb400('0x40')][_0xb400('0x21')](_0x37d45b)[_0xb400('0x27')](function(_0x40bc9a){_0x3020bd[_0xb400('0x21')]=_0x40bc9a;if(_0x385285[_0xb400('0x32')][_0xb400('0x41')]){_0x357a21['include']=[{'all':!![]}];}return db[_0xb400('0x40')][_0xb400('0x42')](_0x357a21);})['then'](function(_0x40a269){_0x3020bd[_0xb400('0x43')]=_0x40a269;return _0x3020bd;})[_0xb400('0x27')](respondWithFilteredResult(_0x16ce53,_0x357a21))['catch'](handleError(_0x16ce53,null));};exports[_0xb400('0x44')]=function(_0x2670fb,_0x3be9fd){var _0x13f55f={'raw':![],'where':{'id':_0x2670fb[_0xb400('0x45')]['id']}},_0x3c6a26={};_0x3c6a26[_0xb400('0x31')]=_[_0xb400('0x46')](db[_0xb400('0x40')][_0xb400('0x2d')]);_0x3c6a26[_0xb400('0x32')]=_['keys'](_0x2670fb[_0xb400('0x32')]);_0x3c6a26['filters']=_[_0xb400('0x33')](_0x3c6a26[_0xb400('0x31')],_0x3c6a26['query']);_0x13f55f[_0xb400('0x34')]=_['intersection'](_0x3c6a26[_0xb400('0x31')],qs[_0xb400('0x35')](_0x2670fb[_0xb400('0x32')][_0xb400('0x35')]));_0x13f55f[_0xb400('0x34')]=_0x13f55f['attributes'][_0xb400('0x36')]?_0x13f55f[_0xb400('0x34')]:_0x3c6a26[_0xb400('0x31')];if(_0x2670fb[_0xb400('0x32')][_0xb400('0x41')]){_0x13f55f[_0xb400('0x47')]=[{'all':!![]}];}_0x13f55f=_[_0xb400('0x3d')]({},_0x13f55f,_0x2670fb['options']);return db[_0xb400('0x40')]['find'](_0x13f55f)['then'](handleEntityNotFound(_0x3be9fd,null))[_0xb400('0x27')](respondWithResult(_0x3be9fd,null))[_0xb400('0x48')](handleError(_0x3be9fd,null));};exports[_0xb400('0x49')]=function(_0x50624e,_0x594196){return db[_0xb400('0x40')]['create'](_0x50624e[_0xb400('0x4a')],{})['then'](respondWithResult(_0x594196,0xc9))[_0xb400('0x48')](handleError(_0x594196,null));};exports[_0xb400('0x26')]=function(_0x234632,_0x2eb11f){if(_0x234632[_0xb400('0x4a')]['id']){delete _0x234632['body']['id'];}return db[_0xb400('0x40')][_0xb400('0x4b')]({'where':{'id':_0x234632[_0xb400('0x45')]['id']}})[_0xb400('0x27')](handleEntityNotFound(_0x2eb11f,null))[_0xb400('0x27')](saveUpdates(_0x234632[_0xb400('0x4a')],null))[_0xb400('0x27')](respondWithResult(_0x2eb11f,null))[_0xb400('0x48')](handleError(_0x2eb11f,null));};exports[_0xb400('0x4c')]=function(_0x5b7570,_0xfea00d){return db[_0xb400('0x40')][_0xb400('0x4b')]({'where':{'id':_0x5b7570['params']['id']}})['then'](handleEntityNotFound(_0xfea00d,null))[_0xb400('0x27')](removeEntity(_0xfea00d,null))['catch'](handleError(_0xfea00d,null));};exports[_0xb400('0x4d')]=function(_0x2e0efe,_0x5c226a,_0x5cccff){return db[_0xb400('0x4e')][_0xb400('0x4b')]({'where':{'id':_0x2e0efe[_0xb400('0x45')]['id']}})[_0xb400('0x27')](handleEntityNotFound(_0x5c226a,null))[_0xb400('0x27')](function(_0x399d93){if(_0x399d93){return _0x399d93['addConditions'](_0x2e0efe[_0xb400('0x4a')][_0xb400('0x4f')],_[_0xb400('0x50')](_0x2e0efe['body'],['ids','id'])||{});}})[_0xb400('0x27')](respondWithResult(_0x5c226a,null))[_0xb400('0x48')](handleError(_0x5c226a,null));};exports[_0xb400('0x51')]=function(_0x147b31,_0x31881c,_0x274219){var _0x47548a={};var _0xf23c={};var _0x4b7f16;var _0x47c8d5;return db[_0xb400('0x40')]['findOne']({'where':{'id':_0x147b31[_0xb400('0x45')]['id']}})[_0xb400('0x27')](handleEntityNotFound(_0x31881c,null))['then'](function(_0x49f807){if(_0x49f807){_0x4b7f16=_0x49f807;_0xf23c[_0xb400('0x31')]=_[_0xb400('0x46')](db[_0xb400('0x4e')][_0xb400('0x2d')]);_0xf23c[_0xb400('0x32')]=_['keys'](_0x147b31['query']);_0xf23c['filters']=_[_0xb400('0x33')](_0xf23c[_0xb400('0x31')],_0xf23c[_0xb400('0x32')]);_0x47548a[_0xb400('0x34')]=_['intersection'](_0xf23c[_0xb400('0x31')],qs[_0xb400('0x35')](_0x147b31[_0xb400('0x32')]['fields']));_0x47548a[_0xb400('0x34')]=_0x47548a[_0xb400('0x34')][_0xb400('0x36')]?_0x47548a[_0xb400('0x34')]:_0xf23c[_0xb400('0x31')];_0x47548a[_0xb400('0x39')]=qs[_0xb400('0x3a')](_0x147b31['query'][_0xb400('0x3a')]);_0x47548a[_0xb400('0x3b')]=qs[_0xb400('0x3c')](_[_0xb400('0x52')](_0x147b31[_0xb400('0x32')],_0xf23c['filters']));if(_0x147b31[_0xb400('0x32')][_0xb400('0x53')]){_0x47548a[_0xb400('0x3b')]=_[_0xb400('0x3d')](_0x47548a[_0xb400('0x3b')],{'$or':_[_0xb400('0x2c')](_0x47548a['attributes'],function(_0x242e41){var _0x319b23={};_0x319b23[_0x242e41]={'$like':'%'+_0x147b31[_0xb400('0x32')][_0xb400('0x53')]+'%'};return _0x319b23;})});}_0x47548a=_[_0xb400('0x3d')]({},_0x47548a,_0x147b31['options']);return _0x4b7f16[_0xb400('0x51')](_0x47548a);}})['then'](function(_0xa25470){if(_0xa25470){_0x47c8d5=_0xa25470[_0xb400('0x36')];if(!_0x147b31[_0xb400('0x32')][_0xb400('0x37')](_0xb400('0x38'))){_0x47548a[_0xb400('0x20')]=qs[_0xb400('0x20')](_0x147b31[_0xb400('0x32')]['limit']);_0x47548a[_0xb400('0x1e')]=qs[_0xb400('0x1e')](_0x147b31[_0xb400('0x32')][_0xb400('0x1e')]);}return _0x4b7f16[_0xb400('0x51')](_0x47548a);}})[_0xb400('0x27')](function(_0x5d3179){if(_0x5d3179){return _0x5d3179?{'count':_0x47c8d5,'rows':_0x5d3179}:null;}})['then'](respondWithResult(_0x31881c,null))[_0xb400('0x48')](handleError(_0x31881c,null));};exports[_0xb400('0x54')]=function(_0x1f788a,_0x3e8085,_0x17fd1f){return db[_0xb400('0x55')][_0xb400('0x4b')]({'where':{'id':_0x1f788a[_0xb400('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8085,null))[_0xb400('0x27')](function(_0x211d41){if(_0x211d41){return _0x211d41['addActions'](_0x1f788a['body'][_0xb400('0x4f')],_['omit'](_0x1f788a[_0xb400('0x4a')],[_0xb400('0x4f'),'id'])||{});}})[_0xb400('0x27')](respondWithResult(_0x3e8085,null))[_0xb400('0x48')](handleError(_0x3e8085,null));};exports[_0xb400('0x56')]=function(_0x254486,_0x39221f,_0x3f1ec9){var _0x53381a={};var _0xac771d={};var _0x3ff159;var _0x37ad30;return db[_0xb400('0x40')][_0xb400('0x57')]({'where':{'id':_0x254486[_0xb400('0x45')]['id']}})[_0xb400('0x27')](handleEntityNotFound(_0x39221f,null))['then'](function(_0x1e35c4){if(_0x1e35c4){_0x3ff159=_0x1e35c4;_0xac771d['model']=_['keys'](db[_0xb400('0x55')][_0xb400('0x2d')]);_0xac771d[_0xb400('0x32')]=_[_0xb400('0x46')](_0x254486['query']);_0xac771d[_0xb400('0x3c')]=_[_0xb400('0x33')](_0xac771d[_0xb400('0x31')],_0xac771d['query']);_0x53381a[_0xb400('0x34')]=_['intersection'](_0xac771d['model'],qs['fields'](_0x254486['query'][_0xb400('0x35')]));_0x53381a['attributes']=_0x53381a[_0xb400('0x34')][_0xb400('0x36')]?_0x53381a['attributes']:_0xac771d[_0xb400('0x31')];_0x53381a[_0xb400('0x39')]=qs[_0xb400('0x3a')](_0x254486[_0xb400('0x32')][_0xb400('0x3a')]);_0x53381a[_0xb400('0x3b')]=qs['filters'](_['pick'](_0x254486[_0xb400('0x32')],_0xac771d[_0xb400('0x3c')]));if(_0x254486[_0xb400('0x32')][_0xb400('0x53')]){_0x53381a['where']=_[_0xb400('0x3d')](_0x53381a['where'],{'$or':_['map'](_0x53381a[_0xb400('0x34')],function(_0x480b39){var _0x23dde1={};_0x23dde1[_0x480b39]={'$like':'%'+_0x254486[_0xb400('0x32')]['filter']+'%'};return _0x23dde1;})});}_0x53381a=_['merge']({},_0x53381a,_0x254486['options']);return _0x3ff159['getActions'](_0x53381a);}})['then'](function(_0x12511e){if(_0x12511e){_0x37ad30=_0x12511e['length'];if(!_0x254486['query'][_0xb400('0x37')](_0xb400('0x38'))){_0x53381a[_0xb400('0x20')]=qs[_0xb400('0x20')](_0x254486['query']['limit']);_0x53381a['offset']=qs[_0xb400('0x1e')](_0x254486[_0xb400('0x32')][_0xb400('0x1e')]);}return _0x3ff159[_0xb400('0x56')](_0x53381a);}})[_0xb400('0x27')](function(_0x3a52ad){if(_0x3a52ad){return _0x3a52ad?{'count':_0x37ad30,'rows':_0x3a52ad}:null;}})[_0xb400('0x27')](respondWithResult(_0x39221f,null))[_0xb400('0x48')](handleError(_0x39221f,null));}; \ No newline at end of file +var _0x7e46=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','Action','omit','getActions','hasOwnProperty','eml-format','zip-dir','request-promise','moment','path','lodash','crypto','desk.js','papaparse'];(function(_0x2b618f,_0x4d3ab0){var _0x16ff8d=function(_0x17132e){while(--_0x17132e){_0x2b618f['push'](_0x2b618f['shift']());}};_0x16ff8d(++_0x4d3ab0);}(_0x7e46,0x8b));var _0x67e4=function(_0x1da7b4,_0x5ca0c0){_0x1da7b4=_0x1da7b4-0x0;var _0x50ebba=_0x7e46[_0x1da7b4];return _0x50ebba;};'use strict';var emlformat=require(_0x67e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67e4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x67e4('0x2'));var moment=require(_0x67e4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x67e4('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67e4('0x5'));var squel=require('squel');var crypto=require(_0x67e4('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x67e4('0x7'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x67e4('0x8'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x67e4('0x9'));var as=require(_0x67e4('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67e4('0xb'))(_0x67e4('0xc'));var utils=require(_0x67e4('0xd'));var config=require('../../config/environment');var licenseUtil=require(_0x67e4('0xe'));var db=require(_0x67e4('0xf'))['db'];function respondWithStatusCode(_0x67d2b0,_0x75a1b1){_0x75a1b1=_0x75a1b1||0xcc;return function(_0x243ede){if(_0x243ede){return _0x67d2b0[_0x67e4('0x10')](_0x75a1b1);}return _0x67d2b0[_0x67e4('0x11')](_0x75a1b1)[_0x67e4('0x12')]();};}function respondWithResult(_0x2d5aab,_0x3e4485){_0x3e4485=_0x3e4485||0xc8;return function(_0x248d2e){if(_0x248d2e){return _0x2d5aab[_0x67e4('0x11')](_0x3e4485)[_0x67e4('0x13')](_0x248d2e);}};}function respondWithFilteredResult(_0x53842b,_0x4a7daa){return function(_0x15376c){if(_0x15376c){var _0x15b61b=typeof _0x4a7daa[_0x67e4('0x14')]===_0x67e4('0x15')&&typeof _0x4a7daa[_0x67e4('0x16')]==='undefined';var _0x41f25d=_0x15376c['count'];var _0x489412=_0x15b61b?0x0:_0x4a7daa[_0x67e4('0x14')];var _0x332ce9=_0x15b61b?_0x15376c[_0x67e4('0x17')]:_0x4a7daa['offset']+_0x4a7daa[_0x67e4('0x16')];var _0x4da432;if(_0x332ce9>=_0x41f25d){_0x332ce9=_0x41f25d;_0x4da432=0xc8;}else{_0x4da432=0xce;}_0x53842b['status'](_0x4da432);return _0x53842b[_0x67e4('0x18')]('Content-Range',_0x489412+'-'+_0x332ce9+'/'+_0x41f25d)[_0x67e4('0x13')](_0x15376c);}return null;};}function patchUpdates(_0x2bc67d){return function(_0x1e2e6d){try{jsonpatch[_0x67e4('0x19')](_0x1e2e6d,_0x2bc67d,!![]);}catch(_0x41829c){return BPromise[_0x67e4('0x1a')](_0x41829c);}return _0x1e2e6d[_0x67e4('0x1b')]();};}function saveUpdates(_0x13e05f,_0x15263f){return function(_0x241ddf){if(_0x241ddf){return _0x241ddf[_0x67e4('0x1c')](_0x13e05f)['then'](function(_0x280633){return _0x280633;});}return null;};}function removeEntity(_0x55d6ec,_0x1829c6){return function(_0x2b075f){if(_0x2b075f){return _0x2b075f['destroy']()[_0x67e4('0x1d')](function(){_0x55d6ec[_0x67e4('0x11')](0xcc)[_0x67e4('0x12')]();});}};}function handleEntityNotFound(_0x55d061,_0xff1f18){return function(_0x121e4b){if(!_0x121e4b){_0x55d061['sendStatus'](0x194);}return _0x121e4b;};}function handleError(_0x2e1ac9,_0x4e44e7){_0x4e44e7=_0x4e44e7||0x1f4;return function(_0x5191dc){logger['error'](_0x5191dc[_0x67e4('0x1e')]);if(_0x5191dc[_0x67e4('0x1f')]){delete _0x5191dc[_0x67e4('0x1f')];}_0x2e1ac9[_0x67e4('0x11')](_0x4e44e7)[_0x67e4('0x20')](_0x5191dc);};}exports['index']=function(_0x523b1b,_0x20dfba){var _0x540568={},_0x15de95={},_0x16fcf1={'count':0x0,'rows':[]};var _0x4bd153=_[_0x67e4('0x21')](db[_0x67e4('0x22')][_0x67e4('0x23')],function(_0x4d5719){return{'name':_0x4d5719[_0x67e4('0x24')],'type':_0x4d5719[_0x67e4('0x25')][_0x67e4('0x26')]};});_0x15de95[_0x67e4('0x27')]=_[_0x67e4('0x21')](_0x4bd153,_0x67e4('0x1f'));_0x15de95[_0x67e4('0x28')]=_['keys'](_0x523b1b[_0x67e4('0x28')]);_0x15de95[_0x67e4('0x29')]=_[_0x67e4('0x2a')](_0x15de95[_0x67e4('0x27')],_0x15de95[_0x67e4('0x28')]);_0x540568[_0x67e4('0x2b')]=_['intersection'](_0x15de95['model'],qs[_0x67e4('0x2c')](_0x523b1b['query'][_0x67e4('0x2c')]));_0x540568[_0x67e4('0x2b')]=_0x540568['attributes'][_0x67e4('0x2d')]?_0x540568[_0x67e4('0x2b')]:_0x15de95[_0x67e4('0x27')];if(!_0x523b1b[_0x67e4('0x28')]['hasOwnProperty'](_0x67e4('0x2e'))){_0x540568['limit']=qs[_0x67e4('0x16')](_0x523b1b[_0x67e4('0x28')]['limit']);_0x540568['offset']=qs['offset'](_0x523b1b[_0x67e4('0x28')][_0x67e4('0x14')]);}_0x540568[_0x67e4('0x2f')]=qs[_0x67e4('0x30')](_0x523b1b[_0x67e4('0x28')][_0x67e4('0x30')]);_0x540568['where']=qs[_0x67e4('0x29')](_[_0x67e4('0x31')](_0x523b1b[_0x67e4('0x28')],_0x15de95['filters']),_0x4bd153);if(_0x523b1b['query'][_0x67e4('0x32')]){_0x540568[_0x67e4('0x33')]=_[_0x67e4('0x34')](_0x540568[_0x67e4('0x33')],{'$or':_[_0x67e4('0x21')](_0x4bd153,function(_0x53d680){if(_0x53d680[_0x67e4('0x25')]!=='VIRTUAL'){var _0x4215f8={};_0x4215f8[_0x53d680[_0x67e4('0x1f')]]={'$like':'%'+_0x523b1b[_0x67e4('0x28')][_0x67e4('0x32')]+'%'};return _0x4215f8;}})});}_0x540568=_[_0x67e4('0x34')]({},_0x540568,_0x523b1b[_0x67e4('0x35')]);var _0x22f634={'where':_0x540568['where']};return db[_0x67e4('0x22')][_0x67e4('0x17')](_0x22f634)[_0x67e4('0x1d')](function(_0x17e7a0){_0x16fcf1[_0x67e4('0x17')]=_0x17e7a0;if(_0x523b1b[_0x67e4('0x28')][_0x67e4('0x36')]){_0x540568[_0x67e4('0x37')]=[{'all':!![]}];}return db[_0x67e4('0x22')][_0x67e4('0x38')](_0x540568);})['then'](function(_0x4c429f){_0x16fcf1['rows']=_0x4c429f;return _0x16fcf1;})[_0x67e4('0x1d')](respondWithFilteredResult(_0x20dfba,_0x540568))[_0x67e4('0x39')](handleError(_0x20dfba,null));};exports[_0x67e4('0x3a')]=function(_0x53eef9,_0x1af116){var _0x17cc9a={'raw':![],'where':{'id':_0x53eef9[_0x67e4('0x3b')]['id']}},_0x36f82f={};_0x36f82f['model']=_['keys'](db[_0x67e4('0x22')][_0x67e4('0x23')]);_0x36f82f[_0x67e4('0x28')]=_[_0x67e4('0x3c')](_0x53eef9[_0x67e4('0x28')]);_0x36f82f['filters']=_[_0x67e4('0x2a')](_0x36f82f[_0x67e4('0x27')],_0x36f82f[_0x67e4('0x28')]);_0x17cc9a[_0x67e4('0x2b')]=_[_0x67e4('0x2a')](_0x36f82f[_0x67e4('0x27')],qs[_0x67e4('0x2c')](_0x53eef9[_0x67e4('0x28')][_0x67e4('0x2c')]));_0x17cc9a['attributes']=_0x17cc9a[_0x67e4('0x2b')][_0x67e4('0x2d')]?_0x17cc9a[_0x67e4('0x2b')]:_0x36f82f[_0x67e4('0x27')];if(_0x53eef9[_0x67e4('0x28')][_0x67e4('0x36')]){_0x17cc9a['include']=[{'all':!![]}];}_0x17cc9a=_[_0x67e4('0x34')]({},_0x17cc9a,_0x53eef9[_0x67e4('0x35')]);return db[_0x67e4('0x22')][_0x67e4('0x3d')](_0x17cc9a)[_0x67e4('0x1d')](handleEntityNotFound(_0x1af116,null))['then'](respondWithResult(_0x1af116,null))[_0x67e4('0x39')](handleError(_0x1af116,null));};exports[_0x67e4('0x3e')]=function(_0x432796,_0x10254a){return db[_0x67e4('0x22')]['create'](_0x432796[_0x67e4('0x3f')],{})['then'](respondWithResult(_0x10254a,0xc9))[_0x67e4('0x39')](handleError(_0x10254a,null));};exports[_0x67e4('0x1c')]=function(_0x368705,_0x184104){if(_0x368705[_0x67e4('0x3f')]['id']){delete _0x368705[_0x67e4('0x3f')]['id'];}return db[_0x67e4('0x22')][_0x67e4('0x3d')]({'where':{'id':_0x368705[_0x67e4('0x3b')]['id']}})[_0x67e4('0x1d')](handleEntityNotFound(_0x184104,null))[_0x67e4('0x1d')](saveUpdates(_0x368705[_0x67e4('0x3f')],null))[_0x67e4('0x1d')](respondWithResult(_0x184104,null))['catch'](handleError(_0x184104,null));};exports['destroy']=function(_0x1bd79b,_0x4be7ff){return db[_0x67e4('0x22')][_0x67e4('0x3d')]({'where':{'id':_0x1bd79b[_0x67e4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4be7ff,null))[_0x67e4('0x1d')](removeEntity(_0x4be7ff,null))[_0x67e4('0x39')](handleError(_0x4be7ff,null));};exports[_0x67e4('0x40')]=function(_0x23bbfa,_0x590e84,_0x38d384){return db[_0x67e4('0x41')]['find']({'where':{'id':_0x23bbfa[_0x67e4('0x3b')]['id']}})[_0x67e4('0x1d')](handleEntityNotFound(_0x590e84,null))[_0x67e4('0x1d')](function(_0x2989bd){if(_0x2989bd){return _0x2989bd[_0x67e4('0x40')](_0x23bbfa[_0x67e4('0x3f')]['ids'],_['omit'](_0x23bbfa['body'],[_0x67e4('0x42'),'id'])||{});}})[_0x67e4('0x1d')](respondWithResult(_0x590e84,null))[_0x67e4('0x39')](handleError(_0x590e84,null));};exports[_0x67e4('0x43')]=function(_0x4d7357,_0x264755,_0x586922){var _0x4346f3={};var _0x34f906={};var _0xc32490;var _0x5e74e0;return db[_0x67e4('0x22')][_0x67e4('0x44')]({'where':{'id':_0x4d7357[_0x67e4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x264755,null))[_0x67e4('0x1d')](function(_0x59314e){if(_0x59314e){_0xc32490=_0x59314e;_0x34f906[_0x67e4('0x27')]=_[_0x67e4('0x3c')](db[_0x67e4('0x41')][_0x67e4('0x23')]);_0x34f906['query']=_[_0x67e4('0x3c')](_0x4d7357[_0x67e4('0x28')]);_0x34f906[_0x67e4('0x29')]=_['intersection'](_0x34f906[_0x67e4('0x27')],_0x34f906[_0x67e4('0x28')]);_0x4346f3[_0x67e4('0x2b')]=_['intersection'](_0x34f906[_0x67e4('0x27')],qs[_0x67e4('0x2c')](_0x4d7357['query']['fields']));_0x4346f3[_0x67e4('0x2b')]=_0x4346f3[_0x67e4('0x2b')][_0x67e4('0x2d')]?_0x4346f3['attributes']:_0x34f906[_0x67e4('0x27')];_0x4346f3[_0x67e4('0x2f')]=qs[_0x67e4('0x30')](_0x4d7357['query'][_0x67e4('0x30')]);_0x4346f3[_0x67e4('0x33')]=qs['filters'](_[_0x67e4('0x31')](_0x4d7357[_0x67e4('0x28')],_0x34f906['filters']));if(_0x4d7357[_0x67e4('0x28')]['filter']){_0x4346f3['where']=_[_0x67e4('0x34')](_0x4346f3[_0x67e4('0x33')],{'$or':_[_0x67e4('0x21')](_0x4346f3[_0x67e4('0x2b')],function(_0x404c99){var _0x2e5936={};_0x2e5936[_0x404c99]={'$like':'%'+_0x4d7357[_0x67e4('0x28')][_0x67e4('0x32')]+'%'};return _0x2e5936;})});}_0x4346f3=_['merge']({},_0x4346f3,_0x4d7357[_0x67e4('0x35')]);return _0xc32490['getConditions'](_0x4346f3);}})['then'](function(_0x5864c5){if(_0x5864c5){_0x5e74e0=_0x5864c5['length'];if(!_0x4d7357[_0x67e4('0x28')]['hasOwnProperty'](_0x67e4('0x2e'))){_0x4346f3[_0x67e4('0x16')]=qs[_0x67e4('0x16')](_0x4d7357[_0x67e4('0x28')][_0x67e4('0x16')]);_0x4346f3[_0x67e4('0x14')]=qs[_0x67e4('0x14')](_0x4d7357['query'][_0x67e4('0x14')]);}return _0xc32490[_0x67e4('0x43')](_0x4346f3);}})[_0x67e4('0x1d')](function(_0x260b12){if(_0x260b12){return _0x260b12?{'count':_0x5e74e0,'rows':_0x260b12}:null;}})[_0x67e4('0x1d')](respondWithResult(_0x264755,null))[_0x67e4('0x39')](handleError(_0x264755,null));};exports[_0x67e4('0x45')]=function(_0x3eab9e,_0x28c99d,_0x46927c){return db[_0x67e4('0x46')][_0x67e4('0x3d')]({'where':{'id':_0x3eab9e[_0x67e4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x28c99d,null))[_0x67e4('0x1d')](function(_0x29539a){if(_0x29539a){return _0x29539a[_0x67e4('0x45')](_0x3eab9e[_0x67e4('0x3f')]['ids'],_[_0x67e4('0x47')](_0x3eab9e[_0x67e4('0x3f')],['ids','id'])||{});}})[_0x67e4('0x1d')](respondWithResult(_0x28c99d,null))[_0x67e4('0x39')](handleError(_0x28c99d,null));};exports[_0x67e4('0x48')]=function(_0x367df5,_0x13e53e,_0x5dd41a){var _0x54b6dc={};var _0xc9e3dc={};var _0x16fa63;var _0x1d5533;return db[_0x67e4('0x22')][_0x67e4('0x44')]({'where':{'id':_0x367df5[_0x67e4('0x3b')]['id']}})[_0x67e4('0x1d')](handleEntityNotFound(_0x13e53e,null))['then'](function(_0x26fdf6){if(_0x26fdf6){_0x16fa63=_0x26fdf6;_0xc9e3dc['model']=_[_0x67e4('0x3c')](db[_0x67e4('0x46')][_0x67e4('0x23')]);_0xc9e3dc['query']=_['keys'](_0x367df5[_0x67e4('0x28')]);_0xc9e3dc['filters']=_[_0x67e4('0x2a')](_0xc9e3dc[_0x67e4('0x27')],_0xc9e3dc[_0x67e4('0x28')]);_0x54b6dc[_0x67e4('0x2b')]=_[_0x67e4('0x2a')](_0xc9e3dc[_0x67e4('0x27')],qs[_0x67e4('0x2c')](_0x367df5[_0x67e4('0x28')][_0x67e4('0x2c')]));_0x54b6dc[_0x67e4('0x2b')]=_0x54b6dc[_0x67e4('0x2b')][_0x67e4('0x2d')]?_0x54b6dc[_0x67e4('0x2b')]:_0xc9e3dc['model'];_0x54b6dc[_0x67e4('0x2f')]=qs['sort'](_0x367df5[_0x67e4('0x28')][_0x67e4('0x30')]);_0x54b6dc[_0x67e4('0x33')]=qs[_0x67e4('0x29')](_[_0x67e4('0x31')](_0x367df5[_0x67e4('0x28')],_0xc9e3dc[_0x67e4('0x29')]));if(_0x367df5[_0x67e4('0x28')][_0x67e4('0x32')]){_0x54b6dc['where']=_[_0x67e4('0x34')](_0x54b6dc['where'],{'$or':_['map'](_0x54b6dc[_0x67e4('0x2b')],function(_0x3bc5ac){var _0x4eaad9={};_0x4eaad9[_0x3bc5ac]={'$like':'%'+_0x367df5[_0x67e4('0x28')][_0x67e4('0x32')]+'%'};return _0x4eaad9;})});}_0x54b6dc=_[_0x67e4('0x34')]({},_0x54b6dc,_0x367df5['options']);return _0x16fa63[_0x67e4('0x48')](_0x54b6dc);}})['then'](function(_0x3ab210){if(_0x3ab210){_0x1d5533=_0x3ab210['length'];if(!_0x367df5[_0x67e4('0x28')][_0x67e4('0x49')](_0x67e4('0x2e'))){_0x54b6dc[_0x67e4('0x16')]=qs[_0x67e4('0x16')](_0x367df5[_0x67e4('0x28')][_0x67e4('0x16')]);_0x54b6dc[_0x67e4('0x14')]=qs['offset'](_0x367df5[_0x67e4('0x28')][_0x67e4('0x14')]);}return _0x16fa63[_0x67e4('0x48')](_0x54b6dc);}})[_0x67e4('0x1d')](function(_0x361816){if(_0x361816){return _0x361816?{'count':_0x1d5533,'rows':_0x361816}:null;}})[_0x67e4('0x1d')](respondWithResult(_0x13e53e,null))[_0x67e4('0x39')](handleError(_0x13e53e,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ac4a7cf..55601e1 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 _0x2bb1=['../../config/environment','./automation.attributes','exports','define','Automation','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0x2bb1,0x10d));var _0x12bb=function(_0x4a9633,_0x1fed33){_0x4a9633=_0x4a9633-0x0;var _0x1f440d=_0x2bb1[_0x4a9633];return _0x1f440d;};'use strict';var _=require(_0x12bb('0x0'));var util=require('util');var logger=require(_0x12bb('0x1'))(_0x12bb('0x2'));var moment=require('moment');var BPromise=require(_0x12bb('0x3'));var rp=require(_0x12bb('0x4'));var fs=require('fs');var path=require(_0x12bb('0x5'));var rimraf=require(_0x12bb('0x6'));var config=require(_0x12bb('0x7'));var attributes=require(_0x12bb('0x8'));module[_0x12bb('0x9')]=function(_0x13b66e,_0x28b184){return _0x13b66e[_0x12bb('0xa')](_0x12bb('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3187=['rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash','util','../../config/logger','request-promise','path'];(function(_0x165315,_0x127274){var _0x2af5b4=function(_0x167198){while(--_0x167198){_0x165315['push'](_0x165315['shift']());}};_0x2af5b4(++_0x127274);}(_0x3187,0x193));var _0x7318=function(_0x10bbd9,_0x343536){_0x10bbd9=_0x10bbd9-0x0;var _0x58249c=_0x3187[_0x10bbd9];return _0x58249c;};'use strict';var _=require(_0x7318('0x0'));var util=require(_0x7318('0x1'));var logger=require(_0x7318('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7318('0x3'));var fs=require('fs');var path=require(_0x7318('0x4'));var rimraf=require(_0x7318('0x5'));var config=require(_0x7318('0x6'));var attributes=require(_0x7318('0x7'));module[_0x7318('0x8')]=function(_0xc489c7,_0x30648b){return _0xc489c7[_0x7318('0x9')](_0x7318('0xa'),attributes,{'tableName':_0x7318('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 7cb65c3..cb79c2e 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 _0x6a55=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','randomstring','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x6a55,0xdb));var _0x56a5=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0x6a55[_0x1c6efd];return _0x53a918;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56a5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56a5('0x2'));var logger=require('../../config/logger')(_0x56a5('0x3'));var config=require('../../config/environment');var jayson=require(_0x56a5('0x4'));var client=jayson[_0x56a5('0x5')][_0x56a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x293ea1,_0x444c65,_0x2272d9){return new BPromise(function(_0x2b8f57,_0x387dcb){return client['request'](_0x293ea1,_0x2272d9)[_0x56a5('0x7')](function(_0xf15490){logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,_0x56a5('0xa'));logger[_0x56a5('0xb')](_0x56a5('0xc'),_0x444c65,_0x56a5('0xa'),JSON[_0x56a5('0xd')](_0xf15490));if(_0xf15490['error']){if(_0xf15490['error'][_0x56a5('0xe')]===0x1f4){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x387dcb(_0xf15490[_0x56a5('0xf')]['message']);}logger['error'](_0x56a5('0x9'),_0x444c65,_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);return _0x2b8f57(_0xf15490[_0x56a5('0xf')][_0x56a5('0x10')]);}else{logger[_0x56a5('0x8')](_0x56a5('0x9'),_0x444c65,'request\x20sent');_0x2b8f57(_0xf15490[_0x56a5('0x11')]['message']);}})[_0x56a5('0x12')](function(_0x51d031){logger[_0x56a5('0xf')](_0x56a5('0x9'),_0x444c65,_0x51d031);_0x387dcb(_0x51d031);});});} \ No newline at end of file +var _0xbe9d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b0972,_0x99e71a){var _0x15b9ab=function(_0x390fed){while(--_0x390fed){_0x2b0972['push'](_0x2b0972['shift']());}};_0x15b9ab(++_0x99e71a);}(_0xbe9d,0x99));var _0xdbe9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbe9d[_0x126558];return _0x1f6d14;};'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(_0xdbe9('0x5'));var db=require(_0xdbe9('0x6'))['db'];var utils=require(_0xdbe9('0x7'));var logger=require(_0xdbe9('0x8'))(_0xdbe9('0x9'));var config=require(_0xdbe9('0xa'));var jayson=require(_0xdbe9('0xb'));var client=jayson[_0xdbe9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e9be,_0x3d5165,_0x1139e8){return new BPromise(function(_0x5a9989,_0x58093b){return client[_0xdbe9('0xd')](_0x56e9be,_0x1139e8)[_0xdbe9('0xe')](function(_0x56470c){logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));logger[_0xdbe9('0x11')](_0xdbe9('0x12'),_0x3d5165,'request\x20sent',JSON[_0xdbe9('0x13')](_0x56470c));if(_0x56470c[_0xdbe9('0x14')]){if(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x15')]===0x1f4){logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c['error'][_0xdbe9('0x16')]);return _0x58093b(_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);}logger['error'](_0xdbe9('0xf'),_0x3d5165,_0x56470c[_0xdbe9('0x14')][_0xdbe9('0x16')]);return _0x5a9989(_0x56470c['error'][_0xdbe9('0x16')]);}else{logger['info'](_0xdbe9('0xf'),_0x3d5165,_0xdbe9('0x10'));_0x5a9989(_0x56470c[_0xdbe9('0x17')]['message']);}})[_0xdbe9('0x18')](function(_0xfc065e){logger[_0xdbe9('0x14')]('Automation,\x20%s,\x20%s',_0x3d5165,_0xfc065e);_0x58093b(_0xfc065e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f89f0a4..4b504d2 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 _0xa400=['/:id','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x3099dd,_0x53607b){var _0x272f8a=function(_0x33fa8c){while(--_0x33fa8c){_0x3099dd['push'](_0x3099dd['shift']());}};_0x272f8a(++_0x53607b);}(_0xa400,0xc1));var _0x0a40=function(_0x2d4f1f,_0x4f62c9){_0x2d4f1f=_0x2d4f1f-0x0;var _0xc1b16c=_0xa400[_0x2d4f1f];return _0xc1b16c;};'use strict';var multer=require(_0x0a40('0x0'));var util=require(_0x0a40('0x1'));var path=require(_0x0a40('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0a40('0x3'));var auth=require(_0x0a40('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0a40('0x5'));var controller=require('./automation.controller');router[_0x0a40('0x6')]('/',auth[_0x0a40('0x7')](),controller[_0x0a40('0x8')]);router[_0x0a40('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0a40('0x6')](_0x0a40('0x9'),auth[_0x0a40('0x7')](),controller[_0x0a40('0xa')]);router[_0x0a40('0x6')](_0x0a40('0xb'),auth[_0x0a40('0x7')](),controller[_0x0a40('0xc')]);router[_0x0a40('0xd')]('/',auth[_0x0a40('0x7')](),controller[_0x0a40('0xe')]);router[_0x0a40('0xd')](_0x0a40('0x9'),auth[_0x0a40('0x7')](),controller[_0x0a40('0xf')]);router[_0x0a40('0xd')](_0x0a40('0xb'),auth['isAuthenticated'](),controller['addActions']);router['put'](_0x0a40('0x10'),auth[_0x0a40('0x7')](),controller['update']);router[_0x0a40('0x11')]('/:id',auth[_0x0a40('0x7')](),controller[_0x0a40('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8c99=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x8c99,0x1a8));var _0x98c9=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0x8c99[_0x9b2bb0];return _0x2cdb3b;};'use strict';var multer=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var path=require(_0x98c9('0x2'));var timeout=require(_0x98c9('0x3'));var express=require(_0x98c9('0x4'));var router=express[_0x98c9('0x5')]();var fs_extra=require(_0x98c9('0x6'));var auth=require(_0x98c9('0x7'));var interaction=require(_0x98c9('0x8'));var config=require(_0x98c9('0x9'));var controller=require(_0x98c9('0xa'));router[_0x98c9('0xb')]('/',auth['isAuthenticated'](),controller[_0x98c9('0xc')]);router[_0x98c9('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x98c9('0xb')](_0x98c9('0xd'),auth[_0x98c9('0xe')](),controller[_0x98c9('0xf')]);router[_0x98c9('0xb')](_0x98c9('0x10'),auth[_0x98c9('0xe')](),controller[_0x98c9('0x11')]);router[_0x98c9('0x12')]('/',auth[_0x98c9('0xe')](),controller[_0x98c9('0x13')]);router['post'](_0x98c9('0xd'),auth[_0x98c9('0xe')](),controller[_0x98c9('0x14')]);router[_0x98c9('0x12')]('/:id/actions',auth[_0x98c9('0xe')](),controller[_0x98c9('0x15')]);router[_0x98c9('0x16')](_0x98c9('0x17'),auth[_0x98c9('0xe')](),controller['update']);router[_0x98c9('0x18')](_0x98c9('0x17'),auth[_0x98c9('0xe')](),controller[_0x98c9('0x19')]);module[_0x98c9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index cb91ba3..dd0ae3e 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 _0x5c21=['exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','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)'];(function(_0x31b751,_0x552a36){var _0x21c941=function(_0x50d54e){while(--_0x50d54e){_0x31b751['push'](_0x31b751['shift']());}};_0x21c941(++_0x552a36);}(_0x5c21,0x90));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x15c2('0x0')]={'name':{'type':Sequelize[_0x15c2('0x1')],'unique':_0x15c2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x15c2('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x15c2('0x4')},'description':{'type':Sequelize[_0x15c2('0x1')]},'active':{'type':Sequelize[_0x15c2('0x5')],'defaultValue':0x0,'comment':_0x15c2('0x6')},'limitCalls':{'type':Sequelize[_0x15c2('0x7')](0x4)[_0x15c2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x15c2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x15c2('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x15c2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x15c2('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'defaultValue':0x3,'comment':_0x15c2('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x15c2('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x15c2('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x15c2('0x3')](_0x15c2('0x10'),_0x15c2('0x11'),_0x15c2('0x12')),'defaultValue':_0x15c2('0x10')},'dialAMDActive':{'type':Sequelize[_0x15c2('0x5')],'defaultValue':0x0,'comment':_0x15c2('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x15c2('0x7')](0x9)[_0x15c2('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x15c2('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x15c2('0x7')](0x9)[_0x15c2('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x15c2('0x7')](0x9)[_0x15c2('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x15c2('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x15c2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x15c2('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x15c2('0x7')](0x9)[_0x15c2('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x15c2('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x15c2('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x15c2('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x15c2('0x3')](_0x15c2('0x19'),_0x15c2('0x1a')),'defaultValue':_0x15c2('0x19')},'dialPrefix':{'type':Sequelize[_0x15c2('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x15c2('0x1b')},'dialCutDigit':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x15c2('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x15c2('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)[_0x15c2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x15c2('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0x21')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x15c2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x15c2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x15c2('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x15c2('0x7')](0x5)[_0x15c2('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x15c2('0x23')}}; \ No newline at end of file +var _0x0b70=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','#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\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x28f206,_0x4f7ddd){var _0x40fc2e=function(_0x3238a1){while(--_0x3238a1){_0x28f206['push'](_0x28f206['shift']());}};_0x40fc2e(++_0x4f7ddd);}(_0x0b70,0x159));var _0x00b7=function(_0x2f4785,_0x322588){_0x2f4785=_0x2f4785-0x0;var _0x49295f=_0x0b70[_0x2f4785];return _0x49295f;};'use strict';var Sequelize=require('sequelize');module[_0x00b7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x00b7('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x00b7('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x00b7('0x3')},'description':{'type':Sequelize[_0x00b7('0x4')]},'active':{'type':Sequelize[_0x00b7('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x00b7('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x00b7('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x00b7('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x00b7('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x00b7('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'comment':_0x00b7('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x00b7('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x00b7('0x4')],'defaultValue':_0x00b7('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x00b7('0x10'),_0x00b7('0x11')),'defaultValue':_0x00b7('0x12')},'dialAMDActive':{'type':Sequelize[_0x00b7('0x5')],'defaultValue':0x0,'comment':_0x00b7('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x00b7('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x00b7('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x00b7('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x00b7('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x00b7('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x00b7('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x00b7('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x00b7('0x6')](0x9)[_0x00b7('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x00b7('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x00b7('0x2')](_0x00b7('0x1b'),_0x00b7('0x1c')),'defaultValue':_0x00b7('0x1b')},'dialPrefix':{'type':Sequelize[_0x00b7('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x00b7('0x1d')},'dialCutDigit':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x00b7('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x00b7('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x00b7('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x00b7('0x24')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x00b7('0x6')](0x3)[_0x00b7('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x00b7('0x6')](0x5)[_0x00b7('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x00b7('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index c773655..c20ca3a 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 _0x7e6b=['update','then','destroy','get','IvrCampaigns','sendStatus','error','stack','index','map','Campaign','fieldName','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','filter','includeAll','include','rows','catch','options','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','params','getHoppers','order','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','omit','spread','dialCheckDuplicateType','always','into','cm_hopper','phone','ContactId','ListId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','from','CampaignId\x20=\x20?','onlyIfOpen','insert','fromQuery','scheduledAt','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','reject','save'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x7e6b,0x186));var _0xb7e6=function(_0x53fcf7,_0x350bca){_0x53fcf7=_0x53fcf7-0x0;var _0x250582=_0x7e6b[_0x53fcf7];return _0x250582;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb7e6('0x0'));var jsonpatch=require(_0xb7e6('0x1'));var rp=require('request-promise');var moment=require(_0xb7e6('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb7e6('0x3'));var path=require(_0xb7e6('0x4'));var sox=require(_0xb7e6('0x5'));var csv=require(_0xb7e6('0x6'));var ejs=require(_0xb7e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb7e6('0x8'));var crypto=require(_0xb7e6('0x9'));var jsforce=require(_0xb7e6('0xa'));var deskjs=require(_0xb7e6('0xb'));var toCsv=require(_0xb7e6('0x6'));var querystring=require('querystring');var Papa=require(_0xb7e6('0xc'));var Redis=require(_0xb7e6('0xd'));var authService=require(_0xb7e6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb7e6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb7e6('0x10'));var utils=require(_0xb7e6('0x11'));var config=require(_0xb7e6('0x12'));var licenseUtil=require(_0xb7e6('0x13'));var db=require(_0xb7e6('0x14'))['db'];function respondWithStatusCode(_0xe1c989,_0x57d7b0){_0x57d7b0=_0x57d7b0||0xcc;return function(_0x47d402){if(_0x47d402){return _0xe1c989['sendStatus'](_0x57d7b0);}return _0xe1c989[_0xb7e6('0x15')](_0x57d7b0)[_0xb7e6('0x16')]();};}function respondWithResult(_0x52aee2,_0x5da089){_0x5da089=_0x5da089||0xc8;return function(_0x6e6ed2){if(_0x6e6ed2){return _0x52aee2[_0xb7e6('0x15')](_0x5da089)[_0xb7e6('0x17')](_0x6e6ed2);}};}function respondWithFilteredResult(_0x4c87f6,_0x1096d8){return function(_0x21b28c){if(_0x21b28c){var _0x10da00=typeof _0x1096d8['offset']===_0xb7e6('0x18')&&typeof _0x1096d8['limit']===_0xb7e6('0x18');var _0x5a4550=_0x21b28c[_0xb7e6('0x19')];var _0x5a5e0f=_0x10da00?0x0:_0x1096d8['offset'];var _0x3b9ade=_0x10da00?_0x21b28c[_0xb7e6('0x19')]:_0x1096d8[_0xb7e6('0x1a')]+_0x1096d8[_0xb7e6('0x1b')];var _0x45cc19;if(_0x3b9ade>=_0x5a4550){_0x3b9ade=_0x5a4550;_0x45cc19=0xc8;}else{_0x45cc19=0xce;}_0x4c87f6['status'](_0x45cc19);return _0x4c87f6['set']('Content-Range',_0x5a5e0f+'-'+_0x3b9ade+'/'+_0x5a4550)[_0xb7e6('0x17')](_0x21b28c);}return null;};}function patchUpdates(_0x544aa1){return function(_0x400bb5){try{jsonpatch['apply'](_0x400bb5,_0x544aa1,!![]);}catch(_0x358a64){return BPromise[_0xb7e6('0x1c')](_0x358a64);}return _0x400bb5[_0xb7e6('0x1d')]();};}function saveUpdates(_0x17330b,_0x55fb83){return function(_0x55b58d){if(_0x55b58d){return _0x55b58d[_0xb7e6('0x1e')](_0x17330b)[_0xb7e6('0x1f')](function(_0x20ea6f){return _0x20ea6f;});}return null;};}function removeEntity(_0x35d56e,_0x4a7c0a){return function(_0x14b21a){if(_0x14b21a){return _0x14b21a[_0xb7e6('0x20')]()['then'](function(){var _0x238fd4=_0x14b21a[_0xb7e6('0x21')]({'plain':!![]});var _0x353bcb=_0xb7e6('0x22');return db['UserProfileResource'][_0xb7e6('0x20')]({'where':{'type':_0x353bcb,'resourceId':_0x238fd4['id']}})['then'](function(){return _0x14b21a;});})[_0xb7e6('0x1f')](function(){_0x35d56e[_0xb7e6('0x15')](0xcc)[_0xb7e6('0x16')]();});}};}function handleEntityNotFound(_0x309691,_0x42329d){return function(_0x272b92){if(!_0x272b92){_0x309691[_0xb7e6('0x23')](0x194);}return _0x272b92;};}function handleError(_0x3057a6,_0x3ea472){_0x3ea472=_0x3ea472||0x1f4;return function(_0x20c30b){logger[_0xb7e6('0x24')](_0x20c30b[_0xb7e6('0x25')]);if(_0x20c30b['name']){delete _0x20c30b['name'];}_0x3057a6[_0xb7e6('0x15')](_0x3ea472)['send'](_0x20c30b);};}exports[_0xb7e6('0x26')]=function(_0x219399,_0x5bb3ba){var _0xb1e140={},_0x3a967b={},_0x37bb01={'count':0x0,'rows':[]};var _0x3409f2=_[_0xb7e6('0x27')](db[_0xb7e6('0x28')]['rawAttributes'],function(_0x4b3a6f){return{'name':_0x4b3a6f[_0xb7e6('0x29')],'type':_0x4b3a6f['type'][_0xb7e6('0x2a')]};});_0x3a967b['model']=_[_0xb7e6('0x27')](_0x3409f2,_0xb7e6('0x2b'));_0x3a967b[_0xb7e6('0x2c')]=_[_0xb7e6('0x2d')](_0x219399[_0xb7e6('0x2c')]);_0x3a967b['filters']=_[_0xb7e6('0x2e')](_0x3a967b[_0xb7e6('0x2f')],_0x3a967b[_0xb7e6('0x2c')]);_0xb1e140[_0xb7e6('0x30')]=_[_0xb7e6('0x2e')](_0x3a967b[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x219399[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0xb1e140[_0xb7e6('0x30')]=_0xb1e140['attributes'][_0xb7e6('0x32')]?_0xb1e140['attributes']:_0x3a967b[_0xb7e6('0x2f')];if(!_0x219399[_0xb7e6('0x2c')][_0xb7e6('0x33')](_0xb7e6('0x34'))){_0xb1e140[_0xb7e6('0x1b')]=qs[_0xb7e6('0x1b')](_0x219399[_0xb7e6('0x2c')]['limit']);_0xb1e140[_0xb7e6('0x1a')]=qs[_0xb7e6('0x1a')](_0x219399['query']['offset']);}_0xb1e140['order']=qs[_0xb7e6('0x35')](_0x219399[_0xb7e6('0x2c')][_0xb7e6('0x35')]);_0xb1e140[_0xb7e6('0x36')]=qs[_0xb7e6('0x37')](_[_0xb7e6('0x38')](_0x219399[_0xb7e6('0x2c')],_0x3a967b['filters']),_0x3409f2);if(_0x219399['query']['filter']){_0xb1e140[_0xb7e6('0x36')]=_[_0xb7e6('0x39')](_0xb1e140['where'],{'$or':_[_0xb7e6('0x27')](_0x3409f2,function(_0x3353a5){if(_0x3353a5[_0xb7e6('0x3a')]!=='VIRTUAL'){var _0x339b41={};_0x339b41[_0x3353a5['name']]={'$like':'%'+_0x219399[_0xb7e6('0x2c')][_0xb7e6('0x3b')]+'%'};return _0x339b41;}})});}_0xb1e140=_[_0xb7e6('0x39')]({},_0xb1e140,_0x219399['options']);var _0xf65fa8={'where':_0xb1e140['where']};return db[_0xb7e6('0x28')][_0xb7e6('0x19')](_0xf65fa8)['then'](function(_0x1f2d99){_0x37bb01[_0xb7e6('0x19')]=_0x1f2d99;if(_0x219399[_0xb7e6('0x2c')][_0xb7e6('0x3c')]){_0xb1e140[_0xb7e6('0x3d')]=[{'all':!![]}];}return db[_0xb7e6('0x28')]['findAll'](_0xb1e140);})[_0xb7e6('0x1f')](function(_0x492f79){_0x37bb01[_0xb7e6('0x3e')]=_0x492f79;return _0x37bb01;})[_0xb7e6('0x1f')](respondWithFilteredResult(_0x5bb3ba,_0xb1e140))[_0xb7e6('0x3f')](handleError(_0x5bb3ba,null));};exports['show']=function(_0x58be39,_0x41c46e){var _0x227373={'raw':![],'where':{'id':_0x58be39['params']['id']}},_0xb9bc68={};_0xb9bc68[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db[_0xb7e6('0x28')]['rawAttributes']);_0xb9bc68['query']=_['keys'](_0x58be39[_0xb7e6('0x2c')]);_0xb9bc68[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0xb9bc68['model'],_0xb9bc68[_0xb7e6('0x2c')]);_0x227373[_0xb7e6('0x30')]=_[_0xb7e6('0x2e')](_0xb9bc68[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x58be39[_0xb7e6('0x2c')]['fields']));_0x227373[_0xb7e6('0x30')]=_0x227373[_0xb7e6('0x30')]['length']?_0x227373[_0xb7e6('0x30')]:_0xb9bc68[_0xb7e6('0x2f')];if(_0x58be39[_0xb7e6('0x2c')][_0xb7e6('0x3c')]){_0x227373[_0xb7e6('0x3d')]=[{'all':!![]}];}_0x227373=_[_0xb7e6('0x39')]({},_0x227373,_0x58be39[_0xb7e6('0x40')]);return db[_0xb7e6('0x28')]['find'](_0x227373)[_0xb7e6('0x1f')](handleEntityNotFound(_0x41c46e,null))[_0xb7e6('0x1f')](respondWithResult(_0x41c46e,null))[_0xb7e6('0x3f')](handleError(_0x41c46e,null));};exports[_0xb7e6('0x41')]=function(_0x2ca3f0,_0x35d79c){return db[_0xb7e6('0x28')]['create'](_0x2ca3f0[_0xb7e6('0x42')],{})[_0xb7e6('0x1f')](function(_0x3038f6){var _0x1e0f9e=_0x2ca3f0[_0xb7e6('0x43')][_0xb7e6('0x21')]({'plain':!![]});if(!_0x1e0f9e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0f9e[_0xb7e6('0x44')]==='user'){var _0x54b103=_0x3038f6[_0xb7e6('0x21')]({'plain':!![]});var _0x283d23=_0xb7e6('0x22');return db[_0xb7e6('0x45')][_0xb7e6('0x46')]({'where':{'name':_0x283d23,'userProfileId':_0x1e0f9e['userProfileId']},'raw':!![]})[_0xb7e6('0x1f')](function(_0x45ce07){if(_0x45ce07&&_0x45ce07[_0xb7e6('0x47')]===0x0){return db['UserProfileResource'][_0xb7e6('0x41')]({'name':_0x54b103['name'],'resourceId':_0x54b103['id'],'type':_0x45ce07[_0xb7e6('0x2b')],'sectionId':_0x45ce07['id']},{})[_0xb7e6('0x1f')](function(){return _0x3038f6;});}else{return _0x3038f6;}})[_0xb7e6('0x3f')](function(_0x22964b){logger[_0xb7e6('0x24')](_0xb7e6('0x48'),_0x22964b);throw _0x22964b;});}return _0x3038f6;})[_0xb7e6('0x1f')](respondWithResult(_0x35d79c,0xc9))[_0xb7e6('0x3f')](handleError(_0x35d79c,null));};exports[_0xb7e6('0x49')]=function(_0x3b858d,_0x281aed){var _0x51523c={'where':{'id':_0x3b858d['params']['id']}},_0x56879f={};_0x56879f[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db['Campaign'][_0xb7e6('0x4a')]);_0x51523c[_0xb7e6('0x30')]=_[_0xb7e6('0x2e')](_0x56879f[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x3b858d[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0x51523c[_0xb7e6('0x30')]=_0x51523c[_0xb7e6('0x30')]['length']?_0x51523c[_0xb7e6('0x30')]:_0x56879f[_0xb7e6('0x2f')];if(_0x3b858d[_0xb7e6('0x2c')][_0xb7e6('0x3c')]){_0x51523c['include']=[{'all':!![]}];}_0x51523c=_[_0xb7e6('0x39')]({},_0x51523c,_0x3b858d[_0xb7e6('0x40')]);return db[_0xb7e6('0x28')][_0xb7e6('0x46')](_0x51523c)[_0xb7e6('0x1f')](handleEntityNotFound(_0x281aed,null))[_0xb7e6('0x1f')](function(_0x419464){if(_0x419464){var _0x27b326=_0x419464[_0xb7e6('0x21')]({'plain':!![]});_0x27b326=qs['omit'](_0x27b326,['id',_0xb7e6('0x4b'),'updatedAt']);_0x3b858d[_0xb7e6('0x42')]=_['omit'](_0x3b858d[_0xb7e6('0x42')],['id','createdAt',_0xb7e6('0x4c')]);return db[_0xb7e6('0x28')][_0xb7e6('0x41')](_['merge'](_0x27b326,_0x3b858d['body']),{'include':_0x3b858d['query'][_0xb7e6('0x3c')]?[{'all':!![]}]:undefined})[_0xb7e6('0x1f')](function(_0x132fef){var _0x3c3657=_0x3b858d[_0xb7e6('0x43')][_0xb7e6('0x21')]({'plain':!![]});if(!_0x3c3657)throw new Error(_0xb7e6('0x4d'));if(_0x3c3657[_0xb7e6('0x44')]==='user'){var _0xcd8d22=_0x132fef[_0xb7e6('0x21')]({'plain':!![]});var _0x4b4f47='IvrCampaigns';return db[_0xb7e6('0x45')][_0xb7e6('0x46')]({'where':{'name':_0x4b4f47,'userProfileId':_0x3c3657['userProfileId']},'raw':!![]})['then'](function(_0x366535){if(_0x366535&&_0x366535['autoAssociation']===0x0){return db[_0xb7e6('0x4e')][_0xb7e6('0x41')]({'name':_0xcd8d22['name'],'resourceId':_0xcd8d22['id'],'type':_0x366535[_0xb7e6('0x2b')],'sectionId':_0x366535['id']},{})['then'](function(){return _0x132fef;});}else{return _0x132fef;}})[_0xb7e6('0x3f')](function(_0x31882b){logger[_0xb7e6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31882b);throw _0x31882b;});}return _0x132fef;});}})['then'](respondWithResult(_0x281aed,0xc9))[_0xb7e6('0x3f')](handleError(_0x281aed,null));};exports[_0xb7e6('0x1e')]=function(_0x131608,_0x4a2c04){if(_0x131608[_0xb7e6('0x42')]['id']){delete _0x131608['body']['id'];}return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0x131608[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x4a2c04,null))['then'](saveUpdates(_0x131608[_0xb7e6('0x42')],null))[_0xb7e6('0x1f')](respondWithResult(_0x4a2c04,null))[_0xb7e6('0x3f')](handleError(_0x4a2c04,null));};exports[_0xb7e6('0x20')]=function(_0x529150,_0x4dec0a){return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0x529150[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x4dec0a,null))[_0xb7e6('0x1f')](removeEntity(_0x4dec0a,null))['catch'](handleError(_0x4dec0a,null));};exports[_0xb7e6('0x50')]=function(_0x40329f,_0x160e8b,_0x27fbcd){var _0x1929e8={'raw':!![],'where':{}};var _0x36b68e={};var _0x3ea821={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x40329f[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x160e8b,null))[_0xb7e6('0x1f')](function(_0x2c0de5){if(_0x2c0de5){_0x36b68e[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db['CmHopper']['rawAttributes']);_0x36b68e[_0xb7e6('0x2c')]=_[_0xb7e6('0x2d')](_0x40329f[_0xb7e6('0x2c')]);_0x36b68e[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0x36b68e[_0xb7e6('0x2f')],_0x36b68e[_0xb7e6('0x2c')]);_0x1929e8['attributes']=_['intersection'](_0x36b68e[_0xb7e6('0x2f')],qs['fields'](_0x40329f[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0x1929e8[_0xb7e6('0x30')]=_0x1929e8[_0xb7e6('0x30')][_0xb7e6('0x32')]?_0x1929e8['attributes']:_0x36b68e[_0xb7e6('0x2f')];if(!_0x40329f[_0xb7e6('0x2c')][_0xb7e6('0x33')](_0xb7e6('0x34'))){_0x1929e8['limit']=qs['limit'](_0x40329f[_0xb7e6('0x2c')]['limit']);_0x1929e8[_0xb7e6('0x1a')]=qs['offset'](_0x40329f[_0xb7e6('0x2c')][_0xb7e6('0x1a')]);}_0x1929e8[_0xb7e6('0x51')]=qs[_0xb7e6('0x35')](_0x40329f[_0xb7e6('0x2c')]['sort']);_0x1929e8['where']=qs['filters'](_[_0xb7e6('0x38')](_0x40329f[_0xb7e6('0x2c')],_0x36b68e['filters']));_0x1929e8[_0xb7e6('0x36')][_0xb7e6('0x52')]=_0x2c0de5['id'];if(_0x40329f['query'][_0xb7e6('0x3b')]){_0x1929e8[_0xb7e6('0x36')]=_[_0xb7e6('0x39')](_0x1929e8[_0xb7e6('0x36')],{'$or':_['map'](_0x1929e8['attributes'],function(_0x459bbc){var _0x5573c2={};_0x5573c2[_0x459bbc]={'$like':'%'+_0x40329f[_0xb7e6('0x2c')]['filter']+'%'};return _0x5573c2;})});}_0x1929e8=_[_0xb7e6('0x39')]({},_0x1929e8,_0x40329f['options']);return db[_0xb7e6('0x53')][_0xb7e6('0x19')]({'where':_0x1929e8[_0xb7e6('0x36')]})[_0xb7e6('0x1f')](function(_0x2da366){_0x3ea821[_0xb7e6('0x19')]=_0x2da366;if(_0x40329f[_0xb7e6('0x2c')][_0xb7e6('0x3c')]){_0x1929e8[_0xb7e6('0x3d')]=[{'all':!![]}];}return db[_0xb7e6('0x53')][_0xb7e6('0x54')](_0x1929e8);})['then'](function(_0x38c602){_0x3ea821[_0xb7e6('0x3e')]=_0x38c602;return _0x3ea821;});}})[_0xb7e6('0x1f')](respondWithFilteredResult(_0x160e8b,_0x1929e8))[_0xb7e6('0x3f')](handleError(_0x160e8b,null));};exports[_0xb7e6('0x55')]=function(_0x1864ae,_0x566d68,_0x11cc31){var _0x26cda7={'raw':!![],'where':{}};var _0x2c2086={};var _0x5da260={'count':0x0,'rows':[]};return db[_0xb7e6('0x28')]['findOne']({'where':{'id':_0x1864ae[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x566d68,null))[_0xb7e6('0x1f')](function(_0x188ab4){if(_0x188ab4){_0x2c2086[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db[_0xb7e6('0x56')]['rawAttributes']);_0x2c2086[_0xb7e6('0x2c')]=_['keys'](_0x1864ae['query']);_0x2c2086[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0x2c2086['model'],_0x2c2086['query']);_0x26cda7[_0xb7e6('0x30')]=_[_0xb7e6('0x2e')](_0x2c2086[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x1864ae[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0x26cda7['attributes']=_0x26cda7[_0xb7e6('0x30')]['length']?_0x26cda7[_0xb7e6('0x30')]:_0x2c2086['model'];if(!_0x1864ae[_0xb7e6('0x2c')]['hasOwnProperty'](_0xb7e6('0x34'))){_0x26cda7['limit']=qs['limit'](_0x1864ae[_0xb7e6('0x2c')][_0xb7e6('0x1b')]);_0x26cda7[_0xb7e6('0x1a')]=qs[_0xb7e6('0x1a')](_0x1864ae[_0xb7e6('0x2c')][_0xb7e6('0x1a')]);}_0x26cda7[_0xb7e6('0x51')]=qs[_0xb7e6('0x35')](_0x1864ae['query']['sort']);_0x26cda7[_0xb7e6('0x36')]=qs[_0xb7e6('0x37')](_[_0xb7e6('0x38')](_0x1864ae[_0xb7e6('0x2c')],_0x2c2086['filters']));_0x26cda7[_0xb7e6('0x36')][_0xb7e6('0x52')]=_0x188ab4['id'];if(_0x1864ae['query']['filter']){_0x26cda7['where']=_['merge'](_0x26cda7[_0xb7e6('0x36')],{'$or':_[_0xb7e6('0x27')](_0x26cda7['attributes'],function(_0x39b8fa){var _0x1f9628={};_0x1f9628[_0x39b8fa]={'$like':'%'+_0x1864ae['query'][_0xb7e6('0x3b')]+'%'};return _0x1f9628;})});}_0x26cda7=_[_0xb7e6('0x39')]({},_0x26cda7,_0x1864ae['options']);return db[_0xb7e6('0x56')][_0xb7e6('0x19')]({'where':_0x26cda7['where']})[_0xb7e6('0x1f')](function(_0x29acc6){_0x5da260[_0xb7e6('0x19')]=_0x29acc6;if(_0x1864ae[_0xb7e6('0x2c')]['includeAll']){_0x26cda7[_0xb7e6('0x3d')]=[{'all':!![]}];}return db[_0xb7e6('0x56')][_0xb7e6('0x54')](_0x26cda7);})['then'](function(_0x2430ce){_0x5da260['rows']=_0x2430ce;return _0x5da260;});}})[_0xb7e6('0x1f')](respondWithFilteredResult(_0x566d68,_0x26cda7))[_0xb7e6('0x3f')](handleError(_0x566d68,null));};exports[_0xb7e6('0x57')]=function(_0x4a8f69,_0x52971c,_0x214b56){var _0x1b9967={'raw':!![],'where':{}};var _0x19909e={};var _0x404c93={'count':0x0,'rows':[]};return db[_0xb7e6('0x28')][_0xb7e6('0x58')]({'where':{'id':_0x4a8f69['params']['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x52971c,null))[_0xb7e6('0x1f')](function(_0x3d7ce8){if(_0x3d7ce8){_0x19909e[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db['CmHopperFinal'][_0xb7e6('0x4a')]);_0x19909e['query']=_[_0xb7e6('0x2d')](_0x4a8f69[_0xb7e6('0x2c')]);_0x19909e['filters']=_['intersection'](_0x19909e[_0xb7e6('0x2f')],_0x19909e['query']);_0x1b9967[_0xb7e6('0x30')]=_[_0xb7e6('0x2e')](_0x19909e[_0xb7e6('0x2f')],qs['fields'](_0x4a8f69[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0x1b9967['attributes']=_0x1b9967['attributes'][_0xb7e6('0x32')]?_0x1b9967[_0xb7e6('0x30')]:_0x19909e[_0xb7e6('0x2f')];if(!_0x4a8f69[_0xb7e6('0x2c')][_0xb7e6('0x33')](_0xb7e6('0x34'))){_0x1b9967[_0xb7e6('0x1b')]=qs[_0xb7e6('0x1b')](_0x4a8f69['query'][_0xb7e6('0x1b')]);_0x1b9967['offset']=qs[_0xb7e6('0x1a')](_0x4a8f69[_0xb7e6('0x2c')]['offset']);}_0x1b9967['order']=qs[_0xb7e6('0x35')](_0x4a8f69['query']['sort']);_0x1b9967['where']=qs[_0xb7e6('0x37')](_[_0xb7e6('0x38')](_0x4a8f69[_0xb7e6('0x2c')],_0x19909e[_0xb7e6('0x37')]));_0x1b9967['where'][_0xb7e6('0x52')]=_0x3d7ce8['id'];if(_0x4a8f69[_0xb7e6('0x2c')][_0xb7e6('0x3b')]){_0x1b9967['where']=_[_0xb7e6('0x39')](_0x1b9967[_0xb7e6('0x36')],{'$or':_[_0xb7e6('0x27')](_0x1b9967[_0xb7e6('0x30')],function(_0x1a8074){var _0x29211b={};_0x29211b[_0x1a8074]={'$like':'%'+_0x4a8f69[_0xb7e6('0x2c')]['filter']+'%'};return _0x29211b;})});}_0x1b9967=_['merge']({},_0x1b9967,_0x4a8f69[_0xb7e6('0x40')]);return db[_0xb7e6('0x59')]['count']({'where':_0x1b9967[_0xb7e6('0x36')]})['then'](function(_0x13faee){_0x404c93[_0xb7e6('0x19')]=_0x13faee;if(_0x4a8f69[_0xb7e6('0x2c')]['includeAll']){_0x1b9967['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xb7e6('0x54')](_0x1b9967);})['then'](function(_0x535b40){_0x404c93[_0xb7e6('0x3e')]=_0x535b40;return _0x404c93;});}})[_0xb7e6('0x1f')](respondWithFilteredResult(_0x52971c,_0x1b9967))[_0xb7e6('0x3f')](handleError(_0x52971c,null));};exports[_0xb7e6('0x5a')]=function(_0x4cfb9c,_0x29fc,_0x6d3e7c){var _0x34288={'raw':!![],'where':{}};var _0x39a96b={};var _0x4ce761={'count':0x0,'rows':[]};return db[_0xb7e6('0x28')][_0xb7e6('0x58')]({'where':{'id':_0x4cfb9c[_0xb7e6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x29fc,null))['then'](function(_0x5c7b46){if(_0x5c7b46){_0x39a96b[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db[_0xb7e6('0x5b')][_0xb7e6('0x4a')]);_0x39a96b[_0xb7e6('0x2c')]=_[_0xb7e6('0x2d')](_0x4cfb9c[_0xb7e6('0x2c')]);_0x39a96b[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0x39a96b[_0xb7e6('0x2f')],_0x39a96b[_0xb7e6('0x2c')]);_0x34288['attributes']=_[_0xb7e6('0x2e')](_0x39a96b[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x4cfb9c[_0xb7e6('0x2c')]['fields']));_0x34288[_0xb7e6('0x30')]=_0x34288[_0xb7e6('0x30')]['length']?_0x34288[_0xb7e6('0x30')]:_0x39a96b[_0xb7e6('0x2f')];if(!_0x4cfb9c['query'][_0xb7e6('0x33')](_0xb7e6('0x34'))){_0x34288[_0xb7e6('0x1b')]=qs[_0xb7e6('0x1b')](_0x4cfb9c[_0xb7e6('0x2c')]['limit']);_0x34288[_0xb7e6('0x1a')]=qs[_0xb7e6('0x1a')](_0x4cfb9c[_0xb7e6('0x2c')][_0xb7e6('0x1a')]);}_0x34288[_0xb7e6('0x51')]=qs[_0xb7e6('0x35')](_0x4cfb9c[_0xb7e6('0x2c')][_0xb7e6('0x35')]);_0x34288['where']=qs[_0xb7e6('0x37')](_[_0xb7e6('0x38')](_0x4cfb9c['query'],_0x39a96b['filters']));_0x34288[_0xb7e6('0x36')][_0xb7e6('0x52')]=_0x5c7b46['id'];if(_0x4cfb9c[_0xb7e6('0x2c')][_0xb7e6('0x3b')]){_0x34288[_0xb7e6('0x36')]=_[_0xb7e6('0x39')](_0x34288[_0xb7e6('0x36')],{'$or':_['map'](_0x34288['attributes'],function(_0x19b133){var _0x4900c1={};_0x4900c1[_0x19b133]={'$like':'%'+_0x4cfb9c['query'][_0xb7e6('0x3b')]+'%'};return _0x4900c1;})});}_0x34288=_[_0xb7e6('0x39')]({},_0x34288,_0x4cfb9c[_0xb7e6('0x40')]);return db[_0xb7e6('0x5b')][_0xb7e6('0x19')]({'where':_0x34288[_0xb7e6('0x36')]})['then'](function(_0x54b3ba){_0x4ce761['count']=_0x54b3ba;if(_0x4cfb9c[_0xb7e6('0x2c')][_0xb7e6('0x3c')]){_0x34288[_0xb7e6('0x3d')]=[{'all':!![]}];}return db[_0xb7e6('0x5b')][_0xb7e6('0x54')](_0x34288);})[_0xb7e6('0x1f')](function(_0xff107){_0x4ce761['rows']=_0xff107;return _0x4ce761;});}})[_0xb7e6('0x1f')](respondWithFilteredResult(_0x29fc,_0x34288))[_0xb7e6('0x3f')](handleError(_0x29fc,null));};exports['getLists']=function(_0x41829b,_0x24c143,_0x433f64){var _0x3dc66d={};var _0x476fdf={};var _0x21652a;var _0xaccd46;return db[_0xb7e6('0x28')][_0xb7e6('0x58')]({'where':{'id':_0x41829b[_0xb7e6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x24c143,null))['then'](function(_0x210c2e){if(_0x210c2e){_0x21652a=_0x210c2e;_0x476fdf[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db[_0xb7e6('0x5c')][_0xb7e6('0x4a')]);_0x476fdf[_0xb7e6('0x2c')]=_['keys'](_0x41829b['query']);_0x476fdf[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0x476fdf[_0xb7e6('0x2f')],_0x476fdf[_0xb7e6('0x2c')]);_0x3dc66d['attributes']=_[_0xb7e6('0x2e')](_0x476fdf[_0xb7e6('0x2f')],qs[_0xb7e6('0x31')](_0x41829b['query'][_0xb7e6('0x31')]));_0x3dc66d[_0xb7e6('0x30')]=_0x3dc66d[_0xb7e6('0x30')]['length']?_0x3dc66d[_0xb7e6('0x30')]:_0x476fdf[_0xb7e6('0x2f')];_0x3dc66d['order']=qs['sort'](_0x41829b[_0xb7e6('0x2c')]['sort']);_0x3dc66d[_0xb7e6('0x36')]=qs[_0xb7e6('0x37')](_['pick'](_0x41829b[_0xb7e6('0x2c')],_0x476fdf['filters']));if(_0x41829b[_0xb7e6('0x2c')][_0xb7e6('0x3b')]){_0x3dc66d['where']=_['merge'](_0x3dc66d[_0xb7e6('0x36')],{'$or':_[_0xb7e6('0x27')](_0x3dc66d[_0xb7e6('0x30')],function(_0x56c5c3){var _0x53162a={};_0x53162a[_0x56c5c3]={'$like':'%'+_0x41829b['query']['filter']+'%'};return _0x53162a;})});}_0x3dc66d=_[_0xb7e6('0x39')]({},_0x3dc66d,_0x41829b[_0xb7e6('0x40')]);return _0x21652a[_0xb7e6('0x5d')](_0x3dc66d);}})[_0xb7e6('0x1f')](function(_0x1fa6e1){if(_0x1fa6e1){_0xaccd46=_0x1fa6e1[_0xb7e6('0x32')];if(!_0x41829b['query']['hasOwnProperty']('nolimit')){_0x3dc66d[_0xb7e6('0x1b')]=qs[_0xb7e6('0x1b')](_0x41829b['query'][_0xb7e6('0x1b')]);_0x3dc66d['offset']=qs[_0xb7e6('0x1a')](_0x41829b[_0xb7e6('0x2c')][_0xb7e6('0x1a')]);}return _0x21652a[_0xb7e6('0x5d')](_0x3dc66d);}})[_0xb7e6('0x1f')](function(_0x12daa1){if(_0x12daa1){return _0x12daa1?{'count':_0xaccd46,'rows':_0x12daa1}:null;}})[_0xb7e6('0x1f')](respondWithResult(_0x24c143,null))[_0xb7e6('0x3f')](handleError(_0x24c143,null));};exports[_0xb7e6('0x5e')]=function(_0x946167,_0x4648b9,_0x5a51b6){var _0x43ce19,_0x3f25d7;var _0x26bb5f=[];var _0x11320a=moment()[_0xb7e6('0x5f')](_0xb7e6('0x60'));return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0x946167[_0xb7e6('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4648b9,null))[_0xb7e6('0x1f')](function(_0x33939d){if(_0x33939d){_0x3f25d7=_0x33939d;return _0x33939d[_0xb7e6('0x5e')](_0x946167[_0xb7e6('0x42')][_0xb7e6('0x61')],_[_0xb7e6('0x62')](_0x946167[_0xb7e6('0x42')],[_0xb7e6('0x61'),'id'])||{});}return null;})[_0xb7e6('0x63')](function(_0x40a02c){var _0x42de64;var _0x358998;_0x43ce19=_0x40a02c||[];var _0x26c893=[];if(_0x40a02c){for(var _0x2c1844=0x0;_0x2c1844<_0x40a02c['length'];_0x2c1844+=0x1){var _0x34ef5e=_0x40a02c[_0x2c1844]['get']({'plain':!![]});_0x3f25d7[_0xb7e6('0x64')]=_0x946167[_0xb7e6('0x42')][_0xb7e6('0x64')]?_0x946167[_0xb7e6('0x42')]['dialCheckDuplicateType']:_0x3f25d7['dialCheckDuplicateType'];switch(_0x3f25d7[_0xb7e6('0x64')]){case _0xb7e6('0x65'):_0x42de64=squel['insert']()[_0xb7e6('0x66')](_0xb7e6('0x67'))['fromQuery']([_0xb7e6('0x68'),'scheduledAt',_0xb7e6('0x69'),_0xb7e6('0x6a'),_0xb7e6('0x52'),_0xb7e6('0x4b'),_0xb7e6('0x4c')],squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')](_0xb7e6('0x68'),_0xb7e6('0x68'))['field'](_0xb7e6('0x6d'),'scheduledAt')[_0xb7e6('0x6c')]('id',_0xb7e6('0x69'))[_0xb7e6('0x6c')](_0x34ef5e['CmListId'][_0xb7e6('0x6e')](),_0xb7e6('0x6a'))[_0xb7e6('0x6c')](_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')](),_0xb7e6('0x52'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27','createdAt')[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4c'))['from'](_0xb7e6('0x6f'))[_0xb7e6('0x36')](_0xb7e6('0x70'))[_0xb7e6('0x36')](_0xb7e6('0x71'),_0x34ef5e[_0xb7e6('0x72')][_0xb7e6('0x6e')]())['where'](_0xb7e6('0x73'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')]('COALESCE(calleridnum,\x27\x27)')['from'](_0xb7e6('0x74'))[_0xb7e6('0x36')]('CampaignId\x20=\x20?',_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')]()))[_0xb7e6('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')]('COALESCE(phone,\x27\x27)')[_0xb7e6('0x75')](_0xb7e6('0x67'))[_0xb7e6('0x36')](_0xb7e6('0x76'),_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')]())))[_0xb7e6('0x6e')]();break;case _0xb7e6('0x77'):_0x42de64=squel[_0xb7e6('0x78')]()['into'](_0xb7e6('0x67'))[_0xb7e6('0x79')]([_0xb7e6('0x68'),_0xb7e6('0x7a'),'ContactId',_0xb7e6('0x6a'),'CampaignId',_0xb7e6('0x4b'),_0xb7e6('0x4c')],squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')]('phone',_0xb7e6('0x68'))['field'](_0xb7e6('0x6d'),_0xb7e6('0x7a'))['field']('id',_0xb7e6('0x69'))[_0xb7e6('0x6c')](_0x34ef5e['CmListId'][_0xb7e6('0x6e')](),_0xb7e6('0x6a'))[_0xb7e6('0x6c')](_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')](),_0xb7e6('0x52'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4b'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4c'))['from']('cm_contacts')[_0xb7e6('0x36')]('deletedAt\x20IS\x20NULL')[_0xb7e6('0x36')](_0xb7e6('0x71'),_0x34ef5e[_0xb7e6('0x72')][_0xb7e6('0x6e')]())[_0xb7e6('0x36')](_0xb7e6('0x73'))[_0xb7e6('0x36')](_0xb7e6('0x7b'),squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')](_0xb7e6('0x7c'))['from'](_0xb7e6('0x67'))[_0xb7e6('0x36')](_0xb7e6('0x76'),_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')]())))[_0xb7e6('0x6e')]();break;default:_0x42de64=squel['insert']()[_0xb7e6('0x66')](_0xb7e6('0x67'))['fromQuery']([_0xb7e6('0x68'),_0xb7e6('0x7a'),_0xb7e6('0x69'),_0xb7e6('0x6a'),_0xb7e6('0x52'),_0xb7e6('0x4b'),_0xb7e6('0x4c')],squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')]('phone',_0xb7e6('0x68'))[_0xb7e6('0x6c')](_0xb7e6('0x6d'),_0xb7e6('0x7a'))['field']('id',_0xb7e6('0x69'))[_0xb7e6('0x6c')](_0x34ef5e[_0xb7e6('0x72')][_0xb7e6('0x6e')](),_0xb7e6('0x6a'))['field'](_0x946167[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')](),_0xb7e6('0x52'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4b'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27','updatedAt')[_0xb7e6('0x75')](_0xb7e6('0x6f'))[_0xb7e6('0x36')](_0xb7e6('0x70'))['where'](_0xb7e6('0x71'),_0x34ef5e[_0xb7e6('0x72')]['toString']())[_0xb7e6('0x36')](_0xb7e6('0x73')))['toString']();}_0x358998=squel[_0xb7e6('0x78')]()['into'](_0xb7e6('0x7d'))[_0xb7e6('0x79')]([_0xb7e6('0x7e'),_0xb7e6('0x7a'),'phone',_0xb7e6('0x7f'),'createdAt',_0xb7e6('0x4c')],squel[_0xb7e6('0x6b')]()[_0xb7e6('0x6c')](_0xb7e6('0x80'),'id')[_0xb7e6('0x6c')](_0xb7e6('0x6d'),_0xb7e6('0x7a'))[_0xb7e6('0x6c')](_0xb7e6('0x81'),_0xb7e6('0x68'))[_0xb7e6('0x6c')](_0xb7e6('0x82'),_0xb7e6('0x7f'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4b'))[_0xb7e6('0x6c')]('\x27'+_0x11320a+'\x27',_0xb7e6('0x4c'))[_0xb7e6('0x75')](_0xb7e6('0x83'),'ci')['join']('cm_hopper','h',_0xb7e6('0x84'))[_0xb7e6('0x36')](_0xb7e6('0x85'),_0x34ef5e[_0xb7e6('0x72')][_0xb7e6('0x6e')]())[_0xb7e6('0x36')]('h.CampaignId=?',_0x946167['params']['id'][_0xb7e6('0x6e')]())['where']('h.createdAt\x20=\x20?',_0x11320a))[_0xb7e6('0x6e')]();_0x26c893[_0xb7e6('0x86')](db[_0xb7e6('0x87')][_0xb7e6('0x2c')](_0x42de64));_0x26bb5f['push'](db[_0xb7e6('0x87')][_0xb7e6('0x2c')](_0x358998));}return BPromise[_0xb7e6('0x88')](_0x26c893);}})[_0xb7e6('0x1f')](function(){return BPromise['all'](_0x26bb5f);})[_0xb7e6('0x1f')](function(){return _0x43ce19;})[_0xb7e6('0x1f')](respondWithResult(_0x4648b9,null))[_0xb7e6('0x3f')](handleError(_0x4648b9,null));};exports[_0xb7e6('0x89')]=function(_0xe9fa95,_0x25f1b9,_0x37ec55){return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0xe9fa95[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x25f1b9,null))[_0xb7e6('0x1f')](function(_0x153223){if(_0x153223){return _0x153223[_0xb7e6('0x89')](_0xe9fa95['query'][_0xb7e6('0x61')]);}})[_0xb7e6('0x1f')](function(_0x2eb6da){if(_0x2eb6da){return db['CmHopper'][_0xb7e6('0x20')]({'where':{'ListId':_0xe9fa95[_0xb7e6('0x2c')][_0xb7e6('0x61')],'CampaignId':_0xe9fa95[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](function(){return _0x2eb6da;});}})[_0xb7e6('0x1f')](respondWithStatusCode(_0x25f1b9,null))['catch'](handleError(_0x25f1b9,null));};exports[_0xb7e6('0x8a')]=function(_0x177f5f,_0x1497ed,_0x3c79fe){var _0x450630={};var _0x2d344b={};var _0xf3006a;var _0x331020;return db[_0xb7e6('0x28')]['findOne']({'where':{'id':_0x177f5f['params']['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x1497ed,null))[_0xb7e6('0x1f')](function(_0xf0f1a0){if(_0xf0f1a0){_0xf3006a=_0xf0f1a0;_0x2d344b[_0xb7e6('0x2f')]=_[_0xb7e6('0x2d')](db[_0xb7e6('0x5c')]['rawAttributes']);_0x2d344b[_0xb7e6('0x2c')]=_[_0xb7e6('0x2d')](_0x177f5f[_0xb7e6('0x2c')]);_0x2d344b[_0xb7e6('0x37')]=_[_0xb7e6('0x2e')](_0x2d344b[_0xb7e6('0x2f')],_0x2d344b[_0xb7e6('0x2c')]);_0x450630[_0xb7e6('0x30')]=_['intersection'](_0x2d344b['model'],qs[_0xb7e6('0x31')](_0x177f5f[_0xb7e6('0x2c')][_0xb7e6('0x31')]));_0x450630[_0xb7e6('0x30')]=_0x450630[_0xb7e6('0x30')][_0xb7e6('0x32')]?_0x450630[_0xb7e6('0x30')]:_0x2d344b['model'];_0x450630[_0xb7e6('0x51')]=qs[_0xb7e6('0x35')](_0x177f5f['query'][_0xb7e6('0x35')]);_0x450630[_0xb7e6('0x36')]=qs[_0xb7e6('0x37')](_[_0xb7e6('0x38')](_0x177f5f[_0xb7e6('0x2c')],_0x2d344b[_0xb7e6('0x37')]));if(_0x177f5f[_0xb7e6('0x2c')][_0xb7e6('0x3b')]){_0x450630['where']=_[_0xb7e6('0x39')](_0x450630['where'],{'$or':_['map'](_0x450630[_0xb7e6('0x30')],function(_0x35c9e1){var _0x284765={};_0x284765[_0x35c9e1]={'$like':'%'+_0x177f5f[_0xb7e6('0x2c')]['filter']+'%'};return _0x284765;})});}_0x450630=_[_0xb7e6('0x39')]({},_0x450630,_0x177f5f[_0xb7e6('0x40')]);return _0xf3006a[_0xb7e6('0x8a')](_0x450630);}})[_0xb7e6('0x1f')](function(_0x52ceb2){if(_0x52ceb2){_0x331020=_0x52ceb2[_0xb7e6('0x32')];if(!_0x177f5f['query'][_0xb7e6('0x33')]('nolimit')){_0x450630[_0xb7e6('0x1b')]=qs[_0xb7e6('0x1b')](_0x177f5f[_0xb7e6('0x2c')][_0xb7e6('0x1b')]);_0x450630['offset']=qs[_0xb7e6('0x1a')](_0x177f5f[_0xb7e6('0x2c')]['offset']);}return _0xf3006a[_0xb7e6('0x8a')](_0x450630);}})['then'](function(_0x5986b8){if(_0x5986b8){return _0x5986b8?{'count':_0x331020,'rows':_0x5986b8}:null;}})[_0xb7e6('0x1f')](respondWithResult(_0x1497ed,null))[_0xb7e6('0x3f')](handleError(_0x1497ed,null));};exports[_0xb7e6('0x8b')]=function(_0x49b3c9,_0x2d24e1,_0x164cd7){var _0x2eddfa,_0xcc7f14;var _0x390227=[];var _0x43683c=moment()[_0xb7e6('0x5f')](_0xb7e6('0x60'));return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0x49b3c9['params']['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x2d24e1,null))[_0xb7e6('0x1f')](function(_0x3c06e7){if(_0x3c06e7){_0xcc7f14=_0x3c06e7;return _0x3c06e7['addBlackLists'](_0x49b3c9['body'][_0xb7e6('0x61')],_[_0xb7e6('0x62')](_0x49b3c9[_0xb7e6('0x42')],[_0xb7e6('0x61'),'id'])||{});}return null;})[_0xb7e6('0x63')](function(_0x50a291){var _0x1fd311;var _0x227eaa;_0x2eddfa=_0x50a291||[];var _0x1b820f=[];if(_0x50a291){for(var _0x206671=0x0;_0x206671<_0x50a291['length'];_0x206671+=0x1){var _0x358fdb=_0x50a291[_0x206671][_0xb7e6('0x21')]({'plain':!![]});_0x1fd311=squel['insert']()['into']('cm_hopper_black')[_0xb7e6('0x79')]([_0xb7e6('0x68'),_0xb7e6('0x69'),_0xb7e6('0x6a'),'CampaignId',_0xb7e6('0x4b'),_0xb7e6('0x4c')],squel['select']()[_0xb7e6('0x6c')](_0xb7e6('0x68'),_0xb7e6('0x68'))[_0xb7e6('0x6c')]('id',_0xb7e6('0x69'))[_0xb7e6('0x6c')](_0x358fdb[_0xb7e6('0x72')][_0xb7e6('0x6e')](),'ListId')[_0xb7e6('0x6c')](_0x49b3c9[_0xb7e6('0x4f')]['id'][_0xb7e6('0x6e')](),_0xb7e6('0x52'))[_0xb7e6('0x6c')](_0xb7e6('0x6d'),'createdAt')['field'](_0xb7e6('0x6d'),_0xb7e6('0x4c'))[_0xb7e6('0x75')](_0xb7e6('0x6f'))[_0xb7e6('0x36')](_0xb7e6('0x70'))[_0xb7e6('0x36')](_0xb7e6('0x71'),_0x358fdb[_0xb7e6('0x72')][_0xb7e6('0x6e')]())['where'](_0xb7e6('0x73')))[_0xb7e6('0x6e')]();_0x1b820f[_0xb7e6('0x86')](db[_0xb7e6('0x87')][_0xb7e6('0x2c')](_0x1fd311));}return BPromise[_0xb7e6('0x88')](_0x1b820f);}})[_0xb7e6('0x1f')](function(){return _0x2eddfa;})[_0xb7e6('0x1f')](respondWithResult(_0x2d24e1,null))[_0xb7e6('0x3f')](handleError(_0x2d24e1,null));};exports['removeBlackLists']=function(_0xaea02a,_0x339c15,_0x206303){return db[_0xb7e6('0x28')][_0xb7e6('0x46')]({'where':{'id':_0xaea02a[_0xb7e6('0x4f')]['id']}})[_0xb7e6('0x1f')](handleEntityNotFound(_0x339c15,null))[_0xb7e6('0x1f')](function(_0x4214c4){if(_0x4214c4){return _0x4214c4['removeBlackLists'](_0xaea02a[_0xb7e6('0x2c')][_0xb7e6('0x61')]);}})[_0xb7e6('0x1f')](function(_0x2d76d2){if(_0x2d76d2){return db[_0xb7e6('0x5b')][_0xb7e6('0x20')]({'where':{'ListId':_0xaea02a[_0xb7e6('0x2c')][_0xb7e6('0x61')],'CampaignId':_0xaea02a['params']['id']}})[_0xb7e6('0x1f')](function(){return _0x2d76d2;});}})['then'](respondWithStatusCode(_0x339c15,null))[_0xb7e6('0x3f')](handleError(_0x339c15,null));}; \ No newline at end of file +var _0xcc94=['hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','clone','keys','createdAt','updatedAt','omit','UserProfileSection','getHoppers','CmHopper','order','CampaignId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','ids','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','ContactId','ListId','NOW()','field','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','scheduledAt','into','cmHopperId','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','spread','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x2a0b47,_0x32cfbd){var _0x291bf6=function(_0x1382b7){while(--_0x1382b7){_0x2a0b47['push'](_0x2a0b47['shift']());}};_0x291bf6(++_0x32cfbd);}(_0xcc94,0xee));var _0x4cc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc94[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4cc9('0x0'));var zipdir=require(_0x4cc9('0x1'));var jsonpatch=require(_0x4cc9('0x2'));var rp=require(_0x4cc9('0x3'));var moment=require(_0x4cc9('0x4'));var BPromise=require(_0x4cc9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4cc9('0x6'));var sox=require(_0x4cc9('0x7'));var csv=require(_0x4cc9('0x8'));var ejs=require(_0x4cc9('0x9'));var fs=require('fs');var fs_extra=require(_0x4cc9('0xa'));var _=require('lodash');var squel=require(_0x4cc9('0xb'));var crypto=require('crypto');var jsforce=require(_0x4cc9('0xc'));var deskjs=require(_0x4cc9('0xd'));var toCsv=require(_0x4cc9('0x8'));var querystring=require(_0x4cc9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4cc9('0xf'));var qs=require(_0x4cc9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cc9('0x11'));var logger=require(_0x4cc9('0x12'))(_0x4cc9('0x13'));var utils=require(_0x4cc9('0x14'));var config=require(_0x4cc9('0x15'));var licenseUtil=require(_0x4cc9('0x16'));var db=require(_0x4cc9('0x17'))['db'];function respondWithStatusCode(_0x55771d,_0x44609d){_0x44609d=_0x44609d||0xcc;return function(_0x16aa77){if(_0x16aa77){return _0x55771d[_0x4cc9('0x18')](_0x44609d);}return _0x55771d[_0x4cc9('0x19')](_0x44609d)[_0x4cc9('0x1a')]();};}function respondWithResult(_0x3ef4cb,_0x3743ef){_0x3743ef=_0x3743ef||0xc8;return function(_0x378495){if(_0x378495){return _0x3ef4cb[_0x4cc9('0x19')](_0x3743ef)[_0x4cc9('0x1b')](_0x378495);}};}function respondWithFilteredResult(_0x46aa3e,_0x3b6893){return function(_0x2a816e){if(_0x2a816e){var _0x2f2f43=typeof _0x3b6893[_0x4cc9('0x1c')]==='undefined'&&typeof _0x3b6893[_0x4cc9('0x1d')]===_0x4cc9('0x1e');var _0x23b5c7=_0x2a816e['count'];var _0x4b09d3=_0x2f2f43?0x0:_0x3b6893['offset'];var _0x38bbd4=_0x2f2f43?_0x2a816e[_0x4cc9('0x1f')]:_0x3b6893[_0x4cc9('0x1c')]+_0x3b6893['limit'];var _0x58125d;if(_0x38bbd4>=_0x23b5c7){_0x38bbd4=_0x23b5c7;_0x58125d=0xc8;}else{_0x58125d=0xce;}_0x46aa3e[_0x4cc9('0x19')](_0x58125d);return _0x46aa3e[_0x4cc9('0x20')]('Content-Range',_0x4b09d3+'-'+_0x38bbd4+'/'+_0x23b5c7)[_0x4cc9('0x1b')](_0x2a816e);}return null;};}function patchUpdates(_0x40d7f0){return function(_0x95b44d){try{jsonpatch[_0x4cc9('0x21')](_0x95b44d,_0x40d7f0,!![]);}catch(_0x3a788d){return BPromise[_0x4cc9('0x22')](_0x3a788d);}return _0x95b44d[_0x4cc9('0x23')]();};}function saveUpdates(_0x1e81fe,_0x14f8c0){return function(_0x5437a9){if(_0x5437a9){return _0x5437a9['update'](_0x1e81fe)[_0x4cc9('0x24')](function(_0x559979){return _0x559979;});}return null;};}function removeEntity(_0x248745,_0x14fdcd){return function(_0xf4d853){if(_0xf4d853){return _0xf4d853[_0x4cc9('0x25')]()[_0x4cc9('0x24')](function(){var _0x3dabfe=_0xf4d853[_0x4cc9('0x26')]({'plain':!![]});var _0x35077e=_0x4cc9('0x27');return db[_0x4cc9('0x28')][_0x4cc9('0x25')]({'where':{'type':_0x35077e,'resourceId':_0x3dabfe['id']}})[_0x4cc9('0x24')](function(){return _0xf4d853;});})[_0x4cc9('0x24')](function(){_0x248745['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c294,_0x36fc0c){return function(_0x23c1be){if(!_0x23c1be){_0x46c294[_0x4cc9('0x18')](0x194);}return _0x23c1be;};}function handleError(_0x3f842d,_0x315bf4){_0x315bf4=_0x315bf4||0x1f4;return function(_0x248629){logger[_0x4cc9('0x29')](_0x248629[_0x4cc9('0x2a')]);if(_0x248629[_0x4cc9('0x2b')]){delete _0x248629[_0x4cc9('0x2b')];}_0x3f842d[_0x4cc9('0x19')](_0x315bf4)[_0x4cc9('0x2c')](_0x248629);};}exports[_0x4cc9('0x2d')]=function(_0x53783c,_0x1ff7cd){var _0x1953c1={},_0x5d39ac={},_0x586bd1={'count':0x0,'rows':[]};var _0x30fe3a=_[_0x4cc9('0x2e')](db[_0x4cc9('0x2f')]['rawAttributes'],function(_0x1c861c){return{'name':_0x1c861c[_0x4cc9('0x30')],'type':_0x1c861c[_0x4cc9('0x31')][_0x4cc9('0x32')]};});_0x5d39ac[_0x4cc9('0x33')]=_[_0x4cc9('0x2e')](_0x30fe3a,_0x4cc9('0x2b'));_0x5d39ac[_0x4cc9('0x34')]=_['keys'](_0x53783c[_0x4cc9('0x34')]);_0x5d39ac[_0x4cc9('0x35')]=_[_0x4cc9('0x36')](_0x5d39ac['model'],_0x5d39ac[_0x4cc9('0x34')]);_0x1953c1[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x5d39ac[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x53783c[_0x4cc9('0x34')]['fields']));_0x1953c1[_0x4cc9('0x37')]=_0x1953c1[_0x4cc9('0x37')][_0x4cc9('0x39')]?_0x1953c1['attributes']:_0x5d39ac[_0x4cc9('0x33')];if(!_0x53783c[_0x4cc9('0x34')][_0x4cc9('0x3a')](_0x4cc9('0x3b'))){_0x1953c1[_0x4cc9('0x1d')]=qs[_0x4cc9('0x1d')](_0x53783c[_0x4cc9('0x34')]['limit']);_0x1953c1['offset']=qs[_0x4cc9('0x1c')](_0x53783c[_0x4cc9('0x34')][_0x4cc9('0x1c')]);}_0x1953c1['order']=qs[_0x4cc9('0x3c')](_0x53783c['query'][_0x4cc9('0x3c')]);_0x1953c1[_0x4cc9('0x3d')]=qs[_0x4cc9('0x35')](_[_0x4cc9('0x3e')](_0x53783c[_0x4cc9('0x34')],_0x5d39ac[_0x4cc9('0x35')]),_0x30fe3a);if(_0x53783c[_0x4cc9('0x34')]['filter']){_0x1953c1[_0x4cc9('0x3d')]=_[_0x4cc9('0x3f')](_0x1953c1['where'],{'$or':_['map'](_0x30fe3a,function(_0x4e7d00){if(_0x4e7d00[_0x4cc9('0x31')]!==_0x4cc9('0x40')){var _0x49542d={};_0x49542d[_0x4e7d00[_0x4cc9('0x2b')]]={'$like':'%'+_0x53783c['query'][_0x4cc9('0x41')]+'%'};return _0x49542d;}})});}_0x1953c1=_[_0x4cc9('0x3f')]({},_0x1953c1,_0x53783c[_0x4cc9('0x42')]);var _0x1eaba9={'where':_0x1953c1[_0x4cc9('0x3d')]};return db[_0x4cc9('0x2f')][_0x4cc9('0x1f')](_0x1eaba9)[_0x4cc9('0x24')](function(_0x319e54){_0x586bd1[_0x4cc9('0x1f')]=_0x319e54;if(_0x53783c[_0x4cc9('0x34')][_0x4cc9('0x43')]){_0x1953c1[_0x4cc9('0x44')]=[{'all':!![]}];}return db[_0x4cc9('0x2f')][_0x4cc9('0x45')](_0x1953c1);})[_0x4cc9('0x24')](function(_0x5a6bd8){_0x586bd1[_0x4cc9('0x46')]=_0x5a6bd8;return _0x586bd1;})[_0x4cc9('0x24')](respondWithFilteredResult(_0x1ff7cd,_0x1953c1))[_0x4cc9('0x47')](handleError(_0x1ff7cd,null));};exports[_0x4cc9('0x48')]=function(_0x1e8b71,_0x316b92){var _0x1a52c0={'raw':![],'where':{'id':_0x1e8b71[_0x4cc9('0x49')]['id']}},_0x3012eb={};_0x3012eb['model']=_['keys'](db[_0x4cc9('0x2f')][_0x4cc9('0x4a')]);_0x3012eb[_0x4cc9('0x34')]=_['keys'](_0x1e8b71['query']);_0x3012eb[_0x4cc9('0x35')]=_[_0x4cc9('0x36')](_0x3012eb[_0x4cc9('0x33')],_0x3012eb[_0x4cc9('0x34')]);_0x1a52c0[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x3012eb[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x1e8b71['query'][_0x4cc9('0x38')]));_0x1a52c0['attributes']=_0x1a52c0[_0x4cc9('0x37')][_0x4cc9('0x39')]?_0x1a52c0['attributes']:_0x3012eb[_0x4cc9('0x33')];if(_0x1e8b71['query'][_0x4cc9('0x43')]){_0x1a52c0[_0x4cc9('0x44')]=[{'all':!![]}];}_0x1a52c0=_[_0x4cc9('0x3f')]({},_0x1a52c0,_0x1e8b71[_0x4cc9('0x42')]);return db['Campaign']['find'](_0x1a52c0)['then'](handleEntityNotFound(_0x316b92,null))['then'](respondWithResult(_0x316b92,null))[_0x4cc9('0x47')](handleError(_0x316b92,null));};exports[_0x4cc9('0x4b')]=function(_0x53823a,_0x4e9309){return db[_0x4cc9('0x2f')][_0x4cc9('0x4b')](_0x53823a[_0x4cc9('0x4c')],{})[_0x4cc9('0x24')](function(_0x27a3e6){var _0x2b3c88=_0x53823a[_0x4cc9('0x4d')][_0x4cc9('0x26')]({'plain':!![]});if(!_0x2b3c88)throw new Error(_0x4cc9('0x4e'));if(_0x2b3c88[_0x4cc9('0x4f')]===_0x4cc9('0x4d')){var _0x12c169=_0x27a3e6[_0x4cc9('0x26')]({'plain':!![]});var _0x440f12=_0x4cc9('0x27');return db['UserProfileSection'][_0x4cc9('0x50')]({'where':{'name':_0x440f12,'userProfileId':_0x2b3c88[_0x4cc9('0x51')]},'raw':!![]})[_0x4cc9('0x24')](function(_0x3b61eb){if(_0x3b61eb&&_0x3b61eb[_0x4cc9('0x52')]===0x0){return db[_0x4cc9('0x28')]['create']({'name':_0x12c169[_0x4cc9('0x2b')],'resourceId':_0x12c169['id'],'type':_0x3b61eb['name'],'sectionId':_0x3b61eb['id']},{})[_0x4cc9('0x24')](function(){return _0x27a3e6;});}else{return _0x27a3e6;}})[_0x4cc9('0x47')](function(_0x2cf8c4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cf8c4);throw _0x2cf8c4;});}return _0x27a3e6;})['then'](respondWithResult(_0x4e9309,0xc9))['catch'](handleError(_0x4e9309,null));};exports[_0x4cc9('0x53')]=function(_0x506069,_0x48cb97){var _0x4a720f={'where':{'id':_0x506069[_0x4cc9('0x49')]['id']}},_0x1938b6={};_0x1938b6['model']=_[_0x4cc9('0x54')](db[_0x4cc9('0x2f')][_0x4cc9('0x4a')]);_0x4a720f[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x1938b6['model'],qs['fields'](_0x506069['query']['fields']));_0x4a720f[_0x4cc9('0x37')]=_0x4a720f['attributes']['length']?_0x4a720f[_0x4cc9('0x37')]:_0x1938b6[_0x4cc9('0x33')];if(_0x506069[_0x4cc9('0x34')][_0x4cc9('0x43')]){_0x4a720f[_0x4cc9('0x44')]=[{'all':!![]}];}_0x4a720f=_['merge']({},_0x4a720f,_0x506069[_0x4cc9('0x42')]);return db[_0x4cc9('0x2f')][_0x4cc9('0x50')](_0x4a720f)[_0x4cc9('0x24')](handleEntityNotFound(_0x48cb97,null))[_0x4cc9('0x24')](function(_0x4cf26e){if(_0x4cf26e){var _0x5e6aed=_0x4cf26e['get']({'plain':!![]});_0x5e6aed=qs['omit'](_0x5e6aed,['id',_0x4cc9('0x55'),_0x4cc9('0x56')]);_0x506069[_0x4cc9('0x4c')]=_[_0x4cc9('0x57')](_0x506069[_0x4cc9('0x4c')],['id','createdAt','updatedAt']);return db['Campaign'][_0x4cc9('0x4b')](_[_0x4cc9('0x3f')](_0x5e6aed,_0x506069[_0x4cc9('0x4c')]),{'include':_0x506069[_0x4cc9('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x4cc9('0x24')](function(_0x20e7a7){var _0x5a2593=_0x506069[_0x4cc9('0x4d')][_0x4cc9('0x26')]({'plain':!![]});if(!_0x5a2593)throw new Error(_0x4cc9('0x4e'));if(_0x5a2593['role']===_0x4cc9('0x4d')){var _0x452e1f=_0x20e7a7[_0x4cc9('0x26')]({'plain':!![]});var _0x53d0dd='IvrCampaigns';return db[_0x4cc9('0x58')][_0x4cc9('0x50')]({'where':{'name':_0x53d0dd,'userProfileId':_0x5a2593[_0x4cc9('0x51')]},'raw':!![]})[_0x4cc9('0x24')](function(_0x40567c){if(_0x40567c&&_0x40567c[_0x4cc9('0x52')]===0x0){return db['UserProfileResource'][_0x4cc9('0x4b')]({'name':_0x452e1f[_0x4cc9('0x2b')],'resourceId':_0x452e1f['id'],'type':_0x40567c[_0x4cc9('0x2b')],'sectionId':_0x40567c['id']},{})[_0x4cc9('0x24')](function(){return _0x20e7a7;});}else{return _0x20e7a7;}})[_0x4cc9('0x47')](function(_0x2a2787){logger[_0x4cc9('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a2787);throw _0x2a2787;});}return _0x20e7a7;});}})[_0x4cc9('0x24')](respondWithResult(_0x48cb97,0xc9))[_0x4cc9('0x47')](handleError(_0x48cb97,null));};exports['update']=function(_0x1363a4,_0x14610f){if(_0x1363a4[_0x4cc9('0x4c')]['id']){delete _0x1363a4[_0x4cc9('0x4c')]['id'];}return db['Campaign'][_0x4cc9('0x50')]({'where':{'id':_0x1363a4[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x14610f,null))[_0x4cc9('0x24')](saveUpdates(_0x1363a4[_0x4cc9('0x4c')],null))[_0x4cc9('0x24')](respondWithResult(_0x14610f,null))[_0x4cc9('0x47')](handleError(_0x14610f,null));};exports['destroy']=function(_0x1e2c72,_0x41723e){return db['Campaign'][_0x4cc9('0x50')]({'where':{'id':_0x1e2c72['params']['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x41723e,null))[_0x4cc9('0x24')](removeEntity(_0x41723e,null))['catch'](handleError(_0x41723e,null));};exports[_0x4cc9('0x59')]=function(_0x30f1c1,_0x5c1ace,_0x5b22f2){var _0x42bd80={'raw':!![],'where':{}};var _0x3f400f={};var _0x59d269={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x30f1c1['params']['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x5c1ace,null))[_0x4cc9('0x24')](function(_0x2376dc){if(_0x2376dc){_0x3f400f[_0x4cc9('0x33')]=_['keys'](db[_0x4cc9('0x5a')]['rawAttributes']);_0x3f400f[_0x4cc9('0x34')]=_['keys'](_0x30f1c1[_0x4cc9('0x34')]);_0x3f400f[_0x4cc9('0x35')]=_[_0x4cc9('0x36')](_0x3f400f[_0x4cc9('0x33')],_0x3f400f[_0x4cc9('0x34')]);_0x42bd80[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x3f400f[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x30f1c1[_0x4cc9('0x34')][_0x4cc9('0x38')]));_0x42bd80[_0x4cc9('0x37')]=_0x42bd80['attributes'][_0x4cc9('0x39')]?_0x42bd80[_0x4cc9('0x37')]:_0x3f400f[_0x4cc9('0x33')];if(!_0x30f1c1[_0x4cc9('0x34')][_0x4cc9('0x3a')](_0x4cc9('0x3b'))){_0x42bd80[_0x4cc9('0x1d')]=qs[_0x4cc9('0x1d')](_0x30f1c1[_0x4cc9('0x34')]['limit']);_0x42bd80[_0x4cc9('0x1c')]=qs['offset'](_0x30f1c1[_0x4cc9('0x34')][_0x4cc9('0x1c')]);}_0x42bd80[_0x4cc9('0x5b')]=qs[_0x4cc9('0x3c')](_0x30f1c1[_0x4cc9('0x34')]['sort']);_0x42bd80[_0x4cc9('0x3d')]=qs[_0x4cc9('0x35')](_['pick'](_0x30f1c1[_0x4cc9('0x34')],_0x3f400f[_0x4cc9('0x35')]));_0x42bd80[_0x4cc9('0x3d')][_0x4cc9('0x5c')]=_0x2376dc['id'];if(_0x30f1c1[_0x4cc9('0x34')][_0x4cc9('0x41')]){_0x42bd80[_0x4cc9('0x3d')]=_[_0x4cc9('0x3f')](_0x42bd80[_0x4cc9('0x3d')],{'$or':_[_0x4cc9('0x2e')](_0x42bd80[_0x4cc9('0x37')],function(_0x250633){var _0x332e85={};_0x332e85[_0x250633]={'$like':'%'+_0x30f1c1['query'][_0x4cc9('0x41')]+'%'};return _0x332e85;})});}_0x42bd80=_[_0x4cc9('0x3f')]({},_0x42bd80,_0x30f1c1[_0x4cc9('0x42')]);return db['CmHopper']['count']({'where':_0x42bd80[_0x4cc9('0x3d')]})['then'](function(_0x42cbaa){_0x59d269[_0x4cc9('0x1f')]=_0x42cbaa;if(_0x30f1c1[_0x4cc9('0x34')][_0x4cc9('0x43')]){_0x42bd80[_0x4cc9('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x42bd80);})['then'](function(_0x34113c){_0x59d269[_0x4cc9('0x46')]=_0x34113c;return _0x59d269;});}})[_0x4cc9('0x24')](respondWithFilteredResult(_0x5c1ace,_0x42bd80))[_0x4cc9('0x47')](handleError(_0x5c1ace,null));};exports['getHopperHistories']=function(_0x162e06,_0x54756c,_0x4e7914){var _0x4c9f2b={'raw':!![],'where':{}};var _0x736c54={};var _0x39f37d={'count':0x0,'rows':[]};return db['Campaign'][_0x4cc9('0x5d')]({'where':{'id':_0x162e06[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x54756c,null))[_0x4cc9('0x24')](function(_0x3f2bd3){if(_0x3f2bd3){_0x736c54[_0x4cc9('0x33')]=_[_0x4cc9('0x54')](db['CmHopperHistory'][_0x4cc9('0x4a')]);_0x736c54['query']=_['keys'](_0x162e06[_0x4cc9('0x34')]);_0x736c54['filters']=_[_0x4cc9('0x36')](_0x736c54[_0x4cc9('0x33')],_0x736c54[_0x4cc9('0x34')]);_0x4c9f2b[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x736c54[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x162e06['query'][_0x4cc9('0x38')]));_0x4c9f2b[_0x4cc9('0x37')]=_0x4c9f2b[_0x4cc9('0x37')][_0x4cc9('0x39')]?_0x4c9f2b['attributes']:_0x736c54[_0x4cc9('0x33')];if(!_0x162e06['query'][_0x4cc9('0x3a')]('nolimit')){_0x4c9f2b[_0x4cc9('0x1d')]=qs[_0x4cc9('0x1d')](_0x162e06[_0x4cc9('0x34')]['limit']);_0x4c9f2b[_0x4cc9('0x1c')]=qs[_0x4cc9('0x1c')](_0x162e06['query'][_0x4cc9('0x1c')]);}_0x4c9f2b[_0x4cc9('0x5b')]=qs['sort'](_0x162e06[_0x4cc9('0x34')]['sort']);_0x4c9f2b[_0x4cc9('0x3d')]=qs[_0x4cc9('0x35')](_['pick'](_0x162e06[_0x4cc9('0x34')],_0x736c54['filters']));_0x4c9f2b['where'][_0x4cc9('0x5c')]=_0x3f2bd3['id'];if(_0x162e06[_0x4cc9('0x34')][_0x4cc9('0x41')]){_0x4c9f2b[_0x4cc9('0x3d')]=_[_0x4cc9('0x3f')](_0x4c9f2b['where'],{'$or':_[_0x4cc9('0x2e')](_0x4c9f2b[_0x4cc9('0x37')],function(_0x3e5c8d){var _0x42b691={};_0x42b691[_0x3e5c8d]={'$like':'%'+_0x162e06['query'][_0x4cc9('0x41')]+'%'};return _0x42b691;})});}_0x4c9f2b=_[_0x4cc9('0x3f')]({},_0x4c9f2b,_0x162e06[_0x4cc9('0x42')]);return db[_0x4cc9('0x5e')][_0x4cc9('0x1f')]({'where':_0x4c9f2b['where']})[_0x4cc9('0x24')](function(_0x3f1230){_0x39f37d[_0x4cc9('0x1f')]=_0x3f1230;if(_0x162e06['query'][_0x4cc9('0x43')]){_0x4c9f2b[_0x4cc9('0x44')]=[{'all':!![]}];}return db[_0x4cc9('0x5e')][_0x4cc9('0x45')](_0x4c9f2b);})['then'](function(_0x1c334c){_0x39f37d[_0x4cc9('0x46')]=_0x1c334c;return _0x39f37d;});}})[_0x4cc9('0x24')](respondWithFilteredResult(_0x54756c,_0x4c9f2b))[_0x4cc9('0x47')](handleError(_0x54756c,null));};exports[_0x4cc9('0x5f')]=function(_0x3a2c9d,_0x499d84,_0xc36a49){var _0x133b7f={'raw':!![],'where':{}};var _0x19c90e={};var _0x44693e={'count':0x0,'rows':[]};return db[_0x4cc9('0x2f')][_0x4cc9('0x5d')]({'where':{'id':_0x3a2c9d[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x499d84,null))[_0x4cc9('0x24')](function(_0x3c69e9){if(_0x3c69e9){_0x19c90e[_0x4cc9('0x33')]=_[_0x4cc9('0x54')](db[_0x4cc9('0x60')][_0x4cc9('0x4a')]);_0x19c90e[_0x4cc9('0x34')]=_['keys'](_0x3a2c9d['query']);_0x19c90e[_0x4cc9('0x35')]=_['intersection'](_0x19c90e[_0x4cc9('0x33')],_0x19c90e[_0x4cc9('0x34')]);_0x133b7f[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x19c90e[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x38')]));_0x133b7f['attributes']=_0x133b7f[_0x4cc9('0x37')][_0x4cc9('0x39')]?_0x133b7f['attributes']:_0x19c90e[_0x4cc9('0x33')];if(!_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x3a')](_0x4cc9('0x3b'))){_0x133b7f[_0x4cc9('0x1d')]=qs['limit'](_0x3a2c9d[_0x4cc9('0x34')]['limit']);_0x133b7f['offset']=qs[_0x4cc9('0x1c')](_0x3a2c9d['query'][_0x4cc9('0x1c')]);}_0x133b7f[_0x4cc9('0x5b')]=qs[_0x4cc9('0x3c')](_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x3c')]);_0x133b7f[_0x4cc9('0x3d')]=qs['filters'](_[_0x4cc9('0x3e')](_0x3a2c9d[_0x4cc9('0x34')],_0x19c90e['filters']));_0x133b7f[_0x4cc9('0x3d')]['CampaignId']=_0x3c69e9['id'];if(_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x41')]){_0x133b7f[_0x4cc9('0x3d')]=_['merge'](_0x133b7f[_0x4cc9('0x3d')],{'$or':_['map'](_0x133b7f[_0x4cc9('0x37')],function(_0x458e16){var _0x163313={};_0x163313[_0x458e16]={'$like':'%'+_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x41')]+'%'};return _0x163313;})});}_0x133b7f=_[_0x4cc9('0x3f')]({},_0x133b7f,_0x3a2c9d[_0x4cc9('0x42')]);return db[_0x4cc9('0x60')][_0x4cc9('0x1f')]({'where':_0x133b7f[_0x4cc9('0x3d')]})['then'](function(_0x2ec8b2){_0x44693e[_0x4cc9('0x1f')]=_0x2ec8b2;if(_0x3a2c9d[_0x4cc9('0x34')][_0x4cc9('0x43')]){_0x133b7f['include']=[{'all':!![]}];}return db[_0x4cc9('0x60')]['findAll'](_0x133b7f);})[_0x4cc9('0x24')](function(_0x21418a){_0x44693e[_0x4cc9('0x46')]=_0x21418a;return _0x44693e;});}})[_0x4cc9('0x24')](respondWithFilteredResult(_0x499d84,_0x133b7f))['catch'](handleError(_0x499d84,null));};exports[_0x4cc9('0x61')]=function(_0x30b91e,_0x4955de,_0x21a05c){var _0x589f8c={'raw':!![],'where':{}};var _0x47bec7={};var _0x510bf1={'count':0x0,'rows':[]};return db[_0x4cc9('0x2f')][_0x4cc9('0x5d')]({'where':{'id':_0x30b91e['params']['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x4955de,null))[_0x4cc9('0x24')](function(_0x9796ca){if(_0x9796ca){_0x47bec7['model']=_[_0x4cc9('0x54')](db['CmHopperBlack'][_0x4cc9('0x4a')]);_0x47bec7[_0x4cc9('0x34')]=_['keys'](_0x30b91e['query']);_0x47bec7[_0x4cc9('0x35')]=_['intersection'](_0x47bec7[_0x4cc9('0x33')],_0x47bec7[_0x4cc9('0x34')]);_0x589f8c[_0x4cc9('0x37')]=_[_0x4cc9('0x36')](_0x47bec7[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x30b91e[_0x4cc9('0x34')]['fields']));_0x589f8c[_0x4cc9('0x37')]=_0x589f8c[_0x4cc9('0x37')]['length']?_0x589f8c['attributes']:_0x47bec7[_0x4cc9('0x33')];if(!_0x30b91e[_0x4cc9('0x34')]['hasOwnProperty'](_0x4cc9('0x3b'))){_0x589f8c[_0x4cc9('0x1d')]=qs[_0x4cc9('0x1d')](_0x30b91e[_0x4cc9('0x34')][_0x4cc9('0x1d')]);_0x589f8c[_0x4cc9('0x1c')]=qs[_0x4cc9('0x1c')](_0x30b91e[_0x4cc9('0x34')][_0x4cc9('0x1c')]);}_0x589f8c[_0x4cc9('0x5b')]=qs[_0x4cc9('0x3c')](_0x30b91e['query']['sort']);_0x589f8c['where']=qs[_0x4cc9('0x35')](_['pick'](_0x30b91e[_0x4cc9('0x34')],_0x47bec7['filters']));_0x589f8c[_0x4cc9('0x3d')][_0x4cc9('0x5c')]=_0x9796ca['id'];if(_0x30b91e[_0x4cc9('0x34')][_0x4cc9('0x41')]){_0x589f8c['where']=_[_0x4cc9('0x3f')](_0x589f8c['where'],{'$or':_['map'](_0x589f8c[_0x4cc9('0x37')],function(_0x19834a){var _0x130056={};_0x130056[_0x19834a]={'$like':'%'+_0x30b91e[_0x4cc9('0x34')][_0x4cc9('0x41')]+'%'};return _0x130056;})});}_0x589f8c=_[_0x4cc9('0x3f')]({},_0x589f8c,_0x30b91e['options']);return db[_0x4cc9('0x62')]['count']({'where':_0x589f8c[_0x4cc9('0x3d')]})['then'](function(_0x4057ba){_0x510bf1['count']=_0x4057ba;if(_0x30b91e[_0x4cc9('0x34')][_0x4cc9('0x43')]){_0x589f8c['include']=[{'all':!![]}];}return db[_0x4cc9('0x62')][_0x4cc9('0x45')](_0x589f8c);})[_0x4cc9('0x24')](function(_0x595d3f){_0x510bf1[_0x4cc9('0x46')]=_0x595d3f;return _0x510bf1;});}})['then'](respondWithFilteredResult(_0x4955de,_0x589f8c))[_0x4cc9('0x47')](handleError(_0x4955de,null));};exports[_0x4cc9('0x63')]=function(_0x289516,_0x166191,_0x1b9572){var _0x4b4a01={};var _0x2c8fff={};var _0xb0fe44;var _0xc8aaa0;return db[_0x4cc9('0x2f')][_0x4cc9('0x5d')]({'where':{'id':_0x289516[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x166191,null))[_0x4cc9('0x24')](function(_0x5dce80){if(_0x5dce80){_0xb0fe44=_0x5dce80;_0x2c8fff[_0x4cc9('0x33')]=_[_0x4cc9('0x54')](db[_0x4cc9('0x64')][_0x4cc9('0x4a')]);_0x2c8fff[_0x4cc9('0x34')]=_['keys'](_0x289516[_0x4cc9('0x34')]);_0x2c8fff[_0x4cc9('0x35')]=_[_0x4cc9('0x36')](_0x2c8fff[_0x4cc9('0x33')],_0x2c8fff[_0x4cc9('0x34')]);_0x4b4a01['attributes']=_[_0x4cc9('0x36')](_0x2c8fff[_0x4cc9('0x33')],qs[_0x4cc9('0x38')](_0x289516[_0x4cc9('0x34')][_0x4cc9('0x38')]));_0x4b4a01[_0x4cc9('0x37')]=_0x4b4a01[_0x4cc9('0x37')]['length']?_0x4b4a01[_0x4cc9('0x37')]:_0x2c8fff[_0x4cc9('0x33')];_0x4b4a01['order']=qs[_0x4cc9('0x3c')](_0x289516[_0x4cc9('0x34')]['sort']);_0x4b4a01[_0x4cc9('0x3d')]=qs[_0x4cc9('0x35')](_[_0x4cc9('0x3e')](_0x289516['query'],_0x2c8fff[_0x4cc9('0x35')]));if(_0x289516[_0x4cc9('0x34')][_0x4cc9('0x41')]){_0x4b4a01['where']=_[_0x4cc9('0x3f')](_0x4b4a01[_0x4cc9('0x3d')],{'$or':_['map'](_0x4b4a01[_0x4cc9('0x37')],function(_0x35d042){var _0x2cb27d={};_0x2cb27d[_0x35d042]={'$like':'%'+_0x289516[_0x4cc9('0x34')][_0x4cc9('0x41')]+'%'};return _0x2cb27d;})});}_0x4b4a01=_['merge']({},_0x4b4a01,_0x289516[_0x4cc9('0x42')]);return _0xb0fe44[_0x4cc9('0x63')](_0x4b4a01);}})[_0x4cc9('0x24')](function(_0x459ace){if(_0x459ace){_0xc8aaa0=_0x459ace['length'];if(!_0x289516['query'][_0x4cc9('0x3a')](_0x4cc9('0x3b'))){_0x4b4a01['limit']=qs[_0x4cc9('0x1d')](_0x289516[_0x4cc9('0x34')][_0x4cc9('0x1d')]);_0x4b4a01['offset']=qs[_0x4cc9('0x1c')](_0x289516['query'][_0x4cc9('0x1c')]);}return _0xb0fe44[_0x4cc9('0x63')](_0x4b4a01);}})[_0x4cc9('0x24')](function(_0x40979b){if(_0x40979b){return _0x40979b?{'count':_0xc8aaa0,'rows':_0x40979b}:null;}})['then'](respondWithResult(_0x166191,null))[_0x4cc9('0x47')](handleError(_0x166191,null));};exports['addLists']=function(_0x53bcfc,_0x3801fe,_0x74cb4e){var _0x3490a3,_0x2bd7de;var _0x208a58=[];var _0x274269=moment()[_0x4cc9('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x4cc9('0x2f')][_0x4cc9('0x50')]({'where':{'id':_0x53bcfc[_0x4cc9('0x49')]['id']}})['then'](handleEntityNotFound(_0x3801fe,null))[_0x4cc9('0x24')](function(_0x8f1c4a){if(_0x8f1c4a){_0x2bd7de=_0x8f1c4a;return _0x8f1c4a['addLists'](_0x53bcfc[_0x4cc9('0x4c')][_0x4cc9('0x66')],_[_0x4cc9('0x57')](_0x53bcfc['body'],['ids','id'])||{});}return null;})['spread'](function(_0x3b63e3){var _0x100565;var _0x555699;_0x3490a3=_0x3b63e3||[];var _0x2db722=[];if(_0x3b63e3){for(var _0x44e695=0x0;_0x44e695<_0x3b63e3[_0x4cc9('0x39')];_0x44e695+=0x1){var _0x35cf7c=_0x3b63e3[_0x44e695][_0x4cc9('0x26')]({'plain':!![]});_0x2bd7de[_0x4cc9('0x67')]=_0x53bcfc['body']['dialCheckDuplicateType']?_0x53bcfc[_0x4cc9('0x4c')][_0x4cc9('0x67')]:_0x2bd7de[_0x4cc9('0x67')];switch(_0x2bd7de['dialCheckDuplicateType']){case'always':_0x100565=squel[_0x4cc9('0x68')]()['into'](_0x4cc9('0x69'))[_0x4cc9('0x6a')]([_0x4cc9('0x6b'),'scheduledAt',_0x4cc9('0x6c'),_0x4cc9('0x6d'),'CampaignId',_0x4cc9('0x55'),'updatedAt'],squel['select']()['field'](_0x4cc9('0x6b'),'phone')['field'](_0x4cc9('0x6e'),'scheduledAt')[_0x4cc9('0x6f')]('id',_0x4cc9('0x6c'))[_0x4cc9('0x6f')](_0x35cf7c[_0x4cc9('0x70')][_0x4cc9('0x71')](),_0x4cc9('0x6d'))[_0x4cc9('0x6f')](_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')](),_0x4cc9('0x5c'))[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27','createdAt')['field']('\x27'+_0x274269+'\x27','updatedAt')['from'](_0x4cc9('0x72'))[_0x4cc9('0x3d')](_0x4cc9('0x73'))[_0x4cc9('0x3d')](_0x4cc9('0x74'),_0x35cf7c[_0x4cc9('0x70')]['toString']())[_0x4cc9('0x3d')](_0x4cc9('0x75'))[_0x4cc9('0x3d')](_0x4cc9('0x76'),squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')](_0x4cc9('0x78'))['from'](_0x4cc9('0x79'))['where'](_0x4cc9('0x7a'),_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')]()))[_0x4cc9('0x3d')](_0x4cc9('0x76'),squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')](_0x4cc9('0x7b'))[_0x4cc9('0x7c')](_0x4cc9('0x69'))['where']('CampaignId\x20=\x20?',_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')]())))[_0x4cc9('0x71')]();break;case _0x4cc9('0x7d'):_0x100565=squel[_0x4cc9('0x68')]()['into'](_0x4cc9('0x69'))['fromQuery']([_0x4cc9('0x6b'),_0x4cc9('0x7e'),'ContactId',_0x4cc9('0x6d'),_0x4cc9('0x5c'),_0x4cc9('0x55'),'updatedAt'],squel['select']()[_0x4cc9('0x6f')](_0x4cc9('0x6b'),'phone')[_0x4cc9('0x6f')](_0x4cc9('0x6e'),'scheduledAt')[_0x4cc9('0x6f')]('id',_0x4cc9('0x6c'))[_0x4cc9('0x6f')](_0x35cf7c[_0x4cc9('0x70')][_0x4cc9('0x71')](),_0x4cc9('0x6d'))[_0x4cc9('0x6f')](_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')](),_0x4cc9('0x5c'))[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x55'))[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x56'))[_0x4cc9('0x7c')]('cm_contacts')['where'](_0x4cc9('0x73'))['where'](_0x4cc9('0x74'),_0x35cf7c[_0x4cc9('0x70')]['toString']())['where'](_0x4cc9('0x75'))[_0x4cc9('0x3d')](_0x4cc9('0x76'),squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')](_0x4cc9('0x7b'))[_0x4cc9('0x7c')](_0x4cc9('0x69'))['where']('CampaignId\x20=\x20?',_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')]())))['toString']();break;default:_0x100565=squel['insert']()[_0x4cc9('0x7f')](_0x4cc9('0x69'))[_0x4cc9('0x6a')]([_0x4cc9('0x6b'),'scheduledAt',_0x4cc9('0x6c'),'ListId',_0x4cc9('0x5c'),_0x4cc9('0x55'),'updatedAt'],squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')]('phone','phone')[_0x4cc9('0x6f')]('NOW()','scheduledAt')['field']('id',_0x4cc9('0x6c'))[_0x4cc9('0x6f')](_0x35cf7c[_0x4cc9('0x70')][_0x4cc9('0x71')](),'ListId')[_0x4cc9('0x6f')](_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')](),'CampaignId')[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x55'))[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x56'))[_0x4cc9('0x7c')](_0x4cc9('0x72'))[_0x4cc9('0x3d')](_0x4cc9('0x73'))['where'](_0x4cc9('0x74'),_0x35cf7c['CmListId'][_0x4cc9('0x71')]())[_0x4cc9('0x3d')](_0x4cc9('0x75')))[_0x4cc9('0x71')]();}_0x555699=squel[_0x4cc9('0x68')]()[_0x4cc9('0x7f')]('cm_hopper_additional_phones')[_0x4cc9('0x6a')]([_0x4cc9('0x80'),_0x4cc9('0x7e'),_0x4cc9('0x6b'),'OrderBy',_0x4cc9('0x55'),_0x4cc9('0x56')],squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')](_0x4cc9('0x81'),'id')[_0x4cc9('0x6f')]('NOW()',_0x4cc9('0x7e'))[_0x4cc9('0x6f')](_0x4cc9('0x82'),_0x4cc9('0x6b'))[_0x4cc9('0x6f')](_0x4cc9('0x83'),'OrderBy')[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x55'))[_0x4cc9('0x6f')]('\x27'+_0x274269+'\x27',_0x4cc9('0x56'))['from'](_0x4cc9('0x84'),'ci')[_0x4cc9('0x85')]('cm_hopper','h',_0x4cc9('0x86'))[_0x4cc9('0x3d')](_0x4cc9('0x87'),_0x35cf7c['CmListId'][_0x4cc9('0x71')]())[_0x4cc9('0x3d')](_0x4cc9('0x88'),_0x53bcfc[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')]())[_0x4cc9('0x3d')](_0x4cc9('0x89'),_0x274269))[_0x4cc9('0x71')]();_0x2db722[_0x4cc9('0x8a')](db[_0x4cc9('0x8b')]['query'](_0x100565));_0x208a58[_0x4cc9('0x8a')](db[_0x4cc9('0x8b')][_0x4cc9('0x34')](_0x555699));}return BPromise[_0x4cc9('0x8c')](_0x2db722);}})[_0x4cc9('0x24')](function(){return BPromise[_0x4cc9('0x8c')](_0x208a58);})['then'](function(){return _0x3490a3;})['then'](respondWithResult(_0x3801fe,null))[_0x4cc9('0x47')](handleError(_0x3801fe,null));};exports[_0x4cc9('0x8d')]=function(_0x2a983f,_0x36ab09,_0x5914da){return db['Campaign'][_0x4cc9('0x50')]({'where':{'id':_0x2a983f[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x36ab09,null))['then'](function(_0x481579){if(_0x481579){return _0x481579[_0x4cc9('0x8d')](_0x2a983f[_0x4cc9('0x34')]['ids']);}})['then'](function(_0x1735a9){if(_0x1735a9){return db[_0x4cc9('0x5a')][_0x4cc9('0x25')]({'where':{'ListId':_0x2a983f[_0x4cc9('0x34')]['ids'],'CampaignId':_0x2a983f[_0x4cc9('0x49')]['id']}})['then'](function(){return _0x1735a9;});}})[_0x4cc9('0x24')](respondWithStatusCode(_0x36ab09,null))[_0x4cc9('0x47')](handleError(_0x36ab09,null));};exports[_0x4cc9('0x8e')]=function(_0x48cad6,_0x331cf8,_0x5e45b6){var _0x595225={};var _0x4321e2={};var _0x4d52a1;var _0x73cf25;return db[_0x4cc9('0x2f')][_0x4cc9('0x5d')]({'where':{'id':_0x48cad6[_0x4cc9('0x49')]['id']}})['then'](handleEntityNotFound(_0x331cf8,null))[_0x4cc9('0x24')](function(_0x5cf0a1){if(_0x5cf0a1){_0x4d52a1=_0x5cf0a1;_0x4321e2[_0x4cc9('0x33')]=_[_0x4cc9('0x54')](db[_0x4cc9('0x64')][_0x4cc9('0x4a')]);_0x4321e2[_0x4cc9('0x34')]=_['keys'](_0x48cad6['query']);_0x4321e2[_0x4cc9('0x35')]=_[_0x4cc9('0x36')](_0x4321e2[_0x4cc9('0x33')],_0x4321e2[_0x4cc9('0x34')]);_0x595225['attributes']=_['intersection'](_0x4321e2[_0x4cc9('0x33')],qs['fields'](_0x48cad6[_0x4cc9('0x34')][_0x4cc9('0x38')]));_0x595225[_0x4cc9('0x37')]=_0x595225[_0x4cc9('0x37')]['length']?_0x595225['attributes']:_0x4321e2[_0x4cc9('0x33')];_0x595225['order']=qs[_0x4cc9('0x3c')](_0x48cad6[_0x4cc9('0x34')][_0x4cc9('0x3c')]);_0x595225[_0x4cc9('0x3d')]=qs[_0x4cc9('0x35')](_['pick'](_0x48cad6[_0x4cc9('0x34')],_0x4321e2[_0x4cc9('0x35')]));if(_0x48cad6['query'][_0x4cc9('0x41')]){_0x595225['where']=_[_0x4cc9('0x3f')](_0x595225[_0x4cc9('0x3d')],{'$or':_[_0x4cc9('0x2e')](_0x595225['attributes'],function(_0x9d8eec){var _0x55d209={};_0x55d209[_0x9d8eec]={'$like':'%'+_0x48cad6[_0x4cc9('0x34')][_0x4cc9('0x41')]+'%'};return _0x55d209;})});}_0x595225=_[_0x4cc9('0x3f')]({},_0x595225,_0x48cad6[_0x4cc9('0x42')]);return _0x4d52a1[_0x4cc9('0x8e')](_0x595225);}})[_0x4cc9('0x24')](function(_0x15427f){if(_0x15427f){_0x73cf25=_0x15427f['length'];if(!_0x48cad6[_0x4cc9('0x34')][_0x4cc9('0x3a')]('nolimit')){_0x595225[_0x4cc9('0x1d')]=qs[_0x4cc9('0x1d')](_0x48cad6[_0x4cc9('0x34')][_0x4cc9('0x1d')]);_0x595225['offset']=qs[_0x4cc9('0x1c')](_0x48cad6[_0x4cc9('0x34')]['offset']);}return _0x4d52a1[_0x4cc9('0x8e')](_0x595225);}})['then'](function(_0x12c784){if(_0x12c784){return _0x12c784?{'count':_0x73cf25,'rows':_0x12c784}:null;}})[_0x4cc9('0x24')](respondWithResult(_0x331cf8,null))[_0x4cc9('0x47')](handleError(_0x331cf8,null));};exports[_0x4cc9('0x8f')]=function(_0x124f75,_0x2b51c3,_0x42f076){var _0x1264cd,_0x4a3c95;var _0x37a374=[];var _0x4332fd=moment()[_0x4cc9('0x65')](_0x4cc9('0x90'));return db[_0x4cc9('0x2f')]['find']({'where':{'id':_0x124f75[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](handleEntityNotFound(_0x2b51c3,null))['then'](function(_0xa7a1bc){if(_0xa7a1bc){_0x4a3c95=_0xa7a1bc;return _0xa7a1bc[_0x4cc9('0x8f')](_0x124f75[_0x4cc9('0x4c')]['ids'],_[_0x4cc9('0x57')](_0x124f75['body'],[_0x4cc9('0x66'),'id'])||{});}return null;})[_0x4cc9('0x91')](function(_0x5e1db9){var _0xd538d4;var _0x3db6be;_0x1264cd=_0x5e1db9||[];var _0x54305f=[];if(_0x5e1db9){for(var _0x33abc7=0x0;_0x33abc7<_0x5e1db9[_0x4cc9('0x39')];_0x33abc7+=0x1){var _0x2a77f0=_0x5e1db9[_0x33abc7]['get']({'plain':!![]});_0xd538d4=squel['insert']()[_0x4cc9('0x7f')](_0x4cc9('0x92'))[_0x4cc9('0x6a')]([_0x4cc9('0x6b'),_0x4cc9('0x6c'),_0x4cc9('0x6d'),_0x4cc9('0x5c'),_0x4cc9('0x55'),_0x4cc9('0x56')],squel[_0x4cc9('0x77')]()[_0x4cc9('0x6f')](_0x4cc9('0x6b'),_0x4cc9('0x6b'))[_0x4cc9('0x6f')]('id',_0x4cc9('0x6c'))[_0x4cc9('0x6f')](_0x2a77f0['CmListId']['toString'](),_0x4cc9('0x6d'))[_0x4cc9('0x6f')](_0x124f75[_0x4cc9('0x49')]['id'][_0x4cc9('0x71')](),_0x4cc9('0x5c'))['field'](_0x4cc9('0x6e'),_0x4cc9('0x55'))[_0x4cc9('0x6f')](_0x4cc9('0x6e'),'updatedAt')[_0x4cc9('0x7c')]('cm_contacts')['where'](_0x4cc9('0x73'))[_0x4cc9('0x3d')]('ListId\x20=\x20?',_0x2a77f0[_0x4cc9('0x70')][_0x4cc9('0x71')]())[_0x4cc9('0x3d')](_0x4cc9('0x75')))[_0x4cc9('0x71')]();_0x54305f['push'](db['sequelize'][_0x4cc9('0x34')](_0xd538d4));}return BPromise[_0x4cc9('0x8c')](_0x54305f);}})[_0x4cc9('0x24')](function(){return _0x1264cd;})[_0x4cc9('0x24')](respondWithResult(_0x2b51c3,null))['catch'](handleError(_0x2b51c3,null));};exports[_0x4cc9('0x93')]=function(_0x265ac1,_0x4e0f3c,_0x368daf){return db[_0x4cc9('0x2f')][_0x4cc9('0x50')]({'where':{'id':_0x265ac1[_0x4cc9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e0f3c,null))[_0x4cc9('0x24')](function(_0x3d77f){if(_0x3d77f){return _0x3d77f[_0x4cc9('0x93')](_0x265ac1['query']['ids']);}})['then'](function(_0x448fdd){if(_0x448fdd){return db['CmHopperBlack'][_0x4cc9('0x25')]({'where':{'ListId':_0x265ac1[_0x4cc9('0x34')][_0x4cc9('0x66')],'CampaignId':_0x265ac1[_0x4cc9('0x49')]['id']}})[_0x4cc9('0x24')](function(){return _0x448fdd;});}})[_0x4cc9('0x24')](respondWithStatusCode(_0x4e0f3c,null))[_0x4cc9('0x47')](handleError(_0x4e0f3c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d7761bb..7ac9983 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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index cd94d7d..4acdb92 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 _0x6d2e=['stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model','attributes','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x34aa94,_0x202a0a){var _0x43ca4a=function(_0x250f5a){while(--_0x250f5a){_0x34aa94['push'](_0x34aa94['shift']());}};_0x43ca4a(++_0x202a0a);}(_0x6d2e,0x97));var _0xe6d2=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x6d2e[_0x2faddb];return _0x273c05;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var moment=require(_0xe6d2('0x1'));var BPromise=require(_0xe6d2('0x2'));var rs=require(_0xe6d2('0x3'));var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6d2('0x7'));var client=jayson[_0xe6d2('0x8')][_0xe6d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d9c9f,_0x36d6ad,_0x53906e){return new BPromise(function(_0x2e227e,_0x2ce8cb){return client['request'](_0x4d9c9f,_0x53906e)[_0xe6d2('0xa')](function(_0xa7d0e1){logger['info'](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));logger['debug'](_0xe6d2('0xd'),_0x36d6ad,_0xe6d2('0xc'),JSON[_0xe6d2('0xe')](_0xa7d0e1));if(_0xa7d0e1[_0xe6d2('0xf')]){if(_0xa7d0e1['error'][_0xe6d2('0x10')]===0x1f4){logger[_0xe6d2('0xf')]('Campaign,\x20%s,\x20%s',_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2ce8cb(_0xa7d0e1['error'][_0xe6d2('0x11')]);}logger[_0xe6d2('0xf')](_0xe6d2('0xb'),_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2e227e(_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);}else{logger[_0xe6d2('0x12')](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));_0x2e227e(_0xa7d0e1[_0xe6d2('0x13')][_0xe6d2('0x11')]);}})[_0xe6d2('0x14')](function(_0x2ad072){logger[_0xe6d2('0xf')]('Campaign,\x20%s,\x20%s',_0x36d6ad,_0x2ad072);_0x2ce8cb(_0x2ad072);});});}exports[_0xe6d2('0x15')]=function(_0x35cc9c){var _0x38410a=this;return new Promise(function(_0x242bcb,_0x31b572){return db[_0xe6d2('0x16')][_0xe6d2('0x17')]({'raw':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x19')]===undefined?!![]:![]:!![],'where':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x1a')]||null:null,'attributes':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c[_0xe6d2('0x18')]['attributes']||null:null,'limit':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x1b')]||null:null,'include':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c[_0xe6d2('0x18')][_0xe6d2('0x1c')]?_[_0xe6d2('0x1d')](_0x35cc9c[_0xe6d2('0x18')][_0xe6d2('0x1c')],function(_0x3f5fc1){return{'model':db[_0x3f5fc1[_0xe6d2('0x1e')]],'as':_0x3f5fc1['as'],'attributes':_0x3f5fc1['attributes'],'include':_0x3f5fc1[_0xe6d2('0x1c')]?_[_0xe6d2('0x1d')](_0x3f5fc1[_0xe6d2('0x1c')],function(_0x1de5b3){return{'model':db[_0x1de5b3[_0xe6d2('0x1e')]],'as':_0x1de5b3['as'],'attributes':_0x1de5b3['attributes'],'include':_0x1de5b3['include']?_['map'](_0x1de5b3[_0xe6d2('0x1c')],function(_0x4700b5){return{'model':db[_0x4700b5[_0xe6d2('0x1e')]],'as':_0x4700b5['as'],'attributes':_0x4700b5[_0xe6d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe6d2('0xa')](function(_0x223992){logger[_0xe6d2('0x12')]('GetCampaign',_0x35cc9c);logger[_0xe6d2('0x20')]('GetCampaign',_0x35cc9c,JSON[_0xe6d2('0xe')](_0x223992));_0x242bcb(_0x223992);})[_0xe6d2('0x14')](function(_0x15b607){logger[_0xe6d2('0xf')](_0xe6d2('0x15'),_0x15b607[_0xe6d2('0x11')],_0x35cc9c);_0x31b572(_0x38410a[_0xe6d2('0xf')](0x1f4,_0x15b607[_0xe6d2('0x11')]));});});}; \ No newline at end of file +var _0x8eeb=['stringify','error','code','Campaign,\x20%s,\x20%s','message','result','GetCampaign','findAll','options','where','limit','include','map','model','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s'];(function(_0x34b278,_0x5471a4){var _0x52a0ac=function(_0x47d289){while(--_0x47d289){_0x34b278['push'](_0x34b278['shift']());}};_0x52a0ac(++_0x5471a4);}(_0x8eeb,0x183));var _0xb8ee=function(_0xd8c813,_0x563885){_0xd8c813=_0xd8c813-0x0;var _0x413d05=_0x8eeb[_0xd8c813];return _0x413d05;};'use strict';var _=require(_0xb8ee('0x0'));var util=require('util');var moment=require(_0xb8ee('0x1'));var BPromise=require(_0xb8ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8ee('0x3'));var db=require(_0xb8ee('0x4'))['db'];var utils=require(_0xb8ee('0x5'));var logger=require(_0xb8ee('0x6'))(_0xb8ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8ee('0x8'));var client=jayson['client'][_0xb8ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dff7,_0x430b38,_0x469393){return new BPromise(function(_0x4e2428,_0x27243c){return client[_0xb8ee('0xa')](_0x30dff7,_0x469393)[_0xb8ee('0xb')](function(_0x5ea3ab){logger[_0xb8ee('0xc')]('Campaign,\x20%s,\x20%s',_0x430b38,_0xb8ee('0xd'));logger[_0xb8ee('0xe')](_0xb8ee('0xf'),_0x430b38,_0xb8ee('0xd'),JSON[_0xb8ee('0x10')](_0x5ea3ab));if(_0x5ea3ab[_0xb8ee('0x11')]){if(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x12')]===0x1f4){logger['error'](_0xb8ee('0x13'),_0x430b38,_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);return _0x27243c(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);}logger[_0xb8ee('0x11')]('Campaign,\x20%s,\x20%s',_0x430b38,_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);return _0x4e2428(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);}else{logger[_0xb8ee('0xc')](_0xb8ee('0x13'),_0x430b38,_0xb8ee('0xd'));_0x4e2428(_0x5ea3ab[_0xb8ee('0x15')][_0xb8ee('0x14')]);}})['catch'](function(_0x135d5d){logger['error']('Campaign,\x20%s,\x20%s',_0x430b38,_0x135d5d);_0x27243c(_0x135d5d);});});}exports[_0xb8ee('0x16')]=function(_0x34dfb9){var _0x4d9a82=this;return new Promise(function(_0x3f0577,_0x369e3e){return db['Campaign'][_0xb8ee('0x17')]({'raw':_0x34dfb9[_0xb8ee('0x18')]?_0x34dfb9[_0xb8ee('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x34dfb9[_0xb8ee('0x18')]?_0x34dfb9[_0xb8ee('0x18')][_0xb8ee('0x19')]||null:null,'attributes':_0x34dfb9[_0xb8ee('0x18')]?_0x34dfb9[_0xb8ee('0x18')]['attributes']||null:null,'limit':_0x34dfb9[_0xb8ee('0x18')]?_0x34dfb9['options'][_0xb8ee('0x1a')]||null:null,'include':_0x34dfb9[_0xb8ee('0x18')]?_0x34dfb9[_0xb8ee('0x18')][_0xb8ee('0x1b')]?_[_0xb8ee('0x1c')](_0x34dfb9[_0xb8ee('0x18')][_0xb8ee('0x1b')],function(_0x2c179b){return{'model':db[_0x2c179b[_0xb8ee('0x1d')]],'as':_0x2c179b['as'],'attributes':_0x2c179b[_0xb8ee('0x1e')],'include':_0x2c179b['include']?_[_0xb8ee('0x1c')](_0x2c179b['include'],function(_0x5d1218){return{'model':db[_0x5d1218['model']],'as':_0x5d1218['as'],'attributes':_0x5d1218['attributes'],'include':_0x5d1218[_0xb8ee('0x1b')]?_[_0xb8ee('0x1c')](_0x5d1218[_0xb8ee('0x1b')],function(_0x3fadb6){return{'model':db[_0x3fadb6[_0xb8ee('0x1d')]],'as':_0x3fadb6['as'],'attributes':_0x3fadb6[_0xb8ee('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb8ee('0xb')](function(_0x295670){logger['info'](_0xb8ee('0x16'),_0x34dfb9);logger[_0xb8ee('0xe')](_0xb8ee('0x16'),_0x34dfb9,JSON[_0xb8ee('0x10')](_0x295670));_0x3f0577(_0x295670);})['catch'](function(_0x35e844){logger[_0xb8ee('0x11')]('GetCampaign',_0x35e844[_0xb8ee('0x14')],_0x34dfb9);_0x369e3e(_0x4d9a82[_0xb8ee('0x11')](0x1f4,_0x35e844['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index f2a1a14..5a5e661 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 _0x38fb=['post','create','/:id/clone','clone','/:id/blacklists','put','update','delete','removeBlackLists','multer','util','express','../../components/auth/service','../../components/interaction/service','./campaign.controller','isAuthenticated','/:id','show','get','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x38fb,0xd1));var _0xb38f=function(_0x515283,_0x813dea){_0x515283=_0x515283-0x0;var _0x38f836=_0x38fb[_0x515283];return _0x38f836;};'use strict';var multer=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb38f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb38f('0x3'));var interaction=require(_0xb38f('0x4'));var config=require('../../config/environment');var controller=require(_0xb38f('0x5'));router['get']('/',auth[_0xb38f('0x6')](),controller['index']);router['get'](_0xb38f('0x7'),auth['isAuthenticated'](),controller[_0xb38f('0x8')]);router[_0xb38f('0x9')](_0xb38f('0xa'),auth[_0xb38f('0x6')](),controller['getHoppers']);router[_0xb38f('0x9')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xb38f('0xb')]);router[_0xb38f('0x9')](_0xb38f('0xc'),auth[_0xb38f('0x6')](),controller[_0xb38f('0xd')]);router[_0xb38f('0x9')](_0xb38f('0xe'),auth[_0xb38f('0x6')](),controller['getHopperBlacks']);router[_0xb38f('0x9')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['getLists']);router['get']('/:id/blacklists',auth[_0xb38f('0x6')](),controller['getBlackLists']);router[_0xb38f('0x10')]('/',auth[_0xb38f('0x6')](),controller[_0xb38f('0x11')]);router[_0xb38f('0x10')](_0xb38f('0x12'),auth['isAuthenticated'](),controller[_0xb38f('0x13')]);router[_0xb38f('0x10')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['addLists']);router[_0xb38f('0x10')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller['addBlackLists']);router[_0xb38f('0x15')]('/:id',auth[_0xb38f('0x6')](),controller[_0xb38f('0x16')]);router['delete'](_0xb38f('0x7'),auth[_0xb38f('0x6')](),controller['destroy']);router[_0xb38f('0x17')](_0xb38f('0xf'),auth[_0xb38f('0x6')](),controller['removeLists']);router[_0xb38f('0x17')](_0xb38f('0x14'),auth[_0xb38f('0x6')](),controller[_0xb38f('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1cd5=['isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','/:id/blacklists','removeBlackLists','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cd5,0x107));var _0x51cd=function(_0x2b0c16,_0x227b97){_0x2b0c16=_0x2b0c16-0x0;var _0xd7b54c=_0x1cd5[_0x2b0c16];return _0xd7b54c;};'use strict';var multer=require('multer');var util=require(_0x51cd('0x0'));var path=require('path');var timeout=require(_0x51cd('0x1'));var express=require(_0x51cd('0x2'));var router=express['Router']();var fs_extra=require(_0x51cd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51cd('0x4'));var config=require(_0x51cd('0x5'));var controller=require('./campaign.controller');router[_0x51cd('0x6')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x8')]);router[_0x51cd('0x6')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['show']);router['get'](_0x51cd('0xa'),auth[_0x51cd('0x7')](),controller['getHoppers']);router[_0x51cd('0x6')](_0x51cd('0xb'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xc')]);router[_0x51cd('0x6')](_0x51cd('0xd'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xe')]);router['get'](_0x51cd('0xf'),auth[_0x51cd('0x7')](),controller['getHopperBlacks']);router['get'](_0x51cd('0x10'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x11')]);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x51cd('0x12')]);router[_0x51cd('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x51cd('0x13')](_0x51cd('0x14'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x15')]);router['post'](_0x51cd('0x10'),auth['isAuthenticated'](),controller[_0x51cd('0x16')]);router[_0x51cd('0x13')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x51cd('0x17')]);router[_0x51cd('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x51cd('0x19')]);router[_0x51cd('0x1a')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['destroy']);router[_0x51cd('0x1a')](_0x51cd('0x10'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x51cd('0x1b'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x1c')]);module[_0x51cd('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2326bf7..cf54248 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 _0x37fb=['STRING','TEXT','getDataValue','key','exports'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x37fb,0x1b7));var _0xb37f=function(_0x5c2779,_0x849267){_0x5c2779=_0x5c2779-0x0;var _0x262c56=_0x37fb[_0x5c2779];return _0x262c56;};'use strict';var Sequelize=require('sequelize');module[_0xb37f('0x0')]={'key':{'type':Sequelize[_0xb37f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xb37f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb37f('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb37f('0x3')](_0xb37f('0x4'));}}}; \ No newline at end of file +var _0x83d7=['key','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x83d7,0x1d5));var _0x783d=function(_0x4cba56,_0x5b2c44){_0x4cba56=_0x4cba56-0x0;var _0x3cc9f3=_0x83d7[_0x4cba56];return _0x3cc9f3;};'use strict';var Sequelize=require('sequelize');module[_0x783d('0x0')]={'key':{'type':Sequelize[_0x783d('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x783d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x783d('0x1')]},'name':{'type':Sequelize[_0x783d('0x3')],'get':function(){return this[_0x783d('0x4')](_0x783d('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e918e26..a9986e5 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 _0xd88c=['stack','name','send','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','length','attributes','order','sort','where','pick','filters','merge','filter','options','includeAll','include','catch','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','role','UserProfileSection','CannedAnswers','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','error'];(function(_0x565f81,_0x355f29){var _0x43e836=function(_0x294051){while(--_0x294051){_0x565f81['push'](_0x565f81['shift']());}};_0x43e836(++_0x355f29);}(_0xd88c,0x1b0));var _0xcd88=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xd88c[_0x151721];return _0x2deaa7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd88('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcd88('0x1'));var Mustache=require(_0xcd88('0x2'));var util=require(_0xcd88('0x3'));var path=require(_0xcd88('0x4'));var sox=require(_0xcd88('0x5'));var csv=require(_0xcd88('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd88('0x7'));var _=require(_0xcd88('0x8'));var squel=require('squel');var crypto=require(_0xcd88('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xcd88('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcd88('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd88('0xc'));var qs=require(_0xcd88('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcd88('0xe'));var logger=require(_0xcd88('0xf'))('api');var utils=require(_0xcd88('0x10'));var config=require(_0xcd88('0x11'));var licenseUtil=require(_0xcd88('0x12'));var db=require(_0xcd88('0x13'))['db'];function respondWithStatusCode(_0x50a2f3,_0x1682ac){_0x1682ac=_0x1682ac||0xcc;return function(_0x1ef1b1){if(_0x1ef1b1){return _0x50a2f3[_0xcd88('0x14')](_0x1682ac);}return _0x50a2f3[_0xcd88('0x15')](_0x1682ac)[_0xcd88('0x16')]();};}function respondWithResult(_0x907297,_0x4c31bd){_0x4c31bd=_0x4c31bd||0xc8;return function(_0xd2132b){if(_0xd2132b){return _0x907297[_0xcd88('0x15')](_0x4c31bd)['json'](_0xd2132b);}};}function respondWithFilteredResult(_0x336100,_0x544f15){return function(_0x3b739b){if(_0x3b739b){var _0xa41849=typeof _0x544f15[_0xcd88('0x17')]===_0xcd88('0x18')&&typeof _0x544f15[_0xcd88('0x19')]===_0xcd88('0x18');var _0x283839=_0x3b739b[_0xcd88('0x1a')];var _0x515109=_0xa41849?0x0:_0x544f15[_0xcd88('0x17')];var _0x65585d=_0xa41849?_0x3b739b[_0xcd88('0x1a')]:_0x544f15[_0xcd88('0x17')]+_0x544f15['limit'];var _0x50cb15;if(_0x65585d>=_0x283839){_0x65585d=_0x283839;_0x50cb15=0xc8;}else{_0x50cb15=0xce;}_0x336100[_0xcd88('0x15')](_0x50cb15);return _0x336100[_0xcd88('0x1b')](_0xcd88('0x1c'),_0x515109+'-'+_0x65585d+'/'+_0x283839)['json'](_0x3b739b);}return null;};}function patchUpdates(_0x596c3c){return function(_0xcdf738){try{jsonpatch['apply'](_0xcdf738,_0x596c3c,!![]);}catch(_0x49ba67){return BPromise[_0xcd88('0x1d')](_0x49ba67);}return _0xcdf738[_0xcd88('0x1e')]();};}function saveUpdates(_0xef1f36,_0x140490){return function(_0x3a5637){if(_0x3a5637){return _0x3a5637[_0xcd88('0x1f')](_0xef1f36)[_0xcd88('0x20')](function(_0x51cabf){return _0x51cabf;});}return null;};}function removeEntity(_0x7984b2,_0x38a2e8){return function(_0x1ba69b){if(_0x1ba69b){return _0x1ba69b[_0xcd88('0x21')]()[_0xcd88('0x20')](function(){var _0x4da0a0=_0x1ba69b[_0xcd88('0x22')]({'plain':!![]});var _0x43a530='CannedAnswers';return db['UserProfileResource'][_0xcd88('0x21')]({'where':{'type':_0x43a530,'resourceId':_0x4da0a0['id']}})[_0xcd88('0x20')](function(){return _0x1ba69b;});})[_0xcd88('0x20')](function(){_0x7984b2[_0xcd88('0x15')](0xcc)[_0xcd88('0x16')]();});}};}function handleEntityNotFound(_0x5cce7e,_0x315c59){return function(_0x43fb91){if(!_0x43fb91){_0x5cce7e['sendStatus'](0x194);}return _0x43fb91;};}function handleError(_0xb73604,_0x5eeb08){_0x5eeb08=_0x5eeb08||0x1f4;return function(_0x4ab70f){logger[_0xcd88('0x23')](_0x4ab70f[_0xcd88('0x24')]);if(_0x4ab70f[_0xcd88('0x25')]){delete _0x4ab70f[_0xcd88('0x25')];}_0xb73604[_0xcd88('0x15')](_0x5eeb08)[_0xcd88('0x26')](_0x4ab70f);};}exports['index']=function(_0x429a53,_0x3c3090){var _0x68732c={},_0x1fd13c={},_0x3f4bfc={'count':0x0,'rows':[]};var _0x23daea=_['map'](db[_0xcd88('0x27')][_0xcd88('0x28')],function(_0x31379a){return{'name':_0x31379a[_0xcd88('0x29')],'type':_0x31379a[_0xcd88('0x2a')][_0xcd88('0x2b')]};});_0x1fd13c[_0xcd88('0x2c')]=_[_0xcd88('0x2d')](_0x23daea,_0xcd88('0x25'));_0x1fd13c[_0xcd88('0x2e')]=_['keys'](_0x429a53['query']);_0x1fd13c['filters']=_[_0xcd88('0x2f')](_0x1fd13c[_0xcd88('0x2c')],_0x1fd13c[_0xcd88('0x2e')]);_0x68732c['attributes']=_[_0xcd88('0x2f')](_0x1fd13c['model'],qs[_0xcd88('0x30')](_0x429a53['query'][_0xcd88('0x30')]));_0x68732c['attributes']=_0x68732c['attributes'][_0xcd88('0x31')]?_0x68732c[_0xcd88('0x32')]:_0x1fd13c['model'];if(!_0x429a53[_0xcd88('0x2e')]['hasOwnProperty']('nolimit')){_0x68732c[_0xcd88('0x19')]=qs[_0xcd88('0x19')](_0x429a53['query'][_0xcd88('0x19')]);_0x68732c[_0xcd88('0x17')]=qs['offset'](_0x429a53[_0xcd88('0x2e')]['offset']);}_0x68732c[_0xcd88('0x33')]=qs[_0xcd88('0x34')](_0x429a53[_0xcd88('0x2e')][_0xcd88('0x34')]);_0x68732c[_0xcd88('0x35')]=qs['filters'](_[_0xcd88('0x36')](_0x429a53[_0xcd88('0x2e')],_0x1fd13c[_0xcd88('0x37')]),_0x23daea);if(_0x429a53['query']['filter']){_0x68732c['where']=_[_0xcd88('0x38')](_0x68732c[_0xcd88('0x35')],{'$or':[{'key':{'$like':'%'+_0x429a53[_0xcd88('0x2e')][_0xcd88('0x39')]+'%'}},{'value':{'$like':'%'+_0x429a53[_0xcd88('0x2e')][_0xcd88('0x39')]+'%'}}]});}_0x68732c=_[_0xcd88('0x38')]({},_0x68732c,_0x429a53[_0xcd88('0x3a')]);var _0x1c8d71={'where':_0x68732c[_0xcd88('0x35')]};return db[_0xcd88('0x27')][_0xcd88('0x1a')](_0x1c8d71)['then'](function(_0x2db1c5){_0x3f4bfc['count']=_0x2db1c5;if(_0x429a53[_0xcd88('0x2e')][_0xcd88('0x3b')]){_0x68732c[_0xcd88('0x3c')]=[{'all':!![]}];}return db[_0xcd88('0x27')]['findAll'](_0x68732c);})[_0xcd88('0x20')](function(_0x12957e){_0x3f4bfc['rows']=_0x12957e;return _0x3f4bfc;})[_0xcd88('0x20')](respondWithFilteredResult(_0x3c3090,_0x68732c))[_0xcd88('0x3d')](handleError(_0x3c3090,null));};exports['show']=function(_0x23b840,_0x53c783){var _0x52e5b2={'raw':!![],'where':{'id':_0x23b840[_0xcd88('0x3e')]['id']}},_0x5885a7={};_0x5885a7[_0xcd88('0x2c')]=_['keys'](db['CannedAnswer'][_0xcd88('0x28')]);_0x5885a7[_0xcd88('0x2e')]=_['keys'](_0x23b840[_0xcd88('0x2e')]);_0x5885a7[_0xcd88('0x37')]=_[_0xcd88('0x2f')](_0x5885a7[_0xcd88('0x2c')],_0x5885a7['query']);_0x52e5b2[_0xcd88('0x32')]=_[_0xcd88('0x2f')](_0x5885a7['model'],qs[_0xcd88('0x30')](_0x23b840[_0xcd88('0x2e')][_0xcd88('0x30')]));_0x52e5b2[_0xcd88('0x32')]=_0x52e5b2[_0xcd88('0x32')]['length']?_0x52e5b2[_0xcd88('0x32')]:_0x5885a7[_0xcd88('0x2c')];if(_0x23b840[_0xcd88('0x2e')][_0xcd88('0x3b')]){_0x52e5b2['include']=[{'all':!![]}];}_0x52e5b2=_[_0xcd88('0x38')]({},_0x52e5b2,_0x23b840['options']);return db[_0xcd88('0x27')][_0xcd88('0x3f')](_0x52e5b2)[_0xcd88('0x20')](handleEntityNotFound(_0x53c783,null))['then'](respondWithResult(_0x53c783,null))[_0xcd88('0x3d')](handleError(_0x53c783,null));};exports[_0xcd88('0x1f')]=function(_0x558cda,_0x3afb50){if(_0x558cda[_0xcd88('0x40')]['id']){delete _0x558cda[_0xcd88('0x40')]['id'];}return db[_0xcd88('0x27')]['find']({'where':{'id':_0x558cda[_0xcd88('0x3e')]['id']}})[_0xcd88('0x20')](handleEntityNotFound(_0x3afb50,null))[_0xcd88('0x20')](saveUpdates(_0x558cda[_0xcd88('0x40')],null))[_0xcd88('0x20')](respondWithResult(_0x3afb50,null))[_0xcd88('0x3d')](handleError(_0x3afb50,null));};exports[_0xcd88('0x21')]=function(_0x2f2ee5,_0x1bc0da){return db[_0xcd88('0x27')][_0xcd88('0x3f')]({'where':{'id':_0x2f2ee5['params']['id']}})['then'](handleEntityNotFound(_0x1bc0da,null))[_0xcd88('0x20')](removeEntity(_0x1bc0da,null))['catch'](handleError(_0x1bc0da,null));};exports[_0xcd88('0x41')]=function(_0x43d844,_0x41b9b6){var _0x596109={'key':_0x43d844[_0xcd88('0x40')][_0xcd88('0x2b')]};if(_0x43d844['body'][_0xcd88('0x42')]){_0x596109[_0xcd88('0x42')]=_0x43d844['body'][_0xcd88('0x42')];}else if(_0x43d844[_0xcd88('0x40')][_0xcd88('0x43')]){_0x596109[_0xcd88('0x43')]=_0x43d844[_0xcd88('0x40')][_0xcd88('0x43')];}else if(_0x43d844[_0xcd88('0x40')][_0xcd88('0x44')]){_0x596109['OpenchannelAccountId']=_0x43d844['body']['OpenchannelAccountId'];}else if(_0x43d844[_0xcd88('0x40')][_0xcd88('0x45')]){_0x596109['ChatWebsiteId']=_0x43d844[_0xcd88('0x40')][_0xcd88('0x45')];}return db[_0xcd88('0x27')][_0xcd88('0x3f')]({'where':_0x596109})[_0xcd88('0x20')](function(_0x1c5bc0){if(_0x1c5bc0){throw new db[(_0xcd88('0x46'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xcd88('0x27')][_0xcd88('0x41')](_0x43d844[_0xcd88('0x40')]);})[_0xcd88('0x20')](function(_0x3f6ba2){var _0x12df72=_0x43d844[_0xcd88('0x47')]['get']({'plain':!![]});if(!_0x12df72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12df72[_0xcd88('0x48')]===_0xcd88('0x47')){var _0x97ec9e=_0x3f6ba2[_0xcd88('0x22')]({'plain':!![]});return db[_0xcd88('0x49')][_0xcd88('0x3f')]({'where':{'name':_0xcd88('0x4a'),'userProfileId':_0x12df72['userProfileId']},'raw':!![]})[_0xcd88('0x20')](function(_0x84f8b8){if(_0x84f8b8&&_0x84f8b8[_0xcd88('0x4b')]===0x0){return db[_0xcd88('0x4c')]['create']({'name':_0x97ec9e['name'],'resourceId':_0x97ec9e['id'],'type':_0x84f8b8['name'],'sectionId':_0x84f8b8['id']},{})[_0xcd88('0x20')](function(){return _0x3f6ba2;});}else{return _0x3f6ba2;}})[_0xcd88('0x3d')](function(_0x59072a){logger['error'](_0xcd88('0x4d'),_0x59072a);throw _0x59072a;});}return _0x3f6ba2;})[_0xcd88('0x20')](respondWithResult(_0x41b9b6,0xc9))[_0xcd88('0x3d')](handleError(_0x41b9b6,null));}; \ No newline at end of file +var _0xc992=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','CannedAnswers','end','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','body','params','find','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2afa33,_0x484c97){var _0x4c1a77=function(_0x36a955){while(--_0x36a955){_0x2afa33['push'](_0x2afa33['shift']());}};_0x4c1a77(++_0x484c97);}(_0xc992,0x13f));var _0x2c99=function(_0x3fb622,_0x57d3d3){_0x3fb622=_0x3fb622-0x0;var _0x17b8ae=_0xc992[_0x3fb622];return _0x17b8ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c99('0x1'));var moment=require(_0x2c99('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2c99('0x3'));var util=require(_0x2c99('0x4'));var path=require(_0x2c99('0x5'));var sox=require('sox');var csv=require(_0x2c99('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c99('0x7'));var _=require(_0x2c99('0x8'));var squel=require(_0x2c99('0x9'));var crypto=require(_0x2c99('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2c99('0xb'));var toCsv=require(_0x2c99('0x6'));var querystring=require(_0x2c99('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c99('0xd'));var authService=require(_0x2c99('0xe'));var qs=require(_0x2c99('0xf'));var as=require(_0x2c99('0x10'));var hardwareService=require(_0x2c99('0x11'));var logger=require(_0x2c99('0x12'))('api');var utils=require(_0x2c99('0x13'));var config=require(_0x2c99('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c99('0x15'))['db'];function respondWithStatusCode(_0x727538,_0x4b6dfb){_0x4b6dfb=_0x4b6dfb||0xcc;return function(_0x3b6d96){if(_0x3b6d96){return _0x727538[_0x2c99('0x16')](_0x4b6dfb);}return _0x727538[_0x2c99('0x17')](_0x4b6dfb)['end']();};}function respondWithResult(_0x7e22ff,_0x5ae874){_0x5ae874=_0x5ae874||0xc8;return function(_0x3a7b8c){if(_0x3a7b8c){return _0x7e22ff[_0x2c99('0x17')](_0x5ae874)[_0x2c99('0x18')](_0x3a7b8c);}};}function respondWithFilteredResult(_0x5e28f9,_0x395375){return function(_0x5e75cb){if(_0x5e75cb){var _0x11a9b6=typeof _0x395375['offset']===_0x2c99('0x19')&&typeof _0x395375['limit']==='undefined';var _0x4846df=_0x5e75cb['count'];var _0x4a48cf=_0x11a9b6?0x0:_0x395375[_0x2c99('0x1a')];var _0x3a90bb=_0x11a9b6?_0x5e75cb[_0x2c99('0x1b')]:_0x395375[_0x2c99('0x1a')]+_0x395375['limit'];var _0x2c3245;if(_0x3a90bb>=_0x4846df){_0x3a90bb=_0x4846df;_0x2c3245=0xc8;}else{_0x2c3245=0xce;}_0x5e28f9[_0x2c99('0x17')](_0x2c3245);return _0x5e28f9[_0x2c99('0x1c')](_0x2c99('0x1d'),_0x4a48cf+'-'+_0x3a90bb+'/'+_0x4846df)['json'](_0x5e75cb);}return null;};}function patchUpdates(_0x80dffc){return function(_0xf98fa){try{jsonpatch[_0x2c99('0x1e')](_0xf98fa,_0x80dffc,!![]);}catch(_0x2925f4){return BPromise[_0x2c99('0x1f')](_0x2925f4);}return _0xf98fa[_0x2c99('0x20')]();};}function saveUpdates(_0x1ef472,_0x3cbc2f){return function(_0x357b57){if(_0x357b57){return _0x357b57['update'](_0x1ef472)[_0x2c99('0x21')](function(_0x3b6110){return _0x3b6110;});}return null;};}function removeEntity(_0xf8ddca,_0x2e3033){return function(_0x509b6e){if(_0x509b6e){return _0x509b6e[_0x2c99('0x22')]()[_0x2c99('0x21')](function(){var _0x400d5b=_0x509b6e[_0x2c99('0x23')]({'plain':!![]});var _0x3a38ec=_0x2c99('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x3a38ec,'resourceId':_0x400d5b['id']}})[_0x2c99('0x21')](function(){return _0x509b6e;});})[_0x2c99('0x21')](function(){_0xf8ddca['status'](0xcc)[_0x2c99('0x25')]();});}};}function handleEntityNotFound(_0x1c8555,_0x55cf5b){return function(_0x4c3c99){if(!_0x4c3c99){_0x1c8555['sendStatus'](0x194);}return _0x4c3c99;};}function handleError(_0x253ec8,_0x605138){_0x605138=_0x605138||0x1f4;return function(_0x1681e0){logger['error'](_0x1681e0[_0x2c99('0x26')]);if(_0x1681e0['name']){delete _0x1681e0[_0x2c99('0x27')];}_0x253ec8[_0x2c99('0x17')](_0x605138)[_0x2c99('0x28')](_0x1681e0);};}exports['index']=function(_0x587ee7,_0x38bae6){var _0x4b8f32={},_0x36824b={},_0x333bcb={'count':0x0,'rows':[]};var _0x3fb68f=_[_0x2c99('0x29')](db[_0x2c99('0x2a')][_0x2c99('0x2b')],function(_0x833e06){return{'name':_0x833e06[_0x2c99('0x2c')],'type':_0x833e06['type']['key']};});_0x36824b[_0x2c99('0x2d')]=_['map'](_0x3fb68f,_0x2c99('0x27'));_0x36824b[_0x2c99('0x2e')]=_[_0x2c99('0x2f')](_0x587ee7[_0x2c99('0x2e')]);_0x36824b[_0x2c99('0x30')]=_['intersection'](_0x36824b[_0x2c99('0x2d')],_0x36824b[_0x2c99('0x2e')]);_0x4b8f32[_0x2c99('0x31')]=_[_0x2c99('0x32')](_0x36824b[_0x2c99('0x2d')],qs[_0x2c99('0x33')](_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x33')]));_0x4b8f32[_0x2c99('0x31')]=_0x4b8f32[_0x2c99('0x31')][_0x2c99('0x34')]?_0x4b8f32[_0x2c99('0x31')]:_0x36824b['model'];if(!_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x35')]('nolimit')){_0x4b8f32[_0x2c99('0x36')]=qs[_0x2c99('0x36')](_0x587ee7['query']['limit']);_0x4b8f32[_0x2c99('0x1a')]=qs[_0x2c99('0x1a')](_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x1a')]);}_0x4b8f32[_0x2c99('0x37')]=qs[_0x2c99('0x38')](_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x38')]);_0x4b8f32[_0x2c99('0x39')]=qs['filters'](_[_0x2c99('0x3a')](_0x587ee7['query'],_0x36824b[_0x2c99('0x30')]),_0x3fb68f);if(_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x3b')]){_0x4b8f32[_0x2c99('0x39')]=_['merge'](_0x4b8f32['where'],{'$or':[{'key':{'$like':'%'+_0x587ee7[_0x2c99('0x2e')][_0x2c99('0x3b')]+'%'}},{'value':{'$like':'%'+_0x587ee7[_0x2c99('0x2e')]['filter']+'%'}}]});}_0x4b8f32=_[_0x2c99('0x3c')]({},_0x4b8f32,_0x587ee7[_0x2c99('0x3d')]);var _0x49ca4c={'where':_0x4b8f32[_0x2c99('0x39')]};return db['CannedAnswer']['count'](_0x49ca4c)[_0x2c99('0x21')](function(_0x125403){_0x333bcb['count']=_0x125403;if(_0x587ee7['query'][_0x2c99('0x3e')]){_0x4b8f32[_0x2c99('0x3f')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2c99('0x40')](_0x4b8f32);})['then'](function(_0x11672c){_0x333bcb[_0x2c99('0x41')]=_0x11672c;return _0x333bcb;})[_0x2c99('0x21')](respondWithFilteredResult(_0x38bae6,_0x4b8f32))[_0x2c99('0x42')](handleError(_0x38bae6,null));};exports[_0x2c99('0x43')]=function(_0x26f670,_0x260d68){var _0x5e1966={'raw':!![],'where':{'id':_0x26f670['params']['id']}},_0x591075={};_0x591075[_0x2c99('0x2d')]=_[_0x2c99('0x2f')](db[_0x2c99('0x2a')][_0x2c99('0x2b')]);_0x591075[_0x2c99('0x2e')]=_['keys'](_0x26f670[_0x2c99('0x2e')]);_0x591075[_0x2c99('0x30')]=_[_0x2c99('0x32')](_0x591075['model'],_0x591075[_0x2c99('0x2e')]);_0x5e1966['attributes']=_['intersection'](_0x591075[_0x2c99('0x2d')],qs[_0x2c99('0x33')](_0x26f670[_0x2c99('0x2e')][_0x2c99('0x33')]));_0x5e1966[_0x2c99('0x31')]=_0x5e1966['attributes'][_0x2c99('0x34')]?_0x5e1966[_0x2c99('0x31')]:_0x591075[_0x2c99('0x2d')];if(_0x26f670['query'][_0x2c99('0x3e')]){_0x5e1966[_0x2c99('0x3f')]=[{'all':!![]}];}_0x5e1966=_[_0x2c99('0x3c')]({},_0x5e1966,_0x26f670[_0x2c99('0x3d')]);return db[_0x2c99('0x2a')]['find'](_0x5e1966)[_0x2c99('0x21')](handleEntityNotFound(_0x260d68,null))[_0x2c99('0x21')](respondWithResult(_0x260d68,null))['catch'](handleError(_0x260d68,null));};exports['update']=function(_0x50a8cf,_0x5ab747){if(_0x50a8cf[_0x2c99('0x44')]['id']){delete _0x50a8cf['body']['id'];}return db[_0x2c99('0x2a')]['find']({'where':{'id':_0x50a8cf[_0x2c99('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ab747,null))[_0x2c99('0x21')](saveUpdates(_0x50a8cf[_0x2c99('0x44')],null))[_0x2c99('0x21')](respondWithResult(_0x5ab747,null))[_0x2c99('0x42')](handleError(_0x5ab747,null));};exports[_0x2c99('0x22')]=function(_0x48af01,_0x3e8a5b){return db[_0x2c99('0x2a')][_0x2c99('0x46')]({'where':{'id':_0x48af01[_0x2c99('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8a5b,null))[_0x2c99('0x21')](removeEntity(_0x3e8a5b,null))[_0x2c99('0x42')](handleError(_0x3e8a5b,null));};exports['create']=function(_0x442929,_0x14b551){var _0x5864b3={'key':_0x442929[_0x2c99('0x44')][_0x2c99('0x47')]};if(_0x442929[_0x2c99('0x44')][_0x2c99('0x48')]){_0x5864b3[_0x2c99('0x48')]=_0x442929[_0x2c99('0x44')][_0x2c99('0x48')];}else if(_0x442929[_0x2c99('0x44')][_0x2c99('0x49')]){_0x5864b3[_0x2c99('0x49')]=_0x442929['body']['SmsAccountId'];}else if(_0x442929['body'][_0x2c99('0x4a')]){_0x5864b3[_0x2c99('0x4a')]=_0x442929[_0x2c99('0x44')][_0x2c99('0x4a')];}else if(_0x442929['body'][_0x2c99('0x4b')]){_0x5864b3[_0x2c99('0x4b')]=_0x442929[_0x2c99('0x44')]['ChatWebsiteId'];}return db['CannedAnswer'][_0x2c99('0x46')]({'where':_0x5864b3})[_0x2c99('0x21')](function(_0x5cbf70){if(_0x5cbf70){throw new db['Sequelize'][(_0x2c99('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x2c99('0x4d')](_0x442929[_0x2c99('0x44')]);})[_0x2c99('0x21')](function(_0x9633e8){var _0x6416ba=_0x442929['user'][_0x2c99('0x23')]({'plain':!![]});if(!_0x6416ba)throw new Error(_0x2c99('0x4e'));if(_0x6416ba[_0x2c99('0x4f')]===_0x2c99('0x50')){var _0x5489a3=_0x9633e8[_0x2c99('0x23')]({'plain':!![]});return db['UserProfileSection'][_0x2c99('0x46')]({'where':{'name':_0x2c99('0x24'),'userProfileId':_0x6416ba[_0x2c99('0x51')]},'raw':!![]})[_0x2c99('0x21')](function(_0x4d6de1){if(_0x4d6de1&&_0x4d6de1['autoAssociation']===0x0){return db[_0x2c99('0x52')][_0x2c99('0x4d')]({'name':_0x5489a3[_0x2c99('0x27')],'resourceId':_0x5489a3['id'],'type':_0x4d6de1[_0x2c99('0x27')],'sectionId':_0x4d6de1['id']},{})[_0x2c99('0x21')](function(){return _0x9633e8;});}else{return _0x9633e8;}})[_0x2c99('0x42')](function(_0x266688){logger['error'](_0x2c99('0x53'),_0x266688);throw _0x266688;});}return _0x9633e8;})[_0x2c99('0x21')](respondWithResult(_0x14b551,0xc9))[_0x2c99('0x42')](handleError(_0x14b551,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index ff26256..ef7a973 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 _0xe373=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird'];(function(_0x4117ac,_0x18d908){var _0x543de8=function(_0x26c76f){while(--_0x26c76f){_0x4117ac['push'](_0x4117ac['shift']());}};_0x543de8(++_0x18d908);}(_0xe373,0x11c));var _0x3e37=function(_0x42d72c,_0x5c6800){_0x42d72c=_0x42d72c-0x0;var _0x3a13d4=_0xe373[_0x42d72c];return _0x3a13d4;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var logger=require(_0x3e37('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3e37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e37('0x4'));var rimraf=require(_0x3e37('0x5'));var config=require(_0x3e37('0x6'));var attributes=require(_0x3e37('0x7'));module[_0x3e37('0x8')]=function(_0x62b337,_0x539870){return _0x62b337[_0x3e37('0x9')](_0x3e37('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3e37('0xb')});}; \ No newline at end of file +var _0xff47=['request-promise','path','rimraf','./cannedAnswer.attributes','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xff47,0x15c));var _0x7ff4=function(_0x3c79d1,_0x1e55d4){_0x3c79d1=_0x3c79d1-0x0;var _0x1646e8=_0xff47[_0x3c79d1];return _0x1646e8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7ff4('0x0'))(_0x7ff4('0x1'));var moment=require(_0x7ff4('0x2'));var BPromise=require(_0x7ff4('0x3'));var rp=require(_0x7ff4('0x4'));var fs=require('fs');var path=require(_0x7ff4('0x5'));var rimraf=require(_0x7ff4('0x6'));var config=require('../../config/environment');var attributes=require(_0x7ff4('0x7'));module['exports']=function(_0x5952a7,_0x4baffc){return _0x5952a7['define']('CannedAnswer',attributes,{'tableName':_0x7ff4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ff4('0x9'),'collate':_0x7ff4('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 62c9e6c..5fa66f8 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(_0x1b81ca,_0x414d4b){var _0x12a7e5=function(_0x34ff10){while(--_0x34ff10){_0x1b81ca['push'](_0x1b81ca['shift']());}};_0x12a7e5(++_0x414d4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x44d962,_0x1eea72){var _0x125621=function(_0xe6acf8){while(--_0xe6acf8){_0x44d962['push'](_0x44d962['shift']());}};_0x125621(++_0x1eea72);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 5186018..709da96 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 _0xe640=['show','post','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xe640,0x1e9));var _0x0e64=function(_0x592199,_0x4f536){_0x592199=_0x592199-0x0;var _0x31b2c4=_0xe640[_0x592199];return _0x31b2c4;};'use strict';var multer=require(_0x0e64('0x0'));var util=require(_0x0e64('0x1'));var path=require('path');var timeout=require(_0x0e64('0x2'));var express=require(_0x0e64('0x3'));var router=express['Router']();var fs_extra=require(_0x0e64('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0e64('0x5'));var config=require(_0x0e64('0x6'));var controller=require(_0x0e64('0x7'));router[_0x0e64('0x8')]('/',auth[_0x0e64('0x9')](),controller[_0x0e64('0xa')]);router[_0x0e64('0x8')]('/:id',auth[_0x0e64('0x9')](),controller[_0x0e64('0xb')]);router[_0x0e64('0xc')]('/',auth[_0x0e64('0x9')](),controller[_0x0e64('0xd')]);router[_0x0e64('0xe')]('/:id',auth[_0x0e64('0x9')](),controller[_0x0e64('0xf')]);router[_0x0e64('0x10')](_0x0e64('0x11'),auth[_0x0e64('0x9')](),controller[_0x0e64('0x12')]);module[_0x0e64('0x13')]=router; \ No newline at end of file +var _0x260b=['isAuthenticated','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','get','post'];(function(_0x61f351,_0x353832){var _0x1d4cfd=function(_0x4c8c44){while(--_0x4c8c44){_0x61f351['push'](_0x61f351['shift']());}};_0x1d4cfd(++_0x353832);}(_0x260b,0x1f3));var _0xb260=function(_0x2e25db,_0x165a34){_0x2e25db=_0x2e25db-0x0;var _0x72fc81=_0x260b[_0x2e25db];return _0x72fc81;};'use strict';var multer=require('multer');var util=require(_0xb260('0x0'));var path=require(_0xb260('0x1'));var timeout=require(_0xb260('0x2'));var express=require('express');var router=express[_0xb260('0x3')]();var fs_extra=require(_0xb260('0x4'));var auth=require(_0xb260('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb260('0x6'));var controller=require(_0xb260('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb260('0x8')]);router[_0xb260('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb260('0xa')]('/',auth[_0xb260('0xb')](),controller[_0xb260('0xc')]);router[_0xb260('0xd')]('/:id',auth[_0xb260('0xb')](),controller['update']);router[_0xb260('0xe')]('/:id',auth[_0xb260('0xb')](),controller[_0xb260('0xf')]);module[_0xb260('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 57a7deb..9f1f5cf 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 _0x49d7=['STRING','INTEGER','sequelize'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x49d7,0xfe));var _0x749d=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x49d7[_0x590851];return _0x3b0115;};'use strict';var Sequelize=require(_0x749d('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x749d('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x749d('0x1')]},'dcontext':{'type':Sequelize[_0x749d('0x1')]},'channel':{'type':Sequelize[_0x749d('0x1')]},'dstchannel':{'type':Sequelize[_0x749d('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x749d('0x1')]},'duration':{'type':Sequelize[_0x749d('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x749d('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x749d('0x1')]},'uniqueid':{'type':Sequelize[_0x749d('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x749d('0x1')]},'type':{'type':Sequelize[_0x749d('0x1')]},'tag':{'type':Sequelize[_0x749d('0x1')]}}; \ No newline at end of file +var _0x149c=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0xda5416,_0x16334a){var _0x1331ba=function(_0x4d5d10){while(--_0x4d5d10){_0xda5416['push'](_0xda5416['shift']());}};_0x1331ba(++_0x16334a);}(_0x149c,0x143));var _0xc149=function(_0x5d4d84,_0x217d9a){_0x5d4d84=_0x5d4d84-0x0;var _0x509f1b=_0x149c[_0x5d4d84];return _0x509f1b;};'use strict';var Sequelize=require(_0xc149('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xc149('0x1')],'allowNull':![],'defaultValue':_0xc149('0x2')},'clid':{'type':Sequelize[_0xc149('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xc149('0x3')]},'dcontext':{'type':Sequelize[_0xc149('0x3')]},'channel':{'type':Sequelize[_0xc149('0x3')]},'dstchannel':{'type':Sequelize[_0xc149('0x3')]},'lastapp':{'type':Sequelize[_0xc149('0x3')]},'lastdata':{'type':Sequelize[_0xc149('0x3')]},'duration':{'type':Sequelize[_0xc149('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xc149('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xc149('0x3')]},'userfield':{'type':Sequelize[_0xc149('0x3')]},'uniqueid':{'type':Sequelize[_0xc149('0x3')]},'linkedid':{'type':Sequelize[_0xc149('0x3')]},'sequence':{'type':Sequelize[_0xc149('0x3')]},'peeraccount':{'type':Sequelize[_0xc149('0x3')]},'type':{'type':Sequelize[_0xc149('0x3')]},'tag':{'type':Sequelize[_0xc149('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 40f07e7..0eef911 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 _0x6c7b=['apply','reject','update','then','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','params','includeAll','include','find','catch','create','body','destroy','describe','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x238df1,_0x288fbf){_0x238df1=_0x238df1-0x0;var _0xab2916=_0x6c7b[_0x238df1];return _0xab2916;};'use strict';var emlformat=require(_0xb6c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c7('0x1'));var moment=require('moment');var BPromise=require(_0xb6c7('0x2'));var Mustache=require(_0xb6c7('0x3'));var util=require(_0xb6c7('0x4'));var path=require('path');var sox=require(_0xb6c7('0x5'));var csv=require(_0xb6c7('0x6'));var ejs=require(_0xb6c7('0x7'));var fs=require('fs');var fs_extra=require(_0xb6c7('0x8'));var _=require(_0xb6c7('0x9'));var squel=require('squel');var crypto=require(_0xb6c7('0xa'));var jsforce=require(_0xb6c7('0xb'));var deskjs=require(_0xb6c7('0xc'));var toCsv=require(_0xb6c7('0x6'));var querystring=require(_0xb6c7('0xd'));var Papa=require(_0xb6c7('0xe'));var Redis=require(_0xb6c7('0xf'));var authService=require(_0xb6c7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6c7('0x11'));var logger=require(_0xb6c7('0x12'))(_0xb6c7('0x13'));var utils=require(_0xb6c7('0x14'));var config=require(_0xb6c7('0x15'));var licenseUtil=require(_0xb6c7('0x16'));var db=require(_0xb6c7('0x17'))['db'];function respondWithStatusCode(_0x50c2de,_0x9b32b7){_0x9b32b7=_0x9b32b7||0xcc;return function(_0xa858c5){if(_0xa858c5){return _0x50c2de[_0xb6c7('0x18')](_0x9b32b7);}return _0x50c2de[_0xb6c7('0x19')](_0x9b32b7)[_0xb6c7('0x1a')]();};}function respondWithResult(_0x383ac5,_0x147e4a){_0x147e4a=_0x147e4a||0xc8;return function(_0x561eb4){if(_0x561eb4){return _0x383ac5[_0xb6c7('0x19')](_0x147e4a)['json'](_0x561eb4);}};}function respondWithFilteredResult(_0x480d9a,_0x5d5428){return function(_0x19c145){if(_0x19c145){var _0x48b7ec=typeof _0x5d5428[_0xb6c7('0x1b')]===_0xb6c7('0x1c')&&typeof _0x5d5428[_0xb6c7('0x1d')]===_0xb6c7('0x1c');var _0x209659=_0x19c145[_0xb6c7('0x1e')];var _0x2c819d=_0x48b7ec?0x0:_0x5d5428[_0xb6c7('0x1b')];var _0x1a591f=_0x48b7ec?_0x19c145[_0xb6c7('0x1e')]:_0x5d5428[_0xb6c7('0x1b')]+_0x5d5428[_0xb6c7('0x1d')];var _0x3beafa;if(_0x1a591f>=_0x209659){_0x1a591f=_0x209659;_0x3beafa=0xc8;}else{_0x3beafa=0xce;}_0x480d9a['status'](_0x3beafa);return _0x480d9a[_0xb6c7('0x1f')](_0xb6c7('0x20'),_0x2c819d+'-'+_0x1a591f+'/'+_0x209659)['json'](_0x19c145);}return null;};}function patchUpdates(_0x25ca5d){return function(_0x5a1c0a){try{jsonpatch[_0xb6c7('0x21')](_0x5a1c0a,_0x25ca5d,!![]);}catch(_0x5b7ebf){return BPromise[_0xb6c7('0x22')](_0x5b7ebf);}return _0x5a1c0a['save']();};}function saveUpdates(_0x24c0b3,_0x146dd4){return function(_0x4a4788){if(_0x4a4788){return _0x4a4788[_0xb6c7('0x23')](_0x24c0b3)[_0xb6c7('0x24')](function(_0x2081a6){return _0x2081a6;});}return null;};}function removeEntity(_0x4232b6,_0xd33675){return function(_0x1ee45d){if(_0x1ee45d){return _0x1ee45d['destroy']()[_0xb6c7('0x24')](function(){_0x4232b6[_0xb6c7('0x19')](0xcc)[_0xb6c7('0x1a')]();});}};}function handleEntityNotFound(_0x418920,_0x5ed41e){return function(_0x1eb265){if(!_0x1eb265){_0x418920[_0xb6c7('0x18')](0x194);}return _0x1eb265;};}function handleError(_0x49909e,_0x1eee74){_0x1eee74=_0x1eee74||0x1f4;return function(_0x164801){logger[_0xb6c7('0x25')](_0x164801[_0xb6c7('0x26')]);if(_0x164801['name']){delete _0x164801[_0xb6c7('0x27')];}_0x49909e['status'](_0x1eee74)[_0xb6c7('0x28')](_0x164801);};}exports[_0xb6c7('0x29')]=function(_0x232f7f,_0x5f3be2){var _0x47acab={},_0x4f19da={},_0x438dc3={'count':0x0,'rows':[]};var _0xcd9464=_[_0xb6c7('0x2a')](db[_0xb6c7('0x2b')][_0xb6c7('0x2c')],function(_0x1b4180){return{'name':_0x1b4180[_0xb6c7('0x2d')],'type':_0x1b4180[_0xb6c7('0x2e')][_0xb6c7('0x2f')]};});_0x4f19da[_0xb6c7('0x30')]=_['map'](_0xcd9464,_0xb6c7('0x27'));_0x4f19da['query']=_[_0xb6c7('0x31')](_0x232f7f[_0xb6c7('0x32')]);_0x4f19da[_0xb6c7('0x33')]=_[_0xb6c7('0x34')](_0x4f19da[_0xb6c7('0x30')],_0x4f19da['query']);_0x47acab['attributes']=_['intersection'](_0x4f19da[_0xb6c7('0x30')],qs[_0xb6c7('0x35')](_0x232f7f['query'][_0xb6c7('0x35')]));_0x47acab[_0xb6c7('0x36')]=_0x47acab['attributes'][_0xb6c7('0x37')]?_0x47acab[_0xb6c7('0x36')]:_0x4f19da[_0xb6c7('0x30')];if(!_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x38')](_0xb6c7('0x39'))){_0x47acab['limit']=qs[_0xb6c7('0x1d')](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x1d')]);_0x47acab[_0xb6c7('0x1b')]=qs[_0xb6c7('0x1b')](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x1b')]);}_0x47acab['order']=qs['sort'](_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x3a')]);_0x47acab[_0xb6c7('0x3b')]=qs[_0xb6c7('0x33')](_[_0xb6c7('0x3c')](_0x232f7f[_0xb6c7('0x32')],_0x4f19da[_0xb6c7('0x33')]),_0xcd9464);if(_0x232f7f[_0xb6c7('0x32')][_0xb6c7('0x3d')]){_0x47acab[_0xb6c7('0x3b')]=_['merge'](_0x47acab[_0xb6c7('0x3b')],{'$or':_['map'](_0xcd9464,function(_0x5836e9){if(_0x5836e9[_0xb6c7('0x2e')]!=='VIRTUAL'){var _0x3af5be={};_0x3af5be[_0x5836e9[_0xb6c7('0x27')]]={'$like':'%'+_0x232f7f['query'][_0xb6c7('0x3d')]+'%'};return _0x3af5be;}})});}_0x47acab=_[_0xb6c7('0x3e')]({},_0x47acab,_0x232f7f[_0xb6c7('0x3f')]);var _0x84861f={'where':_0x47acab[_0xb6c7('0x3b')]};return db['Cdr']['count'](_0x84861f)[_0xb6c7('0x24')](function(_0xb575){_0x438dc3[_0xb6c7('0x1e')]=_0xb575;if(_0x232f7f[_0xb6c7('0x32')]['includeAll']){_0x47acab['include']=[{'all':!![]}];}return db[_0xb6c7('0x2b')][_0xb6c7('0x40')](_0x47acab);})[_0xb6c7('0x24')](function(_0x214d04){_0x438dc3[_0xb6c7('0x41')]=_0x214d04;return _0x438dc3;})['then'](respondWithFilteredResult(_0x5f3be2,_0x47acab))['catch'](handleError(_0x5f3be2,null));};exports['show']=function(_0x45369e,_0x80ee40){var _0x4462dc={'raw':!![],'where':{'id':_0x45369e[_0xb6c7('0x42')]['id']}},_0x5050c9={};_0x5050c9[_0xb6c7('0x30')]=_['keys'](db[_0xb6c7('0x2b')][_0xb6c7('0x2c')]);_0x5050c9[_0xb6c7('0x32')]=_[_0xb6c7('0x31')](_0x45369e[_0xb6c7('0x32')]);_0x5050c9['filters']=_[_0xb6c7('0x34')](_0x5050c9[_0xb6c7('0x30')],_0x5050c9[_0xb6c7('0x32')]);_0x4462dc['attributes']=_['intersection'](_0x5050c9[_0xb6c7('0x30')],qs[_0xb6c7('0x35')](_0x45369e[_0xb6c7('0x32')]['fields']));_0x4462dc['attributes']=_0x4462dc['attributes'][_0xb6c7('0x37')]?_0x4462dc[_0xb6c7('0x36')]:_0x5050c9[_0xb6c7('0x30')];if(_0x45369e[_0xb6c7('0x32')][_0xb6c7('0x43')]){_0x4462dc[_0xb6c7('0x44')]=[{'all':!![]}];}_0x4462dc=_[_0xb6c7('0x3e')]({},_0x4462dc,_0x45369e['options']);return db[_0xb6c7('0x2b')][_0xb6c7('0x45')](_0x4462dc)[_0xb6c7('0x24')](handleEntityNotFound(_0x80ee40,null))[_0xb6c7('0x24')](respondWithResult(_0x80ee40,null))[_0xb6c7('0x46')](handleError(_0x80ee40,null));};exports['create']=function(_0x33b9a2,_0x40bbff){return db[_0xb6c7('0x2b')][_0xb6c7('0x47')](_0x33b9a2[_0xb6c7('0x48')],{})[_0xb6c7('0x24')](respondWithResult(_0x40bbff,0xc9))['catch'](handleError(_0x40bbff,null));};exports[_0xb6c7('0x23')]=function(_0x141cd5,_0x2116cb){if(_0x141cd5[_0xb6c7('0x48')]['id']){delete _0x141cd5[_0xb6c7('0x48')]['id'];}return db[_0xb6c7('0x2b')][_0xb6c7('0x45')]({'where':{'id':_0x141cd5['params']['id']}})['then'](handleEntityNotFound(_0x2116cb,null))['then'](saveUpdates(_0x141cd5[_0xb6c7('0x48')],null))[_0xb6c7('0x24')](respondWithResult(_0x2116cb,null))[_0xb6c7('0x46')](handleError(_0x2116cb,null));};exports[_0xb6c7('0x49')]=function(_0x2278c0,_0x2002f8){return db['Cdr']['find']({'where':{'id':_0x2278c0[_0xb6c7('0x42')]['id']}})['then'](handleEntityNotFound(_0x2002f8,null))[_0xb6c7('0x24')](removeEntity(_0x2002f8,null))[_0xb6c7('0x46')](handleError(_0x2002f8,null));};exports[_0xb6c7('0x4a')]=function(_0x210d50,_0x317a4b){return db['Cdr'][_0xb6c7('0x4a')]()['then'](respondWithResult(_0x317a4b,null))[_0xb6c7('0x46')](handleError(_0x317a4b,null));}; \ No newline at end of file +var _0x029b=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','send','index','map','Cdr'];(function(_0x58ddf0,_0x3730da){var _0x53e079=function(_0x386a47){while(--_0x386a47){_0x58ddf0['push'](_0x58ddf0['shift']());}};_0x53e079(++_0x3730da);}(_0x029b,0x66));var _0xb029=function(_0x1c4661,_0x290f14){_0x1c4661=_0x1c4661-0x0;var _0x30c27b=_0x029b[_0x1c4661];return _0x30c27b;};'use strict';var emlformat=require(_0xb029('0x0'));var rimraf=require(_0xb029('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb029('0x2'));var rp=require(_0xb029('0x3'));var moment=require('moment');var BPromise=require(_0xb029('0x4'));var Mustache=require(_0xb029('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb029('0x6'));var csv=require(_0xb029('0x7'));var ejs=require(_0xb029('0x8'));var fs=require('fs');var fs_extra=require(_0xb029('0x9'));var _=require(_0xb029('0xa'));var squel=require('squel');var crypto=require(_0xb029('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb029('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb029('0xd'));var Papa=require('papaparse');var Redis=require(_0xb029('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb029('0xf'));var as=require(_0xb029('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb029('0x11'))(_0xb029('0x12'));var utils=require(_0xb029('0x13'));var config=require(_0xb029('0x14'));var licenseUtil=require(_0xb029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c87c,_0x4b6202){_0x4b6202=_0x4b6202||0xcc;return function(_0x2ba6c2){if(_0x2ba6c2){return _0x13c87c[_0xb029('0x16')](_0x4b6202);}return _0x13c87c[_0xb029('0x17')](_0x4b6202)[_0xb029('0x18')]();};}function respondWithResult(_0x5ce391,_0x337ab5){_0x337ab5=_0x337ab5||0xc8;return function(_0x356552){if(_0x356552){return _0x5ce391[_0xb029('0x17')](_0x337ab5)['json'](_0x356552);}};}function respondWithFilteredResult(_0x5617c,_0x3afa2b){return function(_0x379fdb){if(_0x379fdb){var _0x3434cf=typeof _0x3afa2b[_0xb029('0x19')]===_0xb029('0x1a')&&typeof _0x3afa2b[_0xb029('0x1b')]===_0xb029('0x1a');var _0x3f91cb=_0x379fdb['count'];var _0x58fbe7=_0x3434cf?0x0:_0x3afa2b[_0xb029('0x19')];var _0x5373cd=_0x3434cf?_0x379fdb[_0xb029('0x1c')]:_0x3afa2b[_0xb029('0x19')]+_0x3afa2b[_0xb029('0x1b')];var _0x497ca0;if(_0x5373cd>=_0x3f91cb){_0x5373cd=_0x3f91cb;_0x497ca0=0xc8;}else{_0x497ca0=0xce;}_0x5617c['status'](_0x497ca0);return _0x5617c[_0xb029('0x1d')](_0xb029('0x1e'),_0x58fbe7+'-'+_0x5373cd+'/'+_0x3f91cb)[_0xb029('0x1f')](_0x379fdb);}return null;};}function patchUpdates(_0x3381b2){return function(_0x3c4396){try{jsonpatch[_0xb029('0x20')](_0x3c4396,_0x3381b2,!![]);}catch(_0x530486){return BPromise['reject'](_0x530486);}return _0x3c4396['save']();};}function saveUpdates(_0x5a79fa,_0x3e1dc4){return function(_0x1e16a3){if(_0x1e16a3){return _0x1e16a3[_0xb029('0x21')](_0x5a79fa)[_0xb029('0x22')](function(_0x500bb6){return _0x500bb6;});}return null;};}function removeEntity(_0x3642b5,_0x379ef3){return function(_0x42b91e){if(_0x42b91e){return _0x42b91e[_0xb029('0x23')]()[_0xb029('0x22')](function(){_0x3642b5[_0xb029('0x17')](0xcc)[_0xb029('0x18')]();});}};}function handleEntityNotFound(_0x3eb5ac,_0x147ad0){return function(_0x3671e6){if(!_0x3671e6){_0x3eb5ac[_0xb029('0x16')](0x194);}return _0x3671e6;};}function handleError(_0x22dccd,_0x279e4a){_0x279e4a=_0x279e4a||0x1f4;return function(_0x599a14){logger[_0xb029('0x24')](_0x599a14[_0xb029('0x25')]);if(_0x599a14['name']){delete _0x599a14['name'];}_0x22dccd[_0xb029('0x17')](_0x279e4a)[_0xb029('0x26')](_0x599a14);};}exports[_0xb029('0x27')]=function(_0x45cb0c,_0x3632a0){var _0x4af2ad={},_0x605a61={},_0x4a4100={'count':0x0,'rows':[]};var _0x2b2d98=_[_0xb029('0x28')](db[_0xb029('0x29')]['rawAttributes'],function(_0x1aa94b){return{'name':_0x1aa94b[_0xb029('0x2a')],'type':_0x1aa94b['type'][_0xb029('0x2b')]};});_0x605a61['model']=_[_0xb029('0x28')](_0x2b2d98,'name');_0x605a61[_0xb029('0x2c')]=_[_0xb029('0x2d')](_0x45cb0c[_0xb029('0x2c')]);_0x605a61[_0xb029('0x2e')]=_[_0xb029('0x2f')](_0x605a61[_0xb029('0x30')],_0x605a61[_0xb029('0x2c')]);_0x4af2ad[_0xb029('0x31')]=_['intersection'](_0x605a61[_0xb029('0x30')],qs[_0xb029('0x32')](_0x45cb0c[_0xb029('0x2c')]['fields']));_0x4af2ad[_0xb029('0x31')]=_0x4af2ad[_0xb029('0x31')]['length']?_0x4af2ad[_0xb029('0x31')]:_0x605a61['model'];if(!_0x45cb0c[_0xb029('0x2c')]['hasOwnProperty'](_0xb029('0x33'))){_0x4af2ad[_0xb029('0x1b')]=qs[_0xb029('0x1b')](_0x45cb0c[_0xb029('0x2c')][_0xb029('0x1b')]);_0x4af2ad[_0xb029('0x19')]=qs[_0xb029('0x19')](_0x45cb0c['query'][_0xb029('0x19')]);}_0x4af2ad[_0xb029('0x34')]=qs['sort'](_0x45cb0c[_0xb029('0x2c')][_0xb029('0x35')]);_0x4af2ad[_0xb029('0x36')]=qs[_0xb029('0x2e')](_['pick'](_0x45cb0c[_0xb029('0x2c')],_0x605a61[_0xb029('0x2e')]),_0x2b2d98);if(_0x45cb0c[_0xb029('0x2c')]['filter']){_0x4af2ad[_0xb029('0x36')]=_[_0xb029('0x37')](_0x4af2ad[_0xb029('0x36')],{'$or':_[_0xb029('0x28')](_0x2b2d98,function(_0x109fe6){if(_0x109fe6[_0xb029('0x38')]!==_0xb029('0x39')){var _0x30cb15={};_0x30cb15[_0x109fe6[_0xb029('0x3a')]]={'$like':'%'+_0x45cb0c[_0xb029('0x2c')]['filter']+'%'};return _0x30cb15;}})});}_0x4af2ad=_[_0xb029('0x37')]({},_0x4af2ad,_0x45cb0c[_0xb029('0x3b')]);var _0x117b1a={'where':_0x4af2ad['where']};return db['Cdr']['count'](_0x117b1a)[_0xb029('0x22')](function(_0x41a857){_0x4a4100['count']=_0x41a857;if(_0x45cb0c[_0xb029('0x2c')][_0xb029('0x3c')]){_0x4af2ad[_0xb029('0x3d')]=[{'all':!![]}];}return db[_0xb029('0x29')][_0xb029('0x3e')](_0x4af2ad);})['then'](function(_0x2f5599){_0x4a4100[_0xb029('0x3f')]=_0x2f5599;return _0x4a4100;})['then'](respondWithFilteredResult(_0x3632a0,_0x4af2ad))[_0xb029('0x40')](handleError(_0x3632a0,null));};exports[_0xb029('0x41')]=function(_0x3ab1ed,_0x56a470){var _0x100680={'raw':!![],'where':{'id':_0x3ab1ed['params']['id']}},_0x72212c={};_0x72212c['model']=_[_0xb029('0x2d')](db[_0xb029('0x29')][_0xb029('0x42')]);_0x72212c[_0xb029('0x2c')]=_['keys'](_0x3ab1ed['query']);_0x72212c[_0xb029('0x2e')]=_['intersection'](_0x72212c[_0xb029('0x30')],_0x72212c['query']);_0x100680[_0xb029('0x31')]=_[_0xb029('0x2f')](_0x72212c[_0xb029('0x30')],qs[_0xb029('0x32')](_0x3ab1ed[_0xb029('0x2c')][_0xb029('0x32')]));_0x100680['attributes']=_0x100680[_0xb029('0x31')]['length']?_0x100680['attributes']:_0x72212c[_0xb029('0x30')];if(_0x3ab1ed['query'][_0xb029('0x3c')]){_0x100680['include']=[{'all':!![]}];}_0x100680=_[_0xb029('0x37')]({},_0x100680,_0x3ab1ed[_0xb029('0x3b')]);return db[_0xb029('0x29')][_0xb029('0x43')](_0x100680)['then'](handleEntityNotFound(_0x56a470,null))[_0xb029('0x22')](respondWithResult(_0x56a470,null))[_0xb029('0x40')](handleError(_0x56a470,null));};exports[_0xb029('0x44')]=function(_0x39782b,_0x370b39){return db[_0xb029('0x29')][_0xb029('0x44')](_0x39782b[_0xb029('0x45')],{})[_0xb029('0x22')](respondWithResult(_0x370b39,0xc9))[_0xb029('0x40')](handleError(_0x370b39,null));};exports['update']=function(_0x6c5bd5,_0x2345cd){if(_0x6c5bd5[_0xb029('0x45')]['id']){delete _0x6c5bd5[_0xb029('0x45')]['id'];}return db['Cdr'][_0xb029('0x43')]({'where':{'id':_0x6c5bd5['params']['id']}})[_0xb029('0x22')](handleEntityNotFound(_0x2345cd,null))[_0xb029('0x22')](saveUpdates(_0x6c5bd5[_0xb029('0x45')],null))[_0xb029('0x22')](respondWithResult(_0x2345cd,null))[_0xb029('0x40')](handleError(_0x2345cd,null));};exports['destroy']=function(_0x4d994f,_0x35b25e){return db[_0xb029('0x29')][_0xb029('0x43')]({'where':{'id':_0x4d994f[_0xb029('0x46')]['id']}})[_0xb029('0x22')](handleEntityNotFound(_0x35b25e,null))[_0xb029('0x22')](removeEntity(_0x35b25e,null))['catch'](handleError(_0x35b25e,null));};exports[_0xb029('0x47')]=function(_0x1b584d,_0x7eee04){return db['Cdr']['describe']()[_0xb029('0x22')](respondWithResult(_0x7eee04,null))['catch'](handleError(_0x7eee04,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index c059717..dbf392f 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(_0x3e74d6,_0xe1ce2c){var _0x55c422=function(_0x66e378){while(--_0x66e378){_0x3e74d6['push'](_0x3e74d6['shift']());}};_0x55c422(++_0xe1ce2c);}(_0x7a54,0x106));var _0x47a5=function(_0x30df8b,_0x4c0ade){_0x30df8b=_0x30df8b-0x0;var _0x3befb6=_0x7a54[_0x30df8b];return _0x3befb6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x35bdd2,_0x332959){var _0x59ffb5=function(_0x57216c){while(--_0x57216c){_0x35bdd2['push'](_0x35bdd2['shift']());}};_0x59ffb5(++_0x332959);}(_0x7a54,0x106));var _0x47a5=function(_0x52a88d,_0xaf7d6b){_0x52a88d=_0x52a88d-0x0;var _0x1c49a0=_0x7a54[_0x52a88d];return _0x1c49a0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index a9ef26d..f35c4da 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 _0x13c3=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','result'];(function(_0x9d61de,_0x1a5cfe){var _0x5ccaa9=function(_0x21b8e8){while(--_0x21b8e8){_0x9d61de['push'](_0x9d61de['shift']());}};_0x5ccaa9(++_0x1a5cfe);}(_0x13c3,0x190));var _0x313c=function(_0x476e79,_0x2f3250){_0x476e79=_0x476e79-0x0;var _0x5c548b=_0x13c3[_0x476e79];return _0x5c548b;};'use strict';var _=require(_0x313c('0x0'));var util=require(_0x313c('0x1'));var moment=require(_0x313c('0x2'));var BPromise=require(_0x313c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x313c('0x4'))['db'];var utils=require(_0x313c('0x5'));var logger=require(_0x313c('0x6'))('rpc');var config=require(_0x313c('0x7'));var jayson=require(_0x313c('0x8'));var client=jayson[_0x313c('0x9')][_0x313c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x225108,_0x3b0508,_0x33c384){return new BPromise(function(_0x1eda8c,_0x5e9a0e){return client['request'](_0x225108,_0x33c384)['then'](function(_0x40843b){logger[_0x313c('0xb')]('Cdr,\x20%s,\x20%s',_0x3b0508,_0x313c('0xc'));logger[_0x313c('0xd')](_0x313c('0xe'),_0x3b0508,_0x313c('0xc'),JSON['stringify'](_0x40843b));if(_0x40843b[_0x313c('0xf')]){if(_0x40843b[_0x313c('0xf')][_0x313c('0x10')]===0x1f4){logger[_0x313c('0xf')](_0x313c('0x11'),_0x3b0508,_0x40843b['error']['message']);return _0x5e9a0e(_0x40843b[_0x313c('0xf')][_0x313c('0x12')]);}logger[_0x313c('0xf')](_0x313c('0x11'),_0x3b0508,_0x40843b['error'][_0x313c('0x12')]);return _0x1eda8c(_0x40843b[_0x313c('0xf')][_0x313c('0x12')]);}else{logger['info'](_0x313c('0x11'),_0x3b0508,_0x313c('0xc'));_0x1eda8c(_0x40843b[_0x313c('0x13')][_0x313c('0x12')]);}})[_0x313c('0x14')](function(_0x22a526){logger['error'](_0x313c('0x11'),_0x3b0508,_0x22a526);_0x5e9a0e(_0x22a526);});});} \ No newline at end of file +var _0x59ec=['debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x50f4e3,_0x3d2e75){var _0x277293=function(_0xdb9d72){while(--_0xdb9d72){_0x50f4e3['push'](_0x50f4e3['shift']());}};_0x277293(++_0x3d2e75);}(_0x59ec,0x8d));var _0xc59e=function(_0x392218,_0x2bf90b){_0x392218=_0x392218-0x0;var _0x1b4b59=_0x59ec[_0x392218];return _0x1b4b59;};'use strict';var _=require('lodash');var util=require(_0xc59e('0x0'));var moment=require(_0xc59e('0x1'));var BPromise=require(_0xc59e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc59e('0x3'));var db=require(_0xc59e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc59e('0x5'))(_0xc59e('0x6'));var config=require(_0xc59e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc59e('0x8')][_0xc59e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f5956,_0x10511f,_0x57d759){return new BPromise(function(_0x21a70a,_0x56b807){return client[_0xc59e('0xa')](_0x3f5956,_0x57d759)[_0xc59e('0xb')](function(_0x19d9bf){logger[_0xc59e('0xc')]('Cdr,\x20%s,\x20%s',_0x10511f,'request\x20sent');logger[_0xc59e('0xd')](_0xc59e('0xe'),_0x10511f,_0xc59e('0xf'),JSON[_0xc59e('0x10')](_0x19d9bf));if(_0x19d9bf['error']){if(_0x19d9bf[_0xc59e('0x11')]['code']===0x1f4){logger[_0xc59e('0x11')](_0xc59e('0x12'),_0x10511f,_0x19d9bf[_0xc59e('0x11')]['message']);return _0x56b807(_0x19d9bf[_0xc59e('0x11')][_0xc59e('0x13')]);}logger[_0xc59e('0x11')](_0xc59e('0x12'),_0x10511f,_0x19d9bf[_0xc59e('0x11')][_0xc59e('0x13')]);return _0x21a70a(_0x19d9bf[_0xc59e('0x11')][_0xc59e('0x13')]);}else{logger[_0xc59e('0xc')]('Cdr,\x20%s,\x20%s',_0x10511f,_0xc59e('0xf'));_0x21a70a(_0x19d9bf[_0xc59e('0x14')][_0xc59e('0x13')]);}})[_0xc59e('0x15')](function(_0x13d600){logger[_0xc59e('0x11')](_0xc59e('0x12'),_0x10511f,_0x13d600);_0x56b807(_0x13d600);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0f15b9f..2f48376 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(_0x3a2798,_0x2e2ec6){var _0x2c5a84=function(_0x5f3e94){while(--_0x5f3e94){_0x3a2798['push'](_0x3a2798['shift']());}};_0x2c5a84(++_0x2e2ec6);}(_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('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 9207735..bfe1f17 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 _0xc89c=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x5616fa,_0x573465){var _0x524365=function(_0x2ab857){while(--_0x2ab857){_0x5616fa['push'](_0x5616fa['shift']());}};_0x524365(++_0x573465);}(_0xc89c,0xd8));var _0xcc89=function(_0x26369b,_0x2ed411){_0x26369b=_0x26369b-0x0;var _0x49280b=_0xc89c[_0x26369b];return _0x49280b;};'use strict';var Sequelize=require(_0xcc89('0x0'));module[_0xcc89('0x1')]={'priority':{'type':Sequelize[_0xcc89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcc89('0x3')],'allowNull':![],'defaultValue':_0xcc89('0x4')},'appdata':{'type':Sequelize[_0xcc89('0x5')]()},'description':{'type':Sequelize[_0xcc89('0x3')]},'interval':{'type':Sequelize[_0xcc89('0x3')],'defaultValue':_0xcc89('0x6')}}; \ No newline at end of file +var _0xeb92=['exports','STRING','TEXT','sequelize'];(function(_0x371ee1,_0x4ce182){var _0x38725d=function(_0x266148){while(--_0x266148){_0x371ee1['push'](_0x371ee1['shift']());}};_0x38725d(++_0x4ce182);}(_0xeb92,0x1e3));var _0x2eb9=function(_0x5a92cb,_0x421d4e){_0x5a92cb=_0x5a92cb-0x0;var _0x3b710d=_0xeb92[_0x5a92cb];return _0x3b710d;};'use strict';var Sequelize=require(_0x2eb9('0x0'));module[_0x2eb9('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2eb9('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2eb9('0x3')]()},'description':{'type':Sequelize[_0x2eb9('0x2')]},'interval':{'type':Sequelize[_0x2eb9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index fab73d1..6aa5a89 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 _0x3308=['../../config/license/util','sendStatus','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','includeAll','options','ChatApplication','find','catch','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x466bc5,_0x3a0f2a){var _0x138952=function(_0x392fa2){while(--_0x392fa2){_0x466bc5['push'](_0x466bc5['shift']());}};_0x138952(++_0x3a0f2a);}(_0x3308,0x160));var _0x8330=function(_0x190219,_0x28644d){_0x190219=_0x190219-0x0;var _0x4a5fb9=_0x3308[_0x190219];return _0x4a5fb9;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require(_0x8330('0x3'));var rp=require(_0x8330('0x4'));var moment=require(_0x8330('0x5'));var BPromise=require(_0x8330('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8330('0x7'));var sox=require('sox');var csv=require(_0x8330('0x8'));var ejs=require(_0x8330('0x9'));var fs=require('fs');var fs_extra=require(_0x8330('0xa'));var _=require('lodash');var squel=require(_0x8330('0xb'));var crypto=require(_0x8330('0xc'));var jsforce=require(_0x8330('0xd'));var deskjs=require(_0x8330('0xe'));var toCsv=require(_0x8330('0x8'));var querystring=require(_0x8330('0xf'));var Papa=require('papaparse');var Redis=require(_0x8330('0x10'));var authService=require(_0x8330('0x11'));var qs=require(_0x8330('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8330('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12d0ff,_0x1da381){_0x1da381=_0x1da381||0xcc;return function(_0x252953){if(_0x252953){return _0x12d0ff[_0x8330('0x14')](_0x1da381);}return _0x12d0ff[_0x8330('0x15')](_0x1da381)['end']();};}function respondWithResult(_0x199da4,_0x4f0cf0){_0x4f0cf0=_0x4f0cf0||0xc8;return function(_0x293658){if(_0x293658){return _0x199da4[_0x8330('0x15')](_0x4f0cf0)[_0x8330('0x16')](_0x293658);}};}function respondWithFilteredResult(_0x962a55,_0x432aca){return function(_0x28998e){if(_0x28998e){var _0x2c3e2f=typeof _0x432aca[_0x8330('0x17')]===_0x8330('0x18')&&typeof _0x432aca['limit']===_0x8330('0x18');var _0x2486ba=_0x28998e['count'];var _0x25853c=_0x2c3e2f?0x0:_0x432aca[_0x8330('0x17')];var _0x457dc7=_0x2c3e2f?_0x28998e['count']:_0x432aca[_0x8330('0x17')]+_0x432aca['limit'];var _0x396f60;if(_0x457dc7>=_0x2486ba){_0x457dc7=_0x2486ba;_0x396f60=0xc8;}else{_0x396f60=0xce;}_0x962a55[_0x8330('0x15')](_0x396f60);return _0x962a55[_0x8330('0x19')](_0x8330('0x1a'),_0x25853c+'-'+_0x457dc7+'/'+_0x2486ba)['json'](_0x28998e);}return null;};}function patchUpdates(_0x31efc9){return function(_0x518236){try{jsonpatch[_0x8330('0x1b')](_0x518236,_0x31efc9,!![]);}catch(_0x5a62e9){return BPromise[_0x8330('0x1c')](_0x5a62e9);}return _0x518236[_0x8330('0x1d')]();};}function saveUpdates(_0x1b213f,_0x350895){return function(_0x317045){if(_0x317045){return _0x317045[_0x8330('0x1e')](_0x1b213f)[_0x8330('0x1f')](function(_0x467ac4){return _0x467ac4;});}return null;};}function removeEntity(_0x21ddaf,_0x2770ca){return function(_0x3fa722){if(_0x3fa722){return _0x3fa722['destroy']()['then'](function(){_0x21ddaf['status'](0xcc)[_0x8330('0x20')]();});}};}function handleEntityNotFound(_0x1fb538,_0x36db54){return function(_0xa04d8){if(!_0xa04d8){_0x1fb538[_0x8330('0x14')](0x194);}return _0xa04d8;};}function handleError(_0x7ea841,_0x19465b){_0x19465b=_0x19465b||0x1f4;return function(_0x4e7aaa){logger[_0x8330('0x21')](_0x4e7aaa[_0x8330('0x22')]);if(_0x4e7aaa['name']){delete _0x4e7aaa[_0x8330('0x23')];}_0x7ea841[_0x8330('0x15')](_0x19465b)[_0x8330('0x24')](_0x4e7aaa);};}exports[_0x8330('0x25')]=function(_0x3cedfb,_0x5297af){var _0x38e8d2={'raw':!![],'where':{'id':_0x3cedfb[_0x8330('0x26')]['id']}},_0x4baceb={};_0x4baceb[_0x8330('0x27')]=_[_0x8330('0x28')](db['ChatApplication'][_0x8330('0x29')]);_0x4baceb[_0x8330('0x2a')]=_['keys'](_0x3cedfb[_0x8330('0x2a')]);_0x4baceb['filters']=_[_0x8330('0x2b')](_0x4baceb[_0x8330('0x27')],_0x4baceb[_0x8330('0x2a')]);_0x38e8d2[_0x8330('0x2c')]=_[_0x8330('0x2b')](_0x4baceb[_0x8330('0x27')],qs[_0x8330('0x2d')](_0x3cedfb[_0x8330('0x2a')][_0x8330('0x2d')]));_0x38e8d2[_0x8330('0x2c')]=_0x38e8d2[_0x8330('0x2c')]['length']?_0x38e8d2['attributes']:_0x4baceb[_0x8330('0x27')];if(_0x3cedfb['query'][_0x8330('0x2e')]){_0x38e8d2['include']=[{'all':!![]}];}_0x38e8d2=_['merge']({},_0x38e8d2,_0x3cedfb[_0x8330('0x2f')]);return db[_0x8330('0x30')][_0x8330('0x31')](_0x38e8d2)[_0x8330('0x1f')](handleEntityNotFound(_0x5297af,null))['then'](respondWithResult(_0x5297af,null))[_0x8330('0x32')](handleError(_0x5297af,null));};exports['update']=function(_0x2e4c07,_0x2b5584){if(_0x2e4c07[_0x8330('0x33')]['id']){delete _0x2e4c07[_0x8330('0x33')]['id'];}return db[_0x8330('0x30')][_0x8330('0x31')]({'where':{'id':_0x2e4c07['params']['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x2b5584,null))[_0x8330('0x1f')](saveUpdates(_0x2e4c07[_0x8330('0x33')],null))[_0x8330('0x1f')](respondWithResult(_0x2b5584,null))[_0x8330('0x32')](handleError(_0x2b5584,null));};exports[_0x8330('0x34')]=function(_0x331308,_0x3283c3){return db['ChatApplication']['find']({'where':{'id':_0x331308[_0x8330('0x26')]['id']}})[_0x8330('0x1f')](handleEntityNotFound(_0x3283c3,null))[_0x8330('0x1f')](removeEntity(_0x3283c3,null))[_0x8330('0x32')](handleError(_0x3283c3,null));}; \ No newline at end of file +var _0x2cae=['keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model'];(function(_0x2b6563,_0x3f16ca){var _0x2dc899=function(_0x342c6b){while(--_0x342c6b){_0x2b6563['push'](_0x2b6563['shift']());}};_0x2dc899(++_0x3f16ca);}(_0x2cae,0x16b));var _0xe2ca=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x2cae[_0x57add2];return _0x4e3670;};'use strict';var emlformat=require(_0xe2ca('0x0'));var rimraf=require(_0xe2ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2ca('0x2'));var moment=require(_0xe2ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2ca('0x4'));var util=require(_0xe2ca('0x5'));var path=require(_0xe2ca('0x6'));var sox=require(_0xe2ca('0x7'));var csv=require('to-csv');var ejs=require(_0xe2ca('0x8'));var fs=require('fs');var fs_extra=require(_0xe2ca('0x9'));var _=require('lodash');var squel=require(_0xe2ca('0xa'));var crypto=require('crypto');var jsforce=require(_0xe2ca('0xb'));var deskjs=require(_0xe2ca('0xc'));var toCsv=require(_0xe2ca('0xd'));var querystring=require(_0xe2ca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2ca('0xf'));var hardwareService=require(_0xe2ca('0x10'));var logger=require(_0xe2ca('0x11'))(_0xe2ca('0x12'));var utils=require(_0xe2ca('0x13'));var config=require(_0xe2ca('0x14'));var licenseUtil=require(_0xe2ca('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1138ee,_0x2773cc){_0x2773cc=_0x2773cc||0xcc;return function(_0x199237){if(_0x199237){return _0x1138ee[_0xe2ca('0x16')](_0x2773cc);}return _0x1138ee[_0xe2ca('0x17')](_0x2773cc)['end']();};}function respondWithResult(_0x31f283,_0x3cfcc9){_0x3cfcc9=_0x3cfcc9||0xc8;return function(_0x27c3ad){if(_0x27c3ad){return _0x31f283[_0xe2ca('0x17')](_0x3cfcc9)[_0xe2ca('0x18')](_0x27c3ad);}};}function respondWithFilteredResult(_0x3a9612,_0x1c1514){return function(_0x29cdcf){if(_0x29cdcf){var _0x326340=typeof _0x1c1514[_0xe2ca('0x19')]==='undefined'&&typeof _0x1c1514[_0xe2ca('0x1a')]==='undefined';var _0x4ca8fd=_0x29cdcf[_0xe2ca('0x1b')];var _0x18cd42=_0x326340?0x0:_0x1c1514['offset'];var _0x393c23=_0x326340?_0x29cdcf[_0xe2ca('0x1b')]:_0x1c1514[_0xe2ca('0x19')]+_0x1c1514['limit'];var _0x4380fb;if(_0x393c23>=_0x4ca8fd){_0x393c23=_0x4ca8fd;_0x4380fb=0xc8;}else{_0x4380fb=0xce;}_0x3a9612[_0xe2ca('0x17')](_0x4380fb);return _0x3a9612[_0xe2ca('0x1c')]('Content-Range',_0x18cd42+'-'+_0x393c23+'/'+_0x4ca8fd)[_0xe2ca('0x18')](_0x29cdcf);}return null;};}function patchUpdates(_0x56b574){return function(_0x16f418){try{jsonpatch[_0xe2ca('0x1d')](_0x16f418,_0x56b574,!![]);}catch(_0x60d8e8){return BPromise[_0xe2ca('0x1e')](_0x60d8e8);}return _0x16f418[_0xe2ca('0x1f')]();};}function saveUpdates(_0x1b98d8,_0x50af69){return function(_0x1a1522){if(_0x1a1522){return _0x1a1522[_0xe2ca('0x20')](_0x1b98d8)[_0xe2ca('0x21')](function(_0x2ca129){return _0x2ca129;});}return null;};}function removeEntity(_0x18a6c6,_0x2772b5){return function(_0xa1fa2b){if(_0xa1fa2b){return _0xa1fa2b[_0xe2ca('0x22')]()[_0xe2ca('0x21')](function(){_0x18a6c6['status'](0xcc)[_0xe2ca('0x23')]();});}};}function handleEntityNotFound(_0x272bb3,_0x3f3d6e){return function(_0xc52f5e){if(!_0xc52f5e){_0x272bb3[_0xe2ca('0x16')](0x194);}return _0xc52f5e;};}function handleError(_0x4b2a2e,_0x524b6c){_0x524b6c=_0x524b6c||0x1f4;return function(_0x20ac37){logger[_0xe2ca('0x24')](_0x20ac37[_0xe2ca('0x25')]);if(_0x20ac37[_0xe2ca('0x26')]){delete _0x20ac37[_0xe2ca('0x26')];}_0x4b2a2e[_0xe2ca('0x17')](_0x524b6c)[_0xe2ca('0x27')](_0x20ac37);};}exports[_0xe2ca('0x28')]=function(_0x565e9b,_0x5df46f){var _0x333665={'raw':!![],'where':{'id':_0x565e9b[_0xe2ca('0x29')]['id']}},_0x300d0e={};_0x300d0e[_0xe2ca('0x2a')]=_[_0xe2ca('0x2b')](db[_0xe2ca('0x2c')][_0xe2ca('0x2d')]);_0x300d0e[_0xe2ca('0x2e')]=_[_0xe2ca('0x2b')](_0x565e9b[_0xe2ca('0x2e')]);_0x300d0e[_0xe2ca('0x2f')]=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],_0x300d0e[_0xe2ca('0x2e')]);_0x333665['attributes']=_[_0xe2ca('0x30')](_0x300d0e[_0xe2ca('0x2a')],qs[_0xe2ca('0x31')](_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x31')]));_0x333665[_0xe2ca('0x32')]=_0x333665[_0xe2ca('0x32')]['length']?_0x333665['attributes']:_0x300d0e['model'];if(_0x565e9b[_0xe2ca('0x2e')][_0xe2ca('0x33')]){_0x333665[_0xe2ca('0x34')]=[{'all':!![]}];}_0x333665=_[_0xe2ca('0x35')]({},_0x333665,_0x565e9b[_0xe2ca('0x36')]);return db['ChatApplication'][_0xe2ca('0x37')](_0x333665)[_0xe2ca('0x21')](handleEntityNotFound(_0x5df46f,null))['then'](respondWithResult(_0x5df46f,null))[_0xe2ca('0x38')](handleError(_0x5df46f,null));};exports[_0xe2ca('0x20')]=function(_0x21d7bf,_0x48b0f8){if(_0x21d7bf[_0xe2ca('0x39')]['id']){delete _0x21d7bf[_0xe2ca('0x39')]['id'];}return db[_0xe2ca('0x2c')]['find']({'where':{'id':_0x21d7bf[_0xe2ca('0x29')]['id']}})['then'](handleEntityNotFound(_0x48b0f8,null))[_0xe2ca('0x21')](saveUpdates(_0x21d7bf['body'],null))['then'](respondWithResult(_0x48b0f8,null))[_0xe2ca('0x38')](handleError(_0x48b0f8,null));};exports[_0xe2ca('0x22')]=function(_0x2dbf5e,_0x57e784){return db[_0xe2ca('0x2c')][_0xe2ca('0x37')]({'where':{'id':_0x2dbf5e[_0xe2ca('0x29')]['id']}})[_0xe2ca('0x21')](handleEntityNotFound(_0x57e784,null))['then'](removeEntity(_0x57e784,null))['catch'](handleError(_0x57e784,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0c0b443..5bd4a25 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 _0x4d5d=['api','moment','request-promise','path','./chatApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x4d5d,0x111));var _0xd4d5=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0x4d5d[_0x289e64];return _0x30246c;};'use strict';var _=require(_0xd4d5('0x0'));var util=require(_0xd4d5('0x1'));var logger=require(_0xd4d5('0x2'))(_0xd4d5('0x3'));var moment=require(_0xd4d5('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4d5('0x5'));var fs=require('fs');var path=require(_0xd4d5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4d5('0x7'));module[_0xd4d5('0x8')]=function(_0x39c809,_0x2f36f0){return _0x39c809[_0xd4d5('0x9')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4d5('0xa'),'collate':_0xd4d5('0xb')});}; \ No newline at end of file +var _0x7fec=['rimraf','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x262817,_0x454c0a){var _0x5aa9e8=function(_0x3d74cc){while(--_0x3d74cc){_0x262817['push'](_0x262817['shift']());}};_0x5aa9e8(++_0x454c0a);}(_0x7fec,0x6e));var _0xc7fe=function(_0x53b490,_0x557fe3){_0x53b490=_0x53b490-0x0;var _0x4adda8=_0x7fec[_0x53b490];return _0x4adda8;};'use strict';var _=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var logger=require(_0xc7fe('0x2'))(_0xc7fe('0x3'));var moment=require(_0xc7fe('0x4'));var BPromise=require(_0xc7fe('0x5'));var rp=require(_0xc7fe('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7fe('0x7'));var config=require('../../config/environment');var attributes=require(_0xc7fe('0x8'));module[_0xc7fe('0x9')]=function(_0x2b7f4a,_0x5eafa3){return _0x2b7f4a['define'](_0xc7fe('0xa'),attributes,{'tableName':_0xc7fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc7fe('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 910f219..20b5e8a 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 _0xc601=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s'];(function(_0x28485c,_0x1a50fa){var _0x2a8578=function(_0x4849f3){while(--_0x4849f3){_0x28485c['push'](_0x28485c['shift']());}};_0x2a8578(++_0x1a50fa);}(_0xc601,0x1e8));var _0x1c60=function(_0x2e3efc,_0x2b26c2){_0x2e3efc=_0x2e3efc-0x0;var _0x275be1=_0xc601[_0x2e3efc];return _0x275be1;};'use strict';var _=require(_0x1c60('0x0'));var util=require(_0x1c60('0x1'));var moment=require(_0x1c60('0x2'));var BPromise=require('bluebird');var rs=require(_0x1c60('0x3'));var fs=require('fs');var Redis=require(_0x1c60('0x4'));var db=require(_0x1c60('0x5'))['db'];var utils=require(_0x1c60('0x6'));var logger=require(_0x1c60('0x7'))(_0x1c60('0x8'));var config=require(_0x1c60('0x9'));var jayson=require(_0x1c60('0xa'));var client=jayson[_0x1c60('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca37a,_0x264cac,_0x30c579){return new BPromise(function(_0x57e49d,_0x32b33e){return client[_0x1c60('0xc')](_0x1ca37a,_0x30c579)[_0x1c60('0xd')](function(_0x2a463f){logger[_0x1c60('0xe')](_0x1c60('0xf'),_0x264cac,_0x1c60('0x10'));logger[_0x1c60('0x11')](_0x1c60('0x12'),_0x264cac,'request\x20sent',JSON[_0x1c60('0x13')](_0x2a463f));if(_0x2a463f['error']){if(_0x2a463f['error'][_0x1c60('0x14')]===0x1f4){logger[_0x1c60('0x15')](_0x1c60('0xf'),_0x264cac,_0x2a463f[_0x1c60('0x15')][_0x1c60('0x16')]);return _0x32b33e(_0x2a463f[_0x1c60('0x15')][_0x1c60('0x16')]);}logger[_0x1c60('0x15')](_0x1c60('0xf'),_0x264cac,_0x2a463f['error'][_0x1c60('0x16')]);return _0x57e49d(_0x2a463f[_0x1c60('0x15')][_0x1c60('0x16')]);}else{logger[_0x1c60('0xe')]('ChatApplication,\x20%s,\x20%s',_0x264cac,_0x1c60('0x10'));_0x57e49d(_0x2a463f['result'][_0x1c60('0x16')]);}})[_0x1c60('0x17')](function(_0x42f3aa){logger[_0x1c60('0x15')](_0x1c60('0xf'),_0x264cac,_0x42f3aa);_0x32b33e(_0x42f3aa);});});} \ No newline at end of file +var _0x47d0=['result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','debug','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message'];(function(_0x2a78d9,_0x5885af){var _0x31b4d5=function(_0x463c46){while(--_0x463c46){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x31b4d5(++_0x5885af);}(_0x47d0,0x74));var _0x047d=function(_0x5854a1,_0x5091bd){_0x5854a1=_0x5854a1-0x0;var _0x357b9d=_0x47d0[_0x5854a1];return _0x357b9d;};'use strict';var _=require(_0x047d('0x0'));var util=require('util');var moment=require(_0x047d('0x1'));var BPromise=require(_0x047d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x047d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x047d('0x4'));var logger=require(_0x047d('0x5'))(_0x047d('0x6'));var config=require('../../config/environment');var jayson=require(_0x047d('0x7'));var client=jayson['client'][_0x047d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x220813,_0x3226dc,_0x1bcd62){return new BPromise(function(_0x5639b5,_0x4c31a4){return client[_0x047d('0x9')](_0x220813,_0x1bcd62)['then'](function(_0xf241c5){logger[_0x047d('0xa')]('ChatApplication,\x20%s,\x20%s',_0x3226dc,'request\x20sent');logger[_0x047d('0xb')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3226dc,_0x047d('0xc'),JSON['stringify'](_0xf241c5));if(_0xf241c5[_0x047d('0xd')]){if(_0xf241c5[_0x047d('0xd')][_0x047d('0xe')]===0x1f4){logger[_0x047d('0xd')](_0x047d('0xf'),_0x3226dc,_0xf241c5[_0x047d('0xd')][_0x047d('0x10')]);return _0x4c31a4(_0xf241c5[_0x047d('0xd')][_0x047d('0x10')]);}logger['error'](_0x047d('0xf'),_0x3226dc,_0xf241c5[_0x047d('0xd')][_0x047d('0x10')]);return _0x5639b5(_0xf241c5[_0x047d('0xd')][_0x047d('0x10')]);}else{logger[_0x047d('0xa')](_0x047d('0xf'),_0x3226dc,'request\x20sent');_0x5639b5(_0xf241c5[_0x047d('0x11')]['message']);}})[_0x047d('0x12')](function(_0x2f8dac){logger['error'](_0x047d('0xf'),_0x3226dc,_0x2f8dac);_0x4c31a4(_0x2f8dac);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 172515a..7f97143 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 _0x5954=['get','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5954,0x13a));var _0x4595=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5954[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x4595('0x0'));var util=require(_0x4595('0x1'));var path=require(_0x4595('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4595('0x3')]();var fs_extra=require(_0x4595('0x4'));var auth=require(_0x4595('0x5'));var interaction=require(_0x4595('0x6'));var config=require(_0x4595('0x7'));var controller=require(_0x4595('0x8'));router[_0x4595('0x9')]('/:id',auth[_0x4595('0xa')](),controller['show']);router[_0x4595('0xb')](_0x4595('0xc'),auth[_0x4595('0xa')](),controller[_0x4595('0xd')]);router[_0x4595('0xe')](_0x4595('0xc'),auth['isAuthenticated'](),controller[_0x4595('0xf')]);module[_0x4595('0x10')]=router; \ No newline at end of file +var _0x88fe=['exports','util','connect-timeout','express','../../components/auth/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x88fe,0x146));var _0xe88f=function(_0xc1a7d3,_0x6ac180){_0xc1a7d3=_0xc1a7d3-0x0;var _0x576e8d=_0x88fe[_0xc1a7d3];return _0x576e8d;};'use strict';var multer=require('multer');var util=require(_0xe88f('0x0'));var path=require('path');var timeout=require(_0xe88f('0x1'));var express=require(_0xe88f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe88f('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe88f('0x4'));router[_0xe88f('0x5')](_0xe88f('0x6'),auth[_0xe88f('0x7')](),controller[_0xe88f('0x8')]);router[_0xe88f('0x9')](_0xe88f('0x6'),auth[_0xe88f('0x7')](),controller[_0xe88f('0xa')]);router['delete'](_0xe88f('0x6'),auth['isAuthenticated'](),controller[_0xe88f('0xb')]);module[_0xe88f('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c98fccd..6ec43e1 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 _0x6e5b=['BOOLEAN','sequelize','STRING'];(function(_0x2aa0a0,_0x2fcf5b){var _0x44b07d=function(_0x1644a0){while(--_0x1644a0){_0x2aa0a0['push'](_0x2aa0a0['shift']());}};_0x44b07d(++_0x2fcf5b);}(_0x6e5b,0x1ae));var _0xb6e5=function(_0x10d8d1,_0x24e290){_0x10d8d1=_0x10d8d1-0x0;var _0x485436=_0x6e5b[_0x10d8d1];return _0x485436;};'use strict';var Sequelize=require(_0xb6e5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb6e5('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb6e5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4288=['sequelize','exports','STRING','BOOLEAN'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4288,0xb8));var _0x8428=function(_0x220b85,_0x33da37){_0x220b85=_0x220b85-0x0;var _0x3bb8ea=_0x4288[_0x220b85];return _0x3bb8ea;};'use strict';var Sequelize=require(_0x8428('0x0'));module[_0x8428('0x1')]={'name':{'type':Sequelize[_0x8428('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x8428('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4f40cf6..dad9b5c 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 _0x37c5=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','catch','show','rawAttributes','create','body','find','params','describe','ChatInternalMessage','addMembers','ids','omit','findOne','User','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3bab53,_0x46230f){var _0x1a969e=function(_0x15ecb1){while(--_0x15ecb1){_0x3bab53['push'](_0x3bab53['shift']());}};_0x1a969e(++_0x46230f);}(_0x37c5,0x1e6));var _0x537c=function(_0x48124f,_0x5959ce){_0x48124f=_0x48124f-0x0;var _0x1f9e33=_0x37c5[_0x48124f];return _0x1f9e33;};'use strict';var emlformat=require(_0x537c('0x0'));var rimraf=require(_0x537c('0x1'));var zipdir=require(_0x537c('0x2'));var jsonpatch=require(_0x537c('0x3'));var rp=require(_0x537c('0x4'));var moment=require(_0x537c('0x5'));var BPromise=require(_0x537c('0x6'));var Mustache=require(_0x537c('0x7'));var util=require('util');var path=require(_0x537c('0x8'));var sox=require(_0x537c('0x9'));var csv=require(_0x537c('0xa'));var ejs=require(_0x537c('0xb'));var fs=require('fs');var fs_extra=require(_0x537c('0xc'));var _=require(_0x537c('0xd'));var squel=require(_0x537c('0xe'));var crypto=require(_0x537c('0xf'));var jsforce=require(_0x537c('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x537c('0xa'));var querystring=require(_0x537c('0x11'));var Papa=require(_0x537c('0x12'));var Redis=require(_0x537c('0x13'));var authService=require(_0x537c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x15'));var hardwareService=require(_0x537c('0x16'));var logger=require(_0x537c('0x17'))(_0x537c('0x18'));var utils=require('../../config/utils');var config=require(_0x537c('0x19'));var licenseUtil=require(_0x537c('0x1a'));var db=require(_0x537c('0x1b'))['db'];config[_0x537c('0x1c')]=_[_0x537c('0x1d')](config[_0x537c('0x1c')],{'host':_0x537c('0x1e'),'port':0x18eb});var socket=require(_0x537c('0x1f'))(new Redis(config[_0x537c('0x1c')]));require(_0x537c('0x20'))['register'](socket);function respondWithStatusCode(_0x1ae054,_0x1e9569){_0x1e9569=_0x1e9569||0xcc;return function(_0x1504c7){if(_0x1504c7){return _0x1ae054[_0x537c('0x21')](_0x1e9569);}return _0x1ae054['status'](_0x1e9569)[_0x537c('0x22')]();};}function respondWithResult(_0x384c23,_0x5ed2c6){_0x5ed2c6=_0x5ed2c6||0xc8;return function(_0x53ca02){if(_0x53ca02){return _0x384c23[_0x537c('0x23')](_0x5ed2c6)['json'](_0x53ca02);}};}function respondWithFilteredResult(_0xa8c965,_0x40668b){return function(_0xc17ea0){if(_0xc17ea0){var _0x566855=typeof _0x40668b[_0x537c('0x24')]===_0x537c('0x25')&&typeof _0x40668b['limit']==='undefined';var _0xda9c56=_0xc17ea0[_0x537c('0x26')];var _0x22999a=_0x566855?0x0:_0x40668b['offset'];var _0x24d18b=_0x566855?_0xc17ea0[_0x537c('0x26')]:_0x40668b[_0x537c('0x24')]+_0x40668b[_0x537c('0x27')];var _0x3bfb90;if(_0x24d18b>=_0xda9c56){_0x24d18b=_0xda9c56;_0x3bfb90=0xc8;}else{_0x3bfb90=0xce;}_0xa8c965[_0x537c('0x23')](_0x3bfb90);return _0xa8c965[_0x537c('0x28')](_0x537c('0x29'),_0x22999a+'-'+_0x24d18b+'/'+_0xda9c56)[_0x537c('0x2a')](_0xc17ea0);}return null;};}function patchUpdates(_0xf899db){return function(_0x4a95af){try{jsonpatch['apply'](_0x4a95af,_0xf899db,!![]);}catch(_0x5351a1){return BPromise[_0x537c('0x2b')](_0x5351a1);}return _0x4a95af[_0x537c('0x2c')]();};}function saveUpdates(_0x1a4e83,_0x143592){return function(_0x3772ca){if(_0x3772ca){return _0x3772ca[_0x537c('0x2d')](_0x1a4e83)[_0x537c('0x2e')](function(_0x2a7686){return _0x2a7686;});}return null;};}function removeEntity(_0x18f3d2,_0x59d1ff){return function(_0x41b568){if(_0x41b568){return _0x41b568[_0x537c('0x2f')]()['then'](function(){_0x18f3d2['status'](0xcc)[_0x537c('0x22')]();});}};}function handleEntityNotFound(_0x59db39,_0x2a2260){return function(_0x4f817a){if(!_0x4f817a){_0x59db39[_0x537c('0x21')](0x194);}return _0x4f817a;};}function handleError(_0x1f6b11,_0x24d783){_0x24d783=_0x24d783||0x1f4;return function(_0x42068e){logger[_0x537c('0x30')](_0x42068e[_0x537c('0x31')]);if(_0x42068e[_0x537c('0x32')]){delete _0x42068e[_0x537c('0x32')];}_0x1f6b11[_0x537c('0x23')](_0x24d783)[_0x537c('0x33')](_0x42068e);};}exports[_0x537c('0x34')]=function(_0x2f9209,_0x3e3eb6){var _0x1a473f={},_0x53687f={},_0x121b5d={'count':0x0,'rows':[]};var _0x164517=_[_0x537c('0x35')](db[_0x537c('0x36')]['rawAttributes'],function(_0x326e92){return{'name':_0x326e92[_0x537c('0x37')],'type':_0x326e92[_0x537c('0x38')][_0x537c('0x39')]};});_0x53687f[_0x537c('0x3a')]=_[_0x537c('0x35')](_0x164517,_0x537c('0x32'));_0x53687f[_0x537c('0x3b')]=_[_0x537c('0x3c')](_0x2f9209[_0x537c('0x3b')]);_0x53687f['filters']=_[_0x537c('0x3d')](_0x53687f['model'],_0x53687f[_0x537c('0x3b')]);_0x1a473f[_0x537c('0x3e')]=_[_0x537c('0x3d')](_0x53687f[_0x537c('0x3a')],qs[_0x537c('0x3f')](_0x2f9209[_0x537c('0x3b')]['fields']));_0x1a473f['attributes']=_0x1a473f[_0x537c('0x3e')][_0x537c('0x40')]?_0x1a473f['attributes']:_0x53687f['model'];if(!_0x2f9209[_0x537c('0x3b')][_0x537c('0x41')]('nolimit')){_0x1a473f[_0x537c('0x27')]=qs[_0x537c('0x27')](_0x2f9209[_0x537c('0x3b')][_0x537c('0x27')]);_0x1a473f[_0x537c('0x24')]=qs['offset'](_0x2f9209[_0x537c('0x3b')]['offset']);}_0x1a473f['order']=qs[_0x537c('0x42')](_0x2f9209['query'][_0x537c('0x42')]);_0x1a473f[_0x537c('0x43')]=qs[_0x537c('0x44')](_[_0x537c('0x45')](_0x2f9209[_0x537c('0x3b')],_0x53687f[_0x537c('0x44')]),_0x164517);if(_0x2f9209['query']['filter']){_0x1a473f[_0x537c('0x43')]=_[_0x537c('0x46')](_0x1a473f[_0x537c('0x43')],{'$or':_[_0x537c('0x35')](_0x164517,function(_0x2e19e2){if(_0x2e19e2['type']!=='VIRTUAL'){var _0x29f4fa={};_0x29f4fa[_0x2e19e2['name']]={'$like':'%'+_0x2f9209[_0x537c('0x3b')][_0x537c('0x47')]+'%'};return _0x29f4fa;}})});}_0x1a473f=_[_0x537c('0x46')]({},_0x1a473f,_0x2f9209[_0x537c('0x48')]);var _0x4edaf4={'where':_0x1a473f[_0x537c('0x43')]};return db[_0x537c('0x36')][_0x537c('0x26')](_0x4edaf4)[_0x537c('0x2e')](function(_0x1af545){_0x121b5d['count']=_0x1af545;if(_0x2f9209[_0x537c('0x3b')][_0x537c('0x49')]){_0x1a473f[_0x537c('0x4a')]=[{'all':!![]}];}return db[_0x537c('0x36')]['findAll'](_0x1a473f);})[_0x537c('0x2e')](function(_0x4987cc){_0x121b5d[_0x537c('0x4b')]=_0x4987cc;return _0x121b5d;})[_0x537c('0x2e')](respondWithFilteredResult(_0x3e3eb6,_0x1a473f))[_0x537c('0x4c')](handleError(_0x3e3eb6,null));};exports[_0x537c('0x4d')]=function(_0x100840,_0x24191e){var _0x3b5c80={'raw':!![],'where':{'id':_0x100840['params']['id']}},_0xeeec8b={};_0xeeec8b[_0x537c('0x3a')]=_[_0x537c('0x3c')](db[_0x537c('0x36')][_0x537c('0x4e')]);_0xeeec8b[_0x537c('0x3b')]=_[_0x537c('0x3c')](_0x100840[_0x537c('0x3b')]);_0xeeec8b['filters']=_[_0x537c('0x3d')](_0xeeec8b[_0x537c('0x3a')],_0xeeec8b[_0x537c('0x3b')]);_0x3b5c80['attributes']=_['intersection'](_0xeeec8b['model'],qs[_0x537c('0x3f')](_0x100840[_0x537c('0x3b')][_0x537c('0x3f')]));_0x3b5c80[_0x537c('0x3e')]=_0x3b5c80[_0x537c('0x3e')][_0x537c('0x40')]?_0x3b5c80[_0x537c('0x3e')]:_0xeeec8b['model'];if(_0x100840[_0x537c('0x3b')][_0x537c('0x49')]){_0x3b5c80[_0x537c('0x4a')]=[{'all':!![]}];}_0x3b5c80=_[_0x537c('0x46')]({},_0x3b5c80,_0x100840['options']);return db['ChatGroup']['find'](_0x3b5c80)[_0x537c('0x2e')](handleEntityNotFound(_0x24191e,null))['then'](respondWithResult(_0x24191e,null))[_0x537c('0x4c')](handleError(_0x24191e,null));};exports[_0x537c('0x4f')]=function(_0x2b44d8,_0x5ea65f){return db[_0x537c('0x36')][_0x537c('0x4f')](_0x2b44d8[_0x537c('0x50')],{})[_0x537c('0x2e')](respondWithResult(_0x5ea65f,0xc9))[_0x537c('0x4c')](handleError(_0x5ea65f,null));};exports[_0x537c('0x2d')]=function(_0xc5589a,_0x524f18){if(_0xc5589a[_0x537c('0x50')]['id']){delete _0xc5589a[_0x537c('0x50')]['id'];}return db[_0x537c('0x36')][_0x537c('0x51')]({'where':{'id':_0xc5589a[_0x537c('0x52')]['id']}})[_0x537c('0x2e')](handleEntityNotFound(_0x524f18,null))['then'](saveUpdates(_0xc5589a[_0x537c('0x50')],null))[_0x537c('0x2e')](respondWithResult(_0x524f18,null))[_0x537c('0x4c')](handleError(_0x524f18,null));};exports['destroy']=function(_0x8ab1f0,_0x49e15f){return db[_0x537c('0x36')][_0x537c('0x51')]({'where':{'id':_0x8ab1f0[_0x537c('0x52')]['id']}})['then'](handleEntityNotFound(_0x49e15f,null))[_0x537c('0x2e')](removeEntity(_0x49e15f,null))[_0x537c('0x4c')](handleError(_0x49e15f,null));};exports[_0x537c('0x53')]=function(_0x5342a4,_0x4d80a0){return db[_0x537c('0x36')][_0x537c('0x53')]()[_0x537c('0x2e')](respondWithResult(_0x4d80a0,null))[_0x537c('0x4c')](handleError(_0x4d80a0,null));};exports['getUnread']=function(_0x4e8116,_0x441b3c,_0x16e975){return db[_0x537c('0x54')][_0x537c('0x26')]({'where':{'ChatGroupId':_0x4e8116[_0x537c('0x52')]['id'],'ToId':_0x4e8116['user']['id'],'read':![]}})[_0x537c('0x2e')](function(_0x489cfa){return{'id':_['toInteger'](_0x4e8116[_0x537c('0x52')]['id']),'count':_0x489cfa};})[_0x537c('0x2e')](respondWithResult(_0x441b3c,null))[_0x537c('0x4c')](handleError(_0x441b3c,null));};exports[_0x537c('0x55')]=function(_0x3fc4dd,_0x575b99,_0x509733){return db[_0x537c('0x36')][_0x537c('0x51')]({'where':{'id':_0x3fc4dd[_0x537c('0x52')]['id']}})[_0x537c('0x2e')](handleEntityNotFound(_0x575b99,null))[_0x537c('0x2e')](function(_0x34ec54){if(_0x34ec54){return _0x34ec54['addMembers'](_0x3fc4dd[_0x537c('0x50')][_0x537c('0x56')],_[_0x537c('0x57')](_0x3fc4dd[_0x537c('0x50')],[_0x537c('0x56'),'id'])||{});}})[_0x537c('0x2e')](respondWithResult(_0x575b99,null))[_0x537c('0x4c')](handleError(_0x575b99,null));};exports['getMembers']=function(_0x4a15d8,_0xcff549,_0x2dd30e){var _0x571366={};var _0x288d6a={};var _0xe47237;var _0x5dc1a7;return db['ChatGroup'][_0x537c('0x58')]({'where':{'id':_0x4a15d8['params']['id']}})[_0x537c('0x2e')](handleEntityNotFound(_0xcff549,null))[_0x537c('0x2e')](function(_0x3c7eb1){if(_0x3c7eb1){_0xe47237=_0x3c7eb1;_0x288d6a['model']=_['keys'](db[_0x537c('0x59')][_0x537c('0x4e')]);_0x288d6a[_0x537c('0x3b')]=_[_0x537c('0x3c')](_0x4a15d8[_0x537c('0x3b')]);_0x288d6a[_0x537c('0x44')]=_[_0x537c('0x3d')](_0x288d6a[_0x537c('0x3a')],_0x288d6a[_0x537c('0x3b')]);_0x571366[_0x537c('0x3e')]=_['intersection'](_0x288d6a[_0x537c('0x3a')],qs['fields'](_0x4a15d8[_0x537c('0x3b')]['fields']));_0x571366['attributes']=_0x571366['attributes']['length']?_0x571366[_0x537c('0x3e')]:_0x288d6a[_0x537c('0x3a')];_0x571366['order']=qs[_0x537c('0x42')](_0x4a15d8['query'][_0x537c('0x42')]);_0x571366[_0x537c('0x43')]=qs[_0x537c('0x44')](_[_0x537c('0x45')](_0x4a15d8['query'],_0x288d6a[_0x537c('0x44')]));if(_0x4a15d8[_0x537c('0x3b')][_0x537c('0x47')]){_0x571366[_0x537c('0x43')]=_[_0x537c('0x46')](_0x571366[_0x537c('0x43')],{'$or':_['map'](_0x571366[_0x537c('0x3e')],function(_0x3a1379){var _0x33b507={};_0x33b507[_0x3a1379]={'$like':'%'+_0x4a15d8['query'][_0x537c('0x47')]+'%'};return _0x33b507;})});}_0x571366=_[_0x537c('0x46')]({},_0x571366,_0x4a15d8[_0x537c('0x48')]);return _0xe47237[_0x537c('0x5a')](_0x571366);}})['then'](function(_0x3690ef){if(_0x3690ef){_0x5dc1a7=_0x3690ef[_0x537c('0x40')];if(!_0x4a15d8[_0x537c('0x3b')]['hasOwnProperty'](_0x537c('0x5b'))){_0x571366['limit']=qs[_0x537c('0x27')](_0x4a15d8[_0x537c('0x3b')][_0x537c('0x27')]);_0x571366[_0x537c('0x24')]=qs[_0x537c('0x24')](_0x4a15d8[_0x537c('0x3b')][_0x537c('0x24')]);}return _0xe47237[_0x537c('0x5a')](_0x571366);}})[_0x537c('0x2e')](function(_0x5b7a4b){if(_0x5b7a4b){return _0x5b7a4b?{'count':_0x5dc1a7,'rows':_0x5b7a4b}:null;}})[_0x537c('0x2e')](respondWithResult(_0xcff549,null))[_0x537c('0x4c')](handleError(_0xcff549,null));};exports[_0x537c('0x5c')]=function(_0x279de5,_0x5d2384,_0x2a45cc){return db[_0x537c('0x36')][_0x537c('0x51')]({'where':{'id':_0x279de5['params']['id']}})[_0x537c('0x2e')](handleEntityNotFound(_0x5d2384,null))['then'](function(_0x8e07ee){if(_0x8e07ee){return _0x8e07ee['removeMembers'](_0x279de5['query'][_0x537c('0x56')]);}})[_0x537c('0x2e')](respondWithStatusCode(_0x5d2384,null))['catch'](handleError(_0x5d2384,null));};exports[_0x537c('0x5d')]=function(_0x3467ce,_0x3d05f4,_0xde89fb){if(_0x3467ce[_0x537c('0x50')]['id']){delete _0x3467ce['body']['id'];}return db[_0x537c('0x36')]['find']({'where':{'id':_0x3467ce[_0x537c('0x52')]['id']}})[_0x537c('0x2e')](handleEntityNotFound(_0x3d05f4,null))[_0x537c('0x2e')](function(_0x24db0d){if(_0x24db0d){_0x3467ce[_0x537c('0x50')][_0x537c('0x5e')]=_0x24db0d['id'];return db[_0x537c('0x54')][_0x537c('0x4f')](_0x3467ce['body']);}})[_0x537c('0x2e')](respondWithResult(_0x3d05f4,null))[_0x537c('0x4c')](handleError(_0x3d05f4,null));};exports['getMessages']=function(_0x5ef4ca,_0x457924,_0x497901){var _0x47562c={};var _0x51604f={};var _0x4d4ed5;var _0x456d0f;return db[_0x537c('0x36')][_0x537c('0x58')]({'where':{'id':_0x5ef4ca['params']['id']}})['then'](handleEntityNotFound(_0x457924,null))[_0x537c('0x2e')](function(_0x8af16e){if(_0x8af16e){_0x4d4ed5=_0x8af16e;_0x51604f[_0x537c('0x3a')]=_['keys'](db[_0x537c('0x54')]['rawAttributes']);_0x51604f[_0x537c('0x3b')]=_[_0x537c('0x3c')](_0x5ef4ca[_0x537c('0x3b')]);_0x51604f[_0x537c('0x44')]=_[_0x537c('0x3d')](_0x51604f[_0x537c('0x3a')],_0x51604f[_0x537c('0x3b')]);_0x47562c[_0x537c('0x3e')]=_[_0x537c('0x3d')](_0x51604f[_0x537c('0x3a')],qs[_0x537c('0x3f')](_0x5ef4ca[_0x537c('0x3b')]['fields']));_0x47562c[_0x537c('0x3e')]=_0x47562c[_0x537c('0x3e')][_0x537c('0x40')]?_0x47562c[_0x537c('0x3e')]:_0x51604f[_0x537c('0x3a')];_0x47562c['order']=qs[_0x537c('0x42')](_0x5ef4ca[_0x537c('0x3b')][_0x537c('0x42')]);_0x47562c['where']=qs[_0x537c('0x44')](_[_0x537c('0x45')](_0x5ef4ca['query'],_0x51604f[_0x537c('0x44')]));if(_0x5ef4ca['query'][_0x537c('0x47')]){_0x47562c[_0x537c('0x43')]=_[_0x537c('0x46')](_0x47562c[_0x537c('0x43')],{'$or':_[_0x537c('0x35')](_0x47562c[_0x537c('0x3e')],function(_0x24f8e0){var _0x5722c1={};_0x5722c1[_0x24f8e0]={'$like':'%'+_0x5ef4ca[_0x537c('0x3b')][_0x537c('0x47')]+'%'};return _0x5722c1;})});}if(_0x5ef4ca[_0x537c('0x3b')]['$gte']){var _0x5ea9c0=_0x5ef4ca[_0x537c('0x3b')][_0x537c('0x5f')][_0x537c('0x60')](',');var _0x363e4c={};_0x363e4c[_0x5ea9c0[0x0]]={'$gte':moment(_0x5ea9c0[0x1])[_0x537c('0x61')](_0x537c('0x62'))};_0x47562c[_0x537c('0x43')]=_[_0x537c('0x46')](_0x47562c[_0x537c('0x43')],_0x363e4c);}_0x47562c=_['merge']({},_0x47562c,_0x5ef4ca[_0x537c('0x48')]);return _0x4d4ed5[_0x537c('0x63')](_0x47562c);}})[_0x537c('0x2e')](function(_0x1120bb){if(_0x1120bb){_0x456d0f=_0x1120bb[_0x537c('0x40')];if(!_0x5ef4ca['query'][_0x537c('0x41')](_0x537c('0x5b'))){_0x47562c[_0x537c('0x27')]=qs[_0x537c('0x27')](_0x5ef4ca['query'][_0x537c('0x27')]);_0x47562c['offset']=qs[_0x537c('0x24')](_0x5ef4ca[_0x537c('0x3b')][_0x537c('0x24')]);}return _0x4d4ed5[_0x537c('0x63')](_0x47562c);}})['then'](function(_0x3f59f0){if(_0x3f59f0){return _0x3f59f0?{'count':_0x456d0f,'rows':_0x3f59f0}:null;}})['then'](respondWithResult(_0x457924,null))[_0x537c('0x4c')](handleError(_0x457924,null));}; \ No newline at end of file +var _0x2ca1=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','params','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','sort','getMembers','removeMembers','addMessage','getMessages','findOne','$gte','split','format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x139968,_0x519f99){var _0x1bbd1f=function(_0x19336e){while(--_0x19336e){_0x139968['push'](_0x139968['shift']());}};_0x1bbd1f(++_0x519f99);}(_0x2ca1,0x1ca));var _0x12ca=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x2ca1[_0x577519];return _0x5b12f7;};'use strict';var emlformat=require(_0x12ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12ca('0x1'));var jsonpatch=require(_0x12ca('0x2'));var rp=require(_0x12ca('0x3'));var moment=require(_0x12ca('0x4'));var BPromise=require(_0x12ca('0x5'));var Mustache=require(_0x12ca('0x6'));var util=require('util');var path=require(_0x12ca('0x7'));var sox=require(_0x12ca('0x8'));var csv=require(_0x12ca('0x9'));var ejs=require(_0x12ca('0xa'));var fs=require('fs');var fs_extra=require(_0x12ca('0xb'));var _=require('lodash');var squel=require(_0x12ca('0xc'));var crypto=require(_0x12ca('0xd'));var jsforce=require(_0x12ca('0xe'));var deskjs=require(_0x12ca('0xf'));var toCsv=require('to-csv');var querystring=require(_0x12ca('0x10'));var Papa=require(_0x12ca('0x11'));var Redis=require(_0x12ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x12ca('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ca('0x14'));var logger=require('../../config/logger')(_0x12ca('0x15'));var utils=require(_0x12ca('0x16'));var config=require(_0x12ca('0x17'));var licenseUtil=require(_0x12ca('0x18'));var db=require(_0x12ca('0x19'))['db'];config['redis']=_[_0x12ca('0x1a')](config[_0x12ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x12ca('0x1c'))(new Redis(config[_0x12ca('0x1b')]));require('./chatGroup.socket')[_0x12ca('0x1d')](socket);function respondWithStatusCode(_0x4f8356,_0x5a5d37){_0x5a5d37=_0x5a5d37||0xcc;return function(_0x5ef021){if(_0x5ef021){return _0x4f8356['sendStatus'](_0x5a5d37);}return _0x4f8356[_0x12ca('0x1e')](_0x5a5d37)[_0x12ca('0x1f')]();};}function respondWithResult(_0x336e03,_0x2cfa01){_0x2cfa01=_0x2cfa01||0xc8;return function(_0x21ab1a){if(_0x21ab1a){return _0x336e03[_0x12ca('0x1e')](_0x2cfa01)[_0x12ca('0x20')](_0x21ab1a);}};}function respondWithFilteredResult(_0xefdcaa,_0x192068){return function(_0x12acad){if(_0x12acad){var _0x48e5a9=typeof _0x192068['offset']===_0x12ca('0x21')&&typeof _0x192068['limit']===_0x12ca('0x21');var _0x5c601e=_0x12acad['count'];var _0x383303=_0x48e5a9?0x0:_0x192068['offset'];var _0x4aa51c=_0x48e5a9?_0x12acad[_0x12ca('0x22')]:_0x192068[_0x12ca('0x23')]+_0x192068[_0x12ca('0x24')];var _0x57af8b;if(_0x4aa51c>=_0x5c601e){_0x4aa51c=_0x5c601e;_0x57af8b=0xc8;}else{_0x57af8b=0xce;}_0xefdcaa[_0x12ca('0x1e')](_0x57af8b);return _0xefdcaa[_0x12ca('0x25')](_0x12ca('0x26'),_0x383303+'-'+_0x4aa51c+'/'+_0x5c601e)[_0x12ca('0x20')](_0x12acad);}return null;};}function patchUpdates(_0x2f0815){return function(_0x307c66){try{jsonpatch['apply'](_0x307c66,_0x2f0815,!![]);}catch(_0x17d95a){return BPromise[_0x12ca('0x27')](_0x17d95a);}return _0x307c66[_0x12ca('0x28')]();};}function saveUpdates(_0x20211a,_0x24d2dd){return function(_0x4de5a9){if(_0x4de5a9){return _0x4de5a9[_0x12ca('0x29')](_0x20211a)[_0x12ca('0x2a')](function(_0xe42e2d){return _0xe42e2d;});}return null;};}function removeEntity(_0x34f735,_0x38dbf){return function(_0x56a5a7){if(_0x56a5a7){return _0x56a5a7[_0x12ca('0x2b')]()[_0x12ca('0x2a')](function(){_0x34f735[_0x12ca('0x1e')](0xcc)[_0x12ca('0x1f')]();});}};}function handleEntityNotFound(_0x4f5bab,_0x4e1d70){return function(_0x510fb7){if(!_0x510fb7){_0x4f5bab['sendStatus'](0x194);}return _0x510fb7;};}function handleError(_0x50ddc3,_0x4c1612){_0x4c1612=_0x4c1612||0x1f4;return function(_0x20e213){logger['error'](_0x20e213[_0x12ca('0x2c')]);if(_0x20e213['name']){delete _0x20e213[_0x12ca('0x2d')];}_0x50ddc3['status'](_0x4c1612)[_0x12ca('0x2e')](_0x20e213);};}exports[_0x12ca('0x2f')]=function(_0x136e89,_0x3fc4ab){var _0x344aaf={},_0x339b2f={},_0x2240a6={'count':0x0,'rows':[]};var _0x1de0b7=_[_0x12ca('0x30')](db[_0x12ca('0x31')][_0x12ca('0x32')],function(_0x52a85d){return{'name':_0x52a85d['fieldName'],'type':_0x52a85d['type']['key']};});_0x339b2f[_0x12ca('0x33')]=_[_0x12ca('0x30')](_0x1de0b7,_0x12ca('0x2d'));_0x339b2f['query']=_[_0x12ca('0x34')](_0x136e89[_0x12ca('0x35')]);_0x339b2f['filters']=_[_0x12ca('0x36')](_0x339b2f[_0x12ca('0x33')],_0x339b2f[_0x12ca('0x35')]);_0x344aaf['attributes']=_[_0x12ca('0x36')](_0x339b2f[_0x12ca('0x33')],qs[_0x12ca('0x37')](_0x136e89[_0x12ca('0x35')][_0x12ca('0x37')]));_0x344aaf[_0x12ca('0x38')]=_0x344aaf['attributes'][_0x12ca('0x39')]?_0x344aaf[_0x12ca('0x38')]:_0x339b2f[_0x12ca('0x33')];if(!_0x136e89[_0x12ca('0x35')][_0x12ca('0x3a')](_0x12ca('0x3b'))){_0x344aaf['limit']=qs[_0x12ca('0x24')](_0x136e89[_0x12ca('0x35')]['limit']);_0x344aaf[_0x12ca('0x23')]=qs[_0x12ca('0x23')](_0x136e89[_0x12ca('0x35')][_0x12ca('0x23')]);}_0x344aaf[_0x12ca('0x3c')]=qs['sort'](_0x136e89[_0x12ca('0x35')]['sort']);_0x344aaf[_0x12ca('0x3d')]=qs['filters'](_[_0x12ca('0x3e')](_0x136e89[_0x12ca('0x35')],_0x339b2f[_0x12ca('0x3f')]),_0x1de0b7);if(_0x136e89[_0x12ca('0x35')][_0x12ca('0x40')]){_0x344aaf[_0x12ca('0x3d')]=_[_0x12ca('0x41')](_0x344aaf['where'],{'$or':_[_0x12ca('0x30')](_0x1de0b7,function(_0x125872){if(_0x125872[_0x12ca('0x42')]!==_0x12ca('0x43')){var _0x2a6eaa={};_0x2a6eaa[_0x125872[_0x12ca('0x2d')]]={'$like':'%'+_0x136e89[_0x12ca('0x35')][_0x12ca('0x40')]+'%'};return _0x2a6eaa;}})});}_0x344aaf=_['merge']({},_0x344aaf,_0x136e89[_0x12ca('0x44')]);var _0x5ac241={'where':_0x344aaf[_0x12ca('0x3d')]};return db[_0x12ca('0x31')][_0x12ca('0x22')](_0x5ac241)['then'](function(_0x49fcc6){_0x2240a6[_0x12ca('0x22')]=_0x49fcc6;if(_0x136e89[_0x12ca('0x35')][_0x12ca('0x45')]){_0x344aaf[_0x12ca('0x46')]=[{'all':!![]}];}return db['ChatGroup'][_0x12ca('0x47')](_0x344aaf);})[_0x12ca('0x2a')](function(_0x5f1231){_0x2240a6[_0x12ca('0x48')]=_0x5f1231;return _0x2240a6;})[_0x12ca('0x2a')](respondWithFilteredResult(_0x3fc4ab,_0x344aaf))['catch'](handleError(_0x3fc4ab,null));};exports[_0x12ca('0x49')]=function(_0x43c845,_0x2003ec){var _0x2f95c9={'raw':!![],'where':{'id':_0x43c845['params']['id']}},_0x345985={};_0x345985['model']=_[_0x12ca('0x34')](db[_0x12ca('0x31')][_0x12ca('0x32')]);_0x345985[_0x12ca('0x35')]=_['keys'](_0x43c845['query']);_0x345985[_0x12ca('0x3f')]=_['intersection'](_0x345985['model'],_0x345985[_0x12ca('0x35')]);_0x2f95c9[_0x12ca('0x38')]=_[_0x12ca('0x36')](_0x345985[_0x12ca('0x33')],qs[_0x12ca('0x37')](_0x43c845[_0x12ca('0x35')][_0x12ca('0x37')]));_0x2f95c9[_0x12ca('0x38')]=_0x2f95c9[_0x12ca('0x38')][_0x12ca('0x39')]?_0x2f95c9[_0x12ca('0x38')]:_0x345985[_0x12ca('0x33')];if(_0x43c845[_0x12ca('0x35')]['includeAll']){_0x2f95c9[_0x12ca('0x46')]=[{'all':!![]}];}_0x2f95c9=_['merge']({},_0x2f95c9,_0x43c845['options']);return db['ChatGroup']['find'](_0x2f95c9)['then'](handleEntityNotFound(_0x2003ec,null))[_0x12ca('0x2a')](respondWithResult(_0x2003ec,null))[_0x12ca('0x4a')](handleError(_0x2003ec,null));};exports[_0x12ca('0x4b')]=function(_0x5ab339,_0xdee7e9){return db['ChatGroup'][_0x12ca('0x4b')](_0x5ab339[_0x12ca('0x4c')],{})[_0x12ca('0x2a')](respondWithResult(_0xdee7e9,0xc9))[_0x12ca('0x4a')](handleError(_0xdee7e9,null));};exports[_0x12ca('0x29')]=function(_0x300406,_0x162f7b){if(_0x300406[_0x12ca('0x4c')]['id']){delete _0x300406[_0x12ca('0x4c')]['id'];}return db[_0x12ca('0x31')]['find']({'where':{'id':_0x300406[_0x12ca('0x4d')]['id']}})[_0x12ca('0x2a')](handleEntityNotFound(_0x162f7b,null))['then'](saveUpdates(_0x300406['body'],null))[_0x12ca('0x2a')](respondWithResult(_0x162f7b,null))[_0x12ca('0x4a')](handleError(_0x162f7b,null));};exports[_0x12ca('0x2b')]=function(_0x29fa56,_0x3b2506){return db[_0x12ca('0x31')][_0x12ca('0x4e')]({'where':{'id':_0x29fa56[_0x12ca('0x4d')]['id']}})[_0x12ca('0x2a')](handleEntityNotFound(_0x3b2506,null))[_0x12ca('0x2a')](removeEntity(_0x3b2506,null))['catch'](handleError(_0x3b2506,null));};exports[_0x12ca('0x4f')]=function(_0x28d59f,_0xfbb7f7){return db[_0x12ca('0x31')][_0x12ca('0x4f')]()[_0x12ca('0x2a')](respondWithResult(_0xfbb7f7,null))['catch'](handleError(_0xfbb7f7,null));};exports['getUnread']=function(_0x56a11a,_0x26f413,_0x50238e){return db[_0x12ca('0x50')][_0x12ca('0x22')]({'where':{'ChatGroupId':_0x56a11a['params']['id'],'ToId':_0x56a11a[_0x12ca('0x51')]['id'],'read':![]}})[_0x12ca('0x2a')](function(_0x577808){return{'id':_[_0x12ca('0x52')](_0x56a11a[_0x12ca('0x4d')]['id']),'count':_0x577808};})[_0x12ca('0x2a')](respondWithResult(_0x26f413,null))['catch'](handleError(_0x26f413,null));};exports[_0x12ca('0x53')]=function(_0x34fa23,_0x792540,_0x33f807){return db['ChatGroup'][_0x12ca('0x4e')]({'where':{'id':_0x34fa23[_0x12ca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x792540,null))[_0x12ca('0x2a')](function(_0x566b25){if(_0x566b25){return _0x566b25[_0x12ca('0x53')](_0x34fa23[_0x12ca('0x4c')][_0x12ca('0x54')],_[_0x12ca('0x55')](_0x34fa23[_0x12ca('0x4c')],[_0x12ca('0x54'),'id'])||{});}})[_0x12ca('0x2a')](respondWithResult(_0x792540,null))[_0x12ca('0x4a')](handleError(_0x792540,null));};exports['getMembers']=function(_0xb84a2d,_0x454466,_0x871040){var _0x1af09f={};var _0x4d4c72={};var _0x448198;var _0x5cbc2e;return db['ChatGroup']['findOne']({'where':{'id':_0xb84a2d[_0x12ca('0x4d')]['id']}})[_0x12ca('0x2a')](handleEntityNotFound(_0x454466,null))[_0x12ca('0x2a')](function(_0x437d11){if(_0x437d11){_0x448198=_0x437d11;_0x4d4c72[_0x12ca('0x33')]=_['keys'](db['User'][_0x12ca('0x32')]);_0x4d4c72[_0x12ca('0x35')]=_[_0x12ca('0x34')](_0xb84a2d[_0x12ca('0x35')]);_0x4d4c72['filters']=_['intersection'](_0x4d4c72[_0x12ca('0x33')],_0x4d4c72[_0x12ca('0x35')]);_0x1af09f[_0x12ca('0x38')]=_['intersection'](_0x4d4c72[_0x12ca('0x33')],qs[_0x12ca('0x37')](_0xb84a2d[_0x12ca('0x35')]['fields']));_0x1af09f['attributes']=_0x1af09f['attributes'][_0x12ca('0x39')]?_0x1af09f[_0x12ca('0x38')]:_0x4d4c72[_0x12ca('0x33')];_0x1af09f[_0x12ca('0x3c')]=qs[_0x12ca('0x56')](_0xb84a2d['query'][_0x12ca('0x56')]);_0x1af09f[_0x12ca('0x3d')]=qs['filters'](_[_0x12ca('0x3e')](_0xb84a2d[_0x12ca('0x35')],_0x4d4c72[_0x12ca('0x3f')]));if(_0xb84a2d[_0x12ca('0x35')]['filter']){_0x1af09f[_0x12ca('0x3d')]=_[_0x12ca('0x41')](_0x1af09f['where'],{'$or':_['map'](_0x1af09f[_0x12ca('0x38')],function(_0x3fd8fa){var _0x24a705={};_0x24a705[_0x3fd8fa]={'$like':'%'+_0xb84a2d[_0x12ca('0x35')]['filter']+'%'};return _0x24a705;})});}_0x1af09f=_[_0x12ca('0x41')]({},_0x1af09f,_0xb84a2d[_0x12ca('0x44')]);return _0x448198[_0x12ca('0x57')](_0x1af09f);}})[_0x12ca('0x2a')](function(_0x394eb3){if(_0x394eb3){_0x5cbc2e=_0x394eb3[_0x12ca('0x39')];if(!_0xb84a2d['query'][_0x12ca('0x3a')]('nolimit')){_0x1af09f[_0x12ca('0x24')]=qs['limit'](_0xb84a2d['query'][_0x12ca('0x24')]);_0x1af09f[_0x12ca('0x23')]=qs[_0x12ca('0x23')](_0xb84a2d[_0x12ca('0x35')][_0x12ca('0x23')]);}return _0x448198[_0x12ca('0x57')](_0x1af09f);}})[_0x12ca('0x2a')](function(_0x4dcc93){if(_0x4dcc93){return _0x4dcc93?{'count':_0x5cbc2e,'rows':_0x4dcc93}:null;}})[_0x12ca('0x2a')](respondWithResult(_0x454466,null))[_0x12ca('0x4a')](handleError(_0x454466,null));};exports[_0x12ca('0x58')]=function(_0x1a0b10,_0x53b1de,_0x2543c2){return db[_0x12ca('0x31')]['find']({'where':{'id':_0x1a0b10[_0x12ca('0x4d')]['id']}})[_0x12ca('0x2a')](handleEntityNotFound(_0x53b1de,null))[_0x12ca('0x2a')](function(_0x5904c0){if(_0x5904c0){return _0x5904c0[_0x12ca('0x58')](_0x1a0b10[_0x12ca('0x35')]['ids']);}})[_0x12ca('0x2a')](respondWithStatusCode(_0x53b1de,null))[_0x12ca('0x4a')](handleError(_0x53b1de,null));};exports[_0x12ca('0x59')]=function(_0x2004a0,_0x59dbd6,_0x13de9f){if(_0x2004a0[_0x12ca('0x4c')]['id']){delete _0x2004a0[_0x12ca('0x4c')]['id'];}return db[_0x12ca('0x31')]['find']({'where':{'id':_0x2004a0[_0x12ca('0x4d')]['id']}})[_0x12ca('0x2a')](handleEntityNotFound(_0x59dbd6,null))[_0x12ca('0x2a')](function(_0x36d26c){if(_0x36d26c){_0x2004a0[_0x12ca('0x4c')]['ChatGroupId']=_0x36d26c['id'];return db[_0x12ca('0x50')][_0x12ca('0x4b')](_0x2004a0[_0x12ca('0x4c')]);}})[_0x12ca('0x2a')](respondWithResult(_0x59dbd6,null))['catch'](handleError(_0x59dbd6,null));};exports[_0x12ca('0x5a')]=function(_0x632b5f,_0x15624a,_0x39ffdf){var _0x41a670={};var _0x2c8322={};var _0x2f70ed;var _0x5cc535;return db[_0x12ca('0x31')][_0x12ca('0x5b')]({'where':{'id':_0x632b5f['params']['id']}})['then'](handleEntityNotFound(_0x15624a,null))[_0x12ca('0x2a')](function(_0x3bd0e9){if(_0x3bd0e9){_0x2f70ed=_0x3bd0e9;_0x2c8322[_0x12ca('0x33')]=_[_0x12ca('0x34')](db[_0x12ca('0x50')][_0x12ca('0x32')]);_0x2c8322[_0x12ca('0x35')]=_[_0x12ca('0x34')](_0x632b5f['query']);_0x2c8322[_0x12ca('0x3f')]=_[_0x12ca('0x36')](_0x2c8322[_0x12ca('0x33')],_0x2c8322['query']);_0x41a670[_0x12ca('0x38')]=_[_0x12ca('0x36')](_0x2c8322[_0x12ca('0x33')],qs['fields'](_0x632b5f[_0x12ca('0x35')]['fields']));_0x41a670['attributes']=_0x41a670[_0x12ca('0x38')][_0x12ca('0x39')]?_0x41a670[_0x12ca('0x38')]:_0x2c8322['model'];_0x41a670[_0x12ca('0x3c')]=qs[_0x12ca('0x56')](_0x632b5f[_0x12ca('0x35')][_0x12ca('0x56')]);_0x41a670[_0x12ca('0x3d')]=qs['filters'](_['pick'](_0x632b5f[_0x12ca('0x35')],_0x2c8322[_0x12ca('0x3f')]));if(_0x632b5f[_0x12ca('0x35')][_0x12ca('0x40')]){_0x41a670[_0x12ca('0x3d')]=_[_0x12ca('0x41')](_0x41a670[_0x12ca('0x3d')],{'$or':_[_0x12ca('0x30')](_0x41a670[_0x12ca('0x38')],function(_0x5cbb24){var _0x285b06={};_0x285b06[_0x5cbb24]={'$like':'%'+_0x632b5f[_0x12ca('0x35')][_0x12ca('0x40')]+'%'};return _0x285b06;})});}if(_0x632b5f[_0x12ca('0x35')][_0x12ca('0x5c')]){var _0x4fa398=_0x632b5f[_0x12ca('0x35')][_0x12ca('0x5c')][_0x12ca('0x5d')](',');var _0x542c61={};_0x542c61[_0x4fa398[0x0]]={'$gte':moment(_0x4fa398[0x1])[_0x12ca('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x41a670[_0x12ca('0x3d')]=_[_0x12ca('0x41')](_0x41a670['where'],_0x542c61);}_0x41a670=_[_0x12ca('0x41')]({},_0x41a670,_0x632b5f[_0x12ca('0x44')]);return _0x2f70ed[_0x12ca('0x5a')](_0x41a670);}})[_0x12ca('0x2a')](function(_0x5a3843){if(_0x5a3843){_0x5cc535=_0x5a3843[_0x12ca('0x39')];if(!_0x632b5f[_0x12ca('0x35')][_0x12ca('0x3a')](_0x12ca('0x3b'))){_0x41a670[_0x12ca('0x24')]=qs[_0x12ca('0x24')](_0x632b5f[_0x12ca('0x35')][_0x12ca('0x24')]);_0x41a670[_0x12ca('0x23')]=qs[_0x12ca('0x23')](_0x632b5f[_0x12ca('0x35')][_0x12ca('0x23')]);}return _0x2f70ed[_0x12ca('0x5a')](_0x41a670);}})['then'](function(_0x2b044c){if(_0x2b044c){return _0x2b044c?{'count':_0x5cc535,'rows':_0x2b044c}:null;}})[_0x12ca('0x2a')](respondWithResult(_0x15624a,null))['catch'](handleError(_0x15624a,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 03eae83..970382e 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 _0x9416=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x9416,0xde));var _0x6941=function(_0x126ea3,_0x135186){_0x126ea3=_0x126ea3-0x0;var _0x3e97b0=_0x9416[_0x126ea3];return _0x3e97b0;};'use strict';var EventEmitter=require(_0x6941('0x0'));var ChatGroup=require(_0x6941('0x1'))['db'][_0x6941('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6941('0x3')](0x0);var events={'afterCreate':_0x6941('0x4'),'afterUpdate':_0x6941('0x5'),'afterDestroy':_0x6941('0x6')};function emitEvent(_0x40d841){return function(_0x3e4f7b,_0x12932f,_0x182dc6){ChatGroupEvents[_0x6941('0x7')](_0x40d841+':'+_0x3e4f7b['id'],_0x3e4f7b);ChatGroupEvents[_0x6941('0x7')](_0x40d841,_0x3e4f7b);_0x182dc6(null);};}for(var e in events){if(events[_0x6941('0x8')](e)){var event=events[e];ChatGroup[_0x6941('0x9')](e,emitEvent(event));}}module[_0x6941('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xbdc1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','ChatGroup','setMaxListeners'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0xbdc1,0x147));var _0x1bdc=function(_0x124a52,_0x1f5676){_0x124a52=_0x124a52-0x0;var _0x39c289=_0xbdc1[_0x124a52];return _0x39c289;};'use strict';var EventEmitter=require(_0x1bdc('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x1bdc('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1bdc('0x2')](0x0);var events={'afterCreate':_0x1bdc('0x3'),'afterUpdate':_0x1bdc('0x4'),'afterDestroy':_0x1bdc('0x5')};function emitEvent(_0xaa84ca){return function(_0x59cff6,_0x4fa3e0,_0x29074f){ChatGroupEvents[_0x1bdc('0x6')](_0xaa84ca+':'+_0x59cff6['id'],_0x59cff6);ChatGroupEvents['emit'](_0xaa84ca,_0x59cff6);_0x29074f(null);};}for(var e in events){if(events[_0x1bdc('0x7')](e)){var event=events[e];ChatGroup[_0x1bdc('0x8')](e,emitEvent(event));}}module[_0x1bdc('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 65d7484..df3bc05 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 _0x2bd6=['rimraf','../../config/environment','exports','define','ChatGroup','chat_groups','../../config/logger','api','request-promise','path'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0x2bd6,0xb0));var _0x62bd=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x2bd6[_0x50e40b];return _0x2608b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62bd('0x0'))(_0x62bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x62bd('0x2'));var fs=require('fs');var path=require(_0x62bd('0x3'));var rimraf=require(_0x62bd('0x4'));var config=require(_0x62bd('0x5'));var attributes=require('./chatGroup.attributes');module[_0x62bd('0x6')]=function(_0x8a88ca,_0x1ba538){return _0x8a88ca[_0x62bd('0x7')](_0x62bd('0x8'),attributes,{'tableName':_0x62bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7345=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','chat_groups','lodash','util','../../config/logger','bluebird'];(function(_0x3d8243,_0x431106){var _0x140fb4=function(_0x1bde1f){while(--_0x1bde1f){_0x3d8243['push'](_0x3d8243['shift']());}};_0x140fb4(++_0x431106);}(_0x7345,0x6a));var _0x5734=function(_0x5e2cee,_0x2d51d4){_0x5e2cee=_0x5e2cee-0x0;var _0x3c9eec=_0x7345[_0x5e2cee];return _0x3c9eec;};'use strict';var _=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var logger=require(_0x5734('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5734('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5734('0x4'));var rimraf=require(_0x5734('0x5'));var config=require(_0x5734('0x6'));var attributes=require(_0x5734('0x7'));module[_0x5734('0x8')]=function(_0x134712,_0x589463){return _0x134712['define']('ChatGroup',attributes,{'tableName':_0x5734('0x9'),'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 8dd45e8..611eaea 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 _0x3248=['rpc','jayson/promise','client','redis','defaults','localhost','./chatGroup.socket','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','info','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x15f236,_0x59a12b){var _0x3645c0=function(_0x574879){while(--_0x574879){_0x15f236['push'](_0x15f236['shift']());}};_0x3645c0(++_0x59a12b);}(_0x3248,0x1bc));var _0x8324=function(_0x137e7b,_0x5717ae){_0x137e7b=_0x137e7b-0x0;var _0x509986=_0x3248[_0x137e7b];return _0x509986;};'use strict';var _=require('lodash');var util=require(_0x8324('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8324('0x1'));var fs=require('fs');var Redis=require(_0x8324('0x2'));var db=require(_0x8324('0x3'))['db'];var utils=require(_0x8324('0x4'));var logger=require(_0x8324('0x5'))(_0x8324('0x6'));var config=require('../../config/environment');var jayson=require(_0x8324('0x7'));var client=jayson[_0x8324('0x8')]['http']({'port':0x232a});config[_0x8324('0x9')]=_[_0x8324('0xa')](config[_0x8324('0x9')],{'host':_0x8324('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8324('0x9')]));require(_0x8324('0xc'))[_0x8324('0xd')](socket);function respondWithRpcPromise(_0x3dafb5,_0x481aec,_0x33b170){return new BPromise(function(_0x3dd97d,_0x4f61a4){return client[_0x8324('0xe')](_0x3dafb5,_0x33b170)[_0x8324('0xf')](function(_0x58286f){logger['info']('ChatGroup,\x20%s,\x20%s',_0x481aec,_0x8324('0x10'));logger[_0x8324('0x11')](_0x8324('0x12'),_0x481aec,_0x8324('0x10'),JSON['stringify'](_0x58286f));if(_0x58286f[_0x8324('0x13')]){if(_0x58286f[_0x8324('0x13')][_0x8324('0x14')]===0x1f4){logger[_0x8324('0x13')](_0x8324('0x15'),_0x481aec,_0x58286f['error'][_0x8324('0x16')]);return _0x4f61a4(_0x58286f[_0x8324('0x13')][_0x8324('0x16')]);}logger[_0x8324('0x13')](_0x8324('0x15'),_0x481aec,_0x58286f['error'][_0x8324('0x16')]);return _0x3dd97d(_0x58286f[_0x8324('0x13')][_0x8324('0x16')]);}else{logger[_0x8324('0x17')]('ChatGroup,\x20%s,\x20%s',_0x481aec,'request\x20sent');_0x3dd97d(_0x58286f['result']['message']);}})[_0x8324('0x18')](function(_0x466cb6){logger[_0x8324('0x13')](_0x8324('0x15'),_0x481aec,_0x466cb6);_0x4f61a4(_0x466cb6);});});} \ No newline at end of file +var _0x036b=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x594d41,_0x7b4004){var _0x2f0d54=function(_0x400c05){while(--_0x400c05){_0x594d41['push'](_0x594d41['shift']());}};_0x2f0d54(++_0x7b4004);}(_0x036b,0x145));var _0xb036=function(_0x3b4585,_0x16a9c2){_0x3b4585=_0x3b4585-0x0;var _0x551be9=_0x036b[_0x3b4585];return _0x551be9;};'use strict';var _=require(_0xb036('0x0'));var util=require(_0xb036('0x1'));var moment=require(_0xb036('0x2'));var BPromise=require('bluebird');var rs=require(_0xb036('0x3'));var fs=require('fs');var Redis=require(_0xb036('0x4'));var db=require(_0xb036('0x5'))['db'];var utils=require(_0xb036('0x6'));var logger=require(_0xb036('0x7'))('rpc');var config=require(_0xb036('0x8'));var jayson=require(_0xb036('0x9'));var client=jayson[_0xb036('0xa')][_0xb036('0xb')]({'port':0x232a});config[_0xb036('0xc')]=_[_0xb036('0xd')](config['redis'],{'host':_0xb036('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb036('0xc')]));require(_0xb036('0xf'))[_0xb036('0x10')](socket);function respondWithRpcPromise(_0x25a5d4,_0x18db0b,_0x2f371b){return new BPromise(function(_0x22f971,_0x42cf16){return client[_0xb036('0x11')](_0x25a5d4,_0x2f371b)[_0xb036('0x12')](function(_0x5ffd75){logger[_0xb036('0x13')](_0xb036('0x14'),_0x18db0b,_0xb036('0x15'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x18db0b,'request\x20sent',JSON[_0xb036('0x16')](_0x5ffd75));if(_0x5ffd75[_0xb036('0x17')]){if(_0x5ffd75['error'][_0xb036('0x18')]===0x1f4){logger[_0xb036('0x17')](_0xb036('0x14'),_0x18db0b,_0x5ffd75[_0xb036('0x17')]['message']);return _0x42cf16(_0x5ffd75[_0xb036('0x17')][_0xb036('0x19')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x18db0b,_0x5ffd75[_0xb036('0x17')][_0xb036('0x19')]);return _0x22f971(_0x5ffd75[_0xb036('0x17')][_0xb036('0x19')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x18db0b,_0xb036('0x15'));_0x22f971(_0x5ffd75['result'][_0xb036('0x19')]);}})[_0xb036('0x1a')](function(_0x42c1f5){logger['error']('ChatGroup,\x20%s,\x20%s',_0x18db0b,_0x42c1f5);_0x42cf16(_0x42c1f5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index daaca5c..fd98a8d 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 _0x7fc2=['update','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x35b558,_0xeb7d5c){var _0x481909=function(_0x3aea9c){while(--_0x3aea9c){_0x35b558['push'](_0x35b558['shift']());}};_0x481909(++_0xeb7d5c);}(_0x7fc2,0xe5));var _0x27fc=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7fc2[_0x3e5086];return _0xfeb102;};'use strict';var ChatGroupEvents=require(_0x27fc('0x0'));var events=[_0x27fc('0x1'),'remove',_0x27fc('0x2')];function createListener(_0x3e266e,_0x225b14){return function(_0x3b4998){_0x225b14['emit'](_0x3e266e,_0x3b4998);};}function removeListener(_0x124111,_0xd55d0d){return function(){ChatGroupEvents[_0x27fc('0x3')](_0x124111,_0xd55d0d);};}exports[_0x27fc('0x4')]=function(_0x5f269e){for(var _0x3dbee9=0x0,_0x460bd6=events[_0x27fc('0x5')];_0x3dbee9<_0x460bd6;_0x3dbee9++){var _0x36ec2c=events[_0x3dbee9];var _0x419b53=createListener(_0x27fc('0x6')+_0x36ec2c,_0x5f269e);ChatGroupEvents['on'](_0x36ec2c,_0x419b53);}}; \ No newline at end of file +var _0x892c=['register','save','remove','update','emit','removeListener'];(function(_0x33c953,_0x1f9762){var _0x41dd49=function(_0x56d3bc){while(--_0x56d3bc){_0x33c953['push'](_0x33c953['shift']());}};_0x41dd49(++_0x1f9762);}(_0x892c,0x1a5));var _0xc892=function(_0x1a6399,_0x437d38){_0x1a6399=_0x1a6399-0x0;var _0x3a42d1=_0x892c[_0x1a6399];return _0x3a42d1;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc892('0x0'),_0xc892('0x1'),_0xc892('0x2')];function createListener(_0x4b8ff2,_0xc35b60){return function(_0xe0f119){_0xc35b60[_0xc892('0x3')](_0x4b8ff2,_0xe0f119);};}function removeListener(_0x1bbf8b,_0x26129d){return function(){ChatGroupEvents[_0xc892('0x4')](_0x1bbf8b,_0x26129d);};}exports[_0xc892('0x5')]=function(_0x123d7e){for(var _0x7301dc=0x0,_0x22123c=events['length'];_0x7301dc<_0x22123c;_0x7301dc++){var _0x56e1c5=events[_0x7301dc];var _0x4d1ae3=createListener('chatGroup:'+_0x56e1c5,_0x123d7e);ChatGroupEvents['on'](_0x56e1c5,_0x4d1ae3);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 002e773..0292a70 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 _0x1830=['/:id/messages','getMessages','post','create','addMembers','addMessage','removeMembers','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','getUnread','getMembers'];(function(_0x34cf17,_0x3f4892){var _0x4edbd1=function(_0x596864){while(--_0x596864){_0x34cf17['push'](_0x34cf17['shift']());}};_0x4edbd1(++_0x3f4892);}(_0x1830,0x101));var _0x0183=function(_0xbf19d7,_0x58b2bf){_0xbf19d7=_0xbf19d7-0x0;var _0x376e11=_0x1830[_0xbf19d7];return _0x376e11;};'use strict';var multer=require(_0x0183('0x0'));var util=require(_0x0183('0x1'));var path=require(_0x0183('0x2'));var timeout=require(_0x0183('0x3'));var express=require(_0x0183('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0183('0x5'));var interaction=require(_0x0183('0x6'));var config=require(_0x0183('0x7'));var controller=require(_0x0183('0x8'));router['get']('/',auth[_0x0183('0x9')](),controller[_0x0183('0xa')]);router[_0x0183('0xb')](_0x0183('0xc'),auth[_0x0183('0x9')](),controller[_0x0183('0xd')]);router['get'](_0x0183('0xe'),auth[_0x0183('0x9')](),controller[_0x0183('0xf')]);router[_0x0183('0xb')]('/:id/unread',auth[_0x0183('0x9')](),controller[_0x0183('0x10')]);router[_0x0183('0xb')]('/:id/members',auth['isAuthenticated'](),controller[_0x0183('0x11')]);router[_0x0183('0xb')](_0x0183('0x12'),auth[_0x0183('0x9')](),controller[_0x0183('0x13')]);router[_0x0183('0x14')]('/',auth[_0x0183('0x9')](),controller[_0x0183('0x15')]);router[_0x0183('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x0183('0x16')]);router[_0x0183('0x14')]('/:id/messages',auth[_0x0183('0x9')](),controller[_0x0183('0x17')]);router['put'](_0x0183('0xe'),auth[_0x0183('0x9')](),controller['update']);router['delete'](_0x0183('0xe'),auth[_0x0183('0x9')](),controller['destroy']);router['delete']('/:id/members',auth['isAuthenticated'](),controller[_0x0183('0x18')]);module['exports']=router; \ No newline at end of file +var _0xab91=['addMembers','addMessage','put','update','destroy','delete','removeMembers','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create'];(function(_0x196411,_0xbd83a2){var _0x56a4da=function(_0x2046a8){while(--_0x2046a8){_0x196411['push'](_0x196411['shift']());}};_0x56a4da(++_0xbd83a2);}(_0xab91,0x134));var _0x1ab9=function(_0x5f139c,_0x34abe0){_0x5f139c=_0x5f139c-0x0;var _0xd3bd61=_0xab91[_0x5f139c];return _0xd3bd61;};'use strict';var multer=require(_0x1ab9('0x0'));var util=require(_0x1ab9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1ab9('0x2')]();var fs_extra=require(_0x1ab9('0x3'));var auth=require(_0x1ab9('0x4'));var interaction=require(_0x1ab9('0x5'));var config=require(_0x1ab9('0x6'));var controller=require(_0x1ab9('0x7'));router[_0x1ab9('0x8')]('/',auth[_0x1ab9('0x9')](),controller['index']);router[_0x1ab9('0x8')](_0x1ab9('0xa'),auth['isAuthenticated'](),controller[_0x1ab9('0xb')]);router['get'](_0x1ab9('0xc'),auth[_0x1ab9('0x9')](),controller[_0x1ab9('0xd')]);router[_0x1ab9('0x8')](_0x1ab9('0xe'),auth['isAuthenticated'](),controller[_0x1ab9('0xf')]);router[_0x1ab9('0x8')](_0x1ab9('0x10'),auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x11')]);router[_0x1ab9('0x8')](_0x1ab9('0x12'),auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x13')]);router[_0x1ab9('0x14')]('/',auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x15')]);router[_0x1ab9('0x14')](_0x1ab9('0x10'),auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x16')]);router[_0x1ab9('0x14')](_0x1ab9('0x12'),auth['isAuthenticated'](),controller[_0x1ab9('0x17')]);router[_0x1ab9('0x18')](_0x1ab9('0xc'),auth['isAuthenticated'](),controller[_0x1ab9('0x19')]);router['delete'](_0x1ab9('0xc'),auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x1a')]);router[_0x1ab9('0x1b')]('/:id/members',auth[_0x1ab9('0x9')](),controller[_0x1ab9('0x1c')]);module[_0x1ab9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a43364d..d8aca4a 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 _0x4a1d=['exports','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','sequelize'];(function(_0x43b124,_0x3f5997){var _0x990244=function(_0x1b53b0){while(--_0x1b53b0){_0x43b124['push'](_0x43b124['shift']());}};_0x990244(++_0x3f5997);}(_0x4a1d,0x77));var _0xd4a1=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x4a1d[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'closed':{'type':Sequelize[_0xd4a1('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd4a1('0x3')]},'ratingType':{'type':Sequelize[_0xd4a1('0x4')]('star',_0xd4a1('0x5')),'defaultValue':_0xd4a1('0x6')},'ratingMessage':{'type':Sequelize[_0xd4a1('0x7')]},'pathTranscript':{'type':Sequelize[_0xd4a1('0x7')]},'mailTranscript':{'type':Sequelize[_0xd4a1('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd4a1('0x9')]},'disposition':{'type':Sequelize[_0xd4a1('0x8')]},'secondDisposition':{'type':Sequelize[_0xd4a1('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd4a1('0x8')]},'browserName':{'type':Sequelize[_0xd4a1('0x8')]},'browserVersion':{'type':Sequelize[_0xd4a1('0x8')]},'osName':{'type':Sequelize[_0xd4a1('0x8')]},'osVersion':{'type':Sequelize[_0xd4a1('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xd4a1('0x8')]},'referer':{'type':Sequelize[_0xd4a1('0x7')]},'customerIp':{'type':Sequelize[_0xd4a1('0x8')]},'formData':{'type':Sequelize[_0xd4a1('0x7')]('long')},'read1stAt':{'type':Sequelize[_0xd4a1('0x9')]},'lastMsgAt':{'type':Sequelize[_0xd4a1('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xd4a1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd4a1('0x8')]},'customerPort':{'type':Sequelize[_0xd4a1('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xd4a1('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xd4a1('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xc224=['exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','sequelize'];(function(_0x8c569a,_0x411529){var _0x2f5882=function(_0x7cb52d){while(--_0x7cb52d){_0x8c569a['push'](_0x8c569a['shift']());}};_0x2f5882(++_0x411529);}(_0xc224,0x1af));var _0x4c22=function(_0x318cd5,_0x1033f7){_0x318cd5=_0x318cd5-0x0;var _0x4e445c=_0xc224[_0x318cd5];return _0x4e445c;};'use strict';var Sequelize=require(_0x4c22('0x0'));module[_0x4c22('0x1')]={'closed':{'type':Sequelize[_0x4c22('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x4c22('0x3')](_0x4c22('0x4'),_0x4c22('0x5')),'defaultValue':_0x4c22('0x4')},'ratingMessage':{'type':Sequelize[_0x4c22('0x6')]},'pathTranscript':{'type':Sequelize[_0x4c22('0x6')]},'mailTranscript':{'type':Sequelize[_0x4c22('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4c22('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4c22('0x7')]},'browserName':{'type':Sequelize[_0x4c22('0x7')]},'browserVersion':{'type':Sequelize[_0x4c22('0x7')]},'osName':{'type':Sequelize[_0x4c22('0x7')]},'osVersion':{'type':Sequelize[_0x4c22('0x7')]},'deviceModel':{'type':Sequelize[_0x4c22('0x7')]},'deviceVendor':{'type':Sequelize[_0x4c22('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x4c22('0x6')]},'customerIp':{'type':Sequelize[_0x4c22('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x4c22('0x8')]},'lastMsgAt':{'type':Sequelize[_0x4c22('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x4c22('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4c22('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'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 5c39480..16d73a3 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 _0x2750=['createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','name','send','render','body','contact','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','UserId','disposition','abandoned','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','select','field','tools_tags','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','keys','includeAll','include','merge','options','create','params','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','abandon','attachmentUpload','file','basename','filename','Attachment','attachmentDownload','attachId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','format','now','ChatMessage','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','findAll','includeAgent','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','unix','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe'];(function(_0x41a32a,_0x48b49e){var _0x36740c=function(_0x1a55ec){while(--_0x1a55ec){_0x41a32a['push'](_0x41a32a['shift']());}};_0x36740c(++_0x48b49e);}(_0x2750,0x13b));var _0x0275=function(_0x3e7f8e,_0x2eaac3){_0x3e7f8e=_0x3e7f8e-0x0;var _0x51c108=_0x2750[_0x3e7f8e];return _0x51c108;};'use strict';var rimraf=require(_0x0275('0x0'));var zipdir=require('zip-dir');var rp=require(_0x0275('0x1'));var moment=require(_0x0275('0x2'));var BPromise=require(_0x0275('0x3'));var Mustache=require(_0x0275('0x4'));var util=require(_0x0275('0x5'));var path=require(_0x0275('0x6'));var ejs=require(_0x0275('0x7'));var fs=require('fs');var _=require(_0x0275('0x8'));var squel=require(_0x0275('0x9'));var Redis=require(_0x0275('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0xb'));var pdf=require(_0x0275('0xc'));var logger=require(_0x0275('0xd'))(_0x0275('0xe'));var config=require('../../config/environment');var db=require(_0x0275('0xf'))['db'];config[_0x0275('0x10')]=_[_0x0275('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0275('0x12'))(new Redis(config['redis']));require(_0x0275('0x13'))[_0x0275('0x14')](socket);var jayson=require(_0x0275('0x15'));var client=jayson[_0x0275('0x16')][_0x0275('0x17')]({'port':0x232b});var client9004=jayson['client'][_0x0275('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x1e0932,_0x1f128d,_0x4c6ee0,_0x55ffd6){return new BPromise(function(_0x292f93,_0x395398){var _0x37f809=_0x55ffd6||client;return _0x37f809[_0x0275('0x18')](_0x1e0932,_0x4c6ee0)[_0x0275('0x19')](function(_0x36921c){logger['info'](_0x0275('0x1a'),_0x1f128d,_0x0275('0x1b'));logger['debug'](_0x0275('0x1c'),_0x1f128d,_0x0275('0x1b'),JSON['stringify'](_0x36921c));if(_0x36921c[_0x0275('0x1d')]){if(_0x36921c[_0x0275('0x1d')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1f128d,_0x36921c['error']['message']);return _0x395398(_0x36921c[_0x0275('0x1d')][_0x0275('0x1e')]);}logger[_0x0275('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x1f128d,_0x36921c[_0x0275('0x1d')][_0x0275('0x1e')]);return _0x292f93(_0x36921c[_0x0275('0x1d')]['message']);}else{logger[_0x0275('0x1f')](_0x0275('0x1a'),_0x1f128d,'request\x20sent');_0x292f93(_0x36921c['result'][_0x0275('0x1e')]);}})[_0x0275('0x20')](function(_0x562c82){logger['error'](_0x0275('0x1a'),_0x1f128d,_0x562c82);_0x395398(_0x562c82);});});}function respondWithStatusCode(_0x5ab9e7,_0x16e6cc){_0x16e6cc=_0x16e6cc||0xcc;return function(_0x5c75f1){if(_0x5c75f1){return _0x5ab9e7[_0x0275('0x21')](_0x16e6cc);}return _0x5ab9e7[_0x0275('0x22')](_0x16e6cc)['end']();};}function respondWithResult(_0x140a18,_0x3004bf){_0x3004bf=_0x3004bf||0xc8;return function(_0x2e3605){if(_0x2e3605){return _0x140a18['status'](_0x3004bf)[_0x0275('0x23')](_0x2e3605);}};}function respondWithFilteredResult(_0x44bbf8,_0x24c928){return function(_0x15813f){if(_0x15813f){var _0x1a2024=typeof _0x24c928[_0x0275('0x24')]==='undefined'&&typeof _0x24c928[_0x0275('0x25')]===_0x0275('0x26');var _0x1d24b2=_0x15813f[_0x0275('0x27')];var _0x4689a3=_0x1a2024?0x0:_0x24c928['offset'];var _0x1ffd57=_0x1a2024?_0x15813f[_0x0275('0x27')]:_0x24c928[_0x0275('0x24')]+_0x24c928[_0x0275('0x25')];var _0xe5863c;if(_0x1ffd57>=_0x1d24b2){_0x1ffd57=_0x1d24b2;_0xe5863c=0xc8;}else{_0xe5863c=0xce;}_0x44bbf8['status'](_0xe5863c);return _0x44bbf8[_0x0275('0x28')](_0x0275('0x29'),_0x4689a3+'-'+_0x1ffd57+'/'+_0x1d24b2)[_0x0275('0x23')](_0x15813f);}return null;};}function saveUpdates(_0x489d7f){return function(_0x5e2e22){if(_0x5e2e22){return _0x5e2e22[_0x0275('0x2a')](_0x489d7f)[_0x0275('0x19')](function(_0x5dc2bc){return _0x5dc2bc;});}return null;};}function removeEntity(_0x7eff96){return function(_0x155a50){if(_0x155a50){return _0x155a50[_0x0275('0x2b')]()[_0x0275('0x19')](function(){_0x7eff96['status'](0xcc)[_0x0275('0x2c')]();});}};}function handleEntityNotFound(_0x86940b){return function(_0x3bba47){if(!_0x3bba47){_0x86940b[_0x0275('0x21')](0x194);}return _0x3bba47;};}function handleError(_0x58da2d,_0x134f12){_0x134f12=_0x134f12||0x1f4;return function(_0x55198e){logger[_0x0275('0x1d')](_0x55198e['stack']);if(_0x55198e[_0x0275('0x2d')]){delete _0x55198e[_0x0275('0x2d')];}_0x58da2d['status'](_0x134f12)[_0x0275('0x2e')](_0x55198e);};}function getMustacheRender(_0x459f83,_0x1575be){return Mustache[_0x0275('0x2f')](_0x459f83,_['merge'](_0x1575be[_0x0275('0x30')],{'contact':_0x1575be[_0x0275('0x31')],'message':_0x1575be[_0x0275('0x1e')],'agent':_0x1575be[_0x0275('0x32')],'interaction':_0x1575be[_0x0275('0x33')],'account':_0x1575be['account']}))||'';}function getInteractionUsers(_0x2a18c3,_0x2ad334){return new BPromise(function(_0x1b7276,_0x364773){try{if(_0x2ad334[_0x2a18c3['id']]){_0x2a18c3[_0x0275('0x34')]=_[_0x0275('0x35')](_0x2ad334[_0x2a18c3['id']],function(_0x28cf71){return{'id':_0x28cf71['id'],'fullname':_0x28cf71[_0x0275('0x36')]};});}}catch(_0x3bf52d){_0x364773(_0x3bf52d);}_0x1b7276(_0x2a18c3);});}function getInteractionTags(_0x234ac3,_0xb3264e){return new BPromise(function(_0x5b47bc,_0x2e9ba0){try{if(_0x234ac3[_0x0275('0x37')]){_0x234ac3[_0x0275('0x38')]=[];_0x234ac3[_0x0275('0x37')][_0x0275('0x39')](',')[_0x0275('0x3a')](function(_0x1a2424){_0x234ac3[_0x0275('0x38')][_0x0275('0x3b')](_0xb3264e[_0x1a2424]);});}delete _0x234ac3[_0x0275('0x37')];}catch(_0x124e7d){_0x2e9ba0(_0x124e7d);}_0x5b47bc(_0x234ac3);});}function updateChatInteraction(_0x43417a,_0x32f0cf,_0x22991c){return new BPromise(function(_0x5b5606,_0x3c81fc){return getInteractionUsers(_0x43417a,_0x22991c)[_0x0275('0x19')](function(_0x4d2d59){return getInteractionTags(_0x4d2d59,_0x32f0cf);})[_0x0275('0x19')](function(_0x76b8fa){return getStateInteraction(_0x76b8fa);})[_0x0275('0x19')](function(_0xe72991){_0x5b5606(_0xe72991);})[_0x0275('0x20')](function(_0x14d148){_0x3c81fc(_0x14d148);});});}function getStateInteraction(_0x279db8){return new BPromise(function(_0x5e57b5){_0x279db8[_0x0275('0x3c')]=0x0;_0x279db8[_0x0275('0x3d')]=0x0;_0x279db8[_0x0275('0x3e')]=0x0;_0x279db8[_0x0275('0x3f')]=0x0;_0x279db8['abandoned']=0x0;_0x279db8[_0x0275('0x40')]=0x0;if(!_0x279db8[_0x0275('0x41')]&&!_0x279db8[_0x0275('0x42')]){_0x279db8[_0x0275('0x3c')]+=0x1;}if(!_0x279db8['closed']&&_0x279db8[_0x0275('0x42')]){_0x279db8['talking']+=0x1;if(_0x279db8[_0x0275('0x3c')]){_0x279db8[_0x0275('0x3c')]-=0x1;}}if(_0x279db8[_0x0275('0x41')]&&_0x279db8[_0x0275('0x43')]==='abandoned'){_0x279db8[_0x0275('0x44')]+=0x1;if(_0x279db8[_0x0275('0x3c')]){_0x279db8['waiting']-=0x1;}}else if(_0x279db8[_0x0275('0x41')]&&!_0x279db8[_0x0275('0x42')]&&_0x279db8[_0x0275('0x43')]){_0x279db8['unmanaged']+=0x1;if(_0x279db8[_0x0275('0x3c')]){_0x279db8[_0x0275('0x3c')]-=0x1;}}else if(_0x279db8['closed']&&_0x279db8[_0x0275('0x42')]){_0x279db8[_0x0275('0x3e')]+=0x1;if(_0x279db8[_0x0275('0x3d')]){_0x279db8[_0x0275('0x3d')]-=0x1;}}_0x279db8[_0x0275('0x40')]+=0x1;_0x5e57b5(_0x279db8);});}exports[_0x0275('0x45')]=function(_0x163a08,_0x1d1ac8){var _0xb15d65={},_0x2179da={},_0x28b9ad={'count':0x0,'rows':[]};var _0x4d6757=_[_0x0275('0x35')](db[_0x0275('0x46')][_0x0275('0x47')],function(_0x33617b){return{'name':_0x33617b[_0x0275('0x48')],'type':_0x33617b[_0x0275('0x49')][_0x0275('0x4a')]};});_0x2179da[_0x0275('0x4b')]=_[_0x0275('0x35')](_0x4d6757,_0x0275('0x2d'));_0x2179da[_0x0275('0x4c')]=_['keys'](_0x163a08['query']);_0x2179da[_0x0275('0x4d')]=_[_0x0275('0x4e')](_0x2179da[_0x0275('0x4b')],_0x2179da[_0x0275('0x4c')]);_0xb15d65[_0x0275('0x4f')]=_['intersection'](_0x2179da[_0x0275('0x4b')],qs['fields'](_0x163a08[_0x0275('0x4c')][_0x0275('0x50')]));_0xb15d65[_0x0275('0x4f')]=_0xb15d65[_0x0275('0x4f')]['length']?_0xb15d65[_0x0275('0x4f')]:_0x2179da['model'];if(!_0x163a08['query']['hasOwnProperty'](_0x0275('0x51'))){_0xb15d65['limit']=qs[_0x0275('0x25')](_0x163a08[_0x0275('0x4c')][_0x0275('0x25')]);_0xb15d65[_0x0275('0x24')]=qs[_0x0275('0x24')](_0x163a08[_0x0275('0x4c')][_0x0275('0x24')]);}_0xb15d65['order']=qs[_0x0275('0x52')](_0x163a08['query'][_0x0275('0x52')]);_0xb15d65[_0x0275('0x53')]=qs[_0x0275('0x4d')](_[_0x0275('0x54')](_0x163a08[_0x0275('0x4c')],_0x2179da[_0x0275('0x4d')]),_0x4d6757);var _0x78dc83=[];var _0x3ab216=squel[_0x0275('0x55')]()[_0x0275('0x56')]('id')['field']('name')[_0x0275('0x56')]('color')['from'](_0x0275('0x57'));var _0x23e37f=squel[_0x0275('0x55')]()[_0x0275('0x56')](_0x0275('0x58'))[_0x0275('0x56')]('u.fullname')[_0x0275('0x56')](_0x0275('0x59'))[_0x0275('0x5a')](_0x0275('0x5b'),'ui')[_0x0275('0x5c')](_0x0275('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x33556f=squel[_0x0275('0x55')]()['from'](_0x0275('0x5e'),'i')['left_join'](_0x0275('0x5f'),'c',_0x0275('0x60'))[_0x0275('0x5c')](_0x0275('0x5d'),'o',_0x0275('0x61'))[_0x0275('0x5c')](_0x0275('0x62'),'a',_0x0275('0x63'))[_0x0275('0x5c')](_0x0275('0x64'),'me',_0x0275('0x65'))['left_join'](_0x0275('0x66'),'it',_0x0275('0x67'))[_0x0275('0x5c')]('tools_tags','t',_0x0275('0x68'));var _0x126f05=squel['expr']();var _0x27b4b8=[];var _0x5683f4=squel[_0x0275('0x69')]();var _0x424f1e;if(_0x163a08[_0x0275('0x4c')][_0x0275('0x6a')]){_0x424f1e=as['parseSearch'](_0x163a08[_0x0275('0x4c')][_0x0275('0x6a')]);var _0x2a4f8d=_0x424f1e[_0x0275('0x6b')];for(var _0x4e3763=0x0;_0x4e3763<_0x424f1e[_0x0275('0x6c')][_0x0275('0x6d')];_0x4e3763++){var _0x58ea62=_0x424f1e[_0x0275('0x6c')][_0x4e3763];var _0x2bb5a8='i';var _0x5e0a17=_['find'](_0x4d6757,[_0x0275('0x2d'),_0x58ea62[_0x0275('0x56')]]);if(!_0x5e0a17){switch(_0x58ea62['field']){case'unreadMessages':if(_0x58ea62[_0x0275('0x6e')]==0x1){_0x33556f[_0x0275('0x6f')]('`'+_0x58ea62[_0x0275('0x56')]+_0x0275('0x70'));}else{_0x33556f[_0x0275('0x6f')]('`'+_0x58ea62[_0x0275('0x56')]+_0x0275('0x71'));}break;case _0x0275('0x72'):if(_0x58ea62['operator']===_0x0275('0x73')){if(_0x58ea62[_0x0275('0x6e')][_0x0275('0x39')]('\x20')[_0x0275('0x6d')]>0x1){_0x126f05[_0x2a4f8d](_0x0275('0x74'),qs[_0x0275('0x75')](_0x58ea62['value']),null);}else{var _0x1a4b01='%'+_0x58ea62['value']+'%';_0x126f05[_0x2a4f8d](_0x0275('0x76'),_0x1a4b01,_0x1a4b01,_0x1a4b01);}}else{_0x5e0a17=_[_0x0275('0x77')](_0x4d6757,[_0x0275('0x2d'),_0x0275('0x78')]);_0x58ea62['field']=_0x0275('0x78');_0x53d41e=as[_0x0275('0x79')](_0x2bb5a8,_0x5e0a17[_0x0275('0x49')],_0x58ea62);_0x126f05[_0x2a4f8d](_0x53d41e[_0x0275('0x7a')],_0x53d41e[_0x0275('0x6e')][_0x0275('0x7b')],_0x53d41e[_0x0275('0x6e')][_0x0275('0x2c')]);}break;case _0x0275('0x7c'):var _0x49d39c=_0x58ea62['value']['split'](',')[_0x0275('0x35')](function(_0x37a49d){return Number(_0x37a49d);});_0x49d39c[_0x0275('0x3a')](function(_0x58439d){_0x5683f4['or'](_0x0275('0x7d'),'%,'+_0x58439d+',%');});_0x27b4b8=_[_0x0275('0x7e')](_0x27b4b8,_0x49d39c);break;case _0x0275('0x7f'):if(_0x58ea62[_0x0275('0x80')]===_0x0275('0x73')){_0x126f05[_0x2a4f8d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x58ea62[_0x0275('0x6e')]+'%',null);}else{_0x5e0a17=_['find'](_0x4d6757,[_0x0275('0x2d'),_0x0275('0x42')]);_0x58ea62[_0x0275('0x56')]=_0x0275('0x42');_0x53d41e=as['buildExpression'](_0x2bb5a8,_0x5e0a17[_0x0275('0x49')],_0x58ea62);_0x126f05[_0x2a4f8d](_0x53d41e[_0x0275('0x7a')],_0x53d41e[_0x0275('0x6e')]['start'],_0x53d41e[_0x0275('0x6e')][_0x0275('0x2c')]);}break;case _0x0275('0x30'):_0x53d41e=as[_0x0275('0x79')]('me',null,_0x58ea62);_0x126f05[_0x2a4f8d](_0x53d41e[_0x0275('0x7a')],_0x53d41e[_0x0275('0x6e')][_0x0275('0x7b')],_0x53d41e[_0x0275('0x6e')]['end']);break;}}else{var _0x53d41e=as['buildExpression'](_0x2bb5a8,_0x5e0a17[_0x0275('0x49')],_0x58ea62);_0x126f05[_0x2a4f8d](_0x53d41e[_0x0275('0x7a')],_0x53d41e[_0x0275('0x6e')][_0x0275('0x7b')],_0x53d41e[_0x0275('0x6e')]['end']);}}}else{var _0x5c273e=_(_0x163a08['query'])['keys']()[_0x0275('0x35')](function(_0x4b3d73){return _[_0x0275('0x81')](_0x4d6757,[_0x0275('0x2d'),_0x4b3d73])?_0x4b3d73:undefined;})[_0x0275('0x82')]()[_0x0275('0x6e')]();if(!_[_0x0275('0x83')](_0x5c273e)){_0x5c273e[_0x0275('0x3a')](function(_0x17eb7d){if(_0x17eb7d===_0x0275('0x84')){_0x33556f[_0x0275('0x53')](_0x0275('0x85'),[][_0x0275('0x86')](_0x163a08[_0x0275('0x4c')][_0x17eb7d]));}else if(_0x17eb7d===_0x0275('0x87')){var _0x3db267=JSON[_0x0275('0x88')](_0x163a08[_0x0275('0x4c')][_0x17eb7d])[_0x0275('0x89')];var _0x39c781=JSON[_0x0275('0x88')](_0x163a08[_0x0275('0x4c')][_0x17eb7d])[_0x0275('0x8a')];_0x33556f['where'](_0x0275('0x8b'),_0x3db267,_0x39c781);}else{if(_0x163a08[_0x0275('0x4c')][_0x17eb7d]===_0x0275('0x8c')){_0x33556f[_0x0275('0x53')]('i.'+_0x17eb7d+_0x0275('0x8d'));}else{_0x33556f[_0x0275('0x53')]('i.'+_0x17eb7d+'\x20=\x20?',_0x163a08[_0x0275('0x4c')][_0x17eb7d]);}}});}if(_0x163a08[_0x0275('0x4c')]['read']){if(_0x163a08[_0x0275('0x4c')][_0x0275('0x8e')]==0x1){_0x33556f[_0x0275('0x6f')](_0x0275('0x8f'));}else{_0x33556f['having'](_0x0275('0x90'));}}if(_0x163a08[_0x0275('0x4c')]['tag']){_0x27b4b8=_[_0x0275('0x91')](_0x163a08['query'][_0x0275('0x92')])?_0x163a08[_0x0275('0x4c')]['tag']:new Array(_0x163a08[_0x0275('0x4c')][_0x0275('0x92')]);_0x27b4b8[_0x0275('0x3a')](function(_0x2b3662){_0x5683f4['or'](_0x0275('0x7d'),'%,'+_0x2b3662+',%');});}if(_0x163a08[_0x0275('0x4c')][_0x0275('0x93')]){var _0x569182=_0x163a08[_0x0275('0x4c')][_0x0275('0x93')]['replace']('\x5c','\x5c\x5c')[_0x0275('0x94')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x569182)){_0x126f05['or']('i.id\x20LIKE\x20?',_0x569182+'%');}else{_0x126f05['or'](_0x0275('0x95'),qs['getFullTextValue'](_0x569182))['or'](_0x0275('0x96'),_0x569182+'%');}}}_0x33556f[_0x0275('0x53')](_0x126f05);_0x33556f['group'](_0x0275('0x97'));var _0xe66036={'type':db[_0x0275('0x98')]['QueryTypes'][_0x0275('0x99')],'raw':!![]};var _0x49c711=_0x33556f[_0x0275('0x9a')]();_0x49c711[_0x0275('0x56')](_0x0275('0x97'));_0x49c711['field'](_0x0275('0x9b'),_0x0275('0x9c'));if(_0xb15d65[_0x0275('0x9d')]){_0xb15d65[_0x0275('0x9d')][_0x0275('0x3a')](function(_0x13f251){var _0x5393aa=_0x13f251[0x0]===_0x0275('0x9e')?_0x13f251[0x0]:'i.'+_0x13f251[0x0];_0x33556f[_0x0275('0x9d')](_0x5393aa,_0x13f251[0x1]===_0x0275('0x9f')?![]:!![]);});}if(!_['isEmpty'](_0x27b4b8)){_0x33556f[_0x0275('0x6f')](_0x5683f4);_0x49c711[_0x0275('0x53')](_0x0275('0xa0'),_0x27b4b8);}BPromise['resolve']()[_0x0275('0x19')](function(){if(!_0x424f1e){if(_0x163a08[_0x0275('0x4c')][_0x0275('0x84')])return;_0x49c711['where'](_0x0275('0xa1'));_0x33556f[_0x0275('0x53')](_0x0275('0xa1'));return;}if(_0x163a08[_0x0275('0xa2')][_0x0275('0xa3')]!==_0x0275('0x32'))return;return _0x163a08[_0x0275('0xa2')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x458a2e){if(_[_0x0275('0x83')](_0x458a2e)){_0x49c711[_0x0275('0x53')](_0x0275('0xa4'));_0x33556f[_0x0275('0x53')](_0x0275('0xa4'));}else{_0x49c711[_0x0275('0x53')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0275('0x35')](_0x458a2e,'id'));_0x33556f[_0x0275('0x53')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0275('0x35')](_0x458a2e,'id'));}});})['then'](function(){if(_0x163a08[_0x0275('0xa2')][_0x0275('0xa3')]===_0x0275('0x32')&&!_0x424f1e&&!_0x163a08[_0x0275('0x4c')][_0x0275('0x84')])return[];return db[_0x0275('0xa5')]['query'](_0x49c711[_0x0275('0xa6')](),_0xe66036);})[_0x0275('0x19')](function(_0x397c28){_0x28b9ad[_0x0275('0x27')]=_0x397c28[_0x0275('0x6d')];if(_0x28b9ad[_0x0275('0x27')]===0x0)return[];return db['sequelize'][_0x0275('0x4c')](_0x3ab216[_0x0275('0xa6')](),_0xe66036)[_0x0275('0x19')](function(_0x1aff31){_0x78dc83=_[_0x0275('0xa7')](_0x1aff31,'id');_0xe66036=_['merge'](_0xe66036,{'model':db[_0x0275('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x163a08['query'][_0x0275('0x50')]){_0xb15d65[_0x0275('0x4f')][_0x0275('0x3a')](function(_0x445dd4){_0x33556f[_0x0275('0x56')]('i.'+_0x445dd4);});}else{_0x33556f[_0x0275('0x56')](_0x0275('0x9b'),_0x0275('0x9c'));_0x33556f[_0x0275('0x56')](_0x0275('0xa8'),'Account.key');_0x33556f[_0x0275('0x56')](_0x0275('0xa9'),'Account.mandatoryDisposition');_0x33556f[_0x0275('0x56')](_0x0275('0xaa'),'contactName');_0x33556f[_0x0275('0x56')]('i.*');_0x33556f[_0x0275('0x56')](_0x0275('0xab'),_0x0275('0xac'));_0x33556f[_0x0275('0x56')](_0x0275('0xad'),_0x0275('0xae'));_0x33556f['field'](_0x0275('0xaf'),_0x0275('0xb0'));_0x33556f[_0x0275('0x56')]('c.phone',_0x0275('0xb1'));_0x33556f[_0x0275('0x56')](_0x0275('0xb2'),_0x0275('0xb3'));_0x33556f['field'](_0x0275('0xb4'),_0x0275('0xb5'));_0x33556f[_0x0275('0x56')](_0x0275('0xb6'),_0x0275('0xb7'));_0x33556f['field'](_0x0275('0xb8'),_0x0275('0xb9'));_0x33556f[_0x0275('0x56')](_0x0275('0xba'),_0x0275('0x37'));}if(_0xb15d65[_0x0275('0x25')])_0x33556f[_0x0275('0x25')](_0xb15d65[_0x0275('0x25')]);if(_0xb15d65[_0x0275('0x24')])_0x33556f[_0x0275('0x24')](_0xb15d65['offset']);return db[_0x0275('0xa5')][_0x0275('0x4c')](_0x33556f[_0x0275('0xa6')](),_0xe66036);})[_0x0275('0x19')](function(_0x2a280c){if(_0x2a280c[_0x0275('0x6d')]>0x0)_0x23e37f[_0x0275('0x53')](_0x0275('0xbb'),_[_0x0275('0x35')](_0x2a280c,'id'));return db[_0x0275('0xa5')][_0x0275('0x4c')](_0x23e37f[_0x0275('0xa6')](),_0xe66036)[_0x0275('0x19')](function(_0x206d27){var _0x1e5c6d=_[_0x0275('0xbc')](_0x206d27,_0x0275('0xbd'));var _0x3e079c=[];_0x2a280c[_0x0275('0x3a')](function(_0x21ed9e){_0x3e079c[_0x0275('0x3b')](updateChatInteraction(_0x21ed9e,_0x78dc83,_0x1e5c6d));});return BPromise[_0x0275('0xbe')](_0x3e079c);});});})[_0x0275('0x19')](function(_0xb04903){_0x28b9ad[_0x0275('0xbf')]=_0xb04903;return _0x28b9ad;})[_0x0275('0x19')](respondWithFilteredResult(_0x1d1ac8,_0xb15d65))['catch'](handleError(_0x1d1ac8,null));};exports[_0x0275('0xc0')]=function(_0x57ab50,_0x257611){var _0x47608b={'raw':![],'where':{'id':_0x57ab50['params']['id']}},_0x4a237f={};_0x4a237f[_0x0275('0x4b')]=_[_0x0275('0xc1')](db[_0x0275('0x46')][_0x0275('0x47')]);_0x4a237f[_0x0275('0x4c')]=_[_0x0275('0xc1')](_0x57ab50[_0x0275('0x4c')]);_0x4a237f[_0x0275('0x4d')]=_[_0x0275('0x4e')](_0x4a237f[_0x0275('0x4b')],_0x4a237f[_0x0275('0x4c')]);_0x47608b['attributes']=_[_0x0275('0x4e')](_0x4a237f[_0x0275('0x4b')],qs['fields'](_0x57ab50[_0x0275('0x4c')][_0x0275('0x50')]));_0x47608b['attributes']=_0x47608b['attributes'][_0x0275('0x6d')]?_0x47608b[_0x0275('0x4f')]:_0x4a237f[_0x0275('0x4b')];if(_0x57ab50[_0x0275('0x4c')][_0x0275('0xc2')]){_0x47608b[_0x0275('0xc3')]=[{'all':!![]}];}_0x47608b=_[_0x0275('0xc4')]({},_0x47608b,_0x57ab50[_0x0275('0xc5')]);return db['ChatInteraction'][_0x0275('0x77')](_0x47608b)[_0x0275('0x19')](handleEntityNotFound(_0x257611,null))[_0x0275('0x19')](respondWithResult(_0x257611,null))['catch'](handleError(_0x257611,null));};exports[_0x0275('0xc6')]=function(_0x5f0fd5,_0x1d6d73){return db[_0x0275('0x46')][_0x0275('0xc6')](_0x5f0fd5[_0x0275('0x30')],{})[_0x0275('0x19')](respondWithResult(_0x1d6d73,0xc9))[_0x0275('0x20')](handleError(_0x1d6d73,null));};exports['update']=function(_0x47e9ba,_0x3d122f){if(_0x47e9ba['body']['id']){delete _0x47e9ba[_0x0275('0x30')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x47e9ba[_0x0275('0xc7')]['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x3d122f,null))[_0x0275('0x19')](saveUpdates(_0x47e9ba[_0x0275('0x30')],null))[_0x0275('0x19')](respondWithResult(_0x3d122f,null))[_0x0275('0x20')](handleError(_0x3d122f,null));};exports['destroy']=function(_0x298169,_0x4be783){return db[_0x0275('0x46')]['find']({'where':{'id':_0x298169['params']['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x4be783,null))[_0x0275('0x19')](removeEntity(_0x4be783,null))[_0x0275('0x20')](handleError(_0x4be783,null));};exports['describe']=function(_0x31f695,_0x19eb67){return db[_0x0275('0x46')]['describe']()['then'](respondWithResult(_0x19eb67,null))['catch'](handleError(_0x19eb67,null));};exports['createVidaooSession']=function(_0xa53ae8,_0x4ff75f){var _0x224a09=_0xa53ae8['params']['id'];var _0x334c51;var _0x4db2c6;var _0x24ff74;return db[_0x0275('0x46')]['findOne']({'where':{'id':_0x224a09}})['then'](function(_0x236e84){_0x334c51=_0x236e84;return db[_0x0275('0xc8')][_0x0275('0xc9')]({'where':{'id':_0x236e84[_0x0275('0x84')]},'attributes':['id',_0x0275('0xca'),'vidaooEscalation',_0x0275('0xcb'),_0x0275('0xcc'),_0x0275('0xcd')],'raw':!![]});})['then'](function(_0x340ec6){if(_0x340ec6&&_0x340ec6[_0x0275('0xca')]&&_0x340ec6[_0x0275('0xce')]){_0x4db2c6=_0x340ec6;var _0x1d8c42={'interaction':{'id':_0x224a09},'agent':{'id':_0xa53ae8[_0x0275('0xa2')]['id'],'name':_0xa53ae8[_0x0275('0xa2')][_0x0275('0x2d')],'fullname':_0xa53ae8[_0x0275('0xa2')][_0x0275('0x36')],'email':_0xa53ae8[_0x0275('0xa2')][_0x0275('0xcf')]},'contact':_0xa53ae8[_0x0275('0x30')][_0x0275('0x31')],'account':_0xa53ae8[_0x0275('0x30')][_0x0275('0xd0')]};var _0x1f55e3={'rejectUnauthorized':![],'method':_0x0275('0xd1'),'url':_0x0275('0xd2'),'headers':{'X-APIKEY':_0x340ec6[_0x0275('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xa53ae8['user']['email']],'buttons':null,'topic':_0x4db2c6[_0x0275('0xcb')],'note':_[_0x0275('0xd3')](_0x4db2c6[_0x0275('0xcc')])?null:getMustacheRender(_0x4db2c6[_0x0275('0xcc')],_0x1d8c42),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x0275('0xd3')](_0x4db2c6[_0x0275('0xcd')])){var _0x1ebe5a=getMustacheRender(_0x4db2c6[_0x0275('0xcd')],_0x1d8c42);var _0x176ea1=JSON[_0x0275('0x88')](_0x1ebe5a);_0x1f55e3[_0x0275('0x30')][_0x0275('0xd4')]=_0x176ea1;}}catch(_0x36b378){throw new db[(_0x0275('0x98'))][(_0x0275('0xd5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x1f55e3);}else{throw new db[(_0x0275('0x98'))][(_0x0275('0xd5'))](_0x0275('0xd6'));}})[_0x0275('0x19')](function(_0x820de0){_0x24ff74=_0x820de0;if(_0x24ff74['id']){var _0x251b16={'body':_0x24ff74[_0x0275('0xd7')],'ChatWebsiteId':_0x4db2c6['id'],'ChatInteractionId':_0x334c51['id'],'direction':_0x0275('0xd8'),'UserId':_0xa53ae8['user']['id']};return db['ChatMessage'][_0x0275('0xc6')](_0x251b16,{});}else{throw new db[(_0x0275('0x98'))][(_0x0275('0xd5'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x334c51[_0x0275('0xd9')]({'vidaooSessionId':_0x24ff74['id']});})[_0x0275('0x19')](respondWithResult(_0x4ff75f,null))[_0x0275('0x20')](handleError(_0x4ff75f,null));};exports[_0x0275('0xda')]=function(_0x17ffbe,_0xbd42c1){if(_0x17ffbe[_0x0275('0x30')]['id']){delete _0x17ffbe[_0x0275('0x30')]['id'];}return db[_0x0275('0x46')][_0x0275('0x77')]({'where':{'id':_0x17ffbe['params']['id']},'include':[{'model':db['CmContact'],'as':_0x0275('0x72')}]})[_0x0275('0x19')](handleEntityNotFound(_0xbd42c1,null))['then'](saveUpdates(_0x17ffbe[_0x0275('0x30')],null))['then'](respondWithResult(_0xbd42c1,null))[_0x0275('0x20')](handleError(_0xbd42c1,null));};exports['abandon']=function(_0x33b4b6,_0x268979){if(_0x33b4b6['body']['id']){delete _0x33b4b6[_0x0275('0x30')]['id'];}return db[_0x0275('0x46')][_0x0275('0x77')]({'where':{'id':_0x33b4b6[_0x0275('0xc7')]['id']}})['then'](function(_0xc7ee12){if(!_0xc7ee12){logger[_0x0275('0x1d')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x0275('0xdb'));_0x268979[_0x0275('0x21')](0x194);}else{if(_0xc7ee12[_0x0275('0x42')]){throw new db[(_0x0275('0x98'))][(_0x0275('0xd5'))](_0x0275('0xdc'));}}return _0xc7ee12;})[_0x0275('0x19')](function(_0x50d78f){if(_0x50d78f){return _0x50d78f['update']({'closed':_0x33b4b6['body'][_0x0275('0x41')],'disposition':_0x33b4b6[_0x0275('0x30')][_0x0275('0x43')]})[_0x0275('0x19')](function(_0x2a8123){return _0x2a8123;});}})[_0x0275('0x19')](function(){return respondWithRpcPromise(_0x0275('0xdd'),_0x0275('0xde'),_0x33b4b6[_0x0275('0x30')],client9004);})[_0x0275('0x19')](respondWithResult(_0x268979,null))['catch'](handleError(_0x268979,null));};exports[_0x0275('0xdf')]=function(_0xdd1bff,_0x27f7f1){_0xdd1bff[_0x0275('0x30')][_0x0275('0x2d')]=_0xdd1bff[_0x0275('0xe0')]['originalname'];_0xdd1bff['body'][_0x0275('0xe1')]=_0xdd1bff[_0x0275('0xe0')][_0x0275('0xe2')];_0xdd1bff[_0x0275('0x30')]['type']=_0xdd1bff[_0x0275('0xe0')]['mimetype'];return db[_0x0275('0xe3')]['create'](_0xdd1bff[_0x0275('0x30')])[_0x0275('0x19')](respondWithResult(_0x27f7f1,0xc9))[_0x0275('0x20')](handleError(_0x27f7f1,null));};exports[_0x0275('0xe4')]=function(_0x2a5f2c,_0x31eac9){return db[_0x0275('0x46')][_0x0275('0xc9')]({'where':{'id':_0x2a5f2c[_0x0275('0xc7')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x31eac9,null))[_0x0275('0x19')](function(_0x50a8f1){if(_0x50a8f1){if(_0x50a8f1[_0x0275('0x41')]){return _0x31eac9['status'](0x193)[_0x0275('0x23')]({'status':0x193,'message':'Unauthorized'});}return db[_0x0275('0xe3')]['findOne']({'where':{'id':_0x2a5f2c[_0x0275('0x4c')][_0x0275('0xe5')]},'raw':!![]})['then'](handleEntityNotFound(_0x31eac9,null));}})[_0x0275('0x19')](function(_0x5f4401){if(_0x5f4401){var _0xc04fd5=_0x5f4401['ChatOfflineMessageId']!==null;var _0x101fc3=path[_0x0275('0xe6')](config['root'],_0x0275('0xe7'));if(_0xc04fd5){_0x101fc3=path[_0x0275('0xe6')](_0x101fc3,_0x0275('0xe8'));}var _0x2edbb9=path[_0x0275('0xe6')](_0x101fc3,_0x5f4401[_0x0275('0xe1')]);return _0x31eac9[_0x0275('0xe9')](_0x2edbb9);}})[_0x0275('0x20')](handleError(_0x31eac9,null));};exports[_0x0275('0xea')]=function(_0xa95c3,_0x4d2658){var _0x268a07=null;var _0x4ab6d2=null;var _0x7ffbdd=null;if(_0xa95c3[_0x0275('0x30')]['id']){delete _0xa95c3[_0x0275('0x30')]['id'];}if(_0xa95c3[_0x0275('0x30')][_0x0275('0xeb')]){_0x7ffbdd=path['join'](config[_0x0275('0xec')],'server/files/chat/upload/',util[_0x0275('0xed')]('transcript-%s.txt',Date[_0x0275('0xee')]()));_0xa95c3['body']['pathTranscript']=_0x7ffbdd;}return db[_0x0275('0x46')][_0x0275('0x77')]({'where':{'id':_0xa95c3[_0x0275('0xc7')]['id']},'include':[{'model':db[_0x0275('0xef')],'as':_0x0275('0xf0'),'include':[{'model':db[_0x0275('0x7f')],'as':_0x0275('0x7f')}]}]})[_0x0275('0x19')](handleEntityNotFound(_0x4d2658,null))[_0x0275('0x19')](saveUpdates(_0xa95c3[_0x0275('0x30')],null))['then'](function(_0xb954f1){if(_0xb954f1){_0x268a07=_0xb954f1;return db[_0x0275('0xc8')][_0x0275('0x77')]({'where':{'id':_0x268a07[_0x0275('0x84')]}});}})[_0x0275('0x19')](function(_0x556467){if(_0x556467){_0x4ab6d2=_0x556467;return db[_0x0275('0xf1')]['find']({'where':{'id':_0x268a07[_0x0275('0x78')]}});}})[_0x0275('0x19')](function(_0x3a0919){if(_0x3a0919){if(_0x7ffbdd){var _0x12d822=null;for(var _0x356443=0x1;_0x356443<_0x268a07[_0x0275('0xf0')]['length'];++_0x356443){_0x12d822=_0x268a07[_0x0275('0xf0')][_0x356443];var _0x564791=_0x12d822[_0x0275('0x42')]?util['format'](_0x0275('0xf2'),_0x4ab6d2[_0x0275('0xf3')],_0x12d822[_0x0275('0x42')]):_0x0275('0xf4');var _0x5deb56=_0xa95c3[_0x0275('0x30')][_0x0275('0xf5')]||util[_0x0275('0xed')](_0x0275('0xf2'),_0x0275('0xf6'),_0x12d822['ContactId']);switch(_0x4ab6d2['agentIdentifier']){case _0x0275('0xf7'):_0x564791=_0x12d822[_0x0275('0x42')]?util[_0x0275('0xed')]('%s%d',_0x4ab6d2[_0x0275('0xf3')],_0x12d822[_0x0275('0x42')]):_0x0275('0xf4');break;case'agent_alias':_0x564791=_0x12d822[_0x0275('0x42')]?_0x12d822[_0x0275('0x7f')][_0x0275('0xf8')]||_0x12d822[_0x0275('0x7f')][_0x0275('0x36')]:_0x0275('0xf4');break;case _0x0275('0xf9'):_0x564791=_0x12d822[_0x0275('0x42')]?_0x12d822[_0x0275('0x7f')][_0x0275('0x36')]:'System';break;default:_0x564791=_0x12d822[_0x0275('0x42')]?util['format'](_0x0275('0xf2'),_0x4ab6d2[_0x0275('0xf3')],_0x12d822[_0x0275('0x42')]):'System';}var _0x1afcd6=util[_0x0275('0xed')](_0x0275('0xfa'),moment(_0x12d822['createdAt'])[_0x0275('0xed')]('MM/DD/YYYY\x20HH:mm:ss'),_0x12d822[_0x0275('0xfb')]==='in'?_0x5deb56:_0x564791,_0x12d822[_0x0275('0x30')]);if(!_0x12d822[_0x0275('0xfc')]){fs[_0x0275('0xfd')](_0x7ffbdd,_0x1afcd6);}}return db[_0x0275('0xfe')][_0x0275('0xc9')]({'where':{'service':!![]},'include':[{'model':db[_0x0275('0xff')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x0275('0x100')],'as':_0x0275('0x100'),'raw':!![]}]}]});}}})['then'](function(_0x5e86bf){if(!_0x5e86bf||!_0x5e86bf[_0x0275('0x101')]||!_0xa95c3['body'])return _0x268a07;var _0x5f0ca3=_0x5e86bf[_0x0275('0x102')]();return respondWithRpcPromise(_0x0275('0x103'),_0x0275('0x104'),{'account':_0x5f0ca3,'message':{'from':util[_0x0275('0xed')](_0x0275('0x105'),_0x5e86bf[_0x0275('0x2d')],_0x5e86bf[_0x0275('0xcf')]||_0x5e86bf[_0x0275('0x101')][_0x0275('0xa2')]),'to':_0xa95c3[_0x0275('0x30')][_0x0275('0xeb')],'subject':_0x0275('0x106'),'text':util[_0x0275('0xed')](_0x0275('0x107'),_0xa95c3[_0x0275('0x30')]['mailTranscript']),'attachments':[{'path':_0x7ffbdd}]}})[_0x0275('0x19')](function(){return _0x268a07;})[_0x0275('0x20')](function(_0x284e4e){logger[_0x0275('0x1d')](_0x284e4e);});})[_0x0275('0x19')](respondWithStatusCode(_0x4d2658,0xc8))['catch'](handleError(_0x4d2658,null));};exports['addMessage']=function(_0x87955,_0xf4cfdb){return db[_0x0275('0xef')]['find']({'where':{'id':_0x87955[_0x0275('0xc7')]['id']}})['then'](handleEntityNotFound(_0xf4cfdb,null))[_0x0275('0x19')](function(_0x6322c3){if(_0x6322c3){return _0x6322c3[_0x0275('0x108')](_0x87955['body'][_0x0275('0x109')],_[_0x0275('0x10a')](_0x87955['body'],['ids','id'])||{});}})[_0x0275('0x19')](respondWithResult(_0xf4cfdb,null))[_0x0275('0x20')](handleError(_0xf4cfdb,null));};exports[_0x0275('0x10b')]=function(_0x5d55b1,_0x1d60ce){var _0x556d56={'raw':![],'where':{}};var _0x52ecbd={};var _0x39ddbf={'count':0x0,'rows':[]};return db[_0x0275('0x46')][_0x0275('0xc9')]({'where':{'id':_0x5d55b1[_0x0275('0xc7')]['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x1d60ce,null))[_0x0275('0x19')](function(_0x3bcceb){if(_0x3bcceb){_0x52ecbd[_0x0275('0x4b')]=_['keys'](db[_0x0275('0xef')][_0x0275('0x47')]);_0x52ecbd[_0x0275('0x4c')]=_[_0x0275('0xc1')](_0x5d55b1['query']);_0x52ecbd['filters']=_[_0x0275('0x4e')](_0x52ecbd[_0x0275('0x4b')],_0x52ecbd['query']);_0x556d56[_0x0275('0x4f')]=_[_0x0275('0x4e')](_0x52ecbd[_0x0275('0x4b')],qs[_0x0275('0x50')](_0x5d55b1[_0x0275('0x4c')][_0x0275('0x50')]));_0x556d56[_0x0275('0x4f')]=_0x556d56[_0x0275('0x4f')][_0x0275('0x6d')]?_0x556d56[_0x0275('0x4f')]:_0x52ecbd[_0x0275('0x4b')];if(!_0x5d55b1[_0x0275('0x4c')][_0x0275('0x10c')](_0x0275('0x51'))){_0x556d56[_0x0275('0x25')]=qs[_0x0275('0x25')](_0x5d55b1['query']['limit']);_0x556d56[_0x0275('0x24')]=qs[_0x0275('0x24')](_0x5d55b1['query'][_0x0275('0x24')]);}_0x556d56[_0x0275('0x9d')]=qs[_0x0275('0x52')](_0x5d55b1[_0x0275('0x4c')][_0x0275('0x52')]);_0x556d56[_0x0275('0x53')]=qs['filters'](_[_0x0275('0x54')](_0x5d55b1[_0x0275('0x4c')],_0x52ecbd['filters']));_0x556d56['where'][_0x0275('0xbd')]=_0x3bcceb['id'];if(_0x5d55b1[_0x0275('0x4c')]['filter']){_0x556d56['where']=_[_0x0275('0xc4')](_0x556d56['where'],{'$or':_[_0x0275('0x35')](_0x556d56[_0x0275('0x4f')],function(_0x3db1aa){var _0x3b8938={};_0x3b8938[_0x3db1aa]={'$like':'%'+_0x5d55b1['query'][_0x0275('0x93')]+'%'};return _0x3b8938;})});}if(_0x5d55b1[_0x0275('0x4c')][_0x0275('0x89')]){var _0x589941=_0x5d55b1[_0x0275('0x4c')]['$gte'][_0x0275('0x39')](',');var _0x38403b={};_0x38403b[_0x589941[0x0]]={'$gte':moment(_0x589941[0x1])[_0x0275('0xed')]('YYYY-MM-DD\x20HH:mm:ss')};_0x556d56[_0x0275('0x53')]=_[_0x0275('0xc4')](_0x556d56[_0x0275('0x53')],_0x38403b);}_0x556d56=_[_0x0275('0xc4')]({},_0x556d56,_0x5d55b1[_0x0275('0xc5')]);return db[_0x0275('0xef')][_0x0275('0x27')]({'where':_0x556d56[_0x0275('0x53')]})[_0x0275('0x19')](function(_0x410480){_0x39ddbf[_0x0275('0x27')]=_0x410480;if(_0x5d55b1['query'][_0x0275('0xc2')]){_0x556d56[_0x0275('0xc3')]=[{'all':!![]}];}return db[_0x0275('0xef')][_0x0275('0x10d')](_0x556d56);})['then'](function(_0x3ec80d){_0x39ddbf[_0x0275('0xbf')]=_0x3ec80d;return _0x39ddbf;});}})[_0x0275('0x19')](respondWithFilteredResult(_0x1d60ce,_0x556d56))[_0x0275('0x20')](handleError(_0x1d60ce,null));};exports['getMyMessages']=function(_0x433f70,_0x30d128){var _0x38a6b1={'where':{}},_0x4b1f62={},_0x20fc16={'count':0x0,'rows':[]};return db[_0x0275('0x46')][_0x0275('0xc9')]({'where':{'id':_0x433f70[_0x0275('0xc7')]['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x30d128,null))[_0x0275('0x19')](function(_0x258d3b){if(_0x258d3b){_0x4b1f62[_0x0275('0x4b')]=_[_0x0275('0xc1')](db[_0x0275('0xef')]['rawAttributes']);_0x4b1f62[_0x0275('0x4c')]=_[_0x0275('0xc1')](_0x433f70['query']);_0x4b1f62[_0x0275('0x4d')]=_[_0x0275('0x4e')](_0x4b1f62[_0x0275('0x4b')],_0x4b1f62[_0x0275('0x4c')]);_0x38a6b1[_0x0275('0x4f')]=_[_0x0275('0x4e')](_0x4b1f62[_0x0275('0x4b')],qs[_0x0275('0x50')](_0x433f70[_0x0275('0x4c')][_0x0275('0x50')]));_0x38a6b1[_0x0275('0x4f')]=_0x38a6b1['attributes']['length']?_0x38a6b1[_0x0275('0x4f')]:_0x4b1f62['model'];if(!_0x433f70[_0x0275('0x4c')][_0x0275('0x10c')](_0x0275('0x51'))){_0x38a6b1[_0x0275('0x25')]=qs['limit'](_0x433f70[_0x0275('0x4c')][_0x0275('0x25')]);_0x38a6b1[_0x0275('0x24')]=qs[_0x0275('0x24')](_0x433f70[_0x0275('0x4c')][_0x0275('0x24')]);}_0x38a6b1[_0x0275('0x9d')]=qs[_0x0275('0x52')](_0x433f70[_0x0275('0x4c')][_0x0275('0x52')]);_0x38a6b1[_0x0275('0x53')]=qs['filters'](_[_0x0275('0x54')](_0x433f70[_0x0275('0x4c')],_0x4b1f62[_0x0275('0x4d')]));_0x38a6b1['where'][_0x0275('0xbd')]=_0x258d3b['id'];if(_0x433f70[_0x0275('0x4c')][_0x0275('0x93')]){_0x38a6b1['where']=_[_0x0275('0xc4')](_0x38a6b1[_0x0275('0x53')],{'$or':_[_0x0275('0x35')](_0x38a6b1['attributes'],function(_0x3ca2ca){var _0x5e4ce3={};_0x5e4ce3[_0x3ca2ca]={'$like':'%'+_0x433f70['query']['filter']+'%'};return _0x5e4ce3;})});}_0x38a6b1[_0x0275('0x53')][_0x0275('0xfc')]=![];if(_0x433f70['query']['id']){_0x38a6b1[_0x0275('0x53')]['id']={'$gt':_0x433f70[_0x0275('0x4c')]['id']};}_0x38a6b1=_[_0x0275('0xc4')]({},_0x38a6b1,_0x433f70[_0x0275('0xc5')]);return db[_0x0275('0xef')][_0x0275('0x27')]({'where':_0x38a6b1[_0x0275('0x53')]})[_0x0275('0x19')](function(_0x345df0){_0x20fc16['count']=_0x345df0;_0x38a6b1[_0x0275('0xc3')]=[];if(_0x433f70[_0x0275('0x4c')][_0x0275('0x10e')]){_0x38a6b1[_0x0275('0xc3')][_0x0275('0x3b')]({'model':db[_0x0275('0x7f')],'as':_0x0275('0x7f'),'attributes':['id',_0x0275('0x36'),'alias']});}if(_0x433f70['query'][_0x0275('0xc2')]){_0x38a6b1[_0x0275('0xc3')]=[{'all':!![]}];}return db[_0x0275('0xef')][_0x0275('0x10d')](_0x38a6b1);})[_0x0275('0x19')](function(_0x9dd17e){_0x20fc16[_0x0275('0xbf')]=_0x9dd17e;return _0x20fc16;});}})['then'](respondWithFilteredResult(_0x30d128,_0x38a6b1))[_0x0275('0x20')](handleError(_0x30d128,null));};exports[_0x0275('0x10f')]=function(_0x284329,_0x575f73){return db[_0x0275('0x46')][_0x0275('0x77')]({'where':{'id':_0x284329['params']['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x575f73,null))[_0x0275('0x19')](function(_0x4f0ab5){if(_0x4f0ab5){return _0x4f0ab5[_0x0275('0x110')](_0x284329[_0x0275('0x30')][_0x0275('0x109')],_['omit'](_0x284329['body'],['ids','id'])||{})[_0x0275('0x111')](function(){return db[_0x0275('0x7c')][_0x0275('0x10d')]({'attributes':['id',_0x0275('0x2d'),_0x0275('0x112')],'where':{'id':_0x284329[_0x0275('0x30')][_0x0275('0x109')]}});})[_0x0275('0x19')](function(_0x15b6c0){socket['emit'](_0x0275('0x113'),{'id':Number(_0x284329['params']['id']),'tags':_0x15b6c0||[]});return{'id':Number(_0x284329[_0x0275('0xc7')]['id']),'tags':_0x15b6c0||[]};});}})[_0x0275('0x19')](respondWithResult(_0x575f73,null))[_0x0275('0x20')](handleError(_0x575f73,null));};exports[_0x0275('0x114')]=function(_0x362713,_0x58cd4b){return db['ChatInteraction']['find']({'where':{'id':_0x362713[_0x0275('0xc7')]['id']}})[_0x0275('0x19')](handleEntityNotFound(_0x58cd4b,null))[_0x0275('0x19')](function(_0x3bd0f9){if(_0x3bd0f9){return _0x3bd0f9[_0x0275('0x114')](_0x362713[_0x0275('0x4c')][_0x0275('0x109')]);}})[_0x0275('0x19')](respondWithStatusCode(_0x58cd4b,null))[_0x0275('0x20')](handleError(_0x58cd4b,null));};exports[_0x0275('0xe9')]=function(_0x5503e1,_0x25e2d2){var _0x3b0ebb=moment()[_0x0275('0x115')]()[_0x0275('0xa6')]();var _0x478430=path[_0x0275('0xe6')](config[_0x0275('0xec')],'server',_0x0275('0x116'),_0x0275('0x117'));var _0x356e83=path[_0x0275('0xe6')](config[_0x0275('0xec')],_0x0275('0x118'),_0x0275('0x116'),_0x0275('0x119'));var _0x3b6526=path[_0x0275('0xe6')](_0x478430,_0x3b0ebb);var _0x4b9a31=util[_0x0275('0xed')](_0x0275('0x11a'),_0x5503e1['params']['id'],_0x3b0ebb);var _0x1c2691=path[_0x0275('0xe6')](_0x478430,_0x4b9a31);var _0x41036e=[];_0x41036e[_0x0275('0x3b')]({'model':db[_0x0275('0x7f')],'as':_0x0275('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x41036e[_0x0275('0x3b')]({'model':db['CmContact'],'as':_0x0275('0x72'),'attributes':['id',_0x0275('0x11b'),_0x0275('0x11c')],'raw':!![]});if(_0x5503e1[_0x0275('0x4c')][_0x0275('0x119')]){_0x41036e['push']({'model':db['Attachment'],'as':_0x0275('0xe3'),'raw':!![]});}var _0x583712=[{'model':db[_0x0275('0xef')],'as':'Messages','attributes':['id','body',_0x0275('0x87'),_0x0275('0xfb'),_0x0275('0xfc'),_0x0275('0x8e')],'include':_0x41036e}];_0x583712[_0x0275('0x3b')]({'model':db['ChatWebsite'],'as':_0x0275('0x11d'),'attributes':['id',_0x0275('0x2d')]});_0x583712[_0x0275('0x3b')]({'model':db['User'],'as':'Owner','attributes':['id',_0x0275('0x36')]});return db[_0x0275('0x46')][_0x0275('0x77')]({'where':{'id':_0x5503e1[_0x0275('0xc7')]['id']},'include':_0x583712})[_0x0275('0x19')](handleEntityNotFound(_0x25e2d2,null))[_0x0275('0x19')](function(_0xe877e2){if(_0xe877e2){var _0x55abe3=_0xe877e2[_0x0275('0x11e')]({'plain':!![]});fs[_0x0275('0x11f')](_0x3b6526);var _0x4fd2c9={'channel':'Chat','account':_0x55abe3['Account'][_0x0275('0x2d')],'agent':_0x55abe3[_0x0275('0x120')]?_0x55abe3[_0x0275('0x120')][_0x0275('0x36')]:_0x0275('0x121'),'createdAt':moment(_0x55abe3[_0x0275('0x87')])[_0x0275('0xed')](_0x0275('0x122'))[_0x0275('0xa6')](),'closedAt':_0x55abe3[_0x0275('0x41')]?moment(_0x55abe3['closedAt'])[_0x0275('0xed')](_0x0275('0x122'))[_0x0275('0xa6')]():'','disposition':_0x55abe3[_0x0275('0x43')],'chatInfo':{'browser':_0x55abe3[_0x0275('0x123')],'os':_0x55abe3[_0x0275('0x124')],'referer':_0x55abe3[_0x0275('0x125')],'customerIp':_0x55abe3['customerIp'],'customerPort':_0x55abe3['customerPort']?_0x55abe3[_0x0275('0x126')]:_0x0275('0x121')},'messages':_(_0x55abe3[_0x0275('0xf0')])[_0x0275('0x127')]()['filter']({'secret':![]})[_0x0275('0x35')](function(_0x37d6f1){if(_0x37d6f1[_0x0275('0xe3')]){var _0x4bf67c=path[_0x0275('0xe6')](_0x356e83,_0x37d6f1[_0x0275('0xe3')][_0x0275('0xe1')]);if(fs[_0x0275('0x128')](_0x4bf67c)){fs[_0x0275('0x129')](_0x4bf67c)[_0x0275('0x12a')](fs[_0x0275('0x12b')](path[_0x0275('0xe6')](_0x3b6526,_0x37d6f1[_0x0275('0xe3')]['basename'])));}}return{'date':moment(_0x37d6f1[_0x0275('0x87')])[_0x0275('0xed')](_0x0275('0x122'))[_0x0275('0xa6')](),'sender':_0x37d6f1[_0x0275('0xfb')]==='out'?_0x37d6f1[_0x0275('0x7f')]?_0x37d6f1[_0x0275('0x7f')][_0x0275('0x36')]:_0x0275('0xf4'):_0x37d6f1[_0x0275('0x72')][_0x0275('0x11b')]+(_0x37d6f1[_0x0275('0x72')][_0x0275('0x11c')]?'\x20'+_0x37d6f1[_0x0275('0x72')][_0x0275('0x11c')]:''),'body':_0x37d6f1[_0x0275('0xe3')]?_0x37d6f1[_0x0275('0xe3')][_0x0275('0xe1')]:_0x37d6f1['body'],'direction':_0x37d6f1['direction']==='out'?'A':'C','secret':_0x37d6f1[_0x0275('0xfc')],'read':_0x37d6f1[_0x0275('0x8e')],'attachment':_0x37d6f1['Attachment']};})['value']()};return ejs['renderFile'](path[_0x0275('0xe6')](config[_0x0275('0xec')],_0x0275('0x118'),_0x0275('0x12c'),_0x0275('0x12d')),{'interaction':_0x4fd2c9})[_0x0275('0x19')](function(_0x2f5529){var _0x2f40e3=path[_0x0275('0xe6')](_0x3b6526,_0x0275('0x12e')+_0x55abe3['id']+'-'+_0x3b0ebb+_0x0275('0x12f'));var _0xc95536={'path':_0x2f40e3,'channel':'Chat','interactionId':_0x55abe3['id']};return pdf[_0x0275('0x130')](_0x2f5529,_0xc95536);})[_0x0275('0x19')](function(){return new Promise(function(_0x515fdb,_0xb0cd3e){zipdir(_0x3b6526,{'saveTo':_0x1c2691},function(_0x5cd982,_0x3fc043){if(_0x5cd982)return _0xb0cd3e(_0x5cd982);return _0x515fdb(_0x3fc043);});})[_0x0275('0x19')](function(){return new BPromise(function(_0x2b8b3e,_0x34b6eb){rimraf(_0x3b6526,function(_0x152b1f){if(_0x152b1f)_0x34b6eb(_0x152b1f);return _0x2b8b3e();});});})[_0x0275('0x19')](function(){return _0x25e2d2['download'](_0x1c2691,_0x4b9a31,function(_0x139328){if(_0x139328){logger['error'](_0x0275('0x131'),_0x139328);}else{fs[_0x0275('0x132')](_0x1c2691);}});});});}else{return _0x25e2d2[_0x0275('0x21')](0xc8);}})[_0x0275('0x20')](handleError(_0x25e2d2,null));}; \ No newline at end of file +var _0x70e0=['transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','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','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','fullname','addTags','setTags','spread','Tag','chatInteractionTags:save','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','Chat','closedAt','browserName','osName','referer','customerPort','N.A.','tail','existsSync','createReadStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','mustache','util','path','ejs','squel','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','stack','send','render','merge','body','contact','account','map','TagIds','Tags','split','forEach','push','catch','waiting','unmanaged','abandoned','total','UserId','closed','disposition','talking','index','ChatInteraction','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','buildExpression','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','keyBy','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.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.ChatInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','server/files/attachments/','join','download','mailTranscript','root'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x70e0,0x17b));var _0x070e=function(_0x3a54a9,_0xb33ffc){_0x3a54a9=_0x3a54a9-0x0;var _0x4376c0=_0x70e0[_0x3a54a9];return _0x4376c0;};'use strict';var rimraf=require(_0x070e('0x0'));var zipdir=require(_0x070e('0x1'));var rp=require(_0x070e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x070e('0x3'));var util=require(_0x070e('0x4'));var path=require(_0x070e('0x5'));var ejs=require(_0x070e('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x070e('0x7'));var Redis=require('ioredis');var qs=require(_0x070e('0x8'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x070e('0x9'));var config=require(_0x070e('0xa'));var db=require(_0x070e('0xb'))['db'];config[_0x070e('0xc')]=_[_0x070e('0xd')](config[_0x070e('0xc')],{'host':_0x070e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x070e('0xf'))[_0x070e('0x10')](socket);var jayson=require(_0x070e('0x11'));var client=jayson[_0x070e('0x12')][_0x070e('0x13')]({'port':0x232b});var client9004=jayson[_0x070e('0x12')][_0x070e('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x1baa12,_0x39d2b9,_0x5bf079,_0x2930b8){return new BPromise(function(_0x52da3b,_0x5dca0f){var _0x24baba=_0x2930b8||client;return _0x24baba['request'](_0x1baa12,_0x5bf079)['then'](function(_0x5bae0f){logger[_0x070e('0x14')](_0x070e('0x15'),_0x39d2b9,'request\x20sent');logger['debug'](_0x070e('0x16'),_0x39d2b9,_0x070e('0x17'),JSON[_0x070e('0x18')](_0x5bae0f));if(_0x5bae0f[_0x070e('0x19')]){if(_0x5bae0f['error']['code']===0x1f4){logger[_0x070e('0x19')](_0x070e('0x15'),_0x39d2b9,_0x5bae0f[_0x070e('0x19')][_0x070e('0x1a')]);return _0x5dca0f(_0x5bae0f[_0x070e('0x19')]['message']);}logger[_0x070e('0x19')](_0x070e('0x15'),_0x39d2b9,_0x5bae0f[_0x070e('0x19')][_0x070e('0x1a')]);return _0x52da3b(_0x5bae0f[_0x070e('0x19')]['message']);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x39d2b9,_0x070e('0x17'));_0x52da3b(_0x5bae0f[_0x070e('0x1b')][_0x070e('0x1a')]);}})['catch'](function(_0x5b184){logger['error'](_0x070e('0x15'),_0x39d2b9,_0x5b184);_0x5dca0f(_0x5b184);});});}function respondWithStatusCode(_0x3f6985,_0x27a01e){_0x27a01e=_0x27a01e||0xcc;return function(_0x33e8c6){if(_0x33e8c6){return _0x3f6985[_0x070e('0x1c')](_0x27a01e);}return _0x3f6985[_0x070e('0x1d')](_0x27a01e)[_0x070e('0x1e')]();};}function respondWithResult(_0x164cdf,_0x595c7e){_0x595c7e=_0x595c7e||0xc8;return function(_0x2f8055){if(_0x2f8055){return _0x164cdf[_0x070e('0x1d')](_0x595c7e)[_0x070e('0x1f')](_0x2f8055);}};}function respondWithFilteredResult(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(_0x5f3e9d){var _0x4a2dbd=typeof _0xf17c56[_0x070e('0x20')]===_0x070e('0x21')&&typeof _0xf17c56[_0x070e('0x22')]===_0x070e('0x21');var _0x4763c6=_0x5f3e9d['count'];var _0x374c54=_0x4a2dbd?0x0:_0xf17c56[_0x070e('0x20')];var _0x1d72d6=_0x4a2dbd?_0x5f3e9d[_0x070e('0x23')]:_0xf17c56[_0x070e('0x20')]+_0xf17c56[_0x070e('0x22')];var _0x1a1892;if(_0x1d72d6>=_0x4763c6){_0x1d72d6=_0x4763c6;_0x1a1892=0xc8;}else{_0x1a1892=0xce;}_0x503f4d[_0x070e('0x1d')](_0x1a1892);return _0x503f4d['set'](_0x070e('0x24'),_0x374c54+'-'+_0x1d72d6+'/'+_0x4763c6)[_0x070e('0x1f')](_0x5f3e9d);}return null;};}function saveUpdates(_0x3a16d0){return function(_0x56fc12){if(_0x56fc12){return _0x56fc12['update'](_0x3a16d0)[_0x070e('0x25')](function(_0x46065c){return _0x46065c;});}return null;};}function removeEntity(_0xa6c0ab){return function(_0x51402c){if(_0x51402c){return _0x51402c[_0x070e('0x26')]()[_0x070e('0x25')](function(){_0xa6c0ab[_0x070e('0x1d')](0xcc)[_0x070e('0x1e')]();});}};}function handleEntityNotFound(_0x53d473){return function(_0x5bf522){if(!_0x5bf522){_0x53d473['sendStatus'](0x194);}return _0x5bf522;};}function handleError(_0x59c5b4,_0xdf8945){_0xdf8945=_0xdf8945||0x1f4;return function(_0x4e0a7d){logger[_0x070e('0x19')](_0x4e0a7d[_0x070e('0x27')]);if(_0x4e0a7d['name']){delete _0x4e0a7d['name'];}_0x59c5b4[_0x070e('0x1d')](_0xdf8945)[_0x070e('0x28')](_0x4e0a7d);};}function getMustacheRender(_0x55288a,_0x546a16){return Mustache[_0x070e('0x29')](_0x55288a,_[_0x070e('0x2a')](_0x546a16[_0x070e('0x2b')],{'contact':_0x546a16[_0x070e('0x2c')],'message':_0x546a16[_0x070e('0x1a')],'agent':_0x546a16['agent'],'interaction':_0x546a16['interaction'],'account':_0x546a16[_0x070e('0x2d')]}))||'';}function getInteractionUsers(_0x3011c4,_0x4bb439){return new BPromise(function(_0xf57ed,_0xf11439){try{if(_0x4bb439[_0x3011c4['id']]){_0x3011c4['Users']=_[_0x070e('0x2e')](_0x4bb439[_0x3011c4['id']],function(_0x1927f4){return{'id':_0x1927f4['id'],'fullname':_0x1927f4['fullname']};});}}catch(_0x2d6bb6){_0xf11439(_0x2d6bb6);}_0xf57ed(_0x3011c4);});}function getInteractionTags(_0x34746e,_0x4ba6f0){return new BPromise(function(_0x4d4ee8,_0x5ddbe9){try{if(_0x34746e[_0x070e('0x2f')]){_0x34746e[_0x070e('0x30')]=[];_0x34746e[_0x070e('0x2f')][_0x070e('0x31')](',')[_0x070e('0x32')](function(_0x5e3827){_0x34746e[_0x070e('0x30')][_0x070e('0x33')](_0x4ba6f0[_0x5e3827]);});}delete _0x34746e[_0x070e('0x2f')];}catch(_0x487276){_0x5ddbe9(_0x487276);}_0x4d4ee8(_0x34746e);});}function updateChatInteraction(_0x268c5d,_0x72cbc7,_0x165c16){return new BPromise(function(_0x54b72f,_0x13982f){return getInteractionUsers(_0x268c5d,_0x165c16)[_0x070e('0x25')](function(_0x4800a9){return getInteractionTags(_0x4800a9,_0x72cbc7);})[_0x070e('0x25')](function(_0x5d689b){return getStateInteraction(_0x5d689b);})[_0x070e('0x25')](function(_0x146bf6){_0x54b72f(_0x146bf6);})[_0x070e('0x34')](function(_0x30319c){_0x13982f(_0x30319c);});});}function getStateInteraction(_0xd03404){return new BPromise(function(_0x47b929){_0xd03404[_0x070e('0x35')]=0x0;_0xd03404['talking']=0x0;_0xd03404['answered']=0x0;_0xd03404[_0x070e('0x36')]=0x0;_0xd03404[_0x070e('0x37')]=0x0;_0xd03404[_0x070e('0x38')]=0x0;if(!_0xd03404['closed']&&!_0xd03404[_0x070e('0x39')]){_0xd03404[_0x070e('0x35')]+=0x1;}if(!_0xd03404[_0x070e('0x3a')]&&_0xd03404[_0x070e('0x39')]){_0xd03404['talking']+=0x1;if(_0xd03404[_0x070e('0x35')]){_0xd03404['waiting']-=0x1;}}if(_0xd03404['closed']&&_0xd03404['disposition']===_0x070e('0x37')){_0xd03404[_0x070e('0x37')]+=0x1;if(_0xd03404[_0x070e('0x35')]){_0xd03404[_0x070e('0x35')]-=0x1;}}else if(_0xd03404[_0x070e('0x3a')]&&!_0xd03404['UserId']&&_0xd03404[_0x070e('0x3b')]){_0xd03404['unmanaged']+=0x1;if(_0xd03404[_0x070e('0x35')]){_0xd03404[_0x070e('0x35')]-=0x1;}}else if(_0xd03404[_0x070e('0x3a')]&&_0xd03404['UserId']){_0xd03404['answered']+=0x1;if(_0xd03404[_0x070e('0x3c')]){_0xd03404['talking']-=0x1;}}_0xd03404[_0x070e('0x38')]+=0x1;_0x47b929(_0xd03404);});}exports[_0x070e('0x3d')]=function(_0x139820,_0x5f5675){var _0x7c15f9={},_0x20a1ee={},_0x48d836={'count':0x0,'rows':[]};var _0x589b97=_[_0x070e('0x2e')](db[_0x070e('0x3e')][_0x070e('0x3f')],function(_0x1fc7c4){return{'name':_0x1fc7c4[_0x070e('0x40')],'type':_0x1fc7c4['type'][_0x070e('0x41')]};});_0x20a1ee[_0x070e('0x42')]=_[_0x070e('0x2e')](_0x589b97,_0x070e('0x43'));_0x20a1ee[_0x070e('0x44')]=_[_0x070e('0x45')](_0x139820[_0x070e('0x44')]);_0x20a1ee[_0x070e('0x46')]=_[_0x070e('0x47')](_0x20a1ee[_0x070e('0x42')],_0x20a1ee[_0x070e('0x44')]);_0x7c15f9[_0x070e('0x48')]=_[_0x070e('0x47')](_0x20a1ee[_0x070e('0x42')],qs[_0x070e('0x49')](_0x139820['query'][_0x070e('0x49')]));_0x7c15f9[_0x070e('0x48')]=_0x7c15f9[_0x070e('0x48')][_0x070e('0x4a')]?_0x7c15f9[_0x070e('0x48')]:_0x20a1ee[_0x070e('0x42')];if(!_0x139820[_0x070e('0x44')][_0x070e('0x4b')](_0x070e('0x4c'))){_0x7c15f9['limit']=qs[_0x070e('0x22')](_0x139820['query'][_0x070e('0x22')]);_0x7c15f9[_0x070e('0x20')]=qs['offset'](_0x139820[_0x070e('0x44')][_0x070e('0x20')]);}_0x7c15f9[_0x070e('0x4d')]=qs[_0x070e('0x4e')](_0x139820[_0x070e('0x44')][_0x070e('0x4e')]);_0x7c15f9[_0x070e('0x4f')]=qs['filters'](_[_0x070e('0x50')](_0x139820['query'],_0x20a1ee['filters']),_0x589b97);var _0x3a06c6=[];var _0x3d1b5e=squel[_0x070e('0x51')]()[_0x070e('0x52')]('id')[_0x070e('0x52')](_0x070e('0x43'))[_0x070e('0x52')](_0x070e('0x53'))['from'](_0x070e('0x54'));var _0x51d27d=squel['select']()[_0x070e('0x52')](_0x070e('0x55'))['field'](_0x070e('0x56'))[_0x070e('0x52')](_0x070e('0x57'))[_0x070e('0x58')](_0x070e('0x59'),'ui')[_0x070e('0x5a')](_0x070e('0x5b'),'u','u.id\x20=\x20ui.UserId');var _0x5874cd=squel['select']()[_0x070e('0x58')](_0x070e('0x5c'),'i')[_0x070e('0x5a')](_0x070e('0x5d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x070e('0x5a')]('users','o',_0x070e('0x5e'))[_0x070e('0x5a')](_0x070e('0x5f'),'a',_0x070e('0x60'))[_0x070e('0x5a')](_0x070e('0x61'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x070e('0x5a')](_0x070e('0x62'),'it',_0x070e('0x63'))['left_join'](_0x070e('0x54'),'t',_0x070e('0x64'));var _0x5cd534=squel[_0x070e('0x65')]();var _0x4e8dfc=[];var _0xc89f90=squel['expr']();var _0x4cb86f;if(_0x139820['query'][_0x070e('0x66')]){_0x4cb86f=as[_0x070e('0x67')](_0x139820[_0x070e('0x44')][_0x070e('0x66')]);var _0x3cb9ee=_0x4cb86f[_0x070e('0x68')];for(var _0x498bc6=0x0;_0x498bc6<_0x4cb86f[_0x070e('0x69')]['length'];_0x498bc6++){var _0xae78a4=_0x4cb86f['conditions'][_0x498bc6];var _0x2e10f7='i';var _0x34f410=_['find'](_0x589b97,[_0x070e('0x43'),_0xae78a4['field']]);if(!_0x34f410){switch(_0xae78a4[_0x070e('0x52')]){case _0x070e('0x6a'):if(_0xae78a4[_0x070e('0x6b')]==0x1){_0x5874cd[_0x070e('0x6c')]('`'+_0xae78a4[_0x070e('0x52')]+_0x070e('0x6d'));}else{_0x5874cd[_0x070e('0x6c')]('`'+_0xae78a4[_0x070e('0x52')]+_0x070e('0x6e'));}break;case _0x070e('0x6f'):if(_0xae78a4[_0x070e('0x70')]===_0x070e('0x71')){if(_0xae78a4[_0x070e('0x6b')][_0x070e('0x31')]('\x20')['length']>0x1){_0x5cd534[_0x3cb9ee](_0x070e('0x72'),qs[_0x070e('0x73')](_0xae78a4[_0x070e('0x6b')]),null);}else{var _0x93301a='%'+_0xae78a4['value']+'%';_0x5cd534[_0x3cb9ee](_0x070e('0x74'),_0x93301a,_0x93301a,_0x93301a);}}else{_0x34f410=_[_0x070e('0x75')](_0x589b97,[_0x070e('0x43'),_0x070e('0x76')]);_0xae78a4[_0x070e('0x52')]=_0x070e('0x76');_0x17cf15=as['buildExpression'](_0x2e10f7,_0x34f410[_0x070e('0x77')],_0xae78a4);_0x5cd534[_0x3cb9ee](_0x17cf15[_0x070e('0x78')],_0x17cf15[_0x070e('0x6b')][_0x070e('0x79')],_0x17cf15['value'][_0x070e('0x1e')]);}break;case'Tag':var _0x10d95d=_0xae78a4[_0x070e('0x6b')][_0x070e('0x31')](',')[_0x070e('0x2e')](function(_0x2a20d4){return Number(_0x2a20d4);});_0x10d95d['forEach'](function(_0x2e48f9){_0xc89f90['or'](_0x070e('0x7a'),'%,'+_0x2e48f9+',%');});_0x4e8dfc=_[_0x070e('0x7b')](_0x4e8dfc,_0x10d95d);break;case _0x070e('0x7c'):if(_0xae78a4['operator']===_0x070e('0x71')){_0x5cd534[_0x3cb9ee]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xae78a4[_0x070e('0x6b')]+'%',null);}else{_0x34f410=_[_0x070e('0x75')](_0x589b97,[_0x070e('0x43'),'UserId']);_0xae78a4[_0x070e('0x52')]='UserId';_0x17cf15=as[_0x070e('0x7d')](_0x2e10f7,_0x34f410['type'],_0xae78a4);_0x5cd534[_0x3cb9ee](_0x17cf15[_0x070e('0x78')],_0x17cf15[_0x070e('0x6b')]['start'],_0x17cf15[_0x070e('0x6b')]['end']);}break;case _0x070e('0x2b'):_0x17cf15=as[_0x070e('0x7d')]('me',null,_0xae78a4);_0x5cd534[_0x3cb9ee](_0x17cf15['text'],_0x17cf15['value'][_0x070e('0x79')],_0x17cf15[_0x070e('0x6b')][_0x070e('0x1e')]);break;}}else{var _0x17cf15=as[_0x070e('0x7d')](_0x2e10f7,_0x34f410[_0x070e('0x77')],_0xae78a4);_0x5cd534[_0x3cb9ee](_0x17cf15[_0x070e('0x78')],_0x17cf15[_0x070e('0x6b')][_0x070e('0x79')],_0x17cf15[_0x070e('0x6b')][_0x070e('0x1e')]);}}}else{var _0x25670e=_(_0x139820[_0x070e('0x44')])['keys']()[_0x070e('0x2e')](function(_0x549979){return _['some'](_0x589b97,['name',_0x549979])?_0x549979:undefined;})[_0x070e('0x7e')]()[_0x070e('0x6b')]();if(!_[_0x070e('0x7f')](_0x25670e)){_0x25670e[_0x070e('0x32')](function(_0x3b3e96){if(_0x3b3e96===_0x070e('0x80')){_0x5874cd[_0x070e('0x4f')](_0x070e('0x81'),[][_0x070e('0x82')](_0x139820[_0x070e('0x44')][_0x3b3e96]));}else if(_0x3b3e96===_0x070e('0x83')){var _0x2084a1=JSON[_0x070e('0x84')](_0x139820['query'][_0x3b3e96])['$gte'];var _0x5ee283=JSON[_0x070e('0x84')](_0x139820[_0x070e('0x44')][_0x3b3e96])[_0x070e('0x85')];_0x5874cd[_0x070e('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2084a1,_0x5ee283);}else{if(_0x139820[_0x070e('0x44')][_0x3b3e96]===_0x070e('0x86')){_0x5874cd[_0x070e('0x4f')]('i.'+_0x3b3e96+_0x070e('0x87'));}else{_0x5874cd[_0x070e('0x4f')]('i.'+_0x3b3e96+_0x070e('0x88'),_0x139820['query'][_0x3b3e96]);}}});}if(_0x139820[_0x070e('0x44')]['read']){if(_0x139820[_0x070e('0x44')][_0x070e('0x89')]==0x1){_0x5874cd[_0x070e('0x6c')](_0x070e('0x8a'));}else{_0x5874cd[_0x070e('0x6c')]('`unreadMessages`\x20>\x200');}}if(_0x139820[_0x070e('0x44')][_0x070e('0x8b')]){_0x4e8dfc=_['isArray'](_0x139820[_0x070e('0x44')][_0x070e('0x8b')])?_0x139820['query'][_0x070e('0x8b')]:new Array(_0x139820[_0x070e('0x44')][_0x070e('0x8b')]);_0x4e8dfc['forEach'](function(_0x40d7e6){_0xc89f90['or'](_0x070e('0x7a'),'%,'+_0x40d7e6+',%');});}if(_0x139820[_0x070e('0x44')][_0x070e('0x8c')]){var _0x2082a8=_0x139820[_0x070e('0x44')][_0x070e('0x8c')][_0x070e('0x8d')]('\x5c','\x5c\x5c')[_0x070e('0x8d')](/'/g,'\x27\x27');if(qs[_0x070e('0x8e')](_0x2082a8)){_0x5cd534['or'](_0x070e('0x8f'),_0x2082a8+'%');}else{_0x5cd534['or'](_0x070e('0x90'),qs[_0x070e('0x73')](_0x2082a8))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2082a8+'%');}}}_0x5874cd[_0x070e('0x4f')](_0x5cd534);_0x5874cd[_0x070e('0x91')](_0x070e('0x92'));var _0x1b71dd={'type':db[_0x070e('0x93')][_0x070e('0x94')]['SELECT'],'raw':!![]};var _0x55f135=_0x5874cd['clone']();_0x55f135[_0x070e('0x52')](_0x070e('0x92'));_0x55f135[_0x070e('0x52')](_0x070e('0x95'),'unreadMessages');if(_0x7c15f9[_0x070e('0x4d')]){_0x7c15f9[_0x070e('0x4d')][_0x070e('0x32')](function(_0x522685){var _0x9d81a9=_0x522685[0x0]==='contactName'?_0x522685[0x0]:'i.'+_0x522685[0x0];_0x5874cd[_0x070e('0x4d')](_0x9d81a9,_0x522685[0x1]===_0x070e('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x4e8dfc)){_0x5874cd['having'](_0xc89f90);_0x55f135[_0x070e('0x4f')](_0x070e('0x97'),_0x4e8dfc);}BPromise['resolve']()[_0x070e('0x25')](function(){if(!_0x4cb86f){if(_0x139820['query']['ChatWebsiteId'])return;_0x55f135['where'](_0x070e('0x98'));_0x5874cd[_0x070e('0x4f')](_0x070e('0x98'));return;}if(_0x139820[_0x070e('0x99')][_0x070e('0x9a')]!==_0x070e('0x9b'))return;return _0x139820[_0x070e('0x99')][_0x070e('0x9c')]({'attributes':['id'],'raw':!![]})[_0x070e('0x25')](function(_0xdcc60a){if(_[_0x070e('0x7f')](_0xdcc60a)){_0x55f135[_0x070e('0x4f')](_0x070e('0x9d'));_0x5874cd[_0x070e('0x4f')](_0x070e('0x9d'));}else{_0x55f135[_0x070e('0x4f')](_0x070e('0x81'),_[_0x070e('0x2e')](_0xdcc60a,'id'));_0x5874cd[_0x070e('0x4f')](_0x070e('0x81'),_[_0x070e('0x2e')](_0xdcc60a,'id'));}});})[_0x070e('0x25')](function(){if(_0x139820['user'][_0x070e('0x9a')]===_0x070e('0x9b')&&!_0x4cb86f&&!_0x139820[_0x070e('0x44')][_0x070e('0x80')])return[];return db['sequelize'][_0x070e('0x44')](_0x55f135[_0x070e('0x9e')](),_0x1b71dd);})[_0x070e('0x25')](function(_0x2bad43){_0x48d836[_0x070e('0x23')]=_0x2bad43[_0x070e('0x4a')];if(_0x48d836['count']===0x0)return[];return db['sequelize']['query'](_0x3d1b5e[_0x070e('0x9e')](),_0x1b71dd)['then'](function(_0x26e9c1){_0x3a06c6=_[_0x070e('0x9f')](_0x26e9c1,'id');_0x1b71dd=_['merge'](_0x1b71dd,{'model':db[_0x070e('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x139820[_0x070e('0x44')]['fields']){_0x7c15f9['attributes'][_0x070e('0x32')](function(_0x3ed849){_0x5874cd[_0x070e('0x52')]('i.'+_0x3ed849);});}else{_0x5874cd[_0x070e('0x52')](_0x070e('0x95'),'unreadMessages');_0x5874cd[_0x070e('0x52')]('a.key',_0x070e('0xa0'));_0x5874cd[_0x070e('0x52')]('a.mandatoryDisposition',_0x070e('0xa1'));_0x5874cd[_0x070e('0x52')](_0x070e('0xa2'),_0x070e('0xa3'));_0x5874cd[_0x070e('0x52')](_0x070e('0xa4'));_0x5874cd['field'](_0x070e('0xa5'),_0x070e('0xa6'));_0x5874cd[_0x070e('0x52')](_0x070e('0xa7'),_0x070e('0xa8'));_0x5874cd['field'](_0x070e('0xa9'),_0x070e('0xaa'));_0x5874cd[_0x070e('0x52')](_0x070e('0xab'),_0x070e('0xac'));_0x5874cd[_0x070e('0x52')](_0x070e('0xad'),_0x070e('0xae'));_0x5874cd[_0x070e('0x52')](_0x070e('0xaf'),_0x070e('0xb0'));_0x5874cd[_0x070e('0x52')](_0x070e('0xb1'),_0x070e('0xb2'));_0x5874cd[_0x070e('0x52')](_0x070e('0xb3'),'Owner.internal');_0x5874cd['field'](_0x070e('0xb4'),_0x070e('0x2f'));}if(_0x7c15f9['limit'])_0x5874cd['limit'](_0x7c15f9['limit']);if(_0x7c15f9['offset'])_0x5874cd[_0x070e('0x20')](_0x7c15f9[_0x070e('0x20')]);return db[_0x070e('0xb5')][_0x070e('0x44')](_0x5874cd[_0x070e('0x9e')](),_0x1b71dd);})[_0x070e('0x25')](function(_0x32cfe3){if(_0x32cfe3[_0x070e('0x4a')]>0x0)_0x51d27d[_0x070e('0x4f')](_0x070e('0xb6'),_['map'](_0x32cfe3,'id'));return db[_0x070e('0xb5')][_0x070e('0x44')](_0x51d27d['toString'](),_0x1b71dd)[_0x070e('0x25')](function(_0x2890ba){var _0x1bff76=_[_0x070e('0xb7')](_0x2890ba,'ChatInteractionId');var _0x2d46fb=[];_0x32cfe3[_0x070e('0x32')](function(_0x214bea){_0x2d46fb[_0x070e('0x33')](updateChatInteraction(_0x214bea,_0x3a06c6,_0x1bff76));});return BPromise['all'](_0x2d46fb);});});})[_0x070e('0x25')](function(_0x14a769){_0x48d836[_0x070e('0xb8')]=_0x14a769;return _0x48d836;})[_0x070e('0x25')](respondWithFilteredResult(_0x5f5675,_0x7c15f9))[_0x070e('0x34')](handleError(_0x5f5675,null));};exports[_0x070e('0xb9')]=function(_0x1a4ed1,_0xb2cca5){var _0x3d5862={'raw':![],'where':{'id':_0x1a4ed1[_0x070e('0xba')]['id']}},_0x1a41f2={};_0x1a41f2['model']=_[_0x070e('0x45')](db[_0x070e('0x3e')]['rawAttributes']);_0x1a41f2['query']=_[_0x070e('0x45')](_0x1a4ed1['query']);_0x1a41f2[_0x070e('0x46')]=_[_0x070e('0x47')](_0x1a41f2[_0x070e('0x42')],_0x1a41f2[_0x070e('0x44')]);_0x3d5862[_0x070e('0x48')]=_[_0x070e('0x47')](_0x1a41f2[_0x070e('0x42')],qs['fields'](_0x1a4ed1[_0x070e('0x44')][_0x070e('0x49')]));_0x3d5862[_0x070e('0x48')]=_0x3d5862[_0x070e('0x48')]['length']?_0x3d5862['attributes']:_0x1a41f2[_0x070e('0x42')];if(_0x1a4ed1[_0x070e('0x44')][_0x070e('0xbb')]){_0x3d5862['include']=[{'all':!![]}];}_0x3d5862=_[_0x070e('0x2a')]({},_0x3d5862,_0x1a4ed1[_0x070e('0xbc')]);return db['ChatInteraction'][_0x070e('0x75')](_0x3d5862)[_0x070e('0x25')](handleEntityNotFound(_0xb2cca5,null))[_0x070e('0x25')](respondWithResult(_0xb2cca5,null))[_0x070e('0x34')](handleError(_0xb2cca5,null));};exports[_0x070e('0xbd')]=function(_0x2bd6db,_0x56169b){return db['ChatInteraction'][_0x070e('0xbd')](_0x2bd6db['body'],{})[_0x070e('0x25')](respondWithResult(_0x56169b,0xc9))[_0x070e('0x34')](handleError(_0x56169b,null));};exports['update']=function(_0x377b8b,_0x4b80b9){if(_0x377b8b[_0x070e('0x2b')]['id']){delete _0x377b8b[_0x070e('0x2b')]['id'];}return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x377b8b[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x4b80b9,null))['then'](saveUpdates(_0x377b8b[_0x070e('0x2b')],null))[_0x070e('0x25')](respondWithResult(_0x4b80b9,null))['catch'](handleError(_0x4b80b9,null));};exports['destroy']=function(_0x46d778,_0x8e9b5c){return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x46d778[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x8e9b5c,null))[_0x070e('0x25')](removeEntity(_0x8e9b5c,null))[_0x070e('0x34')](handleError(_0x8e9b5c,null));};exports['describe']=function(_0x1deb2a,_0x9a1b90){return db[_0x070e('0x3e')][_0x070e('0xbe')]()[_0x070e('0x25')](respondWithResult(_0x9a1b90,null))[_0x070e('0x34')](handleError(_0x9a1b90,null));};exports[_0x070e('0xbf')]=function(_0x85163b,_0x522513){var _0x189c8e=_0x85163b[_0x070e('0xba')]['id'];var _0x40532a;var _0xbc61f2;var _0x119fab;return db[_0x070e('0x3e')][_0x070e('0xc0')]({'where':{'id':_0x189c8e}})[_0x070e('0x25')](function(_0x3d0cd2){_0x40532a=_0x3d0cd2;return db[_0x070e('0xc1')]['findOne']({'where':{'id':_0x3d0cd2['ChatWebsiteId']},'attributes':['id',_0x070e('0xc2'),_0x070e('0xc3'),_0x070e('0xc4'),'vidaooNote',_0x070e('0xc5')],'raw':!![]});})[_0x070e('0x25')](function(_0x5f00d0){if(_0x5f00d0&&_0x5f00d0[_0x070e('0xc2')]&&_0x5f00d0[_0x070e('0xc3')]){_0xbc61f2=_0x5f00d0;var _0x2f34b9={'interaction':{'id':_0x189c8e},'agent':{'id':_0x85163b[_0x070e('0x99')]['id'],'name':_0x85163b[_0x070e('0x99')][_0x070e('0x43')],'fullname':_0x85163b['user']['fullname'],'email':_0x85163b[_0x070e('0x99')][_0x070e('0xc6')]},'contact':_0x85163b['body'][_0x070e('0x2c')],'account':_0x85163b[_0x070e('0x2b')][_0x070e('0x2d')]};var _0x3853df={'rejectUnauthorized':![],'method':_0x070e('0xc7'),'url':_0x070e('0xc8'),'headers':{'X-APIKEY':_0x5f00d0['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x85163b[_0x070e('0x99')][_0x070e('0xc6')]],'buttons':null,'topic':_0xbc61f2['vidaooTopic'],'note':_[_0x070e('0xc9')](_0xbc61f2[_0x070e('0xca')])?null:getMustacheRender(_0xbc61f2[_0x070e('0xca')],_0x2f34b9),'metadata':null},'redirect':_0x070e('0xcb'),'json':!![]};try{if(!_['isNull'](_0xbc61f2['vidaooMetadata'])){var _0x2c2585=getMustacheRender(_0xbc61f2[_0x070e('0xc5')],_0x2f34b9);var _0x2ad143=JSON[_0x070e('0x84')](_0x2c2585);_0x3853df[_0x070e('0x2b')][_0x070e('0xcc')]=_0x2ad143;}}catch(_0x317f18){throw new db[(_0x070e('0x93'))][(_0x070e('0xcd'))](_0x070e('0xce'));}return rp(_0x3853df);}else{throw new db['Sequelize'][(_0x070e('0xcd'))](_0x070e('0xcf'));}})[_0x070e('0x25')](function(_0x205fc7){_0x119fab=_0x205fc7;if(_0x119fab['id']){var _0x49f3df={'body':_0x119fab[_0x070e('0xd0')],'ChatWebsiteId':_0xbc61f2['id'],'ChatInteractionId':_0x40532a['id'],'direction':_0x070e('0xd1'),'UserId':_0x85163b['user']['id']};return db['ChatMessage'][_0x070e('0xbd')](_0x49f3df,{});}else{throw new db[(_0x070e('0x93'))][(_0x070e('0xcd'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x070e('0x25')](function(){return _0x40532a[_0x070e('0xd2')]({'vidaooSessionId':_0x119fab['id']});})[_0x070e('0x25')](respondWithResult(_0x522513,null))[_0x070e('0x34')](handleError(_0x522513,null));};exports[_0x070e('0xd3')]=function(_0x5605da,_0x271bb9){if(_0x5605da[_0x070e('0x2b')]['id']){delete _0x5605da['body']['id'];}return db[_0x070e('0x3e')]['find']({'where':{'id':_0x5605da['params']['id']},'include':[{'model':db['CmContact'],'as':_0x070e('0x6f')}]})[_0x070e('0x25')](handleEntityNotFound(_0x271bb9,null))[_0x070e('0x25')](saveUpdates(_0x5605da[_0x070e('0x2b')],null))['then'](respondWithResult(_0x271bb9,null))[_0x070e('0x34')](handleError(_0x271bb9,null));};exports[_0x070e('0xd4')]=function(_0x500fa9,_0x3c6a6e){if(_0x500fa9[_0x070e('0x2b')]['id']){delete _0x500fa9[_0x070e('0x2b')]['id'];}return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x500fa9[_0x070e('0xba')]['id']}})['then'](function(_0x40ff1b){if(!_0x40ff1b){logger['error'](_0x070e('0xd5'),_0x070e('0xd4'),0x194,_0x070e('0xd6'));_0x3c6a6e['sendStatus'](0x194);}else{if(_0x40ff1b[_0x070e('0x39')]){throw new db[(_0x070e('0x93'))][(_0x070e('0xcd'))]('Interaction\x20already\x20assigned');}}return _0x40ff1b;})[_0x070e('0x25')](function(_0x3a5086){if(_0x3a5086){return _0x3a5086['update']({'closed':_0x500fa9[_0x070e('0x2b')][_0x070e('0x3a')],'disposition':_0x500fa9['body']['disposition']})['then'](function(_0x5e1fee){return _0x5e1fee;});}})[_0x070e('0x25')](function(){return respondWithRpcPromise(_0x070e('0xd7'),_0x070e('0xd4'),_0x500fa9[_0x070e('0x2b')],client9004);})[_0x070e('0x25')](respondWithResult(_0x3c6a6e,null))[_0x070e('0x34')](handleError(_0x3c6a6e,null));};exports[_0x070e('0xd8')]=function(_0x472fc9,_0x569425){_0x472fc9['body']['name']=_0x472fc9['file'][_0x070e('0xd9')];_0x472fc9[_0x070e('0x2b')][_0x070e('0xda')]=_0x472fc9[_0x070e('0xdb')][_0x070e('0xdc')];_0x472fc9['body']['type']=_0x472fc9[_0x070e('0xdb')][_0x070e('0xdd')];return db['Attachment'][_0x070e('0xbd')](_0x472fc9[_0x070e('0x2b')])[_0x070e('0x25')](respondWithResult(_0x569425,0xc9))[_0x070e('0x34')](handleError(_0x569425,null));};exports[_0x070e('0xde')]=function(_0x15b1f6,_0x5e71ab){return db[_0x070e('0x3e')][_0x070e('0xc0')]({'where':{'id':_0x15b1f6[_0x070e('0xba')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5e71ab,null))[_0x070e('0x25')](function(_0x1d721b){if(_0x1d721b){if(_0x1d721b[_0x070e('0x3a')]){return _0x5e71ab[_0x070e('0x1d')](0x193)['json']({'status':0x193,'message':_0x070e('0xdf')});}return db[_0x070e('0xe0')]['findOne']({'where':{'id':_0x15b1f6[_0x070e('0x44')][_0x070e('0xe1')]},'raw':!![]})['then'](handleEntityNotFound(_0x5e71ab,null));}})[_0x070e('0x25')](function(_0x4ff695){if(_0x4ff695){var _0x438384=_0x4ff695['ChatOfflineMessageId']!==null;var _0x1f9ef1=path['join'](config['root'],_0x070e('0xe2'));if(_0x438384){_0x1f9ef1=path['join'](_0x1f9ef1,'offline-chat/');}var _0x7966d4=path[_0x070e('0xe3')](_0x1f9ef1,_0x4ff695[_0x070e('0xda')]);return _0x5e71ab[_0x070e('0xe4')](_0x7966d4);}})[_0x070e('0x34')](handleError(_0x5e71ab,null));};exports['close']=function(_0x29e1f8,_0x1c084b){var _0x203989=null;var _0x32cd02=null;var _0x41a292=null;if(_0x29e1f8[_0x070e('0x2b')]['id']){delete _0x29e1f8['body']['id'];}if(_0x29e1f8[_0x070e('0x2b')][_0x070e('0xe5')]){_0x41a292=path[_0x070e('0xe3')](config[_0x070e('0xe6')],'server/files/chat/upload/',util['format'](_0x070e('0xe7'),Date[_0x070e('0xe8')]()));_0x29e1f8[_0x070e('0x2b')][_0x070e('0xe9')]=_0x41a292;}return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x29e1f8['params']['id']},'include':[{'model':db[_0x070e('0xea')],'as':_0x070e('0xeb'),'include':[{'model':db[_0x070e('0x7c')],'as':_0x070e('0x7c')}]}]})[_0x070e('0x25')](handleEntityNotFound(_0x1c084b,null))[_0x070e('0x25')](saveUpdates(_0x29e1f8['body'],null))['then'](function(_0x9b1fb1){if(_0x9b1fb1){_0x203989=_0x9b1fb1;return db[_0x070e('0xc1')][_0x070e('0x75')]({'where':{'id':_0x203989[_0x070e('0x80')]}});}})[_0x070e('0x25')](function(_0x167139){if(_0x167139){_0x32cd02=_0x167139;return db[_0x070e('0xec')]['find']({'where':{'id':_0x203989[_0x070e('0x76')]}});}})['then'](function(_0xfe12a6){if(_0xfe12a6){if(_0x41a292){var _0x5dc059=null;for(var _0x49ea24=0x1;_0x49ea24<_0x203989['Messages'][_0x070e('0x4a')];++_0x49ea24){_0x5dc059=_0x203989[_0x070e('0xeb')][_0x49ea24];var _0x396809=_0x5dc059[_0x070e('0x39')]?util[_0x070e('0xed')](_0x070e('0xee'),_0x32cd02[_0x070e('0xef')],_0x5dc059[_0x070e('0x39')]):_0x070e('0xf0');var _0x538bd4=_0x29e1f8[_0x070e('0x2b')][_0x070e('0xf1')]||util[_0x070e('0xed')](_0x070e('0xee'),_0x070e('0xf2'),_0x5dc059[_0x070e('0x76')]);switch(_0x32cd02[_0x070e('0xf3')]){case _0x070e('0xf4'):_0x396809=_0x5dc059[_0x070e('0x39')]?util['format']('%s%d',_0x32cd02[_0x070e('0xef')],_0x5dc059[_0x070e('0x39')]):'System';break;case _0x070e('0xf5'):_0x396809=_0x5dc059['UserId']?_0x5dc059['User'][_0x070e('0xf6')]||_0x5dc059[_0x070e('0x7c')]['fullname']:_0x070e('0xf0');break;case _0x070e('0xf7'):_0x396809=_0x5dc059[_0x070e('0x39')]?_0x5dc059['User']['fullname']:_0x070e('0xf0');break;default:_0x396809=_0x5dc059[_0x070e('0x39')]?util[_0x070e('0xed')]('%s%d',_0x32cd02[_0x070e('0xef')],_0x5dc059[_0x070e('0x39')]):'System';}var _0x12faf6=util[_0x070e('0xed')](_0x070e('0xf8'),moment(_0x5dc059[_0x070e('0x83')])[_0x070e('0xed')](_0x070e('0xf9')),_0x5dc059[_0x070e('0xfa')]==='in'?_0x538bd4:_0x396809,_0x5dc059[_0x070e('0x2b')]);if(!_0x5dc059[_0x070e('0xfb')]){fs[_0x070e('0xfc')](_0x41a292,_0x12faf6);}}return db[_0x070e('0xfd')][_0x070e('0xc0')]({'where':{'service':!![]},'include':[{'model':db[_0x070e('0xfe')],'as':_0x070e('0xff'),'raw':!![],'include':[{'model':db[_0x070e('0x100')],'as':_0x070e('0x100'),'raw':!![]}]}]});}}})[_0x070e('0x25')](function(_0x4ac2e7){if(!_0x4ac2e7||!_0x4ac2e7['Smtp']||!_0x29e1f8['body'])return _0x203989;var _0x52b206=_0x4ac2e7[_0x070e('0x101')]();return respondWithRpcPromise(_0x070e('0x102'),_0x070e('0x103'),{'account':_0x52b206,'message':{'from':util['format'](_0x070e('0x104'),_0x4ac2e7[_0x070e('0x43')],_0x4ac2e7[_0x070e('0xc6')]||_0x4ac2e7['Smtp'][_0x070e('0x99')]),'to':_0x29e1f8[_0x070e('0x2b')][_0x070e('0xe5')],'subject':_0x070e('0x105'),'text':util['format'](_0x070e('0x106'),_0x29e1f8[_0x070e('0x2b')][_0x070e('0xe5')]),'attachments':[{'path':_0x41a292}]}})['then'](function(){return _0x203989;})[_0x070e('0x34')](function(_0x417350){logger[_0x070e('0x19')](_0x417350);});})[_0x070e('0x25')](respondWithStatusCode(_0x1c084b,0xc8))[_0x070e('0x34')](handleError(_0x1c084b,null));};exports[_0x070e('0x107')]=function(_0x1a79b4,_0x3fb461){return db[_0x070e('0xea')]['find']({'where':{'id':_0x1a79b4['params']['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x3fb461,null))['then'](function(_0x4fc9db){if(_0x4fc9db){return _0x4fc9db[_0x070e('0x107')](_0x1a79b4[_0x070e('0x2b')][_0x070e('0x108')],_[_0x070e('0x109')](_0x1a79b4[_0x070e('0x2b')],[_0x070e('0x108'),'id'])||{});}})['then'](respondWithResult(_0x3fb461,null))[_0x070e('0x34')](handleError(_0x3fb461,null));};exports[_0x070e('0x10a')]=function(_0xcc4073,_0x351d73){var _0x5dbc81={'raw':![],'where':{}};var _0x22a256={};var _0x485788={'count':0x0,'rows':[]};return db[_0x070e('0x3e')][_0x070e('0xc0')]({'where':{'id':_0xcc4073[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x351d73,null))[_0x070e('0x25')](function(_0x23eb9c){if(_0x23eb9c){_0x22a256[_0x070e('0x42')]=_[_0x070e('0x45')](db[_0x070e('0xea')]['rawAttributes']);_0x22a256[_0x070e('0x44')]=_[_0x070e('0x45')](_0xcc4073[_0x070e('0x44')]);_0x22a256[_0x070e('0x46')]=_[_0x070e('0x47')](_0x22a256[_0x070e('0x42')],_0x22a256[_0x070e('0x44')]);_0x5dbc81[_0x070e('0x48')]=_['intersection'](_0x22a256[_0x070e('0x42')],qs[_0x070e('0x49')](_0xcc4073['query']['fields']));_0x5dbc81[_0x070e('0x48')]=_0x5dbc81[_0x070e('0x48')][_0x070e('0x4a')]?_0x5dbc81[_0x070e('0x48')]:_0x22a256[_0x070e('0x42')];if(!_0xcc4073[_0x070e('0x44')]['hasOwnProperty']('nolimit')){_0x5dbc81[_0x070e('0x22')]=qs[_0x070e('0x22')](_0xcc4073['query'][_0x070e('0x22')]);_0x5dbc81['offset']=qs[_0x070e('0x20')](_0xcc4073[_0x070e('0x44')]['offset']);}_0x5dbc81[_0x070e('0x4d')]=qs[_0x070e('0x4e')](_0xcc4073['query']['sort']);_0x5dbc81[_0x070e('0x4f')]=qs['filters'](_[_0x070e('0x50')](_0xcc4073[_0x070e('0x44')],_0x22a256[_0x070e('0x46')]));_0x5dbc81['where'][_0x070e('0x10b')]=_0x23eb9c['id'];if(_0xcc4073[_0x070e('0x44')]['filter']){_0x5dbc81[_0x070e('0x4f')]=_[_0x070e('0x2a')](_0x5dbc81[_0x070e('0x4f')],{'$or':_[_0x070e('0x2e')](_0x5dbc81[_0x070e('0x48')],function(_0x203ecb){var _0x65735f={};_0x65735f[_0x203ecb]={'$like':'%'+_0xcc4073[_0x070e('0x44')][_0x070e('0x8c')]+'%'};return _0x65735f;})});}if(_0xcc4073[_0x070e('0x44')]['$gte']){var _0x26e6ee=_0xcc4073[_0x070e('0x44')][_0x070e('0x10c')]['split'](',');var _0x595531={};_0x595531[_0x26e6ee[0x0]]={'$gte':moment(_0x26e6ee[0x1])[_0x070e('0xed')](_0x070e('0x10d'))};_0x5dbc81[_0x070e('0x4f')]=_[_0x070e('0x2a')](_0x5dbc81['where'],_0x595531);}_0x5dbc81=_[_0x070e('0x2a')]({},_0x5dbc81,_0xcc4073['options']);return db['ChatMessage'][_0x070e('0x23')]({'where':_0x5dbc81['where']})[_0x070e('0x25')](function(_0x3fff93){_0x485788[_0x070e('0x23')]=_0x3fff93;if(_0xcc4073[_0x070e('0x44')]['includeAll']){_0x5dbc81[_0x070e('0x10e')]=[{'all':!![]}];}return db['ChatMessage'][_0x070e('0x10f')](_0x5dbc81);})[_0x070e('0x25')](function(_0x45d6b6){_0x485788[_0x070e('0xb8')]=_0x45d6b6;return _0x485788;});}})[_0x070e('0x25')](respondWithFilteredResult(_0x351d73,_0x5dbc81))[_0x070e('0x34')](handleError(_0x351d73,null));};exports[_0x070e('0x110')]=function(_0x22f791,_0xa4fe4e){var _0xf8cfd={'where':{}},_0x428293={},_0xf0cc00={'count':0x0,'rows':[]};return db[_0x070e('0x3e')][_0x070e('0xc0')]({'where':{'id':_0x22f791[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0xa4fe4e,null))['then'](function(_0x48ea98){if(_0x48ea98){_0x428293[_0x070e('0x42')]=_[_0x070e('0x45')](db['ChatMessage'][_0x070e('0x3f')]);_0x428293[_0x070e('0x44')]=_['keys'](_0x22f791[_0x070e('0x44')]);_0x428293[_0x070e('0x46')]=_['intersection'](_0x428293[_0x070e('0x42')],_0x428293[_0x070e('0x44')]);_0xf8cfd[_0x070e('0x48')]=_[_0x070e('0x47')](_0x428293[_0x070e('0x42')],qs[_0x070e('0x49')](_0x22f791['query'][_0x070e('0x49')]));_0xf8cfd[_0x070e('0x48')]=_0xf8cfd[_0x070e('0x48')]['length']?_0xf8cfd[_0x070e('0x48')]:_0x428293[_0x070e('0x42')];if(!_0x22f791[_0x070e('0x44')][_0x070e('0x4b')]('nolimit')){_0xf8cfd['limit']=qs[_0x070e('0x22')](_0x22f791[_0x070e('0x44')][_0x070e('0x22')]);_0xf8cfd[_0x070e('0x20')]=qs[_0x070e('0x20')](_0x22f791[_0x070e('0x44')][_0x070e('0x20')]);}_0xf8cfd['order']=qs[_0x070e('0x4e')](_0x22f791[_0x070e('0x44')][_0x070e('0x4e')]);_0xf8cfd[_0x070e('0x4f')]=qs[_0x070e('0x46')](_[_0x070e('0x50')](_0x22f791[_0x070e('0x44')],_0x428293[_0x070e('0x46')]));_0xf8cfd[_0x070e('0x4f')][_0x070e('0x10b')]=_0x48ea98['id'];if(_0x22f791[_0x070e('0x44')][_0x070e('0x8c')]){_0xf8cfd[_0x070e('0x4f')]=_[_0x070e('0x2a')](_0xf8cfd[_0x070e('0x4f')],{'$or':_['map'](_0xf8cfd[_0x070e('0x48')],function(_0x101719){var _0x36ab4a={};_0x36ab4a[_0x101719]={'$like':'%'+_0x22f791[_0x070e('0x44')][_0x070e('0x8c')]+'%'};return _0x36ab4a;})});}_0xf8cfd[_0x070e('0x4f')][_0x070e('0xfb')]=![];if(_0x22f791['query']['id']){_0xf8cfd[_0x070e('0x4f')]['id']={'$gt':_0x22f791[_0x070e('0x44')]['id']};}_0xf8cfd=_[_0x070e('0x2a')]({},_0xf8cfd,_0x22f791[_0x070e('0xbc')]);return db[_0x070e('0xea')][_0x070e('0x23')]({'where':_0xf8cfd[_0x070e('0x4f')]})[_0x070e('0x25')](function(_0x45735c){_0xf0cc00['count']=_0x45735c;_0xf8cfd[_0x070e('0x10e')]=[];if(_0x22f791[_0x070e('0x44')][_0x070e('0x111')]){_0xf8cfd[_0x070e('0x10e')][_0x070e('0x33')]({'model':db[_0x070e('0x7c')],'as':_0x070e('0x7c'),'attributes':['id',_0x070e('0x112'),_0x070e('0xf6')]});}if(_0x22f791[_0x070e('0x44')][_0x070e('0xbb')]){_0xf8cfd[_0x070e('0x10e')]=[{'all':!![]}];}return db[_0x070e('0xea')][_0x070e('0x10f')](_0xf8cfd);})[_0x070e('0x25')](function(_0x2b8a76){_0xf0cc00[_0x070e('0xb8')]=_0x2b8a76;return _0xf0cc00;});}})[_0x070e('0x25')](respondWithFilteredResult(_0xa4fe4e,_0xf8cfd))[_0x070e('0x34')](handleError(_0xa4fe4e,null));};exports[_0x070e('0x113')]=function(_0x4208c3,_0x257350){return db['ChatInteraction'][_0x070e('0x75')]({'where':{'id':_0x4208c3[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x257350,null))[_0x070e('0x25')](function(_0x50ec71){if(_0x50ec71){return _0x50ec71[_0x070e('0x114')](_0x4208c3['body'][_0x070e('0x108')],_['omit'](_0x4208c3['body'],[_0x070e('0x108'),'id'])||{})[_0x070e('0x115')](function(){return db[_0x070e('0x116')]['findAll']({'attributes':['id',_0x070e('0x43'),'color'],'where':{'id':_0x4208c3[_0x070e('0x2b')][_0x070e('0x108')]}});})['then'](function(_0x17a593){socket['emit'](_0x070e('0x117'),{'id':Number(_0x4208c3[_0x070e('0xba')]['id']),'tags':_0x17a593||[]});return{'id':Number(_0x4208c3[_0x070e('0xba')]['id']),'tags':_0x17a593||[]};});}})['then'](respondWithResult(_0x257350,null))['catch'](handleError(_0x257350,null));};exports[_0x070e('0x118')]=function(_0x4bed29,_0x3235f6){return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x4bed29[_0x070e('0xba')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x3235f6,null))[_0x070e('0x25')](function(_0x4aaf0f){if(_0x4aaf0f){return _0x4aaf0f['removeTags'](_0x4bed29[_0x070e('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x3235f6,null))[_0x070e('0x34')](handleError(_0x3235f6,null));};exports[_0x070e('0xe4')]=function(_0x3c8b7d,_0x5ddf05){var _0x241d86=moment()[_0x070e('0x119')]()[_0x070e('0x9e')]();var _0x4dfac3=path['join'](config[_0x070e('0xe6')],_0x070e('0x11a'),_0x070e('0x11b'),'tmp');var _0xc0e641=path['join'](config[_0x070e('0xe6')],'server',_0x070e('0x11b'),_0x070e('0x11c'));var _0x530311=path[_0x070e('0xe3')](_0x4dfac3,_0x241d86);var _0x30fa55=util[_0x070e('0xed')](_0x070e('0x11d'),_0x3c8b7d[_0x070e('0xba')]['id'],_0x241d86);var _0xd6529a=path[_0x070e('0xe3')](_0x4dfac3,_0x30fa55);var _0x1584d2=[];_0x1584d2[_0x070e('0x33')]({'model':db[_0x070e('0x7c')],'as':_0x070e('0x7c'),'attributes':['id',_0x070e('0x112')],'raw':!![]});_0x1584d2[_0x070e('0x33')]({'model':db['CmContact'],'as':_0x070e('0x6f'),'attributes':['id',_0x070e('0x11e'),_0x070e('0x11f')],'raw':!![]});if(_0x3c8b7d['query']['attachments']){_0x1584d2[_0x070e('0x33')]({'model':db[_0x070e('0xe0')],'as':'Attachment','raw':!![]});}var _0x134ca4=[{'model':db[_0x070e('0xea')],'as':_0x070e('0xeb'),'attributes':['id','body',_0x070e('0x83'),'direction',_0x070e('0xfb'),_0x070e('0x89')],'include':_0x1584d2}];_0x134ca4['push']({'model':db[_0x070e('0xc1')],'as':_0x070e('0x120'),'attributes':['id',_0x070e('0x43')]});_0x134ca4[_0x070e('0x33')]({'model':db[_0x070e('0x7c')],'as':_0x070e('0x121'),'attributes':['id',_0x070e('0x112')]});return db[_0x070e('0x3e')][_0x070e('0x75')]({'where':{'id':_0x3c8b7d['params']['id']},'include':_0x134ca4})[_0x070e('0x25')](handleEntityNotFound(_0x5ddf05,null))[_0x070e('0x25')](function(_0x39ac44){if(_0x39ac44){var _0x30b0d9=_0x39ac44['get']({'plain':!![]});fs['mkdirSync'](_0x530311);var _0x5442c4={'channel':_0x070e('0x122'),'account':_0x30b0d9['Account'][_0x070e('0x43')],'agent':_0x30b0d9[_0x070e('0x121')]?_0x30b0d9['Owner'][_0x070e('0x112')]:'N.A.','createdAt':moment(_0x30b0d9['createdAt'])[_0x070e('0xed')](_0x070e('0x10d'))[_0x070e('0x9e')](),'closedAt':_0x30b0d9[_0x070e('0x3a')]?moment(_0x30b0d9[_0x070e('0x123')])[_0x070e('0xed')](_0x070e('0x10d'))[_0x070e('0x9e')]():'','disposition':_0x30b0d9[_0x070e('0x3b')],'chatInfo':{'browser':_0x30b0d9[_0x070e('0x124')],'os':_0x30b0d9[_0x070e('0x125')],'referer':_0x30b0d9[_0x070e('0x126')],'customerIp':_0x30b0d9['customerIp'],'customerPort':_0x30b0d9[_0x070e('0x127')]?_0x30b0d9[_0x070e('0x127')]:_0x070e('0x128')},'messages':_(_0x30b0d9[_0x070e('0xeb')])[_0x070e('0x129')]()[_0x070e('0x8c')]({'secret':![]})['map'](function(_0x58440f){if(_0x58440f['Attachment']){var _0x5c050f=path[_0x070e('0xe3')](_0xc0e641,_0x58440f[_0x070e('0xe0')]['basename']);if(fs[_0x070e('0x12a')](_0x5c050f)){fs[_0x070e('0x12b')](_0x5c050f)['pipe'](fs['createWriteStream'](path[_0x070e('0xe3')](_0x530311,_0x58440f['Attachment'][_0x070e('0xda')])));}}return{'date':moment(_0x58440f[_0x070e('0x83')])[_0x070e('0xed')](_0x070e('0x10d'))[_0x070e('0x9e')](),'sender':_0x58440f[_0x070e('0xfa')]==='out'?_0x58440f[_0x070e('0x7c')]?_0x58440f[_0x070e('0x7c')][_0x070e('0x112')]:'System':_0x58440f[_0x070e('0x6f')]['firstName']+(_0x58440f['Contact'][_0x070e('0x11f')]?'\x20'+_0x58440f['Contact'][_0x070e('0x11f')]:''),'body':_0x58440f['Attachment']?_0x58440f[_0x070e('0xe0')][_0x070e('0xda')]:_0x58440f['body'],'direction':_0x58440f[_0x070e('0xfa')]===_0x070e('0xd1')?'A':'C','secret':_0x58440f[_0x070e('0xfb')],'read':_0x58440f[_0x070e('0x89')],'attachment':_0x58440f[_0x070e('0xe0')]};})[_0x070e('0x6b')]()};return ejs[_0x070e('0x12c')](path[_0x070e('0xe3')](config[_0x070e('0xe6')],_0x070e('0x11a'),'views',_0x070e('0x12d')),{'interaction':_0x5442c4})['then'](function(_0x1b49ef){var _0x8d52b9=path['join'](_0x530311,_0x070e('0x12e')+_0x30b0d9['id']+'-'+_0x241d86+'.pdf');var _0x47257a={'path':_0x8d52b9,'channel':'Chat','interactionId':_0x30b0d9['id']};return pdf[_0x070e('0x12f')](_0x1b49ef,_0x47257a);})[_0x070e('0x25')](function(){return new Promise(function(_0x59ecf8,_0x189bef){zipdir(_0x530311,{'saveTo':_0xd6529a},function(_0xe831e0,_0x2f4102){if(_0xe831e0)return _0x189bef(_0xe831e0);return _0x59ecf8(_0x2f4102);});})[_0x070e('0x25')](function(){return new BPromise(function(_0x12e363,_0x5cbcf6){rimraf(_0x530311,function(_0x423464){if(_0x423464)_0x5cbcf6(_0x423464);return _0x12e363();});});})['then'](function(){return _0x5ddf05['download'](_0xd6529a,_0x30fa55,function(_0x442bdc){if(_0x442bdc){logger['error']('err',_0x442bdc);}else{fs[_0x070e('0x130')](_0xd6529a);}});});});}else{return _0x5ddf05['sendStatus'](0xc8);}})[_0x070e('0x34')](handleError(_0x5ddf05,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c49333a..03287b6 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 _0x6d3c=['unreadMessages','emit','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers','then','map','setDataValue'];(function(_0x1d2ef2,_0x1a7599){var _0x345183=function(_0x21384d){while(--_0x21384d){_0x1d2ef2['push'](_0x1d2ef2['shift']());}};_0x345183(++_0x1a7599);}(_0x6d3c,0x17d));var _0xc6d3=function(_0x53c018,_0x1665b4){_0x53c018=_0x53c018-0x0;var _0x2c28a8=_0x6d3c[_0x53c018];return _0x2c28a8;};'use strict';var EventEmitter=require(_0xc6d3('0x0'));var ChatInteraction=require(_0xc6d3('0x1'))['db'][_0xc6d3('0x2')];var ChatMessage=require(_0xc6d3('0x1'))['db'][_0xc6d3('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc6d3('0x4')](0x0);var events={'afterCreate':_0xc6d3('0x5'),'afterUpdate':_0xc6d3('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4a097b){return function(_0x1f534b,_0x13360f,_0xd95b22){_0x1f534b[_0xc6d3('0x7')]({'attributes':['id'],'raw':!![]})[_0xc6d3('0x8')](function(_0x205404){_0x1f534b['setDataValue']('Users',_0x205404[_0xc6d3('0x9')](function(_0x3fb08d){return{'id':_0x3fb08d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1f534b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc6d3('0x8')](function(_0x4b8296){_0x1f534b[_0xc6d3('0xa')](_0xc6d3('0xb'),_0x4b8296['length']);ChatInteractionEvents[_0xc6d3('0xc')](_0x4a097b+':'+_0x1f534b['id'],_0x1f534b);ChatInteractionEvents[_0xc6d3('0xc')](_0x4a097b,_0x1f534b);_0xd95b22(null);})['catch'](_0xd95b22(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xc6d3('0xd')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x106e=['then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','getUsers'];(function(_0x4edd4c,_0x111815){var _0x565723=function(_0x1ae02b){while(--_0x1ae02b){_0x4edd4c['push'](_0x4edd4c['shift']());}};_0x565723(++_0x111815);}(_0x106e,0xc9));var _0xe106=function(_0x5d2943,_0x107d32){_0x5d2943=_0x5d2943-0x0;var _0x4b1ec8=_0x106e[_0x5d2943];return _0x4b1ec8;};'use strict';var EventEmitter=require(_0xe106('0x0'));var ChatInteraction=require(_0xe106('0x1'))['db'][_0xe106('0x2')];var ChatMessage=require(_0xe106('0x1'))['db'][_0xe106('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe106('0x4')](0x0);var events={'afterCreate':_0xe106('0x5'),'afterUpdate':_0xe106('0x6'),'afterDestroy':'remove'};function emitEvent(_0x24b9e8){return function(_0x118985,_0x434462,_0x271405){_0x118985[_0xe106('0x7')]({'attributes':['id'],'raw':!![]})[_0xe106('0x8')](function(_0x46dd59){_0x118985[_0xe106('0x9')]('Users',_0x46dd59[_0xe106('0xa')](function(_0x48166c){return{'id':_0x48166c['id']};}));return ChatMessage[_0xe106('0xb')]({'where':{'ChatInteractionId':_0x118985['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe106('0x8')](function(_0x10f1f1){_0x118985['setDataValue'](_0xe106('0xc'),_0x10f1f1[_0xe106('0xd')]);ChatInteractionEvents[_0xe106('0xe')](_0x24b9e8+':'+_0x118985['id'],_0x118985);ChatInteractionEvents['emit'](_0x24b9e8,_0x118985);_0x271405(null);})[_0xe106('0xf')](_0x271405(null));};}for(var e in events){if(events[_0xe106('0x10')](e)){var event=events[e];ChatInteraction[_0xe106('0x11')](e,emitEvent(event));}}module[_0xe106('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2c5172d..52691aa 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 _0x0be9=['request-promise','path','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird'];(function(_0x175342,_0x57e790){var _0x1477a8=function(_0x3f6b55){while(--_0x3f6b55){_0x175342['push'](_0x175342['shift']());}};_0x1477a8(++_0x57e790);}(_0x0be9,0x192));var _0x90be=function(_0x15ac74,_0x35fac9){_0x15ac74=_0x15ac74-0x0;var _0xcc16c8=_0x0be9[_0x15ac74];return _0xcc16c8;};'use strict';var _=require(_0x90be('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x90be('0x1'));var moment=require(_0x90be('0x2'));var BPromise=require(_0x90be('0x3'));var rp=require(_0x90be('0x4'));var fs=require('fs');var path=require(_0x90be('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x90be('0x6'));module[_0x90be('0x7')]=function(_0x176744,_0x4e23eb){return _0x176744[_0x90be('0x8')](_0x90be('0x9'),attributes,{'tableName':_0x90be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x624bd6,_0x173a5f,_0x3a900e){if(_0x624bd6[_0x90be('0xb')]('closed')){_0x624bd6['closedAt']=moment()[_0x90be('0xc')](_0x90be('0xd'));}_0x3a900e(null,_0x624bd6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e75=['define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x277dd6,_0x2b3ca8){var _0x18c43f=function(_0x25c61d){while(--_0x25c61d){_0x277dd6['push'](_0x277dd6['shift']());}};_0x18c43f(++_0x2b3ca8);}(_0x0e75,0x1d7));var _0x50e7=function(_0x7b3e4d,_0x571e16){_0x7b3e4d=_0x7b3e4d-0x0;var _0x3bc2ab=_0x0e75[_0x7b3e4d];return _0x3bc2ab;};'use strict';var _=require('lodash');var util=require(_0x50e7('0x0'));var logger=require('../../config/logger')(_0x50e7('0x1'));var moment=require(_0x50e7('0x2'));var BPromise=require(_0x50e7('0x3'));var rp=require(_0x50e7('0x4'));var fs=require('fs');var path=require(_0x50e7('0x5'));var rimraf=require(_0x50e7('0x6'));var config=require(_0x50e7('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x50e7('0x8')]=function(_0x329ced,_0x4d9557){return _0x329ced[_0x50e7('0x9')](_0x50e7('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x405751,_0x4edcef,_0x5823eb){if(_0x405751[_0x50e7('0xb')]('closed')){_0x405751[_0x50e7('0xc')]=moment()[_0x50e7('0xd')](_0x50e7('0xe'));}_0x5823eb(null,_0x405751);}},'charset':_0x50e7('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3e01914..f9539dc 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 _0xbd4b=['jayson/promise','client','redis','localhost','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','body','options','raw','where','attributes','limit','info','debug','AddTagsToChatInteraction','ChatInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x236a51,_0x5e22e5){var _0x47297b=function(_0x447752){while(--_0x447752){_0x236a51['push'](_0x236a51['shift']());}};_0x47297b(++_0x5e22e5);}(_0xbd4b,0xc3));var _0xbbd4=function(_0x11ef8e,_0x440753){_0x11ef8e=_0x11ef8e-0x0;var _0x26b0f9=_0xbd4b[_0x11ef8e];return _0x26b0f9;};'use strict';var _=require(_0xbbd4('0x0'));var util=require(_0xbbd4('0x1'));var moment=require(_0xbbd4('0x2'));var BPromise=require(_0xbbd4('0x3'));var rs=require(_0xbbd4('0x4'));var fs=require('fs');var Redis=require(_0xbbd4('0x5'));var db=require(_0xbbd4('0x6'))['db'];var utils=require(_0xbbd4('0x7'));var logger=require(_0xbbd4('0x8'))('rpc');var config=require(_0xbbd4('0x9'));var jayson=require(_0xbbd4('0xa'));var client=jayson[_0xbbd4('0xb')]['http']({'port':0x232a});config[_0xbbd4('0xc')]=_['defaults'](config['redis'],{'host':_0xbbd4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbbd4('0xe'))['register'](socket);function respondWithRpcPromise(_0x4264c1,_0x202b0e,_0x5d9da1){return new BPromise(function(_0x5c8caf,_0x4080a7){return client[_0xbbd4('0xf')](_0x4264c1,_0x5d9da1)[_0xbbd4('0x10')](function(_0x293c0a){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x202b0e,'request\x20sent');logger['debug'](_0xbbd4('0x11'),_0x202b0e,_0xbbd4('0x12'),JSON[_0xbbd4('0x13')](_0x293c0a));if(_0x293c0a[_0xbbd4('0x14')]){if(_0x293c0a[_0xbbd4('0x14')]['code']===0x1f4){logger[_0xbbd4('0x14')](_0xbbd4('0x15'),_0x202b0e,_0x293c0a[_0xbbd4('0x14')]['message']);return _0x4080a7(_0x293c0a[_0xbbd4('0x14')][_0xbbd4('0x16')]);}logger[_0xbbd4('0x14')](_0xbbd4('0x15'),_0x202b0e,_0x293c0a['error'][_0xbbd4('0x16')]);return _0x5c8caf(_0x293c0a['error'][_0xbbd4('0x16')]);}else{logger['info'](_0xbbd4('0x15'),_0x202b0e,_0xbbd4('0x12'));_0x5c8caf(_0x293c0a[_0xbbd4('0x17')][_0xbbd4('0x16')]);}})[_0xbbd4('0x18')](function(_0x4988d0){logger[_0xbbd4('0x14')](_0xbbd4('0x15'),_0x202b0e,_0x4988d0);_0x4080a7(_0x4988d0);});});}exports[_0xbbd4('0x19')]=function(_0x347608){var _0x410e2e=this;return new Promise(function(_0xf5a45a,_0x2db769){return db['ChatInteraction']['update'](_0x347608[_0xbbd4('0x1a')],{'raw':_0x347608[_0xbbd4('0x1b')]?_0x347608[_0xbbd4('0x1b')][_0xbbd4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347608[_0xbbd4('0x1b')]?_0x347608[_0xbbd4('0x1b')][_0xbbd4('0x1d')]||null:null,'attributes':_0x347608[_0xbbd4('0x1b')]?_0x347608[_0xbbd4('0x1b')][_0xbbd4('0x1e')]||null:null,'limit':_0x347608['options']?_0x347608[_0xbbd4('0x1b')][_0xbbd4('0x1f')]||null:null})[_0xbbd4('0x10')](function(_0x71ee44){logger[_0xbbd4('0x20')](_0xbbd4('0x19'),_0x347608);logger[_0xbbd4('0x21')](_0xbbd4('0x19'),_0x347608,JSON[_0xbbd4('0x13')](_0x71ee44));_0xf5a45a(_0x71ee44);})['catch'](function(_0xcb9241){logger[_0xbbd4('0x14')]('UpdateChatInteraction',_0xcb9241[_0xbbd4('0x16')],_0x347608);_0x2db769(_0x410e2e['error'](0x1f4,_0xcb9241[_0xbbd4('0x16')]));});});};exports[_0xbbd4('0x22')]=function(_0x5ddd61){return new Promise(function(_0xcfc1f5,_0x2957b9){return db[_0xbbd4('0x23')][_0xbbd4('0x24')]({'where':_0x5ddd61[_0xbbd4('0x1b')]?_0x5ddd61[_0xbbd4('0x1b')]['where']||null:null})[_0xbbd4('0x10')](function(_0x1ae3bc){if(_0x1ae3bc){return _0x1ae3bc['addTags'](_0x5ddd61[_0xbbd4('0x1a')][_0xbbd4('0x25')],_[_0xbbd4('0x26')](_0x5ddd61[_0xbbd4('0x1a')],[_0xbbd4('0x25'),'id'])||{});}})[_0xbbd4('0x27')](function(_0x10fab9){logger['info']('AddTags',_0x5ddd61);logger['debug'](_0xbbd4('0x28'),_0x5ddd61,JSON[_0xbbd4('0x13')](_0x10fab9));_0xcfc1f5(_0x10fab9);})[_0xbbd4('0x18')](function(_0x4d6421){logger[_0xbbd4('0x14')](_0xbbd4('0x28'),_0x4d6421['message'],_0x5ddd61);_0x2957b9(_this['error'](0x1f4,_0x4d6421['message']));});});}; \ No newline at end of file +var _0x97c6=['defaults','localhost','socket.io-emitter','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','options','raw','where','attributes','stringify','AddTagsToChatInteraction','then','body','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x97c6,0x8c));var _0x697c=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x97c6[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require(_0x697c('0x0'));var util=require(_0x697c('0x1'));var moment=require(_0x697c('0x2'));var BPromise=require(_0x697c('0x3'));var rs=require(_0x697c('0x4'));var fs=require('fs');var Redis=require(_0x697c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x697c('0x6'))(_0x697c('0x7'));var config=require(_0x697c('0x8'));var jayson=require(_0x697c('0x9'));var client=jayson['client'][_0x697c('0xa')]({'port':0x232a});config[_0x697c('0xb')]=_[_0x697c('0xc')](config[_0x697c('0xb')],{'host':_0x697c('0xd'),'port':0x18eb});var socket=require(_0x697c('0xe'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x32ba74,_0x3207d8,_0x19a005){return new BPromise(function(_0x3603f0,_0x1b753e){return client['request'](_0x32ba74,_0x19a005)['then'](function(_0x5888b7){logger['info'](_0x697c('0xf'),_0x3207d8,_0x697c('0x10'));logger[_0x697c('0x11')](_0x697c('0x12'),_0x3207d8,_0x697c('0x10'),JSON['stringify'](_0x5888b7));if(_0x5888b7[_0x697c('0x13')]){if(_0x5888b7[_0x697c('0x13')][_0x697c('0x14')]===0x1f4){logger[_0x697c('0x13')](_0x697c('0xf'),_0x3207d8,_0x5888b7[_0x697c('0x13')][_0x697c('0x15')]);return _0x1b753e(_0x5888b7[_0x697c('0x13')]['message']);}logger[_0x697c('0x13')](_0x697c('0xf'),_0x3207d8,_0x5888b7['error'][_0x697c('0x15')]);return _0x3603f0(_0x5888b7[_0x697c('0x13')]['message']);}else{logger[_0x697c('0x16')](_0x697c('0xf'),_0x3207d8,'request\x20sent');_0x3603f0(_0x5888b7[_0x697c('0x17')]['message']);}})['catch'](function(_0x3ff013){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3207d8,_0x3ff013);_0x1b753e(_0x3ff013);});});}exports[_0x697c('0x18')]=function(_0x41de91){var _0x135412=this;return new Promise(function(_0x5bdee0,_0x102bf9){return db[_0x697c('0x19')]['update'](_0x41de91['body'],{'raw':_0x41de91[_0x697c('0x1a')]?_0x41de91[_0x697c('0x1a')][_0x697c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41de91[_0x697c('0x1a')]?_0x41de91[_0x697c('0x1a')][_0x697c('0x1c')]||null:null,'attributes':_0x41de91['options']?_0x41de91[_0x697c('0x1a')][_0x697c('0x1d')]||null:null,'limit':_0x41de91[_0x697c('0x1a')]?_0x41de91[_0x697c('0x1a')]['limit']||null:null})['then'](function(_0x4c82c0){logger['info'](_0x697c('0x18'),_0x41de91);logger[_0x697c('0x11')]('UpdateChatInteraction',_0x41de91,JSON[_0x697c('0x1e')](_0x4c82c0));_0x5bdee0(_0x4c82c0);})['catch'](function(_0xe82ada){logger['error'](_0x697c('0x18'),_0xe82ada[_0x697c('0x15')],_0x41de91);_0x102bf9(_0x135412[_0x697c('0x13')](0x1f4,_0xe82ada[_0x697c('0x15')]));});});};exports[_0x697c('0x1f')]=function(_0x575153){return new Promise(function(_0xe99447,_0x4f949e){return db[_0x697c('0x19')]['find']({'where':_0x575153[_0x697c('0x1a')]?_0x575153[_0x697c('0x1a')][_0x697c('0x1c')]||null:null})[_0x697c('0x20')](function(_0xffd47c){if(_0xffd47c){return _0xffd47c['addTags'](_0x575153[_0x697c('0x21')][_0x697c('0x22')],_['omit'](_0x575153[_0x697c('0x21')],[_0x697c('0x22'),'id'])||{});}})[_0x697c('0x23')](function(_0xa7cc6d){logger['info'](_0x697c('0x24'),_0x575153);logger[_0x697c('0x11')](_0x697c('0x24'),_0x575153,JSON[_0x697c('0x1e')](_0xa7cc6d));_0xe99447(_0xa7cc6d);})[_0x697c('0x25')](function(_0xc0bf08){logger[_0x697c('0x13')](_0x697c('0x24'),_0xc0bf08[_0x697c('0x15')],_0x575153);_0x4f949e(_this[_0x697c('0x13')](0x1f4,_0xc0bf08[_0x697c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 457e986..39f6f12 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 _0x5458=['emit','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x5458,0x14c));var _0x8545=function(_0x459ff5,_0x112d74){_0x459ff5=_0x459ff5-0x0;var _0x1ac7cb=_0x5458[_0x459ff5];return _0x1ac7cb;};'use strict';var ChatInteractionEvents=require(_0x8545('0x0'));var events=[_0x8545('0x1'),_0x8545('0x2'),_0x8545('0x3')];function createListener(_0x111138,_0xc26b13){return function(_0x1d63e7){_0xc26b13[_0x8545('0x4')](_0x111138,_0x1d63e7);};}function removeListener(_0x23fa8e,_0x5bae96){return function(){ChatInteractionEvents['removeListener'](_0x23fa8e,_0x5bae96);};}exports[_0x8545('0x5')]=function(_0x1811e7){for(var _0x2a6150=0x0,_0x597cc1=events[_0x8545('0x6')];_0x2a6150<_0x597cc1;_0x2a6150++){var _0x474b92=events[_0x2a6150];var _0x3e1cd0=createListener(_0x8545('0x7')+_0x474b92,_0x1811e7);ChatInteractionEvents['on'](_0x474b92,_0x3e1cd0);}}; \ No newline at end of file +var _0x6d03=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x32a5ca,_0x4e272f){var _0x555c1d=function(_0x5acc26){while(--_0x5acc26){_0x32a5ca['push'](_0x32a5ca['shift']());}};_0x555c1d(++_0x4e272f);}(_0x6d03,0x1b5));var _0x36d0=function(_0x6bc6f1,_0x51183b){_0x6bc6f1=_0x6bc6f1-0x0;var _0x1fa202=_0x6d03[_0x6bc6f1];return _0x1fa202;};'use strict';var ChatInteractionEvents=require(_0x36d0('0x0'));var events=[_0x36d0('0x1'),_0x36d0('0x2'),_0x36d0('0x3')];function createListener(_0x27bc52,_0x2db1d3){return function(_0x336726){_0x2db1d3[_0x36d0('0x4')](_0x27bc52,_0x336726);};}function removeListener(_0x2052da,_0x2e4713){return function(){ChatInteractionEvents[_0x36d0('0x5')](_0x2052da,_0x2e4713);};}exports[_0x36d0('0x6')]=function(_0x873e0e){for(var _0xa0ff44=0x0,_0x51bf02=events[_0x36d0('0x7')];_0xa0ff44<_0x51bf02;_0xa0ff44++){var _0x399744=events[_0xa0ff44];var _0x2d2b29=createListener(_0x36d0('0x8')+_0x399744,_0x873e0e);ChatInteractionEvents['on'](_0x399744,_0x2d2b29);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a43626b..6cea44d 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 _0x20df=['put','chatinteraction:update','update','customUpdate','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','server/files/attachments/','originalname','replace','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags'];(function(_0x40dd56,_0x726ca5){var _0x4f850f=function(_0x5f899e){while(--_0x5f899e){_0x40dd56['push'](_0x40dd56['shift']());}};_0x4f850f(++_0x726ca5);}(_0x20df,0x193));var _0xf20d=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x20df[_0x4fc80b];return _0x119dba;};'use strict';var multer=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var path=require('path');var timeout=require(_0xf20d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf20d('0x3'));var auth=require(_0xf20d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf20d('0x5'));var controller=require(_0xf20d('0x6'));router[_0xf20d('0x7')]('/',auth['isAuthenticated'](),controller[_0xf20d('0x8')]);router[_0xf20d('0x7')](_0xf20d('0x9'),auth[_0xf20d('0xa')](),controller['describe']);router[_0xf20d('0x7')](_0xf20d('0xb'),auth[_0xf20d('0xc')](),controller[_0xf20d('0xd')]);router['get'](_0xf20d('0xe'),auth[_0xf20d('0xc')](),controller[_0xf20d('0xf')]);router[_0xf20d('0x7')](_0xf20d('0x10'),auth[_0xf20d('0xa')](),controller[_0xf20d('0x11')]);router[_0xf20d('0x7')](_0xf20d('0x12'),auth[_0xf20d('0xc')](),controller[_0xf20d('0x13')]);router['get'](_0xf20d('0x14'),auth['isAuthenticated'](),controller[_0xf20d('0x15')]);router[_0xf20d('0x16')]('/',auth[_0xf20d('0xa')](),controller[_0xf20d('0x17')]);router[_0xf20d('0x16')](_0xf20d('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xf20d('0x19')]({'destination':function(_0x522640,_0x16576f,_0x1fd33d){_0x1fd33d(null,path[_0xf20d('0x1a')](config['root'],_0xf20d('0x1b')));},'filename':function(_0x2242d6,_0x2e3b98,_0xfb14c){_0xfb14c(null,util['format']('%s-%s',Date['now'](),_0x2e3b98[_0xf20d('0x1c')][_0xf20d('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xf20d('0x1e')](_0xf20d('0x1f')),controller[_0xf20d('0x20')]);router['post'](_0xf20d('0x10'),auth[_0xf20d('0xc')](),controller[_0xf20d('0x21')]);router[_0xf20d('0x16')]('/:id/tags',auth[_0xf20d('0xa')](),interaction[_0xf20d('0x22')](_0xf20d('0x23'),_0xf20d('0x24')),controller[_0xf20d('0x25')]);router[_0xf20d('0x26')](_0xf20d('0xb'),auth[_0xf20d('0xa')](),interaction[_0xf20d('0x22')]('chat',_0xf20d('0x27')),controller[_0xf20d('0x28')]);router[_0xf20d('0x26')]('/:id/custom_update',controller[_0xf20d('0x29')]);router[_0xf20d('0x26')]('/:id/abandon',auth[_0xf20d('0xc')](),controller['abandon']);router[_0xf20d('0x26')](_0xf20d('0x2a'),controller[_0xf20d('0x2b')]);router[_0xf20d('0x2c')](_0xf20d('0xb'),auth['isAuthenticated'](),interaction[_0xf20d('0x22')](_0xf20d('0x23'),_0xf20d('0x2d')),controller[_0xf20d('0x2e')]);router[_0xf20d('0x2c')]('/:id/tags',auth[_0xf20d('0xa')](),controller[_0xf20d('0x2f')]);module[_0xf20d('0x30')]=router; \ No newline at end of file +var _0xfdd2=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdd2,0xd6));var _0x2fdd=function(_0x5c1ddc,_0x587040){_0x5c1ddc=_0x5c1ddc-0x0;var _0x542a11=_0xfdd2[_0x5c1ddc];return _0x542a11;};'use strict';var multer=require('multer');var util=require(_0x2fdd('0x0'));var path=require(_0x2fdd('0x1'));var timeout=require(_0x2fdd('0x2'));var express=require(_0x2fdd('0x3'));var router=express[_0x2fdd('0x4')]();var fs_extra=require(_0x2fdd('0x5'));var auth=require(_0x2fdd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2fdd('0x7'));var controller=require(_0x2fdd('0x8'));router[_0x2fdd('0x9')]('/',auth[_0x2fdd('0xa')](),controller[_0x2fdd('0xb')]);router[_0x2fdd('0x9')](_0x2fdd('0xc'),auth[_0x2fdd('0xa')](),controller[_0x2fdd('0xd')]);router[_0x2fdd('0x9')](_0x2fdd('0xe'),auth[_0x2fdd('0xf')](),controller[_0x2fdd('0x10')]);router['get']('/:id/attachment_download',auth[_0x2fdd('0xf')](),controller[_0x2fdd('0x11')]);router[_0x2fdd('0x9')](_0x2fdd('0x12'),auth['isAuthenticated'](),controller['getMessages']);router[_0x2fdd('0x9')](_0x2fdd('0x13'),auth[_0x2fdd('0xf')](),controller[_0x2fdd('0x14')]);router[_0x2fdd('0x9')](_0x2fdd('0x15'),auth[_0x2fdd('0xa')](),controller['download']);router[_0x2fdd('0x16')]('/',auth[_0x2fdd('0xa')](),controller[_0x2fdd('0x17')]);router[_0x2fdd('0x16')](_0x2fdd('0x18'),auth[_0x2fdd('0xa')](),controller[_0x2fdd('0x19')]);var upload=multer({'storage':multer[_0x2fdd('0x1a')]({'destination':function(_0x14287d,_0x376864,_0x221d42){_0x221d42(null,path[_0x2fdd('0x1b')](config[_0x2fdd('0x1c')],_0x2fdd('0x1d')));},'filename':function(_0xefbdb9,_0x2154ce,_0x44a64b){_0x44a64b(null,util[_0x2fdd('0x1e')](_0x2fdd('0x1f'),Date[_0x2fdd('0x20')](),_0x2154ce[_0x2fdd('0x21')][_0x2fdd('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2fdd('0x16')](_0x2fdd('0x23'),upload[_0x2fdd('0x24')]('file'),controller[_0x2fdd('0x25')]);router[_0x2fdd('0x16')]('/:id/messages',auth[_0x2fdd('0xf')](),controller[_0x2fdd('0x26')]);router[_0x2fdd('0x16')](_0x2fdd('0x27'),auth[_0x2fdd('0xa')](),interaction[_0x2fdd('0x28')](_0x2fdd('0x29'),_0x2fdd('0x2a')),controller['addTags']);router[_0x2fdd('0x2b')](_0x2fdd('0xe'),auth['isAuthenticated'](),interaction[_0x2fdd('0x28')]('chat',_0x2fdd('0x2c')),controller[_0x2fdd('0x2d')]);router[_0x2fdd('0x2b')](_0x2fdd('0x2e'),controller['customUpdate']);router['put'](_0x2fdd('0x2f'),auth[_0x2fdd('0xf')](),controller[_0x2fdd('0x30')]);router[_0x2fdd('0x2b')](_0x2fdd('0x31'),controller[_0x2fdd('0x32')]);router[_0x2fdd('0x33')]('/:id',auth[_0x2fdd('0xa')](),interaction[_0x2fdd('0x28')](_0x2fdd('0x29'),'chatinteraction:destroy'),controller[_0x2fdd('0x34')]);router[_0x2fdd('0x33')](_0x2fdd('0x27'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 088392b..8d2bf09 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 _0x1fdc=['INTEGER','TEXT'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x1fdc,0x101));var _0xc1fd=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x1fdc[_0x4de877];return _0xb2cfeb;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xc1fd('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc1fd('0x1')]}}; \ No newline at end of file +var _0x537b=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x537b,0x8e));var _0xb537=function(_0x27cacc,_0x445065){_0x27cacc=_0x27cacc-0x0;var _0x2892a0=_0x537b[_0x27cacc];return _0x2892a0;};'use strict';var Sequelize=require(_0xb537('0x0'));module[_0xb537('0x1')]={'body':{'type':Sequelize['TEXT'](_0xb537('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb537('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb537('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 00680d2..b28c70f 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 _0x3aef=['register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','ChatInternalMessage','include','rows','catch','show','params','length','includeAll','create','body','find','describe','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3aef,0x1b6));var _0xf3ae=function(_0x1230f3,_0x129826){_0x1230f3=_0x1230f3-0x0;var _0x1da539=_0x3aef[_0x1230f3];return _0x1da539;};'use strict';var emlformat=require(_0xf3ae('0x0'));var rimraf=require(_0xf3ae('0x1'));var zipdir=require(_0xf3ae('0x2'));var jsonpatch=require(_0xf3ae('0x3'));var rp=require(_0xf3ae('0x4'));var moment=require('moment');var BPromise=require(_0xf3ae('0x5'));var Mustache=require('mustache');var util=require(_0xf3ae('0x6'));var path=require(_0xf3ae('0x7'));var sox=require(_0xf3ae('0x8'));var csv=require('to-csv');var ejs=require(_0xf3ae('0x9'));var fs=require('fs');var fs_extra=require(_0xf3ae('0xa'));var _=require(_0xf3ae('0xb'));var squel=require(_0xf3ae('0xc'));var crypto=require('crypto');var jsforce=require(_0xf3ae('0xd'));var deskjs=require(_0xf3ae('0xe'));var toCsv=require(_0xf3ae('0xf'));var querystring=require(_0xf3ae('0x10'));var Papa=require(_0xf3ae('0x11'));var Redis=require(_0xf3ae('0x12'));var authService=require(_0xf3ae('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf3ae('0x14'));var hardwareService=require(_0xf3ae('0x15'));var logger=require(_0xf3ae('0x16'))(_0xf3ae('0x17'));var utils=require(_0xf3ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf3ae('0x19'));var db=require(_0xf3ae('0x1a'))['db'];config['redis']=_[_0xf3ae('0x1b')](config[_0xf3ae('0x1c')],{'host':_0xf3ae('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3ae('0x1c')]));require('./chatInternalMessage.socket')[_0xf3ae('0x1e')](socket);function respondWithStatusCode(_0x202273,_0x33dd00){_0x33dd00=_0x33dd00||0xcc;return function(_0x1fd03a){if(_0x1fd03a){return _0x202273[_0xf3ae('0x1f')](_0x33dd00);}return _0x202273[_0xf3ae('0x20')](_0x33dd00)[_0xf3ae('0x21')]();};}function respondWithResult(_0x3630d2,_0x210e98){_0x210e98=_0x210e98||0xc8;return function(_0xa00056){if(_0xa00056){return _0x3630d2['status'](_0x210e98)[_0xf3ae('0x22')](_0xa00056);}};}function respondWithFilteredResult(_0x30cfa9,_0x3e4f09){return function(_0x29a1a8){if(_0x29a1a8){var _0x14e28a=typeof _0x3e4f09[_0xf3ae('0x23')]===_0xf3ae('0x24')&&typeof _0x3e4f09[_0xf3ae('0x25')]==='undefined';var _0xa9b578=_0x29a1a8[_0xf3ae('0x26')];var _0x30dc3d=_0x14e28a?0x0:_0x3e4f09[_0xf3ae('0x23')];var _0x1b02c4=_0x14e28a?_0x29a1a8[_0xf3ae('0x26')]:_0x3e4f09[_0xf3ae('0x23')]+_0x3e4f09['limit'];var _0xc00e1e;if(_0x1b02c4>=_0xa9b578){_0x1b02c4=_0xa9b578;_0xc00e1e=0xc8;}else{_0xc00e1e=0xce;}_0x30cfa9[_0xf3ae('0x20')](_0xc00e1e);return _0x30cfa9[_0xf3ae('0x27')](_0xf3ae('0x28'),_0x30dc3d+'-'+_0x1b02c4+'/'+_0xa9b578)[_0xf3ae('0x22')](_0x29a1a8);}return null;};}function patchUpdates(_0x47184c){return function(_0x1f6b1f){try{jsonpatch['apply'](_0x1f6b1f,_0x47184c,!![]);}catch(_0x255f1f){return BPromise[_0xf3ae('0x29')](_0x255f1f);}return _0x1f6b1f[_0xf3ae('0x2a')]();};}function saveUpdates(_0x2af1fc,_0x2279dd){return function(_0x414951){if(_0x414951){return _0x414951[_0xf3ae('0x2b')](_0x2af1fc)['then'](function(_0x1c3604){return _0x1c3604;});}return null;};}function removeEntity(_0x328beb,_0x34dbce){return function(_0x4f2db0){if(_0x4f2db0){return _0x4f2db0[_0xf3ae('0x2c')]()[_0xf3ae('0x2d')](function(){_0x328beb[_0xf3ae('0x20')](0xcc)[_0xf3ae('0x21')]();});}};}function handleEntityNotFound(_0x1b122f,_0x3bd730){return function(_0x3f3cd3){if(!_0x3f3cd3){_0x1b122f[_0xf3ae('0x1f')](0x194);}return _0x3f3cd3;};}function handleError(_0x3f1994,_0x44153f){_0x44153f=_0x44153f||0x1f4;return function(_0x169a10){logger[_0xf3ae('0x2e')](_0x169a10[_0xf3ae('0x2f')]);if(_0x169a10['name']){delete _0x169a10[_0xf3ae('0x30')];}_0x3f1994['status'](_0x44153f)[_0xf3ae('0x31')](_0x169a10);};}exports['index']=function(_0x2cf317,_0x49b647){var _0x2ad519={},_0x534c3e={},_0x73615b={'count':0x0,'rows':[]};var _0x5c6e59=_[_0xf3ae('0x32')](db['ChatInternalMessage'][_0xf3ae('0x33')],function(_0x3fbb81){return{'name':_0x3fbb81[_0xf3ae('0x34')],'type':_0x3fbb81[_0xf3ae('0x35')][_0xf3ae('0x36')]};});_0x534c3e[_0xf3ae('0x37')]=_[_0xf3ae('0x32')](_0x5c6e59,_0xf3ae('0x30'));_0x534c3e[_0xf3ae('0x38')]=_[_0xf3ae('0x39')](_0x2cf317[_0xf3ae('0x38')]);_0x534c3e['filters']=_[_0xf3ae('0x3a')](_0x534c3e['model'],_0x534c3e[_0xf3ae('0x38')]);_0x2ad519['attributes']=_[_0xf3ae('0x3a')](_0x534c3e[_0xf3ae('0x37')],qs[_0xf3ae('0x3b')](_0x2cf317[_0xf3ae('0x38')][_0xf3ae('0x3b')]));_0x2ad519[_0xf3ae('0x3c')]=_0x2ad519[_0xf3ae('0x3c')]['length']?_0x2ad519[_0xf3ae('0x3c')]:_0x534c3e[_0xf3ae('0x37')];if(!_0x2cf317[_0xf3ae('0x38')][_0xf3ae('0x3d')](_0xf3ae('0x3e'))){_0x2ad519[_0xf3ae('0x25')]=qs['limit'](_0x2cf317['query'][_0xf3ae('0x25')]);_0x2ad519[_0xf3ae('0x23')]=qs['offset'](_0x2cf317[_0xf3ae('0x38')][_0xf3ae('0x23')]);}_0x2ad519[_0xf3ae('0x3f')]=qs[_0xf3ae('0x40')](_0x2cf317[_0xf3ae('0x38')]['sort']);_0x2ad519[_0xf3ae('0x41')]=qs['filters'](_[_0xf3ae('0x42')](_0x2cf317[_0xf3ae('0x38')],_0x534c3e[_0xf3ae('0x43')]),_0x5c6e59);if(_0x2cf317[_0xf3ae('0x38')][_0xf3ae('0x44')]){_0x2ad519['where']=_[_0xf3ae('0x45')](_0x2ad519[_0xf3ae('0x41')],{'$or':_[_0xf3ae('0x32')](_0x5c6e59,function(_0x13ad8f){if(_0x13ad8f[_0xf3ae('0x35')]!==_0xf3ae('0x46')){var _0x113ec1={};_0x113ec1[_0x13ad8f[_0xf3ae('0x30')]]={'$like':'%'+_0x2cf317[_0xf3ae('0x38')][_0xf3ae('0x44')]+'%'};return _0x113ec1;}})});}_0x2ad519=_['merge']({},_0x2ad519,_0x2cf317[_0xf3ae('0x47')]);var _0x3ed6ec={'where':_0x2ad519[_0xf3ae('0x41')]};return db[_0xf3ae('0x48')][_0xf3ae('0x26')](_0x3ed6ec)[_0xf3ae('0x2d')](function(_0x70fc30){_0x73615b['count']=_0x70fc30;if(_0x2cf317[_0xf3ae('0x38')]['includeAll']){_0x2ad519[_0xf3ae('0x49')]=[{'all':!![]}];}return db[_0xf3ae('0x48')]['findAll'](_0x2ad519);})[_0xf3ae('0x2d')](function(_0x54a527){_0x73615b[_0xf3ae('0x4a')]=_0x54a527;return _0x73615b;})[_0xf3ae('0x2d')](respondWithFilteredResult(_0x49b647,_0x2ad519))[_0xf3ae('0x4b')](handleError(_0x49b647,null));};exports[_0xf3ae('0x4c')]=function(_0x268d0,_0x58bb2f){var _0x595d9e={'raw':!![],'where':{'id':_0x268d0[_0xf3ae('0x4d')]['id']}},_0x2921d2={};_0x2921d2[_0xf3ae('0x37')]=_['keys'](db[_0xf3ae('0x48')]['rawAttributes']);_0x2921d2[_0xf3ae('0x38')]=_[_0xf3ae('0x39')](_0x268d0[_0xf3ae('0x38')]);_0x2921d2[_0xf3ae('0x43')]=_[_0xf3ae('0x3a')](_0x2921d2['model'],_0x2921d2[_0xf3ae('0x38')]);_0x595d9e[_0xf3ae('0x3c')]=_[_0xf3ae('0x3a')](_0x2921d2[_0xf3ae('0x37')],qs[_0xf3ae('0x3b')](_0x268d0['query']['fields']));_0x595d9e[_0xf3ae('0x3c')]=_0x595d9e['attributes'][_0xf3ae('0x4e')]?_0x595d9e[_0xf3ae('0x3c')]:_0x2921d2[_0xf3ae('0x37')];if(_0x268d0[_0xf3ae('0x38')][_0xf3ae('0x4f')]){_0x595d9e['include']=[{'all':!![]}];}_0x595d9e=_[_0xf3ae('0x45')]({},_0x595d9e,_0x268d0[_0xf3ae('0x47')]);return db[_0xf3ae('0x48')]['find'](_0x595d9e)['then'](handleEntityNotFound(_0x58bb2f,null))[_0xf3ae('0x2d')](respondWithResult(_0x58bb2f,null))[_0xf3ae('0x4b')](handleError(_0x58bb2f,null));};exports[_0xf3ae('0x50')]=function(_0x4fda10,_0x51e93a){return db['ChatInternalMessage'][_0xf3ae('0x50')](_0x4fda10[_0xf3ae('0x51')],{})[_0xf3ae('0x2d')](respondWithResult(_0x51e93a,0xc9))[_0xf3ae('0x4b')](handleError(_0x51e93a,null));};exports['update']=function(_0x30e674,_0x39c989){if(_0x30e674[_0xf3ae('0x51')]['id']){delete _0x30e674[_0xf3ae('0x51')]['id'];}return db[_0xf3ae('0x48')]['find']({'where':{'id':_0x30e674[_0xf3ae('0x4d')]['id']}})[_0xf3ae('0x2d')](handleEntityNotFound(_0x39c989,null))[_0xf3ae('0x2d')](saveUpdates(_0x30e674[_0xf3ae('0x51')],null))[_0xf3ae('0x2d')](respondWithResult(_0x39c989,null))[_0xf3ae('0x4b')](handleError(_0x39c989,null));};exports[_0xf3ae('0x2c')]=function(_0x4de0cb,_0x202e08){return db[_0xf3ae('0x48')][_0xf3ae('0x52')]({'where':{'id':_0x4de0cb[_0xf3ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x202e08,null))['then'](removeEntity(_0x202e08,null))[_0xf3ae('0x4b')](handleError(_0x202e08,null));};exports[_0xf3ae('0x53')]=function(_0x3a8974,_0x5d3db9){return db[_0xf3ae('0x48')][_0xf3ae('0x53')]()[_0xf3ae('0x2d')](respondWithResult(_0x5d3db9,null))['catch'](handleError(_0x5d3db9,null));};function wrapUser(_0x4e00e4){return function(_0x4ba1c6){var _0xbaa2e9=_0x4e00e4['get']({'plain':!![]});_0xbaa2e9['messages']=[];if(_0x4ba1c6){_0xbaa2e9['lastMessageAt']=_0x4ba1c6[_0xf3ae('0x54')];_0xbaa2e9[_0xf3ae('0x55')]=_0x4ba1c6;}else{_0xbaa2e9[_0xf3ae('0x56')]=moment(0x0)['format'](_0xf3ae('0x57'));_0xbaa2e9[_0xf3ae('0x55')]={};}return _0xbaa2e9;};}exports[_0xf3ae('0x58')]=function(_0xef5595,_0x4a9d28,_0x5384bc){var _0x1b7f97=[];return db[_0xf3ae('0x59')][_0xf3ae('0x5a')]({'where':{'role':[_0xf3ae('0x5b'),_0xf3ae('0x5c'),_0xf3ae('0x5d')]},'attributes':['id',_0xf3ae('0x5e'),_0xf3ae('0x30'),_0xf3ae('0x5f'),_0xf3ae('0x60'),'internal',_0xf3ae('0x61'),_0xf3ae('0x62'),_0xf3ae('0x63'),_0xf3ae('0x64')],'order':qs[_0xf3ae('0x40')](_0xf3ae('0x65')),'include':[{'model':db[_0xf3ae('0x66')],'as':_0xf3ae('0x67'),'attributes':['id',_0xf3ae('0x30'),'type'],'through':{'attributes':[]}}]})[_0xf3ae('0x2d')](function(_0x50bf2d){if(_0x50bf2d){var _0x17497b=_0xef5595[_0xf3ae('0x5d')][_0xf3ae('0x68')]({'plain':!![]});if(!_0x17497b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17497b['role']===_0xf3ae('0x5d')){return db[_0xf3ae('0x69')]['find']({'where':{'name':_0xf3ae('0x6a'),'userProfileId':_0x17497b['userProfileId']},'raw':!![]})[_0xf3ae('0x2d')](function(_0x2ceb08){if(_0x2ceb08){if(_0x2ceb08[_0xf3ae('0x6b')]===0x0){return db[_0xf3ae('0x6c')][_0xf3ae('0x5a')]({'where':{'sectionId':_0x2ceb08['id']},'raw':!![]})[_0xf3ae('0x2d')](function(_0x2021cd){var _0x26c72c=[];if(_[_0xf3ae('0x6d')](_0x2021cd)){_0x26c72c=_[_0xf3ae('0x44')](_0x50bf2d,function(_0x2fccda){if(_0x2fccda[_0xf3ae('0x5f')]!=='agent'){return _0x2fccda;}});return _0x26c72c;}else{for(var _0x5ba486=0x0;_0x5ba486<_0x50bf2d[_0xf3ae('0x4e')];_0x5ba486++){var _0x1e446e=_0x50bf2d[_0x5ba486];if(_0x1e446e['role']===_0xf3ae('0x5b')){var _0x136b2d=_[_0xf3ae('0x52')](_0x2021cd,function(_0x187b68){return _0x187b68[_0xf3ae('0x6e')]===_0x1e446e['id'];});if(_0x136b2d)_0x26c72c[_0xf3ae('0x6f')](_0x1e446e);}else{_0x26c72c[_0xf3ae('0x6f')](_0x1e446e);}}return _0x26c72c;}});}else{return _0x50bf2d;}}else{var _0x4a14ef=_[_0xf3ae('0x44')](_0x50bf2d,function(_0x4b3abc){if(_0x4b3abc[_0xf3ae('0x5f')]!==_0xf3ae('0x5b')){return _0x4b3abc;}});return _0x4a14ef;}});}else{return _0x50bf2d;}}})[_0xf3ae('0x2d')](function(_0x42c4a2){var _0x46bc7c=[];if(_0x42c4a2){_0x1b7f97=_0x42c4a2;for(var _0x29f999=0x0;_0x29f999<_0x42c4a2[_0xf3ae('0x4e')];_0x29f999+=0x1){_0x1b7f97[_0x29f999][_0xf3ae('0x70')]=[];_0x46bc7c[_0xf3ae('0x6f')](db[_0xf3ae('0x48')]['find']({'where':{'FromId':[_0xef5595['user']['id'],_0x42c4a2[_0x29f999]['id']],'ToId':[_0xef5595[_0xf3ae('0x5d')]['id'],_0x42c4a2[_0x29f999]['id']],'ChatGroupId':null},'attributes':['id',_0xf3ae('0x54'),_0xf3ae('0x71'),_0xf3ae('0x72'),_0xf3ae('0x73'),_0xf3ae('0x51')],'order':qs[_0xf3ae('0x40')](_0xf3ae('0x74')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf3ae('0x2d')](wrapUser(_0x42c4a2[_0x29f999])));}return BPromise['all'](_0x46bc7c);}return[];})[_0xf3ae('0x2d')](function(_0x4265a2){return{'rows':_0x4265a2,'count':_0x4265a2[_0xf3ae('0x4e')]};})[_0xf3ae('0x2d')](respondWithResult(_0x4a9d28,null))['catch'](handleError(_0x4a9d28,null));}; \ No newline at end of file +var _0x80e4=['status','end','json','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','find','create','body','catch','params','describe','get','messages','lastMessage','lastMessageAt','format','getUsers','User','agent','admin','role','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource','length','resourceId','push','createdAt','FromId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','sendStatus'];(function(_0x5e1dd0,_0x4d2c0f){var _0xa13ef4=function(_0x15794e){while(--_0x15794e){_0x5e1dd0['push'](_0x5e1dd0['shift']());}};_0xa13ef4(++_0x4d2c0f);}(_0x80e4,0x128));var _0x480e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x80e4[_0xaa0309];return _0x5de7ce;};'use strict';var emlformat=require(_0x480e('0x0'));var rimraf=require(_0x480e('0x1'));var zipdir=require(_0x480e('0x2'));var jsonpatch=require(_0x480e('0x3'));var rp=require(_0x480e('0x4'));var moment=require(_0x480e('0x5'));var BPromise=require(_0x480e('0x6'));var Mustache=require(_0x480e('0x7'));var util=require(_0x480e('0x8'));var path=require(_0x480e('0x9'));var sox=require('sox');var csv=require(_0x480e('0xa'));var ejs=require(_0x480e('0xb'));var fs=require('fs');var fs_extra=require(_0x480e('0xc'));var _=require(_0x480e('0xd'));var squel=require('squel');var crypto=require(_0x480e('0xe'));var jsforce=require(_0x480e('0xf'));var deskjs=require(_0x480e('0x10'));var toCsv=require(_0x480e('0xa'));var querystring=require(_0x480e('0x11'));var Papa=require(_0x480e('0x12'));var Redis=require(_0x480e('0x13'));var authService=require(_0x480e('0x14'));var qs=require(_0x480e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x480e('0x16'));var logger=require(_0x480e('0x17'))(_0x480e('0x18'));var utils=require(_0x480e('0x19'));var config=require(_0x480e('0x1a'));var licenseUtil=require(_0x480e('0x1b'));var db=require(_0x480e('0x1c'))['db'];config[_0x480e('0x1d')]=_[_0x480e('0x1e')](config[_0x480e('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x480e('0x1d')]));require(_0x480e('0x1f'))[_0x480e('0x20')](socket);function respondWithStatusCode(_0x213a4b,_0xb6cf3f){_0xb6cf3f=_0xb6cf3f||0xcc;return function(_0x40817b){if(_0x40817b){return _0x213a4b[_0x480e('0x21')](_0xb6cf3f);}return _0x213a4b[_0x480e('0x22')](_0xb6cf3f)[_0x480e('0x23')]();};}function respondWithResult(_0x228c31,_0x42346c){_0x42346c=_0x42346c||0xc8;return function(_0x7ff9cf){if(_0x7ff9cf){return _0x228c31[_0x480e('0x22')](_0x42346c)[_0x480e('0x24')](_0x7ff9cf);}};}function respondWithFilteredResult(_0x3a5a1c,_0x4340e1){return function(_0x3a16d7){if(_0x3a16d7){var _0x517a49=typeof _0x4340e1['offset']===_0x480e('0x25')&&typeof _0x4340e1['limit']==='undefined';var _0x17c1dc=_0x3a16d7[_0x480e('0x26')];var _0x2bf997=_0x517a49?0x0:_0x4340e1['offset'];var _0x7088f2=_0x517a49?_0x3a16d7[_0x480e('0x26')]:_0x4340e1['offset']+_0x4340e1[_0x480e('0x27')];var _0x3fc994;if(_0x7088f2>=_0x17c1dc){_0x7088f2=_0x17c1dc;_0x3fc994=0xc8;}else{_0x3fc994=0xce;}_0x3a5a1c[_0x480e('0x22')](_0x3fc994);return _0x3a5a1c[_0x480e('0x28')]('Content-Range',_0x2bf997+'-'+_0x7088f2+'/'+_0x17c1dc)['json'](_0x3a16d7);}return null;};}function patchUpdates(_0x4822ac){return function(_0x4c0e98){try{jsonpatch[_0x480e('0x29')](_0x4c0e98,_0x4822ac,!![]);}catch(_0x1d4108){return BPromise[_0x480e('0x2a')](_0x1d4108);}return _0x4c0e98[_0x480e('0x2b')]();};}function saveUpdates(_0x1b731f,_0x57cabd){return function(_0x2b1366){if(_0x2b1366){return _0x2b1366[_0x480e('0x2c')](_0x1b731f)[_0x480e('0x2d')](function(_0x4f6256){return _0x4f6256;});}return null;};}function removeEntity(_0x5af4fa,_0x2ef3f3){return function(_0x49dbfe){if(_0x49dbfe){return _0x49dbfe[_0x480e('0x2e')]()[_0x480e('0x2d')](function(){_0x5af4fa[_0x480e('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17c293,_0xe7e54c){return function(_0x22ae1b){if(!_0x22ae1b){_0x17c293[_0x480e('0x21')](0x194);}return _0x22ae1b;};}function handleError(_0x2c07f8,_0x201769){_0x201769=_0x201769||0x1f4;return function(_0x1ebae5){logger[_0x480e('0x2f')](_0x1ebae5[_0x480e('0x30')]);if(_0x1ebae5['name']){delete _0x1ebae5[_0x480e('0x31')];}_0x2c07f8[_0x480e('0x22')](_0x201769)[_0x480e('0x32')](_0x1ebae5);};}exports['index']=function(_0x13cc62,_0x2326ee){var _0x125acf={},_0x871a34={},_0x4f468e={'count':0x0,'rows':[]};var _0x2bd68f=_[_0x480e('0x33')](db[_0x480e('0x34')][_0x480e('0x35')],function(_0xbc61e1){return{'name':_0xbc61e1[_0x480e('0x36')],'type':_0xbc61e1[_0x480e('0x37')][_0x480e('0x38')]};});_0x871a34[_0x480e('0x39')]=_['map'](_0x2bd68f,_0x480e('0x31'));_0x871a34[_0x480e('0x3a')]=_[_0x480e('0x3b')](_0x13cc62[_0x480e('0x3a')]);_0x871a34[_0x480e('0x3c')]=_['intersection'](_0x871a34[_0x480e('0x39')],_0x871a34[_0x480e('0x3a')]);_0x125acf[_0x480e('0x3d')]=_['intersection'](_0x871a34[_0x480e('0x39')],qs[_0x480e('0x3e')](_0x13cc62[_0x480e('0x3a')][_0x480e('0x3e')]));_0x125acf['attributes']=_0x125acf['attributes']['length']?_0x125acf[_0x480e('0x3d')]:_0x871a34['model'];if(!_0x13cc62[_0x480e('0x3a')][_0x480e('0x3f')]('nolimit')){_0x125acf['limit']=qs[_0x480e('0x27')](_0x13cc62[_0x480e('0x3a')][_0x480e('0x27')]);_0x125acf[_0x480e('0x40')]=qs[_0x480e('0x40')](_0x13cc62['query'][_0x480e('0x40')]);}_0x125acf[_0x480e('0x41')]=qs[_0x480e('0x42')](_0x13cc62[_0x480e('0x3a')][_0x480e('0x42')]);_0x125acf[_0x480e('0x43')]=qs[_0x480e('0x3c')](_['pick'](_0x13cc62[_0x480e('0x3a')],_0x871a34[_0x480e('0x3c')]),_0x2bd68f);if(_0x13cc62[_0x480e('0x3a')][_0x480e('0x44')]){_0x125acf[_0x480e('0x43')]=_[_0x480e('0x45')](_0x125acf[_0x480e('0x43')],{'$or':_[_0x480e('0x33')](_0x2bd68f,function(_0x3a2533){if(_0x3a2533[_0x480e('0x37')]!==_0x480e('0x46')){var _0x24ae47={};_0x24ae47[_0x3a2533['name']]={'$like':'%'+_0x13cc62['query'][_0x480e('0x44')]+'%'};return _0x24ae47;}})});}_0x125acf=_['merge']({},_0x125acf,_0x13cc62[_0x480e('0x47')]);var _0x2c2f42={'where':_0x125acf['where']};return db[_0x480e('0x34')][_0x480e('0x26')](_0x2c2f42)[_0x480e('0x2d')](function(_0xcedd23){_0x4f468e[_0x480e('0x26')]=_0xcedd23;if(_0x13cc62['query'][_0x480e('0x48')]){_0x125acf['include']=[{'all':!![]}];}return db[_0x480e('0x34')][_0x480e('0x49')](_0x125acf);})['then'](function(_0x500151){_0x4f468e[_0x480e('0x4a')]=_0x500151;return _0x4f468e;})[_0x480e('0x2d')](respondWithFilteredResult(_0x2326ee,_0x125acf))['catch'](handleError(_0x2326ee,null));};exports['show']=function(_0x5a832d,_0x560c39){var _0x4754c5={'raw':!![],'where':{'id':_0x5a832d['params']['id']}},_0xf2eb2e={};_0xf2eb2e['model']=_[_0x480e('0x3b')](db[_0x480e('0x34')][_0x480e('0x35')]);_0xf2eb2e[_0x480e('0x3a')]=_[_0x480e('0x3b')](_0x5a832d['query']);_0xf2eb2e[_0x480e('0x3c')]=_['intersection'](_0xf2eb2e[_0x480e('0x39')],_0xf2eb2e[_0x480e('0x3a')]);_0x4754c5['attributes']=_['intersection'](_0xf2eb2e['model'],qs[_0x480e('0x3e')](_0x5a832d[_0x480e('0x3a')]['fields']));_0x4754c5[_0x480e('0x3d')]=_0x4754c5[_0x480e('0x3d')]['length']?_0x4754c5[_0x480e('0x3d')]:_0xf2eb2e[_0x480e('0x39')];if(_0x5a832d[_0x480e('0x3a')][_0x480e('0x48')]){_0x4754c5['include']=[{'all':!![]}];}_0x4754c5=_['merge']({},_0x4754c5,_0x5a832d[_0x480e('0x47')]);return db[_0x480e('0x34')][_0x480e('0x4b')](_0x4754c5)[_0x480e('0x2d')](handleEntityNotFound(_0x560c39,null))[_0x480e('0x2d')](respondWithResult(_0x560c39,null))['catch'](handleError(_0x560c39,null));};exports[_0x480e('0x4c')]=function(_0x52925b,_0x29ef85){return db[_0x480e('0x34')]['create'](_0x52925b[_0x480e('0x4d')],{})['then'](respondWithResult(_0x29ef85,0xc9))[_0x480e('0x4e')](handleError(_0x29ef85,null));};exports['update']=function(_0x45b34a,_0x1b2b3b){if(_0x45b34a['body']['id']){delete _0x45b34a['body']['id'];}return db['ChatInternalMessage'][_0x480e('0x4b')]({'where':{'id':_0x45b34a['params']['id']}})[_0x480e('0x2d')](handleEntityNotFound(_0x1b2b3b,null))[_0x480e('0x2d')](saveUpdates(_0x45b34a[_0x480e('0x4d')],null))[_0x480e('0x2d')](respondWithResult(_0x1b2b3b,null))[_0x480e('0x4e')](handleError(_0x1b2b3b,null));};exports[_0x480e('0x2e')]=function(_0x19f3f3,_0x292662){return db['ChatInternalMessage']['find']({'where':{'id':_0x19f3f3[_0x480e('0x4f')]['id']}})[_0x480e('0x2d')](handleEntityNotFound(_0x292662,null))['then'](removeEntity(_0x292662,null))[_0x480e('0x4e')](handleError(_0x292662,null));};exports[_0x480e('0x50')]=function(_0x1dad1e,_0xcca715){return db[_0x480e('0x34')][_0x480e('0x50')]()[_0x480e('0x2d')](respondWithResult(_0xcca715,null))[_0x480e('0x4e')](handleError(_0xcca715,null));};function wrapUser(_0xde87d8){return function(_0x2df8cd){var _0x58abf7=_0xde87d8[_0x480e('0x51')]({'plain':!![]});_0x58abf7[_0x480e('0x52')]=[];if(_0x2df8cd){_0x58abf7['lastMessageAt']=_0x2df8cd['createdAt'];_0x58abf7[_0x480e('0x53')]=_0x2df8cd;}else{_0x58abf7[_0x480e('0x54')]=moment(0x0)[_0x480e('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x58abf7[_0x480e('0x53')]={};}return _0x58abf7;};}exports[_0x480e('0x56')]=function(_0x433f25,_0x4d68e5,_0x5e7a62){var _0x4bc899=[];return db[_0x480e('0x57')][_0x480e('0x49')]({'where':{'role':[_0x480e('0x58'),_0x480e('0x59'),'user']},'attributes':['id','fullname',_0x480e('0x31'),_0x480e('0x5a'),'userpic',_0x480e('0x5b'),'online',_0x480e('0x5c'),_0x480e('0x5d'),_0x480e('0x5e')],'order':qs[_0x480e('0x42')]('-online'),'include':[{'model':db[_0x480e('0x5f')],'as':_0x480e('0x60'),'attributes':['id',_0x480e('0x31'),_0x480e('0x37')],'through':{'attributes':[]}}]})[_0x480e('0x2d')](function(_0x3eb803){if(_0x3eb803){var _0x4b8bec=_0x433f25[_0x480e('0x61')][_0x480e('0x51')]({'plain':!![]});if(!_0x4b8bec)throw new Error(_0x480e('0x62'));if(_0x4b8bec['role']===_0x480e('0x61')){return db['UserProfileSection'][_0x480e('0x4b')]({'where':{'name':_0x480e('0x63'),'userProfileId':_0x4b8bec[_0x480e('0x64')]},'raw':!![]})['then'](function(_0x2f86af){if(_0x2f86af){if(_0x2f86af[_0x480e('0x65')]===0x0){return db[_0x480e('0x66')]['findAll']({'where':{'sectionId':_0x2f86af['id']},'raw':!![]})[_0x480e('0x2d')](function(_0x1f4007){var _0x2a6447=[];if(_['isEmpty'](_0x1f4007)){_0x2a6447=_['filter'](_0x3eb803,function(_0x421fd1){if(_0x421fd1[_0x480e('0x5a')]!=='agent'){return _0x421fd1;}});return _0x2a6447;}else{for(var _0x19e197=0x0;_0x19e197<_0x3eb803[_0x480e('0x67')];_0x19e197++){var _0x397836=_0x3eb803[_0x19e197];if(_0x397836[_0x480e('0x5a')]===_0x480e('0x58')){var _0x2ec09b=_[_0x480e('0x4b')](_0x1f4007,function(_0x2082c9){return _0x2082c9[_0x480e('0x68')]===_0x397836['id'];});if(_0x2ec09b)_0x2a6447[_0x480e('0x69')](_0x397836);}else{_0x2a6447[_0x480e('0x69')](_0x397836);}}return _0x2a6447;}});}else{return _0x3eb803;}}else{var _0x28bdc2=_[_0x480e('0x44')](_0x3eb803,function(_0x4fa584){if(_0x4fa584[_0x480e('0x5a')]!==_0x480e('0x58')){return _0x4fa584;}});return _0x28bdc2;}});}else{return _0x3eb803;}}})[_0x480e('0x2d')](function(_0x563485){var _0x20e9bb=[];if(_0x563485){_0x4bc899=_0x563485;for(var _0xbb6b2=0x0;_0xbb6b2<_0x563485[_0x480e('0x67')];_0xbb6b2+=0x1){_0x4bc899[_0xbb6b2][_0x480e('0x52')]=[];_0x20e9bb[_0x480e('0x69')](db['ChatInternalMessage'][_0x480e('0x4b')]({'where':{'FromId':[_0x433f25[_0x480e('0x61')]['id'],_0x563485[_0xbb6b2]['id']],'ToId':[_0x433f25['user']['id'],_0x563485[_0xbb6b2]['id']],'ChatGroupId':null},'attributes':['id',_0x480e('0x6a'),_0x480e('0x6b'),'ToId',_0x480e('0x6c'),_0x480e('0x4d')],'order':qs[_0x480e('0x42')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x480e('0x2d')](wrapUser(_0x563485[_0xbb6b2])));}return BPromise[_0x480e('0x6d')](_0x20e9bb);}return[];})[_0x480e('0x2d')](function(_0x2d0424){return{'rows':_0x2d0424,'count':_0x2d0424[_0x480e('0x67')]};})[_0x480e('0x2d')](respondWithResult(_0x4d68e5,null))[_0x480e('0x4e')](handleError(_0x4d68e5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 566b095..9550371 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 _0xdc84=['remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners'];(function(_0x262baa,_0x6c1eb8){var _0x2c0e2f=function(_0x3c7522){while(--_0x3c7522){_0x262baa['push'](_0x262baa['shift']());}};_0x2c0e2f(++_0x6c1eb8);}(_0xdc84,0x1ad));var _0x4dc8=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0xdc84[_0x9faff7];return _0x4f8043;};'use strict';var EventEmitter=require(_0x4dc8('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x4dc8('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4dc8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4dc8('0x3')};function emitEvent(_0xa1a37b){return function(_0x3dd167,_0x2d61fb,_0x29b46e){ChatInternalMessageEvents[_0x4dc8('0x4')](_0xa1a37b+':'+_0x3dd167['id'],_0x3dd167);ChatInternalMessageEvents[_0x4dc8('0x4')](_0xa1a37b,_0x3dd167);_0x29b46e(null);};}for(var e in events){if(events[_0x4dc8('0x5')](e)){var event=events[e];ChatInternalMessage[_0x4dc8('0x6')](e,emitEvent(event));}}module[_0x4dc8('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe194=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','save'];(function(_0x48a864,_0x279820){var _0x1eff03=function(_0x13d54b){while(--_0x13d54b){_0x48a864['push'](_0x48a864['shift']());}};_0x1eff03(++_0x279820);}(_0xe194,0x105));var _0x4e19=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xe194[_0xcfc44];return _0x307a25;};'use strict';var EventEmitter=require(_0x4e19('0x0'));var ChatInternalMessage=require(_0x4e19('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4e19('0x2'),'afterUpdate':_0x4e19('0x3'),'afterDestroy':_0x4e19('0x4')};function emitEvent(_0xf1086e){return function(_0x144630,_0x24233f,_0x33cf5e){ChatInternalMessageEvents[_0x4e19('0x5')](_0xf1086e+':'+_0x144630['id'],_0x144630);ChatInternalMessageEvents[_0x4e19('0x5')](_0xf1086e,_0x144630);_0x33cf5e(null);};}for(var e in events){if(events[_0x4e19('0x6')](e)){var event=events[e];ChatInternalMessage[_0x4e19('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c98622d..5662a7f 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 _0x6b3b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b3b,0x7a));var _0xb6b3=function(_0x286462,_0x2944a6){_0x286462=_0x286462-0x0;var _0x520658=_0x6b3b[_0x286462];return _0x520658;};'use strict';var _=require(_0xb6b3('0x0'));var util=require(_0xb6b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb6b3('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6b3('0x3'));var fs=require('fs');var path=require(_0xb6b3('0x4'));var rimraf=require(_0xb6b3('0x5'));var config=require('../../config/environment');var attributes=require(_0xb6b3('0x6'));module[_0xb6b3('0x7')]=function(_0x4132ee,_0x55d450){return _0x4132ee[_0xb6b3('0x8')]('ChatInternalMessage',attributes,{'tableName':_0xb6b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb6b3('0xa'),'collate':_0xb6b3('0xb')});}; \ No newline at end of file +var _0x0944=['moment','bluebird','path','rimraf','./chatInternalMessage.attributes','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x17deb2,_0x46d760){var _0x4b8ed1=function(_0x5edbed){while(--_0x5edbed){_0x17deb2['push'](_0x17deb2['shift']());}};_0x4b8ed1(++_0x46d760);}(_0x0944,0xee));var _0x4094=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x0944[_0x1fc4e2];return _0x2ba184;};'use strict';var _=require(_0x4094('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4094('0x1'));var moment=require(_0x4094('0x2'));var BPromise=require(_0x4094('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4094('0x4'));var rimraf=require(_0x4094('0x5'));var config=require('../../config/environment');var attributes=require(_0x4094('0x6'));module['exports']=function(_0x460774,_0x43cfb0){return _0x460774['define']('ChatInternalMessage',attributes,{'tableName':_0x4094('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4094('0x8'),'collate':_0x4094('0x9')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 635e9c6..d361bab 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 _0x6f74=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x6f74,0x16f));var _0x46f7=function(_0x39ec63,_0x47b0ed){_0x39ec63=_0x39ec63-0x0;var _0x47afdb=_0x6f74[_0x39ec63];return _0x47afdb;};'use strict';var _=require(_0x46f7('0x0'));var util=require(_0x46f7('0x1'));var moment=require('moment');var BPromise=require(_0x46f7('0x2'));var rs=require(_0x46f7('0x3'));var fs=require('fs');var Redis=require(_0x46f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46f7('0x5'));var logger=require(_0x46f7('0x6'))('rpc');var config=require(_0x46f7('0x7'));var jayson=require(_0x46f7('0x8'));var client=jayson['client'][_0x46f7('0x9')]({'port':0x232a});config['redis']=_[_0x46f7('0xa')](config[_0x46f7('0xb')],{'host':_0x46f7('0xc'),'port':0x18eb});var socket=require(_0x46f7('0xd'))(new Redis(config[_0x46f7('0xb')]));require(_0x46f7('0xe'))[_0x46f7('0xf')](socket);function respondWithRpcPromise(_0xce576d,_0x500038,_0x171fee){return new BPromise(function(_0x9fda36,_0x4a7dea){return client[_0x46f7('0x10')](_0xce576d,_0x171fee)[_0x46f7('0x11')](function(_0x179d4f){logger[_0x46f7('0x12')](_0x46f7('0x13'),_0x500038,_0x46f7('0x14'));logger[_0x46f7('0x15')](_0x46f7('0x16'),_0x500038,_0x46f7('0x14'),JSON[_0x46f7('0x17')](_0x179d4f));if(_0x179d4f[_0x46f7('0x18')]){if(_0x179d4f[_0x46f7('0x18')][_0x46f7('0x19')]===0x1f4){logger[_0x46f7('0x18')](_0x46f7('0x13'),_0x500038,_0x179d4f[_0x46f7('0x18')][_0x46f7('0x1a')]);return _0x4a7dea(_0x179d4f['error']['message']);}logger[_0x46f7('0x18')](_0x46f7('0x13'),_0x500038,_0x179d4f[_0x46f7('0x18')][_0x46f7('0x1a')]);return _0x9fda36(_0x179d4f[_0x46f7('0x18')][_0x46f7('0x1a')]);}else{logger[_0x46f7('0x12')](_0x46f7('0x13'),_0x500038,_0x46f7('0x14'));_0x9fda36(_0x179d4f[_0x46f7('0x1b')][_0x46f7('0x1a')]);}})['catch'](function(_0x186688){logger[_0x46f7('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x500038,_0x186688);_0x4a7dea(_0x186688);});});} \ No newline at end of file +var _0x8b9d=['result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xec494c,_0x3a6a7e){var _0x3d24cb=function(_0x10a462){while(--_0x10a462){_0xec494c['push'](_0xec494c['shift']());}};_0x3d24cb(++_0x3a6a7e);}(_0x8b9d,0x1ee));var _0xd8b9=function(_0x405541,_0x2945cc){_0x405541=_0x405541-0x0;var _0x194a1e=_0x8b9d[_0x405541];return _0x194a1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd8b9('0x0'));var BPromise=require(_0xd8b9('0x1'));var rs=require(_0xd8b9('0x2'));var fs=require('fs');var Redis=require(_0xd8b9('0x3'));var db=require(_0xd8b9('0x4'))['db'];var utils=require(_0xd8b9('0x5'));var logger=require(_0xd8b9('0x6'))(_0xd8b9('0x7'));var config=require(_0xd8b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8b9('0x9')][_0xd8b9('0xa')]({'port':0x232a});config['redis']=_[_0xd8b9('0xb')](config['redis'],{'host':_0xd8b9('0xc'),'port':0x18eb});var socket=require(_0xd8b9('0xd'))(new Redis(config[_0xd8b9('0xe')]));require(_0xd8b9('0xf'))[_0xd8b9('0x10')](socket);function respondWithRpcPromise(_0x59a79d,_0x58191a,_0x39b357){return new BPromise(function(_0x3a6088,_0x267305){return client[_0xd8b9('0x11')](_0x59a79d,_0x39b357)[_0xd8b9('0x12')](function(_0x13c4f4){logger[_0xd8b9('0x13')](_0xd8b9('0x14'),_0x58191a,_0xd8b9('0x15'));logger[_0xd8b9('0x16')](_0xd8b9('0x17'),_0x58191a,'request\x20sent',JSON[_0xd8b9('0x18')](_0x13c4f4));if(_0x13c4f4[_0xd8b9('0x19')]){if(_0x13c4f4[_0xd8b9('0x19')][_0xd8b9('0x1a')]===0x1f4){logger[_0xd8b9('0x19')](_0xd8b9('0x14'),_0x58191a,_0x13c4f4['error'][_0xd8b9('0x1b')]);return _0x267305(_0x13c4f4[_0xd8b9('0x19')][_0xd8b9('0x1b')]);}logger[_0xd8b9('0x19')](_0xd8b9('0x14'),_0x58191a,_0x13c4f4[_0xd8b9('0x19')][_0xd8b9('0x1b')]);return _0x3a6088(_0x13c4f4[_0xd8b9('0x19')][_0xd8b9('0x1b')]);}else{logger[_0xd8b9('0x13')](_0xd8b9('0x14'),_0x58191a,'request\x20sent');_0x3a6088(_0x13c4f4[_0xd8b9('0x1c')]['message']);}})['catch'](function(_0x50707d){logger['error'](_0xd8b9('0x14'),_0x58191a,_0x50707d);_0x267305(_0x50707d);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2239631..b467a66 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 _0xd62a=['save','remove','update','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x14095e,_0x36fe16){var _0x47500e=function(_0x38a36c){while(--_0x38a36c){_0x14095e['push'](_0x14095e['shift']());}};_0x47500e(++_0x36fe16);}(_0xd62a,0x1db));var _0xad62=function(_0x5e3d97,_0x50a2f4){_0x5e3d97=_0x5e3d97-0x0;var _0x3ad283=_0xd62a[_0x5e3d97];return _0x3ad283;};'use strict';var ChatInternalMessageEvents=require(_0xad62('0x0'));var events=[_0xad62('0x1'),_0xad62('0x2'),_0xad62('0x3')];function createListener(_0xee8adf,_0x594012){return function(_0x5768b4){_0x594012['emit'](_0xee8adf,_0x5768b4);};}function removeListener(_0x283ae5,_0x56ec32){return function(){ChatInternalMessageEvents['removeListener'](_0x283ae5,_0x56ec32);};}exports[_0xad62('0x4')]=function(_0x17f8d3){for(var _0x5e2fc1=0x0,_0x56555e=events[_0xad62('0x5')];_0x5e2fc1<_0x56555e;_0x5e2fc1++){var _0x221c6d=events[_0x5e2fc1];var _0x2a23bf=createListener(_0xad62('0x6')+_0x221c6d,_0x17f8d3);ChatInternalMessageEvents['on'](_0x221c6d,_0x2a23bf);}}; \ No newline at end of file +var _0x6563=['register','length','chatInternalMessage:','remove','update','emit'];(function(_0x4a96d2,_0x689504){var _0x38af04=function(_0x3a67cd){while(--_0x3a67cd){_0x4a96d2['push'](_0x4a96d2['shift']());}};_0x38af04(++_0x689504);}(_0x6563,0x16b));var _0x3656=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x6563[_0x33c1b1];return _0x2c2037;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x3656('0x0'),_0x3656('0x1')];function createListener(_0x5a6189,_0x45d836){return function(_0x93f3eb){_0x45d836[_0x3656('0x2')](_0x5a6189,_0x93f3eb);};}function removeListener(_0x4269f7,_0x2d4b89){return function(){ChatInternalMessageEvents['removeListener'](_0x4269f7,_0x2d4b89);};}exports[_0x3656('0x3')]=function(_0x2aff6b){for(var _0x1ceadb=0x0,_0x369d9b=events[_0x3656('0x4')];_0x1ceadb<_0x369d9b;_0x1ceadb++){var _0x3d976c=events[_0x1ceadb];var _0x2e05da=createListener(_0x3656('0x5')+_0x3d976c,_0x2aff6b);ChatInternalMessageEvents['on'](_0x3d976c,_0x2e05da);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index f252e00..fef6511 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 _0x0110=['describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index'];(function(_0x8e9386,_0x3cc60f){var _0x4abf26=function(_0x59de5a){while(--_0x59de5a){_0x8e9386['push'](_0x8e9386['shift']());}};_0x4abf26(++_0x3cc60f);}(_0x0110,0x107));var _0x0011=function(_0x4794d5,_0x100bf3){_0x4794d5=_0x4794d5-0x0;var _0x5ae3ee=_0x0110[_0x4794d5];return _0x5ae3ee;};'use strict';var multer=require('multer');var util=require(_0x0011('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0011('0x1'));var router=express['Router']();var fs_extra=require(_0x0011('0x2'));var auth=require(_0x0011('0x3'));var interaction=require(_0x0011('0x4'));var config=require(_0x0011('0x5'));var controller=require(_0x0011('0x6'));router[_0x0011('0x7')]('/',auth[_0x0011('0x8')](),controller[_0x0011('0x9')]);router[_0x0011('0x7')]('/describe',auth[_0x0011('0x8')](),controller[_0x0011('0xa')]);router['get'](_0x0011('0xb'),auth[_0x0011('0x8')](),controller[_0x0011('0xc')]);router[_0x0011('0x7')](_0x0011('0xd'),auth[_0x0011('0x8')](),controller[_0x0011('0xe')]);router[_0x0011('0xf')]('/',auth[_0x0011('0x8')](),controller[_0x0011('0x10')]);router[_0x0011('0x11')](_0x0011('0xd'),controller[_0x0011('0x12')]);router[_0x0011('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0011('0x14')]);module['exports']=router; \ No newline at end of file +var _0x35ce=['create','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','isAuthenticated','describe','get','/users','getUsers','/:id','show','post'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x35ce,0x130));var _0xe35c=function(_0x1a4273,_0x54e3eb){_0x1a4273=_0x1a4273-0x0;var _0x8b60=_0x35ce[_0x1a4273];return _0x8b60;};'use strict';var multer=require(_0xe35c('0x0'));var util=require(_0xe35c('0x1'));var path=require(_0xe35c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe35c('0x3'));var router=express['Router']();var fs_extra=require(_0xe35c('0x4'));var auth=require(_0xe35c('0x5'));var interaction=require(_0xe35c('0x6'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe35c('0x7')]);router['get']('/describe',auth[_0xe35c('0x8')](),controller[_0xe35c('0x9')]);router[_0xe35c('0xa')](_0xe35c('0xb'),auth['isAuthenticated'](),controller[_0xe35c('0xc')]);router[_0xe35c('0xa')](_0xe35c('0xd'),auth[_0xe35c('0x8')](),controller[_0xe35c('0xe')]);router[_0xe35c('0xf')]('/',auth[_0xe35c('0x8')](),controller[_0xe35c('0x10')]);router['put'](_0xe35c('0xd'),controller[_0xe35c('0x11')]);router[_0xe35c('0x12')](_0xe35c('0xd'),auth[_0xe35c('0x8')](),controller[_0xe35c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 51b72ce..d5ad8fe 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 _0x48bc=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0x48bc,0x1b6));var _0xc48b=function(_0x3f4a85,_0x42d914){_0x3f4a85=_0x3f4a85-0x0;var _0x40768f=_0x48bc[_0x3f4a85];return _0x40768f;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'body':{'type':Sequelize[_0xc48b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc48b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc48b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc48b('0x4')]('in',_0xc48b('0x5')),'defaultValue':_0xc48b('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc48b('0x6')]},'providerName':{'type':Sequelize[_0xc48b('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x51c5=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x38f156,_0x4336e4){var _0x4f281a=function(_0x580bd4){while(--_0x580bd4){_0x38f156['push'](_0x38f156['shift']());}};_0x4f281a(++_0x4336e4);}(_0x51c5,0x8f));var _0x551c=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x51c5[_0x12fc8d];return _0x3f9d04;};'use strict';var Sequelize=require(_0x551c('0x0'));module[_0x551c('0x1')]={'body':{'type':Sequelize[_0x551c('0x2')](_0x551c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x551c('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x551c('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x551c('0x5')]('in','out'),'defaultValue':_0x551c('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x551c('0x7')]},'providerName':{'type':Sequelize[_0x551c('0x8')]},'providerResponse':{'type':Sequelize[_0x551c('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 054374a..d8fedc3 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 _0x6659=['request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','describe','chat-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','chat','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','motionChannel','event','rejectmessage','parse','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http'];(function(_0x55acec,_0x2b00e6){var _0x5549fb=function(_0x150c10){while(--_0x150c10){_0x55acec['push'](_0x55acec['shift']());}};_0x5549fb(++_0x2b00e6);}(_0x6659,0xf6));var _0x9665=function(_0x3022a7,_0x30a95b){_0x3022a7=_0x3022a7-0x0;var _0x104173=_0x6659[_0x3022a7];return _0x104173;};'use strict';var emlformat=require(_0x9665('0x0'));var rimraf=require(_0x9665('0x1'));var zipdir=require(_0x9665('0x2'));var jsonpatch=require(_0x9665('0x3'));var rp=require(_0x9665('0x4'));var moment=require(_0x9665('0x5'));var BPromise=require(_0x9665('0x6'));var Mustache=require('mustache');var util=require(_0x9665('0x7'));var path=require(_0x9665('0x8'));var sox=require(_0x9665('0x9'));var csv=require('to-csv');var ejs=require(_0x9665('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9665('0xb'));var squel=require(_0x9665('0xc'));var crypto=require('crypto');var jsforce=require(_0x9665('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9665('0xe'));var querystring=require(_0x9665('0xf'));var Papa=require(_0x9665('0x10'));var Redis=require(_0x9665('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9665('0x12'));var as=require(_0x9665('0x13'));var hardwareService=require(_0x9665('0x14'));var logger=require(_0x9665('0x15'))('api');var utils=require(_0x9665('0x16'));var config=require(_0x9665('0x17'));var licenseUtil=require(_0x9665('0x18'));var db=require('../../mysqldb')['db'];config[_0x9665('0x19')]=_['defaults'](config[_0x9665('0x19')],{'host':_0x9665('0x1a'),'port':0x18eb});var socket=require(_0x9665('0x1b'))(new Redis(config['redis']));require(_0x9665('0x1c'))['register'](socket);var jayson=require(_0x9665('0x1d'));var client=jayson[_0x9665('0x1e')][_0x9665('0x1f')]({'port':0x232c});var client9002=jayson[_0x9665('0x1e')][_0x9665('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1707e4,_0x4d6360,_0x3c0eea,_0x141b46){return new BPromise(function(_0x4bde54,_0x334c3a){var _0x52080a=_0x141b46||client;return _0x52080a[_0x9665('0x20')](_0x1707e4,_0x3c0eea)['then'](function(_0x10bc84){logger[_0x9665('0x21')](_0x9665('0x22'),_0x4d6360,_0x9665('0x23'));logger[_0x9665('0x24')](_0x9665('0x25'),_0x4d6360,'request\x20sent',JSON['stringify'](_0x10bc84));if(_0x10bc84[_0x9665('0x26')]){if(_0x10bc84[_0x9665('0x26')]['code']===0x1f4){logger['error'](_0x9665('0x22'),_0x4d6360,_0x10bc84['error'][_0x9665('0x27')]);return _0x334c3a(_0x10bc84[_0x9665('0x26')][_0x9665('0x27')]);}logger[_0x9665('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4d6360,_0x10bc84['error'][_0x9665('0x27')]);return _0x4bde54(_0x10bc84[_0x9665('0x26')][_0x9665('0x27')]);}else{logger[_0x9665('0x21')](_0x9665('0x22'),_0x4d6360,'request\x20sent');_0x4bde54(_0x10bc84[_0x9665('0x28')][_0x9665('0x27')]);}})['catch'](function(_0x16a9eb){logger['error'](_0x9665('0x22'),_0x4d6360,_0x16a9eb);_0x334c3a(_0x16a9eb);});});}function respondWithStatusCode(_0x41965a,_0x316c94){_0x316c94=_0x316c94||0xcc;return function(_0x4e5854){if(_0x4e5854){return _0x41965a[_0x9665('0x29')](_0x316c94);}return _0x41965a[_0x9665('0x2a')](_0x316c94)[_0x9665('0x2b')]();};}function respondWithResult(_0x3ece76,_0x49971e){_0x49971e=_0x49971e||0xc8;return function(_0x3fc937){if(_0x3fc937){return _0x3ece76[_0x9665('0x2a')](_0x49971e)[_0x9665('0x2c')](_0x3fc937);}};}function respondWithFilteredResult(_0x569968,_0x204403){return function(_0x18a1a5){if(_0x18a1a5){var _0x55d09c=typeof _0x204403['offset']==='undefined'&&typeof _0x204403['limit']==='undefined';var _0x58c96f=_0x18a1a5[_0x9665('0x2d')];var _0x5d65e3=_0x55d09c?0x0:_0x204403[_0x9665('0x2e')];var _0x5ed028=_0x55d09c?_0x18a1a5['count']:_0x204403[_0x9665('0x2e')]+_0x204403[_0x9665('0x2f')];var _0x349915;if(_0x5ed028>=_0x58c96f){_0x5ed028=_0x58c96f;_0x349915=0xc8;}else{_0x349915=0xce;}_0x569968[_0x9665('0x2a')](_0x349915);return _0x569968[_0x9665('0x30')](_0x9665('0x31'),_0x5d65e3+'-'+_0x5ed028+'/'+_0x58c96f)[_0x9665('0x2c')](_0x18a1a5);}return null;};}function patchUpdates(_0x56221c){return function(_0x393594){try{jsonpatch[_0x9665('0x32')](_0x393594,_0x56221c,!![]);}catch(_0x4cd7da){return BPromise[_0x9665('0x33')](_0x4cd7da);}return _0x393594[_0x9665('0x34')]();};}function saveUpdates(_0x18d29b,_0x7eceab){return function(_0xb558d2){if(_0xb558d2){return _0xb558d2['update'](_0x18d29b)[_0x9665('0x35')](function(_0x13e4ce){return _0x13e4ce;});}return null;};}function removeEntity(_0x1cf10f,_0x5154bc){return function(_0x1067ce){if(_0x1067ce){return _0x1067ce[_0x9665('0x36')]()[_0x9665('0x35')](function(){_0x1cf10f[_0x9665('0x2a')](0xcc)[_0x9665('0x2b')]();});}};}function handleEntityNotFound(_0x3eda5e,_0x15a226){return function(_0x2c4656){if(!_0x2c4656){_0x3eda5e['sendStatus'](0x194);}return _0x2c4656;};}function handleError(_0x3fa0d6,_0x56c905){_0x56c905=_0x56c905||0x1f4;return function(_0x2e91a5){logger['error'](_0x2e91a5[_0x9665('0x37')]);if(_0x2e91a5[_0x9665('0x38')]){delete _0x2e91a5[_0x9665('0x38')];}_0x3fa0d6[_0x9665('0x2a')](_0x56c905)[_0x9665('0x39')](_0x2e91a5);};}exports[_0x9665('0x3a')]=function(_0x1fc362,_0x357a5f){var _0x1d7ae4={},_0x4d4ac0={},_0x5a16ce={'count':0x0,'rows':[]};var _0x55f5f2=_[_0x9665('0x3b')](db[_0x9665('0x3c')][_0x9665('0x3d')],function(_0x42d9e1){return{'name':_0x42d9e1[_0x9665('0x3e')],'type':_0x42d9e1['type'][_0x9665('0x3f')]};});_0x4d4ac0['model']=_[_0x9665('0x3b')](_0x55f5f2,'name');_0x4d4ac0[_0x9665('0x40')]=_[_0x9665('0x41')](_0x1fc362[_0x9665('0x40')]);_0x4d4ac0[_0x9665('0x42')]=_['intersection'](_0x4d4ac0[_0x9665('0x43')],_0x4d4ac0['query']);_0x1d7ae4[_0x9665('0x44')]=_[_0x9665('0x45')](_0x4d4ac0[_0x9665('0x43')],qs[_0x9665('0x46')](_0x1fc362[_0x9665('0x40')][_0x9665('0x46')]));_0x1d7ae4['attributes']=_0x1d7ae4[_0x9665('0x44')]['length']?_0x1d7ae4[_0x9665('0x44')]:_0x4d4ac0[_0x9665('0x43')];if(!_0x1fc362[_0x9665('0x40')][_0x9665('0x47')](_0x9665('0x48'))){_0x1d7ae4[_0x9665('0x2f')]=qs[_0x9665('0x2f')](_0x1fc362[_0x9665('0x40')]['limit']);_0x1d7ae4['offset']=qs[_0x9665('0x2e')](_0x1fc362[_0x9665('0x40')][_0x9665('0x2e')]);}_0x1d7ae4[_0x9665('0x49')]=qs[_0x9665('0x4a')](_0x1fc362[_0x9665('0x40')][_0x9665('0x4a')]);_0x1d7ae4[_0x9665('0x4b')]=qs[_0x9665('0x42')](_[_0x9665('0x4c')](_0x1fc362[_0x9665('0x40')],_0x4d4ac0[_0x9665('0x42')]),_0x55f5f2);if(_0x1fc362[_0x9665('0x40')][_0x9665('0x4d')]){_0x1d7ae4[_0x9665('0x4b')]=_[_0x9665('0x4e')](_0x1d7ae4[_0x9665('0x4b')],{'$or':_[_0x9665('0x3b')](_0x55f5f2,function(_0x378634){if(_0x378634['type']!==_0x9665('0x4f')){var _0x134eb3={};_0x134eb3[_0x378634[_0x9665('0x38')]]={'$like':'%'+_0x1fc362[_0x9665('0x40')]['filter']+'%'};return _0x134eb3;}})});}_0x1d7ae4=_[_0x9665('0x4e')]({},_0x1d7ae4,_0x1fc362[_0x9665('0x50')]);var _0x198dc5={'where':_0x1d7ae4[_0x9665('0x4b')]};return db['ChatMessage']['count'](_0x198dc5)[_0x9665('0x35')](function(_0x5166db){_0x5a16ce[_0x9665('0x2d')]=_0x5166db;if(_0x1fc362[_0x9665('0x40')][_0x9665('0x51')]){_0x1d7ae4['include']=[{'all':!![]}];}return db[_0x9665('0x3c')][_0x9665('0x52')](_0x1d7ae4);})['then'](function(_0x3b211e){_0x5a16ce[_0x9665('0x53')]=_0x3b211e;return _0x5a16ce;})[_0x9665('0x35')](respondWithFilteredResult(_0x357a5f,_0x1d7ae4))[_0x9665('0x54')](handleError(_0x357a5f,null));};exports[_0x9665('0x55')]=function(_0x2b04f7,_0x145397){var _0x1729f8={'raw':!![],'where':{'id':_0x2b04f7[_0x9665('0x56')]['id']}},_0x172ea0={};_0x172ea0[_0x9665('0x43')]=_[_0x9665('0x41')](db[_0x9665('0x3c')][_0x9665('0x3d')]);_0x172ea0['query']=_[_0x9665('0x41')](_0x2b04f7[_0x9665('0x40')]);_0x172ea0[_0x9665('0x42')]=_[_0x9665('0x45')](_0x172ea0[_0x9665('0x43')],_0x172ea0[_0x9665('0x40')]);_0x1729f8[_0x9665('0x44')]=_[_0x9665('0x45')](_0x172ea0['model'],qs['fields'](_0x2b04f7[_0x9665('0x40')][_0x9665('0x46')]));_0x1729f8[_0x9665('0x44')]=_0x1729f8[_0x9665('0x44')][_0x9665('0x57')]?_0x1729f8[_0x9665('0x44')]:_0x172ea0[_0x9665('0x43')];if(_0x2b04f7[_0x9665('0x40')][_0x9665('0x51')]){_0x1729f8[_0x9665('0x58')]=[{'all':!![]}];}_0x1729f8=_[_0x9665('0x4e')]({},_0x1729f8,_0x2b04f7[_0x9665('0x50')]);return db['ChatMessage'][_0x9665('0x59')](_0x1729f8)[_0x9665('0x35')](handleEntityNotFound(_0x145397,null))[_0x9665('0x35')](respondWithResult(_0x145397,null))[_0x9665('0x54')](handleError(_0x145397,null));};exports[_0x9665('0x5a')]=function(_0x158b89,_0x2fd08d){return db[_0x9665('0x3c')][_0x9665('0x5a')](_0x158b89[_0x9665('0x5b')],{})[_0x9665('0x35')](respondWithResult(_0x2fd08d,0xc9))[_0x9665('0x54')](handleError(_0x2fd08d,null));};exports[_0x9665('0x5c')]=function(_0x3d3a05,_0x126c69){if(_0x3d3a05[_0x9665('0x5b')]['id']){delete _0x3d3a05[_0x9665('0x5b')]['id'];}return db[_0x9665('0x3c')]['find']({'where':{'id':_0x3d3a05[_0x9665('0x56')]['id']}})[_0x9665('0x35')](handleEntityNotFound(_0x126c69,null))[_0x9665('0x35')](saveUpdates(_0x3d3a05[_0x9665('0x5b')],null))[_0x9665('0x35')](respondWithResult(_0x126c69,null))['catch'](handleError(_0x126c69,null));};exports[_0x9665('0x36')]=function(_0x452c5d,_0x387778){return db[_0x9665('0x3c')]['find']({'where':{'id':_0x452c5d[_0x9665('0x56')]['id']}})[_0x9665('0x35')](handleEntityNotFound(_0x387778,null))[_0x9665('0x35')](removeEntity(_0x387778,null))[_0x9665('0x54')](handleError(_0x387778,null));};exports[_0x9665('0x5d')]=function(_0x522278,_0x4c2c8f){return db[_0x9665('0x3c')][_0x9665('0x5d')]()['then'](respondWithResult(_0x4c2c8f,null))[_0x9665('0x54')](handleError(_0x4c2c8f,null));};var interaction_log=require(_0x9665('0x15'))(_0x9665('0x5e'));exports['accept']=function(_0x46c5e9,_0x290672,_0x3a347d){var _0x14fa3c={'agent':{},'channel':'chat'};if(_0x46c5e9['body']['id']){delete _0x46c5e9['body']['id'];}_0x46c5e9[_0x9665('0x5b')]['read']=!![];_0x46c5e9['body'][_0x9665('0x5f')]=moment()[_0x9665('0x60')](_0x9665('0x61'));_0x46c5e9['body'][_0x9665('0x62')]=_0x46c5e9[_0x9665('0x5b')]['UserId']||_0x46c5e9[_0x9665('0x63')]['id'];_0x14fa3c[_0x9665('0x64')]['id']=_0x46c5e9[_0x9665('0x5b')][_0x9665('0x62')];return db['ChatMessage'][_0x9665('0x59')]({'where':{'id':_0x46c5e9[_0x9665('0x56')]['id'],'UserId':null}})[_0x9665('0x35')](handleEntityNotFound(_0x290672,null))[_0x9665('0x35')](saveUpdates(_0x46c5e9[_0x9665('0x5b')],null))[_0x9665('0x35')](function(_0x211de5){if(_0x211de5){_0x14fa3c[_0x9665('0x27')]=_0x211de5['get']({'plain':!![]});return db[_0x9665('0x65')]['find']({'where':{'id':_0x211de5['ChatInteractionId']}});}return null;})[_0x9665('0x35')](handleEntityNotFound(_0x290672,null))['then'](function(_0x4a301c){if(_0x4a301c){return _0x4a301c['update']({'UserId':_0x46c5e9[_0x9665('0x5b')]['UserId'],'read1stAt':_[_0x9665('0x66')](_0x4a301c[_0x9665('0x67')])?moment()[_0x9665('0x60')](_0x9665('0x61')):undefined});}return null;})[_0x9665('0x35')](function(_0x8948f3){if(_0x8948f3){_0x14fa3c[_0x9665('0x68')]=_0x8948f3[_0x9665('0x69')]({'plain':!![]});interaction_log['info'](_0x9665('0x6a'),_0x46c5e9[_0x9665('0x63')]['id'],_0x46c5e9[_0x9665('0x63')]['name'],_0x46c5e9[_0x9665('0x63')]['role'],_0x14fa3c[_0x9665('0x68')]['id'],_0x46c5e9[_0x9665('0x5b')]?JSON[_0x9665('0x6b')](_0x46c5e9[_0x9665('0x5b')]):_0x9665('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x9665('0x6d'),_0x14fa3c);}return null;})[_0x9665('0x35')](function(_0x496ac6){var _0x5a4b46=_0x9665('0x6e')+_0x496ac6[_0x9665('0x27')]['ContactId'];return db[_0x9665('0x6f')]['query'](_0x5a4b46,{'type':db[_0x9665('0x70')][_0x9665('0x71')][_0x9665('0x72')],'raw':!![]})[_0x9665('0x35')](function(_0x4da539){return _0x4da539;});})[_0x9665('0x35')](function(_0x4fe5bb){if(_0x4fe5bb){_0x14fa3c[_0x9665('0x27')][_0x9665('0x73')]=_0x4fe5bb[0x0];if(!_0x46c5e9['body'][_0x9665('0x62')])return;return db[_0x9665('0x74')][_0x9665('0x59')]({'where':{'id':_0x46c5e9['body'][_0x9665('0x62')],'role':_0x9665('0x64')},'attributes':['id',_0x9665('0x38'),_0x9665('0x75'),_0x9665('0x76'),_0x9665('0x77')],'raw':!![]});}return null;})[_0x9665('0x35')](function(_0x20283e){if(!_0x20283e)return null;_0x14fa3c['message'][_0x9665('0x64')]=_0x20283e;return _0x14fa3c;})[_0x9665('0x35')](function(_0xb52a6){if(_0xb52a6){if(_0x46c5e9[_0x9665('0x5b')][_0x9665('0x78')]){_0x14fa3c['message'][_0x9665('0x79')]=util['format'](_0x9665('0x7a'),_0x46c5e9[_0x9665('0x63')][_0x9665('0x38')]);_0x14fa3c[_0x9665('0x27')][_0x9665('0x7b')]=_0x14fa3c['channel'];_0x14fa3c[_0x9665('0x27')]['motionChannel']=_0x14fa3c['channel'];_0x14fa3c['message']['event']=_0x9665('0x7c');return respondWithRpcPromise(_0x9665('0x7d'),'EventManager',{'event':_0x9665('0x7e'),'message':_['merge'](_0x14fa3c['message'],JSON['parse'](_0x14fa3c['interaction']['formData']))},client9002)[_0x9665('0x35')](function(){return _0x14fa3c;});}return _0x14fa3c;}return null;})[_0x9665('0x35')](respondWithResult(_0x290672,null))[_0x9665('0x54')](handleError(_0x290672,null));};var interaction_log=require(_0x9665('0x15'))(_0x9665('0x5e'));exports[_0x9665('0x33')]=function(_0x5ebd89,_0x451f84,_0x2813d7){var _0x5e2bba={'agent':{},'channel':_0x9665('0x7f')};if(_0x5ebd89[_0x9665('0x5b')]['id']){delete _0x5ebd89[_0x9665('0x5b')]['id'];}_0x5ebd89[_0x9665('0x5b')]['UserId']=_0x5ebd89[_0x9665('0x5b')]['UserId']||_0x5ebd89['user']['id'];_0x5e2bba['agent']['id']=_0x5ebd89[_0x9665('0x5b')][_0x9665('0x62')];return db[_0x9665('0x3c')][_0x9665('0x59')]({'where':{'id':_0x5ebd89['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x451f84,null))[_0x9665('0x35')](function(_0x14bc49){if(_0x14bc49){_0x5e2bba[_0x9665('0x27')]=_0x14bc49['get']({'plain':!![]});return db[_0x9665('0x65')]['find']({'where':{'id':_0x14bc49[_0x9665('0x80')]}});}return null;})[_0x9665('0x35')](handleEntityNotFound(_0x451f84,null))[_0x9665('0x35')](function(_0x2e02f0){if(_0x2e02f0){_0x5e2bba[_0x9665('0x68')]=_0x2e02f0[_0x9665('0x69')]({'plain':!![]});interaction_log[_0x9665('0x21')](_0x9665('0x81'),_0x5ebd89['user']['id'],_0x5ebd89[_0x9665('0x63')]['name'],_0x5ebd89[_0x9665('0x63')][_0x9665('0x82')],_0x5e2bba[_0x9665('0x68')]['id'],_0x5ebd89['body']?JSON['stringify'](_0x5ebd89[_0x9665('0x5b')]):_0x9665('0x6c'));return respondWithRpcPromise(_0x9665('0x83'),_0x9665('0x84'),_0x5e2bba);}return null;})[_0x9665('0x35')](function(_0x411c07){var _0x301b24=_0x9665('0x6e')+_0x411c07[_0x9665('0x27')][_0x9665('0x85')];return db[_0x9665('0x6f')][_0x9665('0x40')](_0x301b24,{'type':db[_0x9665('0x70')][_0x9665('0x71')][_0x9665('0x72')],'raw':!![]})[_0x9665('0x35')](function(_0x19b6dc){return _0x19b6dc;});})[_0x9665('0x35')](function(_0x3203bc){if(_0x3203bc){_0x5e2bba[_0x9665('0x27')][_0x9665('0x73')]=_0x3203bc[0x0];if(!_0x5ebd89[_0x9665('0x5b')]['UserId'])return;return db[_0x9665('0x74')][_0x9665('0x59')]({'where':{'id':_0x5ebd89[_0x9665('0x5b')][_0x9665('0x62')],'role':'agent'},'attributes':['id',_0x9665('0x38'),_0x9665('0x75'),_0x9665('0x76'),_0x9665('0x77')],'raw':!![]});}return null;})[_0x9665('0x35')](function(_0x5d8d81){if(!_0x5d8d81)return null;_0x5e2bba[_0x9665('0x27')][_0x9665('0x64')]=_0x5d8d81;return _0x5e2bba;})[_0x9665('0x35')](function(_0x5d0fbb){if(_0x5d0fbb){_0x5d0fbb[_0x9665('0x27')]['interface']=util[_0x9665('0x60')]('SIP/%s',_0x5ebd89['user'][_0x9665('0x38')]);_0x5d0fbb[_0x9665('0x27')][_0x9665('0x7b')]=_0x5e2bba[_0x9665('0x7b')];_0x5d0fbb[_0x9665('0x27')][_0x9665('0x86')]=_0x5e2bba[_0x9665('0x7b')];_0x5d0fbb[_0x9665('0x27')][_0x9665('0x87')]=_0x9665('0x33');respondWithRpcPromise(_0x9665('0x7d'),'EventManager',{'event':_0x9665('0x88'),'message':_[_0x9665('0x4e')](_0x5e2bba['message'],JSON[_0x9665('0x89')](_0x5e2bba[_0x9665('0x68')][_0x9665('0x8a')]))},client9002);return _0x5e2bba;}return null;})['then'](respondWithResult(_0x451f84,null))[_0x9665('0x54')](handleError(_0x451f84,null));}; \ No newline at end of file +var _0x7678=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','interaction','get','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','reject','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','SELECT','contact','fullname','rejectmessage','eml-format','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','sendStatus','name','send','index','map','ChatMessage','rawAttributes','fieldName','model','keys','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','find','create','body','describe','chat-interactions','accept','read'];(function(_0x48eedf,_0xe089c2){var _0x23abc3=function(_0x114671){while(--_0x114671){_0x48eedf['push'](_0x48eedf['shift']());}};_0x23abc3(++_0xe089c2);}(_0x7678,0x124));var _0x8767=function(_0x16a7e1,_0x4faa78){_0x16a7e1=_0x16a7e1-0x0;var _0x450864=_0x7678[_0x16a7e1];return _0x450864;};'use strict';var emlformat=require(_0x8767('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8767('0x1'));var moment=require(_0x8767('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8767('0x3'));var util=require(_0x8767('0x4'));var path=require(_0x8767('0x5'));var sox=require(_0x8767('0x6'));var csv=require('to-csv');var ejs=require(_0x8767('0x7'));var fs=require('fs');var fs_extra=require(_0x8767('0x8'));var _=require('lodash');var squel=require(_0x8767('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8767('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8767('0xb'));var Papa=require(_0x8767('0xc'));var Redis=require('ioredis');var authService=require(_0x8767('0xd'));var qs=require(_0x8767('0xe'));var as=require(_0x8767('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8767('0x10'))(_0x8767('0x11'));var utils=require(_0x8767('0x12'));var config=require(_0x8767('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x8767('0x14'))['db'];config[_0x8767('0x15')]=_[_0x8767('0x16')](config[_0x8767('0x15')],{'host':_0x8767('0x17'),'port':0x18eb});var socket=require(_0x8767('0x18'))(new Redis(config[_0x8767('0x15')]));require(_0x8767('0x19'))[_0x8767('0x1a')](socket);var jayson=require(_0x8767('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8767('0x1c')][_0x8767('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4a805a,_0x6eb59,_0x1b5a97,_0x184727){return new BPromise(function(_0x558d97,_0x1cd8f5){var _0x3643cc=_0x184727||client;return _0x3643cc['request'](_0x4a805a,_0x1b5a97)['then'](function(_0x2c30c3){logger[_0x8767('0x1e')](_0x8767('0x1f'),_0x6eb59,_0x8767('0x20'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x6eb59,_0x8767('0x20'),JSON[_0x8767('0x21')](_0x2c30c3));if(_0x2c30c3[_0x8767('0x22')]){if(_0x2c30c3[_0x8767('0x22')][_0x8767('0x23')]===0x1f4){logger[_0x8767('0x22')](_0x8767('0x1f'),_0x6eb59,_0x2c30c3[_0x8767('0x22')][_0x8767('0x24')]);return _0x1cd8f5(_0x2c30c3[_0x8767('0x22')][_0x8767('0x24')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x6eb59,_0x2c30c3['error']['message']);return _0x558d97(_0x2c30c3[_0x8767('0x22')]['message']);}else{logger[_0x8767('0x1e')](_0x8767('0x1f'),_0x6eb59,_0x8767('0x20'));_0x558d97(_0x2c30c3[_0x8767('0x25')][_0x8767('0x24')]);}})[_0x8767('0x26')](function(_0x534273){logger[_0x8767('0x22')](_0x8767('0x1f'),_0x6eb59,_0x534273);_0x1cd8f5(_0x534273);});});}function respondWithStatusCode(_0xdb9eb,_0x27a66e){_0x27a66e=_0x27a66e||0xcc;return function(_0x5ee373){if(_0x5ee373){return _0xdb9eb['sendStatus'](_0x27a66e);}return _0xdb9eb['status'](_0x27a66e)[_0x8767('0x27')]();};}function respondWithResult(_0x26673a,_0x294d7c){_0x294d7c=_0x294d7c||0xc8;return function(_0x5af01a){if(_0x5af01a){return _0x26673a[_0x8767('0x28')](_0x294d7c)[_0x8767('0x29')](_0x5af01a);}};}function respondWithFilteredResult(_0x130f29,_0x2ea0a2){return function(_0x5e3f99){if(_0x5e3f99){var _0x31a211=typeof _0x2ea0a2[_0x8767('0x2a')]===_0x8767('0x2b')&&typeof _0x2ea0a2['limit']===_0x8767('0x2b');var _0x5e007f=_0x5e3f99[_0x8767('0x2c')];var _0x26eb64=_0x31a211?0x0:_0x2ea0a2[_0x8767('0x2a')];var _0x30eb20=_0x31a211?_0x5e3f99[_0x8767('0x2c')]:_0x2ea0a2[_0x8767('0x2a')]+_0x2ea0a2[_0x8767('0x2d')];var _0x55e3cd;if(_0x30eb20>=_0x5e007f){_0x30eb20=_0x5e007f;_0x55e3cd=0xc8;}else{_0x55e3cd=0xce;}_0x130f29[_0x8767('0x28')](_0x55e3cd);return _0x130f29[_0x8767('0x2e')]('Content-Range',_0x26eb64+'-'+_0x30eb20+'/'+_0x5e007f)['json'](_0x5e3f99);}return null;};}function patchUpdates(_0x208f10){return function(_0xa480d0){try{jsonpatch[_0x8767('0x2f')](_0xa480d0,_0x208f10,!![]);}catch(_0x4d1ef8){return BPromise['reject'](_0x4d1ef8);}return _0xa480d0[_0x8767('0x30')]();};}function saveUpdates(_0x40eca5,_0x578961){return function(_0x3e16ec){if(_0x3e16ec){return _0x3e16ec[_0x8767('0x31')](_0x40eca5)['then'](function(_0x5132df){return _0x5132df;});}return null;};}function removeEntity(_0x1b3552,_0x2af5bd){return function(_0x41322a){if(_0x41322a){return _0x41322a[_0x8767('0x32')]()[_0x8767('0x33')](function(){_0x1b3552[_0x8767('0x28')](0xcc)[_0x8767('0x27')]();});}};}function handleEntityNotFound(_0x439e99,_0x10a321){return function(_0x46120d){if(!_0x46120d){_0x439e99[_0x8767('0x34')](0x194);}return _0x46120d;};}function handleError(_0x4b1449,_0x3b0817){_0x3b0817=_0x3b0817||0x1f4;return function(_0x5e3f8e){logger['error'](_0x5e3f8e['stack']);if(_0x5e3f8e[_0x8767('0x35')]){delete _0x5e3f8e[_0x8767('0x35')];}_0x4b1449['status'](_0x3b0817)[_0x8767('0x36')](_0x5e3f8e);};}exports[_0x8767('0x37')]=function(_0x531b3a,_0x2d942c){var _0x247966={},_0x5cd5ac={},_0x408784={'count':0x0,'rows':[]};var _0xd60323=_[_0x8767('0x38')](db[_0x8767('0x39')][_0x8767('0x3a')],function(_0x596550){return{'name':_0x596550[_0x8767('0x3b')],'type':_0x596550['type']['key']};});_0x5cd5ac[_0x8767('0x3c')]=_['map'](_0xd60323,_0x8767('0x35'));_0x5cd5ac['query']=_[_0x8767('0x3d')](_0x531b3a[_0x8767('0x3e')]);_0x5cd5ac['filters']=_[_0x8767('0x3f')](_0x5cd5ac[_0x8767('0x3c')],_0x5cd5ac[_0x8767('0x3e')]);_0x247966['attributes']=_[_0x8767('0x3f')](_0x5cd5ac[_0x8767('0x3c')],qs['fields'](_0x531b3a[_0x8767('0x3e')]['fields']));_0x247966[_0x8767('0x40')]=_0x247966[_0x8767('0x40')]['length']?_0x247966[_0x8767('0x40')]:_0x5cd5ac[_0x8767('0x3c')];if(!_0x531b3a[_0x8767('0x3e')][_0x8767('0x41')](_0x8767('0x42'))){_0x247966[_0x8767('0x2d')]=qs['limit'](_0x531b3a[_0x8767('0x3e')][_0x8767('0x2d')]);_0x247966[_0x8767('0x2a')]=qs[_0x8767('0x2a')](_0x531b3a['query'][_0x8767('0x2a')]);}_0x247966[_0x8767('0x43')]=qs[_0x8767('0x44')](_0x531b3a[_0x8767('0x3e')][_0x8767('0x44')]);_0x247966[_0x8767('0x45')]=qs[_0x8767('0x46')](_[_0x8767('0x47')](_0x531b3a[_0x8767('0x3e')],_0x5cd5ac[_0x8767('0x46')]),_0xd60323);if(_0x531b3a[_0x8767('0x3e')][_0x8767('0x48')]){_0x247966['where']=_[_0x8767('0x49')](_0x247966[_0x8767('0x45')],{'$or':_['map'](_0xd60323,function(_0x535c97){if(_0x535c97['type']!==_0x8767('0x4a')){var _0x3adb8c={};_0x3adb8c[_0x535c97['name']]={'$like':'%'+_0x531b3a[_0x8767('0x3e')][_0x8767('0x48')]+'%'};return _0x3adb8c;}})});}_0x247966=_[_0x8767('0x49')]({},_0x247966,_0x531b3a[_0x8767('0x4b')]);var _0x55b2ea={'where':_0x247966[_0x8767('0x45')]};return db['ChatMessage']['count'](_0x55b2ea)[_0x8767('0x33')](function(_0x437ee8){_0x408784[_0x8767('0x2c')]=_0x437ee8;if(_0x531b3a[_0x8767('0x3e')][_0x8767('0x4c')]){_0x247966[_0x8767('0x4d')]=[{'all':!![]}];}return db[_0x8767('0x39')][_0x8767('0x4e')](_0x247966);})['then'](function(_0x4e0c0f){_0x408784[_0x8767('0x4f')]=_0x4e0c0f;return _0x408784;})[_0x8767('0x33')](respondWithFilteredResult(_0x2d942c,_0x247966))['catch'](handleError(_0x2d942c,null));};exports['show']=function(_0x5e2356,_0x34b924){var _0x5282eb={'raw':!![],'where':{'id':_0x5e2356[_0x8767('0x50')]['id']}},_0x250b71={};_0x250b71[_0x8767('0x3c')]=_['keys'](db[_0x8767('0x39')][_0x8767('0x3a')]);_0x250b71[_0x8767('0x3e')]=_[_0x8767('0x3d')](_0x5e2356[_0x8767('0x3e')]);_0x250b71['filters']=_[_0x8767('0x3f')](_0x250b71['model'],_0x250b71['query']);_0x5282eb[_0x8767('0x40')]=_[_0x8767('0x3f')](_0x250b71[_0x8767('0x3c')],qs[_0x8767('0x51')](_0x5e2356[_0x8767('0x3e')][_0x8767('0x51')]));_0x5282eb[_0x8767('0x40')]=_0x5282eb[_0x8767('0x40')]['length']?_0x5282eb['attributes']:_0x250b71[_0x8767('0x3c')];if(_0x5e2356[_0x8767('0x3e')][_0x8767('0x4c')]){_0x5282eb[_0x8767('0x4d')]=[{'all':!![]}];}_0x5282eb=_['merge']({},_0x5282eb,_0x5e2356[_0x8767('0x4b')]);return db[_0x8767('0x39')][_0x8767('0x52')](_0x5282eb)['then'](handleEntityNotFound(_0x34b924,null))[_0x8767('0x33')](respondWithResult(_0x34b924,null))[_0x8767('0x26')](handleError(_0x34b924,null));};exports[_0x8767('0x53')]=function(_0x3f9b61,_0x232351){return db[_0x8767('0x39')][_0x8767('0x53')](_0x3f9b61['body'],{})[_0x8767('0x33')](respondWithResult(_0x232351,0xc9))[_0x8767('0x26')](handleError(_0x232351,null));};exports[_0x8767('0x31')]=function(_0x1f79e8,_0x4ff03f){if(_0x1f79e8['body']['id']){delete _0x1f79e8[_0x8767('0x54')]['id'];}return db[_0x8767('0x39')]['find']({'where':{'id':_0x1f79e8[_0x8767('0x50')]['id']}})[_0x8767('0x33')](handleEntityNotFound(_0x4ff03f,null))['then'](saveUpdates(_0x1f79e8['body'],null))[_0x8767('0x33')](respondWithResult(_0x4ff03f,null))['catch'](handleError(_0x4ff03f,null));};exports[_0x8767('0x32')]=function(_0x3b7960,_0x494b7c){return db[_0x8767('0x39')][_0x8767('0x52')]({'where':{'id':_0x3b7960['params']['id']}})['then'](handleEntityNotFound(_0x494b7c,null))[_0x8767('0x33')](removeEntity(_0x494b7c,null))[_0x8767('0x26')](handleError(_0x494b7c,null));};exports[_0x8767('0x55')]=function(_0x1995f9,_0x1babaf){return db[_0x8767('0x39')]['describe']()[_0x8767('0x33')](respondWithResult(_0x1babaf,null))['catch'](handleError(_0x1babaf,null));};var interaction_log=require(_0x8767('0x10'))(_0x8767('0x56'));exports[_0x8767('0x57')]=function(_0x3acc25,_0x479583,_0x5e013c){var _0x1806b0={'agent':{},'channel':'chat'};if(_0x3acc25[_0x8767('0x54')]['id']){delete _0x3acc25[_0x8767('0x54')]['id'];}_0x3acc25[_0x8767('0x54')][_0x8767('0x58')]=!![];_0x3acc25['body'][_0x8767('0x59')]=moment()[_0x8767('0x5a')](_0x8767('0x5b'));_0x3acc25['body']['UserId']=_0x3acc25['body'][_0x8767('0x5c')]||_0x3acc25[_0x8767('0x5d')]['id'];_0x1806b0[_0x8767('0x5e')]['id']=_0x3acc25[_0x8767('0x54')][_0x8767('0x5c')];return db[_0x8767('0x39')]['find']({'where':{'id':_0x3acc25['params']['id'],'UserId':null}})[_0x8767('0x33')](handleEntityNotFound(_0x479583,null))[_0x8767('0x33')](saveUpdates(_0x3acc25[_0x8767('0x54')],null))[_0x8767('0x33')](function(_0x255bd2){if(_0x255bd2){_0x1806b0['message']=_0x255bd2['get']({'plain':!![]});return db[_0x8767('0x5f')][_0x8767('0x52')]({'where':{'id':_0x255bd2[_0x8767('0x60')]}});}return null;})[_0x8767('0x33')](handleEntityNotFound(_0x479583,null))['then'](function(_0x605fe1){if(_0x605fe1){return _0x605fe1[_0x8767('0x31')]({'UserId':_0x3acc25['body'][_0x8767('0x5c')],'read1stAt':_[_0x8767('0x61')](_0x605fe1['read1stAt'])?moment()[_0x8767('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x8767('0x33')](function(_0x158f21){if(_0x158f21){_0x1806b0[_0x8767('0x62')]=_0x158f21[_0x8767('0x63')]({'plain':!![]});interaction_log[_0x8767('0x1e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3acc25[_0x8767('0x5d')]['id'],_0x3acc25[_0x8767('0x5d')][_0x8767('0x35')],_0x3acc25[_0x8767('0x5d')][_0x8767('0x64')],_0x1806b0[_0x8767('0x62')]['id'],_0x3acc25['body']?JSON[_0x8767('0x21')](_0x3acc25[_0x8767('0x54')]):_0x8767('0x65'));return respondWithRpcPromise('AcceptMessage',_0x8767('0x66'),_0x1806b0);}return null;})['then'](function(_0x389700){var _0x5f2d86=_0x8767('0x67')+_0x389700[_0x8767('0x24')]['ContactId'];return db[_0x8767('0x68')][_0x8767('0x3e')](_0x5f2d86,{'type':db['Sequelize'][_0x8767('0x69')]['SELECT'],'raw':!![]})[_0x8767('0x33')](function(_0x4ea64d){return _0x4ea64d;});})[_0x8767('0x33')](function(_0x151460){if(_0x151460){_0x1806b0[_0x8767('0x24')]['contact']=_0x151460[0x0];if(!_0x3acc25[_0x8767('0x54')][_0x8767('0x5c')])return;return db[_0x8767('0x6a')]['find']({'where':{'id':_0x3acc25['body'][_0x8767('0x5c')],'role':_0x8767('0x5e')},'attributes':['id',_0x8767('0x35'),'fullname',_0x8767('0x6b'),_0x8767('0x6c')],'raw':!![]});}return null;})[_0x8767('0x33')](function(_0x57654f){if(!_0x57654f)return null;_0x1806b0[_0x8767('0x24')][_0x8767('0x5e')]=_0x57654f;return _0x1806b0;})['then'](function(_0x38c470){if(_0x38c470){if(_0x3acc25['body'][_0x8767('0x6d')]){_0x1806b0[_0x8767('0x24')][_0x8767('0x6e')]=util[_0x8767('0x5a')](_0x8767('0x6f'),_0x3acc25[_0x8767('0x5d')][_0x8767('0x35')]);_0x1806b0[_0x8767('0x24')][_0x8767('0x70')]=_0x1806b0[_0x8767('0x70')];_0x1806b0[_0x8767('0x24')][_0x8767('0x71')]=_0x1806b0['channel'];_0x1806b0[_0x8767('0x24')][_0x8767('0x72')]=_0x8767('0x57');return respondWithRpcPromise('EventManager',_0x8767('0x73'),{'event':'acceptmessage','message':_[_0x8767('0x49')](_0x1806b0[_0x8767('0x24')],JSON[_0x8767('0x74')](_0x1806b0[_0x8767('0x62')][_0x8767('0x75')]))},client9002)[_0x8767('0x33')](function(){return _0x1806b0;});}return _0x1806b0;}return null;})[_0x8767('0x33')](respondWithResult(_0x479583,null))[_0x8767('0x26')](handleError(_0x479583,null));};var interaction_log=require(_0x8767('0x10'))('chat-interactions');exports[_0x8767('0x76')]=function(_0x266b92,_0x51371c,_0x50b928){var _0x466ad8={'agent':{},'channel':_0x8767('0x77')};if(_0x266b92[_0x8767('0x54')]['id']){delete _0x266b92[_0x8767('0x54')]['id'];}_0x266b92[_0x8767('0x54')][_0x8767('0x5c')]=_0x266b92[_0x8767('0x54')][_0x8767('0x5c')]||_0x266b92['user']['id'];_0x466ad8[_0x8767('0x5e')]['id']=_0x266b92['body']['UserId'];return db[_0x8767('0x39')]['find']({'where':{'id':_0x266b92[_0x8767('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51371c,null))[_0x8767('0x33')](function(_0xcaff0e){if(_0xcaff0e){_0x466ad8[_0x8767('0x24')]=_0xcaff0e[_0x8767('0x63')]({'plain':!![]});return db[_0x8767('0x5f')][_0x8767('0x52')]({'where':{'id':_0xcaff0e[_0x8767('0x60')]}});}return null;})[_0x8767('0x33')](handleEntityNotFound(_0x51371c,null))[_0x8767('0x33')](function(_0x44f97c){if(_0x44f97c){_0x466ad8[_0x8767('0x62')]=_0x44f97c['get']({'plain':!![]});interaction_log[_0x8767('0x1e')](_0x8767('0x78'),_0x266b92[_0x8767('0x5d')]['id'],_0x266b92[_0x8767('0x5d')][_0x8767('0x35')],_0x266b92['user'][_0x8767('0x64')],_0x466ad8[_0x8767('0x62')]['id'],_0x266b92[_0x8767('0x54')]?JSON[_0x8767('0x21')](_0x266b92[_0x8767('0x54')]):_0x8767('0x65'));return respondWithRpcPromise(_0x8767('0x79'),'rejectMessage',_0x466ad8);}return null;})[_0x8767('0x33')](function(_0x10db0c){var _0x1dd376='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x10db0c[_0x8767('0x24')][_0x8767('0x7a')];return db[_0x8767('0x68')][_0x8767('0x3e')](_0x1dd376,{'type':db['Sequelize'][_0x8767('0x69')][_0x8767('0x7b')],'raw':!![]})['then'](function(_0x15c309){return _0x15c309;});})[_0x8767('0x33')](function(_0x2479fe){if(_0x2479fe){_0x466ad8[_0x8767('0x24')][_0x8767('0x7c')]=_0x2479fe[0x0];if(!_0x266b92[_0x8767('0x54')]['UserId'])return;return db[_0x8767('0x6a')][_0x8767('0x52')]({'where':{'id':_0x266b92['body'][_0x8767('0x5c')],'role':_0x8767('0x5e')},'attributes':['id',_0x8767('0x35'),_0x8767('0x7d'),_0x8767('0x6b'),_0x8767('0x6c')],'raw':!![]});}return null;})[_0x8767('0x33')](function(_0x43b227){if(!_0x43b227)return null;_0x466ad8[_0x8767('0x24')][_0x8767('0x5e')]=_0x43b227;return _0x466ad8;})[_0x8767('0x33')](function(_0x1b4309){if(_0x1b4309){_0x1b4309[_0x8767('0x24')][_0x8767('0x6e')]=util[_0x8767('0x5a')](_0x8767('0x6f'),_0x266b92[_0x8767('0x5d')][_0x8767('0x35')]);_0x1b4309[_0x8767('0x24')][_0x8767('0x70')]=_0x466ad8['channel'];_0x1b4309[_0x8767('0x24')][_0x8767('0x71')]=_0x466ad8[_0x8767('0x70')];_0x1b4309[_0x8767('0x24')][_0x8767('0x72')]=_0x8767('0x76');respondWithRpcPromise(_0x8767('0x73'),'EventManager',{'event':_0x8767('0x7e'),'message':_[_0x8767('0x49')](_0x466ad8['message'],JSON['parse'](_0x466ad8['interaction'][_0x8767('0x75')]))},client9002);return _0x466ad8;}return null;})[_0x8767('0x33')](respondWithResult(_0x51371c,null))['catch'](handleError(_0x51371c,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 3f74914..f2676ea 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 _0x0b1a=['exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x191f9d,_0x21976f){var _0x58e60d=function(_0x598c0d){while(--_0x598c0d){_0x191f9d['push'](_0x191f9d['shift']());}};_0x58e60d(++_0x21976f);}(_0x0b1a,0x83));var _0xa0b1=function(_0x5ca179,_0x4af352){_0x5ca179=_0x5ca179-0x0;var _0x5819bf=_0x0b1a[_0x5ca179];return _0x5819bf;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xa0b1('0x0'))['db'][_0xa0b1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa0b1('0x2')](0x0);var events={'afterCreate':_0xa0b1('0x3'),'afterUpdate':_0xa0b1('0x4'),'afterDestroy':_0xa0b1('0x5')};function emitEvent(_0x2896b7){return function(_0x227e4c,_0x267ad7,_0x5ea955){ChatMessageEvents[_0xa0b1('0x6')](_0x2896b7+':'+_0x227e4c['id'],_0x227e4c);ChatMessageEvents[_0xa0b1('0x6')](_0x2896b7,_0x227e4c);_0x5ea955(null);};}for(var e in events){if(events[_0xa0b1('0x7')](e)){var event=events[e];ChatMessage[_0xa0b1('0x8')](e,emitEvent(event));}}module[_0xa0b1('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x0a2d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x25135a,_0xe0b757){var _0x7c4cb4=function(_0x2fdb0b){while(--_0x2fdb0b){_0x25135a['push'](_0x25135a['shift']());}};_0x7c4cb4(++_0xe0b757);}(_0x0a2d,0x17b));var _0xd0a2=function(_0x17b3b8,_0x54e57f){_0x17b3b8=_0x17b3b8-0x0;var _0x8f6f84=_0x0a2d[_0x17b3b8];return _0x8f6f84;};'use strict';var EventEmitter=require(_0xd0a2('0x0'));var ChatMessage=require(_0xd0a2('0x1'))['db'][_0xd0a2('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xd0a2('0x3')](0x0);var events={'afterCreate':_0xd0a2('0x4'),'afterUpdate':_0xd0a2('0x5'),'afterDestroy':_0xd0a2('0x6')};function emitEvent(_0x54ecba){return function(_0x87863c,_0x319b12,_0x31aa2f){ChatMessageEvents[_0xd0a2('0x7')](_0x54ecba+':'+_0x87863c['id'],_0x87863c);ChatMessageEvents[_0xd0a2('0x7')](_0x54ecba,_0x87863c);_0x31aa2f(null);};}for(var e in events){if(events[_0xd0a2('0x8')](e)){var event=events[e];ChatMessage[_0xd0a2('0x9')](e,emitEvent(event));}}module[_0xd0a2('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index aece3ff..36ee2de 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 _0x47ab=['createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','then','update'];(function(_0x22a1d6,_0x2a2c5b){var _0x524796=function(_0x331af2){while(--_0x331af2){_0x22a1d6['push'](_0x22a1d6['shift']());}};_0x524796(++_0x2a2c5b);}(_0x47ab,0xeb));var _0xb47a=function(_0x371a2b,_0x13fa1d){_0x371a2b=_0x371a2b-0x0;var _0x277bf0=_0x47ab[_0x371a2b];return _0x277bf0;};'use strict';var _=require(_0xb47a('0x0'));var util=require(_0xb47a('0x1'));var logger=require(_0xb47a('0x2'))(_0xb47a('0x3'));var moment=require('moment');var BPromise=require(_0xb47a('0x4'));var rp=require(_0xb47a('0x5'));var fs=require('fs');var path=require(_0xb47a('0x6'));var rimraf=require(_0xb47a('0x7'));var config=require(_0xb47a('0x8'));var attributes=require(_0xb47a('0x9'));module[_0xb47a('0xa')]=function(_0x4a811a,_0x36ea4d){return _0x4a811a[_0xb47a('0xb')](_0xb47a('0xc'),attributes,{'tableName':_0xb47a('0xd'),'paranoid':![],'indexes':[{'name':_0xb47a('0xe'),'fields':['body'],'type':_0xb47a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4788b8,_0x435c77,_0x59c3fc){var _0x54df46=_0x4a811a[_0xb47a('0x10')];var _0x48e2ca=_0x4788b8[_0xb47a('0x11')]({'plain':!![]});if(_0x48e2ca[_0xb47a('0x12')][_0xb47a('0x13')]()==='in'||_0x48e2ca['direction']['toLowerCase']()===_0xb47a('0x14')&&!_0x48e2ca[_0xb47a('0x15')]&&!_[_0xb47a('0x16')](_0x48e2ca['UserId'])){_0x54df46['ChatInteraction'][_0xb47a('0x17')]({'where':{'id':_0x48e2ca['ChatInteractionId']}})[_0xb47a('0x18')](function(_0x4c3582){if(_0x4c3582){_0x4c3582[_0xb47a('0x19')]({'lastMsgAt':_0x48e2ca[_0xb47a('0x1a')],'lastMsgDirection':_0x48e2ca[_0xb47a('0x12')][_0xb47a('0x13')]()});}})['catch'](function(_0x39649c){console[_0xb47a('0x1b')](_0x39649c);});}_0x59c3fc();}},'charset':'utf8mb4','collate':_0xb47a('0x1c')});}; \ No newline at end of file +var _0x7080=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4bd6f6,_0x35e6cf){var _0x156c68=function(_0x25743c){while(--_0x25743c){_0x4bd6f6['push'](_0x4bd6f6['shift']());}};_0x156c68(++_0x35e6cf);}(_0x7080,0xa0));var _0x0708=function(_0x1a381e,_0x3030ab){_0x1a381e=_0x1a381e-0x0;var _0x4d0482=_0x7080[_0x1a381e];return _0x4d0482;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0708('0x0'))(_0x0708('0x1'));var moment=require(_0x0708('0x2'));var BPromise=require(_0x0708('0x3'));var rp=require(_0x0708('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0708('0x5'));var config=require(_0x0708('0x6'));var attributes=require(_0x0708('0x7'));module[_0x0708('0x8')]=function(_0x485d5a,_0x278cab){return _0x485d5a[_0x0708('0x9')](_0x0708('0xa'),attributes,{'tableName':_0x0708('0xb'),'paranoid':![],'indexes':[{'name':_0x0708('0xc'),'fields':[_0x0708('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x373275,_0x4caf37,_0x1426c4){var _0xb01bf7=_0x485d5a[_0x0708('0xe')];var _0x49275b=_0x373275[_0x0708('0xf')]({'plain':!![]});if(_0x49275b[_0x0708('0x10')][_0x0708('0x11')]()==='in'||_0x49275b['direction']['toLowerCase']()===_0x0708('0x12')&&!_0x49275b[_0x0708('0x13')]&&!_[_0x0708('0x14')](_0x49275b[_0x0708('0x15')])){_0xb01bf7[_0x0708('0x16')][_0x0708('0x17')]({'where':{'id':_0x49275b[_0x0708('0x18')]}})[_0x0708('0x19')](function(_0x4a8827){if(_0x4a8827){_0x4a8827[_0x0708('0x1a')]({'lastMsgAt':_0x49275b[_0x0708('0x1b')],'lastMsgDirection':_0x49275b[_0x0708('0x10')][_0x0708('0x11')]()});}})[_0x0708('0x1c')](function(_0x3d5b1c){console[_0x0708('0x1d')](_0x3d5b1c);});}_0x1426c4();}},'charset':_0x0708('0x1e'),'collate':_0x0708('0x1f')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d6c4ba9..c9eb710 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 _0x5d6d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateChatMessage','ChatMessage','create','options','raw','debug','lodash'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0x5d6d,0x1ee));var _0xd5d6=function(_0x14d365,_0x40b446){_0x14d365=_0x14d365-0x0;var _0x4e6550=_0x5d6d[_0x14d365];return _0x4e6550;};'use strict';var _=require(_0xd5d6('0x0'));var util=require(_0xd5d6('0x1'));var moment=require(_0xd5d6('0x2'));var BPromise=require(_0xd5d6('0x3'));var rs=require(_0xd5d6('0x4'));var fs=require('fs');var Redis=require(_0xd5d6('0x5'));var db=require(_0xd5d6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd5d6('0x7'));var config=require(_0xd5d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd5d6('0x9')][_0xd5d6('0xa')]({'port':0x232a});config[_0xd5d6('0xb')]=_[_0xd5d6('0xc')](config[_0xd5d6('0xb')],{'host':_0xd5d6('0xd'),'port':0x18eb});var socket=require(_0xd5d6('0xe'))(new Redis(config[_0xd5d6('0xb')]));require(_0xd5d6('0xf'))[_0xd5d6('0x10')](socket);function respondWithRpcPromise(_0x380fad,_0x4c79e3,_0x47e5cc){return new BPromise(function(_0x29be4c,_0x12e8df){return client['request'](_0x380fad,_0x47e5cc)[_0xd5d6('0x11')](function(_0x56e839){logger[_0xd5d6('0x12')](_0xd5d6('0x13'),_0x4c79e3,'request\x20sent');logger['debug'](_0xd5d6('0x14'),_0x4c79e3,_0xd5d6('0x15'),JSON[_0xd5d6('0x16')](_0x56e839));if(_0x56e839[_0xd5d6('0x17')]){if(_0x56e839['error'][_0xd5d6('0x18')]===0x1f4){logger[_0xd5d6('0x17')](_0xd5d6('0x13'),_0x4c79e3,_0x56e839[_0xd5d6('0x17')][_0xd5d6('0x19')]);return _0x12e8df(_0x56e839[_0xd5d6('0x17')][_0xd5d6('0x19')]);}logger[_0xd5d6('0x17')](_0xd5d6('0x13'),_0x4c79e3,_0x56e839[_0xd5d6('0x17')]['message']);return _0x29be4c(_0x56e839[_0xd5d6('0x17')][_0xd5d6('0x19')]);}else{logger[_0xd5d6('0x12')](_0xd5d6('0x13'),_0x4c79e3,_0xd5d6('0x15'));_0x29be4c(_0x56e839['result']['message']);}})[_0xd5d6('0x1a')](function(_0x1574a5){logger[_0xd5d6('0x17')]('ChatMessage,\x20%s,\x20%s',_0x4c79e3,_0x1574a5);_0x12e8df(_0x1574a5);});});}exports[_0xd5d6('0x1b')]=function(_0x450160){var _0x428053=this;return new Promise(function(_0x48b2f8,_0x3b3148){return db[_0xd5d6('0x1c')][_0xd5d6('0x1d')](_0x450160['body'],{'raw':_0x450160[_0xd5d6('0x1e')]?_0x450160[_0xd5d6('0x1e')][_0xd5d6('0x1f')]===undefined?!![]:![]:!![]})[_0xd5d6('0x11')](function(_0x8ebc0d){logger['info'](_0xd5d6('0x1b'),_0x450160);logger[_0xd5d6('0x20')](_0xd5d6('0x1b'),_0x450160,JSON[_0xd5d6('0x16')](_0x8ebc0d));_0x48b2f8(_0x8ebc0d);})[_0xd5d6('0x1a')](function(_0x4ab0f8){logger[_0xd5d6('0x17')]('CreateChatMessage',_0x4ab0f8[_0xd5d6('0x19')],_0x450160);_0x3b3148(_0x428053['error'](0x1f4,_0x4ab0f8[_0xd5d6('0x19')]));});});}; \ No newline at end of file +var _0x54ad=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x535a1a,_0x5a2408){var _0x1cf22c=function(_0x4a54bb){while(--_0x4a54bb){_0x535a1a['push'](_0x535a1a['shift']());}};_0x1cf22c(++_0x5a2408);}(_0x54ad,0xf0));var _0xd54a=function(_0xbfab4a,_0x469323){_0xbfab4a=_0xbfab4a-0x0;var _0x95f8cb=_0x54ad[_0xbfab4a];return _0x95f8cb;};'use strict';var _=require(_0xd54a('0x0'));var util=require(_0xd54a('0x1'));var moment=require(_0xd54a('0x2'));var BPromise=require(_0xd54a('0x3'));var rs=require(_0xd54a('0x4'));var fs=require('fs');var Redis=require(_0xd54a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd54a('0x6'));var logger=require(_0xd54a('0x7'))(_0xd54a('0x8'));var config=require(_0xd54a('0x9'));var jayson=require(_0xd54a('0xa'));var client=jayson[_0xd54a('0xb')][_0xd54a('0xc')]({'port':0x232a});config[_0xd54a('0xd')]=_[_0xd54a('0xe')](config[_0xd54a('0xd')],{'host':_0xd54a('0xf'),'port':0x18eb});var socket=require(_0xd54a('0x10'))(new Redis(config[_0xd54a('0xd')]));require('./chatMessage.socket')[_0xd54a('0x11')](socket);function respondWithRpcPromise(_0x880a45,_0x2f8b83,_0x5f48c4){return new BPromise(function(_0x2906d8,_0x5d6a56){return client[_0xd54a('0x12')](_0x880a45,_0x5f48c4)[_0xd54a('0x13')](function(_0x3bbb0e){logger[_0xd54a('0x14')](_0xd54a('0x15'),_0x2f8b83,_0xd54a('0x16'));logger['debug'](_0xd54a('0x17'),_0x2f8b83,_0xd54a('0x16'),JSON[_0xd54a('0x18')](_0x3bbb0e));if(_0x3bbb0e[_0xd54a('0x19')]){if(_0x3bbb0e[_0xd54a('0x19')][_0xd54a('0x1a')]===0x1f4){logger['error'](_0xd54a('0x15'),_0x2f8b83,_0x3bbb0e[_0xd54a('0x19')]['message']);return _0x5d6a56(_0x3bbb0e[_0xd54a('0x19')][_0xd54a('0x1b')]);}logger['error'](_0xd54a('0x15'),_0x2f8b83,_0x3bbb0e['error']['message']);return _0x2906d8(_0x3bbb0e[_0xd54a('0x19')][_0xd54a('0x1b')]);}else{logger[_0xd54a('0x14')](_0xd54a('0x15'),_0x2f8b83,'request\x20sent');_0x2906d8(_0x3bbb0e[_0xd54a('0x1c')]['message']);}})[_0xd54a('0x1d')](function(_0x25b122){logger[_0xd54a('0x19')]('ChatMessage,\x20%s,\x20%s',_0x2f8b83,_0x25b122);_0x5d6a56(_0x25b122);});});}exports[_0xd54a('0x1e')]=function(_0x119da7){var _0x3a3e5b=this;return new Promise(function(_0x38d0ec,_0xac9263){return db[_0xd54a('0x1f')][_0xd54a('0x20')](_0x119da7[_0xd54a('0x21')],{'raw':_0x119da7[_0xd54a('0x22')]?_0x119da7['options'][_0xd54a('0x23')]===undefined?!![]:![]:!![]})['then'](function(_0x5d78ad){logger['info'](_0xd54a('0x1e'),_0x119da7);logger['debug'](_0xd54a('0x1e'),_0x119da7,JSON[_0xd54a('0x18')](_0x5d78ad));_0x38d0ec(_0x5d78ad);})['catch'](function(_0x14ade6){logger[_0xd54a('0x19')](_0xd54a('0x1e'),_0x14ade6[_0xd54a('0x1b')],_0x119da7);_0xac9263(_0x3a3e5b[_0xd54a('0x19')](0x1f4,_0x14ade6[_0xd54a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d7ee300..5c3fd84 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 _0x6075=['remove','update','emit','register','chatMessage:','save'];(function(_0x36f641,_0x1a3063){var _0x39b299=function(_0x20c0a3){while(--_0x20c0a3){_0x36f641['push'](_0x36f641['shift']());}};_0x39b299(++_0x1a3063);}(_0x6075,0x191));var _0x5607=function(_0x116fc7,_0xa81f1){_0x116fc7=_0x116fc7-0x0;var _0x335c28=_0x6075[_0x116fc7];return _0x335c28;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5607('0x0'),_0x5607('0x1'),_0x5607('0x2')];function createListener(_0x24427f,_0x2bcf4e){return function(_0x120ba2){_0x2bcf4e[_0x5607('0x3')](_0x24427f,_0x120ba2);};}function removeListener(_0x100852,_0x2a1c03){return function(){ChatMessageEvents['removeListener'](_0x100852,_0x2a1c03);};}exports[_0x5607('0x4')]=function(_0xabf691){for(var _0x14b9f4=0x0,_0x5ab18d=events['length'];_0x14b9f4<_0x5ab18d;_0x14b9f4++){var _0x3dc860=events[_0x14b9f4];var _0x25107d=createListener(_0x5607('0x5')+_0x3dc860,_0xabf691);ChatMessageEvents['on'](_0x3dc860,_0x25107d);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x142a07,_0x251e3c){var _0x101b6d=function(_0xcc9433){while(--_0xcc9433){_0x142a07['push'](_0x142a07['shift']());}};_0x101b6d(++_0x251e3c);}(_0x9829,0xc4));var _0x9982=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x9829[_0x2d994d];return _0xd54be4;};'use strict';var ChatMessageEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){ChatMessageEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);ChatMessageEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c7d5708..3b42a1d 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 _0xdf11=['../../components/interaction/service','./chatMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','create','put','/:id/accept','accept','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x6e875f,_0x852030){var _0x2e5ca6=function(_0x5741a2){while(--_0x5741a2){_0x6e875f['push'](_0x6e875f['shift']());}};_0x2e5ca6(++_0x852030);}(_0xdf11,0xe2));var _0x1df1=function(_0x566666,_0x762a3){_0x566666=_0x566666-0x0;var _0x56d2d5=_0xdf11[_0x566666];return _0x56d2d5;};'use strict';var multer=require(_0x1df1('0x0'));var util=require(_0x1df1('0x1'));var path=require(_0x1df1('0x2'));var timeout=require(_0x1df1('0x3'));var express=require(_0x1df1('0x4'));var router=express[_0x1df1('0x5')]();var fs_extra=require(_0x1df1('0x6'));var auth=require(_0x1df1('0x7'));var interaction=require(_0x1df1('0x8'));var config=require('../../config/environment');var controller=require(_0x1df1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1df1('0xa')]);router[_0x1df1('0xb')](_0x1df1('0xc'),auth[_0x1df1('0xd')](),controller[_0x1df1('0xe')]);router[_0x1df1('0xb')](_0x1df1('0xf'),auth['isAuthenticated'](),controller[_0x1df1('0x10')]);router[_0x1df1('0x11')]('/',auth[_0x1df1('0xd')](),interaction[_0x1df1('0x12')]('chat','chatmessage:create'),controller[_0x1df1('0x13')]);router[_0x1df1('0x14')](_0x1df1('0xf'),controller['update']);router[_0x1df1('0x14')](_0x1df1('0x15'),auth[_0x1df1('0xd')](),controller[_0x1df1('0x16')]);router['put']('/:id/reject',auth[_0x1df1('0xd')](),controller['reject']);router[_0x1df1('0x17')](_0x1df1('0xf'),auth[_0x1df1('0xd')](),controller[_0x1df1('0x18')]);module[_0x1df1('0x19')]=router; \ No newline at end of file +var _0x97e2=['/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x5ad61b,_0x10b776){var _0x36b137=function(_0x5238e3){while(--_0x5238e3){_0x5ad61b['push'](_0x5ad61b['shift']());}};_0x36b137(++_0x10b776);}(_0x97e2,0x78));var _0x297e=function(_0x28184d,_0x4297cc){_0x28184d=_0x28184d-0x0;var _0x28a500=_0x97e2[_0x28184d];return _0x28a500;};'use strict';var multer=require(_0x297e('0x0'));var util=require('util');var path=require(_0x297e('0x1'));var timeout=require(_0x297e('0x2'));var express=require(_0x297e('0x3'));var router=express['Router']();var fs_extra=require(_0x297e('0x4'));var auth=require(_0x297e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x297e('0x6'));var controller=require(_0x297e('0x7'));router[_0x297e('0x8')]('/',auth[_0x297e('0x9')](),controller['index']);router[_0x297e('0x8')](_0x297e('0xa'),auth[_0x297e('0x9')](),controller[_0x297e('0xb')]);router['get'](_0x297e('0xc'),auth[_0x297e('0x9')](),controller[_0x297e('0xd')]);router[_0x297e('0xe')]('/',auth['isAuthenticated'](),interaction[_0x297e('0xf')](_0x297e('0x10'),'chatmessage:create'),controller[_0x297e('0x11')]);router[_0x297e('0x12')](_0x297e('0xc'),controller[_0x297e('0x13')]);router[_0x297e('0x12')](_0x297e('0x14'),auth['isAuthenticated'](),controller[_0x297e('0x15')]);router['put'](_0x297e('0x16'),auth[_0x297e('0x9')](),controller[_0x297e('0x17')]);router[_0x297e('0x18')](_0x297e('0xc'),auth[_0x297e('0x9')](),controller[_0x297e('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c01df3a..5b02902 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['medium','TEXT','exports'];(function(_0x530deb,_0x38fda8){var _0x4b3c9a=function(_0x4cbaf4){while(--_0x4cbaf4){_0x530deb['push'](_0x530deb['shift']());}};_0x4b3c9a(++_0x38fda8);}(_0xadb5,0xad));var _0x5adb=function(_0x51deb9,_0x20cf4e){_0x51deb9=_0x51deb9-0x0;var _0x13a9c4=_0xadb5[_0x51deb9];return _0x13a9c4;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x24885d,_0x1c0716){var _0x4e3fc2=function(_0x126b99){while(--_0x126b99){_0x24885d['push'](_0x24885d['shift']());}};_0x4e3fc2(++_0x1c0716);}(_0xadb5,0xad));var _0x5adb=function(_0x102466,_0x1937e6){_0x102466=_0x102466-0x0;var _0x1f457d=_0xadb5[_0x102466];return _0x1f457d;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 061119d..4213bd4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x22f5f3,_0x5dddba){var _0x5339f9=function(_0x211707){while(--_0x211707){_0x22f5f3['push'](_0x22f5f3['shift']());}};_0x5339f9(++_0x5dddba);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x7a54,0x106));var _0x47a5=function(_0x5a7421,_0x40b228){_0x5a7421=_0x5a7421-0x0;var _0x5df9a0=_0x7a54[_0x5a7421];return _0x5df9a0;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index bd42779..4b7c214 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 _0x0e4b=['emit','hasOwnProperty','exports','events','ChatOfflineMessage','update','remove'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x0e4b,0x1d1));var _0xb0e4=function(_0x2d0614,_0x325d18){_0x2d0614=_0x2d0614-0x0;var _0x133390=_0x0e4b[_0x2d0614];return _0x133390;};'use strict';var EventEmitter=require(_0xb0e4('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xb0e4('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb0e4('0x2'),'afterDestroy':_0xb0e4('0x3')};function emitEvent(_0x38ba7b){return function(_0x5d85ce,_0x343b89,_0x11a0b8){ChatOfflineMessageEvents[_0xb0e4('0x4')](_0x38ba7b+':'+_0x5d85ce['id'],_0x5d85ce);ChatOfflineMessageEvents[_0xb0e4('0x4')](_0x38ba7b,_0x5d85ce);_0x11a0b8(null);};}for(var e in events){if(events[_0xb0e4('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xb0e4('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x2c27=['../../mysqldb','ChatOfflineMessage','save','update','emit','hasOwnProperty','exports','events'];(function(_0x23c90f,_0x3504e9){var _0x9891de=function(_0x10f49e){while(--_0x10f49e){_0x23c90f['push'](_0x23c90f['shift']());}};_0x9891de(++_0x3504e9);}(_0x2c27,0x9f));var _0x72c2=function(_0x4b188e,_0x22d05a){_0x4b188e=_0x4b188e-0x0;var _0x56ae37=_0x2c27[_0x4b188e];return _0x56ae37;};'use strict';var EventEmitter=require(_0x72c2('0x0'));var ChatOfflineMessage=require(_0x72c2('0x1'))['db'][_0x72c2('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x72c2('0x3'),'afterUpdate':_0x72c2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x18d6c3){return function(_0x12cb79,_0x11efcb,_0x2786b9){ChatOfflineMessageEvents[_0x72c2('0x5')](_0x18d6c3+':'+_0x12cb79['id'],_0x12cb79);ChatOfflineMessageEvents[_0x72c2('0x5')](_0x18d6c3,_0x12cb79);_0x2786b9(null);};}for(var e in events){if(events[_0x72c2('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x72c2('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 05b1e4b..00a496e 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 _0x4ad2=['exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x4e601b,_0x5f337f){var _0xe04188=function(_0x242dee){while(--_0x242dee){_0x4e601b['push'](_0x4e601b['shift']());}};_0xe04188(++_0x5f337f);}(_0x4ad2,0x89));var _0x24ad=function(_0x2d4aeb,_0x382aed){_0x2d4aeb=_0x2d4aeb-0x0;var _0x3dbddd=_0x4ad2[_0x2d4aeb];return _0x3dbddd;};'use strict';var attributes=require(_0x24ad('0x0'));module[_0x24ad('0x1')]=function(_0x5ada1c){return _0x5ada1c[_0x24ad('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x24ad('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x24ad('0x4'),'collate':_0x24ad('0x5')});}; \ No newline at end of file +var _0x24db=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','exports'];(function(_0xf48693,_0x435864){var _0x1e009d=function(_0x238dc3){while(--_0x238dc3){_0xf48693['push'](_0xf48693['shift']());}};_0x1e009d(++_0x435864);}(_0x24db,0x11f));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xb24d('0x0')]=function(_0x238d42){return _0x238d42['define'](_0xb24d('0x1'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb24d('0x2'),'collate':_0xb24d('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1512029..326ffbd 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 _0x7345=['../../config/logger','../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','randomstring','../../config/utils'];(function(_0x1f43d9,_0x5df4d2){var _0x59974d=function(_0x145c73){while(--_0x145c73){_0x1f43d9['push'](_0x1f43d9['shift']());}};_0x59974d(++_0x5df4d2);}(_0x7345,0x163));var _0x5734=function(_0x4cd7e1,_0x5e7cff){_0x4cd7e1=_0x4cd7e1-0x0;var _0x7de25=_0x7345[_0x4cd7e1];return _0x7de25;};'use strict';var _=require(_0x5734('0x0'));var util=require(_0x5734('0x1'));var moment=require(_0x5734('0x2'));var BPromise=require('bluebird');var rs=require(_0x5734('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5734('0x4'));var logger=require(_0x5734('0x5'))('rpc');var config=require(_0x5734('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5734('0x7')][_0x5734('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x469af9,_0x213e18,_0x1b7db1){return new BPromise(function(_0x3142ff,_0x335d4d){return client[_0x5734('0x9')](_0x469af9,_0x1b7db1)['then'](function(_0x54be6d){logger[_0x5734('0xa')](_0x5734('0xb'),_0x213e18,'request\x20sent');logger[_0x5734('0xc')](_0x5734('0xd'),_0x213e18,_0x5734('0xe'),JSON['stringify'](_0x54be6d));if(_0x54be6d[_0x5734('0xf')]){if(_0x54be6d[_0x5734('0xf')][_0x5734('0x10')]===0x1f4){logger[_0x5734('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x213e18,_0x54be6d['error'][_0x5734('0x11')]);return _0x335d4d(_0x54be6d['error'][_0x5734('0x11')]);}logger[_0x5734('0xf')](_0x5734('0xb'),_0x213e18,_0x54be6d['error'][_0x5734('0x11')]);return _0x3142ff(_0x54be6d[_0x5734('0xf')][_0x5734('0x11')]);}else{logger[_0x5734('0xa')](_0x5734('0xb'),_0x213e18,_0x5734('0xe'));_0x3142ff(_0x54be6d['result'][_0x5734('0x11')]);}})['catch'](function(_0x4f3dc3){logger['error'](_0x5734('0xb'),_0x213e18,_0x4f3dc3);_0x335d4d(_0x4f3dc3);});});} \ No newline at end of file +var _0x19d0=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x19d0,0xd9));var _0x019d=function(_0x7c7037,_0x57d8da){_0x7c7037=_0x7c7037-0x0;var _0x285571=_0x19d0[_0x7c7037];return _0x285571;};'use strict';var _=require(_0x019d('0x0'));var util=require(_0x019d('0x1'));var moment=require(_0x019d('0x2'));var BPromise=require(_0x019d('0x3'));var rs=require(_0x019d('0x4'));var fs=require('fs');var Redis=require(_0x019d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x019d('0x6'));var logger=require(_0x019d('0x7'))(_0x019d('0x8'));var config=require(_0x019d('0x9'));var jayson=require(_0x019d('0xa'));var client=jayson[_0x019d('0xb')][_0x019d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a4d46,_0x42fc6d,_0x11d2a9){return new BPromise(function(_0x2526ea,_0x1aabc8){return client[_0x019d('0xd')](_0x3a4d46,_0x11d2a9)[_0x019d('0xe')](function(_0x36f195){logger[_0x019d('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x42fc6d,_0x019d('0x10'));logger[_0x019d('0x11')](_0x019d('0x12'),_0x42fc6d,_0x019d('0x10'),JSON[_0x019d('0x13')](_0x36f195));if(_0x36f195[_0x019d('0x14')]){if(_0x36f195['error'][_0x019d('0x15')]===0x1f4){logger['error'](_0x019d('0x16'),_0x42fc6d,_0x36f195['error'][_0x019d('0x17')]);return _0x1aabc8(_0x36f195[_0x019d('0x14')][_0x019d('0x17')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x42fc6d,_0x36f195[_0x019d('0x14')][_0x019d('0x17')]);return _0x2526ea(_0x36f195['error'][_0x019d('0x17')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x42fc6d,_0x019d('0x10'));_0x2526ea(_0x36f195['result']['message']);}})[_0x019d('0x18')](function(_0x281058){logger['error'](_0x019d('0x16'),_0x42fc6d,_0x281058);_0x1aabc8(_0x281058);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 2d4983c..1327a19 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 _0xd99f=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','create','put','delete'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd99f,0x1f0));var _0xfd99=function(_0x575c39,_0x30a993){_0x575c39=_0x575c39-0x0;var _0x613cc6=_0xd99f[_0x575c39];return _0x613cc6;};'use strict';var multer=require(_0xfd99('0x0'));var util=require(_0xfd99('0x1'));var path=require(_0xfd99('0x2'));var timeout=require(_0xfd99('0x3'));var express=require(_0xfd99('0x4'));var router=express[_0xfd99('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd99('0x6'));var config=require(_0xfd99('0x7'));var controller=require(_0xfd99('0x8'));router[_0xfd99('0x9')]('/',auth[_0xfd99('0xa')](),controller['index']);router['get'](_0xfd99('0xb'),auth['isAuthenticated'](),controller[_0xfd99('0xc')]);router[_0xfd99('0x9')](_0xfd99('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xfd99('0xe')]);router[_0xfd99('0xf')](_0xfd99('0xd'),auth[_0xfd99('0xa')](),controller['update']);router[_0xfd99('0x10')]('/:id',auth[_0xfd99('0xa')](),controller[_0xfd99('0x11')]);module[_0xfd99('0x12')]=router; \ No newline at end of file +var _0xc275=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc275,0x141));var _0x5c27=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc275[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0x5c27('0x0'));var util=require(_0x5c27('0x1'));var path=require(_0x5c27('0x2'));var timeout=require(_0x5c27('0x3'));var express=require('express');var router=express[_0x5c27('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5c27('0x5'));var config=require(_0x5c27('0x6'));var controller=require(_0x5c27('0x7'));router[_0x5c27('0x8')]('/',auth['isAuthenticated'](),controller[_0x5c27('0x9')]);router[_0x5c27('0x8')]('/describe',auth[_0x5c27('0xa')](),controller[_0x5c27('0xb')]);router[_0x5c27('0x8')](_0x5c27('0xc'),auth[_0x5c27('0xa')](),controller[_0x5c27('0xd')]);router[_0x5c27('0xe')]('/',auth[_0x5c27('0xa')](),controller[_0x5c27('0xf')]);router[_0x5c27('0x10')]('/:id',auth[_0x5c27('0xa')](),controller['update']);router[_0x5c27('0x11')](_0x5c27('0xc'),auth[_0x5c27('0xa')](),controller[_0x5c27('0x12')]);module[_0x5c27('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f9f1e90..2eb9dc3 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 _0xf5e9=['STRING','ENUM','mouseOver','INTEGER','exports'];(function(_0x1f9eca,_0x2e91c1){var _0x351b19=function(_0x20afc6){while(--_0x20afc6){_0x1f9eca['push'](_0x1f9eca['shift']());}};_0x351b19(++_0x2e91c1);}(_0xf5e9,0x1d5));var _0x9f5e=function(_0x6bc26,_0x59d229){_0x6bc26=_0x6bc26-0x0;var _0x420728=_0xf5e9[_0x6bc26];return _0x420728;};'use strict';var Sequelize=require('sequelize');module[_0x9f5e('0x0')]={'name':{'type':Sequelize[_0x9f5e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9f5e('0x2')](_0x9f5e('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x9f5e('0x1')]},'timeout':{'type':Sequelize[_0x9f5e('0x4')]}}; \ No newline at end of file +var _0x7d9c=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x7d9c,0x94));var _0xc7d9=function(_0x19fea7,_0x2031b5){_0x19fea7=_0x19fea7-0x0;var _0x4707df=_0x7d9c[_0x19fea7];return _0x4707df;};'use strict';var Sequelize=require(_0xc7d9('0x0'));module[_0xc7d9('0x1')]={'name':{'type':Sequelize[_0xc7d9('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc7d9('0x3')](_0xc7d9('0x4'),_0xc7d9('0x5')),'defaultValue':_0xc7d9('0x4')},'selector':{'type':Sequelize[_0xc7d9('0x2')]},'timeout':{'type':Sequelize[_0xc7d9('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 3b9b083..a128572 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 _0x3baf=['ChatProactiveAction','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','params','rawAttributes','query','model','attributes','intersection','fields','length','includeAll','include','options','catch','create','body'];(function(_0x4a68d5,_0x41dc37){var _0x5a6c7e=function(_0x44fd05){while(--_0x44fd05){_0x4a68d5['push'](_0x4a68d5['shift']());}};_0x5a6c7e(++_0x41dc37);}(_0x3baf,0xf7));var _0xf3ba=function(_0x2d8c90,_0xebac28){_0x2d8c90=_0x2d8c90-0x0;var _0x118c87=_0x3baf[_0x2d8c90];return _0x118c87;};'use strict';var emlformat=require(_0xf3ba('0x0'));var rimraf=require(_0xf3ba('0x1'));var zipdir=require(_0xf3ba('0x2'));var jsonpatch=require(_0xf3ba('0x3'));var rp=require(_0xf3ba('0x4'));var moment=require(_0xf3ba('0x5'));var BPromise=require(_0xf3ba('0x6'));var Mustache=require(_0xf3ba('0x7'));var util=require(_0xf3ba('0x8'));var path=require(_0xf3ba('0x9'));var sox=require(_0xf3ba('0xa'));var csv=require(_0xf3ba('0xb'));var ejs=require(_0xf3ba('0xc'));var fs=require('fs');var fs_extra=require(_0xf3ba('0xd'));var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var licenseUtil=require(_0xf3ba('0x1b'));var db=require(_0xf3ba('0x1c'))['db'];function respondWithStatusCode(_0x85939e,_0x26cefe){_0x26cefe=_0x26cefe||0xcc;return function(_0x17673a){if(_0x17673a){return _0x85939e[_0xf3ba('0x1d')](_0x26cefe);}return _0x85939e[_0xf3ba('0x1e')](_0x26cefe)['end']();};}function respondWithResult(_0x327675,_0x56816b){_0x56816b=_0x56816b||0xc8;return function(_0x815037){if(_0x815037){return _0x327675[_0xf3ba('0x1e')](_0x56816b)[_0xf3ba('0x1f')](_0x815037);}};}function respondWithFilteredResult(_0x1e2969,_0x235c8a){return function(_0x53f848){if(_0x53f848){var _0x301856=typeof _0x235c8a[_0xf3ba('0x20')]===_0xf3ba('0x21')&&typeof _0x235c8a['limit']===_0xf3ba('0x21');var _0x11fbd2=_0x53f848[_0xf3ba('0x22')];var _0x44de40=_0x301856?0x0:_0x235c8a['offset'];var _0x1e18ed=_0x301856?_0x53f848[_0xf3ba('0x22')]:_0x235c8a['offset']+_0x235c8a['limit'];var _0x35a03c;if(_0x1e18ed>=_0x11fbd2){_0x1e18ed=_0x11fbd2;_0x35a03c=0xc8;}else{_0x35a03c=0xce;}_0x1e2969[_0xf3ba('0x1e')](_0x35a03c);return _0x1e2969[_0xf3ba('0x23')]('Content-Range',_0x44de40+'-'+_0x1e18ed+'/'+_0x11fbd2)[_0xf3ba('0x1f')](_0x53f848);}return null;};}function patchUpdates(_0x327723){return function(_0x35d6d4){try{jsonpatch[_0xf3ba('0x24')](_0x35d6d4,_0x327723,!![]);}catch(_0x23a744){return BPromise[_0xf3ba('0x25')](_0x23a744);}return _0x35d6d4[_0xf3ba('0x26')]();};}function saveUpdates(_0x4caf74,_0x4e94a7){return function(_0x4a065a){if(_0x4a065a){return _0x4a065a[_0xf3ba('0x27')](_0x4caf74)[_0xf3ba('0x28')](function(_0x6f538f){return _0x6f538f;});}return null;};}function removeEntity(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(_0x545ee1){return _0x545ee1['destroy']()[_0xf3ba('0x28')](function(){_0x3b6404[_0xf3ba('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9d6a,_0x37cba1){return function(_0x59ce48){if(!_0x59ce48){_0x1c9d6a['sendStatus'](0x194);}return _0x59ce48;};}function handleError(_0x396089,_0x7effa1){_0x7effa1=_0x7effa1||0x1f4;return function(_0x5f1709){logger[_0xf3ba('0x29')](_0x5f1709[_0xf3ba('0x2a')]);if(_0x5f1709[_0xf3ba('0x2b')]){delete _0x5f1709['name'];}_0x396089[_0xf3ba('0x1e')](_0x7effa1)['send'](_0x5f1709);};}exports['show']=function(_0x7c1a60,_0x19ef2c){var _0x5b4e0d={'raw':!![],'where':{'id':_0x7c1a60[_0xf3ba('0x2c')]['id']}},_0x41c4b1={};_0x41c4b1['model']=_['keys'](db['ChatProactiveAction'][_0xf3ba('0x2d')]);_0x41c4b1[_0xf3ba('0x2e')]=_['keys'](_0x7c1a60[_0xf3ba('0x2e')]);_0x41c4b1['filters']=_['intersection'](_0x41c4b1[_0xf3ba('0x2f')],_0x41c4b1[_0xf3ba('0x2e')]);_0x5b4e0d[_0xf3ba('0x30')]=_[_0xf3ba('0x31')](_0x41c4b1[_0xf3ba('0x2f')],qs[_0xf3ba('0x32')](_0x7c1a60['query'][_0xf3ba('0x32')]));_0x5b4e0d['attributes']=_0x5b4e0d[_0xf3ba('0x30')][_0xf3ba('0x33')]?_0x5b4e0d['attributes']:_0x41c4b1[_0xf3ba('0x2f')];if(_0x7c1a60[_0xf3ba('0x2e')][_0xf3ba('0x34')]){_0x5b4e0d[_0xf3ba('0x35')]=[{'all':!![]}];}_0x5b4e0d=_['merge']({},_0x5b4e0d,_0x7c1a60[_0xf3ba('0x36')]);return db['ChatProactiveAction']['find'](_0x5b4e0d)['then'](handleEntityNotFound(_0x19ef2c,null))[_0xf3ba('0x28')](respondWithResult(_0x19ef2c,null))[_0xf3ba('0x37')](handleError(_0x19ef2c,null));};exports[_0xf3ba('0x38')]=function(_0x38e691,_0x3bab98){return db['ChatProactiveAction'][_0xf3ba('0x38')](_0x38e691['body'],{})[_0xf3ba('0x28')](respondWithResult(_0x3bab98,0xc9))['catch'](handleError(_0x3bab98,null));};exports[_0xf3ba('0x27')]=function(_0x4355fe,_0x4232e0){if(_0x4355fe[_0xf3ba('0x39')]['id']){delete _0x4355fe['body']['id'];}return db[_0xf3ba('0x3a')][_0xf3ba('0x3b')]({'where':{'id':_0x4355fe['params']['id']}})[_0xf3ba('0x28')](handleEntityNotFound(_0x4232e0,null))[_0xf3ba('0x28')](saveUpdates(_0x4355fe[_0xf3ba('0x39')],null))[_0xf3ba('0x28')](respondWithResult(_0x4232e0,null))[_0xf3ba('0x37')](handleError(_0x4232e0,null));};exports[_0xf3ba('0x3c')]=function(_0x148b43,_0x4d4f3d){return db[_0xf3ba('0x3a')]['find']({'where':{'id':_0x148b43[_0xf3ba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4d4f3d,null))[_0xf3ba('0x28')](removeEntity(_0x4d4f3d,null))[_0xf3ba('0x37')](handleError(_0x4d4f3d,null));}; \ No newline at end of file +var _0xc2d6=['request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','status','send','show','params','keys','ChatProactiveAction','rawAttributes','query','attributes','intersection','fields','include','merge','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch'];(function(_0x29b257,_0x2c9433){var _0x45b8f9=function(_0xb5c7bc){while(--_0xb5c7bc){_0x29b257['push'](_0x29b257['shift']());}};_0x45b8f9(++_0x2c9433);}(_0xc2d6,0x171));var _0x6c2d=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc2d6[_0x187ee1];return _0x388160;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c2d('0x0'));var zipdir=require(_0x6c2d('0x1'));var jsonpatch=require(_0x6c2d('0x2'));var rp=require(_0x6c2d('0x3'));var moment=require(_0x6c2d('0x4'));var BPromise=require(_0x6c2d('0x5'));var Mustache=require(_0x6c2d('0x6'));var util=require(_0x6c2d('0x7'));var path=require(_0x6c2d('0x8'));var sox=require(_0x6c2d('0x9'));var csv=require('to-csv');var ejs=require(_0x6c2d('0xa'));var fs=require('fs');var fs_extra=require(_0x6c2d('0xb'));var _=require(_0x6c2d('0xc'));var squel=require('squel');var crypto=require(_0x6c2d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c2d('0xe'));var toCsv=require(_0x6c2d('0xf'));var querystring=require(_0x6c2d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6c2d('0x11'));var qs=require(_0x6c2d('0x12'));var as=require(_0x6c2d('0x13'));var hardwareService=require(_0x6c2d('0x14'));var logger=require('../../config/logger')(_0x6c2d('0x15'));var utils=require(_0x6c2d('0x16'));var config=require(_0x6c2d('0x17'));var licenseUtil=require(_0x6c2d('0x18'));var db=require(_0x6c2d('0x19'))['db'];function respondWithStatusCode(_0x177240,_0x5ccd68){_0x5ccd68=_0x5ccd68||0xcc;return function(_0x5be11c){if(_0x5be11c){return _0x177240[_0x6c2d('0x1a')](_0x5ccd68);}return _0x177240['status'](_0x5ccd68)[_0x6c2d('0x1b')]();};}function respondWithResult(_0x4632b3,_0x2b6dbf){_0x2b6dbf=_0x2b6dbf||0xc8;return function(_0x5ca11d){if(_0x5ca11d){return _0x4632b3['status'](_0x2b6dbf)[_0x6c2d('0x1c')](_0x5ca11d);}};}function respondWithFilteredResult(_0x500f62,_0x2e9475){return function(_0x109eef){if(_0x109eef){var _0x28ff75=typeof _0x2e9475[_0x6c2d('0x1d')]===_0x6c2d('0x1e')&&typeof _0x2e9475[_0x6c2d('0x1f')]==='undefined';var _0x1f75b5=_0x109eef[_0x6c2d('0x20')];var _0xc70f8e=_0x28ff75?0x0:_0x2e9475[_0x6c2d('0x1d')];var _0x37ecbe=_0x28ff75?_0x109eef[_0x6c2d('0x20')]:_0x2e9475[_0x6c2d('0x1d')]+_0x2e9475[_0x6c2d('0x1f')];var _0x4785c9;if(_0x37ecbe>=_0x1f75b5){_0x37ecbe=_0x1f75b5;_0x4785c9=0xc8;}else{_0x4785c9=0xce;}_0x500f62['status'](_0x4785c9);return _0x500f62[_0x6c2d('0x21')](_0x6c2d('0x22'),_0xc70f8e+'-'+_0x37ecbe+'/'+_0x1f75b5)['json'](_0x109eef);}return null;};}function patchUpdates(_0xe941d9){return function(_0x1f3941){try{jsonpatch[_0x6c2d('0x23')](_0x1f3941,_0xe941d9,!![]);}catch(_0x580395){return BPromise[_0x6c2d('0x24')](_0x580395);}return _0x1f3941[_0x6c2d('0x25')]();};}function saveUpdates(_0x494053,_0x3354c2){return function(_0x236656){if(_0x236656){return _0x236656[_0x6c2d('0x26')](_0x494053)['then'](function(_0x17b078){return _0x17b078;});}return null;};}function removeEntity(_0x440b48,_0x595a42){return function(_0x5ea17f){if(_0x5ea17f){return _0x5ea17f[_0x6c2d('0x27')]()[_0x6c2d('0x28')](function(){_0x440b48['status'](0xcc)[_0x6c2d('0x1b')]();});}};}function handleEntityNotFound(_0x70fec3,_0x530c9d){return function(_0x6b81d4){if(!_0x6b81d4){_0x70fec3['sendStatus'](0x194);}return _0x6b81d4;};}function handleError(_0x230478,_0x3b9c71){_0x3b9c71=_0x3b9c71||0x1f4;return function(_0x1b3b0b){logger[_0x6c2d('0x29')](_0x1b3b0b[_0x6c2d('0x2a')]);if(_0x1b3b0b[_0x6c2d('0x2b')]){delete _0x1b3b0b[_0x6c2d('0x2b')];}_0x230478[_0x6c2d('0x2c')](_0x3b9c71)[_0x6c2d('0x2d')](_0x1b3b0b);};}exports[_0x6c2d('0x2e')]=function(_0x3c8d61,_0x3eb54e){var _0x5571ba={'raw':!![],'where':{'id':_0x3c8d61[_0x6c2d('0x2f')]['id']}},_0x15ad57={};_0x15ad57['model']=_[_0x6c2d('0x30')](db[_0x6c2d('0x31')][_0x6c2d('0x32')]);_0x15ad57[_0x6c2d('0x33')]=_[_0x6c2d('0x30')](_0x3c8d61[_0x6c2d('0x33')]);_0x15ad57['filters']=_['intersection'](_0x15ad57['model'],_0x15ad57[_0x6c2d('0x33')]);_0x5571ba[_0x6c2d('0x34')]=_[_0x6c2d('0x35')](_0x15ad57['model'],qs['fields'](_0x3c8d61['query'][_0x6c2d('0x36')]));_0x5571ba['attributes']=_0x5571ba['attributes']['length']?_0x5571ba[_0x6c2d('0x34')]:_0x15ad57['model'];if(_0x3c8d61[_0x6c2d('0x33')]['includeAll']){_0x5571ba[_0x6c2d('0x37')]=[{'all':!![]}];}_0x5571ba=_[_0x6c2d('0x38')]({},_0x5571ba,_0x3c8d61[_0x6c2d('0x39')]);return db[_0x6c2d('0x31')][_0x6c2d('0x3a')](_0x5571ba)[_0x6c2d('0x28')](handleEntityNotFound(_0x3eb54e,null))[_0x6c2d('0x28')](respondWithResult(_0x3eb54e,null))['catch'](handleError(_0x3eb54e,null));};exports[_0x6c2d('0x3b')]=function(_0x1be862,_0x4c1cd4){return db['ChatProactiveAction'][_0x6c2d('0x3b')](_0x1be862[_0x6c2d('0x3c')],{})['then'](respondWithResult(_0x4c1cd4,0xc9))[_0x6c2d('0x3d')](handleError(_0x4c1cd4,null));};exports[_0x6c2d('0x26')]=function(_0x38b5e2,_0xbf3ea2){if(_0x38b5e2[_0x6c2d('0x3c')]['id']){delete _0x38b5e2[_0x6c2d('0x3c')]['id'];}return db[_0x6c2d('0x31')][_0x6c2d('0x3a')]({'where':{'id':_0x38b5e2[_0x6c2d('0x2f')]['id']}})[_0x6c2d('0x28')](handleEntityNotFound(_0xbf3ea2,null))[_0x6c2d('0x28')](saveUpdates(_0x38b5e2['body'],null))['then'](respondWithResult(_0xbf3ea2,null))['catch'](handleError(_0xbf3ea2,null));};exports[_0x6c2d('0x27')]=function(_0x411905,_0x1516db){return db['ChatProactiveAction'][_0x6c2d('0x3a')]({'where':{'id':_0x411905[_0x6c2d('0x2f')]['id']}})[_0x6c2d('0x28')](handleEntityNotFound(_0x1516db,null))[_0x6c2d('0x28')](removeEntity(_0x1516db,null))['catch'](handleError(_0x1516db,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6af9c12..aafa95a 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 _0x5b1d=['bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','moment'];(function(_0x1233d1,_0x15cf04){var _0x56ee5e=function(_0x470ed9){while(--_0x470ed9){_0x1233d1['push'](_0x1233d1['shift']());}};_0x56ee5e(++_0x15cf04);}(_0x5b1d,0xb3));var _0xd5b1=function(_0x4347e7,_0x308a8b){_0x4347e7=_0x4347e7-0x0;var _0x4b0fc7=_0x5b1d[_0x4347e7];return _0x4b0fc7;};'use strict';var _=require(_0xd5b1('0x0'));var util=require(_0xd5b1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd5b1('0x2'));var BPromise=require(_0xd5b1('0x3'));var rp=require(_0xd5b1('0x4'));var fs=require('fs');var path=require(_0xd5b1('0x5'));var rimraf=require(_0xd5b1('0x6'));var config=require(_0xd5b1('0x7'));var attributes=require(_0xd5b1('0x8'));module[_0xd5b1('0x9')]=function(_0x2c2c47,_0x1366b8){return _0x2c2c47[_0xd5b1('0xa')](_0xd5b1('0xb'),attributes,{'tableName':_0xd5b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc33a=['./chatProactiveAction.attributes','exports','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x205bea,_0x4695f2){var _0x59e5a3=function(_0x5d80f5){while(--_0x5d80f5){_0x205bea['push'](_0x205bea['shift']());}};_0x59e5a3(++_0x4695f2);}(_0xc33a,0x11b));var _0xac33=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc33a[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xac33('0x0'));var util=require(_0xac33('0x1'));var logger=require(_0xac33('0x2'))('api');var moment=require(_0xac33('0x3'));var BPromise=require(_0xac33('0x4'));var rp=require(_0xac33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac33('0x6'));var attributes=require(_0xac33('0x7'));module[_0xac33('0x8')]=function(_0x237899,_0x375e77){return _0x237899['define']('ChatProactiveAction',attributes,{'tableName':_0xac33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index d813938..fdfd7dc 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 _0x51e6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x51e6,0xa4));var _0x651e=function(_0x1e1d07,_0x299b1e){_0x1e1d07=_0x1e1d07-0x0;var _0x225dce=_0x51e6[_0x1e1d07];return _0x225dce;};'use strict';var _=require(_0x651e('0x0'));var util=require(_0x651e('0x1'));var moment=require(_0x651e('0x2'));var BPromise=require(_0x651e('0x3'));var rs=require(_0x651e('0x4'));var fs=require('fs');var Redis=require(_0x651e('0x5'));var db=require(_0x651e('0x6'))['db'];var utils=require(_0x651e('0x7'));var logger=require(_0x651e('0x8'))(_0x651e('0x9'));var config=require(_0x651e('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x651e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1708eb,_0x39ce33,_0x402b95){return new BPromise(function(_0x4741be,_0x24f0cc){return client[_0x651e('0xc')](_0x1708eb,_0x402b95)[_0x651e('0xd')](function(_0x405eb3){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x39ce33,'request\x20sent');logger[_0x651e('0xe')](_0x651e('0xf'),_0x39ce33,'request\x20sent',JSON[_0x651e('0x10')](_0x405eb3));if(_0x405eb3[_0x651e('0x11')]){if(_0x405eb3[_0x651e('0x11')][_0x651e('0x12')]===0x1f4){logger[_0x651e('0x11')](_0x651e('0x13'),_0x39ce33,_0x405eb3['error'][_0x651e('0x14')]);return _0x24f0cc(_0x405eb3[_0x651e('0x11')][_0x651e('0x14')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x39ce33,_0x405eb3[_0x651e('0x11')]['message']);return _0x4741be(_0x405eb3['error'][_0x651e('0x14')]);}else{logger[_0x651e('0x15')](_0x651e('0x13'),_0x39ce33,_0x651e('0x16'));_0x4741be(_0x405eb3[_0x651e('0x17')][_0x651e('0x14')]);}})['catch'](function(_0x1d147b){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x39ce33,_0x1d147b);_0x24f0cc(_0x1d147b);});});} \ No newline at end of file +var _0x0b07=['client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2c699e,_0x5e9d6c){var _0x5844e3=function(_0x45b361){while(--_0x45b361){_0x2c699e['push'](_0x2c699e['shift']());}};_0x5844e3(++_0x5e9d6c);}(_0x0b07,0x7d));var _0x70b0=function(_0x3130b5,_0x23faf7){_0x3130b5=_0x3130b5-0x0;var _0xa6d8a3=_0x0b07[_0x3130b5];return _0xa6d8a3;};'use strict';var _=require(_0x70b0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x70b0('0x1'));var rs=require(_0x70b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70b0('0x3'))['db'];var utils=require(_0x70b0('0x4'));var logger=require(_0x70b0('0x5'))(_0x70b0('0x6'));var config=require('../../config/environment');var jayson=require(_0x70b0('0x7'));var client=jayson[_0x70b0('0x8')][_0x70b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24c534,_0x38b9cc,_0xbb2391){return new BPromise(function(_0x4d88b7,_0x3f333d){return client[_0x70b0('0xa')](_0x24c534,_0xbb2391)['then'](function(_0x196434){logger['info'](_0x70b0('0xb'),_0x38b9cc,_0x70b0('0xc'));logger['debug'](_0x70b0('0xd'),_0x38b9cc,_0x70b0('0xc'),JSON['stringify'](_0x196434));if(_0x196434[_0x70b0('0xe')]){if(_0x196434[_0x70b0('0xe')]['code']===0x1f4){logger[_0x70b0('0xe')](_0x70b0('0xb'),_0x38b9cc,_0x196434[_0x70b0('0xe')][_0x70b0('0xf')]);return _0x3f333d(_0x196434[_0x70b0('0xe')]['message']);}logger[_0x70b0('0xe')](_0x70b0('0xb'),_0x38b9cc,_0x196434[_0x70b0('0xe')][_0x70b0('0xf')]);return _0x4d88b7(_0x196434[_0x70b0('0xe')][_0x70b0('0xf')]);}else{logger[_0x70b0('0x10')](_0x70b0('0xb'),_0x38b9cc,_0x70b0('0xc'));_0x4d88b7(_0x196434[_0x70b0('0x11')][_0x70b0('0xf')]);}})[_0x70b0('0x12')](function(_0x3e06f8){logger[_0x70b0('0xe')](_0x70b0('0xb'),_0x38b9cc,_0x3e06f8);_0x3f333d(_0x3e06f8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3f34272..9ee831e 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 _0x9957=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0xc')]);router[_0x7995('0xd')]('/',auth['isAuthenticated'](),controller[_0x7995('0xe')]);router[_0x7995('0xf')]('/:id',auth[_0x7995('0xb')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')](_0x7995('0xa'),auth[_0x7995('0xb')](),controller[_0x7995('0x12')]);module[_0x7995('0x13')]=router; \ No newline at end of file +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(_0x54f978,_0x3a6b7e){var _0x5d40b3=function(_0x44b545){while(--_0x44b545){_0x54f978['push'](_0x54f978['shift']());}};_0x5d40b3(++_0x3a6b7e);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'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 diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4af03c9..c24a805 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 _0x7092=['INTEGER','ENUM','beepall','roundrobin','sequelize','name','STRING'];(function(_0x23ffc7,_0x2636a2){var _0x10c679=function(_0x4c3676){while(--_0x4c3676){_0x23ffc7['push'](_0x23ffc7['shift']());}};_0x10c679(++_0x2636a2);}(_0x7092,0x123));var _0x2709=function(_0x52000a,_0x320b14){_0x52000a=_0x52000a-0x0;var _0x5017be=_0x7092[_0x52000a];return _0x5017be;};'use strict';var Sequelize=require(_0x2709('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2709('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2709('0x2')]},'timeout':{'type':Sequelize[_0x2709('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2709('0x4')]('rrmemory',_0x2709('0x5'),_0x2709('0x6'))}}; \ No newline at end of file +var _0x2591=['rrmemory','beepall','sequelize','exports','STRING','ENUM'];(function(_0x1e0a84,_0x3332f9){var _0x42caef=function(_0x493802){while(--_0x493802){_0x1e0a84['push'](_0x1e0a84['shift']());}};_0x42caef(++_0x3332f9);}(_0x2591,0x146));var _0x1259=function(_0xfcf2df,_0x54e948){_0xfcf2df=_0xfcf2df-0x0;var _0x2cae25=_0x2591[_0xfcf2df];return _0x2cae25;};'use strict';var Sequelize=require(_0x1259('0x0'));module[_0x1259('0x1')]={'name':{'type':Sequelize[_0x1259('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1259('0x3')](_0x1259('0x4'),_0x1259('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index db1985e..c006e79 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 _0xa404=['path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','limit','count','Content-Range','apply','reject','save','then','destroy','get','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','hasOwnProperty','ChatQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','forEach','userChatQueue:save','removeTeams','select','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x4781d8,_0x34b398){var _0x31966d=function(_0x197b57){while(--_0x197b57){_0x4781d8['push'](_0x4781d8['shift']());}};_0x31966d(++_0x34b398);}(_0xa404,0x11a));var _0x4a40=function(_0x27f3e0,_0x32f92d){_0x27f3e0=_0x27f3e0-0x0;var _0x46bb75=_0xa404[_0x27f3e0];return _0x46bb75;};'use strict';var emlformat=require(_0x4a40('0x0'));var rimraf=require(_0x4a40('0x1'));var zipdir=require(_0x4a40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a40('0x3'));var moment=require(_0x4a40('0x4'));var BPromise=require(_0x4a40('0x5'));var Mustache=require(_0x4a40('0x6'));var util=require(_0x4a40('0x7'));var path=require(_0x4a40('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4a40('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a40('0xa'));var squel=require(_0x4a40('0xb'));var crypto=require(_0x4a40('0xc'));var jsforce=require(_0x4a40('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4a40('0xe'));var querystring=require(_0x4a40('0xf'));var Papa=require('papaparse');var Redis=require(_0x4a40('0x10'));var authService=require(_0x4a40('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4a40('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a40('0x13'))(_0x4a40('0x14'));var utils=require(_0x4a40('0x15'));var config=require(_0x4a40('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a40('0x17'))['db'];config[_0x4a40('0x18')]=_[_0x4a40('0x19')](config[_0x4a40('0x18')],{'host':_0x4a40('0x1a'),'port':0x18eb});var socket=require(_0x4a40('0x1b'))(new Redis(config[_0x4a40('0x18')]));require(_0x4a40('0x1c'))[_0x4a40('0x1d')](socket);var jayson=require(_0x4a40('0x1e'));var client=jayson[_0x4a40('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84d80b,_0x5c4d75,_0x2251a3,_0x4e1cda){return new BPromise(function(_0x3d2114,_0x275dee){var _0x2da0e5=_0x4e1cda||client;return _0x2da0e5[_0x4a40('0x20')](_0x84d80b,_0x2251a3)['then'](function(_0xbf5657){logger[_0x4a40('0x21')]('ChatQueue,\x20%s,\x20%s',_0x5c4d75,_0x4a40('0x22'));logger[_0x4a40('0x23')](_0x4a40('0x24'),_0x5c4d75,_0x4a40('0x22'),JSON[_0x4a40('0x25')](_0xbf5657));if(_0xbf5657[_0x4a40('0x26')]){if(_0xbf5657[_0x4a40('0x26')]['code']===0x1f4){logger[_0x4a40('0x26')](_0x4a40('0x27'),_0x5c4d75,_0xbf5657[_0x4a40('0x26')][_0x4a40('0x28')]);return _0x275dee(_0xbf5657[_0x4a40('0x26')][_0x4a40('0x28')]);}logger[_0x4a40('0x26')](_0x4a40('0x27'),_0x5c4d75,_0xbf5657[_0x4a40('0x26')][_0x4a40('0x28')]);return _0x3d2114(_0xbf5657[_0x4a40('0x26')]['message']);}else{logger[_0x4a40('0x21')](_0x4a40('0x27'),_0x5c4d75,_0x4a40('0x22'));_0x3d2114(_0xbf5657['result'][_0x4a40('0x28')]);}})[_0x4a40('0x29')](function(_0x4d3784){logger[_0x4a40('0x26')](_0x4a40('0x27'),_0x5c4d75,_0x4d3784);_0x275dee(_0x4d3784);});});}function respondWithStatusCode(_0x43b12d,_0x2e6c00){_0x2e6c00=_0x2e6c00||0xcc;return function(_0xcdfdab){if(_0xcdfdab){return _0x43b12d[_0x4a40('0x2a')](_0x2e6c00);}return _0x43b12d[_0x4a40('0x2b')](_0x2e6c00)[_0x4a40('0x2c')]();};}function respondWithResult(_0x54ec65,_0x17174c){_0x17174c=_0x17174c||0xc8;return function(_0x4d5939){if(_0x4d5939){return _0x54ec65[_0x4a40('0x2b')](_0x17174c)['json'](_0x4d5939);}};}function respondWithFilteredResult(_0x604550,_0x5b5437){return function(_0x3138a6){if(_0x3138a6){var _0x5ca50d=typeof _0x5b5437[_0x4a40('0x2d')]==='undefined'&&typeof _0x5b5437[_0x4a40('0x2e')]==='undefined';var _0x177b22=_0x3138a6[_0x4a40('0x2f')];var _0x22ba02=_0x5ca50d?0x0:_0x5b5437[_0x4a40('0x2d')];var _0x420a55=_0x5ca50d?_0x3138a6[_0x4a40('0x2f')]:_0x5b5437[_0x4a40('0x2d')]+_0x5b5437[_0x4a40('0x2e')];var _0x260307;if(_0x420a55>=_0x177b22){_0x420a55=_0x177b22;_0x260307=0xc8;}else{_0x260307=0xce;}_0x604550['status'](_0x260307);return _0x604550['set'](_0x4a40('0x30'),_0x22ba02+'-'+_0x420a55+'/'+_0x177b22)['json'](_0x3138a6);}return null;};}function patchUpdates(_0x5d3edc){return function(_0x2158a2){try{jsonpatch[_0x4a40('0x31')](_0x2158a2,_0x5d3edc,!![]);}catch(_0x197295){return BPromise[_0x4a40('0x32')](_0x197295);}return _0x2158a2[_0x4a40('0x33')]();};}function saveUpdates(_0x2fbd90,_0x3d3761){return function(_0x23f99d){if(_0x23f99d){return _0x23f99d['update'](_0x2fbd90)[_0x4a40('0x34')](function(_0x12c016){return _0x12c016;});}return null;};}function removeEntity(_0xe972e0,_0x12f5e1){return function(_0xa190a7){if(_0xa190a7){return _0xa190a7[_0x4a40('0x35')]()[_0x4a40('0x34')](function(){var _0x12d384=_0xa190a7[_0x4a40('0x36')]({'plain':!![]});var _0x545849='ChatQueues';return db['UserProfileResource'][_0x4a40('0x35')]({'where':{'type':_0x545849,'resourceId':_0x12d384['id']}})[_0x4a40('0x34')](function(){return _0xa190a7;});})[_0x4a40('0x34')](function(){_0xe972e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f6b9,_0x506e08){return function(_0x13540c){if(!_0x13540c){_0x18f6b9[_0x4a40('0x2a')](0x194);}return _0x13540c;};}function handleError(_0x3359ac,_0x4434c0){_0x4434c0=_0x4434c0||0x1f4;return function(_0xcdf7c1){logger['error'](_0xcdf7c1[_0x4a40('0x37')]);if(_0xcdf7c1[_0x4a40('0x38')]){delete _0xcdf7c1[_0x4a40('0x38')];}_0x3359ac[_0x4a40('0x2b')](_0x4434c0)[_0x4a40('0x39')](_0xcdf7c1);};}exports['index']=function(_0x5efd04,_0x2c4b2d){var _0x369318={},_0x4575cd={},_0x3fd079={'count':0x0,'rows':[]};var _0x41a954=_[_0x4a40('0x3a')](db[_0x4a40('0x3b')][_0x4a40('0x3c')],function(_0x59477d){return{'name':_0x59477d[_0x4a40('0x3d')],'type':_0x59477d[_0x4a40('0x3e')][_0x4a40('0x3f')]};});_0x4575cd[_0x4a40('0x40')]=_[_0x4a40('0x3a')](_0x41a954,'name');_0x4575cd['query']=_[_0x4a40('0x41')](_0x5efd04[_0x4a40('0x42')]);_0x4575cd[_0x4a40('0x43')]=_[_0x4a40('0x44')](_0x4575cd[_0x4a40('0x40')],_0x4575cd[_0x4a40('0x42')]);_0x369318[_0x4a40('0x45')]=_['intersection'](_0x4575cd[_0x4a40('0x40')],qs['fields'](_0x5efd04[_0x4a40('0x42')][_0x4a40('0x46')]));_0x369318['attributes']=_0x369318[_0x4a40('0x45')][_0x4a40('0x47')]?_0x369318['attributes']:_0x4575cd[_0x4a40('0x40')];if(!_0x5efd04[_0x4a40('0x42')]['hasOwnProperty'](_0x4a40('0x48'))){_0x369318[_0x4a40('0x2e')]=qs[_0x4a40('0x2e')](_0x5efd04[_0x4a40('0x42')][_0x4a40('0x2e')]);_0x369318[_0x4a40('0x2d')]=qs[_0x4a40('0x2d')](_0x5efd04[_0x4a40('0x42')]['offset']);}_0x369318[_0x4a40('0x49')]=qs[_0x4a40('0x4a')](_0x5efd04['query'][_0x4a40('0x4a')]);_0x369318[_0x4a40('0x4b')]=qs['filters'](_[_0x4a40('0x4c')](_0x5efd04[_0x4a40('0x42')],_0x4575cd[_0x4a40('0x43')]),_0x41a954);if(_0x5efd04[_0x4a40('0x42')][_0x4a40('0x4d')]){_0x369318[_0x4a40('0x4b')]=_['merge'](_0x369318[_0x4a40('0x4b')],{'$or':_['map'](_0x41a954,function(_0x2c4e9d){if(_0x2c4e9d[_0x4a40('0x3e')]!=='VIRTUAL'){var _0x45c5a2={};_0x45c5a2[_0x2c4e9d[_0x4a40('0x38')]]={'$like':'%'+_0x5efd04[_0x4a40('0x42')][_0x4a40('0x4d')]+'%'};return _0x45c5a2;}})});}_0x369318=_[_0x4a40('0x4e')]({},_0x369318,_0x5efd04[_0x4a40('0x4f')]);var _0x18c53b={'where':_0x369318['where']};return db[_0x4a40('0x3b')][_0x4a40('0x2f')](_0x18c53b)['then'](function(_0x40a1b1){_0x3fd079[_0x4a40('0x2f')]=_0x40a1b1;if(_0x5efd04[_0x4a40('0x42')][_0x4a40('0x50')]){_0x369318[_0x4a40('0x51')]=[{'all':!![]}];}return db[_0x4a40('0x3b')][_0x4a40('0x52')](_0x369318);})[_0x4a40('0x34')](function(_0x129a0e){_0x3fd079[_0x4a40('0x53')]=_0x129a0e;return _0x3fd079;})['then'](respondWithFilteredResult(_0x2c4b2d,_0x369318))['catch'](handleError(_0x2c4b2d,null));};exports['show']=function(_0x1b5f4e,_0x4edda1){var _0x52a43a={'raw':!![],'where':{'id':_0x1b5f4e[_0x4a40('0x54')]['id']}},_0x4d0cb4={};_0x4d0cb4[_0x4a40('0x40')]=_['keys'](db[_0x4a40('0x3b')][_0x4a40('0x3c')]);_0x4d0cb4[_0x4a40('0x42')]=_['keys'](_0x1b5f4e[_0x4a40('0x42')]);_0x4d0cb4[_0x4a40('0x43')]=_[_0x4a40('0x44')](_0x4d0cb4['model'],_0x4d0cb4['query']);_0x52a43a['attributes']=_[_0x4a40('0x44')](_0x4d0cb4[_0x4a40('0x40')],qs[_0x4a40('0x46')](_0x1b5f4e[_0x4a40('0x42')][_0x4a40('0x46')]));_0x52a43a[_0x4a40('0x45')]=_0x52a43a[_0x4a40('0x45')]['length']?_0x52a43a[_0x4a40('0x45')]:_0x4d0cb4[_0x4a40('0x40')];if(_0x1b5f4e[_0x4a40('0x42')][_0x4a40('0x50')]){_0x52a43a[_0x4a40('0x51')]=[{'all':!![]}];}_0x52a43a=_[_0x4a40('0x4e')]({},_0x52a43a,_0x1b5f4e['options']);return db[_0x4a40('0x3b')][_0x4a40('0x55')](_0x52a43a)[_0x4a40('0x34')](handleEntityNotFound(_0x4edda1,null))[_0x4a40('0x34')](respondWithResult(_0x4edda1,null))['catch'](handleError(_0x4edda1,null));};exports[_0x4a40('0x56')]=function(_0x2ea976,_0x4b77d1){return db[_0x4a40('0x3b')][_0x4a40('0x56')](_0x2ea976[_0x4a40('0x57')],{})[_0x4a40('0x34')](function(_0x4b0550){var _0x4a664c=_0x2ea976[_0x4a40('0x58')][_0x4a40('0x36')]({'plain':!![]});if(!_0x4a664c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a664c[_0x4a40('0x59')]==='user'){var _0x554260=_0x4b0550[_0x4a40('0x36')]({'plain':!![]});var _0x39d154=_0x4a40('0x5a');return db[_0x4a40('0x5b')][_0x4a40('0x55')]({'where':{'name':_0x39d154,'userProfileId':_0x4a664c[_0x4a40('0x5c')]},'raw':!![]})[_0x4a40('0x34')](function(_0x3546b9){if(_0x3546b9&&_0x3546b9[_0x4a40('0x5d')]===0x0){return db[_0x4a40('0x5e')][_0x4a40('0x56')]({'name':_0x554260['name'],'resourceId':_0x554260['id'],'type':_0x3546b9[_0x4a40('0x38')],'sectionId':_0x3546b9['id']},{})[_0x4a40('0x34')](function(){return _0x4b0550;});}else{return _0x4b0550;}})['catch'](function(_0x4f650d){logger['error'](_0x4a40('0x5f'),_0x4f650d);throw _0x4f650d;});}return _0x4b0550;})['then'](respondWithResult(_0x4b77d1,0xc9))[_0x4a40('0x29')](handleError(_0x4b77d1,null));};exports['update']=function(_0x157a1b,_0x3bebc1){if(_0x157a1b['body']['id']){delete _0x157a1b[_0x4a40('0x57')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x157a1b[_0x4a40('0x54')]['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x3bebc1,null))[_0x4a40('0x34')](saveUpdates(_0x157a1b[_0x4a40('0x57')],null))[_0x4a40('0x34')](respondWithResult(_0x3bebc1,null))[_0x4a40('0x29')](handleError(_0x3bebc1,null));};exports[_0x4a40('0x35')]=function(_0x3919b1,_0x253782){return db[_0x4a40('0x3b')][_0x4a40('0x55')]({'where':{'id':_0x3919b1[_0x4a40('0x54')]['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x253782,null))[_0x4a40('0x34')](removeEntity(_0x253782,null))[_0x4a40('0x29')](handleError(_0x253782,null));};exports[_0x4a40('0x60')]=function(_0x185bf7,_0x296b12){return db[_0x4a40('0x3b')][_0x4a40('0x60')]()[_0x4a40('0x34')](respondWithResult(_0x296b12,null))[_0x4a40('0x29')](handleError(_0x296b12,null));};exports['getMembers']=function(_0xa5097,_0x1ed22b,_0x24f812){var _0x2d138b={'raw':!![],'where':{}},_0x3190fd={},_0x3b344a;return db[_0x4a40('0x3b')][_0x4a40('0x61')]({'where':{'id':_0xa5097['params']['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x1ed22b,null))['then'](function(_0x4b8afd){if(_0x4b8afd){_0x3b344a=_0x4b8afd['get']({'plain':!![]});_0x3190fd[_0x4a40('0x40')]=_[_0x4a40('0x41')](db[_0x4a40('0x62')][_0x4a40('0x3c')]);_0x3190fd[_0x4a40('0x42')]=_[_0x4a40('0x41')](_0xa5097[_0x4a40('0x42')]);_0x3190fd[_0x4a40('0x43')]=_['intersection'](_0x3190fd['model'],_0x3190fd['query']);_0x2d138b[_0x4a40('0x45')]=_[_0x4a40('0x44')](_0x3190fd[_0x4a40('0x40')],qs['fields'](_0xa5097[_0x4a40('0x42')][_0x4a40('0x46')]));_0x2d138b['attributes']=_0x2d138b[_0x4a40('0x45')][_0x4a40('0x47')]?_0x2d138b[_0x4a40('0x45')]:_0x3190fd[_0x4a40('0x40')];if(!_0xa5097[_0x4a40('0x42')][_0x4a40('0x63')](_0x4a40('0x48'))){_0x2d138b[_0x4a40('0x2e')]=qs[_0x4a40('0x2e')](_0xa5097[_0x4a40('0x42')][_0x4a40('0x2e')]);_0x2d138b['offset']=qs[_0x4a40('0x2d')](_0xa5097[_0x4a40('0x42')][_0x4a40('0x2d')]);}_0x2d138b[_0x4a40('0x49')]=qs['sort'](_0xa5097[_0x4a40('0x42')]['sort']);_0x2d138b['where']=qs['filters'](_['pick'](_0xa5097[_0x4a40('0x42')],_0x3190fd['filters']));_0x2d138b['where'][_0x4a40('0x64')]=_0x4b8afd['id'];if(_0xa5097['query'][_0x4a40('0x4d')]){_0x2d138b[_0x4a40('0x4b')]=_['merge'](_0x2d138b[_0x4a40('0x4b')],{'$or':_[_0x4a40('0x3a')](_0x2d138b[_0x4a40('0x45')],function(_0x5c9ea8){var _0x4cdeb3={};_0x4cdeb3[_0x5c9ea8]={'$like':'%'+_0xa5097[_0x4a40('0x42')][_0x4a40('0x4d')]+'%'};return _0x4cdeb3;})});}_0x2d138b=_[_0x4a40('0x4e')]({},_0x2d138b,_0xa5097[_0x4a40('0x4f')]);return db[_0x4a40('0x62')]['findAll'](_0x2d138b);}})[_0x4a40('0x34')](function(_0x488e89){if(_0x488e89){return db[_0x4a40('0x65')]['findAndCountAll']({'where':{'id':_[_0x4a40('0x3a')](_0x488e89,_0x4a40('0x66')),'role':_0x4a40('0x67')},'attributes':['id',_0x4a40('0x38'),'chatPause',_0x4a40('0x68'),_0x4a40('0x69')]});}})['then'](function(_0x2c65ef){if(_0x2c65ef){return{'count':_0x2c65ef[_0x4a40('0x2f')],'rows':_[_0x4a40('0x3a')](_0x2c65ef['rows'],function(_0x4aa79e){return{'membername':_0x4aa79e['name'],'UserId':_0x4aa79e['id'],'queue_name':_0x3b344a['name'],'ChatQueueId':_0x3b344a['id'],'interface':util[_0x4a40('0x6a')](_0x4a40('0x6b'),_0x4a40('0x6c'),_0x4aa79e[_0x4a40('0x38')]),'penalty':0x0,'paused':_0x4aa79e['chatPause'],'createdAt':_0x4aa79e[_0x4a40('0x69')],'updatedAt':_0x4aa79e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4a40('0x34')](respondWithFilteredResult(_0x1ed22b,_0x2d138b))['catch'](handleError(_0x1ed22b,null));};exports['getTeams']=function(_0x31ff43,_0x452359,_0x2d8196){var _0x75fbeb={};var _0x267f0c={};var _0x3755a5;var _0x1ac449;return db['ChatQueue']['findOne']({'where':{'id':_0x31ff43[_0x4a40('0x54')]['id']}})['then'](handleEntityNotFound(_0x452359,null))[_0x4a40('0x34')](function(_0x576a05){if(_0x576a05){_0x3755a5=_0x576a05;_0x267f0c[_0x4a40('0x40')]=_[_0x4a40('0x41')](db[_0x4a40('0x6d')]['rawAttributes']);_0x267f0c[_0x4a40('0x42')]=_[_0x4a40('0x41')](_0x31ff43[_0x4a40('0x42')]);_0x267f0c[_0x4a40('0x43')]=_['intersection'](_0x267f0c[_0x4a40('0x40')],_0x267f0c[_0x4a40('0x42')]);_0x75fbeb[_0x4a40('0x45')]=_[_0x4a40('0x44')](_0x267f0c['model'],qs[_0x4a40('0x46')](_0x31ff43[_0x4a40('0x42')][_0x4a40('0x46')]));_0x75fbeb['attributes']=_0x75fbeb[_0x4a40('0x45')]['length']?_0x75fbeb['attributes']:_0x267f0c[_0x4a40('0x40')];_0x75fbeb[_0x4a40('0x49')]=qs['sort'](_0x31ff43[_0x4a40('0x42')]['sort']);_0x75fbeb[_0x4a40('0x4b')]=qs[_0x4a40('0x43')](_['pick'](_0x31ff43[_0x4a40('0x42')],_0x267f0c[_0x4a40('0x43')]));if(_0x31ff43['query'][_0x4a40('0x4d')]){_0x75fbeb[_0x4a40('0x4b')]=_['merge'](_0x75fbeb[_0x4a40('0x4b')],{'$or':_[_0x4a40('0x3a')](_0x75fbeb[_0x4a40('0x45')],function(_0x33f15e){var _0x1e008b={};_0x1e008b[_0x33f15e]={'$like':'%'+_0x31ff43[_0x4a40('0x42')][_0x4a40('0x4d')]+'%'};return _0x1e008b;})});}_0x75fbeb=_[_0x4a40('0x4e')]({},_0x75fbeb,_0x31ff43[_0x4a40('0x4f')]);return _0x3755a5[_0x4a40('0x6e')](_0x75fbeb);}})[_0x4a40('0x34')](function(_0x391968){if(_0x391968){_0x1ac449=_0x391968['length'];if(!_0x31ff43[_0x4a40('0x42')]['hasOwnProperty'](_0x4a40('0x48'))){_0x75fbeb[_0x4a40('0x2e')]=qs['limit'](_0x31ff43[_0x4a40('0x42')][_0x4a40('0x2e')]);_0x75fbeb[_0x4a40('0x2d')]=qs[_0x4a40('0x2d')](_0x31ff43[_0x4a40('0x42')][_0x4a40('0x2d')]);}return _0x3755a5[_0x4a40('0x6e')](_0x75fbeb);}})[_0x4a40('0x34')](function(_0x428777){if(_0x428777){return _0x428777?{'count':_0x1ac449,'rows':_0x428777}:null;}})[_0x4a40('0x34')](respondWithResult(_0x452359,null))[_0x4a40('0x29')](handleError(_0x452359,null));};exports[_0x4a40('0x6f')]=function(_0x37b0b2,_0x1d09a1,_0x40f770){var _0x150d68=_0x37b0b2[_0x4a40('0x57')][_0x4a40('0x70')];return db[_0x4a40('0x6d')][_0x4a40('0x52')]({'where':{'id':_0x150d68},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4a40('0x71'),'attributes':['id',_0x4a40('0x38'),'online','voicePause',_0x4a40('0x72')],'raw':!![]}]})[_0x4a40('0x34')](function(_0x5d0424){if(_0x5d0424){var _0xc5c6e0=_[_0x4a40('0x73')](_0x5d0424,function(_0x5f0d90){var _0x56fad9=_0x5f0d90[_0x4a40('0x36')]({'plain':!![]});return _0x56fad9['Agents'];});return db[_0x4a40('0x3b')][_0x4a40('0x55')]({'where':{'id':_0x37b0b2['params']['id']}})[_0x4a40('0x34')](function(_0x20cf40){return db[_0x4a40('0x74')][_0x4a40('0x75')](function(_0x582aff){return _0x20cf40[_0x4a40('0x6f')](_0x150d68,{'transaction':_0x582aff})[_0x4a40('0x34')](function(){return BPromise['each'](_0xc5c6e0,function(_0x48e67f){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x48e67f['id'],'ChatQueueId':_0x37b0b2[_0x4a40('0x54')]['id']},'transaction':_0x582aff});});})['then'](function(){_0xc5c6e0[_0x4a40('0x76')](function(_0x33cc26){socket['emit'](_0x4a40('0x77'),{'UserId':_0x33cc26['id'],'ChatQueueId':_0x20cf40['id']});});});});});}})['then'](respondWithStatusCode(_0x1d09a1,null))[_0x4a40('0x29')](handleError(_0x1d09a1,null));};exports[_0x4a40('0x78')]=function(_0x1dac76,_0x49ca9f,_0x2a5aaa){return db[_0x4a40('0x6d')][_0x4a40('0x52')]({'where':{'id':_0x1dac76[_0x4a40('0x42')][_0x4a40('0x70')]},'attributes':['id'],'include':[{'model':db[_0x4a40('0x65')],'as':_0x4a40('0x71'),'attributes':['id'],'raw':!![]}]})[_0x4a40('0x34')](handleEntityNotFound(_0x49ca9f,null))[_0x4a40('0x34')](function(_0x5d7704){var _0x2130be=_[_0x4a40('0x3a')](_0x5d7704,'id');var _0xbab512=[];var _0x2d7bb8=[];var _0x308c2f=squel[_0x4a40('0x79')]();_0x308c2f[_0x4a40('0x7a')]('tq.TeamId')['from'](_0x4a40('0x7b'),'tq')[_0x4a40('0x7c')](_0x4a40('0x7d'),'ut',_0x4a40('0x7e'))['where'](_0x4a40('0x7f'),_0x1dac76[_0x4a40('0x54')]['id']);for(var _0x1defa8=0x0;_0x1defa8<_0x5d7704['length'];_0x1defa8+=0x1){let _0x5da8e3=_0x5d7704[_0x1defa8];for(var _0x541b6b=0x0;_0x541b6b<_0x5da8e3[_0x4a40('0x71')][_0x4a40('0x47')];_0x541b6b+=0x1){let _0x38122c=_0x5da8e3['Agents'][_0x541b6b];var _0xdf38e7=_0x308c2f['clone']();_0xdf38e7[_0x4a40('0x4b')]('ut.UserId\x20=\x20?',_0x38122c['id']);_0x2d7bb8[_0x4a40('0x80')](db[_0x4a40('0x74')][_0x4a40('0x42')](_0xdf38e7['toString'](),{'type':db[_0x4a40('0x74')][_0x4a40('0x81')][_0x4a40('0x82')]})[_0x4a40('0x34')](function(_0x222faa){if(_0x222faa[_0x4a40('0x47')]===0x1){return _0x38122c['id'];}else{var _0x462bb1=_[_0x4a40('0x83')](_[_0x4a40('0x3a')](_0x222faa,_0x4a40('0x84')),function(_0x37a099){return _[_0x4a40('0x85')](_0x2130be,_0x37a099);});if(_0x462bb1){return _0x38122c['id'];}}}));}}return BPromise[_0x4a40('0x86')](_0x2d7bb8)[_0x4a40('0x34')](function(_0x3a7ae7){_0xbab512=_(_0xbab512)[_0x4a40('0x87')](_0x3a7ae7)['compact']()[_0x4a40('0x88')]();return db[_0x4a40('0x3b')]['find']({'where':{'id':_0x1dac76['params']['id']}})[_0x4a40('0x34')](function(_0x2f497e){return db['sequelize'][_0x4a40('0x75')](function(_0x2193f5){return _0x2f497e[_0x4a40('0x78')](_0x1dac76[_0x4a40('0x42')][_0x4a40('0x70')],{'transaction':_0x2193f5})[_0x4a40('0x34')](function(){if(!_[_0x4a40('0x89')](_0xbab512)){return _0x2f497e[_0x4a40('0x8a')](_0xbab512,{'transaction':_0x2193f5});}})[_0x4a40('0x34')](function(){_0xbab512[_0x4a40('0x76')](function(_0x1fafe3){socket[_0x4a40('0x8b')](_0x4a40('0x8c'),{'UserId':_0x1fafe3,'ChatQueueId':_0x2f497e['id']});});});});});});})[_0x4a40('0x34')](respondWithStatusCode(_0x49ca9f,null))['catch'](handleError(_0x49ca9f,null));};exports[_0x4a40('0x8d')]=function(_0x2acc67,_0x5c86d6,_0x24dbaf){return db[_0x4a40('0x3b')][_0x4a40('0x55')]({'where':{'id':_0x2acc67['params']['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x5c86d6,null))[_0x4a40('0x34')](function(_0x1e6669){if(_0x1e6669){return _0x1e6669[_0x4a40('0x8d')](_0x2acc67['body'][_0x4a40('0x70')],_[_0x4a40('0x8e')](_0x2acc67[_0x4a40('0x57')],[_0x4a40('0x70'),'id'])||{})[_0x4a40('0x8f')](function(_0x529663){for(var _0x198012=0x0;_0x198012<_0x2acc67['body'][_0x4a40('0x70')][_0x4a40('0x47')];_0x198012+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x2acc67[_0x4a40('0x57')][_0x4a40('0x70')][_0x198012]),'ChatQueueId':Number(_0x2acc67[_0x4a40('0x54')]['id'])});}return _0x529663;});}})[_0x4a40('0x34')](respondWithResult(_0x5c86d6,null))['catch'](handleError(_0x5c86d6,null));};exports[_0x4a40('0x8a')]=function(_0x5d97d7,_0x459647,_0x39c4ce){return db[_0x4a40('0x3b')]['find']({'where':{'id':_0x5d97d7[_0x4a40('0x54')]['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x459647,null))[_0x4a40('0x34')](function(_0x55277f){if(_0x55277f){return _0x55277f[_0x4a40('0x8a')](_0x5d97d7[_0x4a40('0x42')][_0x4a40('0x70')])[_0x4a40('0x34')](function(){if(_['isArray'](_0x5d97d7[_0x4a40('0x42')][_0x4a40('0x70')])){for(var _0x3c477a=0x0;_0x3c477a<_0x5d97d7[_0x4a40('0x42')][_0x4a40('0x70')][_0x4a40('0x47')];_0x3c477a+=0x1){socket[_0x4a40('0x8b')]('userChatQueue:remove',{'UserId':Number(_0x5d97d7[_0x4a40('0x42')][_0x4a40('0x70')][_0x3c477a]),'ChatQueueId':Number(_0x5d97d7['params']['id'])});}}else{socket['emit'](_0x4a40('0x8c'),{'UserId':Number(_0x5d97d7['query'][_0x4a40('0x70')]),'ChatQueueId':Number(_0x5d97d7['params']['id'])});}});}})[_0x4a40('0x34')](respondWithStatusCode(_0x459647,null))[_0x4a40('0x29')](handleError(_0x459647,null));};exports[_0x4a40('0x90')]=function(_0x3d3ca2,_0x29253b,_0xf2d7a7){var _0xd69e={};var _0x4d2b31={};var _0x179bdd;var _0x589ab7;return db[_0x4a40('0x3b')][_0x4a40('0x61')]({'where':{'id':_0x3d3ca2[_0x4a40('0x54')]['id']}})[_0x4a40('0x34')](handleEntityNotFound(_0x29253b,null))[_0x4a40('0x34')](function(_0x512e7f){if(_0x512e7f){_0x179bdd=_0x512e7f;_0x4d2b31['model']=_[_0x4a40('0x41')](db[_0x4a40('0x65')]['rawAttributes']);_0x4d2b31['query']=_[_0x4a40('0x41')](_0x3d3ca2[_0x4a40('0x42')]);_0x4d2b31[_0x4a40('0x43')]=_[_0x4a40('0x44')](_0x4d2b31[_0x4a40('0x40')],_0x4d2b31['query']);_0xd69e[_0x4a40('0x45')]=_['intersection'](_0x4d2b31[_0x4a40('0x40')],qs[_0x4a40('0x46')](_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x46')]));_0xd69e[_0x4a40('0x45')]=_0xd69e[_0x4a40('0x45')][_0x4a40('0x47')]?_0xd69e[_0x4a40('0x45')]:_0x4d2b31[_0x4a40('0x40')];_0xd69e['order']=qs['sort'](_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x4a')]);_0xd69e[_0x4a40('0x4b')]=qs[_0x4a40('0x43')](_[_0x4a40('0x4c')](_0x3d3ca2[_0x4a40('0x42')],_0x4d2b31[_0x4a40('0x43')]));if(_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x4d')]){_0xd69e['where']=_[_0x4a40('0x4e')](_0xd69e[_0x4a40('0x4b')],{'$or':_['map'](_0xd69e[_0x4a40('0x45')],function(_0x5653cb){var _0x3e20e0={};_0x3e20e0[_0x5653cb]={'$like':'%'+_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x4d')]+'%'};return _0x3e20e0;})});}_0xd69e=_['merge']({},_0xd69e,_0x3d3ca2[_0x4a40('0x4f')]);return _0x179bdd[_0x4a40('0x90')](_0xd69e);}})[_0x4a40('0x34')](function(_0x145337){if(_0x145337){_0x589ab7=_0x145337['length'];if(!_0x3d3ca2[_0x4a40('0x42')]['hasOwnProperty'](_0x4a40('0x48'))){_0xd69e[_0x4a40('0x2e')]=qs[_0x4a40('0x2e')](_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x2e')]);_0xd69e[_0x4a40('0x2d')]=qs[_0x4a40('0x2d')](_0x3d3ca2[_0x4a40('0x42')][_0x4a40('0x2d')]);}return _0x179bdd['getAgents'](_0xd69e);}})[_0x4a40('0x34')](function(_0x1718dc){if(_0x1718dc){return _0x1718dc?{'count':_0x589ab7,'rows':_0x1718dc}:null;}})['then'](respondWithResult(_0x29253b,null))['catch'](handleError(_0x29253b,null));}; \ No newline at end of file +var _0xd2fa=['update','get','destroy','sendStatus','stack','name','index','ChatQueue','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMembers','UserChatQueue','hasOwnProperty','ChatQueueId','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','createdAt','findOne','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','every','all','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x188778,_0x2195e4){var _0x14c245=function(_0x4086c0){while(--_0x4086c0){_0x188778['push'](_0x188778['shift']());}};_0x14c245(++_0x2195e4);}(_0xd2fa,0xf7));var _0xad2f=function(_0x221d94,_0x3b35a3){_0x221d94=_0x221d94-0x0;var _0x3738b6=_0xd2fa[_0x221d94];return _0x3738b6;};'use strict';var emlformat=require(_0xad2f('0x0'));var rimraf=require(_0xad2f('0x1'));var zipdir=require(_0xad2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad2f('0x3'));var moment=require(_0xad2f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xad2f('0x5'));var util=require(_0xad2f('0x6'));var path=require(_0xad2f('0x7'));var sox=require(_0xad2f('0x8'));var csv=require(_0xad2f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad2f('0xa'));var _=require(_0xad2f('0xb'));var squel=require(_0xad2f('0xc'));var crypto=require('crypto');var jsforce=require(_0xad2f('0xd'));var deskjs=require(_0xad2f('0xe'));var toCsv=require(_0xad2f('0x9'));var querystring=require('querystring');var Papa=require(_0xad2f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad2f('0x10'));var as=require(_0xad2f('0x11'));var hardwareService=require(_0xad2f('0x12'));var logger=require('../../config/logger')(_0xad2f('0x13'));var utils=require(_0xad2f('0x14'));var config=require(_0xad2f('0x15'));var licenseUtil=require(_0xad2f('0x16'));var db=require('../../mysqldb')['db'];config[_0xad2f('0x17')]=_[_0xad2f('0x18')](config[_0xad2f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2f('0x19'))(new Redis(config[_0xad2f('0x17')]));require(_0xad2f('0x1a'))[_0xad2f('0x1b')](socket);var jayson=require(_0xad2f('0x1c'));var client=jayson['client'][_0xad2f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2c0675,_0x274413,_0x1dea71,_0x14586f){return new BPromise(function(_0xa51284,_0x54c653){var _0x2bb85c=_0x14586f||client;return _0x2bb85c[_0xad2f('0x1e')](_0x2c0675,_0x1dea71)[_0xad2f('0x1f')](function(_0x3adf0e){logger[_0xad2f('0x20')](_0xad2f('0x21'),_0x274413,_0xad2f('0x22'));logger[_0xad2f('0x23')](_0xad2f('0x24'),_0x274413,_0xad2f('0x22'),JSON[_0xad2f('0x25')](_0x3adf0e));if(_0x3adf0e[_0xad2f('0x26')]){if(_0x3adf0e[_0xad2f('0x26')]['code']===0x1f4){logger[_0xad2f('0x26')](_0xad2f('0x21'),_0x274413,_0x3adf0e[_0xad2f('0x26')][_0xad2f('0x27')]);return _0x54c653(_0x3adf0e['error'][_0xad2f('0x27')]);}logger['error'](_0xad2f('0x21'),_0x274413,_0x3adf0e[_0xad2f('0x26')]['message']);return _0xa51284(_0x3adf0e[_0xad2f('0x26')][_0xad2f('0x27')]);}else{logger[_0xad2f('0x20')](_0xad2f('0x21'),_0x274413,'request\x20sent');_0xa51284(_0x3adf0e[_0xad2f('0x28')][_0xad2f('0x27')]);}})['catch'](function(_0x2b3266){logger[_0xad2f('0x26')]('ChatQueue,\x20%s,\x20%s',_0x274413,_0x2b3266);_0x54c653(_0x2b3266);});});}function respondWithStatusCode(_0x371e9b,_0x49d53b){_0x49d53b=_0x49d53b||0xcc;return function(_0x1a2135){if(_0x1a2135){return _0x371e9b['sendStatus'](_0x49d53b);}return _0x371e9b[_0xad2f('0x29')](_0x49d53b)[_0xad2f('0x2a')]();};}function respondWithResult(_0x567046,_0xd37f23){_0xd37f23=_0xd37f23||0xc8;return function(_0x416c21){if(_0x416c21){return _0x567046[_0xad2f('0x29')](_0xd37f23)[_0xad2f('0x2b')](_0x416c21);}};}function respondWithFilteredResult(_0x203bfa,_0x4a2d4a){return function(_0x9732ea){if(_0x9732ea){var _0x2d236a=typeof _0x4a2d4a[_0xad2f('0x2c')]==='undefined'&&typeof _0x4a2d4a[_0xad2f('0x2d')]===_0xad2f('0x2e');var _0x1d1a87=_0x9732ea['count'];var _0x4e3b74=_0x2d236a?0x0:_0x4a2d4a[_0xad2f('0x2c')];var _0x140bd2=_0x2d236a?_0x9732ea[_0xad2f('0x2f')]:_0x4a2d4a['offset']+_0x4a2d4a[_0xad2f('0x2d')];var _0x3bcc12;if(_0x140bd2>=_0x1d1a87){_0x140bd2=_0x1d1a87;_0x3bcc12=0xc8;}else{_0x3bcc12=0xce;}_0x203bfa[_0xad2f('0x29')](_0x3bcc12);return _0x203bfa[_0xad2f('0x30')](_0xad2f('0x31'),_0x4e3b74+'-'+_0x140bd2+'/'+_0x1d1a87)[_0xad2f('0x2b')](_0x9732ea);}return null;};}function patchUpdates(_0x1a0d1c){return function(_0x32f429){try{jsonpatch[_0xad2f('0x32')](_0x32f429,_0x1a0d1c,!![]);}catch(_0x517ffe){return BPromise[_0xad2f('0x33')](_0x517ffe);}return _0x32f429[_0xad2f('0x34')]();};}function saveUpdates(_0x46fb8f,_0x3988fc){return function(_0x27350d){if(_0x27350d){return _0x27350d[_0xad2f('0x35')](_0x46fb8f)[_0xad2f('0x1f')](function(_0x2b3d64){return _0x2b3d64;});}return null;};}function removeEntity(_0x31b81b,_0x156d4c){return function(_0x5e0f27){if(_0x5e0f27){return _0x5e0f27['destroy']()[_0xad2f('0x1f')](function(){var _0x27c9fb=_0x5e0f27[_0xad2f('0x36')]({'plain':!![]});var _0x45cf3a='ChatQueues';return db['UserProfileResource'][_0xad2f('0x37')]({'where':{'type':_0x45cf3a,'resourceId':_0x27c9fb['id']}})[_0xad2f('0x1f')](function(){return _0x5e0f27;});})[_0xad2f('0x1f')](function(){_0x31b81b[_0xad2f('0x29')](0xcc)[_0xad2f('0x2a')]();});}};}function handleEntityNotFound(_0xd4ce4a,_0x5c552a){return function(_0x1cc19c){if(!_0x1cc19c){_0xd4ce4a[_0xad2f('0x38')](0x194);}return _0x1cc19c;};}function handleError(_0x4cd7aa,_0x431006){_0x431006=_0x431006||0x1f4;return function(_0x128765){logger['error'](_0x128765[_0xad2f('0x39')]);if(_0x128765['name']){delete _0x128765[_0xad2f('0x3a')];}_0x4cd7aa[_0xad2f('0x29')](_0x431006)['send'](_0x128765);};}exports[_0xad2f('0x3b')]=function(_0xea28f7,_0x1e2d7a){var _0x276b45={},_0x156fe9={},_0x11fde1={'count':0x0,'rows':[]};var _0x4f75dc=_['map'](db[_0xad2f('0x3c')][_0xad2f('0x3d')],function(_0x227c17){return{'name':_0x227c17[_0xad2f('0x3e')],'type':_0x227c17[_0xad2f('0x3f')]['key']};});_0x156fe9[_0xad2f('0x40')]=_[_0xad2f('0x41')](_0x4f75dc,_0xad2f('0x3a'));_0x156fe9[_0xad2f('0x42')]=_['keys'](_0xea28f7['query']);_0x156fe9[_0xad2f('0x43')]=_[_0xad2f('0x44')](_0x156fe9[_0xad2f('0x40')],_0x156fe9[_0xad2f('0x42')]);_0x276b45[_0xad2f('0x45')]=_['intersection'](_0x156fe9[_0xad2f('0x40')],qs[_0xad2f('0x46')](_0xea28f7[_0xad2f('0x42')]['fields']));_0x276b45['attributes']=_0x276b45[_0xad2f('0x45')][_0xad2f('0x47')]?_0x276b45[_0xad2f('0x45')]:_0x156fe9[_0xad2f('0x40')];if(!_0xea28f7[_0xad2f('0x42')]['hasOwnProperty'](_0xad2f('0x48'))){_0x276b45[_0xad2f('0x2d')]=qs['limit'](_0xea28f7[_0xad2f('0x42')][_0xad2f('0x2d')]);_0x276b45[_0xad2f('0x2c')]=qs[_0xad2f('0x2c')](_0xea28f7[_0xad2f('0x42')][_0xad2f('0x2c')]);}_0x276b45[_0xad2f('0x49')]=qs[_0xad2f('0x4a')](_0xea28f7[_0xad2f('0x42')][_0xad2f('0x4a')]);_0x276b45['where']=qs['filters'](_[_0xad2f('0x4b')](_0xea28f7[_0xad2f('0x42')],_0x156fe9[_0xad2f('0x43')]),_0x4f75dc);if(_0xea28f7['query'][_0xad2f('0x4c')]){_0x276b45['where']=_[_0xad2f('0x4d')](_0x276b45['where'],{'$or':_['map'](_0x4f75dc,function(_0x545019){if(_0x545019[_0xad2f('0x3f')]!==_0xad2f('0x4e')){var _0x4fb6fd={};_0x4fb6fd[_0x545019[_0xad2f('0x3a')]]={'$like':'%'+_0xea28f7[_0xad2f('0x42')][_0xad2f('0x4c')]+'%'};return _0x4fb6fd;}})});}_0x276b45=_[_0xad2f('0x4d')]({},_0x276b45,_0xea28f7['options']);var _0x4390cd={'where':_0x276b45[_0xad2f('0x4f')]};return db[_0xad2f('0x3c')][_0xad2f('0x2f')](_0x4390cd)[_0xad2f('0x1f')](function(_0x4bd3bb){_0x11fde1[_0xad2f('0x2f')]=_0x4bd3bb;if(_0xea28f7['query'][_0xad2f('0x50')]){_0x276b45[_0xad2f('0x51')]=[{'all':!![]}];}return db[_0xad2f('0x3c')][_0xad2f('0x52')](_0x276b45);})[_0xad2f('0x1f')](function(_0x27881d){_0x11fde1['rows']=_0x27881d;return _0x11fde1;})['then'](respondWithFilteredResult(_0x1e2d7a,_0x276b45))[_0xad2f('0x53')](handleError(_0x1e2d7a,null));};exports[_0xad2f('0x54')]=function(_0x5b4765,_0x4163ab){var _0x473757={'raw':!![],'where':{'id':_0x5b4765[_0xad2f('0x55')]['id']}},_0x192500={};_0x192500[_0xad2f('0x40')]=_[_0xad2f('0x56')](db['ChatQueue'][_0xad2f('0x3d')]);_0x192500[_0xad2f('0x42')]=_['keys'](_0x5b4765[_0xad2f('0x42')]);_0x192500[_0xad2f('0x43')]=_[_0xad2f('0x44')](_0x192500['model'],_0x192500[_0xad2f('0x42')]);_0x473757[_0xad2f('0x45')]=_['intersection'](_0x192500['model'],qs[_0xad2f('0x46')](_0x5b4765[_0xad2f('0x42')][_0xad2f('0x46')]));_0x473757[_0xad2f('0x45')]=_0x473757[_0xad2f('0x45')][_0xad2f('0x47')]?_0x473757[_0xad2f('0x45')]:_0x192500[_0xad2f('0x40')];if(_0x5b4765[_0xad2f('0x42')][_0xad2f('0x50')]){_0x473757[_0xad2f('0x51')]=[{'all':!![]}];}_0x473757=_[_0xad2f('0x4d')]({},_0x473757,_0x5b4765['options']);return db[_0xad2f('0x3c')]['find'](_0x473757)['then'](handleEntityNotFound(_0x4163ab,null))[_0xad2f('0x1f')](respondWithResult(_0x4163ab,null))['catch'](handleError(_0x4163ab,null));};exports[_0xad2f('0x57')]=function(_0x49568b,_0x5d781e){return db[_0xad2f('0x3c')][_0xad2f('0x57')](_0x49568b['body'],{})[_0xad2f('0x1f')](function(_0x55850f){var _0x20fad8=_0x49568b[_0xad2f('0x58')][_0xad2f('0x36')]({'plain':!![]});if(!_0x20fad8)throw new Error(_0xad2f('0x59'));if(_0x20fad8[_0xad2f('0x5a')]===_0xad2f('0x58')){var _0x59bcb4=_0x55850f[_0xad2f('0x36')]({'plain':!![]});var _0x57839d='ChatQueues';return db[_0xad2f('0x5b')][_0xad2f('0x5c')]({'where':{'name':_0x57839d,'userProfileId':_0x20fad8[_0xad2f('0x5d')]},'raw':!![]})[_0xad2f('0x1f')](function(_0x436633){if(_0x436633&&_0x436633['autoAssociation']===0x0){return db['UserProfileResource'][_0xad2f('0x57')]({'name':_0x59bcb4['name'],'resourceId':_0x59bcb4['id'],'type':_0x436633[_0xad2f('0x3a')],'sectionId':_0x436633['id']},{})[_0xad2f('0x1f')](function(){return _0x55850f;});}else{return _0x55850f;}})['catch'](function(_0x81ef9a){logger[_0xad2f('0x26')](_0xad2f('0x5e'),_0x81ef9a);throw _0x81ef9a;});}return _0x55850f;})[_0xad2f('0x1f')](respondWithResult(_0x5d781e,0xc9))['catch'](handleError(_0x5d781e,null));};exports[_0xad2f('0x35')]=function(_0x10ee6c,_0x494c5c){if(_0x10ee6c[_0xad2f('0x5f')]['id']){delete _0x10ee6c[_0xad2f('0x5f')]['id'];}return db['ChatQueue']['find']({'where':{'id':_0x10ee6c[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x494c5c,null))['then'](saveUpdates(_0x10ee6c[_0xad2f('0x5f')],null))[_0xad2f('0x1f')](respondWithResult(_0x494c5c,null))['catch'](handleError(_0x494c5c,null));};exports[_0xad2f('0x37')]=function(_0x2a16ed,_0x40a0b0){return db[_0xad2f('0x3c')]['find']({'where':{'id':_0x2a16ed[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x40a0b0,null))['then'](removeEntity(_0x40a0b0,null))[_0xad2f('0x53')](handleError(_0x40a0b0,null));};exports['describe']=function(_0x5657c1,_0xcb3f95){return db[_0xad2f('0x3c')]['describe']()[_0xad2f('0x1f')](respondWithResult(_0xcb3f95,null))['catch'](handleError(_0xcb3f95,null));};exports[_0xad2f('0x60')]=function(_0x52ab6a,_0x4fe32b,_0x4c2746){var _0x21579e={'raw':!![],'where':{}},_0x529a93={},_0x2bdce0;return db['ChatQueue']['findOne']({'where':{'id':_0x52ab6a[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x4fe32b,null))['then'](function(_0x3fe4b7){if(_0x3fe4b7){_0x2bdce0=_0x3fe4b7['get']({'plain':!![]});_0x529a93['model']=_[_0xad2f('0x56')](db[_0xad2f('0x61')][_0xad2f('0x3d')]);_0x529a93[_0xad2f('0x42')]=_[_0xad2f('0x56')](_0x52ab6a[_0xad2f('0x42')]);_0x529a93[_0xad2f('0x43')]=_[_0xad2f('0x44')](_0x529a93[_0xad2f('0x40')],_0x529a93['query']);_0x21579e[_0xad2f('0x45')]=_['intersection'](_0x529a93['model'],qs[_0xad2f('0x46')](_0x52ab6a['query'][_0xad2f('0x46')]));_0x21579e['attributes']=_0x21579e['attributes'][_0xad2f('0x47')]?_0x21579e[_0xad2f('0x45')]:_0x529a93[_0xad2f('0x40')];if(!_0x52ab6a[_0xad2f('0x42')][_0xad2f('0x62')](_0xad2f('0x48'))){_0x21579e[_0xad2f('0x2d')]=qs[_0xad2f('0x2d')](_0x52ab6a[_0xad2f('0x42')][_0xad2f('0x2d')]);_0x21579e[_0xad2f('0x2c')]=qs[_0xad2f('0x2c')](_0x52ab6a[_0xad2f('0x42')][_0xad2f('0x2c')]);}_0x21579e[_0xad2f('0x49')]=qs[_0xad2f('0x4a')](_0x52ab6a[_0xad2f('0x42')]['sort']);_0x21579e['where']=qs['filters'](_[_0xad2f('0x4b')](_0x52ab6a[_0xad2f('0x42')],_0x529a93['filters']));_0x21579e[_0xad2f('0x4f')][_0xad2f('0x63')]=_0x3fe4b7['id'];if(_0x52ab6a[_0xad2f('0x42')][_0xad2f('0x4c')]){_0x21579e[_0xad2f('0x4f')]=_[_0xad2f('0x4d')](_0x21579e['where'],{'$or':_['map'](_0x21579e[_0xad2f('0x45')],function(_0x1f12da){var _0x4f9b40={};_0x4f9b40[_0x1f12da]={'$like':'%'+_0x52ab6a[_0xad2f('0x42')][_0xad2f('0x4c')]+'%'};return _0x4f9b40;})});}_0x21579e=_[_0xad2f('0x4d')]({},_0x21579e,_0x52ab6a[_0xad2f('0x64')]);return db['UserChatQueue'][_0xad2f('0x52')](_0x21579e);}})['then'](function(_0x345d3b){if(_0x345d3b){return db[_0xad2f('0x65')][_0xad2f('0x66')]({'where':{'id':_[_0xad2f('0x41')](_0x345d3b,_0xad2f('0x67')),'role':_0xad2f('0x68')},'attributes':['id','name',_0xad2f('0x69'),_0xad2f('0x6a'),'createdAt']});}})[_0xad2f('0x1f')](function(_0x4aa84c){if(_0x4aa84c){return{'count':_0x4aa84c[_0xad2f('0x2f')],'rows':_['map'](_0x4aa84c[_0xad2f('0x6b')],function(_0x1de7a9){return{'membername':_0x1de7a9[_0xad2f('0x3a')],'UserId':_0x1de7a9['id'],'queue_name':_0x2bdce0[_0xad2f('0x3a')],'ChatQueueId':_0x2bdce0['id'],'interface':util[_0xad2f('0x6c')]('%s/%s',_0xad2f('0x6d'),_0x1de7a9[_0xad2f('0x3a')]),'penalty':0x0,'paused':_0x1de7a9[_0xad2f('0x69')],'createdAt':_0x1de7a9[_0xad2f('0x6e')],'updatedAt':_0x1de7a9['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xad2f('0x1f')](respondWithFilteredResult(_0x4fe32b,_0x21579e))[_0xad2f('0x53')](handleError(_0x4fe32b,null));};exports['getTeams']=function(_0x17b229,_0x1be51a,_0x40f733){var _0x484276={};var _0xe292dc={};var _0x5a8ca2;var _0x1edc37;return db[_0xad2f('0x3c')][_0xad2f('0x6f')]({'where':{'id':_0x17b229[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x1be51a,null))[_0xad2f('0x1f')](function(_0x15f582){if(_0x15f582){_0x5a8ca2=_0x15f582;_0xe292dc[_0xad2f('0x40')]=_[_0xad2f('0x56')](db[_0xad2f('0x70')][_0xad2f('0x3d')]);_0xe292dc[_0xad2f('0x42')]=_[_0xad2f('0x56')](_0x17b229[_0xad2f('0x42')]);_0xe292dc[_0xad2f('0x43')]=_[_0xad2f('0x44')](_0xe292dc[_0xad2f('0x40')],_0xe292dc[_0xad2f('0x42')]);_0x484276[_0xad2f('0x45')]=_[_0xad2f('0x44')](_0xe292dc[_0xad2f('0x40')],qs[_0xad2f('0x46')](_0x17b229[_0xad2f('0x42')][_0xad2f('0x46')]));_0x484276[_0xad2f('0x45')]=_0x484276[_0xad2f('0x45')][_0xad2f('0x47')]?_0x484276[_0xad2f('0x45')]:_0xe292dc[_0xad2f('0x40')];_0x484276['order']=qs[_0xad2f('0x4a')](_0x17b229[_0xad2f('0x42')][_0xad2f('0x4a')]);_0x484276[_0xad2f('0x4f')]=qs[_0xad2f('0x43')](_[_0xad2f('0x4b')](_0x17b229['query'],_0xe292dc['filters']));if(_0x17b229[_0xad2f('0x42')]['filter']){_0x484276[_0xad2f('0x4f')]=_['merge'](_0x484276[_0xad2f('0x4f')],{'$or':_[_0xad2f('0x41')](_0x484276[_0xad2f('0x45')],function(_0x2a0627){var _0x54465d={};_0x54465d[_0x2a0627]={'$like':'%'+_0x17b229[_0xad2f('0x42')]['filter']+'%'};return _0x54465d;})});}_0x484276=_['merge']({},_0x484276,_0x17b229[_0xad2f('0x64')]);return _0x5a8ca2[_0xad2f('0x71')](_0x484276);}})['then'](function(_0x23f087){if(_0x23f087){_0x1edc37=_0x23f087[_0xad2f('0x47')];if(!_0x17b229[_0xad2f('0x42')][_0xad2f('0x62')](_0xad2f('0x48'))){_0x484276['limit']=qs[_0xad2f('0x2d')](_0x17b229['query'][_0xad2f('0x2d')]);_0x484276['offset']=qs['offset'](_0x17b229[_0xad2f('0x42')][_0xad2f('0x2c')]);}return _0x5a8ca2[_0xad2f('0x71')](_0x484276);}})[_0xad2f('0x1f')](function(_0x4df8f2){if(_0x4df8f2){return _0x4df8f2?{'count':_0x1edc37,'rows':_0x4df8f2}:null;}})['then'](respondWithResult(_0x1be51a,null))['catch'](handleError(_0x1be51a,null));};exports['addTeams']=function(_0x48651e,_0x1ade42,_0x5d9059){var _0x4d2449=_0x48651e[_0xad2f('0x5f')][_0xad2f('0x72')];return db[_0xad2f('0x70')]['findAll']({'where':{'id':_0x4d2449},'attributes':['id'],'include':[{'model':db[_0xad2f('0x65')],'as':_0xad2f('0x73'),'attributes':['id',_0xad2f('0x3a'),_0xad2f('0x74'),_0xad2f('0x75'),_0xad2f('0x76')],'raw':!![]}]})[_0xad2f('0x1f')](function(_0x595346){if(_0x595346){var _0x321092=_[_0xad2f('0x77')](_0x595346,function(_0x521e61){var _0x1addfe=_0x521e61[_0xad2f('0x36')]({'plain':!![]});return _0x1addfe['Agents'];});return db[_0xad2f('0x3c')][_0xad2f('0x5c')]({'where':{'id':_0x48651e[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](function(_0xafc37d){return db[_0xad2f('0x78')][_0xad2f('0x79')](function(_0x43ad44){return _0xafc37d[_0xad2f('0x7a')](_0x4d2449,{'transaction':_0x43ad44})[_0xad2f('0x1f')](function(){return BPromise[_0xad2f('0x7b')](_0x321092,function(_0x1232d9){return db[_0xad2f('0x61')][_0xad2f('0x7c')]({'where':{'UserId':_0x1232d9['id'],'ChatQueueId':_0x48651e[_0xad2f('0x55')]['id']},'transaction':_0x43ad44});});})[_0xad2f('0x1f')](function(){_0x321092['forEach'](function(_0x1f5d02){socket[_0xad2f('0x7d')]('userChatQueue:save',{'UserId':_0x1f5d02['id'],'ChatQueueId':_0xafc37d['id']});});});});});}})[_0xad2f('0x1f')](respondWithStatusCode(_0x1ade42,null))[_0xad2f('0x53')](handleError(_0x1ade42,null));};exports[_0xad2f('0x7e')]=function(_0x10c26d,_0x22b9d4,_0x47af9d){return db[_0xad2f('0x70')]['findAll']({'where':{'id':_0x10c26d['query'][_0xad2f('0x72')]},'attributes':['id'],'include':[{'model':db[_0xad2f('0x65')],'as':_0xad2f('0x73'),'attributes':['id'],'raw':!![]}]})[_0xad2f('0x1f')](handleEntityNotFound(_0x22b9d4,null))[_0xad2f('0x1f')](function(_0x107b7f){var _0x23b4d7=_[_0xad2f('0x41')](_0x107b7f,'id');var _0x3ab757=[];var _0x3e630e=[];var _0x22a09f=squel[_0xad2f('0x7f')]();_0x22a09f[_0xad2f('0x80')](_0xad2f('0x81'))[_0xad2f('0x82')](_0xad2f('0x83'),'tq')[_0xad2f('0x84')](_0xad2f('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xad2f('0x4f')](_0xad2f('0x86'),_0x10c26d[_0xad2f('0x55')]['id']);for(var _0x582e1f=0x0;_0x582e1f<_0x107b7f[_0xad2f('0x47')];_0x582e1f+=0x1){let _0x52faa6=_0x107b7f[_0x582e1f];for(var _0x731bba=0x0;_0x731bba<_0x52faa6[_0xad2f('0x73')][_0xad2f('0x47')];_0x731bba+=0x1){let _0x10bcc6=_0x52faa6[_0xad2f('0x73')][_0x731bba];var _0x478cf7=_0x22a09f[_0xad2f('0x87')]();_0x478cf7[_0xad2f('0x4f')]('ut.UserId\x20=\x20?',_0x10bcc6['id']);_0x3e630e[_0xad2f('0x88')](db['sequelize'][_0xad2f('0x42')](_0x478cf7[_0xad2f('0x89')](),{'type':db[_0xad2f('0x78')]['QueryTypes']['SELECT']})[_0xad2f('0x1f')](function(_0x1a5895){if(_0x1a5895[_0xad2f('0x47')]===0x1){return _0x10bcc6['id'];}else{var _0x952a25=_[_0xad2f('0x8a')](_[_0xad2f('0x41')](_0x1a5895,'TeamId'),function(_0x5ee94f){return _['includes'](_0x23b4d7,_0x5ee94f);});if(_0x952a25){return _0x10bcc6['id'];}}}));}}return BPromise[_0xad2f('0x8b')](_0x3e630e)['then'](function(_0x351319){_0x3ab757=_(_0x3ab757)['union'](_0x351319)['compact']()[_0xad2f('0x8c')]();return db[_0xad2f('0x3c')]['find']({'where':{'id':_0x10c26d['params']['id']}})[_0xad2f('0x1f')](function(_0x2f3d62){return db[_0xad2f('0x78')][_0xad2f('0x79')](function(_0x3c4748){return _0x2f3d62[_0xad2f('0x7e')](_0x10c26d[_0xad2f('0x42')][_0xad2f('0x72')],{'transaction':_0x3c4748})[_0xad2f('0x1f')](function(){if(!_[_0xad2f('0x8d')](_0x3ab757)){return _0x2f3d62[_0xad2f('0x8e')](_0x3ab757,{'transaction':_0x3c4748});}})[_0xad2f('0x1f')](function(){_0x3ab757[_0xad2f('0x8f')](function(_0x17957c){socket['emit'](_0xad2f('0x90'),{'UserId':_0x17957c,'ChatQueueId':_0x2f3d62['id']});});});});});});})['then'](respondWithStatusCode(_0x22b9d4,null))[_0xad2f('0x53')](handleError(_0x22b9d4,null));};exports['addAgents']=function(_0x1b2336,_0x6d18f2,_0x3cb27b){return db[_0xad2f('0x3c')][_0xad2f('0x5c')]({'where':{'id':_0x1b2336[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x6d18f2,null))[_0xad2f('0x1f')](function(_0x56ab34){if(_0x56ab34){return _0x56ab34[_0xad2f('0x91')](_0x1b2336[_0xad2f('0x5f')][_0xad2f('0x72')],_['omit'](_0x1b2336['body'],[_0xad2f('0x72'),'id'])||{})[_0xad2f('0x92')](function(_0x4cc0e3){for(var _0x15f4ca=0x0;_0x15f4ca<_0x1b2336['body']['ids'][_0xad2f('0x47')];_0x15f4ca+=0x1){socket[_0xad2f('0x7d')](_0xad2f('0x93'),{'UserId':Number(_0x1b2336[_0xad2f('0x5f')]['ids'][_0x15f4ca]),'ChatQueueId':Number(_0x1b2336[_0xad2f('0x55')]['id'])});}return _0x4cc0e3;});}})[_0xad2f('0x1f')](respondWithResult(_0x6d18f2,null))['catch'](handleError(_0x6d18f2,null));};exports['removeAgents']=function(_0x5ecc37,_0x30e684,_0x42f74c){return db[_0xad2f('0x3c')][_0xad2f('0x5c')]({'where':{'id':_0x5ecc37[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x30e684,null))['then'](function(_0x517c1a){if(_0x517c1a){return _0x517c1a[_0xad2f('0x8e')](_0x5ecc37[_0xad2f('0x42')]['ids'])[_0xad2f('0x1f')](function(){if(_[_0xad2f('0x94')](_0x5ecc37[_0xad2f('0x42')][_0xad2f('0x72')])){for(var _0x4c1396=0x0;_0x4c1396<_0x5ecc37[_0xad2f('0x42')][_0xad2f('0x72')]['length'];_0x4c1396+=0x1){socket[_0xad2f('0x7d')](_0xad2f('0x90'),{'UserId':Number(_0x5ecc37[_0xad2f('0x42')][_0xad2f('0x72')][_0x4c1396]),'ChatQueueId':Number(_0x5ecc37[_0xad2f('0x55')]['id'])});}}else{socket[_0xad2f('0x7d')](_0xad2f('0x90'),{'UserId':Number(_0x5ecc37[_0xad2f('0x42')][_0xad2f('0x72')]),'ChatQueueId':Number(_0x5ecc37[_0xad2f('0x55')]['id'])});}});}})[_0xad2f('0x1f')](respondWithStatusCode(_0x30e684,null))[_0xad2f('0x53')](handleError(_0x30e684,null));};exports['getAgents']=function(_0xe6544d,_0x654a67,_0x40022c){var _0x3c570e={};var _0x2ab804={};var _0x23b152;var _0x103059;return db[_0xad2f('0x3c')][_0xad2f('0x6f')]({'where':{'id':_0xe6544d[_0xad2f('0x55')]['id']}})[_0xad2f('0x1f')](handleEntityNotFound(_0x654a67,null))['then'](function(_0xde7697){if(_0xde7697){_0x23b152=_0xde7697;_0x2ab804[_0xad2f('0x40')]=_[_0xad2f('0x56')](db[_0xad2f('0x65')]['rawAttributes']);_0x2ab804[_0xad2f('0x42')]=_[_0xad2f('0x56')](_0xe6544d[_0xad2f('0x42')]);_0x2ab804[_0xad2f('0x43')]=_[_0xad2f('0x44')](_0x2ab804[_0xad2f('0x40')],_0x2ab804[_0xad2f('0x42')]);_0x3c570e[_0xad2f('0x45')]=_[_0xad2f('0x44')](_0x2ab804[_0xad2f('0x40')],qs['fields'](_0xe6544d[_0xad2f('0x42')]['fields']));_0x3c570e[_0xad2f('0x45')]=_0x3c570e['attributes']['length']?_0x3c570e['attributes']:_0x2ab804['model'];_0x3c570e[_0xad2f('0x49')]=qs[_0xad2f('0x4a')](_0xe6544d[_0xad2f('0x42')][_0xad2f('0x4a')]);_0x3c570e[_0xad2f('0x4f')]=qs[_0xad2f('0x43')](_[_0xad2f('0x4b')](_0xe6544d[_0xad2f('0x42')],_0x2ab804[_0xad2f('0x43')]));if(_0xe6544d[_0xad2f('0x42')][_0xad2f('0x4c')]){_0x3c570e[_0xad2f('0x4f')]=_[_0xad2f('0x4d')](_0x3c570e['where'],{'$or':_[_0xad2f('0x41')](_0x3c570e[_0xad2f('0x45')],function(_0x2f0000){var _0x123ba9={};_0x123ba9[_0x2f0000]={'$like':'%'+_0xe6544d['query'][_0xad2f('0x4c')]+'%'};return _0x123ba9;})});}_0x3c570e=_[_0xad2f('0x4d')]({},_0x3c570e,_0xe6544d[_0xad2f('0x64')]);return _0x23b152[_0xad2f('0x95')](_0x3c570e);}})[_0xad2f('0x1f')](function(_0x955532){if(_0x955532){_0x103059=_0x955532[_0xad2f('0x47')];if(!_0xe6544d['query'][_0xad2f('0x62')](_0xad2f('0x48'))){_0x3c570e[_0xad2f('0x2d')]=qs[_0xad2f('0x2d')](_0xe6544d[_0xad2f('0x42')][_0xad2f('0x2d')]);_0x3c570e[_0xad2f('0x2c')]=qs[_0xad2f('0x2c')](_0xe6544d[_0xad2f('0x42')]['offset']);}return _0x23b152[_0xad2f('0x95')](_0x3c570e);}})[_0xad2f('0x1f')](function(_0x5bcfaf){if(_0x5bcfaf){return _0x5bcfaf?{'count':_0x103059,'rows':_0x5bcfaf}:null;}})[_0xad2f('0x1f')](respondWithResult(_0x654a67,null))[_0xad2f('0x53')](handleError(_0x654a67,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 268affb..3e61f16 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 _0x0f10=['exports','events','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a2ed0,_0x2b2715){var _0xe3d3c9=function(_0x49530c){while(--_0x49530c){_0x5a2ed0['push'](_0x5a2ed0['shift']());}};_0xe3d3c9(++_0x2b2715);}(_0x0f10,0x14b));var _0x00f1=function(_0x44e694,_0x4a1703){_0x44e694=_0x44e694-0x0;var _0x15d09e=_0x0f10[_0x44e694];return _0x15d09e;};'use strict';var EventEmitter=require(_0x00f1('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x00f1('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x00f1('0x2')](0x0);var events={'afterCreate':_0x00f1('0x3'),'afterUpdate':_0x00f1('0x4'),'afterDestroy':_0x00f1('0x5')};function emitEvent(_0x2c6c68){return function(_0x4e2c15,_0x415ca5,_0x305108){ChatQueueEvents[_0x00f1('0x6')](_0x2c6c68+':'+_0x4e2c15['id'],_0x4e2c15);ChatQueueEvents[_0x00f1('0x6')](_0x2c6c68,_0x4e2c15);_0x305108(null);};}for(var e in events){if(events[_0x00f1('0x7')](e)){var event=events[e];ChatQueue[_0x00f1('0x8')](e,emitEvent(event));}}module[_0x00f1('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0xa23d=['../../mysqldb','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x1796ea,_0x3a214e){var _0x7c46b8=function(_0x1ff7ea){while(--_0x1ff7ea){_0x1796ea['push'](_0x1796ea['shift']());}};_0x7c46b8(++_0x3a214e);}(_0xa23d,0x131));var _0xda23=function(_0x241da4,_0x4d74e3){_0x241da4=_0x241da4-0x0;var _0x4ab729=_0xa23d[_0x241da4];return _0x4ab729;};'use strict';var EventEmitter=require(_0xda23('0x0'));var ChatQueue=require(_0xda23('0x1'))['db'][_0xda23('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xda23('0x3')](0x0);var events={'afterCreate':_0xda23('0x4'),'afterUpdate':'update','afterDestroy':_0xda23('0x5')};function emitEvent(_0x2735b7){return function(_0x491cb7,_0x3e1bce,_0x343584){ChatQueueEvents[_0xda23('0x6')](_0x2735b7+':'+_0x491cb7['id'],_0x491cb7);ChatQueueEvents[_0xda23('0x6')](_0x2735b7,_0x491cb7);_0x343584(null);};}for(var e in events){if(events[_0xda23('0x7')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0xda23('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d02306b..b885154 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 _0xd0df=['rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','api','bluebird','request-promise'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0xd0df,0xe1));var _0xfd0d=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xd0df[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0xfd0d('0x0'));var util=require(_0xfd0d('0x1'));var logger=require('../../config/logger')(_0xfd0d('0x2'));var moment=require('moment');var BPromise=require(_0xfd0d('0x3'));var rp=require(_0xfd0d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd0d('0x5'));var config=require(_0xfd0d('0x6'));var attributes=require(_0xfd0d('0x7'));module['exports']=function(_0x5ce6f6,_0x304824){return _0x5ce6f6['define'](_0xfd0d('0x8'),attributes,{'tableName':_0xfd0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00ea=['../../config/logger','moment','request-promise','../../config/environment','ChatQueue','chat_queues','util'];(function(_0x370aa1,_0x2b1a51){var _0x36f521=function(_0x8388b5){while(--_0x8388b5){_0x370aa1['push'](_0x370aa1['shift']());}};_0x36f521(++_0x2b1a51);}(_0x00ea,0x76));var _0xa00e=function(_0x448697,_0x7fe072){_0x448697=_0x448697-0x0;var _0x4755cb=_0x00ea[_0x448697];return _0x4755cb;};'use strict';var _=require('lodash');var util=require(_0xa00e('0x0'));var logger=require(_0xa00e('0x1'))('api');var moment=require(_0xa00e('0x2'));var BPromise=require('bluebird');var rp=require(_0xa00e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa00e('0x4'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x5bff6b,_0xf5bf83){return _0x5bff6b['define'](_0xa00e('0x5'),attributes,{'tableName':_0xa00e('0x6'),'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 56a3824..d203cbb 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 _0xbc7a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetChatQueue','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowChatQueue','ChatQueue','find','raw','lodash','util','moment','randomstring'];(function(_0x148192,_0x3af027){var _0x3b863d=function(_0x5b6902){while(--_0x5b6902){_0x148192['push'](_0x148192['shift']());}};_0x3b863d(++_0x3af027);}(_0xbc7a,0xa4));var _0xabc7=function(_0x9f7745,_0x2cd4a5){_0x9f7745=_0x9f7745-0x0;var _0x201e80=_0xbc7a[_0x9f7745];return _0x201e80;};'use strict';var _=require(_0xabc7('0x0'));var util=require(_0xabc7('0x1'));var moment=require(_0xabc7('0x2'));var BPromise=require('bluebird');var rs=require(_0xabc7('0x3'));var fs=require('fs');var Redis=require(_0xabc7('0x4'));var db=require(_0xabc7('0x5'))['db'];var utils=require(_0xabc7('0x6'));var logger=require(_0xabc7('0x7'))(_0xabc7('0x8'));var config=require('../../config/environment');var jayson=require(_0xabc7('0x9'));var client=jayson[_0xabc7('0xa')][_0xabc7('0xb')]({'port':0x232a});config[_0xabc7('0xc')]=_[_0xabc7('0xd')](config[_0xabc7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xabc7('0xe'))(new Redis(config['redis']));require(_0xabc7('0xf'))[_0xabc7('0x10')](socket);function respondWithRpcPromise(_0x3db08f,_0x6fe2da,_0x3677d2){return new BPromise(function(_0x5c6c81,_0x590292){return client[_0xabc7('0x11')](_0x3db08f,_0x3677d2)['then'](function(_0x42cb88){logger[_0xabc7('0x12')](_0xabc7('0x13'),_0x6fe2da,'request\x20sent');logger[_0xabc7('0x14')](_0xabc7('0x15'),_0x6fe2da,'request\x20sent',JSON['stringify'](_0x42cb88));if(_0x42cb88[_0xabc7('0x16')]){if(_0x42cb88[_0xabc7('0x16')]['code']===0x1f4){logger[_0xabc7('0x16')]('ChatQueue,\x20%s,\x20%s',_0x6fe2da,_0x42cb88[_0xabc7('0x16')][_0xabc7('0x17')]);return _0x590292(_0x42cb88[_0xabc7('0x16')][_0xabc7('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x6fe2da,_0x42cb88[_0xabc7('0x16')][_0xabc7('0x17')]);return _0x5c6c81(_0x42cb88[_0xabc7('0x16')][_0xabc7('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x6fe2da,_0xabc7('0x18'));_0x5c6c81(_0x42cb88[_0xabc7('0x19')]['message']);}})[_0xabc7('0x1a')](function(_0x15be22){logger['error'](_0xabc7('0x13'),_0x6fe2da,_0x15be22);_0x590292(_0x15be22);});});}exports[_0xabc7('0x1b')]=function(_0x53a828){var _0x1b8674=this;return new Promise(function(_0x5135f6,_0x5905db){return db['ChatQueue'][_0xabc7('0x1c')]({'raw':_0x53a828['options']?_0x53a828[_0xabc7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x53a828['options']?_0x53a828[_0xabc7('0x1d')][_0xabc7('0x1e')]||null:null,'attributes':_0x53a828[_0xabc7('0x1d')]?_0x53a828['options'][_0xabc7('0x1f')]||null:null,'limit':_0x53a828[_0xabc7('0x1d')]?_0x53a828[_0xabc7('0x1d')][_0xabc7('0x20')]||null:null,'include':_0x53a828[_0xabc7('0x1d')]?_0x53a828[_0xabc7('0x1d')][_0xabc7('0x21')]?_[_0xabc7('0x22')](_0x53a828[_0xabc7('0x1d')]['include'],function(_0x12ccd2){return{'model':db[_0x12ccd2[_0xabc7('0x23')]],'as':_0x12ccd2['as'],'attributes':_0x12ccd2[_0xabc7('0x1f')],'include':_0x12ccd2['include']?_[_0xabc7('0x22')](_0x12ccd2['include'],function(_0x3eb1d1){return{'model':db[_0x3eb1d1[_0xabc7('0x23')]],'as':_0x3eb1d1['as'],'attributes':_0x3eb1d1[_0xabc7('0x1f')],'include':_0x3eb1d1[_0xabc7('0x21')]?_['map'](_0x3eb1d1['include'],function(_0x3b0bdc){return{'model':db[_0x3b0bdc['model']],'as':_0x3b0bdc['as'],'attributes':_0x3b0bdc['attributes']};}):[]};}):[]};}):[]:[]})[_0xabc7('0x24')](function(_0x1df938){logger[_0xabc7('0x12')](_0xabc7('0x1b'),_0x53a828);logger[_0xabc7('0x14')](_0xabc7('0x1b'),_0x53a828,JSON[_0xabc7('0x25')](_0x1df938));_0x5135f6(_0x1df938);})[_0xabc7('0x1a')](function(_0x415dfd){logger[_0xabc7('0x16')]('GetChatQueue',_0x415dfd['message'],_0x53a828);_0x5905db(_0x1b8674[_0xabc7('0x16')](0x1f4,_0x415dfd[_0xabc7('0x17')]));});});};exports[_0xabc7('0x26')]=function(_0x570703){var _0x53fa0c=this;return new Promise(function(_0x4b69b8,_0x3976d2){return db[_0xabc7('0x27')][_0xabc7('0x28')]({'raw':_0x570703[_0xabc7('0x1d')]?_0x570703[_0xabc7('0x1d')][_0xabc7('0x29')]===undefined?!![]:![]:!![],'where':_0x570703[_0xabc7('0x1d')]?_0x570703[_0xabc7('0x1d')][_0xabc7('0x1e')]||null:null,'attributes':_0x570703[_0xabc7('0x1d')]?_0x570703[_0xabc7('0x1d')][_0xabc7('0x1f')]||null:null,'include':_0x570703[_0xabc7('0x1d')]?_0x570703[_0xabc7('0x1d')][_0xabc7('0x21')]?_['map'](_0x570703[_0xabc7('0x1d')][_0xabc7('0x21')],function(_0x1163a4){return{'model':db[_0x1163a4[_0xabc7('0x23')]],'as':_0x1163a4['as'],'attributes':_0x1163a4[_0xabc7('0x1f')],'include':_0x1163a4[_0xabc7('0x21')]?_['map'](_0x1163a4[_0xabc7('0x21')],function(_0x271779){return{'model':db[_0x271779[_0xabc7('0x23')]],'as':_0x271779['as'],'attributes':_0x271779[_0xabc7('0x1f')],'include':_0x271779[_0xabc7('0x21')]?_['map'](_0x271779['include'],function(_0x435cbe){return{'model':db[_0x435cbe[_0xabc7('0x23')]],'as':_0x435cbe['as'],'attributes':_0x435cbe['attributes']};}):[]};}):[]};}):[]:[]})[_0xabc7('0x24')](function(_0x389c39){logger[_0xabc7('0x12')](_0xabc7('0x26'),_0x570703);logger[_0xabc7('0x14')](_0xabc7('0x26'),_0x570703,JSON['stringify'](_0x389c39));_0x4b69b8(_0x389c39);})['catch'](function(_0x3e57f8){logger[_0xabc7('0x16')](_0xabc7('0x26'),_0x3e57f8[_0xabc7('0x17')],_0x570703);_0x3976d2(_0x53fa0c[_0xabc7('0x16')](0x1f4,_0x3e57f8['message']));});});}; \ No newline at end of file +var _0x553e=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','debug','error','code','ChatQueue,\x20%s,\x20%s','message','request\x20sent','catch','findAll','options','raw','where','attributes','limit','include','model','map','GetChatQueue','stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x241aad,_0x5eb528){var _0x2be52a=function(_0x37ab65){while(--_0x37ab65){_0x241aad['push'](_0x241aad['shift']());}};_0x2be52a(++_0x5eb528);}(_0x553e,0x10f));var _0xe553=function(_0xc083d5,_0x3251b8){_0xc083d5=_0xc083d5-0x0;var _0x26b06b=_0x553e[_0xc083d5];return _0x26b06b;};'use strict';var _=require(_0xe553('0x0'));var util=require(_0xe553('0x1'));var moment=require(_0xe553('0x2'));var BPromise=require(_0xe553('0x3'));var rs=require(_0xe553('0x4'));var fs=require('fs');var Redis=require(_0xe553('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe553('0x6'));var logger=require(_0xe553('0x7'))(_0xe553('0x8'));var config=require(_0xe553('0x9'));var jayson=require(_0xe553('0xa'));var client=jayson[_0xe553('0xb')][_0xe553('0xc')]({'port':0x232a});config['redis']=_[_0xe553('0xd')](config[_0xe553('0xe')],{'host':_0xe553('0xf'),'port':0x18eb});var socket=require(_0xe553('0x10'))(new Redis(config[_0xe553('0xe')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5bdf58,_0x4dbe84,_0xffc39){return new BPromise(function(_0xac75c5,_0x211007){return client[_0xe553('0x11')](_0x5bdf58,_0xffc39)[_0xe553('0x12')](function(_0x504854){logger[_0xe553('0x13')]('ChatQueue,\x20%s,\x20%s',_0x4dbe84,'request\x20sent');logger[_0xe553('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4dbe84,'request\x20sent',JSON['stringify'](_0x504854));if(_0x504854['error']){if(_0x504854[_0xe553('0x15')][_0xe553('0x16')]===0x1f4){logger[_0xe553('0x15')](_0xe553('0x17'),_0x4dbe84,_0x504854[_0xe553('0x15')][_0xe553('0x18')]);return _0x211007(_0x504854[_0xe553('0x15')][_0xe553('0x18')]);}logger[_0xe553('0x15')]('ChatQueue,\x20%s,\x20%s',_0x4dbe84,_0x504854['error'][_0xe553('0x18')]);return _0xac75c5(_0x504854['error'][_0xe553('0x18')]);}else{logger[_0xe553('0x13')](_0xe553('0x17'),_0x4dbe84,_0xe553('0x19'));_0xac75c5(_0x504854['result'][_0xe553('0x18')]);}})[_0xe553('0x1a')](function(_0x5ba218){logger[_0xe553('0x15')](_0xe553('0x17'),_0x4dbe84,_0x5ba218);_0x211007(_0x5ba218);});});}exports['GetChatQueue']=function(_0x294bdf){var _0x166e9f=this;return new Promise(function(_0xc3a29e,_0x4aa596){return db['ChatQueue'][_0xe553('0x1b')]({'raw':_0x294bdf[_0xe553('0x1c')]?_0x294bdf[_0xe553('0x1c')][_0xe553('0x1d')]===undefined?!![]:![]:!![],'where':_0x294bdf[_0xe553('0x1c')]?_0x294bdf[_0xe553('0x1c')][_0xe553('0x1e')]||null:null,'attributes':_0x294bdf['options']?_0x294bdf[_0xe553('0x1c')][_0xe553('0x1f')]||null:null,'limit':_0x294bdf['options']?_0x294bdf[_0xe553('0x1c')][_0xe553('0x20')]||null:null,'include':_0x294bdf[_0xe553('0x1c')]?_0x294bdf[_0xe553('0x1c')][_0xe553('0x21')]?_['map'](_0x294bdf[_0xe553('0x1c')][_0xe553('0x21')],function(_0x5dc12f){return{'model':db[_0x5dc12f[_0xe553('0x22')]],'as':_0x5dc12f['as'],'attributes':_0x5dc12f[_0xe553('0x1f')],'include':_0x5dc12f[_0xe553('0x21')]?_[_0xe553('0x23')](_0x5dc12f[_0xe553('0x21')],function(_0x3a1dcf){return{'model':db[_0x3a1dcf[_0xe553('0x22')]],'as':_0x3a1dcf['as'],'attributes':_0x3a1dcf[_0xe553('0x1f')],'include':_0x3a1dcf[_0xe553('0x21')]?_['map'](_0x3a1dcf['include'],function(_0x4b45be){return{'model':db[_0x4b45be[_0xe553('0x22')]],'as':_0x4b45be['as'],'attributes':_0x4b45be['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1c53){logger[_0xe553('0x13')](_0xe553('0x24'),_0x294bdf);logger[_0xe553('0x14')](_0xe553('0x24'),_0x294bdf,JSON[_0xe553('0x25')](_0x2a1c53));_0xc3a29e(_0x2a1c53);})[_0xe553('0x1a')](function(_0x2602dc){logger['error']('GetChatQueue',_0x2602dc['message'],_0x294bdf);_0x4aa596(_0x166e9f['error'](0x1f4,_0x2602dc[_0xe553('0x18')]));});});};exports[_0xe553('0x26')]=function(_0x2144b7){var _0x2e4ddb=this;return new Promise(function(_0x1db4fa,_0x272009){return db['ChatQueue'][_0xe553('0x27')]({'raw':_0x2144b7[_0xe553('0x1c')]?_0x2144b7[_0xe553('0x1c')][_0xe553('0x1d')]===undefined?!![]:![]:!![],'where':_0x2144b7['options']?_0x2144b7['options'][_0xe553('0x1e')]||null:null,'attributes':_0x2144b7['options']?_0x2144b7[_0xe553('0x1c')][_0xe553('0x1f')]||null:null,'include':_0x2144b7[_0xe553('0x1c')]?_0x2144b7[_0xe553('0x1c')]['include']?_[_0xe553('0x23')](_0x2144b7[_0xe553('0x1c')]['include'],function(_0x98b039){return{'model':db[_0x98b039['model']],'as':_0x98b039['as'],'attributes':_0x98b039['attributes'],'include':_0x98b039['include']?_[_0xe553('0x23')](_0x98b039[_0xe553('0x21')],function(_0x483e6a){return{'model':db[_0x483e6a[_0xe553('0x22')]],'as':_0x483e6a['as'],'attributes':_0x483e6a[_0xe553('0x1f')],'include':_0x483e6a[_0xe553('0x21')]?_['map'](_0x483e6a[_0xe553('0x21')],function(_0x16c342){return{'model':db[_0x16c342[_0xe553('0x22')]],'as':_0x16c342['as'],'attributes':_0x16c342[_0xe553('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe553('0x12')](function(_0xe6114b){logger['info'](_0xe553('0x26'),_0x2144b7);logger[_0xe553('0x14')](_0xe553('0x26'),_0x2144b7,JSON['stringify'](_0xe6114b));_0x1db4fa(_0xe6114b);})['catch'](function(_0xedde21){logger['error'](_0xe553('0x26'),_0xedde21[_0xe553('0x18')],_0x2144b7);_0x272009(_0x2e4ddb[_0xe553('0x15')](0x1f4,_0xedde21[_0xe553('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 18d3e4f..41f766f 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 _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x26d823,_0x3f2031){var _0x5c24b1=function(_0x205a09){while(--_0x205a09){_0x26d823['push'](_0x26d823['shift']());}};_0x5c24b1(++_0x3f2031);}(_0x0faf,0x132));var _0xf0fa=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x0faf[_0xe73080];return _0x12cbc4;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file +var _0x0c02=['save','remove','emit','removeListener','register','chatQueue:'];(function(_0x99f838,_0xe376e2){var _0x432cd7=function(_0x2cd5dc){while(--_0x2cd5dc){_0x99f838['push'](_0x99f838['shift']());}};_0x432cd7(++_0xe376e2);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x20c0('0x0'),_0x20c0('0x1'),'update'];function createListener(_0x1338cf,_0x5c8750){return function(_0x454922){_0x5c8750[_0x20c0('0x2')](_0x1338cf,_0x454922);};}function removeListener(_0x38022e,_0x2e9d65){return function(){ChatQueueEvents[_0x20c0('0x3')](_0x38022e,_0x2e9d65);};}exports[_0x20c0('0x4')]=function(_0x13312d){for(var _0xd25ee8=0x0,_0x5d6408=events['length'];_0xd25ee8<_0x5d6408;_0xd25ee8++){var _0x5da127=events[_0xd25ee8];var _0x4db532=createListener(_0x20c0('0x5')+_0x5da127,_0x13312d);ChatQueueEvents['on'](_0x5da127,_0x4db532);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 50be4d3..b01484f 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 _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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3e74,0x175));var _0x43e7=function(_0x28fcf9,_0x5462cb){_0x28fcf9=_0x28fcf9-0x0;var _0x361147=_0x3e74[_0x28fcf9];return _0x361147;};'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 +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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4358f5,_0x5b1ac6){_0x4358f5=_0x4358f5-0x0;var _0x4d8104=_0x5fc3[_0x4358f5];return _0x4d8104;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 001c1cb..e9f73ad 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 _0xe93a=['sequelize','DATE','STRING','moment'];(function(_0x271dd1,_0x1c332a){var _0x2d0ec5=function(_0x31276d){while(--_0x31276d){_0x271dd1['push'](_0x271dd1['shift']());}};_0x2d0ec5(++_0x1c332a);}(_0xe93a,0x1a7));var _0xae93=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe93a[_0x17d9e3];return _0x14192d;};'use strict';var moment=require(_0xae93('0x0'));var Sequelize=require(_0xae93('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xae93('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xae93('0x2')]},'reason':{'type':Sequelize[_0xae93('0x3')]}}; \ No newline at end of file +var _0x0ecc=['sequelize','STRING','DATE'];(function(_0x551ae6,_0x10f89c){var _0x386443=function(_0x3e3117){while(--_0x3e3117){_0x551ae6['push'](_0x551ae6['shift']());}};_0x386443(++_0x10f89c);}(_0x0ecc,0x17d));var _0xc0ec=function(_0x3562b0,_0x28fec7){_0x3562b0=_0x3562b0-0x0;var _0x5de051=_0x0ecc[_0x3562b0];return _0x5de051;};'use strict';var moment=require('moment');var Sequelize=require(_0xc0ec('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc0ec('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc0ec('0x2')]},'leaveAt':{'type':Sequelize[_0xc0ec('0x2')]},'acceptAt':{'type':Sequelize[_0xc0ec('0x2')]},'exitAt':{'type':Sequelize[_0xc0ec('0x2')]},'reason':{'type':Sequelize[_0xc0ec('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 424bffd..0ca2a57 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 _0x71ab=['filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','ChatQueueReport','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys'];(function(_0x2b5634,_0x54e914){var _0x21e050=function(_0x425871){while(--_0x425871){_0x2b5634['push'](_0x2b5634['shift']());}};_0x21e050(++_0x54e914);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['ChatQueueReport']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['ChatQueueReport']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':!![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['ChatQueueReport'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));};exports[_0xb71a('0x49')]=function(_0x4b26d2,_0x1ea17b){return db['ChatQueueReport'][_0xb71a('0x49')]()[_0xb71a('0x24')](respondWithResult(_0x1ea17b,null))['catch'](handleError(_0x1ea17b,null));}; \ No newline at end of file +var _0xf78f=['send','index','map','ChatQueueReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','update','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name'];(function(_0x32d595,_0x40020b){var _0x87217c=function(_0xfbc239){while(--_0xfbc239){_0x32d595['push'](_0x32d595['shift']());}};_0x87217c(++_0x40020b);}(_0xf78f,0x72));var _0xff78=function(_0x26c579,_0x1eeb6b){_0x26c579=_0x26c579-0x0;var _0x26d560=_0xf78f[_0x26c579];return _0x26d560;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff78('0x0'));var zipdir=require(_0xff78('0x1'));var jsonpatch=require(_0xff78('0x2'));var rp=require(_0xff78('0x3'));var moment=require(_0xff78('0x4'));var BPromise=require(_0xff78('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(_0xff78('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff78('0x7'));var squel=require(_0xff78('0x8'));var crypto=require(_0xff78('0x9'));var jsforce=require(_0xff78('0xa'));var deskjs=require(_0xff78('0xb'));var toCsv=require(_0xff78('0xc'));var querystring=require(_0xff78('0xd'));var Papa=require(_0xff78('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff78('0xf'));var as=require(_0xff78('0x10'));var hardwareService=require(_0xff78('0x11'));var logger=require(_0xff78('0x12'))(_0xff78('0x13'));var utils=require(_0xff78('0x14'));var config=require(_0xff78('0x15'));var licenseUtil=require(_0xff78('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d325b,_0x25c5db){_0x25c5db=_0x25c5db||0xcc;return function(_0x52ea61){if(_0x52ea61){return _0x1d325b[_0xff78('0x17')](_0x25c5db);}return _0x1d325b['status'](_0x25c5db)[_0xff78('0x18')]();};}function respondWithResult(_0x532f51,_0x848823){_0x848823=_0x848823||0xc8;return function(_0x27c281){if(_0x27c281){return _0x532f51[_0xff78('0x19')](_0x848823)[_0xff78('0x1a')](_0x27c281);}};}function respondWithFilteredResult(_0x52bbf1,_0x2a0e95){return function(_0x150d87){if(_0x150d87){var _0x21b5ef=typeof _0x2a0e95[_0xff78('0x1b')]===_0xff78('0x1c')&&typeof _0x2a0e95[_0xff78('0x1d')]===_0xff78('0x1c');var _0x5dfd19=_0x150d87[_0xff78('0x1e')];var _0x183cd1=_0x21b5ef?0x0:_0x2a0e95[_0xff78('0x1b')];var _0x201af4=_0x21b5ef?_0x150d87[_0xff78('0x1e')]:_0x2a0e95[_0xff78('0x1b')]+_0x2a0e95[_0xff78('0x1d')];var _0xf0c91b;if(_0x201af4>=_0x5dfd19){_0x201af4=_0x5dfd19;_0xf0c91b=0xc8;}else{_0xf0c91b=0xce;}_0x52bbf1['status'](_0xf0c91b);return _0x52bbf1[_0xff78('0x1f')](_0xff78('0x20'),_0x183cd1+'-'+_0x201af4+'/'+_0x5dfd19)[_0xff78('0x1a')](_0x150d87);}return null;};}function patchUpdates(_0x4dd9fa){return function(_0x2cee04){try{jsonpatch['apply'](_0x2cee04,_0x4dd9fa,!![]);}catch(_0x16ed8e){return BPromise[_0xff78('0x21')](_0x16ed8e);}return _0x2cee04[_0xff78('0x22')]();};}function saveUpdates(_0xe2be6e,_0xe22c7e){return function(_0x4ebf5e){if(_0x4ebf5e){return _0x4ebf5e['update'](_0xe2be6e)[_0xff78('0x23')](function(_0x9f79f){return _0x9f79f;});}return null;};}function removeEntity(_0xd827a4,_0x600dbe){return function(_0x1dd2a2){if(_0x1dd2a2){return _0x1dd2a2[_0xff78('0x24')]()[_0xff78('0x23')](function(){_0xd827a4[_0xff78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x184563,_0x122b5e){return function(_0x395734){if(!_0x395734){_0x184563[_0xff78('0x17')](0x194);}return _0x395734;};}function handleError(_0x5591fa,_0x2e4176){_0x2e4176=_0x2e4176||0x1f4;return function(_0xb77e22){logger[_0xff78('0x25')](_0xb77e22[_0xff78('0x26')]);if(_0xb77e22[_0xff78('0x27')]){delete _0xb77e22['name'];}_0x5591fa[_0xff78('0x19')](_0x2e4176)[_0xff78('0x28')](_0xb77e22);};}exports[_0xff78('0x29')]=function(_0x2e716b,_0x16b546){var _0x5a49f5={},_0x3500cc={},_0x35354b={'count':0x0,'rows':[]};var _0x473d9e=_[_0xff78('0x2a')](db[_0xff78('0x2b')]['rawAttributes'],function(_0x3d1a4a){return{'name':_0x3d1a4a[_0xff78('0x2c')],'type':_0x3d1a4a[_0xff78('0x2d')][_0xff78('0x2e')]};});_0x3500cc['model']=_[_0xff78('0x2a')](_0x473d9e,_0xff78('0x27'));_0x3500cc[_0xff78('0x2f')]=_[_0xff78('0x30')](_0x2e716b[_0xff78('0x2f')]);_0x3500cc[_0xff78('0x31')]=_[_0xff78('0x32')](_0x3500cc[_0xff78('0x33')],_0x3500cc['query']);_0x5a49f5[_0xff78('0x34')]=_[_0xff78('0x32')](_0x3500cc[_0xff78('0x33')],qs[_0xff78('0x35')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x35')]));_0x5a49f5[_0xff78('0x34')]=_0x5a49f5['attributes'][_0xff78('0x36')]?_0x5a49f5['attributes']:_0x3500cc[_0xff78('0x33')];if(!_0x2e716b[_0xff78('0x2f')][_0xff78('0x37')](_0xff78('0x38'))){_0x5a49f5['limit']=qs[_0xff78('0x1d')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x1d')]);_0x5a49f5[_0xff78('0x1b')]=qs[_0xff78('0x1b')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x1b')]);}_0x5a49f5[_0xff78('0x39')]=qs[_0xff78('0x3a')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x3a')]);_0x5a49f5['where']=qs[_0xff78('0x31')](_[_0xff78('0x3b')](_0x2e716b[_0xff78('0x2f')],_0x3500cc[_0xff78('0x31')]),_0x473d9e);if(_0x2e716b[_0xff78('0x2f')][_0xff78('0x3c')]){_0x5a49f5[_0xff78('0x3d')]=_[_0xff78('0x3e')](_0x5a49f5[_0xff78('0x3d')],{'$or':_['map'](_0x473d9e,function(_0x5729db){if(_0x5729db[_0xff78('0x2d')]!==_0xff78('0x3f')){var _0x565da3={};_0x565da3[_0x5729db['name']]={'$like':'%'+_0x2e716b['query'][_0xff78('0x3c')]+'%'};return _0x565da3;}})});}_0x5a49f5=_['merge']({},_0x5a49f5,_0x2e716b[_0xff78('0x40')]);var _0x2afd94={'where':_0x5a49f5[_0xff78('0x3d')]};return db[_0xff78('0x2b')][_0xff78('0x1e')](_0x2afd94)['then'](function(_0x31b444){_0x35354b[_0xff78('0x1e')]=_0x31b444;if(_0x2e716b['query'][_0xff78('0x41')]){_0x5a49f5[_0xff78('0x42')]=[{'all':!![]}];}return db[_0xff78('0x2b')]['findAll'](_0x5a49f5);})[_0xff78('0x23')](function(_0x1a6221){_0x35354b[_0xff78('0x43')]=_0x1a6221;return _0x35354b;})['then'](respondWithFilteredResult(_0x16b546,_0x5a49f5))[_0xff78('0x44')](handleError(_0x16b546,null));};exports[_0xff78('0x45')]=function(_0x448a87,_0xfcc444){var _0x3fdcb4={'raw':!![],'where':{'id':_0x448a87[_0xff78('0x46')]['id']}},_0x2d0f87={};_0x2d0f87[_0xff78('0x33')]=_[_0xff78('0x30')](db[_0xff78('0x2b')][_0xff78('0x47')]);_0x2d0f87['query']=_['keys'](_0x448a87[_0xff78('0x2f')]);_0x2d0f87['filters']=_[_0xff78('0x32')](_0x2d0f87[_0xff78('0x33')],_0x2d0f87[_0xff78('0x2f')]);_0x3fdcb4[_0xff78('0x34')]=_[_0xff78('0x32')](_0x2d0f87[_0xff78('0x33')],qs[_0xff78('0x35')](_0x448a87[_0xff78('0x2f')][_0xff78('0x35')]));_0x3fdcb4[_0xff78('0x34')]=_0x3fdcb4[_0xff78('0x34')][_0xff78('0x36')]?_0x3fdcb4[_0xff78('0x34')]:_0x2d0f87[_0xff78('0x33')];if(_0x448a87[_0xff78('0x2f')][_0xff78('0x41')]){_0x3fdcb4[_0xff78('0x42')]=[{'all':!![]}];}_0x3fdcb4=_[_0xff78('0x3e')]({},_0x3fdcb4,_0x448a87['options']);return db['ChatQueueReport']['find'](_0x3fdcb4)[_0xff78('0x23')](handleEntityNotFound(_0xfcc444,null))[_0xff78('0x23')](respondWithResult(_0xfcc444,null))[_0xff78('0x44')](handleError(_0xfcc444,null));};exports[_0xff78('0x48')]=function(_0x48a900,_0x25d896){return db['ChatQueueReport'][_0xff78('0x48')](_0x48a900[_0xff78('0x49')],{})[_0xff78('0x23')](respondWithResult(_0x25d896,0xc9))[_0xff78('0x44')](handleError(_0x25d896,null));};exports[_0xff78('0x4a')]=function(_0x4508bc,_0x3b48fd){if(_0x4508bc['body']['id']){delete _0x4508bc['body']['id'];}return db[_0xff78('0x2b')][_0xff78('0x4b')]({'where':{'id':_0x4508bc['params']['id']}})[_0xff78('0x23')](handleEntityNotFound(_0x3b48fd,null))['then'](saveUpdates(_0x4508bc[_0xff78('0x49')],null))[_0xff78('0x23')](respondWithResult(_0x3b48fd,null))[_0xff78('0x44')](handleError(_0x3b48fd,null));};exports[_0xff78('0x24')]=function(_0x371968,_0x7530e4){return db[_0xff78('0x2b')][_0xff78('0x4b')]({'where':{'id':_0x371968[_0xff78('0x46')]['id']}})[_0xff78('0x23')](handleEntityNotFound(_0x7530e4,null))[_0xff78('0x23')](removeEntity(_0x7530e4,null))['catch'](handleError(_0x7530e4,null));};exports[_0xff78('0x4c')]=function(_0x299414,_0x410638){return db[_0xff78('0x2b')][_0xff78('0x4c')]()[_0xff78('0x23')](respondWithResult(_0x410638,null))[_0xff78('0x44')](handleError(_0x410638,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 060cb0c..c829940 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(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37d526,_0x52323c){var _0x42376f=function(_0x5c4f84){while(--_0x5c4f84){_0x37d526['push'](_0x37d526['shift']());}};_0x42376f(++_0x52323c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2d6c036..06534cd 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 _0xb08f=['rpc','../../config/environment','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x48e8c1,_0x5cceef){var _0x46fd3f=function(_0x5aa713){while(--_0x5aa713){_0x48e8c1['push'](_0x48e8c1['shift']());}};_0x46fd3f(++_0x5cceef);}(_0xb08f,0x125));var _0xfb08=function(_0x24e2cc,_0x4c7081){_0x24e2cc=_0x24e2cc-0x0;var _0x131009=_0xb08f[_0x24e2cc];return _0x131009;};'use strict';var _=require('lodash');var util=require(_0xfb08('0x0'));var moment=require(_0xfb08('0x1'));var BPromise=require(_0xfb08('0x2'));var rs=require(_0xfb08('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb08('0x4'))['db'];var utils=require(_0xfb08('0x5'));var logger=require(_0xfb08('0x6'))(_0xfb08('0x7'));var config=require(_0xfb08('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3147c0,_0x45411f,_0xd24e28){return new BPromise(function(_0x3b6faf,_0x526931){return client[_0xfb08('0xa')](_0x3147c0,_0xd24e28)[_0xfb08('0xb')](function(_0x2c221a){logger[_0xfb08('0xc')](_0xfb08('0xd'),_0x45411f,_0xfb08('0xe'));logger[_0xfb08('0xf')](_0xfb08('0x10'),_0x45411f,'request\x20sent',JSON[_0xfb08('0x11')](_0x2c221a));if(_0x2c221a['error']){if(_0x2c221a[_0xfb08('0x12')]['code']===0x1f4){logger[_0xfb08('0x12')](_0xfb08('0xd'),_0x45411f,_0x2c221a['error'][_0xfb08('0x13')]);return _0x526931(_0x2c221a[_0xfb08('0x12')][_0xfb08('0x13')]);}logger[_0xfb08('0x12')](_0xfb08('0xd'),_0x45411f,_0x2c221a[_0xfb08('0x12')]['message']);return _0x3b6faf(_0x2c221a[_0xfb08('0x12')][_0xfb08('0x13')]);}else{logger[_0xfb08('0xc')](_0xfb08('0xd'),_0x45411f,_0xfb08('0xe'));_0x3b6faf(_0x2c221a['result']['message']);}})[_0xfb08('0x14')](function(_0x316a28){logger[_0xfb08('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x45411f,_0x316a28);_0x526931(_0x316a28);});});}exports[_0xfb08('0x15')]=function(_0x393576){var _0x4fa98e=this;return new Promise(function(_0xf03fa0,_0x35623d){return db[_0xfb08('0x16')]['create'](_0x393576[_0xfb08('0x17')],{'raw':_0x393576['options']?_0x393576[_0xfb08('0x18')][_0xfb08('0x19')]===undefined?!![]:![]:!![]})[_0xfb08('0xb')](function(_0x1eeb29){logger['info'](_0xfb08('0x15'),_0x393576);logger[_0xfb08('0xf')](_0xfb08('0x15'),_0x393576,JSON[_0xfb08('0x11')](_0x1eeb29));_0xf03fa0(_0x1eeb29);})[_0xfb08('0x14')](function(_0x37f7ad){logger[_0xfb08('0x12')](_0xfb08('0x15'),_0x37f7ad[_0xfb08('0x13')],_0x393576);_0x35623d(_0x4fa98e[_0xfb08('0x12')](0x1f4,_0x37f7ad[_0xfb08('0x13')]));});});};exports[_0xfb08('0x1a')]=function(_0x300693){var _0x6fbd5=this;return new Promise(function(_0x3adce7,_0x4f859c){return db[_0xfb08('0x16')][_0xfb08('0x1b')](_0x300693[_0xfb08('0x17')],{'raw':_0x300693[_0xfb08('0x18')]?_0x300693[_0xfb08('0x18')][_0xfb08('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x300693[_0xfb08('0x18')]?_0x300693[_0xfb08('0x18')]['where']||null:null,'attributes':_0x300693[_0xfb08('0x18')]?_0x300693['options'][_0xfb08('0x1c')]||null:null,'limit':_0x300693[_0xfb08('0x18')]?_0x300693[_0xfb08('0x18')][_0xfb08('0x1d')]||null:null})['then'](function(_0x4aa26f){logger[_0xfb08('0xc')](_0xfb08('0x1a'),_0x300693);logger[_0xfb08('0xf')](_0xfb08('0x1a'),_0x300693,JSON['stringify'](_0x4aa26f));_0x3adce7(_0x4aa26f);})[_0xfb08('0x14')](function(_0x443fd2){logger['error'](_0xfb08('0x1a'),_0x443fd2[_0xfb08('0x13')],_0x300693);_0x4f859c(_0x6fbd5[_0xfb08('0x12')](0x1f4,_0x443fd2[_0xfb08('0x13')]));});});}; \ No newline at end of file +var _0xe791=['result','catch','options','raw','then','CreateChatQueueReport','update','body','where','UpdateChatQueueReport','debug','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x27e1ea,_0x42aed9){var _0x3411b3=function(_0x7b5afe){while(--_0x7b5afe){_0x27e1ea['push'](_0x27e1ea['shift']());}};_0x3411b3(++_0x42aed9);}(_0xe791,0x1be));var _0x1e79=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xe791[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0x1e79('0x0'));var util=require(_0x1e79('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e79('0x3'))['db'];var utils=require(_0x1e79('0x4'));var logger=require(_0x1e79('0x5'))(_0x1e79('0x6'));var config=require('../../config/environment');var jayson=require(_0x1e79('0x7'));var client=jayson[_0x1e79('0x8')][_0x1e79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x363b64,_0x2a98c9,_0x53d388){return new BPromise(function(_0x15b420,_0x344c32){return client[_0x1e79('0xa')](_0x363b64,_0x53d388)['then'](function(_0x7a3637){logger[_0x1e79('0xb')](_0x1e79('0xc'),_0x2a98c9,'request\x20sent');logger['debug'](_0x1e79('0xd'),_0x2a98c9,_0x1e79('0xe'),JSON[_0x1e79('0xf')](_0x7a3637));if(_0x7a3637['error']){if(_0x7a3637[_0x1e79('0x10')]['code']===0x1f4){logger[_0x1e79('0x10')](_0x1e79('0xc'),_0x2a98c9,_0x7a3637[_0x1e79('0x10')][_0x1e79('0x11')]);return _0x344c32(_0x7a3637[_0x1e79('0x10')][_0x1e79('0x11')]);}logger[_0x1e79('0x10')](_0x1e79('0xc'),_0x2a98c9,_0x7a3637['error'][_0x1e79('0x11')]);return _0x15b420(_0x7a3637[_0x1e79('0x10')][_0x1e79('0x11')]);}else{logger[_0x1e79('0xb')](_0x1e79('0xc'),_0x2a98c9,_0x1e79('0xe'));_0x15b420(_0x7a3637[_0x1e79('0x12')][_0x1e79('0x11')]);}})[_0x1e79('0x13')](function(_0x454767){logger[_0x1e79('0x10')](_0x1e79('0xc'),_0x2a98c9,_0x454767);_0x344c32(_0x454767);});});}exports['CreateChatQueueReport']=function(_0x288a9e){var _0x5416de=this;return new Promise(function(_0x1019de,_0x60f7b){return db['ChatQueueReport']['create'](_0x288a9e['body'],{'raw':_0x288a9e[_0x1e79('0x14')]?_0x288a9e[_0x1e79('0x14')][_0x1e79('0x15')]===undefined?!![]:![]:!![]})[_0x1e79('0x16')](function(_0x43970b){logger['info']('CreateChatQueueReport',_0x288a9e);logger['debug'](_0x1e79('0x17'),_0x288a9e,JSON['stringify'](_0x43970b));_0x1019de(_0x43970b);})[_0x1e79('0x13')](function(_0x46a5b4){logger[_0x1e79('0x10')](_0x1e79('0x17'),_0x46a5b4['message'],_0x288a9e);_0x60f7b(_0x5416de[_0x1e79('0x10')](0x1f4,_0x46a5b4[_0x1e79('0x11')]));});});};exports['UpdateChatQueueReport']=function(_0x5cee49){var _0x4d37db=this;return new Promise(function(_0x150a51,_0x15e127){return db['ChatQueueReport'][_0x1e79('0x18')](_0x5cee49[_0x1e79('0x19')],{'raw':_0x5cee49[_0x1e79('0x14')]?_0x5cee49[_0x1e79('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cee49[_0x1e79('0x14')]?_0x5cee49['options'][_0x1e79('0x1a')]||null:null,'attributes':_0x5cee49[_0x1e79('0x14')]?_0x5cee49[_0x1e79('0x14')]['attributes']||null:null,'limit':_0x5cee49[_0x1e79('0x14')]?_0x5cee49['options']['limit']||null:null})[_0x1e79('0x16')](function(_0x2ebaf4){logger[_0x1e79('0xb')](_0x1e79('0x1b'),_0x5cee49);logger[_0x1e79('0x1c')](_0x1e79('0x1b'),_0x5cee49,JSON[_0x1e79('0xf')](_0x2ebaf4));_0x150a51(_0x2ebaf4);})[_0x1e79('0x13')](function(_0x59a475){logger[_0x1e79('0x10')]('UpdateChatQueueReport',_0x59a475[_0x1e79('0x11')],_0x5cee49);_0x15e127(_0x4d37db[_0x1e79('0x10')](0x1f4,_0x59a475[_0x1e79('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index dcc7b51..80a06aa 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 _0x6f46=['../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d7f86,_0x588c27){var _0x4c80d1=function(_0x5448a8){while(--_0x5448a8){_0x5d7f86['push'](_0x5d7f86['shift']());}};_0x4c80d1(++_0x588c27);}(_0x6f46,0x115));var _0x66f4=function(_0x4bdda3,_0x25f960){_0x4bdda3=_0x4bdda3-0x0;var _0x3f8722=_0x6f46[_0x4bdda3];return _0x3f8722;};'use strict';var multer=require(_0x66f4('0x0'));var util=require(_0x66f4('0x1'));var path=require(_0x66f4('0x2'));var timeout=require(_0x66f4('0x3'));var express=require(_0x66f4('0x4'));var router=express[_0x66f4('0x5')]();var fs_extra=require(_0x66f4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x66f4('0x7'));var config=require(_0x66f4('0x8'));var controller=require(_0x66f4('0x9'));router['get']('/',auth[_0x66f4('0xa')](),controller['index']);router[_0x66f4('0xb')](_0x66f4('0xc'),auth[_0x66f4('0xa')](),controller['describe']);router[_0x66f4('0xb')](_0x66f4('0xd'),auth[_0x66f4('0xa')](),controller['show']);router[_0x66f4('0xe')]('/',auth['isAuthenticated'](),controller[_0x66f4('0xf')]);router[_0x66f4('0x10')]('/:id',auth[_0x66f4('0xa')](),controller['update']);router[_0x66f4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x66f4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x95c8=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','index','describe','/:id','isAuthenticated'];(function(_0x5575c1,_0x11b31a){var _0x50ea4e=function(_0x225d89){while(--_0x225d89){_0x5575c1['push'](_0x5575c1['shift']());}};_0x50ea4e(++_0x11b31a);}(_0x95c8,0x95));var _0x895c=function(_0x4b8fd2,_0x430cc7){_0x4b8fd2=_0x4b8fd2-0x0;var _0x3cdef5=_0x95c8[_0x4b8fd2];return _0x3cdef5;};'use strict';var multer=require(_0x895c('0x0'));var util=require(_0x895c('0x1'));var path=require('path');var timeout=require(_0x895c('0x2'));var express=require(_0x895c('0x3'));var router=express[_0x895c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x895c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x895c('0x6'));var controller=require(_0x895c('0x7'));router[_0x895c('0x8')]('/',auth['isAuthenticated'](),controller[_0x895c('0x9')]);router[_0x895c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x895c('0xa')]);router[_0x895c('0x8')](_0x895c('0xb'),auth[_0x895c('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x895c('0xd')](_0x895c('0xb'),auth[_0x895c('0xc')](),controller[_0x895c('0xe')]);router[_0x895c('0xf')](_0x895c('0xb'),auth[_0x895c('0xc')](),controller[_0x895c('0x10')]);module[_0x895c('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 031c3ce..bbd9203 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4beda6,_0x186de9){var _0x2c8556=function(_0x14d1e1){while(--_0x14d1e1){_0x4beda6['push'](_0x4beda6['shift']());}};_0x2c8556(++_0x186de9);}(_0x00bb,0x1d8));var _0xb00b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x00bb[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x9bde,0xe1));var _0xe9bd=function(_0x48e140,_0x14bde2){_0x48e140=_0x48e140-0x0;var _0x504d6a=_0x9bde[_0x48e140];return _0x504d6a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ab4aa0a..1fa03cc 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 _0x7365=['nolimit','sort','where','filters','merge','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty'];(function(_0x20b19c,_0x1dbd90){var _0x38b099=function(_0x30ce86){while(--_0x30ce86){_0x20b19c['push'](_0x20b19c['shift']());}};_0x38b099(++_0x1dbd90);}(_0x7365,0x1d4));var _0x5736=function(_0x54d5ba,_0x1f1ba9){_0x54d5ba=_0x54d5ba-0x0;var _0x6a592e=_0x7365[_0x54d5ba];return _0x6a592e;};'use strict';var emlformat=require(_0x5736('0x0'));var rimraf=require(_0x5736('0x1'));var zipdir=require(_0x5736('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5736('0x3'));var BPromise=require(_0x5736('0x4'));var Mustache=require(_0x5736('0x5'));var util=require(_0x5736('0x6'));var path=require('path');var sox=require(_0x5736('0x7'));var csv=require(_0x5736('0x8'));var ejs=require(_0x5736('0x9'));var fs=require('fs');var fs_extra=require(_0x5736('0xa'));var _=require(_0x5736('0xb'));var squel=require(_0x5736('0xc'));var crypto=require(_0x5736('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5736('0x8'));var querystring=require('querystring');var Papa=require(_0x5736('0xe'));var Redis=require('ioredis');var authService=require(_0x5736('0xf'));var qs=require(_0x5736('0x10'));var as=require(_0x5736('0x11'));var hardwareService=require(_0x5736('0x12'));var logger=require(_0x5736('0x13'))(_0x5736('0x14'));var utils=require(_0x5736('0x15'));var config=require(_0x5736('0x16'));var licenseUtil=require(_0x5736('0x17'));var db=require(_0x5736('0x18'))['db'];function respondWithStatusCode(_0x4d2744,_0x44e65b){_0x44e65b=_0x44e65b||0xcc;return function(_0x3a1f21){if(_0x3a1f21){return _0x4d2744[_0x5736('0x19')](_0x44e65b);}return _0x4d2744[_0x5736('0x1a')](_0x44e65b)['end']();};}function respondWithResult(_0x1631cd,_0x2844dc){_0x2844dc=_0x2844dc||0xc8;return function(_0x22a41e){if(_0x22a41e){return _0x1631cd[_0x5736('0x1a')](_0x2844dc)[_0x5736('0x1b')](_0x22a41e);}};}function respondWithFilteredResult(_0x2a8f0f,_0x307499){return function(_0x2adf79){if(_0x2adf79){var _0x2662b1=typeof _0x307499[_0x5736('0x1c')]==='undefined'&&typeof _0x307499[_0x5736('0x1d')]===_0x5736('0x1e');var _0x444e37=_0x2adf79[_0x5736('0x1f')];var _0x31508a=_0x2662b1?0x0:_0x307499[_0x5736('0x1c')];var _0x17aecd=_0x2662b1?_0x2adf79[_0x5736('0x1f')]:_0x307499[_0x5736('0x1c')]+_0x307499[_0x5736('0x1d')];var _0x252203;if(_0x17aecd>=_0x444e37){_0x17aecd=_0x444e37;_0x252203=0xc8;}else{_0x252203=0xce;}_0x2a8f0f[_0x5736('0x1a')](_0x252203);return _0x2a8f0f[_0x5736('0x20')]('Content-Range',_0x31508a+'-'+_0x17aecd+'/'+_0x444e37)['json'](_0x2adf79);}return null;};}function patchUpdates(_0x1c7061){return function(_0x33d042){try{jsonpatch[_0x5736('0x21')](_0x33d042,_0x1c7061,!![]);}catch(_0x47d6ae){return BPromise[_0x5736('0x22')](_0x47d6ae);}return _0x33d042['save']();};}function saveUpdates(_0x293b2f,_0x3047d7){return function(_0x58723b){if(_0x58723b){return _0x58723b[_0x5736('0x23')](_0x293b2f)[_0x5736('0x24')](function(_0x4e8abb){return _0x4e8abb;});}return null;};}function removeEntity(_0x114c9d,_0x47b163){return function(_0x409e73){if(_0x409e73){return _0x409e73[_0x5736('0x25')]()[_0x5736('0x24')](function(){_0x114c9d['status'](0xcc)[_0x5736('0x26')]();});}};}function handleEntityNotFound(_0x34a01c,_0x584b53){return function(_0x4a8467){if(!_0x4a8467){_0x34a01c[_0x5736('0x19')](0x194);}return _0x4a8467;};}function handleError(_0x32ef5f,_0x25850a){_0x25850a=_0x25850a||0x1f4;return function(_0x2a3fdb){logger[_0x5736('0x27')](_0x2a3fdb[_0x5736('0x28')]);if(_0x2a3fdb['name']){delete _0x2a3fdb[_0x5736('0x29')];}_0x32ef5f[_0x5736('0x1a')](_0x25850a)[_0x5736('0x2a')](_0x2a3fdb);};}exports[_0x5736('0x2b')]=function(_0x178dfe,_0x192638){var _0xb18256={},_0x587f18={},_0x3144f7={'count':0x0,'rows':[]};var _0x5d2342=_[_0x5736('0x2c')](db[_0x5736('0x2d')][_0x5736('0x2e')],function(_0x195360){return{'name':_0x195360[_0x5736('0x2f')],'type':_0x195360[_0x5736('0x30')][_0x5736('0x31')]};});_0x587f18['model']=_['map'](_0x5d2342,_0x5736('0x29'));_0x587f18[_0x5736('0x32')]=_['keys'](_0x178dfe[_0x5736('0x32')]);_0x587f18['filters']=_[_0x5736('0x33')](_0x587f18['model'],_0x587f18[_0x5736('0x32')]);_0xb18256[_0x5736('0x34')]=_[_0x5736('0x33')](_0x587f18[_0x5736('0x35')],qs['fields'](_0x178dfe[_0x5736('0x32')][_0x5736('0x36')]));_0xb18256[_0x5736('0x34')]=_0xb18256[_0x5736('0x34')][_0x5736('0x37')]?_0xb18256[_0x5736('0x34')]:_0x587f18[_0x5736('0x35')];if(!_0x178dfe[_0x5736('0x32')][_0x5736('0x38')](_0x5736('0x39'))){_0xb18256[_0x5736('0x1d')]=qs[_0x5736('0x1d')](_0x178dfe[_0x5736('0x32')][_0x5736('0x1d')]);_0xb18256[_0x5736('0x1c')]=qs['offset'](_0x178dfe[_0x5736('0x32')][_0x5736('0x1c')]);}_0xb18256['order']=qs[_0x5736('0x3a')](_0x178dfe[_0x5736('0x32')][_0x5736('0x3a')]);_0xb18256[_0x5736('0x3b')]=qs['filters'](_['pick'](_0x178dfe[_0x5736('0x32')],_0x587f18[_0x5736('0x3c')]),_0x5d2342);if(_0x178dfe[_0x5736('0x32')]['filter']){_0xb18256[_0x5736('0x3b')]=_['merge'](_0xb18256[_0x5736('0x3b')],{'$or':_['map'](_0x5d2342,function(_0x42cce0){if(_0x42cce0[_0x5736('0x30')]!=='VIRTUAL'){var _0xd5129b={};_0xd5129b[_0x42cce0[_0x5736('0x29')]]={'$like':'%'+_0x178dfe[_0x5736('0x32')]['filter']+'%'};return _0xd5129b;}})});}_0xb18256=_[_0x5736('0x3d')]({},_0xb18256,_0x178dfe['options']);var _0x7e1caa={'where':_0xb18256[_0x5736('0x3b')]};return db[_0x5736('0x2d')][_0x5736('0x1f')](_0x7e1caa)[_0x5736('0x24')](function(_0x34301e){_0x3144f7[_0x5736('0x1f')]=_0x34301e;if(_0x178dfe[_0x5736('0x32')][_0x5736('0x3e')]){_0xb18256['include']=[{'all':!![]}];}return db[_0x5736('0x2d')][_0x5736('0x3f')](_0xb18256);})[_0x5736('0x24')](function(_0x4cce19){_0x3144f7[_0x5736('0x40')]=_0x4cce19;return _0x3144f7;})[_0x5736('0x24')](respondWithFilteredResult(_0x192638,_0xb18256))[_0x5736('0x41')](handleError(_0x192638,null));};exports[_0x5736('0x42')]=function(_0x28bb1e,_0x1c993d){var _0x7370d4={'raw':!![],'where':{'id':_0x28bb1e[_0x5736('0x43')]['id']}},_0x1ab115={};_0x1ab115[_0x5736('0x35')]=_[_0x5736('0x44')](db[_0x5736('0x2d')][_0x5736('0x2e')]);_0x1ab115[_0x5736('0x32')]=_[_0x5736('0x44')](_0x28bb1e['query']);_0x1ab115[_0x5736('0x3c')]=_[_0x5736('0x33')](_0x1ab115[_0x5736('0x35')],_0x1ab115[_0x5736('0x32')]);_0x7370d4['attributes']=_['intersection'](_0x1ab115['model'],qs[_0x5736('0x36')](_0x28bb1e[_0x5736('0x32')]['fields']));_0x7370d4[_0x5736('0x34')]=_0x7370d4['attributes'][_0x5736('0x37')]?_0x7370d4['attributes']:_0x1ab115['model'];if(_0x28bb1e[_0x5736('0x32')][_0x5736('0x3e')]){_0x7370d4[_0x5736('0x45')]=[{'all':!![]}];}_0x7370d4=_[_0x5736('0x3d')]({},_0x7370d4,_0x28bb1e[_0x5736('0x46')]);return db[_0x5736('0x2d')][_0x5736('0x47')](_0x7370d4)['then'](handleEntityNotFound(_0x1c993d,null))[_0x5736('0x24')](respondWithResult(_0x1c993d,null))[_0x5736('0x41')](handleError(_0x1c993d,null));};exports['create']=function(_0x2eca2e,_0x2c6ea7){return db['ChatTransferReport'][_0x5736('0x48')](_0x2eca2e[_0x5736('0x49')],{})[_0x5736('0x24')](respondWithResult(_0x2c6ea7,0xc9))[_0x5736('0x41')](handleError(_0x2c6ea7,null));};exports[_0x5736('0x23')]=function(_0x5eeb5f,_0x1a2e23){if(_0x5eeb5f[_0x5736('0x49')]['id']){delete _0x5eeb5f[_0x5736('0x49')]['id'];}return db[_0x5736('0x2d')][_0x5736('0x47')]({'where':{'id':_0x5eeb5f['params']['id']}})[_0x5736('0x24')](handleEntityNotFound(_0x1a2e23,null))['then'](saveUpdates(_0x5eeb5f[_0x5736('0x49')],null))['then'](respondWithResult(_0x1a2e23,null))[_0x5736('0x41')](handleError(_0x1a2e23,null));};exports['destroy']=function(_0x44a264,_0x1de816){return db[_0x5736('0x2d')][_0x5736('0x47')]({'where':{'id':_0x44a264[_0x5736('0x43')]['id']}})[_0x5736('0x24')](handleEntityNotFound(_0x1de816,null))[_0x5736('0x24')](removeEntity(_0x1de816,null))[_0x5736('0x41')](handleError(_0x1de816,null));};exports[_0x5736('0x4a')]=function(_0x5b149e,_0x2c5d52){return db[_0x5736('0x2d')][_0x5736('0x4a')]()[_0x5736('0x24')](respondWithResult(_0x2c5d52,null))[_0x5736('0x41')](handleError(_0x2c5d52,null));}; \ No newline at end of file +var _0x05a8=['filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','include','catch','show','length','options','find','create','update','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','query','keys'];(function(_0x31eb98,_0x592fa2){var _0x20cf3e=function(_0x5e30b1){while(--_0x5e30b1){_0x31eb98['push'](_0x31eb98['shift']());}};_0x20cf3e(++_0x592fa2);}(_0x05a8,0xef));var _0x805a=function(_0xe5b422,_0x34669e){_0xe5b422=_0xe5b422-0x0;var _0x3e1199=_0x05a8[_0xe5b422];return _0x3e1199;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x805a('0x0'));var zipdir=require(_0x805a('0x1'));var jsonpatch=require(_0x805a('0x2'));var rp=require(_0x805a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x805a('0x4'));var util=require(_0x805a('0x5'));var path=require(_0x805a('0x6'));var sox=require(_0x805a('0x7'));var csv=require(_0x805a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x805a('0x9'));var _=require(_0x805a('0xa'));var squel=require(_0x805a('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x805a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x805a('0xd'));var Papa=require('papaparse');var Redis=require(_0x805a('0xe'));var authService=require(_0x805a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x805a('0x10'));var logger=require(_0x805a('0x11'))(_0x805a('0x12'));var utils=require(_0x805a('0x13'));var config=require(_0x805a('0x14'));var licenseUtil=require(_0x805a('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c603,_0x18af75){_0x18af75=_0x18af75||0xcc;return function(_0x287c9d){if(_0x287c9d){return _0x53c603[_0x805a('0x16')](_0x18af75);}return _0x53c603[_0x805a('0x17')](_0x18af75)['end']();};}function respondWithResult(_0x6ae92d,_0xd49b5c){_0xd49b5c=_0xd49b5c||0xc8;return function(_0x42f664){if(_0x42f664){return _0x6ae92d[_0x805a('0x17')](_0xd49b5c)['json'](_0x42f664);}};}function respondWithFilteredResult(_0x3410c0,_0x26fd30){return function(_0xf06f50){if(_0xf06f50){var _0x2003d7=typeof _0x26fd30[_0x805a('0x18')]===_0x805a('0x19')&&typeof _0x26fd30[_0x805a('0x1a')]===_0x805a('0x19');var _0x5e64e4=_0xf06f50[_0x805a('0x1b')];var _0x29c362=_0x2003d7?0x0:_0x26fd30[_0x805a('0x18')];var _0x1706bc=_0x2003d7?_0xf06f50[_0x805a('0x1b')]:_0x26fd30['offset']+_0x26fd30[_0x805a('0x1a')];var _0x134b5f;if(_0x1706bc>=_0x5e64e4){_0x1706bc=_0x5e64e4;_0x134b5f=0xc8;}else{_0x134b5f=0xce;}_0x3410c0[_0x805a('0x17')](_0x134b5f);return _0x3410c0[_0x805a('0x1c')](_0x805a('0x1d'),_0x29c362+'-'+_0x1706bc+'/'+_0x5e64e4)['json'](_0xf06f50);}return null;};}function patchUpdates(_0x18ade1){return function(_0x33e82c){try{jsonpatch[_0x805a('0x1e')](_0x33e82c,_0x18ade1,!![]);}catch(_0x2d2b14){return BPromise[_0x805a('0x1f')](_0x2d2b14);}return _0x33e82c[_0x805a('0x20')]();};}function saveUpdates(_0x2dc94a,_0x4132a9){return function(_0x281284){if(_0x281284){return _0x281284['update'](_0x2dc94a)[_0x805a('0x21')](function(_0x568f42){return _0x568f42;});}return null;};}function removeEntity(_0x712787,_0xc70a7){return function(_0x1f9ffe){if(_0x1f9ffe){return _0x1f9ffe[_0x805a('0x22')]()[_0x805a('0x21')](function(){_0x712787[_0x805a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49456a,_0x562302){return function(_0x1ba544){if(!_0x1ba544){_0x49456a[_0x805a('0x16')](0x194);}return _0x1ba544;};}function handleError(_0x267745,_0x54398e){_0x54398e=_0x54398e||0x1f4;return function(_0x26a9d9){logger['error'](_0x26a9d9[_0x805a('0x23')]);if(_0x26a9d9['name']){delete _0x26a9d9['name'];}_0x267745['status'](_0x54398e)[_0x805a('0x24')](_0x26a9d9);};}exports[_0x805a('0x25')]=function(_0x3f2000,_0xab1296){var _0x9b1e0f={},_0x3ebb34={},_0x4f577e={'count':0x0,'rows':[]};var _0x45fef4=_[_0x805a('0x26')](db[_0x805a('0x27')][_0x805a('0x28')],function(_0x26d8d5){return{'name':_0x26d8d5[_0x805a('0x29')],'type':_0x26d8d5[_0x805a('0x2a')]['key']};});_0x3ebb34['model']=_['map'](_0x45fef4,'name');_0x3ebb34[_0x805a('0x2b')]=_[_0x805a('0x2c')](_0x3f2000['query']);_0x3ebb34[_0x805a('0x2d')]=_[_0x805a('0x2e')](_0x3ebb34['model'],_0x3ebb34[_0x805a('0x2b')]);_0x9b1e0f[_0x805a('0x2f')]=_['intersection'](_0x3ebb34[_0x805a('0x30')],qs[_0x805a('0x31')](_0x3f2000['query'][_0x805a('0x31')]));_0x9b1e0f[_0x805a('0x2f')]=_0x9b1e0f[_0x805a('0x2f')]['length']?_0x9b1e0f['attributes']:_0x3ebb34[_0x805a('0x30')];if(!_0x3f2000['query']['hasOwnProperty'](_0x805a('0x32'))){_0x9b1e0f[_0x805a('0x1a')]=qs[_0x805a('0x1a')](_0x3f2000['query'][_0x805a('0x1a')]);_0x9b1e0f['offset']=qs['offset'](_0x3f2000[_0x805a('0x2b')]['offset']);}_0x9b1e0f[_0x805a('0x33')]=qs[_0x805a('0x34')](_0x3f2000[_0x805a('0x2b')]['sort']);_0x9b1e0f[_0x805a('0x35')]=qs['filters'](_[_0x805a('0x36')](_0x3f2000[_0x805a('0x2b')],_0x3ebb34[_0x805a('0x2d')]),_0x45fef4);if(_0x3f2000['query'][_0x805a('0x37')]){_0x9b1e0f[_0x805a('0x35')]=_['merge'](_0x9b1e0f[_0x805a('0x35')],{'$or':_[_0x805a('0x26')](_0x45fef4,function(_0x42e2a8){if(_0x42e2a8[_0x805a('0x2a')]!==_0x805a('0x38')){var _0x4d864d={};_0x4d864d[_0x42e2a8[_0x805a('0x39')]]={'$like':'%'+_0x3f2000[_0x805a('0x2b')][_0x805a('0x37')]+'%'};return _0x4d864d;}})});}_0x9b1e0f=_[_0x805a('0x3a')]({},_0x9b1e0f,_0x3f2000['options']);var _0x378d4b={'where':_0x9b1e0f[_0x805a('0x35')]};return db[_0x805a('0x27')]['count'](_0x378d4b)[_0x805a('0x21')](function(_0x65fe18){_0x4f577e[_0x805a('0x1b')]=_0x65fe18;if(_0x3f2000[_0x805a('0x2b')][_0x805a('0x3b')]){_0x9b1e0f[_0x805a('0x3c')]=[{'all':!![]}];}return db[_0x805a('0x27')]['findAll'](_0x9b1e0f);})['then'](function(_0x57fb96){_0x4f577e['rows']=_0x57fb96;return _0x4f577e;})[_0x805a('0x21')](respondWithFilteredResult(_0xab1296,_0x9b1e0f))[_0x805a('0x3d')](handleError(_0xab1296,null));};exports[_0x805a('0x3e')]=function(_0x5030fc,_0x2e64c4){var _0x3c4640={'raw':!![],'where':{'id':_0x5030fc['params']['id']}},_0x43c033={};_0x43c033['model']=_[_0x805a('0x2c')](db[_0x805a('0x27')][_0x805a('0x28')]);_0x43c033[_0x805a('0x2b')]=_[_0x805a('0x2c')](_0x5030fc['query']);_0x43c033['filters']=_[_0x805a('0x2e')](_0x43c033['model'],_0x43c033['query']);_0x3c4640['attributes']=_[_0x805a('0x2e')](_0x43c033[_0x805a('0x30')],qs['fields'](_0x5030fc['query'][_0x805a('0x31')]));_0x3c4640[_0x805a('0x2f')]=_0x3c4640[_0x805a('0x2f')][_0x805a('0x3f')]?_0x3c4640['attributes']:_0x43c033[_0x805a('0x30')];if(_0x5030fc[_0x805a('0x2b')][_0x805a('0x3b')]){_0x3c4640[_0x805a('0x3c')]=[{'all':!![]}];}_0x3c4640=_[_0x805a('0x3a')]({},_0x3c4640,_0x5030fc[_0x805a('0x40')]);return db[_0x805a('0x27')][_0x805a('0x41')](_0x3c4640)[_0x805a('0x21')](handleEntityNotFound(_0x2e64c4,null))[_0x805a('0x21')](respondWithResult(_0x2e64c4,null))[_0x805a('0x3d')](handleError(_0x2e64c4,null));};exports[_0x805a('0x42')]=function(_0x1ce3d2,_0x47e991){return db['ChatTransferReport'][_0x805a('0x42')](_0x1ce3d2['body'],{})['then'](respondWithResult(_0x47e991,0xc9))[_0x805a('0x3d')](handleError(_0x47e991,null));};exports[_0x805a('0x43')]=function(_0x1fd8c7,_0x5a6d62){if(_0x1fd8c7[_0x805a('0x44')]['id']){delete _0x1fd8c7['body']['id'];}return db['ChatTransferReport'][_0x805a('0x41')]({'where':{'id':_0x1fd8c7[_0x805a('0x45')]['id']}})[_0x805a('0x21')](handleEntityNotFound(_0x5a6d62,null))[_0x805a('0x21')](saveUpdates(_0x1fd8c7[_0x805a('0x44')],null))[_0x805a('0x21')](respondWithResult(_0x5a6d62,null))['catch'](handleError(_0x5a6d62,null));};exports['destroy']=function(_0x7ce31,_0x16af61){return db[_0x805a('0x27')][_0x805a('0x41')]({'where':{'id':_0x7ce31['params']['id']}})[_0x805a('0x21')](handleEntityNotFound(_0x16af61,null))[_0x805a('0x21')](removeEntity(_0x16af61,null))['catch'](handleError(_0x16af61,null));};exports[_0x805a('0x46')]=function(_0x546326,_0x32fd49){return db[_0x805a('0x27')][_0x805a('0x46')]()[_0x805a('0x21')](respondWithResult(_0x32fd49,null))[_0x805a('0x3d')](handleError(_0x32fd49,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index cc09fab..3bb7bf1 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 _0xd013=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0xd013,0x1c9));var _0x3d01=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xd013[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d01('0x0'))(_0x3d01('0x1'));var moment=require('moment');var BPromise=require(_0x3d01('0x2'));var rp=require(_0x3d01('0x3'));var fs=require('fs');var path=require(_0x3d01('0x4'));var rimraf=require(_0x3d01('0x5'));var config=require(_0x3d01('0x6'));var attributes=require(_0x3d01('0x7'));module[_0x3d01('0x8')]=function(_0x2e7183,_0x15e3a7){return _0x2e7183['define']('ChatTransferReport',attributes,{'tableName':_0x3d01('0x9'),'paranoid':![],'indexes':[{'name':_0x3d01('0xa'),'fields':[_0x3d01('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcafd=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','request-promise','path'];(function(_0x260b3b,_0x400f37){var _0x435f01=function(_0x6dfef){while(--_0x6dfef){_0x260b3b['push'](_0x260b3b['shift']());}};_0x435f01(++_0x400f37);}(_0xcafd,0x18e));var _0xdcaf=function(_0x2c00fe,_0x34d236){_0x2c00fe=_0x2c00fe-0x0;var _0x1fcbb7=_0xcafd[_0x2c00fe];return _0x1fcbb7;};'use strict';var _=require(_0xdcaf('0x0'));var util=require(_0xdcaf('0x1'));var logger=require(_0xdcaf('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdcaf('0x3'));var fs=require('fs');var path=require(_0xdcaf('0x4'));var rimraf=require(_0xdcaf('0x5'));var config=require(_0xdcaf('0x6'));var attributes=require(_0xdcaf('0x7'));module[_0xdcaf('0x8')]=function(_0x2a5324,_0x3a3c72){return _0x2a5324[_0xdcaf('0x9')](_0xdcaf('0xa'),attributes,{'tableName':_0xdcaf('0xb'),'paranoid':![],'indexes':[{'name':_0xdcaf('0xc'),'fields':[_0xdcaf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e954eae..5e5c7fc 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 _0xabc1=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s','message','info','result'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xabc1,0x161));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var util=require(_0x1abc('0x1'));var moment=require(_0x1abc('0x2'));var BPromise=require(_0x1abc('0x3'));var rs=require(_0x1abc('0x4'));var fs=require('fs');var Redis=require(_0x1abc('0x5'));var db=require(_0x1abc('0x6'))['db'];var utils=require(_0x1abc('0x7'));var logger=require('../../config/logger')(_0x1abc('0x8'));var config=require('../../config/environment');var jayson=require(_0x1abc('0x9'));var client=jayson['client'][_0x1abc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cb447,_0x16955a,_0x21f1c1){return new BPromise(function(_0x1e18ce,_0x5b7204){return client['request'](_0x2cb447,_0x21f1c1)[_0x1abc('0xb')](function(_0x2efc50){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x16955a,'request\x20sent');logger[_0x1abc('0xc')](_0x1abc('0xd'),_0x16955a,_0x1abc('0xe'),JSON['stringify'](_0x2efc50));if(_0x2efc50['error']){if(_0x2efc50[_0x1abc('0xf')][_0x1abc('0x10')]===0x1f4){logger[_0x1abc('0xf')](_0x1abc('0x11'),_0x16955a,_0x2efc50[_0x1abc('0xf')]['message']);return _0x5b7204(_0x2efc50['error']['message']);}logger['error'](_0x1abc('0x11'),_0x16955a,_0x2efc50[_0x1abc('0xf')][_0x1abc('0x12')]);return _0x1e18ce(_0x2efc50[_0x1abc('0xf')][_0x1abc('0x12')]);}else{logger[_0x1abc('0x13')](_0x1abc('0x11'),_0x16955a,_0x1abc('0xe'));_0x1e18ce(_0x2efc50[_0x1abc('0x14')][_0x1abc('0x12')]);}})[_0x1abc('0x15')](function(_0x4cb515){logger['error'](_0x1abc('0x11'),_0x16955a,_0x4cb515);_0x5b7204(_0x4cb515);});});} \ No newline at end of file +var _0x1f75=['jayson/promise','client','http','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4e218b,_0x52e3e8){var _0x59d177=function(_0x52a23e){while(--_0x52a23e){_0x4e218b['push'](_0x4e218b['shift']());}};_0x59d177(++_0x52e3e8);}(_0x1f75,0x13b));var _0x51f7=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x1f75[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x51f7('0x0'));var util=require(_0x51f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51f7('0x2'));var fs=require('fs');var Redis=require(_0x51f7('0x3'));var db=require(_0x51f7('0x4'))['db'];var utils=require(_0x51f7('0x5'));var logger=require(_0x51f7('0x6'))('rpc');var config=require(_0x51f7('0x7'));var jayson=require(_0x51f7('0x8'));var client=jayson[_0x51f7('0x9')][_0x51f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52f5e9,_0x37be23,_0x253d92){return new BPromise(function(_0x43ccae,_0x4416e2){return client['request'](_0x52f5e9,_0x253d92)['then'](function(_0x2c5915){logger['info'](_0x51f7('0xb'),_0x37be23,_0x51f7('0xc'));logger['debug'](_0x51f7('0xd'),_0x37be23,_0x51f7('0xc'),JSON[_0x51f7('0xe')](_0x2c5915));if(_0x2c5915[_0x51f7('0xf')]){if(_0x2c5915[_0x51f7('0xf')]['code']===0x1f4){logger[_0x51f7('0xf')](_0x51f7('0xb'),_0x37be23,_0x2c5915[_0x51f7('0xf')][_0x51f7('0x10')]);return _0x4416e2(_0x2c5915['error']['message']);}logger[_0x51f7('0xf')](_0x51f7('0xb'),_0x37be23,_0x2c5915[_0x51f7('0xf')][_0x51f7('0x10')]);return _0x43ccae(_0x2c5915[_0x51f7('0xf')][_0x51f7('0x10')]);}else{logger[_0x51f7('0x11')](_0x51f7('0xb'),_0x37be23,_0x51f7('0xc'));_0x43ccae(_0x2c5915[_0x51f7('0x12')]['message']);}})['catch'](function(_0x5d0082){logger[_0x51f7('0xf')](_0x51f7('0xb'),_0x37be23,_0x5d0082);_0x4416e2(_0x5d0082);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 741c2d1..aa4371d 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 _0xfff5=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x10e840,_0x5b3935){var _0x405caa=function(_0x46b707){while(--_0x46b707){_0x10e840['push'](_0x10e840['shift']());}};_0x405caa(++_0x5b3935);}(_0xfff5,0x164));var _0x5fff=function(_0x367712,_0x5a0cb4){_0x367712=_0x367712-0x0;var _0x5c8ba3=_0xfff5[_0x367712];return _0x5c8ba3;};'use strict';var multer=require(_0x5fff('0x0'));var util=require(_0x5fff('0x1'));var path=require(_0x5fff('0x2'));var timeout=require(_0x5fff('0x3'));var express=require(_0x5fff('0x4'));var router=express[_0x5fff('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5fff('0x6'));var config=require(_0x5fff('0x7'));var controller=require(_0x5fff('0x8'));router[_0x5fff('0x9')]('/',auth[_0x5fff('0xa')](),controller[_0x5fff('0xb')]);router[_0x5fff('0x9')](_0x5fff('0xc'),auth[_0x5fff('0xa')](),controller[_0x5fff('0xd')]);router['get'](_0x5fff('0xe'),auth['isAuthenticated'](),controller[_0x5fff('0xf')]);router[_0x5fff('0x10')]('/',auth['isAuthenticated'](),controller[_0x5fff('0x11')]);router['put'](_0x5fff('0xe'),auth[_0x5fff('0xa')](),controller[_0x5fff('0x12')]);router[_0x5fff('0x13')](_0x5fff('0xe'),auth[_0x5fff('0xa')](),controller[_0x5fff('0x14')]);module[_0x5fff('0x15')]=router; \ No newline at end of file +var _0x9f5f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b4e4c,_0x49dd34){var _0x56742d=function(_0x4295b6){while(--_0x4295b6){_0x5b4e4c['push'](_0x5b4e4c['shift']());}};_0x56742d(++_0x49dd34);}(_0x9f5f,0x1f4));var _0xf9f5=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x9f5f[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0xf9f5('0x0'));var util=require('util');var path=require(_0xf9f5('0x1'));var timeout=require(_0xf9f5('0x2'));var express=require(_0xf9f5('0x3'));var router=express[_0xf9f5('0x4')]();var fs_extra=require(_0xf9f5('0x5'));var auth=require(_0xf9f5('0x6'));var interaction=require(_0xf9f5('0x7'));var config=require(_0xf9f5('0x8'));var controller=require('./chatTransferReport.controller');router[_0xf9f5('0x9')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xb')]);router[_0xf9f5('0x9')]('/describe',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xc')]);router[_0xf9f5('0x9')](_0xf9f5('0xd'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0xe')]);router[_0xf9f5('0xf')]('/',auth[_0xf9f5('0xa')](),controller[_0xf9f5('0x10')]);router[_0xf9f5('0x11')](_0xf9f5('0xd'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0x12')]);router[_0xf9f5('0x13')](_0xf9f5('0xd'),auth[_0xf9f5('0xa')](),controller[_0xf9f5('0x14')]);module[_0xf9f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a123c90..cefc070 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 _0x9f62=['Skip','Feedback','thumb','stringify','input','name','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x5335d4,_0x222022){var _0x2f96ff=function(_0x42e82a){while(--_0x42e82a){_0x5335d4['push'](_0x5335d4['shift']());}};_0x2f96ff(++_0x222022);}(_0x9f62,0x154));var _0x29f6=function(_0x21f331,_0x2c8b35){_0x21f331=_0x21f331-0x0;var _0x4978ff=_0x9f62[_0x21f331];return _0x4978ff;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x29f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'unique':_0x29f6('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x3')},'mapKeyOffline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x3')},'key':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0x4')},'customerAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':_0x29f6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x29f6('0x8')](_0x29f6('0x9'),'squared'),'defaultValue':_0x29f6('0x9')},'header_online':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x29f6('0xa')},'header_offline':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xb')},'download_transcript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x29f6('0xe')]},'closingQuestion':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x11')},'noteTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x13')},'closingMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x15')},'ratingType':{'type':Sequelize[_0x29f6('0x8')]('star',_0x29f6('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'variable':null,'config':{'placeholder':_0x29f6('0x19'),'type':'text','required':!![]},'props':{'title':_0x29f6('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x29f6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x29f6('0x1a')]('onlineForm')?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')]('onlineForm')):{};},'set':function(_0x1401fb){return this[_0x29f6('0x1c')](_0x29f6('0x1d'),JSON[_0x29f6('0x17')](_0x1401fb));}},'offlineForm':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return JSON[_0x29f6('0x17')]({'items':[{'type':_0x29f6('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x29f6('0x3'),'type':_0x29f6('0x3')},'variable':null},{'type':_0x29f6('0x1e'),'config':{'placeholder':_0x29f6('0x1f')},'props':{'title':_0x29f6('0x1f'),'helpText':_0x29f6('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x29f6('0x1a')](_0x29f6('0x21'))?JSON[_0x29f6('0x1b')](this[_0x29f6('0x1a')](_0x29f6('0x21'))):{};},'set':function(_0x1c3f0b){return this[_0x29f6('0x1c')](_0x29f6('0x21'),JSON[_0x29f6('0x17')](_0x1c3f0b));}},'token':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return rs[_0x29f6('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x29f6('0x1')]},'waitingTitle':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x24')},'offlineMessageBody':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x26')},'skipUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x14')},'sendUnmanaged':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':function(){return _0x29f6('0x27');}},'notificationSound':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x29f6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':_0x29f6('0x29')},'messagesAlignment':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x29f6('0x1')]},'customerAvatar':{'type':Sequelize[_0x29f6('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x29f6('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x29f6('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x29f6('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3f3475){if(!_0x3f3475)this[_0x29f6('0x1c')]('mandatoryDispositionPauseId',null);this[_0x29f6('0x1c')](_0x29f6('0x2a'),_0x3f3475);}},'vidaooEscalation':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x29f6('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x29f6('0x2b')},'vidaooNote':{'type':Sequelize[_0x29f6('0x1')],'defaultValue':function(){return _0x29f6('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x29f6('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x29f6('0xc')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xda55=['alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x3f9e36,_0x533cb0){var _0x4895bc=function(_0x22a48f){while(--_0x22a48f){_0x3f9e36['push'](_0x3f9e36['shift']());}};_0x4895bc(++_0x533cb0);}(_0xda55,0x6d));var _0x5da5=function(_0x2fced0,_0x454743){_0x2fced0=_0x2fced0-0x0;var _0x25b3af=_0xda55[_0x2fced0];return _0x25b3af;};'use strict';var Sequelize=require(_0x5da5('0x0'));var rs=require(_0x5da5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'unique':_0x5da5('0x3')},'description':{'type':Sequelize[_0x5da5('0x2')]},'mapKey':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5da5('0x2')]},'animation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5da5('0x9')](_0x5da5('0xa'),_0x5da5('0xb')),'defaultValue':_0x5da5('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0xc')},'start_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xd')},'header_offline':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xe')},'download_transcript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5da5('0xf')]},'closingQuestion':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x13')},'placeholderMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x14')},'closingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x15')},'closingMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x16')},'conditionAgreement':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x17')},'ratingType':{'type':Sequelize[_0x5da5('0x9')]('star',_0x5da5('0x18')),'defaultValue':_0x5da5('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x5da5('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5da5('0x1b'),'props':{'title':_0x5da5('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x1e'))?JSON[_0x5da5('0x1f')](this[_0x5da5('0x1d')]('onlineForm')):{};},'set':function(_0x5b0b43){return this['setDataValue'](_0x5da5('0x1e'),JSON['stringify'](_0x5b0b43));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':_0x5da5('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5da5('0x20')},'props':{'title':_0x5da5('0x20'),'helpText':_0x5da5('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x22'))?JSON['parse'](this[_0x5da5('0x1d')](_0x5da5('0x22'))):{};},'set':function(_0x31cb5f){return this[_0x5da5('0x23')]('offlineForm',JSON['stringify'](_0x31cb5f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5da5('0x24')]();}},'autoclose':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5da5('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x25')},'offlineMessageBody':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5da5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return _0x5da5('0x28');}},'notificationSound':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2b')},'messagesAlignment':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5da5('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2e')},'systemAvatar':{'type':Sequelize[_0x5da5('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5da5('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'comment':_0x5da5('0x2f'),'set':function(_0x14c3f5){if(!_0x14c3f5)this[_0x5da5('0x23')](_0x5da5('0x30'),null);this['setDataValue'](_0x5da5('0x31'),_0x14c3f5);}},'vidaooEscalation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x5da5('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5da5('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d1c532e..41214bf 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 _0x6f3e=['filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','findAll','rows','show','params','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','pick','removeDispositions','addAnswer','CannedAnswer','ids','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','DESC','ChatApplication','Applications','account','applications','orderBy','priority','asc','Contacts','CmContact','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','files','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','Smtp','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','../../config/license/util','virtual','custom','License','increment','chatLicenseExceeded','Intervals','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','alignment','verticalAlignment','labelText','color_button','IntervalId','addApplications','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getProactiveActions','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','path','lodash','querystring','ioredis','../../components/parsers/qs','../../config/environment','redis','defaults','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','keys','query'];(function(_0x1b73d7,_0x215968){var _0x2f39ae=function(_0xe2fe99){while(--_0xe2fe99){_0x1b73d7['push'](_0x1b73d7['shift']());}};_0x2f39ae(++_0x215968);}(_0x6f3e,0xf3));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0xe6f3('0x0'));var Mustache=require(_0xe6f3('0x1'));var util=require('util');var path=require(_0xe6f3('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6f3('0x3'));var querystring=require(_0xe6f3('0x4'));var Redis=require(_0xe6f3('0x5'));var qs=require(_0xe6f3('0x6'));var logger=require('../../config/logger')('api');var config=require(_0xe6f3('0x7'));var db=require('../../mysqldb')['db'];config[_0xe6f3('0x8')]=_[_0xe6f3('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe6f3('0xa'))(new Redis(config[_0xe6f3('0x8')]));require(_0xe6f3('0xb'))['register'](socket);var htmlToText=require(_0xe6f3('0xc'));var jayson=require(_0xe6f3('0xd'));var client=jayson[_0xe6f3('0xe')][_0xe6f3('0xf')]({'port':0x232c});var client9002=jayson[_0xe6f3('0xe')][_0xe6f3('0xf')]({'port':0x232a});var client9003=jayson[_0xe6f3('0xe')][_0xe6f3('0xf')]({'port':0x232b});var client9001=jayson[_0xe6f3('0xe')][_0xe6f3('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x3f0d25,_0x5aac8b,_0x251308,_0x9ad057){return new BPromise(function(_0x436d7c,_0x5cc709){var _0xae1df2=_0x9ad057||client;return _0xae1df2['request'](_0x3f0d25,_0x251308)[_0xe6f3('0x10')](function(_0x12d4e1){logger[_0xe6f3('0x11')](_0xe6f3('0x12'),_0x5aac8b,_0xe6f3('0x13'));logger[_0xe6f3('0x14')](_0xe6f3('0x15'),_0x5aac8b,_0xe6f3('0x13'),JSON['stringify'](_0x12d4e1));if(_0x12d4e1[_0xe6f3('0x16')]){if(_0x12d4e1[_0xe6f3('0x16')]['code']===0x1f4){logger[_0xe6f3('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x5aac8b,_0x12d4e1['error']['message']);return _0x5cc709(_0x12d4e1[_0xe6f3('0x16')]['message']);}logger[_0xe6f3('0x16')](_0xe6f3('0x12'),_0x5aac8b,_0x12d4e1['error'][_0xe6f3('0x17')]);return _0x436d7c(_0x12d4e1['error'][_0xe6f3('0x17')]);}else{logger[_0xe6f3('0x11')](_0xe6f3('0x12'),_0x5aac8b,'request\x20sent');_0x436d7c(_0x12d4e1[_0xe6f3('0x18')][_0xe6f3('0x17')]);}})['catch'](function(_0x1249b4){logger[_0xe6f3('0x16')](_0xe6f3('0x12'),_0x5aac8b,_0x1249b4);_0x5cc709(_0x1249b4);});});}function respondWithStatusCode(_0x389a52,_0x18658f){_0x18658f=_0x18658f||0xcc;return function(_0x4066a4){if(_0x4066a4){return _0x389a52[_0xe6f3('0x19')](_0x18658f);}return _0x389a52[_0xe6f3('0x1a')](_0x18658f)[_0xe6f3('0x1b')]();};}function respondWithResult(_0x39896f,_0x30dd4d){_0x30dd4d=_0x30dd4d||0xc8;return function(_0x173e06){if(_0x173e06){return _0x39896f[_0xe6f3('0x1a')](_0x30dd4d)[_0xe6f3('0x1c')](_0x173e06);}};}function respondWithFilteredResult(_0x1da5dc,_0x227de7){return function(_0x334503){if(_0x334503){var _0x57a53e=typeof _0x227de7[_0xe6f3('0x1d')]===_0xe6f3('0x1e')&&typeof _0x227de7[_0xe6f3('0x1f')]==='undefined';var _0x3ca9d4=_0x334503[_0xe6f3('0x20')];var _0x37a1ef=_0x57a53e?0x0:_0x227de7[_0xe6f3('0x1d')];var _0x1910ee=_0x57a53e?_0x334503[_0xe6f3('0x20')]:_0x227de7[_0xe6f3('0x1d')]+_0x227de7[_0xe6f3('0x1f')];var _0x233497;if(_0x1910ee>=_0x3ca9d4){_0x1910ee=_0x3ca9d4;_0x233497=0xc8;}else{_0x233497=0xce;}_0x1da5dc[_0xe6f3('0x1a')](_0x233497);return _0x1da5dc[_0xe6f3('0x21')](_0xe6f3('0x22'),_0x37a1ef+'-'+_0x1910ee+'/'+_0x3ca9d4)[_0xe6f3('0x1c')](_0x334503);}return null;};}function saveUpdates(_0x28f723){return function(_0x25b204){if(_0x25b204){return _0x25b204['update'](_0x28f723)[_0xe6f3('0x10')](function(_0x14fcee){return _0x14fcee;});}return null;};}function removeEntity(_0x15cb12){return function(_0x146707){if(_0x146707){return _0x146707[_0xe6f3('0x23')]()[_0xe6f3('0x10')](function(){var _0x4aad10=_0x146707[_0xe6f3('0x24')]({'plain':!![]});var _0x174058=_0xe6f3('0x25');return db[_0xe6f3('0x26')][_0xe6f3('0x23')]({'where':{'type':_0x174058,'resourceId':_0x4aad10['id']}})[_0xe6f3('0x10')](function(){return _0x146707;});})[_0xe6f3('0x10')](function(){_0x15cb12[_0xe6f3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x389c47){return function(_0x5b2b16){if(!_0x5b2b16){_0x389c47[_0xe6f3('0x19')](0x194);}return _0x5b2b16;};}function handleError(_0x12319c,_0x2c5766){_0x2c5766=_0x2c5766||0x1f4;return function(_0x2cbd4d){logger[_0xe6f3('0x16')](_0x2cbd4d[_0xe6f3('0x27')]);if(_0x2cbd4d[_0xe6f3('0x28')]){delete _0x2cbd4d[_0xe6f3('0x28')];}_0x12319c[_0xe6f3('0x1a')](_0x2c5766)['send'](_0x2cbd4d);};}exports[_0xe6f3('0x29')]=function(_0x4a96e6,_0x9827ad){var _0x4dc04b={'include':[{'model':db[_0xe6f3('0x2a')],'as':_0xe6f3('0x2b')}]},_0x47a3e5={},_0x78dc63={'count':0x0,'rows':[]};var _0x379b99=_[_0xe6f3('0x2c')](db[_0xe6f3('0x2d')][_0xe6f3('0x2e')],function(_0x3dba43){return{'name':_0x3dba43[_0xe6f3('0x2f')],'type':_0x3dba43[_0xe6f3('0x30')][_0xe6f3('0x31')]};});_0x47a3e5['model']=_[_0xe6f3('0x2c')](_0x379b99,'name');_0x47a3e5['query']=_[_0xe6f3('0x32')](_0x4a96e6[_0xe6f3('0x33')]);_0x47a3e5[_0xe6f3('0x34')]=_[_0xe6f3('0x35')](_0x47a3e5['model'],_0x47a3e5[_0xe6f3('0x33')]);_0x4dc04b[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x47a3e5[_0xe6f3('0x37')],qs['fields'](_0x4a96e6['query'][_0xe6f3('0x38')]));_0x4dc04b[_0xe6f3('0x36')]=_0x4dc04b['attributes'][_0xe6f3('0x39')]?_0x4dc04b['attributes']:_0x47a3e5[_0xe6f3('0x37')];if(!_0x4a96e6[_0xe6f3('0x33')][_0xe6f3('0x3a')]('nolimit')){_0x4dc04b['limit']=qs[_0xe6f3('0x1f')](_0x4a96e6['query']['limit']);_0x4dc04b[_0xe6f3('0x1d')]=qs[_0xe6f3('0x1d')](_0x4a96e6['query']['offset']);}_0x4dc04b[_0xe6f3('0x3b')]=qs[_0xe6f3('0x3c')](_0x4a96e6['query'][_0xe6f3('0x3c')]);_0x4dc04b[_0xe6f3('0x3d')]=qs[_0xe6f3('0x34')](_['pick'](_0x4a96e6['query'],_0x47a3e5[_0xe6f3('0x34')]),_0x379b99);if(_0x4a96e6['query']['filter']){_0x4dc04b[_0xe6f3('0x3d')]=_[_0xe6f3('0x3e')](_0x4dc04b[_0xe6f3('0x3d')],{'$or':_[_0xe6f3('0x2c')](_0x379b99,function(_0x3be62f){if(_0x3be62f[_0xe6f3('0x30')]!=='VIRTUAL'){var _0x18cfb9={};_0x18cfb9[_0x3be62f[_0xe6f3('0x28')]]={'$like':'%'+_0x4a96e6[_0xe6f3('0x33')][_0xe6f3('0x3f')]+'%'};return _0x18cfb9;}})});}_0x4dc04b=_[_0xe6f3('0x3e')]({},_0x4dc04b,_0x4a96e6[_0xe6f3('0x40')]);var _0xd9f71a={'where':_0x4dc04b[_0xe6f3('0x3d')]};return db[_0xe6f3('0x2d')][_0xe6f3('0x20')](_0xd9f71a)[_0xe6f3('0x10')](function(_0x16a461){_0x78dc63[_0xe6f3('0x20')]=_0x16a461;if(_0x4a96e6[_0xe6f3('0x33')][_0xe6f3('0x41')]){_0x4dc04b['include']=[{'all':!![]}];}return db[_0xe6f3('0x2d')][_0xe6f3('0x42')](_0x4dc04b);})[_0xe6f3('0x10')](function(_0xa1e1d5){_0x78dc63[_0xe6f3('0x43')]=_0xa1e1d5;return _0x78dc63;})[_0xe6f3('0x10')](respondWithFilteredResult(_0x9827ad,_0x4dc04b))['catch'](handleError(_0x9827ad,null));};exports[_0xe6f3('0x44')]=function(_0x54868e,_0x5b6834){var _0x35e49b={'raw':![],'where':{'id':_0x54868e[_0xe6f3('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0xe6f3('0x2b')}]},_0x1b187f={};_0x1b187f[_0xe6f3('0x37')]=_[_0xe6f3('0x32')](db['ChatWebsite']['rawAttributes']);_0x1b187f['query']=_['keys'](_0x54868e[_0xe6f3('0x33')]);_0x1b187f['filters']=_['intersection'](_0x1b187f[_0xe6f3('0x37')],_0x1b187f[_0xe6f3('0x33')]);_0x35e49b[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x1b187f[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x54868e['query']['fields']));_0x35e49b[_0xe6f3('0x36')]=_0x35e49b[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x35e49b[_0xe6f3('0x36')]:_0x1b187f[_0xe6f3('0x37')];if(_0x54868e[_0xe6f3('0x33')]['includeAll']){_0x35e49b[_0xe6f3('0x46')]=[{'all':!![]}];}_0x35e49b=_[_0xe6f3('0x3e')]({},_0x35e49b,_0x54868e[_0xe6f3('0x40')]);return db[_0xe6f3('0x2d')]['find'](_0x35e49b)['then'](handleEntityNotFound(_0x5b6834,null))['then'](respondWithResult(_0x5b6834,null))[_0xe6f3('0x47')](handleError(_0x5b6834,null));};exports[_0xe6f3('0x48')]=function(_0x38a418,_0x4ad4dd){return db[_0xe6f3('0x2d')]['create'](_0x38a418[_0xe6f3('0x49')],{})['then'](function(_0x3c08f3){var _0x215fd3=_0x38a418[_0xe6f3('0x4a')][_0xe6f3('0x24')]({'plain':!![]});if(!_0x215fd3)throw new Error(_0xe6f3('0x4b'));if(_0x215fd3['role']==='user'){var _0x1f8d34=_0x3c08f3['get']({'plain':!![]});var _0x213983=_0xe6f3('0x25');return db[_0xe6f3('0x4c')][_0xe6f3('0x4d')]({'where':{'name':_0x213983,'userProfileId':_0x215fd3[_0xe6f3('0x4e')]},'raw':!![]})[_0xe6f3('0x10')](function(_0x187fb1){if(_0x187fb1&&_0x187fb1[_0xe6f3('0x4f')]===0x0){return db[_0xe6f3('0x26')][_0xe6f3('0x48')]({'name':_0x1f8d34[_0xe6f3('0x28')],'resourceId':_0x1f8d34['id'],'type':_0x187fb1[_0xe6f3('0x28')],'sectionId':_0x187fb1['id']},{})[_0xe6f3('0x10')](function(){return _0x3c08f3;});}else{return _0x3c08f3;}})[_0xe6f3('0x47')](function(_0xfde2b2){logger['error'](_0xe6f3('0x50'),_0xfde2b2);throw _0xfde2b2;});}return _0x3c08f3;})['then'](respondWithResult(_0x4ad4dd,0xc9))[_0xe6f3('0x47')](handleError(_0x4ad4dd,null));};exports['update']=function(_0x2c7539,_0x5b4b07){if(_0x2c7539[_0xe6f3('0x49')]['id']){delete _0x2c7539[_0xe6f3('0x49')]['id'];}return db[_0xe6f3('0x2d')]['find']({'where':{'id':_0x2c7539[_0xe6f3('0x45')]['id']},'include':[{'model':db['Pause'],'as':_0xe6f3('0x2b')}]})[_0xe6f3('0x10')](handleEntityNotFound(_0x5b4b07,null))[_0xe6f3('0x10')](saveUpdates(_0x2c7539['body'],null))['then'](respondWithResult(_0x5b4b07,null))[_0xe6f3('0x47')](handleError(_0x5b4b07,null));};exports[_0xe6f3('0x23')]=function(_0x1471c6,_0x554a6f){return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x1471c6[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x554a6f,null))[_0xe6f3('0x10')](removeEntity(_0x554a6f,null))[_0xe6f3('0x47')](handleError(_0x554a6f,null));};exports[_0xe6f3('0x51')]=function(_0x4854bf,_0x22e604){return db[_0xe6f3('0x2d')][_0xe6f3('0x51')]()['then'](respondWithResult(_0x22e604,null))['catch'](handleError(_0x22e604,null));};exports[_0xe6f3('0x52')]=function(_0x34602f,_0x19f017){if(_0x34602f[_0xe6f3('0x49')]['id']){delete _0x34602f['body']['id'];}return db['ChatWebsite'][_0xe6f3('0x4d')]({'where':{'id':_0x34602f[_0xe6f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x19f017,null))['then'](function(_0x14af7d){if(_0x14af7d){_0x34602f['body'][_0xe6f3('0x53')]=_0x14af7d['id'];return db[_0xe6f3('0x54')]['create'](_0x34602f[_0xe6f3('0x49')]);}})['then'](respondWithResult(_0x19f017,null))[_0xe6f3('0x47')](handleError(_0x19f017,null));};exports['getDispositions']=function(_0x328c78,_0x2c8132){var _0x4a3916={'raw':![],'where':{}};var _0x360ff0={};var _0x1fc94e={'count':0x0,'rows':[]};return db[_0xe6f3('0x2d')][_0xe6f3('0x55')]({'where':{'id':_0x328c78[_0xe6f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c8132,null))['then'](function(_0x16ffbd){if(_0x16ffbd){_0x360ff0[_0xe6f3('0x37')]=_['keys'](db[_0xe6f3('0x54')]['rawAttributes']);_0x360ff0[_0xe6f3('0x33')]=_[_0xe6f3('0x32')](_0x328c78['query']);_0x360ff0[_0xe6f3('0x34')]=_[_0xe6f3('0x35')](_0x360ff0['model'],_0x360ff0[_0xe6f3('0x33')]);_0x4a3916[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x360ff0['model'],qs['fields'](_0x328c78['query'][_0xe6f3('0x38')]));_0x4a3916['attributes']=_0x4a3916[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x4a3916['attributes']:_0x360ff0[_0xe6f3('0x37')];if(!_0x328c78['query'][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0x4a3916[_0xe6f3('0x1f')]=qs[_0xe6f3('0x1f')](_0x328c78[_0xe6f3('0x33')][_0xe6f3('0x1f')]);_0x4a3916[_0xe6f3('0x1d')]=qs[_0xe6f3('0x1d')](_0x328c78[_0xe6f3('0x33')]['offset']);}_0x4a3916['order']=qs[_0xe6f3('0x3c')](_0x328c78[_0xe6f3('0x33')][_0xe6f3('0x3c')]);_0x4a3916['where']=qs[_0xe6f3('0x34')](_[_0xe6f3('0x57')](_0x328c78[_0xe6f3('0x33')],_0x360ff0[_0xe6f3('0x34')]));_0x4a3916[_0xe6f3('0x3d')]['ChatWebsiteId']=_0x16ffbd['id'];if(_0x328c78['query'][_0xe6f3('0x3f')]){_0x4a3916['where']=_[_0xe6f3('0x3e')](_0x4a3916[_0xe6f3('0x3d')],{'$or':_[_0xe6f3('0x2c')](_0x4a3916[_0xe6f3('0x36')],function(_0xc2cd6){var _0x2bf63c={};_0x2bf63c[_0xc2cd6]={'$like':'%'+_0x328c78[_0xe6f3('0x33')]['filter']+'%'};return _0x2bf63c;})});}_0x4a3916=_[_0xe6f3('0x3e')]({},_0x4a3916,_0x328c78['options']);return db[_0xe6f3('0x54')][_0xe6f3('0x20')]({'where':_0x4a3916[_0xe6f3('0x3d')]})[_0xe6f3('0x10')](function(_0x260942){_0x1fc94e[_0xe6f3('0x20')]=_0x260942;if(_0x328c78[_0xe6f3('0x33')][_0xe6f3('0x41')]){_0x4a3916[_0xe6f3('0x46')]=[{'all':!![]}];}return db[_0xe6f3('0x54')][_0xe6f3('0x42')](_0x4a3916);})[_0xe6f3('0x10')](function(_0x947482){_0x1fc94e[_0xe6f3('0x43')]=_0x947482;return _0x1fc94e;});}})[_0xe6f3('0x10')](respondWithFilteredResult(_0x2c8132,_0x4a3916))['catch'](handleError(_0x2c8132,null));};exports[_0xe6f3('0x58')]=function(_0x234cae,_0x5d5b47){return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x234cae[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x5d5b47,null))[_0xe6f3('0x10')](function(_0x524098){if(_0x524098){return _0x524098['removeDispositions'](_0x234cae['query']['ids']);}})[_0xe6f3('0x10')](respondWithStatusCode(_0x5d5b47,null))[_0xe6f3('0x47')](handleError(_0x5d5b47,null));};exports[_0xe6f3('0x59')]=function(_0x5814cf,_0x252b4b){if(_0x5814cf[_0xe6f3('0x49')]['id']){delete _0x5814cf[_0xe6f3('0x49')]['id'];}return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x5814cf[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x252b4b,null))[_0xe6f3('0x10')](function(_0x2989dc){if(_0x2989dc){_0x5814cf['body']['ChatWebsiteId']=_0x2989dc['id'];return db[_0xe6f3('0x5a')][_0xe6f3('0x48')](_0x5814cf['body']);}})[_0xe6f3('0x10')](respondWithResult(_0x252b4b,null))['catch'](handleError(_0x252b4b,null));};exports['getAnswers']=function(_0x4ad8dd,_0x4e1902){var _0x3dadbe={'raw':![],'where':{}};var _0x29c458={};var _0x2843e0={'count':0x0,'rows':[]};return db[_0xe6f3('0x2d')][_0xe6f3('0x55')]({'where':{'id':_0x4ad8dd[_0xe6f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e1902,null))[_0xe6f3('0x10')](function(_0x4ee33b){if(_0x4ee33b){_0x29c458['model']=_[_0xe6f3('0x32')](db['CannedAnswer'][_0xe6f3('0x2e')]);_0x29c458[_0xe6f3('0x33')]=_['keys'](_0x4ad8dd[_0xe6f3('0x33')]);_0x29c458['filters']=_[_0xe6f3('0x35')](_0x29c458[_0xe6f3('0x37')],_0x29c458['query']);_0x3dadbe[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x29c458[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x4ad8dd[_0xe6f3('0x33')][_0xe6f3('0x38')]));_0x3dadbe[_0xe6f3('0x36')]=_0x3dadbe[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x3dadbe[_0xe6f3('0x36')]:_0x29c458['model'];if(!_0x4ad8dd[_0xe6f3('0x33')][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0x3dadbe['limit']=qs[_0xe6f3('0x1f')](_0x4ad8dd[_0xe6f3('0x33')][_0xe6f3('0x1f')]);_0x3dadbe[_0xe6f3('0x1d')]=qs[_0xe6f3('0x1d')](_0x4ad8dd[_0xe6f3('0x33')][_0xe6f3('0x1d')]);}_0x3dadbe['order']=qs['sort'](_0x4ad8dd[_0xe6f3('0x33')][_0xe6f3('0x3c')]);_0x3dadbe[_0xe6f3('0x3d')]=qs[_0xe6f3('0x34')](_[_0xe6f3('0x57')](_0x4ad8dd[_0xe6f3('0x33')],_0x29c458[_0xe6f3('0x34')]));_0x3dadbe[_0xe6f3('0x3d')]['ChatWebsiteId']=_0x4ee33b['id'];if(_0x4ad8dd['query'][_0xe6f3('0x3f')]){_0x3dadbe[_0xe6f3('0x3d')]=_[_0xe6f3('0x3e')](_0x3dadbe[_0xe6f3('0x3d')],{'$or':_[_0xe6f3('0x2c')](_0x3dadbe[_0xe6f3('0x36')],function(_0x1de219){var _0x3e404d={};_0x3e404d[_0x1de219]={'$like':'%'+_0x4ad8dd['query'][_0xe6f3('0x3f')]+'%'};return _0x3e404d;})});}_0x3dadbe=_[_0xe6f3('0x3e')]({},_0x3dadbe,_0x4ad8dd['options']);return db['CannedAnswer']['count']({'where':_0x3dadbe[_0xe6f3('0x3d')]})['then'](function(_0x4e9f48){_0x2843e0[_0xe6f3('0x20')]=_0x4e9f48;if(_0x4ad8dd['query'][_0xe6f3('0x41')]){_0x3dadbe['include']=[{'all':!![]}];}return db[_0xe6f3('0x5a')][_0xe6f3('0x42')](_0x3dadbe);})['then'](function(_0x1c2c8c){_0x2843e0[_0xe6f3('0x43')]=_0x1c2c8c;return _0x2843e0;});}})[_0xe6f3('0x10')](respondWithFilteredResult(_0x4e1902,_0x3dadbe))[_0xe6f3('0x47')](handleError(_0x4e1902,null));};exports['removeAnswers']=function(_0x239cb5,_0x5d0d97){return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x239cb5[_0xe6f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d0d97,null))[_0xe6f3('0x10')](function(_0x3670a3){if(_0x3670a3){return _0x3670a3['removeAnswers'](_0x239cb5[_0xe6f3('0x33')][_0xe6f3('0x5b')]);}})[_0xe6f3('0x10')](respondWithStatusCode(_0x5d0d97,null))['catch'](handleError(_0x5d0d97,null));};exports[_0xe6f3('0x5c')]=function(_0x1ebf43,_0x56cd80){_0x1ebf43['body']['sitepic']=_0x1ebf43[_0xe6f3('0x5d')][_0xe6f3('0x5e')];return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x1ebf43['params']['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x56cd80,null))[_0xe6f3('0x10')](saveUpdates(_0x1ebf43[_0xe6f3('0x49')],null))[_0xe6f3('0x10')](respondWithResult(_0x56cd80,null))[_0xe6f3('0x47')](handleError(_0x56cd80,null));};exports[_0xe6f3('0x5f')]=function(_0x31fff0,_0x1780cc){_0x31fff0[_0xe6f3('0x49')][_0xe6f3('0x60')]=_0x31fff0[_0xe6f3('0x5d')][_0xe6f3('0x5e')];return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x31fff0[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x1780cc,null))[_0xe6f3('0x10')](saveUpdates(_0x31fff0[_0xe6f3('0x49')],null))[_0xe6f3('0x10')](respondWithResult(_0x1780cc,null))[_0xe6f3('0x47')](handleError(_0x1780cc,null));};exports[_0xe6f3('0x61')]=function(_0x1fdf00,_0x58410c){_0x1fdf00['body'][_0xe6f3('0x62')]=_0x1fdf00['file'][_0xe6f3('0x5e')];return db[_0xe6f3('0x2d')]['find']({'where':{'id':_0x1fdf00[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x58410c,null))[_0xe6f3('0x10')](saveUpdates(_0x1fdf00[_0xe6f3('0x49')],null))[_0xe6f3('0x10')](respondWithResult(_0x58410c,null))['catch'](handleError(_0x58410c,null));};exports[_0xe6f3('0x63')]=function(_0xaee76d,_0x3933fa){_0xaee76d[_0xe6f3('0x49')][_0xe6f3('0x64')]=_0xaee76d['file'][_0xe6f3('0x5e')];return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0xaee76d[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x3933fa,null))[_0xe6f3('0x10')](saveUpdates(_0xaee76d[_0xe6f3('0x49')],null))[_0xe6f3('0x10')](respondWithResult(_0x3933fa,null))[_0xe6f3('0x47')](handleError(_0x3933fa,null));};exports[_0xe6f3('0x65')]=function(_0x403c38,_0x21590b){var _0x1da469=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],_0xe6f3('0x68'));var _0x228a2e={'where':{'id':_0x403c38['params']['id']},'attributes':['id',_0xe6f3('0x69')],'raw':!![]};var _0x1daec8=![];return require('../../config/license/util')[_0xe6f3('0x6a')]()[_0xe6f3('0x10')](function(_0x42fa13){if(_0x42fa13){_0x1daec8=_0x42fa13['custom'];}})['then'](function(){return db['ChatWebsite'][_0xe6f3('0x4d')](_0x228a2e);})[_0xe6f3('0x10')](handleEntityNotFound(_0x21590b,null))[_0xe6f3('0x10')](function(_0x3cc028){if(_0x3cc028){if(!_[_0xe6f3('0x6b')](_0x3cc028[_0xe6f3('0x69')])){if(fs[_0xe6f3('0x6c')](path['join'](config['root'],_0xe6f3('0x6d'),_0x3cc028[_0xe6f3('0x69')]))&&_0x1daec8){_0x1da469=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],'server/files/images/logos/',_0x3cc028[_0xe6f3('0x69')]);}}return _0x21590b[_0xe6f3('0x6e')](_0x1da469);}})[_0xe6f3('0x47')](handleError(_0x21590b,null));};exports[_0xe6f3('0x6f')]=function(_0x3a574e,_0x5ea962){var _0x31b406=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],_0xe6f3('0x70'));var _0x26f976={'where':{'id':_0x3a574e['params']['id']},'attributes':['id',_0xe6f3('0x60')],'raw':!![]};return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')](_0x26f976)[_0xe6f3('0x10')](handleEntityNotFound(_0x5ea962,null))[_0xe6f3('0x10')](function(_0x18b0e6){if(_0x18b0e6){if(!_['isNil'](_0x18b0e6['agentAvatar'])){if(fs[_0xe6f3('0x6c')](path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],'server/files/images/avatars/',_0x18b0e6[_0xe6f3('0x60')]))){_0x31b406=path['join'](config[_0xe6f3('0x67')],_0xe6f3('0x71'),_0x18b0e6['agentAvatar']);}}return _0x5ea962[_0xe6f3('0x6e')](_0x31b406);}})[_0xe6f3('0x47')](handleError(_0x5ea962,null));};exports[_0xe6f3('0x72')]=function(_0x534b1f,_0x1d4d7a){var _0x2cd753=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],_0xe6f3('0x73'));var _0x33c5da={'where':{'id':_0x534b1f[_0xe6f3('0x45')]['id']},'attributes':['id',_0xe6f3('0x62'),_0xe6f3('0x74')],'raw':!![]};return db['ChatWebsite'][_0xe6f3('0x4d')](_0x33c5da)[_0xe6f3('0x10')](handleEntityNotFound(_0x1d4d7a,null))['then'](function(_0x59e81d){if(_0x59e81d){if(!_['isNil'](_0x59e81d['customerAvatar'])){if(fs[_0xe6f3('0x6c')](path['join'](config[_0xe6f3('0x67')],_0xe6f3('0x71'),_0x59e81d[_0xe6f3('0x62')]))&&_0x59e81d[_0xe6f3('0x74')]){_0x2cd753=path['join'](config['root'],_0xe6f3('0x71'),_0x59e81d['customerAvatar']);}}return _0x1d4d7a[_0xe6f3('0x6e')](_0x2cd753);}})[_0xe6f3('0x47')](handleError(_0x1d4d7a,null));};exports[_0xe6f3('0x75')]=function(_0x4787a0,_0x30be37){var _0x1196ff=path['join'](config['root'],_0xe6f3('0x76'));var _0x5ed4c2={'where':{'id':_0x4787a0[_0xe6f3('0x45')]['id']},'attributes':['id',_0xe6f3('0x64')],'raw':!![]};return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')](_0x5ed4c2)[_0xe6f3('0x10')](handleEntityNotFound(_0x30be37,null))['then'](function(_0x5b1031){if(_0x5b1031){if(!_[_0xe6f3('0x6b')](_0x5b1031[_0xe6f3('0x64')])){if(fs[_0xe6f3('0x6c')](path['join'](config[_0xe6f3('0x67')],_0xe6f3('0x71'),_0x5b1031[_0xe6f3('0x64')]))){_0x1196ff=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],_0xe6f3('0x71'),_0x5b1031['systemAvatar']);}}return _0x30be37[_0xe6f3('0x6e')](_0x1196ff);}})[_0xe6f3('0x47')](handleError(_0x30be37,null));};exports[_0xe6f3('0x77')]=function(_0x4cc380,_0x2afd2a){var _0x4bd1ae=require(_0xe6f3('0x78'));var _0x1d97f0=new _0x4bd1ae();var _0x2d557f=_0x1d97f0[_0xe6f3('0x79')](_0x4cc380[_0xe6f3('0x7a')][_0xe6f3('0x7b')])[_0xe6f3('0x7c')]();var _0x28756c={'body':_0x4cc380['body'],'channel':_0xe6f3('0x7d')};var _0x1df83d=[];var _0x4a3630=[];var _0x53f625={};var _0x3c8a37=![];return db['CmContact'][_0xe6f3('0x51')]()[_0xe6f3('0x10')](function(_0x40dbf3){if(!_0x40dbf3){throw new db['Sequelize'][(_0xe6f3('0x7e'))](_0xe6f3('0x7f'));}_0x1df83d=_[_0xe6f3('0x80')](_[_0xe6f3('0x32')](_0x40dbf3),[_0xe6f3('0x81'),_0xe6f3('0x82')]);_0x4a3630=_['difference'](_[_0xe6f3('0x32')](_0x40dbf3),['createdAt','updatedAt',_0xe6f3('0x83'),_0xe6f3('0x84')]);if(_0x4cc380[_0xe6f3('0x49')]['id']){delete _0x4cc380[_0xe6f3('0x49')]['id'];}if(_[_0xe6f3('0x6b')](_0x4cc380['body'][_0xe6f3('0x85')])){throw new db['Sequelize'][(_0xe6f3('0x7e'))](_0xe6f3('0x86'));}if(_['isNil'](_0x4cc380['body'][_0xe6f3('0x49')])||_0x4cc380['body'][_0xe6f3('0x49')]===''){throw new db[(_0xe6f3('0x87'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe6f3('0x6b')](_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x88')])){throw new db[(_0xe6f3('0x87'))]['ValidationError'](_0xe6f3('0x89')+_0x4a3630);}if(!_[_0xe6f3('0x8a')](_0x4a3630,_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x88')])){throw new db[(_0xe6f3('0x87'))]['ValidationError'](_0xe6f3('0x8b')+_0x4a3630);}_0x53f625[_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x88')]]=_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x85')];})[_0xe6f3('0x10')](function(){return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x4cc380[_0xe6f3('0x45')]['id']},'include':[{'model':db['CmList'],'as':_0xe6f3('0x8c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x53f625,'limit':0x1,'order':[[_0xe6f3('0x82'),_0xe6f3('0x8d')]]}]},{'model':db[_0xe6f3('0x8e')],'as':_0xe6f3('0x8f')}]});})['then'](handleEntityNotFound(_0x2afd2a,null))[_0xe6f3('0x10')](function(_0x27aeaf){if(_0x27aeaf&&_0x27aeaf['List']){_0x28756c[_0xe6f3('0x90')]=_0x27aeaf;_0x28756c['applications']=_0x27aeaf[_0xe6f3('0x8f')];_0x28756c['list']=_0x27aeaf['List'];_0x28756c[_0xe6f3('0x91')]=_[_0xe6f3('0x92')](_0x28756c[_0xe6f3('0x91')],[_0xe6f3('0x93')],[_0xe6f3('0x94')]);if(_0x28756c[_0xe6f3('0x90')][_0xe6f3('0x8f')]){delete _0x28756c['account'][_0xe6f3('0x8f')];}if(_0x28756c[_0xe6f3('0x90')][_0xe6f3('0x8c')]&&_0x28756c[_0xe6f3('0x90')][_0xe6f3('0x8c')][_0xe6f3('0x95')][_0xe6f3('0x39')]){return _0x28756c[_0xe6f3('0x90')][_0xe6f3('0x8c')][_0xe6f3('0x95')][0x0];}var _0x541689=_[_0xe6f3('0x9')](_0x4cc380[_0xe6f3('0x49')],{'firstName':_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x85')],'ListId':_0x27aeaf[_0xe6f3('0x84')]});_0x541689[_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x88')]]=_0x4cc380['body'][_0xe6f3('0x85')];return db[_0xe6f3('0x96')][_0xe6f3('0x48')](_0x541689,{'fields':_0x1df83d,'raw':!![]});}})[_0xe6f3('0x10')](handleEntityNotFound(_0x2afd2a,null))[_0xe6f3('0x10')](function(_0x43e94c){_0x28756c[_0xe6f3('0x97')]=_0x43e94c;var _0x369ee2=_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x98')];if(_0x4cc380['headers'][_0xe6f3('0x99')]){_0x369ee2=_0x4cc380['headers'][_0xe6f3('0x99')];}else if(_0x4cc380[_0xe6f3('0x7a')][_0xe6f3('0x9a')]){_0x369ee2=_[_0xe6f3('0x9b')](_0x4cc380[_0xe6f3('0x7a')][_0xe6f3('0x9a')][_0xe6f3('0x9c')](','));}if(_0x43e94c){var _0x7b2e11={'ContactId':_0x43e94c['id'],'ChatWebsiteId':_0x4cc380['params']['id'],'from':(_0x43e94c[_0xe6f3('0x9d')]||'')+'\x20'+(_0x43e94c[_0xe6f3('0x9e')]||''),'customerIp':_0x369ee2,'customerPort':_0x4cc380[_0xe6f3('0x7a')]['x-real-port']?_0x4cc380['headers']['x-real-port']:null,'referer':_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x9f')],'browserName':_0x2d557f['browser']['name']&&_0x2d557f[_0xe6f3('0xa0')][_0xe6f3('0xa1')]?util['format'](_0xe6f3('0xa2'),_0x2d557f[_0xe6f3('0xa0')][_0xe6f3('0x28')],_0x2d557f['browser']['version']):_0xe6f3('0xa3'),'browserVersion':_0x2d557f['browser']['version']||'unknown','osName':util[_0xe6f3('0xa4')](_0xe6f3('0xa2'),_0x2d557f['os']['name'],_0x2d557f['os'][_0xe6f3('0xa1')]),'osVersion':_0x2d557f['os']['version'],'deviceModel':_0x2d557f[_0xe6f3('0xa5')][_0xe6f3('0x37')]&&_0x2d557f[_0xe6f3('0xa5')][_0xe6f3('0xa6')]?util[_0xe6f3('0xa4')](_0xe6f3('0xa7'),_0x2d557f[_0xe6f3('0xa5')][_0xe6f3('0x37')],_0x2d557f[_0xe6f3('0xa5')][_0xe6f3('0xa6')],_0x2d557f[_0xe6f3('0xa5')]['type']):null,'deviceVendor':_0x2d557f['device']['vendor'],'deviceType':_0x2d557f[_0xe6f3('0xa5')]['type'],'formData':JSON[_0xe6f3('0xa8')](_0x4cc380[_0xe6f3('0x49')])};var _0x272465={'ChatWebsiteId':_0x4cc380[_0xe6f3('0x45')]['id'],'closed':![]};if(_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0xa9')]){_0x272465[_0xe6f3('0xa9')]=_0x4cc380['body'][_0xe6f3('0xa9')];return db[_0xe6f3('0xaa')][_0xe6f3('0x4d')]({'where':_0x272465})[_0xe6f3('0x10')](function(_0x36f2a9){if(_0x36f2a9){return[_0x36f2a9,![]];}_0x7b2e11[_0xe6f3('0xa9')]=_0x4cc380['body']['threadId'];_0x7b2e11[_0xe6f3('0xab')]=_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0xab')];return db['ChatInteraction'][_0xe6f3('0x48')](_0x7b2e11)[_0xe6f3('0x10')](function(_0x5bf071){return[_0x5bf071,!![]];});});}_0x272465[_0xe6f3('0xac')]=_0x43e94c['id'];if(_0x4cc380[_0xe6f3('0x49')]['interaction']&&_0x4cc380[_0xe6f3('0x49')]['interaction']['id']){_0x272465['id']=_0x4cc380['body'][_0xe6f3('0xad')]['id'];return db[_0xe6f3('0xaa')][_0xe6f3('0x4d')]({'where':_0x272465})['then'](function(_0xcc1660){if(_0xcc1660){return[_0xcc1660,![]];}return db[_0xe6f3('0xaa')][_0xe6f3('0x48')](_0x7b2e11)[_0xe6f3('0x10')](function(_0x432cd0){return[_0x432cd0,!![]];});});}return db[_0xe6f3('0xaa')][_0xe6f3('0x48')](_0x7b2e11)[_0xe6f3('0x10')](function(_0x177d66){return[_0x177d66,!![]];});}})[_0xe6f3('0xae')](function(_0x19d8d2,_0xc204eb){if(_0x19d8d2){_0x3c8a37=_0xc204eb;if(!_0xc204eb){var _0x3b5066={'from':(_0x28756c[_0xe6f3('0x97')][_0xe6f3('0x9d')]||'')+'\x20'+(_0x28756c[_0xe6f3('0x97')][_0xe6f3('0x9e')]||'')};if(_0x4cc380['body'][_0xe6f3('0xa9')]&&_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0xaf')]&&_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0xa9')]!=_0x4cc380[_0xe6f3('0x49')]['messageId']){_0x3b5066[_0xe6f3('0xa9')]=_0x4cc380['body'][_0xe6f3('0xaf')];}return _0x19d8d2[_0xe6f3('0xb0')](_0x3b5066);}else{return _0x19d8d2;}}})[_0xe6f3('0x10')](function(_0x46c7dc){_0x28756c['interaction']=_0x46c7dc[_0xe6f3('0x24')]({'plain':!![]});_0x28756c[_0xe6f3('0xad')]['created']=_0x3c8a37;if(_0x28756c[_0xe6f3('0xad')][_0xe6f3('0xb1')]){if(_0x28756c[_0xe6f3('0x90')][_0xe6f3('0xb2')]){_0x28756c['applications'][_0xe6f3('0xb3')]({'id':0x0,'priority':_0x28756c[_0xe6f3('0x91')][_0xe6f3('0x39')]+0x1,'app':_0xe6f3('0xb4'),'appdata':_0xe6f3('0xb5'),'interval':_0xe6f3('0xb6')});}}return db[_0xe6f3('0xb7')][_0xe6f3('0x48')]({'body':_0x4cc380[_0xe6f3('0x49')][_0xe6f3('0x49')],'ChatWebsiteId':_0x4cc380[_0xe6f3('0x45')]['id'],'ChatInteractionId':_0x46c7dc['id'],'direction':'in','ContactId':_0x28756c['contact']['id'],'AttachmentId':_0x4cc380['body']['AttachmentId']});})[_0xe6f3('0x10')](function(_0x50c8a8){_0x28756c[_0xe6f3('0x17')]=_0x50c8a8;if(_0x28756c[_0xe6f3('0xad')][_0xe6f3('0xb8')]){return db[_0xe6f3('0xb9')]['find']({'attributes':['id','name'],'where':{'id':_0x28756c['interaction'][_0xe6f3('0xb8')]}})['then'](function(_0x28007e){if(_0x28007e){_0x28756c[_0xe6f3('0x91')][_0xe6f3('0xba')]({'id':0x0,'priority':0x0,'app':_0xe6f3('0xbb'),'appdata':_0x28007e[_0xe6f3('0x28')]+','+(_0x28756c['account'][_0xe6f3('0xbc')]||0xa),'interval':_0xe6f3('0xb6')});_0x28756c[_0xe6f3('0xbd')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x28756c);});}return respondWithRpcPromise(_0xe6f3('0xbe'),_0xe6f3('0xbf'),_0x28756c);})[_0xe6f3('0x10')](function(_0x11bb10){respondWithRpcPromise(_0xe6f3('0xc0'),_0xe6f3('0xc0'),{'event':_0xe6f3('0x77'),'message':_0x11bb10},client9002);return _0x11bb10;})[_0xe6f3('0x10')](respondWithResult(_0x2afd2a,null))[_0xe6f3('0x47')](handleError(_0x2afd2a,null));};exports['offline']=function(_0x43413e,_0x2c80ba){var _0x86e263,_0x443003,_0x12d65c;var _0x34f268=[];var _0x569b0d={};var _0x3c483c=_0x43413e['files']||[];var _0x532867=[];var _0x599330;return db['CmContact'][_0xe6f3('0x51')]()[_0xe6f3('0x10')](function(_0x45c26f){if(!_0x45c26f){throw new db['Sequelize'][(_0xe6f3('0x7e'))](_0xe6f3('0x7f'));}_0x34f268=_[_0xe6f3('0x80')](_['keys'](_0x45c26f),[_0xe6f3('0x81'),_0xe6f3('0x82'),_0xe6f3('0x83'),'ListId']);if(_0x43413e['body']['id']){delete _0x43413e[_0xe6f3('0x49')]['id'];}if(_[_0xe6f3('0x6b')](_0x43413e[_0xe6f3('0x49')][_0xe6f3('0x85')])){throw _0x2c80ba[_0xe6f3('0x1a')](0x1f4)[_0xe6f3('0xc1')](new db[(_0xe6f3('0x87'))][(_0xe6f3('0x7e'))](_0xe6f3('0x86')));}if(_[_0xe6f3('0x6b')](_0x43413e[_0xe6f3('0x49')]['body'])||_0x43413e[_0xe6f3('0x49')][_0xe6f3('0x49')]===''){throw _0x2c80ba[_0xe6f3('0x1a')](0x1f4)[_0xe6f3('0xc1')](new db[(_0xe6f3('0x87'))]['ValidationError'](_0xe6f3('0xc2')));}if(_['isNil'](_0x43413e['body'][_0xe6f3('0xc3')])){throw _0x2c80ba['status'](0x1f4)[_0xe6f3('0xc1')](new db[(_0xe6f3('0x87'))][(_0xe6f3('0x7e'))](_0xe6f3('0xc4')+_0x34f268));}if(!_['includes'](_0x34f268,_0x43413e[_0xe6f3('0x49')][_0xe6f3('0xc3')])){throw _0x2c80ba[_0xe6f3('0x1a')](0x1f4)[_0xe6f3('0xc1')](new db['Sequelize'][(_0xe6f3('0x7e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34f268));}_0x569b0d[_0x43413e[_0xe6f3('0x49')][_0xe6f3('0xc3')]]=_0x43413e[_0xe6f3('0x49')][_0xe6f3('0x85')];})[_0xe6f3('0x10')](function(){return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'where':{'id':_0x43413e['params']['id']},'include':[{'model':db['CmList'],'as':_0xe6f3('0x8c')},{'model':db[_0xe6f3('0xc5')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x2c80ba,null))[_0xe6f3('0x10')](function(_0x40fab0){if(_0x40fab0&&_0x40fab0['List']){_0x443003=_0x40fab0;var _0x1c0613=_[_0xe6f3('0x9')](_0x43413e['body'],{'firstName':_0x43413e[_0xe6f3('0x49')][_0xe6f3('0x85')],'phone':_0x43413e[_0xe6f3('0x49')][_0xe6f3('0x85')],'ListId':_0x40fab0[_0xe6f3('0x84')]});_0x1c0613[_0x43413e[_0xe6f3('0x49')]['mapKeyOffline']]=_0x43413e['body'][_0xe6f3('0x85')];return db[_0xe6f3('0x96')][_0xe6f3('0xc6')]({'where':_0x569b0d,'defaults':_0x1c0613});}})[_0xe6f3('0xae')](function(_0x1d0af4){if(_0x1d0af4){_0x12d65c=_0x1d0af4;var _0x446139=fs[_0xe6f3('0xc7')](path['join'](config[_0xe6f3('0x67')],_0xe6f3('0xc8')),_0xe6f3('0xc9'));var _0x3d8dc1=ejs[_0xe6f3('0xca')](_0x446139,{'body':_[_0xe6f3('0xcb')](_0x43413e['body'][_0xe6f3('0x49')]),'bodyTitle':_0x443003[_0xe6f3('0xcc')]});return db[_0xe6f3('0xcd')][_0xe6f3('0x48')]({'body':_0x3d8dc1,'plainBody':htmlToText[_0xe6f3('0xce')](_0x3d8dc1),'ContactId':_0x1d0af4['id'],'ChatWebsiteId':_0x443003['id']});}})['then'](function(_0x7847da){_0x599330=_0x7847da;if(_0x3c483c[_0xe6f3('0x39')]){var _0x58bbea=_0x3c483c[_0xe6f3('0x2c')](function(_0x458ae7){return{'name':_0x458ae7['originalname'],'basename':_0x458ae7[_0xe6f3('0x5e')],'type':_0x458ae7[_0xe6f3('0xcf')],'ChatOfflineMessageId':_0x7847da['id']};});_0x532867=_0x58bbea[_0xe6f3('0x2c')](_0x2b783c=>{var _0x23810a={'filename':_0x2b783c[_0xe6f3('0x28')],'path':path['join'](config[_0xe6f3('0x67')],'server',_0xe6f3('0xd0'),_0xe6f3('0xd1'),_0xe6f3('0xd2'),_0x2b783c[_0xe6f3('0xd3')])};return _0x23810a;});if(!_0x443003[_0xe6f3('0xd4')]){return db[_0xe6f3('0xd5')][_0xe6f3('0xd6')](function(_0x45be54){return db[_0xe6f3('0xd7')]['bulkCreate'](_0x58bbea,{'transaction':_0x45be54});});}}})[_0xe6f3('0x10')](function(){if(_0x599330){_0x86e263=_0x599330;return db[_0xe6f3('0xc5')][_0xe6f3('0x55')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe6f3('0xd8')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xe6f3('0x10')](function(_0x4fdeac){if(_0x4fdeac&&_0x4fdeac['Smtp']&&_0x443003[_0xe6f3('0xd9')]&&_0x443003[_0xe6f3('0xda')]){var _0x4743e6=_0x4fdeac[_0xe6f3('0xdb')]();return respondWithRpcPromise(_0xe6f3('0xdc'),'sendMail',{'account':_0x4743e6,'message':{'from':util[_0xe6f3('0xa4')](_0xe6f3('0xdd'),_0x4fdeac[_0xe6f3('0x28')],_0x4fdeac[_0xe6f3('0xde')]||_0x4fdeac[_0xe6f3('0xdf')][_0xe6f3('0x4a')]),'to':_0x443003[_0xe6f3('0xda')],'subject':_0x443003[_0xe6f3('0xe0')],'html':_0x86e263[_0xe6f3('0x49')],'attachments':_0x532867}},client9003)[_0xe6f3('0x10')](function(){return _0x86e263;})[_0xe6f3('0x47')](function(_0x1a89cb){logger[_0xe6f3('0x16')](_0x1a89cb);});}})[_0xe6f3('0x10')](function(){if(_0x443003&&_0x443003['openNewInteraction']&&_0x443003[_0xe6f3('0xe1')]){var _0xa28b35=[];if(_0x3c483c[_0xe6f3('0x39')]){_0xa28b35=_0x3c483c['map'](function(_0x193b88){return{'name':_0x193b88[_0xe6f3('0xe2')],'basename':_0x193b88[_0xe6f3('0x5e')],'type':_0x193b88[_0xe6f3('0xcf')],'ChatOfflineMessageId':_0x599330['id']};});}var _0x26869d;if(!_[_0xe6f3('0x6b')](_0x443003[_0xe6f3('0xe3')])){var _0x1234bf=_['map'](_0x43413e[_0xe6f3('0x49')],function(_0x662484){return _0x662484;});var _0x30def9=_['toPairsIn'](_0x1234bf)[0x0];var _0x282950=_[_0xe6f3('0xe4')](_0x30def9,function(_0x56d3c6){return _0x56d3c6;});_0x26869d=_0x282950[0x1][_0x443003[_0xe6f3('0xe3')]];}var _0x5702d2={'from':_0x12d65c[_0xe6f3('0xde')],'firstName':_0x12d65c[_0xe6f3('0x9d')],'lastName':_0x12d65c[_0xe6f3('0x9e')],'mapKey':_0xe6f3('0xde'),'message':{'from':_0x12d65c[_0xe6f3('0xde')],'to':_0x443003[_0xe6f3('0xc5')][_0xe6f3('0xde')],'cc':'','subject':_[_0xe6f3('0x6b')](_0x26869d)?_0x443003['offlineMessageSubject']:_0x26869d,'messageId':'','sentAt':new Date(),'attach':_0xa28b35['length'],'attachments':_0xa28b35,'originChannel':_0xe6f3('0xe5'),'ChatWebsiteId':_0x443003['id'],'ChatOfflineMessageId':_0x86e263['id'],'originTo':_0x443003['MailAccount'][_0xe6f3('0xde')]},'body':_0x86e263[_0xe6f3('0x49')]};var _0x3f924b={'account':{'id':_0x443003[_0xe6f3('0xe1')]},'body':_0x5702d2,'log':_0xe6f3('0xe6')};return respondWithRpcPromise(_0xe6f3('0xe6'),_0xe6f3('0xe7'),_0x3f924b,client9001)[_0xe6f3('0x10')](function(){return _0x86e263;})['catch'](function(_0x42b3c8){logger[_0xe6f3('0x16')](_0x42b3c8);});}return;})[_0xe6f3('0x10')](function(){if(_0x86e263){return _0x86e263;}})[_0xe6f3('0x10')](respondWithResult(_0x2c80ba,null))['catch'](function(_0x273667){logger['error'](_0xe6f3('0x47'),_0x273667);for(var _0x25a2da of _0x3c483c){var _0x5cef1e=path[_0xe6f3('0x66')](config[_0xe6f3('0x67')],_0xe6f3('0xe8'),_0xe6f3('0xd0'),_0xe6f3('0xd1'),_0xe6f3('0xd2'),_0x25a2da[_0xe6f3('0x5e')]);fs_extra[_0xe6f3('0xe9')](_0x5cef1e)[_0xe6f3('0x47')](function(_0x63e3bb){logger['error'](_0xe6f3('0xea'),_0x5cef1e,_0x63e3bb);});}});};exports[_0xe6f3('0xeb')]=function(_0x1838fb,_0xfed2b5){return db[_0xe6f3('0xaa')][_0xe6f3('0x4d')]({'where':{'id':_0x1838fb[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0xfed2b5,null))['then'](function(_0x47e621){if(_0x47e621){return _0x47e621[_0xe6f3('0xeb')](_0x1838fb[_0xe6f3('0x49')][_0xe6f3('0x5b')],_[_0xe6f3('0xec')](_0x1838fb[_0xe6f3('0x49')],[_0xe6f3('0x5b'),'id'])||{});}})[_0xe6f3('0x10')](respondWithResult(_0xfed2b5,null))[_0xe6f3('0x47')](handleError(_0xfed2b5,null));};exports[_0xe6f3('0xed')]=function(_0xebf7dd,_0x527c61){var _0x270f16={'raw':![],'where':{}};var _0x58649a={};var _0x13fee5={'count':0x0,'rows':[]};return db[_0xe6f3('0x2d')]['findOne']({'where':{'id':_0xebf7dd[_0xe6f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x527c61,null))[_0xe6f3('0x10')](function(_0x14c008){if(_0x14c008){_0x58649a[_0xe6f3('0x37')]=_[_0xe6f3('0x32')](db[_0xe6f3('0xaa')][_0xe6f3('0x2e')]);_0x58649a[_0xe6f3('0x33')]=_[_0xe6f3('0x32')](_0xebf7dd[_0xe6f3('0x33')]);_0x58649a[_0xe6f3('0x34')]=_['intersection'](_0x58649a[_0xe6f3('0x37')],_0x58649a[_0xe6f3('0x33')]);_0x270f16[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x58649a['model'],qs['fields'](_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0x38')]));_0x270f16[_0xe6f3('0x36')]=_0x270f16[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x270f16[_0xe6f3('0x36')]:_0x58649a[_0xe6f3('0x37')];if(!_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0x270f16[_0xe6f3('0x1f')]=qs[_0xe6f3('0x1f')](_0xebf7dd['query']['limit']);_0x270f16[_0xe6f3('0x1d')]=qs['offset'](_0xebf7dd['query']['offset']);}_0x270f16[_0xe6f3('0x3b')]=qs[_0xe6f3('0x3c')](_0xebf7dd[_0xe6f3('0x33')]['sort']);_0x270f16[_0xe6f3('0x3d')]=qs[_0xe6f3('0x34')](_['pick'](_0xebf7dd[_0xe6f3('0x33')],_0x58649a[_0xe6f3('0x34')]));_0x270f16['where'][_0xe6f3('0x53')]=_0x14c008['id'];if(_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0x3f')]){_0x270f16[_0xe6f3('0x3d')]=_['merge'](_0x270f16[_0xe6f3('0x3d')],{'$or':_[_0xe6f3('0x2c')](_0x270f16[_0xe6f3('0x36')],function(_0x5a1125){var _0x21e66a={};_0x21e66a[_0x5a1125]={'$like':'%'+_0xebf7dd['query'][_0xe6f3('0x3f')]+'%'};return _0x21e66a;})});}_0x270f16=_['merge']({},_0x270f16,_0xebf7dd[_0xe6f3('0x40')]);return db[_0xe6f3('0xaa')][_0xe6f3('0x20')]({'where':_0x270f16[_0xe6f3('0x3d')]})[_0xe6f3('0x10')](function(_0x18a73e){_0x13fee5[_0xe6f3('0x20')]=_0x18a73e;if(_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0x41')]){_0x270f16[_0xe6f3('0x46')]=[{'model':db[_0xe6f3('0x96')],'as':'Contact','required':![]},{'model':db[_0xe6f3('0xb9')],'as':_0xe6f3('0xee'),'attributes':[_0xe6f3('0x28'),'fullname','internal'],'required':![]},{'model':db[_0xe6f3('0xef')],'as':_0xe6f3('0xf0'),'attributes':['id',_0xe6f3('0x28'),_0xe6f3('0xf1')],'where':_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0xf2')]?{'id':_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0xf2')]}:undefined,'required':_0xebf7dd[_0xe6f3('0x33')][_0xe6f3('0xf2')]?!![]:![]}];}return db['ChatInteraction'][_0xe6f3('0x42')](_0x270f16);})['then'](function(_0x1b14b1){_0x13fee5[_0xe6f3('0x43')]=_0x1b14b1;return _0x13fee5;});}})[_0xe6f3('0x10')](respondWithFilteredResult(_0x527c61,_0x270f16))[_0xe6f3('0x47')](handleError(_0x527c61,null));};function iftimePromise(_0x171186,_0x55283a){return respondWithRpcPromise(_0xe6f3('0xf3'),'getSnippet',{'command':_0x55283a[_0xe6f3('0xf4')]?util[_0xe6f3('0xa4')](_0xe6f3('0xf5'),_0x171186[_0xe6f3('0xf6')],_0x55283a[_0xe6f3('0xf4')]):util[_0xe6f3('0xa4')](_0xe6f3('0xf7'),_0x171186[_0xe6f3('0xf6')])},client9002)[_0xe6f3('0x10')](function(_0x1d462b){var _0x7ccc71=_0x1d462b&&_0x1d462b['indexOf']('true')>=0x0?!![]:![];logger[_0xe6f3('0x11')](_0xe6f3('0xf8'),_0x55283a['id'],_0x171186['id'],_0x171186[_0xe6f3('0xf6')],_0x7ccc71?_0xe6f3('0xf9'):_0xe6f3('0xfa'),_0x55283a[_0xe6f3('0xf4')]?_0x55283a[_0xe6f3('0xf4')]:_0xe6f3('0xfb'));return _0x7ccc71;})['catch'](function(_0x4b0f30){logger['error'](_0xe6f3('0xf8'),_0x55283a['id'],_0x171186['id'],_0x171186['interval'],util[_0xe6f3('0xfc')](_0x4b0f30,{'showHidden':![],'depth':null}),_0x55283a['timezone']?_0x55283a[_0xe6f3('0xf4')]:_0xe6f3('0xfb'));return![];});}exports[_0xe6f3('0xfd')]=function(_0x17084e,_0x599ca7){var _0x8cdf8e=0x0;var _0xf3af7c=0x0;var _0x2e3e92=![];var _0x238d43;var _0x13632e;return db[_0xe6f3('0x2d')]['find']({'where':{'id':_0x17084e[_0xe6f3('0x45')]['id']},'include':[{'model':db['Interval'],'as':_0xe6f3('0xfe'),'include':[{'model':db[_0xe6f3('0xfe')],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xe6f3('0x10')](handleEntityNotFound(_0x599ca7,null))['then'](function(_0x5347f8){if(_0x5347f8){_0x238d43=_0x5347f8;return _0x5347f8['getProactiveActions']({'raw':!![]});}})[_0xe6f3('0x10')](function(_0x41f40d){if(_0x238d43){if(_0x41f40d){_0x13632e=_0x41f40d;}}return require(_0xe6f3('0xff'))[_0xe6f3('0x6a')]();})[_0xe6f3('0x10')](function(_0x259330){if(_0x259330){_0xf3af7c=_0x259330[_0xe6f3('0x100')];_0x2e3e92=_0x259330[_0xe6f3('0x101')];}})['then'](function(){return db[_0xe6f3('0xaa')][_0xe6f3('0x20')]({'where':{'closed':![]}});})[_0xe6f3('0x10')](function(_0x306705){_0x8cdf8e=_0x306705;if(_0xf3af7c&&_0x306705>_0xf3af7c){return db[_0xe6f3('0x102')][_0xe6f3('0x55')]({'where':{'id':0x1}})['then'](function(_0xbb5ffd){if(_0xbb5ffd){_0xbb5ffd[_0xe6f3('0x103')](_0xe6f3('0x104'));}});}})[_0xe6f3('0x10')](function(){if(_0x238d43[_0xe6f3('0xfe')]&&_0x238d43[_0xe6f3('0xfe')]['Intervals']){var _0x2efc44=[];for(var _0x213653=0x0;_0x213653<_0x238d43[_0xe6f3('0xfe')][_0xe6f3('0x105')][_0xe6f3('0x39')];_0x213653++){var _0x33b1bd=_0x238d43[_0xe6f3('0xfe')][_0xe6f3('0x105')][_0x213653][_0xe6f3('0x24')]({'plain':!![]});_0x2efc44[_0xe6f3('0xb3')](iftimePromise(_0x33b1bd,_0x238d43));}return BPromise[_0xe6f3('0x106')](_0x2efc44)[_0xe6f3('0x10')](function(_0x4f0e2e){return _['some'](_0x4f0e2e);});}else{return!![];}})[_0xe6f3('0x10')](function(_0x6fbe63){var _0x3116c2=fs[_0xe6f3('0xc7')](path[_0xe6f3('0x66')](config['root'],_0xe6f3('0x107')),_0xe6f3('0xc9'));var _0x2c54b2={'remote':_0x238d43[_0xe6f3('0x108')],'query':querystring[_0xe6f3('0xa8')](_[_0xe6f3('0x3e')](_0x238d43[_0xe6f3('0x24')]({'plain':!![]}),{'customerIp':_0x17084e[_0xe6f3('0x7a')][_0xe6f3('0x9a')]||_0x17084e[_0xe6f3('0x7a')][_0xe6f3('0x109')]||_0x17084e[_0xe6f3('0x10a')][_0xe6f3('0x10b')]||_0x17084e['ip'],'referer':_0x17084e[_0xe6f3('0x7a')][_0xe6f3('0x9f')],'openedInteractions':_0x8cdf8e,'maxInteractions':_0xf3af7c,'virtual':_0x2e3e92[_0xe6f3('0x100')],'online':_0x6fbe63,'custom':_0x2e3e92}))['replace'](/'/g,'\x5c\x27')};_0x599ca7['send'](ejs['render'](Mustache[_0xe6f3('0xca')](_0x3116c2,_0x2c54b2),{'proactiveActions':_0x13632e,'alignment':_0x238d43[_0xe6f3('0x10c')],'verticalAlignment':_0x238d43[_0xe6f3('0x10d')],'div_color':_0x238d43[_0xe6f3('0xf1')],'labelText':_0x238d43[_0xe6f3('0x10e')],'text_color':_0x238d43['textColor'],'text_button_color':_0x238d43['textButtonColor'],'button_color':_0x238d43[_0xe6f3('0x10f')],'background_color':_0x238d43['backgroundColor'],'hideWhenOffline':_0x238d43['hideWhenOffline'],'interval':_0x238d43[_0xe6f3('0x110')]}));})[_0xe6f3('0x47')](handleError(_0x599ca7,null));};exports[_0xe6f3('0x111')]=function(_0x45e626,_0x2002f7){var _0x573f2c=_0x45e626[_0xe6f3('0x45')]['id'];var _0xf227d8=_0x45e626[_0xe6f3('0x49')];var _0x504e08=0xc8;var _0x5c63ff=null;return db[_0xe6f3('0xd5')][_0xe6f3('0xd6')]({'isolationLevel':db[_0xe6f3('0xd5')]['Transaction'][_0xe6f3('0x112')][_0xe6f3('0x113')]},function(_0xc0ddc4){return db[_0xe6f3('0x2d')][_0xe6f3('0x55')]({'where':{'id':_0x573f2c},'transaction':_0xc0ddc4})[_0xe6f3('0x10')](function(_0x1d50e2){if(_0x1d50e2){return db[_0xe6f3('0x8e')]['destroy']({'where':{'ChatWebsiteId':_0x573f2c},'transaction':_0xc0ddc4})['then'](function(){var _0x405f04=_[_0xe6f3('0x2c')](_0xf227d8,function(_0x5c57a1){_0x5c57a1['ChatWebsiteId']=_0x573f2c;return _0x5c57a1;});return db[_0xe6f3('0x8e')][_0xe6f3('0x114')](_0x405f04,{'transaction':_0xc0ddc4});});}else{_0x504e08=0x194;_0x5c63ff=[];}});})[_0xe6f3('0x10')](function(){if(_0x504e08!==0x194){return db[_0xe6f3('0x8e')][_0xe6f3('0x115')]({'where':{'ChatWebsiteId':_0x573f2c},'order':_0xe6f3('0x93')})['then'](function(_0x33b1b3){_0x5c63ff=_0x33b1b3;});}})['catch'](function(_0x1a5707){_0x504e08=0x1f4;logger['error'](_0x1a5707[_0xe6f3('0x27')]);if(_0x1a5707['name']){delete _0x1a5707['name'];}_0x5c63ff=_0x1a5707;})[_0xe6f3('0x116')](function(){if(_0x5c63ff===null){_0x2002f7[_0xe6f3('0x19')](_0x504e08);}else{if(_0x504e08===0x1f4){_0x2002f7[_0xe6f3('0x1a')](_0x504e08)[_0xe6f3('0xc1')](_0x5c63ff);}else{_0x2002f7[_0xe6f3('0x1a')](_0x504e08)[_0xe6f3('0x1c')](_0x5c63ff);}}});};exports[_0xe6f3('0x117')]=function(_0x46e598,_0x2a99fe){var _0xa1817f={};var _0x3503b8={};var _0x2c0db3;var _0x3304e4;return db[_0xe6f3('0x2d')]['findOne']({'where':{'id':_0x46e598[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x2a99fe,null))['then'](function(_0x463daf){if(_0x463daf){_0x2c0db3=_0x463daf;_0x3503b8['model']=_[_0xe6f3('0x32')](db[_0xe6f3('0x8e')][_0xe6f3('0x2e')]);_0x3503b8[_0xe6f3('0x33')]=_[_0xe6f3('0x32')](_0x46e598[_0xe6f3('0x33')]);_0x3503b8[_0xe6f3('0x34')]=_[_0xe6f3('0x35')](_0x3503b8[_0xe6f3('0x37')],_0x3503b8[_0xe6f3('0x33')]);_0xa1817f[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x3503b8[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x38')]));_0xa1817f[_0xe6f3('0x36')]=_0xa1817f['attributes'][_0xe6f3('0x39')]?_0xa1817f[_0xe6f3('0x36')]:_0x3503b8['model'];_0xa1817f['order']=qs[_0xe6f3('0x3c')](_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x3c')]);_0xa1817f['where']=qs[_0xe6f3('0x34')](_[_0xe6f3('0x57')](_0x46e598['query'],_0x3503b8[_0xe6f3('0x34')]));if(_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x3f')]){_0xa1817f[_0xe6f3('0x3d')]=_[_0xe6f3('0x3e')](_0xa1817f[_0xe6f3('0x3d')],{'$or':_['map'](_0xa1817f[_0xe6f3('0x36')],function(_0x4ec2a4){var _0x3c05f7={};_0x3c05f7[_0x4ec2a4]={'$like':'%'+_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x3f')]+'%'};return _0x3c05f7;})});}_0xa1817f=_[_0xe6f3('0x3e')]({},_0xa1817f,_0x46e598[_0xe6f3('0x40')]);return _0x2c0db3[_0xe6f3('0x117')](_0xa1817f);}})[_0xe6f3('0x10')](function(_0x1f7892){if(_0x1f7892){_0x3304e4=_0x1f7892[_0xe6f3('0x39')];if(!_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0xa1817f[_0xe6f3('0x1f')]=qs[_0xe6f3('0x1f')](_0x46e598[_0xe6f3('0x33')][_0xe6f3('0x1f')]);_0xa1817f['offset']=qs[_0xe6f3('0x1d')](_0x46e598['query'][_0xe6f3('0x1d')]);}return _0x2c0db3['getApplications'](_0xa1817f);}})[_0xe6f3('0x10')](function(_0x1d48a2){if(_0x1d48a2){return _0x1d48a2?{'count':_0x3304e4,'rows':_0x1d48a2}:null;}})[_0xe6f3('0x10')](respondWithResult(_0x2a99fe,null))[_0xe6f3('0x47')](handleError(_0x2a99fe,null));};exports[_0xe6f3('0x118')]=function(_0x35afad,_0x457e15){return db['chatProactiveAction']['find']({'where':{'id':_0x35afad['params']['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x457e15,null))[_0xe6f3('0x10')](function(_0x150eff){if(_0x150eff){return _0x150eff[_0xe6f3('0x118')](_0x35afad[_0xe6f3('0x49')][_0xe6f3('0x5b')],_[_0xe6f3('0xec')](_0x35afad[_0xe6f3('0x49')],[_0xe6f3('0x5b'),'id'])||{});}})[_0xe6f3('0x10')](respondWithResult(_0x457e15,null))[_0xe6f3('0x47')](handleError(_0x457e15,null));};exports['getProactiveActions']=function(_0x22dd3e,_0x11df93){var _0x59e647={};var _0x1703b4={};var _0x21a6d5;var _0x12f1d3;return db[_0xe6f3('0x2d')][_0xe6f3('0x55')]({'where':{'id':_0x22dd3e[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x11df93,null))[_0xe6f3('0x10')](function(_0x5b5d40){if(_0x5b5d40){_0x21a6d5=_0x5b5d40;_0x1703b4[_0xe6f3('0x37')]=_[_0xe6f3('0x32')](db[_0xe6f3('0x119')][_0xe6f3('0x2e')]);_0x1703b4['query']=_[_0xe6f3('0x32')](_0x22dd3e[_0xe6f3('0x33')]);_0x1703b4[_0xe6f3('0x34')]=_[_0xe6f3('0x35')](_0x1703b4[_0xe6f3('0x37')],_0x1703b4[_0xe6f3('0x33')]);_0x59e647[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x1703b4[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x22dd3e[_0xe6f3('0x33')]['fields']));_0x59e647[_0xe6f3('0x36')]=_0x59e647[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x59e647[_0xe6f3('0x36')]:_0x1703b4[_0xe6f3('0x37')];_0x59e647[_0xe6f3('0x3b')]=qs[_0xe6f3('0x3c')](_0x22dd3e[_0xe6f3('0x33')][_0xe6f3('0x3c')]);_0x59e647[_0xe6f3('0x3d')]=qs[_0xe6f3('0x34')](_[_0xe6f3('0x57')](_0x22dd3e[_0xe6f3('0x33')],_0x1703b4['filters']));if(_0x22dd3e[_0xe6f3('0x33')][_0xe6f3('0x3f')]){_0x59e647[_0xe6f3('0x3d')]=_[_0xe6f3('0x3e')](_0x59e647['where'],{'$or':_[_0xe6f3('0x2c')](_0x59e647[_0xe6f3('0x36')],function(_0x65460d){var _0x380973={};_0x380973[_0x65460d]={'$like':'%'+_0x22dd3e['query']['filter']+'%'};return _0x380973;})});}_0x59e647=_[_0xe6f3('0x3e')]({},_0x59e647,_0x22dd3e[_0xe6f3('0x40')]);return _0x21a6d5[_0xe6f3('0x11a')](_0x59e647);}})['then'](function(_0x53ac13){if(_0x53ac13){_0x12f1d3=_0x53ac13[_0xe6f3('0x39')];if(!_0x22dd3e[_0xe6f3('0x33')][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0x59e647['limit']=qs[_0xe6f3('0x1f')](_0x22dd3e[_0xe6f3('0x33')]['limit']);_0x59e647['offset']=qs['offset'](_0x22dd3e[_0xe6f3('0x33')]['offset']);}return _0x21a6d5[_0xe6f3('0x11a')](_0x59e647);}})['then'](function(_0x135f9a){if(_0x135f9a){return _0x135f9a?{'count':_0x12f1d3,'rows':_0x135f9a}:null;}})['then'](respondWithResult(_0x11df93,null))[_0xe6f3('0x47')](handleError(_0x11df93,null));};exports[_0xe6f3('0x11b')]=function(_0x14ce3d,_0x488350){var _0xdea909=_0x14ce3d['query'][_0xe6f3('0x11c')]==='false'?'offlineForm':_0xe6f3('0x11d');return db[_0xe6f3('0x2d')][_0xe6f3('0x4d')]({'attributes':['id',_0xdea909],'where':{'id':_0x14ce3d['params']['id']}})['then'](handleEntityNotFound(_0x488350,null))['then'](function(_0x296c02){if(_0x296c02){var _0x182439=_0x296c02[_0xdea909];var _0x51f42e=_0x182439&&_0x182439[_0xe6f3('0x11e')]?_0x182439[_0xe6f3('0x11e')]:[];_0x488350[_0xe6f3('0xc1')]({'fromKey':_[_0xe6f3('0x6b')](_0x182439[_0xe6f3('0x11f')])?undefined:_0x182439['fromKey'],'count':_0x51f42e[_0xe6f3('0x39')],'rows':_0x51f42e});}})[_0xe6f3('0x47')](handleError(_0x488350,null));};exports[_0xe6f3('0x120')]=function(_0x55afc6,_0x411064){var _0x392697={'raw':![],'where':{}};var _0x1034b1={};var _0x43493b={'count':0x0,'rows':[]};return db[_0xe6f3('0x2d')]['findOne']({'where':{'id':_0x55afc6[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x411064,null))[_0xe6f3('0x10')](function(_0x11d428){if(_0x11d428){_0x1034b1[_0xe6f3('0x37')]=_[_0xe6f3('0x32')](db[_0xe6f3('0xcd')][_0xe6f3('0x2e')]);_0x1034b1[_0xe6f3('0x33')]=_[_0xe6f3('0x32')](_0x55afc6['query']);_0x1034b1[_0xe6f3('0x34')]=_['intersection'](_0x1034b1[_0xe6f3('0x37')],_0x1034b1[_0xe6f3('0x33')]);_0x392697['attributes']=_['intersection'](_0x1034b1[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x38')]));_0x392697['attributes']=_0x392697[_0xe6f3('0x36')]['length']?_0x392697[_0xe6f3('0x36')]:_0x1034b1[_0xe6f3('0x37')];if(!_0x55afc6['query']['hasOwnProperty']('nolimit')){_0x392697['limit']=qs[_0xe6f3('0x1f')](_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x1f')]);_0x392697[_0xe6f3('0x1d')]=qs[_0xe6f3('0x1d')](_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x1d')]);}_0x392697[_0xe6f3('0x3b')]=qs[_0xe6f3('0x3c')](_0x55afc6[_0xe6f3('0x33')]['sort']);_0x392697[_0xe6f3('0x3d')]=qs['filters'](_['pick'](_0x55afc6['query'],_0x1034b1[_0xe6f3('0x34')]));_0x392697[_0xe6f3('0x3d')][_0xe6f3('0x53')]=_0x11d428['id'];if(_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x3f')]){_0x392697['where']=_[_0xe6f3('0x3e')](_0x392697[_0xe6f3('0x3d')],{'$or':_[_0xe6f3('0x2c')](_0x392697['attributes'],function(_0x175f7e){var _0x4d43fe={};_0x4d43fe[_0x175f7e]={'$like':'%'+_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x3f')]+'%'};return _0x4d43fe;})});}_0x392697=_[_0xe6f3('0x3e')]({},_0x392697,_0x55afc6[_0xe6f3('0x40')]);return db['ChatOfflineMessage'][_0xe6f3('0x20')]({'where':_0x392697[_0xe6f3('0x3d')]})['then'](function(_0x2c094e){_0x43493b[_0xe6f3('0x20')]=_0x2c094e;if(_0x55afc6[_0xe6f3('0x33')][_0xe6f3('0x41')]){_0x392697[_0xe6f3('0x46')]=[{'all':!![]}];}else{_0x392697[_0xe6f3('0x46')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xe6f3('0xd7')],'as':_0xe6f3('0x121'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x392697);})[_0xe6f3('0x10')](function(_0x433e88){_0x43493b['rows']=_0x433e88;return _0x43493b;});}})[_0xe6f3('0x10')](respondWithFilteredResult(_0x411064,_0x392697))[_0xe6f3('0x47')](handleError(_0x411064,null));};exports['addAgents']=function(_0x17373c,_0x302c9e){return db['ChatWebsite'][_0xe6f3('0x4d')]({'where':{'id':_0x17373c['params']['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x302c9e,null))[_0xe6f3('0x10')](function(_0x5d4855){if(_0x5d4855){return _0x5d4855[_0xe6f3('0x122')](_0x17373c['body'][_0xe6f3('0x5b')],_['omit'](_0x17373c[_0xe6f3('0x49')],['ids','id'])||{})[_0xe6f3('0xae')](function(_0x25c73a){for(var _0x3f0f53=0x0;_0x3f0f53<_0x17373c['body']['ids'][_0xe6f3('0x39')];_0x3f0f53+=0x1){socket[_0xe6f3('0x123')]('userChatWebsite:save',{'UserId':Number(_0x17373c[_0xe6f3('0x49')][_0xe6f3('0x5b')][_0x3f0f53]),'ChatWebsiteId':Number(_0x17373c[_0xe6f3('0x45')]['id'])});}return _0x25c73a;});}})[_0xe6f3('0x10')](respondWithResult(_0x302c9e,null))['catch'](handleError(_0x302c9e,null));};exports[_0xe6f3('0x124')]=function(_0x8698c,_0x221d8b){return db[_0xe6f3('0x2d')]['find']({'where':{'id':_0x8698c[_0xe6f3('0x45')]['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x221d8b,null))[_0xe6f3('0x10')](function(_0x42679e){if(_0x42679e){return _0x42679e[_0xe6f3('0x124')](_0x8698c[_0xe6f3('0x33')][_0xe6f3('0x5b')])[_0xe6f3('0x10')](function(){if(_['isArray'](_0x8698c[_0xe6f3('0x33')][_0xe6f3('0x5b')])){for(var _0x20a8d2=0x0;_0x20a8d2<_0x8698c[_0xe6f3('0x33')][_0xe6f3('0x5b')]['length'];_0x20a8d2+=0x1){socket[_0xe6f3('0x123')](_0xe6f3('0x125'),{'UserId':Number(_0x8698c[_0xe6f3('0x33')][_0xe6f3('0x5b')][_0x20a8d2]),'ChatWebsiteId':Number(_0x8698c[_0xe6f3('0x45')]['id'])});}}else{socket[_0xe6f3('0x123')](_0xe6f3('0x125'),{'UserId':Number(_0x8698c[_0xe6f3('0x33')][_0xe6f3('0x5b')]),'ChatWebsiteId':Number(_0x8698c[_0xe6f3('0x45')]['id'])});}});}})[_0xe6f3('0x10')](respondWithStatusCode(_0x221d8b,null))[_0xe6f3('0x47')](handleError(_0x221d8b,null));};exports[_0xe6f3('0x126')]=function(_0x28a990,_0x37e2ba){var _0x4b2056={};var _0x15f023={};var _0x493413;var _0x12bf07;return db[_0xe6f3('0x2d')][_0xe6f3('0x55')]({'where':{'id':_0x28a990['params']['id']}})[_0xe6f3('0x10')](handleEntityNotFound(_0x37e2ba,null))[_0xe6f3('0x10')](function(_0x3978db){if(_0x3978db){_0x493413=_0x3978db;_0x15f023[_0xe6f3('0x37')]=_['keys'](db[_0xe6f3('0xb9')]['rawAttributes']);_0x15f023[_0xe6f3('0x33')]=_['keys'](_0x28a990[_0xe6f3('0x33')]);_0x15f023[_0xe6f3('0x34')]=_[_0xe6f3('0x35')](_0x15f023[_0xe6f3('0x37')],_0x15f023['query']);_0x4b2056[_0xe6f3('0x36')]=_[_0xe6f3('0x35')](_0x15f023[_0xe6f3('0x37')],qs[_0xe6f3('0x38')](_0x28a990[_0xe6f3('0x33')][_0xe6f3('0x38')]));_0x4b2056['attributes']=_0x4b2056[_0xe6f3('0x36')][_0xe6f3('0x39')]?_0x4b2056['attributes']:_0x15f023[_0xe6f3('0x37')];_0x4b2056['order']=qs[_0xe6f3('0x3c')](_0x28a990[_0xe6f3('0x33')][_0xe6f3('0x3c')]);_0x4b2056[_0xe6f3('0x3d')]=qs[_0xe6f3('0x34')](_[_0xe6f3('0x57')](_0x28a990[_0xe6f3('0x33')],_0x15f023[_0xe6f3('0x34')]));if(_0x28a990['query'][_0xe6f3('0x3f')]){_0x4b2056['where']=_[_0xe6f3('0x3e')](_0x4b2056[_0xe6f3('0x3d')],{'$or':_['map'](_0x4b2056[_0xe6f3('0x36')],function(_0x3be3a4){var _0x279e82={};_0x279e82[_0x3be3a4]={'$like':'%'+_0x28a990[_0xe6f3('0x33')][_0xe6f3('0x3f')]+'%'};return _0x279e82;})});}_0x4b2056=_['merge']({},_0x4b2056,_0x28a990[_0xe6f3('0x40')]);return _0x493413[_0xe6f3('0x126')](_0x4b2056);}})['then'](function(_0x32c9d0){if(_0x32c9d0){_0x12bf07=_0x32c9d0['length'];if(!_0x28a990[_0xe6f3('0x33')][_0xe6f3('0x3a')](_0xe6f3('0x56'))){_0x4b2056[_0xe6f3('0x1f')]=qs[_0xe6f3('0x1f')](_0x28a990[_0xe6f3('0x33')]['limit']);_0x4b2056['offset']=qs[_0xe6f3('0x1d')](_0x28a990[_0xe6f3('0x33')][_0xe6f3('0x1d')]);}return _0x493413[_0xe6f3('0x126')](_0x4b2056);}})[_0xe6f3('0x10')](function(_0x2cbbff){if(_0x2cbbff){return _0x2cbbff?{'count':_0x12bf07,'rows':_0x2cbbff}:null;}})[_0xe6f3('0x10')](respondWithResult(_0x37e2ba,null))['catch'](handleError(_0x37e2ba,null));}; \ No newline at end of file +var _0x4820=['addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','ChatApplication','Applications','List','account','list','applications','priority','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','lastName','messageId','created','push','close','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','no\x20available\x20attributes','ListId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','files','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','offlineMessageSubject','Chat','NotifyMailAccount','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','x-real-ip','replace','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','json','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','mustache','path','ejs','fs-extra','lodash','querystring','ioredis','../../mysqldb','defaults','redis','localhost','register','html-to-text','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','undefined','limit','offset','count','Content-Range','update','get','ChatWebsites','destroy','stack','name','send','index','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','show','Pause','rawAttributes','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','findOne','length','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers'];(function(_0x518cc0,_0x4e38ab){var _0x281183=function(_0x2ffafe){while(--_0x2ffafe){_0x518cc0['push'](_0x518cc0['shift']());}};_0x281183(++_0x4e38ab);}(_0x4820,0xc8));var _0x0482=function(_0x4f8596,_0x2b8d60){_0x4f8596=_0x4f8596-0x0;var _0x41485c=_0x4820[_0x4f8596];return _0x41485c;};'use strict';var BPromise=require(_0x0482('0x0'));var Mustache=require(_0x0482('0x1'));var util=require('util');var path=require(_0x0482('0x2'));var ejs=require(_0x0482('0x3'));var fs=require('fs');var fs_extra=require(_0x0482('0x4'));var _=require(_0x0482('0x5'));var querystring=require(_0x0482('0x6'));var Redis=require(_0x0482('0x7'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x0482('0x8'))['db'];config['redis']=_[_0x0482('0x9')](config[_0x0482('0xa')],{'host':_0x0482('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0482('0xa')]));require('./chatWebsite.socket')[_0x0482('0xc')](socket);var htmlToText=require(_0x0482('0xd'));var jayson=require(_0x0482('0xe'));var client=jayson[_0x0482('0xf')]['http']({'port':0x232c});var client9002=jayson[_0x0482('0xf')][_0x0482('0x10')]({'port':0x232a});var client9003=jayson[_0x0482('0xf')][_0x0482('0x10')]({'port':0x232b});var client9001=jayson[_0x0482('0xf')]['http']({'port':0x2329});function respondWithRpcPromise(_0x47075a,_0x32a8a1,_0xa3e251,_0x21e94c){return new BPromise(function(_0x47aae3,_0x15feed){var _0x5c20a4=_0x21e94c||client;return _0x5c20a4['request'](_0x47075a,_0xa3e251)[_0x0482('0x11')](function(_0x25f1bd){logger[_0x0482('0x12')](_0x0482('0x13'),_0x32a8a1,_0x0482('0x14'));logger[_0x0482('0x15')](_0x0482('0x16'),_0x32a8a1,'request\x20sent',JSON[_0x0482('0x17')](_0x25f1bd));if(_0x25f1bd[_0x0482('0x18')]){if(_0x25f1bd[_0x0482('0x18')][_0x0482('0x19')]===0x1f4){logger[_0x0482('0x18')](_0x0482('0x13'),_0x32a8a1,_0x25f1bd['error'][_0x0482('0x1a')]);return _0x15feed(_0x25f1bd[_0x0482('0x18')]['message']);}logger['error'](_0x0482('0x13'),_0x32a8a1,_0x25f1bd[_0x0482('0x18')]['message']);return _0x47aae3(_0x25f1bd[_0x0482('0x18')]['message']);}else{logger['info'](_0x0482('0x13'),_0x32a8a1,_0x0482('0x14'));_0x47aae3(_0x25f1bd['result'][_0x0482('0x1a')]);}})[_0x0482('0x1b')](function(_0x3d7163){logger['error'](_0x0482('0x13'),_0x32a8a1,_0x3d7163);_0x15feed(_0x3d7163);});});}function respondWithStatusCode(_0x345667,_0x1bda68){_0x1bda68=_0x1bda68||0xcc;return function(_0x40a8c7){if(_0x40a8c7){return _0x345667[_0x0482('0x1c')](_0x1bda68);}return _0x345667[_0x0482('0x1d')](_0x1bda68)['end']();};}function respondWithResult(_0xadb08c,_0x2beb56){_0x2beb56=_0x2beb56||0xc8;return function(_0x373cd6){if(_0x373cd6){return _0xadb08c[_0x0482('0x1d')](_0x2beb56)['json'](_0x373cd6);}};}function respondWithFilteredResult(_0x36676a,_0x20c32b){return function(_0x423e11){if(_0x423e11){var _0x5677c7=typeof _0x20c32b['offset']===_0x0482('0x1e')&&typeof _0x20c32b[_0x0482('0x1f')]==='undefined';var _0x5d11e7=_0x423e11['count'];var _0x5052c8=_0x5677c7?0x0:_0x20c32b[_0x0482('0x20')];var _0x364a57=_0x5677c7?_0x423e11[_0x0482('0x21')]:_0x20c32b[_0x0482('0x20')]+_0x20c32b[_0x0482('0x1f')];var _0x458aed;if(_0x364a57>=_0x5d11e7){_0x364a57=_0x5d11e7;_0x458aed=0xc8;}else{_0x458aed=0xce;}_0x36676a['status'](_0x458aed);return _0x36676a['set'](_0x0482('0x22'),_0x5052c8+'-'+_0x364a57+'/'+_0x5d11e7)['json'](_0x423e11);}return null;};}function saveUpdates(_0x15b117){return function(_0x1535a5){if(_0x1535a5){return _0x1535a5[_0x0482('0x23')](_0x15b117)['then'](function(_0x66e676){return _0x66e676;});}return null;};}function removeEntity(_0x2c4af6){return function(_0x30c3ab){if(_0x30c3ab){return _0x30c3ab['destroy']()[_0x0482('0x11')](function(){var _0x15f204=_0x30c3ab[_0x0482('0x24')]({'plain':!![]});var _0x311df4=_0x0482('0x25');return db['UserProfileResource'][_0x0482('0x26')]({'where':{'type':_0x311df4,'resourceId':_0x15f204['id']}})['then'](function(){return _0x30c3ab;});})[_0x0482('0x11')](function(){_0x2c4af6[_0x0482('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270f5d){return function(_0x3e7946){if(!_0x3e7946){_0x270f5d['sendStatus'](0x194);}return _0x3e7946;};}function handleError(_0x361b97,_0x502810){_0x502810=_0x502810||0x1f4;return function(_0x2a14f9){logger['error'](_0x2a14f9[_0x0482('0x27')]);if(_0x2a14f9[_0x0482('0x28')]){delete _0x2a14f9[_0x0482('0x28')];}_0x361b97['status'](_0x502810)[_0x0482('0x29')](_0x2a14f9);};}exports[_0x0482('0x2a')]=function(_0x63c52e,_0xc40c51){var _0x2ad819={'include':[{'model':db['Pause'],'as':_0x0482('0x2b')}]},_0x3fcba3={},_0x52c1eb={'count':0x0,'rows':[]};var _0x1b98ad=_[_0x0482('0x2c')](db[_0x0482('0x2d')]['rawAttributes'],function(_0x2f08ef){return{'name':_0x2f08ef[_0x0482('0x2e')],'type':_0x2f08ef[_0x0482('0x2f')][_0x0482('0x30')]};});_0x3fcba3[_0x0482('0x31')]=_['map'](_0x1b98ad,_0x0482('0x28'));_0x3fcba3[_0x0482('0x32')]=_[_0x0482('0x33')](_0x63c52e[_0x0482('0x32')]);_0x3fcba3[_0x0482('0x34')]=_['intersection'](_0x3fcba3[_0x0482('0x31')],_0x3fcba3[_0x0482('0x32')]);_0x2ad819['attributes']=_[_0x0482('0x35')](_0x3fcba3[_0x0482('0x31')],qs[_0x0482('0x36')](_0x63c52e[_0x0482('0x32')]['fields']));_0x2ad819[_0x0482('0x37')]=_0x2ad819[_0x0482('0x37')]['length']?_0x2ad819[_0x0482('0x37')]:_0x3fcba3[_0x0482('0x31')];if(!_0x63c52e[_0x0482('0x32')][_0x0482('0x38')](_0x0482('0x39'))){_0x2ad819[_0x0482('0x1f')]=qs[_0x0482('0x1f')](_0x63c52e[_0x0482('0x32')][_0x0482('0x1f')]);_0x2ad819[_0x0482('0x20')]=qs['offset'](_0x63c52e[_0x0482('0x32')]['offset']);}_0x2ad819[_0x0482('0x3a')]=qs[_0x0482('0x3b')](_0x63c52e[_0x0482('0x32')]['sort']);_0x2ad819['where']=qs[_0x0482('0x34')](_['pick'](_0x63c52e[_0x0482('0x32')],_0x3fcba3[_0x0482('0x34')]),_0x1b98ad);if(_0x63c52e[_0x0482('0x32')]['filter']){_0x2ad819['where']=_[_0x0482('0x3c')](_0x2ad819[_0x0482('0x3d')],{'$or':_[_0x0482('0x2c')](_0x1b98ad,function(_0x13599d){if(_0x13599d[_0x0482('0x2f')]!==_0x0482('0x3e')){var _0x45ac8c={};_0x45ac8c[_0x13599d[_0x0482('0x28')]]={'$like':'%'+_0x63c52e[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x45ac8c;}})});}_0x2ad819=_[_0x0482('0x3c')]({},_0x2ad819,_0x63c52e[_0x0482('0x40')]);var _0x2d682b={'where':_0x2ad819['where']};return db['ChatWebsite'][_0x0482('0x21')](_0x2d682b)[_0x0482('0x11')](function(_0x5def5a){_0x52c1eb['count']=_0x5def5a;if(_0x63c52e[_0x0482('0x32')][_0x0482('0x41')]){_0x2ad819[_0x0482('0x42')]=[{'all':!![]}];}return db['ChatWebsite'][_0x0482('0x43')](_0x2ad819);})['then'](function(_0x434d17){_0x52c1eb['rows']=_0x434d17;return _0x52c1eb;})['then'](respondWithFilteredResult(_0xc40c51,_0x2ad819))[_0x0482('0x1b')](handleError(_0xc40c51,null));};exports[_0x0482('0x44')]=function(_0x2c895a,_0xfd36d6){var _0x589c7d={'raw':![],'where':{'id':_0x2c895a['params']['id']},'include':[{'model':db[_0x0482('0x45')],'as':_0x0482('0x2b')}]},_0x124aa6={};_0x124aa6[_0x0482('0x31')]=_[_0x0482('0x33')](db[_0x0482('0x2d')][_0x0482('0x46')]);_0x124aa6[_0x0482('0x32')]=_[_0x0482('0x33')](_0x2c895a[_0x0482('0x32')]);_0x124aa6[_0x0482('0x34')]=_[_0x0482('0x35')](_0x124aa6['model'],_0x124aa6[_0x0482('0x32')]);_0x589c7d['attributes']=_['intersection'](_0x124aa6['model'],qs[_0x0482('0x36')](_0x2c895a[_0x0482('0x32')]['fields']));_0x589c7d[_0x0482('0x37')]=_0x589c7d[_0x0482('0x37')]['length']?_0x589c7d['attributes']:_0x124aa6[_0x0482('0x31')];if(_0x2c895a[_0x0482('0x32')]['includeAll']){_0x589c7d['include']=[{'all':!![]}];}_0x589c7d=_['merge']({},_0x589c7d,_0x2c895a['options']);return db[_0x0482('0x2d')][_0x0482('0x47')](_0x589c7d)[_0x0482('0x11')](handleEntityNotFound(_0xfd36d6,null))[_0x0482('0x11')](respondWithResult(_0xfd36d6,null))[_0x0482('0x1b')](handleError(_0xfd36d6,null));};exports['create']=function(_0x4b42c9,_0x6d6e8f){return db[_0x0482('0x2d')]['create'](_0x4b42c9['body'],{})[_0x0482('0x11')](function(_0x210b47){var _0x3ebc88=_0x4b42c9[_0x0482('0x48')]['get']({'plain':!![]});if(!_0x3ebc88)throw new Error(_0x0482('0x49'));if(_0x3ebc88[_0x0482('0x4a')]===_0x0482('0x48')){var _0x1a985e=_0x210b47[_0x0482('0x24')]({'plain':!![]});var _0x23430d=_0x0482('0x25');return db[_0x0482('0x4b')][_0x0482('0x47')]({'where':{'name':_0x23430d,'userProfileId':_0x3ebc88[_0x0482('0x4c')]},'raw':!![]})[_0x0482('0x11')](function(_0x30f77f){if(_0x30f77f&&_0x30f77f[_0x0482('0x4d')]===0x0){return db[_0x0482('0x4e')][_0x0482('0x4f')]({'name':_0x1a985e[_0x0482('0x28')],'resourceId':_0x1a985e['id'],'type':_0x30f77f[_0x0482('0x28')],'sectionId':_0x30f77f['id']},{})['then'](function(){return _0x210b47;});}else{return _0x210b47;}})[_0x0482('0x1b')](function(_0x1bf4ef){logger['error'](_0x0482('0x50'),_0x1bf4ef);throw _0x1bf4ef;});}return _0x210b47;})[_0x0482('0x11')](respondWithResult(_0x6d6e8f,0xc9))[_0x0482('0x1b')](handleError(_0x6d6e8f,null));};exports['update']=function(_0xc992be,_0x2055cc){if(_0xc992be[_0x0482('0x51')]['id']){delete _0xc992be[_0x0482('0x51')]['id'];}return db['ChatWebsite'][_0x0482('0x47')]({'where':{'id':_0xc992be[_0x0482('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x0482('0x2b')}]})[_0x0482('0x11')](handleEntityNotFound(_0x2055cc,null))['then'](saveUpdates(_0xc992be[_0x0482('0x51')],null))[_0x0482('0x11')](respondWithResult(_0x2055cc,null))[_0x0482('0x1b')](handleError(_0x2055cc,null));};exports['destroy']=function(_0x48c9ff,_0x22cf75){return db[_0x0482('0x2d')][_0x0482('0x47')]({'where':{'id':_0x48c9ff[_0x0482('0x52')]['id']}})['then'](handleEntityNotFound(_0x22cf75,null))['then'](removeEntity(_0x22cf75,null))[_0x0482('0x1b')](handleError(_0x22cf75,null));};exports[_0x0482('0x53')]=function(_0x24429d,_0x540747){return db[_0x0482('0x2d')]['describe']()[_0x0482('0x11')](respondWithResult(_0x540747,null))[_0x0482('0x1b')](handleError(_0x540747,null));};exports[_0x0482('0x54')]=function(_0x12fc00,_0x188cb2){if(_0x12fc00[_0x0482('0x51')]['id']){delete _0x12fc00[_0x0482('0x51')]['id'];}return db[_0x0482('0x2d')][_0x0482('0x47')]({'where':{'id':_0x12fc00['params']['id']}})['then'](handleEntityNotFound(_0x188cb2,null))[_0x0482('0x11')](function(_0xd0899c){if(_0xd0899c){_0x12fc00[_0x0482('0x51')][_0x0482('0x55')]=_0xd0899c['id'];return db[_0x0482('0x56')][_0x0482('0x4f')](_0x12fc00[_0x0482('0x51')]);}})[_0x0482('0x11')](respondWithResult(_0x188cb2,null))['catch'](handleError(_0x188cb2,null));};exports['getDispositions']=function(_0x3465f9,_0x576c05){var _0x5d604b={'raw':![],'where':{}};var _0x464b9b={};var _0x38c4f4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0482('0x57')]({'where':{'id':_0x3465f9[_0x0482('0x52')]['id']}})['then'](handleEntityNotFound(_0x576c05,null))[_0x0482('0x11')](function(_0x527651){if(_0x527651){_0x464b9b[_0x0482('0x31')]=_[_0x0482('0x33')](db[_0x0482('0x56')][_0x0482('0x46')]);_0x464b9b['query']=_[_0x0482('0x33')](_0x3465f9[_0x0482('0x32')]);_0x464b9b[_0x0482('0x34')]=_[_0x0482('0x35')](_0x464b9b['model'],_0x464b9b[_0x0482('0x32')]);_0x5d604b['attributes']=_[_0x0482('0x35')](_0x464b9b['model'],qs[_0x0482('0x36')](_0x3465f9[_0x0482('0x32')][_0x0482('0x36')]));_0x5d604b[_0x0482('0x37')]=_0x5d604b['attributes'][_0x0482('0x58')]?_0x5d604b['attributes']:_0x464b9b['model'];if(!_0x3465f9[_0x0482('0x32')][_0x0482('0x38')](_0x0482('0x39'))){_0x5d604b[_0x0482('0x1f')]=qs['limit'](_0x3465f9['query']['limit']);_0x5d604b['offset']=qs['offset'](_0x3465f9[_0x0482('0x32')][_0x0482('0x20')]);}_0x5d604b['order']=qs[_0x0482('0x3b')](_0x3465f9['query'][_0x0482('0x3b')]);_0x5d604b[_0x0482('0x3d')]=qs['filters'](_[_0x0482('0x59')](_0x3465f9[_0x0482('0x32')],_0x464b9b[_0x0482('0x34')]));_0x5d604b['where']['ChatWebsiteId']=_0x527651['id'];if(_0x3465f9[_0x0482('0x32')][_0x0482('0x3f')]){_0x5d604b[_0x0482('0x3d')]=_[_0x0482('0x3c')](_0x5d604b[_0x0482('0x3d')],{'$or':_[_0x0482('0x2c')](_0x5d604b['attributes'],function(_0x322bef){var _0x4b487d={};_0x4b487d[_0x322bef]={'$like':'%'+_0x3465f9[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x4b487d;})});}_0x5d604b=_[_0x0482('0x3c')]({},_0x5d604b,_0x3465f9['options']);return db['Disposition'][_0x0482('0x21')]({'where':_0x5d604b[_0x0482('0x3d')]})['then'](function(_0x34082c){_0x38c4f4[_0x0482('0x21')]=_0x34082c;if(_0x3465f9[_0x0482('0x32')][_0x0482('0x41')]){_0x5d604b['include']=[{'all':!![]}];}return db[_0x0482('0x56')][_0x0482('0x43')](_0x5d604b);})[_0x0482('0x11')](function(_0x259a34){_0x38c4f4[_0x0482('0x5a')]=_0x259a34;return _0x38c4f4;});}})[_0x0482('0x11')](respondWithFilteredResult(_0x576c05,_0x5d604b))[_0x0482('0x1b')](handleError(_0x576c05,null));};exports[_0x0482('0x5b')]=function(_0x543ccd,_0x4b59cd){return db[_0x0482('0x2d')][_0x0482('0x47')]({'where':{'id':_0x543ccd[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x4b59cd,null))[_0x0482('0x11')](function(_0x17d979){if(_0x17d979){return _0x17d979[_0x0482('0x5b')](_0x543ccd[_0x0482('0x32')][_0x0482('0x5c')]);}})[_0x0482('0x11')](respondWithStatusCode(_0x4b59cd,null))[_0x0482('0x1b')](handleError(_0x4b59cd,null));};exports[_0x0482('0x5d')]=function(_0x57f1e8,_0x37f7f9){if(_0x57f1e8[_0x0482('0x51')]['id']){delete _0x57f1e8[_0x0482('0x51')]['id'];}return db['ChatWebsite'][_0x0482('0x47')]({'where':{'id':_0x57f1e8[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x37f7f9,null))[_0x0482('0x11')](function(_0x456154){if(_0x456154){_0x57f1e8[_0x0482('0x51')][_0x0482('0x55')]=_0x456154['id'];return db[_0x0482('0x5e')][_0x0482('0x4f')](_0x57f1e8[_0x0482('0x51')]);}})[_0x0482('0x11')](respondWithResult(_0x37f7f9,null))['catch'](handleError(_0x37f7f9,null));};exports[_0x0482('0x5f')]=function(_0x1d5681,_0x2f6bb9){var _0x3165ce={'raw':![],'where':{}};var _0x1688f0={};var _0x3057d0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0482('0x57')]({'where':{'id':_0x1d5681[_0x0482('0x52')]['id']}})['then'](handleEntityNotFound(_0x2f6bb9,null))['then'](function(_0x2561fa){if(_0x2561fa){_0x1688f0['model']=_['keys'](db['CannedAnswer'][_0x0482('0x46')]);_0x1688f0[_0x0482('0x32')]=_[_0x0482('0x33')](_0x1d5681[_0x0482('0x32')]);_0x1688f0[_0x0482('0x34')]=_['intersection'](_0x1688f0[_0x0482('0x31')],_0x1688f0['query']);_0x3165ce[_0x0482('0x37')]=_[_0x0482('0x35')](_0x1688f0[_0x0482('0x31')],qs['fields'](_0x1d5681['query'][_0x0482('0x36')]));_0x3165ce[_0x0482('0x37')]=_0x3165ce[_0x0482('0x37')][_0x0482('0x58')]?_0x3165ce['attributes']:_0x1688f0[_0x0482('0x31')];if(!_0x1d5681['query'][_0x0482('0x38')](_0x0482('0x39'))){_0x3165ce['limit']=qs[_0x0482('0x1f')](_0x1d5681['query'][_0x0482('0x1f')]);_0x3165ce['offset']=qs[_0x0482('0x20')](_0x1d5681[_0x0482('0x32')][_0x0482('0x20')]);}_0x3165ce['order']=qs[_0x0482('0x3b')](_0x1d5681[_0x0482('0x32')][_0x0482('0x3b')]);_0x3165ce['where']=qs['filters'](_['pick'](_0x1d5681[_0x0482('0x32')],_0x1688f0['filters']));_0x3165ce['where'][_0x0482('0x55')]=_0x2561fa['id'];if(_0x1d5681[_0x0482('0x32')]['filter']){_0x3165ce[_0x0482('0x3d')]=_[_0x0482('0x3c')](_0x3165ce['where'],{'$or':_[_0x0482('0x2c')](_0x3165ce['attributes'],function(_0x34e711){var _0x51b534={};_0x51b534[_0x34e711]={'$like':'%'+_0x1d5681[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x51b534;})});}_0x3165ce=_[_0x0482('0x3c')]({},_0x3165ce,_0x1d5681['options']);return db[_0x0482('0x5e')][_0x0482('0x21')]({'where':_0x3165ce['where']})[_0x0482('0x11')](function(_0x2477ec){_0x3057d0[_0x0482('0x21')]=_0x2477ec;if(_0x1d5681[_0x0482('0x32')][_0x0482('0x41')]){_0x3165ce['include']=[{'all':!![]}];}return db[_0x0482('0x5e')][_0x0482('0x43')](_0x3165ce);})['then'](function(_0x52414d){_0x3057d0[_0x0482('0x5a')]=_0x52414d;return _0x3057d0;});}})[_0x0482('0x11')](respondWithFilteredResult(_0x2f6bb9,_0x3165ce))[_0x0482('0x1b')](handleError(_0x2f6bb9,null));};exports['removeAnswers']=function(_0x464c02,_0x9e2f76){return db['ChatWebsite'][_0x0482('0x47')]({'where':{'id':_0x464c02[_0x0482('0x52')]['id']}})['then'](handleEntityNotFound(_0x9e2f76,null))[_0x0482('0x11')](function(_0xb4b79){if(_0xb4b79){return _0xb4b79[_0x0482('0x60')](_0x464c02[_0x0482('0x32')]['ids']);}})[_0x0482('0x11')](respondWithStatusCode(_0x9e2f76,null))[_0x0482('0x1b')](handleError(_0x9e2f76,null));};exports[_0x0482('0x61')]=function(_0x3e9837,_0x55d8c8){_0x3e9837[_0x0482('0x51')][_0x0482('0x62')]=_0x3e9837[_0x0482('0x63')]['filename'];return db[_0x0482('0x2d')][_0x0482('0x47')]({'where':{'id':_0x3e9837['params']['id']}})['then'](handleEntityNotFound(_0x55d8c8,null))[_0x0482('0x11')](saveUpdates(_0x3e9837[_0x0482('0x51')],null))[_0x0482('0x11')](respondWithResult(_0x55d8c8,null))['catch'](handleError(_0x55d8c8,null));};exports[_0x0482('0x64')]=function(_0x823191,_0x51662c){_0x823191[_0x0482('0x51')][_0x0482('0x65')]=_0x823191[_0x0482('0x63')][_0x0482('0x66')];return db[_0x0482('0x2d')]['find']({'where':{'id':_0x823191[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x51662c,null))['then'](saveUpdates(_0x823191[_0x0482('0x51')],null))[_0x0482('0x11')](respondWithResult(_0x51662c,null))[_0x0482('0x1b')](handleError(_0x51662c,null));};exports['addCustomerAvatar']=function(_0x5e1aed,_0x1f5f71){_0x5e1aed['body'][_0x0482('0x67')]=_0x5e1aed['file'][_0x0482('0x66')];return db['ChatWebsite'][_0x0482('0x47')]({'where':{'id':_0x5e1aed[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x1f5f71,null))[_0x0482('0x11')](saveUpdates(_0x5e1aed[_0x0482('0x51')],null))[_0x0482('0x11')](respondWithResult(_0x1f5f71,null))[_0x0482('0x1b')](handleError(_0x1f5f71,null));};exports[_0x0482('0x68')]=function(_0x1342de,_0x596fea){_0x1342de[_0x0482('0x51')][_0x0482('0x69')]=_0x1342de[_0x0482('0x63')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x1342de[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x596fea,null))['then'](saveUpdates(_0x1342de[_0x0482('0x51')],null))['then'](respondWithResult(_0x596fea,null))[_0x0482('0x1b')](handleError(_0x596fea,null));};exports[_0x0482('0x6a')]=function(_0x4e1426,_0x2c6a53){var _0x18195f=path[_0x0482('0x6b')](config['root'],_0x0482('0x6c'));var _0x186243={'where':{'id':_0x4e1426[_0x0482('0x52')]['id']},'attributes':['id',_0x0482('0x62')],'raw':!![]};var _0x1db112=![];return require(_0x0482('0x6d'))[_0x0482('0x6e')]()['then'](function(_0x4445ed){if(_0x4445ed){_0x1db112=_0x4445ed[_0x0482('0x6f')];}})[_0x0482('0x11')](function(){return db[_0x0482('0x2d')]['find'](_0x186243);})[_0x0482('0x11')](handleEntityNotFound(_0x2c6a53,null))[_0x0482('0x11')](function(_0x5c1bfe){if(_0x5c1bfe){if(!_[_0x0482('0x70')](_0x5c1bfe[_0x0482('0x62')])){if(fs[_0x0482('0x71')](path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x73'),_0x5c1bfe['sitepic']))&&_0x1db112){_0x18195f=path[_0x0482('0x6b')](config['root'],_0x0482('0x73'),_0x5c1bfe[_0x0482('0x62')]);}}return _0x2c6a53[_0x0482('0x74')](_0x18195f);}})[_0x0482('0x1b')](handleError(_0x2c6a53,null));};exports[_0x0482('0x75')]=function(_0x17510a,_0x53512e){var _0x177dc8=path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x76'));var _0x2ef47c={'where':{'id':_0x17510a[_0x0482('0x52')]['id']},'attributes':['id',_0x0482('0x65')],'raw':!![]};return db[_0x0482('0x2d')]['find'](_0x2ef47c)['then'](handleEntityNotFound(_0x53512e,null))['then'](function(_0x46420d){if(_0x46420d){if(!_['isNil'](_0x46420d[_0x0482('0x65')])){if(fs[_0x0482('0x71')](path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x77'),_0x46420d['agentAvatar']))){_0x177dc8=path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x77'),_0x46420d['agentAvatar']);}}return _0x53512e[_0x0482('0x74')](_0x177dc8);}})['catch'](handleError(_0x53512e,null));};exports['getCustomerAvatar']=function(_0x101bf3,_0x16cea4){var _0x2f3416=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x35733d={'where':{'id':_0x101bf3[_0x0482('0x52')]['id']},'attributes':['id',_0x0482('0x67'),'showCustomerAvatar'],'raw':!![]};return db[_0x0482('0x2d')]['find'](_0x35733d)['then'](handleEntityNotFound(_0x16cea4,null))[_0x0482('0x11')](function(_0xddd36){if(_0xddd36){if(!_[_0x0482('0x70')](_0xddd36[_0x0482('0x67')])){if(fs[_0x0482('0x71')](path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x77'),_0xddd36[_0x0482('0x67')]))&&_0xddd36[_0x0482('0x78')]){_0x2f3416=path['join'](config[_0x0482('0x72')],'server/files/images/avatars/',_0xddd36['customerAvatar']);}}return _0x16cea4[_0x0482('0x74')](_0x2f3416);}})[_0x0482('0x1b')](handleError(_0x16cea4,null));};exports['getSystemAvatar']=function(_0x28b603,_0x1e3494){var _0x2bbd1d=path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x79'));var _0x93d9e7={'where':{'id':_0x28b603[_0x0482('0x52')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x0482('0x2d')][_0x0482('0x47')](_0x93d9e7)[_0x0482('0x11')](handleEntityNotFound(_0x1e3494,null))[_0x0482('0x11')](function(_0x2ee03d){if(_0x2ee03d){if(!_[_0x0482('0x70')](_0x2ee03d[_0x0482('0x69')])){if(fs['existsSync'](path[_0x0482('0x6b')](config[_0x0482('0x72')],'server/files/images/avatars/',_0x2ee03d[_0x0482('0x69')]))){_0x2bbd1d=path[_0x0482('0x6b')](config['root'],_0x0482('0x77'),_0x2ee03d[_0x0482('0x69')]);}}return _0x1e3494[_0x0482('0x74')](_0x2bbd1d);}})[_0x0482('0x1b')](handleError(_0x1e3494,null));};exports[_0x0482('0x7a')]=function(_0xa4d9ba,_0x59e19){var _0x1663a9=require(_0x0482('0x7b'));var _0x19deb8=new _0x1663a9();var _0x3c8fd7=_0x19deb8[_0x0482('0x7c')](_0xa4d9ba[_0x0482('0x7d')]['user-agent'])[_0x0482('0x7e')]();var _0x51016c={'body':_0xa4d9ba[_0x0482('0x51')],'channel':_0x0482('0x7f')};var _0x1adee7=[];var _0x52b32a=[];var _0x1cb34f={};var _0x5795f3=![];return db[_0x0482('0x80')][_0x0482('0x53')]()[_0x0482('0x11')](function(_0x358ac5){if(!_0x358ac5){throw new db[(_0x0482('0x81'))][(_0x0482('0x82'))]('no\x20available\x20attributes');}_0x1adee7=_[_0x0482('0x83')](_['keys'](_0x358ac5),[_0x0482('0x84'),_0x0482('0x85')]);_0x52b32a=_[_0x0482('0x83')](_['keys'](_0x358ac5),['createdAt',_0x0482('0x85'),_0x0482('0x86'),'ListId']);if(_0xa4d9ba[_0x0482('0x51')]['id']){delete _0xa4d9ba['body']['id'];}if(_[_0x0482('0x70')](_0xa4d9ba[_0x0482('0x51')][_0x0482('0x87')])){throw new db['Sequelize']['ValidationError'](_0x0482('0x88'));}if(_[_0x0482('0x70')](_0xa4d9ba['body'][_0x0482('0x51')])||_0xa4d9ba[_0x0482('0x51')][_0x0482('0x51')]===''){throw new db[(_0x0482('0x81'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xa4d9ba[_0x0482('0x51')][_0x0482('0x89')])){throw new db[(_0x0482('0x81'))]['ValidationError'](_0x0482('0x8a')+_0x52b32a);}if(!_[_0x0482('0x8b')](_0x52b32a,_0xa4d9ba[_0x0482('0x51')][_0x0482('0x89')])){throw new db[(_0x0482('0x81'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52b32a);}_0x1cb34f[_0xa4d9ba[_0x0482('0x51')][_0x0482('0x89')]]=_0xa4d9ba[_0x0482('0x51')][_0x0482('0x87')];})['then'](function(){return db[_0x0482('0x2d')][_0x0482('0x47')]({'where':{'id':_0xa4d9ba['params']['id']},'include':[{'model':db[_0x0482('0x8c')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0482('0x8d'),'where':_0x1cb34f,'limit':0x1,'order':[[_0x0482('0x85'),_0x0482('0x8e')]]}]},{'model':db[_0x0482('0x8f')],'as':_0x0482('0x90')}]});})[_0x0482('0x11')](handleEntityNotFound(_0x59e19,null))[_0x0482('0x11')](function(_0x436e5b){if(_0x436e5b&&_0x436e5b[_0x0482('0x91')]){_0x51016c[_0x0482('0x92')]=_0x436e5b;_0x51016c['applications']=_0x436e5b[_0x0482('0x90')];_0x51016c[_0x0482('0x93')]=_0x436e5b['List'];_0x51016c['applications']=_['orderBy'](_0x51016c[_0x0482('0x94')],[_0x0482('0x95')],[_0x0482('0x96')]);if(_0x51016c['account'][_0x0482('0x90')]){delete _0x51016c[_0x0482('0x92')][_0x0482('0x90')];}if(_0x51016c[_0x0482('0x92')]['List']&&_0x51016c[_0x0482('0x92')][_0x0482('0x91')][_0x0482('0x8d')][_0x0482('0x58')]){return _0x51016c[_0x0482('0x92')]['List'][_0x0482('0x8d')][0x0];}var _0x943fa8=_[_0x0482('0x9')](_0xa4d9ba[_0x0482('0x51')],{'firstName':_0xa4d9ba[_0x0482('0x51')]['from'],'ListId':_0x436e5b['ListId']});_0x943fa8[_0xa4d9ba[_0x0482('0x51')]['mapKey']]=_0xa4d9ba['body'][_0x0482('0x87')];return db[_0x0482('0x80')][_0x0482('0x4f')](_0x943fa8,{'fields':_0x1adee7,'raw':!![]});}})[_0x0482('0x11')](handleEntityNotFound(_0x59e19,null))['then'](function(_0x2b643d){_0x51016c[_0x0482('0x97')]=_0x2b643d;var _0x4b61c9=_0xa4d9ba[_0x0482('0x51')][_0x0482('0x98')];if(_0xa4d9ba['headers'][_0x0482('0x99')]){_0x4b61c9=_0xa4d9ba[_0x0482('0x7d')][_0x0482('0x99')];}else if(_0xa4d9ba[_0x0482('0x7d')][_0x0482('0x9a')]){_0x4b61c9=_[_0x0482('0x9b')](_0xa4d9ba[_0x0482('0x7d')][_0x0482('0x9a')][_0x0482('0x9c')](','));}if(_0x2b643d){var _0x4eccf5={'ContactId':_0x2b643d['id'],'ChatWebsiteId':_0xa4d9ba[_0x0482('0x52')]['id'],'from':(_0x2b643d[_0x0482('0x9d')]||'')+'\x20'+(_0x2b643d['lastName']||''),'customerIp':_0x4b61c9,'customerPort':_0xa4d9ba[_0x0482('0x7d')][_0x0482('0x9e')]?_0xa4d9ba['headers']['x-real-port']:null,'referer':_0xa4d9ba[_0x0482('0x51')][_0x0482('0x9f')],'browserName':_0x3c8fd7[_0x0482('0xa0')]['name']&&_0x3c8fd7[_0x0482('0xa0')][_0x0482('0xa1')]?util[_0x0482('0xa2')](_0x0482('0xa3'),_0x3c8fd7[_0x0482('0xa0')][_0x0482('0x28')],_0x3c8fd7['browser'][_0x0482('0xa1')]):'unknown','browserVersion':_0x3c8fd7[_0x0482('0xa0')][_0x0482('0xa1')]||_0x0482('0xa4'),'osName':util[_0x0482('0xa2')](_0x0482('0xa3'),_0x3c8fd7['os']['name'],_0x3c8fd7['os'][_0x0482('0xa1')]),'osVersion':_0x3c8fd7['os'][_0x0482('0xa1')],'deviceModel':_0x3c8fd7[_0x0482('0xa5')][_0x0482('0x31')]&&_0x3c8fd7[_0x0482('0xa5')][_0x0482('0xa6')]?util['format'](_0x0482('0xa7'),_0x3c8fd7['device'][_0x0482('0x31')],_0x3c8fd7['device']['vendor'],_0x3c8fd7[_0x0482('0xa5')][_0x0482('0x2f')]):null,'deviceVendor':_0x3c8fd7[_0x0482('0xa5')][_0x0482('0xa6')],'deviceType':_0x3c8fd7[_0x0482('0xa5')]['type'],'formData':JSON[_0x0482('0x17')](_0xa4d9ba[_0x0482('0x51')])};var _0x3cde8b={'ChatWebsiteId':_0xa4d9ba[_0x0482('0x52')]['id'],'closed':![]};if(_0xa4d9ba[_0x0482('0x51')][_0x0482('0xa8')]){_0x3cde8b[_0x0482('0xa8')]=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xa8')];return db[_0x0482('0xa9')][_0x0482('0x47')]({'where':_0x3cde8b})[_0x0482('0x11')](function(_0x26fb43){if(_0x26fb43){return[_0x26fb43,![]];}_0x4eccf5['threadId']=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xa8')];_0x4eccf5['externalUrl']=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xaa')];return db[_0x0482('0xa9')][_0x0482('0x4f')](_0x4eccf5)[_0x0482('0x11')](function(_0xc54dab){return[_0xc54dab,!![]];});});}_0x3cde8b[_0x0482('0xab')]=_0x2b643d['id'];if(_0xa4d9ba[_0x0482('0x51')][_0x0482('0xac')]&&_0xa4d9ba[_0x0482('0x51')]['interaction']['id']){_0x3cde8b['id']=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xac')]['id'];return db[_0x0482('0xa9')][_0x0482('0x47')]({'where':_0x3cde8b})[_0x0482('0x11')](function(_0x5036a6){if(_0x5036a6){return[_0x5036a6,![]];}return db[_0x0482('0xa9')][_0x0482('0x4f')](_0x4eccf5)[_0x0482('0x11')](function(_0xac1723){return[_0xac1723,!![]];});});}return db[_0x0482('0xa9')]['create'](_0x4eccf5)[_0x0482('0x11')](function(_0x5e9820){return[_0x5e9820,!![]];});}})[_0x0482('0xad')](function(_0x1f897e,_0x31011f){if(_0x1f897e){_0x5795f3=_0x31011f;if(!_0x31011f){var _0x5d500b={'from':(_0x51016c[_0x0482('0x97')][_0x0482('0x9d')]||'')+'\x20'+(_0x51016c['contact'][_0x0482('0xae')]||'')};if(_0xa4d9ba['body'][_0x0482('0xa8')]&&_0xa4d9ba[_0x0482('0x51')][_0x0482('0xaf')]&&_0xa4d9ba[_0x0482('0x51')][_0x0482('0xa8')]!=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xaf')]){_0x5d500b[_0x0482('0xa8')]=_0xa4d9ba[_0x0482('0x51')][_0x0482('0xaf')];}return _0x1f897e[_0x0482('0x23')](_0x5d500b);}else{return _0x1f897e;}}})['then'](function(_0x427312){_0x51016c[_0x0482('0xac')]=_0x427312[_0x0482('0x24')]({'plain':!![]});_0x51016c[_0x0482('0xac')][_0x0482('0xb0')]=_0x5795f3;if(_0x51016c['interaction']['created']){if(_0x51016c[_0x0482('0x92')]['autoclose']){_0x51016c['applications'][_0x0482('0xb1')]({'id':0x0,'priority':_0x51016c[_0x0482('0x94')][_0x0482('0x58')]+0x1,'app':_0x0482('0xb2'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x0482('0xb3')][_0x0482('0x4f')]({'body':_0xa4d9ba[_0x0482('0x51')][_0x0482('0x51')],'ChatWebsiteId':_0xa4d9ba[_0x0482('0x52')]['id'],'ChatInteractionId':_0x427312['id'],'direction':'in','ContactId':_0x51016c['contact']['id'],'AttachmentId':_0xa4d9ba[_0x0482('0x51')][_0x0482('0xb4')]});})[_0x0482('0x11')](function(_0x3d0a5f){_0x51016c['message']=_0x3d0a5f;if(_0x51016c[_0x0482('0xac')][_0x0482('0xb5')]){return db['User'][_0x0482('0x47')]({'attributes':['id',_0x0482('0x28')],'where':{'id':_0x51016c[_0x0482('0xac')][_0x0482('0xb5')]}})['then'](function(_0x10e6ec){if(_0x10e6ec){_0x51016c['applications'][_0x0482('0xb6')]({'id':0x0,'priority':0x0,'app':_0x0482('0xb7'),'appdata':_0x10e6ec[_0x0482('0x28')]+','+(_0x51016c[_0x0482('0x92')][_0x0482('0xb8')]||0xa),'interval':'*,*,*,*'});_0x51016c[_0x0482('0xb9')]=!![];}return respondWithRpcPromise(_0x0482('0xba'),_0x0482('0xbb'),_0x51016c);});}return respondWithRpcPromise(_0x0482('0xba'),_0x0482('0xbb'),_0x51016c);})['then'](function(_0x45eda8){respondWithRpcPromise('EventManager',_0x0482('0xbc'),{'event':_0x0482('0x7a'),'message':_0x45eda8},client9002);return _0x45eda8;})[_0x0482('0x11')](respondWithResult(_0x59e19,null))[_0x0482('0x1b')](handleError(_0x59e19,null));};exports[_0x0482('0xbd')]=function(_0xc5da26,_0x332b91){var _0x3d2a34,_0x2d4f97,_0x967ed;var _0x36c017=[];var _0x568c68={};var _0x520a05=_0xc5da26['files']||[];var _0x24d5e3=[];var _0x2dbeb9;return db['CmContact']['describe']()[_0x0482('0x11')](function(_0x3097be){if(!_0x3097be){throw new db[(_0x0482('0x81'))][(_0x0482('0x82'))](_0x0482('0xbe'));}_0x36c017=_[_0x0482('0x83')](_[_0x0482('0x33')](_0x3097be),[_0x0482('0x84'),'updatedAt',_0x0482('0x86'),_0x0482('0xbf')]);if(_0xc5da26['body']['id']){delete _0xc5da26[_0x0482('0x51')]['id'];}if(_['isNil'](_0xc5da26[_0x0482('0x51')][_0x0482('0x87')])){throw _0x332b91[_0x0482('0x1d')](0x1f4)[_0x0482('0x29')](new db[(_0x0482('0x81'))]['ValidationError'](_0x0482('0x88')));}if(_[_0x0482('0x70')](_0xc5da26[_0x0482('0x51')][_0x0482('0x51')])||_0xc5da26[_0x0482('0x51')][_0x0482('0x51')]===''){throw _0x332b91[_0x0482('0x1d')](0x1f4)[_0x0482('0x29')](new db[(_0x0482('0x81'))][(_0x0482('0x82'))](_0x0482('0xc0')));}if(_[_0x0482('0x70')](_0xc5da26['body'][_0x0482('0xc1')])){throw _0x332b91[_0x0482('0x1d')](0x1f4)[_0x0482('0x29')](new db[(_0x0482('0x81'))][(_0x0482('0x82'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36c017));}if(!_['includes'](_0x36c017,_0xc5da26[_0x0482('0x51')][_0x0482('0xc1')])){throw _0x332b91[_0x0482('0x1d')](0x1f4)[_0x0482('0x29')](new db['Sequelize'][(_0x0482('0x82'))](_0x0482('0xc2')+_0x36c017));}_0x568c68[_0xc5da26[_0x0482('0x51')]['mapKeyOffline']]=_0xc5da26[_0x0482('0x51')][_0x0482('0x87')];})[_0x0482('0x11')](function(){return db[_0x0482('0x2d')]['find']({'where':{'id':_0xc5da26[_0x0482('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x0482('0x91')},{'model':db[_0x0482('0xc3')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x332b91,null))[_0x0482('0x11')](function(_0x339a81){if(_0x339a81&&_0x339a81[_0x0482('0x91')]){_0x2d4f97=_0x339a81;var _0x3ce159=_[_0x0482('0x9')](_0xc5da26[_0x0482('0x51')],{'firstName':_0xc5da26[_0x0482('0x51')]['from'],'phone':_0xc5da26[_0x0482('0x51')][_0x0482('0x87')],'ListId':_0x339a81['ListId']});_0x3ce159[_0xc5da26['body']['mapKeyOffline']]=_0xc5da26[_0x0482('0x51')][_0x0482('0x87')];return db[_0x0482('0x80')][_0x0482('0xc4')]({'where':_0x568c68,'defaults':_0x3ce159});}})['spread'](function(_0x14e7a4){if(_0x14e7a4){_0x967ed=_0x14e7a4;var _0x145afc=fs[_0x0482('0xc5')](path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0xc6')),_0x0482('0xc7'));var _0x4bccd6=ejs[_0x0482('0xc8')](_0x145afc,{'body':_[_0x0482('0xc9')](_0xc5da26[_0x0482('0x51')][_0x0482('0x51')]),'bodyTitle':_0x2d4f97[_0x0482('0xca')]});return db[_0x0482('0xcb')][_0x0482('0x4f')]({'body':_0x4bccd6,'plainBody':htmlToText[_0x0482('0xcc')](_0x4bccd6),'ContactId':_0x14e7a4['id'],'ChatWebsiteId':_0x2d4f97['id']});}})['then'](function(_0x2fdd23){_0x2dbeb9=_0x2fdd23;if(_0x520a05[_0x0482('0x58')]){var _0x43ecf3=_0x520a05['map'](function(_0x42b254){return{'name':_0x42b254[_0x0482('0xcd')],'basename':_0x42b254['filename'],'type':_0x42b254['mimetype'],'ChatOfflineMessageId':_0x2fdd23['id']};});_0x24d5e3=_0x43ecf3['map'](_0x239498=>{var _0x1aee8b={'filename':_0x239498['name'],'path':path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0xce'),_0x0482('0xcf'),'attachments',_0x0482('0xd0'),_0x239498[_0x0482('0xd1')])};return _0x1aee8b;});if(!_0x2d4f97['openNewInteraction']){return db[_0x0482('0xd2')]['transaction'](function(_0x17962a){return db[_0x0482('0xd3')][_0x0482('0xd4')](_0x43ecf3,{'transaction':_0x17962a});});}}})['then'](function(){if(_0x2dbeb9){_0x3d2a34=_0x2dbeb9;return db[_0x0482('0xc3')][_0x0482('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0x0482('0xd5')],'as':_0x0482('0xd6'),'raw':!![],'include':[{'model':db[_0x0482('0xd7')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0xf099ca){if(_0xf099ca&&_0xf099ca['Smtp']&&_0x2d4f97[_0x0482('0xd8')]&&_0x2d4f97[_0x0482('0xd9')]){var _0x4e2090=_0xf099ca[_0x0482('0xda')]();return respondWithRpcPromise(_0x0482('0xdb'),_0x0482('0xdc'),{'account':_0x4e2090,'message':{'from':util['format'](_0x0482('0xdd'),_0xf099ca[_0x0482('0x28')],_0xf099ca[_0x0482('0xde')]||_0xf099ca['Smtp'][_0x0482('0x48')]),'to':_0x2d4f97['forwardOfflineAddress'],'subject':_0x2d4f97['offlineMessageSubject'],'html':_0x3d2a34['body'],'attachments':_0x24d5e3}},client9003)['then'](function(){return _0x3d2a34;})[_0x0482('0x1b')](function(_0x158373){logger[_0x0482('0x18')](_0x158373);});}})[_0x0482('0x11')](function(){if(_0x2d4f97&&_0x2d4f97['openNewInteraction']&&_0x2d4f97[_0x0482('0xdf')]){var _0x3959c0=[];if(_0x520a05[_0x0482('0x58')]){_0x3959c0=_0x520a05[_0x0482('0x2c')](function(_0x3a4c57){return{'name':_0x3a4c57[_0x0482('0xcd')],'basename':_0x3a4c57[_0x0482('0x66')],'type':_0x3a4c57['mimetype'],'ChatOfflineMessageId':_0x2dbeb9['id']};});}var _0x405db9;if(!_[_0x0482('0x70')](_0x2d4f97[_0x0482('0xe0')])){var _0x45792d=_['map'](_0xc5da26[_0x0482('0x51')],function(_0x34a881){return _0x34a881;});var _0xa2c1cc=_[_0x0482('0xe1')](_0x45792d)[0x0];var _0x4c1f63=_['mapValues'](_0xa2c1cc,function(_0x2428ca){return _0x2428ca;});_0x405db9=_0x4c1f63[0x1][_0x2d4f97['subjectOffline']];}var _0x444c30={'from':_0x967ed[_0x0482('0xde')],'firstName':_0x967ed[_0x0482('0x9d')],'lastName':_0x967ed[_0x0482('0xae')],'mapKey':_0x0482('0xde'),'message':{'from':_0x967ed[_0x0482('0xde')],'to':_0x2d4f97[_0x0482('0xc3')][_0x0482('0xde')],'cc':'','subject':_[_0x0482('0x70')](_0x405db9)?_0x2d4f97[_0x0482('0xe2')]:_0x405db9,'messageId':'','sentAt':new Date(),'attach':_0x3959c0[_0x0482('0x58')],'attachments':_0x3959c0,'originChannel':_0x0482('0xe3'),'ChatWebsiteId':_0x2d4f97['id'],'ChatOfflineMessageId':_0x3d2a34['id'],'originTo':_0x2d4f97[_0x0482('0xc3')]['email']},'body':_0x3d2a34[_0x0482('0x51')]};var _0x22fc7a={'account':{'id':_0x2d4f97[_0x0482('0xdf')]},'body':_0x444c30,'log':_0x0482('0xe4')};return respondWithRpcPromise(_0x0482('0xe4'),'notifyMail',_0x22fc7a,client9001)[_0x0482('0x11')](function(){return _0x3d2a34;})[_0x0482('0x1b')](function(_0x36f54e){logger[_0x0482('0x18')](_0x36f54e);});}return;})[_0x0482('0x11')](function(){if(_0x3d2a34){return _0x3d2a34;}})[_0x0482('0x11')](respondWithResult(_0x332b91,null))[_0x0482('0x1b')](function(_0x10d56e){logger[_0x0482('0x18')](_0x0482('0x1b'),_0x10d56e);for(var _0x47ec43 of _0x520a05){var _0x4a1d2f=path['join'](config[_0x0482('0x72')],_0x0482('0xce'),'files',_0x0482('0xe5'),'offline-chat',_0x47ec43[_0x0482('0x66')]);fs_extra[_0x0482('0xe6')](_0x4a1d2f)[_0x0482('0x1b')](function(_0x2c657a){logger['error'](_0x0482('0xe7'),_0x4a1d2f,_0x2c657a);});}});};exports[_0x0482('0xe8')]=function(_0xf7e141,_0x7ae926){return db[_0x0482('0xa9')][_0x0482('0x47')]({'where':{'id':_0xf7e141['params']['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x7ae926,null))['then'](function(_0x455c69){if(_0x455c69){return _0x455c69[_0x0482('0xe8')](_0xf7e141[_0x0482('0x51')]['ids'],_[_0x0482('0xe9')](_0xf7e141[_0x0482('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x7ae926,null))[_0x0482('0x1b')](handleError(_0x7ae926,null));};exports[_0x0482('0xea')]=function(_0x4a2a5f,_0x11ae55){var _0x298e14={'raw':![],'where':{}};var _0x175866={};var _0xc808dc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0482('0x57')]({'where':{'id':_0x4a2a5f[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x11ae55,null))['then'](function(_0x5a92d7){if(_0x5a92d7){_0x175866[_0x0482('0x31')]=_[_0x0482('0x33')](db['ChatInteraction'][_0x0482('0x46')]);_0x175866['query']=_[_0x0482('0x33')](_0x4a2a5f['query']);_0x175866[_0x0482('0x34')]=_[_0x0482('0x35')](_0x175866['model'],_0x175866[_0x0482('0x32')]);_0x298e14[_0x0482('0x37')]=_[_0x0482('0x35')](_0x175866['model'],qs[_0x0482('0x36')](_0x4a2a5f[_0x0482('0x32')][_0x0482('0x36')]));_0x298e14[_0x0482('0x37')]=_0x298e14[_0x0482('0x37')]['length']?_0x298e14['attributes']:_0x175866[_0x0482('0x31')];if(!_0x4a2a5f[_0x0482('0x32')]['hasOwnProperty'](_0x0482('0x39'))){_0x298e14[_0x0482('0x1f')]=qs[_0x0482('0x1f')](_0x4a2a5f[_0x0482('0x32')][_0x0482('0x1f')]);_0x298e14[_0x0482('0x20')]=qs[_0x0482('0x20')](_0x4a2a5f[_0x0482('0x32')][_0x0482('0x20')]);}_0x298e14[_0x0482('0x3a')]=qs[_0x0482('0x3b')](_0x4a2a5f[_0x0482('0x32')]['sort']);_0x298e14[_0x0482('0x3d')]=qs[_0x0482('0x34')](_['pick'](_0x4a2a5f[_0x0482('0x32')],_0x175866[_0x0482('0x34')]));_0x298e14['where'][_0x0482('0x55')]=_0x5a92d7['id'];if(_0x4a2a5f[_0x0482('0x32')]['filter']){_0x298e14[_0x0482('0x3d')]=_[_0x0482('0x3c')](_0x298e14[_0x0482('0x3d')],{'$or':_[_0x0482('0x2c')](_0x298e14[_0x0482('0x37')],function(_0x14fca3){var _0x374099={};_0x374099[_0x14fca3]={'$like':'%'+_0x4a2a5f[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x374099;})});}_0x298e14=_[_0x0482('0x3c')]({},_0x298e14,_0x4a2a5f['options']);return db['ChatInteraction'][_0x0482('0x21')]({'where':_0x298e14[_0x0482('0x3d')]})['then'](function(_0x16e8d4){_0xc808dc[_0x0482('0x21')]=_0x16e8d4;if(_0x4a2a5f[_0x0482('0x32')][_0x0482('0x41')]){_0x298e14[_0x0482('0x42')]=[{'model':db['CmContact'],'as':_0x0482('0xeb'),'required':![]},{'model':db[_0x0482('0xec')],'as':'Owner','attributes':[_0x0482('0x28'),_0x0482('0xed'),_0x0482('0xee')],'required':![]},{'model':db[_0x0482('0xef')],'as':_0x0482('0xf0'),'attributes':['id',_0x0482('0x28'),_0x0482('0xf1')],'where':_0x4a2a5f[_0x0482('0x32')][_0x0482('0xf2')]?{'id':_0x4a2a5f[_0x0482('0x32')]['tag']}:undefined,'required':_0x4a2a5f[_0x0482('0x32')][_0x0482('0xf2')]?!![]:![]}];}return db[_0x0482('0xa9')][_0x0482('0x43')](_0x298e14);})['then'](function(_0x44be98){_0xc808dc[_0x0482('0x5a')]=_0x44be98;return _0xc808dc;});}})[_0x0482('0x11')](respondWithFilteredResult(_0x11ae55,_0x298e14))[_0x0482('0x1b')](handleError(_0x11ae55,null));};function iftimePromise(_0x5b9973,_0x515745){return respondWithRpcPromise(_0x0482('0xf3'),_0x0482('0xf4'),{'command':_0x515745[_0x0482('0xf5')]?util[_0x0482('0xa2')](_0x0482('0xf6'),_0x5b9973['interval'],_0x515745[_0x0482('0xf5')]):util['format']('iftime\x20%s',_0x5b9973[_0x0482('0xf7')])},client9002)[_0x0482('0x11')](function(_0x1da088){var _0x47a3ca=_0x1da088&&_0x1da088[_0x0482('0xf8')]('true')>=0x0?!![]:![];logger[_0x0482('0x12')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x515745['id'],_0x5b9973['id'],_0x5b9973[_0x0482('0xf7')],_0x47a3ca?_0x0482('0xf9'):_0x0482('0xfa'),_0x515745['timezone']?_0x515745['timezone']:_0x0482('0xfb'));return _0x47a3ca;})[_0x0482('0x1b')](function(_0x587c6c){logger[_0x0482('0x18')](_0x0482('0xfc'),_0x515745['id'],_0x5b9973['id'],_0x5b9973[_0x0482('0xf7')],util['inspect'](_0x587c6c,{'showHidden':![],'depth':null}),_0x515745['timezone']?_0x515745[_0x0482('0xf5')]:_0x0482('0xfb'));return![];});}exports[_0x0482('0xf4')]=function(_0x2a1c51,_0x3de23c){var _0xe70f3f=0x0;var _0x574365=0x0;var _0x401216=![];var _0x4dca23;var _0x2b9292;return db['ChatWebsite'][_0x0482('0x47')]({'where':{'id':_0x2a1c51[_0x0482('0x52')]['id']},'include':[{'model':db[_0x0482('0xfd')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x0482('0xfe'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x0482('0x11')](handleEntityNotFound(_0x3de23c,null))[_0x0482('0x11')](function(_0x2de17f){if(_0x2de17f){_0x4dca23=_0x2de17f;return _0x2de17f[_0x0482('0xff')]({'raw':!![]});}})['then'](function(_0x129d5f){if(_0x4dca23){if(_0x129d5f){_0x2b9292=_0x129d5f;}}return require(_0x0482('0x6d'))['getLicense']();})[_0x0482('0x11')](function(_0xc0c188){if(_0xc0c188){_0x574365=_0xc0c188[_0x0482('0x100')];_0x401216=_0xc0c188[_0x0482('0x6f')];}})['then'](function(){return db[_0x0482('0xa9')][_0x0482('0x21')]({'where':{'closed':![]}});})[_0x0482('0x11')](function(_0x29df8b){_0xe70f3f=_0x29df8b;if(_0x574365&&_0x29df8b>_0x574365){return db[_0x0482('0x101')][_0x0482('0x57')]({'where':{'id':0x1}})[_0x0482('0x11')](function(_0x47455e){if(_0x47455e){_0x47455e[_0x0482('0x102')](_0x0482('0x103'));}});}})[_0x0482('0x11')](function(){if(_0x4dca23[_0x0482('0xfd')]&&_0x4dca23[_0x0482('0xfd')][_0x0482('0xfe')]){var _0x6f8ab4=[];for(var _0x190487=0x0;_0x190487<_0x4dca23['Interval'][_0x0482('0xfe')][_0x0482('0x58')];_0x190487++){var _0x2304db=_0x4dca23[_0x0482('0xfd')][_0x0482('0xfe')][_0x190487][_0x0482('0x24')]({'plain':!![]});_0x6f8ab4[_0x0482('0xb1')](iftimePromise(_0x2304db,_0x4dca23));}return BPromise[_0x0482('0x104')](_0x6f8ab4)[_0x0482('0x11')](function(_0x4b0db4){return _[_0x0482('0x105')](_0x4b0db4);});}else{return!![];}})[_0x0482('0x11')](function(_0xe10b67){var _0x4802f1=fs[_0x0482('0xc5')](path[_0x0482('0x6b')](config[_0x0482('0x72')],_0x0482('0x106')),_0x0482('0xc7'));var _0x23f402={'remote':_0x4dca23['remote'],'query':querystring['stringify'](_[_0x0482('0x3c')](_0x4dca23['get']({'plain':!![]}),{'customerIp':_0x2a1c51['headers'][_0x0482('0x9a')]||_0x2a1c51[_0x0482('0x7d')][_0x0482('0x107')]||_0x2a1c51['connection']['remoteAddress']||_0x2a1c51['ip'],'referer':_0x2a1c51[_0x0482('0x7d')][_0x0482('0x9f')],'openedInteractions':_0xe70f3f,'maxInteractions':_0x574365,'virtual':_0x401216['virtual'],'online':_0xe10b67,'custom':_0x401216}))[_0x0482('0x108')](/'/g,'\x5c\x27')};_0x3de23c[_0x0482('0x29')](ejs['render'](Mustache['render'](_0x4802f1,_0x23f402),{'proactiveActions':_0x2b9292,'alignment':_0x4dca23[_0x0482('0x109')],'verticalAlignment':_0x4dca23[_0x0482('0x10a')],'div_color':_0x4dca23['color'],'labelText':_0x4dca23[_0x0482('0x10b')],'text_color':_0x4dca23['textColor'],'text_button_color':_0x4dca23[_0x0482('0x10c')],'button_color':_0x4dca23[_0x0482('0x10d')],'background_color':_0x4dca23[_0x0482('0x10e')],'hideWhenOffline':_0x4dca23[_0x0482('0x10f')],'interval':_0x4dca23[_0x0482('0x110')]}));})[_0x0482('0x1b')](handleError(_0x3de23c,null));};exports['addApplications']=function(_0x35b1d5,_0x58df8a){var _0x5711c9=_0x35b1d5[_0x0482('0x52')]['id'];var _0x2fd90f=_0x35b1d5[_0x0482('0x51')];var _0x5b3d30=0xc8;var _0x3e3d9a=null;return db[_0x0482('0xd2')][_0x0482('0x111')]({'isolationLevel':db['sequelize'][_0x0482('0x112')][_0x0482('0x113')][_0x0482('0x114')]},function(_0x2aee5a){return db[_0x0482('0x2d')][_0x0482('0x57')]({'where':{'id':_0x5711c9},'transaction':_0x2aee5a})['then'](function(_0x563faf){if(_0x563faf){return db['ChatApplication'][_0x0482('0x26')]({'where':{'ChatWebsiteId':_0x5711c9},'transaction':_0x2aee5a})[_0x0482('0x11')](function(){var _0x21a941=_[_0x0482('0x2c')](_0x2fd90f,function(_0x583cab){_0x583cab[_0x0482('0x55')]=_0x5711c9;return _0x583cab;});return db[_0x0482('0x8f')][_0x0482('0xd4')](_0x21a941,{'transaction':_0x2aee5a});});}else{_0x5b3d30=0x194;_0x3e3d9a=[];}});})[_0x0482('0x11')](function(){if(_0x5b3d30!==0x194){return db[_0x0482('0x8f')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x5711c9},'order':'priority'})['then'](function(_0x5c1a4a){_0x3e3d9a=_0x5c1a4a;});}})[_0x0482('0x1b')](function(_0x121ec4){_0x5b3d30=0x1f4;logger[_0x0482('0x18')](_0x121ec4[_0x0482('0x27')]);if(_0x121ec4[_0x0482('0x28')]){delete _0x121ec4[_0x0482('0x28')];}_0x3e3d9a=_0x121ec4;})[_0x0482('0x115')](function(){if(_0x3e3d9a===null){_0x58df8a[_0x0482('0x1c')](_0x5b3d30);}else{if(_0x5b3d30===0x1f4){_0x58df8a[_0x0482('0x1d')](_0x5b3d30)[_0x0482('0x29')](_0x3e3d9a);}else{_0x58df8a['status'](_0x5b3d30)[_0x0482('0x116')](_0x3e3d9a);}}});};exports[_0x0482('0x117')]=function(_0x3bccaa,_0x52fef0){var _0x4f2c31={};var _0x1a39aa={};var _0x12ac8d;var _0x5e1a95;return db[_0x0482('0x2d')][_0x0482('0x57')]({'where':{'id':_0x3bccaa[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x52fef0,null))[_0x0482('0x11')](function(_0x4efe66){if(_0x4efe66){_0x12ac8d=_0x4efe66;_0x1a39aa[_0x0482('0x31')]=_[_0x0482('0x33')](db[_0x0482('0x8f')][_0x0482('0x46')]);_0x1a39aa['query']=_['keys'](_0x3bccaa[_0x0482('0x32')]);_0x1a39aa['filters']=_['intersection'](_0x1a39aa[_0x0482('0x31')],_0x1a39aa[_0x0482('0x32')]);_0x4f2c31[_0x0482('0x37')]=_[_0x0482('0x35')](_0x1a39aa[_0x0482('0x31')],qs[_0x0482('0x36')](_0x3bccaa['query']['fields']));_0x4f2c31['attributes']=_0x4f2c31['attributes']['length']?_0x4f2c31[_0x0482('0x37')]:_0x1a39aa[_0x0482('0x31')];_0x4f2c31['order']=qs['sort'](_0x3bccaa[_0x0482('0x32')][_0x0482('0x3b')]);_0x4f2c31[_0x0482('0x3d')]=qs[_0x0482('0x34')](_[_0x0482('0x59')](_0x3bccaa[_0x0482('0x32')],_0x1a39aa[_0x0482('0x34')]));if(_0x3bccaa[_0x0482('0x32')][_0x0482('0x3f')]){_0x4f2c31[_0x0482('0x3d')]=_[_0x0482('0x3c')](_0x4f2c31['where'],{'$or':_[_0x0482('0x2c')](_0x4f2c31['attributes'],function(_0x1ebebd){var _0x42f7f1={};_0x42f7f1[_0x1ebebd]={'$like':'%'+_0x3bccaa[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x42f7f1;})});}_0x4f2c31=_[_0x0482('0x3c')]({},_0x4f2c31,_0x3bccaa['options']);return _0x12ac8d[_0x0482('0x117')](_0x4f2c31);}})[_0x0482('0x11')](function(_0x38b8b9){if(_0x38b8b9){_0x5e1a95=_0x38b8b9[_0x0482('0x58')];if(!_0x3bccaa[_0x0482('0x32')][_0x0482('0x38')](_0x0482('0x39'))){_0x4f2c31[_0x0482('0x1f')]=qs['limit'](_0x3bccaa[_0x0482('0x32')][_0x0482('0x1f')]);_0x4f2c31[_0x0482('0x20')]=qs[_0x0482('0x20')](_0x3bccaa['query']['offset']);}return _0x12ac8d[_0x0482('0x117')](_0x4f2c31);}})[_0x0482('0x11')](function(_0x3d4a12){if(_0x3d4a12){return _0x3d4a12?{'count':_0x5e1a95,'rows':_0x3d4a12}:null;}})[_0x0482('0x11')](respondWithResult(_0x52fef0,null))[_0x0482('0x1b')](handleError(_0x52fef0,null));};exports['addProactiveActions']=function(_0x2f45e9,_0x1d0fa5){return db[_0x0482('0x118')][_0x0482('0x47')]({'where':{'id':_0x2f45e9[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x1d0fa5,null))['then'](function(_0x1d7fdd){if(_0x1d7fdd){return _0x1d7fdd[_0x0482('0x119')](_0x2f45e9['body']['ids'],_['omit'](_0x2f45e9[_0x0482('0x51')],['ids','id'])||{});}})[_0x0482('0x11')](respondWithResult(_0x1d0fa5,null))[_0x0482('0x1b')](handleError(_0x1d0fa5,null));};exports[_0x0482('0xff')]=function(_0x5cd90a,_0x13458a){var _0x2a9ddf={};var _0x1e4205={};var _0x35f400;var _0x2c059c;return db[_0x0482('0x2d')][_0x0482('0x57')]({'where':{'id':_0x5cd90a['params']['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x13458a,null))['then'](function(_0x2cff6a){if(_0x2cff6a){_0x35f400=_0x2cff6a;_0x1e4205['model']=_['keys'](db[_0x0482('0x11a')][_0x0482('0x46')]);_0x1e4205[_0x0482('0x32')]=_[_0x0482('0x33')](_0x5cd90a['query']);_0x1e4205['filters']=_[_0x0482('0x35')](_0x1e4205[_0x0482('0x31')],_0x1e4205[_0x0482('0x32')]);_0x2a9ddf['attributes']=_[_0x0482('0x35')](_0x1e4205['model'],qs[_0x0482('0x36')](_0x5cd90a[_0x0482('0x32')]['fields']));_0x2a9ddf[_0x0482('0x37')]=_0x2a9ddf[_0x0482('0x37')]['length']?_0x2a9ddf[_0x0482('0x37')]:_0x1e4205['model'];_0x2a9ddf['order']=qs[_0x0482('0x3b')](_0x5cd90a['query'][_0x0482('0x3b')]);_0x2a9ddf[_0x0482('0x3d')]=qs[_0x0482('0x34')](_[_0x0482('0x59')](_0x5cd90a[_0x0482('0x32')],_0x1e4205['filters']));if(_0x5cd90a[_0x0482('0x32')][_0x0482('0x3f')]){_0x2a9ddf[_0x0482('0x3d')]=_['merge'](_0x2a9ddf[_0x0482('0x3d')],{'$or':_[_0x0482('0x2c')](_0x2a9ddf[_0x0482('0x37')],function(_0x216875){var _0x2e57e9={};_0x2e57e9[_0x216875]={'$like':'%'+_0x5cd90a[_0x0482('0x32')]['filter']+'%'};return _0x2e57e9;})});}_0x2a9ddf=_[_0x0482('0x3c')]({},_0x2a9ddf,_0x5cd90a[_0x0482('0x40')]);return _0x35f400[_0x0482('0xff')](_0x2a9ddf);}})[_0x0482('0x11')](function(_0x103863){if(_0x103863){_0x2c059c=_0x103863[_0x0482('0x58')];if(!_0x5cd90a[_0x0482('0x32')][_0x0482('0x38')](_0x0482('0x39'))){_0x2a9ddf[_0x0482('0x1f')]=qs[_0x0482('0x1f')](_0x5cd90a[_0x0482('0x32')][_0x0482('0x1f')]);_0x2a9ddf[_0x0482('0x20')]=qs['offset'](_0x5cd90a['query']['offset']);}return _0x35f400[_0x0482('0xff')](_0x2a9ddf);}})['then'](function(_0x133e46){if(_0x133e46){return _0x133e46?{'count':_0x2c059c,'rows':_0x133e46}:null;}})[_0x0482('0x11')](respondWithResult(_0x13458a,null))[_0x0482('0x1b')](handleError(_0x13458a,null));};exports[_0x0482('0x11b')]=function(_0x16a7f2,_0x3070db){var _0xa31349=_0x16a7f2[_0x0482('0x32')][_0x0482('0x11c')]===_0x0482('0x11d')?'offlineForm':_0x0482('0x11e');return db[_0x0482('0x2d')][_0x0482('0x47')]({'attributes':['id',_0xa31349],'where':{'id':_0x16a7f2[_0x0482('0x52')]['id']}})['then'](handleEntityNotFound(_0x3070db,null))[_0x0482('0x11')](function(_0x5d0657){if(_0x5d0657){var _0x26501e=_0x5d0657[_0xa31349];var _0x3d83c9=_0x26501e&&_0x26501e[_0x0482('0x11f')]?_0x26501e[_0x0482('0x11f')]:[];_0x3070db[_0x0482('0x29')]({'fromKey':_['isNil'](_0x26501e[_0x0482('0x120')])?undefined:_0x26501e[_0x0482('0x120')],'count':_0x3d83c9[_0x0482('0x58')],'rows':_0x3d83c9});}})[_0x0482('0x1b')](handleError(_0x3070db,null));};exports[_0x0482('0x121')]=function(_0x55c882,_0x549211){var _0x76091={'raw':![],'where':{}};var _0xf1595e={};var _0x118c79={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x55c882[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x549211,null))[_0x0482('0x11')](function(_0x3b933c){if(_0x3b933c){_0xf1595e[_0x0482('0x31')]=_['keys'](db[_0x0482('0xcb')]['rawAttributes']);_0xf1595e[_0x0482('0x32')]=_['keys'](_0x55c882[_0x0482('0x32')]);_0xf1595e['filters']=_[_0x0482('0x35')](_0xf1595e[_0x0482('0x31')],_0xf1595e[_0x0482('0x32')]);_0x76091[_0x0482('0x37')]=_[_0x0482('0x35')](_0xf1595e[_0x0482('0x31')],qs[_0x0482('0x36')](_0x55c882[_0x0482('0x32')][_0x0482('0x36')]));_0x76091[_0x0482('0x37')]=_0x76091[_0x0482('0x37')][_0x0482('0x58')]?_0x76091[_0x0482('0x37')]:_0xf1595e[_0x0482('0x31')];if(!_0x55c882['query']['hasOwnProperty'](_0x0482('0x39'))){_0x76091['limit']=qs[_0x0482('0x1f')](_0x55c882[_0x0482('0x32')][_0x0482('0x1f')]);_0x76091[_0x0482('0x20')]=qs[_0x0482('0x20')](_0x55c882[_0x0482('0x32')][_0x0482('0x20')]);}_0x76091[_0x0482('0x3a')]=qs[_0x0482('0x3b')](_0x55c882[_0x0482('0x32')][_0x0482('0x3b')]);_0x76091[_0x0482('0x3d')]=qs['filters'](_[_0x0482('0x59')](_0x55c882[_0x0482('0x32')],_0xf1595e[_0x0482('0x34')]));_0x76091[_0x0482('0x3d')][_0x0482('0x55')]=_0x3b933c['id'];if(_0x55c882[_0x0482('0x32')][_0x0482('0x3f')]){_0x76091[_0x0482('0x3d')]=_['merge'](_0x76091['where'],{'$or':_['map'](_0x76091[_0x0482('0x37')],function(_0x3e5cfe){var _0x38303b={};_0x38303b[_0x3e5cfe]={'$like':'%'+_0x55c882[_0x0482('0x32')][_0x0482('0x3f')]+'%'};return _0x38303b;})});}_0x76091=_[_0x0482('0x3c')]({},_0x76091,_0x55c882[_0x0482('0x40')]);return db[_0x0482('0xcb')]['count']({'where':_0x76091[_0x0482('0x3d')]})[_0x0482('0x11')](function(_0x64b8e9){_0x118c79[_0x0482('0x21')]=_0x64b8e9;if(_0x55c882[_0x0482('0x32')][_0x0482('0x41')]){_0x76091[_0x0482('0x42')]=[{'all':!![]}];}else{_0x76091[_0x0482('0x42')]=[{'model':db[_0x0482('0x80')],'as':_0x0482('0xeb'),'required':![]},{'model':db['Attachment'],'as':_0x0482('0x122'),'required':![]}];}return db[_0x0482('0xcb')][_0x0482('0x43')](_0x76091);})[_0x0482('0x11')](function(_0x1c4930){_0x118c79['rows']=_0x1c4930;return _0x118c79;});}})[_0x0482('0x11')](respondWithFilteredResult(_0x549211,_0x76091))[_0x0482('0x1b')](handleError(_0x549211,null));};exports[_0x0482('0x123')]=function(_0x5254a2,_0x4008d5){return db[_0x0482('0x2d')]['find']({'where':{'id':_0x5254a2[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x4008d5,null))[_0x0482('0x11')](function(_0x5021e8){if(_0x5021e8){return _0x5021e8['addAgents'](_0x5254a2[_0x0482('0x51')][_0x0482('0x5c')],_[_0x0482('0xe9')](_0x5254a2[_0x0482('0x51')],[_0x0482('0x5c'),'id'])||{})['spread'](function(_0xaabc25){for(var _0x50db73=0x0;_0x50db73<_0x5254a2[_0x0482('0x51')][_0x0482('0x5c')]['length'];_0x50db73+=0x1){socket['emit'](_0x0482('0x124'),{'UserId':Number(_0x5254a2[_0x0482('0x51')]['ids'][_0x50db73]),'ChatWebsiteId':Number(_0x5254a2[_0x0482('0x52')]['id'])});}return _0xaabc25;});}})[_0x0482('0x11')](respondWithResult(_0x4008d5,null))[_0x0482('0x1b')](handleError(_0x4008d5,null));};exports[_0x0482('0x125')]=function(_0x10c767,_0x3f0052){return db['ChatWebsite']['find']({'where':{'id':_0x10c767[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x3f0052,null))[_0x0482('0x11')](function(_0x3280d4){if(_0x3280d4){return _0x3280d4['removeAgents'](_0x10c767[_0x0482('0x32')][_0x0482('0x5c')])[_0x0482('0x11')](function(){if(_['isArray'](_0x10c767['query'][_0x0482('0x5c')])){for(var _0x283d6d=0x0;_0x283d6d<_0x10c767['query']['ids'][_0x0482('0x58')];_0x283d6d+=0x1){socket[_0x0482('0x126')](_0x0482('0x127'),{'UserId':Number(_0x10c767[_0x0482('0x32')]['ids'][_0x283d6d]),'ChatWebsiteId':Number(_0x10c767[_0x0482('0x52')]['id'])});}}else{socket[_0x0482('0x126')]('userChatWebsite:remove',{'UserId':Number(_0x10c767[_0x0482('0x32')][_0x0482('0x5c')]),'ChatWebsiteId':Number(_0x10c767[_0x0482('0x52')]['id'])});}});}})[_0x0482('0x11')](respondWithStatusCode(_0x3f0052,null))[_0x0482('0x1b')](handleError(_0x3f0052,null));};exports[_0x0482('0x128')]=function(_0x128125,_0x2dc4ae){var _0x3cb7d5={};var _0x4650de={};var _0x38b4dc;var _0x58a2eb;return db[_0x0482('0x2d')][_0x0482('0x57')]({'where':{'id':_0x128125[_0x0482('0x52')]['id']}})[_0x0482('0x11')](handleEntityNotFound(_0x2dc4ae,null))[_0x0482('0x11')](function(_0x153b4d){if(_0x153b4d){_0x38b4dc=_0x153b4d;_0x4650de[_0x0482('0x31')]=_[_0x0482('0x33')](db[_0x0482('0xec')][_0x0482('0x46')]);_0x4650de['query']=_[_0x0482('0x33')](_0x128125[_0x0482('0x32')]);_0x4650de[_0x0482('0x34')]=_[_0x0482('0x35')](_0x4650de['model'],_0x4650de[_0x0482('0x32')]);_0x3cb7d5[_0x0482('0x37')]=_[_0x0482('0x35')](_0x4650de['model'],qs[_0x0482('0x36')](_0x128125['query']['fields']));_0x3cb7d5[_0x0482('0x37')]=_0x3cb7d5[_0x0482('0x37')][_0x0482('0x58')]?_0x3cb7d5[_0x0482('0x37')]:_0x4650de['model'];_0x3cb7d5[_0x0482('0x3a')]=qs[_0x0482('0x3b')](_0x128125['query'][_0x0482('0x3b')]);_0x3cb7d5['where']=qs[_0x0482('0x34')](_[_0x0482('0x59')](_0x128125[_0x0482('0x32')],_0x4650de[_0x0482('0x34')]));if(_0x128125[_0x0482('0x32')][_0x0482('0x3f')]){_0x3cb7d5['where']=_['merge'](_0x3cb7d5[_0x0482('0x3d')],{'$or':_[_0x0482('0x2c')](_0x3cb7d5[_0x0482('0x37')],function(_0x6a6722){var _0x22e6fc={};_0x22e6fc[_0x6a6722]={'$like':'%'+_0x128125['query'][_0x0482('0x3f')]+'%'};return _0x22e6fc;})});}_0x3cb7d5=_['merge']({},_0x3cb7d5,_0x128125[_0x0482('0x40')]);return _0x38b4dc[_0x0482('0x128')](_0x3cb7d5);}})[_0x0482('0x11')](function(_0x428c40){if(_0x428c40){_0x58a2eb=_0x428c40['length'];if(!_0x128125[_0x0482('0x32')]['hasOwnProperty'](_0x0482('0x39'))){_0x3cb7d5[_0x0482('0x1f')]=qs[_0x0482('0x1f')](_0x128125[_0x0482('0x32')][_0x0482('0x1f')]);_0x3cb7d5['offset']=qs['offset'](_0x128125[_0x0482('0x32')][_0x0482('0x20')]);}return _0x38b4dc['getAgents'](_0x3cb7d5);}})[_0x0482('0x11')](function(_0x289eb0){if(_0x289eb0){return _0x289eb0?{'count':_0x58a2eb,'rows':_0x289eb0}:null;}})['then'](respondWithResult(_0x2dc4ae,null))[_0x0482('0x1b')](handleError(_0x2dc4ae,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 88f55cd..a98005b 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 _0xadb8=['ChatWebsite','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x135d26,_0x1ec1af){var _0x4de92a=function(_0x4ecc92){while(--_0x4ecc92){_0x135d26['push'](_0x135d26['shift']());}};_0x4de92a(++_0x1ec1af);}(_0xadb8,0x1d0));var _0x8adb=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xadb8[_0x198446];return _0x38d7b7;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x8adb('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8adb('0x1'),'afterUpdate':_0x8adb('0x2'),'afterDestroy':_0x8adb('0x3')};function emitEvent(_0x1bf88c){return function(_0x44fdf7,_0x2baedb,_0x42a86f){ChatWebsiteEvents['emit'](_0x1bf88c+':'+_0x44fdf7['id'],_0x44fdf7);ChatWebsiteEvents[_0x8adb('0x4')](_0x1bf88c,_0x44fdf7);_0x42a86f(null);};}for(var e in events){if(events[_0x8adb('0x5')](e)){var event=events[e];ChatWebsite[_0x8adb('0x6')](e,emitEvent(event));}}module[_0x8adb('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xd846=['../../mysqldb','ChatWebsite','update','emit','hook','exports','events'];(function(_0x5591df,_0x98bf25){var _0x3b4fc6=function(_0x40db3d){while(--_0x40db3d){_0x5591df['push'](_0x5591df['shift']());}};_0x3b4fc6(++_0x98bf25);}(_0xd846,0x195));var _0x6d84=function(_0x3f9dcc,_0x156e11){_0x3f9dcc=_0x3f9dcc-0x0;var _0x44257c=_0xd846[_0x3f9dcc];return _0x44257c;};'use strict';var EventEmitter=require(_0x6d84('0x0'));var ChatWebsite=require(_0x6d84('0x1'))['db'][_0x6d84('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6d84('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47e90f){return function(_0x15fb0c,_0xa19796,_0x5c2176){ChatWebsiteEvents[_0x6d84('0x4')](_0x47e90f+':'+_0x15fb0c['id'],_0x15fb0c);ChatWebsiteEvents['emit'](_0x47e90f,_0x15fb0c);_0x5c2176(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x6d84('0x5')](e,emitEvent(event));}}module[_0x6d84('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index b03fa5f..ea85c98 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 _0x7a14=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x3329c1,_0x1e5cd3){var _0x326cd0=function(_0x1e218e){while(--_0x1e218e){_0x3329c1['push'](_0x3329c1['shift']());}};_0x326cd0(++_0x1e5cd3);}(_0x7a14,0x1e3));var _0x47a1=function(_0x5b35ab,_0x184a2f){_0x5b35ab=_0x5b35ab-0x0;var _0x35e5a4=_0x7a14[_0x5b35ab];return _0x35e5a4;};'use strict';var _=require(_0x47a1('0x0'));var util=require(_0x47a1('0x1'));var logger=require(_0x47a1('0x2'))(_0x47a1('0x3'));var moment=require('moment');var BPromise=require(_0x47a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a1('0x5'));var rimraf=require(_0x47a1('0x6'));var config=require(_0x47a1('0x7'));var attributes=require(_0x47a1('0x8'));module[_0x47a1('0x9')]=function(_0x1d6d3b,_0x20f725){return _0x1d6d3b[_0x47a1('0xa')](_0x47a1('0xb'),attributes,{'tableName':_0x47a1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5672=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites'];(function(_0x54ca9c,_0x22a3ee){var _0x321e68=function(_0x54b713){while(--_0x54b713){_0x54ca9c['push'](_0x54ca9c['shift']());}};_0x321e68(++_0x22a3ee);}(_0x5672,0x138));var _0x2567=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x5672[_0x5d6e30];return _0x3d3f3b;};'use strict';var _=require(_0x2567('0x0'));var util=require(_0x2567('0x1'));var logger=require(_0x2567('0x2'))(_0x2567('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2567('0x4'));var fs=require('fs');var path=require(_0x2567('0x5'));var rimraf=require(_0x2567('0x6'));var config=require(_0x2567('0x7'));var attributes=require(_0x2567('0x8'));module['exports']=function(_0x5df5e2,_0x4c0423){return _0x5df5e2[_0x2567('0x9')](_0x2567('0xa'),attributes,{'tableName':_0x2567('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0f06c14..74206b9 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 _0xea3a=['rpc','../../config/environment','client','http','defaults','localhost','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x204434,_0x418c7a){var _0x49a67a=function(_0x451e82){while(--_0x451e82){_0x204434['push'](_0x204434['shift']());}};_0x49a67a(++_0x418c7a);}(_0xea3a,0xda));var _0xaea3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xea3a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xaea3('0x0'));var util=require('util');var moment=require(_0xaea3('0x1'));var BPromise=require(_0xaea3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea3('0x3'));var db=require(_0xaea3('0x4'))['db'];var utils=require(_0xaea3('0x5'));var logger=require(_0xaea3('0x6'))(_0xaea3('0x7'));var config=require(_0xaea3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaea3('0x9')][_0xaea3('0xa')]({'port':0x232a});config['redis']=_[_0xaea3('0xb')](config['redis'],{'host':_0xaea3('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0xacf20,_0x41ae12,_0x5478ee){return new BPromise(function(_0x10e3e9,_0x5ae89a){return client[_0xaea3('0xd')](_0xacf20,_0x5478ee)[_0xaea3('0xe')](function(_0x3dfe8b){logger[_0xaea3('0xf')](_0xaea3('0x10'),_0x41ae12,_0xaea3('0x11'));logger[_0xaea3('0x12')](_0xaea3('0x13'),_0x41ae12,_0xaea3('0x11'),JSON['stringify'](_0x3dfe8b));if(_0x3dfe8b[_0xaea3('0x14')]){if(_0x3dfe8b[_0xaea3('0x14')][_0xaea3('0x15')]===0x1f4){logger[_0xaea3('0x14')](_0xaea3('0x10'),_0x41ae12,_0x3dfe8b['error'][_0xaea3('0x16')]);return _0x5ae89a(_0x3dfe8b[_0xaea3('0x14')][_0xaea3('0x16')]);}logger['error'](_0xaea3('0x10'),_0x41ae12,_0x3dfe8b[_0xaea3('0x14')][_0xaea3('0x16')]);return _0x10e3e9(_0x3dfe8b['error'][_0xaea3('0x16')]);}else{logger[_0xaea3('0xf')](_0xaea3('0x10'),_0x41ae12,_0xaea3('0x11'));_0x10e3e9(_0x3dfe8b[_0xaea3('0x17')][_0xaea3('0x16')]);}})[_0xaea3('0x18')](function(_0xb4c4cb){logger[_0xaea3('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x41ae12,_0xb4c4cb);_0x5ae89a(_0xb4c4cb);});});} \ No newline at end of file +var _0x4818=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','request\x20sent','stringify','error','message','ChatWebsite,\x20%s,\x20%s','info','result','catch','util','moment','bluebird','randomstring'];(function(_0x232c55,_0xf4bd02){var _0x19dc5c=function(_0x417ffb){while(--_0x417ffb){_0x232c55['push'](_0x232c55['shift']());}};_0x19dc5c(++_0xf4bd02);}(_0x4818,0xf6));var _0x8481=function(_0x4f3a55,_0x23ee08){_0x4f3a55=_0x4f3a55-0x0;var _0x54453f=_0x4818[_0x4f3a55];return _0x54453f;};'use strict';var _=require('lodash');var util=require(_0x8481('0x0'));var moment=require(_0x8481('0x1'));var BPromise=require(_0x8481('0x2'));var rs=require(_0x8481('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8481('0x4'));var logger=require(_0x8481('0x5'))(_0x8481('0x6'));var config=require(_0x8481('0x7'));var jayson=require(_0x8481('0x8'));var client=jayson[_0x8481('0x9')]['http']({'port':0x232a});config[_0x8481('0xa')]=_[_0x8481('0xb')](config[_0x8481('0xa')],{'host':_0x8481('0xc'),'port':0x18eb});var socket=require(_0x8481('0xd'))(new Redis(config[_0x8481('0xa')]));require(_0x8481('0xe'))['register'](socket);function respondWithRpcPromise(_0x21d39b,_0x4a674b,_0x478f25){return new BPromise(function(_0x711e02,_0xc5cfb9){return client[_0x8481('0xf')](_0x21d39b,_0x478f25)[_0x8481('0x10')](function(_0x34faf3){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x4a674b,_0x8481('0x11'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4a674b,_0x8481('0x11'),JSON[_0x8481('0x12')](_0x34faf3));if(_0x34faf3[_0x8481('0x13')]){if(_0x34faf3[_0x8481('0x13')]['code']===0x1f4){logger[_0x8481('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4a674b,_0x34faf3[_0x8481('0x13')][_0x8481('0x14')]);return _0xc5cfb9(_0x34faf3[_0x8481('0x13')][_0x8481('0x14')]);}logger[_0x8481('0x13')](_0x8481('0x15'),_0x4a674b,_0x34faf3[_0x8481('0x13')][_0x8481('0x14')]);return _0x711e02(_0x34faf3[_0x8481('0x13')][_0x8481('0x14')]);}else{logger[_0x8481('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x4a674b,_0x8481('0x11'));_0x711e02(_0x34faf3[_0x8481('0x17')]['message']);}})[_0x8481('0x18')](function(_0x240504){logger[_0x8481('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4a674b,_0x240504);_0xc5cfb9(_0x240504);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c5e3072..b4ffe95 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 _0x1d47=['emit','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d47,0x130));var _0x71d4=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1d47[_0x580576];return _0x3f55a0;};'use strict';var ChatWebsiteEvents=require(_0x71d4('0x0'));var events=[_0x71d4('0x1'),_0x71d4('0x2'),_0x71d4('0x3')];function createListener(_0x1b03e4,_0x174d55){return function(_0x18c8d8){_0x174d55[_0x71d4('0x4')](_0x1b03e4,_0x18c8d8);};}function removeListener(_0x2446f9,_0xdc9caf){return function(){ChatWebsiteEvents['removeListener'](_0x2446f9,_0xdc9caf);};}exports['register']=function(_0x55ef17){for(var _0x155cfe=0x0,_0x18b6ee=events[_0x71d4('0x5')];_0x155cfe<_0x18b6ee;_0x155cfe++){var _0x339d37=events[_0x155cfe];var _0x2c1d61=createListener(_0x71d4('0x6')+_0x339d37,_0x55ef17);ChatWebsiteEvents['on'](_0x339d37,_0x2c1d61);}}; \ No newline at end of file +var _0xe9a3=['chatWebsite:','./chatWebsite.events','save','remove','emit','removeListener','register','length'];(function(_0x1f7996,_0x299a14){var _0x584609=function(_0x14c34a){while(--_0x14c34a){_0x1f7996['push'](_0x1f7996['shift']());}};_0x584609(++_0x299a14);}(_0xe9a3,0x161));var _0x3e9a=function(_0x18bb3c,_0xd55229){_0x18bb3c=_0x18bb3c-0x0;var _0x2e7e9a=_0xe9a3[_0x18bb3c];return _0x2e7e9a;};'use strict';var ChatWebsiteEvents=require(_0x3e9a('0x0'));var events=[_0x3e9a('0x1'),_0x3e9a('0x2'),'update'];function createListener(_0x19f281,_0x51d274){return function(_0x26b77b){_0x51d274[_0x3e9a('0x3')](_0x19f281,_0x26b77b);};}function removeListener(_0x7adca,_0x56e958){return function(){ChatWebsiteEvents[_0x3e9a('0x4')](_0x7adca,_0x56e958);};}exports[_0x3e9a('0x5')]=function(_0x599f4a){for(var _0x295e5e=0x0,_0x3236a1=events[_0x3e9a('0x6')];_0x295e5e<_0x3236a1;_0x295e5e++){var _0x47c3ba=events[_0x295e5e];var _0x1925e4=createListener(_0x3e9a('0x7')+_0x47c3ba,_0x599f4a);ChatWebsiteEvents['on'](_0x47c3ba,_0x1925e4);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 8cafa22..3c38a8b 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 _0x7704=['originalname','file','addLogo','single','addAvatar','server/files/images/avatars/','now','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7704,0x178));var _0x4770=function(_0x54d6ff,_0x3c5aa9){_0x54d6ff=_0x54d6ff-0x0;var _0x169279=_0x7704[_0x54d6ff];return _0x169279;};'use strict';var multer=require(_0x4770('0x0'));var util=require(_0x4770('0x1'));var path=require(_0x4770('0x2'));var timeout=require(_0x4770('0x3'));var express=require(_0x4770('0x4'));var router=express[_0x4770('0x5')]();var fs_extra=require(_0x4770('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4770('0x7'));var config=require(_0x4770('0x8'));var controller=require(_0x4770('0x9'));router[_0x4770('0xa')]('/',auth[_0x4770('0xb')](),controller[_0x4770('0xc')]);router['get'](_0x4770('0xd'),auth[_0x4770('0xb')](),controller['describe']);router[_0x4770('0xa')](_0x4770('0xe'),auth[_0x4770('0xb')](),controller[_0x4770('0xf')]);router[_0x4770('0xa')]('/:id/dispositions',auth[_0x4770('0xb')](),controller['getDispositions']);router[_0x4770('0xa')](_0x4770('0x10'),auth[_0x4770('0xb')](),controller[_0x4770('0x11')]);router['get'](_0x4770('0x12'),controller['getLogo']);router[_0x4770('0xa')](_0x4770('0x13'),controller[_0x4770('0x14')]);router[_0x4770('0xa')](_0x4770('0x15'),controller[_0x4770('0x16')]);router[_0x4770('0xa')](_0x4770('0x17'),controller['getSystemAvatar']);router[_0x4770('0xa')](_0x4770('0x18'),auth[_0x4770('0xb')](),controller[_0x4770('0x19')]);router['get']('/:id/snippet',controller[_0x4770('0x1a')]);router[_0x4770('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0x4770('0x1b')]);router[_0x4770('0xa')](_0x4770('0x1c'),auth[_0x4770('0xb')](),controller[_0x4770('0x1d')]);router[_0x4770('0xa')](_0x4770('0x1e'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x4770('0xb')](),controller['getOfflineMessages']);router[_0x4770('0xa')](_0x4770('0x1f'),auth[_0x4770('0xb')](),controller[_0x4770('0x20')]);router[_0x4770('0x21')]('/',auth[_0x4770('0xb')](),controller[_0x4770('0x22')]);router[_0x4770('0x21')](_0x4770('0x23'),auth[_0x4770('0xb')](),controller[_0x4770('0x24')]);router[_0x4770('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4770('0x25')]);var upload=multer({'storage':multer[_0x4770('0x26')]({'destination':function(_0x41a2fd,_0x195480,_0x6b08d4){_0x6b08d4(null,path[_0x4770('0x27')](config[_0x4770('0x28')],_0x4770('0x29')));},'filename':function(_0x4cb305,_0x122219,_0x230bef){_0x230bef(null,util[_0x4770('0x2a')](_0x4770('0x2b'),Date['now'](),_0x122219[_0x4770('0x2c')]));}})});router['post']('/:id/logo',upload['single'](_0x4770('0x2d')),controller[_0x4770('0x2e')]);var upload=multer({'storage':multer[_0x4770('0x26')]({'destination':function(_0x1d0503,_0x2ffc32,_0x507e7a){_0x507e7a(null,path['join'](config[_0x4770('0x28')],'server/files/images/avatars/'));},'filename':function(_0x2fee4f,_0x54e54b,_0xae91d7){_0xae91d7(null,util['format'](_0x4770('0x2b'),Date['now'](),_0x54e54b[_0x4770('0x2c')]));}})});router[_0x4770('0x21')](_0x4770('0x13'),upload[_0x4770('0x2f')]('file'),controller[_0x4770('0x30')]);var upload=multer({'storage':multer[_0x4770('0x26')]({'destination':function(_0x2df6ea,_0x2fff1c,_0x24b3be){_0x24b3be(null,path['join'](config['root'],_0x4770('0x31')));},'filename':function(_0x108f5a,_0x59e1b9,_0x8ca296){_0x8ca296(null,util[_0x4770('0x2a')](_0x4770('0x2b'),Date[_0x4770('0x32')](),_0x59e1b9[_0x4770('0x2c')]));}})});router[_0x4770('0x21')](_0x4770('0x15'),upload[_0x4770('0x2f')](_0x4770('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x4770('0x26')]({'destination':function(_0x50d8ff,_0x3b40b3,_0x2677e8){_0x2677e8(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x290ff2,_0x375a74,_0x35757b){_0x35757b(null,util[_0x4770('0x2a')](_0x4770('0x2b'),Date['now'](),_0x375a74[_0x4770('0x2c')]));}})});router['post']('/:id/system_avatar',upload[_0x4770('0x2f')](_0x4770('0x2d')),controller[_0x4770('0x33')]);router['post'](_0x4770('0x34'),controller[_0x4770('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x3dc75f,_0xbca1aa,_0x4fdff5){const _0xbb082e=path[_0x4770('0x27')](config[_0x4770('0x28')],_0x4770('0x36'),_0x4770('0x37'),_0x4770('0x38'));fs_extra['ensureDir'](_0xbb082e,function(){_0x4fdff5(null,_0xbb082e);});},'filename':function(_0x578ccb,_0x28fedf,_0x159a29){const _0x5ebfed=_0x28fedf[_0x4770('0x2c')][_0x4770('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x448254=path['extname'](_0x5ebfed);const _0x497b35=Date[_0x4770('0x32')]()+'-'+_0x5ebfed[_0x4770('0x39')](_0x448254,'')+_0x448254;_0x159a29(null,_0x497b35);}})});router[_0x4770('0x21')](_0x4770('0x3a'),offlineUploadMulter[_0x4770('0x3b')](),controller['offline']);router[_0x4770('0x21')]('/:id/interactions',auth[_0x4770('0xb')](),controller[_0x4770('0x3c')]);router[_0x4770('0x21')]('/:id/applications',auth[_0x4770('0xb')](),controller[_0x4770('0x3d')]);router[_0x4770('0x21')](_0x4770('0x1c'),auth['isAuthenticated'](),controller[_0x4770('0x3e')]);router['post'](_0x4770('0x1f'),auth['isAuthenticated'](),controller['addAgents']);router[_0x4770('0x3f')](_0x4770('0xe'),auth['isAuthenticated'](),controller[_0x4770('0x40')]);router['delete']('/:id',auth[_0x4770('0xb')](),controller[_0x4770('0x41')]);router[_0x4770('0x42')]('/:id/dispositions',auth[_0x4770('0xb')](),controller['removeDispositions']);router[_0x4770('0x42')]('/:id/canned_answers',auth[_0x4770('0xb')](),controller[_0x4770('0x43')]);router[_0x4770('0x42')](_0x4770('0x1f'),auth['isAuthenticated'](),controller[_0x4770('0x44')]);module[_0x4770('0x45')]=router; \ No newline at end of file +var _0x3c1f=['../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','/:id/system_avatar','getInteractions','getSnippet','/:id/applications','getFields','/:id/offline_messages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','file','addLogo','server/files/images/avatars/','now','originalname','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addApplications','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','update','/:id','delete','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/auth/service'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3c1f,0x106));var _0xf3c1=function(_0x3322e0,_0x4413c9){_0x3322e0=_0x3322e0-0x0;var _0x57444b=_0x3c1f[_0x3322e0];return _0x57444b;};'use strict';var multer=require(_0xf3c1('0x0'));var util=require(_0xf3c1('0x1'));var path=require(_0xf3c1('0x2'));var timeout=require('connect-timeout');var express=require(_0xf3c1('0x3'));var router=express[_0xf3c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf3c1('0x5'));var interaction=require(_0xf3c1('0x6'));var config=require('../../config/environment');var controller=require(_0xf3c1('0x7'));router[_0xf3c1('0x8')]('/',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xa')]);router[_0xf3c1('0x8')](_0xf3c1('0xb'),auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xc')]);router[_0xf3c1('0x8')]('/:id',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xd')]);router[_0xf3c1('0x8')](_0xf3c1('0xe'),auth['isAuthenticated'](),controller[_0xf3c1('0xf')]);router['get'](_0xf3c1('0x10'),auth['isAuthenticated'](),controller[_0xf3c1('0x11')]);router[_0xf3c1('0x8')](_0xf3c1('0x12'),controller['getLogo']);router[_0xf3c1('0x8')](_0xf3c1('0x13'),controller['getAvatar']);router[_0xf3c1('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xf3c1('0x8')](_0xf3c1('0x14'),controller['getSystemAvatar']);router[_0xf3c1('0x8')]('/:id/interactions',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x15')]);router['get']('/:id/snippet',controller[_0xf3c1('0x16')]);router[_0xf3c1('0x8')](_0xf3c1('0x17'),auth[_0xf3c1('0x9')](),controller['getApplications']);router[_0xf3c1('0x8')]('/:id/proactive_actions',auth[_0xf3c1('0x9')](),controller['getProactiveActions']);router[_0xf3c1('0x8')]('/:id/fields',controller[_0xf3c1('0x18')]);router['get'](_0xf3c1('0x19'),auth[_0xf3c1('0x9')](),controller['getOfflineMessages']);router[_0xf3c1('0x8')]('/:id/users',auth[_0xf3c1('0x9')](),controller['getAgents']);router[_0xf3c1('0x1a')]('/',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x1b')]);router[_0xf3c1('0x1a')](_0xf3c1('0xe'),auth[_0xf3c1('0x9')](),controller['addDisposition']);router[_0xf3c1('0x1a')](_0xf3c1('0x10'),auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x1c')]);var upload=multer({'storage':multer[_0xf3c1('0x1d')]({'destination':function(_0x8e83eb,_0x5be282,_0x5c59a3){_0x5c59a3(null,path[_0xf3c1('0x1e')](config[_0xf3c1('0x1f')],_0xf3c1('0x20')));},'filename':function(_0x1ce1c4,_0x5c22f6,_0x5c236e){_0x5c236e(null,util[_0xf3c1('0x21')](_0xf3c1('0x22'),Date['now'](),_0x5c22f6['originalname']));}})});router[_0xf3c1('0x1a')](_0xf3c1('0x12'),upload['single'](_0xf3c1('0x23')),controller[_0xf3c1('0x24')]);var upload=multer({'storage':multer[_0xf3c1('0x1d')]({'destination':function(_0x6ab59d,_0x2be0f9,_0x2c927e){_0x2c927e(null,path[_0xf3c1('0x1e')](config[_0xf3c1('0x1f')],_0xf3c1('0x25')));},'filename':function(_0x335c5f,_0x460cfa,_0x24ce81){_0x24ce81(null,util['format'](_0xf3c1('0x22'),Date[_0xf3c1('0x26')](),_0x460cfa[_0xf3c1('0x27')]));}})});router['post'](_0xf3c1('0x13'),upload[_0xf3c1('0x28')](_0xf3c1('0x23')),controller[_0xf3c1('0x29')]);var upload=multer({'storage':multer[_0xf3c1('0x1d')]({'destination':function(_0x229549,_0x31331e,_0x39395e){_0x39395e(null,path[_0xf3c1('0x1e')](config[_0xf3c1('0x1f')],'server/files/images/avatars/'));},'filename':function(_0x4187af,_0x5cb136,_0x17998b){_0x17998b(null,util['format'](_0xf3c1('0x22'),Date[_0xf3c1('0x26')](),_0x5cb136[_0xf3c1('0x27')]));}})});router[_0xf3c1('0x1a')](_0xf3c1('0x2a'),upload[_0xf3c1('0x28')](_0xf3c1('0x23')),controller[_0xf3c1('0x2b')]);var upload=multer({'storage':multer[_0xf3c1('0x1d')]({'destination':function(_0x33c6f6,_0x105209,_0x127bae){_0x127bae(null,path['join'](config[_0xf3c1('0x1f')],'server/files/images/avatars/'));},'filename':function(_0x2ce184,_0x57c4a0,_0x199406){_0x199406(null,util[_0xf3c1('0x21')]('%s-%s',Date[_0xf3c1('0x26')](),_0x57c4a0[_0xf3c1('0x27')]));}})});router[_0xf3c1('0x1a')](_0xf3c1('0x14'),upload[_0xf3c1('0x28')](_0xf3c1('0x23')),controller[_0xf3c1('0x2c')]);router[_0xf3c1('0x1a')](_0xf3c1('0x2d'),controller[_0xf3c1('0x2e')]);const offlineUploadMulter=multer({'storage':multer[_0xf3c1('0x1d')]({'destination':function(_0x510824,_0x4eb900,_0xa9f446){const _0x2145fd=path[_0xf3c1('0x1e')](config[_0xf3c1('0x1f')],_0xf3c1('0x2f'),_0xf3c1('0x30'),_0xf3c1('0x31'));fs_extra[_0xf3c1('0x32')](_0x2145fd,function(){_0xa9f446(null,_0x2145fd);});},'filename':function(_0x193c33,_0x236c1d,_0x52dbf5){const _0xd829f9=_0x236c1d['originalname'][_0xf3c1('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x20ed95=path[_0xf3c1('0x34')](_0xd829f9);const _0x192bff=Date[_0xf3c1('0x26')]()+'-'+_0xd829f9[_0xf3c1('0x33')](_0x20ed95,'')+_0x20ed95;_0x52dbf5(null,_0x192bff);}})});router['post'](_0xf3c1('0x35'),offlineUploadMulter[_0xf3c1('0x36')](),controller[_0xf3c1('0x37')]);router[_0xf3c1('0x1a')](_0xf3c1('0x38'),auth[_0xf3c1('0x9')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x39')]);router[_0xf3c1('0x1a')](_0xf3c1('0x3a'),auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x3b')]);router[_0xf3c1('0x1a')](_0xf3c1('0x3c'),auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x3d')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf3c1('0x3e')]);router['delete'](_0xf3c1('0x3f'),auth[_0xf3c1('0x9')](),controller['destroy']);router[_0xf3c1('0x40')](_0xf3c1('0xe'),auth[_0xf3c1('0x9')](),controller['removeDispositions']);router[_0xf3c1('0x40')](_0xf3c1('0x10'),auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x41')]);router[_0xf3c1('0x40')]('/:id/users',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0x42')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 85aaca5..4082c0a 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 _0xcc87=['use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','app','get','client-side-logger','expressEndpoint','/client-logs'];(function(_0x2ab381,_0x857f3d){var _0x10bc9e=function(_0x1adbcf){while(--_0x1adbcf){_0x2ab381['push'](_0x2ab381['shift']());}};_0x10bc9e(++_0x857f3d);}(_0xcc87,0x8e));var _0x7cc8=function(_0x444da8,_0x21eaee){_0x444da8=_0x444da8-0x0;var _0x56e7b3=_0xcc87[_0x444da8];return _0x56e7b3;};var beaverLogger=require(_0x7cc8('0x0'));var express=require(_0x7cc8('0x1'));var auth=require(_0x7cc8('0x2'));var config=require(_0x7cc8('0x3'));var router=express[_0x7cc8('0x4')]();var isProduction=config[_0x7cc8('0x5')]===_0x7cc8('0x6')||![];function clientSideLogs(_0x599275,_0x2a16de,_0x965ce3){var _0x59a1dd=_0x599275[_0x7cc8('0x7')][_0x7cc8('0x8')](_0x7cc8('0x9'));if(!_0x59a1dd){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x7cc8('0xa')]({'uri':_0x7cc8('0xb'),'logger':_0x59a1dd,'enableCors':!isProduction})(_0x599275,_0x2a16de,_0x965ce3);}router[_0x7cc8('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0x7cc8('0xd')]=router; \ No newline at end of file +var _0x86da=['Router','env','production','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../config/environment'];(function(_0x54420e,_0x12b851){var _0x1feb62=function(_0x54f1aa){while(--_0x54f1aa){_0x54420e['push'](_0x54420e['shift']());}};_0x1feb62(++_0x12b851);}(_0x86da,0xce));var _0xa86d=function(_0x3af298,_0x4c2ce6){_0x3af298=_0x3af298-0x0;var _0x3ba9d9=_0x86da[_0x3af298];return _0x3ba9d9;};var beaverLogger=require('beaver-logger/server');var express=require(_0xa86d('0x0'));var auth=require('../components/auth/service');var config=require(_0xa86d('0x1'));var router=express[_0xa86d('0x2')]();var isProduction=config[_0xa86d('0x3')]===_0xa86d('0x4')||![];function clientSideLogs(_0x2c712e,_0x3259e4,_0x5cfe7a){var _0x5a3ef7=_0x2c712e[_0xa86d('0x5')][_0xa86d('0x6')]('client-side-logger');if(!_0x5a3ef7){throw new Error(_0xa86d('0x7'));}return beaverLogger[_0xa86d('0x8')]({'uri':_0xa86d('0x9'),'logger':_0x5a3ef7,'enableCors':!isProduction})(_0x2c712e,_0x3259e4,_0x5cfe7a);}router[_0xa86d('0xa')](auth[_0xa86d('0xb')](),clientSideLogs);module[_0xa86d('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e697bd3..651dada 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 _0xa63b=['sequelize','exports','STRING','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'];(function(_0x5ace39,_0x8462ed){var _0x27b947=function(_0x2dd5f4){while(--_0x2dd5f4){_0x5ace39['push'](_0x5ace39['shift']());}};_0x27b947(++_0x8462ed);}(_0xa63b,0x1b2));var _0xba63=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xa63b[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0xba63('0x0'));module[_0xba63('0x1')]={'name':{'type':Sequelize[_0xba63('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xba63('0x3'),_0xba63('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xba63('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xba63('0x2')],'comment':_0xba63('0x6')},'data2':{'type':Sequelize[_0xba63('0x2')],'comment':_0xba63('0x7')},'data3':{'type':Sequelize[_0xba63('0x2')],'comment':_0xba63('0x8')},'data4':{'type':Sequelize[_0xba63('0x2')],'comment':_0xba63('0x9')},'data5':{'type':Sequelize[_0xba63('0xa')],'comment':_0xba63('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xba63('0xc')},'data7':{'type':Sequelize[_0xba63('0xa')],'comment':_0xba63('0xd')}}; \ No newline at end of file +var _0x328b=['AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','exports','ENUM'];(function(_0x2babe9,_0xc3e8ba){var _0x462541=function(_0x1f8982){while(--_0x1f8982){_0x2babe9['push'](_0x2babe9['shift']());}};_0x462541(++_0xc3e8ba);}(_0x328b,0x1a2));var _0xb328=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x328b[_0x4e0b8c];return _0x633ecc;};'use strict';var Sequelize=require('sequelize');module[_0xb328('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xb328('0x1')](_0xb328('0x2'),_0xb328('0x3'),_0xb328('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb328('0x5'),_0xb328('0x6'))},'data1':{'type':Sequelize[_0xb328('0x7')],'comment':_0xb328('0x8')},'data2':{'type':Sequelize[_0xb328('0x7')],'comment':_0xb328('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0xb328('0xa')},'data4':{'type':Sequelize[_0xb328('0x7')],'comment':_0xb328('0xb')},'data5':{'type':Sequelize[_0xb328('0xc')],'comment':_0xb328('0xd')},'data6':{'type':Sequelize['TEXT'],'comment':_0xb328('0xe')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 4c8b945..7c640b5 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 _0x4664=['destroy','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','end','error','stack','name','send','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','MicrosoftAzure','data3','catch','params','find','service','decryptString','body','Service\x20parameter\x20not\x20specified','includes','encryptString','create'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4664,0xc9));var _0x4466=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x4664[_0x18aaaf];return _0x52d892;};'use strict';var _=require('lodash');var Redis=require(_0x4466('0x0'));var qs=require(_0x4466('0x1'));var encryptor=require(_0x4466('0x2'));var config=require(_0x4466('0x3'));var logger=require(_0x4466('0x4'))('api');var db=require(_0x4466('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x4466('0x6')]=_[_0x4466('0x7')](config[_0x4466('0x6')],{'host':_0x4466('0x8'),'port':0x18eb});var socket=require(_0x4466('0x9'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5d6961,_0x239927){_0x239927=_0x239927||0xcc;return function(_0x38f23d){if(_0x38f23d){return _0x5d6961[_0x4466('0xa')](_0x239927);}return _0x5d6961[_0x4466('0xb')](_0x239927)['end']();};}function respondWithResult(_0x59b57d,_0x369dfa){_0x369dfa=_0x369dfa||0xc8;return function(_0x49f89d){if(_0x49f89d){return _0x59b57d[_0x4466('0xb')](_0x369dfa)[_0x4466('0xc')](_0x49f89d);}};}function respondWithFilteredResult(_0x3b1085,_0x2d8e2f){return function(_0x452792){if(_0x452792){var _0x6ca7f3=typeof _0x2d8e2f[_0x4466('0xd')]==='undefined'&&typeof _0x2d8e2f[_0x4466('0xe')]==='undefined';var _0x2d8a7a=_0x452792[_0x4466('0xf')];var _0x570282=_0x6ca7f3?0x0:_0x2d8e2f[_0x4466('0xd')];var _0xbf36e7=_0x6ca7f3?_0x452792[_0x4466('0xf')]:_0x2d8e2f[_0x4466('0xd')]+_0x2d8e2f[_0x4466('0xe')];var _0xfaf45a;if(_0xbf36e7>=_0x2d8a7a){_0xbf36e7=_0x2d8a7a;_0xfaf45a=0xc8;}else{_0xfaf45a=0xce;}_0x3b1085[_0x4466('0xb')](_0xfaf45a);return _0x3b1085[_0x4466('0x10')](_0x4466('0x11'),_0x570282+'-'+_0xbf36e7+'/'+_0x2d8a7a)['json'](_0x452792);}return null;};}function saveUpdates(_0x4390ef){return function(_0x4c25a3){if(_0x4c25a3){return _0x4c25a3[_0x4466('0x12')](_0x4390ef)[_0x4466('0x13')](function(_0x564c9a){return _0x564c9a;});}return null;};}function removeEntity(_0x101be3){return function(_0x5bd1fa){if(_0x5bd1fa){return _0x5bd1fa['destroy']()[_0x4466('0x13')](function(){_0x101be3[_0x4466('0xb')](0xcc)[_0x4466('0x14')]();});}};}function handleEntityNotFound(_0x380464){return function(_0x50eba8){if(!_0x50eba8){_0x380464[_0x4466('0xa')](0x194);}return _0x50eba8;};}function handleError(_0x31df7d,_0x1a0f46){_0x1a0f46=_0x1a0f46||0x1f4;return function(_0x414891){logger[_0x4466('0x15')](_0x414891[_0x4466('0x16')]);if(_0x414891[_0x4466('0x17')]){delete _0x414891[_0x4466('0x17')];}_0x31df7d['status'](_0x1a0f46)[_0x4466('0x18')](_0x414891);};}function maskClientSecret(_0x12e617){return _['padEnd'](_0x12e617[_0x4466('0x19')](0x0,0x3),0x14,'*');}exports[_0x4466('0x1a')]=function(_0x275a51,_0x2e07f0){var _0x1501b7={},_0x1b6101={},_0x308cef={'count':0x0,'rows':[]};var _0x3ad30e=_[_0x4466('0x1b')](db[_0x4466('0x1c')][_0x4466('0x1d')],function(_0x1f5c5a){return{'name':_0x1f5c5a[_0x4466('0x1e')],'type':_0x1f5c5a[_0x4466('0x1f')][_0x4466('0x20')]};});_0x1b6101[_0x4466('0x21')]=_['map'](_0x3ad30e,_0x4466('0x17'));_0x1b6101[_0x4466('0x22')]=_[_0x4466('0x23')](_0x275a51[_0x4466('0x22')]);_0x1b6101[_0x4466('0x24')]=_[_0x4466('0x25')](_0x1b6101[_0x4466('0x21')],_0x1b6101[_0x4466('0x22')]);_0x1501b7[_0x4466('0x26')]=_[_0x4466('0x25')](_0x1b6101[_0x4466('0x21')],qs[_0x4466('0x27')](_0x275a51[_0x4466('0x22')][_0x4466('0x27')]));_0x1501b7[_0x4466('0x26')]=_0x1501b7[_0x4466('0x26')][_0x4466('0x28')]?_0x1501b7[_0x4466('0x26')]:_0x1b6101['model'];if(!_0x275a51[_0x4466('0x22')][_0x4466('0x29')](_0x4466('0x2a'))){_0x1501b7[_0x4466('0xe')]=qs[_0x4466('0xe')](_0x275a51['query']['limit']);_0x1501b7[_0x4466('0xd')]=qs['offset'](_0x275a51['query'][_0x4466('0xd')]);}_0x1501b7[_0x4466('0x2b')]=qs[_0x4466('0x2c')](_0x275a51['query'][_0x4466('0x2c')]);_0x1501b7[_0x4466('0x2d')]=qs[_0x4466('0x24')](_[_0x4466('0x2e')](_0x275a51[_0x4466('0x22')],_0x1b6101[_0x4466('0x24')]),_0x3ad30e);if(_0x275a51[_0x4466('0x22')]['filter']){_0x1501b7[_0x4466('0x2d')]=_[_0x4466('0x2f')](_0x1501b7['where'],{'$or':_[_0x4466('0x1b')](_0x3ad30e,function(_0x577059){if(_0x577059[_0x4466('0x1f')]!==_0x4466('0x30')){var _0x5f9b0a={};_0x5f9b0a[_0x577059[_0x4466('0x17')]]={'$like':'%'+_0x275a51[_0x4466('0x22')][_0x4466('0x31')]+'%'};return _0x5f9b0a;}})});}_0x1501b7=_['merge']({},_0x1501b7,_0x275a51[_0x4466('0x32')]);var _0x25a7c9={'where':_0x1501b7[_0x4466('0x2d')]};return db[_0x4466('0x1c')]['count'](_0x25a7c9)[_0x4466('0x13')](function(_0x282585){_0x308cef['count']=_0x282585;if(_0x275a51[_0x4466('0x22')][_0x4466('0x33')]){_0x1501b7[_0x4466('0x34')]=[{'all':!![]}];}return db[_0x4466('0x1c')][_0x4466('0x35')](_0x1501b7);})[_0x4466('0x13')](function(_0x175a18){_0x308cef['rows']=_['map'](_0x175a18,function(_0x572286){if(_0x572286['service']===_0x4466('0x36')){var _0x426256=encryptor['decryptString'](_0x572286['data3']);_0x572286[_0x4466('0x37')]=maskClientSecret(_0x426256);}return _0x572286;});return _0x308cef;})[_0x4466('0x13')](respondWithFilteredResult(_0x2e07f0,_0x1501b7))[_0x4466('0x38')](handleError(_0x2e07f0,null));};exports['show']=function(_0x5f37ac,_0x13bcad){var _0x2191c6={'raw':!![],'where':{'id':_0x5f37ac[_0x4466('0x39')]['id']}},_0x25d754={};_0x25d754['model']=_[_0x4466('0x23')](db[_0x4466('0x1c')]['rawAttributes']);_0x25d754['query']=_[_0x4466('0x23')](_0x5f37ac[_0x4466('0x22')]);_0x25d754['filters']=_['intersection'](_0x25d754[_0x4466('0x21')],_0x25d754['query']);_0x2191c6[_0x4466('0x26')]=_[_0x4466('0x25')](_0x25d754[_0x4466('0x21')],qs['fields'](_0x5f37ac['query']['fields']));_0x2191c6['attributes']=_0x2191c6[_0x4466('0x26')][_0x4466('0x28')]?_0x2191c6[_0x4466('0x26')]:_0x25d754[_0x4466('0x21')];if(_0x5f37ac[_0x4466('0x22')][_0x4466('0x33')]){_0x2191c6['include']=[{'all':!![]}];}_0x2191c6=_[_0x4466('0x2f')]({},_0x2191c6,_0x5f37ac['options']);return db[_0x4466('0x1c')][_0x4466('0x3a')](_0x2191c6)[_0x4466('0x13')](handleEntityNotFound(_0x13bcad,null))[_0x4466('0x13')](function(_0x570a3f){if(_0x570a3f[_0x4466('0x3b')]===_0x4466('0x36')){var _0x2b106e=encryptor[_0x4466('0x3c')](_0x570a3f[_0x4466('0x37')]);_0x570a3f[_0x4466('0x37')]=maskClientSecret(_0x2b106e);}return _0x570a3f;})['then'](respondWithResult(_0x13bcad,null))[_0x4466('0x38')](handleError(_0x13bcad,null));};exports['create']=function(_0x348f00,_0x3ef74e){if(!_0x348f00[_0x4466('0x3d')][_0x4466('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x348f00[_0x4466('0x3d')][_0x4466('0x3b')])throw new Error(_0x4466('0x3e'));var _0x2b417c=db[_0x4466('0x1c')][_0x4466('0x1d')][_0x4466('0x3b')]['values'];if(!_0x2b417c[_0x4466('0x3f')](_0x348f00[_0x4466('0x3d')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2b417c['join'](',\x20'));if(_0x348f00[_0x4466('0x3d')][_0x4466('0x3b')]===_0x4466('0x36')&&_0x348f00[_0x4466('0x3d')][_0x4466('0x37')]){_0x348f00[_0x4466('0x3d')][_0x4466('0x37')]=encryptor[_0x4466('0x40')](_0x348f00['body']['data3']);}return db[_0x4466('0x1c')][_0x4466('0x41')](_0x348f00['body'],{})[_0x4466('0x13')](respondWithResult(_0x3ef74e,0xc9))[_0x4466('0x38')](handleError(_0x3ef74e,null));};exports[_0x4466('0x12')]=function(_0x21fcb2,_0x198c8c){if(_0x21fcb2[_0x4466('0x3d')]['id']){delete _0x21fcb2['body']['id'];}return db[_0x4466('0x1c')][_0x4466('0x3a')]({'where':{'id':_0x21fcb2[_0x4466('0x39')]['id']}})[_0x4466('0x13')](handleEntityNotFound(_0x198c8c,null))[_0x4466('0x13')](function(_0x3d489a){if(_0x3d489a[_0x4466('0x3b')]===_0x4466('0x36')&&_0x21fcb2[_0x4466('0x3d')]['data3']){_0x21fcb2[_0x4466('0x3d')][_0x4466('0x37')]=encryptor['encryptString'](_0x21fcb2['body'][_0x4466('0x37')]);}return _0x3d489a;})['then'](saveUpdates(_0x21fcb2[_0x4466('0x3d')],null))['then'](respondWithResult(_0x198c8c,null))[_0x4466('0x38')](handleError(_0x198c8c,null));};exports[_0x4466('0x42')]=function(_0x593f03,_0x45f2a6){return db['CloudProvider'][_0x4466('0x3a')]({'where':{'id':_0x593f03[_0x4466('0x39')]['id']}})[_0x4466('0x13')](handleEntityNotFound(_0x45f2a6,null))['then'](removeEntity(_0x45f2a6,null))['catch'](handleError(_0x45f2a6,null));};exports[_0x4466('0x43')]=function(_0x3e53b2,_0x5dcd64){return db[_0x4466('0x1c')][_0x4466('0x44')]({'where':{'id':_0x3e53b2[_0x4466('0x39')]['id']},'raw':!![]})[_0x4466('0x13')](function(_0x502165){if(!_0x502165)return _0x5dcd64[_0x4466('0xa')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x502165,_0x3e53b2[_0x4466('0x45')]['id'])};})['then'](respondWithResult(_0x5dcd64,null))['catch'](handleError(_0x5dcd64,null));};exports[_0x4466('0x46')]=function(_0x5b1d7d,_0x41b44a){var _0xd37a34=_0x5b1d7d[_0x4466('0x3d')];var _0x310ca1;var _0x294010;if(_0xd37a34[_0x4466('0x15')])throw _0xd37a34;redis['get'](_0xd37a34[_0x4466('0x47')])[_0x4466('0x13')](function(_0x5a4b58){if(!_0x5a4b58)throw new Error(_0x4466('0x48'));_0x310ca1=JSON[_0x4466('0x49')](_0x5a4b58);var _0x3bf088=Buffer[_0x4466('0x4a')](_0xd37a34[_0x4466('0x47')],_0x4466('0x4b'))[_0x4466('0x4c')](_0x4466('0x4d'));_0x294010=JSON[_0x4466('0x49')](_0x3bf088);if(!oauth[_0x4466('0x4e')](_0xd37a34['id_token'],_0x310ca1['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0xd37a34[_0x4466('0x47')]);return oauth['getOauth2MicrosoftAccessToken'](_0xd37a34[_0x4466('0x4f')],_0x310ca1);})[_0x4466('0x13')](function(_0x20c53b){_0x310ca1[_0x4466('0x50')]=_0x20c53b['access_token'];_0x310ca1[_0x4466('0x51')]=_0x20c53b[_0x4466('0x52')];return db['CloudProvider']['update']({'data5':_0x310ca1[_0x4466('0x50')],'data6':_0x310ca1['data6']},{'where':{'id':_0x310ca1['id']}});})['then'](function(){oauth[_0x4466('0x53')](_0x310ca1);socket[_0x4466('0x54')]('microsoftAuthorization:success',{'id':_0x294010['id']});return;})[_0x4466('0x13')](respondWithStatusCode(_0x41b44a,null))[_0x4466('0x38')](function(_0xc2b227){if(_0x294010){socket[_0x4466('0x54')](_0x4466('0x55'),{'id':_0x294010['id']});}if(!_0x310ca1){logger['error'](_0x4466('0x56'),_0xc2b227);return _0x41b44a['status'](0x1f4)[_0x4466('0x18')](_0xc2b227[_0x4466('0x57')]);}logger[_0x4466('0x15')](_0x4466('0x58'),_0x310ca1['id'],JSON['stringify'](_0xc2b227));});}; \ No newline at end of file +var _0x2917=['includes','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','state','parse','from','toString','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','set','update','then','destroy','stack','name','send','padEnd','slice','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','CloudProvider','count','includeAll','include','findAll','rows','map','decryptString','data3','show','params','find','MicrosoftAzure','catch','create','body','service','Service\x20parameter\x20not\x20specified','values'];(function(_0x251116,_0x222c1f){var _0x37d879=function(_0x20d344){while(--_0x20d344){_0x251116['push'](_0x251116['shift']());}};_0x37d879(++_0x222c1f);}(_0x2917,0xd3));var _0x7291=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0x2917[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x7291('0x0'));var Redis=require('ioredis');var qs=require(_0x7291('0x1'));var encryptor=require(_0x7291('0x2'));var config=require(_0x7291('0x3'));var logger=require(_0x7291('0x4'))(_0x7291('0x5'));var db=require(_0x7291('0x6'))['db'];var oauth=require(_0x7291('0x7'));config[_0x7291('0x8')]=_[_0x7291('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7291('0xa'))(new Redis(config[_0x7291('0x8')]));var redis=new Redis(config[_0x7291('0x8')]);function respondWithStatusCode(_0x485a58,_0x43dae3){_0x43dae3=_0x43dae3||0xcc;return function(_0x19d193){if(_0x19d193){return _0x485a58[_0x7291('0xb')](_0x43dae3);}return _0x485a58[_0x7291('0xc')](_0x43dae3)[_0x7291('0xd')]();};}function respondWithResult(_0x3e8852,_0xbcda48){_0xbcda48=_0xbcda48||0xc8;return function(_0x4328cb){if(_0x4328cb){return _0x3e8852[_0x7291('0xc')](_0xbcda48)[_0x7291('0xe')](_0x4328cb);}};}function respondWithFilteredResult(_0x544e69,_0x5f41e1){return function(_0x5c7aeb){if(_0x5c7aeb){var _0x441323=typeof _0x5f41e1[_0x7291('0xf')]==='undefined'&&typeof _0x5f41e1['limit']===_0x7291('0x10');var _0xa8ae7d=_0x5c7aeb['count'];var _0x51f8f0=_0x441323?0x0:_0x5f41e1[_0x7291('0xf')];var _0x16cbac=_0x441323?_0x5c7aeb['count']:_0x5f41e1[_0x7291('0xf')]+_0x5f41e1[_0x7291('0x11')];var _0x18b63b;if(_0x16cbac>=_0xa8ae7d){_0x16cbac=_0xa8ae7d;_0x18b63b=0xc8;}else{_0x18b63b=0xce;}_0x544e69['status'](_0x18b63b);return _0x544e69[_0x7291('0x12')]('Content-Range',_0x51f8f0+'-'+_0x16cbac+'/'+_0xa8ae7d)[_0x7291('0xe')](_0x5c7aeb);}return null;};}function saveUpdates(_0x5002f2){return function(_0x3650c3){if(_0x3650c3){return _0x3650c3[_0x7291('0x13')](_0x5002f2)[_0x7291('0x14')](function(_0x182dcb){return _0x182dcb;});}return null;};}function removeEntity(_0x3e930c){return function(_0x45da28){if(_0x45da28){return _0x45da28[_0x7291('0x15')]()['then'](function(){_0x3e930c[_0x7291('0xc')](0xcc)[_0x7291('0xd')]();});}};}function handleEntityNotFound(_0x20aa59){return function(_0x462d36){if(!_0x462d36){_0x20aa59['sendStatus'](0x194);}return _0x462d36;};}function handleError(_0x18a17a,_0x5583d1){_0x5583d1=_0x5583d1||0x1f4;return function(_0xc847e1){logger['error'](_0xc847e1[_0x7291('0x16')]);if(_0xc847e1[_0x7291('0x17')]){delete _0xc847e1[_0x7291('0x17')];}_0x18a17a['status'](_0x5583d1)[_0x7291('0x18')](_0xc847e1);};}function maskClientSecret(_0x5bcd79){return _[_0x7291('0x19')](_0x5bcd79[_0x7291('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x545c38,_0x2f2fb0){var _0xcfc584={},_0x17bbdc={},_0x2f25a7={'count':0x0,'rows':[]};var _0x22bf9b=_['map'](db['CloudProvider'][_0x7291('0x1b')],function(_0x320f14){return{'name':_0x320f14[_0x7291('0x1c')],'type':_0x320f14[_0x7291('0x1d')]['key']};});_0x17bbdc[_0x7291('0x1e')]=_['map'](_0x22bf9b,'name');_0x17bbdc[_0x7291('0x1f')]=_[_0x7291('0x20')](_0x545c38['query']);_0x17bbdc[_0x7291('0x21')]=_[_0x7291('0x22')](_0x17bbdc[_0x7291('0x1e')],_0x17bbdc[_0x7291('0x1f')]);_0xcfc584[_0x7291('0x23')]=_[_0x7291('0x22')](_0x17bbdc[_0x7291('0x1e')],qs[_0x7291('0x24')](_0x545c38[_0x7291('0x1f')][_0x7291('0x24')]));_0xcfc584['attributes']=_0xcfc584[_0x7291('0x23')][_0x7291('0x25')]?_0xcfc584['attributes']:_0x17bbdc['model'];if(!_0x545c38[_0x7291('0x1f')][_0x7291('0x26')]('nolimit')){_0xcfc584[_0x7291('0x11')]=qs[_0x7291('0x11')](_0x545c38['query'][_0x7291('0x11')]);_0xcfc584[_0x7291('0xf')]=qs[_0x7291('0xf')](_0x545c38[_0x7291('0x1f')][_0x7291('0xf')]);}_0xcfc584['order']=qs[_0x7291('0x27')](_0x545c38[_0x7291('0x1f')]['sort']);_0xcfc584[_0x7291('0x28')]=qs[_0x7291('0x21')](_[_0x7291('0x29')](_0x545c38['query'],_0x17bbdc[_0x7291('0x21')]),_0x22bf9b);if(_0x545c38['query']['filter']){_0xcfc584[_0x7291('0x28')]=_[_0x7291('0x2a')](_0xcfc584[_0x7291('0x28')],{'$or':_['map'](_0x22bf9b,function(_0x93279f){if(_0x93279f[_0x7291('0x1d')]!==_0x7291('0x2b')){var _0x43b42d={};_0x43b42d[_0x93279f[_0x7291('0x17')]]={'$like':'%'+_0x545c38[_0x7291('0x1f')][_0x7291('0x2c')]+'%'};return _0x43b42d;}})});}_0xcfc584=_[_0x7291('0x2a')]({},_0xcfc584,_0x545c38[_0x7291('0x2d')]);var _0x18d334={'where':_0xcfc584[_0x7291('0x28')]};return db[_0x7291('0x2e')][_0x7291('0x2f')](_0x18d334)['then'](function(_0x2fc2cd){_0x2f25a7[_0x7291('0x2f')]=_0x2fc2cd;if(_0x545c38['query'][_0x7291('0x30')]){_0xcfc584[_0x7291('0x31')]=[{'all':!![]}];}return db['CloudProvider'][_0x7291('0x32')](_0xcfc584);})[_0x7291('0x14')](function(_0x3b7330){_0x2f25a7[_0x7291('0x33')]=_[_0x7291('0x34')](_0x3b7330,function(_0x7e7888){if(_0x7e7888['service']==='MicrosoftAzure'){var _0x3994c2=encryptor[_0x7291('0x35')](_0x7e7888['data3']);_0x7e7888[_0x7291('0x36')]=maskClientSecret(_0x3994c2);}return _0x7e7888;});return _0x2f25a7;})[_0x7291('0x14')](respondWithFilteredResult(_0x2f2fb0,_0xcfc584))['catch'](handleError(_0x2f2fb0,null));};exports[_0x7291('0x37')]=function(_0x20cdf5,_0x37fe98){var _0x9faf53={'raw':!![],'where':{'id':_0x20cdf5[_0x7291('0x38')]['id']}},_0x54f79a={};_0x54f79a[_0x7291('0x1e')]=_['keys'](db[_0x7291('0x2e')][_0x7291('0x1b')]);_0x54f79a['query']=_[_0x7291('0x20')](_0x20cdf5[_0x7291('0x1f')]);_0x54f79a['filters']=_[_0x7291('0x22')](_0x54f79a[_0x7291('0x1e')],_0x54f79a[_0x7291('0x1f')]);_0x9faf53[_0x7291('0x23')]=_[_0x7291('0x22')](_0x54f79a[_0x7291('0x1e')],qs[_0x7291('0x24')](_0x20cdf5[_0x7291('0x1f')][_0x7291('0x24')]));_0x9faf53[_0x7291('0x23')]=_0x9faf53[_0x7291('0x23')][_0x7291('0x25')]?_0x9faf53[_0x7291('0x23')]:_0x54f79a[_0x7291('0x1e')];if(_0x20cdf5['query']['includeAll']){_0x9faf53[_0x7291('0x31')]=[{'all':!![]}];}_0x9faf53=_[_0x7291('0x2a')]({},_0x9faf53,_0x20cdf5[_0x7291('0x2d')]);return db[_0x7291('0x2e')][_0x7291('0x39')](_0x9faf53)[_0x7291('0x14')](handleEntityNotFound(_0x37fe98,null))[_0x7291('0x14')](function(_0x2bc655){if(_0x2bc655['service']===_0x7291('0x3a')){var _0x259d01=encryptor[_0x7291('0x35')](_0x2bc655[_0x7291('0x36')]);_0x2bc655[_0x7291('0x36')]=maskClientSecret(_0x259d01);}return _0x2bc655;})[_0x7291('0x14')](respondWithResult(_0x37fe98,null))[_0x7291('0x3b')](handleError(_0x37fe98,null));};exports[_0x7291('0x3c')]=function(_0x7bb9e9,_0x1f2174){if(!_0x7bb9e9[_0x7291('0x3d')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x7bb9e9[_0x7291('0x3d')][_0x7291('0x3e')])throw new Error(_0x7291('0x3f'));var _0x528c0a=db[_0x7291('0x2e')][_0x7291('0x1b')][_0x7291('0x3e')][_0x7291('0x40')];if(!_0x528c0a[_0x7291('0x41')](_0x7bb9e9[_0x7291('0x3d')][_0x7291('0x3e')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x528c0a[_0x7291('0x42')](',\x20'));if(_0x7bb9e9[_0x7291('0x3d')]['service']===_0x7291('0x3a')&&_0x7bb9e9[_0x7291('0x3d')][_0x7291('0x36')]){_0x7bb9e9['body'][_0x7291('0x36')]=encryptor['encryptString'](_0x7bb9e9[_0x7291('0x3d')][_0x7291('0x36')]);}return db[_0x7291('0x2e')]['create'](_0x7bb9e9[_0x7291('0x3d')],{})[_0x7291('0x14')](respondWithResult(_0x1f2174,0xc9))[_0x7291('0x3b')](handleError(_0x1f2174,null));};exports[_0x7291('0x13')]=function(_0x1f0ca1,_0x199ac3){if(_0x1f0ca1[_0x7291('0x3d')]['id']){delete _0x1f0ca1[_0x7291('0x3d')]['id'];}return db[_0x7291('0x2e')][_0x7291('0x39')]({'where':{'id':_0x1f0ca1[_0x7291('0x38')]['id']}})[_0x7291('0x14')](handleEntityNotFound(_0x199ac3,null))[_0x7291('0x14')](function(_0x23b381){if(_0x23b381['service']===_0x7291('0x3a')&&_0x1f0ca1[_0x7291('0x3d')]['data3']){_0x1f0ca1[_0x7291('0x3d')][_0x7291('0x36')]=encryptor[_0x7291('0x43')](_0x1f0ca1[_0x7291('0x3d')][_0x7291('0x36')]);}return _0x23b381;})[_0x7291('0x14')](saveUpdates(_0x1f0ca1['body'],null))['then'](respondWithResult(_0x199ac3,null))[_0x7291('0x3b')](handleError(_0x199ac3,null));};exports[_0x7291('0x15')]=function(_0x3d5b4e,_0x387532){return db[_0x7291('0x2e')][_0x7291('0x39')]({'where':{'id':_0x3d5b4e['params']['id']}})['then'](handleEntityNotFound(_0x387532,null))['then'](removeEntity(_0x387532,null))[_0x7291('0x3b')](handleError(_0x387532,null));};exports[_0x7291('0x44')]=function(_0x3bfdf6,_0x4330a0){return db['CloudProvider']['findOne']({'where':{'id':_0x3bfdf6[_0x7291('0x38')]['id']},'raw':!![]})['then'](function(_0x3ec68f){if(!_0x3ec68f)return _0x4330a0[_0x7291('0xb')](0x194);return{'url':oauth[_0x7291('0x45')](_0x3ec68f,_0x3bfdf6['user']['id'])};})['then'](respondWithResult(_0x4330a0,null))[_0x7291('0x3b')](handleError(_0x4330a0,null));};exports[_0x7291('0x46')]=function(_0x25cc4f,_0x4bea81){var _0xeee21d=_0x25cc4f[_0x7291('0x3d')];var _0x299cf2;var _0x5e2996;if(_0xeee21d[_0x7291('0x47')])throw _0xeee21d;redis['get'](_0xeee21d[_0x7291('0x48')])[_0x7291('0x14')](function(_0x558af8){if(!_0x558af8)throw new Error('Invalid\x20state\x20parameter');_0x299cf2=JSON[_0x7291('0x49')](_0x558af8);var _0x136941=Buffer[_0x7291('0x4a')](_0xeee21d['state'],'base64')[_0x7291('0x4b')](_0x7291('0x4c'));_0x5e2996=JSON[_0x7291('0x49')](_0x136941);if(!oauth[_0x7291('0x4d')](_0xeee21d[_0x7291('0x4e')],_0x299cf2['oauth2Claims']))throw new Error(_0x7291('0x4f'));redis['del'](_0xeee21d[_0x7291('0x48')]);return oauth[_0x7291('0x50')](_0xeee21d[_0x7291('0x51')],_0x299cf2);})[_0x7291('0x14')](function(_0x571ce5){_0x299cf2[_0x7291('0x52')]=_0x571ce5[_0x7291('0x53')];_0x299cf2['data6']=_0x571ce5[_0x7291('0x54')];return db[_0x7291('0x2e')][_0x7291('0x13')]({'data5':_0x299cf2[_0x7291('0x52')],'data6':_0x299cf2[_0x7291('0x55')]},{'where':{'id':_0x299cf2['id']}});})[_0x7291('0x14')](function(){oauth['startRefreshInterval'](_0x299cf2);socket[_0x7291('0x56')](_0x7291('0x57'),{'id':_0x5e2996['id']});return;})[_0x7291('0x14')](respondWithStatusCode(_0x4bea81,null))['catch'](function(_0x165d66){if(_0x5e2996){socket[_0x7291('0x56')](_0x7291('0x58'),{'id':_0x5e2996['id']});}if(!_0x299cf2){logger['error'](_0x7291('0x59'),_0x165d66);return _0x4bea81[_0x7291('0xc')](0x1f4)[_0x7291('0x18')](_0x165d66[_0x7291('0x5a')]);}logger[_0x7291('0x47')](_0x7291('0x5b'),_0x299cf2['id'],JSON['stringify'](_0x165d66));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 72089eb..fa3aebf 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 _0xb935=['path','rimraf','./cloudProvider.attributes','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x383e05,_0x1c3e1c){var _0x5f4551=function(_0x325c0e){while(--_0x325c0e){_0x383e05['push'](_0x383e05['shift']());}};_0x5f4551(++_0x1c3e1c);}(_0xb935,0x1f4));var _0x5b93=function(_0x4fa583,_0x4bbbb4){_0x4fa583=_0x4fa583-0x0;var _0x103a4d=_0xb935[_0x4fa583];return _0x103a4d;};'use strict';var _=require(_0x5b93('0x0'));var util=require('util');var logger=require(_0x5b93('0x1'))(_0x5b93('0x2'));var moment=require(_0x5b93('0x3'));var BPromise=require(_0x5b93('0x4'));var rp=require(_0x5b93('0x5'));var fs=require('fs');var path=require(_0x5b93('0x6'));var rimraf=require(_0x5b93('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b93('0x8'));module['exports']=function(_0x5c8e42,_0x7c70de){return _0x5c8e42['define'](_0x5b93('0x9'),attributes,{'tableName':_0x5b93('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7fd=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','api','bluebird','request-promise'];(function(_0x217906,_0x3efae1){var _0x2d5d90=function(_0x1c3101){while(--_0x1c3101){_0x217906['push'](_0x217906['shift']());}};_0x2d5d90(++_0x3efae1);}(_0xb7fd,0xd3));var _0xdb7f=function(_0x5523c1,_0x434f8a){_0x5523c1=_0x5523c1-0x0;var _0x527971=_0xb7fd[_0x5523c1];return _0x527971;};'use strict';var _=require(_0xdb7f('0x0'));var util=require(_0xdb7f('0x1'));var logger=require('../../config/logger')(_0xdb7f('0x2'));var moment=require('moment');var BPromise=require(_0xdb7f('0x3'));var rp=require(_0xdb7f('0x4'));var fs=require('fs');var path=require(_0xdb7f('0x5'));var rimraf=require(_0xdb7f('0x6'));var config=require(_0xdb7f('0x7'));var attributes=require(_0xdb7f('0x8'));module[_0xdb7f('0x9')]=function(_0x127765,_0x4a0695){return _0x127765[_0xdb7f('0xa')]('CloudProvider',attributes,{'tableName':_0xdb7f('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 86db1b9..268126c 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 _0x780e=['CloudProvider','findOne','refresh_token','POST','data5','access_token','update','data6','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','push','data7','/.default','Outlook365','Dynamics365','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','client_id','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','oauth2Claims','replace','oauth2/','data1','decode','payload','issuer','aud','audience','unix','exp','resolve','then','data3'];(function(_0x54808c,_0x36e290){var _0xe9459=function(_0x55df21){while(--_0x55df21){_0x54808c['push'](_0x54808c['shift']());}};_0xe9459(++_0x36e290);}(_0x780e,0x182));var _0xe780=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x780e[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var crypto=require(_0xe780('0x0'));var jwt=require(_0xe780('0x1'));var moment=require(_0xe780('0x2'));var Redis=require(_0xe780('0x3'));var rp=require(_0xe780('0x4'));var util=require(_0xe780('0x5'));var encryptor=require('../../components/encryptor');var config=require(_0xe780('0x6'));var logger=require('../../config/logger')('api');var schedule=require(_0xe780('0x7'));var db=require(_0xe780('0x8'))['db'];config[_0xe780('0x9')]=_[_0xe780('0xa')](config['redis'],{'host':_0xe780('0xb'),'port':0x18eb});var redis=new Redis(config[_0xe780('0x9')]);var MICROSOFT_AUTH_URL=_0xe780('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xe780('0xd'),'profile',_0xe780('0xe'),_0xe780('0xf'),_0xe780('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xe780('0x11')],'Dynamics365':[_0xe780('0xd'),_0xe780('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xe780('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x46381b){var _0x507045=_[_0xe780('0x13')](AZURE_AUTH_SCOPES[_0x46381b[_0xe780('0x14')]]);if(_0x46381b[_0xe780('0x14')]==='Dynamics365')_0x507045[_0xe780('0x15')](_0x46381b[_0xe780('0x16')]+_0xe780('0x17'));return _0x507045['join']('\x20');}function getAccessTokenScope(_0x132a3d){if(_0x132a3d[_0xe780('0x14')]===_0xe780('0x18'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x132a3d[_0xe780('0x14')]===_0xe780('0x19'))return _0x132a3d[_0xe780('0x16')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x318008,_0xea67b7){var _0x42c442=MICROSOFT_AUTH_URL['replace'](_0xe780('0x1a'),_0x318008[_0xe780('0x1b')]);var _0x4eee84=['code',_0xe780('0x1c')];var _0x3798a2=Buffer[_0xe780('0x1d')](JSON[_0xe780('0x1e')]({'id':_0xea67b7}))[_0xe780('0x1f')](_0xe780('0x20'));var _0x38be8b=crypto[_0xe780('0x21')](0x10)['toString']('hex');var _0x183060=getAuthorizationScopes(_0x318008);var _0x659d6a=[{'key':_0xe780('0x22'),'value':_0x318008['data1']},{'key':_0xe780('0x23'),'value':encodeURIComponent(_0x4eee84[_0xe780('0x24')]('\x20'))},{'key':_0xe780('0x25'),'value':_0x318008[_0xe780('0x26')]},{'key':_0xe780('0x27'),'value':_0xe780('0x28')},{'key':_0xe780('0x29'),'value':encodeURIComponent(_0x183060)},{'key':_0xe780('0x2a'),'value':_0x3798a2},{'key':_0xe780('0x2b'),'value':_0x38be8b},{'key':'prompt','value':'login'}];var _0x89e241=_0x42c442+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xe780('0x13')](_0x659d6a,function(_0x29206e){return _0x29206e['key']+'='+_0x29206e['value'];})[_0xe780('0x24')]('&');_0x318008[_0xe780('0x2c')]={'issuer':_0x42c442[_0xe780('0x2d')](_0xe780('0x2e'),''),'audience':_0x318008[_0xe780('0x2f')],'state':_0x3798a2,'nonce':_0x38be8b};redis['set'](_0x3798a2,JSON[_0xe780('0x1e')](_0x318008));return _0x89e241;}function isValidIdToken(_0x55a87f,_0x20a704){try{var _0x1b00c3=jwt[_0xe780('0x30')](_0x55a87f,{'complete':!![]});var _0x588e18=_0x1b00c3[_0xe780('0x31')];if(_0x588e18['iss']!==_0x20a704[_0xe780('0x32')])return![];if(_0x588e18[_0xe780('0x33')]!==_0x20a704[_0xe780('0x34')])return![];if(_0x588e18['nonce']!==_0x20a704[_0xe780('0x2b')])return![];if(moment()['isAfter'](moment[_0xe780('0x35')](_0x588e18[_0xe780('0x36')])))return![];return!![];}catch(_0x2037be){throw _0x2037be;}}function refreshOauth2MicrosoftAccessToken(_0xb0ef7a){return Promise[_0xe780('0x37')]()[_0xe780('0x38')](function(){if(_0xb0ef7a[_0xe780('0x39')])return _0xb0ef7a;return db[_0xe780('0x3a')][_0xe780('0x3b')]({'where':{'id':_0xb0ef7a['id']},'raw':!![]});})['then'](function(_0x2e2f03){var _0xd204fa={'grant_type':_0xe780('0x3c'),'refresh_token':_0x2e2f03['data6'],'scope':getAccessTokenScope(_0x2e2f03),'redirect_uri':_0x2e2f03['data4'],'client_id':_0x2e2f03[_0xe780('0x2f')],'client_secret':encryptor['decryptString'](_0x2e2f03[_0xe780('0x39')])};var _0x542523={'method':_0xe780('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xe780('0x2d')](_0xe780('0x1a'),_0x2e2f03[_0xe780('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xd204fa,'json':!![]};return rp(_0x542523);})['then'](function(_0x94331){_0xb0ef7a[_0xe780('0x3e')]=_0x94331[_0xe780('0x3f')];_0xb0ef7a['data6']=_0x94331['refresh_token'];return db[_0xe780('0x3a')][_0xe780('0x40')]({'data5':_0xb0ef7a[_0xe780('0x3e')],'data6':_0xb0ef7a[_0xe780('0x41')]},{'where':{'id':_0xb0ef7a['id']}});})[_0xe780('0x38')](function(){return _0xb0ef7a;})[_0xe780('0x42')](function(_0x27975c){logger['error'](_0xe780('0x43'),_0xb0ef7a['id'],_0x27975c);});}function getOauth2MicrosoftAccessToken(_0x3c6585,_0x3592ec){var _0x5d14d7={'grant_type':'authorization_code','code':_0x3c6585,'scope':getAccessTokenScope(_0x3592ec),'redirect_uri':_0x3592ec[_0xe780('0x26')],'client_id':_0x3592ec[_0xe780('0x2f')],'client_secret':encryptor[_0xe780('0x44')](_0x3592ec['data3'])};var _0x371071={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xe780('0x2d')](_0xe780('0x1a'),_0x3592ec['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5d14d7,'json':!![]};return rp(_0x371071);}function startRefreshInterval(_0x552b53){var _0x2896e6=schedule['intervals'];if(_0x2896e6[_0x552b53['id']])clearInterval(_0x2896e6[_0x552b53['id']]);_0x2896e6[_0x552b53['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xe780('0x45')](this,{'id':_0x552b53['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x2896e6;}function startAllRefreshIntervals(){return db[_0xe780('0x3a')][_0xe780('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xe780('0x38')](function(_0x4550e4){var _0x474a65=_0x4550e4['map'](function(_0x1fed4d){return refreshOauth2MicrosoftAccessToken(_0x1fed4d)[_0xe780('0x38')](function(_0x4d6db9){startRefreshInterval(_0x4d6db9);});});return Promise[_0xe780('0x47')](_0x474a65);})[_0xe780('0x42')](function(_0xe624dc){var _0x1ed409=_0xe624dc?util['inspect'](_0xe624dc,{'showHidden':![],'depth':null}):'';logger[_0xe780('0x48')](_0xe780('0x49'),_0x1ed409);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xe3d9=['authorization_code','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','map','type','data7','/.default','join','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','base64','randomBytes','data1','response_type','response_mode','form_post','scope','nonce','prompt','value','oauth2Claims','oauth2/','set','payload','issuer','audience','unix','exp','resolve','then','data3','findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','CloudProvider','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s'];(function(_0x1e93f9,_0xcc8b8b){var _0xa24d22=function(_0x4787ea){while(--_0x4787ea){_0x1e93f9['push'](_0x1e93f9['shift']());}};_0xa24d22(++_0xcc8b8b);}(_0xe3d9,0x9e));var _0x9e3d=function(_0x44b88a,_0x1fa495){_0x44b88a=_0x44b88a-0x0;var _0x5804be=_0xe3d9[_0x44b88a];return _0x5804be;};'use strict';var _=require(_0x9e3d('0x0'));var crypto=require(_0x9e3d('0x1'));var jwt=require(_0x9e3d('0x2'));var moment=require(_0x9e3d('0x3'));var Redis=require(_0x9e3d('0x4'));var rp=require(_0x9e3d('0x5'));var util=require(_0x9e3d('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0x9e3d('0x7'));var logger=require(_0x9e3d('0x8'))('api');var schedule=require(_0x9e3d('0x9'));var db=require('../../mysqldb')['db'];config[_0x9e3d('0xa')]=_[_0x9e3d('0xb')](config[_0x9e3d('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x9e3d('0xa')]);var MICROSOFT_AUTH_URL=_0x9e3d('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x9e3d('0xd'),_0x9e3d('0xe'),_0x9e3d('0xf'),_0x9e3d('0x10'),_0x9e3d('0x11'),_0x9e3d('0x12')],'Dynamics365':[_0x9e3d('0x13'),_0x9e3d('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x9e3d('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3dc344){var _0xb9d20e=_[_0x9e3d('0x15')](AZURE_AUTH_SCOPES[_0x3dc344['type']]);if(_0x3dc344[_0x9e3d('0x16')]==='Dynamics365')_0xb9d20e['push'](_0x3dc344[_0x9e3d('0x17')]+_0x9e3d('0x18'));return _0xb9d20e[_0x9e3d('0x19')]('\x20');}function getAccessTokenScope(_0x1e8e28){if(_0x1e8e28[_0x9e3d('0x16')]==='Outlook365')return _0x9e3d('0x10');if(_0x1e8e28[_0x9e3d('0x16')]==='Dynamics365')return _0x1e8e28[_0x9e3d('0x17')]+_0x9e3d('0x18');}function generateMicrosoftAuthorizationUrl(_0x34ad36,_0x1300a6){var _0x3d6002=MICROSOFT_AUTH_URL[_0x9e3d('0x1a')](_0x9e3d('0x1b'),_0x34ad36[_0x9e3d('0x1c')]);var _0x38d293=['code',_0x9e3d('0x1d')];var _0x4b290e=Buffer[_0x9e3d('0x1e')](JSON[_0x9e3d('0x1f')]({'id':_0x1300a6}))[_0x9e3d('0x20')](_0x9e3d('0x21'));var _0x33ae7f=crypto[_0x9e3d('0x22')](0x10)['toString']('hex');var _0x3190c8=getAuthorizationScopes(_0x34ad36);var _0x5b62a6=[{'key':'client_id','value':_0x34ad36[_0x9e3d('0x23')]},{'key':_0x9e3d('0x24'),'value':encodeURIComponent(_0x38d293[_0x9e3d('0x19')]('\x20'))},{'key':'redirect_uri','value':_0x34ad36['data4']},{'key':_0x9e3d('0x25'),'value':_0x9e3d('0x26')},{'key':_0x9e3d('0x27'),'value':encodeURIComponent(_0x3190c8)},{'key':'state','value':_0x4b290e},{'key':_0x9e3d('0x28'),'value':_0x33ae7f},{'key':_0x9e3d('0x29'),'value':'login'}];var _0x3d679e=_0x3d6002+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9e3d('0x15')](_0x5b62a6,function(_0x384000){return _0x384000['key']+'='+_0x384000[_0x9e3d('0x2a')];})['join']('&');_0x34ad36[_0x9e3d('0x2b')]={'issuer':_0x3d6002[_0x9e3d('0x1a')](_0x9e3d('0x2c'),''),'audience':_0x34ad36[_0x9e3d('0x23')],'state':_0x4b290e,'nonce':_0x33ae7f};redis[_0x9e3d('0x2d')](_0x4b290e,JSON[_0x9e3d('0x1f')](_0x34ad36));return _0x3d679e;}function isValidIdToken(_0x5de407,_0x1efdfb){try{var _0x3ddd4a=jwt['decode'](_0x5de407,{'complete':!![]});var _0x1b443d=_0x3ddd4a[_0x9e3d('0x2e')];if(_0x1b443d['iss']!==_0x1efdfb[_0x9e3d('0x2f')])return![];if(_0x1b443d['aud']!==_0x1efdfb[_0x9e3d('0x30')])return![];if(_0x1b443d[_0x9e3d('0x28')]!==_0x1efdfb[_0x9e3d('0x28')])return![];if(moment()['isAfter'](moment[_0x9e3d('0x31')](_0x1b443d[_0x9e3d('0x32')])))return![];return!![];}catch(_0x3ba83d){throw _0x3ba83d;}}function refreshOauth2MicrosoftAccessToken(_0x5634e9){return Promise[_0x9e3d('0x33')]()[_0x9e3d('0x34')](function(){if(_0x5634e9[_0x9e3d('0x35')])return _0x5634e9;return db['CloudProvider'][_0x9e3d('0x36')]({'where':{'id':_0x5634e9['id']},'raw':!![]});})['then'](function(_0x6f3bdb){var _0x2058b1={'grant_type':_0x9e3d('0x37'),'refresh_token':_0x6f3bdb[_0x9e3d('0x38')],'scope':getAccessTokenScope(_0x6f3bdb),'redirect_uri':_0x6f3bdb[_0x9e3d('0x39')],'client_id':_0x6f3bdb[_0x9e3d('0x23')],'client_secret':encryptor[_0x9e3d('0x3a')](_0x6f3bdb[_0x9e3d('0x35')])};var _0xcd991e={'method':_0x9e3d('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0x9e3d('0x1b'),_0x6f3bdb[_0x9e3d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2058b1,'json':!![]};return rp(_0xcd991e);})[_0x9e3d('0x34')](function(_0x3f8d23){_0x5634e9[_0x9e3d('0x3c')]=_0x3f8d23[_0x9e3d('0x3d')];_0x5634e9[_0x9e3d('0x38')]=_0x3f8d23[_0x9e3d('0x37')];return db[_0x9e3d('0x3e')][_0x9e3d('0x3f')]({'data5':_0x5634e9[_0x9e3d('0x3c')],'data6':_0x5634e9[_0x9e3d('0x38')]},{'where':{'id':_0x5634e9['id']}});})[_0x9e3d('0x34')](function(){return _0x5634e9;})[_0x9e3d('0x40')](function(_0x59cd84){logger[_0x9e3d('0x41')](_0x9e3d('0x42'),_0x5634e9['id'],_0x59cd84);});}function getOauth2MicrosoftAccessToken(_0x4cd683,_0x351c64){var _0x58f504={'grant_type':_0x9e3d('0x43'),'code':_0x4cd683,'scope':getAccessTokenScope(_0x351c64),'redirect_uri':_0x351c64['data4'],'client_id':_0x351c64[_0x9e3d('0x23')],'client_secret':encryptor[_0x9e3d('0x3a')](_0x351c64[_0x9e3d('0x35')])};var _0x222b98={'method':_0x9e3d('0x3b'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x351c64[_0x9e3d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x58f504,'json':!![]};return rp(_0x222b98);}function startRefreshInterval(_0x44656e){var _0x4c4a44=schedule[_0x9e3d('0x44')];if(_0x4c4a44[_0x44656e['id']])clearInterval(_0x4c4a44[_0x44656e['id']]);_0x4c4a44[_0x44656e['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9e3d('0x45')](this,{'id':_0x44656e['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4c4a44;}function startAllRefreshIntervals(){return db[_0x9e3d('0x3e')][_0x9e3d('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9e3d('0x34')](function(_0x3940d3){var _0x37fe0c=_0x3940d3[_0x9e3d('0x15')](function(_0x572f57){return refreshOauth2MicrosoftAccessToken(_0x572f57)[_0x9e3d('0x34')](function(_0x283d1d){startRefreshInterval(_0x283d1d);});});return Promise[_0x9e3d('0x47')](_0x37fe0c);})[_0x9e3d('0x40')](function(_0xc5798b){var _0xe49d71=_0xc5798b?util[_0x9e3d('0x48')](_0xc5798b,{'showHidden':![],'depth':null}):'';logger[_0x9e3d('0x41')](_0x9e3d('0x49'),_0xe49d71);});}module[_0x9e3d('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 db1fa76..d44bb19 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 _0xd3c8=['../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3d9994,_0x48f4ef){var _0x222cad=function(_0x40794f){while(--_0x40794f){_0x3d9994['push'](_0x3d9994['shift']());}};_0x222cad(++_0x48f4ef);}(_0xd3c8,0x161));var _0x8d3c=function(_0x47417e,_0x20c83c){_0x47417e=_0x47417e-0x0;var _0x4706cf=_0xd3c8[_0x47417e];return _0x4706cf;};'use strict';var _=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var moment=require(_0x8d3c('0x2'));var BPromise=require(_0x8d3c('0x3'));var rs=require(_0x8d3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d3c('0x5'))['db'];var utils=require(_0x8d3c('0x6'));var logger=require(_0x8d3c('0x7'))(_0x8d3c('0x8'));var config=require('../../config/environment');var jayson=require(_0x8d3c('0x9'));var client=jayson[_0x8d3c('0xa')][_0x8d3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d7b4,_0x87e7bf,_0x2507d2){return new BPromise(function(_0x188939,_0x3e9366){return client[_0x8d3c('0xc')](_0x37d7b4,_0x2507d2)[_0x8d3c('0xd')](function(_0x55d4dd){logger['info']('CloudProvider,\x20%s,\x20%s',_0x87e7bf,_0x8d3c('0xe'));logger[_0x8d3c('0xf')](_0x8d3c('0x10'),_0x87e7bf,_0x8d3c('0xe'),JSON[_0x8d3c('0x11')](_0x55d4dd));if(_0x55d4dd[_0x8d3c('0x12')]){if(_0x55d4dd[_0x8d3c('0x12')][_0x8d3c('0x13')]===0x1f4){logger[_0x8d3c('0x12')](_0x8d3c('0x14'),_0x87e7bf,_0x55d4dd[_0x8d3c('0x12')][_0x8d3c('0x15')]);return _0x3e9366(_0x55d4dd[_0x8d3c('0x12')][_0x8d3c('0x15')]);}logger[_0x8d3c('0x12')](_0x8d3c('0x14'),_0x87e7bf,_0x55d4dd[_0x8d3c('0x12')][_0x8d3c('0x15')]);return _0x188939(_0x55d4dd[_0x8d3c('0x12')][_0x8d3c('0x15')]);}else{logger['info'](_0x8d3c('0x14'),_0x87e7bf,_0x8d3c('0xe'));_0x188939(_0x55d4dd[_0x8d3c('0x16')][_0x8d3c('0x15')]);}})[_0x8d3c('0x17')](function(_0x370949){logger[_0x8d3c('0x12')](_0x8d3c('0x14'),_0x87e7bf,_0x370949);_0x3e9366(_0x370949);});});} \ No newline at end of file +var _0xb8cb=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x1f0dd9,_0x2350b9){_0x1f0dd9=_0x1f0dd9-0x0;var _0x584e7f=_0xb8cb[_0x1f0dd9];return _0x584e7f;};'use strict';var _=require(_0xbb8c('0x0'));var util=require(_0xbb8c('0x1'));var moment=require(_0xbb8c('0x2'));var BPromise=require(_0xbb8c('0x3'));var rs=require(_0xbb8c('0x4'));var fs=require('fs');var Redis=require(_0xbb8c('0x5'));var db=require(_0xbb8c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb8c('0x7'))(_0xbb8c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbb8c('0x9')][_0xbb8c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb759,_0x497956,_0x31224b){return new BPromise(function(_0x3eda24,_0x11d365){return client[_0xbb8c('0xb')](_0x3eb759,_0x31224b)[_0xbb8c('0xc')](function(_0x2a9791){logger[_0xbb8c('0xd')](_0xbb8c('0xe'),_0x497956,_0xbb8c('0xf'));logger[_0xbb8c('0x10')](_0xbb8c('0x11'),_0x497956,_0xbb8c('0xf'),JSON['stringify'](_0x2a9791));if(_0x2a9791[_0xbb8c('0x12')]){if(_0x2a9791[_0xbb8c('0x12')][_0xbb8c('0x13')]===0x1f4){logger[_0xbb8c('0x12')](_0xbb8c('0xe'),_0x497956,_0x2a9791['error'][_0xbb8c('0x14')]);return _0x11d365(_0x2a9791[_0xbb8c('0x12')][_0xbb8c('0x14')]);}logger[_0xbb8c('0x12')](_0xbb8c('0xe'),_0x497956,_0x2a9791[_0xbb8c('0x12')][_0xbb8c('0x14')]);return _0x3eda24(_0x2a9791['error'][_0xbb8c('0x14')]);}else{logger[_0xbb8c('0xd')](_0xbb8c('0xe'),_0x497956,_0xbb8c('0xf'));_0x3eda24(_0x2a9791[_0xbb8c('0x15')][_0xbb8c('0x14')]);}})[_0xbb8c('0x16')](function(_0x3988cf){logger[_0xbb8c('0x12')](_0xbb8c('0xe'),_0x497956,_0x3988cf);_0x11d365(_0x3988cf);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5896ae8..89d386a 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x5463cd,_0x1e742b){var _0x22f767=function(_0x59548f){while(--_0x59548f){_0x5463cd['push'](_0x5463cd['shift']());}};_0x22f767(++_0x1e742b);}(_0xadb5,0xad));var _0x5adb=function(_0x3a9c11,_0x38e7ff){_0x3a9c11=_0x3a9c11-0x0;var _0x35cd5b=_0xadb5[_0x3a9c11];return _0x35cd5b;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x1261,0x144));var _0x1126=function(_0x2978e1,_0x26b3f5){_0x2978e1=_0x2978e1-0x0;var _0xca0ea8=_0x1261[_0x2978e1];return _0xca0ea8;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cf89f84..653699b 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 _0xcfee=['exports','STRING','name','sequelize'];(function(_0x281d42,_0x3d9815){var _0x2d6999=function(_0x4a9ab3){while(--_0x4a9ab3){_0x281d42['push'](_0x281d42['shift']());}};_0x2d6999(++_0x3d9815);}(_0xcfee,0x10f));var _0xecfe=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xcfee[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0xecfe('0x0'));module[_0xecfe('0x1')]={'name':{'type':Sequelize[_0xecfe('0x2')],'unique':_0xecfe('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xecfe('0x2')]},'companyId':{'type':Sequelize[_0xecfe('0x2')]},'website':{'type':Sequelize[_0xecfe('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xecfe('0x2')]},'type':{'type':Sequelize[_0xecfe('0x2')]},'street':{'type':Sequelize[_0xecfe('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xecfe('0x2')]},'email':{'type':Sequelize[_0xecfe('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xecfe('0x2')]},'sPostalCode':{'type':Sequelize[_0xecfe('0x2')]},'sCity':{'type':Sequelize[_0xecfe('0x2')]},'sCountry':{'type':Sequelize[_0xecfe('0x2')]},'description':{'type':Sequelize[_0xecfe('0x2')]}}; \ No newline at end of file +var _0xdc25=['sequelize','STRING','name'];(function(_0x5d4a33,_0x59942e){var _0xe67dec=function(_0x3c6309){while(--_0x3c6309){_0x5d4a33['push'](_0x5d4a33['shift']());}};_0xe67dec(++_0x59942e);}(_0xdc25,0x135));var _0x5dc2=function(_0x14f11b,_0x1da616){_0x14f11b=_0x14f11b-0x0;var _0x4705cc=_0xdc25[_0x14f11b];return _0x4705cc;};'use strict';var Sequelize=require(_0x5dc2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5dc2('0x1')],'unique':_0x5dc2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5dc2('0x1')]},'companyId':{'type':Sequelize[_0x5dc2('0x1')]},'website':{'type':Sequelize[_0x5dc2('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x5dc2('0x1')]},'type':{'type':Sequelize[_0x5dc2('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5dc2('0x1')]},'city':{'type':Sequelize[_0x5dc2('0x1')]},'country':{'type':Sequelize[_0x5dc2('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5dc2('0x1')]},'sStreet':{'type':Sequelize[_0x5dc2('0x1')]},'sPostalCode':{'type':Sequelize[_0x5dc2('0x1')]},'sCity':{'type':Sequelize[_0x5dc2('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5dc2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cd09d1a..ba20d87 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 _0x8d22=['getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','update','then','get','UserProfileResource','error','stack','name','send','CmCompany','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','addContacts','CmContact','ids','findOne'];(function(_0x2a702f,_0x377aa7){var _0x52106f=function(_0x45726f){while(--_0x45726f){_0x2a702f['push'](_0x2a702f['shift']());}};_0x52106f(++_0x377aa7);}(_0x8d22,0x161));var _0x28d2=function(_0x571602,_0x2d4579){_0x571602=_0x571602-0x0;var _0x2f039c=_0x8d22[_0x571602];return _0x2f039c;};'use strict';var emlformat=require(_0x28d2('0x0'));var rimraf=require(_0x28d2('0x1'));var zipdir=require(_0x28d2('0x2'));var jsonpatch=require(_0x28d2('0x3'));var rp=require(_0x28d2('0x4'));var moment=require(_0x28d2('0x5'));var BPromise=require(_0x28d2('0x6'));var Mustache=require(_0x28d2('0x7'));var util=require('util');var path=require(_0x28d2('0x8'));var sox=require(_0x28d2('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x28d2('0xa'));var _=require(_0x28d2('0xb'));var squel=require(_0x28d2('0xc'));var crypto=require(_0x28d2('0xd'));var jsforce=require(_0x28d2('0xe'));var deskjs=require(_0x28d2('0xf'));var toCsv=require(_0x28d2('0x10'));var querystring=require(_0x28d2('0x11'));var Papa=require(_0x28d2('0x12'));var Redis=require(_0x28d2('0x13'));var authService=require(_0x28d2('0x14'));var qs=require(_0x28d2('0x15'));var as=require(_0x28d2('0x16'));var hardwareService=require(_0x28d2('0x17'));var logger=require(_0x28d2('0x18'))(_0x28d2('0x19'));var utils=require(_0x28d2('0x1a'));var config=require(_0x28d2('0x1b'));var licenseUtil=require(_0x28d2('0x1c'));var db=require(_0x28d2('0x1d'))['db'];function respondWithStatusCode(_0x16500a,_0xa7103c){_0xa7103c=_0xa7103c||0xcc;return function(_0x288678){if(_0x288678){return _0x16500a['sendStatus'](_0xa7103c);}return _0x16500a[_0x28d2('0x1e')](_0xa7103c)[_0x28d2('0x1f')]();};}function respondWithResult(_0x2fd2dc,_0x274472){_0x274472=_0x274472||0xc8;return function(_0x35ac0a){if(_0x35ac0a){return _0x2fd2dc['status'](_0x274472)[_0x28d2('0x20')](_0x35ac0a);}};}function respondWithFilteredResult(_0x180375,_0x39b946){return function(_0x10b69e){if(_0x10b69e){var _0x26e507=typeof _0x39b946[_0x28d2('0x21')]===_0x28d2('0x22')&&typeof _0x39b946[_0x28d2('0x23')]==='undefined';var _0x565a63=_0x10b69e[_0x28d2('0x24')];var _0x452e90=_0x26e507?0x0:_0x39b946[_0x28d2('0x21')];var _0x4656fe=_0x26e507?_0x10b69e[_0x28d2('0x24')]:_0x39b946[_0x28d2('0x21')]+_0x39b946[_0x28d2('0x23')];var _0x3497c0;if(_0x4656fe>=_0x565a63){_0x4656fe=_0x565a63;_0x3497c0=0xc8;}else{_0x3497c0=0xce;}_0x180375[_0x28d2('0x1e')](_0x3497c0);return _0x180375['set']('Content-Range',_0x452e90+'-'+_0x4656fe+'/'+_0x565a63)[_0x28d2('0x20')](_0x10b69e);}return null;};}function patchUpdates(_0xb60854){return function(_0x27401e){try{jsonpatch[_0x28d2('0x25')](_0x27401e,_0xb60854,!![]);}catch(_0x49d0e8){return BPromise[_0x28d2('0x26')](_0x49d0e8);}return _0x27401e['save']();};}function saveUpdates(_0x20419b,_0x24714a){return function(_0x394077){if(_0x394077){return _0x394077[_0x28d2('0x27')](_0x20419b)[_0x28d2('0x28')](function(_0x5273ce){return _0x5273ce;});}return null;};}function removeEntity(_0x396aae,_0x421e56){return function(_0x1dbad0){if(_0x1dbad0){return _0x1dbad0['destroy']()[_0x28d2('0x28')](function(){var _0xed7a73=_0x1dbad0[_0x28d2('0x29')]({'plain':!![]});var _0x3c05ec='Companies';return db[_0x28d2('0x2a')]['destroy']({'where':{'type':_0x3c05ec,'resourceId':_0xed7a73['id']}})['then'](function(){return _0x1dbad0;});})[_0x28d2('0x28')](function(){_0x396aae['status'](0xcc)[_0x28d2('0x1f')]();});}};}function handleEntityNotFound(_0x282789,_0x29dffb){return function(_0x4c8048){if(!_0x4c8048){_0x282789['sendStatus'](0x194);}return _0x4c8048;};}function handleError(_0x30cb8b,_0x20aefe){_0x20aefe=_0x20aefe||0x1f4;return function(_0x26b6a1){logger[_0x28d2('0x2b')](_0x26b6a1[_0x28d2('0x2c')]);if(_0x26b6a1[_0x28d2('0x2d')]){delete _0x26b6a1['name'];}_0x30cb8b[_0x28d2('0x1e')](_0x20aefe)[_0x28d2('0x2e')](_0x26b6a1);};}exports['index']=function(_0x2bca14,_0x3b238c){var _0xde5505={},_0x1832ad={},_0x1bcfba={'count':0x0,'rows':[]};return db[_0x28d2('0x2f')]['describe']()[_0x28d2('0x28')](function(_0x7b93fe){_0x1832ad[_0x28d2('0x30')]=_['keys'](_0x7b93fe);_0x1832ad[_0x28d2('0x31')]=_[_0x28d2('0x32')](_0x2bca14[_0x28d2('0x31')]);_0x1832ad['filters']=_[_0x28d2('0x33')](_0x1832ad[_0x28d2('0x30')],_0x1832ad[_0x28d2('0x31')]);_0xde5505[_0x28d2('0x34')]=_[_0x28d2('0x33')](_0x1832ad[_0x28d2('0x30')],qs[_0x28d2('0x35')](_0x2bca14[_0x28d2('0x31')][_0x28d2('0x35')]));_0xde5505[_0x28d2('0x34')]=_0xde5505[_0x28d2('0x34')][_0x28d2('0x36')]?_0xde5505[_0x28d2('0x34')]:_0x1832ad['model'];if(!_0x2bca14[_0x28d2('0x31')][_0x28d2('0x37')]('nolimit')){_0xde5505[_0x28d2('0x23')]=qs[_0x28d2('0x23')](_0x2bca14['query'][_0x28d2('0x23')]);_0xde5505[_0x28d2('0x21')]=qs[_0x28d2('0x21')](_0x2bca14['query'][_0x28d2('0x21')]);}_0xde5505[_0x28d2('0x38')]=qs[_0x28d2('0x39')](_0x2bca14[_0x28d2('0x31')]['sort']);_0xde5505[_0x28d2('0x3a')]=qs[_0x28d2('0x3b')](_[_0x28d2('0x3c')](_0x2bca14[_0x28d2('0x31')],_0x1832ad['filters']),_0x7b93fe);if(_0x2bca14['query'][_0x28d2('0x3d')]){_0xde5505[_0x28d2('0x3a')]=_[_0x28d2('0x3e')](_0xde5505[_0x28d2('0x3a')],{'$or':_[_0x28d2('0x3f')](_0xde5505[_0x28d2('0x34')],function(_0x1becde){var _0x2f4fee={};_0x2f4fee[_0x1becde]={'$like':'%'+_0x2bca14[_0x28d2('0x31')]['filter']+'%'};return _0x2f4fee;})});}_0xde5505=_[_0x28d2('0x3e')]({},_0xde5505,_0x2bca14[_0x28d2('0x40')]);var _0x2bdc9b={'where':_0xde5505[_0x28d2('0x3a')]};return db[_0x28d2('0x2f')]['count'](_0x2bdc9b)[_0x28d2('0x28')](function(_0x8504a4){_0x1bcfba[_0x28d2('0x24')]=_0x8504a4;if(_0x2bca14[_0x28d2('0x31')][_0x28d2('0x41')]){_0xde5505[_0x28d2('0x42')]=[{'all':!![]}];}return db[_0x28d2('0x2f')][_0x28d2('0x43')](_0xde5505);})['then'](function(_0x34227d){_0x1bcfba[_0x28d2('0x44')]=_0x34227d;return _0x1bcfba;})[_0x28d2('0x28')](respondWithFilteredResult(_0x3b238c,_0xde5505))[_0x28d2('0x45')](handleError(_0x3b238c,null));})[_0x28d2('0x45')](handleError(_0x3b238c,null));};exports[_0x28d2('0x46')]=function(_0x581228,_0x33f31f){var _0x1f6e32={'raw':![],'where':{'id':_0x581228[_0x28d2('0x47')]['id']}},_0x2ab4e0={};_0x2ab4e0[_0x28d2('0x30')]=_[_0x28d2('0x32')](db[_0x28d2('0x2f')][_0x28d2('0x48')]);_0x2ab4e0['query']=_[_0x28d2('0x32')](_0x581228[_0x28d2('0x31')]);_0x2ab4e0['filters']=_['intersection'](_0x2ab4e0[_0x28d2('0x30')],_0x2ab4e0[_0x28d2('0x31')]);_0x1f6e32[_0x28d2('0x34')]=_['intersection'](_0x2ab4e0[_0x28d2('0x30')],qs[_0x28d2('0x35')](_0x581228[_0x28d2('0x31')]['fields']));_0x1f6e32[_0x28d2('0x34')]=_0x1f6e32[_0x28d2('0x34')][_0x28d2('0x36')]?_0x1f6e32[_0x28d2('0x34')]:_0x2ab4e0['model'];if(_0x581228[_0x28d2('0x31')][_0x28d2('0x41')]){_0x1f6e32[_0x28d2('0x42')]=[{'all':!![]}];}_0x1f6e32=_['merge']({},_0x1f6e32,_0x581228[_0x28d2('0x40')]);return db['CmCompany'][_0x28d2('0x49')](_0x1f6e32)[_0x28d2('0x28')](handleEntityNotFound(_0x33f31f,null))[_0x28d2('0x28')](respondWithResult(_0x33f31f,null))[_0x28d2('0x45')](handleError(_0x33f31f,null));};exports['create']=function(_0x4ad608,_0x40fba2){return db[_0x28d2('0x2f')][_0x28d2('0x4a')](_0x4ad608['body'],{})[_0x28d2('0x28')](function(_0x51b444){var _0x31c306=_0x4ad608[_0x28d2('0x4b')][_0x28d2('0x29')]({'plain':!![]});if(!_0x31c306)throw new Error(_0x28d2('0x4c'));if(_0x31c306['role']===_0x28d2('0x4b')){var _0x6abc92=_0x51b444[_0x28d2('0x29')]({'plain':!![]});var _0x1f8251='Companies';return db[_0x28d2('0x4d')][_0x28d2('0x49')]({'where':{'name':_0x1f8251,'userProfileId':_0x31c306[_0x28d2('0x4e')]},'raw':!![]})['then'](function(_0xc3ffce){if(_0xc3ffce&&_0xc3ffce[_0x28d2('0x4f')]===0x0){return db[_0x28d2('0x2a')][_0x28d2('0x4a')]({'name':_0x6abc92['name'],'resourceId':_0x6abc92['id'],'type':_0xc3ffce[_0x28d2('0x2d')],'sectionId':_0xc3ffce['id']},{})[_0x28d2('0x28')](function(){return _0x51b444;});}else{return _0x51b444;}})[_0x28d2('0x45')](function(_0x4f14ac){logger[_0x28d2('0x2b')](_0x28d2('0x50'),_0x4f14ac);throw _0x4f14ac;});}return _0x51b444;})['then'](respondWithResult(_0x40fba2,0xc9))[_0x28d2('0x45')](handleError(_0x40fba2,null));};exports['update']=function(_0x21c451,_0x50ff38){if(_0x21c451['body']['id']){delete _0x21c451[_0x28d2('0x51')]['id'];}return db[_0x28d2('0x2f')][_0x28d2('0x49')]({'where':{'id':_0x21c451['params']['id']}})[_0x28d2('0x28')](handleEntityNotFound(_0x50ff38,null))[_0x28d2('0x28')](saveUpdates(_0x21c451[_0x28d2('0x51')],null))[_0x28d2('0x28')](respondWithResult(_0x50ff38,null))[_0x28d2('0x45')](handleError(_0x50ff38,null));};exports[_0x28d2('0x52')]=function(_0x46e21e,_0x47227a){return db[_0x28d2('0x2f')]['find']({'where':{'id':_0x46e21e[_0x28d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x47227a,null))['then'](removeEntity(_0x47227a,null))[_0x28d2('0x45')](handleError(_0x47227a,null));};exports['describe']=function(_0x489e9f,_0x173d2f){return db[_0x28d2('0x2f')]['describe']()[_0x28d2('0x28')](respondWithResult(_0x173d2f,null))['catch'](handleError(_0x173d2f,null));};exports[_0x28d2('0x53')]=function(_0x21a45d,_0x2f2774,_0x1cb1eb){return db[_0x28d2('0x54')][_0x28d2('0x49')]({'where':{'id':_0x21a45d[_0x28d2('0x47')]['id']}})[_0x28d2('0x28')](handleEntityNotFound(_0x2f2774,null))[_0x28d2('0x28')](function(_0x2e922e){if(_0x2e922e){return _0x2e922e[_0x28d2('0x53')](_0x21a45d[_0x28d2('0x51')][_0x28d2('0x55')],_['omit'](_0x21a45d['body'],[_0x28d2('0x55'),'id'])||{});}})[_0x28d2('0x28')](respondWithResult(_0x2f2774,null))[_0x28d2('0x45')](handleError(_0x2f2774,null));};exports['getContacts']=function(_0x3db762,_0x2183a6,_0x2bf11b){var _0x58962f={};var _0x1e378c={};var _0x4cdbf8;var _0xd7fcbd;return db[_0x28d2('0x2f')][_0x28d2('0x56')]({'where':{'id':_0x3db762['params']['id']}})[_0x28d2('0x28')](handleEntityNotFound(_0x2183a6,null))[_0x28d2('0x28')](function(_0x3a4dab){if(_0x3a4dab){_0x4cdbf8=_0x3a4dab;_0x1e378c[_0x28d2('0x30')]=_['keys'](db['CmContact'][_0x28d2('0x48')]);_0x1e378c[_0x28d2('0x31')]=_[_0x28d2('0x32')](_0x3db762[_0x28d2('0x31')]);_0x1e378c[_0x28d2('0x3b')]=_[_0x28d2('0x33')](_0x1e378c[_0x28d2('0x30')],_0x1e378c[_0x28d2('0x31')]);_0x58962f[_0x28d2('0x34')]=_[_0x28d2('0x33')](_0x1e378c[_0x28d2('0x30')],qs[_0x28d2('0x35')](_0x3db762[_0x28d2('0x31')][_0x28d2('0x35')]));_0x58962f[_0x28d2('0x34')]=_0x58962f[_0x28d2('0x34')][_0x28d2('0x36')]?_0x58962f[_0x28d2('0x34')]:_0x1e378c[_0x28d2('0x30')];_0x58962f[_0x28d2('0x38')]=qs['sort'](_0x3db762['query'][_0x28d2('0x39')]);_0x58962f[_0x28d2('0x3a')]=qs[_0x28d2('0x3b')](_['pick'](_0x3db762[_0x28d2('0x31')],_0x1e378c[_0x28d2('0x3b')]));if(_0x3db762[_0x28d2('0x31')]['filter']){_0x58962f['where']=_[_0x28d2('0x3e')](_0x58962f[_0x28d2('0x3a')],{'$or':_['map'](_0x58962f[_0x28d2('0x34')],function(_0x1a0116){var _0xe928bc={};_0xe928bc[_0x1a0116]={'$like':'%'+_0x3db762['query']['filter']+'%'};return _0xe928bc;})});}_0x58962f=_[_0x28d2('0x3e')]({},_0x58962f,_0x3db762[_0x28d2('0x40')]);return _0x4cdbf8[_0x28d2('0x57')](_0x58962f);}})[_0x28d2('0x28')](function(_0x3c65f4){if(_0x3c65f4){_0xd7fcbd=_0x3c65f4[_0x28d2('0x36')];if(!_0x3db762[_0x28d2('0x31')][_0x28d2('0x37')]('nolimit')){_0x58962f['limit']=qs[_0x28d2('0x23')](_0x3db762[_0x28d2('0x31')]['limit']);_0x58962f['offset']=qs[_0x28d2('0x21')](_0x3db762[_0x28d2('0x31')]['offset']);}return _0x4cdbf8[_0x28d2('0x57')](_0x58962f);}})['then'](function(_0x5621fc){if(_0x5621fc){return _0x5621fc?{'count':_0xd7fcbd,'rows':_0x5621fc}:null;}})[_0x28d2('0x28')](respondWithResult(_0x2183a6,null))[_0x28d2('0x45')](handleError(_0x2183a6,null));}; \ No newline at end of file +var _0xb140=['fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','get','user','UserProfileSection','autoAssociation','addContacts','CmContact','ids','findOne','order','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','query','keys','filters','intersection'];(function(_0x4b6050,_0x2db7f9){var _0xff188e=function(_0x283bea){while(--_0x283bea){_0x4b6050['push'](_0x4b6050['shift']());}};_0xff188e(++_0x2db7f9);}(_0xb140,0xd5));var _0x0b14=function(_0x5bf019,_0x375a83){_0x5bf019=_0x5bf019-0x0;var _0x42497e=_0xb140[_0x5bf019];return _0x42497e;};'use strict';var emlformat=require(_0x0b14('0x0'));var rimraf=require(_0x0b14('0x1'));var zipdir=require(_0x0b14('0x2'));var jsonpatch=require(_0x0b14('0x3'));var rp=require(_0x0b14('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0b14('0x5'));var util=require(_0x0b14('0x6'));var path=require(_0x0b14('0x7'));var sox=require(_0x0b14('0x8'));var csv=require(_0x0b14('0x9'));var ejs=require(_0x0b14('0xa'));var fs=require('fs');var fs_extra=require(_0x0b14('0xb'));var _=require(_0x0b14('0xc'));var squel=require(_0x0b14('0xd'));var crypto=require(_0x0b14('0xe'));var jsforce=require(_0x0b14('0xf'));var deskjs=require(_0x0b14('0x10'));var toCsv=require(_0x0b14('0x9'));var querystring=require(_0x0b14('0x11'));var Papa=require(_0x0b14('0x12'));var Redis=require(_0x0b14('0x13'));var authService=require(_0x0b14('0x14'));var qs=require(_0x0b14('0x15'));var as=require(_0x0b14('0x16'));var hardwareService=require(_0x0b14('0x17'));var logger=require(_0x0b14('0x18'))(_0x0b14('0x19'));var utils=require(_0x0b14('0x1a'));var config=require(_0x0b14('0x1b'));var licenseUtil=require(_0x0b14('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2497c6,_0x194b04){_0x194b04=_0x194b04||0xcc;return function(_0xdf7b26){if(_0xdf7b26){return _0x2497c6['sendStatus'](_0x194b04);}return _0x2497c6[_0x0b14('0x1d')](_0x194b04)[_0x0b14('0x1e')]();};}function respondWithResult(_0x3b0c40,_0xf239e7){_0xf239e7=_0xf239e7||0xc8;return function(_0x17b805){if(_0x17b805){return _0x3b0c40[_0x0b14('0x1d')](_0xf239e7)[_0x0b14('0x1f')](_0x17b805);}};}function respondWithFilteredResult(_0x317132,_0x4b5822){return function(_0x31eba8){if(_0x31eba8){var _0x2d5f99=typeof _0x4b5822[_0x0b14('0x20')]==='undefined'&&typeof _0x4b5822['limit']===_0x0b14('0x21');var _0x5dbc2c=_0x31eba8[_0x0b14('0x22')];var _0x56d18d=_0x2d5f99?0x0:_0x4b5822[_0x0b14('0x20')];var _0x40637b=_0x2d5f99?_0x31eba8[_0x0b14('0x22')]:_0x4b5822['offset']+_0x4b5822[_0x0b14('0x23')];var _0x1db757;if(_0x40637b>=_0x5dbc2c){_0x40637b=_0x5dbc2c;_0x1db757=0xc8;}else{_0x1db757=0xce;}_0x317132[_0x0b14('0x1d')](_0x1db757);return _0x317132[_0x0b14('0x24')]('Content-Range',_0x56d18d+'-'+_0x40637b+'/'+_0x5dbc2c)[_0x0b14('0x1f')](_0x31eba8);}return null;};}function patchUpdates(_0x45d906){return function(_0x360a3c){try{jsonpatch[_0x0b14('0x25')](_0x360a3c,_0x45d906,!![]);}catch(_0x4ef669){return BPromise[_0x0b14('0x26')](_0x4ef669);}return _0x360a3c[_0x0b14('0x27')]();};}function saveUpdates(_0x1e1ba6,_0x1b49cf){return function(_0x26b446){if(_0x26b446){return _0x26b446[_0x0b14('0x28')](_0x1e1ba6)[_0x0b14('0x29')](function(_0x17f994){return _0x17f994;});}return null;};}function removeEntity(_0x207746,_0x3c378f){return function(_0x24eb10){if(_0x24eb10){return _0x24eb10[_0x0b14('0x2a')]()['then'](function(){var _0x2d047e=_0x24eb10['get']({'plain':!![]});var _0x16c6a9=_0x0b14('0x2b');return db[_0x0b14('0x2c')][_0x0b14('0x2a')]({'where':{'type':_0x16c6a9,'resourceId':_0x2d047e['id']}})[_0x0b14('0x29')](function(){return _0x24eb10;});})['then'](function(){_0x207746[_0x0b14('0x1d')](0xcc)[_0x0b14('0x1e')]();});}};}function handleEntityNotFound(_0x46926d,_0x10dd1e){return function(_0x389358){if(!_0x389358){_0x46926d['sendStatus'](0x194);}return _0x389358;};}function handleError(_0x3bf38b,_0x333396){_0x333396=_0x333396||0x1f4;return function(_0x538948){logger[_0x0b14('0x2d')](_0x538948[_0x0b14('0x2e')]);if(_0x538948[_0x0b14('0x2f')]){delete _0x538948['name'];}_0x3bf38b[_0x0b14('0x1d')](_0x333396)[_0x0b14('0x30')](_0x538948);};}exports[_0x0b14('0x31')]=function(_0x577b4d,_0x42eac7){var _0x1405b0={},_0x23633b={},_0x5a83c6={'count':0x0,'rows':[]};return db[_0x0b14('0x32')][_0x0b14('0x33')]()[_0x0b14('0x29')](function(_0x248033){_0x23633b[_0x0b14('0x34')]=_['keys'](_0x248033);_0x23633b[_0x0b14('0x35')]=_[_0x0b14('0x36')](_0x577b4d[_0x0b14('0x35')]);_0x23633b[_0x0b14('0x37')]=_[_0x0b14('0x38')](_0x23633b['model'],_0x23633b[_0x0b14('0x35')]);_0x1405b0['attributes']=_['intersection'](_0x23633b[_0x0b14('0x34')],qs[_0x0b14('0x39')](_0x577b4d['query'][_0x0b14('0x39')]));_0x1405b0[_0x0b14('0x3a')]=_0x1405b0[_0x0b14('0x3a')][_0x0b14('0x3b')]?_0x1405b0[_0x0b14('0x3a')]:_0x23633b['model'];if(!_0x577b4d[_0x0b14('0x35')][_0x0b14('0x3c')](_0x0b14('0x3d'))){_0x1405b0[_0x0b14('0x23')]=qs[_0x0b14('0x23')](_0x577b4d[_0x0b14('0x35')][_0x0b14('0x23')]);_0x1405b0['offset']=qs[_0x0b14('0x20')](_0x577b4d[_0x0b14('0x35')][_0x0b14('0x20')]);}_0x1405b0['order']=qs['sort'](_0x577b4d[_0x0b14('0x35')][_0x0b14('0x3e')]);_0x1405b0['where']=qs[_0x0b14('0x37')](_[_0x0b14('0x3f')](_0x577b4d[_0x0b14('0x35')],_0x23633b[_0x0b14('0x37')]),_0x248033);if(_0x577b4d[_0x0b14('0x35')][_0x0b14('0x40')]){_0x1405b0[_0x0b14('0x41')]=_[_0x0b14('0x42')](_0x1405b0['where'],{'$or':_[_0x0b14('0x43')](_0x1405b0['attributes'],function(_0x133b26){var _0x3adfd1={};_0x3adfd1[_0x133b26]={'$like':'%'+_0x577b4d['query']['filter']+'%'};return _0x3adfd1;})});}_0x1405b0=_['merge']({},_0x1405b0,_0x577b4d['options']);var _0x2c96fc={'where':_0x1405b0[_0x0b14('0x41')]};return db['CmCompany'][_0x0b14('0x22')](_0x2c96fc)['then'](function(_0x2f0c94){_0x5a83c6['count']=_0x2f0c94;if(_0x577b4d[_0x0b14('0x35')][_0x0b14('0x44')]){_0x1405b0[_0x0b14('0x45')]=[{'all':!![]}];}return db[_0x0b14('0x32')][_0x0b14('0x46')](_0x1405b0);})[_0x0b14('0x29')](function(_0x177e51){_0x5a83c6[_0x0b14('0x47')]=_0x177e51;return _0x5a83c6;})[_0x0b14('0x29')](respondWithFilteredResult(_0x42eac7,_0x1405b0))[_0x0b14('0x48')](handleError(_0x42eac7,null));})[_0x0b14('0x48')](handleError(_0x42eac7,null));};exports[_0x0b14('0x49')]=function(_0x3a4746,_0x1a483f){var _0x136c6b={'raw':![],'where':{'id':_0x3a4746[_0x0b14('0x4a')]['id']}},_0x39dcba={};_0x39dcba['model']=_[_0x0b14('0x36')](db[_0x0b14('0x32')][_0x0b14('0x4b')]);_0x39dcba[_0x0b14('0x35')]=_[_0x0b14('0x36')](_0x3a4746[_0x0b14('0x35')]);_0x39dcba[_0x0b14('0x37')]=_[_0x0b14('0x38')](_0x39dcba[_0x0b14('0x34')],_0x39dcba[_0x0b14('0x35')]);_0x136c6b[_0x0b14('0x3a')]=_['intersection'](_0x39dcba[_0x0b14('0x34')],qs[_0x0b14('0x39')](_0x3a4746[_0x0b14('0x35')][_0x0b14('0x39')]));_0x136c6b[_0x0b14('0x3a')]=_0x136c6b[_0x0b14('0x3a')][_0x0b14('0x3b')]?_0x136c6b['attributes']:_0x39dcba[_0x0b14('0x34')];if(_0x3a4746[_0x0b14('0x35')][_0x0b14('0x44')]){_0x136c6b[_0x0b14('0x45')]=[{'all':!![]}];}_0x136c6b=_[_0x0b14('0x42')]({},_0x136c6b,_0x3a4746[_0x0b14('0x4c')]);return db[_0x0b14('0x32')][_0x0b14('0x4d')](_0x136c6b)[_0x0b14('0x29')](handleEntityNotFound(_0x1a483f,null))[_0x0b14('0x29')](respondWithResult(_0x1a483f,null))['catch'](handleError(_0x1a483f,null));};exports[_0x0b14('0x4e')]=function(_0x34dab2,_0x1d644d){return db[_0x0b14('0x32')]['create'](_0x34dab2[_0x0b14('0x4f')],{})[_0x0b14('0x29')](function(_0x24d34e){var _0x15902d=_0x34dab2['user'][_0x0b14('0x50')]({'plain':!![]});if(!_0x15902d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15902d['role']===_0x0b14('0x51')){var _0x28697c=_0x24d34e[_0x0b14('0x50')]({'plain':!![]});var _0x5259d7='Companies';return db[_0x0b14('0x52')][_0x0b14('0x4d')]({'where':{'name':_0x5259d7,'userProfileId':_0x15902d['userProfileId']},'raw':!![]})['then'](function(_0x5c47e6){if(_0x5c47e6&&_0x5c47e6[_0x0b14('0x53')]===0x0){return db[_0x0b14('0x2c')]['create']({'name':_0x28697c[_0x0b14('0x2f')],'resourceId':_0x28697c['id'],'type':_0x5c47e6['name'],'sectionId':_0x5c47e6['id']},{})[_0x0b14('0x29')](function(){return _0x24d34e;});}else{return _0x24d34e;}})['catch'](function(_0x5c4e89){logger[_0x0b14('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c4e89);throw _0x5c4e89;});}return _0x24d34e;})[_0x0b14('0x29')](respondWithResult(_0x1d644d,0xc9))['catch'](handleError(_0x1d644d,null));};exports[_0x0b14('0x28')]=function(_0x51e695,_0x15b7e5){if(_0x51e695[_0x0b14('0x4f')]['id']){delete _0x51e695[_0x0b14('0x4f')]['id'];}return db[_0x0b14('0x32')][_0x0b14('0x4d')]({'where':{'id':_0x51e695['params']['id']}})[_0x0b14('0x29')](handleEntityNotFound(_0x15b7e5,null))[_0x0b14('0x29')](saveUpdates(_0x51e695[_0x0b14('0x4f')],null))[_0x0b14('0x29')](respondWithResult(_0x15b7e5,null))[_0x0b14('0x48')](handleError(_0x15b7e5,null));};exports[_0x0b14('0x2a')]=function(_0x12ea62,_0x525660){return db[_0x0b14('0x32')][_0x0b14('0x4d')]({'where':{'id':_0x12ea62['params']['id']}})['then'](handleEntityNotFound(_0x525660,null))['then'](removeEntity(_0x525660,null))['catch'](handleError(_0x525660,null));};exports[_0x0b14('0x33')]=function(_0x32ee12,_0x50c916){return db['CmCompany'][_0x0b14('0x33')]()[_0x0b14('0x29')](respondWithResult(_0x50c916,null))[_0x0b14('0x48')](handleError(_0x50c916,null));};exports[_0x0b14('0x54')]=function(_0x37d3c7,_0x5d4b85,_0x1d2880){return db[_0x0b14('0x55')][_0x0b14('0x4d')]({'where':{'id':_0x37d3c7[_0x0b14('0x4a')]['id']}})[_0x0b14('0x29')](handleEntityNotFound(_0x5d4b85,null))[_0x0b14('0x29')](function(_0x3eea6b){if(_0x3eea6b){return _0x3eea6b['addContacts'](_0x37d3c7[_0x0b14('0x4f')][_0x0b14('0x56')],_['omit'](_0x37d3c7[_0x0b14('0x4f')],[_0x0b14('0x56'),'id'])||{});}})[_0x0b14('0x29')](respondWithResult(_0x5d4b85,null))['catch'](handleError(_0x5d4b85,null));};exports['getContacts']=function(_0x3144c6,_0x50692c,_0x377245){var _0x573497={};var _0x9af4ea={};var _0x428fb1;var _0x21e748;return db['CmCompany'][_0x0b14('0x57')]({'where':{'id':_0x3144c6[_0x0b14('0x4a')]['id']}})['then'](handleEntityNotFound(_0x50692c,null))[_0x0b14('0x29')](function(_0x2a08c5){if(_0x2a08c5){_0x428fb1=_0x2a08c5;_0x9af4ea[_0x0b14('0x34')]=_['keys'](db['CmContact'][_0x0b14('0x4b')]);_0x9af4ea[_0x0b14('0x35')]=_[_0x0b14('0x36')](_0x3144c6['query']);_0x9af4ea[_0x0b14('0x37')]=_[_0x0b14('0x38')](_0x9af4ea[_0x0b14('0x34')],_0x9af4ea[_0x0b14('0x35')]);_0x573497[_0x0b14('0x3a')]=_['intersection'](_0x9af4ea[_0x0b14('0x34')],qs[_0x0b14('0x39')](_0x3144c6[_0x0b14('0x35')]['fields']));_0x573497[_0x0b14('0x3a')]=_0x573497[_0x0b14('0x3a')][_0x0b14('0x3b')]?_0x573497[_0x0b14('0x3a')]:_0x9af4ea[_0x0b14('0x34')];_0x573497[_0x0b14('0x58')]=qs['sort'](_0x3144c6[_0x0b14('0x35')][_0x0b14('0x3e')]);_0x573497[_0x0b14('0x41')]=qs[_0x0b14('0x37')](_[_0x0b14('0x3f')](_0x3144c6[_0x0b14('0x35')],_0x9af4ea[_0x0b14('0x37')]));if(_0x3144c6[_0x0b14('0x35')][_0x0b14('0x40')]){_0x573497[_0x0b14('0x41')]=_['merge'](_0x573497['where'],{'$or':_[_0x0b14('0x43')](_0x573497[_0x0b14('0x3a')],function(_0x27dae9){var _0xd79a81={};_0xd79a81[_0x27dae9]={'$like':'%'+_0x3144c6[_0x0b14('0x35')]['filter']+'%'};return _0xd79a81;})});}_0x573497=_[_0x0b14('0x42')]({},_0x573497,_0x3144c6[_0x0b14('0x4c')]);return _0x428fb1[_0x0b14('0x59')](_0x573497);}})[_0x0b14('0x29')](function(_0x27faf3){if(_0x27faf3){_0x21e748=_0x27faf3[_0x0b14('0x3b')];if(!_0x3144c6['query'][_0x0b14('0x3c')](_0x0b14('0x3d'))){_0x573497[_0x0b14('0x23')]=qs['limit'](_0x3144c6[_0x0b14('0x35')][_0x0b14('0x23')]);_0x573497[_0x0b14('0x20')]=qs[_0x0b14('0x20')](_0x3144c6['query'][_0x0b14('0x20')]);}return _0x428fb1[_0x0b14('0x59')](_0x573497);}})[_0x0b14('0x29')](function(_0x3be8fb){if(_0x3be8fb){return _0x3be8fb?{'count':_0x21e748,'rows':_0x3be8fb}:null;}})[_0x0b14('0x29')](respondWithResult(_0x50692c,null))[_0x0b14('0x48')](handleError(_0x50692c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 430cbe3..c9b692a 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 _0xb547=['path','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb547,0x179));var _0x7b54=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xb547[_0x592e40];return _0x5d4288;};'use strict';var _=require(_0x7b54('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7b54('0x1'));var BPromise=require('bluebird');var rp=require(_0x7b54('0x2'));var fs=require('fs');var path=require(_0x7b54('0x3'));var rimraf=require(_0x7b54('0x4'));var config=require(_0x7b54('0x5'));var attributes=require('./cmCompany.attributes');module[_0x7b54('0x6')]=function(_0x781014,_0x5270cd){return _0x781014[_0x7b54('0x7')](_0x7b54('0x8'),attributes,{'tableName':_0x7b54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c10=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_companies'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0x0c10,0x1ba));var _0x00c1=function(_0x24c654,_0x3289ba){_0x24c654=_0x24c654-0x0;var _0x509d87=_0x0c10[_0x24c654];return _0x509d87;};'use strict';var _=require(_0x00c1('0x0'));var util=require(_0x00c1('0x1'));var logger=require(_0x00c1('0x2'))(_0x00c1('0x3'));var moment=require(_0x00c1('0x4'));var BPromise=require(_0x00c1('0x5'));var rp=require(_0x00c1('0x6'));var fs=require('fs');var path=require(_0x00c1('0x7'));var rimraf=require(_0x00c1('0x8'));var config=require(_0x00c1('0x9'));var attributes=require('./cmCompany.attributes');module[_0x00c1('0xa')]=function(_0x1c2f7d,_0x35af24){return _0x1c2f7d[_0x00c1('0xb')]('CmCompany',attributes,{'tableName':_0x00c1('0xc'),'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 25dddf6..ceec5d5 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 _0xe963=['client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5707e4,_0x3c580e){var _0x3fbff4=function(_0x2dff7f){while(--_0x2dff7f){_0x5707e4['push'](_0x5707e4['shift']());}};_0x3fbff4(++_0x3c580e);}(_0xe963,0x19c));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e96('0x0'));var util=require(_0x3e96('0x1'));var moment=require(_0x3e96('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e96('0x3'));var fs=require('fs');var Redis=require(_0x3e96('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e96('0x5'));var logger=require(_0x3e96('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3e96('0x7'));var client=jayson[_0x3e96('0x8')][_0x3e96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dfc5f,_0x523740,_0x3f6de7){return new BPromise(function(_0x18f21e,_0x1cdfb1){return client[_0x3e96('0xa')](_0x3dfc5f,_0x3f6de7)['then'](function(_0x15ecfe){logger[_0x3e96('0xb')](_0x3e96('0xc'),_0x523740,_0x3e96('0xd'));logger[_0x3e96('0xe')](_0x3e96('0xf'),_0x523740,'request\x20sent',JSON[_0x3e96('0x10')](_0x15ecfe));if(_0x15ecfe[_0x3e96('0x11')]){if(_0x15ecfe[_0x3e96('0x11')][_0x3e96('0x12')]===0x1f4){logger[_0x3e96('0x11')](_0x3e96('0xc'),_0x523740,_0x15ecfe[_0x3e96('0x11')][_0x3e96('0x13')]);return _0x1cdfb1(_0x15ecfe[_0x3e96('0x11')][_0x3e96('0x13')]);}logger[_0x3e96('0x11')](_0x3e96('0xc'),_0x523740,_0x15ecfe[_0x3e96('0x11')][_0x3e96('0x13')]);return _0x18f21e(_0x15ecfe[_0x3e96('0x11')][_0x3e96('0x13')]);}else{logger[_0x3e96('0xb')]('CmCompany,\x20%s,\x20%s',_0x523740,_0x3e96('0xd'));_0x18f21e(_0x15ecfe[_0x3e96('0x14')][_0x3e96('0x13')]);}})['catch'](function(_0x5b9e2f){logger[_0x3e96('0x11')](_0x3e96('0xc'),_0x523740,_0x5b9e2f);_0x1cdfb1(_0x5b9e2f);});});} \ No newline at end of file +var _0xdae2=['lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdae2,0x126));var _0x2dae=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xdae2[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x2dae('0x0'));var util=require(_0x2dae('0x1'));var moment=require(_0x2dae('0x2'));var BPromise=require(_0x2dae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2dae('0x5'))(_0x2dae('0x6'));var config=require(_0x2dae('0x7'));var jayson=require(_0x2dae('0x8'));var client=jayson[_0x2dae('0x9')][_0x2dae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8e4f94,_0xbde9e4,_0x4fb961){return new BPromise(function(_0x58df1b,_0x4a1469){return client[_0x2dae('0xb')](_0x8e4f94,_0x4fb961)['then'](function(_0x596815){logger['info'](_0x2dae('0xc'),_0xbde9e4,_0x2dae('0xd'));logger[_0x2dae('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xbde9e4,_0x2dae('0xd'),JSON[_0x2dae('0xf')](_0x596815));if(_0x596815[_0x2dae('0x10')]){if(_0x596815[_0x2dae('0x10')][_0x2dae('0x11')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0xbde9e4,_0x596815[_0x2dae('0x10')][_0x2dae('0x12')]);return _0x4a1469(_0x596815['error'][_0x2dae('0x12')]);}logger['error'](_0x2dae('0xc'),_0xbde9e4,_0x596815[_0x2dae('0x10')][_0x2dae('0x12')]);return _0x58df1b(_0x596815[_0x2dae('0x10')][_0x2dae('0x12')]);}else{logger[_0x2dae('0x13')](_0x2dae('0xc'),_0xbde9e4,_0x2dae('0xd'));_0x58df1b(_0x596815[_0x2dae('0x14')][_0x2dae('0x12')]);}})['catch'](function(_0x58b767){logger['error'](_0x2dae('0xc'),_0xbde9e4,_0x58b767);_0x4a1469(_0x58b767);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1a78e1d..f3c2030 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 _0xe530=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','put','update','delete'];(function(_0x1bc514,_0x21a15f){var _0x14661e=function(_0x4567cc){while(--_0x4567cc){_0x1bc514['push'](_0x1bc514['shift']());}};_0x14661e(++_0x21a15f);}(_0xe530,0x1ca));var _0x0e53=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe530[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x0e53('0x0'));var util=require('util');var path=require(_0x0e53('0x1'));var timeout=require('connect-timeout');var express=require(_0x0e53('0x2'));var router=express[_0x0e53('0x3')]();var fs_extra=require(_0x0e53('0x4'));var auth=require(_0x0e53('0x5'));var interaction=require(_0x0e53('0x6'));var config=require(_0x0e53('0x7'));var controller=require(_0x0e53('0x8'));router[_0x0e53('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e53('0x9')](_0x0e53('0xa'),auth[_0x0e53('0xb')](),controller[_0x0e53('0xc')]);router['get'](_0x0e53('0xd'),auth[_0x0e53('0xb')](),controller[_0x0e53('0xe')]);router[_0x0e53('0x9')](_0x0e53('0xf'),auth[_0x0e53('0xb')](),controller[_0x0e53('0x10')]);router[_0x0e53('0x11')]('/',auth['isAuthenticated'](),controller[_0x0e53('0x12')]);router[_0x0e53('0x11')](_0x0e53('0xf'),auth[_0x0e53('0xb')](),controller['addContacts']);router[_0x0e53('0x13')](_0x0e53('0xd'),auth[_0x0e53('0xb')](),controller[_0x0e53('0x14')]);router[_0x0e53('0x15')](_0x0e53('0xd'),auth[_0x0e53('0xb')](),controller[_0x0e53('0x16')]);module[_0x0e53('0x17')]=router; \ No newline at end of file +var _0x4c58=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','/:id/contacts','getContacts','post','addContacts'];(function(_0x241e28,_0x14a3c4){var _0x2c37f2=function(_0x8424cf){while(--_0x8424cf){_0x241e28['push'](_0x241e28['shift']());}};_0x2c37f2(++_0x14a3c4);}(_0x4c58,0x14e));var _0x84c5=function(_0xf2b9fa,_0x192dae){_0xf2b9fa=_0xf2b9fa-0x0;var _0x422042=_0x4c58[_0xf2b9fa];return _0x422042;};'use strict';var multer=require(_0x84c5('0x0'));var util=require(_0x84c5('0x1'));var path=require(_0x84c5('0x2'));var timeout=require(_0x84c5('0x3'));var express=require(_0x84c5('0x4'));var router=express[_0x84c5('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x84c5('0x6'));var config=require(_0x84c5('0x7'));var controller=require(_0x84c5('0x8'));router[_0x84c5('0x9')]('/',auth[_0x84c5('0xa')](),controller[_0x84c5('0xb')]);router[_0x84c5('0x9')]('/describe',auth[_0x84c5('0xa')](),controller['describe']);router[_0x84c5('0x9')](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0xd')]);router['get'](_0x84c5('0xe'),auth[_0x84c5('0xa')](),controller[_0x84c5('0xf')]);router[_0x84c5('0x10')]('/',auth[_0x84c5('0xa')](),controller['create']);router[_0x84c5('0x10')](_0x84c5('0xe'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x11')]);router[_0x84c5('0x12')](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x13')]);router['delete'](_0x84c5('0xc'),auth[_0x84c5('0xa')](),controller[_0x84c5('0x14')]);module[_0x84c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 8de9d0a..2decc50 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 _0x2b0a=['UNSIGNED','lodash','exports','STRING','TEXT','INTEGER'];(function(_0x4dc569,_0x327057){var _0x31c45f=function(_0x51fc37){while(--_0x51fc37){_0x4dc569['push'](_0x4dc569['shift']());}};_0x31c45f(++_0x327057);}(_0x2b0a,0xf1));var _0xa2b0=function(_0x4e9101,_0x478c76){_0x4e9101=_0x4e9101-0x0;var _0x235f02=_0x2b0a[_0x4e9101];return _0x235f02;};'use strict';var _=require(_0xa2b0('0x0'));var Sequelize=require('sequelize');module[_0xa2b0('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa2b0('0x2')]},'street':{'type':Sequelize[_0xa2b0('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa2b0('0x2')]},'country':{'type':Sequelize[_0xa2b0('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa2b0('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xa2b0('0x2')]},'fax':{'type':Sequelize[_0xa2b0('0x2')]},'email':{'type':Sequelize[_0xa2b0('0x2')]},'url':{'type':Sequelize[_0xa2b0('0x2')]},'facebook':{'type':Sequelize[_0xa2b0('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa2b0('0x2')]},'skype':{'type':Sequelize[_0xa2b0('0x2')]},'teams':{'type':Sequelize[_0xa2b0('0x2')]},'viber':{'type':Sequelize[_0xa2b0('0x2')]},'line':{'type':Sequelize[_0xa2b0('0x2')]},'wechat':{'type':Sequelize[_0xa2b0('0x2')]},'telegram':{'type':Sequelize[_0xa2b0('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xa2b0('0x2')]},'priority':{'type':Sequelize[_0xa2b0('0x4')](0x2)[_0xa2b0('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xa2b0('0x2')]},'utcOffset':{'type':Sequelize[_0xa2b0('0x4')]}}; \ No newline at end of file +var _0x88b7=['INTEGER','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x1b99bf,_0x335846){var _0x1edf66=function(_0x2401d2){while(--_0x2401d2){_0x1b99bf['push'](_0x1b99bf['shift']());}};_0x1edf66(++_0x335846);}(_0x88b7,0x152));var _0x788b=function(_0x508f71,_0x3dad77){_0x508f71=_0x508f71-0x0;var _0x5bb675=_0x88b7[_0x508f71];return _0x5bb675;};'use strict';var _=require(_0x788b('0x0'));var Sequelize=require(_0x788b('0x1'));module[_0x788b('0x2')]={'firstName':{'type':Sequelize[_0x788b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x788b('0x3')]},'street':{'type':Sequelize[_0x788b('0x3')]},'postalCode':{'type':Sequelize[_0x788b('0x3')]},'city':{'type':Sequelize[_0x788b('0x3')]},'country':{'type':Sequelize[_0x788b('0x3')]},'dateOfBirth':{'type':Sequelize[_0x788b('0x3')]},'description':{'type':Sequelize[_0x788b('0x4')]},'phone':{'type':Sequelize[_0x788b('0x3')]},'mobile':{'type':Sequelize[_0x788b('0x3')]},'fax':{'type':Sequelize[_0x788b('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x788b('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x788b('0x3')]},'twitter':{'type':Sequelize[_0x788b('0x3')]},'skype':{'type':Sequelize[_0x788b('0x3')]},'teams':{'type':Sequelize[_0x788b('0x3')]},'viber':{'type':Sequelize[_0x788b('0x3')]},'line':{'type':Sequelize[_0x788b('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x788b('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x788b('0x3')]},'priority':{'type':Sequelize[_0x788b('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x788b('0x6')]},'dialTimezone':{'type':Sequelize[_0x788b('0x3')]},'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 5bd2f07..be17525 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 _0x005d=['rawAttributes','sort','getTags','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','rows','getHopperHistories','CmHopperHistory','options','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_values','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','join','root','filename','chmodSync','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','firstName','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','mail','chat','sms','openchannel','fax','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','createdAt','userDisposition','userThirdDisposition','UserId','fullname','alias','range','VoiceCallReport','findAndCountAll','startCase','Account','closed','closedAt','disposition','thirdDisposition','Owner','browserName','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','moment','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','Content-Range','destroy','sendStatus','error','stack','name','index','CmContact','describe','then','keys','length','startsWith','push','CmCustomField','findOne','trimStart','all','cf_','fieldType','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','select','field','color','tools_tags','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','text','start','end','map','filter','isNil','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','QueryTypes','SELECT','DESC','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','role','sequelize','toString','count','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','params','tags','columnName','displayName','analytics','findAll','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','update','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperFinal','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','findOrCreate','spread','contact','show','Tag','Phones','ItemType','literal','$and','omit','format','cf_%d','setFields','id\x20=\x20?','toParam','values','phone'];(function(_0x34429f,_0x1e5e08){var _0xba2b7e=function(_0x39f467){while(--_0x39f467){_0x34429f['push'](_0x34429f['shift']());}};_0xba2b7e(++_0x1e5e08);}(_0x005d,0x1aa));var _0xd005=function(_0x3836f0,_0x195cf4){_0x3836f0=_0x3836f0-0x0;var _0x3b212b=_0x005d[_0x3836f0];return _0x3b212b;};'use strict';var moment=require(_0xd005('0x0'));var BPromise=require('bluebird');var util=require(_0xd005('0x1'));var path=require(_0xd005('0x2'));var fs=require('fs');var _=require(_0xd005('0x3'));var squel=require(_0xd005('0x4'));var Papa=require('papaparse');var Redis=require(_0xd005('0x5'));var qs=require(_0xd005('0x6'));var as=require(_0xd005('0x7'));var logger=require(_0xd005('0x8'))(_0xd005('0x9'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var db=require(_0xd005('0xa'))['db'];config[_0xd005('0xb')]=_[_0xd005('0xc')](config[_0xd005('0xb')],{'host':_0xd005('0xd'),'port':0x18eb});var socket=require(_0xd005('0xe'))(new Redis(config[_0xd005('0xb')]));require('./cmContact.socket')[_0xd005('0xf')](socket);function respondWithResult(_0x32ea46,_0x18eb9b){_0x18eb9b=_0x18eb9b||0xc8;return function(_0x2c9eb8){if(_0x2c9eb8){return _0x32ea46[_0xd005('0x10')](_0x18eb9b)[_0xd005('0x11')](_0x2c9eb8);}};}function respondWithFilteredResult(_0x5f294a,_0x42261f){return function(_0x3c05b1){if(_0x3c05b1){var _0x9c7018=typeof _0x42261f[_0xd005('0x12')]===_0xd005('0x13')&&typeof _0x42261f[_0xd005('0x14')]===_0xd005('0x13');var _0xf48010=_0x3c05b1['count'];var _0x2a1d02=_0x9c7018?0x0:_0x42261f[_0xd005('0x12')];var _0x563006=_0x9c7018?_0x3c05b1['count']:_0x42261f[_0xd005('0x12')]+_0x42261f[_0xd005('0x14')];var _0x255fa9;if(_0x563006>=_0xf48010){_0x563006=_0xf48010;_0x255fa9=0xc8;}else{_0x255fa9=0xce;}_0x5f294a[_0xd005('0x10')](_0x255fa9);return _0x5f294a['set'](_0xd005('0x15'),_0x2a1d02+'-'+_0x563006+'/'+_0xf48010)[_0xd005('0x11')](_0x3c05b1);}return null;};}function saveUpdates(_0x277cbf){return function(_0x198809){if(_0x198809){return _0x198809['update'](_0x277cbf)['then'](function(_0x4d9317){return _0x4d9317;});}return null;};}function removeEntity(_0x5d94db){return function(_0x51e9de){if(_0x51e9de){return _0x51e9de[_0xd005('0x16')]()['then'](function(){_0x5d94db[_0xd005('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x410c39){return function(_0x7e37e1){if(!_0x7e37e1){_0x410c39[_0xd005('0x17')](0x194);}return _0x7e37e1;};}function handleError(_0x25d814,_0xc58959){_0xc58959=_0xc58959||0x1f4;return function(_0x40e291){logger[_0xd005('0x18')](_0x40e291[_0xd005('0x19')]);if(_0x40e291[_0xd005('0x1a')]){delete _0x40e291[_0xd005('0x1a')];}_0x25d814[_0xd005('0x10')](_0xc58959)['send'](_0x40e291);};}exports[_0xd005('0x1b')]=function(_0x1bcea9,_0x2cef26){var _0x4e9736={},_0x4f7909={},_0x1e559b={'count':0x0,'rows':[]};return db[_0xd005('0x1c')][_0xd005('0x1d')]()[_0xd005('0x1e')](function(_0x20bc2a){var _0x4dbda4=[];for(var _0x640fdd=0x0;_0x640fdd0x1){_0x189c34['or'](_0xd005('0x62'),qs['getFullTextValue'](_0x56e2f0),null);}else{if(qs['isNumeric'](_0x56e2f0)){_0x189c34['or'](_0xd005('0x63'),_0x56e2f0+'%');_0x189c34['or']('c.phone\x20LIKE\x20?',_0x56e2f0+'%');_0x189c34['or'](_0xd005('0x64'),_0x56e2f0+'%');_0x189c34['or'](_0xd005('0x65'),_0x56e2f0+'%');}else if(qs[_0xd005('0x66')](_0x56e2f0)){_0x189c34['or'](_0xd005('0x67'),_0x56e2f0+'%');}else{_0x189c34['or'](_0xd005('0x68'),'%'+_0x56e2f0+'%');_0x189c34['or'](_0xd005('0x69'),'%'+_0x56e2f0+'%');_0x189c34['or']('c.email\x20LIKE\x20?','%'+_0x56e2f0+'%');}}}}_0x22e90a[_0xd005('0x32')](_0x189c34);_0x22e90a['group'](_0xd005('0x6a'));var _0x57ffc9={'type':db['Sequelize'][_0xd005('0x6b')][_0xd005('0x6c')],'raw':!![]};var _0x207431=_0x22e90a['clone']()[_0xd005('0x36')](_0xd005('0x6a'));if(_0x4e9736[_0xd005('0x31')]){_0x4e9736['order']['forEach'](function(_0x2b29bc){_0x22e90a['order']('c.'+_0x2b29bc[0x0],_0x2b29bc[0x1]===_0xd005('0x6d')?![]:!![]);});}if(!_[_0xd005('0x5b')](_0x2f1f13)){_0x22e90a['having'](_0x2d8376);_0x207431[_0xd005('0x32')]('t.id\x20IN\x20?',_0x2f1f13);}BPromise[_0xd005('0x6e')]()[_0xd005('0x1e')](function(){if(!_0x4b3c77)return;if(_0x1bcea9[_0xd005('0x6f')]['role']!==_0xd005('0x70'))return;if(!_[_0xd005('0x71')](_0x4b3c77[_0xd005('0x46')],[_0xd005('0x36'),_0xd005('0x4c')])){return _0x1bcea9['user'][_0xd005('0x72')]({'attributes':['id'],'raw':!![]})[_0xd005('0x1e')](function(_0x26f577){if(_[_0xd005('0x5b')](_0x26f577)){_0x207431[_0xd005('0x32')](_0xd005('0x73'));_0x22e90a[_0xd005('0x32')](_0xd005('0x73'));}else{_0x207431[_0xd005('0x32')]('c.ListId\x20IN\x20?',_[_0xd005('0x58')](_0x26f577,'id'));_0x22e90a['where'](_0xd005('0x74'),_['map'](_0x26f577,'id'));}});}})[_0xd005('0x1e')](function(){if(_0x1bcea9[_0xd005('0x6f')][_0xd005('0x75')]==='agent'&&!_0x4b3c77&&!_0x1bcea9[_0xd005('0x2b')][_0xd005('0x5c')])return[];return db[_0xd005('0x76')]['query'](_0x207431[_0xd005('0x77')](),_0x57ffc9);})['then'](function(_0x4d5563){_0x1e559b[_0xd005('0x78')]=_0x4d5563['length'];if(_0x1e559b[_0xd005('0x78')]===0x0)return[];return db[_0xd005('0x76')][_0xd005('0x2b')](_0x26f302[_0xd005('0x77')](),_0x57ffc9)[_0xd005('0x1e')](function(_0x464de5){_0x26d143=_[_0xd005('0x79')](_0x464de5,'id');_0x57ffc9=_[_0xd005('0x7a')](_0x57ffc9,{'model':db[_0xd005('0x1c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1bcea9['query']['fields']){_0x4e9736[_0xd005('0x2e')]['forEach'](function(_0x5124dc){_0x22e90a['field']('c.'+_0x5124dc);});}else{_0x22e90a['field']('c.id');_0x22e90a[_0xd005('0x36')](_0xd005('0x7b'));_0x22e90a['field'](_0xd005('0x7c'));_0x22e90a[_0xd005('0x36')](_0xd005('0x7d'));_0x22e90a[_0xd005('0x36')](_0xd005('0x7e'));_0x22e90a[_0xd005('0x36')]('c.fax');_0x22e90a[_0xd005('0x36')](_0xd005('0x7f'));_0x22e90a[_0xd005('0x36')](_0xd005('0x80'));_0x22e90a['field'](_0xd005('0x81'));_0x22e90a[_0xd005('0x36')]('c.deletedAt');_0x22e90a['field'](_0xd005('0x82'));_0x22e90a[_0xd005('0x36')](_0xd005('0x83'),_0xd005('0x84'));}if(_0x4e9736[_0xd005('0x14')])_0x22e90a['limit'](_0x4e9736[_0xd005('0x14')]);if(_0x4e9736['offset'])_0x22e90a['offset'](_0x4e9736[_0xd005('0x12')]);return db[_0xd005('0x76')]['query'](_0x22e90a[_0xd005('0x77')](),_0x57ffc9);});})['then'](function(_0x3d91b5){_0x3d91b5['forEach'](function(_0x1778e2){if(_0x1778e2[_0xd005('0x84')]){_0x1778e2[_0xd005('0x85')]=[];_0x1778e2[_0xd005('0x84')][_0xd005('0x48')](',')[_0xd005('0x49')](function(_0x33d52a){_0x1778e2[_0xd005('0x85')][_0xd005('0x22')](_0x26d143[_0x33d52a]);});}delete _0x1778e2[_0xd005('0x84')];});_0x1e559b['rows']=_0x3d91b5;return _0x1e559b;})[_0xd005('0x1e')](respondWithFilteredResult(_0x2cef26,_0x4e9736));})[_0xd005('0x86')](handleError(_0x2cef26,null));};exports[_0xd005('0x16')]=function(_0x1037c7,_0x147fca){return db[_0xd005('0x1c')][_0xd005('0x47')]({'where':{'id':_0x1037c7[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x147fca,null))['then'](removeEntity(_0x147fca,null))[_0xd005('0x86')](handleError(_0x147fca,null));};exports[_0xd005('0x1d')]=function(_0x34fced,_0x578e95){return db[_0xd005('0x1c')][_0xd005('0x1d')]()[_0xd005('0x1e')](function(_0x409ffc){delete _0x409ffc[_0xd005('0x88')];for(var _0xd9bfd8=0x0;_0xd9bfd80x0){return new Promise(function(_0x13de91,_0x2e3cac){var _0x4bae41=[];for(var _0x9fe83f=0x0;_0x9fe83f<_0xf13b70[_0xd005('0x20')];_0x9fe83f++){_0x4bae41[_0xd005('0x22')](insertAdditionalPhones(_0xf13b70[_0x9fe83f][_0xd005('0xb1')],_0xf13b70[_0x9fe83f][_0xd005('0xac')]));}Promise[_0xd005('0x26')](_0x4bae41)[_0xd005('0x1e')](function(){_0x13de91(0x1);});})['then'](function(){return{'success':_0x5d5753,'failure':_0x4ef0f6,'duplicates':_0x43dbb7};});}else{return{'success':_0x5d5753,'failure':_0x4ef0f6,'duplicates':_0x43dbb7};}}})[_0xd005('0x1e')](respondWithResult(_0x2da4e0,0xc9))[_0xd005('0x86')](handleError(_0x2da4e0,null));};exports[_0xd005('0xb2')]=function(_0x5b21e8,_0x5a0bd5){var _0xa340bb;return db['CmContact'][_0xd005('0x1d')]()['then'](function(_0x4acf17){return db['CmContact'][_0xd005('0x47')]({'where':{'id':_0x5b21e8[_0xd005('0x87')]['id']},'include':[{'model':db[_0xd005('0xb3')],'as':'Tags','attributes':['id',_0xd005('0x1a'),_0xd005('0x37')],'required':_0x5b21e8[_0xd005('0x2b')][_0xd005('0x5f')]?!![]:![]},{'model':db[_0xd005('0xa0')],'as':_0xd005('0xb4'),'where':{'CmContactId':_0x5b21e8['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xd005('0xb5')}]}],'order':[db[_0xd005('0x76')][_0xd005('0xb6')]('Phones.OrderBy')],'attributes':_['keys'](_0x4acf17)});})[_0xd005('0x1e')](function(_0x4c9b62){if(!_['isNil'](_0x4c9b62)){_0xa340bb=_0x4c9b62[_0xd005('0x8e')]({'plain':!![]});var _0x7df39f={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4c9b62&&_0x4c9b62[_0xd005('0x5c')]){if(_0x4c9b62['ListId']){_0x7df39f[_0xd005('0x32')][_0xd005('0xb7')][_0xd005('0x22')]({'ListId':{'$ne':_0x4c9b62[_0xd005('0x5c')]}});}}return db[_0xd005('0x23')]['findAll'](_0x7df39f);}})[_0xd005('0x1e')](function(_0x4fbdf3){if(!_[_0xd005('0x5a')](_0x4fbdf3)){return _[_0xd005('0xb8')](_0xa340bb,_[_0xd005('0x58')](_0x4fbdf3,function(_0x51f632){return util[_0xd005('0xb9')](_0xd005('0xba'),_0x51f632['id']);}));}})[_0xd005('0x1e')](handleEntityNotFound(_0x5a0bd5,null))['then'](respondWithResult(_0x5a0bd5,null))[_0xd005('0x86')](handleError(_0x5a0bd5,null));};exports[_0xd005('0x98')]=function(_0x100520,_0x4dcea7){var _0x4b4271;if(_0x100520['body']['id']){delete _0x100520[_0xd005('0x8d')]['id'];}if(!_[_0xd005('0x5a')](_0x100520[_0xd005('0x8d')][_0xd005('0xa9')])){var _0x4b9fdf=_0x100520[_0xd005('0x8d')][_0xd005('0xa9')];if(!_[_0xd005('0x5a')](shared[_0xd005('0xaa')][_0x4b9fdf]))_0x100520[_0xd005('0x8d')][_0xd005('0xab')]=shared[_0xd005('0xaa')][_0x4b9fdf][_0xd005('0xab')];}return db[_0xd005('0x1c')][_0xd005('0x47')]({'where':{'id':_0x100520[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x4dcea7,null))[_0xd005('0x1e')](saveUpdates(_0x100520['body'],null))[_0xd005('0x1e')](function(_0x26a685){_0x4b4271=_0x26a685;var _0x4b860a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x26a685&&_0x26a685[_0xd005('0x5c')]){if(_0x26a685[_0xd005('0x5c')]){_0x4b860a[_0xd005('0x32')][_0xd005('0xb7')]['push']({'ListId':{'$ne':_0x26a685['ListId']}});}}return db[_0xd005('0x23')][_0xd005('0x8c')](_0x4b860a);})['then'](function(_0x504fb1){if(_0x504fb1){return _['omit'](_['pickBy'](_0x100520[_0xd005('0x8d')],function(_0x3b4c3b,_0x5e62de){return _[_0xd005('0x21')](_0x5e62de,_0xd005('0x27'));}),_['map'](_0x504fb1,function(_0x5324c5){return util['format'](_0xd005('0xba'),_0x5324c5['id']);}));}})[_0xd005('0x1e')](function(_0x3716e3){if(_0x3716e3&&!_[_0xd005('0x5b')](_0x3716e3)){var _0x3c875f=squel[_0xd005('0x98')]()['table'](_0xd005('0x3a'))[_0xd005('0xbb')](_0x3716e3)[_0xd005('0x32')](_0xd005('0xbc'),_0x100520['params']['id'])[_0xd005('0xbd')]();return db[_0xd005('0x76')][_0xd005('0x2b')](_0x3c875f[_0xd005('0x55')],{'replacements':_0x3c875f[_0xd005('0xbe')]});}})[_0xd005('0x1e')](function(){if(_0x100520[_0xd005('0x8d')][_0xd005('0xbf')]&&_0x4b4271){return db[_0xd005('0x92')][_0xd005('0x98')]({'phone':_0x100520[_0xd005('0x8d')][_0xd005('0xbf')],'OrderBy':0x0},{'where':{'ContactId':_0x4b4271['id']}});}})[_0xd005('0x1e')](function(){return _0x4b4271;})[_0xd005('0x1e')](respondWithResult(_0x4dcea7,null))[_0xd005('0x86')](handleError(_0x4dcea7,null));};exports['getTags']=function(_0x6b5a75,_0xb4c17e){var _0xf52a02={};var _0x526c11={};var _0xd234cf;var _0x175cc9;return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0x6b5a75[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0xb4c17e,null))[_0xd005('0x1e')](function(_0x46047a){if(_0x46047a){_0xd234cf=_0x46047a;_0x526c11[_0xd005('0x2a')]=_[_0xd005('0x1f')](db['Tag'][_0xd005('0xc0')]);_0x526c11[_0xd005('0x2b')]=_[_0xd005('0x1f')](_0x6b5a75[_0xd005('0x2b')]);_0x526c11['filters']=_[_0xd005('0x2c')](_0x526c11[_0xd005('0x2a')],_0x526c11['query']);_0xf52a02[_0xd005('0x2e')]=_['intersection'](_0x526c11['model'],qs['fields'](_0x6b5a75['query']['fields']));_0xf52a02[_0xd005('0x2e')]=_0xf52a02[_0xd005('0x2e')][_0xd005('0x20')]?_0xf52a02[_0xd005('0x2e')]:_0x526c11['model'];_0xf52a02[_0xd005('0x31')]=qs[_0xd005('0xc1')](_0x6b5a75[_0xd005('0x2b')][_0xd005('0xc1')]);_0xf52a02['where']=qs['filters'](_[_0xd005('0x34')](_0x6b5a75['query'],_0x526c11[_0xd005('0x33')]));if(_0x6b5a75['query'][_0xd005('0x59')]){_0xf52a02['where']=_['merge'](_0xf52a02[_0xd005('0x32')],{'$or':_[_0xd005('0x58')](_0xf52a02[_0xd005('0x2e')],function(_0x302476){var _0x794211={};_0x794211[_0x302476]={'$like':'%'+_0x6b5a75[_0xd005('0x2b')][_0xd005('0x59')]+'%'};return _0x794211;})});}_0xf52a02=_['merge']({},_0xf52a02,_0x6b5a75['options']);return _0xd234cf[_0xd005('0xc2')](_0xf52a02);}})[_0xd005('0x1e')](function(_0x58174c){if(_0x58174c){_0x175cc9=_0x58174c['length'];if(!_0x6b5a75['query'][_0xd005('0x2f')](_0xd005('0x30'))){_0xf52a02['limit']=qs['limit'](_0x6b5a75[_0xd005('0x2b')][_0xd005('0x14')]);_0xf52a02[_0xd005('0x12')]=qs[_0xd005('0x12')](_0x6b5a75[_0xd005('0x2b')]['offset']);}return _0xd234cf[_0xd005('0xc2')](_0xf52a02);}})[_0xd005('0x1e')](function(_0x29d53f){if(_0x29d53f){return _0x29d53f?{'count':_0x175cc9,'rows':_0x29d53f}:null;}})['then'](respondWithResult(_0xb4c17e,null))[_0xd005('0x86')](handleError(_0xb4c17e,null));};exports[_0xd005('0xc3')]=function(_0x25e1a0,_0x53f70a){if(_0x25e1a0[_0xd005('0x8d')]['id']){delete _0x25e1a0[_0xd005('0x8d')]['id'];}return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0x25e1a0[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x53f70a,null))[_0xd005('0x1e')](function(_0x194639){if(_0x194639){return _0x194639[_0xd005('0xc3')](_0x25e1a0['body'][_0xd005('0xc4')]||[]);}return null;})[_0xd005('0x1e')](respondWithResult(_0x53f70a,null))[_0xd005('0x86')](handleError(_0x53f70a,null));};exports[_0xd005('0xc5')]=function(_0x4030c1,_0xc9f044){var _0x2bd7e6=[];_0x2bd7e6[_0xd005('0x22')](addAdditionalPhones(_0x4030c1[_0xd005('0x8d')]));Promise[_0xd005('0x26')](_0x2bd7e6)[_0xd005('0x1e')](function(){_0x2bd7e6=[];_0x2bd7e6[_0xd005('0x22')](deleteCmHopperPhones(_0x4030c1['body']['id']));_0x2bd7e6[_0xd005('0x22')](addCmHopperPhones(_0x4030c1[_0xd005('0x8d')]['id']));Promise[_0xd005('0x26')](_0x2bd7e6)[_0xd005('0x1e')](function(){return[0x1];})[_0xd005('0x1e')](respondWithResult(_0xc9f044,null));});};function addAdditionalPhones(_0x28844b){var _0x5c0167;return new Promise(function(_0x4dfc87,_0x941c96){return db[_0xd005('0xa0')]['destroy']({'where':{'CmContactId':_0x28844b['id']}})[_0xd005('0x1e')](function(){db[_0xd005('0xc6')][_0xd005('0x8c')]({'raw':!![],'attributes':['id',_0xd005('0xc7')]})[_0xd005('0x1e')](function(_0x2694aa){var _0x2dfbc6=[];for(var _0xe9efdf=0x0;_0xe9efdf<_0x28844b[_0xd005('0xc8')][_0xd005('0x20')];_0xe9efdf++){var _0x424a3b=_0x28844b['item_types']?_[_0xd005('0x5a')](_0x28844b[_0xd005('0xc9')][_0xe9efdf])?'':_0x28844b[_0xd005('0xc9')][_0xe9efdf]:_0x28844b[_0xd005('0xc8')][_0xe9efdf][_0xd005('0xca')]?_0x28844b[_0xd005('0xc8')][_0xe9efdf][_0xd005('0xca')]:'';var _0xda6e7a=_[_0xd005('0x5a')](_0x28844b[_0xd005('0xc8')][_0xe9efdf]['description'])?'':_0x28844b['items'][_0xe9efdf][_0xd005('0xcb')];var _0x257859=_0x424a3b+':'+_0x28844b[_0xd005('0xc8')][_0xe9efdf][_0xd005('0xbf')]+'§'+_0xda6e7a;if(_[_0xd005('0x5a')](_0x5c0167))_0x5c0167=_0x257859;else _0x5c0167+=';'+_0x257859;var _0x5214d7=null;if(_0x28844b[_0xd005('0xc9')]){if(!_[_0xd005('0x5a')](_0x28844b[_0xd005('0xc9')][_0xe9efdf])){var _0x4ca5a0=_[_0xd005('0x47')](_0x2694aa,function(_0x45f52f){return _0x45f52f['id']===_0x28844b[_0xd005('0xc9')][_0xe9efdf];});if(!_['isNil'](_0x4ca5a0)){_0x5214d7=_0x4ca5a0[_0xd005('0xc7')];}}}else{if(!_['isNil'](_0x28844b['items'][_0xe9efdf])){var _0x4ca5a0=_[_0xd005('0x47')](_0x2694aa,function(_0x1a2efe){return _0x1a2efe['id']===_0x28844b[_0xd005('0xc8')][_0xe9efdf][_0xd005('0xca')];});if(!_[_0xd005('0x5a')](_0x4ca5a0)){_0x5214d7=_0xe9efdf;}}}if(_[_0xd005('0x5a')](_0x5214d7)){_0x5214d7=0x64;}_0x2dfbc6[_0xd005('0x22')](addAdditionalPhone(_0x28844b['id'],_0x28844b['items'][_0xe9efdf][_0xd005('0xbf')],_0x28844b[_0xd005('0xc9')]?_[_0xd005('0x5a')](_0x28844b[_0xd005('0xc9')][_0xe9efdf])?null:_0x28844b[_0xd005('0xc9')][_0xe9efdf]:_0x28844b['items'][_0xe9efdf][_0xd005('0xca')]?_0x28844b[_0xd005('0xc8')][_0xe9efdf][_0xd005('0xca')]:null,_0x5214d7,_0xda6e7a));}Promise[_0xd005('0x26')](_0x2dfbc6)[_0xd005('0x1e')](function(){db[_0xd005('0x1c')][_0xd005('0x98')]({'AdditionalPhones':_0x5c0167},{'where':{'id':_0x28844b['id']}})[_0xd005('0x1e')](function(){_0x4dfc87(0x1);});});});});});}function addAdditionalPhone(_0x34c931,_0x23f0b0,_0x8afecd,_0x375ffc,_0x12e3ea){return db['CmContactHasItem'][_0xd005('0x47')]({'where':{'CmContactId':_0x34c931,'item':_0x23f0b0}})[_0xd005('0x1e')](function(_0x541047){if(_0x541047)logger[_0xd005('0x90')](_0xd005('0xcc'),_0x541047);else{db[_0xd005('0xa0')][_0xd005('0x96')]({'CmContactId':_0x34c931,'item':_0x23f0b0,'ItemTypeId':_0x8afecd,'OrderBy':_0x375ffc,'ItemClass':_0xd005('0xcd'),'description':_0x12e3ea});}});}function deletePhones(_0x5cf2aa){return db[_0xd005('0xa0')][_0xd005('0x16')]({'where':{'CmContactId':_0x5cf2aa}});}function deleteCmHopperPhones(_0x21e0e8){return new Promise(function(_0x2851c1,_0x564de3){return db[_0xd005('0x92')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x21e0e8}})['then'](function(_0xbdedaa){db[_0xd005('0xce')][_0xd005('0x16')]({'where':{'CmHopperId':{'$in':_[_0xd005('0x58')](_0xbdedaa,'id')}}});})[_0xd005('0x1e')](function(){_0x2851c1(0x1);});});}function addCmHopperPhones(_0xb3169f){return new Promise(function(_0x36285e,_0x81d263){return db[_0xd005('0x92')][_0xd005('0x8c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb3169f}})[_0xd005('0x1e')](function(_0x48f2b8){var _0x585647=[];_[_0xd005('0x58')](_0x48f2b8,function(_0xc00e3c){_0x585647['push'](createCmHopperPhone(_0xb3169f,_0xc00e3c['id']));});Promise[_0xd005('0x26')](_0x585647)[_0xd005('0x1e')](function(){_0x36285e(0x1);});});});}function createCmHopperPhone(_0x1ef323,_0x5b0de8){return new Promise(function(_0x39d0dd,_0xa98811){db[_0xd005('0xa0')][_0xd005('0x8c')]({'raw':!![],'attributes':[_0xd005('0xcf'),_0xd005('0xc7')],'where':{'CmContactId':_0x1ef323,'ItemClass':'PHONE'},'include':[{'model':db[_0xd005('0xc6')],'attributes':[_0xd005('0xc7')],'as':_0xd005('0xb5')}],'order':[_0xd005('0xc7'),db['sequelize'][_0xd005('0xb6')](_0xd005('0xd0'))]})[_0xd005('0x1e')](function(_0x3045f5){var _0x5bd8ed=0x1;var _0x59aa92=_[_0xd005('0x58')](_0x3045f5,function(_0x185070){_0x185070[_0xd005('0xd1')]=_0x5b0de8;_0x185070[_0xd005('0xbf')]=_0x185070[_0xd005('0xcf')];_0x185070[_0xd005('0xc7')]=_0x5bd8ed;delete _0x185070['ItemType.OrderBy'];_0x5bd8ed=_0x5bd8ed+0x1;return _0x185070;});return db[_0xd005('0xce')]['bulkCreate'](_0x59aa92,{});})[_0xd005('0x1e')](function(){_0x39d0dd(0x1);});});}function insertAdditionalPhones(_0x364e7b,_0x24757e){return new Promise(function(_0x48efdd,_0x5e87d9){var _0x1661b7=[];for(var _0x46423c=0x0;_0x46423c<_0x24757e[_0xd005('0x20')];_0x46423c++){var _0x351115=_0x24757e[_0x46423c];_0x1661b7[_0xd005('0x22')](parseContactItemType(_0x351115));}Promise['all'](_0x1661b7)[_0xd005('0x1e')](function(){var _0x55c360={'id':_0x364e7b['id'],'items':_0x24757e};return addAdditionalPhones(_0x55c360)[_0xd005('0x1e')](function(_0xe6c0f1){return addCmHopperPhones(_0x364e7b['id']);});})[_0xd005('0x1e')](function(){_0x48efdd(_0x364e7b);});});}function parseContactItemType(_0x8fbc26){return new Promise(function(_0x491cf1,_0x5309ac){if(_0x8fbc26[_0xd005('0x2f')](_0xd005('0xca'))){_0x491cf1(_0x8fbc26);}else{return db[_0xd005('0xc6')][_0xd005('0x47')]({'where':{'name':_0x8fbc26['ItemType']}})[_0xd005('0x1e')](function(_0x4214cf){if(_[_0xd005('0x5a')](_0x4214cf))_0x8fbc26[_0xd005('0xca')]=null;else _0x8fbc26[_0xd005('0xca')]=_0x4214cf['id'];_0x491cf1(_0x8fbc26);});}});}exports[_0xd005('0xd2')]=function(_0x17af5b,_0x3d777d){return db[_0xd005('0xa0')][_0xd005('0x8c')]({'raw':!![],'where':{'CmContactId':_0x17af5b[_0xd005('0x87')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xd005('0xc6')],'as':_0xd005('0xb5')}],'order':[[_0xd005('0xc7')],[db['sequelize']['literal']('`ItemType`.OrderBy')]]})[_0xd005('0x1e')](function(_0x19dfbb){return _0x19dfbb;})['then'](respondWithResult(_0x3d777d,null))[_0xd005('0x86')](handleError(_0x3d777d,null));};exports[_0xd005('0xd3')]=function(_0x5bf2a5,_0x305089){return db[_0xd005('0xa0')][_0xd005('0x8c')]({'raw':!![],'where':{'CmContactId':_0x5bf2a5[_0xd005('0x8d')][_0xd005('0xd4')]}})[_0xd005('0x1e')](function(_0x5b369b){var _0x2e6c84=_['map'](_0x5b369b,function(_0x36efd7){_0x36efd7[_0xd005('0xd5')]=_0x5bf2a5[_0xd005('0x8d')][_0xd005('0xd6')];return _0x36efd7;});return db[_0xd005('0xa0')]['bulkCreate'](_0x2e6c84,{});})['then'](function(_0x4e0518){return addCmHopperPhones(_0x5bf2a5[_0xd005('0x8d')][_0xd005('0xd6')]);})[_0xd005('0x1e')](function(_0x707ff){return['ok'];})['then'](respondWithResult(_0x305089,null))['catch'](handleError(_0x305089,null));};exports[_0xd005('0xd7')]=function(_0x4b8338,_0x5da639){var _0x49317d=[];_0x49317d[_0xd005('0x22')](createCmHopperPhone(_0x4b8338[_0xd005('0x8d')]['id'],_0x4b8338['body'][_0xd005('0xd8')]));Promise[_0xd005('0x26')](_0x49317d)['then'](function(){return[0x1];})[_0xd005('0x1e')](respondWithResult(_0x5da639,null));};exports[_0xd005('0xd9')]=function(_0x90e69d,_0x10442d){var _0x5507d2={'raw':![],'where':{}};var _0x1e4034={};var _0x2ccc95={'count':0x0,'rows':[]};return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0x90e69d['params']['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x10442d,null))['then'](function(_0x1047d0){if(_0x1047d0){_0x1e4034[_0xd005('0x2a')]=_[_0xd005('0x1f')](db[_0xd005('0x92')][_0xd005('0xc0')]);_0x1e4034[_0xd005('0x2b')]=_['keys'](_0x90e69d[_0xd005('0x2b')]);_0x1e4034[_0xd005('0x33')]=_[_0xd005('0x2c')](_0x1e4034[_0xd005('0x2a')],_0x1e4034['query']);_0x5507d2[_0xd005('0x2e')]=_[_0xd005('0x2c')](_0x1e4034[_0xd005('0x2a')],qs[_0xd005('0x2d')](_0x90e69d['query'][_0xd005('0x2d')]));_0x5507d2['attributes']=_0x5507d2[_0xd005('0x2e')][_0xd005('0x20')]?_0x5507d2['attributes']:_0x1e4034[_0xd005('0x2a')];if(!_0x90e69d[_0xd005('0x2b')][_0xd005('0x2f')]('nolimit')){_0x5507d2[_0xd005('0x14')]=qs['limit'](_0x90e69d[_0xd005('0x2b')][_0xd005('0x14')]);_0x5507d2[_0xd005('0x12')]=qs[_0xd005('0x12')](_0x90e69d[_0xd005('0x2b')]['offset']);}_0x5507d2['order']=qs['sort'](_0x90e69d[_0xd005('0x2b')][_0xd005('0xc1')]);_0x5507d2['where']=qs[_0xd005('0x33')](_[_0xd005('0x34')](_0x90e69d[_0xd005('0x2b')],_0x1e4034[_0xd005('0x33')]));_0x5507d2[_0xd005('0x32')][_0xd005('0xda')]=_0x1047d0['id'];if(_0x90e69d[_0xd005('0x2b')][_0xd005('0x59')]){_0x5507d2['where']=_[_0xd005('0x7a')](_0x5507d2[_0xd005('0x32')],{'$or':_['map'](_0x5507d2['attributes'],function(_0x569069){var _0xdbee6a={};_0xdbee6a[_0x569069]={'$like':'%'+_0x90e69d['query'][_0xd005('0x59')]+'%'};return _0xdbee6a;})});}_0x5507d2=_[_0xd005('0x7a')]({},_0x5507d2,_0x90e69d['options']);return db[_0xd005('0x92')][_0xd005('0x78')]({'where':_0x5507d2['where']})[_0xd005('0x1e')](function(_0x1e62c6){_0x2ccc95[_0xd005('0x78')]=_0x1e62c6;if(_0x90e69d[_0xd005('0x2b')][_0xd005('0xdb')]){_0x5507d2[_0xd005('0xdc')]=[{'all':!![]}];}return db[_0xd005('0x92')]['findAll'](_0x5507d2);})['then'](function(_0x44aa78){_0x2ccc95[_0xd005('0xdd')]=_0x44aa78;return _0x2ccc95;});}})['then'](respondWithFilteredResult(_0x10442d,_0x5507d2))['catch'](handleError(_0x10442d,null));};exports[_0xd005('0xde')]=function(_0x51d582,_0x2f2fba){var _0x5b5899={'raw':!![],'where':{}};var _0x521634={};var _0x33300a={'count':0x0,'rows':[]};return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0x51d582[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x2f2fba,null))[_0xd005('0x1e')](function(_0x5efb65){if(_0x5efb65){_0x521634[_0xd005('0x2a')]=_[_0xd005('0x1f')](db[_0xd005('0xdf')][_0xd005('0xc0')]);_0x521634[_0xd005('0x2b')]=_[_0xd005('0x1f')](_0x51d582['query']);_0x521634[_0xd005('0x33')]=_[_0xd005('0x2c')](_0x521634[_0xd005('0x2a')],_0x521634[_0xd005('0x2b')]);_0x5b5899['attributes']=_[_0xd005('0x2c')](_0x521634['model'],qs['fields'](_0x51d582[_0xd005('0x2b')][_0xd005('0x2d')]));_0x5b5899[_0xd005('0x2e')]=_0x5b5899[_0xd005('0x2e')][_0xd005('0x20')]?_0x5b5899[_0xd005('0x2e')]:_0x521634[_0xd005('0x2a')];if(!_0x51d582[_0xd005('0x2b')][_0xd005('0x2f')]('nolimit')){_0x5b5899['limit']=qs[_0xd005('0x14')](_0x51d582[_0xd005('0x2b')][_0xd005('0x14')]);_0x5b5899[_0xd005('0x12')]=qs[_0xd005('0x12')](_0x51d582['query']['offset']);}_0x5b5899[_0xd005('0x31')]=qs[_0xd005('0xc1')](_0x51d582[_0xd005('0x2b')][_0xd005('0xc1')]);_0x5b5899[_0xd005('0x32')]=qs[_0xd005('0x33')](_[_0xd005('0x34')](_0x51d582[_0xd005('0x2b')],_0x521634[_0xd005('0x33')]));_0x5b5899[_0xd005('0x32')][_0xd005('0xda')]=_0x5efb65['id'];if(_0x51d582[_0xd005('0x2b')]['filter']){_0x5b5899['where']=_[_0xd005('0x7a')](_0x5b5899[_0xd005('0x32')],{'$or':_[_0xd005('0x58')](_0x5b5899[_0xd005('0x2e')],function(_0x19e383){var _0x1461e0={};_0x1461e0[_0x19e383]={'$like':'%'+_0x51d582[_0xd005('0x2b')][_0xd005('0x59')]+'%'};return _0x1461e0;})});}_0x5b5899=_[_0xd005('0x7a')]({},_0x5b5899,_0x51d582[_0xd005('0xe0')]);return db[_0xd005('0xdf')][_0xd005('0x78')]({'where':_0x5b5899[_0xd005('0x32')]})['then'](function(_0x4cb51d){_0x33300a[_0xd005('0x78')]=_0x4cb51d;if(_0x51d582[_0xd005('0x2b')][_0xd005('0xdb')]){_0x5b5899[_0xd005('0xdc')]=[{'all':!![]}];}return db[_0xd005('0xdf')][_0xd005('0x8c')](_0x5b5899);})[_0xd005('0x1e')](function(_0x559f44){_0x33300a[_0xd005('0xdd')]=_0x559f44;return _0x33300a;});}})['then'](respondWithFilteredResult(_0x2f2fba,_0x5b5899))['catch'](handleError(_0x2f2fba,null));};exports[_0xd005('0xe1')]=function(_0x26b737,_0xd0278e){var _0x3ef6f6={'raw':!![],'where':{}};var _0x215f6c={};var _0x1a10aa={'count':0x0,'rows':[]};return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0x26b737[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0xd0278e,null))[_0xd005('0x1e')](function(_0xd7277f){if(_0xd7277f){_0x215f6c[_0xd005('0x2a')]=_[_0xd005('0x1f')](db['CmHopperFinal'][_0xd005('0xc0')]);_0x215f6c[_0xd005('0x2b')]=_[_0xd005('0x1f')](_0x26b737[_0xd005('0x2b')]);_0x215f6c[_0xd005('0x33')]=_['intersection'](_0x215f6c[_0xd005('0x2a')],_0x215f6c[_0xd005('0x2b')]);_0x3ef6f6[_0xd005('0x2e')]=_[_0xd005('0x2c')](_0x215f6c[_0xd005('0x2a')],qs[_0xd005('0x2d')](_0x26b737[_0xd005('0x2b')][_0xd005('0x2d')]));_0x3ef6f6[_0xd005('0x2e')]=_0x3ef6f6[_0xd005('0x2e')][_0xd005('0x20')]?_0x3ef6f6['attributes']:_0x215f6c[_0xd005('0x2a')];if(!_0x26b737['query'][_0xd005('0x2f')]('nolimit')){_0x3ef6f6[_0xd005('0x14')]=qs[_0xd005('0x14')](_0x26b737[_0xd005('0x2b')][_0xd005('0x14')]);_0x3ef6f6[_0xd005('0x12')]=qs[_0xd005('0x12')](_0x26b737[_0xd005('0x2b')]['offset']);}_0x3ef6f6['order']=qs[_0xd005('0xc1')](_0x26b737[_0xd005('0x2b')]['sort']);_0x3ef6f6[_0xd005('0x32')]=qs[_0xd005('0x33')](_[_0xd005('0x34')](_0x26b737[_0xd005('0x2b')],_0x215f6c[_0xd005('0x33')]));_0x3ef6f6[_0xd005('0x32')][_0xd005('0xda')]=_0xd7277f['id'];if(_0x26b737[_0xd005('0x2b')][_0xd005('0x59')]){_0x3ef6f6[_0xd005('0x32')]=_[_0xd005('0x7a')](_0x3ef6f6[_0xd005('0x32')],{'$or':_['map'](_0x3ef6f6['attributes'],function(_0x28321f){var _0x4c70c6={};_0x4c70c6[_0x28321f]={'$like':'%'+_0x26b737[_0xd005('0x2b')][_0xd005('0x59')]+'%'};return _0x4c70c6;})});}_0x3ef6f6=_['merge']({},_0x3ef6f6,_0x26b737[_0xd005('0xe0')]);return db[_0xd005('0xa1')][_0xd005('0x78')]({'where':_0x3ef6f6[_0xd005('0x32')]})[_0xd005('0x1e')](function(_0x355701){_0x1a10aa[_0xd005('0x78')]=_0x355701;if(_0x26b737[_0xd005('0x2b')][_0xd005('0xdb')]){_0x3ef6f6['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x3ef6f6);})[_0xd005('0x1e')](function(_0x53a880){_0x1a10aa[_0xd005('0xdd')]=_0x53a880;return _0x1a10aa;});}})['then'](respondWithFilteredResult(_0xd0278e,_0x3ef6f6))[_0xd005('0x86')](handleError(_0xd0278e,null));};exports[_0xd005('0xe2')]=function(_0xe658,_0x16720a){var _0x20bdb3={'raw':!![],'where':{}};var _0x25e3b7={};var _0x4eabcf={'count':0x0,'rows':[]};return db[_0xd005('0x1c')][_0xd005('0x24')]({'where':{'id':_0xe658[_0xd005('0x87')]['id']}})[_0xd005('0x1e')](handleEntityNotFound(_0x16720a,null))[_0xd005('0x1e')](function(_0x59d6b8){if(_0x59d6b8){_0x25e3b7[_0xd005('0x2a')]=_[_0xd005('0x1f')](db[_0xd005('0xe3')]['rawAttributes']);_0x25e3b7[_0xd005('0x2b')]=_[_0xd005('0x1f')](_0xe658[_0xd005('0x2b')]);_0x25e3b7[_0xd005('0x33')]=_[_0xd005('0x2c')](_0x25e3b7[_0xd005('0x2a')],_0x25e3b7['query']);_0x20bdb3[_0xd005('0x2e')]=_['intersection'](_0x25e3b7['model'],qs[_0xd005('0x2d')](_0xe658[_0xd005('0x2b')]['fields']));_0x20bdb3[_0xd005('0x2e')]=_0x20bdb3[_0xd005('0x2e')][_0xd005('0x20')]?_0x20bdb3[_0xd005('0x2e')]:_0x25e3b7[_0xd005('0x2a')];if(!_0xe658[_0xd005('0x2b')][_0xd005('0x2f')](_0xd005('0x30'))){_0x20bdb3[_0xd005('0x14')]=qs['limit'](_0xe658[_0xd005('0x2b')][_0xd005('0x14')]);_0x20bdb3[_0xd005('0x12')]=qs[_0xd005('0x12')](_0xe658['query'][_0xd005('0x12')]);}_0x20bdb3[_0xd005('0x31')]=qs[_0xd005('0xc1')](_0xe658[_0xd005('0x2b')][_0xd005('0xc1')]);_0x20bdb3['where']=qs[_0xd005('0x33')](_['pick'](_0xe658[_0xd005('0x2b')],_0x25e3b7[_0xd005('0x33')]));_0x20bdb3[_0xd005('0x32')][_0xd005('0xda')]=_0x59d6b8['id'];if(_0xe658[_0xd005('0x2b')][_0xd005('0x59')]){_0x20bdb3[_0xd005('0x32')]=_['merge'](_0x20bdb3[_0xd005('0x32')],{'$or':_[_0xd005('0x58')](_0x20bdb3[_0xd005('0x2e')],function(_0x56e62c){var _0x4272b2={};_0x4272b2[_0x56e62c]={'$like':'%'+_0xe658[_0xd005('0x2b')][_0xd005('0x59')]+'%'};return _0x4272b2;})});}_0x20bdb3=_[_0xd005('0x7a')]({},_0x20bdb3,_0xe658[_0xd005('0xe0')]);return db[_0xd005('0xe3')][_0xd005('0x78')]({'where':_0x20bdb3[_0xd005('0x32')]})['then'](function(_0x171498){_0x4eabcf[_0xd005('0x78')]=_0x171498;if(_0xe658['query'][_0xd005('0xdb')]){_0x20bdb3[_0xd005('0xdc')]=[{'all':!![]}];}return db[_0xd005('0xe3')][_0xd005('0x8c')](_0x20bdb3);})['then'](function(_0x3c8810){_0x4eabcf['rows']=_0x3c8810;return _0x4eabcf;});}})[_0xd005('0x1e')](respondWithFilteredResult(_0x16720a,_0x20bdb3))['catch'](handleError(_0x16720a,null));};exports[_0xd005('0xe4')]=function(_0x2f294c,_0x5215a5){try{if(!_0x2f294c[_0xd005('0x8d')][_0xd005('0x5c')]){throw new Error(_0xd005('0xe5'));}if(!_0x2f294c[_0xd005('0x8d')][_0xd005('0xe6')]){throw new Error(_0xd005('0xe7'));}if(!_0x2f294c[_0xd005('0x8d')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2f294c['body'][_0xd005('0xe8')]){throw new Error(_0xd005('0xe9'));}var _0x2d7442=_0x2f294c[_0xd005('0x8d')][_0xd005('0xe6')][_0xd005('0x48')](',');var _0x3e2452=_0x2f294c[_0xd005('0x8d')][_0xd005('0xea')][_0xd005('0x48')](',');if(!_0x2d7442[_0xd005('0x20')]||!_0x3e2452[_0xd005('0x20')]||_0x2d7442[_0xd005('0x20')]!==_0x3e2452['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2f294c[_0xd005('0x8d')][_0xd005('0x2d')]=_[_0xd005('0xeb')](_0x2d7442,_0x3e2452);if(!_0x2f294c[_0xd005('0x8d')][_0xd005('0x2d')][_0xd005('0xbf')]){throw new Error(_0xd005('0xec'));}if(!_0x2f294c[_0xd005('0x8d')]['fields']['firstName']){throw new Error(_0xd005('0xed'));}var _0x26b8dd=path[_0xd005('0xee')](config[_0xd005('0xef')],'server/files/tmp',_0x2f294c['file'][_0xd005('0xf0')]);fs[_0xd005('0xf1')](_0x26b8dd,parseInt('0777',0x8));var _0x2466c0=require(_0xd005('0xf2'))[_0xd005('0xf3')](path[_0xd005('0xee')](__dirname,'../../components/import/cm/csv'),[_0x26b8dd,_0x2f294c['body'][_0xd005('0xe6')],_0x2f294c[_0xd005('0x8d')][_0xd005('0xea')],_0x2f294c[_0xd005('0x8d')]['ListId'],_0x2f294c[_0xd005('0x8d')][_0xd005('0xf4')],_0x2f294c[_0xd005('0x8d')]['duplicates'],_0x2f294c[_0xd005('0x8d')][_0xd005('0xe8')]]);return _0x5215a5[_0xd005('0x10')](0xc8)['json']({'message':_0xd005('0xf5'),'pid':_0x2466c0[_0xd005('0xf6')]});}catch(_0x50d954){return _0x5215a5[_0xd005('0x10')](0x1f4)['send'](_0x50d954);}};exports[_0xd005('0xf7')]=function(_0x2ce709,_0x34bad3){var _0x17a633=fs[_0xd005('0xf8')](_0x2ce709['file'][_0xd005('0x2')]);Papa[_0xd005('0xf9')](_0x17a633,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5677da){return _0x34bad3['status'](0xc8)[_0xd005('0x11')]({'file':_0x2ce709['file'],'fields':_0x5677da[_0xd005('0xfa')][_0xd005('0x2d')]});}});};exports[_0xd005('0xfb')]=function(_0xc2951c,_0x5943fc){return db[_0xd005('0x4c')][_0xd005('0x8c')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xd005('0x1e')](function(_0x4abf38){var _0x141244=![];if(!_0xc2951c[_0xd005('0x8d')][_0xd005('0x5c')]){throw new Error('No\x20ListId\x20specified');}if(!_0xc2951c[_0xd005('0x8d')][_0xd005('0xfc')][_0xd005('0xbf')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xc2951c['body'][_0xd005('0xfc')][_0xd005('0xfd')]){throw new Error(_0xd005('0xed'));}if(!_0xc2951c['body'][_0xd005('0xe8')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x32f342=require('child_process')[_0xd005('0xf3')](path[_0xd005('0xee')](__dirname,'../../components/import/cm/csv2'),[_0xc2951c['params']['id'],JSON['stringify'](_0xc2951c['body']),JSON[_0xd005('0xfe')](_0x4abf38)]);_0x32f342['on'](_0xd005('0xff'),function(){_0x141244=!![];return _0x5943fc[_0xd005('0x10')](0xc8)[_0xd005('0x11')]({'message':_0xd005('0x100'),'pid':_0x32f342[_0xd005('0xf6')]});});_0x32f342['on'](_0xd005('0x101'),function(_0x58b946){if(_0x58b946&&!_0x141244){return _0x5943fc[_0xd005('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x32f342[_0xd005('0xf6')]});}});})[_0xd005('0x86')](handleError(_0x5943fc,null));};exports['importUpdates']=function(_0x2ccc4e,_0x5069c0,_0x49b2af){return db['User'][_0xd005('0x8c')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd005('0x70')}})[_0xd005('0x1e')](function(_0x2bf6cf){var _0x125f8d=![];if(!_0x2ccc4e[_0xd005('0x8d')][_0xd005('0x5c')]){throw new Error(_0xd005('0xe5'));}if(!_0x2ccc4e[_0xd005('0x8d')][_0xd005('0xfc')]['phone']){throw new Error(_0xd005('0xec'));}if(!_0x2ccc4e['body'][_0xd005('0xfc')][_0xd005('0xfd')]){throw new Error(_0xd005('0xed'));}if(!_0x2ccc4e[_0xd005('0x8d')][_0xd005('0xe8')]){throw new Error(_0xd005('0xe9'));}var _0x12c6fd=require(_0xd005('0xf2'))[_0xd005('0xf3')](path[_0xd005('0xee')](__dirname,'../../components/import/cm/csvUpdates'),[_0x2ccc4e['params']['id'],JSON[_0xd005('0xfe')](_0x2ccc4e[_0xd005('0x8d')]),JSON[_0xd005('0xfe')](_0x2bf6cf)]);_0x12c6fd['on'](_0xd005('0xff'),function(_0x446e2e){_0x125f8d=!![];return _0x5069c0[_0xd005('0x10')](0xc8)[_0xd005('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x12c6fd['pid']});});_0x12c6fd['on']('exit',function(_0x23e06e){if(_0x23e06e&&!_0x125f8d){return _0x5069c0[_0xd005('0x10')](0x1f4)[_0xd005('0x11')]({'message':_0xd005('0x102'),'pid':_0x12c6fd['pid']});}});})[_0xd005('0x86')](handleError(_0x5069c0,null));};exports['getJourney']=function(_0x316cd9,_0x227d99){var _0x5c0ede=[_0xd005('0x103'),_0xd005('0x104'),_0xd005('0x105'),_0xd005('0x106'),_0xd005('0x107'),'whatsapp',_0xd005('0x108')];var _0x29f4a1={'offset':0x0,'order':qs[_0xd005('0xc1')](_0xd005('0x109'))},_0x34a0e3={'count':0x0,'rows':[]};Promise[_0xd005('0x6e')]()[_0xd005('0x1e')](function(){if(_0x316cd9['query'][_0xd005('0x10a')]){if(!_[_0xd005('0x10b')](_0x5c0ede,_0x316cd9[_0xd005('0x2b')]['channel'][_0xd005('0x10c')]())){throw new Error(_0xd005('0x10d'));}_0x5c0ede=[_0x316cd9['query']['channel'][_0xd005('0x10c')]()];}if(_0x316cd9[_0xd005('0x2b')]['range']){try{var _0x542696=JSON[_0xd005('0xf9')](_0x316cd9['query']['range']);if(!moment(_0x542696[_0xd005('0x39')])['isValid']()){throw new Error(_0xd005('0x10e'));}if(!moment(_0x542696['to'])[_0xd005('0x10f')]()){throw new Error(_0xd005('0x110'));}}catch(_0x7dd0f5){throw new Error(_0xd005('0x111'));}}if(!_0x316cd9[_0xd005('0x2b')][_0xd005('0x2f')](_0xd005('0x30'))){_0x29f4a1[_0xd005('0x14')]=qs['limit'](_0x316cd9[_0xd005('0x2b')][_0xd005('0x14')]||0xa);_0x29f4a1['offset']=qs[_0xd005('0x12')](_0x316cd9['query'][_0xd005('0x12')]);}var _0x17b1b8=_0x5c0ede['map'](function(_0xe02a77){if(_0xe02a77===_0xd005('0x108')){var _0x21b196={'attributes':['id',_0xd005('0x112'),_0xd005('0x29'),_0xd005('0x113'),'destination','callerid',_0xd005('0x114'),'endtime','duration','note',_0xd005('0x115'),_0xd005('0x116'),'userSecondDisposition',_0xd005('0x117'),_0xd005('0x118')],'where':{'ContactId':_0x316cd9[_0xd005('0x87')]['id']},'include':[{'model':db[_0xd005('0x4c')],'as':'User','attributes':['id',_0xd005('0x1a'),_0xd005('0x119'),_0xd005('0x11a')]}],'order':[['createdAt',_0xd005('0x6d')]]};if(_0x316cd9[_0xd005('0x2b')][_0xd005('0x11b')]){_0x21b196[_0xd005('0x32')][_0xd005('0x115')]={'$gte':_0x542696[_0xd005('0x39')],'$lte':_0x542696['to']};}return db[_0xd005('0x11c')][_0xd005('0x11d')](_0x21b196)[_0xd005('0x1e')](function(_0x5556fc){_0x34a0e3['count']+=_0x5556fc[_0xd005('0x78')];return _[_0xd005('0x58')](_0x5556fc[_0xd005('0xdd')],function(_0x1ea740){var _0x3ed673=_0x1ea740['get']({'plain':!![]});_0x3ed673[_0xd005('0x10a')]=_0xe02a77;if(_0x3ed673['User']){_0x3ed673[_0xd005('0x4c')]={'id':_0x3ed673[_0xd005('0x4c')]['id'],'name':_0x3ed673[_0xd005('0x4c')][_0xd005('0x1a')],'fullname':_0x3ed673[_0xd005('0x4c')]['fullname'],'alias':_0x3ed673['User']['alias']};}return _0x3ed673;});});}else{var _0x4033de=_[_0xd005('0x11e')](_0xe02a77)+(_0xe02a77===_0xd005('0x104')?'Website':_0xd005('0x11f'));var _0x15ea27={'attributes':['id',_0xd005('0x120'),_0xd005('0x121'),_0xd005('0x115'),'note',_0xd005('0x122'),'secondDisposition',_0xd005('0x123'),'UserId',_0x4033de+'Id'],'where':{'ContactId':_0x316cd9['params']['id']},'include':[{'model':db[_0x4033de],'as':_0xd005('0x11f'),'attributes':['id',_0xd005('0x1a'),'key']},{'model':db[_0xd005('0x4c')],'as':_0xd005('0x124'),'attributes':['id','name',_0xd005('0x119')]},{'model':db[_0xd005('0xb3')],'as':_0xd005('0x85'),'attributes':['id',_0xd005('0x1a'),_0xd005('0x37')],'through':{'attributes':[]}}],'order':[[_0xd005('0x115'),_0xd005('0x6d')]]};if(_0x316cd9[_0xd005('0x2b')][_0xd005('0x11b')]){_0x15ea27[_0xd005('0x32')]['createdAt']={'$gte':_0x542696[_0xd005('0x39')],'$lte':_0x542696['to']};}switch(_0xe02a77){case _0xd005('0x104'):_0x15ea27[_0xd005('0x2e')][_0xd005('0x22')](_0xd005('0x125'),_0xd005('0x126'),_0xd005('0x127'),'deviceModel',_0xd005('0x128'),_0xd005('0x129'),_0xd005('0x12a'),_0xd005('0x12b'),_0xd005('0x12c'));break;case'mail':_0x15ea27['attributes']['push']('subject',_0xd005('0x12d'));break;case _0xd005('0x106'):_0x15ea27[_0xd005('0x2e')]['push'](_0xd005('0x12e'),_0xd005('0x12f'));break;}return db[_[_0xd005('0x11e')](_0xe02a77)+_0xd005('0x130')][_0xd005('0x11d')](_0x15ea27)[_0xd005('0x1e')](function(_0x49c976){_0x34a0e3[_0xd005('0x78')]+=_0x49c976[_0xd005('0x78')];return _[_0xd005('0x58')](_0x49c976[_0xd005('0xdd')],function(_0x1fd39c){var _0x194aa3=_0x1fd39c[_0xd005('0x8e')]({'plain':!![]});_0x194aa3[_0xd005('0x10a')]=_0xe02a77;if(_0x194aa3['Owner']){_0x194aa3[_0xd005('0x124')]={'id':_0x194aa3[_0xd005('0x124')]['id'],'name':_0x194aa3['Owner'][_0xd005('0x1a')],'fullname':_0x194aa3[_0xd005('0x124')][_0xd005('0x119')]};}return _0x194aa3;});});}});return Promise[_0xd005('0x26')](_0x17b1b8);})['then'](function(_0x4d9853){return _(_0x4d9853)[_0xd005('0x131')]()[_0xd005('0x132')]('createdAt')[_0xd005('0x133')]()[_0xd005('0x4f')]();})[_0xd005('0x1e')](function(_0xb0b49c){_0x34a0e3['rows']=_0x29f4a1[_0xd005('0x14')]?_0xb0b49c[_0xd005('0x134')](_0x29f4a1[_0xd005('0x12')],_0x29f4a1[_0xd005('0x12')]+_0x29f4a1[_0xd005('0x14')]):_0xb0b49c;return _0x34a0e3;})['then'](respondWithFilteredResult(_0x227d99,_0x29f4a1))[_0xd005('0x86')](handleError(_0x227d99,null));}; \ No newline at end of file +var _0xda7a=['c.lastName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','params','catch','tags','columnName','displayName','analytics','findAll','custom','values','body','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappMessage','dialTimezone','timezones','utcOffset','duplicates','$or','findOrCreate','hasOwnProperty','additionalPhones','contact','show','CmContactHasItem','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','get','$and','omit','format','cf_%d','pickBy','setFields','id\x20=\x20?','toParam','phone','getTags','options','nolimit','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','ContactId','include','rows','includeAll','getHopperFinals','CmHopperFinal','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','import','binding','stringify','message','pid','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','alias','Account','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','color','customerPort','osName','ratingMessage','ratingType','referer','substatus','externalUrl','threadId','Interaction','flatten','sortBy','slice','moment','bluebird','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','offset','count','limit','status','set','Content-Range','json','update','then','destroy','end','error','stack','name','send','CmContact','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','all','fieldType','query','filters','intersection','attributes','model','fields','order','sort','pick','select','field','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','parseSearch','conditions','find','Tag','value','split','forEach','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','type','text','start','map','filter','isNil','Contact','isEmpty','ListId','where','concat','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','DESC','having','resolve','user','role','agent','some','getLists','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xda7a,0xb8));var _0xada7=function(_0xb2e981,_0x5dac85){_0xb2e981=_0xb2e981-0x0;var _0x534dc6=_0xda7a[_0xb2e981];return _0x534dc6;};'use strict';var moment=require(_0xada7('0x0'));var BPromise=require(_0xada7('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0xada7('0x2'));var Papa=require(_0xada7('0x3'));var Redis=require('ioredis');var qs=require(_0xada7('0x4'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xada7('0x5'))(_0xada7('0x6'));var config=require(_0xada7('0x7'));var shared=require(_0xada7('0x8'));var db=require(_0xada7('0x9'))['db'];config[_0xada7('0xa')]=_[_0xada7('0xb')](config[_0xada7('0xa')],{'host':_0xada7('0xc'),'port':0x18eb});var socket=require(_0xada7('0xd'))(new Redis(config['redis']));require(_0xada7('0xe'))['register'](socket);function respondWithResult(_0x556515,_0xf61fd9){_0xf61fd9=_0xf61fd9||0xc8;return function(_0x4c7791){if(_0x4c7791){return _0x556515['status'](_0xf61fd9)['json'](_0x4c7791);}};}function respondWithFilteredResult(_0x2f7ece,_0x549045){return function(_0x2c8c0d){if(_0x2c8c0d){var _0x309997=typeof _0x549045[_0xada7('0xf')]==='undefined'&&typeof _0x549045['limit']==='undefined';var _0x32dc89=_0x2c8c0d[_0xada7('0x10')];var _0x2b816b=_0x309997?0x0:_0x549045[_0xada7('0xf')];var _0x2d7ad2=_0x309997?_0x2c8c0d['count']:_0x549045['offset']+_0x549045[_0xada7('0x11')];var _0x513aeb;if(_0x2d7ad2>=_0x32dc89){_0x2d7ad2=_0x32dc89;_0x513aeb=0xc8;}else{_0x513aeb=0xce;}_0x2f7ece[_0xada7('0x12')](_0x513aeb);return _0x2f7ece[_0xada7('0x13')](_0xada7('0x14'),_0x2b816b+'-'+_0x2d7ad2+'/'+_0x32dc89)[_0xada7('0x15')](_0x2c8c0d);}return null;};}function saveUpdates(_0x5572cd){return function(_0x10fac5){if(_0x10fac5){return _0x10fac5[_0xada7('0x16')](_0x5572cd)[_0xada7('0x17')](function(_0x1dd6e2){return _0x1dd6e2;});}return null;};}function removeEntity(_0x4649e4){return function(_0x28ed2f){if(_0x28ed2f){return _0x28ed2f[_0xada7('0x18')]()[_0xada7('0x17')](function(){_0x4649e4[_0xada7('0x12')](0xcc)[_0xada7('0x19')]();});}};}function handleEntityNotFound(_0x171508){return function(_0x48ebf7){if(!_0x48ebf7){_0x171508['sendStatus'](0x194);}return _0x48ebf7;};}function handleError(_0x2c7828,_0x33248f){_0x33248f=_0x33248f||0x1f4;return function(_0x23eb69){logger[_0xada7('0x1a')](_0x23eb69[_0xada7('0x1b')]);if(_0x23eb69[_0xada7('0x1c')]){delete _0x23eb69[_0xada7('0x1c')];}_0x2c7828[_0xada7('0x12')](_0x33248f)[_0xada7('0x1d')](_0x23eb69);};}exports['index']=function(_0x4c694b,_0x185571){var _0x862443={},_0x1f2d81={},_0x5629c2={'count':0x0,'rows':[]};return db[_0xada7('0x1e')][_0xada7('0x1f')]()[_0xada7('0x17')](function(_0x1790b1){var _0x3fd7bf=[];for(var _0x423123=0x0;_0x4231230x1){_0x1414bd['or'](_0xada7('0x5c'),qs[_0xada7('0x5d')](_0x4d72ee),null);}else{if(qs[_0xada7('0x5e')](_0x4d72ee)){_0x1414bd['or'](_0xada7('0x5f'),_0x4d72ee+'%');_0x1414bd['or'](_0xada7('0x60'),_0x4d72ee+'%');_0x1414bd['or'](_0xada7('0x61'),_0x4d72ee+'%');_0x1414bd['or'](_0xada7('0x62'),_0x4d72ee+'%');}else if(qs[_0xada7('0x63')](_0x4d72ee)){_0x1414bd['or'](_0xada7('0x64'),_0x4d72ee+'%');}else{_0x1414bd['or'](_0xada7('0x65'),'%'+_0x4d72ee+'%');_0x1414bd['or'](_0xada7('0x66'),'%'+_0x4d72ee+'%');_0x1414bd['or'](_0xada7('0x64'),'%'+_0x4d72ee+'%');}}}}_0x54d76a[_0xada7('0x55')](_0x1414bd);_0x54d76a[_0xada7('0x67')](_0xada7('0x68'));var _0x5d428b={'type':db[_0xada7('0x69')]['QueryTypes'][_0xada7('0x6a')],'raw':!![]};var _0x2292c2=_0x54d76a[_0xada7('0x6b')]()[_0xada7('0x33')]('c.id');if(_0x862443[_0xada7('0x2f')]){_0x862443['order'][_0xada7('0x43')](function(_0x40257f){_0x54d76a['order']('c.'+_0x40257f[0x0],_0x40257f[0x1]===_0xada7('0x6c')?![]:!![]);});}if(!_[_0xada7('0x53')](_0x5cb5d3)){_0x54d76a[_0xada7('0x6d')](_0x43de3d);_0x2292c2['where']('t.id\x20IN\x20?',_0x5cb5d3);}BPromise[_0xada7('0x6e')]()[_0xada7('0x17')](function(){if(!_0x50dadd)return;if(_0x4c694b[_0xada7('0x6f')][_0xada7('0x70')]!==_0xada7('0x71'))return;if(!_[_0xada7('0x72')](_0x50dadd['conditions'],[_0xada7('0x33'),_0xada7('0x45')])){return _0x4c694b[_0xada7('0x6f')][_0xada7('0x73')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2821f3){if(_[_0xada7('0x53')](_0x2821f3)){_0x2292c2['where']('c.ListId\x20IS\x20NULL');_0x54d76a[_0xada7('0x55')]('c.ListId\x20IS\x20NULL');}else{_0x2292c2['where'](_0xada7('0x74'),_['map'](_0x2821f3,'id'));_0x54d76a[_0xada7('0x55')](_0xada7('0x74'),_[_0xada7('0x4f')](_0x2821f3,'id'));}});}})[_0xada7('0x17')](function(){if(_0x4c694b[_0xada7('0x6f')][_0xada7('0x70')]===_0xada7('0x71')&&!_0x50dadd&&!_0x4c694b['query'][_0xada7('0x54')])return[];return db[_0xada7('0x75')][_0xada7('0x29')](_0x2292c2[_0xada7('0x76')](),_0x5d428b);})['then'](function(_0x24a4a2){_0x5629c2[_0xada7('0x10')]=_0x24a4a2['length'];if(_0x5629c2['count']===0x0)return[];return db['sequelize'][_0xada7('0x29')](_0x2b50b4[_0xada7('0x76')](),_0x5d428b)[_0xada7('0x17')](function(_0x24373d){_0x2458f4=_[_0xada7('0x77')](_0x24373d,'id');_0x5d428b=_[_0xada7('0x78')](_0x5d428b,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c694b[_0xada7('0x29')][_0xada7('0x2e')]){_0x862443[_0xada7('0x2c')][_0xada7('0x43')](function(_0x3e003f){_0x54d76a[_0xada7('0x33')]('c.'+_0x3e003f);});}else{_0x54d76a[_0xada7('0x33')](_0xada7('0x68'));_0x54d76a[_0xada7('0x33')]('c.firstName');_0x54d76a['field'](_0xada7('0x79'));_0x54d76a[_0xada7('0x33')](_0xada7('0x7a'));_0x54d76a['field'](_0xada7('0x7b'));_0x54d76a['field'](_0xada7('0x7c'));_0x54d76a['field']('c.email');_0x54d76a[_0xada7('0x33')](_0xada7('0x7d'));_0x54d76a['field'](_0xada7('0x7e'));_0x54d76a[_0xada7('0x33')](_0xada7('0x7f'));_0x54d76a[_0xada7('0x33')](_0xada7('0x80'));_0x54d76a[_0xada7('0x33')](_0xada7('0x81'),'TagIds');}if(_0x862443[_0xada7('0x11')])_0x54d76a[_0xada7('0x11')](_0x862443[_0xada7('0x11')]);if(_0x862443['offset'])_0x54d76a[_0xada7('0xf')](_0x862443[_0xada7('0xf')]);return db[_0xada7('0x75')][_0xada7('0x29')](_0x54d76a[_0xada7('0x76')](),_0x5d428b);});})[_0xada7('0x17')](function(_0x25ed7d){_0x25ed7d[_0xada7('0x43')](function(_0x5e4d98){if(_0x5e4d98[_0xada7('0x82')]){_0x5e4d98['Tags']=[];_0x5e4d98['TagIds'][_0xada7('0x42')](',')[_0xada7('0x43')](function(_0x5baa57){_0x5e4d98[_0xada7('0x83')][_0xada7('0x24')](_0x2458f4[_0x5baa57]);});}delete _0x5e4d98['TagIds'];});_0x5629c2['rows']=_0x25ed7d;return _0x5629c2;})[_0xada7('0x17')](respondWithFilteredResult(_0x185571,_0x862443));})['catch'](handleError(_0x185571,null));};exports['destroy']=function(_0x4152d4,_0x2b88f0){return db[_0xada7('0x1e')][_0xada7('0x3f')]({'where':{'id':_0x4152d4[_0xada7('0x84')]['id']}})[_0xada7('0x17')](handleEntityNotFound(_0x2b88f0,null))[_0xada7('0x17')](removeEntity(_0x2b88f0,null))[_0xada7('0x85')](handleError(_0x2b88f0,null));};exports['describe']=function(_0x32216c,_0x2fca51){return db['CmContact'][_0xada7('0x1f')]()[_0xada7('0x17')](function(_0x332e94){delete _0x332e94[_0xada7('0x86')];for(var _0x5f3797=0x0;_0x5f37970x0){return new Promise(function(_0x9d3fa8,_0x412a6d){var _0x412ac7=[];for(var _0x390494=0x0;_0x390494<_0x250a21[_0xada7('0x21')];_0x390494++){_0x412ac7['push'](insertAdditionalPhones(_0x250a21[_0x390494][_0xada7('0xaf')],_0x250a21[_0x390494]['additionalPhones']));}Promise['all'](_0x412ac7)[_0xada7('0x17')](function(){_0x9d3fa8(0x1);});})[_0xada7('0x17')](function(){return{'success':_0x5a9095,'failure':_0x33bff8,'duplicates':_0x2a18b1};});}else{return{'success':_0x5a9095,'failure':_0x33bff8,'duplicates':_0x2a18b1};}}})[_0xada7('0x17')](respondWithResult(_0x1758ba,0xc9))[_0xada7('0x85')](handleError(_0x1758ba,null));};exports[_0xada7('0xb0')]=function(_0x202fde,_0x5442fc){var _0x3f68dc;return db[_0xada7('0x1e')][_0xada7('0x1f')]()['then'](function(_0x1ce528){return db[_0xada7('0x1e')][_0xada7('0x3f')]({'where':{'id':_0x202fde[_0xada7('0x84')]['id']},'include':[{'model':db[_0xada7('0x40')],'as':'Tags','attributes':['id',_0xada7('0x1c'),'color'],'required':_0x202fde['query'][_0xada7('0x58')]?!![]:![]},{'model':db[_0xada7('0xb1')],'as':_0xada7('0xb2'),'where':{'CmContactId':_0x202fde['params']['id']},'required':![],'include':[{'model':db[_0xada7('0xb3')],'as':_0xada7('0xb4')}]}],'order':[db['sequelize'][_0xada7('0xb5')](_0xada7('0xb6'))],'attributes':_['keys'](_0x1ce528)});})['then'](function(_0x380974){if(!_['isNil'](_0x380974)){_0x3f68dc=_0x380974[_0xada7('0xb7')]({'plain':!![]});var _0x25b511={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x380974&&_0x380974[_0xada7('0x54')]){if(_0x380974[_0xada7('0x54')]){_0x25b511[_0xada7('0x55')][_0xada7('0xb8')][_0xada7('0x24')]({'ListId':{'$ne':_0x380974['ListId']}});}}return db[_0xada7('0x25')]['findAll'](_0x25b511);}})[_0xada7('0x17')](function(_0x276f24){if(!_[_0xada7('0x51')](_0x276f24)){return _[_0xada7('0xb9')](_0x3f68dc,_[_0xada7('0x4f')](_0x276f24,function(_0x2e8728){return util[_0xada7('0xba')](_0xada7('0xbb'),_0x2e8728['id']);}));}})[_0xada7('0x17')](handleEntityNotFound(_0x5442fc,null))['then'](respondWithResult(_0x5442fc,null))['catch'](handleError(_0x5442fc,null));};exports[_0xada7('0x16')]=function(_0xf1e725,_0x3f4e22){var _0x1e49bc;if(_0xf1e725[_0xada7('0x8d')]['id']){delete _0xf1e725[_0xada7('0x8d')]['id'];}if(!_['isNil'](_0xf1e725[_0xada7('0x8d')][_0xada7('0xa7')])){var _0x1bd925=_0xf1e725[_0xada7('0x8d')][_0xada7('0xa7')];if(!_[_0xada7('0x51')](shared[_0xada7('0xa8')][_0x1bd925]))_0xf1e725[_0xada7('0x8d')]['utcOffset']=shared[_0xada7('0xa8')][_0x1bd925][_0xada7('0xa9')];}return db[_0xada7('0x1e')][_0xada7('0x3f')]({'where':{'id':_0xf1e725[_0xada7('0x84')]['id']}})['then'](handleEntityNotFound(_0x3f4e22,null))['then'](saveUpdates(_0xf1e725[_0xada7('0x8d')],null))[_0xada7('0x17')](function(_0x5856c2){_0x1e49bc=_0x5856c2;var _0x57a4a6={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5856c2&&_0x5856c2['ListId']){if(_0x5856c2[_0xada7('0x54')]){_0x57a4a6[_0xada7('0x55')]['$and'][_0xada7('0x24')]({'ListId':{'$ne':_0x5856c2[_0xada7('0x54')]}});}}return db[_0xada7('0x25')][_0xada7('0x8a')](_0x57a4a6);})['then'](function(_0x5f3a9d){if(_0x5f3a9d){return _['omit'](_[_0xada7('0xbc')](_0xf1e725[_0xada7('0x8d')],function(_0x44fec0,_0x27384e){return _['startsWith'](_0x27384e,'cf_');}),_['map'](_0x5f3a9d,function(_0x4fbc1a){return util[_0xada7('0xba')](_0xada7('0xbb'),_0x4fbc1a['id']);}));}})[_0xada7('0x17')](function(_0x1e3aca){if(_0x1e3aca&&!_[_0xada7('0x53')](_0x1e3aca)){var _0x4b0367=squel[_0xada7('0x16')]()['table'](_0xada7('0x36'))[_0xada7('0xbd')](_0x1e3aca)[_0xada7('0x55')](_0xada7('0xbe'),_0xf1e725[_0xada7('0x84')]['id'])[_0xada7('0xbf')]();return db[_0xada7('0x75')]['query'](_0x4b0367[_0xada7('0x4d')],{'replacements':_0x4b0367[_0xada7('0x8c')]});}})[_0xada7('0x17')](function(){if(_0xf1e725[_0xada7('0x8d')][_0xada7('0xc0')]&&_0x1e49bc){return db[_0xada7('0x92')][_0xada7('0x16')]({'phone':_0xf1e725[_0xada7('0x8d')][_0xada7('0xc0')],'OrderBy':0x0},{'where':{'ContactId':_0x1e49bc['id']}});}})[_0xada7('0x17')](function(){return _0x1e49bc;})[_0xada7('0x17')](respondWithResult(_0x3f4e22,null))[_0xada7('0x85')](handleError(_0x3f4e22,null));};exports[_0xada7('0xc1')]=function(_0x498a3a,_0x14fe4c){var _0x42ce0c={};var _0x8df194={};var _0x63fe38;var _0x467b58;return db[_0xada7('0x1e')][_0xada7('0x26')]({'where':{'id':_0x498a3a[_0xada7('0x84')]['id']}})['then'](handleEntityNotFound(_0x14fe4c,null))[_0xada7('0x17')](function(_0x5f1755){if(_0x5f1755){_0x63fe38=_0x5f1755;_0x8df194[_0xada7('0x2d')]=_['keys'](db[_0xada7('0x40')]['rawAttributes']);_0x8df194[_0xada7('0x29')]=_['keys'](_0x498a3a[_0xada7('0x29')]);_0x8df194[_0xada7('0x2a')]=_[_0xada7('0x2b')](_0x8df194[_0xada7('0x2d')],_0x8df194[_0xada7('0x29')]);_0x42ce0c[_0xada7('0x2c')]=_[_0xada7('0x2b')](_0x8df194[_0xada7('0x2d')],qs[_0xada7('0x2e')](_0x498a3a['query'][_0xada7('0x2e')]));_0x42ce0c[_0xada7('0x2c')]=_0x42ce0c[_0xada7('0x2c')][_0xada7('0x21')]?_0x42ce0c[_0xada7('0x2c')]:_0x8df194[_0xada7('0x2d')];_0x42ce0c[_0xada7('0x2f')]=qs[_0xada7('0x30')](_0x498a3a[_0xada7('0x29')][_0xada7('0x30')]);_0x42ce0c[_0xada7('0x55')]=qs['filters'](_['pick'](_0x498a3a[_0xada7('0x29')],_0x8df194[_0xada7('0x2a')]));if(_0x498a3a[_0xada7('0x29')][_0xada7('0x50')]){_0x42ce0c[_0xada7('0x55')]=_[_0xada7('0x78')](_0x42ce0c[_0xada7('0x55')],{'$or':_[_0xada7('0x4f')](_0x42ce0c[_0xada7('0x2c')],function(_0x539360){var _0xe4d26e={};_0xe4d26e[_0x539360]={'$like':'%'+_0x498a3a[_0xada7('0x29')][_0xada7('0x50')]+'%'};return _0xe4d26e;})});}_0x42ce0c=_[_0xada7('0x78')]({},_0x42ce0c,_0x498a3a[_0xada7('0xc2')]);return _0x63fe38['getTags'](_0x42ce0c);}})[_0xada7('0x17')](function(_0x2106a8){if(_0x2106a8){_0x467b58=_0x2106a8[_0xada7('0x21')];if(!_0x498a3a['query']['hasOwnProperty'](_0xada7('0xc3'))){_0x42ce0c[_0xada7('0x11')]=qs[_0xada7('0x11')](_0x498a3a[_0xada7('0x29')][_0xada7('0x11')]);_0x42ce0c[_0xada7('0xf')]=qs[_0xada7('0xf')](_0x498a3a[_0xada7('0x29')][_0xada7('0xf')]);}return _0x63fe38[_0xada7('0xc1')](_0x42ce0c);}})[_0xada7('0x17')](function(_0x24deef){if(_0x24deef){return _0x24deef?{'count':_0x467b58,'rows':_0x24deef}:null;}})[_0xada7('0x17')](respondWithResult(_0x14fe4c,null))[_0xada7('0x85')](handleError(_0x14fe4c,null));};exports[_0xada7('0xc4')]=function(_0x5d717c,_0x2a741d){if(_0x5d717c['body']['id']){delete _0x5d717c['body']['id'];}return db[_0xada7('0x1e')][_0xada7('0x26')]({'where':{'id':_0x5d717c[_0xada7('0x84')]['id']}})[_0xada7('0x17')](handleEntityNotFound(_0x2a741d,null))['then'](function(_0x32d6c6){if(_0x32d6c6){return _0x32d6c6['setTags'](_0x5d717c[_0xada7('0x8d')][_0xada7('0xc5')]||[]);}return null;})[_0xada7('0x17')](respondWithResult(_0x2a741d,null))[_0xada7('0x85')](handleError(_0x2a741d,null));};exports['setAdditionalPhones']=function(_0x5db93c,_0x3a66b7){var _0x22d72a=[];_0x22d72a[_0xada7('0x24')](addAdditionalPhones(_0x5db93c[_0xada7('0x8d')]));Promise[_0xada7('0x27')](_0x22d72a)[_0xada7('0x17')](function(){_0x22d72a=[];_0x22d72a[_0xada7('0x24')](deleteCmHopperPhones(_0x5db93c[_0xada7('0x8d')]['id']));_0x22d72a[_0xada7('0x24')](addCmHopperPhones(_0x5db93c[_0xada7('0x8d')]['id']));Promise['all'](_0x22d72a)[_0xada7('0x17')](function(){return[0x1];})[_0xada7('0x17')](respondWithResult(_0x3a66b7,null));});};function addAdditionalPhones(_0x2839e7){var _0x3aaccd;return new Promise(function(_0x4805af,_0x2f6c8d){return db[_0xada7('0xb1')][_0xada7('0x18')]({'where':{'CmContactId':_0x2839e7['id']}})[_0xada7('0x17')](function(){db[_0xada7('0xb3')][_0xada7('0x8a')]({'raw':!![],'attributes':['id',_0xada7('0xc6')]})[_0xada7('0x17')](function(_0x2f9974){var _0x2b7b74=[];for(var _0x4e7875=0x0;_0x4e7875<_0x2839e7[_0xada7('0xc7')][_0xada7('0x21')];_0x4e7875++){var _0x340cb8=_0x2839e7[_0xada7('0xc8')]?_[_0xada7('0x51')](_0x2839e7['item_types'][_0x4e7875])?'':_0x2839e7[_0xada7('0xc8')][_0x4e7875]:_0x2839e7['items'][_0x4e7875][_0xada7('0xc9')]?_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xc9')]:'';var _0x2a9b34=_[_0xada7('0x51')](_0x2839e7['items'][_0x4e7875]['description'])?'':_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xca')];var _0x8373d7=_0x340cb8+':'+_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xc0')]+'§'+_0x2a9b34;if(_[_0xada7('0x51')](_0x3aaccd))_0x3aaccd=_0x8373d7;else _0x3aaccd+=';'+_0x8373d7;var _0x372dbb=null;if(_0x2839e7[_0xada7('0xc8')]){if(!_[_0xada7('0x51')](_0x2839e7[_0xada7('0xc8')][_0x4e7875])){var _0x5b7c1c=_[_0xada7('0x3f')](_0x2f9974,function(_0x4762fb){return _0x4762fb['id']===_0x2839e7[_0xada7('0xc8')][_0x4e7875];});if(!_['isNil'](_0x5b7c1c)){_0x372dbb=_0x5b7c1c[_0xada7('0xc6')];}}}else{if(!_[_0xada7('0x51')](_0x2839e7[_0xada7('0xc7')][_0x4e7875])){var _0x5b7c1c=_[_0xada7('0x3f')](_0x2f9974,function(_0x760226){return _0x760226['id']===_0x2839e7[_0xada7('0xc7')][_0x4e7875]['ItemTypeId'];});if(!_[_0xada7('0x51')](_0x5b7c1c)){_0x372dbb=_0x4e7875;}}}if(_[_0xada7('0x51')](_0x372dbb)){_0x372dbb=0x64;}_0x2b7b74[_0xada7('0x24')](addAdditionalPhone(_0x2839e7['id'],_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xc0')],_0x2839e7[_0xada7('0xc8')]?_[_0xada7('0x51')](_0x2839e7[_0xada7('0xc8')][_0x4e7875])?null:_0x2839e7[_0xada7('0xc8')][_0x4e7875]:_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xc9')]?_0x2839e7[_0xada7('0xc7')][_0x4e7875][_0xada7('0xc9')]:null,_0x372dbb,_0x2a9b34));}Promise[_0xada7('0x27')](_0x2b7b74)[_0xada7('0x17')](function(){db[_0xada7('0x1e')]['update']({'AdditionalPhones':_0x3aaccd},{'where':{'id':_0x2839e7['id']}})[_0xada7('0x17')](function(){_0x4805af(0x1);});});});});});}function addAdditionalPhone(_0x223094,_0x532042,_0x147e5d,_0xad8380,_0xe3e028){return db[_0xada7('0xb1')][_0xada7('0x3f')]({'where':{'CmContactId':_0x223094,'item':_0x532042}})[_0xada7('0x17')](function(_0x5d268a){if(_0x5d268a)logger[_0xada7('0x90')](_0xada7('0xcb'),_0x5d268a);else{db['CmContactHasItem'][_0xada7('0x95')]({'CmContactId':_0x223094,'item':_0x532042,'ItemTypeId':_0x147e5d,'OrderBy':_0xad8380,'ItemClass':_0xada7('0xcc'),'description':_0xe3e028});}});}function deletePhones(_0x36c3d0){return db[_0xada7('0xb1')]['destroy']({'where':{'CmContactId':_0x36c3d0}});}function deleteCmHopperPhones(_0x161c56){return new Promise(function(_0x12e48a,_0x4e8e34){return db[_0xada7('0x92')][_0xada7('0x8a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x161c56}})[_0xada7('0x17')](function(_0x1640cf){db[_0xada7('0xcd')][_0xada7('0x18')]({'where':{'CmHopperId':{'$in':_[_0xada7('0x4f')](_0x1640cf,'id')}}});})[_0xada7('0x17')](function(){_0x12e48a(0x1);});});}function addCmHopperPhones(_0x2e32f3){return new Promise(function(_0x48948d,_0x5475a4){return db[_0xada7('0x92')][_0xada7('0x8a')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2e32f3}})[_0xada7('0x17')](function(_0x1b1b7e){var _0x2352eb=[];_[_0xada7('0x4f')](_0x1b1b7e,function(_0x922720){_0x2352eb['push'](createCmHopperPhone(_0x2e32f3,_0x922720['id']));});Promise[_0xada7('0x27')](_0x2352eb)[_0xada7('0x17')](function(){_0x48948d(0x1);});});});}function createCmHopperPhone(_0x3836eb,_0xef1eb5){return new Promise(function(_0x227f5a,_0x4ddbf0){db[_0xada7('0xb1')][_0xada7('0x8a')]({'raw':!![],'attributes':['item',_0xada7('0xc6')],'where':{'CmContactId':_0x3836eb,'ItemClass':_0xada7('0xcc')},'include':[{'model':db[_0xada7('0xb3')],'attributes':[_0xada7('0xc6')],'as':_0xada7('0xb4')}],'order':['OrderBy',db['sequelize'][_0xada7('0xb5')]('`ItemType`.OrderBy')]})[_0xada7('0x17')](function(_0x142e2e){var _0x21db7a=0x1;var _0x348dce=_['map'](_0x142e2e,function(_0x3a1f34){_0x3a1f34['CmHopperId']=_0xef1eb5;_0x3a1f34[_0xada7('0xc0')]=_0x3a1f34[_0xada7('0xce')];_0x3a1f34[_0xada7('0xc6')]=_0x21db7a;delete _0x3a1f34[_0xada7('0xcf')];_0x21db7a=_0x21db7a+0x1;return _0x3a1f34;});return db[_0xada7('0xcd')][_0xada7('0xd0')](_0x348dce,{});})['then'](function(){_0x227f5a(0x1);});});}function insertAdditionalPhones(_0x46758b,_0x12d92b){return new Promise(function(_0x44b970,_0x580087){var _0x5b2db3=[];for(var _0x54b72f=0x0;_0x54b72f<_0x12d92b[_0xada7('0x21')];_0x54b72f++){var _0x545029=_0x12d92b[_0x54b72f];_0x5b2db3['push'](parseContactItemType(_0x545029));}Promise[_0xada7('0x27')](_0x5b2db3)[_0xada7('0x17')](function(){var _0x2667b9={'id':_0x46758b['id'],'items':_0x12d92b};return addAdditionalPhones(_0x2667b9)[_0xada7('0x17')](function(_0x505c51){return addCmHopperPhones(_0x46758b['id']);});})['then'](function(){_0x44b970(_0x46758b);});});}function parseContactItemType(_0x327b41){return new Promise(function(_0x3ba8dc,_0x4ac20b){if(_0x327b41[_0xada7('0xad')]('ItemTypeId')){_0x3ba8dc(_0x327b41);}else{return db[_0xada7('0xb3')][_0xada7('0x3f')]({'where':{'name':_0x327b41['ItemType']}})[_0xada7('0x17')](function(_0x56a275){if(_[_0xada7('0x51')](_0x56a275))_0x327b41[_0xada7('0xc9')]=null;else _0x327b41[_0xada7('0xc9')]=_0x56a275['id'];_0x3ba8dc(_0x327b41);});}});}exports[_0xada7('0xd1')]=function(_0x5b319e,_0x437c70){return db[_0xada7('0xb1')][_0xada7('0x8a')]({'raw':!![],'where':{'CmContactId':_0x5b319e[_0xada7('0x84')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0xada7('0xb4')}],'order':[[_0xada7('0xc6')],[db[_0xada7('0x75')][_0xada7('0xb5')](_0xada7('0xd2'))]]})[_0xada7('0x17')](function(_0x2a7402){return _0x2a7402;})[_0xada7('0x17')](respondWithResult(_0x437c70,null))[_0xada7('0x85')](handleError(_0x437c70,null));};exports[_0xada7('0xd3')]=function(_0x1c3f06,_0x3f4c94){return db[_0xada7('0xb1')][_0xada7('0x8a')]({'raw':!![],'where':{'CmContactId':_0x1c3f06[_0xada7('0x8d')][_0xada7('0xd4')]}})[_0xada7('0x17')](function(_0x574914){var _0x16f2e9=_[_0xada7('0x4f')](_0x574914,function(_0x63e588){_0x63e588[_0xada7('0xd5')]=_0x1c3f06[_0xada7('0x8d')][_0xada7('0xd6')];return _0x63e588;});return db['CmContactHasItem'][_0xada7('0xd0')](_0x16f2e9,{});})[_0xada7('0x17')](function(_0x42102c){return addCmHopperPhones(_0x1c3f06['body'][_0xada7('0xd6')]);})[_0xada7('0x17')](function(_0xe598e4){return['ok'];})[_0xada7('0x17')](respondWithResult(_0x3f4c94,null))[_0xada7('0x85')](handleError(_0x3f4c94,null));};exports[_0xada7('0xd7')]=function(_0x59d03b,_0x1eaa4){var _0x1a7a23=[];_0x1a7a23[_0xada7('0x24')](createCmHopperPhone(_0x59d03b['body']['id'],_0x59d03b[_0xada7('0x8d')][_0xada7('0xd8')]));Promise[_0xada7('0x27')](_0x1a7a23)[_0xada7('0x17')](function(){return[0x1];})[_0xada7('0x17')](respondWithResult(_0x1eaa4,null));};exports[_0xada7('0xd9')]=function(_0x156dce,_0x46768e){var _0x54f83e={'raw':![],'where':{}};var _0x1332df={};var _0x54e064={'count':0x0,'rows':[]};return db[_0xada7('0x1e')][_0xada7('0x26')]({'where':{'id':_0x156dce[_0xada7('0x84')]['id']}})['then'](handleEntityNotFound(_0x46768e,null))[_0xada7('0x17')](function(_0x5fd7cc){if(_0x5fd7cc){_0x1332df['model']=_[_0xada7('0x20')](db[_0xada7('0x92')][_0xada7('0xda')]);_0x1332df[_0xada7('0x29')]=_[_0xada7('0x20')](_0x156dce[_0xada7('0x29')]);_0x1332df['filters']=_['intersection'](_0x1332df[_0xada7('0x2d')],_0x1332df[_0xada7('0x29')]);_0x54f83e[_0xada7('0x2c')]=_[_0xada7('0x2b')](_0x1332df[_0xada7('0x2d')],qs['fields'](_0x156dce[_0xada7('0x29')][_0xada7('0x2e')]));_0x54f83e[_0xada7('0x2c')]=_0x54f83e[_0xada7('0x2c')][_0xada7('0x21')]?_0x54f83e[_0xada7('0x2c')]:_0x1332df[_0xada7('0x2d')];if(!_0x156dce['query'][_0xada7('0xad')](_0xada7('0xc3'))){_0x54f83e[_0xada7('0x11')]=qs[_0xada7('0x11')](_0x156dce[_0xada7('0x29')][_0xada7('0x11')]);_0x54f83e[_0xada7('0xf')]=qs[_0xada7('0xf')](_0x156dce['query']['offset']);}_0x54f83e[_0xada7('0x2f')]=qs[_0xada7('0x30')](_0x156dce['query']['sort']);_0x54f83e['where']=qs['filters'](_[_0xada7('0x31')](_0x156dce[_0xada7('0x29')],_0x1332df[_0xada7('0x2a')]));_0x54f83e['where'][_0xada7('0xdb')]=_0x5fd7cc['id'];if(_0x156dce[_0xada7('0x29')][_0xada7('0x50')]){_0x54f83e['where']=_[_0xada7('0x78')](_0x54f83e['where'],{'$or':_[_0xada7('0x4f')](_0x54f83e['attributes'],function(_0xccaaac){var _0x5b23fd={};_0x5b23fd[_0xccaaac]={'$like':'%'+_0x156dce[_0xada7('0x29')][_0xada7('0x50')]+'%'};return _0x5b23fd;})});}_0x54f83e=_[_0xada7('0x78')]({},_0x54f83e,_0x156dce[_0xada7('0xc2')]);return db['CmHopper'][_0xada7('0x10')]({'where':_0x54f83e[_0xada7('0x55')]})[_0xada7('0x17')](function(_0x45cb39){_0x54e064['count']=_0x45cb39;if(_0x156dce[_0xada7('0x29')]['includeAll']){_0x54f83e[_0xada7('0xdc')]=[{'all':!![]}];}return db[_0xada7('0x92')][_0xada7('0x8a')](_0x54f83e);})['then'](function(_0x4da8a3){_0x54e064[_0xada7('0xdd')]=_0x4da8a3;return _0x54e064;});}})['then'](respondWithFilteredResult(_0x46768e,_0x54f83e))[_0xada7('0x85')](handleError(_0x46768e,null));};exports['getHopperHistories']=function(_0x135c4c,_0x1fcd50){var _0x17ae72={'raw':!![],'where':{}};var _0x3fefc7={};var _0xccf71e={'count':0x0,'rows':[]};return db[_0xada7('0x1e')][_0xada7('0x26')]({'where':{'id':_0x135c4c[_0xada7('0x84')]['id']}})[_0xada7('0x17')](handleEntityNotFound(_0x1fcd50,null))[_0xada7('0x17')](function(_0x1ca4c7){if(_0x1ca4c7){_0x3fefc7[_0xada7('0x2d')]=_['keys'](db[_0xada7('0x9f')][_0xada7('0xda')]);_0x3fefc7[_0xada7('0x29')]=_[_0xada7('0x20')](_0x135c4c[_0xada7('0x29')]);_0x3fefc7[_0xada7('0x2a')]=_[_0xada7('0x2b')](_0x3fefc7[_0xada7('0x2d')],_0x3fefc7[_0xada7('0x29')]);_0x17ae72[_0xada7('0x2c')]=_[_0xada7('0x2b')](_0x3fefc7[_0xada7('0x2d')],qs[_0xada7('0x2e')](_0x135c4c[_0xada7('0x29')][_0xada7('0x2e')]));_0x17ae72[_0xada7('0x2c')]=_0x17ae72[_0xada7('0x2c')]['length']?_0x17ae72[_0xada7('0x2c')]:_0x3fefc7['model'];if(!_0x135c4c[_0xada7('0x29')][_0xada7('0xad')](_0xada7('0xc3'))){_0x17ae72[_0xada7('0x11')]=qs['limit'](_0x135c4c[_0xada7('0x29')][_0xada7('0x11')]);_0x17ae72[_0xada7('0xf')]=qs['offset'](_0x135c4c['query'][_0xada7('0xf')]);}_0x17ae72[_0xada7('0x2f')]=qs['sort'](_0x135c4c[_0xada7('0x29')][_0xada7('0x30')]);_0x17ae72[_0xada7('0x55')]=qs[_0xada7('0x2a')](_[_0xada7('0x31')](_0x135c4c[_0xada7('0x29')],_0x3fefc7['filters']));_0x17ae72[_0xada7('0x55')][_0xada7('0xdb')]=_0x1ca4c7['id'];if(_0x135c4c[_0xada7('0x29')][_0xada7('0x50')]){_0x17ae72[_0xada7('0x55')]=_[_0xada7('0x78')](_0x17ae72[_0xada7('0x55')],{'$or':_[_0xada7('0x4f')](_0x17ae72['attributes'],function(_0x18ccc5){var _0x2b4a39={};_0x2b4a39[_0x18ccc5]={'$like':'%'+_0x135c4c[_0xada7('0x29')]['filter']+'%'};return _0x2b4a39;})});}_0x17ae72=_['merge']({},_0x17ae72,_0x135c4c[_0xada7('0xc2')]);return db[_0xada7('0x9f')][_0xada7('0x10')]({'where':_0x17ae72['where']})[_0xada7('0x17')](function(_0x4ea02d){_0xccf71e[_0xada7('0x10')]=_0x4ea02d;if(_0x135c4c[_0xada7('0x29')][_0xada7('0xde')]){_0x17ae72[_0xada7('0xdc')]=[{'all':!![]}];}return db[_0xada7('0x9f')][_0xada7('0x8a')](_0x17ae72);})['then'](function(_0x4888bd){_0xccf71e[_0xada7('0xdd')]=_0x4888bd;return _0xccf71e;});}})[_0xada7('0x17')](respondWithFilteredResult(_0x1fcd50,_0x17ae72))[_0xada7('0x85')](handleError(_0x1fcd50,null));};exports[_0xada7('0xdf')]=function(_0xdd7fb7,_0x59d651){var _0x414bbb={'raw':!![],'where':{}};var _0x3baa7f={};var _0x505d5f={'count':0x0,'rows':[]};return db['CmContact'][_0xada7('0x26')]({'where':{'id':_0xdd7fb7[_0xada7('0x84')]['id']}})[_0xada7('0x17')](handleEntityNotFound(_0x59d651,null))[_0xada7('0x17')](function(_0x4c2c19){if(_0x4c2c19){_0x3baa7f[_0xada7('0x2d')]=_[_0xada7('0x20')](db['CmHopperFinal']['rawAttributes']);_0x3baa7f[_0xada7('0x29')]=_[_0xada7('0x20')](_0xdd7fb7[_0xada7('0x29')]);_0x3baa7f[_0xada7('0x2a')]=_[_0xada7('0x2b')](_0x3baa7f['model'],_0x3baa7f['query']);_0x414bbb[_0xada7('0x2c')]=_[_0xada7('0x2b')](_0x3baa7f['model'],qs['fields'](_0xdd7fb7[_0xada7('0x29')][_0xada7('0x2e')]));_0x414bbb['attributes']=_0x414bbb['attributes'][_0xada7('0x21')]?_0x414bbb[_0xada7('0x2c')]:_0x3baa7f[_0xada7('0x2d')];if(!_0xdd7fb7[_0xada7('0x29')][_0xada7('0xad')](_0xada7('0xc3'))){_0x414bbb[_0xada7('0x11')]=qs[_0xada7('0x11')](_0xdd7fb7['query']['limit']);_0x414bbb[_0xada7('0xf')]=qs[_0xada7('0xf')](_0xdd7fb7[_0xada7('0x29')][_0xada7('0xf')]);}_0x414bbb[_0xada7('0x2f')]=qs[_0xada7('0x30')](_0xdd7fb7[_0xada7('0x29')][_0xada7('0x30')]);_0x414bbb[_0xada7('0x55')]=qs['filters'](_[_0xada7('0x31')](_0xdd7fb7[_0xada7('0x29')],_0x3baa7f[_0xada7('0x2a')]));_0x414bbb[_0xada7('0x55')][_0xada7('0xdb')]=_0x4c2c19['id'];if(_0xdd7fb7['query'][_0xada7('0x50')]){_0x414bbb[_0xada7('0x55')]=_[_0xada7('0x78')](_0x414bbb[_0xada7('0x55')],{'$or':_[_0xada7('0x4f')](_0x414bbb[_0xada7('0x2c')],function(_0x20a1ef){var _0xb6e1e5={};_0xb6e1e5[_0x20a1ef]={'$like':'%'+_0xdd7fb7[_0xada7('0x29')]['filter']+'%'};return _0xb6e1e5;})});}_0x414bbb=_[_0xada7('0x78')]({},_0x414bbb,_0xdd7fb7[_0xada7('0xc2')]);return db[_0xada7('0xe0')][_0xada7('0x10')]({'where':_0x414bbb['where']})['then'](function(_0x5b8fb8){_0x505d5f[_0xada7('0x10')]=_0x5b8fb8;if(_0xdd7fb7[_0xada7('0x29')][_0xada7('0xde')]){_0x414bbb[_0xada7('0xdc')]=[{'all':!![]}];}return db[_0xada7('0xe0')][_0xada7('0x8a')](_0x414bbb);})[_0xada7('0x17')](function(_0x28a9c1){_0x505d5f['rows']=_0x28a9c1;return _0x505d5f;});}})[_0xada7('0x17')](respondWithFilteredResult(_0x59d651,_0x414bbb))[_0xada7('0x85')](handleError(_0x59d651,null));};exports[_0xada7('0xe1')]=function(_0x441ab1,_0x1d77c7){var _0x1587f5={'raw':!![],'where':{}};var _0x2c863e={};var _0x3d5d54={'count':0x0,'rows':[]};return db[_0xada7('0x1e')][_0xada7('0x26')]({'where':{'id':_0x441ab1['params']['id']}})['then'](handleEntityNotFound(_0x1d77c7,null))[_0xada7('0x17')](function(_0x412e69){if(_0x412e69){_0x2c863e[_0xada7('0x2d')]=_[_0xada7('0x20')](db[_0xada7('0xe2')][_0xada7('0xda')]);_0x2c863e['query']=_[_0xada7('0x20')](_0x441ab1[_0xada7('0x29')]);_0x2c863e[_0xada7('0x2a')]=_['intersection'](_0x2c863e['model'],_0x2c863e[_0xada7('0x29')]);_0x1587f5[_0xada7('0x2c')]=_[_0xada7('0x2b')](_0x2c863e[_0xada7('0x2d')],qs[_0xada7('0x2e')](_0x441ab1[_0xada7('0x29')]['fields']));_0x1587f5[_0xada7('0x2c')]=_0x1587f5[_0xada7('0x2c')][_0xada7('0x21')]?_0x1587f5['attributes']:_0x2c863e[_0xada7('0x2d')];if(!_0x441ab1['query']['hasOwnProperty'](_0xada7('0xc3'))){_0x1587f5['limit']=qs['limit'](_0x441ab1[_0xada7('0x29')][_0xada7('0x11')]);_0x1587f5[_0xada7('0xf')]=qs[_0xada7('0xf')](_0x441ab1['query'][_0xada7('0xf')]);}_0x1587f5[_0xada7('0x2f')]=qs['sort'](_0x441ab1[_0xada7('0x29')][_0xada7('0x30')]);_0x1587f5['where']=qs[_0xada7('0x2a')](_[_0xada7('0x31')](_0x441ab1[_0xada7('0x29')],_0x2c863e[_0xada7('0x2a')]));_0x1587f5['where'][_0xada7('0xdb')]=_0x412e69['id'];if(_0x441ab1[_0xada7('0x29')][_0xada7('0x50')]){_0x1587f5[_0xada7('0x55')]=_[_0xada7('0x78')](_0x1587f5[_0xada7('0x55')],{'$or':_[_0xada7('0x4f')](_0x1587f5[_0xada7('0x2c')],function(_0x26f8a7){var _0x975cf1={};_0x975cf1[_0x26f8a7]={'$like':'%'+_0x441ab1[_0xada7('0x29')][_0xada7('0x50')]+'%'};return _0x975cf1;})});}_0x1587f5=_[_0xada7('0x78')]({},_0x1587f5,_0x441ab1[_0xada7('0xc2')]);return db[_0xada7('0xe2')][_0xada7('0x10')]({'where':_0x1587f5[_0xada7('0x55')]})[_0xada7('0x17')](function(_0x5b59e4){_0x3d5d54[_0xada7('0x10')]=_0x5b59e4;if(_0x441ab1['query'][_0xada7('0xde')]){_0x1587f5[_0xada7('0xdc')]=[{'all':!![]}];}return db[_0xada7('0xe2')]['findAll'](_0x1587f5);})[_0xada7('0x17')](function(_0xe7766f){_0x3d5d54[_0xada7('0xdd')]=_0xe7766f;return _0x3d5d54;});}})[_0xada7('0x17')](respondWithFilteredResult(_0x1d77c7,_0x1587f5))[_0xada7('0x85')](handleError(_0x1d77c7,null));};exports[_0xada7('0xe3')]=function(_0x518090,_0x21352b){try{if(!_0x518090['body'][_0xada7('0x54')]){throw new Error(_0xada7('0xe4'));}if(!_0x518090[_0xada7('0x8d')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x518090[_0xada7('0x8d')][_0xada7('0xe5')]){throw new Error(_0xada7('0xe6'));}if(!_0x518090[_0xada7('0x8d')][_0xada7('0xe7')]){throw new Error(_0xada7('0xe8'));}var _0x1ac294=_0x518090[_0xada7('0x8d')][_0xada7('0xe9')][_0xada7('0x42')](',');var _0x15f0b5=_0x518090[_0xada7('0x8d')][_0xada7('0xe5')][_0xada7('0x42')](',');if(!_0x1ac294[_0xada7('0x21')]||!_0x15f0b5['length']||_0x1ac294[_0xada7('0x21')]!==_0x15f0b5[_0xada7('0x21')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x518090[_0xada7('0x8d')][_0xada7('0x2e')]=_[_0xada7('0xea')](_0x1ac294,_0x15f0b5);if(!_0x518090[_0xada7('0x8d')][_0xada7('0x2e')][_0xada7('0xc0')]){throw new Error(_0xada7('0xeb'));}if(!_0x518090[_0xada7('0x8d')]['fields'][_0xada7('0xec')]){throw new Error(_0xada7('0xed'));}var _0x91d49a=path[_0xada7('0x8f')](config[_0xada7('0xee')],'server/files/tmp',_0x518090[_0xada7('0xef')]['filename']);fs['chmodSync'](_0x91d49a,parseInt('0777',0x8));var _0x212e2b=require(_0xada7('0xf0'))[_0xada7('0xf1')](path[_0xada7('0x8f')](__dirname,_0xada7('0xf2')),[_0x91d49a,_0x518090[_0xada7('0x8d')][_0xada7('0xe9')],_0x518090[_0xada7('0x8d')][_0xada7('0xe5')],_0x518090['body']['ListId'],_0x518090[_0xada7('0x8d')][_0xada7('0xf3')],_0x518090[_0xada7('0x8d')][_0xada7('0xaa')],_0x518090['body'][_0xada7('0xe7')]]);return _0x21352b[_0xada7('0x12')](0xc8)[_0xada7('0x15')]({'message':_0xada7('0xf4'),'pid':_0x212e2b['pid']});}catch(_0xa9dffc){return _0x21352b[_0xada7('0x12')](0x1f4)[_0xada7('0x1d')](_0xa9dffc);}};exports[_0xada7('0xf5')]=function(_0x574140,_0x541c3e){var _0x365294=fs[_0xada7('0xf6')](_0x574140[_0xada7('0xef')]['path']);Papa['parse'](_0x365294,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3d620c){return _0x541c3e[_0xada7('0x12')](0xc8)[_0xada7('0x15')]({'file':_0x574140[_0xada7('0xef')],'fields':_0x3d620c['meta'][_0xada7('0x2e')]});}});};exports[_0xada7('0xf7')]=function(_0x3e701d,_0x3c358f){return db[_0xada7('0x45')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xada7('0x71')}})[_0xada7('0x17')](function(_0xe03e93){var _0x54680d=![];if(!_0x3e701d[_0xada7('0x8d')][_0xada7('0x54')]){throw new Error(_0xada7('0xe4'));}if(!_0x3e701d[_0xada7('0x8d')]['binding'][_0xada7('0xc0')]){throw new Error(_0xada7('0xeb'));}if(!_0x3e701d[_0xada7('0x8d')][_0xada7('0xf8')]['firstName']){throw new Error(_0xada7('0xed'));}if(!_0x3e701d[_0xada7('0x8d')][_0xada7('0xe7')]){throw new Error(_0xada7('0xe8'));}var _0x258937=require('child_process')[_0xada7('0xf1')](path[_0xada7('0x8f')](__dirname,'../../components/import/cm/csv2'),[_0x3e701d[_0xada7('0x84')]['id'],JSON[_0xada7('0xf9')](_0x3e701d[_0xada7('0x8d')]),JSON[_0xada7('0xf9')](_0xe03e93)]);_0x258937['on'](_0xada7('0xfa'),function(){_0x54680d=!![];return _0x3c358f[_0xada7('0x12')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x258937[_0xada7('0xfb')]});});_0x258937['on']('exit',function(_0x31d202){if(_0x31d202&&!_0x54680d){return _0x3c358f[_0xada7('0x12')](0x1f4)[_0xada7('0x15')]({'message':'error\x20child\x20process','pid':_0x258937[_0xada7('0xfb')]});}});})[_0xada7('0x85')](handleError(_0x3c358f,null));};exports[_0xada7('0xfc')]=function(_0x411d97,_0x43e81d,_0x4e2464){return db[_0xada7('0x45')][_0xada7('0x8a')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x24eddf){var _0x16955c=![];if(!_0x411d97[_0xada7('0x8d')][_0xada7('0x54')]){throw new Error(_0xada7('0xe4'));}if(!_0x411d97[_0xada7('0x8d')][_0xada7('0xf8')][_0xada7('0xc0')]){throw new Error(_0xada7('0xeb'));}if(!_0x411d97[_0xada7('0x8d')][_0xada7('0xf8')][_0xada7('0xec')]){throw new Error(_0xada7('0xed'));}if(!_0x411d97[_0xada7('0x8d')][_0xada7('0xe7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xaee5bc=require(_0xada7('0xf0'))[_0xada7('0xf1')](path['join'](__dirname,_0xada7('0xfd')),[_0x411d97['params']['id'],JSON[_0xada7('0xf9')](_0x411d97[_0xada7('0x8d')]),JSON[_0xada7('0xf9')](_0x24eddf)]);_0xaee5bc['on'](_0xada7('0xfa'),function(_0x3ac833){_0x16955c=!![];return _0x43e81d[_0xada7('0x12')](0xc8)[_0xada7('0x15')]({'message':_0xada7('0xfe'),'pid':_0xaee5bc[_0xada7('0xfb')]});});_0xaee5bc['on'](_0xada7('0xff'),function(_0x2da1a5){if(_0x2da1a5&&!_0x16955c){return _0x43e81d[_0xada7('0x12')](0x1f4)[_0xada7('0x15')]({'message':_0xada7('0x100'),'pid':_0xaee5bc[_0xada7('0xfb')]});}});})[_0xada7('0x85')](handleError(_0x43e81d,null));};exports[_0xada7('0x101')]=function(_0x2eb5a7,_0x283bf4){var _0x3c9445=[_0xada7('0x102'),_0xada7('0x103'),'sms',_0xada7('0x104'),_0xada7('0x105'),_0xada7('0x106'),_0xada7('0x107')];var _0x413811={'offset':0x0,'order':qs['sort'](_0xada7('0x108'))},_0x45b47b={'count':0x0,'rows':[]};Promise[_0xada7('0x6e')]()['then'](function(){if(_0x2eb5a7['query'][_0xada7('0x109')]){if(!_[_0xada7('0x10a')](_0x3c9445,_0x2eb5a7[_0xada7('0x29')]['channel']['toLowerCase']())){throw new Error(_0xada7('0x10b'));}_0x3c9445=[_0x2eb5a7[_0xada7('0x29')][_0xada7('0x109')]['toLowerCase']()];}if(_0x2eb5a7[_0xada7('0x29')][_0xada7('0x10c')]){try{var _0x2a68b8=JSON[_0xada7('0x10d')](_0x2eb5a7['query']['range']);if(!moment(_0x2a68b8[_0xada7('0x34')])['isValid']()){throw new Error(_0xada7('0x10e'));}if(!moment(_0x2a68b8['to'])[_0xada7('0x10f')]()){throw new Error(_0xada7('0x110'));}}catch(_0x41b030){throw new Error(_0xada7('0x111'));}}if(!_0x2eb5a7['query'][_0xada7('0xad')]('nolimit')){_0x413811[_0xada7('0x11')]=qs[_0xada7('0x11')](_0x2eb5a7[_0xada7('0x29')][_0xada7('0x11')]||0xa);_0x413811['offset']=qs[_0xada7('0xf')](_0x2eb5a7[_0xada7('0x29')]['offset']);}var _0xfcb2ef=_0x3c9445[_0xada7('0x4f')](function(_0x1d2ede){if(_0x1d2ede==='voice'){var _0x3cd98b={'attributes':['id','uniqueid',_0xada7('0x4c'),'source',_0xada7('0x112'),'callerid','starttime','endtime',_0xada7('0x113'),_0xada7('0x114'),_0xada7('0x115'),_0xada7('0x116'),_0xada7('0x117'),_0xada7('0x118'),_0xada7('0x119')],'where':{'ContactId':_0x2eb5a7[_0xada7('0x84')]['id']},'include':[{'model':db['User'],'as':_0xada7('0x45'),'attributes':['id','name',_0xada7('0x11a'),'alias']}],'order':[[_0xada7('0x115'),'DESC']]};if(_0x2eb5a7[_0xada7('0x29')]['range']){_0x3cd98b['where'][_0xada7('0x115')]={'$gte':_0x2a68b8['from'],'$lte':_0x2a68b8['to']};}return db[_0xada7('0xa1')][_0xada7('0x11b')](_0x3cd98b)['then'](function(_0x4e2ac3){_0x45b47b['count']+=_0x4e2ac3['count'];return _[_0xada7('0x4f')](_0x4e2ac3[_0xada7('0xdd')],function(_0x1da0cc){var _0x402276=_0x1da0cc['get']({'plain':!![]});_0x402276[_0xada7('0x109')]=_0x1d2ede;if(_0x402276[_0xada7('0x45')]){_0x402276['User']={'id':_0x402276[_0xada7('0x45')]['id'],'name':_0x402276[_0xada7('0x45')][_0xada7('0x1c')],'fullname':_0x402276['User'][_0xada7('0x11a')],'alias':_0x402276[_0xada7('0x45')][_0xada7('0x11c')]};}return _0x402276;});});}else{var _0x1a513b=_['startCase'](_0x1d2ede)+(_0x1d2ede===_0xada7('0x103')?'Website':_0xada7('0x11d'));var _0x57edf8={'attributes':['id','closed',_0xada7('0x11e'),_0xada7('0x115'),_0xada7('0x114'),_0xada7('0x11f'),_0xada7('0x120'),_0xada7('0x121'),_0xada7('0x119'),_0x1a513b+'Id'],'where':{'ContactId':_0x2eb5a7[_0xada7('0x84')]['id']},'include':[{'model':db[_0x1a513b],'as':'Account','attributes':['id',_0xada7('0x1c'),_0xada7('0x122')]},{'model':db[_0xada7('0x45')],'as':_0xada7('0x123'),'attributes':['id',_0xada7('0x1c'),_0xada7('0x11a')]},{'model':db[_0xada7('0x40')],'as':'Tags','attributes':['id','name',_0xada7('0x124')],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x2eb5a7['query'][_0xada7('0x10c')]){_0x57edf8[_0xada7('0x55')]['createdAt']={'$gte':_0x2a68b8['from'],'$lte':_0x2a68b8['to']};}switch(_0x1d2ede){case _0xada7('0x103'):_0x57edf8[_0xada7('0x2c')]['push']('browserName','customerIp',_0xada7('0x125'),'deviceModel',_0xada7('0x126'),_0xada7('0x127'),_0xada7('0x128'),'ratingValue',_0xada7('0x129'));break;case _0xada7('0x102'):_0x57edf8[_0xada7('0x2c')][_0xada7('0x24')]('subject',_0xada7('0x12a'));break;case _0xada7('0x104'):_0x57edf8[_0xada7('0x2c')][_0xada7('0x24')](_0xada7('0x12b'),_0xada7('0x12c'));break;}return db[_['startCase'](_0x1d2ede)+_0xada7('0x12d')][_0xada7('0x11b')](_0x57edf8)[_0xada7('0x17')](function(_0x5b765d){_0x45b47b[_0xada7('0x10')]+=_0x5b765d[_0xada7('0x10')];return _[_0xada7('0x4f')](_0x5b765d[_0xada7('0xdd')],function(_0x133e31){var _0x2fa533=_0x133e31[_0xada7('0xb7')]({'plain':!![]});_0x2fa533[_0xada7('0x109')]=_0x1d2ede;if(_0x2fa533[_0xada7('0x123')]){_0x2fa533['Owner']={'id':_0x2fa533['Owner']['id'],'name':_0x2fa533[_0xada7('0x123')][_0xada7('0x1c')],'fullname':_0x2fa533[_0xada7('0x123')]['fullname']};}return _0x2fa533;});});}});return Promise[_0xada7('0x27')](_0xfcb2ef);})[_0xada7('0x17')](function(_0x27ac9d){return _(_0x27ac9d)[_0xada7('0x12e')]()[_0xada7('0x12f')]('createdAt')['reverse']()[_0xada7('0x41')]();})[_0xada7('0x17')](function(_0x35d7e8){_0x45b47b[_0xada7('0xdd')]=_0x413811['limit']?_0x35d7e8[_0xada7('0x130')](_0x413811[_0xada7('0xf')],_0x413811[_0xada7('0xf')]+_0x413811[_0xada7('0x11')]):_0x35d7e8;return _0x45b47b;})['then'](respondWithFilteredResult(_0x283bf4,_0x413811))[_0xada7('0x85')](handleError(_0x283bf4,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 3850073..0db3f04 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe3b1=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x31a39c,_0x2b2e6c){var _0x4358e8=function(_0x66c0ea){while(--_0x66c0ea){_0x31a39c['push'](_0x31a39c['shift']());}};_0x4358e8(++_0x2b2e6c);}(_0xe3b1,0x101));var _0x1e3b=function(_0x416e71,_0x338419){_0x416e71=_0x416e71-0x0;var _0x14e60b=_0xe3b1[_0x416e71];return _0x14e60b;};'use strict';var EventEmitter=require(_0x1e3b('0x0'));var CmContact=require(_0x1e3b('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x1e3b('0x2')](0x0);var events={'afterCreate':_0x1e3b('0x3'),'afterUpdate':_0x1e3b('0x4'),'afterDestroy':_0x1e3b('0x5')};function emitEvent(_0x4ca214){return function(_0x2bc73b,_0x1c1714,_0x484de3){CmContactEvents[_0x1e3b('0x6')](_0x4ca214+':'+_0x2bc73b['id'],_0x2bc73b);CmContactEvents[_0x1e3b('0x6')](_0x4ca214,_0x2bc73b);_0x484de3(null);};}for(var e in events){if(events[_0x1e3b('0x7')](e)){var event=events[e];CmContact[_0x1e3b('0x8')](e,emitEvent(event));}}module[_0x1e3b('0x9')]=CmContactEvents; \ No newline at end of file +var _0x8c29=['hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3daeba,_0x130354){var _0x34500d=function(_0x449f53){while(--_0x449f53){_0x3daeba['push'](_0x3daeba['shift']());}};_0x34500d(++_0x130354);}(_0x8c29,0x8e));var _0x98c2=function(_0x43a107,_0x336f58){_0x43a107=_0x43a107-0x0;var _0x134c30=_0x8c29[_0x43a107];return _0x134c30;};'use strict';var EventEmitter=require(_0x98c2('0x0'));var CmContact=require(_0x98c2('0x1'))['db'][_0x98c2('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x98c2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x98c2('0x4'),'afterDestroy':_0x98c2('0x5')};function emitEvent(_0x241da7){return function(_0x51d570,_0xbde255,_0x3ab13f){CmContactEvents['emit'](_0x241da7+':'+_0x51d570['id'],_0x51d570);CmContactEvents[_0x98c2('0x6')](_0x241da7,_0x51d570);_0x3ab13f(null);};}for(var e in events){if(events[_0x98c2('0x7')](e)){var event=events[e];CmContact[_0x98c2('0x8')](e,emitEvent(event));}}module[_0x98c2('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e3c84e7..7190bac 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1439=['lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','utcOffset','add','minutes','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','onlyIfOpen','VoiceQueue','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Campaign','Lists','message','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','bluebird','request-promise','path','./cmContact.attributes','exports','CmContact','cm_contacts','phone','firstName'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1439,0x19e));var _0x9143=function(_0x44264b,_0x40aea6){_0x44264b=_0x44264b-0x0;var _0x2c605e=_0x1439[_0x44264b];return _0x2c605e;};'use strict';var _=require('lodash');var util=require(_0x9143('0x0'));var logger=require(_0x9143('0x1'))(_0x9143('0x2'));var moment=require('moment');var BPromise=require(_0x9143('0x3'));var rp=require(_0x9143('0x4'));var fs=require('fs');var path=require(_0x9143('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x9143('0x6'));module[_0x9143('0x7')]=function(_0x7aad31,_0x314450){return _0x7aad31['define'](_0x9143('0x8'),attributes,{'tableName':_0x9143('0x9'),'paranoid':!![],'indexes':[{'name':_0x9143('0xa'),'fields':[_0x9143('0xa')]},{'name':'fti_cm_contacts','fields':[_0x9143('0xb'),_0x9143('0xc'),'phone',_0x9143('0xd'),_0x9143('0xe'),_0x9143('0xf')],'type':_0x9143('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x9143('0x11'),'hooks':{'afterCreate':function(_0x5ee2f8,_0xbd2312,_0x3ace2d){var _0xd31155=_0x7aad31[_0x9143('0x12')];var _0x50967a=_0x5ee2f8[_0x9143('0x13')]({'plain':!![]});function _0x652af4(){return function(_0x296e30){logger[_0x9143('0x14')](_0x9143('0x15'),_0x9143('0x16'),util[_0x9143('0x17')](_0x296e30,{'showHidden':![],'depth':null}));};}function _0x211f39(_0x41f52c,_0x55407a){var _0x372e95=_0x55407a[_0x9143('0x18')]?_0x55407a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a'));return new BPromise(function(_0x62e687,_0x298e4e){if(_[_0x9143('0x1b')](_0x55407a[_0x9143('0x1c')])){_0x62e687({'ret':_0x372e95});}else{_0xd31155['VoiceQueue'][_0x9143('0x1d')]({'where':{'id':_0x41f52c['id']}})[_0x9143('0x1e')](function(_0x49b6da){if(!_['isNil'](_0x49b6da)){var _0x22c998=_0x49b6da[_0x9143('0x1c')];if(!_[_0x9143('0x1b')](_0x22c998)){var _0x4271f0=shared['timezones'];var _0x2aa86d=_0x4271f0[_0x22c998];var _0x301c72=_0x4271f0[_0x55407a['dialTimezone']];if(!_[_0x9143('0x1b')](_0x2aa86d)&&!_['isNil'](_0x301c72)){var _0x5fdf1a=_0x2aa86d[_0x9143('0x1f')]-_0x301c72[_0x9143('0x1f')];_0x372e95=_0x55407a[_0x9143('0x18')]?_0x55407a['scheduledat']:moment();var _0x55709b=moment(_0x372e95)[_0x9143('0x20')](_0x5fdf1a,_0x9143('0x21'));_0x62e687({'ret':_0x55709b['format'](_0x9143('0x1a'))});}else _0x62e687({'ret':_0x372e95});}else _0x62e687({'ret':_0x372e95});}else{_0x62e687({'ret':_0x372e95});}});}});return 0xa;}var _0x5929b8=function(_0x1e592e){return new BPromise(function(_0x5210bd,_0xd1113e){_0x211f39(_0x1e592e,_0x50967a)[_0x9143('0x1e')](function(_0x4ef4c4){_0x50967a[_0x9143('0x18')]=_0x4ef4c4[_0x9143('0x22')];_0xd31155[_0x9143('0x23')][_0x9143('0x1d')]({'where':{'phone':_0x50967a[_0x9143('0xa')],'VoiceQueueId':_0x1e592e['id']}})[_0x9143('0x1e')](function(_0x3bc189){if(!_['isNil'](_0x3bc189)){throw new Error(_0x9143('0x24')+_0x50967a[_0x9143('0xa')]+_0x9143('0x25')+_0x1e592e['id']);}return _0xd31155[_0x9143('0x23')]['create']({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a[_0x9143('0x26')],'priority':_0x50967a[_0x9143('0x27')]?_0x50967a[_0x9143('0x27')]:0x2,'scheduledat':_0x50967a[_0x9143('0x18')]?_0x50967a[_0x9143('0x18')]:moment()['format'](_0x9143('0x1a')),'callback':_0x50967a[_0x9143('0x28')]?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a['callbackUniqueid']?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'VoiceQueueId':_0x1e592e['id']});})[_0x9143('0x29')](function(_0x1847d0){_0xd1113e(_0x1847d0);});});});};var _0xa281cb=function(_0x43d14f){return new BPromise(function(_0x4dc41d,_0x234ca5){_0x211f39(_0x43d14f,_0x50967a)[_0x9143('0x1e')](function(_0x2561ec){_0x50967a['scheduledat']=_0x2561ec[_0x9143('0x22')];_0xd31155[_0x9143('0x23')][_0x9143('0x1d')]({'where':{'phone':_0x50967a[_0x9143('0xa')],'VoiceQueueId':_0x43d14f['id']}})[_0x9143('0x1e')](function(_0x4c3648){if(!_[_0x9143('0x1b')](_0x4c3648)){throw new Error(_0x9143('0x24')+_0x50967a[_0x9143('0xa')]+_0x9143('0x2a')+_0x43d14f['id']);}return _0xd31155[_0x9143('0x2b')][_0x9143('0x1d')]({'where':{'calleridnum':_0x50967a['phone'],'VoiceQueueId':_0x43d14f['id']}});})[_0x9143('0x1e')](function(_0x48a9a1){if(!_[_0x9143('0x1b')](_0x48a9a1)){throw new Error(_0x9143('0x2c')+_0x50967a[_0x9143('0xa')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x43d14f['id']);}return _0xd31155[_0x9143('0x23')][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a['ListId'],'priority':_0x50967a[_0x9143('0x27')]?_0x50967a['priority']:0x2,'scheduledat':_0x50967a[_0x9143('0x18')]?_0x50967a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a')),'callback':_0x50967a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a[_0x9143('0x28')]?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'VoiceQueueId':_0x43d14f['id']});})[_0x9143('0x29')](function(_0x451443){_0x234ca5(_0x451443);});});});};function _0x2e593f(){return function(_0x5adb2d){logger[_0x9143('0x14')]('cmContact',_0x9143('0x16'),util['inspect'](_0x5adb2d,{'showHidden':![],'depth':null}));};}function _0x1e85b2(_0x5cfd50,_0x27988d){var _0x33feae=_0x27988d[_0x9143('0x18')]?_0x27988d['scheduledat']:moment()[_0x9143('0x19')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x114565,_0x25520b){if(_[_0x9143('0x1b')](_0x27988d[_0x9143('0x1c')])){_0x114565({'ret':_0x33feae});}else{_0xd31155['Campaign']['findOne']({'where':{'id':_0x5cfd50['id']}})['then'](function(_0x2b41f9){if(!_[_0x9143('0x1b')](_0x2b41f9)){var _0x330bac=_0x2b41f9[_0x9143('0x1c')];if(!_[_0x9143('0x1b')](_0x330bac)){var _0x3b6d42=shared['timezones'];var _0x41763e=_0x3b6d42[_0x330bac];var _0x230fb9=_0x3b6d42[_0x27988d[_0x9143('0x1c')]];if(!_['isNil'](_0x41763e)&&!_[_0x9143('0x1b')](_0x230fb9)){var _0x363e8c=_0x41763e[_0x9143('0x1f')]-_0x230fb9[_0x9143('0x1f')];_0x33feae=_0x27988d[_0x9143('0x18')]?_0x27988d[_0x9143('0x18')]:moment();var _0x163e25=moment(_0x33feae)[_0x9143('0x20')](_0x363e8c,'minutes');_0x114565({'ret':_0x163e25[_0x9143('0x19')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x114565({'ret':_0x33feae});}else _0x114565({'ret':_0x33feae});}else{_0x114565({'ret':_0x33feae});}});}});return 0xa;}var _0x56410d=function(_0x10718e){return new BPromise(function(_0x2911ec,_0x4baff3){_0x1e85b2(_0x10718e,_0x50967a)[_0x9143('0x1e')](function(_0x21f08d){_0x50967a['scheduledat']=_0x21f08d[_0x9143('0x22')];_0xd31155[_0x9143('0x23')][_0x9143('0x1d')]({'where':{'phone':_0x50967a[_0x9143('0xa')],'CampaignId':_0x10718e['id']}})[_0x9143('0x1e')](function(_0x1eafba){if(!_['isNil'](_0x1eafba)){throw new Error('cmContact,\x20afterCreate\x20'+_0x50967a[_0x9143('0xa')]+_0x9143('0x2e')+_0x10718e['id']);}return _0xd31155[_0x9143('0x23')][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a['ListId'],'priority':_0x50967a[_0x9143('0x27')]?_0x50967a[_0x9143('0x27')]:0x2,'scheduledat':_0x50967a['scheduledat']?_0x50967a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a')),'callback':_0x50967a[_0x9143('0x28')]?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a[_0x9143('0x28')]?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'CampaignId':_0x10718e['id']});})['catch'](function(_0x5d8769){_0x4baff3(_0x5d8769);});});});};var _0x361250=function(_0xc4a2c){return new BPromise(function(_0x23f8bb,_0xb8dff8){_0x1e85b2(_0xc4a2c,_0x50967a)['then'](function(_0x325c23){_0x50967a[_0x9143('0x18')]=_0x325c23[_0x9143('0x22')];_0xd31155[_0x9143('0x23')][_0x9143('0x1d')]({'where':{'phone':_0x50967a[_0x9143('0xa')],'CampaignId':_0xc4a2c['id']}})[_0x9143('0x1e')](function(_0x19a42e){if(!_[_0x9143('0x1b')](_0x19a42e)){throw new Error(_0x9143('0x24')+_0x50967a[_0x9143('0xa')]+_0x9143('0x2f')+_0xc4a2c['id']);}return _0xd31155[_0x9143('0x2b')][_0x9143('0x1d')]({'where':{'calleridnum':_0x50967a[_0x9143('0xa')],'CampaignId':_0xc4a2c['id']}});})[_0x9143('0x1e')](function(_0xb287b0){if(!_['isNil'](_0xb287b0)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x50967a[_0x9143('0xa')]+_0x9143('0x30')+_0xc4a2c['id']);}return _0xd31155['CmHopper'][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a[_0x9143('0x26')],'priority':_0x50967a[_0x9143('0x27')]?_0x50967a[_0x9143('0x27')]:0x2,'scheduledat':_0x50967a['scheduledat']?_0x50967a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a')),'callback':_0x50967a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a[_0x9143('0x28')]?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'CampaignId':_0xc4a2c['id']});})['catch'](function(_0x17c3f9){_0xb8dff8(_0x17c3f9);});});});};if(_0x50967a[_0x9143('0x26')]){_0xd31155['VoiceQueue'][_0x9143('0x31')]({'where':{'type':_0x9143('0x32')},'attributes':['id',_0x9143('0x33'),_0x9143('0x1c')],'include':[{'model':_0xd31155[_0x9143('0x34')],'as':'Lists','where':{'id':_0x50967a['ListId']}}]})['then'](function(_0x525f71){if(_0x525f71){var _0x22effb=[];for(var _0x453480=0x0,_0x4b50dc;_0x453480<_0x525f71[_0x9143('0x35')];_0x453480+=0x1){_0x4b50dc=_0x525f71[_0x453480][_0x9143('0x13')]({'plain':!![]});switch(_0x4b50dc[_0x9143('0x33')]){case'always':_0xa281cb(_0x4b50dc)[_0x9143('0x29')](_0x652af4());break;case _0x9143('0x36'):_0x5929b8(_0x4b50dc)[_0x9143('0x29')](_0x652af4());break;default:_0x1e85b2(_0x4b50dc,_0x50967a)['then'](function(_0x158c5e){_0x50967a[_0x9143('0x18')]=_0x158c5e[_0x9143('0x22')];_0xd31155['CmHopper'][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a['ListId'],'scheduledat':_0x50967a[_0x9143('0x18')]?_0x50967a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a')),'priority':_0x50967a[_0x9143('0x27')]?_0x50967a['priority']:0x2,'callback':_0x50967a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a[_0x9143('0x28')]?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'VoiceQueueId':_0x4b50dc['id']})[_0x9143('0x29')](_0x652af4());});}}}})[_0x9143('0x1e')](function(){return _0xd31155[_0x9143('0x37')][_0x9143('0x31')]({'where':{'type':_0x9143('0x32')},'attributes':['id'],'include':[{'model':_0xd31155[_0x9143('0x34')],'as':_0x9143('0x38'),'where':{'id':_0x50967a[_0x9143('0x26')]}}]})[_0x9143('0x1e')](function(_0x2f29c9){if(_0x2f29c9){var _0x5422c0=[];for(var _0x4e805e=0x0,_0x38b437;_0x4e805e<_0x2f29c9[_0x9143('0x35')];_0x4e805e+=0x1){_0x38b437=_0x2f29c9[_0x4e805e][_0x9143('0x13')]({'plain':!![]});_0xd31155[_0x9143('0x39')]['create']({'phone':_0x50967a['phone'],'ContactId':_0x50967a['id'],'ListId':_0x50967a[_0x9143('0x26')],'VoiceQueueId':_0x38b437['id']})['catch'](function(_0x3c221b){logger[_0x9143('0x14')](_0x9143('0x3a'),_0x9143('0x16'),_0x3c221b['message']);});}}});})[_0x9143('0x1e')](function(){return _0xd31155[_0x9143('0x3b')][_0x9143('0x31')]({'attributes':['id',_0x9143('0x33'),_0x9143('0x1c')],'include':[{'model':_0xd31155[_0x9143('0x34')],'as':_0x9143('0x3c'),'where':{'id':_0x50967a[_0x9143('0x26')]}}]})[_0x9143('0x1e')](function(_0x32e635){if(_0x32e635){var _0x549996=[];for(var _0xbc0b9=0x0,_0x3a8ce7;_0xbc0b9<_0x32e635[_0x9143('0x35')];_0xbc0b9+=0x1){_0x3a8ce7=_0x32e635[_0xbc0b9][_0x9143('0x13')]({'plain':!![]});switch(_0x3a8ce7[_0x9143('0x33')]){case'always':_0x361250(_0x3a8ce7)['catch'](_0x2e593f());break;case _0x9143('0x36'):_0x56410d(_0x3a8ce7)['catch'](_0x2e593f());break;default:_0xd31155['CmHopper'][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a['ListId'],'scheduledat':_0x50967a[_0x9143('0x18')]?_0x50967a[_0x9143('0x18')]:moment()[_0x9143('0x19')](_0x9143('0x1a')),'priority':_0x50967a[_0x9143('0x27')]?_0x50967a[_0x9143('0x27')]:0x2,'callback':_0x50967a[_0x9143('0x28')]?!![]:![],'callbackuniqueid':_0x50967a[_0x9143('0x28')]?_0x50967a[_0x9143('0x28')]:undefined,'callbackat':_0x50967a[_0x9143('0x28')]?moment()[_0x9143('0x19')](_0x9143('0x1a')):undefined,'CampaignId':_0x3a8ce7['id']})[_0x9143('0x29')](_0x2e593f());}}}});})[_0x9143('0x1e')](function(){return _0xd31155[_0x9143('0x3b')][_0x9143('0x31')]({'attributes':['id'],'include':[{'model':_0xd31155[_0x9143('0x34')],'as':_0x9143('0x38'),'where':{'id':_0x50967a[_0x9143('0x26')]}}]})[_0x9143('0x1e')](function(_0x154096){if(_0x154096){var _0x16ff82=[];for(var _0x396224=0x0,_0xed4b2a;_0x396224<_0x154096[_0x9143('0x35')];_0x396224+=0x1){_0xed4b2a=_0x154096[_0x396224][_0x9143('0x13')]({'plain':!![]});_0xd31155[_0x9143('0x39')][_0x9143('0x2d')]({'phone':_0x50967a[_0x9143('0xa')],'ContactId':_0x50967a['id'],'ListId':_0x50967a['ListId'],'CampaignId':_0xed4b2a['id']})[_0x9143('0x29')](function(_0x420277){logger['error']('cmContact,\x20%s,\x20%s',_0x9143('0x16'),_0x420277[_0x9143('0x3d')]);});}}});})[_0x9143('0x1e')](function(){_0x3ace2d();})[_0x9143('0x29')](function(_0x2b1b1){logger[_0x9143('0x14')](_0x9143('0x3a'),'afterCreate',_0x2b1b1['message']);_0x3ace2d(_0x2b1b1);});}else{_0x3ace2d(new Error(_0x9143('0x3e')));}},'afterDestroy':function(_0x53a8ea,_0x49635d,_0x3247f7){var _0xaa9a28=_0x7aad31[_0x9143('0x12')];var _0x4e0e2e=_0x53a8ea['get']({'plain':!![]});return _0xaa9a28['CmHopper'][_0x9143('0x31')]({'raw':!![],'where':{'ListId':_0x4e0e2e['ListId'],'ContactId':_0x4e0e2e['id']}})[_0x9143('0x1e')](function(_0x5c2ce4){if(!_[_0x9143('0x3f')](_0x5c2ce4)){var _0x25118e=[];for(var _0xe04e59=0x0;_0xe04e59<_0x5c2ce4[_0x9143('0x35')];_0xe04e59+=0x1){var _0x36519f=_0xaa9a28[_0x9143('0x23')][_0x9143('0x40')]({'where':{'ListId':_0x5c2ce4[_0xe04e59][_0x9143('0x26')],'ContactId':_0x5c2ce4[_0xe04e59]['ContactId'],'VoiceQueueId':_0x5c2ce4[_0xe04e59][_0x9143('0x41')],'CampaignId':_0x5c2ce4[_0xe04e59][_0x9143('0x42')]}});_0x25118e[_0x9143('0x43')](_0x36519f);}return BPromise[_0x9143('0x44')](_0x25118e);}})[_0x9143('0x1e')](function(_0x1a7a09){logger[_0x9143('0x45')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x1a7a09,{'showHidden':![],'depth':null}));_0x3247f7();})['catch'](function(_0x4a43dd){logger[_0x9143('0x14')](_0x9143('0x46'),util[_0x9143('0x17')](_0x4a43dd,{'showHidden':![],'depth':null}));_0x3247f7(_0x4a43dd);});}}});}; \ No newline at end of file +var _0x2861=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','then','isNil','timezones','dialTimezone','utcOffset','add','minutes','ret','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','error','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','Campaign','CmList','CmHopperBlack','afterCreate','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger'];(function(_0x23d4e6,_0x3c3d01){var _0x1cc66a=function(_0x50d424){while(--_0x50d424){_0x23d4e6['push'](_0x23d4e6['shift']());}};_0x1cc66a(++_0x3c3d01);}(_0x2861,0xea));var _0x1286=function(_0x5c6f53,_0x5f08f6){_0x5c6f53=_0x5c6f53-0x0;var _0x4b9fff=_0x2861[_0x5c6f53];return _0x4b9fff;};'use strict';var _=require(_0x1286('0x0'));var util=require(_0x1286('0x1'));var logger=require(_0x1286('0x2'))(_0x1286('0x3'));var moment=require(_0x1286('0x4'));var BPromise=require(_0x1286('0x5'));var rp=require(_0x1286('0x6'));var fs=require('fs');var path=require(_0x1286('0x7'));var rimraf=require(_0x1286('0x8'));var config=require(_0x1286('0x9'));var shared=require(_0x1286('0xa'));var attributes=require(_0x1286('0xb'));module['exports']=function(_0x300d9e,_0x49d064){return _0x300d9e['define']('CmContact',attributes,{'tableName':_0x1286('0xc'),'paranoid':!![],'indexes':[{'name':_0x1286('0xd'),'fields':['phone']},{'name':_0x1286('0xe'),'fields':[_0x1286('0xf'),_0x1286('0x10'),_0x1286('0xd'),_0x1286('0x11'),_0x1286('0x12'),_0x1286('0x13')],'type':_0x1286('0x14')}],'timestamps':!![],'charset':_0x1286('0x15'),'collate':_0x1286('0x16'),'hooks':{'afterCreate':function(_0x383329,_0x33dea9,_0xbe426d){var _0x8ac47c=_0x300d9e[_0x1286('0x17')];var _0x588bf9=_0x383329[_0x1286('0x18')]({'plain':!![]});function _0x37e2d3(){return function(_0x965d5e){logger['error'](_0x1286('0x19'),'afterCreate',util[_0x1286('0x1a')](_0x965d5e,{'showHidden':![],'depth':null}));};}function _0x168e6d(_0x570a41,_0x207f67){var _0x4e9d7b=_0x207f67[_0x1286('0x1b')]?_0x207f67[_0x1286('0x1b')]:moment()[_0x1286('0x1c')](_0x1286('0x1d'));return new BPromise(function(_0xe87815,_0x5294f3){if(_['isNil'](_0x207f67['dialTimezone'])){_0xe87815({'ret':_0x4e9d7b});}else{_0x8ac47c[_0x1286('0x1e')]['findOne']({'where':{'id':_0x570a41['id']}})[_0x1286('0x1f')](function(_0xb23c94){if(!_[_0x1286('0x20')](_0xb23c94)){var _0x448cac=_0xb23c94['dialTimezone'];if(!_[_0x1286('0x20')](_0x448cac)){var _0x4da603=shared[_0x1286('0x21')];var _0x5bc85e=_0x4da603[_0x448cac];var _0x5e9215=_0x4da603[_0x207f67[_0x1286('0x22')]];if(!_[_0x1286('0x20')](_0x5bc85e)&&!_[_0x1286('0x20')](_0x5e9215)){var _0x2b13b6=_0x5bc85e[_0x1286('0x23')]-_0x5e9215[_0x1286('0x23')];_0x4e9d7b=_0x207f67['scheduledat']?_0x207f67[_0x1286('0x1b')]:moment();var _0x1eab0b=moment(_0x4e9d7b)[_0x1286('0x24')](_0x2b13b6,_0x1286('0x25'));_0xe87815({'ret':_0x1eab0b[_0x1286('0x1c')](_0x1286('0x1d'))});}else _0xe87815({'ret':_0x4e9d7b});}else _0xe87815({'ret':_0x4e9d7b});}else{_0xe87815({'ret':_0x4e9d7b});}});}});return 0xa;}var _0x13785c=function(_0x196e65){return new BPromise(function(_0x573db5,_0x456714){_0x168e6d(_0x196e65,_0x588bf9)[_0x1286('0x1f')](function(_0x3447d4){_0x588bf9[_0x1286('0x1b')]=_0x3447d4[_0x1286('0x26')];_0x8ac47c['CmHopper'][_0x1286('0x27')]({'where':{'phone':_0x588bf9[_0x1286('0xd')],'VoiceQueueId':_0x196e65['id']}})[_0x1286('0x1f')](function(_0x515ba1){if(!_[_0x1286('0x20')](_0x515ba1)){throw new Error(_0x1286('0x28')+_0x588bf9[_0x1286('0xd')]+_0x1286('0x29')+_0x196e65['id']);}return _0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9['ListId'],'priority':_0x588bf9[_0x1286('0x2c')]?_0x588bf9[_0x1286('0x2c')]:0x2,'scheduledat':_0x588bf9[_0x1286('0x1b')]?_0x588bf9['scheduledat']:moment()[_0x1286('0x1c')](_0x1286('0x1d')),'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9[_0x1286('0x2d')]?_0x588bf9[_0x1286('0x2d')]:undefined,'callbackat':_0x588bf9[_0x1286('0x2d')]?moment()[_0x1286('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x196e65['id']});})[_0x1286('0x2e')](function(_0x2d433a){_0x456714(_0x2d433a);});});});};var _0x124d6e=function(_0x3b1453){return new BPromise(function(_0x4c4f3a,_0x20300d){_0x168e6d(_0x3b1453,_0x588bf9)['then'](function(_0x174342){_0x588bf9[_0x1286('0x1b')]=_0x174342['ret'];_0x8ac47c[_0x1286('0x2a')]['findOne']({'where':{'phone':_0x588bf9[_0x1286('0xd')],'VoiceQueueId':_0x3b1453['id']}})['then'](function(_0x23cf26){if(!_[_0x1286('0x20')](_0x23cf26)){throw new Error('cmContact,\x20afterCreate\x20'+_0x588bf9[_0x1286('0xd')]+_0x1286('0x2f')+_0x3b1453['id']);}return _0x8ac47c[_0x1286('0x30')][_0x1286('0x27')]({'where':{'calleridnum':_0x588bf9['phone'],'VoiceQueueId':_0x3b1453['id']}});})[_0x1286('0x1f')](function(_0x4cb312){if(!_['isNil'](_0x4cb312)){throw new Error(_0x1286('0x31')+_0x588bf9['phone']+_0x1286('0x32')+_0x3b1453['id']);}return _0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9[_0x1286('0x33')],'priority':_0x588bf9[_0x1286('0x2c')]?_0x588bf9['priority']:0x2,'scheduledat':_0x588bf9['scheduledat']?_0x588bf9[_0x1286('0x1b')]:moment()[_0x1286('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9[_0x1286('0x2d')]?_0x588bf9[_0x1286('0x2d')]:undefined,'callbackat':_0x588bf9[_0x1286('0x2d')]?moment()['format'](_0x1286('0x1d')):undefined,'VoiceQueueId':_0x3b1453['id']});})['catch'](function(_0x23cbee){_0x20300d(_0x23cbee);});});});};function _0x167a68(){return function(_0x2043df){logger[_0x1286('0x34')]('cmContact','afterCreate',util['inspect'](_0x2043df,{'showHidden':![],'depth':null}));};}function _0x251f19(_0xd783a3,_0x5e2dfd){var _0x1e1d5e=_0x5e2dfd[_0x1286('0x1b')]?_0x5e2dfd[_0x1286('0x1b')]:moment()[_0x1286('0x1c')](_0x1286('0x1d'));return new BPromise(function(_0x4ec3f2,_0x302c79){if(_[_0x1286('0x20')](_0x5e2dfd[_0x1286('0x22')])){_0x4ec3f2({'ret':_0x1e1d5e});}else{_0x8ac47c['Campaign']['findOne']({'where':{'id':_0xd783a3['id']}})[_0x1286('0x1f')](function(_0xe5f650){if(!_[_0x1286('0x20')](_0xe5f650)){var _0x124579=_0xe5f650[_0x1286('0x22')];if(!_[_0x1286('0x20')](_0x124579)){var _0x451fdb=shared[_0x1286('0x21')];var _0x4bbe98=_0x451fdb[_0x124579];var _0x4b450e=_0x451fdb[_0x5e2dfd[_0x1286('0x22')]];if(!_[_0x1286('0x20')](_0x4bbe98)&&!_['isNil'](_0x4b450e)){var _0x2fea9a=_0x4bbe98[_0x1286('0x23')]-_0x4b450e['utcOffset'];_0x1e1d5e=_0x5e2dfd['scheduledat']?_0x5e2dfd[_0x1286('0x1b')]:moment();var _0x44c9d8=moment(_0x1e1d5e)[_0x1286('0x24')](_0x2fea9a,_0x1286('0x25'));_0x4ec3f2({'ret':_0x44c9d8[_0x1286('0x1c')](_0x1286('0x1d'))});}else _0x4ec3f2({'ret':_0x1e1d5e});}else _0x4ec3f2({'ret':_0x1e1d5e});}else{_0x4ec3f2({'ret':_0x1e1d5e});}});}});return 0xa;}var _0x387864=function(_0x417b15){return new BPromise(function(_0x10239b,_0x2108bd){_0x251f19(_0x417b15,_0x588bf9)[_0x1286('0x1f')](function(_0x4fc7d2){_0x588bf9[_0x1286('0x1b')]=_0x4fc7d2[_0x1286('0x26')];_0x8ac47c[_0x1286('0x2a')][_0x1286('0x27')]({'where':{'phone':_0x588bf9['phone'],'CampaignId':_0x417b15['id']}})[_0x1286('0x1f')](function(_0x113211){if(!_[_0x1286('0x20')](_0x113211)){throw new Error('cmContact,\x20afterCreate\x20'+_0x588bf9[_0x1286('0xd')]+_0x1286('0x35')+_0x417b15['id']);}return _0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9[_0x1286('0x33')],'priority':_0x588bf9[_0x1286('0x2c')]?_0x588bf9[_0x1286('0x2c')]:0x2,'scheduledat':_0x588bf9['scheduledat']?_0x588bf9['scheduledat']:moment()[_0x1286('0x1c')](_0x1286('0x1d')),'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9[_0x1286('0x2d')]?_0x588bf9[_0x1286('0x2d')]:undefined,'callbackat':_0x588bf9['callbackUniqueid']?moment()[_0x1286('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x417b15['id']});})[_0x1286('0x2e')](function(_0x3810a8){_0x2108bd(_0x3810a8);});});});};var _0x4088d2=function(_0x52d2db){return new BPromise(function(_0x4c0560,_0x24b117){_0x251f19(_0x52d2db,_0x588bf9)['then'](function(_0x27f8e2){_0x588bf9[_0x1286('0x1b')]=_0x27f8e2['ret'];_0x8ac47c[_0x1286('0x2a')][_0x1286('0x27')]({'where':{'phone':_0x588bf9['phone'],'CampaignId':_0x52d2db['id']}})[_0x1286('0x1f')](function(_0x338388){if(!_[_0x1286('0x20')](_0x338388)){throw new Error(_0x1286('0x28')+_0x588bf9[_0x1286('0xd')]+_0x1286('0x36')+_0x52d2db['id']);}return _0x8ac47c[_0x1286('0x30')][_0x1286('0x27')]({'where':{'calleridnum':_0x588bf9[_0x1286('0xd')],'CampaignId':_0x52d2db['id']}});})[_0x1286('0x1f')](function(_0x4b4055){if(!_[_0x1286('0x20')](_0x4b4055)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x588bf9['phone']+_0x1286('0x37')+_0x52d2db['id']);}return _0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9[_0x1286('0x33')],'priority':_0x588bf9[_0x1286('0x2c')]?_0x588bf9['priority']:0x2,'scheduledat':_0x588bf9['scheduledat']?_0x588bf9[_0x1286('0x1b')]:moment()[_0x1286('0x1c')](_0x1286('0x1d')),'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9['callbackUniqueid']?_0x588bf9['callbackUniqueid']:undefined,'callbackat':_0x588bf9[_0x1286('0x2d')]?moment()[_0x1286('0x1c')](_0x1286('0x1d')):undefined,'CampaignId':_0x52d2db['id']});})[_0x1286('0x2e')](function(_0x441519){_0x24b117(_0x441519);});});});};if(_0x588bf9[_0x1286('0x33')]){_0x8ac47c['VoiceQueue'][_0x1286('0x38')]({'where':{'type':_0x1286('0x39')},'attributes':['id',_0x1286('0x3a'),_0x1286('0x22')],'include':[{'model':_0x8ac47c['CmList'],'as':_0x1286('0x3b'),'where':{'id':_0x588bf9[_0x1286('0x33')]}}]})[_0x1286('0x1f')](function(_0x4e5e4e){if(_0x4e5e4e){var _0x2c9804=[];for(var _0x1202c4=0x0,_0x46976f;_0x1202c4<_0x4e5e4e[_0x1286('0x3c')];_0x1202c4+=0x1){_0x46976f=_0x4e5e4e[_0x1202c4][_0x1286('0x18')]({'plain':!![]});switch(_0x46976f[_0x1286('0x3a')]){case _0x1286('0x3d'):_0x124d6e(_0x46976f)[_0x1286('0x2e')](_0x37e2d3());break;case _0x1286('0x3e'):_0x13785c(_0x46976f)[_0x1286('0x2e')](_0x37e2d3());break;default:_0x251f19(_0x46976f,_0x588bf9)[_0x1286('0x1f')](function(_0x273eb6){_0x588bf9[_0x1286('0x1b')]=_0x273eb6[_0x1286('0x26')];_0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9['ListId'],'scheduledat':_0x588bf9[_0x1286('0x1b')]?_0x588bf9[_0x1286('0x1b')]:moment()[_0x1286('0x1c')](_0x1286('0x1d')),'priority':_0x588bf9['priority']?_0x588bf9[_0x1286('0x2c')]:0x2,'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9[_0x1286('0x2d')]?_0x588bf9[_0x1286('0x2d')]:undefined,'callbackat':_0x588bf9[_0x1286('0x2d')]?moment()[_0x1286('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x46976f['id']})[_0x1286('0x2e')](_0x37e2d3());});}}}})[_0x1286('0x1f')](function(){return _0x8ac47c[_0x1286('0x1e')][_0x1286('0x38')]({'where':{'type':_0x1286('0x39')},'attributes':['id'],'include':[{'model':_0x8ac47c['CmList'],'as':_0x1286('0x3f'),'where':{'id':_0x588bf9[_0x1286('0x33')]}}]})[_0x1286('0x1f')](function(_0x53e7ad){if(_0x53e7ad){var _0xde1113=[];for(var _0x25aeab=0x0,_0x5006b3;_0x25aeab<_0x53e7ad[_0x1286('0x3c')];_0x25aeab+=0x1){_0x5006b3=_0x53e7ad[_0x25aeab][_0x1286('0x18')]({'plain':!![]});_0x8ac47c['CmHopperBlack'][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9[_0x1286('0x33')],'VoiceQueueId':_0x5006b3['id']})[_0x1286('0x2e')](function(_0x52733d){logger[_0x1286('0x34')](_0x1286('0x40'),'afterCreate',_0x52733d[_0x1286('0x41')]);});}}});})['then'](function(){return _0x8ac47c[_0x1286('0x42')][_0x1286('0x38')]({'attributes':['id',_0x1286('0x3a'),'dialTimezone'],'include':[{'model':_0x8ac47c[_0x1286('0x43')],'as':_0x1286('0x3b'),'where':{'id':_0x588bf9['ListId']}}]})[_0x1286('0x1f')](function(_0xf5af48){if(_0xf5af48){var _0xf55c4b=[];for(var _0x5c8e3a=0x0,_0x1d3933;_0x5c8e3a<_0xf5af48['length'];_0x5c8e3a+=0x1){_0x1d3933=_0xf5af48[_0x5c8e3a]['get']({'plain':!![]});switch(_0x1d3933[_0x1286('0x3a')]){case _0x1286('0x3d'):_0x4088d2(_0x1d3933)[_0x1286('0x2e')](_0x167a68());break;case _0x1286('0x3e'):_0x387864(_0x1d3933)['catch'](_0x167a68());break;default:_0x8ac47c[_0x1286('0x2a')][_0x1286('0x2b')]({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9['ListId'],'scheduledat':_0x588bf9['scheduledat']?_0x588bf9['scheduledat']:moment()[_0x1286('0x1c')](_0x1286('0x1d')),'priority':_0x588bf9[_0x1286('0x2c')]?_0x588bf9[_0x1286('0x2c')]:0x2,'callback':_0x588bf9[_0x1286('0x2d')]?!![]:![],'callbackuniqueid':_0x588bf9['callbackUniqueid']?_0x588bf9[_0x1286('0x2d')]:undefined,'callbackat':_0x588bf9[_0x1286('0x2d')]?moment()[_0x1286('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1d3933['id']})[_0x1286('0x2e')](_0x167a68());}}}});})[_0x1286('0x1f')](function(){return _0x8ac47c['Campaign'][_0x1286('0x38')]({'attributes':['id'],'include':[{'model':_0x8ac47c[_0x1286('0x43')],'as':'BlackLists','where':{'id':_0x588bf9[_0x1286('0x33')]}}]})['then'](function(_0x42e58c){if(_0x42e58c){var _0x13415a=[];for(var _0x5e82a1=0x0,_0x50e122;_0x5e82a1<_0x42e58c[_0x1286('0x3c')];_0x5e82a1+=0x1){_0x50e122=_0x42e58c[_0x5e82a1][_0x1286('0x18')]({'plain':!![]});_0x8ac47c[_0x1286('0x44')]['create']({'phone':_0x588bf9[_0x1286('0xd')],'ContactId':_0x588bf9['id'],'ListId':_0x588bf9[_0x1286('0x33')],'CampaignId':_0x50e122['id']})[_0x1286('0x2e')](function(_0x6365a5){logger[_0x1286('0x34')](_0x1286('0x40'),'afterCreate',_0x6365a5[_0x1286('0x41')]);});}}});})['then'](function(){_0xbe426d();})['catch'](function(_0xc3dff7){logger[_0x1286('0x34')](_0x1286('0x40'),_0x1286('0x45'),_0xc3dff7[_0x1286('0x41')]);_0xbe426d(_0xc3dff7);});}else{_0xbe426d(new Error(_0x1286('0x46')));}},'afterDestroy':function(_0x583a6f,_0x462b13,_0x153d66){var _0x1e8843=_0x300d9e['models'];var _0x3831fe=_0x583a6f['get']({'plain':!![]});return _0x1e8843['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x3831fe[_0x1286('0x33')],'ContactId':_0x3831fe['id']}})['then'](function(_0x55464c){if(!_['isEmpty'](_0x55464c)){var _0x12d451=[];for(var _0x120d82=0x0;_0x120d82<_0x55464c[_0x1286('0x3c')];_0x120d82+=0x1){var _0x48d902=_0x1e8843[_0x1286('0x2a')][_0x1286('0x47')]({'where':{'ListId':_0x55464c[_0x120d82][_0x1286('0x33')],'ContactId':_0x55464c[_0x120d82][_0x1286('0x48')],'VoiceQueueId':_0x55464c[_0x120d82][_0x1286('0x49')],'CampaignId':_0x55464c[_0x120d82][_0x1286('0x4a')]}});_0x12d451[_0x1286('0x4b')](_0x48d902);}return BPromise[_0x1286('0x4c')](_0x12d451);}})[_0x1286('0x1f')](function(_0x101bff){logger[_0x1286('0x4d')]('[CmContact][afterDestroy][Succesfull]',util[_0x1286('0x1a')](_0x101bff,{'showHidden':![],'depth':null}));_0x153d66();})[_0x1286('0x2e')](function(_0xd9dffc){logger['error'](_0x1286('0x4e'),util[_0x1286('0x1a')](_0xd9dffc,{'showHidden':![],'depth':null}));_0x153d66(_0xd9dffc);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index d7723fd..32a0b4b 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0xc4205a,_0x3fa6ad){var _0x28cbfa=function(_0x1f8d24){while(--_0x1f8d24){_0xc4205a['push'](_0xc4205a['shift']());}};_0x28cbfa(++_0x3fa6ad);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4805b8,_0x25fae3){var _0x3289c5=function(_0xe5bc66){while(--_0xe5bc66){_0x4805b8['push'](_0x4805b8['shift']());}};_0x3289c5(++_0x25fae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 671f1b8..7728e40 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b7c=['PHONE','sequelize','exports','INTEGER','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8b7c,0x119));var _0xc8b7=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x8b7c[_0x5e709a];return _0x57401a;};'use strict';var Sequelize=require(_0xc8b7('0x0'));module[_0xc8b7('0x1')]={'CmContactId':{'type':Sequelize[_0xc8b7('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc8b7('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc8b7('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc8b7('0x3')],'defaultValue':_0xc8b7('0x4')},'OrderBy':{'type':Sequelize[_0xc8b7('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xc7e9=['exports','STRING','INTEGER','sequelize'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7e9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x9c7e('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x9c7e('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x9c7e('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x9c7e('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0x9c7e('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 120c38c..91d04ea 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f12=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','json','apply','reject','save','update','then','get','CmContactHasItems','UserProfileResource','destroy','end','error','stack','name','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','catch','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x1f12,0x144));var _0x21f1=function(_0x446e4c,_0x3756e3){_0x446e4c=_0x446e4c-0x0;var _0x238db2=_0x1f12[_0x446e4c];return _0x238db2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x21f1('0x0'));var jsonpatch=require(_0x21f1('0x1'));var rp=require(_0x21f1('0x2'));var moment=require(_0x21f1('0x3'));var BPromise=require(_0x21f1('0x4'));var Mustache=require(_0x21f1('0x5'));var util=require(_0x21f1('0x6'));var path=require('path');var sox=require(_0x21f1('0x7'));var csv=require(_0x21f1('0x8'));var ejs=require(_0x21f1('0x9'));var fs=require('fs');var fs_extra=require(_0x21f1('0xa'));var _=require(_0x21f1('0xb'));var squel=require(_0x21f1('0xc'));var crypto=require(_0x21f1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x21f1('0xe'));var toCsv=require(_0x21f1('0x8'));var querystring=require(_0x21f1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21f1('0x10'));var as=require(_0x21f1('0x11'));var hardwareService=require(_0x21f1('0x12'));var logger=require(_0x21f1('0x13'))(_0x21f1('0x14'));var utils=require(_0x21f1('0x15'));var config=require(_0x21f1('0x16'));var licenseUtil=require(_0x21f1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x760568,_0x718b63){_0x718b63=_0x718b63||0xcc;return function(_0x5e6db7){if(_0x5e6db7){return _0x760568[_0x21f1('0x18')](_0x718b63);}return _0x760568['status'](_0x718b63)['end']();};}function respondWithResult(_0x45e4f1,_0x51c69c){_0x51c69c=_0x51c69c||0xc8;return function(_0x5b9cbf){if(_0x5b9cbf){return _0x45e4f1[_0x21f1('0x19')](_0x51c69c)['json'](_0x5b9cbf);}};}function respondWithFilteredResult(_0x2e6b0c,_0x5a71c5){return function(_0x27e720){if(_0x27e720){var _0x405ac9=typeof _0x5a71c5[_0x21f1('0x1a')]==='undefined'&&typeof _0x5a71c5[_0x21f1('0x1b')]==='undefined';var _0x3efeb9=_0x27e720[_0x21f1('0x1c')];var _0x5dbbcf=_0x405ac9?0x0:_0x5a71c5['offset'];var _0x4aa2ec=_0x405ac9?_0x27e720['count']:_0x5a71c5['offset']+_0x5a71c5[_0x21f1('0x1b')];var _0x4ea18f;if(_0x4aa2ec>=_0x3efeb9){_0x4aa2ec=_0x3efeb9;_0x4ea18f=0xc8;}else{_0x4ea18f=0xce;}_0x2e6b0c['status'](_0x4ea18f);return _0x2e6b0c[_0x21f1('0x1d')]('Content-Range',_0x5dbbcf+'-'+_0x4aa2ec+'/'+_0x3efeb9)[_0x21f1('0x1e')](_0x27e720);}return null;};}function patchUpdates(_0x2008b1){return function(_0x572116){try{jsonpatch[_0x21f1('0x1f')](_0x572116,_0x2008b1,!![]);}catch(_0x44d19f){return BPromise[_0x21f1('0x20')](_0x44d19f);}return _0x572116[_0x21f1('0x21')]();};}function saveUpdates(_0x296117,_0x19407e){return function(_0x1647b5){if(_0x1647b5){return _0x1647b5[_0x21f1('0x22')](_0x296117)[_0x21f1('0x23')](function(_0x5516be){return _0x5516be;});}return null;};}function removeEntity(_0x36add3,_0x2c98e7){return function(_0x45d24f){if(_0x45d24f){return _0x45d24f['destroy']()[_0x21f1('0x23')](function(){var _0x1bf1f4=_0x45d24f[_0x21f1('0x24')]({'plain':!![]});var _0xc71e70=_0x21f1('0x25');return db[_0x21f1('0x26')][_0x21f1('0x27')]({'where':{'type':_0xc71e70,'resourceId':_0x1bf1f4['id']}})[_0x21f1('0x23')](function(){return _0x45d24f;});})[_0x21f1('0x23')](function(){_0x36add3['status'](0xcc)[_0x21f1('0x28')]();});}};}function handleEntityNotFound(_0x2e1354,_0x259832){return function(_0x297e6d){if(!_0x297e6d){_0x2e1354[_0x21f1('0x18')](0x194);}return _0x297e6d;};}function handleError(_0x33cc54,_0x53b6ef){_0x53b6ef=_0x53b6ef||0x1f4;return function(_0x5673e7){logger[_0x21f1('0x29')](_0x5673e7[_0x21f1('0x2a')]);if(_0x5673e7['name']){delete _0x5673e7[_0x21f1('0x2b')];}_0x33cc54[_0x21f1('0x19')](_0x53b6ef)['send'](_0x5673e7);};}exports['index']=function(_0x583446,_0x29217d){var _0x5cef51={},_0x533479={},_0x2d68d4={'count':0x0,'rows':[]};var _0x222f64=_['map'](db['CmContactHasItem']['rawAttributes'],function(_0x3f59e5){return{'name':_0x3f59e5[_0x21f1('0x2c')],'type':_0x3f59e5[_0x21f1('0x2d')][_0x21f1('0x2e')]};});_0x533479[_0x21f1('0x2f')]=_['map'](_0x222f64,_0x21f1('0x2b'));_0x533479['query']=_[_0x21f1('0x30')](_0x583446[_0x21f1('0x31')]);_0x533479['filters']=_[_0x21f1('0x32')](_0x533479[_0x21f1('0x2f')],_0x533479['query']);_0x5cef51[_0x21f1('0x33')]=_['intersection'](_0x533479[_0x21f1('0x2f')],qs[_0x21f1('0x34')](_0x583446[_0x21f1('0x31')][_0x21f1('0x34')]));_0x5cef51[_0x21f1('0x33')]=_0x5cef51['attributes']['length']?_0x5cef51[_0x21f1('0x33')]:_0x533479[_0x21f1('0x2f')];if(!_0x583446[_0x21f1('0x31')][_0x21f1('0x35')]('nolimit')){_0x5cef51[_0x21f1('0x1b')]=qs[_0x21f1('0x1b')](_0x583446[_0x21f1('0x31')][_0x21f1('0x1b')]);_0x5cef51['offset']=qs[_0x21f1('0x1a')](_0x583446[_0x21f1('0x31')][_0x21f1('0x1a')]);}_0x5cef51['order']=qs['sort'](_0x583446[_0x21f1('0x31')][_0x21f1('0x36')]);_0x5cef51[_0x21f1('0x37')]=qs[_0x21f1('0x38')](_[_0x21f1('0x39')](_0x583446[_0x21f1('0x31')],_0x533479[_0x21f1('0x38')]),_0x222f64);if(_0x583446['query'][_0x21f1('0x3a')]){_0x5cef51[_0x21f1('0x37')]=_[_0x21f1('0x3b')](_0x5cef51[_0x21f1('0x37')],{'$or':_[_0x21f1('0x3c')](_0x222f64,function(_0x170f62){if(_0x170f62[_0x21f1('0x2d')]!==_0x21f1('0x3d')){var _0x3856e2={};_0x3856e2[_0x170f62[_0x21f1('0x2b')]]={'$like':'%'+_0x583446[_0x21f1('0x31')][_0x21f1('0x3a')]+'%'};return _0x3856e2;}})});}_0x5cef51=_[_0x21f1('0x3b')]({},_0x5cef51,_0x583446[_0x21f1('0x3e')]);var _0x5b18d9={'where':_0x5cef51[_0x21f1('0x37')]};return db[_0x21f1('0x3f')]['count'](_0x5b18d9)[_0x21f1('0x23')](function(_0x2566bb){_0x2d68d4[_0x21f1('0x1c')]=_0x2566bb;if(_0x583446['query'][_0x21f1('0x40')]){_0x5cef51[_0x21f1('0x41')]=[{'all':!![]}];}return db[_0x21f1('0x3f')][_0x21f1('0x42')](_0x5cef51);})[_0x21f1('0x23')](function(_0x1b5ce7){_0x2d68d4['rows']=_0x1b5ce7;return _0x2d68d4;})[_0x21f1('0x23')](respondWithFilteredResult(_0x29217d,_0x5cef51))[_0x21f1('0x43')](handleError(_0x29217d,null));};exports['show']=function(_0x198a09,_0x4d47b3){var _0x293656={'raw':!![],'where':{'id':_0x198a09[_0x21f1('0x44')]['id']}},_0x2a7d29={};_0x2a7d29[_0x21f1('0x2f')]=_['keys'](db[_0x21f1('0x3f')][_0x21f1('0x45')]);_0x2a7d29[_0x21f1('0x31')]=_['keys'](_0x198a09['query']);_0x2a7d29[_0x21f1('0x38')]=_[_0x21f1('0x32')](_0x2a7d29[_0x21f1('0x2f')],_0x2a7d29[_0x21f1('0x31')]);_0x293656['attributes']=_[_0x21f1('0x32')](_0x2a7d29[_0x21f1('0x2f')],qs[_0x21f1('0x34')](_0x198a09[_0x21f1('0x31')][_0x21f1('0x34')]));_0x293656[_0x21f1('0x33')]=_0x293656['attributes'][_0x21f1('0x46')]?_0x293656['attributes']:_0x2a7d29[_0x21f1('0x2f')];if(_0x198a09[_0x21f1('0x31')][_0x21f1('0x40')]){_0x293656[_0x21f1('0x41')]=[{'all':!![]}];}_0x293656=_[_0x21f1('0x3b')]({},_0x293656,_0x198a09[_0x21f1('0x3e')]);return db[_0x21f1('0x3f')][_0x21f1('0x47')](_0x293656)['then'](handleEntityNotFound(_0x4d47b3,null))[_0x21f1('0x23')](respondWithResult(_0x4d47b3,null))[_0x21f1('0x43')](handleError(_0x4d47b3,null));};exports['create']=function(_0x172deb,_0x2bc849){return db[_0x21f1('0x3f')][_0x21f1('0x48')](_0x172deb[_0x21f1('0x49')],{})['then'](function(_0x1d28ff){var _0x4a8e25=_0x172deb[_0x21f1('0x4a')]['get']({'plain':!![]});if(!_0x4a8e25)throw new Error(_0x21f1('0x4b'));if(_0x4a8e25['role']===_0x21f1('0x4a')){var _0x2f3a4a=_0x1d28ff['get']({'plain':!![]});var _0x25be5a='CmContactHasItems';return db[_0x21f1('0x4c')][_0x21f1('0x47')]({'where':{'name':_0x25be5a,'userProfileId':_0x4a8e25[_0x21f1('0x4d')]},'raw':!![]})[_0x21f1('0x23')](function(_0x5ab68d){if(_0x5ab68d&&_0x5ab68d[_0x21f1('0x4e')]===0x0){return db[_0x21f1('0x26')][_0x21f1('0x48')]({'name':_0x2f3a4a['name'],'resourceId':_0x2f3a4a['id'],'type':_0x5ab68d[_0x21f1('0x2b')],'sectionId':_0x5ab68d['id']},{})[_0x21f1('0x23')](function(){return _0x1d28ff;});}else{return _0x1d28ff;}})[_0x21f1('0x43')](function(_0x56c3d8){logger[_0x21f1('0x29')](_0x21f1('0x4f'),_0x56c3d8);throw _0x56c3d8;});}return _0x1d28ff;})[_0x21f1('0x23')](respondWithResult(_0x2bc849,0xc9))[_0x21f1('0x43')](handleError(_0x2bc849,null));};exports[_0x21f1('0x22')]=function(_0x2e0103,_0xf3f2ae){if(_0x2e0103['body']['id']){delete _0x2e0103[_0x21f1('0x49')]['id'];}return db[_0x21f1('0x3f')][_0x21f1('0x47')]({'where':{'id':_0x2e0103[_0x21f1('0x44')]['id']}})[_0x21f1('0x23')](handleEntityNotFound(_0xf3f2ae,null))[_0x21f1('0x23')](saveUpdates(_0x2e0103[_0x21f1('0x49')],null))['then'](respondWithResult(_0xf3f2ae,null))[_0x21f1('0x43')](handleError(_0xf3f2ae,null));};exports['destroy']=function(_0x32ab5d,_0x278684){return db[_0x21f1('0x3f')][_0x21f1('0x47')]({'where':{'id':_0x32ab5d[_0x21f1('0x44')]['id']}})['then'](handleEntityNotFound(_0x278684,null))['then'](removeEntity(_0x278684,null))[_0x21f1('0x43')](handleError(_0x278684,null));}; \ No newline at end of file +var _0x885c=['includeAll','findAll','rows','catch','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','get','CmContactHasItems','UserProfileResource','then','error','stack','name','send','CmContactHasItem','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x55f50d,_0x3dfee7){var _0xe91e35=function(_0x503d8f){while(--_0x503d8f){_0x55f50d['push'](_0x55f50d['shift']());}};_0xe91e35(++_0x3dfee7);}(_0x885c,0x157));var _0xc885=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0x885c[_0x45f6cb];return _0x5b7f93;};'use strict';var emlformat=require(_0xc885('0x0'));var rimraf=require(_0xc885('0x1'));var zipdir=require(_0xc885('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc885('0x3'));var moment=require(_0xc885('0x4'));var BPromise=require(_0xc885('0x5'));var Mustache=require(_0xc885('0x6'));var util=require(_0xc885('0x7'));var path=require(_0xc885('0x8'));var sox=require('sox');var csv=require(_0xc885('0x9'));var ejs=require(_0xc885('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc885('0xb'));var squel=require('squel');var crypto=require(_0xc885('0xc'));var jsforce=require(_0xc885('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc885('0x9'));var querystring=require(_0xc885('0xe'));var Papa=require(_0xc885('0xf'));var Redis=require('ioredis');var authService=require(_0xc885('0x10'));var qs=require(_0xc885('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc885('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc885('0x13'));var config=require(_0xc885('0x14'));var licenseUtil=require(_0xc885('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46cabc,_0x3487dc){_0x3487dc=_0x3487dc||0xcc;return function(_0x159566){if(_0x159566){return _0x46cabc[_0xc885('0x16')](_0x3487dc);}return _0x46cabc[_0xc885('0x17')](_0x3487dc)[_0xc885('0x18')]();};}function respondWithResult(_0x33d796,_0x21781b){_0x21781b=_0x21781b||0xc8;return function(_0x9c4d9f){if(_0x9c4d9f){return _0x33d796[_0xc885('0x17')](_0x21781b)[_0xc885('0x19')](_0x9c4d9f);}};}function respondWithFilteredResult(_0x5b30eb,_0x489ef5){return function(_0x4da05b){if(_0x4da05b){var _0x706d17=typeof _0x489ef5[_0xc885('0x1a')]===_0xc885('0x1b')&&typeof _0x489ef5['limit']==='undefined';var _0x594dfe=_0x4da05b['count'];var _0x442f96=_0x706d17?0x0:_0x489ef5[_0xc885('0x1a')];var _0x128fed=_0x706d17?_0x4da05b[_0xc885('0x1c')]:_0x489ef5[_0xc885('0x1a')]+_0x489ef5['limit'];var _0x2e5678;if(_0x128fed>=_0x594dfe){_0x128fed=_0x594dfe;_0x2e5678=0xc8;}else{_0x2e5678=0xce;}_0x5b30eb['status'](_0x2e5678);return _0x5b30eb['set'](_0xc885('0x1d'),_0x442f96+'-'+_0x128fed+'/'+_0x594dfe)[_0xc885('0x19')](_0x4da05b);}return null;};}function patchUpdates(_0xd70678){return function(_0x142441){try{jsonpatch[_0xc885('0x1e')](_0x142441,_0xd70678,!![]);}catch(_0x2c8082){return BPromise[_0xc885('0x1f')](_0x2c8082);}return _0x142441[_0xc885('0x20')]();};}function saveUpdates(_0x57c2ae,_0x29fe75){return function(_0x14a93f){if(_0x14a93f){return _0x14a93f[_0xc885('0x21')](_0x57c2ae)['then'](function(_0x381ce3){return _0x381ce3;});}return null;};}function removeEntity(_0x4d2e96,_0x477390){return function(_0x481698){if(_0x481698){return _0x481698[_0xc885('0x22')]()['then'](function(){var _0x3d62c4=_0x481698[_0xc885('0x23')]({'plain':!![]});var _0x59e0ff=_0xc885('0x24');return db[_0xc885('0x25')][_0xc885('0x22')]({'where':{'type':_0x59e0ff,'resourceId':_0x3d62c4['id']}})[_0xc885('0x26')](function(){return _0x481698;});})['then'](function(){_0x4d2e96[_0xc885('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41e019,_0xe1ae13){return function(_0x24c488){if(!_0x24c488){_0x41e019['sendStatus'](0x194);}return _0x24c488;};}function handleError(_0xcc19bb,_0x3c25be){_0x3c25be=_0x3c25be||0x1f4;return function(_0x47f2c3){logger[_0xc885('0x27')](_0x47f2c3[_0xc885('0x28')]);if(_0x47f2c3[_0xc885('0x29')]){delete _0x47f2c3['name'];}_0xcc19bb['status'](_0x3c25be)[_0xc885('0x2a')](_0x47f2c3);};}exports['index']=function(_0xff1995,_0xc0e587){var _0x2e23ca={},_0x120e28={},_0x14448c={'count':0x0,'rows':[]};var _0x5947f6=_['map'](db[_0xc885('0x2b')]['rawAttributes'],function(_0x2e63d5){return{'name':_0x2e63d5[_0xc885('0x2c')],'type':_0x2e63d5[_0xc885('0x2d')][_0xc885('0x2e')]};});_0x120e28[_0xc885('0x2f')]=_[_0xc885('0x30')](_0x5947f6,'name');_0x120e28[_0xc885('0x31')]=_[_0xc885('0x32')](_0xff1995['query']);_0x120e28[_0xc885('0x33')]=_[_0xc885('0x34')](_0x120e28['model'],_0x120e28[_0xc885('0x31')]);_0x2e23ca[_0xc885('0x35')]=_['intersection'](_0x120e28[_0xc885('0x2f')],qs[_0xc885('0x36')](_0xff1995['query'][_0xc885('0x36')]));_0x2e23ca['attributes']=_0x2e23ca[_0xc885('0x35')][_0xc885('0x37')]?_0x2e23ca['attributes']:_0x120e28[_0xc885('0x2f')];if(!_0xff1995[_0xc885('0x31')][_0xc885('0x38')](_0xc885('0x39'))){_0x2e23ca['limit']=qs[_0xc885('0x3a')](_0xff1995[_0xc885('0x31')][_0xc885('0x3a')]);_0x2e23ca['offset']=qs[_0xc885('0x1a')](_0xff1995[_0xc885('0x31')][_0xc885('0x1a')]);}_0x2e23ca[_0xc885('0x3b')]=qs[_0xc885('0x3c')](_0xff1995['query'][_0xc885('0x3c')]);_0x2e23ca['where']=qs['filters'](_[_0xc885('0x3d')](_0xff1995[_0xc885('0x31')],_0x120e28[_0xc885('0x33')]),_0x5947f6);if(_0xff1995['query'][_0xc885('0x3e')]){_0x2e23ca[_0xc885('0x3f')]=_[_0xc885('0x40')](_0x2e23ca['where'],{'$or':_[_0xc885('0x30')](_0x5947f6,function(_0x115b18){if(_0x115b18[_0xc885('0x2d')]!==_0xc885('0x41')){var _0x191038={};_0x191038[_0x115b18[_0xc885('0x29')]]={'$like':'%'+_0xff1995['query'][_0xc885('0x3e')]+'%'};return _0x191038;}})});}_0x2e23ca=_[_0xc885('0x40')]({},_0x2e23ca,_0xff1995[_0xc885('0x42')]);var _0x217152={'where':_0x2e23ca[_0xc885('0x3f')]};return db[_0xc885('0x2b')]['count'](_0x217152)[_0xc885('0x26')](function(_0x6e4f77){_0x14448c[_0xc885('0x1c')]=_0x6e4f77;if(_0xff1995[_0xc885('0x31')][_0xc885('0x43')]){_0x2e23ca['include']=[{'all':!![]}];}return db[_0xc885('0x2b')][_0xc885('0x44')](_0x2e23ca);})[_0xc885('0x26')](function(_0x127bf2){_0x14448c[_0xc885('0x45')]=_0x127bf2;return _0x14448c;})[_0xc885('0x26')](respondWithFilteredResult(_0xc0e587,_0x2e23ca))[_0xc885('0x46')](handleError(_0xc0e587,null));};exports['show']=function(_0x35fa63,_0x373366){var _0x148bd2={'raw':!![],'where':{'id':_0x35fa63['params']['id']}},_0x45042b={};_0x45042b[_0xc885('0x2f')]=_[_0xc885('0x32')](db[_0xc885('0x2b')][_0xc885('0x47')]);_0x45042b[_0xc885('0x31')]=_[_0xc885('0x32')](_0x35fa63[_0xc885('0x31')]);_0x45042b[_0xc885('0x33')]=_['intersection'](_0x45042b['model'],_0x45042b[_0xc885('0x31')]);_0x148bd2[_0xc885('0x35')]=_[_0xc885('0x34')](_0x45042b[_0xc885('0x2f')],qs['fields'](_0x35fa63[_0xc885('0x31')][_0xc885('0x36')]));_0x148bd2['attributes']=_0x148bd2[_0xc885('0x35')][_0xc885('0x37')]?_0x148bd2['attributes']:_0x45042b[_0xc885('0x2f')];if(_0x35fa63[_0xc885('0x31')][_0xc885('0x43')]){_0x148bd2['include']=[{'all':!![]}];}_0x148bd2=_[_0xc885('0x40')]({},_0x148bd2,_0x35fa63[_0xc885('0x42')]);return db[_0xc885('0x2b')][_0xc885('0x48')](_0x148bd2)[_0xc885('0x26')](handleEntityNotFound(_0x373366,null))['then'](respondWithResult(_0x373366,null))[_0xc885('0x46')](handleError(_0x373366,null));};exports[_0xc885('0x49')]=function(_0x41fb1e,_0x3a04b4){return db[_0xc885('0x2b')][_0xc885('0x49')](_0x41fb1e[_0xc885('0x4a')],{})[_0xc885('0x26')](function(_0x4b80ae){var _0x27b95b=_0x41fb1e[_0xc885('0x4b')][_0xc885('0x23')]({'plain':!![]});if(!_0x27b95b)throw new Error(_0xc885('0x4c'));if(_0x27b95b['role']==='user'){var _0x220239=_0x4b80ae[_0xc885('0x23')]({'plain':!![]});var _0x45c3f8='CmContactHasItems';return db[_0xc885('0x4d')]['find']({'where':{'name':_0x45c3f8,'userProfileId':_0x27b95b[_0xc885('0x4e')]},'raw':!![]})[_0xc885('0x26')](function(_0x20cee6){if(_0x20cee6&&_0x20cee6[_0xc885('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x220239[_0xc885('0x29')],'resourceId':_0x220239['id'],'type':_0x20cee6[_0xc885('0x29')],'sectionId':_0x20cee6['id']},{})[_0xc885('0x26')](function(){return _0x4b80ae;});}else{return _0x4b80ae;}})[_0xc885('0x46')](function(_0x383fe4){logger[_0xc885('0x27')](_0xc885('0x50'),_0x383fe4);throw _0x383fe4;});}return _0x4b80ae;})[_0xc885('0x26')](respondWithResult(_0x3a04b4,0xc9))[_0xc885('0x46')](handleError(_0x3a04b4,null));};exports[_0xc885('0x21')]=function(_0x53cdff,_0x15193e){if(_0x53cdff[_0xc885('0x4a')]['id']){delete _0x53cdff[_0xc885('0x4a')]['id'];}return db[_0xc885('0x2b')]['find']({'where':{'id':_0x53cdff[_0xc885('0x51')]['id']}})[_0xc885('0x26')](handleEntityNotFound(_0x15193e,null))['then'](saveUpdates(_0x53cdff['body'],null))['then'](respondWithResult(_0x15193e,null))[_0xc885('0x46')](handleError(_0x15193e,null));};exports[_0xc885('0x22')]=function(_0x1ce061,_0x476089){return db['CmContactHasItem'][_0xc885('0x48')]({'where':{'id':_0x1ce061[_0xc885('0x51')]['id']}})[_0xc885('0x26')](handleEntityNotFound(_0x476089,null))['then'](removeEntity(_0x476089,null))[_0xc885('0x46')](handleError(_0x476089,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index f17300f..c256089 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4fc=['util','api','moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x188a13,_0xf2cddb){var _0x37f488=function(_0x24b39f){while(--_0x24b39f){_0x188a13['push'](_0x188a13['shift']());}};_0x37f488(++_0xf2cddb);}(_0xd4fc,0x11d));var _0xcd4f=function(_0x1501d9,_0x84fcf7){_0x1501d9=_0x1501d9-0x0;var _0x269f96=_0xd4fc[_0x1501d9];return _0x269f96;};'use strict';var _=require(_0xcd4f('0x0'));var util=require(_0xcd4f('0x1'));var logger=require('../../config/logger')(_0xcd4f('0x2'));var moment=require(_0xcd4f('0x3'));var BPromise=require(_0xcd4f('0x4'));var rp=require(_0xcd4f('0x5'));var fs=require('fs');var path=require(_0xcd4f('0x6'));var rimraf=require('rimraf');var config=require(_0xcd4f('0x7'));var attributes=require(_0xcd4f('0x8'));module[_0xcd4f('0x9')]=function(_0x1e4a05,_0x56101d){return _0x1e4a05[_0xcd4f('0xa')](_0xcd4f('0xb'),attributes,{'tableName':_0xcd4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x729b=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x22cf86,_0x9ecba2){var _0x2d1ea9=function(_0x44b259){while(--_0x44b259){_0x22cf86['push'](_0x22cf86['shift']());}};_0x2d1ea9(++_0x9ecba2);}(_0x729b,0x1cb));var _0xb729=function(_0x49ca8d,_0x491596){_0x49ca8d=_0x49ca8d-0x0;var _0x591290=_0x729b[_0x49ca8d];return _0x591290;};'use strict';var _=require(_0xb729('0x0'));var util=require(_0xb729('0x1'));var logger=require(_0xb729('0x2'))(_0xb729('0x3'));var moment=require(_0xb729('0x4'));var BPromise=require(_0xb729('0x5'));var rp=require(_0xb729('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb729('0x7'));var config=require(_0xb729('0x8'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x4cda38,_0x4efe26){return _0x4cda38[_0xb729('0x9')](_0xb729('0xa'),attributes,{'tableName':_0xb729('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6b66442..aa48126 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3da1=['request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x55c79e,_0x33920e){var _0x1e4deb=function(_0x3327e4){while(--_0x3327e4){_0x55c79e['push'](_0x55c79e['shift']());}};_0x1e4deb(++_0x33920e);}(_0x3da1,0x156));var _0x13da=function(_0x205ba6,_0x33fc1d){_0x205ba6=_0x205ba6-0x0;var _0x4638e3=_0x3da1[_0x205ba6];return _0x4638e3;};'use strict';var _=require(_0x13da('0x0'));var util=require(_0x13da('0x1'));var moment=require('moment');var BPromise=require(_0x13da('0x2'));var rs=require(_0x13da('0x3'));var fs=require('fs');var Redis=require(_0x13da('0x4'));var db=require(_0x13da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x13da('0x6'))('rpc');var config=require(_0x13da('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x13da('0x8')][_0x13da('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x107296,_0x484204,_0x4edf8b){return new BPromise(function(_0x554070,_0x440c5c){return client[_0x13da('0xa')](_0x107296,_0x4edf8b)['then'](function(_0xefa14c){logger[_0x13da('0xb')](_0x13da('0xc'),_0x484204,_0x13da('0xd'));logger[_0x13da('0xe')](_0x13da('0xf'),_0x484204,'request\x20sent',JSON[_0x13da('0x10')](_0xefa14c));if(_0xefa14c['error']){if(_0xefa14c[_0x13da('0x11')][_0x13da('0x12')]===0x1f4){logger['error'](_0x13da('0xc'),_0x484204,_0xefa14c['error'][_0x13da('0x13')]);return _0x440c5c(_0xefa14c[_0x13da('0x11')][_0x13da('0x13')]);}logger[_0x13da('0x11')](_0x13da('0xc'),_0x484204,_0xefa14c[_0x13da('0x11')]['message']);return _0x554070(_0xefa14c[_0x13da('0x11')][_0x13da('0x13')]);}else{logger[_0x13da('0xb')](_0x13da('0xc'),_0x484204,_0x13da('0xd'));_0x554070(_0xefa14c[_0x13da('0x14')]['message']);}})[_0x13da('0x15')](function(_0x3f7d74){logger[_0x13da('0x11')](_0x13da('0xc'),_0x484204,_0x3f7d74);_0x440c5c(_0x3f7d74);});});} \ No newline at end of file +var _0x5dc9=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2ad08e,_0xf49111){var _0xc1b283=function(_0xcd90cf){while(--_0xcd90cf){_0x2ad08e['push'](_0x2ad08e['shift']());}};_0xc1b283(++_0xf49111);}(_0x5dc9,0x1f1));var _0x95dc=function(_0x3ad80c,_0x17944d){_0x3ad80c=_0x3ad80c-0x0;var _0xbfe061=_0x5dc9[_0x3ad80c];return _0xbfe061;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x95dc('0x0'));var BPromise=require(_0x95dc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95dc('0x2'));var db=require(_0x95dc('0x3'))['db'];var utils=require(_0x95dc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95dc('0x5'));var jayson=require(_0x95dc('0x6'));var client=jayson[_0x95dc('0x7')][_0x95dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cb136,_0x4eaef6,_0x45f443){return new BPromise(function(_0x2fb0c1,_0x368bdd){return client[_0x95dc('0x9')](_0x4cb136,_0x45f443)[_0x95dc('0xa')](function(_0x3da1b6){logger[_0x95dc('0xb')](_0x95dc('0xc'),_0x4eaef6,_0x95dc('0xd'));logger[_0x95dc('0xe')](_0x95dc('0xf'),_0x4eaef6,_0x95dc('0xd'),JSON[_0x95dc('0x10')](_0x3da1b6));if(_0x3da1b6[_0x95dc('0x11')]){if(_0x3da1b6[_0x95dc('0x11')]['code']===0x1f4){logger[_0x95dc('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x4eaef6,_0x3da1b6['error'][_0x95dc('0x12')]);return _0x368bdd(_0x3da1b6[_0x95dc('0x11')][_0x95dc('0x12')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x4eaef6,_0x3da1b6[_0x95dc('0x11')]['message']);return _0x2fb0c1(_0x3da1b6['error'][_0x95dc('0x12')]);}else{logger['info'](_0x95dc('0xc'),_0x4eaef6,'request\x20sent');_0x2fb0c1(_0x3da1b6[_0x95dc('0x13')]['message']);}})[_0x95dc('0x14')](function(_0x24a979){logger['error'](_0x95dc('0xc'),_0x4eaef6,_0x24a979);_0x368bdd(_0x24a979);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 3fec4e5..9c8a5a7 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71d3=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x33d23f,_0x1f5e0f){var _0x23e4be=function(_0x5a58f7){while(--_0x5a58f7){_0x33d23f['push'](_0x33d23f['shift']());}};_0x23e4be(++_0x1f5e0f);}(_0x71d3,0x67));var _0x371d=function(_0x4f614c,_0x547bf9){_0x4f614c=_0x4f614c-0x0;var _0x1ae415=_0x71d3[_0x4f614c];return _0x1ae415;};'use strict';var multer=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var path=require(_0x371d('0x2'));var timeout=require('connect-timeout');var express=require(_0x371d('0x3'));var router=express[_0x371d('0x4')]();var fs_extra=require(_0x371d('0x5'));var auth=require(_0x371d('0x6'));var interaction=require(_0x371d('0x7'));var config=require(_0x371d('0x8'));var controller=require(_0x371d('0x9'));router['get']('/',auth[_0x371d('0xa')](),controller[_0x371d('0xb')]);router['get']('/:id',auth[_0x371d('0xa')](),controller[_0x371d('0xc')]);router[_0x371d('0xd')]('/',auth[_0x371d('0xa')](),controller[_0x371d('0xe')]);router[_0x371d('0xf')](_0x371d('0x10'),auth['isAuthenticated'](),controller[_0x371d('0x11')]);router[_0x371d('0x12')](_0x371d('0x10'),auth[_0x371d('0xa')](),controller[_0x371d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfd6d=['/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfd6d,0x14b));var _0xdfd6=function(_0x3f50c6,_0x12c1ca){_0x3f50c6=_0x3f50c6-0x0;var _0x26adba=_0xfd6d[_0x3f50c6];return _0x26adba;};'use strict';var multer=require(_0xdfd6('0x0'));var util=require(_0xdfd6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfd6('0x2'));var router=express[_0xdfd6('0x3')]();var fs_extra=require(_0xdfd6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdfd6('0x5'));var config=require(_0xdfd6('0x6'));var controller=require(_0xdfd6('0x7'));router[_0xdfd6('0x8')]('/',auth[_0xdfd6('0x9')](),controller[_0xdfd6('0xa')]);router[_0xdfd6('0x8')](_0xdfd6('0xb'),auth[_0xdfd6('0x9')](),controller[_0xdfd6('0xc')]);router[_0xdfd6('0xd')]('/',auth[_0xdfd6('0x9')](),controller[_0xdfd6('0xe')]);router[_0xdfd6('0xf')]('/:id',auth[_0xdfd6('0x9')](),controller[_0xdfd6('0x10')]);router[_0xdfd6('0x11')](_0xdfd6('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xdfd6('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 1860e15..833be0a 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 _0x9a21=['name','long','type','select','parse','isArray','values','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue','STRING','setDataValue'];(function(_0x57035d,_0x29577a){var _0x18de21=function(_0x3a8a5d){while(--_0x3a8a5d){_0x57035d['push'](_0x57035d['shift']());}};_0x18de21(++_0x29577a);}(_0x9a21,0xd7));var _0x19a2=function(_0x41d75b,_0x3321a6){_0x41d75b=_0x41d75b-0x0;var _0x378597=_0x9a21[_0x41d75b];return _0x378597;};'use strict';var Sequelize=require(_0x19a2('0x0'));var _=require(_0x19a2('0x1'));module[_0x19a2('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x58806b){return this[_0x19a2('0x3')]('alias');}},'alias':{'type':Sequelize[_0x19a2('0x4')],'allowNull':![],'set':function(_0x275ad5){this[_0x19a2('0x5')]('alias',_0x275ad5?_0x275ad5:this[_0x19a2('0x3')](_0x19a2('0x6')));}},'type':{'type':Sequelize[_0x19a2('0x4')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x19a2('0x7')),'get':function(){if(this['getDataValue'](_0x19a2('0x8'))===_0x19a2('0x9')){return JSON[_0x19a2('0xa')](this[_0x19a2('0x3')]('values'));}else{return this[_0x19a2('0x3')]('values');}},'set':function(_0x478864){if(Array[_0x19a2('0xb')](_0x478864)){this['setDataValue'](_0x19a2('0xc'),JSON[_0x19a2('0xd')](_0x478864));}else{this[_0x19a2('0x5')](_0x19a2('0xc'),_0x478864);}}},'required':{'type':Sequelize[_0x19a2('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x19a2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x19a2('0xf')](_0x19a2('0x10'))}}; \ No newline at end of file +var _0x1b12=['BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse','values','isArray','stringify'];(function(_0x266e2c,_0x57b6ab){var _0xb19c8b=function(_0x4b9f49){while(--_0x4b9f49){_0x266e2c['push'](_0x266e2c['shift']());}};_0xb19c8b(++_0x57b6ab);}(_0x1b12,0xb7));var _0x21b1=function(_0x45798e,_0xaa06f3){_0x45798e=_0x45798e-0x0;var _0x359dcf=_0x1b12[_0x45798e];return _0x359dcf;};'use strict';var Sequelize=require('sequelize');var _=require(_0x21b1('0x0'));module[_0x21b1('0x1')]={'name':{'type':Sequelize[_0x21b1('0x2')],'get':function(_0x73c1f4){return this[_0x21b1('0x3')](_0x21b1('0x4'));}},'alias':{'type':Sequelize[_0x21b1('0x5')],'allowNull':![],'set':function(_0x20da62){this[_0x21b1('0x6')](_0x21b1('0x4'),_0x20da62?_0x20da62:this[_0x21b1('0x3')](_0x21b1('0x7')));}},'type':{'type':Sequelize[_0x21b1('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x21b1('0x8')](_0x21b1('0x9')),'get':function(){if(this[_0x21b1('0x3')]('type')===_0x21b1('0xa')){return JSON[_0x21b1('0xb')](this['getDataValue'](_0x21b1('0xc')));}else{return this[_0x21b1('0x3')]('values');}},'set':function(_0x13431d){if(Array[_0x21b1('0xd')](_0x13431d)){this[_0x21b1('0x6')]('values',JSON[_0x21b1('0xe')](_0x13431d));}else{this[_0x21b1('0x6')](_0x21b1('0xc'),_0x13431d);}}},'required':{'type':Sequelize[_0x21b1('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x21b1('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x21b1('0x10')](_0x21b1('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6ae2d08..705a859 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 _0x21f5=['find','body','destroy','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','update','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x4d0791,_0x4cdf29){var _0x5c3ae6=function(_0x322518){while(--_0x322518){_0x4d0791['push'](_0x4d0791['shift']());}};_0x5c3ae6(++_0x4cdf29);}(_0x21f5,0xca));var _0x521f=function(_0x37d45c,_0x2c6f2f){_0x37d45c=_0x37d45c-0x0;var _0xd649c4=_0x21f5[_0x37d45c];return _0xd649c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x521f('0x0'));var zipdir=require(_0x521f('0x1'));var jsonpatch=require(_0x521f('0x2'));var rp=require(_0x521f('0x3'));var moment=require(_0x521f('0x4'));var BPromise=require(_0x521f('0x5'));var Mustache=require(_0x521f('0x6'));var util=require(_0x521f('0x7'));var path=require(_0x521f('0x8'));var sox=require(_0x521f('0x9'));var csv=require(_0x521f('0xa'));var ejs=require(_0x521f('0xb'));var fs=require('fs');var fs_extra=require(_0x521f('0xc'));var _=require(_0x521f('0xd'));var squel=require(_0x521f('0xe'));var crypto=require(_0x521f('0xf'));var jsforce=require(_0x521f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x521f('0xa'));var querystring=require(_0x521f('0x11'));var Papa=require('papaparse');var Redis=require(_0x521f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x521f('0x13'));var as=require(_0x521f('0x14'));var hardwareService=require(_0x521f('0x15'));var logger=require(_0x521f('0x16'))(_0x521f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x521f('0x18'));var db=require(_0x521f('0x19'))['db'];function respondWithStatusCode(_0x333451,_0x5bee0b){_0x5bee0b=_0x5bee0b||0xcc;return function(_0x283884){if(_0x283884){return _0x333451[_0x521f('0x1a')](_0x5bee0b);}return _0x333451[_0x521f('0x1b')](_0x5bee0b)[_0x521f('0x1c')]();};}function respondWithResult(_0x3c359c,_0x168667){_0x168667=_0x168667||0xc8;return function(_0x211329){if(_0x211329){return _0x3c359c[_0x521f('0x1b')](_0x168667)['json'](_0x211329);}};}function respondWithFilteredResult(_0x12a15a,_0x94d1fd){return function(_0x6d0d1f){if(_0x6d0d1f){var _0x217b46=typeof _0x94d1fd['offset']===_0x521f('0x1d')&&typeof _0x94d1fd[_0x521f('0x1e')]==='undefined';var _0x1631c6=_0x6d0d1f[_0x521f('0x1f')];var _0xbafb27=_0x217b46?0x0:_0x94d1fd[_0x521f('0x20')];var _0x3e43f6=_0x217b46?_0x6d0d1f[_0x521f('0x1f')]:_0x94d1fd[_0x521f('0x20')]+_0x94d1fd[_0x521f('0x1e')];var _0x1e3b4e;if(_0x3e43f6>=_0x1631c6){_0x3e43f6=_0x1631c6;_0x1e3b4e=0xc8;}else{_0x1e3b4e=0xce;}_0x12a15a[_0x521f('0x1b')](_0x1e3b4e);return _0x12a15a['set']('Content-Range',_0xbafb27+'-'+_0x3e43f6+'/'+_0x1631c6)[_0x521f('0x21')](_0x6d0d1f);}return null;};}function patchUpdates(_0x53f5d5){return function(_0x40ef5e){try{jsonpatch[_0x521f('0x22')](_0x40ef5e,_0x53f5d5,!![]);}catch(_0x2946e3){return BPromise[_0x521f('0x23')](_0x2946e3);}return _0x40ef5e['save']();};}function saveUpdates(_0x4f35fb,_0x3fea2a){return function(_0x1920ad){if(_0x1920ad){return _0x1920ad[_0x521f('0x24')](_0x4f35fb)['then'](function(_0x4d2793){return _0x4d2793;});}return null;};}function removeEntity(_0xfe36b1,_0x237e87){return function(_0x5c1813){if(_0x5c1813){return _0x5c1813['destroy']()['then'](function(){_0xfe36b1[_0x521f('0x1b')](0xcc)[_0x521f('0x1c')]();});}};}function handleEntityNotFound(_0x17cc5f,_0xad9066){return function(_0x376cbd){if(!_0x376cbd){_0x17cc5f[_0x521f('0x1a')](0x194);}return _0x376cbd;};}function handleError(_0x4451ac,_0x19a996){_0x19a996=_0x19a996||0x1f4;return function(_0x444719){logger[_0x521f('0x25')](_0x444719[_0x521f('0x26')]);if(_0x444719[_0x521f('0x27')]){delete _0x444719[_0x521f('0x27')];}_0x4451ac[_0x521f('0x1b')](_0x19a996)[_0x521f('0x28')](_0x444719);};}exports['index']=function(_0x4b1db5,_0x103437){var _0x51a48b={},_0x5b05fd={},_0x2a5a39={'count':0x0,'rows':[]};var _0xd50bb2=_['map'](db[_0x521f('0x29')][_0x521f('0x2a')],function(_0x526d37){return{'name':_0x526d37[_0x521f('0x2b')],'type':_0x526d37[_0x521f('0x2c')][_0x521f('0x2d')]};});_0x5b05fd['model']=_[_0x521f('0x2e')](_['map'](_0xd50bb2,_0x521f('0x27')),[_0x521f('0x27')]);_0x5b05fd[_0x521f('0x2f')]=_['keys'](_0x4b1db5['query']);_0x5b05fd[_0x521f('0x30')]=_[_0x521f('0x31')](_0x5b05fd[_0x521f('0x32')],_0x5b05fd[_0x521f('0x2f')]);_0x51a48b[_0x521f('0x33')]=_[_0x521f('0x31')](_0x5b05fd[_0x521f('0x32')],qs[_0x521f('0x34')](_0x4b1db5[_0x521f('0x2f')][_0x521f('0x34')]));_0x51a48b['attributes']=_0x51a48b[_0x521f('0x33')][_0x521f('0x35')]?_0x51a48b[_0x521f('0x33')]:_0x5b05fd[_0x521f('0x32')];if(!_0x4b1db5[_0x521f('0x2f')][_0x521f('0x36')](_0x521f('0x37'))){_0x51a48b[_0x521f('0x1e')]=qs[_0x521f('0x1e')](_0x4b1db5[_0x521f('0x2f')][_0x521f('0x1e')]);_0x51a48b[_0x521f('0x20')]=qs[_0x521f('0x20')](_0x4b1db5[_0x521f('0x2f')]['offset']);}_0x51a48b[_0x521f('0x38')]=qs['sort'](_0x4b1db5[_0x521f('0x2f')][_0x521f('0x39')]);_0x51a48b[_0x521f('0x3a')]=qs[_0x521f('0x30')](_[_0x521f('0x3b')](_0x4b1db5[_0x521f('0x2f')],_0x5b05fd[_0x521f('0x30')]),_0xd50bb2);if(_0x4b1db5[_0x521f('0x2f')][_0x521f('0x3c')]){_0x51a48b[_0x521f('0x3a')]=_[_0x521f('0x3d')](_0x51a48b[_0x521f('0x3a')],{'$or':_[_0x521f('0x3e')](_0xd50bb2,function(_0x2cd310){if(_0x2cd310[_0x521f('0x2c')]!==_0x521f('0x3f')){var _0x391b81={};_0x391b81[_0x2cd310[_0x521f('0x27')]]={'$like':'%'+_0x4b1db5[_0x521f('0x2f')][_0x521f('0x3c')]+'%'};return _0x391b81;}})});}_0x51a48b=_['merge']({},_0x51a48b,_0x4b1db5[_0x521f('0x40')]);var _0x4b6981={'where':_0x51a48b[_0x521f('0x3a')]};return db[_0x521f('0x29')]['count'](_0x4b6981)[_0x521f('0x41')](function(_0x2db51e){_0x2a5a39[_0x521f('0x1f')]=_0x2db51e;if(_0x4b1db5[_0x521f('0x2f')][_0x521f('0x42')]){_0x51a48b[_0x521f('0x43')]=[{'all':!![]}];}return db[_0x521f('0x29')][_0x521f('0x44')](_0x51a48b);})['then'](function(_0x7bb0df){_0x2a5a39[_0x521f('0x45')]=_0x7bb0df;return _0x2a5a39;})[_0x521f('0x41')](respondWithFilteredResult(_0x103437,_0x51a48b))[_0x521f('0x46')](handleError(_0x103437,null));};exports[_0x521f('0x47')]=function(_0x5b896f,_0x5af893){var _0x8f9a44={'raw':!![],'where':{'id':_0x5b896f[_0x521f('0x48')]['id']}},_0x43d865={};_0x43d865[_0x521f('0x32')]=_[_0x521f('0x49')](db[_0x521f('0x29')]['rawAttributes']);_0x43d865[_0x521f('0x2f')]=_[_0x521f('0x49')](_0x5b896f[_0x521f('0x2f')]);_0x43d865[_0x521f('0x30')]=_[_0x521f('0x31')](_0x43d865['model'],_0x43d865[_0x521f('0x2f')]);_0x8f9a44[_0x521f('0x33')]=_[_0x521f('0x31')](_0x43d865['model'],qs[_0x521f('0x34')](_0x5b896f[_0x521f('0x2f')]['fields']));_0x8f9a44[_0x521f('0x33')]=_0x8f9a44['attributes'][_0x521f('0x35')]?_0x8f9a44[_0x521f('0x33')]:_0x43d865['model'];if(_0x5b896f['query'][_0x521f('0x42')]){_0x8f9a44[_0x521f('0x43')]=[{'all':!![]}];}_0x8f9a44=_[_0x521f('0x3d')]({},_0x8f9a44,_0x5b896f[_0x521f('0x40')]);return db['CmCustomField'][_0x521f('0x4a')](_0x8f9a44)[_0x521f('0x41')](handleEntityNotFound(_0x5af893,null))[_0x521f('0x41')](respondWithResult(_0x5af893,null))[_0x521f('0x46')](handleError(_0x5af893,null));};exports['update']=function(_0x577d6c,_0x17ff15){if(_0x577d6c[_0x521f('0x4b')]['id']){delete _0x577d6c['body']['id'];}return db[_0x521f('0x29')][_0x521f('0x4a')]({'where':{'id':_0x577d6c[_0x521f('0x48')]['id']}})['then'](handleEntityNotFound(_0x17ff15,null))[_0x521f('0x41')](saveUpdates(_0x577d6c[_0x521f('0x4b')],null))[_0x521f('0x41')](respondWithResult(_0x17ff15,null))[_0x521f('0x46')](handleError(_0x17ff15,null));};exports[_0x521f('0x4c')]=function(_0x113fec,_0x1630e7){return db[_0x521f('0x29')][_0x521f('0x4a')]({'where':{'id':_0x113fec[_0x521f('0x48')]['id']}})[_0x521f('0x41')](handleEntityNotFound(_0x1630e7,null))[_0x521f('0x41')](removeEntity(_0x1630e7,null))['catch'](handleError(_0x1630e7,null));};exports[_0x521f('0x4d')]=function(_0x1de63f,_0xf1cb7f){var _0x302672;return db['sequelize'][_0x521f('0x4e')](function(_0x4e63c1){return db['CmCustomField'][_0x521f('0x4d')](_0x1de63f['body'],{'transaction':_0x4e63c1})[_0x521f('0x41')](function(_0x5d2c53){_0x302672=_0x5d2c53;var _0x56a2d0={'type':db[_0x521f('0x4f')][_0x521f('0x50')],'transaction':_0x4e63c1};switch(_0x1de63f['body'][_0x521f('0x2c')]){case _0x521f('0x51'):_0x56a2d0[_0x521f('0x2c')]=db['Sequelize']['TEXT'];break;case _0x521f('0x52'):_0x56a2d0[_0x521f('0x2c')]=db['Sequelize'][_0x521f('0x53')];break;case _0x521f('0x54'):_0x56a2d0[_0x521f('0x2c')]=db[_0x521f('0x4f')][_0x521f('0x55')];_0x56a2d0[_0x521f('0x56')]=![];break;default:}return db[_0x521f('0x57')][_0x521f('0x58')][_0x521f('0x59')](_0x521f('0x5a'),util[_0x521f('0x5b')]('cf_%d',_0x302672['id']),_0x56a2d0);})['then'](function(){return _0x302672;});})[_0x521f('0x41')](respondWithResult(_0xf1cb7f,0xc9))[_0x521f('0x46')](handleError(_0xf1cb7f,null));}; \ No newline at end of file +var _0xd465=['desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','keys','includeAll','options','find','update','body','params','create','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x39e629,_0x1ad9f4){var _0x2b4d83=function(_0x240789){while(--_0x240789){_0x39e629['push'](_0x39e629['shift']());}};_0x2b4d83(++_0x1ad9f4);}(_0xd465,0xa3));var _0x5d46=function(_0x148bfd,_0x137e0e){_0x148bfd=_0x148bfd-0x0;var _0xab74a0=_0xd465[_0x148bfd];return _0xab74a0;};'use strict';var emlformat=require(_0x5d46('0x0'));var rimraf=require(_0x5d46('0x1'));var zipdir=require(_0x5d46('0x2'));var jsonpatch=require(_0x5d46('0x3'));var rp=require(_0x5d46('0x4'));var moment=require(_0x5d46('0x5'));var BPromise=require(_0x5d46('0x6'));var Mustache=require(_0x5d46('0x7'));var util=require(_0x5d46('0x8'));var path=require(_0x5d46('0x9'));var sox=require('sox');var csv=require(_0x5d46('0xa'));var ejs=require(_0x5d46('0xb'));var fs=require('fs');var fs_extra=require(_0x5d46('0xc'));var _=require(_0x5d46('0xd'));var squel=require(_0x5d46('0xe'));var crypto=require(_0x5d46('0xf'));var jsforce=require(_0x5d46('0x10'));var deskjs=require(_0x5d46('0x11'));var toCsv=require(_0x5d46('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5d46('0x12'));var authService=require(_0x5d46('0x13'));var qs=require(_0x5d46('0x14'));var as=require(_0x5d46('0x15'));var hardwareService=require(_0x5d46('0x16'));var logger=require(_0x5d46('0x17'))('api');var utils=require(_0x5d46('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d46('0x19'))['db'];function respondWithStatusCode(_0x3506b9,_0x45ddb1){_0x45ddb1=_0x45ddb1||0xcc;return function(_0x1c126b){if(_0x1c126b){return _0x3506b9[_0x5d46('0x1a')](_0x45ddb1);}return _0x3506b9[_0x5d46('0x1b')](_0x45ddb1)[_0x5d46('0x1c')]();};}function respondWithResult(_0x39baf6,_0x15898c){_0x15898c=_0x15898c||0xc8;return function(_0xe64c54){if(_0xe64c54){return _0x39baf6[_0x5d46('0x1b')](_0x15898c)[_0x5d46('0x1d')](_0xe64c54);}};}function respondWithFilteredResult(_0x36ba55,_0x3b2542){return function(_0x2e8c04){if(_0x2e8c04){var _0x17182e=typeof _0x3b2542['offset']==='undefined'&&typeof _0x3b2542[_0x5d46('0x1e')]===_0x5d46('0x1f');var _0x58dc52=_0x2e8c04[_0x5d46('0x20')];var _0x580774=_0x17182e?0x0:_0x3b2542['offset'];var _0x3b8197=_0x17182e?_0x2e8c04[_0x5d46('0x20')]:_0x3b2542[_0x5d46('0x21')]+_0x3b2542[_0x5d46('0x1e')];var _0x5b9ecd;if(_0x3b8197>=_0x58dc52){_0x3b8197=_0x58dc52;_0x5b9ecd=0xc8;}else{_0x5b9ecd=0xce;}_0x36ba55[_0x5d46('0x1b')](_0x5b9ecd);return _0x36ba55[_0x5d46('0x22')](_0x5d46('0x23'),_0x580774+'-'+_0x3b8197+'/'+_0x58dc52)[_0x5d46('0x1d')](_0x2e8c04);}return null;};}function patchUpdates(_0x6290cc){return function(_0x515f7b){try{jsonpatch[_0x5d46('0x24')](_0x515f7b,_0x6290cc,!![]);}catch(_0x406b18){return BPromise['reject'](_0x406b18);}return _0x515f7b[_0x5d46('0x25')]();};}function saveUpdates(_0x1fd2f1,_0x2a4a2c){return function(_0x2f7a3d){if(_0x2f7a3d){return _0x2f7a3d['update'](_0x1fd2f1)[_0x5d46('0x26')](function(_0x5c8901){return _0x5c8901;});}return null;};}function removeEntity(_0x3a8c9d,_0x47eb9b){return function(_0x210c29){if(_0x210c29){return _0x210c29[_0x5d46('0x27')]()['then'](function(){_0x3a8c9d[_0x5d46('0x1b')](0xcc)[_0x5d46('0x1c')]();});}};}function handleEntityNotFound(_0x47a578,_0x3e2915){return function(_0x4651bd){if(!_0x4651bd){_0x47a578[_0x5d46('0x1a')](0x194);}return _0x4651bd;};}function handleError(_0x442c61,_0x59b4ae){_0x59b4ae=_0x59b4ae||0x1f4;return function(_0x3e40c0){logger[_0x5d46('0x28')](_0x3e40c0['stack']);if(_0x3e40c0[_0x5d46('0x29')]){delete _0x3e40c0[_0x5d46('0x29')];}_0x442c61[_0x5d46('0x1b')](_0x59b4ae)[_0x5d46('0x2a')](_0x3e40c0);};}exports['index']=function(_0x4eae70,_0x400de3){var _0x3c3a47={},_0x292ac9={},_0x4f95bb={'count':0x0,'rows':[]};var _0x579d59=_[_0x5d46('0x2b')](db[_0x5d46('0x2c')][_0x5d46('0x2d')],function(_0x58847b){return{'name':_0x58847b[_0x5d46('0x2e')],'type':_0x58847b[_0x5d46('0x2f')][_0x5d46('0x30')]};});_0x292ac9[_0x5d46('0x31')]=_[_0x5d46('0x32')](_[_0x5d46('0x2b')](_0x579d59,_0x5d46('0x29')),[_0x5d46('0x29')]);_0x292ac9['query']=_['keys'](_0x4eae70[_0x5d46('0x33')]);_0x292ac9['filters']=_['intersection'](_0x292ac9[_0x5d46('0x31')],_0x292ac9['query']);_0x3c3a47[_0x5d46('0x34')]=_[_0x5d46('0x35')](_0x292ac9['model'],qs['fields'](_0x4eae70['query'][_0x5d46('0x36')]));_0x3c3a47[_0x5d46('0x34')]=_0x3c3a47[_0x5d46('0x34')][_0x5d46('0x37')]?_0x3c3a47[_0x5d46('0x34')]:_0x292ac9[_0x5d46('0x31')];if(!_0x4eae70[_0x5d46('0x33')][_0x5d46('0x38')]('nolimit')){_0x3c3a47[_0x5d46('0x1e')]=qs[_0x5d46('0x1e')](_0x4eae70['query'][_0x5d46('0x1e')]);_0x3c3a47[_0x5d46('0x21')]=qs[_0x5d46('0x21')](_0x4eae70[_0x5d46('0x33')][_0x5d46('0x21')]);}_0x3c3a47[_0x5d46('0x39')]=qs[_0x5d46('0x3a')](_0x4eae70['query']['sort']);_0x3c3a47[_0x5d46('0x3b')]=qs[_0x5d46('0x3c')](_[_0x5d46('0x3d')](_0x4eae70[_0x5d46('0x33')],_0x292ac9[_0x5d46('0x3c')]),_0x579d59);if(_0x4eae70['query'][_0x5d46('0x3e')]){_0x3c3a47[_0x5d46('0x3b')]=_[_0x5d46('0x3f')](_0x3c3a47[_0x5d46('0x3b')],{'$or':_['map'](_0x579d59,function(_0x3eafda){if(_0x3eafda[_0x5d46('0x2f')]!=='VIRTUAL'){var _0x3026f7={};_0x3026f7[_0x3eafda[_0x5d46('0x29')]]={'$like':'%'+_0x4eae70[_0x5d46('0x33')][_0x5d46('0x3e')]+'%'};return _0x3026f7;}})});}_0x3c3a47=_['merge']({},_0x3c3a47,_0x4eae70['options']);var _0x468263={'where':_0x3c3a47[_0x5d46('0x3b')]};return db[_0x5d46('0x2c')][_0x5d46('0x20')](_0x468263)['then'](function(_0x1a2d9c){_0x4f95bb['count']=_0x1a2d9c;if(_0x4eae70[_0x5d46('0x33')]['includeAll']){_0x3c3a47[_0x5d46('0x40')]=[{'all':!![]}];}return db['CmCustomField'][_0x5d46('0x41')](_0x3c3a47);})[_0x5d46('0x26')](function(_0x1a2262){_0x4f95bb[_0x5d46('0x42')]=_0x1a2262;return _0x4f95bb;})['then'](respondWithFilteredResult(_0x400de3,_0x3c3a47))[_0x5d46('0x43')](handleError(_0x400de3,null));};exports['show']=function(_0x55c38d,_0x881dec){var _0x2fd826={'raw':!![],'where':{'id':_0x55c38d['params']['id']}},_0x260bf6={};_0x260bf6[_0x5d46('0x31')]=_[_0x5d46('0x44')](db[_0x5d46('0x2c')][_0x5d46('0x2d')]);_0x260bf6[_0x5d46('0x33')]=_[_0x5d46('0x44')](_0x55c38d[_0x5d46('0x33')]);_0x260bf6['filters']=_[_0x5d46('0x35')](_0x260bf6[_0x5d46('0x31')],_0x260bf6[_0x5d46('0x33')]);_0x2fd826[_0x5d46('0x34')]=_[_0x5d46('0x35')](_0x260bf6[_0x5d46('0x31')],qs[_0x5d46('0x36')](_0x55c38d[_0x5d46('0x33')][_0x5d46('0x36')]));_0x2fd826[_0x5d46('0x34')]=_0x2fd826[_0x5d46('0x34')][_0x5d46('0x37')]?_0x2fd826['attributes']:_0x260bf6[_0x5d46('0x31')];if(_0x55c38d[_0x5d46('0x33')][_0x5d46('0x45')]){_0x2fd826['include']=[{'all':!![]}];}_0x2fd826=_[_0x5d46('0x3f')]({},_0x2fd826,_0x55c38d[_0x5d46('0x46')]);return db[_0x5d46('0x2c')][_0x5d46('0x47')](_0x2fd826)[_0x5d46('0x26')](handleEntityNotFound(_0x881dec,null))['then'](respondWithResult(_0x881dec,null))['catch'](handleError(_0x881dec,null));};exports[_0x5d46('0x48')]=function(_0x68e52d,_0x5a1e15){if(_0x68e52d['body']['id']){delete _0x68e52d[_0x5d46('0x49')]['id'];}return db['CmCustomField'][_0x5d46('0x47')]({'where':{'id':_0x68e52d[_0x5d46('0x4a')]['id']}})[_0x5d46('0x26')](handleEntityNotFound(_0x5a1e15,null))[_0x5d46('0x26')](saveUpdates(_0x68e52d['body'],null))[_0x5d46('0x26')](respondWithResult(_0x5a1e15,null))[_0x5d46('0x43')](handleError(_0x5a1e15,null));};exports[_0x5d46('0x27')]=function(_0x58ec11,_0x5bd87d){return db[_0x5d46('0x2c')][_0x5d46('0x47')]({'where':{'id':_0x58ec11[_0x5d46('0x4a')]['id']}})[_0x5d46('0x26')](handleEntityNotFound(_0x5bd87d,null))[_0x5d46('0x26')](removeEntity(_0x5bd87d,null))['catch'](handleError(_0x5bd87d,null));};exports[_0x5d46('0x4b')]=function(_0x3b5f96,_0x4710be){var _0x3a0c67;return db['sequelize'][_0x5d46('0x4c')](function(_0x449997){return db['CmCustomField'][_0x5d46('0x4b')](_0x3b5f96[_0x5d46('0x49')],{'transaction':_0x449997})[_0x5d46('0x26')](function(_0xc52ec6){_0x3a0c67=_0xc52ec6;var _0x44395e={'type':db['Sequelize'][_0x5d46('0x4d')],'transaction':_0x449997};switch(_0x3b5f96['body']['type']){case _0x5d46('0x4e'):_0x44395e[_0x5d46('0x2f')]=db[_0x5d46('0x4f')][_0x5d46('0x4d')];break;case _0x5d46('0x50'):_0x44395e[_0x5d46('0x2f')]=db[_0x5d46('0x4f')][_0x5d46('0x51')];break;case _0x5d46('0x52'):_0x44395e['type']=db[_0x5d46('0x4f')][_0x5d46('0x53')];_0x44395e[_0x5d46('0x54')]=![];break;default:}return db[_0x5d46('0x55')][_0x5d46('0x56')][_0x5d46('0x57')](_0x5d46('0x58'),util[_0x5d46('0x59')]('cf_%d',_0x3a0c67['id']),_0x44395e);})[_0x5d46('0x26')](function(){return _0x3a0c67;});})[_0x5d46('0x26')](respondWithResult(_0x4710be,0xc9))[_0x5d46('0x43')](handleError(_0x4710be,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 98b4825..33cfd37 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 _0xe3c6=['request-promise','path','rimraf','../../config/environment','CmCustomField','cm_custom_fields','lodash','../../config/logger','moment','bluebird'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe3c6,0x196));var _0x6e3c=function(_0x2859f2,_0x1e3102){_0x2859f2=_0x2859f2-0x0;var _0x4974cd=_0xe3c6[_0x2859f2];return _0x4974cd;};'use strict';var _=require(_0x6e3c('0x0'));var util=require('util');var logger=require(_0x6e3c('0x1'))('api');var moment=require(_0x6e3c('0x2'));var BPromise=require(_0x6e3c('0x3'));var rp=require(_0x6e3c('0x4'));var fs=require('fs');var path=require(_0x6e3c('0x5'));var rimraf=require(_0x6e3c('0x6'));var config=require(_0x6e3c('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x113090,_0x5515a1){return _0x113090['define'](_0x6e3c('0x8'),attributes,{'tableName':_0x6e3c('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6c5=['request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','cm_custom_fields','lodash','api','moment'];(function(_0x2a1ed3,_0xc9bf54){var _0x17caa2=function(_0x10e33f){while(--_0x10e33f){_0x2a1ed3['push'](_0x2a1ed3['shift']());}};_0x17caa2(++_0xc9bf54);}(_0xe6c5,0x126));var _0x5e6c=function(_0x5ee797,_0x56c315){_0x5ee797=_0x5ee797-0x0;var _0x28478b=_0xe6c5[_0x5ee797];return _0x28478b;};'use strict';var _=require(_0x5e6c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5e6c('0x1'));var moment=require(_0x5e6c('0x2'));var BPromise=require('bluebird');var rp=require(_0x5e6c('0x3'));var fs=require('fs');var path=require(_0x5e6c('0x4'));var rimraf=require(_0x5e6c('0x5'));var config=require(_0x5e6c('0x6'));var attributes=require(_0x5e6c('0x7'));module['exports']=function(_0x57659d,_0x1a6df2){return _0x57659d['define']('CmCustomField',attributes,{'tableName':_0x5e6c('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index a18abd6..2346c61 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 _0xe5cd=['debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x3e3a98,_0xf1a455){var _0x1294e2=function(_0x36ba57){while(--_0x36ba57){_0x3e3a98['push'](_0x3e3a98['shift']());}};_0x1294e2(++_0xf1a455);}(_0xe5cd,0x13f));var _0xde5c=function(_0x34c011,_0x54c5db){_0x34c011=_0x34c011-0x0;var _0x3a0daf=_0xe5cd[_0x34c011];return _0x3a0daf;};'use strict';var _=require(_0xde5c('0x0'));var util=require(_0xde5c('0x1'));var moment=require(_0xde5c('0x2'));var BPromise=require(_0xde5c('0x3'));var rs=require(_0xde5c('0x4'));var fs=require('fs');var Redis=require(_0xde5c('0x5'));var db=require(_0xde5c('0x6'))['db'];var utils=require(_0xde5c('0x7'));var logger=require(_0xde5c('0x8'))('rpc');var config=require(_0xde5c('0x9'));var jayson=require(_0xde5c('0xa'));var client=jayson[_0xde5c('0xb')][_0xde5c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ca4f9,_0x586991,_0x5946a1){return new BPromise(function(_0x218448,_0x5506e6){return client[_0xde5c('0xd')](_0x1ca4f9,_0x5946a1)[_0xde5c('0xe')](function(_0xdd47aa){logger['info'](_0xde5c('0xf'),_0x586991,_0xde5c('0x10'));logger[_0xde5c('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x586991,_0xde5c('0x10'),JSON[_0xde5c('0x12')](_0xdd47aa));if(_0xdd47aa[_0xde5c('0x13')]){if(_0xdd47aa[_0xde5c('0x13')][_0xde5c('0x14')]===0x1f4){logger['error'](_0xde5c('0xf'),_0x586991,_0xdd47aa[_0xde5c('0x13')][_0xde5c('0x15')]);return _0x5506e6(_0xdd47aa[_0xde5c('0x13')][_0xde5c('0x15')]);}logger[_0xde5c('0x13')](_0xde5c('0xf'),_0x586991,_0xdd47aa['error'][_0xde5c('0x15')]);return _0x218448(_0xdd47aa['error'][_0xde5c('0x15')]);}else{logger[_0xde5c('0x16')](_0xde5c('0xf'),_0x586991,_0xde5c('0x10'));_0x218448(_0xdd47aa[_0xde5c('0x17')]['message']);}})['catch'](function(_0xef16fe){logger[_0xde5c('0x13')](_0xde5c('0xf'),_0x586991,_0xef16fe);_0x5506e6(_0xef16fe);});});} \ No newline at end of file +var _0x09d8=['http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x4f4ad3,_0x5dbfff){var _0xdb16de=function(_0x24e121){while(--_0x24e121){_0x4f4ad3['push'](_0x4f4ad3['shift']());}};_0xdb16de(++_0x5dbfff);}(_0x09d8,0xf2));var _0x809d=function(_0x90bf70,_0x3df3bb){_0x90bf70=_0x90bf70-0x0;var _0x4bb7ec=_0x09d8[_0x90bf70];return _0x4bb7ec;};'use strict';var _=require(_0x809d('0x0'));var util=require('util');var moment=require(_0x809d('0x1'));var BPromise=require(_0x809d('0x2'));var rs=require(_0x809d('0x3'));var fs=require('fs');var Redis=require(_0x809d('0x4'));var db=require(_0x809d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x809d('0x6'))(_0x809d('0x7'));var config=require('../../config/environment');var jayson=require(_0x809d('0x8'));var client=jayson[_0x809d('0x9')][_0x809d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a33e,_0x4963c5,_0x57d9d2){return new BPromise(function(_0x5efc19,_0x2542a1){return client[_0x809d('0xb')](_0x3a33e,_0x57d9d2)[_0x809d('0xc')](function(_0xd8fac1){logger[_0x809d('0xd')](_0x809d('0xe'),_0x4963c5,_0x809d('0xf'));logger['debug'](_0x809d('0x10'),_0x4963c5,_0x809d('0xf'),JSON['stringify'](_0xd8fac1));if(_0xd8fac1[_0x809d('0x11')]){if(_0xd8fac1[_0x809d('0x11')][_0x809d('0x12')]===0x1f4){logger[_0x809d('0x11')](_0x809d('0xe'),_0x4963c5,_0xd8fac1[_0x809d('0x11')][_0x809d('0x13')]);return _0x2542a1(_0xd8fac1[_0x809d('0x11')]['message']);}logger[_0x809d('0x11')]('CmCustomField,\x20%s,\x20%s',_0x4963c5,_0xd8fac1[_0x809d('0x11')][_0x809d('0x13')]);return _0x5efc19(_0xd8fac1['error'][_0x809d('0x13')]);}else{logger[_0x809d('0xd')](_0x809d('0xe'),_0x4963c5,_0x809d('0xf'));_0x5efc19(_0xd8fac1[_0x809d('0x14')]['message']);}})['catch'](function(_0x27ad07){logger[_0x809d('0x11')](_0x809d('0xe'),_0x4963c5,_0x27ad07);_0x2542a1(_0x27ad07);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3346715..ca133d4 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 _0x9fc5=['destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete'];(function(_0x477626,_0xcad91d){var _0x1e777a=function(_0x2b4f23){while(--_0x2b4f23){_0x477626['push'](_0x477626['shift']());}};_0x1e777a(++_0xcad91d);}(_0x9fc5,0xb6));var _0x59fc=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x9fc5[_0x56a871];return _0x124954;};'use strict';var multer=require('multer');var util=require(_0x59fc('0x0'));var path=require(_0x59fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x59fc('0x2'));var router=express[_0x59fc('0x3')]();var fs_extra=require(_0x59fc('0x4'));var auth=require(_0x59fc('0x5'));var interaction=require(_0x59fc('0x6'));var config=require(_0x59fc('0x7'));var controller=require(_0x59fc('0x8'));router[_0x59fc('0x9')]('/',auth['isAuthenticated'](),controller[_0x59fc('0xa')]);router[_0x59fc('0x9')](_0x59fc('0xb'),auth['isAuthenticated'](),controller[_0x59fc('0xc')]);router[_0x59fc('0xd')]('/',auth[_0x59fc('0xe')](),controller[_0x59fc('0xf')]);router[_0x59fc('0x10')](_0x59fc('0xb'),auth[_0x59fc('0xe')](),controller['update']);router[_0x59fc('0x11')](_0x59fc('0xb'),auth[_0x59fc('0xe')](),controller[_0x59fc('0x12')]);module[_0x59fc('0x13')]=router; \ No newline at end of file +var _0xacea=['path','express','Router','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util'];(function(_0x484bbd,_0x3d0d2e){var _0x2d20a3=function(_0x9ab1a6){while(--_0x9ab1a6){_0x484bbd['push'](_0x484bbd['shift']());}};_0x2d20a3(++_0x3d0d2e);}(_0xacea,0x1d2));var _0xaace=function(_0x3556f3,_0x5651a4){_0x3556f3=_0x3556f3-0x0;var _0x37e0e1=_0xacea[_0x3556f3];return _0x37e0e1;};'use strict';var multer=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var path=require(_0xaace('0x2'));var timeout=require('connect-timeout');var express=require(_0xaace('0x3'));var router=express[_0xaace('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaace('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaace('0x6'));var controller=require(_0xaace('0x7'));router[_0xaace('0x8')]('/',auth[_0xaace('0x9')](),controller[_0xaace('0xa')]);router[_0xaace('0x8')](_0xaace('0xb'),auth[_0xaace('0x9')](),controller[_0xaace('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaace('0xd')]);router['put']('/:id',auth[_0xaace('0x9')](),controller[_0xaace('0xe')]);router[_0xaace('0xf')](_0xaace('0xb'),auth['isAuthenticated'](),controller[_0xaace('0x10')]);module[_0xaace('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 3ac707b..9edf4aa 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 _0x92cd=['INTEGER','UNSIGNED','moment','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92cd,0x77));var _0xd92c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x92cd[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xd92c('0x0'));var Sequelize=require('sequelize');module[_0xd92c('0x1')]={'phone':{'type':Sequelize[_0xd92c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xd92c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd92c('0x4')],'defaultValue':moment()[_0xd92c('0x5')](_0xd92c('0x6'))},'countbusyretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd92c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xd92c('0x7')](0x2)[_0xd92c('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd92c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd92c('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xd92c('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xd92c('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd92c('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd92c('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd92c('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xd92c('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x828d=['UNSIGNED','contactListQueue','moment','sequelize','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN'];(function(_0x2ae4cd,_0x31786e){var _0x381211=function(_0x221e25){while(--_0x221e25){_0x2ae4cd['push'](_0x2ae4cd['shift']());}};_0x381211(++_0x31786e);}(_0x828d,0x15a));var _0xd828=function(_0x5af2c8,_0x501dc9){_0x5af2c8=_0x5af2c8-0x0;var _0x15e0f6=_0x828d[_0x5af2c8];return _0x15e0f6;};'use strict';var moment=require(_0xd828('0x0'));var Sequelize=require(_0xd828('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd828('0x2')],'defaultValue':moment()['format'](_0xd828('0x3'))},'countbusyretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd828('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd828('0x2')]},'priority':{'type':Sequelize[_0xd828('0x4')](0x2)[_0xd828('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd828('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd828('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd828('0x4')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xd828('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xd828('0x4')],'unique':_0xd828('0x7')},'CampaignId':{'type':Sequelize[_0xd828('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd828('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd828('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xd828('0x2')],'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 52d50fe..a21b76d 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 _0x90b5=['VoiceQueue','CampaignId','dataValues','createdAt','updatedAt','deleted','campaign','membername','format','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','status','user','getVoiceQueues','outbound','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','phone','recallme','UPDATE','Contact','Company','CmList','Queue','dialActive','getPreviewRecall','findOne','scheduledat','LOCK','List','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','CmHopper','rawAttributes','type','key','model','map','query','filters','$and','$gte','$lte','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','catch','show','params','keys','intersection','length','includeAll','find','create','body','describe','destroy','VoiceQueueId'];(function(_0x44f1f1,_0x4be4e4){var _0x1fae61=function(_0x3c2051){while(--_0x3c2051){_0x44f1f1['push'](_0x44f1f1['shift']());}};_0x1fae61(++_0x4be4e4);}(_0x90b5,0x139));var _0x590b=function(_0x55e74b,_0x523345){_0x55e74b=_0x55e74b-0x0;var _0x2b0c91=_0x90b5[_0x55e74b];return _0x2b0c91;};'use strict';var moment=require(_0x590b('0x0'));var _=require('lodash');var qs=require(_0x590b('0x1'));var logger=require(_0x590b('0x2'))(_0x590b('0x3'));var shared=require(_0x590b('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x4cf794,_0x2318b8){_0x2318b8=_0x2318b8||0xc8;return function(_0x27e96f){if(_0x27e96f){return _0x4cf794['status'](_0x2318b8)[_0x590b('0x5')](_0x27e96f);}};}function respondWithFilteredResult(_0x2059e4,_0x88a5f9){return function(_0x5e54fe){if(_0x5e54fe){var _0x30bc6e=typeof _0x88a5f9[_0x590b('0x6')]===_0x590b('0x7')&&typeof _0x88a5f9[_0x590b('0x8')]===_0x590b('0x7');var _0x268b0a=_0x5e54fe[_0x590b('0x9')];var _0xe0b13d=_0x30bc6e?0x0:_0x88a5f9[_0x590b('0x6')];var _0x50a7b8=_0x30bc6e?_0x5e54fe[_0x590b('0x9')]:_0x88a5f9[_0x590b('0x6')]+_0x88a5f9['limit'];var _0x2962b0;if(_0x50a7b8>=_0x268b0a){_0x50a7b8=_0x268b0a;_0x2962b0=0xc8;}else{_0x2962b0=0xce;}_0x2059e4['status'](_0x2962b0);return _0x2059e4[_0x590b('0xa')](_0x590b('0xb'),_0xe0b13d+'-'+_0x50a7b8+'/'+_0x268b0a)[_0x590b('0x5')](_0x5e54fe);}return null;};}function saveUpdates(_0x477069,_0x527487){return function(_0xb0ca22){if(_0xb0ca22){return _0xb0ca22[_0x590b('0xc')](_0x477069)[_0x590b('0xd')](function(_0x1c8607){return _0x1c8607;});}return null;};}function handleEntityNotFound(_0x2e85b1,_0x6ad7e7){return function(_0x45ac04){if(!_0x45ac04){_0x2e85b1[_0x590b('0xe')](0x194);}return _0x45ac04;};}function handleError(_0x168bde,_0x1fbc84){_0x1fbc84=_0x1fbc84||0x1f4;return function(_0x3fc5ca){logger[_0x590b('0xf')](_0x3fc5ca[_0x590b('0x10')]);if(_0x3fc5ca[_0x590b('0x11')]){delete _0x3fc5ca[_0x590b('0x11')];}_0x168bde['status'](_0x1fbc84)[_0x590b('0x12')](_0x3fc5ca);};}exports['index']=function(_0x5c788,_0x115309){var _0xf05b00={},_0x53337c={},_0x4b2c3c={'count':0x0,'rows':[]};var _0x466dcc=_['map'](db[_0x590b('0x13')][_0x590b('0x14')],function(_0x3fbeb2){return{'name':_0x3fbeb2['fieldName'],'type':_0x3fbeb2[_0x590b('0x15')][_0x590b('0x16')]};});_0x53337c[_0x590b('0x17')]=_[_0x590b('0x18')](_0x466dcc,'name');_0x53337c[_0x590b('0x19')]=_['keys'](_0x5c788[_0x590b('0x19')]);_0x53337c[_0x590b('0x1a')]=_['intersection'](_0x53337c['model'],_0x53337c[_0x590b('0x19')]);_0x53337c[_0x590b('0x1a')]=_['concat'](_0x53337c[_0x590b('0x1a')],[_0x590b('0x1b'),'$or','$gt',_0x590b('0x1c'),'$lt',_0x590b('0x1d'),'$ne','$eq',_0x590b('0x1e'),_0x590b('0x1f'),'$notBetween',_0x590b('0x20'),_0x590b('0x21'),_0x590b('0x22'),_0x590b('0x23'),_0x590b('0x24'),'$notILike',_0x590b('0x22'),_0x590b('0x25'),_0x590b('0x26'),_0x590b('0x27'),_0x590b('0x28')]);_0xf05b00[_0x590b('0x29')]=_['intersection'](_0x53337c[_0x590b('0x17')],qs['fields'](_0x5c788[_0x590b('0x19')][_0x590b('0x2a')]));_0xf05b00[_0x590b('0x29')]=_0xf05b00[_0x590b('0x29')]['length']?_0xf05b00[_0x590b('0x29')]:_0x53337c['model'];if(!_0x5c788[_0x590b('0x19')][_0x590b('0x2b')](_0x590b('0x2c'))){_0xf05b00[_0x590b('0x8')]=qs[_0x590b('0x8')](_0x5c788['query'][_0x590b('0x8')]);_0xf05b00[_0x590b('0x6')]=qs[_0x590b('0x6')](_0x5c788[_0x590b('0x19')]['offset']);}_0xf05b00['order']=qs[_0x590b('0x2d')](_0x5c788[_0x590b('0x19')][_0x590b('0x2d')]);_0xf05b00[_0x590b('0x2e')]=qs['filters'](_['pick'](_0x5c788[_0x590b('0x19')],_0x53337c['filters']),_0x466dcc);if(_0x5c788[_0x590b('0x19')][_0x590b('0x2f')]){_0xf05b00[_0x590b('0x2e')]=_[_0x590b('0x30')](_0xf05b00[_0x590b('0x2e')],{'$or':_[_0x590b('0x18')](_0x466dcc,function(_0x251cab){if(_0x251cab[_0x590b('0x15')]!==_0x590b('0x31')){var _0x3e5c5e={};_0x3e5c5e[_0x251cab['name']]={'$like':'%'+_0x5c788['query'][_0x590b('0x2f')]+'%'};return _0x3e5c5e;}})});}_0xf05b00=_[_0x590b('0x30')]({},_0xf05b00,_0x5c788[_0x590b('0x32')]);var _0x3a03ff={'where':_0xf05b00[_0x590b('0x2e')]};return db['CmHopper'][_0x590b('0x9')](_0x3a03ff)[_0x590b('0xd')](function(_0x3e5ca5){_0x4b2c3c[_0x590b('0x9')]=_0x3e5ca5;if(_0x5c788[_0x590b('0x19')]['includeAll']){_0xf05b00[_0x590b('0x33')]=[{'all':!![]}];}return db[_0x590b('0x13')]['findAll'](_0xf05b00);})['then'](function(_0x46dbf3){_0x4b2c3c['rows']=_0x46dbf3;return _0x4b2c3c;})[_0x590b('0xd')](respondWithFilteredResult(_0x115309,_0xf05b00))[_0x590b('0x34')](handleError(_0x115309,null));};exports[_0x590b('0x35')]=function(_0x2a67fc,_0x210af8){var _0x419e6a={'raw':!![],'where':{'id':_0x2a67fc[_0x590b('0x36')]['id']}},_0x2fc05c={};_0x2fc05c[_0x590b('0x17')]=_[_0x590b('0x37')](db['CmHopper'][_0x590b('0x14')]);_0x2fc05c[_0x590b('0x19')]=_[_0x590b('0x37')](_0x2a67fc['query']);_0x2fc05c[_0x590b('0x1a')]=_[_0x590b('0x38')](_0x2fc05c[_0x590b('0x17')],_0x2fc05c[_0x590b('0x19')]);_0x419e6a[_0x590b('0x29')]=_[_0x590b('0x38')](_0x2fc05c[_0x590b('0x17')],qs[_0x590b('0x2a')](_0x2a67fc['query'][_0x590b('0x2a')]));_0x419e6a['attributes']=_0x419e6a[_0x590b('0x29')][_0x590b('0x39')]?_0x419e6a[_0x590b('0x29')]:_0x2fc05c['model'];if(_0x2a67fc[_0x590b('0x19')][_0x590b('0x3a')]){_0x419e6a[_0x590b('0x33')]=[{'all':!![]}];}_0x419e6a=_[_0x590b('0x30')]({},_0x419e6a,_0x2a67fc['options']);return db[_0x590b('0x13')][_0x590b('0x3b')](_0x419e6a)['then'](handleEntityNotFound(_0x210af8,null))['then'](respondWithResult(_0x210af8,null))['catch'](handleError(_0x210af8,null));};exports[_0x590b('0x3c')]=function(_0x44defc,_0x3bd990){return db['CmHopper']['create'](_0x44defc[_0x590b('0x3d')],{})[_0x590b('0xd')](respondWithResult(_0x3bd990,0xc9))['catch'](handleError(_0x3bd990,null));};exports[_0x590b('0xc')]=function(_0x1a9678,_0x44d1d8){if(_0x1a9678[_0x590b('0x3d')]['id']){delete _0x1a9678[_0x590b('0x3d')]['id'];}return db[_0x590b('0x13')][_0x590b('0x3b')]({'where':{'id':_0x1a9678[_0x590b('0x36')]['id']}})[_0x590b('0xd')](handleEntityNotFound(_0x44d1d8,null))[_0x590b('0xd')](saveUpdates(_0x1a9678[_0x590b('0x3d')],null))[_0x590b('0xd')](respondWithResult(_0x44d1d8,null))[_0x590b('0x34')](handleError(_0x44d1d8,null));};exports['describe']=function(_0x5e79c5,_0x1a92fb){return db[_0x590b('0x13')][_0x590b('0x3e')]()[_0x590b('0xd')](respondWithResult(_0x1a92fb,null))['catch'](handleError(_0x1a92fb,null));};exports[_0x590b('0x3f')]=function(_0x11bb48,_0x2f492a){var _0x5cc53f;var _0x1964c5=_0x11bb48[_0x590b('0x36')]['id'];return db['CmHopper']['find']({'where':{'id':_0x11bb48[_0x590b('0x36')]['id']}})[_0x590b('0xd')](handleEntityNotFound(_0x2f492a,null))['then'](function(_0x218c86){if(_0x218c86){return _0x218c86[_0x590b('0x3f')]()['then'](function(_0x67ee4f){return _0x67ee4f;});}})[_0x590b('0xd')](function(_0x446910){_0x5cc53f=_0x446910;if(_0x446910){if(_0x446910['VoiceQueueId']||_0x446910['CampaignId']){return db[_0x446910[_0x590b('0x40')]?_0x590b('0x41'):'Campaign'][_0x590b('0x3b')]({'where':{'id':_0x446910[_0x590b('0x40')]?_0x446910[_0x590b('0x40')]:_0x446910[_0x590b('0x42')]},'attributes':['id',_0x590b('0x11')],'raw':!![]});}}})[_0x590b('0xd')](function(_0x2a74b8){var _0x4b51ac={};if(_0x2a74b8){_[_0x590b('0x30')](_0x4b51ac,_['omit'](_0x5cc53f[_0x590b('0x43')],[_0x590b('0x44'),_0x590b('0x45'),'id']));_0x4b51ac['state']=0x15;_0x4b51ac['statedesc']=_0x590b('0x46');_0x4b51ac[_0x590b('0x47')]=_0x2a74b8[_0x590b('0x11')];_0x4b51ac[_0x590b('0x48')]=_0x11bb48['user'][_0x590b('0x11')];_0x4b51ac['UserId']=_0x11bb48['user']['id'];_0x4b51ac[_0x590b('0x46')]=!![];_0x4b51ac['deletedat']=moment()[_0x590b('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b51ac[_0x590b('0x4a')]=_0x5cc53f['phone'];_0x4b51ac[_0x590b('0x4b')]=_0x5cc53f[_0x590b('0x40')]?_0x590b('0x4c'):_0x590b('0x4d');return db[_0x590b('0x4e')][_0x590b('0x3b')]({'where':{'id':_0x4b51ac[_0x590b('0x4f')]},'attributes':[_0x590b('0x50'),_0x590b('0x51')]})['then'](function(_0x3ec016){if(!_[_0x590b('0x52')](_0x2f492a)&&!_['isNil'](_0x3ec016[_0x590b('0x50')])){_0x4b51ac[_0x590b('0x53')]=_0x3ec016[_0x590b('0x50')];if(!_[_0x590b('0x52')](_0x3ec016['lastName'])){_0x4b51ac[_0x590b('0x53')]+='\x20'+_0x3ec016[_0x590b('0x51')];}}})[_0x590b('0x54')](function(){return db[_0x590b('0x55')]['create'](_0x4b51ac);});}})[_0x590b('0xd')](function(_0x58dfdc){return db[_0x590b('0x56')][_0x590b('0x3f')]({'where':{'CmHopperId':_0x1964c5}});})[_0x590b('0xd')](function(){return _0x2f492a[_0x590b('0x57')](0xcc)['end']();})[_0x590b('0x34')](handleError(_0x2f492a,null));};exports['getPreview']=function(_0xc22794,_0x426470){var _0x3ef6d3=[];return db['CmContact'][_0x590b('0x3e')]()['then'](function(_0x1b0cbb){_0x3ef6d3=_['keys'](_0x1b0cbb);return _0xc22794[_0x590b('0x58')][_0x590b('0x59')]({'where':{'type':_0x590b('0x5a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x590b('0x5b')],'raw':!![]});})[_0x590b('0xd')](function(_0x3e32d2){if(_0x3e32d2&&_0x3e32d2[_0x590b('0x39')]){return db['sequelize'][_0x590b('0x5c')](function(_0x5eb081){var _0x236aa8={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x590b('0x49')](_0x590b('0x5d'))},'VoiceQueueId':{'$in':_[_0x590b('0x18')](_0x3e32d2,'id')},'$or':[{'UserId':null},{'UserId':_0xc22794[_0x590b('0x58')]['id']}]};var _0x5836c9={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3e32d2)['filter']([_0x590b('0x5b'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0xc22794[_0x590b('0x58')]['id']}]};var _0x1c14bf={'$or':[_0x236aa8,_0x5836c9]};var _0x4d16a1=[];if(_0xc22794[_0x590b('0x3d')][_0x590b('0x5e')]&&_0xc22794['body'][_0x590b('0x5e')]===_0x590b('0x5f')){if(!_['isEmpty'](_0xc22794[_0x590b('0x3d')]['hopperIds'])){_0x1c14bf['id']={'$in':_0xc22794[_0x590b('0x3d')][_0x590b('0x60')]};}_0x4d16a1=[[_0x590b('0x61'),'ASC'],[_0x590b('0x62'),_0x3e32d2[0x0][_0x590b('0x63')]===_0x590b('0x64')?_0x590b('0x65'):'ASC'],db[_0x590b('0x66')][_0x590b('0x67')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x590b('0x65')]];}else{if(!_['isEmpty'](_0xc22794[_0x590b('0x3d')][_0x590b('0x60')])){_0x1c14bf['id']={'$notIn':_0xc22794[_0x590b('0x3d')][_0x590b('0x60')]};}_0x4d16a1=[[_0x590b('0x61'),_0x590b('0x65')],[_0x590b('0x62'),_0x3e32d2[0x0][_0x590b('0x63')]],db['sequelize'][_0x590b('0x67')](_0x590b('0x68')),['id',_0x590b('0x64')]];}return db[_0x590b('0x13')]['findOne']({'attributes':['id','scheduledat',_0x590b('0x69'),_0x590b('0x6a')],'where':_0x1c14bf,'order':_0x4d16a1,'transaction':_0x5eb081,'lock':_0x5eb081['LOCK'][_0x590b('0x6b')],'include':[{'model':db[_0x590b('0x4e')],'as':_0x590b('0x6c'),'attributes':_0x3ef6d3,'include':[{'model':db['CmCompany'],'as':_0x590b('0x6d'),'attributes':['id','name']}]},{'model':db[_0x590b('0x6e')],'as':'List','attributes':['id','name']},{'model':db[_0x590b('0x41')],'as':_0x590b('0x6f'),'attributes':['id','name',_0x590b('0x70')]}]})[_0x590b('0xd')](function(_0x397a00){if(_0x397a00){return _0x397a00[_0x590b('0xc')]({'UserId':_0xc22794['user']['id']},{'transaction':_0x5eb081});}});});}})[_0x590b('0xd')](handleEntityNotFound(_0x426470,null))[_0x590b('0xd')](respondWithResult(_0x426470,null))[_0x590b('0x34')](handleError(_0x426470,null));};exports[_0x590b('0x71')]=function(_0x1be3fc,_0x319b9c,_0x251272){var _0xfa8e7d=[];var _0x421547=_0x1be3fc['params']['id'];var _0x4b81f=_0x1be3fc['user']['id'];return db[_0x590b('0x4e')][_0x590b('0x3e')]()[_0x590b('0xd')](function(_0x3859f6){_0xfa8e7d=_['keys'](_0x3859f6);return db[_0x590b('0x66')][_0x590b('0x5c')](function(_0x1e0778){const _0x5411ac={'id':_0x421547};return db[_0x590b('0x13')][_0x590b('0x72')]({'attributes':['id',_0x590b('0x73'),_0x590b('0x6a')],'where':_0x5411ac,'transaction':_0x1e0778,'lock':_0x1e0778[_0x590b('0x74')]['UPDATE'],'include':[{'model':db[_0x590b('0x4e')],'as':_0x590b('0x6c'),'attributes':_0xfa8e7d,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x590b('0x6e')],'as':_0x590b('0x75'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x590b('0x6f'),'attributes':['id','name',_0x590b('0x70')]}]})[_0x590b('0xd')](function(_0x21be96){if(_0x21be96){return _0x21be96['update']({'UserId':_0x4b81f},{'transaction':_0x1e0778});}});});})[_0x590b('0xd')](handleEntityNotFound(_0x319b9c,null))[_0x590b('0xd')](respondWithResult(_0x319b9c,null))[_0x590b('0x34')](handleError(_0x319b9c,null));};exports['getOpenContacts']=function(_0x18b10f,_0x3d1617){return _0x18b10f[_0x590b('0x58')]['getVoiceQueues']({'where':{'type':_0x590b('0x5a'),'dialActive':!![],'dialMethod':_0x590b('0x76')},'attributes':['id'],'raw':!![]})[_0x590b('0xd')](function(_0x31c37b){if(_0x31c37b&&_0x31c37b['length']){return db[_0x590b('0x13')][_0x590b('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x590b('0x49')](_0x590b('0x5d'))},'VoiceQueueId':{'$in':_[_0x590b('0x18')](_0x31c37b,'id')},'$or':[{'UserId':null},{'UserId':_0x18b10f[_0x590b('0x58')]['id']}]}});}return 0x0;})['then'](function(_0x20baa9){if(!_[_0x590b('0x52')](_0x20baa9)&&_[_0x590b('0x77')](_0x20baa9)){return _0x3d1617[_0x590b('0x57')](0xc8)[_0x590b('0x5')]({'contacts':_0x20baa9});}else{logger['error'](_0x590b('0x78'),_0x590b('0x79'),0x194,_0x590b('0x7a'));_0x3d1617['sendStatus'](0x194);}})['catch'](handleError(_0x3d1617,null));};exports[_0x590b('0x7b')]=function(_0x1c3797,_0x3c6dd5){var _0x4b0c5d=shared[_0x590b('0x7c')];var _0x4b5870=[];_[_0x590b('0x18')](_0x4b0c5d,function(_0x616cdf){_0x4b5870['push']({'id':_0x616cdf[_0x590b('0x11')],'name':_0x616cdf[_0x590b('0x11')],'utcOffset':_0x616cdf['utcOffset']});});return _0x3c6dd5[_0x590b('0x57')](0xc8)[_0x590b('0x5')]({'tz':_0x4b5870});};exports[_0x590b('0x7d')]=function(_0x1f17f2,_0x16dea7){var _0x6281dc=shared['timezones'];var _0x1d8bdf={};if(!_[_0x590b('0x52')](_0x6281dc[_0x1f17f2['body']['id']]))_0x1d8bdf=_0x6281dc[_0x1f17f2[_0x590b('0x3d')]['id']];return _0x16dea7[_0x590b('0x57')](0xc8)[_0x590b('0x5')](_0x1d8bdf);}; \ No newline at end of file +var _0x6c32=['type','keys','filters','model','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$in','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','include','create','body','find','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','format','calleridnum','phone','campaigntype','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','Contact','Company','List','dialActive','getPreviewRecall','UPDATE','CmCompany','CmList','Queue','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','index','map','CmHopper','fieldName'];(function(_0x53947f,_0xfa70e5){var _0x33d8e3=function(_0x456031){while(--_0x456031){_0x53947f['push'](_0x53947f['shift']());}};_0x33d8e3(++_0xfa70e5);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x26c3('0x0'));var _=require(_0x26c3('0x1'));var qs=require(_0x26c3('0x2'));var logger=require(_0x26c3('0x3'))(_0x26c3('0x4'));var shared=require(_0x26c3('0x5'));var db=require(_0x26c3('0x6'))['db'];function respondWithResult(_0x321cc5,_0x36528a){_0x36528a=_0x36528a||0xc8;return function(_0x49d4a1){if(_0x49d4a1){return _0x321cc5[_0x26c3('0x7')](_0x36528a)[_0x26c3('0x8')](_0x49d4a1);}};}function respondWithFilteredResult(_0x15ac36,_0x57d915){return function(_0x187b81){if(_0x187b81){var _0x5b3a5f=typeof _0x57d915[_0x26c3('0x9')]===_0x26c3('0xa')&&typeof _0x57d915[_0x26c3('0xb')]===_0x26c3('0xa');var _0x2bbb9a=_0x187b81[_0x26c3('0xc')];var _0x155187=_0x5b3a5f?0x0:_0x57d915[_0x26c3('0x9')];var _0x356992=_0x5b3a5f?_0x187b81[_0x26c3('0xc')]:_0x57d915['offset']+_0x57d915['limit'];var _0x4aa8e2;if(_0x356992>=_0x2bbb9a){_0x356992=_0x2bbb9a;_0x4aa8e2=0xc8;}else{_0x4aa8e2=0xce;}_0x15ac36['status'](_0x4aa8e2);return _0x15ac36[_0x26c3('0xd')](_0x26c3('0xe'),_0x155187+'-'+_0x356992+'/'+_0x2bbb9a)[_0x26c3('0x8')](_0x187b81);}return null;};}function saveUpdates(_0x457fc9,_0x4b8d92){return function(_0x4c7b94){if(_0x4c7b94){return _0x4c7b94[_0x26c3('0xf')](_0x457fc9)[_0x26c3('0x10')](function(_0xbbbec7){return _0xbbbec7;});}return null;};}function handleEntityNotFound(_0x3cd3c7,_0x17c399){return function(_0x568d0b){if(!_0x568d0b){_0x3cd3c7['sendStatus'](0x194);}return _0x568d0b;};}function handleError(_0x2acfb1,_0xc14c69){_0xc14c69=_0xc14c69||0x1f4;return function(_0x4f4256){logger['error'](_0x4f4256[_0x26c3('0x11')]);if(_0x4f4256['name']){delete _0x4f4256[_0x26c3('0x12')];}_0x2acfb1['status'](_0xc14c69)['send'](_0x4f4256);};}exports[_0x26c3('0x13')]=function(_0x5545ee,_0x38fe17){var _0x50a3e5={},_0x170039={},_0x2613e2={'count':0x0,'rows':[]};var _0x1405fb=_[_0x26c3('0x14')](db[_0x26c3('0x15')]['rawAttributes'],function(_0x5c530f){return{'name':_0x5c530f[_0x26c3('0x16')],'type':_0x5c530f[_0x26c3('0x17')]['key']};});_0x170039['model']=_[_0x26c3('0x14')](_0x1405fb,'name');_0x170039['query']=_[_0x26c3('0x18')](_0x5545ee['query']);_0x170039[_0x26c3('0x19')]=_['intersection'](_0x170039[_0x26c3('0x1a')],_0x170039['query']);_0x170039[_0x26c3('0x19')]=_[_0x26c3('0x1b')](_0x170039[_0x26c3('0x19')],[_0x26c3('0x1c'),_0x26c3('0x1d'),_0x26c3('0x1e'),_0x26c3('0x1f'),_0x26c3('0x20'),_0x26c3('0x21'),_0x26c3('0x22'),'$eq',_0x26c3('0x23'),'$between','$notBetween',_0x26c3('0x24'),_0x26c3('0x25'),'$like',_0x26c3('0x26'),'$iLike',_0x26c3('0x27'),_0x26c3('0x28'),_0x26c3('0x29'),_0x26c3('0x2a'),_0x26c3('0x2b'),'$any']);_0x50a3e5[_0x26c3('0x2c')]=_[_0x26c3('0x2d')](_0x170039[_0x26c3('0x1a')],qs[_0x26c3('0x2e')](_0x5545ee[_0x26c3('0x2f')][_0x26c3('0x2e')]));_0x50a3e5['attributes']=_0x50a3e5[_0x26c3('0x2c')][_0x26c3('0x30')]?_0x50a3e5[_0x26c3('0x2c')]:_0x170039['model'];if(!_0x5545ee[_0x26c3('0x2f')][_0x26c3('0x31')](_0x26c3('0x32'))){_0x50a3e5[_0x26c3('0xb')]=qs[_0x26c3('0xb')](_0x5545ee[_0x26c3('0x2f')]['limit']);_0x50a3e5[_0x26c3('0x9')]=qs[_0x26c3('0x9')](_0x5545ee['query']['offset']);}_0x50a3e5['order']=qs['sort'](_0x5545ee['query'][_0x26c3('0x33')]);_0x50a3e5[_0x26c3('0x34')]=qs['filters'](_[_0x26c3('0x35')](_0x5545ee[_0x26c3('0x2f')],_0x170039['filters']),_0x1405fb);if(_0x5545ee['query'][_0x26c3('0x36')]){_0x50a3e5['where']=_[_0x26c3('0x37')](_0x50a3e5['where'],{'$or':_[_0x26c3('0x14')](_0x1405fb,function(_0x40e41c){if(_0x40e41c[_0x26c3('0x17')]!==_0x26c3('0x38')){var _0x474349={};_0x474349[_0x40e41c['name']]={'$like':'%'+_0x5545ee[_0x26c3('0x2f')][_0x26c3('0x36')]+'%'};return _0x474349;}})});}_0x50a3e5=_[_0x26c3('0x37')]({},_0x50a3e5,_0x5545ee[_0x26c3('0x39')]);var _0x43145f={'where':_0x50a3e5[_0x26c3('0x34')]};return db['CmHopper']['count'](_0x43145f)[_0x26c3('0x10')](function(_0xcdb3fb){_0x2613e2[_0x26c3('0xc')]=_0xcdb3fb;if(_0x5545ee[_0x26c3('0x2f')][_0x26c3('0x3a')]){_0x50a3e5['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x50a3e5);})[_0x26c3('0x10')](function(_0x3fc4f7){_0x2613e2[_0x26c3('0x3b')]=_0x3fc4f7;return _0x2613e2;})[_0x26c3('0x10')](respondWithFilteredResult(_0x38fe17,_0x50a3e5))[_0x26c3('0x3c')](handleError(_0x38fe17,null));};exports['show']=function(_0x592764,_0x6db262){var _0x16e680={'raw':!![],'where':{'id':_0x592764[_0x26c3('0x3d')]['id']}},_0x2d9e80={};_0x2d9e80['model']=_[_0x26c3('0x18')](db[_0x26c3('0x15')][_0x26c3('0x3e')]);_0x2d9e80[_0x26c3('0x2f')]=_[_0x26c3('0x18')](_0x592764[_0x26c3('0x2f')]);_0x2d9e80[_0x26c3('0x19')]=_[_0x26c3('0x2d')](_0x2d9e80[_0x26c3('0x1a')],_0x2d9e80[_0x26c3('0x2f')]);_0x16e680[_0x26c3('0x2c')]=_[_0x26c3('0x2d')](_0x2d9e80[_0x26c3('0x1a')],qs['fields'](_0x592764[_0x26c3('0x2f')][_0x26c3('0x2e')]));_0x16e680[_0x26c3('0x2c')]=_0x16e680[_0x26c3('0x2c')][_0x26c3('0x30')]?_0x16e680[_0x26c3('0x2c')]:_0x2d9e80['model'];if(_0x592764[_0x26c3('0x2f')]['includeAll']){_0x16e680[_0x26c3('0x3f')]=[{'all':!![]}];}_0x16e680=_['merge']({},_0x16e680,_0x592764[_0x26c3('0x39')]);return db[_0x26c3('0x15')]['find'](_0x16e680)[_0x26c3('0x10')](handleEntityNotFound(_0x6db262,null))[_0x26c3('0x10')](respondWithResult(_0x6db262,null))[_0x26c3('0x3c')](handleError(_0x6db262,null));};exports[_0x26c3('0x40')]=function(_0x651d74,_0x4a7d48){return db[_0x26c3('0x15')]['create'](_0x651d74[_0x26c3('0x41')],{})['then'](respondWithResult(_0x4a7d48,0xc9))['catch'](handleError(_0x4a7d48,null));};exports[_0x26c3('0xf')]=function(_0x2b86da,_0x278563){if(_0x2b86da['body']['id']){delete _0x2b86da[_0x26c3('0x41')]['id'];}return db[_0x26c3('0x15')][_0x26c3('0x42')]({'where':{'id':_0x2b86da[_0x26c3('0x3d')]['id']}})[_0x26c3('0x10')](handleEntityNotFound(_0x278563,null))[_0x26c3('0x10')](saveUpdates(_0x2b86da['body'],null))[_0x26c3('0x10')](respondWithResult(_0x278563,null))[_0x26c3('0x3c')](handleError(_0x278563,null));};exports[_0x26c3('0x43')]=function(_0x133cf7,_0x551e22){return db[_0x26c3('0x15')][_0x26c3('0x43')]()['then'](respondWithResult(_0x551e22,null))[_0x26c3('0x3c')](handleError(_0x551e22,null));};exports[_0x26c3('0x44')]=function(_0x522fe2,_0x4566ab){var _0x4827c6;var _0x2c6d8b=_0x522fe2[_0x26c3('0x3d')]['id'];return db[_0x26c3('0x15')][_0x26c3('0x42')]({'where':{'id':_0x522fe2[_0x26c3('0x3d')]['id']}})[_0x26c3('0x10')](handleEntityNotFound(_0x4566ab,null))[_0x26c3('0x10')](function(_0x4b7578){if(_0x4b7578){return _0x4b7578[_0x26c3('0x44')]()['then'](function(_0x4ada42){return _0x4ada42;});}})[_0x26c3('0x10')](function(_0x3a46f9){_0x4827c6=_0x3a46f9;if(_0x3a46f9){if(_0x3a46f9[_0x26c3('0x45')]||_0x3a46f9['CampaignId']){return db[_0x3a46f9['VoiceQueueId']?_0x26c3('0x46'):_0x26c3('0x47')][_0x26c3('0x42')]({'where':{'id':_0x3a46f9['VoiceQueueId']?_0x3a46f9[_0x26c3('0x45')]:_0x3a46f9[_0x26c3('0x48')]},'attributes':['id',_0x26c3('0x12')],'raw':!![]});}}})['then'](function(_0x24f3a1){var _0x4f3564={};if(_0x24f3a1){_[_0x26c3('0x37')](_0x4f3564,_[_0x26c3('0x49')](_0x4827c6[_0x26c3('0x4a')],['createdAt',_0x26c3('0x4b'),'id']));_0x4f3564[_0x26c3('0x4c')]=0x15;_0x4f3564[_0x26c3('0x4d')]=_0x26c3('0x4e');_0x4f3564[_0x26c3('0x4f')]=_0x24f3a1[_0x26c3('0x12')];_0x4f3564['membername']=_0x522fe2[_0x26c3('0x50')][_0x26c3('0x12')];_0x4f3564['UserId']=_0x522fe2[_0x26c3('0x50')]['id'];_0x4f3564['deleted']=!![];_0x4f3564['deletedat']=moment()[_0x26c3('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f3564[_0x26c3('0x52')]=_0x4827c6[_0x26c3('0x53')];_0x4f3564[_0x26c3('0x54')]=_0x4827c6[_0x26c3('0x45')]?'queue':'ivr';return db[_0x26c3('0x55')]['find']({'where':{'id':_0x4f3564['ContactId']},'attributes':['firstName',_0x26c3('0x56')]})['then'](function(_0x4a0100){if(!_[_0x26c3('0x57')](_0x4566ab)&&!_[_0x26c3('0x57')](_0x4a0100[_0x26c3('0x58')])){_0x4f3564[_0x26c3('0x59')]=_0x4a0100[_0x26c3('0x58')];if(!_[_0x26c3('0x57')](_0x4a0100['lastName'])){_0x4f3564[_0x26c3('0x59')]+='\x20'+_0x4a0100[_0x26c3('0x56')];}}})[_0x26c3('0x5a')](function(){return db[_0x26c3('0x5b')]['create'](_0x4f3564);});}})[_0x26c3('0x10')](function(_0x2c8390){return db[_0x26c3('0x5c')][_0x26c3('0x44')]({'where':{'CmHopperId':_0x2c6d8b}});})[_0x26c3('0x10')](function(){return _0x4566ab[_0x26c3('0x7')](0xcc)['end']();})[_0x26c3('0x3c')](handleError(_0x4566ab,null));};exports[_0x26c3('0x5d')]=function(_0x34c041,_0x3ad7b1){var _0x5cc9fc=[];return db[_0x26c3('0x55')][_0x26c3('0x43')]()[_0x26c3('0x10')](function(_0x416373){_0x5cc9fc=_['keys'](_0x416373);return _0x34c041[_0x26c3('0x50')][_0x26c3('0x5e')]({'where':{'type':_0x26c3('0x5f'),'dialActive':!![],'dialMethod':_0x26c3('0x60')},'attributes':['id','dialOrderByScheduledAt',_0x26c3('0x61')],'raw':!![]});})['then'](function(_0x2ada84){if(_0x2ada84&&_0x2ada84['length']){return db[_0x26c3('0x62')][_0x26c3('0x63')](function(_0x4bfda1){var _0x4518bc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x26c3('0x51')](_0x26c3('0x64'))},'VoiceQueueId':{'$in':_[_0x26c3('0x14')](_0x2ada84,'id')},'$or':[{'UserId':null},{'UserId':_0x34c041[_0x26c3('0x50')]['id']}]};var _0x4fbd2e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2ada84)[_0x26c3('0x36')]([_0x26c3('0x61'),0x0])[_0x26c3('0x14')]('id')[_0x26c3('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x34c041[_0x26c3('0x50')]['id']}]};var _0x3268d7={'$or':[_0x4518bc,_0x4fbd2e]};var _0x38cd7e=[];if(_0x34c041['body'][_0x26c3('0x66')]&&_0x34c041[_0x26c3('0x41')][_0x26c3('0x66')]===_0x26c3('0x67')){if(!_['isEmpty'](_0x34c041[_0x26c3('0x41')][_0x26c3('0x68')])){_0x3268d7['id']={'$in':_0x34c041['body'][_0x26c3('0x68')]};}_0x38cd7e=[[_0x26c3('0x69'),_0x26c3('0x6a')],[_0x26c3('0x6b'),_0x2ada84[0x0][_0x26c3('0x6c')]===_0x26c3('0x6a')?_0x26c3('0x6d'):_0x26c3('0x6a')],db[_0x26c3('0x62')][_0x26c3('0x6e')](_0x26c3('0x6f')),['id',_0x26c3('0x6d')]];}else{if(!_['isEmpty'](_0x34c041['body']['hopperIds'])){_0x3268d7['id']={'$notIn':_0x34c041['body'][_0x26c3('0x68')]};}_0x38cd7e=[[_0x26c3('0x69'),_0x26c3('0x6d')],[_0x26c3('0x6b'),_0x2ada84[0x0][_0x26c3('0x6c')]],db[_0x26c3('0x62')][_0x26c3('0x6e')](_0x26c3('0x70')),['id','ASC']];}return db[_0x26c3('0x15')][_0x26c3('0x71')]({'attributes':['id',_0x26c3('0x72'),_0x26c3('0x53'),_0x26c3('0x73')],'where':_0x3268d7,'order':_0x38cd7e,'transaction':_0x4bfda1,'lock':_0x4bfda1[_0x26c3('0x74')]['UPDATE'],'include':[{'model':db[_0x26c3('0x55')],'as':_0x26c3('0x75'),'attributes':_0x5cc9fc,'include':[{'model':db['CmCompany'],'as':_0x26c3('0x76'),'attributes':['id',_0x26c3('0x12')]}]},{'model':db['CmList'],'as':_0x26c3('0x77'),'attributes':['id',_0x26c3('0x12')]},{'model':db[_0x26c3('0x46')],'as':'Queue','attributes':['id',_0x26c3('0x12'),_0x26c3('0x78')]}]})[_0x26c3('0x10')](function(_0x13f0ac){if(_0x13f0ac){return _0x13f0ac[_0x26c3('0xf')]({'UserId':_0x34c041[_0x26c3('0x50')]['id']},{'transaction':_0x4bfda1});}});});}})[_0x26c3('0x10')](handleEntityNotFound(_0x3ad7b1,null))['then'](respondWithResult(_0x3ad7b1,null))['catch'](handleError(_0x3ad7b1,null));};exports[_0x26c3('0x79')]=function(_0x1ce607,_0x1c7387,_0x18189a){var _0x56b282=[];var _0x3c03cb=_0x1ce607['params']['id'];var _0x568151=_0x1ce607[_0x26c3('0x50')]['id'];return db[_0x26c3('0x55')]['describe']()[_0x26c3('0x10')](function(_0x59a8b8){_0x56b282=_[_0x26c3('0x18')](_0x59a8b8);return db[_0x26c3('0x62')][_0x26c3('0x63')](function(_0x5bbaae){const _0xc40965={'id':_0x3c03cb};return db['CmHopper'][_0x26c3('0x71')]({'attributes':['id',_0x26c3('0x72'),_0x26c3('0x73')],'where':_0xc40965,'transaction':_0x5bbaae,'lock':_0x5bbaae[_0x26c3('0x74')][_0x26c3('0x7a')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x56b282,'include':[{'model':db[_0x26c3('0x7b')],'as':_0x26c3('0x76'),'attributes':['id','name']}]},{'model':db[_0x26c3('0x7c')],'as':_0x26c3('0x77'),'attributes':['id',_0x26c3('0x12')]},{'model':db['VoiceQueue'],'as':_0x26c3('0x7d'),'attributes':['id',_0x26c3('0x12'),'dialActive']}]})['then'](function(_0x1440c9){if(_0x1440c9){return _0x1440c9[_0x26c3('0xf')]({'UserId':_0x568151},{'transaction':_0x5bbaae});}});});})[_0x26c3('0x10')](handleEntityNotFound(_0x1c7387,null))[_0x26c3('0x10')](respondWithResult(_0x1c7387,null))[_0x26c3('0x3c')](handleError(_0x1c7387,null));};exports[_0x26c3('0x7e')]=function(_0x483458,_0x3ca3d7){return _0x483458[_0x26c3('0x50')]['getVoiceQueues']({'where':{'type':_0x26c3('0x5f'),'dialActive':!![],'dialMethod':_0x26c3('0x60')},'attributes':['id'],'raw':!![]})[_0x26c3('0x10')](function(_0x54691c){if(_0x54691c&&_0x54691c[_0x26c3('0x30')]){return db[_0x26c3('0x15')][_0x26c3('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x26c3('0x51')](_0x26c3('0x64'))},'VoiceQueueId':{'$in':_['map'](_0x54691c,'id')},'$or':[{'UserId':null},{'UserId':_0x483458['user']['id']}]}});}return 0x0;})[_0x26c3('0x10')](function(_0x469a0a){if(!_[_0x26c3('0x57')](_0x469a0a)&&_['isNumber'](_0x469a0a)){return _0x3ca3d7[_0x26c3('0x7')](0xc8)[_0x26c3('0x8')]({'contacts':_0x469a0a});}else{logger['error'](_0x26c3('0x7f'),_0x26c3('0x7e'),0x194,_0x26c3('0x80'));_0x3ca3d7['sendStatus'](0x194);}})[_0x26c3('0x3c')](handleError(_0x3ca3d7,null));};exports[_0x26c3('0x81')]=function(_0x452a3e,_0x188f2e){var _0x4e9d4b=shared['timezones'];var _0x34acb7=[];_[_0x26c3('0x14')](_0x4e9d4b,function(_0x1be246){_0x34acb7[_0x26c3('0x82')]({'id':_0x1be246[_0x26c3('0x12')],'name':_0x1be246[_0x26c3('0x12')],'utcOffset':_0x1be246['utcOffset']});});return _0x188f2e[_0x26c3('0x7')](0xc8)[_0x26c3('0x8')]({'tz':_0x34acb7});};exports[_0x26c3('0x83')]=function(_0x44a99e,_0x2c91f1){var _0x23f7af=shared[_0x26c3('0x84')];var _0x1da826={};if(!_[_0x26c3('0x57')](_0x23f7af[_0x44a99e[_0x26c3('0x41')]['id']]))_0x1da826=_0x23f7af[_0x44a99e['body']['id']];return _0x2c91f1[_0x26c3('0x7')](0xc8)[_0x26c3('0x8')](_0x1da826);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 3a67b0b..eb5cf6d 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326f,0xd1));var _0xf326=function(_0x524d0b,_0x513d30){_0x524d0b=_0x524d0b-0x0;var _0x177fc8=_0x326f[_0x524d0b];return _0x177fc8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api'];(function(_0x4fadaf,_0x179d85){var _0x4738a8=function(_0x34ce7b){while(--_0x34ce7b){_0x4fadaf['push'](_0x4fadaf['shift']());}};_0x4738a8(++_0x179d85);}(_0x187d,0x93));var _0xd187=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x187d[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xc')]},{'name':_0xd187('0xd'),'fields':['phone']},{'name':_0xd187('0xe'),'fields':[_0xd187('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a5d7948..044003c 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 _0xaf4c=['limit','include','map','model','debug','ShowCmHopper','CmHopper','create','body','CreateCmHopper','raw','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','UpdateCmHopper','DestroyCmHopper','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','push','update','all','GetContactDialer','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','contactsRescheduled','CountReScheduled','order','UserId','length','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','CmHopperHandlePreviewRecallNotifications','util','moment','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopper','findAll','options','where','attributes'];(function(_0x4aed6f,_0x25250e){var _0x40503e=function(_0x290617){while(--_0x290617){_0x4aed6f['push'](_0x4aed6f['shift']());}};_0x40503e(++_0x25250e);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x182de9,_0x88a47a){_0x182de9=_0x182de9-0x0;var _0x424bcc=_0xaf4c[_0x182de9];return _0x424bcc;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var moment=require(_0xcaf4('0x1'));var BPromise=require('bluebird');var db=require(_0xcaf4('0x2'))['db'];var logger=require(_0xcaf4('0x3'))(_0xcaf4('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xcaf4('0x5')][_0xcaf4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1018ca,_0x4fddcf,_0x21ad95){return new BPromise(function(_0x548527,_0x3de3af){return client[_0xcaf4('0x7')](_0x1018ca,_0x21ad95)[_0xcaf4('0x8')](function(_0x3380fa){logger[_0xcaf4('0x9')](_0xcaf4('0xa'),_0x4fddcf,'request\x20sent');logger['debug'](_0xcaf4('0xb'),_0x4fddcf,_0xcaf4('0xc'),JSON[_0xcaf4('0xd')](_0x3380fa));if(_0x3380fa[_0xcaf4('0xe')]){if(_0x3380fa[_0xcaf4('0xe')][_0xcaf4('0xf')]===0x1f4){logger[_0xcaf4('0xe')](_0xcaf4('0xa'),_0x4fddcf,_0x3380fa[_0xcaf4('0xe')]['message']);return _0x3de3af(_0x3380fa[_0xcaf4('0xe')][_0xcaf4('0x10')]);}logger['error'](_0xcaf4('0xa'),_0x4fddcf,_0x3380fa[_0xcaf4('0xe')][_0xcaf4('0x10')]);return _0x548527(_0x3380fa['error'][_0xcaf4('0x10')]);}else{logger[_0xcaf4('0x9')]('CmHopper,\x20%s,\x20%s',_0x4fddcf,_0xcaf4('0xc'));_0x548527(_0x3380fa['result'][_0xcaf4('0x10')]);}})[_0xcaf4('0x11')](function(_0x67532a){logger[_0xcaf4('0xe')](_0xcaf4('0xa'),_0x4fddcf,_0x67532a);_0x3de3af(_0x67532a);});});}exports[_0xcaf4('0x12')]=function(_0x4d2817){var _0x11e29e=this;return new Promise(function(_0x488bac,_0x31743d){return db['CmHopper'][_0xcaf4('0x13')]({'raw':_0x4d2817[_0xcaf4('0x14')]?_0x4d2817[_0xcaf4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4d2817['options']?_0x4d2817[_0xcaf4('0x14')][_0xcaf4('0x15')]||null:null,'attributes':_0x4d2817[_0xcaf4('0x14')]?_0x4d2817[_0xcaf4('0x14')][_0xcaf4('0x16')]||null:null,'limit':_0x4d2817['options']?_0x4d2817[_0xcaf4('0x14')][_0xcaf4('0x17')]||null:null,'include':_0x4d2817[_0xcaf4('0x14')]?_0x4d2817['options'][_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x4d2817[_0xcaf4('0x14')]['include'],function(_0xaab3f9){return{'model':db[_0xaab3f9['model']],'as':_0xaab3f9['as'],'attributes':_0xaab3f9[_0xcaf4('0x16')],'include':_0xaab3f9[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0xaab3f9['include'],function(_0x2078d9){return{'model':db[_0x2078d9[_0xcaf4('0x1a')]],'as':_0x2078d9['as'],'attributes':_0x2078d9[_0xcaf4('0x16')],'include':_0x2078d9[_0xcaf4('0x18')]?_['map'](_0x2078d9[_0xcaf4('0x18')],function(_0xf9fe54){return{'model':db[_0xf9fe54['model']],'as':_0xf9fe54['as'],'attributes':_0xf9fe54[_0xcaf4('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcaf4('0x8')](function(_0x43c05d){logger[_0xcaf4('0x9')](_0xcaf4('0x12'),_0x4d2817);logger[_0xcaf4('0x1b')](_0xcaf4('0x12'),_0x4d2817,JSON['stringify'](_0x43c05d));_0x488bac(_0x43c05d);})[_0xcaf4('0x11')](function(_0x16b3b8){logger[_0xcaf4('0xe')]('GetCmHopper',_0x16b3b8[_0xcaf4('0x10')],_0x4d2817);_0x31743d(_0x11e29e[_0xcaf4('0xe')](0x1f4,_0x16b3b8[_0xcaf4('0x10')]));});});};exports[_0xcaf4('0x1c')]=function(_0xfac767){var _0x3f1f6d=this;return new Promise(function(_0x31322d,_0x52ee2a){return db[_0xcaf4('0x1d')]['find']({'raw':_0xfac767['options']?_0xfac767[_0xcaf4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xfac767[_0xcaf4('0x14')]?_0xfac767['options'][_0xcaf4('0x15')]||null:null,'attributes':_0xfac767['options']?_0xfac767[_0xcaf4('0x14')][_0xcaf4('0x16')]||null:null,'include':_0xfac767[_0xcaf4('0x14')]?_0xfac767[_0xcaf4('0x14')][_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0xfac767[_0xcaf4('0x14')][_0xcaf4('0x18')],function(_0x5b55f1){return{'model':db[_0x5b55f1[_0xcaf4('0x1a')]],'as':_0x5b55f1['as'],'attributes':_0x5b55f1[_0xcaf4('0x16')],'include':_0x5b55f1[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x5b55f1[_0xcaf4('0x18')],function(_0x4b09cf){return{'model':db[_0x4b09cf['model']],'as':_0x4b09cf['as'],'attributes':_0x4b09cf['attributes'],'include':_0x4b09cf['include']?_['map'](_0x4b09cf[_0xcaf4('0x18')],function(_0x37ed8f){return{'model':db[_0x37ed8f[_0xcaf4('0x1a')]],'as':_0x37ed8f['as'],'attributes':_0x37ed8f['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaf4('0x8')](function(_0x23820e){logger[_0xcaf4('0x9')](_0xcaf4('0x1c'),_0xfac767);logger['debug']('ShowCmHopper',_0xfac767,JSON['stringify'](_0x23820e));_0x31322d(_0x23820e);})['catch'](function(_0x5bc344){logger[_0xcaf4('0xe')](_0xcaf4('0x1c'),_0x5bc344['message'],_0xfac767);_0x52ee2a(_0x3f1f6d[_0xcaf4('0xe')](0x1f4,_0x5bc344[_0xcaf4('0x10')]));});});};exports['CreateCmHopper']=function(_0x11c58e){var _0x43f1c0=this;return new Promise(function(_0x1ea14d,_0x4f5305){return db['CmHopper'][_0xcaf4('0x1e')](_0x11c58e[_0xcaf4('0x1f')],{'raw':_0x11c58e[_0xcaf4('0x14')]?_0x11c58e[_0xcaf4('0x14')]['raw']===undefined?!![]:![]:!![]})[_0xcaf4('0x8')](function(_0x23c725){logger[_0xcaf4('0x9')]('CreateCmHopper',_0x11c58e);logger[_0xcaf4('0x1b')](_0xcaf4('0x20'),_0x11c58e,JSON[_0xcaf4('0xd')](_0x23c725));_0x1ea14d(_0x23c725);})[_0xcaf4('0x11')](function(_0x3ad6b5){logger[_0xcaf4('0xe')]('CreateCmHopper',_0x3ad6b5['message'],_0x11c58e);_0x4f5305(_0x43f1c0[_0xcaf4('0xe')](0x1f4,_0x3ad6b5[_0xcaf4('0x10')]));});});};exports['UpdateCmHopper']=function(_0xda0fde){var _0xf6f3e7=this;return new Promise(function(_0x2b52c2,_0x645b5c){return db[_0xcaf4('0x1d')]['update'](_0xda0fde[_0xcaf4('0x1f')],{'raw':_0xda0fde[_0xcaf4('0x14')]?_0xda0fde[_0xcaf4('0x14')][_0xcaf4('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda0fde[_0xcaf4('0x14')]?_0xda0fde['options'][_0xcaf4('0x15')]||null:null,'attributes':_0xda0fde[_0xcaf4('0x14')]?_0xda0fde[_0xcaf4('0x14')]['attributes']||null:null,'limit':_0xda0fde[_0xcaf4('0x14')]?_0xda0fde[_0xcaf4('0x14')]['limit']||null:null})[_0xcaf4('0x8')](function(_0x2158c4){logger[_0xcaf4('0x9')]('UpdateCmHopper',_0xda0fde);logger[_0xcaf4('0x9')](_0xcaf4('0x22'),JSON[_0xcaf4('0xd')](_0xda0fde[_0xcaf4('0x14')][_0xcaf4('0x15')]),_0xda0fde[_0xcaf4('0x1f')][_0xcaf4('0x23')]);logger['debug'](_0xcaf4('0x24'),_0xda0fde,JSON[_0xcaf4('0xd')](_0x2158c4));_0x2b52c2(_0x2158c4);})[_0xcaf4('0x11')](function(_0x456dbe){logger[_0xcaf4('0xe')](_0xcaf4('0x24'),_0x456dbe[_0xcaf4('0x10')],_0xda0fde);_0x645b5c(_0xf6f3e7[_0xcaf4('0xe')](0x1f4,_0x456dbe[_0xcaf4('0x10')]));});});};exports['DestroyCmHopper']=function(_0x4e076e){var _0x22515e=this;return new Promise(function(_0x110b4f,_0x40179c){return db[_0xcaf4('0x1d')]['destroy']({'where':_0x4e076e['options']?_0x4e076e[_0xcaf4('0x14')][_0xcaf4('0x15')]||null:null})['then'](function(_0x179d26){logger[_0xcaf4('0x9')](_0xcaf4('0x25'),_0x4e076e);logger[_0xcaf4('0x1b')](_0xcaf4('0x25'),_0x4e076e,JSON[_0xcaf4('0xd')](_0x179d26));_0x110b4f(_0x179d26);})[_0xcaf4('0x11')](function(_0x3f32a5){logger['error']('DestroyCmHopper',_0x3f32a5[_0xcaf4('0x10')],_0x4e076e);_0x40179c(_0x22515e[_0xcaf4('0xe')](0x1f4,_0x3f32a5[_0xcaf4('0x10')]));});});};exports['GetContactDialer']=function(_0x29ca80){var _0x2d35be=this;return new Promise(function(_0x5df8ef,_0x342992){return db[_0xcaf4('0x26')][_0xcaf4('0x27')]()[_0xcaf4('0x8')](function(_0x403922){return db[_0xcaf4('0x28')]['transaction'](function(_0x336ba8){return db[_0xcaf4('0x1d')]['findAll']({'where':_0x29ca80[_0xcaf4('0x14')]?_0x29ca80['options']['where']||null:null,'attributes':_0x29ca80['options']?_0x29ca80[_0xcaf4('0x14')][_0xcaf4('0x16')]||null:null,'limit':_0x29ca80[_0xcaf4('0x14')]?_0x29ca80[_0xcaf4('0x14')][_0xcaf4('0x17')]||null:null,'order':_0x29ca80[_0xcaf4('0x14')]?_0x29ca80['options']['order']||null:null,'transaction':_0x336ba8,'lock':_0x336ba8[_0xcaf4('0x29')][_0xcaf4('0x2a')],'include':[{'model':db['CmContact'],'as':_0xcaf4('0x2b'),'attributes':_[_0xcaf4('0x2c')](_0x403922)},{'model':db[_0xcaf4('0x2d')],'as':_0xcaf4('0x2e'),'attributes':['id',_0xcaf4('0x2f'),_0xcaf4('0x30')]}]})['then'](function(_0x3e7370){var _0x47911c=[];var _0x4e14f4=[];for(var _0x1d9378=0x0;_0x1d9378<_0x3e7370['length'];_0x1d9378+=0x1){var _0x125efe=_0x3e7370[_0x1d9378]['UserId'];if(_0x125efe===null){_0x47911c[_0xcaf4('0x31')](_0x3e7370[_0x1d9378][_0xcaf4('0x32')](_0x29ca80[_0xcaf4('0x1f')],{'transaction':_0x336ba8}));}else if(!_0x4e14f4['includes'](_0x125efe)){_0x4e14f4[_0xcaf4('0x31')](_0x125efe);_0x47911c[_0xcaf4('0x31')](_0x3e7370[_0x1d9378][_0xcaf4('0x32')](_0x29ca80[_0xcaf4('0x1f')],{'transaction':_0x336ba8}));}}return BPromise[_0xcaf4('0x33')](_0x47911c);});})[_0xcaf4('0x8')](function(_0x17764f){logger[_0xcaf4('0x9')](_0xcaf4('0x34'),_0x29ca80);if(_0x17764f['length']>0x0){logger[_0xcaf4('0x9')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x17764f[0x0][_0xcaf4('0x35')]['id'],_0x17764f[0x0][_0xcaf4('0x35')][_0xcaf4('0x36')],_0x17764f[0x0][_0xcaf4('0x35')][_0xcaf4('0x23')]);}logger[_0xcaf4('0x1b')](_0xcaf4('0x34'),_0x29ca80,JSON[_0xcaf4('0xd')](_0x17764f));_0x5df8ef(_0x17764f);})['catch'](function(_0x235f99){logger[_0xcaf4('0xe')](_0xcaf4('0x34'),_0x235f99[_0xcaf4('0x10')],_0x29ca80);_0x342992(_0x2d35be[_0xcaf4('0xe')](0x1f4,_0x235f99[_0xcaf4('0x10')]));});});});};exports[_0xcaf4('0x37')]=function(_0x18ead3){var _0x568e8c=this;return new Promise(function(_0xf60d5d,_0x386f09){return db[_0xcaf4('0x28')][_0xcaf4('0x38')](function(_0x2943a0){return db[_0xcaf4('0x39')][_0xcaf4('0x1e')](_0x18ead3[_0xcaf4('0x1f')],{'raw':_0x18ead3[_0xcaf4('0x14')]?_0x18ead3[_0xcaf4('0x14')][_0xcaf4('0x21')]===undefined?!![]:![]:!![],'transaction':_0x2943a0})[_0xcaf4('0x8')](function(){logger['info'](_0xcaf4('0x3a'),JSON[_0xcaf4('0xd')](_0x18ead3[_0xcaf4('0x14')][_0xcaf4('0x15')]),_0x18ead3[_0xcaf4('0x14')]['where'][_0xcaf4('0x23')]);return db[_0xcaf4('0x1d')][_0xcaf4('0x3b')]({'where':_0x18ead3[_0xcaf4('0x14')]?_0x18ead3[_0xcaf4('0x14')]['where']||null:null,'transaction':_0x2943a0});});})['then'](function(_0x62c81f){logger[_0xcaf4('0x9')](_0xcaf4('0x37'),_0x18ead3);logger['debug'](_0xcaf4('0x37'),_0x18ead3,JSON[_0xcaf4('0xd')](_0x62c81f));_0xf60d5d(_0x62c81f);})['catch'](function(_0x904b7b){logger['error'](_0xcaf4('0x37'),_0x904b7b['message'],_0x18ead3);_0x386f09(_0x568e8c[_0xcaf4('0xe')](0x1f4,_0x904b7b[_0xcaf4('0x10')]));});});};exports['CountReScheduled']=function(_0xe658e1){var _0x489742=this;return new Promise(function(_0x99f935,_0x29eede){return db[_0xcaf4('0x1d')]['findAll']({'raw':_0xe658e1[_0xcaf4('0x14')]?_0xe658e1['options'][_0xcaf4('0x21')]===undefined?!![]:![]:!![],'where':_0xe658e1['options']?_0xe658e1['options']['where']||null:null,'attributes':[[db[_0xcaf4('0x28')]['fn'](_0xcaf4('0x3c'),db[_0xcaf4('0x28')]['fn']('IF',db['sequelize'][_0xcaf4('0x3d')](_0xcaf4('0x3e')+util[_0xcaf4('0x3f')](_0xcaf4('0x40'),moment()[_0xcaf4('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0xcaf4('0x41')]]})[_0xcaf4('0x8')](function(_0x25956f){logger[_0xcaf4('0x9')]('CountReScheduled',_0xe658e1);logger[_0xcaf4('0x1b')](_0xcaf4('0x42'),_0xe658e1,JSON[_0xcaf4('0xd')](_0x25956f));_0x99f935(_0x25956f);})[_0xcaf4('0x11')](function(_0xc9a106){logger['error'](_0xcaf4('0x42'),_0xc9a106[_0xcaf4('0x10')],_0xe658e1);_0x29eede(_0x489742['error'](0x1f4,_0xc9a106[_0xcaf4('0x10')]));});});};exports['GetContactRecallMe']=function(_0x523547){var _0x31559f=this;return new Promise(function(_0x692090,_0x2b7105){return db[_0xcaf4('0x26')][_0xcaf4('0x27')]()[_0xcaf4('0x8')](function(_0x42730c){return db[_0xcaf4('0x28')][_0xcaf4('0x38')](function(_0x5a3dd6){return db[_0xcaf4('0x1d')][_0xcaf4('0x13')]({'where':_0x523547['options']?_0x523547[_0xcaf4('0x14')][_0xcaf4('0x15')]||null:null,'attributes':_0x523547[_0xcaf4('0x14')]?_0x523547[_0xcaf4('0x14')][_0xcaf4('0x16')]||null:null,'limit':0x1,'order':_0x523547[_0xcaf4('0x14')]?_0x523547['options'][_0xcaf4('0x43')]||null:null,'group':db[_0xcaf4('0x1d')][_0xcaf4('0x44')],'transaction':_0x5a3dd6,'lock':_0x5a3dd6[_0xcaf4('0x29')]['UPDATE'],'include':_0x523547['options']?_0x523547[_0xcaf4('0x14')][_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x523547[_0xcaf4('0x14')][_0xcaf4('0x18')],function(_0x58be8d){return{'model':db[_0x58be8d[_0xcaf4('0x1a')]],'as':_0x58be8d['as'],'attributes':_0x58be8d['attributes'],'include':_0x58be8d[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x58be8d[_0xcaf4('0x18')],function(_0x5eada3){return{'model':db[_0x5eada3[_0xcaf4('0x1a')]],'as':_0x5eada3['as'],'attributes':_0x5eada3[_0xcaf4('0x16')],'include':_0x5eada3[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x5eada3[_0xcaf4('0x18')],function(_0x4306bd){return{'model':db[_0x4306bd[_0xcaf4('0x1a')]],'as':_0x4306bd['as'],'attributes':_0x4306bd[_0xcaf4('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcaf4('0x8')](function(_0x2425c0){var _0x2d0c2e=[];for(var _0x2cc17d=0x0;_0x2cc17d<_0x2425c0[_0xcaf4('0x45')];_0x2cc17d+=0x1){_0x2d0c2e['push'](_0x2425c0[_0x2cc17d][_0xcaf4('0x32')](_0x523547[_0xcaf4('0x1f')],{'transaction':_0x5a3dd6}));}return BPromise[_0xcaf4('0x33')](_0x2d0c2e);});})[_0xcaf4('0x8')](function(_0x37b00c){logger['info']('GetContactRecallMe',_0x523547);logger[_0xcaf4('0x1b')](_0xcaf4('0x46'),_0x523547,JSON[_0xcaf4('0xd')](_0x37b00c));_0x692090(_0x37b00c);})['catch'](function(_0x3c5a1c){logger[_0xcaf4('0xe')](_0xcaf4('0x46'),_0x3c5a1c[_0xcaf4('0x10')],_0x523547);_0x2b7105(_0x31559f[_0xcaf4('0xe')](0x1f4,_0x3c5a1c[_0xcaf4('0x10')]));});});});};exports[_0xcaf4('0x47')]=function(_0x2103b3){var _0x3fa020=this;return new Promise(function(_0x38283c,_0x32b366){db[_0xcaf4('0x26')]['describe']()[_0xcaf4('0x8')](function(_0x21ba9a){return db[_0xcaf4('0x1d')][_0xcaf4('0x13')]({'raw':_0x2103b3[_0xcaf4('0x14')]?_0x2103b3[_0xcaf4('0x14')][_0xcaf4('0x21')]===undefined?!![]:![]:!![],'where':_0x2103b3[_0xcaf4('0x14')]?_0x2103b3[_0xcaf4('0x14')][_0xcaf4('0x15')]||null:null,'attributes':_0x2103b3[_0xcaf4('0x14')]?_0x2103b3[_0xcaf4('0x14')][_0xcaf4('0x16')]||null:null,'limit':_0x2103b3[_0xcaf4('0x14')]?_0x2103b3[_0xcaf4('0x14')][_0xcaf4('0x17')]||null:null,'include':_0x2103b3['options']?_0x2103b3['options']['include']?_[_0xcaf4('0x19')](_0x2103b3['options'][_0xcaf4('0x18')],function(_0x5a25e7){return{'model':db[_0x5a25e7[_0xcaf4('0x1a')]],'as':_0x5a25e7['as'],'attributes':_0x5a25e7['as']===_0xcaf4('0x2b')?_[_0xcaf4('0x2c')](_0x21ba9a):_0x5a25e7['attributes'],'include':_0x5a25e7[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x5a25e7[_0xcaf4('0x18')],function(_0x2723d4){return{'model':db[_0x2723d4['model']],'as':_0x2723d4['as'],'attributes':_0x2723d4[_0xcaf4('0x16')],'include':_0x2723d4[_0xcaf4('0x18')]?_[_0xcaf4('0x19')](_0x2723d4[_0xcaf4('0x18')],function(_0x55dbdd){return{'model':db[_0x55dbdd[_0xcaf4('0x1a')]],'as':_0x55dbdd['as'],'attributes':_0x55dbdd['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaf4('0x8')](function(_0x49fa50){logger[_0xcaf4('0x9')](_0xcaf4('0x12'),_0x2103b3);logger[_0xcaf4('0x1b')](_0xcaf4('0x12'),_0x2103b3,JSON[_0xcaf4('0xd')](_0x49fa50));_0x38283c(_0x49fa50);})[_0xcaf4('0x11')](function(_0x4dcf0e){logger[_0xcaf4('0xe')](_0xcaf4('0x12'),_0x4dcf0e['message'],_0x2103b3);_0x32b366(_0x3fa020[_0xcaf4('0xe')](0x1f4,_0x4dcf0e[_0xcaf4('0x10')]));});});});};exports[_0xcaf4('0x48')]=function(_0x15db07){var _0x2de713=this;return new Promise(function(_0x571c80,_0x2cc5ad){return db[_0xcaf4('0x26')][_0xcaf4('0x49')]({'raw':!![],'where':{'phone':_0x15db07[_0xcaf4('0x14')][_0xcaf4('0x15')]['phone']},'attributes':['id',_0xcaf4('0x4a')],'order':[['id',_0xcaf4('0x4b')]]})[_0xcaf4('0x8')](function(_0x52a4bb){logger[_0xcaf4('0x9')](_0xcaf4('0x4c'),_0x15db07);logger[_0xcaf4('0x1b')](_0xcaf4('0x4c'),_0x15db07,JSON[_0xcaf4('0xd')](_0x52a4bb));_0x571c80(_0x52a4bb);})['catch'](function(_0x31925f){logger[_0xcaf4('0xe')](_0xcaf4('0x4c'),_0x31925f['message'],_0x15db07);_0x2cc5ad(_0x2de713[_0xcaf4('0xe')](0x1f4,_0x31925f['message']));});});};exports['ResetActiveCalls']=function(_0x1b8e88){var _0x1a903f=this;return new Promise(function(_0x13edf0,_0x2ecf55){return db[_0xcaf4('0x28')][_0xcaf4('0x38')](function(_0x53291f){return db[_0xcaf4('0x1d')][_0xcaf4('0x32')]({'active':![]},{'where':{},'transaction':_0x53291f})[_0xcaf4('0x8')](function(_0x5e84b0){logger[_0xcaf4('0x9')](_0xcaf4('0x4d'),_0x1b8e88);logger[_0xcaf4('0x1b')](_0xcaf4('0x4d'),_0x1b8e88,JSON[_0xcaf4('0xd')](_0x5e84b0));_0x13edf0(_0x5e84b0);})[_0xcaf4('0x11')](function(_0x146bbe){logger['error'](_0xcaf4('0x4d'),_0x146bbe[_0xcaf4('0x10')],_0x1b8e88);_0x2ecf55(_0x1a903f[_0xcaf4('0xe')](0x1f4,_0x146bbe[_0xcaf4('0x10')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xa01db1){var _0x39dfcb=this;var _0x33ac7b=_0xa01db1[_0xcaf4('0x1f')]['where'][_0xcaf4('0x4e')];var _0x4e977c=_0xa01db1[_0xcaf4('0x1f')]['where'][_0xcaf4('0x4f')];var _0x4c4d8b=_0xa01db1[_0xcaf4('0x1f')][_0xcaf4('0x15')][_0xcaf4('0x50')];return new Promise(function(_0x11b203,_0x2a4edd){return db['CmHopper'][_0xcaf4('0x13')]({'where':{'voiceQueueId':{'$in':_0x33ac7b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xcaf4('0x28')][_0xcaf4('0x3d')](_0xcaf4('0x51')+_0x4e977c+'\x20MINUTE'),'$gt':db[_0xcaf4('0x28')][_0xcaf4('0x3d')](_0xcaf4('0x52'))}},'UserId':{'$in':_0x4c4d8b}},'include':[{'model':db[_0xcaf4('0x26')],'as':'Contact'},{'model':db[_0xcaf4('0x2d')],'as':'Agent','attributes':['id',_0xcaf4('0x2f'),_0xcaf4('0x30')]},{'model':db[_0xcaf4('0x53')],'as':_0xcaf4('0x54')}]})['then'](function(_0x1c50ed){if(_0x1c50ed[_0xcaf4('0x45')]>0x0){return db[_0xcaf4('0x28')][_0xcaf4('0x38')](function(_0x2a74fa){return db[_0xcaf4('0x1d')]['update']({'recallmeNotifiedDate':db[_0xcaf4('0x28')][_0xcaf4('0x3d')](_0xcaf4('0x52'))},{'where':{'id':{'$in':_[_0xcaf4('0x19')](_0x1c50ed,'id')}},'transaction':_0x2a74fa})[_0xcaf4('0x8')](function(){_0x11b203(_0x1c50ed);})['catch'](function(_0x22dbdb){logger['error'](_0xcaf4('0x55'),_0x22dbdb['message'],_0xa01db1);_0x2a4edd(_0x39dfcb[_0xcaf4('0xe')](0x1f4,_0x22dbdb[_0xcaf4('0x10')]));});})[_0xcaf4('0x11')](function(_0x4b76d1){logger['error'](_0xcaf4('0x55'),_0x4b76d1['message'],_0xa01db1);_0x2a4edd(_0x39dfcb[_0xcaf4('0xe')](0x1f4,_0x4b76d1[_0xcaf4('0x10')]));});}else{_0x11b203(_0x1c50ed);}});});}; \ No newline at end of file +var _0x3013=['where','CmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','destroy','CmContact','describe','transaction','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','Contact','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()','lodash','util','moment','bluebird','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','findAll','options','raw','limit','model','attributes','include','map','ShowCmHopper'];(function(_0xc63444,_0x611880){var _0x3ccb87=function(_0x439fef){while(--_0x439fef){_0xc63444['push'](_0xc63444['shift']());}};_0x3ccb87(++_0x611880);}(_0x3013,0xea));var _0x3301=function(_0x1e9176,_0x1e4dfb){_0x1e9176=_0x1e9176-0x0;var _0xc8195d=_0x3013[_0x1e9176];return _0xc8195d;};'use strict';var _=require(_0x3301('0x0'));var util=require(_0x3301('0x1'));var moment=require(_0x3301('0x2'));var BPromise=require(_0x3301('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x3301('0x4'))('rpc');var jayson=require(_0x3301('0x5'));var client=jayson[_0x3301('0x6')][_0x3301('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3a8c34,_0x501044,_0x30b608){return new BPromise(function(_0x52515d,_0x41dd5b){return client[_0x3301('0x8')](_0x3a8c34,_0x30b608)[_0x3301('0x9')](function(_0x1b1d66){logger[_0x3301('0xa')]('CmHopper,\x20%s,\x20%s',_0x501044,_0x3301('0xb'));logger[_0x3301('0xc')](_0x3301('0xd'),_0x501044,_0x3301('0xb'),JSON[_0x3301('0xe')](_0x1b1d66));if(_0x1b1d66['error']){if(_0x1b1d66[_0x3301('0xf')][_0x3301('0x10')]===0x1f4){logger[_0x3301('0xf')](_0x3301('0x11'),_0x501044,_0x1b1d66[_0x3301('0xf')][_0x3301('0x12')]);return _0x41dd5b(_0x1b1d66[_0x3301('0xf')][_0x3301('0x12')]);}logger[_0x3301('0xf')](_0x3301('0x11'),_0x501044,_0x1b1d66[_0x3301('0xf')][_0x3301('0x12')]);return _0x52515d(_0x1b1d66[_0x3301('0xf')][_0x3301('0x12')]);}else{logger['info'](_0x3301('0x11'),_0x501044,_0x3301('0xb'));_0x52515d(_0x1b1d66['result']['message']);}})[_0x3301('0x13')](function(_0x225e94){logger['error'](_0x3301('0x11'),_0x501044,_0x225e94);_0x41dd5b(_0x225e94);});});}exports[_0x3301('0x14')]=function(_0x4a3915){var _0x293b9d=this;return new Promise(function(_0x6e88ec,_0x194df4){return db['CmHopper'][_0x3301('0x15')]({'raw':_0x4a3915[_0x3301('0x16')]?_0x4a3915[_0x3301('0x16')][_0x3301('0x17')]===undefined?!![]:![]:!![],'where':_0x4a3915[_0x3301('0x16')]?_0x4a3915[_0x3301('0x16')]['where']||null:null,'attributes':_0x4a3915['options']?_0x4a3915['options']['attributes']||null:null,'limit':_0x4a3915[_0x3301('0x16')]?_0x4a3915[_0x3301('0x16')][_0x3301('0x18')]||null:null,'include':_0x4a3915[_0x3301('0x16')]?_0x4a3915['options']['include']?_['map'](_0x4a3915[_0x3301('0x16')]['include'],function(_0x5a6d68){return{'model':db[_0x5a6d68[_0x3301('0x19')]],'as':_0x5a6d68['as'],'attributes':_0x5a6d68[_0x3301('0x1a')],'include':_0x5a6d68[_0x3301('0x1b')]?_[_0x3301('0x1c')](_0x5a6d68[_0x3301('0x1b')],function(_0x461550){return{'model':db[_0x461550['model']],'as':_0x461550['as'],'attributes':_0x461550[_0x3301('0x1a')],'include':_0x461550[_0x3301('0x1b')]?_[_0x3301('0x1c')](_0x461550[_0x3301('0x1b')],function(_0x54ec21){return{'model':db[_0x54ec21[_0x3301('0x19')]],'as':_0x54ec21['as'],'attributes':_0x54ec21[_0x3301('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3301('0x9')](function(_0x2febe1){logger[_0x3301('0xa')]('GetCmHopper',_0x4a3915);logger['debug']('GetCmHopper',_0x4a3915,JSON['stringify'](_0x2febe1));_0x6e88ec(_0x2febe1);})[_0x3301('0x13')](function(_0x1268d){logger[_0x3301('0xf')]('GetCmHopper',_0x1268d[_0x3301('0x12')],_0x4a3915);_0x194df4(_0x293b9d[_0x3301('0xf')](0x1f4,_0x1268d[_0x3301('0x12')]));});});};exports[_0x3301('0x1d')]=function(_0x17337c){var _0x3f3811=this;return new Promise(function(_0x336544,_0x20e938){return db['CmHopper']['find']({'raw':_0x17337c[_0x3301('0x16')]?_0x17337c[_0x3301('0x16')][_0x3301('0x17')]===undefined?!![]:![]:!![],'where':_0x17337c[_0x3301('0x16')]?_0x17337c[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':_0x17337c[_0x3301('0x16')]?_0x17337c['options']['attributes']||null:null,'include':_0x17337c[_0x3301('0x16')]?_0x17337c[_0x3301('0x16')][_0x3301('0x1b')]?_[_0x3301('0x1c')](_0x17337c[_0x3301('0x16')][_0x3301('0x1b')],function(_0x37f6c9){return{'model':db[_0x37f6c9[_0x3301('0x19')]],'as':_0x37f6c9['as'],'attributes':_0x37f6c9[_0x3301('0x1a')],'include':_0x37f6c9['include']?_[_0x3301('0x1c')](_0x37f6c9['include'],function(_0x496461){return{'model':db[_0x496461[_0x3301('0x19')]],'as':_0x496461['as'],'attributes':_0x496461[_0x3301('0x1a')],'include':_0x496461[_0x3301('0x1b')]?_[_0x3301('0x1c')](_0x496461[_0x3301('0x1b')],function(_0x137f48){return{'model':db[_0x137f48[_0x3301('0x19')]],'as':_0x137f48['as'],'attributes':_0x137f48['attributes']};}):[]};}):[]};}):[]:[]})[_0x3301('0x9')](function(_0x42206c){logger[_0x3301('0xa')](_0x3301('0x1d'),_0x17337c);logger[_0x3301('0xc')](_0x3301('0x1d'),_0x17337c,JSON[_0x3301('0xe')](_0x42206c));_0x336544(_0x42206c);})['catch'](function(_0x714f89){logger[_0x3301('0xf')]('ShowCmHopper',_0x714f89['message'],_0x17337c);_0x20e938(_0x3f3811[_0x3301('0xf')](0x1f4,_0x714f89[_0x3301('0x12')]));});});};exports['CreateCmHopper']=function(_0xdef18e){var _0x4bd260=this;return new Promise(function(_0x2a4ce3,_0xd37fb){return db[_0x3301('0x1f')][_0x3301('0x20')](_0xdef18e[_0x3301('0x21')],{'raw':_0xdef18e[_0x3301('0x16')]?_0xdef18e[_0x3301('0x16')][_0x3301('0x17')]===undefined?!![]:![]:!![]})[_0x3301('0x9')](function(_0x25ccfa){logger[_0x3301('0xa')](_0x3301('0x22'),_0xdef18e);logger['debug'](_0x3301('0x22'),_0xdef18e,JSON['stringify'](_0x25ccfa));_0x2a4ce3(_0x25ccfa);})[_0x3301('0x13')](function(_0x4c7370){logger['error']('CreateCmHopper',_0x4c7370[_0x3301('0x12')],_0xdef18e);_0xd37fb(_0x4bd260['error'](0x1f4,_0x4c7370['message']));});});};exports[_0x3301('0x23')]=function(_0x2283ed){var _0xd538c4=this;return new Promise(function(_0x1773fe,_0xe9c010){return db[_0x3301('0x1f')][_0x3301('0x24')](_0x2283ed[_0x3301('0x21')],{'raw':_0x2283ed[_0x3301('0x16')]?_0x2283ed[_0x3301('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2283ed['options']?_0x2283ed[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':_0x2283ed[_0x3301('0x16')]?_0x2283ed['options'][_0x3301('0x1a')]||null:null,'limit':_0x2283ed['options']?_0x2283ed['options']['limit']||null:null})[_0x3301('0x9')](function(_0x4c6004){logger['info'](_0x3301('0x23'),_0x2283ed);logger[_0x3301('0xa')](_0x3301('0x25'),JSON[_0x3301('0xe')](_0x2283ed[_0x3301('0x16')][_0x3301('0x1e')]),_0x2283ed[_0x3301('0x21')]['active']);logger[_0x3301('0xc')](_0x3301('0x23'),_0x2283ed,JSON[_0x3301('0xe')](_0x4c6004));_0x1773fe(_0x4c6004);})['catch'](function(_0x56634d){logger['error']('UpdateCmHopper',_0x56634d[_0x3301('0x12')],_0x2283ed);_0xe9c010(_0xd538c4['error'](0x1f4,_0x56634d[_0x3301('0x12')]));});});};exports[_0x3301('0x26')]=function(_0x506c4d){var _0x175cc5=this;return new Promise(function(_0x14cda6,_0x26183c){return db[_0x3301('0x1f')][_0x3301('0x27')]({'where':_0x506c4d['options']?_0x506c4d[_0x3301('0x16')][_0x3301('0x1e')]||null:null})['then'](function(_0x29aa3c){logger[_0x3301('0xa')](_0x3301('0x26'),_0x506c4d);logger[_0x3301('0xc')](_0x3301('0x26'),_0x506c4d,JSON['stringify'](_0x29aa3c));_0x14cda6(_0x29aa3c);})['catch'](function(_0x5a519c){logger[_0x3301('0xf')](_0x3301('0x26'),_0x5a519c[_0x3301('0x12')],_0x506c4d);_0x26183c(_0x175cc5[_0x3301('0xf')](0x1f4,_0x5a519c[_0x3301('0x12')]));});});};exports['GetContactDialer']=function(_0x16bd4b){var _0x4a384d=this;return new Promise(function(_0x496f34,_0xbcb672){return db[_0x3301('0x28')][_0x3301('0x29')]()[_0x3301('0x9')](function(_0x2d8b98){return db['sequelize'][_0x3301('0x2a')](function(_0x10c4ec){return db[_0x3301('0x1f')][_0x3301('0x15')]({'where':_0x16bd4b['options']?_0x16bd4b[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':_0x16bd4b[_0x3301('0x16')]?_0x16bd4b['options']['attributes']||null:null,'limit':_0x16bd4b[_0x3301('0x16')]?_0x16bd4b[_0x3301('0x16')][_0x3301('0x18')]||null:null,'order':_0x16bd4b[_0x3301('0x16')]?_0x16bd4b[_0x3301('0x16')]['order']||null:null,'transaction':_0x10c4ec,'lock':_0x10c4ec[_0x3301('0x2b')][_0x3301('0x2c')],'include':[{'model':db[_0x3301('0x28')],'as':'Contact','attributes':_[_0x3301('0x2d')](_0x2d8b98)},{'model':db[_0x3301('0x2e')],'as':_0x3301('0x2f'),'attributes':['id',_0x3301('0x30'),_0x3301('0x31')]}]})['then'](function(_0x450b8e){var _0x3fad82=[];var _0x3ec8c4=[];for(var _0x47b260=0x0;_0x47b260<_0x450b8e[_0x3301('0x32')];_0x47b260+=0x1){var _0x1af896=_0x450b8e[_0x47b260][_0x3301('0x33')];if(_0x1af896===null){_0x3fad82[_0x3301('0x34')](_0x450b8e[_0x47b260][_0x3301('0x24')](_0x16bd4b['body'],{'transaction':_0x10c4ec}));}else if(!_0x3ec8c4[_0x3301('0x35')](_0x1af896)){_0x3ec8c4[_0x3301('0x34')](_0x1af896);_0x3fad82[_0x3301('0x34')](_0x450b8e[_0x47b260][_0x3301('0x24')](_0x16bd4b[_0x3301('0x21')],{'transaction':_0x10c4ec}));}}return BPromise[_0x3301('0x36')](_0x3fad82);});})['then'](function(_0x463bb1){logger[_0x3301('0xa')]('GetContactDialer',_0x16bd4b);if(_0x463bb1['length']>0x0){logger[_0x3301('0xa')](_0x3301('0x37'),_0x463bb1[0x0][_0x3301('0x38')]['id'],_0x463bb1[0x0][_0x3301('0x38')][_0x3301('0x39')],_0x463bb1[0x0][_0x3301('0x38')][_0x3301('0x3a')]);}logger[_0x3301('0xc')](_0x3301('0x3b'),_0x16bd4b,JSON[_0x3301('0xe')](_0x463bb1));_0x496f34(_0x463bb1);})['catch'](function(_0x59dbde){logger[_0x3301('0xf')]('GetContactDialer',_0x59dbde[_0x3301('0x12')],_0x16bd4b);_0xbcb672(_0x4a384d['error'](0x1f4,_0x59dbde[_0x3301('0x12')]));});});});};exports[_0x3301('0x3c')]=function(_0x3cfc36){var _0x597804=this;return new Promise(function(_0x519432,_0x14660b){return db[_0x3301('0x3d')][_0x3301('0x2a')](function(_0x52bc73){return db[_0x3301('0x3e')][_0x3301('0x20')](_0x3cfc36[_0x3301('0x21')],{'raw':_0x3cfc36[_0x3301('0x16')]?_0x3cfc36[_0x3301('0x16')][_0x3301('0x17')]===undefined?!![]:![]:!![],'transaction':_0x52bc73})['then'](function(){logger[_0x3301('0xa')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x3301('0xe')](_0x3cfc36['options']['where']),_0x3cfc36[_0x3301('0x16')][_0x3301('0x1e')][_0x3301('0x3a')]);return db[_0x3301('0x1f')][_0x3301('0x27')]({'where':_0x3cfc36['options']?_0x3cfc36[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'transaction':_0x52bc73});});})[_0x3301('0x9')](function(_0x4a9580){logger[_0x3301('0xa')](_0x3301('0x3c'),_0x3cfc36);logger[_0x3301('0xc')](_0x3301('0x3c'),_0x3cfc36,JSON[_0x3301('0xe')](_0x4a9580));_0x519432(_0x4a9580);})[_0x3301('0x13')](function(_0x391db3){logger[_0x3301('0xf')](_0x3301('0x3c'),_0x391db3[_0x3301('0x12')],_0x3cfc36);_0x14660b(_0x597804[_0x3301('0xf')](0x1f4,_0x391db3['message']));});});};exports[_0x3301('0x3f')]=function(_0x578974){var _0x6dd528=this;return new Promise(function(_0x2702de,_0x5abb7c){return db['CmHopper']['findAll']({'raw':_0x578974['options']?_0x578974['options']['raw']===undefined?!![]:![]:!![],'where':_0x578974[_0x3301('0x16')]?_0x578974[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':[[db[_0x3301('0x3d')]['fn'](_0x3301('0x40'),db['sequelize']['fn']('IF',db[_0x3301('0x3d')][_0x3301('0x41')](_0x3301('0x42')+util[_0x3301('0x43')]('\x22%s\x22',moment()[_0x3301('0x43')](_0x3301('0x44')))+_0x3301('0x45')))),_0x3301('0x46')]]})['then'](function(_0x49a8ca){logger[_0x3301('0xa')](_0x3301('0x3f'),_0x578974);logger[_0x3301('0xc')](_0x3301('0x3f'),_0x578974,JSON[_0x3301('0xe')](_0x49a8ca));_0x2702de(_0x49a8ca);})['catch'](function(_0x2ea8b6){logger[_0x3301('0xf')](_0x3301('0x3f'),_0x2ea8b6[_0x3301('0x12')],_0x578974);_0x5abb7c(_0x6dd528[_0x3301('0xf')](0x1f4,_0x2ea8b6['message']));});});};exports[_0x3301('0x47')]=function(_0x4c3f64){var _0x517164=this;return new Promise(function(_0x5215de,_0x4a6019){return db['CmContact'][_0x3301('0x29')]()[_0x3301('0x9')](function(_0x17ae95){return db['sequelize'][_0x3301('0x2a')](function(_0x323108){return db['CmHopper']['findAll']({'where':_0x4c3f64[_0x3301('0x16')]?_0x4c3f64[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':_0x4c3f64['options']?_0x4c3f64[_0x3301('0x16')][_0x3301('0x1a')]||null:null,'limit':0x1,'order':_0x4c3f64[_0x3301('0x16')]?_0x4c3f64[_0x3301('0x16')][_0x3301('0x48')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x323108,'lock':_0x323108['LOCK']['UPDATE'],'include':_0x4c3f64['options']?_0x4c3f64['options'][_0x3301('0x1b')]?_['map'](_0x4c3f64['options']['include'],function(_0x56419b){return{'model':db[_0x56419b[_0x3301('0x19')]],'as':_0x56419b['as'],'attributes':_0x56419b[_0x3301('0x1a')],'include':_0x56419b[_0x3301('0x1b')]?_['map'](_0x56419b[_0x3301('0x1b')],function(_0x270d89){return{'model':db[_0x270d89[_0x3301('0x19')]],'as':_0x270d89['as'],'attributes':_0x270d89[_0x3301('0x1a')],'include':_0x270d89['include']?_[_0x3301('0x1c')](_0x270d89[_0x3301('0x1b')],function(_0x1f5f2c){return{'model':db[_0x1f5f2c[_0x3301('0x19')]],'as':_0x1f5f2c['as'],'attributes':_0x1f5f2c[_0x3301('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x556f07){var _0x3aface=[];for(var _0xf94fa9=0x0;_0xf94fa9<_0x556f07[_0x3301('0x32')];_0xf94fa9+=0x1){_0x3aface[_0x3301('0x34')](_0x556f07[_0xf94fa9]['update'](_0x4c3f64[_0x3301('0x21')],{'transaction':_0x323108}));}return BPromise['all'](_0x3aface);});})['then'](function(_0x9b03cf){logger[_0x3301('0xa')]('GetContactRecallMe',_0x4c3f64);logger[_0x3301('0xc')](_0x3301('0x47'),_0x4c3f64,JSON[_0x3301('0xe')](_0x9b03cf));_0x5215de(_0x9b03cf);})[_0x3301('0x13')](function(_0x4b9794){logger[_0x3301('0xf')](_0x3301('0x47'),_0x4b9794[_0x3301('0x12')],_0x4c3f64);_0x4a6019(_0x517164[_0x3301('0xf')](0x1f4,_0x4b9794['message']));});});});};exports[_0x3301('0x49')]=function(_0x24b4e3){var _0x145010=this;return new Promise(function(_0x2ca252,_0x20a472){db[_0x3301('0x28')][_0x3301('0x29')]()[_0x3301('0x9')](function(_0x55b4e6){return db[_0x3301('0x1f')]['findAll']({'raw':_0x24b4e3[_0x3301('0x16')]?_0x24b4e3[_0x3301('0x16')][_0x3301('0x17')]===undefined?!![]:![]:!![],'where':_0x24b4e3[_0x3301('0x16')]?_0x24b4e3[_0x3301('0x16')][_0x3301('0x1e')]||null:null,'attributes':_0x24b4e3['options']?_0x24b4e3['options']['attributes']||null:null,'limit':_0x24b4e3['options']?_0x24b4e3[_0x3301('0x16')][_0x3301('0x18')]||null:null,'include':_0x24b4e3['options']?_0x24b4e3['options']['include']?_[_0x3301('0x1c')](_0x24b4e3[_0x3301('0x16')][_0x3301('0x1b')],function(_0xbb22b4){return{'model':db[_0xbb22b4[_0x3301('0x19')]],'as':_0xbb22b4['as'],'attributes':_0xbb22b4['as']===_0x3301('0x4a')?_[_0x3301('0x2d')](_0x55b4e6):_0xbb22b4[_0x3301('0x1a')],'include':_0xbb22b4[_0x3301('0x1b')]?_[_0x3301('0x1c')](_0xbb22b4['include'],function(_0x487166){return{'model':db[_0x487166[_0x3301('0x19')]],'as':_0x487166['as'],'attributes':_0x487166[_0x3301('0x1a')],'include':_0x487166[_0x3301('0x1b')]?_[_0x3301('0x1c')](_0x487166['include'],function(_0x23e44a){return{'model':db[_0x23e44a['model']],'as':_0x23e44a['as'],'attributes':_0x23e44a[_0x3301('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3301('0x9')](function(_0x3b3204){logger[_0x3301('0xa')](_0x3301('0x14'),_0x24b4e3);logger[_0x3301('0xc')]('GetCmHopper',_0x24b4e3,JSON['stringify'](_0x3b3204));_0x2ca252(_0x3b3204);})[_0x3301('0x13')](function(_0x543d26){logger[_0x3301('0xf')](_0x3301('0x14'),_0x543d26[_0x3301('0x12')],_0x24b4e3);_0x20a472(_0x145010[_0x3301('0xf')](0x1f4,_0x543d26[_0x3301('0x12')]));});});});};exports['GetContactByPhone']=function(_0x3fcee7){var _0x57d602=this;return new Promise(function(_0x1e9e20,_0x41d1eb){return db[_0x3301('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x3fcee7[_0x3301('0x16')][_0x3301('0x1e')]['phone']},'attributes':['id',_0x3301('0x4b')],'order':[['id',_0x3301('0x4c')]]})[_0x3301('0x9')](function(_0x329644){logger[_0x3301('0xa')](_0x3301('0x4d'),_0x3fcee7);logger['debug'](_0x3301('0x4d'),_0x3fcee7,JSON[_0x3301('0xe')](_0x329644));_0x1e9e20(_0x329644);})[_0x3301('0x13')](function(_0x1254f0){logger[_0x3301('0xf')]('getContactByPhone',_0x1254f0[_0x3301('0x12')],_0x3fcee7);_0x41d1eb(_0x57d602[_0x3301('0xf')](0x1f4,_0x1254f0[_0x3301('0x12')]));});});};exports[_0x3301('0x4e')]=function(_0x39d747){var _0x52e877=this;return new Promise(function(_0x4bd77c,_0x40cc02){return db[_0x3301('0x3d')][_0x3301('0x2a')](function(_0x4cc0ea){return db[_0x3301('0x1f')][_0x3301('0x24')]({'active':![]},{'where':{},'transaction':_0x4cc0ea})[_0x3301('0x9')](function(_0xb34560){logger[_0x3301('0xa')]('ResetActiveCalls',_0x39d747);logger[_0x3301('0xc')](_0x3301('0x4e'),_0x39d747,JSON[_0x3301('0xe')](_0xb34560));_0x4bd77c(_0xb34560);})[_0x3301('0x13')](function(_0x66b12){logger[_0x3301('0xf')]('ResetActiveCalls',_0x66b12[_0x3301('0x12')],_0x39d747);_0x40cc02(_0x52e877['error'](0x1f4,_0x66b12[_0x3301('0x12')]));});});});};exports[_0x3301('0x4f')]=function(_0x44cc86){var _0x3b6b7d=this;var _0x3c8f85=_0x44cc86['body'][_0x3301('0x1e')][_0x3301('0x50')];var _0x250d69=_0x44cc86['body']['where'][_0x3301('0x51')];var _0x6974dc=_0x44cc86[_0x3301('0x21')][_0x3301('0x1e')][_0x3301('0x52')];return new Promise(function(_0x41b5bd,_0x17a2d5){return db[_0x3301('0x1f')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3c8f85},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3301('0x3d')][_0x3301('0x41')](_0x3301('0x53')+_0x250d69+_0x3301('0x54')),'$gt':db[_0x3301('0x3d')][_0x3301('0x41')]('NOW()')}},'UserId':{'$in':_0x6974dc}},'include':[{'model':db[_0x3301('0x28')],'as':'Contact'},{'model':db[_0x3301('0x2e')],'as':_0x3301('0x2f'),'attributes':['id',_0x3301('0x30'),_0x3301('0x31')]},{'model':db[_0x3301('0x55')],'as':_0x3301('0x56')}]})[_0x3301('0x9')](function(_0x1f2508){if(_0x1f2508[_0x3301('0x32')]>0x0){return db[_0x3301('0x3d')]['transaction'](function(_0x1a715e){return db[_0x3301('0x1f')][_0x3301('0x24')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0x3301('0x57'))},{'where':{'id':{'$in':_['map'](_0x1f2508,'id')}},'transaction':_0x1a715e})[_0x3301('0x9')](function(){_0x41b5bd(_0x1f2508);})[_0x3301('0x13')](function(_0x50fdaf){logger[_0x3301('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x50fdaf[_0x3301('0x12')],_0x44cc86);_0x17a2d5(_0x3b6b7d[_0x3301('0xf')](0x1f4,_0x50fdaf['message']));});})[_0x3301('0x13')](function(_0x445d98){logger[_0x3301('0xf')](_0x3301('0x4f'),_0x445d98[_0x3301('0x12')],_0x44cc86);_0x17a2d5(_0x3b6b7d[_0x3301('0xf')](0x1f4,_0x445d98[_0x3301('0x12')]));});}else{_0x41b5bd(_0x1f2508);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 238dd0a..d88bb49 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 _0xce0f=['delete','/:id','destroy','exports','isAuthenticated','index','get','/describe','getOpenContacts','getTimezones','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','update'];(function(_0x4d2c26,_0x2701f9){var _0x5bf9b4=function(_0x52edc6){while(--_0x52edc6){_0x4d2c26['push'](_0x4d2c26['shift']());}};_0x5bf9b4(++_0x2701f9);}(_0xce0f,0xa4));var _0xfce0=function(_0x3bfaeb,_0x4b13da){_0x3bfaeb=_0x3bfaeb-0x0;var _0x440988=_0xce0f[_0x3bfaeb];return _0x440988;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router['get']('/',auth[_0xfce0('0x0')](),controller[_0xfce0('0x1')]);router[_0xfce0('0x2')](_0xfce0('0x3'),auth[_0xfce0('0x0')](),controller['describe']);router[_0xfce0('0x2')]('/opencontacts',auth[_0xfce0('0x0')](),controller[_0xfce0('0x4')]);router['get']('/timezones',auth[_0xfce0('0x0')](),controller[_0xfce0('0x5')]);router[_0xfce0('0x2')]('/:id',auth[_0xfce0('0x0')](),controller['show']);router['get'](_0xfce0('0x6'),auth[_0xfce0('0x0')](),controller[_0xfce0('0x7')]);router[_0xfce0('0x8')]('/',auth['isAuthenticated'](),controller[_0xfce0('0x9')]);router[_0xfce0('0x8')](_0xfce0('0xa'),auth['isAuthenticated'](),controller[_0xfce0('0xb')]);router[_0xfce0('0x8')](_0xfce0('0xc'),auth['isAuthenticated'](),controller[_0xfce0('0xd')]);router[_0xfce0('0xe')]('/:id',auth[_0xfce0('0x0')](),controller[_0xfce0('0xf')]);router[_0xfce0('0x10')](_0xfce0('0x11'),auth[_0xfce0('0x0')](),controller[_0xfce0('0x12')]);module[_0xfce0('0x13')]=router; \ No newline at end of file +var _0x10d7=['Router','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','post','/preview','getTimezone','put','update','delete','exports','express'];(function(_0x27dfe7,_0x3acd6f){var _0x9d647c=function(_0x200340){while(--_0x200340){_0x27dfe7['push'](_0x27dfe7['shift']());}};_0x9d647c(++_0x3acd6f);}(_0x10d7,0xd0));var _0x710d=function(_0x21173e,_0x40c85a){_0x21173e=_0x21173e-0x0;var _0x5a3dd8=_0x10d7[_0x21173e];return _0x5a3dd8;};'use strict';var express=require(_0x710d('0x0'));var router=express[_0x710d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x710d('0x2'));router[_0x710d('0x3')]('/',auth[_0x710d('0x4')](),controller[_0x710d('0x5')]);router[_0x710d('0x3')]('/describe',auth[_0x710d('0x4')](),controller['describe']);router[_0x710d('0x3')](_0x710d('0x6'),auth['isAuthenticated'](),controller[_0x710d('0x7')]);router[_0x710d('0x3')]('/timezones',auth[_0x710d('0x4')](),controller[_0x710d('0x8')]);router[_0x710d('0x3')](_0x710d('0x9'),auth[_0x710d('0x4')](),controller[_0x710d('0xa')]);router['get'](_0x710d('0xb'),auth[_0x710d('0x4')](),controller['getPreviewRecall']);router[_0x710d('0xc')]('/',auth[_0x710d('0x4')](),controller['create']);router['post'](_0x710d('0xd'),auth[_0x710d('0x4')](),controller['getPreview']);router[_0x710d('0xc')]('/timezone',auth[_0x710d('0x4')](),controller[_0x710d('0xe')]);router[_0x710d('0xf')](_0x710d('0x9'),auth[_0x710d('0x4')](),controller[_0x710d('0x10')]);router[_0x710d('0x11')](_0x710d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x710d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index e222a22..7ef32b7 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3264=['DATE','YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER'];(function(_0x5f15f4,_0x5efcaf){var _0x17d662=function(_0x59516d){while(--_0x59516d){_0x5f15f4['push'](_0x5f15f4['shift']());}};_0x17d662(++_0x5efcaf);}(_0x3264,0x1ba));var _0x4326=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x3264[_0x4d613c];return _0x301fe3;};'use strict';var moment=require(_0x4326('0x0'));var Sequelize=require('sequelize');module[_0x4326('0x1')]={'CmHopperId':{'type':Sequelize[_0x4326('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4326('0x3')],'defaultValue':moment()['format'](_0x4326('0x4'))},'countbusyretry':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4326('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bd1=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER','DATE'];(function(_0x1bfa83,_0x265190){var _0x5ca1cf=function(_0x505cf0){while(--_0x505cf0){_0x1bfa83['push'](_0x1bfa83['shift']());}};_0x5ca1cf(++_0x265190);}(_0x2bd1,0x196));var _0x12bd=function(_0x174d4e,_0x49373f){_0x174d4e=_0x174d4e-0x0;var _0x128153=_0x2bd1[_0x174d4e];return _0x128153;};'use strict';var moment=require(_0x12bd('0x0'));var Sequelize=require(_0x12bd('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x12bd('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x12bd('0x3')],'defaultValue':moment()['format'](_0x12bd('0x4'))},'countbusyretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x12bd('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 4ea34db..4ed66be 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61ba=['set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x61ba,0x1e5));var _0xa61b=function(_0x4f2bc5,_0x1ced74){_0x4f2bc5=_0x4f2bc5-0x0;var _0x103453=_0x61ba[_0x4f2bc5];return _0x103453;};'use strict';var emlformat=require(_0xa61b('0x0'));var rimraf=require(_0xa61b('0x1'));var zipdir=require(_0xa61b('0x2'));var jsonpatch=require(_0xa61b('0x3'));var rp=require('request-promise');var moment=require(_0xa61b('0x4'));var BPromise=require(_0xa61b('0x5'));var Mustache=require(_0xa61b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa61b('0x7'));var ejs=require(_0xa61b('0x8'));var fs=require('fs');var fs_extra=require(_0xa61b('0x9'));var _=require(_0xa61b('0xa'));var squel=require('squel');var crypto=require(_0xa61b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa61b('0x7'));var querystring=require(_0xa61b('0xc'));var Papa=require(_0xa61b('0xd'));var Redis=require(_0xa61b('0xe'));var authService=require(_0xa61b('0xf'));var qs=require(_0xa61b('0x10'));var as=require(_0xa61b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa61b('0x12'))(_0xa61b('0x13'));var utils=require(_0xa61b('0x14'));var config=require(_0xa61b('0x15'));var licenseUtil=require(_0xa61b('0x16'));var db=require(_0xa61b('0x17'))['db'];function respondWithStatusCode(_0x57ff0e,_0x2114f6){_0x2114f6=_0x2114f6||0xcc;return function(_0x5c60c9){if(_0x5c60c9){return _0x57ff0e[_0xa61b('0x18')](_0x2114f6);}return _0x57ff0e[_0xa61b('0x19')](_0x2114f6)[_0xa61b('0x1a')]();};}function respondWithResult(_0x31facc,_0x39cfd0){_0x39cfd0=_0x39cfd0||0xc8;return function(_0x480a23){if(_0x480a23){return _0x31facc[_0xa61b('0x19')](_0x39cfd0)['json'](_0x480a23);}};}function respondWithFilteredResult(_0x3465b5,_0x18859e){return function(_0x35eb88){if(_0x35eb88){var _0x4d93de=typeof _0x18859e[_0xa61b('0x1b')]==='undefined'&&typeof _0x18859e[_0xa61b('0x1c')]===_0xa61b('0x1d');var _0x53fb29=_0x35eb88[_0xa61b('0x1e')];var _0x4f7337=_0x4d93de?0x0:_0x18859e[_0xa61b('0x1b')];var _0x6f7871=_0x4d93de?_0x35eb88[_0xa61b('0x1e')]:_0x18859e[_0xa61b('0x1b')]+_0x18859e['limit'];var _0x56021a;if(_0x6f7871>=_0x53fb29){_0x6f7871=_0x53fb29;_0x56021a=0xc8;}else{_0x56021a=0xce;}_0x3465b5[_0xa61b('0x19')](_0x56021a);return _0x3465b5[_0xa61b('0x1f')](_0xa61b('0x20'),_0x4f7337+'-'+_0x6f7871+'/'+_0x53fb29)[_0xa61b('0x21')](_0x35eb88);}return null;};}function patchUpdates(_0x5ea0c1){return function(_0x21c1ff){try{jsonpatch[_0xa61b('0x22')](_0x21c1ff,_0x5ea0c1,!![]);}catch(_0x3f9d77){return BPromise[_0xa61b('0x23')](_0x3f9d77);}return _0x21c1ff[_0xa61b('0x24')]();};}function saveUpdates(_0x205b6d,_0x3f9eaf){return function(_0x4ef1a8){if(_0x4ef1a8){return _0x4ef1a8['update'](_0x205b6d)[_0xa61b('0x25')](function(_0x295de6){return _0x295de6;});}return null;};}function removeEntity(_0x2ca78b,_0x17c07){return function(_0x12d555){if(_0x12d555){return _0x12d555[_0xa61b('0x26')]()[_0xa61b('0x25')](function(){var _0x57293b=_0x12d555[_0xa61b('0x27')]({'plain':!![]});var _0x3615a3='CmHopperAdditionalPhones';return db[_0xa61b('0x28')][_0xa61b('0x26')]({'where':{'type':_0x3615a3,'resourceId':_0x57293b['id']}})['then'](function(){return _0x12d555;});})[_0xa61b('0x25')](function(){_0x2ca78b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57dbe1,_0x301f50){return function(_0x4fb549){if(!_0x4fb549){_0x57dbe1[_0xa61b('0x18')](0x194);}return _0x4fb549;};}function handleError(_0x240426,_0x43096e){_0x43096e=_0x43096e||0x1f4;return function(_0x1cfe5c){logger[_0xa61b('0x29')](_0x1cfe5c[_0xa61b('0x2a')]);if(_0x1cfe5c[_0xa61b('0x2b')]){delete _0x1cfe5c[_0xa61b('0x2b')];}_0x240426['status'](_0x43096e)['send'](_0x1cfe5c);};}exports[_0xa61b('0x2c')]=function(_0x3f68be,_0x44ef0c){var _0x6fe579={},_0x7af83c={},_0x6c883e={'count':0x0,'rows':[]};var _0x1ab1f4=_[_0xa61b('0x2d')](db[_0xa61b('0x2e')]['rawAttributes'],function(_0x415e54){return{'name':_0x415e54[_0xa61b('0x2f')],'type':_0x415e54[_0xa61b('0x30')][_0xa61b('0x31')]};});_0x7af83c[_0xa61b('0x32')]=_['map'](_0x1ab1f4,_0xa61b('0x2b'));_0x7af83c[_0xa61b('0x33')]=_[_0xa61b('0x34')](_0x3f68be['query']);_0x7af83c['filters']=_['intersection'](_0x7af83c['model'],_0x7af83c['query']);_0x6fe579[_0xa61b('0x35')]=_['intersection'](_0x7af83c['model'],qs['fields'](_0x3f68be[_0xa61b('0x33')][_0xa61b('0x36')]));_0x6fe579['attributes']=_0x6fe579[_0xa61b('0x35')][_0xa61b('0x37')]?_0x6fe579[_0xa61b('0x35')]:_0x7af83c[_0xa61b('0x32')];if(!_0x3f68be['query'][_0xa61b('0x38')](_0xa61b('0x39'))){_0x6fe579['limit']=qs[_0xa61b('0x1c')](_0x3f68be[_0xa61b('0x33')][_0xa61b('0x1c')]);_0x6fe579[_0xa61b('0x1b')]=qs['offset'](_0x3f68be[_0xa61b('0x33')][_0xa61b('0x1b')]);}_0x6fe579['order']=qs[_0xa61b('0x3a')](_0x3f68be['query']['sort']);_0x6fe579[_0xa61b('0x3b')]=qs[_0xa61b('0x3c')](_[_0xa61b('0x3d')](_0x3f68be[_0xa61b('0x33')],_0x7af83c[_0xa61b('0x3c')]),_0x1ab1f4);if(_0x3f68be['query']['filter']){_0x6fe579[_0xa61b('0x3b')]=_[_0xa61b('0x3e')](_0x6fe579[_0xa61b('0x3b')],{'$or':_['map'](_0x1ab1f4,function(_0x27d750){if(_0x27d750[_0xa61b('0x30')]!==_0xa61b('0x3f')){var _0x17b73c={};_0x17b73c[_0x27d750[_0xa61b('0x2b')]]={'$like':'%'+_0x3f68be[_0xa61b('0x33')][_0xa61b('0x40')]+'%'};return _0x17b73c;}})});}_0x6fe579=_[_0xa61b('0x3e')]({},_0x6fe579,_0x3f68be['options']);var _0xc8cafe={'where':_0x6fe579[_0xa61b('0x3b')]};return db['CmHopperAdditionalPhone'][_0xa61b('0x1e')](_0xc8cafe)[_0xa61b('0x25')](function(_0x5c16a3){_0x6c883e[_0xa61b('0x1e')]=_0x5c16a3;if(_0x3f68be[_0xa61b('0x33')][_0xa61b('0x41')]){_0x6fe579[_0xa61b('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0xa61b('0x43')](_0x6fe579);})[_0xa61b('0x25')](function(_0xd85089){_0x6c883e[_0xa61b('0x44')]=_0xd85089;return _0x6c883e;})[_0xa61b('0x25')](respondWithFilteredResult(_0x44ef0c,_0x6fe579))[_0xa61b('0x45')](handleError(_0x44ef0c,null));};exports[_0xa61b('0x46')]=function(_0x37685b,_0x16c1c4){var _0x83e332={'raw':!![],'where':{'id':_0x37685b[_0xa61b('0x47')]['id']}},_0x3a346b={};_0x3a346b[_0xa61b('0x32')]=_['keys'](db['CmHopperAdditionalPhone'][_0xa61b('0x48')]);_0x3a346b[_0xa61b('0x33')]=_[_0xa61b('0x34')](_0x37685b[_0xa61b('0x33')]);_0x3a346b[_0xa61b('0x3c')]=_[_0xa61b('0x49')](_0x3a346b[_0xa61b('0x32')],_0x3a346b[_0xa61b('0x33')]);_0x83e332[_0xa61b('0x35')]=_[_0xa61b('0x49')](_0x3a346b['model'],qs[_0xa61b('0x36')](_0x37685b[_0xa61b('0x33')]['fields']));_0x83e332[_0xa61b('0x35')]=_0x83e332['attributes'][_0xa61b('0x37')]?_0x83e332[_0xa61b('0x35')]:_0x3a346b[_0xa61b('0x32')];if(_0x37685b['query'][_0xa61b('0x41')]){_0x83e332[_0xa61b('0x42')]=[{'all':!![]}];}_0x83e332=_['merge']({},_0x83e332,_0x37685b[_0xa61b('0x4a')]);return db[_0xa61b('0x2e')][_0xa61b('0x4b')](_0x83e332)['then'](handleEntityNotFound(_0x16c1c4,null))[_0xa61b('0x25')](respondWithResult(_0x16c1c4,null))[_0xa61b('0x45')](handleError(_0x16c1c4,null));};exports[_0xa61b('0x4c')]=function(_0x4730bd,_0x324d1e){return db[_0xa61b('0x2e')][_0xa61b('0x4c')](_0x4730bd['body'],{})[_0xa61b('0x25')](function(_0x446c0f){var _0x249f7b=_0x4730bd['user']['get']({'plain':!![]});if(!_0x249f7b)throw new Error(_0xa61b('0x4d'));if(_0x249f7b[_0xa61b('0x4e')]===_0xa61b('0x4f')){var _0xeb531=_0x446c0f[_0xa61b('0x27')]({'plain':!![]});var _0xc0ab82=_0xa61b('0x50');return db['UserProfileSection'][_0xa61b('0x4b')]({'where':{'name':_0xc0ab82,'userProfileId':_0x249f7b[_0xa61b('0x51')]},'raw':!![]})[_0xa61b('0x25')](function(_0xf9cfde){if(_0xf9cfde&&_0xf9cfde[_0xa61b('0x52')]===0x0){return db[_0xa61b('0x28')]['create']({'name':_0xeb531[_0xa61b('0x2b')],'resourceId':_0xeb531['id'],'type':_0xf9cfde['name'],'sectionId':_0xf9cfde['id']},{})[_0xa61b('0x25')](function(){return _0x446c0f;});}else{return _0x446c0f;}})['catch'](function(_0x2e910f){logger[_0xa61b('0x29')](_0xa61b('0x53'),_0x2e910f);throw _0x2e910f;});}return _0x446c0f;})['then'](respondWithResult(_0x324d1e,0xc9))[_0xa61b('0x45')](handleError(_0x324d1e,null));};exports[_0xa61b('0x54')]=function(_0x3c4219,_0x5de146){if(_0x3c4219[_0xa61b('0x55')]['id']){delete _0x3c4219[_0xa61b('0x55')]['id'];}return db[_0xa61b('0x2e')][_0xa61b('0x4b')]({'where':{'id':_0x3c4219['params']['id']}})[_0xa61b('0x25')](handleEntityNotFound(_0x5de146,null))[_0xa61b('0x25')](saveUpdates(_0x3c4219['body'],null))[_0xa61b('0x25')](respondWithResult(_0x5de146,null))[_0xa61b('0x45')](handleError(_0x5de146,null));};exports[_0xa61b('0x26')]=function(_0x46efcb,_0x15c91a){return db[_0xa61b('0x2e')][_0xa61b('0x4b')]({'where':{'id':_0x46efcb[_0xa61b('0x47')]['id']}})[_0xa61b('0x25')](handleEntityNotFound(_0x15c91a,null))['then'](removeEntity(_0x15c91a,null))[_0xa61b('0x45')](handleError(_0x15c91a,null));}; \ No newline at end of file +var _0xb025=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','end','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0x1be48a,_0x3b1e4a){var _0x5a0742=function(_0x2730db){while(--_0x2730db){_0x1be48a['push'](_0x1be48a['shift']());}};_0x5a0742(++_0x3b1e4a);}(_0xb025,0xa6));var _0x5b02=function(_0x3dbafc,_0x585279){_0x3dbafc=_0x3dbafc-0x0;var _0x514496=_0xb025[_0x3dbafc];return _0x514496;};'use strict';var emlformat=require(_0x5b02('0x0'));var rimraf=require(_0x5b02('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5b02('0x2'));var moment=require(_0x5b02('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5b02('0x4'));var util=require(_0x5b02('0x5'));var path=require(_0x5b02('0x6'));var sox=require(_0x5b02('0x7'));var csv=require(_0x5b02('0x8'));var ejs=require(_0x5b02('0x9'));var fs=require('fs');var fs_extra=require(_0x5b02('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b02('0xb'));var deskjs=require(_0x5b02('0xc'));var toCsv=require(_0x5b02('0x8'));var querystring=require(_0x5b02('0xd'));var Papa=require(_0x5b02('0xe'));var Redis=require(_0x5b02('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5b02('0x10'));var as=require(_0x5b02('0x11'));var hardwareService=require(_0x5b02('0x12'));var logger=require('../../config/logger')(_0x5b02('0x13'));var utils=require(_0x5b02('0x14'));var config=require(_0x5b02('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44deb5,_0x59ed8e){_0x59ed8e=_0x59ed8e||0xcc;return function(_0x3d8eb6){if(_0x3d8eb6){return _0x44deb5[_0x5b02('0x16')](_0x59ed8e);}return _0x44deb5[_0x5b02('0x17')](_0x59ed8e)['end']();};}function respondWithResult(_0x2424c5,_0x557817){_0x557817=_0x557817||0xc8;return function(_0x1b72e3){if(_0x1b72e3){return _0x2424c5[_0x5b02('0x17')](_0x557817)[_0x5b02('0x18')](_0x1b72e3);}};}function respondWithFilteredResult(_0x55bc45,_0x59f285){return function(_0x2364ef){if(_0x2364ef){var _0x52f099=typeof _0x59f285[_0x5b02('0x19')]==='undefined'&&typeof _0x59f285[_0x5b02('0x1a')]===_0x5b02('0x1b');var _0x15e245=_0x2364ef[_0x5b02('0x1c')];var _0x3127b6=_0x52f099?0x0:_0x59f285[_0x5b02('0x19')];var _0x226682=_0x52f099?_0x2364ef[_0x5b02('0x1c')]:_0x59f285[_0x5b02('0x19')]+_0x59f285['limit'];var _0x348b41;if(_0x226682>=_0x15e245){_0x226682=_0x15e245;_0x348b41=0xc8;}else{_0x348b41=0xce;}_0x55bc45[_0x5b02('0x17')](_0x348b41);return _0x55bc45[_0x5b02('0x1d')]('Content-Range',_0x3127b6+'-'+_0x226682+'/'+_0x15e245)[_0x5b02('0x18')](_0x2364ef);}return null;};}function patchUpdates(_0xa91dfd){return function(_0x4ae9eb){try{jsonpatch['apply'](_0x4ae9eb,_0xa91dfd,!![]);}catch(_0x1d87f7){return BPromise[_0x5b02('0x1e')](_0x1d87f7);}return _0x4ae9eb[_0x5b02('0x1f')]();};}function saveUpdates(_0x2d4e39,_0x628440){return function(_0x350ca1){if(_0x350ca1){return _0x350ca1[_0x5b02('0x20')](_0x2d4e39)['then'](function(_0x498fc0){return _0x498fc0;});}return null;};}function removeEntity(_0x37f0bd,_0x4189d2){return function(_0x241f24){if(_0x241f24){return _0x241f24[_0x5b02('0x21')]()[_0x5b02('0x22')](function(){var _0x3af206=_0x241f24[_0x5b02('0x23')]({'plain':!![]});var _0x51220b=_0x5b02('0x24');return db['UserProfileResource'][_0x5b02('0x21')]({'where':{'type':_0x51220b,'resourceId':_0x3af206['id']}})['then'](function(){return _0x241f24;});})['then'](function(){_0x37f0bd[_0x5b02('0x17')](0xcc)[_0x5b02('0x25')]();});}};}function handleEntityNotFound(_0x56f66b,_0x4f39e3){return function(_0x22ee48){if(!_0x22ee48){_0x56f66b[_0x5b02('0x16')](0x194);}return _0x22ee48;};}function handleError(_0x6f7b4c,_0x502ec4){_0x502ec4=_0x502ec4||0x1f4;return function(_0xf01498){logger[_0x5b02('0x26')](_0xf01498[_0x5b02('0x27')]);if(_0xf01498[_0x5b02('0x28')]){delete _0xf01498['name'];}_0x6f7b4c['status'](_0x502ec4)[_0x5b02('0x29')](_0xf01498);};}exports[_0x5b02('0x2a')]=function(_0x492eac,_0xfbf523){var _0x4d4be7={},_0x532f62={},_0x107652={'count':0x0,'rows':[]};var _0x58db4a=_['map'](db[_0x5b02('0x2b')][_0x5b02('0x2c')],function(_0x4cc440){return{'name':_0x4cc440[_0x5b02('0x2d')],'type':_0x4cc440[_0x5b02('0x2e')][_0x5b02('0x2f')]};});_0x532f62[_0x5b02('0x30')]=_['map'](_0x58db4a,'name');_0x532f62[_0x5b02('0x31')]=_[_0x5b02('0x32')](_0x492eac[_0x5b02('0x31')]);_0x532f62['filters']=_[_0x5b02('0x33')](_0x532f62[_0x5b02('0x30')],_0x532f62[_0x5b02('0x31')]);_0x4d4be7[_0x5b02('0x34')]=_['intersection'](_0x532f62[_0x5b02('0x30')],qs[_0x5b02('0x35')](_0x492eac[_0x5b02('0x31')][_0x5b02('0x35')]));_0x4d4be7[_0x5b02('0x34')]=_0x4d4be7[_0x5b02('0x34')][_0x5b02('0x36')]?_0x4d4be7[_0x5b02('0x34')]:_0x532f62[_0x5b02('0x30')];if(!_0x492eac[_0x5b02('0x31')][_0x5b02('0x37')](_0x5b02('0x38'))){_0x4d4be7[_0x5b02('0x1a')]=qs[_0x5b02('0x1a')](_0x492eac['query'][_0x5b02('0x1a')]);_0x4d4be7[_0x5b02('0x19')]=qs[_0x5b02('0x19')](_0x492eac['query'][_0x5b02('0x19')]);}_0x4d4be7[_0x5b02('0x39')]=qs[_0x5b02('0x3a')](_0x492eac['query']['sort']);_0x4d4be7[_0x5b02('0x3b')]=qs[_0x5b02('0x3c')](_[_0x5b02('0x3d')](_0x492eac[_0x5b02('0x31')],_0x532f62[_0x5b02('0x3c')]),_0x58db4a);if(_0x492eac[_0x5b02('0x31')][_0x5b02('0x3e')]){_0x4d4be7[_0x5b02('0x3b')]=_['merge'](_0x4d4be7['where'],{'$or':_[_0x5b02('0x3f')](_0x58db4a,function(_0x9de74f){if(_0x9de74f[_0x5b02('0x2e')]!=='VIRTUAL'){var _0xb2226e={};_0xb2226e[_0x9de74f[_0x5b02('0x28')]]={'$like':'%'+_0x492eac[_0x5b02('0x31')]['filter']+'%'};return _0xb2226e;}})});}_0x4d4be7=_['merge']({},_0x4d4be7,_0x492eac[_0x5b02('0x40')]);var _0x39d545={'where':_0x4d4be7['where']};return db['CmHopperAdditionalPhone']['count'](_0x39d545)['then'](function(_0x197058){_0x107652['count']=_0x197058;if(_0x492eac[_0x5b02('0x31')]['includeAll']){_0x4d4be7[_0x5b02('0x41')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x5b02('0x42')](_0x4d4be7);})[_0x5b02('0x22')](function(_0x45cbc7){_0x107652[_0x5b02('0x43')]=_0x45cbc7;return _0x107652;})[_0x5b02('0x22')](respondWithFilteredResult(_0xfbf523,_0x4d4be7))[_0x5b02('0x44')](handleError(_0xfbf523,null));};exports[_0x5b02('0x45')]=function(_0x5113a0,_0x22d955){var _0x36a3be={'raw':!![],'where':{'id':_0x5113a0[_0x5b02('0x46')]['id']}},_0x41902f={};_0x41902f[_0x5b02('0x30')]=_['keys'](db['CmHopperAdditionalPhone'][_0x5b02('0x2c')]);_0x41902f[_0x5b02('0x31')]=_[_0x5b02('0x32')](_0x5113a0[_0x5b02('0x31')]);_0x41902f[_0x5b02('0x3c')]=_[_0x5b02('0x33')](_0x41902f[_0x5b02('0x30')],_0x41902f['query']);_0x36a3be[_0x5b02('0x34')]=_[_0x5b02('0x33')](_0x41902f[_0x5b02('0x30')],qs[_0x5b02('0x35')](_0x5113a0[_0x5b02('0x31')][_0x5b02('0x35')]));_0x36a3be[_0x5b02('0x34')]=_0x36a3be[_0x5b02('0x34')][_0x5b02('0x36')]?_0x36a3be['attributes']:_0x41902f[_0x5b02('0x30')];if(_0x5113a0['query'][_0x5b02('0x47')]){_0x36a3be[_0x5b02('0x41')]=[{'all':!![]}];}_0x36a3be=_[_0x5b02('0x48')]({},_0x36a3be,_0x5113a0[_0x5b02('0x40')]);return db[_0x5b02('0x2b')][_0x5b02('0x49')](_0x36a3be)[_0x5b02('0x22')](handleEntityNotFound(_0x22d955,null))['then'](respondWithResult(_0x22d955,null))[_0x5b02('0x44')](handleError(_0x22d955,null));};exports[_0x5b02('0x4a')]=function(_0x5043f2,_0x32d410){return db[_0x5b02('0x2b')][_0x5b02('0x4a')](_0x5043f2[_0x5b02('0x4b')],{})[_0x5b02('0x22')](function(_0x3e3f82){var _0x20032c=_0x5043f2['user'][_0x5b02('0x23')]({'plain':!![]});if(!_0x20032c)throw new Error(_0x5b02('0x4c'));if(_0x20032c[_0x5b02('0x4d')]===_0x5b02('0x4e')){var _0xf5ab94=_0x3e3f82[_0x5b02('0x23')]({'plain':!![]});var _0x561924='CmHopperAdditionalPhones';return db[_0x5b02('0x4f')]['find']({'where':{'name':_0x561924,'userProfileId':_0x20032c[_0x5b02('0x50')]},'raw':!![]})['then'](function(_0xd2bcf5){if(_0xd2bcf5&&_0xd2bcf5[_0x5b02('0x51')]===0x0){return db[_0x5b02('0x52')][_0x5b02('0x4a')]({'name':_0xf5ab94[_0x5b02('0x28')],'resourceId':_0xf5ab94['id'],'type':_0xd2bcf5[_0x5b02('0x28')],'sectionId':_0xd2bcf5['id']},{})['then'](function(){return _0x3e3f82;});}else{return _0x3e3f82;}})[_0x5b02('0x44')](function(_0x270ffe){logger[_0x5b02('0x26')](_0x5b02('0x53'),_0x270ffe);throw _0x270ffe;});}return _0x3e3f82;})[_0x5b02('0x22')](respondWithResult(_0x32d410,0xc9))[_0x5b02('0x44')](handleError(_0x32d410,null));};exports['update']=function(_0x3da9c7,_0x46ce14){if(_0x3da9c7['body']['id']){delete _0x3da9c7[_0x5b02('0x4b')]['id'];}return db[_0x5b02('0x2b')][_0x5b02('0x49')]({'where':{'id':_0x3da9c7[_0x5b02('0x46')]['id']}})[_0x5b02('0x22')](handleEntityNotFound(_0x46ce14,null))[_0x5b02('0x22')](saveUpdates(_0x3da9c7['body'],null))[_0x5b02('0x22')](respondWithResult(_0x46ce14,null))[_0x5b02('0x44')](handleError(_0x46ce14,null));};exports[_0x5b02('0x21')]=function(_0x586c36,_0x340ce2){return db[_0x5b02('0x2b')]['find']({'where':{'id':_0x586c36['params']['id']}})['then'](handleEntityNotFound(_0x340ce2,null))[_0x5b02('0x22')](removeEntity(_0x340ce2,null))['catch'](handleError(_0x340ce2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index fce4d62..f6de24e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x67ef=['CmHopperAdditionalPhone','cm_hopper_additional_phones','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x67ef,0x91));var _0xf67e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x67ef[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xf67e('0x0'));var logger=require('../../config/logger')(_0xf67e('0x1'));var moment=require(_0xf67e('0x2'));var BPromise=require(_0xf67e('0x3'));var rp=require(_0xf67e('0x4'));var fs=require('fs');var path=require(_0xf67e('0x5'));var rimraf=require(_0xf67e('0x6'));var config=require(_0xf67e('0x7'));var attributes=require(_0xf67e('0x8'));module['exports']=function(_0x23a99c,_0x4ed308){return _0x23a99c['define'](_0xf67e('0x9'),attributes,{'tableName':_0xf67e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44c5=['../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44c5,0x76));var _0x544c=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x44c5[_0x5db313];return _0x36d503;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var logger=require(_0x544c('0x2'))(_0x544c('0x3'));var moment=require('moment');var BPromise=require(_0x544c('0x4'));var rp=require(_0x544c('0x5'));var fs=require('fs');var path=require(_0x544c('0x6'));var rimraf=require(_0x544c('0x7'));var config=require(_0x544c('0x8'));var attributes=require(_0x544c('0x9'));module[_0x544c('0xa')]=function(_0xcfd37a,_0x45d35f){return _0xcfd37a[_0x544c('0xb')](_0x544c('0xc'),attributes,{'tableName':_0x544c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 6805911..3205044 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x804f=['code','message','request\x20sent','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countcongestionretry','countnoanswerretry','countabandonedretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','minutes','add','phone','countnosuchnumberretry','createdAt','updatedAt','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2bb197,_0x5bda99){var _0x152608=function(_0x42aa57){while(--_0x42aa57){_0x2bb197['push'](_0x2bb197['shift']());}};_0x152608(++_0x5bda99);}(_0x804f,0x150));var _0xf804=function(_0x245537,_0xea9b45){_0x245537=_0x245537-0x0;var _0x49b71f=_0x804f[_0x245537];return _0x49b71f;};'use strict';var _=require(_0xf804('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf804('0x1'));var rs=require(_0xf804('0x2'));var fs=require('fs');var Redis=require(_0xf804('0x3'));var db=require(_0xf804('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf804('0x5'))(_0xf804('0x6'));var config=require(_0xf804('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf804('0x8')][_0xf804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44a259,_0x1db71c,_0x157191){return new BPromise(function(_0x5b42b1,_0x4be03c){return client[_0xf804('0xa')](_0x44a259,_0x157191)[_0xf804('0xb')](function(_0x3290b2){logger[_0xf804('0xc')](_0xf804('0xd'),_0x1db71c,'request\x20sent');logger[_0xf804('0xe')](_0xf804('0xf'),_0x1db71c,'request\x20sent',JSON[_0xf804('0x10')](_0x3290b2));if(_0x3290b2[_0xf804('0x11')]){if(_0x3290b2['error'][_0xf804('0x12')]===0x1f4){logger['error'](_0xf804('0xd'),_0x1db71c,_0x3290b2[_0xf804('0x11')][_0xf804('0x13')]);return _0x4be03c(_0x3290b2[_0xf804('0x11')][_0xf804('0x13')]);}logger['error'](_0xf804('0xd'),_0x1db71c,_0x3290b2['error']['message']);return _0x5b42b1(_0x3290b2['error']['message']);}else{logger['info'](_0xf804('0xd'),_0x1db71c,_0xf804('0x14'));_0x5b42b1(_0x3290b2[_0xf804('0x15')][_0xf804('0x13')]);}})[_0xf804('0x16')](function(_0x432d00){logger[_0xf804('0x11')](_0xf804('0xd'),_0x1db71c,_0x432d00);_0x4be03c(_0x432d00);});});}exports[_0xf804('0x17')]=function(_0x14f3fb){var _0x3e9798=this;return new Promise(function(_0x303ed2,_0x31e1ec){return db[_0xf804('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x14f3fb[_0xf804('0x19')][_0xf804('0x1a')],'ListId':_0x14f3fb['body'][_0xf804('0x1b')],'VoiceQueueId':_0x14f3fb['body']['VoiceQueueId']===undefined?null:_0x14f3fb[_0xf804('0x19')][_0xf804('0x1c')],'CampaignId':_0x14f3fb[_0xf804('0x19')][_0xf804('0x1d')]===undefined?null:_0x14f3fb[_0xf804('0x19')]['CampaignId']}})[_0xf804('0xb')](function(_0x49462a){if(_0x49462a!=null){return db[_0xf804('0x1e')][_0xf804('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x49462a['id'],'OrderBy':{'$gt':_0x49462a[_0xf804('0x20')]}},'order':[[_0xf804('0x20'),_0xf804('0x21')]]})['then'](function(_0x5d3d3a){var _0x28cac4=0x0;if(_0x5d3d3a){if(_0x5d3d3a[_0xf804('0x22')]+_0x5d3d3a['countcongestionretry']+_0x5d3d3a['countnoanswerretry']+_0x5d3d3a['countnosuchnumberretry']+_0x5d3d3a[_0xf804('0x23')]+_0x5d3d3a['countabandonedretry']+_0x5d3d3a[_0xf804('0x24')]+_0x5d3d3a[_0xf804('0x25')]<_0x14f3fb[_0xf804('0x26')][_0xf804('0x27')])_0x28cac4=0x1;_0x303ed2({'additional':_0x28cac4});}else{return db[_0xf804('0x1e')][_0xf804('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x49462a['id']},'order':[[_0xf804('0x20'),_0xf804('0x21')]]})[_0xf804('0xb')](function(_0x45d181){var _0x54a00e=0x0;if(_0x45d181){if(_0x45d181[_0xf804('0x22')]+_0x45d181[_0xf804('0x28')]+_0x45d181[_0xf804('0x29')]+_0x45d181['countnosuchnumberretry']+_0x45d181[_0xf804('0x23')]+_0x45d181[_0xf804('0x2a')]+_0x45d181['countmachineretry']+_0x45d181[_0xf804('0x25')]<_0x14f3fb[_0xf804('0x26')][_0xf804('0x27')])_0x54a00e=0x1;_0x303ed2({'additional':_0x54a00e});}else{_0x303ed2({'additional':0x0});}})[_0xf804('0x16')](function(_0xdf6412){logger['error'](_0xf804('0x17'),_0xdf6412[_0xf804('0x13')]);_0x31e1ec(_0x3e9798['error'](0x1f4,_0xdf6412['message']));});}})[_0xf804('0x16')](function(_0x4e8121){logger[_0xf804('0x11')]('VerifyAdditionalPhones',_0x4e8121[_0xf804('0x13')]);_0x31e1ec(_0x3e9798[_0xf804('0x11')](0x1f4,_0x4e8121[_0xf804('0x13')]));});}else _0x303ed2({'additional':0x0});});});};exports[_0xf804('0x2b')]=function(_0x8cea4b){var _0x1d3ceb=this;return new Promise(function(_0x2279b6,_0x185715){return db['CmHopper'][_0xf804('0x1f')]({'raw':!![],'where':{'ContactId':_0x8cea4b[_0xf804('0x19')][_0xf804('0x1a')],'ListId':_0x8cea4b['body']['ListId'],'VoiceQueueId':_0x8cea4b['body'][_0xf804('0x1c')]===undefined?null:_0x8cea4b[_0xf804('0x19')][_0xf804('0x1c')],'CampaignId':_0x8cea4b[_0xf804('0x19')][_0xf804('0x1d')]===undefined?null:_0x8cea4b[_0xf804('0x19')][_0xf804('0x1d')]}})[_0xf804('0xb')](function(_0x49c4cb){if(_0x49c4cb!=null){return db[_0xf804('0x1e')][_0xf804('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x49c4cb['id'],'OrderBy':{'$gte':_0x49c4cb[_0xf804('0x20')]}},'order':[[_0xf804('0x20'),_0xf804('0x21')]]})['then'](function(_0x11b1b4){if(_0x11b1b4)return activateAdditionalPhone(_0x49c4cb,_0x8cea4b[_0xf804('0x19')],_0x11b1b4,_0x8cea4b[_0xf804('0x2c')],_0x8cea4b[_0xf804('0x2d')])[_0xf804('0xb')](function(_0x5caada){_0x2279b6(_0x5caada);});else{return db[_0xf804('0x1e')][_0xf804('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x49c4cb['id']},'order':[[_0xf804('0x20'),_0xf804('0x21')]]})['then'](function(_0x2739dd){if(_0x2739dd)return activateAdditionalPhone(_0x49c4cb,_0x8cea4b[_0xf804('0x19')],_0x2739dd,_0x8cea4b[_0xf804('0x2c')],_0x8cea4b[_0xf804('0x2d')])['then'](function(_0x875cf2){_0x2279b6(_0x875cf2);});else{_0x2279b6({'id':_0x49c4cb['id'],'phone':''});}})[_0xf804('0x16')](function(_0xb4b68a){logger['error'](_0xf804('0x17'),_0xb4b68a[_0xf804('0x13')]);_0x185715(_0x1d3ceb['error'](0x1f4,_0xb4b68a[_0xf804('0x13')]));});}})['catch'](function(_0x4eeb00){logger['error'](_0xf804('0x17'),_0x4eeb00[_0xf804('0x13')]);_0x185715(_0x1d3ceb[_0xf804('0x11')](0x1f4,_0x4eeb00['message']));});}else _0x2279b6(0x1);});});};function activateAdditionalPhone(_0x3fc7bd,_0x208117,_0x342355,_0x121072,_0x4fa43e){return new Promise(function(_0x5a0416,_0x1fc10a){var _0x171b62;if(_[_0xf804('0x2e')](_0x342355['scheduledat'])){_0x342355['scheduledat']=moment();}if(moment()>moment(_0x342355[_0xf804('0x2f')])){_0x171b62=moment()['add'](_0x4fa43e||0x3,_0xf804('0x30'));}else{if(_0x342355[_0xf804('0x20')]==0x0){_0x171b62=moment(_0x342355[_0xf804('0x2f')]);}else{_0x171b62=moment()[_0xf804('0x31')](_0x4fa43e||0x3,'minutes');}}if(_['isNil'](_0x171b62)){_0x171b62=moment()[_0xf804('0x31')](_0x4fa43e||0x3,_0xf804('0x30'));}var _0xdc4790={'phone':_0x3fc7bd[_0xf804('0x32')],'active':0x0,'OrderBy':_[_0xf804('0x2e')](_0x3fc7bd[_0xf804('0x20')])?0x0:_0x3fc7bd[_0xf804('0x20')],'scheduledat':moment()[_0xf804('0x31')](_0x121072||0x1,_0xf804('0x30')),'countbusyretry':_0x208117['countbusyretry'],'countcongestionretry':_0x208117[_0xf804('0x28')],'countnoanswerretry':_0x208117[_0xf804('0x29')],'countnosuchnumberretry':_0x208117[_0xf804('0x33')],'countdropretry':_0x208117[_0xf804('0x23')],'countabandonedretry':_0x208117[_0xf804('0x2a')],'countmachineretry':_0x208117[_0xf804('0x24')],'countagentrejectretry':_0x208117[_0xf804('0x25')],'createdAt':_0x208117['createdAt'],'updatedAt':_0x208117['updatedAt']};var _0x5035a9={'CmHopperId':_0x3fc7bd['id'],'phone':_0x342355[_0xf804('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x342355[_0xf804('0x20')])?0x0:_0x342355[_0xf804('0x20')],'scheduledat':_0x171b62,'countbusyretry':_0x342355['countbusyretry'],'countcongestionretry':_0x342355[_0xf804('0x28')],'countnoanswerretry':_0x342355['countnoanswerretry'],'countnosuchnumberretry':_0x342355[_0xf804('0x33')],'countdropretry':_0x342355[_0xf804('0x23')],'countabandonedretry':_0x342355['countabandonedretry'],'countmachineretry':_0x342355[_0xf804('0x24')],'countagentrejectretry':_0x342355['countagentrejectretry'],'createdAt':_0x342355[_0xf804('0x34')],'updatedAt':_0x342355[_0xf804('0x35')]};return db['sequelize'][_0xf804('0x36')](function(_0x1d3f1a){return db[_0xf804('0x1e')][_0xf804('0x37')](_0xdc4790,{'where':{'id':_0x342355['id']}},{'transaction':_0x1d3f1a})[_0xf804('0xb')](function(){return db[_0xf804('0x18')][_0xf804('0x37')](_0x5035a9,{'where':{'id':_0x3fc7bd['id']}},{'transaction':_0x1d3f1a});});})[_0xf804('0xb')](function(_0x2a93d7){_0x5a0416({'id':_0x3fc7bd['id'],'phone':_0x342355[_0xf804('0x32')]});})[_0xf804('0x16')](function(_0x22f026){logger['error'](_0xf804('0x38'),_0x22f026[_0xf804('0x13')]);_0x1fc10a({'error':_0x22f026[_0xf804('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0x21995f){var _0x4de3c4=this;return new Promise(function(_0x2dc1e0,_0xf15954){return db['CmHopper'][_0xf804('0x37')](_0x21995f[_0xf804('0x19')][_0xf804('0x39')],{'where':{'id':_0x21995f[_0xf804('0x19')]['id']}})[_0xf804('0xb')](function(_0x5312aa){_0x2dc1e0(_0x5312aa);})[_0xf804('0x16')](function(_0x52442d){logger[_0xf804('0x11')](_0xf804('0x3a'),_0x52442d['message']);_0xf15954(_0x4de3c4['error'](0x1f4,_0x52442d[_0xf804('0x13')]));});});}; \ No newline at end of file +var _0x1671=['jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','ContactId','body','VoiceQueueId','CampaignId','findOne','ASC','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','OrderBy','countbusyretry','countnosuchnumberretry','countdropretry','VerifyAdditionalPhones','SwapAdditionalPhones','CmHopper','ListId','CmHopperAdditionalPhone','duration','isNil','scheduledat','minutes','add','countagentrejectretry','updatedAt','transaction','update','phone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x31b9d4,_0x3756fe){var _0x303a09=function(_0x3921c3){while(--_0x3921c3){_0x31b9d4['push'](_0x31b9d4['shift']());}};_0x303a09(++_0x3756fe);}(_0x1671,0xda));var _0x1167=function(_0x298d14,_0x2e7f09){_0x298d14=_0x298d14-0x0;var _0x5e2bf8=_0x1671[_0x298d14];return _0x5e2bf8;};'use strict';var _=require(_0x1167('0x0'));var util=require(_0x1167('0x1'));var moment=require(_0x1167('0x2'));var BPromise=require(_0x1167('0x3'));var rs=require(_0x1167('0x4'));var fs=require('fs');var Redis=require(_0x1167('0x5'));var db=require(_0x1167('0x6'))['db'];var utils=require(_0x1167('0x7'));var logger=require(_0x1167('0x8'))('rpc');var config=require(_0x1167('0x9'));var jayson=require(_0x1167('0xa'));var client=jayson[_0x1167('0xb')][_0x1167('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddd30,_0x1cbca5,_0x367b60){return new BPromise(function(_0x48f044,_0x2da76e){return client[_0x1167('0xd')](_0x1ddd30,_0x367b60)[_0x1167('0xe')](function(_0x425385){logger[_0x1167('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1cbca5,_0x1167('0x10'));logger[_0x1167('0x11')](_0x1167('0x12'),_0x1cbca5,'request\x20sent',JSON['stringify'](_0x425385));if(_0x425385[_0x1167('0x13')]){if(_0x425385[_0x1167('0x13')][_0x1167('0x14')]===0x1f4){logger[_0x1167('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1cbca5,_0x425385[_0x1167('0x13')][_0x1167('0x15')]);return _0x2da76e(_0x425385[_0x1167('0x13')][_0x1167('0x15')]);}logger[_0x1167('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1cbca5,_0x425385['error']['message']);return _0x48f044(_0x425385[_0x1167('0x13')][_0x1167('0x15')]);}else{logger[_0x1167('0xf')](_0x1167('0x16'),_0x1cbca5,'request\x20sent');_0x48f044(_0x425385[_0x1167('0x17')][_0x1167('0x15')]);}})[_0x1167('0x18')](function(_0x5c297a){logger[_0x1167('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1cbca5,_0x5c297a);_0x2da76e(_0x5c297a);});});}exports['VerifyAdditionalPhones']=function(_0x393e19){var _0x22b98c=this;return new Promise(function(_0x1ddf1e,_0x31eab9){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x393e19['body'][_0x1167('0x19')],'ListId':_0x393e19['body']['ListId'],'VoiceQueueId':_0x393e19[_0x1167('0x1a')]['VoiceQueueId']===undefined?null:_0x393e19[_0x1167('0x1a')][_0x1167('0x1b')],'CampaignId':_0x393e19[_0x1167('0x1a')]['CampaignId']===undefined?null:_0x393e19['body'][_0x1167('0x1c')]}})[_0x1167('0xe')](function(_0x56da0f){if(_0x56da0f!=null){return db['CmHopperAdditionalPhone'][_0x1167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x56da0f['id'],'OrderBy':{'$gt':_0x56da0f['OrderBy']}},'order':[['OrderBy',_0x1167('0x1e')]]})[_0x1167('0xe')](function(_0x1dc9ad){var _0x4020c3=0x0;if(_0x1dc9ad){if(_0x1dc9ad['countbusyretry']+_0x1dc9ad[_0x1167('0x1f')]+_0x1dc9ad[_0x1167('0x20')]+_0x1dc9ad['countnosuchnumberretry']+_0x1dc9ad['countdropretry']+_0x1dc9ad[_0x1167('0x21')]+_0x1dc9ad[_0x1167('0x22')]+_0x1dc9ad['countagentrejectretry']<_0x393e19['entity'][_0x1167('0x23')])_0x4020c3=0x1;_0x1ddf1e({'additional':_0x4020c3});}else{return db['CmHopperAdditionalPhone'][_0x1167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x56da0f['id']},'order':[[_0x1167('0x24'),_0x1167('0x1e')]]})['then'](function(_0x1ef794){var _0x127ac4=0x0;if(_0x1ef794){if(_0x1ef794[_0x1167('0x25')]+_0x1ef794['countcongestionretry']+_0x1ef794[_0x1167('0x20')]+_0x1ef794[_0x1167('0x26')]+_0x1ef794[_0x1167('0x27')]+_0x1ef794[_0x1167('0x21')]+_0x1ef794['countmachineretry']+_0x1ef794['countagentrejectretry']<_0x393e19['entity'][_0x1167('0x23')])_0x127ac4=0x1;_0x1ddf1e({'additional':_0x127ac4});}else{_0x1ddf1e({'additional':0x0});}})[_0x1167('0x18')](function(_0x299464){logger['error'](_0x1167('0x28'),_0x299464[_0x1167('0x15')]);_0x31eab9(_0x22b98c[_0x1167('0x13')](0x1f4,_0x299464['message']));});}})[_0x1167('0x18')](function(_0xbd0e48){logger['error'](_0x1167('0x28'),_0xbd0e48[_0x1167('0x15')]);_0x31eab9(_0x22b98c[_0x1167('0x13')](0x1f4,_0xbd0e48[_0x1167('0x15')]));});}else _0x1ddf1e({'additional':0x0});});});};exports[_0x1167('0x29')]=function(_0x1381c8){var _0x4a53c=this;return new Promise(function(_0x1cd3c3,_0x1969a6){return db[_0x1167('0x2a')][_0x1167('0x1d')]({'raw':!![],'where':{'ContactId':_0x1381c8[_0x1167('0x1a')][_0x1167('0x19')],'ListId':_0x1381c8[_0x1167('0x1a')][_0x1167('0x2b')],'VoiceQueueId':_0x1381c8[_0x1167('0x1a')]['VoiceQueueId']===undefined?null:_0x1381c8['body']['VoiceQueueId'],'CampaignId':_0x1381c8[_0x1167('0x1a')]['CampaignId']===undefined?null:_0x1381c8[_0x1167('0x1a')][_0x1167('0x1c')]}})[_0x1167('0xe')](function(_0x3d87a5){if(_0x3d87a5!=null){return db[_0x1167('0x2c')][_0x1167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3d87a5['id'],'OrderBy':{'$gte':_0x3d87a5[_0x1167('0x24')]}},'order':[['OrderBy',_0x1167('0x1e')]]})['then'](function(_0x15c033){if(_0x15c033)return activateAdditionalPhone(_0x3d87a5,_0x1381c8[_0x1167('0x1a')],_0x15c033,_0x1381c8[_0x1167('0x2d')],_0x1381c8['waitTime'])[_0x1167('0xe')](function(_0x282587){_0x1cd3c3(_0x282587);});else{return db[_0x1167('0x2c')][_0x1167('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x3d87a5['id']},'order':[[_0x1167('0x24'),_0x1167('0x1e')]]})[_0x1167('0xe')](function(_0x42812e){if(_0x42812e)return activateAdditionalPhone(_0x3d87a5,_0x1381c8[_0x1167('0x1a')],_0x42812e,_0x1381c8[_0x1167('0x2d')],_0x1381c8['waitTime'])[_0x1167('0xe')](function(_0x12ce26){_0x1cd3c3(_0x12ce26);});else{_0x1cd3c3({'id':_0x3d87a5['id'],'phone':''});}})['catch'](function(_0x37181){logger[_0x1167('0x13')](_0x1167('0x28'),_0x37181[_0x1167('0x15')]);_0x1969a6(_0x4a53c[_0x1167('0x13')](0x1f4,_0x37181[_0x1167('0x15')]));});}})['catch'](function(_0x565683){logger[_0x1167('0x13')](_0x1167('0x28'),_0x565683[_0x1167('0x15')]);_0x1969a6(_0x4a53c['error'](0x1f4,_0x565683[_0x1167('0x15')]));});}else _0x1cd3c3(0x1);});});};function activateAdditionalPhone(_0x2d17d1,_0x44c4af,_0x404ab7,_0x33528a,_0x1badc7){return new Promise(function(_0x1f0a01,_0x460701){var _0x460070;if(_[_0x1167('0x2e')](_0x404ab7[_0x1167('0x2f')])){_0x404ab7[_0x1167('0x2f')]=moment();}if(moment()>moment(_0x404ab7[_0x1167('0x2f')])){_0x460070=moment()['add'](_0x1badc7||0x3,_0x1167('0x30'));}else{if(_0x404ab7['OrderBy']==0x0){_0x460070=moment(_0x404ab7[_0x1167('0x2f')]);}else{_0x460070=moment()[_0x1167('0x31')](_0x1badc7||0x3,_0x1167('0x30'));}}if(_[_0x1167('0x2e')](_0x460070)){_0x460070=moment()[_0x1167('0x31')](_0x1badc7||0x3,_0x1167('0x30'));}var _0x4e41e9={'phone':_0x2d17d1['phone'],'active':0x0,'OrderBy':_['isNil'](_0x2d17d1[_0x1167('0x24')])?0x0:_0x2d17d1[_0x1167('0x24')],'scheduledat':moment()[_0x1167('0x31')](_0x33528a||0x1,_0x1167('0x30')),'countbusyretry':_0x44c4af['countbusyretry'],'countcongestionretry':_0x44c4af['countcongestionretry'],'countnoanswerretry':_0x44c4af[_0x1167('0x20')],'countnosuchnumberretry':_0x44c4af[_0x1167('0x26')],'countdropretry':_0x44c4af[_0x1167('0x27')],'countabandonedretry':_0x44c4af[_0x1167('0x21')],'countmachineretry':_0x44c4af[_0x1167('0x22')],'countagentrejectretry':_0x44c4af[_0x1167('0x32')],'createdAt':_0x44c4af['createdAt'],'updatedAt':_0x44c4af['updatedAt']};var _0x8a3d3f={'CmHopperId':_0x2d17d1['id'],'phone':_0x404ab7['phone'],'active':0x0,'OrderBy':_['isNil'](_0x404ab7[_0x1167('0x24')])?0x0:_0x404ab7[_0x1167('0x24')],'scheduledat':_0x460070,'countbusyretry':_0x404ab7[_0x1167('0x25')],'countcongestionretry':_0x404ab7[_0x1167('0x1f')],'countnoanswerretry':_0x404ab7[_0x1167('0x20')],'countnosuchnumberretry':_0x404ab7[_0x1167('0x26')],'countdropretry':_0x404ab7[_0x1167('0x27')],'countabandonedretry':_0x404ab7[_0x1167('0x21')],'countmachineretry':_0x404ab7[_0x1167('0x22')],'countagentrejectretry':_0x404ab7['countagentrejectretry'],'createdAt':_0x404ab7['createdAt'],'updatedAt':_0x404ab7[_0x1167('0x33')]};return db['sequelize'][_0x1167('0x34')](function(_0x4976f0){return db[_0x1167('0x2c')][_0x1167('0x35')](_0x4e41e9,{'where':{'id':_0x404ab7['id']}},{'transaction':_0x4976f0})[_0x1167('0xe')](function(){return db[_0x1167('0x2a')][_0x1167('0x35')](_0x8a3d3f,{'where':{'id':_0x2d17d1['id']}},{'transaction':_0x4976f0});});})[_0x1167('0xe')](function(_0x545eea){_0x1f0a01({'id':_0x2d17d1['id'],'phone':_0x404ab7[_0x1167('0x36')]});})[_0x1167('0x18')](function(_0x51b5af){logger['error']('activateAdditionalPhone',_0x51b5af[_0x1167('0x15')]);_0x460701({'error':_0x51b5af[_0x1167('0x15')]});});});}exports['IncrementPreviewCounters']=function(_0x5c7948){var _0x5d3e7d=this;return new Promise(function(_0x2f348a,_0x58d032){return db[_0x1167('0x2a')][_0x1167('0x35')](_0x5c7948[_0x1167('0x1a')][_0x1167('0x37')],{'where':{'id':_0x5c7948[_0x1167('0x1a')]['id']}})[_0x1167('0xe')](function(_0x5a52e5){_0x2f348a(_0x5a52e5);})['catch'](function(_0x333fa0){logger['error'](_0x1167('0x38'),_0x333fa0[_0x1167('0x15')]);_0x58d032(_0x5d3e7d['error'](0x1f4,_0x333fa0[_0x1167('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 34b8b65..5dc9a22 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb74d=['create','delete','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb74d,0x16e));var _0xdb74=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0xb74d[_0x28e2cd];return _0x11fd46;};'use strict';var multer=require(_0xdb74('0x0'));var util=require('util');var path=require(_0xdb74('0x1'));var timeout=require('connect-timeout');var express=require(_0xdb74('0x2'));var router=express['Router']();var fs_extra=require(_0xdb74('0x3'));var auth=require(_0xdb74('0x4'));var interaction=require(_0xdb74('0x5'));var config=require('../../config/environment');var controller=require(_0xdb74('0x6'));router[_0xdb74('0x7')]('/',auth[_0xdb74('0x8')](),controller['index']);router['get'](_0xdb74('0x9'),auth['isAuthenticated'](),controller[_0xdb74('0xa')]);router[_0xdb74('0xb')]('/',auth['isAuthenticated'](),controller[_0xdb74('0xc')]);router['put'](_0xdb74('0x9'),auth[_0xdb74('0x8')](),controller['update']);router[_0xdb74('0xd')](_0xdb74('0x9'),auth[_0xdb74('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x36bd=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2854f3,_0x45d563){var _0x51c174=function(_0x1e861d){while(--_0x1e861d){_0x2854f3['push'](_0x2854f3['shift']());}};_0x51c174(++_0x45d563);}(_0x36bd,0x179));var _0xd36b=function(_0x1c2a51,_0x5bc68d){_0x1c2a51=_0x1c2a51-0x0;var _0x2032ec=_0x36bd[_0x1c2a51];return _0x2032ec;};'use strict';var multer=require(_0xd36b('0x0'));var util=require(_0xd36b('0x1'));var path=require('path');var timeout=require(_0xd36b('0x2'));var express=require(_0xd36b('0x3'));var router=express[_0xd36b('0x4')]();var fs_extra=require(_0xd36b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd36b('0x6'));var config=require('../../config/environment');var controller=require(_0xd36b('0x7'));router[_0xd36b('0x8')]('/',auth[_0xd36b('0x9')](),controller[_0xd36b('0xa')]);router[_0xd36b('0x8')](_0xd36b('0xb'),auth[_0xd36b('0x9')](),controller[_0xd36b('0xc')]);router[_0xd36b('0xd')]('/',auth[_0xd36b('0x9')](),controller['create']);router['put'](_0xd36b('0xb'),auth[_0xd36b('0x9')](),controller[_0xd36b('0xe')]);router[_0xd36b('0xf')](_0xd36b('0xb'),auth[_0xd36b('0x9')](),controller[_0xd36b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5b966b3..a096e8a 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 _0xb7d8=['moment','sequelize','STRING','INTEGER','contactListQueue'];(function(_0x1de17c,_0x725632){var _0x31af68=function(_0x50dce7){while(--_0x50dce7){_0x1de17c['push'](_0x1de17c['shift']());}};_0x31af68(++_0x725632);}(_0xb7d8,0x163));var _0x8b7d=function(_0x21823d,_0x53f03c){_0x21823d=_0x21823d-0x0;var _0x3fb7db=_0xb7d8[_0x21823d];return _0x3fb7db;};'use strict';var moment=require(_0x8b7d('0x0'));var Sequelize=require(_0x8b7d('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8b7d('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8b7d('0x3')],'unique':_0x8b7d('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x8b7d('0x4')}}; \ No newline at end of file +var _0xa992=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0x4f8b44,_0x5781b8){var _0x555d04=function(_0x5001ab){while(--_0x5001ab){_0x4f8b44['push'](_0x4f8b44['shift']());}};_0x555d04(++_0x5781b8);}(_0xa992,0x18c));var _0x2a99=function(_0x328c5d,_0x39a8a6){_0x328c5d=_0x328c5d-0x0;var _0x14a008=_0xa992[_0x328c5d];return _0x14a008;};'use strict';var moment=require(_0x2a99('0x0'));var Sequelize=require(_0x2a99('0x1'));module[_0x2a99('0x2')]={'phone':{'type':Sequelize[_0x2a99('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2a99('0x4')},'ListId':{'type':Sequelize[_0x2a99('0x5')],'unique':_0x2a99('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2a99('0x5')],'unique':_0x2a99('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 6172a3f..4eedad9 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 _0x1a05=['../../config/logger','api','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','then','error','name','send','index','map','CmHopperBlack','type','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','body','find','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4d3629,_0x2db92d){var _0x2bc81e=function(_0x58b849){while(--_0x58b849){_0x4d3629['push'](_0x4d3629['shift']());}};_0x2bc81e(++_0x2db92d);}(_0x1a05,0x153));var _0x51a0=function(_0x734491,_0x3ff62d){_0x734491=_0x734491-0x0;var _0x45c2ee=_0x1a05[_0x734491];return _0x45c2ee;};'use strict';var emlformat=require(_0x51a0('0x0'));var rimraf=require(_0x51a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51a0('0x2'));var rp=require(_0x51a0('0x3'));var moment=require(_0x51a0('0x4'));var BPromise=require(_0x51a0('0x5'));var Mustache=require(_0x51a0('0x6'));var util=require(_0x51a0('0x7'));var path=require(_0x51a0('0x8'));var sox=require(_0x51a0('0x9'));var csv=require(_0x51a0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a0('0xb'));var _=require(_0x51a0('0xc'));var squel=require(_0x51a0('0xd'));var crypto=require(_0x51a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51a0('0xf'));var toCsv=require(_0x51a0('0xa'));var querystring=require('querystring');var Papa=require(_0x51a0('0x10'));var Redis=require(_0x51a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51a0('0x12'));var as=require(_0x51a0('0x13'));var hardwareService=require(_0x51a0('0x14'));var logger=require(_0x51a0('0x15'))(_0x51a0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x51a0('0x17'))['db'];function respondWithStatusCode(_0x1c41cf,_0x2870d7){_0x2870d7=_0x2870d7||0xcc;return function(_0x37a682){if(_0x37a682){return _0x1c41cf[_0x51a0('0x18')](_0x2870d7);}return _0x1c41cf['status'](_0x2870d7)[_0x51a0('0x19')]();};}function respondWithResult(_0x522f78,_0x350c6b){_0x350c6b=_0x350c6b||0xc8;return function(_0x29e1ce){if(_0x29e1ce){return _0x522f78['status'](_0x350c6b)['json'](_0x29e1ce);}};}function respondWithFilteredResult(_0x3c1866,_0x29589e){return function(_0x5a6449){if(_0x5a6449){var _0x275e90=typeof _0x29589e['offset']===_0x51a0('0x1a')&&typeof _0x29589e[_0x51a0('0x1b')]===_0x51a0('0x1a');var _0x152553=_0x5a6449[_0x51a0('0x1c')];var _0x31a9e7=_0x275e90?0x0:_0x29589e[_0x51a0('0x1d')];var _0x356aa1=_0x275e90?_0x5a6449[_0x51a0('0x1c')]:_0x29589e[_0x51a0('0x1d')]+_0x29589e[_0x51a0('0x1b')];var _0x5e1bbe;if(_0x356aa1>=_0x152553){_0x356aa1=_0x152553;_0x5e1bbe=0xc8;}else{_0x5e1bbe=0xce;}_0x3c1866[_0x51a0('0x1e')](_0x5e1bbe);return _0x3c1866[_0x51a0('0x1f')](_0x51a0('0x20'),_0x31a9e7+'-'+_0x356aa1+'/'+_0x152553)[_0x51a0('0x21')](_0x5a6449);}return null;};}function patchUpdates(_0x5f06ae){return function(_0x4f2458){try{jsonpatch[_0x51a0('0x22')](_0x4f2458,_0x5f06ae,!![]);}catch(_0x545e20){return BPromise[_0x51a0('0x23')](_0x545e20);}return _0x4f2458['save']();};}function saveUpdates(_0x485e61,_0x2ffba4){return function(_0x5922c7){if(_0x5922c7){return _0x5922c7['update'](_0x485e61)[_0x51a0('0x24')](function(_0x4bd85e){return _0x4bd85e;});}return null;};}function removeEntity(_0x4af6ff,_0x616fbb){return function(_0x5f3c45){if(_0x5f3c45){return _0x5f3c45['destroy']()[_0x51a0('0x24')](function(){_0x4af6ff[_0x51a0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f6d52,_0xea4b5a){return function(_0x3ab282){if(!_0x3ab282){_0x3f6d52['sendStatus'](0x194);}return _0x3ab282;};}function handleError(_0x1e0d71,_0x3b61e1){_0x3b61e1=_0x3b61e1||0x1f4;return function(_0x22148b){logger[_0x51a0('0x25')](_0x22148b['stack']);if(_0x22148b[_0x51a0('0x26')]){delete _0x22148b[_0x51a0('0x26')];}_0x1e0d71[_0x51a0('0x1e')](_0x3b61e1)[_0x51a0('0x27')](_0x22148b);};}exports[_0x51a0('0x28')]=function(_0x1f4627,_0x211364){var _0x46c4f5={},_0x445136={},_0x41563e={'count':0x0,'rows':[]};var _0x5e850e=_[_0x51a0('0x29')](db[_0x51a0('0x2a')]['rawAttributes'],function(_0x357850){return{'name':_0x357850['fieldName'],'type':_0x357850[_0x51a0('0x2b')][_0x51a0('0x2c')]};});_0x445136['model']=_['map'](_0x5e850e,_0x51a0('0x26'));_0x445136[_0x51a0('0x2d')]=_['keys'](_0x1f4627['query']);_0x445136[_0x51a0('0x2e')]=_[_0x51a0('0x2f')](_0x445136['model'],_0x445136[_0x51a0('0x2d')]);_0x46c4f5[_0x51a0('0x30')]=_[_0x51a0('0x2f')](_0x445136['model'],qs['fields'](_0x1f4627['query'][_0x51a0('0x31')]));_0x46c4f5[_0x51a0('0x30')]=_0x46c4f5[_0x51a0('0x30')][_0x51a0('0x32')]?_0x46c4f5[_0x51a0('0x30')]:_0x445136[_0x51a0('0x33')];if(!_0x1f4627[_0x51a0('0x2d')][_0x51a0('0x34')]('nolimit')){_0x46c4f5[_0x51a0('0x1b')]=qs[_0x51a0('0x1b')](_0x1f4627[_0x51a0('0x2d')][_0x51a0('0x1b')]);_0x46c4f5['offset']=qs[_0x51a0('0x1d')](_0x1f4627['query'][_0x51a0('0x1d')]);}_0x46c4f5[_0x51a0('0x35')]=qs['sort'](_0x1f4627[_0x51a0('0x2d')][_0x51a0('0x36')]);_0x46c4f5[_0x51a0('0x37')]=qs[_0x51a0('0x2e')](_[_0x51a0('0x38')](_0x1f4627[_0x51a0('0x2d')],_0x445136[_0x51a0('0x2e')]),_0x5e850e);if(_0x1f4627[_0x51a0('0x2d')][_0x51a0('0x39')]){_0x46c4f5['where']=_[_0x51a0('0x3a')](_0x46c4f5['where'],{'$or':_['map'](_0x5e850e,function(_0x5b4411){if(_0x5b4411[_0x51a0('0x2b')]!=='VIRTUAL'){var _0x5bf65a={};_0x5bf65a[_0x5b4411[_0x51a0('0x26')]]={'$like':'%'+_0x1f4627[_0x51a0('0x2d')][_0x51a0('0x39')]+'%'};return _0x5bf65a;}})});}_0x46c4f5=_[_0x51a0('0x3a')]({},_0x46c4f5,_0x1f4627['options']);var _0x42ac16={'where':_0x46c4f5[_0x51a0('0x37')]};return db[_0x51a0('0x2a')][_0x51a0('0x1c')](_0x42ac16)[_0x51a0('0x24')](function(_0x406650){_0x41563e['count']=_0x406650;if(_0x1f4627['query'][_0x51a0('0x3b')]){_0x46c4f5[_0x51a0('0x3c')]=[{'all':!![]}];}return db[_0x51a0('0x2a')][_0x51a0('0x3d')](_0x46c4f5);})[_0x51a0('0x24')](function(_0x303844){_0x41563e[_0x51a0('0x3e')]=_0x303844;return _0x41563e;})[_0x51a0('0x24')](respondWithFilteredResult(_0x211364,_0x46c4f5))[_0x51a0('0x3f')](handleError(_0x211364,null));};exports[_0x51a0('0x40')]=function(_0x3c4e1c,_0x1cda2a){var _0x5ebfbe={'raw':!![],'where':{'id':_0x3c4e1c['params']['id']}},_0x251c5a={};_0x251c5a[_0x51a0('0x33')]=_[_0x51a0('0x41')](db[_0x51a0('0x2a')][_0x51a0('0x42')]);_0x251c5a[_0x51a0('0x2d')]=_[_0x51a0('0x41')](_0x3c4e1c[_0x51a0('0x2d')]);_0x251c5a['filters']=_[_0x51a0('0x2f')](_0x251c5a[_0x51a0('0x33')],_0x251c5a[_0x51a0('0x2d')]);_0x5ebfbe[_0x51a0('0x30')]=_[_0x51a0('0x2f')](_0x251c5a[_0x51a0('0x33')],qs[_0x51a0('0x31')](_0x3c4e1c[_0x51a0('0x2d')][_0x51a0('0x31')]));_0x5ebfbe[_0x51a0('0x30')]=_0x5ebfbe[_0x51a0('0x30')][_0x51a0('0x32')]?_0x5ebfbe[_0x51a0('0x30')]:_0x251c5a['model'];if(_0x3c4e1c[_0x51a0('0x2d')][_0x51a0('0x3b')]){_0x5ebfbe[_0x51a0('0x3c')]=[{'all':!![]}];}_0x5ebfbe=_[_0x51a0('0x3a')]({},_0x5ebfbe,_0x3c4e1c['options']);return db['CmHopperBlack']['find'](_0x5ebfbe)[_0x51a0('0x24')](handleEntityNotFound(_0x1cda2a,null))[_0x51a0('0x24')](respondWithResult(_0x1cda2a,null))['catch'](handleError(_0x1cda2a,null));};exports['update']=function(_0x4719ff,_0xa6bec4){if(_0x4719ff['body']['id']){delete _0x4719ff[_0x51a0('0x43')]['id'];}return db[_0x51a0('0x2a')][_0x51a0('0x44')]({'where':{'id':_0x4719ff[_0x51a0('0x45')]['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0xa6bec4,null))['then'](saveUpdates(_0x4719ff[_0x51a0('0x43')],null))[_0x51a0('0x24')](respondWithResult(_0xa6bec4,null))[_0x51a0('0x3f')](handleError(_0xa6bec4,null));};exports[_0x51a0('0x46')]=function(_0x2c07ad,_0x13bcbe){return db[_0x51a0('0x2a')][_0x51a0('0x44')]({'where':{'id':_0x2c07ad[_0x51a0('0x45')]['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x13bcbe,null))[_0x51a0('0x24')](removeEntity(_0x13bcbe,null))[_0x51a0('0x3f')](handleError(_0x13bcbe,null));};exports[_0x51a0('0x47')]=function(_0x14b5ff,_0xf2c3bc){return db[_0x51a0('0x2a')][_0x51a0('0x47')]()[_0x51a0('0x24')](respondWithResult(_0xf2c3bc,null))[_0x51a0('0x3f')](handleError(_0xf2c3bc,null));}; \ No newline at end of file +var _0x6061=['apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4d49c9,_0x47f3c5){var _0x5d6fd7=function(_0x2eab45){while(--_0x2eab45){_0x4d49c9['push'](_0x4d49c9['shift']());}};_0x5d6fd7(++_0x47f3c5);}(_0x6061,0x159));var _0x1606=function(_0x45864b,_0x37550b){_0x45864b=_0x45864b-0x0;var _0x4ba4f2=_0x6061[_0x45864b];return _0x4ba4f2;};'use strict';var emlformat=require(_0x1606('0x0'));var rimraf=require(_0x1606('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1606('0x2'));var rp=require('request-promise');var moment=require(_0x1606('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1606('0x4'));var util=require(_0x1606('0x5'));var path=require(_0x1606('0x6'));var sox=require(_0x1606('0x7'));var csv=require(_0x1606('0x8'));var ejs=require(_0x1606('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1606('0xa'));var squel=require(_0x1606('0xb'));var crypto=require(_0x1606('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1606('0x8'));var querystring=require(_0x1606('0xd'));var Papa=require(_0x1606('0xe'));var Redis=require(_0x1606('0xf'));var authService=require(_0x1606('0x10'));var qs=require(_0x1606('0x11'));var as=require(_0x1606('0x12'));var hardwareService=require(_0x1606('0x13'));var logger=require(_0x1606('0x14'))(_0x1606('0x15'));var utils=require(_0x1606('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1606('0x17'));var db=require(_0x1606('0x18'))['db'];function respondWithStatusCode(_0x4d2979,_0x553407){_0x553407=_0x553407||0xcc;return function(_0x4e702f){if(_0x4e702f){return _0x4d2979[_0x1606('0x19')](_0x553407);}return _0x4d2979[_0x1606('0x1a')](_0x553407)[_0x1606('0x1b')]();};}function respondWithResult(_0x2d23b4,_0x4b4edc){_0x4b4edc=_0x4b4edc||0xc8;return function(_0x21bed7){if(_0x21bed7){return _0x2d23b4['status'](_0x4b4edc)[_0x1606('0x1c')](_0x21bed7);}};}function respondWithFilteredResult(_0x17cc2c,_0x3b8d2c){return function(_0x5d5377){if(_0x5d5377){var _0x1861ce=typeof _0x3b8d2c[_0x1606('0x1d')]===_0x1606('0x1e')&&typeof _0x3b8d2c[_0x1606('0x1f')]===_0x1606('0x1e');var _0x5a81d0=_0x5d5377[_0x1606('0x20')];var _0x5edfa1=_0x1861ce?0x0:_0x3b8d2c['offset'];var _0x2a5b51=_0x1861ce?_0x5d5377[_0x1606('0x20')]:_0x3b8d2c[_0x1606('0x1d')]+_0x3b8d2c[_0x1606('0x1f')];var _0x3b0996;if(_0x2a5b51>=_0x5a81d0){_0x2a5b51=_0x5a81d0;_0x3b0996=0xc8;}else{_0x3b0996=0xce;}_0x17cc2c['status'](_0x3b0996);return _0x17cc2c[_0x1606('0x21')](_0x1606('0x22'),_0x5edfa1+'-'+_0x2a5b51+'/'+_0x5a81d0)['json'](_0x5d5377);}return null;};}function patchUpdates(_0x441039){return function(_0x315a2c){try{jsonpatch[_0x1606('0x23')](_0x315a2c,_0x441039,!![]);}catch(_0x5d63f9){return BPromise['reject'](_0x5d63f9);}return _0x315a2c[_0x1606('0x24')]();};}function saveUpdates(_0x552a8a,_0x2b7506){return function(_0x50d848){if(_0x50d848){return _0x50d848[_0x1606('0x25')](_0x552a8a)[_0x1606('0x26')](function(_0x542c60){return _0x542c60;});}return null;};}function removeEntity(_0xe57e2c,_0x4ebaca){return function(_0x4397b4){if(_0x4397b4){return _0x4397b4[_0x1606('0x27')]()[_0x1606('0x26')](function(){_0xe57e2c[_0x1606('0x1a')](0xcc)[_0x1606('0x1b')]();});}};}function handleEntityNotFound(_0x6187dd,_0x2d98b0){return function(_0x9347ea){if(!_0x9347ea){_0x6187dd[_0x1606('0x19')](0x194);}return _0x9347ea;};}function handleError(_0x426d8c,_0x43617b){_0x43617b=_0x43617b||0x1f4;return function(_0x2026e0){logger[_0x1606('0x28')](_0x2026e0[_0x1606('0x29')]);if(_0x2026e0['name']){delete _0x2026e0[_0x1606('0x2a')];}_0x426d8c[_0x1606('0x1a')](_0x43617b)[_0x1606('0x2b')](_0x2026e0);};}exports['index']=function(_0x459711,_0x13fe11){var _0x4a1ac0={},_0x146bfb={},_0x4f8575={'count':0x0,'rows':[]};var _0x3fc59c=_[_0x1606('0x2c')](db['CmHopperBlack'][_0x1606('0x2d')],function(_0x375673){return{'name':_0x375673[_0x1606('0x2e')],'type':_0x375673[_0x1606('0x2f')][_0x1606('0x30')]};});_0x146bfb[_0x1606('0x31')]=_[_0x1606('0x2c')](_0x3fc59c,_0x1606('0x2a'));_0x146bfb[_0x1606('0x32')]=_[_0x1606('0x33')](_0x459711['query']);_0x146bfb['filters']=_['intersection'](_0x146bfb[_0x1606('0x31')],_0x146bfb['query']);_0x4a1ac0[_0x1606('0x34')]=_['intersection'](_0x146bfb['model'],qs[_0x1606('0x35')](_0x459711[_0x1606('0x32')]['fields']));_0x4a1ac0[_0x1606('0x34')]=_0x4a1ac0[_0x1606('0x34')][_0x1606('0x36')]?_0x4a1ac0[_0x1606('0x34')]:_0x146bfb[_0x1606('0x31')];if(!_0x459711['query'][_0x1606('0x37')](_0x1606('0x38'))){_0x4a1ac0['limit']=qs[_0x1606('0x1f')](_0x459711[_0x1606('0x32')][_0x1606('0x1f')]);_0x4a1ac0[_0x1606('0x1d')]=qs[_0x1606('0x1d')](_0x459711[_0x1606('0x32')][_0x1606('0x1d')]);}_0x4a1ac0[_0x1606('0x39')]=qs['sort'](_0x459711['query']['sort']);_0x4a1ac0[_0x1606('0x3a')]=qs[_0x1606('0x3b')](_[_0x1606('0x3c')](_0x459711[_0x1606('0x32')],_0x146bfb[_0x1606('0x3b')]),_0x3fc59c);if(_0x459711[_0x1606('0x32')][_0x1606('0x3d')]){_0x4a1ac0[_0x1606('0x3a')]=_[_0x1606('0x3e')](_0x4a1ac0['where'],{'$or':_[_0x1606('0x2c')](_0x3fc59c,function(_0x367c22){if(_0x367c22[_0x1606('0x2f')]!==_0x1606('0x3f')){var _0x358d50={};_0x358d50[_0x367c22[_0x1606('0x2a')]]={'$like':'%'+_0x459711[_0x1606('0x32')][_0x1606('0x3d')]+'%'};return _0x358d50;}})});}_0x4a1ac0=_[_0x1606('0x3e')]({},_0x4a1ac0,_0x459711[_0x1606('0x40')]);var _0x362a80={'where':_0x4a1ac0[_0x1606('0x3a')]};return db[_0x1606('0x41')]['count'](_0x362a80)[_0x1606('0x26')](function(_0x96770d){_0x4f8575['count']=_0x96770d;if(_0x459711[_0x1606('0x32')][_0x1606('0x42')]){_0x4a1ac0[_0x1606('0x43')]=[{'all':!![]}];}return db[_0x1606('0x41')][_0x1606('0x44')](_0x4a1ac0);})['then'](function(_0x583dd7){_0x4f8575[_0x1606('0x45')]=_0x583dd7;return _0x4f8575;})[_0x1606('0x26')](respondWithFilteredResult(_0x13fe11,_0x4a1ac0))['catch'](handleError(_0x13fe11,null));};exports[_0x1606('0x46')]=function(_0x5e1522,_0x2e201e){var _0x1e37ec={'raw':!![],'where':{'id':_0x5e1522[_0x1606('0x47')]['id']}},_0x5f59f0={};_0x5f59f0[_0x1606('0x31')]=_[_0x1606('0x33')](db[_0x1606('0x41')][_0x1606('0x2d')]);_0x5f59f0['query']=_[_0x1606('0x33')](_0x5e1522[_0x1606('0x32')]);_0x5f59f0[_0x1606('0x3b')]=_['intersection'](_0x5f59f0[_0x1606('0x31')],_0x5f59f0[_0x1606('0x32')]);_0x1e37ec[_0x1606('0x34')]=_['intersection'](_0x5f59f0[_0x1606('0x31')],qs['fields'](_0x5e1522['query'][_0x1606('0x35')]));_0x1e37ec[_0x1606('0x34')]=_0x1e37ec[_0x1606('0x34')][_0x1606('0x36')]?_0x1e37ec[_0x1606('0x34')]:_0x5f59f0[_0x1606('0x31')];if(_0x5e1522['query']['includeAll']){_0x1e37ec[_0x1606('0x43')]=[{'all':!![]}];}_0x1e37ec=_[_0x1606('0x3e')]({},_0x1e37ec,_0x5e1522[_0x1606('0x40')]);return db['CmHopperBlack'][_0x1606('0x48')](_0x1e37ec)[_0x1606('0x26')](handleEntityNotFound(_0x2e201e,null))[_0x1606('0x26')](respondWithResult(_0x2e201e,null))[_0x1606('0x49')](handleError(_0x2e201e,null));};exports[_0x1606('0x25')]=function(_0x870c18,_0x924f3b){if(_0x870c18['body']['id']){delete _0x870c18['body']['id'];}return db[_0x1606('0x41')][_0x1606('0x48')]({'where':{'id':_0x870c18[_0x1606('0x47')]['id']}})[_0x1606('0x26')](handleEntityNotFound(_0x924f3b,null))[_0x1606('0x26')](saveUpdates(_0x870c18[_0x1606('0x4a')],null))[_0x1606('0x26')](respondWithResult(_0x924f3b,null))[_0x1606('0x49')](handleError(_0x924f3b,null));};exports[_0x1606('0x27')]=function(_0x19a88e,_0x10cd7d){return db[_0x1606('0x41')][_0x1606('0x48')]({'where':{'id':_0x19a88e[_0x1606('0x47')]['id']}})[_0x1606('0x26')](handleEntityNotFound(_0x10cd7d,null))['then'](removeEntity(_0x10cd7d,null))[_0x1606('0x49')](handleError(_0x10cd7d,null));};exports[_0x1606('0x4b')]=function(_0x3c8152,_0x3d40c9){return db[_0x1606('0x41')]['describe']()[_0x1606('0x26')](respondWithResult(_0x3d40c9,null))[_0x1606('0x49')](handleError(_0x3d40c9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 083a932..bdaf139 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 _0x9821=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x9821,0x1e0));var _0x1982=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9821[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1982('0x0'));var util=require(_0x1982('0x1'));var logger=require(_0x1982('0x2'))(_0x1982('0x3'));var moment=require(_0x1982('0x4'));var BPromise=require(_0x1982('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1982('0x6'));var rimraf=require(_0x1982('0x7'));var config=require(_0x1982('0x8'));var attributes=require(_0x1982('0x9'));module[_0x1982('0xa')]=function(_0x14d412,_0x1451c7){return _0x14d412[_0x1982('0xb')](_0x1982('0xc'),attributes,{'tableName':_0x1982('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x965e=['cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x5b0258,_0x2c2496){var _0x1fb28d=function(_0x29b46b){while(--_0x29b46b){_0x5b0258['push'](_0x5b0258['shift']());}};_0x1fb28d(++_0x2c2496);}(_0x965e,0x1eb));var _0xe965=function(_0x497141,_0x365823){_0x497141=_0x497141-0x0;var _0x281aa5=_0x965e[_0x497141];return _0x281aa5;};'use strict';var _=require('lodash');var util=require(_0xe965('0x0'));var logger=require(_0xe965('0x1'))(_0xe965('0x2'));var moment=require(_0xe965('0x3'));var BPromise=require(_0xe965('0x4'));var rp=require(_0xe965('0x5'));var fs=require('fs');var path=require(_0xe965('0x6'));var rimraf=require('rimraf');var config=require(_0xe965('0x7'));var attributes=require(_0xe965('0x8'));module['exports']=function(_0x1552bb,_0x27c9ea){return _0x1552bb['define']('CmHopperBlack',attributes,{'tableName':_0xe965('0x9'),'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 724ed11..05eeab3 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 _0x8395=['../../mysqldb','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','include','map','model','stringify','UpdateCmHopperBlack','update','catch','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis'];(function(_0x3dc320,_0x51a587){var _0x5d8f4f=function(_0x2cd123){while(--_0x2cd123){_0x3dc320['push'](_0x3dc320['shift']());}};_0x5d8f4f(++_0x51a587);}(_0x8395,0x11c));var _0x5839=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8395[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5839('0x0'));var util=require('util');var moment=require(_0x5839('0x1'));var BPromise=require('bluebird');var rs=require(_0x5839('0x2'));var fs=require('fs');var Redis=require(_0x5839('0x3'));var db=require(_0x5839('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5839('0x5'));var config=require(_0x5839('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5839('0x7')][_0x5839('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3005fb,_0x23e3af,_0x4ed8ff){return new BPromise(function(_0x3350af,_0x279c10){return client[_0x5839('0x9')](_0x3005fb,_0x4ed8ff)[_0x5839('0xa')](function(_0x8b8cf1){logger[_0x5839('0xb')](_0x5839('0xc'),_0x23e3af,'request\x20sent');logger[_0x5839('0xd')](_0x5839('0xe'),_0x23e3af,_0x5839('0xf'),JSON['stringify'](_0x8b8cf1));if(_0x8b8cf1[_0x5839('0x10')]){if(_0x8b8cf1[_0x5839('0x10')][_0x5839('0x11')]===0x1f4){logger['error'](_0x5839('0xc'),_0x23e3af,_0x8b8cf1['error'][_0x5839('0x12')]);return _0x279c10(_0x8b8cf1[_0x5839('0x10')]['message']);}logger['error'](_0x5839('0xc'),_0x23e3af,_0x8b8cf1[_0x5839('0x10')]['message']);return _0x3350af(_0x8b8cf1[_0x5839('0x10')][_0x5839('0x12')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x23e3af,_0x5839('0xf'));_0x3350af(_0x8b8cf1['result'][_0x5839('0x12')]);}})['catch'](function(_0x49a4cd){logger[_0x5839('0x10')](_0x5839('0xc'),_0x23e3af,_0x49a4cd);_0x279c10(_0x49a4cd);});});}exports[_0x5839('0x13')]=function(_0x1f4028){var _0x24a2ec=this;return new Promise(function(_0x120915,_0x4ba5d7){return db[_0x5839('0x14')][_0x5839('0x15')]({'raw':_0x1f4028['options']?_0x1f4028['options'][_0x5839('0x16')]===undefined?!![]:![]:!![],'where':_0x1f4028[_0x5839('0x17')]?_0x1f4028[_0x5839('0x17')][_0x5839('0x18')]||null:null,'attributes':_0x1f4028['options']?_0x1f4028[_0x5839('0x17')][_0x5839('0x19')]||null:null,'limit':_0x1f4028[_0x5839('0x17')]?_0x1f4028[_0x5839('0x17')][_0x5839('0x1a')]||null:null,'include':_0x1f4028[_0x5839('0x17')]?_0x1f4028[_0x5839('0x17')][_0x5839('0x1b')]?_[_0x5839('0x1c')](_0x1f4028[_0x5839('0x17')]['include'],function(_0x2cc7c1){return{'model':db[_0x2cc7c1[_0x5839('0x1d')]],'as':_0x2cc7c1['as'],'attributes':_0x2cc7c1['attributes'],'include':_0x2cc7c1[_0x5839('0x1b')]?_[_0x5839('0x1c')](_0x2cc7c1['include'],function(_0x53a865){return{'model':db[_0x53a865[_0x5839('0x1d')]],'as':_0x53a865['as'],'attributes':_0x53a865[_0x5839('0x19')],'include':_0x53a865[_0x5839('0x1b')]?_[_0x5839('0x1c')](_0x53a865['include'],function(_0x448b3d){return{'model':db[_0x448b3d[_0x5839('0x1d')]],'as':_0x448b3d['as'],'attributes':_0x448b3d[_0x5839('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5839('0xa')](function(_0x417bf9){logger[_0x5839('0xb')](_0x5839('0x13'),_0x1f4028);logger[_0x5839('0xd')]('GetCmHopperBlack',_0x1f4028,JSON[_0x5839('0x1e')](_0x417bf9));_0x120915(_0x417bf9);})['catch'](function(_0x7a54a1){logger[_0x5839('0x10')](_0x5839('0x13'),_0x7a54a1['message'],_0x1f4028);_0x4ba5d7(_0x24a2ec[_0x5839('0x10')](0x1f4,_0x7a54a1[_0x5839('0x12')]));});});};exports[_0x5839('0x1f')]=function(_0x3ac94a){var _0x37f4ee=this;return new Promise(function(_0x3da3fa,_0xf51a0d){return db[_0x5839('0x14')][_0x5839('0x20')](_0x3ac94a['body'],{'raw':_0x3ac94a['options']?_0x3ac94a[_0x5839('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ac94a['options']?_0x3ac94a['options'][_0x5839('0x18')]||null:null,'attributes':_0x3ac94a[_0x5839('0x17')]?_0x3ac94a[_0x5839('0x17')][_0x5839('0x19')]||null:null,'limit':_0x3ac94a[_0x5839('0x17')]?_0x3ac94a[_0x5839('0x17')]['limit']||null:null})[_0x5839('0xa')](function(_0x1e87e1){logger[_0x5839('0xb')](_0x5839('0x1f'),_0x3ac94a);logger['debug'](_0x5839('0x1f'),_0x3ac94a,JSON[_0x5839('0x1e')](_0x1e87e1));_0x3da3fa(_0x1e87e1);})[_0x5839('0x21')](function(_0x11791f){logger[_0x5839('0x10')]('UpdateCmHopperBlack',_0x11791f['message'],_0x3ac94a);_0xf51a0d(_0x37f4ee['error'](0x1f4,_0x11791f[_0x5839('0x12')]));});});};exports[_0x5839('0x22')]=function(_0x3d739){var _0x299d40=this;return new Promise(function(_0x151f28,_0x1056e5){return db[_0x5839('0x14')][_0x5839('0x23')]({'where':_0x3d739['options']?_0x3d739[_0x5839('0x17')][_0x5839('0x18')]||null:null})['then'](function(_0x4d19ed){logger[_0x5839('0xb')]('DestroyCmHopperBlack',_0x3d739);logger['debug'](_0x5839('0x22'),_0x3d739,JSON[_0x5839('0x1e')](_0x4d19ed));_0x151f28(_0x4d19ed);})[_0x5839('0x21')](function(_0x3454fe){logger[_0x5839('0x10')](_0x5839('0x22'),_0x3454fe[_0x5839('0x12')],_0x3d739);_0x1056e5(_0x299d40['error'](0x1f4,_0x3454fe['message']));});});}; \ No newline at end of file +var _0x30ea=['result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','map','include','model','debug','UpdateCmHopperBlack','CmHopperBlack','update','body','stringify','destroy','DestroyCmHopperBlack','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x30ea,0x1d7));var _0xa30e=function(_0x34857a,_0xdd718a){_0x34857a=_0x34857a-0x0;var _0x1e8551=_0x30ea[_0x34857a];return _0x1e8551;};'use strict';var _=require(_0xa30e('0x0'));var util=require('util');var moment=require(_0xa30e('0x1'));var BPromise=require('bluebird');var rs=require(_0xa30e('0x2'));var fs=require('fs');var Redis=require(_0xa30e('0x3'));var db=require(_0xa30e('0x4'))['db'];var utils=require(_0xa30e('0x5'));var logger=require(_0xa30e('0x6'))(_0xa30e('0x7'));var config=require(_0xa30e('0x8'));var jayson=require(_0xa30e('0x9'));var client=jayson[_0xa30e('0xa')][_0xa30e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa1111e,_0x5aef3d,_0x3108a1){return new BPromise(function(_0x4f947b,_0x2c74d4){return client[_0xa30e('0xc')](_0xa1111e,_0x3108a1)[_0xa30e('0xd')](function(_0x1b8670){logger[_0xa30e('0xe')](_0xa30e('0xf'),_0x5aef3d,_0xa30e('0x10'));logger['debug'](_0xa30e('0x11'),_0x5aef3d,_0xa30e('0x10'),JSON['stringify'](_0x1b8670));if(_0x1b8670[_0xa30e('0x12')]){if(_0x1b8670[_0xa30e('0x12')][_0xa30e('0x13')]===0x1f4){logger[_0xa30e('0x12')](_0xa30e('0xf'),_0x5aef3d,_0x1b8670['error'][_0xa30e('0x14')]);return _0x2c74d4(_0x1b8670[_0xa30e('0x12')]['message']);}logger[_0xa30e('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x5aef3d,_0x1b8670[_0xa30e('0x12')]['message']);return _0x4f947b(_0x1b8670[_0xa30e('0x12')][_0xa30e('0x14')]);}else{logger[_0xa30e('0xe')](_0xa30e('0xf'),_0x5aef3d,_0xa30e('0x10'));_0x4f947b(_0x1b8670[_0xa30e('0x15')][_0xa30e('0x14')]);}})[_0xa30e('0x16')](function(_0x22667f){logger['error'](_0xa30e('0xf'),_0x5aef3d,_0x22667f);_0x2c74d4(_0x22667f);});});}exports[_0xa30e('0x17')]=function(_0x4e78f6){var _0x480cf8=this;return new Promise(function(_0x18e306,_0x506e7e){return db['CmHopperBlack'][_0xa30e('0x18')]({'raw':_0x4e78f6[_0xa30e('0x19')]?_0x4e78f6[_0xa30e('0x19')][_0xa30e('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e78f6[_0xa30e('0x19')]?_0x4e78f6[_0xa30e('0x19')][_0xa30e('0x1b')]||null:null,'attributes':_0x4e78f6['options']?_0x4e78f6[_0xa30e('0x19')][_0xa30e('0x1c')]||null:null,'limit':_0x4e78f6[_0xa30e('0x19')]?_0x4e78f6['options'][_0xa30e('0x1d')]||null:null,'include':_0x4e78f6[_0xa30e('0x19')]?_0x4e78f6[_0xa30e('0x19')]['include']?_[_0xa30e('0x1e')](_0x4e78f6[_0xa30e('0x19')][_0xa30e('0x1f')],function(_0x44284d){return{'model':db[_0x44284d[_0xa30e('0x20')]],'as':_0x44284d['as'],'attributes':_0x44284d[_0xa30e('0x1c')],'include':_0x44284d[_0xa30e('0x1f')]?_['map'](_0x44284d[_0xa30e('0x1f')],function(_0x54d9c5){return{'model':db[_0x54d9c5[_0xa30e('0x20')]],'as':_0x54d9c5['as'],'attributes':_0x54d9c5[_0xa30e('0x1c')],'include':_0x54d9c5[_0xa30e('0x1f')]?_[_0xa30e('0x1e')](_0x54d9c5[_0xa30e('0x1f')],function(_0x4b9bc0){return{'model':db[_0x4b9bc0[_0xa30e('0x20')]],'as':_0x4b9bc0['as'],'attributes':_0x4b9bc0[_0xa30e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa30e('0xd')](function(_0x1aa384){logger['info'](_0xa30e('0x17'),_0x4e78f6);logger[_0xa30e('0x21')]('GetCmHopperBlack',_0x4e78f6,JSON['stringify'](_0x1aa384));_0x18e306(_0x1aa384);})[_0xa30e('0x16')](function(_0x4b2439){logger[_0xa30e('0x12')](_0xa30e('0x17'),_0x4b2439[_0xa30e('0x14')],_0x4e78f6);_0x506e7e(_0x480cf8[_0xa30e('0x12')](0x1f4,_0x4b2439[_0xa30e('0x14')]));});});};exports[_0xa30e('0x22')]=function(_0x2b9dc2){var _0x5083fe=this;return new Promise(function(_0x46d974,_0x2e8072){return db[_0xa30e('0x23')][_0xa30e('0x24')](_0x2b9dc2[_0xa30e('0x25')],{'raw':_0x2b9dc2[_0xa30e('0x19')]?_0x2b9dc2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b9dc2[_0xa30e('0x19')]?_0x2b9dc2[_0xa30e('0x19')]['where']||null:null,'attributes':_0x2b9dc2['options']?_0x2b9dc2['options']['attributes']||null:null,'limit':_0x2b9dc2['options']?_0x2b9dc2[_0xa30e('0x19')][_0xa30e('0x1d')]||null:null})[_0xa30e('0xd')](function(_0x1f3ea0){logger[_0xa30e('0xe')](_0xa30e('0x22'),_0x2b9dc2);logger[_0xa30e('0x21')](_0xa30e('0x22'),_0x2b9dc2,JSON[_0xa30e('0x26')](_0x1f3ea0));_0x46d974(_0x1f3ea0);})[_0xa30e('0x16')](function(_0x20d009){logger[_0xa30e('0x12')](_0xa30e('0x22'),_0x20d009[_0xa30e('0x14')],_0x2b9dc2);_0x2e8072(_0x5083fe['error'](0x1f4,_0x20d009[_0xa30e('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x17301c){var _0x296fbf=this;return new Promise(function(_0x2d668c,_0x3b8e1f){return db['CmHopperBlack'][_0xa30e('0x27')]({'where':_0x17301c['options']?_0x17301c[_0xa30e('0x19')][_0xa30e('0x1b')]||null:null})[_0xa30e('0xd')](function(_0x2e4188){logger[_0xa30e('0xe')](_0xa30e('0x28'),_0x17301c);logger[_0xa30e('0x21')](_0xa30e('0x28'),_0x17301c,JSON[_0xa30e('0x26')](_0x2e4188));_0x2d668c(_0x2e4188);})[_0xa30e('0x16')](function(_0x15bb1e){logger[_0xa30e('0x12')](_0xa30e('0x28'),_0x15bb1e[_0xa30e('0x14')],_0x17301c);_0x3b8e1f(_0x296fbf[_0xa30e('0x12')](0x1f4,_0x15bb1e[_0xa30e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a2690e1..80bfc6d 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 _0xc1c6=['../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x2bae67,_0x1077b2){var _0x5f29ed=function(_0xa01841){while(--_0xa01841){_0x2bae67['push'](_0x2bae67['shift']());}};_0x5f29ed(++_0x1077b2);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x502cde,_0x1b267d){_0x502cde=_0x502cde-0x0;var _0xcc38f9=_0xc1c6[_0x502cde];return _0xcc38f9;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['put'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0xf')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x10')]);module[_0x6c1c('0x11')]=router; \ No newline at end of file +var _0x33af=['isAuthenticated','describe','show','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','get','index','/describe'];(function(_0x416a7f,_0xe41175){var _0x11cfaa=function(_0x4dce3a){while(--_0x4dce3a){_0x416a7f['push'](_0x416a7f['shift']());}};_0x11cfaa(++_0xe41175);}(_0x33af,0xec));var _0xf33a=function(_0x1bb0b8,_0x24add2){_0x1bb0b8=_0x1bb0b8-0x0;var _0x22fc67=_0x33af[_0x1bb0b8];return _0x22fc67;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')](_0xf33a('0xf'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router['delete']('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0x11')]);module[_0xf33a('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index f9b2607..8b95670 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 _0x56ca=['diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime'];(function(_0x1e4fee,_0x1f3ac0){var _0x273e09=function(_0x18ec06){while(--_0x18ec06){_0x1e4fee['push'](_0x1e4fee['shift']());}};_0x273e09(++_0x1f3ac0);}(_0x56ca,0x7b));var _0xa56c=function(_0x34d482,_0x1b0493){_0x34d482=_0x34d482-0x0;var _0x400b97=_0x56ca[_0x34d482];return _0x400b97;};'use strict';var Sequelize=require(_0xa56c('0x0'));var moment=require(_0xa56c('0x1'));module[_0xa56c('0x2')]={'state':{'type':Sequelize[_0xa56c('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xa56c('0x4')]},'scheduledat':{'type':Sequelize[_0xa56c('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa56c('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xa56c('0x4')]},'originatecalleridname':{'type':Sequelize[_0xa56c('0x4')]},'calleridnum':{'type':Sequelize[_0xa56c('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xa56c('0x5')]},'responsetime':{'type':Sequelize[_0xa56c('0x5')]},'answertime':{'type':Sequelize[_0xa56c('0x5')]},'droptime':{'type':Sequelize[_0xa56c('0x5')]},'endtime':{'type':Sequelize[_0xa56c('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa56c('0x4')]},'campaign':{'type':Sequelize[_0xa56c('0x4')]},'campaigntype':{'type':Sequelize[_0xa56c('0x4')]},'membername':{'type':Sequelize[_0xa56c('0x4')]},'reason':{'type':Sequelize[_0xa56c('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa56c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa56c('0x4')]},'dispositionat':{'type':Sequelize[_0xa56c('0x5')],'set':function(_0x19856f){var _0x568be4=this[_0xa56c('0x6')]('endtime');if(_0x568be4&&_0x19856f){this[_0xa56c('0x7')](_0xa56c('0x8'),moment(_0x19856f)[_0xa56c('0x9')](moment(_0x568be4),_0xa56c('0xa')));}}},'amd':{'type':Sequelize[_0xa56c('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa56c('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xa56c('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xa56c('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa56c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa56c('0x5')]},'deleted':{'type':Sequelize[_0xa56c('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa56c('0x5')]},'recallme':{'type':Sequelize[_0xa56c('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa56c('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa56c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb7b=['followuptime','diff','seconds','BOOLEAN','sequelize','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xbb7b,0xc4));var _0xbbb7=function(_0x439c83,_0x5c8380){_0x439c83=_0x439c83-0x0;var _0x330d66=_0xbb7b[_0x439c83];return _0x330d66;};'use strict';var Sequelize=require(_0xbbb7('0x0'));var moment=require('moment');module[_0xbbb7('0x1')]={'state':{'type':Sequelize[_0xbbb7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbbb7('0x3')]},'scheduledat':{'type':Sequelize[_0xbbb7('0x4')]},'countbusyretry':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbbb7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbbb7('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbbb7('0x3')]},'starttime':{'type':Sequelize[_0xbbb7('0x4')]},'responsetime':{'type':Sequelize[_0xbbb7('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbbb7('0x3')]},'campaign':{'type':Sequelize[_0xbbb7('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xbbb7('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xbbb7('0x3')]},'secondDisposition':{'type':Sequelize[_0xbbb7('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbbb7('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3db67a){var _0x47ca7e=this[_0xbbb7('0x5')](_0xbbb7('0x6'));if(_0x47ca7e&&_0x3db67a){this[_0xbbb7('0x7')](_0xbbb7('0x8'),moment(_0x3db67a)[_0xbbb7('0x9')](moment(_0x47ca7e),_0xbbb7('0xa')));}}},'amd':{'type':Sequelize[_0xbbb7('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbbb7('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbbb7('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbbb7('0x4')]},'deleted':{'type':Sequelize[_0xbbb7('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xbbb7('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbbb7('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbbb7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbbb7('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 cc80ccf..ead49a2 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x16d765,_0x58471f){var _0x38ce01=function(_0x360318){while(--_0x360318){_0x16d765['push'](_0x16d765['shift']());}};_0x38ce01(++_0x58471f);}(_0x2a07,0x74));var _0x72a0=function(_0x78c442,_0x1d9dad){_0x78c442=_0x78c442-0x0;var _0x345210=_0x2a07[_0x78c442];return _0x345210;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file +var _0x7880=['index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','where','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x247994,_0x502fa8){var _0x33f211=function(_0x231a0e){while(--_0x231a0e){_0x247994['push'](_0x247994['shift']());}};_0x33f211(++_0x502fa8);}(_0x7880,0x1f4));var _0x0788=function(_0x1268f4,_0x147117){_0x1268f4=_0x1268f4-0x0;var _0x2f1b05=_0x7880[_0x1268f4];return _0x2f1b05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];function respondWithStatusCode(_0x311729,_0xce4342){_0xce4342=_0xce4342||0xcc;return function(_0x261ebc){if(_0x261ebc){return _0x311729['sendStatus'](_0xce4342);}return _0x311729[_0x0788('0x1a')](_0xce4342)[_0x0788('0x1b')]();};}function respondWithResult(_0x3bdcdf,_0x13cf07){_0x13cf07=_0x13cf07||0xc8;return function(_0x51e5d3){if(_0x51e5d3){return _0x3bdcdf[_0x0788('0x1a')](_0x13cf07)['json'](_0x51e5d3);}};}function respondWithFilteredResult(_0x195f14,_0x170d56){return function(_0x3fd1e4){if(_0x3fd1e4){var _0xb406fb=typeof _0x170d56[_0x0788('0x1c')]===_0x0788('0x1d')&&typeof _0x170d56['limit']==='undefined';var _0x17d805=_0x3fd1e4[_0x0788('0x1e')];var _0x5b2bdc=_0xb406fb?0x0:_0x170d56[_0x0788('0x1c')];var _0x415f19=_0xb406fb?_0x3fd1e4[_0x0788('0x1e')]:_0x170d56['offset']+_0x170d56[_0x0788('0x1f')];var _0x3fb723;if(_0x415f19>=_0x17d805){_0x415f19=_0x17d805;_0x3fb723=0xc8;}else{_0x3fb723=0xce;}_0x195f14['status'](_0x3fb723);return _0x195f14[_0x0788('0x20')]('Content-Range',_0x5b2bdc+'-'+_0x415f19+'/'+_0x17d805)[_0x0788('0x21')](_0x3fd1e4);}return null;};}function patchUpdates(_0x48bc5f){return function(_0x17cca3){try{jsonpatch[_0x0788('0x22')](_0x17cca3,_0x48bc5f,!![]);}catch(_0x18ff22){return BPromise[_0x0788('0x23')](_0x18ff22);}return _0x17cca3[_0x0788('0x24')]();};}function saveUpdates(_0x4f0005,_0x48ec43){return function(_0x2270d4){if(_0x2270d4){return _0x2270d4[_0x0788('0x25')](_0x4f0005)[_0x0788('0x26')](function(_0x7a99a1){return _0x7a99a1;});}return null;};}function removeEntity(_0x5ba1da,_0x4d5c93){return function(_0x79204e){if(_0x79204e){return _0x79204e[_0x0788('0x27')]()[_0x0788('0x26')](function(){_0x5ba1da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x240459,_0xa1f7dc){return function(_0x5f2dda){if(!_0x5f2dda){_0x240459['sendStatus'](0x194);}return _0x5f2dda;};}function handleError(_0x5a54a5,_0x44798c){_0x44798c=_0x44798c||0x1f4;return function(_0x57fda1){logger[_0x0788('0x28')](_0x57fda1[_0x0788('0x29')]);if(_0x57fda1[_0x0788('0x2a')]){delete _0x57fda1[_0x0788('0x2a')];}_0x5a54a5[_0x0788('0x1a')](_0x44798c)[_0x0788('0x2b')](_0x57fda1);};}exports[_0x0788('0x2c')]=function(_0x3ffe4f,_0x5b7594){var _0x5a5178={},_0x3c5246={},_0x40d345={'count':0x0,'rows':[]};var _0x54979a=_['map'](db[_0x0788('0x2d')][_0x0788('0x2e')],function(_0x20fcd8){return{'name':_0x20fcd8[_0x0788('0x2f')],'type':_0x20fcd8[_0x0788('0x30')][_0x0788('0x31')]};});_0x3c5246[_0x0788('0x32')]=_[_0x0788('0x33')](_0x54979a,_0x0788('0x2a'));_0x3c5246[_0x0788('0x34')]=_['keys'](_0x3ffe4f[_0x0788('0x34')]);_0x3c5246[_0x0788('0x35')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],_0x3c5246[_0x0788('0x34')]);_0x5a5178[_0x0788('0x37')]=_[_0x0788('0x36')](_0x3c5246[_0x0788('0x32')],qs[_0x0788('0x38')](_0x3ffe4f[_0x0788('0x34')]['fields']));_0x5a5178['attributes']=_0x5a5178['attributes']['length']?_0x5a5178['attributes']:_0x3c5246['model'];if(!_0x3ffe4f[_0x0788('0x34')][_0x0788('0x39')](_0x0788('0x3a'))){_0x5a5178['limit']=qs[_0x0788('0x1f')](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x1f')]);_0x5a5178[_0x0788('0x1c')]=qs['offset'](_0x3ffe4f[_0x0788('0x34')]['offset']);}_0x5a5178[_0x0788('0x3b')]=qs['sort'](_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3c')]);_0x5a5178['where']=qs[_0x0788('0x35')](_[_0x0788('0x3d')](_0x3ffe4f['query'],_0x3c5246[_0x0788('0x35')]),_0x54979a);if(_0x3ffe4f['query'][_0x0788('0x3e')]){_0x5a5178['where']=_[_0x0788('0x3f')](_0x5a5178['where'],{'$or':_[_0x0788('0x33')](_0x54979a,function(_0x57fec9){if(_0x57fec9['type']!==_0x0788('0x40')){var _0x68d9d4={};_0x68d9d4[_0x57fec9[_0x0788('0x2a')]]={'$like':'%'+_0x3ffe4f[_0x0788('0x34')][_0x0788('0x3e')]+'%'};return _0x68d9d4;}})});}_0x5a5178=_['merge']({},_0x5a5178,_0x3ffe4f['options']);var _0x530d83={'where':_0x5a5178['where']};return db[_0x0788('0x2d')][_0x0788('0x1e')](_0x530d83)[_0x0788('0x26')](function(_0x358a22){_0x40d345[_0x0788('0x1e')]=_0x358a22;if(_0x3ffe4f['query']['includeAll']){_0x5a5178[_0x0788('0x41')]=[{'all':!![]}];}return db[_0x0788('0x2d')][_0x0788('0x42')](_0x5a5178);})[_0x0788('0x26')](function(_0x236b63){_0x40d345[_0x0788('0x43')]=_0x236b63;return _0x40d345;})[_0x0788('0x26')](respondWithFilteredResult(_0x5b7594,_0x5a5178))[_0x0788('0x44')](handleError(_0x5b7594,null));};exports[_0x0788('0x45')]=function(_0x50e8f5,_0x5581e6){var _0x441aec={'raw':!![],'where':{'id':_0x50e8f5[_0x0788('0x46')]['id']}},_0x1d579d={};_0x1d579d['model']=_['keys'](db['CmHopperFinal'][_0x0788('0x2e')]);_0x1d579d[_0x0788('0x34')]=_[_0x0788('0x47')](_0x50e8f5[_0x0788('0x34')]);_0x1d579d[_0x0788('0x35')]=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],_0x1d579d[_0x0788('0x34')]);_0x441aec['attributes']=_[_0x0788('0x36')](_0x1d579d[_0x0788('0x32')],qs[_0x0788('0x38')](_0x50e8f5[_0x0788('0x34')]['fields']));_0x441aec[_0x0788('0x37')]=_0x441aec[_0x0788('0x37')]['length']?_0x441aec['attributes']:_0x1d579d['model'];if(_0x50e8f5[_0x0788('0x34')]['includeAll']){_0x441aec[_0x0788('0x41')]=[{'all':!![]}];}_0x441aec=_[_0x0788('0x3f')]({},_0x441aec,_0x50e8f5[_0x0788('0x48')]);return db[_0x0788('0x2d')][_0x0788('0x49')](_0x441aec)[_0x0788('0x26')](handleEntityNotFound(_0x5581e6,null))[_0x0788('0x26')](respondWithResult(_0x5581e6,null))[_0x0788('0x44')](handleError(_0x5581e6,null));};exports['describe']=function(_0x4c6366,_0x39c3cc){return db[_0x0788('0x2d')][_0x0788('0x4a')]()['then'](respondWithResult(_0x39c3cc,null))[_0x0788('0x44')](handleError(_0x39c3cc,null));};exports[_0x0788('0x25')]=function(_0x19aad6,_0x4563cd){if(_0x19aad6[_0x0788('0x4b')]['uniqueid']){delete _0x19aad6['body'][_0x0788('0x4c')];}return db[_0x0788('0x2d')]['find']({'where':{'uniqueid':_0x19aad6[_0x0788('0x46')]['id']}})['then'](handleEntityNotFound(_0x4563cd,null))[_0x0788('0x26')](saveUpdates(_0x19aad6[_0x0788('0x4b')],null))[_0x0788('0x26')](respondWithResult(_0x4563cd,null))[_0x0788('0x44')](handleError(_0x4563cd,null));};exports[_0x0788('0x4d')]=function(_0x379928,_0x1722d4,_0x25ac3c){return db['CmHopperFinal'][_0x0788('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x379928[_0x0788('0x46')]['id']},'attributes':[[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x4f')))),_0x0788('0x50')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),_0x0788('0x57')],[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x58')))),_0x0788('0x59')],[db['sequelize']['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5a')))),_0x0788('0x5b')],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5c')))),_0x0788('0x5d')]]})[_0x0788('0x26')](handleEntityNotFound(_0x1722d4,null))[_0x0788('0x26')](respondWithResult(_0x1722d4,null))[_0x0788('0x44')](handleError(_0x1722d4,null));};exports[_0x0788('0x5e')]=function(_0x2a8b14,_0x59fcbc,_0xe1a934){return db[_0x0788('0x2d')][_0x0788('0x42')]({'raw':![],'where':{'CampaignId':_0x2a8b14[_0x0788('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x4f')))),'noSuchContacts'],[db[_0x0788('0x4e')]['fn']('COUNT',db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x5f')))),_0x0788('0x52')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal'](_0x0788('0x54')))),_0x0788('0x55')],[db[_0x0788('0x4e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x56')))),'congestionContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize']['literal'](_0x0788('0x5a')))),'abandonedContacts'],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db[_0x0788('0x4e')][_0x0788('0x53')](_0x0788('0x60')))),_0x0788('0x61')],[db[_0x0788('0x4e')]['fn'](_0x0788('0x51'),db[_0x0788('0x4e')]['fn']('IF',db['sequelize'][_0x0788('0x53')](_0x0788('0x5c')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x59fcbc,null))[_0x0788('0x26')](respondWithResult(_0x59fcbc,null))[_0x0788('0x44')](handleError(_0x59fcbc,null));};exports[_0x0788('0x62')]=function(_0x219252,_0x3628d6,_0x192798){return db['VoiceQueue'][_0x0788('0x49')]({'where':{'id':_0x219252[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x3628d6,null))[_0x0788('0x26')](function(_0x4e0282){var _0x35c612;if(_0x4e0282){_0x35c612=squel[_0x0788('0x63')]()[_0x0788('0x64')](_0x0788('0x65'))['fromQuery'](['phone',_0x0788('0x66'),_0x0788('0x67'),_0x0788('0x68'),_0x0788('0x69'),_0x0788('0x6a'),_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')](_0x0788('0x6e'),'phone')[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x66'))['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))['field'](_0x0788('0x70'),_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x71'),_0x0788('0x69'))[_0x0788('0x6d')](_0x0788('0x6f'),_0x0788('0x6a'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6b'))[_0x0788('0x72')](_0x0788('0x73'))['where'](_0x0788('0x74'),_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x76'),_0x219252[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field'](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x74'),_0x219252['params']['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel['select']()[_0x0788('0x6d')](_0x0788('0x7c'))[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')]('VoiceQueueId\x20=\x20?',_0x219252[_0x0788('0x46')]['id'][_0x0788('0x75')]())['where'](_0x0788('0x7d')))[_0x0788('0x7e')]('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x35c612);}return[];})['then'](respondWithResult(_0x3628d6,null))[_0x0788('0x44')](handleError(_0x3628d6,null));};exports[_0x0788('0x7f')]=function(_0xbb5b1d,_0x53730a,_0xddfb97){return db[_0x0788('0x80')][_0x0788('0x49')]({'where':{'id':_0xbb5b1d[_0x0788('0x46')]['id']}})[_0x0788('0x26')](handleEntityNotFound(_0x53730a,null))[_0x0788('0x26')](function(_0x2545a7){var _0x174931;if(_0x2545a7){_0x174931=squel['insert']()[_0x0788('0x64')](_0x0788('0x65'))[_0x0788('0x81')]([_0x0788('0x7b'),'scheduledAt','ContactId',_0x0788('0x68'),_0x0788('0x82'),'createdAt',_0x0788('0x6b')],squel[_0x0788('0x6c')]()[_0x0788('0x6d')]('ANY_VALUE(calleridnum)','phone')[_0x0788('0x6d')](_0x0788('0x6f'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x0788('0x67'))[_0x0788('0x6d')]('ANY_VALUE(ListId)',_0x0788('0x68'))[_0x0788('0x6d')](_0x0788('0x83'),_0x0788('0x82'))[_0x0788('0x6d')]('NOW()',_0x0788('0x6a'))['field'](_0x0788('0x6f'),'updatedAt')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x76'),_0xbb5b1d[_0x0788('0x4b')][_0x0788('0x77')][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x79'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x0788('0x6d')](_0x0788('0x7b'))[_0x0788('0x72')](_0x0788('0x65'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]()))[_0x0788('0x78')](_0x0788('0x7a'),squel[_0x0788('0x6c')]()['field']('calleridnum')[_0x0788('0x72')](_0x0788('0x73'))[_0x0788('0x78')](_0x0788('0x84'),_0xbb5b1d[_0x0788('0x46')]['id'][_0x0788('0x75')]())[_0x0788('0x78')](_0x0788('0x7d')))['group']('ContactId'))[_0x0788('0x75')]();return db[_0x0788('0x4e')][_0x0788('0x34')](_0x174931);}return[];})[_0x0788('0x26')](respondWithResult(_0x53730a,null))[_0x0788('0x44')](handleError(_0x53730a,null));};exports[_0x0788('0x85')]=function(_0x52dd97,_0x2f6851,_0x1311d7){return db[_0x0788('0x86')][_0x0788('0x87')]({'where':{'VoiceQueueId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x69')],'CampaignId':_0x52dd97[_0x0788('0x4b')][_0x0788('0x82')],'ContactId':_0x52dd97[_0x0788('0x4b')]['ContactId']}})[_0x0788('0x26')](handleEntityNotFound(_0x2f6851,null))[_0x0788('0x26')](function(_0x178f52){if(_0x178f52){return _0x178f52;}return null;})[_0x0788('0x26')](respondWithResult(_0x2f6851,null))[_0x0788('0x44')](handleError(_0x2f6851,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f289407..9650f66 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 _0x3a49=['./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa496b4,_0x2a60fa){var _0x804f82=function(_0x9b24d9){while(--_0x9b24d9){_0xa496b4['push'](_0xa496b4['shift']());}};_0x804f82(++_0x2a60fa);}(_0x3a49,0x1e7));var _0x93a4=function(_0x34233f,_0x2988db){_0x34233f=_0x34233f-0x0;var _0x1f4999=_0x3a49[_0x34233f];return _0x1f4999;};'use strict';var _=require(_0x93a4('0x0'));var util=require('util');var logger=require(_0x93a4('0x1'))(_0x93a4('0x2'));var moment=require(_0x93a4('0x3'));var BPromise=require(_0x93a4('0x4'));var rp=require(_0x93a4('0x5'));var fs=require('fs');var path=require(_0x93a4('0x6'));var rimraf=require('rimraf');var config=require(_0x93a4('0x7'));var attributes=require(_0x93a4('0x8'));module[_0x93a4('0x9')]=function(_0x1cfd7f,_0xcfd251){return _0x1cfd7f[_0x93a4('0xa')](_0x93a4('0xb'),attributes,{'tableName':_0x93a4('0xc'),'paranoid':![],'indexes':[{'name':_0x93a4('0xd'),'fields':[_0x93a4('0xd')]},{'name':_0x93a4('0xe'),'fields':[_0x93a4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7e6=['lodash','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmHopperFinal','calleridnum','uniqueid'];(function(_0x462582,_0x279982){var _0x176aac=function(_0xc93667){while(--_0xc93667){_0x462582['push'](_0x462582['shift']());}};_0x176aac(++_0x279982);}(_0xa7e6,0x1a4));var _0x6a7e=function(_0x301d88,_0x36caa3){_0x301d88=_0x301d88-0x0;var _0x5a98e4=_0xa7e6[_0x301d88];return _0x5a98e4;};'use strict';var _=require(_0x6a7e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));var BPromise=require(_0x6a7e('0x3'));var rp=require(_0x6a7e('0x4'));var fs=require('fs');var path=require(_0x6a7e('0x5'));var rimraf=require(_0x6a7e('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x6a7e('0x7')]=function(_0x532e6a,_0x22d121){return _0x532e6a[_0x6a7e('0x8')](_0x6a7e('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x6a7e('0xa')]},{'name':_0x6a7e('0xb'),'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 0507fe1..67cdde8 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(_0x1b0e23,_0x47688d){var _0x37a2c9=function(_0x207e24){while(--_0x207e24){_0x1b0e23['push'](_0x1b0e23['shift']());}};_0x37a2c9(++_0x47688d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a15cd,_0x1b95c6){_0x1a15cd=_0x1a15cd-0x0;var _0x33f1eb=_0xb10b[_0x1a15cd];return _0x33f1eb;};'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 _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(_0x21758e,_0x313f0b){var _0x3d346c=function(_0x49416a){while(--_0x49416a){_0x21758e['push'](_0x21758e['shift']());}};_0x3d346c(++_0x313f0b);}(_0xb10b,0x12a));var _0xbb10=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xb10b[_0x456b77];return _0x118bb6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 6276a61..952ac7b 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 _0xcfb5=['/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','describe'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xcfb5,0x6b));var _0x5cfb=function(_0x52bfde,_0xb8e46e){_0x52bfde=_0x52bfde-0x0;var _0x3084eb=_0xcfb5[_0x52bfde];return _0x3084eb;};'use strict';var multer=require(_0x5cfb('0x0'));var util=require(_0x5cfb('0x1'));var path=require(_0x5cfb('0x2'));var timeout=require(_0x5cfb('0x3'));var express=require(_0x5cfb('0x4'));var router=express[_0x5cfb('0x5')]();var fs_extra=require(_0x5cfb('0x6'));var auth=require(_0x5cfb('0x7'));var interaction=require(_0x5cfb('0x8'));var config=require(_0x5cfb('0x9'));var controller=require(_0x5cfb('0xa'));router[_0x5cfb('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x5cfb('0xc')]);router[_0x5cfb('0xb')](_0x5cfb('0xd'),auth[_0x5cfb('0xe')](),controller[_0x5cfb('0xf')]);router[_0x5cfb('0xb')](_0x5cfb('0x10'),auth['isAuthenticated'](),controller[_0x5cfb('0x11')]);router[_0x5cfb('0xb')](_0x5cfb('0x12'),auth['isAuthenticated'](),controller[_0x5cfb('0x13')]);router[_0x5cfb('0x14')](_0x5cfb('0x15'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x5cfb('0x14')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x5cfb('0x16')]);router[_0x5cfb('0x14')](_0x5cfb('0x17'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0x5cfb('0xd'),auth[_0x5cfb('0xe')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x10ee=['describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x10ee,0xed));var _0xe10e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x10ee[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0xe10e('0x0'));var util=require(_0xe10e('0x1'));var path=require(_0xe10e('0x2'));var timeout=require(_0xe10e('0x3'));var express=require('express');var router=express[_0xe10e('0x4')]();var fs_extra=require(_0xe10e('0x5'));var auth=require(_0xe10e('0x6'));var interaction=require(_0xe10e('0x7'));var config=require(_0xe10e('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xe10e('0x9')]('/',auth[_0xe10e('0xa')](),controller[_0xe10e('0xb')]);router['get'](_0xe10e('0xc'),auth[_0xe10e('0xa')](),controller[_0xe10e('0xd')]);router[_0xe10e('0x9')]('/:id',auth[_0xe10e('0xa')](),controller[_0xe10e('0xe')]);router[_0xe10e('0x9')](_0xe10e('0xf'),auth[_0xe10e('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xe10e('0x10'),auth[_0xe10e('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xe10e('0x11')]('/voice/queue/moveContacts/:id',auth[_0xe10e('0xa')](),controller[_0xe10e('0x12')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xe10e('0xa')](),controller[_0xe10e('0x13')]);router[_0xe10e('0x11')](_0xe10e('0x14'),auth['isAuthenticated'](),controller[_0xe10e('0x15')]);router['put'](_0xe10e('0x16'),auth[_0xe10e('0xa')](),controller[_0xe10e('0x17')]);module[_0xe10e('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9be2f22..b3f20ab 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 _0xa921=['DATE','STRING','BOOLEAN','INTEGER'];(function(_0x1c1fcf,_0x1b1e85){var _0x303ce1=function(_0x569517){while(--_0x569517){_0x1c1fcf['push'](_0x1c1fcf['shift']());}};_0x303ce1(++_0x1b1e85);}(_0xa921,0x77));var _0x1a92=function(_0x3298da,_0x8640fe){_0x3298da=_0x3298da-0x0;var _0x21ddaf=_0xa921[_0x3298da];return _0x21ddaf;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x1a92('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1a92('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1a92('0x2')]},'calleridnum':{'type':Sequelize[_0x1a92('0x2')]},'calleridname':{'type':Sequelize[_0x1a92('0x2')]},'starttime':{'type':Sequelize[_0x1a92('0x1')]},'responsetime':{'type':Sequelize[_0x1a92('0x1')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x1a92('0x1')]},'endtime':{'type':Sequelize[_0x1a92('0x1')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x1a92('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1a92('0x2')]},'membername':{'type':Sequelize[_0x1a92('0x2')]},'reason':{'type':Sequelize[_0x1a92('0x2')]},'amd':{'type':Sequelize[_0x1a92('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x1a92('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1a92('0x1')]},'recallme':{'type':Sequelize[_0x1a92('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x1a92('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1a92('0x0')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1a92('0x2')]}}; \ No newline at end of file +var _0xd9cc=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x1380e9,_0x1d2627){var _0x3790bf=function(_0x422b99){while(--_0x422b99){_0x1380e9['push'](_0x1380e9['shift']());}};_0x3790bf(++_0x1d2627);}(_0xd9cc,0xed));var _0xcd9c=function(_0xf2c137,_0x51cc73){_0xf2c137=_0xf2c137-0x0;var _0x4c3f75=_0xd9cc[_0xf2c137];return _0x4c3f75;};'use strict';var Sequelize=require(_0xcd9c('0x0'));module[_0xcd9c('0x1')]={'state':{'type':Sequelize[_0xcd9c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xcd9c('0x3')]},'countbusyretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcd9c('0x4')]},'calleridnum':{'type':Sequelize[_0xcd9c('0x4')]},'calleridname':{'type':Sequelize[_0xcd9c('0x4')]},'starttime':{'type':Sequelize[_0xcd9c('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xcd9c('0x4')]},'campaigntype':{'type':Sequelize[_0xcd9c('0x4')]},'membername':{'type':Sequelize[_0xcd9c('0x4')]},'reason':{'type':Sequelize[_0xcd9c('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xcd9c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xcd9c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd9c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xcd9c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xcd9c('0x3')]},'edited':{'type':Sequelize[_0xcd9c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcd9c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd9c('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 06730e7..900cdcf 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 _0x2840=['name','send','index','CmHopperHistory','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','params','include','merge','options','find','create','body','describe','uniqueid','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','limit','set','apply','reject','update','destroy','then','error'];(function(_0x4734c3,_0x32b465){var _0x298191=function(_0x32ba54){while(--_0x32ba54){_0x4734c3['push'](_0x4734c3['shift']());}};_0x298191(++_0x32b465);}(_0x2840,0x6e));var _0x0284=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x2840[_0x5d72da];return _0x43ebe7;};'use strict';var emlformat=require(_0x0284('0x0'));var rimraf=require(_0x0284('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0284('0x2'));var moment=require(_0x0284('0x3'));var BPromise=require(_0x0284('0x4'));var Mustache=require(_0x0284('0x5'));var util=require(_0x0284('0x6'));var path=require(_0x0284('0x7'));var sox=require(_0x0284('0x8'));var csv=require(_0x0284('0x9'));var ejs=require(_0x0284('0xa'));var fs=require('fs');var fs_extra=require(_0x0284('0xb'));var _=require(_0x0284('0xc'));var squel=require(_0x0284('0xd'));var crypto=require(_0x0284('0xe'));var jsforce=require(_0x0284('0xf'));var deskjs=require(_0x0284('0x10'));var toCsv=require(_0x0284('0x9'));var querystring=require(_0x0284('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0284('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0284('0x13'))(_0x0284('0x14'));var utils=require(_0x0284('0x15'));var config=require(_0x0284('0x16'));var licenseUtil=require(_0x0284('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f2c0c,_0x4cedc6){_0x4cedc6=_0x4cedc6||0xcc;return function(_0x1f4958){if(_0x1f4958){return _0x1f2c0c[_0x0284('0x18')](_0x4cedc6);}return _0x1f2c0c['status'](_0x4cedc6)[_0x0284('0x19')]();};}function respondWithResult(_0x55b25a,_0xbedc78){_0xbedc78=_0xbedc78||0xc8;return function(_0x3f731c){if(_0x3f731c){return _0x55b25a[_0x0284('0x1a')](_0xbedc78)[_0x0284('0x1b')](_0x3f731c);}};}function respondWithFilteredResult(_0x59783d,_0x28395c){return function(_0x295732){if(_0x295732){var _0x31c07e=typeof _0x28395c[_0x0284('0x1c')]==='undefined'&&typeof _0x28395c['limit']==='undefined';var _0x159e7e=_0x295732[_0x0284('0x1d')];var _0x5dfa56=_0x31c07e?0x0:_0x28395c['offset'];var _0x150567=_0x31c07e?_0x295732[_0x0284('0x1d')]:_0x28395c[_0x0284('0x1c')]+_0x28395c[_0x0284('0x1e')];var _0x332daf;if(_0x150567>=_0x159e7e){_0x150567=_0x159e7e;_0x332daf=0xc8;}else{_0x332daf=0xce;}_0x59783d[_0x0284('0x1a')](_0x332daf);return _0x59783d[_0x0284('0x1f')]('Content-Range',_0x5dfa56+'-'+_0x150567+'/'+_0x159e7e)[_0x0284('0x1b')](_0x295732);}return null;};}function patchUpdates(_0x353197){return function(_0x370af3){try{jsonpatch[_0x0284('0x20')](_0x370af3,_0x353197,!![]);}catch(_0x3421ab){return BPromise[_0x0284('0x21')](_0x3421ab);}return _0x370af3['save']();};}function saveUpdates(_0x236e3d,_0x359805){return function(_0x2cc617){if(_0x2cc617){return _0x2cc617[_0x0284('0x22')](_0x236e3d)['then'](function(_0x2d0400){return _0x2d0400;});}return null;};}function removeEntity(_0xcb032a,_0x4c3de8){return function(_0x32d299){if(_0x32d299){return _0x32d299[_0x0284('0x23')]()[_0x0284('0x24')](function(){_0xcb032a['status'](0xcc)[_0x0284('0x19')]();});}};}function handleEntityNotFound(_0x4135a9,_0x1267fd){return function(_0x2688d0){if(!_0x2688d0){_0x4135a9['sendStatus'](0x194);}return _0x2688d0;};}function handleError(_0x37fce8,_0x34445f){_0x34445f=_0x34445f||0x1f4;return function(_0x3aa8e5){logger[_0x0284('0x25')](_0x3aa8e5['stack']);if(_0x3aa8e5[_0x0284('0x26')]){delete _0x3aa8e5[_0x0284('0x26')];}_0x37fce8[_0x0284('0x1a')](_0x34445f)[_0x0284('0x27')](_0x3aa8e5);};}exports[_0x0284('0x28')]=function(_0x5588a1,_0x3d8f50){var _0x15496c={},_0x299ecd={},_0x2e622f={'count':0x0,'rows':[]};var _0x2fd3f1=_['map'](db[_0x0284('0x29')][_0x0284('0x2a')],function(_0x32c2bd){return{'name':_0x32c2bd['fieldName'],'type':_0x32c2bd[_0x0284('0x2b')][_0x0284('0x2c')]};});_0x299ecd[_0x0284('0x2d')]=_[_0x0284('0x2e')](_0x2fd3f1,_0x0284('0x26'));_0x299ecd[_0x0284('0x2f')]=_[_0x0284('0x30')](_0x5588a1[_0x0284('0x2f')]);_0x299ecd[_0x0284('0x31')]=_[_0x0284('0x32')](_0x299ecd[_0x0284('0x2d')],_0x299ecd['query']);_0x15496c[_0x0284('0x33')]=_[_0x0284('0x32')](_0x299ecd[_0x0284('0x2d')],qs[_0x0284('0x34')](_0x5588a1[_0x0284('0x2f')][_0x0284('0x34')]));_0x15496c[_0x0284('0x33')]=_0x15496c['attributes']['length']?_0x15496c['attributes']:_0x299ecd['model'];if(!_0x5588a1[_0x0284('0x2f')][_0x0284('0x35')](_0x0284('0x36'))){_0x15496c['limit']=qs['limit'](_0x5588a1[_0x0284('0x2f')][_0x0284('0x1e')]);_0x15496c[_0x0284('0x1c')]=qs[_0x0284('0x1c')](_0x5588a1[_0x0284('0x2f')]['offset']);}_0x15496c[_0x0284('0x37')]=qs[_0x0284('0x38')](_0x5588a1[_0x0284('0x2f')]['sort']);_0x15496c[_0x0284('0x39')]=qs[_0x0284('0x31')](_[_0x0284('0x3a')](_0x5588a1[_0x0284('0x2f')],_0x299ecd[_0x0284('0x31')]),_0x2fd3f1);if(_0x5588a1[_0x0284('0x2f')][_0x0284('0x3b')]){_0x15496c[_0x0284('0x39')]=_['merge'](_0x15496c['where'],{'$or':_[_0x0284('0x2e')](_0x2fd3f1,function(_0x1df061){if(_0x1df061[_0x0284('0x2b')]!==_0x0284('0x3c')){var _0x363519={};_0x363519[_0x1df061[_0x0284('0x26')]]={'$like':'%'+_0x5588a1[_0x0284('0x2f')]['filter']+'%'};return _0x363519;}})});}_0x15496c=_['merge']({},_0x15496c,_0x5588a1['options']);var _0x4ee23d={'where':_0x15496c[_0x0284('0x39')]};return db[_0x0284('0x29')][_0x0284('0x1d')](_0x4ee23d)[_0x0284('0x24')](function(_0x3847e2){_0x2e622f['count']=_0x3847e2;if(_0x5588a1[_0x0284('0x2f')][_0x0284('0x3d')]){_0x15496c['include']=[{'all':!![]}];}return db[_0x0284('0x29')][_0x0284('0x3e')](_0x15496c);})[_0x0284('0x24')](function(_0x1e51e8){_0x2e622f[_0x0284('0x3f')]=_0x1e51e8;return _0x2e622f;})[_0x0284('0x24')](respondWithFilteredResult(_0x3d8f50,_0x15496c))[_0x0284('0x40')](handleError(_0x3d8f50,null));};exports['show']=function(_0x5ddeae,_0x532d25){var _0x7f254c={'raw':!![],'where':{'id':_0x5ddeae[_0x0284('0x41')]['id']}},_0x4ba17a={};_0x4ba17a[_0x0284('0x2d')]=_['keys'](db[_0x0284('0x29')][_0x0284('0x2a')]);_0x4ba17a[_0x0284('0x2f')]=_[_0x0284('0x30')](_0x5ddeae['query']);_0x4ba17a['filters']=_[_0x0284('0x32')](_0x4ba17a['model'],_0x4ba17a[_0x0284('0x2f')]);_0x7f254c[_0x0284('0x33')]=_[_0x0284('0x32')](_0x4ba17a['model'],qs[_0x0284('0x34')](_0x5ddeae[_0x0284('0x2f')]['fields']));_0x7f254c[_0x0284('0x33')]=_0x7f254c[_0x0284('0x33')]['length']?_0x7f254c['attributes']:_0x4ba17a[_0x0284('0x2d')];if(_0x5ddeae[_0x0284('0x2f')][_0x0284('0x3d')]){_0x7f254c[_0x0284('0x42')]=[{'all':!![]}];}_0x7f254c=_[_0x0284('0x43')]({},_0x7f254c,_0x5ddeae[_0x0284('0x44')]);return db[_0x0284('0x29')][_0x0284('0x45')](_0x7f254c)[_0x0284('0x24')](handleEntityNotFound(_0x532d25,null))['then'](respondWithResult(_0x532d25,null))['catch'](handleError(_0x532d25,null));};exports['create']=function(_0x2a05a6,_0x2cbed5){return db[_0x0284('0x29')][_0x0284('0x46')](_0x2a05a6[_0x0284('0x47')],{})['then'](respondWithResult(_0x2cbed5,0xc9))['catch'](handleError(_0x2cbed5,null));};exports[_0x0284('0x48')]=function(_0x19bffb,_0x4a4160){return db[_0x0284('0x29')][_0x0284('0x48')]()['then'](respondWithResult(_0x4a4160,null))['catch'](handleError(_0x4a4160,null));};exports[_0x0284('0x22')]=function(_0x1fa84c,_0x95fff4){if(_0x1fa84c[_0x0284('0x47')][_0x0284('0x49')]){delete _0x1fa84c['body'][_0x0284('0x49')];}return db[_0x0284('0x29')][_0x0284('0x45')]({'where':{'uniqueid':_0x1fa84c['params']['id']}})[_0x0284('0x24')](handleEntityNotFound(_0x95fff4,null))[_0x0284('0x24')](saveUpdates(_0x1fa84c['body'],null))['then'](respondWithResult(_0x95fff4,null))['catch'](handleError(_0x95fff4,null));}; \ No newline at end of file +var _0x28e0=['then','destroy','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','keys','find','create','describe','body','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','count','limit','Content-Range','apply','reject','save','update'];(function(_0x110c54,_0xa3cfcb){var _0x58a348=function(_0x2ddb40){while(--_0x2ddb40){_0x110c54['push'](_0x110c54['shift']());}};_0x58a348(++_0xa3cfcb);}(_0x28e0,0x1ac));var _0x028e=function(_0x4cb1f7,_0xba51a){_0x4cb1f7=_0x4cb1f7-0x0;var _0x570298=_0x28e0[_0x4cb1f7];return _0x570298;};'use strict';var emlformat=require(_0x028e('0x0'));var rimraf=require(_0x028e('0x1'));var zipdir=require(_0x028e('0x2'));var jsonpatch=require(_0x028e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x028e('0x4'));var Mustache=require(_0x028e('0x5'));var util=require('util');var path=require(_0x028e('0x6'));var sox=require(_0x028e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x028e('0x8'));var _=require(_0x028e('0x9'));var squel=require(_0x028e('0xa'));var crypto=require(_0x028e('0xb'));var jsforce=require(_0x028e('0xc'));var deskjs=require(_0x028e('0xd'));var toCsv=require(_0x028e('0xe'));var querystring=require(_0x028e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x028e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x028e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x028e('0x12'))(_0x028e('0x13'));var utils=require(_0x028e('0x14'));var config=require(_0x028e('0x15'));var licenseUtil=require(_0x028e('0x16'));var db=require(_0x028e('0x17'))['db'];function respondWithStatusCode(_0x532b2a,_0x3e9b71){_0x3e9b71=_0x3e9b71||0xcc;return function(_0x2f6810){if(_0x2f6810){return _0x532b2a[_0x028e('0x18')](_0x3e9b71);}return _0x532b2a[_0x028e('0x19')](_0x3e9b71)['end']();};}function respondWithResult(_0x10ce3b,_0x3cae76){_0x3cae76=_0x3cae76||0xc8;return function(_0x36e91c){if(_0x36e91c){return _0x10ce3b[_0x028e('0x19')](_0x3cae76)['json'](_0x36e91c);}};}function respondWithFilteredResult(_0x94aa8b,_0x470851){return function(_0x3473d3){if(_0x3473d3){var _0x4f42d8=typeof _0x470851[_0x028e('0x1a')]==='undefined'&&typeof _0x470851['limit']==='undefined';var _0x37f9a6=_0x3473d3[_0x028e('0x1b')];var _0x5a169e=_0x4f42d8?0x0:_0x470851['offset'];var _0x133717=_0x4f42d8?_0x3473d3[_0x028e('0x1b')]:_0x470851['offset']+_0x470851[_0x028e('0x1c')];var _0x4465dd;if(_0x133717>=_0x37f9a6){_0x133717=_0x37f9a6;_0x4465dd=0xc8;}else{_0x4465dd=0xce;}_0x94aa8b['status'](_0x4465dd);return _0x94aa8b['set'](_0x028e('0x1d'),_0x5a169e+'-'+_0x133717+'/'+_0x37f9a6)['json'](_0x3473d3);}return null;};}function patchUpdates(_0x2f2764){return function(_0x2335d8){try{jsonpatch[_0x028e('0x1e')](_0x2335d8,_0x2f2764,!![]);}catch(_0x3e6e24){return BPromise[_0x028e('0x1f')](_0x3e6e24);}return _0x2335d8[_0x028e('0x20')]();};}function saveUpdates(_0x29ffda,_0x372252){return function(_0x2495d2){if(_0x2495d2){return _0x2495d2[_0x028e('0x21')](_0x29ffda)[_0x028e('0x22')](function(_0x122fe7){return _0x122fe7;});}return null;};}function removeEntity(_0x30aece,_0x448f13){return function(_0x591158){if(_0x591158){return _0x591158[_0x028e('0x23')]()[_0x028e('0x22')](function(){_0x30aece[_0x028e('0x19')](0xcc)[_0x028e('0x24')]();});}};}function handleEntityNotFound(_0xc660f3,_0x53b20c){return function(_0x3f962a){if(!_0x3f962a){_0xc660f3['sendStatus'](0x194);}return _0x3f962a;};}function handleError(_0x59d84c,_0x522df7){_0x522df7=_0x522df7||0x1f4;return function(_0x4c01d8){logger[_0x028e('0x25')](_0x4c01d8[_0x028e('0x26')]);if(_0x4c01d8[_0x028e('0x27')]){delete _0x4c01d8[_0x028e('0x27')];}_0x59d84c['status'](_0x522df7)[_0x028e('0x28')](_0x4c01d8);};}exports[_0x028e('0x29')]=function(_0x28a7c8,_0x5898c9){var _0x26cbe4={},_0x59b7b6={},_0x1454c3={'count':0x0,'rows':[]};var _0xc125aa=_['map'](db[_0x028e('0x2a')][_0x028e('0x2b')],function(_0x1abfc7){return{'name':_0x1abfc7[_0x028e('0x2c')],'type':_0x1abfc7[_0x028e('0x2d')][_0x028e('0x2e')]};});_0x59b7b6[_0x028e('0x2f')]=_[_0x028e('0x30')](_0xc125aa,_0x028e('0x27'));_0x59b7b6[_0x028e('0x31')]=_['keys'](_0x28a7c8[_0x028e('0x31')]);_0x59b7b6['filters']=_[_0x028e('0x32')](_0x59b7b6[_0x028e('0x2f')],_0x59b7b6[_0x028e('0x31')]);_0x26cbe4['attributes']=_[_0x028e('0x32')](_0x59b7b6[_0x028e('0x2f')],qs[_0x028e('0x33')](_0x28a7c8[_0x028e('0x31')]['fields']));_0x26cbe4['attributes']=_0x26cbe4[_0x028e('0x34')][_0x028e('0x35')]?_0x26cbe4[_0x028e('0x34')]:_0x59b7b6[_0x028e('0x2f')];if(!_0x28a7c8[_0x028e('0x31')][_0x028e('0x36')](_0x028e('0x37'))){_0x26cbe4[_0x028e('0x1c')]=qs[_0x028e('0x1c')](_0x28a7c8['query'][_0x028e('0x1c')]);_0x26cbe4[_0x028e('0x1a')]=qs[_0x028e('0x1a')](_0x28a7c8[_0x028e('0x31')][_0x028e('0x1a')]);}_0x26cbe4[_0x028e('0x38')]=qs['sort'](_0x28a7c8[_0x028e('0x31')][_0x028e('0x39')]);_0x26cbe4['where']=qs['filters'](_[_0x028e('0x3a')](_0x28a7c8[_0x028e('0x31')],_0x59b7b6[_0x028e('0x3b')]),_0xc125aa);if(_0x28a7c8[_0x028e('0x31')]['filter']){_0x26cbe4[_0x028e('0x3c')]=_[_0x028e('0x3d')](_0x26cbe4[_0x028e('0x3c')],{'$or':_[_0x028e('0x30')](_0xc125aa,function(_0x5528c6){if(_0x5528c6['type']!==_0x028e('0x3e')){var _0x41c9ac={};_0x41c9ac[_0x5528c6[_0x028e('0x27')]]={'$like':'%'+_0x28a7c8['query'][_0x028e('0x3f')]+'%'};return _0x41c9ac;}})});}_0x26cbe4=_[_0x028e('0x3d')]({},_0x26cbe4,_0x28a7c8[_0x028e('0x40')]);var _0x388376={'where':_0x26cbe4['where']};return db[_0x028e('0x2a')][_0x028e('0x1b')](_0x388376)[_0x028e('0x22')](function(_0x53bb67){_0x1454c3['count']=_0x53bb67;if(_0x28a7c8['query'][_0x028e('0x41')]){_0x26cbe4[_0x028e('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x26cbe4);})[_0x028e('0x22')](function(_0x3d1075){_0x1454c3[_0x028e('0x43')]=_0x3d1075;return _0x1454c3;})[_0x028e('0x22')](respondWithFilteredResult(_0x5898c9,_0x26cbe4))[_0x028e('0x44')](handleError(_0x5898c9,null));};exports[_0x028e('0x45')]=function(_0xea1a55,_0x49e59e){var _0x300825={'raw':!![],'where':{'id':_0xea1a55['params']['id']}},_0x565aa1={};_0x565aa1[_0x028e('0x2f')]=_[_0x028e('0x46')](db['CmHopperHistory'][_0x028e('0x2b')]);_0x565aa1[_0x028e('0x31')]=_[_0x028e('0x46')](_0xea1a55[_0x028e('0x31')]);_0x565aa1[_0x028e('0x3b')]=_[_0x028e('0x32')](_0x565aa1[_0x028e('0x2f')],_0x565aa1[_0x028e('0x31')]);_0x300825[_0x028e('0x34')]=_[_0x028e('0x32')](_0x565aa1[_0x028e('0x2f')],qs[_0x028e('0x33')](_0xea1a55['query'][_0x028e('0x33')]));_0x300825[_0x028e('0x34')]=_0x300825['attributes'][_0x028e('0x35')]?_0x300825[_0x028e('0x34')]:_0x565aa1['model'];if(_0xea1a55['query']['includeAll']){_0x300825['include']=[{'all':!![]}];}_0x300825=_['merge']({},_0x300825,_0xea1a55[_0x028e('0x40')]);return db['CmHopperHistory'][_0x028e('0x47')](_0x300825)[_0x028e('0x22')](handleEntityNotFound(_0x49e59e,null))[_0x028e('0x22')](respondWithResult(_0x49e59e,null))[_0x028e('0x44')](handleError(_0x49e59e,null));};exports['create']=function(_0x173784,_0x4b18e2){return db[_0x028e('0x2a')][_0x028e('0x48')](_0x173784['body'],{})['then'](respondWithResult(_0x4b18e2,0xc9))[_0x028e('0x44')](handleError(_0x4b18e2,null));};exports[_0x028e('0x49')]=function(_0x5430a3,_0x58e327){return db[_0x028e('0x2a')][_0x028e('0x49')]()[_0x028e('0x22')](respondWithResult(_0x58e327,null))[_0x028e('0x44')](handleError(_0x58e327,null));};exports[_0x028e('0x21')]=function(_0x439ca5,_0x42413a){if(_0x439ca5[_0x028e('0x4a')][_0x028e('0x4b')]){delete _0x439ca5['body'][_0x028e('0x4b')];}return db['CmHopperHistory'][_0x028e('0x47')]({'where':{'uniqueid':_0x439ca5[_0x028e('0x4c')]['id']}})[_0x028e('0x22')](handleEntityNotFound(_0x42413a,null))[_0x028e('0x22')](saveUpdates(_0x439ca5[_0x028e('0x4a')],null))[_0x028e('0x22')](respondWithResult(_0x42413a,null))[_0x028e('0x44')](handleError(_0x42413a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 06416a0..67d4801 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 _0x9af6=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x3ff0f0,_0x5523bf){var _0x5dc82a=function(_0x14d26d){while(--_0x14d26d){_0x3ff0f0['push'](_0x3ff0f0['shift']());}};_0x5dc82a(++_0x5523bf);}(_0x9af6,0x1d7));var _0x69af=function(_0x246876,_0xef5a5d){_0x246876=_0x246876-0x0;var _0x11d5e4=_0x9af6[_0x246876];return _0x11d5e4;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))('api');var moment=require('moment');var BPromise=require(_0x69af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x69af('0x4'));var config=require(_0x69af('0x5'));var attributes=require(_0x69af('0x6'));module['exports']=function(_0x3848c6,_0x54e2f1){return _0x3848c6[_0x69af('0x7')](_0x69af('0x8'),attributes,{'tableName':_0x69af('0x9'),'paranoid':![],'indexes':[{'name':_0x69af('0xa'),'fields':[_0x69af('0xa')]},{'name':_0x69af('0xb'),'fields':[_0x69af('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x471a=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','exports','CmHopperHistory','cm_hopper_history','endtime'];(function(_0xf19fd4,_0x12b8fe){var _0x291407=function(_0x41b85d){while(--_0x41b85d){_0xf19fd4['push'](_0xf19fd4['shift']());}};_0x291407(++_0x12b8fe);}(_0x471a,0x18d));var _0xa471=function(_0x448364,_0x20dfa5){_0x448364=_0x448364-0x0;var _0x1bfa66=_0x471a[_0x448364];return _0x1bfa66;};'use strict';var _=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var logger=require(_0xa471('0x2'))('api');var moment=require(_0xa471('0x3'));var BPromise=require(_0xa471('0x4'));var rp=require(_0xa471('0x5'));var fs=require('fs');var path=require(_0xa471('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xa471('0x7')]=function(_0x4de28a,_0x4942a0){return _0x4de28a['define'](_0xa471('0x8'),attributes,{'tableName':_0xa471('0x9'),'paranoid':![],'indexes':[{'name':_0xa471('0xa'),'fields':['endtime']},{'name':_0xa471('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3cfd583..71bc696 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 _0x3445=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5344('0x2'));var fs=require('fs');var Redis=require(_0x5344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5344('0x4'));var logger=require(_0x5344('0x5'))(_0x5344('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5344('0x7')][_0x5344('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea8222,_0x3c4589,_0x9f237f){return new BPromise(function(_0xb805dc,_0x530ebb){return client[_0x5344('0x9')](_0xea8222,_0x9f237f)['then'](function(_0x271c86){logger['info'](_0x5344('0xa'),_0x3c4589,_0x5344('0xb'));logger[_0x5344('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'),JSON[_0x5344('0xd')](_0x271c86));if(_0x271c86[_0x5344('0xe')]){if(_0x271c86[_0x5344('0xe')][_0x5344('0xf')]===0x1f4){logger['error'](_0x5344('0xa'),_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0x530ebb(_0x271c86[_0x5344('0xe')]['message']);}logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0xb805dc(_0x271c86[_0x5344('0xe')]['message']);}else{logger[_0x5344('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'));_0xb805dc(_0x271c86[_0x5344('0x12')][_0x5344('0x10')]);}})[_0x5344('0x13')](function(_0x2b4963){logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x2b4963);_0x530ebb(_0x2b4963);});});}exports[_0x5344('0x14')]=function(_0x5ee0a3){var _0xd2740c=this;return new Promise(function(_0x193492,_0xf2811d){return db[_0x5344('0x15')]['create'](_0x5ee0a3[_0x5344('0x16')],{'raw':_0x5ee0a3[_0x5344('0x17')]?_0x5ee0a3['options'][_0x5344('0x18')]===undefined?!![]:![]:!![]})[_0x5344('0x19')](function(_0x3418da){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5ee0a3);logger[_0x5344('0xc')](_0x5344('0x14'),_0x5ee0a3,JSON[_0x5344('0xd')](_0x3418da));_0x193492(_0x3418da);})[_0x5344('0x13')](function(_0x1ebec4){logger[_0x5344('0xe')]('CreateCmHopperHistory',_0x1ebec4['message'],_0x5ee0a3);_0xf2811d(_0xd2740c[_0x5344('0xe')](0x1f4,_0x1ebec4[_0x5344('0x10')]));});});};exports['AvgHandleTime']=function(_0x487993){var _0x20472=this;return new Promise(function(_0x20f228,_0x2f000d){return db['CmHopperHistory'][_0x5344('0x1a')]({'raw':_0x487993[_0x5344('0x17')]?_0x487993['options'][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x487993[_0x5344('0x17')]?_0x487993[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')][_0x5344('0x1e')]('id')),_0x5344('0x1f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x22')))),_0x5344('0x23')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x24')))),_0x5344('0x25')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')]['literal'](_0x5344('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5344('0x28')]]})['then'](function(_0x217c43){logger[_0x5344('0x11')](_0x5344('0x29'),_0x487993);logger[_0x5344('0xc')](_0x5344('0x29'),_0x487993,JSON[_0x5344('0xd')](_0x217c43));_0x20f228(_0x217c43);})[_0x5344('0x13')](function(_0x1e7070){logger['error'](_0x5344('0x29'),_0x1e7070['message'],_0x487993);_0x2f000d(_0x20472[_0x5344('0xe')](0x1f4,_0x1e7070[_0x5344('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x35c7d0){var _0x2bb695=this;return new Promise(function(_0x29d396,_0x2eaffa){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x35c7d0['options']?_0x35c7d0[_0x5344('0x17')][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x35c7d0[_0x5344('0x17')]?_0x35c7d0[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db['sequelize'][_0x5344('0x20')](_0x5344('0x2c')))),_0x5344('0x2d')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),_0x5344('0x2f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x5344('0x30')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x31')))),_0x5344('0x32')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x33')))),_0x5344('0x34')],[db['sequelize']['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5344('0x35')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x36')))),_0x5344('0x37')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x5344('0x38')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x39')))),_0x5344('0x3a')],[db['sequelize']['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3b')))),_0x5344('0x3c')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3d')))),'outboundRejectCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x54d2b0){logger['info'](_0x5344('0x3e'),_0x35c7d0);logger[_0x5344('0xc')](_0x5344('0x3e'),_0x35c7d0,JSON[_0x5344('0xd')](_0x54d2b0));_0x29d396(_0x54d2b0);})[_0x5344('0x13')](function(_0x534b32){logger[_0x5344('0xe')](_0x5344('0x3e'),_0x534b32[_0x5344('0x10')],_0x35c7d0);_0x2eaffa(_0x2bb695['error'](0x1f4,_0x534b32['message']));});});};exports[_0x5344('0x3f')]=function(_0x2e71f4){var _0x37409e=this;return new Promise(function(_0xaae044,_0x52882e){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn']('COUNT',db['sequelize'][_0x5344('0x1e')]('id')),_0x5344('0x40')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x5344('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x32cfa4){logger['info'](_0x5344('0x3f'),_0x2e71f4);logger[_0x5344('0xc')]('GetCampaignHopperHistory',_0x2e71f4,JSON[_0x5344('0xd')](_0x32cfa4));_0xaae044(_0x32cfa4);})['catch'](function(_0x56dc43){logger[_0x5344('0xe')](_0x5344('0x3f'),_0x56dc43['message'],_0x2e71f4);_0x52882e(_0x37409e[_0x5344('0xe')](0x1f4,_0x56dc43['message']));});});}; \ No newline at end of file +var _0xd86f=['predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`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','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col'];(function(_0x53e471,_0x4d9148){var _0x37c2f1=function(_0x555539){while(--_0x555539){_0x53e471['push'](_0x53e471['shift']());}};_0x37c2f1(++_0x4d9148);}(_0xd86f,0xf6));var _0xfd86=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xd86f[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xfd86('0x0'));var util=require(_0xfd86('0x1'));var moment=require(_0xfd86('0x2'));var BPromise=require(_0xfd86('0x3'));var rs=require(_0xfd86('0x4'));var fs=require('fs');var Redis=require(_0xfd86('0x5'));var db=require(_0xfd86('0x6'))['db'];var utils=require(_0xfd86('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfd86('0x8'));var client=jayson[_0xfd86('0x9')][_0xfd86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52baeb,_0x4d1781,_0xa7cae3){return new BPromise(function(_0x5bf033,_0x4e5d6d){return client[_0xfd86('0xb')](_0x52baeb,_0xa7cae3)[_0xfd86('0xc')](function(_0x1a1932){logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,'request\x20sent');logger[_0xfd86('0xf')](_0xfd86('0x10'),_0x4d1781,'request\x20sent',JSON[_0xfd86('0x11')](_0x1a1932));if(_0x1a1932[_0xfd86('0x12')]){if(_0x1a1932[_0xfd86('0x12')]['code']===0x1f4){logger[_0xfd86('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4d1781,_0x1a1932['error'][_0xfd86('0x13')]);return _0x4e5d6d(_0x1a1932[_0xfd86('0x12')]['message']);}logger[_0xfd86('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x4d1781,_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);return _0x5bf033(_0x1a1932[_0xfd86('0x12')][_0xfd86('0x13')]);}else{logger[_0xfd86('0xd')](_0xfd86('0xe'),_0x4d1781,_0xfd86('0x14'));_0x5bf033(_0x1a1932[_0xfd86('0x15')]['message']);}})[_0xfd86('0x16')](function(_0x23d34f){logger['error'](_0xfd86('0xe'),_0x4d1781,_0x23d34f);_0x4e5d6d(_0x23d34f);});});}exports[_0xfd86('0x17')]=function(_0x5c9ad5){var _0x3b57e3=this;return new Promise(function(_0x3086a3,_0x599151){return db[_0xfd86('0x18')][_0xfd86('0x19')](_0x5c9ad5['body'],{'raw':_0x5c9ad5[_0xfd86('0x1a')]?_0x5c9ad5[_0xfd86('0x1a')][_0xfd86('0x1b')]===undefined?!![]:![]:!![]})[_0xfd86('0xc')](function(_0x20666f){logger[_0xfd86('0xd')](_0xfd86('0x17'),_0x5c9ad5);logger['debug']('CreateCmHopperHistory',_0x5c9ad5,JSON[_0xfd86('0x11')](_0x20666f));_0x3086a3(_0x20666f);})[_0xfd86('0x16')](function(_0xc16cc5){logger['error'](_0xfd86('0x17'),_0xc16cc5[_0xfd86('0x13')],_0x5c9ad5);_0x599151(_0x3b57e3['error'](0x1f4,_0xc16cc5[_0xfd86('0x13')]));});});};exports[_0xfd86('0x1c')]=function(_0x1c9150){var _0x4a655e=this;return new Promise(function(_0x3de285,_0x34ea66){return db[_0xfd86('0x18')][_0xfd86('0x1d')]({'raw':_0x1c9150[_0xfd86('0x1a')]?_0x1c9150[_0xfd86('0x1a')][_0xfd86('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c9150[_0xfd86('0x1a')]?_0x1c9150['options'][_0xfd86('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')][_0xfd86('0x21')]('id')),_0xfd86('0x22')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')]['literal'](_0xfd86('0x23')))),_0xfd86('0x24')],[db['sequelize']['fn']('COUNT',db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x26')))),_0xfd86('0x27')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),_0xfd86('0x28')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x29'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x2a')))),_0xfd86('0x2b')],[db['sequelize']['fn'](_0xfd86('0x29'),db[_0xfd86('0x20')]['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x2c')))),_0xfd86('0x2d')]]})[_0xfd86('0xc')](function(_0x4832ad){logger[_0xfd86('0xd')](_0xfd86('0x1c'),_0x1c9150);logger[_0xfd86('0xf')]('AvgHandleTime',_0x1c9150,JSON[_0xfd86('0x11')](_0x4832ad));_0x3de285(_0x4832ad);})[_0xfd86('0x16')](function(_0x527343){logger[_0xfd86('0x12')](_0xfd86('0x1c'),_0x527343['message'],_0x1c9150);_0x34ea66(_0x4a655e[_0xfd86('0x12')](0x1f4,_0x527343[_0xfd86('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5c72fa){var _0xa201e8=this;return new Promise(function(_0x88b970,_0x1cca52){return db[_0xfd86('0x18')][_0xfd86('0x1d')]({'raw':_0x5c72fa[_0xfd86('0x1a')]?_0x5c72fa[_0xfd86('0x1a')][_0xfd86('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c72fa['options']?_0x5c72fa[_0xfd86('0x1a')][_0xfd86('0x1e')]||null:null,'attributes':[[_0xfd86('0x2e'),_0xfd86('0x2f')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')]['literal'](_0xfd86('0x30')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x31')))),_0xfd86('0x32')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db['sequelize']['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x23')))),_0xfd86('0x33')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xfd86('0x25')]('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x34')))),'outboundCongestionCallsDay'],[db[_0xfd86('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x35')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x36')))),_0xfd86('0x37')],[db[_0xfd86('0x20')]['fn']('COUNT',db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')]['literal'](_0xfd86('0x38')))),_0xfd86('0x39')],[db[_0xfd86('0x20')]['fn']('COUNT',db[_0xfd86('0x20')]['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')](_0xfd86('0x3b')))),_0xfd86('0x3c')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db[_0xfd86('0x20')][_0xfd86('0x25')]('`state`\x20=\x2018,\x201,\x20null'))),_0xfd86('0x3d')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x3e')))),_0xfd86('0x3f')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x40')))),_0xfd86('0x3d')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x41')))),'outboundReCallsDay']],'group':[_0xfd86('0x2e')]})[_0xfd86('0xc')](function(_0x586758){logger[_0xfd86('0xd')](_0xfd86('0x42'),_0x5c72fa);logger[_0xfd86('0xf')](_0xfd86('0x42'),_0x5c72fa,JSON[_0xfd86('0x11')](_0x586758));_0x88b970(_0x586758);})[_0xfd86('0x16')](function(_0x12acf8){logger[_0xfd86('0x12')](_0xfd86('0x42'),_0x12acf8[_0xfd86('0x13')],_0x5c72fa);_0x1cca52(_0xa201e8['error'](0x1f4,_0x12acf8[_0xfd86('0x13')]));});});};exports[_0xfd86('0x43')]=function(_0x39ac85){var _0x3ddacd=this;return new Promise(function(_0x226a49,_0x5a6f65){return db['CmHopperHistory'][_0xfd86('0x1d')]({'raw':_0x39ac85[_0xfd86('0x1a')]?_0x39ac85[_0xfd86('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x39ac85[_0xfd86('0x1a')]?_0x39ac85[_0xfd86('0x1a')][_0xfd86('0x1e')]||null:null,'attributes':[['campaign',_0xfd86('0x2f')],[db[_0xfd86('0x20')]['fn'](_0xfd86('0x1f'),db['sequelize'][_0xfd86('0x21')]('id')),_0xfd86('0x44')],[db['sequelize']['fn'](_0xfd86('0x1f'),db[_0xfd86('0x20')]['fn']('IF',db['sequelize'][_0xfd86('0x25')](_0xfd86('0x23')))),_0xfd86('0x45')]],'group':[_0xfd86('0x2e')]})['then'](function(_0x22c06f){logger[_0xfd86('0xd')](_0xfd86('0x43'),_0x39ac85);logger[_0xfd86('0xf')](_0xfd86('0x43'),_0x39ac85,JSON[_0xfd86('0x11')](_0x22c06f));_0x226a49(_0x22c06f);})['catch'](function(_0x134248){logger[_0xfd86('0x12')](_0xfd86('0x43'),_0x134248['message'],_0x39ac85);_0x5a6f65(_0x3ddacd[_0xfd86('0x12')](0x1f4,_0x134248['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c4ddeea..a5d3707 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 _0x4ca0=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x487af3,_0xce1f2c){var _0x33ac2b=function(_0x4c766d){while(--_0x4c766d){_0x487af3['push'](_0x487af3['shift']());}};_0x33ac2b(++_0xce1f2c);}(_0x4ca0,0xdc));var _0x04ca=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x4ca0[_0x324012];return _0x435cf2;};'use strict';var multer=require(_0x04ca('0x0'));var util=require(_0x04ca('0x1'));var path=require(_0x04ca('0x2'));var timeout=require(_0x04ca('0x3'));var express=require('express');var router=express[_0x04ca('0x4')]();var fs_extra=require(_0x04ca('0x5'));var auth=require(_0x04ca('0x6'));var interaction=require(_0x04ca('0x7'));var config=require(_0x04ca('0x8'));var controller=require(_0x04ca('0x9'));router[_0x04ca('0xa')]('/',auth[_0x04ca('0xb')](),controller[_0x04ca('0xc')]);router[_0x04ca('0xa')](_0x04ca('0xd'),auth[_0x04ca('0xb')](),controller[_0x04ca('0xe')]);router[_0x04ca('0xa')](_0x04ca('0xf'),auth[_0x04ca('0xb')](),controller[_0x04ca('0x10')]);router[_0x04ca('0x11')]('/',auth['isAuthenticated'](),controller[_0x04ca('0x12')]);router[_0x04ca('0x13')](_0x04ca('0xf'),auth['isAuthenticated'](),controller[_0x04ca('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4d7c=['./cmHopperHistory.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x4d7c,0xe8));var _0xc4d7=function(_0x160ffe,_0x7eb475){_0x160ffe=_0x160ffe-0x0;var _0x259757=_0x4d7c[_0x160ffe];return _0x259757;};'use strict';var multer=require(_0xc4d7('0x0'));var util=require(_0xc4d7('0x1'));var path=require('path');var timeout=require(_0xc4d7('0x2'));var express=require(_0xc4d7('0x3'));var router=express[_0xc4d7('0x4')]();var fs_extra=require(_0xc4d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc4d7('0x6'));var config=require(_0xc4d7('0x7'));var controller=require(_0xc4d7('0x8'));router['get']('/',auth[_0xc4d7('0x9')](),controller[_0xc4d7('0xa')]);router[_0xc4d7('0xb')](_0xc4d7('0xc'),auth[_0xc4d7('0x9')](),controller[_0xc4d7('0xd')]);router[_0xc4d7('0xb')](_0xc4d7('0xe'),auth[_0xc4d7('0x9')](),controller[_0xc4d7('0xf')]);router[_0xc4d7('0x10')]('/',auth[_0xc4d7('0x9')](),controller['create']);router[_0xc4d7('0x11')](_0xc4d7('0xe'),auth[_0xc4d7('0x9')](),controller[_0xc4d7('0x12')]);module[_0xc4d7('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 dda0855..041bcbc 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 _0xc0a4=['exports','STRING','name'];(function(_0x3fffac,_0x1f3712){var _0x4a0ea6=function(_0x217230){while(--_0x217230){_0x3fffac['push'](_0x3fffac['shift']());}};_0x4a0ea6(++_0x1f3712);}(_0xc0a4,0x147));var _0x4c0a=function(_0x155edb,_0x11cd3d){_0x155edb=_0x155edb-0x0;var _0x35a612=_0xc0a4[_0x155edb];return _0x35a612;};'use strict';var Sequelize=require('sequelize');module[_0x4c0a('0x0')]={'name':{'type':Sequelize[_0x4c0a('0x1')],'unique':_0x4c0a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x4c0a('0x1')]}}; \ No newline at end of file +var _0x8c32=['sequelize','exports','STRING','name'];(function(_0x37d7b5,_0x48d6ae){var _0x37145d=function(_0x422864){while(--_0x422864){_0x37d7b5['push'](_0x37d7b5['shift']());}};_0x37145d(++_0x48d6ae);}(_0x8c32,0x130));var _0x28c3=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x8c32[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x28c3('0x0'));module[_0x28c3('0x1')]={'name':{'type':Sequelize[_0x28c3('0x2')],'unique':_0x28c3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x28c3('0x2')]},'dialPrefix':{'type':Sequelize[_0x28c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 3edf6df..ca9b295 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 _0xd0b7=['sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','get','Lists','UserProfileResource','destroy','error','name','send','index','map','CmList','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','includeAll','rows','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','ItemTypeId\x20=\x20?','additionalPhone_','description','from','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','options','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./cmList.socket'];(function(_0x6d5431,_0x5314b3){var _0x5d9d45=function(_0x89d539){while(--_0x89d539){_0x6d5431['push'](_0x6d5431['shift']());}};_0x5d9d45(++_0x5314b3);}(_0xd0b7,0x88));var _0x7d0b=function(_0x997bde,_0x56b130){_0x997bde=_0x997bde-0x0;var _0x13e29b=_0xd0b7[_0x997bde];return _0x13e29b;};'use strict';var emlformat=require(_0x7d0b('0x0'));var rimraf=require(_0x7d0b('0x1'));var zipdir=require(_0x7d0b('0x2'));var jsonpatch=require(_0x7d0b('0x3'));var rp=require(_0x7d0b('0x4'));var moment=require(_0x7d0b('0x5'));var BPromise=require(_0x7d0b('0x6'));var Mustache=require(_0x7d0b('0x7'));var util=require(_0x7d0b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7d0b('0x9'));var ejs=require(_0x7d0b('0xa'));var fs=require('fs');var fs_extra=require(_0x7d0b('0xb'));var _=require(_0x7d0b('0xc'));var squel=require('squel');var crypto=require(_0x7d0b('0xd'));var jsforce=require(_0x7d0b('0xe'));var deskjs=require(_0x7d0b('0xf'));var toCsv=require(_0x7d0b('0x9'));var querystring=require(_0x7d0b('0x10'));var Papa=require(_0x7d0b('0x11'));var Redis=require(_0x7d0b('0x12'));var authService=require(_0x7d0b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7d0b('0x14'));var hardwareService=require(_0x7d0b('0x15'));var logger=require(_0x7d0b('0x16'))('api');var utils=require(_0x7d0b('0x17'));var config=require(_0x7d0b('0x18'));var licenseUtil=require(_0x7d0b('0x19'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x7d0b('0x1a')](config[_0x7d0b('0x1b')],{'host':_0x7d0b('0x1c'),'port':0x18eb});var socket=require(_0x7d0b('0x1d'))(new Redis(config['redis']));require(_0x7d0b('0x1e'))['register'](socket);function respondWithStatusCode(_0x3309e2,_0x2d5c88){_0x2d5c88=_0x2d5c88||0xcc;return function(_0x4b597d){if(_0x4b597d){return _0x3309e2[_0x7d0b('0x1f')](_0x2d5c88);}return _0x3309e2[_0x7d0b('0x20')](_0x2d5c88)[_0x7d0b('0x21')]();};}function respondWithResult(_0x272aa9,_0x119400){_0x119400=_0x119400||0xc8;return function(_0x413dce){if(_0x413dce){return _0x272aa9[_0x7d0b('0x20')](_0x119400)[_0x7d0b('0x22')](_0x413dce);}};}function respondWithFilteredResult(_0x4ddede,_0x35622d){return function(_0x2ee4be){if(_0x2ee4be){var _0x11316f=typeof _0x35622d[_0x7d0b('0x23')]==='undefined'&&typeof _0x35622d[_0x7d0b('0x24')]===_0x7d0b('0x25');var _0x25d5aa=_0x2ee4be[_0x7d0b('0x26')];var _0x445aab=_0x11316f?0x0:_0x35622d['offset'];var _0x3cf0f1=_0x11316f?_0x2ee4be[_0x7d0b('0x26')]:_0x35622d[_0x7d0b('0x23')]+_0x35622d[_0x7d0b('0x24')];var _0x52e0f9;if(_0x3cf0f1>=_0x25d5aa){_0x3cf0f1=_0x25d5aa;_0x52e0f9=0xc8;}else{_0x52e0f9=0xce;}_0x4ddede[_0x7d0b('0x20')](_0x52e0f9);return _0x4ddede['set']('Content-Range',_0x445aab+'-'+_0x3cf0f1+'/'+_0x25d5aa)[_0x7d0b('0x22')](_0x2ee4be);}return null;};}function patchUpdates(_0x429c5c){return function(_0x21ce1e){try{jsonpatch[_0x7d0b('0x27')](_0x21ce1e,_0x429c5c,!![]);}catch(_0x26d06e){return BPromise[_0x7d0b('0x28')](_0x26d06e);}return _0x21ce1e[_0x7d0b('0x29')]();};}function saveUpdates(_0x46c14f,_0x3a3c07){return function(_0x527f6d){if(_0x527f6d){return _0x527f6d[_0x7d0b('0x2a')](_0x46c14f)[_0x7d0b('0x2b')](function(_0x119361){return _0x119361;});}return null;};}function removeEntity(_0x44e4d3,_0x146eac){return function(_0x50b737){if(_0x50b737){return _0x50b737['destroy']()[_0x7d0b('0x2b')](function(){var _0x270e3d=_0x50b737[_0x7d0b('0x2c')]({'plain':!![]});var _0x129f9b=_0x7d0b('0x2d');return db[_0x7d0b('0x2e')][_0x7d0b('0x2f')]({'where':{'type':_0x129f9b,'resourceId':_0x270e3d['id']}})[_0x7d0b('0x2b')](function(){return _0x50b737;});})['then'](function(){_0x44e4d3[_0x7d0b('0x20')](0xcc)[_0x7d0b('0x21')]();});}};}function handleEntityNotFound(_0x3e9d5a,_0x2720ce){return function(_0x3215d7){if(!_0x3215d7){_0x3e9d5a[_0x7d0b('0x1f')](0x194);}return _0x3215d7;};}function handleError(_0x5ca047,_0x1afdef){_0x1afdef=_0x1afdef||0x1f4;return function(_0xf3ee4f){logger[_0x7d0b('0x30')](_0xf3ee4f['stack']);if(_0xf3ee4f[_0x7d0b('0x31')]){delete _0xf3ee4f[_0x7d0b('0x31')];}_0x5ca047['status'](_0x1afdef)[_0x7d0b('0x32')](_0xf3ee4f);};}exports[_0x7d0b('0x33')]=function(_0x223a55,_0x4f6525){var _0x18782e={},_0x48b196={},_0x9823b1={'count':0x0,'rows':[]};var _0x25a22d=_[_0x7d0b('0x34')](db[_0x7d0b('0x35')][_0x7d0b('0x36')],function(_0x2f58d5){return{'name':_0x2f58d5[_0x7d0b('0x37')],'type':_0x2f58d5[_0x7d0b('0x38')]['key']};});_0x48b196['model']=_[_0x7d0b('0x34')](_0x25a22d,_0x7d0b('0x31'));_0x48b196[_0x7d0b('0x39')]=_[_0x7d0b('0x3a')](_0x223a55[_0x7d0b('0x39')]);_0x48b196[_0x7d0b('0x3b')]=_['intersection'](_0x48b196[_0x7d0b('0x3c')],_0x48b196[_0x7d0b('0x39')]);_0x18782e[_0x7d0b('0x3d')]=_['intersection'](_0x48b196[_0x7d0b('0x3c')],qs[_0x7d0b('0x3e')](_0x223a55[_0x7d0b('0x39')]['fields']));_0x18782e[_0x7d0b('0x3d')]=_0x18782e[_0x7d0b('0x3d')][_0x7d0b('0x3f')]?_0x18782e[_0x7d0b('0x3d')]:_0x48b196['model'];if(!_0x223a55[_0x7d0b('0x39')][_0x7d0b('0x40')](_0x7d0b('0x41'))){_0x18782e[_0x7d0b('0x24')]=qs[_0x7d0b('0x24')](_0x223a55['query']['limit']);_0x18782e[_0x7d0b('0x23')]=qs[_0x7d0b('0x23')](_0x223a55[_0x7d0b('0x39')][_0x7d0b('0x23')]);}_0x18782e[_0x7d0b('0x42')]=qs[_0x7d0b('0x43')](_0x223a55[_0x7d0b('0x39')][_0x7d0b('0x43')]);_0x18782e[_0x7d0b('0x44')]=qs['filters'](_[_0x7d0b('0x45')](_0x223a55[_0x7d0b('0x39')],_0x48b196['filters']),_0x25a22d);if(_0x223a55[_0x7d0b('0x39')][_0x7d0b('0x46')]){_0x18782e[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0x18782e[_0x7d0b('0x44')],{'$or':_[_0x7d0b('0x34')](_0x25a22d,function(_0x33ab9e){if(_0x33ab9e[_0x7d0b('0x38')]!==_0x7d0b('0x48')){var _0x174194={};_0x174194[_0x33ab9e['name']]={'$like':'%'+_0x223a55['query']['filter']+'%'};return _0x174194;}})});}_0x18782e=_['merge']({},_0x18782e,_0x223a55['options']);var _0x5b1696={'where':_0x18782e['where']};return db[_0x7d0b('0x35')][_0x7d0b('0x26')](_0x5b1696)[_0x7d0b('0x2b')](function(_0x153657){_0x9823b1[_0x7d0b('0x26')]=_0x153657;if(_0x223a55['query']['includeAll']){_0x18782e[_0x7d0b('0x49')]=[{'all':!![]}];}return db[_0x7d0b('0x35')][_0x7d0b('0x4a')](_0x18782e);})[_0x7d0b('0x2b')](function(_0x5a4fe3){_0x9823b1['rows']=_0x5a4fe3;return _0x9823b1;})[_0x7d0b('0x2b')](respondWithFilteredResult(_0x4f6525,_0x18782e))[_0x7d0b('0x4b')](handleError(_0x4f6525,null));};exports[_0x7d0b('0x4c')]=function(_0x22cdb6,_0x3bf73c){var _0x4ffc18={'raw':![],'where':{'id':_0x22cdb6['params']['id']}},_0x369b69={};_0x369b69['model']=_[_0x7d0b('0x3a')](db[_0x7d0b('0x35')][_0x7d0b('0x36')]);_0x369b69['query']=_[_0x7d0b('0x3a')](_0x22cdb6['query']);_0x369b69['filters']=_['intersection'](_0x369b69['model'],_0x369b69[_0x7d0b('0x39')]);_0x4ffc18[_0x7d0b('0x3d')]=_[_0x7d0b('0x4d')](_0x369b69[_0x7d0b('0x3c')],qs[_0x7d0b('0x3e')](_0x22cdb6['query'][_0x7d0b('0x3e')]));_0x4ffc18[_0x7d0b('0x3d')]=_0x4ffc18[_0x7d0b('0x3d')][_0x7d0b('0x3f')]?_0x4ffc18[_0x7d0b('0x3d')]:_0x369b69[_0x7d0b('0x3c')];if(_0x22cdb6['query']['includeAll']){_0x4ffc18[_0x7d0b('0x49')]=[{'all':!![]}];}_0x4ffc18=_[_0x7d0b('0x47')]({},_0x4ffc18,_0x22cdb6['options']);return db[_0x7d0b('0x35')][_0x7d0b('0x4e')](_0x4ffc18)[_0x7d0b('0x2b')](handleEntityNotFound(_0x3bf73c,null))[_0x7d0b('0x2b')](respondWithResult(_0x3bf73c,null))[_0x7d0b('0x4b')](handleError(_0x3bf73c,null));};exports[_0x7d0b('0x4f')]=function(_0x432cfd,_0x3d5708){return db[_0x7d0b('0x35')][_0x7d0b('0x4f')](_0x432cfd[_0x7d0b('0x50')],{})['then'](function(_0xd8ea6b){var _0x3333c6=_0x432cfd[_0x7d0b('0x51')][_0x7d0b('0x2c')]({'plain':!![]});if(!_0x3333c6)throw new Error(_0x7d0b('0x52'));if(_0x3333c6['role']===_0x7d0b('0x51')){var _0x14bafc=_0xd8ea6b[_0x7d0b('0x2c')]({'plain':!![]});var _0x12f9d3=_0x7d0b('0x2d');return db[_0x7d0b('0x53')][_0x7d0b('0x4e')]({'where':{'name':_0x12f9d3,'userProfileId':_0x3333c6[_0x7d0b('0x54')]},'raw':!![]})['then'](function(_0x54ca0b){if(_0x54ca0b&&_0x54ca0b['autoAssociation']===0x0){return db[_0x7d0b('0x2e')][_0x7d0b('0x4f')]({'name':_0x14bafc[_0x7d0b('0x31')],'resourceId':_0x14bafc['id'],'type':_0x54ca0b[_0x7d0b('0x31')],'sectionId':_0x54ca0b['id']},{})['then'](function(){return _0xd8ea6b;});}else{return _0xd8ea6b;}})[_0x7d0b('0x4b')](function(_0x330cf7){logger[_0x7d0b('0x30')](_0x7d0b('0x55'),_0x330cf7);throw _0x330cf7;});}return _0xd8ea6b;})[_0x7d0b('0x2b')](respondWithResult(_0x3d5708,0xc9))[_0x7d0b('0x4b')](handleError(_0x3d5708,null));};exports[_0x7d0b('0x2a')]=function(_0x149461,_0x45fa83){if(_0x149461[_0x7d0b('0x50')]['id']){delete _0x149461['body']['id'];}return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x149461['params']['id']}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x45fa83,null))[_0x7d0b('0x2b')](saveUpdates(_0x149461[_0x7d0b('0x50')],null))[_0x7d0b('0x2b')](respondWithResult(_0x45fa83,null))[_0x7d0b('0x4b')](handleError(_0x45fa83,null));};exports[_0x7d0b('0x2f')]=function(_0x5a7dd6,_0x54f400){return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x5a7dd6[_0x7d0b('0x56')]['id']}})['then'](handleEntityNotFound(_0x54f400,null))[_0x7d0b('0x2b')](removeEntity(_0x54f400,null))['catch'](handleError(_0x54f400,null));};exports[_0x7d0b('0x57')]=function(_0x38a015,_0x1b8e1c){return db[_0x7d0b('0x35')][_0x7d0b('0x57')]()['then'](respondWithResult(_0x1b8e1c,null))[_0x7d0b('0x4b')](handleError(_0x1b8e1c,null));};exports[_0x7d0b('0x58')]=function(_0x4a1fe4,_0x410fba,_0x2e89c2){if(_0x4a1fe4[_0x7d0b('0x50')]['id']){delete _0x4a1fe4['body']['id'];}return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x4a1fe4['params']['id']}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x410fba,null))['then'](function(_0x5c2d0e){if(_0x5c2d0e){_0x4a1fe4[_0x7d0b('0x50')][_0x7d0b('0x59')]=_0x5c2d0e['id'];return db['Disposition']['create'](_0x4a1fe4[_0x7d0b('0x50')]);}})[_0x7d0b('0x2b')](respondWithResult(_0x410fba,null))['catch'](handleError(_0x410fba,null));};exports[_0x7d0b('0x5a')]=function(_0x367b3b,_0x2a2d96,_0x1b28b5){var _0x596ec0={'raw':![],'where':{}};var _0x308dd4={};var _0x48bd47={'count':0x0,'rows':[]};return db[_0x7d0b('0x35')][_0x7d0b('0x5b')]({'where':{'id':_0x367b3b[_0x7d0b('0x56')]['id']}})['then'](handleEntityNotFound(_0x2a2d96,null))[_0x7d0b('0x2b')](function(_0x5c4cd8){if(_0x5c4cd8){_0x308dd4['model']=_['keys'](db[_0x7d0b('0x5c')][_0x7d0b('0x36')]);_0x308dd4[_0x7d0b('0x39')]=_[_0x7d0b('0x3a')](_0x367b3b['query']);_0x308dd4[_0x7d0b('0x3b')]=_[_0x7d0b('0x4d')](_0x308dd4['model'],_0x308dd4[_0x7d0b('0x39')]);_0x596ec0[_0x7d0b('0x3d')]=_['intersection'](_0x308dd4[_0x7d0b('0x3c')],qs['fields'](_0x367b3b['query'][_0x7d0b('0x3e')]));_0x596ec0['attributes']=_0x596ec0[_0x7d0b('0x3d')][_0x7d0b('0x3f')]?_0x596ec0[_0x7d0b('0x3d')]:_0x308dd4[_0x7d0b('0x3c')];if(!_0x367b3b[_0x7d0b('0x39')][_0x7d0b('0x40')]('nolimit')){_0x596ec0['limit']=qs[_0x7d0b('0x24')](_0x367b3b[_0x7d0b('0x39')][_0x7d0b('0x24')]);_0x596ec0['offset']=qs[_0x7d0b('0x23')](_0x367b3b[_0x7d0b('0x39')]['offset']);}_0x596ec0[_0x7d0b('0x42')]=qs[_0x7d0b('0x43')](_0x367b3b[_0x7d0b('0x39')]['sort']);_0x596ec0['where']=qs[_0x7d0b('0x3b')](_[_0x7d0b('0x45')](_0x367b3b[_0x7d0b('0x39')],_0x308dd4[_0x7d0b('0x3b')]));_0x596ec0[_0x7d0b('0x44')][_0x7d0b('0x59')]=_0x5c4cd8['id'];if(_0x367b3b[_0x7d0b('0x39')][_0x7d0b('0x46')]){_0x596ec0[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0x596ec0[_0x7d0b('0x44')],{'$or':_['map'](_0x596ec0['attributes'],function(_0x1dd543){var _0x49c5d3={};_0x49c5d3[_0x1dd543]={'$like':'%'+_0x367b3b[_0x7d0b('0x39')][_0x7d0b('0x46')]+'%'};return _0x49c5d3;})});}_0x596ec0=_[_0x7d0b('0x47')]({},_0x596ec0,_0x367b3b['options']);return db[_0x7d0b('0x5c')]['count']({'where':_0x596ec0['where']})[_0x7d0b('0x2b')](function(_0x1bd7a6){_0x48bd47['count']=_0x1bd7a6;if(_0x367b3b[_0x7d0b('0x39')][_0x7d0b('0x5d')]){_0x596ec0[_0x7d0b('0x49')]=[{'all':!![]}];}return db[_0x7d0b('0x5c')][_0x7d0b('0x4a')](_0x596ec0);})[_0x7d0b('0x2b')](function(_0x2ee215){_0x48bd47[_0x7d0b('0x5e')]=_0x2ee215;return _0x48bd47;});}})[_0x7d0b('0x2b')](respondWithFilteredResult(_0x2a2d96,_0x596ec0))[_0x7d0b('0x4b')](handleError(_0x2a2d96,null));};exports['removeDispositions']=function(_0x255f44,_0x4efe6c,_0x23c09a){return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x255f44[_0x7d0b('0x56')]['id']}})['then'](handleEntityNotFound(_0x4efe6c,null))[_0x7d0b('0x2b')](function(_0x4a6380){if(_0x4a6380){return _0x4a6380[_0x7d0b('0x5f')](_0x255f44[_0x7d0b('0x39')][_0x7d0b('0x60')]);}})[_0x7d0b('0x2b')](respondWithStatusCode(_0x4efe6c,null))[_0x7d0b('0x4b')](handleError(_0x4efe6c,null));};exports['addContacts']=function(_0x28ebd1,_0x3d92a7,_0x38271f){return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x28ebd1[_0x7d0b('0x56')]['id']}})['then'](handleEntityNotFound(_0x3d92a7,null))[_0x7d0b('0x2b')](function(_0x3cf1bc){if(_0x3cf1bc){var _0x16217d=[];var _0x4d2bfa={'success':[],'errors':[]};return db[_0x7d0b('0x61')][_0x7d0b('0x57')]()['then'](function(_0x319305){if(_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x62')]&&_[_0x7d0b('0x63')](_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x62')])){if(_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x62')][_0x7d0b('0x3f')]){_0x28ebd1[_0x7d0b('0x50')]['tags']=_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x62')][_0x7d0b('0x64')](';')+';';}else{_0x28ebd1['body'][_0x7d0b('0x62')]=null;}}else{_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x62')]=null;}if(_0x28ebd1[_0x7d0b('0x50')]&&_[_0x7d0b('0x63')](_0x28ebd1[_0x7d0b('0x50')])){for(var _0x71c8c=0x0;_0x71c8c<_0x28ebd1[_0x7d0b('0x50')][_0x7d0b('0x3f')];_0x71c8c+=0x1){_0x28ebd1[_0x7d0b('0x50')][_0x71c8c][_0x7d0b('0x59')]=_0x28ebd1[_0x7d0b('0x56')]['id'];_0x16217d[_0x7d0b('0x65')](_0x28ebd1['body'][_0x71c8c]);}return BPromise[_0x7d0b('0x66')](_0x16217d,function(_0x93159d){return db['CmContact'][_0x7d0b('0x4f')](_[_0x7d0b('0x67')](_0x93159d,[_0x7d0b('0x60'),'id'])||{},{'fields':_[_0x7d0b('0x3a')](_0x319305),'raw':!![]})[_0x7d0b('0x2b')](function(_0x46ac74){_0x4d2bfa[_0x7d0b('0x68')][_0x7d0b('0x65')](_0x46ac74[_0x7d0b('0x69')]);})[_0x7d0b('0x4b')](function(_0x3f3438){_0x4d2bfa[_0x7d0b('0x6a')][_0x7d0b('0x65')]({'data':_0x93159d,'error':_0x3f3438['message']});});})[_0x7d0b('0x2b')](function(_0x51c235){return _0x4d2bfa;})[_0x7d0b('0x4b')](function(_0x580d3b){return _0x580d3b;});}else{_0x3d92a7[_0x7d0b('0x20')](0x190)[_0x7d0b('0x22')]({'message':_0x7d0b('0x6b')});}});}})[_0x7d0b('0x2b')](respondWithResult(_0x3d92a7,null))[_0x7d0b('0x4b')](handleError(_0x3d92a7,null));};exports['getContacts']=function(_0x155448,_0x15e9e1,_0x281504){var _0x3bdf52;return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x155448[_0x7d0b('0x56')]['id']},'include':[{'model':db[_0x7d0b('0x6c')],'as':_0x7d0b('0x6d')}]})[_0x7d0b('0x2b')](handleEntityNotFound(_0x15e9e1,null))[_0x7d0b('0x2b')](function(_0x426044){if(_0x426044){_0x3bdf52=_0x426044;return db['CmContact'][_0x7d0b('0x36')];}})['then'](function(_0x4d2f78){if(_0x4d2f78){var _0x2cdd15={};var _0x1134aa={};_0x1134aa['model']=_[_0x7d0b('0x6e')](_[_0x7d0b('0x3a')](_0x4d2f78),_[_0x7d0b('0x34')](_0x3bdf52[_0x7d0b('0x6d')],function(_0x344f06){return util[_0x7d0b('0x6f')]('cf_%d',_0x344f06['id']);}));_0x1134aa['query']=_['keys'](_0x155448[_0x7d0b('0x39')]);_0x1134aa[_0x7d0b('0x3b')]=_['intersection'](_0x1134aa[_0x7d0b('0x3c')],_0x1134aa[_0x7d0b('0x39')]);_0x2cdd15[_0x7d0b('0x3d')]=_[_0x7d0b('0x4d')](_0x1134aa[_0x7d0b('0x3c')],qs['fields'](_0x155448[_0x7d0b('0x39')][_0x7d0b('0x3e')]));_0x2cdd15['attributes']=_0x2cdd15['attributes'][_0x7d0b('0x3f')]?_0x2cdd15['attributes']:_0x1134aa[_0x7d0b('0x3c')];if(!_0x155448[_0x7d0b('0x39')][_0x7d0b('0x40')](_0x7d0b('0x41'))){_0x2cdd15[_0x7d0b('0x24')]=qs[_0x7d0b('0x24')](_0x155448[_0x7d0b('0x39')][_0x7d0b('0x24')]);_0x2cdd15[_0x7d0b('0x23')]=qs[_0x7d0b('0x23')](_0x155448[_0x7d0b('0x39')][_0x7d0b('0x23')]);}_0x2cdd15[_0x7d0b('0x42')]=qs[_0x7d0b('0x43')](_0x155448[_0x7d0b('0x39')][_0x7d0b('0x43')]);_0x2cdd15[_0x7d0b('0x44')]=qs[_0x7d0b('0x3b')](_[_0x7d0b('0x45')](_0x155448[_0x7d0b('0x39')],_0x1134aa[_0x7d0b('0x3b')]));_0x2cdd15[_0x7d0b('0x70')]=!![];if(_0x155448[_0x7d0b('0x39')][_0x7d0b('0x46')]){_0x2cdd15[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0x2cdd15['where'],{'$or':_['map'](_0x2cdd15[_0x7d0b('0x3d')],function(_0x17d86e){var _0x4477e0={};_0x4477e0[_0x17d86e]={'$like':'%'+_0x155448['query'][_0x7d0b('0x46')]+'%'};return _0x4477e0;})});}_0x2cdd15=_[_0x7d0b('0x47')]({},_0x2cdd15,_0x155448['options']);return _0x3bdf52['getContacts'](_0x2cdd15);}})[_0x7d0b('0x2b')](respondWithResult(_0x15e9e1,null))[_0x7d0b('0x4b')](handleError(_0x15e9e1,null));};exports[_0x7d0b('0x71')]=function(_0xf2d5c7,_0x18094c,_0x2fc7de){var _0x122ba0;var _0x216e36;var _0x524570;var _0x17a236=_0xf2d5c7[_0x7d0b('0x56')]['id'];csv_results=[];return db[_0x7d0b('0x72')]['findAll']({'attributes':['id',_0x7d0b('0x31')],'raw':!![],'order':[_0x7d0b('0x73')]})['then'](function(_0x45f470){_0x122ba0=_0x45f470;var _0x2bd03a=_[_0x7d0b('0x3a')](db[_0x7d0b('0x61')][_0x7d0b('0x36')]);return db[_0x7d0b('0x6c')]['findAll']({'raw':!![],'attributes':['id',_0x7d0b('0x74')]})[_0x7d0b('0x2b')](function(_0xa854ee){_0x216e36=_0xa854ee;var _0xc49ab5=squel[_0x7d0b('0x75')]()[_0x7d0b('0x3e')](_0x2bd03a)['from'](_0x7d0b('0x76'),'c')[_0x7d0b('0x44')]('c.ListId\x20=\x20?',_0x17a236)[_0x7d0b('0x44')](_0x7d0b('0x77'))[_0x7d0b('0x78')]();for(var _0x5f4ae4=0x0;_0x5f4ae4<_0x216e36[_0x7d0b('0x3f')];_0x5f4ae4++){_0xc49ab5[_0x7d0b('0x79')](_0x7d0b('0x7a')+_0x216e36[_0x5f4ae4]['id'],'customField_'+_0x216e36[_0x5f4ae4]['alias']);}for(var _0x5f4ae4=0x0;_0x5f4ae4<_0x122ba0['length'];_0x5f4ae4++){_0xc49ab5[_0x7d0b('0x79')](squel['select']()[_0x7d0b('0x79')](_0x7d0b('0x7b'))['from']('cm_contact_has_items')[_0x7d0b('0x44')](_0x7d0b('0x7c'),_0x122ba0[_0x5f4ae4]['id'])[_0x7d0b('0x44')]('CmContactId\x20=\x20c.id'),_0x7d0b('0x7d')+_0x122ba0[_0x5f4ae4][_0x7d0b('0x31')]);_0xc49ab5['field'](squel[_0x7d0b('0x75')]()['field'](_0x7d0b('0x7e'))[_0x7d0b('0x7f')](_0x7d0b('0x80'))[_0x7d0b('0x44')](_0x7d0b('0x7c'),_0x122ba0[_0x5f4ae4]['id'])[_0x7d0b('0x44')]('CmContactId\x20=\x20c.id'),_0x7d0b('0x81')+_0x122ba0[_0x5f4ae4][_0x7d0b('0x31')]);}var _0xecaf74=[];_0xecaf74[_0x7d0b('0x65')](_0xc49ab5[_0x7d0b('0x82')]());BPromise['each'](_0xecaf74,handleQuery)[_0x7d0b('0x2b')](function(_0x1d6227){handleQuery(_0xc49ab5[_0x7d0b('0x82')]());var _0x55994f=csv_results[0x0];if(!_[_0x7d0b('0x83')](_0x55994f)){var _0xe0ff50=toCsv(_0x55994f);var _0x15d100=Date[_0x7d0b('0x84')]();fs['writeFileSync'](util[_0x7d0b('0x6f')](_0x7d0b('0x85'),_0x17a236,_0x15d100),_0xe0ff50);_0x18094c[_0x7d0b('0x86')](_0x7d0b('0x87'),_0x7d0b('0x88')+util[_0x7d0b('0x6f')](_0x7d0b('0x89'),_0x17a236,_0x15d100));_0x18094c[_0x7d0b('0x86')](_0x7d0b('0x8a'),'text/csv');return _0x18094c[_0x7d0b('0x8b')](util[_0x7d0b('0x6f')]('/tmp/list_%d_%s.csv',_0x17a236,_0x15d100));}else{return _0x18094c[_0x7d0b('0x1f')](0xcc);}});});});};exports['addCustomField']=function(_0x12f2df,_0x167c57,_0x582a77){var _0x2b7213;delete _0x12f2df[_0x7d0b('0x50')]['id'];return db[_0x7d0b('0x35')][_0x7d0b('0x5b')]({'where':{'id':_0x12f2df[_0x7d0b('0x56')]['id']}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x167c57,null))[_0x7d0b('0x2b')](function(_0x47e310){if(_0x47e310){return db[_0x7d0b('0x8c')][_0x7d0b('0x8d')](function(_0x270963){return db['CmCustomField']['create'](_0x12f2df[_0x7d0b('0x50')],{'transaction':_0x270963})['then'](function(_0x3bc62b){_0x2b7213=_0x3bc62b;return _0x47e310[_0x7d0b('0x8e')](_0x3bc62b,{'transaction':_0x270963});})[_0x7d0b('0x2b')](function(){var _0x2bb79b={'type':db['Sequelize']['TEXT'],'transaction':_0x270963};switch(_0x12f2df['body'][_0x7d0b('0x38')]){case _0x7d0b('0x8f'):_0x2bb79b[_0x7d0b('0x38')]=db[_0x7d0b('0x90')][_0x7d0b('0x91')];break;case _0x7d0b('0x92'):_0x2bb79b[_0x7d0b('0x38')]=db[_0x7d0b('0x90')][_0x7d0b('0x93')];break;case _0x7d0b('0x94'):_0x2bb79b[_0x7d0b('0x38')]=db[_0x7d0b('0x90')][_0x7d0b('0x95')];_0x2bb79b['defaultValue']=![];break;default:}return db[_0x7d0b('0x8c')][_0x7d0b('0x96')][_0x7d0b('0x97')](_0x7d0b('0x76'),util['format'](_0x7d0b('0x98'),_0x2b7213['id']),_0x2bb79b);})[_0x7d0b('0x2b')](function(){return _0x2b7213;});});}})[_0x7d0b('0x2b')](respondWithResult(_0x167c57,null))[_0x7d0b('0x4b')](handleError(_0x167c57,null));};exports[_0x7d0b('0x99')]=function(_0x465cd5,_0x2bcf5a,_0x263b41){var _0xf655c9={};var _0x3e2950={};var _0x378f05;var _0x31d454;return db[_0x7d0b('0x35')][_0x7d0b('0x5b')]({'where':{'id':_0x465cd5[_0x7d0b('0x56')]['id']}})['then'](handleEntityNotFound(_0x2bcf5a,null))[_0x7d0b('0x2b')](function(_0x1c1899){if(_0x1c1899){_0x378f05=_0x1c1899;_0x3e2950[_0x7d0b('0x3c')]=_[_0x7d0b('0x3a')](db['CmCustomField'][_0x7d0b('0x36')]);_0x3e2950[_0x7d0b('0x39')]=_[_0x7d0b('0x3a')](_0x465cd5[_0x7d0b('0x39')]);_0x3e2950[_0x7d0b('0x3b')]=_[_0x7d0b('0x4d')](_0x3e2950['model'],_0x3e2950[_0x7d0b('0x39')]);_0xf655c9[_0x7d0b('0x3d')]=_[_0x7d0b('0x4d')](_0x3e2950[_0x7d0b('0x3c')],qs[_0x7d0b('0x3e')](_0x465cd5['query'][_0x7d0b('0x3e')]));_0xf655c9[_0x7d0b('0x3d')]=_0xf655c9['attributes'][_0x7d0b('0x3f')]?_0xf655c9[_0x7d0b('0x3d')]:_0x3e2950['model'];_0xf655c9[_0x7d0b('0x42')]=qs[_0x7d0b('0x43')](_0x465cd5[_0x7d0b('0x39')][_0x7d0b('0x43')]);_0xf655c9[_0x7d0b('0x44')]=qs[_0x7d0b('0x3b')](_[_0x7d0b('0x45')](_0x465cd5['query'],_0x3e2950[_0x7d0b('0x3b')]));_0xf655c9[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0xf655c9['where'],{'$or':[{'ListId':_0x1c1899['id']},{'ListId':null}]});if(_0x465cd5['query'][_0x7d0b('0x46')]){_0xf655c9[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0xf655c9[_0x7d0b('0x44')],{'$or':_[_0x7d0b('0x34')](_0xf655c9[_0x7d0b('0x3d')],function(_0x15ebe6){var _0x555bb4={};_0x555bb4[_0x15ebe6]={'$like':'%'+_0x465cd5['query'][_0x7d0b('0x46')]+'%'};return _0x555bb4;})});}_0xf655c9=_[_0x7d0b('0x47')]({},_0xf655c9,_0x465cd5[_0x7d0b('0x9a')]);return db[_0x7d0b('0x6c')][_0x7d0b('0x9b')](_0xf655c9);}})['then'](respondWithResult(_0x2bcf5a,null))[_0x7d0b('0x4b')](handleError(_0x2bcf5a,null));};exports[_0x7d0b('0x9c')]=function(_0xfd301a,_0x352861){return db[_0x7d0b('0x6c')][_0x7d0b('0x9b')]({'where':{'ListId':null}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x352861,null))[_0x7d0b('0x2b')](function(_0x3494fe){return _0x3494fe;})[_0x7d0b('0x2b')](respondWithResult(_0x352861,null))[_0x7d0b('0x4b')](handleError(_0x352861,null));};exports[_0x7d0b('0x9d')]=function(_0x2ecee9,_0x1758f3,_0x59f604){return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x2ecee9[_0x7d0b('0x56')]['id']}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x1758f3,null))[_0x7d0b('0x2b')](function(_0x2a9e15){if(_0x2a9e15){return _0x2a9e15[_0x7d0b('0x9d')](_0x2ecee9['body']['ids'],_[_0x7d0b('0x67')](_0x2ecee9[_0x7d0b('0x50')],['ids','id'])||{})[_0x7d0b('0x9e')](function(_0x333b0){for(var _0x435898=0x0;_0x435898<_0x2ecee9[_0x7d0b('0x50')]['ids'][_0x7d0b('0x3f')];_0x435898+=0x1){socket[_0x7d0b('0x9f')](_0x7d0b('0xa0'),{'UserId':Number(_0x2ecee9[_0x7d0b('0x50')]['ids'][_0x435898]),'CmListId':Number(_0x2ecee9[_0x7d0b('0x56')]['id'])});}return _0x333b0;});}})['then'](respondWithResult(_0x1758f3,null))[_0x7d0b('0x4b')](handleError(_0x1758f3,null));};exports[_0x7d0b('0xa1')]=function(_0x54443d,_0x4edcee,_0x2a5057){return db[_0x7d0b('0x35')][_0x7d0b('0x4e')]({'where':{'id':_0x54443d['params']['id']}})[_0x7d0b('0x2b')](handleEntityNotFound(_0x4edcee,null))[_0x7d0b('0x2b')](function(_0x1366f1){if(_0x1366f1){return _0x1366f1[_0x7d0b('0xa1')](_0x54443d['query'][_0x7d0b('0x60')])['then'](function(){if(_[_0x7d0b('0x63')](_0x54443d[_0x7d0b('0x39')][_0x7d0b('0x60')])){for(var _0x1499eb=0x0;_0x1499eb<_0x54443d['query'][_0x7d0b('0x60')]['length'];_0x1499eb+=0x1){socket[_0x7d0b('0x9f')](_0x7d0b('0xa2'),{'UserId':Number(_0x54443d[_0x7d0b('0x39')][_0x7d0b('0x60')][_0x1499eb]),'CmListId':Number(_0x54443d[_0x7d0b('0x56')]['id'])});}}else{socket[_0x7d0b('0x9f')](_0x7d0b('0xa2'),{'UserId':Number(_0x54443d['query']['ids']),'CmListId':Number(_0x54443d[_0x7d0b('0x56')]['id'])});}});}})[_0x7d0b('0x2b')](respondWithStatusCode(_0x4edcee,null))['catch'](handleError(_0x4edcee,null));};exports['getAgents']=function(_0x155297,_0x53f86d,_0x2d53cc){var _0x21091a={};var _0x2eb744={};var _0xd2eac7;var _0x499f58;return db[_0x7d0b('0x35')][_0x7d0b('0x5b')]({'where':{'id':_0x155297['params']['id']}})['then'](handleEntityNotFound(_0x53f86d,null))[_0x7d0b('0x2b')](function(_0x2fdbfc){if(_0x2fdbfc){_0xd2eac7=_0x2fdbfc;_0x2eb744[_0x7d0b('0x3c')]=_[_0x7d0b('0x3a')](db[_0x7d0b('0xa3')][_0x7d0b('0x36')]);_0x2eb744[_0x7d0b('0x39')]=_[_0x7d0b('0x3a')](_0x155297['query']);_0x2eb744[_0x7d0b('0x3b')]=_[_0x7d0b('0x4d')](_0x2eb744[_0x7d0b('0x3c')],_0x2eb744[_0x7d0b('0x39')]);_0x21091a[_0x7d0b('0x3d')]=_['intersection'](_0x2eb744[_0x7d0b('0x3c')],qs[_0x7d0b('0x3e')](_0x155297[_0x7d0b('0x39')][_0x7d0b('0x3e')]));_0x21091a[_0x7d0b('0x3d')]=_0x21091a[_0x7d0b('0x3d')][_0x7d0b('0x3f')]?_0x21091a['attributes']:_0x2eb744[_0x7d0b('0x3c')];_0x21091a['order']=qs['sort'](_0x155297[_0x7d0b('0x39')]['sort']);_0x21091a[_0x7d0b('0x44')]=qs['filters'](_[_0x7d0b('0x45')](_0x155297[_0x7d0b('0x39')],_0x2eb744[_0x7d0b('0x3b')]));if(_0x155297[_0x7d0b('0x39')][_0x7d0b('0x46')]){_0x21091a[_0x7d0b('0x44')]=_[_0x7d0b('0x47')](_0x21091a[_0x7d0b('0x44')],{'$or':_[_0x7d0b('0x34')](_0x21091a[_0x7d0b('0x3d')],function(_0x3bb992){var _0x14dc1b={};_0x14dc1b[_0x3bb992]={'$like':'%'+_0x155297[_0x7d0b('0x39')][_0x7d0b('0x46')]+'%'};return _0x14dc1b;})});}_0x21091a=_[_0x7d0b('0x47')]({},_0x21091a,_0x155297[_0x7d0b('0x9a')]);return _0xd2eac7[_0x7d0b('0xa4')](_0x21091a);}})[_0x7d0b('0x2b')](function(_0x46bdfb){if(_0x46bdfb){_0x499f58=_0x46bdfb[_0x7d0b('0x3f')];if(!_0x155297[_0x7d0b('0x39')][_0x7d0b('0x40')]('nolimit')){_0x21091a[_0x7d0b('0x24')]=qs[_0x7d0b('0x24')](_0x155297[_0x7d0b('0x39')][_0x7d0b('0x24')]);_0x21091a['offset']=qs[_0x7d0b('0x23')](_0x155297[_0x7d0b('0x39')]['offset']);}return _0xd2eac7[_0x7d0b('0xa4')](_0x21091a);}})['then'](function(_0x28f8d8){if(_0x28f8d8){return _0x28f8d8?{'count':_0x499f58,'rows':_0x28f8d8}:null;}})[_0x7d0b('0x2b')](respondWithResult(_0x53f86d,null))[_0x7d0b('0x4b')](handleError(_0x53f86d,null));};function handleQuery(_0x2e3d5d){logger[_0x7d0b('0xa5')](_0x2e3d5d);return db[_0x7d0b('0x8c')]['query'](_0x2e3d5d)[_0x7d0b('0x9e')](function(_0x13ea60){csv_results['push'](_0x13ea60);})[_0x7d0b('0x4b')](function(_0x533394){logger[_0x7d0b('0x30')](_0x533394[_0x7d0b('0xa6')]);});} \ No newline at end of file +var _0x2c7a=['emit','userCmList:save','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','reject','save','update','then','destroy','UserProfileResource','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','CmList','includeAll','include','findAll','catch','params','merge','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','Disposition','getDispositions','findOne','rows','ids','addContacts','CmContact','tags','isArray','join','push','each','success','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','c.cf_','field','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','getGlobalCustomFields','findAndCountAll','addAgents','omit','spread'];(function(_0x163323,_0x18bd4f){var _0x1f2ea8=function(_0x452851){while(--_0x452851){_0x163323['push'](_0x163323['shift']());}};_0x1f2ea8(++_0x18bd4f);}(_0x2c7a,0x1dd));var _0xa2c7=function(_0x3351bf,_0x1acad8){_0x3351bf=_0x3351bf-0x0;var _0x535d15=_0x2c7a[_0x3351bf];return _0x535d15;};'use strict';var emlformat=require(_0xa2c7('0x0'));var rimraf=require(_0xa2c7('0x1'));var zipdir=require(_0xa2c7('0x2'));var jsonpatch=require(_0xa2c7('0x3'));var rp=require(_0xa2c7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa2c7('0x5'));var util=require(_0xa2c7('0x6'));var path=require('path');var sox=require(_0xa2c7('0x7'));var csv=require(_0xa2c7('0x8'));var ejs=require(_0xa2c7('0x9'));var fs=require('fs');var fs_extra=require(_0xa2c7('0xa'));var _=require(_0xa2c7('0xb'));var squel=require('squel');var crypto=require(_0xa2c7('0xc'));var jsforce=require(_0xa2c7('0xd'));var deskjs=require(_0xa2c7('0xe'));var toCsv=require(_0xa2c7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2c7('0xf'));var qs=require(_0xa2c7('0x10'));var as=require(_0xa2c7('0x11'));var hardwareService=require(_0xa2c7('0x12'));var logger=require(_0xa2c7('0x13'))('api');var utils=require(_0xa2c7('0x14'));var config=require(_0xa2c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0xa2c7('0x16')]=_[_0xa2c7('0x17')](config[_0xa2c7('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2c7('0x18'))(new Redis(config[_0xa2c7('0x16')]));require(_0xa2c7('0x19'))[_0xa2c7('0x1a')](socket);function respondWithStatusCode(_0x58e5a2,_0x330c57){_0x330c57=_0x330c57||0xcc;return function(_0xa34039){if(_0xa34039){return _0x58e5a2[_0xa2c7('0x1b')](_0x330c57);}return _0x58e5a2[_0xa2c7('0x1c')](_0x330c57)[_0xa2c7('0x1d')]();};}function respondWithResult(_0x3414fe,_0x21ae14){_0x21ae14=_0x21ae14||0xc8;return function(_0x5db0ec){if(_0x5db0ec){return _0x3414fe[_0xa2c7('0x1c')](_0x21ae14)['json'](_0x5db0ec);}};}function respondWithFilteredResult(_0x370c91,_0x2254fe){return function(_0x148cda){if(_0x148cda){var _0x564e19=typeof _0x2254fe[_0xa2c7('0x1e')]===_0xa2c7('0x1f')&&typeof _0x2254fe['limit']===_0xa2c7('0x1f');var _0x301f17=_0x148cda[_0xa2c7('0x20')];var _0xf775aa=_0x564e19?0x0:_0x2254fe[_0xa2c7('0x1e')];var _0x80f1d1=_0x564e19?_0x148cda[_0xa2c7('0x20')]:_0x2254fe[_0xa2c7('0x1e')]+_0x2254fe[_0xa2c7('0x21')];var _0x16037b;if(_0x80f1d1>=_0x301f17){_0x80f1d1=_0x301f17;_0x16037b=0xc8;}else{_0x16037b=0xce;}_0x370c91[_0xa2c7('0x1c')](_0x16037b);return _0x370c91[_0xa2c7('0x22')]('Content-Range',_0xf775aa+'-'+_0x80f1d1+'/'+_0x301f17)['json'](_0x148cda);}return null;};}function patchUpdates(_0x44eedc){return function(_0x50269f){try{jsonpatch['apply'](_0x50269f,_0x44eedc,!![]);}catch(_0x59f145){return BPromise[_0xa2c7('0x23')](_0x59f145);}return _0x50269f[_0xa2c7('0x24')]();};}function saveUpdates(_0x43823d,_0x2aea4f){return function(_0x45f198){if(_0x45f198){return _0x45f198[_0xa2c7('0x25')](_0x43823d)[_0xa2c7('0x26')](function(_0x1d781e){return _0x1d781e;});}return null;};}function removeEntity(_0xb0164a,_0x5d6e6b){return function(_0x58f578){if(_0x58f578){return _0x58f578[_0xa2c7('0x27')]()[_0xa2c7('0x26')](function(){var _0x47b839=_0x58f578['get']({'plain':!![]});var _0x4f4c22='Lists';return db[_0xa2c7('0x28')][_0xa2c7('0x27')]({'where':{'type':_0x4f4c22,'resourceId':_0x47b839['id']}})['then'](function(){return _0x58f578;});})[_0xa2c7('0x26')](function(){_0xb0164a[_0xa2c7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b488f,_0x44fcdb){return function(_0x3bcaf5){if(!_0x3bcaf5){_0x5b488f[_0xa2c7('0x1b')](0x194);}return _0x3bcaf5;};}function handleError(_0x1df39c,_0x3a0518){_0x3a0518=_0x3a0518||0x1f4;return function(_0x3a6353){logger['error'](_0x3a6353['stack']);if(_0x3a6353[_0xa2c7('0x29')]){delete _0x3a6353[_0xa2c7('0x29')];}_0x1df39c['status'](_0x3a0518)['send'](_0x3a6353);};}exports[_0xa2c7('0x2a')]=function(_0x49039e,_0x1a3ddc){var _0x1241ee={},_0x2f3f53={},_0x584347={'count':0x0,'rows':[]};var _0x2586ef=_[_0xa2c7('0x2b')](db['CmList'][_0xa2c7('0x2c')],function(_0x1bb1de){return{'name':_0x1bb1de[_0xa2c7('0x2d')],'type':_0x1bb1de[_0xa2c7('0x2e')][_0xa2c7('0x2f')]};});_0x2f3f53['model']=_[_0xa2c7('0x2b')](_0x2586ef,'name');_0x2f3f53['query']=_[_0xa2c7('0x30')](_0x49039e[_0xa2c7('0x31')]);_0x2f3f53[_0xa2c7('0x32')]=_[_0xa2c7('0x33')](_0x2f3f53[_0xa2c7('0x34')],_0x2f3f53['query']);_0x1241ee[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0x2f3f53['model'],qs[_0xa2c7('0x36')](_0x49039e[_0xa2c7('0x31')]['fields']));_0x1241ee[_0xa2c7('0x35')]=_0x1241ee[_0xa2c7('0x35')][_0xa2c7('0x37')]?_0x1241ee[_0xa2c7('0x35')]:_0x2f3f53[_0xa2c7('0x34')];if(!_0x49039e[_0xa2c7('0x31')][_0xa2c7('0x38')](_0xa2c7('0x39'))){_0x1241ee[_0xa2c7('0x21')]=qs[_0xa2c7('0x21')](_0x49039e[_0xa2c7('0x31')][_0xa2c7('0x21')]);_0x1241ee['offset']=qs[_0xa2c7('0x1e')](_0x49039e[_0xa2c7('0x31')][_0xa2c7('0x1e')]);}_0x1241ee[_0xa2c7('0x3a')]=qs[_0xa2c7('0x3b')](_0x49039e[_0xa2c7('0x31')]['sort']);_0x1241ee[_0xa2c7('0x3c')]=qs[_0xa2c7('0x32')](_[_0xa2c7('0x3d')](_0x49039e[_0xa2c7('0x31')],_0x2f3f53[_0xa2c7('0x32')]),_0x2586ef);if(_0x49039e['query'][_0xa2c7('0x3e')]){_0x1241ee[_0xa2c7('0x3c')]=_['merge'](_0x1241ee[_0xa2c7('0x3c')],{'$or':_[_0xa2c7('0x2b')](_0x2586ef,function(_0x52989d){if(_0x52989d[_0xa2c7('0x2e')]!==_0xa2c7('0x3f')){var _0x591529={};_0x591529[_0x52989d[_0xa2c7('0x29')]]={'$like':'%'+_0x49039e[_0xa2c7('0x31')][_0xa2c7('0x3e')]+'%'};return _0x591529;}})});}_0x1241ee=_['merge']({},_0x1241ee,_0x49039e[_0xa2c7('0x40')]);var _0x1ff0d1={'where':_0x1241ee[_0xa2c7('0x3c')]};return db[_0xa2c7('0x41')][_0xa2c7('0x20')](_0x1ff0d1)['then'](function(_0x562928){_0x584347[_0xa2c7('0x20')]=_0x562928;if(_0x49039e[_0xa2c7('0x31')][_0xa2c7('0x42')]){_0x1241ee[_0xa2c7('0x43')]=[{'all':!![]}];}return db['CmList'][_0xa2c7('0x44')](_0x1241ee);})[_0xa2c7('0x26')](function(_0x55de2c){_0x584347['rows']=_0x55de2c;return _0x584347;})[_0xa2c7('0x26')](respondWithFilteredResult(_0x1a3ddc,_0x1241ee))[_0xa2c7('0x45')](handleError(_0x1a3ddc,null));};exports['show']=function(_0x13d3b6,_0x4e4b26){var _0x202ad6={'raw':![],'where':{'id':_0x13d3b6[_0xa2c7('0x46')]['id']}},_0x3b843a={};_0x3b843a[_0xa2c7('0x34')]=_[_0xa2c7('0x30')](db[_0xa2c7('0x41')][_0xa2c7('0x2c')]);_0x3b843a['query']=_[_0xa2c7('0x30')](_0x13d3b6[_0xa2c7('0x31')]);_0x3b843a['filters']=_[_0xa2c7('0x33')](_0x3b843a[_0xa2c7('0x34')],_0x3b843a[_0xa2c7('0x31')]);_0x202ad6[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0x3b843a['model'],qs[_0xa2c7('0x36')](_0x13d3b6[_0xa2c7('0x31')][_0xa2c7('0x36')]));_0x202ad6[_0xa2c7('0x35')]=_0x202ad6[_0xa2c7('0x35')][_0xa2c7('0x37')]?_0x202ad6[_0xa2c7('0x35')]:_0x3b843a[_0xa2c7('0x34')];if(_0x13d3b6[_0xa2c7('0x31')][_0xa2c7('0x42')]){_0x202ad6[_0xa2c7('0x43')]=[{'all':!![]}];}_0x202ad6=_[_0xa2c7('0x47')]({},_0x202ad6,_0x13d3b6[_0xa2c7('0x40')]);return db[_0xa2c7('0x41')][_0xa2c7('0x48')](_0x202ad6)[_0xa2c7('0x26')](handleEntityNotFound(_0x4e4b26,null))[_0xa2c7('0x26')](respondWithResult(_0x4e4b26,null))['catch'](handleError(_0x4e4b26,null));};exports[_0xa2c7('0x49')]=function(_0x21de3c,_0x915dc){return db['CmList'][_0xa2c7('0x49')](_0x21de3c['body'],{})[_0xa2c7('0x26')](function(_0x214058){var _0x2fd919=_0x21de3c[_0xa2c7('0x4a')][_0xa2c7('0x4b')]({'plain':!![]});if(!_0x2fd919)throw new Error(_0xa2c7('0x4c'));if(_0x2fd919[_0xa2c7('0x4d')]==='user'){var _0x3a1645=_0x214058[_0xa2c7('0x4b')]({'plain':!![]});var _0x3e7a2f=_0xa2c7('0x4e');return db[_0xa2c7('0x4f')][_0xa2c7('0x48')]({'where':{'name':_0x3e7a2f,'userProfileId':_0x2fd919['userProfileId']},'raw':!![]})['then'](function(_0x412375){if(_0x412375&&_0x412375[_0xa2c7('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x3a1645[_0xa2c7('0x29')],'resourceId':_0x3a1645['id'],'type':_0x412375[_0xa2c7('0x29')],'sectionId':_0x412375['id']},{})[_0xa2c7('0x26')](function(){return _0x214058;});}else{return _0x214058;}})[_0xa2c7('0x45')](function(_0x117d0b){logger[_0xa2c7('0x51')](_0xa2c7('0x52'),_0x117d0b);throw _0x117d0b;});}return _0x214058;})[_0xa2c7('0x26')](respondWithResult(_0x915dc,0xc9))[_0xa2c7('0x45')](handleError(_0x915dc,null));};exports[_0xa2c7('0x25')]=function(_0x33212c,_0x28154f){if(_0x33212c['body']['id']){delete _0x33212c['body']['id'];}return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x33212c[_0xa2c7('0x46')]['id']}})['then'](handleEntityNotFound(_0x28154f,null))[_0xa2c7('0x26')](saveUpdates(_0x33212c[_0xa2c7('0x53')],null))[_0xa2c7('0x26')](respondWithResult(_0x28154f,null))[_0xa2c7('0x45')](handleError(_0x28154f,null));};exports[_0xa2c7('0x27')]=function(_0x13dd87,_0x4f2107){return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x13dd87[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x4f2107,null))[_0xa2c7('0x26')](removeEntity(_0x4f2107,null))['catch'](handleError(_0x4f2107,null));};exports[_0xa2c7('0x54')]=function(_0x2b56ab,_0x4349cd){return db[_0xa2c7('0x41')]['describe']()['then'](respondWithResult(_0x4349cd,null))[_0xa2c7('0x45')](handleError(_0x4349cd,null));};exports['addDisposition']=function(_0xa69d6f,_0x31e989,_0x54d8b7){if(_0xa69d6f['body']['id']){delete _0xa69d6f[_0xa2c7('0x53')]['id'];}return db[_0xa2c7('0x41')]['find']({'where':{'id':_0xa69d6f['params']['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x31e989,null))[_0xa2c7('0x26')](function(_0x1cc1e4){if(_0x1cc1e4){_0xa69d6f[_0xa2c7('0x53')][_0xa2c7('0x55')]=_0x1cc1e4['id'];return db[_0xa2c7('0x56')][_0xa2c7('0x49')](_0xa69d6f['body']);}})[_0xa2c7('0x26')](respondWithResult(_0x31e989,null))[_0xa2c7('0x45')](handleError(_0x31e989,null));};exports[_0xa2c7('0x57')]=function(_0x2cfa7c,_0x355211,_0xe72239){var _0x158dd8={'raw':![],'where':{}};var _0x376aff={};var _0xf26f33={'count':0x0,'rows':[]};return db[_0xa2c7('0x41')][_0xa2c7('0x58')]({'where':{'id':_0x2cfa7c[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x355211,null))[_0xa2c7('0x26')](function(_0x2a8883){if(_0x2a8883){_0x376aff[_0xa2c7('0x34')]=_[_0xa2c7('0x30')](db[_0xa2c7('0x56')][_0xa2c7('0x2c')]);_0x376aff[_0xa2c7('0x31')]=_[_0xa2c7('0x30')](_0x2cfa7c[_0xa2c7('0x31')]);_0x376aff[_0xa2c7('0x32')]=_[_0xa2c7('0x33')](_0x376aff['model'],_0x376aff['query']);_0x158dd8[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0x376aff[_0xa2c7('0x34')],qs[_0xa2c7('0x36')](_0x2cfa7c[_0xa2c7('0x31')][_0xa2c7('0x36')]));_0x158dd8[_0xa2c7('0x35')]=_0x158dd8[_0xa2c7('0x35')][_0xa2c7('0x37')]?_0x158dd8[_0xa2c7('0x35')]:_0x376aff[_0xa2c7('0x34')];if(!_0x2cfa7c[_0xa2c7('0x31')]['hasOwnProperty'](_0xa2c7('0x39'))){_0x158dd8[_0xa2c7('0x21')]=qs['limit'](_0x2cfa7c[_0xa2c7('0x31')][_0xa2c7('0x21')]);_0x158dd8[_0xa2c7('0x1e')]=qs[_0xa2c7('0x1e')](_0x2cfa7c[_0xa2c7('0x31')]['offset']);}_0x158dd8[_0xa2c7('0x3a')]=qs[_0xa2c7('0x3b')](_0x2cfa7c[_0xa2c7('0x31')][_0xa2c7('0x3b')]);_0x158dd8[_0xa2c7('0x3c')]=qs[_0xa2c7('0x32')](_['pick'](_0x2cfa7c[_0xa2c7('0x31')],_0x376aff[_0xa2c7('0x32')]));_0x158dd8[_0xa2c7('0x3c')][_0xa2c7('0x55')]=_0x2a8883['id'];if(_0x2cfa7c['query'][_0xa2c7('0x3e')]){_0x158dd8[_0xa2c7('0x3c')]=_[_0xa2c7('0x47')](_0x158dd8[_0xa2c7('0x3c')],{'$or':_[_0xa2c7('0x2b')](_0x158dd8[_0xa2c7('0x35')],function(_0x5ed208){var _0x339406={};_0x339406[_0x5ed208]={'$like':'%'+_0x2cfa7c['query'][_0xa2c7('0x3e')]+'%'};return _0x339406;})});}_0x158dd8=_['merge']({},_0x158dd8,_0x2cfa7c[_0xa2c7('0x40')]);return db[_0xa2c7('0x56')][_0xa2c7('0x20')]({'where':_0x158dd8[_0xa2c7('0x3c')]})[_0xa2c7('0x26')](function(_0x351799){_0xf26f33[_0xa2c7('0x20')]=_0x351799;if(_0x2cfa7c[_0xa2c7('0x31')][_0xa2c7('0x42')]){_0x158dd8[_0xa2c7('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xa2c7('0x44')](_0x158dd8);})[_0xa2c7('0x26')](function(_0xfefaf2){_0xf26f33[_0xa2c7('0x59')]=_0xfefaf2;return _0xf26f33;});}})[_0xa2c7('0x26')](respondWithFilteredResult(_0x355211,_0x158dd8))[_0xa2c7('0x45')](handleError(_0x355211,null));};exports['removeDispositions']=function(_0x47e893,_0x2c4ff1,_0x43301f){return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x47e893[_0xa2c7('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c4ff1,null))[_0xa2c7('0x26')](function(_0x4a89c7){if(_0x4a89c7){return _0x4a89c7['removeDispositions'](_0x47e893['query'][_0xa2c7('0x5a')]);}})[_0xa2c7('0x26')](respondWithStatusCode(_0x2c4ff1,null))[_0xa2c7('0x45')](handleError(_0x2c4ff1,null));};exports[_0xa2c7('0x5b')]=function(_0x79e26e,_0xe5ca07,_0x41fef0){return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x79e26e[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0xe5ca07,null))[_0xa2c7('0x26')](function(_0x999cf2){if(_0x999cf2){var _0x5d6249=[];var _0xe9cc07={'success':[],'errors':[]};return db[_0xa2c7('0x5c')][_0xa2c7('0x54')]()[_0xa2c7('0x26')](function(_0x76fd85){if(_0x79e26e['body'][_0xa2c7('0x5d')]&&_[_0xa2c7('0x5e')](_0x79e26e['body'][_0xa2c7('0x5d')])){if(_0x79e26e[_0xa2c7('0x53')][_0xa2c7('0x5d')][_0xa2c7('0x37')]){_0x79e26e[_0xa2c7('0x53')][_0xa2c7('0x5d')]=_0x79e26e['body'][_0xa2c7('0x5d')][_0xa2c7('0x5f')](';')+';';}else{_0x79e26e['body'][_0xa2c7('0x5d')]=null;}}else{_0x79e26e[_0xa2c7('0x53')]['tags']=null;}if(_0x79e26e[_0xa2c7('0x53')]&&_['isArray'](_0x79e26e[_0xa2c7('0x53')])){for(var _0x1df959=0x0;_0x1df959<_0x79e26e[_0xa2c7('0x53')][_0xa2c7('0x37')];_0x1df959+=0x1){_0x79e26e[_0xa2c7('0x53')][_0x1df959][_0xa2c7('0x55')]=_0x79e26e[_0xa2c7('0x46')]['id'];_0x5d6249[_0xa2c7('0x60')](_0x79e26e[_0xa2c7('0x53')][_0x1df959]);}return BPromise[_0xa2c7('0x61')](_0x5d6249,function(_0x1c79b0){return db['CmContact'][_0xa2c7('0x49')](_['omit'](_0x1c79b0,[_0xa2c7('0x5a'),'id'])||{},{'fields':_[_0xa2c7('0x30')](_0x76fd85),'raw':!![]})[_0xa2c7('0x26')](function(_0x3fec9e){_0xe9cc07[_0xa2c7('0x62')][_0xa2c7('0x60')](_0x3fec9e['dataValues']);})[_0xa2c7('0x45')](function(_0x31f366){_0xe9cc07['errors']['push']({'data':_0x1c79b0,'error':_0x31f366[_0xa2c7('0x63')]});});})['then'](function(_0x5ed8ff){return _0xe9cc07;})['catch'](function(_0x3bdd19){return _0x3bdd19;});}else{_0xe5ca07[_0xa2c7('0x1c')](0x190)[_0xa2c7('0x64')]({'message':_0xa2c7('0x65')});}});}})['then'](respondWithResult(_0xe5ca07,null))['catch'](handleError(_0xe5ca07,null));};exports[_0xa2c7('0x66')]=function(_0x20fd5c,_0xc025a4,_0x1f56b3){var _0x128724;return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x20fd5c[_0xa2c7('0x46')]['id']},'include':[{'model':db[_0xa2c7('0x67')],'as':_0xa2c7('0x68')}]})[_0xa2c7('0x26')](handleEntityNotFound(_0xc025a4,null))[_0xa2c7('0x26')](function(_0x322b39){if(_0x322b39){_0x128724=_0x322b39;return db['CmContact']['rawAttributes'];}})[_0xa2c7('0x26')](function(_0x54b054){if(_0x54b054){var _0x137f77={};var _0xa1d5a2={};_0xa1d5a2[_0xa2c7('0x34')]=_[_0xa2c7('0x69')](_[_0xa2c7('0x30')](_0x54b054),_[_0xa2c7('0x2b')](_0x128724[_0xa2c7('0x68')],function(_0x41bff9){return util[_0xa2c7('0x6a')](_0xa2c7('0x6b'),_0x41bff9['id']);}));_0xa1d5a2[_0xa2c7('0x31')]=_['keys'](_0x20fd5c[_0xa2c7('0x31')]);_0xa1d5a2[_0xa2c7('0x32')]=_['intersection'](_0xa1d5a2[_0xa2c7('0x34')],_0xa1d5a2['query']);_0x137f77[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0xa1d5a2[_0xa2c7('0x34')],qs[_0xa2c7('0x36')](_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x36')]));_0x137f77[_0xa2c7('0x35')]=_0x137f77[_0xa2c7('0x35')][_0xa2c7('0x37')]?_0x137f77['attributes']:_0xa1d5a2[_0xa2c7('0x34')];if(!_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x38')](_0xa2c7('0x39'))){_0x137f77['limit']=qs[_0xa2c7('0x21')](_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x21')]);_0x137f77[_0xa2c7('0x1e')]=qs[_0xa2c7('0x1e')](_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x1e')]);}_0x137f77['order']=qs['sort'](_0x20fd5c['query'][_0xa2c7('0x3b')]);_0x137f77['where']=qs[_0xa2c7('0x32')](_[_0xa2c7('0x3d')](_0x20fd5c[_0xa2c7('0x31')],_0xa1d5a2[_0xa2c7('0x32')]));_0x137f77['raw']=!![];if(_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x3e')]){_0x137f77[_0xa2c7('0x3c')]=_[_0xa2c7('0x47')](_0x137f77[_0xa2c7('0x3c')],{'$or':_['map'](_0x137f77['attributes'],function(_0x51e7e7){var _0x523335={};_0x523335[_0x51e7e7]={'$like':'%'+_0x20fd5c[_0xa2c7('0x31')][_0xa2c7('0x3e')]+'%'};return _0x523335;})});}_0x137f77=_[_0xa2c7('0x47')]({},_0x137f77,_0x20fd5c[_0xa2c7('0x40')]);return _0x128724['getContacts'](_0x137f77);}})[_0xa2c7('0x26')](respondWithResult(_0xc025a4,null))[_0xa2c7('0x45')](handleError(_0xc025a4,null));};exports[_0xa2c7('0x6c')]=function(_0x1182d8,_0x28f90e,_0x548143){var _0x5e7f86;var _0x186644;var _0x147a75;var _0x22bf80=_0x1182d8[_0xa2c7('0x46')]['id'];csv_results=[];return db[_0xa2c7('0x6d')][_0xa2c7('0x44')]({'attributes':['id',_0xa2c7('0x29')],'raw':!![],'order':[_0xa2c7('0x6e')]})[_0xa2c7('0x26')](function(_0x46e446){_0x5e7f86=_0x46e446;var _0x48009b=_[_0xa2c7('0x30')](db[_0xa2c7('0x5c')][_0xa2c7('0x2c')]);return db['CmCustomField'][_0xa2c7('0x44')]({'raw':!![],'attributes':['id',_0xa2c7('0x6f')]})[_0xa2c7('0x26')](function(_0xba1230){_0x186644=_0xba1230;var _0x5f1989=squel['select']()['fields'](_0x48009b)[_0xa2c7('0x70')](_0xa2c7('0x71'),'c')[_0xa2c7('0x3c')]('c.ListId\x20=\x20?',_0x22bf80)[_0xa2c7('0x3c')](_0xa2c7('0x72'))['distinct']();for(var _0x145e81=0x0;_0x145e81<_0x186644[_0xa2c7('0x37')];_0x145e81++){_0x5f1989['field'](_0xa2c7('0x73')+_0x186644[_0x145e81]['id'],'customField_'+_0x186644[_0x145e81]['alias']);}for(var _0x145e81=0x0;_0x145e81<_0x5e7f86[_0xa2c7('0x37')];_0x145e81++){_0x5f1989[_0xa2c7('0x74')](squel[_0xa2c7('0x75')]()[_0xa2c7('0x74')](_0xa2c7('0x76'))[_0xa2c7('0x70')](_0xa2c7('0x77'))['where'](_0xa2c7('0x78'),_0x5e7f86[_0x145e81]['id'])[_0xa2c7('0x3c')](_0xa2c7('0x79')),_0xa2c7('0x7a')+_0x5e7f86[_0x145e81][_0xa2c7('0x29')]);_0x5f1989[_0xa2c7('0x74')](squel[_0xa2c7('0x75')]()[_0xa2c7('0x74')](_0xa2c7('0x7b'))['from'](_0xa2c7('0x77'))['where'](_0xa2c7('0x78'),_0x5e7f86[_0x145e81]['id'])[_0xa2c7('0x3c')](_0xa2c7('0x79')),_0xa2c7('0x7c')+_0x5e7f86[_0x145e81][_0xa2c7('0x29')]);}var _0x48f05e=[];_0x48f05e[_0xa2c7('0x60')](_0x5f1989['toString']());BPromise[_0xa2c7('0x61')](_0x48f05e,handleQuery)[_0xa2c7('0x26')](function(_0x17210b){handleQuery(_0x5f1989[_0xa2c7('0x7d')]());var _0x5352a3=csv_results[0x0];if(!_[_0xa2c7('0x7e')](_0x5352a3)){var _0x596b50=toCsv(_0x5352a3);var _0x262364=Date['now']();fs[_0xa2c7('0x7f')](util[_0xa2c7('0x6a')](_0xa2c7('0x80'),_0x22bf80,_0x262364),_0x596b50);_0x28f90e[_0xa2c7('0x81')](_0xa2c7('0x82'),_0xa2c7('0x83')+util[_0xa2c7('0x6a')](_0xa2c7('0x84'),_0x22bf80,_0x262364));_0x28f90e[_0xa2c7('0x81')](_0xa2c7('0x85'),'text/csv');return _0x28f90e[_0xa2c7('0x86')](util[_0xa2c7('0x6a')](_0xa2c7('0x80'),_0x22bf80,_0x262364));}else{return _0x28f90e[_0xa2c7('0x1b')](0xcc);}});});});};exports['addCustomField']=function(_0x15e126,_0x3c1cf9,_0x1fe22d){var _0x52aaf3;delete _0x15e126['body']['id'];return db[_0xa2c7('0x41')]['findOne']({'where':{'id':_0x15e126[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x3c1cf9,null))[_0xa2c7('0x26')](function(_0x5989c8){if(_0x5989c8){return db[_0xa2c7('0x87')][_0xa2c7('0x88')](function(_0x4d74d9){return db[_0xa2c7('0x67')][_0xa2c7('0x49')](_0x15e126[_0xa2c7('0x53')],{'transaction':_0x4d74d9})[_0xa2c7('0x26')](function(_0x4715a7){_0x52aaf3=_0x4715a7;return _0x5989c8['addCustomFields'](_0x4715a7,{'transaction':_0x4d74d9});})[_0xa2c7('0x26')](function(){var _0x64d6fe={'type':db[_0xa2c7('0x89')][_0xa2c7('0x8a')],'transaction':_0x4d74d9};switch(_0x15e126[_0xa2c7('0x53')]['type']){case _0xa2c7('0x8b'):_0x64d6fe[_0xa2c7('0x2e')]=db[_0xa2c7('0x89')]['TEXT'];break;case _0xa2c7('0x8c'):_0x64d6fe[_0xa2c7('0x2e')]=db['Sequelize'][_0xa2c7('0x8d')];break;case _0xa2c7('0x8e'):_0x64d6fe[_0xa2c7('0x2e')]=db[_0xa2c7('0x89')][_0xa2c7('0x8f')];_0x64d6fe['defaultValue']=![];break;default:}return db[_0xa2c7('0x87')][_0xa2c7('0x90')][_0xa2c7('0x91')](_0xa2c7('0x71'),util[_0xa2c7('0x6a')]('cf_%s',_0x52aaf3['id']),_0x64d6fe);})[_0xa2c7('0x26')](function(){return _0x52aaf3;});});}})[_0xa2c7('0x26')](respondWithResult(_0x3c1cf9,null))[_0xa2c7('0x45')](handleError(_0x3c1cf9,null));};exports['getCustomFields']=function(_0x17a77f,_0x3786e0,_0x24cd7e){var _0x5091ed={};var _0x2fd2e5={};var _0x1e15f4;var _0x3605da;return db[_0xa2c7('0x41')][_0xa2c7('0x58')]({'where':{'id':_0x17a77f[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x3786e0,null))[_0xa2c7('0x26')](function(_0x212ed2){if(_0x212ed2){_0x1e15f4=_0x212ed2;_0x2fd2e5[_0xa2c7('0x34')]=_[_0xa2c7('0x30')](db['CmCustomField'][_0xa2c7('0x2c')]);_0x2fd2e5[_0xa2c7('0x31')]=_[_0xa2c7('0x30')](_0x17a77f[_0xa2c7('0x31')]);_0x2fd2e5[_0xa2c7('0x32')]=_[_0xa2c7('0x33')](_0x2fd2e5[_0xa2c7('0x34')],_0x2fd2e5[_0xa2c7('0x31')]);_0x5091ed[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0x2fd2e5[_0xa2c7('0x34')],qs[_0xa2c7('0x36')](_0x17a77f['query'][_0xa2c7('0x36')]));_0x5091ed[_0xa2c7('0x35')]=_0x5091ed[_0xa2c7('0x35')][_0xa2c7('0x37')]?_0x5091ed[_0xa2c7('0x35')]:_0x2fd2e5[_0xa2c7('0x34')];_0x5091ed[_0xa2c7('0x3a')]=qs[_0xa2c7('0x3b')](_0x17a77f[_0xa2c7('0x31')][_0xa2c7('0x3b')]);_0x5091ed[_0xa2c7('0x3c')]=qs[_0xa2c7('0x32')](_['pick'](_0x17a77f[_0xa2c7('0x31')],_0x2fd2e5[_0xa2c7('0x32')]));_0x5091ed[_0xa2c7('0x3c')]=_[_0xa2c7('0x47')](_0x5091ed[_0xa2c7('0x3c')],{'$or':[{'ListId':_0x212ed2['id']},{'ListId':null}]});if(_0x17a77f[_0xa2c7('0x31')][_0xa2c7('0x3e')]){_0x5091ed[_0xa2c7('0x3c')]=_[_0xa2c7('0x47')](_0x5091ed['where'],{'$or':_[_0xa2c7('0x2b')](_0x5091ed[_0xa2c7('0x35')],function(_0x1fe91b){var _0x5d5021={};_0x5d5021[_0x1fe91b]={'$like':'%'+_0x17a77f['query'][_0xa2c7('0x3e')]+'%'};return _0x5d5021;})});}_0x5091ed=_['merge']({},_0x5091ed,_0x17a77f[_0xa2c7('0x40')]);return db[_0xa2c7('0x67')]['findAndCountAll'](_0x5091ed);}})[_0xa2c7('0x26')](respondWithResult(_0x3786e0,null))[_0xa2c7('0x45')](handleError(_0x3786e0,null));};exports[_0xa2c7('0x92')]=function(_0x4df89f,_0x4a9d76){return db[_0xa2c7('0x67')][_0xa2c7('0x93')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x4a9d76,null))[_0xa2c7('0x26')](function(_0x1712f7){return _0x1712f7;})[_0xa2c7('0x26')](respondWithResult(_0x4a9d76,null))[_0xa2c7('0x45')](handleError(_0x4a9d76,null));};exports[_0xa2c7('0x94')]=function(_0x140bf3,_0x1fc260,_0x5f8a2c){return db['CmList']['find']({'where':{'id':_0x140bf3[_0xa2c7('0x46')]['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x1fc260,null))[_0xa2c7('0x26')](function(_0x24a5db){if(_0x24a5db){return _0x24a5db[_0xa2c7('0x94')](_0x140bf3[_0xa2c7('0x53')][_0xa2c7('0x5a')],_[_0xa2c7('0x95')](_0x140bf3[_0xa2c7('0x53')],['ids','id'])||{})[_0xa2c7('0x96')](function(_0x393c96){for(var _0x1beea3=0x0;_0x1beea3<_0x140bf3[_0xa2c7('0x53')][_0xa2c7('0x5a')][_0xa2c7('0x37')];_0x1beea3+=0x1){socket[_0xa2c7('0x97')](_0xa2c7('0x98'),{'UserId':Number(_0x140bf3['body'][_0xa2c7('0x5a')][_0x1beea3]),'CmListId':Number(_0x140bf3[_0xa2c7('0x46')]['id'])});}return _0x393c96;});}})[_0xa2c7('0x26')](respondWithResult(_0x1fc260,null))[_0xa2c7('0x45')](handleError(_0x1fc260,null));};exports['removeAgents']=function(_0x5398a0,_0x1ae047,_0x465a26){return db[_0xa2c7('0x41')][_0xa2c7('0x48')]({'where':{'id':_0x5398a0['params']['id']}})[_0xa2c7('0x26')](handleEntityNotFound(_0x1ae047,null))[_0xa2c7('0x26')](function(_0x2530e9){if(_0x2530e9){return _0x2530e9['removeAgents'](_0x5398a0[_0xa2c7('0x31')][_0xa2c7('0x5a')])[_0xa2c7('0x26')](function(){if(_[_0xa2c7('0x5e')](_0x5398a0[_0xa2c7('0x31')][_0xa2c7('0x5a')])){for(var _0x1e6813=0x0;_0x1e6813<_0x5398a0[_0xa2c7('0x31')][_0xa2c7('0x5a')][_0xa2c7('0x37')];_0x1e6813+=0x1){socket['emit'](_0xa2c7('0x99'),{'UserId':Number(_0x5398a0['query'][_0xa2c7('0x5a')][_0x1e6813]),'CmListId':Number(_0x5398a0[_0xa2c7('0x46')]['id'])});}}else{socket['emit'](_0xa2c7('0x99'),{'UserId':Number(_0x5398a0['query'][_0xa2c7('0x5a')]),'CmListId':Number(_0x5398a0['params']['id'])});}});}})[_0xa2c7('0x26')](respondWithStatusCode(_0x1ae047,null))[_0xa2c7('0x45')](handleError(_0x1ae047,null));};exports[_0xa2c7('0x9a')]=function(_0x37e65b,_0x22b8ee,_0x4ad032){var _0x3170c8={};var _0x1ccb0c={};var _0x24d55f;var _0x397b8f;return db['CmList'][_0xa2c7('0x58')]({'where':{'id':_0x37e65b[_0xa2c7('0x46')]['id']}})['then'](handleEntityNotFound(_0x22b8ee,null))[_0xa2c7('0x26')](function(_0x3e8355){if(_0x3e8355){_0x24d55f=_0x3e8355;_0x1ccb0c[_0xa2c7('0x34')]=_[_0xa2c7('0x30')](db[_0xa2c7('0x9b')]['rawAttributes']);_0x1ccb0c[_0xa2c7('0x31')]=_[_0xa2c7('0x30')](_0x37e65b[_0xa2c7('0x31')]);_0x1ccb0c[_0xa2c7('0x32')]=_[_0xa2c7('0x33')](_0x1ccb0c[_0xa2c7('0x34')],_0x1ccb0c[_0xa2c7('0x31')]);_0x3170c8[_0xa2c7('0x35')]=_[_0xa2c7('0x33')](_0x1ccb0c[_0xa2c7('0x34')],qs['fields'](_0x37e65b[_0xa2c7('0x31')][_0xa2c7('0x36')]));_0x3170c8[_0xa2c7('0x35')]=_0x3170c8['attributes'][_0xa2c7('0x37')]?_0x3170c8[_0xa2c7('0x35')]:_0x1ccb0c['model'];_0x3170c8[_0xa2c7('0x3a')]=qs[_0xa2c7('0x3b')](_0x37e65b[_0xa2c7('0x31')]['sort']);_0x3170c8[_0xa2c7('0x3c')]=qs[_0xa2c7('0x32')](_[_0xa2c7('0x3d')](_0x37e65b[_0xa2c7('0x31')],_0x1ccb0c[_0xa2c7('0x32')]));if(_0x37e65b['query'][_0xa2c7('0x3e')]){_0x3170c8[_0xa2c7('0x3c')]=_[_0xa2c7('0x47')](_0x3170c8[_0xa2c7('0x3c')],{'$or':_['map'](_0x3170c8[_0xa2c7('0x35')],function(_0x58ad88){var _0xbcb489={};_0xbcb489[_0x58ad88]={'$like':'%'+_0x37e65b[_0xa2c7('0x31')][_0xa2c7('0x3e')]+'%'};return _0xbcb489;})});}_0x3170c8=_[_0xa2c7('0x47')]({},_0x3170c8,_0x37e65b[_0xa2c7('0x40')]);return _0x24d55f[_0xa2c7('0x9a')](_0x3170c8);}})['then'](function(_0x5e974c){if(_0x5e974c){_0x397b8f=_0x5e974c[_0xa2c7('0x37')];if(!_0x37e65b[_0xa2c7('0x31')][_0xa2c7('0x38')](_0xa2c7('0x39'))){_0x3170c8[_0xa2c7('0x21')]=qs['limit'](_0x37e65b[_0xa2c7('0x31')][_0xa2c7('0x21')]);_0x3170c8[_0xa2c7('0x1e')]=qs[_0xa2c7('0x1e')](_0x37e65b['query'][_0xa2c7('0x1e')]);}return _0x24d55f[_0xa2c7('0x9a')](_0x3170c8);}})[_0xa2c7('0x26')](function(_0x312790){if(_0x312790){return _0x312790?{'count':_0x397b8f,'rows':_0x312790}:null;}})[_0xa2c7('0x26')](respondWithResult(_0x22b8ee,null))[_0xa2c7('0x45')](handleError(_0x22b8ee,null));};function handleQuery(_0x190dd0){logger[_0xa2c7('0x9c')](_0x190dd0);return db['sequelize'][_0xa2c7('0x31')](_0x190dd0)[_0xa2c7('0x96')](function(_0x1be6af){csv_results['push'](_0x1be6af);})[_0xa2c7('0x45')](function(_0x262e19){logger[_0xa2c7('0x51')](_0x262e19[_0xa2c7('0x63')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 4b79d65..b4c4eab 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(_0x2ec06f,_0x3bb56d){var _0x3a1c71=function(_0x5ca631){while(--_0x5ca631){_0x2ec06f['push'](_0x2ec06f['shift']());}};_0x3a1c71(++_0x3bb56d);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x1b2a7c,_0x5afac9){_0x1b2a7c=_0x1b2a7c-0x0;var _0x3c803f=_0xe14b[_0x1b2a7c];return _0x3c803f;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 8bf221d..f4ff526 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','lodash'];(function(_0x153873,_0x259e06){var _0x396f36=function(_0x49adbd){while(--_0x49adbd){_0x153873['push'](_0x153873['shift']());}};_0x396f36(++_0x259e06);}(_0xdace,0xc5));var _0xedac=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xdace[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./cmList.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['./cmList.attributes','exports','define','cm_lists','lodash','bluebird','rimraf','../../config/environment'];(function(_0x5b7e2e,_0x689e00){var _0x31c1a2=function(_0x2c2949){while(--_0x2c2949){_0x5b7e2e['push'](_0x5b7e2e['shift']());}};_0x31c1a2(++_0x689e00);}(_0xf4eb,0xec));var _0xbf4e=function(_0x29dda5,_0x1834eb){_0x29dda5=_0x29dda5-0x0;var _0x4e4050=_0xf4eb[_0x29dda5];return _0x4e4050;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('CmList',attributes,{'tableName':_0xbf4e('0x7'),'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 002beef..69f84db 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 _0x5dbd=['debug','stringify','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0xf5b004,_0x17fce8){var _0x127f97=function(_0x2648a2){while(--_0x2648a2){_0xf5b004['push'](_0xf5b004['shift']());}};_0x127f97(++_0x17fce8);}(_0x5dbd,0x172));var _0xd5db=function(_0x38d01b,_0x1a977d){_0x38d01b=_0x38d01b-0x0;var _0x5253f2=_0x5dbd[_0x38d01b];return _0x5253f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd5db('0x0'));var BPromise=require('bluebird');var rs=require(_0xd5db('0x1'));var fs=require('fs');var Redis=require(_0xd5db('0x2'));var db=require(_0xd5db('0x3'))['db'];var utils=require(_0xd5db('0x4'));var logger=require(_0xd5db('0x5'))(_0xd5db('0x6'));var config=require(_0xd5db('0x7'));var jayson=require(_0xd5db('0x8'));var client=jayson[_0xd5db('0x9')][_0xd5db('0xa')]({'port':0x232a});config[_0xd5db('0xb')]=_[_0xd5db('0xc')](config[_0xd5db('0xb')],{'host':_0xd5db('0xd'),'port':0x18eb});var socket=require(_0xd5db('0xe'))(new Redis(config[_0xd5db('0xb')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0x3cbdf5,_0x5ba4e1,_0x39ece3){return new BPromise(function(_0x4af410,_0x3d520c){return client[_0xd5db('0xf')](_0x3cbdf5,_0x39ece3)[_0xd5db('0x10')](function(_0x443aeb){logger[_0xd5db('0x11')](_0xd5db('0x12'),_0x5ba4e1,_0xd5db('0x13'));logger[_0xd5db('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x5ba4e1,_0xd5db('0x13'),JSON[_0xd5db('0x15')](_0x443aeb));if(_0x443aeb[_0xd5db('0x16')]){if(_0x443aeb[_0xd5db('0x16')]['code']===0x1f4){logger[_0xd5db('0x16')](_0xd5db('0x12'),_0x5ba4e1,_0x443aeb[_0xd5db('0x16')]['message']);return _0x3d520c(_0x443aeb[_0xd5db('0x16')][_0xd5db('0x17')]);}logger['error'](_0xd5db('0x12'),_0x5ba4e1,_0x443aeb[_0xd5db('0x16')]['message']);return _0x4af410(_0x443aeb[_0xd5db('0x16')][_0xd5db('0x17')]);}else{logger['info'](_0xd5db('0x12'),_0x5ba4e1,_0xd5db('0x13'));_0x4af410(_0x443aeb[_0xd5db('0x18')][_0xd5db('0x17')]);}})[_0xd5db('0x19')](function(_0x39fb40){logger['error'](_0xd5db('0x12'),_0x5ba4e1,_0x39fb40);_0x3d520c(_0x39fb40);});});} \ No newline at end of file +var _0x914e=['client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5e724c,_0x18ef3c){var _0x39c944=function(_0x3c7020){while(--_0x3c7020){_0x5e724c['push'](_0x5e724c['shift']());}};_0x39c944(++_0x18ef3c);}(_0x914e,0xfc));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe914('0x0'));var util=require(_0xe914('0x1'));var moment=require(_0xe914('0x2'));var BPromise=require('bluebird');var rs=require(_0xe914('0x3'));var fs=require('fs');var Redis=require(_0xe914('0x4'));var db=require(_0xe914('0x5'))['db'];var utils=require(_0xe914('0x6'));var logger=require(_0xe914('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe914('0x8'));var client=jayson[_0xe914('0x9')][_0xe914('0xa')]({'port':0x232a});config['redis']=_[_0xe914('0xb')](config[_0xe914('0xc')],{'host':_0xe914('0xd'),'port':0x18eb});var socket=require(_0xe914('0xe'))(new Redis(config[_0xe914('0xc')]));require(_0xe914('0xf'))[_0xe914('0x10')](socket);function respondWithRpcPromise(_0x4c2664,_0x3b47df,_0x2e05bd){return new BPromise(function(_0x166131,_0x55a334){return client[_0xe914('0x11')](_0x4c2664,_0x2e05bd)[_0xe914('0x12')](function(_0x36d7b4){logger[_0xe914('0x13')](_0xe914('0x14'),_0x3b47df,_0xe914('0x15'));logger[_0xe914('0x16')](_0xe914('0x17'),_0x3b47df,_0xe914('0x15'),JSON['stringify'](_0x36d7b4));if(_0x36d7b4[_0xe914('0x18')]){if(_0x36d7b4[_0xe914('0x18')][_0xe914('0x19')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3b47df,_0x36d7b4[_0xe914('0x18')][_0xe914('0x1a')]);return _0x55a334(_0x36d7b4[_0xe914('0x18')][_0xe914('0x1a')]);}logger['error'](_0xe914('0x14'),_0x3b47df,_0x36d7b4[_0xe914('0x18')][_0xe914('0x1a')]);return _0x166131(_0x36d7b4['error']['message']);}else{logger[_0xe914('0x13')](_0xe914('0x14'),_0x3b47df,'request\x20sent');_0x166131(_0x36d7b4[_0xe914('0x1b')][_0xe914('0x1a')]);}})[_0xe914('0x1c')](function(_0xcfb3c5){logger[_0xe914('0x18')]('CmList,\x20%s,\x20%s',_0x3b47df,_0xcfb3c5);_0x55a334(_0xcfb3c5);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c08d37b..e0bce43 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 _0xcc4e=['save','update','emit','register','length','./cmList.events'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xcc4e,0x19d));var _0xecc4=function(_0x5e9422,_0x5406c8){_0x5e9422=_0x5e9422-0x0;var _0x40a5e3=_0xcc4e[_0x5e9422];return _0x40a5e3;};'use strict';var CmListEvents=require(_0xecc4('0x0'));var events=[_0xecc4('0x1'),'remove',_0xecc4('0x2')];function createListener(_0x9192ab,_0x49a348){return function(_0x2e319e){_0x49a348[_0xecc4('0x3')](_0x9192ab,_0x2e319e);};}function removeListener(_0x52284d,_0x375da0){return function(){CmListEvents['removeListener'](_0x52284d,_0x375da0);};}exports[_0xecc4('0x4')]=function(_0x34e82c){for(var _0x4a28b7=0x0,_0x37e868=events[_0xecc4('0x5')];_0x4a28b7<_0x37e868;_0x4a28b7++){var _0x3883a7=events[_0x4a28b7];var _0x540d68=createListener('cmList:'+_0x3883a7,_0x34e82c);CmListEvents['on'](_0x3883a7,_0x540d68);}}; \ No newline at end of file +var _0x6a52=['removeListener','register','length','cmList:','save','remove','update','emit'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x6a52,0x64));var _0x26a5=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x6a52[_0x16d10f];return _0x50c823;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x26a5('0x0'),_0x26a5('0x1'),_0x26a5('0x2')];function createListener(_0xd88d02,_0x39197c){return function(_0xd86f1a){_0x39197c[_0x26a5('0x3')](_0xd88d02,_0xd86f1a);};}function removeListener(_0x26bcfc,_0x192416){return function(){CmListEvents[_0x26a5('0x4')](_0x26bcfc,_0x192416);};}exports[_0x26a5('0x5')]=function(_0x1c0788){for(var _0x220205=0x0,_0x33d128=events[_0x26a5('0x6')];_0x220205<_0x33d128;_0x220205++){var _0x11c1af=events[_0x220205];var _0x2b802c=createListener(_0x26a5('0x7')+_0x11c1af,_0x1c0788);CmListEvents['on'](_0x11c1af,_0x2b802c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2f3fde2..7fb10ba 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 _0x6da5=['/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','/describe','isAuthenticated'];(function(_0xde560c,_0x23431d){var _0x323f2c=function(_0x2843fd){while(--_0x2843fd){_0xde560c['push'](_0xde560c['shift']());}};_0x323f2c(++_0x23431d);}(_0x6da5,0x104));var _0x56da=function(_0x385420,_0x251f45){_0x385420=_0x385420-0x0;var _0x4cd4f7=_0x6da5[_0x385420];return _0x4cd4f7;};'use strict';var multer=require('multer');var util=require(_0x56da('0x0'));var path=require(_0x56da('0x1'));var timeout=require(_0x56da('0x2'));var express=require(_0x56da('0x3'));var router=express[_0x56da('0x4')]();var fs_extra=require(_0x56da('0x5'));var auth=require(_0x56da('0x6'));var interaction=require(_0x56da('0x7'));var config=require(_0x56da('0x8'));var controller=require(_0x56da('0x9'));router[_0x56da('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x56da('0xa')](_0x56da('0xb'),auth[_0x56da('0xc')](),controller['describe']);router[_0x56da('0xa')](_0x56da('0xd'),auth[_0x56da('0xc')](),controller[_0x56da('0xe')]);router[_0x56da('0xa')](_0x56da('0xf'),auth['isAuthenticated'](),controller[_0x56da('0x10')]);router[_0x56da('0xa')](_0x56da('0x11'),auth['isAuthenticated'](),controller[_0x56da('0x12')]);router[_0x56da('0xa')](_0x56da('0x13'),auth[_0x56da('0xc')](),controller[_0x56da('0x14')]);router[_0x56da('0xa')](_0x56da('0x15'),auth[_0x56da('0xc')](),controller[_0x56da('0x16')]);router[_0x56da('0xa')](_0x56da('0x17'),auth[_0x56da('0xc')](),controller[_0x56da('0x18')]);router['get'](_0x56da('0x19'),auth[_0x56da('0xc')](),controller[_0x56da('0x1a')]);router[_0x56da('0x1b')]('/',auth[_0x56da('0xc')](),controller['create']);router['post'](_0x56da('0x11'),auth['isAuthenticated'](),controller[_0x56da('0x1c')]);router[_0x56da('0x1b')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x56da('0x1d')]);router['post']('/:id/fields',auth[_0x56da('0xc')](),controller[_0x56da('0x1e')]);router[_0x56da('0x1b')]('/:id/users',auth[_0x56da('0xc')](),controller[_0x56da('0x1f')]);router[_0x56da('0x20')](_0x56da('0xf'),auth[_0x56da('0xc')](),controller[_0x56da('0x21')]);router[_0x56da('0x22')]('/:id',auth[_0x56da('0xc')](),controller[_0x56da('0x23')]);router['delete'](_0x56da('0x11'),auth[_0x56da('0xc')](),controller[_0x56da('0x24')]);router[_0x56da('0x22')](_0x56da('0x19'),auth[_0x56da('0xc')](),controller[_0x56da('0x25')]);module[_0x56da('0x26')]=router; \ No newline at end of file +var _0x6731=['getContacts','/:id/contacts/csv','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','getDispositions','/:id/contacts'];(function(_0x342b40,_0x3bc1dd){var _0x370170=function(_0x2f115a){while(--_0x2f115a){_0x342b40['push'](_0x342b40['shift']());}};_0x370170(++_0x3bc1dd);}(_0x6731,0x80));var _0x1673=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x6731[_0x403c20];return _0x2b271a;};'use strict';var multer=require(_0x1673('0x0'));var util=require(_0x1673('0x1'));var path=require(_0x1673('0x2'));var timeout=require(_0x1673('0x3'));var express=require(_0x1673('0x4'));var router=express['Router']();var fs_extra=require(_0x1673('0x5'));var auth=require(_0x1673('0x6'));var interaction=require(_0x1673('0x7'));var config=require(_0x1673('0x8'));var controller=require(_0x1673('0x9'));router[_0x1673('0xa')]('/',auth[_0x1673('0xb')](),controller[_0x1673('0xc')]);router[_0x1673('0xa')](_0x1673('0xd'),auth['isAuthenticated'](),controller[_0x1673('0xe')]);router[_0x1673('0xa')](_0x1673('0xf'),auth['isAuthenticated'](),controller[_0x1673('0x10')]);router['get'](_0x1673('0x11'),auth[_0x1673('0xb')](),controller['show']);router[_0x1673('0xa')]('/:id/dispositions',auth[_0x1673('0xb')](),controller[_0x1673('0x12')]);router[_0x1673('0xa')](_0x1673('0x13'),auth['isAuthenticated'](),controller[_0x1673('0x14')]);router[_0x1673('0xa')](_0x1673('0x15'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x1673('0xa')]('/:id/fields',auth[_0x1673('0xb')](),controller['getCustomFields']);router['get'](_0x1673('0x16'),auth[_0x1673('0xb')](),controller[_0x1673('0x17')]);router[_0x1673('0x18')]('/',auth[_0x1673('0xb')](),controller['create']);router[_0x1673('0x18')](_0x1673('0x19'),auth[_0x1673('0xb')](),controller[_0x1673('0x1a')]);router[_0x1673('0x18')](_0x1673('0x13'),auth[_0x1673('0xb')](),controller[_0x1673('0x1b')]);router[_0x1673('0x18')](_0x1673('0x1c'),auth[_0x1673('0xb')](),controller[_0x1673('0x1d')]);router['post'](_0x1673('0x16'),auth['isAuthenticated'](),controller[_0x1673('0x1e')]);router[_0x1673('0x1f')](_0x1673('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1673('0x20')](_0x1673('0x11'),auth['isAuthenticated'](),controller[_0x1673('0x21')]);router[_0x1673('0x20')](_0x1673('0x19'),auth[_0x1673('0xb')](),controller[_0x1673('0x22')]);router[_0x1673('0x20')](_0x1673('0x16'),auth[_0x1673('0xb')](),controller[_0x1673('0x23')]);module[_0x1673('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index ba13d65..fe0d41e 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 _0xb9d0=['exports','field','STRING','sequelize'];(function(_0xd6f122,_0xcfebd2){var _0x4f9b8a=function(_0x4bab68){while(--_0x4bab68){_0xd6f122['push'](_0xd6f122['shift']());}};_0x4f9b8a(++_0xcfebd2);}(_0xb9d0,0xb3));var _0x0b9d=function(_0x165898,_0x739357){_0x165898=_0x165898-0x0;var _0x57b1cc=_0xb9d0[_0x165898];return _0x57b1cc;};'use strict';var Sequelize=require(_0x0b9d('0x0'));module[_0x0b9d('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x321098){return this['getDataValue'](_0x0b9d('0x2'));}},'field':{'type':Sequelize[_0x0b9d('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x0b9d('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x15b7=['STRING','exports'];(function(_0x1ccd9e,_0x1067c2){var _0x29910b=function(_0x2ace9a){while(--_0x2ace9a){_0x1ccd9e['push'](_0x1ccd9e['shift']());}};_0x29910b(++_0x1067c2);}(_0x15b7,0x18d));var _0x715b=function(_0x3c3520,_0x49b940){_0x3c3520=_0x3c3520-0x0;var _0x3b10e8=_0x15b7[_0x3c3520];return _0x3b10e8;};'use strict';var Sequelize=require('sequelize');module[_0x715b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x212ba7){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x715b('0x1')],'allowNull':![]},'operator':{'type':Sequelize[_0x715b('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x715b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a8233d0..29d54e9 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1c6e9f,_0x29a0c8){var _0x455cc9=function(_0x40622d){while(--_0x40622d){_0x1c6e9f['push'](_0x1c6e9f['shift']());}};_0x455cc9(++_0x29a0c8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x5bd7e2,_0x269390){var _0x2b85b0=function(_0x3cfd15){while(--_0x3cfd15){_0x5bd7e2['push'](_0x5bd7e2['shift']());}};_0x2b85b0(++_0x269390);}(_0x7a54,0x106));var _0x47a5=function(_0x179503,_0x3e4d00){_0x179503=_0x179503-0x0;var _0x215982=_0x7a54[_0x179503];return _0x215982;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 8655ad9..3e1da9b 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 _0xefc8=['api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xefc8,0x189));var _0x8efc=function(_0x5e3e9e,_0x5329b8){_0x5e3e9e=_0x5e3e9e-0x0;var _0x43d527=_0xefc8[_0x5e3e9e];return _0x43d527;};'use strict';var _=require(_0x8efc('0x0'));var util=require(_0x8efc('0x1'));var logger=require(_0x8efc('0x2'))(_0x8efc('0x3'));var moment=require(_0x8efc('0x4'));var BPromise=require('bluebird');var rp=require(_0x8efc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8efc('0x6'));var config=require(_0x8efc('0x7'));var attributes=require(_0x8efc('0x8'));module[_0x8efc('0x9')]=function(_0x3e705a,_0x1bf6aa){return _0x3e705a[_0x8efc('0xa')]('Condition',attributes,{'tableName':_0x8efc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23e4=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./condition.attributes','define','Condition'];(function(_0x1b3590,_0xe86c19){var _0x56d87e=function(_0x2c94d6){while(--_0x2c94d6){_0x1b3590['push'](_0x1b3590['shift']());}};_0x56d87e(++_0xe86c19);}(_0x23e4,0x155));var _0x423e=function(_0x29cd49,_0x23102c){_0x29cd49=_0x29cd49-0x0;var _0xd29bf5=_0x23e4[_0x29cd49];return _0xd29bf5;};'use strict';var _=require(_0x423e('0x0'));var util=require(_0x423e('0x1'));var logger=require(_0x423e('0x2'))(_0x423e('0x3'));var moment=require(_0x423e('0x4'));var BPromise=require(_0x423e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x423e('0x6'));var rimraf=require('rimraf');var config=require(_0x423e('0x7'));var attributes=require(_0x423e('0x8'));module['exports']=function(_0x3a65ac,_0x4a0d1c){return _0x3a65ac[_0x423e('0x9')](_0x423e('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 d0440db..7fc42fc 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 _0xf747=['info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf747,0x1ac));var _0x7f74=function(_0x376fdf,_0xf66661){_0x376fdf=_0x376fdf-0x0;var _0x28f68e=_0xf747[_0x376fdf];return _0x28f68e;};'use strict';var _=require(_0x7f74('0x0'));var util=require('util');var moment=require(_0x7f74('0x1'));var BPromise=require(_0x7f74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f74('0x3'))['db'];var utils=require(_0x7f74('0x4'));var logger=require(_0x7f74('0x5'))(_0x7f74('0x6'));var config=require(_0x7f74('0x7'));var jayson=require(_0x7f74('0x8'));var client=jayson[_0x7f74('0x9')][_0x7f74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24ff9b,_0x5bc6d7,_0x56d26e){return new BPromise(function(_0x57038d,_0x3dd6ce){return client['request'](_0x24ff9b,_0x56d26e)[_0x7f74('0xb')](function(_0x120515){logger[_0x7f74('0xc')](_0x7f74('0xd'),_0x5bc6d7,_0x7f74('0xe'));logger['debug'](_0x7f74('0xf'),_0x5bc6d7,_0x7f74('0xe'),JSON[_0x7f74('0x10')](_0x120515));if(_0x120515[_0x7f74('0x11')]){if(_0x120515[_0x7f74('0x11')][_0x7f74('0x12')]===0x1f4){logger[_0x7f74('0x11')](_0x7f74('0xd'),_0x5bc6d7,_0x120515[_0x7f74('0x11')][_0x7f74('0x13')]);return _0x3dd6ce(_0x120515[_0x7f74('0x11')][_0x7f74('0x13')]);}logger[_0x7f74('0x11')]('Condition,\x20%s,\x20%s',_0x5bc6d7,_0x120515[_0x7f74('0x11')][_0x7f74('0x13')]);return _0x57038d(_0x120515[_0x7f74('0x11')][_0x7f74('0x13')]);}else{logger[_0x7f74('0xc')](_0x7f74('0xd'),_0x5bc6d7,_0x7f74('0xe'));_0x57038d(_0x120515[_0x7f74('0x14')][_0x7f74('0x13')]);}})[_0x7f74('0x15')](function(_0x256cd6){logger[_0x7f74('0x11')](_0x7f74('0xd'),_0x5bc6d7,_0x256cd6);_0x3dd6ce(_0x256cd6);});});} \ No newline at end of file +var _0x0ddd=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Condition,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ddd,0xc6));var _0xd0dd=function(_0x4ca054,_0x56b673){_0x4ca054=_0x4ca054-0x0;var _0x3c89c9=_0x0ddd[_0x4ca054];return _0x3c89c9;};'use strict';var _=require(_0xd0dd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0dd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0dd('0x2'));var db=require(_0xd0dd('0x3'))['db'];var utils=require(_0xd0dd('0x4'));var logger=require('../../config/logger')(_0xd0dd('0x5'));var config=require(_0xd0dd('0x6'));var jayson=require(_0xd0dd('0x7'));var client=jayson[_0xd0dd('0x8')][_0xd0dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x93620,_0x3f1308,_0x2128bb){return new BPromise(function(_0x27caed,_0x189ce2){return client[_0xd0dd('0xa')](_0x93620,_0x2128bb)[_0xd0dd('0xb')](function(_0x1b2ec9){logger['info']('Condition,\x20%s,\x20%s',_0x3f1308,'request\x20sent');logger[_0xd0dd('0xc')](_0xd0dd('0xd'),_0x3f1308,_0xd0dd('0xe'),JSON[_0xd0dd('0xf')](_0x1b2ec9));if(_0x1b2ec9[_0xd0dd('0x10')]){if(_0x1b2ec9[_0xd0dd('0x10')]['code']===0x1f4){logger[_0xd0dd('0x10')](_0xd0dd('0x11'),_0x3f1308,_0x1b2ec9[_0xd0dd('0x10')][_0xd0dd('0x12')]);return _0x189ce2(_0x1b2ec9[_0xd0dd('0x10')][_0xd0dd('0x12')]);}logger[_0xd0dd('0x10')](_0xd0dd('0x11'),_0x3f1308,_0x1b2ec9[_0xd0dd('0x10')][_0xd0dd('0x12')]);return _0x27caed(_0x1b2ec9[_0xd0dd('0x10')]['message']);}else{logger[_0xd0dd('0x13')](_0xd0dd('0x11'),_0x3f1308,'request\x20sent');_0x27caed(_0x1b2ec9[_0xd0dd('0x14')][_0xd0dd('0x12')]);}})[_0xd0dd('0x15')](function(_0x220d99){logger['error'](_0xd0dd('0x11'),_0x3f1308,_0x220d99);_0x189ce2(_0x220d99);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index cf0e610..4ece7fe 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 _0xae3f=['./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x35f59c,_0x470218){var _0xd9d7ba=function(_0xc3c39b){while(--_0xc3c39b){_0x35f59c['push'](_0x35f59c['shift']());}};_0xd9d7ba(++_0x470218);}(_0xae3f,0x1a8));var _0xfae3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xae3f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfae3('0x0'));var util=require('util');var path=require(_0xfae3('0x1'));var timeout=require(_0xfae3('0x2'));var express=require(_0xfae3('0x3'));var router=express['Router']();var fs_extra=require(_0xfae3('0x4'));var auth=require(_0xfae3('0x5'));var interaction=require(_0xfae3('0x6'));var config=require(_0xfae3('0x7'));var controller=require(_0xfae3('0x8'));router[_0xfae3('0x9')](_0xfae3('0xa'),auth[_0xfae3('0xb')](),controller[_0xfae3('0xc')]);router[_0xfae3('0xd')]('/:id',auth[_0xfae3('0xb')](),controller[_0xfae3('0xe')]);module[_0xfae3('0xf')]=router; \ No newline at end of file +var _0xbd38=['isAuthenticated','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd38,0x130));var _0x8bd3=function(_0x57fda9,_0x20bf12){_0x57fda9=_0x57fda9-0x0;var _0x3841b4=_0xbd38[_0x57fda9];return _0x3841b4;};'use strict';var multer=require(_0x8bd3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8bd3('0x1'));var router=express[_0x8bd3('0x2')]();var fs_extra=require(_0x8bd3('0x3'));var auth=require(_0x8bd3('0x4'));var interaction=require(_0x8bd3('0x5'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x8bd3('0x6')](_0x8bd3('0x7'),auth[_0x8bd3('0x8')](),controller['update']);router[_0x8bd3('0x9')](_0x8bd3('0x7'),auth[_0x8bd3('0x8')](),controller[_0x8bd3('0xa')]);module[_0x8bd3('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 6b899e4..6638844 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a88=['sequelize','exports','STRING'];(function(_0x18671d,_0x2d9b86){var _0x5cd4b2=function(_0x2d1cda){while(--_0x2d1cda){_0x18671d['push'](_0x18671d['shift']());}};_0x5cd4b2(++_0x2d9b86);}(_0x9a88,0x1bc));var _0x89a8=function(_0x360938,_0x119ab1){_0x360938=_0x360938-0x0;var _0x321c93=_0x9a88[_0x360938];return _0x321c93;};'use strict';var Sequelize=require(_0x89a8('0x0'));module[_0x89a8('0x1')]={'name':{'type':Sequelize[_0x89a8('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x89a8('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x34e4=['exports','STRING','name','INTEGER','sequelize'];(function(_0x1884b8,_0x174f1a){var _0x5f1bfd=function(_0x1e6e8e){while(--_0x1e6e8e){_0x1884b8['push'](_0x1884b8['shift']());}};_0x5f1bfd(++_0x174f1a);}(_0x34e4,0x13f));var _0x434e=function(_0x3d0575,_0x5c3732){_0x3d0575=_0x3d0575-0x0;var _0x3688dc=_0x34e4[_0x3d0575];return _0x3688dc;};'use strict';var Sequelize=require(_0x434e('0x0'));module[_0x434e('0x1')]={'name':{'type':Sequelize[_0x434e('0x2')],'allowNull':![],'unique':_0x434e('0x3')},'OrderBy':{'type':Sequelize[_0x434e('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x434e('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 2b07a9f..665fbc5 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb44a=['where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ContactItemTypes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','CmContactHasItem','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','error','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x552a82,_0x1b615){var _0x2d7d06=function(_0x3d0e9f){while(--_0x3d0e9f){_0x552a82['push'](_0x552a82['shift']());}};_0x2d7d06(++_0x1b615);}(_0xb44a,0x1c2));var _0xab44=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0xb44a[_0x2a7210];return _0x460766;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){var _0x1d4a2f=_0x43f1c6['get']({'plain':!![]});var _0x2439f3='ContactItemTypes';return db[_0xab44('0x24')]['destroy']({'where':{'type':_0x2439f3,'resourceId':_0x1d4a2f['id']}})['then'](function(){return _0x43f1c6;});})[_0xab44('0x23')](function(){_0x11f0b[_0xab44('0x18')](0xcc)[_0xab44('0x17')]();});}};}function handleEntityNotFound(_0x4620ed,_0x132bf6){return function(_0x4e820c){if(!_0x4e820c){_0x4620ed[_0xab44('0x16')](0x194);}return _0x4e820c;};}function handleError(_0x5587fe,_0x5071f3){_0x5071f3=_0x5071f3||0x1f4;return function(_0x887b0d){logger[_0xab44('0x25')](_0x887b0d[_0xab44('0x26')]);if(_0x887b0d[_0xab44('0x27')]){delete _0x887b0d[_0xab44('0x27')];}_0x5587fe[_0xab44('0x18')](_0x5071f3)['send'](_0x887b0d);};}exports[_0xab44('0x28')]=function(_0x43a42d,_0x36f9b6){var _0x47e1be={},_0x54cac8={},_0x106d3a={'count':0x0,'rows':[]};var _0x5082e4=_['map'](db[_0xab44('0x29')][_0xab44('0x2a')],function(_0x160177){return{'name':_0x160177[_0xab44('0x2b')],'type':_0x160177[_0xab44('0x2c')][_0xab44('0x2d')]};});_0x54cac8[_0xab44('0x2e')]=_[_0xab44('0x2f')](_0x5082e4,_0xab44('0x27'));_0x54cac8[_0xab44('0x30')]=_[_0xab44('0x31')](_0x43a42d[_0xab44('0x30')]);_0x54cac8[_0xab44('0x32')]=_[_0xab44('0x33')](_0x54cac8['model'],_0x54cac8['query']);_0x47e1be[_0xab44('0x34')]=_[_0xab44('0x33')](_0x54cac8['model'],qs[_0xab44('0x35')](_0x43a42d[_0xab44('0x30')][_0xab44('0x35')]));_0x47e1be[_0xab44('0x34')]=_0x47e1be[_0xab44('0x34')][_0xab44('0x36')]?_0x47e1be[_0xab44('0x34')]:_0x54cac8[_0xab44('0x2e')];if(!_0x43a42d[_0xab44('0x30')][_0xab44('0x37')](_0xab44('0x38'))){_0x47e1be[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x43a42d[_0xab44('0x30')][_0xab44('0x1c')]);_0x47e1be[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x43a42d[_0xab44('0x30')]['offset']);}_0x47e1be[_0xab44('0x39')]=qs[_0xab44('0x3a')](_0x43a42d[_0xab44('0x30')][_0xab44('0x3a')]);_0x47e1be['where']=qs[_0xab44('0x32')](_[_0xab44('0x3b')](_0x43a42d[_0xab44('0x30')],_0x54cac8[_0xab44('0x32')]),_0x5082e4);if(_0x43a42d[_0xab44('0x30')]['filter']){_0x47e1be[_0xab44('0x3c')]=_[_0xab44('0x3d')](_0x47e1be[_0xab44('0x3c')],{'$or':_['map'](_0x5082e4,function(_0x3ef5ea){if(_0x3ef5ea[_0xab44('0x2c')]!==_0xab44('0x3e')){var _0xf80acf={};_0xf80acf[_0x3ef5ea[_0xab44('0x27')]]={'$like':'%'+_0x43a42d['query'][_0xab44('0x3f')]+'%'};return _0xf80acf;}})});}_0x47e1be=_['merge']({},_0x47e1be,_0x43a42d[_0xab44('0x40')]);var _0x4f2b94={'where':_0x47e1be['where']};return db['ContactItemType']['count'](_0x4f2b94)['then'](function(_0x120585){_0x106d3a[_0xab44('0x1d')]=_0x120585;if(_0x43a42d[_0xab44('0x30')][_0xab44('0x41')]){_0x47e1be[_0xab44('0x42')]=[{'all':!![]}];}return db[_0xab44('0x29')][_0xab44('0x43')](_0x47e1be);})[_0xab44('0x23')](function(_0x4429e6){_0x106d3a[_0xab44('0x44')]=_0x4429e6;return _0x106d3a;})['then'](respondWithFilteredResult(_0x36f9b6,_0x47e1be))[_0xab44('0x45')](handleError(_0x36f9b6,null));};exports[_0xab44('0x46')]=function(_0x3cb9fc,_0x9a6da5){var _0x54f603={'raw':!![],'where':{'id':_0x3cb9fc[_0xab44('0x47')]['id']}},_0x3e9a79={};_0x3e9a79[_0xab44('0x2e')]=_[_0xab44('0x31')](db[_0xab44('0x29')][_0xab44('0x2a')]);_0x3e9a79['query']=_['keys'](_0x3cb9fc[_0xab44('0x30')]);_0x3e9a79[_0xab44('0x32')]=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],_0x3e9a79[_0xab44('0x30')]);_0x54f603['attributes']=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],qs[_0xab44('0x35')](_0x3cb9fc[_0xab44('0x30')]['fields']));_0x54f603[_0xab44('0x34')]=_0x54f603[_0xab44('0x34')][_0xab44('0x36')]?_0x54f603['attributes']:_0x3e9a79[_0xab44('0x2e')];if(_0x3cb9fc[_0xab44('0x30')][_0xab44('0x41')]){_0x54f603[_0xab44('0x42')]=[{'all':!![]}];}_0x54f603=_['merge']({},_0x54f603,_0x3cb9fc[_0xab44('0x40')]);return db['ContactItemType'][_0xab44('0x48')](_0x54f603)[_0xab44('0x23')](handleEntityNotFound(_0x9a6da5,null))[_0xab44('0x23')](respondWithResult(_0x9a6da5,null))[_0xab44('0x45')](handleError(_0x9a6da5,null));};exports['create']=function(_0x328891,_0x5497a3){return db[_0xab44('0x29')][_0xab44('0x49')](_0x328891[_0xab44('0x4a')],{})[_0xab44('0x23')](function(_0x14bd54){var _0x4eeef0=_0x328891[_0xab44('0x4b')]['get']({'plain':!![]});if(!_0x4eeef0)throw new Error(_0xab44('0x4c'));if(_0x4eeef0[_0xab44('0x4d')]===_0xab44('0x4b')){var _0x50b705=_0x14bd54[_0xab44('0x4e')]({'plain':!![]});var _0x105a89=_0xab44('0x4f');return db[_0xab44('0x50')][_0xab44('0x48')]({'where':{'name':_0x105a89,'userProfileId':_0x4eeef0['userProfileId']},'raw':!![]})['then'](function(_0xe5302b){if(_0xe5302b&&_0xe5302b[_0xab44('0x51')]===0x0){return db[_0xab44('0x24')]['create']({'name':_0x50b705[_0xab44('0x27')],'resourceId':_0x50b705['id'],'type':_0xe5302b[_0xab44('0x27')],'sectionId':_0xe5302b['id']},{})[_0xab44('0x23')](function(){return _0x14bd54;});}else{return _0x14bd54;}})[_0xab44('0x45')](function(_0x4eb2eb){logger['error'](_0xab44('0x52'),_0x4eb2eb);throw _0x4eb2eb;});}return _0x14bd54;})[_0xab44('0x23')](respondWithResult(_0x5497a3,0xc9))[_0xab44('0x45')](handleError(_0x5497a3,null));};exports[_0xab44('0x22')]=function(_0x109f38,_0x2234c0){if(_0x109f38[_0xab44('0x4a')]['id']){delete _0x109f38[_0xab44('0x4a')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x109f38[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x2234c0,null))[_0xab44('0x23')](saveUpdates(_0x109f38[_0xab44('0x4a')],null))[_0xab44('0x23')](respondWithResult(_0x2234c0,null))[_0xab44('0x45')](handleError(_0x2234c0,null));};exports[_0xab44('0x53')]=function(_0x411bac,_0x1e606b){return db['ContactItemType'][_0xab44('0x48')]({'where':{'id':_0x411bac[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x1e606b,null))[_0xab44('0x23')](db[_0xab44('0x54')][_0xab44('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x411bac[_0xab44('0x47')]['id']}}))[_0xab44('0x23')](removeEntity(_0x1e606b,null))['catch'](handleError(_0x1e606b,null));}; \ No newline at end of file +var _0xf4f4=['json','apply','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','sendStatus','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ContactItemType','includeAll','show','include','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x1dab66,_0x28c01a){var _0x4665a5=function(_0x501992){while(--_0x501992){_0x1dab66['push'](_0x1dab66['shift']());}};_0x4665a5(++_0x28c01a);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x3b885f,_0x265272){_0x3b885f=_0x3b885f-0x0;var _0x33d23e=_0xf4f4[_0x3b885f];return _0x33d23e;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){var _0x15859c=_0x43e661[_0x4f4f('0x28')]({'plain':!![]});var _0x2ec92a=_0x4f4f('0x29');return db[_0x4f4f('0x2a')][_0x4f4f('0x2b')]({'where':{'type':_0x2ec92a,'resourceId':_0x15859c['id']}})['then'](function(){return _0x43e661;});})[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x2c')]();});}};}function handleEntityNotFound(_0x15c79c,_0x18e864){return function(_0x4ad33d){if(!_0x4ad33d){_0x15c79c[_0x4f4f('0x2d')](0x194);}return _0x4ad33d;};}function handleError(_0xaf3de1,_0x7180f8){_0x7180f8=_0x7180f8||0x1f4;return function(_0x5deda9){logger['error'](_0x5deda9['stack']);if(_0x5deda9[_0x4f4f('0x2e')]){delete _0x5deda9['name'];}_0xaf3de1[_0x4f4f('0x1b')](_0x7180f8)[_0x4f4f('0x2f')](_0x5deda9);};}exports[_0x4f4f('0x30')]=function(_0x5eb7c9,_0x460546){var _0x1b6f53={},_0x5dd5a3={},_0x413b71={'count':0x0,'rows':[]};var _0x1a551a=_[_0x4f4f('0x31')](db['ContactItemType'][_0x4f4f('0x32')],function(_0x343c75){return{'name':_0x343c75['fieldName'],'type':_0x343c75['type'][_0x4f4f('0x33')]};});_0x5dd5a3[_0x4f4f('0x34')]=_[_0x4f4f('0x31')](_0x1a551a,_0x4f4f('0x2e'));_0x5dd5a3[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x5eb7c9[_0x4f4f('0x35')]);_0x5dd5a3[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x5dd5a3[_0x4f4f('0x34')],_0x5dd5a3['query']);_0x1b6f53['attributes']=_[_0x4f4f('0x38')](_0x5dd5a3['model'],qs[_0x4f4f('0x39')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x39')]));_0x1b6f53[_0x4f4f('0x3a')]=_0x1b6f53[_0x4f4f('0x3a')][_0x4f4f('0x3b')]?_0x1b6f53[_0x4f4f('0x3a')]:_0x5dd5a3[_0x4f4f('0x34')];if(!_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x3c')](_0x4f4f('0x3d'))){_0x1b6f53[_0x4f4f('0x1e')]=qs['limit'](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1e')]);_0x1b6f53[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x1c')]);}_0x1b6f53[_0x4f4f('0x3e')]=qs[_0x4f4f('0x3f')](_0x5eb7c9[_0x4f4f('0x35')]['sort']);_0x1b6f53[_0x4f4f('0x40')]=qs[_0x4f4f('0x37')](_[_0x4f4f('0x41')](_0x5eb7c9['query'],_0x5dd5a3['filters']),_0x1a551a);if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x42')]){_0x1b6f53[_0x4f4f('0x40')]=_[_0x4f4f('0x43')](_0x1b6f53[_0x4f4f('0x40')],{'$or':_[_0x4f4f('0x31')](_0x1a551a,function(_0x1c012d){if(_0x1c012d[_0x4f4f('0x44')]!==_0x4f4f('0x45')){var _0x455aa0={};_0x455aa0[_0x1c012d[_0x4f4f('0x2e')]]={'$like':'%'+_0x5eb7c9[_0x4f4f('0x35')]['filter']+'%'};return _0x455aa0;}})});}_0x1b6f53=_[_0x4f4f('0x43')]({},_0x1b6f53,_0x5eb7c9[_0x4f4f('0x46')]);var _0x306ee7={'where':_0x1b6f53[_0x4f4f('0x40')]};return db[_0x4f4f('0x47')]['count'](_0x306ee7)['then'](function(_0x134710){_0x413b71[_0x4f4f('0x1f')]=_0x134710;if(_0x5eb7c9[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x1b6f53['include']=[{'all':!![]}];}return db[_0x4f4f('0x47')]['findAll'](_0x1b6f53);})[_0x4f4f('0x27')](function(_0x5a7c94){_0x413b71['rows']=_0x5a7c94;return _0x413b71;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x460546,_0x1b6f53))['catch'](handleError(_0x460546,null));};exports[_0x4f4f('0x49')]=function(_0x2af7a7,_0x5e1c20){var _0x220df1={'raw':!![],'where':{'id':_0x2af7a7['params']['id']}},_0x2d8ff6={};_0x2d8ff6[_0x4f4f('0x34')]=_[_0x4f4f('0x36')](db[_0x4f4f('0x47')][_0x4f4f('0x32')]);_0x2d8ff6[_0x4f4f('0x35')]=_[_0x4f4f('0x36')](_0x2af7a7[_0x4f4f('0x35')]);_0x2d8ff6[_0x4f4f('0x37')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],_0x2d8ff6[_0x4f4f('0x35')]);_0x220df1[_0x4f4f('0x3a')]=_[_0x4f4f('0x38')](_0x2d8ff6[_0x4f4f('0x34')],qs[_0x4f4f('0x39')](_0x2af7a7['query'][_0x4f4f('0x39')]));_0x220df1['attributes']=_0x220df1['attributes'][_0x4f4f('0x3b')]?_0x220df1[_0x4f4f('0x3a')]:_0x2d8ff6['model'];if(_0x2af7a7[_0x4f4f('0x35')][_0x4f4f('0x48')]){_0x220df1[_0x4f4f('0x4a')]=[{'all':!![]}];}_0x220df1=_[_0x4f4f('0x43')]({},_0x220df1,_0x2af7a7[_0x4f4f('0x46')]);return db['ContactItemType'][_0x4f4f('0x4b')](_0x220df1)[_0x4f4f('0x27')](handleEntityNotFound(_0x5e1c20,null))[_0x4f4f('0x27')](respondWithResult(_0x5e1c20,null))[_0x4f4f('0x4c')](handleError(_0x5e1c20,null));};exports[_0x4f4f('0x4d')]=function(_0x433787,_0x29314b){return db[_0x4f4f('0x47')][_0x4f4f('0x4d')](_0x433787['body'],{})[_0x4f4f('0x27')](function(_0xd3b763){var _0x4b33a5=_0x433787['user']['get']({'plain':!![]});if(!_0x4b33a5)throw new Error(_0x4f4f('0x4e'));if(_0x4b33a5[_0x4f4f('0x4f')]===_0x4f4f('0x50')){var _0x5c5077=_0xd3b763[_0x4f4f('0x28')]({'plain':!![]});var _0x5db92e=_0x4f4f('0x29');return db[_0x4f4f('0x51')][_0x4f4f('0x4b')]({'where':{'name':_0x5db92e,'userProfileId':_0x4b33a5[_0x4f4f('0x52')]},'raw':!![]})[_0x4f4f('0x27')](function(_0x1d0867){if(_0x1d0867&&_0x1d0867[_0x4f4f('0x53')]===0x0){return db[_0x4f4f('0x2a')][_0x4f4f('0x4d')]({'name':_0x5c5077['name'],'resourceId':_0x5c5077['id'],'type':_0x1d0867['name'],'sectionId':_0x1d0867['id']},{})[_0x4f4f('0x27')](function(){return _0xd3b763;});}else{return _0xd3b763;}})[_0x4f4f('0x4c')](function(_0x4c04eb){logger['error'](_0x4f4f('0x54'),_0x4c04eb);throw _0x4c04eb;});}return _0xd3b763;})[_0x4f4f('0x27')](respondWithResult(_0x29314b,0xc9))[_0x4f4f('0x4c')](handleError(_0x29314b,null));};exports['update']=function(_0x4a7622,_0x27c7fc){if(_0x4a7622[_0x4f4f('0x55')]['id']){delete _0x4a7622[_0x4f4f('0x55')]['id'];}return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x4a7622[_0x4f4f('0x56')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x27c7fc,null))[_0x4f4f('0x27')](saveUpdates(_0x4a7622[_0x4f4f('0x55')],null))[_0x4f4f('0x27')](respondWithResult(_0x27c7fc,null))[_0x4f4f('0x4c')](handleError(_0x27c7fc,null));};exports['destroy']=function(_0x585c06,_0x376aea){return db[_0x4f4f('0x47')][_0x4f4f('0x4b')]({'where':{'id':_0x585c06[_0x4f4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x376aea,null))[_0x4f4f('0x27')](db['CmContactHasItem'][_0x4f4f('0x26')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x585c06[_0x4f4f('0x56')]['id']}}))[_0x4f4f('0x27')](removeEntity(_0x376aea,null))['catch'](handleError(_0x376aea,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4c5bda5..aea15cf 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf9ea=['bluebird','request-promise','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment'];(function(_0x35c07e,_0x3daa9d){var _0x4cadde=function(_0xdb18a){while(--_0xdb18a){_0x35c07e['push'](_0x35c07e['shift']());}};_0x4cadde(++_0x3daa9d);}(_0xf9ea,0xa0));var _0xaf9e=function(_0x5a17d6,_0x514820){_0x5a17d6=_0x5a17d6-0x0;var _0x409d71=_0xf9ea[_0x5a17d6];return _0x409d71;};'use strict';var _=require(_0xaf9e('0x0'));var util=require(_0xaf9e('0x1'));var logger=require(_0xaf9e('0x2'))(_0xaf9e('0x3'));var moment=require(_0xaf9e('0x4'));var BPromise=require(_0xaf9e('0x5'));var rp=require(_0xaf9e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xaf9e('0x7'));var attributes=require(_0xaf9e('0x8'));module['exports']=function(_0x3a9cb4,_0x9fc51e){return _0x3a9cb4['define'](_0xaf9e('0x9'),attributes,{'tableName':_0xaf9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4184=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./contactItemType.attributes','exports','define','lodash'];(function(_0x520427,_0x5b247e){var _0xaf230b=function(_0x3dcca5){while(--_0x3dcca5){_0x520427['push'](_0x520427['shift']());}};_0xaf230b(++_0x5b247e);}(_0x4184,0x180));var _0x4418=function(_0x491a92,_0x2c2202){_0x491a92=_0x491a92-0x0;var _0x4ed7f5=_0x4184[_0x491a92];return _0x4ed7f5;};'use strict';var _=require(_0x4418('0x0'));var util=require(_0x4418('0x1'));var logger=require(_0x4418('0x2'))(_0x4418('0x3'));var moment=require(_0x4418('0x4'));var BPromise=require(_0x4418('0x5'));var rp=require(_0x4418('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4418('0x7'));var attributes=require(_0x4418('0x8'));module[_0x4418('0x9')]=function(_0x29eeeb,_0x85fcbc){return _0x29eeeb[_0x4418('0xa')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 8c2d274..94917c5 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeff5=['error','code','message','result','catch','lodash','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x4b472c,_0x2ac014){var _0x5063c5=function(_0x542859){while(--_0x542859){_0x4b472c['push'](_0x4b472c['shift']());}};_0x5063c5(++_0x2ac014);}(_0xeff5,0x101));var _0x5eff=function(_0x24ef13,_0x4b947d){_0x24ef13=_0x24ef13-0x0;var _0x461204=_0xeff5[_0x24ef13];return _0x461204;};'use strict';var _=require(_0x5eff('0x0'));var util=require('util');var moment=require(_0x5eff('0x1'));var BPromise=require('bluebird');var rs=require(_0x5eff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5eff('0x3'))(_0x5eff('0x4'));var config=require(_0x5eff('0x5'));var jayson=require(_0x5eff('0x6'));var client=jayson[_0x5eff('0x7')][_0x5eff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31e993,_0x446a04,_0x109f8e){return new BPromise(function(_0x386143,_0x2a1f37){return client[_0x5eff('0x9')](_0x31e993,_0x109f8e)[_0x5eff('0xa')](function(_0x432819){logger[_0x5eff('0xb')](_0x5eff('0xc'),_0x446a04,_0x5eff('0xd'));logger[_0x5eff('0xe')](_0x5eff('0xf'),_0x446a04,_0x5eff('0xd'),JSON['stringify'](_0x432819));if(_0x432819[_0x5eff('0x10')]){if(_0x432819['error'][_0x5eff('0x11')]===0x1f4){logger['error']('ContactItemType,\x20%s,\x20%s',_0x446a04,_0x432819['error'][_0x5eff('0x12')]);return _0x2a1f37(_0x432819['error'][_0x5eff('0x12')]);}logger['error'](_0x5eff('0xc'),_0x446a04,_0x432819[_0x5eff('0x10')][_0x5eff('0x12')]);return _0x386143(_0x432819['error'][_0x5eff('0x12')]);}else{logger[_0x5eff('0xb')](_0x5eff('0xc'),_0x446a04,'request\x20sent');_0x386143(_0x432819[_0x5eff('0x13')][_0x5eff('0x12')]);}})[_0x5eff('0x14')](function(_0x2c4526){logger[_0x5eff('0x10')]('ContactItemType,\x20%s,\x20%s',_0x446a04,_0x2c4526);_0x2a1f37(_0x2c4526);});});} \ No newline at end of file +var _0xe809=['../../config/environment','jayson/promise','http','request','info','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x572bf2,_0x10105c){var _0x221f8f=function(_0x33def2){while(--_0x33def2){_0x572bf2['push'](_0x572bf2['shift']());}};_0x221f8f(++_0x10105c);}(_0xe809,0xa1));var _0x9e80=function(_0x22a9f8,_0x3b3a66){_0x22a9f8=_0x22a9f8-0x0;var _0xc2c526=_0xe809[_0x22a9f8];return _0xc2c526;};'use strict';var _=require(_0x9e80('0x0'));var util=require('util');var moment=require(_0x9e80('0x1'));var BPromise=require(_0x9e80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e80('0x3'));var db=require(_0x9e80('0x4'))['db'];var utils=require(_0x9e80('0x5'));var logger=require(_0x9e80('0x6'))('rpc');var config=require(_0x9e80('0x7'));var jayson=require(_0x9e80('0x8'));var client=jayson['client'][_0x9e80('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53cbad,_0x1096bf,_0x4c9d10){return new BPromise(function(_0x35dcb9,_0x4b6f98){return client[_0x9e80('0xa')](_0x53cbad,_0x4c9d10)['then'](function(_0x5ef8ad){logger[_0x9e80('0xb')]('ContactItemType,\x20%s,\x20%s',_0x1096bf,'request\x20sent');logger[_0x9e80('0xc')](_0x9e80('0xd'),_0x1096bf,'request\x20sent',JSON[_0x9e80('0xe')](_0x5ef8ad));if(_0x5ef8ad['error']){if(_0x5ef8ad[_0x9e80('0xf')][_0x9e80('0x10')]===0x1f4){logger[_0x9e80('0xf')](_0x9e80('0x11'),_0x1096bf,_0x5ef8ad[_0x9e80('0xf')][_0x9e80('0x12')]);return _0x4b6f98(_0x5ef8ad['error'][_0x9e80('0x12')]);}logger['error'](_0x9e80('0x11'),_0x1096bf,_0x5ef8ad[_0x9e80('0xf')][_0x9e80('0x12')]);return _0x35dcb9(_0x5ef8ad[_0x9e80('0xf')]['message']);}else{logger[_0x9e80('0xb')](_0x9e80('0x11'),_0x1096bf,_0x9e80('0x13'));_0x35dcb9(_0x5ef8ad[_0x9e80('0x14')][_0x9e80('0x12')]);}})['catch'](function(_0x3e7aaa){logger[_0x9e80('0xf')]('ContactItemType,\x20%s,\x20%s',_0x1096bf,_0x3e7aaa);_0x4b6f98(_0x3e7aaa);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 832ba8e..ad65db2 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0cf3=['put','isAuthenticated','update','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','/:id','post','create'];(function(_0xaad2f8,_0x4b7e6b){var _0x2096d8=function(_0x32d7ef){while(--_0x32d7ef){_0xaad2f8['push'](_0xaad2f8['shift']());}};_0x2096d8(++_0x4b7e6b);}(_0x0cf3,0x1a2));var _0x30cf=function(_0x1aebee,_0x1a0452){_0x1aebee=_0x1aebee-0x0;var _0x1399e9=_0x0cf3[_0x1aebee];return _0x1399e9;};'use strict';var multer=require(_0x30cf('0x0'));var util=require(_0x30cf('0x1'));var path=require(_0x30cf('0x2'));var timeout=require('connect-timeout');var express=require(_0x30cf('0x3'));var router=express['Router']();var fs_extra=require(_0x30cf('0x4'));var auth=require(_0x30cf('0x5'));var interaction=require(_0x30cf('0x6'));var config=require(_0x30cf('0x7'));var controller=require(_0x30cf('0x8'));router[_0x30cf('0x9')]('/',auth['isAuthenticated'](),controller[_0x30cf('0xa')]);router[_0x30cf('0x9')](_0x30cf('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x30cf('0xc')]('/',auth['isAuthenticated'](),controller[_0x30cf('0xd')]);router[_0x30cf('0xe')](_0x30cf('0xb'),auth[_0x30cf('0xf')](),controller[_0x30cf('0x10')]);router[_0x30cf('0x11')]('/:id',auth[_0x30cf('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9d0=['show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','index','isAuthenticated'];(function(_0x2f4f25,_0x592d31){var _0x6a112a=function(_0x112d68){while(--_0x112d68){_0x2f4f25['push'](_0x2f4f25['shift']());}};_0x6a112a(++_0x592d31);}(_0xa9d0,0x1c0));var _0x0a9d=function(_0x3d7a2d,_0x2b19c1){_0x3d7a2d=_0x3d7a2d-0x0;var _0x338476=_0xa9d0[_0x3d7a2d];return _0x338476;};'use strict';var multer=require(_0x0a9d('0x0'));var util=require(_0x0a9d('0x1'));var path=require(_0x0a9d('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a9d('0x3'));var router=express[_0x0a9d('0x4')]();var fs_extra=require(_0x0a9d('0x5'));var auth=require(_0x0a9d('0x6'));var interaction=require(_0x0a9d('0x7'));var config=require('../../config/environment');var controller=require(_0x0a9d('0x8'));router[_0x0a9d('0x9')]('/',auth['isAuthenticated'](),controller[_0x0a9d('0xa')]);router[_0x0a9d('0x9')]('/:id',auth[_0x0a9d('0xb')](),controller[_0x0a9d('0xc')]);router[_0x0a9d('0xd')]('/',auth['isAuthenticated'](),controller[_0x0a9d('0xe')]);router['put'](_0x0a9d('0xf'),auth[_0x0a9d('0xb')](),controller[_0x0a9d('0x10')]);router[_0x0a9d('0x11')](_0x0a9d('0xf'),auth[_0x0a9d('0xb')](),controller[_0x0a9d('0x12')]);module[_0x0a9d('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 8534c47..f1bcba1 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(_0x789e83,_0x324622){var _0x5ebbb4=function(_0x47dbf1){while(--_0x47dbf1){_0x789e83['push'](_0x789e83['shift']());}};_0x5ebbb4(++_0x324622);}(_0x2032,0xd9));var _0x2203=function(_0x170a2d,_0xc4d9f3){_0x170a2d=_0x170a2d-0x0;var _0x5bfeb4=_0x2032[_0x170a2d];return _0x5bfeb4;};'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 _0x2032=['name','exports','STRING'];(function(_0x2f6354,_0xcd29bb){var _0x277279=function(_0x25e236){while(--_0x25e236){_0x2f6354['push'](_0x2f6354['shift']());}};_0x277279(++_0xcd29bb);}(_0x2032,0xd9));var _0x2203=function(_0x5565fc,_0x14fe50){_0x5565fc=_0x5565fc-0x0;var _0x3de5bd=_0x2032[_0x5565fc];return _0x3de5bd;};'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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index aa6d253..bbc52bc 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 _0x2e47=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','destroy','CustomDashboards','UserProfileResource','then','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','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','clone','find','omit','updatedAt','createdAt','UserProfileSection','update','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x286f62,_0x51bcf0){var _0x592ac0=function(_0x18d68d){while(--_0x18d68d){_0x286f62['push'](_0x286f62['shift']());}};_0x592ac0(++_0x51bcf0);}(_0x2e47,0x6e));var _0x72e4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2e47[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x72e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72e4('0x1'));var jsonpatch=require(_0x72e4('0x2'));var rp=require(_0x72e4('0x3'));var moment=require(_0x72e4('0x4'));var BPromise=require(_0x72e4('0x5'));var Mustache=require(_0x72e4('0x6'));var util=require(_0x72e4('0x7'));var path=require(_0x72e4('0x8'));var sox=require(_0x72e4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x72e4('0xa'));var _=require(_0x72e4('0xb'));var squel=require(_0x72e4('0xc'));var crypto=require('crypto');var jsforce=require(_0x72e4('0xd'));var deskjs=require(_0x72e4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x72e4('0xf'));var Papa=require(_0x72e4('0x10'));var Redis=require(_0x72e4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x72e4('0x12'));var as=require(_0x72e4('0x13'));var hardwareService=require(_0x72e4('0x14'));var logger=require(_0x72e4('0x15'))(_0x72e4('0x16'));var utils=require(_0x72e4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x72e4('0x18'));var db=require('../../mysqldb')['db'];config[_0x72e4('0x19')]=_['defaults'](config[_0x72e4('0x19')],{'host':_0x72e4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72e4('0x19')]));require('./dashboard.socket')[_0x72e4('0x1b')](socket);function respondWithStatusCode(_0x3b3a39,_0x3ea585){_0x3ea585=_0x3ea585||0xcc;return function(_0x2f27d8){if(_0x2f27d8){return _0x3b3a39[_0x72e4('0x1c')](_0x3ea585);}return _0x3b3a39[_0x72e4('0x1d')](_0x3ea585)[_0x72e4('0x1e')]();};}function respondWithResult(_0x4e987b,_0x3a0e2c){_0x3a0e2c=_0x3a0e2c||0xc8;return function(_0x36e21e){if(_0x36e21e){return _0x4e987b[_0x72e4('0x1d')](_0x3a0e2c)[_0x72e4('0x1f')](_0x36e21e);}};}function respondWithFilteredResult(_0x47fde3,_0x303b3e){return function(_0x17e30c){if(_0x17e30c){var _0x4f1ebe=typeof _0x303b3e[_0x72e4('0x20')]==='undefined'&&typeof _0x303b3e[_0x72e4('0x21')]===_0x72e4('0x22');var _0x37cd23=_0x17e30c[_0x72e4('0x23')];var _0x3b34a7=_0x4f1ebe?0x0:_0x303b3e['offset'];var _0xa4bd28=_0x4f1ebe?_0x17e30c[_0x72e4('0x23')]:_0x303b3e[_0x72e4('0x20')]+_0x303b3e['limit'];var _0x1f02b9;if(_0xa4bd28>=_0x37cd23){_0xa4bd28=_0x37cd23;_0x1f02b9=0xc8;}else{_0x1f02b9=0xce;}_0x47fde3[_0x72e4('0x1d')](_0x1f02b9);return _0x47fde3['set'](_0x72e4('0x24'),_0x3b34a7+'-'+_0xa4bd28+'/'+_0x37cd23)['json'](_0x17e30c);}return null;};}function patchUpdates(_0x301dae){return function(_0x517caf){try{jsonpatch[_0x72e4('0x25')](_0x517caf,_0x301dae,!![]);}catch(_0x3b9f0e){return BPromise[_0x72e4('0x26')](_0x3b9f0e);}return _0x517caf['save']();};}function saveUpdates(_0x32f7b7,_0x1b11ca){return function(_0x2abc33){if(_0x2abc33){return _0x2abc33['update'](_0x32f7b7)['then'](function(_0x4f0914){return _0x4f0914;});}return null;};}function removeEntity(_0x57379d,_0x30dd85){return function(_0x57161e){if(_0x57161e){return _0x57161e[_0x72e4('0x27')]()['then'](function(){var _0x4bf11e=_0x57161e['get']({'plain':!![]});var _0x325234=_0x72e4('0x28');return db[_0x72e4('0x29')][_0x72e4('0x27')]({'where':{'type':_0x325234,'resourceId':_0x4bf11e['id']}})[_0x72e4('0x2a')](function(){return _0x57161e;});})[_0x72e4('0x2a')](function(){_0x57379d[_0x72e4('0x1d')](0xcc)[_0x72e4('0x1e')]();});}};}function handleEntityNotFound(_0x1d68eb,_0x51b38d){return function(_0x3b74ca){if(!_0x3b74ca){_0x1d68eb[_0x72e4('0x1c')](0x194);}return _0x3b74ca;};}function handleError(_0x4789eb,_0x2849a){_0x2849a=_0x2849a||0x1f4;return function(_0x2dfd56){logger[_0x72e4('0x2b')](_0x2dfd56[_0x72e4('0x2c')]);if(_0x2dfd56['name']){delete _0x2dfd56[_0x72e4('0x2d')];}_0x4789eb['status'](_0x2849a)[_0x72e4('0x2e')](_0x2dfd56);};}exports[_0x72e4('0x2f')]=function(_0x3b1807,_0x56391a){var _0x4b205a={},_0x3bb296={},_0x4a1292={'count':0x0,'rows':[]};var _0xcce211=_[_0x72e4('0x30')](db[_0x72e4('0x31')][_0x72e4('0x32')],function(_0x507a40){return{'name':_0x507a40[_0x72e4('0x33')],'type':_0x507a40[_0x72e4('0x34')][_0x72e4('0x35')]};});_0x3bb296['model']=_[_0x72e4('0x30')](_0xcce211,_0x72e4('0x2d'));_0x3bb296[_0x72e4('0x36')]=_[_0x72e4('0x37')](_0x3b1807[_0x72e4('0x36')]);_0x3bb296[_0x72e4('0x38')]=_[_0x72e4('0x39')](_0x3bb296[_0x72e4('0x3a')],_0x3bb296['query']);_0x4b205a[_0x72e4('0x3b')]=_['intersection'](_0x3bb296[_0x72e4('0x3a')],qs['fields'](_0x3b1807[_0x72e4('0x36')][_0x72e4('0x3c')]));_0x4b205a[_0x72e4('0x3b')]=_0x4b205a[_0x72e4('0x3b')][_0x72e4('0x3d')]?_0x4b205a[_0x72e4('0x3b')]:_0x3bb296['model'];if(!_0x3b1807['query']['hasOwnProperty'](_0x72e4('0x3e'))){_0x4b205a['limit']=qs[_0x72e4('0x21')](_0x3b1807['query'][_0x72e4('0x21')]);_0x4b205a[_0x72e4('0x20')]=qs[_0x72e4('0x20')](_0x3b1807['query'][_0x72e4('0x20')]);}_0x4b205a['order']=qs['sort'](_0x3b1807[_0x72e4('0x36')][_0x72e4('0x3f')]);_0x4b205a[_0x72e4('0x40')]=qs[_0x72e4('0x38')](_['pick'](_0x3b1807[_0x72e4('0x36')],_0x3bb296['filters']),_0xcce211);if(_0x3b1807['query'][_0x72e4('0x41')]){_0x4b205a['where']=_[_0x72e4('0x42')](_0x4b205a[_0x72e4('0x40')],{'$or':_[_0x72e4('0x30')](_0xcce211,function(_0x5e91c4){if(_0x5e91c4[_0x72e4('0x34')]!==_0x72e4('0x43')){var _0x423a27={};_0x423a27[_0x5e91c4['name']]={'$like':'%'+_0x3b1807[_0x72e4('0x36')]['filter']+'%'};return _0x423a27;}})});}_0x4b205a=_[_0x72e4('0x42')]({},_0x4b205a,_0x3b1807[_0x72e4('0x44')]);var _0x17396c={'where':_0x4b205a['where']};return db['Dashboard'][_0x72e4('0x23')](_0x17396c)[_0x72e4('0x2a')](function(_0x2806db){_0x4a1292['count']=_0x2806db;if(_0x3b1807[_0x72e4('0x36')][_0x72e4('0x45')]){_0x4b205a[_0x72e4('0x46')]=[{'all':!![]}];}return db[_0x72e4('0x31')][_0x72e4('0x47')](_0x4b205a);})[_0x72e4('0x2a')](function(_0x139bff){_0x4a1292[_0x72e4('0x48')]=_0x139bff;return _0x4a1292;})['then'](respondWithFilteredResult(_0x56391a,_0x4b205a))['catch'](handleError(_0x56391a,null));};exports[_0x72e4('0x49')]=function(_0x1e0d36,_0x33a3f9){var _0x5e203f={'raw':![],'where':{'id':_0x1e0d36[_0x72e4('0x4a')]['id']}},_0xbcb769={};_0xbcb769[_0x72e4('0x3a')]=_[_0x72e4('0x37')](db['Dashboard'][_0x72e4('0x32')]);_0xbcb769[_0x72e4('0x36')]=_[_0x72e4('0x37')](_0x1e0d36[_0x72e4('0x36')]);_0xbcb769['filters']=_[_0x72e4('0x39')](_0xbcb769[_0x72e4('0x3a')],_0xbcb769[_0x72e4('0x36')]);_0x5e203f[_0x72e4('0x3b')]=_[_0x72e4('0x39')](_0xbcb769['model'],qs[_0x72e4('0x3c')](_0x1e0d36['query'][_0x72e4('0x3c')]));_0x5e203f[_0x72e4('0x3b')]=_0x5e203f['attributes']['length']?_0x5e203f[_0x72e4('0x3b')]:_0xbcb769[_0x72e4('0x3a')];if(_0x1e0d36[_0x72e4('0x36')][_0x72e4('0x45')]){_0x5e203f[_0x72e4('0x46')]=[{'all':!![]}];}_0x5e203f=_['merge']({},_0x5e203f,_0x1e0d36[_0x72e4('0x44')]);return db[_0x72e4('0x31')]['find'](_0x5e203f)[_0x72e4('0x2a')](handleEntityNotFound(_0x33a3f9,null))[_0x72e4('0x2a')](respondWithResult(_0x33a3f9,null))[_0x72e4('0x4b')](handleError(_0x33a3f9,null));};exports[_0x72e4('0x4c')]=function(_0x4247e7,_0x5a4237){return db[_0x72e4('0x31')][_0x72e4('0x4c')](_0x4247e7[_0x72e4('0x4d')],{})[_0x72e4('0x2a')](function(_0x507cda){var _0x10fbb0=_0x4247e7[_0x72e4('0x4e')]['get']({'plain':!![]});if(!_0x10fbb0)throw new Error(_0x72e4('0x4f'));if(_0x10fbb0[_0x72e4('0x50')]===_0x72e4('0x4e')){var _0x3d0de2=_0x507cda[_0x72e4('0x51')]({'plain':!![]});var _0x14e051=_0x72e4('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x14e051,'userProfileId':_0x10fbb0[_0x72e4('0x52')]},'raw':!![]})[_0x72e4('0x2a')](function(_0x3bb7a7){if(_0x3bb7a7&&_0x3bb7a7[_0x72e4('0x53')]===0x0){return db[_0x72e4('0x29')][_0x72e4('0x4c')]({'name':_0x3d0de2['name'],'resourceId':_0x3d0de2['id'],'type':_0x3bb7a7['name'],'sectionId':_0x3bb7a7['id']},{})['then'](function(){return _0x507cda;});}else{return _0x507cda;}})[_0x72e4('0x4b')](function(_0x5b6eb7){logger[_0x72e4('0x2b')](_0x72e4('0x54'),_0x5b6eb7);throw _0x5b6eb7;});}return _0x507cda;})[_0x72e4('0x2a')](respondWithResult(_0x5a4237,0xc9))[_0x72e4('0x4b')](handleError(_0x5a4237,null));};exports[_0x72e4('0x55')]=function(_0xc658d8,_0x555cb9){var _0x29e74a={'where':{'id':_0xc658d8[_0x72e4('0x4a')]['id']}},_0x17f786={};_0x17f786[_0x72e4('0x3a')]=_[_0x72e4('0x37')](db[_0x72e4('0x31')]['rawAttributes']);_0x29e74a[_0x72e4('0x3b')]=_['intersection'](_0x17f786['model'],qs[_0x72e4('0x3c')](_0xc658d8[_0x72e4('0x36')][_0x72e4('0x3c')]));_0x29e74a[_0x72e4('0x3b')]=_0x29e74a[_0x72e4('0x3b')]['length']?_0x29e74a['attributes']:_0x17f786[_0x72e4('0x3a')];if(_0xc658d8[_0x72e4('0x36')][_0x72e4('0x45')]){_0x29e74a[_0x72e4('0x46')]=[{'all':!![]}];}_0x29e74a=_[_0x72e4('0x42')]({},_0x29e74a,_0xc658d8[_0x72e4('0x44')]);return db[_0x72e4('0x31')][_0x72e4('0x56')](_0x29e74a)[_0x72e4('0x2a')](handleEntityNotFound(_0x555cb9,null))[_0x72e4('0x2a')](function(_0x1216cb){if(_0x1216cb){var _0xbc1bba=_0x1216cb['get']({'plain':!![]});_0xbc1bba=qs[_0x72e4('0x57')](_0xbc1bba,['id','createdAt',_0x72e4('0x58')]);_0xc658d8['body']=_[_0x72e4('0x57')](_0xc658d8['body'],['id',_0x72e4('0x59'),_0x72e4('0x58')]);return db[_0x72e4('0x31')][_0x72e4('0x4c')](_['merge'](_0xbc1bba,_0xc658d8[_0x72e4('0x4d')]),{'include':_0xc658d8[_0x72e4('0x36')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5cd394){var _0x200eb7=_0xc658d8['user'][_0x72e4('0x51')]({'plain':!![]});if(!_0x200eb7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200eb7['role']==='user'){var _0x1d36db=_0x5cd394['get']({'plain':!![]});var _0x40735a=_0x72e4('0x28');return db[_0x72e4('0x5a')][_0x72e4('0x56')]({'where':{'name':_0x40735a,'userProfileId':_0x200eb7['userProfileId']},'raw':!![]})[_0x72e4('0x2a')](function(_0x1bcd20){if(_0x1bcd20&&_0x1bcd20[_0x72e4('0x53')]===0x0){return db[_0x72e4('0x29')]['create']({'name':_0x1d36db[_0x72e4('0x2d')],'resourceId':_0x1d36db['id'],'type':_0x1bcd20[_0x72e4('0x2d')],'sectionId':_0x1bcd20['id']},{})[_0x72e4('0x2a')](function(){return _0x5cd394;});}else{return _0x5cd394;}})[_0x72e4('0x4b')](function(_0x9b0513){logger[_0x72e4('0x2b')](_0x72e4('0x54'),_0x9b0513);throw _0x9b0513;});}return _0x5cd394;});}})[_0x72e4('0x2a')](respondWithResult(_0x555cb9,0xc9))[_0x72e4('0x4b')](handleError(_0x555cb9,null));};exports[_0x72e4('0x5b')]=function(_0x59591a,_0x1babe9){if(_0x59591a['body']['id']){delete _0x59591a[_0x72e4('0x4d')]['id'];}return db[_0x72e4('0x31')]['find']({'where':{'id':_0x59591a['params']['id']}})[_0x72e4('0x2a')](handleEntityNotFound(_0x1babe9,null))[_0x72e4('0x2a')](saveUpdates(_0x59591a['body'],null))['then'](respondWithResult(_0x1babe9,null))['catch'](handleError(_0x1babe9,null));};exports[_0x72e4('0x27')]=function(_0x3bc98b,_0x30feb3){return db['Dashboard'][_0x72e4('0x56')]({'where':{'id':_0x3bc98b[_0x72e4('0x4a')]['id']}})[_0x72e4('0x2a')](handleEntityNotFound(_0x30feb3,null))['then'](removeEntity(_0x30feb3,null))[_0x72e4('0x4b')](handleError(_0x30feb3,null));};function widgetAttributes(_0x305a29){try{switch(_0x305a29[_0x72e4('0x34')]){case _0x72e4('0x5c'):return[{'name':_0x72e4('0x5d'),'value':_0x305a29[_0x72e4('0x5d')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29['attrs'][0x0][_0x72e4('0x5f')]:undefined)||_0x72e4('0x60')}];case'custom':return[{'name':_0x72e4('0x61'),'value':_0x305a29[_0x72e4('0x61')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29[_0x72e4('0x5e')][0x0][_0x72e4('0x5f')]:undefined)||''}];case _0x72e4('0x62'):return[{'name':_0x72e4('0x63'),'value':_0x305a29['attrHourFormat']||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x72e4('0x64'),'value':_0x305a29[_0x72e4('0x64')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x1]?_0x305a29[_0x72e4('0x5e')][0x1][_0x72e4('0x5f')]:undefined)||'0.00'},{'name':_0x72e4('0x65'),'value':_0x305a29[_0x72e4('0x65')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x2]?_0x305a29['attrs'][0x2]['value']:undefined)||0xc}];case _0x72e4('0x66'):return[{'name':_0x72e4('0x67'),'value':_0x305a29[_0x72e4('0x67')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29['attrs'][0x0][_0x72e4('0x5f')]:undefined)||_0x72e4('0x68')},{'name':'attrVoiceQueues','value':_0x305a29[_0x72e4('0x69')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x1]?_0x305a29[_0x72e4('0x5e')][0x1][_0x72e4('0x5f')]:undefined)||[]},{'name':_0x72e4('0x65'),'value':_0x305a29[_0x72e4('0x65')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x2]?_0x305a29[_0x72e4('0x5e')][0x2]['value']:undefined)||0x14},{'name':_0x72e4('0x6a'),'value':_0x305a29[_0x72e4('0x6a')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x3]?_0x305a29[_0x72e4('0x5e')][0x3][_0x72e4('0x5f')]:undefined)||_0x72e4('0x6b')},{'name':'attrEmailAccounts','value':_0x305a29[_0x72e4('0x6c')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x4]?_0x305a29[_0x72e4('0x5e')][0x4][_0x72e4('0x5f')]:undefined)||''},{'name':_0x72e4('0x6d'),'value':_0x305a29[_0x72e4('0x6d')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x5]?_0x305a29[_0x72e4('0x5e')][0x5]['value']:undefined)||''},{'name':_0x72e4('0x6e'),'value':_0x305a29[_0x72e4('0x6e')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x6]?_0x305a29[_0x72e4('0x5e')][0x6][_0x72e4('0x5f')]:undefined)||''},{'name':_0x72e4('0x6f'),'value':_0x305a29[_0x72e4('0x6f')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x7]?_0x305a29[_0x72e4('0x5e')][0x7]['value']:undefined)||''},{'name':_0x72e4('0x70'),'value':_0x305a29[_0x72e4('0x70')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x8]?_0x305a29[_0x72e4('0x5e')][0x8][_0x72e4('0x5f')]:undefined)||''},{'name':_0x72e4('0x71'),'value':_0x305a29['attrChatWebsites']||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x9]?_0x305a29['attrs'][0x9][_0x72e4('0x5f')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x72e4('0x72'),'value':_0x305a29['attrSerie1']||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x0]?_0x305a29['attrs'][0x0]['value']:undefined)||_0x72e4('0x68')},{'name':'attrSerie2','value':_0x305a29[_0x72e4('0x73')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x1]?_0x305a29['attrs'][0x1]['value']:undefined)||null},{'name':_0x72e4('0x74'),'value':_0x305a29[_0x72e4('0x74')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x2]?_0x305a29[_0x72e4('0x5e')][0x2][_0x72e4('0x5f')]:undefined)||null},{'name':_0x72e4('0x69'),'value':_0x305a29[_0x72e4('0x69')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x3]?_0x305a29[_0x72e4('0x5e')][0x3][_0x72e4('0x5f')]:undefined)||[]},{'name':'attrChannel','value':_0x305a29[_0x72e4('0x6a')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x4]?_0x305a29[_0x72e4('0x5e')][0x4]['value']:undefined)||_0x72e4('0x6b')},{'name':'attrEmailAccounts','value':_0x305a29[_0x72e4('0x6c')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x5]?_0x305a29[_0x72e4('0x5e')][0x5]['value']:undefined)||''},{'name':_0x72e4('0x6d'),'value':_0x305a29[_0x72e4('0x6d')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x6]?_0x305a29[_0x72e4('0x5e')][0x6]['value']:undefined)||''},{'name':_0x72e4('0x6e'),'value':_0x305a29['attrSmsAccounts']||(_0x305a29['attrs']&&_0x305a29['attrs'][0x7]?_0x305a29[_0x72e4('0x5e')][0x7][_0x72e4('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x305a29['attrOpenchannelAccounts']||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29[_0x72e4('0x5e')][0x8]?_0x305a29[_0x72e4('0x5e')][0x8][_0x72e4('0x5f')]:undefined)||''},{'name':_0x72e4('0x70'),'value':_0x305a29[_0x72e4('0x70')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x9]?_0x305a29['attrs'][0x9]['value']:undefined)||''},{'name':_0x72e4('0x71'),'value':_0x305a29[_0x72e4('0x71')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0xa]?_0x305a29[_0x72e4('0x5e')][0xa][_0x72e4('0x5f')]:undefined)||''}];case'web-report':return[{'name':_0x72e4('0x75'),'type':_0x305a29['reportType']||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29[_0x72e4('0x5e')][0x0][_0x72e4('0x34')]:undefined)||null,'value':_0x305a29[_0x72e4('0x75')]||(_0x305a29['attrs']&&_0x305a29[_0x72e4('0x5e')][0x0]?_0x305a29[_0x72e4('0x5e')][0x0][_0x72e4('0x5f')]:undefined)||null},{'name':'attrRefresh','value':_0x305a29[_0x72e4('0x76')]||(_0x305a29[_0x72e4('0x5e')]&&_0x305a29['attrs'][0x1]?_0x305a29[_0x72e4('0x5e')][0x1][_0x72e4('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x3b6874){logger[_0x72e4('0x2b')](_0x72e4('0x77'),JSON[_0x72e4('0x78')](_0x3b6874));return[];}}exports[_0x72e4('0x79')]=function(_0x36d345,_0x52aa76,_0xe23c25){if(_0x36d345['body']['id']){delete _0x36d345[_0x72e4('0x4d')]['id'];}return db[_0x72e4('0x31')]['find']({'where':{'id':_0x36d345['params']['id']}})[_0x72e4('0x2a')](handleEntityNotFound(_0x52aa76,null))['then'](function(_0x1be4d5){if(_0x1be4d5){_0x36d345[_0x72e4('0x4d')]['DashboardId']=_0x1be4d5['id'];_0x36d345[_0x72e4('0x4d')]['attrs']=widgetAttributes(_0x36d345[_0x72e4('0x4d')]);return db[_0x72e4('0x7a')]['create'](_0x36d345[_0x72e4('0x4d')]);}})[_0x72e4('0x2a')](respondWithResult(_0x52aa76,null))[_0x72e4('0x4b')](handleError(_0x52aa76,null));};exports[_0x72e4('0x7b')]=function(_0x16a902,_0x5cac48,_0x2ad85f){var _0x499269={};var _0x58bb68={};var _0x2ca9aa;var _0x29b66c;return db[_0x72e4('0x31')]['findOne']({'where':{'id':_0x16a902[_0x72e4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cac48,null))[_0x72e4('0x2a')](function(_0x1f6122){if(_0x1f6122){_0x2ca9aa=_0x1f6122;_0x58bb68[_0x72e4('0x3a')]=_[_0x72e4('0x37')](db[_0x72e4('0x7a')][_0x72e4('0x32')]);_0x58bb68[_0x72e4('0x36')]=_['keys'](_0x16a902[_0x72e4('0x36')]);_0x58bb68[_0x72e4('0x38')]=_['intersection'](_0x58bb68[_0x72e4('0x3a')],_0x58bb68[_0x72e4('0x36')]);_0x499269['attributes']=_[_0x72e4('0x39')](_0x58bb68[_0x72e4('0x3a')],qs[_0x72e4('0x3c')](_0x16a902[_0x72e4('0x36')][_0x72e4('0x3c')]));_0x499269[_0x72e4('0x3b')]=_0x499269[_0x72e4('0x3b')][_0x72e4('0x3d')]?_0x499269[_0x72e4('0x3b')]:_0x58bb68['model'];_0x499269[_0x72e4('0x7c')]=qs[_0x72e4('0x3f')](_0x16a902['query']['sort']);_0x499269[_0x72e4('0x40')]=qs[_0x72e4('0x38')](_['pick'](_0x16a902['query'],_0x58bb68[_0x72e4('0x38')]));if(_0x16a902[_0x72e4('0x36')][_0x72e4('0x41')]){_0x499269['where']=_[_0x72e4('0x42')](_0x499269[_0x72e4('0x40')],{'$or':_[_0x72e4('0x30')](_0x499269[_0x72e4('0x3b')],function(_0x351ab0){var _0xee469c={};_0xee469c[_0x351ab0]={'$like':'%'+_0x16a902[_0x72e4('0x36')][_0x72e4('0x41')]+'%'};return _0xee469c;})});}_0x499269=_[_0x72e4('0x42')]({},_0x499269,_0x16a902['options']);return _0x2ca9aa[_0x72e4('0x7b')](_0x499269);}})['then'](function(_0x447172){if(_0x447172){_0x29b66c=_0x447172[_0x72e4('0x3d')];if(!_0x16a902[_0x72e4('0x36')]['hasOwnProperty'](_0x72e4('0x3e'))){_0x499269[_0x72e4('0x21')]=qs[_0x72e4('0x21')](_0x16a902[_0x72e4('0x36')]['limit']);_0x499269[_0x72e4('0x20')]=qs[_0x72e4('0x20')](_0x16a902[_0x72e4('0x36')][_0x72e4('0x20')]);}return _0x2ca9aa[_0x72e4('0x7b')](_0x499269);}})[_0x72e4('0x2a')](function(_0x1c4954){if(_0x1c4954){return _0x1c4954?{'count':_0x29b66c,'rows':_0x1c4954}:null;}})['then'](respondWithResult(_0x5cac48,null))[_0x72e4('0x4b')](handleError(_0x5cac48,null));}; \ No newline at end of file +var _0x3a3d=['https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','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','addItem','DashboardItem','findOne','getItems','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','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','get','CustomDashboards','UserProfileResource','destroy','sendStatus','error','name','send','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value'];(function(_0x20cd56,_0x4c10cd){var _0x19ab81=function(_0x58179a){while(--_0x58179a){_0x20cd56['push'](_0x20cd56['shift']());}};_0x19ab81(++_0x4c10cd);}(_0x3a3d,0xa7));var _0xd3a3=function(_0x2bd6d9,_0x2071cb){_0x2bd6d9=_0x2bd6d9-0x0;var _0x4b4929=_0x3a3d[_0x2bd6d9];return _0x4b4929;};'use strict';var emlformat=require(_0xd3a3('0x0'));var rimraf=require(_0xd3a3('0x1'));var zipdir=require(_0xd3a3('0x2'));var jsonpatch=require(_0xd3a3('0x3'));var rp=require(_0xd3a3('0x4'));var moment=require(_0xd3a3('0x5'));var BPromise=require(_0xd3a3('0x6'));var Mustache=require(_0xd3a3('0x7'));var util=require(_0xd3a3('0x8'));var path=require(_0xd3a3('0x9'));var sox=require(_0xd3a3('0xa'));var csv=require(_0xd3a3('0xb'));var ejs=require(_0xd3a3('0xc'));var fs=require('fs');var fs_extra=require(_0xd3a3('0xd'));var _=require(_0xd3a3('0xe'));var squel=require(_0xd3a3('0xf'));var crypto=require('crypto');var jsforce=require(_0xd3a3('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd3a3('0x11'));var Papa=require(_0xd3a3('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd3a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a3('0x14'));var logger=require(_0xd3a3('0x15'))(_0xd3a3('0x16'));var utils=require(_0xd3a3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd3a3('0x18'));var db=require(_0xd3a3('0x19'))['db'];config[_0xd3a3('0x1a')]=_[_0xd3a3('0x1b')](config[_0xd3a3('0x1a')],{'host':_0xd3a3('0x1c'),'port':0x18eb});var socket=require(_0xd3a3('0x1d'))(new Redis(config['redis']));require(_0xd3a3('0x1e'))[_0xd3a3('0x1f')](socket);function respondWithStatusCode(_0x1f533f,_0x4a2078){_0x4a2078=_0x4a2078||0xcc;return function(_0x5133ec){if(_0x5133ec){return _0x1f533f['sendStatus'](_0x4a2078);}return _0x1f533f['status'](_0x4a2078)[_0xd3a3('0x20')]();};}function respondWithResult(_0x39b931,_0x5d12b9){_0x5d12b9=_0x5d12b9||0xc8;return function(_0x290c89){if(_0x290c89){return _0x39b931[_0xd3a3('0x21')](_0x5d12b9)[_0xd3a3('0x22')](_0x290c89);}};}function respondWithFilteredResult(_0x52a66c,_0x49dda6){return function(_0x363497){if(_0x363497){var _0x562264=typeof _0x49dda6[_0xd3a3('0x23')]===_0xd3a3('0x24')&&typeof _0x49dda6[_0xd3a3('0x25')]===_0xd3a3('0x24');var _0x378b84=_0x363497[_0xd3a3('0x26')];var _0x44433a=_0x562264?0x0:_0x49dda6[_0xd3a3('0x23')];var _0x4682d4=_0x562264?_0x363497[_0xd3a3('0x26')]:_0x49dda6['offset']+_0x49dda6[_0xd3a3('0x25')];var _0x311b75;if(_0x4682d4>=_0x378b84){_0x4682d4=_0x378b84;_0x311b75=0xc8;}else{_0x311b75=0xce;}_0x52a66c[_0xd3a3('0x21')](_0x311b75);return _0x52a66c[_0xd3a3('0x27')]('Content-Range',_0x44433a+'-'+_0x4682d4+'/'+_0x378b84)[_0xd3a3('0x22')](_0x363497);}return null;};}function patchUpdates(_0x37e2cb){return function(_0x5c7edc){try{jsonpatch[_0xd3a3('0x28')](_0x5c7edc,_0x37e2cb,!![]);}catch(_0x45b12f){return BPromise[_0xd3a3('0x29')](_0x45b12f);}return _0x5c7edc['save']();};}function saveUpdates(_0x3ddfa2,_0x3b7ab0){return function(_0x4aa4b5){if(_0x4aa4b5){return _0x4aa4b5[_0xd3a3('0x2a')](_0x3ddfa2)[_0xd3a3('0x2b')](function(_0x2ef687){return _0x2ef687;});}return null;};}function removeEntity(_0x272732,_0x3b417d){return function(_0x2aff2e){if(_0x2aff2e){return _0x2aff2e['destroy']()['then'](function(){var _0x134257=_0x2aff2e[_0xd3a3('0x2c')]({'plain':!![]});var _0x425136=_0xd3a3('0x2d');return db[_0xd3a3('0x2e')][_0xd3a3('0x2f')]({'where':{'type':_0x425136,'resourceId':_0x134257['id']}})['then'](function(){return _0x2aff2e;});})[_0xd3a3('0x2b')](function(){_0x272732[_0xd3a3('0x21')](0xcc)[_0xd3a3('0x20')]();});}};}function handleEntityNotFound(_0x5a5c14,_0x2add6b){return function(_0xf0bd82){if(!_0xf0bd82){_0x5a5c14[_0xd3a3('0x30')](0x194);}return _0xf0bd82;};}function handleError(_0x103f96,_0x1c49e9){_0x1c49e9=_0x1c49e9||0x1f4;return function(_0x1394ae){logger[_0xd3a3('0x31')](_0x1394ae['stack']);if(_0x1394ae[_0xd3a3('0x32')]){delete _0x1394ae['name'];}_0x103f96[_0xd3a3('0x21')](_0x1c49e9)[_0xd3a3('0x33')](_0x1394ae);};}exports['index']=function(_0x4dd2da,_0x9aec59){var _0x2c702a={},_0xa5c66e={},_0x590cfa={'count':0x0,'rows':[]};var _0x578d36=_[_0xd3a3('0x34')](db[_0xd3a3('0x35')]['rawAttributes'],function(_0x4ea98a){return{'name':_0x4ea98a[_0xd3a3('0x36')],'type':_0x4ea98a[_0xd3a3('0x37')][_0xd3a3('0x38')]};});_0xa5c66e[_0xd3a3('0x39')]=_['map'](_0x578d36,_0xd3a3('0x32'));_0xa5c66e[_0xd3a3('0x3a')]=_[_0xd3a3('0x3b')](_0x4dd2da['query']);_0xa5c66e[_0xd3a3('0x3c')]=_[_0xd3a3('0x3d')](_0xa5c66e['model'],_0xa5c66e['query']);_0x2c702a[_0xd3a3('0x3e')]=_['intersection'](_0xa5c66e[_0xd3a3('0x39')],qs[_0xd3a3('0x3f')](_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x3f')]));_0x2c702a[_0xd3a3('0x3e')]=_0x2c702a[_0xd3a3('0x3e')][_0xd3a3('0x40')]?_0x2c702a[_0xd3a3('0x3e')]:_0xa5c66e[_0xd3a3('0x39')];if(!_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x41')](_0xd3a3('0x42'))){_0x2c702a[_0xd3a3('0x25')]=qs[_0xd3a3('0x25')](_0x4dd2da['query'][_0xd3a3('0x25')]);_0x2c702a[_0xd3a3('0x23')]=qs[_0xd3a3('0x23')](_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x23')]);}_0x2c702a[_0xd3a3('0x43')]=qs[_0xd3a3('0x44')](_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x44')]);_0x2c702a[_0xd3a3('0x45')]=qs[_0xd3a3('0x3c')](_[_0xd3a3('0x46')](_0x4dd2da[_0xd3a3('0x3a')],_0xa5c66e[_0xd3a3('0x3c')]),_0x578d36);if(_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x47')]){_0x2c702a[_0xd3a3('0x45')]=_['merge'](_0x2c702a[_0xd3a3('0x45')],{'$or':_[_0xd3a3('0x34')](_0x578d36,function(_0x6c7ce9){if(_0x6c7ce9['type']!==_0xd3a3('0x48')){var _0xbf8eac={};_0xbf8eac[_0x6c7ce9[_0xd3a3('0x32')]]={'$like':'%'+_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x47')]+'%'};return _0xbf8eac;}})});}_0x2c702a=_[_0xd3a3('0x49')]({},_0x2c702a,_0x4dd2da[_0xd3a3('0x4a')]);var _0x36bde8={'where':_0x2c702a[_0xd3a3('0x45')]};return db['Dashboard'][_0xd3a3('0x26')](_0x36bde8)[_0xd3a3('0x2b')](function(_0x379158){_0x590cfa['count']=_0x379158;if(_0x4dd2da[_0xd3a3('0x3a')][_0xd3a3('0x4b')]){_0x2c702a[_0xd3a3('0x4c')]=[{'all':!![]}];}return db[_0xd3a3('0x35')][_0xd3a3('0x4d')](_0x2c702a);})['then'](function(_0x193620){_0x590cfa[_0xd3a3('0x4e')]=_0x193620;return _0x590cfa;})[_0xd3a3('0x2b')](respondWithFilteredResult(_0x9aec59,_0x2c702a))[_0xd3a3('0x4f')](handleError(_0x9aec59,null));};exports[_0xd3a3('0x50')]=function(_0x2eca65,_0x4a4921){var _0x3412da={'raw':![],'where':{'id':_0x2eca65[_0xd3a3('0x51')]['id']}},_0x2a47b7={};_0x2a47b7[_0xd3a3('0x39')]=_[_0xd3a3('0x3b')](db[_0xd3a3('0x35')][_0xd3a3('0x52')]);_0x2a47b7[_0xd3a3('0x3a')]=_[_0xd3a3('0x3b')](_0x2eca65[_0xd3a3('0x3a')]);_0x2a47b7[_0xd3a3('0x3c')]=_[_0xd3a3('0x3d')](_0x2a47b7['model'],_0x2a47b7[_0xd3a3('0x3a')]);_0x3412da[_0xd3a3('0x3e')]=_[_0xd3a3('0x3d')](_0x2a47b7[_0xd3a3('0x39')],qs['fields'](_0x2eca65['query'][_0xd3a3('0x3f')]));_0x3412da[_0xd3a3('0x3e')]=_0x3412da['attributes'][_0xd3a3('0x40')]?_0x3412da[_0xd3a3('0x3e')]:_0x2a47b7['model'];if(_0x2eca65[_0xd3a3('0x3a')][_0xd3a3('0x4b')]){_0x3412da[_0xd3a3('0x4c')]=[{'all':!![]}];}_0x3412da=_[_0xd3a3('0x49')]({},_0x3412da,_0x2eca65[_0xd3a3('0x4a')]);return db[_0xd3a3('0x35')][_0xd3a3('0x53')](_0x3412da)[_0xd3a3('0x2b')](handleEntityNotFound(_0x4a4921,null))[_0xd3a3('0x2b')](respondWithResult(_0x4a4921,null))[_0xd3a3('0x4f')](handleError(_0x4a4921,null));};exports[_0xd3a3('0x54')]=function(_0x5d0d89,_0x4a6310){return db[_0xd3a3('0x35')]['create'](_0x5d0d89[_0xd3a3('0x55')],{})[_0xd3a3('0x2b')](function(_0xe20b79){var _0x258324=_0x5d0d89[_0xd3a3('0x56')][_0xd3a3('0x2c')]({'plain':!![]});if(!_0x258324)throw new Error(_0xd3a3('0x57'));if(_0x258324[_0xd3a3('0x58')]===_0xd3a3('0x56')){var _0x1416a8=_0xe20b79['get']({'plain':!![]});var _0x26dd24=_0xd3a3('0x2d');return db[_0xd3a3('0x59')][_0xd3a3('0x53')]({'where':{'name':_0x26dd24,'userProfileId':_0x258324[_0xd3a3('0x5a')]},'raw':!![]})['then'](function(_0x490d59){if(_0x490d59&&_0x490d59[_0xd3a3('0x5b')]===0x0){return db[_0xd3a3('0x2e')][_0xd3a3('0x54')]({'name':_0x1416a8[_0xd3a3('0x32')],'resourceId':_0x1416a8['id'],'type':_0x490d59[_0xd3a3('0x32')],'sectionId':_0x490d59['id']},{})[_0xd3a3('0x2b')](function(){return _0xe20b79;});}else{return _0xe20b79;}})[_0xd3a3('0x4f')](function(_0x419116){logger[_0xd3a3('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x419116);throw _0x419116;});}return _0xe20b79;})['then'](respondWithResult(_0x4a6310,0xc9))[_0xd3a3('0x4f')](handleError(_0x4a6310,null));};exports[_0xd3a3('0x5c')]=function(_0x217bbf,_0x45ef03){var _0x3ee752={'where':{'id':_0x217bbf[_0xd3a3('0x51')]['id']}},_0x11d898={};_0x11d898[_0xd3a3('0x39')]=_[_0xd3a3('0x3b')](db[_0xd3a3('0x35')][_0xd3a3('0x52')]);_0x3ee752[_0xd3a3('0x3e')]=_[_0xd3a3('0x3d')](_0x11d898['model'],qs['fields'](_0x217bbf['query'][_0xd3a3('0x3f')]));_0x3ee752[_0xd3a3('0x3e')]=_0x3ee752[_0xd3a3('0x3e')][_0xd3a3('0x40')]?_0x3ee752[_0xd3a3('0x3e')]:_0x11d898[_0xd3a3('0x39')];if(_0x217bbf['query'][_0xd3a3('0x4b')]){_0x3ee752[_0xd3a3('0x4c')]=[{'all':!![]}];}_0x3ee752=_[_0xd3a3('0x49')]({},_0x3ee752,_0x217bbf[_0xd3a3('0x4a')]);return db[_0xd3a3('0x35')]['find'](_0x3ee752)[_0xd3a3('0x2b')](handleEntityNotFound(_0x45ef03,null))[_0xd3a3('0x2b')](function(_0x5ce7c9){if(_0x5ce7c9){var _0x3a1a60=_0x5ce7c9[_0xd3a3('0x2c')]({'plain':!![]});_0x3a1a60=qs[_0xd3a3('0x5d')](_0x3a1a60,['id',_0xd3a3('0x5e'),_0xd3a3('0x5f')]);_0x217bbf[_0xd3a3('0x55')]=_[_0xd3a3('0x5d')](_0x217bbf[_0xd3a3('0x55')],['id','createdAt',_0xd3a3('0x5f')]);return db['Dashboard'][_0xd3a3('0x54')](_['merge'](_0x3a1a60,_0x217bbf[_0xd3a3('0x55')]),{'include':_0x217bbf[_0xd3a3('0x3a')][_0xd3a3('0x4b')]?[{'all':!![]}]:undefined})[_0xd3a3('0x2b')](function(_0x54de29){var _0x563933=_0x217bbf['user'][_0xd3a3('0x2c')]({'plain':!![]});if(!_0x563933)throw new Error(_0xd3a3('0x57'));if(_0x563933[_0xd3a3('0x58')]===_0xd3a3('0x56')){var _0x136943=_0x54de29['get']({'plain':!![]});var _0x10b5a3='CustomDashboards';return db['UserProfileSection'][_0xd3a3('0x53')]({'where':{'name':_0x10b5a3,'userProfileId':_0x563933[_0xd3a3('0x5a')]},'raw':!![]})['then'](function(_0x2aeca1){if(_0x2aeca1&&_0x2aeca1[_0xd3a3('0x5b')]===0x0){return db[_0xd3a3('0x2e')]['create']({'name':_0x136943[_0xd3a3('0x32')],'resourceId':_0x136943['id'],'type':_0x2aeca1[_0xd3a3('0x32')],'sectionId':_0x2aeca1['id']},{})[_0xd3a3('0x2b')](function(){return _0x54de29;});}else{return _0x54de29;}})[_0xd3a3('0x4f')](function(_0x447bb1){logger[_0xd3a3('0x31')](_0xd3a3('0x60'),_0x447bb1);throw _0x447bb1;});}return _0x54de29;});}})['then'](respondWithResult(_0x45ef03,0xc9))[_0xd3a3('0x4f')](handleError(_0x45ef03,null));};exports[_0xd3a3('0x2a')]=function(_0x591fb7,_0x398215){if(_0x591fb7[_0xd3a3('0x55')]['id']){delete _0x591fb7[_0xd3a3('0x55')]['id'];}return db[_0xd3a3('0x35')][_0xd3a3('0x53')]({'where':{'id':_0x591fb7[_0xd3a3('0x51')]['id']}})[_0xd3a3('0x2b')](handleEntityNotFound(_0x398215,null))[_0xd3a3('0x2b')](saveUpdates(_0x591fb7['body'],null))[_0xd3a3('0x2b')](respondWithResult(_0x398215,null))['catch'](handleError(_0x398215,null));};exports[_0xd3a3('0x2f')]=function(_0xe64a16,_0xcfb796){return db[_0xd3a3('0x35')][_0xd3a3('0x53')]({'where':{'id':_0xe64a16['params']['id']}})[_0xd3a3('0x2b')](handleEntityNotFound(_0xcfb796,null))[_0xd3a3('0x2b')](removeEntity(_0xcfb796,null))['catch'](handleError(_0xcfb796,null));};function widgetAttributes(_0x2c5a13){try{switch(_0x2c5a13['type']){case _0xd3a3('0x61'):return[{'name':_0xd3a3('0x62'),'value':_0x2c5a13[_0xd3a3('0x62')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13[_0xd3a3('0x63')][0x0][_0xd3a3('0x64')]:undefined)||_0xd3a3('0x65')}];case _0xd3a3('0x66'):return[{'name':_0xd3a3('0x67'),'value':_0x2c5a13[_0xd3a3('0x67')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13[_0xd3a3('0x63')][0x0][_0xd3a3('0x64')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2c5a13[_0xd3a3('0x68')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13[_0xd3a3('0x63')][0x0][_0xd3a3('0x64')]:undefined)||_0xd3a3('0x69')},{'name':_0xd3a3('0x6a'),'value':_0x2c5a13[_0xd3a3('0x6a')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x1]?_0x2c5a13['attrs'][0x1][_0xd3a3('0x64')]:undefined)||_0xd3a3('0x6b')},{'name':_0xd3a3('0x6c'),'value':_0x2c5a13[_0xd3a3('0x6c')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x2]?_0x2c5a13[_0xd3a3('0x63')][0x2]['value']:undefined)||0xc}];case _0xd3a3('0x6d'):return[{'name':'attrMetric','value':_0x2c5a13[_0xd3a3('0x6e')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13['attrs'][0x0][_0xd3a3('0x64')]:undefined)||_0xd3a3('0x6f')},{'name':_0xd3a3('0x70'),'value':_0x2c5a13['attrVoiceQueues']||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x1]?_0x2c5a13['attrs'][0x1][_0xd3a3('0x64')]:undefined)||[]},{'name':_0xd3a3('0x6c'),'value':_0x2c5a13[_0xd3a3('0x6c')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x2]?_0x2c5a13[_0xd3a3('0x63')][0x2]['value']:undefined)||0x14},{'name':_0xd3a3('0x71'),'value':_0x2c5a13[_0xd3a3('0x71')]||(_0x2c5a13['attrs']&&_0x2c5a13['attrs'][0x3]?_0x2c5a13['attrs'][0x3][_0xd3a3('0x64')]:undefined)||_0xd3a3('0x72')},{'name':_0xd3a3('0x73'),'value':_0x2c5a13[_0xd3a3('0x73')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x4]?_0x2c5a13[_0xd3a3('0x63')][0x4][_0xd3a3('0x64')]:undefined)||''},{'name':_0xd3a3('0x74'),'value':_0x2c5a13[_0xd3a3('0x74')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13['attrs'][0x5]?_0x2c5a13[_0xd3a3('0x63')][0x5]['value']:undefined)||''},{'name':_0xd3a3('0x75'),'value':_0x2c5a13[_0xd3a3('0x75')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13['attrs'][0x6]?_0x2c5a13[_0xd3a3('0x63')][0x6][_0xd3a3('0x64')]:undefined)||''},{'name':_0xd3a3('0x76'),'value':_0x2c5a13[_0xd3a3('0x76')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x7]?_0x2c5a13['attrs'][0x7]['value']:undefined)||''},{'name':_0xd3a3('0x77'),'value':_0x2c5a13['attrWhatsappAccounts']||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x8]?_0x2c5a13[_0xd3a3('0x63')][0x8][_0xd3a3('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2c5a13[_0xd3a3('0x78')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x9]?_0x2c5a13['attrs'][0x9][_0xd3a3('0x64')]:undefined)||''}];case _0xd3a3('0x79'):case _0xd3a3('0x7a'):return[{'name':_0xd3a3('0x7b'),'value':_0x2c5a13[_0xd3a3('0x7b')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13['attrs'][0x0][_0xd3a3('0x64')]:undefined)||'total'},{'name':_0xd3a3('0x7c'),'value':_0x2c5a13[_0xd3a3('0x7c')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x1]?_0x2c5a13[_0xd3a3('0x63')][0x1]['value']:undefined)||null},{'name':_0xd3a3('0x7d'),'value':_0x2c5a13[_0xd3a3('0x7d')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x2]?_0x2c5a13[_0xd3a3('0x63')][0x2][_0xd3a3('0x64')]:undefined)||null},{'name':_0xd3a3('0x70'),'value':_0x2c5a13[_0xd3a3('0x70')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13['attrs'][0x3]?_0x2c5a13['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x2c5a13[_0xd3a3('0x71')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x4]?_0x2c5a13[_0xd3a3('0x63')][0x4]['value']:undefined)||_0xd3a3('0x72')},{'name':_0xd3a3('0x73'),'value':_0x2c5a13[_0xd3a3('0x73')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x5]?_0x2c5a13[_0xd3a3('0x63')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x2c5a13[_0xd3a3('0x74')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0x6]?_0x2c5a13['attrs'][0x6][_0xd3a3('0x64')]:undefined)||''},{'name':_0xd3a3('0x75'),'value':_0x2c5a13[_0xd3a3('0x75')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x7]?_0x2c5a13[_0xd3a3('0x63')][0x7][_0xd3a3('0x64')]:undefined)||''},{'name':_0xd3a3('0x76'),'value':_0x2c5a13['attrOpenchannelAccounts']||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13['attrs'][0x8]?_0x2c5a13['attrs'][0x8]['value']:undefined)||''},{'name':_0xd3a3('0x77'),'value':_0x2c5a13[_0xd3a3('0x77')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x9]?_0x2c5a13[_0xd3a3('0x63')][0x9][_0xd3a3('0x64')]:undefined)||''},{'name':_0xd3a3('0x78'),'value':_0x2c5a13[_0xd3a3('0x78')]||(_0x2c5a13['attrs']&&_0x2c5a13[_0xd3a3('0x63')][0xa]?_0x2c5a13[_0xd3a3('0x63')][0xa][_0xd3a3('0x64')]:undefined)||''}];case _0xd3a3('0x7e'):return[{'name':_0xd3a3('0x7f'),'type':_0x2c5a13[_0xd3a3('0x80')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13[_0xd3a3('0x63')][0x0][_0xd3a3('0x37')]:undefined)||null,'value':_0x2c5a13[_0xd3a3('0x7f')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x0]?_0x2c5a13['attrs'][0x0]['value']:undefined)||null},{'name':_0xd3a3('0x81'),'value':_0x2c5a13[_0xd3a3('0x81')]||(_0x2c5a13[_0xd3a3('0x63')]&&_0x2c5a13[_0xd3a3('0x63')][0x1]?_0x2c5a13['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x32cd0c){logger[_0xd3a3('0x31')]('widgetAttributes:\x20%s',JSON['stringify'](_0x32cd0c));return[];}}exports[_0xd3a3('0x82')]=function(_0x429dba,_0x5a5c28,_0x21c7d7){if(_0x429dba[_0xd3a3('0x55')]['id']){delete _0x429dba[_0xd3a3('0x55')]['id'];}return db[_0xd3a3('0x35')][_0xd3a3('0x53')]({'where':{'id':_0x429dba['params']['id']}})['then'](handleEntityNotFound(_0x5a5c28,null))[_0xd3a3('0x2b')](function(_0x79f39e){if(_0x79f39e){_0x429dba[_0xd3a3('0x55')]['DashboardId']=_0x79f39e['id'];_0x429dba[_0xd3a3('0x55')][_0xd3a3('0x63')]=widgetAttributes(_0x429dba[_0xd3a3('0x55')]);return db[_0xd3a3('0x83')]['create'](_0x429dba[_0xd3a3('0x55')]);}})[_0xd3a3('0x2b')](respondWithResult(_0x5a5c28,null))[_0xd3a3('0x4f')](handleError(_0x5a5c28,null));};exports['getItems']=function(_0x5ca2c7,_0x24ec42,_0x42e8ff){var _0x4f0da1={};var _0x381733={};var _0x5d4e52;var _0x27353b;return db[_0xd3a3('0x35')][_0xd3a3('0x84')]({'where':{'id':_0x5ca2c7[_0xd3a3('0x51')]['id']}})[_0xd3a3('0x2b')](handleEntityNotFound(_0x24ec42,null))['then'](function(_0x1840e4){if(_0x1840e4){_0x5d4e52=_0x1840e4;_0x381733[_0xd3a3('0x39')]=_[_0xd3a3('0x3b')](db[_0xd3a3('0x83')][_0xd3a3('0x52')]);_0x381733[_0xd3a3('0x3a')]=_[_0xd3a3('0x3b')](_0x5ca2c7['query']);_0x381733[_0xd3a3('0x3c')]=_[_0xd3a3('0x3d')](_0x381733[_0xd3a3('0x39')],_0x381733[_0xd3a3('0x3a')]);_0x4f0da1[_0xd3a3('0x3e')]=_['intersection'](_0x381733[_0xd3a3('0x39')],qs[_0xd3a3('0x3f')](_0x5ca2c7['query']['fields']));_0x4f0da1[_0xd3a3('0x3e')]=_0x4f0da1['attributes'][_0xd3a3('0x40')]?_0x4f0da1['attributes']:_0x381733[_0xd3a3('0x39')];_0x4f0da1[_0xd3a3('0x43')]=qs[_0xd3a3('0x44')](_0x5ca2c7[_0xd3a3('0x3a')][_0xd3a3('0x44')]);_0x4f0da1[_0xd3a3('0x45')]=qs['filters'](_[_0xd3a3('0x46')](_0x5ca2c7[_0xd3a3('0x3a')],_0x381733[_0xd3a3('0x3c')]));if(_0x5ca2c7[_0xd3a3('0x3a')][_0xd3a3('0x47')]){_0x4f0da1[_0xd3a3('0x45')]=_[_0xd3a3('0x49')](_0x4f0da1['where'],{'$or':_[_0xd3a3('0x34')](_0x4f0da1[_0xd3a3('0x3e')],function(_0x4a20a6){var _0x52dcd9={};_0x52dcd9[_0x4a20a6]={'$like':'%'+_0x5ca2c7[_0xd3a3('0x3a')][_0xd3a3('0x47')]+'%'};return _0x52dcd9;})});}_0x4f0da1=_[_0xd3a3('0x49')]({},_0x4f0da1,_0x5ca2c7['options']);return _0x5d4e52[_0xd3a3('0x85')](_0x4f0da1);}})[_0xd3a3('0x2b')](function(_0x11add3){if(_0x11add3){_0x27353b=_0x11add3['length'];if(!_0x5ca2c7['query'][_0xd3a3('0x41')](_0xd3a3('0x42'))){_0x4f0da1['limit']=qs[_0xd3a3('0x25')](_0x5ca2c7['query']['limit']);_0x4f0da1['offset']=qs[_0xd3a3('0x23')](_0x5ca2c7[_0xd3a3('0x3a')][_0xd3a3('0x23')]);}return _0x5d4e52[_0xd3a3('0x85')](_0x4f0da1);}})[_0xd3a3('0x2b')](function(_0x3eb1a5){if(_0x3eb1a5){return _0x3eb1a5?{'count':_0x27353b,'rows':_0x3eb1a5}:null;}})[_0xd3a3('0x2b')](respondWithResult(_0x24ec42,null))[_0xd3a3('0x4f')](handleError(_0x24ec42,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 06a28a6..2f17609 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 _0xc899=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save'];(function(_0x5a125c,_0x155fa2){var _0x4c70af=function(_0x5dccb6){while(--_0x5dccb6){_0x5a125c['push'](_0x5a125c['shift']());}};_0x4c70af(++_0x155fa2);}(_0xc899,0x1f4));var _0x9c89=function(_0x481284,_0x5bc8d3){_0x481284=_0x481284-0x0;var _0x3364cf=_0xc899[_0x481284];return _0x3364cf;};'use strict';var EventEmitter=require(_0x9c89('0x0'));var Dashboard=require(_0x9c89('0x1'))['db'][_0x9c89('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c89('0x3'),'afterUpdate':_0x9c89('0x4'),'afterDestroy':_0x9c89('0x5')};function emitEvent(_0x3fe730){return function(_0x13510c,_0x572059,_0x35b587){DashboardEvents[_0x9c89('0x6')](_0x3fe730+':'+_0x13510c['id'],_0x13510c);DashboardEvents[_0x9c89('0x6')](_0x3fe730,_0x13510c);_0x35b587(null);};}for(var e in events){if(events[_0x9c89('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x9c89('0x8')]=DashboardEvents; \ No newline at end of file +var _0xa817=['hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xa817,0x7b));var _0x7a81=function(_0xb272ca,_0x9f0c1b){_0xb272ca=_0xb272ca-0x0;var _0x5278c3=_0xa817[_0xb272ca];return _0x5278c3;};'use strict';var EventEmitter=require(_0x7a81('0x0'));var Dashboard=require(_0x7a81('0x1'))['db'][_0x7a81('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7a81('0x3')](0x0);var events={'afterCreate':_0x7a81('0x4'),'afterUpdate':_0x7a81('0x5'),'afterDestroy':_0x7a81('0x6')};function emitEvent(_0x91ac8){return function(_0x32f6ff,_0x4b5d54,_0x23551a){DashboardEvents[_0x7a81('0x7')](_0x91ac8+':'+_0x32f6ff['id'],_0x32f6ff);DashboardEvents['emit'](_0x91ac8,_0x32f6ff);_0x23551a(null);};}for(var e in events){if(events[_0x7a81('0x8')](e)){var event=events[e];Dashboard[_0x7a81('0x9')](e,emitEvent(event));}}module[_0x7a81('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 4413fd0..7574b0e 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 _0x1b59=['api','bluebird','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x5d6e1f,_0x29bf65){var _0x562e03=function(_0x55438f){while(--_0x55438f){_0x5d6e1f['push'](_0x5d6e1f['shift']());}};_0x562e03(++_0x29bf65);}(_0x1b59,0x1c5));var _0x91b5=function(_0x272fed,_0x243d67){_0x272fed=_0x272fed-0x0;var _0x2f7ead=_0x1b59[_0x272fed];return _0x2f7ead;};'use strict';var _=require(_0x91b5('0x0'));var util=require(_0x91b5('0x1'));var logger=require(_0x91b5('0x2'))(_0x91b5('0x3'));var moment=require('moment');var BPromise=require(_0x91b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91b5('0x5'));var rimraf=require('rimraf');var config=require(_0x91b5('0x6'));var attributes=require(_0x91b5('0x7'));module[_0x91b5('0x8')]=function(_0x304697,_0x474f9f){return _0x304697[_0x91b5('0x9')](_0x91b5('0xa'),attributes,{'tableName':_0x91b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c83=['define','Dashboard','dashboards','lodash','util','bluebird','request-promise','path','rimraf','./dashboard.attributes'];(function(_0x43e54d,_0x259aeb){var _0x1e8df8=function(_0xb109e8){while(--_0xb109e8){_0x43e54d['push'](_0x43e54d['shift']());}};_0x1e8df8(++_0x259aeb);}(_0x0c83,0xc1));var _0x30c8=function(_0x54e4f7,_0x24a5b5){_0x54e4f7=_0x54e4f7-0x0;var _0xbe4089=_0x0c83[_0x54e4f7];return _0xbe4089;};'use strict';var _=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x30c8('0x2'));var rp=require(_0x30c8('0x3'));var fs=require('fs');var path=require(_0x30c8('0x4'));var rimraf=require(_0x30c8('0x5'));var config=require('../../config/environment');var attributes=require(_0x30c8('0x6'));module['exports']=function(_0x4d3530,_0x590352){return _0x4d3530[_0x30c8('0x7')](_0x30c8('0x8'),attributes,{'tableName':_0x30c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index b5d7f6f..e3e25ad 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 _0xe6ce=['socket.io-emitter','./dashboard.socket','request','then','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','Dashboard,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x4009b8,_0x491866){var _0x1617c3=function(_0x3e640c){while(--_0x3e640c){_0x4009b8['push'](_0x4009b8['shift']());}};_0x1617c3(++_0x491866);}(_0xe6ce,0xe7));var _0xee6c=function(_0x450038,_0x964674){_0x450038=_0x450038-0x0;var _0x46d6c7=_0xe6ce[_0x450038];return _0x46d6c7;};'use strict';var _=require('lodash');var util=require(_0xee6c('0x0'));var moment=require('moment');var BPromise=require(_0xee6c('0x1'));var rs=require(_0xee6c('0x2'));var fs=require('fs');var Redis=require(_0xee6c('0x3'));var db=require(_0xee6c('0x4'))['db'];var utils=require(_0xee6c('0x5'));var logger=require('../../config/logger')(_0xee6c('0x6'));var config=require(_0xee6c('0x7'));var jayson=require(_0xee6c('0x8'));var client=jayson['client'][_0xee6c('0x9')]({'port':0x232a});config[_0xee6c('0xa')]=_[_0xee6c('0xb')](config[_0xee6c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xee6c('0xc'))(new Redis(config[_0xee6c('0xa')]));require(_0xee6c('0xd'))['register'](socket);function respondWithRpcPromise(_0x3cc7d7,_0x43459d,_0x4669d0){return new BPromise(function(_0x32cfbb,_0x17b419){return client[_0xee6c('0xe')](_0x3cc7d7,_0x4669d0)[_0xee6c('0xf')](function(_0x143735){logger['info']('Dashboard,\x20%s,\x20%s',_0x43459d,'request\x20sent');logger[_0xee6c('0x10')](_0xee6c('0x11'),_0x43459d,_0xee6c('0x12'),JSON[_0xee6c('0x13')](_0x143735));if(_0x143735[_0xee6c('0x14')]){if(_0x143735[_0xee6c('0x14')][_0xee6c('0x15')]===0x1f4){logger[_0xee6c('0x14')]('Dashboard,\x20%s,\x20%s',_0x43459d,_0x143735[_0xee6c('0x14')][_0xee6c('0x16')]);return _0x17b419(_0x143735[_0xee6c('0x14')][_0xee6c('0x16')]);}logger[_0xee6c('0x14')]('Dashboard,\x20%s,\x20%s',_0x43459d,_0x143735[_0xee6c('0x14')][_0xee6c('0x16')]);return _0x32cfbb(_0x143735['error'][_0xee6c('0x16')]);}else{logger[_0xee6c('0x17')](_0xee6c('0x18'),_0x43459d,_0xee6c('0x12'));_0x32cfbb(_0x143735[_0xee6c('0x19')][_0xee6c('0x16')]);}})[_0xee6c('0x1a')](function(_0x15e8eb){logger[_0xee6c('0x14')](_0xee6c('0x18'),_0x43459d,_0x15e8eb);_0x17b419(_0x15e8eb);});});} \ No newline at end of file +var _0x62bd=['util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','debug','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0x62bd,0x1a8));var _0xd62b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62bd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd62b('0x0'));var util=require(_0xd62b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd62b('0x2'));var fs=require('fs');var Redis=require(_0xd62b('0x3'));var db=require(_0xd62b('0x4'))['db'];var utils=require(_0xd62b('0x5'));var logger=require('../../config/logger')(_0xd62b('0x6'));var config=require(_0xd62b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd62b('0x8')]({'port':0x232a});config[_0xd62b('0x9')]=_[_0xd62b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd62b('0xb'))(new Redis(config['redis']));require(_0xd62b('0xc'))[_0xd62b('0xd')](socket);function respondWithRpcPromise(_0x5b1fdf,_0x3e401d,_0x47efe0){return new BPromise(function(_0xb3126e,_0x4d65f5){return client[_0xd62b('0xe')](_0x5b1fdf,_0x47efe0)[_0xd62b('0xf')](function(_0x5559a4){logger['info']('Dashboard,\x20%s,\x20%s',_0x3e401d,'request\x20sent');logger[_0xd62b('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3e401d,_0xd62b('0x11'),JSON[_0xd62b('0x12')](_0x5559a4));if(_0x5559a4[_0xd62b('0x13')]){if(_0x5559a4[_0xd62b('0x13')][_0xd62b('0x14')]===0x1f4){logger[_0xd62b('0x13')](_0xd62b('0x15'),_0x3e401d,_0x5559a4[_0xd62b('0x13')][_0xd62b('0x16')]);return _0x4d65f5(_0x5559a4[_0xd62b('0x13')][_0xd62b('0x16')]);}logger['error'](_0xd62b('0x15'),_0x3e401d,_0x5559a4[_0xd62b('0x13')][_0xd62b('0x16')]);return _0xb3126e(_0x5559a4[_0xd62b('0x13')]['message']);}else{logger[_0xd62b('0x17')](_0xd62b('0x15'),_0x3e401d,_0xd62b('0x11'));_0xb3126e(_0x5559a4['result'][_0xd62b('0x16')]);}})[_0xd62b('0x18')](function(_0x4c91f1){logger[_0xd62b('0x13')](_0xd62b('0x15'),_0x3e401d,_0x4c91f1);_0x4d65f5(_0x4c91f1);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2fd8dee..16a52cc 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 _0x5da7=['update','emit','removeListener','length','dashboard:','./dashboard.events','remove'];(function(_0x27a88a,_0x1536c4){var _0xba5c68=function(_0x2321d6){while(--_0x2321d6){_0x27a88a['push'](_0x27a88a['shift']());}};_0xba5c68(++_0x1536c4);}(_0x5da7,0x1be));var _0x75da=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5da7[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x75da('0x0'));var events=['save',_0x75da('0x1'),_0x75da('0x2')];function createListener(_0x2cb962,_0x363080){return function(_0x4505d0){_0x363080[_0x75da('0x3')](_0x2cb962,_0x4505d0);};}function removeListener(_0x49c14e,_0xaa3e87){return function(){DashboardEvents[_0x75da('0x4')](_0x49c14e,_0xaa3e87);};}exports['register']=function(_0x5c54ba){for(var _0x43905f=0x0,_0x2b8d81=events[_0x75da('0x5')];_0x43905f<_0x2b8d81;_0x43905f++){var _0x41d480=events[_0x43905f];var _0x36f1d4=createListener(_0x75da('0x6')+_0x41d480,_0x5c54ba);DashboardEvents['on'](_0x41d480,_0x36f1d4);}}; \ No newline at end of file +var _0xf9e0=['dashboard:','save','remove','update','emit','register','length'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0xf9e0,0xa2));var _0x0f9e=function(_0x3d687c,_0x1904dd){_0x3d687c=_0x3d687c-0x0;var _0x48809c=_0xf9e0[_0x3d687c];return _0x48809c;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x0f9e('0x0'),_0x0f9e('0x1'),_0x0f9e('0x2')];function createListener(_0x1ee89f,_0x5df154){return function(_0xa17027){_0x5df154[_0x0f9e('0x3')](_0x1ee89f,_0xa17027);};}function removeListener(_0x5d5d25,_0xb65e02){return function(){DashboardEvents['removeListener'](_0x5d5d25,_0xb65e02);};}exports[_0x0f9e('0x4')]=function(_0x45567e){for(var _0x570087=0x0,_0x103958=events[_0x0f9e('0x5')];_0x570087<_0x103958;_0x570087++){var _0x103e89=events[_0x570087];var _0x56f6fc=createListener(_0x0f9e('0x6')+_0x103e89,_0x45567e);DashboardEvents['on'](_0x103e89,_0x56f6fc);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 2f0681b..a8543a2 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 _0xeac1=['get','isAuthenticated','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller'];(function(_0x4739ee,_0x2aacfa){var _0x382b2a=function(_0x4f4117){while(--_0x4f4117){_0x4739ee['push'](_0x4739ee['shift']());}};_0x382b2a(++_0x2aacfa);}(_0xeac1,0x143));var _0x1eac=function(_0x973167,_0x2ec13c){_0x973167=_0x973167-0x0;var _0x485c31=_0xeac1[_0x973167];return _0x485c31;};'use strict';var multer=require(_0x1eac('0x0'));var util=require(_0x1eac('0x1'));var path=require('path');var timeout=require(_0x1eac('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1eac('0x3'));var interaction=require(_0x1eac('0x4'));var config=require(_0x1eac('0x5'));var controller=require(_0x1eac('0x6'));router[_0x1eac('0x7')]('/',auth[_0x1eac('0x8')](),controller['index']);router[_0x1eac('0x7')](_0x1eac('0x9'),auth[_0x1eac('0x8')](),controller[_0x1eac('0xa')]);router['get'](_0x1eac('0xb'),auth[_0x1eac('0x8')](),controller[_0x1eac('0xc')]);router[_0x1eac('0xd')]('/',auth['isAuthenticated'](),controller[_0x1eac('0xe')]);router[_0x1eac('0xd')](_0x1eac('0xf'),auth['isAuthenticated'](),controller['clone']);router['post']('/:id/items',auth[_0x1eac('0x8')](),controller[_0x1eac('0x10')]);router[_0x1eac('0x11')](_0x1eac('0x9'),auth[_0x1eac('0x8')](),controller[_0x1eac('0x12')]);router[_0x1eac('0x13')](_0x1eac('0x9'),auth['isAuthenticated'](),controller[_0x1eac('0x14')]);module[_0x1eac('0x15')]=router; \ No newline at end of file +var _0xeb68=['get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','addItem','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xeb68,0x177));var _0x8eb6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xeb68[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x8eb6('0x0'));var util=require('util');var path=require(_0x8eb6('0x1'));var timeout=require(_0x8eb6('0x2'));var express=require(_0x8eb6('0x3'));var router=express[_0x8eb6('0x4')]();var fs_extra=require(_0x8eb6('0x5'));var auth=require(_0x8eb6('0x6'));var interaction=require(_0x8eb6('0x7'));var config=require(_0x8eb6('0x8'));var controller=require('./dashboard.controller');router[_0x8eb6('0x9')]('/',auth[_0x8eb6('0xa')](),controller[_0x8eb6('0xb')]);router[_0x8eb6('0x9')](_0x8eb6('0xc'),auth[_0x8eb6('0xa')](),controller[_0x8eb6('0xd')]);router[_0x8eb6('0x9')](_0x8eb6('0xe'),auth[_0x8eb6('0xa')](),controller[_0x8eb6('0xf')]);router[_0x8eb6('0x10')]('/',auth['isAuthenticated'](),controller[_0x8eb6('0x11')]);router[_0x8eb6('0x10')]('/:id/clone',auth[_0x8eb6('0xa')](),controller['clone']);router[_0x8eb6('0x10')](_0x8eb6('0xe'),auth[_0x8eb6('0xa')](),controller[_0x8eb6('0x12')]);router[_0x8eb6('0x13')](_0x8eb6('0xc'),auth['isAuthenticated'](),controller[_0x8eb6('0x14')]);router[_0x8eb6('0x15')](_0x8eb6('0xc'),auth[_0x8eb6('0xa')](),controller[_0x8eb6('0x16')]);module[_0x8eb6('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 298231d..ec3bf30 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 _0x6f47=['#ffffff','squel','lodash','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x3374b0,_0x3cc015){var _0x11fac4=function(_0x2c05ca){while(--_0x2c05ca){_0x3374b0['push'](_0x3374b0['shift']());}};_0x11fac4(++_0x3cc015);}(_0x6f47,0xc7));var _0x76f4=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6f47[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x76f4('0x0'));var _=require(_0x76f4('0x1'));module['exports']={'title':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x76f4('0x3')]('long'),'get':function(){try{return JSON[_0x76f4('0x4')](this[_0x76f4('0x5')](_0x76f4('0x6')));}catch(_0x2523ba){return[];}},'set':function(_0x5754ca){try{this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')](_0x5754ca));}catch(_0x497f99){this[_0x76f4('0x7')](_0x76f4('0x6'),JSON[_0x76f4('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x76f4('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x76f4('0x2')],'allowNull':![],'defaultValue':_0x76f4('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x76f4('0x2')]},'titleFontSize':{'type':Sequelize[_0x76f4('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xda19,0xd5));var _0x9da1=function(_0x580c95,_0x537617){_0x580c95=_0x580c95-0x0;var _0x1b56e4=_0xda19[_0x580c95];return _0x1b56e4;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'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 536af7d..045c142 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 _0x2b29=['count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','params','model','rawAttributes','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','DashboardItem','catch','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4fb5cd,_0x47f894){var _0x4cfed9=function(_0x3cdea5){while(--_0x3cdea5){_0x4fb5cd['push'](_0x4fb5cd['shift']());}};_0x4cfed9(++_0x47f894);}(_0x2b29,0x163));var _0x92b2=function(_0x5a6b0f,_0x20327c){_0x5a6b0f=_0x5a6b0f-0x0;var _0x5e1f77=_0x2b29[_0x5a6b0f];return _0x5e1f77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92b2('0x0'));var zipdir=require(_0x92b2('0x1'));var jsonpatch=require(_0x92b2('0x2'));var rp=require(_0x92b2('0x3'));var moment=require('moment');var BPromise=require(_0x92b2('0x4'));var Mustache=require(_0x92b2('0x5'));var util=require(_0x92b2('0x6'));var path=require(_0x92b2('0x7'));var sox=require(_0x92b2('0x8'));var csv=require(_0x92b2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92b2('0xa'));var _=require('lodash');var squel=require(_0x92b2('0xb'));var crypto=require(_0x92b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x92b2('0xd'));var toCsv=require(_0x92b2('0x9'));var querystring=require(_0x92b2('0xe'));var Papa=require(_0x92b2('0xf'));var Redis=require('ioredis');var authService=require(_0x92b2('0x10'));var qs=require(_0x92b2('0x11'));var as=require(_0x92b2('0x12'));var hardwareService=require(_0x92b2('0x13'));var logger=require(_0x92b2('0x14'))(_0x92b2('0x15'));var utils=require(_0x92b2('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x92b2('0x17'));var db=require(_0x92b2('0x18'))['db'];config[_0x92b2('0x19')]=_['defaults'](config[_0x92b2('0x19')],{'host':_0x92b2('0x1a'),'port':0x18eb});var socket=require(_0x92b2('0x1b'))(new Redis(config[_0x92b2('0x19')]));require(_0x92b2('0x1c'))[_0x92b2('0x1d')](socket);function respondWithStatusCode(_0x52ef07,_0x11e175){_0x11e175=_0x11e175||0xcc;return function(_0x5c42b5){if(_0x5c42b5){return _0x52ef07[_0x92b2('0x1e')](_0x11e175);}return _0x52ef07[_0x92b2('0x1f')](_0x11e175)[_0x92b2('0x20')]();};}function respondWithResult(_0x4899fa,_0x5cbb30){_0x5cbb30=_0x5cbb30||0xc8;return function(_0xbb9cef){if(_0xbb9cef){return _0x4899fa['status'](_0x5cbb30)[_0x92b2('0x21')](_0xbb9cef);}};}function respondWithFilteredResult(_0x4d51db,_0x42872b){return function(_0x1a7866){if(_0x1a7866){var _0x39d811=typeof _0x42872b[_0x92b2('0x22')]===_0x92b2('0x23')&&typeof _0x42872b[_0x92b2('0x24')]===_0x92b2('0x23');var _0x692704=_0x1a7866[_0x92b2('0x25')];var _0xa08831=_0x39d811?0x0:_0x42872b[_0x92b2('0x22')];var _0x3bdda8=_0x39d811?_0x1a7866[_0x92b2('0x25')]:_0x42872b[_0x92b2('0x22')]+_0x42872b[_0x92b2('0x24')];var _0x4d2850;if(_0x3bdda8>=_0x692704){_0x3bdda8=_0x692704;_0x4d2850=0xc8;}else{_0x4d2850=0xce;}_0x4d51db[_0x92b2('0x1f')](_0x4d2850);return _0x4d51db['set'](_0x92b2('0x26'),_0xa08831+'-'+_0x3bdda8+'/'+_0x692704)[_0x92b2('0x21')](_0x1a7866);}return null;};}function patchUpdates(_0x2b372c){return function(_0x1e09b6){try{jsonpatch[_0x92b2('0x27')](_0x1e09b6,_0x2b372c,!![]);}catch(_0x574c3e){return BPromise['reject'](_0x574c3e);}return _0x1e09b6[_0x92b2('0x28')]();};}function saveUpdates(_0x31567c,_0x8ed58d){return function(_0x386a80){if(_0x386a80){return _0x386a80[_0x92b2('0x29')](_0x31567c)[_0x92b2('0x2a')](function(_0x15faf5){return _0x15faf5;});}return null;};}function removeEntity(_0x49b81e,_0xbbbfa7){return function(_0x573df3){if(_0x573df3){return _0x573df3[_0x92b2('0x2b')]()['then'](function(){_0x49b81e[_0x92b2('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9688,_0x105270){return function(_0x2d707f){if(!_0x2d707f){_0x5e9688[_0x92b2('0x1e')](0x194);}return _0x2d707f;};}function handleError(_0x5a874e,_0x9314e3){_0x9314e3=_0x9314e3||0x1f4;return function(_0x482706){logger[_0x92b2('0x2c')](_0x482706[_0x92b2('0x2d')]);if(_0x482706[_0x92b2('0x2e')]){delete _0x482706[_0x92b2('0x2e')];}_0x5a874e[_0x92b2('0x1f')](_0x9314e3)[_0x92b2('0x2f')](_0x482706);};}exports[_0x92b2('0x30')]=function(_0x515a62,_0x4dda21){var _0x5efa2b={'raw':![],'where':{'id':_0x515a62[_0x92b2('0x31')]['id']}},_0xd240ec={};_0xd240ec[_0x92b2('0x32')]=_['keys'](db['DashboardItem'][_0x92b2('0x33')]);_0xd240ec[_0x92b2('0x34')]=_[_0x92b2('0x35')](_0x515a62[_0x92b2('0x34')]);_0xd240ec[_0x92b2('0x36')]=_['intersection'](_0xd240ec['model'],_0xd240ec['query']);_0x5efa2b[_0x92b2('0x37')]=_[_0x92b2('0x38')](_0xd240ec['model'],qs[_0x92b2('0x39')](_0x515a62[_0x92b2('0x34')][_0x92b2('0x39')]));_0x5efa2b[_0x92b2('0x37')]=_0x5efa2b[_0x92b2('0x37')][_0x92b2('0x3a')]?_0x5efa2b[_0x92b2('0x37')]:_0xd240ec[_0x92b2('0x32')];if(_0x515a62['query'][_0x92b2('0x3b')]){_0x5efa2b[_0x92b2('0x3c')]=[{'all':!![]}];}_0x5efa2b=_[_0x92b2('0x3d')]({},_0x5efa2b,_0x515a62['options']);return db[_0x92b2('0x3e')]['find'](_0x5efa2b)[_0x92b2('0x2a')](handleEntityNotFound(_0x4dda21,null))[_0x92b2('0x2a')](respondWithResult(_0x4dda21,null))['catch'](handleError(_0x4dda21,null));};exports['destroy']=function(_0x119d4c,_0xc6730b){return db['DashboardItem']['find']({'where':{'id':_0x119d4c[_0x92b2('0x31')]['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0xc6730b,null))['then'](removeEntity(_0xc6730b,null))[_0x92b2('0x3f')](handleError(_0xc6730b,null));};function widgetAttributes(_0x111eca){try{switch(_0x111eca[_0x92b2('0x40')]){case'iframe':return[{'name':_0x92b2('0x41'),'value':_0x111eca['attrUrl']||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x0]?_0x111eca[_0x92b2('0x42')][0x0][_0x92b2('0x43')]:undefined)||_0x92b2('0x44')}];case _0x92b2('0x45'):return[{'name':'attrPath','value':_0x111eca[_0x92b2('0x46')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca['attrs'][0x0]?_0x111eca[_0x92b2('0x42')][0x0][_0x92b2('0x43')]:undefined)||''}];case _0x92b2('0x47'):return[{'name':_0x92b2('0x48'),'value':_0x111eca[_0x92b2('0x48')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x0]?_0x111eca['attrs'][0x0][_0x92b2('0x43')]:undefined)||'HH:mm:ss'},{'name':_0x92b2('0x49'),'value':_0x111eca['attrTimezone']||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x1]?_0x111eca[_0x92b2('0x42')][0x1]['value']:undefined)||_0x92b2('0x4a')},{'name':_0x92b2('0x4b'),'value':_0x111eca[_0x92b2('0x4b')]||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x2]?_0x111eca[_0x92b2('0x42')][0x2][_0x92b2('0x43')]:undefined)||0xc}];case _0x92b2('0x4c'):return[{'name':'attrMetric','value':_0x111eca['attrMetric']||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x0]?_0x111eca[_0x92b2('0x42')][0x0][_0x92b2('0x43')]:undefined)||'total'},{'name':_0x92b2('0x4d'),'value':_0x111eca['attrVoiceQueues']||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x1]?_0x111eca[_0x92b2('0x42')][0x1][_0x92b2('0x43')]:undefined)||[]},{'name':_0x92b2('0x4b'),'value':_0x111eca[_0x92b2('0x4b')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x2]?_0x111eca[_0x92b2('0x42')][0x2][_0x92b2('0x43')]:undefined)||0x14},{'name':_0x92b2('0x4e'),'value':_0x111eca[_0x92b2('0x4e')]||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x3]?_0x111eca['attrs'][0x3][_0x92b2('0x43')]:undefined)||'voice'},{'name':_0x92b2('0x4f'),'value':_0x111eca[_0x92b2('0x4f')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca['attrs'][0x4]?_0x111eca[_0x92b2('0x42')][0x4]['value']:undefined)||''},{'name':_0x92b2('0x50'),'value':_0x111eca[_0x92b2('0x50')]||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x5]?_0x111eca[_0x92b2('0x42')][0x5][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x51'),'value':_0x111eca[_0x92b2('0x51')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x6]?_0x111eca[_0x92b2('0x42')][0x6][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x52'),'value':_0x111eca[_0x92b2('0x52')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x7]?_0x111eca[_0x92b2('0x42')][0x7]['value']:undefined)||''},{'name':_0x92b2('0x53'),'value':_0x111eca[_0x92b2('0x53')]||(_0x111eca['attrs']&&_0x111eca['attrs'][0x8]?_0x111eca['attrs'][0x8][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x54'),'value':_0x111eca['attrChatWebsites']||(_0x111eca['attrs']&&_0x111eca['attrs'][0x9]?_0x111eca[_0x92b2('0x42')][0x9][_0x92b2('0x43')]:undefined)||''}];case _0x92b2('0x55'):case _0x92b2('0x56'):return[{'name':_0x92b2('0x57'),'value':_0x111eca[_0x92b2('0x57')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x0]?_0x111eca['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x92b2('0x58'),'value':_0x111eca['attrSerie2']||(_0x111eca[_0x92b2('0x42')]&&_0x111eca['attrs'][0x1]?_0x111eca[_0x92b2('0x42')][0x1][_0x92b2('0x43')]:undefined)||null},{'name':_0x92b2('0x59'),'value':_0x111eca[_0x92b2('0x59')]||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x2]?_0x111eca[_0x92b2('0x42')][0x2][_0x92b2('0x43')]:undefined)||null},{'name':_0x92b2('0x4d'),'value':_0x111eca[_0x92b2('0x4d')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x3]?_0x111eca[_0x92b2('0x42')][0x3][_0x92b2('0x43')]:undefined)||[]},{'name':_0x92b2('0x4e'),'value':_0x111eca[_0x92b2('0x4e')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x4]?_0x111eca[_0x92b2('0x42')][0x4][_0x92b2('0x43')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x111eca[_0x92b2('0x4f')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x5]?_0x111eca['attrs'][0x5][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x50'),'value':_0x111eca[_0x92b2('0x50')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x6]?_0x111eca[_0x92b2('0x42')][0x6][_0x92b2('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x111eca[_0x92b2('0x51')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x7]?_0x111eca['attrs'][0x7][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x52'),'value':_0x111eca['attrOpenchannelAccounts']||(_0x111eca['attrs']&&_0x111eca[_0x92b2('0x42')][0x8]?_0x111eca[_0x92b2('0x42')][0x8]['value']:undefined)||''},{'name':_0x92b2('0x53'),'value':_0x111eca[_0x92b2('0x53')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x9]?_0x111eca[_0x92b2('0x42')][0x9][_0x92b2('0x43')]:undefined)||''},{'name':_0x92b2('0x54'),'value':_0x111eca[_0x92b2('0x54')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0xa]?_0x111eca['attrs'][0xa][_0x92b2('0x43')]:undefined)||''}];case _0x92b2('0x5a'):return[{'name':_0x92b2('0x5b'),'type':_0x111eca[_0x92b2('0x5c')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca['attrs'][0x0]?_0x111eca['attrs'][0x0][_0x92b2('0x40')]:undefined)||null,'value':_0x111eca[_0x92b2('0x5b')]||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x0]?_0x111eca[_0x92b2('0x42')][0x0][_0x92b2('0x43')]:undefined)||null},{'name':_0x92b2('0x5d'),'value':_0x111eca['attrRefresh']||(_0x111eca[_0x92b2('0x42')]&&_0x111eca[_0x92b2('0x42')][0x1]?_0x111eca['attrs'][0x1][_0x92b2('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x545872){logger[_0x92b2('0x2c')](_0x92b2('0x5e'),JSON[_0x92b2('0x5f')](_0x545872));return[];}}exports['create']=function(_0x4b2036,_0x1fa5cb){if(_0x4b2036['body']){_0x4b2036['body'][_0x92b2('0x42')]=widgetAttributes(_0x4b2036[_0x92b2('0x60')]);}return db[_0x92b2('0x3e')][_0x92b2('0x61')](_0x4b2036[_0x92b2('0x60')],{})[_0x92b2('0x2a')](respondWithResult(_0x1fa5cb,0xc9))[_0x92b2('0x3f')](handleError(_0x1fa5cb,null));};exports['update']=function(_0x3ba3ca,_0x407b80){if(_0x3ba3ca['body']['id']){delete _0x3ba3ca[_0x92b2('0x60')]['id'];}_0x3ba3ca[_0x92b2('0x60')][_0x92b2('0x42')]=widgetAttributes(_0x3ba3ca[_0x92b2('0x60')]);return db[_0x92b2('0x3e')]['find']({'where':{'id':_0x3ba3ca[_0x92b2('0x31')]['id']}})[_0x92b2('0x2a')](handleEntityNotFound(_0x407b80,null))['then'](saveUpdates(_0x3ba3ca[_0x92b2('0x60')],null))[_0x92b2('0x2a')](respondWithResult(_0x407b80,null))[_0x92b2('0x3f')](handleError(_0x407b80,null));}; \ No newline at end of file +var _0x2e88=['attributes','intersection','fields','include','options','find','catch','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters'];(function(_0x5e17e1,_0x32be51){var _0x343ef6=function(_0x1ef39b){while(--_0x1ef39b){_0x5e17e1['push'](_0x5e17e1['shift']());}};_0x343ef6(++_0x32be51);}(_0x2e88,0x95));var _0x82e8=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x2e88[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require(_0x82e8('0x0'));var rimraf=require(_0x82e8('0x1'));var zipdir=require(_0x82e8('0x2'));var jsonpatch=require(_0x82e8('0x3'));var rp=require(_0x82e8('0x4'));var moment=require(_0x82e8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82e8('0x6'));var util=require(_0x82e8('0x7'));var path=require('path');var sox=require(_0x82e8('0x8'));var csv=require(_0x82e8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82e8('0xa'));var _=require(_0x82e8('0xb'));var squel=require(_0x82e8('0xc'));var crypto=require(_0x82e8('0xd'));var jsforce=require(_0x82e8('0xe'));var deskjs=require(_0x82e8('0xf'));var toCsv=require(_0x82e8('0x9'));var querystring=require(_0x82e8('0x10'));var Papa=require(_0x82e8('0x11'));var Redis=require(_0x82e8('0x12'));var authService=require(_0x82e8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x82e8('0x14'));var hardwareService=require(_0x82e8('0x15'));var logger=require(_0x82e8('0x16'))(_0x82e8('0x17'));var utils=require(_0x82e8('0x18'));var config=require(_0x82e8('0x19'));var licenseUtil=require(_0x82e8('0x1a'));var db=require('../../mysqldb')['db'];config[_0x82e8('0x1b')]=_[_0x82e8('0x1c')](config[_0x82e8('0x1b')],{'host':_0x82e8('0x1d'),'port':0x18eb});var socket=require(_0x82e8('0x1e'))(new Redis(config['redis']));require(_0x82e8('0x1f'))[_0x82e8('0x20')](socket);function respondWithStatusCode(_0xad6055,_0x46e01e){_0x46e01e=_0x46e01e||0xcc;return function(_0x539d82){if(_0x539d82){return _0xad6055[_0x82e8('0x21')](_0x46e01e);}return _0xad6055[_0x82e8('0x22')](_0x46e01e)[_0x82e8('0x23')]();};}function respondWithResult(_0xf53214,_0x17a2e2){_0x17a2e2=_0x17a2e2||0xc8;return function(_0x541c58){if(_0x541c58){return _0xf53214[_0x82e8('0x22')](_0x17a2e2)[_0x82e8('0x24')](_0x541c58);}};}function respondWithFilteredResult(_0x574ba2,_0x1a776d){return function(_0xf287da){if(_0xf287da){var _0x16cb41=typeof _0x1a776d[_0x82e8('0x25')]===_0x82e8('0x26')&&typeof _0x1a776d[_0x82e8('0x27')]===_0x82e8('0x26');var _0x5d7986=_0xf287da[_0x82e8('0x28')];var _0x3c2582=_0x16cb41?0x0:_0x1a776d[_0x82e8('0x25')];var _0x25d153=_0x16cb41?_0xf287da[_0x82e8('0x28')]:_0x1a776d['offset']+_0x1a776d[_0x82e8('0x27')];var _0x497c48;if(_0x25d153>=_0x5d7986){_0x25d153=_0x5d7986;_0x497c48=0xc8;}else{_0x497c48=0xce;}_0x574ba2[_0x82e8('0x22')](_0x497c48);return _0x574ba2[_0x82e8('0x29')](_0x82e8('0x2a'),_0x3c2582+'-'+_0x25d153+'/'+_0x5d7986)[_0x82e8('0x24')](_0xf287da);}return null;};}function patchUpdates(_0x198c3d){return function(_0x1be7f4){try{jsonpatch[_0x82e8('0x2b')](_0x1be7f4,_0x198c3d,!![]);}catch(_0x591583){return BPromise[_0x82e8('0x2c')](_0x591583);}return _0x1be7f4['save']();};}function saveUpdates(_0x4de0d2,_0x47df25){return function(_0x47389b){if(_0x47389b){return _0x47389b['update'](_0x4de0d2)[_0x82e8('0x2d')](function(_0x305710){return _0x305710;});}return null;};}function removeEntity(_0xeff996,_0x488b06){return function(_0x2751e1){if(_0x2751e1){return _0x2751e1[_0x82e8('0x2e')]()[_0x82e8('0x2d')](function(){_0xeff996[_0x82e8('0x22')](0xcc)[_0x82e8('0x23')]();});}};}function handleEntityNotFound(_0x5b2833,_0x55c0d0){return function(_0x220d51){if(!_0x220d51){_0x5b2833[_0x82e8('0x21')](0x194);}return _0x220d51;};}function handleError(_0x3eb8ec,_0x3c050e){_0x3c050e=_0x3c050e||0x1f4;return function(_0x1c2160){logger[_0x82e8('0x2f')](_0x1c2160[_0x82e8('0x30')]);if(_0x1c2160[_0x82e8('0x31')]){delete _0x1c2160[_0x82e8('0x31')];}_0x3eb8ec[_0x82e8('0x22')](_0x3c050e)[_0x82e8('0x32')](_0x1c2160);};}exports[_0x82e8('0x33')]=function(_0x7d089d,_0x4902af){var _0x435b62={'raw':![],'where':{'id':_0x7d089d[_0x82e8('0x34')]['id']}},_0x3ff82d={};_0x3ff82d[_0x82e8('0x35')]=_[_0x82e8('0x36')](db[_0x82e8('0x37')][_0x82e8('0x38')]);_0x3ff82d[_0x82e8('0x39')]=_[_0x82e8('0x36')](_0x7d089d[_0x82e8('0x39')]);_0x3ff82d[_0x82e8('0x3a')]=_['intersection'](_0x3ff82d[_0x82e8('0x35')],_0x3ff82d[_0x82e8('0x39')]);_0x435b62[_0x82e8('0x3b')]=_[_0x82e8('0x3c')](_0x3ff82d[_0x82e8('0x35')],qs[_0x82e8('0x3d')](_0x7d089d[_0x82e8('0x39')][_0x82e8('0x3d')]));_0x435b62['attributes']=_0x435b62[_0x82e8('0x3b')]['length']?_0x435b62[_0x82e8('0x3b')]:_0x3ff82d[_0x82e8('0x35')];if(_0x7d089d['query']['includeAll']){_0x435b62[_0x82e8('0x3e')]=[{'all':!![]}];}_0x435b62=_['merge']({},_0x435b62,_0x7d089d[_0x82e8('0x3f')]);return db[_0x82e8('0x37')][_0x82e8('0x40')](_0x435b62)[_0x82e8('0x2d')](handleEntityNotFound(_0x4902af,null))[_0x82e8('0x2d')](respondWithResult(_0x4902af,null))[_0x82e8('0x41')](handleError(_0x4902af,null));};exports[_0x82e8('0x2e')]=function(_0x125e73,_0x3eead1){return db[_0x82e8('0x37')][_0x82e8('0x40')]({'where':{'id':_0x125e73[_0x82e8('0x34')]['id']}})['then'](handleEntityNotFound(_0x3eead1,null))[_0x82e8('0x2d')](removeEntity(_0x3eead1,null))[_0x82e8('0x41')](handleError(_0x3eead1,null));};function widgetAttributes(_0x7ebf5f){try{switch(_0x7ebf5f['type']){case _0x82e8('0x42'):return[{'name':_0x82e8('0x43'),'value':_0x7ebf5f[_0x82e8('0x43')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||_0x82e8('0x46')}];case _0x82e8('0x47'):return[{'name':_0x82e8('0x48'),'value':_0x7ebf5f[_0x82e8('0x48')]||(_0x7ebf5f['attrs']&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||''}];case _0x82e8('0x49'):return[{'name':_0x82e8('0x4a'),'value':_0x7ebf5f[_0x82e8('0x4a')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||_0x82e8('0x4b')},{'name':_0x82e8('0x4c'),'value':_0x7ebf5f[_0x82e8('0x4c')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x1]?_0x7ebf5f['attrs'][0x1][_0x82e8('0x45')]:undefined)||'0.00'},{'name':_0x82e8('0x4d'),'value':_0x7ebf5f[_0x82e8('0x4d')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x2]?_0x7ebf5f[_0x82e8('0x44')][0x2][_0x82e8('0x45')]:undefined)||0xc}];case'counter':return[{'name':_0x82e8('0x4e'),'value':_0x7ebf5f['attrMetric']||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||_0x82e8('0x4f')},{'name':'attrVoiceQueues','value':_0x7ebf5f['attrVoiceQueues']||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x1]?_0x7ebf5f[_0x82e8('0x44')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x7ebf5f['attrFontSize']||(_0x7ebf5f['attrs']&&_0x7ebf5f[_0x82e8('0x44')][0x2]?_0x7ebf5f[_0x82e8('0x44')][0x2]['value']:undefined)||0x14},{'name':_0x82e8('0x50'),'value':_0x7ebf5f[_0x82e8('0x50')]||(_0x7ebf5f['attrs']&&_0x7ebf5f[_0x82e8('0x44')][0x3]?_0x7ebf5f['attrs'][0x3][_0x82e8('0x45')]:undefined)||_0x82e8('0x51')},{'name':_0x82e8('0x52'),'value':_0x7ebf5f[_0x82e8('0x52')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x4]?_0x7ebf5f['attrs'][0x4][_0x82e8('0x45')]:undefined)||''},{'name':_0x82e8('0x53'),'value':_0x7ebf5f[_0x82e8('0x53')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x5]?_0x7ebf5f[_0x82e8('0x44')][0x5]['value']:undefined)||''},{'name':_0x82e8('0x54'),'value':_0x7ebf5f['attrSmsAccounts']||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x6]?_0x7ebf5f[_0x82e8('0x44')][0x6]['value']:undefined)||''},{'name':_0x82e8('0x55'),'value':_0x7ebf5f['attrOpenchannelAccounts']||(_0x7ebf5f['attrs']&&_0x7ebf5f[_0x82e8('0x44')][0x7]?_0x7ebf5f[_0x82e8('0x44')][0x7][_0x82e8('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x7ebf5f[_0x82e8('0x56')]||(_0x7ebf5f['attrs']&&_0x7ebf5f['attrs'][0x8]?_0x7ebf5f['attrs'][0x8]['value']:undefined)||''},{'name':_0x82e8('0x57'),'value':_0x7ebf5f[_0x82e8('0x57')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x9]?_0x7ebf5f['attrs'][0x9][_0x82e8('0x45')]:undefined)||''}];case _0x82e8('0x58'):case _0x82e8('0x59'):return[{'name':_0x82e8('0x5a'),'value':_0x7ebf5f[_0x82e8('0x5a')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||'total'},{'name':'attrSerie2','value':_0x7ebf5f[_0x82e8('0x5b')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x1]?_0x7ebf5f[_0x82e8('0x44')][0x1][_0x82e8('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x7ebf5f[_0x82e8('0x5c')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x2]?_0x7ebf5f[_0x82e8('0x44')][0x2]['value']:undefined)||null},{'name':_0x82e8('0x5d'),'value':_0x7ebf5f['attrVoiceQueues']||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x3]?_0x7ebf5f['attrs'][0x3][_0x82e8('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x7ebf5f[_0x82e8('0x50')]||(_0x7ebf5f['attrs']&&_0x7ebf5f[_0x82e8('0x44')][0x4]?_0x7ebf5f['attrs'][0x4][_0x82e8('0x45')]:undefined)||_0x82e8('0x51')},{'name':'attrEmailAccounts','value':_0x7ebf5f[_0x82e8('0x52')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f['attrs'][0x5]?_0x7ebf5f['attrs'][0x5][_0x82e8('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x7ebf5f[_0x82e8('0x53')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x6]?_0x7ebf5f[_0x82e8('0x44')][0x6][_0x82e8('0x45')]:undefined)||''},{'name':_0x82e8('0x54'),'value':_0x7ebf5f[_0x82e8('0x54')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x7]?_0x7ebf5f['attrs'][0x7][_0x82e8('0x45')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x7ebf5f['attrOpenchannelAccounts']||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x8]?_0x7ebf5f[_0x82e8('0x44')][0x8][_0x82e8('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x7ebf5f[_0x82e8('0x56')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x9]?_0x7ebf5f[_0x82e8('0x44')][0x9][_0x82e8('0x45')]:undefined)||''},{'name':_0x82e8('0x57'),'value':_0x7ebf5f[_0x82e8('0x57')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0xa]?_0x7ebf5f[_0x82e8('0x44')][0xa][_0x82e8('0x45')]:undefined)||''}];case _0x82e8('0x5e'):return[{'name':_0x82e8('0x5f'),'type':_0x7ebf5f[_0x82e8('0x60')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f['attrs'][0x0][_0x82e8('0x61')]:undefined)||null,'value':_0x7ebf5f[_0x82e8('0x5f')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x0]?_0x7ebf5f[_0x82e8('0x44')][0x0][_0x82e8('0x45')]:undefined)||null},{'name':_0x82e8('0x62'),'value':_0x7ebf5f[_0x82e8('0x62')]||(_0x7ebf5f[_0x82e8('0x44')]&&_0x7ebf5f[_0x82e8('0x44')][0x1]?_0x7ebf5f[_0x82e8('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2320fc){logger[_0x82e8('0x2f')](_0x82e8('0x63'),JSON[_0x82e8('0x64')](_0x2320fc));return[];}}exports[_0x82e8('0x65')]=function(_0x44fff8,_0xbe3429){if(_0x44fff8[_0x82e8('0x66')]){_0x44fff8[_0x82e8('0x66')][_0x82e8('0x44')]=widgetAttributes(_0x44fff8[_0x82e8('0x66')]);}return db[_0x82e8('0x37')][_0x82e8('0x65')](_0x44fff8[_0x82e8('0x66')],{})[_0x82e8('0x2d')](respondWithResult(_0xbe3429,0xc9))[_0x82e8('0x41')](handleError(_0xbe3429,null));};exports[_0x82e8('0x67')]=function(_0x47a631,_0x33dd57){if(_0x47a631[_0x82e8('0x66')]['id']){delete _0x47a631[_0x82e8('0x66')]['id'];}_0x47a631[_0x82e8('0x66')][_0x82e8('0x44')]=widgetAttributes(_0x47a631[_0x82e8('0x66')]);return db[_0x82e8('0x37')]['find']({'where':{'id':_0x47a631[_0x82e8('0x34')]['id']}})[_0x82e8('0x2d')](handleEntityNotFound(_0x33dd57,null))['then'](saveUpdates(_0x47a631['body'],null))[_0x82e8('0x2d')](respondWithResult(_0x33dd57,null))['catch'](handleError(_0x33dd57,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e36b272..f42cd41 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 _0x4407=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x4407,0x12e));var _0x7440=function(_0x5d04fe,_0x2ed0f5){_0x5d04fe=_0x5d04fe-0x0;var _0x1303f6=_0x4407[_0x5d04fe];return _0x1303f6;};'use strict';var EventEmitter=require(_0x7440('0x0'));var DashboardItem=require(_0x7440('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7440('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7440('0x3')};function emitEvent(_0x2bac76){return function(_0x45f059,_0x688b3e,_0x5df893){DashboardItemEvents[_0x7440('0x4')](_0x2bac76+':'+_0x45f059['id'],_0x45f059);DashboardItemEvents['emit'](_0x2bac76,_0x45f059);_0x5df893(null);};}for(var e in events){if(events[_0x7440('0x5')](e)){var event=events[e];DashboardItem[_0x7440('0x6')](e,emitEvent(event));}}module[_0x7440('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x8d7d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove'];(function(_0x486562,_0x13eb52){var _0x35eeb9=function(_0x10f1fb){while(--_0x10f1fb){_0x486562['push'](_0x486562['shift']());}};_0x35eeb9(++_0x13eb52);}(_0x8d7d,0x9e));var _0xd8d7=function(_0x7260d1,_0x5acd7c){_0x7260d1=_0x7260d1-0x0;var _0x3e05eb=_0x8d7d[_0x7260d1];return _0x3e05eb;};'use strict';var EventEmitter=require(_0xd8d7('0x0'));var DashboardItem=require(_0xd8d7('0x1'))['db'][_0xd8d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd8d7('0x3')](0x0);var events={'afterCreate':_0xd8d7('0x4'),'afterUpdate':_0xd8d7('0x5'),'afterDestroy':_0xd8d7('0x6')};function emitEvent(_0x5bf994){return function(_0x4fb51c,_0x4c9a15,_0x23a72e){DashboardItemEvents['emit'](_0x5bf994+':'+_0x4fb51c['id'],_0x4fb51c);DashboardItemEvents[_0xd8d7('0x7')](_0x5bf994,_0x4fb51c);_0x23a72e(null);};}for(var e in events){if(events[_0xd8d7('0x8')](e)){var event=events[e];DashboardItem[_0xd8d7('0x9')](e,emitEvent(event));}}module[_0xd8d7('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5523a53..d5b7740 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 _0xc8e9=['request-promise','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash','../../config/logger'];(function(_0x1d012e,_0x348b1c){var _0x5adb43=function(_0x1a6d51){while(--_0x1a6d51){_0x1d012e['push'](_0x1d012e['shift']());}};_0x5adb43(++_0x348b1c);}(_0xc8e9,0x1d6));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9c8e('0x0'));var util=require('util');var logger=require(_0x9c8e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c8e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c8e('0x3'));var attributes=require(_0x9c8e('0x4'));module[_0x9c8e('0x5')]=function(_0xf403a5,_0x26c9cc){return _0xf403a5['define'](_0x9c8e('0x6'),attributes,{'tableName':_0x9c8e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeff=['../../config/environment','exports','DashboardItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x313014,_0x375ea6){var _0x39e670=function(_0x1bf910){while(--_0x1bf910){_0x313014['push'](_0x313014['shift']());}};_0x39e670(++_0x375ea6);}(_0xaeff,0xea));var _0xfaef=function(_0x1f852d,_0x5261ba){_0x1f852d=_0x1f852d-0x0;var _0x343a4a=_0xaeff[_0x1f852d];return _0x343a4a;};'use strict';var _=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var logger=require(_0xfaef('0x2'))(_0xfaef('0x3'));var moment=require(_0xfaef('0x4'));var BPromise=require(_0xfaef('0x5'));var rp=require(_0xfaef('0x6'));var fs=require('fs');var path=require(_0xfaef('0x7'));var rimraf=require('rimraf');var config=require(_0xfaef('0x8'));var attributes=require('./dashboardItem.attributes');module[_0xfaef('0x9')]=function(_0x2675fb,_0x583c4f){return _0x2675fb['define'](_0xfaef('0xa'),attributes,{'tableName':'dashboard_items','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 f07868d..6c58e73 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 _0xe531=['http','redis','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x15aa9e,_0x4c3e4f){var _0x118810=function(_0x37f154){while(--_0x37f154){_0x15aa9e['push'](_0x15aa9e['shift']());}};_0x118810(++_0x4c3e4f);}(_0xe531,0x1ac));var _0x1e53=function(_0x1d116b,_0x4924ec){_0x1d116b=_0x1d116b-0x0;var _0x13db0c=_0xe531[_0x1d116b];return _0x13db0c;};'use strict';var _=require(_0x1e53('0x0'));var util=require('util');var moment=require(_0x1e53('0x1'));var BPromise=require(_0x1e53('0x2'));var rs=require(_0x1e53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1e53('0x4'))['db'];var utils=require(_0x1e53('0x5'));var logger=require(_0x1e53('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1e53('0x7'));var client=jayson[_0x1e53('0x8')][_0x1e53('0x9')]({'port':0x232a});config[_0x1e53('0xa')]=_['defaults'](config[_0x1e53('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e53('0xb'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x1e53('0xc')](socket);function respondWithRpcPromise(_0x555e7a,_0x1259d2,_0x50f74d){return new BPromise(function(_0x2f6828,_0x3a8d01){return client[_0x1e53('0xd')](_0x555e7a,_0x50f74d)['then'](function(_0x45bc67){logger[_0x1e53('0xe')](_0x1e53('0xf'),_0x1259d2,_0x1e53('0x10'));logger[_0x1e53('0x11')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1259d2,_0x1e53('0x10'),JSON['stringify'](_0x45bc67));if(_0x45bc67['error']){if(_0x45bc67[_0x1e53('0x12')][_0x1e53('0x13')]===0x1f4){logger[_0x1e53('0x12')](_0x1e53('0xf'),_0x1259d2,_0x45bc67['error'][_0x1e53('0x14')]);return _0x3a8d01(_0x45bc67['error'][_0x1e53('0x14')]);}logger[_0x1e53('0x12')](_0x1e53('0xf'),_0x1259d2,_0x45bc67[_0x1e53('0x12')][_0x1e53('0x14')]);return _0x2f6828(_0x45bc67[_0x1e53('0x12')][_0x1e53('0x14')]);}else{logger[_0x1e53('0xe')](_0x1e53('0xf'),_0x1259d2,_0x1e53('0x10'));_0x2f6828(_0x45bc67[_0x1e53('0x15')][_0x1e53('0x14')]);}})[_0x1e53('0x16')](function(_0x25892b){logger['error']('DashboardItem,\x20%s,\x20%s',_0x1259d2,_0x25892b);_0x3a8d01(_0x25892b);});});} \ No newline at end of file +var _0x4e0c=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b47d9,_0x1327ce){var _0x4151f0=function(_0x24bda2){while(--_0x24bda2){_0x5b47d9['push'](_0x5b47d9['shift']());}};_0x4151f0(++_0x1327ce);}(_0x4e0c,0x16a));var _0xc4e0=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0x4e0c[_0xf2f332];return _0x56cce3;};'use strict';var _=require(_0xc4e0('0x0'));var util=require(_0xc4e0('0x1'));var moment=require(_0xc4e0('0x2'));var BPromise=require(_0xc4e0('0x3'));var rs=require(_0xc4e0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4e0('0x5'))['db'];var utils=require(_0xc4e0('0x6'));var logger=require(_0xc4e0('0x7'))(_0xc4e0('0x8'));var config=require(_0xc4e0('0x9'));var jayson=require(_0xc4e0('0xa'));var client=jayson[_0xc4e0('0xb')][_0xc4e0('0xc')]({'port':0x232a});config[_0xc4e0('0xd')]=_[_0xc4e0('0xe')](config['redis'],{'host':_0xc4e0('0xf'),'port':0x18eb});var socket=require(_0xc4e0('0x10'))(new Redis(config[_0xc4e0('0xd')]));require(_0xc4e0('0x11'))['register'](socket);function respondWithRpcPromise(_0x553f15,_0x32ee9e,_0x5d4e15){return new BPromise(function(_0x5b9110,_0x21030a){return client[_0xc4e0('0x12')](_0x553f15,_0x5d4e15)[_0xc4e0('0x13')](function(_0x4f8764){logger[_0xc4e0('0x14')](_0xc4e0('0x15'),_0x32ee9e,_0xc4e0('0x16'));logger[_0xc4e0('0x17')](_0xc4e0('0x18'),_0x32ee9e,_0xc4e0('0x16'),JSON[_0xc4e0('0x19')](_0x4f8764));if(_0x4f8764['error']){if(_0x4f8764[_0xc4e0('0x1a')][_0xc4e0('0x1b')]===0x1f4){logger['error'](_0xc4e0('0x15'),_0x32ee9e,_0x4f8764['error'][_0xc4e0('0x1c')]);return _0x21030a(_0x4f8764['error'][_0xc4e0('0x1c')]);}logger['error'](_0xc4e0('0x15'),_0x32ee9e,_0x4f8764['error'][_0xc4e0('0x1c')]);return _0x5b9110(_0x4f8764[_0xc4e0('0x1a')]['message']);}else{logger['info'](_0xc4e0('0x15'),_0x32ee9e,_0xc4e0('0x16'));_0x5b9110(_0x4f8764[_0xc4e0('0x1d')]['message']);}})[_0xc4e0('0x1e')](function(_0x34370){logger[_0xc4e0('0x1a')](_0xc4e0('0x15'),_0x32ee9e,_0x34370);_0x21030a(_0x34370);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3c00c5d..82b331c 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 _0xff16=['removeListener','dashboardItem:','save','remove','emit'];(function(_0x45da86,_0x1fb5e5){var _0x282a97=function(_0x36c56f){while(--_0x36c56f){_0x45da86['push'](_0x45da86['shift']());}};_0x282a97(++_0x1fb5e5);}(_0xff16,0x98));var _0x6ff1=function(_0x4693d0,_0x53cd00){_0x4693d0=_0x4693d0-0x0;var _0x2a4219=_0xff16[_0x4693d0];return _0x2a4219;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x6ff1('0x0'),_0x6ff1('0x1'),'update'];function createListener(_0x2e4f30,_0x1b2b29){return function(_0xf1eb04){_0x1b2b29[_0x6ff1('0x2')](_0x2e4f30,_0xf1eb04);};}function removeListener(_0x5c0aab,_0x5ee6a2){return function(){DashboardItemEvents[_0x6ff1('0x3')](_0x5c0aab,_0x5ee6a2);};}exports['register']=function(_0x37092d){for(var _0x21c3a0=0x0,_0x4227ea=events['length'];_0x21c3a0<_0x4227ea;_0x21c3a0++){var _0x177181=events[_0x21c3a0];var _0x2860ba=createListener(_0x6ff1('0x4')+_0x177181,_0x37092d);DashboardItemEvents['on'](_0x177181,_0x2860ba);}}; \ No newline at end of file +var _0x8ded=['dashboardItem:','./dashboardItem.events','save','update','emit','length'];(function(_0x17e91c,_0x3be9de){var _0x302407=function(_0x39a61b){while(--_0x39a61b){_0x17e91c['push'](_0x17e91c['shift']());}};_0x302407(++_0x3be9de);}(_0x8ded,0x169));var _0xd8de=function(_0x196f56,_0x16d23f){_0x196f56=_0x196f56-0x0;var _0x4b258a=_0x8ded[_0x196f56];return _0x4b258a;};'use strict';var DashboardItemEvents=require(_0xd8de('0x0'));var events=[_0xd8de('0x1'),'remove',_0xd8de('0x2')];function createListener(_0x1c9bf7,_0x165408){return function(_0x351e47){_0x165408[_0xd8de('0x3')](_0x1c9bf7,_0x351e47);};}function removeListener(_0x54c59c,_0xb6d236){return function(){DashboardItemEvents['removeListener'](_0x54c59c,_0xb6d236);};}exports['register']=function(_0x49febf){for(var _0x3f8951=0x0,_0x496408=events[_0xd8de('0x4')];_0x3f8951<_0x496408;_0x3f8951++){var _0x2437e8=events[_0x3f8951];var _0x5d7e76=createListener(_0xd8de('0x5')+_0x2437e8,_0x49febf);DashboardItemEvents['on'](_0x2437e8,_0x5d7e76);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index b19003e..604f87d 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 _0x1c4d=['isAuthenticated','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x46e598,_0xb16373){var _0x18b5ec=function(_0x414d23){while(--_0x414d23){_0x46e598['push'](_0x46e598['shift']());}};_0x18b5ec(++_0xb16373);}(_0x1c4d,0x1d2));var _0xd1c4=function(_0x2bfa06,_0x351e03){_0x2bfa06=_0x2bfa06-0x0;var _0x58811b=_0x1c4d[_0x2bfa06];return _0x58811b;};'use strict';var multer=require(_0xd1c4('0x0'));var util=require(_0xd1c4('0x1'));var path=require(_0xd1c4('0x2'));var timeout=require(_0xd1c4('0x3'));var express=require(_0xd1c4('0x4'));var router=express[_0xd1c4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd1c4('0x6'));var interaction=require(_0xd1c4('0x7'));var config=require(_0xd1c4('0x8'));var controller=require('./dashboardItem.controller');router[_0xd1c4('0x9')]('/:id',auth[_0xd1c4('0xa')](),controller['show']);router[_0xd1c4('0xb')]('/',auth['isAuthenticated'](),controller[_0xd1c4('0xc')]);router[_0xd1c4('0xd')](_0xd1c4('0xe'),auth[_0xd1c4('0xa')](),controller[_0xd1c4('0xf')]);router['delete'](_0xd1c4('0xe'),auth[_0xd1c4('0xa')](),controller[_0xd1c4('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb713=['Router','fs-extra','../../components/auth/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0x1d6932,_0xa48bc9){var _0x4b877e=function(_0x34f315){while(--_0x34f315){_0x1d6932['push'](_0x1d6932['shift']());}};_0x4b877e(++_0xa48bc9);}(_0xb713,0x188));var _0x3b71=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0xb713[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0x3b71('0x0'));var util=require(_0x3b71('0x1'));var path=require(_0x3b71('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b71('0x3'));var router=express[_0x3b71('0x4')]();var fs_extra=require(_0x3b71('0x5'));var auth=require(_0x3b71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3b71('0x7'));var controller=require('./dashboardItem.controller');router[_0x3b71('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3b71('0x9')]);router[_0x3b71('0xa')]('/',auth[_0x3b71('0xb')](),controller[_0x3b71('0xc')]);router[_0x3b71('0xd')](_0x3b71('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3b71('0xf')](_0x3b71('0xe'),auth['isAuthenticated'](),controller[_0x3b71('0x10')]);module[_0x3b71('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 0900759..399125a 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 _0x06b9=['STRING','ENUM','first','second','third','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x06b9,0xb3));var _0x906b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06b9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x906b('0x0')]={'name':{'type':Sequelize[_0x906b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x906b('0x2')](_0x906b('0x3'),_0x906b('0x4'),_0x906b('0x5')),'allowNull':![],'defaultValue':_0x906b('0x3')},'description':{'type':Sequelize[_0x906b('0x1')]}}; \ No newline at end of file +var _0xb73c=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0xb73c,0x133));var _0xcb73=function(_0x20df20,_0x107202){_0x20df20=_0x20df20-0x0;var _0xbd5380=_0xb73c[_0x20df20];return _0xbd5380;};'use strict';var Sequelize=require(_0xcb73('0x0'));module[_0xcb73('0x1')]={'name':{'type':Sequelize[_0xcb73('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcb73('0x3')](_0xcb73('0x4'),_0xcb73('0x5'),_0xcb73('0x6')),'allowNull':![],'defaultValue':_0xcb73('0x4')},'description':{'type':Sequelize[_0xcb73('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 428b54c..a8dd837 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 _0xda42=['save','destroy','then','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Disposition','includeAll','include','findAll','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply'];(function(_0x11b02d,_0x556cf6){var _0x25f4fa=function(_0x2871fe){while(--_0x2871fe){_0x11b02d['push'](_0x11b02d['shift']());}};_0x25f4fa(++_0x556cf6);}(_0xda42,0x1bd));var _0x2da4=function(_0x24eac3,_0x362b21){_0x24eac3=_0x24eac3-0x0;var _0x2633a7=_0xda42[_0x24eac3];return _0x2633a7;};'use strict';var emlformat=require(_0x2da4('0x0'));var rimraf=require(_0x2da4('0x1'));var zipdir=require(_0x2da4('0x2'));var jsonpatch=require(_0x2da4('0x3'));var rp=require(_0x2da4('0x4'));var moment=require(_0x2da4('0x5'));var BPromise=require(_0x2da4('0x6'));var Mustache=require('mustache');var util=require(_0x2da4('0x7'));var path=require('path');var sox=require(_0x2da4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2da4('0x9'));var squel=require(_0x2da4('0xa'));var crypto=require(_0x2da4('0xb'));var jsforce=require(_0x2da4('0xc'));var deskjs=require(_0x2da4('0xd'));var toCsv=require(_0x2da4('0xe'));var querystring=require(_0x2da4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2da4('0x10'));var qs=require(_0x2da4('0x11'));var as=require(_0x2da4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2da4('0x13'))(_0x2da4('0x14'));var utils=require(_0x2da4('0x15'));var config=require(_0x2da4('0x16'));var licenseUtil=require(_0x2da4('0x17'));var db=require(_0x2da4('0x18'))['db'];function respondWithStatusCode(_0x25371d,_0x510486){_0x510486=_0x510486||0xcc;return function(_0x77560a){if(_0x77560a){return _0x25371d[_0x2da4('0x19')](_0x510486);}return _0x25371d['status'](_0x510486)[_0x2da4('0x1a')]();};}function respondWithResult(_0x2673bd,_0x2a1f57){_0x2a1f57=_0x2a1f57||0xc8;return function(_0x4ad611){if(_0x4ad611){return _0x2673bd[_0x2da4('0x1b')](_0x2a1f57)[_0x2da4('0x1c')](_0x4ad611);}};}function respondWithFilteredResult(_0x35aab4,_0x10d5d3){return function(_0x4f7424){if(_0x4f7424){var _0x4d44c9=typeof _0x10d5d3[_0x2da4('0x1d')]===_0x2da4('0x1e')&&typeof _0x10d5d3['limit']===_0x2da4('0x1e');var _0x244c0c=_0x4f7424[_0x2da4('0x1f')];var _0xd3bdf2=_0x4d44c9?0x0:_0x10d5d3[_0x2da4('0x1d')];var _0x379229=_0x4d44c9?_0x4f7424[_0x2da4('0x1f')]:_0x10d5d3[_0x2da4('0x1d')]+_0x10d5d3[_0x2da4('0x20')];var _0x46a4b4;if(_0x379229>=_0x244c0c){_0x379229=_0x244c0c;_0x46a4b4=0xc8;}else{_0x46a4b4=0xce;}_0x35aab4[_0x2da4('0x1b')](_0x46a4b4);return _0x35aab4[_0x2da4('0x21')]('Content-Range',_0xd3bdf2+'-'+_0x379229+'/'+_0x244c0c)[_0x2da4('0x1c')](_0x4f7424);}return null;};}function patchUpdates(_0x1b41f1){return function(_0x3a3ee6){try{jsonpatch[_0x2da4('0x22')](_0x3a3ee6,_0x1b41f1,!![]);}catch(_0x135732){return BPromise['reject'](_0x135732);}return _0x3a3ee6[_0x2da4('0x23')]();};}function saveUpdates(_0x56f47f,_0x229cab){return function(_0x2ed894){if(_0x2ed894){return _0x2ed894['update'](_0x56f47f)['then'](function(_0x402a74){return _0x402a74;});}return null;};}function removeEntity(_0x3370ce,_0x440a75){return function(_0x3a71df){if(_0x3a71df){return _0x3a71df[_0x2da4('0x24')]()[_0x2da4('0x25')](function(){var _0x37fd09=_0x3a71df['get']({'plain':!![]});var _0x850e2='Dispositions';return db[_0x2da4('0x26')]['destroy']({'where':{'type':_0x850e2,'resourceId':_0x37fd09['id']}})['then'](function(){return _0x3a71df;});})['then'](function(){_0x3370ce[_0x2da4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17cb1d,_0xb8cbb3){return function(_0x4c406a){if(!_0x4c406a){_0x17cb1d[_0x2da4('0x19')](0x194);}return _0x4c406a;};}function handleError(_0x2c22c4,_0x5243c7){_0x5243c7=_0x5243c7||0x1f4;return function(_0x3620cf){logger[_0x2da4('0x27')](_0x3620cf[_0x2da4('0x28')]);if(_0x3620cf[_0x2da4('0x29')]){delete _0x3620cf[_0x2da4('0x29')];}_0x2c22c4[_0x2da4('0x1b')](_0x5243c7)['send'](_0x3620cf);};}exports[_0x2da4('0x2a')]=function(_0x4c47cc,_0x1302cf){var _0x498ae6={},_0x2882d1={},_0x12360c={'count':0x0,'rows':[]};var _0xe63897=_[_0x2da4('0x2b')](db['Disposition'][_0x2da4('0x2c')],function(_0x46ef32){return{'name':_0x46ef32['fieldName'],'type':_0x46ef32[_0x2da4('0x2d')][_0x2da4('0x2e')]};});_0x2882d1[_0x2da4('0x2f')]=_[_0x2da4('0x2b')](_0xe63897,_0x2da4('0x29'));_0x2882d1[_0x2da4('0x30')]=_[_0x2da4('0x31')](_0x4c47cc[_0x2da4('0x30')]);_0x2882d1['filters']=_[_0x2da4('0x32')](_0x2882d1[_0x2da4('0x2f')],_0x2882d1[_0x2da4('0x30')]);_0x498ae6[_0x2da4('0x33')]=_[_0x2da4('0x32')](_0x2882d1[_0x2da4('0x2f')],qs[_0x2da4('0x34')](_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x34')]));_0x498ae6['attributes']=_0x498ae6[_0x2da4('0x33')][_0x2da4('0x35')]?_0x498ae6[_0x2da4('0x33')]:_0x2882d1['model'];if(!_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x36')]('nolimit')){_0x498ae6[_0x2da4('0x20')]=qs[_0x2da4('0x20')](_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x20')]);_0x498ae6['offset']=qs[_0x2da4('0x1d')](_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x1d')]);}_0x498ae6[_0x2da4('0x37')]=qs[_0x2da4('0x38')](_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x38')]);_0x498ae6[_0x2da4('0x39')]=qs[_0x2da4('0x3a')](_[_0x2da4('0x3b')](_0x4c47cc[_0x2da4('0x30')],_0x2882d1['filters']),_0xe63897);if(_0x4c47cc[_0x2da4('0x30')]['filter']){_0x498ae6[_0x2da4('0x39')]=_[_0x2da4('0x3c')](_0x498ae6['where'],{'$or':_['map'](_0xe63897,function(_0x544421){if(_0x544421[_0x2da4('0x2d')]!==_0x2da4('0x3d')){var _0x49d5c4={};_0x49d5c4[_0x544421['name']]={'$like':'%'+_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x3e')]+'%'};return _0x49d5c4;}})});}_0x498ae6=_[_0x2da4('0x3c')]({},_0x498ae6,_0x4c47cc[_0x2da4('0x3f')]);var _0x64e75={'where':_0x498ae6['where']};return db[_0x2da4('0x40')][_0x2da4('0x1f')](_0x64e75)[_0x2da4('0x25')](function(_0xd76236){_0x12360c[_0x2da4('0x1f')]=_0xd76236;if(_0x4c47cc[_0x2da4('0x30')][_0x2da4('0x41')]){_0x498ae6[_0x2da4('0x42')]=[{'all':!![]}];}return db[_0x2da4('0x40')][_0x2da4('0x43')](_0x498ae6);})[_0x2da4('0x25')](function(_0x46267f){_0x12360c['rows']=_0x46267f;return _0x12360c;})[_0x2da4('0x25')](respondWithFilteredResult(_0x1302cf,_0x498ae6))['catch'](handleError(_0x1302cf,null));};exports['show']=function(_0x33da40,_0x167bdf){var _0x3a6351={'raw':!![],'where':{'id':_0x33da40[_0x2da4('0x44')]['id']}},_0x1e26e3={};_0x1e26e3[_0x2da4('0x2f')]=_[_0x2da4('0x31')](db['Disposition'][_0x2da4('0x2c')]);_0x1e26e3['query']=_['keys'](_0x33da40[_0x2da4('0x30')]);_0x1e26e3[_0x2da4('0x3a')]=_[_0x2da4('0x32')](_0x1e26e3[_0x2da4('0x2f')],_0x1e26e3[_0x2da4('0x30')]);_0x3a6351[_0x2da4('0x33')]=_[_0x2da4('0x32')](_0x1e26e3['model'],qs[_0x2da4('0x34')](_0x33da40[_0x2da4('0x30')]['fields']));_0x3a6351[_0x2da4('0x33')]=_0x3a6351[_0x2da4('0x33')][_0x2da4('0x35')]?_0x3a6351['attributes']:_0x1e26e3[_0x2da4('0x2f')];if(_0x33da40[_0x2da4('0x30')][_0x2da4('0x41')]){_0x3a6351[_0x2da4('0x42')]=[{'all':!![]}];}_0x3a6351=_[_0x2da4('0x3c')]({},_0x3a6351,_0x33da40[_0x2da4('0x3f')]);return db[_0x2da4('0x40')][_0x2da4('0x45')](_0x3a6351)['then'](handleEntityNotFound(_0x167bdf,null))[_0x2da4('0x25')](respondWithResult(_0x167bdf,null))['catch'](handleError(_0x167bdf,null));};exports[_0x2da4('0x46')]=function(_0x9335f3,_0x1a956f){return db[_0x2da4('0x40')][_0x2da4('0x46')](_0x9335f3[_0x2da4('0x47')],{})[_0x2da4('0x25')](function(_0x5b00a8){var _0x22d9b8=_0x9335f3[_0x2da4('0x48')][_0x2da4('0x49')]({'plain':!![]});if(!_0x22d9b8)throw new Error(_0x2da4('0x4a'));if(_0x22d9b8[_0x2da4('0x4b')]===_0x2da4('0x48')){var _0x1b744e=_0x5b00a8['get']({'plain':!![]});var _0x5445da='Dispositions';return db['UserProfileSection'][_0x2da4('0x45')]({'where':{'name':_0x5445da,'userProfileId':_0x22d9b8[_0x2da4('0x4c')]},'raw':!![]})[_0x2da4('0x25')](function(_0x341e76){if(_0x341e76&&_0x341e76[_0x2da4('0x4d')]===0x0){return db[_0x2da4('0x26')][_0x2da4('0x46')]({'name':_0x1b744e[_0x2da4('0x29')],'resourceId':_0x1b744e['id'],'type':_0x341e76[_0x2da4('0x29')],'sectionId':_0x341e76['id']},{})['then'](function(){return _0x5b00a8;});}else{return _0x5b00a8;}})['catch'](function(_0x1f691c){logger[_0x2da4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f691c);throw _0x1f691c;});}return _0x5b00a8;})[_0x2da4('0x25')](respondWithResult(_0x1a956f,0xc9))[_0x2da4('0x4e')](handleError(_0x1a956f,null));};exports[_0x2da4('0x4f')]=function(_0x1a6520,_0x57f49c){if(_0x1a6520[_0x2da4('0x47')]['id']){delete _0x1a6520[_0x2da4('0x47')]['id'];}return db[_0x2da4('0x40')][_0x2da4('0x45')]({'where':{'id':_0x1a6520[_0x2da4('0x44')]['id']}})[_0x2da4('0x25')](handleEntityNotFound(_0x57f49c,null))['then'](saveUpdates(_0x1a6520['body'],null))[_0x2da4('0x25')](respondWithResult(_0x57f49c,null))['catch'](handleError(_0x57f49c,null));};exports[_0x2da4('0x24')]=function(_0x38c5bc,_0x398c56){return db[_0x2da4('0x40')][_0x2da4('0x45')]({'where':{'id':_0x38c5bc['params']['id']}})[_0x2da4('0x25')](handleEntityNotFound(_0x398c56,null))[_0x2da4('0x25')](removeEntity(_0x398c56,null))[_0x2da4('0x4e')](handleError(_0x398c56,null));}; \ No newline at end of file +var _0xd8c0=['error','stack','name','send','map','Disposition','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','UserProfileResource'];(function(_0x28ac6b,_0x5dcf2c){var _0xde8e37=function(_0x1ac512){while(--_0x1ac512){_0x28ac6b['push'](_0x28ac6b['shift']());}};_0xde8e37(++_0x5dcf2c);}(_0xd8c0,0x76));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0d8c('0x0'));var rimraf=require(_0x0d8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d8c('0x2'));var rp=require('request-promise');var moment=require(_0x0d8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0d8c('0x4'));var util=require(_0x0d8c('0x5'));var path=require('path');var sox=require(_0x0d8c('0x6'));var csv=require('to-csv');var ejs=require(_0x0d8c('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8c('0x8'));var _=require('lodash');var squel=require(_0x0d8c('0x9'));var crypto=require(_0x0d8c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0d8c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0d8c('0xc'));var Papa=require('papaparse');var Redis=require(_0x0d8c('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d8c('0xe'));var logger=require(_0x0d8c('0xf'))(_0x0d8c('0x10'));var utils=require(_0x0d8c('0x11'));var config=require(_0x0d8c('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d8c('0x13'))['db'];function respondWithStatusCode(_0x46c761,_0x117b51){_0x117b51=_0x117b51||0xcc;return function(_0x8225e1){if(_0x8225e1){return _0x46c761[_0x0d8c('0x14')](_0x117b51);}return _0x46c761[_0x0d8c('0x15')](_0x117b51)[_0x0d8c('0x16')]();};}function respondWithResult(_0x2aebb9,_0x2649b5){_0x2649b5=_0x2649b5||0xc8;return function(_0x381e96){if(_0x381e96){return _0x2aebb9['status'](_0x2649b5)[_0x0d8c('0x17')](_0x381e96);}};}function respondWithFilteredResult(_0x52eb7d,_0x511412){return function(_0x16f2bc){if(_0x16f2bc){var _0x18b382=typeof _0x511412[_0x0d8c('0x18')]===_0x0d8c('0x19')&&typeof _0x511412['limit']===_0x0d8c('0x19');var _0x381092=_0x16f2bc['count'];var _0x520011=_0x18b382?0x0:_0x511412[_0x0d8c('0x18')];var _0xd3e6e9=_0x18b382?_0x16f2bc[_0x0d8c('0x1a')]:_0x511412[_0x0d8c('0x18')]+_0x511412['limit'];var _0x5cf041;if(_0xd3e6e9>=_0x381092){_0xd3e6e9=_0x381092;_0x5cf041=0xc8;}else{_0x5cf041=0xce;}_0x52eb7d[_0x0d8c('0x15')](_0x5cf041);return _0x52eb7d[_0x0d8c('0x1b')]('Content-Range',_0x520011+'-'+_0xd3e6e9+'/'+_0x381092)[_0x0d8c('0x17')](_0x16f2bc);}return null;};}function patchUpdates(_0xf750f2){return function(_0x57afb7){try{jsonpatch[_0x0d8c('0x1c')](_0x57afb7,_0xf750f2,!![]);}catch(_0x3f967a){return BPromise[_0x0d8c('0x1d')](_0x3f967a);}return _0x57afb7[_0x0d8c('0x1e')]();};}function saveUpdates(_0x95f083,_0x38a1b7){return function(_0x208a45){if(_0x208a45){return _0x208a45['update'](_0x95f083)[_0x0d8c('0x1f')](function(_0x34a816){return _0x34a816;});}return null;};}function removeEntity(_0x4b12da,_0x3e1d84){return function(_0x102996){if(_0x102996){return _0x102996[_0x0d8c('0x20')]()[_0x0d8c('0x1f')](function(){var _0x4e6837=_0x102996['get']({'plain':!![]});var _0xeb0dcd='Dispositions';return db[_0x0d8c('0x21')]['destroy']({'where':{'type':_0xeb0dcd,'resourceId':_0x4e6837['id']}})[_0x0d8c('0x1f')](function(){return _0x102996;});})['then'](function(){_0x4b12da['status'](0xcc)[_0x0d8c('0x16')]();});}};}function handleEntityNotFound(_0x138032,_0x4cbf3a){return function(_0x324131){if(!_0x324131){_0x138032['sendStatus'](0x194);}return _0x324131;};}function handleError(_0x2712cb,_0x49ec08){_0x49ec08=_0x49ec08||0x1f4;return function(_0x393e00){logger[_0x0d8c('0x22')](_0x393e00[_0x0d8c('0x23')]);if(_0x393e00[_0x0d8c('0x24')]){delete _0x393e00[_0x0d8c('0x24')];}_0x2712cb[_0x0d8c('0x15')](_0x49ec08)[_0x0d8c('0x25')](_0x393e00);};}exports['index']=function(_0x153624,_0x5eb2d9){var _0x3e0551={},_0x723151={},_0x414fd5={'count':0x0,'rows':[]};var _0x3556c1=_[_0x0d8c('0x26')](db[_0x0d8c('0x27')]['rawAttributes'],function(_0x1db90e){return{'name':_0x1db90e['fieldName'],'type':_0x1db90e[_0x0d8c('0x28')]['key']};});_0x723151['model']=_[_0x0d8c('0x26')](_0x3556c1,'name');_0x723151[_0x0d8c('0x29')]=_[_0x0d8c('0x2a')](_0x153624[_0x0d8c('0x29')]);_0x723151[_0x0d8c('0x2b')]=_[_0x0d8c('0x2c')](_0x723151[_0x0d8c('0x2d')],_0x723151[_0x0d8c('0x29')]);_0x3e0551['attributes']=_[_0x0d8c('0x2c')](_0x723151['model'],qs[_0x0d8c('0x2e')](_0x153624[_0x0d8c('0x29')][_0x0d8c('0x2e')]));_0x3e0551['attributes']=_0x3e0551[_0x0d8c('0x2f')][_0x0d8c('0x30')]?_0x3e0551['attributes']:_0x723151[_0x0d8c('0x2d')];if(!_0x153624[_0x0d8c('0x29')][_0x0d8c('0x31')](_0x0d8c('0x32'))){_0x3e0551['limit']=qs[_0x0d8c('0x33')](_0x153624[_0x0d8c('0x29')][_0x0d8c('0x33')]);_0x3e0551[_0x0d8c('0x18')]=qs[_0x0d8c('0x18')](_0x153624[_0x0d8c('0x29')][_0x0d8c('0x18')]);}_0x3e0551[_0x0d8c('0x34')]=qs['sort'](_0x153624['query'][_0x0d8c('0x35')]);_0x3e0551[_0x0d8c('0x36')]=qs['filters'](_[_0x0d8c('0x37')](_0x153624[_0x0d8c('0x29')],_0x723151['filters']),_0x3556c1);if(_0x153624[_0x0d8c('0x29')]['filter']){_0x3e0551[_0x0d8c('0x36')]=_[_0x0d8c('0x38')](_0x3e0551[_0x0d8c('0x36')],{'$or':_[_0x0d8c('0x26')](_0x3556c1,function(_0x495024){if(_0x495024[_0x0d8c('0x28')]!=='VIRTUAL'){var _0x702128={};_0x702128[_0x495024[_0x0d8c('0x24')]]={'$like':'%'+_0x153624[_0x0d8c('0x29')]['filter']+'%'};return _0x702128;}})});}_0x3e0551=_['merge']({},_0x3e0551,_0x153624[_0x0d8c('0x39')]);var _0x20f1e2={'where':_0x3e0551[_0x0d8c('0x36')]};return db[_0x0d8c('0x27')][_0x0d8c('0x1a')](_0x20f1e2)['then'](function(_0x1f3278){_0x414fd5[_0x0d8c('0x1a')]=_0x1f3278;if(_0x153624[_0x0d8c('0x29')][_0x0d8c('0x3a')]){_0x3e0551[_0x0d8c('0x3b')]=[{'all':!![]}];}return db['Disposition'][_0x0d8c('0x3c')](_0x3e0551);})[_0x0d8c('0x1f')](function(_0x3ad9d2){_0x414fd5['rows']=_0x3ad9d2;return _0x414fd5;})[_0x0d8c('0x1f')](respondWithFilteredResult(_0x5eb2d9,_0x3e0551))[_0x0d8c('0x3d')](handleError(_0x5eb2d9,null));};exports[_0x0d8c('0x3e')]=function(_0x375733,_0x32f450){var _0x5f1d50={'raw':!![],'where':{'id':_0x375733[_0x0d8c('0x3f')]['id']}},_0x4eca7f={};_0x4eca7f['model']=_[_0x0d8c('0x2a')](db[_0x0d8c('0x27')][_0x0d8c('0x40')]);_0x4eca7f['query']=_[_0x0d8c('0x2a')](_0x375733[_0x0d8c('0x29')]);_0x4eca7f['filters']=_['intersection'](_0x4eca7f[_0x0d8c('0x2d')],_0x4eca7f['query']);_0x5f1d50[_0x0d8c('0x2f')]=_[_0x0d8c('0x2c')](_0x4eca7f[_0x0d8c('0x2d')],qs[_0x0d8c('0x2e')](_0x375733['query'][_0x0d8c('0x2e')]));_0x5f1d50[_0x0d8c('0x2f')]=_0x5f1d50[_0x0d8c('0x2f')][_0x0d8c('0x30')]?_0x5f1d50[_0x0d8c('0x2f')]:_0x4eca7f[_0x0d8c('0x2d')];if(_0x375733[_0x0d8c('0x29')][_0x0d8c('0x3a')]){_0x5f1d50[_0x0d8c('0x3b')]=[{'all':!![]}];}_0x5f1d50=_['merge']({},_0x5f1d50,_0x375733[_0x0d8c('0x39')]);return db['Disposition'][_0x0d8c('0x41')](_0x5f1d50)[_0x0d8c('0x1f')](handleEntityNotFound(_0x32f450,null))[_0x0d8c('0x1f')](respondWithResult(_0x32f450,null))[_0x0d8c('0x3d')](handleError(_0x32f450,null));};exports[_0x0d8c('0x42')]=function(_0x471c46,_0x3c0516){return db[_0x0d8c('0x27')]['create'](_0x471c46[_0x0d8c('0x43')],{})['then'](function(_0x48ad31){var _0x58e572=_0x471c46[_0x0d8c('0x44')]['get']({'plain':!![]});if(!_0x58e572)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58e572[_0x0d8c('0x45')]===_0x0d8c('0x44')){var _0x2d5ba4=_0x48ad31['get']({'plain':!![]});var _0x17870f=_0x0d8c('0x46');return db[_0x0d8c('0x47')][_0x0d8c('0x41')]({'where':{'name':_0x17870f,'userProfileId':_0x58e572[_0x0d8c('0x48')]},'raw':!![]})[_0x0d8c('0x1f')](function(_0x5b5659){if(_0x5b5659&&_0x5b5659[_0x0d8c('0x49')]===0x0){return db[_0x0d8c('0x21')][_0x0d8c('0x42')]({'name':_0x2d5ba4['name'],'resourceId':_0x2d5ba4['id'],'type':_0x5b5659['name'],'sectionId':_0x5b5659['id']},{})[_0x0d8c('0x1f')](function(){return _0x48ad31;});}else{return _0x48ad31;}})[_0x0d8c('0x3d')](function(_0x53b0e8){logger[_0x0d8c('0x22')](_0x0d8c('0x4a'),_0x53b0e8);throw _0x53b0e8;});}return _0x48ad31;})[_0x0d8c('0x1f')](respondWithResult(_0x3c0516,0xc9))[_0x0d8c('0x3d')](handleError(_0x3c0516,null));};exports[_0x0d8c('0x4b')]=function(_0x278530,_0x49528d){if(_0x278530[_0x0d8c('0x43')]['id']){delete _0x278530[_0x0d8c('0x43')]['id'];}return db[_0x0d8c('0x27')]['find']({'where':{'id':_0x278530[_0x0d8c('0x3f')]['id']}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x49528d,null))[_0x0d8c('0x1f')](saveUpdates(_0x278530[_0x0d8c('0x43')],null))[_0x0d8c('0x1f')](respondWithResult(_0x49528d,null))[_0x0d8c('0x3d')](handleError(_0x49528d,null));};exports[_0x0d8c('0x20')]=function(_0x488b68,_0x3e72e5){return db[_0x0d8c('0x27')]['find']({'where':{'id':_0x488b68[_0x0d8c('0x3f')]['id']}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x3e72e5,null))[_0x0d8c('0x1f')](removeEntity(_0x3e72e5,null))[_0x0d8c('0x3d')](handleError(_0x3e72e5,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d8c2b60..d45d772 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 _0x787d=['name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','tools_dispositions'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x787d,0x1b0));var _0xd787=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x787d[_0x5a7112];return _0x3147f7;};'use strict';var _=require('lodash');var util=require(_0xd787('0x0'));var logger=require(_0xd787('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd787('0x2'));var rp=require(_0xd787('0x3'));var fs=require('fs');var path=require(_0xd787('0x4'));var rimraf=require('rimraf');var config=require(_0xd787('0x5'));var attributes=require(_0xd787('0x6'));module[_0xd787('0x7')]=function(_0x18ac7c,_0x1fd758){return _0x18ac7c['define']('Disposition',attributes,{'tableName':_0xd787('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd787('0x9'),'fields':[_0xd787('0xa'),_0xd787('0xb')]},{'unique':!![],'name':_0xd787('0xc'),'fields':[_0xd787('0xa'),_0xd787('0xd')]},{'unique':!![],'name':'name_mail','fields':[_0xd787('0xa'),_0xd787('0xe')]},{'unique':!![],'name':'name_sms','fields':[_0xd787('0xa'),_0xd787('0xf')]},{'unique':!![],'name':_0xd787('0x10'),'fields':[_0xd787('0xa'),_0xd787('0x11')]},{'unique':!![],'name':_0xd787('0x12'),'fields':[_0xd787('0xa'),'OpenchannelAccountId']},{'unique':!![],'name':_0xd787('0x13'),'fields':[_0xd787('0xa'),_0xd787('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4983=['bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','../../config/logger','api'];(function(_0xcd105d,_0x3b5600){var _0x43d94d=function(_0x37fc7a){while(--_0x37fc7a){_0xcd105d['push'](_0xcd105d['shift']());}};_0x43d94d(++_0x3b5600);}(_0x4983,0xfb));var _0x3498=function(_0x2d39fe,_0x28e055){_0x2d39fe=_0x2d39fe-0x0;var _0x3e0a5f=_0x4983[_0x2d39fe];return _0x3e0a5f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3498('0x0'))(_0x3498('0x1'));var moment=require('moment');var BPromise=require(_0x3498('0x2'));var rp=require(_0x3498('0x3'));var fs=require('fs');var path=require(_0x3498('0x4'));var rimraf=require('rimraf');var config=require(_0x3498('0x5'));var attributes=require(_0x3498('0x6'));module[_0x3498('0x7')]=function(_0x23d194,_0x2a2179){return _0x23d194[_0x3498('0x8')]('Disposition',attributes,{'tableName':_0x3498('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3498('0xa'),'fields':[_0x3498('0xb'),'ListId']},{'unique':!![],'name':_0x3498('0xc'),'fields':[_0x3498('0xb'),_0x3498('0xd')]},{'unique':!![],'name':_0x3498('0xe'),'fields':[_0x3498('0xb'),_0x3498('0xf')]},{'unique':!![],'name':_0x3498('0x10'),'fields':['name',_0x3498('0x11')]},{'unique':!![],'name':_0x3498('0x12'),'fields':[_0x3498('0xb'),_0x3498('0x13')]},{'unique':!![],'name':_0x3498('0x14'),'fields':['name',_0x3498('0x15')]},{'unique':!![],'name':_0x3498('0x16'),'fields':['name','WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7a9504b..dd9028d 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(_0x46276a,_0x11c5df){var _0x1bfb25=function(_0x1ce86b){while(--_0x1ce86b){_0x46276a['push'](_0x46276a['shift']());}};_0x1bfb25(++_0x11c5df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x1de6b1,_0x4c3fec){var _0x3b3900=function(_0x3f701a){while(--_0x3f701a){_0x1de6b1['push'](_0x1de6b1['shift']());}};_0x3b3900(++_0x4c3fec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index b94a55f..c58fd9a 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 _0x66df=['../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','put','update','delete','/:id','destroy','exports','express'];(function(_0x1e1baa,_0x344d00){var _0x35f060=function(_0x1a3e79){while(--_0x1a3e79){_0x1e1baa['push'](_0x1e1baa['shift']());}};_0x35f060(++_0x344d00);}(_0x66df,0x67));var _0xf66d=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0x66df[_0x1526e1];return _0x249a1e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf66d('0x0'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf66d('0x1'));var config=require(_0xf66d('0x2'));var controller=require(_0xf66d('0x3'));router['get']('/',auth[_0xf66d('0x4')](),controller[_0xf66d('0x5')]);router[_0xf66d('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf66d('0x4')](),controller['create']);router[_0xf66d('0x7')]('/:id',auth[_0xf66d('0x4')](),controller[_0xf66d('0x8')]);router[_0xf66d('0x9')](_0xf66d('0xa'),auth[_0xf66d('0x4')](),controller[_0xf66d('0xb')]);module[_0xf66d('0xc')]=router; \ No newline at end of file +var _0x3715=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x11cf14,_0xc80d66){var _0x9af4a2=function(_0x33943f){while(--_0x33943f){_0x11cf14['push'](_0x11cf14['shift']());}};_0x9af4a2(++_0xc80d66);}(_0x3715,0xa3));var _0x5371=function(_0x1142f0,_0x4f9008){_0x1142f0=_0x1142f0-0x0;var _0x429a5f=_0x3715[_0x1142f0];return _0x429a5f;};'use strict';var multer=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var path=require(_0x5371('0x2'));var timeout=require(_0x5371('0x3'));var express=require(_0x5371('0x4'));var router=express['Router']();var fs_extra=require(_0x5371('0x5'));var auth=require(_0x5371('0x6'));var interaction=require(_0x5371('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5371('0x8')]);router[_0x5371('0x9')](_0x5371('0xa'),auth['isAuthenticated'](),controller[_0x5371('0xb')]);router[_0x5371('0xc')]('/',auth[_0x5371('0xd')](),controller[_0x5371('0xe')]);router[_0x5371('0xf')](_0x5371('0xa'),auth[_0x5371('0xd')](),controller[_0x5371('0x10')]);router[_0x5371('0x11')](_0x5371('0xa'),auth[_0x5371('0xd')](),controller[_0x5371('0x12')]);module[_0x5371('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index dea7369..98fde80 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 _0xbbca=['mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','7200','9600','12000','14400','4800','INTEGER','IAX','DADHI','KHOMP','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0xbbca,0xd9));var _0xabbc=function(_0x421bec,_0x5efe48){_0x421bec=_0x421bec-0x0;var _0x26ad85=_0xbbca[_0x421bec];return _0x26ad85;};'use strict';var Sequelize=require(_0xabbc('0x0'));module[_0xabbc('0x1')]={'name':{'type':Sequelize[_0xabbc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabbc('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xabbc('0x3'),'no'),'defaultValue':_0xabbc('0x3')},'headerinfo':{'type':Sequelize[_0xabbc('0x2')],'defaultValue':_0xabbc('0x4')},'localstationid':{'type':Sequelize[_0xabbc('0x2')],'unique':_0xabbc('0x5')},'minrate':{'type':Sequelize[_0xabbc('0x6')](_0xabbc('0x7'),'4800',_0xabbc('0x8'),_0xabbc('0x9'),_0xabbc('0xa'),_0xabbc('0xb')),'defaultValue':_0xabbc('0xc')},'maxrate':{'type':Sequelize[_0xabbc('0x6')](_0xabbc('0x7'),_0xabbc('0xc'),_0xabbc('0x8'),_0xabbc('0x9'),'12000',_0xabbc('0xb')),'defaultValue':_0xabbc('0xb')},'modem':{'type':Sequelize[_0xabbc('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xabbc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xabbc('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xabbc('0x6')]('SIP',_0xabbc('0xe'),_0xabbc('0xf'),_0xabbc('0x10')),'defaultValue':_0xabbc('0x11')},'key':{'type':Sequelize[_0xabbc('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xabbc('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xabbc('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabbc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xabbc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xabbc('0x13')],'defaultValue':![],'comment':_0xabbc('0x14'),'set':function(_0x45e628){if(!_0x45e628)this['setDataValue'](_0xabbc('0x15'),null);this[_0xabbc('0x16')](_0xabbc('0x17'),_0x45e628);}}}; \ No newline at end of file +var _0xfe5d=['INTEGER','SIP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','2400','9600'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xfe5d,0xcf));var _0xdfe5=function(_0x9e94e3,_0x2b5a08){_0x9e94e3=_0x9e94e3-0x0;var _0x2181c8=_0xfe5d[_0x9e94e3];return _0x2181c8;};'use strict';var Sequelize=require(_0xdfe5('0x0'));module[_0xdfe5('0x1')]={'name':{'type':Sequelize[_0xdfe5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfe5('0x2')]},'ecm':{'type':Sequelize[_0xdfe5('0x3')](_0xdfe5('0x4'),'no'),'defaultValue':_0xdfe5('0x4')},'headerinfo':{'type':Sequelize[_0xdfe5('0x2')],'defaultValue':_0xdfe5('0x5')},'localstationid':{'type':Sequelize[_0xdfe5('0x2')],'unique':_0xdfe5('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0xdfe5('0x7'),_0xdfe5('0x8'),'9600',_0xdfe5('0x9'),_0xdfe5('0xa')),'defaultValue':_0xdfe5('0x7')},'maxrate':{'type':Sequelize[_0xdfe5('0x3')](_0xdfe5('0xb'),'4800',_0xdfe5('0x8'),_0xdfe5('0xc'),'12000','14400'),'defaultValue':_0xdfe5('0xa')},'modem':{'type':Sequelize[_0xdfe5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xdfe5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xdfe5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdfe5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdfe5('0x3')](_0xdfe5('0xe'),'IAX','DADHI','KHOMP'),'defaultValue':_0xdfe5('0xe')},'key':{'type':Sequelize[_0xdfe5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xdfe5('0xf');}},'notificationSound':{'type':Sequelize[_0xdfe5('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdfe5('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfe5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfe5('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfe5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfe5('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfe5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfe5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xdfe5('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xdfe5('0x12'),'set':function(_0x5caf96){if(!_0x5caf96)this['setDataValue'](_0xdfe5('0x13'),null);this[_0xdfe5('0x14')](_0xdfe5('0x15'),_0x5caf96);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index b818e78..36a93f1 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 _0xbd59=['localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxAccounts','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','description','appdata','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/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','updateAccountApplications','VoiceExtension','tech','key','createdAt','TrunkId','ListId','findById','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x35edb9,_0x2c8e90){var _0x1c29b0=function(_0x1dde92){while(--_0x1dde92){_0x35edb9['push'](_0x35edb9['shift']());}};_0x1c29b0(++_0x2c8e90);}(_0xbd59,0xab));var _0x9bd5=function(_0x1b1834,_0x165b05){_0x1b1834=_0x1b1834-0x0;var _0x5352ad=_0xbd59[_0x1b1834];return _0x5352ad;};'use strict';var emlformat=require(_0x9bd5('0x0'));var rimraf=require(_0x9bd5('0x1'));var zipdir=require(_0x9bd5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9bd5('0x3'));var moment=require(_0x9bd5('0x4'));var BPromise=require(_0x9bd5('0x5'));var Mustache=require(_0x9bd5('0x6'));var util=require('util');var path=require(_0x9bd5('0x7'));var sox=require(_0x9bd5('0x8'));var csv=require('to-csv');var ejs=require(_0x9bd5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bd5('0xa'));var squel=require(_0x9bd5('0xb'));var crypto=require(_0x9bd5('0xc'));var jsforce=require(_0x9bd5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9bd5('0xe'));var Papa=require(_0x9bd5('0xf'));var Redis=require(_0x9bd5('0x10'));var authService=require(_0x9bd5('0x11'));var qs=require(_0x9bd5('0x12'));var as=require(_0x9bd5('0x13'));var hardwareService=require(_0x9bd5('0x14'));var logger=require(_0x9bd5('0x15'))(_0x9bd5('0x16'));var utils=require('../../config/utils');var config=require(_0x9bd5('0x17'));var licenseUtil=require(_0x9bd5('0x18'));var db=require(_0x9bd5('0x19'))['db'];config[_0x9bd5('0x1a')]=_[_0x9bd5('0x1b')](config['redis'],{'host':_0x9bd5('0x1c'),'port':0x18eb});var socket=require(_0x9bd5('0x1d'))(new Redis(config[_0x9bd5('0x1a')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0x9bd5('0x1e'));var client=jayson[_0x9bd5('0x1f')][_0x9bd5('0x20')]({'port':0x232c});var client9002=jayson[_0x9bd5('0x1f')][_0x9bd5('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x54d6d1,_0x32216e,_0x34a841,_0x1b670e){return new BPromise(function(_0x1d2776,_0x106eb8){var _0x48bb11=_0x1b670e||client;return _0x48bb11[_0x9bd5('0x21')](_0x54d6d1,_0x34a841)[_0x9bd5('0x22')](function(_0x1dfcf8){logger[_0x9bd5('0x23')](_0x9bd5('0x24'),_0x32216e,_0x9bd5('0x25'));logger[_0x9bd5('0x26')](_0x9bd5('0x27'),_0x32216e,'request\x20sent',JSON[_0x9bd5('0x28')](_0x1dfcf8));if(_0x1dfcf8[_0x9bd5('0x29')]){if(_0x1dfcf8[_0x9bd5('0x29')][_0x9bd5('0x2a')]===0x1f4){logger[_0x9bd5('0x29')](_0x9bd5('0x24'),_0x32216e,_0x1dfcf8[_0x9bd5('0x29')][_0x9bd5('0x2b')]);return _0x106eb8(_0x1dfcf8[_0x9bd5('0x29')][_0x9bd5('0x2b')]);}logger['error'](_0x9bd5('0x24'),_0x32216e,_0x1dfcf8[_0x9bd5('0x29')][_0x9bd5('0x2b')]);return _0x1d2776(_0x1dfcf8[_0x9bd5('0x29')]['message']);}else{logger[_0x9bd5('0x23')](_0x9bd5('0x24'),_0x32216e,_0x9bd5('0x25'));_0x1d2776(_0x1dfcf8[_0x9bd5('0x2c')][_0x9bd5('0x2b')]);}})['catch'](function(_0x103821){logger[_0x9bd5('0x29')](_0x9bd5('0x24'),_0x32216e,_0x103821);_0x106eb8(_0x103821);});});}function respondWithStatusCode(_0xffd22e,_0x5a000e){_0x5a000e=_0x5a000e||0xcc;return function(_0x14e224){if(_0x14e224){return _0xffd22e[_0x9bd5('0x2d')](_0x5a000e);}return _0xffd22e[_0x9bd5('0x2e')](_0x5a000e)[_0x9bd5('0x2f')]();};}function respondWithResult(_0x4132b9,_0x4e7a6f){_0x4e7a6f=_0x4e7a6f||0xc8;return function(_0x27c9dc){if(_0x27c9dc){return _0x4132b9[_0x9bd5('0x2e')](_0x4e7a6f)[_0x9bd5('0x30')](_0x27c9dc);}};}function respondWithFilteredResult(_0x2d684f,_0x426620){return function(_0x3bf55f){if(_0x3bf55f){var _0x3039a0=typeof _0x426620[_0x9bd5('0x31')]===_0x9bd5('0x32')&&typeof _0x426620[_0x9bd5('0x33')]===_0x9bd5('0x32');var _0x467b20=_0x3bf55f['count'];var _0x57faf7=_0x3039a0?0x0:_0x426620['offset'];var _0x2f7143=_0x3039a0?_0x3bf55f[_0x9bd5('0x34')]:_0x426620['offset']+_0x426620[_0x9bd5('0x33')];var _0x149db1;if(_0x2f7143>=_0x467b20){_0x2f7143=_0x467b20;_0x149db1=0xc8;}else{_0x149db1=0xce;}_0x2d684f[_0x9bd5('0x2e')](_0x149db1);return _0x2d684f[_0x9bd5('0x35')]('Content-Range',_0x57faf7+'-'+_0x2f7143+'/'+_0x467b20)['json'](_0x3bf55f);}return null;};}function patchUpdates(_0x900166){return function(_0x457328){try{jsonpatch[_0x9bd5('0x36')](_0x457328,_0x900166,!![]);}catch(_0x368490){return BPromise['reject'](_0x368490);}return _0x457328[_0x9bd5('0x37')]();};}function saveUpdates(_0x3ebcb9,_0x1c65f0){return function(_0x3bce80){if(_0x3bce80){return _0x3bce80[_0x9bd5('0x38')](_0x3ebcb9)[_0x9bd5('0x22')](function(_0x20e345){return _0x20e345;});}return null;};}function removeEntity(_0x424072,_0x385669){return function(_0x636d93){if(_0x636d93){return _0x636d93[_0x9bd5('0x39')]()['then'](function(){var _0x94167=_0x636d93[_0x9bd5('0x3a')]({'plain':!![]});var _0x554826='FaxAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x554826,'resourceId':_0x94167['id']}})[_0x9bd5('0x22')](function(){return _0x636d93;});})['then'](function(){_0x424072[_0x9bd5('0x2e')](0xcc)[_0x9bd5('0x2f')]();});}};}function handleEntityNotFound(_0x29944c,_0x381c29){return function(_0xe23bb5){if(!_0xe23bb5){_0x29944c[_0x9bd5('0x2d')](0x194);}return _0xe23bb5;};}function handleError(_0x3b4421,_0x53e3c1){_0x53e3c1=_0x53e3c1||0x1f4;return function(_0x5a0f1f){logger[_0x9bd5('0x29')](_0x5a0f1f[_0x9bd5('0x3b')]);if(_0x5a0f1f['name']){delete _0x5a0f1f[_0x9bd5('0x3c')];}_0x3b4421[_0x9bd5('0x2e')](_0x53e3c1)[_0x9bd5('0x3d')](_0x5a0f1f);};}exports[_0x9bd5('0x3e')]=function(_0x30bc6b,_0x187e62){var _0x4d8320={'include':[{'model':db[_0x9bd5('0x3f')],'as':_0x9bd5('0x40')}]},_0xccdbd4={},_0x155127={'count':0x0,'rows':[]};var _0x54a681=_[_0x9bd5('0x41')](db[_0x9bd5('0x42')]['rawAttributes'],function(_0x25bcfd){return{'name':_0x25bcfd[_0x9bd5('0x43')],'type':_0x25bcfd[_0x9bd5('0x44')]['key']};});_0xccdbd4[_0x9bd5('0x45')]=_[_0x9bd5('0x41')](_0x54a681,_0x9bd5('0x3c'));_0xccdbd4[_0x9bd5('0x46')]=_['keys'](_0x30bc6b[_0x9bd5('0x46')]);_0xccdbd4[_0x9bd5('0x47')]=_['intersection'](_0xccdbd4['model'],_0xccdbd4['query']);_0x4d8320[_0x9bd5('0x48')]=_['intersection'](_0xccdbd4[_0x9bd5('0x45')],qs[_0x9bd5('0x49')](_0x30bc6b['query'][_0x9bd5('0x49')]));_0x4d8320[_0x9bd5('0x48')]=_0x4d8320[_0x9bd5('0x48')][_0x9bd5('0x4a')]?_0x4d8320['attributes']:_0xccdbd4[_0x9bd5('0x45')];if(!_0x30bc6b[_0x9bd5('0x46')][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x4d8320[_0x9bd5('0x33')]=qs[_0x9bd5('0x33')](_0x30bc6b[_0x9bd5('0x46')][_0x9bd5('0x33')]);_0x4d8320[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x30bc6b[_0x9bd5('0x46')]['offset']);}_0x4d8320[_0x9bd5('0x4d')]=qs[_0x9bd5('0x4e')](_0x30bc6b[_0x9bd5('0x46')][_0x9bd5('0x4e')]);_0x4d8320[_0x9bd5('0x4f')]=qs[_0x9bd5('0x47')](_[_0x9bd5('0x50')](_0x30bc6b[_0x9bd5('0x46')],_0xccdbd4['filters']),_0x54a681);if(_0x30bc6b['query'][_0x9bd5('0x51')]){_0x4d8320[_0x9bd5('0x4f')]=_[_0x9bd5('0x52')](_0x4d8320[_0x9bd5('0x4f')],{'$or':_[_0x9bd5('0x41')](_0x54a681,function(_0x246ae8){if(_0x246ae8[_0x9bd5('0x44')]!==_0x9bd5('0x53')){var _0x96c68c={};_0x96c68c[_0x246ae8['name']]={'$like':'%'+_0x30bc6b[_0x9bd5('0x46')][_0x9bd5('0x51')]+'%'};return _0x96c68c;}})});}_0x4d8320=_['merge']({},_0x4d8320,_0x30bc6b[_0x9bd5('0x54')]);var _0x5e103c={'where':_0x4d8320[_0x9bd5('0x4f')]};return db[_0x9bd5('0x42')][_0x9bd5('0x34')](_0x5e103c)[_0x9bd5('0x22')](function(_0x235330){_0x155127[_0x9bd5('0x34')]=_0x235330;if(_0x30bc6b[_0x9bd5('0x46')][_0x9bd5('0x55')]){_0x4d8320[_0x9bd5('0x56')]=[{'all':!![]}];}return db['FaxAccount'][_0x9bd5('0x57')](_0x4d8320);})[_0x9bd5('0x22')](function(_0x2a63d6){_0x155127[_0x9bd5('0x58')]=_0x2a63d6;return _0x155127;})[_0x9bd5('0x22')](respondWithFilteredResult(_0x187e62,_0x4d8320))[_0x9bd5('0x59')](handleError(_0x187e62,null));};exports[_0x9bd5('0x5a')]=function(_0x582f63,_0x57ede3){var _0x1e81e2={'raw':![],'where':{'id':_0x582f63[_0x9bd5('0x5b')]['id']},'include':[{'model':db[_0x9bd5('0x3f')],'as':_0x9bd5('0x40')}]},_0x2674c0={};_0x2674c0[_0x9bd5('0x45')]=_[_0x9bd5('0x5c')](db['FaxAccount'][_0x9bd5('0x5d')]);_0x2674c0[_0x9bd5('0x46')]=_[_0x9bd5('0x5c')](_0x582f63[_0x9bd5('0x46')]);_0x2674c0[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x2674c0[_0x9bd5('0x45')],_0x2674c0['query']);_0x1e81e2[_0x9bd5('0x48')]=_[_0x9bd5('0x5e')](_0x2674c0['model'],qs[_0x9bd5('0x49')](_0x582f63['query'][_0x9bd5('0x49')]));_0x1e81e2['attributes']=_0x1e81e2[_0x9bd5('0x48')][_0x9bd5('0x4a')]?_0x1e81e2[_0x9bd5('0x48')]:_0x2674c0['model'];if(_0x582f63[_0x9bd5('0x46')][_0x9bd5('0x55')]){_0x1e81e2['include']=[{'all':!![]}];}_0x1e81e2=_[_0x9bd5('0x52')]({},_0x1e81e2,_0x582f63[_0x9bd5('0x54')]);return db[_0x9bd5('0x42')][_0x9bd5('0x5f')](_0x1e81e2)[_0x9bd5('0x22')](handleEntityNotFound(_0x57ede3,null))[_0x9bd5('0x22')](respondWithResult(_0x57ede3,null))[_0x9bd5('0x59')](handleError(_0x57ede3,null));};exports[_0x9bd5('0x60')]=function(_0x4ee0fc,_0x8e18e7){return db[_0x9bd5('0x42')][_0x9bd5('0x60')](_0x4ee0fc[_0x9bd5('0x61')],{})['then'](function(_0x2ecadf){var _0x1de982=_0x4ee0fc[_0x9bd5('0x62')][_0x9bd5('0x3a')]({'plain':!![]});if(!_0x1de982)throw new Error(_0x9bd5('0x63'));if(_0x1de982['role']===_0x9bd5('0x62')){var _0x3b076b=_0x2ecadf['get']({'plain':!![]});var _0x1a595f=_0x9bd5('0x64');return db[_0x9bd5('0x65')][_0x9bd5('0x5f')]({'where':{'name':_0x1a595f,'userProfileId':_0x1de982['userProfileId']},'raw':!![]})[_0x9bd5('0x22')](function(_0x467f01){if(_0x467f01&&_0x467f01[_0x9bd5('0x66')]===0x0){return db[_0x9bd5('0x67')]['create']({'name':_0x3b076b[_0x9bd5('0x3c')],'resourceId':_0x3b076b['id'],'type':_0x467f01[_0x9bd5('0x3c')],'sectionId':_0x467f01['id']},{})[_0x9bd5('0x22')](function(){return _0x2ecadf;});}else{return _0x2ecadf;}})[_0x9bd5('0x59')](function(_0x53542e){logger[_0x9bd5('0x29')](_0x9bd5('0x68'),_0x53542e);throw _0x53542e;});}return _0x2ecadf;})['then'](respondWithResult(_0x8e18e7,0xc9))[_0x9bd5('0x59')](handleError(_0x8e18e7,null));};exports[_0x9bd5('0x38')]=function(_0x5bb624,_0xaab536){if(_0x5bb624[_0x9bd5('0x61')]['id']){delete _0x5bb624[_0x9bd5('0x61')]['id'];}return db[_0x9bd5('0x42')][_0x9bd5('0x5f')]({'where':{'id':_0x5bb624[_0x9bd5('0x5b')]['id']},'include':[{'model':db[_0x9bd5('0x3f')],'as':_0x9bd5('0x40')}]})[_0x9bd5('0x22')](handleEntityNotFound(_0xaab536,null))[_0x9bd5('0x22')](saveUpdates(_0x5bb624[_0x9bd5('0x61')],null))[_0x9bd5('0x22')](respondWithResult(_0xaab536,null))[_0x9bd5('0x59')](handleError(_0xaab536,null));};exports[_0x9bd5('0x39')]=function(_0x3b1095,_0x4498){return db['FaxAccount'][_0x9bd5('0x5f')]({'where':{'id':_0x3b1095['params']['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x4498,null))[_0x9bd5('0x22')](removeEntity(_0x4498,null))[_0x9bd5('0x59')](handleError(_0x4498,null));};exports['describe']=function(_0x4d040a,_0x484580){return db[_0x9bd5('0x42')][_0x9bd5('0x69')]()['then'](respondWithResult(_0x484580,null))[_0x9bd5('0x59')](handleError(_0x484580,null));};exports[_0x9bd5('0x6a')]=function(_0x3e0254,_0x1028a6,_0x302cca){if(_0x3e0254[_0x9bd5('0x61')]['id']){delete _0x3e0254[_0x9bd5('0x61')]['id'];}return db[_0x9bd5('0x42')][_0x9bd5('0x5f')]({'where':{'id':_0x3e0254[_0x9bd5('0x5b')]['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x1028a6,null))[_0x9bd5('0x22')](function(_0x286654){if(_0x286654){_0x3e0254[_0x9bd5('0x61')][_0x9bd5('0x6b')]=_0x286654['id'];return db[_0x9bd5('0x6c')][_0x9bd5('0x60')](_0x3e0254['body']);}})[_0x9bd5('0x22')](respondWithResult(_0x1028a6,null))['catch'](handleError(_0x1028a6,null));};exports[_0x9bd5('0x6d')]=function(_0x37d975,_0x43d178,_0x2e44aa){var _0x30ecaf={'raw':![],'where':{}};var _0xfd7a95={};var _0x120c21={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x37d975['params']['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x43d178,null))['then'](function(_0xe85aba){if(_0xe85aba){_0xfd7a95[_0x9bd5('0x45')]=_[_0x9bd5('0x5c')](db[_0x9bd5('0x6c')]['rawAttributes']);_0xfd7a95[_0x9bd5('0x46')]=_[_0x9bd5('0x5c')](_0x37d975['query']);_0xfd7a95[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0xfd7a95[_0x9bd5('0x45')],_0xfd7a95['query']);_0x30ecaf[_0x9bd5('0x48')]=_['intersection'](_0xfd7a95[_0x9bd5('0x45')],qs[_0x9bd5('0x49')](_0x37d975[_0x9bd5('0x46')]['fields']));_0x30ecaf[_0x9bd5('0x48')]=_0x30ecaf[_0x9bd5('0x48')]['length']?_0x30ecaf[_0x9bd5('0x48')]:_0xfd7a95[_0x9bd5('0x45')];if(!_0x37d975[_0x9bd5('0x46')][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x30ecaf[_0x9bd5('0x33')]=qs['limit'](_0x37d975[_0x9bd5('0x46')][_0x9bd5('0x33')]);_0x30ecaf[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x37d975['query'][_0x9bd5('0x31')]);}_0x30ecaf[_0x9bd5('0x4d')]=qs[_0x9bd5('0x4e')](_0x37d975[_0x9bd5('0x46')][_0x9bd5('0x4e')]);_0x30ecaf[_0x9bd5('0x4f')]=qs[_0x9bd5('0x47')](_[_0x9bd5('0x50')](_0x37d975[_0x9bd5('0x46')],_0xfd7a95[_0x9bd5('0x47')]));_0x30ecaf[_0x9bd5('0x4f')][_0x9bd5('0x6b')]=_0xe85aba['id'];if(_0x37d975[_0x9bd5('0x46')]['filter']){_0x30ecaf[_0x9bd5('0x4f')]=_[_0x9bd5('0x52')](_0x30ecaf[_0x9bd5('0x4f')],{'$or':_[_0x9bd5('0x41')](_0x30ecaf[_0x9bd5('0x48')],function(_0x53b943){var _0x85d65={};_0x85d65[_0x53b943]={'$like':'%'+_0x37d975[_0x9bd5('0x46')]['filter']+'%'};return _0x85d65;})});}_0x30ecaf=_[_0x9bd5('0x52')]({},_0x30ecaf,_0x37d975[_0x9bd5('0x54')]);return db[_0x9bd5('0x6c')][_0x9bd5('0x34')]({'where':_0x30ecaf[_0x9bd5('0x4f')]})[_0x9bd5('0x22')](function(_0x9ea52f){_0x120c21[_0x9bd5('0x34')]=_0x9ea52f;if(_0x37d975[_0x9bd5('0x46')][_0x9bd5('0x55')]){_0x30ecaf[_0x9bd5('0x56')]=[{'all':!![]}];}return db[_0x9bd5('0x6c')][_0x9bd5('0x57')](_0x30ecaf);})[_0x9bd5('0x22')](function(_0x38e415){_0x120c21[_0x9bd5('0x58')]=_0x38e415;return _0x120c21;});}})[_0x9bd5('0x22')](respondWithFilteredResult(_0x43d178,_0x30ecaf))[_0x9bd5('0x59')](handleError(_0x43d178,null));};exports[_0x9bd5('0x6e')]=function(_0x3df0de,_0x3d7980,_0x11d0b3){return db[_0x9bd5('0x42')][_0x9bd5('0x5f')]({'where':{'id':_0x3df0de[_0x9bd5('0x5b')]['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x3d7980,null))[_0x9bd5('0x22')](function(_0x5cc224){if(_0x5cc224){return _0x5cc224['removeDispositions'](_0x3df0de[_0x9bd5('0x46')][_0x9bd5('0x6f')]);}})[_0x9bd5('0x22')](respondWithStatusCode(_0x3d7980,null))['catch'](handleError(_0x3d7980,null));};exports['addAnswer']=function(_0x24f56a,_0x3ff131,_0x3e1afc){if(_0x24f56a[_0x9bd5('0x61')]['id']){delete _0x24f56a[_0x9bd5('0x61')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x24f56a[_0x9bd5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ff131,null))['then'](function(_0x3b65f3){if(_0x3b65f3){_0x24f56a[_0x9bd5('0x61')][_0x9bd5('0x6b')]=_0x3b65f3['id'];return db[_0x9bd5('0x70')][_0x9bd5('0x60')](_0x24f56a[_0x9bd5('0x61')]);}})[_0x9bd5('0x22')](respondWithResult(_0x3ff131,null))[_0x9bd5('0x59')](handleError(_0x3ff131,null));};exports['getAnswers']=function(_0x27d83b,_0x7be0dd,_0x2e50dd){var _0x3b5024={'raw':![],'where':{}};var _0x1135df={};var _0x547b04={'count':0x0,'rows':[]};return db[_0x9bd5('0x42')][_0x9bd5('0x71')]({'where':{'id':_0x27d83b[_0x9bd5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x7be0dd,null))[_0x9bd5('0x22')](function(_0x470444){if(_0x470444){_0x1135df[_0x9bd5('0x45')]=_[_0x9bd5('0x5c')](db[_0x9bd5('0x70')][_0x9bd5('0x5d')]);_0x1135df[_0x9bd5('0x46')]=_[_0x9bd5('0x5c')](_0x27d83b[_0x9bd5('0x46')]);_0x1135df[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x1135df[_0x9bd5('0x45')],_0x1135df[_0x9bd5('0x46')]);_0x3b5024[_0x9bd5('0x48')]=_['intersection'](_0x1135df[_0x9bd5('0x45')],qs['fields'](_0x27d83b['query']['fields']));_0x3b5024[_0x9bd5('0x48')]=_0x3b5024[_0x9bd5('0x48')]['length']?_0x3b5024[_0x9bd5('0x48')]:_0x1135df['model'];if(!_0x27d83b['query'][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x3b5024[_0x9bd5('0x33')]=qs[_0x9bd5('0x33')](_0x27d83b['query'][_0x9bd5('0x33')]);_0x3b5024[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x27d83b[_0x9bd5('0x46')][_0x9bd5('0x31')]);}_0x3b5024[_0x9bd5('0x4d')]=qs[_0x9bd5('0x4e')](_0x27d83b[_0x9bd5('0x46')][_0x9bd5('0x4e')]);_0x3b5024['where']=qs[_0x9bd5('0x47')](_[_0x9bd5('0x50')](_0x27d83b[_0x9bd5('0x46')],_0x1135df['filters']));_0x3b5024[_0x9bd5('0x4f')][_0x9bd5('0x6b')]=_0x470444['id'];if(_0x27d83b[_0x9bd5('0x46')][_0x9bd5('0x51')]){_0x3b5024[_0x9bd5('0x4f')]=_['merge'](_0x3b5024[_0x9bd5('0x4f')],{'$or':_[_0x9bd5('0x41')](_0x3b5024['attributes'],function(_0x400376){var _0x5bec0d={};_0x5bec0d[_0x400376]={'$like':'%'+_0x27d83b['query'][_0x9bd5('0x51')]+'%'};return _0x5bec0d;})});}_0x3b5024=_['merge']({},_0x3b5024,_0x27d83b[_0x9bd5('0x54')]);return db['CannedAnswer'][_0x9bd5('0x34')]({'where':_0x3b5024[_0x9bd5('0x4f')]})[_0x9bd5('0x22')](function(_0x3e9361){_0x547b04[_0x9bd5('0x34')]=_0x3e9361;if(_0x27d83b[_0x9bd5('0x46')][_0x9bd5('0x55')]){_0x3b5024[_0x9bd5('0x56')]=[{'all':!![]}];}return db[_0x9bd5('0x70')][_0x9bd5('0x57')](_0x3b5024);})[_0x9bd5('0x22')](function(_0x1ed3bf){_0x547b04['rows']=_0x1ed3bf;return _0x547b04;});}})[_0x9bd5('0x22')](respondWithFilteredResult(_0x7be0dd,_0x3b5024))[_0x9bd5('0x59')](handleError(_0x7be0dd,null));};exports[_0x9bd5('0x72')]=function(_0x2cfda2,_0xedad5a,_0x8b80b8){return db[_0x9bd5('0x42')][_0x9bd5('0x5f')]({'where':{'id':_0x2cfda2[_0x9bd5('0x5b')]['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0xedad5a,null))[_0x9bd5('0x22')](function(_0x36954e){if(_0x36954e){return _0x36954e['removeAnswers'](_0x2cfda2[_0x9bd5('0x46')][_0x9bd5('0x6f')]);}})[_0x9bd5('0x22')](respondWithStatusCode(_0xedad5a,null))['catch'](handleError(_0xedad5a,null));};exports[_0x9bd5('0x73')]=function(_0x4fd10d,_0x3bca49,_0xa20526){return db[_0x9bd5('0x74')][_0x9bd5('0x5f')]({'where':{'id':_0x4fd10d['params']['id']}})['then'](handleEntityNotFound(_0x3bca49,null))['then'](function(_0x137567){if(_0x137567){return _0x137567[_0x9bd5('0x73')](_0x4fd10d['body']['ids'],_[_0x9bd5('0x75')](_0x4fd10d[_0x9bd5('0x61')],[_0x9bd5('0x6f'),'id'])||{});}})[_0x9bd5('0x22')](respondWithResult(_0x3bca49,null))[_0x9bd5('0x59')](handleError(_0x3bca49,null));};exports[_0x9bd5('0x76')]=function(_0x3cf7a6,_0x59b44f,_0x142c8e){var _0x420594={'raw':![],'where':{}};var _0x1aec6d={};var _0x465fda={'count':0x0,'rows':[]};return db[_0x9bd5('0x42')][_0x9bd5('0x71')]({'where':{'id':_0x3cf7a6[_0x9bd5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59b44f,null))['then'](function(_0x1625d3){if(_0x1625d3){_0x1aec6d[_0x9bd5('0x45')]=_[_0x9bd5('0x5c')](db[_0x9bd5('0x74')][_0x9bd5('0x5d')]);_0x1aec6d['query']=_[_0x9bd5('0x5c')](_0x3cf7a6[_0x9bd5('0x46')]);_0x1aec6d[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x1aec6d[_0x9bd5('0x45')],_0x1aec6d[_0x9bd5('0x46')]);_0x420594['attributes']=_['intersection'](_0x1aec6d['model'],qs[_0x9bd5('0x49')](_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x49')]));_0x420594[_0x9bd5('0x48')]=_0x420594['attributes'][_0x9bd5('0x4a')]?_0x420594[_0x9bd5('0x48')]:_0x1aec6d[_0x9bd5('0x45')];if(!_0x3cf7a6['query'][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x420594['limit']=qs[_0x9bd5('0x33')](_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x33')]);_0x420594[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x3cf7a6['query'][_0x9bd5('0x31')]);}_0x420594[_0x9bd5('0x4d')]=qs[_0x9bd5('0x4e')](_0x3cf7a6[_0x9bd5('0x46')]['sort']);_0x420594[_0x9bd5('0x4f')]=qs['filters'](_[_0x9bd5('0x50')](_0x3cf7a6[_0x9bd5('0x46')],_0x1aec6d[_0x9bd5('0x47')]));_0x420594[_0x9bd5('0x4f')][_0x9bd5('0x6b')]=_0x1625d3['id'];if(_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x51')]){_0x420594[_0x9bd5('0x4f')]=_[_0x9bd5('0x52')](_0x420594[_0x9bd5('0x4f')],{'$or':_[_0x9bd5('0x41')](_0x420594[_0x9bd5('0x48')],function(_0x5e0737){var _0x849d={};_0x849d[_0x5e0737]={'$like':'%'+_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x51')]+'%'};return _0x849d;})});}_0x420594=_['merge']({},_0x420594,_0x3cf7a6[_0x9bd5('0x54')]);return db['FaxInteraction'][_0x9bd5('0x34')]({'where':_0x420594[_0x9bd5('0x4f')]})[_0x9bd5('0x22')](function(_0x2d7d32){_0x465fda['count']=_0x2d7d32;if(_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x55')]){_0x420594[_0x9bd5('0x56')]=[{'model':db[_0x9bd5('0x77')],'as':_0x9bd5('0x78'),'required':![]},{'model':db[_0x9bd5('0x79')],'as':_0x9bd5('0x7a'),'attributes':['name',_0x9bd5('0x7b'),_0x9bd5('0x7c')],'required':![]},{'model':db[_0x9bd5('0x7d')],'as':_0x9bd5('0x7e'),'attributes':['id',_0x9bd5('0x3c'),_0x9bd5('0x7f')],'where':_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x80')]?{'id':_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x80')]}:undefined,'required':_0x3cf7a6[_0x9bd5('0x46')][_0x9bd5('0x80')]?!![]:![]}];}return db[_0x9bd5('0x74')][_0x9bd5('0x57')](_0x420594);})['then'](function(_0x1ab38d){_0x465fda[_0x9bd5('0x58')]=_0x1ab38d;return _0x465fda;});}})['then'](respondWithFilteredResult(_0x59b44f,_0x420594))['catch'](handleError(_0x59b44f,null));};exports[_0x9bd5('0x81')]=function(_0x111d6f,_0x4ef308){var _0x4d8db2=_0x111d6f[_0x9bd5('0x5b')]['id'];var _0x22f5c1=_0x111d6f[_0x9bd5('0x61')];var _0x5cf3b8=0xc8;var _0x339432=null;return db[_0x9bd5('0x82')][_0x9bd5('0x83')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x31d8fd){return db['FaxAccount']['findOne']({'where':{'id':_0x4d8db2},'transaction':_0x31d8fd})[_0x9bd5('0x22')](function(_0x2d4bd3){if(_0x2d4bd3){return db[_0x9bd5('0x84')][_0x9bd5('0x39')]({'where':{'FaxAccountId':_0x4d8db2},'transaction':_0x31d8fd})['then'](function(){var _0x1f3a17=_[_0x9bd5('0x41')](_0x22f5c1,function(_0x2cc43b){_0x2cc43b['FaxAccountId']=_0x4d8db2;return _0x2cc43b;});return db[_0x9bd5('0x84')][_0x9bd5('0x85')](_0x1f3a17,{'transaction':_0x31d8fd});});}else{_0x5cf3b8=0x194;_0x339432=[];}});})[_0x9bd5('0x22')](function(){if(_0x5cf3b8!==0x194){return db[_0x9bd5('0x84')][_0x9bd5('0x86')]({'where':{'FaxAccountId':_0x4d8db2},'order':_0x9bd5('0x87')})['then'](function(_0x205b7d){_0x339432=_0x205b7d;});}})['catch'](function(_0x4ffef7){_0x5cf3b8=0x1f4;logger[_0x9bd5('0x29')](_0x4ffef7[_0x9bd5('0x3b')]);if(_0x4ffef7['name']){delete _0x4ffef7['name'];}_0x339432=_0x4ffef7;})[_0x9bd5('0x88')](function(){if(_0x339432===null){_0x4ef308[_0x9bd5('0x2d')](_0x5cf3b8);}else{if(_0x5cf3b8===0x1f4){_0x4ef308['status'](_0x5cf3b8)[_0x9bd5('0x3d')](_0x339432);}else{_0x4ef308['status'](_0x5cf3b8)[_0x9bd5('0x30')](_0x339432);}}});};exports[_0x9bd5('0x89')]=function(_0x40490b,_0x5b5cc4,_0x409958){var _0x2430fb={};var _0x27fb1b={};var _0x4c8160;var _0x39bda9;return db[_0x9bd5('0x42')][_0x9bd5('0x71')]({'where':{'id':_0x40490b[_0x9bd5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5b5cc4,null))['then'](function(_0x2ffea3){if(_0x2ffea3){_0x4c8160=_0x2ffea3;_0x27fb1b['model']=_[_0x9bd5('0x5c')](db[_0x9bd5('0x84')]['rawAttributes']);_0x27fb1b['query']=_[_0x9bd5('0x5c')](_0x40490b[_0x9bd5('0x46')]);_0x27fb1b[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x27fb1b['model'],_0x27fb1b[_0x9bd5('0x46')]);_0x2430fb[_0x9bd5('0x48')]=_[_0x9bd5('0x5e')](_0x27fb1b[_0x9bd5('0x45')],qs[_0x9bd5('0x49')](_0x40490b['query'][_0x9bd5('0x49')]));_0x2430fb['attributes']=_0x2430fb[_0x9bd5('0x48')][_0x9bd5('0x4a')]?_0x2430fb[_0x9bd5('0x48')]:_0x27fb1b[_0x9bd5('0x45')];_0x2430fb[_0x9bd5('0x4d')]=qs[_0x9bd5('0x4e')](_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x4e')]);_0x2430fb[_0x9bd5('0x4f')]=qs[_0x9bd5('0x47')](_[_0x9bd5('0x50')](_0x40490b[_0x9bd5('0x46')],_0x27fb1b[_0x9bd5('0x47')]));if(_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x51')]){_0x2430fb['where']=_[_0x9bd5('0x52')](_0x2430fb['where'],{'$or':_[_0x9bd5('0x41')](_0x2430fb[_0x9bd5('0x48')],function(_0x7c6f70){var _0x4fa642={};_0x4fa642[_0x7c6f70]={'$like':'%'+_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x51')]+'%'};return _0x4fa642;})});}_0x2430fb=_[_0x9bd5('0x52')]({},_0x2430fb,_0x40490b[_0x9bd5('0x54')]);return _0x4c8160['getApplications'](_0x2430fb);}})[_0x9bd5('0x22')](function(_0x552f2a){if(_0x552f2a){_0x39bda9=_0x552f2a['length'];if(!_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x2430fb[_0x9bd5('0x33')]=qs[_0x9bd5('0x33')](_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x33')]);_0x2430fb[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x40490b[_0x9bd5('0x46')][_0x9bd5('0x31')]);}return _0x4c8160[_0x9bd5('0x89')](_0x2430fb);}})[_0x9bd5('0x22')](function(_0x19c0e8){if(_0x19c0e8){return _0x19c0e8?{'count':_0x39bda9,'rows':_0x19c0e8}:null;}})[_0x9bd5('0x22')](respondWithResult(_0x5b5cc4,null))[_0x9bd5('0x59')](handleError(_0x5b5cc4,null));};function Extension(_0x35969f,_0x45f8a2,_0x24750c,_0x116b2d){this[_0x9bd5('0x8a')]=_0x9bd5('0x8b');this[_0x9bd5('0x8c')]=_0x35969f[_0x9bd5('0x8d')];this[_0x9bd5('0x8e')]=_0x116b2d;this[_0x9bd5('0x44')]='system';this[_0x9bd5('0x8f')]='Fax\x20Extension';this[_0x9bd5('0x6b')]=_0x35969f['id'];this[_0x9bd5('0x87')]=_0x45f8a2;this[_0x9bd5('0x90')]=_0x24750c;}function createExtensionsReciveFax(_0x42078e){var _0x1ea0be=0x1;var _0x35d38d=[];_0x35d38d[_0x9bd5('0x91')](new Extension(_0x42078e,_0x1ea0be,'','Answer'));_0x1ea0be+=0x1;_0x35d38d['push'](new Extension(_0x42078e,_0x1ea0be,_0x9bd5('0x92'),'Set'));_0x1ea0be+=0x1;for(var _0x505432 in _0x42078e){if(_0x42078e['hasOwnProperty'](_0x505432)&&(_0x505432===_0x9bd5('0x93')||_0x505432==='localstationid'||_0x505432===_0x9bd5('0x94')||_0x505432===_0x9bd5('0x95')||_0x505432===_0x9bd5('0x96')||_0x505432===_0x9bd5('0x97')||_0x505432===_0x9bd5('0x98')||_0x505432===_0x9bd5('0x99')||_0x505432===_0x9bd5('0x9a'))){_0x35d38d[_0x9bd5('0x91')](new Extension(_0x42078e,_0x1ea0be,_0x9bd5('0x9b')+_0x505432+')='+_0x42078e[_0x505432],'Set'));_0x1ea0be+=0x1;}}_0x35d38d[_0x9bd5('0x91')](new Extension(_0x42078e,_0x1ea0be,'6','Wait'));_0x1ea0be+=0x1;_0x35d38d['push'](new Extension(_0x42078e,_0x1ea0be,_0x9bd5('0x9c'),_0x9bd5('0x9d')));_0x1ea0be=0x0;return _0x35d38d;}exports['addAccountApplications']=function(_0x2b6280,_0x23919c,_0x5d9347){var _0x1f9049;return db[_0x9bd5('0x82')][_0x9bd5('0x83')](function(_0x422c54){return db['FaxAccount'][_0x9bd5('0x60')](_0x2b6280[_0x9bd5('0x61')],{'transaction':_0x422c54})[_0x9bd5('0x22')](function(_0xf6a415){_0x1f9049=_0xf6a415[_0x9bd5('0x3a')]({'plain':!![]});return db['VoiceExtension'][_0x9bd5('0x85')](createExtensionsReciveFax(_0x1f9049),{'transaction':_0x422c54});});})[_0x9bd5('0x22')](function(){return _0x1f9049;})[_0x9bd5('0x22')](respondWithResult(_0x23919c,null))[_0x9bd5('0x59')](handleError(_0x23919c,null));};exports[_0x9bd5('0x9e')]=function(_0x633c65,_0x4a38b4,_0x3cd0b3){var _0xafd47c;return db[_0x9bd5('0x82')]['transaction'](function(_0x420cb2){return db['FaxAccount'][_0x9bd5('0x38')](_0x633c65['body'],{'where':{'id':_0x633c65[_0x9bd5('0x61')]['id']},'transaction':_0x420cb2})['then'](function(_0x4bb601){return db['VoiceExtension'][_0x9bd5('0x39')]({'where':{'FaxAccountId':_0x633c65[_0x9bd5('0x61')]['id']},'transaction':_0x420cb2})[_0x9bd5('0x22')](function(_0x1dece1){return db[_0x9bd5('0x9f')]['bulkCreate'](createExtensionsReciveFax(_[_0x9bd5('0x75')](_0x633c65[_0x9bd5('0x61')],[_0x9bd5('0xa0'),_0x9bd5('0xa1'),_0x9bd5('0xa2'),'updatedAt',_0x9bd5('0xa3'),_0x9bd5('0xa4')])),{'transaction':_0x420cb2});});});})['then'](function(){return db[_0x9bd5('0x42')][_0x9bd5('0xa5')](_0x633c65[_0x9bd5('0x61')]['id']);})[_0x9bd5('0x22')](respondWithResult(_0x4a38b4,null))['catch'](handleError(_0x4a38b4,null));};exports['getMessages']=function(_0x2dd75a,_0x516a94,_0x1a6cf6){var _0x4c4f38={'raw':!![],'where':{}};var _0x4ca397={};var _0x2f08b8={'count':0x0,'rows':[]};return db[_0x9bd5('0x42')]['findOne']({'where':{'id':_0x2dd75a['params']['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x516a94,null))['then'](function(_0x361df2){if(_0x361df2){_0x4ca397[_0x9bd5('0x45')]=_[_0x9bd5('0x5c')](db['FaxMessage'][_0x9bd5('0x5d')]);_0x4ca397[_0x9bd5('0x46')]=_[_0x9bd5('0x5c')](_0x2dd75a[_0x9bd5('0x46')]);_0x4ca397[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x4ca397[_0x9bd5('0x45')],_0x4ca397[_0x9bd5('0x46')]);_0x4c4f38[_0x9bd5('0x48')]=_['intersection'](_0x4ca397['model'],qs[_0x9bd5('0x49')](_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x49')]));_0x4c4f38[_0x9bd5('0x48')]=_0x4c4f38[_0x9bd5('0x48')][_0x9bd5('0x4a')]?_0x4c4f38[_0x9bd5('0x48')]:_0x4ca397[_0x9bd5('0x45')];if(!_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x4c4f38[_0x9bd5('0x33')]=qs['limit'](_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x33')]);_0x4c4f38['offset']=qs[_0x9bd5('0x31')](_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x31')]);}_0x4c4f38[_0x9bd5('0x4d')]=qs['sort'](_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x4e')]);_0x4c4f38['where']=qs[_0x9bd5('0x47')](_[_0x9bd5('0x50')](_0x2dd75a['query'],_0x4ca397[_0x9bd5('0x47')]));_0x4c4f38[_0x9bd5('0x4f')][_0x9bd5('0x6b')]=_0x361df2['id'];if(_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x51')]){_0x4c4f38[_0x9bd5('0x4f')]=_[_0x9bd5('0x52')](_0x4c4f38[_0x9bd5('0x4f')],{'$or':_[_0x9bd5('0x41')](_0x4c4f38[_0x9bd5('0x48')],function(_0x3271ba){var _0x4d90e6={};_0x4d90e6[_0x3271ba]={'$like':'%'+_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0x51')]+'%'};return _0x4d90e6;})});}if(_0x2dd75a[_0x9bd5('0x46')]['$gte']){var _0x3db1a6=_0x2dd75a[_0x9bd5('0x46')][_0x9bd5('0xa6')][_0x9bd5('0xa7')](',');var _0x5d2c41={};_0x5d2c41[_0x3db1a6[0x0]]={'$gte':moment(_0x3db1a6[0x1])[_0x9bd5('0xa8')](_0x9bd5('0xa9'))};_0x4c4f38['where']=_['merge'](_0x4c4f38['where'],_0x5d2c41);}_0x4c4f38=_[_0x9bd5('0x52')]({},_0x4c4f38,_0x2dd75a['options']);return db[_0x9bd5('0xaa')][_0x9bd5('0x34')]({'where':_0x4c4f38[_0x9bd5('0x4f')]})[_0x9bd5('0x22')](function(_0x14a5db){_0x2f08b8[_0x9bd5('0x34')]=_0x14a5db;if(_0x2dd75a[_0x9bd5('0x46')]['includeAll']){_0x4c4f38['include']=[{'all':!![]}];}return db['FaxMessage'][_0x9bd5('0x57')](_0x4c4f38);})[_0x9bd5('0x22')](function(_0x53cd0a){_0x2f08b8[_0x9bd5('0x58')]=_0x53cd0a;return _0x2f08b8;});}})[_0x9bd5('0x22')](respondWithFilteredResult(_0x516a94,_0x4c4f38))[_0x9bd5('0x59')](handleError(_0x516a94,null));};exports[_0x9bd5('0x3d')]=function(_0x1b625d,_0x4ef962,_0x5cbffb){var _0x5e801e,_0x28246a={},_0x2deeda;if(_0x1b625d[_0x9bd5('0x61')]['to']){_0x2deeda=_0x1b625d[_0x9bd5('0x61')]['to'][0x0];}return db['FaxAccount'][_0x9bd5('0x5f')]({'where':{'id':_0x1b625d['params']['id']},'include':[{'model':db[_0x9bd5('0xab')],'as':_0x9bd5('0xac'),'include':[{'model':db[_0x9bd5('0x77')],'as':_0x9bd5('0xad'),'where':{'fax':_0x2deeda},'limit':0x1,'order':[[_0x9bd5('0xae'),_0x9bd5('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x4ef962,null))['then'](function(_0x16da29){_0x5e801e=_0x16da29;if(_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')]&&_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')]['length']){for(var _0x10dba8=0x0;_0x10dba8<_0x1b625d[_0x9bd5('0x61')]['attachments']['length'];_0x10dba8+=0x1){_0x1b625d[_0x9bd5('0x61')]['attachments'][_0x10dba8]={'filename':_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')][_0x10dba8]['name'],'id':_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')][_0x10dba8]['id'],'path':path['join'](config['root'],_0x9bd5('0xb1'),_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')][_0x10dba8][_0x9bd5('0xb2')])};}}return respondWithRpcPromise(_0x9bd5('0xb3'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x1b625d[_0x9bd5('0x5b')]['id'])?undefined:_0x1b625d['params']['id'],'path':_[_0x9bd5('0xb4')](_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')][0x0][_0x9bd5('0x7')])?undefined:_0x1b625d['body'][_0x9bd5('0xb0')][0x0]['path'],'fax':_[_0x9bd5('0xb4')](_0x1b625d[_0x9bd5('0x61')]['to'][0x0])?undefined:_0x1b625d[_0x9bd5('0x61')]['to'][0x0]},client9002);})[_0x9bd5('0x22')](function(){if(_0x5e801e){if(_[_0x9bd5('0xb4')](_0x1b625d['body'][_0x9bd5('0xb5')])){_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb5')]=util['format'](_0x9bd5('0xb6'),_0x5e801e[_0x9bd5('0x3c')],_0x5e801e['fax']);}if(_0x5e801e[_0x9bd5('0xac')]){if(_0x5e801e[_0x9bd5('0xac')][_0x9bd5('0xad')][_0x9bd5('0x4a')]){return _0x5e801e[_0x9bd5('0xac')]['Contacts'][0x0];}else{return db[_0x9bd5('0x77')][_0x9bd5('0x60')](_[_0x9bd5('0x1b')](_0x1b625d[_0x9bd5('0x61')],{'firstName':_0x1b625d[_0x9bd5('0x61')]['to'][0x0],'phone':_0x1b625d[_0x9bd5('0x61')]['to'][0x0],'fax':_0x1b625d[_0x9bd5('0x61')]['to'][0x0],'ListId':_0x5e801e[_0x9bd5('0xa4')]}));}}else{throw new Error(_0x9bd5('0xb7'));}}else{throw new Error(_0x9bd5('0xb8'));}})[_0x9bd5('0x22')](function(_0x469ddb){if(_0x469ddb){return db[_0x9bd5('0x74')][_0x9bd5('0x5f')]({'where':{'ContactId':_0x469ddb['id'],'closed':![],'FaxAccountId':_0x5e801e['id']}})[_0x9bd5('0x22')](function(_0xb5f7eb){if(_0xb5f7eb){return[_0xb5f7eb,![]];}return db[_0x9bd5('0x74')]['create']({'UserId':_0x1b625d[_0x9bd5('0x62')]['id'],'ContactId':_0x469ddb['id'],'FaxAccountId':_0x5e801e['id'],'fax':_0x1b625d[_0x9bd5('0x61')]['to'][0x0],'firstMsgDirection':_0x9bd5('0xb9'),'Messages':[_[_0x9bd5('0x52')](_0x1b625d[_0x9bd5('0x61')],{'read':![],'body':_0x1b625d[_0x9bd5('0x61')]['attachments'][0x0][_0x9bd5('0xba')],'FaxAccountId':_0x5e801e['id'],'UserId':_0x1b625d[_0x9bd5('0x62')]['id'],'ContactId':_0x469ddb['id'],'AttachmentId':_0x1b625d['body'][_0x9bd5('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0x9bd5('0xaa')],'as':_0x9bd5('0xbb')}]})[_0x9bd5('0x22')](function(_0x1858f1){return[_0x1858f1,!![]];});});}else{throw new Error(_0x9bd5('0xbc'));}})[_0x9bd5('0xbd')](function(_0x5a1698,_0x3422e6){if(_0x3422e6){return _0x5a1698;}return db[_0x9bd5('0xaa')]['create']({'direction':_0x9bd5('0xb9'),'read':![],'body':_0x1b625d['body'][_0x9bd5('0xb0')][0x0]['filename'],'FaxAccountId':_0x5e801e['id'],'FaxInteractionId':_0x5a1698['id'],'UserId':_0x1b625d['user']['id'],'ContactId':_0x5a1698[_0x9bd5('0xbe')],'AttachmentId':_0x1b625d['body']['attachments'][0x0]['id']})[_0x9bd5('0x22')](function(_0x38dcd4){_0x5a1698[_0x9bd5('0xbf')][_0x9bd5('0xbb')]=[];_0x5a1698[_0x9bd5('0xbf')][_0x9bd5('0xbb')][_0x9bd5('0x91')](_0x38dcd4['dataValues']);return _0x5a1698;});})[_0x9bd5('0x22')](function(_0x5656f2){respondWithRpcPromise(_0x9bd5('0xc0'),'SendFax',{'FaxAccountId':_['isNil'](_0x1b625d[_0x9bd5('0x5b')]['id'])?undefined:_0x1b625d[_0x9bd5('0x5b')]['id'],'path':_[_0x9bd5('0xb4')](_0x1b625d['body'][_0x9bd5('0xb0')][0x0]['path'])?undefined:_0x1b625d[_0x9bd5('0x61')][_0x9bd5('0xb0')][0x0][_0x9bd5('0x7')],'fax':_[_0x9bd5('0xb4')](_0x1b625d[_0x9bd5('0x61')]['to'][0x0])?undefined:_0x1b625d[_0x9bd5('0x61')]['to'][0x0],'AttachmentId':_0x1b625d['body'][_0x9bd5('0xb0')][0x0]['id']},client9002)[_0x9bd5('0x22')](function(_0x587be7){logger['info']('SendFaxRpc,\x20%s',_0x587be7);})[_0x9bd5('0x59')](function(_0x1582bf){logger[_0x9bd5('0x23')]('SendFaxRpc,\x20%s',_0x1582bf);});return _0x5656f2;})[_0x9bd5('0x22')](respondWithResult(_0x4ef962,null))[_0x9bd5('0x59')](handleError(_0x4ef962,null));};exports[_0x9bd5('0xc1')]=function(_0x3d38be,_0x24ce73,_0x394bd3){return db['FaxAccount'][_0x9bd5('0x5f')]({'where':{'id':_0x3d38be[_0x9bd5('0x5b')]['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x24ce73,null))[_0x9bd5('0x22')](function(_0x1425ff){if(_0x1425ff){return _0x1425ff[_0x9bd5('0xc1')](_0x3d38be[_0x9bd5('0x61')][_0x9bd5('0x6f')],_['omit'](_0x3d38be[_0x9bd5('0x61')],['ids','id'])||{})[_0x9bd5('0xbd')](function(_0x552af3){for(var _0x4bb98a=0x0;_0x4bb98a<_0x3d38be[_0x9bd5('0x61')][_0x9bd5('0x6f')]['length'];_0x4bb98a+=0x1){socket['emit'](_0x9bd5('0xc2'),{'UserId':Number(_0x3d38be[_0x9bd5('0x61')]['ids'][_0x4bb98a]),'FaxAccountId':Number(_0x3d38be[_0x9bd5('0x5b')]['id'])});}return _0x552af3;});}})[_0x9bd5('0x22')](respondWithResult(_0x24ce73,null))['catch'](handleError(_0x24ce73,null));};exports[_0x9bd5('0xc3')]=function(_0x13d4ee,_0x1bf4de,_0x53ff28){return db[_0x9bd5('0x42')][_0x9bd5('0x5f')]({'where':{'id':_0x13d4ee['params']['id']}})['then'](handleEntityNotFound(_0x1bf4de,null))[_0x9bd5('0x22')](function(_0x39836f){if(_0x39836f){return _0x39836f[_0x9bd5('0xc3')](_0x13d4ee['query']['ids'])[_0x9bd5('0x22')](function(){if(_[_0x9bd5('0xc4')](_0x13d4ee['query']['ids'])){for(var _0x41743a=0x0;_0x41743a<_0x13d4ee[_0x9bd5('0x46')][_0x9bd5('0x6f')][_0x9bd5('0x4a')];_0x41743a+=0x1){socket['emit'](_0x9bd5('0xc5'),{'UserId':Number(_0x13d4ee['query']['ids'][_0x41743a]),'FaxAccountId':Number(_0x13d4ee[_0x9bd5('0x5b')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x13d4ee['query'][_0x9bd5('0x6f')]),'FaxAccountId':Number(_0x13d4ee[_0x9bd5('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1bf4de,null))[_0x9bd5('0x59')](handleError(_0x1bf4de,null));};exports[_0x9bd5('0xc6')]=function(_0x1854cb,_0x1ce249,_0x50941c){var _0x1f16b7={};var _0x39416e={};var _0x5e9a22;var _0x50c541;return db['FaxAccount'][_0x9bd5('0x71')]({'where':{'id':_0x1854cb[_0x9bd5('0x5b')]['id']}})[_0x9bd5('0x22')](handleEntityNotFound(_0x1ce249,null))['then'](function(_0x26330c){if(_0x26330c){_0x5e9a22=_0x26330c;_0x39416e['model']=_['keys'](db['User'][_0x9bd5('0x5d')]);_0x39416e[_0x9bd5('0x46')]=_['keys'](_0x1854cb[_0x9bd5('0x46')]);_0x39416e[_0x9bd5('0x47')]=_[_0x9bd5('0x5e')](_0x39416e[_0x9bd5('0x45')],_0x39416e[_0x9bd5('0x46')]);_0x1f16b7[_0x9bd5('0x48')]=_[_0x9bd5('0x5e')](_0x39416e['model'],qs[_0x9bd5('0x49')](_0x1854cb[_0x9bd5('0x46')][_0x9bd5('0x49')]));_0x1f16b7[_0x9bd5('0x48')]=_0x1f16b7['attributes']['length']?_0x1f16b7[_0x9bd5('0x48')]:_0x39416e[_0x9bd5('0x45')];_0x1f16b7[_0x9bd5('0x4d')]=qs['sort'](_0x1854cb['query'][_0x9bd5('0x4e')]);_0x1f16b7[_0x9bd5('0x4f')]=qs['filters'](_['pick'](_0x1854cb[_0x9bd5('0x46')],_0x39416e[_0x9bd5('0x47')]));if(_0x1854cb['query'][_0x9bd5('0x51')]){_0x1f16b7['where']=_[_0x9bd5('0x52')](_0x1f16b7[_0x9bd5('0x4f')],{'$or':_['map'](_0x1f16b7[_0x9bd5('0x48')],function(_0x17d775){var _0x48e1ac={};_0x48e1ac[_0x17d775]={'$like':'%'+_0x1854cb[_0x9bd5('0x46')]['filter']+'%'};return _0x48e1ac;})});}_0x1f16b7=_[_0x9bd5('0x52')]({},_0x1f16b7,_0x1854cb[_0x9bd5('0x54')]);return _0x5e9a22[_0x9bd5('0xc6')](_0x1f16b7);}})[_0x9bd5('0x22')](function(_0x16b696){if(_0x16b696){_0x50c541=_0x16b696[_0x9bd5('0x4a')];if(!_0x1854cb['query'][_0x9bd5('0x4b')](_0x9bd5('0x4c'))){_0x1f16b7['limit']=qs[_0x9bd5('0x33')](_0x1854cb[_0x9bd5('0x46')]['limit']);_0x1f16b7[_0x9bd5('0x31')]=qs[_0x9bd5('0x31')](_0x1854cb[_0x9bd5('0x46')][_0x9bd5('0x31')]);}return _0x5e9a22['getAgents'](_0x1f16b7);}})[_0x9bd5('0x22')](function(_0x40e216){if(_0x40e216){return _0x40e216?{'count':_0x50c541,'rows':_0x40e216}:null;}})[_0x9bd5('0x22')](respondWithResult(_0x1ce249,null))[_0x9bd5('0x59')](handleError(_0x1ce249,null));}; \ No newline at end of file +var _0x46c9=['filter','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','addAnswer','FaxAccountId','CannedAnswer','getAnswers','rows','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','ecm','localstationid','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Set','Wait','updateAccountApplications','VoiceExtension','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','attachments','root','basename','CheckAfterSend','isNil','path','from','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick'];(function(_0x3c2b57,_0x3c818b){var _0x314adf=function(_0x54118b){while(--_0x54118b){_0x3c2b57['push'](_0x3c2b57['shift']());}};_0x314adf(++_0x3c818b);}(_0x46c9,0x72));var _0x946c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x46c9[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x946c('0x0'));var rimraf=require(_0x946c('0x1'));var zipdir=require(_0x946c('0x2'));var jsonpatch=require(_0x946c('0x3'));var rp=require(_0x946c('0x4'));var moment=require(_0x946c('0x5'));var BPromise=require(_0x946c('0x6'));var Mustache=require(_0x946c('0x7'));var util=require(_0x946c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x946c('0x9'));var ejs=require(_0x946c('0xa'));var fs=require('fs');var fs_extra=require(_0x946c('0xb'));var _=require(_0x946c('0xc'));var squel=require(_0x946c('0xd'));var crypto=require(_0x946c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x946c('0xf'));var toCsv=require(_0x946c('0x9'));var querystring=require(_0x946c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x946c('0x11'));var qs=require(_0x946c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x946c('0x13'))('api');var utils=require(_0x946c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x946c('0x15'));var db=require(_0x946c('0x16'))['db'];config['redis']=_['defaults'](config[_0x946c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x946c('0x18'))(new Redis(config[_0x946c('0x17')]));require('./faxAccount.socket')[_0x946c('0x19')](socket);var jayson=require(_0x946c('0x1a'));var client=jayson[_0x946c('0x1b')][_0x946c('0x1c')]({'port':0x232c});var client9002=jayson[_0x946c('0x1b')][_0x946c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x311f5d,_0x351994,_0x382823,_0x1e58f7){return new BPromise(function(_0x111df4,_0x58f069){var _0x12dbb5=_0x1e58f7||client;return _0x12dbb5[_0x946c('0x1d')](_0x311f5d,_0x382823)[_0x946c('0x1e')](function(_0x1186b9){logger[_0x946c('0x1f')](_0x946c('0x20'),_0x351994,_0x946c('0x21'));logger[_0x946c('0x22')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x351994,'request\x20sent',JSON['stringify'](_0x1186b9));if(_0x1186b9['error']){if(_0x1186b9[_0x946c('0x23')][_0x946c('0x24')]===0x1f4){logger[_0x946c('0x23')](_0x946c('0x20'),_0x351994,_0x1186b9[_0x946c('0x23')]['message']);return _0x58f069(_0x1186b9[_0x946c('0x23')][_0x946c('0x25')]);}logger[_0x946c('0x23')](_0x946c('0x20'),_0x351994,_0x1186b9[_0x946c('0x23')][_0x946c('0x25')]);return _0x111df4(_0x1186b9[_0x946c('0x23')][_0x946c('0x25')]);}else{logger[_0x946c('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x351994,_0x946c('0x21'));_0x111df4(_0x1186b9[_0x946c('0x26')]['message']);}})['catch'](function(_0x5473b4){logger[_0x946c('0x23')]('FaxAccount,\x20%s,\x20%s',_0x351994,_0x5473b4);_0x58f069(_0x5473b4);});});}function respondWithStatusCode(_0x49b558,_0x4e1195){_0x4e1195=_0x4e1195||0xcc;return function(_0x36fd2e){if(_0x36fd2e){return _0x49b558[_0x946c('0x27')](_0x4e1195);}return _0x49b558[_0x946c('0x28')](_0x4e1195)[_0x946c('0x29')]();};}function respondWithResult(_0x27f0fb,_0xbf164c){_0xbf164c=_0xbf164c||0xc8;return function(_0x2248dd){if(_0x2248dd){return _0x27f0fb[_0x946c('0x28')](_0xbf164c)[_0x946c('0x2a')](_0x2248dd);}};}function respondWithFilteredResult(_0x23ac64,_0x223f4f){return function(_0x111ae6){if(_0x111ae6){var _0x883751=typeof _0x223f4f[_0x946c('0x2b')]==='undefined'&&typeof _0x223f4f[_0x946c('0x2c')]===_0x946c('0x2d');var _0x361abf=_0x111ae6['count'];var _0x47b43b=_0x883751?0x0:_0x223f4f[_0x946c('0x2b')];var _0x4ddc2c=_0x883751?_0x111ae6[_0x946c('0x2e')]:_0x223f4f[_0x946c('0x2b')]+_0x223f4f[_0x946c('0x2c')];var _0x555773;if(_0x4ddc2c>=_0x361abf){_0x4ddc2c=_0x361abf;_0x555773=0xc8;}else{_0x555773=0xce;}_0x23ac64[_0x946c('0x28')](_0x555773);return _0x23ac64['set']('Content-Range',_0x47b43b+'-'+_0x4ddc2c+'/'+_0x361abf)[_0x946c('0x2a')](_0x111ae6);}return null;};}function patchUpdates(_0x42c88b){return function(_0x7c552e){try{jsonpatch[_0x946c('0x2f')](_0x7c552e,_0x42c88b,!![]);}catch(_0x6b4561){return BPromise[_0x946c('0x30')](_0x6b4561);}return _0x7c552e[_0x946c('0x31')]();};}function saveUpdates(_0x11f636,_0x5498b7){return function(_0x37141c){if(_0x37141c){return _0x37141c[_0x946c('0x32')](_0x11f636)['then'](function(_0xf504a7){return _0xf504a7;});}return null;};}function removeEntity(_0x54c814,_0x3add41){return function(_0x6c813d){if(_0x6c813d){return _0x6c813d[_0x946c('0x33')]()[_0x946c('0x1e')](function(){var _0x434c83=_0x6c813d[_0x946c('0x34')]({'plain':!![]});var _0x5ebff0=_0x946c('0x35');return db[_0x946c('0x36')]['destroy']({'where':{'type':_0x5ebff0,'resourceId':_0x434c83['id']}})['then'](function(){return _0x6c813d;});})[_0x946c('0x1e')](function(){_0x54c814['status'](0xcc)[_0x946c('0x29')]();});}};}function handleEntityNotFound(_0x25e8af,_0x2fde4c){return function(_0x19bc4c){if(!_0x19bc4c){_0x25e8af['sendStatus'](0x194);}return _0x19bc4c;};}function handleError(_0x2736fa,_0x81bedc){_0x81bedc=_0x81bedc||0x1f4;return function(_0x21c42b){logger[_0x946c('0x23')](_0x21c42b[_0x946c('0x37')]);if(_0x21c42b['name']){delete _0x21c42b[_0x946c('0x38')];}_0x2736fa[_0x946c('0x28')](_0x81bedc)[_0x946c('0x39')](_0x21c42b);};}exports[_0x946c('0x3a')]=function(_0xc73d08,_0x7bd911){var _0x30c728={'include':[{'model':db[_0x946c('0x3b')],'as':_0x946c('0x3c')}]},_0x1e36e0={},_0x13a72a={'count':0x0,'rows':[]};var _0xe064c8=_[_0x946c('0x3d')](db[_0x946c('0x3e')]['rawAttributes'],function(_0x2f37be){return{'name':_0x2f37be[_0x946c('0x3f')],'type':_0x2f37be[_0x946c('0x40')][_0x946c('0x41')]};});_0x1e36e0[_0x946c('0x42')]=_[_0x946c('0x3d')](_0xe064c8,'name');_0x1e36e0[_0x946c('0x43')]=_[_0x946c('0x44')](_0xc73d08['query']);_0x1e36e0['filters']=_[_0x946c('0x45')](_0x1e36e0[_0x946c('0x42')],_0x1e36e0[_0x946c('0x43')]);_0x30c728[_0x946c('0x46')]=_[_0x946c('0x45')](_0x1e36e0[_0x946c('0x42')],qs[_0x946c('0x47')](_0xc73d08['query'][_0x946c('0x47')]));_0x30c728[_0x946c('0x46')]=_0x30c728[_0x946c('0x46')][_0x946c('0x48')]?_0x30c728['attributes']:_0x1e36e0['model'];if(!_0xc73d08[_0x946c('0x43')]['hasOwnProperty'](_0x946c('0x49'))){_0x30c728[_0x946c('0x2c')]=qs[_0x946c('0x2c')](_0xc73d08[_0x946c('0x43')][_0x946c('0x2c')]);_0x30c728[_0x946c('0x2b')]=qs[_0x946c('0x2b')](_0xc73d08[_0x946c('0x43')][_0x946c('0x2b')]);}_0x30c728[_0x946c('0x4a')]=qs[_0x946c('0x4b')](_0xc73d08['query'][_0x946c('0x4b')]);_0x30c728[_0x946c('0x4c')]=qs[_0x946c('0x4d')](_[_0x946c('0x4e')](_0xc73d08[_0x946c('0x43')],_0x1e36e0[_0x946c('0x4d')]),_0xe064c8);if(_0xc73d08[_0x946c('0x43')][_0x946c('0x4f')]){_0x30c728[_0x946c('0x4c')]=_[_0x946c('0x50')](_0x30c728[_0x946c('0x4c')],{'$or':_[_0x946c('0x3d')](_0xe064c8,function(_0xd3cefa){if(_0xd3cefa[_0x946c('0x40')]!==_0x946c('0x51')){var _0x29ed41={};_0x29ed41[_0xd3cefa[_0x946c('0x38')]]={'$like':'%'+_0xc73d08[_0x946c('0x43')][_0x946c('0x4f')]+'%'};return _0x29ed41;}})});}_0x30c728=_[_0x946c('0x50')]({},_0x30c728,_0xc73d08[_0x946c('0x52')]);var _0x207282={'where':_0x30c728['where']};return db[_0x946c('0x3e')][_0x946c('0x2e')](_0x207282)[_0x946c('0x1e')](function(_0xc484ea){_0x13a72a[_0x946c('0x2e')]=_0xc484ea;if(_0xc73d08['query']['includeAll']){_0x30c728[_0x946c('0x53')]=[{'all':!![]}];}return db[_0x946c('0x3e')][_0x946c('0x54')](_0x30c728);})['then'](function(_0x279611){_0x13a72a['rows']=_0x279611;return _0x13a72a;})[_0x946c('0x1e')](respondWithFilteredResult(_0x7bd911,_0x30c728))[_0x946c('0x55')](handleError(_0x7bd911,null));};exports[_0x946c('0x56')]=function(_0x4db959,_0x539089){var _0x5d041f={'raw':![],'where':{'id':_0x4db959['params']['id']},'include':[{'model':db[_0x946c('0x3b')],'as':_0x946c('0x3c')}]},_0x24e565={};_0x24e565['model']=_[_0x946c('0x44')](db['FaxAccount'][_0x946c('0x57')]);_0x24e565[_0x946c('0x43')]=_[_0x946c('0x44')](_0x4db959[_0x946c('0x43')]);_0x24e565[_0x946c('0x4d')]=_[_0x946c('0x45')](_0x24e565[_0x946c('0x42')],_0x24e565[_0x946c('0x43')]);_0x5d041f[_0x946c('0x46')]=_[_0x946c('0x45')](_0x24e565[_0x946c('0x42')],qs[_0x946c('0x47')](_0x4db959['query'][_0x946c('0x47')]));_0x5d041f['attributes']=_0x5d041f[_0x946c('0x46')][_0x946c('0x48')]?_0x5d041f[_0x946c('0x46')]:_0x24e565[_0x946c('0x42')];if(_0x4db959[_0x946c('0x43')][_0x946c('0x58')]){_0x5d041f[_0x946c('0x53')]=[{'all':!![]}];}_0x5d041f=_['merge']({},_0x5d041f,_0x4db959[_0x946c('0x52')]);return db[_0x946c('0x3e')][_0x946c('0x59')](_0x5d041f)[_0x946c('0x1e')](handleEntityNotFound(_0x539089,null))[_0x946c('0x1e')](respondWithResult(_0x539089,null))[_0x946c('0x55')](handleError(_0x539089,null));};exports[_0x946c('0x5a')]=function(_0x122b79,_0x473ecf){return db[_0x946c('0x3e')][_0x946c('0x5a')](_0x122b79[_0x946c('0x5b')],{})[_0x946c('0x1e')](function(_0x2df44e){var _0x29d1da=_0x122b79['user'][_0x946c('0x34')]({'plain':!![]});if(!_0x29d1da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29d1da[_0x946c('0x5c')]===_0x946c('0x5d')){var _0x25aaf8=_0x2df44e[_0x946c('0x34')]({'plain':!![]});var _0x5a7fcb='FaxAccounts';return db[_0x946c('0x5e')][_0x946c('0x59')]({'where':{'name':_0x5a7fcb,'userProfileId':_0x29d1da[_0x946c('0x5f')]},'raw':!![]})[_0x946c('0x1e')](function(_0x130648){if(_0x130648&&_0x130648['autoAssociation']===0x0){return db[_0x946c('0x36')][_0x946c('0x5a')]({'name':_0x25aaf8[_0x946c('0x38')],'resourceId':_0x25aaf8['id'],'type':_0x130648['name'],'sectionId':_0x130648['id']},{})[_0x946c('0x1e')](function(){return _0x2df44e;});}else{return _0x2df44e;}})[_0x946c('0x55')](function(_0x597086){logger[_0x946c('0x23')](_0x946c('0x60'),_0x597086);throw _0x597086;});}return _0x2df44e;})[_0x946c('0x1e')](respondWithResult(_0x473ecf,0xc9))['catch'](handleError(_0x473ecf,null));};exports[_0x946c('0x32')]=function(_0x372e6c,_0x5e9fad){if(_0x372e6c[_0x946c('0x5b')]['id']){delete _0x372e6c[_0x946c('0x5b')]['id'];}return db[_0x946c('0x3e')][_0x946c('0x59')]({'where':{'id':_0x372e6c['params']['id']},'include':[{'model':db[_0x946c('0x3b')],'as':_0x946c('0x3c')}]})[_0x946c('0x1e')](handleEntityNotFound(_0x5e9fad,null))['then'](saveUpdates(_0x372e6c[_0x946c('0x5b')],null))[_0x946c('0x1e')](respondWithResult(_0x5e9fad,null))[_0x946c('0x55')](handleError(_0x5e9fad,null));};exports[_0x946c('0x33')]=function(_0x416f98,_0x1877be){return db[_0x946c('0x3e')][_0x946c('0x59')]({'where':{'id':_0x416f98[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x1877be,null))[_0x946c('0x1e')](removeEntity(_0x1877be,null))['catch'](handleError(_0x1877be,null));};exports[_0x946c('0x62')]=function(_0x3bed19,_0x57591d){return db[_0x946c('0x3e')]['describe']()['then'](respondWithResult(_0x57591d,null))['catch'](handleError(_0x57591d,null));};exports[_0x946c('0x63')]=function(_0x251bf2,_0x217045,_0x18a747){if(_0x251bf2[_0x946c('0x5b')]['id']){delete _0x251bf2[_0x946c('0x5b')]['id'];}return db[_0x946c('0x3e')][_0x946c('0x59')]({'where':{'id':_0x251bf2['params']['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x217045,null))[_0x946c('0x1e')](function(_0x2abc64){if(_0x2abc64){_0x251bf2[_0x946c('0x5b')]['FaxAccountId']=_0x2abc64['id'];return db['Disposition'][_0x946c('0x5a')](_0x251bf2[_0x946c('0x5b')]);}})[_0x946c('0x1e')](respondWithResult(_0x217045,null))['catch'](handleError(_0x217045,null));};exports[_0x946c('0x64')]=function(_0x464854,_0x3e1954,_0x5b8fb0){var _0x56cf56={'raw':![],'where':{}};var _0x454003={};var _0xad4341={'count':0x0,'rows':[]};return db[_0x946c('0x3e')][_0x946c('0x65')]({'where':{'id':_0x464854[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x3e1954,null))[_0x946c('0x1e')](function(_0xd9429f){if(_0xd9429f){_0x454003[_0x946c('0x42')]=_['keys'](db[_0x946c('0x66')][_0x946c('0x57')]);_0x454003['query']=_[_0x946c('0x44')](_0x464854['query']);_0x454003['filters']=_[_0x946c('0x45')](_0x454003[_0x946c('0x42')],_0x454003['query']);_0x56cf56[_0x946c('0x46')]=_['intersection'](_0x454003[_0x946c('0x42')],qs['fields'](_0x464854['query']['fields']));_0x56cf56[_0x946c('0x46')]=_0x56cf56[_0x946c('0x46')][_0x946c('0x48')]?_0x56cf56[_0x946c('0x46')]:_0x454003[_0x946c('0x42')];if(!_0x464854[_0x946c('0x43')][_0x946c('0x67')]('nolimit')){_0x56cf56['limit']=qs['limit'](_0x464854[_0x946c('0x43')][_0x946c('0x2c')]);_0x56cf56[_0x946c('0x2b')]=qs[_0x946c('0x2b')](_0x464854[_0x946c('0x43')][_0x946c('0x2b')]);}_0x56cf56['order']=qs['sort'](_0x464854[_0x946c('0x43')]['sort']);_0x56cf56[_0x946c('0x4c')]=qs[_0x946c('0x4d')](_[_0x946c('0x4e')](_0x464854['query'],_0x454003[_0x946c('0x4d')]));_0x56cf56[_0x946c('0x4c')]['FaxAccountId']=_0xd9429f['id'];if(_0x464854[_0x946c('0x43')][_0x946c('0x4f')]){_0x56cf56[_0x946c('0x4c')]=_[_0x946c('0x50')](_0x56cf56['where'],{'$or':_[_0x946c('0x3d')](_0x56cf56[_0x946c('0x46')],function(_0x326d9c){var _0x5ed2da={};_0x5ed2da[_0x326d9c]={'$like':'%'+_0x464854[_0x946c('0x43')]['filter']+'%'};return _0x5ed2da;})});}_0x56cf56=_[_0x946c('0x50')]({},_0x56cf56,_0x464854[_0x946c('0x52')]);return db['Disposition']['count']({'where':_0x56cf56[_0x946c('0x4c')]})[_0x946c('0x1e')](function(_0x2a811b){_0xad4341[_0x946c('0x2e')]=_0x2a811b;if(_0x464854[_0x946c('0x43')][_0x946c('0x58')]){_0x56cf56[_0x946c('0x53')]=[{'all':!![]}];}return db[_0x946c('0x66')][_0x946c('0x54')](_0x56cf56);})['then'](function(_0x3aec52){_0xad4341['rows']=_0x3aec52;return _0xad4341;});}})[_0x946c('0x1e')](respondWithFilteredResult(_0x3e1954,_0x56cf56))[_0x946c('0x55')](handleError(_0x3e1954,null));};exports['removeDispositions']=function(_0x45a3ab,_0x4c804d,_0x13760d){return db[_0x946c('0x3e')][_0x946c('0x59')]({'where':{'id':_0x45a3ab[_0x946c('0x61')]['id']}})['then'](handleEntityNotFound(_0x4c804d,null))[_0x946c('0x1e')](function(_0x216f9e){if(_0x216f9e){return _0x216f9e['removeDispositions'](_0x45a3ab[_0x946c('0x43')]['ids']);}})[_0x946c('0x1e')](respondWithStatusCode(_0x4c804d,null))[_0x946c('0x55')](handleError(_0x4c804d,null));};exports[_0x946c('0x68')]=function(_0x338cf7,_0x54f3e0,_0x7055a7){if(_0x338cf7[_0x946c('0x5b')]['id']){delete _0x338cf7[_0x946c('0x5b')]['id'];}return db['FaxAccount'][_0x946c('0x59')]({'where':{'id':_0x338cf7[_0x946c('0x61')]['id']}})['then'](handleEntityNotFound(_0x54f3e0,null))['then'](function(_0x225176){if(_0x225176){_0x338cf7[_0x946c('0x5b')][_0x946c('0x69')]=_0x225176['id'];return db[_0x946c('0x6a')][_0x946c('0x5a')](_0x338cf7[_0x946c('0x5b')]);}})[_0x946c('0x1e')](respondWithResult(_0x54f3e0,null))[_0x946c('0x55')](handleError(_0x54f3e0,null));};exports[_0x946c('0x6b')]=function(_0xe68c63,_0x47f911,_0x197eeb){var _0x1f84b2={'raw':![],'where':{}};var _0x34a739={};var _0x5bd455={'count':0x0,'rows':[]};return db[_0x946c('0x3e')][_0x946c('0x65')]({'where':{'id':_0xe68c63[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x47f911,null))[_0x946c('0x1e')](function(_0x146bf1){if(_0x146bf1){_0x34a739[_0x946c('0x42')]=_[_0x946c('0x44')](db[_0x946c('0x6a')][_0x946c('0x57')]);_0x34a739[_0x946c('0x43')]=_['keys'](_0xe68c63[_0x946c('0x43')]);_0x34a739['filters']=_[_0x946c('0x45')](_0x34a739[_0x946c('0x42')],_0x34a739[_0x946c('0x43')]);_0x1f84b2[_0x946c('0x46')]=_['intersection'](_0x34a739[_0x946c('0x42')],qs[_0x946c('0x47')](_0xe68c63['query'][_0x946c('0x47')]));_0x1f84b2[_0x946c('0x46')]=_0x1f84b2['attributes']['length']?_0x1f84b2['attributes']:_0x34a739[_0x946c('0x42')];if(!_0xe68c63[_0x946c('0x43')]['hasOwnProperty'](_0x946c('0x49'))){_0x1f84b2['limit']=qs[_0x946c('0x2c')](_0xe68c63['query'][_0x946c('0x2c')]);_0x1f84b2[_0x946c('0x2b')]=qs['offset'](_0xe68c63[_0x946c('0x43')]['offset']);}_0x1f84b2[_0x946c('0x4a')]=qs[_0x946c('0x4b')](_0xe68c63['query'][_0x946c('0x4b')]);_0x1f84b2[_0x946c('0x4c')]=qs[_0x946c('0x4d')](_[_0x946c('0x4e')](_0xe68c63[_0x946c('0x43')],_0x34a739['filters']));_0x1f84b2[_0x946c('0x4c')][_0x946c('0x69')]=_0x146bf1['id'];if(_0xe68c63[_0x946c('0x43')]['filter']){_0x1f84b2[_0x946c('0x4c')]=_[_0x946c('0x50')](_0x1f84b2[_0x946c('0x4c')],{'$or':_[_0x946c('0x3d')](_0x1f84b2['attributes'],function(_0x30a5b7){var _0x4c0814={};_0x4c0814[_0x30a5b7]={'$like':'%'+_0xe68c63[_0x946c('0x43')][_0x946c('0x4f')]+'%'};return _0x4c0814;})});}_0x1f84b2=_[_0x946c('0x50')]({},_0x1f84b2,_0xe68c63[_0x946c('0x52')]);return db['CannedAnswer'][_0x946c('0x2e')]({'where':_0x1f84b2[_0x946c('0x4c')]})[_0x946c('0x1e')](function(_0x5ef021){_0x5bd455[_0x946c('0x2e')]=_0x5ef021;if(_0xe68c63[_0x946c('0x43')]['includeAll']){_0x1f84b2['include']=[{'all':!![]}];}return db[_0x946c('0x6a')][_0x946c('0x54')](_0x1f84b2);})[_0x946c('0x1e')](function(_0x1fa9d3){_0x5bd455[_0x946c('0x6c')]=_0x1fa9d3;return _0x5bd455;});}})[_0x946c('0x1e')](respondWithFilteredResult(_0x47f911,_0x1f84b2))['catch'](handleError(_0x47f911,null));};exports[_0x946c('0x6d')]=function(_0x5ac20e,_0x650d6e,_0x5be4e4){return db['FaxAccount'][_0x946c('0x59')]({'where':{'id':_0x5ac20e['params']['id']}})['then'](handleEntityNotFound(_0x650d6e,null))[_0x946c('0x1e')](function(_0x2f62f5){if(_0x2f62f5){return _0x2f62f5[_0x946c('0x6d')](_0x5ac20e[_0x946c('0x43')][_0x946c('0x6e')]);}})[_0x946c('0x1e')](respondWithStatusCode(_0x650d6e,null))[_0x946c('0x55')](handleError(_0x650d6e,null));};exports[_0x946c('0x6f')]=function(_0x3b885a,_0x18f591,_0x5c3bfe){return db[_0x946c('0x70')][_0x946c('0x59')]({'where':{'id':_0x3b885a[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x18f591,null))[_0x946c('0x1e')](function(_0x27b0f2){if(_0x27b0f2){return _0x27b0f2[_0x946c('0x6f')](_0x3b885a[_0x946c('0x5b')][_0x946c('0x6e')],_[_0x946c('0x71')](_0x3b885a[_0x946c('0x5b')],[_0x946c('0x6e'),'id'])||{});}})[_0x946c('0x1e')](respondWithResult(_0x18f591,null))[_0x946c('0x55')](handleError(_0x18f591,null));};exports[_0x946c('0x72')]=function(_0x3d334e,_0x125628,_0x5c0e09){var _0x1eac11={'raw':![],'where':{}};var _0xd6f1f8={};var _0x19c421={'count':0x0,'rows':[]};return db[_0x946c('0x3e')][_0x946c('0x65')]({'where':{'id':_0x3d334e[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x125628,null))['then'](function(_0x4dc4ce){if(_0x4dc4ce){_0xd6f1f8['model']=_[_0x946c('0x44')](db['FaxInteraction'][_0x946c('0x57')]);_0xd6f1f8[_0x946c('0x43')]=_[_0x946c('0x44')](_0x3d334e[_0x946c('0x43')]);_0xd6f1f8[_0x946c('0x4d')]=_[_0x946c('0x45')](_0xd6f1f8[_0x946c('0x42')],_0xd6f1f8['query']);_0x1eac11[_0x946c('0x46')]=_[_0x946c('0x45')](_0xd6f1f8['model'],qs[_0x946c('0x47')](_0x3d334e['query'][_0x946c('0x47')]));_0x1eac11[_0x946c('0x46')]=_0x1eac11[_0x946c('0x46')]['length']?_0x1eac11[_0x946c('0x46')]:_0xd6f1f8[_0x946c('0x42')];if(!_0x3d334e[_0x946c('0x43')][_0x946c('0x67')](_0x946c('0x49'))){_0x1eac11['limit']=qs[_0x946c('0x2c')](_0x3d334e[_0x946c('0x43')][_0x946c('0x2c')]);_0x1eac11[_0x946c('0x2b')]=qs[_0x946c('0x2b')](_0x3d334e[_0x946c('0x43')][_0x946c('0x2b')]);}_0x1eac11[_0x946c('0x4a')]=qs[_0x946c('0x4b')](_0x3d334e['query']['sort']);_0x1eac11['where']=qs[_0x946c('0x4d')](_['pick'](_0x3d334e[_0x946c('0x43')],_0xd6f1f8[_0x946c('0x4d')]));_0x1eac11[_0x946c('0x4c')][_0x946c('0x69')]=_0x4dc4ce['id'];if(_0x3d334e[_0x946c('0x43')][_0x946c('0x4f')]){_0x1eac11['where']=_[_0x946c('0x50')](_0x1eac11[_0x946c('0x4c')],{'$or':_[_0x946c('0x3d')](_0x1eac11[_0x946c('0x46')],function(_0x4181b7){var _0x161449={};_0x161449[_0x4181b7]={'$like':'%'+_0x3d334e['query'][_0x946c('0x4f')]+'%'};return _0x161449;})});}_0x1eac11=_[_0x946c('0x50')]({},_0x1eac11,_0x3d334e[_0x946c('0x52')]);return db[_0x946c('0x70')]['count']({'where':_0x1eac11[_0x946c('0x4c')]})[_0x946c('0x1e')](function(_0x20b182){_0x19c421[_0x946c('0x2e')]=_0x20b182;if(_0x3d334e['query']['includeAll']){_0x1eac11[_0x946c('0x53')]=[{'model':db[_0x946c('0x73')],'as':_0x946c('0x74'),'required':![]},{'model':db[_0x946c('0x75')],'as':_0x946c('0x76'),'attributes':[_0x946c('0x38'),_0x946c('0x77'),_0x946c('0x78')],'required':![]},{'model':db[_0x946c('0x79')],'as':_0x946c('0x7a'),'attributes':['id','name',_0x946c('0x7b')],'where':_0x3d334e[_0x946c('0x43')][_0x946c('0x7c')]?{'id':_0x3d334e[_0x946c('0x43')][_0x946c('0x7c')]}:undefined,'required':_0x3d334e[_0x946c('0x43')][_0x946c('0x7c')]?!![]:![]}];}return db[_0x946c('0x70')][_0x946c('0x54')](_0x1eac11);})[_0x946c('0x1e')](function(_0x554d74){_0x19c421[_0x946c('0x6c')]=_0x554d74;return _0x19c421;});}})['then'](respondWithFilteredResult(_0x125628,_0x1eac11))['catch'](handleError(_0x125628,null));};exports[_0x946c('0x7d')]=function(_0x15da47,_0x468194){var _0x4bc96d=_0x15da47[_0x946c('0x61')]['id'];var _0x2778d1=_0x15da47[_0x946c('0x5b')];var _0x2e0ca0=0xc8;var _0x4b19a9=null;return db[_0x946c('0x7e')][_0x946c('0x7f')]({'isolationLevel':db[_0x946c('0x7e')][_0x946c('0x80')][_0x946c('0x81')][_0x946c('0x82')]},function(_0x14397f){return db['FaxAccount'][_0x946c('0x65')]({'where':{'id':_0x4bc96d},'transaction':_0x14397f})['then'](function(_0x1e5a12){if(_0x1e5a12){return db['FaxApplication'][_0x946c('0x33')]({'where':{'FaxAccountId':_0x4bc96d},'transaction':_0x14397f})[_0x946c('0x1e')](function(){var _0x38f4c9=_[_0x946c('0x3d')](_0x2778d1,function(_0x70dee3){_0x70dee3[_0x946c('0x69')]=_0x4bc96d;return _0x70dee3;});return db[_0x946c('0x83')][_0x946c('0x84')](_0x38f4c9,{'transaction':_0x14397f});});}else{_0x2e0ca0=0x194;_0x4b19a9=[];}});})[_0x946c('0x1e')](function(){if(_0x2e0ca0!==0x194){return db[_0x946c('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x4bc96d},'order':_0x946c('0x85')})[_0x946c('0x1e')](function(_0x5407f4){_0x4b19a9=_0x5407f4;});}})[_0x946c('0x55')](function(_0x3b5ce8){_0x2e0ca0=0x1f4;logger[_0x946c('0x23')](_0x3b5ce8[_0x946c('0x37')]);if(_0x3b5ce8[_0x946c('0x38')]){delete _0x3b5ce8[_0x946c('0x38')];}_0x4b19a9=_0x3b5ce8;})[_0x946c('0x86')](function(){if(_0x4b19a9===null){_0x468194[_0x946c('0x27')](_0x2e0ca0);}else{if(_0x2e0ca0===0x1f4){_0x468194['status'](_0x2e0ca0)[_0x946c('0x39')](_0x4b19a9);}else{_0x468194[_0x946c('0x28')](_0x2e0ca0)[_0x946c('0x2a')](_0x4b19a9);}}});};exports[_0x946c('0x87')]=function(_0x20c818,_0x3d0966,_0x5acf05){var _0x2d5e2a={};var _0x5b102d={};var _0x4ea91e;var _0x3edcc6;return db[_0x946c('0x3e')][_0x946c('0x65')]({'where':{'id':_0x20c818['params']['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x3d0966,null))['then'](function(_0x5b6a46){if(_0x5b6a46){_0x4ea91e=_0x5b6a46;_0x5b102d['model']=_[_0x946c('0x44')](db['FaxApplication'][_0x946c('0x57')]);_0x5b102d[_0x946c('0x43')]=_['keys'](_0x20c818[_0x946c('0x43')]);_0x5b102d[_0x946c('0x4d')]=_[_0x946c('0x45')](_0x5b102d[_0x946c('0x42')],_0x5b102d[_0x946c('0x43')]);_0x2d5e2a[_0x946c('0x46')]=_[_0x946c('0x45')](_0x5b102d[_0x946c('0x42')],qs[_0x946c('0x47')](_0x20c818[_0x946c('0x43')]['fields']));_0x2d5e2a['attributes']=_0x2d5e2a['attributes'][_0x946c('0x48')]?_0x2d5e2a[_0x946c('0x46')]:_0x5b102d[_0x946c('0x42')];_0x2d5e2a[_0x946c('0x4a')]=qs[_0x946c('0x4b')](_0x20c818[_0x946c('0x43')][_0x946c('0x4b')]);_0x2d5e2a[_0x946c('0x4c')]=qs[_0x946c('0x4d')](_[_0x946c('0x4e')](_0x20c818[_0x946c('0x43')],_0x5b102d[_0x946c('0x4d')]));if(_0x20c818[_0x946c('0x43')]['filter']){_0x2d5e2a['where']=_[_0x946c('0x50')](_0x2d5e2a['where'],{'$or':_[_0x946c('0x3d')](_0x2d5e2a[_0x946c('0x46')],function(_0x18053e){var _0x5003bc={};_0x5003bc[_0x18053e]={'$like':'%'+_0x20c818[_0x946c('0x43')][_0x946c('0x4f')]+'%'};return _0x5003bc;})});}_0x2d5e2a=_[_0x946c('0x50')]({},_0x2d5e2a,_0x20c818[_0x946c('0x52')]);return _0x4ea91e['getApplications'](_0x2d5e2a);}})['then'](function(_0x1b6a0a){if(_0x1b6a0a){_0x3edcc6=_0x1b6a0a[_0x946c('0x48')];if(!_0x20c818[_0x946c('0x43')][_0x946c('0x67')](_0x946c('0x49'))){_0x2d5e2a[_0x946c('0x2c')]=qs[_0x946c('0x2c')](_0x20c818['query'][_0x946c('0x2c')]);_0x2d5e2a[_0x946c('0x2b')]=qs['offset'](_0x20c818['query']['offset']);}return _0x4ea91e[_0x946c('0x87')](_0x2d5e2a);}})['then'](function(_0xff526e){if(_0xff526e){return _0xff526e?{'count':_0x3edcc6,'rows':_0xff526e}:null;}})[_0x946c('0x1e')](respondWithResult(_0x3d0966,null))['catch'](handleError(_0x3d0966,null));};function Extension(_0x191277,_0x5d7f40,_0x160106,_0x48fb06){this[_0x946c('0x88')]=_0x946c('0x89');this[_0x946c('0x8a')]=_0x191277['localstationid'];this['app']=_0x48fb06;this[_0x946c('0x40')]=_0x946c('0x8b');this[_0x946c('0x8c')]=_0x946c('0x8d');this['FaxAccountId']=_0x191277['id'];this['priority']=_0x5d7f40;this[_0x946c('0x8e')]=_0x160106;}function createExtensionsReciveFax(_0x420ee2){var _0x4a79dc=0x1;var _0x49f960=[];_0x49f960[_0x946c('0x8f')](new Extension(_0x420ee2,_0x4a79dc,'','Answer'));_0x4a79dc+=0x1;_0x49f960['push'](new Extension(_0x420ee2,_0x4a79dc,_0x946c('0x90'),'Set'));_0x4a79dc+=0x1;for(var _0x2269aa in _0x420ee2){if(_0x420ee2[_0x946c('0x67')](_0x2269aa)&&(_0x2269aa===_0x946c('0x91')||_0x2269aa===_0x946c('0x92')||_0x2269aa==='gateway'||_0x2269aa==='faxdetect'||_0x2269aa===_0x946c('0x93')||_0x2269aa===_0x946c('0x94')||_0x2269aa==='minrate'||_0x2269aa===_0x946c('0x95')||_0x2269aa===_0x946c('0x96'))){_0x49f960[_0x946c('0x8f')](new Extension(_0x420ee2,_0x4a79dc,_0x946c('0x97')+_0x2269aa+')='+_0x420ee2[_0x2269aa],_0x946c('0x98')));_0x4a79dc+=0x1;}}_0x49f960[_0x946c('0x8f')](new Extension(_0x420ee2,_0x4a79dc,'6',_0x946c('0x99')));_0x4a79dc+=0x1;_0x49f960[_0x946c('0x8f')](new Extension(_0x420ee2,_0x4a79dc,'/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'));_0x4a79dc=0x0;return _0x49f960;}exports['addAccountApplications']=function(_0x2d97e8,_0x1e65b0,_0x4750b8){var _0x400a99;return db[_0x946c('0x7e')][_0x946c('0x7f')](function(_0x23f9b5){return db[_0x946c('0x3e')][_0x946c('0x5a')](_0x2d97e8[_0x946c('0x5b')],{'transaction':_0x23f9b5})[_0x946c('0x1e')](function(_0x341535){_0x400a99=_0x341535[_0x946c('0x34')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x400a99),{'transaction':_0x23f9b5});});})[_0x946c('0x1e')](function(){return _0x400a99;})[_0x946c('0x1e')](respondWithResult(_0x1e65b0,null))[_0x946c('0x55')](handleError(_0x1e65b0,null));};exports[_0x946c('0x9a')]=function(_0x4aee61,_0x49428b,_0x3c577b){var _0x5f0509;return db[_0x946c('0x7e')][_0x946c('0x7f')](function(_0x1e7e77){return db['FaxAccount'][_0x946c('0x32')](_0x4aee61[_0x946c('0x5b')],{'where':{'id':_0x4aee61[_0x946c('0x5b')]['id']},'transaction':_0x1e7e77})['then'](function(_0x221546){return db['VoiceExtension'][_0x946c('0x33')]({'where':{'FaxAccountId':_0x4aee61['body']['id']},'transaction':_0x1e7e77})[_0x946c('0x1e')](function(_0x7a8b44){return db[_0x946c('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0x946c('0x71')](_0x4aee61[_0x946c('0x5b')],[_0x946c('0x9c'),'key',_0x946c('0x9d'),'updatedAt',_0x946c('0x9e'),_0x946c('0x9f')])),{'transaction':_0x1e7e77});});});})[_0x946c('0x1e')](function(){return db[_0x946c('0x3e')][_0x946c('0xa0')](_0x4aee61[_0x946c('0x5b')]['id']);})[_0x946c('0x1e')](respondWithResult(_0x49428b,null))[_0x946c('0x55')](handleError(_0x49428b,null));};exports[_0x946c('0xa1')]=function(_0x4be88b,_0x5abf75,_0x350aa1){var _0x4fbcde={'raw':!![],'where':{}};var _0x5772db={};var _0x586422={'count':0x0,'rows':[]};return db[_0x946c('0x3e')]['findOne']({'where':{'id':_0x4be88b[_0x946c('0x61')]['id']}})['then'](handleEntityNotFound(_0x5abf75,null))['then'](function(_0x1a8482){if(_0x1a8482){_0x5772db[_0x946c('0x42')]=_[_0x946c('0x44')](db[_0x946c('0xa2')][_0x946c('0x57')]);_0x5772db[_0x946c('0x43')]=_[_0x946c('0x44')](_0x4be88b[_0x946c('0x43')]);_0x5772db[_0x946c('0x4d')]=_[_0x946c('0x45')](_0x5772db[_0x946c('0x42')],_0x5772db[_0x946c('0x43')]);_0x4fbcde['attributes']=_[_0x946c('0x45')](_0x5772db['model'],qs[_0x946c('0x47')](_0x4be88b[_0x946c('0x43')][_0x946c('0x47')]));_0x4fbcde[_0x946c('0x46')]=_0x4fbcde[_0x946c('0x46')]['length']?_0x4fbcde[_0x946c('0x46')]:_0x5772db[_0x946c('0x42')];if(!_0x4be88b['query'][_0x946c('0x67')](_0x946c('0x49'))){_0x4fbcde[_0x946c('0x2c')]=qs[_0x946c('0x2c')](_0x4be88b['query']['limit']);_0x4fbcde[_0x946c('0x2b')]=qs[_0x946c('0x2b')](_0x4be88b[_0x946c('0x43')][_0x946c('0x2b')]);}_0x4fbcde['order']=qs[_0x946c('0x4b')](_0x4be88b['query'][_0x946c('0x4b')]);_0x4fbcde[_0x946c('0x4c')]=qs[_0x946c('0x4d')](_[_0x946c('0x4e')](_0x4be88b[_0x946c('0x43')],_0x5772db[_0x946c('0x4d')]));_0x4fbcde[_0x946c('0x4c')][_0x946c('0x69')]=_0x1a8482['id'];if(_0x4be88b[_0x946c('0x43')][_0x946c('0x4f')]){_0x4fbcde['where']=_[_0x946c('0x50')](_0x4fbcde[_0x946c('0x4c')],{'$or':_['map'](_0x4fbcde['attributes'],function(_0x3775f5){var _0x2b70dd={};_0x2b70dd[_0x3775f5]={'$like':'%'+_0x4be88b[_0x946c('0x43')][_0x946c('0x4f')]+'%'};return _0x2b70dd;})});}if(_0x4be88b[_0x946c('0x43')][_0x946c('0xa3')]){var _0x1a73b1=_0x4be88b[_0x946c('0x43')][_0x946c('0xa3')][_0x946c('0xa4')](',');var _0x474169={};_0x474169[_0x1a73b1[0x0]]={'$gte':moment(_0x1a73b1[0x1])['format'](_0x946c('0xa5'))};_0x4fbcde['where']=_['merge'](_0x4fbcde[_0x946c('0x4c')],_0x474169);}_0x4fbcde=_[_0x946c('0x50')]({},_0x4fbcde,_0x4be88b[_0x946c('0x52')]);return db[_0x946c('0xa2')][_0x946c('0x2e')]({'where':_0x4fbcde[_0x946c('0x4c')]})['then'](function(_0x3832d2){_0x586422[_0x946c('0x2e')]=_0x3832d2;if(_0x4be88b['query']['includeAll']){_0x4fbcde[_0x946c('0x53')]=[{'all':!![]}];}return db[_0x946c('0xa2')][_0x946c('0x54')](_0x4fbcde);})[_0x946c('0x1e')](function(_0x50d466){_0x586422[_0x946c('0x6c')]=_0x50d466;return _0x586422;});}})[_0x946c('0x1e')](respondWithFilteredResult(_0x5abf75,_0x4fbcde))[_0x946c('0x55')](handleError(_0x5abf75,null));};exports[_0x946c('0x39')]=function(_0x3c6834,_0x45ce87,_0x49d07e){var _0x362d2d,_0x32f07e={},_0xdde058;if(_0x3c6834[_0x946c('0x5b')]['to']){_0xdde058=_0x3c6834[_0x946c('0x5b')]['to'][0x0];}return db[_0x946c('0x3e')][_0x946c('0x59')]({'where':{'id':_0x3c6834['params']['id']},'include':[{'model':db['CmList'],'as':_0x946c('0xa6'),'include':[{'model':db[_0x946c('0x73')],'as':'Contacts','where':{'fax':_0xdde058},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x45ce87,null))['then'](function(_0x2cae8c){_0x362d2d=_0x2cae8c;if(_0x3c6834['body'][_0x946c('0xa7')]&&_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][_0x946c('0x48')]){for(var _0x21914f=0x0;_0x21914f<_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][_0x946c('0x48')];_0x21914f+=0x1){_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][_0x21914f]={'filename':_0x3c6834['body'][_0x946c('0xa7')][_0x21914f][_0x946c('0x38')],'id':_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][_0x21914f]['id'],'path':path['join'](config[_0x946c('0xa8')],'server/files/attachments',_0x3c6834['body']['attachments'][_0x21914f][_0x946c('0xa9')])};}}return respondWithRpcPromise(_0x946c('0xaa'),_0x946c('0xaa'),{'FaxAccountId':_[_0x946c('0xab')](_0x3c6834[_0x946c('0x61')]['id'])?undefined:_0x3c6834[_0x946c('0x61')]['id'],'path':_[_0x946c('0xab')](_0x3c6834['body'][_0x946c('0xa7')][0x0][_0x946c('0xac')])?undefined:_0x3c6834[_0x946c('0x5b')]['attachments'][0x0][_0x946c('0xac')],'fax':_['isNil'](_0x3c6834[_0x946c('0x5b')]['to'][0x0])?undefined:_0x3c6834[_0x946c('0x5b')]['to'][0x0]},client9002);})[_0x946c('0x1e')](function(){if(_0x362d2d){if(_[_0x946c('0xab')](_0x3c6834[_0x946c('0x5b')]['from'])){_0x3c6834[_0x946c('0x5b')][_0x946c('0xad')]=util['format']('\x22%s\x22\x20<%s>',_0x362d2d[_0x946c('0x38')],_0x362d2d['fax']);}if(_0x362d2d[_0x946c('0xa6')]){if(_0x362d2d[_0x946c('0xa6')]['Contacts']['length']){return _0x362d2d['List']['Contacts'][0x0];}else{return db[_0x946c('0x73')]['create'](_[_0x946c('0xae')](_0x3c6834[_0x946c('0x5b')],{'firstName':_0x3c6834[_0x946c('0x5b')]['to'][0x0],'phone':_0x3c6834[_0x946c('0x5b')]['to'][0x0],'fax':_0x3c6834[_0x946c('0x5b')]['to'][0x0],'ListId':_0x362d2d[_0x946c('0x9f')]}));}}else{throw new Error(_0x946c('0xaf'));}}else{throw new Error(_0x946c('0xb0'));}})[_0x946c('0x1e')](function(_0x2fa043){if(_0x2fa043){return db[_0x946c('0x70')][_0x946c('0x59')]({'where':{'ContactId':_0x2fa043['id'],'closed':![],'FaxAccountId':_0x362d2d['id']}})[_0x946c('0x1e')](function(_0x2e7674){if(_0x2e7674){return[_0x2e7674,![]];}return db['FaxInteraction'][_0x946c('0x5a')]({'UserId':_0x3c6834[_0x946c('0x5d')]['id'],'ContactId':_0x2fa043['id'],'FaxAccountId':_0x362d2d['id'],'fax':_0x3c6834['body']['to'][0x0],'firstMsgDirection':_0x946c('0xb1'),'Messages':[_[_0x946c('0x50')](_0x3c6834[_0x946c('0x5b')],{'read':![],'body':_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][0x0][_0x946c('0xb2')],'FaxAccountId':_0x362d2d['id'],'UserId':_0x3c6834['user']['id'],'ContactId':_0x2fa043['id'],'AttachmentId':_0x3c6834['body'][_0x946c('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x946c('0xa2')],'as':'Messages'}]})[_0x946c('0x1e')](function(_0x3bde9c){return[_0x3bde9c,!![]];});});}else{throw new Error(_0x946c('0xb3'));}})[_0x946c('0xb4')](function(_0x5249c5,_0x50ca5e){if(_0x50ca5e){return _0x5249c5;}return db['FaxMessage']['create']({'direction':_0x946c('0xb1'),'read':![],'body':_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][0x0][_0x946c('0xb2')],'FaxAccountId':_0x362d2d['id'],'FaxInteractionId':_0x5249c5['id'],'UserId':_0x3c6834[_0x946c('0x5d')]['id'],'ContactId':_0x5249c5[_0x946c('0xb5')],'AttachmentId':_0x3c6834['body'][_0x946c('0xa7')][0x0]['id']})[_0x946c('0x1e')](function(_0x3eabc6){_0x5249c5[_0x946c('0xb6')]['Messages']=[];_0x5249c5[_0x946c('0xb6')][_0x946c('0xb7')][_0x946c('0x8f')](_0x3eabc6[_0x946c('0xb6')]);return _0x5249c5;});})[_0x946c('0x1e')](function(_0x5af769){respondWithRpcPromise(_0x946c('0xb8'),_0x946c('0xb8'),{'FaxAccountId':_['isNil'](_0x3c6834[_0x946c('0x61')]['id'])?undefined:_0x3c6834[_0x946c('0x61')]['id'],'path':_[_0x946c('0xab')](_0x3c6834[_0x946c('0x5b')]['attachments'][0x0][_0x946c('0xac')])?undefined:_0x3c6834[_0x946c('0x5b')][_0x946c('0xa7')][0x0]['path'],'fax':_[_0x946c('0xab')](_0x3c6834[_0x946c('0x5b')]['to'][0x0])?undefined:_0x3c6834['body']['to'][0x0],'AttachmentId':_0x3c6834['body'][_0x946c('0xa7')][0x0]['id']},client9002)[_0x946c('0x1e')](function(_0x5a8175){logger[_0x946c('0x1f')]('SendFaxRpc,\x20%s',_0x5a8175);})['catch'](function(_0x34533b){logger['info'](_0x946c('0xb9'),_0x34533b);});return _0x5af769;})[_0x946c('0x1e')](respondWithResult(_0x45ce87,null))[_0x946c('0x55')](handleError(_0x45ce87,null));};exports[_0x946c('0xba')]=function(_0x4d564a,_0x5d09ca,_0x49cfb0){return db['FaxAccount'][_0x946c('0x59')]({'where':{'id':_0x4d564a['params']['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x5d09ca,null))[_0x946c('0x1e')](function(_0x3b80ea){if(_0x3b80ea){return _0x3b80ea['addAgents'](_0x4d564a[_0x946c('0x5b')][_0x946c('0x6e')],_[_0x946c('0x71')](_0x4d564a[_0x946c('0x5b')],[_0x946c('0x6e'),'id'])||{})[_0x946c('0xb4')](function(_0xee8a53){for(var _0x452d1f=0x0;_0x452d1f<_0x4d564a[_0x946c('0x5b')][_0x946c('0x6e')]['length'];_0x452d1f+=0x1){socket[_0x946c('0xbb')](_0x946c('0xbc'),{'UserId':Number(_0x4d564a[_0x946c('0x5b')][_0x946c('0x6e')][_0x452d1f]),'FaxAccountId':Number(_0x4d564a['params']['id'])});}return _0xee8a53;});}})[_0x946c('0x1e')](respondWithResult(_0x5d09ca,null))[_0x946c('0x55')](handleError(_0x5d09ca,null));};exports[_0x946c('0xbd')]=function(_0xdff83f,_0x15a8db,_0x19db71){return db[_0x946c('0x3e')]['find']({'where':{'id':_0xdff83f[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x15a8db,null))[_0x946c('0x1e')](function(_0x4a360d){if(_0x4a360d){return _0x4a360d[_0x946c('0xbd')](_0xdff83f[_0x946c('0x43')][_0x946c('0x6e')])[_0x946c('0x1e')](function(){if(_[_0x946c('0xbe')](_0xdff83f['query']['ids'])){for(var _0x1e33fe=0x0;_0x1e33fe<_0xdff83f[_0x946c('0x43')][_0x946c('0x6e')]['length'];_0x1e33fe+=0x1){socket[_0x946c('0xbb')](_0x946c('0xbf'),{'UserId':Number(_0xdff83f[_0x946c('0x43')][_0x946c('0x6e')][_0x1e33fe]),'FaxAccountId':Number(_0xdff83f[_0x946c('0x61')]['id'])});}}else{socket['emit'](_0x946c('0xbf'),{'UserId':Number(_0xdff83f[_0x946c('0x43')][_0x946c('0x6e')]),'FaxAccountId':Number(_0xdff83f[_0x946c('0x61')]['id'])});}});}})[_0x946c('0x1e')](respondWithStatusCode(_0x15a8db,null))[_0x946c('0x55')](handleError(_0x15a8db,null));};exports[_0x946c('0xc0')]=function(_0xf2b980,_0x88a29,_0x150a14){var _0x592771={};var _0x66d9f6={};var _0x4ff869;var _0x53252a;return db['FaxAccount'][_0x946c('0x65')]({'where':{'id':_0xf2b980[_0x946c('0x61')]['id']}})[_0x946c('0x1e')](handleEntityNotFound(_0x88a29,null))[_0x946c('0x1e')](function(_0x2a0719){if(_0x2a0719){_0x4ff869=_0x2a0719;_0x66d9f6['model']=_[_0x946c('0x44')](db[_0x946c('0x75')]['rawAttributes']);_0x66d9f6[_0x946c('0x43')]=_[_0x946c('0x44')](_0xf2b980[_0x946c('0x43')]);_0x66d9f6[_0x946c('0x4d')]=_['intersection'](_0x66d9f6[_0x946c('0x42')],_0x66d9f6['query']);_0x592771[_0x946c('0x46')]=_[_0x946c('0x45')](_0x66d9f6[_0x946c('0x42')],qs[_0x946c('0x47')](_0xf2b980[_0x946c('0x43')][_0x946c('0x47')]));_0x592771['attributes']=_0x592771['attributes'][_0x946c('0x48')]?_0x592771['attributes']:_0x66d9f6[_0x946c('0x42')];_0x592771[_0x946c('0x4a')]=qs[_0x946c('0x4b')](_0xf2b980[_0x946c('0x43')][_0x946c('0x4b')]);_0x592771['where']=qs['filters'](_[_0x946c('0x4e')](_0xf2b980[_0x946c('0x43')],_0x66d9f6[_0x946c('0x4d')]));if(_0xf2b980[_0x946c('0x43')][_0x946c('0x4f')]){_0x592771[_0x946c('0x4c')]=_['merge'](_0x592771['where'],{'$or':_['map'](_0x592771[_0x946c('0x46')],function(_0x4aa9ce){var _0x12c772={};_0x12c772[_0x4aa9ce]={'$like':'%'+_0xf2b980['query'][_0x946c('0x4f')]+'%'};return _0x12c772;})});}_0x592771=_[_0x946c('0x50')]({},_0x592771,_0xf2b980[_0x946c('0x52')]);return _0x4ff869[_0x946c('0xc0')](_0x592771);}})[_0x946c('0x1e')](function(_0x1f43a3){if(_0x1f43a3){_0x53252a=_0x1f43a3[_0x946c('0x48')];if(!_0xf2b980[_0x946c('0x43')][_0x946c('0x67')](_0x946c('0x49'))){_0x592771[_0x946c('0x2c')]=qs[_0x946c('0x2c')](_0xf2b980['query'][_0x946c('0x2c')]);_0x592771['offset']=qs[_0x946c('0x2b')](_0xf2b980[_0x946c('0x43')][_0x946c('0x2b')]);}return _0x4ff869['getAgents'](_0x592771);}})[_0x946c('0x1e')](function(_0xfb844f){if(_0xfb844f){return _0xfb844f?{'count':_0x53252a,'rows':_0xfb844f}:null;}})[_0x946c('0x1e')](respondWithResult(_0x88a29,null))[_0x946c('0x55')](handleError(_0x88a29,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 21de90c..f4f0066 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 _0xdb00=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb00,0xd4));var _0x0db0=function(_0x5df952,_0x3940da){_0x5df952=_0x5df952-0x0;var _0xf5400a=_0xdb00[_0x5df952];return _0xf5400a;};'use strict';var EventEmitter=require(_0x0db0('0x0'));var FaxAccount=require(_0x0db0('0x1'))['db'][_0x0db0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0db0('0x3')](0x0);var events={'afterCreate':_0x0db0('0x4'),'afterUpdate':_0x0db0('0x5'),'afterDestroy':_0x0db0('0x6')};function emitEvent(_0xbc8ff){return function(_0x2dcca9,_0x2c23a1,_0x4006c0){FaxAccountEvents[_0x0db0('0x7')](_0xbc8ff+':'+_0x2dcca9['id'],_0x2dcca9);FaxAccountEvents[_0x0db0('0x7')](_0xbc8ff,_0x2dcca9);_0x4006c0(null);};}for(var e in events){if(events[_0x0db0('0x8')](e)){var event=events[e];FaxAccount[_0x0db0('0x9')](e,emitEvent(event));}}module[_0x0db0('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0xd5d7=['exports','../../mysqldb','remove','emit','hook'];(function(_0x43e96e,_0x28906f){var _0x5eece1=function(_0x2cc9f4){while(--_0x2cc9f4){_0x43e96e['push'](_0x43e96e['shift']());}};_0x5eece1(++_0x28906f);}(_0xd5d7,0x92));var _0x7d5d=function(_0x1bd086,_0x33e083){_0x1bd086=_0x1bd086-0x0;var _0xa3f628=_0xd5d7[_0x1bd086];return _0xa3f628;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x7d5d('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7d5d('0x1')};function emitEvent(_0x352e42){return function(_0x3f72fc,_0x56c069,_0xe67455){FaxAccountEvents[_0x7d5d('0x2')](_0x352e42+':'+_0x3f72fc['id'],_0x3f72fc);FaxAccountEvents[_0x7d5d('0x2')](_0x352e42,_0x3f72fc);_0xe67455(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x7d5d('0x3')](e,emitEvent(event));}}module[_0x7d5d('0x4')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 7d37b97..0a74cf5 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 _0x58a5=['define','lodash','util','api','moment','bluebird','request-promise','path','./faxAccount.attributes'];(function(_0x2a0fc4,_0x2eaf74){var _0x531d00=function(_0xa4388f){while(--_0xa4388f){_0x2a0fc4['push'](_0x2a0fc4['shift']());}};_0x531d00(++_0x2eaf74);}(_0x58a5,0x1a8));var _0x558a=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0x58a5[_0x4c7d8b];return _0x187158;};'use strict';var _=require(_0x558a('0x0'));var util=require(_0x558a('0x1'));var logger=require('../../config/logger')(_0x558a('0x2'));var moment=require(_0x558a('0x3'));var BPromise=require(_0x558a('0x4'));var rp=require(_0x558a('0x5'));var fs=require('fs');var path=require(_0x558a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x558a('0x7'));module['exports']=function(_0x315cfb,_0x4bbf0f){return _0x315cfb[_0x558a('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd7c=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash'];(function(_0x1a3f4b,_0x3face2){var _0x503e87=function(_0x205cea){while(--_0x205cea){_0x1a3f4b['push'](_0x1a3f4b['shift']());}};_0x503e87(++_0x3face2);}(_0xbd7c,0xcb));var _0xcbd7=function(_0x2e54a9,_0x49ea15){_0x2e54a9=_0x2e54a9-0x0;var _0x140b00=_0xbd7c[_0x2e54a9];return _0x140b00;};'use strict';var _=require(_0xcbd7('0x0'));var util=require(_0xcbd7('0x1'));var logger=require(_0xcbd7('0x2'))(_0xcbd7('0x3'));var moment=require('moment');var BPromise=require(_0xcbd7('0x4'));var rp=require(_0xcbd7('0x5'));var fs=require('fs');var path=require(_0xcbd7('0x6'));var rimraf=require('rimraf');var config=require(_0xcbd7('0x7'));var attributes=require(_0xcbd7('0x8'));module[_0xcbd7('0x9')]=function(_0x4a6993,_0x3069be){return _0x4a6993[_0xcbd7('0xa')](_0xcbd7('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 2200f87..18203a6 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 _0x46e0=['autoclose','close','unmanaged','created','interaction','FaxMessage','create','ContactId','AttachmentId','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options','where','include','map','model','attributes','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','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','FaxAccount','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','asc','length','defaults','FaxInteraction','Contact\x20not\x20found','spread'];(function(_0x2cf898,_0x30af1a){var _0x78f314=function(_0x1acacb){while(--_0x1acacb){_0x2cf898['push'](_0x2cf898['shift']());}};_0x78f314(++_0x30af1a);}(_0x46e0,0xc6));var _0x046e=function(_0xf00675,_0x2ea2e9){_0xf00675=_0xf00675-0x0;var _0x5479d6=_0x46e0[_0xf00675];return _0x5479d6;};'use strict';var _=require(_0x046e('0x0'));var util=require(_0x046e('0x1'));var moment=require(_0x046e('0x2'));var BPromise=require(_0x046e('0x3'));var rs=require(_0x046e('0x4'));var fs=require('fs');var Redis=require(_0x046e('0x5'));var db=require(_0x046e('0x6'))['db'];var utils=require(_0x046e('0x7'));var logger=require(_0x046e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x046e('0x9'));var client=jayson['client'][_0x046e('0xa')]({'port':0x232c});config[_0x046e('0xb')]=_['defaults'](config['redis'],{'host':_0x046e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x046e('0xb')]));require(_0x046e('0xd'))[_0x046e('0xe')](socket);function respondWithRpcPromise(_0x41ff44,_0x2deeee,_0x1e09ec){return new BPromise(function(_0x3aa408,_0x446b79){return client[_0x046e('0xf')](_0x41ff44,_0x1e09ec)[_0x046e('0x10')](function(_0x2cfd47){logger[_0x046e('0x11')](_0x046e('0x12'),_0x2deeee,_0x046e('0x13'));logger[_0x046e('0x14')](_0x046e('0x15'),_0x2deeee,'request\x20sent',JSON['stringify'](_0x2cfd47));if(_0x2cfd47[_0x046e('0x16')]){if(_0x2cfd47['error'][_0x046e('0x17')]===0x1f4){logger[_0x046e('0x16')](_0x046e('0x12'),_0x2deeee,_0x2cfd47[_0x046e('0x16')]['message']);return _0x446b79(_0x2cfd47['error'][_0x046e('0x18')]);}logger[_0x046e('0x16')](_0x046e('0x12'),_0x2deeee,_0x2cfd47['error']['message']);return _0x3aa408(_0x2cfd47['error'][_0x046e('0x18')]);}else{logger[_0x046e('0x11')]('FaxAccount,\x20%s,\x20%s',_0x2deeee,_0x046e('0x13'));_0x3aa408(_0x2cfd47[_0x046e('0x19')][_0x046e('0x18')]);}})[_0x046e('0x1a')](function(_0x54824d){logger[_0x046e('0x16')](_0x046e('0x12'),_0x2deeee,_0x54824d);_0x446b79(_0x54824d);});});}exports[_0x046e('0x1b')]=function(_0x5bc956){var _0x3a6536=this;return new Promise(function(_0x45b7e8,_0x1541ed){return db['FaxAccount'][_0x046e('0x1c')]({'raw':_0x5bc956[_0x046e('0x1d')]?_0x5bc956[_0x046e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5bc956[_0x046e('0x1d')]?_0x5bc956['options'][_0x046e('0x1e')]||null:null,'attributes':_0x5bc956[_0x046e('0x1d')]?_0x5bc956[_0x046e('0x1d')]['attributes']||null:null,'limit':_0x5bc956[_0x046e('0x1d')]?_0x5bc956[_0x046e('0x1d')]['limit']||null:null,'include':_0x5bc956['options']?_0x5bc956['options'][_0x046e('0x1f')]?_[_0x046e('0x20')](_0x5bc956[_0x046e('0x1d')]['include'],function(_0x40b2e7){return{'model':db[_0x40b2e7[_0x046e('0x21')]],'as':_0x40b2e7['as'],'attributes':_0x40b2e7[_0x046e('0x22')],'include':_0x40b2e7[_0x046e('0x1f')]?_[_0x046e('0x20')](_0x40b2e7[_0x046e('0x1f')],function(_0x18ca00){return{'model':db[_0x18ca00['model']],'as':_0x18ca00['as'],'attributes':_0x18ca00[_0x046e('0x22')],'include':_0x18ca00[_0x046e('0x1f')]?_[_0x046e('0x20')](_0x18ca00[_0x046e('0x1f')],function(_0x3ee572){return{'model':db[_0x3ee572['model']],'as':_0x3ee572['as'],'attributes':_0x3ee572[_0x046e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa5e41b){logger[_0x046e('0x11')](_0x046e('0x1b'),_0x5bc956);logger[_0x046e('0x14')]('GetFaxAccount',_0x5bc956,JSON['stringify'](_0xa5e41b));_0x45b7e8(_0xa5e41b);})[_0x046e('0x1a')](function(_0x17db8a){logger['error'](_0x046e('0x1b'),_0x17db8a[_0x046e('0x18')],_0x5bc956);_0x1541ed(_0x3a6536['error'](0x1f4,_0x17db8a['message']));});});};exports[_0x046e('0x23')]=function(_0x4c6f0a,_0x3c1554,_0x23a39d){var _0xcb4c6e=this;return new Promise(function(_0xea3a29,_0x4f1125){var _0x2b948a={'body':_0x4c6f0a[_0x046e('0x24')],'channel':_0x046e('0x25')};var _0x227ff6=[];var _0x2c891d=[];var _0x3ac9fa={};return db[_0x046e('0x26')][_0x046e('0x27')]()[_0x046e('0x10')](function(_0x5134c9){if(!_0x5134c9){throw new db[(_0x046e('0x28'))][(_0x046e('0x29'))](_0x046e('0x2a'));}_0x227ff6=_['difference'](_[_0x046e('0x2b')](_0x5134c9),[_0x046e('0x2c'),_0x046e('0x2d')]);_0x2c891d=_[_0x046e('0x2e')](_['keys'](_0x5134c9),[_0x046e('0x2c'),_0x046e('0x2d'),_0x046e('0x2f'),_0x046e('0x30')]);if(_0x4c6f0a[_0x046e('0x24')]['id']){delete _0x4c6f0a[_0x046e('0x24')]['id'];}if(_[_0x046e('0x31')](_0x4c6f0a[_0x046e('0x24')][_0x046e('0x32')])){throw new db[(_0x046e('0x28'))][(_0x046e('0x29'))](_0x046e('0x33'));}if(_[_0x046e('0x31')](_0x4c6f0a[_0x046e('0x24')][_0x046e('0x24')])||_0x4c6f0a['body'][_0x046e('0x24')]===''){throw new db[(_0x046e('0x28'))][(_0x046e('0x29'))](_0x046e('0x34'));}if(_[_0x046e('0x31')](_0x4c6f0a['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x046e('0x35')+_0x2c891d);}if(!_[_0x046e('0x36')](_0x2c891d,_0x4c6f0a[_0x046e('0x24')][_0x046e('0x37')])){throw new db[(_0x046e('0x28'))][(_0x046e('0x29'))](_0x046e('0x38')+_0x2c891d);}_0x3ac9fa[_0x4c6f0a['body'][_0x046e('0x37')]]=_0x4c6f0a[_0x046e('0x24')]['from'];})[_0x046e('0x10')](function(){return db[_0x046e('0x39')][_0x046e('0x3a')]({'where':{'id':_0x4c6f0a[_0x046e('0x3b')]['id']},'include':[{'model':db[_0x046e('0x3c')],'as':_0x046e('0x3d'),'include':[{'model':db['CmContact'],'as':_0x046e('0x3e'),'where':_0x3ac9fa,'limit':0x1,'order':[[_0x046e('0x2d'),_0x046e('0x3f')]]}]},{'model':db[_0x046e('0x40')],'as':_0x046e('0x41')}]});})[_0x046e('0x10')](function(_0x2389f6){if(_0x2389f6&&_0x2389f6[_0x046e('0x3d')]){var _0x3ada0a=_0x2389f6[_0x046e('0x42')]({'plain':!![]});_0x2b948a[_0x046e('0x3b')]=_0x3ada0a;_0x2b948a[_0x046e('0x43')]=_0x3ada0a['Applications'];_0x2b948a[_0x046e('0x44')]=_0x3ada0a['List'];_0x2b948a[_0x046e('0x43')]=_['orderBy'](_0x2b948a[_0x046e('0x43')],['priority'],[_0x046e('0x45')]);if(_0x2b948a['account']['Applications']){delete _0x2b948a[_0x046e('0x3b')][_0x046e('0x41')];}if(_0x2b948a['account'][_0x046e('0x3d')]&&_0x2b948a[_0x046e('0x3b')][_0x046e('0x3d')][_0x046e('0x3e')][_0x046e('0x46')]){return _0x2b948a[_0x046e('0x3b')][_0x046e('0x3d')][_0x046e('0x3e')][0x0];}var _0x2fd735=_[_0x046e('0x47')](_0x4c6f0a[_0x046e('0x24')],{'firstName':_0x4c6f0a[_0x046e('0x24')][_0x046e('0x32')],'ListId':_0x3ada0a[_0x046e('0x30')]});_0x2fd735[_0x4c6f0a['body'][_0x046e('0x37')]]=_0x4c6f0a['body'][_0x046e('0x32')];return db[_0x046e('0x26')]['create'](_0x2fd735,{'fields':_0x227ff6,'raw':!![]});}})['then'](function(_0x5d98a4){_0x2b948a['contact']=_0x5d98a4;if(_0x5d98a4){var _0x6aec92={'ContactId':_0x5d98a4['id'],'FaxAccountId':_0x4c6f0a[_0x046e('0x3b')]['id'],'fax':_0x5d98a4[_0x046e('0x25')]};return db[_0x046e('0x48')]['find']({'where':{'ContactId':_0x5d98a4['id'],'closed':![],'FaxAccountId':_0x4c6f0a[_0x046e('0x3b')]['id']}})[_0x046e('0x10')](function(_0x3acf6c){if(_0x3acf6c){return[_0x3acf6c,![]];}return db[_0x046e('0x48')]['create'](_0x6aec92)[_0x046e('0x10')](function(_0x54ab8f){return[_0x54ab8f,!![]];});});}else{throw new Error(_0x046e('0x49'));}})[_0x046e('0x4a')](function(_0x4f5f67,_0x5d17e7){var _0x47d010=_0x4f5f67[_0x046e('0x42')]({'plain':!![]});if(_0x5d17e7){if(_0x2b948a[_0x046e('0x3b')][_0x046e('0x4b')]){_0x2b948a[_0x046e('0x43')]['push']({'id':0x0,'priority':_0x2b948a[_0x046e('0x43')][_0x046e('0x46')]+0x1,'app':_0x046e('0x4c'),'appdata':_0x046e('0x4d'),'interval':'*,*,*,*'});}_0x47d010[_0x046e('0x4e')]=!![];}else{_0x47d010['created']=![];}_0x2b948a[_0x046e('0x4f')]=_0x47d010;return db[_0x046e('0x50')][_0x046e('0x51')]({'body':_0x4c6f0a[_0x046e('0x24')]['body'],'FaxAccountId':_0x4c6f0a[_0x046e('0x3b')]['id'],'FaxInteractionId':_0x4f5f67['id'],'direction':'in','ContactId':_0x4f5f67[_0x046e('0x52')],'AttachmentId':_0x4c6f0a[_0x046e('0x24')][_0x046e('0x53')]});})[_0x046e('0x10')](function(_0x1a3d6a){_0x2b948a[_0x046e('0x18')]=_0x1a3d6a;if(_0x2b948a[_0x046e('0x4f')][_0x046e('0x54')]){return db['User']['find']({'attributes':['id',_0x046e('0x55')],'where':{'id':_0x2b948a[_0x046e('0x4f')][_0x046e('0x54')]}})[_0x046e('0x10')](function(_0x55756a){if(_0x55756a){_0x2b948a['applications'][_0x046e('0x56')]({'id':0x0,'priority':0x0,'app':_0x046e('0x57'),'appdata':_0x55756a['name']+','+(_0x2b948a[_0x046e('0x3b')][_0x046e('0x58')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x2b948a);});}return respondWithRpcPromise(_0x046e('0x59'),_0x046e('0x5a'),_0x2b948a);})[_0x046e('0x10')](function(_0x40305d){_0xea3a29(_0x40305d);})[_0x046e('0x1a')](function(_0x35c766){_0x4f1125(_0xcb4c6e[_0x046e('0x16')](0x1f4,_0x35c766[_0x046e('0x18')]));});});}; \ No newline at end of file +var _0xbf4b=['push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','find','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','stringify','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','difference','keys','updatedAt','ListId','isNil','from','Sequelize','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','DESC','FaxApplication','List','get','account','applications','Applications','orderBy','priority','asc','Contacts','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found','spread'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xbf4b,0x11b));var _0xbbf4=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xbf4b[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0xbbf4('0x0'));var util=require(_0xbbf4('0x1'));var moment=require('moment');var BPromise=require(_0xbbf4('0x2'));var rs=require(_0xbbf4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbf4('0x4'))['db'];var utils=require(_0xbbf4('0x5'));var logger=require('../../config/logger')(_0xbbf4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbbf4('0x7')][_0xbbf4('0x8')]({'port':0x232c});config[_0xbbf4('0x9')]=_['defaults'](config[_0xbbf4('0x9')],{'host':_0xbbf4('0xa'),'port':0x18eb});var socket=require(_0xbbf4('0xb'))(new Redis(config[_0xbbf4('0x9')]));require(_0xbbf4('0xc'))[_0xbbf4('0xd')](socket);function respondWithRpcPromise(_0x4c2d87,_0x407fa1,_0x154163){return new BPromise(function(_0x3f1d72,_0x5edd87){return client[_0xbbf4('0xe')](_0x4c2d87,_0x154163)['then'](function(_0xf3d389){logger['info'](_0xbbf4('0xf'),_0x407fa1,_0xbbf4('0x10'));logger[_0xbbf4('0x11')](_0xbbf4('0x12'),_0x407fa1,_0xbbf4('0x10'),JSON['stringify'](_0xf3d389));if(_0xf3d389[_0xbbf4('0x13')]){if(_0xf3d389[_0xbbf4('0x13')]['code']===0x1f4){logger[_0xbbf4('0x13')](_0xbbf4('0xf'),_0x407fa1,_0xf3d389['error']['message']);return _0x5edd87(_0xf3d389['error']['message']);}logger[_0xbbf4('0x13')]('FaxAccount,\x20%s,\x20%s',_0x407fa1,_0xf3d389[_0xbbf4('0x13')][_0xbbf4('0x14')]);return _0x3f1d72(_0xf3d389[_0xbbf4('0x13')][_0xbbf4('0x14')]);}else{logger[_0xbbf4('0x15')](_0xbbf4('0xf'),_0x407fa1,_0xbbf4('0x10'));_0x3f1d72(_0xf3d389[_0xbbf4('0x16')][_0xbbf4('0x14')]);}})[_0xbbf4('0x17')](function(_0x340a9e){logger['error'](_0xbbf4('0xf'),_0x407fa1,_0x340a9e);_0x5edd87(_0x340a9e);});});}exports[_0xbbf4('0x18')]=function(_0x5357fd){var _0x3a7275=this;return new Promise(function(_0x528c52,_0x2790c2){return db[_0xbbf4('0x19')][_0xbbf4('0x1a')]({'raw':_0x5357fd['options']?_0x5357fd[_0xbbf4('0x1b')][_0xbbf4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5357fd[_0xbbf4('0x1b')]?_0x5357fd['options']['where']||null:null,'attributes':_0x5357fd['options']?_0x5357fd[_0xbbf4('0x1b')][_0xbbf4('0x1d')]||null:null,'limit':_0x5357fd['options']?_0x5357fd[_0xbbf4('0x1b')][_0xbbf4('0x1e')]||null:null,'include':_0x5357fd[_0xbbf4('0x1b')]?_0x5357fd['options'][_0xbbf4('0x1f')]?_[_0xbbf4('0x20')](_0x5357fd[_0xbbf4('0x1b')][_0xbbf4('0x1f')],function(_0x47e18e){return{'model':db[_0x47e18e[_0xbbf4('0x21')]],'as':_0x47e18e['as'],'attributes':_0x47e18e[_0xbbf4('0x1d')],'include':_0x47e18e[_0xbbf4('0x1f')]?_['map'](_0x47e18e['include'],function(_0x58d891){return{'model':db[_0x58d891[_0xbbf4('0x21')]],'as':_0x58d891['as'],'attributes':_0x58d891[_0xbbf4('0x1d')],'include':_0x58d891[_0xbbf4('0x1f')]?_[_0xbbf4('0x20')](_0x58d891[_0xbbf4('0x1f')],function(_0xb3927a){return{'model':db[_0xb3927a[_0xbbf4('0x21')]],'as':_0xb3927a['as'],'attributes':_0xb3927a[_0xbbf4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbbf4('0x22')](function(_0x4275f4){logger[_0xbbf4('0x15')]('GetFaxAccount',_0x5357fd);logger[_0xbbf4('0x11')]('GetFaxAccount',_0x5357fd,JSON[_0xbbf4('0x23')](_0x4275f4));_0x528c52(_0x4275f4);})[_0xbbf4('0x17')](function(_0x3ff974){logger['error']('GetFaxAccount',_0x3ff974[_0xbbf4('0x14')],_0x5357fd);_0x2790c2(_0x3a7275[_0xbbf4('0x13')](0x1f4,_0x3ff974['message']));});});};exports[_0xbbf4('0x24')]=function(_0x539f8e,_0x304d4c,_0x5cf48f){var _0x435061=this;return new Promise(function(_0x134fb8,_0x3b6ad3){var _0x1f10ac={'body':_0x539f8e[_0xbbf4('0x25')],'channel':_0xbbf4('0x26')};var _0x5f1147=[];var _0x307232=[];var _0x46e999={};return db[_0xbbf4('0x27')][_0xbbf4('0x28')]()[_0xbbf4('0x22')](function(_0x2ee696){if(!_0x2ee696){throw new db['Sequelize'][(_0xbbf4('0x29'))]('no\x20available\x20attributes');}_0x5f1147=_[_0xbbf4('0x2a')](_[_0xbbf4('0x2b')](_0x2ee696),['createdAt',_0xbbf4('0x2c')]);_0x307232=_[_0xbbf4('0x2a')](_['keys'](_0x2ee696),['createdAt','updatedAt','CompanyId',_0xbbf4('0x2d')]);if(_0x539f8e[_0xbbf4('0x25')]['id']){delete _0x539f8e[_0xbbf4('0x25')]['id'];}if(_[_0xbbf4('0x2e')](_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x2f')])){throw new db[(_0xbbf4('0x30'))][(_0xbbf4('0x29'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x25')])||_0x539f8e['body']['body']===''){throw new db[(_0xbbf4('0x30'))][(_0xbbf4('0x29'))](_0xbbf4('0x31'));}if(_[_0xbbf4('0x2e')](_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x32')])){throw new db[(_0xbbf4('0x30'))][(_0xbbf4('0x29'))](_0xbbf4('0x33')+_0x307232);}if(!_[_0xbbf4('0x34')](_0x307232,_0x539f8e['body'][_0xbbf4('0x32')])){throw new db['Sequelize'][(_0xbbf4('0x29'))](_0xbbf4('0x35')+_0x307232);}_0x46e999[_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x32')]]=_0x539f8e['body'][_0xbbf4('0x2f')];})['then'](function(){return db[_0xbbf4('0x19')]['find']({'where':{'id':_0x539f8e['account']['id']},'include':[{'model':db[_0xbbf4('0x36')],'as':'List','include':[{'model':db[_0xbbf4('0x27')],'as':'Contacts','where':_0x46e999,'limit':0x1,'order':[[_0xbbf4('0x2c'),_0xbbf4('0x37')]]}]},{'model':db[_0xbbf4('0x38')],'as':'Applications'}]});})[_0xbbf4('0x22')](function(_0x3bc817){if(_0x3bc817&&_0x3bc817[_0xbbf4('0x39')]){var _0x305206=_0x3bc817[_0xbbf4('0x3a')]({'plain':!![]});_0x1f10ac[_0xbbf4('0x3b')]=_0x305206;_0x1f10ac[_0xbbf4('0x3c')]=_0x305206[_0xbbf4('0x3d')];_0x1f10ac['list']=_0x305206[_0xbbf4('0x39')];_0x1f10ac[_0xbbf4('0x3c')]=_[_0xbbf4('0x3e')](_0x1f10ac[_0xbbf4('0x3c')],[_0xbbf4('0x3f')],[_0xbbf4('0x40')]);if(_0x1f10ac[_0xbbf4('0x3b')][_0xbbf4('0x3d')]){delete _0x1f10ac['account']['Applications'];}if(_0x1f10ac['account'][_0xbbf4('0x39')]&&_0x1f10ac['account']['List'][_0xbbf4('0x41')][_0xbbf4('0x42')]){return _0x1f10ac[_0xbbf4('0x3b')][_0xbbf4('0x39')][_0xbbf4('0x41')][0x0];}var _0x18b2b9=_[_0xbbf4('0x43')](_0x539f8e[_0xbbf4('0x25')],{'firstName':_0x539f8e[_0xbbf4('0x25')]['from'],'ListId':_0x305206[_0xbbf4('0x2d')]});_0x18b2b9[_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x32')]]=_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x2f')];return db[_0xbbf4('0x27')][_0xbbf4('0x44')](_0x18b2b9,{'fields':_0x5f1147,'raw':!![]});}})['then'](function(_0x42088a){_0x1f10ac[_0xbbf4('0x45')]=_0x42088a;if(_0x42088a){var _0x283294={'ContactId':_0x42088a['id'],'FaxAccountId':_0x539f8e[_0xbbf4('0x3b')]['id'],'fax':_0x42088a[_0xbbf4('0x26')]};return db[_0xbbf4('0x46')]['find']({'where':{'ContactId':_0x42088a['id'],'closed':![],'FaxAccountId':_0x539f8e[_0xbbf4('0x3b')]['id']}})['then'](function(_0x5846e4){if(_0x5846e4){return[_0x5846e4,![]];}return db[_0xbbf4('0x46')][_0xbbf4('0x44')](_0x283294)[_0xbbf4('0x22')](function(_0x21af4b){return[_0x21af4b,!![]];});});}else{throw new Error(_0xbbf4('0x47'));}})[_0xbbf4('0x48')](function(_0x5b368c,_0x2840ed){var _0x499e26=_0x5b368c[_0xbbf4('0x3a')]({'plain':!![]});if(_0x2840ed){if(_0x1f10ac[_0xbbf4('0x3b')]['autoclose']){_0x1f10ac[_0xbbf4('0x3c')][_0xbbf4('0x49')]({'id':0x0,'priority':_0x1f10ac[_0xbbf4('0x3c')][_0xbbf4('0x42')]+0x1,'app':_0xbbf4('0x4a'),'appdata':_0xbbf4('0x4b'),'interval':_0xbbf4('0x4c')});}_0x499e26[_0xbbf4('0x4d')]=!![];}else{_0x499e26[_0xbbf4('0x4d')]=![];}_0x1f10ac[_0xbbf4('0x4e')]=_0x499e26;return db[_0xbbf4('0x4f')][_0xbbf4('0x44')]({'body':_0x539f8e[_0xbbf4('0x25')][_0xbbf4('0x25')],'FaxAccountId':_0x539f8e[_0xbbf4('0x3b')]['id'],'FaxInteractionId':_0x5b368c['id'],'direction':'in','ContactId':_0x5b368c[_0xbbf4('0x50')],'AttachmentId':_0x539f8e['body']['AttachmentId']});})[_0xbbf4('0x22')](function(_0x4f1aa0){_0x1f10ac[_0xbbf4('0x14')]=_0x4f1aa0;if(_0x1f10ac[_0xbbf4('0x4e')][_0xbbf4('0x51')]){return db['User'][_0xbbf4('0x52')]({'attributes':['id',_0xbbf4('0x53')],'where':{'id':_0x1f10ac[_0xbbf4('0x4e')]['UserId']}})[_0xbbf4('0x22')](function(_0x15b5c7){if(_0x15b5c7){_0x1f10ac[_0xbbf4('0x3c')][_0xbbf4('0x54')]({'id':0x0,'priority':0x0,'app':_0xbbf4('0x55'),'appdata':_0x15b5c7['name']+','+(_0x1f10ac[_0xbbf4('0x3b')][_0xbbf4('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbbf4('0x57'),'startRouting',_0x1f10ac);});}return respondWithRpcPromise(_0xbbf4('0x57'),_0xbbf4('0x58'),_0x1f10ac);})[_0xbbf4('0x22')](function(_0x591e03){_0x134fb8(_0x591e03);})['catch'](function(_0x3c1583){_0x3b6ad3(_0x435061[_0xbbf4('0x13')](0x1f4,_0x3c1583[_0xbbf4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 50eb41a..fb12cde 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 _0x63a8=['length','./faxAccount.events','remove','emit','removeListener','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x63a8,0x145));var _0x863a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a8[_0xfae23b];return _0x200640;};'use strict';var FaxAccountEvents=require(_0x863a('0x0'));var events=['save',_0x863a('0x1'),'update'];function createListener(_0x3b164c,_0x16a821){return function(_0x18d7ba){_0x16a821[_0x863a('0x2')](_0x3b164c,_0x18d7ba);};}function removeListener(_0x365177,_0x39cdaf){return function(){FaxAccountEvents[_0x863a('0x3')](_0x365177,_0x39cdaf);};}exports[_0x863a('0x4')]=function(_0x2140cf){for(var _0x4bff87=0x0,_0x20aa5d=events[_0x863a('0x5')];_0x4bff87<_0x20aa5d;_0x4bff87++){var _0x579c27=events[_0x4bff87];var _0x5db0c2=createListener('faxAccount:'+_0x579c27,_0x2140cf);FaxAccountEvents['on'](_0x579c27,_0x5db0c2);}}; \ No newline at end of file +var _0x162d=['emit','register','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x162d,0x168));var _0xd162=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x162d[_0x27af45];return _0x18df21;};'use strict';var FaxAccountEvents=require(_0xd162('0x0'));var events=[_0xd162('0x1'),_0xd162('0x2'),_0xd162('0x3')];function createListener(_0x5284ff,_0x271dd6){return function(_0x2db5ee){_0x271dd6[_0xd162('0x4')](_0x5284ff,_0x2db5ee);};}function removeListener(_0xe8f685,_0x180193){return function(){FaxAccountEvents['removeListener'](_0xe8f685,_0x180193);};}exports[_0xd162('0x5')]=function(_0x24d6b0){for(var _0x232a2=0x0,_0x489f54=events['length'];_0x232a2<_0x489f54;_0x232a2++){var _0xba2761=events[_0x232a2];var _0x2438c3=createListener(_0xd162('0x6')+_0xba2761,_0x24d6b0);FaxAccountEvents['on'](_0xba2761,_0x2438c3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index cda2628..2fcbba0 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(_0x224ac2,_0x1d3f3e){var _0x560ca7=function(_0x13c5a3){while(--_0x13c5a3){_0x224ac2['push'](_0x224ac2['shift']());}};_0x560ca7(++_0x1d3f3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x111b49,_0x3b9284){var _0x3fc3ef=function(_0x4089ff){while(--_0x4089ff){_0x111b49['push'](_0x111b49['shift']());}};_0x3fc3ef(++_0x3b9284);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 7ad0aff..de07f15 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 _0xd664=['STRING','sequelize','exports','INTEGER','noop'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0xd664,0xb5));var _0x4d66=function(_0x34f06c,_0x9e3b64){_0x34f06c=_0x34f06c-0x0;var _0x2ab23e=_0xd664[_0x34f06c];return _0x2ab23e;};'use strict';var Sequelize=require(_0x4d66('0x0'));module[_0x4d66('0x1')]={'priority':{'type':Sequelize[_0x4d66('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4d66('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4d66('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8aa6=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x277eb7,_0x493481){var _0x551ae3=function(_0x4bf7bd){while(--_0x4bf7bd){_0x277eb7['push'](_0x277eb7['shift']());}};_0x551ae3(++_0x493481);}(_0x8aa6,0x165));var _0x68aa=function(_0x2c1c86,_0xb5268b){_0x2c1c86=_0x2c1c86-0x0;var _0x127659=_0x8aa6[_0x2c1c86];return _0x127659;};'use strict';var Sequelize=require(_0x68aa('0x0'));module['exports']={'priority':{'type':Sequelize[_0x68aa('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x68aa('0x2')],'allowNull':![],'defaultValue':_0x68aa('0x3')},'appdata':{'type':Sequelize[_0x68aa('0x4')]()},'description':{'type':Sequelize[_0x68aa('0x2')]},'interval':{'type':Sequelize[_0x68aa('0x2')],'defaultValue':_0x68aa('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 37d5054..4c8ff4a 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 _0x24e1=['order','sort','where','pick','filter','merge','options','FaxApplication','include','rows','catch','show','params','intersection','includeAll','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x24e1,0x1da));var _0x124e=function(_0x513b1d,_0x5280f1){_0x513b1d=_0x513b1d-0x0;var _0x5cc8c8=_0x24e1[_0x513b1d];return _0x5cc8c8;};'use strict';var emlformat=require(_0x124e('0x0'));var rimraf=require(_0x124e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x124e('0x2'));var rp=require(_0x124e('0x3'));var moment=require(_0x124e('0x4'));var BPromise=require(_0x124e('0x5'));var Mustache=require(_0x124e('0x6'));var util=require(_0x124e('0x7'));var path=require(_0x124e('0x8'));var sox=require('sox');var csv=require(_0x124e('0x9'));var ejs=require(_0x124e('0xa'));var fs=require('fs');var fs_extra=require(_0x124e('0xb'));var _=require(_0x124e('0xc'));var squel=require(_0x124e('0xd'));var crypto=require('crypto');var jsforce=require(_0x124e('0xe'));var deskjs=require(_0x124e('0xf'));var toCsv=require(_0x124e('0x9'));var querystring=require('querystring');var Papa=require(_0x124e('0x10'));var Redis=require(_0x124e('0x11'));var authService=require(_0x124e('0x12'));var qs=require(_0x124e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x124e('0x14'));var logger=require(_0x124e('0x15'))(_0x124e('0x16'));var utils=require(_0x124e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x124e('0x18'));var db=require(_0x124e('0x19'))['db'];function respondWithStatusCode(_0x852ac0,_0x4abceb){_0x4abceb=_0x4abceb||0xcc;return function(_0x53fbfa){if(_0x53fbfa){return _0x852ac0[_0x124e('0x1a')](_0x4abceb);}return _0x852ac0[_0x124e('0x1b')](_0x4abceb)[_0x124e('0x1c')]();};}function respondWithResult(_0x1acf77,_0x54e9cc){_0x54e9cc=_0x54e9cc||0xc8;return function(_0x27707b){if(_0x27707b){return _0x1acf77[_0x124e('0x1b')](_0x54e9cc)[_0x124e('0x1d')](_0x27707b);}};}function respondWithFilteredResult(_0x5bfc03,_0x121ac2){return function(_0x30ee82){if(_0x30ee82){var _0x566cdf=typeof _0x121ac2[_0x124e('0x1e')]===_0x124e('0x1f')&&typeof _0x121ac2[_0x124e('0x20')]==='undefined';var _0x289d19=_0x30ee82['count'];var _0x2adc0a=_0x566cdf?0x0:_0x121ac2[_0x124e('0x1e')];var _0x4258a8=_0x566cdf?_0x30ee82[_0x124e('0x21')]:_0x121ac2[_0x124e('0x1e')]+_0x121ac2['limit'];var _0x4e6d45;if(_0x4258a8>=_0x289d19){_0x4258a8=_0x289d19;_0x4e6d45=0xc8;}else{_0x4e6d45=0xce;}_0x5bfc03[_0x124e('0x1b')](_0x4e6d45);return _0x5bfc03[_0x124e('0x22')](_0x124e('0x23'),_0x2adc0a+'-'+_0x4258a8+'/'+_0x289d19)[_0x124e('0x1d')](_0x30ee82);}return null;};}function patchUpdates(_0x1726a7){return function(_0x26590c){try{jsonpatch['apply'](_0x26590c,_0x1726a7,!![]);}catch(_0x4fca15){return BPromise[_0x124e('0x24')](_0x4fca15);}return _0x26590c[_0x124e('0x25')]();};}function saveUpdates(_0x5d53b9,_0x3be24f){return function(_0x37f295){if(_0x37f295){return _0x37f295[_0x124e('0x26')](_0x5d53b9)[_0x124e('0x27')](function(_0x3c4778){return _0x3c4778;});}return null;};}function removeEntity(_0x188e8e,_0x3dc8d1){return function(_0x593744){if(_0x593744){return _0x593744[_0x124e('0x28')]()[_0x124e('0x27')](function(){_0x188e8e[_0x124e('0x1b')](0xcc)[_0x124e('0x1c')]();});}};}function handleEntityNotFound(_0x371625,_0x1036bd){return function(_0xf02e6f){if(!_0xf02e6f){_0x371625[_0x124e('0x1a')](0x194);}return _0xf02e6f;};}function handleError(_0x16bd71,_0x32d902){_0x32d902=_0x32d902||0x1f4;return function(_0x5dd5c8){logger[_0x124e('0x29')](_0x5dd5c8[_0x124e('0x2a')]);if(_0x5dd5c8[_0x124e('0x2b')]){delete _0x5dd5c8[_0x124e('0x2b')];}_0x16bd71[_0x124e('0x1b')](_0x32d902)[_0x124e('0x2c')](_0x5dd5c8);};}exports[_0x124e('0x2d')]=function(_0x21054a,_0x28f5d7){var _0xad3560={},_0x4ff0ac={},_0xc518a0={'count':0x0,'rows':[]};var _0xb3e82d=_[_0x124e('0x2e')](db['FaxApplication']['rawAttributes'],function(_0x2c7cb9){return{'name':_0x2c7cb9[_0x124e('0x2f')],'type':_0x2c7cb9[_0x124e('0x30')]['key']};});_0x4ff0ac[_0x124e('0x31')]=_[_0x124e('0x2e')](_0xb3e82d,_0x124e('0x2b'));_0x4ff0ac[_0x124e('0x32')]=_[_0x124e('0x33')](_0x21054a[_0x124e('0x32')]);_0x4ff0ac[_0x124e('0x34')]=_['intersection'](_0x4ff0ac[_0x124e('0x31')],_0x4ff0ac['query']);_0xad3560[_0x124e('0x35')]=_['intersection'](_0x4ff0ac[_0x124e('0x31')],qs['fields'](_0x21054a[_0x124e('0x32')][_0x124e('0x36')]));_0xad3560[_0x124e('0x35')]=_0xad3560[_0x124e('0x35')][_0x124e('0x37')]?_0xad3560[_0x124e('0x35')]:_0x4ff0ac[_0x124e('0x31')];if(!_0x21054a['query'][_0x124e('0x38')](_0x124e('0x39'))){_0xad3560[_0x124e('0x20')]=qs[_0x124e('0x20')](_0x21054a['query']['limit']);_0xad3560[_0x124e('0x1e')]=qs[_0x124e('0x1e')](_0x21054a[_0x124e('0x32')][_0x124e('0x1e')]);}_0xad3560[_0x124e('0x3a')]=qs['sort'](_0x21054a[_0x124e('0x32')][_0x124e('0x3b')]);_0xad3560[_0x124e('0x3c')]=qs[_0x124e('0x34')](_[_0x124e('0x3d')](_0x21054a['query'],_0x4ff0ac[_0x124e('0x34')]),_0xb3e82d);if(_0x21054a[_0x124e('0x32')][_0x124e('0x3e')]){_0xad3560[_0x124e('0x3c')]=_[_0x124e('0x3f')](_0xad3560['where'],{'$or':_[_0x124e('0x2e')](_0xb3e82d,function(_0x58bebe){if(_0x58bebe[_0x124e('0x30')]!=='VIRTUAL'){var _0xddb17d={};_0xddb17d[_0x58bebe[_0x124e('0x2b')]]={'$like':'%'+_0x21054a[_0x124e('0x32')][_0x124e('0x3e')]+'%'};return _0xddb17d;}})});}_0xad3560=_[_0x124e('0x3f')]({},_0xad3560,_0x21054a[_0x124e('0x40')]);var _0x31f985={'where':_0xad3560[_0x124e('0x3c')]};return db[_0x124e('0x41')][_0x124e('0x21')](_0x31f985)[_0x124e('0x27')](function(_0xff8c9e){_0xc518a0[_0x124e('0x21')]=_0xff8c9e;if(_0x21054a[_0x124e('0x32')]['includeAll']){_0xad3560[_0x124e('0x42')]=[{'all':!![]}];}return db[_0x124e('0x41')]['findAll'](_0xad3560);})[_0x124e('0x27')](function(_0x2ef1ac){_0xc518a0[_0x124e('0x43')]=_0x2ef1ac;return _0xc518a0;})[_0x124e('0x27')](respondWithFilteredResult(_0x28f5d7,_0xad3560))[_0x124e('0x44')](handleError(_0x28f5d7,null));};exports[_0x124e('0x45')]=function(_0x540392,_0x46f459){var _0x3af351={'raw':!![],'where':{'id':_0x540392[_0x124e('0x46')]['id']}},_0x3b6c77={};_0x3b6c77[_0x124e('0x31')]=_[_0x124e('0x33')](db[_0x124e('0x41')]['rawAttributes']);_0x3b6c77['query']=_['keys'](_0x540392[_0x124e('0x32')]);_0x3b6c77[_0x124e('0x34')]=_[_0x124e('0x47')](_0x3b6c77['model'],_0x3b6c77['query']);_0x3af351[_0x124e('0x35')]=_[_0x124e('0x47')](_0x3b6c77[_0x124e('0x31')],qs[_0x124e('0x36')](_0x540392[_0x124e('0x32')][_0x124e('0x36')]));_0x3af351[_0x124e('0x35')]=_0x3af351[_0x124e('0x35')][_0x124e('0x37')]?_0x3af351[_0x124e('0x35')]:_0x3b6c77[_0x124e('0x31')];if(_0x540392[_0x124e('0x32')][_0x124e('0x48')]){_0x3af351[_0x124e('0x42')]=[{'all':!![]}];}_0x3af351=_[_0x124e('0x3f')]({},_0x3af351,_0x540392['options']);return db[_0x124e('0x41')]['find'](_0x3af351)[_0x124e('0x27')](handleEntityNotFound(_0x46f459,null))[_0x124e('0x27')](respondWithResult(_0x46f459,null))[_0x124e('0x44')](handleError(_0x46f459,null));};exports[_0x124e('0x49')]=function(_0x43a158,_0x85059){return db[_0x124e('0x41')][_0x124e('0x49')](_0x43a158[_0x124e('0x4a')],{})[_0x124e('0x27')](respondWithResult(_0x85059,0xc9))['catch'](handleError(_0x85059,null));};exports['update']=function(_0x1a9419,_0x35ac7c){if(_0x1a9419[_0x124e('0x4a')]['id']){delete _0x1a9419[_0x124e('0x4a')]['id'];}return db[_0x124e('0x41')][_0x124e('0x4b')]({'where':{'id':_0x1a9419[_0x124e('0x46')]['id']}})[_0x124e('0x27')](handleEntityNotFound(_0x35ac7c,null))['then'](saveUpdates(_0x1a9419['body'],null))[_0x124e('0x27')](respondWithResult(_0x35ac7c,null))['catch'](handleError(_0x35ac7c,null));};exports[_0x124e('0x28')]=function(_0x31e6d8,_0x3a42da){return db[_0x124e('0x41')][_0x124e('0x4b')]({'where':{'id':_0x31e6d8[_0x124e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a42da,null))[_0x124e('0x27')](removeEntity(_0x3a42da,null))[_0x124e('0x44')](handleError(_0x3a42da,null));}; \ No newline at end of file +var _0x8282=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','map','FaxApplication','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','update','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8282,0x16b));var _0x2828=function(_0x5c3149,_0x50e8be){_0x5c3149=_0x5c3149-0x0;var _0x4386eb=_0x8282[_0x5c3149];return _0x4386eb;};'use strict';var emlformat=require(_0x2828('0x0'));var rimraf=require(_0x2828('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2828('0x2'));var moment=require(_0x2828('0x3'));var BPromise=require(_0x2828('0x4'));var Mustache=require(_0x2828('0x5'));var util=require(_0x2828('0x6'));var path=require(_0x2828('0x7'));var sox=require(_0x2828('0x8'));var csv=require(_0x2828('0x9'));var ejs=require(_0x2828('0xa'));var fs=require('fs');var fs_extra=require(_0x2828('0xb'));var _=require('lodash');var squel=require(_0x2828('0xc'));var crypto=require(_0x2828('0xd'));var jsforce=require(_0x2828('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2828('0x9'));var querystring=require(_0x2828('0xf'));var Papa=require('papaparse');var Redis=require(_0x2828('0x10'));var authService=require(_0x2828('0x11'));var qs=require(_0x2828('0x12'));var as=require(_0x2828('0x13'));var hardwareService=require(_0x2828('0x14'));var logger=require(_0x2828('0x15'))(_0x2828('0x16'));var utils=require(_0x2828('0x17'));var config=require(_0x2828('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xea6e99,_0x3196c8){_0x3196c8=_0x3196c8||0xcc;return function(_0x5b8e74){if(_0x5b8e74){return _0xea6e99[_0x2828('0x19')](_0x3196c8);}return _0xea6e99['status'](_0x3196c8)['end']();};}function respondWithResult(_0x2da993,_0xb1cd01){_0xb1cd01=_0xb1cd01||0xc8;return function(_0x38bf39){if(_0x38bf39){return _0x2da993[_0x2828('0x1a')](_0xb1cd01)['json'](_0x38bf39);}};}function respondWithFilteredResult(_0x5a1acf,_0x1ec300){return function(_0x141864){if(_0x141864){var _0x51f0a7=typeof _0x1ec300[_0x2828('0x1b')]===_0x2828('0x1c')&&typeof _0x1ec300[_0x2828('0x1d')]===_0x2828('0x1c');var _0x1c2dcf=_0x141864[_0x2828('0x1e')];var _0x5737be=_0x51f0a7?0x0:_0x1ec300[_0x2828('0x1b')];var _0x2da40f=_0x51f0a7?_0x141864[_0x2828('0x1e')]:_0x1ec300[_0x2828('0x1b')]+_0x1ec300[_0x2828('0x1d')];var _0x4abbd3;if(_0x2da40f>=_0x1c2dcf){_0x2da40f=_0x1c2dcf;_0x4abbd3=0xc8;}else{_0x4abbd3=0xce;}_0x5a1acf['status'](_0x4abbd3);return _0x5a1acf['set'](_0x2828('0x1f'),_0x5737be+'-'+_0x2da40f+'/'+_0x1c2dcf)['json'](_0x141864);}return null;};}function patchUpdates(_0x47a1e2){return function(_0x2ed465){try{jsonpatch[_0x2828('0x20')](_0x2ed465,_0x47a1e2,!![]);}catch(_0x3fa430){return BPromise[_0x2828('0x21')](_0x3fa430);}return _0x2ed465[_0x2828('0x22')]();};}function saveUpdates(_0x2830f1,_0x1391d4){return function(_0x43dd55){if(_0x43dd55){return _0x43dd55['update'](_0x2830f1)['then'](function(_0x194a55){return _0x194a55;});}return null;};}function removeEntity(_0x23dfdc,_0x4d3d5c){return function(_0x29a5ef){if(_0x29a5ef){return _0x29a5ef[_0x2828('0x23')]()[_0x2828('0x24')](function(){_0x23dfdc[_0x2828('0x1a')](0xcc)[_0x2828('0x25')]();});}};}function handleEntityNotFound(_0x4c9f81,_0x52a84d){return function(_0x4a0e5d){if(!_0x4a0e5d){_0x4c9f81[_0x2828('0x19')](0x194);}return _0x4a0e5d;};}function handleError(_0x2cb3d8,_0x34bea7){_0x34bea7=_0x34bea7||0x1f4;return function(_0x2f4b9b){logger[_0x2828('0x26')](_0x2f4b9b[_0x2828('0x27')]);if(_0x2f4b9b[_0x2828('0x28')]){delete _0x2f4b9b[_0x2828('0x28')];}_0x2cb3d8['status'](_0x34bea7)['send'](_0x2f4b9b);};}exports['index']=function(_0x108fda,_0x457464){var _0x273a1f={},_0x58bdab={},_0x42bb90={'count':0x0,'rows':[]};var _0xa3931f=_[_0x2828('0x29')](db[_0x2828('0x2a')]['rawAttributes'],function(_0x3dc16f){return{'name':_0x3dc16f['fieldName'],'type':_0x3dc16f[_0x2828('0x2b')][_0x2828('0x2c')]};});_0x58bdab['model']=_[_0x2828('0x29')](_0xa3931f,_0x2828('0x28'));_0x58bdab[_0x2828('0x2d')]=_[_0x2828('0x2e')](_0x108fda[_0x2828('0x2d')]);_0x58bdab[_0x2828('0x2f')]=_[_0x2828('0x30')](_0x58bdab[_0x2828('0x31')],_0x58bdab['query']);_0x273a1f[_0x2828('0x32')]=_['intersection'](_0x58bdab[_0x2828('0x31')],qs[_0x2828('0x33')](_0x108fda['query']['fields']));_0x273a1f[_0x2828('0x32')]=_0x273a1f[_0x2828('0x32')][_0x2828('0x34')]?_0x273a1f[_0x2828('0x32')]:_0x58bdab[_0x2828('0x31')];if(!_0x108fda['query'][_0x2828('0x35')](_0x2828('0x36'))){_0x273a1f[_0x2828('0x1d')]=qs[_0x2828('0x1d')](_0x108fda[_0x2828('0x2d')][_0x2828('0x1d')]);_0x273a1f['offset']=qs['offset'](_0x108fda[_0x2828('0x2d')][_0x2828('0x1b')]);}_0x273a1f[_0x2828('0x37')]=qs['sort'](_0x108fda['query'][_0x2828('0x38')]);_0x273a1f[_0x2828('0x39')]=qs[_0x2828('0x2f')](_[_0x2828('0x3a')](_0x108fda[_0x2828('0x2d')],_0x58bdab['filters']),_0xa3931f);if(_0x108fda[_0x2828('0x2d')][_0x2828('0x3b')]){_0x273a1f['where']=_[_0x2828('0x3c')](_0x273a1f[_0x2828('0x39')],{'$or':_[_0x2828('0x29')](_0xa3931f,function(_0x46347d){if(_0x46347d[_0x2828('0x2b')]!==_0x2828('0x3d')){var _0x308e53={};_0x308e53[_0x46347d[_0x2828('0x28')]]={'$like':'%'+_0x108fda[_0x2828('0x2d')][_0x2828('0x3b')]+'%'};return _0x308e53;}})});}_0x273a1f=_[_0x2828('0x3c')]({},_0x273a1f,_0x108fda[_0x2828('0x3e')]);var _0x5438a1={'where':_0x273a1f['where']};return db[_0x2828('0x2a')][_0x2828('0x1e')](_0x5438a1)[_0x2828('0x24')](function(_0x374a6d){_0x42bb90[_0x2828('0x1e')]=_0x374a6d;if(_0x108fda[_0x2828('0x2d')]['includeAll']){_0x273a1f[_0x2828('0x3f')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x273a1f);})['then'](function(_0x879f1b){_0x42bb90[_0x2828('0x40')]=_0x879f1b;return _0x42bb90;})[_0x2828('0x24')](respondWithFilteredResult(_0x457464,_0x273a1f))[_0x2828('0x41')](handleError(_0x457464,null));};exports[_0x2828('0x42')]=function(_0x73c70d,_0x210c24){var _0x161fb5={'raw':!![],'where':{'id':_0x73c70d[_0x2828('0x43')]['id']}},_0x29c490={};_0x29c490[_0x2828('0x31')]=_[_0x2828('0x2e')](db[_0x2828('0x2a')][_0x2828('0x44')]);_0x29c490['query']=_[_0x2828('0x2e')](_0x73c70d['query']);_0x29c490[_0x2828('0x2f')]=_['intersection'](_0x29c490[_0x2828('0x31')],_0x29c490[_0x2828('0x2d')]);_0x161fb5[_0x2828('0x32')]=_['intersection'](_0x29c490[_0x2828('0x31')],qs[_0x2828('0x33')](_0x73c70d['query']['fields']));_0x161fb5[_0x2828('0x32')]=_0x161fb5[_0x2828('0x32')][_0x2828('0x34')]?_0x161fb5['attributes']:_0x29c490[_0x2828('0x31')];if(_0x73c70d[_0x2828('0x2d')][_0x2828('0x45')]){_0x161fb5['include']=[{'all':!![]}];}_0x161fb5=_[_0x2828('0x3c')]({},_0x161fb5,_0x73c70d[_0x2828('0x3e')]);return db[_0x2828('0x2a')]['find'](_0x161fb5)[_0x2828('0x24')](handleEntityNotFound(_0x210c24,null))[_0x2828('0x24')](respondWithResult(_0x210c24,null))['catch'](handleError(_0x210c24,null));};exports[_0x2828('0x46')]=function(_0x4cc063,_0x36360a){return db['FaxApplication'][_0x2828('0x46')](_0x4cc063[_0x2828('0x47')],{})['then'](respondWithResult(_0x36360a,0xc9))[_0x2828('0x41')](handleError(_0x36360a,null));};exports[_0x2828('0x48')]=function(_0x39a391,_0x385ed9){if(_0x39a391[_0x2828('0x47')]['id']){delete _0x39a391[_0x2828('0x47')]['id'];}return db[_0x2828('0x2a')]['find']({'where':{'id':_0x39a391['params']['id']}})[_0x2828('0x24')](handleEntityNotFound(_0x385ed9,null))[_0x2828('0x24')](saveUpdates(_0x39a391[_0x2828('0x47')],null))[_0x2828('0x24')](respondWithResult(_0x385ed9,null))[_0x2828('0x41')](handleError(_0x385ed9,null));};exports['destroy']=function(_0x26646a,_0x5364c7){return db[_0x2828('0x2a')][_0x2828('0x49')]({'where':{'id':_0x26646a['params']['id']}})[_0x2828('0x24')](handleEntityNotFound(_0x5364c7,null))[_0x2828('0x24')](removeEntity(_0x5364c7,null))[_0x2828('0x41')](handleError(_0x5364c7,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b466482..5cc9bbf 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 _0x7b96=['api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x7b96,0xe7));var _0x67b9=function(_0x50636d,_0x422a17){_0x50636d=_0x50636d-0x0;var _0x4a41f3=_0x7b96[_0x50636d];return _0x4a41f3;};'use strict';var _=require(_0x67b9('0x0'));var util=require(_0x67b9('0x1'));var logger=require(_0x67b9('0x2'))(_0x67b9('0x3'));var moment=require(_0x67b9('0x4'));var BPromise=require(_0x67b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67b9('0x6'));var rimraf=require('rimraf');var config=require(_0x67b9('0x7'));var attributes=require(_0x67b9('0x8'));module['exports']=function(_0xd11923,_0x248068){return _0xd11923['define'](_0x67b9('0x9'),attributes,{'tableName':_0x67b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x67b9('0xb'),'collate':_0x67b9('0xc')});}; \ No newline at end of file +var _0x269d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','lodash','util','api'];(function(_0x222b92,_0x4da885){var _0x20b006=function(_0x210eb0){while(--_0x210eb0){_0x222b92['push'](_0x222b92['shift']());}};_0x20b006(++_0x4da885);}(_0x269d,0xda));var _0xd269=function(_0x5e3839,_0x4f9863){_0x5e3839=_0x5e3839-0x0;var _0x5d0ff8=_0x269d[_0x5e3839];return _0x5d0ff8;};'use strict';var _=require(_0xd269('0x0'));var util=require(_0xd269('0x1'));var logger=require('../../config/logger')(_0xd269('0x2'));var moment=require(_0xd269('0x3'));var BPromise=require(_0xd269('0x4'));var rp=require(_0xd269('0x5'));var fs=require('fs');var path=require(_0xd269('0x6'));var rimraf=require(_0xd269('0x7'));var config=require(_0xd269('0x8'));var attributes=require(_0xd269('0x9'));module[_0xd269('0xa')]=function(_0x5948bb,_0x18e0a6){return _0x5948bb['define'](_0xd269('0xb'),attributes,{'tableName':_0xd269('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 2b7fc8e..f18d815 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 _0x6ced=['raw','where','limit','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','update','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ced,0x116));var _0xd6ce=function(_0x2f2f25,_0x35537a){_0x2f2f25=_0x2f2f25-0x0;var _0x3a7434=_0x6ced[_0x2f2f25];return _0x3a7434;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6ce('0x0'));var BPromise=require(_0xd6ce('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6ce('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6ce('0x3'))(_0xd6ce('0x4'));var config=require('../../config/environment');var jayson=require(_0xd6ce('0x5'));var client=jayson[_0xd6ce('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x543e72,_0x5cb130,_0x21fd09){return new BPromise(function(_0x466a43,_0x5abd24){return client[_0xd6ce('0x7')](_0x543e72,_0x21fd09)[_0xd6ce('0x8')](function(_0x2c790f){logger[_0xd6ce('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5cb130,_0xd6ce('0xa'));logger[_0xd6ce('0xb')](_0xd6ce('0xc'),_0x5cb130,_0xd6ce('0xa'),JSON['stringify'](_0x2c790f));if(_0x2c790f[_0xd6ce('0xd')]){if(_0x2c790f[_0xd6ce('0xd')][_0xd6ce('0xe')]===0x1f4){logger['error'](_0xd6ce('0xf'),_0x5cb130,_0x2c790f['error'][_0xd6ce('0x10')]);return _0x5abd24(_0x2c790f[_0xd6ce('0xd')]['message']);}logger[_0xd6ce('0xd')](_0xd6ce('0xf'),_0x5cb130,_0x2c790f[_0xd6ce('0xd')][_0xd6ce('0x10')]);return _0x466a43(_0x2c790f[_0xd6ce('0xd')]['message']);}else{logger[_0xd6ce('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5cb130,_0xd6ce('0xa'));_0x466a43(_0x2c790f[_0xd6ce('0x11')]['message']);}})[_0xd6ce('0x12')](function(_0x4385e4){logger['error'](_0xd6ce('0xf'),_0x5cb130,_0x4385e4);_0x5abd24(_0x4385e4);});});}exports[_0xd6ce('0x13')]=function(_0x3d089f){var _0x498e4b=this;return new Promise(function(_0x421d9b,_0x5d007a){return db['FaxApplication'][_0xd6ce('0x14')](_0x3d089f['body'],{'raw':_0x3d089f[_0xd6ce('0x15')]?_0x3d089f[_0xd6ce('0x15')][_0xd6ce('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d089f['options']?_0x3d089f['options'][_0xd6ce('0x17')]||null:null,'attributes':_0x3d089f[_0xd6ce('0x15')]?_0x3d089f[_0xd6ce('0x15')]['attributes']||null:null,'limit':_0x3d089f[_0xd6ce('0x15')]?_0x3d089f[_0xd6ce('0x15')][_0xd6ce('0x18')]||null:null})[_0xd6ce('0x8')](function(_0x5bdeb9){logger['info']('UpdateFaxApplication',_0x3d089f);logger[_0xd6ce('0xb')](_0xd6ce('0x13'),_0x3d089f,JSON['stringify'](_0x5bdeb9));_0x421d9b(_0x5bdeb9);})[_0xd6ce('0x12')](function(_0x24d69b){logger['error']('UpdateFaxApplication',_0x24d69b[_0xd6ce('0x10')],_0x3d089f);_0x5d007a(_0x498e4b[_0xd6ce('0xd')](0x1f4,_0x24d69b['message']));});});}; \ No newline at end of file +var _0xf463=['attributes','then','UpdateFaxApplication','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxApplication','update','body','options','raw'];(function(_0x24c32f,_0x53a058){var _0x3209ba=function(_0x3ba419){while(--_0x3ba419){_0x24c32f['push'](_0x24c32f['shift']());}};_0x3209ba(++_0x53a058);}(_0xf463,0x94));var _0x3f46=function(_0x5223b9,_0x298d66){_0x5223b9=_0x5223b9-0x0;var _0x332163=_0xf463[_0x5223b9];return _0x332163;};'use strict';var _=require('lodash');var util=require(_0x3f46('0x0'));var moment=require('moment');var BPromise=require(_0x3f46('0x1'));var rs=require(_0x3f46('0x2'));var fs=require('fs');var Redis=require(_0x3f46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f46('0x4'));var logger=require(_0x3f46('0x5'))(_0x3f46('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f46('0x7'));var client=jayson[_0x3f46('0x8')][_0x3f46('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5626d5,_0x3ba556,_0x288523){return new BPromise(function(_0x43b630,_0x3d1c58){return client[_0x3f46('0xa')](_0x5626d5,_0x288523)['then'](function(_0x27985d){logger[_0x3f46('0xb')](_0x3f46('0xc'),_0x3ba556,_0x3f46('0xd'));logger[_0x3f46('0xe')](_0x3f46('0xf'),_0x3ba556,_0x3f46('0xd'),JSON[_0x3f46('0x10')](_0x27985d));if(_0x27985d[_0x3f46('0x11')]){if(_0x27985d[_0x3f46('0x11')][_0x3f46('0x12')]===0x1f4){logger[_0x3f46('0x11')](_0x3f46('0xc'),_0x3ba556,_0x27985d['error']['message']);return _0x3d1c58(_0x27985d[_0x3f46('0x11')][_0x3f46('0x13')]);}logger[_0x3f46('0x11')](_0x3f46('0xc'),_0x3ba556,_0x27985d['error'][_0x3f46('0x13')]);return _0x43b630(_0x27985d['error'][_0x3f46('0x13')]);}else{logger[_0x3f46('0xb')](_0x3f46('0xc'),_0x3ba556,'request\x20sent');_0x43b630(_0x27985d[_0x3f46('0x14')][_0x3f46('0x13')]);}})['catch'](function(_0x186678){logger[_0x3f46('0x11')]('FaxApplication,\x20%s,\x20%s',_0x3ba556,_0x186678);_0x3d1c58(_0x186678);});});}exports['UpdateFaxApplication']=function(_0xfe12d3){var _0x551ee7=this;return new Promise(function(_0x532bdb,_0x3ff9fe){return db[_0x3f46('0x15')][_0x3f46('0x16')](_0xfe12d3[_0x3f46('0x17')],{'raw':_0xfe12d3['options']?_0xfe12d3[_0x3f46('0x18')][_0x3f46('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfe12d3['options']?_0xfe12d3[_0x3f46('0x18')]['where']||null:null,'attributes':_0xfe12d3[_0x3f46('0x18')]?_0xfe12d3[_0x3f46('0x18')][_0x3f46('0x1a')]||null:null,'limit':_0xfe12d3[_0x3f46('0x18')]?_0xfe12d3['options']['limit']||null:null})[_0x3f46('0x1b')](function(_0x149c80){logger[_0x3f46('0xb')](_0x3f46('0x1c'),_0xfe12d3);logger[_0x3f46('0xe')](_0x3f46('0x1c'),_0xfe12d3,JSON[_0x3f46('0x10')](_0x149c80));_0x532bdb(_0x149c80);})['catch'](function(_0x2a375d){logger[_0x3f46('0x11')](_0x3f46('0x1c'),_0x2a375d[_0x3f46('0x13')],_0xfe12d3);_0x3ff9fe(_0x551ee7['error'](0x1f4,_0x2a375d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ecdbfac..cfe706a 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 _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file +var _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0xee9c,_0x119f00){var _0x2826fe=function(_0x6b7e3c){while(--_0x6b7e3c){_0xee9c['push'](_0xee9c['shift']());}};_0x2826fe(++_0x119f00);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4fdb2e,_0x1f0ad9){_0x4fdb2e=_0x4fdb2e-0x0;var _0x2f415a=_0x9c00[_0x4fdb2e];return _0x2f415a;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index be7f636..9b8ba31 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 _0x6b51=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x228251,_0x591cec){var _0x5e3a74=function(_0x2694da){while(--_0x2694da){_0x228251['push'](_0x228251['shift']());}};_0x5e3a74(++_0x591cec);}(_0x6b51,0xc6));var _0x16b5=function(_0x5f508b,_0x451d17){_0x5f508b=_0x5f508b-0x0;var _0x24abb1=_0x6b51[_0x5f508b];return _0x24abb1;};'use strict';var Sequelize=require(_0x16b5('0x0'));module[_0x16b5('0x1')]={'closed':{'type':Sequelize[_0x16b5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x16b5('0x3')]},'disposition':{'type':Sequelize[_0x16b5('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x16b5('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x16b5('0x3')]},'fax':{'type':Sequelize[_0x16b5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x16b5('0x5')]('in',_0x16b5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x16b5('0x5')]('in',_0x16b5('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x99b7=['BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0xb303d6,_0x2b0e0c){var _0x1bdc54=function(_0x26037a){while(--_0x26037a){_0xb303d6['push'](_0xb303d6['shift']());}};_0x1bdc54(++_0x2b0e0c);}(_0x99b7,0xef));var _0x799b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x99b7[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x799b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x799b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x799b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x799b('0x2')]},'note':{'type':Sequelize[_0x799b('0x2')]},'read1stAt':{'type':Sequelize[_0x799b('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x799b('0x4')]('in',_0x799b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x799b('0x4')]('in',_0x799b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 8c5a1b0..d7b012a 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 _0x968a=['omit','getMessages','findOne','hasOwnProperty','pick','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','download','join','files','tmp','root','server','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createWriteStream','log','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','talking','answered','closed','waiting','UserId','unmanaged','total','index','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','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_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','FaxAccountId','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','Sequelize','QueryTypes','SELECT','clone','i.id','contactName','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','merge','catch','create','body','update','destroy','addMessage','FaxMessage','ids'];(function(_0x4de283,_0x4bdbbb){var _0x5aeeeb=function(_0x4b4d56){while(--_0x4b4d56){_0x4de283['push'](_0x4de283['shift']());}};_0x5aeeeb(++_0x4bdbbb);}(_0x968a,0x1da));var _0xa968=function(_0x1d45b6,_0x1d6a19){_0x1d45b6=_0x1d45b6-0x0;var _0x3aff7d=_0x968a[_0x1d45b6];return _0x3aff7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa968('0x0'));var zipdir=require(_0xa968('0x1'));var jsonpatch=require(_0xa968('0x2'));var rp=require('request-promise');var moment=require(_0xa968('0x3'));var BPromise=require(_0xa968('0x4'));var Mustache=require(_0xa968('0x5'));var util=require(_0xa968('0x6'));var path=require(_0xa968('0x7'));var sox=require('sox');var csv=require(_0xa968('0x8'));var ejs=require(_0xa968('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa968('0xa'));var squel=require(_0xa968('0xb'));var crypto=require(_0xa968('0xc'));var jsforce=require(_0xa968('0xd'));var deskjs=require(_0xa968('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa968('0xf'));var Papa=require('papaparse');var Redis=require(_0xa968('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa968('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa968('0x12'))(_0xa968('0x13'));var utils=require(_0xa968('0x14'));var config=require(_0xa968('0x15'));var licenseUtil=require(_0xa968('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa968('0x17')](config[_0xa968('0x18')],{'host':_0xa968('0x19'),'port':0x18eb});var socket=require(_0xa968('0x1a'))(new Redis(config[_0xa968('0x18')]));require(_0xa968('0x1b'))[_0xa968('0x1c')](socket);function respondWithStatusCode(_0x49e629,_0xf01c0b){_0xf01c0b=_0xf01c0b||0xcc;return function(_0x56fd92){if(_0x56fd92){return _0x49e629[_0xa968('0x1d')](_0xf01c0b);}return _0x49e629['status'](_0xf01c0b)['end']();};}function respondWithResult(_0x3e2483,_0x40d5ef){_0x40d5ef=_0x40d5ef||0xc8;return function(_0x2bfdac){if(_0x2bfdac){return _0x3e2483[_0xa968('0x1e')](_0x40d5ef)[_0xa968('0x1f')](_0x2bfdac);}};}function respondWithFilteredResult(_0x9e76b4,_0x1373e7){return function(_0x43ed23){if(_0x43ed23){var _0x231ee3=typeof _0x1373e7[_0xa968('0x20')]===_0xa968('0x21')&&typeof _0x1373e7[_0xa968('0x22')]==='undefined';var _0x408441=_0x43ed23[_0xa968('0x23')];var _0x1f578d=_0x231ee3?0x0:_0x1373e7[_0xa968('0x20')];var _0x3c80a7=_0x231ee3?_0x43ed23[_0xa968('0x23')]:_0x1373e7['offset']+_0x1373e7['limit'];var _0x5624b8;if(_0x3c80a7>=_0x408441){_0x3c80a7=_0x408441;_0x5624b8=0xc8;}else{_0x5624b8=0xce;}_0x9e76b4[_0xa968('0x1e')](_0x5624b8);return _0x9e76b4[_0xa968('0x24')](_0xa968('0x25'),_0x1f578d+'-'+_0x3c80a7+'/'+_0x408441)['json'](_0x43ed23);}return null;};}function patchUpdates(_0x24e4ab){return function(_0x63f28e){try{jsonpatch[_0xa968('0x26')](_0x63f28e,_0x24e4ab,!![]);}catch(_0x5b4e41){return BPromise[_0xa968('0x27')](_0x5b4e41);}return _0x63f28e[_0xa968('0x28')]();};}function saveUpdates(_0x43afae,_0x216b1b){return function(_0x1aa853){if(_0x1aa853){return _0x1aa853['update'](_0x43afae)[_0xa968('0x29')](function(_0x1b81f1){return _0x1b81f1;});}return null;};}function removeEntity(_0x26c03b,_0x3c2b19){return function(_0x46439f){if(_0x46439f){return _0x46439f['destroy']()[_0xa968('0x29')](function(){_0x26c03b['status'](0xcc)[_0xa968('0x2a')]();});}};}function handleEntityNotFound(_0xd0d5d0,_0x3e78ea){return function(_0x3ea9db){if(!_0x3ea9db){_0xd0d5d0[_0xa968('0x1d')](0x194);}return _0x3ea9db;};}function handleError(_0xe6d29c,_0x4cba16){_0x4cba16=_0x4cba16||0x1f4;return function(_0x137260){logger[_0xa968('0x2b')](_0x137260[_0xa968('0x2c')]);if(_0x137260[_0xa968('0x2d')]){delete _0x137260['name'];}_0xe6d29c['status'](_0x4cba16)[_0xa968('0x2e')](_0x137260);};}function getInteractionUsers(_0x54a04b,_0x2b0954){return new BPromise(function(_0x494074,_0x1859da){try{if(_0x2b0954[_0x54a04b['id']]){_0x54a04b[_0xa968('0x2f')]=_[_0xa968('0x30')](_0x2b0954[_0x54a04b['id']],function(_0x27bc47){return{'id':_0x27bc47['id'],'fullname':_0x27bc47[_0xa968('0x31')]};});}}catch(_0x89f794){_0x1859da(_0x89f794);}_0x494074(_0x54a04b);});}function getInteractionTags(_0x2cde76,_0x4485dd){return new BPromise(function(_0x3b3cf0,_0x193424){try{if(_0x2cde76[_0xa968('0x32')]){_0x2cde76[_0xa968('0x33')]=[];_0x2cde76[_0xa968('0x32')]['split'](',')[_0xa968('0x34')](function(_0x349900){_0x2cde76[_0xa968('0x33')][_0xa968('0x35')](_0x4485dd[_0x349900]);});}delete _0x2cde76[_0xa968('0x32')];}catch(_0x45f91f){_0x193424(_0x45f91f);}_0x3b3cf0(_0x2cde76);});}function updateFaxInteraction(_0x6e5cce,_0x516d6b,_0x3afbcf){return new BPromise(function(_0x2a9b4e,_0xbea33c){return getInteractionUsers(_0x6e5cce,_0x3afbcf)[_0xa968('0x29')](function(_0x50d9cb){return getInteractionTags(_0x50d9cb,_0x516d6b);})[_0xa968('0x29')](function(_0x3f1a6b){return getStateInteraction(_0x3f1a6b);})[_0xa968('0x29')](function(_0x1cf35c){_0x2a9b4e(_0x1cf35c);})['catch'](function(_0x4b3adb){_0xbea33c(_0x4b3adb);});});}function getStateInteraction(_0x55cf64){return new BPromise(function(_0x23644f){_0x55cf64['waiting']=0x0;_0x55cf64[_0xa968('0x36')]=0x0;_0x55cf64[_0xa968('0x37')]=0x0;_0x55cf64['unmanaged']=0x0;_0x55cf64['total']=0x0;if(!_0x55cf64[_0xa968('0x38')]&&!_0x55cf64['UserId']){_0x55cf64[_0xa968('0x39')]+=0x1;}if(!_0x55cf64['closed']&&_0x55cf64['UserId']){_0x55cf64[_0xa968('0x36')]+=0x1;if(_0x55cf64[_0xa968('0x39')]){_0x55cf64['waiting']-=0x1;}}if(_0x55cf64['closed']&&_0x55cf64[_0xa968('0x3a')]){_0x55cf64[_0xa968('0x37')]+=0x1;if(_0x55cf64['talking']){_0x55cf64[_0xa968('0x36')]-=0x1;}}if(_0x55cf64[_0xa968('0x38')]&&!_0x55cf64['UserId']){_0x55cf64[_0xa968('0x3b')]+=0x1;if(_0x55cf64[_0xa968('0x39')]){_0x55cf64[_0xa968('0x39')]-=0x1;}}_0x55cf64[_0xa968('0x3c')]+=0x1;_0x23644f(_0x55cf64);});}exports[_0xa968('0x3d')]=function(_0x574f9f,_0x3f501e){var _0x281484={},_0x312f55={},_0x191a08={'count':0x0,'rows':[]};var _0x761aa9=_['map'](db[_0xa968('0x3e')][_0xa968('0x3f')],function(_0x28c606){return{'name':_0x28c606[_0xa968('0x40')],'type':_0x28c606[_0xa968('0x41')]['key']};});_0x312f55[_0xa968('0x42')]=_['map'](_0x761aa9,_0xa968('0x2d'));_0x312f55[_0xa968('0x43')]=_[_0xa968('0x44')](_0x574f9f[_0xa968('0x43')]);_0x312f55[_0xa968('0x45')]=_[_0xa968('0x46')](_0x312f55['model'],_0x312f55[_0xa968('0x43')]);_0x281484[_0xa968('0x47')]=_[_0xa968('0x46')](_0x312f55[_0xa968('0x42')],qs[_0xa968('0x48')](_0x574f9f[_0xa968('0x43')]['fields']));_0x281484[_0xa968('0x47')]=_0x281484[_0xa968('0x47')][_0xa968('0x49')]?_0x281484[_0xa968('0x47')]:_0x312f55[_0xa968('0x42')];if(!_0x574f9f[_0xa968('0x43')]['hasOwnProperty'](_0xa968('0x4a'))){_0x281484[_0xa968('0x22')]=qs[_0xa968('0x22')](_0x574f9f[_0xa968('0x43')][_0xa968('0x22')]);_0x281484[_0xa968('0x20')]=qs[_0xa968('0x20')](_0x574f9f['query'][_0xa968('0x20')]);}_0x281484[_0xa968('0x4b')]=qs[_0xa968('0x4c')](_0x574f9f[_0xa968('0x43')][_0xa968('0x4c')]);_0x281484[_0xa968('0x4d')]=qs['filters'](_['pick'](_0x574f9f[_0xa968('0x43')],_0x312f55[_0xa968('0x45')]),_0x761aa9);var _0x2a95bc=[];var _0x52ba44=squel[_0xa968('0x4e')]()[_0xa968('0x4f')]('id')[_0xa968('0x4f')](_0xa968('0x2d'))['field']('color')['from']('tools_tags');var _0x1a658a=squel[_0xa968('0x4e')]()[_0xa968('0x4f')]('u.id')[_0xa968('0x4f')](_0xa968('0x50'))[_0xa968('0x4f')](_0xa968('0x51'))[_0xa968('0x52')](_0xa968('0x53'),'ui')[_0xa968('0x54')](_0xa968('0x55'),'u',_0xa968('0x56'));var _0x1d7ea3=squel[_0xa968('0x4e')]()[_0xa968('0x52')](_0xa968('0x57'),'i')[_0xa968('0x54')]('cm_contacts','c',_0xa968('0x58'))[_0xa968('0x54')](_0xa968('0x55'),'o',_0xa968('0x59'))['left_join'](_0xa968('0x5a'),'a',_0xa968('0x5b'))[_0xa968('0x54')](_0xa968('0x5c'),'me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0xa968('0x5d'),'it',_0xa968('0x5e'))[_0xa968('0x54')](_0xa968('0x5f'),'t',_0xa968('0x60'));var _0x7c0cdc=squel[_0xa968('0x61')]();var _0x557ca5=[];var _0x176171=squel[_0xa968('0x61')]();var _0x51b53f;if(_0x574f9f['query'][_0xa968('0x62')]){_0x51b53f=as[_0xa968('0x63')](_0x574f9f['query'][_0xa968('0x62')]);var _0x5003b6=_0x51b53f['sqlOperator'];for(var _0xd54266=0x0;_0xd54266<_0x51b53f['conditions'][_0xa968('0x49')];_0xd54266++){var _0x2c0527=_0x51b53f[_0xa968('0x64')][_0xd54266];var _0x526ade='i';var _0x4c8855=_['find'](_0x761aa9,[_0xa968('0x2d'),_0x2c0527[_0xa968('0x4f')]]);if(!_0x4c8855){switch(_0x2c0527[_0xa968('0x4f')]){case _0xa968('0x65'):if(_0x2c0527[_0xa968('0x66')]==0x1){_0x1d7ea3['having']('`'+_0x2c0527[_0xa968('0x4f')]+'`\x20=\x200');}else{_0x1d7ea3[_0xa968('0x67')]('`'+_0x2c0527[_0xa968('0x4f')]+'`\x20>\x200');}break;case'Contact':if(_0x2c0527['operator']===_0xa968('0x68')){if(_0x2c0527[_0xa968('0x66')][_0xa968('0x69')]('\x20')['length']>0x1){_0x7c0cdc[_0x5003b6](_0xa968('0x6a'),qs['getFullTextValue'](_0x2c0527[_0xa968('0x66')]),null);}else{var _0x9281a8='%'+_0x2c0527[_0xa968('0x66')]+'%';_0x7c0cdc[_0x5003b6](_0xa968('0x6b'),_0x9281a8,_0x9281a8,_0x9281a8);}}else{_0x4c8855=_[_0xa968('0x6c')](_0x761aa9,[_0xa968('0x2d'),_0xa968('0x6d')]);_0x2c0527[_0xa968('0x4f')]='ContactId';_0x2cd185=as[_0xa968('0x6e')](_0x526ade,_0x4c8855['type'],_0x2c0527);_0x7c0cdc[_0x5003b6](_0x2cd185[_0xa968('0x6f')],_0x2cd185[_0xa968('0x66')]['start'],_0x2cd185[_0xa968('0x66')][_0xa968('0x2a')]);}break;case _0xa968('0x70'):var _0x109ab8=_0x2c0527['value'][_0xa968('0x69')](',')[_0xa968('0x30')](function(_0x94443c){return Number(_0x94443c);});_0x109ab8[_0xa968('0x34')](function(_0x2a264d){_0x176171['or'](_0xa968('0x71'),'%,'+_0x2a264d+',%');});_0x557ca5=_['union'](_0x557ca5,_0x109ab8);break;case _0xa968('0x72'):if(_0x2c0527['operator']==='$substring'){_0x7c0cdc[_0x5003b6](_0xa968('0x73'),'%'+_0x2c0527['value']+'%',null);}else{_0x4c8855=_[_0xa968('0x6c')](_0x761aa9,['name',_0xa968('0x3a')]);_0x2c0527[_0xa968('0x4f')]=_0xa968('0x3a');_0x2cd185=as[_0xa968('0x6e')](_0x526ade,_0x4c8855[_0xa968('0x41')],_0x2c0527);_0x7c0cdc[_0x5003b6](_0x2cd185[_0xa968('0x6f')],_0x2cd185[_0xa968('0x66')][_0xa968('0x74')],_0x2cd185['value'][_0xa968('0x2a')]);}break;case'body':_0x2cd185=as[_0xa968('0x6e')]('me',null,_0x2c0527);_0x7c0cdc[_0x5003b6](_0x2cd185[_0xa968('0x6f')],_0x2cd185['value']['start'],_0x2cd185[_0xa968('0x66')]['end']);break;}}else{var _0x2cd185=as[_0xa968('0x6e')](_0x526ade,_0x4c8855[_0xa968('0x41')],_0x2c0527);_0x7c0cdc[_0x5003b6](_0x2cd185['text'],_0x2cd185[_0xa968('0x66')][_0xa968('0x74')],_0x2cd185[_0xa968('0x66')][_0xa968('0x2a')]);}}}else{var _0x95131b=_(_0x574f9f[_0xa968('0x43')])['keys']()['map'](function(_0x32a491){return _[_0xa968('0x75')](_0x761aa9,['name',_0x32a491])?_0x32a491:undefined;})[_0xa968('0x76')]()['value']();if(!_['isEmpty'](_0x95131b)){_0x95131b[_0xa968('0x34')](function(_0x16d9c7){if(_0x16d9c7===_0xa968('0x77')){_0x1d7ea3[_0xa968('0x4d')](_0xa968('0x78'),[][_0xa968('0x79')](_0x574f9f[_0xa968('0x43')][_0x16d9c7]));}else if(_0x16d9c7===_0xa968('0x7a')){var _0x5ea881=JSON[_0xa968('0x7b')](_0x574f9f['query'][_0x16d9c7])[_0xa968('0x7c')];var _0x4a17b5=JSON['parse'](_0x574f9f[_0xa968('0x43')][_0x16d9c7])[_0xa968('0x7d')];_0x1d7ea3[_0xa968('0x4d')](_0xa968('0x7e'),_0x5ea881,_0x4a17b5);}else{if(_0x574f9f['query'][_0x16d9c7]===_0xa968('0x7f')){_0x1d7ea3[_0xa968('0x4d')]('i.'+_0x16d9c7+_0xa968('0x80'));}else{_0x1d7ea3['where']('i.'+_0x16d9c7+_0xa968('0x81'),_0x574f9f['query'][_0x16d9c7]);}}});}if(_0x574f9f['query'][_0xa968('0x82')]){if(_0x574f9f['query']['read']==0x1){_0x1d7ea3[_0xa968('0x67')](_0xa968('0x83'));}else{_0x1d7ea3[_0xa968('0x67')](_0xa968('0x84'));}}if(_0x574f9f[_0xa968('0x43')][_0xa968('0x85')]){_0x557ca5=_[_0xa968('0x86')](_0x574f9f[_0xa968('0x43')][_0xa968('0x85')])?_0x574f9f[_0xa968('0x43')]['tag']:new Array(_0x574f9f[_0xa968('0x43')][_0xa968('0x85')]);_0x557ca5[_0xa968('0x34')](function(_0xbca880){_0x176171['or'](_0xa968('0x71'),'%,'+_0xbca880+',%');});}if(_0x574f9f['query'][_0xa968('0x87')]){var _0x80b21e=_0x574f9f[_0xa968('0x43')][_0xa968('0x87')][_0xa968('0x88')]('\x5c','\x5c\x5c')[_0xa968('0x88')](/'/g,'\x27\x27');if(qs[_0xa968('0x89')](_0x80b21e)){_0x7c0cdc['or']('i.id\x20LIKE\x20?',_0x80b21e+'%')['or'](_0xa968('0x8a'),_0x80b21e+'%');}_0x7c0cdc['or'](_0xa968('0x8b'),_0x80b21e+'%');}}_0x1d7ea3[_0xa968('0x4d')](_0x7c0cdc);_0x1d7ea3[_0xa968('0x8c')]('i.id');var _0x101e5f={'type':db[_0xa968('0x8d')][_0xa968('0x8e')][_0xa968('0x8f')],'raw':!![]};var _0xaedead=_0x1d7ea3[_0xa968('0x90')]();_0xaedead[_0xa968('0x4f')](_0xa968('0x91'));_0xaedead[_0xa968('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa968('0x65'));if(_0x281484[_0xa968('0x4b')]){_0x281484[_0xa968('0x4b')][_0xa968('0x34')](function(_0x5c6683){var _0x25bf7f=_0x5c6683[0x0]===_0xa968('0x92')?_0x5c6683[0x0]:'i.'+_0x5c6683[0x0];_0x1d7ea3[_0xa968('0x4b')](_0x25bf7f,_0x5c6683[0x1]===_0xa968('0x93')?![]:!![]);});}if(!_[_0xa968('0x94')](_0x557ca5)){_0x1d7ea3[_0xa968('0x67')](_0x176171);_0xaedead['where']('t.id\x20IN\x20?',_0x557ca5);}BPromise[_0xa968('0x95')]()['then'](function(){if(!_0x51b53f){if(_0x574f9f[_0xa968('0x43')][_0xa968('0x77')])return;_0xaedead[_0xa968('0x4d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1d7ea3[_0xa968('0x4d')](_0xa968('0x96'));return;}if(_0x574f9f[_0xa968('0x97')][_0xa968('0x98')]!==_0xa968('0x99'))return;return _0x574f9f['user'][_0xa968('0x9a')]({'attributes':['id'],'raw':!![]})[_0xa968('0x29')](function(_0x5d7172){if(_[_0xa968('0x94')](_0x5d7172)){_0xaedead[_0xa968('0x4d')](_0xa968('0x9b'));_0x1d7ea3[_0xa968('0x4d')](_0xa968('0x9b'));}else{_0xaedead[_0xa968('0x4d')](_0xa968('0x78'),_[_0xa968('0x30')](_0x5d7172,'id'));_0x1d7ea3[_0xa968('0x4d')]('i.FaxAccountId\x20IN\x20?',_[_0xa968('0x30')](_0x5d7172,'id'));}});})[_0xa968('0x29')](function(){if(_0x574f9f[_0xa968('0x97')]['role']===_0xa968('0x99')&&!_0x51b53f&&!_0x574f9f[_0xa968('0x43')][_0xa968('0x77')])return[];return db[_0xa968('0x9c')][_0xa968('0x43')](_0xaedead[_0xa968('0x9d')](),_0x101e5f);})['then'](function(_0x274269){_0x191a08[_0xa968('0x23')]=_0x274269[_0xa968('0x49')];if(_0x191a08['count']===0x0)return[];return db['sequelize'][_0xa968('0x43')](_0x52ba44[_0xa968('0x9d')](),_0x101e5f)['then'](function(_0x48255d){_0x2a95bc=_[_0xa968('0x9e')](_0x48255d,'id');_0x101e5f=_['merge'](_0x101e5f,{'model':db[_0xa968('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x574f9f[_0xa968('0x43')][_0xa968('0x48')]){_0x281484[_0xa968('0x47')][_0xa968('0x34')](function(_0x181cd1){_0x1d7ea3['field']('i.'+_0x181cd1);});}else{_0x1d7ea3['field'](_0xa968('0x9f'),_0xa968('0x65'));_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xa0'),_0xa968('0xa1'));_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xa2'),'Account.mandatoryDisposition');_0x1d7ea3['field'](_0xa968('0xa3'),'contactName');_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xa4'));_0x1d7ea3[_0xa968('0x4f')]('c.firstName',_0xa968('0xa5'));_0x1d7ea3['field'](_0xa968('0xa6'),_0xa968('0xa7'));_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xa8'),_0xa968('0xa9'));_0x1d7ea3['field'](_0xa968('0xaa'),_0xa968('0xab'));_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xac'),_0xa968('0xad'));_0x1d7ea3[_0xa968('0x4f')]('c.fax','Contact.fax');_0x1d7ea3[_0xa968('0x4f')](_0xa968('0xae'),_0xa968('0xaf'));_0x1d7ea3[_0xa968('0x4f')]('o.internal',_0xa968('0xb0'));_0x1d7ea3[_0xa968('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa968('0x32'));}if(_0x281484[_0xa968('0x22')])_0x1d7ea3[_0xa968('0x22')](_0x281484['limit']);if(_0x281484[_0xa968('0x20')])_0x1d7ea3[_0xa968('0x20')](_0x281484[_0xa968('0x20')]);return db[_0xa968('0x9c')][_0xa968('0x43')](_0x1d7ea3['toString'](),_0x101e5f);})[_0xa968('0x29')](function(_0x520f4f){if(_0x520f4f['length']>0x0)_0x1a658a[_0xa968('0x4d')](_0xa968('0xb1'),_[_0xa968('0x30')](_0x520f4f,'id'));return db[_0xa968('0x9c')][_0xa968('0x43')](_0x1a658a[_0xa968('0x9d')](),_0x101e5f)['then'](function(_0xf00503){var _0x483693=_[_0xa968('0xb2')](_0xf00503,_0xa968('0xb3'));var _0x56b3c5=[];_0x520f4f[_0xa968('0x34')](function(_0x464309){_0x56b3c5['push'](updateFaxInteraction(_0x464309,_0x2a95bc,_0x483693));});return BPromise[_0xa968('0xb4')](_0x56b3c5);});});})['then'](function(_0x25a9da){_0x191a08[_0xa968('0xb5')]=_0x25a9da;return _0x191a08;})[_0xa968('0x29')](respondWithFilteredResult(_0x3f501e,_0x281484))['catch'](handleError(_0x3f501e,null));};exports[_0xa968('0xb6')]=function(_0x48f799,_0x231702){var _0x5b1be5={'raw':![],'where':{'id':_0x48f799[_0xa968('0xb7')]['id']}},_0xa51940={};_0xa51940[_0xa968('0x42')]=_[_0xa968('0x44')](db[_0xa968('0x3e')][_0xa968('0x3f')]);_0xa51940[_0xa968('0x43')]=_['keys'](_0x48f799['query']);_0xa51940['filters']=_['intersection'](_0xa51940['model'],_0xa51940[_0xa968('0x43')]);_0x5b1be5[_0xa968('0x47')]=_[_0xa968('0x46')](_0xa51940[_0xa968('0x42')],qs[_0xa968('0x48')](_0x48f799[_0xa968('0x43')]['fields']));_0x5b1be5[_0xa968('0x47')]=_0x5b1be5[_0xa968('0x47')]['length']?_0x5b1be5[_0xa968('0x47')]:_0xa51940[_0xa968('0x42')];if(_0x48f799['query'][_0xa968('0xb8')]){_0x5b1be5[_0xa968('0xb9')]=[{'all':!![]}];}_0x5b1be5=_[_0xa968('0xba')]({},_0x5b1be5,_0x48f799['options']);return db[_0xa968('0x3e')][_0xa968('0x6c')](_0x5b1be5)[_0xa968('0x29')](handleEntityNotFound(_0x231702,null))[_0xa968('0x29')](respondWithResult(_0x231702,null))[_0xa968('0xbb')](handleError(_0x231702,null));};exports[_0xa968('0xbc')]=function(_0x3f03cc,_0x426554){return db[_0xa968('0x3e')]['create'](_0x3f03cc[_0xa968('0xbd')],{})[_0xa968('0x29')](respondWithResult(_0x426554,0xc9))[_0xa968('0xbb')](handleError(_0x426554,null));};exports[_0xa968('0xbe')]=function(_0x4241a8,_0xf9b867){if(_0x4241a8['body']['id']){delete _0x4241a8[_0xa968('0xbd')]['id'];}return db[_0xa968('0x3e')][_0xa968('0x6c')]({'where':{'id':_0x4241a8[_0xa968('0xb7')]['id']}})['then'](handleEntityNotFound(_0xf9b867,null))[_0xa968('0x29')](saveUpdates(_0x4241a8[_0xa968('0xbd')],null))['then'](respondWithResult(_0xf9b867,null))[_0xa968('0xbb')](handleError(_0xf9b867,null));};exports[_0xa968('0xbf')]=function(_0x349b28,_0x1b3a82){return db[_0xa968('0x3e')][_0xa968('0x6c')]({'where':{'id':_0x349b28[_0xa968('0xb7')]['id']}})[_0xa968('0x29')](handleEntityNotFound(_0x1b3a82,null))[_0xa968('0x29')](removeEntity(_0x1b3a82,null))[_0xa968('0xbb')](handleError(_0x1b3a82,null));};exports['describe']=function(_0xca33fc,_0x2bdc70){return db[_0xa968('0x3e')]['describe']()[_0xa968('0x29')](respondWithResult(_0x2bdc70,null))[_0xa968('0xbb')](handleError(_0x2bdc70,null));};exports[_0xa968('0xc0')]=function(_0x3c7030,_0x536a2c,_0xcf749b){return db[_0xa968('0xc1')]['find']({'where':{'id':_0x3c7030['params']['id']}})[_0xa968('0x29')](handleEntityNotFound(_0x536a2c,null))['then'](function(_0x32a24f){if(_0x32a24f){return _0x32a24f[_0xa968('0xc0')](_0x3c7030[_0xa968('0xbd')][_0xa968('0xc2')],_[_0xa968('0xc3')](_0x3c7030['body'],[_0xa968('0xc2'),'id'])||{});}})[_0xa968('0x29')](respondWithResult(_0x536a2c,null))['catch'](handleError(_0x536a2c,null));};exports[_0xa968('0xc4')]=function(_0x34898e,_0x4a732e,_0x4c5d53){var _0x44fe2d={'raw':![],'where':{}};var _0x5d0a4a={};var _0x2c86fb={'count':0x0,'rows':[]};return db[_0xa968('0x3e')][_0xa968('0xc5')]({'where':{'id':_0x34898e['params']['id']}})[_0xa968('0x29')](handleEntityNotFound(_0x4a732e,null))[_0xa968('0x29')](function(_0x34abde){if(_0x34abde){_0x5d0a4a[_0xa968('0x42')]=_[_0xa968('0x44')](db[_0xa968('0xc1')][_0xa968('0x3f')]);_0x5d0a4a['query']=_[_0xa968('0x44')](_0x34898e['query']);_0x5d0a4a[_0xa968('0x45')]=_['intersection'](_0x5d0a4a['model'],_0x5d0a4a[_0xa968('0x43')]);_0x44fe2d[_0xa968('0x47')]=_[_0xa968('0x46')](_0x5d0a4a[_0xa968('0x42')],qs[_0xa968('0x48')](_0x34898e[_0xa968('0x43')][_0xa968('0x48')]));_0x44fe2d[_0xa968('0x47')]=_0x44fe2d[_0xa968('0x47')]['length']?_0x44fe2d['attributes']:_0x5d0a4a[_0xa968('0x42')];if(!_0x34898e['query'][_0xa968('0xc6')](_0xa968('0x4a'))){_0x44fe2d[_0xa968('0x22')]=qs['limit'](_0x34898e[_0xa968('0x43')][_0xa968('0x22')]);_0x44fe2d[_0xa968('0x20')]=qs['offset'](_0x34898e[_0xa968('0x43')][_0xa968('0x20')]);}_0x44fe2d['order']=qs[_0xa968('0x4c')](_0x34898e[_0xa968('0x43')][_0xa968('0x4c')]);_0x44fe2d[_0xa968('0x4d')]=qs[_0xa968('0x45')](_[_0xa968('0xc7')](_0x34898e[_0xa968('0x43')],_0x5d0a4a[_0xa968('0x45')]));_0x44fe2d[_0xa968('0x4d')][_0xa968('0xb3')]=_0x34abde['id'];if(_0x34898e[_0xa968('0x43')]['filter']){_0x44fe2d[_0xa968('0x4d')]=_[_0xa968('0xba')](_0x44fe2d[_0xa968('0x4d')],{'$or':_[_0xa968('0x30')](_0x44fe2d[_0xa968('0x47')],function(_0x3ce253){var _0x850ec7={};_0x850ec7[_0x3ce253]={'$like':'%'+_0x34898e[_0xa968('0x43')][_0xa968('0x87')]+'%'};return _0x850ec7;})});}if(_0x34898e['query']['$gte']){var _0x5a01aa=_0x34898e[_0xa968('0x43')][_0xa968('0x7c')][_0xa968('0x69')](',');var _0x48e709={};_0x48e709[_0x5a01aa[0x0]]={'$gte':moment(_0x5a01aa[0x1])['format'](_0xa968('0xc8'))};_0x44fe2d[_0xa968('0x4d')]=_['merge'](_0x44fe2d['where'],_0x48e709);}_0x44fe2d=_[_0xa968('0xba')]({},_0x44fe2d,_0x34898e[_0xa968('0xc9')]);return db['FaxMessage'][_0xa968('0x23')]({'where':_0x44fe2d[_0xa968('0x4d')]})['then'](function(_0x139dbb){_0x2c86fb[_0xa968('0x23')]=_0x139dbb;if(_0x34898e[_0xa968('0x43')][_0xa968('0xb8')]){_0x44fe2d[_0xa968('0xb9')]=[{'all':!![]}];}return db[_0xa968('0xc1')][_0xa968('0xca')](_0x44fe2d);})[_0xa968('0x29')](function(_0x4776c4){_0x2c86fb[_0xa968('0xb5')]=_0x4776c4;return _0x2c86fb;});}})['then'](respondWithFilteredResult(_0x4a732e,_0x44fe2d))['catch'](handleError(_0x4a732e,null));};exports[_0xa968('0xcb')]=function(_0x17bef5,_0x172fe9,_0x10f06c){return db['FaxInteraction'][_0xa968('0x6c')]({'where':{'id':_0x17bef5[_0xa968('0xb7')]['id']}})[_0xa968('0x29')](handleEntityNotFound(_0x172fe9,null))[_0xa968('0x29')](function(_0x138981){if(_0x138981){return _0x138981[_0xa968('0xcc')](_0x17bef5[_0xa968('0xbd')][_0xa968('0xc2')],_[_0xa968('0xc3')](_0x17bef5[_0xa968('0xbd')],[_0xa968('0xc2'),'id'])||{})[_0xa968('0xcd')](function(){return db[_0xa968('0x70')][_0xa968('0xca')]({'attributes':['id',_0xa968('0x2d'),'color'],'where':{'id':_0x17bef5[_0xa968('0xbd')][_0xa968('0xc2')]}});})[_0xa968('0x29')](function(_0x47cc34){socket[_0xa968('0xce')](_0xa968('0xcf'),{'id':Number(_0x17bef5[_0xa968('0xb7')]['id']),'tags':_0x47cc34||[]});return{'id':Number(_0x17bef5[_0xa968('0xb7')]['id']),'tags':_0x47cc34||[]};});}})[_0xa968('0x29')](respondWithResult(_0x172fe9,null))['catch'](handleError(_0x172fe9,null));};exports['removeTags']=function(_0x39d342,_0x357d4a,_0x2c2521){return db['FaxInteraction'][_0xa968('0x6c')]({'where':{'id':_0x39d342[_0xa968('0xb7')]['id']}})['then'](handleEntityNotFound(_0x357d4a,null))[_0xa968('0x29')](function(_0x21fc1f){if(_0x21fc1f){return _0x21fc1f['removeTags'](_0x39d342[_0xa968('0x43')][_0xa968('0xc2')]);}})[_0xa968('0x29')](respondWithStatusCode(_0x357d4a,null))[_0xa968('0xbb')](handleError(_0x357d4a,null));};exports[_0xa968('0xd0')]=function(_0x24010f,_0x195c4f){var _0x2b8607=moment()['unix']()['toString']();var _0x2e1be0=path[_0xa968('0xd1')](config['root'],'server',_0xa968('0xd2'),_0xa968('0xd3'));var _0x1b0432=path[_0xa968('0xd1')](config[_0xa968('0xd4')],_0xa968('0xd5'),_0xa968('0xd2'),'attachments');var _0x533328=path[_0xa968('0xd1')](_0x2e1be0,_0x2b8607);var _0x178082=util['format'](_0xa968('0xd6'),_0x24010f['params']['id'],_0x2b8607);var _0x403f03=path['join'](_0x2e1be0,_0x178082);var _0x266326=[];_0x266326[_0xa968('0x35')]({'model':db['Attachment'],'as':_0xa968('0xd7'),'raw':!![]});var _0x13fe08=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0xa968('0x7a')],'include':_0x266326}];return db[_0xa968('0x3e')][_0xa968('0x6c')]({'where':{'id':_0x24010f['params']['id']},'include':_0x13fe08})['then'](handleEntityNotFound(_0x195c4f,null))[_0xa968('0x29')](function(_0x4487dd){if(_0x4487dd&&_0x4487dd[_0xa968('0xd8')]){var _0x32afe5=_0x4487dd['get']({'plain':!![]});fs[_0xa968('0xd9')](_0x533328);for(var _0x52ef71=0x0;_0x52ef71<_0x32afe5[_0xa968('0xd8')][_0xa968('0x49')];_0x52ef71++){var _0x2b8d4f=_0x32afe5[_0xa968('0xd8')][_0x52ef71]['Attachment'];if(_0x2b8d4f){var _0x2cbbe4=path[_0xa968('0xd1')](_0x1b0432,_0x2b8d4f[_0xa968('0xda')]);if(fs[_0xa968('0xdb')](_0x2cbbe4)){fs['createReadStream'](_0x2cbbe4)['pipe'](fs[_0xa968('0xdc')](path[_0xa968('0xd1')](_0x533328,_0x2b8d4f['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x4388ff,_0x3100b3){zipdir(_0x533328,{'saveTo':_0x403f03},function(_0x4e4cba,_0x2d94a3){if(_0x4e4cba)return _0x3100b3(_0x4e4cba);return _0x4388ff(_0x2d94a3);});})['then'](function(){return new BPromise(function(_0x2f0f06,_0x4ddf08){rimraf(_0x533328,function(_0x149f71){if(_0x149f71)_0x4ddf08(_0x149f71);return _0x2f0f06();});});})[_0xa968('0x29')](function(){return _0x195c4f['download'](_0x403f03,_0x178082,function(_0x54b17d){if(_0x54b17d){console[_0xa968('0xdd')]('err',_0x54b17d);}else{fs[_0xa968('0xde')](_0x403f03);}});});});}else{return _0x195c4f[_0xa968('0x1d')](0xc8);}})['catch'](handleError(_0x195c4f,null));}; \ No newline at end of file +var _0x2522=['download','unix','join','root','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','waiting','talking','answered','unmanaged','closed','UserId','total','index','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','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','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','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','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','keys','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','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)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','all','rows','show','params','rawAttributes','include','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','spread','color','faxInteractionTags:save','removeTags'];(function(_0x936f18,_0x110725){var _0x36b3b7=function(_0x5cd86b){while(--_0x5cd86b){_0x936f18['push'](_0x936f18['shift']());}};_0x36b3b7(++_0x110725);}(_0x2522,0xf2));var _0x2252=function(_0x5c4748,_0x467de7){_0x5c4748=_0x5c4748-0x0;var _0x11dcaa=_0x2522[_0x5c4748];return _0x11dcaa;};'use strict';var emlformat=require(_0x2252('0x0'));var rimraf=require(_0x2252('0x1'));var zipdir=require(_0x2252('0x2'));var jsonpatch=require(_0x2252('0x3'));var rp=require(_0x2252('0x4'));var moment=require(_0x2252('0x5'));var BPromise=require(_0x2252('0x6'));var Mustache=require(_0x2252('0x7'));var util=require(_0x2252('0x8'));var path=require(_0x2252('0x9'));var sox=require(_0x2252('0xa'));var csv=require(_0x2252('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2252('0xc'));var _=require(_0x2252('0xd'));var squel=require(_0x2252('0xe'));var crypto=require(_0x2252('0xf'));var jsforce=require(_0x2252('0x10'));var deskjs=require(_0x2252('0x11'));var toCsv=require(_0x2252('0xb'));var querystring=require(_0x2252('0x12'));var Papa=require('papaparse');var Redis=require(_0x2252('0x13'));var authService=require(_0x2252('0x14'));var qs=require(_0x2252('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2252('0x16'));var logger=require('../../config/logger')(_0x2252('0x17'));var utils=require(_0x2252('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2252('0x19'));var db=require(_0x2252('0x1a'))['db'];config[_0x2252('0x1b')]=_['defaults'](config[_0x2252('0x1b')],{'host':_0x2252('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2252('0x1b')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x2a734a,_0x5ceded){_0x5ceded=_0x5ceded||0xcc;return function(_0x3ec43e){if(_0x3ec43e){return _0x2a734a['sendStatus'](_0x5ceded);}return _0x2a734a['status'](_0x5ceded)[_0x2252('0x1d')]();};}function respondWithResult(_0x4cb697,_0x3bfd5c){_0x3bfd5c=_0x3bfd5c||0xc8;return function(_0x421078){if(_0x421078){return _0x4cb697[_0x2252('0x1e')](_0x3bfd5c)['json'](_0x421078);}};}function respondWithFilteredResult(_0x43eb58,_0x36e316){return function(_0xbafdba){if(_0xbafdba){var _0x41d458=typeof _0x36e316[_0x2252('0x1f')]===_0x2252('0x20')&&typeof _0x36e316[_0x2252('0x21')]===_0x2252('0x20');var _0x203ca0=_0xbafdba[_0x2252('0x22')];var _0x4d011f=_0x41d458?0x0:_0x36e316[_0x2252('0x1f')];var _0x4dac42=_0x41d458?_0xbafdba[_0x2252('0x22')]:_0x36e316[_0x2252('0x1f')]+_0x36e316['limit'];var _0x5f0d87;if(_0x4dac42>=_0x203ca0){_0x4dac42=_0x203ca0;_0x5f0d87=0xc8;}else{_0x5f0d87=0xce;}_0x43eb58[_0x2252('0x1e')](_0x5f0d87);return _0x43eb58[_0x2252('0x23')](_0x2252('0x24'),_0x4d011f+'-'+_0x4dac42+'/'+_0x203ca0)['json'](_0xbafdba);}return null;};}function patchUpdates(_0x89c320){return function(_0x34ba05){try{jsonpatch[_0x2252('0x25')](_0x34ba05,_0x89c320,!![]);}catch(_0x39276f){return BPromise['reject'](_0x39276f);}return _0x34ba05[_0x2252('0x26')]();};}function saveUpdates(_0x5c9c00,_0x5481f5){return function(_0x40d774){if(_0x40d774){return _0x40d774['update'](_0x5c9c00)[_0x2252('0x27')](function(_0x112c58){return _0x112c58;});}return null;};}function removeEntity(_0x1a3736,_0x4fea8c){return function(_0x2363bd){if(_0x2363bd){return _0x2363bd['destroy']()[_0x2252('0x27')](function(){_0x1a3736[_0x2252('0x1e')](0xcc)[_0x2252('0x1d')]();});}};}function handleEntityNotFound(_0x4080ee,_0x14ac4f){return function(_0x3eb55e){if(!_0x3eb55e){_0x4080ee['sendStatus'](0x194);}return _0x3eb55e;};}function handleError(_0x47de17,_0x3d9e66){_0x3d9e66=_0x3d9e66||0x1f4;return function(_0x3f3029){logger[_0x2252('0x28')](_0x3f3029[_0x2252('0x29')]);if(_0x3f3029[_0x2252('0x2a')]){delete _0x3f3029['name'];}_0x47de17['status'](_0x3d9e66)[_0x2252('0x2b')](_0x3f3029);};}function getInteractionUsers(_0x2df4ae,_0x1146f2){return new BPromise(function(_0x2f6b80,_0xcf40b2){try{if(_0x1146f2[_0x2df4ae['id']]){_0x2df4ae[_0x2252('0x2c')]=_[_0x2252('0x2d')](_0x1146f2[_0x2df4ae['id']],function(_0x35a15e){return{'id':_0x35a15e['id'],'fullname':_0x35a15e[_0x2252('0x2e')]};});}}catch(_0x457efe){_0xcf40b2(_0x457efe);}_0x2f6b80(_0x2df4ae);});}function getInteractionTags(_0x572b90,_0x555a22){return new BPromise(function(_0x45d7f2,_0x3505ea){try{if(_0x572b90[_0x2252('0x2f')]){_0x572b90[_0x2252('0x30')]=[];_0x572b90['TagIds'][_0x2252('0x31')](',')[_0x2252('0x32')](function(_0xf1115e){_0x572b90[_0x2252('0x30')]['push'](_0x555a22[_0xf1115e]);});}delete _0x572b90[_0x2252('0x2f')];}catch(_0xe1c2a1){_0x3505ea(_0xe1c2a1);}_0x45d7f2(_0x572b90);});}function updateFaxInteraction(_0x32eb08,_0x92bfcf,_0x5e9f9b){return new BPromise(function(_0x79e0b6,_0x57e60d){return getInteractionUsers(_0x32eb08,_0x5e9f9b)[_0x2252('0x27')](function(_0x250ac6){return getInteractionTags(_0x250ac6,_0x92bfcf);})[_0x2252('0x27')](function(_0x39ee66){return getStateInteraction(_0x39ee66);})[_0x2252('0x27')](function(_0x17979a){_0x79e0b6(_0x17979a);})[_0x2252('0x33')](function(_0x4b1f75){_0x57e60d(_0x4b1f75);});});}function getStateInteraction(_0x32b75e){return new BPromise(function(_0x496390){_0x32b75e[_0x2252('0x34')]=0x0;_0x32b75e[_0x2252('0x35')]=0x0;_0x32b75e[_0x2252('0x36')]=0x0;_0x32b75e[_0x2252('0x37')]=0x0;_0x32b75e['total']=0x0;if(!_0x32b75e[_0x2252('0x38')]&&!_0x32b75e['UserId']){_0x32b75e['waiting']+=0x1;}if(!_0x32b75e[_0x2252('0x38')]&&_0x32b75e[_0x2252('0x39')]){_0x32b75e[_0x2252('0x35')]+=0x1;if(_0x32b75e[_0x2252('0x34')]){_0x32b75e[_0x2252('0x34')]-=0x1;}}if(_0x32b75e['closed']&&_0x32b75e[_0x2252('0x39')]){_0x32b75e['answered']+=0x1;if(_0x32b75e['talking']){_0x32b75e[_0x2252('0x35')]-=0x1;}}if(_0x32b75e[_0x2252('0x38')]&&!_0x32b75e[_0x2252('0x39')]){_0x32b75e['unmanaged']+=0x1;if(_0x32b75e[_0x2252('0x34')]){_0x32b75e[_0x2252('0x34')]-=0x1;}}_0x32b75e[_0x2252('0x3a')]+=0x1;_0x496390(_0x32b75e);});}exports[_0x2252('0x3b')]=function(_0xb0d3db,_0x20c05e){var _0x5574e8={},_0x5dbec2={},_0x108637={'count':0x0,'rows':[]};var _0x3412b1=_[_0x2252('0x2d')](db['FaxInteraction']['rawAttributes'],function(_0x2f4548){return{'name':_0x2f4548[_0x2252('0x3c')],'type':_0x2f4548['type']['key']};});_0x5dbec2[_0x2252('0x3d')]=_['map'](_0x3412b1,_0x2252('0x2a'));_0x5dbec2[_0x2252('0x3e')]=_['keys'](_0xb0d3db[_0x2252('0x3e')]);_0x5dbec2[_0x2252('0x3f')]=_[_0x2252('0x40')](_0x5dbec2[_0x2252('0x3d')],_0x5dbec2['query']);_0x5574e8[_0x2252('0x41')]=_[_0x2252('0x40')](_0x5dbec2['model'],qs[_0x2252('0x42')](_0xb0d3db['query'][_0x2252('0x42')]));_0x5574e8[_0x2252('0x41')]=_0x5574e8[_0x2252('0x41')][_0x2252('0x43')]?_0x5574e8[_0x2252('0x41')]:_0x5dbec2[_0x2252('0x3d')];if(!_0xb0d3db[_0x2252('0x3e')][_0x2252('0x44')](_0x2252('0x45'))){_0x5574e8[_0x2252('0x21')]=qs[_0x2252('0x21')](_0xb0d3db[_0x2252('0x3e')]['limit']);_0x5574e8[_0x2252('0x1f')]=qs[_0x2252('0x1f')](_0xb0d3db['query']['offset']);}_0x5574e8['order']=qs['sort'](_0xb0d3db[_0x2252('0x3e')][_0x2252('0x46')]);_0x5574e8[_0x2252('0x47')]=qs[_0x2252('0x3f')](_[_0x2252('0x48')](_0xb0d3db[_0x2252('0x3e')],_0x5dbec2[_0x2252('0x3f')]),_0x3412b1);var _0x1010a0=[];var _0x102843=squel[_0x2252('0x49')]()['field']('id')[_0x2252('0x4a')]('name')['field']('color')[_0x2252('0x4b')](_0x2252('0x4c'));var _0x3b2fff=squel['select']()[_0x2252('0x4a')](_0x2252('0x4d'))['field'](_0x2252('0x4e'))['field'](_0x2252('0x4f'))[_0x2252('0x4b')](_0x2252('0x50'),'ui')[_0x2252('0x51')](_0x2252('0x52'),'u',_0x2252('0x53'));var _0x474f45=squel[_0x2252('0x49')]()[_0x2252('0x4b')]('fax_interactions','i')[_0x2252('0x51')]('cm_contacts','c',_0x2252('0x54'))[_0x2252('0x51')](_0x2252('0x52'),'o',_0x2252('0x55'))[_0x2252('0x51')](_0x2252('0x56'),'a',_0x2252('0x57'))[_0x2252('0x51')](_0x2252('0x58'),'me',_0x2252('0x59'))[_0x2252('0x51')](_0x2252('0x5a'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2252('0x51')](_0x2252('0x4c'),'t',_0x2252('0x5b'));var _0x11fca1=squel[_0x2252('0x5c')]();var _0xc0eccd=[];var _0x18106c=squel[_0x2252('0x5c')]();var _0x33f0bc;if(_0xb0d3db[_0x2252('0x3e')][_0x2252('0x5d')]){_0x33f0bc=as['parseSearch'](_0xb0d3db[_0x2252('0x3e')][_0x2252('0x5d')]);var _0x55c04e=_0x33f0bc[_0x2252('0x5e')];for(var _0x1e2f2a=0x0;_0x1e2f2a<_0x33f0bc[_0x2252('0x5f')][_0x2252('0x43')];_0x1e2f2a++){var _0x3e9c25=_0x33f0bc['conditions'][_0x1e2f2a];var _0x3b68f4='i';var _0x8e885f=_[_0x2252('0x60')](_0x3412b1,[_0x2252('0x2a'),_0x3e9c25['field']]);if(!_0x8e885f){switch(_0x3e9c25['field']){case _0x2252('0x61'):if(_0x3e9c25[_0x2252('0x62')]==0x1){_0x474f45[_0x2252('0x63')]('`'+_0x3e9c25[_0x2252('0x4a')]+'`\x20=\x200');}else{_0x474f45[_0x2252('0x63')]('`'+_0x3e9c25['field']+_0x2252('0x64'));}break;case _0x2252('0x65'):if(_0x3e9c25[_0x2252('0x66')]===_0x2252('0x67')){if(_0x3e9c25[_0x2252('0x62')][_0x2252('0x31')]('\x20')[_0x2252('0x43')]>0x1){_0x11fca1[_0x55c04e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2252('0x68')](_0x3e9c25[_0x2252('0x62')]),null);}else{var _0xa7b038='%'+_0x3e9c25['value']+'%';_0x11fca1[_0x55c04e](_0x2252('0x69'),_0xa7b038,_0xa7b038,_0xa7b038);}}else{_0x8e885f=_['find'](_0x3412b1,['name','ContactId']);_0x3e9c25[_0x2252('0x4a')]=_0x2252('0x6a');_0x3e9988=as[_0x2252('0x6b')](_0x3b68f4,_0x8e885f[_0x2252('0x6c')],_0x3e9c25);_0x11fca1[_0x55c04e](_0x3e9988[_0x2252('0x6d')],_0x3e9988['value'][_0x2252('0x6e')],_0x3e9988[_0x2252('0x62')][_0x2252('0x1d')]);}break;case _0x2252('0x6f'):var _0x582545=_0x3e9c25[_0x2252('0x62')][_0x2252('0x31')](',')[_0x2252('0x2d')](function(_0x57a94f){return Number(_0x57a94f);});_0x582545[_0x2252('0x32')](function(_0x484b7b){_0x18106c['or'](_0x2252('0x70'),'%,'+_0x484b7b+',%');});_0xc0eccd=_[_0x2252('0x71')](_0xc0eccd,_0x582545);break;case _0x2252('0x72'):if(_0x3e9c25[_0x2252('0x66')]===_0x2252('0x67')){_0x11fca1[_0x55c04e](_0x2252('0x73'),'%'+_0x3e9c25[_0x2252('0x62')]+'%',null);}else{_0x8e885f=_[_0x2252('0x60')](_0x3412b1,[_0x2252('0x2a'),_0x2252('0x39')]);_0x3e9c25[_0x2252('0x4a')]=_0x2252('0x39');_0x3e9988=as['buildExpression'](_0x3b68f4,_0x8e885f[_0x2252('0x6c')],_0x3e9c25);_0x11fca1[_0x55c04e](_0x3e9988[_0x2252('0x6d')],_0x3e9988[_0x2252('0x62')][_0x2252('0x6e')],_0x3e9988[_0x2252('0x62')][_0x2252('0x1d')]);}break;case _0x2252('0x74'):_0x3e9988=as[_0x2252('0x6b')]('me',null,_0x3e9c25);_0x11fca1[_0x55c04e](_0x3e9988[_0x2252('0x6d')],_0x3e9988[_0x2252('0x62')][_0x2252('0x6e')],_0x3e9988['value']['end']);break;}}else{var _0x3e9988=as[_0x2252('0x6b')](_0x3b68f4,_0x8e885f[_0x2252('0x6c')],_0x3e9c25);_0x11fca1[_0x55c04e](_0x3e9988[_0x2252('0x6d')],_0x3e9988[_0x2252('0x62')][_0x2252('0x6e')],_0x3e9988[_0x2252('0x62')][_0x2252('0x1d')]);}}}else{var _0x4898a4=_(_0xb0d3db[_0x2252('0x3e')])[_0x2252('0x75')]()[_0x2252('0x2d')](function(_0xf67eab){return _['some'](_0x3412b1,[_0x2252('0x2a'),_0xf67eab])?_0xf67eab:undefined;})[_0x2252('0x76')]()[_0x2252('0x62')]();if(!_[_0x2252('0x77')](_0x4898a4)){_0x4898a4[_0x2252('0x32')](function(_0x41c4e2){if(_0x41c4e2===_0x2252('0x78')){_0x474f45[_0x2252('0x47')](_0x2252('0x79'),[][_0x2252('0x7a')](_0xb0d3db[_0x2252('0x3e')][_0x41c4e2]));}else if(_0x41c4e2===_0x2252('0x7b')){var _0x6c145=JSON[_0x2252('0x7c')](_0xb0d3db['query'][_0x41c4e2])['$gte'];var _0x4a7e17=JSON[_0x2252('0x7c')](_0xb0d3db[_0x2252('0x3e')][_0x41c4e2])[_0x2252('0x7d')];_0x474f45['where'](_0x2252('0x7e'),_0x6c145,_0x4a7e17);}else{if(_0xb0d3db[_0x2252('0x3e')][_0x41c4e2]===_0x2252('0x7f')){_0x474f45['where']('i.'+_0x41c4e2+_0x2252('0x80'));}else{_0x474f45[_0x2252('0x47')]('i.'+_0x41c4e2+_0x2252('0x81'),_0xb0d3db[_0x2252('0x3e')][_0x41c4e2]);}}});}if(_0xb0d3db['query']['read']){if(_0xb0d3db[_0x2252('0x3e')]['read']==0x1){_0x474f45[_0x2252('0x63')](_0x2252('0x82'));}else{_0x474f45[_0x2252('0x63')](_0x2252('0x83'));}}if(_0xb0d3db[_0x2252('0x3e')][_0x2252('0x84')]){_0xc0eccd=_['isArray'](_0xb0d3db[_0x2252('0x3e')][_0x2252('0x84')])?_0xb0d3db[_0x2252('0x3e')][_0x2252('0x84')]:new Array(_0xb0d3db[_0x2252('0x3e')][_0x2252('0x84')]);_0xc0eccd[_0x2252('0x32')](function(_0x4e9d17){_0x18106c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e9d17+',%');});}if(_0xb0d3db[_0x2252('0x3e')][_0x2252('0x85')]){var _0x173a1c=_0xb0d3db['query'][_0x2252('0x85')][_0x2252('0x86')]('\x5c','\x5c\x5c')[_0x2252('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x173a1c)){_0x11fca1['or']('i.id\x20LIKE\x20?',_0x173a1c+'%')['or']('i.fax\x20LIKE\x20?',_0x173a1c+'%');}_0x11fca1['or'](_0x2252('0x87'),_0x173a1c+'%');}}_0x474f45['where'](_0x11fca1);_0x474f45[_0x2252('0x88')]('i.id');var _0x595e31={'type':db['Sequelize'][_0x2252('0x89')][_0x2252('0x8a')],'raw':!![]};var _0x1e4205=_0x474f45[_0x2252('0x8b')]();_0x1e4205['field'](_0x2252('0x8c'));_0x1e4205[_0x2252('0x4a')](_0x2252('0x8d'),'unreadMessages');if(_0x5574e8['order']){_0x5574e8[_0x2252('0x8e')][_0x2252('0x32')](function(_0x17d2a7){var _0x4fd534=_0x17d2a7[0x0]===_0x2252('0x8f')?_0x17d2a7[0x0]:'i.'+_0x17d2a7[0x0];_0x474f45[_0x2252('0x8e')](_0x4fd534,_0x17d2a7[0x1]===_0x2252('0x90')?![]:!![]);});}if(!_[_0x2252('0x77')](_0xc0eccd)){_0x474f45[_0x2252('0x63')](_0x18106c);_0x1e4205[_0x2252('0x47')](_0x2252('0x91'),_0xc0eccd);}BPromise[_0x2252('0x92')]()[_0x2252('0x27')](function(){if(!_0x33f0bc){if(_0xb0d3db[_0x2252('0x3e')]['FaxAccountId'])return;_0x1e4205[_0x2252('0x47')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x474f45[_0x2252('0x47')](_0x2252('0x93'));return;}if(_0xb0d3db[_0x2252('0x94')][_0x2252('0x95')]!==_0x2252('0x96'))return;return _0xb0d3db['user'][_0x2252('0x97')]({'attributes':['id'],'raw':!![]})[_0x2252('0x27')](function(_0x4f9ba2){if(_[_0x2252('0x77')](_0x4f9ba2)){_0x1e4205[_0x2252('0x47')]('i.FaxAccountId\x20IS\x20NULL');_0x474f45['where'](_0x2252('0x98'));}else{_0x1e4205[_0x2252('0x47')]('i.FaxAccountId\x20IN\x20?',_[_0x2252('0x2d')](_0x4f9ba2,'id'));_0x474f45[_0x2252('0x47')](_0x2252('0x79'),_[_0x2252('0x2d')](_0x4f9ba2,'id'));}});})[_0x2252('0x27')](function(){if(_0xb0d3db['user']['role']===_0x2252('0x96')&&!_0x33f0bc&&!_0xb0d3db['query']['FaxAccountId'])return[];return db[_0x2252('0x99')][_0x2252('0x3e')](_0x1e4205[_0x2252('0x9a')](),_0x595e31);})[_0x2252('0x27')](function(_0x1f7703){_0x108637['count']=_0x1f7703[_0x2252('0x43')];if(_0x108637[_0x2252('0x22')]===0x0)return[];return db['sequelize'][_0x2252('0x3e')](_0x102843[_0x2252('0x9a')](),_0x595e31)[_0x2252('0x27')](function(_0x367d32){_0x1010a0=_[_0x2252('0x9b')](_0x367d32,'id');_0x595e31=_[_0x2252('0x9c')](_0x595e31,{'model':db[_0x2252('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb0d3db[_0x2252('0x3e')]['fields']){_0x5574e8[_0x2252('0x41')][_0x2252('0x32')](function(_0x1fd5bb){_0x474f45[_0x2252('0x4a')]('i.'+_0x1fd5bb);});}else{_0x474f45[_0x2252('0x4a')](_0x2252('0x8d'),'unreadMessages');_0x474f45[_0x2252('0x4a')](_0x2252('0x9e'),'Account.key');_0x474f45[_0x2252('0x4a')]('a.mandatoryDisposition',_0x2252('0x9f'));_0x474f45[_0x2252('0x4a')](_0x2252('0xa0'),'contactName');_0x474f45['field'](_0x2252('0xa1'));_0x474f45[_0x2252('0x4a')](_0x2252('0xa2'),'Contact.firstName');_0x474f45[_0x2252('0x4a')](_0x2252('0xa3'),'Contact.lastName');_0x474f45[_0x2252('0x4a')](_0x2252('0xa4'),_0x2252('0xa5'));_0x474f45[_0x2252('0x4a')](_0x2252('0xa6'),'Contact.phone');_0x474f45[_0x2252('0x4a')](_0x2252('0xa7'),_0x2252('0xa8'));_0x474f45[_0x2252('0x4a')]('c.fax',_0x2252('0xa9'));_0x474f45['field'](_0x2252('0xaa'),_0x2252('0xab'));_0x474f45[_0x2252('0x4a')](_0x2252('0xac'),'Owner.internal');_0x474f45[_0x2252('0x4a')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2252('0x2f'));}if(_0x5574e8[_0x2252('0x21')])_0x474f45[_0x2252('0x21')](_0x5574e8[_0x2252('0x21')]);if(_0x5574e8[_0x2252('0x1f')])_0x474f45['offset'](_0x5574e8[_0x2252('0x1f')]);return db['sequelize'][_0x2252('0x3e')](_0x474f45[_0x2252('0x9a')](),_0x595e31);})['then'](function(_0x3b6189){if(_0x3b6189[_0x2252('0x43')]>0x0)_0x3b2fff[_0x2252('0x47')](_0x2252('0xad'),_[_0x2252('0x2d')](_0x3b6189,'id'));return db[_0x2252('0x99')]['query'](_0x3b2fff[_0x2252('0x9a')](),_0x595e31)['then'](function(_0x480c91){var _0x14c9b6=_[_0x2252('0xae')](_0x480c91,_0x2252('0xaf'));var _0x1c56e3=[];_0x3b6189[_0x2252('0x32')](function(_0x222366){_0x1c56e3[_0x2252('0xb0')](updateFaxInteraction(_0x222366,_0x1010a0,_0x14c9b6));});return BPromise[_0x2252('0xb1')](_0x1c56e3);});});})[_0x2252('0x27')](function(_0x4c5756){_0x108637[_0x2252('0xb2')]=_0x4c5756;return _0x108637;})[_0x2252('0x27')](respondWithFilteredResult(_0x20c05e,_0x5574e8))[_0x2252('0x33')](handleError(_0x20c05e,null));};exports[_0x2252('0xb3')]=function(_0x2e3822,_0x249e52){var _0x4d2c46={'raw':![],'where':{'id':_0x2e3822[_0x2252('0xb4')]['id']}},_0x261f59={};_0x261f59[_0x2252('0x3d')]=_[_0x2252('0x75')](db[_0x2252('0x9d')][_0x2252('0xb5')]);_0x261f59['query']=_[_0x2252('0x75')](_0x2e3822['query']);_0x261f59[_0x2252('0x3f')]=_[_0x2252('0x40')](_0x261f59[_0x2252('0x3d')],_0x261f59[_0x2252('0x3e')]);_0x4d2c46['attributes']=_[_0x2252('0x40')](_0x261f59[_0x2252('0x3d')],qs[_0x2252('0x42')](_0x2e3822['query']['fields']));_0x4d2c46[_0x2252('0x41')]=_0x4d2c46[_0x2252('0x41')][_0x2252('0x43')]?_0x4d2c46['attributes']:_0x261f59['model'];if(_0x2e3822[_0x2252('0x3e')]['includeAll']){_0x4d2c46[_0x2252('0xb6')]=[{'all':!![]}];}_0x4d2c46=_[_0x2252('0x9c')]({},_0x4d2c46,_0x2e3822[_0x2252('0xb7')]);return db['FaxInteraction'][_0x2252('0x60')](_0x4d2c46)[_0x2252('0x27')](handleEntityNotFound(_0x249e52,null))[_0x2252('0x27')](respondWithResult(_0x249e52,null))[_0x2252('0x33')](handleError(_0x249e52,null));};exports[_0x2252('0xb8')]=function(_0x2ad739,_0x24bbe5){return db[_0x2252('0x9d')][_0x2252('0xb8')](_0x2ad739[_0x2252('0x74')],{})['then'](respondWithResult(_0x24bbe5,0xc9))[_0x2252('0x33')](handleError(_0x24bbe5,null));};exports['update']=function(_0x164397,_0x2ff5de){if(_0x164397[_0x2252('0x74')]['id']){delete _0x164397[_0x2252('0x74')]['id'];}return db[_0x2252('0x9d')][_0x2252('0x60')]({'where':{'id':_0x164397['params']['id']}})['then'](handleEntityNotFound(_0x2ff5de,null))['then'](saveUpdates(_0x164397['body'],null))['then'](respondWithResult(_0x2ff5de,null))['catch'](handleError(_0x2ff5de,null));};exports[_0x2252('0xb9')]=function(_0x753170,_0x5f1e57){return db[_0x2252('0x9d')]['find']({'where':{'id':_0x753170['params']['id']}})[_0x2252('0x27')](handleEntityNotFound(_0x5f1e57,null))[_0x2252('0x27')](removeEntity(_0x5f1e57,null))[_0x2252('0x33')](handleError(_0x5f1e57,null));};exports['describe']=function(_0x5155ce,_0x5ab20e){return db[_0x2252('0x9d')][_0x2252('0xba')]()[_0x2252('0x27')](respondWithResult(_0x5ab20e,null))['catch'](handleError(_0x5ab20e,null));};exports[_0x2252('0xbb')]=function(_0x3dbbe2,_0x13c78c,_0x4dec39){return db[_0x2252('0xbc')][_0x2252('0x60')]({'where':{'id':_0x3dbbe2['params']['id']}})[_0x2252('0x27')](handleEntityNotFound(_0x13c78c,null))[_0x2252('0x27')](function(_0x572bdc){if(_0x572bdc){return _0x572bdc[_0x2252('0xbb')](_0x3dbbe2['body'][_0x2252('0xbd')],_[_0x2252('0xbe')](_0x3dbbe2['body'],[_0x2252('0xbd'),'id'])||{});}})[_0x2252('0x27')](respondWithResult(_0x13c78c,null))[_0x2252('0x33')](handleError(_0x13c78c,null));};exports[_0x2252('0xbf')]=function(_0x1e4b32,_0xb40e6d,_0x2bbd3e){var _0x2d7cca={'raw':![],'where':{}};var _0x579220={};var _0x24f630={'count':0x0,'rows':[]};return db[_0x2252('0x9d')][_0x2252('0xc0')]({'where':{'id':_0x1e4b32[_0x2252('0xb4')]['id']}})[_0x2252('0x27')](handleEntityNotFound(_0xb40e6d,null))[_0x2252('0x27')](function(_0x92b146){if(_0x92b146){_0x579220[_0x2252('0x3d')]=_[_0x2252('0x75')](db[_0x2252('0xbc')]['rawAttributes']);_0x579220[_0x2252('0x3e')]=_[_0x2252('0x75')](_0x1e4b32['query']);_0x579220[_0x2252('0x3f')]=_[_0x2252('0x40')](_0x579220[_0x2252('0x3d')],_0x579220['query']);_0x2d7cca[_0x2252('0x41')]=_[_0x2252('0x40')](_0x579220[_0x2252('0x3d')],qs[_0x2252('0x42')](_0x1e4b32['query'][_0x2252('0x42')]));_0x2d7cca[_0x2252('0x41')]=_0x2d7cca[_0x2252('0x41')]['length']?_0x2d7cca[_0x2252('0x41')]:_0x579220[_0x2252('0x3d')];if(!_0x1e4b32['query'][_0x2252('0x44')](_0x2252('0x45'))){_0x2d7cca[_0x2252('0x21')]=qs[_0x2252('0x21')](_0x1e4b32['query'][_0x2252('0x21')]);_0x2d7cca['offset']=qs['offset'](_0x1e4b32[_0x2252('0x3e')]['offset']);}_0x2d7cca['order']=qs[_0x2252('0x46')](_0x1e4b32['query']['sort']);_0x2d7cca[_0x2252('0x47')]=qs[_0x2252('0x3f')](_['pick'](_0x1e4b32[_0x2252('0x3e')],_0x579220['filters']));_0x2d7cca[_0x2252('0x47')][_0x2252('0xaf')]=_0x92b146['id'];if(_0x1e4b32[_0x2252('0x3e')]['filter']){_0x2d7cca[_0x2252('0x47')]=_[_0x2252('0x9c')](_0x2d7cca[_0x2252('0x47')],{'$or':_['map'](_0x2d7cca[_0x2252('0x41')],function(_0x14a038){var _0x228fff={};_0x228fff[_0x14a038]={'$like':'%'+_0x1e4b32['query'][_0x2252('0x85')]+'%'};return _0x228fff;})});}if(_0x1e4b32[_0x2252('0x3e')]['$gte']){var _0x4b6dad=_0x1e4b32[_0x2252('0x3e')]['$gte'][_0x2252('0x31')](',');var _0x3fe351={};_0x3fe351[_0x4b6dad[0x0]]={'$gte':moment(_0x4b6dad[0x1])[_0x2252('0xc1')](_0x2252('0xc2'))};_0x2d7cca[_0x2252('0x47')]=_['merge'](_0x2d7cca[_0x2252('0x47')],_0x3fe351);}_0x2d7cca=_[_0x2252('0x9c')]({},_0x2d7cca,_0x1e4b32[_0x2252('0xb7')]);return db[_0x2252('0xbc')]['count']({'where':_0x2d7cca[_0x2252('0x47')]})[_0x2252('0x27')](function(_0x22ad8d){_0x24f630[_0x2252('0x22')]=_0x22ad8d;if(_0x1e4b32[_0x2252('0x3e')][_0x2252('0xc3')]){_0x2d7cca['include']=[{'all':!![]}];}return db[_0x2252('0xbc')][_0x2252('0xc4')](_0x2d7cca);})['then'](function(_0x50275a){_0x24f630['rows']=_0x50275a;return _0x24f630;});}})[_0x2252('0x27')](respondWithFilteredResult(_0xb40e6d,_0x2d7cca))[_0x2252('0x33')](handleError(_0xb40e6d,null));};exports[_0x2252('0xc5')]=function(_0x6347b0,_0x5740ad,_0x23979b){return db[_0x2252('0x9d')][_0x2252('0x60')]({'where':{'id':_0x6347b0[_0x2252('0xb4')]['id']}})[_0x2252('0x27')](handleEntityNotFound(_0x5740ad,null))[_0x2252('0x27')](function(_0xfa4315){if(_0xfa4315){return _0xfa4315['setTags'](_0x6347b0[_0x2252('0x74')][_0x2252('0xbd')],_[_0x2252('0xbe')](_0x6347b0[_0x2252('0x74')],[_0x2252('0xbd'),'id'])||{})[_0x2252('0xc6')](function(){return db[_0x2252('0x6f')]['findAll']({'attributes':['id',_0x2252('0x2a'),_0x2252('0xc7')],'where':{'id':_0x6347b0['body'][_0x2252('0xbd')]}});})[_0x2252('0x27')](function(_0x1aa5ae){socket['emit'](_0x2252('0xc8'),{'id':Number(_0x6347b0[_0x2252('0xb4')]['id']),'tags':_0x1aa5ae||[]});return{'id':Number(_0x6347b0[_0x2252('0xb4')]['id']),'tags':_0x1aa5ae||[]};});}})[_0x2252('0x27')](respondWithResult(_0x5740ad,null))['catch'](handleError(_0x5740ad,null));};exports[_0x2252('0xc9')]=function(_0xfb63c9,_0x355cc5,_0x575193){return db[_0x2252('0x9d')][_0x2252('0x60')]({'where':{'id':_0xfb63c9[_0x2252('0xb4')]['id']}})['then'](handleEntityNotFound(_0x355cc5,null))[_0x2252('0x27')](function(_0x5ac079){if(_0x5ac079){return _0x5ac079['removeTags'](_0xfb63c9[_0x2252('0x3e')][_0x2252('0xbd')]);}})[_0x2252('0x27')](respondWithStatusCode(_0x355cc5,null))[_0x2252('0x33')](handleError(_0x355cc5,null));};exports[_0x2252('0xca')]=function(_0x5d52bd,_0x199f6e){var _0x16e23b=moment()[_0x2252('0xcb')]()['toString']();var _0x2a48ec=path[_0x2252('0xcc')](config[_0x2252('0xcd')],'server',_0x2252('0xce'),_0x2252('0xcf'));var _0x28f0c2=path[_0x2252('0xcc')](config[_0x2252('0xcd')],'server',_0x2252('0xce'),_0x2252('0xd0'));var _0x3959b8=path[_0x2252('0xcc')](_0x2a48ec,_0x16e23b);var _0x3ddd19=util[_0x2252('0xc1')](_0x2252('0xd1'),_0x5d52bd['params']['id'],_0x16e23b);var _0x3b1f1b=path['join'](_0x2a48ec,_0x3ddd19);var _0x34ba8e=[];_0x34ba8e[_0x2252('0xb0')]({'model':db[_0x2252('0xd2')],'as':'Attachment','raw':!![]});var _0x42c29d=[{'model':db['FaxMessage'],'as':_0x2252('0xd3'),'attributes':['id',_0x2252('0x74'),_0x2252('0x7b')],'include':_0x34ba8e}];return db[_0x2252('0x9d')][_0x2252('0x60')]({'where':{'id':_0x5d52bd['params']['id']},'include':_0x42c29d})['then'](handleEntityNotFound(_0x199f6e,null))[_0x2252('0x27')](function(_0xaa36ea){if(_0xaa36ea&&_0xaa36ea[_0x2252('0xd3')]){var _0x2c3fe1=_0xaa36ea[_0x2252('0xd4')]({'plain':!![]});fs[_0x2252('0xd5')](_0x3959b8);for(var _0x34372a=0x0;_0x34372a<_0x2c3fe1[_0x2252('0xd3')][_0x2252('0x43')];_0x34372a++){var _0x3885c5=_0x2c3fe1['Messages'][_0x34372a][_0x2252('0xd2')];if(_0x3885c5){var _0x5ca412=path[_0x2252('0xcc')](_0x28f0c2,_0x3885c5[_0x2252('0xd6')]);if(fs[_0x2252('0xd7')](_0x5ca412)){fs[_0x2252('0xd8')](_0x5ca412)[_0x2252('0xd9')](fs[_0x2252('0xda')](path[_0x2252('0xcc')](_0x3959b8,_0x3885c5['basename'])));}}}return BPromise[_0x2252('0x92')]()[_0x2252('0x27')](function(){return new BPromise(function(_0x50422d,_0x365ac9){zipdir(_0x3959b8,{'saveTo':_0x3b1f1b},function(_0x12d123,_0x282dfd){if(_0x12d123)return _0x365ac9(_0x12d123);return _0x50422d(_0x282dfd);});})[_0x2252('0x27')](function(){return new BPromise(function(_0x2288f7,_0x53c61e){rimraf(_0x3959b8,function(_0x2f9541){if(_0x2f9541)_0x53c61e(_0x2f9541);return _0x2288f7();});});})['then'](function(){return _0x199f6e[_0x2252('0xca')](_0x3b1f1b,_0x3ddd19,function(_0x42090a){if(_0x42090a){console['log'](_0x2252('0xdb'),_0x42090a);}else{fs[_0x2252('0xdc')](_0x3b1f1b);}});});});}else{return _0x199f6e[_0x2252('0xdd')](0xc8);}})[_0x2252('0x33')](handleError(_0x199f6e,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 508387f..26fed58 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 _0xf9cc=['update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save'];(function(_0x5af486,_0xaac837){var _0x5169d2=function(_0x26b4fc){while(--_0x26b4fc){_0x5af486['push'](_0x5af486['shift']());}};_0x5169d2(++_0xaac837);}(_0xf9cc,0xea));var _0xcf9c=function(_0x2bbb55,_0xf4e783){_0x2bbb55=_0x2bbb55-0x0;var _0x4fc50b=_0xf9cc[_0x2bbb55];return _0x4fc50b;};'use strict';var EventEmitter=require(_0xcf9c('0x0'));var FaxInteraction=require(_0xcf9c('0x1'))['db'][_0xcf9c('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0xcf9c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xcf9c('0x4')](0x0);var events={'afterCreate':_0xcf9c('0x5'),'afterUpdate':_0xcf9c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x50a0b9){return function(_0x1bdeb1,_0x584efa,_0x1261b9){_0x1bdeb1[_0xcf9c('0x7')]({'attributes':['id'],'raw':!![]})[_0xcf9c('0x8')](function(_0x2a9656){_0x1bdeb1[_0xcf9c('0x9')](_0xcf9c('0xa'),_0x2a9656[_0xcf9c('0xb')](function(_0x554c69){return{'id':_0x554c69['id']};}));return FaxMessage[_0xcf9c('0xc')]({'where':{'FaxInteractionId':_0x1bdeb1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcf9c('0x8')](function(_0xd17edc){_0x1bdeb1[_0xcf9c('0x9')](_0xcf9c('0xd'),_0xd17edc[_0xcf9c('0xe')]);FaxInteractionEvents['emit'](_0x50a0b9+':'+_0x1bdeb1['id'],_0x1bdeb1);FaxInteractionEvents[_0xcf9c('0xf')](_0x50a0b9,_0x1bdeb1);_0x1261b9(null);})[_0xcf9c('0x10')](_0x1261b9(null));};}for(var e in events){if(events[_0xcf9c('0x11')](e)){var event=events[e];FaxInteraction[_0xcf9c('0x12')](e,emitEvent(event));}}module[_0xcf9c('0x13')]=FaxInteractionEvents; \ No newline at end of file +var _0x85cb=['hasOwnProperty','hook','events','FaxInteraction','../../mysqldb','FaxMessage','save','update','getUsers','then','Users','map','unreadMessages','emit','catch'];(function(_0x3ef9a8,_0x287d8c){var _0x57319b=function(_0x467739){while(--_0x467739){_0x3ef9a8['push'](_0x3ef9a8['shift']());}};_0x57319b(++_0x287d8c);}(_0x85cb,0x11f));var _0xb85c=function(_0xf7e615,_0x3a8a25){_0xf7e615=_0xf7e615-0x0;var _0x4eaf40=_0x85cb[_0xf7e615];return _0x4eaf40;};'use strict';var EventEmitter=require(_0xb85c('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb85c('0x1')];var FaxMessage=require(_0xb85c('0x2'))['db'][_0xb85c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb85c('0x4'),'afterUpdate':_0xb85c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5d26c7){return function(_0x4676d5,_0x44aa40,_0x25962b){_0x4676d5[_0xb85c('0x6')]({'attributes':['id'],'raw':!![]})[_0xb85c('0x7')](function(_0x32ea35){_0x4676d5['setDataValue'](_0xb85c('0x8'),_0x32ea35[_0xb85c('0x9')](function(_0x5e97a3){return{'id':_0x5e97a3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x4676d5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb85c('0x7')](function(_0x11e1dc){_0x4676d5['setDataValue'](_0xb85c('0xa'),_0x11e1dc['length']);FaxInteractionEvents[_0xb85c('0xb')](_0x5d26c7+':'+_0x4676d5['id'],_0x4676d5);FaxInteractionEvents[_0xb85c('0xb')](_0x5d26c7,_0x4676d5);_0x25962b(null);})[_0xb85c('0xc')](_0x25962b(null));};}for(var e in events){if(events[_0xb85c('0xd')](e)){var event=events[e];FaxInteraction[_0xb85c('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 5479bcc..3672213 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 _0xe3a5=['request-promise','path','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird'];(function(_0x2881b3,_0x2a9fd4){var _0x2d8e9a=function(_0x5a862e){while(--_0x5a862e){_0x2881b3['push'](_0x2881b3['shift']());}};_0x2d8e9a(++_0x2a9fd4);}(_0xe3a5,0x127));var _0x5e3a=function(_0x4f7b93,_0x47bfde){_0x4f7b93=_0x4f7b93-0x0;var _0x3a9e03=_0xe3a5[_0x4f7b93];return _0x3a9e03;};'use strict';var _=require(_0x5e3a('0x0'));var util=require(_0x5e3a('0x1'));var logger=require(_0x5e3a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e3a('0x3'));var rp=require(_0x5e3a('0x4'));var fs=require('fs');var path=require(_0x5e3a('0x5'));var rimraf=require('rimraf');var config=require(_0x5e3a('0x6'));var attributes=require(_0x5e3a('0x7'));module[_0x5e3a('0x8')]=function(_0x195c9e,_0x3e39e5){return _0x195c9e['define'](_0x5e3a('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4786a7,_0x592e4a,_0xaf7e71){if(_0x4786a7[_0x5e3a('0xa')]('closed')){_0x4786a7['closedAt']=moment()[_0x5e3a('0xb')](_0x5e3a('0xc'));}_0xaf7e71(null,_0x4786a7);}}});}; \ No newline at end of file +var _0xcdef=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x7dd4b,_0x4ce376){var _0x30bad3=function(_0x17eaef){while(--_0x17eaef){_0x7dd4b['push'](_0x7dd4b['shift']());}};_0x30bad3(++_0x4ce376);}(_0xcdef,0xb3));var _0xfcde=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcdef[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xfcde('0x0'));var util=require(_0xfcde('0x1'));var logger=require('../../config/logger')(_0xfcde('0x2'));var moment=require(_0xfcde('0x3'));var BPromise=require(_0xfcde('0x4'));var rp=require(_0xfcde('0x5'));var fs=require('fs');var path=require(_0xfcde('0x6'));var rimraf=require(_0xfcde('0x7'));var config=require(_0xfcde('0x8'));var attributes=require(_0xfcde('0x9'));module[_0xfcde('0xa')]=function(_0x59500d,_0x99913a){return _0x59500d[_0xfcde('0xb')](_0xfcde('0xc'),attributes,{'tableName':_0xfcde('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c6ded,_0x2ddcc8,_0x228f69){if(_0x3c6ded[_0xfcde('0xe')](_0xfcde('0xf'))){_0x3c6ded['closedAt']=moment()[_0xfcde('0x10')](_0xfcde('0x11'));}_0x228f69(null,_0x3c6ded);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d3704a4..cfbdcff 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 _0xbe78=['info','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','limit','debug','stringify','AddTagsToFaxInteraction','find','addTags','body','ids','omit','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxInteraction,\x20%s,\x20%s','message'];(function(_0x3ec148,_0x4438ad){var _0x57e7a5=function(_0x7eed48){while(--_0x7eed48){_0x3ec148['push'](_0x3ec148['shift']());}};_0x57e7a5(++_0x4438ad);}(_0xbe78,0x1ec));var _0x8be7=function(_0x5303b9,_0x5c548){_0x5303b9=_0x5303b9-0x0;var _0x455125=_0xbe78[_0x5303b9];return _0x455125;};'use strict';var _=require(_0x8be7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8be7('0x1'));var rs=require(_0x8be7('0x2'));var fs=require('fs');var Redis=require(_0x8be7('0x3'));var db=require(_0x8be7('0x4'))['db'];var utils=require(_0x8be7('0x5'));var logger=require(_0x8be7('0x6'))(_0x8be7('0x7'));var config=require('../../config/environment');var jayson=require(_0x8be7('0x8'));var client=jayson[_0x8be7('0x9')][_0x8be7('0xa')]({'port':0x232a});config[_0x8be7('0xb')]=_[_0x8be7('0xc')](config[_0x8be7('0xb')],{'host':_0x8be7('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8be7('0xb')]));require(_0x8be7('0xe'))[_0x8be7('0xf')](socket);function respondWithRpcPromise(_0x26d5e2,_0x56f992,_0x197509){return new BPromise(function(_0x56ac2f,_0x2552de){return client[_0x8be7('0x10')](_0x26d5e2,_0x197509)[_0x8be7('0x11')](function(_0x4701aa){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x56f992,'request\x20sent');logger['debug'](_0x8be7('0x12'),_0x56f992,_0x8be7('0x13'),JSON['stringify'](_0x4701aa));if(_0x4701aa[_0x8be7('0x14')]){if(_0x4701aa['error'][_0x8be7('0x15')]===0x1f4){logger[_0x8be7('0x14')](_0x8be7('0x16'),_0x56f992,_0x4701aa[_0x8be7('0x14')]['message']);return _0x2552de(_0x4701aa['error'][_0x8be7('0x17')]);}logger[_0x8be7('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x56f992,_0x4701aa[_0x8be7('0x14')][_0x8be7('0x17')]);return _0x56ac2f(_0x4701aa[_0x8be7('0x14')][_0x8be7('0x17')]);}else{logger[_0x8be7('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x56f992,_0x8be7('0x13'));_0x56ac2f(_0x4701aa[_0x8be7('0x19')][_0x8be7('0x17')]);}})[_0x8be7('0x1a')](function(_0xd62927){logger[_0x8be7('0x14')](_0x8be7('0x16'),_0x56f992,_0xd62927);_0x2552de(_0xd62927);});});}exports[_0x8be7('0x1b')]=function(_0x7a6ed6){var _0x48b92f=this;return new Promise(function(_0x3cacbe,_0x155197){return db[_0x8be7('0x1c')][_0x8be7('0x1d')](_0x7a6ed6['body'],{'raw':_0x7a6ed6[_0x8be7('0x1e')]?_0x7a6ed6['options'][_0x8be7('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7a6ed6[_0x8be7('0x1e')]?_0x7a6ed6['options'][_0x8be7('0x20')]||null:null,'attributes':_0x7a6ed6[_0x8be7('0x1e')]?_0x7a6ed6['options']['attributes']||null:null,'limit':_0x7a6ed6[_0x8be7('0x1e')]?_0x7a6ed6['options'][_0x8be7('0x21')]||null:null})[_0x8be7('0x11')](function(_0x74c284){logger['info'](_0x8be7('0x1b'),_0x7a6ed6);logger[_0x8be7('0x22')]('UpdateFaxInteraction',_0x7a6ed6,JSON[_0x8be7('0x23')](_0x74c284));_0x3cacbe(_0x74c284);})[_0x8be7('0x1a')](function(_0x280d17){logger['error'](_0x8be7('0x1b'),_0x280d17[_0x8be7('0x17')],_0x7a6ed6);_0x155197(_0x48b92f[_0x8be7('0x14')](0x1f4,_0x280d17[_0x8be7('0x17')]));});});};exports[_0x8be7('0x24')]=function(_0x5a8acb){return new Promise(function(_0x8203b4,_0x3e6630){return db[_0x8be7('0x1c')][_0x8be7('0x25')]({'where':_0x5a8acb[_0x8be7('0x1e')]?_0x5a8acb['options'][_0x8be7('0x20')]||null:null})[_0x8be7('0x11')](function(_0x1b04db){if(_0x1b04db){return _0x1b04db[_0x8be7('0x26')](_0x5a8acb[_0x8be7('0x27')][_0x8be7('0x28')],_[_0x8be7('0x29')](_0x5a8acb['body'],[_0x8be7('0x28'),'id'])||{});}})['spread'](function(_0x13e752){logger[_0x8be7('0x18')](_0x8be7('0x2a'),_0x5a8acb);logger[_0x8be7('0x22')]('AddTags',_0x5a8acb,JSON['stringify'](_0x13e752));_0x8203b4(_0x13e752);})[_0x8be7('0x1a')](function(_0x1acf7e){logger[_0x8be7('0x14')](_0x8be7('0x2a'),_0x1acf7e[_0x8be7('0x17')],_0x5a8acb);_0x3e6630(_this[_0x8be7('0x14')](0x1f4,_0x1acf7e['message']));});});}; \ No newline at end of file +var _0xf56d=['update','body','options','raw','where','attributes','info','AddTagsToFaxInteraction','then','addTags','omit','ids','AddTags','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x4bf32d,_0x277e42){var _0x398e72=function(_0x356b5a){while(--_0x356b5a){_0x4bf32d['push'](_0x4bf32d['shift']());}};_0x398e72(++_0x277e42);}(_0xf56d,0x14d));var _0xdf56=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf56d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdf56('0x0'));var moment=require(_0xdf56('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(_0xdf56('0x2'));var logger=require(_0xdf56('0x3'))(_0xdf56('0x4'));var config=require(_0xdf56('0x5'));var jayson=require(_0xdf56('0x6'));var client=jayson[_0xdf56('0x7')][_0xdf56('0x8')]({'port':0x232a});config[_0xdf56('0x9')]=_[_0xdf56('0xa')](config[_0xdf56('0x9')],{'host':_0xdf56('0xb'),'port':0x18eb});var socket=require(_0xdf56('0xc'))(new Redis(config[_0xdf56('0x9')]));require(_0xdf56('0xd'))[_0xdf56('0xe')](socket);function respondWithRpcPromise(_0x55f063,_0x3792d7,_0x286cf4){return new BPromise(function(_0x5d8730,_0x18f35f){return client[_0xdf56('0xf')](_0x55f063,_0x286cf4)['then'](function(_0x29c15a){logger['info'](_0xdf56('0x10'),_0x3792d7,_0xdf56('0x11'));logger[_0xdf56('0x12')](_0xdf56('0x13'),_0x3792d7,_0xdf56('0x11'),JSON[_0xdf56('0x14')](_0x29c15a));if(_0x29c15a['error']){if(_0x29c15a[_0xdf56('0x15')]['code']===0x1f4){logger[_0xdf56('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x3792d7,_0x29c15a[_0xdf56('0x15')][_0xdf56('0x16')]);return _0x18f35f(_0x29c15a[_0xdf56('0x15')][_0xdf56('0x16')]);}logger[_0xdf56('0x15')](_0xdf56('0x10'),_0x3792d7,_0x29c15a[_0xdf56('0x15')][_0xdf56('0x16')]);return _0x5d8730(_0x29c15a[_0xdf56('0x15')][_0xdf56('0x16')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x3792d7,'request\x20sent');_0x5d8730(_0x29c15a[_0xdf56('0x17')]['message']);}})[_0xdf56('0x18')](function(_0x42db31){logger[_0xdf56('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x3792d7,_0x42db31);_0x18f35f(_0x42db31);});});}exports[_0xdf56('0x19')]=function(_0x49170b){var _0x2bda93=this;return new Promise(function(_0x2c9296,_0x1c9a83){return db[_0xdf56('0x1a')][_0xdf56('0x1b')](_0x49170b[_0xdf56('0x1c')],{'raw':_0x49170b['options']?_0x49170b[_0xdf56('0x1d')][_0xdf56('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49170b[_0xdf56('0x1d')]?_0x49170b[_0xdf56('0x1d')][_0xdf56('0x1f')]||null:null,'attributes':_0x49170b[_0xdf56('0x1d')]?_0x49170b[_0xdf56('0x1d')][_0xdf56('0x20')]||null:null,'limit':_0x49170b['options']?_0x49170b[_0xdf56('0x1d')]['limit']||null:null})['then'](function(_0x58d5f8){logger[_0xdf56('0x21')]('UpdateFaxInteraction',_0x49170b);logger[_0xdf56('0x12')](_0xdf56('0x19'),_0x49170b,JSON[_0xdf56('0x14')](_0x58d5f8));_0x2c9296(_0x58d5f8);})['catch'](function(_0x568a98){logger['error']('UpdateFaxInteraction',_0x568a98[_0xdf56('0x16')],_0x49170b);_0x1c9a83(_0x2bda93[_0xdf56('0x15')](0x1f4,_0x568a98[_0xdf56('0x16')]));});});};exports[_0xdf56('0x22')]=function(_0x431ea1){return new Promise(function(_0x2e0389,_0x45cfa9){return db[_0xdf56('0x1a')]['find']({'where':_0x431ea1[_0xdf56('0x1d')]?_0x431ea1[_0xdf56('0x1d')][_0xdf56('0x1f')]||null:null})[_0xdf56('0x23')](function(_0x4f49b1){if(_0x4f49b1){return _0x4f49b1[_0xdf56('0x24')](_0x431ea1[_0xdf56('0x1c')]['ids'],_[_0xdf56('0x25')](_0x431ea1[_0xdf56('0x1c')],[_0xdf56('0x26'),'id'])||{});}})['spread'](function(_0x520c7b){logger[_0xdf56('0x21')]('AddTags',_0x431ea1);logger[_0xdf56('0x12')]('AddTags',_0x431ea1,JSON[_0xdf56('0x14')](_0x520c7b));_0x2e0389(_0x520c7b);})[_0xdf56('0x18')](function(_0x2da973){logger['error'](_0xdf56('0x27'),_0x2da973['message'],_0x431ea1);_0x45cfa9(_this['error'](0x1f4,_0x2da973[_0xdf56('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index bc14205..fa4e0d1 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 _0xaeec=['removeListener','register','length','faxInteraction:','save','remove','update','emit'];(function(_0x47b15d,_0x5586ec){var _0x54a269=function(_0x3d2477){while(--_0x3d2477){_0x47b15d['push'](_0x47b15d['shift']());}};_0x54a269(++_0x5586ec);}(_0xaeec,0x12c));var _0xcaee=function(_0x3cb05b,_0xc0f1c9){_0x3cb05b=_0x3cb05b-0x0;var _0x3cf3e2=_0xaeec[_0x3cb05b];return _0x3cf3e2;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xcaee('0x0'),_0xcaee('0x1'),_0xcaee('0x2')];function createListener(_0x4139f8,_0x5914b5){return function(_0x1fddc7){_0x5914b5[_0xcaee('0x3')](_0x4139f8,_0x1fddc7);};}function removeListener(_0x40bd18,_0x318f76){return function(){FaxInteractionEvents[_0xcaee('0x4')](_0x40bd18,_0x318f76);};}exports[_0xcaee('0x5')]=function(_0x3f15cd){for(var _0x3bb200=0x0,_0x2f5f0c=events[_0xcaee('0x6')];_0x3bb200<_0x2f5f0c;_0x3bb200++){var _0x388cba=events[_0x3bb200];var _0x5b9941=createListener(_0xcaee('0x7')+_0x388cba,_0x3f15cd);FaxInteractionEvents['on'](_0x388cba,_0x5b9941);}}; \ No newline at end of file +var _0xafd6=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x1d5d28,_0x51a402){var _0x304f23=function(_0x39acf7){while(--_0x39acf7){_0x1d5d28['push'](_0x1d5d28['shift']());}};_0x304f23(++_0x51a402);}(_0xafd6,0x1dc));var _0x6afd=function(_0x54fbcc,_0x6b7756){_0x54fbcc=_0x54fbcc-0x0;var _0x477365=_0xafd6[_0x54fbcc];return _0x477365;};'use strict';var FaxInteractionEvents=require(_0x6afd('0x0'));var events=[_0x6afd('0x1'),_0x6afd('0x2'),_0x6afd('0x3')];function createListener(_0x326765,_0x52afc7){return function(_0x1ed4e2){_0x52afc7['emit'](_0x326765,_0x1ed4e2);};}function removeListener(_0x4b5d6e,_0x35cc73){return function(){FaxInteractionEvents[_0x6afd('0x4')](_0x4b5d6e,_0x35cc73);};}exports[_0x6afd('0x5')]=function(_0x27055a){for(var _0x16a594=0x0,_0x2b43d5=events[_0x6afd('0x6')];_0x16a594<_0x2b43d5;_0x16a594++){var _0x11e1c5=events[_0x16a594];var _0x5b5147=createListener(_0x6afd('0x7')+_0x11e1c5,_0x27055a);FaxInteractionEvents['on'](_0x11e1c5,_0x5b5147);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 606b304..307e7a8 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 _0xdada=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy'];(function(_0x51809d,_0x5dd4a6){var _0x28226f=function(_0x1e8834){while(--_0x1e8834){_0x51809d['push'](_0x51809d['shift']());}};_0x28226f(++_0x5dd4a6);}(_0xdada,0x1a2));var _0xadad=function(_0x4880e1,_0x4dc35b){_0x4880e1=_0x4880e1-0x0;var _0x29262d=_0xdada[_0x4880e1];return _0x29262d;};'use strict';var multer=require(_0xadad('0x0'));var util=require(_0xadad('0x1'));var path=require(_0xadad('0x2'));var timeout=require('connect-timeout');var express=require(_0xadad('0x3'));var router=express[_0xadad('0x4')]();var fs_extra=require(_0xadad('0x5'));var auth=require(_0xadad('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xadad('0x7'));var controller=require('./faxInteraction.controller');router[_0xadad('0x8')]('/',auth['isAuthenticated'](),controller[_0xadad('0x9')]);router[_0xadad('0x8')](_0xadad('0xa'),auth['isAuthenticated'](),controller[_0xadad('0xb')]);router['get'](_0xadad('0xc'),auth[_0xadad('0xd')](),controller['show']);router['get'](_0xadad('0xe'),auth[_0xadad('0xd')](),controller[_0xadad('0xf')]);router[_0xadad('0x8')]('/:id/download',auth[_0xadad('0xd')](),controller[_0xadad('0x10')]);router[_0xadad('0x11')]('/',auth[_0xadad('0xd')](),controller[_0xadad('0x12')]);router[_0xadad('0x11')]('/:id/messages',auth[_0xadad('0xd')](),controller[_0xadad('0x13')]);router[_0xadad('0x11')](_0xadad('0x14'),auth[_0xadad('0xd')](),interaction[_0xadad('0x15')](_0xadad('0x16'),_0xadad('0x17')),controller[_0xadad('0x18')]);router[_0xadad('0x19')](_0xadad('0xc'),auth['isAuthenticated'](),interaction[_0xadad('0x15')](_0xadad('0x16'),_0xadad('0x1a')),controller[_0xadad('0x1b')]);router[_0xadad('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0xadad('0x15')](_0xadad('0x16'),_0xadad('0x1d')),controller[_0xadad('0x1e')]);router[_0xadad('0x1c')](_0xadad('0x14'),auth[_0xadad('0xd')](),controller['removeTags']);module[_0xadad('0x1f')]=router; \ No newline at end of file +var _0xb776=['create','addMessage','fax','addTags','tracked','faxinteraction:update','update','delete','/:id','faxinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x20d7b2,_0x1cd564){var _0x483991=function(_0x1405b4){while(--_0x1405b4){_0x20d7b2['push'](_0x20d7b2['shift']());}};_0x483991(++_0x1cd564);}(_0xb776,0x1cc));var _0x6b77=function(_0x158d19,_0x41a949){_0x158d19=_0x158d19-0x0;var _0x2592bb=_0xb776[_0x158d19];return _0x2592bb;};'use strict';var multer=require(_0x6b77('0x0'));var util=require(_0x6b77('0x1'));var path=require(_0x6b77('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b77('0x3'));var router=express[_0x6b77('0x4')]();var fs_extra=require(_0x6b77('0x5'));var auth=require(_0x6b77('0x6'));var interaction=require(_0x6b77('0x7'));var config=require(_0x6b77('0x8'));var controller=require(_0x6b77('0x9'));router[_0x6b77('0xa')]('/',auth[_0x6b77('0xb')](),controller['index']);router[_0x6b77('0xa')](_0x6b77('0xc'),auth[_0x6b77('0xb')](),controller[_0x6b77('0xd')]);router[_0x6b77('0xa')]('/:id',auth[_0x6b77('0xb')](),controller[_0x6b77('0xe')]);router[_0x6b77('0xa')](_0x6b77('0xf'),auth[_0x6b77('0xb')](),controller[_0x6b77('0x10')]);router[_0x6b77('0xa')](_0x6b77('0x11'),auth[_0x6b77('0xb')](),controller[_0x6b77('0x12')]);router[_0x6b77('0x13')]('/',auth[_0x6b77('0xb')](),controller[_0x6b77('0x14')]);router[_0x6b77('0x13')](_0x6b77('0xf'),auth[_0x6b77('0xb')](),controller[_0x6b77('0x15')]);router[_0x6b77('0x13')]('/:id/tags',auth[_0x6b77('0xb')](),interaction['tracked'](_0x6b77('0x16'),'faxinteraction:addtags'),controller[_0x6b77('0x17')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x6b77('0x18')](_0x6b77('0x16'),_0x6b77('0x19')),controller[_0x6b77('0x1a')]);router[_0x6b77('0x1b')](_0x6b77('0x1c'),auth[_0x6b77('0xb')](),interaction['tracked'](_0x6b77('0x16'),_0x6b77('0x1d')),controller['destroy']);router['delete']('/:id/tags',auth[_0x6b77('0xb')](),controller[_0x6b77('0x1e')]);module[_0x6b77('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a64dc6e..35c1c8a 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 _0xe13e=['TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x2e4ef6,_0x206c02){var _0x1dee7f=function(_0x4c6f4f){while(--_0x4c6f4f){_0x2e4ef6['push'](_0x2e4ef6['shift']());}};_0x1dee7f(++_0x206c02);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee13('0x0')](_0xee13('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xee13('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee13('0x3')]('in',_0xee13('0x4')),'defaultValue':_0xee13('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xee13('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0xee13('0x5')]}}; \ No newline at end of file +var _0xdb76=['TEXT','medium','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x26e2c6,_0x4b278b){var _0x7ee368=function(_0x594a5c){while(--_0x594a5c){_0x26e2c6['push'](_0x26e2c6['shift']());}};_0x7ee368(++_0x4b278b);}(_0xdb76,0x1be));var _0x6db7=function(_0x3a59b6,_0x5267f1){_0x3a59b6=_0x3a59b6-0x0;var _0x466a80=_0xdb76[_0x3a59b6];return _0x466a80;};'use strict';var Sequelize=require(_0x6db7('0x0'));module[_0x6db7('0x1')]={'body':{'type':Sequelize[_0x6db7('0x2')](_0x6db7('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6db7('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6db7('0x5')),'defaultValue':_0x6db7('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6db7('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6db7('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 566f7c7..b0747b5 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 _0xbf68=['accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','contact','create','CmContact','findOne','Attachment','AttachmentId','SendFax','isNil','basename','download','root','server','attachments','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','name','send','index','map','FaxMessage','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','body','destroy','describe'];(function(_0x296e65,_0x3e0881){var _0x5e6be7=function(_0x3a8e46){while(--_0x3a8e46){_0x296e65['push'](_0x296e65['shift']());}};_0x5e6be7(++_0x3e0881);}(_0xbf68,0xc4));var _0x8bf6=function(_0x1ad3e5,_0x32c0e4){_0x1ad3e5=_0x1ad3e5-0x0;var _0x1f3af4=_0xbf68[_0x1ad3e5];return _0x1f3af4;};'use strict';var emlformat=require(_0x8bf6('0x0'));var rimraf=require(_0x8bf6('0x1'));var zipdir=require(_0x8bf6('0x2'));var jsonpatch=require(_0x8bf6('0x3'));var rp=require(_0x8bf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bf6('0x5'));var util=require('util');var path=require(_0x8bf6('0x6'));var sox=require(_0x8bf6('0x7'));var csv=require('to-csv');var ejs=require(_0x8bf6('0x8'));var fs=require('fs');var fs_extra=require(_0x8bf6('0x9'));var _=require(_0x8bf6('0xa'));var squel=require(_0x8bf6('0xb'));var crypto=require(_0x8bf6('0xc'));var jsforce=require(_0x8bf6('0xd'));var deskjs=require(_0x8bf6('0xe'));var toCsv=require(_0x8bf6('0xf'));var querystring=require(_0x8bf6('0x10'));var Papa=require(_0x8bf6('0x11'));var Redis=require(_0x8bf6('0x12'));var authService=require(_0x8bf6('0x13'));var qs=require(_0x8bf6('0x14'));var as=require(_0x8bf6('0x15'));var hardwareService=require(_0x8bf6('0x16'));var logger=require(_0x8bf6('0x17'))(_0x8bf6('0x18'));var utils=require(_0x8bf6('0x19'));var config=require(_0x8bf6('0x1a'));var licenseUtil=require(_0x8bf6('0x1b'));var db=require('../../mysqldb')['db'];config[_0x8bf6('0x1c')]=_['defaults'](config[_0x8bf6('0x1c')],{'host':_0x8bf6('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bf6('0x1c')]));require(_0x8bf6('0x1e'))[_0x8bf6('0x1f')](socket);var jayson=require(_0x8bf6('0x20'));var client=jayson[_0x8bf6('0x21')][_0x8bf6('0x22')]({'port':0x232c});var client9002=jayson[_0x8bf6('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5bb2,_0x59cb3b,_0x530b7d,_0x34e383){return new BPromise(function(_0xb0b202,_0x10043b){var _0xdb82c8=_0x34e383||client;return _0xdb82c8[_0x8bf6('0x23')](_0x2d5bb2,_0x530b7d)[_0x8bf6('0x24')](function(_0x2f8719){logger['info']('FaxMessage,\x20%s,\x20%s',_0x59cb3b,_0x8bf6('0x25'));logger['debug'](_0x8bf6('0x26'),_0x59cb3b,_0x8bf6('0x25'),JSON[_0x8bf6('0x27')](_0x2f8719));if(_0x2f8719[_0x8bf6('0x28')]){if(_0x2f8719[_0x8bf6('0x28')]['code']===0x1f4){logger[_0x8bf6('0x28')]('FaxMessage,\x20%s,\x20%s',_0x59cb3b,_0x2f8719[_0x8bf6('0x28')][_0x8bf6('0x29')]);return _0x10043b(_0x2f8719[_0x8bf6('0x28')][_0x8bf6('0x29')]);}logger[_0x8bf6('0x28')](_0x8bf6('0x2a'),_0x59cb3b,_0x2f8719[_0x8bf6('0x28')][_0x8bf6('0x29')]);return _0xb0b202(_0x2f8719['error'][_0x8bf6('0x29')]);}else{logger['info'](_0x8bf6('0x2a'),_0x59cb3b,'request\x20sent');_0xb0b202(_0x2f8719[_0x8bf6('0x2b')]['message']);}})['catch'](function(_0x29043d){logger['error'](_0x8bf6('0x2a'),_0x59cb3b,_0x29043d);_0x10043b(_0x29043d);});});}function respondWithStatusCode(_0x54f534,_0x5d3305){_0x5d3305=_0x5d3305||0xcc;return function(_0x74e5cd){if(_0x74e5cd){return _0x54f534[_0x8bf6('0x2c')](_0x5d3305);}return _0x54f534[_0x8bf6('0x2d')](_0x5d3305)[_0x8bf6('0x2e')]();};}function respondWithResult(_0x4ccf25,_0x149efa){_0x149efa=_0x149efa||0xc8;return function(_0x36c33f){if(_0x36c33f){return _0x4ccf25['status'](_0x149efa)[_0x8bf6('0x2f')](_0x36c33f);}};}function respondWithFilteredResult(_0x219fd1,_0xa42dc1){return function(_0x1cf159){if(_0x1cf159){var _0x2ce2ab=typeof _0xa42dc1[_0x8bf6('0x30')]===_0x8bf6('0x31')&&typeof _0xa42dc1['limit']===_0x8bf6('0x31');var _0x4a0678=_0x1cf159[_0x8bf6('0x32')];var _0x517a2d=_0x2ce2ab?0x0:_0xa42dc1[_0x8bf6('0x30')];var _0x3bba3b=_0x2ce2ab?_0x1cf159['count']:_0xa42dc1[_0x8bf6('0x30')]+_0xa42dc1[_0x8bf6('0x33')];var _0x4cdfe7;if(_0x3bba3b>=_0x4a0678){_0x3bba3b=_0x4a0678;_0x4cdfe7=0xc8;}else{_0x4cdfe7=0xce;}_0x219fd1[_0x8bf6('0x2d')](_0x4cdfe7);return _0x219fd1[_0x8bf6('0x34')](_0x8bf6('0x35'),_0x517a2d+'-'+_0x3bba3b+'/'+_0x4a0678)[_0x8bf6('0x2f')](_0x1cf159);}return null;};}function patchUpdates(_0x33e8cc){return function(_0x35155c){try{jsonpatch[_0x8bf6('0x36')](_0x35155c,_0x33e8cc,!![]);}catch(_0x2a73e9){return BPromise[_0x8bf6('0x37')](_0x2a73e9);}return _0x35155c[_0x8bf6('0x38')]();};}function saveUpdates(_0xb3ec8a,_0xce948e){return function(_0x2494e5){if(_0x2494e5){return _0x2494e5[_0x8bf6('0x39')](_0xb3ec8a)[_0x8bf6('0x24')](function(_0x30336c){return _0x30336c;});}return null;};}function removeEntity(_0x1afbfb,_0xa1f416){return function(_0x386ebd){if(_0x386ebd){return _0x386ebd['destroy']()[_0x8bf6('0x24')](function(){_0x1afbfb['status'](0xcc)[_0x8bf6('0x2e')]();});}};}function handleEntityNotFound(_0x35e156,_0x38f760){return function(_0x477fb7){if(!_0x477fb7){_0x35e156['sendStatus'](0x194);}return _0x477fb7;};}function handleError(_0x2c781d,_0x1e679e){_0x1e679e=_0x1e679e||0x1f4;return function(_0x5ae5c0){logger[_0x8bf6('0x28')](_0x5ae5c0['stack']);if(_0x5ae5c0[_0x8bf6('0x3a')]){delete _0x5ae5c0[_0x8bf6('0x3a')];}_0x2c781d[_0x8bf6('0x2d')](_0x1e679e)[_0x8bf6('0x3b')](_0x5ae5c0);};}exports[_0x8bf6('0x3c')]=function(_0x9c7d0d,_0x4f0a0a){var _0x221fdc={},_0x127b0a={},_0x22f58e={'count':0x0,'rows':[]};var _0x9f387b=_[_0x8bf6('0x3d')](db[_0x8bf6('0x3e')][_0x8bf6('0x3f')],function(_0x36b856){return{'name':_0x36b856['fieldName'],'type':_0x36b856[_0x8bf6('0x40')][_0x8bf6('0x41')]};});_0x127b0a['model']=_[_0x8bf6('0x3d')](_0x9f387b,_0x8bf6('0x3a'));_0x127b0a[_0x8bf6('0x42')]=_[_0x8bf6('0x43')](_0x9c7d0d[_0x8bf6('0x42')]);_0x127b0a['filters']=_['intersection'](_0x127b0a[_0x8bf6('0x44')],_0x127b0a[_0x8bf6('0x42')]);_0x221fdc[_0x8bf6('0x45')]=_[_0x8bf6('0x46')](_0x127b0a[_0x8bf6('0x44')],qs[_0x8bf6('0x47')](_0x9c7d0d[_0x8bf6('0x42')]['fields']));_0x221fdc[_0x8bf6('0x45')]=_0x221fdc[_0x8bf6('0x45')][_0x8bf6('0x48')]?_0x221fdc['attributes']:_0x127b0a['model'];if(!_0x9c7d0d[_0x8bf6('0x42')][_0x8bf6('0x49')](_0x8bf6('0x4a'))){_0x221fdc[_0x8bf6('0x33')]=qs[_0x8bf6('0x33')](_0x9c7d0d['query']['limit']);_0x221fdc[_0x8bf6('0x30')]=qs['offset'](_0x9c7d0d['query'][_0x8bf6('0x30')]);}_0x221fdc[_0x8bf6('0x4b')]=qs[_0x8bf6('0x4c')](_0x9c7d0d[_0x8bf6('0x42')][_0x8bf6('0x4c')]);_0x221fdc[_0x8bf6('0x4d')]=qs[_0x8bf6('0x4e')](_[_0x8bf6('0x4f')](_0x9c7d0d[_0x8bf6('0x42')],_0x127b0a[_0x8bf6('0x4e')]),_0x9f387b);if(_0x9c7d0d['query'][_0x8bf6('0x50')]){_0x221fdc[_0x8bf6('0x4d')]=_['merge'](_0x221fdc['where'],{'$or':_['map'](_0x9f387b,function(_0x4dd549){if(_0x4dd549['type']!==_0x8bf6('0x51')){var _0x499348={};_0x499348[_0x4dd549[_0x8bf6('0x3a')]]={'$like':'%'+_0x9c7d0d['query'][_0x8bf6('0x50')]+'%'};return _0x499348;}})});}_0x221fdc=_[_0x8bf6('0x52')]({},_0x221fdc,_0x9c7d0d[_0x8bf6('0x53')]);var _0x39530d={'where':_0x221fdc[_0x8bf6('0x4d')]};return db['FaxMessage'][_0x8bf6('0x32')](_0x39530d)[_0x8bf6('0x24')](function(_0x1320b8){_0x22f58e[_0x8bf6('0x32')]=_0x1320b8;if(_0x9c7d0d[_0x8bf6('0x42')][_0x8bf6('0x54')]){_0x221fdc[_0x8bf6('0x55')]=[{'all':!![]}];}return db[_0x8bf6('0x3e')][_0x8bf6('0x56')](_0x221fdc);})[_0x8bf6('0x24')](function(_0x4b783f){_0x22f58e[_0x8bf6('0x57')]=_0x4b783f;return _0x22f58e;})[_0x8bf6('0x24')](respondWithFilteredResult(_0x4f0a0a,_0x221fdc))[_0x8bf6('0x58')](handleError(_0x4f0a0a,null));};exports['show']=function(_0x50427c,_0x38780c){var _0x72bd67={'raw':!![],'where':{'id':_0x50427c[_0x8bf6('0x59')]['id']}},_0x23c745={};_0x23c745['model']=_[_0x8bf6('0x43')](db['FaxMessage']['rawAttributes']);_0x23c745[_0x8bf6('0x42')]=_['keys'](_0x50427c[_0x8bf6('0x42')]);_0x23c745[_0x8bf6('0x4e')]=_['intersection'](_0x23c745[_0x8bf6('0x44')],_0x23c745[_0x8bf6('0x42')]);_0x72bd67[_0x8bf6('0x45')]=_[_0x8bf6('0x46')](_0x23c745[_0x8bf6('0x44')],qs['fields'](_0x50427c[_0x8bf6('0x42')][_0x8bf6('0x47')]));_0x72bd67[_0x8bf6('0x45')]=_0x72bd67['attributes'][_0x8bf6('0x48')]?_0x72bd67[_0x8bf6('0x45')]:_0x23c745['model'];if(_0x50427c['query']['includeAll']){_0x72bd67['include']=[{'all':!![]}];}_0x72bd67=_['merge']({},_0x72bd67,_0x50427c[_0x8bf6('0x53')]);return db['FaxMessage'][_0x8bf6('0x5a')](_0x72bd67)['then'](handleEntityNotFound(_0x38780c,null))[_0x8bf6('0x24')](respondWithResult(_0x38780c,null))[_0x8bf6('0x58')](handleError(_0x38780c,null));};exports['update']=function(_0x4aa1e1,_0x35f80d){if(_0x4aa1e1[_0x8bf6('0x5b')]['id']){delete _0x4aa1e1['body']['id'];}return db[_0x8bf6('0x3e')][_0x8bf6('0x5a')]({'where':{'id':_0x4aa1e1[_0x8bf6('0x59')]['id']}})[_0x8bf6('0x24')](handleEntityNotFound(_0x35f80d,null))[_0x8bf6('0x24')](saveUpdates(_0x4aa1e1['body'],null))['then'](respondWithResult(_0x35f80d,null))[_0x8bf6('0x58')](handleError(_0x35f80d,null));};exports[_0x8bf6('0x5c')]=function(_0x3df5d0,_0x239323){return db[_0x8bf6('0x3e')][_0x8bf6('0x5a')]({'where':{'id':_0x3df5d0['params']['id']}})['then'](handleEntityNotFound(_0x239323,null))[_0x8bf6('0x24')](removeEntity(_0x239323,null))[_0x8bf6('0x58')](handleError(_0x239323,null));};exports[_0x8bf6('0x5d')]=function(_0x46c02a,_0x3b273c){return db[_0x8bf6('0x3e')][_0x8bf6('0x5d')]()[_0x8bf6('0x24')](respondWithResult(_0x3b273c,null))[_0x8bf6('0x58')](handleError(_0x3b273c,null));};var interaction_log=require(_0x8bf6('0x17'))('fax-interactions');exports[_0x8bf6('0x5e')]=function(_0x50ee06,_0xc0f2a2,_0x4c3e05){var _0x285cba={'agent':{},'channel':_0x8bf6('0x5f')};if(_0x50ee06[_0x8bf6('0x5b')]['id']){delete _0x50ee06['body']['id'];}_0x50ee06[_0x8bf6('0x5b')][_0x8bf6('0x60')]=!![];_0x50ee06['body'][_0x8bf6('0x61')]=moment()[_0x8bf6('0x62')](_0x8bf6('0x63'));_0x50ee06[_0x8bf6('0x5b')][_0x8bf6('0x64')]=_0x50ee06[_0x8bf6('0x5b')][_0x8bf6('0x64')]||_0x50ee06['user']['id'];_0x285cba[_0x8bf6('0x65')]['id']=_0x50ee06[_0x8bf6('0x5b')]['UserId'];return db[_0x8bf6('0x3e')]['find']({'where':{'id':_0x50ee06[_0x8bf6('0x59')]['id'],'UserId':null}})[_0x8bf6('0x24')](handleEntityNotFound(_0xc0f2a2,null))[_0x8bf6('0x24')](saveUpdates(_0x50ee06[_0x8bf6('0x5b')],null))[_0x8bf6('0x24')](function(_0x26ef64){if(_0x26ef64){_0x285cba[_0x8bf6('0x29')]=_0x26ef64[_0x8bf6('0x66')]({'plain':!![]});return db[_0x8bf6('0x67')][_0x8bf6('0x5a')]({'where':{'id':_0x26ef64[_0x8bf6('0x68')]}});}return null;})['then'](handleEntityNotFound(_0xc0f2a2,null))[_0x8bf6('0x24')](function(_0x8e1c7){if(_0x8e1c7){return _0x8e1c7['update']({'UserId':_0x50ee06['body'][_0x8bf6('0x64')],'read1stAt':_['isNil'](_0x8e1c7[_0x8bf6('0x69')])?moment()[_0x8bf6('0x62')](_0x8bf6('0x63')):undefined});}return null;})[_0x8bf6('0x24')](function(_0x2899ea){if(_0x2899ea){_0x285cba[_0x8bf6('0x6a')]=_0x2899ea[_0x8bf6('0x66')]({'plain':!![]});interaction_log[_0x8bf6('0x6b')](_0x8bf6('0x6c'),_0x50ee06[_0x8bf6('0x6d')]['id'],_0x50ee06[_0x8bf6('0x6d')]['name'],_0x50ee06[_0x8bf6('0x6d')][_0x8bf6('0x6e')],_0x285cba[_0x8bf6('0x6a')]['id'],_0x50ee06[_0x8bf6('0x5b')]?JSON[_0x8bf6('0x27')](_0x50ee06['body']):_0x8bf6('0x6f'));return respondWithRpcPromise(_0x8bf6('0x70'),_0x8bf6('0x71'),_0x285cba);}return null;})['then'](function(_0x289d8c){var _0x430ace=_0x8bf6('0x72')+_0x289d8c[_0x8bf6('0x29')][_0x8bf6('0x73')];return db['sequelize'][_0x8bf6('0x42')](_0x430ace,{'type':db[_0x8bf6('0x74')][_0x8bf6('0x75')]['SELECT'],'raw':!![]})[_0x8bf6('0x24')](function(_0xefb7a){return _0xefb7a;});})['then'](function(_0x59681a){if(_0x59681a){_0x285cba[_0x8bf6('0x29')]['contact']=_0x59681a[0x0];if(!_0x50ee06[_0x8bf6('0x5b')][_0x8bf6('0x64')])return;return db[_0x8bf6('0x76')][_0x8bf6('0x5a')]({'where':{'id':_0x50ee06[_0x8bf6('0x5b')][_0x8bf6('0x64')],'role':_0x8bf6('0x65')},'attributes':['id',_0x8bf6('0x3a'),_0x8bf6('0x77'),_0x8bf6('0x78'),_0x8bf6('0x79')],'raw':!![]});}return null;})[_0x8bf6('0x24')](function(_0x4d9402){if(!_0x4d9402)return null;_0x285cba[_0x8bf6('0x29')][_0x8bf6('0x65')]=_0x4d9402;return _0x285cba;})[_0x8bf6('0x24')](function(_0x3d4658){if(_0x3d4658){if(_0x50ee06[_0x8bf6('0x5b')]['manual']){_0x285cba['message'][_0x8bf6('0x7a')]=util[_0x8bf6('0x62')]('SIP/%s',_0x50ee06[_0x8bf6('0x6d')]['name']);_0x285cba[_0x8bf6('0x29')]['channel']=_0x285cba[_0x8bf6('0x7b')];_0x285cba['message'][_0x8bf6('0x7c')]=_0x285cba[_0x8bf6('0x7b')];_0x285cba[_0x8bf6('0x29')][_0x8bf6('0x7d')]=_0x8bf6('0x5e');return respondWithRpcPromise(_0x8bf6('0x7e'),'EventManager',{'event':_0x8bf6('0x7f'),'message':_0x285cba[_0x8bf6('0x29')]},client9002)[_0x8bf6('0x24')](function(){return _0x285cba;});}return _0x285cba;}return null;})[_0x8bf6('0x24')](respondWithResult(_0xc0f2a2,null))[_0x8bf6('0x58')](handleError(_0xc0f2a2,null));};var interaction_log=require(_0x8bf6('0x17'))('fax-interactions');exports[_0x8bf6('0x37')]=function(_0xa5a378,_0x4224c3,_0x50ce7f){var _0x565aa5={'agent':{},'channel':_0x8bf6('0x5f')};if(_0xa5a378[_0x8bf6('0x5b')]['id']){delete _0xa5a378[_0x8bf6('0x5b')]['id'];}_0xa5a378[_0x8bf6('0x5b')]['UserId']=_0xa5a378[_0x8bf6('0x5b')]['UserId']||_0xa5a378[_0x8bf6('0x6d')]['id'];_0x565aa5[_0x8bf6('0x65')]['id']=_0xa5a378['body'][_0x8bf6('0x64')];return db[_0x8bf6('0x3e')][_0x8bf6('0x5a')]({'where':{'id':_0xa5a378['params']['id'],'UserId':null}})[_0x8bf6('0x24')](handleEntityNotFound(_0x4224c3,null))[_0x8bf6('0x24')](function(_0xf5d238){if(_0xf5d238){_0x565aa5[_0x8bf6('0x29')]=_0xf5d238[_0x8bf6('0x66')]({'plain':!![]});return db[_0x8bf6('0x67')]['find']({'where':{'id':_0xf5d238['FaxInteractionId']}});}return null;})[_0x8bf6('0x24')](handleEntityNotFound(_0x4224c3,null))[_0x8bf6('0x24')](function(_0x583ced){if(_0x583ced){_0x565aa5[_0x8bf6('0x6a')]=_0x583ced[_0x8bf6('0x66')]({'plain':!![]});interaction_log['info'](_0x8bf6('0x80'),_0xa5a378[_0x8bf6('0x6d')]['id'],_0xa5a378[_0x8bf6('0x6d')]['name'],_0xa5a378[_0x8bf6('0x6d')][_0x8bf6('0x6e')],_0x565aa5[_0x8bf6('0x6a')]['id'],_0xa5a378['body']?JSON[_0x8bf6('0x27')](_0xa5a378['body']):_0x8bf6('0x6f'));return respondWithRpcPromise(_0x8bf6('0x81'),'rejectMessage',_0x565aa5);}return null;})[_0x8bf6('0x24')](function(_0x38e8d0){var _0x3203ae=_0x8bf6('0x72')+_0x38e8d0[_0x8bf6('0x29')]['ContactId'];return db['sequelize']['query'](_0x3203ae,{'type':db[_0x8bf6('0x74')][_0x8bf6('0x75')][_0x8bf6('0x82')],'raw':!![]})['then'](function(_0x25c947){return _0x25c947;});})[_0x8bf6('0x24')](function(_0x2fccd8){if(_0x2fccd8){_0x565aa5[_0x8bf6('0x29')][_0x8bf6('0x83')]=_0x2fccd8[0x0];if(!_0xa5a378[_0x8bf6('0x5b')][_0x8bf6('0x64')])return;return db[_0x8bf6('0x76')]['find']({'where':{'id':_0xa5a378[_0x8bf6('0x5b')][_0x8bf6('0x64')],'role':'agent'},'attributes':['id',_0x8bf6('0x3a'),_0x8bf6('0x77'),_0x8bf6('0x78'),_0x8bf6('0x79')],'raw':!![]});}return null;})['then'](function(_0x2a0a89){if(!_0x2a0a89)return null;_0x565aa5['message'][_0x8bf6('0x65')]=_0x2a0a89;return _0x565aa5;})[_0x8bf6('0x24')](function(_0x573ca4){if(_0x573ca4){_0x573ca4[_0x8bf6('0x29')][_0x8bf6('0x7a')]=util[_0x8bf6('0x62')]('SIP/%s',_0xa5a378[_0x8bf6('0x6d')][_0x8bf6('0x3a')]);_0x573ca4[_0x8bf6('0x29')][_0x8bf6('0x7b')]=_0x565aa5[_0x8bf6('0x7b')];_0x573ca4['message'][_0x8bf6('0x7c')]=_0x565aa5[_0x8bf6('0x7b')];_0x573ca4[_0x8bf6('0x29')][_0x8bf6('0x7d')]='reject';respondWithRpcPromise(_0x8bf6('0x7e'),_0x8bf6('0x7e'),{'event':'rejectmessage','message':_0x573ca4['message']},client9002);return _0x565aa5;}return null;})[_0x8bf6('0x24')](respondWithResult(_0x4224c3,null))[_0x8bf6('0x58')](handleError(_0x4224c3,null));};exports[_0x8bf6('0x84')]=function(_0x387686,_0x1a1100){var _0x2f1c37;return db[_0x8bf6('0x3e')][_0x8bf6('0x84')](_0x387686['body'],{})['then'](function(_0x3abbc2){_0x2f1c37=_0x3abbc2;return db[_0x8bf6('0x85')][_0x8bf6('0x86')]({'where':{'id':_0x2f1c37[_0x8bf6('0x73')]}});})[_0x8bf6('0x24')](function(_0x439f5a){if(_['isNil'](_0x439f5a)){return;}else{_0x2f1c37[_0x8bf6('0x5f')]=_0x439f5a[_0x8bf6('0x5f')];return db[_0x8bf6('0x87')][_0x8bf6('0x86')]({'where':{'id':_0x2f1c37[_0x8bf6('0x88')]}});}})[_0x8bf6('0x24')](function(_0x43d4bd){return respondWithRpcPromise(_0x8bf6('0x89'),_0x8bf6('0x89'),{'FaxAccountId':_['isNil'](_0x387686['body'])?undefined:_0x387686['body']['FaxAccountId'],'path':_[_0x8bf6('0x8a')](_0x43d4bd)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x43d4bd[_0x8bf6('0x8b')]),'fax':_[_0x8bf6('0x8a')](_0x2f1c37[_0x8bf6('0x5f')])?undefined:_0x2f1c37[_0x8bf6('0x5f')],'AttachmentId':_0x2f1c37['AttachmentId']},client9002);})[_0x8bf6('0x24')](respondWithResult(_0x1a1100,0xc9))[_0x8bf6('0x58')](handleError(_0x1a1100,null));};exports[_0x8bf6('0x8c')]=function(_0x31e7da,_0x4aa16d){var _0xfe0db5=path['join'](config[_0x8bf6('0x8d')],_0x8bf6('0x8e'),'files',_0x8bf6('0x8f'));return db[_0x8bf6('0x3e')][_0x8bf6('0x5a')]({'where':{'id':_0x31e7da[_0x8bf6('0x59')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x8bf6('0x24')](handleEntityNotFound(_0x4aa16d,null))['then'](function(_0x49df27){if(_0x49df27){return _0x4aa16d[_0x8bf6('0x8c')](path[_0x8bf6('0x90')](_0xfe0db5,_0x49df27[_0x8bf6('0x87')][_0x8bf6('0x8b')]));}})[_0x8bf6('0x58')](handleError(_0x4aa16d,null));}; \ No newline at end of file +var _0x8796=['fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','fields','options','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','../../config/logger','null','RejectMessage','rejectMessage','Sequelize','SELECT','fullname','create','findOne','Attachment','AttachmentId','SendFax','basename','download','root','server','files','attachments','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','register','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','FaxMessage','rawAttributes'];(function(_0x377f50,_0x5589ba){var _0x14a9d2=function(_0x4ab38b){while(--_0x4ab38b){_0x377f50['push'](_0x377f50['shift']());}};_0x14a9d2(++_0x5589ba);}(_0x8796,0xe5));var _0x6879=function(_0x3300b3,_0x27c03a){_0x3300b3=_0x3300b3-0x0;var _0x1cbefe=_0x8796[_0x3300b3];return _0x1cbefe;};'use strict';var emlformat=require(_0x6879('0x0'));var rimraf=require(_0x6879('0x1'));var zipdir=require(_0x6879('0x2'));var jsonpatch=require(_0x6879('0x3'));var rp=require(_0x6879('0x4'));var moment=require(_0x6879('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6879('0x6'));var sox=require(_0x6879('0x7'));var csv=require(_0x6879('0x8'));var ejs=require(_0x6879('0x9'));var fs=require('fs');var fs_extra=require(_0x6879('0xa'));var _=require(_0x6879('0xb'));var squel=require(_0x6879('0xc'));var crypto=require(_0x6879('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6879('0xe'));var toCsv=require(_0x6879('0x8'));var querystring=require(_0x6879('0xf'));var Papa=require(_0x6879('0x10'));var Redis=require('ioredis');var authService=require(_0x6879('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6879('0x12'));var hardwareService=require(_0x6879('0x13'));var logger=require('../../config/logger')(_0x6879('0x14'));var utils=require(_0x6879('0x15'));var config=require(_0x6879('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6879('0x17'))['db'];config['redis']=_[_0x6879('0x18')](config['redis'],{'host':_0x6879('0x19'),'port':0x18eb});var socket=require(_0x6879('0x1a'))(new Redis(config[_0x6879('0x1b')]));require(_0x6879('0x1c'))[_0x6879('0x1d')](socket);var jayson=require(_0x6879('0x1e'));var client=jayson[_0x6879('0x1f')][_0x6879('0x20')]({'port':0x232c});var client9002=jayson[_0x6879('0x1f')][_0x6879('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x518778,_0x5c4dce,_0xc5c47a,_0x46993e){return new BPromise(function(_0x37f0d7,_0x1f00c3){var _0x2ce31c=_0x46993e||client;return _0x2ce31c['request'](_0x518778,_0xc5c47a)[_0x6879('0x21')](function(_0x206179){logger['info'](_0x6879('0x22'),_0x5c4dce,_0x6879('0x23'));logger[_0x6879('0x24')](_0x6879('0x25'),_0x5c4dce,'request\x20sent',JSON[_0x6879('0x26')](_0x206179));if(_0x206179[_0x6879('0x27')]){if(_0x206179['error'][_0x6879('0x28')]===0x1f4){logger[_0x6879('0x27')](_0x6879('0x22'),_0x5c4dce,_0x206179[_0x6879('0x27')]['message']);return _0x1f00c3(_0x206179[_0x6879('0x27')]['message']);}logger[_0x6879('0x27')](_0x6879('0x22'),_0x5c4dce,_0x206179[_0x6879('0x27')][_0x6879('0x29')]);return _0x37f0d7(_0x206179['error'][_0x6879('0x29')]);}else{logger['info'](_0x6879('0x22'),_0x5c4dce,_0x6879('0x23'));_0x37f0d7(_0x206179[_0x6879('0x2a')]['message']);}})[_0x6879('0x2b')](function(_0x317449){logger[_0x6879('0x27')](_0x6879('0x22'),_0x5c4dce,_0x317449);_0x1f00c3(_0x317449);});});}function respondWithStatusCode(_0x50b527,_0x46c3b5){_0x46c3b5=_0x46c3b5||0xcc;return function(_0x438e52){if(_0x438e52){return _0x50b527[_0x6879('0x2c')](_0x46c3b5);}return _0x50b527[_0x6879('0x2d')](_0x46c3b5)['end']();};}function respondWithResult(_0xc5302a,_0x2a57b4){_0x2a57b4=_0x2a57b4||0xc8;return function(_0x4982fc){if(_0x4982fc){return _0xc5302a[_0x6879('0x2d')](_0x2a57b4)[_0x6879('0x2e')](_0x4982fc);}};}function respondWithFilteredResult(_0x5daa3c,_0x91b749){return function(_0x1387ce){if(_0x1387ce){var _0x2feab2=typeof _0x91b749[_0x6879('0x2f')]==='undefined'&&typeof _0x91b749[_0x6879('0x30')]===_0x6879('0x31');var _0x347ed6=_0x1387ce[_0x6879('0x32')];var _0x3b163f=_0x2feab2?0x0:_0x91b749[_0x6879('0x2f')];var _0x2e9fdb=_0x2feab2?_0x1387ce[_0x6879('0x32')]:_0x91b749[_0x6879('0x2f')]+_0x91b749[_0x6879('0x30')];var _0x7d34fa;if(_0x2e9fdb>=_0x347ed6){_0x2e9fdb=_0x347ed6;_0x7d34fa=0xc8;}else{_0x7d34fa=0xce;}_0x5daa3c['status'](_0x7d34fa);return _0x5daa3c[_0x6879('0x33')](_0x6879('0x34'),_0x3b163f+'-'+_0x2e9fdb+'/'+_0x347ed6)[_0x6879('0x2e')](_0x1387ce);}return null;};}function patchUpdates(_0x45f4d8){return function(_0x4a5eb1){try{jsonpatch[_0x6879('0x35')](_0x4a5eb1,_0x45f4d8,!![]);}catch(_0x2dd606){return BPromise[_0x6879('0x36')](_0x2dd606);}return _0x4a5eb1[_0x6879('0x37')]();};}function saveUpdates(_0x409b38,_0x354735){return function(_0x279ce6){if(_0x279ce6){return _0x279ce6[_0x6879('0x38')](_0x409b38)[_0x6879('0x21')](function(_0x1775c2){return _0x1775c2;});}return null;};}function removeEntity(_0x2d3cfc,_0x222ecd){return function(_0x1e4695){if(_0x1e4695){return _0x1e4695[_0x6879('0x39')]()[_0x6879('0x21')](function(){_0x2d3cfc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e5d5,_0x4674dd){return function(_0x83497){if(!_0x83497){_0x20e5d5['sendStatus'](0x194);}return _0x83497;};}function handleError(_0x55f16d,_0x234532){_0x234532=_0x234532||0x1f4;return function(_0xfd28a3){logger['error'](_0xfd28a3[_0x6879('0x3a')]);if(_0xfd28a3[_0x6879('0x3b')]){delete _0xfd28a3[_0x6879('0x3b')];}_0x55f16d['status'](_0x234532)['send'](_0xfd28a3);};}exports[_0x6879('0x3c')]=function(_0x668438,_0x247bbc){var _0x356927={},_0x4a0ceb={},_0x6ebb14={'count':0x0,'rows':[]};var _0x4d285b=_['map'](db[_0x6879('0x3d')][_0x6879('0x3e')],function(_0x2f5f56){return{'name':_0x2f5f56[_0x6879('0x3f')],'type':_0x2f5f56[_0x6879('0x40')][_0x6879('0x41')]};});_0x4a0ceb[_0x6879('0x42')]=_[_0x6879('0x43')](_0x4d285b,_0x6879('0x3b'));_0x4a0ceb['query']=_[_0x6879('0x44')](_0x668438[_0x6879('0x45')]);_0x4a0ceb[_0x6879('0x46')]=_[_0x6879('0x47')](_0x4a0ceb[_0x6879('0x42')],_0x4a0ceb[_0x6879('0x45')]);_0x356927['attributes']=_[_0x6879('0x47')](_0x4a0ceb[_0x6879('0x42')],qs['fields'](_0x668438['query']['fields']));_0x356927[_0x6879('0x48')]=_0x356927[_0x6879('0x48')][_0x6879('0x49')]?_0x356927[_0x6879('0x48')]:_0x4a0ceb[_0x6879('0x42')];if(!_0x668438[_0x6879('0x45')][_0x6879('0x4a')](_0x6879('0x4b'))){_0x356927[_0x6879('0x30')]=qs['limit'](_0x668438[_0x6879('0x45')][_0x6879('0x30')]);_0x356927[_0x6879('0x2f')]=qs[_0x6879('0x2f')](_0x668438[_0x6879('0x45')]['offset']);}_0x356927[_0x6879('0x4c')]=qs[_0x6879('0x4d')](_0x668438['query'][_0x6879('0x4d')]);_0x356927[_0x6879('0x4e')]=qs[_0x6879('0x46')](_['pick'](_0x668438['query'],_0x4a0ceb['filters']),_0x4d285b);if(_0x668438[_0x6879('0x45')][_0x6879('0x4f')]){_0x356927['where']=_[_0x6879('0x50')](_0x356927[_0x6879('0x4e')],{'$or':_[_0x6879('0x43')](_0x4d285b,function(_0x4f8b0f){if(_0x4f8b0f[_0x6879('0x40')]!==_0x6879('0x51')){var _0x1815a5={};_0x1815a5[_0x4f8b0f[_0x6879('0x3b')]]={'$like':'%'+_0x668438[_0x6879('0x45')][_0x6879('0x4f')]+'%'};return _0x1815a5;}})});}_0x356927=_['merge']({},_0x356927,_0x668438['options']);var _0xb516e3={'where':_0x356927['where']};return db[_0x6879('0x3d')][_0x6879('0x32')](_0xb516e3)[_0x6879('0x21')](function(_0x4de783){_0x6ebb14[_0x6879('0x32')]=_0x4de783;if(_0x668438[_0x6879('0x45')][_0x6879('0x52')]){_0x356927[_0x6879('0x53')]=[{'all':!![]}];}return db[_0x6879('0x3d')]['findAll'](_0x356927);})[_0x6879('0x21')](function(_0x543541){_0x6ebb14[_0x6879('0x54')]=_0x543541;return _0x6ebb14;})[_0x6879('0x21')](respondWithFilteredResult(_0x247bbc,_0x356927))['catch'](handleError(_0x247bbc,null));};exports[_0x6879('0x55')]=function(_0x4cab28,_0x4e14cd){var _0xb11af7={'raw':!![],'where':{'id':_0x4cab28[_0x6879('0x56')]['id']}},_0x37b281={};_0x37b281[_0x6879('0x42')]=_[_0x6879('0x44')](db[_0x6879('0x3d')]['rawAttributes']);_0x37b281[_0x6879('0x45')]=_[_0x6879('0x44')](_0x4cab28[_0x6879('0x45')]);_0x37b281[_0x6879('0x46')]=_[_0x6879('0x47')](_0x37b281['model'],_0x37b281[_0x6879('0x45')]);_0xb11af7['attributes']=_['intersection'](_0x37b281[_0x6879('0x42')],qs[_0x6879('0x57')](_0x4cab28[_0x6879('0x45')][_0x6879('0x57')]));_0xb11af7[_0x6879('0x48')]=_0xb11af7[_0x6879('0x48')]['length']?_0xb11af7[_0x6879('0x48')]:_0x37b281[_0x6879('0x42')];if(_0x4cab28[_0x6879('0x45')][_0x6879('0x52')]){_0xb11af7[_0x6879('0x53')]=[{'all':!![]}];}_0xb11af7=_[_0x6879('0x50')]({},_0xb11af7,_0x4cab28[_0x6879('0x58')]);return db['FaxMessage'][_0x6879('0x59')](_0xb11af7)['then'](handleEntityNotFound(_0x4e14cd,null))[_0x6879('0x21')](respondWithResult(_0x4e14cd,null))[_0x6879('0x2b')](handleError(_0x4e14cd,null));};exports[_0x6879('0x38')]=function(_0x3916c8,_0x45951c){if(_0x3916c8['body']['id']){delete _0x3916c8[_0x6879('0x5a')]['id'];}return db[_0x6879('0x3d')][_0x6879('0x59')]({'where':{'id':_0x3916c8['params']['id']}})[_0x6879('0x21')](handleEntityNotFound(_0x45951c,null))['then'](saveUpdates(_0x3916c8[_0x6879('0x5a')],null))[_0x6879('0x21')](respondWithResult(_0x45951c,null))['catch'](handleError(_0x45951c,null));};exports['destroy']=function(_0x465ff6,_0xbaf9b2){return db[_0x6879('0x3d')]['find']({'where':{'id':_0x465ff6[_0x6879('0x56')]['id']}})[_0x6879('0x21')](handleEntityNotFound(_0xbaf9b2,null))[_0x6879('0x21')](removeEntity(_0xbaf9b2,null))[_0x6879('0x2b')](handleError(_0xbaf9b2,null));};exports[_0x6879('0x5b')]=function(_0x501ad3,_0x30dd0d){return db[_0x6879('0x3d')]['describe']()[_0x6879('0x21')](respondWithResult(_0x30dd0d,null))['catch'](handleError(_0x30dd0d,null));};var interaction_log=require('../../config/logger')(_0x6879('0x5c'));exports[_0x6879('0x5d')]=function(_0x42600e,_0x52791c,_0x1e4475){var _0x4ad07d={'agent':{},'channel':_0x6879('0x5e')};if(_0x42600e[_0x6879('0x5a')]['id']){delete _0x42600e['body']['id'];}_0x42600e[_0x6879('0x5a')][_0x6879('0x5f')]=!![];_0x42600e[_0x6879('0x5a')][_0x6879('0x60')]=moment()[_0x6879('0x61')](_0x6879('0x62'));_0x42600e['body'][_0x6879('0x63')]=_0x42600e[_0x6879('0x5a')]['UserId']||_0x42600e['user']['id'];_0x4ad07d[_0x6879('0x64')]['id']=_0x42600e[_0x6879('0x5a')]['UserId'];return db['FaxMessage'][_0x6879('0x59')]({'where':{'id':_0x42600e[_0x6879('0x56')]['id'],'UserId':null}})[_0x6879('0x21')](handleEntityNotFound(_0x52791c,null))[_0x6879('0x21')](saveUpdates(_0x42600e[_0x6879('0x5a')],null))[_0x6879('0x21')](function(_0x2303ec){if(_0x2303ec){_0x4ad07d['message']=_0x2303ec[_0x6879('0x65')]({'plain':!![]});return db[_0x6879('0x66')][_0x6879('0x59')]({'where':{'id':_0x2303ec[_0x6879('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x52791c,null))['then'](function(_0x13490c){if(_0x13490c){return _0x13490c['update']({'UserId':_0x42600e['body']['UserId'],'read1stAt':_[_0x6879('0x68')](_0x13490c[_0x6879('0x69')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x341b54){if(_0x341b54){_0x4ad07d[_0x6879('0x6a')]=_0x341b54['get']({'plain':!![]});interaction_log[_0x6879('0x6b')](_0x6879('0x6c'),_0x42600e[_0x6879('0x6d')]['id'],_0x42600e[_0x6879('0x6d')][_0x6879('0x3b')],_0x42600e[_0x6879('0x6d')][_0x6879('0x6e')],_0x4ad07d['interaction']['id'],_0x42600e[_0x6879('0x5a')]?JSON[_0x6879('0x26')](_0x42600e[_0x6879('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x6879('0x6f'),_0x4ad07d);}return null;})[_0x6879('0x21')](function(_0x509fcb){var _0x162a6a=_0x6879('0x70')+_0x509fcb['message'][_0x6879('0x71')];return db[_0x6879('0x72')]['query'](_0x162a6a,{'type':db['Sequelize'][_0x6879('0x73')]['SELECT'],'raw':!![]})['then'](function(_0x588f7a){return _0x588f7a;});})['then'](function(_0x300aac){if(_0x300aac){_0x4ad07d[_0x6879('0x29')][_0x6879('0x74')]=_0x300aac[0x0];if(!_0x42600e[_0x6879('0x5a')][_0x6879('0x63')])return;return db[_0x6879('0x75')][_0x6879('0x59')]({'where':{'id':_0x42600e[_0x6879('0x5a')]['UserId'],'role':_0x6879('0x64')},'attributes':['id','name','fullname',_0x6879('0x76'),_0x6879('0x77')],'raw':!![]});}return null;})[_0x6879('0x21')](function(_0x15e7d6){if(!_0x15e7d6)return null;_0x4ad07d[_0x6879('0x29')][_0x6879('0x64')]=_0x15e7d6;return _0x4ad07d;})[_0x6879('0x21')](function(_0x45252d){if(_0x45252d){if(_0x42600e['body'][_0x6879('0x78')]){_0x4ad07d[_0x6879('0x29')][_0x6879('0x79')]=util[_0x6879('0x61')](_0x6879('0x7a'),_0x42600e[_0x6879('0x6d')][_0x6879('0x3b')]);_0x4ad07d[_0x6879('0x29')]['channel']=_0x4ad07d[_0x6879('0x7b')];_0x4ad07d[_0x6879('0x29')][_0x6879('0x7c')]=_0x4ad07d['channel'];_0x4ad07d[_0x6879('0x29')][_0x6879('0x7d')]=_0x6879('0x5d');return respondWithRpcPromise(_0x6879('0x7e'),_0x6879('0x7e'),{'event':'acceptmessage','message':_0x4ad07d[_0x6879('0x29')]},client9002)[_0x6879('0x21')](function(){return _0x4ad07d;});}return _0x4ad07d;}return null;})[_0x6879('0x21')](respondWithResult(_0x52791c,null))[_0x6879('0x2b')](handleError(_0x52791c,null));};var interaction_log=require(_0x6879('0x7f'))('fax-interactions');exports['reject']=function(_0x2908de,_0x25e216,_0x5b182d){var _0x34f5e3={'agent':{},'channel':_0x6879('0x5e')};if(_0x2908de['body']['id']){delete _0x2908de['body']['id'];}_0x2908de[_0x6879('0x5a')][_0x6879('0x63')]=_0x2908de[_0x6879('0x5a')]['UserId']||_0x2908de[_0x6879('0x6d')]['id'];_0x34f5e3[_0x6879('0x64')]['id']=_0x2908de[_0x6879('0x5a')][_0x6879('0x63')];return db[_0x6879('0x3d')][_0x6879('0x59')]({'where':{'id':_0x2908de[_0x6879('0x56')]['id'],'UserId':null}})[_0x6879('0x21')](handleEntityNotFound(_0x25e216,null))[_0x6879('0x21')](function(_0x54df4){if(_0x54df4){_0x34f5e3['message']=_0x54df4[_0x6879('0x65')]({'plain':!![]});return db[_0x6879('0x66')]['find']({'where':{'id':_0x54df4[_0x6879('0x67')]}});}return null;})[_0x6879('0x21')](handleEntityNotFound(_0x25e216,null))[_0x6879('0x21')](function(_0x5dd355){if(_0x5dd355){_0x34f5e3[_0x6879('0x6a')]=_0x5dd355[_0x6879('0x65')]({'plain':!![]});interaction_log[_0x6879('0x6b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2908de[_0x6879('0x6d')]['id'],_0x2908de[_0x6879('0x6d')][_0x6879('0x3b')],_0x2908de[_0x6879('0x6d')][_0x6879('0x6e')],_0x34f5e3['interaction']['id'],_0x2908de['body']?JSON[_0x6879('0x26')](_0x2908de[_0x6879('0x5a')]):_0x6879('0x80'));return respondWithRpcPromise(_0x6879('0x81'),_0x6879('0x82'),_0x34f5e3);}return null;})['then'](function(_0x29a78c){var _0x30503e=_0x6879('0x70')+_0x29a78c[_0x6879('0x29')][_0x6879('0x71')];return db[_0x6879('0x72')]['query'](_0x30503e,{'type':db[_0x6879('0x83')][_0x6879('0x73')][_0x6879('0x84')],'raw':!![]})[_0x6879('0x21')](function(_0x51d8ff){return _0x51d8ff;});})[_0x6879('0x21')](function(_0xa08501){if(_0xa08501){_0x34f5e3[_0x6879('0x29')][_0x6879('0x74')]=_0xa08501[0x0];if(!_0x2908de[_0x6879('0x5a')][_0x6879('0x63')])return;return db['User'][_0x6879('0x59')]({'where':{'id':_0x2908de[_0x6879('0x5a')]['UserId'],'role':_0x6879('0x64')},'attributes':['id','name',_0x6879('0x85'),'email',_0x6879('0x77')],'raw':!![]});}return null;})[_0x6879('0x21')](function(_0x125885){if(!_0x125885)return null;_0x34f5e3[_0x6879('0x29')]['agent']=_0x125885;return _0x34f5e3;})[_0x6879('0x21')](function(_0x2e1e5e){if(_0x2e1e5e){_0x2e1e5e[_0x6879('0x29')]['interface']=util['format'](_0x6879('0x7a'),_0x2908de[_0x6879('0x6d')][_0x6879('0x3b')]);_0x2e1e5e[_0x6879('0x29')][_0x6879('0x7b')]=_0x34f5e3['channel'];_0x2e1e5e[_0x6879('0x29')][_0x6879('0x7c')]=_0x34f5e3[_0x6879('0x7b')];_0x2e1e5e[_0x6879('0x29')][_0x6879('0x7d')]='reject';respondWithRpcPromise(_0x6879('0x7e'),_0x6879('0x7e'),{'event':'rejectmessage','message':_0x2e1e5e[_0x6879('0x29')]},client9002);return _0x34f5e3;}return null;})['then'](respondWithResult(_0x25e216,null))['catch'](handleError(_0x25e216,null));};exports[_0x6879('0x86')]=function(_0x440e15,_0x3c0fa7){var _0x2f3bca;return db['FaxMessage'][_0x6879('0x86')](_0x440e15[_0x6879('0x5a')],{})['then'](function(_0x5618a3){_0x2f3bca=_0x5618a3;return db['CmContact'][_0x6879('0x87')]({'where':{'id':_0x2f3bca['ContactId']}});})['then'](function(_0x4fd883){if(_[_0x6879('0x68')](_0x4fd883)){return;}else{_0x2f3bca[_0x6879('0x5e')]=_0x4fd883[_0x6879('0x5e')];return db[_0x6879('0x88')][_0x6879('0x87')]({'where':{'id':_0x2f3bca[_0x6879('0x89')]}});}})[_0x6879('0x21')](function(_0x355051){return respondWithRpcPromise(_0x6879('0x8a'),_0x6879('0x8a'),{'FaxAccountId':_[_0x6879('0x68')](_0x440e15[_0x6879('0x5a')])?undefined:_0x440e15['body']['FaxAccountId'],'path':_['isNil'](_0x355051)?undefined:util[_0x6879('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x355051[_0x6879('0x8b')]),'fax':_[_0x6879('0x68')](_0x2f3bca['fax'])?undefined:_0x2f3bca[_0x6879('0x5e')],'AttachmentId':_0x2f3bca['AttachmentId']},client9002);})['then'](respondWithResult(_0x3c0fa7,0xc9))[_0x6879('0x2b')](handleError(_0x3c0fa7,null));};exports[_0x6879('0x8c')]=function(_0x5341db,_0x500ffd){var _0x44b1f7=path['join'](config[_0x6879('0x8d')],_0x6879('0x8e'),_0x6879('0x8f'),_0x6879('0x90'));return db[_0x6879('0x3d')]['find']({'where':{'id':_0x5341db[_0x6879('0x56')]['id']},'include':[{'model':db[_0x6879('0x88')],'as':'Attachment'}]})[_0x6879('0x21')](handleEntityNotFound(_0x500ffd,null))[_0x6879('0x21')](function(_0x27df90){if(_0x27df90){return _0x500ffd[_0x6879('0x8c')](path[_0x6879('0x91')](_0x44b1f7,_0x27df90[_0x6879('0x88')]['basename']));}})['catch'](handleError(_0x500ffd,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index ab17b7d..d0bb45d 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 _0xb458=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage','update'];(function(_0x528443,_0xf38ac1){var _0x3cdb50=function(_0x577605){while(--_0x577605){_0x528443['push'](_0x528443['shift']());}};_0x3cdb50(++_0xf38ac1);}(_0xb458,0x94));var _0x8b45=function(_0x3f2d70,_0x2d06e3){_0x3f2d70=_0x3f2d70-0x0;var _0x226bd4=_0xb458[_0x3f2d70];return _0x226bd4;};'use strict';var EventEmitter=require(_0x8b45('0x0'));var FaxMessage=require(_0x8b45('0x1'))['db'][_0x8b45('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b45('0x3'),'afterDestroy':'remove'};function emitEvent(_0x102d9c){return function(_0x223890,_0x10f68e,_0x3089cd){FaxMessageEvents['emit'](_0x102d9c+':'+_0x223890['id'],_0x223890);FaxMessageEvents[_0x8b45('0x4')](_0x102d9c,_0x223890);_0x3089cd(null);};}for(var e in events){if(events[_0x8b45('0x5')](e)){var event=events[e];FaxMessage[_0x8b45('0x6')](e,emitEvent(event));}}module[_0x8b45('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xd9eb=['hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit'];(function(_0x47e34a,_0x3e17bd){var _0x3a1d14=function(_0x3d9849){while(--_0x3d9849){_0x47e34a['push'](_0x47e34a['shift']());}};_0x3a1d14(++_0x3e17bd);}(_0xd9eb,0xca));var _0xbd9e=function(_0x1fb4a0,_0x48a602){_0x1fb4a0=_0x1fb4a0-0x0;var _0x1094e7=_0xd9eb[_0x1fb4a0];return _0x1094e7;};'use strict';var EventEmitter=require(_0xbd9e('0x0'));var FaxMessage=require(_0xbd9e('0x1'))['db'][_0xbd9e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbd9e('0x3')](0x0);var events={'afterCreate':_0xbd9e('0x4'),'afterUpdate':_0xbd9e('0x5'),'afterDestroy':_0xbd9e('0x6')};function emitEvent(_0x8d4b08){return function(_0x2b6174,_0x1df81b,_0x365865){FaxMessageEvents[_0xbd9e('0x7')](_0x8d4b08+':'+_0x2b6174['id'],_0x2b6174);FaxMessageEvents[_0xbd9e('0x7')](_0x8d4b08,_0x2b6174);_0x365865(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xbd9e('0x8')](e,emitEvent(event));}}module[_0xbd9e('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6da8b77..bd73107 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 _0xbac0=['api','moment','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3d918d,_0x157f56){var _0x45f336=function(_0x3d0a96){while(--_0x3d0a96){_0x3d918d['push'](_0x3d918d['shift']());}};_0x45f336(++_0x157f56);}(_0xbac0,0x1bd));var _0x0bac=function(_0x7c0646,_0x45d16b){_0x7c0646=_0x7c0646-0x0;var _0x32416d=_0xbac0[_0x7c0646];return _0x32416d;};'use strict';var _=require(_0x0bac('0x0'));var util=require(_0x0bac('0x1'));var logger=require(_0x0bac('0x2'))(_0x0bac('0x3'));var moment=require(_0x0bac('0x4'));var BPromise=require(_0x0bac('0x5'));var rp=require(_0x0bac('0x6'));var fs=require('fs');var path=require(_0x0bac('0x7'));var rimraf=require('rimraf');var config=require(_0x0bac('0x8'));var attributes=require(_0x0bac('0x9'));module[_0x0bac('0xa')]=function(_0x55f6d5,_0x49d67a){return _0x55f6d5['define'](_0x0bac('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x0bac('0xc'),'fields':[_0x0bac('0xd')],'type':_0x0bac('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x46fefa,_0x2566f8,_0x186590){var _0x2ccb32=_0x55f6d5[_0x0bac('0xf')];var _0x3b8b04=_0x46fefa['get']({'plain':!![]});if(_0x3b8b04[_0x0bac('0x10')][_0x0bac('0x11')]()==='in'||_0x3b8b04[_0x0bac('0x10')]['toLowerCase']()===_0x0bac('0x12')&&!_0x3b8b04['secret']&&!_['isNil'](_0x3b8b04[_0x0bac('0x13')])){_0x2ccb32[_0x0bac('0x14')][_0x0bac('0x15')]({'where':{'id':_0x3b8b04['FaxInteractionId']}})['then'](function(_0x4228c2){if(_0x4228c2){_0x4228c2[_0x0bac('0x16')]({'lastMsgAt':_0x3b8b04[_0x0bac('0x17')],'lastMsgDirection':_0x3b8b04['direction'][_0x0bac('0x11')]()});}})[_0x0bac('0x18')](function(_0x1befbf){console[_0x0bac('0x19')](_0x1befbf);});}_0x186590();}},'charset':_0x0bac('0x1a'),'collate':_0x0bac('0x1b')});}; \ No newline at end of file +var _0x7f4b=['rimraf','../../config/environment','./faxMessage.attributes','define','fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','FaxInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7f4b,0xef));var _0xb7f4=function(_0x5528bc,_0x3fbeca){_0x5528bc=_0x5528bc-0x0;var _0x592eea=_0x7f4b[_0x5528bc];return _0x592eea;};'use strict';var _=require(_0xb7f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb7f4('0x1'));var moment=require('moment');var BPromise=require(_0xb7f4('0x2'));var rp=require(_0xb7f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7f4('0x4'));var config=require(_0xb7f4('0x5'));var attributes=require(_0xb7f4('0x6'));module['exports']=function(_0x406547,_0x1c1654){return _0x406547[_0xb7f4('0x7')]('FaxMessage',attributes,{'tableName':_0xb7f4('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xb7f4('0x9')],'type':_0xb7f4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe55537,_0x59ae1f,_0x486eec){var _0x4f056d=_0x406547[_0xb7f4('0xb')];var _0x1e9811=_0xe55537[_0xb7f4('0xc')]({'plain':!![]});if(_0x1e9811['direction'][_0xb7f4('0xd')]()==='in'||_0x1e9811[_0xb7f4('0xe')][_0xb7f4('0xd')]()===_0xb7f4('0xf')&&!_0x1e9811[_0xb7f4('0x10')]&&!_['isNil'](_0x1e9811[_0xb7f4('0x11')])){_0x4f056d[_0xb7f4('0x12')][_0xb7f4('0x13')]({'where':{'id':_0x1e9811['FaxInteractionId']}})[_0xb7f4('0x14')](function(_0x3f7ebd){if(_0x3f7ebd){_0x3f7ebd[_0xb7f4('0x15')]({'lastMsgAt':_0x1e9811[_0xb7f4('0x16')],'lastMsgDirection':_0x1e9811['direction'][_0xb7f4('0xd')]()});}})[_0xb7f4('0x17')](function(_0x385458){console[_0xb7f4('0x18')](_0x385458);});}_0x486eec();}},'charset':_0xb7f4('0x19'),'collate':_0xb7f4('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 072eb19..775f872 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 _0x3e74=['result','catch','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','create','body','options','raw','then','attributes','limit','UpdateFaxMessage','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x575d12,_0x117009){var _0x1abe35=function(_0x4cc95d){while(--_0x4cc95d){_0x575d12['push'](_0x575d12['shift']());}};_0x1abe35(++_0x117009);}(_0x3e74,0x175));var _0x43e7=function(_0x453521,_0x1c6ec8){_0x453521=_0x453521-0x0;var _0x1e9a3d=_0x3e74[_0x453521];return _0x1e9a3d;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});config['redis']=_[_0x43e7('0xa')](config[_0x43e7('0xb')],{'host':_0x43e7('0xc'),'port':0x18eb});var socket=require(_0x43e7('0xd'))(new Redis(config[_0x43e7('0xb')]));require('./faxMessage.socket')[_0x43e7('0xe')](socket);function respondWithRpcPromise(_0x554d44,_0x54948c,_0x39c8bd){return new BPromise(function(_0x4139c9,_0x5c34f4){return client[_0x43e7('0xf')](_0x554d44,_0x39c8bd)['then'](function(_0xf7c520){logger[_0x43e7('0x10')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));logger[_0x43e7('0x12')](_0x43e7('0x13'),_0x54948c,_0x43e7('0x11'),JSON['stringify'](_0xf7c520));if(_0xf7c520['error']){if(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x15')]===0x1f4){logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x5c34f4(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}logger[_0x43e7('0x14')]('FaxMessage,\x20%s,\x20%s',_0x54948c,_0xf7c520['error'][_0x43e7('0x16')]);return _0x4139c9(_0xf7c520[_0x43e7('0x14')][_0x43e7('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x54948c,_0x43e7('0x11'));_0x4139c9(_0xf7c520[_0x43e7('0x17')][_0x43e7('0x16')]);}})[_0x43e7('0x18')](function(_0x3776f5){logger[_0x43e7('0x14')](_0x43e7('0x19'),_0x54948c,_0x3776f5);_0x5c34f4(_0x3776f5);});});}exports[_0x43e7('0x1a')]=function(_0x2377a3){var _0xab63cf=this;return new Promise(function(_0x191dd5,_0x177ee1){return db['FaxMessage'][_0x43e7('0x1b')](_0x2377a3[_0x43e7('0x1c')],{'raw':_0x2377a3['options']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![]})[_0x43e7('0x1f')](function(_0x28aacc){logger[_0x43e7('0x10')](_0x43e7('0x1a'),_0x2377a3);logger['debug'](_0x43e7('0x1a'),_0x2377a3,JSON['stringify'](_0x28aacc));_0x191dd5(_0x28aacc);})['catch'](function(_0x47204e){logger[_0x43e7('0x14')]('CreateFaxMessage',_0x47204e[_0x43e7('0x16')],_0x2377a3);_0x177ee1(_0xab63cf['error'](0x1f4,_0x47204e[_0x43e7('0x16')]));});});};exports['UpdateFaxMessage']=function(_0x1af208){var _0x1b5f50=this;return new Promise(function(_0x20888b,_0x405f85){return db['FaxMessage']['update'](_0x1af208[_0x43e7('0x1c')],{'raw':_0x1af208['options']?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')]['where']||null:null,'attributes':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x20')]||null:null,'limit':_0x1af208[_0x43e7('0x1d')]?_0x1af208[_0x43e7('0x1d')][_0x43e7('0x21')]||null:null})[_0x43e7('0x1f')](function(_0x31b2a6){logger[_0x43e7('0x10')](_0x43e7('0x22'),_0x1af208);logger[_0x43e7('0x12')](_0x43e7('0x22'),_0x1af208,JSON[_0x43e7('0x23')](_0x31b2a6));_0x20888b(_0x31b2a6);})[_0x43e7('0x18')](function(_0x4bdb17){logger[_0x43e7('0x14')](_0x43e7('0x22'),_0x4bdb17[_0x43e7('0x16')],_0x1af208);_0x405f85(_0x1b5f50[_0x43e7('0x14')](0x1f4,_0x4bdb17[_0x43e7('0x16')]));});});}; \ No newline at end of file +var _0x8d0e=['http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','debug','UpdateFaxMessage','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1f9e81,_0x4adb1d){var _0x34464e=function(_0xc059a5){while(--_0xc059a5){_0x1f9e81['push'](_0x1f9e81['shift']());}};_0x34464e(++_0x4adb1d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x552e7b,_0x1b9601){_0x552e7b=_0x552e7b-0x0;var _0x16fe1a=_0x8d0e[_0x552e7b];return _0x16fe1a;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});config[_0xe8d0('0xb')]=_[_0xe8d0('0xc')](config[_0xe8d0('0xb')],{'host':_0xe8d0('0xd'),'port':0x18eb});var socket=require(_0xe8d0('0xe'))(new Redis(config[_0xe8d0('0xb')]));require(_0xe8d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x10e56c,_0x19c3d0,_0x463159){return new BPromise(function(_0x599bc3,_0x580aab){return client[_0xe8d0('0x10')](_0x10e56c,_0x463159)[_0xe8d0('0x11')](function(_0x3da047){logger[_0xe8d0('0x12')](_0xe8d0('0x13'),_0x19c3d0,_0xe8d0('0x14'));logger['debug'](_0xe8d0('0x15'),_0x19c3d0,_0xe8d0('0x14'),JSON['stringify'](_0x3da047));if(_0x3da047[_0xe8d0('0x16')]){if(_0x3da047['error']['code']===0x1f4){logger[_0xe8d0('0x16')](_0xe8d0('0x13'),_0x19c3d0,_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);return _0x580aab(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}logger['error'](_0xe8d0('0x13'),_0x19c3d0,_0x3da047['error'][_0xe8d0('0x17')]);return _0x599bc3(_0x3da047[_0xe8d0('0x16')][_0xe8d0('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x19c3d0,'request\x20sent');_0x599bc3(_0x3da047[_0xe8d0('0x18')][_0xe8d0('0x17')]);}})[_0xe8d0('0x19')](function(_0x44bbe4){logger[_0xe8d0('0x16')]('FaxMessage,\x20%s,\x20%s',_0x19c3d0,_0x44bbe4);_0x580aab(_0x44bbe4);});});}exports[_0xe8d0('0x1a')]=function(_0x12ebf4){var _0x524b00=this;return new Promise(function(_0x5ce284,_0x554402){return db[_0xe8d0('0x1b')][_0xe8d0('0x1c')](_0x12ebf4[_0xe8d0('0x1d')],{'raw':_0x12ebf4[_0xe8d0('0x1e')]?_0x12ebf4[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![]})[_0xe8d0('0x11')](function(_0x28a6b5){logger[_0xe8d0('0x12')]('CreateFaxMessage',_0x12ebf4);logger[_0xe8d0('0x20')](_0xe8d0('0x1a'),_0x12ebf4,JSON['stringify'](_0x28a6b5));_0x5ce284(_0x28a6b5);})[_0xe8d0('0x19')](function(_0x2e69d1){logger[_0xe8d0('0x16')](_0xe8d0('0x1a'),_0x2e69d1[_0xe8d0('0x17')],_0x12ebf4);_0x554402(_0x524b00[_0xe8d0('0x16')](0x1f4,_0x2e69d1[_0xe8d0('0x17')]));});});};exports[_0xe8d0('0x21')]=function(_0xfa3527){var _0x2dee67=this;return new Promise(function(_0x264de4,_0x539548){return db[_0xe8d0('0x1b')][_0xe8d0('0x22')](_0xfa3527[_0xe8d0('0x1d')],{'raw':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x23')]||null:null,'attributes':_0xfa3527[_0xe8d0('0x1e')]?_0xfa3527[_0xe8d0('0x1e')][_0xe8d0('0x24')]||null:null,'limit':_0xfa3527['options']?_0xfa3527[_0xe8d0('0x1e')]['limit']||null:null})['then'](function(_0x50ad3c){logger[_0xe8d0('0x12')](_0xe8d0('0x21'),_0xfa3527);logger[_0xe8d0('0x20')]('UpdateFaxMessage',_0xfa3527,JSON['stringify'](_0x50ad3c));_0x264de4(_0x50ad3c);})[_0xe8d0('0x19')](function(_0x551999){logger[_0xe8d0('0x16')](_0xe8d0('0x21'),_0x551999[_0xe8d0('0x17')],_0xfa3527);_0x539548(_0x2dee67[_0xe8d0('0x16')](0x1f4,_0x551999[_0xe8d0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c68d5ed..5cd3822 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 _0x8c08=['register','length','faxMessage:','./faxMessage.events','save','update','emit'];(function(_0x1e287e,_0x21b7bf){var _0x514751=function(_0x21333d){while(--_0x21333d){_0x1e287e['push'](_0x1e287e['shift']());}};_0x514751(++_0x21b7bf);}(_0x8c08,0x18b));var _0x88c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8c08[_0x20a584];return _0x4b41a8;};'use strict';var FaxMessageEvents=require(_0x88c0('0x0'));var events=[_0x88c0('0x1'),'remove',_0x88c0('0x2')];function createListener(_0x5fb1eb,_0x259870){return function(_0x203ddf){_0x259870[_0x88c0('0x3')](_0x5fb1eb,_0x203ddf);};}function removeListener(_0x1c3322,_0x54144a){return function(){FaxMessageEvents['removeListener'](_0x1c3322,_0x54144a);};}exports[_0x88c0('0x4')]=function(_0x3d5cf8){for(var _0x16d243=0x0,_0x46a9ee=events[_0x88c0('0x5')];_0x16d243<_0x46a9ee;_0x16d243++){var _0x5f6012=events[_0x16d243];var _0x12d530=createListener(_0x88c0('0x6')+_0x5f6012,_0x3d5cf8);FaxMessageEvents['on'](_0x5f6012,_0x12d530);}}; \ No newline at end of file +var _0xc258=['faxMessage:','save','remove','update','emit','register'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xc258,0x145));var _0x8c25=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc258[_0x122ef9];return _0x42fba0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x8c25('0x0'),_0x8c25('0x1'),_0x8c25('0x2')];function createListener(_0x10762a,_0x1bdc24){return function(_0x4e2646){_0x1bdc24[_0x8c25('0x3')](_0x10762a,_0x4e2646);};}function removeListener(_0x533838,_0x37c92a){return function(){FaxMessageEvents['removeListener'](_0x533838,_0x37c92a);};}exports[_0x8c25('0x4')]=function(_0x2132ff){for(var _0x1aad5e=0x0,_0x8289f=events['length'];_0x1aad5e<_0x8289f;_0x1aad5e++){var _0x5a02ec=events[_0x1aad5e];var _0x4dad7f=createListener(_0x8c25('0x5')+_0x5a02ec,_0x2132ff);FaxMessageEvents['on'](_0x5a02ec,_0x4dad7f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 687f8a8..059c62d 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 _0xc874=['destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','tracked','faxmessage:create','create','put','accept','/:id/reject','reject','delete'];(function(_0x342c67,_0x17adb8){var _0x34430b=function(_0x21feed){while(--_0x21feed){_0x342c67['push'](_0x342c67['shift']());}};_0x34430b(++_0x17adb8);}(_0xc874,0x154));var _0x4c87=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0xc874[_0x2c27ed];return _0x597bd1;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xb')]);router['get'](_0x4c87('0xc'),auth['isAuthenticated'](),controller[_0x4c87('0xd')]);router[_0x4c87('0x7')](_0x4c87('0xe'),auth[_0x4c87('0xa')](),controller[_0x4c87('0xf')]);router['post']('/',auth[_0x4c87('0xa')](),interaction[_0x4c87('0x10')]('fax',_0x4c87('0x11')),controller[_0x4c87('0x12')]);router[_0x4c87('0x13')](_0x4c87('0xc'),auth[_0x4c87('0xa')](),controller['update']);router['put']('/:id/accept',auth[_0x4c87('0xa')](),controller[_0x4c87('0x14')]);router[_0x4c87('0x13')](_0x4c87('0x15'),auth[_0x4c87('0xa')](),controller[_0x4c87('0x16')]);router[_0x4c87('0x17')](_0x4c87('0xc'),auth['isAuthenticated'](),controller[_0x4c87('0x18')]);module[_0x4c87('0x19')]=router; \ No newline at end of file +var _0x2dae=['faxmessage:create','put','update','/:id/accept','accept','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax'];(function(_0xa25862,_0x27f1a4){var _0x5b9b0a=function(_0x300346){while(--_0x300346){_0xa25862['push'](_0xa25862['shift']());}};_0x5b9b0a(++_0x27f1a4);}(_0x2dae,0xc3));var _0xe2da=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x2dae[_0x5ac84c];return _0x3c53d2;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var fs_extra=require(_0xe2da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var controller=require(_0xe2da('0x8'));router[_0xe2da('0x9')]('/',auth['isAuthenticated'](),controller[_0xe2da('0xa')]);router[_0xe2da('0x9')](_0xe2da('0xb'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xd')]);router[_0xe2da('0x9')](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0xf')]);router['get'](_0xe2da('0x10'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x11')]);router[_0xe2da('0x12')]('/',auth[_0xe2da('0xc')](),interaction[_0xe2da('0x13')](_0xe2da('0x14'),_0xe2da('0x15')),controller['create']);router[_0xe2da('0x16')]('/:id',auth[_0xe2da('0xc')](),controller[_0xe2da('0x17')]);router[_0xe2da('0x16')](_0xe2da('0x18'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x19')]);router[_0xe2da('0x16')]('/:id/reject',auth[_0xe2da('0xc')](),controller['reject']);router['delete'](_0xe2da('0xe'),auth[_0xe2da('0xc')](),controller[_0xe2da('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f816166..8930dab 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 _0xd9d0=['STRING','name','INTEGER','rrmemory','beepall','sequelize','exports'];(function(_0x51797f,_0x2bfc09){var _0x4eaddf=function(_0x2e4f63){while(--_0x2e4f63){_0x51797f['push'](_0x51797f['shift']());}};_0x4eaddf(++_0x2bfc09);}(_0xd9d0,0xe5));var _0x0d9d=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xd9d0[_0x23b655];return _0x364b32;};'use strict';var Sequelize=require(_0x0d9d('0x0'));module[_0x0d9d('0x1')]={'name':{'type':Sequelize[_0x0d9d('0x2')],'unique':_0x0d9d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0d9d('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0d9d('0x5'),_0x0d9d('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x0d9d('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x19e7=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4988fc,_0x3166bb){var _0x2a2a66=function(_0x318e72){while(--_0x318e72){_0x4988fc['push'](_0x4988fc['shift']());}};_0x2a2a66(++_0x3166bb);}(_0x19e7,0xc8));var _0x719e=function(_0x366171,_0x160e18){_0x366171=_0x366171-0x0;var _0x2fb0af=_0x19e7[_0x366171];return _0x2fb0af;};'use strict';var Sequelize=require(_0x719e('0x0'));module[_0x719e('0x1')]={'name':{'type':Sequelize[_0x719e('0x2')],'unique':_0x719e('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x719e('0x2')]},'timeout':{'type':Sequelize[_0x719e('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x719e('0x5')](_0x719e('0x6'),_0x719e('0x7'),_0x719e('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x719e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index e34653d..f153f80 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 _0xedc7=['options','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','user_has_teams','ut.UserId\x20=\x20?','push','QueryTypes','all','union','compact','value','isEmpty','addAgents','spread','removeAgents','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxQueues','then','sendStatus','error','stack','name','index','map','FaxQueue','fieldName','key','model','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','filters','filter','merge','type'];(function(_0x27bb98,_0x276d46){var _0x34c914=function(_0x527f44){while(--_0x527f44){_0x27bb98['push'](_0x27bb98['shift']());}};_0x34c914(++_0x276d46);}(_0xedc7,0xc8));var _0x7edc=function(_0x25ce74,_0x543f3a){_0x25ce74=_0x25ce74-0x0;var _0x4aad94=_0xedc7[_0x25ce74];return _0x4aad94;};'use strict';var emlformat=require(_0x7edc('0x0'));var rimraf=require(_0x7edc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7edc('0x2'));var rp=require(_0x7edc('0x3'));var moment=require(_0x7edc('0x4'));var BPromise=require(_0x7edc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7edc('0x6'));var ejs=require(_0x7edc('0x7'));var fs=require('fs');var fs_extra=require(_0x7edc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7edc('0x9'));var jsforce=require(_0x7edc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7edc('0x6'));var querystring=require(_0x7edc('0xb'));var Papa=require(_0x7edc('0xc'));var Redis=require(_0x7edc('0xd'));var authService=require(_0x7edc('0xe'));var qs=require(_0x7edc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7edc('0x10'));var logger=require(_0x7edc('0x11'))(_0x7edc('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7edc('0x13'));var db=require('../../mysqldb')['db'];config[_0x7edc('0x14')]=_[_0x7edc('0x15')](config['redis'],{'host':_0x7edc('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7edc('0x14')]));require(_0x7edc('0x17'))['register'](socket);function respondWithStatusCode(_0x66104b,_0xaf831){_0xaf831=_0xaf831||0xcc;return function(_0x2e9d33){if(_0x2e9d33){return _0x66104b['sendStatus'](_0xaf831);}return _0x66104b[_0x7edc('0x18')](_0xaf831)[_0x7edc('0x19')]();};}function respondWithResult(_0x410550,_0x100520){_0x100520=_0x100520||0xc8;return function(_0x5dd983){if(_0x5dd983){return _0x410550[_0x7edc('0x18')](_0x100520)['json'](_0x5dd983);}};}function respondWithFilteredResult(_0x3005eb,_0x4d0380){return function(_0x1a833a){if(_0x1a833a){var _0x586c42=typeof _0x4d0380[_0x7edc('0x1a')]==='undefined'&&typeof _0x4d0380['limit']===_0x7edc('0x1b');var _0x88c3db=_0x1a833a['count'];var _0x4608f9=_0x586c42?0x0:_0x4d0380[_0x7edc('0x1a')];var _0xd938c4=_0x586c42?_0x1a833a[_0x7edc('0x1c')]:_0x4d0380[_0x7edc('0x1a')]+_0x4d0380['limit'];var _0x10e2a5;if(_0xd938c4>=_0x88c3db){_0xd938c4=_0x88c3db;_0x10e2a5=0xc8;}else{_0x10e2a5=0xce;}_0x3005eb[_0x7edc('0x18')](_0x10e2a5);return _0x3005eb[_0x7edc('0x1d')](_0x7edc('0x1e'),_0x4608f9+'-'+_0xd938c4+'/'+_0x88c3db)['json'](_0x1a833a);}return null;};}function patchUpdates(_0x53f544){return function(_0x40aa60){try{jsonpatch[_0x7edc('0x1f')](_0x40aa60,_0x53f544,!![]);}catch(_0x311322){return BPromise[_0x7edc('0x20')](_0x311322);}return _0x40aa60[_0x7edc('0x21')]();};}function saveUpdates(_0x365d21,_0x1dbc86){return function(_0x1e7426){if(_0x1e7426){return _0x1e7426[_0x7edc('0x22')](_0x365d21)['then'](function(_0x180a47){return _0x180a47;});}return null;};}function removeEntity(_0x593bf0,_0x5b6e69){return function(_0x4e2d15){if(_0x4e2d15){return _0x4e2d15[_0x7edc('0x23')]()['then'](function(){var _0x522211=_0x4e2d15[_0x7edc('0x24')]({'plain':!![]});var _0x1ffafb=_0x7edc('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x1ffafb,'resourceId':_0x522211['id']}})[_0x7edc('0x26')](function(){return _0x4e2d15;});})[_0x7edc('0x26')](function(){_0x593bf0[_0x7edc('0x18')](0xcc)[_0x7edc('0x19')]();});}};}function handleEntityNotFound(_0x53b104,_0x545889){return function(_0x28976a){if(!_0x28976a){_0x53b104[_0x7edc('0x27')](0x194);}return _0x28976a;};}function handleError(_0x4fd39d,_0xcf081e){_0xcf081e=_0xcf081e||0x1f4;return function(_0xfbfd9){logger[_0x7edc('0x28')](_0xfbfd9[_0x7edc('0x29')]);if(_0xfbfd9[_0x7edc('0x2a')]){delete _0xfbfd9[_0x7edc('0x2a')];}_0x4fd39d['status'](_0xcf081e)['send'](_0xfbfd9);};}exports[_0x7edc('0x2b')]=function(_0x53c387,_0x8cbceb){var _0x386f2d={},_0xad9293={},_0x557c6e={'count':0x0,'rows':[]};var _0x4f0dc2=_[_0x7edc('0x2c')](db[_0x7edc('0x2d')]['rawAttributes'],function(_0x3f7487){return{'name':_0x3f7487[_0x7edc('0x2e')],'type':_0x3f7487['type'][_0x7edc('0x2f')]};});_0xad9293[_0x7edc('0x30')]=_[_0x7edc('0x2c')](_0x4f0dc2,_0x7edc('0x2a'));_0xad9293[_0x7edc('0x31')]=_[_0x7edc('0x32')](_0x53c387[_0x7edc('0x31')]);_0xad9293['filters']=_[_0x7edc('0x33')](_0xad9293['model'],_0xad9293[_0x7edc('0x31')]);_0x386f2d[_0x7edc('0x34')]=_[_0x7edc('0x33')](_0xad9293[_0x7edc('0x30')],qs[_0x7edc('0x35')](_0x53c387['query'][_0x7edc('0x35')]));_0x386f2d[_0x7edc('0x34')]=_0x386f2d['attributes']['length']?_0x386f2d[_0x7edc('0x34')]:_0xad9293[_0x7edc('0x30')];if(!_0x53c387['query']['hasOwnProperty'](_0x7edc('0x36'))){_0x386f2d[_0x7edc('0x37')]=qs['limit'](_0x53c387['query']['limit']);_0x386f2d[_0x7edc('0x1a')]=qs[_0x7edc('0x1a')](_0x53c387[_0x7edc('0x31')][_0x7edc('0x1a')]);}_0x386f2d[_0x7edc('0x38')]=qs['sort'](_0x53c387[_0x7edc('0x31')][_0x7edc('0x39')]);_0x386f2d[_0x7edc('0x3a')]=qs['filters'](_[_0x7edc('0x3b')](_0x53c387[_0x7edc('0x31')],_0xad9293[_0x7edc('0x3c')]),_0x4f0dc2);if(_0x53c387[_0x7edc('0x31')][_0x7edc('0x3d')]){_0x386f2d['where']=_[_0x7edc('0x3e')](_0x386f2d['where'],{'$or':_[_0x7edc('0x2c')](_0x4f0dc2,function(_0x31bfd0){if(_0x31bfd0[_0x7edc('0x3f')]!=='VIRTUAL'){var _0xa8f360={};_0xa8f360[_0x31bfd0['name']]={'$like':'%'+_0x53c387[_0x7edc('0x31')][_0x7edc('0x3d')]+'%'};return _0xa8f360;}})});}_0x386f2d=_[_0x7edc('0x3e')]({},_0x386f2d,_0x53c387[_0x7edc('0x40')]);var _0xe60b2e={'where':_0x386f2d['where']};return db['FaxQueue'][_0x7edc('0x1c')](_0xe60b2e)[_0x7edc('0x26')](function(_0x29c0ce){_0x557c6e[_0x7edc('0x1c')]=_0x29c0ce;if(_0x53c387[_0x7edc('0x31')]['includeAll']){_0x386f2d['include']=[{'all':!![]}];}return db[_0x7edc('0x2d')][_0x7edc('0x41')](_0x386f2d);})[_0x7edc('0x26')](function(_0x41162b){_0x557c6e[_0x7edc('0x42')]=_0x41162b;return _0x557c6e;})[_0x7edc('0x26')](respondWithFilteredResult(_0x8cbceb,_0x386f2d))[_0x7edc('0x43')](handleError(_0x8cbceb,null));};exports[_0x7edc('0x44')]=function(_0x3ee087,_0xbb8bb2){var _0x244d19={'raw':!![],'where':{'id':_0x3ee087[_0x7edc('0x45')]['id']}},_0x19f839={};_0x19f839['model']=_[_0x7edc('0x32')](db[_0x7edc('0x2d')][_0x7edc('0x46')]);_0x19f839[_0x7edc('0x31')]=_[_0x7edc('0x32')](_0x3ee087[_0x7edc('0x31')]);_0x19f839['filters']=_[_0x7edc('0x33')](_0x19f839[_0x7edc('0x30')],_0x19f839[_0x7edc('0x31')]);_0x244d19[_0x7edc('0x34')]=_[_0x7edc('0x33')](_0x19f839[_0x7edc('0x30')],qs[_0x7edc('0x35')](_0x3ee087['query'][_0x7edc('0x35')]));_0x244d19[_0x7edc('0x34')]=_0x244d19[_0x7edc('0x34')]['length']?_0x244d19[_0x7edc('0x34')]:_0x19f839[_0x7edc('0x30')];if(_0x3ee087[_0x7edc('0x31')]['includeAll']){_0x244d19[_0x7edc('0x47')]=[{'all':!![]}];}_0x244d19=_[_0x7edc('0x3e')]({},_0x244d19,_0x3ee087[_0x7edc('0x40')]);return db['FaxQueue'][_0x7edc('0x48')](_0x244d19)[_0x7edc('0x26')](handleEntityNotFound(_0xbb8bb2,null))[_0x7edc('0x26')](respondWithResult(_0xbb8bb2,null))[_0x7edc('0x43')](handleError(_0xbb8bb2,null));};exports[_0x7edc('0x49')]=function(_0x56e261,_0x46ea68){return db['FaxQueue']['create'](_0x56e261[_0x7edc('0x4a')],{})[_0x7edc('0x26')](function(_0x42c098){var _0x533be7=_0x56e261[_0x7edc('0x4b')][_0x7edc('0x24')]({'plain':!![]});if(!_0x533be7)throw new Error(_0x7edc('0x4c'));if(_0x533be7[_0x7edc('0x4d')]==='user'){var _0x5037cc=_0x42c098[_0x7edc('0x24')]({'plain':!![]});var _0x281252=_0x7edc('0x25');return db[_0x7edc('0x4e')][_0x7edc('0x48')]({'where':{'name':_0x281252,'userProfileId':_0x533be7[_0x7edc('0x4f')]},'raw':!![]})[_0x7edc('0x26')](function(_0x27e4ff){if(_0x27e4ff&&_0x27e4ff['autoAssociation']===0x0){return db[_0x7edc('0x50')]['create']({'name':_0x5037cc[_0x7edc('0x2a')],'resourceId':_0x5037cc['id'],'type':_0x27e4ff['name'],'sectionId':_0x27e4ff['id']},{})[_0x7edc('0x26')](function(){return _0x42c098;});}else{return _0x42c098;}})['catch'](function(_0x51708e){logger[_0x7edc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51708e);throw _0x51708e;});}return _0x42c098;})[_0x7edc('0x26')](respondWithResult(_0x46ea68,0xc9))[_0x7edc('0x43')](handleError(_0x46ea68,null));};exports['update']=function(_0x2fcab8,_0x106a4a){if(_0x2fcab8['body']['id']){delete _0x2fcab8[_0x7edc('0x4a')]['id'];}return db[_0x7edc('0x2d')][_0x7edc('0x48')]({'where':{'id':_0x2fcab8[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x106a4a,null))[_0x7edc('0x26')](saveUpdates(_0x2fcab8[_0x7edc('0x4a')],null))['then'](respondWithResult(_0x106a4a,null))[_0x7edc('0x43')](handleError(_0x106a4a,null));};exports['destroy']=function(_0x4c7c1f,_0x3599ab){return db[_0x7edc('0x2d')][_0x7edc('0x48')]({'where':{'id':_0x4c7c1f['params']['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x3599ab,null))[_0x7edc('0x26')](removeEntity(_0x3599ab,null))[_0x7edc('0x43')](handleError(_0x3599ab,null));};exports[_0x7edc('0x51')]=function(_0x1c9c5e,_0x197903){return db['FaxQueue'][_0x7edc('0x51')]()['then'](respondWithResult(_0x197903,null))['catch'](handleError(_0x197903,null));};exports[_0x7edc('0x52')]=function(_0x1326ed,_0x2b77f5,_0x16dad0){var _0x537c67={'raw':!![],'where':{}},_0x46dc01={},_0xf23855;return db[_0x7edc('0x2d')][_0x7edc('0x53')]({'where':{'id':_0x1326ed[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x2b77f5,null))[_0x7edc('0x26')](function(_0x56145b){if(_0x56145b){_0xf23855=_0x56145b['get']({'plain':!![]});_0x46dc01['model']=_[_0x7edc('0x32')](db[_0x7edc('0x54')][_0x7edc('0x46')]);_0x46dc01['query']=_[_0x7edc('0x32')](_0x1326ed[_0x7edc('0x31')]);_0x46dc01[_0x7edc('0x3c')]=_[_0x7edc('0x33')](_0x46dc01['model'],_0x46dc01['query']);_0x537c67[_0x7edc('0x34')]=_[_0x7edc('0x33')](_0x46dc01[_0x7edc('0x30')],qs['fields'](_0x1326ed[_0x7edc('0x31')][_0x7edc('0x35')]));_0x537c67[_0x7edc('0x34')]=_0x537c67['attributes'][_0x7edc('0x55')]?_0x537c67['attributes']:_0x46dc01[_0x7edc('0x30')];if(!_0x1326ed[_0x7edc('0x31')][_0x7edc('0x56')](_0x7edc('0x36'))){_0x537c67[_0x7edc('0x37')]=qs[_0x7edc('0x37')](_0x1326ed['query']['limit']);_0x537c67[_0x7edc('0x1a')]=qs[_0x7edc('0x1a')](_0x1326ed['query'][_0x7edc('0x1a')]);}_0x537c67[_0x7edc('0x38')]=qs[_0x7edc('0x39')](_0x1326ed['query'][_0x7edc('0x39')]);_0x537c67[_0x7edc('0x3a')]=qs[_0x7edc('0x3c')](_[_0x7edc('0x3b')](_0x1326ed[_0x7edc('0x31')],_0x46dc01[_0x7edc('0x3c')]));_0x537c67[_0x7edc('0x3a')][_0x7edc('0x57')]=_0x56145b['id'];if(_0x1326ed[_0x7edc('0x31')][_0x7edc('0x3d')]){_0x537c67[_0x7edc('0x3a')]=_[_0x7edc('0x3e')](_0x537c67['where'],{'$or':_[_0x7edc('0x2c')](_0x537c67['attributes'],function(_0x5c56e3){var _0x128e0a={};_0x128e0a[_0x5c56e3]={'$like':'%'+_0x1326ed[_0x7edc('0x31')][_0x7edc('0x3d')]+'%'};return _0x128e0a;})});}_0x537c67=_[_0x7edc('0x3e')]({},_0x537c67,_0x1326ed[_0x7edc('0x40')]);return db[_0x7edc('0x54')][_0x7edc('0x41')](_0x537c67);}})['then'](function(_0x14cdb0){if(_0x14cdb0){return db[_0x7edc('0x58')][_0x7edc('0x59')]({'where':{'id':_['map'](_0x14cdb0,_0x7edc('0x5a')),'role':_0x7edc('0x5b')},'attributes':['id',_0x7edc('0x2a'),_0x7edc('0x5c'),_0x7edc('0x5d'),_0x7edc('0x5e')]});}})[_0x7edc('0x26')](function(_0x5dc76d){if(_0x5dc76d){return{'count':_0x5dc76d[_0x7edc('0x1c')],'rows':_[_0x7edc('0x2c')](_0x5dc76d[_0x7edc('0x42')],function(_0x37e798){return{'membername':_0x37e798['name'],'UserId':_0x37e798['id'],'queue_name':_0xf23855['name'],'FaxQueueId':_0xf23855['id'],'interface':util[_0x7edc('0x5f')](_0x7edc('0x60'),_0x7edc('0x61'),_0x37e798[_0x7edc('0x2a')]),'penalty':0x0,'paused':_0x37e798[_0x7edc('0x5c')],'createdAt':_0x37e798[_0x7edc('0x5e')],'updatedAt':_0x37e798['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2b77f5,_0x537c67))['catch'](handleError(_0x2b77f5,null));};exports[_0x7edc('0x62')]=function(_0x1e3561,_0x2c0f6c,_0x3c9bb1){var _0x1df101={};var _0x2497c8={};var _0x4d5036;var _0x1fc222;return db[_0x7edc('0x2d')][_0x7edc('0x53')]({'where':{'id':_0x1e3561[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x2c0f6c,null))[_0x7edc('0x26')](function(_0x1ff1d0){if(_0x1ff1d0){_0x4d5036=_0x1ff1d0;_0x2497c8[_0x7edc('0x30')]=_[_0x7edc('0x32')](db[_0x7edc('0x63')]['rawAttributes']);_0x2497c8[_0x7edc('0x31')]=_['keys'](_0x1e3561['query']);_0x2497c8[_0x7edc('0x3c')]=_['intersection'](_0x2497c8[_0x7edc('0x30')],_0x2497c8['query']);_0x1df101[_0x7edc('0x34')]=_[_0x7edc('0x33')](_0x2497c8[_0x7edc('0x30')],qs['fields'](_0x1e3561[_0x7edc('0x31')][_0x7edc('0x35')]));_0x1df101[_0x7edc('0x34')]=_0x1df101[_0x7edc('0x34')]['length']?_0x1df101[_0x7edc('0x34')]:_0x2497c8[_0x7edc('0x30')];_0x1df101[_0x7edc('0x38')]=qs[_0x7edc('0x39')](_0x1e3561[_0x7edc('0x31')][_0x7edc('0x39')]);_0x1df101['where']=qs[_0x7edc('0x3c')](_['pick'](_0x1e3561[_0x7edc('0x31')],_0x2497c8[_0x7edc('0x3c')]));if(_0x1e3561[_0x7edc('0x31')][_0x7edc('0x3d')]){_0x1df101[_0x7edc('0x3a')]=_['merge'](_0x1df101[_0x7edc('0x3a')],{'$or':_[_0x7edc('0x2c')](_0x1df101[_0x7edc('0x34')],function(_0x400ea3){var _0x32e2f9={};_0x32e2f9[_0x400ea3]={'$like':'%'+_0x1e3561[_0x7edc('0x31')][_0x7edc('0x3d')]+'%'};return _0x32e2f9;})});}_0x1df101=_[_0x7edc('0x3e')]({},_0x1df101,_0x1e3561[_0x7edc('0x40')]);return _0x4d5036[_0x7edc('0x62')](_0x1df101);}})['then'](function(_0x5a7f87){if(_0x5a7f87){_0x1fc222=_0x5a7f87['length'];if(!_0x1e3561[_0x7edc('0x31')]['hasOwnProperty'](_0x7edc('0x36'))){_0x1df101[_0x7edc('0x37')]=qs[_0x7edc('0x37')](_0x1e3561[_0x7edc('0x31')][_0x7edc('0x37')]);_0x1df101['offset']=qs[_0x7edc('0x1a')](_0x1e3561['query']['offset']);}return _0x4d5036[_0x7edc('0x62')](_0x1df101);}})['then'](function(_0x14844a){if(_0x14844a){return _0x14844a?{'count':_0x1fc222,'rows':_0x14844a}:null;}})[_0x7edc('0x26')](respondWithResult(_0x2c0f6c,null))['catch'](handleError(_0x2c0f6c,null));};exports[_0x7edc('0x64')]=function(_0x245d5a,_0x47f1dc,_0x487c80){var _0x2bdd29=_0x245d5a[_0x7edc('0x4a')][_0x7edc('0x65')];return db['Team']['findAll']({'where':{'id':_0x2bdd29},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7edc('0x66'),'attributes':['id',_0x7edc('0x2a'),_0x7edc('0x67'),_0x7edc('0x68'),_0x7edc('0x69')],'raw':!![]}]})[_0x7edc('0x26')](function(_0x592b40){if(_0x592b40){var _0x39f1af=_[_0x7edc('0x6a')](_0x592b40,function(_0x4cf13e){var _0x19d32c=_0x4cf13e[_0x7edc('0x24')]({'plain':!![]});return _0x19d32c[_0x7edc('0x66')];});return db[_0x7edc('0x2d')][_0x7edc('0x48')]({'where':{'id':_0x245d5a[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](function(_0x43ada8){return db[_0x7edc('0x6b')][_0x7edc('0x6c')](function(_0x3afbd6){return _0x43ada8[_0x7edc('0x64')](_0x2bdd29,{'transaction':_0x3afbd6})['then'](function(){return BPromise['each'](_0x39f1af,function(_0x18c1f3){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x18c1f3['id'],'FaxQueueId':_0x245d5a[_0x7edc('0x45')]['id']},'transaction':_0x3afbd6});});})[_0x7edc('0x26')](function(){_0x39f1af[_0x7edc('0x6d')](function(_0x2e9137){socket[_0x7edc('0x6e')](_0x7edc('0x6f'),{'UserId':_0x2e9137['id'],'FaxQueueId':_0x43ada8['id']});});});});});}})[_0x7edc('0x26')](respondWithStatusCode(_0x47f1dc,null))[_0x7edc('0x43')](handleError(_0x47f1dc,null));};exports[_0x7edc('0x70')]=function(_0x19d883,_0x11020a,_0x21865b){return db['Team']['findAll']({'where':{'id':_0x19d883[_0x7edc('0x31')][_0x7edc('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7edc('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x11020a,null))['then'](function(_0x13a061){var _0x10ceac=_[_0x7edc('0x2c')](_0x13a061,'id');var _0x5bb5bb=[];var _0x3717e3=[];var _0x178656=squel[_0x7edc('0x71')]();_0x178656[_0x7edc('0x72')]('tq.TeamId')[_0x7edc('0x73')](_0x7edc('0x74'),'tq')['join'](_0x7edc('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7edc('0x3a')]('FaxQueueId\x20=\x20?',_0x19d883[_0x7edc('0x45')]['id']);for(var _0x37a8b5=0x0;_0x37a8b5<_0x13a061['length'];_0x37a8b5+=0x1){let _0x20cb49=_0x13a061[_0x37a8b5];for(var _0x5a2be5=0x0;_0x5a2be5<_0x20cb49[_0x7edc('0x66')][_0x7edc('0x55')];_0x5a2be5+=0x1){let _0x2c1094=_0x20cb49[_0x7edc('0x66')][_0x5a2be5];var _0x372685=_0x178656['clone']();_0x372685['where'](_0x7edc('0x76'),_0x2c1094['id']);_0x3717e3[_0x7edc('0x77')](db[_0x7edc('0x6b')][_0x7edc('0x31')](_0x372685['toString'](),{'type':db[_0x7edc('0x6b')][_0x7edc('0x78')]['SELECT']})['then'](function(_0x4edb1f){if(_0x4edb1f[_0x7edc('0x55')]===0x1){return _0x2c1094['id'];}else{var _0x53cbf3=_['every'](_[_0x7edc('0x2c')](_0x4edb1f,'TeamId'),function(_0x3e9bdb){return _['includes'](_0x10ceac,_0x3e9bdb);});if(_0x53cbf3){return _0x2c1094['id'];}}}));}}return BPromise[_0x7edc('0x79')](_0x3717e3)['then'](function(_0x205122){_0x5bb5bb=_(_0x5bb5bb)[_0x7edc('0x7a')](_0x205122)[_0x7edc('0x7b')]()[_0x7edc('0x7c')]();return db[_0x7edc('0x2d')]['find']({'where':{'id':_0x19d883[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](function(_0x326f86){return db['sequelize']['transaction'](function(_0x24c302){return _0x326f86[_0x7edc('0x70')](_0x19d883[_0x7edc('0x31')][_0x7edc('0x65')],{'transaction':_0x24c302})['then'](function(){if(!_[_0x7edc('0x7d')](_0x5bb5bb)){return _0x326f86['removeAgents'](_0x5bb5bb,{'transaction':_0x24c302});}})[_0x7edc('0x26')](function(){_0x5bb5bb[_0x7edc('0x6d')](function(_0x4917f8){socket['emit']('userFaxQueue:remove',{'UserId':_0x4917f8,'FaxQueueId':_0x326f86['id']});});});});});});})[_0x7edc('0x26')](respondWithStatusCode(_0x11020a,null))[_0x7edc('0x43')](handleError(_0x11020a,null));};exports['addAgents']=function(_0x4411ce,_0x37e694,_0x4e5832){return db[_0x7edc('0x2d')][_0x7edc('0x48')]({'where':{'id':_0x4411ce[_0x7edc('0x45')]['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x37e694,null))[_0x7edc('0x26')](function(_0x1b7bf0){if(_0x1b7bf0){return _0x1b7bf0[_0x7edc('0x7e')](_0x4411ce[_0x7edc('0x4a')][_0x7edc('0x65')],_['omit'](_0x4411ce[_0x7edc('0x4a')],[_0x7edc('0x65'),'id'])||{})[_0x7edc('0x7f')](function(_0x57234f){for(var _0x4a81b7=0x0;_0x4a81b7<_0x4411ce[_0x7edc('0x4a')]['ids']['length'];_0x4a81b7+=0x1){socket[_0x7edc('0x6e')]('userFaxQueue:save',{'UserId':Number(_0x4411ce[_0x7edc('0x4a')][_0x7edc('0x65')][_0x4a81b7]),'FaxQueueId':Number(_0x4411ce[_0x7edc('0x45')]['id'])});}return _0x57234f;});}})[_0x7edc('0x26')](respondWithResult(_0x37e694,null))[_0x7edc('0x43')](handleError(_0x37e694,null));};exports[_0x7edc('0x80')]=function(_0x2acd95,_0xf4164c,_0x4ac3e4){return db[_0x7edc('0x2d')][_0x7edc('0x48')]({'where':{'id':_0x2acd95[_0x7edc('0x45')]['id']}})['then'](handleEntityNotFound(_0xf4164c,null))['then'](function(_0x1c7ebe){if(_0x1c7ebe){return _0x1c7ebe[_0x7edc('0x80')](_0x2acd95[_0x7edc('0x31')][_0x7edc('0x65')])[_0x7edc('0x26')](function(){if(_[_0x7edc('0x81')](_0x2acd95[_0x7edc('0x31')][_0x7edc('0x65')])){for(var _0x1367c7=0x0;_0x1367c7<_0x2acd95[_0x7edc('0x31')][_0x7edc('0x65')]['length'];_0x1367c7+=0x1){socket['emit'](_0x7edc('0x82'),{'UserId':Number(_0x2acd95[_0x7edc('0x31')][_0x7edc('0x65')][_0x1367c7]),'FaxQueueId':Number(_0x2acd95[_0x7edc('0x45')]['id'])});}}else{socket[_0x7edc('0x6e')](_0x7edc('0x82'),{'UserId':Number(_0x2acd95['query'][_0x7edc('0x65')]),'FaxQueueId':Number(_0x2acd95['params']['id'])});}});}})[_0x7edc('0x26')](respondWithStatusCode(_0xf4164c,null))['catch'](handleError(_0xf4164c,null));};exports[_0x7edc('0x83')]=function(_0xa653cf,_0x3f0284,_0x2a0a4b){var _0x53f6ea={};var _0x39e712={};var _0x306aa7;var _0x400c05;return db[_0x7edc('0x2d')][_0x7edc('0x53')]({'where':{'id':_0xa653cf['params']['id']}})[_0x7edc('0x26')](handleEntityNotFound(_0x3f0284,null))[_0x7edc('0x26')](function(_0x3cceae){if(_0x3cceae){_0x306aa7=_0x3cceae;_0x39e712[_0x7edc('0x30')]=_['keys'](db[_0x7edc('0x58')][_0x7edc('0x46')]);_0x39e712[_0x7edc('0x31')]=_[_0x7edc('0x32')](_0xa653cf[_0x7edc('0x31')]);_0x39e712['filters']=_[_0x7edc('0x33')](_0x39e712[_0x7edc('0x30')],_0x39e712[_0x7edc('0x31')]);_0x53f6ea[_0x7edc('0x34')]=_[_0x7edc('0x33')](_0x39e712[_0x7edc('0x30')],qs[_0x7edc('0x35')](_0xa653cf[_0x7edc('0x31')][_0x7edc('0x35')]));_0x53f6ea[_0x7edc('0x34')]=_0x53f6ea[_0x7edc('0x34')][_0x7edc('0x55')]?_0x53f6ea[_0x7edc('0x34')]:_0x39e712[_0x7edc('0x30')];_0x53f6ea[_0x7edc('0x38')]=qs['sort'](_0xa653cf[_0x7edc('0x31')][_0x7edc('0x39')]);_0x53f6ea['where']=qs['filters'](_[_0x7edc('0x3b')](_0xa653cf[_0x7edc('0x31')],_0x39e712[_0x7edc('0x3c')]));if(_0xa653cf[_0x7edc('0x31')][_0x7edc('0x3d')]){_0x53f6ea[_0x7edc('0x3a')]=_['merge'](_0x53f6ea[_0x7edc('0x3a')],{'$or':_[_0x7edc('0x2c')](_0x53f6ea['attributes'],function(_0x508f14){var _0x5d1e8d={};_0x5d1e8d[_0x508f14]={'$like':'%'+_0xa653cf[_0x7edc('0x31')][_0x7edc('0x3d')]+'%'};return _0x5d1e8d;})});}_0x53f6ea=_[_0x7edc('0x3e')]({},_0x53f6ea,_0xa653cf[_0x7edc('0x40')]);return _0x306aa7['getAgents'](_0x53f6ea);}})[_0x7edc('0x26')](function(_0x4aaff1){if(_0x4aaff1){_0x400c05=_0x4aaff1[_0x7edc('0x55')];if(!_0xa653cf['query'][_0x7edc('0x56')]('nolimit')){_0x53f6ea[_0x7edc('0x37')]=qs[_0x7edc('0x37')](_0xa653cf['query'][_0x7edc('0x37')]);_0x53f6ea[_0x7edc('0x1a')]=qs[_0x7edc('0x1a')](_0xa653cf['query'][_0x7edc('0x1a')]);}return _0x306aa7[_0x7edc('0x83')](_0x53f6ea);}})[_0x7edc('0x26')](function(_0x2eb9a6){if(_0x2eb9a6){return _0x2eb9a6?{'count':_0x400c05,'rows':_0x2eb9a6}:null;}})[_0x7edc('0x26')](respondWithResult(_0x3f0284,null))[_0x7edc('0x43')](handleError(_0x3f0284,null));}; \ No newline at end of file +var _0xb838=['find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','findOne','UserFaxQueue','nolimit','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','User','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','userFaxQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','value','ids','emit','userFaxQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','get','FaxQueues','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','filters','length','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb838,0x15b));var _0x8b83=function(_0x365e63,_0x9c4dcd){_0x365e63=_0x365e63-0x0;var _0x274f61=_0xb838[_0x365e63];return _0x274f61;};'use strict';var emlformat=require(_0x8b83('0x0'));var rimraf=require(_0x8b83('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b83('0x2'));var rp=require(_0x8b83('0x3'));var moment=require(_0x8b83('0x4'));var BPromise=require(_0x8b83('0x5'));var Mustache=require(_0x8b83('0x6'));var util=require('util');var path=require(_0x8b83('0x7'));var sox=require(_0x8b83('0x8'));var csv=require(_0x8b83('0x9'));var ejs=require(_0x8b83('0xa'));var fs=require('fs');var fs_extra=require(_0x8b83('0xb'));var _=require(_0x8b83('0xc'));var squel=require(_0x8b83('0xd'));var crypto=require(_0x8b83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b83('0xf'));var toCsv=require(_0x8b83('0x9'));var querystring=require(_0x8b83('0x10'));var Papa=require(_0x8b83('0x11'));var Redis=require(_0x8b83('0x12'));var authService=require(_0x8b83('0x13'));var qs=require(_0x8b83('0x14'));var as=require(_0x8b83('0x15'));var hardwareService=require(_0x8b83('0x16'));var logger=require(_0x8b83('0x17'))('api');var utils=require(_0x8b83('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8b83('0x19'));var db=require(_0x8b83('0x1a'))['db'];config[_0x8b83('0x1b')]=_[_0x8b83('0x1c')](config['redis'],{'host':_0x8b83('0x1d'),'port':0x18eb});var socket=require(_0x8b83('0x1e'))(new Redis(config[_0x8b83('0x1b')]));require(_0x8b83('0x1f'))['register'](socket);function respondWithStatusCode(_0x62d5d8,_0x456942){_0x456942=_0x456942||0xcc;return function(_0xd07bb9){if(_0xd07bb9){return _0x62d5d8[_0x8b83('0x20')](_0x456942);}return _0x62d5d8[_0x8b83('0x21')](_0x456942)[_0x8b83('0x22')]();};}function respondWithResult(_0x1d9bea,_0x484f1c){_0x484f1c=_0x484f1c||0xc8;return function(_0x424209){if(_0x424209){return _0x1d9bea['status'](_0x484f1c)[_0x8b83('0x23')](_0x424209);}};}function respondWithFilteredResult(_0x5d1664,_0x45eb75){return function(_0x1b4af8){if(_0x1b4af8){var _0x12ced2=typeof _0x45eb75[_0x8b83('0x24')]===_0x8b83('0x25')&&typeof _0x45eb75[_0x8b83('0x26')]===_0x8b83('0x25');var _0x4d7b8a=_0x1b4af8['count'];var _0x1831b1=_0x12ced2?0x0:_0x45eb75[_0x8b83('0x24')];var _0x216c35=_0x12ced2?_0x1b4af8[_0x8b83('0x27')]:_0x45eb75[_0x8b83('0x24')]+_0x45eb75['limit'];var _0x2c9573;if(_0x216c35>=_0x4d7b8a){_0x216c35=_0x4d7b8a;_0x2c9573=0xc8;}else{_0x2c9573=0xce;}_0x5d1664[_0x8b83('0x21')](_0x2c9573);return _0x5d1664[_0x8b83('0x28')]('Content-Range',_0x1831b1+'-'+_0x216c35+'/'+_0x4d7b8a)[_0x8b83('0x23')](_0x1b4af8);}return null;};}function patchUpdates(_0x18b944){return function(_0x2742b5){try{jsonpatch['apply'](_0x2742b5,_0x18b944,!![]);}catch(_0x53fb52){return BPromise['reject'](_0x53fb52);}return _0x2742b5[_0x8b83('0x29')]();};}function saveUpdates(_0x59b4df,_0x110d05){return function(_0x14b5d){if(_0x14b5d){return _0x14b5d[_0x8b83('0x2a')](_0x59b4df)[_0x8b83('0x2b')](function(_0x4569a6){return _0x4569a6;});}return null;};}function removeEntity(_0x5ef39a,_0x2fcada){return function(_0x18acc4){if(_0x18acc4){return _0x18acc4['destroy']()[_0x8b83('0x2b')](function(){var _0x4f85dc=_0x18acc4[_0x8b83('0x2c')]({'plain':!![]});var _0x4e8f47=_0x8b83('0x2d');return db[_0x8b83('0x2e')]['destroy']({'where':{'type':_0x4e8f47,'resourceId':_0x4f85dc['id']}})[_0x8b83('0x2b')](function(){return _0x18acc4;});})[_0x8b83('0x2b')](function(){_0x5ef39a[_0x8b83('0x21')](0xcc)[_0x8b83('0x22')]();});}};}function handleEntityNotFound(_0x694f39,_0x450aa1){return function(_0x47ba8f){if(!_0x47ba8f){_0x694f39[_0x8b83('0x20')](0x194);}return _0x47ba8f;};}function handleError(_0x26a7fe,_0xfe6781){_0xfe6781=_0xfe6781||0x1f4;return function(_0x1ea5c5){logger['error'](_0x1ea5c5[_0x8b83('0x2f')]);if(_0x1ea5c5[_0x8b83('0x30')]){delete _0x1ea5c5[_0x8b83('0x30')];}_0x26a7fe[_0x8b83('0x21')](_0xfe6781)[_0x8b83('0x31')](_0x1ea5c5);};}exports[_0x8b83('0x32')]=function(_0xd354a9,_0xd762a8){var _0x2de35b={},_0x1eaebe={},_0x305ab1={'count':0x0,'rows':[]};var _0x588193=_[_0x8b83('0x33')](db[_0x8b83('0x34')][_0x8b83('0x35')],function(_0x28e459){return{'name':_0x28e459['fieldName'],'type':_0x28e459[_0x8b83('0x36')]['key']};});_0x1eaebe[_0x8b83('0x37')]=_[_0x8b83('0x33')](_0x588193,_0x8b83('0x30'));_0x1eaebe['query']=_[_0x8b83('0x38')](_0xd354a9[_0x8b83('0x39')]);_0x1eaebe['filters']=_[_0x8b83('0x3a')](_0x1eaebe[_0x8b83('0x37')],_0x1eaebe[_0x8b83('0x39')]);_0x2de35b[_0x8b83('0x3b')]=_['intersection'](_0x1eaebe[_0x8b83('0x37')],qs[_0x8b83('0x3c')](_0xd354a9[_0x8b83('0x39')][_0x8b83('0x3c')]));_0x2de35b[_0x8b83('0x3b')]=_0x2de35b[_0x8b83('0x3b')]['length']?_0x2de35b[_0x8b83('0x3b')]:_0x1eaebe['model'];if(!_0xd354a9['query'][_0x8b83('0x3d')]('nolimit')){_0x2de35b[_0x8b83('0x26')]=qs[_0x8b83('0x26')](_0xd354a9['query'][_0x8b83('0x26')]);_0x2de35b[_0x8b83('0x24')]=qs['offset'](_0xd354a9[_0x8b83('0x39')]['offset']);}_0x2de35b[_0x8b83('0x3e')]=qs[_0x8b83('0x3f')](_0xd354a9[_0x8b83('0x39')]['sort']);_0x2de35b['where']=qs['filters'](_[_0x8b83('0x40')](_0xd354a9[_0x8b83('0x39')],_0x1eaebe['filters']),_0x588193);if(_0xd354a9[_0x8b83('0x39')][_0x8b83('0x41')]){_0x2de35b[_0x8b83('0x42')]=_[_0x8b83('0x43')](_0x2de35b['where'],{'$or':_[_0x8b83('0x33')](_0x588193,function(_0x28df50){if(_0x28df50[_0x8b83('0x36')]!==_0x8b83('0x44')){var _0x1e1e69={};_0x1e1e69[_0x28df50[_0x8b83('0x30')]]={'$like':'%'+_0xd354a9[_0x8b83('0x39')][_0x8b83('0x41')]+'%'};return _0x1e1e69;}})});}_0x2de35b=_['merge']({},_0x2de35b,_0xd354a9[_0x8b83('0x45')]);var _0x3607de={'where':_0x2de35b['where']};return db[_0x8b83('0x34')][_0x8b83('0x27')](_0x3607de)[_0x8b83('0x2b')](function(_0x1f4d25){_0x305ab1[_0x8b83('0x27')]=_0x1f4d25;if(_0xd354a9[_0x8b83('0x39')]['includeAll']){_0x2de35b[_0x8b83('0x46')]=[{'all':!![]}];}return db[_0x8b83('0x34')][_0x8b83('0x47')](_0x2de35b);})[_0x8b83('0x2b')](function(_0x4109ba){_0x305ab1['rows']=_0x4109ba;return _0x305ab1;})[_0x8b83('0x2b')](respondWithFilteredResult(_0xd762a8,_0x2de35b))['catch'](handleError(_0xd762a8,null));};exports[_0x8b83('0x48')]=function(_0x301507,_0x371dc2){var _0x89352={'raw':!![],'where':{'id':_0x301507['params']['id']}},_0x3f6bf8={};_0x3f6bf8['model']=_['keys'](db['FaxQueue'][_0x8b83('0x35')]);_0x3f6bf8[_0x8b83('0x39')]=_[_0x8b83('0x38')](_0x301507[_0x8b83('0x39')]);_0x3f6bf8[_0x8b83('0x49')]=_[_0x8b83('0x3a')](_0x3f6bf8[_0x8b83('0x37')],_0x3f6bf8[_0x8b83('0x39')]);_0x89352[_0x8b83('0x3b')]=_['intersection'](_0x3f6bf8[_0x8b83('0x37')],qs[_0x8b83('0x3c')](_0x301507['query']['fields']));_0x89352[_0x8b83('0x3b')]=_0x89352['attributes'][_0x8b83('0x4a')]?_0x89352[_0x8b83('0x3b')]:_0x3f6bf8['model'];if(_0x301507[_0x8b83('0x39')][_0x8b83('0x4b')]){_0x89352[_0x8b83('0x46')]=[{'all':!![]}];}_0x89352=_[_0x8b83('0x43')]({},_0x89352,_0x301507[_0x8b83('0x45')]);return db['FaxQueue'][_0x8b83('0x4c')](_0x89352)['then'](handleEntityNotFound(_0x371dc2,null))[_0x8b83('0x2b')](respondWithResult(_0x371dc2,null))[_0x8b83('0x4d')](handleError(_0x371dc2,null));};exports[_0x8b83('0x4e')]=function(_0x3801ea,_0x268681){return db[_0x8b83('0x34')][_0x8b83('0x4e')](_0x3801ea[_0x8b83('0x4f')],{})[_0x8b83('0x2b')](function(_0x7e2bdd){var _0x3e0f65=_0x3801ea[_0x8b83('0x50')][_0x8b83('0x2c')]({'plain':!![]});if(!_0x3e0f65)throw new Error(_0x8b83('0x51'));if(_0x3e0f65[_0x8b83('0x52')]===_0x8b83('0x50')){var _0x5c4a91=_0x7e2bdd[_0x8b83('0x2c')]({'plain':!![]});var _0x37eee7=_0x8b83('0x2d');return db['UserProfileSection'][_0x8b83('0x4c')]({'where':{'name':_0x37eee7,'userProfileId':_0x3e0f65['userProfileId']},'raw':!![]})['then'](function(_0x4763ba){if(_0x4763ba&&_0x4763ba[_0x8b83('0x53')]===0x0){return db[_0x8b83('0x2e')][_0x8b83('0x4e')]({'name':_0x5c4a91['name'],'resourceId':_0x5c4a91['id'],'type':_0x4763ba['name'],'sectionId':_0x4763ba['id']},{})['then'](function(){return _0x7e2bdd;});}else{return _0x7e2bdd;}})[_0x8b83('0x4d')](function(_0x142d47){logger['error'](_0x8b83('0x54'),_0x142d47);throw _0x142d47;});}return _0x7e2bdd;})[_0x8b83('0x2b')](respondWithResult(_0x268681,0xc9))[_0x8b83('0x4d')](handleError(_0x268681,null));};exports['update']=function(_0x5b9987,_0x10f912){if(_0x5b9987[_0x8b83('0x4f')]['id']){delete _0x5b9987['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x5b9987[_0x8b83('0x55')]['id']}})['then'](handleEntityNotFound(_0x10f912,null))['then'](saveUpdates(_0x5b9987[_0x8b83('0x4f')],null))[_0x8b83('0x2b')](respondWithResult(_0x10f912,null))[_0x8b83('0x4d')](handleError(_0x10f912,null));};exports[_0x8b83('0x56')]=function(_0x8fec44,_0x176382){return db[_0x8b83('0x34')][_0x8b83('0x4c')]({'where':{'id':_0x8fec44[_0x8b83('0x55')]['id']}})['then'](handleEntityNotFound(_0x176382,null))[_0x8b83('0x2b')](removeEntity(_0x176382,null))['catch'](handleError(_0x176382,null));};exports[_0x8b83('0x57')]=function(_0x1126ba,_0x3b1352){return db[_0x8b83('0x34')][_0x8b83('0x57')]()[_0x8b83('0x2b')](respondWithResult(_0x3b1352,null))[_0x8b83('0x4d')](handleError(_0x3b1352,null));};exports['getMembers']=function(_0x4c542c,_0x377c72,_0x3f0a75){var _0x1c7493={'raw':!![],'where':{}},_0x5bb61c={},_0x5b937e;return db['FaxQueue'][_0x8b83('0x58')]({'where':{'id':_0x4c542c['params']['id']}})[_0x8b83('0x2b')](handleEntityNotFound(_0x377c72,null))['then'](function(_0x994890){if(_0x994890){_0x5b937e=_0x994890['get']({'plain':!![]});_0x5bb61c[_0x8b83('0x37')]=_[_0x8b83('0x38')](db[_0x8b83('0x59')][_0x8b83('0x35')]);_0x5bb61c[_0x8b83('0x39')]=_[_0x8b83('0x38')](_0x4c542c['query']);_0x5bb61c[_0x8b83('0x49')]=_['intersection'](_0x5bb61c[_0x8b83('0x37')],_0x5bb61c[_0x8b83('0x39')]);_0x1c7493[_0x8b83('0x3b')]=_[_0x8b83('0x3a')](_0x5bb61c[_0x8b83('0x37')],qs['fields'](_0x4c542c[_0x8b83('0x39')][_0x8b83('0x3c')]));_0x1c7493['attributes']=_0x1c7493['attributes'][_0x8b83('0x4a')]?_0x1c7493[_0x8b83('0x3b')]:_0x5bb61c[_0x8b83('0x37')];if(!_0x4c542c[_0x8b83('0x39')]['hasOwnProperty'](_0x8b83('0x5a'))){_0x1c7493[_0x8b83('0x26')]=qs[_0x8b83('0x26')](_0x4c542c[_0x8b83('0x39')][_0x8b83('0x26')]);_0x1c7493[_0x8b83('0x24')]=qs[_0x8b83('0x24')](_0x4c542c['query'][_0x8b83('0x24')]);}_0x1c7493[_0x8b83('0x3e')]=qs[_0x8b83('0x3f')](_0x4c542c[_0x8b83('0x39')][_0x8b83('0x3f')]);_0x1c7493[_0x8b83('0x42')]=qs[_0x8b83('0x49')](_[_0x8b83('0x40')](_0x4c542c[_0x8b83('0x39')],_0x5bb61c[_0x8b83('0x49')]));_0x1c7493[_0x8b83('0x42')][_0x8b83('0x5b')]=_0x994890['id'];if(_0x4c542c[_0x8b83('0x39')][_0x8b83('0x41')]){_0x1c7493[_0x8b83('0x42')]=_['merge'](_0x1c7493[_0x8b83('0x42')],{'$or':_[_0x8b83('0x33')](_0x1c7493['attributes'],function(_0x48b62f){var _0x60d795={};_0x60d795[_0x48b62f]={'$like':'%'+_0x4c542c[_0x8b83('0x39')][_0x8b83('0x41')]+'%'};return _0x60d795;})});}_0x1c7493=_[_0x8b83('0x43')]({},_0x1c7493,_0x4c542c[_0x8b83('0x45')]);return db[_0x8b83('0x59')][_0x8b83('0x47')](_0x1c7493);}})[_0x8b83('0x2b')](function(_0x401e07){if(_0x401e07){return db['User'][_0x8b83('0x5c')]({'where':{'id':_[_0x8b83('0x33')](_0x401e07,_0x8b83('0x5d')),'role':_0x8b83('0x5e')},'attributes':['id','name',_0x8b83('0x5f'),_0x8b83('0x60'),_0x8b83('0x61')]});}})[_0x8b83('0x2b')](function(_0x3330f3){if(_0x3330f3){return{'count':_0x3330f3[_0x8b83('0x27')],'rows':_[_0x8b83('0x33')](_0x3330f3['rows'],function(_0x2aa7ce){return{'membername':_0x2aa7ce['name'],'UserId':_0x2aa7ce['id'],'queue_name':_0x5b937e[_0x8b83('0x30')],'FaxQueueId':_0x5b937e['id'],'interface':util[_0x8b83('0x62')](_0x8b83('0x63'),_0x8b83('0x64'),_0x2aa7ce[_0x8b83('0x30')]),'penalty':0x0,'paused':_0x2aa7ce[_0x8b83('0x5f')],'createdAt':_0x2aa7ce['createdAt'],'updatedAt':_0x2aa7ce[_0x8b83('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b83('0x2b')](respondWithFilteredResult(_0x377c72,_0x1c7493))[_0x8b83('0x4d')](handleError(_0x377c72,null));};exports[_0x8b83('0x65')]=function(_0x3630b6,_0x3d3689,_0x5ee41b){var _0x148113={};var _0x29584c={};var _0x11d086;var _0x59fbf1;return db['FaxQueue'][_0x8b83('0x58')]({'where':{'id':_0x3630b6[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](handleEntityNotFound(_0x3d3689,null))[_0x8b83('0x2b')](function(_0x32ce10){if(_0x32ce10){_0x11d086=_0x32ce10;_0x29584c[_0x8b83('0x37')]=_[_0x8b83('0x38')](db[_0x8b83('0x66')]['rawAttributes']);_0x29584c[_0x8b83('0x39')]=_[_0x8b83('0x38')](_0x3630b6[_0x8b83('0x39')]);_0x29584c[_0x8b83('0x49')]=_[_0x8b83('0x3a')](_0x29584c[_0x8b83('0x37')],_0x29584c[_0x8b83('0x39')]);_0x148113[_0x8b83('0x3b')]=_['intersection'](_0x29584c[_0x8b83('0x37')],qs[_0x8b83('0x3c')](_0x3630b6['query'][_0x8b83('0x3c')]));_0x148113[_0x8b83('0x3b')]=_0x148113['attributes']['length']?_0x148113[_0x8b83('0x3b')]:_0x29584c['model'];_0x148113['order']=qs[_0x8b83('0x3f')](_0x3630b6[_0x8b83('0x39')][_0x8b83('0x3f')]);_0x148113[_0x8b83('0x42')]=qs[_0x8b83('0x49')](_[_0x8b83('0x40')](_0x3630b6[_0x8b83('0x39')],_0x29584c[_0x8b83('0x49')]));if(_0x3630b6['query'][_0x8b83('0x41')]){_0x148113[_0x8b83('0x42')]=_['merge'](_0x148113[_0x8b83('0x42')],{'$or':_[_0x8b83('0x33')](_0x148113['attributes'],function(_0x5ef3d8){var _0xfdbdc1={};_0xfdbdc1[_0x5ef3d8]={'$like':'%'+_0x3630b6['query'][_0x8b83('0x41')]+'%'};return _0xfdbdc1;})});}_0x148113=_[_0x8b83('0x43')]({},_0x148113,_0x3630b6[_0x8b83('0x45')]);return _0x11d086[_0x8b83('0x65')](_0x148113);}})[_0x8b83('0x2b')](function(_0x195e2f){if(_0x195e2f){_0x59fbf1=_0x195e2f[_0x8b83('0x4a')];if(!_0x3630b6[_0x8b83('0x39')]['hasOwnProperty'](_0x8b83('0x5a'))){_0x148113['limit']=qs[_0x8b83('0x26')](_0x3630b6['query'][_0x8b83('0x26')]);_0x148113['offset']=qs[_0x8b83('0x24')](_0x3630b6[_0x8b83('0x39')][_0x8b83('0x24')]);}return _0x11d086[_0x8b83('0x65')](_0x148113);}})[_0x8b83('0x2b')](function(_0x33ec75){if(_0x33ec75){return _0x33ec75?{'count':_0x59fbf1,'rows':_0x33ec75}:null;}})[_0x8b83('0x2b')](respondWithResult(_0x3d3689,null))[_0x8b83('0x4d')](handleError(_0x3d3689,null));};exports['addTeams']=function(_0x554645,_0x4fa288,_0x545be0){var _0x36010d=_0x554645['body']['ids'];return db['Team'][_0x8b83('0x47')]({'where':{'id':_0x36010d},'attributes':['id'],'include':[{'model':db[_0x8b83('0x67')],'as':'Agents','attributes':['id',_0x8b83('0x30'),_0x8b83('0x68'),_0x8b83('0x69'),_0x8b83('0x6a')],'raw':!![]}]})['then'](function(_0x573fc5){if(_0x573fc5){var _0xf8979d=_[_0x8b83('0x6b')](_0x573fc5,function(_0xbe336a){var _0xd51f09=_0xbe336a[_0x8b83('0x2c')]({'plain':!![]});return _0xd51f09['Agents'];});return db['FaxQueue'][_0x8b83('0x4c')]({'where':{'id':_0x554645[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](function(_0x5f3023){return db[_0x8b83('0x6c')][_0x8b83('0x6d')](function(_0x3f41d7){return _0x5f3023[_0x8b83('0x6e')](_0x36010d,{'transaction':_0x3f41d7})[_0x8b83('0x2b')](function(){return BPromise[_0x8b83('0x6f')](_0xf8979d,function(_0x27e7a8){return db['UserFaxQueue'][_0x8b83('0x70')]({'where':{'UserId':_0x27e7a8['id'],'FaxQueueId':_0x554645[_0x8b83('0x55')]['id']},'transaction':_0x3f41d7});});})[_0x8b83('0x2b')](function(){_0xf8979d['forEach'](function(_0xacc0a7){socket['emit'](_0x8b83('0x71'),{'UserId':_0xacc0a7['id'],'FaxQueueId':_0x5f3023['id']});});});});});}})[_0x8b83('0x2b')](respondWithStatusCode(_0x4fa288,null))[_0x8b83('0x4d')](handleError(_0x4fa288,null));};exports[_0x8b83('0x72')]=function(_0x2ee69f,_0x44288b,_0x30e8f1){return db['Team'][_0x8b83('0x47')]({'where':{'id':_0x2ee69f['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8b83('0x67')],'as':_0x8b83('0x73'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44288b,null))[_0x8b83('0x2b')](function(_0x5ccc9b){var _0x5ad149=_[_0x8b83('0x33')](_0x5ccc9b,'id');var _0x2e5eee=[];var _0x418123=[];var _0x537e29=squel[_0x8b83('0x74')]();_0x537e29[_0x8b83('0x75')](_0x8b83('0x76'))[_0x8b83('0x77')](_0x8b83('0x78'),'tq')[_0x8b83('0x79')]('user_has_teams','ut',_0x8b83('0x7a'))['where'](_0x8b83('0x7b'),_0x2ee69f['params']['id']);for(var _0x3f1ddb=0x0;_0x3f1ddb<_0x5ccc9b['length'];_0x3f1ddb+=0x1){let _0x1c858b=_0x5ccc9b[_0x3f1ddb];for(var _0x15fbe5=0x0;_0x15fbe5<_0x1c858b[_0x8b83('0x73')][_0x8b83('0x4a')];_0x15fbe5+=0x1){let _0x14bb21=_0x1c858b[_0x8b83('0x73')][_0x15fbe5];var _0x19c591=_0x537e29[_0x8b83('0x7c')]();_0x19c591[_0x8b83('0x42')](_0x8b83('0x7d'),_0x14bb21['id']);_0x418123[_0x8b83('0x7e')](db[_0x8b83('0x6c')][_0x8b83('0x39')](_0x19c591[_0x8b83('0x7f')](),{'type':db['sequelize'][_0x8b83('0x80')][_0x8b83('0x81')]})['then'](function(_0x4fae6f){if(_0x4fae6f['length']===0x1){return _0x14bb21['id'];}else{var _0x305bd2=_['every'](_[_0x8b83('0x33')](_0x4fae6f,_0x8b83('0x82')),function(_0x1e4777){return _[_0x8b83('0x83')](_0x5ad149,_0x1e4777);});if(_0x305bd2){return _0x14bb21['id'];}}}));}}return BPromise[_0x8b83('0x84')](_0x418123)[_0x8b83('0x2b')](function(_0x396b55){_0x2e5eee=_(_0x2e5eee)['union'](_0x396b55)['compact']()[_0x8b83('0x85')]();return db['FaxQueue'][_0x8b83('0x4c')]({'where':{'id':_0x2ee69f[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](function(_0x1fffd7){return db[_0x8b83('0x6c')]['transaction'](function(_0x2af876){return _0x1fffd7[_0x8b83('0x72')](_0x2ee69f[_0x8b83('0x39')][_0x8b83('0x86')],{'transaction':_0x2af876})[_0x8b83('0x2b')](function(){if(!_['isEmpty'](_0x2e5eee)){return _0x1fffd7['removeAgents'](_0x2e5eee,{'transaction':_0x2af876});}})[_0x8b83('0x2b')](function(){_0x2e5eee['forEach'](function(_0x5ae8a2){socket[_0x8b83('0x87')](_0x8b83('0x88'),{'UserId':_0x5ae8a2,'FaxQueueId':_0x1fffd7['id']});});});});});});})[_0x8b83('0x2b')](respondWithStatusCode(_0x44288b,null))[_0x8b83('0x4d')](handleError(_0x44288b,null));};exports[_0x8b83('0x89')]=function(_0x53a48b,_0x425eac,_0xc2e183){return db[_0x8b83('0x34')][_0x8b83('0x4c')]({'where':{'id':_0x53a48b[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](handleEntityNotFound(_0x425eac,null))['then'](function(_0x2c41a8){if(_0x2c41a8){return _0x2c41a8[_0x8b83('0x89')](_0x53a48b[_0x8b83('0x4f')]['ids'],_['omit'](_0x53a48b[_0x8b83('0x4f')],[_0x8b83('0x86'),'id'])||{})[_0x8b83('0x8a')](function(_0x3f64f2){for(var _0x43ed64=0x0;_0x43ed64<_0x53a48b[_0x8b83('0x4f')]['ids'][_0x8b83('0x4a')];_0x43ed64+=0x1){socket[_0x8b83('0x87')](_0x8b83('0x71'),{'UserId':Number(_0x53a48b[_0x8b83('0x4f')][_0x8b83('0x86')][_0x43ed64]),'FaxQueueId':Number(_0x53a48b[_0x8b83('0x55')]['id'])});}return _0x3f64f2;});}})[_0x8b83('0x2b')](respondWithResult(_0x425eac,null))['catch'](handleError(_0x425eac,null));};exports['removeAgents']=function(_0x3818f9,_0x41d364,_0x103a8c){return db[_0x8b83('0x34')][_0x8b83('0x4c')]({'where':{'id':_0x3818f9[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](handleEntityNotFound(_0x41d364,null))[_0x8b83('0x2b')](function(_0x1e9d0d){if(_0x1e9d0d){return _0x1e9d0d['removeAgents'](_0x3818f9['query'][_0x8b83('0x86')])[_0x8b83('0x2b')](function(){if(_[_0x8b83('0x8b')](_0x3818f9[_0x8b83('0x39')][_0x8b83('0x86')])){for(var _0x4dbe6e=0x0;_0x4dbe6e<_0x3818f9[_0x8b83('0x39')][_0x8b83('0x86')][_0x8b83('0x4a')];_0x4dbe6e+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3818f9[_0x8b83('0x39')][_0x8b83('0x86')][_0x4dbe6e]),'FaxQueueId':Number(_0x3818f9['params']['id'])});}}else{socket[_0x8b83('0x87')]('userFaxQueue:remove',{'UserId':Number(_0x3818f9[_0x8b83('0x39')][_0x8b83('0x86')]),'FaxQueueId':Number(_0x3818f9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x41d364,null))[_0x8b83('0x4d')](handleError(_0x41d364,null));};exports['getAgents']=function(_0x3f4528,_0x15d68e,_0x5f4585){var _0x6fb396={};var _0x55a99c={};var _0x5eccd4;var _0x3d8323;return db[_0x8b83('0x34')][_0x8b83('0x58')]({'where':{'id':_0x3f4528[_0x8b83('0x55')]['id']}})[_0x8b83('0x2b')](handleEntityNotFound(_0x15d68e,null))['then'](function(_0xa8a28d){if(_0xa8a28d){_0x5eccd4=_0xa8a28d;_0x55a99c[_0x8b83('0x37')]=_[_0x8b83('0x38')](db[_0x8b83('0x67')][_0x8b83('0x35')]);_0x55a99c[_0x8b83('0x39')]=_[_0x8b83('0x38')](_0x3f4528[_0x8b83('0x39')]);_0x55a99c[_0x8b83('0x49')]=_[_0x8b83('0x3a')](_0x55a99c[_0x8b83('0x37')],_0x55a99c[_0x8b83('0x39')]);_0x6fb396[_0x8b83('0x3b')]=_[_0x8b83('0x3a')](_0x55a99c[_0x8b83('0x37')],qs['fields'](_0x3f4528['query'][_0x8b83('0x3c')]));_0x6fb396[_0x8b83('0x3b')]=_0x6fb396[_0x8b83('0x3b')]['length']?_0x6fb396['attributes']:_0x55a99c[_0x8b83('0x37')];_0x6fb396['order']=qs[_0x8b83('0x3f')](_0x3f4528[_0x8b83('0x39')][_0x8b83('0x3f')]);_0x6fb396[_0x8b83('0x42')]=qs[_0x8b83('0x49')](_['pick'](_0x3f4528[_0x8b83('0x39')],_0x55a99c[_0x8b83('0x49')]));if(_0x3f4528[_0x8b83('0x39')][_0x8b83('0x41')]){_0x6fb396['where']=_[_0x8b83('0x43')](_0x6fb396[_0x8b83('0x42')],{'$or':_[_0x8b83('0x33')](_0x6fb396[_0x8b83('0x3b')],function(_0x391122){var _0x61e2b2={};_0x61e2b2[_0x391122]={'$like':'%'+_0x3f4528[_0x8b83('0x39')][_0x8b83('0x41')]+'%'};return _0x61e2b2;})});}_0x6fb396=_[_0x8b83('0x43')]({},_0x6fb396,_0x3f4528[_0x8b83('0x45')]);return _0x5eccd4[_0x8b83('0x8c')](_0x6fb396);}})[_0x8b83('0x2b')](function(_0x2e646a){if(_0x2e646a){_0x3d8323=_0x2e646a[_0x8b83('0x4a')];if(!_0x3f4528[_0x8b83('0x39')][_0x8b83('0x3d')](_0x8b83('0x5a'))){_0x6fb396['limit']=qs[_0x8b83('0x26')](_0x3f4528[_0x8b83('0x39')]['limit']);_0x6fb396[_0x8b83('0x24')]=qs['offset'](_0x3f4528[_0x8b83('0x39')][_0x8b83('0x24')]);}return _0x5eccd4[_0x8b83('0x8c')](_0x6fb396);}})[_0x8b83('0x2b')](function(_0x5b8316){if(_0x5b8316){return _0x5b8316?{'count':_0x3d8323,'rows':_0x5b8316}:null;}})[_0x8b83('0x2b')](respondWithResult(_0x15d68e,null))[_0x8b83('0x4d')](handleError(_0x15d68e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2e77e26..b5c4a69 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 _0x9297=['save','remove','emit','exports','events','FaxQueue','setMaxListeners'];(function(_0x1adfe0,_0x51fb99){var _0x5f421f=function(_0x41527e){while(--_0x41527e){_0x1adfe0['push'](_0x1adfe0['shift']());}};_0x5f421f(++_0x51fb99);}(_0x9297,0xcf));var _0x7929=function(_0x45a74a,_0x5b320c){_0x45a74a=_0x45a74a-0x0;var _0xa53e84=_0x9297[_0x45a74a];return _0xa53e84;};'use strict';var EventEmitter=require(_0x7929('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x7929('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x7929('0x2')](0x0);var events={'afterCreate':_0x7929('0x3'),'afterUpdate':'update','afterDestroy':_0x7929('0x4')};function emitEvent(_0x5ece8c){return function(_0x43219a,_0x445fb8,_0x32b806){FaxQueueEvents[_0x7929('0x5')](_0x5ece8c+':'+_0x43219a['id'],_0x43219a);FaxQueueEvents['emit'](_0x5ece8c,_0x43219a);_0x32b806(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x7929('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x49ab=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','save','remove'];(function(_0x2c08ca,_0x46701f){var _0x5efcdd=function(_0x125e86){while(--_0x125e86){_0x2c08ca['push'](_0x2c08ca['shift']());}};_0x5efcdd(++_0x46701f);}(_0x49ab,0x15b));var _0xb49a=function(_0x332caf,_0xe4f3f1){_0x332caf=_0x332caf-0x0;var _0x489de2=_0x49ab[_0x332caf];return _0x489de2;};'use strict';var EventEmitter=require(_0xb49a('0x0'));var FaxQueue=require(_0xb49a('0x1'))['db'][_0xb49a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb49a('0x3'),'afterUpdate':'update','afterDestroy':_0xb49a('0x4')};function emitEvent(_0x453fe6){return function(_0x4eef8d,_0x2f8387,_0x3ee758){FaxQueueEvents['emit'](_0x453fe6+':'+_0x4eef8d['id'],_0x4eef8d);FaxQueueEvents[_0xb49a('0x5')](_0x453fe6,_0x4eef8d);_0x3ee758(null);};}for(var e in events){if(events[_0xb49a('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xb49a('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 989c334..590c9c8 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 _0xd71b=['exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xd71b,0xd3));var _0xbd71=function(_0x96f10c,_0x180fff){_0x96f10c=_0x96f10c-0x0;var _0x468fc0=_0xd71b[_0x96f10c];return _0x468fc0;};'use strict';var _=require(_0xbd71('0x0'));var util=require(_0xbd71('0x1'));var logger=require(_0xbd71('0x2'))(_0xbd71('0x3'));var moment=require(_0xbd71('0x4'));var BPromise=require(_0xbd71('0x5'));var rp=require(_0xbd71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd71('0x7'));var config=require(_0xbd71('0x8'));var attributes=require(_0xbd71('0x9'));module[_0xbd71('0xa')]=function(_0x201da1,_0x5b7e3d){return _0x201da1[_0xbd71('0xb')](_0xbd71('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf42f=['rimraf','./faxQueue.attributes','exports','FaxQueue','lodash','util','bluebird','request-promise'];(function(_0x23599a,_0x150499){var _0x151f64=function(_0x37eb9b){while(--_0x37eb9b){_0x23599a['push'](_0x23599a['shift']());}};_0x151f64(++_0x150499);}(_0xf42f,0x1ec));var _0xff42=function(_0x3f3a22,_0x4a5d0e){_0x3f3a22=_0x3f3a22-0x0;var _0x5a0c31=_0xf42f[_0x3f3a22];return _0x5a0c31;};'use strict';var _=require(_0xff42('0x0'));var util=require(_0xff42('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xff42('0x2'));var rp=require(_0xff42('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff42('0x4'));var config=require('../../config/environment');var attributes=require(_0xff42('0x5'));module[_0xff42('0x6')]=function(_0x592d35,_0x513621){return _0x592d35['define'](_0xff42('0x7'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 5868d79..f323202 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 _0xc46c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./faxQueue.socket','register','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll','options','raw','where','attributes','include','map','model','then','GetFaxQueue','ShowFaxQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2078ea,_0x3f782c){var _0x4c77a5=function(_0x427ffb){while(--_0x427ffb){_0x2078ea['push'](_0x2078ea['shift']());}};_0x4c77a5(++_0x3f782c);}(_0xc46c,0x192));var _0xcc46=function(_0x491faa,_0x4f2907){_0x491faa=_0x491faa-0x0;var _0x414440=_0xc46c[_0x491faa];return _0x414440;};'use strict';var _=require('lodash');var util=require(_0xcc46('0x0'));var moment=require('moment');var BPromise=require(_0xcc46('0x1'));var rs=require(_0xcc46('0x2'));var fs=require('fs');var Redis=require(_0xcc46('0x3'));var db=require(_0xcc46('0x4'))['db'];var utils=require(_0xcc46('0x5'));var logger=require(_0xcc46('0x6'))(_0xcc46('0x7'));var config=require(_0xcc46('0x8'));var jayson=require(_0xcc46('0x9'));var client=jayson['client'][_0xcc46('0xa')]({'port':0x232a});config[_0xcc46('0xb')]=_['defaults'](config[_0xcc46('0xb')],{'host':_0xcc46('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc46('0xb')]));require(_0xcc46('0xd'))[_0xcc46('0xe')](socket);function respondWithRpcPromise(_0x4e875a,_0x2c55c3,_0x938cc){return new BPromise(function(_0x1eadbc,_0x4cd6c0){return client['request'](_0x4e875a,_0x938cc)['then'](function(_0x526eda){logger[_0xcc46('0xf')](_0xcc46('0x10'),_0x2c55c3,'request\x20sent');logger[_0xcc46('0x11')](_0xcc46('0x12'),_0x2c55c3,_0xcc46('0x13'),JSON[_0xcc46('0x14')](_0x526eda));if(_0x526eda['error']){if(_0x526eda[_0xcc46('0x15')][_0xcc46('0x16')]===0x1f4){logger[_0xcc46('0x15')]('FaxQueue,\x20%s,\x20%s',_0x2c55c3,_0x526eda[_0xcc46('0x15')][_0xcc46('0x17')]);return _0x4cd6c0(_0x526eda[_0xcc46('0x15')][_0xcc46('0x17')]);}logger['error'](_0xcc46('0x10'),_0x2c55c3,_0x526eda[_0xcc46('0x15')]['message']);return _0x1eadbc(_0x526eda[_0xcc46('0x15')]['message']);}else{logger[_0xcc46('0xf')](_0xcc46('0x10'),_0x2c55c3,_0xcc46('0x13'));_0x1eadbc(_0x526eda['result'][_0xcc46('0x17')]);}})[_0xcc46('0x18')](function(_0x3a3784){logger['error'](_0xcc46('0x10'),_0x2c55c3,_0x3a3784);_0x4cd6c0(_0x3a3784);});});}exports['GetFaxQueue']=function(_0x2de144){var _0x502f1c=this;return new Promise(function(_0x4f6b93,_0x446ded){return db['FaxQueue'][_0xcc46('0x19')]({'raw':_0x2de144[_0xcc46('0x1a')]?_0x2de144['options'][_0xcc46('0x1b')]===undefined?!![]:![]:!![],'where':_0x2de144[_0xcc46('0x1a')]?_0x2de144[_0xcc46('0x1a')][_0xcc46('0x1c')]||null:null,'attributes':_0x2de144[_0xcc46('0x1a')]?_0x2de144['options'][_0xcc46('0x1d')]||null:null,'limit':_0x2de144[_0xcc46('0x1a')]?_0x2de144[_0xcc46('0x1a')]['limit']||null:null,'include':_0x2de144[_0xcc46('0x1a')]?_0x2de144[_0xcc46('0x1a')][_0xcc46('0x1e')]?_[_0xcc46('0x1f')](_0x2de144['options'][_0xcc46('0x1e')],function(_0x4d21e1){return{'model':db[_0x4d21e1[_0xcc46('0x20')]],'as':_0x4d21e1['as'],'attributes':_0x4d21e1[_0xcc46('0x1d')],'include':_0x4d21e1[_0xcc46('0x1e')]?_[_0xcc46('0x1f')](_0x4d21e1[_0xcc46('0x1e')],function(_0x15349f){return{'model':db[_0x15349f[_0xcc46('0x20')]],'as':_0x15349f['as'],'attributes':_0x15349f['attributes'],'include':_0x15349f[_0xcc46('0x1e')]?_['map'](_0x15349f[_0xcc46('0x1e')],function(_0x5ec290){return{'model':db[_0x5ec290[_0xcc46('0x20')]],'as':_0x5ec290['as'],'attributes':_0x5ec290['attributes']};}):[]};}):[]};}):[]:[]})[_0xcc46('0x21')](function(_0x50250a){logger[_0xcc46('0xf')](_0xcc46('0x22'),_0x2de144);logger[_0xcc46('0x11')](_0xcc46('0x22'),_0x2de144,JSON[_0xcc46('0x14')](_0x50250a));_0x4f6b93(_0x50250a);})[_0xcc46('0x18')](function(_0x6d1060){logger[_0xcc46('0x15')]('GetFaxQueue',_0x6d1060['message'],_0x2de144);_0x446ded(_0x502f1c[_0xcc46('0x15')](0x1f4,_0x6d1060['message']));});});};exports[_0xcc46('0x23')]=function(_0x4a3f3c){var _0x5d9e7b=this;return new Promise(function(_0xa9b65d,_0x187c1f){return db['FaxQueue'][_0xcc46('0x24')]({'raw':_0x4a3f3c[_0xcc46('0x1a')]?_0x4a3f3c[_0xcc46('0x1a')][_0xcc46('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a3f3c[_0xcc46('0x1a')]?_0x4a3f3c[_0xcc46('0x1a')][_0xcc46('0x1c')]||null:null,'attributes':_0x4a3f3c[_0xcc46('0x1a')]?_0x4a3f3c[_0xcc46('0x1a')]['attributes']||null:null,'include':_0x4a3f3c[_0xcc46('0x1a')]?_0x4a3f3c[_0xcc46('0x1a')][_0xcc46('0x1e')]?_[_0xcc46('0x1f')](_0x4a3f3c[_0xcc46('0x1a')][_0xcc46('0x1e')],function(_0xdd4e18){return{'model':db[_0xdd4e18[_0xcc46('0x20')]],'as':_0xdd4e18['as'],'attributes':_0xdd4e18[_0xcc46('0x1d')],'include':_0xdd4e18[_0xcc46('0x1e')]?_[_0xcc46('0x1f')](_0xdd4e18[_0xcc46('0x1e')],function(_0x5737a6){return{'model':db[_0x5737a6[_0xcc46('0x20')]],'as':_0x5737a6['as'],'attributes':_0x5737a6[_0xcc46('0x1d')],'include':_0x5737a6[_0xcc46('0x1e')]?_[_0xcc46('0x1f')](_0x5737a6[_0xcc46('0x1e')],function(_0x40ff5d){return{'model':db[_0x40ff5d[_0xcc46('0x20')]],'as':_0x40ff5d['as'],'attributes':_0x40ff5d[_0xcc46('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcc46('0x21')](function(_0x13a6a6){logger[_0xcc46('0xf')](_0xcc46('0x23'),_0x4a3f3c);logger[_0xcc46('0x11')](_0xcc46('0x23'),_0x4a3f3c,JSON[_0xcc46('0x14')](_0x13a6a6));_0xa9b65d(_0x13a6a6);})[_0xcc46('0x18')](function(_0x599719){logger[_0xcc46('0x15')](_0xcc46('0x23'),_0x599719[_0xcc46('0x17')],_0x4a3f3c);_0x187c1f(_0x5d9e7b[_0xcc46('0x15')](0x1f4,_0x599719['message']));});});}; \ No newline at end of file +var _0xaf43=['register','request','then','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','include','map','model','debug','ShowFaxQueue','find','where','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0xaf43,0xbe));var _0x3af4=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xaf43[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x3af4('0x0'));var util=require(_0x3af4('0x1'));var moment=require('moment');var BPromise=require(_0x3af4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3af4('0x3'));var db=require(_0x3af4('0x4'))['db'];var utils=require(_0x3af4('0x5'));var logger=require('../../config/logger')(_0x3af4('0x6'));var config=require(_0x3af4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3af4('0x8')][_0x3af4('0x9')]({'port':0x232a});config['redis']=_[_0x3af4('0xa')](config[_0x3af4('0xb')],{'host':_0x3af4('0xc'),'port':0x18eb});var socket=require(_0x3af4('0xd'))(new Redis(config[_0x3af4('0xb')]));require(_0x3af4('0xe'))[_0x3af4('0xf')](socket);function respondWithRpcPromise(_0x5bbbaf,_0x35e419,_0xe96dd6){return new BPromise(function(_0x490e53,_0x2feba0){return client[_0x3af4('0x10')](_0x5bbbaf,_0xe96dd6)[_0x3af4('0x11')](function(_0x286d1a){logger['info']('FaxQueue,\x20%s,\x20%s',_0x35e419,_0x3af4('0x12'));logger['debug'](_0x3af4('0x13'),_0x35e419,_0x3af4('0x12'),JSON[_0x3af4('0x14')](_0x286d1a));if(_0x286d1a[_0x3af4('0x15')]){if(_0x286d1a[_0x3af4('0x15')][_0x3af4('0x16')]===0x1f4){logger[_0x3af4('0x15')](_0x3af4('0x17'),_0x35e419,_0x286d1a[_0x3af4('0x15')]['message']);return _0x2feba0(_0x286d1a[_0x3af4('0x15')][_0x3af4('0x18')]);}logger[_0x3af4('0x15')](_0x3af4('0x17'),_0x35e419,_0x286d1a[_0x3af4('0x15')][_0x3af4('0x18')]);return _0x490e53(_0x286d1a[_0x3af4('0x15')]['message']);}else{logger['info'](_0x3af4('0x17'),_0x35e419,_0x3af4('0x12'));_0x490e53(_0x286d1a[_0x3af4('0x19')]['message']);}})[_0x3af4('0x1a')](function(_0x5d0407){logger[_0x3af4('0x15')](_0x3af4('0x17'),_0x35e419,_0x5d0407);_0x2feba0(_0x5d0407);});});}exports[_0x3af4('0x1b')]=function(_0x5c3b72){var _0x3d729f=this;return new Promise(function(_0x1487ee,_0x42a26c){return db[_0x3af4('0x1c')][_0x3af4('0x1d')]({'raw':_0x5c3b72[_0x3af4('0x1e')]?_0x5c3b72[_0x3af4('0x1e')][_0x3af4('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c3b72[_0x3af4('0x1e')]?_0x5c3b72[_0x3af4('0x1e')]['where']||null:null,'attributes':_0x5c3b72[_0x3af4('0x1e')]?_0x5c3b72[_0x3af4('0x1e')][_0x3af4('0x20')]||null:null,'limit':_0x5c3b72[_0x3af4('0x1e')]?_0x5c3b72[_0x3af4('0x1e')]['limit']||null:null,'include':_0x5c3b72[_0x3af4('0x1e')]?_0x5c3b72[_0x3af4('0x1e')][_0x3af4('0x21')]?_[_0x3af4('0x22')](_0x5c3b72['options'][_0x3af4('0x21')],function(_0x2524c7){return{'model':db[_0x2524c7[_0x3af4('0x23')]],'as':_0x2524c7['as'],'attributes':_0x2524c7['attributes'],'include':_0x2524c7[_0x3af4('0x21')]?_['map'](_0x2524c7['include'],function(_0x15abdb){return{'model':db[_0x15abdb[_0x3af4('0x23')]],'as':_0x15abdb['as'],'attributes':_0x15abdb['attributes'],'include':_0x15abdb[_0x3af4('0x21')]?_[_0x3af4('0x22')](_0x15abdb[_0x3af4('0x21')],function(_0x570c8e){return{'model':db[_0x570c8e['model']],'as':_0x570c8e['as'],'attributes':_0x570c8e[_0x3af4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3af4('0x11')](function(_0xd73e55){logger['info'](_0x3af4('0x1b'),_0x5c3b72);logger[_0x3af4('0x24')]('GetFaxQueue',_0x5c3b72,JSON['stringify'](_0xd73e55));_0x1487ee(_0xd73e55);})[_0x3af4('0x1a')](function(_0x147c1f){logger['error'](_0x3af4('0x1b'),_0x147c1f[_0x3af4('0x18')],_0x5c3b72);_0x42a26c(_0x3d729f[_0x3af4('0x15')](0x1f4,_0x147c1f[_0x3af4('0x18')]));});});};exports[_0x3af4('0x25')]=function(_0x554e29){var _0x4a02a6=this;return new Promise(function(_0x105ab9,_0x206869){return db[_0x3af4('0x1c')][_0x3af4('0x26')]({'raw':_0x554e29[_0x3af4('0x1e')]?_0x554e29[_0x3af4('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x554e29['options']?_0x554e29[_0x3af4('0x1e')][_0x3af4('0x27')]||null:null,'attributes':_0x554e29[_0x3af4('0x1e')]?_0x554e29[_0x3af4('0x1e')][_0x3af4('0x20')]||null:null,'include':_0x554e29['options']?_0x554e29[_0x3af4('0x1e')][_0x3af4('0x21')]?_['map'](_0x554e29['options'][_0x3af4('0x21')],function(_0x1c06da){return{'model':db[_0x1c06da[_0x3af4('0x23')]],'as':_0x1c06da['as'],'attributes':_0x1c06da['attributes'],'include':_0x1c06da[_0x3af4('0x21')]?_[_0x3af4('0x22')](_0x1c06da[_0x3af4('0x21')],function(_0x8c4b4e){return{'model':db[_0x8c4b4e[_0x3af4('0x23')]],'as':_0x8c4b4e['as'],'attributes':_0x8c4b4e[_0x3af4('0x20')],'include':_0x8c4b4e[_0x3af4('0x21')]?_[_0x3af4('0x22')](_0x8c4b4e[_0x3af4('0x21')],function(_0x41dace){return{'model':db[_0x41dace[_0x3af4('0x23')]],'as':_0x41dace['as'],'attributes':_0x41dace[_0x3af4('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3af4('0x11')](function(_0x5599a6){logger[_0x3af4('0x28')](_0x3af4('0x25'),_0x554e29);logger[_0x3af4('0x24')](_0x3af4('0x25'),_0x554e29,JSON[_0x3af4('0x14')](_0x5599a6));_0x105ab9(_0x5599a6);})[_0x3af4('0x1a')](function(_0x409442){logger[_0x3af4('0x15')](_0x3af4('0x25'),_0x409442['message'],_0x554e29);_0x206869(_0x4a02a6[_0x3af4('0x15')](0x1f4,_0x409442[_0x3af4('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 8a41a72..769eddf 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 _0x7768=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7768,0x1ea));var _0x8776=function(_0x345acb,_0x54072f){_0x345acb=_0x345acb-0x0;var _0x4e716d=_0x7768[_0x345acb];return _0x4e716d;};'use strict';var FaxQueueEvents=require(_0x8776('0x0'));var events=[_0x8776('0x1'),_0x8776('0x2'),_0x8776('0x3')];function createListener(_0x2ee45a,_0x346f5c){return function(_0x3d98b8){_0x346f5c[_0x8776('0x4')](_0x2ee45a,_0x3d98b8);};}function removeListener(_0x5b7042,_0x154dd0){return function(){FaxQueueEvents[_0x8776('0x5')](_0x5b7042,_0x154dd0);};}exports[_0x8776('0x6')]=function(_0x244017){for(var _0x4b6778=0x0,_0x32ffe1=events[_0x8776('0x7')];_0x4b6778<_0x32ffe1;_0x4b6778++){var _0x2ed5a6=events[_0x4b6778];var _0x21250c=createListener(_0x8776('0x8')+_0x2ed5a6,_0x244017);FaxQueueEvents['on'](_0x2ed5a6,_0x21250c);}}; \ No newline at end of file +var _0x4c54=['removeListener','length','save','remove','update','emit'];(function(_0x3945dd,_0x4910d8){var _0xfa906e=function(_0x9d542){while(--_0x9d542){_0x3945dd['push'](_0x3945dd['shift']());}};_0xfa906e(++_0x4910d8);}(_0x4c54,0xaa));var _0x44c5=function(_0x391ab4,_0x5c62aa){_0x391ab4=_0x391ab4-0x0;var _0x2f8f0d=_0x4c54[_0x391ab4];return _0x2f8f0d;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x44c5('0x0'),_0x44c5('0x1'),_0x44c5('0x2')];function createListener(_0x4b37cb,_0xb58689){return function(_0x346b9a){_0xb58689[_0x44c5('0x3')](_0x4b37cb,_0x346b9a);};}function removeListener(_0x5d708b,_0x20368b){return function(){FaxQueueEvents[_0x44c5('0x4')](_0x5d708b,_0x20368b);};}exports['register']=function(_0x3cfa0a){for(var _0x1b8a10=0x0,_0x22e8cc=events[_0x44c5('0x5')];_0x1b8a10<_0x22e8cc;_0x1b8a10++){var _0x52169a=events[_0x1b8a10];var _0x378829=createListener('faxQueue:'+_0x52169a,_0x3cfa0a);FaxQueueEvents['on'](_0x52169a,_0x378829);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c4199b5..ea600fa 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 _0xc359=['isAuthenticated','describe','/:id','show','/:id/members','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x85db9b,_0x254a0c){var _0xb8005=function(_0xd78af1){while(--_0xd78af1){_0x85db9b['push'](_0x85db9b['shift']());}};_0xb8005(++_0x254a0c);}(_0xc359,0x1d9));var _0x9c35=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xc359[_0xcfc44];return _0x307a25;};'use strict';var multer=require('multer');var util=require(_0x9c35('0x0'));var path=require('path');var timeout=require(_0x9c35('0x1'));var express=require(_0x9c35('0x2'));var router=express[_0x9c35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c35('0x5'));var controller=require('./faxQueue.controller');router[_0x9c35('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9c35('0x7')](),controller[_0x9c35('0x8')]);router[_0x9c35('0x6')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xa')]);router['get'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x9c35('0x7')](),controller['getTeams']);router[_0x9c35('0x6')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['getAgents']);router[_0x9c35('0xd')]('/',auth[_0x9c35('0x7')](),controller[_0x9c35('0xe')]);router[_0x9c35('0xd')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x10')]);router[_0x9c35('0xd')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x11')]);router[_0x9c35('0x12')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x15')]);router[_0x9c35('0x14')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x16')]);router[_0x9c35('0x14')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['removeAgents']);module[_0x9c35('0x17')]=router; \ No newline at end of file +var _0xf970=['addTeams','addAgents','put','/:id','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0f97('0x0'));var util=require('util');var path=require(_0x0f97('0x1'));var timeout=require(_0x0f97('0x2'));var express=require(_0x0f97('0x3'));var router=express[_0x0f97('0x4')]();var fs_extra=require(_0x0f97('0x5'));var auth=require(_0x0f97('0x6'));var interaction=require(_0x0f97('0x7'));var config=require('../../config/environment');var controller=require(_0x0f97('0x8'));router[_0x0f97('0x9')]('/',auth[_0x0f97('0xa')](),controller[_0x0f97('0xb')]);router[_0x0f97('0x9')](_0x0f97('0xc'),auth[_0x0f97('0xa')](),controller[_0x0f97('0xd')]);router[_0x0f97('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0f97('0xe')]);router['get'](_0x0f97('0xf'),auth[_0x0f97('0xa')](),controller[_0x0f97('0x10')]);router['get'](_0x0f97('0x11'),auth['isAuthenticated'](),controller[_0x0f97('0x12')]);router[_0x0f97('0x9')](_0x0f97('0x13'),auth[_0x0f97('0xa')](),controller[_0x0f97('0x14')]);router['post']('/',auth[_0x0f97('0xa')](),controller[_0x0f97('0x15')]);router[_0x0f97('0x16')](_0x0f97('0x11'),auth[_0x0f97('0xa')](),controller[_0x0f97('0x17')]);router[_0x0f97('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x0f97('0x18')]);router[_0x0f97('0x19')](_0x0f97('0x1a'),auth[_0x0f97('0xa')](),controller['update']);router['delete'](_0x0f97('0x1a'),auth[_0x0f97('0xa')](),controller[_0x0f97('0x1b')]);router[_0x0f97('0x1c')](_0x0f97('0x11'),auth[_0x0f97('0xa')](),controller['removeTeams']);router['delete'](_0x0f97('0x13'),auth[_0x0f97('0xa')](),controller[_0x0f97('0x1d')]);module[_0x0f97('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 331e484..85959a6 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 _0xd7be=['moment','exports','STRING','DATE'];(function(_0x5c6721,_0x11b24e){var _0x41fe17=function(_0x4c1ca6){while(--_0x4c1ca6){_0x5c6721['push'](_0x5c6721['shift']());}};_0x41fe17(++_0x11b24e);}(_0xd7be,0x128));var _0xed7b=function(_0x46ac32,_0x3903ce){_0x46ac32=_0x46ac32-0x0;var _0x4f1ef3=_0xd7be[_0x46ac32];return _0x4f1ef3;};'use strict';var moment=require(_0xed7b('0x0'));var Sequelize=require('sequelize');module[_0xed7b('0x1')]={'uniqueid':{'type':Sequelize[_0xed7b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xed7b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xed7b('0x3')]},'acceptAt':{'type':Sequelize[_0xed7b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xed7b('0x2')]}}; \ No newline at end of file +var _0xa1bb=['sequelize','exports','STRING','DATE','moment'];(function(_0x277b58,_0x15d243){var _0x26cf09=function(_0x4abfd9){while(--_0x4abfd9){_0x277b58['push'](_0x277b58['shift']());}};_0x26cf09(++_0x15d243);}(_0xa1bb,0x180));var _0xba1b=function(_0x521392,_0x1e2855){_0x521392=_0x521392-0x0;var _0x20c3da=_0xa1bb[_0x521392];return _0x20c3da;};'use strict';var moment=require(_0xba1b('0x0'));var Sequelize=require(_0xba1b('0x1'));module[_0xba1b('0x2')]={'uniqueid':{'type':Sequelize[_0xba1b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xba1b('0x4')]},'leaveAt':{'type':Sequelize[_0xba1b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xba1b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c317199..abb444c 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 _0x5d31=['then','end','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','update','destroy'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x5d31,0xb7));var _0x15d3=function(_0x42572b,_0x259433){_0x42572b=_0x42572b-0x0;var _0x4d50b3=_0x5d31[_0x42572b];return _0x4d50b3;};'use strict';var emlformat=require(_0x15d3('0x0'));var rimraf=require(_0x15d3('0x1'));var zipdir=require(_0x15d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d3('0x3'));var moment=require(_0x15d3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x15d3('0x5'));var util=require('util');var path=require('path');var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require(_0x15d3('0x8'));var fs=require('fs');var fs_extra=require(_0x15d3('0x9'));var _=require(_0x15d3('0xa'));var squel=require(_0x15d3('0xb'));var crypto=require('crypto');var jsforce=require(_0x15d3('0xc'));var deskjs=require(_0x15d3('0xd'));var toCsv=require(_0x15d3('0x7'));var querystring=require('querystring');var Papa=require(_0x15d3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15d3('0xf'));var as=require(_0x15d3('0x10'));var hardwareService=require(_0x15d3('0x11'));var logger=require(_0x15d3('0x12'))(_0x15d3('0x13'));var utils=require(_0x15d3('0x14'));var config=require(_0x15d3('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x15d3('0x16'))['db'];function respondWithStatusCode(_0xd6309a,_0x2b4409){_0x2b4409=_0x2b4409||0xcc;return function(_0x3721fc){if(_0x3721fc){return _0xd6309a[_0x15d3('0x17')](_0x2b4409);}return _0xd6309a[_0x15d3('0x18')](_0x2b4409)['end']();};}function respondWithResult(_0x25da22,_0x3ce80d){_0x3ce80d=_0x3ce80d||0xc8;return function(_0x466f82){if(_0x466f82){return _0x25da22['status'](_0x3ce80d)['json'](_0x466f82);}};}function respondWithFilteredResult(_0x1503cc,_0x5aa531){return function(_0x514875){if(_0x514875){var _0xcbfd71=typeof _0x5aa531[_0x15d3('0x19')]===_0x15d3('0x1a')&&typeof _0x5aa531['limit']===_0x15d3('0x1a');var _0x121692=_0x514875[_0x15d3('0x1b')];var _0x42940f=_0xcbfd71?0x0:_0x5aa531[_0x15d3('0x19')];var _0x1778fd=_0xcbfd71?_0x514875[_0x15d3('0x1b')]:_0x5aa531['offset']+_0x5aa531[_0x15d3('0x1c')];var _0x3225a4;if(_0x1778fd>=_0x121692){_0x1778fd=_0x121692;_0x3225a4=0xc8;}else{_0x3225a4=0xce;}_0x1503cc[_0x15d3('0x18')](_0x3225a4);return _0x1503cc['set']('Content-Range',_0x42940f+'-'+_0x1778fd+'/'+_0x121692)[_0x15d3('0x1d')](_0x514875);}return null;};}function patchUpdates(_0x25cfdb){return function(_0x1d251e){try{jsonpatch[_0x15d3('0x1e')](_0x1d251e,_0x25cfdb,!![]);}catch(_0x148c40){return BPromise['reject'](_0x148c40);}return _0x1d251e['save']();};}function saveUpdates(_0x184236,_0x7c9603){return function(_0x28af7b){if(_0x28af7b){return _0x28af7b[_0x15d3('0x1f')](_0x184236)['then'](function(_0x1b7174){return _0x1b7174;});}return null;};}function removeEntity(_0x9eb2b5,_0x10ae1b){return function(_0x5178e1){if(_0x5178e1){return _0x5178e1[_0x15d3('0x20')]()[_0x15d3('0x21')](function(){_0x9eb2b5[_0x15d3('0x18')](0xcc)[_0x15d3('0x22')]();});}};}function handleEntityNotFound(_0x426932,_0x6baf8c){return function(_0x2a3e77){if(!_0x2a3e77){_0x426932[_0x15d3('0x17')](0x194);}return _0x2a3e77;};}function handleError(_0x590480,_0x5d939c){_0x5d939c=_0x5d939c||0x1f4;return function(_0x4ee291){logger[_0x15d3('0x23')](_0x4ee291['stack']);if(_0x4ee291['name']){delete _0x4ee291[_0x15d3('0x24')];}_0x590480['status'](_0x5d939c)[_0x15d3('0x25')](_0x4ee291);};}exports[_0x15d3('0x26')]=function(_0x1e895e,_0x4a4505){var _0x181f56={},_0x2f39bb={},_0x590646={'count':0x0,'rows':[]};var _0x3ee31e=_[_0x15d3('0x27')](db['FaxQueueReport'][_0x15d3('0x28')],function(_0x1dfc0c){return{'name':_0x1dfc0c[_0x15d3('0x29')],'type':_0x1dfc0c['type'][_0x15d3('0x2a')]};});_0x2f39bb[_0x15d3('0x2b')]=_[_0x15d3('0x27')](_0x3ee31e,'name');_0x2f39bb[_0x15d3('0x2c')]=_[_0x15d3('0x2d')](_0x1e895e[_0x15d3('0x2c')]);_0x2f39bb[_0x15d3('0x2e')]=_[_0x15d3('0x2f')](_0x2f39bb[_0x15d3('0x2b')],_0x2f39bb['query']);_0x181f56[_0x15d3('0x30')]=_[_0x15d3('0x2f')](_0x2f39bb['model'],qs[_0x15d3('0x31')](_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x31')]));_0x181f56[_0x15d3('0x30')]=_0x181f56[_0x15d3('0x30')]['length']?_0x181f56[_0x15d3('0x30')]:_0x2f39bb[_0x15d3('0x2b')];if(!_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x32')](_0x15d3('0x33'))){_0x181f56['limit']=qs[_0x15d3('0x1c')](_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x1c')]);_0x181f56[_0x15d3('0x19')]=qs[_0x15d3('0x19')](_0x1e895e[_0x15d3('0x2c')]['offset']);}_0x181f56[_0x15d3('0x34')]=qs['sort'](_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x35')]);_0x181f56[_0x15d3('0x36')]=qs[_0x15d3('0x2e')](_[_0x15d3('0x37')](_0x1e895e[_0x15d3('0x2c')],_0x2f39bb[_0x15d3('0x2e')]),_0x3ee31e);if(_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x38')]){_0x181f56[_0x15d3('0x36')]=_['merge'](_0x181f56['where'],{'$or':_[_0x15d3('0x27')](_0x3ee31e,function(_0x305a80){if(_0x305a80['type']!==_0x15d3('0x39')){var _0x469466={};_0x469466[_0x305a80[_0x15d3('0x24')]]={'$like':'%'+_0x1e895e[_0x15d3('0x2c')]['filter']+'%'};return _0x469466;}})});}_0x181f56=_[_0x15d3('0x3a')]({},_0x181f56,_0x1e895e[_0x15d3('0x3b')]);var _0x4c102a={'where':_0x181f56[_0x15d3('0x36')]};return db[_0x15d3('0x3c')][_0x15d3('0x1b')](_0x4c102a)[_0x15d3('0x21')](function(_0x134d96){_0x590646['count']=_0x134d96;if(_0x1e895e[_0x15d3('0x2c')][_0x15d3('0x3d')]){_0x181f56[_0x15d3('0x3e')]=[{'all':!![]}];}return db[_0x15d3('0x3c')][_0x15d3('0x3f')](_0x181f56);})['then'](function(_0x361fb5){_0x590646[_0x15d3('0x40')]=_0x361fb5;return _0x590646;})[_0x15d3('0x21')](respondWithFilteredResult(_0x4a4505,_0x181f56))[_0x15d3('0x41')](handleError(_0x4a4505,null));};exports[_0x15d3('0x42')]=function(_0x57791d,_0x46ed30){var _0x1437dc={'raw':!![],'where':{'id':_0x57791d[_0x15d3('0x43')]['id']}},_0x409ebb={};_0x409ebb[_0x15d3('0x2b')]=_[_0x15d3('0x2d')](db[_0x15d3('0x3c')]['rawAttributes']);_0x409ebb[_0x15d3('0x2c')]=_[_0x15d3('0x2d')](_0x57791d[_0x15d3('0x2c')]);_0x409ebb[_0x15d3('0x2e')]=_[_0x15d3('0x2f')](_0x409ebb[_0x15d3('0x2b')],_0x409ebb['query']);_0x1437dc[_0x15d3('0x30')]=_['intersection'](_0x409ebb[_0x15d3('0x2b')],qs['fields'](_0x57791d['query'][_0x15d3('0x31')]));_0x1437dc[_0x15d3('0x30')]=_0x1437dc[_0x15d3('0x30')]['length']?_0x1437dc[_0x15d3('0x30')]:_0x409ebb[_0x15d3('0x2b')];if(_0x57791d[_0x15d3('0x2c')][_0x15d3('0x3d')]){_0x1437dc[_0x15d3('0x3e')]=[{'all':!![]}];}_0x1437dc=_['merge']({},_0x1437dc,_0x57791d[_0x15d3('0x3b')]);return db[_0x15d3('0x3c')][_0x15d3('0x44')](_0x1437dc)[_0x15d3('0x21')](handleEntityNotFound(_0x46ed30,null))[_0x15d3('0x21')](respondWithResult(_0x46ed30,null))['catch'](handleError(_0x46ed30,null));};exports[_0x15d3('0x45')]=function(_0x237fa4,_0x2b66f0){return db[_0x15d3('0x3c')][_0x15d3('0x45')](_0x237fa4['body'],{})[_0x15d3('0x21')](respondWithResult(_0x2b66f0,0xc9))[_0x15d3('0x41')](handleError(_0x2b66f0,null));};exports[_0x15d3('0x1f')]=function(_0x239c03,_0x1105fa){if(_0x239c03[_0x15d3('0x46')]['id']){delete _0x239c03[_0x15d3('0x46')]['id'];}return db[_0x15d3('0x3c')][_0x15d3('0x44')]({'where':{'id':_0x239c03[_0x15d3('0x43')]['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0x1105fa,null))[_0x15d3('0x21')](saveUpdates(_0x239c03[_0x15d3('0x46')],null))[_0x15d3('0x21')](respondWithResult(_0x1105fa,null))[_0x15d3('0x41')](handleError(_0x1105fa,null));};exports[_0x15d3('0x20')]=function(_0x28aa12,_0x126c56){return db[_0x15d3('0x3c')][_0x15d3('0x44')]({'where':{'id':_0x28aa12['params']['id']}})['then'](handleEntityNotFound(_0x126c56,null))[_0x15d3('0x21')](removeEntity(_0x126c56,null))[_0x15d3('0x41')](handleError(_0x126c56,null));};exports['describe']=function(_0x3b3bc7,_0x3042a){return db['FaxQueueReport'][_0x15d3('0x47')]()['then'](respondWithResult(_0x3042a,null))[_0x15d3('0x41')](handleError(_0x3042a,null));}; \ No newline at end of file +var _0x3f59=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','find','create','body','catch','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x302d1a,_0x387081){var _0xd82ca=function(_0x24912b){while(--_0x24912b){_0x302d1a['push'](_0x302d1a['shift']());}};_0xd82ca(++_0x387081);}(_0x3f59,0x1b0));var _0x93f5=function(_0x4968f4,_0xe84e6b){_0x4968f4=_0x4968f4-0x0;var _0x5798e3=_0x3f59[_0x4968f4];return _0x5798e3;};'use strict';var emlformat=require(_0x93f5('0x0'));var rimraf=require(_0x93f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93f5('0x2'));var rp=require(_0x93f5('0x3'));var moment=require(_0x93f5('0x4'));var BPromise=require(_0x93f5('0x5'));var Mustache=require(_0x93f5('0x6'));var util=require(_0x93f5('0x7'));var path=require(_0x93f5('0x8'));var sox=require(_0x93f5('0x9'));var csv=require(_0x93f5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x93f5('0xb'));var squel=require(_0x93f5('0xc'));var crypto=require(_0x93f5('0xd'));var jsforce=require(_0x93f5('0xe'));var deskjs=require(_0x93f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93f5('0x10'));var qs=require(_0x93f5('0x11'));var as=require(_0x93f5('0x12'));var hardwareService=require(_0x93f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x93f5('0x14'));var config=require(_0x93f5('0x15'));var licenseUtil=require(_0x93f5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x789645,_0x4ea7b4){_0x4ea7b4=_0x4ea7b4||0xcc;return function(_0x3e7e84){if(_0x3e7e84){return _0x789645[_0x93f5('0x17')](_0x4ea7b4);}return _0x789645[_0x93f5('0x18')](_0x4ea7b4)[_0x93f5('0x19')]();};}function respondWithResult(_0x3d85da,_0x45a275){_0x45a275=_0x45a275||0xc8;return function(_0x5d6001){if(_0x5d6001){return _0x3d85da[_0x93f5('0x18')](_0x45a275)[_0x93f5('0x1a')](_0x5d6001);}};}function respondWithFilteredResult(_0xe145df,_0x2ab5ce){return function(_0x316fb2){if(_0x316fb2){var _0x22bcd7=typeof _0x2ab5ce[_0x93f5('0x1b')]===_0x93f5('0x1c')&&typeof _0x2ab5ce[_0x93f5('0x1d')]===_0x93f5('0x1c');var _0x46a05d=_0x316fb2[_0x93f5('0x1e')];var _0x4df4ec=_0x22bcd7?0x0:_0x2ab5ce[_0x93f5('0x1b')];var _0x3180f2=_0x22bcd7?_0x316fb2[_0x93f5('0x1e')]:_0x2ab5ce[_0x93f5('0x1b')]+_0x2ab5ce[_0x93f5('0x1d')];var _0x569c0c;if(_0x3180f2>=_0x46a05d){_0x3180f2=_0x46a05d;_0x569c0c=0xc8;}else{_0x569c0c=0xce;}_0xe145df[_0x93f5('0x18')](_0x569c0c);return _0xe145df[_0x93f5('0x1f')](_0x93f5('0x20'),_0x4df4ec+'-'+_0x3180f2+'/'+_0x46a05d)[_0x93f5('0x1a')](_0x316fb2);}return null;};}function patchUpdates(_0x3fc4ab){return function(_0xb44720){try{jsonpatch[_0x93f5('0x21')](_0xb44720,_0x3fc4ab,!![]);}catch(_0x257aa8){return BPromise[_0x93f5('0x22')](_0x257aa8);}return _0xb44720[_0x93f5('0x23')]();};}function saveUpdates(_0x2ef296,_0xb59065){return function(_0x330869){if(_0x330869){return _0x330869['update'](_0x2ef296)[_0x93f5('0x24')](function(_0x27bde4){return _0x27bde4;});}return null;};}function removeEntity(_0x34f8ce,_0x3ffe51){return function(_0x365afd){if(_0x365afd){return _0x365afd[_0x93f5('0x25')]()['then'](function(){_0x34f8ce[_0x93f5('0x18')](0xcc)[_0x93f5('0x19')]();});}};}function handleEntityNotFound(_0x54955f,_0x107d91){return function(_0x43fad9){if(!_0x43fad9){_0x54955f['sendStatus'](0x194);}return _0x43fad9;};}function handleError(_0x5bb7d3,_0x403b45){_0x403b45=_0x403b45||0x1f4;return function(_0x11e86c){logger[_0x93f5('0x26')](_0x11e86c[_0x93f5('0x27')]);if(_0x11e86c['name']){delete _0x11e86c[_0x93f5('0x28')];}_0x5bb7d3['status'](_0x403b45)[_0x93f5('0x29')](_0x11e86c);};}exports[_0x93f5('0x2a')]=function(_0x56d867,_0x36d579){var _0x95e47e={},_0x136dc4={},_0x5e5cb5={'count':0x0,'rows':[]};var _0x3090a9=_['map'](db[_0x93f5('0x2b')]['rawAttributes'],function(_0x448b5a){return{'name':_0x448b5a[_0x93f5('0x2c')],'type':_0x448b5a['type'][_0x93f5('0x2d')]};});_0x136dc4[_0x93f5('0x2e')]=_[_0x93f5('0x2f')](_0x3090a9,_0x93f5('0x28'));_0x136dc4['query']=_[_0x93f5('0x30')](_0x56d867['query']);_0x136dc4[_0x93f5('0x31')]=_['intersection'](_0x136dc4[_0x93f5('0x2e')],_0x136dc4[_0x93f5('0x32')]);_0x95e47e[_0x93f5('0x33')]=_[_0x93f5('0x34')](_0x136dc4['model'],qs[_0x93f5('0x35')](_0x56d867[_0x93f5('0x32')][_0x93f5('0x35')]));_0x95e47e[_0x93f5('0x33')]=_0x95e47e['attributes'][_0x93f5('0x36')]?_0x95e47e['attributes']:_0x136dc4[_0x93f5('0x2e')];if(!_0x56d867[_0x93f5('0x32')][_0x93f5('0x37')](_0x93f5('0x38'))){_0x95e47e['limit']=qs[_0x93f5('0x1d')](_0x56d867['query'][_0x93f5('0x1d')]);_0x95e47e['offset']=qs['offset'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x1b')]);}_0x95e47e[_0x93f5('0x39')]=qs['sort'](_0x56d867[_0x93f5('0x32')][_0x93f5('0x3a')]);_0x95e47e['where']=qs[_0x93f5('0x31')](_['pick'](_0x56d867[_0x93f5('0x32')],_0x136dc4['filters']),_0x3090a9);if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x3b')]){_0x95e47e[_0x93f5('0x3c')]=_[_0x93f5('0x3d')](_0x95e47e[_0x93f5('0x3c')],{'$or':_['map'](_0x3090a9,function(_0x246f8e){if(_0x246f8e[_0x93f5('0x3e')]!==_0x93f5('0x3f')){var _0x2c7e9b={};_0x2c7e9b[_0x246f8e[_0x93f5('0x28')]]={'$like':'%'+_0x56d867[_0x93f5('0x32')]['filter']+'%'};return _0x2c7e9b;}})});}_0x95e47e=_[_0x93f5('0x3d')]({},_0x95e47e,_0x56d867[_0x93f5('0x40')]);var _0x421a4f={'where':_0x95e47e[_0x93f5('0x3c')]};return db[_0x93f5('0x2b')][_0x93f5('0x1e')](_0x421a4f)['then'](function(_0x2e86bd){_0x5e5cb5['count']=_0x2e86bd;if(_0x56d867[_0x93f5('0x32')][_0x93f5('0x41')]){_0x95e47e['include']=[{'all':!![]}];}return db[_0x93f5('0x2b')][_0x93f5('0x42')](_0x95e47e);})[_0x93f5('0x24')](function(_0x136e51){_0x5e5cb5['rows']=_0x136e51;return _0x5e5cb5;})[_0x93f5('0x24')](respondWithFilteredResult(_0x36d579,_0x95e47e))['catch'](handleError(_0x36d579,null));};exports[_0x93f5('0x43')]=function(_0x465fd4,_0x283261){var _0x24d2dc={'raw':!![],'where':{'id':_0x465fd4[_0x93f5('0x44')]['id']}},_0xd4d915={};_0xd4d915[_0x93f5('0x2e')]=_['keys'](db[_0x93f5('0x2b')][_0x93f5('0x45')]);_0xd4d915[_0x93f5('0x32')]=_[_0x93f5('0x30')](_0x465fd4[_0x93f5('0x32')]);_0xd4d915[_0x93f5('0x31')]=_[_0x93f5('0x34')](_0xd4d915[_0x93f5('0x2e')],_0xd4d915['query']);_0x24d2dc['attributes']=_[_0x93f5('0x34')](_0xd4d915['model'],qs[_0x93f5('0x35')](_0x465fd4['query'][_0x93f5('0x35')]));_0x24d2dc[_0x93f5('0x33')]=_0x24d2dc['attributes']['length']?_0x24d2dc[_0x93f5('0x33')]:_0xd4d915['model'];if(_0x465fd4[_0x93f5('0x32')][_0x93f5('0x41')]){_0x24d2dc['include']=[{'all':!![]}];}_0x24d2dc=_[_0x93f5('0x3d')]({},_0x24d2dc,_0x465fd4[_0x93f5('0x40')]);return db[_0x93f5('0x2b')][_0x93f5('0x46')](_0x24d2dc)['then'](handleEntityNotFound(_0x283261,null))[_0x93f5('0x24')](respondWithResult(_0x283261,null))['catch'](handleError(_0x283261,null));};exports[_0x93f5('0x47')]=function(_0x1af1c1,_0x548ee2){return db['FaxQueueReport'][_0x93f5('0x47')](_0x1af1c1[_0x93f5('0x48')],{})['then'](respondWithResult(_0x548ee2,0xc9))[_0x93f5('0x49')](handleError(_0x548ee2,null));};exports[_0x93f5('0x4a')]=function(_0xad4687,_0x576500){if(_0xad4687['body']['id']){delete _0xad4687[_0x93f5('0x48')]['id'];}return db[_0x93f5('0x2b')]['find']({'where':{'id':_0xad4687[_0x93f5('0x44')]['id']}})['then'](handleEntityNotFound(_0x576500,null))[_0x93f5('0x24')](saveUpdates(_0xad4687[_0x93f5('0x48')],null))[_0x93f5('0x24')](respondWithResult(_0x576500,null))[_0x93f5('0x49')](handleError(_0x576500,null));};exports[_0x93f5('0x25')]=function(_0x2e5524,_0x970bcf){return db[_0x93f5('0x2b')][_0x93f5('0x46')]({'where':{'id':_0x2e5524[_0x93f5('0x44')]['id']}})[_0x93f5('0x24')](handleEntityNotFound(_0x970bcf,null))[_0x93f5('0x24')](removeEntity(_0x970bcf,null))[_0x93f5('0x49')](handleError(_0x970bcf,null));};exports[_0x93f5('0x4b')]=function(_0x24b55b,_0xd2d30a){return db[_0x93f5('0x2b')][_0x93f5('0x4b')]()[_0x93f5('0x24')](respondWithResult(_0xd2d30a,null))['catch'](handleError(_0xd2d30a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 59cbebe..56c5de5 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x487cde,_0x230a8a){var _0x2231eb=function(_0x11ef84){while(--_0x11ef84){_0x487cde['push'](_0x487cde['shift']());}};_0x2231eb(++_0x230a8a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2a478e,_0x404251){_0x2a478e=_0x2a478e-0x0;var _0x51322c=_0x7fbe[_0x2a478e];return _0x51322c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','util'];(function(_0x19603a,_0x5a411f){var _0x14a3f5=function(_0x58e391){while(--_0x58e391){_0x19603a['push'](_0x19603a['shift']());}};_0x14a3f5(++_0x5a411f);}(_0x1261,0x144));var _0x1126=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x1261[_0x725b8e];return _0x43ac45;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('FaxQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('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 1794977..f6b1fc4 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 _0x91e1=['jayson/promise','client','http','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','UpdateFaxQueueReport','body','where','limit','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x91e1,0x182));var _0x191e=function(_0x15d9e7,_0x140d20){_0x15d9e7=_0x15d9e7-0x0;var _0x29e1b4=_0x91e1[_0x15d9e7];return _0x29e1b4;};'use strict';var _=require(_0x191e('0x0'));var util=require(_0x191e('0x1'));var moment=require(_0x191e('0x2'));var BPromise=require(_0x191e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x191e('0x4'));var db=require(_0x191e('0x5'))['db'];var utils=require(_0x191e('0x6'));var logger=require(_0x191e('0x7'))(_0x191e('0x8'));var config=require(_0x191e('0x9'));var jayson=require(_0x191e('0xa'));var client=jayson[_0x191e('0xb')][_0x191e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbcba0c,_0x383dc1,_0x5f2c46){return new BPromise(function(_0xb976b0,_0x166b5d){return client['request'](_0xbcba0c,_0x5f2c46)[_0x191e('0xd')](function(_0x3dd43c){logger['info'](_0x191e('0xe'),_0x383dc1,_0x191e('0xf'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x383dc1,'request\x20sent',JSON[_0x191e('0x10')](_0x3dd43c));if(_0x3dd43c[_0x191e('0x11')]){if(_0x3dd43c[_0x191e('0x11')][_0x191e('0x12')]===0x1f4){logger[_0x191e('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x383dc1,_0x3dd43c['error'][_0x191e('0x13')]);return _0x166b5d(_0x3dd43c[_0x191e('0x11')][_0x191e('0x13')]);}logger['error'](_0x191e('0xe'),_0x383dc1,_0x3dd43c['error']['message']);return _0xb976b0(_0x3dd43c[_0x191e('0x11')][_0x191e('0x13')]);}else{logger[_0x191e('0x14')](_0x191e('0xe'),_0x383dc1,_0x191e('0xf'));_0xb976b0(_0x3dd43c[_0x191e('0x15')][_0x191e('0x13')]);}})[_0x191e('0x16')](function(_0x2defe6){logger[_0x191e('0x11')](_0x191e('0xe'),_0x383dc1,_0x2defe6);_0x166b5d(_0x2defe6);});});}exports[_0x191e('0x17')]=function(_0x36c5e7){var _0xcabdcd=this;return new Promise(function(_0x49ccef,_0x5b4b63){return db[_0x191e('0x18')][_0x191e('0x19')](_0x36c5e7['body'],{'raw':_0x36c5e7[_0x191e('0x1a')]?_0x36c5e7[_0x191e('0x1a')][_0x191e('0x1b')]===undefined?!![]:![]:!![]})[_0x191e('0xd')](function(_0x5c66e1){logger[_0x191e('0x14')](_0x191e('0x17'),_0x36c5e7);logger['debug'](_0x191e('0x17'),_0x36c5e7,JSON[_0x191e('0x10')](_0x5c66e1));_0x49ccef(_0x5c66e1);})[_0x191e('0x16')](function(_0x1fdac4){logger['error'](_0x191e('0x17'),_0x1fdac4[_0x191e('0x13')],_0x36c5e7);_0x5b4b63(_0xcabdcd[_0x191e('0x11')](0x1f4,_0x1fdac4[_0x191e('0x13')]));});});};exports[_0x191e('0x1c')]=function(_0x12810c){var _0x1c5dac=this;return new Promise(function(_0x79dc92,_0x13e539){return db[_0x191e('0x18')]['update'](_0x12810c[_0x191e('0x1d')],{'raw':_0x12810c[_0x191e('0x1a')]?_0x12810c['options'][_0x191e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12810c['options']?_0x12810c[_0x191e('0x1a')][_0x191e('0x1e')]||null:null,'attributes':_0x12810c[_0x191e('0x1a')]?_0x12810c[_0x191e('0x1a')]['attributes']||null:null,'limit':_0x12810c[_0x191e('0x1a')]?_0x12810c[_0x191e('0x1a')][_0x191e('0x1f')]||null:null})[_0x191e('0xd')](function(_0x1f2775){logger[_0x191e('0x14')](_0x191e('0x1c'),_0x12810c);logger[_0x191e('0x20')](_0x191e('0x1c'),_0x12810c,JSON[_0x191e('0x10')](_0x1f2775));_0x79dc92(_0x1f2775);})['catch'](function(_0x2b1e70){logger[_0x191e('0x11')](_0x191e('0x1c'),_0x2b1e70['message'],_0x12810c);_0x13e539(_0x1c5dac[_0x191e('0x11')](0x1f4,_0x2b1e70[_0x191e('0x13')]));});});}; \ No newline at end of file +var _0x35ba=['../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x14afeb,_0x1d2903){var _0x7c708a=function(_0x363c25){while(--_0x363c25){_0x14afeb['push'](_0x14afeb['shift']());}};_0x7c708a(++_0x1d2903);}(_0x35ba,0x161));var _0xa35b=function(_0x120207,_0x598472){_0x120207=_0x120207-0x0;var _0x1faa90=_0x35ba[_0x120207];return _0x1faa90;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var moment=require(_0xa35b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa35b('0x3'));var fs=require('fs');var Redis=require(_0xa35b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa35b('0x5'));var logger=require(_0xa35b('0x6'))('rpc');var config=require(_0xa35b('0x7'));var jayson=require(_0xa35b('0x8'));var client=jayson[_0xa35b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fad18,_0xfebb69,_0x5379b5){return new BPromise(function(_0x227b1d,_0x5ea24e){return client[_0xa35b('0xa')](_0x1fad18,_0x5379b5)[_0xa35b('0xb')](function(_0x5f3de2){logger[_0xa35b('0xc')](_0xa35b('0xd'),_0xfebb69,_0xa35b('0xe'));logger[_0xa35b('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0xfebb69,_0xa35b('0xe'),JSON[_0xa35b('0x10')](_0x5f3de2));if(_0x5f3de2[_0xa35b('0x11')]){if(_0x5f3de2[_0xa35b('0x11')]['code']===0x1f4){logger[_0xa35b('0x11')](_0xa35b('0xd'),_0xfebb69,_0x5f3de2['error'][_0xa35b('0x12')]);return _0x5ea24e(_0x5f3de2[_0xa35b('0x11')][_0xa35b('0x12')]);}logger[_0xa35b('0x11')](_0xa35b('0xd'),_0xfebb69,_0x5f3de2[_0xa35b('0x11')][_0xa35b('0x12')]);return _0x227b1d(_0x5f3de2[_0xa35b('0x11')][_0xa35b('0x12')]);}else{logger[_0xa35b('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0xfebb69,'request\x20sent');_0x227b1d(_0x5f3de2['result']['message']);}})[_0xa35b('0x13')](function(_0x46fc24){logger['error'](_0xa35b('0xd'),_0xfebb69,_0x46fc24);_0x5ea24e(_0x46fc24);});});}exports[_0xa35b('0x14')]=function(_0x478623){var _0x73f039=this;return new Promise(function(_0x1db764,_0x5b2d13){return db[_0xa35b('0x15')]['create'](_0x478623['body'],{'raw':_0x478623['options']?_0x478623[_0xa35b('0x16')][_0xa35b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x2e5728){logger[_0xa35b('0xc')](_0xa35b('0x14'),_0x478623);logger[_0xa35b('0xf')]('CreateFaxQueueReport',_0x478623,JSON['stringify'](_0x2e5728));_0x1db764(_0x2e5728);})['catch'](function(_0x45078b){logger[_0xa35b('0x11')](_0xa35b('0x14'),_0x45078b[_0xa35b('0x12')],_0x478623);_0x5b2d13(_0x73f039[_0xa35b('0x11')](0x1f4,_0x45078b[_0xa35b('0x12')]));});});};exports[_0xa35b('0x18')]=function(_0x3c1c2d){var _0x311f48=this;return new Promise(function(_0x4d205e,_0x43f16a){return db[_0xa35b('0x15')][_0xa35b('0x19')](_0x3c1c2d[_0xa35b('0x1a')],{'raw':_0x3c1c2d[_0xa35b('0x16')]?_0x3c1c2d['options'][_0xa35b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1c2d[_0xa35b('0x16')]?_0x3c1c2d['options'][_0xa35b('0x1b')]||null:null,'attributes':_0x3c1c2d['options']?_0x3c1c2d[_0xa35b('0x16')][_0xa35b('0x1c')]||null:null,'limit':_0x3c1c2d[_0xa35b('0x16')]?_0x3c1c2d[_0xa35b('0x16')][_0xa35b('0x1d')]||null:null})[_0xa35b('0xb')](function(_0x3e3bea){logger['info']('UpdateFaxQueueReport',_0x3c1c2d);logger[_0xa35b('0xf')](_0xa35b('0x18'),_0x3c1c2d,JSON['stringify'](_0x3e3bea));_0x4d205e(_0x3e3bea);})['catch'](function(_0x5976cd){logger[_0xa35b('0x11')]('UpdateFaxQueueReport',_0x5976cd[_0xa35b('0x12')],_0x3c1c2d);_0x43f16a(_0x311f48['error'](0x1f4,_0x5976cd[_0xa35b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 44a16e5..405a406 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 _0xd99f=['/describe','post','create','update','delete','/:id','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2fc7bb,_0x399dc1){var _0x45fa5b=function(_0x58c681){while(--_0x58c681){_0x2fc7bb['push'](_0x2fc7bb['shift']());}};_0x45fa5b(++_0x399dc1);}(_0xd99f,0x170));var _0xfd99=function(_0x254009,_0x2ae9c2){_0x254009=_0x254009-0x0;var _0x21d4e0=_0xd99f[_0x254009];return _0x21d4e0;};'use strict';var multer=require(_0xfd99('0x0'));var util=require('util');var path=require(_0xfd99('0x1'));var timeout=require(_0xfd99('0x2'));var express=require(_0xfd99('0x3'));var router=express[_0xfd99('0x4')]();var fs_extra=require(_0xfd99('0x5'));var auth=require(_0xfd99('0x6'));var interaction=require(_0xfd99('0x7'));var config=require(_0xfd99('0x8'));var controller=require('./faxQueueReport.controller');router[_0xfd99('0x9')]('/',auth[_0xfd99('0xa')](),controller[_0xfd99('0xb')]);router['get'](_0xfd99('0xc'),auth[_0xfd99('0xa')](),controller['describe']);router[_0xfd99('0x9')]('/:id',auth[_0xfd99('0xa')](),controller['show']);router[_0xfd99('0xd')]('/',auth[_0xfd99('0xa')](),controller[_0xfd99('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfd99('0xf')]);router[_0xfd99('0x10')](_0xfd99('0x11'),auth[_0xfd99('0xa')](),controller[_0xfd99('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe6af=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get'];(function(_0x5cd868,_0x8fecc0){var _0x1472a5=function(_0x1e0499){while(--_0x1e0499){_0x5cd868['push'](_0x5cd868['shift']());}};_0x1472a5(++_0x8fecc0);}(_0xe6af,0xdc));var _0xfe6a=function(_0x420e65,_0x91d323){_0x420e65=_0x420e65-0x0;var _0x593a93=_0xe6af[_0x420e65];return _0x593a93;};'use strict';var multer=require(_0xfe6a('0x0'));var util=require(_0xfe6a('0x1'));var path=require(_0xfe6a('0x2'));var timeout=require(_0xfe6a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe6a('0x4'));var interaction=require(_0xfe6a('0x5'));var config=require(_0xfe6a('0x6'));var controller=require(_0xfe6a('0x7'));router['get']('/',auth[_0xfe6a('0x8')](),controller[_0xfe6a('0x9')]);router[_0xfe6a('0xa')](_0xfe6a('0xb'),auth[_0xfe6a('0x8')](),controller[_0xfe6a('0xc')]);router[_0xfe6a('0xa')](_0xfe6a('0xd'),auth[_0xfe6a('0x8')](),controller[_0xfe6a('0xe')]);router['post']('/',auth[_0xfe6a('0x8')](),controller[_0xfe6a('0xf')]);router[_0xfe6a('0x10')](_0xfe6a('0xd'),auth[_0xfe6a('0x8')](),controller[_0xfe6a('0x11')]);router[_0xfe6a('0x12')](_0xfe6a('0xd'),auth[_0xfe6a('0x8')](),controller[_0xfe6a('0x13')]);module[_0xfe6a('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0d0c88f..73f88eb 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(_0x2c228d,_0xa4e91b){var _0x1d5201=function(_0x29eee9){while(--_0x29eee9){_0x2c228d['push'](_0x2c228d['shift']());}};_0x1d5201(++_0xa4e91b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xcb91[_0x3861f7];return _0x50879f;};'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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x5ac6ab,_0x31e863){var _0x3a39f=function(_0x5a7b8a){while(--_0x5a7b8a){_0x5ac6ab['push'](_0x5ac6ab['shift']());}};_0x3a39f(++_0x31e863);}(_0x4b84,0x1cc));var _0x44b8=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x4b84[_0x14a0a0];return _0x56b651;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 0372a29..dc7fd35 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 _0x4f05=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FaxTransferReport','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json'];(function(_0x31218c,_0x28ae34){var _0x13e4ab=function(_0x3e0521){while(--_0x3e0521){_0x31218c['push'](_0x31218c['shift']());}};_0x13e4ab(++_0x28ae34);}(_0x4f05,0x112));var _0x54f0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4f05[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x54f0('0x0'));var rimraf=require(_0x54f0('0x1'));var zipdir=require(_0x54f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54f0('0x3'));var moment=require(_0x54f0('0x4'));var BPromise=require(_0x54f0('0x5'));var Mustache=require(_0x54f0('0x6'));var util=require(_0x54f0('0x7'));var path=require(_0x54f0('0x8'));var sox=require(_0x54f0('0x9'));var csv=require('to-csv');var ejs=require(_0x54f0('0xa'));var fs=require('fs');var fs_extra=require(_0x54f0('0xb'));var _=require(_0x54f0('0xc'));var squel=require(_0x54f0('0xd'));var crypto=require(_0x54f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x54f0('0xf'));var toCsv=require(_0x54f0('0x10'));var querystring=require(_0x54f0('0x11'));var Papa=require(_0x54f0('0x12'));var Redis=require(_0x54f0('0x13'));var authService=require(_0x54f0('0x14'));var qs=require(_0x54f0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54f0('0x16'));var logger=require(_0x54f0('0x17'))(_0x54f0('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x54f0('0x19'));var db=require(_0x54f0('0x1a'))['db'];function respondWithStatusCode(_0x21fda4,_0x59e3a3){_0x59e3a3=_0x59e3a3||0xcc;return function(_0x34830c){if(_0x34830c){return _0x21fda4['sendStatus'](_0x59e3a3);}return _0x21fda4[_0x54f0('0x1b')](_0x59e3a3)[_0x54f0('0x1c')]();};}function respondWithResult(_0x20e3c0,_0x5e163d){_0x5e163d=_0x5e163d||0xc8;return function(_0x4b4cd5){if(_0x4b4cd5){return _0x20e3c0[_0x54f0('0x1b')](_0x5e163d)['json'](_0x4b4cd5);}};}function respondWithFilteredResult(_0x1d76cf,_0x3babae){return function(_0x23bcfe){if(_0x23bcfe){var _0x5ca7dc=typeof _0x3babae[_0x54f0('0x1d')]===_0x54f0('0x1e')&&typeof _0x3babae[_0x54f0('0x1f')]==='undefined';var _0x44fe42=_0x23bcfe['count'];var _0x32e607=_0x5ca7dc?0x0:_0x3babae['offset'];var _0x1b51ef=_0x5ca7dc?_0x23bcfe[_0x54f0('0x20')]:_0x3babae['offset']+_0x3babae[_0x54f0('0x1f')];var _0x542094;if(_0x1b51ef>=_0x44fe42){_0x1b51ef=_0x44fe42;_0x542094=0xc8;}else{_0x542094=0xce;}_0x1d76cf[_0x54f0('0x1b')](_0x542094);return _0x1d76cf['set']('Content-Range',_0x32e607+'-'+_0x1b51ef+'/'+_0x44fe42)[_0x54f0('0x21')](_0x23bcfe);}return null;};}function patchUpdates(_0x1e518f){return function(_0x2f4e98){try{jsonpatch['apply'](_0x2f4e98,_0x1e518f,!![]);}catch(_0x485a1b){return BPromise[_0x54f0('0x22')](_0x485a1b);}return _0x2f4e98[_0x54f0('0x23')]();};}function saveUpdates(_0x45dc8d,_0x2ba0da){return function(_0x15ebc8){if(_0x15ebc8){return _0x15ebc8[_0x54f0('0x24')](_0x45dc8d)[_0x54f0('0x25')](function(_0x5eedeb){return _0x5eedeb;});}return null;};}function removeEntity(_0x1dcf8d,_0x321e56){return function(_0x55643a){if(_0x55643a){return _0x55643a[_0x54f0('0x26')]()[_0x54f0('0x25')](function(){_0x1dcf8d[_0x54f0('0x1b')](0xcc)[_0x54f0('0x1c')]();});}};}function handleEntityNotFound(_0xd32c1f,_0xc13510){return function(_0x783d69){if(!_0x783d69){_0xd32c1f[_0x54f0('0x27')](0x194);}return _0x783d69;};}function handleError(_0x2afcc1,_0xbd79e8){_0xbd79e8=_0xbd79e8||0x1f4;return function(_0x22eadc){logger[_0x54f0('0x28')](_0x22eadc[_0x54f0('0x29')]);if(_0x22eadc[_0x54f0('0x2a')]){delete _0x22eadc[_0x54f0('0x2a')];}_0x2afcc1[_0x54f0('0x1b')](_0xbd79e8)[_0x54f0('0x2b')](_0x22eadc);};}exports[_0x54f0('0x2c')]=function(_0x492378,_0x513e2f){var _0x580952={},_0x3ad90d={},_0x49fca9={'count':0x0,'rows':[]};var _0x16410b=_['map'](db[_0x54f0('0x2d')]['rawAttributes'],function(_0xa501ef){return{'name':_0xa501ef[_0x54f0('0x2e')],'type':_0xa501ef['type'][_0x54f0('0x2f')]};});_0x3ad90d[_0x54f0('0x30')]=_[_0x54f0('0x31')](_0x16410b,_0x54f0('0x2a'));_0x3ad90d[_0x54f0('0x32')]=_['keys'](_0x492378['query']);_0x3ad90d[_0x54f0('0x33')]=_[_0x54f0('0x34')](_0x3ad90d[_0x54f0('0x30')],_0x3ad90d[_0x54f0('0x32')]);_0x580952[_0x54f0('0x35')]=_[_0x54f0('0x34')](_0x3ad90d['model'],qs[_0x54f0('0x36')](_0x492378[_0x54f0('0x32')][_0x54f0('0x36')]));_0x580952[_0x54f0('0x35')]=_0x580952[_0x54f0('0x35')][_0x54f0('0x37')]?_0x580952['attributes']:_0x3ad90d[_0x54f0('0x30')];if(!_0x492378['query']['hasOwnProperty'](_0x54f0('0x38'))){_0x580952['limit']=qs[_0x54f0('0x1f')](_0x492378[_0x54f0('0x32')][_0x54f0('0x1f')]);_0x580952[_0x54f0('0x1d')]=qs['offset'](_0x492378[_0x54f0('0x32')][_0x54f0('0x1d')]);}_0x580952[_0x54f0('0x39')]=qs[_0x54f0('0x3a')](_0x492378['query'][_0x54f0('0x3a')]);_0x580952[_0x54f0('0x3b')]=qs[_0x54f0('0x33')](_[_0x54f0('0x3c')](_0x492378[_0x54f0('0x32')],_0x3ad90d[_0x54f0('0x33')]),_0x16410b);if(_0x492378[_0x54f0('0x32')]['filter']){_0x580952['where']=_[_0x54f0('0x3d')](_0x580952['where'],{'$or':_[_0x54f0('0x31')](_0x16410b,function(_0x4d67c9){if(_0x4d67c9[_0x54f0('0x3e')]!=='VIRTUAL'){var _0x1cef46={};_0x1cef46[_0x4d67c9[_0x54f0('0x2a')]]={'$like':'%'+_0x492378[_0x54f0('0x32')][_0x54f0('0x3f')]+'%'};return _0x1cef46;}})});}_0x580952=_['merge']({},_0x580952,_0x492378[_0x54f0('0x40')]);var _0x31db70={'where':_0x580952['where']};return db['FaxTransferReport']['count'](_0x31db70)[_0x54f0('0x25')](function(_0x28114e){_0x49fca9['count']=_0x28114e;if(_0x492378[_0x54f0('0x32')][_0x54f0('0x41')]){_0x580952[_0x54f0('0x42')]=[{'all':!![]}];}return db[_0x54f0('0x2d')]['findAll'](_0x580952);})[_0x54f0('0x25')](function(_0x5e65b1){_0x49fca9[_0x54f0('0x43')]=_0x5e65b1;return _0x49fca9;})[_0x54f0('0x25')](respondWithFilteredResult(_0x513e2f,_0x580952))[_0x54f0('0x44')](handleError(_0x513e2f,null));};exports[_0x54f0('0x45')]=function(_0x19e84d,_0x1c9ca8){var _0x1faeaa={'raw':!![],'where':{'id':_0x19e84d[_0x54f0('0x46')]['id']}},_0x4e69ae={};_0x4e69ae[_0x54f0('0x30')]=_[_0x54f0('0x47')](db['FaxTransferReport'][_0x54f0('0x48')]);_0x4e69ae[_0x54f0('0x32')]=_['keys'](_0x19e84d[_0x54f0('0x32')]);_0x4e69ae[_0x54f0('0x33')]=_[_0x54f0('0x34')](_0x4e69ae[_0x54f0('0x30')],_0x4e69ae['query']);_0x1faeaa['attributes']=_['intersection'](_0x4e69ae[_0x54f0('0x30')],qs['fields'](_0x19e84d['query'][_0x54f0('0x36')]));_0x1faeaa[_0x54f0('0x35')]=_0x1faeaa[_0x54f0('0x35')][_0x54f0('0x37')]?_0x1faeaa[_0x54f0('0x35')]:_0x4e69ae[_0x54f0('0x30')];if(_0x19e84d[_0x54f0('0x32')]['includeAll']){_0x1faeaa[_0x54f0('0x42')]=[{'all':!![]}];}_0x1faeaa=_[_0x54f0('0x3d')]({},_0x1faeaa,_0x19e84d['options']);return db[_0x54f0('0x2d')][_0x54f0('0x49')](_0x1faeaa)[_0x54f0('0x25')](handleEntityNotFound(_0x1c9ca8,null))['then'](respondWithResult(_0x1c9ca8,null))[_0x54f0('0x44')](handleError(_0x1c9ca8,null));};exports[_0x54f0('0x4a')]=function(_0x5a24d2,_0x5ed8c2){return db[_0x54f0('0x2d')]['create'](_0x5a24d2[_0x54f0('0x4b')],{})['then'](respondWithResult(_0x5ed8c2,0xc9))[_0x54f0('0x44')](handleError(_0x5ed8c2,null));};exports[_0x54f0('0x24')]=function(_0x17bf7f,_0x32a28c){if(_0x17bf7f[_0x54f0('0x4b')]['id']){delete _0x17bf7f[_0x54f0('0x4b')]['id'];}return db[_0x54f0('0x2d')][_0x54f0('0x49')]({'where':{'id':_0x17bf7f['params']['id']}})[_0x54f0('0x25')](handleEntityNotFound(_0x32a28c,null))[_0x54f0('0x25')](saveUpdates(_0x17bf7f['body'],null))[_0x54f0('0x25')](respondWithResult(_0x32a28c,null))[_0x54f0('0x44')](handleError(_0x32a28c,null));};exports[_0x54f0('0x26')]=function(_0x29e1bf,_0x573bcb){return db['FaxTransferReport'][_0x54f0('0x49')]({'where':{'id':_0x29e1bf[_0x54f0('0x46')]['id']}})['then'](handleEntityNotFound(_0x573bcb,null))[_0x54f0('0x25')](removeEntity(_0x573bcb,null))[_0x54f0('0x44')](handleError(_0x573bcb,null));};exports[_0x54f0('0x4c')]=function(_0x302f65,_0x2030b1){return db[_0x54f0('0x2d')][_0x54f0('0x4c')]()[_0x54f0('0x25')](respondWithResult(_0x2030b1,null))[_0x54f0('0x44')](handleError(_0x2030b1,null));}; \ No newline at end of file +var _0x70c0=['where','pick','merge','filter','options','includeAll','findAll','rows','keys','include','create','catch','body','destroy','find','params','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','end','error','stack','name','send','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x1ae7bf,_0x4eb1b0){var _0x32c596=function(_0x3da760){while(--_0x3da760){_0x1ae7bf['push'](_0x1ae7bf['shift']());}};_0x32c596(++_0x4eb1b0);}(_0x70c0,0x1c1));var _0x070c=function(_0x319778,_0x37b894){_0x319778=_0x319778-0x0;var _0x4a63f5=_0x70c0[_0x319778];return _0x4a63f5;};'use strict';var emlformat=require(_0x070c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x070c('0x1'));var rp=require(_0x070c('0x2'));var moment=require(_0x070c('0x3'));var BPromise=require(_0x070c('0x4'));var Mustache=require(_0x070c('0x5'));var util=require(_0x070c('0x6'));var path=require(_0x070c('0x7'));var sox=require(_0x070c('0x8'));var csv=require(_0x070c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x070c('0xa'));var _=require(_0x070c('0xb'));var squel=require(_0x070c('0xc'));var crypto=require(_0x070c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x070c('0xe'));var toCsv=require(_0x070c('0x9'));var querystring=require('querystring');var Papa=require(_0x070c('0xf'));var Redis=require(_0x070c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x070c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x070c('0x12'))('api');var utils=require(_0x070c('0x13'));var config=require(_0x070c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x070c('0x15'))['db'];function respondWithStatusCode(_0x51e4,_0x2fce44){_0x2fce44=_0x2fce44||0xcc;return function(_0x45e015){if(_0x45e015){return _0x51e4[_0x070c('0x16')](_0x2fce44);}return _0x51e4[_0x070c('0x17')](_0x2fce44)['end']();};}function respondWithResult(_0x23fd0f,_0x45641b){_0x45641b=_0x45641b||0xc8;return function(_0x2bde86){if(_0x2bde86){return _0x23fd0f['status'](_0x45641b)['json'](_0x2bde86);}};}function respondWithFilteredResult(_0x5a3c2e,_0x445f48){return function(_0x55c7bd){if(_0x55c7bd){var _0x2461b3=typeof _0x445f48['offset']===_0x070c('0x18')&&typeof _0x445f48[_0x070c('0x19')]==='undefined';var _0x13ba86=_0x55c7bd[_0x070c('0x1a')];var _0x255dbd=_0x2461b3?0x0:_0x445f48[_0x070c('0x1b')];var _0x5d7edc=_0x2461b3?_0x55c7bd[_0x070c('0x1a')]:_0x445f48[_0x070c('0x1b')]+_0x445f48[_0x070c('0x19')];var _0x41b1a7;if(_0x5d7edc>=_0x13ba86){_0x5d7edc=_0x13ba86;_0x41b1a7=0xc8;}else{_0x41b1a7=0xce;}_0x5a3c2e[_0x070c('0x17')](_0x41b1a7);return _0x5a3c2e[_0x070c('0x1c')](_0x070c('0x1d'),_0x255dbd+'-'+_0x5d7edc+'/'+_0x13ba86)[_0x070c('0x1e')](_0x55c7bd);}return null;};}function patchUpdates(_0x11aba1){return function(_0x4712cb){try{jsonpatch['apply'](_0x4712cb,_0x11aba1,!![]);}catch(_0x4fcf53){return BPromise[_0x070c('0x1f')](_0x4fcf53);}return _0x4712cb[_0x070c('0x20')]();};}function saveUpdates(_0x52b6bf,_0x131155){return function(_0x3f69aa){if(_0x3f69aa){return _0x3f69aa[_0x070c('0x21')](_0x52b6bf)[_0x070c('0x22')](function(_0x3c4500){return _0x3c4500;});}return null;};}function removeEntity(_0x2aa856,_0x3f7692){return function(_0x214c39){if(_0x214c39){return _0x214c39['destroy']()[_0x070c('0x22')](function(){_0x2aa856[_0x070c('0x17')](0xcc)[_0x070c('0x23')]();});}};}function handleEntityNotFound(_0x197279,_0x49cdd7){return function(_0x2a1e74){if(!_0x2a1e74){_0x197279[_0x070c('0x16')](0x194);}return _0x2a1e74;};}function handleError(_0x4f9245,_0x3a0693){_0x3a0693=_0x3a0693||0x1f4;return function(_0xe84941){logger[_0x070c('0x24')](_0xe84941[_0x070c('0x25')]);if(_0xe84941[_0x070c('0x26')]){delete _0xe84941[_0x070c('0x26')];}_0x4f9245[_0x070c('0x17')](_0x3a0693)[_0x070c('0x27')](_0xe84941);};}exports['index']=function(_0x8b9cf3,_0x55934f){var _0x45fad6={},_0x4a274d={},_0x2e9ad5={'count':0x0,'rows':[]};var _0x36d376=_['map'](db[_0x070c('0x28')][_0x070c('0x29')],function(_0x158e88){return{'name':_0x158e88[_0x070c('0x2a')],'type':_0x158e88[_0x070c('0x2b')][_0x070c('0x2c')]};});_0x4a274d[_0x070c('0x2d')]=_['map'](_0x36d376,_0x070c('0x26'));_0x4a274d[_0x070c('0x2e')]=_['keys'](_0x8b9cf3[_0x070c('0x2e')]);_0x4a274d[_0x070c('0x2f')]=_['intersection'](_0x4a274d[_0x070c('0x2d')],_0x4a274d[_0x070c('0x2e')]);_0x45fad6[_0x070c('0x30')]=_[_0x070c('0x31')](_0x4a274d['model'],qs[_0x070c('0x32')](_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x32')]));_0x45fad6[_0x070c('0x30')]=_0x45fad6[_0x070c('0x30')][_0x070c('0x33')]?_0x45fad6['attributes']:_0x4a274d[_0x070c('0x2d')];if(!_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x34')](_0x070c('0x35'))){_0x45fad6['limit']=qs[_0x070c('0x19')](_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x19')]);_0x45fad6['offset']=qs[_0x070c('0x1b')](_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x1b')]);}_0x45fad6['order']=qs[_0x070c('0x36')](_0x8b9cf3['query']['sort']);_0x45fad6[_0x070c('0x37')]=qs[_0x070c('0x2f')](_[_0x070c('0x38')](_0x8b9cf3[_0x070c('0x2e')],_0x4a274d['filters']),_0x36d376);if(_0x8b9cf3[_0x070c('0x2e')]['filter']){_0x45fad6[_0x070c('0x37')]=_[_0x070c('0x39')](_0x45fad6[_0x070c('0x37')],{'$or':_['map'](_0x36d376,function(_0xd02a3){if(_0xd02a3[_0x070c('0x2b')]!=='VIRTUAL'){var _0x44c540={};_0x44c540[_0xd02a3[_0x070c('0x26')]]={'$like':'%'+_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x3a')]+'%'};return _0x44c540;}})});}_0x45fad6=_['merge']({},_0x45fad6,_0x8b9cf3[_0x070c('0x3b')]);var _0x47e7c5={'where':_0x45fad6[_0x070c('0x37')]};return db['FaxTransferReport'][_0x070c('0x1a')](_0x47e7c5)[_0x070c('0x22')](function(_0x19f4d2){_0x2e9ad5[_0x070c('0x1a')]=_0x19f4d2;if(_0x8b9cf3[_0x070c('0x2e')][_0x070c('0x3c')]){_0x45fad6['include']=[{'all':!![]}];}return db[_0x070c('0x28')][_0x070c('0x3d')](_0x45fad6);})[_0x070c('0x22')](function(_0x447098){_0x2e9ad5[_0x070c('0x3e')]=_0x447098;return _0x2e9ad5;})[_0x070c('0x22')](respondWithFilteredResult(_0x55934f,_0x45fad6))['catch'](handleError(_0x55934f,null));};exports['show']=function(_0x978b0a,_0x14cd80){var _0x567c60={'raw':!![],'where':{'id':_0x978b0a['params']['id']}},_0x4e8216={};_0x4e8216['model']=_[_0x070c('0x3f')](db[_0x070c('0x28')][_0x070c('0x29')]);_0x4e8216[_0x070c('0x2e')]=_[_0x070c('0x3f')](_0x978b0a[_0x070c('0x2e')]);_0x4e8216[_0x070c('0x2f')]=_['intersection'](_0x4e8216[_0x070c('0x2d')],_0x4e8216[_0x070c('0x2e')]);_0x567c60[_0x070c('0x30')]=_['intersection'](_0x4e8216[_0x070c('0x2d')],qs[_0x070c('0x32')](_0x978b0a[_0x070c('0x2e')]['fields']));_0x567c60[_0x070c('0x30')]=_0x567c60[_0x070c('0x30')][_0x070c('0x33')]?_0x567c60[_0x070c('0x30')]:_0x4e8216[_0x070c('0x2d')];if(_0x978b0a[_0x070c('0x2e')][_0x070c('0x3c')]){_0x567c60[_0x070c('0x40')]=[{'all':!![]}];}_0x567c60=_[_0x070c('0x39')]({},_0x567c60,_0x978b0a[_0x070c('0x3b')]);return db[_0x070c('0x28')]['find'](_0x567c60)[_0x070c('0x22')](handleEntityNotFound(_0x14cd80,null))[_0x070c('0x22')](respondWithResult(_0x14cd80,null))['catch'](handleError(_0x14cd80,null));};exports[_0x070c('0x41')]=function(_0x1e40e2,_0x210a8c){return db[_0x070c('0x28')]['create'](_0x1e40e2['body'],{})['then'](respondWithResult(_0x210a8c,0xc9))[_0x070c('0x42')](handleError(_0x210a8c,null));};exports[_0x070c('0x21')]=function(_0x53e3f0,_0x78015f){if(_0x53e3f0[_0x070c('0x43')]['id']){delete _0x53e3f0['body']['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x53e3f0['params']['id']}})[_0x070c('0x22')](handleEntityNotFound(_0x78015f,null))[_0x070c('0x22')](saveUpdates(_0x53e3f0[_0x070c('0x43')],null))[_0x070c('0x22')](respondWithResult(_0x78015f,null))['catch'](handleError(_0x78015f,null));};exports[_0x070c('0x44')]=function(_0xd43100,_0x416b0f){return db[_0x070c('0x28')][_0x070c('0x45')]({'where':{'id':_0xd43100[_0x070c('0x46')]['id']}})[_0x070c('0x22')](handleEntityNotFound(_0x416b0f,null))['then'](removeEntity(_0x416b0f,null))['catch'](handleError(_0x416b0f,null));};exports[_0x070c('0x47')]=function(_0x21dfd5,_0x528fa0){return db[_0x070c('0x28')][_0x070c('0x47')]()['then'](respondWithResult(_0x528fa0,null))['catch'](handleError(_0x528fa0,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index aa6e6b9..09bcbca 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 _0xa849=['bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x106c5d,_0x402ba5){var _0x8f0182=function(_0x2d10a4){while(--_0x2d10a4){_0x106c5d['push'](_0x106c5d['shift']());}};_0x8f0182(++_0x402ba5);}(_0xa849,0x175));var _0x9a84=function(_0x120076,_0x7d88b4){_0x120076=_0x120076-0x0;var _0x1b09d7=_0xa849[_0x120076];return _0x1b09d7;};'use strict';var _=require(_0x9a84('0x0'));var util=require(_0x9a84('0x1'));var logger=require(_0x9a84('0x2'))('api');var moment=require(_0x9a84('0x3'));var BPromise=require(_0x9a84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a84('0x5'));var rimraf=require(_0x9a84('0x6'));var config=require(_0x9a84('0x7'));var attributes=require(_0x9a84('0x8'));module[_0x9a84('0x9')]=function(_0x2ba3b2,_0x15bea3){return _0x2ba3b2[_0x9a84('0xa')]('FaxTransferReport',attributes,{'tableName':_0x9a84('0xb'),'paranoid':![],'indexes':[{'name':_0x9a84('0xc'),'fields':[_0x9a84('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a81=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xf57c10,_0x2d4c9c){var _0x884f8d=function(_0x22cb67){while(--_0x22cb67){_0xf57c10['push'](_0xf57c10['shift']());}};_0x884f8d(++_0x2d4c9c);}(_0x1a81,0x19b));var _0x11a8=function(_0x33d95f,_0x4b2405){_0x33d95f=_0x33d95f-0x0;var _0x551544=_0x1a81[_0x33d95f];return _0x551544;};'use strict';var _=require(_0x11a8('0x0'));var util=require(_0x11a8('0x1'));var logger=require(_0x11a8('0x2'))(_0x11a8('0x3'));var moment=require(_0x11a8('0x4'));var BPromise=require(_0x11a8('0x5'));var rp=require(_0x11a8('0x6'));var fs=require('fs');var path=require(_0x11a8('0x7'));var rimraf=require(_0x11a8('0x8'));var config=require(_0x11a8('0x9'));var attributes=require(_0x11a8('0xa'));module[_0x11a8('0xb')]=function(_0x241217,_0x107c5c){return _0x241217[_0x11a8('0xc')](_0x11a8('0xd'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x11a8('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 198c6e8..1a0f51a 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 _0x73a1=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x9257ac,_0x368f9f){var _0x2f79bb=function(_0x3d6601){while(--_0x3d6601){_0x9257ac['push'](_0x9257ac['shift']());}};_0x2f79bb(++_0x368f9f);}(_0x73a1,0xbb));var _0x173a=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x73a1[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0x173a('0x0'));var util=require('util');var moment=require(_0x173a('0x1'));var BPromise=require(_0x173a('0x2'));var rs=require(_0x173a('0x3'));var fs=require('fs');var Redis=require(_0x173a('0x4'));var db=require(_0x173a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x173a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x173a('0x7')][_0x173a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d0e70,_0x375548,_0x519119){return new BPromise(function(_0x481a3e,_0xfa1b90){return client[_0x173a('0x9')](_0x5d0e70,_0x519119)[_0x173a('0xa')](function(_0x3318e7){logger[_0x173a('0xb')](_0x173a('0xc'),_0x375548,_0x173a('0xd'));logger[_0x173a('0xe')](_0x173a('0xf'),_0x375548,_0x173a('0xd'),JSON[_0x173a('0x10')](_0x3318e7));if(_0x3318e7[_0x173a('0x11')]){if(_0x3318e7['error'][_0x173a('0x12')]===0x1f4){logger[_0x173a('0x11')](_0x173a('0xc'),_0x375548,_0x3318e7[_0x173a('0x11')]['message']);return _0xfa1b90(_0x3318e7['error'][_0x173a('0x13')]);}logger['error'](_0x173a('0xc'),_0x375548,_0x3318e7['error']['message']);return _0x481a3e(_0x3318e7[_0x173a('0x11')][_0x173a('0x13')]);}else{logger[_0x173a('0xb')](_0x173a('0xc'),_0x375548,'request\x20sent');_0x481a3e(_0x3318e7['result'][_0x173a('0x13')]);}})['catch'](function(_0x5285d0){logger[_0x173a('0x11')](_0x173a('0xc'),_0x375548,_0x5285d0);_0xfa1b90(_0x5285d0);});});} \ No newline at end of file +var _0x224a=['info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x224a,0x191));var _0xa224=function(_0xea1478,_0x4f72dd){_0xea1478=_0xea1478-0x0;var _0x526b19=_0x224a[_0xea1478];return _0x526b19;};'use strict';var _=require('lodash');var util=require(_0xa224('0x0'));var moment=require(_0xa224('0x1'));var BPromise=require(_0xa224('0x2'));var rs=require(_0xa224('0x3'));var fs=require('fs');var Redis=require(_0xa224('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa224('0x5'));var logger=require(_0xa224('0x6'))(_0xa224('0x7'));var config=require(_0xa224('0x8'));var jayson=require(_0xa224('0x9'));var client=jayson[_0xa224('0xa')][_0xa224('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x514972,_0x5bfe4e,_0x205323){return new BPromise(function(_0x5a29cc,_0x10dc39){return client[_0xa224('0xc')](_0x514972,_0x205323)['then'](function(_0xcc2b60){logger[_0xa224('0xd')](_0xa224('0xe'),_0x5bfe4e,'request\x20sent');logger[_0xa224('0xf')](_0xa224('0x10'),_0x5bfe4e,'request\x20sent',JSON[_0xa224('0x11')](_0xcc2b60));if(_0xcc2b60[_0xa224('0x12')]){if(_0xcc2b60[_0xa224('0x12')][_0xa224('0x13')]===0x1f4){logger['error'](_0xa224('0xe'),_0x5bfe4e,_0xcc2b60['error'][_0xa224('0x14')]);return _0x10dc39(_0xcc2b60[_0xa224('0x12')][_0xa224('0x14')]);}logger[_0xa224('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5bfe4e,_0xcc2b60[_0xa224('0x12')]['message']);return _0x5a29cc(_0xcc2b60[_0xa224('0x12')][_0xa224('0x14')]);}else{logger[_0xa224('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5bfe4e,_0xa224('0x15'));_0x5a29cc(_0xcc2b60['result']['message']);}})[_0xa224('0x16')](function(_0x1dc08a){logger[_0xa224('0x12')](_0xa224('0xe'),_0x5bfe4e,_0x1dc08a);_0x10dc39(_0x1dc08a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index abee1ab..5e02c33 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 _0x5945=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id','create','put','update','delete','destroy','exports','multer'];(function(_0x51e323,_0x12ede4){var _0x4bef7e=function(_0x32cf10){while(--_0x32cf10){_0x51e323['push'](_0x51e323['shift']());}};_0x4bef7e(++_0x12ede4);}(_0x5945,0xf6));var _0x5594=function(_0x51fd25,_0x2fcbb){_0x51fd25=_0x51fd25-0x0;var _0x4529ae=_0x5945[_0x51fd25];return _0x4529ae;};'use strict';var multer=require(_0x5594('0x0'));var util=require(_0x5594('0x1'));var path=require('path');var timeout=require(_0x5594('0x2'));var express=require(_0x5594('0x3'));var router=express[_0x5594('0x4')]();var fs_extra=require(_0x5594('0x5'));var auth=require(_0x5594('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5594('0x7'));var controller=require(_0x5594('0x8'));router[_0x5594('0x9')]('/',auth[_0x5594('0xa')](),controller['index']);router[_0x5594('0x9')](_0x5594('0xb'),auth[_0x5594('0xa')](),controller['describe']);router[_0x5594('0x9')](_0x5594('0xc'),auth[_0x5594('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5594('0xd')]);router[_0x5594('0xe')](_0x5594('0xc'),auth[_0x5594('0xa')](),controller[_0x5594('0xf')]);router[_0x5594('0x10')](_0x5594('0xc'),auth['isAuthenticated'](),controller[_0x5594('0x11')]);module[_0x5594('0x12')]=router; \ No newline at end of file +var _0x2bac=['connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path'];(function(_0xdc1176,_0x55c094){var _0x4d7c39=function(_0x280d21){while(--_0x280d21){_0xdc1176['push'](_0xdc1176['shift']());}};_0x4d7c39(++_0x55c094);}(_0x2bac,0x18d));var _0xc2ba=function(_0x1406f7,_0x10197d){_0x1406f7=_0x1406f7-0x0;var _0x21bfd4=_0x2bac[_0x1406f7];return _0x21bfd4;};'use strict';var multer=require(_0xc2ba('0x0'));var util=require(_0xc2ba('0x1'));var path=require(_0xc2ba('0x2'));var timeout=require(_0xc2ba('0x3'));var express=require(_0xc2ba('0x4'));var router=express[_0xc2ba('0x5')]();var fs_extra=require(_0xc2ba('0x6'));var auth=require(_0xc2ba('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xc2ba('0x8')](),controller[_0xc2ba('0x9')]);router[_0xc2ba('0xa')](_0xc2ba('0xb'),auth[_0xc2ba('0x8')](),controller[_0xc2ba('0xc')]);router[_0xc2ba('0xa')](_0xc2ba('0xd'),auth['isAuthenticated'](),controller[_0xc2ba('0xe')]);router[_0xc2ba('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc2ba('0xd'),auth[_0xc2ba('0x8')](),controller[_0xc2ba('0x10')]);router[_0xc2ba('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc2ba('0x12')]);module[_0xc2ba('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 32e850a..84c4fc2 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 _0xa975=['getConfigurations','/:id/fields','create','post','addConfiguration','put','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa975,0x1ab));var _0x5a97=function(_0x2f7407,_0x43cc01){_0x2f7407=_0x2f7407-0x0;var _0x67a242=_0xa975[_0x2f7407];return _0x67a242;};'use strict';var multer=require(_0x5a97('0x0'));var util=require('util');var path=require(_0x5a97('0x1'));var timeout=require(_0x5a97('0x2'));var express=require(_0x5a97('0x3'));var router=express[_0x5a97('0x4')]();var fs_extra=require(_0x5a97('0x5'));var auth=require(_0x5a97('0x6'));var interaction=require(_0x5a97('0x7'));var config=require('../../config/environment');var controller=require(_0x5a97('0x8'));router[_0x5a97('0x9')]('/',auth[_0x5a97('0xa')](),controller['index']);router[_0x5a97('0x9')](_0x5a97('0xb'),auth[_0x5a97('0xa')](),controller[_0x5a97('0xc')]);router['get'](_0x5a97('0xd'),auth['isAuthenticated'](),controller[_0x5a97('0xe')]);router['get'](_0x5a97('0xf'),auth[_0x5a97('0xa')](),controller['getFields']);router['post']('/',auth[_0x5a97('0xa')](),controller[_0x5a97('0x10')]);router[_0x5a97('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5a97('0x12')]);router[_0x5a97('0x13')](_0x5a97('0xb'),auth[_0x5a97('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5a97('0xa')](),controller[_0x5a97('0x14')]);module['exports']=router; \ No newline at end of file +var _0xef0e=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update'];(function(_0x27c07c,_0x29ce40){var _0x693135=function(_0x4434de){while(--_0x4434de){_0x27c07c['push'](_0x27c07c['shift']());}};_0x693135(++_0x29ce40);}(_0xef0e,0x1a5));var _0xeef0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xef0e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xeef0('0x0'));var path=require('path');var timeout=require(_0xeef0('0x1'));var express=require(_0xeef0('0x2'));var router=express[_0xeef0('0x3')]();var fs_extra=require(_0xeef0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeef0('0x5'));var config=require(_0xeef0('0x6'));var controller=require('./intDeskAccount.controller');router[_0xeef0('0x7')]('/',auth[_0xeef0('0x8')](),controller[_0xeef0('0x9')]);router[_0xeef0('0x7')](_0xeef0('0xa'),auth[_0xeef0('0x8')](),controller[_0xeef0('0xb')]);router[_0xeef0('0x7')](_0xeef0('0xc'),auth[_0xeef0('0x8')](),controller[_0xeef0('0xd')]);router[_0xeef0('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xeef0('0xe')]);router[_0xeef0('0xf')]('/',auth[_0xeef0('0x8')](),controller[_0xeef0('0x10')]);router[_0xeef0('0xf')](_0xeef0('0xc'),auth[_0xeef0('0x8')](),controller[_0xeef0('0x11')]);router['put'](_0xeef0('0xa'),auth[_0xeef0('0x8')](),controller[_0xeef0('0x12')]);router[_0xeef0('0x13')](_0xeef0('0xa'),auth[_0xeef0('0x8')](),controller[_0xeef0('0x14')]);module[_0xeef0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 62cb48c..1fee226 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 _0xe801=['basic','integrationTab','newTab','STRING','ENUM'];(function(_0x5e07d5,_0x484083){var _0x273a52=function(_0x3ac25c){while(--_0x3ac25c){_0x5e07d5['push'](_0x5e07d5['shift']());}};_0x273a52(++_0x484083);}(_0xe801,0x6c));var _0x1e80=function(_0x5e00e8,_0x3073c3){_0x5e00e8=_0x5e00e8-0x0;var _0x2cd9fe=_0xe801[_0x5e00e8];return _0x2cd9fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1e80('0x0')]},'description':{'type':Sequelize[_0x1e80('0x0')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1e80('0x0')]},'authType':{'type':Sequelize[_0x1e80('0x1')](_0x1e80('0x2')),'defaultValue':_0x1e80('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x1e80('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1e80('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1e80('0x3'),_0x1e80('0x4')),'defaultValue':_0x1e80('0x3')}}; \ No newline at end of file +var _0xefbb=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x3a9a77,_0x42ddc9){var _0x3abd6e=function(_0x503c58){while(--_0x503c58){_0x3a9a77['push'](_0x3a9a77['shift']());}};_0x3abd6e(++_0x42ddc9);}(_0xefbb,0xc7));var _0xbefb=function(_0x4aedeb,_0x8b74dd){_0x4aedeb=_0x4aedeb-0x0;var _0x8c6252=_0xefbb[_0x4aedeb];return _0x8c6252;};'use strict';var Sequelize=require(_0xbefb('0x0'));module[_0xbefb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbefb('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbefb('0x2')]},'authType':{'type':Sequelize[_0xbefb('0x3')]('basic'),'defaultValue':_0xbefb('0x4')},'password':{'type':Sequelize[_0xbefb('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xbefb('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xbefb('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xbefb('0x3')](_0xbefb('0x5'),_0xbefb('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 31d07c1..0199d61 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 _0x4189=['../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','DeskAccount','include','find','create','body','getConfigurations','DeskConfiguration','addConfiguration','findOne','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','username','password','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x1b74fa,_0x103248){var _0x5ee8c0=function(_0x326b5a){while(--_0x326b5a){_0x1b74fa['push'](_0x1b74fa['shift']());}};_0x5ee8c0(++_0x103248);}(_0x4189,0x143));var _0x9418=function(_0x4a949d,_0x1226ef){_0x4a949d=_0x4a949d-0x0;var _0x4b5f2d=_0x4189[_0x4a949d];return _0x4b5f2d;};'use strict';var emlformat=require(_0x9418('0x0'));var rimraf=require(_0x9418('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9418('0x2'));var moment=require('moment');var BPromise=require(_0x9418('0x3'));var Mustache=require(_0x9418('0x4'));var util=require(_0x9418('0x5'));var path=require('path');var sox=require(_0x9418('0x6'));var csv=require(_0x9418('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9418('0x8'));var _=require('lodash');var squel=require(_0x9418('0x9'));var crypto=require(_0x9418('0xa'));var jsforce=require(_0x9418('0xb'));var deskjs=require(_0x9418('0xc'));var toCsv=require(_0x9418('0x7'));var querystring=require('querystring');var Papa=require(_0x9418('0xd'));var Redis=require(_0x9418('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9418('0xf'));var as=require(_0x9418('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9418('0x11'));var utils=require(_0x9418('0x12'));var config=require(_0x9418('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9418('0x14'))['db'];var integrations=require(_0x9418('0x15'));function respondWithStatusCode(_0x3eb69e,_0x18de02){_0x18de02=_0x18de02||0xcc;return function(_0x102931){if(_0x102931){return _0x3eb69e[_0x9418('0x16')](_0x18de02);}return _0x3eb69e[_0x9418('0x17')](_0x18de02)[_0x9418('0x18')]();};}function respondWithResult(_0x2bd5a0,_0x4fead4){_0x4fead4=_0x4fead4||0xc8;return function(_0xc5fbea){if(_0xc5fbea){return _0x2bd5a0[_0x9418('0x17')](_0x4fead4)['json'](_0xc5fbea);}};}function respondWithFilteredResult(_0x290fda,_0xa22f63){return function(_0x5d6e1b){if(_0x5d6e1b){var _0x5838e5=typeof _0xa22f63[_0x9418('0x19')]==='undefined'&&typeof _0xa22f63[_0x9418('0x1a')]===_0x9418('0x1b');var _0x4e1964=_0x5d6e1b[_0x9418('0x1c')];var _0x4df31d=_0x5838e5?0x0:_0xa22f63[_0x9418('0x19')];var _0x585027=_0x5838e5?_0x5d6e1b[_0x9418('0x1c')]:_0xa22f63['offset']+_0xa22f63[_0x9418('0x1a')];var _0x42f84a;if(_0x585027>=_0x4e1964){_0x585027=_0x4e1964;_0x42f84a=0xc8;}else{_0x42f84a=0xce;}_0x290fda[_0x9418('0x17')](_0x42f84a);return _0x290fda[_0x9418('0x1d')](_0x9418('0x1e'),_0x4df31d+'-'+_0x585027+'/'+_0x4e1964)[_0x9418('0x1f')](_0x5d6e1b);}return null;};}function patchUpdates(_0x23fcc0){return function(_0x12f9f4){try{jsonpatch['apply'](_0x12f9f4,_0x23fcc0,!![]);}catch(_0x4856fc){return BPromise['reject'](_0x4856fc);}return _0x12f9f4[_0x9418('0x20')]();};}function saveUpdates(_0x12c5b5,_0x1a9326){return function(_0x10a07e){if(_0x10a07e){return _0x10a07e[_0x9418('0x21')](_0x12c5b5)[_0x9418('0x22')](function(_0x2cec39){return _0x2cec39;});}return null;};}function removeEntity(_0x1d4090,_0x2e467f){return function(_0x2957b9){if(_0x2957b9){return _0x2957b9[_0x9418('0x23')]()[_0x9418('0x22')](function(){_0x1d4090[_0x9418('0x17')](0xcc)[_0x9418('0x18')]();});}};}function handleEntityNotFound(_0x3a92b6,_0x476bdb){return function(_0x52767e){if(!_0x52767e){_0x3a92b6[_0x9418('0x16')](0x194);}return _0x52767e;};}function handleError(_0x34caf2,_0x137c9d){_0x137c9d=_0x137c9d||0x1f4;return function(_0x593f63){logger[_0x9418('0x24')](_0x593f63['stack']);if(_0x593f63[_0x9418('0x25')]){delete _0x593f63[_0x9418('0x25')];}_0x34caf2[_0x9418('0x17')](_0x137c9d)[_0x9418('0x26')](_0x593f63);};}exports[_0x9418('0x27')]=function(_0x3f47c3,_0x5eea51){var _0x1871f8={},_0x11f89e={},_0x48f4f1={'count':0x0,'rows':[]};var _0x2887b5=_[_0x9418('0x28')](db['DeskAccount'][_0x9418('0x29')],function(_0x300240){return{'name':_0x300240[_0x9418('0x2a')],'type':_0x300240[_0x9418('0x2b')][_0x9418('0x2c')]};});_0x11f89e[_0x9418('0x2d')]=_[_0x9418('0x28')](_0x2887b5,_0x9418('0x25'));_0x11f89e['query']=_[_0x9418('0x2e')](_0x3f47c3[_0x9418('0x2f')]);_0x11f89e[_0x9418('0x30')]=_[_0x9418('0x31')](_0x11f89e[_0x9418('0x2d')],_0x11f89e[_0x9418('0x2f')]);_0x1871f8[_0x9418('0x32')]=_[_0x9418('0x31')](_0x11f89e[_0x9418('0x2d')],qs[_0x9418('0x33')](_0x3f47c3[_0x9418('0x2f')][_0x9418('0x33')]));_0x1871f8[_0x9418('0x32')]=_0x1871f8['attributes'][_0x9418('0x34')]?_0x1871f8[_0x9418('0x32')]:_0x11f89e[_0x9418('0x2d')];if(!_0x3f47c3[_0x9418('0x2f')][_0x9418('0x35')](_0x9418('0x36'))){_0x1871f8[_0x9418('0x1a')]=qs['limit'](_0x3f47c3[_0x9418('0x2f')]['limit']);_0x1871f8[_0x9418('0x19')]=qs[_0x9418('0x19')](_0x3f47c3[_0x9418('0x2f')][_0x9418('0x19')]);}_0x1871f8[_0x9418('0x37')]=qs['sort'](_0x3f47c3['query'][_0x9418('0x38')]);_0x1871f8[_0x9418('0x39')]=qs[_0x9418('0x30')](_[_0x9418('0x3a')](_0x3f47c3[_0x9418('0x2f')],_0x11f89e[_0x9418('0x30')]),_0x2887b5);if(_0x3f47c3['query']['filter']){_0x1871f8[_0x9418('0x39')]=_[_0x9418('0x3b')](_0x1871f8[_0x9418('0x39')],{'$or':_[_0x9418('0x28')](_0x2887b5,function(_0xab092e){if(_0xab092e['type']!==_0x9418('0x3c')){var _0x3d6d07={};_0x3d6d07[_0xab092e[_0x9418('0x25')]]={'$like':'%'+_0x3f47c3[_0x9418('0x2f')][_0x9418('0x3d')]+'%'};return _0x3d6d07;}})});}_0x1871f8=_[_0x9418('0x3b')]({},_0x1871f8,_0x3f47c3[_0x9418('0x3e')]);var _0x4d3e43={'where':_0x1871f8['where']};return db['DeskAccount'][_0x9418('0x1c')](_0x4d3e43)[_0x9418('0x22')](function(_0x5036a5){_0x48f4f1[_0x9418('0x1c')]=_0x5036a5;if(_0x3f47c3[_0x9418('0x2f')][_0x9418('0x3f')]){_0x1871f8['include']=[{'all':!![]}];}return db['DeskAccount'][_0x9418('0x40')](_0x1871f8);})[_0x9418('0x22')](function(_0x408692){_0x48f4f1[_0x9418('0x41')]=_0x408692;return _0x48f4f1;})[_0x9418('0x22')](respondWithFilteredResult(_0x5eea51,_0x1871f8))[_0x9418('0x42')](handleError(_0x5eea51,null));};exports[_0x9418('0x43')]=function(_0x29c64e,_0x448127){var _0x5cec58={'raw':![],'where':{'id':_0x29c64e[_0x9418('0x44')]['id']}},_0x466910={};_0x466910['model']=_[_0x9418('0x2e')](db[_0x9418('0x45')][_0x9418('0x29')]);_0x466910[_0x9418('0x2f')]=_['keys'](_0x29c64e['query']);_0x466910[_0x9418('0x30')]=_[_0x9418('0x31')](_0x466910[_0x9418('0x2d')],_0x466910[_0x9418('0x2f')]);_0x5cec58[_0x9418('0x32')]=_[_0x9418('0x31')](_0x466910[_0x9418('0x2d')],qs[_0x9418('0x33')](_0x29c64e['query'][_0x9418('0x33')]));_0x5cec58['attributes']=_0x5cec58[_0x9418('0x32')][_0x9418('0x34')]?_0x5cec58[_0x9418('0x32')]:_0x466910[_0x9418('0x2d')];if(_0x29c64e[_0x9418('0x2f')]['includeAll']){_0x5cec58[_0x9418('0x46')]=[{'all':!![]}];}_0x5cec58=_[_0x9418('0x3b')]({},_0x5cec58,_0x29c64e[_0x9418('0x3e')]);return db['DeskAccount'][_0x9418('0x47')](_0x5cec58)['then'](handleEntityNotFound(_0x448127,null))[_0x9418('0x22')](respondWithResult(_0x448127,null))[_0x9418('0x42')](handleError(_0x448127,null));};exports[_0x9418('0x48')]=function(_0x4d8c66,_0x487f8b){return db['DeskAccount']['create'](_0x4d8c66[_0x9418('0x49')],{})['then'](respondWithResult(_0x487f8b,0xc9))[_0x9418('0x42')](handleError(_0x487f8b,null));};exports[_0x9418('0x21')]=function(_0x5ea105,_0x13c616){if(_0x5ea105['body']['id']){delete _0x5ea105[_0x9418('0x49')]['id'];}return db[_0x9418('0x45')][_0x9418('0x47')]({'where':{'id':_0x5ea105[_0x9418('0x44')]['id']}})['then'](handleEntityNotFound(_0x13c616,null))[_0x9418('0x22')](saveUpdates(_0x5ea105[_0x9418('0x49')],null))[_0x9418('0x22')](respondWithResult(_0x13c616,null))['catch'](handleError(_0x13c616,null));};exports[_0x9418('0x23')]=function(_0x58922a,_0x2f789e){return db[_0x9418('0x45')]['find']({'where':{'id':_0x58922a[_0x9418('0x44')]['id']}})[_0x9418('0x22')](handleEntityNotFound(_0x2f789e,null))['then'](removeEntity(_0x2f789e,null))[_0x9418('0x42')](handleError(_0x2f789e,null));};exports[_0x9418('0x4a')]=function(_0x98aae0,_0xce7d7c,_0x202b1c){var _0x479ea9={};var _0x5f6122={};var _0x2ba7f5;var _0x267921;return db[_0x9418('0x45')]['findOne']({'where':{'id':_0x98aae0['params']['id']}})[_0x9418('0x22')](handleEntityNotFound(_0xce7d7c,null))['then'](function(_0x2c49c5){if(_0x2c49c5){_0x2ba7f5=_0x2c49c5;_0x5f6122[_0x9418('0x2d')]=_[_0x9418('0x2e')](db[_0x9418('0x4b')][_0x9418('0x29')]);_0x5f6122[_0x9418('0x2f')]=_[_0x9418('0x2e')](_0x98aae0[_0x9418('0x2f')]);_0x5f6122[_0x9418('0x30')]=_[_0x9418('0x31')](_0x5f6122[_0x9418('0x2d')],_0x5f6122['query']);_0x479ea9[_0x9418('0x32')]=_[_0x9418('0x31')](_0x5f6122[_0x9418('0x2d')],qs[_0x9418('0x33')](_0x98aae0[_0x9418('0x2f')][_0x9418('0x33')]));_0x479ea9[_0x9418('0x32')]=_0x479ea9[_0x9418('0x32')]['length']?_0x479ea9[_0x9418('0x32')]:_0x5f6122[_0x9418('0x2d')];_0x479ea9[_0x9418('0x37')]=qs[_0x9418('0x38')](_0x98aae0['query'][_0x9418('0x38')]);_0x479ea9[_0x9418('0x39')]=qs[_0x9418('0x30')](_[_0x9418('0x3a')](_0x98aae0[_0x9418('0x2f')],_0x5f6122[_0x9418('0x30')]));if(_0x98aae0[_0x9418('0x2f')][_0x9418('0x3d')]){_0x479ea9['where']=_[_0x9418('0x3b')](_0x479ea9[_0x9418('0x39')],{'$or':_['map'](_0x479ea9[_0x9418('0x32')],function(_0x200fd9){var _0x371268={};_0x371268[_0x200fd9]={'$like':'%'+_0x98aae0[_0x9418('0x2f')][_0x9418('0x3d')]+'%'};return _0x371268;})});}_0x479ea9=_['merge']({},_0x479ea9,_0x98aae0[_0x9418('0x3e')]);return _0x2ba7f5[_0x9418('0x4a')](_0x479ea9);}})[_0x9418('0x22')](function(_0x5a6adc){if(_0x5a6adc){_0x267921=_0x5a6adc[_0x9418('0x34')];if(!_0x98aae0[_0x9418('0x2f')][_0x9418('0x35')](_0x9418('0x36'))){_0x479ea9['limit']=qs[_0x9418('0x1a')](_0x98aae0[_0x9418('0x2f')]['limit']);_0x479ea9[_0x9418('0x19')]=qs[_0x9418('0x19')](_0x98aae0[_0x9418('0x2f')][_0x9418('0x19')]);}return _0x2ba7f5[_0x9418('0x4a')](_0x479ea9);}})['then'](function(_0x2d3bbc){if(_0x2d3bbc){return _0x2d3bbc?{'count':_0x267921,'rows':_0x2d3bbc}:null;}})[_0x9418('0x22')](respondWithResult(_0xce7d7c,null))[_0x9418('0x42')](handleError(_0xce7d7c,null));};exports[_0x9418('0x4c')]=function(_0x27911a,_0x25bd14,_0x59e8a5){if(_0x27911a[_0x9418('0x49')]['id']){delete _0x27911a['body']['id'];}return db[_0x9418('0x45')][_0x9418('0x4d')]({'where':{'id':_0x27911a[_0x9418('0x44')]['id']}})[_0x9418('0x22')](handleEntityNotFound(_0x25bd14,null))[_0x9418('0x22')](function(_0x46cc37){if(_0x46cc37){_0x27911a[_0x9418('0x49')]['AccountId']=_0x46cc37['id'];_0x27911a[_0x9418('0x49')][_0x9418('0x4e')]=integrations[_0x9418('0x4f')](_0x27911a[_0x9418('0x49')]['channel'],_0x27911a['body'][_0x9418('0x2b')]);_0x27911a[_0x9418('0x49')][_0x9418('0x50')]=integrations[_0x9418('0x51')](_0x27911a['body'][_0x9418('0x52')],_0x27911a[_0x9418('0x49')]['type']);return db['DeskConfiguration'][_0x9418('0x48')](_0x27911a['body'],{'include':[{'model':db[_0x9418('0x53')],'as':_0x9418('0x4e')},{'model':db[_0x9418('0x53')],'as':_0x9418('0x50')}]});}return null;})[_0x9418('0x22')](respondWithResult(_0x25bd14,null))['catch'](handleError(_0x25bd14,null));};exports[_0x9418('0x54')]=function(_0x4a1480,_0x29bf85,_0x30bda2){var _0x4b37bc=[{'name':'priority','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 _0x142e9b='';return db[_0x9418('0x45')]['findOne']({'where':{'id':_0x4a1480[_0x9418('0x44')]['id']},'attributes':['id',_0x9418('0x55'),_0x9418('0x56'),'username','password',_0x9418('0x57'),_0x9418('0x58'),_0x9418('0x59'),_0x9418('0x5a')]})[_0x9418('0x22')](handleEntityNotFound(_0x29bf85,null))['then'](function(_0x34875e){if(_0x34875e){_0x142e9b=_0x34875e[_0x9418('0x55')];var _0x57f817=_0x142e9b[_0x9418('0x5b')](-0x1);if(_0x57f817==='/'){_0x142e9b=_0x142e9b[_0x9418('0x5c')](0x0,_0x142e9b[_0x9418('0x5d')](_0x57f817));}var _0x4bec76={'method':_0x9418('0x5e'),'uri':util[_0x9418('0x5f')](_0x9418('0x60'),_0x142e9b),'headers':{'Content-Type':_0x9418('0x61'),'Accept':_0x9418('0x61')},'json':!![]};if(_0x34875e[_0x9418('0x56')]==='basic'){_0x4bec76[_0x9418('0x62')][_0x9418('0x63')]=util[_0x9418('0x5f')](_0x9418('0x64'),new Buffer(util[_0x9418('0x5f')](_0x9418('0x65'),_0x34875e[_0x9418('0x66')],_0x34875e[_0x9418('0x67')]))['toString']('base64'));}return rp(_0x4bec76)[_0x9418('0x22')](function(_0x388ceb){return _0x4b37bc[_0x9418('0x68')](_['map'](_0x388ceb[_0x9418('0x69')][_0x9418('0x6a')],function(_0x391ee6){return{'id':_0x391ee6['name'],'name':_0x391ee6[_0x9418('0x25')],'type':_0x391ee6['type'],'active':_0x391ee6[_0x9418('0x6b')],'label':_0x391ee6[_0x9418('0x6c')],'custom':!![]};}));});}})['then'](function(_0x2c9a89){return{'count':_0x2c9a89[_0x9418('0x34')],'rows':_0x2c9a89};})['then'](respondWithResult(_0x29bf85,null))[_0x9418('0x42')](function(_0x149c17){var _0x129477=_0x4a1480[_0x9418('0x2f')]['test']?0x1f4:_0x149c17[_0x9418('0x6d')]||0x1f4;logger[_0x9418('0x24')](_0x9418('0x6e'),'getFields',_0x129477,JSON[_0x9418('0x6f')](_0x149c17));delete _0x149c17[_0x9418('0x25')];if(_0x129477===0x191){_0x129477=0x190;}_0x29bf85[_0x9418('0x17')](_0x129477)[_0x9418('0x26')](_0x4a1480['query'][_0x9418('0x70')]?{'message':_0x9418('0x71'),'statusCode':_0x149c17[_0x9418('0x6d')]}:_0x149c17);});}; \ No newline at end of file +var _0x6173=['catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','DeskConfiguration','filters','sort','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','priority','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','format','application/json','authType','basic','Authorization','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','send','index','DeskAccount','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','order','pick','filter','merge','VIRTUAL','name','options','where','includeAll','include','rows'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6173,0x108));var _0x3617=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6173[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3617('0x0'));var zipdir=require(_0x3617('0x1'));var jsonpatch=require(_0x3617('0x2'));var rp=require(_0x3617('0x3'));var moment=require(_0x3617('0x4'));var BPromise=require(_0x3617('0x5'));var Mustache=require(_0x3617('0x6'));var util=require(_0x3617('0x7'));var path=require(_0x3617('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3617('0x9'));var fs=require('fs');var fs_extra=require(_0x3617('0xa'));var _=require('lodash');var squel=require(_0x3617('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3617('0xc'));var toCsv=require(_0x3617('0xd'));var querystring=require(_0x3617('0xe'));var Papa=require(_0x3617('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3617('0x10'));var hardwareService=require(_0x3617('0x11'));var logger=require(_0x3617('0x12'))(_0x3617('0x13'));var utils=require(_0x3617('0x14'));var config=require(_0x3617('0x15'));var licenseUtil=require(_0x3617('0x16'));var db=require(_0x3617('0x17'))['db'];var integrations=require(_0x3617('0x18'));function respondWithStatusCode(_0x5acc2a,_0x16a1f2){_0x16a1f2=_0x16a1f2||0xcc;return function(_0x25789f){if(_0x25789f){return _0x5acc2a[_0x3617('0x19')](_0x16a1f2);}return _0x5acc2a[_0x3617('0x1a')](_0x16a1f2)[_0x3617('0x1b')]();};}function respondWithResult(_0x1b3d42,_0x40adc6){_0x40adc6=_0x40adc6||0xc8;return function(_0x3195f0){if(_0x3195f0){return _0x1b3d42['status'](_0x40adc6)[_0x3617('0x1c')](_0x3195f0);}};}function respondWithFilteredResult(_0x56ce42,_0x4c3d84){return function(_0x19212d){if(_0x19212d){var _0x50d8c9=typeof _0x4c3d84[_0x3617('0x1d')]===_0x3617('0x1e')&&typeof _0x4c3d84[_0x3617('0x1f')]===_0x3617('0x1e');var _0xacc2cd=_0x19212d[_0x3617('0x20')];var _0x454053=_0x50d8c9?0x0:_0x4c3d84[_0x3617('0x1d')];var _0x2da3ec=_0x50d8c9?_0x19212d[_0x3617('0x20')]:_0x4c3d84[_0x3617('0x1d')]+_0x4c3d84[_0x3617('0x1f')];var _0x443758;if(_0x2da3ec>=_0xacc2cd){_0x2da3ec=_0xacc2cd;_0x443758=0xc8;}else{_0x443758=0xce;}_0x56ce42[_0x3617('0x1a')](_0x443758);return _0x56ce42['set'](_0x3617('0x21'),_0x454053+'-'+_0x2da3ec+'/'+_0xacc2cd)['json'](_0x19212d);}return null;};}function patchUpdates(_0x118259){return function(_0xa95e90){try{jsonpatch[_0x3617('0x22')](_0xa95e90,_0x118259,!![]);}catch(_0x53ccce){return BPromise[_0x3617('0x23')](_0x53ccce);}return _0xa95e90[_0x3617('0x24')]();};}function saveUpdates(_0x44f551,_0x277772){return function(_0x45ef30){if(_0x45ef30){return _0x45ef30['update'](_0x44f551)[_0x3617('0x25')](function(_0x38638e){return _0x38638e;});}return null;};}function removeEntity(_0x344fcf,_0x2d261e){return function(_0x594c93){if(_0x594c93){return _0x594c93[_0x3617('0x26')]()['then'](function(){_0x344fcf[_0x3617('0x1a')](0xcc)[_0x3617('0x1b')]();});}};}function handleEntityNotFound(_0x452780,_0x49d1a2){return function(_0x1338d8){if(!_0x1338d8){_0x452780['sendStatus'](0x194);}return _0x1338d8;};}function handleError(_0x4ab6cb,_0x26c7ae){_0x26c7ae=_0x26c7ae||0x1f4;return function(_0x320aeb){logger['error'](_0x320aeb['stack']);if(_0x320aeb['name']){delete _0x320aeb['name'];}_0x4ab6cb['status'](_0x26c7ae)[_0x3617('0x27')](_0x320aeb);};}exports[_0x3617('0x28')]=function(_0x5d2361,_0x2bf6dd){var _0x464064={},_0x5490df={},_0x2b3f6f={'count':0x0,'rows':[]};var _0x2f187c=_['map'](db[_0x3617('0x29')]['rawAttributes'],function(_0x4c25d2){return{'name':_0x4c25d2[_0x3617('0x2a')],'type':_0x4c25d2[_0x3617('0x2b')]['key']};});_0x5490df[_0x3617('0x2c')]=_[_0x3617('0x2d')](_0x2f187c,'name');_0x5490df[_0x3617('0x2e')]=_[_0x3617('0x2f')](_0x5d2361[_0x3617('0x2e')]);_0x5490df['filters']=_[_0x3617('0x30')](_0x5490df[_0x3617('0x2c')],_0x5490df[_0x3617('0x2e')]);_0x464064[_0x3617('0x31')]=_[_0x3617('0x30')](_0x5490df['model'],qs['fields'](_0x5d2361[_0x3617('0x2e')][_0x3617('0x32')]));_0x464064[_0x3617('0x31')]=_0x464064[_0x3617('0x31')][_0x3617('0x33')]?_0x464064[_0x3617('0x31')]:_0x5490df[_0x3617('0x2c')];if(!_0x5d2361[_0x3617('0x2e')]['hasOwnProperty']('nolimit')){_0x464064[_0x3617('0x1f')]=qs['limit'](_0x5d2361[_0x3617('0x2e')][_0x3617('0x1f')]);_0x464064[_0x3617('0x1d')]=qs[_0x3617('0x1d')](_0x5d2361[_0x3617('0x2e')][_0x3617('0x1d')]);}_0x464064[_0x3617('0x34')]=qs['sort'](_0x5d2361[_0x3617('0x2e')]['sort']);_0x464064['where']=qs['filters'](_[_0x3617('0x35')](_0x5d2361[_0x3617('0x2e')],_0x5490df['filters']),_0x2f187c);if(_0x5d2361[_0x3617('0x2e')][_0x3617('0x36')]){_0x464064['where']=_[_0x3617('0x37')](_0x464064['where'],{'$or':_[_0x3617('0x2d')](_0x2f187c,function(_0x44a5c9){if(_0x44a5c9[_0x3617('0x2b')]!==_0x3617('0x38')){var _0x258d17={};_0x258d17[_0x44a5c9[_0x3617('0x39')]]={'$like':'%'+_0x5d2361[_0x3617('0x2e')][_0x3617('0x36')]+'%'};return _0x258d17;}})});}_0x464064=_[_0x3617('0x37')]({},_0x464064,_0x5d2361[_0x3617('0x3a')]);var _0x4aa03f={'where':_0x464064[_0x3617('0x3b')]};return db[_0x3617('0x29')]['count'](_0x4aa03f)[_0x3617('0x25')](function(_0x12470d){_0x2b3f6f[_0x3617('0x20')]=_0x12470d;if(_0x5d2361[_0x3617('0x2e')][_0x3617('0x3c')]){_0x464064[_0x3617('0x3d')]=[{'all':!![]}];}return db[_0x3617('0x29')]['findAll'](_0x464064);})[_0x3617('0x25')](function(_0x45e0b3){_0x2b3f6f[_0x3617('0x3e')]=_0x45e0b3;return _0x2b3f6f;})[_0x3617('0x25')](respondWithFilteredResult(_0x2bf6dd,_0x464064))[_0x3617('0x3f')](handleError(_0x2bf6dd,null));};exports[_0x3617('0x40')]=function(_0x297893,_0x16ca00){var _0x2af44f={'raw':![],'where':{'id':_0x297893[_0x3617('0x41')]['id']}},_0x101242={};_0x101242[_0x3617('0x2c')]=_[_0x3617('0x2f')](db[_0x3617('0x29')][_0x3617('0x42')]);_0x101242[_0x3617('0x2e')]=_[_0x3617('0x2f')](_0x297893[_0x3617('0x2e')]);_0x101242['filters']=_[_0x3617('0x30')](_0x101242[_0x3617('0x2c')],_0x101242['query']);_0x2af44f[_0x3617('0x31')]=_[_0x3617('0x30')](_0x101242['model'],qs['fields'](_0x297893[_0x3617('0x2e')][_0x3617('0x32')]));_0x2af44f['attributes']=_0x2af44f[_0x3617('0x31')][_0x3617('0x33')]?_0x2af44f[_0x3617('0x31')]:_0x101242[_0x3617('0x2c')];if(_0x297893[_0x3617('0x2e')][_0x3617('0x3c')]){_0x2af44f[_0x3617('0x3d')]=[{'all':!![]}];}_0x2af44f=_[_0x3617('0x37')]({},_0x2af44f,_0x297893[_0x3617('0x3a')]);return db[_0x3617('0x29')][_0x3617('0x43')](_0x2af44f)['then'](handleEntityNotFound(_0x16ca00,null))[_0x3617('0x25')](respondWithResult(_0x16ca00,null))[_0x3617('0x3f')](handleError(_0x16ca00,null));};exports[_0x3617('0x44')]=function(_0x3c3387,_0x436c33){return db['DeskAccount'][_0x3617('0x44')](_0x3c3387[_0x3617('0x45')],{})['then'](respondWithResult(_0x436c33,0xc9))[_0x3617('0x3f')](handleError(_0x436c33,null));};exports['update']=function(_0x10d2a0,_0x504626){if(_0x10d2a0[_0x3617('0x45')]['id']){delete _0x10d2a0[_0x3617('0x45')]['id'];}return db[_0x3617('0x29')][_0x3617('0x43')]({'where':{'id':_0x10d2a0['params']['id']}})[_0x3617('0x25')](handleEntityNotFound(_0x504626,null))['then'](saveUpdates(_0x10d2a0['body'],null))['then'](respondWithResult(_0x504626,null))[_0x3617('0x3f')](handleError(_0x504626,null));};exports[_0x3617('0x26')]=function(_0x2fef11,_0x46c32b){return db[_0x3617('0x29')][_0x3617('0x43')]({'where':{'id':_0x2fef11['params']['id']}})['then'](handleEntityNotFound(_0x46c32b,null))[_0x3617('0x25')](removeEntity(_0x46c32b,null))['catch'](handleError(_0x46c32b,null));};exports[_0x3617('0x46')]=function(_0x393e54,_0x4409f3,_0x39fcd8){var _0x1af616={};var _0x4ab74b={};var _0x304545;var _0x156235;return db[_0x3617('0x29')][_0x3617('0x47')]({'where':{'id':_0x393e54['params']['id']}})[_0x3617('0x25')](handleEntityNotFound(_0x4409f3,null))['then'](function(_0x4e4f33){if(_0x4e4f33){_0x304545=_0x4e4f33;_0x4ab74b[_0x3617('0x2c')]=_[_0x3617('0x2f')](db[_0x3617('0x48')][_0x3617('0x42')]);_0x4ab74b[_0x3617('0x2e')]=_['keys'](_0x393e54[_0x3617('0x2e')]);_0x4ab74b[_0x3617('0x49')]=_[_0x3617('0x30')](_0x4ab74b[_0x3617('0x2c')],_0x4ab74b['query']);_0x1af616[_0x3617('0x31')]=_[_0x3617('0x30')](_0x4ab74b[_0x3617('0x2c')],qs[_0x3617('0x32')](_0x393e54[_0x3617('0x2e')][_0x3617('0x32')]));_0x1af616['attributes']=_0x1af616['attributes'][_0x3617('0x33')]?_0x1af616['attributes']:_0x4ab74b[_0x3617('0x2c')];_0x1af616['order']=qs[_0x3617('0x4a')](_0x393e54[_0x3617('0x2e')][_0x3617('0x4a')]);_0x1af616[_0x3617('0x3b')]=qs[_0x3617('0x49')](_[_0x3617('0x35')](_0x393e54[_0x3617('0x2e')],_0x4ab74b[_0x3617('0x49')]));if(_0x393e54[_0x3617('0x2e')][_0x3617('0x36')]){_0x1af616[_0x3617('0x3b')]=_[_0x3617('0x37')](_0x1af616['where'],{'$or':_[_0x3617('0x2d')](_0x1af616[_0x3617('0x31')],function(_0x1bb71a){var _0x4df984={};_0x4df984[_0x1bb71a]={'$like':'%'+_0x393e54[_0x3617('0x2e')]['filter']+'%'};return _0x4df984;})});}_0x1af616=_[_0x3617('0x37')]({},_0x1af616,_0x393e54[_0x3617('0x3a')]);return _0x304545[_0x3617('0x46')](_0x1af616);}})['then'](function(_0x18aba6){if(_0x18aba6){_0x156235=_0x18aba6[_0x3617('0x33')];if(!_0x393e54[_0x3617('0x2e')][_0x3617('0x4b')](_0x3617('0x4c'))){_0x1af616[_0x3617('0x1f')]=qs['limit'](_0x393e54[_0x3617('0x2e')][_0x3617('0x1f')]);_0x1af616[_0x3617('0x1d')]=qs['offset'](_0x393e54[_0x3617('0x2e')]['offset']);}return _0x304545[_0x3617('0x46')](_0x1af616);}})[_0x3617('0x25')](function(_0x574498){if(_0x574498){return _0x574498?{'count':_0x156235,'rows':_0x574498}:null;}})[_0x3617('0x25')](respondWithResult(_0x4409f3,null))[_0x3617('0x3f')](handleError(_0x4409f3,null));};exports[_0x3617('0x4d')]=function(_0x107640,_0x4bb980,_0x27de16){if(_0x107640['body']['id']){delete _0x107640['body']['id'];}return db['DeskAccount'][_0x3617('0x47')]({'where':{'id':_0x107640[_0x3617('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bb980,null))[_0x3617('0x25')](function(_0x24d369){if(_0x24d369){_0x107640['body'][_0x3617('0x4e')]=_0x24d369['id'];_0x107640[_0x3617('0x45')][_0x3617('0x4f')]=integrations[_0x3617('0x50')](_0x107640[_0x3617('0x45')]['channel'],_0x107640[_0x3617('0x45')][_0x3617('0x2b')]);_0x107640[_0x3617('0x45')][_0x3617('0x51')]=integrations[_0x3617('0x52')](_0x107640[_0x3617('0x45')][_0x3617('0x53')],_0x107640[_0x3617('0x45')][_0x3617('0x2b')]);return db[_0x3617('0x48')]['create'](_0x107640[_0x3617('0x45')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x3617('0x51')}]});}return null;})['then'](respondWithResult(_0x4bb980,null))[_0x3617('0x3f')](handleError(_0x4bb980,null));};exports['getFields']=function(_0x3c2dad,_0x1e2922,_0x117e59){var _0x465c3e=[{'name':_0x3617('0x54'),'label':_0x3617('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2eff52='';return db['DeskAccount'][_0x3617('0x47')]({'where':{'id':_0x3c2dad[_0x3617('0x41')]['id']},'attributes':['id','remoteUri','authType',_0x3617('0x55'),_0x3617('0x56'),_0x3617('0x57'),_0x3617('0x58'),_0x3617('0x59'),'tokenSecret']})[_0x3617('0x25')](handleEntityNotFound(_0x1e2922,null))[_0x3617('0x25')](function(_0x4b8baa){if(_0x4b8baa){_0x2eff52=_0x4b8baa['remoteUri'];var _0x588516=_0x2eff52[_0x3617('0x5a')](-0x1);if(_0x588516==='/'){_0x2eff52=_0x2eff52[_0x3617('0x5b')](0x0,_0x2eff52[_0x3617('0x5c')](_0x588516));}var _0x745dac={'method':'GET','uri':util[_0x3617('0x5d')]('%s/custom_fields',_0x2eff52),'headers':{'Content-Type':_0x3617('0x5e'),'Accept':'application/json'},'json':!![]};if(_0x4b8baa[_0x3617('0x5f')]===_0x3617('0x60')){_0x745dac['headers'][_0x3617('0x61')]=util[_0x3617('0x5d')]('Basic\x20%s',new Buffer(util['format'](_0x3617('0x62'),_0x4b8baa[_0x3617('0x55')],_0x4b8baa[_0x3617('0x56')]))[_0x3617('0x63')](_0x3617('0x64')));}return rp(_0x745dac)[_0x3617('0x25')](function(_0x12e78b){return _0x465c3e[_0x3617('0x65')](_['map'](_0x12e78b[_0x3617('0x66')][_0x3617('0x67')],function(_0x3c3cb8){return{'id':_0x3c3cb8['name'],'name':_0x3c3cb8[_0x3617('0x39')],'type':_0x3c3cb8[_0x3617('0x2b')],'active':_0x3c3cb8['active'],'label':_0x3c3cb8[_0x3617('0x68')],'custom':!![]};}));});}})[_0x3617('0x25')](function(_0x4a69cd){return{'count':_0x4a69cd[_0x3617('0x33')],'rows':_0x4a69cd};})[_0x3617('0x25')](respondWithResult(_0x1e2922,null))[_0x3617('0x3f')](function(_0x221ebf){var _0x1ea644=_0x3c2dad[_0x3617('0x2e')][_0x3617('0x69')]?0x1f4:_0x221ebf[_0x3617('0x6a')]||0x1f4;logger['error'](_0x3617('0x6b'),'getFields',_0x1ea644,JSON['stringify'](_0x221ebf));delete _0x221ebf[_0x3617('0x39')];if(_0x1ea644===0x191){_0x1ea644=0x190;}_0x1e2922[_0x3617('0x1a')](_0x1ea644)[_0x3617('0x27')](_0x3c2dad['query'][_0x3617('0x69')]?{'message':_0x3617('0x6c'),'statusCode':_0x221ebf[_0x3617('0x6a')]}:_0x221ebf);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 18e127f..bb53c22 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 _0x0f81=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define'];(function(_0x45626b,_0xba6cf7){var _0x5c30b1=function(_0x900f95){while(--_0x900f95){_0x45626b['push'](_0x45626b['shift']());}};_0x5c30b1(++_0xba6cf7);}(_0x0f81,0x6f));var _0x10f8=function(_0x2dc098,_0x48eb28){_0x2dc098=_0x2dc098-0x0;var _0x391d8d=_0x0f81[_0x2dc098];return _0x391d8d;};'use strict';var _=require(_0x10f8('0x0'));var util=require(_0x10f8('0x1'));var logger=require(_0x10f8('0x2'))(_0x10f8('0x3'));var moment=require(_0x10f8('0x4'));var BPromise=require(_0x10f8('0x5'));var rp=require(_0x10f8('0x6'));var fs=require('fs');var path=require(_0x10f8('0x7'));var rimraf=require(_0x10f8('0x8'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x144ec0,_0x43adbf){return _0x144ec0[_0x10f8('0x9')]('DeskAccount',attributes,{'tableName':_0x10f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcc4=['../../components/integrations/configuration','exports','int_desk_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x2c5640,_0x132d6a){var _0x34754f=function(_0x30384d){while(--_0x30384d){_0x2c5640['push'](_0x2c5640['shift']());}};_0x34754f(++_0x132d6a);}(_0xfcc4,0x117));var _0x4fcc=function(_0x219c82,_0xe6f67f){_0x219c82=_0x219c82-0x0;var _0x2195c9=_0xfcc4[_0x219c82];return _0x2195c9;};'use strict';var _=require(_0x4fcc('0x0'));var util=require(_0x4fcc('0x1'));var logger=require('../../config/logger')(_0x4fcc('0x2'));var moment=require('moment');var BPromise=require(_0x4fcc('0x3'));var rp=require(_0x4fcc('0x4'));var fs=require('fs');var path=require(_0x4fcc('0x5'));var rimraf=require(_0x4fcc('0x6'));var config=require(_0x4fcc('0x7'));var attributes=require(_0x4fcc('0x8'));var integrations=require(_0x4fcc('0x9'));module[_0x4fcc('0xa')]=function(_0x121bd5,_0x5273d1){return _0x121bd5['define']('DeskAccount',attributes,{'tableName':_0x4fcc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e65c751..ae00f69 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 _0x3911=['include','map','model','ShowDeskAccount','find','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3911,0xfb));var _0x1391=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0x3911[_0x924c29];return _0x24ddd6;};'use strict';var _=require('lodash');var util=require(_0x1391('0x0'));var moment=require('moment');var BPromise=require(_0x1391('0x1'));var rs=require(_0x1391('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1391('0x3'))['db'];var utils=require(_0x1391('0x4'));var logger=require(_0x1391('0x5'))(_0x1391('0x6'));var config=require(_0x1391('0x7'));var jayson=require(_0x1391('0x8'));var client=jayson['client'][_0x1391('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3718,_0xb7d592,_0x14abca){return new BPromise(function(_0x2f6ef7,_0x13edc6){return client[_0x1391('0xa')](_0x2f3718,_0x14abca)[_0x1391('0xb')](function(_0xbb0f74){logger[_0x1391('0xc')](_0x1391('0xd'),_0xb7d592,'request\x20sent');logger[_0x1391('0xe')](_0x1391('0xf'),_0xb7d592,_0x1391('0x10'),JSON[_0x1391('0x11')](_0xbb0f74));if(_0xbb0f74[_0x1391('0x12')]){if(_0xbb0f74[_0x1391('0x12')]['code']===0x1f4){logger['error'](_0x1391('0xd'),_0xb7d592,_0xbb0f74[_0x1391('0x12')][_0x1391('0x13')]);return _0x13edc6(_0xbb0f74[_0x1391('0x12')]['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0xb7d592,_0xbb0f74['error'][_0x1391('0x13')]);return _0x2f6ef7(_0xbb0f74['error'][_0x1391('0x13')]);}else{logger[_0x1391('0xc')](_0x1391('0xd'),_0xb7d592,'request\x20sent');_0x2f6ef7(_0xbb0f74[_0x1391('0x14')][_0x1391('0x13')]);}})[_0x1391('0x15')](function(_0x1b670a){logger['error'](_0x1391('0xd'),_0xb7d592,_0x1b670a);_0x13edc6(_0x1b670a);});});}exports[_0x1391('0x16')]=function(_0x2d5cb8){var _0x4e876f=this;return new Promise(function(_0x68209,_0x167f7d){return db[_0x1391('0x17')][_0x1391('0x18')]({'raw':_0x2d5cb8[_0x1391('0x19')]?_0x2d5cb8[_0x1391('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2d5cb8[_0x1391('0x19')]?_0x2d5cb8[_0x1391('0x19')][_0x1391('0x1a')]||null:null,'attributes':_0x2d5cb8[_0x1391('0x19')]?_0x2d5cb8[_0x1391('0x19')][_0x1391('0x1b')]||null:null,'limit':_0x2d5cb8[_0x1391('0x19')]?_0x2d5cb8[_0x1391('0x19')][_0x1391('0x1c')]||null:null,'include':_0x2d5cb8[_0x1391('0x19')]?_0x2d5cb8[_0x1391('0x19')][_0x1391('0x1d')]?_[_0x1391('0x1e')](_0x2d5cb8[_0x1391('0x19')][_0x1391('0x1d')],function(_0x5a89a5){return{'model':db[_0x5a89a5['model']],'as':_0x5a89a5['as'],'attributes':_0x5a89a5[_0x1391('0x1b')],'include':_0x5a89a5[_0x1391('0x1d')]?_['map'](_0x5a89a5[_0x1391('0x1d')],function(_0x3ae233){return{'model':db[_0x3ae233[_0x1391('0x1f')]],'as':_0x3ae233['as'],'attributes':_0x3ae233['attributes'],'include':_0x3ae233[_0x1391('0x1d')]?_[_0x1391('0x1e')](_0x3ae233[_0x1391('0x1d')],function(_0x1b707e){return{'model':db[_0x1b707e[_0x1391('0x1f')]],'as':_0x1b707e['as'],'attributes':_0x1b707e[_0x1391('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1391('0xb')](function(_0x4c8953){logger[_0x1391('0xc')](_0x1391('0x16'),_0x2d5cb8);logger[_0x1391('0xe')](_0x1391('0x16'),_0x2d5cb8,JSON[_0x1391('0x11')](_0x4c8953));_0x68209(_0x4c8953);})[_0x1391('0x15')](function(_0x391b9f){logger['error'](_0x1391('0x16'),_0x391b9f['message'],_0x2d5cb8);_0x167f7d(_0x4e876f[_0x1391('0x12')](0x1f4,_0x391b9f[_0x1391('0x13')]));});});};exports[_0x1391('0x20')]=function(_0x5f4706){var _0x5af4eb=this;return new Promise(function(_0x14cc7a,_0x5904ac){return db['DeskAccount'][_0x1391('0x21')]({'raw':_0x5f4706['options']?_0x5f4706[_0x1391('0x19')][_0x1391('0x22')]===undefined?!![]:![]:!![],'where':_0x5f4706[_0x1391('0x19')]?_0x5f4706[_0x1391('0x19')][_0x1391('0x1a')]||null:null,'attributes':_0x5f4706[_0x1391('0x19')]?_0x5f4706[_0x1391('0x19')][_0x1391('0x1b')]||null:null,'include':_0x5f4706[_0x1391('0x19')]?_0x5f4706[_0x1391('0x19')]['include']?_['map'](_0x5f4706[_0x1391('0x19')]['include'],function(_0x1d566e){return{'model':db[_0x1d566e[_0x1391('0x1f')]],'as':_0x1d566e['as'],'attributes':_0x1d566e[_0x1391('0x1b')],'include':_0x1d566e[_0x1391('0x1d')]?_[_0x1391('0x1e')](_0x1d566e[_0x1391('0x1d')],function(_0x6c2069){return{'model':db[_0x6c2069[_0x1391('0x1f')]],'as':_0x6c2069['as'],'attributes':_0x6c2069['attributes'],'include':_0x6c2069[_0x1391('0x1d')]?_[_0x1391('0x1e')](_0x6c2069[_0x1391('0x1d')],function(_0x2649d4){return{'model':db[_0x2649d4[_0x1391('0x1f')]],'as':_0x2649d4['as'],'attributes':_0x2649d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x1391('0xb')](function(_0x57adef){logger[_0x1391('0xc')]('ShowDeskAccount',_0x5f4706);logger[_0x1391('0xe')](_0x1391('0x20'),_0x5f4706,JSON['stringify'](_0x57adef));_0x14cc7a(_0x57adef);})[_0x1391('0x15')](function(_0x534f18){logger[_0x1391('0x12')](_0x1391('0x20'),_0x534f18[_0x1391('0x13')],_0x5f4706);_0x5904ac(_0x5af4eb[_0x1391('0x12')](0x1f4,_0x534f18[_0x1391('0x13')]));});});}; \ No newline at end of file +var _0x2a8f=['include','map','model','ShowDeskAccount','DeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','findAll','options','raw','where','attributes'];(function(_0x3354b7,_0xd6a99f){var _0x55c80f=function(_0x4aac7c){while(--_0x4aac7c){_0x3354b7['push'](_0x3354b7['shift']());}};_0x55c80f(++_0xd6a99f);}(_0x2a8f,0xb0));var _0xf2a8=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x2a8f[_0x207811];return _0x170d56;};'use strict';var _=require(_0xf2a8('0x0'));var util=require(_0xf2a8('0x1'));var moment=require('moment');var BPromise=require(_0xf2a8('0x2'));var rs=require(_0xf2a8('0x3'));var fs=require('fs');var Redis=require(_0xf2a8('0x4'));var db=require(_0xf2a8('0x5'))['db'];var utils=require(_0xf2a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2a8('0x7'));var jayson=require(_0xf2a8('0x8'));var client=jayson[_0xf2a8('0x9')][_0xf2a8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ca965,_0x2d7dda,_0x28f2a8){return new BPromise(function(_0x59fd2f,_0x45d141){return client['request'](_0x5ca965,_0x28f2a8)[_0xf2a8('0xb')](function(_0x2c1bf1){logger[_0xf2a8('0xc')]('DeskAccount,\x20%s,\x20%s',_0x2d7dda,_0xf2a8('0xd'));logger[_0xf2a8('0xe')](_0xf2a8('0xf'),_0x2d7dda,_0xf2a8('0xd'),JSON[_0xf2a8('0x10')](_0x2c1bf1));if(_0x2c1bf1[_0xf2a8('0x11')]){if(_0x2c1bf1[_0xf2a8('0x11')]['code']===0x1f4){logger['error'](_0xf2a8('0x12'),_0x2d7dda,_0x2c1bf1[_0xf2a8('0x11')]['message']);return _0x45d141(_0x2c1bf1[_0xf2a8('0x11')][_0xf2a8('0x13')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x2d7dda,_0x2c1bf1[_0xf2a8('0x11')][_0xf2a8('0x13')]);return _0x59fd2f(_0x2c1bf1[_0xf2a8('0x11')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x2d7dda,_0xf2a8('0xd'));_0x59fd2f(_0x2c1bf1[_0xf2a8('0x14')][_0xf2a8('0x13')]);}})[_0xf2a8('0x15')](function(_0x4a3359){logger[_0xf2a8('0x11')](_0xf2a8('0x12'),_0x2d7dda,_0x4a3359);_0x45d141(_0x4a3359);});});}exports[_0xf2a8('0x16')]=function(_0x120e8b){var _0x41df5f=this;return new Promise(function(_0x1b4eca,_0x2bd529){return db['DeskAccount'][_0xf2a8('0x17')]({'raw':_0x120e8b[_0xf2a8('0x18')]?_0x120e8b['options'][_0xf2a8('0x19')]===undefined?!![]:![]:!![],'where':_0x120e8b[_0xf2a8('0x18')]?_0x120e8b[_0xf2a8('0x18')][_0xf2a8('0x1a')]||null:null,'attributes':_0x120e8b[_0xf2a8('0x18')]?_0x120e8b['options'][_0xf2a8('0x1b')]||null:null,'limit':_0x120e8b['options']?_0x120e8b[_0xf2a8('0x18')]['limit']||null:null,'include':_0x120e8b[_0xf2a8('0x18')]?_0x120e8b[_0xf2a8('0x18')][_0xf2a8('0x1c')]?_[_0xf2a8('0x1d')](_0x120e8b[_0xf2a8('0x18')][_0xf2a8('0x1c')],function(_0x510da8){return{'model':db[_0x510da8[_0xf2a8('0x1e')]],'as':_0x510da8['as'],'attributes':_0x510da8['attributes'],'include':_0x510da8[_0xf2a8('0x1c')]?_[_0xf2a8('0x1d')](_0x510da8[_0xf2a8('0x1c')],function(_0x1c8414){return{'model':db[_0x1c8414[_0xf2a8('0x1e')]],'as':_0x1c8414['as'],'attributes':_0x1c8414[_0xf2a8('0x1b')],'include':_0x1c8414[_0xf2a8('0x1c')]?_['map'](_0x1c8414[_0xf2a8('0x1c')],function(_0xdff0f8){return{'model':db[_0xdff0f8[_0xf2a8('0x1e')]],'as':_0xdff0f8['as'],'attributes':_0xdff0f8[_0xf2a8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf2a8('0xb')](function(_0x3114ef){logger['info'](_0xf2a8('0x16'),_0x120e8b);logger[_0xf2a8('0xe')](_0xf2a8('0x16'),_0x120e8b,JSON[_0xf2a8('0x10')](_0x3114ef));_0x1b4eca(_0x3114ef);})['catch'](function(_0x2c9e7e){logger['error'](_0xf2a8('0x16'),_0x2c9e7e['message'],_0x120e8b);_0x2bd529(_0x41df5f[_0xf2a8('0x11')](0x1f4,_0x2c9e7e[_0xf2a8('0x13')]));});});};exports[_0xf2a8('0x1f')]=function(_0x2bb5c6){var _0x2c0ce9=this;return new Promise(function(_0x4bea73,_0x1bf430){return db[_0xf2a8('0x20')][_0xf2a8('0x21')]({'raw':_0x2bb5c6[_0xf2a8('0x18')]?_0x2bb5c6[_0xf2a8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2bb5c6[_0xf2a8('0x18')]?_0x2bb5c6[_0xf2a8('0x18')][_0xf2a8('0x1a')]||null:null,'attributes':_0x2bb5c6[_0xf2a8('0x18')]?_0x2bb5c6[_0xf2a8('0x18')][_0xf2a8('0x1b')]||null:null,'include':_0x2bb5c6[_0xf2a8('0x18')]?_0x2bb5c6[_0xf2a8('0x18')]['include']?_[_0xf2a8('0x1d')](_0x2bb5c6[_0xf2a8('0x18')][_0xf2a8('0x1c')],function(_0x11907d){return{'model':db[_0x11907d[_0xf2a8('0x1e')]],'as':_0x11907d['as'],'attributes':_0x11907d['attributes'],'include':_0x11907d[_0xf2a8('0x1c')]?_[_0xf2a8('0x1d')](_0x11907d['include'],function(_0x396683){return{'model':db[_0x396683[_0xf2a8('0x1e')]],'as':_0x396683['as'],'attributes':_0x396683[_0xf2a8('0x1b')],'include':_0x396683['include']?_[_0xf2a8('0x1d')](_0x396683[_0xf2a8('0x1c')],function(_0x28bed0){return{'model':db[_0x28bed0[_0xf2a8('0x1e')]],'as':_0x28bed0['as'],'attributes':_0x28bed0[_0xf2a8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5822e6){logger['info'](_0xf2a8('0x1f'),_0x2bb5c6);logger['debug']('ShowDeskAccount',_0x2bb5c6,JSON[_0xf2a8('0x10')](_0x5822e6));_0x4bea73(_0x5822e6);})[_0xf2a8('0x15')](function(_0x2ebb82){logger[_0xf2a8('0x11')](_0xf2a8('0x1f'),_0x2ebb82[_0xf2a8('0x13')],_0x2bb5c6);_0x1bf430(_0x2c0ce9[_0xf2a8('0x11')](0x1f4,_0x2ebb82[_0xf2a8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 7ddab4f..15aa82a 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 _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(_0x59cda9,_0x47d4c4){var _0x26c18f=function(_0x4cff5f){while(--_0x4cff5f){_0x59cda9['push'](_0x59cda9['shift']());}};_0x26c18f(++_0x47d4c4);}(_0x55ca,0x126));var _0xa55c=function(_0x444127,_0x27d1e9){_0x444127=_0x444127-0x0;var _0x5855c0=_0x55ca[_0x444127];return _0x5855c0;};'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 +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x586dee,_0x39da32){var _0xe02274=function(_0x5639fa){while(--_0x5639fa){_0x586dee['push'](_0x586dee['shift']());}};_0xe02274(++_0x39da32);}(_0x3e74,0x175));var _0x43e7=function(_0x59e1c5,_0xcd9dbf){_0x59e1c5=_0x59e1c5-0x0;var _0x58b3de=_0x3e74[_0x59e1c5];return _0x58b3de;};'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/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f51604e..437eb88 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 _0x3957=['STRING','exports'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3957,0x177));var _0x7395=function(_0x20a278,_0x50c587){_0x20a278=_0x20a278-0x0;var _0x457db=_0x3957[_0x20a278];return _0x457db;};'use strict';var Sequelize=require('sequelize');module[_0x7395('0x0')]={'name':{'type':Sequelize[_0x7395('0x1')]},'description':{'type':Sequelize[_0x7395('0x1')]}}; \ No newline at end of file +var _0xe6b6=['sequelize','STRING'];(function(_0x388fa7,_0x1a4f5d){var _0x558120=function(_0x2fe608){while(--_0x2fe608){_0x388fa7['push'](_0x388fa7['shift']());}};_0x558120(++_0x1a4f5d);}(_0xe6b6,0x102));var _0x6e6b=function(_0x5206a5,_0x498ee3){_0x5206a5=_0x5206a5-0x0;var _0x180e65=_0xe6b6[_0x5206a5];return _0x180e65;};'use strict';var Sequelize=require(_0x6e6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e6b('0x1')]},'description':{'type':Sequelize[_0x6e6b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ff81c5c..0eff1d7 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 _0xcb36=['model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','catch','create','body','params','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','sendStatus','name','DeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x905e7e,_0x4ee055){var _0x23249b=function(_0x373a43){while(--_0x373a43){_0x905e7e['push'](_0x905e7e['shift']());}};_0x23249b(++_0x4ee055);}(_0xcb36,0x1f4));var _0x6cb3=function(_0x59e93d,_0x241259){_0x59e93d=_0x59e93d-0x0;var _0x187610=_0xcb36[_0x59e93d];return _0x187610;};'use strict';var emlformat=require(_0x6cb3('0x0'));var rimraf=require(_0x6cb3('0x1'));var zipdir=require(_0x6cb3('0x2'));var jsonpatch=require(_0x6cb3('0x3'));var rp=require(_0x6cb3('0x4'));var moment=require(_0x6cb3('0x5'));var BPromise=require(_0x6cb3('0x6'));var Mustache=require(_0x6cb3('0x7'));var util=require('util');var path=require('path');var sox=require(_0x6cb3('0x8'));var csv=require(_0x6cb3('0x9'));var ejs=require(_0x6cb3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6cb3('0xb'));var crypto=require(_0x6cb3('0xc'));var jsforce=require(_0x6cb3('0xd'));var deskjs=require(_0x6cb3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6cb3('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cb3('0x10'));var logger=require(_0x6cb3('0x11'))(_0x6cb3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb3('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39794e,_0x1bee55){_0x1bee55=_0x1bee55||0xcc;return function(_0x525196){if(_0x525196){return _0x39794e['sendStatus'](_0x1bee55);}return _0x39794e[_0x6cb3('0x14')](_0x1bee55)[_0x6cb3('0x15')]();};}function respondWithResult(_0xf96cb8,_0x13d881){_0x13d881=_0x13d881||0xc8;return function(_0x2f5185){if(_0x2f5185){return _0xf96cb8['status'](_0x13d881)[_0x6cb3('0x16')](_0x2f5185);}};}function respondWithFilteredResult(_0x36a272,_0x2cc894){return function(_0x494fd2){if(_0x494fd2){var _0x4f314b=typeof _0x2cc894[_0x6cb3('0x17')]===_0x6cb3('0x18')&&typeof _0x2cc894['limit']===_0x6cb3('0x18');var _0x5b3c71=_0x494fd2[_0x6cb3('0x19')];var _0x15a082=_0x4f314b?0x0:_0x2cc894[_0x6cb3('0x17')];var _0x49d0d2=_0x4f314b?_0x494fd2['count']:_0x2cc894[_0x6cb3('0x17')]+_0x2cc894['limit'];var _0x7a3a33;if(_0x49d0d2>=_0x5b3c71){_0x49d0d2=_0x5b3c71;_0x7a3a33=0xc8;}else{_0x7a3a33=0xce;}_0x36a272[_0x6cb3('0x14')](_0x7a3a33);return _0x36a272['set'](_0x6cb3('0x1a'),_0x15a082+'-'+_0x49d0d2+'/'+_0x5b3c71)['json'](_0x494fd2);}return null;};}function patchUpdates(_0x296410){return function(_0xf7a446){try{jsonpatch['apply'](_0xf7a446,_0x296410,!![]);}catch(_0x338f22){return BPromise[_0x6cb3('0x1b')](_0x338f22);}return _0xf7a446[_0x6cb3('0x1c')]();};}function saveUpdates(_0x375466,_0x6b4eb7){return function(_0x468893){if(_0x468893){return _0x468893[_0x6cb3('0x1d')](_0x375466)[_0x6cb3('0x1e')](function(_0x32ae4a){return _0x32ae4a;});}return null;};}function removeEntity(_0x3c3c0c,_0x3354f4){return function(_0x5ea727){if(_0x5ea727){return _0x5ea727[_0x6cb3('0x1f')]()[_0x6cb3('0x1e')](function(){_0x3c3c0c[_0x6cb3('0x14')](0xcc)[_0x6cb3('0x15')]();});}};}function handleEntityNotFound(_0x56f677,_0x36ddc8){return function(_0x23563f){if(!_0x23563f){_0x56f677[_0x6cb3('0x20')](0x194);}return _0x23563f;};}function handleError(_0x520f5d,_0x48a530){_0x48a530=_0x48a530||0x1f4;return function(_0x3f0234){logger['error'](_0x3f0234['stack']);if(_0x3f0234[_0x6cb3('0x21')]){delete _0x3f0234[_0x6cb3('0x21')];}_0x520f5d[_0x6cb3('0x14')](_0x48a530)['send'](_0x3f0234);};}exports['index']=function(_0x4615b5,_0x358941){var _0x45104b={},_0x26268a={},_0x4090ce={'count':0x0,'rows':[]};var _0xda4b65=_['map'](db[_0x6cb3('0x22')][_0x6cb3('0x23')],function(_0x304a43){return{'name':_0x304a43[_0x6cb3('0x24')],'type':_0x304a43[_0x6cb3('0x25')][_0x6cb3('0x26')]};});_0x26268a[_0x6cb3('0x27')]=_[_0x6cb3('0x28')](_0xda4b65,_0x6cb3('0x21'));_0x26268a['query']=_[_0x6cb3('0x29')](_0x4615b5[_0x6cb3('0x2a')]);_0x26268a[_0x6cb3('0x2b')]=_[_0x6cb3('0x2c')](_0x26268a[_0x6cb3('0x27')],_0x26268a['query']);_0x45104b['attributes']=_[_0x6cb3('0x2c')](_0x26268a[_0x6cb3('0x27')],qs[_0x6cb3('0x2d')](_0x4615b5[_0x6cb3('0x2a')][_0x6cb3('0x2d')]));_0x45104b[_0x6cb3('0x2e')]=_0x45104b[_0x6cb3('0x2e')][_0x6cb3('0x2f')]?_0x45104b[_0x6cb3('0x2e')]:_0x26268a['model'];if(!_0x4615b5['query'][_0x6cb3('0x30')](_0x6cb3('0x31'))){_0x45104b[_0x6cb3('0x32')]=qs[_0x6cb3('0x32')](_0x4615b5[_0x6cb3('0x2a')][_0x6cb3('0x32')]);_0x45104b['offset']=qs['offset'](_0x4615b5[_0x6cb3('0x2a')]['offset']);}_0x45104b[_0x6cb3('0x33')]=qs[_0x6cb3('0x34')](_0x4615b5['query']['sort']);_0x45104b[_0x6cb3('0x35')]=qs[_0x6cb3('0x2b')](_[_0x6cb3('0x36')](_0x4615b5[_0x6cb3('0x2a')],_0x26268a[_0x6cb3('0x2b')]),_0xda4b65);if(_0x4615b5[_0x6cb3('0x2a')][_0x6cb3('0x37')]){_0x45104b[_0x6cb3('0x35')]=_[_0x6cb3('0x38')](_0x45104b[_0x6cb3('0x35')],{'$or':_[_0x6cb3('0x28')](_0xda4b65,function(_0x2d4d3e){if(_0x2d4d3e[_0x6cb3('0x25')]!==_0x6cb3('0x39')){var _0x852b8f={};_0x852b8f[_0x2d4d3e['name']]={'$like':'%'+_0x4615b5[_0x6cb3('0x2a')][_0x6cb3('0x37')]+'%'};return _0x852b8f;}})});}_0x45104b=_['merge']({},_0x45104b,_0x4615b5[_0x6cb3('0x3a')]);var _0x1972a3={'where':_0x45104b[_0x6cb3('0x35')]};return db[_0x6cb3('0x22')][_0x6cb3('0x19')](_0x1972a3)[_0x6cb3('0x1e')](function(_0x27a8a5){_0x4090ce[_0x6cb3('0x19')]=_0x27a8a5;if(_0x4615b5['query'][_0x6cb3('0x3b')]){_0x45104b[_0x6cb3('0x3c')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x45104b);})[_0x6cb3('0x1e')](function(_0x307900){_0x4090ce[_0x6cb3('0x3d')]=_0x307900;return _0x4090ce;})['then'](respondWithFilteredResult(_0x358941,_0x45104b))['catch'](handleError(_0x358941,null));};exports[_0x6cb3('0x3e')]=function(_0x4a354b,_0x562a21){var _0x44d8ba={'raw':![],'where':{'id':_0x4a354b['params']['id']}},_0x1b260e={};_0x1b260e[_0x6cb3('0x27')]=_[_0x6cb3('0x29')](db['DeskConfiguration'][_0x6cb3('0x23')]);_0x1b260e[_0x6cb3('0x2a')]=_[_0x6cb3('0x29')](_0x4a354b['query']);_0x1b260e[_0x6cb3('0x2b')]=_[_0x6cb3('0x2c')](_0x1b260e[_0x6cb3('0x27')],_0x1b260e[_0x6cb3('0x2a')]);_0x44d8ba[_0x6cb3('0x2e')]=_[_0x6cb3('0x2c')](_0x1b260e['model'],qs[_0x6cb3('0x2d')](_0x4a354b[_0x6cb3('0x2a')][_0x6cb3('0x2d')]));_0x44d8ba[_0x6cb3('0x2e')]=_0x44d8ba[_0x6cb3('0x2e')]['length']?_0x44d8ba['attributes']:_0x1b260e[_0x6cb3('0x27')];if(_0x4a354b[_0x6cb3('0x2a')][_0x6cb3('0x3b')]){_0x44d8ba[_0x6cb3('0x3c')]=[{'all':!![]}];}_0x44d8ba=_[_0x6cb3('0x38')]({},_0x44d8ba,_0x4a354b[_0x6cb3('0x3a')]);return db['DeskConfiguration'][_0x6cb3('0x3f')](_0x44d8ba)[_0x6cb3('0x1e')](handleEntityNotFound(_0x562a21,null))[_0x6cb3('0x1e')](respondWithResult(_0x562a21,null))[_0x6cb3('0x40')](handleError(_0x562a21,null));};exports[_0x6cb3('0x41')]=function(_0x5ca44e,_0x1193e4){return db[_0x6cb3('0x22')][_0x6cb3('0x41')](_0x5ca44e[_0x6cb3('0x42')],{})[_0x6cb3('0x1e')](respondWithResult(_0x1193e4,0xc9))[_0x6cb3('0x40')](handleError(_0x1193e4,null));};exports[_0x6cb3('0x1d')]=function(_0x26d834,_0x16d42a){if(_0x26d834['body']['id']){delete _0x26d834[_0x6cb3('0x42')]['id'];}return db[_0x6cb3('0x22')][_0x6cb3('0x3f')]({'where':{'id':_0x26d834[_0x6cb3('0x43')]['id']}})[_0x6cb3('0x1e')](handleEntityNotFound(_0x16d42a,null))[_0x6cb3('0x1e')](saveUpdates(_0x26d834[_0x6cb3('0x42')],null))['then'](respondWithResult(_0x16d42a,null))[_0x6cb3('0x40')](handleError(_0x16d42a,null));};exports[_0x6cb3('0x1f')]=function(_0x131e9f,_0x379b3d){return db['DeskConfiguration']['find']({'where':{'id':_0x131e9f[_0x6cb3('0x43')]['id']}})[_0x6cb3('0x1e')](handleEntityNotFound(_0x379b3d,null))[_0x6cb3('0x1e')](removeEntity(_0x379b3d,null))[_0x6cb3('0x40')](handleError(_0x379b3d,null));};exports[_0x6cb3('0x44')]=function(_0x92f5be,_0x33e179,_0x31dbaa){var _0x3b1830={};var _0x112d6c={};var _0x4d2d47;var _0x535b3e;return db[_0x6cb3('0x22')][_0x6cb3('0x45')]({'where':{'id':_0x92f5be[_0x6cb3('0x43')]['id']}})[_0x6cb3('0x1e')](handleEntityNotFound(_0x33e179,null))[_0x6cb3('0x1e')](function(_0x2a7221){if(_0x2a7221){_0x4d2d47=_0x2a7221;_0x112d6c['model']=_[_0x6cb3('0x29')](db['DeskField'][_0x6cb3('0x23')]);_0x112d6c[_0x6cb3('0x2a')]=_[_0x6cb3('0x29')](_0x92f5be[_0x6cb3('0x2a')]);_0x112d6c[_0x6cb3('0x2b')]=_[_0x6cb3('0x2c')](_0x112d6c[_0x6cb3('0x27')],_0x112d6c[_0x6cb3('0x2a')]);_0x3b1830[_0x6cb3('0x2e')]=_[_0x6cb3('0x2c')](_0x112d6c[_0x6cb3('0x27')],qs[_0x6cb3('0x2d')](_0x92f5be['query'][_0x6cb3('0x2d')]));_0x3b1830['attributes']=_0x3b1830['attributes']['length']?_0x3b1830[_0x6cb3('0x2e')]:_0x112d6c[_0x6cb3('0x27')];_0x3b1830[_0x6cb3('0x33')]=qs['sort'](_0x92f5be['query']['sort']);_0x3b1830['where']=qs['filters'](_[_0x6cb3('0x36')](_0x92f5be[_0x6cb3('0x2a')],_0x112d6c[_0x6cb3('0x2b')]));if(_0x92f5be[_0x6cb3('0x2a')][_0x6cb3('0x37')]){_0x3b1830[_0x6cb3('0x35')]=_[_0x6cb3('0x38')](_0x3b1830['where'],{'$or':_['map'](_0x3b1830['attributes'],function(_0x510cea){var _0x49e9f8={};_0x49e9f8[_0x510cea]={'$like':'%'+_0x92f5be['query'][_0x6cb3('0x37')]+'%'};return _0x49e9f8;})});}_0x3b1830=_['merge']({},_0x3b1830,_0x92f5be[_0x6cb3('0x3a')]);return _0x4d2d47[_0x6cb3('0x44')](_0x3b1830);}})[_0x6cb3('0x1e')](function(_0xc44a4){if(_0xc44a4){_0x535b3e=_0xc44a4[_0x6cb3('0x2f')];if(!_0x92f5be[_0x6cb3('0x2a')][_0x6cb3('0x30')]('nolimit')){_0x3b1830[_0x6cb3('0x32')]=qs[_0x6cb3('0x32')](_0x92f5be['query'][_0x6cb3('0x32')]);_0x3b1830[_0x6cb3('0x17')]=qs['offset'](_0x92f5be['query']['offset']);}return _0x4d2d47[_0x6cb3('0x44')](_0x3b1830);}})['then'](function(_0x5e79cf){if(_0x5e79cf){return _0x5e79cf?{'count':_0x535b3e,'rows':_0x5e79cf}:null;}})[_0x6cb3('0x1e')](respondWithResult(_0x33e179,null))[_0x6cb3('0x40')](handleError(_0x33e179,null));};exports['getSubjects']=function(_0x1c70cb,_0x5cc8dc,_0x33828b){var _0x5e333b={};var _0x5c94be={};var _0x32c9c5;var _0x230248;return db[_0x6cb3('0x22')][_0x6cb3('0x45')]({'where':{'id':_0x1c70cb[_0x6cb3('0x43')]['id']}})[_0x6cb3('0x1e')](handleEntityNotFound(_0x5cc8dc,null))[_0x6cb3('0x1e')](function(_0x9f4ed7){if(_0x9f4ed7){_0x32c9c5=_0x9f4ed7;_0x5c94be[_0x6cb3('0x27')]=_[_0x6cb3('0x29')](db[_0x6cb3('0x46')][_0x6cb3('0x23')]);_0x5c94be[_0x6cb3('0x2a')]=_[_0x6cb3('0x29')](_0x1c70cb[_0x6cb3('0x2a')]);_0x5c94be[_0x6cb3('0x2b')]=_[_0x6cb3('0x2c')](_0x5c94be[_0x6cb3('0x27')],_0x5c94be[_0x6cb3('0x2a')]);_0x5e333b[_0x6cb3('0x2e')]=_[_0x6cb3('0x2c')](_0x5c94be['model'],qs[_0x6cb3('0x2d')](_0x1c70cb[_0x6cb3('0x2a')]['fields']));_0x5e333b[_0x6cb3('0x2e')]=_0x5e333b[_0x6cb3('0x2e')][_0x6cb3('0x2f')]?_0x5e333b[_0x6cb3('0x2e')]:_0x5c94be[_0x6cb3('0x27')];_0x5e333b['order']=qs['sort'](_0x1c70cb[_0x6cb3('0x2a')][_0x6cb3('0x34')]);_0x5e333b['where']=qs[_0x6cb3('0x2b')](_[_0x6cb3('0x36')](_0x1c70cb['query'],_0x5c94be[_0x6cb3('0x2b')]));if(_0x1c70cb[_0x6cb3('0x2a')][_0x6cb3('0x37')]){_0x5e333b[_0x6cb3('0x35')]=_[_0x6cb3('0x38')](_0x5e333b['where'],{'$or':_['map'](_0x5e333b[_0x6cb3('0x2e')],function(_0x314269){var _0x164127={};_0x164127[_0x314269]={'$like':'%'+_0x1c70cb[_0x6cb3('0x2a')]['filter']+'%'};return _0x164127;})});}_0x5e333b=_['merge']({},_0x5e333b,_0x1c70cb[_0x6cb3('0x3a')]);return _0x32c9c5[_0x6cb3('0x47')](_0x5e333b);}})[_0x6cb3('0x1e')](function(_0x562b9c){if(_0x562b9c){_0x230248=_0x562b9c[_0x6cb3('0x2f')];if(!_0x1c70cb[_0x6cb3('0x2a')]['hasOwnProperty'](_0x6cb3('0x31'))){_0x5e333b[_0x6cb3('0x32')]=qs['limit'](_0x1c70cb['query'][_0x6cb3('0x32')]);_0x5e333b['offset']=qs[_0x6cb3('0x17')](_0x1c70cb[_0x6cb3('0x2a')][_0x6cb3('0x17')]);}return _0x32c9c5['getSubjects'](_0x5e333b);}})[_0x6cb3('0x1e')](function(_0x11ec58){if(_0x11ec58){return _0x11ec58?{'count':_0x230248,'rows':_0x11ec58}:null;}})['then'](respondWithResult(_0x5cc8dc,null))[_0x6cb3('0x40')](handleError(_0x5cc8dc,null));};exports[_0x6cb3('0x48')]=function(_0x11cdee,_0x309ac4,_0x4d8670){var _0xe62f74={};var _0x314172={};var _0x1c9a58;var _0x26b110;return db[_0x6cb3('0x22')][_0x6cb3('0x45')]({'where':{'id':_0x11cdee[_0x6cb3('0x43')]['id']}})['then'](handleEntityNotFound(_0x309ac4,null))['then'](function(_0x16c152){if(_0x16c152){_0x1c9a58=_0x16c152;_0x314172[_0x6cb3('0x27')]=_[_0x6cb3('0x29')](db[_0x6cb3('0x46')]['rawAttributes']);_0x314172[_0x6cb3('0x2a')]=_[_0x6cb3('0x29')](_0x11cdee[_0x6cb3('0x2a')]);_0x314172[_0x6cb3('0x2b')]=_[_0x6cb3('0x2c')](_0x314172[_0x6cb3('0x27')],_0x314172[_0x6cb3('0x2a')]);_0xe62f74[_0x6cb3('0x2e')]=_[_0x6cb3('0x2c')](_0x314172[_0x6cb3('0x27')],qs[_0x6cb3('0x2d')](_0x11cdee[_0x6cb3('0x2a')]['fields']));_0xe62f74['attributes']=_0xe62f74[_0x6cb3('0x2e')][_0x6cb3('0x2f')]?_0xe62f74[_0x6cb3('0x2e')]:_0x314172[_0x6cb3('0x27')];_0xe62f74[_0x6cb3('0x33')]=qs[_0x6cb3('0x34')](_0x11cdee[_0x6cb3('0x2a')][_0x6cb3('0x34')]);_0xe62f74[_0x6cb3('0x35')]=qs[_0x6cb3('0x2b')](_[_0x6cb3('0x36')](_0x11cdee['query'],_0x314172['filters']));if(_0x11cdee[_0x6cb3('0x2a')][_0x6cb3('0x37')]){_0xe62f74['where']=_[_0x6cb3('0x38')](_0xe62f74[_0x6cb3('0x35')],{'$or':_['map'](_0xe62f74[_0x6cb3('0x2e')],function(_0x39bddc){var _0x3898bc={};_0x3898bc[_0x39bddc]={'$like':'%'+_0x11cdee[_0x6cb3('0x2a')][_0x6cb3('0x37')]+'%'};return _0x3898bc;})});}_0xe62f74=_[_0x6cb3('0x38')]({},_0xe62f74,_0x11cdee['options']);return _0x1c9a58[_0x6cb3('0x48')](_0xe62f74);}})[_0x6cb3('0x1e')](function(_0x192687){if(_0x192687){_0x26b110=_0x192687[_0x6cb3('0x2f')];if(!_0x11cdee['query']['hasOwnProperty'](_0x6cb3('0x31'))){_0xe62f74[_0x6cb3('0x32')]=qs['limit'](_0x11cdee[_0x6cb3('0x2a')][_0x6cb3('0x32')]);_0xe62f74[_0x6cb3('0x17')]=qs[_0x6cb3('0x17')](_0x11cdee['query'][_0x6cb3('0x17')]);}return _0x1c9a58[_0x6cb3('0x48')](_0xe62f74);}})[_0x6cb3('0x1e')](function(_0x4c5130){if(_0x4c5130){return _0x4c5130?{'count':_0x26b110,'rows':_0x4c5130}:null;}})[_0x6cb3('0x1e')](respondWithResult(_0x309ac4,null))['catch'](handleError(_0x309ac4,null));};exports[_0x6cb3('0x49')]=function(_0x423529,_0xda0631,_0x44edb6){var _0x555ab4={};var _0x47c9f6={};var _0x40de1a;var _0x5247fb;return db[_0x6cb3('0x22')][_0x6cb3('0x45')]({'where':{'id':_0x423529[_0x6cb3('0x43')]['id']}})['then'](handleEntityNotFound(_0xda0631,null))[_0x6cb3('0x1e')](function(_0x21e574){if(_0x21e574){_0x40de1a=_0x21e574;_0x47c9f6['model']=_[_0x6cb3('0x29')](db[_0x6cb3('0x4a')][_0x6cb3('0x23')]);_0x47c9f6['query']=_['keys'](_0x423529[_0x6cb3('0x2a')]);_0x47c9f6['filters']=_[_0x6cb3('0x2c')](_0x47c9f6['model'],_0x47c9f6[_0x6cb3('0x2a')]);_0x555ab4['attributes']=_['intersection'](_0x47c9f6[_0x6cb3('0x27')],qs['fields'](_0x423529['query'][_0x6cb3('0x2d')]));_0x555ab4[_0x6cb3('0x2e')]=_0x555ab4[_0x6cb3('0x2e')]['length']?_0x555ab4['attributes']:_0x47c9f6[_0x6cb3('0x27')];_0x555ab4[_0x6cb3('0x33')]=qs[_0x6cb3('0x34')](_0x423529[_0x6cb3('0x2a')][_0x6cb3('0x34')]);_0x555ab4['where']=qs[_0x6cb3('0x2b')](_[_0x6cb3('0x36')](_0x423529[_0x6cb3('0x2a')],_0x47c9f6['filters']));if(_0x423529[_0x6cb3('0x2a')]['filter']){_0x555ab4[_0x6cb3('0x35')]=_[_0x6cb3('0x38')](_0x555ab4[_0x6cb3('0x35')],{'$or':_[_0x6cb3('0x28')](_0x555ab4[_0x6cb3('0x2e')],function(_0x23dd4c){var _0x2a1d07={};_0x2a1d07[_0x23dd4c]={'$like':'%'+_0x423529['query'][_0x6cb3('0x37')]+'%'};return _0x2a1d07;})});}_0x555ab4=_[_0x6cb3('0x38')]({},_0x555ab4,_0x423529[_0x6cb3('0x3a')]);return _0x40de1a['getTags'](_0x555ab4);}})[_0x6cb3('0x1e')](function(_0x33de85){if(_0x33de85){_0x5247fb=_0x33de85[_0x6cb3('0x2f')];if(!_0x423529[_0x6cb3('0x2a')][_0x6cb3('0x30')](_0x6cb3('0x31'))){_0x555ab4[_0x6cb3('0x32')]=qs[_0x6cb3('0x32')](_0x423529[_0x6cb3('0x2a')]['limit']);_0x555ab4[_0x6cb3('0x17')]=qs[_0x6cb3('0x17')](_0x423529[_0x6cb3('0x2a')]['offset']);}return _0x40de1a[_0x6cb3('0x49')](_0x555ab4);}})[_0x6cb3('0x1e')](function(_0x2bd88d){if(_0x2bd88d){return _0x2bd88d?{'count':_0x5247fb,'rows':_0x2bd88d}:null;}})[_0x6cb3('0x1e')](respondWithResult(_0xda0631,null))[_0x6cb3('0x40')](handleError(_0xda0631,null));};exports['setTags']=function(_0x17f8af,_0x4ade44,_0x196fba){if(_0x17f8af[_0x6cb3('0x42')]['id']){delete _0x17f8af[_0x6cb3('0x42')]['id'];}return db['DeskConfiguration'][_0x6cb3('0x45')]({'where':{'id':_0x17f8af[_0x6cb3('0x43')]['id']}})[_0x6cb3('0x1e')](handleEntityNotFound(_0x4ade44,null))['then'](function(_0x4ccf5c){if(_0x4ccf5c){return _0x4ccf5c[_0x6cb3('0x4b')](_0x17f8af[_0x6cb3('0x42')][_0x6cb3('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x4ade44,null))[_0x6cb3('0x40')](handleError(_0x4ade44,null));}; \ No newline at end of file +var _0x1f2f=['then','destroy','sendStatus','error','name','send','index','map','DeskConfiguration','fieldName','type','key','keys','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','update','body','find','params','getFields','findOne','order','getSubjects','DeskField','getDescriptions','getTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x547b19,_0x50630a){var _0x475770=function(_0x8f5c0d){while(--_0x8f5c0d){_0x547b19['push'](_0x547b19['shift']());}};_0x475770(++_0x50630a);}(_0x1f2f,0xd1));var _0xf1f2=function(_0x2fb28c,_0x458fc5){_0x2fb28c=_0x2fb28c-0x0;var _0x22ee82=_0x1f2f[_0x2fb28c];return _0x22ee82;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf1f2('0x0'));var rp=require(_0xf1f2('0x1'));var moment=require(_0xf1f2('0x2'));var BPromise=require(_0xf1f2('0x3'));var Mustache=require(_0xf1f2('0x4'));var util=require(_0xf1f2('0x5'));var path=require(_0xf1f2('0x6'));var sox=require('sox');var csv=require(_0xf1f2('0x7'));var ejs=require(_0xf1f2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf1f2('0x9'));var crypto=require(_0xf1f2('0xa'));var jsforce=require(_0xf1f2('0xb'));var deskjs=require(_0xf1f2('0xc'));var toCsv=require(_0xf1f2('0x7'));var querystring=require(_0xf1f2('0xd'));var Papa=require(_0xf1f2('0xe'));var Redis=require(_0xf1f2('0xf'));var authService=require(_0xf1f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf1f2('0x11'));var hardwareService=require(_0xf1f2('0x12'));var logger=require(_0xf1f2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf1f2('0x14'));var licenseUtil=require(_0xf1f2('0x15'));var db=require(_0xf1f2('0x16'))['db'];function respondWithStatusCode(_0x2393a3,_0x72342d){_0x72342d=_0x72342d||0xcc;return function(_0x5bac7c){if(_0x5bac7c){return _0x2393a3['sendStatus'](_0x72342d);}return _0x2393a3[_0xf1f2('0x17')](_0x72342d)[_0xf1f2('0x18')]();};}function respondWithResult(_0x4beeb8,_0x395cf5){_0x395cf5=_0x395cf5||0xc8;return function(_0x19960c){if(_0x19960c){return _0x4beeb8[_0xf1f2('0x17')](_0x395cf5)[_0xf1f2('0x19')](_0x19960c);}};}function respondWithFilteredResult(_0x5efe30,_0x1b956f){return function(_0xec4691){if(_0xec4691){var _0x7562df=typeof _0x1b956f[_0xf1f2('0x1a')]===_0xf1f2('0x1b')&&typeof _0x1b956f[_0xf1f2('0x1c')]===_0xf1f2('0x1b');var _0x115ac3=_0xec4691[_0xf1f2('0x1d')];var _0x43c35b=_0x7562df?0x0:_0x1b956f[_0xf1f2('0x1a')];var _0x57d585=_0x7562df?_0xec4691[_0xf1f2('0x1d')]:_0x1b956f[_0xf1f2('0x1a')]+_0x1b956f[_0xf1f2('0x1c')];var _0x4939d0;if(_0x57d585>=_0x115ac3){_0x57d585=_0x115ac3;_0x4939d0=0xc8;}else{_0x4939d0=0xce;}_0x5efe30[_0xf1f2('0x17')](_0x4939d0);return _0x5efe30[_0xf1f2('0x1e')](_0xf1f2('0x1f'),_0x43c35b+'-'+_0x57d585+'/'+_0x115ac3)['json'](_0xec4691);}return null;};}function patchUpdates(_0x5a8f62){return function(_0x10e5a3){try{jsonpatch[_0xf1f2('0x20')](_0x10e5a3,_0x5a8f62,!![]);}catch(_0x29044f){return BPromise[_0xf1f2('0x21')](_0x29044f);}return _0x10e5a3['save']();};}function saveUpdates(_0x156142,_0x598097){return function(_0x1edc7d){if(_0x1edc7d){return _0x1edc7d['update'](_0x156142)[_0xf1f2('0x22')](function(_0x448808){return _0x448808;});}return null;};}function removeEntity(_0x4142cf,_0xa7753e){return function(_0x5652be){if(_0x5652be){return _0x5652be[_0xf1f2('0x23')]()[_0xf1f2('0x22')](function(){_0x4142cf[_0xf1f2('0x17')](0xcc)[_0xf1f2('0x18')]();});}};}function handleEntityNotFound(_0x5afbf0,_0x1a1735){return function(_0x2cdfe8){if(!_0x2cdfe8){_0x5afbf0[_0xf1f2('0x24')](0x194);}return _0x2cdfe8;};}function handleError(_0x2baed4,_0x3383fb){_0x3383fb=_0x3383fb||0x1f4;return function(_0x4bd665){logger[_0xf1f2('0x25')](_0x4bd665['stack']);if(_0x4bd665[_0xf1f2('0x26')]){delete _0x4bd665[_0xf1f2('0x26')];}_0x2baed4['status'](_0x3383fb)[_0xf1f2('0x27')](_0x4bd665);};}exports[_0xf1f2('0x28')]=function(_0x2e3788,_0x5b3c77){var _0x38d77a={},_0x1a44c6={},_0x4d2008={'count':0x0,'rows':[]};var _0x480ba1=_[_0xf1f2('0x29')](db[_0xf1f2('0x2a')]['rawAttributes'],function(_0x48b4ab){return{'name':_0x48b4ab[_0xf1f2('0x2b')],'type':_0x48b4ab[_0xf1f2('0x2c')][_0xf1f2('0x2d')]};});_0x1a44c6['model']=_[_0xf1f2('0x29')](_0x480ba1,_0xf1f2('0x26'));_0x1a44c6['query']=_[_0xf1f2('0x2e')](_0x2e3788['query']);_0x1a44c6['filters']=_[_0xf1f2('0x2f')](_0x1a44c6[_0xf1f2('0x30')],_0x1a44c6['query']);_0x38d77a[_0xf1f2('0x31')]=_['intersection'](_0x1a44c6[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x2e3788[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0x38d77a[_0xf1f2('0x31')]=_0x38d77a[_0xf1f2('0x31')][_0xf1f2('0x34')]?_0x38d77a['attributes']:_0x1a44c6['model'];if(!_0x2e3788[_0xf1f2('0x33')][_0xf1f2('0x35')](_0xf1f2('0x36'))){_0x38d77a[_0xf1f2('0x1c')]=qs['limit'](_0x2e3788[_0xf1f2('0x33')][_0xf1f2('0x1c')]);_0x38d77a[_0xf1f2('0x1a')]=qs[_0xf1f2('0x1a')](_0x2e3788['query'][_0xf1f2('0x1a')]);}_0x38d77a['order']=qs[_0xf1f2('0x37')](_0x2e3788[_0xf1f2('0x33')]['sort']);_0x38d77a[_0xf1f2('0x38')]=qs['filters'](_[_0xf1f2('0x39')](_0x2e3788['query'],_0x1a44c6[_0xf1f2('0x3a')]),_0x480ba1);if(_0x2e3788[_0xf1f2('0x33')][_0xf1f2('0x3b')]){_0x38d77a[_0xf1f2('0x38')]=_[_0xf1f2('0x3c')](_0x38d77a['where'],{'$or':_[_0xf1f2('0x29')](_0x480ba1,function(_0x24e635){if(_0x24e635[_0xf1f2('0x2c')]!==_0xf1f2('0x3d')){var _0x5cc3e0={};_0x5cc3e0[_0x24e635['name']]={'$like':'%'+_0x2e3788['query'][_0xf1f2('0x3b')]+'%'};return _0x5cc3e0;}})});}_0x38d77a=_[_0xf1f2('0x3c')]({},_0x38d77a,_0x2e3788[_0xf1f2('0x3e')]);var _0x4014a4={'where':_0x38d77a[_0xf1f2('0x38')]};return db[_0xf1f2('0x2a')][_0xf1f2('0x1d')](_0x4014a4)[_0xf1f2('0x22')](function(_0x15ab0b){_0x4d2008[_0xf1f2('0x1d')]=_0x15ab0b;if(_0x2e3788[_0xf1f2('0x33')][_0xf1f2('0x3f')]){_0x38d77a[_0xf1f2('0x40')]=[{'all':!![]}];}return db[_0xf1f2('0x2a')][_0xf1f2('0x41')](_0x38d77a);})[_0xf1f2('0x22')](function(_0x556ba7){_0x4d2008[_0xf1f2('0x42')]=_0x556ba7;return _0x4d2008;})[_0xf1f2('0x22')](respondWithFilteredResult(_0x5b3c77,_0x38d77a))[_0xf1f2('0x43')](handleError(_0x5b3c77,null));};exports['show']=function(_0x4004bf,_0x33e24f){var _0x8352f3={'raw':![],'where':{'id':_0x4004bf['params']['id']}},_0x57bc61={};_0x57bc61['model']=_[_0xf1f2('0x2e')](db['DeskConfiguration'][_0xf1f2('0x44')]);_0x57bc61[_0xf1f2('0x33')]=_[_0xf1f2('0x2e')](_0x4004bf[_0xf1f2('0x33')]);_0x57bc61['filters']=_[_0xf1f2('0x2f')](_0x57bc61[_0xf1f2('0x30')],_0x57bc61[_0xf1f2('0x33')]);_0x8352f3['attributes']=_[_0xf1f2('0x2f')](_0x57bc61[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x4004bf[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0x8352f3[_0xf1f2('0x31')]=_0x8352f3[_0xf1f2('0x31')][_0xf1f2('0x34')]?_0x8352f3[_0xf1f2('0x31')]:_0x57bc61[_0xf1f2('0x30')];if(_0x4004bf['query'][_0xf1f2('0x3f')]){_0x8352f3[_0xf1f2('0x40')]=[{'all':!![]}];}_0x8352f3=_[_0xf1f2('0x3c')]({},_0x8352f3,_0x4004bf[_0xf1f2('0x3e')]);return db['DeskConfiguration']['find'](_0x8352f3)[_0xf1f2('0x22')](handleEntityNotFound(_0x33e24f,null))[_0xf1f2('0x22')](respondWithResult(_0x33e24f,null))['catch'](handleError(_0x33e24f,null));};exports[_0xf1f2('0x45')]=function(_0x5aeb56,_0x321997){return db[_0xf1f2('0x2a')][_0xf1f2('0x45')](_0x5aeb56['body'],{})[_0xf1f2('0x22')](respondWithResult(_0x321997,0xc9))[_0xf1f2('0x43')](handleError(_0x321997,null));};exports[_0xf1f2('0x46')]=function(_0x55bc77,_0xed6e22){if(_0x55bc77[_0xf1f2('0x47')]['id']){delete _0x55bc77['body']['id'];}return db[_0xf1f2('0x2a')][_0xf1f2('0x48')]({'where':{'id':_0x55bc77['params']['id']}})['then'](handleEntityNotFound(_0xed6e22,null))[_0xf1f2('0x22')](saveUpdates(_0x55bc77['body'],null))['then'](respondWithResult(_0xed6e22,null))['catch'](handleError(_0xed6e22,null));};exports['destroy']=function(_0x4f535c,_0x58bfd7){return db['DeskConfiguration']['find']({'where':{'id':_0x4f535c[_0xf1f2('0x49')]['id']}})[_0xf1f2('0x22')](handleEntityNotFound(_0x58bfd7,null))['then'](removeEntity(_0x58bfd7,null))[_0xf1f2('0x43')](handleError(_0x58bfd7,null));};exports[_0xf1f2('0x4a')]=function(_0x89cb3b,_0x32ed53,_0x5ba520){var _0x5e3719={};var _0xf06ee4={};var _0x10944d;var _0x442c84;return db['DeskConfiguration'][_0xf1f2('0x4b')]({'where':{'id':_0x89cb3b[_0xf1f2('0x49')]['id']}})[_0xf1f2('0x22')](handleEntityNotFound(_0x32ed53,null))[_0xf1f2('0x22')](function(_0x4ddc12){if(_0x4ddc12){_0x10944d=_0x4ddc12;_0xf06ee4[_0xf1f2('0x30')]=_[_0xf1f2('0x2e')](db['DeskField'][_0xf1f2('0x44')]);_0xf06ee4['query']=_['keys'](_0x89cb3b[_0xf1f2('0x33')]);_0xf06ee4[_0xf1f2('0x3a')]=_[_0xf1f2('0x2f')](_0xf06ee4[_0xf1f2('0x30')],_0xf06ee4[_0xf1f2('0x33')]);_0x5e3719[_0xf1f2('0x31')]=_[_0xf1f2('0x2f')](_0xf06ee4[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0x5e3719[_0xf1f2('0x31')]=_0x5e3719[_0xf1f2('0x31')][_0xf1f2('0x34')]?_0x5e3719[_0xf1f2('0x31')]:_0xf06ee4['model'];_0x5e3719[_0xf1f2('0x4c')]=qs[_0xf1f2('0x37')](_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x37')]);_0x5e3719[_0xf1f2('0x38')]=qs[_0xf1f2('0x3a')](_[_0xf1f2('0x39')](_0x89cb3b[_0xf1f2('0x33')],_0xf06ee4['filters']));if(_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x3b')]){_0x5e3719[_0xf1f2('0x38')]=_[_0xf1f2('0x3c')](_0x5e3719[_0xf1f2('0x38')],{'$or':_[_0xf1f2('0x29')](_0x5e3719[_0xf1f2('0x31')],function(_0x229ddb){var _0x3fd99f={};_0x3fd99f[_0x229ddb]={'$like':'%'+_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x3b')]+'%'};return _0x3fd99f;})});}_0x5e3719=_[_0xf1f2('0x3c')]({},_0x5e3719,_0x89cb3b[_0xf1f2('0x3e')]);return _0x10944d[_0xf1f2('0x4a')](_0x5e3719);}})['then'](function(_0xafe938){if(_0xafe938){_0x442c84=_0xafe938[_0xf1f2('0x34')];if(!_0x89cb3b[_0xf1f2('0x33')]['hasOwnProperty'](_0xf1f2('0x36'))){_0x5e3719[_0xf1f2('0x1c')]=qs[_0xf1f2('0x1c')](_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x1c')]);_0x5e3719[_0xf1f2('0x1a')]=qs[_0xf1f2('0x1a')](_0x89cb3b[_0xf1f2('0x33')][_0xf1f2('0x1a')]);}return _0x10944d[_0xf1f2('0x4a')](_0x5e3719);}})[_0xf1f2('0x22')](function(_0x281699){if(_0x281699){return _0x281699?{'count':_0x442c84,'rows':_0x281699}:null;}})[_0xf1f2('0x22')](respondWithResult(_0x32ed53,null))['catch'](handleError(_0x32ed53,null));};exports[_0xf1f2('0x4d')]=function(_0x2d7527,_0x54294b,_0x5ef9f7){var _0xc12c4a={};var _0x4333f1={};var _0x91a4ca;var _0x3a333a;return db[_0xf1f2('0x2a')][_0xf1f2('0x4b')]({'where':{'id':_0x2d7527['params']['id']}})['then'](handleEntityNotFound(_0x54294b,null))['then'](function(_0x2857aa){if(_0x2857aa){_0x91a4ca=_0x2857aa;_0x4333f1[_0xf1f2('0x30')]=_[_0xf1f2('0x2e')](db[_0xf1f2('0x4e')][_0xf1f2('0x44')]);_0x4333f1[_0xf1f2('0x33')]=_[_0xf1f2('0x2e')](_0x2d7527['query']);_0x4333f1[_0xf1f2('0x3a')]=_[_0xf1f2('0x2f')](_0x4333f1[_0xf1f2('0x30')],_0x4333f1[_0xf1f2('0x33')]);_0xc12c4a[_0xf1f2('0x31')]=_[_0xf1f2('0x2f')](_0x4333f1[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x2d7527[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0xc12c4a[_0xf1f2('0x31')]=_0xc12c4a[_0xf1f2('0x31')][_0xf1f2('0x34')]?_0xc12c4a[_0xf1f2('0x31')]:_0x4333f1['model'];_0xc12c4a['order']=qs[_0xf1f2('0x37')](_0x2d7527[_0xf1f2('0x33')][_0xf1f2('0x37')]);_0xc12c4a['where']=qs['filters'](_[_0xf1f2('0x39')](_0x2d7527['query'],_0x4333f1[_0xf1f2('0x3a')]));if(_0x2d7527[_0xf1f2('0x33')][_0xf1f2('0x3b')]){_0xc12c4a['where']=_[_0xf1f2('0x3c')](_0xc12c4a['where'],{'$or':_['map'](_0xc12c4a['attributes'],function(_0x30d7b5){var _0x15f99b={};_0x15f99b[_0x30d7b5]={'$like':'%'+_0x2d7527[_0xf1f2('0x33')][_0xf1f2('0x3b')]+'%'};return _0x15f99b;})});}_0xc12c4a=_[_0xf1f2('0x3c')]({},_0xc12c4a,_0x2d7527[_0xf1f2('0x3e')]);return _0x91a4ca[_0xf1f2('0x4d')](_0xc12c4a);}})[_0xf1f2('0x22')](function(_0x325daf){if(_0x325daf){_0x3a333a=_0x325daf[_0xf1f2('0x34')];if(!_0x2d7527[_0xf1f2('0x33')][_0xf1f2('0x35')](_0xf1f2('0x36'))){_0xc12c4a[_0xf1f2('0x1c')]=qs[_0xf1f2('0x1c')](_0x2d7527[_0xf1f2('0x33')]['limit']);_0xc12c4a['offset']=qs[_0xf1f2('0x1a')](_0x2d7527['query'][_0xf1f2('0x1a')]);}return _0x91a4ca[_0xf1f2('0x4d')](_0xc12c4a);}})['then'](function(_0x319e4f){if(_0x319e4f){return _0x319e4f?{'count':_0x3a333a,'rows':_0x319e4f}:null;}})[_0xf1f2('0x22')](respondWithResult(_0x54294b,null))[_0xf1f2('0x43')](handleError(_0x54294b,null));};exports[_0xf1f2('0x4f')]=function(_0x5a7f36,_0x28591d,_0xd47278){var _0x4b8fba={};var _0x33408d={};var _0x11ab5c;var _0x4f2e6d;return db[_0xf1f2('0x2a')][_0xf1f2('0x4b')]({'where':{'id':_0x5a7f36[_0xf1f2('0x49')]['id']}})[_0xf1f2('0x22')](handleEntityNotFound(_0x28591d,null))[_0xf1f2('0x22')](function(_0x99e470){if(_0x99e470){_0x11ab5c=_0x99e470;_0x33408d[_0xf1f2('0x30')]=_[_0xf1f2('0x2e')](db[_0xf1f2('0x4e')][_0xf1f2('0x44')]);_0x33408d[_0xf1f2('0x33')]=_[_0xf1f2('0x2e')](_0x5a7f36['query']);_0x33408d[_0xf1f2('0x3a')]=_[_0xf1f2('0x2f')](_0x33408d[_0xf1f2('0x30')],_0x33408d[_0xf1f2('0x33')]);_0x4b8fba[_0xf1f2('0x31')]=_[_0xf1f2('0x2f')](_0x33408d[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x5a7f36[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0x4b8fba[_0xf1f2('0x31')]=_0x4b8fba[_0xf1f2('0x31')]['length']?_0x4b8fba[_0xf1f2('0x31')]:_0x33408d[_0xf1f2('0x30')];_0x4b8fba[_0xf1f2('0x4c')]=qs[_0xf1f2('0x37')](_0x5a7f36[_0xf1f2('0x33')][_0xf1f2('0x37')]);_0x4b8fba[_0xf1f2('0x38')]=qs[_0xf1f2('0x3a')](_[_0xf1f2('0x39')](_0x5a7f36[_0xf1f2('0x33')],_0x33408d[_0xf1f2('0x3a')]));if(_0x5a7f36[_0xf1f2('0x33')]['filter']){_0x4b8fba[_0xf1f2('0x38')]=_[_0xf1f2('0x3c')](_0x4b8fba[_0xf1f2('0x38')],{'$or':_[_0xf1f2('0x29')](_0x4b8fba[_0xf1f2('0x31')],function(_0x4305a2){var _0x308a36={};_0x308a36[_0x4305a2]={'$like':'%'+_0x5a7f36[_0xf1f2('0x33')][_0xf1f2('0x3b')]+'%'};return _0x308a36;})});}_0x4b8fba=_[_0xf1f2('0x3c')]({},_0x4b8fba,_0x5a7f36[_0xf1f2('0x3e')]);return _0x11ab5c[_0xf1f2('0x4f')](_0x4b8fba);}})[_0xf1f2('0x22')](function(_0x2cedd9){if(_0x2cedd9){_0x4f2e6d=_0x2cedd9['length'];if(!_0x5a7f36[_0xf1f2('0x33')][_0xf1f2('0x35')](_0xf1f2('0x36'))){_0x4b8fba[_0xf1f2('0x1c')]=qs[_0xf1f2('0x1c')](_0x5a7f36[_0xf1f2('0x33')][_0xf1f2('0x1c')]);_0x4b8fba[_0xf1f2('0x1a')]=qs[_0xf1f2('0x1a')](_0x5a7f36['query']['offset']);}return _0x11ab5c[_0xf1f2('0x4f')](_0x4b8fba);}})['then'](function(_0x264f08){if(_0x264f08){return _0x264f08?{'count':_0x4f2e6d,'rows':_0x264f08}:null;}})[_0xf1f2('0x22')](respondWithResult(_0x28591d,null))[_0xf1f2('0x43')](handleError(_0x28591d,null));};exports[_0xf1f2('0x50')]=function(_0x57e6ea,_0x365681,_0x54cbce){var _0x482668={};var _0x33ca5a={};var _0x4c7eb3;var _0x4056de;return db[_0xf1f2('0x2a')][_0xf1f2('0x4b')]({'where':{'id':_0x57e6ea[_0xf1f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x365681,null))[_0xf1f2('0x22')](function(_0x7bacae){if(_0x7bacae){_0x4c7eb3=_0x7bacae;_0x33ca5a[_0xf1f2('0x30')]=_[_0xf1f2('0x2e')](db['Tag'][_0xf1f2('0x44')]);_0x33ca5a[_0xf1f2('0x33')]=_['keys'](_0x57e6ea['query']);_0x33ca5a['filters']=_[_0xf1f2('0x2f')](_0x33ca5a[_0xf1f2('0x30')],_0x33ca5a['query']);_0x482668['attributes']=_['intersection'](_0x33ca5a[_0xf1f2('0x30')],qs[_0xf1f2('0x32')](_0x57e6ea[_0xf1f2('0x33')][_0xf1f2('0x32')]));_0x482668[_0xf1f2('0x31')]=_0x482668[_0xf1f2('0x31')][_0xf1f2('0x34')]?_0x482668[_0xf1f2('0x31')]:_0x33ca5a[_0xf1f2('0x30')];_0x482668[_0xf1f2('0x4c')]=qs[_0xf1f2('0x37')](_0x57e6ea[_0xf1f2('0x33')]['sort']);_0x482668[_0xf1f2('0x38')]=qs[_0xf1f2('0x3a')](_[_0xf1f2('0x39')](_0x57e6ea['query'],_0x33ca5a[_0xf1f2('0x3a')]));if(_0x57e6ea[_0xf1f2('0x33')][_0xf1f2('0x3b')]){_0x482668[_0xf1f2('0x38')]=_[_0xf1f2('0x3c')](_0x482668[_0xf1f2('0x38')],{'$or':_[_0xf1f2('0x29')](_0x482668[_0xf1f2('0x31')],function(_0x1eceee){var _0x834ab4={};_0x834ab4[_0x1eceee]={'$like':'%'+_0x57e6ea[_0xf1f2('0x33')]['filter']+'%'};return _0x834ab4;})});}_0x482668=_[_0xf1f2('0x3c')]({},_0x482668,_0x57e6ea[_0xf1f2('0x3e')]);return _0x4c7eb3[_0xf1f2('0x50')](_0x482668);}})['then'](function(_0x413105){if(_0x413105){_0x4056de=_0x413105[_0xf1f2('0x34')];if(!_0x57e6ea[_0xf1f2('0x33')]['hasOwnProperty'](_0xf1f2('0x36'))){_0x482668[_0xf1f2('0x1c')]=qs[_0xf1f2('0x1c')](_0x57e6ea[_0xf1f2('0x33')][_0xf1f2('0x1c')]);_0x482668[_0xf1f2('0x1a')]=qs[_0xf1f2('0x1a')](_0x57e6ea[_0xf1f2('0x33')]['offset']);}return _0x4c7eb3[_0xf1f2('0x50')](_0x482668);}})[_0xf1f2('0x22')](function(_0x3cfc2c){if(_0x3cfc2c){return _0x3cfc2c?{'count':_0x4056de,'rows':_0x3cfc2c}:null;}})[_0xf1f2('0x22')](respondWithResult(_0x365681,null))[_0xf1f2('0x43')](handleError(_0x365681,null));};exports['setTags']=function(_0x5e0d03,_0x5137ee,_0x59e00e){if(_0x5e0d03[_0xf1f2('0x47')]['id']){delete _0x5e0d03[_0xf1f2('0x47')]['id'];}return db[_0xf1f2('0x2a')][_0xf1f2('0x4b')]({'where':{'id':_0x5e0d03[_0xf1f2('0x49')]['id']}})[_0xf1f2('0x22')](handleEntityNotFound(_0x5137ee,null))[_0xf1f2('0x22')](function(_0x45b6ef){if(_0x45b6ef){return _0x45b6ef['setTags'](_0x5e0d03[_0xf1f2('0x47')]['ids']||[]);}return null;})[_0xf1f2('0x22')](respondWithResult(_0x5137ee,null))[_0xf1f2('0x43')](handleError(_0x5137ee,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index af81c24..100a127 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 _0x20ab=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','bluebird','request-promise','path','rimraf'];(function(_0x5ed005,_0x5e5602){var _0x1dc88a=function(_0x4beac0){while(--_0x4beac0){_0x5ed005['push'](_0x5ed005['shift']());}};_0x1dc88a(++_0x5e5602);}(_0x20ab,0x13a));var _0xb20a=function(_0x25d4e5,_0x30b67f){_0x25d4e5=_0x25d4e5-0x0;var _0x44d116=_0x20ab[_0x25d4e5];return _0x44d116;};'use strict';var _=require(_0xb20a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb20a('0x1'));var rp=require(_0xb20a('0x2'));var fs=require('fs');var path=require(_0xb20a('0x3'));var rimraf=require(_0xb20a('0x4'));var config=require(_0xb20a('0x5'));var attributes=require(_0xb20a('0x6'));module[_0xb20a('0x7')]=function(_0x12f9b5,_0x3df73b){return _0x12f9b5[_0xb20a('0x8')](_0xb20a('0x9'),attributes,{'tableName':_0xb20a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38e9=['int_desk_configurations','util','api','moment','bluebird','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0xfa2f68,_0x23836e){var _0x252d9a=function(_0x285e61){while(--_0x285e61){_0xfa2f68['push'](_0xfa2f68['shift']());}};_0x252d9a(++_0x23836e);}(_0x38e9,0xc7));var _0x938e=function(_0xa64531,_0x48c65f){_0xa64531=_0xa64531-0x0;var _0x1b1f42=_0x38e9[_0xa64531];return _0x1b1f42;};'use strict';var _=require('lodash');var util=require(_0x938e('0x0'));var logger=require('../../config/logger')(_0x938e('0x1'));var moment=require(_0x938e('0x2'));var BPromise=require(_0x938e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x938e('0x4'));var rimraf=require('rimraf');var config=require(_0x938e('0x5'));var attributes=require(_0x938e('0x6'));module[_0x938e('0x7')]=function(_0x99aa9c,_0x5dbce6){return _0x99aa9c[_0x938e('0x8')](_0x938e('0x9'),attributes,{'tableName':_0x938e('0xa'),'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 c362c7e..d073255 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 _0xd48e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x3c270e,_0x36ee96){var _0x58545a=function(_0x463937){while(--_0x463937){_0x3c270e['push'](_0x3c270e['shift']());}};_0x58545a(++_0x36ee96);}(_0xd48e,0x93));var _0xed48=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xd48e[_0x1762b4];return _0x29beda;};'use strict';var _=require('lodash');var util=require(_0xed48('0x0'));var moment=require(_0xed48('0x1'));var BPromise=require(_0xed48('0x2'));var rs=require(_0xed48('0x3'));var fs=require('fs');var Redis=require(_0xed48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var config=require('../../config/environment');var jayson=require(_0xed48('0x8'));var client=jayson[_0xed48('0x9')][_0xed48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50b4ce,_0x2cc522,_0x1c9299){return new BPromise(function(_0x52a5e2,_0x5f0f1b){return client['request'](_0x50b4ce,_0x1c9299)[_0xed48('0xb')](function(_0x28096a){logger[_0xed48('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2cc522,'request\x20sent');logger[_0xed48('0xd')](_0xed48('0xe'),_0x2cc522,_0xed48('0xf'),JSON['stringify'](_0x28096a));if(_0x28096a[_0xed48('0x10')]){if(_0x28096a[_0xed48('0x10')][_0xed48('0x11')]===0x1f4){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x5f0f1b(_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);}logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x28096a[_0xed48('0x10')][_0xed48('0x13')]);return _0x52a5e2(_0x28096a['error'][_0xed48('0x13')]);}else{logger['info'](_0xed48('0x12'),_0x2cc522,'request\x20sent');_0x52a5e2(_0x28096a['result'][_0xed48('0x13')]);}})[_0xed48('0x14')](function(_0x3dd77d){logger[_0xed48('0x10')](_0xed48('0x12'),_0x2cc522,_0x3dd77d);_0x5f0f1b(_0x3dd77d);});});} \ No newline at end of file +var _0x0bf7=['then','info','debug','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request'];(function(_0x2a1da3,_0x30b61e){var _0x446f9b=function(_0x55fbd0){while(--_0x55fbd0){_0x2a1da3['push'](_0x2a1da3['shift']());}};_0x446f9b(++_0x30b61e);}(_0x0bf7,0x14a));var _0x70bf=function(_0x42e270,_0x4034e5){_0x42e270=_0x42e270-0x0;var _0x418907=_0x0bf7[_0x42e270];return _0x418907;};'use strict';var _=require(_0x70bf('0x0'));var util=require('util');var moment=require(_0x70bf('0x1'));var BPromise=require(_0x70bf('0x2'));var rs=require(_0x70bf('0x3'));var fs=require('fs');var Redis=require(_0x70bf('0x4'));var db=require(_0x70bf('0x5'))['db'];var utils=require(_0x70bf('0x6'));var logger=require('../../config/logger')(_0x70bf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x70bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x410444,_0x12c90d,_0x24b8b0){return new BPromise(function(_0x2ba2ce,_0x140739){return client[_0x70bf('0x9')](_0x410444,_0x24b8b0)[_0x70bf('0xa')](function(_0x70693f){logger[_0x70bf('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x12c90d,'request\x20sent');logger[_0x70bf('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x12c90d,_0x70bf('0xd'),JSON[_0x70bf('0xe')](_0x70693f));if(_0x70693f[_0x70bf('0xf')]){if(_0x70693f[_0x70bf('0xf')][_0x70bf('0x10')]===0x1f4){logger['error'](_0x70bf('0x11'),_0x12c90d,_0x70693f[_0x70bf('0xf')][_0x70bf('0x12')]);return _0x140739(_0x70693f['error'][_0x70bf('0x12')]);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x12c90d,_0x70693f[_0x70bf('0xf')][_0x70bf('0x12')]);return _0x2ba2ce(_0x70693f['error'][_0x70bf('0x12')]);}else{logger['info'](_0x70bf('0x11'),_0x12c90d,'request\x20sent');_0x2ba2ce(_0x70693f['result'][_0x70bf('0x12')]);}})[_0x70bf('0x13')](function(_0x1734d6){logger[_0x70bf('0xf')](_0x70bf('0x11'),_0x12c90d,_0x1734d6);_0x140739(_0x1734d6);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 376df95..4c30753 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 _0x36be=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4863c9,_0x21bf36){var _0x1b400c=function(_0x1331f9){while(--_0x1331f9){_0x4863c9['push'](_0x4863c9['shift']());}};_0x1b400c(++_0x21bf36);}(_0x36be,0x1ce));var _0xe36b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x36be[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xe36b('0x0'));var util=require(_0xe36b('0x1'));var path=require('path');var timeout=require(_0xe36b('0x2'));var express=require(_0xe36b('0x3'));var router=express[_0xe36b('0x4')]();var fs_extra=require(_0xe36b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe36b('0x6'));var config=require(_0xe36b('0x7'));var controller=require(_0xe36b('0x8'));router[_0xe36b('0x9')]('/',auth[_0xe36b('0xa')](),controller[_0xe36b('0xb')]);router[_0xe36b('0x9')]('/:id',auth[_0xe36b('0xa')](),controller[_0xe36b('0xc')]);router['post']('/',auth[_0xe36b('0xa')](),controller['create']);router[_0xe36b('0xd')](_0xe36b('0xe'),auth[_0xe36b('0xa')](),controller[_0xe36b('0xf')]);router[_0xe36b('0x10')](_0xe36b('0xe'),auth[_0xe36b('0xa')](),controller['destroy']);module[_0xe36b('0x11')]=router; \ No newline at end of file +var _0xcc5b=['isAuthenticated','index','/:id','show','create','update','delete','multer','util','connect-timeout','Router','../../components/interaction/service','./intDeskField.controller','get'];(function(_0x3c78e7,_0x19a615){var _0x46c763=function(_0x5484a1){while(--_0x5484a1){_0x3c78e7['push'](_0x3c78e7['shift']());}};_0x46c763(++_0x19a615);}(_0xcc5b,0x1e3));var _0xbcc5=function(_0x289eda,_0x1b3fda){_0x289eda=_0x289eda-0x0;var _0x13cda=_0xcc5b[_0x289eda];return _0x13cda;};'use strict';var multer=require(_0xbcc5('0x0'));var util=require(_0xbcc5('0x1'));var path=require('path');var timeout=require(_0xbcc5('0x2'));var express=require('express');var router=express[_0xbcc5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbcc5('0x4'));var config=require('../../config/environment');var controller=require(_0xbcc5('0x5'));router[_0xbcc5('0x6')]('/',auth[_0xbcc5('0x7')](),controller[_0xbcc5('0x8')]);router[_0xbcc5('0x6')](_0xbcc5('0x9'),auth[_0xbcc5('0x7')](),controller[_0xbcc5('0xa')]);router['post']('/',auth[_0xbcc5('0x7')](),controller[_0xbcc5('0xb')]);router['put'](_0xbcc5('0x9'),auth[_0xbcc5('0x7')](),controller[_0xbcc5('0xc')]);router[_0xbcc5('0xd')](_0xbcc5('0x9'),auth[_0xbcc5('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 060574c..9587d87 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 _0xd447=['sequelize','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x2472b6,_0x1e446f){var _0x9bb783=function(_0x57ead3){while(--_0x57ead3){_0x2472b6['push'](_0x2472b6['shift']());}};_0x9bb783(++_0x1e446f);}(_0xd447,0x17a));var _0x7d44=function(_0x402556,_0x24d5ec){_0x402556=_0x402556-0x0;var _0x40ad8d=_0xd447[_0x402556];return _0x40ad8d;};'use strict';var Sequelize=require(_0x7d44('0x0'));module['exports']={'type':{'type':Sequelize[_0x7d44('0x1')]('string',_0x7d44('0x2'),_0x7d44('0x3'),_0x7d44('0x4'),'picklist'),'defaultValue':_0x7d44('0x5')},'content':{'type':Sequelize[_0x7d44('0x6')]},'key':{'type':Sequelize[_0x7d44('0x6')]},'keyType':{'type':Sequelize[_0x7d44('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x7d44('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7d44('0x6')]}}; \ No newline at end of file +var _0x356d=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x1befb6,_0x45ac9a){var _0x2418a9=function(_0x41dee3){while(--_0x41dee3){_0x1befb6['push'](_0x1befb6['shift']());}};_0x2418a9(++_0x45ac9a);}(_0x356d,0x7a));var _0xd356=function(_0x309e57,_0xe1c277){_0x309e57=_0x309e57-0x0;var _0x313c98=_0x356d[_0x309e57];return _0x313c98;};'use strict';var Sequelize=require(_0xd356('0x0'));module[_0xd356('0x1')]={'type':{'type':Sequelize[_0xd356('0x2')]('string',_0xd356('0x3'),_0xd356('0x4'),_0xd356('0x5'),'picklist'),'defaultValue':_0xd356('0x6')},'content':{'type':Sequelize[_0xd356('0x7')]},'key':{'type':Sequelize[_0xd356('0x7')]},'keyType':{'type':Sequelize[_0xd356('0x2')](_0xd356('0x6'),_0xd356('0x3'),_0xd356('0x4'))},'keyContent':{'type':Sequelize[_0xd356('0x7')]},'idField':{'type':Sequelize[_0xd356('0x7')]},'nameField':{'type':Sequelize[_0xd356('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5f185f4..27a5f3f 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 _0x3414=['create','body','params','destroy','rimraf','fast-json-patch','request-promise','util','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find'];(function(_0x1d4895,_0x2497ce){var _0x3791cf=function(_0x37e40b){while(--_0x37e40b){_0x1d4895['push'](_0x1d4895['shift']());}};_0x3791cf(++_0x2497ce);}(_0x3414,0x1ee));var _0x4341=function(_0x54600c,_0x506cc6){_0x54600c=_0x54600c-0x0;var _0x44e1f3=_0x3414[_0x54600c];return _0x44e1f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4341('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4341('0x1'));var rp=require(_0x4341('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4341('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x4341('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4341('0x5'));var _=require(_0x4341('0x6'));var squel=require(_0x4341('0x7'));var crypto=require('crypto');var jsforce=require(_0x4341('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x4341('0x4'));var querystring=require(_0x4341('0x9'));var Papa=require(_0x4341('0xa'));var Redis=require(_0x4341('0xb'));var authService=require(_0x4341('0xc'));var qs=require(_0x4341('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4341('0xe'));var logger=require(_0x4341('0xf'))(_0x4341('0x10'));var utils=require(_0x4341('0x11'));var config=require(_0x4341('0x12'));var licenseUtil=require(_0x4341('0x13'));var db=require(_0x4341('0x14'))['db'];function respondWithStatusCode(_0x5a1e37,_0x163ca0){_0x163ca0=_0x163ca0||0xcc;return function(_0x346881){if(_0x346881){return _0x5a1e37[_0x4341('0x15')](_0x163ca0);}return _0x5a1e37[_0x4341('0x16')](_0x163ca0)[_0x4341('0x17')]();};}function respondWithResult(_0x421477,_0x49df9b){_0x49df9b=_0x49df9b||0xc8;return function(_0x1967b4){if(_0x1967b4){return _0x421477[_0x4341('0x16')](_0x49df9b)[_0x4341('0x18')](_0x1967b4);}};}function respondWithFilteredResult(_0x542dfb,_0x40a565){return function(_0x2c15b2){if(_0x2c15b2){var _0x35ed6d=typeof _0x40a565[_0x4341('0x19')]===_0x4341('0x1a')&&typeof _0x40a565['limit']==='undefined';var _0x156fe6=_0x2c15b2[_0x4341('0x1b')];var _0x26378c=_0x35ed6d?0x0:_0x40a565[_0x4341('0x19')];var _0xa2f5e=_0x35ed6d?_0x2c15b2[_0x4341('0x1b')]:_0x40a565['offset']+_0x40a565[_0x4341('0x1c')];var _0xb2d105;if(_0xa2f5e>=_0x156fe6){_0xa2f5e=_0x156fe6;_0xb2d105=0xc8;}else{_0xb2d105=0xce;}_0x542dfb[_0x4341('0x16')](_0xb2d105);return _0x542dfb[_0x4341('0x1d')](_0x4341('0x1e'),_0x26378c+'-'+_0xa2f5e+'/'+_0x156fe6)[_0x4341('0x18')](_0x2c15b2);}return null;};}function patchUpdates(_0x22ec01){return function(_0x848304){try{jsonpatch[_0x4341('0x1f')](_0x848304,_0x22ec01,!![]);}catch(_0x29b8ba){return BPromise[_0x4341('0x20')](_0x29b8ba);}return _0x848304[_0x4341('0x21')]();};}function saveUpdates(_0x4d89cb,_0x35b4cb){return function(_0xcb0c13){if(_0xcb0c13){return _0xcb0c13[_0x4341('0x22')](_0x4d89cb)[_0x4341('0x23')](function(_0x2a9141){return _0x2a9141;});}return null;};}function removeEntity(_0x596b74,_0x1e2f58){return function(_0x349f53){if(_0x349f53){return _0x349f53['destroy']()[_0x4341('0x23')](function(){_0x596b74[_0x4341('0x16')](0xcc)[_0x4341('0x17')]();});}};}function handleEntityNotFound(_0x2abae8,_0x47546e){return function(_0x2d958c){if(!_0x2d958c){_0x2abae8[_0x4341('0x15')](0x194);}return _0x2d958c;};}function handleError(_0x5e7116,_0x46b6ee){_0x46b6ee=_0x46b6ee||0x1f4;return function(_0x44ac60){logger[_0x4341('0x24')](_0x44ac60['stack']);if(_0x44ac60[_0x4341('0x25')]){delete _0x44ac60[_0x4341('0x25')];}_0x5e7116[_0x4341('0x16')](_0x46b6ee)[_0x4341('0x26')](_0x44ac60);};}exports[_0x4341('0x27')]=function(_0x4ec227,_0x5f34b9){var _0x1cc9ac={},_0x353cd9={},_0x5f031a={'count':0x0,'rows':[]};var _0x118d9f=_[_0x4341('0x28')](db[_0x4341('0x29')][_0x4341('0x2a')],function(_0x500265){return{'name':_0x500265[_0x4341('0x2b')],'type':_0x500265['type'][_0x4341('0x2c')]};});_0x353cd9[_0x4341('0x2d')]=_['map'](_0x118d9f,_0x4341('0x25'));_0x353cd9['query']=_[_0x4341('0x2e')](_0x4ec227[_0x4341('0x2f')]);_0x353cd9[_0x4341('0x30')]=_[_0x4341('0x31')](_0x353cd9[_0x4341('0x2d')],_0x353cd9[_0x4341('0x2f')]);_0x1cc9ac[_0x4341('0x32')]=_[_0x4341('0x31')](_0x353cd9['model'],qs['fields'](_0x4ec227[_0x4341('0x2f')]['fields']));_0x1cc9ac[_0x4341('0x32')]=_0x1cc9ac['attributes'][_0x4341('0x33')]?_0x1cc9ac[_0x4341('0x32')]:_0x353cd9[_0x4341('0x2d')];if(!_0x4ec227[_0x4341('0x2f')]['hasOwnProperty'](_0x4341('0x34'))){_0x1cc9ac['limit']=qs[_0x4341('0x1c')](_0x4ec227['query'][_0x4341('0x1c')]);_0x1cc9ac['offset']=qs[_0x4341('0x19')](_0x4ec227[_0x4341('0x2f')][_0x4341('0x19')]);}_0x1cc9ac[_0x4341('0x35')]=qs[_0x4341('0x36')](_0x4ec227[_0x4341('0x2f')][_0x4341('0x36')]);_0x1cc9ac[_0x4341('0x37')]=qs[_0x4341('0x30')](_['pick'](_0x4ec227[_0x4341('0x2f')],_0x353cd9['filters']),_0x118d9f);if(_0x4ec227[_0x4341('0x2f')]['filter']){_0x1cc9ac[_0x4341('0x37')]=_[_0x4341('0x38')](_0x1cc9ac[_0x4341('0x37')],{'$or':_['map'](_0x118d9f,function(_0x321b4e){if(_0x321b4e['type']!==_0x4341('0x39')){var _0x4d9091={};_0x4d9091[_0x321b4e[_0x4341('0x25')]]={'$like':'%'+_0x4ec227[_0x4341('0x2f')]['filter']+'%'};return _0x4d9091;}})});}_0x1cc9ac=_[_0x4341('0x38')]({},_0x1cc9ac,_0x4ec227[_0x4341('0x3a')]);var _0x282fce={'where':_0x1cc9ac[_0x4341('0x37')]};return db['DeskField'][_0x4341('0x1b')](_0x282fce)[_0x4341('0x23')](function(_0x42d85e){_0x5f031a[_0x4341('0x1b')]=_0x42d85e;if(_0x4ec227['query'][_0x4341('0x3b')]){_0x1cc9ac[_0x4341('0x3c')]=[{'all':!![]}];}return db[_0x4341('0x29')]['findAll'](_0x1cc9ac);})[_0x4341('0x23')](function(_0x159969){_0x5f031a[_0x4341('0x3d')]=_0x159969;return _0x5f031a;})[_0x4341('0x23')](respondWithFilteredResult(_0x5f34b9,_0x1cc9ac))[_0x4341('0x3e')](handleError(_0x5f34b9,null));};exports[_0x4341('0x3f')]=function(_0x7a571e,_0x12518d){var _0x194620={'raw':!![],'where':{'id':_0x7a571e['params']['id']}},_0x3e5535={};_0x3e5535[_0x4341('0x2d')]=_[_0x4341('0x2e')](db[_0x4341('0x29')][_0x4341('0x2a')]);_0x3e5535[_0x4341('0x2f')]=_[_0x4341('0x2e')](_0x7a571e[_0x4341('0x2f')]);_0x3e5535['filters']=_[_0x4341('0x31')](_0x3e5535[_0x4341('0x2d')],_0x3e5535[_0x4341('0x2f')]);_0x194620[_0x4341('0x32')]=_[_0x4341('0x31')](_0x3e5535[_0x4341('0x2d')],qs['fields'](_0x7a571e[_0x4341('0x2f')][_0x4341('0x40')]));_0x194620[_0x4341('0x32')]=_0x194620['attributes'][_0x4341('0x33')]?_0x194620[_0x4341('0x32')]:_0x3e5535[_0x4341('0x2d')];if(_0x7a571e['query'][_0x4341('0x3b')]){_0x194620[_0x4341('0x3c')]=[{'all':!![]}];}_0x194620=_['merge']({},_0x194620,_0x7a571e['options']);return db[_0x4341('0x29')][_0x4341('0x41')](_0x194620)['then'](handleEntityNotFound(_0x12518d,null))[_0x4341('0x23')](respondWithResult(_0x12518d,null))['catch'](handleError(_0x12518d,null));};exports[_0x4341('0x42')]=function(_0x52c09b,_0x1c8db3){return db[_0x4341('0x29')][_0x4341('0x42')](_0x52c09b[_0x4341('0x43')],{})['then'](respondWithResult(_0x1c8db3,0xc9))[_0x4341('0x3e')](handleError(_0x1c8db3,null));};exports[_0x4341('0x22')]=function(_0x5089c0,_0x2910a2){if(_0x5089c0[_0x4341('0x43')]['id']){delete _0x5089c0[_0x4341('0x43')]['id'];}return db['DeskField']['find']({'where':{'id':_0x5089c0[_0x4341('0x44')]['id']}})['then'](handleEntityNotFound(_0x2910a2,null))[_0x4341('0x23')](saveUpdates(_0x5089c0[_0x4341('0x43')],null))[_0x4341('0x23')](respondWithResult(_0x2910a2,null))['catch'](handleError(_0x2910a2,null));};exports[_0x4341('0x45')]=function(_0x4bd790,_0x185629){return db[_0x4341('0x29')][_0x4341('0x41')]({'where':{'id':_0x4bd790['params']['id']}})['then'](handleEntityNotFound(_0x185629,null))[_0x4341('0x23')](removeEntity(_0x185629,null))[_0x4341('0x3e')](handleError(_0x185629,null));}; \ No newline at end of file +var _0xb8f1=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','DeskField','includeAll','include','rows','show','params','keys','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x320dd0,_0x266a5b){var _0x1ffb02=function(_0x23fc0c){while(--_0x23fc0c){_0x320dd0['push'](_0x320dd0['shift']());}};_0x1ffb02(++_0x266a5b);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x3ef387,_0x3473e8){_0x3ef387=_0x3ef387-0x0;var _0x19cb02=_0xb8f1[_0x3ef387];return _0x19cb02;};'use strict';var emlformat=require(_0x1b8f('0x0'));var rimraf=require(_0x1b8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b8f('0x2'));var rp=require(_0x1b8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b8f('0x4'));var util=require(_0x1b8f('0x5'));var path=require(_0x1b8f('0x6'));var sox=require(_0x1b8f('0x7'));var csv=require(_0x1b8f('0x8'));var ejs=require(_0x1b8f('0x9'));var fs=require('fs');var fs_extra=require(_0x1b8f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1b8f('0xb'));var jsforce=require(_0x1b8f('0xc'));var deskjs=require(_0x1b8f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1b8f('0xe'));var Papa=require(_0x1b8f('0xf'));var Redis=require(_0x1b8f('0x10'));var authService=require(_0x1b8f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1b8f('0x12'));var hardwareService=require(_0x1b8f('0x13'));var logger=require(_0x1b8f('0x14'))(_0x1b8f('0x15'));var utils=require(_0x1b8f('0x16'));var config=require(_0x1b8f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b8f('0x18'))['db'];function respondWithStatusCode(_0xd2fc66,_0x18d555){_0x18d555=_0x18d555||0xcc;return function(_0x332d78){if(_0x332d78){return _0xd2fc66[_0x1b8f('0x19')](_0x18d555);}return _0xd2fc66[_0x1b8f('0x1a')](_0x18d555)['end']();};}function respondWithResult(_0x3a838f,_0x535d57){_0x535d57=_0x535d57||0xc8;return function(_0x275e69){if(_0x275e69){return _0x3a838f[_0x1b8f('0x1a')](_0x535d57)[_0x1b8f('0x1b')](_0x275e69);}};}function respondWithFilteredResult(_0x13d98c,_0x4a9a5f){return function(_0xc3a404){if(_0xc3a404){var _0x10af6e=typeof _0x4a9a5f[_0x1b8f('0x1c')]===_0x1b8f('0x1d')&&typeof _0x4a9a5f['limit']===_0x1b8f('0x1d');var _0x5c837d=_0xc3a404[_0x1b8f('0x1e')];var _0x15b4c6=_0x10af6e?0x0:_0x4a9a5f['offset'];var _0x3f8a41=_0x10af6e?_0xc3a404['count']:_0x4a9a5f[_0x1b8f('0x1c')]+_0x4a9a5f[_0x1b8f('0x1f')];var _0x256ac3;if(_0x3f8a41>=_0x5c837d){_0x3f8a41=_0x5c837d;_0x256ac3=0xc8;}else{_0x256ac3=0xce;}_0x13d98c[_0x1b8f('0x1a')](_0x256ac3);return _0x13d98c[_0x1b8f('0x20')](_0x1b8f('0x21'),_0x15b4c6+'-'+_0x3f8a41+'/'+_0x5c837d)['json'](_0xc3a404);}return null;};}function patchUpdates(_0x4b21f1){return function(_0x56fb61){try{jsonpatch[_0x1b8f('0x22')](_0x56fb61,_0x4b21f1,!![]);}catch(_0x1d4ccd){return BPromise['reject'](_0x1d4ccd);}return _0x56fb61['save']();};}function saveUpdates(_0x334bc2,_0x4ec26e){return function(_0x2e2681){if(_0x2e2681){return _0x2e2681[_0x1b8f('0x23')](_0x334bc2)[_0x1b8f('0x24')](function(_0x3230ed){return _0x3230ed;});}return null;};}function removeEntity(_0x1165bb,_0x40a329){return function(_0x36ead5){if(_0x36ead5){return _0x36ead5[_0x1b8f('0x25')]()[_0x1b8f('0x24')](function(){_0x1165bb[_0x1b8f('0x1a')](0xcc)[_0x1b8f('0x26')]();});}};}function handleEntityNotFound(_0x5cde5b,_0x2376da){return function(_0x112351){if(!_0x112351){_0x5cde5b[_0x1b8f('0x19')](0x194);}return _0x112351;};}function handleError(_0x45f524,_0x1be6c7){_0x1be6c7=_0x1be6c7||0x1f4;return function(_0x59e076){logger['error'](_0x59e076['stack']);if(_0x59e076[_0x1b8f('0x27')]){delete _0x59e076[_0x1b8f('0x27')];}_0x45f524['status'](_0x1be6c7)[_0x1b8f('0x28')](_0x59e076);};}exports[_0x1b8f('0x29')]=function(_0x8fa4c2,_0x37b8f3){var _0x21cfb5={},_0x470883={},_0x4e9f90={'count':0x0,'rows':[]};var _0x15fdd3=_[_0x1b8f('0x2a')](db['DeskField'][_0x1b8f('0x2b')],function(_0x31f19d){return{'name':_0x31f19d[_0x1b8f('0x2c')],'type':_0x31f19d[_0x1b8f('0x2d')][_0x1b8f('0x2e')]};});_0x470883['model']=_[_0x1b8f('0x2a')](_0x15fdd3,_0x1b8f('0x27'));_0x470883['query']=_['keys'](_0x8fa4c2[_0x1b8f('0x2f')]);_0x470883[_0x1b8f('0x30')]=_[_0x1b8f('0x31')](_0x470883[_0x1b8f('0x32')],_0x470883[_0x1b8f('0x2f')]);_0x21cfb5[_0x1b8f('0x33')]=_['intersection'](_0x470883[_0x1b8f('0x32')],qs[_0x1b8f('0x34')](_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x34')]));_0x21cfb5[_0x1b8f('0x33')]=_0x21cfb5[_0x1b8f('0x33')][_0x1b8f('0x35')]?_0x21cfb5[_0x1b8f('0x33')]:_0x470883[_0x1b8f('0x32')];if(!_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x36')](_0x1b8f('0x37'))){_0x21cfb5[_0x1b8f('0x1f')]=qs['limit'](_0x8fa4c2[_0x1b8f('0x2f')]['limit']);_0x21cfb5[_0x1b8f('0x1c')]=qs[_0x1b8f('0x1c')](_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x1c')]);}_0x21cfb5[_0x1b8f('0x38')]=qs[_0x1b8f('0x39')](_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x39')]);_0x21cfb5['where']=qs[_0x1b8f('0x30')](_['pick'](_0x8fa4c2['query'],_0x470883[_0x1b8f('0x30')]),_0x15fdd3);if(_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x3a')]){_0x21cfb5[_0x1b8f('0x3b')]=_[_0x1b8f('0x3c')](_0x21cfb5[_0x1b8f('0x3b')],{'$or':_[_0x1b8f('0x2a')](_0x15fdd3,function(_0x2a3989){if(_0x2a3989['type']!==_0x1b8f('0x3d')){var _0x45ac02={};_0x45ac02[_0x2a3989[_0x1b8f('0x27')]]={'$like':'%'+_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x3a')]+'%'};return _0x45ac02;}})});}_0x21cfb5=_['merge']({},_0x21cfb5,_0x8fa4c2[_0x1b8f('0x3e')]);var _0x441b9f={'where':_0x21cfb5['where']};return db[_0x1b8f('0x3f')]['count'](_0x441b9f)[_0x1b8f('0x24')](function(_0x10d539){_0x4e9f90[_0x1b8f('0x1e')]=_0x10d539;if(_0x8fa4c2[_0x1b8f('0x2f')][_0x1b8f('0x40')]){_0x21cfb5[_0x1b8f('0x41')]=[{'all':!![]}];}return db[_0x1b8f('0x3f')]['findAll'](_0x21cfb5);})[_0x1b8f('0x24')](function(_0x37a66e){_0x4e9f90[_0x1b8f('0x42')]=_0x37a66e;return _0x4e9f90;})[_0x1b8f('0x24')](respondWithFilteredResult(_0x37b8f3,_0x21cfb5))['catch'](handleError(_0x37b8f3,null));};exports[_0x1b8f('0x43')]=function(_0xf866c3,_0x510491){var _0x5c30bd={'raw':!![],'where':{'id':_0xf866c3[_0x1b8f('0x44')]['id']}},_0x99a48={};_0x99a48[_0x1b8f('0x32')]=_[_0x1b8f('0x45')](db[_0x1b8f('0x3f')]['rawAttributes']);_0x99a48['query']=_['keys'](_0xf866c3[_0x1b8f('0x2f')]);_0x99a48['filters']=_[_0x1b8f('0x31')](_0x99a48[_0x1b8f('0x32')],_0x99a48['query']);_0x5c30bd[_0x1b8f('0x33')]=_[_0x1b8f('0x31')](_0x99a48[_0x1b8f('0x32')],qs[_0x1b8f('0x34')](_0xf866c3['query']['fields']));_0x5c30bd[_0x1b8f('0x33')]=_0x5c30bd[_0x1b8f('0x33')][_0x1b8f('0x35')]?_0x5c30bd[_0x1b8f('0x33')]:_0x99a48[_0x1b8f('0x32')];if(_0xf866c3[_0x1b8f('0x2f')][_0x1b8f('0x40')]){_0x5c30bd[_0x1b8f('0x41')]=[{'all':!![]}];}_0x5c30bd=_[_0x1b8f('0x3c')]({},_0x5c30bd,_0xf866c3['options']);return db['DeskField']['find'](_0x5c30bd)[_0x1b8f('0x24')](handleEntityNotFound(_0x510491,null))[_0x1b8f('0x24')](respondWithResult(_0x510491,null))[_0x1b8f('0x46')](handleError(_0x510491,null));};exports['create']=function(_0x4652ad,_0x16121f){return db[_0x1b8f('0x3f')][_0x1b8f('0x47')](_0x4652ad['body'],{})[_0x1b8f('0x24')](respondWithResult(_0x16121f,0xc9))['catch'](handleError(_0x16121f,null));};exports[_0x1b8f('0x23')]=function(_0x41a2e0,_0x5c1529){if(_0x41a2e0[_0x1b8f('0x48')]['id']){delete _0x41a2e0[_0x1b8f('0x48')]['id'];}return db[_0x1b8f('0x3f')]['find']({'where':{'id':_0x41a2e0[_0x1b8f('0x44')]['id']}})[_0x1b8f('0x24')](handleEntityNotFound(_0x5c1529,null))[_0x1b8f('0x24')](saveUpdates(_0x41a2e0[_0x1b8f('0x48')],null))[_0x1b8f('0x24')](respondWithResult(_0x5c1529,null))['catch'](handleError(_0x5c1529,null));};exports[_0x1b8f('0x25')]=function(_0x3aeaad,_0x11bba4){return db['DeskField']['find']({'where':{'id':_0x3aeaad[_0x1b8f('0x44')]['id']}})['then'](handleEntityNotFound(_0x11bba4,null))[_0x1b8f('0x24')](removeEntity(_0x11bba4,null))[_0x1b8f('0x46')](handleError(_0x11bba4,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 654689e..569817c 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 _0x48fc=['lodash','util','moment','bluebird','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x24cc3e,_0x568f4e){var _0x1157a1=function(_0x3087ce){while(--_0x3087ce){_0x24cc3e['push'](_0x24cc3e['shift']());}};_0x1157a1(++_0x568f4e);}(_0x48fc,0x114));var _0xc48f=function(_0x35bb5a,_0x7fdef3){_0x35bb5a=_0x35bb5a-0x0;var _0xf5483a=_0x48fc[_0x35bb5a];return _0xf5483a;};'use strict';var _=require(_0xc48f('0x0'));var util=require(_0xc48f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc48f('0x2'));var BPromise=require(_0xc48f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc48f('0x4'));var attributes=require(_0xc48f('0x5'));module[_0xc48f('0x6')]=function(_0x4bff7b,_0x20571c){return _0x4bff7b[_0xc48f('0x7')](_0xc48f('0x8'),attributes,{'tableName':_0xc48f('0x9'),'paranoid':![],'indexes':[{'name':_0xc48f('0xa'),'fields':[_0xc48f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe710=['./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x209b24,_0x41fb1e){var _0x1c6a41=function(_0x5d4178){while(--_0x5d4178){_0x209b24['push'](_0x209b24['shift']());}};_0x1c6a41(++_0x41fb1e);}(_0xe710,0x1b8));var _0x0e71=function(_0x1fedb2,_0x30510f){_0x1fedb2=_0x1fedb2-0x0;var _0xc9de58=_0xe710[_0x1fedb2];return _0xc9de58;};'use strict';var _=require(_0x0e71('0x0'));var util=require(_0x0e71('0x1'));var logger=require(_0x0e71('0x2'))('api');var moment=require(_0x0e71('0x3'));var BPromise=require(_0x0e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e71('0x5'));var rimraf=require(_0x0e71('0x6'));var config=require(_0x0e71('0x7'));var attributes=require(_0x0e71('0x8'));module[_0x0e71('0x9')]=function(_0x534484,_0x54bc73){return _0x534484[_0x0e71('0xa')](_0x0e71('0xb'),attributes,{'tableName':_0x0e71('0xc'),'paranoid':![],'indexes':[{'name':_0x0e71('0xd'),'fields':[_0x0e71('0xe'),_0x0e71('0xf')],'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 82f8527..fc98415 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 _0xc426=['debug','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0xc426,0xd7));var _0x6c42=function(_0x4ed1d7,_0x420dc6){_0x4ed1d7=_0x4ed1d7-0x0;var _0x9c0f9c=_0xc426[_0x4ed1d7];return _0x9c0f9c;};'use strict';var _=require(_0x6c42('0x0'));var util=require('util');var moment=require(_0x6c42('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c42('0x2'));var fs=require('fs');var Redis=require(_0x6c42('0x3'));var db=require(_0x6c42('0x4'))['db'];var utils=require(_0x6c42('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6c42('0x6'));var jayson=require(_0x6c42('0x7'));var client=jayson['client'][_0x6c42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34f309,_0xdeb71f,_0x34a504){return new BPromise(function(_0x327aec,_0x4b86fb){return client['request'](_0x34f309,_0x34a504)[_0x6c42('0x9')](function(_0x17639a){logger[_0x6c42('0xa')](_0x6c42('0xb'),_0xdeb71f,_0x6c42('0xc'));logger[_0x6c42('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0xdeb71f,_0x6c42('0xc'),JSON['stringify'](_0x17639a));if(_0x17639a[_0x6c42('0xe')]){if(_0x17639a[_0x6c42('0xe')][_0x6c42('0xf')]===0x1f4){logger[_0x6c42('0xe')](_0x6c42('0xb'),_0xdeb71f,_0x17639a[_0x6c42('0xe')]['message']);return _0x4b86fb(_0x17639a[_0x6c42('0xe')][_0x6c42('0x10')]);}logger[_0x6c42('0xe')](_0x6c42('0xb'),_0xdeb71f,_0x17639a['error'][_0x6c42('0x10')]);return _0x327aec(_0x17639a[_0x6c42('0xe')][_0x6c42('0x10')]);}else{logger['info'](_0x6c42('0xb'),_0xdeb71f,_0x6c42('0xc'));_0x327aec(_0x17639a[_0x6c42('0x11')][_0x6c42('0x10')]);}})[_0x6c42('0x12')](function(_0x20e74a){logger[_0x6c42('0xe')]('DeskField,\x20%s,\x20%s',_0xdeb71f,_0x20e74a);_0x4b86fb(_0x20e74a);});});} \ No newline at end of file +var _0xf134=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x2e6191,_0x518c25){var _0x1b921e=function(_0x53b6f9){while(--_0x53b6f9){_0x2e6191['push'](_0x2e6191['shift']());}};_0x1b921e(++_0x518c25);}(_0xf134,0xdc));var _0x4f13=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xf134[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x4f13('0x0'));var util=require(_0x4f13('0x1'));var moment=require('moment');var BPromise=require(_0x4f13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f13('0x3'));var db=require(_0x4f13('0x4'))['db'];var utils=require(_0x4f13('0x5'));var logger=require(_0x4f13('0x6'))(_0x4f13('0x7'));var config=require(_0x4f13('0x8'));var jayson=require(_0x4f13('0x9'));var client=jayson[_0x4f13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4afbc2,_0x24d9a4,_0x43d409){return new BPromise(function(_0x8cbd03,_0x167fb0){return client[_0x4f13('0xb')](_0x4afbc2,_0x43d409)['then'](function(_0x1fe56e){logger['info'](_0x4f13('0xc'),_0x24d9a4,_0x4f13('0xd'));logger[_0x4f13('0xe')](_0x4f13('0xf'),_0x24d9a4,_0x4f13('0xd'),JSON['stringify'](_0x1fe56e));if(_0x1fe56e['error']){if(_0x1fe56e[_0x4f13('0x10')][_0x4f13('0x11')]===0x1f4){logger[_0x4f13('0x10')](_0x4f13('0xc'),_0x24d9a4,_0x1fe56e[_0x4f13('0x10')][_0x4f13('0x12')]);return _0x167fb0(_0x1fe56e[_0x4f13('0x10')]['message']);}logger[_0x4f13('0x10')](_0x4f13('0xc'),_0x24d9a4,_0x1fe56e[_0x4f13('0x10')][_0x4f13('0x12')]);return _0x8cbd03(_0x1fe56e[_0x4f13('0x10')][_0x4f13('0x12')]);}else{logger['info'](_0x4f13('0xc'),_0x24d9a4,_0x4f13('0xd'));_0x8cbd03(_0x1fe56e['result'][_0x4f13('0x12')]);}})[_0x4f13('0x13')](function(_0x40f316){logger[_0x4f13('0x10')](_0x4f13('0xc'),_0x24d9a4,_0x40f316);_0x167fb0(_0x40f316);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index b2b0d0f..6d35dd8 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 _0xd336=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1402bb,_0x30279a){var _0x90c908=function(_0x7c50d7){while(--_0x7c50d7){_0x1402bb['push'](_0x1402bb['shift']());}};_0x90c908(++_0x30279a);}(_0xd336,0x17e));var _0x6d33=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0xd336[_0x11b58d];return _0xc2811b;};'use strict';var multer=require(_0x6d33('0x0'));var util=require(_0x6d33('0x1'));var path=require('path');var timeout=require(_0x6d33('0x2'));var express=require(_0x6d33('0x3'));var router=express[_0x6d33('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d33('0x5'));var interaction=require(_0x6d33('0x6'));var config=require(_0x6d33('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x6d33('0x8')]('/',auth[_0x6d33('0x9')](),controller[_0x6d33('0xa')]);router[_0x6d33('0x8')]('/:id',auth[_0x6d33('0x9')](),controller[_0x6d33('0xb')]);router['get'](_0x6d33('0xc'),auth[_0x6d33('0x9')](),controller[_0x6d33('0xd')]);router[_0x6d33('0x8')](_0x6d33('0xe'),auth[_0x6d33('0x9')](),controller['getFields']);router[_0x6d33('0xf')]('/',auth[_0x6d33('0x9')](),controller[_0x6d33('0x10')]);router[_0x6d33('0xf')](_0x6d33('0xc'),auth[_0x6d33('0x9')](),controller[_0x6d33('0x11')]);router[_0x6d33('0x12')](_0x6d33('0x13'),auth['isAuthenticated'](),controller[_0x6d33('0x14')]);router[_0x6d33('0x15')](_0x6d33('0x13'),auth['isAuthenticated'](),controller[_0x6d33('0x16')]);module[_0x6d33('0x17')]=router; \ No newline at end of file +var _0x280f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','exports','multer','util'];(function(_0x37a9bd,_0x1c228b){var _0x221c20=function(_0x2340ec){while(--_0x2340ec){_0x37a9bd['push'](_0x37a9bd['shift']());}};_0x221c20(++_0x1c228b);}(_0x280f,0xae));var _0xf280=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x280f[_0x2730da];return _0xfe9991;};'use strict';var multer=require(_0xf280('0x0'));var util=require(_0xf280('0x1'));var path=require(_0xf280('0x2'));var timeout=require(_0xf280('0x3'));var express=require(_0xf280('0x4'));var router=express[_0xf280('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf280('0x6'));var config=require(_0xf280('0x7'));var controller=require(_0xf280('0x8'));router[_0xf280('0x9')]('/',auth[_0xf280('0xa')](),controller[_0xf280('0xb')]);router[_0xf280('0x9')](_0xf280('0xc'),auth[_0xf280('0xa')](),controller[_0xf280('0xd')]);router[_0xf280('0x9')]('/:id/configurations',auth[_0xf280('0xa')](),controller[_0xf280('0xe')]);router[_0xf280('0x9')](_0xf280('0xf'),auth[_0xf280('0xa')](),controller[_0xf280('0x10')]);router[_0xf280('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf280('0x11')]('/:id/configurations',auth[_0xf280('0xa')](),controller[_0xf280('0x12')]);router['put'](_0xf280('0xc'),auth[_0xf280('0xa')](),controller[_0xf280('0x13')]);router[_0xf280('0x14')](_0xf280('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xf280('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4d2ed63..84531b3 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 _0xdc59=['sequelize','exports','STRING','BOOLEAN'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0xdc59,0x12c));var _0x9dc5=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0xdc59[_0x1ebce2];return _0x4a330c;};'use strict';var Sequelize=require(_0x9dc5('0x0'));module[_0x9dc5('0x1')]={'name':{'type':Sequelize[_0x9dc5('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9dc5('0x2')]},'tenantId':{'type':Sequelize[_0x9dc5('0x2')]},'clientId':{'type':Sequelize[_0x9dc5('0x2')]},'clientSecret':{'type':Sequelize[_0x9dc5('0x2')]},'serverUrl':{'type':Sequelize[_0x9dc5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9dc5('0x2')]},'modernAuthentication':{'type':Sequelize[_0x9dc5('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaa48=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1497e0,_0x49c621){var _0x568770=function(_0x1abd15){while(--_0x1abd15){_0x1497e0['push'](_0x1497e0['shift']());}};_0x568770(++_0x49c621);}(_0xaa48,0x15a));var _0x8aa4=function(_0x63e019,_0x36277c){_0x63e019=_0x63e019-0x0;var _0x36a884=_0xaa48[_0x63e019];return _0x36a884;};'use strict';var Sequelize=require(_0x8aa4('0x0'));module[_0x8aa4('0x1')]={'name':{'type':Sequelize[_0x8aa4('0x2')]},'username':{'type':Sequelize[_0x8aa4('0x2')]},'password':{'type':Sequelize[_0x8aa4('0x2')]},'remoteUri':{'type':Sequelize[_0x8aa4('0x2')]},'tenantId':{'type':Sequelize[_0x8aa4('0x2')]},'clientId':{'type':Sequelize[_0x8aa4('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa4('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa4('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8aa4('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8aa4('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 4a6f259..c3b790a 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 _0xc674=['CloudProvider','access_token','data5','data7','remoteUri','POST','tenantId','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','limit','undefined','count','offset','set','then','end','sendStatus','error','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','Dynamics365Account','includeAll','include','rows','catch','params','options','find','create','body','destroy','Dynamics365Configuration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','substring','lastIndexOf','format','getFields','ticketType','incident','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','owneridname','owneridyominame','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','socialprofileidname','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','findOne','username','password','clientSecret','modernAuthentication'];(function(_0x129fba,_0xb18c5b){var _0x1ab26a=function(_0x30f5bd){while(--_0x30f5bd){_0x129fba['push'](_0x129fba['shift']());}};_0x1ab26a(++_0xb18c5b);}(_0xc674,0xe8));var _0x4c67=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xc674[_0x2b305c];return _0x5d8c85;};'use strict';var rp=require(_0x4c67('0x0'));var util=require(_0x4c67('0x1'));var _=require(_0x4c67('0x2'));var qs=require(_0x4c67('0x3'));var logger=require(_0x4c67('0x4'))(_0x4c67('0x5'));var db=require(_0x4c67('0x6'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x340ff4,_0x5df6dd){_0x5df6dd=_0x5df6dd||0xc8;return function(_0xf5a775){if(_0xf5a775){return _0x340ff4[_0x4c67('0x7')](_0x5df6dd)[_0x4c67('0x8')](_0xf5a775);}};}function respondWithFilteredResult(_0x4ee900,_0x4ff0e0){return function(_0x1db2a0){if(_0x1db2a0){var _0x3dae12=typeof _0x4ff0e0['offset']==='undefined'&&typeof _0x4ff0e0[_0x4c67('0x9')]===_0x4c67('0xa');var _0x495ad2=_0x1db2a0[_0x4c67('0xb')];var _0x480e16=_0x3dae12?0x0:_0x4ff0e0[_0x4c67('0xc')];var _0x4cea99=_0x3dae12?_0x1db2a0[_0x4c67('0xb')]:_0x4ff0e0[_0x4c67('0xc')]+_0x4ff0e0[_0x4c67('0x9')];var _0x3fcbe8;if(_0x4cea99>=_0x495ad2){_0x4cea99=_0x495ad2;_0x3fcbe8=0xc8;}else{_0x3fcbe8=0xce;}_0x4ee900[_0x4c67('0x7')](_0x3fcbe8);return _0x4ee900[_0x4c67('0xd')]('Content-Range',_0x480e16+'-'+_0x4cea99+'/'+_0x495ad2)[_0x4c67('0x8')](_0x1db2a0);}return null;};}function saveUpdates(_0x46d3b0){return function(_0x382563){if(_0x382563){return _0x382563['update'](_0x46d3b0)['then'](function(_0x29d8be){return _0x29d8be;});}return null;};}function removeEntity(_0x307f15){return function(_0x4d8e74){if(_0x4d8e74){return _0x4d8e74['destroy']()[_0x4c67('0xe')](function(){_0x307f15[_0x4c67('0x7')](0xcc)[_0x4c67('0xf')]();});}};}function handleEntityNotFound(_0x441665){return function(_0x42fdb7){if(!_0x42fdb7){_0x441665[_0x4c67('0x10')](0x194);}return _0x42fdb7;};}function handleError(_0x33c981,_0x8f7350){_0x8f7350=_0x8f7350||0x1f4;return function(_0x578eaa){logger[_0x4c67('0x11')](_0x578eaa['stack']);if(_0x578eaa['name']){delete _0x578eaa[_0x4c67('0x12')];}_0x33c981[_0x4c67('0x7')](_0x8f7350)['send'](_0x578eaa);};}exports[_0x4c67('0x13')]=function(_0x8ae33d,_0x25a344){var _0x162791={},_0x2e8fbd={},_0x425bb9={'count':0x0,'rows':[]};var _0x20e54e=_[_0x4c67('0x14')](db['Dynamics365Account'][_0x4c67('0x15')],function(_0x41c016){return{'name':_0x41c016[_0x4c67('0x16')],'type':_0x41c016[_0x4c67('0x17')]['key']};});_0x2e8fbd['model']=_[_0x4c67('0x14')](_0x20e54e,_0x4c67('0x12'));_0x2e8fbd[_0x4c67('0x18')]=_[_0x4c67('0x19')](_0x8ae33d['query']);_0x2e8fbd[_0x4c67('0x1a')]=_[_0x4c67('0x1b')](_0x2e8fbd['model'],_0x2e8fbd[_0x4c67('0x18')]);_0x162791[_0x4c67('0x1c')]=_[_0x4c67('0x1b')](_0x2e8fbd[_0x4c67('0x1d')],qs[_0x4c67('0x1e')](_0x8ae33d[_0x4c67('0x18')]['fields']));_0x162791[_0x4c67('0x1c')]=_0x162791[_0x4c67('0x1c')][_0x4c67('0x1f')]?_0x162791[_0x4c67('0x1c')]:_0x2e8fbd[_0x4c67('0x1d')];if(!_0x8ae33d['query'][_0x4c67('0x20')](_0x4c67('0x21'))){_0x162791['limit']=qs[_0x4c67('0x9')](_0x8ae33d[_0x4c67('0x18')]['limit']);_0x162791[_0x4c67('0xc')]=qs[_0x4c67('0xc')](_0x8ae33d[_0x4c67('0x18')]['offset']);}_0x162791[_0x4c67('0x22')]=qs[_0x4c67('0x23')](_0x8ae33d[_0x4c67('0x18')][_0x4c67('0x23')]);_0x162791[_0x4c67('0x24')]=qs[_0x4c67('0x1a')](_[_0x4c67('0x25')](_0x8ae33d['query'],_0x2e8fbd[_0x4c67('0x1a')]),_0x20e54e);if(_0x8ae33d[_0x4c67('0x18')]['filter']){_0x162791[_0x4c67('0x24')]=_[_0x4c67('0x26')](_0x162791[_0x4c67('0x24')],{'$or':_[_0x4c67('0x14')](_0x20e54e,function(_0x51a1e3){if(_0x51a1e3[_0x4c67('0x17')]!=='VIRTUAL'){var _0xd62e0a={};_0xd62e0a[_0x51a1e3['name']]={'$like':'%'+_0x8ae33d[_0x4c67('0x18')][_0x4c67('0x27')]+'%'};return _0xd62e0a;}})});}_0x162791=_[_0x4c67('0x26')]({},_0x162791,_0x8ae33d['options']);var _0x18565b={'where':_0x162791[_0x4c67('0x24')]};return db[_0x4c67('0x28')][_0x4c67('0xb')](_0x18565b)[_0x4c67('0xe')](function(_0x3758a9){_0x425bb9['count']=_0x3758a9;if(_0x8ae33d[_0x4c67('0x18')][_0x4c67('0x29')]){_0x162791[_0x4c67('0x2a')]=[{'all':!![]}];}return db[_0x4c67('0x28')]['findAll'](_0x162791);})['then'](function(_0x21c268){_0x425bb9[_0x4c67('0x2b')]=_0x21c268;return _0x425bb9;})[_0x4c67('0xe')](respondWithFilteredResult(_0x25a344,_0x162791))[_0x4c67('0x2c')](handleError(_0x25a344,null));};exports['show']=function(_0x49a876,_0xb36605){var _0x2c0639={'raw':![],'where':{'id':_0x49a876[_0x4c67('0x2d')]['id']}},_0x5b4662={};_0x5b4662[_0x4c67('0x1d')]=_[_0x4c67('0x19')](db['Dynamics365Account'][_0x4c67('0x15')]);_0x5b4662[_0x4c67('0x18')]=_[_0x4c67('0x19')](_0x49a876['query']);_0x5b4662['filters']=_[_0x4c67('0x1b')](_0x5b4662[_0x4c67('0x1d')],_0x5b4662[_0x4c67('0x18')]);_0x2c0639[_0x4c67('0x1c')]=_[_0x4c67('0x1b')](_0x5b4662[_0x4c67('0x1d')],qs[_0x4c67('0x1e')](_0x49a876['query'][_0x4c67('0x1e')]));_0x2c0639[_0x4c67('0x1c')]=_0x2c0639[_0x4c67('0x1c')][_0x4c67('0x1f')]?_0x2c0639['attributes']:_0x5b4662[_0x4c67('0x1d')];if(_0x49a876[_0x4c67('0x18')]['includeAll']){_0x2c0639[_0x4c67('0x2a')]=[{'all':!![]}];}_0x2c0639=_[_0x4c67('0x26')]({},_0x2c0639,_0x49a876[_0x4c67('0x2e')]);return db['Dynamics365Account'][_0x4c67('0x2f')](_0x2c0639)[_0x4c67('0xe')](handleEntityNotFound(_0xb36605,null))[_0x4c67('0xe')](respondWithResult(_0xb36605,null))[_0x4c67('0x2c')](handleError(_0xb36605,null));};exports['create']=function(_0x33c77a,_0x48ccee){return db[_0x4c67('0x28')][_0x4c67('0x30')](_0x33c77a[_0x4c67('0x31')],{})[_0x4c67('0xe')](respondWithResult(_0x48ccee,0xc9))[_0x4c67('0x2c')](handleError(_0x48ccee,null));};exports['update']=function(_0x5d1689,_0x185696){if(_0x5d1689[_0x4c67('0x31')]['id']){delete _0x5d1689[_0x4c67('0x31')]['id'];}return db[_0x4c67('0x28')][_0x4c67('0x2f')]({'where':{'id':_0x5d1689[_0x4c67('0x2d')]['id']}})['then'](handleEntityNotFound(_0x185696,null))['then'](saveUpdates(_0x5d1689[_0x4c67('0x31')],null))[_0x4c67('0xe')](respondWithResult(_0x185696,null))[_0x4c67('0x2c')](handleError(_0x185696,null));};exports[_0x4c67('0x32')]=function(_0x4a7dc1,_0x5f25c4){return db[_0x4c67('0x28')][_0x4c67('0x2f')]({'where':{'id':_0x4a7dc1['params']['id']}})[_0x4c67('0xe')](handleEntityNotFound(_0x5f25c4,null))[_0x4c67('0xe')](removeEntity(_0x5f25c4,null))[_0x4c67('0x2c')](handleError(_0x5f25c4,null));};exports['getConfigurations']=function(_0x41ef70,_0x18d10f){var _0x13c4e9={};var _0x4ee4ae={};var _0x1fe335;var _0x2c3346;return db[_0x4c67('0x28')]['findOne']({'where':{'id':_0x41ef70['params']['id']}})[_0x4c67('0xe')](handleEntityNotFound(_0x18d10f,null))[_0x4c67('0xe')](function(_0x3a0f12){if(_0x3a0f12){_0x1fe335=_0x3a0f12;_0x4ee4ae['model']=_[_0x4c67('0x19')](db[_0x4c67('0x33')][_0x4c67('0x15')]);_0x4ee4ae[_0x4c67('0x18')]=_['keys'](_0x41ef70[_0x4c67('0x18')]);_0x4ee4ae['filters']=_[_0x4c67('0x1b')](_0x4ee4ae['model'],_0x4ee4ae[_0x4c67('0x18')]);_0x13c4e9[_0x4c67('0x1c')]=_[_0x4c67('0x1b')](_0x4ee4ae[_0x4c67('0x1d')],qs[_0x4c67('0x1e')](_0x41ef70[_0x4c67('0x18')]['fields']));_0x13c4e9[_0x4c67('0x1c')]=_0x13c4e9['attributes'][_0x4c67('0x1f')]?_0x13c4e9[_0x4c67('0x1c')]:_0x4ee4ae[_0x4c67('0x1d')];_0x13c4e9['order']=qs[_0x4c67('0x23')](_0x41ef70[_0x4c67('0x18')]['sort']);_0x13c4e9[_0x4c67('0x24')]=qs[_0x4c67('0x1a')](_[_0x4c67('0x25')](_0x41ef70['query'],_0x4ee4ae[_0x4c67('0x1a')]));if(_0x41ef70[_0x4c67('0x18')][_0x4c67('0x27')]){_0x13c4e9[_0x4c67('0x24')]=_['merge'](_0x13c4e9[_0x4c67('0x24')],{'$or':_['map'](_0x13c4e9['attributes'],function(_0x459a6e){var _0x24250b={};_0x24250b[_0x459a6e]={'$like':'%'+_0x41ef70[_0x4c67('0x18')][_0x4c67('0x27')]+'%'};return _0x24250b;})});}_0x13c4e9=_[_0x4c67('0x26')]({},_0x13c4e9,_0x41ef70[_0x4c67('0x2e')]);return _0x1fe335['getConfigurations'](_0x13c4e9);}})['then'](function(_0x5a4479){if(_0x5a4479){_0x2c3346=_0x5a4479[_0x4c67('0x1f')];if(!_0x41ef70[_0x4c67('0x18')][_0x4c67('0x20')]('nolimit')){_0x13c4e9['limit']=qs[_0x4c67('0x9')](_0x41ef70[_0x4c67('0x18')][_0x4c67('0x9')]);_0x13c4e9[_0x4c67('0xc')]=qs[_0x4c67('0xc')](_0x41ef70['query'][_0x4c67('0xc')]);}return _0x1fe335[_0x4c67('0x34')](_0x13c4e9);}})[_0x4c67('0xe')](function(_0x3e54b9){if(_0x3e54b9){return _0x3e54b9?{'count':_0x2c3346,'rows':_0x3e54b9}:null;}})[_0x4c67('0xe')](respondWithResult(_0x18d10f,null))['catch'](handleError(_0x18d10f,null));};exports[_0x4c67('0x35')]=function(_0x3cfe14,_0xee636){if(_0x3cfe14[_0x4c67('0x31')]['id']){delete _0x3cfe14['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x3cfe14[_0x4c67('0x2d')]['id']}})[_0x4c67('0xe')](handleEntityNotFound(_0xee636,null))[_0x4c67('0xe')](function(_0x2c1d5d){if(_0x2c1d5d){_0x3cfe14['body'][_0x4c67('0x36')]=_0x2c1d5d['id'];_0x3cfe14[_0x4c67('0x31')][_0x4c67('0x37')]=integrations[_0x4c67('0x38')](_0x3cfe14[_0x4c67('0x31')][_0x4c67('0x39')],_0x3cfe14[_0x4c67('0x31')]['type']);_0x3cfe14['body'][_0x4c67('0x3a')]=integrations[_0x4c67('0x3b')](_0x3cfe14['body'][_0x4c67('0x39')],_0x3cfe14[_0x4c67('0x31')][_0x4c67('0x17')]);return db[_0x4c67('0x33')][_0x4c67('0x30')](_0x3cfe14['body'],{'include':[{'model':db[_0x4c67('0x3c')],'as':_0x4c67('0x37')},{'model':db[_0x4c67('0x3c')],'as':_0x4c67('0x3a')}]});}return null;})[_0x4c67('0xe')](respondWithResult(_0xee636,null))[_0x4c67('0x2c')](handleError(_0xee636,null));};function sanitizeRemoteUri(_0x1bbef3){var _0x18e8d1=_0x1bbef3['slice'](-0x1);if(_0x18e8d1==='/')return _0x1bbef3[_0x4c67('0x3d')](0x0,_0x1bbef3[_0x4c67('0x3e')](_0x18e8d1));return _0x1bbef3;}function getWebApiUrl(_0x44a04c){return util[_0x4c67('0x3f')]('%s/api/data/v9.0/',_0x44a04c);}exports[_0x4c67('0x40')]=function(_0x3b378e,_0x507e05){var _0x2d01bd=_0x3b378e[_0x4c67('0x18')][_0x4c67('0x41')];var _0x3e83e9=_0x2d01bd===_0x4c67('0x42')?'Incident':'PhoneCall';var _0x34378c='';var _0x5b3a17='';var _0x570256='';var _0x58d6ed='';var _0x348ff1='';var _0x44f33f='';var _0xb9fb19='';var _0x53f21d='';var _0x4aab55=[_0x4c67('0x43'),_0x4c67('0x44'),_0x4c67('0x45'),_0x4c67('0x46'),'caseorigincode',_0x4c67('0x47'),_0x4c67('0x48'),_0x4c67('0x49'),'directioncode',_0x4c67('0x4a')];var _0x17aaa6=[_0x4c67('0x4b'),'accountidyominame',_0x4c67('0x4c'),'billedserviceunits',_0x4c67('0x4d'),_0x4c67('0x4e'),'contractdetailidname',_0x4c67('0x4f'),_0x4c67('0x50'),_0x4c67('0x51'),_0x4c67('0x52'),_0x4c67('0x53'),'createdon',_0x4c67('0x54'),_0x4c67('0x55'),_0x4c67('0x56'),'customeridtype',_0x4c67('0x57'),_0x4c67('0x58'),_0x4c67('0x59'),_0x4c67('0x5a'),_0x4c67('0x5b'),_0x4c67('0x5c'),_0x4c67('0x5d'),'firstresponsebykpiidname',_0x4c67('0x5e'),_0x4c67('0x5f'),_0x4c67('0x60'),'kbarticleidname',_0x4c67('0x61'),_0x4c67('0x62'),_0x4c67('0x63'),_0x4c67('0x64'),'modifiedbyname','modifiedbyyominame','modifiedon',_0x4c67('0x65'),_0x4c67('0x66'),_0x4c67('0x67'),'msdyn_iotalertname',_0x4c67('0x68'),'onholdtime','overriddencreatedon',_0x4c67('0x69'),'owneridtype',_0x4c67('0x6a'),'parentcaseidname','primarycontactidname',_0x4c67('0x6b'),'prioritycodename',_0x4c67('0x6c'),_0x4c67('0x6d'),_0x4c67('0x6e'),_0x4c67('0x6f'),_0x4c67('0x70'),'responsiblecontactidname',_0x4c67('0x71'),_0x4c67('0x72'),'slainvokedidname','slaname',_0x4c67('0x73'),'statecode','statuscode',_0x4c67('0x74'),'ticketnumber',_0x4c67('0x75'),_0x4c67('0x76'),'traversedpath',_0x4c67('0x77'),'versionnumber'];var _0x5beaee=_0x4aab55[_0x4c67('0x78')](_0x17aaa6);return db['Dynamics365Account'][_0x4c67('0x79')]({'where':{'id':_0x3b378e[_0x4c67('0x2d')]['id']},'attributes':['id',_0x4c67('0x7a'),_0x4c67('0x7b'),'remoteUri','tenantId','clientId',_0x4c67('0x7c'),_0x4c67('0x7d')],'include':[{'model':db[_0x4c67('0x7e')],'as':_0x4c67('0x7e'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x507e05,null))['then'](function(_0x43ec65){if(_0x43ec65){if(_0x43ec65[_0x4c67('0x7d')]){_0x43ec65[_0x4c67('0x7f')]=_0x43ec65[_0x4c67('0x7e')][_0x4c67('0x80')];_0x53f21d=sanitizeRemoteUri(_0x43ec65[_0x4c67('0x7e')][_0x4c67('0x81')]);_0xb9fb19=getWebApiUrl(_0x53f21d);return _0x43ec65;}_0x53f21d=sanitizeRemoteUri(_0x43ec65[_0x4c67('0x82')]);_0xb9fb19=getWebApiUrl(_0x53f21d);var _0x2ed661={'method':_0x4c67('0x83'),'uri':'https://login.microsoftonline.com/'+_0x43ec65[_0x4c67('0x84')]+_0x4c67('0x85'),'form':{'client_id':_0x43ec65[_0x4c67('0x86')],'resource':_0x53f21d,'username':_0x43ec65['username'],'password':_0x43ec65[_0x4c67('0x7b')],'grant_type':'password','client_secret':_0x43ec65[_0x4c67('0x7c')]},'json':!![]};return rp(_0x2ed661);}})[_0x4c67('0xe')](function(_0x1e6ed1){_0x44f33f=_0x1e6ed1[_0x4c67('0x7f')];var _0x3f0b25={'method':_0x4c67('0x87'),'uri':encodeURI(_0xb9fb19+_0x4c67('0x88')+_0x3e83e9+'\x27'),'headers':{'Authorization':_0x4c67('0x89')+_0x44f33f,'If-None-Match':null,'OData-Version':_0x4c67('0x8a')},'json':!![]};return rp(_0x3f0b25);})['then'](function(_0x16e9fb){var _0x3defa1=_0x16e9fb[_0x4c67('0x8b')][0x0];var _0x4f4547=_0x3defa1[_0x4c67('0x8c')];var _0x48c49b={'method':_0x4c67('0x87'),'uri':_0xb9fb19+_0x4c67('0x8d')+_0x4f4547+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x4c67('0x89')+_0x44f33f,'If-None-Match':null,'OData-Version':_0x4c67('0x8a')},'json':!![]};return rp(_0x48c49b);})[_0x4c67('0xe')](function(_0x473ab5){_0x34378c=_0x473ab5;_0x5b3a17=_0x34378c[_0x4c67('0x8e')];_0x5b3a17=_[_0x4c67('0x8f')](_0x5b3a17,function(_0x330fb0){return!_0x5beaee[_0x4c67('0x90')](_0x330fb0[_0x4c67('0x91')]);});var _0x2e9efe=[];var _0x12a6b3=[];_0x5b3a17[_0x4c67('0x92')](function(_0x173d74){if(_0x173d74[_0x4c67('0x93')]){var _0x4c3b97=_0x173d74['@odata.type']['substring'](_0x173d74[_0x4c67('0x93')][_0x4c67('0x3e')]('.')+0x1);if(_0x4c3b97===_0x4c67('0x94')){_0x2e9efe[_0x4c67('0x95')](getSelectList(_0xb9fb19,_0x2d01bd,_0x12a6b3,_0x34378c[_0x4c67('0x8c')],_0x173d74[_0x4c67('0x8c')],_0x44f33f));}}});return Promise[_0x4c67('0x96')](_0x2e9efe);})['then'](function(_0x3d4a87){_0x570256=_0x3d4a87[0x0];var _0x395fa5=[];var _0x5d9b99=[];_0x5b3a17[_0x4c67('0x92')](function(_0x1dd848){if(!_['isNil'](_0x1dd848[_0x4c67('0x93')])){var _0x1b63a8=_0x1dd848[_0x4c67('0x93')][_0x4c67('0x3d')](_0x1dd848[_0x4c67('0x93')][_0x4c67('0x3e')]('.')+0x1);if(_0x1b63a8===_0x4c67('0x97')){_0x395fa5[_0x4c67('0x95')](getBooleanList(_0xb9fb19,_0x2d01bd,_0x5d9b99,_0x34378c['MetadataId'],_0x1dd848[_0x4c67('0x8c')],_0x44f33f));}}});return Promise[_0x4c67('0x96')](_0x395fa5);})[_0x4c67('0xe')](function(_0x1f263b){_0x58d6ed=_0x1f263b[0x0];var _0x2869e3=[];var _0x39a34a=[];_0x5b3a17[_0x4c67('0x92')](function(_0x3101e8){if(_0x3101e8[_0x4c67('0x93')]){var _0x37fc93=_0x3101e8[_0x4c67('0x93')][_0x4c67('0x3d')](_0x3101e8['@odata.type'][_0x4c67('0x3e')]('.')+0x1);if(_0x37fc93===_0x4c67('0x98')||_0x37fc93===_0x4c67('0x99')||_0x37fc93===_0x4c67('0x9a')||_0x37fc93===_0x4c67('0x9b')||_0x37fc93===_0x4c67('0x9c')||_0x37fc93===_0x4c67('0x9d')||_0x37fc93==='StatusAttributeMetadata'||_0x37fc93===_0x4c67('0x9e')||_0x37fc93===_0x4c67('0x9f')||_0x37fc93===_0x4c67('0xa0')){_0x2869e3['push'](getInputList(_0xb9fb19,_0x2d01bd,_0x37fc93,_0x39a34a,_0x34378c[_0x4c67('0x8c')],_0x3101e8[_0x4c67('0x8c')],_0x44f33f));}}});return Promise[_0x4c67('0x96')](_0x2869e3);})[_0x4c67('0xe')](function(_0x50b233){_0x348ff1=_0x50b233[0x0];var _0xd945e5=_0x570256[_0x4c67('0x78')](_0x58d6ed)['concat'](_0x348ff1);var _0xd52b1a={'count':_0xd945e5[_0x4c67('0x1f')],'rows':_0xd945e5};return _0xd52b1a;})[_0x4c67('0xe')](respondWithResult(_0x507e05,null))[_0x4c67('0x2c')](function(_0x40a926){var _0x1cd818=_0x3b378e[_0x4c67('0x18')][_0x4c67('0xa1')]?0x1f4:_0x40a926[_0x4c67('0xa2')]||0x1f4;logger[_0x4c67('0x11')](_0x40a926[_0x4c67('0xa3')]);delete _0x40a926[_0x4c67('0x12')];if(_0x1cd818===0x191){_0x1cd818=0x190;}_0x507e05[_0x4c67('0x7')](_0x1cd818)['send'](_0x3b378e[_0x4c67('0x18')]['test']?{'message':_0x4c67('0xa4'),'statusCode':_0x40a926[_0x4c67('0xa2')]}:_0x40a926);});};function getSelectList(_0xedaf43,_0x46840b,_0x45db1d,_0x42b38e,_0x5e3d49,_0x3eab0f){var _0x3f4362={'method':_0x4c67('0x87'),'uri':_0xedaf43+_0x4c67('0x8d')+_0x42b38e+_0x4c67('0xa5')+_0x5e3d49+_0x4c67('0xa6')+_0x4c67('0xa7'),'headers':{'Authorization':_0x4c67('0x89')+_0x3eab0f,'If-None-Match':null,'OData-Version':_0x4c67('0x8a')},'json':!![]};return rp(_0x3f4362)[_0x4c67('0xe')](function(_0x4efb4f){var _0x4b0299=[];var _0x1b7a52=_0x4efb4f[_0x4c67('0xa8')][_0x4c67('0xa9')];_0x1b7a52[_0x4c67('0x92')](function(_0x36a351){_0x4b0299[_0x4c67('0x95')]({'name':_0x36a351['Label'][_0x4c67('0xaa')][_0x4c67('0xab')],'value':String(_0x36a351[_0x4c67('0xac')])});});var _0x20ea85={'id':_0x46840b+'_'+_0x4efb4f[_0x4c67('0x91')],'name':_0x4efb4f[_0x4c67('0xad')][_0x4c67('0xaa')][_0x4c67('0xab')],'custom':![],'options':_0x4b0299};_0x45db1d[_0x4c67('0x95')](_0x20ea85);return _0x45db1d;});}function getBooleanList(_0x531ae8,_0x408101,_0x51e814,_0x4504e4,_0x28f84b,_0x2290a4){var _0x38cb70={'method':_0x4c67('0x87'),'uri':_0x531ae8+_0x4c67('0x8d')+_0x4504e4+')/Attributes('+_0x28f84b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4c67('0x89')+_0x2290a4,'If-None-Match':null,'OData-Version':_0x4c67('0x8a')},'json':!![]};return rp(_0x38cb70)['then'](function(_0x236a7e){var _0x5a04c8=[];_0x5a04c8['push']({'name':_0x236a7e[_0x4c67('0xa8')][_0x4c67('0xae')][_0x4c67('0xab')][_0x4c67('0xaa')][_0x4c67('0xab')],'value':'true'},{'name':_0x236a7e[_0x4c67('0xa8')][_0x4c67('0xaf')][_0x4c67('0xab')][_0x4c67('0xaa')][_0x4c67('0xab')],'value':_0x4c67('0xb0')});var _0x290942={'id':_0x408101+'_'+_0x236a7e[_0x4c67('0x91')],'name':_0x236a7e['DisplayName'][_0x4c67('0xaa')][_0x4c67('0xab')],'custom':![],'options':_0x5a04c8};_0x51e814[_0x4c67('0x95')](_0x290942);return _0x51e814;});}function getInputList(_0x24577b,_0x2b85b2,_0x344c1a,_0x52a71d,_0x17953b,_0x594daf,_0x5505fb){var _0x2b7acb={'method':'GET','uri':_0x24577b+_0x4c67('0x8d')+_0x17953b+_0x4c67('0xa5')+_0x594daf+_0x4c67('0xb1')+_0x344c1a+_0x4c67('0xb2'),'headers':{'Authorization':_0x4c67('0x89')+_0x5505fb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2b7acb)[_0x4c67('0xe')](function(_0x3e0911){var _0x1e0db6={'id':_0x2b85b2+'_'+_0x3e0911[_0x4c67('0x91')],'name':_0x3e0911[_0x4c67('0xad')][_0x4c67('0xaa')]?_0x3e0911[_0x4c67('0xad')][_0x4c67('0xaa')][_0x4c67('0xab')]:_0x3e0911['LogicalName'],'custom':![],'options':[]};_0x52a71d['push'](_0x1e0db6);return _0x52a71d;});} \ No newline at end of file +var _0xbb2d=['options','include','findAll','show','params','includeAll','find','catch','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','slice','lastIndexOf','format','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidyominame','prioritycodename','productidname','resolveby','responsiblecontactidname','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','false',')/Attributes(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter'];(function(_0x20713e,_0x44f710){var _0x7d998b=function(_0x5d98ab){while(--_0x5d98ab){_0x20713e['push'](_0x20713e['shift']());}};_0x7d998b(++_0x44f710);}(_0xbb2d,0x87));var _0xdbb2=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xbb2d[_0x152aa1];return _0x1bc01a;};'use strict';var rp=require(_0xdbb2('0x0'));var util=require('util');var _=require(_0xdbb2('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xdbb2('0x2'))(_0xdbb2('0x3'));var db=require(_0xdbb2('0x4'))['db'];var integrations=require(_0xdbb2('0x5'));function respondWithResult(_0x11b9ee,_0x51b26a){_0x51b26a=_0x51b26a||0xc8;return function(_0x33a945){if(_0x33a945){return _0x11b9ee[_0xdbb2('0x6')](_0x51b26a)['json'](_0x33a945);}};}function respondWithFilteredResult(_0x3e3de8,_0x2f89c9){return function(_0x2f3861){if(_0x2f3861){var _0x15394e=typeof _0x2f89c9[_0xdbb2('0x7')]===_0xdbb2('0x8')&&typeof _0x2f89c9[_0xdbb2('0x9')]==='undefined';var _0x42a1cc=_0x2f3861[_0xdbb2('0xa')];var _0x27aba4=_0x15394e?0x0:_0x2f89c9[_0xdbb2('0x7')];var _0x54893d=_0x15394e?_0x2f3861[_0xdbb2('0xa')]:_0x2f89c9[_0xdbb2('0x7')]+_0x2f89c9['limit'];var _0x1a6db2;if(_0x54893d>=_0x42a1cc){_0x54893d=_0x42a1cc;_0x1a6db2=0xc8;}else{_0x1a6db2=0xce;}_0x3e3de8[_0xdbb2('0x6')](_0x1a6db2);return _0x3e3de8['set'](_0xdbb2('0xb'),_0x27aba4+'-'+_0x54893d+'/'+_0x42a1cc)['json'](_0x2f3861);}return null;};}function saveUpdates(_0x411a93){return function(_0x9a27eb){if(_0x9a27eb){return _0x9a27eb[_0xdbb2('0xc')](_0x411a93)[_0xdbb2('0xd')](function(_0x119986){return _0x119986;});}return null;};}function removeEntity(_0x4cfec4){return function(_0x561dab){if(_0x561dab){return _0x561dab[_0xdbb2('0xe')]()[_0xdbb2('0xd')](function(){_0x4cfec4[_0xdbb2('0x6')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e5e5c){return function(_0x1e0981){if(!_0x1e0981){_0x4e5e5c[_0xdbb2('0xf')](0x194);}return _0x1e0981;};}function handleError(_0x52a824,_0x2a506d){_0x2a506d=_0x2a506d||0x1f4;return function(_0x1c7b75){logger[_0xdbb2('0x10')](_0x1c7b75[_0xdbb2('0x11')]);if(_0x1c7b75[_0xdbb2('0x12')]){delete _0x1c7b75[_0xdbb2('0x12')];}_0x52a824[_0xdbb2('0x6')](_0x2a506d)[_0xdbb2('0x13')](_0x1c7b75);};}exports[_0xdbb2('0x14')]=function(_0x3c84ae,_0x374383){var _0x26c5ad={},_0x2a0135={},_0x55f21c={'count':0x0,'rows':[]};var _0x15d182=_[_0xdbb2('0x15')](db[_0xdbb2('0x16')][_0xdbb2('0x17')],function(_0x55c62c){return{'name':_0x55c62c[_0xdbb2('0x18')],'type':_0x55c62c[_0xdbb2('0x19')][_0xdbb2('0x1a')]};});_0x2a0135[_0xdbb2('0x1b')]=_[_0xdbb2('0x15')](_0x15d182,_0xdbb2('0x12'));_0x2a0135[_0xdbb2('0x1c')]=_[_0xdbb2('0x1d')](_0x3c84ae[_0xdbb2('0x1c')]);_0x2a0135[_0xdbb2('0x1e')]=_[_0xdbb2('0x1f')](_0x2a0135[_0xdbb2('0x1b')],_0x2a0135[_0xdbb2('0x1c')]);_0x26c5ad[_0xdbb2('0x20')]=_[_0xdbb2('0x1f')](_0x2a0135[_0xdbb2('0x1b')],qs[_0xdbb2('0x21')](_0x3c84ae[_0xdbb2('0x1c')][_0xdbb2('0x21')]));_0x26c5ad[_0xdbb2('0x20')]=_0x26c5ad['attributes'][_0xdbb2('0x22')]?_0x26c5ad[_0xdbb2('0x20')]:_0x2a0135['model'];if(!_0x3c84ae[_0xdbb2('0x1c')][_0xdbb2('0x23')](_0xdbb2('0x24'))){_0x26c5ad[_0xdbb2('0x9')]=qs['limit'](_0x3c84ae[_0xdbb2('0x1c')]['limit']);_0x26c5ad[_0xdbb2('0x7')]=qs['offset'](_0x3c84ae[_0xdbb2('0x1c')][_0xdbb2('0x7')]);}_0x26c5ad[_0xdbb2('0x25')]=qs[_0xdbb2('0x26')](_0x3c84ae[_0xdbb2('0x1c')]['sort']);_0x26c5ad['where']=qs['filters'](_['pick'](_0x3c84ae[_0xdbb2('0x1c')],_0x2a0135[_0xdbb2('0x1e')]),_0x15d182);if(_0x3c84ae[_0xdbb2('0x1c')]['filter']){_0x26c5ad[_0xdbb2('0x27')]=_[_0xdbb2('0x28')](_0x26c5ad['where'],{'$or':_['map'](_0x15d182,function(_0x280169){if(_0x280169['type']!=='VIRTUAL'){var _0x10c417={};_0x10c417[_0x280169[_0xdbb2('0x12')]]={'$like':'%'+_0x3c84ae[_0xdbb2('0x1c')][_0xdbb2('0x29')]+'%'};return _0x10c417;}})});}_0x26c5ad=_[_0xdbb2('0x28')]({},_0x26c5ad,_0x3c84ae[_0xdbb2('0x2a')]);var _0x4db642={'where':_0x26c5ad[_0xdbb2('0x27')]};return db[_0xdbb2('0x16')][_0xdbb2('0xa')](_0x4db642)['then'](function(_0x1e8b6d){_0x55f21c[_0xdbb2('0xa')]=_0x1e8b6d;if(_0x3c84ae[_0xdbb2('0x1c')]['includeAll']){_0x26c5ad[_0xdbb2('0x2b')]=[{'all':!![]}];}return db[_0xdbb2('0x16')][_0xdbb2('0x2c')](_0x26c5ad);})['then'](function(_0x2874e9){_0x55f21c['rows']=_0x2874e9;return _0x55f21c;})[_0xdbb2('0xd')](respondWithFilteredResult(_0x374383,_0x26c5ad))['catch'](handleError(_0x374383,null));};exports[_0xdbb2('0x2d')]=function(_0x285e9c,_0x1b9aca){var _0x4890db={'raw':![],'where':{'id':_0x285e9c[_0xdbb2('0x2e')]['id']}},_0x47e2a0={};_0x47e2a0['model']=_[_0xdbb2('0x1d')](db['Dynamics365Account'][_0xdbb2('0x17')]);_0x47e2a0[_0xdbb2('0x1c')]=_[_0xdbb2('0x1d')](_0x285e9c[_0xdbb2('0x1c')]);_0x47e2a0['filters']=_[_0xdbb2('0x1f')](_0x47e2a0['model'],_0x47e2a0[_0xdbb2('0x1c')]);_0x4890db[_0xdbb2('0x20')]=_[_0xdbb2('0x1f')](_0x47e2a0['model'],qs[_0xdbb2('0x21')](_0x285e9c[_0xdbb2('0x1c')]['fields']));_0x4890db['attributes']=_0x4890db[_0xdbb2('0x20')][_0xdbb2('0x22')]?_0x4890db[_0xdbb2('0x20')]:_0x47e2a0[_0xdbb2('0x1b')];if(_0x285e9c[_0xdbb2('0x1c')][_0xdbb2('0x2f')]){_0x4890db[_0xdbb2('0x2b')]=[{'all':!![]}];}_0x4890db=_[_0xdbb2('0x28')]({},_0x4890db,_0x285e9c[_0xdbb2('0x2a')]);return db['Dynamics365Account'][_0xdbb2('0x30')](_0x4890db)[_0xdbb2('0xd')](handleEntityNotFound(_0x1b9aca,null))[_0xdbb2('0xd')](respondWithResult(_0x1b9aca,null))[_0xdbb2('0x31')](handleError(_0x1b9aca,null));};exports[_0xdbb2('0x32')]=function(_0x46ab87,_0xb19a0f){return db[_0xdbb2('0x16')][_0xdbb2('0x32')](_0x46ab87[_0xdbb2('0x33')],{})[_0xdbb2('0xd')](respondWithResult(_0xb19a0f,0xc9))[_0xdbb2('0x31')](handleError(_0xb19a0f,null));};exports['update']=function(_0x5702d2,_0x124cc6){if(_0x5702d2[_0xdbb2('0x33')]['id']){delete _0x5702d2[_0xdbb2('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5702d2['params']['id']}})['then'](handleEntityNotFound(_0x124cc6,null))[_0xdbb2('0xd')](saveUpdates(_0x5702d2[_0xdbb2('0x33')],null))[_0xdbb2('0xd')](respondWithResult(_0x124cc6,null))[_0xdbb2('0x31')](handleError(_0x124cc6,null));};exports['destroy']=function(_0x5c7273,_0x580b2f){return db[_0xdbb2('0x16')]['find']({'where':{'id':_0x5c7273[_0xdbb2('0x2e')]['id']}})[_0xdbb2('0xd')](handleEntityNotFound(_0x580b2f,null))[_0xdbb2('0xd')](removeEntity(_0x580b2f,null))[_0xdbb2('0x31')](handleError(_0x580b2f,null));};exports[_0xdbb2('0x34')]=function(_0x4836ba,_0x21d91c){var _0x1b9a82={};var _0x3ca206={};var _0x44eec1;var _0xefe370;return db[_0xdbb2('0x16')][_0xdbb2('0x35')]({'where':{'id':_0x4836ba['params']['id']}})['then'](handleEntityNotFound(_0x21d91c,null))['then'](function(_0x6f7cdc){if(_0x6f7cdc){_0x44eec1=_0x6f7cdc;_0x3ca206[_0xdbb2('0x1b')]=_['keys'](db[_0xdbb2('0x36')][_0xdbb2('0x17')]);_0x3ca206[_0xdbb2('0x1c')]=_[_0xdbb2('0x1d')](_0x4836ba[_0xdbb2('0x1c')]);_0x3ca206[_0xdbb2('0x1e')]=_[_0xdbb2('0x1f')](_0x3ca206[_0xdbb2('0x1b')],_0x3ca206[_0xdbb2('0x1c')]);_0x1b9a82[_0xdbb2('0x20')]=_[_0xdbb2('0x1f')](_0x3ca206['model'],qs['fields'](_0x4836ba[_0xdbb2('0x1c')][_0xdbb2('0x21')]));_0x1b9a82[_0xdbb2('0x20')]=_0x1b9a82[_0xdbb2('0x20')][_0xdbb2('0x22')]?_0x1b9a82[_0xdbb2('0x20')]:_0x3ca206['model'];_0x1b9a82[_0xdbb2('0x25')]=qs[_0xdbb2('0x26')](_0x4836ba[_0xdbb2('0x1c')][_0xdbb2('0x26')]);_0x1b9a82[_0xdbb2('0x27')]=qs[_0xdbb2('0x1e')](_['pick'](_0x4836ba['query'],_0x3ca206[_0xdbb2('0x1e')]));if(_0x4836ba['query'][_0xdbb2('0x29')]){_0x1b9a82[_0xdbb2('0x27')]=_['merge'](_0x1b9a82[_0xdbb2('0x27')],{'$or':_['map'](_0x1b9a82[_0xdbb2('0x20')],function(_0x1f7cce){var _0x2da4d0={};_0x2da4d0[_0x1f7cce]={'$like':'%'+_0x4836ba['query']['filter']+'%'};return _0x2da4d0;})});}_0x1b9a82=_[_0xdbb2('0x28')]({},_0x1b9a82,_0x4836ba['options']);return _0x44eec1[_0xdbb2('0x34')](_0x1b9a82);}})[_0xdbb2('0xd')](function(_0x11cd1d){if(_0x11cd1d){_0xefe370=_0x11cd1d['length'];if(!_0x4836ba[_0xdbb2('0x1c')][_0xdbb2('0x23')](_0xdbb2('0x24'))){_0x1b9a82['limit']=qs[_0xdbb2('0x9')](_0x4836ba['query'][_0xdbb2('0x9')]);_0x1b9a82[_0xdbb2('0x7')]=qs[_0xdbb2('0x7')](_0x4836ba[_0xdbb2('0x1c')][_0xdbb2('0x7')]);}return _0x44eec1[_0xdbb2('0x34')](_0x1b9a82);}})[_0xdbb2('0xd')](function(_0x547259){if(_0x547259){return _0x547259?{'count':_0xefe370,'rows':_0x547259}:null;}})[_0xdbb2('0xd')](respondWithResult(_0x21d91c,null))[_0xdbb2('0x31')](handleError(_0x21d91c,null));};exports[_0xdbb2('0x37')]=function(_0x495ba3,_0x39673d){if(_0x495ba3[_0xdbb2('0x33')]['id']){delete _0x495ba3[_0xdbb2('0x33')]['id'];}return db[_0xdbb2('0x16')][_0xdbb2('0x35')]({'where':{'id':_0x495ba3[_0xdbb2('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39673d,null))[_0xdbb2('0xd')](function(_0x141339){if(_0x141339){_0x495ba3['body'][_0xdbb2('0x38')]=_0x141339['id'];_0x495ba3[_0xdbb2('0x33')][_0xdbb2('0x39')]=integrations[_0xdbb2('0x3a')](_0x495ba3['body']['channel'],_0x495ba3[_0xdbb2('0x33')][_0xdbb2('0x19')]);_0x495ba3[_0xdbb2('0x33')][_0xdbb2('0x3b')]=integrations[_0xdbb2('0x3c')](_0x495ba3[_0xdbb2('0x33')]['channel'],_0x495ba3['body'][_0xdbb2('0x19')]);return db[_0xdbb2('0x36')][_0xdbb2('0x32')](_0x495ba3[_0xdbb2('0x33')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xdbb2('0x3d')],'as':_0xdbb2('0x3b')}]});}return null;})['then'](respondWithResult(_0x39673d,null))['catch'](handleError(_0x39673d,null));};function sanitizeRemoteUri(_0x4ade2e){var _0x322597=_0x4ade2e[_0xdbb2('0x3e')](-0x1);if(_0x322597==='/')return _0x4ade2e['substring'](0x0,_0x4ade2e[_0xdbb2('0x3f')](_0x322597));return _0x4ade2e;}function getWebApiUrl(_0xef7a5d){return util[_0xdbb2('0x40')]('%s/api/data/v9.0/',_0xef7a5d);}exports['getFields']=function(_0xa5874a,_0x20ed20){var _0x2cb45a=_0xa5874a['query'][_0xdbb2('0x41')];var _0x5f2238=_0x2cb45a===_0xdbb2('0x42')?_0xdbb2('0x43'):_0xdbb2('0x44');var _0x582763='';var _0x5e20ff='';var _0x324338='';var _0xe449f9='';var _0x53d467='';var _0x4f15d1='';var _0x24824d='';var _0x76f518='';var _0xd4cb1c=[_0xdbb2('0x45'),_0xdbb2('0x46'),_0xdbb2('0x47'),'ownerid',_0xdbb2('0x48'),_0xdbb2('0x49'),'phonenumber',_0xdbb2('0x4a'),_0xdbb2('0x4b'),_0xdbb2('0x4c')];var _0x532bbe=[_0xdbb2('0x4d'),_0xdbb2('0x4e'),'actualserviceunits','billedserviceunits','contactidname','contactidyominame',_0xdbb2('0x4f'),_0xdbb2('0x50'),'createdbyexternalpartyname',_0xdbb2('0x51'),'createdbyname',_0xdbb2('0x52'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype',_0xdbb2('0x53'),_0xdbb2('0x54'),_0xdbb2('0x55'),'entityimage_timestamp',_0xdbb2('0x56'),_0xdbb2('0x57'),_0xdbb2('0x58'),_0xdbb2('0x59'),_0xdbb2('0x5a'),_0xdbb2('0x5b'),_0xdbb2('0x5c'),_0xdbb2('0x5d'),_0xdbb2('0x5e'),_0xdbb2('0x5f'),'modifiedbyexternalpartyname',_0xdbb2('0x60'),_0xdbb2('0x61'),_0xdbb2('0x62'),_0xdbb2('0x63'),_0xdbb2('0x64'),'modifiedonbehalfbyyominame',_0xdbb2('0x65'),'msdyn_iotalertname','numberofchildincidents',_0xdbb2('0x66'),_0xdbb2('0x67'),_0xdbb2('0x68'),_0xdbb2('0x69'),'owneridyominame','parentcaseidname','primarycontactidname',_0xdbb2('0x6a'),_0xdbb2('0x6b'),_0xdbb2('0x6c'),'productserialnumber',_0xdbb2('0x6d'),'resolvebykpiidname','responseby',_0xdbb2('0x6e'),'responsiblecontactidyominame',_0xdbb2('0x6f'),_0xdbb2('0x70'),'slaname','socialprofileidname',_0xdbb2('0x71'),_0xdbb2('0x72'),_0xdbb2('0x73'),_0xdbb2('0x74'),_0xdbb2('0x75'),_0xdbb2('0x76'),'traversedpath','utcconversiontimezonecode',_0xdbb2('0x77')];var _0x3bb8ab=_0xd4cb1c[_0xdbb2('0x78')](_0x532bbe);return db[_0xdbb2('0x16')][_0xdbb2('0x35')]({'where':{'id':_0xa5874a[_0xdbb2('0x2e')]['id']},'attributes':['id','username',_0xdbb2('0x79'),'remoteUri',_0xdbb2('0x7a'),_0xdbb2('0x7b'),_0xdbb2('0x7c'),_0xdbb2('0x7d')],'include':[{'model':db[_0xdbb2('0x7e')],'as':_0xdbb2('0x7e'),'attributes':['id',_0xdbb2('0x7f'),_0xdbb2('0x80')]}]})[_0xdbb2('0xd')](handleEntityNotFound(_0x20ed20,null))[_0xdbb2('0xd')](function(_0x13758e){if(_0x13758e){if(_0x13758e[_0xdbb2('0x7d')]){_0x13758e[_0xdbb2('0x81')]=_0x13758e['CloudProvider'][_0xdbb2('0x7f')];_0x76f518=sanitizeRemoteUri(_0x13758e[_0xdbb2('0x7e')]['data7']);_0x24824d=getWebApiUrl(_0x76f518);return _0x13758e;}_0x76f518=sanitizeRemoteUri(_0x13758e['remoteUri']);_0x24824d=getWebApiUrl(_0x76f518);var _0x52dd1d={'method':_0xdbb2('0x82'),'uri':_0xdbb2('0x83')+_0x13758e[_0xdbb2('0x7a')]+_0xdbb2('0x84'),'form':{'client_id':_0x13758e[_0xdbb2('0x7b')],'resource':_0x76f518,'username':_0x13758e[_0xdbb2('0x85')],'password':_0x13758e[_0xdbb2('0x79')],'grant_type':_0xdbb2('0x79'),'client_secret':_0x13758e[_0xdbb2('0x7c')]},'json':!![]};return rp(_0x52dd1d);}})['then'](function(_0x2ae837){_0x4f15d1=_0x2ae837['access_token'];var _0x4306e5={'method':'GET','uri':encodeURI(_0x24824d+_0xdbb2('0x86')+_0x5f2238+'\x27'),'headers':{'Authorization':_0xdbb2('0x87')+_0x4f15d1,'If-None-Match':null,'OData-Version':_0xdbb2('0x88')},'json':!![]};return rp(_0x4306e5);})[_0xdbb2('0xd')](function(_0x556f93){var _0x4b2726=_0x556f93[_0xdbb2('0x89')][0x0];var _0x12da48=_0x4b2726[_0xdbb2('0x8a')];var _0x2d9b7f={'method':_0xdbb2('0x8b'),'uri':_0x24824d+_0xdbb2('0x8c')+_0x12da48+_0xdbb2('0x8d'),'headers':{'Authorization':_0xdbb2('0x87')+_0x4f15d1,'If-None-Match':null,'OData-Version':_0xdbb2('0x88')},'json':!![]};return rp(_0x2d9b7f);})[_0xdbb2('0xd')](function(_0x40eb41){_0x582763=_0x40eb41;_0x5e20ff=_0x582763['Attributes'];_0x5e20ff=_[_0xdbb2('0x8e')](_0x5e20ff,function(_0x563e2e){return!_0x3bb8ab['includes'](_0x563e2e[_0xdbb2('0x8f')]);});var _0x250bda=[];var _0x25187a=[];_0x5e20ff[_0xdbb2('0x90')](function(_0x17e976){if(_0x17e976['@odata.type']){var _0x14ccc2=_0x17e976[_0xdbb2('0x91')][_0xdbb2('0x92')](_0x17e976[_0xdbb2('0x91')][_0xdbb2('0x3f')]('.')+0x1);if(_0x14ccc2===_0xdbb2('0x93')){_0x250bda[_0xdbb2('0x94')](getSelectList(_0x24824d,_0x2cb45a,_0x25187a,_0x582763[_0xdbb2('0x8a')],_0x17e976[_0xdbb2('0x8a')],_0x4f15d1));}}});return Promise[_0xdbb2('0x95')](_0x250bda);})[_0xdbb2('0xd')](function(_0x3a0f03){_0x324338=_0x3a0f03[0x0];var _0x48f92c=[];var _0x50f1da=[];_0x5e20ff[_0xdbb2('0x90')](function(_0x243f29){if(!_[_0xdbb2('0x96')](_0x243f29['@odata.type'])){var _0x2f174c=_0x243f29['@odata.type'][_0xdbb2('0x92')](_0x243f29[_0xdbb2('0x91')]['lastIndexOf']('.')+0x1);if(_0x2f174c===_0xdbb2('0x97')){_0x48f92c[_0xdbb2('0x94')](getBooleanList(_0x24824d,_0x2cb45a,_0x50f1da,_0x582763[_0xdbb2('0x8a')],_0x243f29[_0xdbb2('0x8a')],_0x4f15d1));}}});return Promise[_0xdbb2('0x95')](_0x48f92c);})['then'](function(_0x1b89c6){_0xe449f9=_0x1b89c6[0x0];var _0x3d3fe9=[];var _0x32fd44=[];_0x5e20ff[_0xdbb2('0x90')](function(_0x2ab226){if(_0x2ab226[_0xdbb2('0x91')]){var _0x53eb34=_0x2ab226[_0xdbb2('0x91')]['substring'](_0x2ab226[_0xdbb2('0x91')][_0xdbb2('0x3f')]('.')+0x1);if(_0x53eb34===_0xdbb2('0x98')||_0x53eb34===_0xdbb2('0x99')||_0x53eb34==='BigIntAttributeMetadata'||_0x53eb34===_0xdbb2('0x9a')||_0x53eb34==='MemoAttributeMetadata'||_0x53eb34===_0xdbb2('0x9b')||_0x53eb34==='StatusAttributeMetadata'||_0x53eb34===_0xdbb2('0x9c')||_0x53eb34===_0xdbb2('0x9d')||_0x53eb34===_0xdbb2('0x9e')){_0x3d3fe9[_0xdbb2('0x94')](getInputList(_0x24824d,_0x2cb45a,_0x53eb34,_0x32fd44,_0x582763['MetadataId'],_0x2ab226['MetadataId'],_0x4f15d1));}}});return Promise[_0xdbb2('0x95')](_0x3d3fe9);})[_0xdbb2('0xd')](function(_0x499399){_0x53d467=_0x499399[0x0];var _0x579e6c=_0x324338[_0xdbb2('0x78')](_0xe449f9)['concat'](_0x53d467);var _0x523633={'count':_0x579e6c[_0xdbb2('0x22')],'rows':_0x579e6c};return _0x523633;})[_0xdbb2('0xd')](respondWithResult(_0x20ed20,null))[_0xdbb2('0x31')](function(_0x50228c){var _0x2dbad3=_0xa5874a[_0xdbb2('0x1c')][_0xdbb2('0x9f')]?0x1f4:_0x50228c[_0xdbb2('0xa0')]||0x1f4;logger[_0xdbb2('0x10')](_0x50228c[_0xdbb2('0x11')]);delete _0x50228c[_0xdbb2('0x12')];if(_0x2dbad3===0x191){_0x2dbad3=0x190;}_0x20ed20['status'](_0x2dbad3)[_0xdbb2('0x13')](_0xa5874a[_0xdbb2('0x1c')][_0xdbb2('0x9f')]?{'message':'Wrong\x20credentials','statusCode':_0x50228c['statusCode']}:_0x50228c);});};function getSelectList(_0x223558,_0x3ff52f,_0x7e5d8,_0x4c8cad,_0x5bde1e,_0x380517){var _0x244266={'method':_0xdbb2('0x8b'),'uri':_0x223558+_0xdbb2('0x8c')+_0x4c8cad+')/Attributes('+_0x5bde1e+_0xdbb2('0xa1')+_0xdbb2('0xa2'),'headers':{'Authorization':_0xdbb2('0x87')+_0x380517,'If-None-Match':null,'OData-Version':_0xdbb2('0x88')},'json':!![]};return rp(_0x244266)[_0xdbb2('0xd')](function(_0x1920bc){var _0x434353=[];var _0x23327e=_0x1920bc['OptionSet'][_0xdbb2('0xa3')];_0x23327e[_0xdbb2('0x90')](function(_0xa1c8b7){_0x434353[_0xdbb2('0x94')]({'name':_0xa1c8b7[_0xdbb2('0xa4')]['UserLocalizedLabel'][_0xdbb2('0xa4')],'value':String(_0xa1c8b7[_0xdbb2('0xa5')])});});var _0x289454={'id':_0x3ff52f+'_'+_0x1920bc[_0xdbb2('0x8f')],'name':_0x1920bc[_0xdbb2('0xa6')][_0xdbb2('0xa7')][_0xdbb2('0xa4')],'custom':![],'options':_0x434353};_0x7e5d8[_0xdbb2('0x94')](_0x289454);return _0x7e5d8;});}function getBooleanList(_0x3b3284,_0x2e492d,_0x4f78e5,_0x3e2191,_0x40f83c,_0x48659e){var _0x2bc354={'method':_0xdbb2('0x8b'),'uri':_0x3b3284+_0xdbb2('0x8c')+_0x3e2191+')/Attributes('+_0x40f83c+_0xdbb2('0xa8'),'headers':{'Authorization':_0xdbb2('0x87')+_0x48659e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2bc354)['then'](function(_0x76ec2c){var _0x51f1d0=[];_0x51f1d0[_0xdbb2('0x94')]({'name':_0x76ec2c[_0xdbb2('0xa9')][_0xdbb2('0xaa')][_0xdbb2('0xa4')]['UserLocalizedLabel'][_0xdbb2('0xa4')],'value':_0xdbb2('0xab')},{'name':_0x76ec2c[_0xdbb2('0xa9')][_0xdbb2('0xac')][_0xdbb2('0xa4')][_0xdbb2('0xa7')][_0xdbb2('0xa4')],'value':_0xdbb2('0xad')});var _0x3ce312={'id':_0x2e492d+'_'+_0x76ec2c[_0xdbb2('0x8f')],'name':_0x76ec2c[_0xdbb2('0xa6')][_0xdbb2('0xa7')][_0xdbb2('0xa4')],'custom':![],'options':_0x51f1d0};_0x4f78e5[_0xdbb2('0x94')](_0x3ce312);return _0x4f78e5;});}function getInputList(_0x500900,_0x5a33d9,_0x46391e,_0x1e8819,_0x38d855,_0x2efa9a,_0x51e348){var _0x3800a1={'method':'GET','uri':_0x500900+_0xdbb2('0x8c')+_0x38d855+_0xdbb2('0xae')+_0x2efa9a+_0xdbb2('0xaf')+_0x46391e+_0xdbb2('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x51e348,'If-None-Match':null,'OData-Version':_0xdbb2('0x88')},'json':!![]};return rp(_0x3800a1)['then'](function(_0x4c9f3b){var _0x5f54c2={'id':_0x5a33d9+'_'+_0x4c9f3b[_0xdbb2('0x8f')],'name':_0x4c9f3b[_0xdbb2('0xa6')][_0xdbb2('0xa7')]?_0x4c9f3b[_0xdbb2('0xa6')][_0xdbb2('0xa7')][_0xdbb2('0xa4')]:_0x4c9f3b[_0xdbb2('0x8f')],'custom':![],'options':[]};_0x1e8819['push'](_0x5f54c2);return _0x1e8819;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 9caf1ea..782a579 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2c3f58,_0x2c4e4b){var _0x4bea39=function(_0x2f3107){while(--_0x2f3107){_0x2c3f58['push'](_0x2c3f58['shift']());}};_0x4bea39(++_0x2c4e4b);}(_0x757a,0xde));var _0xa757=function(_0x13b39d,_0x2daea8){_0x13b39d=_0x13b39d-0x0;var _0xd4df1e=_0x757a[_0x13b39d];return _0xd4df1e;};'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'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x24e925,_0x5e6165){var _0x45abcc=function(_0x166ec4){while(--_0x166ec4){_0x24e925['push'](_0x24e925['shift']());}};_0x45abcc(++_0x5e6165);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xcb91[_0x5581ba];return _0x1e927f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e78046d..9d3a014 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 _0x7c2a=['message','result','findAll','options','where','attributes','limit','include','map','model','GetDynamics365Account','catch','ShowDynamics365Account','Dynamics365Account','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2afdb1,_0x4f3aac){var _0x2917d2=function(_0x95bf28){while(--_0x95bf28){_0x2afdb1['push'](_0x2afdb1['shift']());}};_0x2917d2(++_0x4f3aac);}(_0x7c2a,0x128));var _0xa7c2=function(_0x466deb,_0x40cf86){_0x466deb=_0x466deb-0x0;var _0x19cb41=_0x7c2a[_0x466deb];return _0x19cb41;};'use strict';var _=require(_0xa7c2('0x0'));var util=require(_0xa7c2('0x1'));var moment=require(_0xa7c2('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7c2('0x3'));var fs=require('fs');var Redis=require(_0xa7c2('0x4'));var db=require(_0xa7c2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7c2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa7c2('0x7'));var client=jayson[_0xa7c2('0x8')][_0xa7c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491de9,_0x4575b3,_0x5a1035){return new BPromise(function(_0x2f2d49,_0x27795d){return client[_0xa7c2('0xa')](_0x491de9,_0x5a1035)[_0xa7c2('0xb')](function(_0x2ed013){logger[_0xa7c2('0xc')](_0xa7c2('0xd'),_0x4575b3,_0xa7c2('0xe'));logger[_0xa7c2('0xf')](_0xa7c2('0x10'),_0x4575b3,_0xa7c2('0xe'),JSON[_0xa7c2('0x11')](_0x2ed013));if(_0x2ed013[_0xa7c2('0x12')]){if(_0x2ed013['error']['code']===0x1f4){logger['error'](_0xa7c2('0xd'),_0x4575b3,_0x2ed013[_0xa7c2('0x12')][_0xa7c2('0x13')]);return _0x27795d(_0x2ed013[_0xa7c2('0x12')]['message']);}logger[_0xa7c2('0x12')](_0xa7c2('0xd'),_0x4575b3,_0x2ed013[_0xa7c2('0x12')]['message']);return _0x2f2d49(_0x2ed013[_0xa7c2('0x12')][_0xa7c2('0x13')]);}else{logger['info'](_0xa7c2('0xd'),_0x4575b3,_0xa7c2('0xe'));_0x2f2d49(_0x2ed013[_0xa7c2('0x14')][_0xa7c2('0x13')]);}})['catch'](function(_0x3eab0f){logger[_0xa7c2('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x4575b3,_0x3eab0f);_0x27795d(_0x3eab0f);});});}exports['GetDynamics365Account']=function(_0x145b36){var _0x283b2d=this;return new Promise(function(_0x29b6f6,_0x4502e4){return db['Dynamics365Account'][_0xa7c2('0x15')]({'raw':_0x145b36[_0xa7c2('0x16')]?_0x145b36[_0xa7c2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x145b36[_0xa7c2('0x16')]?_0x145b36[_0xa7c2('0x16')][_0xa7c2('0x17')]||null:null,'attributes':_0x145b36[_0xa7c2('0x16')]?_0x145b36[_0xa7c2('0x16')][_0xa7c2('0x18')]||null:null,'limit':_0x145b36[_0xa7c2('0x16')]?_0x145b36['options'][_0xa7c2('0x19')]||null:null,'include':_0x145b36[_0xa7c2('0x16')]?_0x145b36[_0xa7c2('0x16')][_0xa7c2('0x1a')]?_[_0xa7c2('0x1b')](_0x145b36[_0xa7c2('0x16')][_0xa7c2('0x1a')],function(_0x5ad7e7){return{'model':db[_0x5ad7e7[_0xa7c2('0x1c')]],'as':_0x5ad7e7['as'],'attributes':_0x5ad7e7[_0xa7c2('0x18')],'include':_0x5ad7e7[_0xa7c2('0x1a')]?_[_0xa7c2('0x1b')](_0x5ad7e7['include'],function(_0x13cc12){return{'model':db[_0x13cc12[_0xa7c2('0x1c')]],'as':_0x13cc12['as'],'attributes':_0x13cc12['attributes'],'include':_0x13cc12[_0xa7c2('0x1a')]?_[_0xa7c2('0x1b')](_0x13cc12['include'],function(_0x2d3424){return{'model':db[_0x2d3424[_0xa7c2('0x1c')]],'as':_0x2d3424['as'],'attributes':_0x2d3424[_0xa7c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa7c2('0xb')](function(_0x4e80d2){logger[_0xa7c2('0xc')](_0xa7c2('0x1d'),_0x145b36);logger[_0xa7c2('0xf')](_0xa7c2('0x1d'),_0x145b36,JSON[_0xa7c2('0x11')](_0x4e80d2));_0x29b6f6(_0x4e80d2);})[_0xa7c2('0x1e')](function(_0x1ec03f){logger[_0xa7c2('0x12')]('GetDynamics365Account',_0x1ec03f[_0xa7c2('0x13')],_0x145b36);_0x4502e4(_0x283b2d[_0xa7c2('0x12')](0x1f4,_0x1ec03f[_0xa7c2('0x13')]));});});};exports[_0xa7c2('0x1f')]=function(_0x482c52){var _0x198f4f=this;return new Promise(function(_0x9ed1a9,_0x439ae0){return db[_0xa7c2('0x20')][_0xa7c2('0x21')]({'raw':_0x482c52[_0xa7c2('0x16')]?_0x482c52['options'][_0xa7c2('0x22')]===undefined?!![]:![]:!![],'where':_0x482c52[_0xa7c2('0x16')]?_0x482c52[_0xa7c2('0x16')][_0xa7c2('0x17')]||null:null,'attributes':_0x482c52[_0xa7c2('0x16')]?_0x482c52[_0xa7c2('0x16')]['attributes']||null:null,'include':_0x482c52[_0xa7c2('0x16')]?_0x482c52[_0xa7c2('0x16')]['include']?_[_0xa7c2('0x1b')](_0x482c52['options'][_0xa7c2('0x1a')],function(_0x393618){return{'model':db[_0x393618[_0xa7c2('0x1c')]],'as':_0x393618['as'],'attributes':_0x393618[_0xa7c2('0x18')],'include':_0x393618[_0xa7c2('0x1a')]?_[_0xa7c2('0x1b')](_0x393618[_0xa7c2('0x1a')],function(_0xdf3e6){return{'model':db[_0xdf3e6[_0xa7c2('0x1c')]],'as':_0xdf3e6['as'],'attributes':_0xdf3e6[_0xa7c2('0x18')],'include':_0xdf3e6[_0xa7c2('0x1a')]?_[_0xa7c2('0x1b')](_0xdf3e6['include'],function(_0x3d29ea){return{'model':db[_0x3d29ea['model']],'as':_0x3d29ea['as'],'attributes':_0x3d29ea[_0xa7c2('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa7c2('0xb')](function(_0xdd3b21){logger[_0xa7c2('0xc')](_0xa7c2('0x1f'),_0x482c52);logger[_0xa7c2('0xf')](_0xa7c2('0x1f'),_0x482c52,JSON[_0xa7c2('0x11')](_0xdd3b21));_0x9ed1a9(_0xdd3b21);})[_0xa7c2('0x1e')](function(_0x43c93b){logger['error'](_0xa7c2('0x1f'),_0x43c93b[_0xa7c2('0x13')],_0x482c52);_0x439ae0(_0x198f4f[_0xa7c2('0x12')](0x1f4,_0x43c93b[_0xa7c2('0x13')]));});});}; \ No newline at end of file +var _0xea60=['Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','where','limit','map','include','model','attributes','info','stringify','ShowDynamics365Account','find','raw','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x579827,_0x59df04){var _0x340791=function(_0x2d11ae){while(--_0x2d11ae){_0x579827['push'](_0x579827['shift']());}};_0x340791(++_0x59df04);}(_0xea60,0x14f));var _0x0ea6=function(_0x313d00,_0x4c0546){_0x313d00=_0x313d00-0x0;var _0x12e8c8=_0xea60[_0x313d00];return _0x12e8c8;};'use strict';var _=require('lodash');var util=require(_0x0ea6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0ea6('0x1'));var fs=require('fs');var Redis=require(_0x0ea6('0x2'));var db=require(_0x0ea6('0x3'))['db'];var utils=require(_0x0ea6('0x4'));var logger=require(_0x0ea6('0x5'))('rpc');var config=require(_0x0ea6('0x6'));var jayson=require(_0x0ea6('0x7'));var client=jayson[_0x0ea6('0x8')][_0x0ea6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1442f3,_0x51f699,_0x5db27d){return new BPromise(function(_0xf456f9,_0xce75cd){return client[_0x0ea6('0xa')](_0x1442f3,_0x5db27d)[_0x0ea6('0xb')](function(_0xd4d542){logger['info'](_0x0ea6('0xc'),_0x51f699,_0x0ea6('0xd'));logger[_0x0ea6('0xe')](_0x0ea6('0xf'),_0x51f699,_0x0ea6('0xd'),JSON['stringify'](_0xd4d542));if(_0xd4d542[_0x0ea6('0x10')]){if(_0xd4d542[_0x0ea6('0x10')][_0x0ea6('0x11')]===0x1f4){logger[_0x0ea6('0x10')](_0x0ea6('0xc'),_0x51f699,_0xd4d542[_0x0ea6('0x10')][_0x0ea6('0x12')]);return _0xce75cd(_0xd4d542['error']['message']);}logger[_0x0ea6('0x10')](_0x0ea6('0xc'),_0x51f699,_0xd4d542['error']['message']);return _0xf456f9(_0xd4d542[_0x0ea6('0x10')][_0x0ea6('0x12')]);}else{logger['info'](_0x0ea6('0xc'),_0x51f699,_0x0ea6('0xd'));_0xf456f9(_0xd4d542[_0x0ea6('0x13')][_0x0ea6('0x12')]);}})[_0x0ea6('0x14')](function(_0x266c70){logger[_0x0ea6('0x10')](_0x0ea6('0xc'),_0x51f699,_0x266c70);_0xce75cd(_0x266c70);});});}exports[_0x0ea6('0x15')]=function(_0x4c16c3){var _0x575302=this;return new Promise(function(_0x1a3b8f,_0xd15c57){return db[_0x0ea6('0x16')]['findAll']({'raw':_0x4c16c3[_0x0ea6('0x17')]?_0x4c16c3[_0x0ea6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4c16c3[_0x0ea6('0x17')]?_0x4c16c3[_0x0ea6('0x17')][_0x0ea6('0x18')]||null:null,'attributes':_0x4c16c3[_0x0ea6('0x17')]?_0x4c16c3['options']['attributes']||null:null,'limit':_0x4c16c3[_0x0ea6('0x17')]?_0x4c16c3['options'][_0x0ea6('0x19')]||null:null,'include':_0x4c16c3[_0x0ea6('0x17')]?_0x4c16c3[_0x0ea6('0x17')]['include']?_[_0x0ea6('0x1a')](_0x4c16c3[_0x0ea6('0x17')][_0x0ea6('0x1b')],function(_0x2aaf9){return{'model':db[_0x2aaf9[_0x0ea6('0x1c')]],'as':_0x2aaf9['as'],'attributes':_0x2aaf9[_0x0ea6('0x1d')],'include':_0x2aaf9[_0x0ea6('0x1b')]?_['map'](_0x2aaf9[_0x0ea6('0x1b')],function(_0x36d1a7){return{'model':db[_0x36d1a7[_0x0ea6('0x1c')]],'as':_0x36d1a7['as'],'attributes':_0x36d1a7[_0x0ea6('0x1d')],'include':_0x36d1a7['include']?_[_0x0ea6('0x1a')](_0x36d1a7[_0x0ea6('0x1b')],function(_0x5c99d3){return{'model':db[_0x5c99d3['model']],'as':_0x5c99d3['as'],'attributes':_0x5c99d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ea6('0xb')](function(_0x326c77){logger[_0x0ea6('0x1e')]('GetDynamics365Account',_0x4c16c3);logger[_0x0ea6('0xe')]('GetDynamics365Account',_0x4c16c3,JSON[_0x0ea6('0x1f')](_0x326c77));_0x1a3b8f(_0x326c77);})[_0x0ea6('0x14')](function(_0x152aeb){logger[_0x0ea6('0x10')](_0x0ea6('0x15'),_0x152aeb[_0x0ea6('0x12')],_0x4c16c3);_0xd15c57(_0x575302['error'](0x1f4,_0x152aeb[_0x0ea6('0x12')]));});});};exports[_0x0ea6('0x20')]=function(_0x31e7f1){var _0x4f90b9=this;return new Promise(function(_0x1fd5d9,_0x427517){return db[_0x0ea6('0x16')][_0x0ea6('0x21')]({'raw':_0x31e7f1[_0x0ea6('0x17')]?_0x31e7f1[_0x0ea6('0x17')][_0x0ea6('0x22')]===undefined?!![]:![]:!![],'where':_0x31e7f1['options']?_0x31e7f1['options']['where']||null:null,'attributes':_0x31e7f1[_0x0ea6('0x17')]?_0x31e7f1['options'][_0x0ea6('0x1d')]||null:null,'include':_0x31e7f1[_0x0ea6('0x17')]?_0x31e7f1[_0x0ea6('0x17')][_0x0ea6('0x1b')]?_[_0x0ea6('0x1a')](_0x31e7f1[_0x0ea6('0x17')][_0x0ea6('0x1b')],function(_0x228993){return{'model':db[_0x228993['model']],'as':_0x228993['as'],'attributes':_0x228993['attributes'],'include':_0x228993['include']?_['map'](_0x228993['include'],function(_0x975ad5){return{'model':db[_0x975ad5['model']],'as':_0x975ad5['as'],'attributes':_0x975ad5['attributes'],'include':_0x975ad5[_0x0ea6('0x1b')]?_[_0x0ea6('0x1a')](_0x975ad5[_0x0ea6('0x1b')],function(_0x172216){return{'model':db[_0x172216[_0x0ea6('0x1c')]],'as':_0x172216['as'],'attributes':_0x172216[_0x0ea6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0ea6('0xb')](function(_0x1d3da1){logger['info'](_0x0ea6('0x20'),_0x31e7f1);logger[_0x0ea6('0xe')](_0x0ea6('0x20'),_0x31e7f1,JSON['stringify'](_0x1d3da1));_0x1fd5d9(_0x1d3da1);})[_0x0ea6('0x14')](function(_0xd254aa){logger[_0x0ea6('0x10')](_0x0ea6('0x20'),_0xd254aa[_0x0ea6('0x12')],_0x31e7f1);_0x427517(_0x4f90b9[_0x0ea6('0x10')](0x1f4,_0xd254aa[_0x0ea6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9fd9424..e472ca9 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 _0xf8fb=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf8fb,0x184));var _0xbf8f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf8fb[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xbf8f('0x0'));var util=require('util');var path=require(_0xbf8f('0x1'));var timeout=require(_0xbf8f('0x2'));var express=require(_0xbf8f('0x3'));var router=express[_0xbf8f('0x4')]();var fs_extra=require(_0xbf8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf8f('0x6'));var config=require(_0xbf8f('0x7'));var controller=require(_0xbf8f('0x8'));router[_0xbf8f('0x9')]('/',auth[_0xbf8f('0xa')](),controller[_0xbf8f('0xb')]);router[_0xbf8f('0x9')]('/:id',auth[_0xbf8f('0xa')](),controller[_0xbf8f('0xc')]);router[_0xbf8f('0x9')](_0xbf8f('0xd'),auth[_0xbf8f('0xa')](),controller[_0xbf8f('0xe')]);router[_0xbf8f('0x9')](_0xbf8f('0xf'),auth[_0xbf8f('0xa')](),controller[_0xbf8f('0x10')]);router[_0xbf8f('0x9')](_0xbf8f('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbf8f('0x12')]('/',auth[_0xbf8f('0xa')](),controller[_0xbf8f('0x13')]);router[_0xbf8f('0x14')](_0xbf8f('0x15'),auth['isAuthenticated'](),controller[_0xbf8f('0x16')]);router['delete'](_0xbf8f('0x15'),auth[_0xbf8f('0xa')](),controller[_0xbf8f('0x17')]);module[_0xbf8f('0x18')]=router; \ No newline at end of file +var _0x9e42=['put','update','delete','exports','util','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x252d02,_0xb9148f){var _0x332059=function(_0x19bfd0){while(--_0x19bfd0){_0x252d02['push'](_0x252d02['shift']());}};_0x332059(++_0xb9148f);}(_0x9e42,0x169));var _0x29e4=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x9e42[_0x15ec4e];return _0xb5e5dd;};'use strict';var multer=require('multer');var util=require(_0x29e4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x29e4('0x1'));var router=express[_0x29e4('0x2')]();var fs_extra=require(_0x29e4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x29e4('0x4'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x29e4('0x5')]('/',auth[_0x29e4('0x6')](),controller[_0x29e4('0x7')]);router[_0x29e4('0x5')](_0x29e4('0x8'),auth[_0x29e4('0x6')](),controller[_0x29e4('0x9')]);router[_0x29e4('0x5')](_0x29e4('0xa'),auth[_0x29e4('0x6')](),controller[_0x29e4('0xb')]);router[_0x29e4('0x5')](_0x29e4('0xc'),auth[_0x29e4('0x6')](),controller['getSubjects']);router['get'](_0x29e4('0xd'),auth[_0x29e4('0x6')](),controller[_0x29e4('0xe')]);router[_0x29e4('0xf')]('/',auth[_0x29e4('0x6')](),controller[_0x29e4('0x10')]);router[_0x29e4('0x11')]('/:id',auth[_0x29e4('0x6')](),controller[_0x29e4('0x12')]);router[_0x29e4('0x13')]('/:id',auth[_0x29e4('0x6')](),controller['destroy']);module[_0x29e4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 1e664a5..88cd6f4 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 _0x1a1c=['ENUM','incident','phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING'];(function(_0x36b6fb,_0x4e3b6c){var _0x27b9d2=function(_0x2f3bde){while(--_0x2f3bde){_0x36b6fb['push'](_0x36b6fb['shift']());}};_0x27b9d2(++_0x4e3b6c);}(_0x1a1c,0x102));var _0xc1a1=function(_0x4d3707,_0x4b5ff7){_0x4d3707=_0x4d3707-0x0;var _0x5d7015=_0x1a1c[_0x4d3707];return _0x5d7015;};'use strict';var Sequelize=require(_0xc1a1('0x0'));module[_0xc1a1('0x1')]={'name':{'type':Sequelize[_0xc1a1('0x2')]},'description':{'type':Sequelize[_0xc1a1('0x2')]},'ticketType':{'type':Sequelize[_0xc1a1('0x3')](_0xc1a1('0x4'),_0xc1a1('0x5')),'defaultValue':_0xc1a1('0x4')},'moduleCreate':{'type':Sequelize[_0xc1a1('0x3')](_0xc1a1('0x6'),_0xc1a1('0x7')),'defaultValue':_0xc1a1('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xc1a1('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xc1a1('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5345=['exports','STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x5345,0x143));var _0x5534=function(_0x4ee507,_0x5a3f26){_0x4ee507=_0x4ee507-0x0;var _0x334e37=_0x5345[_0x4ee507];return _0x334e37;};'use strict';var Sequelize=require(_0x5534('0x0'));module[_0x5534('0x1')]={'name':{'type':Sequelize[_0x5534('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5534('0x3')]('incident',_0x5534('0x4')),'defaultValue':_0x5534('0x5')},'moduleCreate':{'type':Sequelize[_0x5534('0x3')](_0x5534('0x6'),_0x5534('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x5534('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x5534('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 5509fe7..fe19bb7 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 _0xaf96=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','key','query','keys','filters','model','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','Dynamics365Configuration','includeAll','include','rows','catch','show','intersection','length','options','create','body','find','params','getFields','Dynamics365Field','getSubjects','hasOwnProperty','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x1d61de,_0x2a303d){var _0x446d8f=function(_0xee1c0d){while(--_0xee1c0d){_0x1d61de['push'](_0x1d61de['shift']());}};_0x446d8f(++_0x2a303d);}(_0xaf96,0x9c));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6af9('0x0'));var rimraf=require(_0x6af9('0x1'));var zipdir=require(_0x6af9('0x2'));var jsonpatch=require(_0x6af9('0x3'));var rp=require('request-promise');var moment=require(_0x6af9('0x4'));var BPromise=require(_0x6af9('0x5'));var Mustache=require(_0x6af9('0x6'));var util=require('util');var path=require(_0x6af9('0x7'));var sox=require(_0x6af9('0x8'));var csv=require(_0x6af9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6af9('0xa'));var _=require(_0x6af9('0xb'));var squel=require(_0x6af9('0xc'));var crypto=require(_0x6af9('0xd'));var jsforce=require(_0x6af9('0xe'));var deskjs=require(_0x6af9('0xf'));var toCsv=require(_0x6af9('0x9'));var querystring=require(_0x6af9('0x10'));var Papa=require(_0x6af9('0x11'));var Redis=require(_0x6af9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6af9('0x13'));var as=require(_0x6af9('0x14'));var hardwareService=require(_0x6af9('0x15'));var logger=require(_0x6af9('0x16'))('api');var utils=require(_0x6af9('0x17'));var config=require(_0x6af9('0x18'));var licenseUtil=require(_0x6af9('0x19'));var db=require(_0x6af9('0x1a'))['db'];function respondWithStatusCode(_0x498c40,_0xed5adb){_0xed5adb=_0xed5adb||0xcc;return function(_0x530993){if(_0x530993){return _0x498c40[_0x6af9('0x1b')](_0xed5adb);}return _0x498c40['status'](_0xed5adb)[_0x6af9('0x1c')]();};}function respondWithResult(_0x347c07,_0x17ab09){_0x17ab09=_0x17ab09||0xc8;return function(_0x3bdb57){if(_0x3bdb57){return _0x347c07[_0x6af9('0x1d')](_0x17ab09)['json'](_0x3bdb57);}};}function respondWithFilteredResult(_0x1ad0d6,_0x23fb7b){return function(_0x2ffe60){if(_0x2ffe60){var _0x43d37b=typeof _0x23fb7b[_0x6af9('0x1e')]===_0x6af9('0x1f')&&typeof _0x23fb7b[_0x6af9('0x20')]==='undefined';var _0x124cd0=_0x2ffe60[_0x6af9('0x21')];var _0xeea508=_0x43d37b?0x0:_0x23fb7b[_0x6af9('0x1e')];var _0x40babf=_0x43d37b?_0x2ffe60[_0x6af9('0x21')]:_0x23fb7b[_0x6af9('0x1e')]+_0x23fb7b[_0x6af9('0x20')];var _0x5f1535;if(_0x40babf>=_0x124cd0){_0x40babf=_0x124cd0;_0x5f1535=0xc8;}else{_0x5f1535=0xce;}_0x1ad0d6[_0x6af9('0x1d')](_0x5f1535);return _0x1ad0d6[_0x6af9('0x22')](_0x6af9('0x23'),_0xeea508+'-'+_0x40babf+'/'+_0x124cd0)['json'](_0x2ffe60);}return null;};}function patchUpdates(_0x466819){return function(_0x17ee34){try{jsonpatch[_0x6af9('0x24')](_0x17ee34,_0x466819,!![]);}catch(_0x116994){return BPromise[_0x6af9('0x25')](_0x116994);}return _0x17ee34[_0x6af9('0x26')]();};}function saveUpdates(_0x5666a4,_0x40ac8b){return function(_0x3707df){if(_0x3707df){return _0x3707df[_0x6af9('0x27')](_0x5666a4)[_0x6af9('0x28')](function(_0x425a96){return _0x425a96;});}return null;};}function removeEntity(_0x3fd2d3,_0x12d01c){return function(_0x3ab95a){if(_0x3ab95a){return _0x3ab95a[_0x6af9('0x29')]()[_0x6af9('0x28')](function(){_0x3fd2d3['status'](0xcc)[_0x6af9('0x1c')]();});}};}function handleEntityNotFound(_0x4247c0,_0x148ee2){return function(_0x431819){if(!_0x431819){_0x4247c0[_0x6af9('0x1b')](0x194);}return _0x431819;};}function handleError(_0xd9a5c0,_0x20f81f){_0x20f81f=_0x20f81f||0x1f4;return function(_0x13af9a){logger[_0x6af9('0x2a')](_0x13af9a['stack']);if(_0x13af9a[_0x6af9('0x2b')]){delete _0x13af9a[_0x6af9('0x2b')];}_0xd9a5c0['status'](_0x20f81f)[_0x6af9('0x2c')](_0x13af9a);};}exports[_0x6af9('0x2d')]=function(_0x4b322b,_0x15bae3){var _0x62f0db={},_0x1e687d={},_0x54dae7={'count':0x0,'rows':[]};var _0x355936=_[_0x6af9('0x2e')](db['Dynamics365Configuration'][_0x6af9('0x2f')],function(_0x47695b){return{'name':_0x47695b['fieldName'],'type':_0x47695b['type'][_0x6af9('0x30')]};});_0x1e687d['model']=_[_0x6af9('0x2e')](_0x355936,'name');_0x1e687d[_0x6af9('0x31')]=_[_0x6af9('0x32')](_0x4b322b[_0x6af9('0x31')]);_0x1e687d[_0x6af9('0x33')]=_['intersection'](_0x1e687d[_0x6af9('0x34')],_0x1e687d[_0x6af9('0x31')]);_0x62f0db['attributes']=_['intersection'](_0x1e687d[_0x6af9('0x34')],qs['fields'](_0x4b322b['query'][_0x6af9('0x35')]));_0x62f0db['attributes']=_0x62f0db['attributes']['length']?_0x62f0db[_0x6af9('0x36')]:_0x1e687d[_0x6af9('0x34')];if(!_0x4b322b['query']['hasOwnProperty'](_0x6af9('0x37'))){_0x62f0db[_0x6af9('0x20')]=qs[_0x6af9('0x20')](_0x4b322b[_0x6af9('0x31')]['limit']);_0x62f0db[_0x6af9('0x1e')]=qs[_0x6af9('0x1e')](_0x4b322b['query'][_0x6af9('0x1e')]);}_0x62f0db[_0x6af9('0x38')]=qs[_0x6af9('0x39')](_0x4b322b[_0x6af9('0x31')]['sort']);_0x62f0db[_0x6af9('0x3a')]=qs[_0x6af9('0x33')](_[_0x6af9('0x3b')](_0x4b322b['query'],_0x1e687d[_0x6af9('0x33')]),_0x355936);if(_0x4b322b[_0x6af9('0x31')][_0x6af9('0x3c')]){_0x62f0db[_0x6af9('0x3a')]=_['merge'](_0x62f0db['where'],{'$or':_['map'](_0x355936,function(_0x34d6d0){if(_0x34d6d0['type']!==_0x6af9('0x3d')){var _0x2c11bb={};_0x2c11bb[_0x34d6d0[_0x6af9('0x2b')]]={'$like':'%'+_0x4b322b[_0x6af9('0x31')][_0x6af9('0x3c')]+'%'};return _0x2c11bb;}})});}_0x62f0db=_[_0x6af9('0x3e')]({},_0x62f0db,_0x4b322b['options']);var _0x29c339={'where':_0x62f0db[_0x6af9('0x3a')]};return db[_0x6af9('0x3f')][_0x6af9('0x21')](_0x29c339)[_0x6af9('0x28')](function(_0x2c81ac){_0x54dae7[_0x6af9('0x21')]=_0x2c81ac;if(_0x4b322b[_0x6af9('0x31')][_0x6af9('0x40')]){_0x62f0db[_0x6af9('0x41')]=[{'all':!![]}];}return db[_0x6af9('0x3f')]['findAll'](_0x62f0db);})['then'](function(_0x54ff77){_0x54dae7[_0x6af9('0x42')]=_0x54ff77;return _0x54dae7;})[_0x6af9('0x28')](respondWithFilteredResult(_0x15bae3,_0x62f0db))[_0x6af9('0x43')](handleError(_0x15bae3,null));};exports[_0x6af9('0x44')]=function(_0x2caecc,_0x3ab450){var _0x3e8c35={'raw':![],'where':{'id':_0x2caecc['params']['id']}},_0x50c348={};_0x50c348[_0x6af9('0x34')]=_[_0x6af9('0x32')](db['Dynamics365Configuration']['rawAttributes']);_0x50c348[_0x6af9('0x31')]=_[_0x6af9('0x32')](_0x2caecc[_0x6af9('0x31')]);_0x50c348[_0x6af9('0x33')]=_[_0x6af9('0x45')](_0x50c348['model'],_0x50c348[_0x6af9('0x31')]);_0x3e8c35[_0x6af9('0x36')]=_[_0x6af9('0x45')](_0x50c348[_0x6af9('0x34')],qs[_0x6af9('0x35')](_0x2caecc['query']['fields']));_0x3e8c35['attributes']=_0x3e8c35[_0x6af9('0x36')][_0x6af9('0x46')]?_0x3e8c35['attributes']:_0x50c348['model'];if(_0x2caecc[_0x6af9('0x31')][_0x6af9('0x40')]){_0x3e8c35[_0x6af9('0x41')]=[{'all':!![]}];}_0x3e8c35=_[_0x6af9('0x3e')]({},_0x3e8c35,_0x2caecc[_0x6af9('0x47')]);return db[_0x6af9('0x3f')]['find'](_0x3e8c35)['then'](handleEntityNotFound(_0x3ab450,null))['then'](respondWithResult(_0x3ab450,null))[_0x6af9('0x43')](handleError(_0x3ab450,null));};exports[_0x6af9('0x48')]=function(_0x28c016,_0x462c1a){return db[_0x6af9('0x3f')]['create'](_0x28c016[_0x6af9('0x49')],{})[_0x6af9('0x28')](respondWithResult(_0x462c1a,0xc9))['catch'](handleError(_0x462c1a,null));};exports[_0x6af9('0x27')]=function(_0x36da71,_0x611b2f){if(_0x36da71['body']['id']){delete _0x36da71[_0x6af9('0x49')]['id'];}return db['Dynamics365Configuration'][_0x6af9('0x4a')]({'where':{'id':_0x36da71[_0x6af9('0x4b')]['id']}})[_0x6af9('0x28')](handleEntityNotFound(_0x611b2f,null))['then'](saveUpdates(_0x36da71[_0x6af9('0x49')],null))['then'](respondWithResult(_0x611b2f,null))[_0x6af9('0x43')](handleError(_0x611b2f,null));};exports[_0x6af9('0x29')]=function(_0x2e8d06,_0x1a2600){return db[_0x6af9('0x3f')][_0x6af9('0x4a')]({'where':{'id':_0x2e8d06['params']['id']}})[_0x6af9('0x28')](handleEntityNotFound(_0x1a2600,null))['then'](removeEntity(_0x1a2600,null))[_0x6af9('0x43')](handleError(_0x1a2600,null));};exports[_0x6af9('0x4c')]=function(_0x3be14c,_0x5d5f01,_0x7034b3){var _0x20fee4={};var _0xb20448={};var _0x5ba0dc;var _0x1a2b15;return db[_0x6af9('0x3f')]['findOne']({'where':{'id':_0x3be14c[_0x6af9('0x4b')]['id']}})[_0x6af9('0x28')](handleEntityNotFound(_0x5d5f01,null))[_0x6af9('0x28')](function(_0x3e7e55){if(_0x3e7e55){_0x5ba0dc=_0x3e7e55;_0xb20448[_0x6af9('0x34')]=_[_0x6af9('0x32')](db[_0x6af9('0x4d')]['rawAttributes']);_0xb20448['query']=_['keys'](_0x3be14c[_0x6af9('0x31')]);_0xb20448['filters']=_[_0x6af9('0x45')](_0xb20448['model'],_0xb20448[_0x6af9('0x31')]);_0x20fee4[_0x6af9('0x36')]=_[_0x6af9('0x45')](_0xb20448[_0x6af9('0x34')],qs[_0x6af9('0x35')](_0x3be14c[_0x6af9('0x31')][_0x6af9('0x35')]));_0x20fee4[_0x6af9('0x36')]=_0x20fee4[_0x6af9('0x36')]['length']?_0x20fee4[_0x6af9('0x36')]:_0xb20448[_0x6af9('0x34')];_0x20fee4[_0x6af9('0x38')]=qs['sort'](_0x3be14c[_0x6af9('0x31')][_0x6af9('0x39')]);_0x20fee4['where']=qs['filters'](_[_0x6af9('0x3b')](_0x3be14c['query'],_0xb20448[_0x6af9('0x33')]));if(_0x3be14c[_0x6af9('0x31')][_0x6af9('0x3c')]){_0x20fee4['where']=_[_0x6af9('0x3e')](_0x20fee4[_0x6af9('0x3a')],{'$or':_[_0x6af9('0x2e')](_0x20fee4[_0x6af9('0x36')],function(_0x15774c){var _0x42f324={};_0x42f324[_0x15774c]={'$like':'%'+_0x3be14c[_0x6af9('0x31')][_0x6af9('0x3c')]+'%'};return _0x42f324;})});}_0x20fee4=_[_0x6af9('0x3e')]({},_0x20fee4,_0x3be14c[_0x6af9('0x47')]);return _0x5ba0dc[_0x6af9('0x4c')](_0x20fee4);}})[_0x6af9('0x28')](function(_0x382e6e){if(_0x382e6e){_0x1a2b15=_0x382e6e[_0x6af9('0x46')];if(!_0x3be14c[_0x6af9('0x31')]['hasOwnProperty'](_0x6af9('0x37'))){_0x20fee4['limit']=qs[_0x6af9('0x20')](_0x3be14c['query'][_0x6af9('0x20')]);_0x20fee4['offset']=qs['offset'](_0x3be14c[_0x6af9('0x31')][_0x6af9('0x1e')]);}return _0x5ba0dc['getFields'](_0x20fee4);}})[_0x6af9('0x28')](function(_0x4fab5d){if(_0x4fab5d){return _0x4fab5d?{'count':_0x1a2b15,'rows':_0x4fab5d}:null;}})[_0x6af9('0x28')](respondWithResult(_0x5d5f01,null))[_0x6af9('0x43')](handleError(_0x5d5f01,null));};exports[_0x6af9('0x4e')]=function(_0x15f8d5,_0x26b973,_0x774b6b){var _0x50d950={};var _0x1a5926={};var _0x4ca51d;var _0xa76cb8;return db[_0x6af9('0x3f')]['findOne']({'where':{'id':_0x15f8d5[_0x6af9('0x4b')]['id']}})[_0x6af9('0x28')](handleEntityNotFound(_0x26b973,null))[_0x6af9('0x28')](function(_0x344645){if(_0x344645){_0x4ca51d=_0x344645;_0x1a5926['model']=_['keys'](db[_0x6af9('0x4d')]['rawAttributes']);_0x1a5926['query']=_[_0x6af9('0x32')](_0x15f8d5['query']);_0x1a5926['filters']=_[_0x6af9('0x45')](_0x1a5926[_0x6af9('0x34')],_0x1a5926[_0x6af9('0x31')]);_0x50d950[_0x6af9('0x36')]=_[_0x6af9('0x45')](_0x1a5926[_0x6af9('0x34')],qs[_0x6af9('0x35')](_0x15f8d5[_0x6af9('0x31')][_0x6af9('0x35')]));_0x50d950['attributes']=_0x50d950[_0x6af9('0x36')][_0x6af9('0x46')]?_0x50d950[_0x6af9('0x36')]:_0x1a5926['model'];_0x50d950[_0x6af9('0x38')]=qs[_0x6af9('0x39')](_0x15f8d5[_0x6af9('0x31')][_0x6af9('0x39')]);_0x50d950[_0x6af9('0x3a')]=qs[_0x6af9('0x33')](_['pick'](_0x15f8d5['query'],_0x1a5926['filters']));if(_0x15f8d5[_0x6af9('0x31')][_0x6af9('0x3c')]){_0x50d950[_0x6af9('0x3a')]=_[_0x6af9('0x3e')](_0x50d950[_0x6af9('0x3a')],{'$or':_[_0x6af9('0x2e')](_0x50d950[_0x6af9('0x36')],function(_0x20e2a7){var _0x48c4e4={};_0x48c4e4[_0x20e2a7]={'$like':'%'+_0x15f8d5[_0x6af9('0x31')][_0x6af9('0x3c')]+'%'};return _0x48c4e4;})});}_0x50d950=_[_0x6af9('0x3e')]({},_0x50d950,_0x15f8d5[_0x6af9('0x47')]);return _0x4ca51d[_0x6af9('0x4e')](_0x50d950);}})[_0x6af9('0x28')](function(_0x58fc6e){if(_0x58fc6e){_0xa76cb8=_0x58fc6e[_0x6af9('0x46')];if(!_0x15f8d5['query'][_0x6af9('0x4f')](_0x6af9('0x37'))){_0x50d950[_0x6af9('0x20')]=qs[_0x6af9('0x20')](_0x15f8d5[_0x6af9('0x31')][_0x6af9('0x20')]);_0x50d950['offset']=qs[_0x6af9('0x1e')](_0x15f8d5[_0x6af9('0x31')]['offset']);}return _0x4ca51d[_0x6af9('0x4e')](_0x50d950);}})[_0x6af9('0x28')](function(_0x4ab1fb){if(_0x4ab1fb){return _0x4ab1fb?{'count':_0xa76cb8,'rows':_0x4ab1fb}:null;}})['then'](respondWithResult(_0x26b973,null))[_0x6af9('0x43')](handleError(_0x26b973,null));};exports[_0x6af9('0x50')]=function(_0x284324,_0x15f8fd,_0x484e32){var _0x4245f4={};var _0x2572c0={};var _0x36b998;var _0x574a1b;return db['Dynamics365Configuration'][_0x6af9('0x51')]({'where':{'id':_0x284324['params']['id']}})[_0x6af9('0x28')](handleEntityNotFound(_0x15f8fd,null))['then'](function(_0x25aeab){if(_0x25aeab){_0x36b998=_0x25aeab;_0x2572c0['model']=_[_0x6af9('0x32')](db[_0x6af9('0x4d')][_0x6af9('0x2f')]);_0x2572c0['query']=_[_0x6af9('0x32')](_0x284324['query']);_0x2572c0[_0x6af9('0x33')]=_[_0x6af9('0x45')](_0x2572c0[_0x6af9('0x34')],_0x2572c0[_0x6af9('0x31')]);_0x4245f4['attributes']=_[_0x6af9('0x45')](_0x2572c0[_0x6af9('0x34')],qs[_0x6af9('0x35')](_0x284324[_0x6af9('0x31')][_0x6af9('0x35')]));_0x4245f4[_0x6af9('0x36')]=_0x4245f4[_0x6af9('0x36')][_0x6af9('0x46')]?_0x4245f4[_0x6af9('0x36')]:_0x2572c0['model'];_0x4245f4[_0x6af9('0x38')]=qs[_0x6af9('0x39')](_0x284324[_0x6af9('0x31')][_0x6af9('0x39')]);_0x4245f4[_0x6af9('0x3a')]=qs['filters'](_[_0x6af9('0x3b')](_0x284324[_0x6af9('0x31')],_0x2572c0[_0x6af9('0x33')]));if(_0x284324[_0x6af9('0x31')]['filter']){_0x4245f4[_0x6af9('0x3a')]=_[_0x6af9('0x3e')](_0x4245f4['where'],{'$or':_[_0x6af9('0x2e')](_0x4245f4[_0x6af9('0x36')],function(_0x408ccb){var _0x2a3c03={};_0x2a3c03[_0x408ccb]={'$like':'%'+_0x284324[_0x6af9('0x31')]['filter']+'%'};return _0x2a3c03;})});}_0x4245f4=_['merge']({},_0x4245f4,_0x284324[_0x6af9('0x47')]);return _0x36b998[_0x6af9('0x50')](_0x4245f4);}})[_0x6af9('0x28')](function(_0x41c6ed){if(_0x41c6ed){_0x574a1b=_0x41c6ed[_0x6af9('0x46')];if(!_0x284324[_0x6af9('0x31')][_0x6af9('0x4f')](_0x6af9('0x37'))){_0x4245f4[_0x6af9('0x20')]=qs[_0x6af9('0x20')](_0x284324['query'][_0x6af9('0x20')]);_0x4245f4['offset']=qs['offset'](_0x284324['query']['offset']);}return _0x36b998[_0x6af9('0x50')](_0x4245f4);}})[_0x6af9('0x28')](function(_0x27242a){if(_0x27242a){return _0x27242a?{'count':_0x574a1b,'rows':_0x27242a}:null;}})[_0x6af9('0x28')](respondWithResult(_0x15f8fd,null))[_0x6af9('0x43')](handleError(_0x15f8fd,null));}; \ No newline at end of file +var _0xc425=['send','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','Dynamics365Configuration','count','includeAll','include','findAll','rows','params','keys','find','create','body','catch','destroy','getFields','findOne','Dynamics365Field','nolimit','getSubjects','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','name'];(function(_0x26712c,_0x14fe70){var _0x921b7c=function(_0x3d9103){while(--_0x3d9103){_0x26712c['push'](_0x26712c['shift']());}};_0x921b7c(++_0x14fe70);}(_0xc425,0xc8));var _0x5c42=function(_0x46c3c2,_0xf8acc0){_0x46c3c2=_0x46c3c2-0x0;var _0x111eca=_0xc425[_0x46c3c2];return _0x111eca;};'use strict';var emlformat=require(_0x5c42('0x0'));var rimraf=require(_0x5c42('0x1'));var zipdir=require(_0x5c42('0x2'));var jsonpatch=require(_0x5c42('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c42('0x4'));var Mustache=require(_0x5c42('0x5'));var util=require(_0x5c42('0x6'));var path=require(_0x5c42('0x7'));var sox=require('sox');var csv=require(_0x5c42('0x8'));var ejs=require(_0x5c42('0x9'));var fs=require('fs');var fs_extra=require(_0x5c42('0xa'));var _=require('lodash');var squel=require(_0x5c42('0xb'));var crypto=require(_0x5c42('0xc'));var jsforce=require(_0x5c42('0xd'));var deskjs=require(_0x5c42('0xe'));var toCsv=require(_0x5c42('0x8'));var querystring=require('querystring');var Papa=require(_0x5c42('0xf'));var Redis=require(_0x5c42('0x10'));var authService=require(_0x5c42('0x11'));var qs=require(_0x5c42('0x12'));var as=require(_0x5c42('0x13'));var hardwareService=require(_0x5c42('0x14'));var logger=require(_0x5c42('0x15'))('api');var utils=require(_0x5c42('0x16'));var config=require(_0x5c42('0x17'));var licenseUtil=require(_0x5c42('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b000,_0x31ab30){_0x31ab30=_0x31ab30||0xcc;return function(_0x264871){if(_0x264871){return _0x14b000['sendStatus'](_0x31ab30);}return _0x14b000[_0x5c42('0x19')](_0x31ab30)[_0x5c42('0x1a')]();};}function respondWithResult(_0x5d1506,_0x2eaa09){_0x2eaa09=_0x2eaa09||0xc8;return function(_0x22a205){if(_0x22a205){return _0x5d1506[_0x5c42('0x19')](_0x2eaa09)['json'](_0x22a205);}};}function respondWithFilteredResult(_0x3d241a,_0x43f15a){return function(_0xb9887){if(_0xb9887){var _0x527d76=typeof _0x43f15a[_0x5c42('0x1b')]===_0x5c42('0x1c')&&typeof _0x43f15a[_0x5c42('0x1d')]===_0x5c42('0x1c');var _0x5cf27e=_0xb9887['count'];var _0x356aa0=_0x527d76?0x0:_0x43f15a[_0x5c42('0x1b')];var _0x14776a=_0x527d76?_0xb9887['count']:_0x43f15a[_0x5c42('0x1b')]+_0x43f15a['limit'];var _0xcc9710;if(_0x14776a>=_0x5cf27e){_0x14776a=_0x5cf27e;_0xcc9710=0xc8;}else{_0xcc9710=0xce;}_0x3d241a[_0x5c42('0x19')](_0xcc9710);return _0x3d241a[_0x5c42('0x1e')](_0x5c42('0x1f'),_0x356aa0+'-'+_0x14776a+'/'+_0x5cf27e)[_0x5c42('0x20')](_0xb9887);}return null;};}function patchUpdates(_0x504b89){return function(_0x4d801e){try{jsonpatch[_0x5c42('0x21')](_0x4d801e,_0x504b89,!![]);}catch(_0x4ac4f4){return BPromise[_0x5c42('0x22')](_0x4ac4f4);}return _0x4d801e[_0x5c42('0x23')]();};}function saveUpdates(_0x345f27,_0x1752ce){return function(_0x4b5111){if(_0x4b5111){return _0x4b5111[_0x5c42('0x24')](_0x345f27)['then'](function(_0x267bac){return _0x267bac;});}return null;};}function removeEntity(_0x24a2ed,_0x4f7449){return function(_0x21b012){if(_0x21b012){return _0x21b012['destroy']()[_0x5c42('0x25')](function(){_0x24a2ed[_0x5c42('0x19')](0xcc)[_0x5c42('0x1a')]();});}};}function handleEntityNotFound(_0x5da9bf,_0x270c6d){return function(_0x577b12){if(!_0x577b12){_0x5da9bf[_0x5c42('0x26')](0x194);}return _0x577b12;};}function handleError(_0x59b461,_0x23f3cf){_0x23f3cf=_0x23f3cf||0x1f4;return function(_0x15a4f8){logger['error'](_0x15a4f8['stack']);if(_0x15a4f8[_0x5c42('0x27')]){delete _0x15a4f8['name'];}_0x59b461[_0x5c42('0x19')](_0x23f3cf)[_0x5c42('0x28')](_0x15a4f8);};}exports['index']=function(_0x26d9f3,_0x46fa0f){var _0x4ff0ba={},_0x54a093={},_0x3ea6a2={'count':0x0,'rows':[]};var _0xe7d01e=_[_0x5c42('0x29')](db['Dynamics365Configuration'][_0x5c42('0x2a')],function(_0x3bdb62){return{'name':_0x3bdb62[_0x5c42('0x2b')],'type':_0x3bdb62['type'][_0x5c42('0x2c')]};});_0x54a093[_0x5c42('0x2d')]=_[_0x5c42('0x29')](_0xe7d01e,_0x5c42('0x27'));_0x54a093[_0x5c42('0x2e')]=_['keys'](_0x26d9f3[_0x5c42('0x2e')]);_0x54a093[_0x5c42('0x2f')]=_['intersection'](_0x54a093[_0x5c42('0x2d')],_0x54a093[_0x5c42('0x2e')]);_0x4ff0ba[_0x5c42('0x30')]=_[_0x5c42('0x31')](_0x54a093[_0x5c42('0x2d')],qs['fields'](_0x26d9f3['query'][_0x5c42('0x32')]));_0x4ff0ba['attributes']=_0x4ff0ba[_0x5c42('0x30')][_0x5c42('0x33')]?_0x4ff0ba[_0x5c42('0x30')]:_0x54a093['model'];if(!_0x26d9f3['query'][_0x5c42('0x34')]('nolimit')){_0x4ff0ba[_0x5c42('0x1d')]=qs[_0x5c42('0x1d')](_0x26d9f3[_0x5c42('0x2e')][_0x5c42('0x1d')]);_0x4ff0ba[_0x5c42('0x1b')]=qs['offset'](_0x26d9f3[_0x5c42('0x2e')][_0x5c42('0x1b')]);}_0x4ff0ba[_0x5c42('0x35')]=qs[_0x5c42('0x36')](_0x26d9f3[_0x5c42('0x2e')][_0x5c42('0x36')]);_0x4ff0ba[_0x5c42('0x37')]=qs['filters'](_[_0x5c42('0x38')](_0x26d9f3[_0x5c42('0x2e')],_0x54a093[_0x5c42('0x2f')]),_0xe7d01e);if(_0x26d9f3['query'][_0x5c42('0x39')]){_0x4ff0ba[_0x5c42('0x37')]=_['merge'](_0x4ff0ba[_0x5c42('0x37')],{'$or':_[_0x5c42('0x29')](_0xe7d01e,function(_0xb3c3f5){if(_0xb3c3f5['type']!==_0x5c42('0x3a')){var _0x20774f={};_0x20774f[_0xb3c3f5[_0x5c42('0x27')]]={'$like':'%'+_0x26d9f3[_0x5c42('0x2e')]['filter']+'%'};return _0x20774f;}})});}_0x4ff0ba=_[_0x5c42('0x3b')]({},_0x4ff0ba,_0x26d9f3['options']);var _0x2956a1={'where':_0x4ff0ba[_0x5c42('0x37')]};return db[_0x5c42('0x3c')][_0x5c42('0x3d')](_0x2956a1)[_0x5c42('0x25')](function(_0x339b15){_0x3ea6a2['count']=_0x339b15;if(_0x26d9f3[_0x5c42('0x2e')][_0x5c42('0x3e')]){_0x4ff0ba[_0x5c42('0x3f')]=[{'all':!![]}];}return db[_0x5c42('0x3c')][_0x5c42('0x40')](_0x4ff0ba);})[_0x5c42('0x25')](function(_0x1a949f){_0x3ea6a2[_0x5c42('0x41')]=_0x1a949f;return _0x3ea6a2;})[_0x5c42('0x25')](respondWithFilteredResult(_0x46fa0f,_0x4ff0ba))['catch'](handleError(_0x46fa0f,null));};exports['show']=function(_0x5ba55f,_0x3bffe7){var _0x53465c={'raw':![],'where':{'id':_0x5ba55f[_0x5c42('0x42')]['id']}},_0x464e90={};_0x464e90[_0x5c42('0x2d')]=_[_0x5c42('0x43')](db['Dynamics365Configuration'][_0x5c42('0x2a')]);_0x464e90['query']=_[_0x5c42('0x43')](_0x5ba55f[_0x5c42('0x2e')]);_0x464e90[_0x5c42('0x2f')]=_[_0x5c42('0x31')](_0x464e90[_0x5c42('0x2d')],_0x464e90['query']);_0x53465c['attributes']=_[_0x5c42('0x31')](_0x464e90[_0x5c42('0x2d')],qs['fields'](_0x5ba55f[_0x5c42('0x2e')][_0x5c42('0x32')]));_0x53465c[_0x5c42('0x30')]=_0x53465c['attributes'][_0x5c42('0x33')]?_0x53465c[_0x5c42('0x30')]:_0x464e90[_0x5c42('0x2d')];if(_0x5ba55f[_0x5c42('0x2e')][_0x5c42('0x3e')]){_0x53465c['include']=[{'all':!![]}];}_0x53465c=_[_0x5c42('0x3b')]({},_0x53465c,_0x5ba55f['options']);return db[_0x5c42('0x3c')][_0x5c42('0x44')](_0x53465c)[_0x5c42('0x25')](handleEntityNotFound(_0x3bffe7,null))['then'](respondWithResult(_0x3bffe7,null))['catch'](handleError(_0x3bffe7,null));};exports[_0x5c42('0x45')]=function(_0x157b53,_0x5166a8){return db[_0x5c42('0x3c')][_0x5c42('0x45')](_0x157b53[_0x5c42('0x46')],{})[_0x5c42('0x25')](respondWithResult(_0x5166a8,0xc9))[_0x5c42('0x47')](handleError(_0x5166a8,null));};exports[_0x5c42('0x24')]=function(_0x175447,_0x49c865){if(_0x175447[_0x5c42('0x46')]['id']){delete _0x175447[_0x5c42('0x46')]['id'];}return db[_0x5c42('0x3c')][_0x5c42('0x44')]({'where':{'id':_0x175447['params']['id']}})[_0x5c42('0x25')](handleEntityNotFound(_0x49c865,null))[_0x5c42('0x25')](saveUpdates(_0x175447['body'],null))['then'](respondWithResult(_0x49c865,null))[_0x5c42('0x47')](handleError(_0x49c865,null));};exports[_0x5c42('0x48')]=function(_0x1e287d,_0x3735a1){return db[_0x5c42('0x3c')]['find']({'where':{'id':_0x1e287d['params']['id']}})['then'](handleEntityNotFound(_0x3735a1,null))[_0x5c42('0x25')](removeEntity(_0x3735a1,null))[_0x5c42('0x47')](handleError(_0x3735a1,null));};exports[_0x5c42('0x49')]=function(_0x2f5929,_0x2400a7,_0x2e5792){var _0x52cd36={};var _0x33ff34={};var _0xa5cdf3;var _0x5eece2;return db['Dynamics365Configuration'][_0x5c42('0x4a')]({'where':{'id':_0x2f5929['params']['id']}})[_0x5c42('0x25')](handleEntityNotFound(_0x2400a7,null))[_0x5c42('0x25')](function(_0x27b757){if(_0x27b757){_0xa5cdf3=_0x27b757;_0x33ff34[_0x5c42('0x2d')]=_['keys'](db[_0x5c42('0x4b')]['rawAttributes']);_0x33ff34[_0x5c42('0x2e')]=_[_0x5c42('0x43')](_0x2f5929['query']);_0x33ff34[_0x5c42('0x2f')]=_[_0x5c42('0x31')](_0x33ff34['model'],_0x33ff34[_0x5c42('0x2e')]);_0x52cd36[_0x5c42('0x30')]=_[_0x5c42('0x31')](_0x33ff34[_0x5c42('0x2d')],qs[_0x5c42('0x32')](_0x2f5929['query'][_0x5c42('0x32')]));_0x52cd36[_0x5c42('0x30')]=_0x52cd36[_0x5c42('0x30')]['length']?_0x52cd36['attributes']:_0x33ff34[_0x5c42('0x2d')];_0x52cd36['order']=qs[_0x5c42('0x36')](_0x2f5929['query']['sort']);_0x52cd36[_0x5c42('0x37')]=qs['filters'](_[_0x5c42('0x38')](_0x2f5929[_0x5c42('0x2e')],_0x33ff34[_0x5c42('0x2f')]));if(_0x2f5929['query'][_0x5c42('0x39')]){_0x52cd36['where']=_['merge'](_0x52cd36[_0x5c42('0x37')],{'$or':_['map'](_0x52cd36[_0x5c42('0x30')],function(_0x179783){var _0x157ec2={};_0x157ec2[_0x179783]={'$like':'%'+_0x2f5929[_0x5c42('0x2e')][_0x5c42('0x39')]+'%'};return _0x157ec2;})});}_0x52cd36=_['merge']({},_0x52cd36,_0x2f5929['options']);return _0xa5cdf3['getFields'](_0x52cd36);}})['then'](function(_0x32b55c){if(_0x32b55c){_0x5eece2=_0x32b55c[_0x5c42('0x33')];if(!_0x2f5929[_0x5c42('0x2e')][_0x5c42('0x34')](_0x5c42('0x4c'))){_0x52cd36[_0x5c42('0x1d')]=qs[_0x5c42('0x1d')](_0x2f5929[_0x5c42('0x2e')]['limit']);_0x52cd36['offset']=qs[_0x5c42('0x1b')](_0x2f5929[_0x5c42('0x2e')]['offset']);}return _0xa5cdf3[_0x5c42('0x49')](_0x52cd36);}})[_0x5c42('0x25')](function(_0x56f541){if(_0x56f541){return _0x56f541?{'count':_0x5eece2,'rows':_0x56f541}:null;}})[_0x5c42('0x25')](respondWithResult(_0x2400a7,null))[_0x5c42('0x47')](handleError(_0x2400a7,null));};exports[_0x5c42('0x4d')]=function(_0x5a6002,_0x73ea0e,_0x159e82){var _0x4651b8={};var _0x26038c={};var _0x21455f;var _0x42e092;return db[_0x5c42('0x3c')][_0x5c42('0x4a')]({'where':{'id':_0x5a6002[_0x5c42('0x42')]['id']}})[_0x5c42('0x25')](handleEntityNotFound(_0x73ea0e,null))['then'](function(_0x28d065){if(_0x28d065){_0x21455f=_0x28d065;_0x26038c[_0x5c42('0x2d')]=_[_0x5c42('0x43')](db['Dynamics365Field'][_0x5c42('0x2a')]);_0x26038c[_0x5c42('0x2e')]=_[_0x5c42('0x43')](_0x5a6002[_0x5c42('0x2e')]);_0x26038c[_0x5c42('0x2f')]=_[_0x5c42('0x31')](_0x26038c[_0x5c42('0x2d')],_0x26038c[_0x5c42('0x2e')]);_0x4651b8[_0x5c42('0x30')]=_[_0x5c42('0x31')](_0x26038c[_0x5c42('0x2d')],qs[_0x5c42('0x32')](_0x5a6002[_0x5c42('0x2e')][_0x5c42('0x32')]));_0x4651b8[_0x5c42('0x30')]=_0x4651b8[_0x5c42('0x30')][_0x5c42('0x33')]?_0x4651b8[_0x5c42('0x30')]:_0x26038c[_0x5c42('0x2d')];_0x4651b8[_0x5c42('0x35')]=qs[_0x5c42('0x36')](_0x5a6002[_0x5c42('0x2e')]['sort']);_0x4651b8[_0x5c42('0x37')]=qs['filters'](_['pick'](_0x5a6002['query'],_0x26038c['filters']));if(_0x5a6002[_0x5c42('0x2e')]['filter']){_0x4651b8[_0x5c42('0x37')]=_[_0x5c42('0x3b')](_0x4651b8[_0x5c42('0x37')],{'$or':_[_0x5c42('0x29')](_0x4651b8[_0x5c42('0x30')],function(_0xfb5679){var _0x4039c9={};_0x4039c9[_0xfb5679]={'$like':'%'+_0x5a6002[_0x5c42('0x2e')]['filter']+'%'};return _0x4039c9;})});}_0x4651b8=_['merge']({},_0x4651b8,_0x5a6002[_0x5c42('0x4e')]);return _0x21455f['getSubjects'](_0x4651b8);}})[_0x5c42('0x25')](function(_0x176031){if(_0x176031){_0x42e092=_0x176031[_0x5c42('0x33')];if(!_0x5a6002[_0x5c42('0x2e')][_0x5c42('0x34')]('nolimit')){_0x4651b8[_0x5c42('0x1d')]=qs['limit'](_0x5a6002[_0x5c42('0x2e')][_0x5c42('0x1d')]);_0x4651b8['offset']=qs[_0x5c42('0x1b')](_0x5a6002[_0x5c42('0x2e')]['offset']);}return _0x21455f[_0x5c42('0x4d')](_0x4651b8);}})[_0x5c42('0x25')](function(_0x3eee37){if(_0x3eee37){return _0x3eee37?{'count':_0x42e092,'rows':_0x3eee37}:null;}})[_0x5c42('0x25')](respondWithResult(_0x73ea0e,null))[_0x5c42('0x47')](handleError(_0x73ea0e,null));};exports['getDescriptions']=function(_0x1c236a,_0x31e296,_0x237773){var _0x45bc44={};var _0x15de9a={};var _0x12c9ed;var _0x2b7186;return db['Dynamics365Configuration'][_0x5c42('0x4a')]({'where':{'id':_0x1c236a[_0x5c42('0x42')]['id']}})['then'](handleEntityNotFound(_0x31e296,null))[_0x5c42('0x25')](function(_0x35e81b){if(_0x35e81b){_0x12c9ed=_0x35e81b;_0x15de9a[_0x5c42('0x2d')]=_[_0x5c42('0x43')](db['Dynamics365Field']['rawAttributes']);_0x15de9a[_0x5c42('0x2e')]=_['keys'](_0x1c236a[_0x5c42('0x2e')]);_0x15de9a[_0x5c42('0x2f')]=_[_0x5c42('0x31')](_0x15de9a[_0x5c42('0x2d')],_0x15de9a[_0x5c42('0x2e')]);_0x45bc44[_0x5c42('0x30')]=_[_0x5c42('0x31')](_0x15de9a['model'],qs['fields'](_0x1c236a[_0x5c42('0x2e')][_0x5c42('0x32')]));_0x45bc44['attributes']=_0x45bc44[_0x5c42('0x30')][_0x5c42('0x33')]?_0x45bc44[_0x5c42('0x30')]:_0x15de9a[_0x5c42('0x2d')];_0x45bc44[_0x5c42('0x35')]=qs[_0x5c42('0x36')](_0x1c236a[_0x5c42('0x2e')]['sort']);_0x45bc44[_0x5c42('0x37')]=qs[_0x5c42('0x2f')](_[_0x5c42('0x38')](_0x1c236a[_0x5c42('0x2e')],_0x15de9a['filters']));if(_0x1c236a['query'][_0x5c42('0x39')]){_0x45bc44[_0x5c42('0x37')]=_[_0x5c42('0x3b')](_0x45bc44['where'],{'$or':_[_0x5c42('0x29')](_0x45bc44['attributes'],function(_0x358e09){var _0x54848a={};_0x54848a[_0x358e09]={'$like':'%'+_0x1c236a[_0x5c42('0x2e')]['filter']+'%'};return _0x54848a;})});}_0x45bc44=_['merge']({},_0x45bc44,_0x1c236a[_0x5c42('0x4e')]);return _0x12c9ed[_0x5c42('0x4f')](_0x45bc44);}})[_0x5c42('0x25')](function(_0x35807b){if(_0x35807b){_0x2b7186=_0x35807b[_0x5c42('0x33')];if(!_0x1c236a[_0x5c42('0x2e')][_0x5c42('0x34')]('nolimit')){_0x45bc44[_0x5c42('0x1d')]=qs[_0x5c42('0x1d')](_0x1c236a[_0x5c42('0x2e')][_0x5c42('0x1d')]);_0x45bc44['offset']=qs['offset'](_0x1c236a[_0x5c42('0x2e')][_0x5c42('0x1b')]);}return _0x12c9ed['getDescriptions'](_0x45bc44);}})['then'](function(_0xab8060){if(_0xab8060){return _0xab8060?{'count':_0x2b7186,'rows':_0xab8060}:null;}})[_0x5c42('0x25')](respondWithResult(_0x31e296,null))[_0x5c42('0x47')](handleError(_0x31e296,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4efc415..aa81394 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 _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x4b84[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x1ba6d7,_0x5e8ccc){var _0x36b73a=function(_0x2bd099){while(--_0x2bd099){_0x1ba6d7['push'](_0x1ba6d7['shift']());}};_0x36b73a(++_0x5e8ccc);}(_0xdace,0xc5));var _0xedac=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xdace[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 36c7866..77ed15c 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 _0x6e26=['then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x6e26,0x128));var _0x66e2=function(_0x2cab3e,_0x329466){_0x2cab3e=_0x2cab3e-0x0;var _0x48ff80=_0x6e26[_0x2cab3e];return _0x48ff80;};'use strict';var _=require(_0x66e2('0x0'));var util=require(_0x66e2('0x1'));var moment=require(_0x66e2('0x2'));var BPromise=require(_0x66e2('0x3'));var rs=require(_0x66e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x66e2('0x6'))(_0x66e2('0x7'));var config=require('../../config/environment');var jayson=require(_0x66e2('0x8'));var client=jayson[_0x66e2('0x9')][_0x66e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28b6f9,_0x182884,_0x590413){return new BPromise(function(_0x41f735,_0x9fc3e2){return client[_0x66e2('0xb')](_0x28b6f9,_0x590413)[_0x66e2('0xc')](function(_0x7da835){logger['info'](_0x66e2('0xd'),_0x182884,_0x66e2('0xe'));logger['debug'](_0x66e2('0xf'),_0x182884,_0x66e2('0xe'),JSON[_0x66e2('0x10')](_0x7da835));if(_0x7da835[_0x66e2('0x11')]){if(_0x7da835['error'][_0x66e2('0x12')]===0x1f4){logger[_0x66e2('0x11')](_0x66e2('0xd'),_0x182884,_0x7da835[_0x66e2('0x11')][_0x66e2('0x13')]);return _0x9fc3e2(_0x7da835['error'][_0x66e2('0x13')]);}logger['error'](_0x66e2('0xd'),_0x182884,_0x7da835['error'][_0x66e2('0x13')]);return _0x41f735(_0x7da835[_0x66e2('0x11')][_0x66e2('0x13')]);}else{logger[_0x66e2('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x182884,_0x66e2('0xe'));_0x41f735(_0x7da835['result'][_0x66e2('0x13')]);}})[_0x66e2('0x15')](function(_0x119a59){logger['error'](_0x66e2('0xd'),_0x182884,_0x119a59);_0x9fc3e2(_0x119a59);});});} \ No newline at end of file +var _0xa684=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa684,0xd3));var _0x4a68=function(_0x3c2787,_0x3238aa){_0x3c2787=_0x3c2787-0x0;var _0x2518d1=_0xa684[_0x3c2787];return _0x2518d1;};'use strict';var _=require(_0x4a68('0x0'));var util=require(_0x4a68('0x1'));var moment=require(_0x4a68('0x2'));var BPromise=require(_0x4a68('0x3'));var rs=require(_0x4a68('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4a68('0x5'))(_0x4a68('0x6'));var config=require(_0x4a68('0x7'));var jayson=require(_0x4a68('0x8'));var client=jayson[_0x4a68('0x9')][_0x4a68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e64ad,_0x52ec59,_0x2e6d8d){return new BPromise(function(_0x2f966,_0x3691b8){return client[_0x4a68('0xb')](_0x4e64ad,_0x2e6d8d)[_0x4a68('0xc')](function(_0x56ac92){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x52ec59,_0x4a68('0xd'));logger[_0x4a68('0xe')](_0x4a68('0xf'),_0x52ec59,_0x4a68('0xd'),JSON[_0x4a68('0x10')](_0x56ac92));if(_0x56ac92[_0x4a68('0x11')]){if(_0x56ac92['error'][_0x4a68('0x12')]===0x1f4){logger[_0x4a68('0x11')](_0x4a68('0x13'),_0x52ec59,_0x56ac92[_0x4a68('0x11')][_0x4a68('0x14')]);return _0x3691b8(_0x56ac92['error'][_0x4a68('0x14')]);}logger[_0x4a68('0x11')](_0x4a68('0x13'),_0x52ec59,_0x56ac92[_0x4a68('0x11')][_0x4a68('0x14')]);return _0x2f966(_0x56ac92['error'][_0x4a68('0x14')]);}else{logger[_0x4a68('0x15')](_0x4a68('0x13'),_0x52ec59,_0x4a68('0xd'));_0x2f966(_0x56ac92[_0x4a68('0x16')]['message']);}})[_0x4a68('0x17')](function(_0x5f0ac1){logger[_0x4a68('0x11')](_0x4a68('0x13'),_0x52ec59,_0x5f0ac1);_0x3691b8(_0x5f0ac1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index be891ae..7b100eb 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 _0xa160=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x16b962,_0x1e8b75){var _0x5b8877=function(_0x451ea6){while(--_0x451ea6){_0x16b962['push'](_0x16b962['shift']());}};_0x5b8877(++_0x1e8b75);}(_0xa160,0x80));var _0x0a16=function(_0x555c99,_0x214b63){_0x555c99=_0x555c99-0x0;var _0x2c1f9e=_0xa160[_0x555c99];return _0x2c1f9e;};'use strict';var multer=require(_0x0a16('0x0'));var util=require(_0x0a16('0x1'));var path=require(_0x0a16('0x2'));var timeout=require(_0x0a16('0x3'));var express=require('express');var router=express[_0x0a16('0x4')]();var fs_extra=require(_0x0a16('0x5'));var auth=require(_0x0a16('0x6'));var interaction=require(_0x0a16('0x7'));var config=require(_0x0a16('0x8'));var controller=require(_0x0a16('0x9'));router['get']('/',auth[_0x0a16('0xa')](),controller[_0x0a16('0xb')]);router['get'](_0x0a16('0xc'),auth['isAuthenticated'](),controller[_0x0a16('0xd')]);router[_0x0a16('0xe')]('/',auth[_0x0a16('0xa')](),controller['create']);router[_0x0a16('0xf')](_0x0a16('0xc'),auth[_0x0a16('0xa')](),controller[_0x0a16('0x10')]);router[_0x0a16('0x11')](_0x0a16('0xc'),auth[_0x0a16('0xa')](),controller[_0x0a16('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8d47=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x52f15c,_0x523a3a){var _0x44f7bb=function(_0x230c4d){while(--_0x230c4d){_0x52f15c['push'](_0x52f15c['shift']());}};_0x44f7bb(++_0x523a3a);}(_0x8d47,0x1df));var _0x78d4=function(_0x3927bb,_0x27a18c){_0x3927bb=_0x3927bb-0x0;var _0x57caef=_0x8d47[_0x3927bb];return _0x57caef;};'use strict';var multer=require(_0x78d4('0x0'));var util=require('util');var path=require(_0x78d4('0x1'));var timeout=require(_0x78d4('0x2'));var express=require(_0x78d4('0x3'));var router=express[_0x78d4('0x4')]();var fs_extra=require(_0x78d4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x78d4('0x6'));var config=require(_0x78d4('0x7'));var controller=require(_0x78d4('0x8'));router[_0x78d4('0x9')]('/',auth[_0x78d4('0xa')](),controller[_0x78d4('0xb')]);router[_0x78d4('0x9')](_0x78d4('0xc'),auth[_0x78d4('0xa')](),controller[_0x78d4('0xd')]);router[_0x78d4('0xe')]('/',auth[_0x78d4('0xa')](),controller['create']);router[_0x78d4('0xf')](_0x78d4('0xc'),auth[_0x78d4('0xa')](),controller[_0x78d4('0x10')]);router[_0x78d4('0x11')](_0x78d4('0xc'),auth[_0x78d4('0xa')](),controller[_0x78d4('0x12')]);module[_0x78d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index d266333..5977cb5 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 _0x5233=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x767d25,_0x5e22b4){var _0x2f5e62=function(_0x1d2d14){while(--_0x1d2d14){_0x767d25['push'](_0x767d25['shift']());}};_0x2f5e62(++_0x5e22b4);}(_0x5233,0xe5));var _0x3523=function(_0x1330e3,_0x3167f8){_0x1330e3=_0x1330e3-0x0;var _0x4d248f=_0x5233[_0x1330e3];return _0x4d248f;};'use strict';var Sequelize=require('sequelize');module[_0x3523('0x0')]={'type':{'type':Sequelize[_0x3523('0x1')](_0x3523('0x2'),'variable',_0x3523('0x3'),_0x3523('0x4'),_0x3523('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3523('0x6')]},'key':{'type':Sequelize[_0x3523('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x3523('0x3'))},'keyContent':{'type':Sequelize[_0x3523('0x6')]},'idField':{'type':Sequelize[_0x3523('0x6')]},'nameField':{'type':Sequelize[_0x3523('0x6')]},'customField':{'type':Sequelize[_0x3523('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3523('0x6')]}}; \ No newline at end of file +var _0x85fc=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x4d8eb2,_0xd781bb){var _0x9aed9c=function(_0x1635c3){while(--_0x1635c3){_0x4d8eb2['push'](_0x4d8eb2['shift']());}};_0x9aed9c(++_0xd781bb);}(_0x85fc,0xfe));var _0xc85f=function(_0x589f7f,_0xfcf6cf){_0x589f7f=_0x589f7f-0x0;var _0x151ce4=_0x85fc[_0x589f7f];return _0x151ce4;};'use strict';var Sequelize=require(_0xc85f('0x0'));module['exports']={'type':{'type':Sequelize[_0xc85f('0x1')](_0xc85f('0x2'),_0xc85f('0x3'),_0xc85f('0x4'),_0xc85f('0x5'),'picklist'),'defaultValue':_0xc85f('0x2')},'content':{'type':Sequelize[_0xc85f('0x6')]},'key':{'type':Sequelize[_0xc85f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc85f('0x2'),_0xc85f('0x3'),_0xc85f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc85f('0x6')]},'nameField':{'type':Sequelize[_0xc85f('0x6')]},'customField':{'type':Sequelize[_0xc85f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 28452fc..154c286 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 _0x6eb3=['error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','intersection','query','attributes','fields','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Dynamics365Field','include','findAll','then','params','includeAll','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy'];(function(_0x3dd9bf,_0x4a6213){var _0x3578df=function(_0x5b0474){while(--_0x5b0474){_0x3dd9bf['push'](_0x3dd9bf['shift']());}};_0x3578df(++_0x4a6213);}(_0x6eb3,0x6a));var _0x36eb=function(_0x1e7201,_0x32d3e5){_0x1e7201=_0x1e7201-0x0;var _0x3517cc=_0x6eb3[_0x1e7201];return _0x3517cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36eb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36eb('0x1'));var rp=require(_0x36eb('0x2'));var moment=require(_0x36eb('0x3'));var BPromise=require(_0x36eb('0x4'));var Mustache=require('mustache');var util=require(_0x36eb('0x5'));var path=require('path');var sox=require(_0x36eb('0x6'));var csv=require(_0x36eb('0x7'));var ejs=require(_0x36eb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36eb('0x9'));var squel=require(_0x36eb('0xa'));var crypto=require(_0x36eb('0xb'));var jsforce=require(_0x36eb('0xc'));var deskjs=require(_0x36eb('0xd'));var toCsv=require(_0x36eb('0x7'));var querystring=require(_0x36eb('0xe'));var Papa=require('papaparse');var Redis=require(_0x36eb('0xf'));var authService=require(_0x36eb('0x10'));var qs=require(_0x36eb('0x11'));var as=require(_0x36eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36eb('0x13'));var utils=require(_0x36eb('0x14'));var config=require(_0x36eb('0x15'));var licenseUtil=require(_0x36eb('0x16'));var db=require(_0x36eb('0x17'))['db'];function respondWithStatusCode(_0x5d8e90,_0x5272aa){_0x5272aa=_0x5272aa||0xcc;return function(_0x3a0b66){if(_0x3a0b66){return _0x5d8e90['sendStatus'](_0x5272aa);}return _0x5d8e90['status'](_0x5272aa)[_0x36eb('0x18')]();};}function respondWithResult(_0x11aff3,_0x385c85){_0x385c85=_0x385c85||0xc8;return function(_0x2f8c4c){if(_0x2f8c4c){return _0x11aff3[_0x36eb('0x19')](_0x385c85)[_0x36eb('0x1a')](_0x2f8c4c);}};}function respondWithFilteredResult(_0x109fa0,_0x295e64){return function(_0x3a1d75){if(_0x3a1d75){var _0x5b54ae=typeof _0x295e64[_0x36eb('0x1b')]===_0x36eb('0x1c')&&typeof _0x295e64[_0x36eb('0x1d')]===_0x36eb('0x1c');var _0x4be1ef=_0x3a1d75[_0x36eb('0x1e')];var _0x20044d=_0x5b54ae?0x0:_0x295e64[_0x36eb('0x1b')];var _0x25f4d2=_0x5b54ae?_0x3a1d75[_0x36eb('0x1e')]:_0x295e64[_0x36eb('0x1b')]+_0x295e64[_0x36eb('0x1d')];var _0x2d5df2;if(_0x25f4d2>=_0x4be1ef){_0x25f4d2=_0x4be1ef;_0x2d5df2=0xc8;}else{_0x2d5df2=0xce;}_0x109fa0[_0x36eb('0x19')](_0x2d5df2);return _0x109fa0['set'](_0x36eb('0x1f'),_0x20044d+'-'+_0x25f4d2+'/'+_0x4be1ef)[_0x36eb('0x1a')](_0x3a1d75);}return null;};}function patchUpdates(_0x1f50f5){return function(_0x1fb301){try{jsonpatch[_0x36eb('0x20')](_0x1fb301,_0x1f50f5,!![]);}catch(_0x3ba4e7){return BPromise[_0x36eb('0x21')](_0x3ba4e7);}return _0x1fb301['save']();};}function saveUpdates(_0x14b52c,_0x2d0f50){return function(_0x7fae57){if(_0x7fae57){return _0x7fae57[_0x36eb('0x22')](_0x14b52c)['then'](function(_0x967edd){return _0x967edd;});}return null;};}function removeEntity(_0x2f3be3,_0x2d5a09){return function(_0x845086){if(_0x845086){return _0x845086[_0x36eb('0x23')]()['then'](function(){_0x2f3be3[_0x36eb('0x19')](0xcc)[_0x36eb('0x18')]();});}};}function handleEntityNotFound(_0x226237,_0x1e9276){return function(_0x2b4710){if(!_0x2b4710){_0x226237['sendStatus'](0x194);}return _0x2b4710;};}function handleError(_0x1df4ba,_0x54be1c){_0x54be1c=_0x54be1c||0x1f4;return function(_0x41f630){logger[_0x36eb('0x24')](_0x41f630[_0x36eb('0x25')]);if(_0x41f630[_0x36eb('0x26')]){delete _0x41f630['name'];}_0x1df4ba[_0x36eb('0x19')](_0x54be1c)[_0x36eb('0x27')](_0x41f630);};}exports[_0x36eb('0x28')]=function(_0x3108fb,_0x30db51){var _0xbdbb0f={},_0x258e7a={},_0x471e0d={'count':0x0,'rows':[]};var _0x5909b4=_['map'](db['Dynamics365Field'][_0x36eb('0x29')],function(_0x2ee475){return{'name':_0x2ee475[_0x36eb('0x2a')],'type':_0x2ee475[_0x36eb('0x2b')][_0x36eb('0x2c')]};});_0x258e7a[_0x36eb('0x2d')]=_[_0x36eb('0x2e')](_0x5909b4,_0x36eb('0x26'));_0x258e7a['query']=_['keys'](_0x3108fb['query']);_0x258e7a['filters']=_[_0x36eb('0x2f')](_0x258e7a[_0x36eb('0x2d')],_0x258e7a[_0x36eb('0x30')]);_0xbdbb0f[_0x36eb('0x31')]=_[_0x36eb('0x2f')](_0x258e7a[_0x36eb('0x2d')],qs[_0x36eb('0x32')](_0x3108fb[_0x36eb('0x30')][_0x36eb('0x32')]));_0xbdbb0f[_0x36eb('0x31')]=_0xbdbb0f[_0x36eb('0x31')][_0x36eb('0x33')]?_0xbdbb0f[_0x36eb('0x31')]:_0x258e7a[_0x36eb('0x2d')];if(!_0x3108fb['query']['hasOwnProperty']('nolimit')){_0xbdbb0f[_0x36eb('0x1d')]=qs['limit'](_0x3108fb[_0x36eb('0x30')][_0x36eb('0x1d')]);_0xbdbb0f[_0x36eb('0x1b')]=qs[_0x36eb('0x1b')](_0x3108fb[_0x36eb('0x30')][_0x36eb('0x1b')]);}_0xbdbb0f[_0x36eb('0x34')]=qs[_0x36eb('0x35')](_0x3108fb[_0x36eb('0x30')][_0x36eb('0x35')]);_0xbdbb0f[_0x36eb('0x36')]=qs[_0x36eb('0x37')](_[_0x36eb('0x38')](_0x3108fb[_0x36eb('0x30')],_0x258e7a[_0x36eb('0x37')]),_0x5909b4);if(_0x3108fb[_0x36eb('0x30')][_0x36eb('0x39')]){_0xbdbb0f[_0x36eb('0x36')]=_['merge'](_0xbdbb0f[_0x36eb('0x36')],{'$or':_[_0x36eb('0x2e')](_0x5909b4,function(_0x27c7bb){if(_0x27c7bb[_0x36eb('0x2b')]!==_0x36eb('0x3a')){var _0x5e9b57={};_0x5e9b57[_0x27c7bb['name']]={'$like':'%'+_0x3108fb[_0x36eb('0x30')][_0x36eb('0x39')]+'%'};return _0x5e9b57;}})});}_0xbdbb0f=_[_0x36eb('0x3b')]({},_0xbdbb0f,_0x3108fb[_0x36eb('0x3c')]);var _0xcc9625={'where':_0xbdbb0f[_0x36eb('0x36')]};return db[_0x36eb('0x3d')][_0x36eb('0x1e')](_0xcc9625)['then'](function(_0x21605e){_0x471e0d[_0x36eb('0x1e')]=_0x21605e;if(_0x3108fb[_0x36eb('0x30')]['includeAll']){_0xbdbb0f[_0x36eb('0x3e')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x36eb('0x3f')](_0xbdbb0f);})['then'](function(_0x26bc95){_0x471e0d['rows']=_0x26bc95;return _0x471e0d;})[_0x36eb('0x40')](respondWithFilteredResult(_0x30db51,_0xbdbb0f))['catch'](handleError(_0x30db51,null));};exports['show']=function(_0x23e7b6,_0x4b1a3c){var _0x1c530f={'raw':!![],'where':{'id':_0x23e7b6[_0x36eb('0x41')]['id']}},_0x7a81a1={};_0x7a81a1[_0x36eb('0x2d')]=_['keys'](db[_0x36eb('0x3d')][_0x36eb('0x29')]);_0x7a81a1[_0x36eb('0x30')]=_['keys'](_0x23e7b6[_0x36eb('0x30')]);_0x7a81a1['filters']=_[_0x36eb('0x2f')](_0x7a81a1[_0x36eb('0x2d')],_0x7a81a1[_0x36eb('0x30')]);_0x1c530f[_0x36eb('0x31')]=_[_0x36eb('0x2f')](_0x7a81a1[_0x36eb('0x2d')],qs['fields'](_0x23e7b6[_0x36eb('0x30')][_0x36eb('0x32')]));_0x1c530f[_0x36eb('0x31')]=_0x1c530f[_0x36eb('0x31')][_0x36eb('0x33')]?_0x1c530f[_0x36eb('0x31')]:_0x7a81a1[_0x36eb('0x2d')];if(_0x23e7b6['query'][_0x36eb('0x42')]){_0x1c530f[_0x36eb('0x3e')]=[{'all':!![]}];}_0x1c530f=_[_0x36eb('0x3b')]({},_0x1c530f,_0x23e7b6[_0x36eb('0x3c')]);return db['Dynamics365Field'][_0x36eb('0x43')](_0x1c530f)[_0x36eb('0x40')](handleEntityNotFound(_0x4b1a3c,null))['then'](respondWithResult(_0x4b1a3c,null))[_0x36eb('0x44')](handleError(_0x4b1a3c,null));};exports[_0x36eb('0x45')]=function(_0xe128c0,_0x529e0a){return db['Dynamics365Field'][_0x36eb('0x45')](_0xe128c0['body'],{})[_0x36eb('0x40')](respondWithResult(_0x529e0a,0xc9))['catch'](handleError(_0x529e0a,null));};exports[_0x36eb('0x22')]=function(_0x512b3b,_0x3623e2){if(_0x512b3b[_0x36eb('0x46')]['id']){delete _0x512b3b[_0x36eb('0x46')]['id'];}return db['Dynamics365Field'][_0x36eb('0x43')]({'where':{'id':_0x512b3b['params']['id']}})[_0x36eb('0x40')](handleEntityNotFound(_0x3623e2,null))['then'](saveUpdates(_0x512b3b[_0x36eb('0x46')],null))[_0x36eb('0x40')](respondWithResult(_0x3623e2,null))[_0x36eb('0x44')](handleError(_0x3623e2,null));};exports[_0x36eb('0x23')]=function(_0x4d39aa,_0x190913){return db['Dynamics365Field'][_0x36eb('0x43')]({'where':{'id':_0x4d39aa[_0x36eb('0x41')]['id']}})[_0x36eb('0x40')](handleEntityNotFound(_0x190913,null))[_0x36eb('0x40')](removeEntity(_0x190913,null))[_0x36eb('0x44')](handleError(_0x190913,null));}; \ No newline at end of file +var _0xd2cc=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','fields','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x355f93,_0x1b71d3){var _0xc630e=function(_0x56ed08){while(--_0x56ed08){_0x355f93['push'](_0x355f93['shift']());}};_0xc630e(++_0x1b71d3);}(_0xd2cc,0x82));var _0xcd2c=function(_0x19df1f,_0x20ae7d){_0x19df1f=_0x19df1f-0x0;var _0x10a183=_0xd2cc[_0x19df1f];return _0x10a183;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd2c('0x0'));var zipdir=require(_0xcd2c('0x1'));var jsonpatch=require(_0xcd2c('0x2'));var rp=require(_0xcd2c('0x3'));var moment=require(_0xcd2c('0x4'));var BPromise=require(_0xcd2c('0x5'));var Mustache=require('mustache');var util=require(_0xcd2c('0x6'));var path=require(_0xcd2c('0x7'));var sox=require('sox');var csv=require(_0xcd2c('0x8'));var ejs=require(_0xcd2c('0x9'));var fs=require('fs');var fs_extra=require(_0xcd2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd2c('0xb'));var deskjs=require(_0xcd2c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcd2c('0xd'));var Papa=require(_0xcd2c('0xe'));var Redis=require(_0xcd2c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcd2c('0x10'));var hardwareService=require(_0xcd2c('0x11'));var logger=require('../../config/logger')(_0xcd2c('0x12'));var utils=require(_0xcd2c('0x13'));var config=require(_0xcd2c('0x14'));var licenseUtil=require(_0xcd2c('0x15'));var db=require(_0xcd2c('0x16'))['db'];function respondWithStatusCode(_0x24c590,_0x3abf5a){_0x3abf5a=_0x3abf5a||0xcc;return function(_0x59f838){if(_0x59f838){return _0x24c590[_0xcd2c('0x17')](_0x3abf5a);}return _0x24c590[_0xcd2c('0x18')](_0x3abf5a)[_0xcd2c('0x19')]();};}function respondWithResult(_0x399a08,_0x42fc07){_0x42fc07=_0x42fc07||0xc8;return function(_0x3e96f3){if(_0x3e96f3){return _0x399a08[_0xcd2c('0x18')](_0x42fc07)[_0xcd2c('0x1a')](_0x3e96f3);}};}function respondWithFilteredResult(_0x25f7f0,_0x4f5df6){return function(_0x19117c){if(_0x19117c){var _0x38f080=typeof _0x4f5df6[_0xcd2c('0x1b')]===_0xcd2c('0x1c')&&typeof _0x4f5df6[_0xcd2c('0x1d')]===_0xcd2c('0x1c');var _0x955e9=_0x19117c['count'];var _0x520432=_0x38f080?0x0:_0x4f5df6[_0xcd2c('0x1b')];var _0x37b9f9=_0x38f080?_0x19117c[_0xcd2c('0x1e')]:_0x4f5df6[_0xcd2c('0x1b')]+_0x4f5df6[_0xcd2c('0x1d')];var _0x6b2996;if(_0x37b9f9>=_0x955e9){_0x37b9f9=_0x955e9;_0x6b2996=0xc8;}else{_0x6b2996=0xce;}_0x25f7f0[_0xcd2c('0x18')](_0x6b2996);return _0x25f7f0[_0xcd2c('0x1f')](_0xcd2c('0x20'),_0x520432+'-'+_0x37b9f9+'/'+_0x955e9)[_0xcd2c('0x1a')](_0x19117c);}return null;};}function patchUpdates(_0x41090a){return function(_0x182337){try{jsonpatch[_0xcd2c('0x21')](_0x182337,_0x41090a,!![]);}catch(_0x3f1344){return BPromise[_0xcd2c('0x22')](_0x3f1344);}return _0x182337[_0xcd2c('0x23')]();};}function saveUpdates(_0x421a77,_0xff21f0){return function(_0x4e6169){if(_0x4e6169){return _0x4e6169[_0xcd2c('0x24')](_0x421a77)[_0xcd2c('0x25')](function(_0x2d22f8){return _0x2d22f8;});}return null;};}function removeEntity(_0x5a3a5c,_0x1adc78){return function(_0x25d777){if(_0x25d777){return _0x25d777[_0xcd2c('0x26')]()[_0xcd2c('0x25')](function(){_0x5a3a5c[_0xcd2c('0x18')](0xcc)[_0xcd2c('0x19')]();});}};}function handleEntityNotFound(_0x55124e,_0x1d1d00){return function(_0x5b50e4){if(!_0x5b50e4){_0x55124e['sendStatus'](0x194);}return _0x5b50e4;};}function handleError(_0x2ff67b,_0x1ad4a4){_0x1ad4a4=_0x1ad4a4||0x1f4;return function(_0xf26606){logger[_0xcd2c('0x27')](_0xf26606[_0xcd2c('0x28')]);if(_0xf26606['name']){delete _0xf26606[_0xcd2c('0x29')];}_0x2ff67b[_0xcd2c('0x18')](_0x1ad4a4)[_0xcd2c('0x2a')](_0xf26606);};}exports[_0xcd2c('0x2b')]=function(_0xe740f1,_0x34c44d){var _0x2c0e86={},_0x9bbba9={},_0x2f500d={'count':0x0,'rows':[]};var _0x184709=_[_0xcd2c('0x2c')](db[_0xcd2c('0x2d')][_0xcd2c('0x2e')],function(_0x4dac86){return{'name':_0x4dac86[_0xcd2c('0x2f')],'type':_0x4dac86[_0xcd2c('0x30')][_0xcd2c('0x31')]};});_0x9bbba9[_0xcd2c('0x32')]=_[_0xcd2c('0x2c')](_0x184709,_0xcd2c('0x29'));_0x9bbba9[_0xcd2c('0x33')]=_[_0xcd2c('0x34')](_0xe740f1[_0xcd2c('0x33')]);_0x9bbba9[_0xcd2c('0x35')]=_[_0xcd2c('0x36')](_0x9bbba9[_0xcd2c('0x32')],_0x9bbba9[_0xcd2c('0x33')]);_0x2c0e86[_0xcd2c('0x37')]=_[_0xcd2c('0x36')](_0x9bbba9[_0xcd2c('0x32')],qs['fields'](_0xe740f1[_0xcd2c('0x33')]['fields']));_0x2c0e86[_0xcd2c('0x37')]=_0x2c0e86['attributes'][_0xcd2c('0x38')]?_0x2c0e86[_0xcd2c('0x37')]:_0x9bbba9[_0xcd2c('0x32')];if(!_0xe740f1[_0xcd2c('0x33')][_0xcd2c('0x39')]('nolimit')){_0x2c0e86[_0xcd2c('0x1d')]=qs[_0xcd2c('0x1d')](_0xe740f1[_0xcd2c('0x33')][_0xcd2c('0x1d')]);_0x2c0e86['offset']=qs['offset'](_0xe740f1[_0xcd2c('0x33')]['offset']);}_0x2c0e86[_0xcd2c('0x3a')]=qs[_0xcd2c('0x3b')](_0xe740f1[_0xcd2c('0x33')][_0xcd2c('0x3b')]);_0x2c0e86[_0xcd2c('0x3c')]=qs[_0xcd2c('0x35')](_[_0xcd2c('0x3d')](_0xe740f1[_0xcd2c('0x33')],_0x9bbba9['filters']),_0x184709);if(_0xe740f1[_0xcd2c('0x33')][_0xcd2c('0x3e')]){_0x2c0e86[_0xcd2c('0x3c')]=_[_0xcd2c('0x3f')](_0x2c0e86[_0xcd2c('0x3c')],{'$or':_[_0xcd2c('0x2c')](_0x184709,function(_0x30b4a7){if(_0x30b4a7[_0xcd2c('0x30')]!==_0xcd2c('0x40')){var _0x45e945={};_0x45e945[_0x30b4a7[_0xcd2c('0x29')]]={'$like':'%'+_0xe740f1[_0xcd2c('0x33')][_0xcd2c('0x3e')]+'%'};return _0x45e945;}})});}_0x2c0e86=_['merge']({},_0x2c0e86,_0xe740f1[_0xcd2c('0x41')]);var _0x225908={'where':_0x2c0e86[_0xcd2c('0x3c')]};return db[_0xcd2c('0x2d')][_0xcd2c('0x1e')](_0x225908)[_0xcd2c('0x25')](function(_0x5267db){_0x2f500d[_0xcd2c('0x1e')]=_0x5267db;if(_0xe740f1['query']['includeAll']){_0x2c0e86['include']=[{'all':!![]}];}return db[_0xcd2c('0x2d')][_0xcd2c('0x42')](_0x2c0e86);})[_0xcd2c('0x25')](function(_0x3264e5){_0x2f500d[_0xcd2c('0x43')]=_0x3264e5;return _0x2f500d;})[_0xcd2c('0x25')](respondWithFilteredResult(_0x34c44d,_0x2c0e86))[_0xcd2c('0x44')](handleError(_0x34c44d,null));};exports['show']=function(_0x2c2c8b,_0x53b5d9){var _0xeafdb1={'raw':!![],'where':{'id':_0x2c2c8b[_0xcd2c('0x45')]['id']}},_0x47c9dc={};_0x47c9dc[_0xcd2c('0x32')]=_['keys'](db[_0xcd2c('0x2d')][_0xcd2c('0x2e')]);_0x47c9dc[_0xcd2c('0x33')]=_[_0xcd2c('0x34')](_0x2c2c8b[_0xcd2c('0x33')]);_0x47c9dc[_0xcd2c('0x35')]=_[_0xcd2c('0x36')](_0x47c9dc[_0xcd2c('0x32')],_0x47c9dc[_0xcd2c('0x33')]);_0xeafdb1[_0xcd2c('0x37')]=_['intersection'](_0x47c9dc[_0xcd2c('0x32')],qs['fields'](_0x2c2c8b['query'][_0xcd2c('0x46')]));_0xeafdb1[_0xcd2c('0x37')]=_0xeafdb1[_0xcd2c('0x37')]['length']?_0xeafdb1[_0xcd2c('0x37')]:_0x47c9dc['model'];if(_0x2c2c8b[_0xcd2c('0x33')][_0xcd2c('0x47')]){_0xeafdb1[_0xcd2c('0x48')]=[{'all':!![]}];}_0xeafdb1=_['merge']({},_0xeafdb1,_0x2c2c8b[_0xcd2c('0x41')]);return db[_0xcd2c('0x2d')][_0xcd2c('0x49')](_0xeafdb1)[_0xcd2c('0x25')](handleEntityNotFound(_0x53b5d9,null))[_0xcd2c('0x25')](respondWithResult(_0x53b5d9,null))[_0xcd2c('0x44')](handleError(_0x53b5d9,null));};exports[_0xcd2c('0x4a')]=function(_0xf7bb80,_0x3aa1a9){return db[_0xcd2c('0x2d')][_0xcd2c('0x4a')](_0xf7bb80[_0xcd2c('0x4b')],{})['then'](respondWithResult(_0x3aa1a9,0xc9))[_0xcd2c('0x44')](handleError(_0x3aa1a9,null));};exports['update']=function(_0x22eb2c,_0xba14f2){if(_0x22eb2c[_0xcd2c('0x4b')]['id']){delete _0x22eb2c[_0xcd2c('0x4b')]['id'];}return db[_0xcd2c('0x2d')][_0xcd2c('0x49')]({'where':{'id':_0x22eb2c['params']['id']}})[_0xcd2c('0x25')](handleEntityNotFound(_0xba14f2,null))[_0xcd2c('0x25')](saveUpdates(_0x22eb2c[_0xcd2c('0x4b')],null))[_0xcd2c('0x25')](respondWithResult(_0xba14f2,null))[_0xcd2c('0x44')](handleError(_0xba14f2,null));};exports[_0xcd2c('0x26')]=function(_0x46fd66,_0x5c4871){return db['Dynamics365Field'][_0xcd2c('0x49')]({'where':{'id':_0x46fd66[_0xcd2c('0x45')]['id']}})[_0xcd2c('0x25')](handleEntityNotFound(_0x5c4871,null))[_0xcd2c('0x25')](removeEntity(_0x5c4871,null))[_0xcd2c('0x44')](handleError(_0x5c4871,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ef523fe..dc8fd57 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 _0x60b2=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x60b2,0xe3));var _0x260b=function(_0x5b8685,_0x1a1c28){_0x5b8685=_0x5b8685-0x0;var _0xa3ef57=_0x60b2[_0x5b8685];return _0xa3ef57;};'use strict';var _=require(_0x260b('0x0'));var util=require('util');var logger=require(_0x260b('0x1'))(_0x260b('0x2'));var moment=require(_0x260b('0x3'));var BPromise=require(_0x260b('0x4'));var rp=require(_0x260b('0x5'));var fs=require('fs');var path=require(_0x260b('0x6'));var rimraf=require(_0x260b('0x7'));var config=require('../../config/environment');var attributes=require(_0x260b('0x8'));module[_0x260b('0x9')]=function(_0x56ab55,_0x1e035e){return _0x56ab55[_0x260b('0xa')](_0x260b('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x260b('0xc'),'fields':[_0x260b('0xd'),_0x260b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaefa=['../../config/environment','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xaefa,0x17d));var _0xaaef=function(_0x3a505b,_0x57c8d2){_0x3a505b=_0x3a505b-0x0;var _0x274da2=_0xaefa[_0x3a505b];return _0x274da2;};'use strict';var _=require(_0xaaef('0x0'));var util=require(_0xaaef('0x1'));var logger=require(_0xaaef('0x2'))(_0xaaef('0x3'));var moment=require(_0xaaef('0x4'));var BPromise=require(_0xaaef('0x5'));var rp=require(_0xaaef('0x6'));var fs=require('fs');var path=require(_0xaaef('0x7'));var rimraf=require(_0xaaef('0x8'));var config=require(_0xaaef('0x9'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x4e9133,_0x30255d){return _0x4e9133[_0xaaef('0xa')](_0xaaef('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xaaef('0xc'),'fields':[_0xaaef('0xd'),_0xaaef('0xe')],'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 44bb5c3..9c38ec3 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 _0x3c3e=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x31c82b,_0x3124dd){var _0x4d1e5f=function(_0x34a986){while(--_0x34a986){_0x31c82b['push'](_0x31c82b['shift']());}};_0x4d1e5f(++_0x3124dd);}(_0x3c3e,0x17e));var _0xe3c3=function(_0x4ab371,_0x218c3b){_0x4ab371=_0x4ab371-0x0;var _0xccf2ba=_0x3c3e[_0x4ab371];return _0xccf2ba;};'use strict';var _=require(_0xe3c3('0x0'));var util=require(_0xe3c3('0x1'));var moment=require(_0xe3c3('0x2'));var BPromise=require(_0xe3c3('0x3'));var rs=require(_0xe3c3('0x4'));var fs=require('fs');var Redis=require(_0xe3c3('0x5'));var db=require(_0xe3c3('0x6'))['db'];var utils=require(_0xe3c3('0x7'));var logger=require(_0xe3c3('0x8'))(_0xe3c3('0x9'));var config=require(_0xe3c3('0xa'));var jayson=require(_0xe3c3('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf9b746,_0xbb920e,_0x6d35b1){return new BPromise(function(_0x3a1f65,_0x973845){return client[_0xe3c3('0xc')](_0xf9b746,_0x6d35b1)[_0xe3c3('0xd')](function(_0x4aa448){logger['info'](_0xe3c3('0xe'),_0xbb920e,_0xe3c3('0xf'));logger[_0xe3c3('0x10')](_0xe3c3('0x11'),_0xbb920e,_0xe3c3('0xf'),JSON[_0xe3c3('0x12')](_0x4aa448));if(_0x4aa448[_0xe3c3('0x13')]){if(_0x4aa448['error'][_0xe3c3('0x14')]===0x1f4){logger[_0xe3c3('0x13')](_0xe3c3('0xe'),_0xbb920e,_0x4aa448[_0xe3c3('0x13')][_0xe3c3('0x15')]);return _0x973845(_0x4aa448[_0xe3c3('0x13')][_0xe3c3('0x15')]);}logger[_0xe3c3('0x13')](_0xe3c3('0xe'),_0xbb920e,_0x4aa448[_0xe3c3('0x13')][_0xe3c3('0x15')]);return _0x3a1f65(_0x4aa448[_0xe3c3('0x13')][_0xe3c3('0x15')]);}else{logger[_0xe3c3('0x16')](_0xe3c3('0xe'),_0xbb920e,_0xe3c3('0xf'));_0x3a1f65(_0x4aa448[_0xe3c3('0x17')][_0xe3c3('0x15')]);}})[_0xe3c3('0x18')](function(_0x50e95a){logger[_0xe3c3('0x13')](_0xe3c3('0xe'),_0xbb920e,_0x50e95a);_0x973845(_0x50e95a);});});} \ No newline at end of file +var _0x4ea6=['message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','request','then','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4ea6,0x8b));var _0x64ea=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x4ea6[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x64ea('0x0'));var util=require('util');var moment=require(_0x64ea('0x1'));var BPromise=require(_0x64ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64ea('0x3'));var db=require(_0x64ea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x64ea('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x921b5f,_0x5a12ae,_0x527708){return new BPromise(function(_0x10aa36,_0x1afaae){return client[_0x64ea('0x6')](_0x921b5f,_0x527708)[_0x64ea('0x7')](function(_0x52f2f8){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x5a12ae,_0x64ea('0x8'));logger['debug'](_0x64ea('0x9'),_0x5a12ae,_0x64ea('0x8'),JSON[_0x64ea('0xa')](_0x52f2f8));if(_0x52f2f8[_0x64ea('0xb')]){if(_0x52f2f8[_0x64ea('0xb')][_0x64ea('0xc')]===0x1f4){logger[_0x64ea('0xb')](_0x64ea('0xd'),_0x5a12ae,_0x52f2f8[_0x64ea('0xb')]['message']);return _0x1afaae(_0x52f2f8[_0x64ea('0xb')][_0x64ea('0xe')]);}logger['error'](_0x64ea('0xd'),_0x5a12ae,_0x52f2f8[_0x64ea('0xb')][_0x64ea('0xe')]);return _0x10aa36(_0x52f2f8[_0x64ea('0xb')][_0x64ea('0xe')]);}else{logger[_0x64ea('0xf')](_0x64ea('0xd'),_0x5a12ae,'request\x20sent');_0x10aa36(_0x52f2f8[_0x64ea('0x10')]['message']);}})['catch'](function(_0x3dd56f){logger[_0x64ea('0xb')](_0x64ea('0xd'),_0x5a12ae,_0x3dd56f);_0x1afaae(_0x3dd56f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index e9acc0d..9cfb65e 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 _0xcdc6=['multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports'];(function(_0x3d8182,_0x1585df){var _0x14c8d9=function(_0x48fd97){while(--_0x48fd97){_0x3d8182['push'](_0x3d8182['shift']());}};_0x14c8d9(++_0x1585df);}(_0xcdc6,0x1e4));var _0x6cdc=function(_0x57f561,_0x5db8ce){_0x57f561=_0x57f561-0x0;var _0x417533=_0xcdc6[_0x57f561];return _0x417533;};'use strict';var multer=require(_0x6cdc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6cdc('0x1'));var express=require(_0x6cdc('0x2'));var router=express[_0x6cdc('0x3')]();var fs_extra=require(_0x6cdc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6cdc('0x5'));var config=require(_0x6cdc('0x6'));var controller=require(_0x6cdc('0x7'));router[_0x6cdc('0x8')]('/',auth[_0x6cdc('0x9')](),controller['index']);router['get'](_0x6cdc('0xa'),auth[_0x6cdc('0x9')](),controller[_0x6cdc('0xb')]);router[_0x6cdc('0x8')](_0x6cdc('0xc'),auth[_0x6cdc('0x9')](),controller[_0x6cdc('0xd')]);router[_0x6cdc('0x8')](_0x6cdc('0xe'),auth[_0x6cdc('0x9')](),controller[_0x6cdc('0xf')]);router[_0x6cdc('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6cdc('0x10')](_0x6cdc('0xc'),auth['isAuthenticated'](),controller[_0x6cdc('0x11')]);router[_0x6cdc('0x12')](_0x6cdc('0xa'),auth[_0x6cdc('0x9')](),controller[_0x6cdc('0x13')]);router[_0x6cdc('0x14')]('/:id',auth[_0x6cdc('0x9')](),controller['destroy']);module[_0x6cdc('0x15')]=router; \ No newline at end of file +var _0x5ff9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x59d397,_0x3e9ef6){var _0x1db33e=function(_0x1f7313){while(--_0x1f7313){_0x59d397['push'](_0x59d397['shift']());}};_0x1db33e(++_0x3e9ef6);}(_0x5ff9,0x1af));var _0x95ff=function(_0x29e495,_0x541179){_0x29e495=_0x29e495-0x0;var _0x296c3b=_0x5ff9[_0x29e495];return _0x296c3b;};'use strict';var multer=require(_0x95ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ff('0x1'));var express=require(_0x95ff('0x2'));var router=express[_0x95ff('0x3')]();var fs_extra=require(_0x95ff('0x4'));var auth=require(_0x95ff('0x5'));var interaction=require(_0x95ff('0x6'));var config=require(_0x95ff('0x7'));var controller=require(_0x95ff('0x8'));router[_0x95ff('0x9')]('/',auth[_0x95ff('0xa')](),controller[_0x95ff('0xb')]);router[_0x95ff('0x9')](_0x95ff('0xc'),auth[_0x95ff('0xa')](),controller[_0x95ff('0xd')]);router[_0x95ff('0x9')](_0x95ff('0xe'),auth[_0x95ff('0xa')](),controller[_0x95ff('0xf')]);router[_0x95ff('0x9')](_0x95ff('0x10'),auth[_0x95ff('0xa')](),controller['getFields']);router[_0x95ff('0x11')]('/',auth[_0x95ff('0xa')](),controller['create']);router['post'](_0x95ff('0xe'),auth[_0x95ff('0xa')](),controller[_0x95ff('0x12')]);router[_0x95ff('0x13')](_0x95ff('0xc'),auth[_0x95ff('0xa')](),controller[_0x95ff('0x14')]);router[_0x95ff('0x15')](_0x95ff('0xc'),auth['isAuthenticated'](),controller[_0x95ff('0x16')]);module[_0x95ff('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 12ceb72..169d5e3 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 _0x1967=['STRING','username','remoteUri','exports'];(function(_0x3f3f75,_0x5e215f){var _0x322635=function(_0x1ff524){while(--_0x1ff524){_0x3f3f75['push'](_0x3f3f75['shift']());}};_0x322635(++_0x5e215f);}(_0x1967,0x173));var _0x7196=function(_0x4173cb,_0x1fc34f){_0x4173cb=_0x4173cb-0x0;var _0x3025bb=_0x1967[_0x4173cb];return _0x3025bb;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x25f280,_0x78272f){var _0x291cc9=function(_0x2acb8f){while(--_0x2acb8f){_0x25f280['push'](_0x25f280['shift']());}};_0x291cc9(++_0x78272f);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x291dec,_0xdd77b8){_0x291dec=_0x291dec-0x0;var _0x4a22cc=_0xd7d1[_0x291dec];return _0x4a22cc;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('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 4876057..ef48c60 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 _0x3308=['AccountId','Subjects','channel','Descriptions','FreshdeskField','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','requester','agent','description','priority','ticket_type','group','company','remove','includes','default','label','choices','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','reject','save','update','then','error','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields','catch','create','body','find','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration'];(function(_0x3b6305,_0x424cee){var _0x54bd5a=function(_0x11e73f){while(--_0x11e73f){_0x3b6305['push'](_0x3b6305['shift']());}};_0x54bd5a(++_0x424cee);}(_0x3308,0x160));var _0x8330=function(_0x446f7f,_0x2b44b6){_0x446f7f=_0x446f7f-0x0;var _0x5a0164=_0x3308[_0x446f7f];return _0x5a0164;};'use strict';var emlformat=require(_0x8330('0x0'));var rimraf=require(_0x8330('0x1'));var zipdir=require(_0x8330('0x2'));var jsonpatch=require(_0x8330('0x3'));var rp=require(_0x8330('0x4'));var moment=require(_0x8330('0x5'));var BPromise=require(_0x8330('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8330('0x7'));var sox=require('sox');var csv=require(_0x8330('0x8'));var ejs=require(_0x8330('0x9'));var fs=require('fs');var fs_extra=require(_0x8330('0xa'));var _=require('lodash');var squel=require(_0x8330('0xb'));var crypto=require(_0x8330('0xc'));var jsforce=require(_0x8330('0xd'));var deskjs=require(_0x8330('0xe'));var toCsv=require(_0x8330('0x8'));var querystring=require(_0x8330('0xf'));var Papa=require('papaparse');var Redis=require(_0x8330('0x10'));var authService=require(_0x8330('0x11'));var qs=require(_0x8330('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8330('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8330('0x14'));function respondWithStatusCode(_0x1da381,_0x252953){_0x252953=_0x252953||0xcc;return function(_0x3ceb1e){if(_0x3ceb1e){return _0x1da381[_0x8330('0x15')](_0x252953);}return _0x1da381['status'](_0x252953)[_0x8330('0x16')]();};}function respondWithResult(_0x4f0cf0,_0x293658){_0x293658=_0x293658||0xc8;return function(_0x2d7e87){if(_0x2d7e87){return _0x4f0cf0[_0x8330('0x17')](_0x293658)[_0x8330('0x18')](_0x2d7e87);}};}function respondWithFilteredResult(_0x432aca,_0x28998e){return function(_0x2c3e2f){if(_0x2c3e2f){var _0x1f230a=typeof _0x28998e[_0x8330('0x19')]==='undefined'&&typeof _0x28998e[_0x8330('0x1a')]===_0x8330('0x1b');var _0x47895b=_0x2c3e2f[_0x8330('0x1c')];var _0x3c9e7b=_0x1f230a?0x0:_0x28998e[_0x8330('0x19')];var _0x56fc18=_0x1f230a?_0x2c3e2f[_0x8330('0x1c')]:_0x28998e['offset']+_0x28998e[_0x8330('0x1a')];var _0x58e614;if(_0x56fc18>=_0x47895b){_0x56fc18=_0x47895b;_0x58e614=0xc8;}else{_0x58e614=0xce;}_0x432aca[_0x8330('0x17')](_0x58e614);return _0x432aca[_0x8330('0x1d')]('Content-Range',_0x3c9e7b+'-'+_0x56fc18+'/'+_0x47895b)[_0x8330('0x18')](_0x2c3e2f);}return null;};}function patchUpdates(_0x518236){return function(_0x3320fb){try{jsonpatch['apply'](_0x3320fb,_0x518236,!![]);}catch(_0x239822){return BPromise[_0x8330('0x1e')](_0x239822);}return _0x3320fb[_0x8330('0x1f')]();};}function saveUpdates(_0x350895,_0x317045){return function(_0x1ebee7){if(_0x1ebee7){return _0x1ebee7[_0x8330('0x20')](_0x350895)[_0x8330('0x21')](function(_0x21ddaf){return _0x21ddaf;});}return null;};}function removeEntity(_0x2770ca,_0x3fa722){return function(_0x5cb80c){if(_0x5cb80c){return _0x5cb80c['destroy']()['then'](function(){_0x2770ca[_0x8330('0x17')](0xcc)[_0x8330('0x16')]();});}};}function handleEntityNotFound(_0x36db54,_0xa04d8){return function(_0x44adb5){if(!_0x44adb5){_0x36db54[_0x8330('0x15')](0x194);}return _0x44adb5;};}function handleError(_0x19465b,_0x4e7aaa){_0x4e7aaa=_0x4e7aaa||0x1f4;return function(_0x339b99){logger[_0x8330('0x22')](_0x339b99['stack']);if(_0x339b99[_0x8330('0x23')]){delete _0x339b99[_0x8330('0x23')];}_0x19465b[_0x8330('0x17')](_0x4e7aaa)[_0x8330('0x24')](_0x339b99);};}exports[_0x8330('0x25')]=function(_0x5297af,_0x38e8d2){var _0x4baceb={},_0x3cce2f={},_0x162436={'count':0x0,'rows':[]};var _0x2cf1e2=_['map'](db[_0x8330('0x26')][_0x8330('0x27')],function(_0x553ca2){return{'name':_0x553ca2[_0x8330('0x28')],'type':_0x553ca2['type'][_0x8330('0x29')]};});_0x3cce2f[_0x8330('0x2a')]=_[_0x8330('0x2b')](_0x2cf1e2,_0x8330('0x23'));_0x3cce2f[_0x8330('0x2c')]=_[_0x8330('0x2d')](_0x5297af[_0x8330('0x2c')]);_0x3cce2f[_0x8330('0x2e')]=_[_0x8330('0x2f')](_0x3cce2f[_0x8330('0x2a')],_0x3cce2f[_0x8330('0x2c')]);_0x4baceb['attributes']=_['intersection'](_0x3cce2f[_0x8330('0x2a')],qs['fields'](_0x5297af[_0x8330('0x2c')]['fields']));_0x4baceb['attributes']=_0x4baceb[_0x8330('0x30')][_0x8330('0x31')]?_0x4baceb[_0x8330('0x30')]:_0x3cce2f[_0x8330('0x2a')];if(!_0x5297af['query'][_0x8330('0x32')]('nolimit')){_0x4baceb[_0x8330('0x1a')]=qs[_0x8330('0x1a')](_0x5297af[_0x8330('0x2c')][_0x8330('0x1a')]);_0x4baceb[_0x8330('0x19')]=qs[_0x8330('0x19')](_0x5297af['query'][_0x8330('0x19')]);}_0x4baceb[_0x8330('0x33')]=qs[_0x8330('0x34')](_0x5297af[_0x8330('0x2c')][_0x8330('0x34')]);_0x4baceb[_0x8330('0x35')]=qs[_0x8330('0x2e')](_[_0x8330('0x36')](_0x5297af['query'],_0x3cce2f['filters']),_0x2cf1e2);if(_0x5297af[_0x8330('0x2c')][_0x8330('0x37')]){_0x4baceb[_0x8330('0x35')]=_[_0x8330('0x38')](_0x4baceb[_0x8330('0x35')],{'$or':_[_0x8330('0x2b')](_0x2cf1e2,function(_0x18bfd0){if(_0x18bfd0[_0x8330('0x39')]!==_0x8330('0x3a')){var _0x4a7634={};_0x4a7634[_0x18bfd0[_0x8330('0x23')]]={'$like':'%'+_0x5297af[_0x8330('0x2c')][_0x8330('0x37')]+'%'};return _0x4a7634;}})});}_0x4baceb=_[_0x8330('0x38')]({},_0x4baceb,_0x5297af[_0x8330('0x3b')]);var _0x297fd3={'where':_0x4baceb[_0x8330('0x35')]};return db[_0x8330('0x26')][_0x8330('0x1c')](_0x297fd3)[_0x8330('0x21')](function(_0x8adf86){_0x162436[_0x8330('0x1c')]=_0x8adf86;if(_0x5297af[_0x8330('0x2c')][_0x8330('0x3c')]){_0x4baceb[_0x8330('0x3d')]=[{'all':!![]}];}return db[_0x8330('0x26')]['findAll'](_0x4baceb);})[_0x8330('0x21')](function(_0x41fb20){_0x162436[_0x8330('0x3e')]=_0x41fb20;return _0x162436;})[_0x8330('0x21')](respondWithFilteredResult(_0x38e8d2,_0x4baceb))['catch'](handleError(_0x38e8d2,null));};exports[_0x8330('0x3f')]=function(_0x752941,_0x1e71df){var _0x11dabe={'raw':![],'where':{'id':_0x752941[_0x8330('0x40')]['id']}},_0x4fa1d1={};_0x4fa1d1['model']=_['keys'](db[_0x8330('0x26')]['rawAttributes']);_0x4fa1d1['query']=_['keys'](_0x752941[_0x8330('0x2c')]);_0x4fa1d1[_0x8330('0x2e')]=_[_0x8330('0x2f')](_0x4fa1d1[_0x8330('0x2a')],_0x4fa1d1[_0x8330('0x2c')]);_0x11dabe[_0x8330('0x30')]=_[_0x8330('0x2f')](_0x4fa1d1[_0x8330('0x2a')],qs[_0x8330('0x41')](_0x752941['query'][_0x8330('0x41')]));_0x11dabe[_0x8330('0x30')]=_0x11dabe[_0x8330('0x30')][_0x8330('0x31')]?_0x11dabe[_0x8330('0x30')]:_0x4fa1d1[_0x8330('0x2a')];if(_0x752941[_0x8330('0x2c')][_0x8330('0x3c')]){_0x11dabe[_0x8330('0x3d')]=[{'all':!![]}];}_0x11dabe=_[_0x8330('0x38')]({},_0x11dabe,_0x752941[_0x8330('0x3b')]);return db[_0x8330('0x26')]['find'](_0x11dabe)[_0x8330('0x21')](handleEntityNotFound(_0x1e71df,null))[_0x8330('0x21')](respondWithResult(_0x1e71df,null))[_0x8330('0x42')](handleError(_0x1e71df,null));};exports[_0x8330('0x43')]=function(_0x3afffc,_0x5279d4){return db[_0x8330('0x26')][_0x8330('0x43')](_0x3afffc[_0x8330('0x44')],{})['then'](respondWithResult(_0x5279d4,0xc9))[_0x8330('0x42')](handleError(_0x5279d4,null));};exports['update']=function(_0x4d5466,_0xe4cd8b){if(_0x4d5466[_0x8330('0x44')]['id']){delete _0x4d5466[_0x8330('0x44')]['id'];}return db['FreshdeskAccount'][_0x8330('0x45')]({'where':{'id':_0x4d5466[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0xe4cd8b,null))[_0x8330('0x21')](saveUpdates(_0x4d5466['body'],null))[_0x8330('0x21')](respondWithResult(_0xe4cd8b,null))[_0x8330('0x42')](handleError(_0xe4cd8b,null));};exports[_0x8330('0x46')]=function(_0x5df830,_0x411ad1){return db['FreshdeskAccount'][_0x8330('0x45')]({'where':{'id':_0x5df830[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0x411ad1,null))['then'](removeEntity(_0x411ad1,null))[_0x8330('0x42')](handleError(_0x411ad1,null));};exports[_0x8330('0x47')]=function(_0xc20baa,_0x2a3e84,_0x211e77){var _0x4d976f={};var _0x9b36c6={};var _0x3d1636;var _0x2b4a09;return db[_0x8330('0x26')][_0x8330('0x48')]({'where':{'id':_0xc20baa[_0x8330('0x40')]['id']}})[_0x8330('0x21')](handleEntityNotFound(_0x2a3e84,null))[_0x8330('0x21')](function(_0x2e5ebe){if(_0x2e5ebe){_0x3d1636=_0x2e5ebe;_0x9b36c6[_0x8330('0x2a')]=_[_0x8330('0x2d')](db[_0x8330('0x49')][_0x8330('0x27')]);_0x9b36c6['query']=_[_0x8330('0x2d')](_0xc20baa['query']);_0x9b36c6['filters']=_[_0x8330('0x2f')](_0x9b36c6[_0x8330('0x2a')],_0x9b36c6[_0x8330('0x2c')]);_0x4d976f[_0x8330('0x30')]=_['intersection'](_0x9b36c6[_0x8330('0x2a')],qs[_0x8330('0x41')](_0xc20baa[_0x8330('0x2c')]['fields']));_0x4d976f[_0x8330('0x30')]=_0x4d976f[_0x8330('0x30')][_0x8330('0x31')]?_0x4d976f['attributes']:_0x9b36c6['model'];_0x4d976f[_0x8330('0x33')]=qs[_0x8330('0x34')](_0xc20baa[_0x8330('0x2c')][_0x8330('0x34')]);_0x4d976f[_0x8330('0x35')]=qs[_0x8330('0x2e')](_[_0x8330('0x36')](_0xc20baa[_0x8330('0x2c')],_0x9b36c6[_0x8330('0x2e')]));if(_0xc20baa[_0x8330('0x2c')]['filter']){_0x4d976f[_0x8330('0x35')]=_['merge'](_0x4d976f['where'],{'$or':_[_0x8330('0x2b')](_0x4d976f['attributes'],function(_0x864763){var _0x484c25={};_0x484c25[_0x864763]={'$like':'%'+_0xc20baa[_0x8330('0x2c')][_0x8330('0x37')]+'%'};return _0x484c25;})});}_0x4d976f=_[_0x8330('0x38')]({},_0x4d976f,_0xc20baa[_0x8330('0x3b')]);return _0x3d1636['getConfigurations'](_0x4d976f);}})[_0x8330('0x21')](function(_0x250e47){if(_0x250e47){_0x2b4a09=_0x250e47['length'];if(!_0xc20baa[_0x8330('0x2c')]['hasOwnProperty'](_0x8330('0x4a'))){_0x4d976f[_0x8330('0x1a')]=qs[_0x8330('0x1a')](_0xc20baa[_0x8330('0x2c')][_0x8330('0x1a')]);_0x4d976f[_0x8330('0x19')]=qs['offset'](_0xc20baa[_0x8330('0x2c')][_0x8330('0x19')]);}return _0x3d1636[_0x8330('0x47')](_0x4d976f);}})[_0x8330('0x21')](function(_0x4988b5){if(_0x4988b5){return _0x4988b5?{'count':_0x2b4a09,'rows':_0x4988b5}:null;}})['then'](respondWithResult(_0x2a3e84,null))[_0x8330('0x42')](handleError(_0x2a3e84,null));};exports[_0x8330('0x4b')]=function(_0x2af35b,_0x44b83e,_0x19362f){if(_0x2af35b['body']['id']){delete _0x2af35b['body']['id'];}return db[_0x8330('0x26')]['findOne']({'where':{'id':_0x2af35b[_0x8330('0x40')]['id']}})['then'](handleEntityNotFound(_0x44b83e,null))[_0x8330('0x21')](function(_0x324a36){if(_0x324a36){_0x2af35b[_0x8330('0x44')][_0x8330('0x4c')]=_0x324a36['id'];_0x2af35b[_0x8330('0x44')][_0x8330('0x4d')]=integrations['getSubjects'](_0x2af35b[_0x8330('0x44')][_0x8330('0x4e')],_0x2af35b[_0x8330('0x44')]['type']);_0x2af35b[_0x8330('0x44')][_0x8330('0x4f')]=integrations['getDescriptions'](_0x2af35b[_0x8330('0x44')]['channel'],_0x2af35b[_0x8330('0x44')][_0x8330('0x39')]);return db[_0x8330('0x49')][_0x8330('0x43')](_0x2af35b[_0x8330('0x44')],{'include':[{'model':db[_0x8330('0x50')],'as':'Subjects'},{'model':db[_0x8330('0x50')],'as':'Descriptions'}]});}return null;})[_0x8330('0x21')](respondWithResult(_0x44b83e,null))[_0x8330('0x42')](handleError(_0x44b83e,null));};exports['getFields']=function(_0x1ad7f6,_0x27ceb2,_0x3a3981){var _0x4d8511='';return db[_0x8330('0x26')][_0x8330('0x48')]({'where':{'id':_0x1ad7f6[_0x8330('0x40')]['id']},'attributes':['id',_0x8330('0x51'),'apiKey']})[_0x8330('0x21')](handleEntityNotFound(_0x27ceb2,null))[_0x8330('0x21')](function(_0x10825c){if(_0x10825c){_0x4d8511=_0x10825c['remoteUri'];var _0x4765e9=_0x4d8511['slice'](-0x1);if(_0x4765e9==='/'){_0x4d8511=_0x4d8511[_0x8330('0x52')](0x0,_0x4d8511[_0x8330('0x53')](_0x4765e9));}return rp({'method':_0x8330('0x54'),'uri':util[_0x8330('0x55')](_0x8330('0x56'),_0x4d8511,_0x8330('0x57')),'headers':{'Authorization':util[_0x8330('0x55')](_0x8330('0x58'),new Buffer(util[_0x8330('0x55')](_0x8330('0x59'),_0x10825c[_0x8330('0x5a')]))['toString']('base64'))},'json':!![]});}})['then'](function(_0x1c2417){if(_0x1c2417){var _0x3340ca=[_0x8330('0x5b'),'subject',_0x8330('0x5c'),_0x8330('0x5d'),_0x8330('0x17'),_0x8330('0x5e'),'group','source',_0x8330('0x5f'),_0x8330('0x60'),_0x8330('0x61')];_[_0x8330('0x62')](_0x1c2417,function(_0x3dcab8){return _0x3340ca[_0x8330('0x63')](_0x3dcab8[_0x8330('0x23')])||!_0x3dcab8[_0x8330('0x64')]&&_0x3dcab8[_0x8330('0x39')]!=='custom_text'&&_0x3dcab8[_0x8330('0x39')]!=='custom_dropdown';});return{'count':_0x1c2417[_0x8330('0x31')],'rows':_['map'](_0x1c2417,function(_0x3ccb74){return{'id':_0x3ccb74[_0x8330('0x23')],'name':_0x3ccb74[_0x8330('0x65')],'custom':!_0x3ccb74[_0x8330('0x64')],'options':_0x3ccb74[_0x8330('0x66')]?_[_0x8330('0x2b')](_0x3ccb74['choices'],function(_0xf58aba){return{'name':_['capitalize'](_0xf58aba),'value':_0xf58aba};}):[]};})};}})[_0x8330('0x21')](respondWithResult(_0x27ceb2,null))[_0x8330('0x42')](function(_0x6d1882){var _0x551b05=_0x1ad7f6[_0x8330('0x2c')]['test']?0x1f4:_0x6d1882[_0x8330('0x67')]||0x1f4;logger[_0x8330('0x22')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x551b05,JSON[_0x8330('0x68')](_0x6d1882));delete _0x6d1882[_0x8330('0x23')];if(_0x551b05===0x191){_0x551b05=0x190;}_0x27ceb2[_0x8330('0x17')](_0x551b05)[_0x8330('0x24')](_0x1ad7f6['query'][_0x8330('0x69')]?{'message':_0x8330('0x6a'),'statusCode':_0x6d1882['statusCode']}:_0x6d1882);});}; \ No newline at end of file +var _0x43b1=['base64','subject','agent','description','priority','ticket_type','group','remove','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','FreshdeskAccount','findAll','rows','show','length','options','find','catch','create','body','update','getConfigurations','findOne','params','FreshdeskConfiguration','rawAttributes','order','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','substring','GET','%s/%s','api/v2/ticket_fields','Basic\x20%s','format','toString'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x43b1,0x7d));var _0x143b=function(_0x40ee6a,_0x512357){_0x40ee6a=_0x40ee6a-0x0;var _0x2a6eab=_0x43b1[_0x40ee6a];return _0x2a6eab;};'use strict';var emlformat=require(_0x143b('0x0'));var rimraf=require(_0x143b('0x1'));var zipdir=require(_0x143b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x143b('0x3'));var moment=require('moment');var BPromise=require(_0x143b('0x4'));var Mustache=require(_0x143b('0x5'));var util=require(_0x143b('0x6'));var path=require(_0x143b('0x7'));var sox=require(_0x143b('0x8'));var csv=require(_0x143b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x143b('0xa'));var _=require(_0x143b('0xb'));var squel=require(_0x143b('0xc'));var crypto=require('crypto');var jsforce=require(_0x143b('0xd'));var deskjs=require(_0x143b('0xe'));var toCsv=require(_0x143b('0x9'));var querystring=require(_0x143b('0xf'));var Papa=require(_0x143b('0x10'));var Redis=require(_0x143b('0x11'));var authService=require(_0x143b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x143b('0x13'));var hardwareService=require(_0x143b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x143b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x143b('0x16'));var db=require(_0x143b('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d6c07,_0x1ef389){_0x1ef389=_0x1ef389||0xcc;return function(_0x8d5095){if(_0x8d5095){return _0x2d6c07[_0x143b('0x18')](_0x1ef389);}return _0x2d6c07[_0x143b('0x19')](_0x1ef389)[_0x143b('0x1a')]();};}function respondWithResult(_0x1325c3,_0x40ce06){_0x40ce06=_0x40ce06||0xc8;return function(_0x2acea8){if(_0x2acea8){return _0x1325c3[_0x143b('0x19')](_0x40ce06)[_0x143b('0x1b')](_0x2acea8);}};}function respondWithFilteredResult(_0x3cc649,_0x2d746a){return function(_0x133603){if(_0x133603){var _0x11d3a9=typeof _0x2d746a[_0x143b('0x1c')]===_0x143b('0x1d')&&typeof _0x2d746a['limit']==='undefined';var _0x14c9bb=_0x133603[_0x143b('0x1e')];var _0x377f9c=_0x11d3a9?0x0:_0x2d746a[_0x143b('0x1c')];var _0x2201bc=_0x11d3a9?_0x133603[_0x143b('0x1e')]:_0x2d746a[_0x143b('0x1c')]+_0x2d746a[_0x143b('0x1f')];var _0x722d79;if(_0x2201bc>=_0x14c9bb){_0x2201bc=_0x14c9bb;_0x722d79=0xc8;}else{_0x722d79=0xce;}_0x3cc649[_0x143b('0x19')](_0x722d79);return _0x3cc649[_0x143b('0x20')]('Content-Range',_0x377f9c+'-'+_0x2201bc+'/'+_0x14c9bb)[_0x143b('0x1b')](_0x133603);}return null;};}function patchUpdates(_0x35df37){return function(_0xb37aa5){try{jsonpatch[_0x143b('0x21')](_0xb37aa5,_0x35df37,!![]);}catch(_0x1f9126){return BPromise[_0x143b('0x22')](_0x1f9126);}return _0xb37aa5[_0x143b('0x23')]();};}function saveUpdates(_0x1d5b5b,_0x5d0684){return function(_0x886476){if(_0x886476){return _0x886476['update'](_0x1d5b5b)[_0x143b('0x24')](function(_0x5bdebc){return _0x5bdebc;});}return null;};}function removeEntity(_0x549638,_0x56717f){return function(_0x100021){if(_0x100021){return _0x100021['destroy']()['then'](function(){_0x549638[_0x143b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e097,_0x54eca6){return function(_0x425213){if(!_0x425213){_0x35e097[_0x143b('0x18')](0x194);}return _0x425213;};}function handleError(_0x1adf50,_0x4f5a17){_0x4f5a17=_0x4f5a17||0x1f4;return function(_0x47997b){logger['error'](_0x47997b['stack']);if(_0x47997b[_0x143b('0x25')]){delete _0x47997b['name'];}_0x1adf50['status'](_0x4f5a17)[_0x143b('0x26')](_0x47997b);};}exports[_0x143b('0x27')]=function(_0x6174a3,_0x5535b5){var _0xd1aa12={},_0x45ef09={},_0x42e136={'count':0x0,'rows':[]};var _0x41971e=_[_0x143b('0x28')](db['FreshdeskAccount']['rawAttributes'],function(_0x498ea4){return{'name':_0x498ea4['fieldName'],'type':_0x498ea4[_0x143b('0x29')][_0x143b('0x2a')]};});_0x45ef09[_0x143b('0x2b')]=_[_0x143b('0x28')](_0x41971e,_0x143b('0x25'));_0x45ef09[_0x143b('0x2c')]=_[_0x143b('0x2d')](_0x6174a3[_0x143b('0x2c')]);_0x45ef09[_0x143b('0x2e')]=_[_0x143b('0x2f')](_0x45ef09['model'],_0x45ef09[_0x143b('0x2c')]);_0xd1aa12[_0x143b('0x30')]=_['intersection'](_0x45ef09['model'],qs[_0x143b('0x31')](_0x6174a3[_0x143b('0x2c')][_0x143b('0x31')]));_0xd1aa12[_0x143b('0x30')]=_0xd1aa12['attributes']['length']?_0xd1aa12['attributes']:_0x45ef09['model'];if(!_0x6174a3[_0x143b('0x2c')][_0x143b('0x32')](_0x143b('0x33'))){_0xd1aa12['limit']=qs[_0x143b('0x1f')](_0x6174a3[_0x143b('0x2c')][_0x143b('0x1f')]);_0xd1aa12['offset']=qs[_0x143b('0x1c')](_0x6174a3[_0x143b('0x2c')][_0x143b('0x1c')]);}_0xd1aa12['order']=qs[_0x143b('0x34')](_0x6174a3[_0x143b('0x2c')]['sort']);_0xd1aa12['where']=qs['filters'](_[_0x143b('0x35')](_0x6174a3[_0x143b('0x2c')],_0x45ef09['filters']),_0x41971e);if(_0x6174a3[_0x143b('0x2c')][_0x143b('0x36')]){_0xd1aa12[_0x143b('0x37')]=_[_0x143b('0x38')](_0xd1aa12['where'],{'$or':_[_0x143b('0x28')](_0x41971e,function(_0x3cdc85){if(_0x3cdc85[_0x143b('0x29')]!==_0x143b('0x39')){var _0x21f16c={};_0x21f16c[_0x3cdc85['name']]={'$like':'%'+_0x6174a3[_0x143b('0x2c')][_0x143b('0x36')]+'%'};return _0x21f16c;}})});}_0xd1aa12=_[_0x143b('0x38')]({},_0xd1aa12,_0x6174a3['options']);var _0x14539c={'where':_0xd1aa12[_0x143b('0x37')]};return db['FreshdeskAccount'][_0x143b('0x1e')](_0x14539c)[_0x143b('0x24')](function(_0x395f59){_0x42e136[_0x143b('0x1e')]=_0x395f59;if(_0x6174a3[_0x143b('0x2c')]['includeAll']){_0xd1aa12[_0x143b('0x3a')]=[{'all':!![]}];}return db[_0x143b('0x3b')][_0x143b('0x3c')](_0xd1aa12);})[_0x143b('0x24')](function(_0xdb1d52){_0x42e136[_0x143b('0x3d')]=_0xdb1d52;return _0x42e136;})[_0x143b('0x24')](respondWithFilteredResult(_0x5535b5,_0xd1aa12))['catch'](handleError(_0x5535b5,null));};exports[_0x143b('0x3e')]=function(_0x19a1c1,_0x5a20e4){var _0x2f3816={'raw':![],'where':{'id':_0x19a1c1['params']['id']}},_0xf2cdd2={};_0xf2cdd2[_0x143b('0x2b')]=_[_0x143b('0x2d')](db[_0x143b('0x3b')]['rawAttributes']);_0xf2cdd2[_0x143b('0x2c')]=_[_0x143b('0x2d')](_0x19a1c1[_0x143b('0x2c')]);_0xf2cdd2[_0x143b('0x2e')]=_[_0x143b('0x2f')](_0xf2cdd2[_0x143b('0x2b')],_0xf2cdd2['query']);_0x2f3816[_0x143b('0x30')]=_[_0x143b('0x2f')](_0xf2cdd2[_0x143b('0x2b')],qs[_0x143b('0x31')](_0x19a1c1['query'][_0x143b('0x31')]));_0x2f3816[_0x143b('0x30')]=_0x2f3816[_0x143b('0x30')][_0x143b('0x3f')]?_0x2f3816[_0x143b('0x30')]:_0xf2cdd2[_0x143b('0x2b')];if(_0x19a1c1[_0x143b('0x2c')]['includeAll']){_0x2f3816['include']=[{'all':!![]}];}_0x2f3816=_['merge']({},_0x2f3816,_0x19a1c1[_0x143b('0x40')]);return db[_0x143b('0x3b')][_0x143b('0x41')](_0x2f3816)[_0x143b('0x24')](handleEntityNotFound(_0x5a20e4,null))[_0x143b('0x24')](respondWithResult(_0x5a20e4,null))[_0x143b('0x42')](handleError(_0x5a20e4,null));};exports[_0x143b('0x43')]=function(_0x3fd640,_0x46b46b){return db[_0x143b('0x3b')]['create'](_0x3fd640[_0x143b('0x44')],{})[_0x143b('0x24')](respondWithResult(_0x46b46b,0xc9))[_0x143b('0x42')](handleError(_0x46b46b,null));};exports[_0x143b('0x45')]=function(_0x48e3e5,_0x1e057d){if(_0x48e3e5['body']['id']){delete _0x48e3e5[_0x143b('0x44')]['id'];}return db[_0x143b('0x3b')]['find']({'where':{'id':_0x48e3e5['params']['id']}})[_0x143b('0x24')](handleEntityNotFound(_0x1e057d,null))[_0x143b('0x24')](saveUpdates(_0x48e3e5[_0x143b('0x44')],null))['then'](respondWithResult(_0x1e057d,null))[_0x143b('0x42')](handleError(_0x1e057d,null));};exports['destroy']=function(_0x409a65,_0x53535f){return db[_0x143b('0x3b')][_0x143b('0x41')]({'where':{'id':_0x409a65['params']['id']}})[_0x143b('0x24')](handleEntityNotFound(_0x53535f,null))[_0x143b('0x24')](removeEntity(_0x53535f,null))[_0x143b('0x42')](handleError(_0x53535f,null));};exports[_0x143b('0x46')]=function(_0x1cf6b5,_0x2b8cf1,_0x48a668){var _0xa2bdc5={};var _0x227d4e={};var _0x511594;var _0x48eb06;return db[_0x143b('0x3b')][_0x143b('0x47')]({'where':{'id':_0x1cf6b5[_0x143b('0x48')]['id']}})[_0x143b('0x24')](handleEntityNotFound(_0x2b8cf1,null))[_0x143b('0x24')](function(_0x3f1590){if(_0x3f1590){_0x511594=_0x3f1590;_0x227d4e[_0x143b('0x2b')]=_[_0x143b('0x2d')](db[_0x143b('0x49')][_0x143b('0x4a')]);_0x227d4e[_0x143b('0x2c')]=_[_0x143b('0x2d')](_0x1cf6b5['query']);_0x227d4e[_0x143b('0x2e')]=_[_0x143b('0x2f')](_0x227d4e[_0x143b('0x2b')],_0x227d4e[_0x143b('0x2c')]);_0xa2bdc5[_0x143b('0x30')]=_[_0x143b('0x2f')](_0x227d4e['model'],qs['fields'](_0x1cf6b5[_0x143b('0x2c')][_0x143b('0x31')]));_0xa2bdc5['attributes']=_0xa2bdc5[_0x143b('0x30')][_0x143b('0x3f')]?_0xa2bdc5[_0x143b('0x30')]:_0x227d4e['model'];_0xa2bdc5[_0x143b('0x4b')]=qs[_0x143b('0x34')](_0x1cf6b5['query'][_0x143b('0x34')]);_0xa2bdc5[_0x143b('0x37')]=qs[_0x143b('0x2e')](_['pick'](_0x1cf6b5[_0x143b('0x2c')],_0x227d4e[_0x143b('0x2e')]));if(_0x1cf6b5[_0x143b('0x2c')]['filter']){_0xa2bdc5[_0x143b('0x37')]=_['merge'](_0xa2bdc5[_0x143b('0x37')],{'$or':_[_0x143b('0x28')](_0xa2bdc5[_0x143b('0x30')],function(_0x39eb4c){var _0x52ec02={};_0x52ec02[_0x39eb4c]={'$like':'%'+_0x1cf6b5[_0x143b('0x2c')]['filter']+'%'};return _0x52ec02;})});}_0xa2bdc5=_[_0x143b('0x38')]({},_0xa2bdc5,_0x1cf6b5[_0x143b('0x40')]);return _0x511594[_0x143b('0x46')](_0xa2bdc5);}})[_0x143b('0x24')](function(_0x23b051){if(_0x23b051){_0x48eb06=_0x23b051[_0x143b('0x3f')];if(!_0x1cf6b5[_0x143b('0x2c')][_0x143b('0x32')](_0x143b('0x33'))){_0xa2bdc5[_0x143b('0x1f')]=qs[_0x143b('0x1f')](_0x1cf6b5[_0x143b('0x2c')][_0x143b('0x1f')]);_0xa2bdc5[_0x143b('0x1c')]=qs['offset'](_0x1cf6b5[_0x143b('0x2c')]['offset']);}return _0x511594[_0x143b('0x46')](_0xa2bdc5);}})[_0x143b('0x24')](function(_0x23ccde){if(_0x23ccde){return _0x23ccde?{'count':_0x48eb06,'rows':_0x23ccde}:null;}})[_0x143b('0x24')](respondWithResult(_0x2b8cf1,null))[_0x143b('0x42')](handleError(_0x2b8cf1,null));};exports[_0x143b('0x4c')]=function(_0x438c48,_0x213bb2,_0x4fcb86){if(_0x438c48[_0x143b('0x44')]['id']){delete _0x438c48[_0x143b('0x44')]['id'];}return db[_0x143b('0x3b')][_0x143b('0x47')]({'where':{'id':_0x438c48[_0x143b('0x48')]['id']}})[_0x143b('0x24')](handleEntityNotFound(_0x213bb2,null))[_0x143b('0x24')](function(_0x21df9a){if(_0x21df9a){_0x438c48[_0x143b('0x44')][_0x143b('0x4d')]=_0x21df9a['id'];_0x438c48[_0x143b('0x44')][_0x143b('0x4e')]=integrations[_0x143b('0x4f')](_0x438c48[_0x143b('0x44')][_0x143b('0x50')],_0x438c48['body']['type']);_0x438c48['body']['Descriptions']=integrations['getDescriptions'](_0x438c48[_0x143b('0x44')][_0x143b('0x50')],_0x438c48[_0x143b('0x44')][_0x143b('0x29')]);return db[_0x143b('0x49')]['create'](_0x438c48[_0x143b('0x44')],{'include':[{'model':db[_0x143b('0x51')],'as':_0x143b('0x4e')},{'model':db[_0x143b('0x51')],'as':_0x143b('0x52')}]});}return null;})[_0x143b('0x24')](respondWithResult(_0x213bb2,null))['catch'](handleError(_0x213bb2,null));};exports[_0x143b('0x53')]=function(_0x130837,_0x31771d,_0x508769){var _0x1d0403='';return db[_0x143b('0x3b')][_0x143b('0x47')]({'where':{'id':_0x130837[_0x143b('0x48')]['id']},'attributes':['id',_0x143b('0x54'),_0x143b('0x55')]})[_0x143b('0x24')](handleEntityNotFound(_0x31771d,null))[_0x143b('0x24')](function(_0x5fa2b2){if(_0x5fa2b2){_0x1d0403=_0x5fa2b2[_0x143b('0x54')];var _0x25641c=_0x1d0403['slice'](-0x1);if(_0x25641c==='/'){_0x1d0403=_0x1d0403[_0x143b('0x56')](0x0,_0x1d0403['lastIndexOf'](_0x25641c));}return rp({'method':_0x143b('0x57'),'uri':util['format'](_0x143b('0x58'),_0x1d0403,_0x143b('0x59')),'headers':{'Authorization':util['format'](_0x143b('0x5a'),new Buffer(util[_0x143b('0x5b')]('%s:X',_0x5fa2b2[_0x143b('0x55')]))[_0x143b('0x5c')](_0x143b('0x5d')))},'json':!![]});}})[_0x143b('0x24')](function(_0x69b2a2){if(_0x69b2a2){var _0x14a6a5=['requester',_0x143b('0x5e'),_0x143b('0x5f'),_0x143b('0x60'),_0x143b('0x19'),_0x143b('0x61'),'group','source',_0x143b('0x62'),_0x143b('0x63'),'company'];_[_0x143b('0x64')](_0x69b2a2,function(_0x29f1b1){return _0x14a6a5['includes'](_0x29f1b1[_0x143b('0x25')])||!_0x29f1b1[_0x143b('0x65')]&&_0x29f1b1['type']!==_0x143b('0x66')&&_0x29f1b1[_0x143b('0x29')]!=='custom_dropdown';});return{'count':_0x69b2a2[_0x143b('0x3f')],'rows':_[_0x143b('0x28')](_0x69b2a2,function(_0x2ff55e){return{'id':_0x2ff55e[_0x143b('0x25')],'name':_0x2ff55e[_0x143b('0x67')],'custom':!_0x2ff55e['default'],'options':_0x2ff55e[_0x143b('0x68')]?_[_0x143b('0x28')](_0x2ff55e['choices'],function(_0x58116b){return{'name':_[_0x143b('0x69')](_0x58116b),'value':_0x58116b};}):[]};})};}})[_0x143b('0x24')](respondWithResult(_0x31771d,null))[_0x143b('0x42')](function(_0x4b6f41){var _0x2336a7=_0x130837[_0x143b('0x2c')][_0x143b('0x6a')]?0x1f4:_0x4b6f41[_0x143b('0x6b')]||0x1f4;logger['error'](_0x143b('0x6c'),'getFields',_0x2336a7,JSON['stringify'](_0x4b6f41));delete _0x4b6f41[_0x143b('0x25')];if(_0x2336a7===0x191){_0x2336a7=0x190;}_0x31771d[_0x143b('0x19')](_0x2336a7)[_0x143b('0x26')](_0x130837[_0x143b('0x2c')][_0x143b('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x4b6f41['statusCode']}:_0x4b6f41);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9c1dd88..2a4d82d 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 _0x79ca=['exports','define','FreshdeskAccount','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes'];(function(_0x3c3fc9,_0x19452a){var _0x34debd=function(_0x2ec1f2){while(--_0x2ec1f2){_0x3c3fc9['push'](_0x3c3fc9['shift']());}};_0x34debd(++_0x19452a);}(_0x79ca,0xdf));var _0xa79c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x79ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa79c('0x0'));var util=require('util');var logger=require(_0xa79c('0x1'))(_0xa79c('0x2'));var moment=require(_0xa79c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa79c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa79c('0x5'));var config=require(_0xa79c('0x6'));var attributes=require(_0xa79c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa79c('0x8')]=function(_0x212992,_0x43ff9b){return _0x212992[_0xa79c('0x9')](_0xa79c('0xa'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4efb=['../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x4efb,0x1a4));var _0xb4ef=function(_0x14d3bf,_0x194823){_0x14d3bf=_0x14d3bf-0x0;var _0x1e1e92=_0x4efb[_0x14d3bf];return _0x1e1e92;};'use strict';var _=require(_0xb4ef('0x0'));var util=require(_0xb4ef('0x1'));var logger=require(_0xb4ef('0x2'))(_0xb4ef('0x3'));var moment=require('moment');var BPromise=require(_0xb4ef('0x4'));var rp=require(_0xb4ef('0x5'));var fs=require('fs');var path=require(_0xb4ef('0x6'));var rimraf=require(_0xb4ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xb4ef('0x8'));var integrations=require(_0xb4ef('0x9'));module[_0xb4ef('0xa')]=function(_0x565bab,_0x5cef69){return _0x565bab[_0xb4ef('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xb4ef('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 d248032..37e1f59 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 _0x342d=['map','model','find','ShowFreshdeskAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include'];(function(_0xe8dbbb,_0x25810f){var _0x567096=function(_0x4a6bcf){while(--_0x4a6bcf){_0xe8dbbb['push'](_0xe8dbbb['shift']());}};_0x567096(++_0x25810f);}(_0x342d,0x197));var _0xd342=function(_0x34b607,_0x25d4e9){_0x34b607=_0x34b607-0x0;var _0x7cced2=_0x342d[_0x34b607];return _0x7cced2;};'use strict';var _=require(_0xd342('0x0'));var util=require(_0xd342('0x1'));var moment=require('moment');var BPromise=require(_0xd342('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd342('0x3'))['db'];var utils=require(_0xd342('0x4'));var logger=require(_0xd342('0x5'))(_0xd342('0x6'));var config=require(_0xd342('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd342('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5447ef,_0x48cd41,_0x2ae9a6){return new BPromise(function(_0x39dff9,_0x1850a4){return client['request'](_0x5447ef,_0x2ae9a6)[_0xd342('0x9')](function(_0x5d21e4){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x48cd41,_0xd342('0xa'));logger[_0xd342('0xb')](_0xd342('0xc'),_0x48cd41,_0xd342('0xa'),JSON[_0xd342('0xd')](_0x5d21e4));if(_0x5d21e4['error']){if(_0x5d21e4[_0xd342('0xe')]['code']===0x1f4){logger[_0xd342('0xe')](_0xd342('0xf'),_0x48cd41,_0x5d21e4[_0xd342('0xe')][_0xd342('0x10')]);return _0x1850a4(_0x5d21e4[_0xd342('0xe')][_0xd342('0x10')]);}logger[_0xd342('0xe')](_0xd342('0xf'),_0x48cd41,_0x5d21e4[_0xd342('0xe')][_0xd342('0x10')]);return _0x39dff9(_0x5d21e4[_0xd342('0xe')][_0xd342('0x10')]);}else{logger[_0xd342('0x11')](_0xd342('0xf'),_0x48cd41,_0xd342('0xa'));_0x39dff9(_0x5d21e4['result'][_0xd342('0x10')]);}})[_0xd342('0x12')](function(_0x2edf7b){logger[_0xd342('0xe')](_0xd342('0xf'),_0x48cd41,_0x2edf7b);_0x1850a4(_0x2edf7b);});});}exports[_0xd342('0x13')]=function(_0x13831f){var _0x329692=this;return new Promise(function(_0x160882,_0x5e589e){return db[_0xd342('0x14')][_0xd342('0x15')]({'raw':_0x13831f[_0xd342('0x16')]?_0x13831f[_0xd342('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x13831f['options']?_0x13831f[_0xd342('0x16')][_0xd342('0x17')]||null:null,'attributes':_0x13831f[_0xd342('0x16')]?_0x13831f[_0xd342('0x16')][_0xd342('0x18')]||null:null,'limit':_0x13831f[_0xd342('0x16')]?_0x13831f[_0xd342('0x16')][_0xd342('0x19')]||null:null,'include':_0x13831f['options']?_0x13831f[_0xd342('0x16')]['include']?_['map'](_0x13831f['options']['include'],function(_0x99ba20){return{'model':db[_0x99ba20['model']],'as':_0x99ba20['as'],'attributes':_0x99ba20[_0xd342('0x18')],'include':_0x99ba20[_0xd342('0x1a')]?_[_0xd342('0x1b')](_0x99ba20[_0xd342('0x1a')],function(_0x5abff1){return{'model':db[_0x5abff1[_0xd342('0x1c')]],'as':_0x5abff1['as'],'attributes':_0x5abff1[_0xd342('0x18')],'include':_0x5abff1['include']?_['map'](_0x5abff1[_0xd342('0x1a')],function(_0x48803d){return{'model':db[_0x48803d[_0xd342('0x1c')]],'as':_0x48803d['as'],'attributes':_0x48803d[_0xd342('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd342('0x9')](function(_0x2321f7){logger[_0xd342('0x11')](_0xd342('0x13'),_0x13831f);logger[_0xd342('0xb')](_0xd342('0x13'),_0x13831f,JSON[_0xd342('0xd')](_0x2321f7));_0x160882(_0x2321f7);})['catch'](function(_0x37d4fa){logger[_0xd342('0xe')](_0xd342('0x13'),_0x37d4fa[_0xd342('0x10')],_0x13831f);_0x5e589e(_0x329692['error'](0x1f4,_0x37d4fa[_0xd342('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x280f92){var _0x35d28f=this;return new Promise(function(_0x39de95,_0x333dfc){return db[_0xd342('0x14')][_0xd342('0x1d')]({'raw':_0x280f92[_0xd342('0x16')]?_0x280f92['options']['raw']===undefined?!![]:![]:!![],'where':_0x280f92[_0xd342('0x16')]?_0x280f92[_0xd342('0x16')]['where']||null:null,'attributes':_0x280f92[_0xd342('0x16')]?_0x280f92[_0xd342('0x16')][_0xd342('0x18')]||null:null,'include':_0x280f92[_0xd342('0x16')]?_0x280f92[_0xd342('0x16')][_0xd342('0x1a')]?_[_0xd342('0x1b')](_0x280f92[_0xd342('0x16')][_0xd342('0x1a')],function(_0x383be4){return{'model':db[_0x383be4[_0xd342('0x1c')]],'as':_0x383be4['as'],'attributes':_0x383be4[_0xd342('0x18')],'include':_0x383be4[_0xd342('0x1a')]?_[_0xd342('0x1b')](_0x383be4[_0xd342('0x1a')],function(_0x591c62){return{'model':db[_0x591c62[_0xd342('0x1c')]],'as':_0x591c62['as'],'attributes':_0x591c62[_0xd342('0x18')],'include':_0x591c62[_0xd342('0x1a')]?_['map'](_0x591c62[_0xd342('0x1a')],function(_0x127067){return{'model':db[_0x127067[_0xd342('0x1c')]],'as':_0x127067['as'],'attributes':_0x127067['attributes']};}):[]};}):[]};}):[]:[]})[_0xd342('0x9')](function(_0x25b6c2){logger[_0xd342('0x11')](_0xd342('0x1e'),_0x280f92);logger['debug'](_0xd342('0x1e'),_0x280f92,JSON[_0xd342('0xd')](_0x25b6c2));_0x39de95(_0x25b6c2);})['catch'](function(_0x252384){logger[_0xd342('0xe')]('ShowFreshdeskAccount',_0x252384[_0xd342('0x10')],_0x280f92);_0x333dfc(_0x35d28f['error'](0x1f4,_0x252384[_0xd342('0x10')]));});});}; \ No newline at end of file +var _0x681c=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','include','model','attributes','map','raw','ShowFreshdeskAccount','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x436230,_0x2ffb59){var _0x2377c1=function(_0x116465){while(--_0x116465){_0x436230['push'](_0x436230['shift']());}};_0x2377c1(++_0x2ffb59);}(_0x681c,0x17b));var _0xc681=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x681c[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xc681('0x0'));var moment=require(_0xc681('0x1'));var BPromise=require(_0xc681('0x2'));var rs=require(_0xc681('0x3'));var fs=require('fs');var Redis=require(_0xc681('0x4'));var db=require(_0xc681('0x5'))['db'];var utils=require(_0xc681('0x6'));var logger=require(_0xc681('0x7'))(_0xc681('0x8'));var config=require(_0xc681('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc681('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e39ed,_0x404a5f,_0xc73ec7){return new BPromise(function(_0x222ba9,_0x361d26){return client[_0xc681('0xb')](_0x2e39ed,_0xc73ec7)[_0xc681('0xc')](function(_0x434d71){logger[_0xc681('0xd')](_0xc681('0xe'),_0x404a5f,_0xc681('0xf'));logger[_0xc681('0x10')](_0xc681('0x11'),_0x404a5f,_0xc681('0xf'),JSON[_0xc681('0x12')](_0x434d71));if(_0x434d71['error']){if(_0x434d71[_0xc681('0x13')][_0xc681('0x14')]===0x1f4){logger[_0xc681('0x13')](_0xc681('0xe'),_0x404a5f,_0x434d71['error']['message']);return _0x361d26(_0x434d71[_0xc681('0x13')][_0xc681('0x15')]);}logger[_0xc681('0x13')](_0xc681('0xe'),_0x404a5f,_0x434d71[_0xc681('0x13')][_0xc681('0x15')]);return _0x222ba9(_0x434d71[_0xc681('0x13')][_0xc681('0x15')]);}else{logger[_0xc681('0xd')](_0xc681('0xe'),_0x404a5f,_0xc681('0xf'));_0x222ba9(_0x434d71[_0xc681('0x16')][_0xc681('0x15')]);}})['catch'](function(_0x72471b){logger[_0xc681('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x404a5f,_0x72471b);_0x361d26(_0x72471b);});});}exports[_0xc681('0x17')]=function(_0x1d90b5){var _0x5ae2b3=this;return new Promise(function(_0x38bfe8,_0x5f2f8a){return db[_0xc681('0x18')][_0xc681('0x19')]({'raw':_0x1d90b5[_0xc681('0x1a')]?_0x1d90b5[_0xc681('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d90b5[_0xc681('0x1a')]?_0x1d90b5[_0xc681('0x1a')][_0xc681('0x1b')]||null:null,'attributes':_0x1d90b5[_0xc681('0x1a')]?_0x1d90b5[_0xc681('0x1a')]['attributes']||null:null,'limit':_0x1d90b5[_0xc681('0x1a')]?_0x1d90b5[_0xc681('0x1a')][_0xc681('0x1c')]||null:null,'include':_0x1d90b5[_0xc681('0x1a')]?_0x1d90b5['options'][_0xc681('0x1d')]?_['map'](_0x1d90b5[_0xc681('0x1a')][_0xc681('0x1d')],function(_0x159033){return{'model':db[_0x159033[_0xc681('0x1e')]],'as':_0x159033['as'],'attributes':_0x159033[_0xc681('0x1f')],'include':_0x159033[_0xc681('0x1d')]?_[_0xc681('0x20')](_0x159033['include'],function(_0x1560c3){return{'model':db[_0x1560c3[_0xc681('0x1e')]],'as':_0x1560c3['as'],'attributes':_0x1560c3[_0xc681('0x1f')],'include':_0x1560c3[_0xc681('0x1d')]?_['map'](_0x1560c3[_0xc681('0x1d')],function(_0x3b29fa){return{'model':db[_0x3b29fa[_0xc681('0x1e')]],'as':_0x3b29fa['as'],'attributes':_0x3b29fa[_0xc681('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc681('0xc')](function(_0x4da117){logger['info'](_0xc681('0x17'),_0x1d90b5);logger['debug']('GetFreshdeskAccount',_0x1d90b5,JSON[_0xc681('0x12')](_0x4da117));_0x38bfe8(_0x4da117);})['catch'](function(_0x2c430d){logger[_0xc681('0x13')](_0xc681('0x17'),_0x2c430d[_0xc681('0x15')],_0x1d90b5);_0x5f2f8a(_0x5ae2b3['error'](0x1f4,_0x2c430d[_0xc681('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x25e3e7){var _0x48ba10=this;return new Promise(function(_0xcc605a,_0x4ed6f8){return db[_0xc681('0x18')]['find']({'raw':_0x25e3e7[_0xc681('0x1a')]?_0x25e3e7['options'][_0xc681('0x21')]===undefined?!![]:![]:!![],'where':_0x25e3e7[_0xc681('0x1a')]?_0x25e3e7[_0xc681('0x1a')][_0xc681('0x1b')]||null:null,'attributes':_0x25e3e7[_0xc681('0x1a')]?_0x25e3e7[_0xc681('0x1a')][_0xc681('0x1f')]||null:null,'include':_0x25e3e7['options']?_0x25e3e7[_0xc681('0x1a')][_0xc681('0x1d')]?_['map'](_0x25e3e7[_0xc681('0x1a')][_0xc681('0x1d')],function(_0x3254c4){return{'model':db[_0x3254c4['model']],'as':_0x3254c4['as'],'attributes':_0x3254c4['attributes'],'include':_0x3254c4['include']?_[_0xc681('0x20')](_0x3254c4[_0xc681('0x1d')],function(_0x17aa84){return{'model':db[_0x17aa84[_0xc681('0x1e')]],'as':_0x17aa84['as'],'attributes':_0x17aa84['attributes'],'include':_0x17aa84[_0xc681('0x1d')]?_[_0xc681('0x20')](_0x17aa84[_0xc681('0x1d')],function(_0x24c199){return{'model':db[_0x24c199[_0xc681('0x1e')]],'as':_0x24c199['as'],'attributes':_0x24c199[_0xc681('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc681('0xc')](function(_0x458ff3){logger[_0xc681('0xd')](_0xc681('0x22'),_0x25e3e7);logger[_0xc681('0x10')](_0xc681('0x22'),_0x25e3e7,JSON['stringify'](_0x458ff3));_0xcc605a(_0x458ff3);})[_0xc681('0x23')](function(_0x534415){logger[_0xc681('0x13')](_0xc681('0x22'),_0x534415[_0xc681('0x15')],_0x25e3e7);_0x4ed6f8(_0x48ba10[_0xc681('0x13')](0x1f4,_0x534415['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7d686c5..8bb0f02 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 _0x1b9b=['../../config/environment','./intFreshdeskConfiguration.controller','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','update','delete','/:id','destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b8736,_0xeee7bc){var _0x43d1bb=function(_0x2f6f51){while(--_0x2f6f51){_0x1b8736['push'](_0x1b8736['shift']());}};_0x43d1bb(++_0xeee7bc);}(_0x1b9b,0x77));var _0xb1b9=function(_0x532c1e,_0xbd3222){_0x532c1e=_0x532c1e-0x0;var _0x35bd5a=_0x1b9b[_0x532c1e];return _0x35bd5a;};'use strict';var multer=require(_0xb1b9('0x0'));var util=require('util');var path=require(_0xb1b9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb1b9('0x2')]();var fs_extra=require(_0xb1b9('0x3'));var auth=require(_0xb1b9('0x4'));var interaction=require(_0xb1b9('0x5'));var config=require(_0xb1b9('0x6'));var controller=require(_0xb1b9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb1b9('0x8')]);router[_0xb1b9('0x9')]('/:id',auth[_0xb1b9('0xa')](),controller[_0xb1b9('0xb')]);router[_0xb1b9('0x9')](_0xb1b9('0xc'),auth[_0xb1b9('0xa')](),controller[_0xb1b9('0xd')]);router[_0xb1b9('0x9')](_0xb1b9('0xe'),auth[_0xb1b9('0xa')](),controller[_0xb1b9('0xf')]);router[_0xb1b9('0x9')]('/:id/descriptions',auth[_0xb1b9('0xa')](),controller[_0xb1b9('0x10')]);router[_0xb1b9('0x9')](_0xb1b9('0x11'),auth[_0xb1b9('0xa')](),controller['getTags']);router[_0xb1b9('0x12')]('/',auth['isAuthenticated'](),controller[_0xb1b9('0x13')]);router[_0xb1b9('0x12')](_0xb1b9('0x11'),auth[_0xb1b9('0xa')](),controller[_0xb1b9('0x14')]);router['put']('/:id',auth[_0xb1b9('0xa')](),controller[_0xb1b9('0x15')]);router[_0xb1b9('0x16')](_0xb1b9('0x17'),auth[_0xb1b9('0xa')](),controller[_0xb1b9('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd97f=['multer','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports'];(function(_0x48d122,_0x4bcd20){var _0x36e303=function(_0x2b7a2e){while(--_0x2b7a2e){_0x48d122['push'](_0x48d122['shift']());}};_0x36e303(++_0x4bcd20);}(_0xd97f,0x12c));var _0xfd97=function(_0x4ad62f,_0x4ee8d0){_0x4ad62f=_0x4ad62f-0x0;var _0x3a178f=_0xd97f[_0x4ad62f];return _0x3a178f;};'use strict';var multer=require(_0xfd97('0x0'));var util=require(_0xfd97('0x1'));var path=require(_0xfd97('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd97('0x3'));var router=express[_0xfd97('0x4')]();var fs_extra=require(_0xfd97('0x5'));var auth=require(_0xfd97('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0xfd97('0x7')](),controller['index']);router[_0xfd97('0x8')](_0xfd97('0x9'),auth[_0xfd97('0x7')](),controller[_0xfd97('0xa')]);router[_0xfd97('0x8')](_0xfd97('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xfd97('0x8')](_0xfd97('0xc'),auth[_0xfd97('0x7')](),controller['getSubjects']);router[_0xfd97('0x8')](_0xfd97('0xd'),auth[_0xfd97('0x7')](),controller[_0xfd97('0xe')]);router[_0xfd97('0x8')](_0xfd97('0xf'),auth[_0xfd97('0x7')](),controller[_0xfd97('0x10')]);router[_0xfd97('0x11')]('/',auth[_0xfd97('0x7')](),controller[_0xfd97('0x12')]);router[_0xfd97('0x11')](_0xfd97('0xf'),auth[_0xfd97('0x7')](),controller[_0xfd97('0x13')]);router[_0xfd97('0x14')](_0xfd97('0x9'),auth[_0xfd97('0x7')](),controller[_0xfd97('0x15')]);router[_0xfd97('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xfd97('0x17')]);module[_0xfd97('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c70fb92..8b22d19 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 _0xf717=['STRING','sequelize'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0xf717,0x173));var _0x7f71=function(_0x448437,_0x23a416){_0x448437=_0x448437-0x0;var _0x122ff6=_0xf717[_0x448437];return _0x122ff6;};'use strict';var Sequelize=require(_0x7f71('0x0'));module['exports']={'name':{'type':Sequelize[_0x7f71('0x1')]},'description':{'type':Sequelize[_0x7f71('0x1')]}}; \ No newline at end of file +var _0x7964=['exports','STRING','sequelize'];(function(_0x5bc75a,_0x38ce5c){var _0x51abb3=function(_0x2622c0){while(--_0x2622c0){_0x5bc75a['push'](_0x5bc75a['shift']());}};_0x51abb3(++_0x38ce5c);}(_0x7964,0x137));var _0x4796=function(_0x309561,_0x340ab0){_0x309561=_0x309561-0x0;var _0x1301a3=_0x7964[_0x309561];return _0x1301a3;};'use strict';var Sequelize=require(_0x4796('0x0'));module[_0x4796('0x1')]={'name':{'type':Sequelize[_0x4796('0x2')]},'description':{'type':Sequelize[_0x4796('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 3292490..d4d830b 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 _0xe562=['include','findAll','rows','show','params','rawAttributes','intersection','find','catch','create','body','getFields','findOne','hasOwnProperty','getSubjects','order','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','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','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','name','index','map','fieldName','type','model','keys','filters','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','then','includeAll'];(function(_0x146c12,_0x2559a8){var _0x1ce6fc=function(_0x301247){while(--_0x301247){_0x146c12['push'](_0x146c12['shift']());}};_0x1ce6fc(++_0x2559a8);}(_0xe562,0xba));var _0x2e56=function(_0x7f84ed,_0x10e49e){_0x7f84ed=_0x7f84ed-0x0;var _0x5c33ae=_0xe562[_0x7f84ed];return _0x5c33ae;};'use strict';var emlformat=require(_0x2e56('0x0'));var rimraf=require(_0x2e56('0x1'));var zipdir=require(_0x2e56('0x2'));var jsonpatch=require(_0x2e56('0x3'));var rp=require(_0x2e56('0x4'));var moment=require(_0x2e56('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e56('0x6'));var path=require(_0x2e56('0x7'));var sox=require('sox');var csv=require(_0x2e56('0x8'));var ejs=require(_0x2e56('0x9'));var fs=require('fs');var fs_extra=require(_0x2e56('0xa'));var _=require(_0x2e56('0xb'));var squel=require(_0x2e56('0xc'));var crypto=require(_0x2e56('0xd'));var jsforce=require(_0x2e56('0xe'));var deskjs=require(_0x2e56('0xf'));var toCsv=require(_0x2e56('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2e56('0x10'));var qs=require(_0x2e56('0x11'));var as=require(_0x2e56('0x12'));var hardwareService=require(_0x2e56('0x13'));var logger=require(_0x2e56('0x14'))(_0x2e56('0x15'));var utils=require(_0x2e56('0x16'));var config=require(_0x2e56('0x17'));var licenseUtil=require(_0x2e56('0x18'));var db=require(_0x2e56('0x19'))['db'];function respondWithStatusCode(_0x41c2ed,_0x5d1cfa){_0x5d1cfa=_0x5d1cfa||0xcc;return function(_0x3a750f){if(_0x3a750f){return _0x41c2ed[_0x2e56('0x1a')](_0x5d1cfa);}return _0x41c2ed[_0x2e56('0x1b')](_0x5d1cfa)[_0x2e56('0x1c')]();};}function respondWithResult(_0x2c2d7b,_0x35df18){_0x35df18=_0x35df18||0xc8;return function(_0x5e8e92){if(_0x5e8e92){return _0x2c2d7b[_0x2e56('0x1b')](_0x35df18)['json'](_0x5e8e92);}};}function respondWithFilteredResult(_0x3a2bd3,_0x2d66fa){return function(_0x796265){if(_0x796265){var _0xea46f8=typeof _0x2d66fa[_0x2e56('0x1d')]===_0x2e56('0x1e')&&typeof _0x2d66fa[_0x2e56('0x1f')]===_0x2e56('0x1e');var _0x350160=_0x796265[_0x2e56('0x20')];var _0x25f12d=_0xea46f8?0x0:_0x2d66fa[_0x2e56('0x1d')];var _0x59aa24=_0xea46f8?_0x796265['count']:_0x2d66fa['offset']+_0x2d66fa[_0x2e56('0x1f')];var _0x1be950;if(_0x59aa24>=_0x350160){_0x59aa24=_0x350160;_0x1be950=0xc8;}else{_0x1be950=0xce;}_0x3a2bd3[_0x2e56('0x1b')](_0x1be950);return _0x3a2bd3[_0x2e56('0x21')]('Content-Range',_0x25f12d+'-'+_0x59aa24+'/'+_0x350160)[_0x2e56('0x22')](_0x796265);}return null;};}function patchUpdates(_0x3ab8a2){return function(_0x4c259e){try{jsonpatch[_0x2e56('0x23')](_0x4c259e,_0x3ab8a2,!![]);}catch(_0x1cf8ce){return BPromise[_0x2e56('0x24')](_0x1cf8ce);}return _0x4c259e[_0x2e56('0x25')]();};}function saveUpdates(_0x11444a,_0x4a2245){return function(_0x4d7dd6){if(_0x4d7dd6){return _0x4d7dd6[_0x2e56('0x26')](_0x11444a)['then'](function(_0x114ed3){return _0x114ed3;});}return null;};}function removeEntity(_0x690f96,_0x2d8b58){return function(_0x3583d7){if(_0x3583d7){return _0x3583d7[_0x2e56('0x27')]()['then'](function(){_0x690f96[_0x2e56('0x1b')](0xcc)[_0x2e56('0x1c')]();});}};}function handleEntityNotFound(_0x2b94fe,_0x3af614){return function(_0x1ee2a5){if(!_0x1ee2a5){_0x2b94fe[_0x2e56('0x1a')](0x194);}return _0x1ee2a5;};}function handleError(_0x46111e,_0x5ef93a){_0x5ef93a=_0x5ef93a||0x1f4;return function(_0x1bb74e){logger['error'](_0x1bb74e['stack']);if(_0x1bb74e['name']){delete _0x1bb74e[_0x2e56('0x28')];}_0x46111e[_0x2e56('0x1b')](_0x5ef93a)['send'](_0x1bb74e);};}exports[_0x2e56('0x29')]=function(_0x248684,_0x1fc59c){var _0x4de657={},_0x586f87={},_0x2f6938={'count':0x0,'rows':[]};var _0xc441a7=_[_0x2e56('0x2a')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x25a697){return{'name':_0x25a697[_0x2e56('0x2b')],'type':_0x25a697[_0x2e56('0x2c')]['key']};});_0x586f87[_0x2e56('0x2d')]=_[_0x2e56('0x2a')](_0xc441a7,_0x2e56('0x28'));_0x586f87['query']=_[_0x2e56('0x2e')](_0x248684['query']);_0x586f87[_0x2e56('0x2f')]=_['intersection'](_0x586f87[_0x2e56('0x2d')],_0x586f87[_0x2e56('0x30')]);_0x4de657[_0x2e56('0x31')]=_['intersection'](_0x586f87[_0x2e56('0x2d')],qs[_0x2e56('0x32')](_0x248684['query']['fields']));_0x4de657[_0x2e56('0x31')]=_0x4de657[_0x2e56('0x31')][_0x2e56('0x33')]?_0x4de657[_0x2e56('0x31')]:_0x586f87[_0x2e56('0x2d')];if(!_0x248684[_0x2e56('0x30')]['hasOwnProperty'](_0x2e56('0x34'))){_0x4de657[_0x2e56('0x1f')]=qs[_0x2e56('0x1f')](_0x248684[_0x2e56('0x30')]['limit']);_0x4de657[_0x2e56('0x1d')]=qs[_0x2e56('0x1d')](_0x248684[_0x2e56('0x30')][_0x2e56('0x1d')]);}_0x4de657['order']=qs['sort'](_0x248684[_0x2e56('0x30')][_0x2e56('0x35')]);_0x4de657[_0x2e56('0x36')]=qs[_0x2e56('0x2f')](_[_0x2e56('0x37')](_0x248684['query'],_0x586f87[_0x2e56('0x2f')]),_0xc441a7);if(_0x248684[_0x2e56('0x30')][_0x2e56('0x38')]){_0x4de657[_0x2e56('0x36')]=_[_0x2e56('0x39')](_0x4de657['where'],{'$or':_[_0x2e56('0x2a')](_0xc441a7,function(_0x159ed6){if(_0x159ed6[_0x2e56('0x2c')]!==_0x2e56('0x3a')){var _0x38cd06={};_0x38cd06[_0x159ed6[_0x2e56('0x28')]]={'$like':'%'+_0x248684[_0x2e56('0x30')][_0x2e56('0x38')]+'%'};return _0x38cd06;}})});}_0x4de657=_[_0x2e56('0x39')]({},_0x4de657,_0x248684[_0x2e56('0x3b')]);var _0x3ec611={'where':_0x4de657[_0x2e56('0x36')]};return db[_0x2e56('0x3c')][_0x2e56('0x20')](_0x3ec611)[_0x2e56('0x3d')](function(_0x5a8bbd){_0x2f6938[_0x2e56('0x20')]=_0x5a8bbd;if(_0x248684[_0x2e56('0x30')][_0x2e56('0x3e')]){_0x4de657[_0x2e56('0x3f')]=[{'all':!![]}];}return db[_0x2e56('0x3c')][_0x2e56('0x40')](_0x4de657);})[_0x2e56('0x3d')](function(_0x12c429){_0x2f6938[_0x2e56('0x41')]=_0x12c429;return _0x2f6938;})[_0x2e56('0x3d')](respondWithFilteredResult(_0x1fc59c,_0x4de657))['catch'](handleError(_0x1fc59c,null));};exports[_0x2e56('0x42')]=function(_0x3f6c5b,_0x12f2e4){var _0x317981={'raw':![],'where':{'id':_0x3f6c5b[_0x2e56('0x43')]['id']}},_0x431905={};_0x431905['model']=_[_0x2e56('0x2e')](db['FreshdeskConfiguration'][_0x2e56('0x44')]);_0x431905[_0x2e56('0x30')]=_[_0x2e56('0x2e')](_0x3f6c5b[_0x2e56('0x30')]);_0x431905[_0x2e56('0x2f')]=_[_0x2e56('0x45')](_0x431905[_0x2e56('0x2d')],_0x431905[_0x2e56('0x30')]);_0x317981['attributes']=_[_0x2e56('0x45')](_0x431905[_0x2e56('0x2d')],qs[_0x2e56('0x32')](_0x3f6c5b[_0x2e56('0x30')]['fields']));_0x317981[_0x2e56('0x31')]=_0x317981[_0x2e56('0x31')][_0x2e56('0x33')]?_0x317981[_0x2e56('0x31')]:_0x431905[_0x2e56('0x2d')];if(_0x3f6c5b[_0x2e56('0x30')]['includeAll']){_0x317981[_0x2e56('0x3f')]=[{'all':!![]}];}_0x317981=_[_0x2e56('0x39')]({},_0x317981,_0x3f6c5b[_0x2e56('0x3b')]);return db[_0x2e56('0x3c')][_0x2e56('0x46')](_0x317981)['then'](handleEntityNotFound(_0x12f2e4,null))['then'](respondWithResult(_0x12f2e4,null))[_0x2e56('0x47')](handleError(_0x12f2e4,null));};exports[_0x2e56('0x48')]=function(_0x4cdb8f,_0xbdda7d){return db[_0x2e56('0x3c')]['create'](_0x4cdb8f[_0x2e56('0x49')],{})[_0x2e56('0x3d')](respondWithResult(_0xbdda7d,0xc9))[_0x2e56('0x47')](handleError(_0xbdda7d,null));};exports[_0x2e56('0x26')]=function(_0xa94094,_0x23cf22){if(_0xa94094[_0x2e56('0x49')]['id']){delete _0xa94094[_0x2e56('0x49')]['id'];}return db[_0x2e56('0x3c')][_0x2e56('0x46')]({'where':{'id':_0xa94094['params']['id']}})['then'](handleEntityNotFound(_0x23cf22,null))[_0x2e56('0x3d')](saveUpdates(_0xa94094[_0x2e56('0x49')],null))[_0x2e56('0x3d')](respondWithResult(_0x23cf22,null))['catch'](handleError(_0x23cf22,null));};exports['destroy']=function(_0x1ab677,_0x58454a){return db[_0x2e56('0x3c')][_0x2e56('0x46')]({'where':{'id':_0x1ab677[_0x2e56('0x43')]['id']}})[_0x2e56('0x3d')](handleEntityNotFound(_0x58454a,null))[_0x2e56('0x3d')](removeEntity(_0x58454a,null))['catch'](handleError(_0x58454a,null));};exports[_0x2e56('0x4a')]=function(_0x2af232,_0x3d8aec,_0x4e2f39){var _0x4ef34f={};var _0x51125a={};var _0x561aad;var _0x4e152c;return db['FreshdeskConfiguration'][_0x2e56('0x4b')]({'where':{'id':_0x2af232[_0x2e56('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d8aec,null))['then'](function(_0x46e960){if(_0x46e960){_0x561aad=_0x46e960;_0x51125a[_0x2e56('0x2d')]=_[_0x2e56('0x2e')](db['FreshdeskField'][_0x2e56('0x44')]);_0x51125a[_0x2e56('0x30')]=_[_0x2e56('0x2e')](_0x2af232[_0x2e56('0x30')]);_0x51125a[_0x2e56('0x2f')]=_[_0x2e56('0x45')](_0x51125a[_0x2e56('0x2d')],_0x51125a[_0x2e56('0x30')]);_0x4ef34f['attributes']=_['intersection'](_0x51125a['model'],qs[_0x2e56('0x32')](_0x2af232[_0x2e56('0x30')]['fields']));_0x4ef34f[_0x2e56('0x31')]=_0x4ef34f['attributes']['length']?_0x4ef34f[_0x2e56('0x31')]:_0x51125a[_0x2e56('0x2d')];_0x4ef34f['order']=qs[_0x2e56('0x35')](_0x2af232[_0x2e56('0x30')][_0x2e56('0x35')]);_0x4ef34f[_0x2e56('0x36')]=qs[_0x2e56('0x2f')](_['pick'](_0x2af232['query'],_0x51125a[_0x2e56('0x2f')]));if(_0x2af232[_0x2e56('0x30')][_0x2e56('0x38')]){_0x4ef34f['where']=_[_0x2e56('0x39')](_0x4ef34f['where'],{'$or':_[_0x2e56('0x2a')](_0x4ef34f[_0x2e56('0x31')],function(_0xb87200){var _0x5644c6={};_0x5644c6[_0xb87200]={'$like':'%'+_0x2af232[_0x2e56('0x30')][_0x2e56('0x38')]+'%'};return _0x5644c6;})});}_0x4ef34f=_['merge']({},_0x4ef34f,_0x2af232['options']);return _0x561aad[_0x2e56('0x4a')](_0x4ef34f);}})[_0x2e56('0x3d')](function(_0x2caaf3){if(_0x2caaf3){_0x4e152c=_0x2caaf3[_0x2e56('0x33')];if(!_0x2af232[_0x2e56('0x30')][_0x2e56('0x4c')](_0x2e56('0x34'))){_0x4ef34f[_0x2e56('0x1f')]=qs['limit'](_0x2af232['query'][_0x2e56('0x1f')]);_0x4ef34f['offset']=qs[_0x2e56('0x1d')](_0x2af232['query'][_0x2e56('0x1d')]);}return _0x561aad[_0x2e56('0x4a')](_0x4ef34f);}})['then'](function(_0x49ce39){if(_0x49ce39){return _0x49ce39?{'count':_0x4e152c,'rows':_0x49ce39}:null;}})[_0x2e56('0x3d')](respondWithResult(_0x3d8aec,null))[_0x2e56('0x47')](handleError(_0x3d8aec,null));};exports[_0x2e56('0x4d')]=function(_0x239fad,_0x26ba08,_0x286c75){var _0x13ad5b={};var _0x2d1c8d={};var _0x177ca9;var _0x2f2885;return db[_0x2e56('0x3c')][_0x2e56('0x4b')]({'where':{'id':_0x239fad[_0x2e56('0x43')]['id']}})[_0x2e56('0x3d')](handleEntityNotFound(_0x26ba08,null))[_0x2e56('0x3d')](function(_0x14281b){if(_0x14281b){_0x177ca9=_0x14281b;_0x2d1c8d['model']=_[_0x2e56('0x2e')](db['FreshdeskField']['rawAttributes']);_0x2d1c8d[_0x2e56('0x30')]=_['keys'](_0x239fad[_0x2e56('0x30')]);_0x2d1c8d[_0x2e56('0x2f')]=_[_0x2e56('0x45')](_0x2d1c8d[_0x2e56('0x2d')],_0x2d1c8d['query']);_0x13ad5b[_0x2e56('0x31')]=_[_0x2e56('0x45')](_0x2d1c8d['model'],qs[_0x2e56('0x32')](_0x239fad['query'][_0x2e56('0x32')]));_0x13ad5b[_0x2e56('0x31')]=_0x13ad5b['attributes'][_0x2e56('0x33')]?_0x13ad5b['attributes']:_0x2d1c8d[_0x2e56('0x2d')];_0x13ad5b[_0x2e56('0x4e')]=qs[_0x2e56('0x35')](_0x239fad[_0x2e56('0x30')][_0x2e56('0x35')]);_0x13ad5b[_0x2e56('0x36')]=qs[_0x2e56('0x2f')](_[_0x2e56('0x37')](_0x239fad[_0x2e56('0x30')],_0x2d1c8d[_0x2e56('0x2f')]));if(_0x239fad[_0x2e56('0x30')]['filter']){_0x13ad5b[_0x2e56('0x36')]=_[_0x2e56('0x39')](_0x13ad5b['where'],{'$or':_[_0x2e56('0x2a')](_0x13ad5b['attributes'],function(_0x2f3500){var _0x279841={};_0x279841[_0x2f3500]={'$like':'%'+_0x239fad[_0x2e56('0x30')][_0x2e56('0x38')]+'%'};return _0x279841;})});}_0x13ad5b=_[_0x2e56('0x39')]({},_0x13ad5b,_0x239fad[_0x2e56('0x3b')]);return _0x177ca9[_0x2e56('0x4d')](_0x13ad5b);}})['then'](function(_0x3e4a56){if(_0x3e4a56){_0x2f2885=_0x3e4a56[_0x2e56('0x33')];if(!_0x239fad[_0x2e56('0x30')]['hasOwnProperty']('nolimit')){_0x13ad5b[_0x2e56('0x1f')]=qs['limit'](_0x239fad['query'][_0x2e56('0x1f')]);_0x13ad5b[_0x2e56('0x1d')]=qs[_0x2e56('0x1d')](_0x239fad[_0x2e56('0x30')][_0x2e56('0x1d')]);}return _0x177ca9[_0x2e56('0x4d')](_0x13ad5b);}})[_0x2e56('0x3d')](function(_0x2330e7){if(_0x2330e7){return _0x2330e7?{'count':_0x2f2885,'rows':_0x2330e7}:null;}})['then'](respondWithResult(_0x26ba08,null))[_0x2e56('0x47')](handleError(_0x26ba08,null));};exports[_0x2e56('0x4f')]=function(_0x3fa0ee,_0x41b373,_0x421084){var _0x29a691={};var _0x444046={};var _0x283c77;var _0x101072;return db['FreshdeskConfiguration'][_0x2e56('0x4b')]({'where':{'id':_0x3fa0ee[_0x2e56('0x43')]['id']}})[_0x2e56('0x3d')](handleEntityNotFound(_0x41b373,null))[_0x2e56('0x3d')](function(_0x5d3d34){if(_0x5d3d34){_0x283c77=_0x5d3d34;_0x444046['model']=_['keys'](db['FreshdeskField'][_0x2e56('0x44')]);_0x444046[_0x2e56('0x30')]=_[_0x2e56('0x2e')](_0x3fa0ee[_0x2e56('0x30')]);_0x444046[_0x2e56('0x2f')]=_[_0x2e56('0x45')](_0x444046[_0x2e56('0x2d')],_0x444046[_0x2e56('0x30')]);_0x29a691[_0x2e56('0x31')]=_['intersection'](_0x444046[_0x2e56('0x2d')],qs[_0x2e56('0x32')](_0x3fa0ee['query']['fields']));_0x29a691[_0x2e56('0x31')]=_0x29a691[_0x2e56('0x31')][_0x2e56('0x33')]?_0x29a691[_0x2e56('0x31')]:_0x444046[_0x2e56('0x2d')];_0x29a691[_0x2e56('0x4e')]=qs[_0x2e56('0x35')](_0x3fa0ee[_0x2e56('0x30')]['sort']);_0x29a691[_0x2e56('0x36')]=qs[_0x2e56('0x2f')](_[_0x2e56('0x37')](_0x3fa0ee[_0x2e56('0x30')],_0x444046[_0x2e56('0x2f')]));if(_0x3fa0ee['query'][_0x2e56('0x38')]){_0x29a691[_0x2e56('0x36')]=_[_0x2e56('0x39')](_0x29a691['where'],{'$or':_[_0x2e56('0x2a')](_0x29a691['attributes'],function(_0x3a3924){var _0x1b7e21={};_0x1b7e21[_0x3a3924]={'$like':'%'+_0x3fa0ee[_0x2e56('0x30')][_0x2e56('0x38')]+'%'};return _0x1b7e21;})});}_0x29a691=_[_0x2e56('0x39')]({},_0x29a691,_0x3fa0ee[_0x2e56('0x3b')]);return _0x283c77[_0x2e56('0x4f')](_0x29a691);}})[_0x2e56('0x3d')](function(_0x1d8567){if(_0x1d8567){_0x101072=_0x1d8567['length'];if(!_0x3fa0ee['query'][_0x2e56('0x4c')]('nolimit')){_0x29a691[_0x2e56('0x1f')]=qs['limit'](_0x3fa0ee[_0x2e56('0x30')][_0x2e56('0x1f')]);_0x29a691[_0x2e56('0x1d')]=qs['offset'](_0x3fa0ee['query'][_0x2e56('0x1d')]);}return _0x283c77['getDescriptions'](_0x29a691);}})[_0x2e56('0x3d')](function(_0x2091cf){if(_0x2091cf){return _0x2091cf?{'count':_0x101072,'rows':_0x2091cf}:null;}})['then'](respondWithResult(_0x41b373,null))[_0x2e56('0x47')](handleError(_0x41b373,null));};exports[_0x2e56('0x50')]=function(_0x151a14,_0x28abcd,_0x262084){var _0x547633={};var _0x4f3a38={};var _0x53e343;var _0x1a0e25;return db[_0x2e56('0x3c')][_0x2e56('0x4b')]({'where':{'id':_0x151a14[_0x2e56('0x43')]['id']}})[_0x2e56('0x3d')](handleEntityNotFound(_0x28abcd,null))['then'](function(_0x40db53){if(_0x40db53){_0x53e343=_0x40db53;_0x4f3a38[_0x2e56('0x2d')]=_[_0x2e56('0x2e')](db['Tag']['rawAttributes']);_0x4f3a38[_0x2e56('0x30')]=_[_0x2e56('0x2e')](_0x151a14[_0x2e56('0x30')]);_0x4f3a38['filters']=_['intersection'](_0x4f3a38[_0x2e56('0x2d')],_0x4f3a38[_0x2e56('0x30')]);_0x547633[_0x2e56('0x31')]=_[_0x2e56('0x45')](_0x4f3a38['model'],qs[_0x2e56('0x32')](_0x151a14[_0x2e56('0x30')][_0x2e56('0x32')]));_0x547633[_0x2e56('0x31')]=_0x547633[_0x2e56('0x31')]['length']?_0x547633[_0x2e56('0x31')]:_0x4f3a38[_0x2e56('0x2d')];_0x547633[_0x2e56('0x4e')]=qs['sort'](_0x151a14[_0x2e56('0x30')]['sort']);_0x547633[_0x2e56('0x36')]=qs[_0x2e56('0x2f')](_['pick'](_0x151a14[_0x2e56('0x30')],_0x4f3a38['filters']));if(_0x151a14[_0x2e56('0x30')]['filter']){_0x547633['where']=_[_0x2e56('0x39')](_0x547633[_0x2e56('0x36')],{'$or':_[_0x2e56('0x2a')](_0x547633[_0x2e56('0x31')],function(_0x2410c8){var _0x318375={};_0x318375[_0x2410c8]={'$like':'%'+_0x151a14[_0x2e56('0x30')][_0x2e56('0x38')]+'%'};return _0x318375;})});}_0x547633=_[_0x2e56('0x39')]({},_0x547633,_0x151a14[_0x2e56('0x3b')]);return _0x53e343[_0x2e56('0x50')](_0x547633);}})[_0x2e56('0x3d')](function(_0x1d739f){if(_0x1d739f){_0x1a0e25=_0x1d739f[_0x2e56('0x33')];if(!_0x151a14[_0x2e56('0x30')][_0x2e56('0x4c')]('nolimit')){_0x547633[_0x2e56('0x1f')]=qs[_0x2e56('0x1f')](_0x151a14[_0x2e56('0x30')]['limit']);_0x547633[_0x2e56('0x1d')]=qs['offset'](_0x151a14[_0x2e56('0x30')]['offset']);}return _0x53e343['getTags'](_0x547633);}})['then'](function(_0x1b057d){if(_0x1b057d){return _0x1b057d?{'count':_0x1a0e25,'rows':_0x1b057d}:null;}})[_0x2e56('0x3d')](respondWithResult(_0x28abcd,null))[_0x2e56('0x47')](handleError(_0x28abcd,null));};exports[_0x2e56('0x51')]=function(_0x2a85d4,_0x1722e5,_0x562025){if(_0x2a85d4['body']['id']){delete _0x2a85d4[_0x2e56('0x49')]['id'];}return db['FreshdeskConfiguration'][_0x2e56('0x4b')]({'where':{'id':_0x2a85d4[_0x2e56('0x43')]['id']}})[_0x2e56('0x3d')](handleEntityNotFound(_0x1722e5,null))['then'](function(_0x36c276){if(_0x36c276){return _0x36c276[_0x2e56('0x51')](_0x2a85d4['body'][_0x2e56('0x52')]||[]);}return null;})[_0x2e56('0x3d')](respondWithResult(_0x1722e5,null))[_0x2e56('0x47')](handleError(_0x1722e5,null));}; \ No newline at end of file +var _0x4c96=['update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','keys','fields','includeAll','catch','body','find','getFields','FreshdeskField','options','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x1d1271,_0x1eb1aa){var _0x35c598=function(_0x424418){while(--_0x424418){_0x1d1271['push'](_0x1d1271['shift']());}};_0x35c598(++_0x1eb1aa);}(_0x4c96,0x18b));var _0x64c9=function(_0xb0308,_0x606396){_0xb0308=_0xb0308-0x0;var _0x1f9ab4=_0x4c96[_0xb0308];return _0x1f9ab4;};'use strict';var emlformat=require(_0x64c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64c9('0x1'));var jsonpatch=require(_0x64c9('0x2'));var rp=require(_0x64c9('0x3'));var moment=require(_0x64c9('0x4'));var BPromise=require(_0x64c9('0x5'));var Mustache=require('mustache');var util=require(_0x64c9('0x6'));var path=require('path');var sox=require(_0x64c9('0x7'));var csv=require(_0x64c9('0x8'));var ejs=require(_0x64c9('0x9'));var fs=require('fs');var fs_extra=require(_0x64c9('0xa'));var _=require(_0x64c9('0xb'));var squel=require(_0x64c9('0xc'));var crypto=require(_0x64c9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x64c9('0xe'));var Papa=require(_0x64c9('0xf'));var Redis=require(_0x64c9('0x10'));var authService=require(_0x64c9('0x11'));var qs=require(_0x64c9('0x12'));var as=require(_0x64c9('0x13'));var hardwareService=require(_0x64c9('0x14'));var logger=require(_0x64c9('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x64c9('0x16'));var db=require(_0x64c9('0x17'))['db'];function respondWithStatusCode(_0x26888d,_0x28297d){_0x28297d=_0x28297d||0xcc;return function(_0x33b2f4){if(_0x33b2f4){return _0x26888d[_0x64c9('0x18')](_0x28297d);}return _0x26888d['status'](_0x28297d)[_0x64c9('0x19')]();};}function respondWithResult(_0x43070d,_0x3c7e14){_0x3c7e14=_0x3c7e14||0xc8;return function(_0x4236a7){if(_0x4236a7){return _0x43070d[_0x64c9('0x1a')](_0x3c7e14)[_0x64c9('0x1b')](_0x4236a7);}};}function respondWithFilteredResult(_0x2b73e7,_0x417bdf){return function(_0x1a5c75){if(_0x1a5c75){var _0x5ce3eb=typeof _0x417bdf['offset']==='undefined'&&typeof _0x417bdf['limit']===_0x64c9('0x1c');var _0x2ef3f3=_0x1a5c75[_0x64c9('0x1d')];var _0x97351=_0x5ce3eb?0x0:_0x417bdf['offset'];var _0x478be2=_0x5ce3eb?_0x1a5c75[_0x64c9('0x1d')]:_0x417bdf['offset']+_0x417bdf['limit'];var _0x440bab;if(_0x478be2>=_0x2ef3f3){_0x478be2=_0x2ef3f3;_0x440bab=0xc8;}else{_0x440bab=0xce;}_0x2b73e7['status'](_0x440bab);return _0x2b73e7[_0x64c9('0x1e')](_0x64c9('0x1f'),_0x97351+'-'+_0x478be2+'/'+_0x2ef3f3)[_0x64c9('0x1b')](_0x1a5c75);}return null;};}function patchUpdates(_0x27eb2b){return function(_0x4f1674){try{jsonpatch[_0x64c9('0x20')](_0x4f1674,_0x27eb2b,!![]);}catch(_0x31200b){return BPromise[_0x64c9('0x21')](_0x31200b);}return _0x4f1674[_0x64c9('0x22')]();};}function saveUpdates(_0x1e66f0,_0x1cf199){return function(_0x244a85){if(_0x244a85){return _0x244a85[_0x64c9('0x23')](_0x1e66f0)['then'](function(_0x258b0e){return _0x258b0e;});}return null;};}function removeEntity(_0x3570cb,_0x5785a3){return function(_0x46e972){if(_0x46e972){return _0x46e972[_0x64c9('0x24')]()[_0x64c9('0x25')](function(){_0x3570cb[_0x64c9('0x1a')](0xcc)[_0x64c9('0x19')]();});}};}function handleEntityNotFound(_0x1e0996,_0x134652){return function(_0x200897){if(!_0x200897){_0x1e0996[_0x64c9('0x18')](0x194);}return _0x200897;};}function handleError(_0x5b910f,_0x2dead5){_0x2dead5=_0x2dead5||0x1f4;return function(_0x21ed5e){logger[_0x64c9('0x26')](_0x21ed5e[_0x64c9('0x27')]);if(_0x21ed5e[_0x64c9('0x28')]){delete _0x21ed5e[_0x64c9('0x28')];}_0x5b910f[_0x64c9('0x1a')](_0x2dead5)[_0x64c9('0x29')](_0x21ed5e);};}exports[_0x64c9('0x2a')]=function(_0x5dd21a,_0x5af5c1){var _0x43cb63={},_0x8e717e={},_0x44480a={'count':0x0,'rows':[]};var _0x4e2c8c=_[_0x64c9('0x2b')](db[_0x64c9('0x2c')][_0x64c9('0x2d')],function(_0x36f696){return{'name':_0x36f696[_0x64c9('0x2e')],'type':_0x36f696[_0x64c9('0x2f')][_0x64c9('0x30')]};});_0x8e717e[_0x64c9('0x31')]=_[_0x64c9('0x2b')](_0x4e2c8c,_0x64c9('0x28'));_0x8e717e[_0x64c9('0x32')]=_['keys'](_0x5dd21a[_0x64c9('0x32')]);_0x8e717e[_0x64c9('0x33')]=_[_0x64c9('0x34')](_0x8e717e[_0x64c9('0x31')],_0x8e717e[_0x64c9('0x32')]);_0x43cb63[_0x64c9('0x35')]=_[_0x64c9('0x34')](_0x8e717e[_0x64c9('0x31')],qs['fields'](_0x5dd21a['query']['fields']));_0x43cb63[_0x64c9('0x35')]=_0x43cb63[_0x64c9('0x35')][_0x64c9('0x36')]?_0x43cb63['attributes']:_0x8e717e[_0x64c9('0x31')];if(!_0x5dd21a['query'][_0x64c9('0x37')](_0x64c9('0x38'))){_0x43cb63[_0x64c9('0x39')]=qs[_0x64c9('0x39')](_0x5dd21a[_0x64c9('0x32')]['limit']);_0x43cb63[_0x64c9('0x3a')]=qs['offset'](_0x5dd21a['query']['offset']);}_0x43cb63[_0x64c9('0x3b')]=qs[_0x64c9('0x3c')](_0x5dd21a[_0x64c9('0x32')][_0x64c9('0x3c')]);_0x43cb63[_0x64c9('0x3d')]=qs['filters'](_[_0x64c9('0x3e')](_0x5dd21a[_0x64c9('0x32')],_0x8e717e[_0x64c9('0x33')]),_0x4e2c8c);if(_0x5dd21a['query'][_0x64c9('0x3f')]){_0x43cb63['where']=_['merge'](_0x43cb63[_0x64c9('0x3d')],{'$or':_['map'](_0x4e2c8c,function(_0x4758d4){if(_0x4758d4[_0x64c9('0x2f')]!==_0x64c9('0x40')){var _0x49d5a6={};_0x49d5a6[_0x4758d4[_0x64c9('0x28')]]={'$like':'%'+_0x5dd21a[_0x64c9('0x32')]['filter']+'%'};return _0x49d5a6;}})});}_0x43cb63=_[_0x64c9('0x41')]({},_0x43cb63,_0x5dd21a['options']);var _0x2ed28b={'where':_0x43cb63[_0x64c9('0x3d')]};return db['FreshdeskConfiguration'][_0x64c9('0x1d')](_0x2ed28b)[_0x64c9('0x25')](function(_0x32812e){_0x44480a['count']=_0x32812e;if(_0x5dd21a[_0x64c9('0x32')]['includeAll']){_0x43cb63[_0x64c9('0x42')]=[{'all':!![]}];}return db[_0x64c9('0x2c')][_0x64c9('0x43')](_0x43cb63);})[_0x64c9('0x25')](function(_0x8448e6){_0x44480a[_0x64c9('0x44')]=_0x8448e6;return _0x44480a;})[_0x64c9('0x25')](respondWithFilteredResult(_0x5af5c1,_0x43cb63))['catch'](handleError(_0x5af5c1,null));};exports[_0x64c9('0x45')]=function(_0x9ec4ab,_0x44c3e6){var _0x16d18e={'raw':![],'where':{'id':_0x9ec4ab[_0x64c9('0x46')]['id']}},_0xcc5f4e={};_0xcc5f4e[_0x64c9('0x31')]=_[_0x64c9('0x47')](db[_0x64c9('0x2c')][_0x64c9('0x2d')]);_0xcc5f4e[_0x64c9('0x32')]=_[_0x64c9('0x47')](_0x9ec4ab['query']);_0xcc5f4e[_0x64c9('0x33')]=_[_0x64c9('0x34')](_0xcc5f4e['model'],_0xcc5f4e['query']);_0x16d18e[_0x64c9('0x35')]=_[_0x64c9('0x34')](_0xcc5f4e[_0x64c9('0x31')],qs[_0x64c9('0x48')](_0x9ec4ab[_0x64c9('0x32')]['fields']));_0x16d18e[_0x64c9('0x35')]=_0x16d18e[_0x64c9('0x35')][_0x64c9('0x36')]?_0x16d18e[_0x64c9('0x35')]:_0xcc5f4e[_0x64c9('0x31')];if(_0x9ec4ab[_0x64c9('0x32')][_0x64c9('0x49')]){_0x16d18e[_0x64c9('0x42')]=[{'all':!![]}];}_0x16d18e=_[_0x64c9('0x41')]({},_0x16d18e,_0x9ec4ab['options']);return db[_0x64c9('0x2c')]['find'](_0x16d18e)[_0x64c9('0x25')](handleEntityNotFound(_0x44c3e6,null))[_0x64c9('0x25')](respondWithResult(_0x44c3e6,null))[_0x64c9('0x4a')](handleError(_0x44c3e6,null));};exports['create']=function(_0x39b6bc,_0x332dff){return db[_0x64c9('0x2c')]['create'](_0x39b6bc[_0x64c9('0x4b')],{})[_0x64c9('0x25')](respondWithResult(_0x332dff,0xc9))[_0x64c9('0x4a')](handleError(_0x332dff,null));};exports['update']=function(_0x47f80a,_0x19feb6){if(_0x47f80a[_0x64c9('0x4b')]['id']){delete _0x47f80a['body']['id'];}return db[_0x64c9('0x2c')][_0x64c9('0x4c')]({'where':{'id':_0x47f80a['params']['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x19feb6,null))[_0x64c9('0x25')](saveUpdates(_0x47f80a[_0x64c9('0x4b')],null))[_0x64c9('0x25')](respondWithResult(_0x19feb6,null))[_0x64c9('0x4a')](handleError(_0x19feb6,null));};exports[_0x64c9('0x24')]=function(_0x1efae6,_0x4e2d51){return db[_0x64c9('0x2c')][_0x64c9('0x4c')]({'where':{'id':_0x1efae6['params']['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x4e2d51,null))[_0x64c9('0x25')](removeEntity(_0x4e2d51,null))[_0x64c9('0x4a')](handleError(_0x4e2d51,null));};exports[_0x64c9('0x4d')]=function(_0x43f634,_0x2e5a16,_0x39c320){var _0xb94359={};var _0x55143e={};var _0x3528b0;var _0x2a7bcd;return db[_0x64c9('0x2c')]['findOne']({'where':{'id':_0x43f634[_0x64c9('0x46')]['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x2e5a16,null))[_0x64c9('0x25')](function(_0x595271){if(_0x595271){_0x3528b0=_0x595271;_0x55143e[_0x64c9('0x31')]=_[_0x64c9('0x47')](db[_0x64c9('0x4e')][_0x64c9('0x2d')]);_0x55143e['query']=_[_0x64c9('0x47')](_0x43f634[_0x64c9('0x32')]);_0x55143e[_0x64c9('0x33')]=_[_0x64c9('0x34')](_0x55143e[_0x64c9('0x31')],_0x55143e[_0x64c9('0x32')]);_0xb94359[_0x64c9('0x35')]=_[_0x64c9('0x34')](_0x55143e[_0x64c9('0x31')],qs[_0x64c9('0x48')](_0x43f634[_0x64c9('0x32')][_0x64c9('0x48')]));_0xb94359[_0x64c9('0x35')]=_0xb94359[_0x64c9('0x35')][_0x64c9('0x36')]?_0xb94359[_0x64c9('0x35')]:_0x55143e[_0x64c9('0x31')];_0xb94359[_0x64c9('0x3b')]=qs[_0x64c9('0x3c')](_0x43f634['query'][_0x64c9('0x3c')]);_0xb94359['where']=qs[_0x64c9('0x33')](_[_0x64c9('0x3e')](_0x43f634[_0x64c9('0x32')],_0x55143e[_0x64c9('0x33')]));if(_0x43f634[_0x64c9('0x32')]['filter']){_0xb94359['where']=_[_0x64c9('0x41')](_0xb94359[_0x64c9('0x3d')],{'$or':_[_0x64c9('0x2b')](_0xb94359[_0x64c9('0x35')],function(_0x573fd4){var _0x14ef64={};_0x14ef64[_0x573fd4]={'$like':'%'+_0x43f634[_0x64c9('0x32')][_0x64c9('0x3f')]+'%'};return _0x14ef64;})});}_0xb94359=_[_0x64c9('0x41')]({},_0xb94359,_0x43f634[_0x64c9('0x4f')]);return _0x3528b0['getFields'](_0xb94359);}})[_0x64c9('0x25')](function(_0x272dc3){if(_0x272dc3){_0x2a7bcd=_0x272dc3[_0x64c9('0x36')];if(!_0x43f634[_0x64c9('0x32')][_0x64c9('0x37')](_0x64c9('0x38'))){_0xb94359['limit']=qs['limit'](_0x43f634[_0x64c9('0x32')][_0x64c9('0x39')]);_0xb94359['offset']=qs[_0x64c9('0x3a')](_0x43f634['query'][_0x64c9('0x3a')]);}return _0x3528b0[_0x64c9('0x4d')](_0xb94359);}})[_0x64c9('0x25')](function(_0x440984){if(_0x440984){return _0x440984?{'count':_0x2a7bcd,'rows':_0x440984}:null;}})[_0x64c9('0x25')](respondWithResult(_0x2e5a16,null))[_0x64c9('0x4a')](handleError(_0x2e5a16,null));};exports[_0x64c9('0x50')]=function(_0x4ff78a,_0x5d889c,_0x14cf53){var _0xb0edf4={};var _0x1a3409={};var _0x12a7b6;var _0xd5381f;return db[_0x64c9('0x2c')][_0x64c9('0x51')]({'where':{'id':_0x4ff78a['params']['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x5d889c,null))[_0x64c9('0x25')](function(_0xc5d7dd){if(_0xc5d7dd){_0x12a7b6=_0xc5d7dd;_0x1a3409[_0x64c9('0x31')]=_[_0x64c9('0x47')](db[_0x64c9('0x4e')][_0x64c9('0x2d')]);_0x1a3409['query']=_[_0x64c9('0x47')](_0x4ff78a['query']);_0x1a3409[_0x64c9('0x33')]=_['intersection'](_0x1a3409[_0x64c9('0x31')],_0x1a3409[_0x64c9('0x32')]);_0xb0edf4[_0x64c9('0x35')]=_[_0x64c9('0x34')](_0x1a3409['model'],qs[_0x64c9('0x48')](_0x4ff78a[_0x64c9('0x32')][_0x64c9('0x48')]));_0xb0edf4['attributes']=_0xb0edf4[_0x64c9('0x35')][_0x64c9('0x36')]?_0xb0edf4['attributes']:_0x1a3409[_0x64c9('0x31')];_0xb0edf4[_0x64c9('0x3b')]=qs[_0x64c9('0x3c')](_0x4ff78a['query']['sort']);_0xb0edf4['where']=qs['filters'](_[_0x64c9('0x3e')](_0x4ff78a[_0x64c9('0x32')],_0x1a3409[_0x64c9('0x33')]));if(_0x4ff78a[_0x64c9('0x32')]['filter']){_0xb0edf4[_0x64c9('0x3d')]=_[_0x64c9('0x41')](_0xb0edf4[_0x64c9('0x3d')],{'$or':_[_0x64c9('0x2b')](_0xb0edf4['attributes'],function(_0x309cea){var _0x143144={};_0x143144[_0x309cea]={'$like':'%'+_0x4ff78a['query'][_0x64c9('0x3f')]+'%'};return _0x143144;})});}_0xb0edf4=_['merge']({},_0xb0edf4,_0x4ff78a[_0x64c9('0x4f')]);return _0x12a7b6[_0x64c9('0x50')](_0xb0edf4);}})[_0x64c9('0x25')](function(_0x471283){if(_0x471283){_0xd5381f=_0x471283[_0x64c9('0x36')];if(!_0x4ff78a[_0x64c9('0x32')][_0x64c9('0x37')](_0x64c9('0x38'))){_0xb0edf4[_0x64c9('0x39')]=qs[_0x64c9('0x39')](_0x4ff78a['query'][_0x64c9('0x39')]);_0xb0edf4[_0x64c9('0x3a')]=qs[_0x64c9('0x3a')](_0x4ff78a[_0x64c9('0x32')][_0x64c9('0x3a')]);}return _0x12a7b6[_0x64c9('0x50')](_0xb0edf4);}})[_0x64c9('0x25')](function(_0x23caaa){if(_0x23caaa){return _0x23caaa?{'count':_0xd5381f,'rows':_0x23caaa}:null;}})[_0x64c9('0x25')](respondWithResult(_0x5d889c,null))['catch'](handleError(_0x5d889c,null));};exports[_0x64c9('0x52')]=function(_0xb81b7b,_0x50ebad,_0x1a173b){var _0x4992d6={};var _0x15d9ae={};var _0x39c325;var _0x4acde5;return db[_0x64c9('0x2c')]['findOne']({'where':{'id':_0xb81b7b[_0x64c9('0x46')]['id']}})['then'](handleEntityNotFound(_0x50ebad,null))[_0x64c9('0x25')](function(_0x58fb7d){if(_0x58fb7d){_0x39c325=_0x58fb7d;_0x15d9ae[_0x64c9('0x31')]=_['keys'](db[_0x64c9('0x4e')][_0x64c9('0x2d')]);_0x15d9ae[_0x64c9('0x32')]=_[_0x64c9('0x47')](_0xb81b7b['query']);_0x15d9ae['filters']=_[_0x64c9('0x34')](_0x15d9ae[_0x64c9('0x31')],_0x15d9ae['query']);_0x4992d6['attributes']=_[_0x64c9('0x34')](_0x15d9ae[_0x64c9('0x31')],qs[_0x64c9('0x48')](_0xb81b7b['query'][_0x64c9('0x48')]));_0x4992d6[_0x64c9('0x35')]=_0x4992d6['attributes']['length']?_0x4992d6['attributes']:_0x15d9ae[_0x64c9('0x31')];_0x4992d6[_0x64c9('0x3b')]=qs['sort'](_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x3c')]);_0x4992d6[_0x64c9('0x3d')]=qs[_0x64c9('0x33')](_[_0x64c9('0x3e')](_0xb81b7b['query'],_0x15d9ae[_0x64c9('0x33')]));if(_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x3f')]){_0x4992d6[_0x64c9('0x3d')]=_[_0x64c9('0x41')](_0x4992d6[_0x64c9('0x3d')],{'$or':_[_0x64c9('0x2b')](_0x4992d6[_0x64c9('0x35')],function(_0x12cb02){var _0x19a858={};_0x19a858[_0x12cb02]={'$like':'%'+_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x3f')]+'%'};return _0x19a858;})});}_0x4992d6=_[_0x64c9('0x41')]({},_0x4992d6,_0xb81b7b[_0x64c9('0x4f')]);return _0x39c325[_0x64c9('0x52')](_0x4992d6);}})[_0x64c9('0x25')](function(_0x90aee9){if(_0x90aee9){_0x4acde5=_0x90aee9[_0x64c9('0x36')];if(!_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x37')](_0x64c9('0x38'))){_0x4992d6[_0x64c9('0x39')]=qs[_0x64c9('0x39')](_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x39')]);_0x4992d6['offset']=qs[_0x64c9('0x3a')](_0xb81b7b[_0x64c9('0x32')][_0x64c9('0x3a')]);}return _0x39c325[_0x64c9('0x52')](_0x4992d6);}})[_0x64c9('0x25')](function(_0x33dc33){if(_0x33dc33){return _0x33dc33?{'count':_0x4acde5,'rows':_0x33dc33}:null;}})[_0x64c9('0x25')](respondWithResult(_0x50ebad,null))['catch'](handleError(_0x50ebad,null));};exports[_0x64c9('0x53')]=function(_0x568f13,_0x3e4835,_0x268d1f){var _0x3fc703={};var _0x8373e9={};var _0x10d29a;var _0x5070f8;return db[_0x64c9('0x2c')]['findOne']({'where':{'id':_0x568f13[_0x64c9('0x46')]['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x3e4835,null))[_0x64c9('0x25')](function(_0x1f52cc){if(_0x1f52cc){_0x10d29a=_0x1f52cc;_0x8373e9[_0x64c9('0x31')]=_[_0x64c9('0x47')](db['Tag']['rawAttributes']);_0x8373e9[_0x64c9('0x32')]=_[_0x64c9('0x47')](_0x568f13['query']);_0x8373e9[_0x64c9('0x33')]=_[_0x64c9('0x34')](_0x8373e9['model'],_0x8373e9['query']);_0x3fc703['attributes']=_['intersection'](_0x8373e9['model'],qs['fields'](_0x568f13[_0x64c9('0x32')]['fields']));_0x3fc703['attributes']=_0x3fc703['attributes'][_0x64c9('0x36')]?_0x3fc703[_0x64c9('0x35')]:_0x8373e9[_0x64c9('0x31')];_0x3fc703[_0x64c9('0x3b')]=qs['sort'](_0x568f13[_0x64c9('0x32')]['sort']);_0x3fc703[_0x64c9('0x3d')]=qs[_0x64c9('0x33')](_['pick'](_0x568f13[_0x64c9('0x32')],_0x8373e9[_0x64c9('0x33')]));if(_0x568f13[_0x64c9('0x32')][_0x64c9('0x3f')]){_0x3fc703[_0x64c9('0x3d')]=_[_0x64c9('0x41')](_0x3fc703['where'],{'$or':_[_0x64c9('0x2b')](_0x3fc703[_0x64c9('0x35')],function(_0x98a683){var _0x2ba77d={};_0x2ba77d[_0x98a683]={'$like':'%'+_0x568f13[_0x64c9('0x32')][_0x64c9('0x3f')]+'%'};return _0x2ba77d;})});}_0x3fc703=_['merge']({},_0x3fc703,_0x568f13[_0x64c9('0x4f')]);return _0x10d29a['getTags'](_0x3fc703);}})[_0x64c9('0x25')](function(_0x1ea433){if(_0x1ea433){_0x5070f8=_0x1ea433[_0x64c9('0x36')];if(!_0x568f13[_0x64c9('0x32')][_0x64c9('0x37')](_0x64c9('0x38'))){_0x3fc703['limit']=qs[_0x64c9('0x39')](_0x568f13[_0x64c9('0x32')][_0x64c9('0x39')]);_0x3fc703[_0x64c9('0x3a')]=qs['offset'](_0x568f13[_0x64c9('0x32')][_0x64c9('0x3a')]);}return _0x10d29a[_0x64c9('0x53')](_0x3fc703);}})[_0x64c9('0x25')](function(_0x248679){if(_0x248679){return _0x248679?{'count':_0x5070f8,'rows':_0x248679}:null;}})[_0x64c9('0x25')](respondWithResult(_0x3e4835,null))[_0x64c9('0x4a')](handleError(_0x3e4835,null));};exports[_0x64c9('0x54')]=function(_0x9c090f,_0x2cb13f,_0x239e9d){if(_0x9c090f[_0x64c9('0x4b')]['id']){delete _0x9c090f[_0x64c9('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x64c9('0x51')]({'where':{'id':_0x9c090f[_0x64c9('0x46')]['id']}})[_0x64c9('0x25')](handleEntityNotFound(_0x2cb13f,null))['then'](function(_0x593d69){if(_0x593d69){return _0x593d69[_0x64c9('0x54')](_0x9c090f[_0x64c9('0x4b')][_0x64c9('0x55')]||[]);}return null;})['then'](respondWithResult(_0x2cb13f,null))[_0x64c9('0x4a')](handleError(_0x2cb13f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 732a42a..ff477f2 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 _0x93f6=['path','../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x44a270,_0x67c506){var _0x22491=function(_0x279d51){while(--_0x279d51){_0x44a270['push'](_0x44a270['shift']());}};_0x22491(++_0x67c506);}(_0x93f6,0xea));var _0x693f=function(_0x101624,_0x54ac82){_0x101624=_0x101624-0x0;var _0x25d274=_0x93f6[_0x101624];return _0x25d274;};'use strict';var _=require(_0x693f('0x0'));var util=require(_0x693f('0x1'));var logger=require(_0x693f('0x2'))(_0x693f('0x3'));var moment=require('moment');var BPromise=require(_0x693f('0x4'));var rp=require(_0x693f('0x5'));var fs=require('fs');var path=require(_0x693f('0x6'));var rimraf=require('rimraf');var config=require(_0x693f('0x7'));var attributes=require(_0x693f('0x8'));module['exports']=function(_0x94a74f,_0xd22c45){return _0x94a74f['define']('FreshdeskConfiguration',attributes,{'tableName':_0x693f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x707a=['request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x652f2d,_0x41dd79){var _0x3b30ad=function(_0x2da5aa){while(--_0x2da5aa){_0x652f2d['push'](_0x652f2d['shift']());}};_0x3b30ad(++_0x41dd79);}(_0x707a,0x1f3));var _0xa707=function(_0x1df0ef,_0x985b62){_0x1df0ef=_0x1df0ef-0x0;var _0x435c6d=_0x707a[_0x1df0ef];return _0x435c6d;};'use strict';var _=require(_0xa707('0x0'));var util=require(_0xa707('0x1'));var logger=require('../../config/logger')(_0xa707('0x2'));var moment=require(_0xa707('0x3'));var BPromise=require(_0xa707('0x4'));var rp=require(_0xa707('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa707('0x6'));var config=require(_0xa707('0x7'));var attributes=require(_0xa707('0x8'));module['exports']=function(_0x33ef13,_0x5e1b72){return _0x33ef13[_0xa707('0x9')](_0xa707('0xa'),attributes,{'tableName':_0xa707('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 7f425af..b04ddfe 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 _0x8129=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x4ce069,_0x16859c){var _0x567629=function(_0x99c59e){while(--_0x99c59e){_0x4ce069['push'](_0x4ce069['shift']());}};_0x567629(++_0x16859c);}(_0x8129,0x8b));var _0x9812=function(_0x4a1bd3,_0x2d2403){_0x4a1bd3=_0x4a1bd3-0x0;var _0xb19d82=_0x8129[_0x4a1bd3];return _0xb19d82;};'use strict';var _=require(_0x9812('0x0'));var util=require(_0x9812('0x1'));var moment=require(_0x9812('0x2'));var BPromise=require(_0x9812('0x3'));var rs=require(_0x9812('0x4'));var fs=require('fs');var Redis=require(_0x9812('0x5'));var db=require(_0x9812('0x6'))['db'];var utils=require(_0x9812('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9812('0x8'));var jayson=require(_0x9812('0x9'));var client=jayson[_0x9812('0xa')][_0x9812('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19ff19,_0x4224eb,_0x5ef457){return new BPromise(function(_0x2a4a3f,_0x3627b8){return client[_0x9812('0xc')](_0x19ff19,_0x5ef457)[_0x9812('0xd')](function(_0x4f286f){logger['info'](_0x9812('0xe'),_0x4224eb,_0x9812('0xf'));logger[_0x9812('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4224eb,_0x9812('0xf'),JSON[_0x9812('0x11')](_0x4f286f));if(_0x4f286f[_0x9812('0x12')]){if(_0x4f286f[_0x9812('0x12')][_0x9812('0x13')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4224eb,_0x4f286f['error'][_0x9812('0x14')]);return _0x3627b8(_0x4f286f[_0x9812('0x12')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4224eb,_0x4f286f[_0x9812('0x12')]['message']);return _0x2a4a3f(_0x4f286f[_0x9812('0x12')][_0x9812('0x14')]);}else{logger['info'](_0x9812('0xe'),_0x4224eb,_0x9812('0xf'));_0x2a4a3f(_0x4f286f['result']['message']);}})[_0x9812('0x15')](function(_0x3fc4bd){logger[_0x9812('0x12')](_0x9812('0xe'),_0x4224eb,_0x3fc4bd);_0x3627b8(_0x3fc4bd);});});} \ No newline at end of file +var _0xbb85=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4c0cf4,_0x15a8ff){var _0x554210=function(_0x456997){while(--_0x456997){_0x4c0cf4['push'](_0x4c0cf4['shift']());}};_0x554210(++_0x15a8ff);}(_0xbb85,0x9b));var _0x5bb8=function(_0x7b3cd0,_0x1fb8e0){_0x7b3cd0=_0x7b3cd0-0x0;var _0x5eda9a=_0xbb85[_0x7b3cd0];return _0x5eda9a;};'use strict';var _=require(_0x5bb8('0x0'));var util=require(_0x5bb8('0x1'));var moment=require(_0x5bb8('0x2'));var BPromise=require(_0x5bb8('0x3'));var rs=require(_0x5bb8('0x4'));var fs=require('fs');var Redis=require(_0x5bb8('0x5'));var db=require(_0x5bb8('0x6'))['db'];var utils=require(_0x5bb8('0x7'));var logger=require(_0x5bb8('0x8'))(_0x5bb8('0x9'));var config=require(_0x5bb8('0xa'));var jayson=require(_0x5bb8('0xb'));var client=jayson['client'][_0x5bb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd617ed,_0x56e35d,_0x18b82f){return new BPromise(function(_0x48fa77,_0x9ab058){return client['request'](_0xd617ed,_0x18b82f)['then'](function(_0x553db9){logger[_0x5bb8('0xd')](_0x5bb8('0xe'),_0x56e35d,_0x5bb8('0xf'));logger[_0x5bb8('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56e35d,_0x5bb8('0xf'),JSON[_0x5bb8('0x11')](_0x553db9));if(_0x553db9[_0x5bb8('0x12')]){if(_0x553db9[_0x5bb8('0x12')][_0x5bb8('0x13')]===0x1f4){logger[_0x5bb8('0x12')](_0x5bb8('0xe'),_0x56e35d,_0x553db9['error'][_0x5bb8('0x14')]);return _0x9ab058(_0x553db9[_0x5bb8('0x12')][_0x5bb8('0x14')]);}logger['error'](_0x5bb8('0xe'),_0x56e35d,_0x553db9[_0x5bb8('0x12')]['message']);return _0x48fa77(_0x553db9[_0x5bb8('0x12')][_0x5bb8('0x14')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x56e35d,'request\x20sent');_0x48fa77(_0x553db9['result']['message']);}})['catch'](function(_0x4f4b18){logger[_0x5bb8('0x12')](_0x5bb8('0xe'),_0x56e35d,_0x4f4b18);_0x9ab058(_0x4f4b18);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 67fe544..092023d 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 _0xac40=['connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','util','path'];(function(_0x5dd8a1,_0x277e7a){var _0x4bbd15=function(_0x324b73){while(--_0x324b73){_0x5dd8a1['push'](_0x5dd8a1['shift']());}};_0x4bbd15(++_0x277e7a);}(_0xac40,0x17e));var _0x0ac4=function(_0x57e7d0,_0x2b8e93){_0x57e7d0=_0x57e7d0-0x0;var _0x230535=_0xac40[_0x57e7d0];return _0x230535;};'use strict';var multer=require('multer');var util=require(_0x0ac4('0x0'));var path=require(_0x0ac4('0x1'));var timeout=require(_0x0ac4('0x2'));var express=require('express');var router=express[_0x0ac4('0x3')]();var fs_extra=require(_0x0ac4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ac4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x0ac4('0x6')]('/',auth['isAuthenticated'](),controller[_0x0ac4('0x7')]);router[_0x0ac4('0x6')](_0x0ac4('0x8'),auth[_0x0ac4('0x9')](),controller[_0x0ac4('0xa')]);router[_0x0ac4('0xb')]('/',auth[_0x0ac4('0x9')](),controller[_0x0ac4('0xc')]);router[_0x0ac4('0xd')](_0x0ac4('0x8'),auth[_0x0ac4('0x9')](),controller['update']);router[_0x0ac4('0xe')](_0x0ac4('0x8'),auth[_0x0ac4('0x9')](),controller['destroy']);module[_0x0ac4('0xf')]=router; \ No newline at end of file +var _0x90f9=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x4e6ce0,_0x5f1901){var _0x3181f2=function(_0x3fc8f3){while(--_0x3fc8f3){_0x4e6ce0['push'](_0x4e6ce0['shift']());}};_0x3181f2(++_0x5f1901);}(_0x90f9,0x117));var _0x990f=function(_0x2baa72,_0x35589c){_0x2baa72=_0x2baa72-0x0;var _0x4ef085=_0x90f9[_0x2baa72];return _0x4ef085;};'use strict';var multer=require(_0x990f('0x0'));var util=require('util');var path=require(_0x990f('0x1'));var timeout=require(_0x990f('0x2'));var express=require(_0x990f('0x3'));var router=express[_0x990f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x990f('0x5'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x990f('0x6')](_0x990f('0x7'),auth[_0x990f('0x8')](),controller[_0x990f('0x9')]);router[_0x990f('0xa')]('/',auth['isAuthenticated'](),controller[_0x990f('0xb')]);router[_0x990f('0xc')]('/:id',auth[_0x990f('0x8')](),controller[_0x990f('0xd')]);router[_0x990f('0xe')](_0x990f('0x7'),auth[_0x990f('0x8')](),controller[_0x990f('0xf')]);module[_0x990f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2d33125..6b1a116 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 _0xb9d8=['exports','ENUM','string','picklist','variable','STRING','BOOLEAN'];(function(_0x4c7c0d,_0x242781){var _0x6094d2=function(_0x55ea3b){while(--_0x55ea3b){_0x4c7c0d['push'](_0x4c7c0d['shift']());}};_0x6094d2(++_0x242781);}(_0xb9d8,0xd9));var _0x8b9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8b9d('0x0')]={'type':{'type':Sequelize[_0x8b9d('0x1')](_0x8b9d('0x2'),'variable','customVariable','keyValue',_0x8b9d('0x3')),'defaultValue':_0x8b9d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8b9d('0x2'),_0x8b9d('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x8b9d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8b9d('0x5')]},'customField':{'type':Sequelize[_0x8b9d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8b9d('0x5')]}}; \ No newline at end of file +var _0x48f8=['keyValue','picklist','STRING','sequelize','ENUM','string','customVariable'];(function(_0x4a5d0d,_0x4ddb19){var _0x35926d=function(_0x1ddbda){while(--_0x1ddbda){_0x4a5d0d['push'](_0x4a5d0d['shift']());}};_0x35926d(++_0x4ddb19);}(_0x48f8,0x1ed));var _0x848f=function(_0x5e8ad6,_0x13d864){_0x5e8ad6=_0x5e8ad6-0x0;var _0x19883f=_0x48f8[_0x5e8ad6];return _0x19883f;};'use strict';var Sequelize=require(_0x848f('0x0'));module['exports']={'type':{'type':Sequelize[_0x848f('0x1')](_0x848f('0x2'),'variable',_0x848f('0x3'),_0x848f('0x4'),_0x848f('0x5')),'defaultValue':_0x848f('0x2')},'content':{'type':Sequelize[_0x848f('0x6')]},'key':{'type':Sequelize[_0x848f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x848f('0x2'),'variable',_0x848f('0x3'))},'keyContent':{'type':Sequelize[_0x848f('0x6')]},'idField':{'type':Sequelize[_0x848f('0x6')]},'nameField':{'type':Sequelize[_0x848f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x848f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c1e50b4..0cbef31 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 _0x6b20=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x5ed20f,_0x432f43){var _0x2414b0=function(_0x365271){while(--_0x365271){_0x5ed20f['push'](_0x5ed20f['shift']());}};_0x2414b0(++_0x432f43);}(_0x6b20,0xd1));var _0x06b2=function(_0x2e9f14,_0x5b41bd){_0x2e9f14=_0x2e9f14-0x0;var _0x3ee6c4=_0x6b20[_0x2e9f14];return _0x3ee6c4;};'use strict';var emlformat=require(_0x06b2('0x0'));var rimraf=require(_0x06b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06b2('0x2'));var rp=require('request-promise');var moment=require(_0x06b2('0x3'));var BPromise=require(_0x06b2('0x4'));var Mustache=require(_0x06b2('0x5'));var util=require('util');var path=require(_0x06b2('0x6'));var sox=require(_0x06b2('0x7'));var csv=require(_0x06b2('0x8'));var ejs=require(_0x06b2('0x9'));var fs=require('fs');var fs_extra=require(_0x06b2('0xa'));var _=require(_0x06b2('0xb'));var squel=require(_0x06b2('0xc'));var crypto=require('crypto');var jsforce=require(_0x06b2('0xd'));var deskjs=require(_0x06b2('0xe'));var toCsv=require(_0x06b2('0x8'));var querystring=require('querystring');var Papa=require(_0x06b2('0xf'));var Redis=require('ioredis');var authService=require(_0x06b2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x06b2('0x11'));var logger=require(_0x06b2('0x12'))('api');var utils=require(_0x06b2('0x13'));var config=require(_0x06b2('0x14'));var licenseUtil=require(_0x06b2('0x15'));var db=require(_0x06b2('0x16'))['db'];function respondWithStatusCode(_0x44a9b4,_0x810a12){_0x810a12=_0x810a12||0xcc;return function(_0x3039c9){if(_0x3039c9){return _0x44a9b4[_0x06b2('0x17')](_0x810a12);}return _0x44a9b4[_0x06b2('0x18')](_0x810a12)[_0x06b2('0x19')]();};}function respondWithResult(_0xa81f11,_0x2822e9){_0x2822e9=_0x2822e9||0xc8;return function(_0x26faee){if(_0x26faee){return _0xa81f11['status'](_0x2822e9)[_0x06b2('0x1a')](_0x26faee);}};}function respondWithFilteredResult(_0xaee98c,_0x47496c){return function(_0x3830e9){if(_0x3830e9){var _0xef0466=typeof _0x47496c[_0x06b2('0x1b')]==='undefined'&&typeof _0x47496c[_0x06b2('0x1c')]===_0x06b2('0x1d');var _0x525945=_0x3830e9[_0x06b2('0x1e')];var _0x594b48=_0xef0466?0x0:_0x47496c['offset'];var _0x192270=_0xef0466?_0x3830e9[_0x06b2('0x1e')]:_0x47496c[_0x06b2('0x1b')]+_0x47496c[_0x06b2('0x1c')];var _0x4c4e21;if(_0x192270>=_0x525945){_0x192270=_0x525945;_0x4c4e21=0xc8;}else{_0x4c4e21=0xce;}_0xaee98c[_0x06b2('0x18')](_0x4c4e21);return _0xaee98c[_0x06b2('0x1f')](_0x06b2('0x20'),_0x594b48+'-'+_0x192270+'/'+_0x525945)[_0x06b2('0x1a')](_0x3830e9);}return null;};}function patchUpdates(_0xe28985){return function(_0x368ad8){try{jsonpatch[_0x06b2('0x21')](_0x368ad8,_0xe28985,!![]);}catch(_0x5ca622){return BPromise[_0x06b2('0x22')](_0x5ca622);}return _0x368ad8[_0x06b2('0x23')]();};}function saveUpdates(_0xb05f65,_0x208384){return function(_0x4e2a4c){if(_0x4e2a4c){return _0x4e2a4c['update'](_0xb05f65)[_0x06b2('0x24')](function(_0xb5231e){return _0xb5231e;});}return null;};}function removeEntity(_0x4fc95f,_0x39659f){return function(_0x5e40f2){if(_0x5e40f2){return _0x5e40f2[_0x06b2('0x25')]()[_0x06b2('0x24')](function(){_0x4fc95f[_0x06b2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4382ce,_0x306ce){return function(_0xc65820){if(!_0xc65820){_0x4382ce[_0x06b2('0x17')](0x194);}return _0xc65820;};}function handleError(_0x1173fc,_0x4f5e90){_0x4f5e90=_0x4f5e90||0x1f4;return function(_0xbb00ea){logger[_0x06b2('0x26')](_0xbb00ea[_0x06b2('0x27')]);if(_0xbb00ea[_0x06b2('0x28')]){delete _0xbb00ea[_0x06b2('0x28')];}_0x1173fc[_0x06b2('0x18')](_0x4f5e90)['send'](_0xbb00ea);};}exports[_0x06b2('0x29')]=function(_0x2a3228,_0x2720fa){var _0x13c0eb={},_0x1f02d8={},_0x1bfaa9={'count':0x0,'rows':[]};var _0x3668bb=_['map'](db[_0x06b2('0x2a')][_0x06b2('0x2b')],function(_0x1637c2){return{'name':_0x1637c2[_0x06b2('0x2c')],'type':_0x1637c2[_0x06b2('0x2d')][_0x06b2('0x2e')]};});_0x1f02d8[_0x06b2('0x2f')]=_[_0x06b2('0x30')](_0x3668bb,'name');_0x1f02d8[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2a3228[_0x06b2('0x31')]);_0x1f02d8[_0x06b2('0x33')]=_[_0x06b2('0x34')](_0x1f02d8[_0x06b2('0x2f')],_0x1f02d8[_0x06b2('0x31')]);_0x13c0eb['attributes']=_['intersection'](_0x1f02d8[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2a3228[_0x06b2('0x31')]['fields']));_0x13c0eb[_0x06b2('0x36')]=_0x13c0eb[_0x06b2('0x36')][_0x06b2('0x37')]?_0x13c0eb[_0x06b2('0x36')]:_0x1f02d8[_0x06b2('0x2f')];if(!_0x2a3228[_0x06b2('0x31')]['hasOwnProperty'](_0x06b2('0x38'))){_0x13c0eb[_0x06b2('0x1c')]=qs[_0x06b2('0x1c')](_0x2a3228['query'][_0x06b2('0x1c')]);_0x13c0eb[_0x06b2('0x1b')]=qs['offset'](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x1b')]);}_0x13c0eb[_0x06b2('0x39')]=qs[_0x06b2('0x3a')](_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3a')]);_0x13c0eb[_0x06b2('0x3b')]=qs[_0x06b2('0x33')](_[_0x06b2('0x3c')](_0x2a3228[_0x06b2('0x31')],_0x1f02d8[_0x06b2('0x33')]),_0x3668bb);if(_0x2a3228[_0x06b2('0x31')]['filter']){_0x13c0eb[_0x06b2('0x3b')]=_['merge'](_0x13c0eb['where'],{'$or':_[_0x06b2('0x30')](_0x3668bb,function(_0x4e92e0){if(_0x4e92e0[_0x06b2('0x2d')]!=='VIRTUAL'){var _0x35e29c={};_0x35e29c[_0x4e92e0[_0x06b2('0x28')]]={'$like':'%'+_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3d')]+'%'};return _0x35e29c;}})});}_0x13c0eb=_[_0x06b2('0x3e')]({},_0x13c0eb,_0x2a3228['options']);var _0x404eab={'where':_0x13c0eb[_0x06b2('0x3b')]};return db[_0x06b2('0x2a')][_0x06b2('0x1e')](_0x404eab)[_0x06b2('0x24')](function(_0x39fd60){_0x1bfaa9['count']=_0x39fd60;if(_0x2a3228[_0x06b2('0x31')][_0x06b2('0x3f')]){_0x13c0eb['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x06b2('0x40')](_0x13c0eb);})[_0x06b2('0x24')](function(_0x286c9b){_0x1bfaa9[_0x06b2('0x41')]=_0x286c9b;return _0x1bfaa9;})[_0x06b2('0x24')](respondWithFilteredResult(_0x2720fa,_0x13c0eb))[_0x06b2('0x42')](handleError(_0x2720fa,null));};exports[_0x06b2('0x43')]=function(_0x2ff968,_0x2e2a80){var _0x117bf4={'raw':!![],'where':{'id':_0x2ff968[_0x06b2('0x44')]['id']}},_0x1d7750={};_0x1d7750[_0x06b2('0x2f')]=_[_0x06b2('0x32')](db[_0x06b2('0x2a')][_0x06b2('0x2b')]);_0x1d7750[_0x06b2('0x31')]=_[_0x06b2('0x32')](_0x2ff968[_0x06b2('0x31')]);_0x1d7750['filters']=_[_0x06b2('0x34')](_0x1d7750[_0x06b2('0x2f')],_0x1d7750[_0x06b2('0x31')]);_0x117bf4[_0x06b2('0x36')]=_['intersection'](_0x1d7750[_0x06b2('0x2f')],qs[_0x06b2('0x35')](_0x2ff968['query'][_0x06b2('0x35')]));_0x117bf4[_0x06b2('0x36')]=_0x117bf4['attributes'][_0x06b2('0x37')]?_0x117bf4[_0x06b2('0x36')]:_0x1d7750['model'];if(_0x2ff968['query']['includeAll']){_0x117bf4[_0x06b2('0x45')]=[{'all':!![]}];}_0x117bf4=_[_0x06b2('0x3e')]({},_0x117bf4,_0x2ff968[_0x06b2('0x46')]);return db[_0x06b2('0x2a')][_0x06b2('0x47')](_0x117bf4)['then'](handleEntityNotFound(_0x2e2a80,null))['then'](respondWithResult(_0x2e2a80,null))[_0x06b2('0x42')](handleError(_0x2e2a80,null));};exports[_0x06b2('0x48')]=function(_0x979759,_0x1f4d89){return db[_0x06b2('0x2a')][_0x06b2('0x48')](_0x979759['body'],{})[_0x06b2('0x24')](respondWithResult(_0x1f4d89,0xc9))[_0x06b2('0x42')](handleError(_0x1f4d89,null));};exports[_0x06b2('0x49')]=function(_0x33f72e,_0x146c5c){if(_0x33f72e[_0x06b2('0x4a')]['id']){delete _0x33f72e['body']['id'];}return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x33f72e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x146c5c,null))['then'](saveUpdates(_0x33f72e[_0x06b2('0x4a')],null))[_0x06b2('0x24')](respondWithResult(_0x146c5c,null))[_0x06b2('0x42')](handleError(_0x146c5c,null));};exports[_0x06b2('0x25')]=function(_0x546c9e,_0x346f04){return db[_0x06b2('0x2a')][_0x06b2('0x47')]({'where':{'id':_0x546c9e[_0x06b2('0x44')]['id']}})[_0x06b2('0x24')](handleEntityNotFound(_0x346f04,null))[_0x06b2('0x24')](removeEntity(_0x346f04,null))[_0x06b2('0x42')](handleError(_0x346f04,null));}; \ No newline at end of file +var _0x55ea=['sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x55ea,0xc9));var _0xa55e=function(_0x90d462,_0x319805){_0x90d462=_0x90d462-0x0;var _0x2162ab=_0x55ea[_0x90d462];return _0x2162ab;};'use strict';var emlformat=require(_0xa55e('0x0'));var rimraf=require(_0xa55e('0x1'));var zipdir=require(_0xa55e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa55e('0x3'));var moment=require(_0xa55e('0x4'));var BPromise=require(_0xa55e('0x5'));var Mustache=require(_0xa55e('0x6'));var util=require(_0xa55e('0x7'));var path=require('path');var sox=require(_0xa55e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa55e('0x9'));var crypto=require(_0xa55e('0xa'));var jsforce=require(_0xa55e('0xb'));var deskjs=require(_0xa55e('0xc'));var toCsv=require(_0xa55e('0xd'));var querystring=require(_0xa55e('0xe'));var Papa=require(_0xa55e('0xf'));var Redis=require(_0xa55e('0x10'));var authService=require(_0xa55e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa55e('0x12'));var logger=require(_0xa55e('0x13'))(_0xa55e('0x14'));var utils=require(_0xa55e('0x15'));var config=require(_0xa55e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa55e('0x17'))['db'];function respondWithStatusCode(_0x5b69cc,_0x3f5178){_0x3f5178=_0x3f5178||0xcc;return function(_0x1d45c1){if(_0x1d45c1){return _0x5b69cc[_0xa55e('0x18')](_0x3f5178);}return _0x5b69cc[_0xa55e('0x19')](_0x3f5178)[_0xa55e('0x1a')]();};}function respondWithResult(_0x20e138,_0x15a283){_0x15a283=_0x15a283||0xc8;return function(_0x27746c){if(_0x27746c){return _0x20e138[_0xa55e('0x19')](_0x15a283)['json'](_0x27746c);}};}function respondWithFilteredResult(_0x1fcee6,_0x30738d){return function(_0x25fa30){if(_0x25fa30){var _0x12895e=typeof _0x30738d[_0xa55e('0x1b')]===_0xa55e('0x1c')&&typeof _0x30738d['limit']===_0xa55e('0x1c');var _0x5dbfe6=_0x25fa30['count'];var _0x4599b9=_0x12895e?0x0:_0x30738d[_0xa55e('0x1b')];var _0x30854e=_0x12895e?_0x25fa30[_0xa55e('0x1d')]:_0x30738d[_0xa55e('0x1b')]+_0x30738d['limit'];var _0x42d2d0;if(_0x30854e>=_0x5dbfe6){_0x30854e=_0x5dbfe6;_0x42d2d0=0xc8;}else{_0x42d2d0=0xce;}_0x1fcee6['status'](_0x42d2d0);return _0x1fcee6['set'](_0xa55e('0x1e'),_0x4599b9+'-'+_0x30854e+'/'+_0x5dbfe6)[_0xa55e('0x1f')](_0x25fa30);}return null;};}function patchUpdates(_0x262f6c){return function(_0x1033c0){try{jsonpatch[_0xa55e('0x20')](_0x1033c0,_0x262f6c,!![]);}catch(_0x438707){return BPromise[_0xa55e('0x21')](_0x438707);}return _0x1033c0[_0xa55e('0x22')]();};}function saveUpdates(_0x9594a3,_0x5b0e74){return function(_0x53a2f9){if(_0x53a2f9){return _0x53a2f9[_0xa55e('0x23')](_0x9594a3)['then'](function(_0xaaf2f1){return _0xaaf2f1;});}return null;};}function removeEntity(_0x31c4ac,_0x801fec){return function(_0x2842a6){if(_0x2842a6){return _0x2842a6[_0xa55e('0x24')]()[_0xa55e('0x25')](function(){_0x31c4ac[_0xa55e('0x19')](0xcc)[_0xa55e('0x1a')]();});}};}function handleEntityNotFound(_0x231333,_0x3627e8){return function(_0x3c519d){if(!_0x3c519d){_0x231333[_0xa55e('0x18')](0x194);}return _0x3c519d;};}function handleError(_0xa05c41,_0x25142c){_0x25142c=_0x25142c||0x1f4;return function(_0xa57293){logger[_0xa55e('0x26')](_0xa57293[_0xa55e('0x27')]);if(_0xa57293[_0xa55e('0x28')]){delete _0xa57293[_0xa55e('0x28')];}_0xa05c41['status'](_0x25142c)['send'](_0xa57293);};}exports[_0xa55e('0x29')]=function(_0x4ebcbd,_0x286f95){var _0x58fc30={},_0x2fe4e9={},_0x4d9634={'count':0x0,'rows':[]};var _0x2758ca=_['map'](db[_0xa55e('0x2a')][_0xa55e('0x2b')],function(_0x4a03ef){return{'name':_0x4a03ef[_0xa55e('0x2c')],'type':_0x4a03ef[_0xa55e('0x2d')][_0xa55e('0x2e')]};});_0x2fe4e9[_0xa55e('0x2f')]=_['map'](_0x2758ca,_0xa55e('0x28'));_0x2fe4e9[_0xa55e('0x30')]=_['keys'](_0x4ebcbd[_0xa55e('0x30')]);_0x2fe4e9[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x2fe4e9[_0xa55e('0x2f')],_0x2fe4e9['query']);_0x58fc30[_0xa55e('0x33')]=_['intersection'](_0x2fe4e9[_0xa55e('0x2f')],qs['fields'](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x34')]));_0x58fc30[_0xa55e('0x33')]=_0x58fc30[_0xa55e('0x33')]['length']?_0x58fc30[_0xa55e('0x33')]:_0x2fe4e9['model'];if(!_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x35')](_0xa55e('0x36'))){_0x58fc30['limit']=qs[_0xa55e('0x37')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x37')]);_0x58fc30[_0xa55e('0x1b')]=qs[_0xa55e('0x1b')](_0x4ebcbd[_0xa55e('0x30')]['offset']);}_0x58fc30['order']=qs[_0xa55e('0x38')](_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x38')]);_0x58fc30[_0xa55e('0x39')]=qs[_0xa55e('0x31')](_[_0xa55e('0x3a')](_0x4ebcbd[_0xa55e('0x30')],_0x2fe4e9['filters']),_0x2758ca);if(_0x4ebcbd['query'][_0xa55e('0x3b')]){_0x58fc30[_0xa55e('0x39')]=_[_0xa55e('0x3c')](_0x58fc30[_0xa55e('0x39')],{'$or':_[_0xa55e('0x3d')](_0x2758ca,function(_0x41444d){if(_0x41444d[_0xa55e('0x2d')]!==_0xa55e('0x3e')){var _0x29e0c2={};_0x29e0c2[_0x41444d[_0xa55e('0x28')]]={'$like':'%'+_0x4ebcbd[_0xa55e('0x30')]['filter']+'%'};return _0x29e0c2;}})});}_0x58fc30=_[_0xa55e('0x3c')]({},_0x58fc30,_0x4ebcbd[_0xa55e('0x3f')]);var _0x2982db={'where':_0x58fc30['where']};return db[_0xa55e('0x2a')]['count'](_0x2982db)[_0xa55e('0x25')](function(_0x4e97de){_0x4d9634[_0xa55e('0x1d')]=_0x4e97de;if(_0x4ebcbd[_0xa55e('0x30')][_0xa55e('0x40')]){_0x58fc30[_0xa55e('0x41')]=[{'all':!![]}];}return db[_0xa55e('0x2a')]['findAll'](_0x58fc30);})['then'](function(_0x3d9fe9){_0x4d9634[_0xa55e('0x42')]=_0x3d9fe9;return _0x4d9634;})[_0xa55e('0x25')](respondWithFilteredResult(_0x286f95,_0x58fc30))['catch'](handleError(_0x286f95,null));};exports[_0xa55e('0x43')]=function(_0x2d4d27,_0x1c7d18){var _0xb43d62={'raw':!![],'where':{'id':_0x2d4d27[_0xa55e('0x44')]['id']}},_0x43c887={};_0x43c887[_0xa55e('0x2f')]=_[_0xa55e('0x45')](db['FreshdeskField']['rawAttributes']);_0x43c887[_0xa55e('0x30')]=_[_0xa55e('0x45')](_0x2d4d27[_0xa55e('0x30')]);_0x43c887[_0xa55e('0x31')]=_[_0xa55e('0x32')](_0x43c887[_0xa55e('0x2f')],_0x43c887[_0xa55e('0x30')]);_0xb43d62[_0xa55e('0x33')]=_['intersection'](_0x43c887['model'],qs[_0xa55e('0x34')](_0x2d4d27['query'][_0xa55e('0x34')]));_0xb43d62['attributes']=_0xb43d62['attributes'][_0xa55e('0x46')]?_0xb43d62[_0xa55e('0x33')]:_0x43c887['model'];if(_0x2d4d27['query'][_0xa55e('0x40')]){_0xb43d62[_0xa55e('0x41')]=[{'all':!![]}];}_0xb43d62=_[_0xa55e('0x3c')]({},_0xb43d62,_0x2d4d27[_0xa55e('0x3f')]);return db[_0xa55e('0x2a')][_0xa55e('0x47')](_0xb43d62)['then'](handleEntityNotFound(_0x1c7d18,null))['then'](respondWithResult(_0x1c7d18,null))[_0xa55e('0x48')](handleError(_0x1c7d18,null));};exports[_0xa55e('0x49')]=function(_0x31458d,_0x259cb3){return db[_0xa55e('0x2a')][_0xa55e('0x49')](_0x31458d['body'],{})[_0xa55e('0x25')](respondWithResult(_0x259cb3,0xc9))[_0xa55e('0x48')](handleError(_0x259cb3,null));};exports[_0xa55e('0x23')]=function(_0x1de3a8,_0x338018){if(_0x1de3a8[_0xa55e('0x4a')]['id']){delete _0x1de3a8['body']['id'];}return db['FreshdeskField'][_0xa55e('0x47')]({'where':{'id':_0x1de3a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x338018,null))['then'](saveUpdates(_0x1de3a8[_0xa55e('0x4a')],null))[_0xa55e('0x25')](respondWithResult(_0x338018,null))[_0xa55e('0x48')](handleError(_0x338018,null));};exports[_0xa55e('0x24')]=function(_0x2c35a8,_0x63aa32){return db[_0xa55e('0x2a')][_0xa55e('0x47')]({'where':{'id':_0x2c35a8['params']['id']}})[_0xa55e('0x25')](handleEntityNotFound(_0x63aa32,null))[_0xa55e('0x25')](removeEntity(_0x63aa32,null))[_0xa55e('0x48')](handleError(_0x63aa32,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b7ae608..697398e 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 _0x3a60=['api','moment','request-promise','rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x5b37c7,_0x5cf44f){var _0x489c08=function(_0x5bf164){while(--_0x5bf164){_0x5b37c7['push'](_0x5b37c7['shift']());}};_0x489c08(++_0x5cf44f);}(_0x3a60,0x135));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x03a6('0x0'));var util=require(_0x03a6('0x1'));var logger=require(_0x03a6('0x2'))(_0x03a6('0x3'));var moment=require(_0x03a6('0x4'));var BPromise=require('bluebird');var rp=require(_0x03a6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03a6('0x6'));var config=require('../../config/environment');var attributes=require(_0x03a6('0x7'));module[_0x03a6('0x8')]=function(_0x441249,_0x5a4e2d){return _0x441249[_0x03a6('0x9')]('FreshdeskField',attributes,{'tableName':_0x03a6('0xa'),'paranoid':![],'indexes':[{'name':_0x03a6('0xb'),'fields':['idField',_0x03a6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9be=['idField','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0x24163b,_0x497914){var _0x5b8c9a=function(_0x13d7dd){while(--_0x13d7dd){_0x24163b['push'](_0x24163b['shift']());}};_0x5b8c9a(++_0x497914);}(_0xa9be,0x1eb));var _0xea9b=function(_0x571d8b,_0x2c7db9){_0x571d8b=_0x571d8b-0x0;var _0x203909=_0xa9be[_0x571d8b];return _0x203909;};'use strict';var _=require(_0xea9b('0x0'));var util=require(_0xea9b('0x1'));var logger=require(_0xea9b('0x2'))(_0xea9b('0x3'));var moment=require(_0xea9b('0x4'));var BPromise=require(_0xea9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea9b('0x6'));var rimraf=require(_0xea9b('0x7'));var config=require(_0xea9b('0x8'));var attributes=require(_0xea9b('0x9'));module[_0xea9b('0xa')]=function(_0x4420c9,_0xd2d008){return _0x4420c9['define'](_0xea9b('0xb'),attributes,{'tableName':_0xea9b('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xea9b('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 938e805..0010bf6 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 _0x1872=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x2cde74,_0x55cf68){var _0x39ee49=function(_0x1e312e){while(--_0x1e312e){_0x2cde74['push'](_0x2cde74['shift']());}};_0x39ee49(++_0x55cf68);}(_0x1872,0x103));var _0x2187=function(_0x501d0f,_0x4adf25){_0x501d0f=_0x501d0f-0x0;var _0x50cea4=_0x1872[_0x501d0f];return _0x50cea4;};'use strict';var _=require('lodash');var util=require(_0x2187('0x0'));var moment=require(_0x2187('0x1'));var BPromise=require(_0x2187('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2187('0x3'));var db=require(_0x2187('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2187('0x5'));var jayson=require(_0x2187('0x6'));var client=jayson[_0x2187('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x440a29,_0x19fb3d,_0x595dbd){return new BPromise(function(_0x13fe84,_0x1a4039){return client[_0x2187('0x8')](_0x440a29,_0x595dbd)[_0x2187('0x9')](function(_0xc93de1){logger[_0x2187('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x19fb3d,'request\x20sent');logger[_0x2187('0xb')](_0x2187('0xc'),_0x19fb3d,'request\x20sent',JSON[_0x2187('0xd')](_0xc93de1));if(_0xc93de1['error']){if(_0xc93de1[_0x2187('0xe')][_0x2187('0xf')]===0x1f4){logger[_0x2187('0xe')](_0x2187('0x10'),_0x19fb3d,_0xc93de1[_0x2187('0xe')][_0x2187('0x11')]);return _0x1a4039(_0xc93de1[_0x2187('0xe')]['message']);}logger[_0x2187('0xe')](_0x2187('0x10'),_0x19fb3d,_0xc93de1[_0x2187('0xe')][_0x2187('0x11')]);return _0x13fe84(_0xc93de1[_0x2187('0xe')][_0x2187('0x11')]);}else{logger[_0x2187('0xa')](_0x2187('0x10'),_0x19fb3d,'request\x20sent');_0x13fe84(_0xc93de1['result'][_0x2187('0x11')]);}})['catch'](function(_0x25ae89){logger[_0x2187('0xe')](_0x2187('0x10'),_0x19fb3d,_0x25ae89);_0x1a4039(_0x25ae89);});});} \ No newline at end of file +var _0xfe98=['randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','catch','moment','bluebird'];(function(_0x428bfd,_0x13418d){var _0x385e66=function(_0x2a49b1){while(--_0x2a49b1){_0x428bfd['push'](_0x428bfd['shift']());}};_0x385e66(++_0x13418d);}(_0xfe98,0x12e));var _0x8fe9=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0xfe98[_0x11deef];return _0xe9ba85;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fe9('0x0'));var BPromise=require(_0x8fe9('0x1'));var rs=require(_0x8fe9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fe9('0x3'))['db'];var utils=require(_0x8fe9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fe9('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8fe9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x19d4d2,_0x18fbd3,_0x27f6f1){return new BPromise(function(_0x27adc2,_0x227da4){return client[_0x8fe9('0x7')](_0x19d4d2,_0x27f6f1)[_0x8fe9('0x8')](function(_0xd39951){logger[_0x8fe9('0x9')](_0x8fe9('0xa'),_0x18fbd3,_0x8fe9('0xb'));logger['debug'](_0x8fe9('0xc'),_0x18fbd3,'request\x20sent',JSON['stringify'](_0xd39951));if(_0xd39951[_0x8fe9('0xd')]){if(_0xd39951[_0x8fe9('0xd')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x18fbd3,_0xd39951[_0x8fe9('0xd')]['message']);return _0x227da4(_0xd39951[_0x8fe9('0xd')][_0x8fe9('0xe')]);}logger[_0x8fe9('0xd')](_0x8fe9('0xa'),_0x18fbd3,_0xd39951[_0x8fe9('0xd')]['message']);return _0x27adc2(_0xd39951[_0x8fe9('0xd')]['message']);}else{logger[_0x8fe9('0x9')]('FreshdeskField,\x20%s,\x20%s',_0x18fbd3,_0x8fe9('0xb'));_0x27adc2(_0xd39951['result'][_0x8fe9('0xe')]);}})[_0x8fe9('0xf')](function(_0x11c1f3){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x18fbd3,_0x11c1f3);_0x227da4(_0x11c1f3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ef66868..c4e59f3 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 _0xd4f4=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update'];(function(_0x3a1ea2,_0x24431c){var _0x5eca01=function(_0x41b508){while(--_0x41b508){_0x3a1ea2['push'](_0x3a1ea2['shift']());}};_0x5eca01(++_0x24431c);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1d1ff5,_0x203bcf){_0x1d1ff5=_0x1d1ff5-0x0;var _0x4302ee=_0xd4f4[_0x1d1ff5];return _0x4302ee;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var fs_extra=require(_0x4d4f('0x6'));var auth=require(_0x4d4f('0x7'));var interaction=require(_0x4d4f('0x8'));var config=require(_0x4d4f('0x9'));var controller=require(_0x4d4f('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4d4f('0xb')](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0xe')]);router[_0x4d4f('0xb')](_0x4d4f('0xf'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x10')]);router[_0x4d4f('0xb')](_0x4d4f('0x11'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x12')]);router[_0x4d4f('0x13')]('/',auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x14')]);router[_0x4d4f('0x13')](_0x4d4f('0xf'),auth[_0x4d4f('0xd')](),controller['addConfiguration']);router['put']('/:id',auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x15')]);router['delete'](_0x4d4f('0xc'),auth[_0x4d4f('0xd')](),controller[_0x4d4f('0x16')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['/:id/fields','getFields','post','create','addConfiguration','update','delete','exports','util','path','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x218681,_0x16971b){var _0x56c5de=function(_0x34b75a){while(--_0x34b75a){_0x218681['push'](_0x218681['shift']());}};_0x56c5de(++_0x16971b);}(_0xda3f,0xec));var _0xfda3=function(_0x303879,_0x4f117b){_0x303879=_0x303879-0x0;var _0xb73dc6=_0xda3f[_0x303879];return _0xb73dc6;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')]('/',auth['isAuthenticated'](),controller[_0xfda3('0xe')]);router[_0xfda3('0xd')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xf')]);router['put'](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfda3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index bfe66f3..0f12d76 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 _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0x2d892b,_0x2ddab2){var _0x3f84c0=function(_0x3a775a){while(--_0x3a775a){_0x2d892b['push'](_0x2d892b['shift']());}};_0x3f84c0(++_0x2ddab2);}(_0x236c,0x155));var _0xc236=function(_0x2ddebf,_0x5a1b45){_0x2ddebf=_0x2ddebf-0x0;var _0x18714f=_0x236c[_0x2ddebf];return _0x18714f;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3de3=['username','remoteUri','sequelize','STRING'];(function(_0x13ac10,_0x46e79e){var _0x28eda2=function(_0x169ef0){while(--_0x169ef0){_0x13ac10['push'](_0x13ac10['shift']());}};_0x28eda2(++_0x46e79e);}(_0x3de3,0x1ce));var _0x33de=function(_0x4d2bf8,_0x500e7a){_0x4d2bf8=_0x4d2bf8-0x0;var _0x14787e=_0x3de3[_0x4d2bf8];return _0x14787e;};'use strict';var Sequelize=require(_0x33de('0x0'));module['exports']={'name':{'type':Sequelize[_0x33de('0x1')]},'description':{'type':Sequelize[_0x33de('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x33de('0x2')},'apiKey':{'type':Sequelize[_0x33de('0x1')]},'remoteUri':{'type':Sequelize[_0x33de('0x1')],'unique':_0x33de('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 60c5247..de775d8 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 _0x4e63=['where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','/api/selector/owners','Token\x20token=','email','stringify','test','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter'];(function(_0x1545ed,_0x578045){var _0x4b8ced=function(_0x38d4fd){while(--_0x38d4fd){_0x1545ed['push'](_0x1545ed['shift']());}};_0x4b8ced(++_0x578045);}(_0x4e63,0x1c7));var _0x34e6=function(_0xabc4bb,_0x27b703){_0xabc4bb=_0xabc4bb-0x0;var _0x3e5a9e=_0x4e63[_0xabc4bb];return _0x3e5a9e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34e6('0x0'));var zipdir=require(_0x34e6('0x1'));var jsonpatch=require(_0x34e6('0x2'));var rp=require(_0x34e6('0x3'));var moment=require(_0x34e6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x34e6('0x5'));var path=require(_0x34e6('0x6'));var sox=require(_0x34e6('0x7'));var csv=require(_0x34e6('0x8'));var ejs=require(_0x34e6('0x9'));var fs=require('fs');var fs_extra=require(_0x34e6('0xa'));var _=require(_0x34e6('0xb'));var squel=require(_0x34e6('0xc'));var crypto=require('crypto');var jsforce=require(_0x34e6('0xd'));var deskjs=require(_0x34e6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x34e6('0xf'));var Papa=require(_0x34e6('0x10'));var Redis=require(_0x34e6('0x11'));var authService=require(_0x34e6('0x12'));var qs=require(_0x34e6('0x13'));var as=require(_0x34e6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x34e6('0x15'));var utils=require(_0x34e6('0x16'));var config=require(_0x34e6('0x17'));var licenseUtil=require(_0x34e6('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x34e6('0x19'));function respondWithStatusCode(_0x2ac67f,_0x5082df){_0x5082df=_0x5082df||0xcc;return function(_0x2819ce){if(_0x2819ce){return _0x2ac67f[_0x34e6('0x1a')](_0x5082df);}return _0x2ac67f[_0x34e6('0x1b')](_0x5082df)[_0x34e6('0x1c')]();};}function respondWithResult(_0x5c47b2,_0x27e89a){_0x27e89a=_0x27e89a||0xc8;return function(_0x17ed28){if(_0x17ed28){return _0x5c47b2[_0x34e6('0x1b')](_0x27e89a)[_0x34e6('0x1d')](_0x17ed28);}};}function respondWithFilteredResult(_0x1df1c8,_0x210a04){return function(_0x4a02e8){if(_0x4a02e8){var _0x41fb95=typeof _0x210a04[_0x34e6('0x1e')]===_0x34e6('0x1f')&&typeof _0x210a04[_0x34e6('0x20')]===_0x34e6('0x1f');var _0x47fdbc=_0x4a02e8['count'];var _0x468935=_0x41fb95?0x0:_0x210a04[_0x34e6('0x1e')];var _0x59c6a9=_0x41fb95?_0x4a02e8[_0x34e6('0x21')]:_0x210a04[_0x34e6('0x1e')]+_0x210a04[_0x34e6('0x20')];var _0x3b7a9b;if(_0x59c6a9>=_0x47fdbc){_0x59c6a9=_0x47fdbc;_0x3b7a9b=0xc8;}else{_0x3b7a9b=0xce;}_0x1df1c8[_0x34e6('0x1b')](_0x3b7a9b);return _0x1df1c8[_0x34e6('0x22')](_0x34e6('0x23'),_0x468935+'-'+_0x59c6a9+'/'+_0x47fdbc)[_0x34e6('0x1d')](_0x4a02e8);}return null;};}function patchUpdates(_0x331195){return function(_0x555f30){try{jsonpatch[_0x34e6('0x24')](_0x555f30,_0x331195,!![]);}catch(_0x2fbbae){return BPromise[_0x34e6('0x25')](_0x2fbbae);}return _0x555f30['save']();};}function saveUpdates(_0x3cc8ce,_0x33a93c){return function(_0x24da47){if(_0x24da47){return _0x24da47['update'](_0x3cc8ce)[_0x34e6('0x26')](function(_0x2718bb){return _0x2718bb;});}return null;};}function removeEntity(_0xce8be4,_0x2b7ef6){return function(_0x395f50){if(_0x395f50){return _0x395f50[_0x34e6('0x27')]()[_0x34e6('0x26')](function(){_0xce8be4[_0x34e6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23bbf2,_0x2a00ce){return function(_0x547d52){if(!_0x547d52){_0x23bbf2['sendStatus'](0x194);}return _0x547d52;};}function handleError(_0xa4f5a7,_0x5705f8){_0x5705f8=_0x5705f8||0x1f4;return function(_0x534415){logger[_0x34e6('0x28')](_0x534415[_0x34e6('0x29')]);if(_0x534415[_0x34e6('0x2a')]){delete _0x534415[_0x34e6('0x2a')];}_0xa4f5a7[_0x34e6('0x1b')](_0x5705f8)[_0x34e6('0x2b')](_0x534415);};}exports[_0x34e6('0x2c')]=function(_0x4b6e02,_0x3ffd6c){var _0x154b66={},_0x5488aa={},_0x2c5d47={'count':0x0,'rows':[]};var _0x4eccfb=_[_0x34e6('0x2d')](db[_0x34e6('0x2e')][_0x34e6('0x2f')],function(_0x1e1d42){return{'name':_0x1e1d42[_0x34e6('0x30')],'type':_0x1e1d42[_0x34e6('0x31')][_0x34e6('0x32')]};});_0x5488aa[_0x34e6('0x33')]=_[_0x34e6('0x2d')](_0x4eccfb,'name');_0x5488aa[_0x34e6('0x34')]=_[_0x34e6('0x35')](_0x4b6e02['query']);_0x5488aa['filters']=_[_0x34e6('0x36')](_0x5488aa[_0x34e6('0x33')],_0x5488aa[_0x34e6('0x34')]);_0x154b66[_0x34e6('0x37')]=_[_0x34e6('0x36')](_0x5488aa[_0x34e6('0x33')],qs['fields'](_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x38')]));_0x154b66[_0x34e6('0x37')]=_0x154b66['attributes'][_0x34e6('0x39')]?_0x154b66['attributes']:_0x5488aa[_0x34e6('0x33')];if(!_0x4b6e02['query'][_0x34e6('0x3a')](_0x34e6('0x3b'))){_0x154b66['limit']=qs['limit'](_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x20')]);_0x154b66[_0x34e6('0x1e')]=qs[_0x34e6('0x1e')](_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x1e')]);}_0x154b66[_0x34e6('0x3c')]=qs['sort'](_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x3d')]);_0x154b66['where']=qs['filters'](_[_0x34e6('0x3e')](_0x4b6e02[_0x34e6('0x34')],_0x5488aa[_0x34e6('0x3f')]),_0x4eccfb);if(_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x40')]){_0x154b66[_0x34e6('0x41')]=_[_0x34e6('0x42')](_0x154b66[_0x34e6('0x41')],{'$or':_[_0x34e6('0x2d')](_0x4eccfb,function(_0x36bb6d){if(_0x36bb6d[_0x34e6('0x31')]!==_0x34e6('0x43')){var _0x3ee10c={};_0x3ee10c[_0x36bb6d[_0x34e6('0x2a')]]={'$like':'%'+_0x4b6e02[_0x34e6('0x34')]['filter']+'%'};return _0x3ee10c;}})});}_0x154b66=_[_0x34e6('0x42')]({},_0x154b66,_0x4b6e02[_0x34e6('0x44')]);var _0x5b1548={'where':_0x154b66['where']};return db[_0x34e6('0x2e')][_0x34e6('0x21')](_0x5b1548)[_0x34e6('0x26')](function(_0x58a68b){_0x2c5d47['count']=_0x58a68b;if(_0x4b6e02[_0x34e6('0x34')][_0x34e6('0x45')]){_0x154b66[_0x34e6('0x46')]=[{'all':!![]}];}return db[_0x34e6('0x2e')][_0x34e6('0x47')](_0x154b66);})[_0x34e6('0x26')](function(_0x241a08){_0x2c5d47[_0x34e6('0x48')]=_0x241a08;return _0x2c5d47;})[_0x34e6('0x26')](respondWithFilteredResult(_0x3ffd6c,_0x154b66))[_0x34e6('0x49')](handleError(_0x3ffd6c,null));};exports['show']=function(_0x4816a9,_0x1b52c2){var _0xcd3a53={'raw':![],'where':{'id':_0x4816a9[_0x34e6('0x4a')]['id']}},_0x745312={};_0x745312[_0x34e6('0x33')]=_[_0x34e6('0x35')](db['FreshsalesAccount'][_0x34e6('0x2f')]);_0x745312[_0x34e6('0x34')]=_['keys'](_0x4816a9[_0x34e6('0x34')]);_0x745312[_0x34e6('0x3f')]=_[_0x34e6('0x36')](_0x745312[_0x34e6('0x33')],_0x745312[_0x34e6('0x34')]);_0xcd3a53[_0x34e6('0x37')]=_[_0x34e6('0x36')](_0x745312[_0x34e6('0x33')],qs[_0x34e6('0x38')](_0x4816a9[_0x34e6('0x34')][_0x34e6('0x38')]));_0xcd3a53[_0x34e6('0x37')]=_0xcd3a53[_0x34e6('0x37')][_0x34e6('0x39')]?_0xcd3a53[_0x34e6('0x37')]:_0x745312[_0x34e6('0x33')];if(_0x4816a9[_0x34e6('0x34')][_0x34e6('0x45')]){_0xcd3a53[_0x34e6('0x46')]=[{'all':!![]}];}_0xcd3a53=_['merge']({},_0xcd3a53,_0x4816a9['options']);return db[_0x34e6('0x2e')][_0x34e6('0x4b')](_0xcd3a53)['then'](handleEntityNotFound(_0x1b52c2,null))[_0x34e6('0x26')](respondWithResult(_0x1b52c2,null))[_0x34e6('0x49')](handleError(_0x1b52c2,null));};exports[_0x34e6('0x4c')]=function(_0x59c045,_0x1b8b43){return db[_0x34e6('0x2e')][_0x34e6('0x4c')](_0x59c045['body'],{})[_0x34e6('0x26')](respondWithResult(_0x1b8b43,0xc9))[_0x34e6('0x49')](handleError(_0x1b8b43,null));};exports[_0x34e6('0x4d')]=function(_0x489b51,_0x33752a){if(_0x489b51[_0x34e6('0x4e')]['id']){delete _0x489b51[_0x34e6('0x4e')]['id'];}return db[_0x34e6('0x2e')][_0x34e6('0x4b')]({'where':{'id':_0x489b51[_0x34e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33752a,null))['then'](saveUpdates(_0x489b51['body'],null))[_0x34e6('0x26')](respondWithResult(_0x33752a,null))[_0x34e6('0x49')](handleError(_0x33752a,null));};exports[_0x34e6('0x27')]=function(_0x4d3fd6,_0x3cf7ca){return db[_0x34e6('0x2e')][_0x34e6('0x4b')]({'where':{'id':_0x4d3fd6[_0x34e6('0x4a')]['id']}})[_0x34e6('0x26')](handleEntityNotFound(_0x3cf7ca,null))[_0x34e6('0x26')](removeEntity(_0x3cf7ca,null))['catch'](handleError(_0x3cf7ca,null));};exports[_0x34e6('0x4f')]=function(_0x28d0cc,_0x1ad84c,_0x3e7037){var _0x360ce9={};var _0x10d943={};var _0x55c330;var _0x3ed2bd;return db[_0x34e6('0x2e')][_0x34e6('0x50')]({'where':{'id':_0x28d0cc[_0x34e6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ad84c,null))['then'](function(_0x28fc47){if(_0x28fc47){_0x55c330=_0x28fc47;_0x10d943[_0x34e6('0x33')]=_[_0x34e6('0x35')](db[_0x34e6('0x51')][_0x34e6('0x2f')]);_0x10d943[_0x34e6('0x34')]=_['keys'](_0x28d0cc[_0x34e6('0x34')]);_0x10d943[_0x34e6('0x3f')]=_['intersection'](_0x10d943[_0x34e6('0x33')],_0x10d943[_0x34e6('0x34')]);_0x360ce9[_0x34e6('0x37')]=_[_0x34e6('0x36')](_0x10d943['model'],qs[_0x34e6('0x38')](_0x28d0cc[_0x34e6('0x34')][_0x34e6('0x38')]));_0x360ce9[_0x34e6('0x37')]=_0x360ce9['attributes'][_0x34e6('0x39')]?_0x360ce9['attributes']:_0x10d943['model'];_0x360ce9[_0x34e6('0x3c')]=qs[_0x34e6('0x3d')](_0x28d0cc['query'][_0x34e6('0x3d')]);_0x360ce9[_0x34e6('0x41')]=qs['filters'](_['pick'](_0x28d0cc[_0x34e6('0x34')],_0x10d943[_0x34e6('0x3f')]));if(_0x28d0cc['query']['filter']){_0x360ce9[_0x34e6('0x41')]=_[_0x34e6('0x42')](_0x360ce9[_0x34e6('0x41')],{'$or':_[_0x34e6('0x2d')](_0x360ce9[_0x34e6('0x37')],function(_0x441a30){var _0x525512={};_0x525512[_0x441a30]={'$like':'%'+_0x28d0cc[_0x34e6('0x34')][_0x34e6('0x40')]+'%'};return _0x525512;})});}_0x360ce9=_[_0x34e6('0x42')]({},_0x360ce9,_0x28d0cc[_0x34e6('0x44')]);return _0x55c330[_0x34e6('0x4f')](_0x360ce9);}})['then'](function(_0x4529cc){if(_0x4529cc){_0x3ed2bd=_0x4529cc[_0x34e6('0x39')];if(!_0x28d0cc[_0x34e6('0x34')][_0x34e6('0x3a')](_0x34e6('0x3b'))){_0x360ce9[_0x34e6('0x20')]=qs[_0x34e6('0x20')](_0x28d0cc[_0x34e6('0x34')][_0x34e6('0x20')]);_0x360ce9['offset']=qs[_0x34e6('0x1e')](_0x28d0cc[_0x34e6('0x34')][_0x34e6('0x1e')]);}return _0x55c330[_0x34e6('0x4f')](_0x360ce9);}})[_0x34e6('0x26')](function(_0x2d0a2a){if(_0x2d0a2a){return _0x2d0a2a?{'count':_0x3ed2bd,'rows':_0x2d0a2a}:null;}})[_0x34e6('0x26')](respondWithResult(_0x1ad84c,null))[_0x34e6('0x49')](handleError(_0x1ad84c,null));};exports[_0x34e6('0x52')]=function(_0x12e9c6,_0x3de3fb,_0x5cb7fd){if(_0x12e9c6[_0x34e6('0x4e')]['id']){delete _0x12e9c6[_0x34e6('0x4e')]['id'];}return db[_0x34e6('0x2e')]['findOne']({'where':{'id':_0x12e9c6[_0x34e6('0x4a')]['id']}})[_0x34e6('0x26')](handleEntityNotFound(_0x3de3fb,null))['then'](function(_0x386f14){if(_0x386f14){_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x53')]=_0x386f14['id'];_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x54')]=integrations[_0x34e6('0x55')](_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x56')],_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x31')]);_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x57')]=integrations['getDescriptions'](_0x12e9c6['body'][_0x34e6('0x56')],_0x12e9c6[_0x34e6('0x4e')][_0x34e6('0x31')]);return db['FreshsalesConfiguration'][_0x34e6('0x4c')](_0x12e9c6[_0x34e6('0x4e')],{'include':[{'model':db['FreshsalesField'],'as':_0x34e6('0x54')},{'model':db[_0x34e6('0x58')],'as':_0x34e6('0x57')}]});}return null;})[_0x34e6('0x26')](respondWithResult(_0x3de3fb,null))['catch'](handleError(_0x3de3fb,null));};exports[_0x34e6('0x59')]=function(_0x3f18a9,_0x279447,_0x1ed186){var _0x54cf9a='';var _0x1672c6='';return db[_0x34e6('0x2e')][_0x34e6('0x50')]({'where':{'id':_0x3f18a9[_0x34e6('0x4a')]['id']},'attributes':['id',_0x34e6('0x5a'),_0x34e6('0x5b'),_0x34e6('0x5c')]})[_0x34e6('0x26')](handleEntityNotFound(_0x279447,null))[_0x34e6('0x26')](function(_0x2abfc1){if(_0x2abfc1){_0x1672c6=_0x2abfc1[_0x34e6('0x5a')];_0x54cf9a=_0x2abfc1[_0x34e6('0x5b')];var _0x33e0f9=_0x2abfc1[_0x34e6('0x5b')][_0x34e6('0x5d')](-0x1);if(_0x33e0f9==='/'){_0x54cf9a=_0x54cf9a[_0x34e6('0x5e')](0x0,_0x54cf9a[_0x34e6('0x5f')](_0x33e0f9));}return rp({'method':'GET','uri':util[_0x34e6('0x60')]('%s%s',_0x54cf9a,_0x34e6('0x61')),'headers':{'Authorization':_0x34e6('0x62')+_0x2abfc1[_0x34e6('0x5c')]},'json':!![]});}})[_0x34e6('0x26')](function(_0x5514f4){if(_0x5514f4){var _0x42ba71=_0x5514f4['users'];var _0xd2d302=![];var _0x349f03=null;for(_0x349f03=0x0;_0x349f03<_0x42ba71[_0x34e6('0x39')];_0x349f03++){if(_0x42ba71[_0x349f03][_0x34e6('0x63')]===_0x1672c6){_0xd2d302=!![];}}if(_0xd2d302){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x279447,null))[_0x34e6('0x49')](function(_0x539f06){var _0x56b059=_0x3f18a9[_0x34e6('0x34')]['test']?0x1f4:_0x539f06['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x34e6('0x59'),_0x56b059,JSON[_0x34e6('0x64')](_0x539f06));delete _0x539f06[_0x34e6('0x2a')];if(_0x56b059===0x191){_0x56b059=0x190;}_0x279447['status'](_0x56b059)['send'](_0x3f18a9[_0x34e6('0x34')][_0x34e6('0x65')]?{'message':_0x34e6('0x66'),'statusCode':_0x539f06[_0x34e6('0x67')]}:_0x539f06);});}; \ No newline at end of file +var _0xbad4=['Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','FreshsalesAccount','includeAll','findAll','rows','show','include','find','catch','create','body','params','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0xbad4,0x7b));var _0x4bad=function(_0x534cb9,_0x4930e2){_0x534cb9=_0x534cb9-0x0;var _0x23d4c7=_0xbad4[_0x534cb9];return _0x23d4c7;};'use strict';var emlformat=require(_0x4bad('0x0'));var rimraf=require(_0x4bad('0x1'));var zipdir=require(_0x4bad('0x2'));var jsonpatch=require(_0x4bad('0x3'));var rp=require(_0x4bad('0x4'));var moment=require(_0x4bad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4bad('0x6'));var csv=require(_0x4bad('0x7'));var ejs=require(_0x4bad('0x8'));var fs=require('fs');var fs_extra=require(_0x4bad('0x9'));var _=require(_0x4bad('0xa'));var squel=require(_0x4bad('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bad('0xc'));var deskjs=require(_0x4bad('0xd'));var toCsv=require(_0x4bad('0x7'));var querystring=require(_0x4bad('0xe'));var Papa=require('papaparse');var Redis=require(_0x4bad('0xf'));var authService=require(_0x4bad('0x10'));var qs=require(_0x4bad('0x11'));var as=require(_0x4bad('0x12'));var hardwareService=require(_0x4bad('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4bad('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bad('0x15'))['db'];var integrations=require(_0x4bad('0x16'));function respondWithStatusCode(_0x5727cc,_0x519a4d){_0x519a4d=_0x519a4d||0xcc;return function(_0x549f50){if(_0x549f50){return _0x5727cc[_0x4bad('0x17')](_0x519a4d);}return _0x5727cc[_0x4bad('0x18')](_0x519a4d)[_0x4bad('0x19')]();};}function respondWithResult(_0x5d6973,_0x5d56ec){_0x5d56ec=_0x5d56ec||0xc8;return function(_0x132e6e){if(_0x132e6e){return _0x5d6973['status'](_0x5d56ec)[_0x4bad('0x1a')](_0x132e6e);}};}function respondWithFilteredResult(_0x332116,_0x8557c8){return function(_0x3ab99a){if(_0x3ab99a){var _0x3f0162=typeof _0x8557c8['offset']===_0x4bad('0x1b')&&typeof _0x8557c8[_0x4bad('0x1c')]==='undefined';var _0x2c3c30=_0x3ab99a[_0x4bad('0x1d')];var _0x1cb2dd=_0x3f0162?0x0:_0x8557c8['offset'];var _0x2b21d6=_0x3f0162?_0x3ab99a['count']:_0x8557c8['offset']+_0x8557c8[_0x4bad('0x1c')];var _0x389a9e;if(_0x2b21d6>=_0x2c3c30){_0x2b21d6=_0x2c3c30;_0x389a9e=0xc8;}else{_0x389a9e=0xce;}_0x332116[_0x4bad('0x18')](_0x389a9e);return _0x332116['set'](_0x4bad('0x1e'),_0x1cb2dd+'-'+_0x2b21d6+'/'+_0x2c3c30)[_0x4bad('0x1a')](_0x3ab99a);}return null;};}function patchUpdates(_0x4a321e){return function(_0x50a7e8){try{jsonpatch[_0x4bad('0x1f')](_0x50a7e8,_0x4a321e,!![]);}catch(_0x58b881){return BPromise[_0x4bad('0x20')](_0x58b881);}return _0x50a7e8['save']();};}function saveUpdates(_0xe20c16,_0x49e9e6){return function(_0x4bd90f){if(_0x4bd90f){return _0x4bd90f[_0x4bad('0x21')](_0xe20c16)[_0x4bad('0x22')](function(_0x5e81a8){return _0x5e81a8;});}return null;};}function removeEntity(_0x1c0c82,_0x34003d){return function(_0x2c641e){if(_0x2c641e){return _0x2c641e[_0x4bad('0x23')]()['then'](function(){_0x1c0c82[_0x4bad('0x18')](0xcc)[_0x4bad('0x19')]();});}};}function handleEntityNotFound(_0x5da427,_0x8ee107){return function(_0x205e36){if(!_0x205e36){_0x5da427[_0x4bad('0x17')](0x194);}return _0x205e36;};}function handleError(_0xab2c60,_0x192ce1){_0x192ce1=_0x192ce1||0x1f4;return function(_0x5528bb){logger[_0x4bad('0x24')](_0x5528bb['stack']);if(_0x5528bb['name']){delete _0x5528bb[_0x4bad('0x25')];}_0xab2c60[_0x4bad('0x18')](_0x192ce1)[_0x4bad('0x26')](_0x5528bb);};}exports[_0x4bad('0x27')]=function(_0x21afe0,_0x42eb70){var _0x484b42={},_0x15fdf9={},_0xc8f4b8={'count':0x0,'rows':[]};var _0x36b631=_[_0x4bad('0x28')](db['FreshsalesAccount'][_0x4bad('0x29')],function(_0x115cdc){return{'name':_0x115cdc['fieldName'],'type':_0x115cdc[_0x4bad('0x2a')][_0x4bad('0x2b')]};});_0x15fdf9[_0x4bad('0x2c')]=_[_0x4bad('0x28')](_0x36b631,'name');_0x15fdf9[_0x4bad('0x2d')]=_[_0x4bad('0x2e')](_0x21afe0[_0x4bad('0x2d')]);_0x15fdf9['filters']=_[_0x4bad('0x2f')](_0x15fdf9[_0x4bad('0x2c')],_0x15fdf9['query']);_0x484b42['attributes']=_['intersection'](_0x15fdf9[_0x4bad('0x2c')],qs[_0x4bad('0x30')](_0x21afe0['query'][_0x4bad('0x30')]));_0x484b42[_0x4bad('0x31')]=_0x484b42[_0x4bad('0x31')][_0x4bad('0x32')]?_0x484b42[_0x4bad('0x31')]:_0x15fdf9[_0x4bad('0x2c')];if(!_0x21afe0[_0x4bad('0x2d')][_0x4bad('0x33')]('nolimit')){_0x484b42[_0x4bad('0x1c')]=qs[_0x4bad('0x1c')](_0x21afe0[_0x4bad('0x2d')][_0x4bad('0x1c')]);_0x484b42[_0x4bad('0x34')]=qs['offset'](_0x21afe0['query']['offset']);}_0x484b42[_0x4bad('0x35')]=qs[_0x4bad('0x36')](_0x21afe0[_0x4bad('0x2d')][_0x4bad('0x36')]);_0x484b42[_0x4bad('0x37')]=qs[_0x4bad('0x38')](_[_0x4bad('0x39')](_0x21afe0[_0x4bad('0x2d')],_0x15fdf9['filters']),_0x36b631);if(_0x21afe0[_0x4bad('0x2d')]['filter']){_0x484b42[_0x4bad('0x37')]=_[_0x4bad('0x3a')](_0x484b42[_0x4bad('0x37')],{'$or':_[_0x4bad('0x28')](_0x36b631,function(_0x16bd6f){if(_0x16bd6f[_0x4bad('0x2a')]!==_0x4bad('0x3b')){var _0x3f9db8={};_0x3f9db8[_0x16bd6f['name']]={'$like':'%'+_0x21afe0[_0x4bad('0x2d')][_0x4bad('0x3c')]+'%'};return _0x3f9db8;}})});}_0x484b42=_[_0x4bad('0x3a')]({},_0x484b42,_0x21afe0[_0x4bad('0x3d')]);var _0x5697cb={'where':_0x484b42[_0x4bad('0x37')]};return db[_0x4bad('0x3e')]['count'](_0x5697cb)[_0x4bad('0x22')](function(_0x54b27c){_0xc8f4b8[_0x4bad('0x1d')]=_0x54b27c;if(_0x21afe0[_0x4bad('0x2d')][_0x4bad('0x3f')]){_0x484b42['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x4bad('0x40')](_0x484b42);})[_0x4bad('0x22')](function(_0x39adb2){_0xc8f4b8[_0x4bad('0x41')]=_0x39adb2;return _0xc8f4b8;})[_0x4bad('0x22')](respondWithFilteredResult(_0x42eb70,_0x484b42))['catch'](handleError(_0x42eb70,null));};exports[_0x4bad('0x42')]=function(_0x214ed5,_0x3ad890){var _0x3f2bb4={'raw':![],'where':{'id':_0x214ed5['params']['id']}},_0x326763={};_0x326763[_0x4bad('0x2c')]=_['keys'](db[_0x4bad('0x3e')][_0x4bad('0x29')]);_0x326763[_0x4bad('0x2d')]=_['keys'](_0x214ed5[_0x4bad('0x2d')]);_0x326763[_0x4bad('0x38')]=_[_0x4bad('0x2f')](_0x326763[_0x4bad('0x2c')],_0x326763[_0x4bad('0x2d')]);_0x3f2bb4[_0x4bad('0x31')]=_[_0x4bad('0x2f')](_0x326763[_0x4bad('0x2c')],qs[_0x4bad('0x30')](_0x214ed5[_0x4bad('0x2d')]['fields']));_0x3f2bb4[_0x4bad('0x31')]=_0x3f2bb4['attributes'][_0x4bad('0x32')]?_0x3f2bb4['attributes']:_0x326763[_0x4bad('0x2c')];if(_0x214ed5['query'][_0x4bad('0x3f')]){_0x3f2bb4[_0x4bad('0x43')]=[{'all':!![]}];}_0x3f2bb4=_[_0x4bad('0x3a')]({},_0x3f2bb4,_0x214ed5[_0x4bad('0x3d')]);return db[_0x4bad('0x3e')][_0x4bad('0x44')](_0x3f2bb4)[_0x4bad('0x22')](handleEntityNotFound(_0x3ad890,null))[_0x4bad('0x22')](respondWithResult(_0x3ad890,null))[_0x4bad('0x45')](handleError(_0x3ad890,null));};exports[_0x4bad('0x46')]=function(_0x58493f,_0x38db0b){return db[_0x4bad('0x3e')][_0x4bad('0x46')](_0x58493f[_0x4bad('0x47')],{})[_0x4bad('0x22')](respondWithResult(_0x38db0b,0xc9))[_0x4bad('0x45')](handleError(_0x38db0b,null));};exports[_0x4bad('0x21')]=function(_0xc1ad84,_0x4dd545){if(_0xc1ad84[_0x4bad('0x47')]['id']){delete _0xc1ad84[_0x4bad('0x47')]['id'];}return db[_0x4bad('0x3e')]['find']({'where':{'id':_0xc1ad84[_0x4bad('0x48')]['id']}})[_0x4bad('0x22')](handleEntityNotFound(_0x4dd545,null))[_0x4bad('0x22')](saveUpdates(_0xc1ad84[_0x4bad('0x47')],null))['then'](respondWithResult(_0x4dd545,null))[_0x4bad('0x45')](handleError(_0x4dd545,null));};exports[_0x4bad('0x23')]=function(_0x25df93,_0x58844b){return db[_0x4bad('0x3e')][_0x4bad('0x44')]({'where':{'id':_0x25df93[_0x4bad('0x48')]['id']}})[_0x4bad('0x22')](handleEntityNotFound(_0x58844b,null))[_0x4bad('0x22')](removeEntity(_0x58844b,null))[_0x4bad('0x45')](handleError(_0x58844b,null));};exports[_0x4bad('0x49')]=function(_0x3533ef,_0x261992,_0x4ce016){var _0x3c02e2={};var _0x586ee7={};var _0x3148c3;var _0x4eff50;return db[_0x4bad('0x3e')][_0x4bad('0x4a')]({'where':{'id':_0x3533ef['params']['id']}})[_0x4bad('0x22')](handleEntityNotFound(_0x261992,null))['then'](function(_0x19c33f){if(_0x19c33f){_0x3148c3=_0x19c33f;_0x586ee7[_0x4bad('0x2c')]=_[_0x4bad('0x2e')](db[_0x4bad('0x4b')][_0x4bad('0x29')]);_0x586ee7['query']=_[_0x4bad('0x2e')](_0x3533ef[_0x4bad('0x2d')]);_0x586ee7[_0x4bad('0x38')]=_['intersection'](_0x586ee7[_0x4bad('0x2c')],_0x586ee7[_0x4bad('0x2d')]);_0x3c02e2[_0x4bad('0x31')]=_['intersection'](_0x586ee7[_0x4bad('0x2c')],qs[_0x4bad('0x30')](_0x3533ef['query']['fields']));_0x3c02e2['attributes']=_0x3c02e2[_0x4bad('0x31')][_0x4bad('0x32')]?_0x3c02e2[_0x4bad('0x31')]:_0x586ee7['model'];_0x3c02e2[_0x4bad('0x35')]=qs[_0x4bad('0x36')](_0x3533ef[_0x4bad('0x2d')][_0x4bad('0x36')]);_0x3c02e2[_0x4bad('0x37')]=qs[_0x4bad('0x38')](_[_0x4bad('0x39')](_0x3533ef[_0x4bad('0x2d')],_0x586ee7[_0x4bad('0x38')]));if(_0x3533ef['query']['filter']){_0x3c02e2['where']=_[_0x4bad('0x3a')](_0x3c02e2[_0x4bad('0x37')],{'$or':_[_0x4bad('0x28')](_0x3c02e2['attributes'],function(_0x43e90e){var _0x5b348a={};_0x5b348a[_0x43e90e]={'$like':'%'+_0x3533ef[_0x4bad('0x2d')]['filter']+'%'};return _0x5b348a;})});}_0x3c02e2=_[_0x4bad('0x3a')]({},_0x3c02e2,_0x3533ef[_0x4bad('0x3d')]);return _0x3148c3['getConfigurations'](_0x3c02e2);}})[_0x4bad('0x22')](function(_0x3a08aa){if(_0x3a08aa){_0x4eff50=_0x3a08aa['length'];if(!_0x3533ef[_0x4bad('0x2d')]['hasOwnProperty'](_0x4bad('0x4c'))){_0x3c02e2['limit']=qs['limit'](_0x3533ef['query'][_0x4bad('0x1c')]);_0x3c02e2[_0x4bad('0x34')]=qs['offset'](_0x3533ef['query'][_0x4bad('0x34')]);}return _0x3148c3[_0x4bad('0x49')](_0x3c02e2);}})[_0x4bad('0x22')](function(_0x135ce6){if(_0x135ce6){return _0x135ce6?{'count':_0x4eff50,'rows':_0x135ce6}:null;}})[_0x4bad('0x22')](respondWithResult(_0x261992,null))[_0x4bad('0x45')](handleError(_0x261992,null));};exports[_0x4bad('0x4d')]=function(_0x56997d,_0x4bf222,_0x446ea3){if(_0x56997d['body']['id']){delete _0x56997d[_0x4bad('0x47')]['id'];}return db[_0x4bad('0x3e')][_0x4bad('0x4a')]({'where':{'id':_0x56997d['params']['id']}})[_0x4bad('0x22')](handleEntityNotFound(_0x4bf222,null))[_0x4bad('0x22')](function(_0x4f8f6b){if(_0x4f8f6b){_0x56997d[_0x4bad('0x47')][_0x4bad('0x4e')]=_0x4f8f6b['id'];_0x56997d['body'][_0x4bad('0x4f')]=integrations[_0x4bad('0x50')](_0x56997d[_0x4bad('0x47')][_0x4bad('0x51')],_0x56997d[_0x4bad('0x47')][_0x4bad('0x2a')]);_0x56997d[_0x4bad('0x47')][_0x4bad('0x52')]=integrations['getDescriptions'](_0x56997d['body'][_0x4bad('0x51')],_0x56997d[_0x4bad('0x47')][_0x4bad('0x2a')]);return db['FreshsalesConfiguration']['create'](_0x56997d[_0x4bad('0x47')],{'include':[{'model':db[_0x4bad('0x53')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0x4bad('0x52')}]});}return null;})['then'](respondWithResult(_0x4bf222,null))[_0x4bad('0x45')](handleError(_0x4bf222,null));};exports[_0x4bad('0x54')]=function(_0x1b4e3f,_0x1654e6,_0x332aad){var _0x3cc9cb='';var _0x31febd='';return db[_0x4bad('0x3e')]['findOne']({'where':{'id':_0x1b4e3f['params']['id']},'attributes':['id',_0x4bad('0x55'),'remoteUri',_0x4bad('0x56')]})[_0x4bad('0x22')](handleEntityNotFound(_0x1654e6,null))[_0x4bad('0x22')](function(_0xea85f0){if(_0xea85f0){_0x31febd=_0xea85f0[_0x4bad('0x55')];_0x3cc9cb=_0xea85f0['remoteUri'];var _0xbd3319=_0xea85f0[_0x4bad('0x57')][_0x4bad('0x58')](-0x1);if(_0xbd3319==='/'){_0x3cc9cb=_0x3cc9cb['substring'](0x0,_0x3cc9cb[_0x4bad('0x59')](_0xbd3319));}return rp({'method':_0x4bad('0x5a'),'uri':util[_0x4bad('0x5b')](_0x4bad('0x5c'),_0x3cc9cb,_0x4bad('0x5d')),'headers':{'Authorization':'Token\x20token='+_0xea85f0[_0x4bad('0x56')]},'json':!![]});}})[_0x4bad('0x22')](function(_0x7b0147){if(_0x7b0147){var _0x3a62b7=_0x7b0147['users'];var _0x104391=![];var _0x1c0cf9=null;for(_0x1c0cf9=0x0;_0x1c0cf9<_0x3a62b7[_0x4bad('0x32')];_0x1c0cf9++){if(_0x3a62b7[_0x1c0cf9][_0x4bad('0x5e')]===_0x31febd){_0x104391=!![];}}if(_0x104391){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x4bad('0x5f')});}}})['then'](respondWithResult(_0x1654e6,null))[_0x4bad('0x45')](function(_0x1a2959){var _0x366386=_0x1b4e3f[_0x4bad('0x2d')][_0x4bad('0x60')]?0x1f4:_0x1a2959[_0x4bad('0x61')]||0x1f4;logger[_0x4bad('0x24')](_0x4bad('0x62'),_0x4bad('0x54'),_0x366386,JSON[_0x4bad('0x63')](_0x1a2959));delete _0x1a2959[_0x4bad('0x25')];if(_0x366386===0x191){_0x366386=0x190;}_0x1654e6[_0x4bad('0x18')](_0x366386)[_0x4bad('0x26')](_0x1b4e3f['query'][_0x4bad('0x60')]?{'message':_0x4bad('0x64'),'statusCode':_0x1a2959[_0x4bad('0x61')]}:_0x1a2959);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 45d55ad..1cc7dc7 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 _0x1a85=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','../../config/logger','api'];(function(_0x55c308,_0x326124){var _0x46d3be=function(_0x274594){while(--_0x274594){_0x55c308['push'](_0x55c308['shift']());}};_0x46d3be(++_0x326124);}(_0x1a85,0x178));var _0x51a8=function(_0x2d5f67,_0x125f70){_0x2d5f67=_0x2d5f67-0x0;var _0x4c0890=_0x1a85[_0x2d5f67];return _0x4c0890;};'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('./intFreshsalesAccount.attributes');var integrations=require(_0x51a8('0x6'));module['exports']=function(_0x2c1180,_0x5cf430){return _0x2c1180[_0x51a8('0x7')](_0x51a8('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0x5430,0x10c));var _0x0543=function(_0x396d55,_0x1611fa){_0x396d55=_0x396d55-0x0;var _0x49ae7c=_0x5430[_0x396d55];return _0x49ae7c;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3163ad4..4e35342 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 _0x7bd0=['limit','include','model','map','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FreshsalesAccount','findAll','options','raw','where','attributes'];(function(_0x5ba865,_0x588d87){var _0x52b898=function(_0x1912ea){while(--_0x1912ea){_0x5ba865['push'](_0x5ba865['shift']());}};_0x52b898(++_0x588d87);}(_0x7bd0,0x111));var _0x07bd=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x7bd0[_0x2b9e8a];return _0x520e67;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var moment=require(_0x07bd('0x2'));var BPromise=require(_0x07bd('0x3'));var rs=require(_0x07bd('0x4'));var fs=require('fs');var Redis=require(_0x07bd('0x5'));var db=require(_0x07bd('0x6'))['db'];var utils=require(_0x07bd('0x7'));var logger=require('../../config/logger')(_0x07bd('0x8'));var config=require(_0x07bd('0x9'));var jayson=require(_0x07bd('0xa'));var client=jayson[_0x07bd('0xb')][_0x07bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x422a22,_0x2e4cd1,_0x5a939d){return new BPromise(function(_0x3968d9,_0x5cd446){return client[_0x07bd('0xd')](_0x422a22,_0x5a939d)[_0x07bd('0xe')](function(_0x323724){logger['info'](_0x07bd('0xf'),_0x2e4cd1,_0x07bd('0x10'));logger[_0x07bd('0x11')](_0x07bd('0x12'),_0x2e4cd1,'request\x20sent',JSON[_0x07bd('0x13')](_0x323724));if(_0x323724[_0x07bd('0x14')]){if(_0x323724[_0x07bd('0x14')][_0x07bd('0x15')]===0x1f4){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x5cd446(_0x323724['error']['message']);}logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);return _0x3968d9(_0x323724[_0x07bd('0x14')][_0x07bd('0x16')]);}else{logger[_0x07bd('0x17')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e4cd1,_0x07bd('0x10'));_0x3968d9(_0x323724['result'][_0x07bd('0x16')]);}})[_0x07bd('0x18')](function(_0x31655a){logger[_0x07bd('0x14')](_0x07bd('0xf'),_0x2e4cd1,_0x31655a);_0x5cd446(_0x31655a);});});}exports['GetFreshsalesAccount']=function(_0x3f9f0b){var _0xc4cf4c=this;return new Promise(function(_0x4948f4,_0x3e8ec4){return db[_0x07bd('0x19')][_0x07bd('0x1a')]({'raw':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1d')]||null:null,'attributes':_0x3f9f0b['options']?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'limit':_0x3f9f0b[_0x07bd('0x1b')]?_0x3f9f0b[_0x07bd('0x1b')][_0x07bd('0x1f')]||null:null,'include':_0x3f9f0b['options']?_0x3f9f0b['options'][_0x07bd('0x20')]?_['map'](_0x3f9f0b[_0x07bd('0x1b')]['include'],function(_0x50bd12){return{'model':db[_0x50bd12[_0x07bd('0x21')]],'as':_0x50bd12['as'],'attributes':_0x50bd12[_0x07bd('0x1e')],'include':_0x50bd12[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x50bd12[_0x07bd('0x20')],function(_0x43cbc8){return{'model':db[_0x43cbc8['model']],'as':_0x43cbc8['as'],'attributes':_0x43cbc8[_0x07bd('0x1e')],'include':_0x43cbc8[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x43cbc8[_0x07bd('0x20')],function(_0x12ce26){return{'model':db[_0x12ce26[_0x07bd('0x21')]],'as':_0x12ce26['as'],'attributes':_0x12ce26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5184dc){logger[_0x07bd('0x17')](_0x07bd('0x23'),_0x3f9f0b);logger[_0x07bd('0x11')]('GetFreshsalesAccount',_0x3f9f0b,JSON[_0x07bd('0x13')](_0x5184dc));_0x4948f4(_0x5184dc);})[_0x07bd('0x18')](function(_0x253dc0){logger[_0x07bd('0x14')](_0x07bd('0x23'),_0x253dc0[_0x07bd('0x16')],_0x3f9f0b);_0x3e8ec4(_0xc4cf4c['error'](0x1f4,_0x253dc0[_0x07bd('0x16')]));});});};exports[_0x07bd('0x24')]=function(_0x4182b9){var _0x321200=this;return new Promise(function(_0x1b6cc,_0x314bda){return db[_0x07bd('0x19')][_0x07bd('0x25')]({'raw':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x1c')]===undefined?!![]:![]:!![],'where':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')]['where']||null:null,'attributes':_0x4182b9[_0x07bd('0x1b')]?_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x1e')]||null:null,'include':_0x4182b9['options']?_0x4182b9['options'][_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x4182b9[_0x07bd('0x1b')][_0x07bd('0x20')],function(_0x5f29c5){return{'model':db[_0x5f29c5[_0x07bd('0x21')]],'as':_0x5f29c5['as'],'attributes':_0x5f29c5[_0x07bd('0x1e')],'include':_0x5f29c5[_0x07bd('0x20')]?_['map'](_0x5f29c5[_0x07bd('0x20')],function(_0x31c381){return{'model':db[_0x31c381['model']],'as':_0x31c381['as'],'attributes':_0x31c381[_0x07bd('0x1e')],'include':_0x31c381[_0x07bd('0x20')]?_[_0x07bd('0x22')](_0x31c381[_0x07bd('0x20')],function(_0x5cde8d){return{'model':db[_0x5cde8d['model']],'as':_0x5cde8d['as'],'attributes':_0x5cde8d[_0x07bd('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c2878){logger[_0x07bd('0x17')](_0x07bd('0x24'),_0x4182b9);logger[_0x07bd('0x11')](_0x07bd('0x24'),_0x4182b9,JSON[_0x07bd('0x13')](_0x3c2878));_0x1b6cc(_0x3c2878);})[_0x07bd('0x18')](function(_0x333ac2){logger[_0x07bd('0x14')](_0x07bd('0x24'),_0x333ac2[_0x07bd('0x16')],_0x4182b9);_0x314bda(_0x321200[_0x07bd('0x14')](0x1f4,_0x333ac2[_0x07bd('0x16')]));});});}; \ No newline at end of file +var _0x7a54=['http','info','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3c848b,_0x4dde0c){var _0x4f094d=function(_0x3c5de8){while(--_0x3c5de8){_0x3c848b['push'](_0x3c848b['shift']());}};_0x4f094d(++_0x4dde0c);}(_0x7a54,0x106));var _0x47a5=function(_0x2532ae,_0xea5c01){_0x2532ae=_0x2532ae-0x0;var _0x3f26ec=_0x7a54[_0x2532ae];return _0x3f26ec;};'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')]('FreshsalesAccount,\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['GetFreshsalesAccount']=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,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2068bea..9733552 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 _0x4f6d=['getSubjects','/:id/descriptions','getFields','post','create','put','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f6d,0x6d));var _0xd4f6=function(_0x43828c,_0x119bd2){_0x43828c=_0x43828c-0x0;var _0x5d0d46=_0x4f6d[_0x43828c];return _0x5d0d46;};'use strict';var multer=require(_0xd4f6('0x0'));var util=require(_0xd4f6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd4f6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd4f6('0x3'));var config=require(_0xd4f6('0x4'));var controller=require(_0xd4f6('0x5'));router[_0xd4f6('0x6')]('/',auth[_0xd4f6('0x7')](),controller[_0xd4f6('0x8')]);router['get'](_0xd4f6('0x9'),auth[_0xd4f6('0x7')](),controller['show']);router[_0xd4f6('0x6')](_0xd4f6('0xa'),auth[_0xd4f6('0x7')](),controller[_0xd4f6('0xb')]);router[_0xd4f6('0x6')](_0xd4f6('0xc'),auth[_0xd4f6('0x7')](),controller['getDescriptions']);router['get']('/:id/fields',auth[_0xd4f6('0x7')](),controller[_0xd4f6('0xd')]);router[_0xd4f6('0xe')]('/',auth['isAuthenticated'](),controller[_0xd4f6('0xf')]);router[_0xd4f6('0x10')](_0xd4f6('0x9'),auth[_0xd4f6('0x7')](),controller['update']);router[_0xd4f6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd4f6('0x12')]);module[_0xd4f6('0x13')]=router; \ No newline at end of file +var _0xa188=['fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x285d29,_0x52c639){var _0x202256=function(_0x4463f3){while(--_0x4463f3){_0x285d29['push'](_0x285d29['shift']());}};_0x202256(++_0x52c639);}(_0xa188,0x18b));var _0x8a18=function(_0x3f34fd,_0x1078e6){_0x3f34fd=_0x3f34fd-0x0;var _0x419883=_0xa188[_0x3f34fd];return _0x419883;};'use strict';var multer=require(_0x8a18('0x0'));var util=require(_0x8a18('0x1'));var path=require('path');var timeout=require(_0x8a18('0x2'));var express=require(_0x8a18('0x3'));var router=express[_0x8a18('0x4')]();var fs_extra=require(_0x8a18('0x5'));var auth=require(_0x8a18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8a18('0x7'));var controller=require(_0x8a18('0x8'));router[_0x8a18('0x9')]('/',auth[_0x8a18('0xa')](),controller[_0x8a18('0xb')]);router['get'](_0x8a18('0xc'),auth[_0x8a18('0xa')](),controller[_0x8a18('0xd')]);router[_0x8a18('0x9')](_0x8a18('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8a18('0x9')](_0x8a18('0xf'),auth['isAuthenticated'](),controller[_0x8a18('0x10')]);router[_0x8a18('0x9')](_0x8a18('0x11'),auth['isAuthenticated'](),controller[_0x8a18('0x12')]);router[_0x8a18('0x13')]('/',auth[_0x8a18('0xa')](),controller[_0x8a18('0x14')]);router['put'](_0x8a18('0xc'),auth['isAuthenticated'](),controller[_0x8a18('0x15')]);router[_0x8a18('0x16')](_0x8a18('0xc'),auth[_0x8a18('0xa')](),controller[_0x8a18('0x17')]);module[_0x8a18('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 2918a1e..9040e23 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 _0x1415=['sequelize'];(function(_0x2c5c6a,_0x276142){var _0x4ac329=function(_0x3ac18f){while(--_0x3ac18f){_0x2c5c6a['push'](_0x2c5c6a['shift']());}};_0x4ac329(++_0x276142);}(_0x1415,0x145));var _0x5141=function(_0x431481,_0x2fad78){_0x431481=_0x431481-0x0;var _0x3f8044=_0x1415[_0x431481];return _0x3f8044;};'use strict';var Sequelize=require(_0x5141('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc226=['sequelize','exports','STRING'];(function(_0xaa5b2e,_0x20bbe7){var _0x32af11=function(_0x285d98){while(--_0x285d98){_0xaa5b2e['push'](_0xaa5b2e['shift']());}};_0x32af11(++_0x20bbe7);}(_0xc226,0xe1));var _0x6c22=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xc226[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x6c22('0x0'));module[_0x6c22('0x1')]={'name':{'type':Sequelize[_0x6c22('0x2')]},'description':{'type':Sequelize[_0x6c22('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index bd0b01b..06d02a5 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 _0x9b31=['FreshsalesField','pick','getDescriptions','nolimit','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','includeAll','find','catch','create','body','params','destroy','getSubjects','findOne'];(function(_0x1b16a5,_0x423765){var _0x479765=function(_0x3b5272){while(--_0x3b5272){_0x1b16a5['push'](_0x1b16a5['shift']());}};_0x479765(++_0x423765);}(_0x9b31,0x104));var _0x19b3=function(_0x5c08ea,_0x3b62b4){_0x5c08ea=_0x5c08ea-0x0;var _0x35bc85=_0x9b31[_0x5c08ea];return _0x35bc85;};'use strict';var emlformat=require(_0x19b3('0x0'));var rimraf=require(_0x19b3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19b3('0x2'));var rp=require(_0x19b3('0x3'));var moment=require(_0x19b3('0x4'));var BPromise=require(_0x19b3('0x5'));var Mustache=require(_0x19b3('0x6'));var util=require(_0x19b3('0x7'));var path=require(_0x19b3('0x8'));var sox=require(_0x19b3('0x9'));var csv=require('to-csv');var ejs=require(_0x19b3('0xa'));var fs=require('fs');var fs_extra=require(_0x19b3('0xb'));var _=require(_0x19b3('0xc'));var squel=require(_0x19b3('0xd'));var crypto=require('crypto');var jsforce=require(_0x19b3('0xe'));var deskjs=require(_0x19b3('0xf'));var toCsv=require(_0x19b3('0x10'));var querystring=require(_0x19b3('0x11'));var Papa=require(_0x19b3('0x12'));var Redis=require(_0x19b3('0x13'));var authService=require(_0x19b3('0x14'));var qs=require(_0x19b3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x19b3('0x16'));var logger=require('../../config/logger')(_0x19b3('0x17'));var utils=require(_0x19b3('0x18'));var config=require(_0x19b3('0x19'));var licenseUtil=require(_0x19b3('0x1a'));var db=require(_0x19b3('0x1b'))['db'];function respondWithStatusCode(_0x49c975,_0x7ed7ac){_0x7ed7ac=_0x7ed7ac||0xcc;return function(_0x5d836e){if(_0x5d836e){return _0x49c975[_0x19b3('0x1c')](_0x7ed7ac);}return _0x49c975[_0x19b3('0x1d')](_0x7ed7ac)[_0x19b3('0x1e')]();};}function respondWithResult(_0x59362b,_0x3dc41b){_0x3dc41b=_0x3dc41b||0xc8;return function(_0x3d3c6c){if(_0x3d3c6c){return _0x59362b['status'](_0x3dc41b)[_0x19b3('0x1f')](_0x3d3c6c);}};}function respondWithFilteredResult(_0x120d94,_0x1b96d1){return function(_0x1251b8){if(_0x1251b8){var _0x561aec=typeof _0x1b96d1[_0x19b3('0x20')]==='undefined'&&typeof _0x1b96d1[_0x19b3('0x21')]==='undefined';var _0x1b37bf=_0x1251b8['count'];var _0x2cb29d=_0x561aec?0x0:_0x1b96d1[_0x19b3('0x20')];var _0x280bf7=_0x561aec?_0x1251b8[_0x19b3('0x22')]:_0x1b96d1[_0x19b3('0x20')]+_0x1b96d1['limit'];var _0x244068;if(_0x280bf7>=_0x1b37bf){_0x280bf7=_0x1b37bf;_0x244068=0xc8;}else{_0x244068=0xce;}_0x120d94[_0x19b3('0x1d')](_0x244068);return _0x120d94[_0x19b3('0x23')](_0x19b3('0x24'),_0x2cb29d+'-'+_0x280bf7+'/'+_0x1b37bf)[_0x19b3('0x1f')](_0x1251b8);}return null;};}function patchUpdates(_0x299f4a){return function(_0x203aea){try{jsonpatch[_0x19b3('0x25')](_0x203aea,_0x299f4a,!![]);}catch(_0x19fbc0){return BPromise[_0x19b3('0x26')](_0x19fbc0);}return _0x203aea['save']();};}function saveUpdates(_0x4d9c08,_0x21d764){return function(_0xa2f661){if(_0xa2f661){return _0xa2f661[_0x19b3('0x27')](_0x4d9c08)[_0x19b3('0x28')](function(_0x2a141e){return _0x2a141e;});}return null;};}function removeEntity(_0x2cf060,_0x112bcc){return function(_0x216f13){if(_0x216f13){return _0x216f13['destroy']()[_0x19b3('0x28')](function(){_0x2cf060[_0x19b3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48a6f9,_0x5cf142){return function(_0x15943f){if(!_0x15943f){_0x48a6f9[_0x19b3('0x1c')](0x194);}return _0x15943f;};}function handleError(_0x2838a4,_0x5ee703){_0x5ee703=_0x5ee703||0x1f4;return function(_0x274868){logger[_0x19b3('0x29')](_0x274868['stack']);if(_0x274868[_0x19b3('0x2a')]){delete _0x274868[_0x19b3('0x2a')];}_0x2838a4[_0x19b3('0x1d')](_0x5ee703)[_0x19b3('0x2b')](_0x274868);};}exports[_0x19b3('0x2c')]=function(_0x48fdd2,_0x4739dd){var _0x507a09={},_0x57b489={},_0x1d3a52={'count':0x0,'rows':[]};var _0x524f3e=_[_0x19b3('0x2d')](db[_0x19b3('0x2e')][_0x19b3('0x2f')],function(_0x3a457b){return{'name':_0x3a457b[_0x19b3('0x30')],'type':_0x3a457b['type'][_0x19b3('0x31')]};});_0x57b489['model']=_[_0x19b3('0x2d')](_0x524f3e,_0x19b3('0x2a'));_0x57b489[_0x19b3('0x32')]=_[_0x19b3('0x33')](_0x48fdd2[_0x19b3('0x32')]);_0x57b489[_0x19b3('0x34')]=_[_0x19b3('0x35')](_0x57b489[_0x19b3('0x36')],_0x57b489['query']);_0x507a09[_0x19b3('0x37')]=_[_0x19b3('0x35')](_0x57b489[_0x19b3('0x36')],qs[_0x19b3('0x38')](_0x48fdd2['query'][_0x19b3('0x38')]));_0x507a09[_0x19b3('0x37')]=_0x507a09[_0x19b3('0x37')][_0x19b3('0x39')]?_0x507a09[_0x19b3('0x37')]:_0x57b489['model'];if(!_0x48fdd2['query'][_0x19b3('0x3a')]('nolimit')){_0x507a09[_0x19b3('0x21')]=qs['limit'](_0x48fdd2[_0x19b3('0x32')][_0x19b3('0x21')]);_0x507a09[_0x19b3('0x20')]=qs[_0x19b3('0x20')](_0x48fdd2[_0x19b3('0x32')][_0x19b3('0x20')]);}_0x507a09[_0x19b3('0x3b')]=qs[_0x19b3('0x3c')](_0x48fdd2['query'][_0x19b3('0x3c')]);_0x507a09[_0x19b3('0x3d')]=qs['filters'](_['pick'](_0x48fdd2[_0x19b3('0x32')],_0x57b489[_0x19b3('0x34')]),_0x524f3e);if(_0x48fdd2[_0x19b3('0x32')][_0x19b3('0x3e')]){_0x507a09['where']=_[_0x19b3('0x3f')](_0x507a09[_0x19b3('0x3d')],{'$or':_[_0x19b3('0x2d')](_0x524f3e,function(_0x36a735){if(_0x36a735[_0x19b3('0x40')]!==_0x19b3('0x41')){var _0x2f49f6={};_0x2f49f6[_0x36a735[_0x19b3('0x2a')]]={'$like':'%'+_0x48fdd2['query']['filter']+'%'};return _0x2f49f6;}})});}_0x507a09=_[_0x19b3('0x3f')]({},_0x507a09,_0x48fdd2[_0x19b3('0x42')]);var _0x58312d={'where':_0x507a09[_0x19b3('0x3d')]};return db[_0x19b3('0x2e')][_0x19b3('0x22')](_0x58312d)[_0x19b3('0x28')](function(_0xdf2f4){_0x1d3a52[_0x19b3('0x22')]=_0xdf2f4;if(_0x48fdd2['query']['includeAll']){_0x507a09[_0x19b3('0x43')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x19b3('0x44')](_0x507a09);})[_0x19b3('0x28')](function(_0xfe8064){_0x1d3a52[_0x19b3('0x45')]=_0xfe8064;return _0x1d3a52;})['then'](respondWithFilteredResult(_0x4739dd,_0x507a09))['catch'](handleError(_0x4739dd,null));};exports[_0x19b3('0x46')]=function(_0x24f30a,_0x32e4bc){var _0x53a152={'raw':![],'where':{'id':_0x24f30a['params']['id']}},_0x3d0e7b={};_0x3d0e7b['model']=_['keys'](db[_0x19b3('0x2e')][_0x19b3('0x2f')]);_0x3d0e7b[_0x19b3('0x32')]=_[_0x19b3('0x33')](_0x24f30a[_0x19b3('0x32')]);_0x3d0e7b[_0x19b3('0x34')]=_[_0x19b3('0x35')](_0x3d0e7b[_0x19b3('0x36')],_0x3d0e7b[_0x19b3('0x32')]);_0x53a152['attributes']=_[_0x19b3('0x35')](_0x3d0e7b[_0x19b3('0x36')],qs[_0x19b3('0x38')](_0x24f30a['query'][_0x19b3('0x38')]));_0x53a152[_0x19b3('0x37')]=_0x53a152['attributes'][_0x19b3('0x39')]?_0x53a152[_0x19b3('0x37')]:_0x3d0e7b['model'];if(_0x24f30a[_0x19b3('0x32')][_0x19b3('0x47')]){_0x53a152['include']=[{'all':!![]}];}_0x53a152=_[_0x19b3('0x3f')]({},_0x53a152,_0x24f30a['options']);return db[_0x19b3('0x2e')][_0x19b3('0x48')](_0x53a152)[_0x19b3('0x28')](handleEntityNotFound(_0x32e4bc,null))[_0x19b3('0x28')](respondWithResult(_0x32e4bc,null))[_0x19b3('0x49')](handleError(_0x32e4bc,null));};exports[_0x19b3('0x4a')]=function(_0x45cc8b,_0x4c62b2){return db[_0x19b3('0x2e')][_0x19b3('0x4a')](_0x45cc8b[_0x19b3('0x4b')],{})[_0x19b3('0x28')](respondWithResult(_0x4c62b2,0xc9))[_0x19b3('0x49')](handleError(_0x4c62b2,null));};exports[_0x19b3('0x27')]=function(_0x2294c6,_0x46b162){if(_0x2294c6['body']['id']){delete _0x2294c6[_0x19b3('0x4b')]['id'];}return db[_0x19b3('0x2e')][_0x19b3('0x48')]({'where':{'id':_0x2294c6[_0x19b3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46b162,null))[_0x19b3('0x28')](saveUpdates(_0x2294c6[_0x19b3('0x4b')],null))[_0x19b3('0x28')](respondWithResult(_0x46b162,null))['catch'](handleError(_0x46b162,null));};exports[_0x19b3('0x4d')]=function(_0x427117,_0x3aa596){return db[_0x19b3('0x2e')]['find']({'where':{'id':_0x427117['params']['id']}})[_0x19b3('0x28')](handleEntityNotFound(_0x3aa596,null))[_0x19b3('0x28')](removeEntity(_0x3aa596,null))[_0x19b3('0x49')](handleError(_0x3aa596,null));};exports[_0x19b3('0x4e')]=function(_0x4ade87,_0x4b9d05,_0x538c04){var _0x458e02={};var _0x15ee77={};var _0x123a1e;var _0x1906ce;return db['FreshsalesConfiguration'][_0x19b3('0x4f')]({'where':{'id':_0x4ade87[_0x19b3('0x4c')]['id']}})[_0x19b3('0x28')](handleEntityNotFound(_0x4b9d05,null))[_0x19b3('0x28')](function(_0x34c1ec){if(_0x34c1ec){_0x123a1e=_0x34c1ec;_0x15ee77[_0x19b3('0x36')]=_[_0x19b3('0x33')](db[_0x19b3('0x50')]['rawAttributes']);_0x15ee77[_0x19b3('0x32')]=_[_0x19b3('0x33')](_0x4ade87[_0x19b3('0x32')]);_0x15ee77[_0x19b3('0x34')]=_[_0x19b3('0x35')](_0x15ee77['model'],_0x15ee77[_0x19b3('0x32')]);_0x458e02['attributes']=_['intersection'](_0x15ee77[_0x19b3('0x36')],qs[_0x19b3('0x38')](_0x4ade87[_0x19b3('0x32')][_0x19b3('0x38')]));_0x458e02[_0x19b3('0x37')]=_0x458e02['attributes'][_0x19b3('0x39')]?_0x458e02[_0x19b3('0x37')]:_0x15ee77[_0x19b3('0x36')];_0x458e02[_0x19b3('0x3b')]=qs['sort'](_0x4ade87[_0x19b3('0x32')][_0x19b3('0x3c')]);_0x458e02[_0x19b3('0x3d')]=qs['filters'](_[_0x19b3('0x51')](_0x4ade87[_0x19b3('0x32')],_0x15ee77[_0x19b3('0x34')]));if(_0x4ade87[_0x19b3('0x32')][_0x19b3('0x3e')]){_0x458e02[_0x19b3('0x3d')]=_[_0x19b3('0x3f')](_0x458e02[_0x19b3('0x3d')],{'$or':_[_0x19b3('0x2d')](_0x458e02['attributes'],function(_0x42b418){var _0x2239bc={};_0x2239bc[_0x42b418]={'$like':'%'+_0x4ade87[_0x19b3('0x32')][_0x19b3('0x3e')]+'%'};return _0x2239bc;})});}_0x458e02=_[_0x19b3('0x3f')]({},_0x458e02,_0x4ade87[_0x19b3('0x42')]);return _0x123a1e['getSubjects'](_0x458e02);}})[_0x19b3('0x28')](function(_0x2524be){if(_0x2524be){_0x1906ce=_0x2524be[_0x19b3('0x39')];if(!_0x4ade87['query'][_0x19b3('0x3a')]('nolimit')){_0x458e02['limit']=qs['limit'](_0x4ade87[_0x19b3('0x32')][_0x19b3('0x21')]);_0x458e02[_0x19b3('0x20')]=qs[_0x19b3('0x20')](_0x4ade87[_0x19b3('0x32')][_0x19b3('0x20')]);}return _0x123a1e[_0x19b3('0x4e')](_0x458e02);}})[_0x19b3('0x28')](function(_0x246719){if(_0x246719){return _0x246719?{'count':_0x1906ce,'rows':_0x246719}:null;}})[_0x19b3('0x28')](respondWithResult(_0x4b9d05,null))[_0x19b3('0x49')](handleError(_0x4b9d05,null));};exports[_0x19b3('0x52')]=function(_0x321202,_0xb0a5f9,_0x58fff3){var _0x38447={};var _0x47978b={};var _0x445aba;var _0x21be80;return db[_0x19b3('0x2e')][_0x19b3('0x4f')]({'where':{'id':_0x321202[_0x19b3('0x4c')]['id']}})[_0x19b3('0x28')](handleEntityNotFound(_0xb0a5f9,null))[_0x19b3('0x28')](function(_0x159224){if(_0x159224){_0x445aba=_0x159224;_0x47978b[_0x19b3('0x36')]=_['keys'](db[_0x19b3('0x50')][_0x19b3('0x2f')]);_0x47978b[_0x19b3('0x32')]=_[_0x19b3('0x33')](_0x321202['query']);_0x47978b[_0x19b3('0x34')]=_['intersection'](_0x47978b[_0x19b3('0x36')],_0x47978b[_0x19b3('0x32')]);_0x38447[_0x19b3('0x37')]=_[_0x19b3('0x35')](_0x47978b[_0x19b3('0x36')],qs['fields'](_0x321202['query']['fields']));_0x38447['attributes']=_0x38447[_0x19b3('0x37')]['length']?_0x38447[_0x19b3('0x37')]:_0x47978b[_0x19b3('0x36')];_0x38447[_0x19b3('0x3b')]=qs[_0x19b3('0x3c')](_0x321202['query']['sort']);_0x38447[_0x19b3('0x3d')]=qs[_0x19b3('0x34')](_['pick'](_0x321202['query'],_0x47978b[_0x19b3('0x34')]));if(_0x321202[_0x19b3('0x32')][_0x19b3('0x3e')]){_0x38447['where']=_[_0x19b3('0x3f')](_0x38447[_0x19b3('0x3d')],{'$or':_[_0x19b3('0x2d')](_0x38447[_0x19b3('0x37')],function(_0x32c78b){var _0xf932ab={};_0xf932ab[_0x32c78b]={'$like':'%'+_0x321202[_0x19b3('0x32')][_0x19b3('0x3e')]+'%'};return _0xf932ab;})});}_0x38447=_[_0x19b3('0x3f')]({},_0x38447,_0x321202[_0x19b3('0x42')]);return _0x445aba['getDescriptions'](_0x38447);}})[_0x19b3('0x28')](function(_0x5924bd){if(_0x5924bd){_0x21be80=_0x5924bd[_0x19b3('0x39')];if(!_0x321202['query'][_0x19b3('0x3a')](_0x19b3('0x53'))){_0x38447['limit']=qs['limit'](_0x321202[_0x19b3('0x32')]['limit']);_0x38447[_0x19b3('0x20')]=qs['offset'](_0x321202[_0x19b3('0x32')][_0x19b3('0x20')]);}return _0x445aba[_0x19b3('0x52')](_0x38447);}})[_0x19b3('0x28')](function(_0x5e9070){if(_0x5e9070){return _0x5e9070?{'count':_0x21be80,'rows':_0x5e9070}:null;}})[_0x19b3('0x28')](respondWithResult(_0xb0a5f9,null))[_0x19b3('0x49')](handleError(_0xb0a5f9,null));};exports[_0x19b3('0x54')]=function(_0x50a5ff,_0x542165,_0x1e9f1e){var _0x185dc9={};var _0x26f6af={};var _0x311034;var _0x15675f;return db[_0x19b3('0x2e')]['findOne']({'where':{'id':_0x50a5ff[_0x19b3('0x4c')]['id']}})[_0x19b3('0x28')](handleEntityNotFound(_0x542165,null))[_0x19b3('0x28')](function(_0x54a302){if(_0x54a302){_0x311034=_0x54a302;_0x26f6af[_0x19b3('0x36')]=_[_0x19b3('0x33')](db[_0x19b3('0x50')][_0x19b3('0x2f')]);_0x26f6af[_0x19b3('0x32')]=_['keys'](_0x50a5ff['query']);_0x26f6af['filters']=_[_0x19b3('0x35')](_0x26f6af[_0x19b3('0x36')],_0x26f6af['query']);_0x185dc9[_0x19b3('0x37')]=_[_0x19b3('0x35')](_0x26f6af['model'],qs[_0x19b3('0x38')](_0x50a5ff['query'][_0x19b3('0x38')]));_0x185dc9[_0x19b3('0x37')]=_0x185dc9['attributes'][_0x19b3('0x39')]?_0x185dc9['attributes']:_0x26f6af[_0x19b3('0x36')];_0x185dc9[_0x19b3('0x3b')]=qs[_0x19b3('0x3c')](_0x50a5ff[_0x19b3('0x32')][_0x19b3('0x3c')]);_0x185dc9['where']=qs[_0x19b3('0x34')](_[_0x19b3('0x51')](_0x50a5ff[_0x19b3('0x32')],_0x26f6af[_0x19b3('0x34')]));if(_0x50a5ff[_0x19b3('0x32')]['filter']){_0x185dc9[_0x19b3('0x3d')]=_[_0x19b3('0x3f')](_0x185dc9[_0x19b3('0x3d')],{'$or':_[_0x19b3('0x2d')](_0x185dc9[_0x19b3('0x37')],function(_0x347aaa){var _0x41c8f6={};_0x41c8f6[_0x347aaa]={'$like':'%'+_0x50a5ff[_0x19b3('0x32')]['filter']+'%'};return _0x41c8f6;})});}_0x185dc9=_[_0x19b3('0x3f')]({},_0x185dc9,_0x50a5ff['options']);return _0x311034[_0x19b3('0x54')](_0x185dc9);}})[_0x19b3('0x28')](function(_0x2369f0){if(_0x2369f0){_0x15675f=_0x2369f0[_0x19b3('0x39')];if(!_0x50a5ff[_0x19b3('0x32')][_0x19b3('0x3a')]('nolimit')){_0x185dc9['limit']=qs[_0x19b3('0x21')](_0x50a5ff['query'][_0x19b3('0x21')]);_0x185dc9[_0x19b3('0x20')]=qs['offset'](_0x50a5ff['query'][_0x19b3('0x20')]);}return _0x311034[_0x19b3('0x54')](_0x185dc9);}})['then'](function(_0x57985e){if(_0x57985e){return _0x57985e?{'count':_0x15675f,'rows':_0x57985e}:null;}})[_0x19b3('0x28')](respondWithResult(_0x542165,null))[_0x19b3('0x49')](handleError(_0x542165,null));}; \ No newline at end of file +var _0x271d=['desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','filters','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','includeAll','include','rows','show','params','keys','intersection','merge','catch','create','body','find','destroy','FreshsalesField','sort','options','getSubjects','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x5d64ac,_0x46e6fa){var _0x2f5c48=function(_0x5b3a85){while(--_0x5b3a85){_0x5d64ac['push'](_0x5d64ac['shift']());}};_0x2f5c48(++_0x46e6fa);}(_0x271d,0x12e));var _0xd271=function(_0x2ee200,_0x3e031d){_0x2ee200=_0x2ee200-0x0;var _0x400f8e=_0x271d[_0x2ee200];return _0x400f8e;};'use strict';var emlformat=require(_0xd271('0x0'));var rimraf=require(_0xd271('0x1'));var zipdir=require(_0xd271('0x2'));var jsonpatch=require(_0xd271('0x3'));var rp=require('request-promise');var moment=require(_0xd271('0x4'));var BPromise=require(_0xd271('0x5'));var Mustache=require(_0xd271('0x6'));var util=require(_0xd271('0x7'));var path=require(_0xd271('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd271('0x9'));var fs=require('fs');var fs_extra=require(_0xd271('0xa'));var _=require('lodash');var squel=require(_0xd271('0xb'));var crypto=require(_0xd271('0xc'));var jsforce=require(_0xd271('0xd'));var deskjs=require(_0xd271('0xe'));var toCsv=require(_0xd271('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd271('0x10'));var authService=require(_0xd271('0x11'));var qs=require(_0xd271('0x12'));var as=require(_0xd271('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd271('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xd271('0x15'));var licenseUtil=require(_0xd271('0x16'));var db=require(_0xd271('0x17'))['db'];function respondWithStatusCode(_0x51a214,_0x1706ff){_0x1706ff=_0x1706ff||0xcc;return function(_0x3fb9ea){if(_0x3fb9ea){return _0x51a214[_0xd271('0x18')](_0x1706ff);}return _0x51a214[_0xd271('0x19')](_0x1706ff)[_0xd271('0x1a')]();};}function respondWithResult(_0x210f7c,_0x51a9b3){_0x51a9b3=_0x51a9b3||0xc8;return function(_0x4aec33){if(_0x4aec33){return _0x210f7c['status'](_0x51a9b3)[_0xd271('0x1b')](_0x4aec33);}};}function respondWithFilteredResult(_0x2fc2ad,_0x3ffada){return function(_0x19fecb){if(_0x19fecb){var _0x2f8073=typeof _0x3ffada['offset']==='undefined'&&typeof _0x3ffada['limit']==='undefined';var _0x57546e=_0x19fecb[_0xd271('0x1c')];var _0x2285af=_0x2f8073?0x0:_0x3ffada[_0xd271('0x1d')];var _0xe4a981=_0x2f8073?_0x19fecb[_0xd271('0x1c')]:_0x3ffada[_0xd271('0x1d')]+_0x3ffada[_0xd271('0x1e')];var _0x178304;if(_0xe4a981>=_0x57546e){_0xe4a981=_0x57546e;_0x178304=0xc8;}else{_0x178304=0xce;}_0x2fc2ad[_0xd271('0x19')](_0x178304);return _0x2fc2ad['set']('Content-Range',_0x2285af+'-'+_0xe4a981+'/'+_0x57546e)['json'](_0x19fecb);}return null;};}function patchUpdates(_0x5b5fb8){return function(_0x510819){try{jsonpatch[_0xd271('0x1f')](_0x510819,_0x5b5fb8,!![]);}catch(_0x301b86){return BPromise[_0xd271('0x20')](_0x301b86);}return _0x510819['save']();};}function saveUpdates(_0x4b2bbe,_0x4c5990){return function(_0x559029){if(_0x559029){return _0x559029[_0xd271('0x21')](_0x4b2bbe)[_0xd271('0x22')](function(_0x5db292){return _0x5db292;});}return null;};}function removeEntity(_0x1adf8e,_0x12d329){return function(_0x1ba04e){if(_0x1ba04e){return _0x1ba04e['destroy']()[_0xd271('0x22')](function(){_0x1adf8e[_0xd271('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4176e1,_0x6715ae){return function(_0x434099){if(!_0x434099){_0x4176e1[_0xd271('0x18')](0x194);}return _0x434099;};}function handleError(_0x5713f1,_0x11c227){_0x11c227=_0x11c227||0x1f4;return function(_0x4c84a5){logger[_0xd271('0x23')](_0x4c84a5[_0xd271('0x24')]);if(_0x4c84a5[_0xd271('0x25')]){delete _0x4c84a5[_0xd271('0x25')];}_0x5713f1[_0xd271('0x19')](_0x11c227)[_0xd271('0x26')](_0x4c84a5);};}exports[_0xd271('0x27')]=function(_0x566a9e,_0x1c2715){var _0x4dac88={},_0x1a6066={},_0x4ae881={'count':0x0,'rows':[]};var _0x90af78=_[_0xd271('0x28')](db[_0xd271('0x29')][_0xd271('0x2a')],function(_0x5b0267){return{'name':_0x5b0267[_0xd271('0x2b')],'type':_0x5b0267[_0xd271('0x2c')][_0xd271('0x2d')]};});_0x1a6066['model']=_['map'](_0x90af78,'name');_0x1a6066['query']=_['keys'](_0x566a9e['query']);_0x1a6066[_0xd271('0x2e')]=_['intersection'](_0x1a6066[_0xd271('0x2f')],_0x1a6066['query']);_0x4dac88[_0xd271('0x30')]=_['intersection'](_0x1a6066['model'],qs[_0xd271('0x31')](_0x566a9e[_0xd271('0x32')][_0xd271('0x31')]));_0x4dac88[_0xd271('0x30')]=_0x4dac88[_0xd271('0x30')][_0xd271('0x33')]?_0x4dac88[_0xd271('0x30')]:_0x1a6066[_0xd271('0x2f')];if(!_0x566a9e[_0xd271('0x32')][_0xd271('0x34')](_0xd271('0x35'))){_0x4dac88['limit']=qs[_0xd271('0x1e')](_0x566a9e[_0xd271('0x32')]['limit']);_0x4dac88[_0xd271('0x1d')]=qs[_0xd271('0x1d')](_0x566a9e[_0xd271('0x32')]['offset']);}_0x4dac88[_0xd271('0x36')]=qs['sort'](_0x566a9e[_0xd271('0x32')]['sort']);_0x4dac88[_0xd271('0x37')]=qs['filters'](_[_0xd271('0x38')](_0x566a9e[_0xd271('0x32')],_0x1a6066[_0xd271('0x2e')]),_0x90af78);if(_0x566a9e[_0xd271('0x32')][_0xd271('0x39')]){_0x4dac88[_0xd271('0x37')]=_['merge'](_0x4dac88['where'],{'$or':_[_0xd271('0x28')](_0x90af78,function(_0x22fdda){if(_0x22fdda[_0xd271('0x2c')]!==_0xd271('0x3a')){var _0x46a99e={};_0x46a99e[_0x22fdda[_0xd271('0x25')]]={'$like':'%'+_0x566a9e[_0xd271('0x32')][_0xd271('0x39')]+'%'};return _0x46a99e;}})});}_0x4dac88=_['merge']({},_0x4dac88,_0x566a9e['options']);var _0x369343={'where':_0x4dac88['where']};return db[_0xd271('0x29')][_0xd271('0x1c')](_0x369343)[_0xd271('0x22')](function(_0x37e9ef){_0x4ae881[_0xd271('0x1c')]=_0x37e9ef;if(_0x566a9e[_0xd271('0x32')][_0xd271('0x3b')]){_0x4dac88[_0xd271('0x3c')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x4dac88);})[_0xd271('0x22')](function(_0x5f20cd){_0x4ae881[_0xd271('0x3d')]=_0x5f20cd;return _0x4ae881;})[_0xd271('0x22')](respondWithFilteredResult(_0x1c2715,_0x4dac88))['catch'](handleError(_0x1c2715,null));};exports[_0xd271('0x3e')]=function(_0x583195,_0x5693ae){var _0x2cb01b={'raw':![],'where':{'id':_0x583195[_0xd271('0x3f')]['id']}},_0x5902af={};_0x5902af['model']=_[_0xd271('0x40')](db[_0xd271('0x29')][_0xd271('0x2a')]);_0x5902af['query']=_[_0xd271('0x40')](_0x583195['query']);_0x5902af[_0xd271('0x2e')]=_[_0xd271('0x41')](_0x5902af[_0xd271('0x2f')],_0x5902af['query']);_0x2cb01b[_0xd271('0x30')]=_[_0xd271('0x41')](_0x5902af[_0xd271('0x2f')],qs[_0xd271('0x31')](_0x583195['query'][_0xd271('0x31')]));_0x2cb01b[_0xd271('0x30')]=_0x2cb01b[_0xd271('0x30')][_0xd271('0x33')]?_0x2cb01b[_0xd271('0x30')]:_0x5902af['model'];if(_0x583195['query'][_0xd271('0x3b')]){_0x2cb01b['include']=[{'all':!![]}];}_0x2cb01b=_[_0xd271('0x42')]({},_0x2cb01b,_0x583195['options']);return db['FreshsalesConfiguration']['find'](_0x2cb01b)['then'](handleEntityNotFound(_0x5693ae,null))[_0xd271('0x22')](respondWithResult(_0x5693ae,null))[_0xd271('0x43')](handleError(_0x5693ae,null));};exports[_0xd271('0x44')]=function(_0x49bde1,_0x5e6687){return db[_0xd271('0x29')]['create'](_0x49bde1[_0xd271('0x45')],{})[_0xd271('0x22')](respondWithResult(_0x5e6687,0xc9))[_0xd271('0x43')](handleError(_0x5e6687,null));};exports[_0xd271('0x21')]=function(_0x120622,_0x5df5a4){if(_0x120622[_0xd271('0x45')]['id']){delete _0x120622[_0xd271('0x45')]['id'];}return db[_0xd271('0x29')][_0xd271('0x46')]({'where':{'id':_0x120622[_0xd271('0x3f')]['id']}})[_0xd271('0x22')](handleEntityNotFound(_0x5df5a4,null))['then'](saveUpdates(_0x120622[_0xd271('0x45')],null))[_0xd271('0x22')](respondWithResult(_0x5df5a4,null))['catch'](handleError(_0x5df5a4,null));};exports[_0xd271('0x47')]=function(_0x41475a,_0x4eb9a0){return db[_0xd271('0x29')][_0xd271('0x46')]({'where':{'id':_0x41475a['params']['id']}})['then'](handleEntityNotFound(_0x4eb9a0,null))['then'](removeEntity(_0x4eb9a0,null))[_0xd271('0x43')](handleError(_0x4eb9a0,null));};exports['getSubjects']=function(_0x1310d1,_0xd0cb01,_0x1cdb0a){var _0x314bea={};var _0x5d7141={};var _0x25a894;var _0x51497b;return db[_0xd271('0x29')]['findOne']({'where':{'id':_0x1310d1[_0xd271('0x3f')]['id']}})[_0xd271('0x22')](handleEntityNotFound(_0xd0cb01,null))['then'](function(_0x34d824){if(_0x34d824){_0x25a894=_0x34d824;_0x5d7141[_0xd271('0x2f')]=_[_0xd271('0x40')](db[_0xd271('0x48')][_0xd271('0x2a')]);_0x5d7141[_0xd271('0x32')]=_[_0xd271('0x40')](_0x1310d1['query']);_0x5d7141[_0xd271('0x2e')]=_[_0xd271('0x41')](_0x5d7141[_0xd271('0x2f')],_0x5d7141[_0xd271('0x32')]);_0x314bea[_0xd271('0x30')]=_['intersection'](_0x5d7141[_0xd271('0x2f')],qs[_0xd271('0x31')](_0x1310d1[_0xd271('0x32')][_0xd271('0x31')]));_0x314bea[_0xd271('0x30')]=_0x314bea[_0xd271('0x30')][_0xd271('0x33')]?_0x314bea[_0xd271('0x30')]:_0x5d7141['model'];_0x314bea[_0xd271('0x36')]=qs[_0xd271('0x49')](_0x1310d1['query'][_0xd271('0x49')]);_0x314bea[_0xd271('0x37')]=qs[_0xd271('0x2e')](_[_0xd271('0x38')](_0x1310d1[_0xd271('0x32')],_0x5d7141[_0xd271('0x2e')]));if(_0x1310d1[_0xd271('0x32')][_0xd271('0x39')]){_0x314bea[_0xd271('0x37')]=_['merge'](_0x314bea[_0xd271('0x37')],{'$or':_[_0xd271('0x28')](_0x314bea[_0xd271('0x30')],function(_0x321765){var _0x625eaa={};_0x625eaa[_0x321765]={'$like':'%'+_0x1310d1[_0xd271('0x32')][_0xd271('0x39')]+'%'};return _0x625eaa;})});}_0x314bea=_[_0xd271('0x42')]({},_0x314bea,_0x1310d1[_0xd271('0x4a')]);return _0x25a894[_0xd271('0x4b')](_0x314bea);}})[_0xd271('0x22')](function(_0x17a7e2){if(_0x17a7e2){_0x51497b=_0x17a7e2[_0xd271('0x33')];if(!_0x1310d1['query']['hasOwnProperty']('nolimit')){_0x314bea[_0xd271('0x1e')]=qs['limit'](_0x1310d1[_0xd271('0x32')][_0xd271('0x1e')]);_0x314bea[_0xd271('0x1d')]=qs[_0xd271('0x1d')](_0x1310d1[_0xd271('0x32')][_0xd271('0x1d')]);}return _0x25a894['getSubjects'](_0x314bea);}})[_0xd271('0x22')](function(_0x42aeb7){if(_0x42aeb7){return _0x42aeb7?{'count':_0x51497b,'rows':_0x42aeb7}:null;}})[_0xd271('0x22')](respondWithResult(_0xd0cb01,null))[_0xd271('0x43')](handleError(_0xd0cb01,null));};exports[_0xd271('0x4c')]=function(_0x3d2bcb,_0x103c0e,_0x21fdaf){var _0x23825a={};var _0x2e0773={};var _0x37cb79;var _0x293dfb;return db['FreshsalesConfiguration'][_0xd271('0x4d')]({'where':{'id':_0x3d2bcb[_0xd271('0x3f')]['id']}})['then'](handleEntityNotFound(_0x103c0e,null))['then'](function(_0x21ab1e){if(_0x21ab1e){_0x37cb79=_0x21ab1e;_0x2e0773[_0xd271('0x2f')]=_[_0xd271('0x40')](db[_0xd271('0x48')][_0xd271('0x2a')]);_0x2e0773['query']=_[_0xd271('0x40')](_0x3d2bcb['query']);_0x2e0773[_0xd271('0x2e')]=_['intersection'](_0x2e0773[_0xd271('0x2f')],_0x2e0773[_0xd271('0x32')]);_0x23825a['attributes']=_[_0xd271('0x41')](_0x2e0773[_0xd271('0x2f')],qs['fields'](_0x3d2bcb[_0xd271('0x32')][_0xd271('0x31')]));_0x23825a[_0xd271('0x30')]=_0x23825a['attributes'][_0xd271('0x33')]?_0x23825a['attributes']:_0x2e0773[_0xd271('0x2f')];_0x23825a['order']=qs[_0xd271('0x49')](_0x3d2bcb[_0xd271('0x32')][_0xd271('0x49')]);_0x23825a[_0xd271('0x37')]=qs[_0xd271('0x2e')](_[_0xd271('0x38')](_0x3d2bcb['query'],_0x2e0773[_0xd271('0x2e')]));if(_0x3d2bcb[_0xd271('0x32')][_0xd271('0x39')]){_0x23825a['where']=_[_0xd271('0x42')](_0x23825a['where'],{'$or':_['map'](_0x23825a['attributes'],function(_0x56f5a3){var _0x13a67d={};_0x13a67d[_0x56f5a3]={'$like':'%'+_0x3d2bcb[_0xd271('0x32')]['filter']+'%'};return _0x13a67d;})});}_0x23825a=_[_0xd271('0x42')]({},_0x23825a,_0x3d2bcb[_0xd271('0x4a')]);return _0x37cb79[_0xd271('0x4c')](_0x23825a);}})[_0xd271('0x22')](function(_0x940346){if(_0x940346){_0x293dfb=_0x940346[_0xd271('0x33')];if(!_0x3d2bcb[_0xd271('0x32')]['hasOwnProperty'](_0xd271('0x35'))){_0x23825a[_0xd271('0x1e')]=qs[_0xd271('0x1e')](_0x3d2bcb[_0xd271('0x32')][_0xd271('0x1e')]);_0x23825a['offset']=qs[_0xd271('0x1d')](_0x3d2bcb[_0xd271('0x32')][_0xd271('0x1d')]);}return _0x37cb79['getDescriptions'](_0x23825a);}})['then'](function(_0x55fb9a){if(_0x55fb9a){return _0x55fb9a?{'count':_0x293dfb,'rows':_0x55fb9a}:null;}})[_0xd271('0x22')](respondWithResult(_0x103c0e,null))['catch'](handleError(_0x103c0e,null));};exports['getFields']=function(_0x34c162,_0x2e69d6,_0x321c2f){var _0x231132={};var _0x5252c3={};var _0x46ab66;var _0x6a18bb;return db['FreshsalesConfiguration'][_0xd271('0x4d')]({'where':{'id':_0x34c162[_0xd271('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e69d6,null))[_0xd271('0x22')](function(_0x343a3c){if(_0x343a3c){_0x46ab66=_0x343a3c;_0x5252c3['model']=_[_0xd271('0x40')](db[_0xd271('0x48')][_0xd271('0x2a')]);_0x5252c3['query']=_[_0xd271('0x40')](_0x34c162[_0xd271('0x32')]);_0x5252c3[_0xd271('0x2e')]=_[_0xd271('0x41')](_0x5252c3[_0xd271('0x2f')],_0x5252c3[_0xd271('0x32')]);_0x231132[_0xd271('0x30')]=_[_0xd271('0x41')](_0x5252c3[_0xd271('0x2f')],qs['fields'](_0x34c162[_0xd271('0x32')]['fields']));_0x231132[_0xd271('0x30')]=_0x231132[_0xd271('0x30')][_0xd271('0x33')]?_0x231132['attributes']:_0x5252c3[_0xd271('0x2f')];_0x231132[_0xd271('0x36')]=qs['sort'](_0x34c162[_0xd271('0x32')][_0xd271('0x49')]);_0x231132[_0xd271('0x37')]=qs[_0xd271('0x2e')](_[_0xd271('0x38')](_0x34c162[_0xd271('0x32')],_0x5252c3['filters']));if(_0x34c162[_0xd271('0x32')][_0xd271('0x39')]){_0x231132[_0xd271('0x37')]=_['merge'](_0x231132['where'],{'$or':_[_0xd271('0x28')](_0x231132[_0xd271('0x30')],function(_0x1cd021){var _0x50aa46={};_0x50aa46[_0x1cd021]={'$like':'%'+_0x34c162[_0xd271('0x32')]['filter']+'%'};return _0x50aa46;})});}_0x231132=_[_0xd271('0x42')]({},_0x231132,_0x34c162[_0xd271('0x4a')]);return _0x46ab66[_0xd271('0x4e')](_0x231132);}})[_0xd271('0x22')](function(_0x4ff44b){if(_0x4ff44b){_0x6a18bb=_0x4ff44b['length'];if(!_0x34c162['query'][_0xd271('0x34')](_0xd271('0x35'))){_0x231132[_0xd271('0x1e')]=qs[_0xd271('0x1e')](_0x34c162[_0xd271('0x32')][_0xd271('0x1e')]);_0x231132[_0xd271('0x1d')]=qs[_0xd271('0x1d')](_0x34c162['query'][_0xd271('0x1d')]);}return _0x46ab66['getFields'](_0x231132);}})[_0xd271('0x22')](function(_0x48a5d9){if(_0x48a5d9){return _0x48a5d9?{'count':_0x6a18bb,'rows':_0x48a5d9}:null;}})[_0xd271('0x22')](respondWithResult(_0x2e69d6,null))[_0xd271('0x43')](handleError(_0x2e69d6,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1dc431c..63a9301 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 _0xd48c=['int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration'];(function(_0xfb9496,_0x25909d){var _0x466fbb=function(_0x106cbc){while(--_0x106cbc){_0xfb9496['push'](_0xfb9496['shift']());}};_0x466fbb(++_0x25909d);}(_0xd48c,0x18d));var _0xcd48=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0xd48c[_0x132558];return _0x34f138;};'use strict';var _=require('lodash');var util=require(_0xcd48('0x0'));var logger=require(_0xcd48('0x1'))(_0xcd48('0x2'));var moment=require(_0xcd48('0x3'));var BPromise=require(_0xcd48('0x4'));var rp=require(_0xcd48('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd48('0x6'));var config=require(_0xcd48('0x7'));var attributes=require(_0xcd48('0x8'));module['exports']=function(_0x3737d8,_0x18080e){return _0x3737d8[_0xcd48('0x9')](_0xcd48('0xa'),attributes,{'tableName':_0xcd48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x682d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x682d,0x1c0));var _0xd682=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x682d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd682('0x0'));var util=require(_0xd682('0x1'));var logger=require(_0xd682('0x2'))(_0xd682('0x3'));var moment=require(_0xd682('0x4'));var BPromise=require(_0xd682('0x5'));var rp=require(_0xd682('0x6'));var fs=require('fs');var path=require(_0xd682('0x7'));var rimraf=require(_0xd682('0x8'));var config=require(_0xd682('0x9'));var attributes=require(_0xd682('0xa'));module[_0xd682('0xb')]=function(_0x49aeeb,_0x4a4105){return _0x49aeeb[_0xd682('0xc')](_0xd682('0xd'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6b23d42..5ef54c6 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 _0xb0ab=['request\x20sent','debug','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xb0ab,0x14b));var _0xbb0a=function(_0x5bdf38,_0x243cae){_0x5bdf38=_0x5bdf38-0x0;var _0x56c541=_0xb0ab[_0x5bdf38];return _0x56c541;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbb0a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb0a('0x1'));var db=require(_0xbb0a('0x2'))['db'];var utils=require(_0xbb0a('0x3'));var logger=require(_0xbb0a('0x4'))('rpc');var config=require(_0xbb0a('0x5'));var jayson=require(_0xbb0a('0x6'));var client=jayson[_0xbb0a('0x7')][_0xbb0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d1739,_0x3446e4,_0xdc12bf){return new BPromise(function(_0x16a89f,_0x59b2e0){return client['request'](_0x4d1739,_0xdc12bf)[_0xbb0a('0x9')](function(_0x22f7bb){logger[_0xbb0a('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x3446e4,_0xbb0a('0xb'));logger[_0xbb0a('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x3446e4,_0xbb0a('0xb'),JSON[_0xbb0a('0xd')](_0x22f7bb));if(_0x22f7bb[_0xbb0a('0xe')]){if(_0x22f7bb[_0xbb0a('0xe')]['code']===0x1f4){logger['error'](_0xbb0a('0xf'),_0x3446e4,_0x22f7bb[_0xbb0a('0xe')][_0xbb0a('0x10')]);return _0x59b2e0(_0x22f7bb[_0xbb0a('0xe')][_0xbb0a('0x10')]);}logger[_0xbb0a('0xe')](_0xbb0a('0xf'),_0x3446e4,_0x22f7bb[_0xbb0a('0xe')][_0xbb0a('0x10')]);return _0x16a89f(_0x22f7bb[_0xbb0a('0xe')][_0xbb0a('0x10')]);}else{logger[_0xbb0a('0xa')](_0xbb0a('0xf'),_0x3446e4,'request\x20sent');_0x16a89f(_0x22f7bb[_0xbb0a('0x11')]['message']);}})[_0xbb0a('0x12')](function(_0x4373a2){logger[_0xbb0a('0xe')](_0xbb0a('0xf'),_0x3446e4,_0x4373a2);_0x59b2e0(_0x4373a2);});});} \ No newline at end of file +var _0x778e=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','util'];(function(_0x572cf3,_0x59c689){var _0x52882d=function(_0x1678ea){while(--_0x1678ea){_0x572cf3['push'](_0x572cf3['shift']());}};_0x52882d(++_0x59c689);}(_0x778e,0x1cb));var _0xe778=function(_0x310b96,_0x15edd6){_0x310b96=_0x310b96-0x0;var _0x37f8eb=_0x778e[_0x310b96];return _0x37f8eb;};'use strict';var _=require('lodash');var util=require(_0xe778('0x0'));var moment=require(_0xe778('0x1'));var BPromise=require(_0xe778('0x2'));var rs=require(_0xe778('0x3'));var fs=require('fs');var Redis=require(_0xe778('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe778('0x5'));var logger=require(_0xe778('0x6'))(_0xe778('0x7'));var config=require('../../config/environment');var jayson=require(_0xe778('0x8'));var client=jayson[_0xe778('0x9')][_0xe778('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2304c0,_0x9587e3,_0x468aa2){return new BPromise(function(_0x223af7,_0x3075f0){return client['request'](_0x2304c0,_0x468aa2)[_0xe778('0xb')](function(_0x232324){logger[_0xe778('0xc')](_0xe778('0xd'),_0x9587e3,'request\x20sent');logger['debug'](_0xe778('0xe'),_0x9587e3,'request\x20sent',JSON[_0xe778('0xf')](_0x232324));if(_0x232324[_0xe778('0x10')]){if(_0x232324[_0xe778('0x10')]['code']===0x1f4){logger['error'](_0xe778('0xd'),_0x9587e3,_0x232324[_0xe778('0x10')][_0xe778('0x11')]);return _0x3075f0(_0x232324['error'][_0xe778('0x11')]);}logger[_0xe778('0x10')](_0xe778('0xd'),_0x9587e3,_0x232324[_0xe778('0x10')]['message']);return _0x223af7(_0x232324[_0xe778('0x10')][_0xe778('0x11')]);}else{logger['info'](_0xe778('0xd'),_0x9587e3,_0xe778('0x12'));_0x223af7(_0x232324['result'][_0xe778('0x11')]);}})[_0xe778('0x13')](function(_0x5b0f24){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x9587e3,_0x5b0f24);_0x3075f0(_0x5b0f24);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index f826102..f62a90d 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 _0x9bb4=['post','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x23e815,_0x142a7b){var _0x24c718=function(_0xb2417){while(--_0xb2417){_0x23e815['push'](_0x23e815['shift']());}};_0x24c718(++_0x142a7b);}(_0x9bb4,0xd5));var _0x49bb=function(_0x252e66,_0x41d260){_0x252e66=_0x252e66-0x0;var _0x269856=_0x9bb4[_0x252e66];return _0x269856;};'use strict';var multer=require(_0x49bb('0x0'));var util=require(_0x49bb('0x1'));var path=require(_0x49bb('0x2'));var timeout=require(_0x49bb('0x3'));var express=require(_0x49bb('0x4'));var router=express[_0x49bb('0x5')]();var fs_extra=require(_0x49bb('0x6'));var auth=require(_0x49bb('0x7'));var interaction=require(_0x49bb('0x8'));var config=require('../../config/environment');var controller=require(_0x49bb('0x9'));router[_0x49bb('0xa')]('/',auth[_0x49bb('0xb')](),controller[_0x49bb('0xc')]);router['get'](_0x49bb('0xd'),auth[_0x49bb('0xb')](),controller[_0x49bb('0xe')]);router[_0x49bb('0xf')]('/',auth[_0x49bb('0xb')](),controller['create']);router[_0x49bb('0x10')]('/:id',auth[_0x49bb('0xb')](),controller[_0x49bb('0x11')]);router['delete'](_0x49bb('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x49bb('0x12')]=router; \ No newline at end of file +var _0xa25c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','index','/:id','isAuthenticated','show','post','update','delete','util'];(function(_0x163a9d,_0xe9c3a){var _0x5b89fb=function(_0x33efd5){while(--_0x33efd5){_0x163a9d['push'](_0x163a9d['shift']());}};_0x5b89fb(++_0xe9c3a);}(_0xa25c,0x13f));var _0xca25=function(_0x3e5e9f,_0x5fef20){_0x3e5e9f=_0x3e5e9f-0x0;var _0x25bf34=_0xa25c[_0x3e5e9f];return _0x25bf34;};'use strict';var multer=require('multer');var util=require(_0xca25('0x0'));var path=require(_0xca25('0x1'));var timeout=require(_0xca25('0x2'));var express=require(_0xca25('0x3'));var router=express[_0xca25('0x4')]();var fs_extra=require(_0xca25('0x5'));var auth=require(_0xca25('0x6'));var interaction=require(_0xca25('0x7'));var config=require('../../config/environment');var controller=require(_0xca25('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xca25('0x9')]);router['get'](_0xca25('0xa'),auth[_0xca25('0xb')](),controller[_0xca25('0xc')]);router[_0xca25('0xd')]('/',auth[_0xca25('0xb')](),controller['create']);router['put'](_0xca25('0xa'),auth['isAuthenticated'](),controller[_0xca25('0xe')]);router[_0xca25('0xf')](_0xca25('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 114b3e5..0303dd3 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 _0xa817=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize','exports'];(function(_0x97d8a6,_0x24b83f){var _0x4bb63f=function(_0x2f9238){while(--_0x2f9238){_0x97d8a6['push'](_0x97d8a6['shift']());}};_0x4bb63f(++_0x24b83f);}(_0xa817,0xfe));var _0x7a81=function(_0x250119,_0x221c37){_0x250119=_0x250119-0x0;var _0x201b20=_0xa817[_0x250119];return _0x201b20;};'use strict';var Sequelize=require(_0x7a81('0x0'));module[_0x7a81('0x1')]={'type':{'type':Sequelize[_0x7a81('0x2')](_0x7a81('0x3'),_0x7a81('0x4'),'customVariable',_0x7a81('0x5'),'picklist'),'defaultValue':_0x7a81('0x3')},'content':{'type':Sequelize[_0x7a81('0x6')]},'key':{'type':Sequelize[_0x7a81('0x6')]},'keyType':{'type':Sequelize[_0x7a81('0x2')]('string','variable',_0x7a81('0x7'))},'keyContent':{'type':Sequelize[_0x7a81('0x6')]},'idField':{'type':Sequelize[_0x7a81('0x6')]},'nameField':{'type':Sequelize[_0x7a81('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9ad0=['string','variable','customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x15d2e7,_0x575e70){var _0x2341c8=function(_0x2b0e62){while(--_0x2b0e62){_0x15d2e7['push'](_0x15d2e7['shift']());}};_0x2341c8(++_0x575e70);}(_0x9ad0,0x12b));var _0x09ad=function(_0x51c6c3,_0x3c0726){_0x51c6c3=_0x51c6c3-0x0;var _0x198fd6=_0x9ad0[_0x51c6c3];return _0x198fd6;};'use strict';var Sequelize=require('sequelize');module[_0x09ad('0x0')]={'type':{'type':Sequelize[_0x09ad('0x1')](_0x09ad('0x2'),_0x09ad('0x3'),_0x09ad('0x4'),'keyValue','picklist'),'defaultValue':_0x09ad('0x2')},'content':{'type':Sequelize[_0x09ad('0x5')]},'key':{'type':Sequelize[_0x09ad('0x5')]},'keyType':{'type':Sequelize[_0x09ad('0x1')](_0x09ad('0x2'),_0x09ad('0x3'),_0x09ad('0x4'))},'keyContent':{'type':Sequelize[_0x09ad('0x5')]},'idField':{'type':Sequelize[_0x09ad('0x5')]},'nameField':{'type':Sequelize[_0x09ad('0x5')]},'customField':{'type':Sequelize[_0x09ad('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x09ad('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 4260013..1f7814b 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 _0x0c47=['VIRTUAL','filter','includeAll','include','FreshsalesField','rows','catch','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x50e265,_0x31cf38){var _0x465539=function(_0x3ba2db){while(--_0x3ba2db){_0x50e265['push'](_0x50e265['shift']());}};_0x465539(++_0x31cf38);}(_0x0c47,0x17e));var _0x70c4=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x0c47[_0x1d70db];return _0x3060c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70c4('0x0'));var zipdir=require(_0x70c4('0x1'));var jsonpatch=require(_0x70c4('0x2'));var rp=require(_0x70c4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x70c4('0x4'));var util=require(_0x70c4('0x5'));var path=require('path');var sox=require(_0x70c4('0x6'));var csv=require(_0x70c4('0x7'));var ejs=require(_0x70c4('0x8'));var fs=require('fs');var fs_extra=require(_0x70c4('0x9'));var _=require(_0x70c4('0xa'));var squel=require(_0x70c4('0xb'));var crypto=require(_0x70c4('0xc'));var jsforce=require(_0x70c4('0xd'));var deskjs=require(_0x70c4('0xe'));var toCsv=require(_0x70c4('0x7'));var querystring=require(_0x70c4('0xf'));var Papa=require('papaparse');var Redis=require(_0x70c4('0x10'));var authService=require(_0x70c4('0x11'));var qs=require(_0x70c4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x70c4('0x13'));var utils=require('../../config/utils');var config=require(_0x70c4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x70c4('0x15'))['db'];function respondWithStatusCode(_0x4bbeae,_0x481751){_0x481751=_0x481751||0xcc;return function(_0x4465ba){if(_0x4465ba){return _0x4bbeae[_0x70c4('0x16')](_0x481751);}return _0x4bbeae[_0x70c4('0x17')](_0x481751)[_0x70c4('0x18')]();};}function respondWithResult(_0x505bdb,_0xe9f3b3){_0xe9f3b3=_0xe9f3b3||0xc8;return function(_0x5a3ee2){if(_0x5a3ee2){return _0x505bdb[_0x70c4('0x17')](_0xe9f3b3)[_0x70c4('0x19')](_0x5a3ee2);}};}function respondWithFilteredResult(_0x2a8c78,_0x4dac02){return function(_0x36f412){if(_0x36f412){var _0x5aefb9=typeof _0x4dac02[_0x70c4('0x1a')]===_0x70c4('0x1b')&&typeof _0x4dac02[_0x70c4('0x1c')]===_0x70c4('0x1b');var _0x2f4e8e=_0x36f412[_0x70c4('0x1d')];var _0x20647a=_0x5aefb9?0x0:_0x4dac02[_0x70c4('0x1a')];var _0x2b2670=_0x5aefb9?_0x36f412[_0x70c4('0x1d')]:_0x4dac02[_0x70c4('0x1a')]+_0x4dac02['limit'];var _0x1413a2;if(_0x2b2670>=_0x2f4e8e){_0x2b2670=_0x2f4e8e;_0x1413a2=0xc8;}else{_0x1413a2=0xce;}_0x2a8c78[_0x70c4('0x17')](_0x1413a2);return _0x2a8c78[_0x70c4('0x1e')](_0x70c4('0x1f'),_0x20647a+'-'+_0x2b2670+'/'+_0x2f4e8e)[_0x70c4('0x19')](_0x36f412);}return null;};}function patchUpdates(_0x101234){return function(_0x2a3f9d){try{jsonpatch[_0x70c4('0x20')](_0x2a3f9d,_0x101234,!![]);}catch(_0x302ab7){return BPromise[_0x70c4('0x21')](_0x302ab7);}return _0x2a3f9d[_0x70c4('0x22')]();};}function saveUpdates(_0x44bd6f,_0x1895e2){return function(_0x4b8029){if(_0x4b8029){return _0x4b8029[_0x70c4('0x23')](_0x44bd6f)[_0x70c4('0x24')](function(_0xf36b4f){return _0xf36b4f;});}return null;};}function removeEntity(_0x504e59,_0x2fdaca){return function(_0x44148e){if(_0x44148e){return _0x44148e[_0x70c4('0x25')]()[_0x70c4('0x24')](function(){_0x504e59['status'](0xcc)[_0x70c4('0x18')]();});}};}function handleEntityNotFound(_0x463def,_0x12b434){return function(_0x317ca3){if(!_0x317ca3){_0x463def[_0x70c4('0x16')](0x194);}return _0x317ca3;};}function handleError(_0x201bf0,_0x142967){_0x142967=_0x142967||0x1f4;return function(_0x17d1fc){logger[_0x70c4('0x26')](_0x17d1fc[_0x70c4('0x27')]);if(_0x17d1fc[_0x70c4('0x28')]){delete _0x17d1fc[_0x70c4('0x28')];}_0x201bf0[_0x70c4('0x17')](_0x142967)[_0x70c4('0x29')](_0x17d1fc);};}exports['index']=function(_0x57ce75,_0x2b936b){var _0x5550d5={},_0x421f0a={},_0x3d43b8={'count':0x0,'rows':[]};var _0x887d53=_[_0x70c4('0x2a')](db['FreshsalesField'][_0x70c4('0x2b')],function(_0x15afe0){return{'name':_0x15afe0[_0x70c4('0x2c')],'type':_0x15afe0[_0x70c4('0x2d')][_0x70c4('0x2e')]};});_0x421f0a[_0x70c4('0x2f')]=_[_0x70c4('0x2a')](_0x887d53,'name');_0x421f0a[_0x70c4('0x30')]=_[_0x70c4('0x31')](_0x57ce75[_0x70c4('0x30')]);_0x421f0a[_0x70c4('0x32')]=_[_0x70c4('0x33')](_0x421f0a[_0x70c4('0x2f')],_0x421f0a[_0x70c4('0x30')]);_0x5550d5[_0x70c4('0x34')]=_[_0x70c4('0x33')](_0x421f0a[_0x70c4('0x2f')],qs['fields'](_0x57ce75[_0x70c4('0x30')][_0x70c4('0x35')]));_0x5550d5[_0x70c4('0x34')]=_0x5550d5[_0x70c4('0x34')][_0x70c4('0x36')]?_0x5550d5[_0x70c4('0x34')]:_0x421f0a[_0x70c4('0x2f')];if(!_0x57ce75[_0x70c4('0x30')][_0x70c4('0x37')](_0x70c4('0x38'))){_0x5550d5['limit']=qs[_0x70c4('0x1c')](_0x57ce75[_0x70c4('0x30')][_0x70c4('0x1c')]);_0x5550d5[_0x70c4('0x1a')]=qs[_0x70c4('0x1a')](_0x57ce75[_0x70c4('0x30')]['offset']);}_0x5550d5[_0x70c4('0x39')]=qs[_0x70c4('0x3a')](_0x57ce75[_0x70c4('0x30')][_0x70c4('0x3a')]);_0x5550d5[_0x70c4('0x3b')]=qs[_0x70c4('0x32')](_[_0x70c4('0x3c')](_0x57ce75['query'],_0x421f0a[_0x70c4('0x32')]),_0x887d53);if(_0x57ce75[_0x70c4('0x30')]['filter']){_0x5550d5[_0x70c4('0x3b')]=_[_0x70c4('0x3d')](_0x5550d5['where'],{'$or':_['map'](_0x887d53,function(_0x314938){if(_0x314938[_0x70c4('0x2d')]!==_0x70c4('0x3e')){var _0xff87ae={};_0xff87ae[_0x314938[_0x70c4('0x28')]]={'$like':'%'+_0x57ce75[_0x70c4('0x30')][_0x70c4('0x3f')]+'%'};return _0xff87ae;}})});}_0x5550d5=_['merge']({},_0x5550d5,_0x57ce75['options']);var _0xcb9085={'where':_0x5550d5[_0x70c4('0x3b')]};return db['FreshsalesField']['count'](_0xcb9085)[_0x70c4('0x24')](function(_0x38e4b5){_0x3d43b8[_0x70c4('0x1d')]=_0x38e4b5;if(_0x57ce75['query'][_0x70c4('0x40')]){_0x5550d5[_0x70c4('0x41')]=[{'all':!![]}];}return db[_0x70c4('0x42')]['findAll'](_0x5550d5);})[_0x70c4('0x24')](function(_0x13b770){_0x3d43b8[_0x70c4('0x43')]=_0x13b770;return _0x3d43b8;})[_0x70c4('0x24')](respondWithFilteredResult(_0x2b936b,_0x5550d5))[_0x70c4('0x44')](handleError(_0x2b936b,null));};exports['show']=function(_0x4bf32f,_0x583878){var _0x3a3c3f={'raw':!![],'where':{'id':_0x4bf32f['params']['id']}},_0x555198={};_0x555198['model']=_[_0x70c4('0x31')](db[_0x70c4('0x42')][_0x70c4('0x2b')]);_0x555198[_0x70c4('0x30')]=_[_0x70c4('0x31')](_0x4bf32f[_0x70c4('0x30')]);_0x555198[_0x70c4('0x32')]=_['intersection'](_0x555198[_0x70c4('0x2f')],_0x555198['query']);_0x3a3c3f['attributes']=_[_0x70c4('0x33')](_0x555198['model'],qs[_0x70c4('0x35')](_0x4bf32f[_0x70c4('0x30')][_0x70c4('0x35')]));_0x3a3c3f['attributes']=_0x3a3c3f[_0x70c4('0x34')][_0x70c4('0x36')]?_0x3a3c3f[_0x70c4('0x34')]:_0x555198[_0x70c4('0x2f')];if(_0x4bf32f['query'][_0x70c4('0x40')]){_0x3a3c3f[_0x70c4('0x41')]=[{'all':!![]}];}_0x3a3c3f=_[_0x70c4('0x3d')]({},_0x3a3c3f,_0x4bf32f[_0x70c4('0x45')]);return db[_0x70c4('0x42')][_0x70c4('0x46')](_0x3a3c3f)['then'](handleEntityNotFound(_0x583878,null))['then'](respondWithResult(_0x583878,null))['catch'](handleError(_0x583878,null));};exports[_0x70c4('0x47')]=function(_0x49a36e,_0x2859a2){return db['FreshsalesField'][_0x70c4('0x47')](_0x49a36e[_0x70c4('0x48')],{})[_0x70c4('0x24')](respondWithResult(_0x2859a2,0xc9))[_0x70c4('0x44')](handleError(_0x2859a2,null));};exports[_0x70c4('0x23')]=function(_0x31fcd7,_0x382e29){if(_0x31fcd7[_0x70c4('0x48')]['id']){delete _0x31fcd7[_0x70c4('0x48')]['id'];}return db['FreshsalesField'][_0x70c4('0x46')]({'where':{'id':_0x31fcd7[_0x70c4('0x49')]['id']}})['then'](handleEntityNotFound(_0x382e29,null))[_0x70c4('0x24')](saveUpdates(_0x31fcd7[_0x70c4('0x48')],null))['then'](respondWithResult(_0x382e29,null))['catch'](handleError(_0x382e29,null));};exports[_0x70c4('0x25')]=function(_0x279a97,_0xb22553){return db[_0x70c4('0x42')]['find']({'where':{'id':_0x279a97[_0x70c4('0x49')]['id']}})[_0x70c4('0x24')](handleEntityNotFound(_0xb22553,null))[_0x70c4('0x24')](removeEntity(_0xb22553,null))[_0x70c4('0x44')](handleError(_0xb22553,null));}; \ No newline at end of file +var _0x225f=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','FreshsalesField','includeAll','include','rows','catch','show','params','length','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x225f,0x69));var _0xf225=function(_0x1afd2f,_0x2ff11d){_0x1afd2f=_0x1afd2f-0x0;var _0x412bb8=_0x225f[_0x1afd2f];return _0x412bb8;};'use strict';var emlformat=require(_0xf225('0x0'));var rimraf=require(_0xf225('0x1'));var zipdir=require(_0xf225('0x2'));var jsonpatch=require(_0xf225('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf225('0x4'));var Mustache=require(_0xf225('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf225('0x6'));var ejs=require(_0xf225('0x7'));var fs=require('fs');var fs_extra=require(_0xf225('0x8'));var _=require(_0xf225('0x9'));var squel=require(_0xf225('0xa'));var crypto=require(_0xf225('0xb'));var jsforce=require(_0xf225('0xc'));var deskjs=require(_0xf225('0xd'));var toCsv=require(_0xf225('0x6'));var querystring=require(_0xf225('0xe'));var Papa=require('papaparse');var Redis=require(_0xf225('0xf'));var authService=require(_0xf225('0x10'));var qs=require(_0xf225('0x11'));var as=require(_0xf225('0x12'));var hardwareService=require(_0xf225('0x13'));var logger=require(_0xf225('0x14'))(_0xf225('0x15'));var utils=require(_0xf225('0x16'));var config=require(_0xf225('0x17'));var licenseUtil=require(_0xf225('0x18'));var db=require(_0xf225('0x19'))['db'];function respondWithStatusCode(_0xa2e7c0,_0x3591db){_0x3591db=_0x3591db||0xcc;return function(_0xbdd684){if(_0xbdd684){return _0xa2e7c0[_0xf225('0x1a')](_0x3591db);}return _0xa2e7c0[_0xf225('0x1b')](_0x3591db)['end']();};}function respondWithResult(_0x3b47b4,_0x5919db){_0x5919db=_0x5919db||0xc8;return function(_0x29c484){if(_0x29c484){return _0x3b47b4[_0xf225('0x1b')](_0x5919db)['json'](_0x29c484);}};}function respondWithFilteredResult(_0x439ee3,_0x250973){return function(_0x1d90ed){if(_0x1d90ed){var _0x5b2208=typeof _0x250973[_0xf225('0x1c')]==='undefined'&&typeof _0x250973['limit']===_0xf225('0x1d');var _0x190223=_0x1d90ed['count'];var _0x35994d=_0x5b2208?0x0:_0x250973['offset'];var _0x31a4bd=_0x5b2208?_0x1d90ed[_0xf225('0x1e')]:_0x250973[_0xf225('0x1c')]+_0x250973['limit'];var _0x4622f1;if(_0x31a4bd>=_0x190223){_0x31a4bd=_0x190223;_0x4622f1=0xc8;}else{_0x4622f1=0xce;}_0x439ee3[_0xf225('0x1b')](_0x4622f1);return _0x439ee3[_0xf225('0x1f')](_0xf225('0x20'),_0x35994d+'-'+_0x31a4bd+'/'+_0x190223)[_0xf225('0x21')](_0x1d90ed);}return null;};}function patchUpdates(_0xf29b12){return function(_0x39f325){try{jsonpatch[_0xf225('0x22')](_0x39f325,_0xf29b12,!![]);}catch(_0x5e8365){return BPromise['reject'](_0x5e8365);}return _0x39f325['save']();};}function saveUpdates(_0x4555cf,_0x5c6a92){return function(_0x2f0bbc){if(_0x2f0bbc){return _0x2f0bbc['update'](_0x4555cf)[_0xf225('0x23')](function(_0x87a48b){return _0x87a48b;});}return null;};}function removeEntity(_0x42d27f,_0x2a4a16){return function(_0xe1d3bd){if(_0xe1d3bd){return _0xe1d3bd['destroy']()[_0xf225('0x23')](function(){_0x42d27f[_0xf225('0x1b')](0xcc)[_0xf225('0x24')]();});}};}function handleEntityNotFound(_0xcc8c11,_0x582fe7){return function(_0x231873){if(!_0x231873){_0xcc8c11[_0xf225('0x1a')](0x194);}return _0x231873;};}function handleError(_0x2bc9a1,_0x3a6ed4){_0x3a6ed4=_0x3a6ed4||0x1f4;return function(_0xa52a57){logger[_0xf225('0x25')](_0xa52a57[_0xf225('0x26')]);if(_0xa52a57[_0xf225('0x27')]){delete _0xa52a57[_0xf225('0x27')];}_0x2bc9a1[_0xf225('0x1b')](_0x3a6ed4)[_0xf225('0x28')](_0xa52a57);};}exports[_0xf225('0x29')]=function(_0x1bca13,_0x2aa34a){var _0x1ea937={},_0x3da49={},_0x528eec={'count':0x0,'rows':[]};var _0x5600e4=_[_0xf225('0x2a')](db['FreshsalesField'][_0xf225('0x2b')],function(_0x987950){return{'name':_0x987950[_0xf225('0x2c')],'type':_0x987950['type'][_0xf225('0x2d')]};});_0x3da49[_0xf225('0x2e')]=_[_0xf225('0x2a')](_0x5600e4,_0xf225('0x27'));_0x3da49[_0xf225('0x2f')]=_[_0xf225('0x30')](_0x1bca13[_0xf225('0x2f')]);_0x3da49[_0xf225('0x31')]=_[_0xf225('0x32')](_0x3da49[_0xf225('0x2e')],_0x3da49[_0xf225('0x2f')]);_0x1ea937[_0xf225('0x33')]=_[_0xf225('0x32')](_0x3da49[_0xf225('0x2e')],qs[_0xf225('0x34')](_0x1bca13['query'][_0xf225('0x34')]));_0x1ea937['attributes']=_0x1ea937[_0xf225('0x33')]['length']?_0x1ea937[_0xf225('0x33')]:_0x3da49['model'];if(!_0x1bca13[_0xf225('0x2f')][_0xf225('0x35')](_0xf225('0x36'))){_0x1ea937['limit']=qs[_0xf225('0x37')](_0x1bca13['query']['limit']);_0x1ea937[_0xf225('0x1c')]=qs[_0xf225('0x1c')](_0x1bca13['query']['offset']);}_0x1ea937[_0xf225('0x38')]=qs[_0xf225('0x39')](_0x1bca13['query'][_0xf225('0x39')]);_0x1ea937[_0xf225('0x3a')]=qs[_0xf225('0x31')](_[_0xf225('0x3b')](_0x1bca13[_0xf225('0x2f')],_0x3da49[_0xf225('0x31')]),_0x5600e4);if(_0x1bca13[_0xf225('0x2f')][_0xf225('0x3c')]){_0x1ea937[_0xf225('0x3a')]=_['merge'](_0x1ea937[_0xf225('0x3a')],{'$or':_[_0xf225('0x2a')](_0x5600e4,function(_0x46aa60){if(_0x46aa60[_0xf225('0x3d')]!=='VIRTUAL'){var _0x2fef96={};_0x2fef96[_0x46aa60[_0xf225('0x27')]]={'$like':'%'+_0x1bca13[_0xf225('0x2f')][_0xf225('0x3c')]+'%'};return _0x2fef96;}})});}_0x1ea937=_[_0xf225('0x3e')]({},_0x1ea937,_0x1bca13[_0xf225('0x3f')]);var _0x503b22={'where':_0x1ea937['where']};return db[_0xf225('0x40')][_0xf225('0x1e')](_0x503b22)[_0xf225('0x23')](function(_0x3a0cfc){_0x528eec[_0xf225('0x1e')]=_0x3a0cfc;if(_0x1bca13[_0xf225('0x2f')][_0xf225('0x41')]){_0x1ea937[_0xf225('0x42')]=[{'all':!![]}];}return db[_0xf225('0x40')]['findAll'](_0x1ea937);})['then'](function(_0x12b05c){_0x528eec[_0xf225('0x43')]=_0x12b05c;return _0x528eec;})[_0xf225('0x23')](respondWithFilteredResult(_0x2aa34a,_0x1ea937))[_0xf225('0x44')](handleError(_0x2aa34a,null));};exports[_0xf225('0x45')]=function(_0x67cc8,_0x4935a9){var _0x6f622a={'raw':!![],'where':{'id':_0x67cc8[_0xf225('0x46')]['id']}},_0x36d7b1={};_0x36d7b1[_0xf225('0x2e')]=_[_0xf225('0x30')](db[_0xf225('0x40')]['rawAttributes']);_0x36d7b1[_0xf225('0x2f')]=_['keys'](_0x67cc8[_0xf225('0x2f')]);_0x36d7b1[_0xf225('0x31')]=_[_0xf225('0x32')](_0x36d7b1[_0xf225('0x2e')],_0x36d7b1[_0xf225('0x2f')]);_0x6f622a[_0xf225('0x33')]=_['intersection'](_0x36d7b1[_0xf225('0x2e')],qs[_0xf225('0x34')](_0x67cc8[_0xf225('0x2f')][_0xf225('0x34')]));_0x6f622a[_0xf225('0x33')]=_0x6f622a[_0xf225('0x33')][_0xf225('0x47')]?_0x6f622a[_0xf225('0x33')]:_0x36d7b1['model'];if(_0x67cc8[_0xf225('0x2f')]['includeAll']){_0x6f622a[_0xf225('0x42')]=[{'all':!![]}];}_0x6f622a=_['merge']({},_0x6f622a,_0x67cc8['options']);return db[_0xf225('0x40')]['find'](_0x6f622a)[_0xf225('0x23')](handleEntityNotFound(_0x4935a9,null))[_0xf225('0x23')](respondWithResult(_0x4935a9,null))[_0xf225('0x44')](handleError(_0x4935a9,null));};exports[_0xf225('0x48')]=function(_0x38c611,_0x1cbf87){return db[_0xf225('0x40')]['create'](_0x38c611[_0xf225('0x49')],{})[_0xf225('0x23')](respondWithResult(_0x1cbf87,0xc9))['catch'](handleError(_0x1cbf87,null));};exports['update']=function(_0x26ba02,_0x8b5293){if(_0x26ba02['body']['id']){delete _0x26ba02[_0xf225('0x49')]['id'];}return db[_0xf225('0x40')][_0xf225('0x4a')]({'where':{'id':_0x26ba02[_0xf225('0x46')]['id']}})[_0xf225('0x23')](handleEntityNotFound(_0x8b5293,null))['then'](saveUpdates(_0x26ba02['body'],null))['then'](respondWithResult(_0x8b5293,null))['catch'](handleError(_0x8b5293,null));};exports[_0xf225('0x4b')]=function(_0x25f3ba,_0x2968c0){return db[_0xf225('0x40')][_0xf225('0x4a')]({'where':{'id':_0x25f3ba['params']['id']}})[_0xf225('0x23')](handleEntityNotFound(_0x2968c0,null))[_0xf225('0x23')](removeEntity(_0x2968c0,null))['catch'](handleError(_0x2968c0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index dfaf4cc..c7ebfef 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 _0x341c=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x341c,0xcc));var _0xc341=function(_0x3c4274,_0x858023){_0x3c4274=_0x3c4274-0x0;var _0x36a214=_0x341c[_0x3c4274];return _0x36a214;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var logger=require(_0xc341('0x1'))('api');var moment=require(_0xc341('0x2'));var BPromise=require(_0xc341('0x3'));var rp=require(_0xc341('0x4'));var fs=require('fs');var path=require(_0xc341('0x5'));var rimraf=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var attributes=require(_0xc341('0x8'));module[_0xc341('0x9')]=function(_0x5226bd,_0xf9fe84){return _0x5226bd[_0xc341('0xa')](_0xc341('0xb'),attributes,{'tableName':_0xc341('0xc'),'paranoid':![],'indexes':[{'name':_0xc341('0xd'),'fields':['idField',_0xc341('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdac7=['request-promise','path','rimraf','FreshsalesField','freshsales_unique_index','FieldId','lodash','util','bluebird'];(function(_0x1677b9,_0x258b87){var _0x327ce4=function(_0x2a8597){while(--_0x2a8597){_0x1677b9['push'](_0x1677b9['shift']());}};_0x327ce4(++_0x258b87);}(_0xdac7,0x180));var _0x7dac=function(_0x9fb412,_0x5b3fdc){_0x9fb412=_0x9fb412-0x0;var _0x43db0f=_0xdac7[_0x9fb412];return _0x43db0f;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7dac('0x2'));var rp=require(_0x7dac('0x3'));var fs=require('fs');var path=require(_0x7dac('0x4'));var rimraf=require(_0x7dac('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x17a05f,_0x2557ee){return _0x17a05f['define'](_0x7dac('0x6'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x7dac('0x7'),'fields':['idField',_0x7dac('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 ee0c48c..5e773da 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x5b5eb4,_0x117c87){var _0x42af53=function(_0xdf6fcb){while(--_0xdf6fcb){_0x5b5eb4['push'](_0x5b5eb4['shift']());}};_0x42af53(++_0x117c87);}(_0x687b,0x14a));var _0xb687=function(_0x1ae125,_0x20820a){_0x1ae125=_0x1ae125-0x0;var _0x1f3b2b=_0x687b[_0x1ae125];return _0x1f3b2b;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x7a54=['info','FreshsalesField,\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(_0x4284d8,_0x1b2f6a){_0x4284d8=_0x4284d8-0x0;var _0x1fd892=_0x7a54[_0x4284d8];return _0x1fd892;};'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')]('FreshsalesField,\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/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ada46d2..f696746 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 _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(_0x45d23d,_0x176f61){var _0x43391f=function(_0x5c75db){while(--_0x5c75db){_0x45d23d['push'](_0x45d23d['shift']());}};_0x43391f(++_0x176f61);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/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','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1b6948,_0x3f7cdf){var _0x20133c=function(_0x1b5aa5){while(--_0x1b5aa5){_0x1b6948['push'](_0x1b6948['shift']());}};_0x20133c(++_0x3f7cdf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 54a6299..d5d0555 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 _0xbaef=['ENUM','newTab','STRING','username'];(function(_0x1bbef5,_0x4803c6){var _0x240a97=function(_0x15b81b){while(--_0x15b81b){_0x1bbef5['push'](_0x1bbef5['shift']());}};_0x240a97(++_0x4803c6);}(_0xbaef,0xae));var _0xfbae=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0xbaef[_0x47a12a];return _0x30cd40;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfbae('0x0')]},'description':{'type':Sequelize[_0xfbae('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xfbae('0x1')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfbae('0x0')]},'clientId':{'type':Sequelize[_0xfbae('0x0')]},'clientSecret':{'type':Sequelize[_0xfbae('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xfbae('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfbae('0x2')]('integrationTab',_0xfbae('0x3')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x28a6=['integrationTab','newTab','exports','STRING'];(function(_0x521907,_0x564add){var _0x239177=function(_0x5588b9){while(--_0x5588b9){_0x521907['push'](_0x521907['shift']());}};_0x239177(++_0x564add);}(_0x28a6,0x166));var _0x628a=function(_0x4851ff,_0x1c9a8d){_0x4851ff=_0x4851ff-0x0;var _0x26773b=_0x28a6[_0x4851ff];return _0x26773b;};'use strict';var Sequelize=require('sequelize');module[_0x628a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x628a('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x628a('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x628a('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x628a('0x2'),_0x628a('0x3')),'defaultValue':_0x628a('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d5489fc..9ce1cc6 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 _0x8a59=['path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','reject','save','update','then','end','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','channel','SalesforceField','Subjects','Descriptions','getFields','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','IsReminderSet','IsRecurrence','string','int','picklist','email','remove','includes','label','picklistValues','value','boolean','True','true','False','false','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'];(function(_0x59522a,_0x14d1e5){var _0x30f09d=function(_0x5cab74){while(--_0x5cab74){_0x59522a['push'](_0x59522a['shift']());}};_0x30f09d(++_0x14d1e5);}(_0x8a59,0xe9));var _0x98a5=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8a59[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x98a5('0x0'));var rimraf=require(_0x98a5('0x1'));var zipdir=require(_0x98a5('0x2'));var jsonpatch=require(_0x98a5('0x3'));var rp=require(_0x98a5('0x4'));var moment=require(_0x98a5('0x5'));var BPromise=require(_0x98a5('0x6'));var Mustache=require(_0x98a5('0x7'));var util=require(_0x98a5('0x8'));var path=require(_0x98a5('0x9'));var sox=require(_0x98a5('0xa'));var csv=require(_0x98a5('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98a5('0xc'));var squel=require(_0x98a5('0xd'));var crypto=require('crypto');var jsforce=require(_0x98a5('0xe'));var deskjs=require(_0x98a5('0xf'));var toCsv=require(_0x98a5('0xb'));var querystring=require('querystring');var Papa=require(_0x98a5('0x10'));var Redis=require(_0x98a5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x98a5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98a5('0x13'));var logger=require('../../config/logger')(_0x98a5('0x14'));var utils=require(_0x98a5('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x98a5('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27e931,_0x3c68b0){_0x3c68b0=_0x3c68b0||0xcc;return function(_0x298f21){if(_0x298f21){return _0x27e931[_0x98a5('0x17')](_0x3c68b0);}return _0x27e931[_0x98a5('0x18')](_0x3c68b0)['end']();};}function respondWithResult(_0x7c75fe,_0xe7f0cc){_0xe7f0cc=_0xe7f0cc||0xc8;return function(_0x5d5bd1){if(_0x5d5bd1){return _0x7c75fe[_0x98a5('0x18')](_0xe7f0cc)[_0x98a5('0x19')](_0x5d5bd1);}};}function respondWithFilteredResult(_0x223c14,_0x5e8d27){return function(_0x3b9e60){if(_0x3b9e60){var _0x3b5caf=typeof _0x5e8d27[_0x98a5('0x1a')]==='undefined'&&typeof _0x5e8d27[_0x98a5('0x1b')]===_0x98a5('0x1c');var _0xa5d9bf=_0x3b9e60[_0x98a5('0x1d')];var _0x17fe02=_0x3b5caf?0x0:_0x5e8d27['offset'];var _0x4ea83f=_0x3b5caf?_0x3b9e60[_0x98a5('0x1d')]:_0x5e8d27[_0x98a5('0x1a')]+_0x5e8d27[_0x98a5('0x1b')];var _0x3ccf90;if(_0x4ea83f>=_0xa5d9bf){_0x4ea83f=_0xa5d9bf;_0x3ccf90=0xc8;}else{_0x3ccf90=0xce;}_0x223c14[_0x98a5('0x18')](_0x3ccf90);return _0x223c14['set']('Content-Range',_0x17fe02+'-'+_0x4ea83f+'/'+_0xa5d9bf)[_0x98a5('0x19')](_0x3b9e60);}return null;};}function patchUpdates(_0x1953ce){return function(_0x56e779){try{jsonpatch['apply'](_0x56e779,_0x1953ce,!![]);}catch(_0x300b02){return BPromise[_0x98a5('0x1e')](_0x300b02);}return _0x56e779[_0x98a5('0x1f')]();};}function saveUpdates(_0x3b79ba,_0x3e2748){return function(_0x4def4d){if(_0x4def4d){return _0x4def4d[_0x98a5('0x20')](_0x3b79ba)['then'](function(_0x30dc72){return _0x30dc72;});}return null;};}function removeEntity(_0x294798,_0x28db9f){return function(_0x30373e){if(_0x30373e){return _0x30373e['destroy']()[_0x98a5('0x21')](function(){_0x294798[_0x98a5('0x18')](0xcc)[_0x98a5('0x22')]();});}};}function handleEntityNotFound(_0x527a9e,_0x4b01b3){return function(_0x546fce){if(!_0x546fce){_0x527a9e['sendStatus'](0x194);}return _0x546fce;};}function handleError(_0x4fbbbd,_0x12f215){_0x12f215=_0x12f215||0x1f4;return function(_0x10d5a9){logger[_0x98a5('0x23')](_0x10d5a9[_0x98a5('0x24')]);if(_0x10d5a9[_0x98a5('0x25')]){delete _0x10d5a9[_0x98a5('0x25')];}_0x4fbbbd[_0x98a5('0x18')](_0x12f215)[_0x98a5('0x26')](_0x10d5a9);};}exports[_0x98a5('0x27')]=function(_0x34d4b7,_0x215549){var _0xa19231={},_0x48e8f8={},_0x297d4a={'count':0x0,'rows':[]};var _0x14c901=_['map'](db[_0x98a5('0x28')][_0x98a5('0x29')],function(_0x17cdfd){return{'name':_0x17cdfd[_0x98a5('0x2a')],'type':_0x17cdfd[_0x98a5('0x2b')][_0x98a5('0x2c')]};});_0x48e8f8[_0x98a5('0x2d')]=_[_0x98a5('0x2e')](_0x14c901,_0x98a5('0x25'));_0x48e8f8[_0x98a5('0x2f')]=_[_0x98a5('0x30')](_0x34d4b7['query']);_0x48e8f8[_0x98a5('0x31')]=_[_0x98a5('0x32')](_0x48e8f8[_0x98a5('0x2d')],_0x48e8f8[_0x98a5('0x2f')]);_0xa19231[_0x98a5('0x33')]=_[_0x98a5('0x32')](_0x48e8f8[_0x98a5('0x2d')],qs[_0x98a5('0x34')](_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x34')]));_0xa19231[_0x98a5('0x33')]=_0xa19231[_0x98a5('0x33')][_0x98a5('0x35')]?_0xa19231[_0x98a5('0x33')]:_0x48e8f8[_0x98a5('0x2d')];if(!_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x36')](_0x98a5('0x37'))){_0xa19231[_0x98a5('0x1b')]=qs[_0x98a5('0x1b')](_0x34d4b7['query']['limit']);_0xa19231['offset']=qs[_0x98a5('0x1a')](_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x1a')]);}_0xa19231[_0x98a5('0x38')]=qs[_0x98a5('0x39')](_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x39')]);_0xa19231['where']=qs[_0x98a5('0x31')](_['pick'](_0x34d4b7[_0x98a5('0x2f')],_0x48e8f8['filters']),_0x14c901);if(_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x3a')]){_0xa19231['where']=_[_0x98a5('0x3b')](_0xa19231[_0x98a5('0x3c')],{'$or':_['map'](_0x14c901,function(_0x5c7de0){if(_0x5c7de0[_0x98a5('0x2b')]!==_0x98a5('0x3d')){var _0x94f780={};_0x94f780[_0x5c7de0[_0x98a5('0x25')]]={'$like':'%'+_0x34d4b7['query'][_0x98a5('0x3a')]+'%'};return _0x94f780;}})});}_0xa19231=_['merge']({},_0xa19231,_0x34d4b7[_0x98a5('0x3e')]);var _0x1d9d57={'where':_0xa19231[_0x98a5('0x3c')]};return db[_0x98a5('0x28')][_0x98a5('0x1d')](_0x1d9d57)['then'](function(_0x4ceb22){_0x297d4a['count']=_0x4ceb22;if(_0x34d4b7[_0x98a5('0x2f')][_0x98a5('0x3f')]){_0xa19231[_0x98a5('0x40')]=[{'all':!![]}];}return db[_0x98a5('0x28')][_0x98a5('0x41')](_0xa19231);})[_0x98a5('0x21')](function(_0x16c5d4){_0x297d4a[_0x98a5('0x42')]=_0x16c5d4;return _0x297d4a;})[_0x98a5('0x21')](respondWithFilteredResult(_0x215549,_0xa19231))['catch'](handleError(_0x215549,null));};exports[_0x98a5('0x43')]=function(_0x10501b,_0xd3025a){var _0x10676c={'raw':![],'where':{'id':_0x10501b[_0x98a5('0x44')]['id']}},_0x23a181={};_0x23a181['model']=_[_0x98a5('0x30')](db[_0x98a5('0x28')]['rawAttributes']);_0x23a181[_0x98a5('0x2f')]=_[_0x98a5('0x30')](_0x10501b['query']);_0x23a181[_0x98a5('0x31')]=_[_0x98a5('0x32')](_0x23a181[_0x98a5('0x2d')],_0x23a181[_0x98a5('0x2f')]);_0x10676c[_0x98a5('0x33')]=_[_0x98a5('0x32')](_0x23a181[_0x98a5('0x2d')],qs[_0x98a5('0x34')](_0x10501b[_0x98a5('0x2f')][_0x98a5('0x34')]));_0x10676c[_0x98a5('0x33')]=_0x10676c['attributes'][_0x98a5('0x35')]?_0x10676c['attributes']:_0x23a181[_0x98a5('0x2d')];if(_0x10501b[_0x98a5('0x2f')][_0x98a5('0x3f')]){_0x10676c[_0x98a5('0x40')]=[{'all':!![]}];}_0x10676c=_['merge']({},_0x10676c,_0x10501b[_0x98a5('0x3e')]);return db[_0x98a5('0x28')][_0x98a5('0x45')](_0x10676c)['then'](handleEntityNotFound(_0xd3025a,null))[_0x98a5('0x21')](respondWithResult(_0xd3025a,null))[_0x98a5('0x46')](handleError(_0xd3025a,null));};exports[_0x98a5('0x47')]=function(_0x533891,_0xbec34f){return db['SalesforceAccount']['create'](_0x533891[_0x98a5('0x48')],{})['then'](respondWithResult(_0xbec34f,0xc9))[_0x98a5('0x46')](handleError(_0xbec34f,null));};exports[_0x98a5('0x20')]=function(_0x324b1,_0x17be96){if(_0x324b1['body']['id']){delete _0x324b1['body']['id'];}return db[_0x98a5('0x28')][_0x98a5('0x45')]({'where':{'id':_0x324b1[_0x98a5('0x44')]['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x17be96,null))[_0x98a5('0x21')](saveUpdates(_0x324b1[_0x98a5('0x48')],null))['then'](respondWithResult(_0x17be96,null))[_0x98a5('0x46')](handleError(_0x17be96,null));};exports[_0x98a5('0x49')]=function(_0x822394,_0x4be9a5){return db[_0x98a5('0x28')][_0x98a5('0x45')]({'where':{'id':_0x822394[_0x98a5('0x44')]['id']}})['then'](handleEntityNotFound(_0x4be9a5,null))[_0x98a5('0x21')](removeEntity(_0x4be9a5,null))[_0x98a5('0x46')](handleError(_0x4be9a5,null));};exports[_0x98a5('0x4a')]=function(_0x1fda96,_0x4453ea,_0x16d1f7){var _0xbf17b0={};var _0x1c7d8b={};var _0x505a05;var _0x53219b;return db[_0x98a5('0x28')][_0x98a5('0x4b')]({'where':{'id':_0x1fda96[_0x98a5('0x44')]['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x4453ea,null))[_0x98a5('0x21')](function(_0xa1894a){if(_0xa1894a){_0x505a05=_0xa1894a;_0x1c7d8b[_0x98a5('0x2d')]=_['keys'](db[_0x98a5('0x4c')]['rawAttributes']);_0x1c7d8b[_0x98a5('0x2f')]=_['keys'](_0x1fda96['query']);_0x1c7d8b[_0x98a5('0x31')]=_['intersection'](_0x1c7d8b[_0x98a5('0x2d')],_0x1c7d8b['query']);_0xbf17b0[_0x98a5('0x33')]=_['intersection'](_0x1c7d8b['model'],qs[_0x98a5('0x34')](_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x34')]));_0xbf17b0[_0x98a5('0x33')]=_0xbf17b0[_0x98a5('0x33')][_0x98a5('0x35')]?_0xbf17b0[_0x98a5('0x33')]:_0x1c7d8b[_0x98a5('0x2d')];_0xbf17b0[_0x98a5('0x38')]=qs[_0x98a5('0x39')](_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x39')]);_0xbf17b0[_0x98a5('0x3c')]=qs['filters'](_['pick'](_0x1fda96[_0x98a5('0x2f')],_0x1c7d8b[_0x98a5('0x31')]));if(_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x3a')]){_0xbf17b0[_0x98a5('0x3c')]=_[_0x98a5('0x3b')](_0xbf17b0[_0x98a5('0x3c')],{'$or':_[_0x98a5('0x2e')](_0xbf17b0[_0x98a5('0x33')],function(_0x2f0b8d){var _0x1c84a4={};_0x1c84a4[_0x2f0b8d]={'$like':'%'+_0x1fda96['query'][_0x98a5('0x3a')]+'%'};return _0x1c84a4;})});}_0xbf17b0=_[_0x98a5('0x3b')]({},_0xbf17b0,_0x1fda96[_0x98a5('0x3e')]);return _0x505a05[_0x98a5('0x4a')](_0xbf17b0);}})[_0x98a5('0x21')](function(_0x5b19f8){if(_0x5b19f8){_0x53219b=_0x5b19f8[_0x98a5('0x35')];if(!_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x36')](_0x98a5('0x37'))){_0xbf17b0[_0x98a5('0x1b')]=qs['limit'](_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x1b')]);_0xbf17b0[_0x98a5('0x1a')]=qs[_0x98a5('0x1a')](_0x1fda96[_0x98a5('0x2f')][_0x98a5('0x1a')]);}return _0x505a05[_0x98a5('0x4a')](_0xbf17b0);}})['then'](function(_0x1f724f){if(_0x1f724f){return _0x1f724f?{'count':_0x53219b,'rows':_0x1f724f}:null;}})[_0x98a5('0x21')](respondWithResult(_0x4453ea,null))[_0x98a5('0x46')](handleError(_0x4453ea,null));};exports[_0x98a5('0x4d')]=function(_0x33e57a,_0x41751c,_0x2b60ba){if(_0x33e57a[_0x98a5('0x48')]['id']){delete _0x33e57a['body']['id'];}return db[_0x98a5('0x28')][_0x98a5('0x4b')]({'where':{'id':_0x33e57a[_0x98a5('0x44')]['id']}})[_0x98a5('0x21')](handleEntityNotFound(_0x41751c,null))[_0x98a5('0x21')](function(_0x1fe812){if(_0x1fe812){_0x33e57a[_0x98a5('0x48')][_0x98a5('0x4e')]=_0x1fe812['id'];_0x33e57a[_0x98a5('0x48')]['Subjects']=integrations['getSubjects'](_0x33e57a[_0x98a5('0x48')][_0x98a5('0x4f')],_0x33e57a[_0x98a5('0x48')][_0x98a5('0x2b')]);_0x33e57a[_0x98a5('0x48')]['Descriptions']=integrations['getDescriptions'](_0x33e57a['body'][_0x98a5('0x4f')],_0x33e57a['body'][_0x98a5('0x2b')]);return db[_0x98a5('0x4c')]['create'](_0x33e57a['body'],{'include':[{'model':db[_0x98a5('0x50')],'as':_0x98a5('0x51')},{'model':db[_0x98a5('0x50')],'as':_0x98a5('0x52')}]});}return null;})[_0x98a5('0x21')](respondWithResult(_0x41751c,null))['catch'](handleError(_0x41751c,null));};exports[_0x98a5('0x53')]=function(_0xf4ecd2,_0x276077,_0x2b8a94){var _0x144a60;var _0x109874='';var _0x2d9d9c='Task';return db[_0x98a5('0x28')][_0x98a5('0x4b')]({'where':{'id':_0xf4ecd2[_0x98a5('0x44')]['id']},'attributes':['id',_0x98a5('0x54'),'clientId',_0x98a5('0x55'),_0x98a5('0x56'),_0x98a5('0x57'),_0x98a5('0x58')]})[_0x98a5('0x21')](handleEntityNotFound(_0x276077,null))['then'](function(_0x458e1f){if(_0x458e1f){_0x109874=_0x458e1f['remoteUri'];var _0x2797a7=_0x109874[_0x98a5('0x59')](-0x1);if(_0x2797a7==='/'){_0x109874=_0x109874[_0x98a5('0x5a')](0x0,_0x109874[_0x98a5('0x5b')](_0x2797a7));}_0x144a60=new jsforce[(_0x98a5('0x5c'))]({'oauth2':{'loginUrl':_0x109874,'clientId':_0x458e1f[_0x98a5('0x5d')],'clientSecret':_0x458e1f[_0x98a5('0x55')]}});return _0x144a60[_0x98a5('0x5e')](_0x458e1f[_0x98a5('0x56')],_0x458e1f[_0x98a5('0x57')][_0x98a5('0x5f')](_0x458e1f[_0x98a5('0x58')]));}})[_0x98a5('0x21')](function(_0x4f99a3){if(_0x4f99a3){if(!_[_0x98a5('0x60')](_0xf4ecd2[_0x98a5('0x2f')][_0x98a5('0x61')])){_0x2d9d9c=_0xf4ecd2[_0x98a5('0x2f')][_0x98a5('0x61')];}return _0x144a60[_0x98a5('0x62')](_0x2d9d9c)[_0x98a5('0x63')]();}})[_0x98a5('0x21')](function(_0x188984){var _0x2e1b34=['OwnerId','ActivityDate',_0x98a5('0x64'),_0x98a5('0x65'),'Subject','Description'];var _0x4d86b8=[_0x98a5('0x66'),_0x98a5('0x67'),_0x98a5('0x68'),'boolean',_0x98a5('0x69'),'textarea','phone'];if(_0x188984){_[_0x98a5('0x6a')](_0x188984[_0x98a5('0x34')],function(_0x57311d){return _0x2e1b34[_0x98a5('0x6b')](_0x57311d['name'])||!_0x4d86b8[_0x98a5('0x6b')](_0x57311d[_0x98a5('0x2b')]);});return{'count':_0x188984[_0x98a5('0x34')]['length'],'rows':_[_0x98a5('0x2e')](_0x188984[_0x98a5('0x34')],function(_0xeecaa0){return{'id':_0xeecaa0[_0x98a5('0x25')],'name':_0xeecaa0[_0x98a5('0x6c')],'custom':_0xeecaa0['custom'],'options':_0xeecaa0['picklistValues'][_0x98a5('0x35')]>0x0?_[_0x98a5('0x2e')](_0xeecaa0[_0x98a5('0x6d')],function(_0x317ea8){return{'name':_0x317ea8['label'],'value':_0x317ea8[_0x98a5('0x6e')]};}):_0xeecaa0['type']==_0x98a5('0x6f')?[{'name':_0x98a5('0x70'),'value':_0x98a5('0x71')},{'name':_0x98a5('0x72'),'value':_0x98a5('0x73')}]:[]};})};}})[_0x98a5('0x21')](respondWithResult(_0x276077,null))[_0x98a5('0x46')](function(_0x406d4d){var _0x538a13=_0xf4ecd2[_0x98a5('0x2f')][_0x98a5('0x74')]?0x1f4:_0x406d4d[_0x98a5('0x75')]||0x1f4;logger['error'](_0x98a5('0x76'),_0x98a5('0x53'),_0x538a13,JSON[_0x98a5('0x77')](_0x406d4d));delete _0x406d4d['name'];if(_0x538a13===0x191){_0x538a13=0x190;}_0x276077['status'](_0x538a13)[_0x98a5('0x26')](_0xf4ecd2[_0x98a5('0x2f')][_0x98a5('0x74')]?{'message':_0x98a5('0x78'),'statusCode':_0x406d4d[_0x98a5('0x75')]}:_0x406d4d);});}; \ No newline at end of file +var _0x54a8=['phone','includes','label','picklistValues','value','true','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','fieldName','key','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','options','find','create','body','update','getConfigurations','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','lastIndexOf','Connection','login','password','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x54a8,0x8c));var _0x854a=function(_0x49a612,_0x5692dd){_0x49a612=_0x49a612-0x0;var _0x2489f1=_0x54a8[_0x49a612];return _0x2489f1;};'use strict';var emlformat=require(_0x854a('0x0'));var rimraf=require(_0x854a('0x1'));var zipdir=require(_0x854a('0x2'));var jsonpatch=require(_0x854a('0x3'));var rp=require('request-promise');var moment=require(_0x854a('0x4'));var BPromise=require(_0x854a('0x5'));var Mustache=require(_0x854a('0x6'));var util=require(_0x854a('0x7'));var path=require(_0x854a('0x8'));var sox=require(_0x854a('0x9'));var csv=require(_0x854a('0xa'));var ejs=require(_0x854a('0xb'));var fs=require('fs');var fs_extra=require(_0x854a('0xc'));var _=require(_0x854a('0xd'));var squel=require('squel');var crypto=require(_0x854a('0xe'));var jsforce=require(_0x854a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x854a('0xa'));var querystring=require(_0x854a('0x10'));var Papa=require(_0x854a('0x11'));var Redis=require(_0x854a('0x12'));var authService=require(_0x854a('0x13'));var qs=require(_0x854a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x854a('0x15'));var logger=require(_0x854a('0x16'))(_0x854a('0x17'));var utils=require(_0x854a('0x18'));var config=require(_0x854a('0x19'));var licenseUtil=require(_0x854a('0x1a'));var db=require(_0x854a('0x1b'))['db'];var integrations=require(_0x854a('0x1c'));function respondWithStatusCode(_0x3be182,_0x38bb9d){_0x38bb9d=_0x38bb9d||0xcc;return function(_0x384484){if(_0x384484){return _0x3be182['sendStatus'](_0x38bb9d);}return _0x3be182[_0x854a('0x1d')](_0x38bb9d)['end']();};}function respondWithResult(_0x494fd8,_0xc3b065){_0xc3b065=_0xc3b065||0xc8;return function(_0x747806){if(_0x747806){return _0x494fd8['status'](_0xc3b065)[_0x854a('0x1e')](_0x747806);}};}function respondWithFilteredResult(_0x56426b,_0x1ded77){return function(_0x2641fd){if(_0x2641fd){var _0x5dcd5e=typeof _0x1ded77['offset']===_0x854a('0x1f')&&typeof _0x1ded77[_0x854a('0x20')]===_0x854a('0x1f');var _0x51c3bf=_0x2641fd[_0x854a('0x21')];var _0x2690cc=_0x5dcd5e?0x0:_0x1ded77[_0x854a('0x22')];var _0x46c7a4=_0x5dcd5e?_0x2641fd[_0x854a('0x21')]:_0x1ded77[_0x854a('0x22')]+_0x1ded77[_0x854a('0x20')];var _0x4e3721;if(_0x46c7a4>=_0x51c3bf){_0x46c7a4=_0x51c3bf;_0x4e3721=0xc8;}else{_0x4e3721=0xce;}_0x56426b[_0x854a('0x1d')](_0x4e3721);return _0x56426b[_0x854a('0x23')](_0x854a('0x24'),_0x2690cc+'-'+_0x46c7a4+'/'+_0x51c3bf)[_0x854a('0x1e')](_0x2641fd);}return null;};}function patchUpdates(_0x559e7e){return function(_0x3b0022){try{jsonpatch[_0x854a('0x25')](_0x3b0022,_0x559e7e,!![]);}catch(_0x4128c7){return BPromise[_0x854a('0x26')](_0x4128c7);}return _0x3b0022[_0x854a('0x27')]();};}function saveUpdates(_0x274b9a,_0x127ac3){return function(_0x167303){if(_0x167303){return _0x167303['update'](_0x274b9a)[_0x854a('0x28')](function(_0x4ccd0e){return _0x4ccd0e;});}return null;};}function removeEntity(_0x1db0e3,_0x18e90d){return function(_0x25723c){if(_0x25723c){return _0x25723c[_0x854a('0x29')]()[_0x854a('0x28')](function(){_0x1db0e3[_0x854a('0x1d')](0xcc)[_0x854a('0x2a')]();});}};}function handleEntityNotFound(_0x2c2fc7,_0x5b55f9){return function(_0x546272){if(!_0x546272){_0x2c2fc7['sendStatus'](0x194);}return _0x546272;};}function handleError(_0x2ce17c,_0x173bd0){_0x173bd0=_0x173bd0||0x1f4;return function(_0x1581f1){logger[_0x854a('0x2b')](_0x1581f1[_0x854a('0x2c')]);if(_0x1581f1[_0x854a('0x2d')]){delete _0x1581f1[_0x854a('0x2d')];}_0x2ce17c[_0x854a('0x1d')](_0x173bd0)[_0x854a('0x2e')](_0x1581f1);};}exports[_0x854a('0x2f')]=function(_0x412026,_0x29392c){var _0x2bf1ad={},_0x5e2b36={},_0x2791d3={'count':0x0,'rows':[]};var _0x2214a1=_[_0x854a('0x30')](db[_0x854a('0x31')]['rawAttributes'],function(_0x3deba7){return{'name':_0x3deba7[_0x854a('0x32')],'type':_0x3deba7['type'][_0x854a('0x33')]};});_0x5e2b36['model']=_[_0x854a('0x30')](_0x2214a1,'name');_0x5e2b36['query']=_[_0x854a('0x34')](_0x412026[_0x854a('0x35')]);_0x5e2b36[_0x854a('0x36')]=_['intersection'](_0x5e2b36[_0x854a('0x37')],_0x5e2b36[_0x854a('0x35')]);_0x2bf1ad[_0x854a('0x38')]=_['intersection'](_0x5e2b36[_0x854a('0x37')],qs['fields'](_0x412026[_0x854a('0x35')][_0x854a('0x39')]));_0x2bf1ad['attributes']=_0x2bf1ad['attributes']['length']?_0x2bf1ad['attributes']:_0x5e2b36['model'];if(!_0x412026['query'][_0x854a('0x3a')](_0x854a('0x3b'))){_0x2bf1ad[_0x854a('0x20')]=qs['limit'](_0x412026[_0x854a('0x35')][_0x854a('0x20')]);_0x2bf1ad[_0x854a('0x22')]=qs[_0x854a('0x22')](_0x412026[_0x854a('0x35')][_0x854a('0x22')]);}_0x2bf1ad[_0x854a('0x3c')]=qs['sort'](_0x412026[_0x854a('0x35')][_0x854a('0x3d')]);_0x2bf1ad[_0x854a('0x3e')]=qs[_0x854a('0x36')](_[_0x854a('0x3f')](_0x412026[_0x854a('0x35')],_0x5e2b36[_0x854a('0x36')]),_0x2214a1);if(_0x412026[_0x854a('0x35')][_0x854a('0x40')]){_0x2bf1ad[_0x854a('0x3e')]=_[_0x854a('0x41')](_0x2bf1ad[_0x854a('0x3e')],{'$or':_['map'](_0x2214a1,function(_0x1b97aa){if(_0x1b97aa[_0x854a('0x42')]!==_0x854a('0x43')){var _0x4db228={};_0x4db228[_0x1b97aa[_0x854a('0x2d')]]={'$like':'%'+_0x412026[_0x854a('0x35')][_0x854a('0x40')]+'%'};return _0x4db228;}})});}_0x2bf1ad=_['merge']({},_0x2bf1ad,_0x412026['options']);var _0x387d11={'where':_0x2bf1ad['where']};return db[_0x854a('0x31')][_0x854a('0x21')](_0x387d11)[_0x854a('0x28')](function(_0x29c9cc){_0x2791d3[_0x854a('0x21')]=_0x29c9cc;if(_0x412026[_0x854a('0x35')]['includeAll']){_0x2bf1ad[_0x854a('0x44')]=[{'all':!![]}];}return db[_0x854a('0x31')][_0x854a('0x45')](_0x2bf1ad);})[_0x854a('0x28')](function(_0x358870){_0x2791d3[_0x854a('0x46')]=_0x358870;return _0x2791d3;})[_0x854a('0x28')](respondWithFilteredResult(_0x29392c,_0x2bf1ad))[_0x854a('0x47')](handleError(_0x29392c,null));};exports[_0x854a('0x48')]=function(_0x3216ae,_0x5c4af1){var _0x51997c={'raw':![],'where':{'id':_0x3216ae[_0x854a('0x49')]['id']}},_0x554fe3={};_0x554fe3['model']=_[_0x854a('0x34')](db[_0x854a('0x31')][_0x854a('0x4a')]);_0x554fe3['query']=_[_0x854a('0x34')](_0x3216ae['query']);_0x554fe3[_0x854a('0x36')]=_[_0x854a('0x4b')](_0x554fe3[_0x854a('0x37')],_0x554fe3['query']);_0x51997c[_0x854a('0x38')]=_['intersection'](_0x554fe3[_0x854a('0x37')],qs[_0x854a('0x39')](_0x3216ae[_0x854a('0x35')][_0x854a('0x39')]));_0x51997c['attributes']=_0x51997c[_0x854a('0x38')][_0x854a('0x4c')]?_0x51997c['attributes']:_0x554fe3[_0x854a('0x37')];if(_0x3216ae[_0x854a('0x35')][_0x854a('0x4d')]){_0x51997c[_0x854a('0x44')]=[{'all':!![]}];}_0x51997c=_[_0x854a('0x41')]({},_0x51997c,_0x3216ae[_0x854a('0x4e')]);return db[_0x854a('0x31')][_0x854a('0x4f')](_0x51997c)[_0x854a('0x28')](handleEntityNotFound(_0x5c4af1,null))['then'](respondWithResult(_0x5c4af1,null))[_0x854a('0x47')](handleError(_0x5c4af1,null));};exports[_0x854a('0x50')]=function(_0x5516aa,_0xeb46a0){return db['SalesforceAccount'][_0x854a('0x50')](_0x5516aa[_0x854a('0x51')],{})[_0x854a('0x28')](respondWithResult(_0xeb46a0,0xc9))[_0x854a('0x47')](handleError(_0xeb46a0,null));};exports[_0x854a('0x52')]=function(_0x1585df,_0x3c90b3){if(_0x1585df[_0x854a('0x51')]['id']){delete _0x1585df[_0x854a('0x51')]['id'];}return db[_0x854a('0x31')][_0x854a('0x4f')]({'where':{'id':_0x1585df[_0x854a('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c90b3,null))[_0x854a('0x28')](saveUpdates(_0x1585df[_0x854a('0x51')],null))['then'](respondWithResult(_0x3c90b3,null))['catch'](handleError(_0x3c90b3,null));};exports[_0x854a('0x29')]=function(_0x3744f5,_0x356fa9){return db[_0x854a('0x31')][_0x854a('0x4f')]({'where':{'id':_0x3744f5[_0x854a('0x49')]['id']}})[_0x854a('0x28')](handleEntityNotFound(_0x356fa9,null))[_0x854a('0x28')](removeEntity(_0x356fa9,null))[_0x854a('0x47')](handleError(_0x356fa9,null));};exports[_0x854a('0x53')]=function(_0x2cc6a0,_0x398cce,_0x3847b6){var _0xca01ce={};var _0x468adf={};var _0x269d4d;var _0x2a3ded;return db[_0x854a('0x31')]['findOne']({'where':{'id':_0x2cc6a0[_0x854a('0x49')]['id']}})[_0x854a('0x28')](handleEntityNotFound(_0x398cce,null))[_0x854a('0x28')](function(_0x4b37ae){if(_0x4b37ae){_0x269d4d=_0x4b37ae;_0x468adf[_0x854a('0x37')]=_['keys'](db['SalesforceConfiguration'][_0x854a('0x4a')]);_0x468adf[_0x854a('0x35')]=_[_0x854a('0x34')](_0x2cc6a0[_0x854a('0x35')]);_0x468adf[_0x854a('0x36')]=_['intersection'](_0x468adf[_0x854a('0x37')],_0x468adf[_0x854a('0x35')]);_0xca01ce['attributes']=_[_0x854a('0x4b')](_0x468adf[_0x854a('0x37')],qs['fields'](_0x2cc6a0[_0x854a('0x35')][_0x854a('0x39')]));_0xca01ce['attributes']=_0xca01ce['attributes'][_0x854a('0x4c')]?_0xca01ce[_0x854a('0x38')]:_0x468adf['model'];_0xca01ce['order']=qs['sort'](_0x2cc6a0[_0x854a('0x35')][_0x854a('0x3d')]);_0xca01ce[_0x854a('0x3e')]=qs[_0x854a('0x36')](_['pick'](_0x2cc6a0[_0x854a('0x35')],_0x468adf[_0x854a('0x36')]));if(_0x2cc6a0[_0x854a('0x35')]['filter']){_0xca01ce[_0x854a('0x3e')]=_['merge'](_0xca01ce[_0x854a('0x3e')],{'$or':_[_0x854a('0x30')](_0xca01ce[_0x854a('0x38')],function(_0x4b856f){var _0x443438={};_0x443438[_0x4b856f]={'$like':'%'+_0x2cc6a0['query']['filter']+'%'};return _0x443438;})});}_0xca01ce=_[_0x854a('0x41')]({},_0xca01ce,_0x2cc6a0['options']);return _0x269d4d[_0x854a('0x53')](_0xca01ce);}})['then'](function(_0x4f82ce){if(_0x4f82ce){_0x2a3ded=_0x4f82ce[_0x854a('0x4c')];if(!_0x2cc6a0[_0x854a('0x35')][_0x854a('0x3a')](_0x854a('0x3b'))){_0xca01ce[_0x854a('0x20')]=qs[_0x854a('0x20')](_0x2cc6a0['query'][_0x854a('0x20')]);_0xca01ce[_0x854a('0x22')]=qs[_0x854a('0x22')](_0x2cc6a0['query'][_0x854a('0x22')]);}return _0x269d4d[_0x854a('0x53')](_0xca01ce);}})[_0x854a('0x28')](function(_0x47a637){if(_0x47a637){return _0x47a637?{'count':_0x2a3ded,'rows':_0x47a637}:null;}})['then'](respondWithResult(_0x398cce,null))[_0x854a('0x47')](handleError(_0x398cce,null));};exports[_0x854a('0x54')]=function(_0x1fcfff,_0x5261e7,_0x3448c3){if(_0x1fcfff[_0x854a('0x51')]['id']){delete _0x1fcfff['body']['id'];}return db['SalesforceAccount'][_0x854a('0x55')]({'where':{'id':_0x1fcfff[_0x854a('0x49')]['id']}})[_0x854a('0x28')](handleEntityNotFound(_0x5261e7,null))[_0x854a('0x28')](function(_0x52ac54){if(_0x52ac54){_0x1fcfff['body'][_0x854a('0x56')]=_0x52ac54['id'];_0x1fcfff[_0x854a('0x51')]['Subjects']=integrations['getSubjects'](_0x1fcfff[_0x854a('0x51')][_0x854a('0x57')],_0x1fcfff['body'][_0x854a('0x42')]);_0x1fcfff[_0x854a('0x51')][_0x854a('0x58')]=integrations[_0x854a('0x59')](_0x1fcfff[_0x854a('0x51')]['channel'],_0x1fcfff[_0x854a('0x51')][_0x854a('0x42')]);return db['SalesforceConfiguration'][_0x854a('0x50')](_0x1fcfff[_0x854a('0x51')],{'include':[{'model':db[_0x854a('0x5a')],'as':_0x854a('0x5b')},{'model':db[_0x854a('0x5a')],'as':_0x854a('0x58')}]});}return null;})[_0x854a('0x28')](respondWithResult(_0x5261e7,null))[_0x854a('0x47')](handleError(_0x5261e7,null));};exports[_0x854a('0x5c')]=function(_0x15644f,_0x533a6d,_0xd1ec63){var _0x516eb8;var _0x3b9caa='';var _0x1eeb8f=_0x854a('0x5d');return db['SalesforceAccount'][_0x854a('0x55')]({'where':{'id':_0x15644f[_0x854a('0x49')]['id']},'attributes':['id',_0x854a('0x5e'),_0x854a('0x5f'),_0x854a('0x60'),_0x854a('0x61'),'password',_0x854a('0x62')]})[_0x854a('0x28')](handleEntityNotFound(_0x533a6d,null))[_0x854a('0x28')](function(_0xb9bbb0){if(_0xb9bbb0){_0x3b9caa=_0xb9bbb0[_0x854a('0x5e')];var _0x5349f0=_0x3b9caa[_0x854a('0x63')](-0x1);if(_0x5349f0==='/'){_0x3b9caa=_0x3b9caa['substring'](0x0,_0x3b9caa[_0x854a('0x64')](_0x5349f0));}_0x516eb8=new jsforce[(_0x854a('0x65'))]({'oauth2':{'loginUrl':_0x3b9caa,'clientId':_0xb9bbb0['clientId'],'clientSecret':_0xb9bbb0['clientSecret']}});return _0x516eb8[_0x854a('0x66')](_0xb9bbb0[_0x854a('0x61')],_0xb9bbb0[_0x854a('0x67')][_0x854a('0x68')](_0xb9bbb0[_0x854a('0x62')]));}})[_0x854a('0x28')](function(_0x5181f2){if(_0x5181f2){if(!_[_0x854a('0x69')](_0x15644f[_0x854a('0x35')][_0x854a('0x6a')])){_0x1eeb8f=_0x15644f[_0x854a('0x35')][_0x854a('0x6a')];}return _0x516eb8[_0x854a('0x6b')](_0x1eeb8f)[_0x854a('0x6c')]();}})['then'](function(_0x1b857c){var _0x10fe11=['OwnerId',_0x854a('0x6d'),_0x854a('0x6e'),_0x854a('0x6f'),_0x854a('0x70'),_0x854a('0x71')];var _0x2e9c48=[_0x854a('0x72'),'int',_0x854a('0x73'),_0x854a('0x74'),_0x854a('0x75'),'textarea',_0x854a('0x76')];if(_0x1b857c){_['remove'](_0x1b857c[_0x854a('0x39')],function(_0x5b8831){return _0x10fe11['includes'](_0x5b8831['name'])||!_0x2e9c48[_0x854a('0x77')](_0x5b8831[_0x854a('0x42')]);});return{'count':_0x1b857c[_0x854a('0x39')][_0x854a('0x4c')],'rows':_['map'](_0x1b857c[_0x854a('0x39')],function(_0x4634e8){return{'id':_0x4634e8['name'],'name':_0x4634e8[_0x854a('0x78')],'custom':_0x4634e8['custom'],'options':_0x4634e8[_0x854a('0x79')][_0x854a('0x4c')]>0x0?_[_0x854a('0x30')](_0x4634e8[_0x854a('0x79')],function(_0x5ba582){return{'name':_0x5ba582['label'],'value':_0x5ba582[_0x854a('0x7a')]};}):_0x4634e8[_0x854a('0x42')]==_0x854a('0x74')?[{'name':'True','value':_0x854a('0x7b')},{'name':'False','value':'false'}]:[]};})};}})[_0x854a('0x28')](respondWithResult(_0x533a6d,null))[_0x854a('0x47')](function(_0x2bf235){var _0x2dd67d=_0x15644f[_0x854a('0x35')][_0x854a('0x7c')]?0x1f4:_0x2bf235[_0x854a('0x7d')]||0x1f4;logger['error'](_0x854a('0x7e'),'getFields',_0x2dd67d,JSON[_0x854a('0x7f')](_0x2bf235));delete _0x2bf235['name'];if(_0x2dd67d===0x191){_0x2dd67d=0x190;}_0x533a6d[_0x854a('0x1d')](_0x2dd67d)['send'](_0x15644f[_0x854a('0x35')][_0x854a('0x7c')]?{'message':_0x854a('0x80'),'statusCode':_0x2bf235[_0x854a('0x7d')]}:_0x2bf235);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5b68ceb..338ca04 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 _0x8e63=['bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','util','moment'];(function(_0x10f1c3,_0x196234){var _0x4dc584=function(_0x45d6f1){while(--_0x45d6f1){_0x10f1c3['push'](_0x10f1c3['shift']());}};_0x4dc584(++_0x196234);}(_0x8e63,0x7c));var _0x38e6=function(_0x571e75,_0x8d9489){_0x571e75=_0x571e75-0x0;var _0x924fbd=_0x8e63[_0x571e75];return _0x924fbd;};'use strict';var _=require('lodash');var util=require(_0x38e6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x38e6('0x1'));var BPromise=require(_0x38e6('0x2'));var rp=require(_0x38e6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x38e6('0x4'));var attributes=require(_0x38e6('0x5'));var integrations=require(_0x38e6('0x6'));module['exports']=function(_0x3048c0,_0x19e7be){return _0x3048c0[_0x38e6('0x7')](_0x38e6('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x887d=['util','../../config/logger','moment','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x887d,0xd0));var _0xd887=function(_0x102174,_0x5c5944){_0x102174=_0x102174-0x0;var _0x23934f=_0x887d[_0x102174];return _0x23934f;};'use strict';var _=require(_0xd887('0x0'));var util=require(_0xd887('0x1'));var logger=require(_0xd887('0x2'))('api');var moment=require(_0xd887('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd887('0x4'));var config=require(_0xd887('0x5'));var attributes=require(_0xd887('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xd887('0x7')]=function(_0x134c45,_0x2b2add){return _0x134c45[_0xd887('0x8')](_0xd887('0x9'),attributes,{'tableName':_0xd887('0xa'),'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 8907e9c..0c33d68 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 _0x685b=['jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowSalesforceAccount','find','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x685b,0x199));var _0xb685=function(_0x1d997f,_0x259b5a){_0x1d997f=_0x1d997f-0x0;var _0x307704=_0x685b[_0x1d997f];return _0x307704;};'use strict';var _=require(_0xb685('0x0'));var util=require(_0xb685('0x1'));var moment=require(_0xb685('0x2'));var BPromise=require(_0xb685('0x3'));var rs=require(_0xb685('0x4'));var fs=require('fs');var Redis=require(_0xb685('0x5'));var db=require(_0xb685('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb685('0x7'));var config=require(_0xb685('0x8'));var jayson=require(_0xb685('0x9'));var client=jayson[_0xb685('0xa')][_0xb685('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x356dd3,_0x3b9fe7,_0x46bfe4){return new BPromise(function(_0x5db5e0,_0x1b28f7){return client[_0xb685('0xc')](_0x356dd3,_0x46bfe4)['then'](function(_0x57559b){logger[_0xb685('0xd')](_0xb685('0xe'),_0x3b9fe7,_0xb685('0xf'));logger[_0xb685('0x10')](_0xb685('0x11'),_0x3b9fe7,_0xb685('0xf'),JSON['stringify'](_0x57559b));if(_0x57559b[_0xb685('0x12')]){if(_0x57559b[_0xb685('0x12')][_0xb685('0x13')]===0x1f4){logger[_0xb685('0x12')](_0xb685('0xe'),_0x3b9fe7,_0x57559b['error'][_0xb685('0x14')]);return _0x1b28f7(_0x57559b['error'][_0xb685('0x14')]);}logger['error'](_0xb685('0xe'),_0x3b9fe7,_0x57559b[_0xb685('0x12')][_0xb685('0x14')]);return _0x5db5e0(_0x57559b[_0xb685('0x12')]['message']);}else{logger[_0xb685('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x3b9fe7,_0xb685('0xf'));_0x5db5e0(_0x57559b[_0xb685('0x15')][_0xb685('0x14')]);}})['catch'](function(_0x4e7895){logger['error'](_0xb685('0xe'),_0x3b9fe7,_0x4e7895);_0x1b28f7(_0x4e7895);});});}exports[_0xb685('0x16')]=function(_0x23f701){var _0x55d5b8=this;return new Promise(function(_0x111066,_0x3c91f7){return db[_0xb685('0x17')][_0xb685('0x18')]({'raw':_0x23f701[_0xb685('0x19')]?_0x23f701[_0xb685('0x19')][_0xb685('0x1a')]===undefined?!![]:![]:!![],'where':_0x23f701[_0xb685('0x19')]?_0x23f701[_0xb685('0x19')][_0xb685('0x1b')]||null:null,'attributes':_0x23f701[_0xb685('0x19')]?_0x23f701[_0xb685('0x19')][_0xb685('0x1c')]||null:null,'limit':_0x23f701['options']?_0x23f701[_0xb685('0x19')][_0xb685('0x1d')]||null:null,'include':_0x23f701['options']?_0x23f701[_0xb685('0x19')]['include']?_[_0xb685('0x1e')](_0x23f701[_0xb685('0x19')]['include'],function(_0x433bb3){return{'model':db[_0x433bb3['model']],'as':_0x433bb3['as'],'attributes':_0x433bb3['attributes'],'include':_0x433bb3['include']?_[_0xb685('0x1e')](_0x433bb3[_0xb685('0x1f')],function(_0x42983b){return{'model':db[_0x42983b[_0xb685('0x20')]],'as':_0x42983b['as'],'attributes':_0x42983b[_0xb685('0x1c')],'include':_0x42983b[_0xb685('0x1f')]?_[_0xb685('0x1e')](_0x42983b[_0xb685('0x1f')],function(_0x2ade94){return{'model':db[_0x2ade94[_0xb685('0x20')]],'as':_0x2ade94['as'],'attributes':_0x2ade94[_0xb685('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fd93b){logger[_0xb685('0xd')]('GetSalesforceAccount',_0x23f701);logger[_0xb685('0x10')](_0xb685('0x16'),_0x23f701,JSON['stringify'](_0x4fd93b));_0x111066(_0x4fd93b);})[_0xb685('0x21')](function(_0x13c91e){logger[_0xb685('0x12')](_0xb685('0x16'),_0x13c91e['message'],_0x23f701);_0x3c91f7(_0x55d5b8[_0xb685('0x12')](0x1f4,_0x13c91e[_0xb685('0x14')]));});});};exports[_0xb685('0x22')]=function(_0x55a701){var _0x4f6253=this;return new Promise(function(_0x323e6e,_0x59b1e5){return db[_0xb685('0x17')][_0xb685('0x23')]({'raw':_0x55a701[_0xb685('0x19')]?_0x55a701[_0xb685('0x19')][_0xb685('0x1a')]===undefined?!![]:![]:!![],'where':_0x55a701[_0xb685('0x19')]?_0x55a701[_0xb685('0x19')][_0xb685('0x1b')]||null:null,'attributes':_0x55a701['options']?_0x55a701[_0xb685('0x19')][_0xb685('0x1c')]||null:null,'include':_0x55a701[_0xb685('0x19')]?_0x55a701[_0xb685('0x19')][_0xb685('0x1f')]?_[_0xb685('0x1e')](_0x55a701[_0xb685('0x19')]['include'],function(_0x1c37b8){return{'model':db[_0x1c37b8[_0xb685('0x20')]],'as':_0x1c37b8['as'],'attributes':_0x1c37b8[_0xb685('0x1c')],'include':_0x1c37b8['include']?_[_0xb685('0x1e')](_0x1c37b8[_0xb685('0x1f')],function(_0x4829d4){return{'model':db[_0x4829d4['model']],'as':_0x4829d4['as'],'attributes':_0x4829d4[_0xb685('0x1c')],'include':_0x4829d4[_0xb685('0x1f')]?_['map'](_0x4829d4['include'],function(_0x18b144){return{'model':db[_0x18b144[_0xb685('0x20')]],'as':_0x18b144['as'],'attributes':_0x18b144[_0xb685('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb685('0x24')](function(_0xb60a23){logger[_0xb685('0xd')](_0xb685('0x22'),_0x55a701);logger[_0xb685('0x10')]('ShowSalesforceAccount',_0x55a701,JSON[_0xb685('0x25')](_0xb60a23));_0x323e6e(_0xb60a23);})[_0xb685('0x21')](function(_0x20be45){logger[_0xb685('0x12')](_0xb685('0x22'),_0x20be45[_0xb685('0x14')],_0x55a701);_0x59b1e5(_0x4f6253[_0xb685('0x12')](0x1f4,_0x20be45[_0xb685('0x14')]));});});}; \ No newline at end of file +var _0xf590=['../../config/environment','jayson/promise','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','result','catch','findAll','options','where','limit','map','attributes','include','model','GetSalesforceAccount','stringify','message','ShowSalesforceAccount','SalesforceAccount','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x11400a,_0x4cb6b2){var _0x131022=function(_0x5550e3){while(--_0x5550e3){_0x11400a['push'](_0x11400a['shift']());}};_0x131022(++_0x4cb6b2);}(_0xf590,0x1e2));var _0x0f59=function(_0x35f7c8,_0x4808eb){_0x35f7c8=_0x35f7c8-0x0;var _0x30bda5=_0xf590[_0x35f7c8];return _0x30bda5;};'use strict';var _=require(_0x0f59('0x0'));var util=require('util');var moment=require(_0x0f59('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f59('0x2'));var fs=require('fs');var Redis=require(_0x0f59('0x3'));var db=require(_0x0f59('0x4'))['db'];var utils=require(_0x0f59('0x5'));var logger=require(_0x0f59('0x6'))(_0x0f59('0x7'));var config=require(_0x0f59('0x8'));var jayson=require(_0x0f59('0x9'));var client=jayson['client'][_0x0f59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b62b2,_0x3cf3ec,_0x534f4d){return new BPromise(function(_0x42fb41,_0x3367f8){return client['request'](_0x5b62b2,_0x534f4d)[_0x0f59('0xb')](function(_0x3f8456){logger[_0x0f59('0xc')](_0x0f59('0xd'),_0x3cf3ec,'request\x20sent');logger[_0x0f59('0xe')](_0x0f59('0xf'),_0x3cf3ec,_0x0f59('0x10'),JSON['stringify'](_0x3f8456));if(_0x3f8456['error']){if(_0x3f8456[_0x0f59('0x11')][_0x0f59('0x12')]===0x1f4){logger[_0x0f59('0x11')](_0x0f59('0xd'),_0x3cf3ec,_0x3f8456[_0x0f59('0x11')]['message']);return _0x3367f8(_0x3f8456['error']['message']);}logger[_0x0f59('0x11')](_0x0f59('0xd'),_0x3cf3ec,_0x3f8456[_0x0f59('0x11')]['message']);return _0x42fb41(_0x3f8456[_0x0f59('0x11')]['message']);}else{logger[_0x0f59('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3cf3ec,_0x0f59('0x10'));_0x42fb41(_0x3f8456[_0x0f59('0x13')]['message']);}})[_0x0f59('0x14')](function(_0x171acb){logger[_0x0f59('0x11')](_0x0f59('0xd'),_0x3cf3ec,_0x171acb);_0x3367f8(_0x171acb);});});}exports['GetSalesforceAccount']=function(_0x24f766){var _0x101c12=this;return new Promise(function(_0x3fe737,_0x4eab06){return db['SalesforceAccount'][_0x0f59('0x15')]({'raw':_0x24f766[_0x0f59('0x16')]?_0x24f766['options']['raw']===undefined?!![]:![]:!![],'where':_0x24f766[_0x0f59('0x16')]?_0x24f766[_0x0f59('0x16')][_0x0f59('0x17')]||null:null,'attributes':_0x24f766[_0x0f59('0x16')]?_0x24f766[_0x0f59('0x16')]['attributes']||null:null,'limit':_0x24f766['options']?_0x24f766['options'][_0x0f59('0x18')]||null:null,'include':_0x24f766['options']?_0x24f766[_0x0f59('0x16')]['include']?_[_0x0f59('0x19')](_0x24f766[_0x0f59('0x16')]['include'],function(_0x3754a3){return{'model':db[_0x3754a3['model']],'as':_0x3754a3['as'],'attributes':_0x3754a3[_0x0f59('0x1a')],'include':_0x3754a3[_0x0f59('0x1b')]?_[_0x0f59('0x19')](_0x3754a3[_0x0f59('0x1b')],function(_0x93d02b){return{'model':db[_0x93d02b[_0x0f59('0x1c')]],'as':_0x93d02b['as'],'attributes':_0x93d02b[_0x0f59('0x1a')],'include':_0x93d02b[_0x0f59('0x1b')]?_[_0x0f59('0x19')](_0x93d02b[_0x0f59('0x1b')],function(_0x4bde0b){return{'model':db[_0x4bde0b['model']],'as':_0x4bde0b['as'],'attributes':_0x4bde0b[_0x0f59('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd1b01e){logger[_0x0f59('0xc')](_0x0f59('0x1d'),_0x24f766);logger['debug'](_0x0f59('0x1d'),_0x24f766,JSON[_0x0f59('0x1e')](_0xd1b01e));_0x3fe737(_0xd1b01e);})[_0x0f59('0x14')](function(_0x5205bf){logger[_0x0f59('0x11')](_0x0f59('0x1d'),_0x5205bf['message'],_0x24f766);_0x4eab06(_0x101c12[_0x0f59('0x11')](0x1f4,_0x5205bf[_0x0f59('0x1f')]));});});};exports[_0x0f59('0x20')]=function(_0x21f167){var _0xca733f=this;return new Promise(function(_0x31cdf8,_0x377c63){return db[_0x0f59('0x21')]['find']({'raw':_0x21f167[_0x0f59('0x16')]?_0x21f167[_0x0f59('0x16')][_0x0f59('0x22')]===undefined?!![]:![]:!![],'where':_0x21f167[_0x0f59('0x16')]?_0x21f167[_0x0f59('0x16')]['where']||null:null,'attributes':_0x21f167[_0x0f59('0x16')]?_0x21f167['options'][_0x0f59('0x1a')]||null:null,'include':_0x21f167['options']?_0x21f167[_0x0f59('0x16')]['include']?_[_0x0f59('0x19')](_0x21f167[_0x0f59('0x16')][_0x0f59('0x1b')],function(_0xb4ce66){return{'model':db[_0xb4ce66[_0x0f59('0x1c')]],'as':_0xb4ce66['as'],'attributes':_0xb4ce66['attributes'],'include':_0xb4ce66['include']?_[_0x0f59('0x19')](_0xb4ce66['include'],function(_0x2c94e0){return{'model':db[_0x2c94e0[_0x0f59('0x1c')]],'as':_0x2c94e0['as'],'attributes':_0x2c94e0[_0x0f59('0x1a')],'include':_0x2c94e0[_0x0f59('0x1b')]?_['map'](_0x2c94e0[_0x0f59('0x1b')],function(_0x28ae7f){return{'model':db[_0x28ae7f[_0x0f59('0x1c')]],'as':_0x28ae7f['as'],'attributes':_0x28ae7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0f59('0xb')](function(_0x280fe3){logger[_0x0f59('0xc')]('ShowSalesforceAccount',_0x21f167);logger['debug'](_0x0f59('0x20'),_0x21f167,JSON['stringify'](_0x280fe3));_0x31cdf8(_0x280fe3);})[_0x0f59('0x14')](function(_0x336f6d){logger[_0x0f59('0x11')](_0x0f59('0x20'),_0x336f6d[_0x0f59('0x1f')],_0x21f167);_0x377c63(_0xca733f[_0x0f59('0x11')](0x1f4,_0x336f6d[_0x0f59('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f5abced..3d04ad5 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(_0x104c7c,_0x1ba91a){var _0x45ee89=function(_0x463784){while(--_0x463784){_0x104c7c['push'](_0x104c7c['shift']());}};_0x45ee89(++_0x1ba91a);}(_0xadb5,0xad));var _0x5adb=function(_0x59c276,_0xe74b31){_0x59c276=_0x59c276-0x0;var _0x5135e7=_0xadb5[_0x59c276];return _0x5135e7;};'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 _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(_0x2ec9bb,_0x216f52){var _0x5687ee=function(_0x4551a7){while(--_0x4551a7){_0x2ec9bb['push'](_0x2ec9bb['shift']());}};_0x5687ee(++_0x216f52);}(_0xadb5,0xad));var _0x5adb=function(_0x408727,_0x2a406d){_0x408727=_0x408727-0x0;var _0x23851d=_0xadb5[_0x408727];return _0x23851d;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cec803f..9133b1e 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 _0x9c2f=['Case','contact_lead','contact','account_contact_lead','nothing','lead','exports','STRING','ENUM','Task'];(function(_0x1966ad,_0x43f2f3){var _0x5d7637=function(_0x24b943){while(--_0x24b943){_0x1966ad['push'](_0x1966ad['shift']());}};_0x5d7637(++_0x43f2f3);}(_0x9c2f,0x1c8));var _0xf9c2=function(_0x32c5c7,_0xc6881f){_0x32c5c7=_0x32c5c7-0x0;var _0x4648be=_0x9c2f[_0x32c5c7];return _0x4648be;};'use strict';var Sequelize=require('sequelize');module[_0xf9c2('0x0')]={'name':{'type':Sequelize[_0xf9c2('0x1')]},'description':{'type':Sequelize[_0xf9c2('0x1')]},'ticketType':{'type':Sequelize[_0xf9c2('0x2')](_0xf9c2('0x3'),_0xf9c2('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xf9c2('0x2')](_0xf9c2('0x5'),_0xf9c2('0x6'),'lead',_0xf9c2('0x7'),'account'),'defaultValue':_0xf9c2('0x5')},'moduleCreate':{'type':Sequelize['ENUM'](_0xf9c2('0x8'),'contact','lead','account'),'defaultValue':_0xf9c2('0x9')},'leadId':{'type':Sequelize[_0xf9c2('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xf9c2('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xf9c2('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xf9c2('0x1')]}}; \ No newline at end of file +var _0x8525=['STRING','exports','ENUM','Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact'];(function(_0x58d889,_0x2423cc){var _0x3f11d4=function(_0x21ea98){while(--_0x21ea98){_0x58d889['push'](_0x58d889['shift']());}};_0x3f11d4(++_0x2423cc);}(_0x8525,0xc7));var _0x5852=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8525[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module[_0x5852('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x5852('0x1')](_0x5852('0x2'),_0x5852('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x5852('0x1')](_0x5852('0x4'),'contact',_0x5852('0x5'),_0x5852('0x6'),_0x5852('0x7')),'defaultValue':_0x5852('0x4')},'moduleCreate':{'type':Sequelize[_0x5852('0x1')](_0x5852('0x8'),_0x5852('0x9'),'lead',_0x5852('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x5852('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0x5852('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x5852('0xa')]},'additionalSearchLead':{'type':Sequelize[_0x5852('0xa')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 42ddd55..aaaff47 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 _0x7d28=['key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','fields','catch','create','body','find','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type'];(function(_0x1a7cd6,_0x287996){var _0x242e95=function(_0x27ff8a){while(--_0x27ff8a){_0x1a7cd6['push'](_0x1a7cd6['shift']());}};_0x242e95(++_0x287996);}(_0x7d28,0x73));var _0x87d2=function(_0x3aec40,_0xea8062){_0x3aec40=_0x3aec40-0x0;var _0x8ff89d=_0x7d28[_0x3aec40];return _0x8ff89d;};'use strict';var emlformat=require(_0x87d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87d2('0x1'));var rp=require(_0x87d2('0x2'));var moment=require(_0x87d2('0x3'));var BPromise=require(_0x87d2('0x4'));var Mustache=require(_0x87d2('0x5'));var util=require(_0x87d2('0x6'));var path=require(_0x87d2('0x7'));var sox=require(_0x87d2('0x8'));var csv=require(_0x87d2('0x9'));var ejs=require(_0x87d2('0xa'));var fs=require('fs');var fs_extra=require(_0x87d2('0xb'));var _=require('lodash');var squel=require(_0x87d2('0xc'));var crypto=require(_0x87d2('0xd'));var jsforce=require(_0x87d2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x87d2('0x9'));var querystring=require('querystring');var Papa=require(_0x87d2('0xf'));var Redis=require(_0x87d2('0x10'));var authService=require(_0x87d2('0x11'));var qs=require(_0x87d2('0x12'));var as=require(_0x87d2('0x13'));var hardwareService=require(_0x87d2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x87d2('0x15'));var licenseUtil=require(_0x87d2('0x16'));var db=require(_0x87d2('0x17'))['db'];function respondWithStatusCode(_0x18ede1,_0x5758c3){_0x5758c3=_0x5758c3||0xcc;return function(_0x285a3f){if(_0x285a3f){return _0x18ede1['sendStatus'](_0x5758c3);}return _0x18ede1[_0x87d2('0x18')](_0x5758c3)[_0x87d2('0x19')]();};}function respondWithResult(_0x1d040e,_0x3b13f6){_0x3b13f6=_0x3b13f6||0xc8;return function(_0x545382){if(_0x545382){return _0x1d040e['status'](_0x3b13f6)[_0x87d2('0x1a')](_0x545382);}};}function respondWithFilteredResult(_0x8510fb,_0x502411){return function(_0x3f5c78){if(_0x3f5c78){var _0xb34d31=typeof _0x502411['offset']===_0x87d2('0x1b')&&typeof _0x502411[_0x87d2('0x1c')]===_0x87d2('0x1b');var _0xbe9d4=_0x3f5c78[_0x87d2('0x1d')];var _0x57c688=_0xb34d31?0x0:_0x502411[_0x87d2('0x1e')];var _0x51dedc=_0xb34d31?_0x3f5c78['count']:_0x502411[_0x87d2('0x1e')]+_0x502411[_0x87d2('0x1c')];var _0x4f089b;if(_0x51dedc>=_0xbe9d4){_0x51dedc=_0xbe9d4;_0x4f089b=0xc8;}else{_0x4f089b=0xce;}_0x8510fb[_0x87d2('0x18')](_0x4f089b);return _0x8510fb[_0x87d2('0x1f')](_0x87d2('0x20'),_0x57c688+'-'+_0x51dedc+'/'+_0xbe9d4)[_0x87d2('0x1a')](_0x3f5c78);}return null;};}function patchUpdates(_0x213b78){return function(_0x1d79a9){try{jsonpatch[_0x87d2('0x21')](_0x1d79a9,_0x213b78,!![]);}catch(_0x594070){return BPromise['reject'](_0x594070);}return _0x1d79a9[_0x87d2('0x22')]();};}function saveUpdates(_0x42a8ae,_0x5f0484){return function(_0x1ddf7f){if(_0x1ddf7f){return _0x1ddf7f[_0x87d2('0x23')](_0x42a8ae)[_0x87d2('0x24')](function(_0x43b6d6){return _0x43b6d6;});}return null;};}function removeEntity(_0x30bc7e,_0x3abddc){return function(_0x80838){if(_0x80838){return _0x80838['destroy']()[_0x87d2('0x24')](function(){_0x30bc7e[_0x87d2('0x18')](0xcc)[_0x87d2('0x19')]();});}};}function handleEntityNotFound(_0x42373c,_0x3a9bb9){return function(_0x310161){if(!_0x310161){_0x42373c['sendStatus'](0x194);}return _0x310161;};}function handleError(_0x5b9bdd,_0x14730c){_0x14730c=_0x14730c||0x1f4;return function(_0x24dfe0){logger['error'](_0x24dfe0[_0x87d2('0x25')]);if(_0x24dfe0[_0x87d2('0x26')]){delete _0x24dfe0[_0x87d2('0x26')];}_0x5b9bdd[_0x87d2('0x18')](_0x14730c)[_0x87d2('0x27')](_0x24dfe0);};}exports[_0x87d2('0x28')]=function(_0xc0c58e,_0x3c2914){var _0x23d7fd={},_0x3d2ba4={},_0x127388={'count':0x0,'rows':[]};var _0x3da4dc=_['map'](db[_0x87d2('0x29')][_0x87d2('0x2a')],function(_0x2721e0){return{'name':_0x2721e0[_0x87d2('0x2b')],'type':_0x2721e0[_0x87d2('0x2c')][_0x87d2('0x2d')]};});_0x3d2ba4[_0x87d2('0x2e')]=_['map'](_0x3da4dc,_0x87d2('0x26'));_0x3d2ba4[_0x87d2('0x2f')]=_[_0x87d2('0x30')](_0xc0c58e[_0x87d2('0x2f')]);_0x3d2ba4[_0x87d2('0x31')]=_[_0x87d2('0x32')](_0x3d2ba4[_0x87d2('0x2e')],_0x3d2ba4[_0x87d2('0x2f')]);_0x23d7fd['attributes']=_[_0x87d2('0x32')](_0x3d2ba4[_0x87d2('0x2e')],qs['fields'](_0xc0c58e[_0x87d2('0x2f')]['fields']));_0x23d7fd[_0x87d2('0x33')]=_0x23d7fd[_0x87d2('0x33')][_0x87d2('0x34')]?_0x23d7fd[_0x87d2('0x33')]:_0x3d2ba4['model'];if(!_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x35')](_0x87d2('0x36'))){_0x23d7fd['limit']=qs['limit'](_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x1c')]);_0x23d7fd['offset']=qs[_0x87d2('0x1e')](_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x1e')]);}_0x23d7fd[_0x87d2('0x37')]=qs[_0x87d2('0x38')](_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x38')]);_0x23d7fd[_0x87d2('0x39')]=qs[_0x87d2('0x31')](_[_0x87d2('0x3a')](_0xc0c58e[_0x87d2('0x2f')],_0x3d2ba4[_0x87d2('0x31')]),_0x3da4dc);if(_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x3b')]){_0x23d7fd['where']=_[_0x87d2('0x3c')](_0x23d7fd[_0x87d2('0x39')],{'$or':_[_0x87d2('0x3d')](_0x3da4dc,function(_0x1ef33e){if(_0x1ef33e[_0x87d2('0x2c')]!==_0x87d2('0x3e')){var _0xe02db9={};_0xe02db9[_0x1ef33e[_0x87d2('0x26')]]={'$like':'%'+_0xc0c58e[_0x87d2('0x2f')]['filter']+'%'};return _0xe02db9;}})});}_0x23d7fd=_[_0x87d2('0x3c')]({},_0x23d7fd,_0xc0c58e[_0x87d2('0x3f')]);var _0x435803={'where':_0x23d7fd[_0x87d2('0x39')]};return db[_0x87d2('0x29')][_0x87d2('0x1d')](_0x435803)[_0x87d2('0x24')](function(_0x59cf2d){_0x127388[_0x87d2('0x1d')]=_0x59cf2d;if(_0xc0c58e[_0x87d2('0x2f')][_0x87d2('0x40')]){_0x23d7fd[_0x87d2('0x41')]=[{'all':!![]}];}return db[_0x87d2('0x29')][_0x87d2('0x42')](_0x23d7fd);})[_0x87d2('0x24')](function(_0x3e670c){_0x127388['rows']=_0x3e670c;return _0x127388;})[_0x87d2('0x24')](respondWithFilteredResult(_0x3c2914,_0x23d7fd))['catch'](handleError(_0x3c2914,null));};exports[_0x87d2('0x43')]=function(_0xde17c3,_0x265fb7){var _0x3d34d2={'raw':![],'where':{'id':_0xde17c3[_0x87d2('0x44')]['id']}},_0x5d4d91={};_0x5d4d91[_0x87d2('0x2e')]=_[_0x87d2('0x30')](db[_0x87d2('0x29')][_0x87d2('0x2a')]);_0x5d4d91[_0x87d2('0x2f')]=_[_0x87d2('0x30')](_0xde17c3[_0x87d2('0x2f')]);_0x5d4d91[_0x87d2('0x31')]=_['intersection'](_0x5d4d91[_0x87d2('0x2e')],_0x5d4d91[_0x87d2('0x2f')]);_0x3d34d2[_0x87d2('0x33')]=_['intersection'](_0x5d4d91[_0x87d2('0x2e')],qs[_0x87d2('0x45')](_0xde17c3[_0x87d2('0x2f')][_0x87d2('0x45')]));_0x3d34d2['attributes']=_0x3d34d2[_0x87d2('0x33')]['length']?_0x3d34d2[_0x87d2('0x33')]:_0x5d4d91[_0x87d2('0x2e')];if(_0xde17c3['query'][_0x87d2('0x40')]){_0x3d34d2[_0x87d2('0x41')]=[{'all':!![]}];}_0x3d34d2=_[_0x87d2('0x3c')]({},_0x3d34d2,_0xde17c3[_0x87d2('0x3f')]);return db[_0x87d2('0x29')]['find'](_0x3d34d2)['then'](handleEntityNotFound(_0x265fb7,null))[_0x87d2('0x24')](respondWithResult(_0x265fb7,null))[_0x87d2('0x46')](handleError(_0x265fb7,null));};exports['create']=function(_0x56d47e,_0x32b369){return db[_0x87d2('0x29')][_0x87d2('0x47')](_0x56d47e[_0x87d2('0x48')],{})['then'](respondWithResult(_0x32b369,0xc9))[_0x87d2('0x46')](handleError(_0x32b369,null));};exports[_0x87d2('0x23')]=function(_0x4cfc99,_0x28e9b7){if(_0x4cfc99[_0x87d2('0x48')]['id']){delete _0x4cfc99[_0x87d2('0x48')]['id'];}return db[_0x87d2('0x29')][_0x87d2('0x49')]({'where':{'id':_0x4cfc99[_0x87d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x28e9b7,null))[_0x87d2('0x24')](saveUpdates(_0x4cfc99[_0x87d2('0x48')],null))['then'](respondWithResult(_0x28e9b7,null))['catch'](handleError(_0x28e9b7,null));};exports[_0x87d2('0x4a')]=function(_0x5aef23,_0x531d5e){return db['SalesforceConfiguration'][_0x87d2('0x49')]({'where':{'id':_0x5aef23[_0x87d2('0x44')]['id']}})[_0x87d2('0x24')](handleEntityNotFound(_0x531d5e,null))[_0x87d2('0x24')](removeEntity(_0x531d5e,null))[_0x87d2('0x46')](handleError(_0x531d5e,null));};exports[_0x87d2('0x4b')]=function(_0x1c8aab,_0x2f173a,_0x1f131e){var _0x38862b={};var _0xf51a10={};var _0x5cfe55;var _0x138ebf;return db['SalesforceConfiguration'][_0x87d2('0x4c')]({'where':{'id':_0x1c8aab[_0x87d2('0x44')]['id']}})[_0x87d2('0x24')](handleEntityNotFound(_0x2f173a,null))[_0x87d2('0x24')](function(_0x3bc32e){if(_0x3bc32e){_0x5cfe55=_0x3bc32e;_0xf51a10[_0x87d2('0x2e')]=_[_0x87d2('0x30')](db[_0x87d2('0x4d')][_0x87d2('0x2a')]);_0xf51a10[_0x87d2('0x2f')]=_[_0x87d2('0x30')](_0x1c8aab['query']);_0xf51a10[_0x87d2('0x31')]=_[_0x87d2('0x32')](_0xf51a10[_0x87d2('0x2e')],_0xf51a10[_0x87d2('0x2f')]);_0x38862b[_0x87d2('0x33')]=_[_0x87d2('0x32')](_0xf51a10[_0x87d2('0x2e')],qs[_0x87d2('0x45')](_0x1c8aab[_0x87d2('0x2f')][_0x87d2('0x45')]));_0x38862b[_0x87d2('0x33')]=_0x38862b[_0x87d2('0x33')][_0x87d2('0x34')]?_0x38862b[_0x87d2('0x33')]:_0xf51a10[_0x87d2('0x2e')];_0x38862b[_0x87d2('0x37')]=qs[_0x87d2('0x38')](_0x1c8aab[_0x87d2('0x2f')][_0x87d2('0x38')]);_0x38862b[_0x87d2('0x39')]=qs['filters'](_[_0x87d2('0x3a')](_0x1c8aab['query'],_0xf51a10[_0x87d2('0x31')]));if(_0x1c8aab[_0x87d2('0x2f')][_0x87d2('0x3b')]){_0x38862b[_0x87d2('0x39')]=_[_0x87d2('0x3c')](_0x38862b[_0x87d2('0x39')],{'$or':_[_0x87d2('0x3d')](_0x38862b[_0x87d2('0x33')],function(_0x4d3528){var _0xff7773={};_0xff7773[_0x4d3528]={'$like':'%'+_0x1c8aab[_0x87d2('0x2f')][_0x87d2('0x3b')]+'%'};return _0xff7773;})});}_0x38862b=_[_0x87d2('0x3c')]({},_0x38862b,_0x1c8aab[_0x87d2('0x3f')]);return _0x5cfe55[_0x87d2('0x4b')](_0x38862b);}})[_0x87d2('0x24')](function(_0x20f9e1){if(_0x20f9e1){_0x138ebf=_0x20f9e1[_0x87d2('0x34')];if(!_0x1c8aab[_0x87d2('0x2f')][_0x87d2('0x35')]('nolimit')){_0x38862b[_0x87d2('0x1c')]=qs[_0x87d2('0x1c')](_0x1c8aab['query'][_0x87d2('0x1c')]);_0x38862b[_0x87d2('0x1e')]=qs['offset'](_0x1c8aab['query']['offset']);}return _0x5cfe55['getFields'](_0x38862b);}})[_0x87d2('0x24')](function(_0x120e2f){if(_0x120e2f){return _0x120e2f?{'count':_0x138ebf,'rows':_0x120e2f}:null;}})[_0x87d2('0x24')](respondWithResult(_0x2f173a,null))[_0x87d2('0x46')](handleError(_0x2f173a,null));};exports[_0x87d2('0x4e')]=function(_0x5804c2,_0x495a1d,_0x4fb85e){var _0x133263={};var _0x41657e={};var _0x40a711;var _0x25116c;return db[_0x87d2('0x29')]['findOne']({'where':{'id':_0x5804c2[_0x87d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x495a1d,null))[_0x87d2('0x24')](function(_0x4fd4bf){if(_0x4fd4bf){_0x40a711=_0x4fd4bf;_0x41657e[_0x87d2('0x2e')]=_[_0x87d2('0x30')](db['SalesforceField'][_0x87d2('0x2a')]);_0x41657e['query']=_[_0x87d2('0x30')](_0x5804c2[_0x87d2('0x2f')]);_0x41657e['filters']=_[_0x87d2('0x32')](_0x41657e[_0x87d2('0x2e')],_0x41657e[_0x87d2('0x2f')]);_0x133263['attributes']=_['intersection'](_0x41657e[_0x87d2('0x2e')],qs[_0x87d2('0x45')](_0x5804c2[_0x87d2('0x2f')]['fields']));_0x133263['attributes']=_0x133263[_0x87d2('0x33')]['length']?_0x133263[_0x87d2('0x33')]:_0x41657e[_0x87d2('0x2e')];_0x133263[_0x87d2('0x37')]=qs['sort'](_0x5804c2[_0x87d2('0x2f')]['sort']);_0x133263[_0x87d2('0x39')]=qs[_0x87d2('0x31')](_[_0x87d2('0x3a')](_0x5804c2[_0x87d2('0x2f')],_0x41657e[_0x87d2('0x31')]));if(_0x5804c2[_0x87d2('0x2f')][_0x87d2('0x3b')]){_0x133263[_0x87d2('0x39')]=_[_0x87d2('0x3c')](_0x133263[_0x87d2('0x39')],{'$or':_[_0x87d2('0x3d')](_0x133263[_0x87d2('0x33')],function(_0x522145){var _0x15ca63={};_0x15ca63[_0x522145]={'$like':'%'+_0x5804c2[_0x87d2('0x2f')]['filter']+'%'};return _0x15ca63;})});}_0x133263=_[_0x87d2('0x3c')]({},_0x133263,_0x5804c2['options']);return _0x40a711[_0x87d2('0x4e')](_0x133263);}})[_0x87d2('0x24')](function(_0xdc350b){if(_0xdc350b){_0x25116c=_0xdc350b['length'];if(!_0x5804c2[_0x87d2('0x2f')]['hasOwnProperty']('nolimit')){_0x133263[_0x87d2('0x1c')]=qs['limit'](_0x5804c2[_0x87d2('0x2f')][_0x87d2('0x1c')]);_0x133263['offset']=qs['offset'](_0x5804c2[_0x87d2('0x2f')][_0x87d2('0x1e')]);}return _0x40a711['getSubjects'](_0x133263);}})['then'](function(_0x3ad039){if(_0x3ad039){return _0x3ad039?{'count':_0x25116c,'rows':_0x3ad039}:null;}})[_0x87d2('0x24')](respondWithResult(_0x495a1d,null))[_0x87d2('0x46')](handleError(_0x495a1d,null));};exports['getDescriptions']=function(_0x1290c0,_0x66d1f9,_0x2cf4ff){var _0x1dd851={};var _0x409dca={};var _0x5512c2;var _0x3aea20;return db[_0x87d2('0x29')][_0x87d2('0x4c')]({'where':{'id':_0x1290c0['params']['id']}})[_0x87d2('0x24')](handleEntityNotFound(_0x66d1f9,null))['then'](function(_0x292484){if(_0x292484){_0x5512c2=_0x292484;_0x409dca[_0x87d2('0x2e')]=_[_0x87d2('0x30')](db[_0x87d2('0x4d')][_0x87d2('0x2a')]);_0x409dca['query']=_[_0x87d2('0x30')](_0x1290c0[_0x87d2('0x2f')]);_0x409dca[_0x87d2('0x31')]=_[_0x87d2('0x32')](_0x409dca[_0x87d2('0x2e')],_0x409dca[_0x87d2('0x2f')]);_0x1dd851[_0x87d2('0x33')]=_[_0x87d2('0x32')](_0x409dca['model'],qs[_0x87d2('0x45')](_0x1290c0['query'][_0x87d2('0x45')]));_0x1dd851['attributes']=_0x1dd851[_0x87d2('0x33')][_0x87d2('0x34')]?_0x1dd851[_0x87d2('0x33')]:_0x409dca[_0x87d2('0x2e')];_0x1dd851['order']=qs['sort'](_0x1290c0[_0x87d2('0x2f')][_0x87d2('0x38')]);_0x1dd851[_0x87d2('0x39')]=qs[_0x87d2('0x31')](_[_0x87d2('0x3a')](_0x1290c0[_0x87d2('0x2f')],_0x409dca[_0x87d2('0x31')]));if(_0x1290c0[_0x87d2('0x2f')][_0x87d2('0x3b')]){_0x1dd851['where']=_[_0x87d2('0x3c')](_0x1dd851[_0x87d2('0x39')],{'$or':_[_0x87d2('0x3d')](_0x1dd851['attributes'],function(_0x15a0f5){var _0x13ae9a={};_0x13ae9a[_0x15a0f5]={'$like':'%'+_0x1290c0['query'][_0x87d2('0x3b')]+'%'};return _0x13ae9a;})});}_0x1dd851=_[_0x87d2('0x3c')]({},_0x1dd851,_0x1290c0[_0x87d2('0x3f')]);return _0x5512c2[_0x87d2('0x4f')](_0x1dd851);}})[_0x87d2('0x24')](function(_0x3ae6d7){if(_0x3ae6d7){_0x3aea20=_0x3ae6d7[_0x87d2('0x34')];if(!_0x1290c0['query'][_0x87d2('0x35')]('nolimit')){_0x1dd851[_0x87d2('0x1c')]=qs[_0x87d2('0x1c')](_0x1290c0[_0x87d2('0x2f')][_0x87d2('0x1c')]);_0x1dd851[_0x87d2('0x1e')]=qs[_0x87d2('0x1e')](_0x1290c0[_0x87d2('0x2f')][_0x87d2('0x1e')]);}return _0x5512c2[_0x87d2('0x4f')](_0x1dd851);}})[_0x87d2('0x24')](function(_0x28be45){if(_0x28be45){return _0x28be45?{'count':_0x3aea20,'rows':_0x28be45}:null;}})[_0x87d2('0x24')](respondWithResult(_0x66d1f9,null))['catch'](handleError(_0x66d1f9,null));}; \ No newline at end of file +var _0xb077=['reject','update','then','error','name','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','catch','body','destroy','findOne','keys','SalesforceField','filter','getFields','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','apply'];(function(_0x425bc6,_0x34ec2d){var _0x46ec57=function(_0x25bc14){while(--_0x25bc14){_0x425bc6['push'](_0x425bc6['shift']());}};_0x46ec57(++_0x34ec2d);}(_0xb077,0x7f));var _0x7b07=function(_0x363ac8,_0x4e1c84){_0x363ac8=_0x363ac8-0x0;var _0x2ea309=_0xb077[_0x363ac8];return _0x2ea309;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b07('0x1'));var rp=require(_0x7b07('0x2'));var moment=require(_0x7b07('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b07('0x4'));var util=require(_0x7b07('0x5'));var path=require(_0x7b07('0x6'));var sox=require(_0x7b07('0x7'));var csv=require(_0x7b07('0x8'));var ejs=require(_0x7b07('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b07('0xa'));var squel=require(_0x7b07('0xb'));var crypto=require(_0x7b07('0xc'));var jsforce=require(_0x7b07('0xd'));var deskjs=require(_0x7b07('0xe'));var toCsv=require(_0x7b07('0x8'));var querystring=require(_0x7b07('0xf'));var Papa=require('papaparse');var Redis=require(_0x7b07('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7b07('0x11'));var as=require(_0x7b07('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b07('0x13'))(_0x7b07('0x14'));var utils=require(_0x7b07('0x15'));var config=require(_0x7b07('0x16'));var licenseUtil=require(_0x7b07('0x17'));var db=require(_0x7b07('0x18'))['db'];function respondWithStatusCode(_0x4aa887,_0x3f24bd){_0x3f24bd=_0x3f24bd||0xcc;return function(_0x5985ba){if(_0x5985ba){return _0x4aa887[_0x7b07('0x19')](_0x3f24bd);}return _0x4aa887['status'](_0x3f24bd)[_0x7b07('0x1a')]();};}function respondWithResult(_0x163b2a,_0x377316){_0x377316=_0x377316||0xc8;return function(_0x2ff4f5){if(_0x2ff4f5){return _0x163b2a['status'](_0x377316)['json'](_0x2ff4f5);}};}function respondWithFilteredResult(_0x3ef92c,_0x4b90bf){return function(_0xcd70f3){if(_0xcd70f3){var _0x3b6a27=typeof _0x4b90bf['offset']===_0x7b07('0x1b')&&typeof _0x4b90bf['limit']==='undefined';var _0x5bde74=_0xcd70f3['count'];var _0x1e4839=_0x3b6a27?0x0:_0x4b90bf['offset'];var _0x31c96a=_0x3b6a27?_0xcd70f3[_0x7b07('0x1c')]:_0x4b90bf[_0x7b07('0x1d')]+_0x4b90bf[_0x7b07('0x1e')];var _0x31935e;if(_0x31c96a>=_0x5bde74){_0x31c96a=_0x5bde74;_0x31935e=0xc8;}else{_0x31935e=0xce;}_0x3ef92c[_0x7b07('0x1f')](_0x31935e);return _0x3ef92c[_0x7b07('0x20')](_0x7b07('0x21'),_0x1e4839+'-'+_0x31c96a+'/'+_0x5bde74)['json'](_0xcd70f3);}return null;};}function patchUpdates(_0x18a672){return function(_0x4d06aa){try{jsonpatch[_0x7b07('0x22')](_0x4d06aa,_0x18a672,!![]);}catch(_0x5526bd){return BPromise[_0x7b07('0x23')](_0x5526bd);}return _0x4d06aa['save']();};}function saveUpdates(_0x35b06d,_0x240e60){return function(_0x155d1b){if(_0x155d1b){return _0x155d1b[_0x7b07('0x24')](_0x35b06d)[_0x7b07('0x25')](function(_0x5a00df){return _0x5a00df;});}return null;};}function removeEntity(_0x43e501,_0x346043){return function(_0x285a63){if(_0x285a63){return _0x285a63['destroy']()[_0x7b07('0x25')](function(){_0x43e501[_0x7b07('0x1f')](0xcc)[_0x7b07('0x1a')]();});}};}function handleEntityNotFound(_0x12c208,_0x5dd89e){return function(_0x47a5d6){if(!_0x47a5d6){_0x12c208[_0x7b07('0x19')](0x194);}return _0x47a5d6;};}function handleError(_0x9806db,_0x57f56d){_0x57f56d=_0x57f56d||0x1f4;return function(_0x3f6a5c){logger[_0x7b07('0x26')](_0x3f6a5c['stack']);if(_0x3f6a5c[_0x7b07('0x27')]){delete _0x3f6a5c[_0x7b07('0x27')];}_0x9806db[_0x7b07('0x1f')](_0x57f56d)['send'](_0x3f6a5c);};}exports[_0x7b07('0x28')]=function(_0x728da8,_0x5d3fa6){var _0x10efcb={},_0x58cb00={},_0x4234fa={'count':0x0,'rows':[]};var _0x3e9483=_['map'](db[_0x7b07('0x29')][_0x7b07('0x2a')],function(_0x182319){return{'name':_0x182319[_0x7b07('0x2b')],'type':_0x182319[_0x7b07('0x2c')][_0x7b07('0x2d')]};});_0x58cb00[_0x7b07('0x2e')]=_[_0x7b07('0x2f')](_0x3e9483,_0x7b07('0x27'));_0x58cb00[_0x7b07('0x30')]=_['keys'](_0x728da8[_0x7b07('0x30')]);_0x58cb00[_0x7b07('0x31')]=_[_0x7b07('0x32')](_0x58cb00[_0x7b07('0x2e')],_0x58cb00[_0x7b07('0x30')]);_0x10efcb['attributes']=_['intersection'](_0x58cb00[_0x7b07('0x2e')],qs[_0x7b07('0x33')](_0x728da8[_0x7b07('0x30')][_0x7b07('0x33')]));_0x10efcb[_0x7b07('0x34')]=_0x10efcb['attributes']['length']?_0x10efcb['attributes']:_0x58cb00[_0x7b07('0x2e')];if(!_0x728da8[_0x7b07('0x30')][_0x7b07('0x35')](_0x7b07('0x36'))){_0x10efcb[_0x7b07('0x1e')]=qs[_0x7b07('0x1e')](_0x728da8[_0x7b07('0x30')][_0x7b07('0x1e')]);_0x10efcb[_0x7b07('0x1d')]=qs[_0x7b07('0x1d')](_0x728da8[_0x7b07('0x30')][_0x7b07('0x1d')]);}_0x10efcb[_0x7b07('0x37')]=qs[_0x7b07('0x38')](_0x728da8[_0x7b07('0x30')][_0x7b07('0x38')]);_0x10efcb[_0x7b07('0x39')]=qs[_0x7b07('0x31')](_[_0x7b07('0x3a')](_0x728da8[_0x7b07('0x30')],_0x58cb00[_0x7b07('0x31')]),_0x3e9483);if(_0x728da8[_0x7b07('0x30')]['filter']){_0x10efcb[_0x7b07('0x39')]=_[_0x7b07('0x3b')](_0x10efcb[_0x7b07('0x39')],{'$or':_[_0x7b07('0x2f')](_0x3e9483,function(_0x54a689){if(_0x54a689[_0x7b07('0x2c')]!==_0x7b07('0x3c')){var _0x1ff844={};_0x1ff844[_0x54a689[_0x7b07('0x27')]]={'$like':'%'+_0x728da8[_0x7b07('0x30')]['filter']+'%'};return _0x1ff844;}})});}_0x10efcb=_['merge']({},_0x10efcb,_0x728da8[_0x7b07('0x3d')]);var _0x24f8b0={'where':_0x10efcb[_0x7b07('0x39')]};return db[_0x7b07('0x29')][_0x7b07('0x1c')](_0x24f8b0)[_0x7b07('0x25')](function(_0x3d35a5){_0x4234fa[_0x7b07('0x1c')]=_0x3d35a5;if(_0x728da8[_0x7b07('0x30')][_0x7b07('0x3e')]){_0x10efcb[_0x7b07('0x3f')]=[{'all':!![]}];}return db[_0x7b07('0x29')][_0x7b07('0x40')](_0x10efcb);})[_0x7b07('0x25')](function(_0x3b1fc9){_0x4234fa[_0x7b07('0x41')]=_0x3b1fc9;return _0x4234fa;})[_0x7b07('0x25')](respondWithFilteredResult(_0x5d3fa6,_0x10efcb))['catch'](handleError(_0x5d3fa6,null));};exports[_0x7b07('0x42')]=function(_0x10c3eb,_0x5d7c9a){var _0x60e192={'raw':![],'where':{'id':_0x10c3eb[_0x7b07('0x43')]['id']}},_0x1d3b6d={};_0x1d3b6d[_0x7b07('0x2e')]=_['keys'](db['SalesforceConfiguration'][_0x7b07('0x2a')]);_0x1d3b6d['query']=_['keys'](_0x10c3eb[_0x7b07('0x30')]);_0x1d3b6d[_0x7b07('0x31')]=_['intersection'](_0x1d3b6d[_0x7b07('0x2e')],_0x1d3b6d[_0x7b07('0x30')]);_0x60e192['attributes']=_[_0x7b07('0x32')](_0x1d3b6d[_0x7b07('0x2e')],qs[_0x7b07('0x33')](_0x10c3eb[_0x7b07('0x30')][_0x7b07('0x33')]));_0x60e192['attributes']=_0x60e192[_0x7b07('0x34')][_0x7b07('0x44')]?_0x60e192[_0x7b07('0x34')]:_0x1d3b6d['model'];if(_0x10c3eb[_0x7b07('0x30')][_0x7b07('0x3e')]){_0x60e192[_0x7b07('0x3f')]=[{'all':!![]}];}_0x60e192=_[_0x7b07('0x3b')]({},_0x60e192,_0x10c3eb[_0x7b07('0x3d')]);return db[_0x7b07('0x29')][_0x7b07('0x45')](_0x60e192)[_0x7b07('0x25')](handleEntityNotFound(_0x5d7c9a,null))[_0x7b07('0x25')](respondWithResult(_0x5d7c9a,null))['catch'](handleError(_0x5d7c9a,null));};exports[_0x7b07('0x46')]=function(_0x3d3625,_0x39d023){return db[_0x7b07('0x29')][_0x7b07('0x46')](_0x3d3625['body'],{})[_0x7b07('0x25')](respondWithResult(_0x39d023,0xc9))[_0x7b07('0x47')](handleError(_0x39d023,null));};exports[_0x7b07('0x24')]=function(_0x23445e,_0x149c9c){if(_0x23445e[_0x7b07('0x48')]['id']){delete _0x23445e[_0x7b07('0x48')]['id'];}return db[_0x7b07('0x29')][_0x7b07('0x45')]({'where':{'id':_0x23445e[_0x7b07('0x43')]['id']}})[_0x7b07('0x25')](handleEntityNotFound(_0x149c9c,null))[_0x7b07('0x25')](saveUpdates(_0x23445e[_0x7b07('0x48')],null))['then'](respondWithResult(_0x149c9c,null))['catch'](handleError(_0x149c9c,null));};exports[_0x7b07('0x49')]=function(_0x53f5b3,_0x2f9439){return db['SalesforceConfiguration'][_0x7b07('0x45')]({'where':{'id':_0x53f5b3['params']['id']}})[_0x7b07('0x25')](handleEntityNotFound(_0x2f9439,null))[_0x7b07('0x25')](removeEntity(_0x2f9439,null))['catch'](handleError(_0x2f9439,null));};exports['getFields']=function(_0x1f167b,_0x95a881,_0x54ce6d){var _0x3a24d0={};var _0x35a678={};var _0x217670;var _0x23438c;return db[_0x7b07('0x29')][_0x7b07('0x4a')]({'where':{'id':_0x1f167b[_0x7b07('0x43')]['id']}})[_0x7b07('0x25')](handleEntityNotFound(_0x95a881,null))[_0x7b07('0x25')](function(_0x2879bd){if(_0x2879bd){_0x217670=_0x2879bd;_0x35a678[_0x7b07('0x2e')]=_[_0x7b07('0x4b')](db[_0x7b07('0x4c')][_0x7b07('0x2a')]);_0x35a678[_0x7b07('0x30')]=_['keys'](_0x1f167b[_0x7b07('0x30')]);_0x35a678[_0x7b07('0x31')]=_[_0x7b07('0x32')](_0x35a678[_0x7b07('0x2e')],_0x35a678[_0x7b07('0x30')]);_0x3a24d0[_0x7b07('0x34')]=_[_0x7b07('0x32')](_0x35a678[_0x7b07('0x2e')],qs[_0x7b07('0x33')](_0x1f167b[_0x7b07('0x30')]['fields']));_0x3a24d0['attributes']=_0x3a24d0[_0x7b07('0x34')][_0x7b07('0x44')]?_0x3a24d0['attributes']:_0x35a678[_0x7b07('0x2e')];_0x3a24d0[_0x7b07('0x37')]=qs[_0x7b07('0x38')](_0x1f167b[_0x7b07('0x30')][_0x7b07('0x38')]);_0x3a24d0[_0x7b07('0x39')]=qs['filters'](_[_0x7b07('0x3a')](_0x1f167b[_0x7b07('0x30')],_0x35a678[_0x7b07('0x31')]));if(_0x1f167b[_0x7b07('0x30')][_0x7b07('0x4d')]){_0x3a24d0['where']=_[_0x7b07('0x3b')](_0x3a24d0[_0x7b07('0x39')],{'$or':_[_0x7b07('0x2f')](_0x3a24d0[_0x7b07('0x34')],function(_0x27502b){var _0x4b33f6={};_0x4b33f6[_0x27502b]={'$like':'%'+_0x1f167b[_0x7b07('0x30')][_0x7b07('0x4d')]+'%'};return _0x4b33f6;})});}_0x3a24d0=_[_0x7b07('0x3b')]({},_0x3a24d0,_0x1f167b[_0x7b07('0x3d')]);return _0x217670[_0x7b07('0x4e')](_0x3a24d0);}})[_0x7b07('0x25')](function(_0x5edd72){if(_0x5edd72){_0x23438c=_0x5edd72['length'];if(!_0x1f167b[_0x7b07('0x30')]['hasOwnProperty'](_0x7b07('0x36'))){_0x3a24d0['limit']=qs[_0x7b07('0x1e')](_0x1f167b[_0x7b07('0x30')][_0x7b07('0x1e')]);_0x3a24d0['offset']=qs[_0x7b07('0x1d')](_0x1f167b['query']['offset']);}return _0x217670[_0x7b07('0x4e')](_0x3a24d0);}})['then'](function(_0x267fe4){if(_0x267fe4){return _0x267fe4?{'count':_0x23438c,'rows':_0x267fe4}:null;}})[_0x7b07('0x25')](respondWithResult(_0x95a881,null))['catch'](handleError(_0x95a881,null));};exports[_0x7b07('0x4f')]=function(_0x3f7b12,_0x170604,_0x3f8aa7){var _0x2e47cc={};var _0xaead70={};var _0x532181;var _0x2b5def;return db['SalesforceConfiguration'][_0x7b07('0x4a')]({'where':{'id':_0x3f7b12[_0x7b07('0x43')]['id']}})[_0x7b07('0x25')](handleEntityNotFound(_0x170604,null))[_0x7b07('0x25')](function(_0x161071){if(_0x161071){_0x532181=_0x161071;_0xaead70[_0x7b07('0x2e')]=_['keys'](db[_0x7b07('0x4c')][_0x7b07('0x2a')]);_0xaead70[_0x7b07('0x30')]=_[_0x7b07('0x4b')](_0x3f7b12[_0x7b07('0x30')]);_0xaead70['filters']=_['intersection'](_0xaead70[_0x7b07('0x2e')],_0xaead70[_0x7b07('0x30')]);_0x2e47cc[_0x7b07('0x34')]=_['intersection'](_0xaead70[_0x7b07('0x2e')],qs['fields'](_0x3f7b12[_0x7b07('0x30')][_0x7b07('0x33')]));_0x2e47cc[_0x7b07('0x34')]=_0x2e47cc[_0x7b07('0x34')]['length']?_0x2e47cc[_0x7b07('0x34')]:_0xaead70[_0x7b07('0x2e')];_0x2e47cc[_0x7b07('0x37')]=qs[_0x7b07('0x38')](_0x3f7b12['query'][_0x7b07('0x38')]);_0x2e47cc[_0x7b07('0x39')]=qs['filters'](_['pick'](_0x3f7b12['query'],_0xaead70[_0x7b07('0x31')]));if(_0x3f7b12[_0x7b07('0x30')]['filter']){_0x2e47cc['where']=_[_0x7b07('0x3b')](_0x2e47cc['where'],{'$or':_[_0x7b07('0x2f')](_0x2e47cc[_0x7b07('0x34')],function(_0x2e384e){var _0x226f29={};_0x226f29[_0x2e384e]={'$like':'%'+_0x3f7b12['query'][_0x7b07('0x4d')]+'%'};return _0x226f29;})});}_0x2e47cc=_[_0x7b07('0x3b')]({},_0x2e47cc,_0x3f7b12[_0x7b07('0x3d')]);return _0x532181[_0x7b07('0x4f')](_0x2e47cc);}})[_0x7b07('0x25')](function(_0x4fa815){if(_0x4fa815){_0x2b5def=_0x4fa815['length'];if(!_0x3f7b12[_0x7b07('0x30')][_0x7b07('0x35')](_0x7b07('0x36'))){_0x2e47cc['limit']=qs[_0x7b07('0x1e')](_0x3f7b12[_0x7b07('0x30')][_0x7b07('0x1e')]);_0x2e47cc[_0x7b07('0x1d')]=qs[_0x7b07('0x1d')](_0x3f7b12[_0x7b07('0x30')]['offset']);}return _0x532181['getSubjects'](_0x2e47cc);}})['then'](function(_0x3e2141){if(_0x3e2141){return _0x3e2141?{'count':_0x2b5def,'rows':_0x3e2141}:null;}})[_0x7b07('0x25')](respondWithResult(_0x170604,null))['catch'](handleError(_0x170604,null));};exports[_0x7b07('0x50')]=function(_0x329efe,_0x55db62,_0x3f251c){var _0x2186d6={};var _0x346b62={};var _0x1335a0;var _0x3394a0;return db['SalesforceConfiguration'][_0x7b07('0x4a')]({'where':{'id':_0x329efe['params']['id']}})[_0x7b07('0x25')](handleEntityNotFound(_0x55db62,null))[_0x7b07('0x25')](function(_0x202419){if(_0x202419){_0x1335a0=_0x202419;_0x346b62[_0x7b07('0x2e')]=_[_0x7b07('0x4b')](db[_0x7b07('0x4c')][_0x7b07('0x2a')]);_0x346b62[_0x7b07('0x30')]=_[_0x7b07('0x4b')](_0x329efe[_0x7b07('0x30')]);_0x346b62[_0x7b07('0x31')]=_[_0x7b07('0x32')](_0x346b62[_0x7b07('0x2e')],_0x346b62[_0x7b07('0x30')]);_0x2186d6[_0x7b07('0x34')]=_[_0x7b07('0x32')](_0x346b62[_0x7b07('0x2e')],qs[_0x7b07('0x33')](_0x329efe['query'][_0x7b07('0x33')]));_0x2186d6[_0x7b07('0x34')]=_0x2186d6['attributes'][_0x7b07('0x44')]?_0x2186d6[_0x7b07('0x34')]:_0x346b62[_0x7b07('0x2e')];_0x2186d6[_0x7b07('0x37')]=qs['sort'](_0x329efe[_0x7b07('0x30')][_0x7b07('0x38')]);_0x2186d6[_0x7b07('0x39')]=qs['filters'](_[_0x7b07('0x3a')](_0x329efe['query'],_0x346b62[_0x7b07('0x31')]));if(_0x329efe[_0x7b07('0x30')]['filter']){_0x2186d6['where']=_[_0x7b07('0x3b')](_0x2186d6['where'],{'$or':_['map'](_0x2186d6['attributes'],function(_0x566bbf){var _0x471b3e={};_0x471b3e[_0x566bbf]={'$like':'%'+_0x329efe[_0x7b07('0x30')][_0x7b07('0x4d')]+'%'};return _0x471b3e;})});}_0x2186d6=_[_0x7b07('0x3b')]({},_0x2186d6,_0x329efe[_0x7b07('0x3d')]);return _0x1335a0[_0x7b07('0x50')](_0x2186d6);}})[_0x7b07('0x25')](function(_0x226bc5){if(_0x226bc5){_0x3394a0=_0x226bc5[_0x7b07('0x44')];if(!_0x329efe[_0x7b07('0x30')][_0x7b07('0x35')](_0x7b07('0x36'))){_0x2186d6[_0x7b07('0x1e')]=qs['limit'](_0x329efe['query'][_0x7b07('0x1e')]);_0x2186d6[_0x7b07('0x1d')]=qs[_0x7b07('0x1d')](_0x329efe[_0x7b07('0x30')][_0x7b07('0x1d')]);}return _0x1335a0['getDescriptions'](_0x2186d6);}})['then'](function(_0x2f3651){if(_0x2f3651){return _0x2f3651?{'count':_0x3394a0,'rows':_0x2f3651}:null;}})[_0x7b07('0x25')](respondWithResult(_0x55db62,null))['catch'](handleError(_0x55db62,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6225e96..d1b4310 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 _0xd774=['bluebird','request-promise','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment'];(function(_0x81119e,_0x1789cc){var _0x26bc19=function(_0x1ecaaf){while(--_0x1ecaaf){_0x81119e['push'](_0x81119e['shift']());}};_0x26bc19(++_0x1789cc);}(_0xd774,0x134));var _0x4d77=function(_0x56eb01,_0x1821ea){_0x56eb01=_0x56eb01-0x0;var _0x2f376c=_0xd774[_0x56eb01];return _0x2f376c;};'use strict';var _=require(_0x4d77('0x0'));var util=require(_0x4d77('0x1'));var logger=require(_0x4d77('0x2'))('api');var moment=require(_0x4d77('0x3'));var BPromise=require(_0x4d77('0x4'));var rp=require(_0x4d77('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d77('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d77('0x7'));module[_0x4d77('0x8')]=function(_0xca4bc2,_0x13e34a){return _0xca4bc2[_0x4d77('0x9')](_0x4d77('0xa'),attributes,{'tableName':_0x4d77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd27f=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0xfe274,_0xf9d827){var _0x2a5d9e=function(_0x59dc00){while(--_0x59dc00){_0xfe274['push'](_0xfe274['shift']());}};_0x2a5d9e(++_0xf9d827);}(_0xd27f,0x11c));var _0xfd27=function(_0x3adad6,_0xbd0e70){_0x3adad6=_0x3adad6-0x0;var _0x2e3a98=_0xd27f[_0x3adad6];return _0x2e3a98;};'use strict';var _=require(_0xfd27('0x0'));var util=require('util');var logger=require(_0xfd27('0x1'))('api');var moment=require(_0xfd27('0x2'));var BPromise=require(_0xfd27('0x3'));var rp=require(_0xfd27('0x4'));var fs=require('fs');var path=require(_0xfd27('0x5'));var rimraf=require('rimraf');var config=require(_0xfd27('0x6'));var attributes=require(_0xfd27('0x7'));module[_0xfd27('0x8')]=function(_0x20fb82,_0x178f4c){return _0x20fb82[_0xfd27('0x9')](_0xfd27('0xa'),attributes,{'tableName':_0xfd27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9f9e6f3..1fa4890 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 _0xfaf7=['../../config/logger','rpc','../../config/environment','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x217542,_0x15cc22){var _0x4bb071=function(_0x5f471b){while(--_0x5f471b){_0x217542['push'](_0x217542['shift']());}};_0x4bb071(++_0x15cc22);}(_0xfaf7,0x19b));var _0x7faf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfaf7[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7faf('0x0'));var util=require(_0x7faf('0x1'));var moment=require(_0x7faf('0x2'));var BPromise=require(_0x7faf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7faf('0x4'));var db=require(_0x7faf('0x5'))['db'];var utils=require(_0x7faf('0x6'));var logger=require(_0x7faf('0x7'))(_0x7faf('0x8'));var config=require(_0x7faf('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x243c95,_0x3923d6,_0x2f1b3b){return new BPromise(function(_0x5cfc1e,_0x492e6f){return client['request'](_0x243c95,_0x2f1b3b)[_0x7faf('0xa')](function(_0x505d87){logger[_0x7faf('0xb')](_0x7faf('0xc'),_0x3923d6,_0x7faf('0xd'));logger[_0x7faf('0xe')](_0x7faf('0xf'),_0x3923d6,_0x7faf('0xd'),JSON[_0x7faf('0x10')](_0x505d87));if(_0x505d87[_0x7faf('0x11')]){if(_0x505d87[_0x7faf('0x11')][_0x7faf('0x12')]===0x1f4){logger[_0x7faf('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3923d6,_0x505d87[_0x7faf('0x11')][_0x7faf('0x13')]);return _0x492e6f(_0x505d87[_0x7faf('0x11')]['message']);}logger[_0x7faf('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3923d6,_0x505d87[_0x7faf('0x11')][_0x7faf('0x13')]);return _0x5cfc1e(_0x505d87[_0x7faf('0x11')][_0x7faf('0x13')]);}else{logger[_0x7faf('0xb')](_0x7faf('0xc'),_0x3923d6,'request\x20sent');_0x5cfc1e(_0x505d87[_0x7faf('0x14')]['message']);}})[_0x7faf('0x15')](function(_0x567cd3){logger[_0x7faf('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3923d6,_0x567cd3);_0x492e6f(_0x567cd3);});});} \ No newline at end of file +var _0xbc08=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1d8ae2,_0x34ea42){var _0x5467e3=function(_0x5bd318){while(--_0x5bd318){_0x1d8ae2['push'](_0x1d8ae2['shift']());}};_0x5467e3(++_0x34ea42);}(_0xbc08,0x18b));var _0x8bc0=function(_0x5281ce,_0x210279){_0x5281ce=_0x5281ce-0x0;var _0x138d09=_0xbc08[_0x5281ce];return _0x138d09;};'use strict';var _=require(_0x8bc0('0x0'));var util=require(_0x8bc0('0x1'));var moment=require('moment');var BPromise=require(_0x8bc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc0('0x3'))['db'];var utils=require(_0x8bc0('0x4'));var logger=require(_0x8bc0('0x5'))(_0x8bc0('0x6'));var config=require(_0x8bc0('0x7'));var jayson=require(_0x8bc0('0x8'));var client=jayson[_0x8bc0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5aff78,_0x239ac4,_0x412ebe){return new BPromise(function(_0x191e84,_0x5398da){return client[_0x8bc0('0xa')](_0x5aff78,_0x412ebe)['then'](function(_0xd8d2fc){logger['info'](_0x8bc0('0xb'),_0x239ac4,'request\x20sent');logger[_0x8bc0('0xc')](_0x8bc0('0xd'),_0x239ac4,_0x8bc0('0xe'),JSON[_0x8bc0('0xf')](_0xd8d2fc));if(_0xd8d2fc[_0x8bc0('0x10')]){if(_0xd8d2fc[_0x8bc0('0x10')][_0x8bc0('0x11')]===0x1f4){logger[_0x8bc0('0x10')](_0x8bc0('0xb'),_0x239ac4,_0xd8d2fc[_0x8bc0('0x10')]['message']);return _0x5398da(_0xd8d2fc[_0x8bc0('0x10')][_0x8bc0('0x12')]);}logger[_0x8bc0('0x10')](_0x8bc0('0xb'),_0x239ac4,_0xd8d2fc[_0x8bc0('0x10')][_0x8bc0('0x12')]);return _0x191e84(_0xd8d2fc[_0x8bc0('0x10')][_0x8bc0('0x12')]);}else{logger[_0x8bc0('0x13')](_0x8bc0('0xb'),_0x239ac4,_0x8bc0('0xe'));_0x191e84(_0xd8d2fc[_0x8bc0('0x14')]['message']);}})[_0x8bc0('0x15')](function(_0x20f68b){logger[_0x8bc0('0x10')](_0x8bc0('0xb'),_0x239ac4,_0x20f68b);_0x5398da(_0x20f68b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e83a93b..c3a8618 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 _0x7767=['util','connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x1f93b6,_0xf85aed){var _0x3cbad6=function(_0x4cd5b7){while(--_0x4cd5b7){_0x1f93b6['push'](_0x1f93b6['shift']());}};_0x3cbad6(++_0xf85aed);}(_0x7767,0xb3));var _0x7776=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x7767[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x7776('0x0'));var util=require(_0x7776('0x1'));var path=require('path');var timeout=require(_0x7776('0x2'));var express=require(_0x7776('0x3'));var router=express[_0x7776('0x4')]();var fs_extra=require(_0x7776('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7776('0x6'));var controller=require(_0x7776('0x7'));router[_0x7776('0x8')]('/',auth[_0x7776('0x9')](),controller[_0x7776('0xa')]);router['get'](_0x7776('0xb'),auth[_0x7776('0x9')](),controller[_0x7776('0xc')]);router[_0x7776('0xd')]('/',auth[_0x7776('0x9')](),controller[_0x7776('0xe')]);router[_0x7776('0xf')](_0x7776('0xb'),auth[_0x7776('0x9')](),controller[_0x7776('0x10')]);router[_0x7776('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7776('0x12')]);module[_0x7776('0x13')]=router; \ No newline at end of file +var _0x2e66=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','/:id'];(function(_0x174a4d,_0x203ae3){var _0x240fa1=function(_0x7139f){while(--_0x7139f){_0x174a4d['push'](_0x174a4d['shift']());}};_0x240fa1(++_0x203ae3);}(_0x2e66,0x110));var _0x62e6=function(_0xca0692,_0x3a5898){_0xca0692=_0xca0692-0x0;var _0x3393da=_0x2e66[_0xca0692];return _0x3393da;};'use strict';var multer=require(_0x62e6('0x0'));var util=require(_0x62e6('0x1'));var path=require(_0x62e6('0x2'));var timeout=require(_0x62e6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x62e6('0x4'));var auth=require(_0x62e6('0x5'));var interaction=require(_0x62e6('0x6'));var config=require(_0x62e6('0x7'));var controller=require(_0x62e6('0x8'));router['get']('/',auth[_0x62e6('0x9')](),controller[_0x62e6('0xa')]);router[_0x62e6('0xb')](_0x62e6('0xc'),auth[_0x62e6('0x9')](),controller['show']);router[_0x62e6('0xd')]('/',auth[_0x62e6('0x9')](),controller[_0x62e6('0xe')]);router[_0x62e6('0xf')](_0x62e6('0xc'),auth[_0x62e6('0x9')](),controller[_0x62e6('0x10')]);router['delete'](_0x62e6('0xc'),auth[_0x62e6('0x9')](),controller[_0x62e6('0x11')]);module[_0x62e6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 407a22c..b9b12ac 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 _0xe05e=['STRING','ENUM','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x1d69e5,_0x2a29af){var _0x17da11=function(_0x36c61f){while(--_0x36c61f){_0x1d69e5['push'](_0x1d69e5['shift']());}};_0x17da11(++_0x2a29af);}(_0xe05e,0x17a));var _0xee05=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xe05e[_0xb6e2ea];return _0x2a57bb;};'use strict';var Sequelize=require('sequelize');module[_0xee05('0x0')]={'type':{'type':Sequelize['ENUM'](_0xee05('0x1'),_0xee05('0x2'),_0xee05('0x3'),_0xee05('0x4'),_0xee05('0x5')),'defaultValue':_0xee05('0x1')},'content':{'type':Sequelize[_0xee05('0x6')]},'key':{'type':Sequelize[_0xee05('0x6')]},'keyType':{'type':Sequelize[_0xee05('0x7')](_0xee05('0x1'),_0xee05('0x2'),_0xee05('0x3'))},'keyContent':{'type':Sequelize[_0xee05('0x6')]},'idField':{'type':Sequelize[_0xee05('0x6')]},'variableName':{'type':Sequelize[_0xee05('0x6')]}}; \ No newline at end of file +var _0x3821=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x3821,0xab));var _0x1382=function(_0x30449f,_0x3a8384){_0x30449f=_0x30449f-0x0;var _0x837f=_0x3821[_0x30449f];return _0x837f;};'use strict';var Sequelize=require(_0x1382('0x0'));module[_0x1382('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1382('0x2'),_0x1382('0x3'),_0x1382('0x4'),_0x1382('0x5'),_0x1382('0x6')),'defaultValue':_0x1382('0x2')},'content':{'type':Sequelize[_0x1382('0x7')]},'key':{'type':Sequelize[_0x1382('0x7')]},'keyType':{'type':Sequelize[_0x1382('0x8')](_0x1382('0x2'),'variable',_0x1382('0x4'))},'keyContent':{'type':Sequelize[_0x1382('0x7')]},'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 d0cf845..3276ff7 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 _0x0ec4=['options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','includeAll','findAll','rows','catch','show','params','keys','include'];(function(_0xfef951,_0x39f247){var _0x368e93=function(_0x30a75b){while(--_0x30a75b){_0xfef951['push'](_0xfef951['shift']());}};_0x368e93(++_0x39f247);}(_0x0ec4,0xe9));var _0x40ec=function(_0x3f55bd,_0x4d9695){_0x3f55bd=_0x3f55bd-0x0;var _0x3905a0=_0x0ec4[_0x3f55bd];return _0x3905a0;};'use strict';var emlformat=require(_0x40ec('0x0'));var rimraf=require(_0x40ec('0x1'));var zipdir=require(_0x40ec('0x2'));var jsonpatch=require(_0x40ec('0x3'));var rp=require(_0x40ec('0x4'));var moment=require(_0x40ec('0x5'));var BPromise=require(_0x40ec('0x6'));var Mustache=require(_0x40ec('0x7'));var util=require(_0x40ec('0x8'));var path=require(_0x40ec('0x9'));var sox=require(_0x40ec('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x40ec('0xb'));var _=require(_0x40ec('0xc'));var squel=require(_0x40ec('0xd'));var crypto=require(_0x40ec('0xe'));var jsforce=require(_0x40ec('0xf'));var deskjs=require(_0x40ec('0x10'));var toCsv=require(_0x40ec('0x11'));var querystring=require(_0x40ec('0x12'));var Papa=require('papaparse');var Redis=require(_0x40ec('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x40ec('0x14'));var as=require(_0x40ec('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40ec('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x40ec('0x17'));var licenseUtil=require(_0x40ec('0x18'));var db=require(_0x40ec('0x19'))['db'];function respondWithStatusCode(_0x28671d,_0x2fb09a){_0x2fb09a=_0x2fb09a||0xcc;return function(_0x51a0a5){if(_0x51a0a5){return _0x28671d[_0x40ec('0x1a')](_0x2fb09a);}return _0x28671d[_0x40ec('0x1b')](_0x2fb09a)[_0x40ec('0x1c')]();};}function respondWithResult(_0x2a139a,_0x4518b8){_0x4518b8=_0x4518b8||0xc8;return function(_0x5ea229){if(_0x5ea229){return _0x2a139a['status'](_0x4518b8)[_0x40ec('0x1d')](_0x5ea229);}};}function respondWithFilteredResult(_0x5c502b,_0x407fab){return function(_0x851097){if(_0x851097){var _0x3b6156=typeof _0x407fab[_0x40ec('0x1e')]===_0x40ec('0x1f')&&typeof _0x407fab[_0x40ec('0x20')]===_0x40ec('0x1f');var _0x4ab90f=_0x851097[_0x40ec('0x21')];var _0x5d9f75=_0x3b6156?0x0:_0x407fab[_0x40ec('0x1e')];var _0x1a4ae0=_0x3b6156?_0x851097['count']:_0x407fab[_0x40ec('0x1e')]+_0x407fab[_0x40ec('0x20')];var _0x1599d4;if(_0x1a4ae0>=_0x4ab90f){_0x1a4ae0=_0x4ab90f;_0x1599d4=0xc8;}else{_0x1599d4=0xce;}_0x5c502b['status'](_0x1599d4);return _0x5c502b[_0x40ec('0x22')](_0x40ec('0x23'),_0x5d9f75+'-'+_0x1a4ae0+'/'+_0x4ab90f)['json'](_0x851097);}return null;};}function patchUpdates(_0x17519b){return function(_0x4fbd4a){try{jsonpatch['apply'](_0x4fbd4a,_0x17519b,!![]);}catch(_0x5739f8){return BPromise[_0x40ec('0x24')](_0x5739f8);}return _0x4fbd4a['save']();};}function saveUpdates(_0x284e32,_0x361d1d){return function(_0x35dcbf){if(_0x35dcbf){return _0x35dcbf['update'](_0x284e32)[_0x40ec('0x25')](function(_0x43b965){return _0x43b965;});}return null;};}function removeEntity(_0x2c70e7,_0x2e0be9){return function(_0x4cea9d){if(_0x4cea9d){return _0x4cea9d[_0x40ec('0x26')]()[_0x40ec('0x25')](function(){_0x2c70e7['status'](0xcc)[_0x40ec('0x1c')]();});}};}function handleEntityNotFound(_0x231d32,_0x4dd0b7){return function(_0x292caf){if(!_0x292caf){_0x231d32[_0x40ec('0x1a')](0x194);}return _0x292caf;};}function handleError(_0x370eac,_0x131743){_0x131743=_0x131743||0x1f4;return function(_0x163029){logger[_0x40ec('0x27')](_0x163029[_0x40ec('0x28')]);if(_0x163029['name']){delete _0x163029[_0x40ec('0x29')];}_0x370eac[_0x40ec('0x1b')](_0x131743)[_0x40ec('0x2a')](_0x163029);};}exports[_0x40ec('0x2b')]=function(_0x418ba8,_0x38eba3){var _0x2e9474={},_0x5e6c8d={},_0x1f8841={'count':0x0,'rows':[]};var _0x83c6b0=_['map'](db[_0x40ec('0x2c')][_0x40ec('0x2d')],function(_0x247563){return{'name':_0x247563[_0x40ec('0x2e')],'type':_0x247563[_0x40ec('0x2f')][_0x40ec('0x30')]};});_0x5e6c8d[_0x40ec('0x31')]=_['map'](_0x83c6b0,'name');_0x5e6c8d[_0x40ec('0x32')]=_['keys'](_0x418ba8['query']);_0x5e6c8d[_0x40ec('0x33')]=_[_0x40ec('0x34')](_0x5e6c8d[_0x40ec('0x31')],_0x5e6c8d[_0x40ec('0x32')]);_0x2e9474['attributes']=_[_0x40ec('0x34')](_0x5e6c8d[_0x40ec('0x31')],qs[_0x40ec('0x35')](_0x418ba8[_0x40ec('0x32')][_0x40ec('0x35')]));_0x2e9474[_0x40ec('0x36')]=_0x2e9474[_0x40ec('0x36')][_0x40ec('0x37')]?_0x2e9474[_0x40ec('0x36')]:_0x5e6c8d[_0x40ec('0x31')];if(!_0x418ba8[_0x40ec('0x32')][_0x40ec('0x38')](_0x40ec('0x39'))){_0x2e9474[_0x40ec('0x20')]=qs[_0x40ec('0x20')](_0x418ba8[_0x40ec('0x32')][_0x40ec('0x20')]);_0x2e9474[_0x40ec('0x1e')]=qs[_0x40ec('0x1e')](_0x418ba8[_0x40ec('0x32')][_0x40ec('0x1e')]);}_0x2e9474['order']=qs[_0x40ec('0x3a')](_0x418ba8['query'][_0x40ec('0x3a')]);_0x2e9474[_0x40ec('0x3b')]=qs[_0x40ec('0x33')](_[_0x40ec('0x3c')](_0x418ba8[_0x40ec('0x32')],_0x5e6c8d[_0x40ec('0x33')]),_0x83c6b0);if(_0x418ba8[_0x40ec('0x32')]['filter']){_0x2e9474[_0x40ec('0x3b')]=_[_0x40ec('0x3d')](_0x2e9474[_0x40ec('0x3b')],{'$or':_[_0x40ec('0x3e')](_0x83c6b0,function(_0x1928f9){if(_0x1928f9[_0x40ec('0x2f')]!=='VIRTUAL'){var _0x3c876b={};_0x3c876b[_0x1928f9['name']]={'$like':'%'+_0x418ba8[_0x40ec('0x32')]['filter']+'%'};return _0x3c876b;}})});}_0x2e9474=_['merge']({},_0x2e9474,_0x418ba8['options']);var _0x4685ec={'where':_0x2e9474[_0x40ec('0x3b')]};return db[_0x40ec('0x2c')]['count'](_0x4685ec)[_0x40ec('0x25')](function(_0xb8d673){_0x1f8841[_0x40ec('0x21')]=_0xb8d673;if(_0x418ba8[_0x40ec('0x32')][_0x40ec('0x3f')]){_0x2e9474['include']=[{'all':!![]}];}return db['SalesforceField'][_0x40ec('0x40')](_0x2e9474);})['then'](function(_0x1b88ed){_0x1f8841[_0x40ec('0x41')]=_0x1b88ed;return _0x1f8841;})[_0x40ec('0x25')](respondWithFilteredResult(_0x38eba3,_0x2e9474))[_0x40ec('0x42')](handleError(_0x38eba3,null));};exports[_0x40ec('0x43')]=function(_0x15b030,_0xe76601){var _0x4e1ad9={'raw':!![],'where':{'id':_0x15b030[_0x40ec('0x44')]['id']}},_0x373e9d={};_0x373e9d[_0x40ec('0x31')]=_['keys'](db[_0x40ec('0x2c')]['rawAttributes']);_0x373e9d[_0x40ec('0x32')]=_[_0x40ec('0x45')](_0x15b030[_0x40ec('0x32')]);_0x373e9d['filters']=_[_0x40ec('0x34')](_0x373e9d[_0x40ec('0x31')],_0x373e9d['query']);_0x4e1ad9['attributes']=_['intersection'](_0x373e9d[_0x40ec('0x31')],qs[_0x40ec('0x35')](_0x15b030['query'][_0x40ec('0x35')]));_0x4e1ad9['attributes']=_0x4e1ad9['attributes'][_0x40ec('0x37')]?_0x4e1ad9[_0x40ec('0x36')]:_0x373e9d['model'];if(_0x15b030['query'][_0x40ec('0x3f')]){_0x4e1ad9[_0x40ec('0x46')]=[{'all':!![]}];}_0x4e1ad9=_[_0x40ec('0x3d')]({},_0x4e1ad9,_0x15b030[_0x40ec('0x47')]);return db[_0x40ec('0x2c')][_0x40ec('0x48')](_0x4e1ad9)['then'](handleEntityNotFound(_0xe76601,null))[_0x40ec('0x25')](respondWithResult(_0xe76601,null))[_0x40ec('0x42')](handleError(_0xe76601,null));};exports[_0x40ec('0x49')]=function(_0xc7a7c3,_0x1b4717){return db['SalesforceField'][_0x40ec('0x49')](_0xc7a7c3[_0x40ec('0x4a')],{})[_0x40ec('0x25')](respondWithResult(_0x1b4717,0xc9))['catch'](handleError(_0x1b4717,null));};exports[_0x40ec('0x4b')]=function(_0x2a44a6,_0x5b9677){if(_0x2a44a6[_0x40ec('0x4a')]['id']){delete _0x2a44a6[_0x40ec('0x4a')]['id'];}return db[_0x40ec('0x2c')][_0x40ec('0x48')]({'where':{'id':_0x2a44a6[_0x40ec('0x44')]['id']}})[_0x40ec('0x25')](handleEntityNotFound(_0x5b9677,null))[_0x40ec('0x25')](saveUpdates(_0x2a44a6[_0x40ec('0x4a')],null))[_0x40ec('0x25')](respondWithResult(_0x5b9677,null))[_0x40ec('0x42')](handleError(_0x5b9677,null));};exports[_0x40ec('0x26')]=function(_0x55f87f,_0x213da6){return db[_0x40ec('0x2c')][_0x40ec('0x48')]({'where':{'id':_0x55f87f[_0x40ec('0x44')]['id']}})[_0x40ec('0x25')](handleEntityNotFound(_0x213da6,null))[_0x40ec('0x25')](removeEntity(_0x213da6,null))[_0x40ec('0x42')](handleError(_0x213da6,null));}; \ No newline at end of file +var _0x8e0c=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','error','name','send','index','map','SalesforceField','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8e0c,0x121));var _0xc8e0=function(_0x18779b,_0x4125de){_0x18779b=_0x18779b-0x0;var _0x2c8980=_0x8e0c[_0x18779b];return _0x2c8980;};'use strict';var emlformat=require(_0xc8e0('0x0'));var rimraf=require(_0xc8e0('0x1'));var zipdir=require(_0xc8e0('0x2'));var jsonpatch=require(_0xc8e0('0x3'));var rp=require(_0xc8e0('0x4'));var moment=require(_0xc8e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc8e0('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc8e0('0x7'));var csv=require(_0xc8e0('0x8'));var ejs=require(_0xc8e0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc8e0('0xa'));var squel=require(_0xc8e0('0xb'));var crypto=require(_0xc8e0('0xc'));var jsforce=require(_0xc8e0('0xd'));var deskjs=require(_0xc8e0('0xe'));var toCsv=require(_0xc8e0('0x8'));var querystring=require(_0xc8e0('0xf'));var Papa=require('papaparse');var Redis=require(_0xc8e0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc8e0('0x11'));var as=require(_0xc8e0('0x12'));var hardwareService=require(_0xc8e0('0x13'));var logger=require(_0xc8e0('0x14'))(_0xc8e0('0x15'));var utils=require(_0xc8e0('0x16'));var config=require(_0xc8e0('0x17'));var licenseUtil=require(_0xc8e0('0x18'));var db=require(_0xc8e0('0x19'))['db'];function respondWithStatusCode(_0x3e7aa9,_0x32de40){_0x32de40=_0x32de40||0xcc;return function(_0x39ee0e){if(_0x39ee0e){return _0x3e7aa9[_0xc8e0('0x1a')](_0x32de40);}return _0x3e7aa9[_0xc8e0('0x1b')](_0x32de40)[_0xc8e0('0x1c')]();};}function respondWithResult(_0x2a1c63,_0x2ba933){_0x2ba933=_0x2ba933||0xc8;return function(_0x8550ea){if(_0x8550ea){return _0x2a1c63[_0xc8e0('0x1b')](_0x2ba933)[_0xc8e0('0x1d')](_0x8550ea);}};}function respondWithFilteredResult(_0x53c1e0,_0x5ca027){return function(_0x8916d){if(_0x8916d){var _0x1e4af7=typeof _0x5ca027[_0xc8e0('0x1e')]===_0xc8e0('0x1f')&&typeof _0x5ca027[_0xc8e0('0x20')]===_0xc8e0('0x1f');var _0x2ce710=_0x8916d[_0xc8e0('0x21')];var _0x42dd31=_0x1e4af7?0x0:_0x5ca027[_0xc8e0('0x1e')];var _0xb064f2=_0x1e4af7?_0x8916d['count']:_0x5ca027[_0xc8e0('0x1e')]+_0x5ca027[_0xc8e0('0x20')];var _0x18e5b5;if(_0xb064f2>=_0x2ce710){_0xb064f2=_0x2ce710;_0x18e5b5=0xc8;}else{_0x18e5b5=0xce;}_0x53c1e0['status'](_0x18e5b5);return _0x53c1e0['set'](_0xc8e0('0x22'),_0x42dd31+'-'+_0xb064f2+'/'+_0x2ce710)['json'](_0x8916d);}return null;};}function patchUpdates(_0xf86191){return function(_0x480b44){try{jsonpatch['apply'](_0x480b44,_0xf86191,!![]);}catch(_0x332b20){return BPromise[_0xc8e0('0x23')](_0x332b20);}return _0x480b44[_0xc8e0('0x24')]();};}function saveUpdates(_0x1b8e44,_0x1c81b1){return function(_0x296898){if(_0x296898){return _0x296898[_0xc8e0('0x25')](_0x1b8e44)[_0xc8e0('0x26')](function(_0x200464){return _0x200464;});}return null;};}function removeEntity(_0x3f9296,_0xb35eb8){return function(_0x5621e5){if(_0x5621e5){return _0x5621e5['destroy']()['then'](function(){_0x3f9296['status'](0xcc)[_0xc8e0('0x1c')]();});}};}function handleEntityNotFound(_0x4431c0,_0x145296){return function(_0xa084d){if(!_0xa084d){_0x4431c0[_0xc8e0('0x1a')](0x194);}return _0xa084d;};}function handleError(_0x503f39,_0x4b6c7c){_0x4b6c7c=_0x4b6c7c||0x1f4;return function(_0x1e9fc2){logger[_0xc8e0('0x27')](_0x1e9fc2['stack']);if(_0x1e9fc2['name']){delete _0x1e9fc2[_0xc8e0('0x28')];}_0x503f39['status'](_0x4b6c7c)[_0xc8e0('0x29')](_0x1e9fc2);};}exports[_0xc8e0('0x2a')]=function(_0x4f7d9e,_0xcd5bb4){var _0x40ca7a={},_0x454d56={},_0x4b7783={'count':0x0,'rows':[]};var _0xfc1bc6=_[_0xc8e0('0x2b')](db[_0xc8e0('0x2c')][_0xc8e0('0x2d')],function(_0x5cee19){return{'name':_0x5cee19['fieldName'],'type':_0x5cee19[_0xc8e0('0x2e')][_0xc8e0('0x2f')]};});_0x454d56['model']=_[_0xc8e0('0x2b')](_0xfc1bc6,_0xc8e0('0x28'));_0x454d56['query']=_[_0xc8e0('0x30')](_0x4f7d9e[_0xc8e0('0x31')]);_0x454d56[_0xc8e0('0x32')]=_[_0xc8e0('0x33')](_0x454d56[_0xc8e0('0x34')],_0x454d56[_0xc8e0('0x31')]);_0x40ca7a[_0xc8e0('0x35')]=_[_0xc8e0('0x33')](_0x454d56[_0xc8e0('0x34')],qs['fields'](_0x4f7d9e['query']['fields']));_0x40ca7a[_0xc8e0('0x35')]=_0x40ca7a[_0xc8e0('0x35')]['length']?_0x40ca7a[_0xc8e0('0x35')]:_0x454d56[_0xc8e0('0x34')];if(!_0x4f7d9e['query'][_0xc8e0('0x36')](_0xc8e0('0x37'))){_0x40ca7a[_0xc8e0('0x20')]=qs[_0xc8e0('0x20')](_0x4f7d9e['query'][_0xc8e0('0x20')]);_0x40ca7a['offset']=qs[_0xc8e0('0x1e')](_0x4f7d9e[_0xc8e0('0x31')]['offset']);}_0x40ca7a[_0xc8e0('0x38')]=qs[_0xc8e0('0x39')](_0x4f7d9e[_0xc8e0('0x31')]['sort']);_0x40ca7a[_0xc8e0('0x3a')]=qs[_0xc8e0('0x32')](_[_0xc8e0('0x3b')](_0x4f7d9e['query'],_0x454d56[_0xc8e0('0x32')]),_0xfc1bc6);if(_0x4f7d9e[_0xc8e0('0x31')]['filter']){_0x40ca7a['where']=_[_0xc8e0('0x3c')](_0x40ca7a['where'],{'$or':_['map'](_0xfc1bc6,function(_0x1c5de3){if(_0x1c5de3[_0xc8e0('0x2e')]!==_0xc8e0('0x3d')){var _0x4409b5={};_0x4409b5[_0x1c5de3[_0xc8e0('0x28')]]={'$like':'%'+_0x4f7d9e['query'][_0xc8e0('0x3e')]+'%'};return _0x4409b5;}})});}_0x40ca7a=_[_0xc8e0('0x3c')]({},_0x40ca7a,_0x4f7d9e[_0xc8e0('0x3f')]);var _0x12464e={'where':_0x40ca7a[_0xc8e0('0x3a')]};return db[_0xc8e0('0x2c')][_0xc8e0('0x21')](_0x12464e)[_0xc8e0('0x26')](function(_0x3bca36){_0x4b7783[_0xc8e0('0x21')]=_0x3bca36;if(_0x4f7d9e[_0xc8e0('0x31')][_0xc8e0('0x40')]){_0x40ca7a[_0xc8e0('0x41')]=[{'all':!![]}];}return db['SalesforceField'][_0xc8e0('0x42')](_0x40ca7a);})[_0xc8e0('0x26')](function(_0xdcf4d6){_0x4b7783[_0xc8e0('0x43')]=_0xdcf4d6;return _0x4b7783;})['then'](respondWithFilteredResult(_0xcd5bb4,_0x40ca7a))[_0xc8e0('0x44')](handleError(_0xcd5bb4,null));};exports['show']=function(_0x1f358f,_0x5717cb){var _0x443d51={'raw':!![],'where':{'id':_0x1f358f[_0xc8e0('0x45')]['id']}},_0x4aaa60={};_0x4aaa60[_0xc8e0('0x34')]=_[_0xc8e0('0x30')](db['SalesforceField'][_0xc8e0('0x2d')]);_0x4aaa60[_0xc8e0('0x31')]=_[_0xc8e0('0x30')](_0x1f358f[_0xc8e0('0x31')]);_0x4aaa60[_0xc8e0('0x32')]=_[_0xc8e0('0x33')](_0x4aaa60[_0xc8e0('0x34')],_0x4aaa60[_0xc8e0('0x31')]);_0x443d51[_0xc8e0('0x35')]=_[_0xc8e0('0x33')](_0x4aaa60['model'],qs[_0xc8e0('0x46')](_0x1f358f['query'][_0xc8e0('0x46')]));_0x443d51[_0xc8e0('0x35')]=_0x443d51[_0xc8e0('0x35')][_0xc8e0('0x47')]?_0x443d51['attributes']:_0x4aaa60['model'];if(_0x1f358f[_0xc8e0('0x31')][_0xc8e0('0x40')]){_0x443d51['include']=[{'all':!![]}];}_0x443d51=_[_0xc8e0('0x3c')]({},_0x443d51,_0x1f358f['options']);return db[_0xc8e0('0x2c')][_0xc8e0('0x48')](_0x443d51)[_0xc8e0('0x26')](handleEntityNotFound(_0x5717cb,null))[_0xc8e0('0x26')](respondWithResult(_0x5717cb,null))['catch'](handleError(_0x5717cb,null));};exports['create']=function(_0x41ea77,_0x45c71a){return db[_0xc8e0('0x2c')][_0xc8e0('0x49')](_0x41ea77[_0xc8e0('0x4a')],{})['then'](respondWithResult(_0x45c71a,0xc9))[_0xc8e0('0x44')](handleError(_0x45c71a,null));};exports[_0xc8e0('0x25')]=function(_0x54554e,_0x25c971){if(_0x54554e[_0xc8e0('0x4a')]['id']){delete _0x54554e[_0xc8e0('0x4a')]['id'];}return db[_0xc8e0('0x2c')]['find']({'where':{'id':_0x54554e[_0xc8e0('0x45')]['id']}})[_0xc8e0('0x26')](handleEntityNotFound(_0x25c971,null))['then'](saveUpdates(_0x54554e['body'],null))['then'](respondWithResult(_0x25c971,null))[_0xc8e0('0x44')](handleError(_0x25c971,null));};exports[_0xc8e0('0x4b')]=function(_0x303750,_0xa13c28){return db['SalesforceField']['find']({'where':{'id':_0x303750[_0xc8e0('0x45')]['id']}})['then'](handleEntityNotFound(_0xa13c28,null))['then'](removeEntity(_0xa13c28,null))['catch'](handleError(_0xa13c28,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d98f640..9e46a05 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 _0x1774=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','salesforce_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x2efdf6,_0x466271){var _0x35d338=function(_0x1bdcaf){while(--_0x1bdcaf){_0x2efdf6['push'](_0x2efdf6['shift']());}};_0x35d338(++_0x466271);}(_0x1774,0x191));var _0x4177=function(_0x3f8ee6,_0x26a9cb){_0x3f8ee6=_0x3f8ee6-0x0;var _0x559617=_0x1774[_0x3f8ee6];return _0x559617;};'use strict';var _=require(_0x4177('0x0'));var util=require('util');var logger=require(_0x4177('0x1'))(_0x4177('0x2'));var moment=require(_0x4177('0x3'));var BPromise=require(_0x4177('0x4'));var rp=require(_0x4177('0x5'));var fs=require('fs');var path=require(_0x4177('0x6'));var rimraf=require(_0x4177('0x7'));var config=require(_0x4177('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x4177('0x9')]=function(_0x1eed75,_0x3b47c7){return _0x1eed75['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4177('0xa'),'fields':[_0x4177('0xb'),_0x4177('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60c1=['util','api','moment','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x36f80e,_0x38e1d1){var _0x13d5d8=function(_0x2ede6d){while(--_0x2ede6d){_0x36f80e['push'](_0x36f80e['shift']());}};_0x13d5d8(++_0x38e1d1);}(_0x60c1,0xc3));var _0x160c=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x60c1[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x160c('0x0'));var util=require(_0x160c('0x1'));var logger=require('../../config/logger')(_0x160c('0x2'));var moment=require(_0x160c('0x3'));var BPromise=require('bluebird');var rp=require(_0x160c('0x4'));var fs=require('fs');var path=require(_0x160c('0x5'));var rimraf=require('rimraf');var config=require(_0x160c('0x6'));var attributes=require(_0x160c('0x7'));module[_0x160c('0x8')]=function(_0x5e6832,_0x57bd29){return _0x5e6832[_0x160c('0x9')](_0x160c('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x160c('0xb'),'fields':[_0x160c('0xc'),_0x160c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index cd7ae7c..e4971a7 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 _0x062b=['client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x53b402,_0x6d0447){var _0x19204e=function(_0x19ff41){while(--_0x19ff41){_0x53b402['push'](_0x53b402['shift']());}};_0x19204e(++_0x6d0447);}(_0x062b,0x186));var _0xb062=function(_0x2aca6e,_0x3a496e){_0x2aca6e=_0x2aca6e-0x0;var _0x59a2e6=_0x062b[_0x2aca6e];return _0x59a2e6;};'use strict';var _=require(_0xb062('0x0'));var util=require(_0xb062('0x1'));var moment=require(_0xb062('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb062('0x3'));var db=require(_0xb062('0x4'))['db'];var utils=require(_0xb062('0x5'));var logger=require(_0xb062('0x6'))('rpc');var config=require(_0xb062('0x7'));var jayson=require(_0xb062('0x8'));var client=jayson[_0xb062('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9292,_0x50b044,_0x4bf96f){return new BPromise(function(_0x485355,_0x112dcb){return client['request'](_0x2b9292,_0x4bf96f)[_0xb062('0xa')](function(_0x529d61){logger[_0xb062('0xb')](_0xb062('0xc'),_0x50b044,_0xb062('0xd'));logger[_0xb062('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x50b044,_0xb062('0xd'),JSON[_0xb062('0xf')](_0x529d61));if(_0x529d61[_0xb062('0x10')]){if(_0x529d61[_0xb062('0x10')][_0xb062('0x11')]===0x1f4){logger[_0xb062('0x10')]('SalesforceField,\x20%s,\x20%s',_0x50b044,_0x529d61[_0xb062('0x10')][_0xb062('0x12')]);return _0x112dcb(_0x529d61[_0xb062('0x10')][_0xb062('0x12')]);}logger[_0xb062('0x10')](_0xb062('0xc'),_0x50b044,_0x529d61[_0xb062('0x10')][_0xb062('0x12')]);return _0x485355(_0x529d61['error'][_0xb062('0x12')]);}else{logger[_0xb062('0xb')](_0xb062('0xc'),_0x50b044,_0xb062('0xd'));_0x485355(_0x529d61[_0xb062('0x13')][_0xb062('0x12')]);}})[_0xb062('0x14')](function(_0x11dbf0){logger[_0xb062('0x10')](_0xb062('0xc'),_0x50b044,_0x11dbf0);_0x112dcb(_0x11dbf0);});});} \ No newline at end of file +var _0x0564=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0564,0xb0));var _0x4056=function(_0x42662a,_0x4ddf20){_0x42662a=_0x42662a-0x0;var _0xd7ca69=_0x0564[_0x42662a];return _0xd7ca69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4056('0x0'));var BPromise=require('bluebird');var rs=require(_0x4056('0x1'));var fs=require('fs');var Redis=require(_0x4056('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4056('0x3'))(_0x4056('0x4'));var config=require(_0x4056('0x5'));var jayson=require(_0x4056('0x6'));var client=jayson['client'][_0x4056('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12d75e,_0x436697,_0x28465e){return new BPromise(function(_0x45d2a0,_0x39b864){return client[_0x4056('0x8')](_0x12d75e,_0x28465e)['then'](function(_0x4f606b){logger[_0x4056('0x9')]('SalesforceField,\x20%s,\x20%s',_0x436697,_0x4056('0xa'));logger[_0x4056('0xb')](_0x4056('0xc'),_0x436697,_0x4056('0xa'),JSON['stringify'](_0x4f606b));if(_0x4f606b[_0x4056('0xd')]){if(_0x4f606b['error'][_0x4056('0xe')]===0x1f4){logger[_0x4056('0xd')](_0x4056('0xf'),_0x436697,_0x4f606b['error'][_0x4056('0x10')]);return _0x39b864(_0x4f606b[_0x4056('0xd')][_0x4056('0x10')]);}logger[_0x4056('0xd')](_0x4056('0xf'),_0x436697,_0x4f606b[_0x4056('0xd')][_0x4056('0x10')]);return _0x45d2a0(_0x4f606b['error'][_0x4056('0x10')]);}else{logger[_0x4056('0x9')](_0x4056('0xf'),_0x436697,'request\x20sent');_0x45d2a0(_0x4f606b[_0x4056('0x11')][_0x4056('0x10')]);}})[_0x4056('0x12')](function(_0x40afaa){logger[_0x4056('0xd')](_0x4056('0xf'),_0x436697,_0x40afaa);_0x39b864(_0x40afaa);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6a3d999..ada6fd0 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 _0x781f=['post','create','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x781f,0x13f));var _0xf781=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x781f[_0x277721];return _0x286051;};'use strict';var multer=require(_0xf781('0x0'));var util=require(_0xf781('0x1'));var path=require('path');var timeout=require(_0xf781('0x2'));var express=require('express');var router=express[_0xf781('0x3')]();var fs_extra=require(_0xf781('0x4'));var auth=require(_0xf781('0x5'));var interaction=require(_0xf781('0x6'));var config=require(_0xf781('0x7'));var controller=require(_0xf781('0x8'));router[_0xf781('0x9')]('/',auth[_0xf781('0xa')](),controller[_0xf781('0xb')]);router[_0xf781('0x9')](_0xf781('0xc'),auth[_0xf781('0xa')](),controller['show']);router[_0xf781('0x9')](_0xf781('0xd'),auth['isAuthenticated'](),controller[_0xf781('0xe')]);router[_0xf781('0x9')](_0xf781('0xf'),auth[_0xf781('0xa')](),controller[_0xf781('0x10')]);router[_0xf781('0x11')]('/',auth[_0xf781('0xa')](),controller[_0xf781('0x12')]);router[_0xf781('0x11')](_0xf781('0xd'),auth[_0xf781('0xa')](),controller[_0xf781('0x13')]);router[_0xf781('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf781('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf781('0x16')]);module[_0xf781('0x17')]=router; \ No newline at end of file +var _0x1301=['express','Router','fs-extra','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getFields','create','post','addConfiguration','put','update','delete','multer','util'];(function(_0x2cd946,_0x1b62ef){var _0x17264d=function(_0x54d944){while(--_0x54d944){_0x2cd946['push'](_0x2cd946['shift']());}};_0x17264d(++_0x1b62ef);}(_0x1301,0x70));var _0x1130=function(_0x16b545,_0x288778){_0x16b545=_0x16b545-0x0;var _0xe75d4a=_0x1301[_0x16b545];return _0xe75d4a;};'use strict';var multer=require(_0x1130('0x0'));var util=require(_0x1130('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1130('0x2'));var router=express[_0x1130('0x3')]();var fs_extra=require(_0x1130('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1130('0x5'));var controller=require(_0x1130('0x6'));router[_0x1130('0x7')]('/',auth[_0x1130('0x8')](),controller[_0x1130('0x9')]);router[_0x1130('0x7')](_0x1130('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x1130('0x7')](_0x1130('0xb'),auth[_0x1130('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x1130('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1130('0xd')]);router[_0x1130('0xe')](_0x1130('0xb'),auth[_0x1130('0x8')](),controller[_0x1130('0xf')]);router[_0x1130('0x10')](_0x1130('0xa'),auth[_0x1130('0x8')](),controller[_0x1130('0x11')]);router[_0x1130('0x12')]('/:id',auth[_0x1130('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7652965..ffa99b2 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 _0x3aa1=['remoteUri','sequelize','STRING'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x3aa1,0x175));var _0x13aa=function(_0x192878,_0x12dbf1){_0x192878=_0x192878-0x0;var _0x3786b7=_0x3aa1[_0x192878];return _0x3786b7;};'use strict';var Sequelize=require(_0x13aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x13aa('0x1')]},'description':{'type':Sequelize[_0x13aa('0x1')]},'username':{'type':Sequelize[_0x13aa('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x13aa('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x13aa('0x2')},'serverUrl':{'type':Sequelize[_0x13aa('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe4ec=['remoteUri','exports','STRING','username'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xe4ec,0x139));var _0xce4e=function(_0x3d3259,_0x203080){_0x3d3259=_0x3d3259-0x0;var _0x391f1c=_0xe4ec[_0x3d3259];return _0x391f1c;};'use strict';var Sequelize=require('sequelize');module[_0xce4e('0x0')]={'name':{'type':Sequelize[_0xce4e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xce4e('0x2')},'password':{'type':Sequelize[_0xce4e('0x1')]},'email':{'type':Sequelize[_0xce4e('0x1')]},'remoteUri':{'type':Sequelize[_0xce4e('0x1')],'unique':_0xce4e('0x3')},'serverUrl':{'type':Sequelize[_0xce4e('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 a04d1a4..e74750e 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 _0x779d=['delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','group_list','work_end','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','activity_due','assigned_to','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','statusCode','test','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','hold_reason','number','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','cmdb_ci'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x779d,0xf6));var _0xd779=function(_0x334e9c,_0x5b3482){_0x334e9c=_0x334e9c-0x0;var _0x4a348e=_0x779d[_0x334e9c];return _0x4a348e;};'use strict';var emlformat=require(_0xd779('0x0'));var rimraf=require(_0xd779('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd779('0x2'));var rp=require('request-promise');var moment=require(_0xd779('0x3'));var BPromise=require(_0xd779('0x4'));var Mustache=require(_0xd779('0x5'));var util=require(_0xd779('0x6'));var path=require('path');var sox=require(_0xd779('0x7'));var csv=require(_0xd779('0x8'));var ejs=require(_0xd779('0x9'));var fs=require('fs');var fs_extra=require(_0xd779('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd779('0xb'));var jsforce=require(_0xd779('0xc'));var deskjs=require(_0xd779('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd779('0xe'));var Papa=require(_0xd779('0xf'));var Redis=require(_0xd779('0x10'));var authService=require(_0xd779('0x11'));var qs=require(_0xd779('0x12'));var as=require(_0xd779('0x13'));var hardwareService=require(_0xd779('0x14'));var logger=require(_0xd779('0x15'))(_0xd779('0x16'));var utils=require(_0xd779('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd779('0x18'));var db=require(_0xd779('0x19'))['db'];var integrations=require(_0xd779('0x1a'));function respondWithStatusCode(_0xd35bb,_0x5af5d6){_0x5af5d6=_0x5af5d6||0xcc;return function(_0x3319ca){if(_0x3319ca){return _0xd35bb[_0xd779('0x1b')](_0x5af5d6);}return _0xd35bb['status'](_0x5af5d6)[_0xd779('0x1c')]();};}function respondWithResult(_0x54ae79,_0x4cab05){_0x4cab05=_0x4cab05||0xc8;return function(_0x345b71){if(_0x345b71){return _0x54ae79[_0xd779('0x1d')](_0x4cab05)['json'](_0x345b71);}};}function respondWithFilteredResult(_0x508d8d,_0x312db8){return function(_0x3da44d){if(_0x3da44d){var _0x27842b=typeof _0x312db8[_0xd779('0x1e')]===_0xd779('0x1f')&&typeof _0x312db8[_0xd779('0x20')]===_0xd779('0x1f');var _0x587a32=_0x3da44d[_0xd779('0x21')];var _0x2b292e=_0x27842b?0x0:_0x312db8['offset'];var _0xd4b564=_0x27842b?_0x3da44d[_0xd779('0x21')]:_0x312db8[_0xd779('0x1e')]+_0x312db8[_0xd779('0x20')];var _0x443503;if(_0xd4b564>=_0x587a32){_0xd4b564=_0x587a32;_0x443503=0xc8;}else{_0x443503=0xce;}_0x508d8d[_0xd779('0x1d')](_0x443503);return _0x508d8d[_0xd779('0x22')](_0xd779('0x23'),_0x2b292e+'-'+_0xd4b564+'/'+_0x587a32)[_0xd779('0x24')](_0x3da44d);}return null;};}function patchUpdates(_0x5c2b47){return function(_0x1c215c){try{jsonpatch[_0xd779('0x25')](_0x1c215c,_0x5c2b47,!![]);}catch(_0x4b4f1a){return BPromise['reject'](_0x4b4f1a);}return _0x1c215c[_0xd779('0x26')]();};}function saveUpdates(_0x1885b7,_0x38b524){return function(_0x36ab45){if(_0x36ab45){return _0x36ab45['update'](_0x1885b7)['then'](function(_0x11c1d2){return _0x11c1d2;});}return null;};}function removeEntity(_0xb5d737,_0x5e4e70){return function(_0x3cf48e){if(_0x3cf48e){return _0x3cf48e[_0xd779('0x27')]()[_0xd779('0x28')](function(){_0xb5d737[_0xd779('0x1d')](0xcc)[_0xd779('0x1c')]();});}};}function handleEntityNotFound(_0x56174f,_0x24b0ca){return function(_0x5748c7){if(!_0x5748c7){_0x56174f['sendStatus'](0x194);}return _0x5748c7;};}function handleError(_0x2d0212,_0x318134){_0x318134=_0x318134||0x1f4;return function(_0x558152){logger[_0xd779('0x29')](_0x558152[_0xd779('0x2a')]);if(_0x558152[_0xd779('0x2b')]){delete _0x558152['name'];}_0x2d0212[_0xd779('0x1d')](_0x318134)[_0xd779('0x2c')](_0x558152);};}exports[_0xd779('0x2d')]=function(_0x34fb6f,_0x495037){var _0x2a1303={},_0x53a9b4={},_0x98104d={'count':0x0,'rows':[]};var _0x38aa37=_[_0xd779('0x2e')](db[_0xd779('0x2f')][_0xd779('0x30')],function(_0x46f25b){return{'name':_0x46f25b[_0xd779('0x31')],'type':_0x46f25b[_0xd779('0x32')][_0xd779('0x33')]};});_0x53a9b4[_0xd779('0x34')]=_[_0xd779('0x2e')](_0x38aa37,_0xd779('0x2b'));_0x53a9b4[_0xd779('0x35')]=_['keys'](_0x34fb6f['query']);_0x53a9b4['filters']=_[_0xd779('0x36')](_0x53a9b4[_0xd779('0x34')],_0x53a9b4[_0xd779('0x35')]);_0x2a1303[_0xd779('0x37')]=_[_0xd779('0x36')](_0x53a9b4[_0xd779('0x34')],qs[_0xd779('0x38')](_0x34fb6f[_0xd779('0x35')][_0xd779('0x38')]));_0x2a1303[_0xd779('0x37')]=_0x2a1303[_0xd779('0x37')][_0xd779('0x39')]?_0x2a1303[_0xd779('0x37')]:_0x53a9b4[_0xd779('0x34')];if(!_0x34fb6f[_0xd779('0x35')][_0xd779('0x3a')](_0xd779('0x3b'))){_0x2a1303['limit']=qs[_0xd779('0x20')](_0x34fb6f[_0xd779('0x35')][_0xd779('0x20')]);_0x2a1303[_0xd779('0x1e')]=qs[_0xd779('0x1e')](_0x34fb6f[_0xd779('0x35')][_0xd779('0x1e')]);}_0x2a1303[_0xd779('0x3c')]=qs[_0xd779('0x3d')](_0x34fb6f[_0xd779('0x35')][_0xd779('0x3d')]);_0x2a1303[_0xd779('0x3e')]=qs[_0xd779('0x3f')](_[_0xd779('0x40')](_0x34fb6f[_0xd779('0x35')],_0x53a9b4['filters']),_0x38aa37);if(_0x34fb6f['query']['filter']){_0x2a1303[_0xd779('0x3e')]=_[_0xd779('0x41')](_0x2a1303[_0xd779('0x3e')],{'$or':_[_0xd779('0x2e')](_0x38aa37,function(_0x22af77){if(_0x22af77[_0xd779('0x32')]!==_0xd779('0x42')){var _0x1ee343={};_0x1ee343[_0x22af77[_0xd779('0x2b')]]={'$like':'%'+_0x34fb6f[_0xd779('0x35')][_0xd779('0x43')]+'%'};return _0x1ee343;}})});}_0x2a1303=_[_0xd779('0x41')]({},_0x2a1303,_0x34fb6f['options']);var _0x4c9b3c={'where':_0x2a1303[_0xd779('0x3e')]};return db[_0xd779('0x2f')][_0xd779('0x21')](_0x4c9b3c)[_0xd779('0x28')](function(_0x43fe05){_0x98104d[_0xd779('0x21')]=_0x43fe05;if(_0x34fb6f[_0xd779('0x35')][_0xd779('0x44')]){_0x2a1303[_0xd779('0x45')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xd779('0x46')](_0x2a1303);})[_0xd779('0x28')](function(_0x341a2b){_0x98104d[_0xd779('0x47')]=_0x341a2b;return _0x98104d;})[_0xd779('0x28')](respondWithFilteredResult(_0x495037,_0x2a1303))[_0xd779('0x48')](handleError(_0x495037,null));};exports[_0xd779('0x49')]=function(_0x12b114,_0x8f79e4){var _0x531c6d={'raw':![],'where':{'id':_0x12b114[_0xd779('0x4a')]['id']}},_0x193caf={};_0x193caf['model']=_[_0xd779('0x4b')](db[_0xd779('0x2f')]['rawAttributes']);_0x193caf['query']=_[_0xd779('0x4b')](_0x12b114[_0xd779('0x35')]);_0x193caf[_0xd779('0x3f')]=_[_0xd779('0x36')](_0x193caf[_0xd779('0x34')],_0x193caf[_0xd779('0x35')]);_0x531c6d[_0xd779('0x37')]=_[_0xd779('0x36')](_0x193caf[_0xd779('0x34')],qs[_0xd779('0x38')](_0x12b114[_0xd779('0x35')]['fields']));_0x531c6d[_0xd779('0x37')]=_0x531c6d['attributes'][_0xd779('0x39')]?_0x531c6d[_0xd779('0x37')]:_0x193caf[_0xd779('0x34')];if(_0x12b114[_0xd779('0x35')]['includeAll']){_0x531c6d['include']=[{'all':!![]}];}_0x531c6d=_[_0xd779('0x41')]({},_0x531c6d,_0x12b114[_0xd779('0x4c')]);return db[_0xd779('0x2f')]['find'](_0x531c6d)[_0xd779('0x28')](handleEntityNotFound(_0x8f79e4,null))[_0xd779('0x28')](respondWithResult(_0x8f79e4,null))[_0xd779('0x48')](handleError(_0x8f79e4,null));};exports[_0xd779('0x4d')]=function(_0x446fda,_0x1c9c43){return db[_0xd779('0x2f')][_0xd779('0x4d')](_0x446fda[_0xd779('0x4e')],{})[_0xd779('0x28')](respondWithResult(_0x1c9c43,0xc9))['catch'](handleError(_0x1c9c43,null));};exports[_0xd779('0x4f')]=function(_0x856320,_0x46e94b){if(_0x856320[_0xd779('0x4e')]['id']){delete _0x856320[_0xd779('0x4e')]['id'];}return db['ServicenowAccount'][_0xd779('0x50')]({'where':{'id':_0x856320[_0xd779('0x4a')]['id']}})[_0xd779('0x28')](handleEntityNotFound(_0x46e94b,null))[_0xd779('0x28')](saveUpdates(_0x856320[_0xd779('0x4e')],null))[_0xd779('0x28')](respondWithResult(_0x46e94b,null))['catch'](handleError(_0x46e94b,null));};exports[_0xd779('0x27')]=function(_0x439286,_0x1ee157){return db[_0xd779('0x2f')][_0xd779('0x50')]({'where':{'id':_0x439286[_0xd779('0x4a')]['id']}})[_0xd779('0x28')](handleEntityNotFound(_0x1ee157,null))[_0xd779('0x28')](removeEntity(_0x1ee157,null))[_0xd779('0x48')](handleError(_0x1ee157,null));};exports[_0xd779('0x51')]=function(_0x425701,_0x1b7856,_0x16efbb){var _0x55406f={};var _0x68db6={};var _0x38b2e7;var _0x1e4cde;return db[_0xd779('0x2f')][_0xd779('0x52')]({'where':{'id':_0x425701['params']['id']}})[_0xd779('0x28')](handleEntityNotFound(_0x1b7856,null))[_0xd779('0x28')](function(_0x4bdd3a){if(_0x4bdd3a){_0x38b2e7=_0x4bdd3a;_0x68db6[_0xd779('0x34')]=_[_0xd779('0x4b')](db['ServicenowConfiguration'][_0xd779('0x30')]);_0x68db6[_0xd779('0x35')]=_[_0xd779('0x4b')](_0x425701[_0xd779('0x35')]);_0x68db6[_0xd779('0x3f')]=_[_0xd779('0x36')](_0x68db6['model'],_0x68db6['query']);_0x55406f[_0xd779('0x37')]=_[_0xd779('0x36')](_0x68db6[_0xd779('0x34')],qs['fields'](_0x425701['query'][_0xd779('0x38')]));_0x55406f[_0xd779('0x37')]=_0x55406f['attributes'][_0xd779('0x39')]?_0x55406f[_0xd779('0x37')]:_0x68db6[_0xd779('0x34')];_0x55406f[_0xd779('0x3c')]=qs[_0xd779('0x3d')](_0x425701[_0xd779('0x35')][_0xd779('0x3d')]);_0x55406f[_0xd779('0x3e')]=qs[_0xd779('0x3f')](_[_0xd779('0x40')](_0x425701[_0xd779('0x35')],_0x68db6[_0xd779('0x3f')]));if(_0x425701[_0xd779('0x35')][_0xd779('0x43')]){_0x55406f['where']=_[_0xd779('0x41')](_0x55406f[_0xd779('0x3e')],{'$or':_[_0xd779('0x2e')](_0x55406f['attributes'],function(_0x47fbe1){var _0x4b1d9f={};_0x4b1d9f[_0x47fbe1]={'$like':'%'+_0x425701['query'][_0xd779('0x43')]+'%'};return _0x4b1d9f;})});}_0x55406f=_[_0xd779('0x41')]({},_0x55406f,_0x425701[_0xd779('0x4c')]);return _0x38b2e7[_0xd779('0x51')](_0x55406f);}})[_0xd779('0x28')](function(_0x5ce03b){if(_0x5ce03b){_0x1e4cde=_0x5ce03b[_0xd779('0x39')];if(!_0x425701[_0xd779('0x35')][_0xd779('0x3a')](_0xd779('0x3b'))){_0x55406f[_0xd779('0x20')]=qs[_0xd779('0x20')](_0x425701[_0xd779('0x35')][_0xd779('0x20')]);_0x55406f[_0xd779('0x1e')]=qs[_0xd779('0x1e')](_0x425701[_0xd779('0x35')][_0xd779('0x1e')]);}return _0x38b2e7[_0xd779('0x51')](_0x55406f);}})[_0xd779('0x28')](function(_0x232687){if(_0x232687){return _0x232687?{'count':_0x1e4cde,'rows':_0x232687}:null;}})[_0xd779('0x28')](respondWithResult(_0x1b7856,null))['catch'](handleError(_0x1b7856,null));};exports[_0xd779('0x53')]=function(_0x4b7fd7,_0x3e6f10,_0x1f7835){if(_0x4b7fd7[_0xd779('0x4e')]['id']){delete _0x4b7fd7[_0xd779('0x4e')]['id'];}return db[_0xd779('0x2f')][_0xd779('0x52')]({'where':{'id':_0x4b7fd7[_0xd779('0x4a')]['id']}})[_0xd779('0x28')](handleEntityNotFound(_0x3e6f10,null))['then'](function(_0x36fc3d){if(_0x36fc3d){_0x4b7fd7[_0xd779('0x4e')][_0xd779('0x54')]=_0x36fc3d['id'];_0x4b7fd7[_0xd779('0x4e')][_0xd779('0x55')]=integrations[_0xd779('0x56')](_0x4b7fd7[_0xd779('0x4e')]['channel'],_0x4b7fd7[_0xd779('0x4e')]['type']);_0x4b7fd7[_0xd779('0x4e')][_0xd779('0x57')]=integrations[_0xd779('0x58')](_0x4b7fd7[_0xd779('0x4e')][_0xd779('0x59')],_0x4b7fd7[_0xd779('0x4e')][_0xd779('0x32')]);return db['ServicenowConfiguration'][_0xd779('0x4d')](_0x4b7fd7[_0xd779('0x4e')],{'include':[{'model':db[_0xd779('0x5a')],'as':_0xd779('0x55')},{'model':db['ServicenowField'],'as':_0xd779('0x57')}]});}return null;})[_0xd779('0x28')](respondWithResult(_0x3e6f10,null))['catch'](handleError(_0x3e6f10,null));};exports[_0xd779('0x5b')]=function(_0x1e6ff8,_0x280d39,_0x308ac4){var _0x551034=[_0xd779('0x5c'),'hold_reason',_0xd779('0x5d'),_0xd779('0x5e'),_0xd779('0x5f'),_0xd779('0x60'),_0xd779('0x61'),_0xd779('0x62'),_0xd779('0x63')];var _0x17f368=[_0xd779('0x64'),_0xd779('0x5c'),_0xd779('0x65'),_0xd779('0x66'),'upon_reject',_0xd779('0x67'),_0xd779('0x68'),_0xd779('0x69'),'approval_history',_0xd779('0x6a'),_0xd779('0x6b'),'sys_updated_by',_0xd779('0x6c'),_0xd779('0x6d'),_0xd779('0x6e'),'sys_domain','state',_0xd779('0x6f'),_0xd779('0x5d'),_0xd779('0x3c'),_0xd779('0x70'),'closed_at',_0xd779('0x71'),_0xd779('0x72'),'impact',_0xd779('0x73'),_0xd779('0x74'),_0xd779('0x75'),_0xd779('0x76'),_0xd779('0x77'),_0xd779('0x78'),_0xd779('0x79'),_0xd779('0x7a'),'opened_at','business_duration',_0xd779('0x7b'),_0xd779('0x7c'),'reopened_time','resolved_at',_0xd779('0x7d'),_0xd779('0x7e'),_0xd779('0x5e'),_0xd779('0x7f'),_0xd779('0x80'),_0xd779('0x5f'),_0xd779('0x81'),_0xd779('0x82'),'work_start',_0xd779('0x83'),'business_stc','additional_assignee_list','description','calendar_duration',_0xd779('0x60'),_0xd779('0x84'),_0xd779('0x85'),_0xd779('0x86'),_0xd779('0x87'),_0xd779('0x88'),_0xd779('0x89'),_0xd779('0x8a'),'reopened_by','incident_state','urgency',_0xd779('0x8b'),_0xd779('0x8c'),'reassignment_count',_0xd779('0x8d'),_0xd779('0x8e'),_0xd779('0x62'),'comments','sla_due',_0xd779('0x8f'),_0xd779('0x90'),_0xd779('0x91'),'sys_mod_count',_0xd779('0x92'),_0xd779('0x93'),_0xd779('0x94'),_0xd779('0x95'),'correlation_id','location',_0xd779('0x63')];var _0x3367fa='';var _0x5b3da9='';var _0x48aa95=[];var _0x4204c6='';var _0x3c1396='';var _0x180dd7=[];var _0x16ef51='';var _0x5f1dee='';var _0x37a838={};var _0x1a0838='';return db[_0xd779('0x2f')][_0xd779('0x52')]({'where':{'id':_0x1e6ff8[_0xd779('0x4a')]['id']},'attributes':['id','username',_0xd779('0x96'),_0xd779('0x97'),_0xd779('0x98'),_0xd779('0x99')]})[_0xd779('0x28')](handleEntityNotFound(_0x280d39,null))[_0xd779('0x28')](function(_0x598db4){if(_0x598db4){_0x1a0838=_0x598db4[_0xd779('0x98')];var _0x416083=_0x1a0838[_0xd779('0x9a')](-0x1);if(_0x416083==='/'){_0x1a0838=_0x1a0838[_0xd779('0x9b')](0x0,_0x1a0838[_0xd779('0x9c')](_0x416083));}_0x5f1dee=util[_0xd779('0x9d')]('%s/api/now/doc/table/schema/',_0x1a0838);_0x16ef51=util[_0xd779('0x9d')]('%s/api/now/table/',_0x1a0838);_0x37a838={'user':_0x598db4['username'],'pass':_0x598db4[_0xd779('0x96')]};var _0x141e9f={'method':_0xd779('0x9e'),'uri':_0x5f1dee+_0xd779('0x9f'),'auth':_0x37a838,'json':!![]};return rp(_0x141e9f);}})[_0xd779('0x28')](function(_0x198f91){if(_0x198f91[_0xd779('0xa0')]['length']>0x0){_0x3367fa=_0x198f91[_0xd779('0xa0')];}console['log'](_0xd779('0xa1'),_0x3367fa);_0x180dd7=[];_0x5b3da9=Object[_0xd779('0xa2')]([],_0x3367fa);_[_0xd779('0xa3')](_0x5b3da9,function(_0x3fa1f1){return!_0x551034[_0xd779('0xa4')](_0x3fa1f1['name']);});_0x5b3da9[_0xd779('0xa5')](function(_0x2013f2){var _0x48bd5e=createFieldObject(_0x16ef51,_0x37a838,_0x2013f2['internalType'],_0x2013f2['name'],_0x2013f2[_0xd779('0xa6')],![]);_0x180dd7[_0xd779('0xa7')](_0x48bd5e);});return Promise[_0xd779('0xa8')](_0x180dd7);})['then'](function(_0x1f38a1){_0x48aa95=_0x1f38a1;_0x4204c6=Object[_0xd779('0xa2')]([],_0x3367fa);console['log'](_0xd779('0xa9'),_0x3367fa);_[_0xd779('0xa3')](_0x4204c6,function(_0x11b1ec){return _0x17f368[_0xd779('0xa4')](_0x11b1ec[_0xd779('0x2b')]);});console['log'](_0xd779('0xaa'),_0x4204c6);_0x180dd7=[];_0x4204c6[_0xd779('0xa5')](function(_0x41fbb9){var _0x4fb1b1=createFieldObject(_0x16ef51,_0x37a838,_0x41fbb9[_0xd779('0xab')],_0x41fbb9[_0xd779('0x2b')],_0x41fbb9[_0xd779('0xa6')],!![]);_0x180dd7['push'](_0x4fb1b1);});return Promise[_0xd779('0xa8')](_0x180dd7);})['then'](function(_0x386baf){_0x3c1396=_0x386baf;var _0x300f90=_0x48aa95[_0xd779('0xac')](_0x3c1396);return{'count':_0x300f90[_0xd779('0x39')],'rows':_0x300f90};})[_0xd779('0x28')](respondWithResult(_0x280d39,null))[_0xd779('0x48')](function(_0x5d3904){console['log']('ServiceNow\x20error:\x20'+_0x5d3904);var _0x255ba8=_0x1e6ff8[_0xd779('0x35')]['test']?0x1f4:_0x5d3904[_0xd779('0xad')]||0x1f4;logger['error'](_0x5d3904[_0xd779('0x2a')]);delete _0x5d3904[_0xd779('0x2b')];if(_0x255ba8===0x191){_0x255ba8=0x190;}_0x280d39[_0xd779('0x1d')](_0x255ba8)[_0xd779('0x2c')](_0x1e6ff8[_0xd779('0x35')][_0xd779('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x5d3904[_0xd779('0xad')]}:_0x5d3904);});};function createFieldObject(_0x9343b1,_0x2edd12,_0x953d37,_0x2e23b2,_0x1a4522,_0x589368){return new Promise(function(_0x2623d1,_0x3bf381){var _0x9650aa={'id':_0x2e23b2,'name':_0x1a4522,'custom':_0x589368};if(_0x953d37==='boolean'){_0x9650aa[_0xd779('0x4c')]=[{'name':_0xd779('0xaf'),'value':_0xd779('0xb0')},{'name':'False','value':_0xd779('0xb1')}];_0x2623d1(_0x9650aa);}else{var _0x327d21={'method':'GET','uri':_0x9343b1+_0xd779('0xb2')+_0x2e23b2,'auth':_0x2edd12,'json':!![]};return rp(_0x327d21)['then'](function(_0x17ba56){var _0x2a713b=[];if(_0x17ba56['result'][_0xd779('0x39')]>0x0){_0x17ba56['result']['forEach'](function(_0x307782){if(_0x307782[_0xd779('0xb3')]===_0xd779('0xb1')){var _0x45b814={'name':_0x307782['label'],'value':_0x307782['value']};_0x2a713b[_0xd779('0xa7')](_0x45b814);}});}_0x9650aa[_0xd779('0x4c')]=_0x2a713b;if(_0x9650aa['options']['length']>0x0){_0x2623d1(_0x9650aa);}else{if(_0x589368==![]){_0x2623d1();}else{_0x2623d1(_0x9650aa);}}});}});} \ No newline at end of file +var _0x6f90=['catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','parent','caused_by','number','sys_updated_by','user_input','sys_domain','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','rfc','opened_at','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','close_code','correlation_display','assignment_group','business_stc','description','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','category','username','password','email','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','GET','result','log','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','Wrong\x20credentials','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','ServicenowAccount','includeAll','include'];(function(_0x19a557,_0x345deb){var _0x97226e=function(_0x49a342){while(--_0x49a342){_0x19a557['push'](_0x19a557['shift']());}};_0x97226e(++_0x345deb);}(_0x6f90,0x1b3));var _0x06f9=function(_0x5c4eee,_0x28f72e){_0x5c4eee=_0x5c4eee-0x0;var _0x185944=_0x6f90[_0x5c4eee];return _0x185944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x06f9('0x1'));var BPromise=require(_0x06f9('0x2'));var Mustache=require(_0x06f9('0x3'));var util=require(_0x06f9('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x06f9('0x5'));var ejs=require(_0x06f9('0x6'));var fs=require('fs');var fs_extra=require(_0x06f9('0x7'));var _=require('lodash');var squel=require(_0x06f9('0x8'));var crypto=require(_0x06f9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x06f9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x06f9('0xb'));var Papa=require('papaparse');var Redis=require(_0x06f9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x06f9('0xd'));var as=require(_0x06f9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x06f9('0xf'))(_0x06f9('0x10'));var utils=require(_0x06f9('0x11'));var config=require(_0x06f9('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x06f9('0x13'))['db'];var integrations=require(_0x06f9('0x14'));function respondWithStatusCode(_0x34cfbc,_0x1b4cae){_0x1b4cae=_0x1b4cae||0xcc;return function(_0x15d870){if(_0x15d870){return _0x34cfbc['sendStatus'](_0x1b4cae);}return _0x34cfbc[_0x06f9('0x15')](_0x1b4cae)[_0x06f9('0x16')]();};}function respondWithResult(_0x496d7e,_0x1cf0d6){_0x1cf0d6=_0x1cf0d6||0xc8;return function(_0x312086){if(_0x312086){return _0x496d7e[_0x06f9('0x15')](_0x1cf0d6)['json'](_0x312086);}};}function respondWithFilteredResult(_0x4ca095,_0x2174ef){return function(_0x3cf46d){if(_0x3cf46d){var _0x49ebb7=typeof _0x2174ef[_0x06f9('0x17')]===_0x06f9('0x18')&&typeof _0x2174ef['limit']===_0x06f9('0x18');var _0xeb1474=_0x3cf46d[_0x06f9('0x19')];var _0x186e29=_0x49ebb7?0x0:_0x2174ef[_0x06f9('0x17')];var _0x530ff5=_0x49ebb7?_0x3cf46d[_0x06f9('0x19')]:_0x2174ef[_0x06f9('0x17')]+_0x2174ef[_0x06f9('0x1a')];var _0xe36f23;if(_0x530ff5>=_0xeb1474){_0x530ff5=_0xeb1474;_0xe36f23=0xc8;}else{_0xe36f23=0xce;}_0x4ca095[_0x06f9('0x15')](_0xe36f23);return _0x4ca095[_0x06f9('0x1b')]('Content-Range',_0x186e29+'-'+_0x530ff5+'/'+_0xeb1474)[_0x06f9('0x1c')](_0x3cf46d);}return null;};}function patchUpdates(_0x293109){return function(_0x5d431e){try{jsonpatch[_0x06f9('0x1d')](_0x5d431e,_0x293109,!![]);}catch(_0x4b1152){return BPromise[_0x06f9('0x1e')](_0x4b1152);}return _0x5d431e[_0x06f9('0x1f')]();};}function saveUpdates(_0x1b5f69,_0x135f7e){return function(_0x2a047d){if(_0x2a047d){return _0x2a047d[_0x06f9('0x20')](_0x1b5f69)[_0x06f9('0x21')](function(_0x562561){return _0x562561;});}return null;};}function removeEntity(_0x493e32,_0x5f24de){return function(_0x182f09){if(_0x182f09){return _0x182f09[_0x06f9('0x22')]()[_0x06f9('0x21')](function(){_0x493e32[_0x06f9('0x15')](0xcc)[_0x06f9('0x16')]();});}};}function handleEntityNotFound(_0x38b752,_0x3d76b4){return function(_0x3e76f6){if(!_0x3e76f6){_0x38b752[_0x06f9('0x23')](0x194);}return _0x3e76f6;};}function handleError(_0x1bd8df,_0x4c2770){_0x4c2770=_0x4c2770||0x1f4;return function(_0x284ab7){logger[_0x06f9('0x24')](_0x284ab7[_0x06f9('0x25')]);if(_0x284ab7[_0x06f9('0x26')]){delete _0x284ab7[_0x06f9('0x26')];}_0x1bd8df[_0x06f9('0x15')](_0x4c2770)[_0x06f9('0x27')](_0x284ab7);};}exports[_0x06f9('0x28')]=function(_0x441017,_0xb66c){var _0x582d5f={},_0x3d3cc0={},_0x355899={'count':0x0,'rows':[]};var _0x45fb72=_[_0x06f9('0x29')](db['ServicenowAccount']['rawAttributes'],function(_0x414489){return{'name':_0x414489[_0x06f9('0x2a')],'type':_0x414489[_0x06f9('0x2b')][_0x06f9('0x2c')]};});_0x3d3cc0[_0x06f9('0x2d')]=_[_0x06f9('0x29')](_0x45fb72,_0x06f9('0x26'));_0x3d3cc0[_0x06f9('0x2e')]=_[_0x06f9('0x2f')](_0x441017['query']);_0x3d3cc0[_0x06f9('0x30')]=_[_0x06f9('0x31')](_0x3d3cc0['model'],_0x3d3cc0[_0x06f9('0x2e')]);_0x582d5f['attributes']=_[_0x06f9('0x31')](_0x3d3cc0['model'],qs[_0x06f9('0x32')](_0x441017[_0x06f9('0x2e')]['fields']));_0x582d5f[_0x06f9('0x33')]=_0x582d5f[_0x06f9('0x33')][_0x06f9('0x34')]?_0x582d5f[_0x06f9('0x33')]:_0x3d3cc0[_0x06f9('0x2d')];if(!_0x441017[_0x06f9('0x2e')]['hasOwnProperty'](_0x06f9('0x35'))){_0x582d5f[_0x06f9('0x1a')]=qs[_0x06f9('0x1a')](_0x441017['query']['limit']);_0x582d5f[_0x06f9('0x17')]=qs[_0x06f9('0x17')](_0x441017[_0x06f9('0x2e')]['offset']);}_0x582d5f[_0x06f9('0x36')]=qs[_0x06f9('0x37')](_0x441017[_0x06f9('0x2e')]['sort']);_0x582d5f[_0x06f9('0x38')]=qs[_0x06f9('0x30')](_[_0x06f9('0x39')](_0x441017[_0x06f9('0x2e')],_0x3d3cc0[_0x06f9('0x30')]),_0x45fb72);if(_0x441017[_0x06f9('0x2e')][_0x06f9('0x3a')]){_0x582d5f[_0x06f9('0x38')]=_[_0x06f9('0x3b')](_0x582d5f[_0x06f9('0x38')],{'$or':_[_0x06f9('0x29')](_0x45fb72,function(_0x2d7776){if(_0x2d7776['type']!=='VIRTUAL'){var _0x4c00df={};_0x4c00df[_0x2d7776['name']]={'$like':'%'+_0x441017[_0x06f9('0x2e')]['filter']+'%'};return _0x4c00df;}})});}_0x582d5f=_['merge']({},_0x582d5f,_0x441017['options']);var _0x284c6d={'where':_0x582d5f[_0x06f9('0x38')]};return db[_0x06f9('0x3c')][_0x06f9('0x19')](_0x284c6d)[_0x06f9('0x21')](function(_0x1d9cbd){_0x355899[_0x06f9('0x19')]=_0x1d9cbd;if(_0x441017['query'][_0x06f9('0x3d')]){_0x582d5f[_0x06f9('0x3e')]=[{'all':!![]}];}return db[_0x06f9('0x3c')]['findAll'](_0x582d5f);})[_0x06f9('0x21')](function(_0x377529){_0x355899['rows']=_0x377529;return _0x355899;})[_0x06f9('0x21')](respondWithFilteredResult(_0xb66c,_0x582d5f))[_0x06f9('0x3f')](handleError(_0xb66c,null));};exports[_0x06f9('0x40')]=function(_0x284852,_0x1e84b2){var _0x4afdae={'raw':![],'where':{'id':_0x284852[_0x06f9('0x41')]['id']}},_0xd0a786={};_0xd0a786['model']=_[_0x06f9('0x2f')](db['ServicenowAccount'][_0x06f9('0x42')]);_0xd0a786['query']=_['keys'](_0x284852['query']);_0xd0a786[_0x06f9('0x30')]=_[_0x06f9('0x31')](_0xd0a786[_0x06f9('0x2d')],_0xd0a786[_0x06f9('0x2e')]);_0x4afdae[_0x06f9('0x33')]=_[_0x06f9('0x31')](_0xd0a786[_0x06f9('0x2d')],qs[_0x06f9('0x32')](_0x284852['query'][_0x06f9('0x32')]));_0x4afdae[_0x06f9('0x33')]=_0x4afdae['attributes'][_0x06f9('0x34')]?_0x4afdae['attributes']:_0xd0a786[_0x06f9('0x2d')];if(_0x284852[_0x06f9('0x2e')][_0x06f9('0x3d')]){_0x4afdae['include']=[{'all':!![]}];}_0x4afdae=_[_0x06f9('0x3b')]({},_0x4afdae,_0x284852[_0x06f9('0x43')]);return db[_0x06f9('0x3c')][_0x06f9('0x44')](_0x4afdae)[_0x06f9('0x21')](handleEntityNotFound(_0x1e84b2,null))[_0x06f9('0x21')](respondWithResult(_0x1e84b2,null))[_0x06f9('0x3f')](handleError(_0x1e84b2,null));};exports['create']=function(_0x53657f,_0x3a48af){return db[_0x06f9('0x3c')][_0x06f9('0x45')](_0x53657f[_0x06f9('0x46')],{})[_0x06f9('0x21')](respondWithResult(_0x3a48af,0xc9))[_0x06f9('0x3f')](handleError(_0x3a48af,null));};exports[_0x06f9('0x20')]=function(_0xb75fe5,_0x5944e2){if(_0xb75fe5['body']['id']){delete _0xb75fe5[_0x06f9('0x46')]['id'];}return db[_0x06f9('0x3c')][_0x06f9('0x44')]({'where':{'id':_0xb75fe5[_0x06f9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5944e2,null))[_0x06f9('0x21')](saveUpdates(_0xb75fe5[_0x06f9('0x46')],null))[_0x06f9('0x21')](respondWithResult(_0x5944e2,null))[_0x06f9('0x3f')](handleError(_0x5944e2,null));};exports[_0x06f9('0x22')]=function(_0x2576ef,_0x26cdea){return db[_0x06f9('0x3c')][_0x06f9('0x44')]({'where':{'id':_0x2576ef[_0x06f9('0x41')]['id']}})[_0x06f9('0x21')](handleEntityNotFound(_0x26cdea,null))['then'](removeEntity(_0x26cdea,null))['catch'](handleError(_0x26cdea,null));};exports[_0x06f9('0x47')]=function(_0x308812,_0x22d633,_0x3ae41c){var _0x12372a={};var _0x394c17={};var _0x2ec340;var _0x839cc;return db['ServicenowAccount'][_0x06f9('0x48')]({'where':{'id':_0x308812[_0x06f9('0x41')]['id']}})[_0x06f9('0x21')](handleEntityNotFound(_0x22d633,null))[_0x06f9('0x21')](function(_0x35a1dd){if(_0x35a1dd){_0x2ec340=_0x35a1dd;_0x394c17['model']=_[_0x06f9('0x2f')](db['ServicenowConfiguration'][_0x06f9('0x42')]);_0x394c17[_0x06f9('0x2e')]=_[_0x06f9('0x2f')](_0x308812['query']);_0x394c17[_0x06f9('0x30')]=_['intersection'](_0x394c17['model'],_0x394c17[_0x06f9('0x2e')]);_0x12372a[_0x06f9('0x33')]=_['intersection'](_0x394c17['model'],qs[_0x06f9('0x32')](_0x308812['query']['fields']));_0x12372a[_0x06f9('0x33')]=_0x12372a['attributes'][_0x06f9('0x34')]?_0x12372a['attributes']:_0x394c17['model'];_0x12372a[_0x06f9('0x36')]=qs[_0x06f9('0x37')](_0x308812['query'][_0x06f9('0x37')]);_0x12372a[_0x06f9('0x38')]=qs[_0x06f9('0x30')](_[_0x06f9('0x39')](_0x308812[_0x06f9('0x2e')],_0x394c17['filters']));if(_0x308812[_0x06f9('0x2e')][_0x06f9('0x3a')]){_0x12372a['where']=_[_0x06f9('0x3b')](_0x12372a[_0x06f9('0x38')],{'$or':_[_0x06f9('0x29')](_0x12372a[_0x06f9('0x33')],function(_0x214ef9){var _0x5a4e6b={};_0x5a4e6b[_0x214ef9]={'$like':'%'+_0x308812[_0x06f9('0x2e')][_0x06f9('0x3a')]+'%'};return _0x5a4e6b;})});}_0x12372a=_[_0x06f9('0x3b')]({},_0x12372a,_0x308812[_0x06f9('0x43')]);return _0x2ec340[_0x06f9('0x47')](_0x12372a);}})[_0x06f9('0x21')](function(_0x561193){if(_0x561193){_0x839cc=_0x561193['length'];if(!_0x308812[_0x06f9('0x2e')]['hasOwnProperty'](_0x06f9('0x35'))){_0x12372a[_0x06f9('0x1a')]=qs['limit'](_0x308812['query'][_0x06f9('0x1a')]);_0x12372a['offset']=qs['offset'](_0x308812['query']['offset']);}return _0x2ec340[_0x06f9('0x47')](_0x12372a);}})['then'](function(_0x1d581c){if(_0x1d581c){return _0x1d581c?{'count':_0x839cc,'rows':_0x1d581c}:null;}})[_0x06f9('0x21')](respondWithResult(_0x22d633,null))[_0x06f9('0x3f')](handleError(_0x22d633,null));};exports[_0x06f9('0x49')]=function(_0x5ed7f3,_0x3c7a30,_0x5958ca){if(_0x5ed7f3[_0x06f9('0x46')]['id']){delete _0x5ed7f3[_0x06f9('0x46')]['id'];}return db[_0x06f9('0x3c')][_0x06f9('0x48')]({'where':{'id':_0x5ed7f3[_0x06f9('0x41')]['id']}})[_0x06f9('0x21')](handleEntityNotFound(_0x3c7a30,null))[_0x06f9('0x21')](function(_0x16383a){if(_0x16383a){_0x5ed7f3[_0x06f9('0x46')]['AccountId']=_0x16383a['id'];_0x5ed7f3[_0x06f9('0x46')][_0x06f9('0x4a')]=integrations[_0x06f9('0x4b')](_0x5ed7f3[_0x06f9('0x46')]['channel'],_0x5ed7f3[_0x06f9('0x46')][_0x06f9('0x2b')]);_0x5ed7f3[_0x06f9('0x46')]['Descriptions']=integrations[_0x06f9('0x4c')](_0x5ed7f3[_0x06f9('0x46')]['channel'],_0x5ed7f3['body'][_0x06f9('0x2b')]);return db[_0x06f9('0x4d')][_0x06f9('0x45')](_0x5ed7f3[_0x06f9('0x46')],{'include':[{'model':db[_0x06f9('0x4e')],'as':_0x06f9('0x4a')},{'model':db[_0x06f9('0x4e')],'as':_0x06f9('0x4f')}]});}return null;})['then'](respondWithResult(_0x3c7a30,null))[_0x06f9('0x3f')](handleError(_0x3c7a30,null));};exports['getFields']=function(_0x53aabd,_0x4efb3b,_0x390f7){var _0x36c15b=[_0x06f9('0x50'),_0x06f9('0x51'),_0x06f9('0x52'),_0x06f9('0x53'),'close_code',_0x06f9('0x54'),_0x06f9('0x55'),_0x06f9('0x56'),'category'];var _0x236bb1=[_0x06f9('0x57'),_0x06f9('0x50'),_0x06f9('0x58'),'watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history',_0x06f9('0x59'),'resolved_by',_0x06f9('0x5a'),'opened_by',_0x06f9('0x5b'),'sys_created_on',_0x06f9('0x5c'),_0x06f9('0x5d'),_0x06f9('0x5e'),_0x06f9('0x52'),'order','calendar_stc',_0x06f9('0x5f'),_0x06f9('0x60'),_0x06f9('0x61'),_0x06f9('0x62'),'active',_0x06f9('0x63'),_0x06f9('0x64'),_0x06f9('0x65'),'sys_domain_path',_0x06f9('0x66'),'time_worked','expected_start',_0x06f9('0x67'),'business_duration',_0x06f9('0x68'),'work_end',_0x06f9('0x69'),_0x06f9('0x6a'),_0x06f9('0x6b'),_0x06f9('0x6c'),_0x06f9('0x53'),_0x06f9('0x6d'),'short_description',_0x06f9('0x6e'),_0x06f9('0x6f'),'delivery_task','work_start',_0x06f9('0x70'),_0x06f9('0x71'),'additional_assignee_list',_0x06f9('0x72'),'calendar_duration','notify','sys_class_name',_0x06f9('0x73'),_0x06f9('0x74'),_0x06f9('0x75'),_0x06f9('0x76'),_0x06f9('0x77'),_0x06f9('0x78'),'reopened_by',_0x06f9('0x55'),'urgency',_0x06f9('0x79'),_0x06f9('0x7a'),_0x06f9('0x7b'),'activity_due',_0x06f9('0x7c'),_0x06f9('0x56'),_0x06f9('0x7d'),_0x06f9('0x7e'),'approval',_0x06f9('0x7f'),_0x06f9('0x80'),'sys_mod_count',_0x06f9('0x81'),_0x06f9('0x82'),_0x06f9('0x83'),_0x06f9('0x84'),'correlation_id',_0x06f9('0x85'),_0x06f9('0x86')];var _0x3f4b07='';var _0x1c4889='';var _0xe0fa71=[];var _0x419f26='';var _0x5b40c9='';var _0x5ee562=[];var _0x1ab45b='';var _0x18cd19='';var _0x1efd3a={};var _0x9dd5c1='';return db[_0x06f9('0x3c')][_0x06f9('0x48')]({'where':{'id':_0x53aabd[_0x06f9('0x41')]['id']},'attributes':['id',_0x06f9('0x87'),_0x06f9('0x88'),_0x06f9('0x89'),_0x06f9('0x8a'),_0x06f9('0x8b')]})[_0x06f9('0x21')](handleEntityNotFound(_0x4efb3b,null))['then'](function(_0x4a9ca0){if(_0x4a9ca0){_0x9dd5c1=_0x4a9ca0[_0x06f9('0x8a')];var _0x4831b4=_0x9dd5c1[_0x06f9('0x8c')](-0x1);if(_0x4831b4==='/'){_0x9dd5c1=_0x9dd5c1[_0x06f9('0x8d')](0x0,_0x9dd5c1['lastIndexOf'](_0x4831b4));}_0x18cd19=util[_0x06f9('0x8e')](_0x06f9('0x8f'),_0x9dd5c1);_0x1ab45b=util[_0x06f9('0x8e')]('%s/api/now/table/',_0x9dd5c1);_0x1efd3a={'user':_0x4a9ca0[_0x06f9('0x87')],'pass':_0x4a9ca0['password']};var _0xcc69b6={'method':_0x06f9('0x90'),'uri':_0x18cd19+'incident?sysparm_display_value=all','auth':_0x1efd3a,'json':!![]};return rp(_0xcc69b6);}})[_0x06f9('0x21')](function(_0x103585){if(_0x103585[_0x06f9('0x91')][_0x06f9('0x34')]>0x0){_0x3f4b07=_0x103585[_0x06f9('0x91')];}console[_0x06f9('0x92')]('incident\x20table\x20objects',_0x3f4b07);_0x5ee562=[];_0x1c4889=Object[_0x06f9('0x93')]([],_0x3f4b07);_[_0x06f9('0x94')](_0x1c4889,function(_0x4365be){return!_0x36c15b['includes'](_0x4365be[_0x06f9('0x26')]);});_0x1c4889[_0x06f9('0x95')](function(_0xa1e064){var _0xe2e6f1=createFieldObject(_0x1ab45b,_0x1efd3a,_0xa1e064[_0x06f9('0x96')],_0xa1e064[_0x06f9('0x26')],_0xa1e064[_0x06f9('0x97')],![]);_0x5ee562[_0x06f9('0x98')](_0xe2e6f1);});return Promise[_0x06f9('0x99')](_0x5ee562);})[_0x06f9('0x21')](function(_0xf4ebdc){_0xe0fa71=_0xf4ebdc;_0x419f26=Object[_0x06f9('0x93')]([],_0x3f4b07);console[_0x06f9('0x92')](_0x06f9('0x9a'),_0x3f4b07);_[_0x06f9('0x94')](_0x419f26,function(_0x2ddd78){return _0x236bb1[_0x06f9('0x9b')](_0x2ddd78[_0x06f9('0x26')]);});console[_0x06f9('0x92')](_0x06f9('0x9c'),_0x419f26);_0x5ee562=[];_0x419f26[_0x06f9('0x95')](function(_0x669b68){var _0x57703c=createFieldObject(_0x1ab45b,_0x1efd3a,_0x669b68['internalType'],_0x669b68[_0x06f9('0x26')],_0x669b68[_0x06f9('0x97')],!![]);_0x5ee562[_0x06f9('0x98')](_0x57703c);});return Promise[_0x06f9('0x99')](_0x5ee562);})['then'](function(_0x595f1f){_0x5b40c9=_0x595f1f;var _0x5d3c3f=_0xe0fa71[_0x06f9('0x9d')](_0x5b40c9);return{'count':_0x5d3c3f[_0x06f9('0x34')],'rows':_0x5d3c3f};})['then'](respondWithResult(_0x4efb3b,null))[_0x06f9('0x3f')](function(_0x1a672a){console['log']('ServiceNow\x20error:\x20'+_0x1a672a);var _0x35ec43=_0x53aabd[_0x06f9('0x2e')][_0x06f9('0x9e')]?0x1f4:_0x1a672a[_0x06f9('0x9f')]||0x1f4;logger[_0x06f9('0x24')](_0x1a672a[_0x06f9('0x25')]);delete _0x1a672a['name'];if(_0x35ec43===0x191){_0x35ec43=0x190;}_0x4efb3b['status'](_0x35ec43)[_0x06f9('0x27')](_0x53aabd[_0x06f9('0x2e')]['test']?{'message':_0x06f9('0xa0'),'statusCode':_0x1a672a[_0x06f9('0x9f')]}:_0x1a672a);});};function createFieldObject(_0x32e9a3,_0x1ad3b6,_0x1ac14e,_0x268ce1,_0x511dbb,_0x33d306){return new Promise(function(_0x4b7b04,_0x361156){var _0x512c7e={'id':_0x268ce1,'name':_0x511dbb,'custom':_0x33d306};if(_0x1ac14e==='boolean'){_0x512c7e[_0x06f9('0x43')]=[{'name':'True','value':'true'},{'name':_0x06f9('0xa1'),'value':_0x06f9('0xa2')}];_0x4b7b04(_0x512c7e);}else{var _0x51d1d2={'method':_0x06f9('0x90'),'uri':_0x32e9a3+_0x06f9('0xa3')+_0x268ce1,'auth':_0x1ad3b6,'json':!![]};return rp(_0x51d1d2)[_0x06f9('0x21')](function(_0x10a68b){var _0x32cac9=[];if(_0x10a68b[_0x06f9('0x91')][_0x06f9('0x34')]>0x0){_0x10a68b[_0x06f9('0x91')][_0x06f9('0x95')](function(_0xca740a){if(_0xca740a[_0x06f9('0xa4')]===_0x06f9('0xa2')){var _0x389081={'name':_0xca740a[_0x06f9('0x97')],'value':_0xca740a[_0x06f9('0xa5')]};_0x32cac9[_0x06f9('0x98')](_0x389081);}});}_0x512c7e[_0x06f9('0x43')]=_0x32cac9;if(_0x512c7e[_0x06f9('0x43')][_0x06f9('0x34')]>0x0){_0x4b7b04(_0x512c7e);}else{if(_0x33d306==![]){_0x4b7b04();}else{_0x4b7b04(_0x512c7e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5de5141..cdfa46d 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 _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1da72c,_0x15d2e9){var _0x58d9e7=function(_0x1487e3){while(--_0x1487e3){_0x1da72c['push'](_0x1da72c['shift']());}};_0x58d9e7(++_0x15d2e9);}(_0x1883,0xab));var _0x3188=function(_0x29dc54,_0x2cc32e){_0x29dc54=_0x29dc54-0x0;var _0xaabea6=_0x1883[_0x29dc54];return _0xaabea6;};'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 +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x2833bc,_0x27a6e2){var _0xfe3c11=function(_0x1d9026){while(--_0x1d9026){_0x2833bc['push'](_0x2833bc['shift']());}};_0xfe3c11(++_0x27a6e2);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 5a37e65..c33e2ec 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 _0x454e=['stringify','error','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0x454e,0x1b2));var _0xe454=function(_0x221b20,_0x5d2d56){_0x221b20=_0x221b20-0x0;var _0x492229=_0x454e[_0x221b20];return _0x492229;};'use strict';var _=require(_0xe454('0x0'));var util=require('util');var moment=require(_0xe454('0x1'));var BPromise=require(_0xe454('0x2'));var rs=require(_0xe454('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe454('0x4'));var config=require(_0xe454('0x5'));var jayson=require(_0xe454('0x6'));var client=jayson['client'][_0xe454('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c35cb,_0x5d8cdb,_0x3dbe75){return new BPromise(function(_0x18f545,_0x483a3d){return client[_0xe454('0x8')](_0x1c35cb,_0x3dbe75)[_0xe454('0x9')](function(_0xfbd060){logger['info'](_0xe454('0xa'),_0x5d8cdb,_0xe454('0xb'));logger[_0xe454('0xc')](_0xe454('0xd'),_0x5d8cdb,'request\x20sent',JSON[_0xe454('0xe')](_0xfbd060));if(_0xfbd060['error']){if(_0xfbd060[_0xe454('0xf')]['code']===0x1f4){logger['error'](_0xe454('0xa'),_0x5d8cdb,_0xfbd060['error'][_0xe454('0x10')]);return _0x483a3d(_0xfbd060[_0xe454('0xf')][_0xe454('0x10')]);}logger[_0xe454('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5d8cdb,_0xfbd060[_0xe454('0xf')][_0xe454('0x10')]);return _0x18f545(_0xfbd060[_0xe454('0xf')][_0xe454('0x10')]);}else{logger[_0xe454('0x11')](_0xe454('0xa'),_0x5d8cdb,_0xe454('0xb'));_0x18f545(_0xfbd060[_0xe454('0x12')][_0xe454('0x10')]);}})[_0xe454('0x13')](function(_0x11b257){logger[_0xe454('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x5d8cdb,_0x11b257);_0x483a3d(_0x11b257);});});}exports[_0xe454('0x14')]=function(_0x8ca557){var _0x306aa4=this;return new Promise(function(_0x3fee9f,_0x16b864){return db[_0xe454('0x15')][_0xe454('0x16')]({'raw':_0x8ca557['options']?_0x8ca557[_0xe454('0x17')][_0xe454('0x18')]===undefined?!![]:![]:!![],'where':_0x8ca557[_0xe454('0x17')]?_0x8ca557[_0xe454('0x17')][_0xe454('0x19')]||null:null,'attributes':_0x8ca557[_0xe454('0x17')]?_0x8ca557[_0xe454('0x17')][_0xe454('0x1a')]||null:null,'limit':_0x8ca557[_0xe454('0x17')]?_0x8ca557[_0xe454('0x17')]['limit']||null:null,'include':_0x8ca557[_0xe454('0x17')]?_0x8ca557[_0xe454('0x17')][_0xe454('0x1b')]?_[_0xe454('0x1c')](_0x8ca557[_0xe454('0x17')][_0xe454('0x1b')],function(_0x292719){return{'model':db[_0x292719[_0xe454('0x1d')]],'as':_0x292719['as'],'attributes':_0x292719[_0xe454('0x1a')],'include':_0x292719[_0xe454('0x1b')]?_[_0xe454('0x1c')](_0x292719['include'],function(_0x46eb83){return{'model':db[_0x46eb83[_0xe454('0x1d')]],'as':_0x46eb83['as'],'attributes':_0x46eb83[_0xe454('0x1a')],'include':_0x46eb83['include']?_['map'](_0x46eb83[_0xe454('0x1b')],function(_0x3c66d2){return{'model':db[_0x3c66d2['model']],'as':_0x3c66d2['as'],'attributes':_0x3c66d2[_0xe454('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe454('0x9')](function(_0x35a513){logger[_0xe454('0x11')](_0xe454('0x14'),_0x8ca557);logger[_0xe454('0xc')]('GetServicenowAccount',_0x8ca557,JSON[_0xe454('0xe')](_0x35a513));_0x3fee9f(_0x35a513);})['catch'](function(_0xf429f4){logger['error'](_0xe454('0x14'),_0xf429f4[_0xe454('0x10')],_0x8ca557);_0x16b864(_0x306aa4[_0xe454('0xf')](0x1f4,_0xf429f4['message']));});});};exports[_0xe454('0x1e')]=function(_0x3c4a3b){var _0x52d34b=this;return new Promise(function(_0x3ea8dc,_0x3f016d){return db['ServicenowAccount'][_0xe454('0x1f')]({'raw':_0x3c4a3b[_0xe454('0x17')]?_0x3c4a3b[_0xe454('0x17')][_0xe454('0x18')]===undefined?!![]:![]:!![],'where':_0x3c4a3b['options']?_0x3c4a3b[_0xe454('0x17')][_0xe454('0x19')]||null:null,'attributes':_0x3c4a3b['options']?_0x3c4a3b[_0xe454('0x17')]['attributes']||null:null,'include':_0x3c4a3b[_0xe454('0x17')]?_0x3c4a3b['options']['include']?_[_0xe454('0x1c')](_0x3c4a3b[_0xe454('0x17')][_0xe454('0x1b')],function(_0x5493d9){return{'model':db[_0x5493d9[_0xe454('0x1d')]],'as':_0x5493d9['as'],'attributes':_0x5493d9[_0xe454('0x1a')],'include':_0x5493d9[_0xe454('0x1b')]?_[_0xe454('0x1c')](_0x5493d9[_0xe454('0x1b')],function(_0x1c9de0){return{'model':db[_0x1c9de0[_0xe454('0x1d')]],'as':_0x1c9de0['as'],'attributes':_0x1c9de0[_0xe454('0x1a')],'include':_0x1c9de0[_0xe454('0x1b')]?_[_0xe454('0x1c')](_0x1c9de0[_0xe454('0x1b')],function(_0x3f38b7){return{'model':db[_0x3f38b7[_0xe454('0x1d')]],'as':_0x3f38b7['as'],'attributes':_0x3f38b7[_0xe454('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe454('0x9')](function(_0x35d100){logger[_0xe454('0x11')](_0xe454('0x1e'),_0x3c4a3b);logger[_0xe454('0xc')](_0xe454('0x1e'),_0x3c4a3b,JSON[_0xe454('0xe')](_0x35d100));_0x3ea8dc(_0x35d100);})[_0xe454('0x13')](function(_0x2e0415){logger['error'](_0xe454('0x1e'),_0x2e0415[_0xe454('0x10')],_0x3c4a3b);_0x3f016d(_0x52d34b[_0xe454('0xf')](0x1f4,_0x2e0415[_0xe454('0x10')]));});});}; \ No newline at end of file +var _0x499a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowServicenowAccount','find','lodash','util','moment'];(function(_0x3e6647,_0x2c0d09){var _0x46bddd=function(_0xad96c0){while(--_0xad96c0){_0x3e6647['push'](_0x3e6647['shift']());}};_0x46bddd(++_0x2c0d09);}(_0x499a,0x1de));var _0xa499=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x499a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa499('0x0'));var util=require(_0xa499('0x1'));var moment=require(_0xa499('0x2'));var BPromise=require(_0xa499('0x3'));var rs=require(_0xa499('0x4'));var fs=require('fs');var Redis=require(_0xa499('0x5'));var db=require(_0xa499('0x6'))['db'];var utils=require(_0xa499('0x7'));var logger=require(_0xa499('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa499('0x9'));var client=jayson['client'][_0xa499('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdab3a0,_0x5c856e,_0x2b67b4){return new BPromise(function(_0x51538f,_0x32eb18){return client[_0xa499('0xb')](_0xdab3a0,_0x2b67b4)[_0xa499('0xc')](function(_0x5d13e1){logger[_0xa499('0xd')](_0xa499('0xe'),_0x5c856e,_0xa499('0xf'));logger[_0xa499('0x10')](_0xa499('0x11'),_0x5c856e,_0xa499('0xf'),JSON[_0xa499('0x12')](_0x5d13e1));if(_0x5d13e1[_0xa499('0x13')]){if(_0x5d13e1['error'][_0xa499('0x14')]===0x1f4){logger[_0xa499('0x13')](_0xa499('0xe'),_0x5c856e,_0x5d13e1[_0xa499('0x13')][_0xa499('0x15')]);return _0x32eb18(_0x5d13e1['error'][_0xa499('0x15')]);}logger[_0xa499('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x5c856e,_0x5d13e1[_0xa499('0x13')][_0xa499('0x15')]);return _0x51538f(_0x5d13e1[_0xa499('0x13')]['message']);}else{logger[_0xa499('0xd')](_0xa499('0xe'),_0x5c856e,_0xa499('0xf'));_0x51538f(_0x5d13e1[_0xa499('0x16')][_0xa499('0x15')]);}})[_0xa499('0x17')](function(_0x1f9d2f){logger[_0xa499('0x13')](_0xa499('0xe'),_0x5c856e,_0x1f9d2f);_0x32eb18(_0x1f9d2f);});});}exports[_0xa499('0x18')]=function(_0x2effe2){var _0xf4838a=this;return new Promise(function(_0x1e43da,_0x54f9f6){return db[_0xa499('0x19')][_0xa499('0x1a')]({'raw':_0x2effe2[_0xa499('0x1b')]?_0x2effe2[_0xa499('0x1b')][_0xa499('0x1c')]===undefined?!![]:![]:!![],'where':_0x2effe2[_0xa499('0x1b')]?_0x2effe2[_0xa499('0x1b')][_0xa499('0x1d')]||null:null,'attributes':_0x2effe2[_0xa499('0x1b')]?_0x2effe2[_0xa499('0x1b')][_0xa499('0x1e')]||null:null,'limit':_0x2effe2[_0xa499('0x1b')]?_0x2effe2[_0xa499('0x1b')][_0xa499('0x1f')]||null:null,'include':_0x2effe2[_0xa499('0x1b')]?_0x2effe2['options'][_0xa499('0x20')]?_['map'](_0x2effe2['options'][_0xa499('0x20')],function(_0x37f4ab){return{'model':db[_0x37f4ab[_0xa499('0x21')]],'as':_0x37f4ab['as'],'attributes':_0x37f4ab[_0xa499('0x1e')],'include':_0x37f4ab[_0xa499('0x20')]?_['map'](_0x37f4ab['include'],function(_0x3ddd23){return{'model':db[_0x3ddd23[_0xa499('0x21')]],'as':_0x3ddd23['as'],'attributes':_0x3ddd23[_0xa499('0x1e')],'include':_0x3ddd23[_0xa499('0x20')]?_[_0xa499('0x22')](_0x3ddd23[_0xa499('0x20')],function(_0x3b565c){return{'model':db[_0x3b565c['model']],'as':_0x3b565c['as'],'attributes':_0x3b565c[_0xa499('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa499('0xc')](function(_0x193e49){logger[_0xa499('0xd')](_0xa499('0x18'),_0x2effe2);logger[_0xa499('0x10')]('GetServicenowAccount',_0x2effe2,JSON[_0xa499('0x12')](_0x193e49));_0x1e43da(_0x193e49);})[_0xa499('0x17')](function(_0x469cd9){logger[_0xa499('0x13')](_0xa499('0x18'),_0x469cd9[_0xa499('0x15')],_0x2effe2);_0x54f9f6(_0xf4838a['error'](0x1f4,_0x469cd9['message']));});});};exports[_0xa499('0x23')]=function(_0x5e009f){var _0x2189cd=this;return new Promise(function(_0x4bdb97,_0x437fbb){return db[_0xa499('0x19')][_0xa499('0x24')]({'raw':_0x5e009f[_0xa499('0x1b')]?_0x5e009f[_0xa499('0x1b')][_0xa499('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e009f[_0xa499('0x1b')]?_0x5e009f[_0xa499('0x1b')][_0xa499('0x1d')]||null:null,'attributes':_0x5e009f[_0xa499('0x1b')]?_0x5e009f[_0xa499('0x1b')][_0xa499('0x1e')]||null:null,'include':_0x5e009f['options']?_0x5e009f[_0xa499('0x1b')][_0xa499('0x20')]?_[_0xa499('0x22')](_0x5e009f[_0xa499('0x1b')][_0xa499('0x20')],function(_0x86d306){return{'model':db[_0x86d306[_0xa499('0x21')]],'as':_0x86d306['as'],'attributes':_0x86d306[_0xa499('0x1e')],'include':_0x86d306['include']?_[_0xa499('0x22')](_0x86d306[_0xa499('0x20')],function(_0x12ee2b){return{'model':db[_0x12ee2b[_0xa499('0x21')]],'as':_0x12ee2b['as'],'attributes':_0x12ee2b[_0xa499('0x1e')],'include':_0x12ee2b[_0xa499('0x20')]?_[_0xa499('0x22')](_0x12ee2b[_0xa499('0x20')],function(_0x5ceaa0){return{'model':db[_0x5ceaa0['model']],'as':_0x5ceaa0['as'],'attributes':_0x5ceaa0[_0xa499('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa499('0xc')](function(_0x3aa8a4){logger[_0xa499('0xd')]('ShowServicenowAccount',_0x5e009f);logger[_0xa499('0x10')](_0xa499('0x23'),_0x5e009f,JSON[_0xa499('0x12')](_0x3aa8a4));_0x4bdb97(_0x3aa8a4);})['catch'](function(_0x306df9){logger['error'](_0xa499('0x23'),_0x306df9[_0xa499('0x15')],_0x5e009f);_0x437fbb(_0x2189cd[_0xa499('0x13')](0x1f4,_0x306df9['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index de06960..1057fc8 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 _0x9a4e=['isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a4e,0x94));var _0xe9a4=function(_0x484e5c,_0x13f5d2){_0x484e5c=_0x484e5c-0x0;var _0x5d65ef=_0x9a4e[_0x484e5c];return _0x5d65ef;};'use strict';var multer=require(_0xe9a4('0x0'));var util=require(_0xe9a4('0x1'));var path=require(_0xe9a4('0x2'));var timeout=require(_0xe9a4('0x3'));var express=require(_0xe9a4('0x4'));var router=express[_0xe9a4('0x5')]();var fs_extra=require(_0xe9a4('0x6'));var auth=require(_0xe9a4('0x7'));var interaction=require(_0xe9a4('0x8'));var config=require('../../config/environment');var controller=require(_0xe9a4('0x9'));router[_0xe9a4('0xa')]('/',auth['isAuthenticated'](),controller[_0xe9a4('0xb')]);router[_0xe9a4('0xa')](_0xe9a4('0xc'),auth[_0xe9a4('0xd')](),controller[_0xe9a4('0xe')]);router[_0xe9a4('0xa')](_0xe9a4('0xf'),auth[_0xe9a4('0xd')](),controller['getFields']);router[_0xe9a4('0xa')](_0xe9a4('0x10'),auth[_0xe9a4('0xd')](),controller['getSubjects']);router[_0xe9a4('0xa')](_0xe9a4('0x11'),auth[_0xe9a4('0xd')](),controller[_0xe9a4('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe9a4('0x13')]);router[_0xe9a4('0x14')](_0xe9a4('0xc'),auth[_0xe9a4('0xd')](),controller[_0xe9a4('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe9a4('0x16')]);module['exports']=router; \ No newline at end of file +var _0x139b=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x139b,0x1ce));var _0xb139=function(_0x59ea3b,_0x81f970){_0x59ea3b=_0x59ea3b-0x0;var _0x29a026=_0x139b[_0x59ea3b];return _0x29a026;};'use strict';var multer=require(_0xb139('0x0'));var util=require(_0xb139('0x1'));var path=require(_0xb139('0x2'));var timeout=require(_0xb139('0x3'));var express=require(_0xb139('0x4'));var router=express['Router']();var fs_extra=require(_0xb139('0x5'));var auth=require(_0xb139('0x6'));var interaction=require(_0xb139('0x7'));var config=require(_0xb139('0x8'));var controller=require(_0xb139('0x9'));router[_0xb139('0xa')]('/',auth[_0xb139('0xb')](),controller[_0xb139('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb139('0xd')]);router['get'](_0xb139('0xe'),auth[_0xb139('0xb')](),controller[_0xb139('0xf')]);router[_0xb139('0xa')](_0xb139('0x10'),auth[_0xb139('0xb')](),controller[_0xb139('0x11')]);router[_0xb139('0xa')]('/:id/descriptions',auth[_0xb139('0xb')](),controller[_0xb139('0x12')]);router[_0xb139('0x13')]('/',auth[_0xb139('0xb')](),controller[_0xb139('0x14')]);router['put'](_0xb139('0x15'),auth[_0xb139('0xb')](),controller[_0xb139('0x16')]);router[_0xb139('0x17')]('/:id',auth[_0xb139('0xb')](),controller[_0xb139('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 304f7c0..7825f97 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 _0x5cde=['exports','STRING','sequelize'];(function(_0x150599,_0x3bdfb0){var _0x12c65f=function(_0x842f6f){while(--_0x842f6f){_0x150599['push'](_0x150599['shift']());}};_0x12c65f(++_0x3bdfb0);}(_0x5cde,0x8f));var _0xe5cd=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5cde[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xe5cd('0x0'));module[_0xe5cd('0x1')]={'name':{'type':Sequelize[_0xe5cd('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe56a=['exports','STRING','sequelize'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0xe56a,0x1a0));var _0xae56=function(_0xe9332a,_0x527d99){_0xe9332a=_0xe9332a-0x0;var _0x5b31ec=_0xe56a[_0xe9332a];return _0x5b31ec;};'use strict';var Sequelize=require(_0xae56('0x0'));module[_0xae56('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xae56('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 03e50e8..0d978fc 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 _0x6c78=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','intersection','options','find','create','body','getFields','ServicenowField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5aad8c,_0x3cb47b){var _0x14007e=function(_0x2ec097){while(--_0x2ec097){_0x5aad8c['push'](_0x5aad8c['shift']());}};_0x14007e(++_0x3cb47b);}(_0x6c78,0x1d2));var _0x86c7=function(_0x2ed725,_0x1fefda){_0x2ed725=_0x2ed725-0x0;var _0x30a0c9=_0x6c78[_0x2ed725];return _0x30a0c9;};'use strict';var emlformat=require(_0x86c7('0x0'));var rimraf=require(_0x86c7('0x1'));var zipdir=require(_0x86c7('0x2'));var jsonpatch=require(_0x86c7('0x3'));var rp=require(_0x86c7('0x4'));var moment=require(_0x86c7('0x5'));var BPromise=require(_0x86c7('0x6'));var Mustache=require(_0x86c7('0x7'));var util=require(_0x86c7('0x8'));var path=require(_0x86c7('0x9'));var sox=require(_0x86c7('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86c7('0xb'));var _=require('lodash');var squel=require(_0x86c7('0xc'));var crypto=require(_0x86c7('0xd'));var jsforce=require(_0x86c7('0xe'));var deskjs=require(_0x86c7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x86c7('0x10'));var Redis=require(_0x86c7('0x11'));var authService=require(_0x86c7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86c7('0x13'));var logger=require(_0x86c7('0x14'))(_0x86c7('0x15'));var utils=require(_0x86c7('0x16'));var config=require(_0x86c7('0x17'));var licenseUtil=require(_0x86c7('0x18'));var db=require(_0x86c7('0x19'))['db'];function respondWithStatusCode(_0x49e93c,_0x3350ce){_0x3350ce=_0x3350ce||0xcc;return function(_0x14b8a2){if(_0x14b8a2){return _0x49e93c[_0x86c7('0x1a')](_0x3350ce);}return _0x49e93c[_0x86c7('0x1b')](_0x3350ce)['end']();};}function respondWithResult(_0xa312f6,_0x4cfbb1){_0x4cfbb1=_0x4cfbb1||0xc8;return function(_0x4687d8){if(_0x4687d8){return _0xa312f6[_0x86c7('0x1b')](_0x4cfbb1)[_0x86c7('0x1c')](_0x4687d8);}};}function respondWithFilteredResult(_0x4f3f4f,_0x1c3be5){return function(_0x5c2819){if(_0x5c2819){var _0x4acc93=typeof _0x1c3be5[_0x86c7('0x1d')]===_0x86c7('0x1e')&&typeof _0x1c3be5[_0x86c7('0x1f')]==='undefined';var _0xc58aa=_0x5c2819[_0x86c7('0x20')];var _0x3c3ec8=_0x4acc93?0x0:_0x1c3be5[_0x86c7('0x1d')];var _0x11855f=_0x4acc93?_0x5c2819[_0x86c7('0x20')]:_0x1c3be5[_0x86c7('0x1d')]+_0x1c3be5[_0x86c7('0x1f')];var _0x464c68;if(_0x11855f>=_0xc58aa){_0x11855f=_0xc58aa;_0x464c68=0xc8;}else{_0x464c68=0xce;}_0x4f3f4f[_0x86c7('0x1b')](_0x464c68);return _0x4f3f4f[_0x86c7('0x21')](_0x86c7('0x22'),_0x3c3ec8+'-'+_0x11855f+'/'+_0xc58aa)[_0x86c7('0x1c')](_0x5c2819);}return null;};}function patchUpdates(_0x5f14ff){return function(_0x52beae){try{jsonpatch[_0x86c7('0x23')](_0x52beae,_0x5f14ff,!![]);}catch(_0x121a62){return BPromise[_0x86c7('0x24')](_0x121a62);}return _0x52beae[_0x86c7('0x25')]();};}function saveUpdates(_0x4208d8,_0x5328e7){return function(_0x1bef72){if(_0x1bef72){return _0x1bef72[_0x86c7('0x26')](_0x4208d8)[_0x86c7('0x27')](function(_0x412927){return _0x412927;});}return null;};}function removeEntity(_0x1e7022,_0x1adb7f){return function(_0x1995af){if(_0x1995af){return _0x1995af[_0x86c7('0x28')]()['then'](function(){_0x1e7022[_0x86c7('0x1b')](0xcc)[_0x86c7('0x29')]();});}};}function handleEntityNotFound(_0x2b3f93,_0x4ad271){return function(_0x4dc021){if(!_0x4dc021){_0x2b3f93[_0x86c7('0x1a')](0x194);}return _0x4dc021;};}function handleError(_0x1194a6,_0x2b65df){_0x2b65df=_0x2b65df||0x1f4;return function(_0x274782){logger[_0x86c7('0x2a')](_0x274782['stack']);if(_0x274782[_0x86c7('0x2b')]){delete _0x274782[_0x86c7('0x2b')];}_0x1194a6[_0x86c7('0x1b')](_0x2b65df)[_0x86c7('0x2c')](_0x274782);};}exports['index']=function(_0x18e974,_0x2b2c71){var _0x32425b={},_0x3dae9d={},_0x222f67={'count':0x0,'rows':[]};var _0x287866=_[_0x86c7('0x2d')](db[_0x86c7('0x2e')][_0x86c7('0x2f')],function(_0x580b8b){return{'name':_0x580b8b[_0x86c7('0x30')],'type':_0x580b8b[_0x86c7('0x31')]['key']};});_0x3dae9d[_0x86c7('0x32')]=_[_0x86c7('0x2d')](_0x287866,'name');_0x3dae9d[_0x86c7('0x33')]=_['keys'](_0x18e974[_0x86c7('0x33')]);_0x3dae9d[_0x86c7('0x34')]=_['intersection'](_0x3dae9d['model'],_0x3dae9d[_0x86c7('0x33')]);_0x32425b[_0x86c7('0x35')]=_['intersection'](_0x3dae9d[_0x86c7('0x32')],qs[_0x86c7('0x36')](_0x18e974[_0x86c7('0x33')][_0x86c7('0x36')]));_0x32425b[_0x86c7('0x35')]=_0x32425b[_0x86c7('0x35')][_0x86c7('0x37')]?_0x32425b['attributes']:_0x3dae9d[_0x86c7('0x32')];if(!_0x18e974[_0x86c7('0x33')][_0x86c7('0x38')](_0x86c7('0x39'))){_0x32425b['limit']=qs[_0x86c7('0x1f')](_0x18e974[_0x86c7('0x33')]['limit']);_0x32425b[_0x86c7('0x1d')]=qs[_0x86c7('0x1d')](_0x18e974[_0x86c7('0x33')][_0x86c7('0x1d')]);}_0x32425b['order']=qs[_0x86c7('0x3a')](_0x18e974['query'][_0x86c7('0x3a')]);_0x32425b['where']=qs[_0x86c7('0x34')](_[_0x86c7('0x3b')](_0x18e974[_0x86c7('0x33')],_0x3dae9d[_0x86c7('0x34')]),_0x287866);if(_0x18e974[_0x86c7('0x33')][_0x86c7('0x3c')]){_0x32425b['where']=_['merge'](_0x32425b[_0x86c7('0x3d')],{'$or':_['map'](_0x287866,function(_0x1f412c){if(_0x1f412c[_0x86c7('0x31')]!==_0x86c7('0x3e')){var _0x39fae9={};_0x39fae9[_0x1f412c[_0x86c7('0x2b')]]={'$like':'%'+_0x18e974[_0x86c7('0x33')][_0x86c7('0x3c')]+'%'};return _0x39fae9;}})});}_0x32425b=_[_0x86c7('0x3f')]({},_0x32425b,_0x18e974['options']);var _0x54816b={'where':_0x32425b[_0x86c7('0x3d')]};return db[_0x86c7('0x2e')][_0x86c7('0x20')](_0x54816b)['then'](function(_0x3995b4){_0x222f67[_0x86c7('0x20')]=_0x3995b4;if(_0x18e974['query'][_0x86c7('0x40')]){_0x32425b[_0x86c7('0x41')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x32425b);})[_0x86c7('0x27')](function(_0x28b4a4){_0x222f67[_0x86c7('0x42')]=_0x28b4a4;return _0x222f67;})['then'](respondWithFilteredResult(_0x2b2c71,_0x32425b))[_0x86c7('0x43')](handleError(_0x2b2c71,null));};exports['show']=function(_0x5d2bcc,_0x28d347){var _0x433a1c={'raw':![],'where':{'id':_0x5d2bcc[_0x86c7('0x44')]['id']}},_0x2891bb={};_0x2891bb[_0x86c7('0x32')]=_[_0x86c7('0x45')](db[_0x86c7('0x2e')][_0x86c7('0x2f')]);_0x2891bb['query']=_[_0x86c7('0x45')](_0x5d2bcc[_0x86c7('0x33')]);_0x2891bb[_0x86c7('0x34')]=_[_0x86c7('0x46')](_0x2891bb['model'],_0x2891bb[_0x86c7('0x33')]);_0x433a1c[_0x86c7('0x35')]=_[_0x86c7('0x46')](_0x2891bb[_0x86c7('0x32')],qs[_0x86c7('0x36')](_0x5d2bcc[_0x86c7('0x33')][_0x86c7('0x36')]));_0x433a1c[_0x86c7('0x35')]=_0x433a1c[_0x86c7('0x35')]['length']?_0x433a1c[_0x86c7('0x35')]:_0x2891bb[_0x86c7('0x32')];if(_0x5d2bcc[_0x86c7('0x33')][_0x86c7('0x40')]){_0x433a1c[_0x86c7('0x41')]=[{'all':!![]}];}_0x433a1c=_[_0x86c7('0x3f')]({},_0x433a1c,_0x5d2bcc[_0x86c7('0x47')]);return db['ServicenowConfiguration'][_0x86c7('0x48')](_0x433a1c)[_0x86c7('0x27')](handleEntityNotFound(_0x28d347,null))['then'](respondWithResult(_0x28d347,null))[_0x86c7('0x43')](handleError(_0x28d347,null));};exports['create']=function(_0xc8c665,_0x3f95c4){return db[_0x86c7('0x2e')][_0x86c7('0x49')](_0xc8c665[_0x86c7('0x4a')],{})[_0x86c7('0x27')](respondWithResult(_0x3f95c4,0xc9))[_0x86c7('0x43')](handleError(_0x3f95c4,null));};exports['update']=function(_0x20e604,_0x1304dd){if(_0x20e604[_0x86c7('0x4a')]['id']){delete _0x20e604[_0x86c7('0x4a')]['id'];}return db[_0x86c7('0x2e')][_0x86c7('0x48')]({'where':{'id':_0x20e604[_0x86c7('0x44')]['id']}})[_0x86c7('0x27')](handleEntityNotFound(_0x1304dd,null))['then'](saveUpdates(_0x20e604['body'],null))[_0x86c7('0x27')](respondWithResult(_0x1304dd,null))[_0x86c7('0x43')](handleError(_0x1304dd,null));};exports[_0x86c7('0x28')]=function(_0x3d5f37,_0xd32fe4){return db['ServicenowConfiguration'][_0x86c7('0x48')]({'where':{'id':_0x3d5f37[_0x86c7('0x44')]['id']}})[_0x86c7('0x27')](handleEntityNotFound(_0xd32fe4,null))[_0x86c7('0x27')](removeEntity(_0xd32fe4,null))[_0x86c7('0x43')](handleError(_0xd32fe4,null));};exports[_0x86c7('0x4b')]=function(_0x34dd65,_0x51ab46,_0x216420){var _0x5c0017={};var _0x576d7c={};var _0x10f279;var _0x3d8325;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x34dd65['params']['id']}})['then'](handleEntityNotFound(_0x51ab46,null))[_0x86c7('0x27')](function(_0x546e36){if(_0x546e36){_0x10f279=_0x546e36;_0x576d7c[_0x86c7('0x32')]=_[_0x86c7('0x45')](db[_0x86c7('0x4c')]['rawAttributes']);_0x576d7c[_0x86c7('0x33')]=_[_0x86c7('0x45')](_0x34dd65[_0x86c7('0x33')]);_0x576d7c[_0x86c7('0x34')]=_['intersection'](_0x576d7c['model'],_0x576d7c[_0x86c7('0x33')]);_0x5c0017[_0x86c7('0x35')]=_[_0x86c7('0x46')](_0x576d7c['model'],qs[_0x86c7('0x36')](_0x34dd65[_0x86c7('0x33')][_0x86c7('0x36')]));_0x5c0017[_0x86c7('0x35')]=_0x5c0017[_0x86c7('0x35')]['length']?_0x5c0017[_0x86c7('0x35')]:_0x576d7c[_0x86c7('0x32')];_0x5c0017[_0x86c7('0x4d')]=qs[_0x86c7('0x3a')](_0x34dd65[_0x86c7('0x33')]['sort']);_0x5c0017[_0x86c7('0x3d')]=qs[_0x86c7('0x34')](_[_0x86c7('0x3b')](_0x34dd65['query'],_0x576d7c[_0x86c7('0x34')]));if(_0x34dd65[_0x86c7('0x33')][_0x86c7('0x3c')]){_0x5c0017[_0x86c7('0x3d')]=_[_0x86c7('0x3f')](_0x5c0017[_0x86c7('0x3d')],{'$or':_[_0x86c7('0x2d')](_0x5c0017[_0x86c7('0x35')],function(_0x1d7fdd){var _0x4b6f58={};_0x4b6f58[_0x1d7fdd]={'$like':'%'+_0x34dd65[_0x86c7('0x33')][_0x86c7('0x3c')]+'%'};return _0x4b6f58;})});}_0x5c0017=_[_0x86c7('0x3f')]({},_0x5c0017,_0x34dd65[_0x86c7('0x47')]);return _0x10f279[_0x86c7('0x4b')](_0x5c0017);}})[_0x86c7('0x27')](function(_0x541861){if(_0x541861){_0x3d8325=_0x541861[_0x86c7('0x37')];if(!_0x34dd65[_0x86c7('0x33')][_0x86c7('0x38')](_0x86c7('0x39'))){_0x5c0017[_0x86c7('0x1f')]=qs['limit'](_0x34dd65[_0x86c7('0x33')][_0x86c7('0x1f')]);_0x5c0017[_0x86c7('0x1d')]=qs[_0x86c7('0x1d')](_0x34dd65[_0x86c7('0x33')][_0x86c7('0x1d')]);}return _0x10f279[_0x86c7('0x4b')](_0x5c0017);}})[_0x86c7('0x27')](function(_0xa25be3){if(_0xa25be3){return _0xa25be3?{'count':_0x3d8325,'rows':_0xa25be3}:null;}})[_0x86c7('0x27')](respondWithResult(_0x51ab46,null))[_0x86c7('0x43')](handleError(_0x51ab46,null));};exports[_0x86c7('0x4e')]=function(_0x13687c,_0x5db6c3,_0x305e6f){var _0x2cb04f={};var _0x51847b={};var _0x1163cb;var _0x2246db;return db[_0x86c7('0x2e')][_0x86c7('0x4f')]({'where':{'id':_0x13687c['params']['id']}})['then'](handleEntityNotFound(_0x5db6c3,null))[_0x86c7('0x27')](function(_0x5ee5d6){if(_0x5ee5d6){_0x1163cb=_0x5ee5d6;_0x51847b[_0x86c7('0x32')]=_['keys'](db[_0x86c7('0x4c')][_0x86c7('0x2f')]);_0x51847b[_0x86c7('0x33')]=_[_0x86c7('0x45')](_0x13687c[_0x86c7('0x33')]);_0x51847b[_0x86c7('0x34')]=_[_0x86c7('0x46')](_0x51847b[_0x86c7('0x32')],_0x51847b[_0x86c7('0x33')]);_0x2cb04f[_0x86c7('0x35')]=_[_0x86c7('0x46')](_0x51847b['model'],qs[_0x86c7('0x36')](_0x13687c[_0x86c7('0x33')][_0x86c7('0x36')]));_0x2cb04f[_0x86c7('0x35')]=_0x2cb04f[_0x86c7('0x35')]['length']?_0x2cb04f[_0x86c7('0x35')]:_0x51847b['model'];_0x2cb04f[_0x86c7('0x4d')]=qs['sort'](_0x13687c['query'][_0x86c7('0x3a')]);_0x2cb04f[_0x86c7('0x3d')]=qs[_0x86c7('0x34')](_[_0x86c7('0x3b')](_0x13687c[_0x86c7('0x33')],_0x51847b[_0x86c7('0x34')]));if(_0x13687c['query']['filter']){_0x2cb04f[_0x86c7('0x3d')]=_[_0x86c7('0x3f')](_0x2cb04f[_0x86c7('0x3d')],{'$or':_[_0x86c7('0x2d')](_0x2cb04f[_0x86c7('0x35')],function(_0x129e9c){var _0x46b76b={};_0x46b76b[_0x129e9c]={'$like':'%'+_0x13687c['query'][_0x86c7('0x3c')]+'%'};return _0x46b76b;})});}_0x2cb04f=_[_0x86c7('0x3f')]({},_0x2cb04f,_0x13687c['options']);return _0x1163cb[_0x86c7('0x4e')](_0x2cb04f);}})[_0x86c7('0x27')](function(_0x21d8c8){if(_0x21d8c8){_0x2246db=_0x21d8c8[_0x86c7('0x37')];if(!_0x13687c[_0x86c7('0x33')][_0x86c7('0x38')](_0x86c7('0x39'))){_0x2cb04f[_0x86c7('0x1f')]=qs[_0x86c7('0x1f')](_0x13687c[_0x86c7('0x33')][_0x86c7('0x1f')]);_0x2cb04f[_0x86c7('0x1d')]=qs['offset'](_0x13687c[_0x86c7('0x33')]['offset']);}return _0x1163cb[_0x86c7('0x4e')](_0x2cb04f);}})[_0x86c7('0x27')](function(_0x16e1eb){if(_0x16e1eb){return _0x16e1eb?{'count':_0x2246db,'rows':_0x16e1eb}:null;}})['then'](respondWithResult(_0x5db6c3,null))['catch'](handleError(_0x5db6c3,null));};exports[_0x86c7('0x50')]=function(_0x420bc3,_0x294d83,_0xf837be){var _0x46bf3a={};var _0x12d4b2={};var _0x3e15d4;var _0x3fd805;return db[_0x86c7('0x2e')][_0x86c7('0x4f')]({'where':{'id':_0x420bc3['params']['id']}})[_0x86c7('0x27')](handleEntityNotFound(_0x294d83,null))[_0x86c7('0x27')](function(_0x123f01){if(_0x123f01){_0x3e15d4=_0x123f01;_0x12d4b2['model']=_['keys'](db[_0x86c7('0x4c')]['rawAttributes']);_0x12d4b2[_0x86c7('0x33')]=_[_0x86c7('0x45')](_0x420bc3['query']);_0x12d4b2['filters']=_[_0x86c7('0x46')](_0x12d4b2['model'],_0x12d4b2[_0x86c7('0x33')]);_0x46bf3a[_0x86c7('0x35')]=_[_0x86c7('0x46')](_0x12d4b2[_0x86c7('0x32')],qs[_0x86c7('0x36')](_0x420bc3['query'][_0x86c7('0x36')]));_0x46bf3a[_0x86c7('0x35')]=_0x46bf3a[_0x86c7('0x35')][_0x86c7('0x37')]?_0x46bf3a[_0x86c7('0x35')]:_0x12d4b2['model'];_0x46bf3a[_0x86c7('0x4d')]=qs['sort'](_0x420bc3['query']['sort']);_0x46bf3a[_0x86c7('0x3d')]=qs[_0x86c7('0x34')](_[_0x86c7('0x3b')](_0x420bc3[_0x86c7('0x33')],_0x12d4b2[_0x86c7('0x34')]));if(_0x420bc3[_0x86c7('0x33')][_0x86c7('0x3c')]){_0x46bf3a[_0x86c7('0x3d')]=_['merge'](_0x46bf3a['where'],{'$or':_[_0x86c7('0x2d')](_0x46bf3a[_0x86c7('0x35')],function(_0x431f77){var _0x141d66={};_0x141d66[_0x431f77]={'$like':'%'+_0x420bc3[_0x86c7('0x33')][_0x86c7('0x3c')]+'%'};return _0x141d66;})});}_0x46bf3a=_[_0x86c7('0x3f')]({},_0x46bf3a,_0x420bc3['options']);return _0x3e15d4['getDescriptions'](_0x46bf3a);}})['then'](function(_0xbba91b){if(_0xbba91b){_0x3fd805=_0xbba91b[_0x86c7('0x37')];if(!_0x420bc3[_0x86c7('0x33')][_0x86c7('0x38')](_0x86c7('0x39'))){_0x46bf3a['limit']=qs[_0x86c7('0x1f')](_0x420bc3[_0x86c7('0x33')][_0x86c7('0x1f')]);_0x46bf3a[_0x86c7('0x1d')]=qs[_0x86c7('0x1d')](_0x420bc3['query'][_0x86c7('0x1d')]);}return _0x3e15d4['getDescriptions'](_0x46bf3a);}})['then'](function(_0x42c68f){if(_0x42c68f){return _0x42c68f?{'count':_0x3fd805,'rows':_0x42c68f}:null;}})['then'](respondWithResult(_0x294d83,null))['catch'](handleError(_0x294d83,null));}; \ No newline at end of file +var _0xe721=['save','update','destroy','error','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','then','includeAll','include','rows','show','params','length','find','catch','create','body','findOne','ServicenowField','getFields','pick','options','getSubjects','getDescriptions','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0xe721,0xcc));var _0x1e72=function(_0x30aa4d,_0x2b360f){_0x30aa4d=_0x30aa4d-0x0;var _0x16fc87=_0xe721[_0x30aa4d];return _0x16fc87;};'use strict';var emlformat=require(_0x1e72('0x0'));var rimraf=require(_0x1e72('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1e72('0x2'));var moment=require('moment');var BPromise=require(_0x1e72('0x3'));var Mustache=require(_0x1e72('0x4'));var util=require(_0x1e72('0x5'));var path=require(_0x1e72('0x6'));var sox=require(_0x1e72('0x7'));var csv=require(_0x1e72('0x8'));var ejs=require(_0x1e72('0x9'));var fs=require('fs');var fs_extra=require(_0x1e72('0xa'));var _=require(_0x1e72('0xb'));var squel=require('squel');var crypto=require(_0x1e72('0xc'));var jsforce=require(_0x1e72('0xd'));var deskjs=require(_0x1e72('0xe'));var toCsv=require(_0x1e72('0x8'));var querystring=require(_0x1e72('0xf'));var Papa=require(_0x1e72('0x10'));var Redis=require(_0x1e72('0x11'));var authService=require(_0x1e72('0x12'));var qs=require(_0x1e72('0x13'));var as=require(_0x1e72('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e72('0x15'));var utils=require(_0x1e72('0x16'));var config=require(_0x1e72('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e72('0x18'))['db'];function respondWithStatusCode(_0x58c4e3,_0x23be15){_0x23be15=_0x23be15||0xcc;return function(_0x37db60){if(_0x37db60){return _0x58c4e3[_0x1e72('0x19')](_0x23be15);}return _0x58c4e3[_0x1e72('0x1a')](_0x23be15)[_0x1e72('0x1b')]();};}function respondWithResult(_0x5cc8a6,_0x12d044){_0x12d044=_0x12d044||0xc8;return function(_0x2dca04){if(_0x2dca04){return _0x5cc8a6['status'](_0x12d044)[_0x1e72('0x1c')](_0x2dca04);}};}function respondWithFilteredResult(_0xd43fd8,_0x3fca80){return function(_0x32fd42){if(_0x32fd42){var _0x289bc2=typeof _0x3fca80[_0x1e72('0x1d')]===_0x1e72('0x1e')&&typeof _0x3fca80[_0x1e72('0x1f')]==='undefined';var _0x26465e=_0x32fd42[_0x1e72('0x20')];var _0x50416f=_0x289bc2?0x0:_0x3fca80[_0x1e72('0x1d')];var _0x3fb837=_0x289bc2?_0x32fd42['count']:_0x3fca80[_0x1e72('0x1d')]+_0x3fca80[_0x1e72('0x1f')];var _0x16f53f;if(_0x3fb837>=_0x26465e){_0x3fb837=_0x26465e;_0x16f53f=0xc8;}else{_0x16f53f=0xce;}_0xd43fd8[_0x1e72('0x1a')](_0x16f53f);return _0xd43fd8[_0x1e72('0x21')]('Content-Range',_0x50416f+'-'+_0x3fb837+'/'+_0x26465e)[_0x1e72('0x1c')](_0x32fd42);}return null;};}function patchUpdates(_0x4a3d5f){return function(_0xe81b37){try{jsonpatch[_0x1e72('0x22')](_0xe81b37,_0x4a3d5f,!![]);}catch(_0x26c12a){return BPromise[_0x1e72('0x23')](_0x26c12a);}return _0xe81b37[_0x1e72('0x24')]();};}function saveUpdates(_0x4e0dff,_0x238050){return function(_0x3ef3d5){if(_0x3ef3d5){return _0x3ef3d5[_0x1e72('0x25')](_0x4e0dff)['then'](function(_0x1c49f0){return _0x1c49f0;});}return null;};}function removeEntity(_0x5558d6,_0x2e78e9){return function(_0xacfdc7){if(_0xacfdc7){return _0xacfdc7[_0x1e72('0x26')]()['then'](function(){_0x5558d6[_0x1e72('0x1a')](0xcc)[_0x1e72('0x1b')]();});}};}function handleEntityNotFound(_0x419fae,_0x206088){return function(_0x2be2e7){if(!_0x2be2e7){_0x419fae['sendStatus'](0x194);}return _0x2be2e7;};}function handleError(_0x5385af,_0x1ce27e){_0x1ce27e=_0x1ce27e||0x1f4;return function(_0x4c6c7e){logger[_0x1e72('0x27')](_0x4c6c7e['stack']);if(_0x4c6c7e[_0x1e72('0x28')]){delete _0x4c6c7e['name'];}_0x5385af['status'](_0x1ce27e)['send'](_0x4c6c7e);};}exports[_0x1e72('0x29')]=function(_0x4bafaa,_0x25f464){var _0x25e213={},_0x971971={},_0x1fdc9b={'count':0x0,'rows':[]};var _0x29436d=_[_0x1e72('0x2a')](db[_0x1e72('0x2b')][_0x1e72('0x2c')],function(_0x430520){return{'name':_0x430520[_0x1e72('0x2d')],'type':_0x430520['type']['key']};});_0x971971[_0x1e72('0x2e')]=_[_0x1e72('0x2a')](_0x29436d,_0x1e72('0x28'));_0x971971[_0x1e72('0x2f')]=_[_0x1e72('0x30')](_0x4bafaa[_0x1e72('0x2f')]);_0x971971[_0x1e72('0x31')]=_[_0x1e72('0x32')](_0x971971[_0x1e72('0x2e')],_0x971971[_0x1e72('0x2f')]);_0x25e213[_0x1e72('0x33')]=_[_0x1e72('0x32')](_0x971971[_0x1e72('0x2e')],qs['fields'](_0x4bafaa[_0x1e72('0x2f')][_0x1e72('0x34')]));_0x25e213[_0x1e72('0x33')]=_0x25e213[_0x1e72('0x33')]['length']?_0x25e213[_0x1e72('0x33')]:_0x971971['model'];if(!_0x4bafaa[_0x1e72('0x2f')][_0x1e72('0x35')](_0x1e72('0x36'))){_0x25e213[_0x1e72('0x1f')]=qs[_0x1e72('0x1f')](_0x4bafaa['query'][_0x1e72('0x1f')]);_0x25e213['offset']=qs[_0x1e72('0x1d')](_0x4bafaa['query'][_0x1e72('0x1d')]);}_0x25e213[_0x1e72('0x37')]=qs[_0x1e72('0x38')](_0x4bafaa['query'][_0x1e72('0x38')]);_0x25e213[_0x1e72('0x39')]=qs[_0x1e72('0x31')](_['pick'](_0x4bafaa[_0x1e72('0x2f')],_0x971971['filters']),_0x29436d);if(_0x4bafaa[_0x1e72('0x2f')][_0x1e72('0x3a')]){_0x25e213[_0x1e72('0x39')]=_[_0x1e72('0x3b')](_0x25e213['where'],{'$or':_[_0x1e72('0x2a')](_0x29436d,function(_0x1af83c){if(_0x1af83c[_0x1e72('0x3c')]!==_0x1e72('0x3d')){var _0x2c0336={};_0x2c0336[_0x1af83c['name']]={'$like':'%'+_0x4bafaa[_0x1e72('0x2f')][_0x1e72('0x3a')]+'%'};return _0x2c0336;}})});}_0x25e213=_[_0x1e72('0x3b')]({},_0x25e213,_0x4bafaa['options']);var _0x9288f4={'where':_0x25e213['where']};return db[_0x1e72('0x2b')][_0x1e72('0x20')](_0x9288f4)[_0x1e72('0x3e')](function(_0x4f1e23){_0x1fdc9b[_0x1e72('0x20')]=_0x4f1e23;if(_0x4bafaa['query'][_0x1e72('0x3f')]){_0x25e213[_0x1e72('0x40')]=[{'all':!![]}];}return db[_0x1e72('0x2b')]['findAll'](_0x25e213);})['then'](function(_0x35aeea){_0x1fdc9b[_0x1e72('0x41')]=_0x35aeea;return _0x1fdc9b;})[_0x1e72('0x3e')](respondWithFilteredResult(_0x25f464,_0x25e213))['catch'](handleError(_0x25f464,null));};exports[_0x1e72('0x42')]=function(_0x59ff5b,_0x4cf477){var _0x5aed24={'raw':![],'where':{'id':_0x59ff5b[_0x1e72('0x43')]['id']}},_0x146467={};_0x146467[_0x1e72('0x2e')]=_[_0x1e72('0x30')](db[_0x1e72('0x2b')][_0x1e72('0x2c')]);_0x146467['query']=_[_0x1e72('0x30')](_0x59ff5b[_0x1e72('0x2f')]);_0x146467[_0x1e72('0x31')]=_[_0x1e72('0x32')](_0x146467[_0x1e72('0x2e')],_0x146467['query']);_0x5aed24[_0x1e72('0x33')]=_['intersection'](_0x146467[_0x1e72('0x2e')],qs[_0x1e72('0x34')](_0x59ff5b[_0x1e72('0x2f')][_0x1e72('0x34')]));_0x5aed24[_0x1e72('0x33')]=_0x5aed24[_0x1e72('0x33')][_0x1e72('0x44')]?_0x5aed24['attributes']:_0x146467['model'];if(_0x59ff5b[_0x1e72('0x2f')]['includeAll']){_0x5aed24[_0x1e72('0x40')]=[{'all':!![]}];}_0x5aed24=_[_0x1e72('0x3b')]({},_0x5aed24,_0x59ff5b['options']);return db[_0x1e72('0x2b')][_0x1e72('0x45')](_0x5aed24)[_0x1e72('0x3e')](handleEntityNotFound(_0x4cf477,null))[_0x1e72('0x3e')](respondWithResult(_0x4cf477,null))[_0x1e72('0x46')](handleError(_0x4cf477,null));};exports[_0x1e72('0x47')]=function(_0x31173d,_0x15b387){return db[_0x1e72('0x2b')]['create'](_0x31173d[_0x1e72('0x48')],{})['then'](respondWithResult(_0x15b387,0xc9))[_0x1e72('0x46')](handleError(_0x15b387,null));};exports[_0x1e72('0x25')]=function(_0x24818b,_0x3c0226){if(_0x24818b['body']['id']){delete _0x24818b[_0x1e72('0x48')]['id'];}return db[_0x1e72('0x2b')][_0x1e72('0x45')]({'where':{'id':_0x24818b[_0x1e72('0x43')]['id']}})[_0x1e72('0x3e')](handleEntityNotFound(_0x3c0226,null))[_0x1e72('0x3e')](saveUpdates(_0x24818b[_0x1e72('0x48')],null))[_0x1e72('0x3e')](respondWithResult(_0x3c0226,null))['catch'](handleError(_0x3c0226,null));};exports[_0x1e72('0x26')]=function(_0x4d3d59,_0x41ffba){return db[_0x1e72('0x2b')][_0x1e72('0x45')]({'where':{'id':_0x4d3d59['params']['id']}})[_0x1e72('0x3e')](handleEntityNotFound(_0x41ffba,null))['then'](removeEntity(_0x41ffba,null))[_0x1e72('0x46')](handleError(_0x41ffba,null));};exports['getFields']=function(_0x2dbf71,_0x27908e,_0x1b5eaf){var _0x57e1a0={};var _0x24e3b3={};var _0x16a047;var _0x32edc4;return db['ServicenowConfiguration'][_0x1e72('0x49')]({'where':{'id':_0x2dbf71[_0x1e72('0x43')]['id']}})[_0x1e72('0x3e')](handleEntityNotFound(_0x27908e,null))[_0x1e72('0x3e')](function(_0x222604){if(_0x222604){_0x16a047=_0x222604;_0x24e3b3[_0x1e72('0x2e')]=_[_0x1e72('0x30')](db[_0x1e72('0x4a')][_0x1e72('0x2c')]);_0x24e3b3[_0x1e72('0x2f')]=_['keys'](_0x2dbf71[_0x1e72('0x2f')]);_0x24e3b3[_0x1e72('0x31')]=_['intersection'](_0x24e3b3[_0x1e72('0x2e')],_0x24e3b3['query']);_0x57e1a0[_0x1e72('0x33')]=_[_0x1e72('0x32')](_0x24e3b3['model'],qs['fields'](_0x2dbf71['query']['fields']));_0x57e1a0[_0x1e72('0x33')]=_0x57e1a0[_0x1e72('0x33')][_0x1e72('0x44')]?_0x57e1a0['attributes']:_0x24e3b3['model'];_0x57e1a0[_0x1e72('0x37')]=qs[_0x1e72('0x38')](_0x2dbf71[_0x1e72('0x2f')][_0x1e72('0x38')]);_0x57e1a0['where']=qs[_0x1e72('0x31')](_['pick'](_0x2dbf71[_0x1e72('0x2f')],_0x24e3b3[_0x1e72('0x31')]));if(_0x2dbf71[_0x1e72('0x2f')][_0x1e72('0x3a')]){_0x57e1a0['where']=_[_0x1e72('0x3b')](_0x57e1a0[_0x1e72('0x39')],{'$or':_[_0x1e72('0x2a')](_0x57e1a0[_0x1e72('0x33')],function(_0xeb6cac){var _0x27f867={};_0x27f867[_0xeb6cac]={'$like':'%'+_0x2dbf71['query'][_0x1e72('0x3a')]+'%'};return _0x27f867;})});}_0x57e1a0=_[_0x1e72('0x3b')]({},_0x57e1a0,_0x2dbf71['options']);return _0x16a047[_0x1e72('0x4b')](_0x57e1a0);}})[_0x1e72('0x3e')](function(_0x49d157){if(_0x49d157){_0x32edc4=_0x49d157['length'];if(!_0x2dbf71[_0x1e72('0x2f')]['hasOwnProperty'](_0x1e72('0x36'))){_0x57e1a0[_0x1e72('0x1f')]=qs[_0x1e72('0x1f')](_0x2dbf71[_0x1e72('0x2f')][_0x1e72('0x1f')]);_0x57e1a0[_0x1e72('0x1d')]=qs[_0x1e72('0x1d')](_0x2dbf71[_0x1e72('0x2f')][_0x1e72('0x1d')]);}return _0x16a047[_0x1e72('0x4b')](_0x57e1a0);}})['then'](function(_0x15d837){if(_0x15d837){return _0x15d837?{'count':_0x32edc4,'rows':_0x15d837}:null;}})[_0x1e72('0x3e')](respondWithResult(_0x27908e,null))[_0x1e72('0x46')](handleError(_0x27908e,null));};exports['getSubjects']=function(_0x188705,_0x3a36d6,_0x524f8e){var _0x103719={};var _0x3019cb={};var _0x243540;var _0x251a6d;return db[_0x1e72('0x2b')][_0x1e72('0x49')]({'where':{'id':_0x188705[_0x1e72('0x43')]['id']}})[_0x1e72('0x3e')](handleEntityNotFound(_0x3a36d6,null))['then'](function(_0xadbd27){if(_0xadbd27){_0x243540=_0xadbd27;_0x3019cb[_0x1e72('0x2e')]=_[_0x1e72('0x30')](db['ServicenowField'][_0x1e72('0x2c')]);_0x3019cb[_0x1e72('0x2f')]=_[_0x1e72('0x30')](_0x188705[_0x1e72('0x2f')]);_0x3019cb[_0x1e72('0x31')]=_[_0x1e72('0x32')](_0x3019cb[_0x1e72('0x2e')],_0x3019cb[_0x1e72('0x2f')]);_0x103719[_0x1e72('0x33')]=_[_0x1e72('0x32')](_0x3019cb[_0x1e72('0x2e')],qs['fields'](_0x188705[_0x1e72('0x2f')][_0x1e72('0x34')]));_0x103719[_0x1e72('0x33')]=_0x103719[_0x1e72('0x33')][_0x1e72('0x44')]?_0x103719[_0x1e72('0x33')]:_0x3019cb[_0x1e72('0x2e')];_0x103719[_0x1e72('0x37')]=qs[_0x1e72('0x38')](_0x188705[_0x1e72('0x2f')]['sort']);_0x103719['where']=qs['filters'](_[_0x1e72('0x4c')](_0x188705[_0x1e72('0x2f')],_0x3019cb[_0x1e72('0x31')]));if(_0x188705['query']['filter']){_0x103719[_0x1e72('0x39')]=_[_0x1e72('0x3b')](_0x103719[_0x1e72('0x39')],{'$or':_['map'](_0x103719[_0x1e72('0x33')],function(_0x1a750a){var _0xc83e77={};_0xc83e77[_0x1a750a]={'$like':'%'+_0x188705[_0x1e72('0x2f')][_0x1e72('0x3a')]+'%'};return _0xc83e77;})});}_0x103719=_[_0x1e72('0x3b')]({},_0x103719,_0x188705[_0x1e72('0x4d')]);return _0x243540['getSubjects'](_0x103719);}})[_0x1e72('0x3e')](function(_0xc05ba4){if(_0xc05ba4){_0x251a6d=_0xc05ba4[_0x1e72('0x44')];if(!_0x188705[_0x1e72('0x2f')][_0x1e72('0x35')]('nolimit')){_0x103719[_0x1e72('0x1f')]=qs[_0x1e72('0x1f')](_0x188705[_0x1e72('0x2f')][_0x1e72('0x1f')]);_0x103719[_0x1e72('0x1d')]=qs[_0x1e72('0x1d')](_0x188705['query'][_0x1e72('0x1d')]);}return _0x243540[_0x1e72('0x4e')](_0x103719);}})[_0x1e72('0x3e')](function(_0x23afbc){if(_0x23afbc){return _0x23afbc?{'count':_0x251a6d,'rows':_0x23afbc}:null;}})[_0x1e72('0x3e')](respondWithResult(_0x3a36d6,null))[_0x1e72('0x46')](handleError(_0x3a36d6,null));};exports[_0x1e72('0x4f')]=function(_0x21c771,_0x4d1301,_0x437e4e){var _0x33eb85={};var _0x514247={};var _0x2472cf;var _0x18cd9b;return db[_0x1e72('0x2b')][_0x1e72('0x49')]({'where':{'id':_0x21c771['params']['id']}})[_0x1e72('0x3e')](handleEntityNotFound(_0x4d1301,null))['then'](function(_0x3039b1){if(_0x3039b1){_0x2472cf=_0x3039b1;_0x514247[_0x1e72('0x2e')]=_[_0x1e72('0x30')](db[_0x1e72('0x4a')][_0x1e72('0x2c')]);_0x514247['query']=_[_0x1e72('0x30')](_0x21c771[_0x1e72('0x2f')]);_0x514247['filters']=_['intersection'](_0x514247[_0x1e72('0x2e')],_0x514247[_0x1e72('0x2f')]);_0x33eb85[_0x1e72('0x33')]=_['intersection'](_0x514247[_0x1e72('0x2e')],qs[_0x1e72('0x34')](_0x21c771[_0x1e72('0x2f')][_0x1e72('0x34')]));_0x33eb85[_0x1e72('0x33')]=_0x33eb85['attributes'][_0x1e72('0x44')]?_0x33eb85[_0x1e72('0x33')]:_0x514247[_0x1e72('0x2e')];_0x33eb85['order']=qs['sort'](_0x21c771[_0x1e72('0x2f')][_0x1e72('0x38')]);_0x33eb85['where']=qs[_0x1e72('0x31')](_[_0x1e72('0x4c')](_0x21c771[_0x1e72('0x2f')],_0x514247[_0x1e72('0x31')]));if(_0x21c771[_0x1e72('0x2f')][_0x1e72('0x3a')]){_0x33eb85[_0x1e72('0x39')]=_[_0x1e72('0x3b')](_0x33eb85['where'],{'$or':_[_0x1e72('0x2a')](_0x33eb85['attributes'],function(_0x1efa1a){var _0x3c4f43={};_0x3c4f43[_0x1efa1a]={'$like':'%'+_0x21c771['query'][_0x1e72('0x3a')]+'%'};return _0x3c4f43;})});}_0x33eb85=_[_0x1e72('0x3b')]({},_0x33eb85,_0x21c771[_0x1e72('0x4d')]);return _0x2472cf[_0x1e72('0x4f')](_0x33eb85);}})[_0x1e72('0x3e')](function(_0x1fc349){if(_0x1fc349){_0x18cd9b=_0x1fc349[_0x1e72('0x44')];if(!_0x21c771[_0x1e72('0x2f')]['hasOwnProperty'](_0x1e72('0x36'))){_0x33eb85[_0x1e72('0x1f')]=qs[_0x1e72('0x1f')](_0x21c771[_0x1e72('0x2f')][_0x1e72('0x1f')]);_0x33eb85[_0x1e72('0x1d')]=qs['offset'](_0x21c771[_0x1e72('0x2f')]['offset']);}return _0x2472cf[_0x1e72('0x4f')](_0x33eb85);}})[_0x1e72('0x3e')](function(_0x3aac62){if(_0x3aac62){return _0x3aac62?{'count':_0x18cd9b,'rows':_0x3aac62}:null;}})[_0x1e72('0x3e')](respondWithResult(_0x4d1301,null))['catch'](handleError(_0x4d1301,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7fa86b8..ba9536c 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 _0xd052=['int_servicenow_configurations','../../config/logger','moment','path','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x446bcf,_0x2220fe){var _0x2f7d88=function(_0x21273c){while(--_0x21273c){_0x446bcf['push'](_0x446bcf['shift']());}};_0x2f7d88(++_0x2220fe);}(_0xd052,0x69));var _0x2d05=function(_0xc7fbc0,_0x41c0be){_0xc7fbc0=_0xc7fbc0-0x0;var _0x21c34c=_0xd052[_0xc7fbc0];return _0x21c34c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d05('0x0'))('api');var moment=require(_0x2d05('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d05('0x2'));var rimraf=require('rimraf');var config=require(_0x2d05('0x3'));var attributes=require(_0x2d05('0x4'));module['exports']=function(_0x380979,_0x15de1f){return _0x380979[_0x2d05('0x5')](_0x2d05('0x6'),attributes,{'tableName':_0x2d05('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081e=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','lodash','util','api'];(function(_0x14470a,_0x40dd37){var _0x536f47=function(_0x4fc8a0){while(--_0x4fc8a0){_0x14470a['push'](_0x14470a['shift']());}};_0x536f47(++_0x40dd37);}(_0x081e,0xc5));var _0xe081=function(_0x22123d,_0x45ae06){_0x22123d=_0x22123d-0x0;var _0xeabce1=_0x081e[_0x22123d];return _0xeabce1;};'use strict';var _=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var logger=require('../../config/logger')(_0xe081('0x2'));var moment=require('moment');var BPromise=require(_0xe081('0x3'));var rp=require(_0xe081('0x4'));var fs=require('fs');var path=require(_0xe081('0x5'));var rimraf=require(_0xe081('0x6'));var config=require(_0xe081('0x7'));var attributes=require(_0xe081('0x8'));module[_0xe081('0x9')]=function(_0x50d6cb,_0x2271b4){return _0x50d6cb['define']('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','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 f9d87a9..330f94c 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 _0x4990=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x3cab38,_0x439e61){var _0x187d60=function(_0x285a14){while(--_0x285a14){_0x3cab38['push'](_0x3cab38['shift']());}};_0x187d60(++_0x439e61);}(_0x4990,0xfe));var _0x0499=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x4990[_0x474d97];return _0x1edf25;};'use strict';var _=require(_0x0499('0x0'));var util=require('util');var moment=require(_0x0499('0x1'));var BPromise=require(_0x0499('0x2'));var rs=require(_0x0499('0x3'));var fs=require('fs');var Redis=require(_0x0499('0x4'));var db=require(_0x0499('0x5'))['db'];var utils=require(_0x0499('0x6'));var logger=require(_0x0499('0x7'))(_0x0499('0x8'));var config=require(_0x0499('0x9'));var jayson=require(_0x0499('0xa'));var client=jayson[_0x0499('0xb')][_0x0499('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b0811,_0x39969a,_0xd9a54f){return new BPromise(function(_0x3f2bc0,_0x364808){return client[_0x0499('0xd')](_0x4b0811,_0xd9a54f)[_0x0499('0xe')](function(_0x1c7803){logger[_0x0499('0xf')](_0x0499('0x10'),_0x39969a,_0x0499('0x11'));logger[_0x0499('0x12')](_0x0499('0x13'),_0x39969a,_0x0499('0x11'),JSON['stringify'](_0x1c7803));if(_0x1c7803[_0x0499('0x14')]){if(_0x1c7803[_0x0499('0x14')][_0x0499('0x15')]===0x1f4){logger[_0x0499('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x39969a,_0x1c7803[_0x0499('0x14')]['message']);return _0x364808(_0x1c7803[_0x0499('0x14')][_0x0499('0x16')]);}logger[_0x0499('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x39969a,_0x1c7803['error'][_0x0499('0x16')]);return _0x3f2bc0(_0x1c7803[_0x0499('0x14')][_0x0499('0x16')]);}else{logger[_0x0499('0xf')](_0x0499('0x10'),_0x39969a,_0x0499('0x11'));_0x3f2bc0(_0x1c7803[_0x0499('0x17')][_0x0499('0x16')]);}})[_0x0499('0x18')](function(_0xd4d142){logger[_0x0499('0x14')](_0x0499('0x10'),_0x39969a,_0xd4d142);_0x364808(_0xd4d142);});});} \ No newline at end of file +var _0xad68=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0xad68,0x100));var _0x8ad6=function(_0x4f964a,_0x41f80b){_0x4f964a=_0x4f964a-0x0;var _0x22142b=_0xad68[_0x4f964a];return _0x22142b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ad6('0x0'));var BPromise=require(_0x8ad6('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad6('0x2'))['db'];var utils=require(_0x8ad6('0x3'));var logger=require(_0x8ad6('0x4'))(_0x8ad6('0x5'));var config=require(_0x8ad6('0x6'));var jayson=require(_0x8ad6('0x7'));var client=jayson[_0x8ad6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144a85,_0x1ca47f,_0x3e009f){return new BPromise(function(_0x46ba71,_0x2680e5){return client['request'](_0x144a85,_0x3e009f)['then'](function(_0xe8b4bd){logger[_0x8ad6('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1ca47f,'request\x20sent');logger[_0x8ad6('0xa')](_0x8ad6('0xb'),_0x1ca47f,_0x8ad6('0xc'),JSON[_0x8ad6('0xd')](_0xe8b4bd));if(_0xe8b4bd[_0x8ad6('0xe')]){if(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0xf')]===0x1f4){logger[_0x8ad6('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x1ca47f,_0xe8b4bd[_0x8ad6('0xe')]['message']);return _0x2680e5(_0xe8b4bd['error'][_0x8ad6('0x10')]);}logger['error'](_0x8ad6('0x11'),_0x1ca47f,_0xe8b4bd['error'][_0x8ad6('0x10')]);return _0x46ba71(_0xe8b4bd[_0x8ad6('0xe')][_0x8ad6('0x10')]);}else{logger['info'](_0x8ad6('0x11'),_0x1ca47f,_0x8ad6('0xc'));_0x46ba71(_0xe8b4bd[_0x8ad6('0x12')][_0x8ad6('0x10')]);}})[_0x8ad6('0x13')](function(_0xb7e3e2){logger[_0x8ad6('0xe')](_0x8ad6('0x11'),_0x1ca47f,_0xb7e3e2);_0x2680e5(_0xb7e3e2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e5afd48..4193620 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 _0x8770=['destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x8770,0xb2));var _0x0877=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8770[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0877('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0877('0x1'));var router=express['Router']();var fs_extra=require(_0x0877('0x2'));var auth=require(_0x0877('0x3'));var interaction=require(_0x0877('0x4'));var config=require(_0x0877('0x5'));var controller=require('./intServicenowField.controller');router[_0x0877('0x6')]('/',auth[_0x0877('0x7')](),controller[_0x0877('0x8')]);router[_0x0877('0x6')](_0x0877('0x9'),auth['isAuthenticated'](),controller[_0x0877('0xa')]);router['post']('/',auth[_0x0877('0x7')](),controller[_0x0877('0xb')]);router[_0x0877('0xc')](_0x0877('0x9'),auth[_0x0877('0x7')](),controller[_0x0877('0xd')]);router['delete'](_0x0877('0x9'),auth[_0x0877('0x7')](),controller[_0x0877('0xe')]);module[_0x0877('0xf')]=router; \ No newline at end of file +var _0x87de=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x36b898,_0x14c87c){var _0x2bff0f=function(_0x5156ab){while(--_0x5156ab){_0x36b898['push'](_0x36b898['shift']());}};_0x2bff0f(++_0x14c87c);}(_0x87de,0x118));var _0xe87d=function(_0x3ec680,_0x5522e2){_0x3ec680=_0x3ec680-0x0;var _0x1a59d4=_0x87de[_0x3ec680];return _0x1a59d4;};'use strict';var multer=require(_0xe87d('0x0'));var util=require(_0xe87d('0x1'));var path=require(_0xe87d('0x2'));var timeout=require(_0xe87d('0x3'));var express=require(_0xe87d('0x4'));var router=express[_0xe87d('0x5')]();var fs_extra=require(_0xe87d('0x6'));var auth=require(_0xe87d('0x7'));var interaction=require(_0xe87d('0x8'));var config=require(_0xe87d('0x9'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xe87d('0xa')](),controller[_0xe87d('0xb')]);router['get'](_0xe87d('0xc'),auth['isAuthenticated'](),controller[_0xe87d('0xd')]);router[_0xe87d('0xe')]('/',auth[_0xe87d('0xa')](),controller['create']);router['put'](_0xe87d('0xc'),auth['isAuthenticated'](),controller[_0xe87d('0xf')]);router[_0xe87d('0x10')](_0xe87d('0xc'),auth[_0xe87d('0xa')](),controller[_0xe87d('0x11')]);module[_0xe87d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 50a7d1b..2c18a01 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 _0xdae4=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdae4,0x7e));var _0x4dae=function(_0x344605,_0x2aa243){_0x344605=_0x344605-0x0;var _0x23228b=_0xdae4[_0x344605];return _0x23228b;};'use strict';var Sequelize=require(_0x4dae('0x0'));module[_0x4dae('0x1')]={'type':{'type':Sequelize[_0x4dae('0x2')](_0x4dae('0x3'),'variable',_0x4dae('0x4'),_0x4dae('0x5'),'picklist'),'defaultValue':_0x4dae('0x3')},'content':{'type':Sequelize[_0x4dae('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4dae('0x2')](_0x4dae('0x3'),_0x4dae('0x7'),_0x4dae('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4dae('0x6')]},'customField':{'type':Sequelize[_0x4dae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4dae('0x6')]}}; \ No newline at end of file +var _0x89dc=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x89dc,0xc9));var _0xc89d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x89dc[_0xa1e3e3];return _0xc980e9;};'use strict';var Sequelize=require(_0xc89d('0x0'));module[_0xc89d('0x1')]={'type':{'type':Sequelize[_0xc89d('0x2')](_0xc89d('0x3'),_0xc89d('0x4'),_0xc89d('0x5'),_0xc89d('0x6'),_0xc89d('0x7')),'defaultValue':_0xc89d('0x3')},'content':{'type':Sequelize[_0xc89d('0x8')]},'key':{'type':Sequelize[_0xc89d('0x8')]},'keyType':{'type':Sequelize[_0xc89d('0x2')](_0xc89d('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc89d('0x8')]},'idField':{'type':Sequelize[_0xc89d('0x8')]},'nameField':{'type':Sequelize[_0xc89d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1ef7297..915f07e 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 _0xa878=['body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','ServicenowField','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','fields','include','find','create'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xa878,0x85));var _0x8a87=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa878[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a87('0x0'));var zipdir=require(_0x8a87('0x1'));var jsonpatch=require(_0x8a87('0x2'));var rp=require(_0x8a87('0x3'));var moment=require(_0x8a87('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8a87('0x5'));var path=require('path');var sox=require(_0x8a87('0x6'));var csv=require('to-csv');var ejs=require(_0x8a87('0x7'));var fs=require('fs');var fs_extra=require(_0x8a87('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a87('0x9'));var toCsv=require(_0x8a87('0xa'));var querystring=require('querystring');var Papa=require(_0x8a87('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8a87('0xc'));var as=require(_0x8a87('0xd'));var hardwareService=require(_0x8a87('0xe'));var logger=require('../../config/logger')(_0x8a87('0xf'));var utils=require(_0x8a87('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x8a87('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc1cc5b,_0x132ee4){_0x132ee4=_0x132ee4||0xcc;return function(_0x39d392){if(_0x39d392){return _0xc1cc5b[_0x8a87('0x12')](_0x132ee4);}return _0xc1cc5b[_0x8a87('0x13')](_0x132ee4)[_0x8a87('0x14')]();};}function respondWithResult(_0x3b90d9,_0x2c7c00){_0x2c7c00=_0x2c7c00||0xc8;return function(_0x149d62){if(_0x149d62){return _0x3b90d9['status'](_0x2c7c00)[_0x8a87('0x15')](_0x149d62);}};}function respondWithFilteredResult(_0x75cdb7,_0x4c5403){return function(_0x8b5962){if(_0x8b5962){var _0x1f1fc0=typeof _0x4c5403[_0x8a87('0x16')]===_0x8a87('0x17')&&typeof _0x4c5403[_0x8a87('0x18')]===_0x8a87('0x17');var _0x105faa=_0x8b5962[_0x8a87('0x19')];var _0x3c8a64=_0x1f1fc0?0x0:_0x4c5403[_0x8a87('0x16')];var _0x1391b6=_0x1f1fc0?_0x8b5962['count']:_0x4c5403[_0x8a87('0x16')]+_0x4c5403['limit'];var _0x3af81c;if(_0x1391b6>=_0x105faa){_0x1391b6=_0x105faa;_0x3af81c=0xc8;}else{_0x3af81c=0xce;}_0x75cdb7['status'](_0x3af81c);return _0x75cdb7['set'](_0x8a87('0x1a'),_0x3c8a64+'-'+_0x1391b6+'/'+_0x105faa)[_0x8a87('0x15')](_0x8b5962);}return null;};}function patchUpdates(_0x2d685e){return function(_0x4e43bf){try{jsonpatch[_0x8a87('0x1b')](_0x4e43bf,_0x2d685e,!![]);}catch(_0x573224){return BPromise[_0x8a87('0x1c')](_0x573224);}return _0x4e43bf[_0x8a87('0x1d')]();};}function saveUpdates(_0x13e0b9,_0x5a42e0){return function(_0x409ded){if(_0x409ded){return _0x409ded[_0x8a87('0x1e')](_0x13e0b9)[_0x8a87('0x1f')](function(_0x205ff5){return _0x205ff5;});}return null;};}function removeEntity(_0x28cfa0,_0xb8838){return function(_0x50f2b4){if(_0x50f2b4){return _0x50f2b4[_0x8a87('0x20')]()[_0x8a87('0x1f')](function(){_0x28cfa0[_0x8a87('0x13')](0xcc)[_0x8a87('0x14')]();});}};}function handleEntityNotFound(_0x2bf7dc,_0x2bf05b){return function(_0x507508){if(!_0x507508){_0x2bf7dc[_0x8a87('0x12')](0x194);}return _0x507508;};}function handleError(_0x4f58e5,_0x39b433){_0x39b433=_0x39b433||0x1f4;return function(_0x23c93e){logger[_0x8a87('0x21')](_0x23c93e[_0x8a87('0x22')]);if(_0x23c93e['name']){delete _0x23c93e[_0x8a87('0x23')];}_0x4f58e5[_0x8a87('0x13')](_0x39b433)['send'](_0x23c93e);};}exports['index']=function(_0x45ae46,_0x46b824){var _0x8ec995={},_0x4e702b={},_0x1cf27b={'count':0x0,'rows':[]};var _0x180f3f=_['map'](db[_0x8a87('0x24')]['rawAttributes'],function(_0x149387){return{'name':_0x149387['fieldName'],'type':_0x149387[_0x8a87('0x25')][_0x8a87('0x26')]};});_0x4e702b['model']=_['map'](_0x180f3f,'name');_0x4e702b[_0x8a87('0x27')]=_['keys'](_0x45ae46[_0x8a87('0x27')]);_0x4e702b[_0x8a87('0x28')]=_[_0x8a87('0x29')](_0x4e702b['model'],_0x4e702b[_0x8a87('0x27')]);_0x8ec995['attributes']=_[_0x8a87('0x29')](_0x4e702b[_0x8a87('0x2a')],qs['fields'](_0x45ae46['query']['fields']));_0x8ec995[_0x8a87('0x2b')]=_0x8ec995['attributes'][_0x8a87('0x2c')]?_0x8ec995[_0x8a87('0x2b')]:_0x4e702b[_0x8a87('0x2a')];if(!_0x45ae46[_0x8a87('0x27')][_0x8a87('0x2d')]('nolimit')){_0x8ec995[_0x8a87('0x18')]=qs[_0x8a87('0x18')](_0x45ae46[_0x8a87('0x27')][_0x8a87('0x18')]);_0x8ec995[_0x8a87('0x16')]=qs[_0x8a87('0x16')](_0x45ae46[_0x8a87('0x27')]['offset']);}_0x8ec995[_0x8a87('0x2e')]=qs[_0x8a87('0x2f')](_0x45ae46[_0x8a87('0x27')][_0x8a87('0x2f')]);_0x8ec995[_0x8a87('0x30')]=qs[_0x8a87('0x28')](_['pick'](_0x45ae46[_0x8a87('0x27')],_0x4e702b[_0x8a87('0x28')]),_0x180f3f);if(_0x45ae46[_0x8a87('0x27')][_0x8a87('0x31')]){_0x8ec995[_0x8a87('0x30')]=_['merge'](_0x8ec995[_0x8a87('0x30')],{'$or':_[_0x8a87('0x32')](_0x180f3f,function(_0x187e82){if(_0x187e82['type']!==_0x8a87('0x33')){var _0x26043e={};_0x26043e[_0x187e82[_0x8a87('0x23')]]={'$like':'%'+_0x45ae46['query'][_0x8a87('0x31')]+'%'};return _0x26043e;}})});}_0x8ec995=_[_0x8a87('0x34')]({},_0x8ec995,_0x45ae46[_0x8a87('0x35')]);var _0x40e43a={'where':_0x8ec995[_0x8a87('0x30')]};return db[_0x8a87('0x24')][_0x8a87('0x19')](_0x40e43a)[_0x8a87('0x1f')](function(_0x40353a){_0x1cf27b[_0x8a87('0x19')]=_0x40353a;if(_0x45ae46[_0x8a87('0x27')][_0x8a87('0x36')]){_0x8ec995['include']=[{'all':!![]}];}return db[_0x8a87('0x24')]['findAll'](_0x8ec995);})[_0x8a87('0x1f')](function(_0x1885d0){_0x1cf27b[_0x8a87('0x37')]=_0x1885d0;return _0x1cf27b;})[_0x8a87('0x1f')](respondWithFilteredResult(_0x46b824,_0x8ec995))[_0x8a87('0x38')](handleError(_0x46b824,null));};exports[_0x8a87('0x39')]=function(_0x166f31,_0x175f9f){var _0x424bc1={'raw':!![],'where':{'id':_0x166f31[_0x8a87('0x3a')]['id']}},_0x1ecb37={};_0x1ecb37[_0x8a87('0x2a')]=_[_0x8a87('0x3b')](db['ServicenowField'][_0x8a87('0x3c')]);_0x1ecb37[_0x8a87('0x27')]=_[_0x8a87('0x3b')](_0x166f31['query']);_0x1ecb37['filters']=_[_0x8a87('0x29')](_0x1ecb37[_0x8a87('0x2a')],_0x1ecb37['query']);_0x424bc1['attributes']=_['intersection'](_0x1ecb37[_0x8a87('0x2a')],qs['fields'](_0x166f31['query'][_0x8a87('0x3d')]));_0x424bc1['attributes']=_0x424bc1[_0x8a87('0x2b')][_0x8a87('0x2c')]?_0x424bc1[_0x8a87('0x2b')]:_0x1ecb37[_0x8a87('0x2a')];if(_0x166f31[_0x8a87('0x27')][_0x8a87('0x36')]){_0x424bc1[_0x8a87('0x3e')]=[{'all':!![]}];}_0x424bc1=_[_0x8a87('0x34')]({},_0x424bc1,_0x166f31[_0x8a87('0x35')]);return db[_0x8a87('0x24')][_0x8a87('0x3f')](_0x424bc1)[_0x8a87('0x1f')](handleEntityNotFound(_0x175f9f,null))['then'](respondWithResult(_0x175f9f,null))[_0x8a87('0x38')](handleError(_0x175f9f,null));};exports[_0x8a87('0x40')]=function(_0x1635dc,_0xe9d3c1){return db[_0x8a87('0x24')]['create'](_0x1635dc[_0x8a87('0x41')],{})['then'](respondWithResult(_0xe9d3c1,0xc9))[_0x8a87('0x38')](handleError(_0xe9d3c1,null));};exports[_0x8a87('0x1e')]=function(_0x11ca73,_0x50f3d7){if(_0x11ca73['body']['id']){delete _0x11ca73[_0x8a87('0x41')]['id'];}return db[_0x8a87('0x24')][_0x8a87('0x3f')]({'where':{'id':_0x11ca73[_0x8a87('0x3a')]['id']}})[_0x8a87('0x1f')](handleEntityNotFound(_0x50f3d7,null))[_0x8a87('0x1f')](saveUpdates(_0x11ca73[_0x8a87('0x41')],null))['then'](respondWithResult(_0x50f3d7,null))[_0x8a87('0x38')](handleError(_0x50f3d7,null));};exports[_0x8a87('0x20')]=function(_0x26fcf3,_0xfb6d09){return db[_0x8a87('0x24')][_0x8a87('0x3f')]({'where':{'id':_0x26fcf3[_0x8a87('0x3a')]['id']}})['then'](handleEntityNotFound(_0xfb6d09,null))[_0x8a87('0x1f')](removeEntity(_0xfb6d09,null))[_0x8a87('0x38')](handleError(_0xfb6d09,null));}; \ No newline at end of file +var _0xd767=['map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','update','then','end','error','stack','name','index'];(function(_0xe5b0a2,_0x4cf913){var _0x5b7cd3=function(_0x2cd773){while(--_0x2cd773){_0xe5b0a2['push'](_0xe5b0a2['shift']());}};_0x5b7cd3(++_0x4cf913);}(_0xd767,0xf4));var _0x7d76=function(_0x1b65f0,_0x2c5770){_0x1b65f0=_0x1b65f0-0x0;var _0x331699=_0xd767[_0x1b65f0];return _0x331699;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7d76('0x0'));var zipdir=require(_0x7d76('0x1'));var jsonpatch=require(_0x7d76('0x2'));var rp=require(_0x7d76('0x3'));var moment=require(_0x7d76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d76('0x5'));var util=require(_0x7d76('0x6'));var path=require('path');var sox=require(_0x7d76('0x7'));var csv=require(_0x7d76('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d76('0x9'));var squel=require(_0x7d76('0xa'));var crypto=require(_0x7d76('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7d76('0xc'));var toCsv=require(_0x7d76('0x8'));var querystring=require(_0x7d76('0xd'));var Papa=require(_0x7d76('0xe'));var Redis=require(_0x7d76('0xf'));var authService=require(_0x7d76('0x10'));var qs=require(_0x7d76('0x11'));var as=require(_0x7d76('0x12'));var hardwareService=require(_0x7d76('0x13'));var logger=require(_0x7d76('0x14'))(_0x7d76('0x15'));var utils=require('../../config/utils');var config=require(_0x7d76('0x16'));var licenseUtil=require(_0x7d76('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x500db5,_0x15dcb9){_0x15dcb9=_0x15dcb9||0xcc;return function(_0x3f917a){if(_0x3f917a){return _0x500db5[_0x7d76('0x18')](_0x15dcb9);}return _0x500db5[_0x7d76('0x19')](_0x15dcb9)['end']();};}function respondWithResult(_0x2331c4,_0x20029e){_0x20029e=_0x20029e||0xc8;return function(_0x1b944a){if(_0x1b944a){return _0x2331c4[_0x7d76('0x19')](_0x20029e)['json'](_0x1b944a);}};}function respondWithFilteredResult(_0x5ceac5,_0x2e7be5){return function(_0x318327){if(_0x318327){var _0xfb84aa=typeof _0x2e7be5[_0x7d76('0x1a')]===_0x7d76('0x1b')&&typeof _0x2e7be5[_0x7d76('0x1c')]===_0x7d76('0x1b');var _0xd82224=_0x318327[_0x7d76('0x1d')];var _0x5a0e99=_0xfb84aa?0x0:_0x2e7be5[_0x7d76('0x1a')];var _0x538b10=_0xfb84aa?_0x318327[_0x7d76('0x1d')]:_0x2e7be5['offset']+_0x2e7be5[_0x7d76('0x1c')];var _0x2d734a;if(_0x538b10>=_0xd82224){_0x538b10=_0xd82224;_0x2d734a=0xc8;}else{_0x2d734a=0xce;}_0x5ceac5['status'](_0x2d734a);return _0x5ceac5['set'](_0x7d76('0x1e'),_0x5a0e99+'-'+_0x538b10+'/'+_0xd82224)[_0x7d76('0x1f')](_0x318327);}return null;};}function patchUpdates(_0x5ca016){return function(_0x4dea4c){try{jsonpatch[_0x7d76('0x20')](_0x4dea4c,_0x5ca016,!![]);}catch(_0x55f368){return BPromise['reject'](_0x55f368);}return _0x4dea4c['save']();};}function saveUpdates(_0x3a3a2e,_0x5a756d){return function(_0x28c1b5){if(_0x28c1b5){return _0x28c1b5[_0x7d76('0x21')](_0x3a3a2e)[_0x7d76('0x22')](function(_0x2466b3){return _0x2466b3;});}return null;};}function removeEntity(_0x108698,_0x43cf18){return function(_0x162c6c){if(_0x162c6c){return _0x162c6c['destroy']()['then'](function(){_0x108698[_0x7d76('0x19')](0xcc)[_0x7d76('0x23')]();});}};}function handleEntityNotFound(_0x27f76,_0x1464b2){return function(_0x326d0d){if(!_0x326d0d){_0x27f76[_0x7d76('0x18')](0x194);}return _0x326d0d;};}function handleError(_0x8af02c,_0x525d93){_0x525d93=_0x525d93||0x1f4;return function(_0xcc51ed){logger[_0x7d76('0x24')](_0xcc51ed[_0x7d76('0x25')]);if(_0xcc51ed['name']){delete _0xcc51ed[_0x7d76('0x26')];}_0x8af02c['status'](_0x525d93)['send'](_0xcc51ed);};}exports[_0x7d76('0x27')]=function(_0x5a60eb,_0x38b5eb){var _0x5a31ae={},_0x2cd32b={},_0x5de504={'count':0x0,'rows':[]};var _0x40427c=_[_0x7d76('0x28')](db[_0x7d76('0x29')][_0x7d76('0x2a')],function(_0x409746){return{'name':_0x409746[_0x7d76('0x2b')],'type':_0x409746[_0x7d76('0x2c')][_0x7d76('0x2d')]};});_0x2cd32b[_0x7d76('0x2e')]=_[_0x7d76('0x28')](_0x40427c,_0x7d76('0x26'));_0x2cd32b[_0x7d76('0x2f')]=_[_0x7d76('0x30')](_0x5a60eb['query']);_0x2cd32b[_0x7d76('0x31')]=_[_0x7d76('0x32')](_0x2cd32b[_0x7d76('0x2e')],_0x2cd32b['query']);_0x5a31ae['attributes']=_['intersection'](_0x2cd32b[_0x7d76('0x2e')],qs[_0x7d76('0x33')](_0x5a60eb[_0x7d76('0x2f')]['fields']));_0x5a31ae[_0x7d76('0x34')]=_0x5a31ae['attributes'][_0x7d76('0x35')]?_0x5a31ae[_0x7d76('0x34')]:_0x2cd32b[_0x7d76('0x2e')];if(!_0x5a60eb[_0x7d76('0x2f')]['hasOwnProperty']('nolimit')){_0x5a31ae[_0x7d76('0x1c')]=qs['limit'](_0x5a60eb[_0x7d76('0x2f')][_0x7d76('0x1c')]);_0x5a31ae[_0x7d76('0x1a')]=qs['offset'](_0x5a60eb[_0x7d76('0x2f')][_0x7d76('0x1a')]);}_0x5a31ae[_0x7d76('0x36')]=qs['sort'](_0x5a60eb[_0x7d76('0x2f')][_0x7d76('0x37')]);_0x5a31ae[_0x7d76('0x38')]=qs[_0x7d76('0x31')](_[_0x7d76('0x39')](_0x5a60eb[_0x7d76('0x2f')],_0x2cd32b['filters']),_0x40427c);if(_0x5a60eb['query'][_0x7d76('0x3a')]){_0x5a31ae[_0x7d76('0x38')]=_['merge'](_0x5a31ae[_0x7d76('0x38')],{'$or':_[_0x7d76('0x28')](_0x40427c,function(_0x39be39){if(_0x39be39[_0x7d76('0x2c')]!==_0x7d76('0x3b')){var _0x138f1c={};_0x138f1c[_0x39be39['name']]={'$like':'%'+_0x5a60eb[_0x7d76('0x2f')][_0x7d76('0x3a')]+'%'};return _0x138f1c;}})});}_0x5a31ae=_[_0x7d76('0x3c')]({},_0x5a31ae,_0x5a60eb[_0x7d76('0x3d')]);var _0x540285={'where':_0x5a31ae[_0x7d76('0x38')]};return db[_0x7d76('0x29')]['count'](_0x540285)['then'](function(_0x1ffb5a){_0x5de504['count']=_0x1ffb5a;if(_0x5a60eb[_0x7d76('0x2f')][_0x7d76('0x3e')]){_0x5a31ae[_0x7d76('0x3f')]=[{'all':!![]}];}return db[_0x7d76('0x29')][_0x7d76('0x40')](_0x5a31ae);})['then'](function(_0xc7582d){_0x5de504['rows']=_0xc7582d;return _0x5de504;})[_0x7d76('0x22')](respondWithFilteredResult(_0x38b5eb,_0x5a31ae))[_0x7d76('0x41')](handleError(_0x38b5eb,null));};exports['show']=function(_0x2b7f44,_0x469bef){var _0x163e86={'raw':!![],'where':{'id':_0x2b7f44[_0x7d76('0x42')]['id']}},_0x4005ba={};_0x4005ba[_0x7d76('0x2e')]=_[_0x7d76('0x30')](db[_0x7d76('0x29')][_0x7d76('0x2a')]);_0x4005ba[_0x7d76('0x2f')]=_[_0x7d76('0x30')](_0x2b7f44['query']);_0x4005ba[_0x7d76('0x31')]=_[_0x7d76('0x32')](_0x4005ba[_0x7d76('0x2e')],_0x4005ba[_0x7d76('0x2f')]);_0x163e86[_0x7d76('0x34')]=_[_0x7d76('0x32')](_0x4005ba['model'],qs[_0x7d76('0x33')](_0x2b7f44['query']['fields']));_0x163e86['attributes']=_0x163e86[_0x7d76('0x34')][_0x7d76('0x35')]?_0x163e86[_0x7d76('0x34')]:_0x4005ba['model'];if(_0x2b7f44[_0x7d76('0x2f')]['includeAll']){_0x163e86['include']=[{'all':!![]}];}_0x163e86=_[_0x7d76('0x3c')]({},_0x163e86,_0x2b7f44[_0x7d76('0x3d')]);return db['ServicenowField'][_0x7d76('0x43')](_0x163e86)[_0x7d76('0x22')](handleEntityNotFound(_0x469bef,null))[_0x7d76('0x22')](respondWithResult(_0x469bef,null))[_0x7d76('0x41')](handleError(_0x469bef,null));};exports['create']=function(_0x300631,_0x4261fc){return db['ServicenowField'][_0x7d76('0x44')](_0x300631['body'],{})['then'](respondWithResult(_0x4261fc,0xc9))['catch'](handleError(_0x4261fc,null));};exports[_0x7d76('0x21')]=function(_0x31ebf8,_0x2c465e){if(_0x31ebf8[_0x7d76('0x45')]['id']){delete _0x31ebf8[_0x7d76('0x45')]['id'];}return db[_0x7d76('0x29')][_0x7d76('0x43')]({'where':{'id':_0x31ebf8[_0x7d76('0x42')]['id']}})[_0x7d76('0x22')](handleEntityNotFound(_0x2c465e,null))[_0x7d76('0x22')](saveUpdates(_0x31ebf8[_0x7d76('0x45')],null))[_0x7d76('0x22')](respondWithResult(_0x2c465e,null))[_0x7d76('0x41')](handleError(_0x2c465e,null));};exports[_0x7d76('0x46')]=function(_0x53dcd0,_0x5cca44){return db[_0x7d76('0x29')][_0x7d76('0x43')]({'where':{'id':_0x53dcd0['params']['id']}})[_0x7d76('0x22')](handleEntityNotFound(_0x5cca44,null))[_0x7d76('0x22')](removeEntity(_0x5cca44,null))['catch'](handleError(_0x5cca44,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 1843d0c..6ed6650 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 _0xd9fb=['servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_servicenow_fields'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd9fb,0x189));var _0xbd9f=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xd9fb[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var logger=require(_0xbd9f('0x2'))(_0xbd9f('0x3'));var moment=require(_0xbd9f('0x4'));var BPromise=require(_0xbd9f('0x5'));var rp=require(_0xbd9f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd9f('0x7'));var config=require(_0xbd9f('0x8'));var attributes=require('./intServicenowField.attributes');module[_0xbd9f('0x9')]=function(_0x5b6052,_0x2e7eea){return _0x5b6052[_0xbd9f('0xa')]('ServicenowField',attributes,{'tableName':_0xbd9f('0xb'),'paranoid':![],'indexes':[{'name':_0xbd9f('0xc'),'fields':[_0xbd9f('0xd'),_0xbd9f('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcfd=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x13ebf2,_0x477fc4){var _0x2f4b4f=function(_0x35159a){while(--_0x35159a){_0x13ebf2['push'](_0x13ebf2['shift']());}};_0x2f4b4f(++_0x477fc4);}(_0xbcfd,0x1d7));var _0xdbcf=function(_0x36756f,_0x4fb7cc){_0x36756f=_0x36756f-0x0;var _0x2259aa=_0xbcfd[_0x36756f];return _0x2259aa;};'use strict';var _=require('lodash');var util=require(_0xdbcf('0x0'));var logger=require(_0xdbcf('0x1'))(_0xdbcf('0x2'));var moment=require(_0xdbcf('0x3'));var BPromise=require(_0xdbcf('0x4'));var rp=require(_0xdbcf('0x5'));var fs=require('fs');var path=require(_0xdbcf('0x6'));var rimraf=require('rimraf');var config=require(_0xdbcf('0x7'));var attributes=require(_0xdbcf('0x8'));module['exports']=function(_0x5d7066,_0x1c17af){return _0x5d7066[_0xdbcf('0x9')](_0xdbcf('0xa'),attributes,{'tableName':_0xdbcf('0xb'),'paranoid':![],'indexes':[{'name':_0xdbcf('0xc'),'fields':[_0xdbcf('0xd'),_0xdbcf('0xe')],'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 a8d623f..266e4ea 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x4e6249,_0x4fd527){var _0x335d13=function(_0x5cb31f){while(--_0x5cb31f){_0x4e6249['push'](_0x4e6249['shift']());}};_0x335d13(++_0x4fd527);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xbaf0=['client','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ServicenowField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9b15013..4b29ce2 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(_0xc8d731,_0x232a1f){var _0x32ed88=function(_0xa697fc){while(--_0xa697fc){_0xc8d731['push'](_0xc8d731['shift']());}};_0x32ed88(++_0x232a1f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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(_0x156fc0,_0x18953e){var _0x1402eb=function(_0x265f26){while(--_0x265f26){_0x156fc0['push'](_0x156fc0['shift']());}};_0x1402eb(++_0x18953e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 bc69f32..7e4b852 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(_0x5c6dec,_0x23bd3f){var _0x18c65a=function(_0xd5ac34){while(--_0xd5ac34){_0x5c6dec['push'](_0x5c6dec['shift']());}};_0x18c65a(++_0x23bd3f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x29cc2b,_0x1fad7b){var _0x3e8cc0=function(_0x49ab6c){while(--_0x49ab6c){_0x29cc2b['push'](_0x29cc2b['shift']());}};_0x3e8cc0(++_0x1fad7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 bd545f2..b694911 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 _0x50be=['ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','count','limit','set','Content-Range','apply','reject','then','destroy','sendStatus','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','length','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','remove','includes','endsWith','value','test','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox'];(function(_0x3b5599,_0x2eddcf){var _0x36367a=function(_0x501883){while(--_0x501883){_0x3b5599['push'](_0x3b5599['shift']());}};_0x36367a(++_0x2eddcf);}(_0x50be,0x1f0));var _0xe50b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50be[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe50b('0x0'));var rimraf=require(_0xe50b('0x1'));var zipdir=require(_0xe50b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe50b('0x3'));var BPromise=require(_0xe50b('0x4'));var Mustache=require(_0xe50b('0x5'));var util=require('util');var path=require(_0xe50b('0x6'));var sox=require(_0xe50b('0x7'));var csv=require('to-csv');var ejs=require(_0xe50b('0x8'));var fs=require('fs');var fs_extra=require(_0xe50b('0x9'));var _=require('lodash');var squel=require(_0xe50b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe50b('0xb'));var toCsv=require(_0xe50b('0xc'));var querystring=require(_0xe50b('0xd'));var Papa=require(_0xe50b('0xe'));var Redis=require(_0xe50b('0xf'));var authService=require(_0xe50b('0x10'));var qs=require(_0xe50b('0x11'));var as=require(_0xe50b('0x12'));var hardwareService=require(_0xe50b('0x13'));var logger=require('../../config/logger')(_0xe50b('0x14'));var utils=require(_0xe50b('0x15'));var config=require(_0xe50b('0x16'));var licenseUtil=require(_0xe50b('0x17'));var db=require(_0xe50b('0x18'))['db'];var integrations=require(_0xe50b('0x19'));function respondWithStatusCode(_0x41953e,_0x5b2c1f){_0x5b2c1f=_0x5b2c1f||0xcc;return function(_0x7aab68){if(_0x7aab68){return _0x41953e['sendStatus'](_0x5b2c1f);}return _0x41953e[_0xe50b('0x1a')](_0x5b2c1f)[_0xe50b('0x1b')]();};}function respondWithResult(_0x9677f7,_0x49e52c){_0x49e52c=_0x49e52c||0xc8;return function(_0xa035c){if(_0xa035c){return _0x9677f7['status'](_0x49e52c)[_0xe50b('0x1c')](_0xa035c);}};}function respondWithFilteredResult(_0xd20deb,_0x3f8f3){return function(_0x5b6d64){if(_0x5b6d64){var _0x5cc2bc=typeof _0x3f8f3[_0xe50b('0x1d')]==='undefined'&&typeof _0x3f8f3['limit']==='undefined';var _0xdc1b0a=_0x5b6d64[_0xe50b('0x1e')];var _0x9c481e=_0x5cc2bc?0x0:_0x3f8f3['offset'];var _0xd360a2=_0x5cc2bc?_0x5b6d64[_0xe50b('0x1e')]:_0x3f8f3[_0xe50b('0x1d')]+_0x3f8f3[_0xe50b('0x1f')];var _0x2b0d18;if(_0xd360a2>=_0xdc1b0a){_0xd360a2=_0xdc1b0a;_0x2b0d18=0xc8;}else{_0x2b0d18=0xce;}_0xd20deb[_0xe50b('0x1a')](_0x2b0d18);return _0xd20deb[_0xe50b('0x20')](_0xe50b('0x21'),_0x9c481e+'-'+_0xd360a2+'/'+_0xdc1b0a)[_0xe50b('0x1c')](_0x5b6d64);}return null;};}function patchUpdates(_0x93d93d){return function(_0xcacae){try{jsonpatch[_0xe50b('0x22')](_0xcacae,_0x93d93d,!![]);}catch(_0x280009){return BPromise[_0xe50b('0x23')](_0x280009);}return _0xcacae['save']();};}function saveUpdates(_0x1e02e8,_0x399d7d){return function(_0x1aeb7c){if(_0x1aeb7c){return _0x1aeb7c['update'](_0x1e02e8)[_0xe50b('0x24')](function(_0x6aec53){return _0x6aec53;});}return null;};}function removeEntity(_0x10dd94,_0x2db5a7){return function(_0x3efad3){if(_0x3efad3){return _0x3efad3[_0xe50b('0x25')]()[_0xe50b('0x24')](function(){_0x10dd94['status'](0xcc)[_0xe50b('0x1b')]();});}};}function handleEntityNotFound(_0x425c2b,_0x21570b){return function(_0xda348f){if(!_0xda348f){_0x425c2b[_0xe50b('0x26')](0x194);}return _0xda348f;};}function handleError(_0x5aaa94,_0x4bca51){_0x4bca51=_0x4bca51||0x1f4;return function(_0x571b54){logger['error'](_0x571b54[_0xe50b('0x27')]);if(_0x571b54['name']){delete _0x571b54[_0xe50b('0x28')];}_0x5aaa94[_0xe50b('0x1a')](_0x4bca51)['send'](_0x571b54);};}exports[_0xe50b('0x29')]=function(_0xfc70ea,_0x30ca29){var _0x569c96={},_0x188279={},_0x58ddaf={'count':0x0,'rows':[]};var _0x206d8f=_[_0xe50b('0x2a')](db[_0xe50b('0x2b')][_0xe50b('0x2c')],function(_0x43d3a6){return{'name':_0x43d3a6[_0xe50b('0x2d')],'type':_0x43d3a6[_0xe50b('0x2e')][_0xe50b('0x2f')]};});_0x188279[_0xe50b('0x30')]=_['map'](_0x206d8f,_0xe50b('0x28'));_0x188279[_0xe50b('0x31')]=_['keys'](_0xfc70ea[_0xe50b('0x31')]);_0x188279[_0xe50b('0x32')]=_[_0xe50b('0x33')](_0x188279[_0xe50b('0x30')],_0x188279[_0xe50b('0x31')]);_0x569c96[_0xe50b('0x34')]=_[_0xe50b('0x33')](_0x188279['model'],qs['fields'](_0xfc70ea[_0xe50b('0x31')]['fields']));_0x569c96[_0xe50b('0x34')]=_0x569c96[_0xe50b('0x34')]['length']?_0x569c96[_0xe50b('0x34')]:_0x188279[_0xe50b('0x30')];if(!_0xfc70ea[_0xe50b('0x31')][_0xe50b('0x35')](_0xe50b('0x36'))){_0x569c96[_0xe50b('0x1f')]=qs[_0xe50b('0x1f')](_0xfc70ea['query'][_0xe50b('0x1f')]);_0x569c96[_0xe50b('0x1d')]=qs[_0xe50b('0x1d')](_0xfc70ea[_0xe50b('0x31')][_0xe50b('0x1d')]);}_0x569c96[_0xe50b('0x37')]=qs[_0xe50b('0x38')](_0xfc70ea[_0xe50b('0x31')][_0xe50b('0x38')]);_0x569c96['where']=qs[_0xe50b('0x32')](_['pick'](_0xfc70ea[_0xe50b('0x31')],_0x188279[_0xe50b('0x32')]),_0x206d8f);if(_0xfc70ea[_0xe50b('0x31')][_0xe50b('0x39')]){_0x569c96[_0xe50b('0x3a')]=_[_0xe50b('0x3b')](_0x569c96['where'],{'$or':_[_0xe50b('0x2a')](_0x206d8f,function(_0x14d5b0){if(_0x14d5b0[_0xe50b('0x2e')]!==_0xe50b('0x3c')){var _0x48939b={};_0x48939b[_0x14d5b0[_0xe50b('0x28')]]={'$like':'%'+_0xfc70ea['query'][_0xe50b('0x39')]+'%'};return _0x48939b;}})});}_0x569c96=_[_0xe50b('0x3b')]({},_0x569c96,_0xfc70ea[_0xe50b('0x3d')]);var _0x625315={'where':_0x569c96[_0xe50b('0x3a')]};return db[_0xe50b('0x2b')][_0xe50b('0x1e')](_0x625315)[_0xe50b('0x24')](function(_0x2e87e3){_0x58ddaf['count']=_0x2e87e3;if(_0xfc70ea[_0xe50b('0x31')][_0xe50b('0x3e')]){_0x569c96[_0xe50b('0x3f')]=[{'all':!![]}];}return db[_0xe50b('0x2b')][_0xe50b('0x40')](_0x569c96);})[_0xe50b('0x24')](function(_0x500e79){_0x58ddaf[_0xe50b('0x41')]=_0x500e79;return _0x58ddaf;})['then'](respondWithFilteredResult(_0x30ca29,_0x569c96))[_0xe50b('0x42')](handleError(_0x30ca29,null));};exports[_0xe50b('0x43')]=function(_0x5b718d,_0x31a7a8){var _0x25693e={'raw':![],'where':{'id':_0x5b718d[_0xe50b('0x44')]['id']}},_0x4c06dd={};_0x4c06dd[_0xe50b('0x30')]=_[_0xe50b('0x45')](db[_0xe50b('0x2b')]['rawAttributes']);_0x4c06dd[_0xe50b('0x31')]=_[_0xe50b('0x45')](_0x5b718d[_0xe50b('0x31')]);_0x4c06dd[_0xe50b('0x32')]=_[_0xe50b('0x33')](_0x4c06dd[_0xe50b('0x30')],_0x4c06dd['query']);_0x25693e[_0xe50b('0x34')]=_[_0xe50b('0x33')](_0x4c06dd['model'],qs[_0xe50b('0x46')](_0x5b718d[_0xe50b('0x31')]['fields']));_0x25693e['attributes']=_0x25693e[_0xe50b('0x34')][_0xe50b('0x47')]?_0x25693e[_0xe50b('0x34')]:_0x4c06dd[_0xe50b('0x30')];if(_0x5b718d[_0xe50b('0x31')][_0xe50b('0x3e')]){_0x25693e['include']=[{'all':!![]}];}_0x25693e=_[_0xe50b('0x3b')]({},_0x25693e,_0x5b718d[_0xe50b('0x3d')]);return db[_0xe50b('0x2b')][_0xe50b('0x48')](_0x25693e)[_0xe50b('0x24')](handleEntityNotFound(_0x31a7a8,null))[_0xe50b('0x24')](respondWithResult(_0x31a7a8,null))['catch'](handleError(_0x31a7a8,null));};exports[_0xe50b('0x49')]=function(_0xa2a9b7,_0x3dae1b){return db['SugarcrmAccount'][_0xe50b('0x49')](_0xa2a9b7[_0xe50b('0x4a')],{})[_0xe50b('0x24')](respondWithResult(_0x3dae1b,0xc9))[_0xe50b('0x42')](handleError(_0x3dae1b,null));};exports[_0xe50b('0x4b')]=function(_0x3da99e,_0x2b2623){if(_0x3da99e['body']['id']){delete _0x3da99e[_0xe50b('0x4a')]['id'];}return db[_0xe50b('0x2b')][_0xe50b('0x48')]({'where':{'id':_0x3da99e[_0xe50b('0x44')]['id']}})[_0xe50b('0x24')](handleEntityNotFound(_0x2b2623,null))[_0xe50b('0x24')](saveUpdates(_0x3da99e[_0xe50b('0x4a')],null))[_0xe50b('0x24')](respondWithResult(_0x2b2623,null))[_0xe50b('0x42')](handleError(_0x2b2623,null));};exports['destroy']=function(_0x3fefea,_0x10f8f3){return db[_0xe50b('0x2b')][_0xe50b('0x48')]({'where':{'id':_0x3fefea[_0xe50b('0x44')]['id']}})[_0xe50b('0x24')](handleEntityNotFound(_0x10f8f3,null))[_0xe50b('0x24')](removeEntity(_0x10f8f3,null))[_0xe50b('0x42')](handleError(_0x10f8f3,null));};exports[_0xe50b('0x4c')]=function(_0x99c487,_0x3de0c4,_0x2f8b97){var _0x542430={};var _0x25aa22={};var _0x18e853;var _0xa99ca2;return db[_0xe50b('0x2b')][_0xe50b('0x4d')]({'where':{'id':_0x99c487[_0xe50b('0x44')]['id']}})[_0xe50b('0x24')](handleEntityNotFound(_0x3de0c4,null))[_0xe50b('0x24')](function(_0x34105e){if(_0x34105e){_0x18e853=_0x34105e;_0x25aa22[_0xe50b('0x30')]=_[_0xe50b('0x45')](db[_0xe50b('0x4e')][_0xe50b('0x2c')]);_0x25aa22[_0xe50b('0x31')]=_[_0xe50b('0x45')](_0x99c487[_0xe50b('0x31')]);_0x25aa22['filters']=_[_0xe50b('0x33')](_0x25aa22[_0xe50b('0x30')],_0x25aa22['query']);_0x542430[_0xe50b('0x34')]=_['intersection'](_0x25aa22[_0xe50b('0x30')],qs[_0xe50b('0x46')](_0x99c487['query'][_0xe50b('0x46')]));_0x542430['attributes']=_0x542430[_0xe50b('0x34')][_0xe50b('0x47')]?_0x542430[_0xe50b('0x34')]:_0x25aa22['model'];_0x542430[_0xe50b('0x37')]=qs[_0xe50b('0x38')](_0x99c487[_0xe50b('0x31')][_0xe50b('0x38')]);_0x542430[_0xe50b('0x3a')]=qs[_0xe50b('0x32')](_[_0xe50b('0x4f')](_0x99c487[_0xe50b('0x31')],_0x25aa22['filters']));if(_0x99c487[_0xe50b('0x31')][_0xe50b('0x39')]){_0x542430[_0xe50b('0x3a')]=_[_0xe50b('0x3b')](_0x542430[_0xe50b('0x3a')],{'$or':_[_0xe50b('0x2a')](_0x542430[_0xe50b('0x34')],function(_0x7c1ac0){var _0x379e7e={};_0x379e7e[_0x7c1ac0]={'$like':'%'+_0x99c487[_0xe50b('0x31')][_0xe50b('0x39')]+'%'};return _0x379e7e;})});}_0x542430=_[_0xe50b('0x3b')]({},_0x542430,_0x99c487[_0xe50b('0x3d')]);return _0x18e853[_0xe50b('0x4c')](_0x542430);}})[_0xe50b('0x24')](function(_0x813bd2){if(_0x813bd2){_0xa99ca2=_0x813bd2[_0xe50b('0x47')];if(!_0x99c487['query'][_0xe50b('0x35')](_0xe50b('0x36'))){_0x542430[_0xe50b('0x1f')]=qs[_0xe50b('0x1f')](_0x99c487[_0xe50b('0x31')]['limit']);_0x542430[_0xe50b('0x1d')]=qs['offset'](_0x99c487[_0xe50b('0x31')][_0xe50b('0x1d')]);}return _0x18e853[_0xe50b('0x4c')](_0x542430);}})[_0xe50b('0x24')](function(_0x94c61c){if(_0x94c61c){return _0x94c61c?{'count':_0xa99ca2,'rows':_0x94c61c}:null;}})[_0xe50b('0x24')](respondWithResult(_0x3de0c4,null))[_0xe50b('0x42')](handleError(_0x3de0c4,null));};exports[_0xe50b('0x50')]=function(_0x282ffa,_0x51a091,_0x48714f){if(_0x282ffa[_0xe50b('0x4a')]['id']){delete _0x282ffa['body']['id'];}return db[_0xe50b('0x2b')][_0xe50b('0x4d')]({'where':{'id':_0x282ffa[_0xe50b('0x44')]['id']}})[_0xe50b('0x24')](handleEntityNotFound(_0x51a091,null))[_0xe50b('0x24')](function(_0x25a2a4){if(_0x25a2a4){_0x282ffa[_0xe50b('0x4a')][_0xe50b('0x51')]=_0x25a2a4['id'];_0x282ffa[_0xe50b('0x4a')][_0xe50b('0x52')]=integrations['getSubjects'](_0x282ffa['body'][_0xe50b('0x53')],_0x282ffa[_0xe50b('0x4a')][_0xe50b('0x2e')]);_0x282ffa[_0xe50b('0x4a')][_0xe50b('0x54')]=integrations[_0xe50b('0x55')](_0x282ffa['body'][_0xe50b('0x53')],_0x282ffa[_0xe50b('0x4a')][_0xe50b('0x2e')]);return db['SugarcrmConfiguration'][_0xe50b('0x49')](_0x282ffa[_0xe50b('0x4a')],{'include':[{'model':db[_0xe50b('0x56')],'as':'Subjects'},{'model':db[_0xe50b('0x56')],'as':_0xe50b('0x54')}]});}return null;})[_0xe50b('0x24')](respondWithResult(_0x51a091,null))[_0xe50b('0x42')](handleError(_0x51a091,null));};exports['getFields']=function(_0x328896,_0x21f32a,_0x386978){var _0x564bcf='';var _0x1aa4db=['id',_0xe50b('0x28'),_0xe50b('0x57'),_0xe50b('0x58'),'description',_0xe50b('0x59'),_0xe50b('0x5a'),_0xe50b('0x5b'),_0xe50b('0x5c'),_0xe50b('0x5d'),_0xe50b('0x5e'),_0xe50b('0x5f')];return db[_0xe50b('0x2b')][_0xe50b('0x4d')]({'where':{'id':_0x328896[_0xe50b('0x44')]['id']},'attributes':['id',_0xe50b('0x60'),_0xe50b('0x61'),'remoteUri']})['then'](handleEntityNotFound(_0x21f32a,null))[_0xe50b('0x24')](function(_0x436da1){if(_0x436da1){_0x564bcf=_0x436da1[_0xe50b('0x62')];var _0x5af352=_0x564bcf[_0xe50b('0x63')](-0x1);if(_0x5af352==='/'){_0x564bcf=_0x564bcf[_0xe50b('0x64')](0x0,_0x564bcf[_0xe50b('0x65')](_0x5af352));}return rp({'method':_0xe50b('0x66'),'uri':util[_0xe50b('0x67')](_0xe50b('0x68'),_0x564bcf,_0xe50b('0x69')),'json':!![],'form':{'method':_0xe50b('0x6a'),'input_type':_0xe50b('0x6b'),'response_type':_0xe50b('0x6b'),'rest_data':JSON[_0xe50b('0x6c')]({'user_auth':{'user_name':_0x436da1['username'],'password':_0x436da1[_0xe50b('0x61')],'encryption':_0xe50b('0x6d')},'application':_0xe50b('0x6e')})}});}})[_0xe50b('0x24')](function(_0x303e97){if(_0x303e97&&_0x303e97['name']!==_0xe50b('0x6f')&&_0x303e97[_0xe50b('0x28')]!==_0xe50b('0x70')){return rp({'method':_0xe50b('0x66'),'uri':util[_0xe50b('0x67')](_0xe50b('0x68'),_0x564bcf,_0xe50b('0x69')),'json':!![],'form':{'method':_0xe50b('0x71'),'input_type':_0xe50b('0x6b'),'response_type':_0xe50b('0x6b'),'rest_data':JSON[_0xe50b('0x6c')]({'session':_0x303e97['id'],'module_name':_0xe50b('0x72')})}})['then'](function(_0x317df2){if(_0x317df2){var _0x17564e=_[_0xe50b('0x73')](_0x317df2[_0xe50b('0x74')]);_[_0xe50b('0x75')](_0x17564e,function(_0x3f2894){return _0x1aa4db[_0xe50b('0x76')](_0x3f2894['name']);});return{'count':_0x17564e[_0xe50b('0x47')],'rows':_[_0xe50b('0x2a')](_0x17564e,function(_0x2a2581){return{'id':_0x2a2581[_0xe50b('0x28')],'name':_0x2a2581['label'],'custom':_[_0xe50b('0x77')](_0x2a2581['name'],'_c')?!![]:![],'options':_0x2a2581['options']?_[_0xe50b('0x2a')](_['values'](_0x2a2581[_0xe50b('0x3d')]),function(_0x3e2049){return{'name':_0x3e2049[_0xe50b('0x78')],'value':_0x3e2049[_0xe50b('0x28')]};}):[]};})};}})[_0xe50b('0x24')](respondWithResult(_0x21f32a,null))[_0xe50b('0x42')](function(_0x13ef18){var _0x1d616f=_0x328896[_0xe50b('0x31')][_0xe50b('0x79')]?0x1f4:_0x13ef18['statusCode']||0x1f4;logger[_0xe50b('0x7a')](_0xe50b('0x7b'),'getFields',_0x1d616f,JSON[_0xe50b('0x6c')](_0x13ef18));delete _0x13ef18['name'];if(_0x1d616f===0x191){_0x1d616f=0x190;}_0x21f32a['status'](_0x1d616f)[_0xe50b('0x7c')](_0x328896[_0xe50b('0x31')][_0xe50b('0x79')]?{'message':_0xe50b('0x7d'),'statusCode':_0x13ef18['statusCode']}:_0x13ef18);});}else{var _0x1152c4=0x1f4;_0x21f32a[_0xe50b('0x1a')](_0x1152c4)[_0xe50b('0x7c')]({'message':_0xe50b('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x24f0=['password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','username','%s%s','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','end','stack','name','send','map','SugarcrmAccount','fieldName','type','key','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction'];(function(_0xd2e2ab,_0x2440cf){var _0x1703a2=function(_0x23deba){while(--_0x23deba){_0xd2e2ab['push'](_0xd2e2ab['shift']());}};_0x1703a2(++_0x2440cf);}(_0x24f0,0x91));var _0x024f=function(_0x4a44fd,_0x5372ce){_0x4a44fd=_0x4a44fd-0x0;var _0x318c19=_0x24f0[_0x4a44fd];return _0x318c19;};'use strict';var emlformat=require(_0x024f('0x0'));var rimraf=require(_0x024f('0x1'));var zipdir=require(_0x024f('0x2'));var jsonpatch=require(_0x024f('0x3'));var rp=require(_0x024f('0x4'));var moment=require(_0x024f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x024f('0x6'));var util=require(_0x024f('0x7'));var path=require(_0x024f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x024f('0x9'));var _=require('lodash');var squel=require(_0x024f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x024f('0xb'));var toCsv=require(_0x024f('0xc'));var querystring=require(_0x024f('0xd'));var Papa=require(_0x024f('0xe'));var Redis=require(_0x024f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x024f('0x10'));var as=require(_0x024f('0x11'));var hardwareService=require(_0x024f('0x12'));var logger=require(_0x024f('0x13'))(_0x024f('0x14'));var utils=require(_0x024f('0x15'));var config=require(_0x024f('0x16'));var licenseUtil=require(_0x024f('0x17'));var db=require(_0x024f('0x18'))['db'];var integrations=require(_0x024f('0x19'));function respondWithStatusCode(_0x4e2eb6,_0x18512f){_0x18512f=_0x18512f||0xcc;return function(_0xd03817){if(_0xd03817){return _0x4e2eb6[_0x024f('0x1a')](_0x18512f);}return _0x4e2eb6[_0x024f('0x1b')](_0x18512f)['end']();};}function respondWithResult(_0x7f4a8f,_0x1493f8){_0x1493f8=_0x1493f8||0xc8;return function(_0xbe367c){if(_0xbe367c){return _0x7f4a8f['status'](_0x1493f8)[_0x024f('0x1c')](_0xbe367c);}};}function respondWithFilteredResult(_0x907482,_0xa6fcfc){return function(_0x6b2d9){if(_0x6b2d9){var _0x3cfc21=typeof _0xa6fcfc[_0x024f('0x1d')]===_0x024f('0x1e')&&typeof _0xa6fcfc[_0x024f('0x1f')]==='undefined';var _0x601035=_0x6b2d9['count'];var _0x555950=_0x3cfc21?0x0:_0xa6fcfc[_0x024f('0x1d')];var _0x37fc91=_0x3cfc21?_0x6b2d9[_0x024f('0x20')]:_0xa6fcfc[_0x024f('0x1d')]+_0xa6fcfc[_0x024f('0x1f')];var _0x14f80a;if(_0x37fc91>=_0x601035){_0x37fc91=_0x601035;_0x14f80a=0xc8;}else{_0x14f80a=0xce;}_0x907482[_0x024f('0x1b')](_0x14f80a);return _0x907482[_0x024f('0x21')](_0x024f('0x22'),_0x555950+'-'+_0x37fc91+'/'+_0x601035)[_0x024f('0x1c')](_0x6b2d9);}return null;};}function patchUpdates(_0x4dcddd){return function(_0x439718){try{jsonpatch[_0x024f('0x23')](_0x439718,_0x4dcddd,!![]);}catch(_0x44abef){return BPromise['reject'](_0x44abef);}return _0x439718[_0x024f('0x24')]();};}function saveUpdates(_0x595382,_0x4ff36d){return function(_0x4cee6a){if(_0x4cee6a){return _0x4cee6a['update'](_0x595382)['then'](function(_0x4912cb){return _0x4912cb;});}return null;};}function removeEntity(_0x3993a9,_0x8c15a7){return function(_0x3dc6d5){if(_0x3dc6d5){return _0x3dc6d5[_0x024f('0x25')]()[_0x024f('0x26')](function(){_0x3993a9['status'](0xcc)[_0x024f('0x27')]();});}};}function handleEntityNotFound(_0x1ea484,_0x836ced){return function(_0x580abb){if(!_0x580abb){_0x1ea484[_0x024f('0x1a')](0x194);}return _0x580abb;};}function handleError(_0x4d8191,_0x2de76c){_0x2de76c=_0x2de76c||0x1f4;return function(_0x15e571){logger['error'](_0x15e571[_0x024f('0x28')]);if(_0x15e571['name']){delete _0x15e571[_0x024f('0x29')];}_0x4d8191[_0x024f('0x1b')](_0x2de76c)[_0x024f('0x2a')](_0x15e571);};}exports['index']=function(_0x6078a3,_0x30d816){var _0x2e6c55={},_0x28a5c4={},_0x7d483={'count':0x0,'rows':[]};var _0x42109c=_[_0x024f('0x2b')](db[_0x024f('0x2c')]['rawAttributes'],function(_0x4d6028){return{'name':_0x4d6028[_0x024f('0x2d')],'type':_0x4d6028[_0x024f('0x2e')][_0x024f('0x2f')]};});_0x28a5c4['model']=_[_0x024f('0x2b')](_0x42109c,_0x024f('0x29'));_0x28a5c4['query']=_[_0x024f('0x30')](_0x6078a3['query']);_0x28a5c4['filters']=_['intersection'](_0x28a5c4[_0x024f('0x31')],_0x28a5c4[_0x024f('0x32')]);_0x2e6c55['attributes']=_[_0x024f('0x33')](_0x28a5c4[_0x024f('0x31')],qs[_0x024f('0x34')](_0x6078a3[_0x024f('0x32')][_0x024f('0x34')]));_0x2e6c55[_0x024f('0x35')]=_0x2e6c55[_0x024f('0x35')][_0x024f('0x36')]?_0x2e6c55[_0x024f('0x35')]:_0x28a5c4[_0x024f('0x31')];if(!_0x6078a3[_0x024f('0x32')][_0x024f('0x37')](_0x024f('0x38'))){_0x2e6c55['limit']=qs[_0x024f('0x1f')](_0x6078a3[_0x024f('0x32')][_0x024f('0x1f')]);_0x2e6c55[_0x024f('0x1d')]=qs[_0x024f('0x1d')](_0x6078a3[_0x024f('0x32')][_0x024f('0x1d')]);}_0x2e6c55[_0x024f('0x39')]=qs[_0x024f('0x3a')](_0x6078a3[_0x024f('0x32')][_0x024f('0x3a')]);_0x2e6c55['where']=qs['filters'](_['pick'](_0x6078a3[_0x024f('0x32')],_0x28a5c4[_0x024f('0x3b')]),_0x42109c);if(_0x6078a3[_0x024f('0x32')][_0x024f('0x3c')]){_0x2e6c55[_0x024f('0x3d')]=_[_0x024f('0x3e')](_0x2e6c55[_0x024f('0x3d')],{'$or':_['map'](_0x42109c,function(_0x9a239d){if(_0x9a239d[_0x024f('0x2e')]!==_0x024f('0x3f')){var _0x16bdf6={};_0x16bdf6[_0x9a239d[_0x024f('0x29')]]={'$like':'%'+_0x6078a3[_0x024f('0x32')]['filter']+'%'};return _0x16bdf6;}})});}_0x2e6c55=_[_0x024f('0x3e')]({},_0x2e6c55,_0x6078a3['options']);var _0x58f5d2={'where':_0x2e6c55['where']};return db['SugarcrmAccount'][_0x024f('0x20')](_0x58f5d2)['then'](function(_0x272572){_0x7d483[_0x024f('0x20')]=_0x272572;if(_0x6078a3[_0x024f('0x32')][_0x024f('0x40')]){_0x2e6c55[_0x024f('0x41')]=[{'all':!![]}];}return db[_0x024f('0x2c')][_0x024f('0x42')](_0x2e6c55);})[_0x024f('0x26')](function(_0x4cfcc7){_0x7d483[_0x024f('0x43')]=_0x4cfcc7;return _0x7d483;})[_0x024f('0x26')](respondWithFilteredResult(_0x30d816,_0x2e6c55))[_0x024f('0x44')](handleError(_0x30d816,null));};exports[_0x024f('0x45')]=function(_0xa35460,_0x1b31a8){var _0x3134f2={'raw':![],'where':{'id':_0xa35460[_0x024f('0x46')]['id']}},_0x4f0030={};_0x4f0030[_0x024f('0x31')]=_[_0x024f('0x30')](db[_0x024f('0x2c')][_0x024f('0x47')]);_0x4f0030[_0x024f('0x32')]=_[_0x024f('0x30')](_0xa35460[_0x024f('0x32')]);_0x4f0030['filters']=_[_0x024f('0x33')](_0x4f0030[_0x024f('0x31')],_0x4f0030[_0x024f('0x32')]);_0x3134f2[_0x024f('0x35')]=_['intersection'](_0x4f0030[_0x024f('0x31')],qs[_0x024f('0x34')](_0xa35460[_0x024f('0x32')][_0x024f('0x34')]));_0x3134f2['attributes']=_0x3134f2['attributes'][_0x024f('0x36')]?_0x3134f2[_0x024f('0x35')]:_0x4f0030[_0x024f('0x31')];if(_0xa35460[_0x024f('0x32')]['includeAll']){_0x3134f2[_0x024f('0x41')]=[{'all':!![]}];}_0x3134f2=_[_0x024f('0x3e')]({},_0x3134f2,_0xa35460[_0x024f('0x48')]);return db[_0x024f('0x2c')][_0x024f('0x49')](_0x3134f2)[_0x024f('0x26')](handleEntityNotFound(_0x1b31a8,null))[_0x024f('0x26')](respondWithResult(_0x1b31a8,null))[_0x024f('0x44')](handleError(_0x1b31a8,null));};exports[_0x024f('0x4a')]=function(_0xa45b5d,_0x5b91cb){return db[_0x024f('0x2c')][_0x024f('0x4a')](_0xa45b5d[_0x024f('0x4b')],{})[_0x024f('0x26')](respondWithResult(_0x5b91cb,0xc9))['catch'](handleError(_0x5b91cb,null));};exports[_0x024f('0x4c')]=function(_0x3c8b02,_0xd19340){if(_0x3c8b02[_0x024f('0x4b')]['id']){delete _0x3c8b02[_0x024f('0x4b')]['id'];}return db[_0x024f('0x2c')][_0x024f('0x49')]({'where':{'id':_0x3c8b02[_0x024f('0x46')]['id']}})[_0x024f('0x26')](handleEntityNotFound(_0xd19340,null))[_0x024f('0x26')](saveUpdates(_0x3c8b02[_0x024f('0x4b')],null))[_0x024f('0x26')](respondWithResult(_0xd19340,null))[_0x024f('0x44')](handleError(_0xd19340,null));};exports[_0x024f('0x25')]=function(_0x1ffa83,_0x292ce4){return db[_0x024f('0x2c')][_0x024f('0x49')]({'where':{'id':_0x1ffa83[_0x024f('0x46')]['id']}})[_0x024f('0x26')](handleEntityNotFound(_0x292ce4,null))[_0x024f('0x26')](removeEntity(_0x292ce4,null))[_0x024f('0x44')](handleError(_0x292ce4,null));};exports[_0x024f('0x4d')]=function(_0x442ea9,_0xaf5526,_0x5ce155){var _0x410405={};var _0x51dec8={};var _0x2ed3a7;var _0x5c5aff;return db['SugarcrmAccount'][_0x024f('0x4e')]({'where':{'id':_0x442ea9[_0x024f('0x46')]['id']}})['then'](handleEntityNotFound(_0xaf5526,null))[_0x024f('0x26')](function(_0x86dca3){if(_0x86dca3){_0x2ed3a7=_0x86dca3;_0x51dec8['model']=_[_0x024f('0x30')](db[_0x024f('0x4f')][_0x024f('0x47')]);_0x51dec8[_0x024f('0x32')]=_[_0x024f('0x30')](_0x442ea9[_0x024f('0x32')]);_0x51dec8[_0x024f('0x3b')]=_[_0x024f('0x33')](_0x51dec8[_0x024f('0x31')],_0x51dec8[_0x024f('0x32')]);_0x410405['attributes']=_[_0x024f('0x33')](_0x51dec8['model'],qs[_0x024f('0x34')](_0x442ea9[_0x024f('0x32')][_0x024f('0x34')]));_0x410405[_0x024f('0x35')]=_0x410405[_0x024f('0x35')][_0x024f('0x36')]?_0x410405[_0x024f('0x35')]:_0x51dec8[_0x024f('0x31')];_0x410405['order']=qs[_0x024f('0x3a')](_0x442ea9[_0x024f('0x32')][_0x024f('0x3a')]);_0x410405[_0x024f('0x3d')]=qs[_0x024f('0x3b')](_[_0x024f('0x50')](_0x442ea9['query'],_0x51dec8[_0x024f('0x3b')]));if(_0x442ea9[_0x024f('0x32')][_0x024f('0x3c')]){_0x410405[_0x024f('0x3d')]=_['merge'](_0x410405[_0x024f('0x3d')],{'$or':_[_0x024f('0x2b')](_0x410405[_0x024f('0x35')],function(_0x4fe47e){var _0x50937d={};_0x50937d[_0x4fe47e]={'$like':'%'+_0x442ea9['query'][_0x024f('0x3c')]+'%'};return _0x50937d;})});}_0x410405=_[_0x024f('0x3e')]({},_0x410405,_0x442ea9['options']);return _0x2ed3a7[_0x024f('0x4d')](_0x410405);}})[_0x024f('0x26')](function(_0x3c1f9c){if(_0x3c1f9c){_0x5c5aff=_0x3c1f9c[_0x024f('0x36')];if(!_0x442ea9[_0x024f('0x32')][_0x024f('0x37')]('nolimit')){_0x410405['limit']=qs[_0x024f('0x1f')](_0x442ea9[_0x024f('0x32')]['limit']);_0x410405[_0x024f('0x1d')]=qs[_0x024f('0x1d')](_0x442ea9[_0x024f('0x32')]['offset']);}return _0x2ed3a7[_0x024f('0x4d')](_0x410405);}})['then'](function(_0x1257f6){if(_0x1257f6){return _0x1257f6?{'count':_0x5c5aff,'rows':_0x1257f6}:null;}})[_0x024f('0x26')](respondWithResult(_0xaf5526,null))['catch'](handleError(_0xaf5526,null));};exports[_0x024f('0x51')]=function(_0x22f350,_0x1be9d9,_0x5dc102){if(_0x22f350[_0x024f('0x4b')]['id']){delete _0x22f350[_0x024f('0x4b')]['id'];}return db[_0x024f('0x2c')][_0x024f('0x4e')]({'where':{'id':_0x22f350[_0x024f('0x46')]['id']}})[_0x024f('0x26')](handleEntityNotFound(_0x1be9d9,null))['then'](function(_0x15663b){if(_0x15663b){_0x22f350[_0x024f('0x4b')][_0x024f('0x52')]=_0x15663b['id'];_0x22f350[_0x024f('0x4b')][_0x024f('0x53')]=integrations[_0x024f('0x54')](_0x22f350[_0x024f('0x4b')][_0x024f('0x55')],_0x22f350[_0x024f('0x4b')][_0x024f('0x2e')]);_0x22f350[_0x024f('0x4b')][_0x024f('0x56')]=integrations['getDescriptions'](_0x22f350['body']['channel'],_0x22f350[_0x024f('0x4b')][_0x024f('0x2e')]);return db['SugarcrmConfiguration']['create'](_0x22f350[_0x024f('0x4b')],{'include':[{'model':db[_0x024f('0x57')],'as':_0x024f('0x53')},{'model':db['SugarcrmField'],'as':_0x024f('0x56')}]});}return null;})[_0x024f('0x26')](respondWithResult(_0x1be9d9,null))['catch'](handleError(_0x1be9d9,null));};exports[_0x024f('0x58')]=function(_0x5c3448,_0x5d03cd,_0x2bdc4d){var _0x290f24='';var _0x533761=['id',_0x024f('0x29'),_0x024f('0x59'),_0x024f('0x5a'),'description',_0x024f('0x5b'),_0x024f('0x5c'),_0x024f('0x5d'),'parent_id',_0x024f('0x5e'),_0x024f('0x5f'),_0x024f('0x60')];return db[_0x024f('0x2c')][_0x024f('0x4e')]({'where':{'id':_0x5c3448[_0x024f('0x46')]['id']},'attributes':['id','username',_0x024f('0x61'),_0x024f('0x62')]})[_0x024f('0x26')](handleEntityNotFound(_0x5d03cd,null))[_0x024f('0x26')](function(_0x5bbc9b){if(_0x5bbc9b){_0x290f24=_0x5bbc9b['remoteUri'];var _0x4c249c=_0x290f24[_0x024f('0x63')](-0x1);if(_0x4c249c==='/'){_0x290f24=_0x290f24['substring'](0x0,_0x290f24[_0x024f('0x64')](_0x4c249c));}return rp({'method':_0x024f('0x65'),'uri':util[_0x024f('0x66')]('%s%s',_0x290f24,_0x024f('0x67')),'json':!![],'form':{'method':_0x024f('0x68'),'input_type':_0x024f('0x69'),'response_type':'JSON','rest_data':JSON[_0x024f('0x6a')]({'user_auth':{'user_name':_0x5bbc9b[_0x024f('0x6b')],'password':_0x5bbc9b[_0x024f('0x61')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x024f('0x26')](function(_0x455a50){if(_0x455a50&&_0x455a50[_0x024f('0x29')]!=='Invalid\x20Login'&&_0x455a50['name']!=='Password\x20Expired'){return rp({'method':_0x024f('0x65'),'uri':util[_0x024f('0x66')](_0x024f('0x6c'),_0x290f24,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':_0x024f('0x69'),'response_type':'JSON','rest_data':JSON[_0x024f('0x6a')]({'session':_0x455a50['id'],'module_name':_0x024f('0x6d')})}})['then'](function(_0xbf810a){if(_0xbf810a){var _0x1026aa=_[_0x024f('0x6e')](_0xbf810a[_0x024f('0x6f')]);_[_0x024f('0x70')](_0x1026aa,function(_0x53415d){return _0x533761['includes'](_0x53415d[_0x024f('0x29')]);});return{'count':_0x1026aa[_0x024f('0x36')],'rows':_[_0x024f('0x2b')](_0x1026aa,function(_0xd7c9ed){return{'id':_0xd7c9ed[_0x024f('0x29')],'name':_0xd7c9ed[_0x024f('0x71')],'custom':_[_0x024f('0x72')](_0xd7c9ed[_0x024f('0x29')],'_c')?!![]:![],'options':_0xd7c9ed[_0x024f('0x48')]?_[_0x024f('0x2b')](_[_0x024f('0x6e')](_0xd7c9ed['options']),function(_0x13a5e4){return{'name':_0x13a5e4[_0x024f('0x73')],'value':_0x13a5e4[_0x024f('0x29')]};}):[]};})};}})[_0x024f('0x26')](respondWithResult(_0x5d03cd,null))[_0x024f('0x44')](function(_0x19547d){var _0x3b24f5=_0x5c3448[_0x024f('0x32')][_0x024f('0x74')]?0x1f4:_0x19547d[_0x024f('0x75')]||0x1f4;logger[_0x024f('0x76')](_0x024f('0x77'),'getFields',_0x3b24f5,JSON['stringify'](_0x19547d));delete _0x19547d[_0x024f('0x29')];if(_0x3b24f5===0x191){_0x3b24f5=0x190;}_0x5d03cd['status'](_0x3b24f5)[_0x024f('0x2a')](_0x5c3448['query']['test']?{'message':_0x024f('0x78'),'statusCode':_0x19547d[_0x024f('0x75')]}:_0x19547d);});}else{var _0x31ac69=0x1f4;_0x5d03cd[_0x024f('0x1b')](_0x31ac69)[_0x024f('0x2a')]({'message':_0x024f('0x78'),'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 d54911b..20f87d5 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 _0x6c3d=['request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x3cdbe7,_0x3d6df1){var _0x38886e=function(_0x49bd6d){while(--_0x49bd6d){_0x3cdbe7['push'](_0x3cdbe7['shift']());}};_0x38886e(++_0x3d6df1);}(_0x6c3d,0x15b));var _0xd6c3=function(_0x23e7fc,_0x5f4a73){_0x23e7fc=_0x23e7fc-0x0;var _0x570ceb=_0x6c3d[_0x23e7fc];return _0x570ceb;};'use strict';var _=require(_0xd6c3('0x0'));var util=require(_0xd6c3('0x1'));var logger=require(_0xd6c3('0x2'))(_0xd6c3('0x3'));var moment=require('moment');var BPromise=require(_0xd6c3('0x4'));var rp=require(_0xd6c3('0x5'));var fs=require('fs');var path=require(_0xd6c3('0x6'));var rimraf=require('rimraf');var config=require(_0xd6c3('0x7'));var attributes=require(_0xd6c3('0x8'));var integrations=require(_0xd6c3('0x9'));module['exports']=function(_0x53b173,_0x2d8957){return _0x53b173['define'](_0xd6c3('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf54=['path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ec25b,_0x1c08ed){var _0x5b2f24=function(_0x6d88b3){while(--_0x6d88b3){_0x1ec25b['push'](_0x1ec25b['shift']());}};_0x5b2f24(++_0x1c08ed);}(_0xcf54,0x125));var _0x4cf5=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0xcf54[_0xee5d2a];return _0x346948;};'use strict';var _=require('lodash');var util=require(_0x4cf5('0x0'));var logger=require(_0x4cf5('0x1'))(_0x4cf5('0x2'));var moment=require(_0x4cf5('0x3'));var BPromise=require(_0x4cf5('0x4'));var rp=require(_0x4cf5('0x5'));var fs=require('fs');var path=require(_0x4cf5('0x6'));var rimraf=require('rimraf');var config=require(_0x4cf5('0x7'));var attributes=require(_0x4cf5('0x8'));var integrations=require(_0x4cf5('0x9'));module[_0x4cf5('0xa')]=function(_0x76b42b,_0x55eae8){return _0x76b42b[_0x4cf5('0xb')](_0x4cf5('0xc'),attributes,{'tableName':'int_sugarcrm_accounts','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 40b6975..7a0d534 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 _0xd0ed=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','stringify','find','raw','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','SugarcrmAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info'];(function(_0x5e8319,_0x54cab4){var _0xac40f=function(_0xfce964){while(--_0xfce964){_0x5e8319['push'](_0x5e8319['shift']());}};_0xac40f(++_0x54cab4);}(_0xd0ed,0x11f));var _0xdd0e=function(_0x255232,_0x140aa3){_0x255232=_0x255232-0x0;var _0x19a7f3=_0xd0ed[_0x255232];return _0x19a7f3;};'use strict';var _=require(_0xdd0e('0x0'));var util=require(_0xdd0e('0x1'));var moment=require(_0xdd0e('0x2'));var BPromise=require(_0xdd0e('0x3'));var rs=require(_0xdd0e('0x4'));var fs=require('fs');var Redis=require(_0xdd0e('0x5'));var db=require(_0xdd0e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdd0e('0x7'));var config=require('../../config/environment');var jayson=require(_0xdd0e('0x8'));var client=jayson['client'][_0xdd0e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54d723,_0x3de119,_0xa8ce){return new BPromise(function(_0x5b42ec,_0x5737aa){return client[_0xdd0e('0xa')](_0x54d723,_0xa8ce)[_0xdd0e('0xb')](function(_0x5b47c6){logger['info'](_0xdd0e('0xc'),_0x3de119,'request\x20sent');logger[_0xdd0e('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3de119,_0xdd0e('0xe'),JSON['stringify'](_0x5b47c6));if(_0x5b47c6[_0xdd0e('0xf')]){if(_0x5b47c6[_0xdd0e('0xf')][_0xdd0e('0x10')]===0x1f4){logger[_0xdd0e('0xf')](_0xdd0e('0xc'),_0x3de119,_0x5b47c6[_0xdd0e('0xf')][_0xdd0e('0x11')]);return _0x5737aa(_0x5b47c6[_0xdd0e('0xf')]['message']);}logger[_0xdd0e('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3de119,_0x5b47c6[_0xdd0e('0xf')][_0xdd0e('0x11')]);return _0x5b42ec(_0x5b47c6[_0xdd0e('0xf')]['message']);}else{logger[_0xdd0e('0x12')](_0xdd0e('0xc'),_0x3de119,_0xdd0e('0xe'));_0x5b42ec(_0x5b47c6[_0xdd0e('0x13')][_0xdd0e('0x11')]);}})[_0xdd0e('0x14')](function(_0x3dc207){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3de119,_0x3dc207);_0x5737aa(_0x3dc207);});});}exports[_0xdd0e('0x15')]=function(_0x1269c1){var _0x114d5c=this;return new Promise(function(_0xaf54c1,_0x384e82){return db[_0xdd0e('0x16')][_0xdd0e('0x17')]({'raw':_0x1269c1[_0xdd0e('0x18')]?_0x1269c1[_0xdd0e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1269c1[_0xdd0e('0x18')]?_0x1269c1['options'][_0xdd0e('0x19')]||null:null,'attributes':_0x1269c1[_0xdd0e('0x18')]?_0x1269c1[_0xdd0e('0x18')][_0xdd0e('0x1a')]||null:null,'limit':_0x1269c1[_0xdd0e('0x18')]?_0x1269c1[_0xdd0e('0x18')]['limit']||null:null,'include':_0x1269c1[_0xdd0e('0x18')]?_0x1269c1[_0xdd0e('0x18')][_0xdd0e('0x1b')]?_[_0xdd0e('0x1c')](_0x1269c1[_0xdd0e('0x18')][_0xdd0e('0x1b')],function(_0x45ebe8){return{'model':db[_0x45ebe8[_0xdd0e('0x1d')]],'as':_0x45ebe8['as'],'attributes':_0x45ebe8[_0xdd0e('0x1a')],'include':_0x45ebe8[_0xdd0e('0x1b')]?_[_0xdd0e('0x1c')](_0x45ebe8[_0xdd0e('0x1b')],function(_0x1e4828){return{'model':db[_0x1e4828['model']],'as':_0x1e4828['as'],'attributes':_0x1e4828[_0xdd0e('0x1a')],'include':_0x1e4828[_0xdd0e('0x1b')]?_[_0xdd0e('0x1c')](_0x1e4828[_0xdd0e('0x1b')],function(_0x2dcd9f){return{'model':db[_0x2dcd9f[_0xdd0e('0x1d')]],'as':_0x2dcd9f['as'],'attributes':_0x2dcd9f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2524e5){logger[_0xdd0e('0x12')](_0xdd0e('0x15'),_0x1269c1);logger[_0xdd0e('0xd')](_0xdd0e('0x15'),_0x1269c1,JSON[_0xdd0e('0x1e')](_0x2524e5));_0xaf54c1(_0x2524e5);})[_0xdd0e('0x14')](function(_0xd4312e){logger[_0xdd0e('0xf')](_0xdd0e('0x15'),_0xd4312e[_0xdd0e('0x11')],_0x1269c1);_0x384e82(_0x114d5c[_0xdd0e('0xf')](0x1f4,_0xd4312e[_0xdd0e('0x11')]));});});};exports['ShowSugarcrmAccount']=function(_0x425784){var _0x5413e0=this;return new Promise(function(_0x245ec3,_0x3c0592){return db[_0xdd0e('0x16')][_0xdd0e('0x1f')]({'raw':_0x425784[_0xdd0e('0x18')]?_0x425784[_0xdd0e('0x18')][_0xdd0e('0x20')]===undefined?!![]:![]:!![],'where':_0x425784['options']?_0x425784[_0xdd0e('0x18')][_0xdd0e('0x19')]||null:null,'attributes':_0x425784[_0xdd0e('0x18')]?_0x425784['options']['attributes']||null:null,'include':_0x425784[_0xdd0e('0x18')]?_0x425784[_0xdd0e('0x18')][_0xdd0e('0x1b')]?_['map'](_0x425784[_0xdd0e('0x18')][_0xdd0e('0x1b')],function(_0x32ab93){return{'model':db[_0x32ab93[_0xdd0e('0x1d')]],'as':_0x32ab93['as'],'attributes':_0x32ab93[_0xdd0e('0x1a')],'include':_0x32ab93[_0xdd0e('0x1b')]?_['map'](_0x32ab93[_0xdd0e('0x1b')],function(_0x2049b4){return{'model':db[_0x2049b4[_0xdd0e('0x1d')]],'as':_0x2049b4['as'],'attributes':_0x2049b4['attributes'],'include':_0x2049b4[_0xdd0e('0x1b')]?_[_0xdd0e('0x1c')](_0x2049b4[_0xdd0e('0x1b')],function(_0x54e5e1){return{'model':db[_0x54e5e1[_0xdd0e('0x1d')]],'as':_0x54e5e1['as'],'attributes':_0x54e5e1['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd0e('0xb')](function(_0x30f38e){logger[_0xdd0e('0x12')](_0xdd0e('0x21'),_0x425784);logger['debug'](_0xdd0e('0x21'),_0x425784,JSON[_0xdd0e('0x1e')](_0x30f38e));_0x245ec3(_0x30f38e);})[_0xdd0e('0x14')](function(_0x1b416d){logger['error'](_0xdd0e('0x21'),_0x1b416d['message'],_0x425784);_0x3c0592(_0x5413e0['error'](0x1f4,_0x1b416d[_0xdd0e('0x11')]));});});}; \ No newline at end of file +var _0x7c95=['model','then','GetSugarcrmAccount','debug','find','where','ShowSugarcrmAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','http','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','SugarcrmAccount','raw','options','attributes','limit','map','include'];(function(_0x477f68,_0x30d874){var _0xc1fd7d=function(_0xa3862b){while(--_0xa3862b){_0x477f68['push'](_0x477f68['shift']());}};_0xc1fd7d(++_0x30d874);}(_0x7c95,0x1e7));var _0x57c9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x7c95[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x57c9('0x0'));var util=require('util');var moment=require(_0x57c9('0x1'));var BPromise=require(_0x57c9('0x2'));var rs=require(_0x57c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x57c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x57c9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x57c9('0x6'));var client=jayson['client'][_0x57c9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23d50f,_0x18b3ae,_0x41fe63){return new BPromise(function(_0x33814e,_0x427ba7){return client['request'](_0x23d50f,_0x41fe63)['then'](function(_0x296122){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x18b3ae,_0x57c9('0x8'));logger['debug'](_0x57c9('0x9'),_0x18b3ae,_0x57c9('0x8'),JSON[_0x57c9('0xa')](_0x296122));if(_0x296122[_0x57c9('0xb')]){if(_0x296122['error'][_0x57c9('0xc')]===0x1f4){logger['error'](_0x57c9('0xd'),_0x18b3ae,_0x296122[_0x57c9('0xb')][_0x57c9('0xe')]);return _0x427ba7(_0x296122['error'][_0x57c9('0xe')]);}logger[_0x57c9('0xb')](_0x57c9('0xd'),_0x18b3ae,_0x296122[_0x57c9('0xb')][_0x57c9('0xe')]);return _0x33814e(_0x296122[_0x57c9('0xb')]['message']);}else{logger[_0x57c9('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x18b3ae,_0x57c9('0x8'));_0x33814e(_0x296122[_0x57c9('0x10')][_0x57c9('0xe')]);}})[_0x57c9('0x11')](function(_0x284f6f){logger[_0x57c9('0xb')](_0x57c9('0xd'),_0x18b3ae,_0x284f6f);_0x427ba7(_0x284f6f);});});}exports['GetSugarcrmAccount']=function(_0x547a7f){var _0x3ff633=this;return new Promise(function(_0x9e5c50,_0x5ce9ae){return db[_0x57c9('0x12')]['findAll']({'raw':_0x547a7f['options']?_0x547a7f['options'][_0x57c9('0x13')]===undefined?!![]:![]:!![],'where':_0x547a7f['options']?_0x547a7f[_0x57c9('0x14')]['where']||null:null,'attributes':_0x547a7f[_0x57c9('0x14')]?_0x547a7f[_0x57c9('0x14')][_0x57c9('0x15')]||null:null,'limit':_0x547a7f[_0x57c9('0x14')]?_0x547a7f[_0x57c9('0x14')][_0x57c9('0x16')]||null:null,'include':_0x547a7f[_0x57c9('0x14')]?_0x547a7f['options']['include']?_[_0x57c9('0x17')](_0x547a7f[_0x57c9('0x14')][_0x57c9('0x18')],function(_0x2d1a85){return{'model':db[_0x2d1a85[_0x57c9('0x19')]],'as':_0x2d1a85['as'],'attributes':_0x2d1a85[_0x57c9('0x15')],'include':_0x2d1a85[_0x57c9('0x18')]?_[_0x57c9('0x17')](_0x2d1a85[_0x57c9('0x18')],function(_0xa0a152){return{'model':db[_0xa0a152['model']],'as':_0xa0a152['as'],'attributes':_0xa0a152[_0x57c9('0x15')],'include':_0xa0a152['include']?_['map'](_0xa0a152[_0x57c9('0x18')],function(_0x303c38){return{'model':db[_0x303c38[_0x57c9('0x19')]],'as':_0x303c38['as'],'attributes':_0x303c38[_0x57c9('0x15')]};}):[]};}):[]};}):[]:[]})[_0x57c9('0x1a')](function(_0x540975){logger[_0x57c9('0xf')](_0x57c9('0x1b'),_0x547a7f);logger[_0x57c9('0x1c')]('GetSugarcrmAccount',_0x547a7f,JSON[_0x57c9('0xa')](_0x540975));_0x9e5c50(_0x540975);})[_0x57c9('0x11')](function(_0x438c0c){logger[_0x57c9('0xb')](_0x57c9('0x1b'),_0x438c0c[_0x57c9('0xe')],_0x547a7f);_0x5ce9ae(_0x3ff633[_0x57c9('0xb')](0x1f4,_0x438c0c[_0x57c9('0xe')]));});});};exports['ShowSugarcrmAccount']=function(_0x3f5f45){var _0xd8ff60=this;return new Promise(function(_0x55086b,_0x1cdf61){return db['SugarcrmAccount'][_0x57c9('0x1d')]({'raw':_0x3f5f45['options']?_0x3f5f45[_0x57c9('0x14')][_0x57c9('0x13')]===undefined?!![]:![]:!![],'where':_0x3f5f45[_0x57c9('0x14')]?_0x3f5f45['options'][_0x57c9('0x1e')]||null:null,'attributes':_0x3f5f45[_0x57c9('0x14')]?_0x3f5f45[_0x57c9('0x14')][_0x57c9('0x15')]||null:null,'include':_0x3f5f45[_0x57c9('0x14')]?_0x3f5f45[_0x57c9('0x14')]['include']?_['map'](_0x3f5f45['options'][_0x57c9('0x18')],function(_0x5783da){return{'model':db[_0x5783da['model']],'as':_0x5783da['as'],'attributes':_0x5783da[_0x57c9('0x15')],'include':_0x5783da[_0x57c9('0x18')]?_['map'](_0x5783da[_0x57c9('0x18')],function(_0x4e739c){return{'model':db[_0x4e739c[_0x57c9('0x19')]],'as':_0x4e739c['as'],'attributes':_0x4e739c[_0x57c9('0x15')],'include':_0x4e739c[_0x57c9('0x18')]?_['map'](_0x4e739c[_0x57c9('0x18')],function(_0x20ebe5){return{'model':db[_0x20ebe5[_0x57c9('0x19')]],'as':_0x20ebe5['as'],'attributes':_0x20ebe5[_0x57c9('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xea5660){logger[_0x57c9('0xf')](_0x57c9('0x1f'),_0x3f5f45);logger[_0x57c9('0x1c')](_0x57c9('0x1f'),_0x3f5f45,JSON[_0x57c9('0xa')](_0xea5660));_0x55086b(_0xea5660);})['catch'](function(_0x7ae81b){logger[_0x57c9('0xb')](_0x57c9('0x1f'),_0x7ae81b['message'],_0x3f5f45);_0x1cdf61(_0xd8ff60[_0x57c9('0xb')](0x1f4,_0x7ae81b[_0x57c9('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f1f06ba..fb8f68c 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 _0x503d=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','post','create','put','update','delete','destroy','util'];(function(_0x3c43f6,_0x429058){var _0x5677a4=function(_0x13b06b){while(--_0x13b06b){_0x3c43f6['push'](_0x3c43f6['shift']());}};_0x5677a4(++_0x429058);}(_0x503d,0x6d));var _0xd503=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x503d[_0x5c78d9];return _0x69ae1f;};'use strict';var multer=require('multer');var util=require(_0xd503('0x0'));var path=require(_0xd503('0x1'));var timeout=require(_0xd503('0x2'));var express=require(_0xd503('0x3'));var router=express['Router']();var fs_extra=require(_0xd503('0x4'));var auth=require(_0xd503('0x5'));var interaction=require(_0xd503('0x6'));var config=require(_0xd503('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xd503('0x8')]('/',auth[_0xd503('0x9')](),controller['index']);router[_0xd503('0x8')](_0xd503('0xa'),auth['isAuthenticated'](),controller[_0xd503('0xb')]);router['get'](_0xd503('0xc'),auth[_0xd503('0x9')](),controller[_0xd503('0xd')]);router[_0xd503('0x8')](_0xd503('0xe'),auth[_0xd503('0x9')](),controller[_0xd503('0xf')]);router[_0xd503('0x8')]('/:id/descriptions',auth[_0xd503('0x9')](),controller['getDescriptions']);router[_0xd503('0x10')]('/',auth['isAuthenticated'](),controller[_0xd503('0x11')]);router[_0xd503('0x12')]('/:id',auth[_0xd503('0x9')](),controller[_0xd503('0x13')]);router[_0xd503('0x14')](_0xd503('0xa'),auth[_0xd503('0x9')](),controller[_0xd503('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0554=['Router','fs-extra','../../components/auth/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x350796,_0x1bf21f){var _0x126f19=function(_0x4d7591){while(--_0x4d7591){_0x350796['push'](_0x350796['shift']());}};_0x126f19(++_0x1bf21f);}(_0x0554,0x85));var _0x4055=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x0554[_0x4e9628];return _0x27bc8c;};'use strict';var multer=require(_0x4055('0x0'));var util=require(_0x4055('0x1'));var path=require(_0x4055('0x2'));var timeout=require(_0x4055('0x3'));var express=require(_0x4055('0x4'));var router=express[_0x4055('0x5')]();var fs_extra=require(_0x4055('0x6'));var auth=require(_0x4055('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4055('0x8'));router['get']('/',auth[_0x4055('0x9')](),controller[_0x4055('0xa')]);router[_0x4055('0xb')](_0x4055('0xc'),auth[_0x4055('0x9')](),controller[_0x4055('0xd')]);router[_0x4055('0xb')]('/:id/fields',auth[_0x4055('0x9')](),controller[_0x4055('0xe')]);router[_0x4055('0xb')](_0x4055('0xf'),auth[_0x4055('0x9')](),controller[_0x4055('0x10')]);router['get'](_0x4055('0x11'),auth[_0x4055('0x9')](),controller[_0x4055('0x12')]);router['post']('/',auth[_0x4055('0x9')](),controller['create']);router[_0x4055('0x13')](_0x4055('0xc'),auth[_0x4055('0x9')](),controller[_0x4055('0x14')]);router['delete']('/:id',auth[_0x4055('0x9')](),controller[_0x4055('0x15')]);module[_0x4055('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7113649..b350e06 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 _0x187d=['STRING','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x187d,0x154));var _0xd187=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x187d[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0xd187('0x0'));module[_0xd187('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd187('0x2')]}}; \ No newline at end of file +var _0xdfa1=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfa1,0x132));var _0x1dfa=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xdfa1[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require('sequelize');module[_0x1dfa('0x0')]={'name':{'type':Sequelize[_0x1dfa('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f56ff41..5e8613b 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 _0x550b=['moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','findOne','SugarcrmField','pick','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x32f649,_0x4ccb75){var _0x5009ff=function(_0x3d4d1a){while(--_0x3d4d1a){_0x32f649['push'](_0x32f649['shift']());}};_0x5009ff(++_0x4ccb75);}(_0x550b,0x143));var _0xb550=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x550b[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xb550('0x0'));var rimraf=require(_0xb550('0x1'));var zipdir=require(_0xb550('0x2'));var jsonpatch=require(_0xb550('0x3'));var rp=require(_0xb550('0x4'));var moment=require(_0xb550('0x5'));var BPromise=require(_0xb550('0x6'));var Mustache=require(_0xb550('0x7'));var util=require(_0xb550('0x8'));var path=require('path');var sox=require(_0xb550('0x9'));var csv=require(_0xb550('0xa'));var ejs=require(_0xb550('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb550('0xc'));var squel=require(_0xb550('0xd'));var crypto=require('crypto');var jsforce=require(_0xb550('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb550('0xa'));var querystring=require(_0xb550('0xf'));var Papa=require('papaparse');var Redis=require(_0xb550('0x10'));var authService=require(_0xb550('0x11'));var qs=require(_0xb550('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb550('0x13'));var logger=require('../../config/logger')(_0xb550('0x14'));var utils=require(_0xb550('0x15'));var config=require(_0xb550('0x16'));var licenseUtil=require(_0xb550('0x17'));var db=require(_0xb550('0x18'))['db'];function respondWithStatusCode(_0x5b3956,_0xc62e71){_0xc62e71=_0xc62e71||0xcc;return function(_0x151752){if(_0x151752){return _0x5b3956[_0xb550('0x19')](_0xc62e71);}return _0x5b3956[_0xb550('0x1a')](_0xc62e71)[_0xb550('0x1b')]();};}function respondWithResult(_0x3d755f,_0x1bbd32){_0x1bbd32=_0x1bbd32||0xc8;return function(_0xfd65ba){if(_0xfd65ba){return _0x3d755f[_0xb550('0x1a')](_0x1bbd32)[_0xb550('0x1c')](_0xfd65ba);}};}function respondWithFilteredResult(_0x5cd4b8,_0x3ae1e0){return function(_0x4caf60){if(_0x4caf60){var _0x7af679=typeof _0x3ae1e0[_0xb550('0x1d')]===_0xb550('0x1e')&&typeof _0x3ae1e0['limit']===_0xb550('0x1e');var _0x1b59c1=_0x4caf60[_0xb550('0x1f')];var _0x1be93b=_0x7af679?0x0:_0x3ae1e0['offset'];var _0x1f5516=_0x7af679?_0x4caf60['count']:_0x3ae1e0[_0xb550('0x1d')]+_0x3ae1e0['limit'];var _0x2c8fe8;if(_0x1f5516>=_0x1b59c1){_0x1f5516=_0x1b59c1;_0x2c8fe8=0xc8;}else{_0x2c8fe8=0xce;}_0x5cd4b8[_0xb550('0x1a')](_0x2c8fe8);return _0x5cd4b8[_0xb550('0x20')](_0xb550('0x21'),_0x1be93b+'-'+_0x1f5516+'/'+_0x1b59c1)[_0xb550('0x1c')](_0x4caf60);}return null;};}function patchUpdates(_0x4ed60c){return function(_0xfaf75e){try{jsonpatch[_0xb550('0x22')](_0xfaf75e,_0x4ed60c,!![]);}catch(_0x3e4924){return BPromise[_0xb550('0x23')](_0x3e4924);}return _0xfaf75e[_0xb550('0x24')]();};}function saveUpdates(_0x143581,_0xd4a3b4){return function(_0x4cc3fe){if(_0x4cc3fe){return _0x4cc3fe['update'](_0x143581)[_0xb550('0x25')](function(_0x8c3a45){return _0x8c3a45;});}return null;};}function removeEntity(_0x1fdabe,_0x55a4c3){return function(_0x2f009f){if(_0x2f009f){return _0x2f009f['destroy']()[_0xb550('0x25')](function(){_0x1fdabe['status'](0xcc)[_0xb550('0x1b')]();});}};}function handleEntityNotFound(_0x204475,_0x2f7d4e){return function(_0x14a4a1){if(!_0x14a4a1){_0x204475[_0xb550('0x19')](0x194);}return _0x14a4a1;};}function handleError(_0x389873,_0x3f8a72){_0x3f8a72=_0x3f8a72||0x1f4;return function(_0x366068){logger[_0xb550('0x26')](_0x366068[_0xb550('0x27')]);if(_0x366068[_0xb550('0x28')]){delete _0x366068[_0xb550('0x28')];}_0x389873['status'](_0x3f8a72)[_0xb550('0x29')](_0x366068);};}exports['index']=function(_0x3c7358,_0x38ecbd){var _0x458e66={},_0xa02e2a={},_0x30ca7a={'count':0x0,'rows':[]};var _0x2a0768=_[_0xb550('0x2a')](db[_0xb550('0x2b')][_0xb550('0x2c')],function(_0x273252){return{'name':_0x273252[_0xb550('0x2d')],'type':_0x273252[_0xb550('0x2e')]['key']};});_0xa02e2a[_0xb550('0x2f')]=_[_0xb550('0x2a')](_0x2a0768,'name');_0xa02e2a['query']=_[_0xb550('0x30')](_0x3c7358[_0xb550('0x31')]);_0xa02e2a[_0xb550('0x32')]=_[_0xb550('0x33')](_0xa02e2a[_0xb550('0x2f')],_0xa02e2a['query']);_0x458e66['attributes']=_[_0xb550('0x33')](_0xa02e2a['model'],qs[_0xb550('0x34')](_0x3c7358['query'][_0xb550('0x34')]));_0x458e66['attributes']=_0x458e66[_0xb550('0x35')][_0xb550('0x36')]?_0x458e66['attributes']:_0xa02e2a['model'];if(!_0x3c7358[_0xb550('0x31')]['hasOwnProperty'](_0xb550('0x37'))){_0x458e66[_0xb550('0x38')]=qs['limit'](_0x3c7358['query'][_0xb550('0x38')]);_0x458e66[_0xb550('0x1d')]=qs[_0xb550('0x1d')](_0x3c7358[_0xb550('0x31')]['offset']);}_0x458e66[_0xb550('0x39')]=qs['sort'](_0x3c7358[_0xb550('0x31')][_0xb550('0x3a')]);_0x458e66[_0xb550('0x3b')]=qs[_0xb550('0x32')](_['pick'](_0x3c7358[_0xb550('0x31')],_0xa02e2a['filters']),_0x2a0768);if(_0x3c7358[_0xb550('0x31')][_0xb550('0x3c')]){_0x458e66[_0xb550('0x3b')]=_[_0xb550('0x3d')](_0x458e66[_0xb550('0x3b')],{'$or':_[_0xb550('0x2a')](_0x2a0768,function(_0x2916eb){if(_0x2916eb['type']!==_0xb550('0x3e')){var _0x3b4a70={};_0x3b4a70[_0x2916eb[_0xb550('0x28')]]={'$like':'%'+_0x3c7358['query']['filter']+'%'};return _0x3b4a70;}})});}_0x458e66=_['merge']({},_0x458e66,_0x3c7358['options']);var _0x42126b={'where':_0x458e66[_0xb550('0x3b')]};return db[_0xb550('0x2b')]['count'](_0x42126b)[_0xb550('0x25')](function(_0x4a304c){_0x30ca7a[_0xb550('0x1f')]=_0x4a304c;if(_0x3c7358['query']['includeAll']){_0x458e66[_0xb550('0x3f')]=[{'all':!![]}];}return db[_0xb550('0x2b')][_0xb550('0x40')](_0x458e66);})[_0xb550('0x25')](function(_0x4bdf1f){_0x30ca7a[_0xb550('0x41')]=_0x4bdf1f;return _0x30ca7a;})[_0xb550('0x25')](respondWithFilteredResult(_0x38ecbd,_0x458e66))[_0xb550('0x42')](handleError(_0x38ecbd,null));};exports[_0xb550('0x43')]=function(_0x3efedd,_0x59555f){var _0x33efdf={'raw':![],'where':{'id':_0x3efedd[_0xb550('0x44')]['id']}},_0x2380c0={};_0x2380c0['model']=_['keys'](db[_0xb550('0x2b')][_0xb550('0x2c')]);_0x2380c0[_0xb550('0x31')]=_['keys'](_0x3efedd[_0xb550('0x31')]);_0x2380c0[_0xb550('0x32')]=_[_0xb550('0x33')](_0x2380c0[_0xb550('0x2f')],_0x2380c0['query']);_0x33efdf[_0xb550('0x35')]=_[_0xb550('0x33')](_0x2380c0[_0xb550('0x2f')],qs[_0xb550('0x34')](_0x3efedd[_0xb550('0x31')]['fields']));_0x33efdf[_0xb550('0x35')]=_0x33efdf[_0xb550('0x35')][_0xb550('0x36')]?_0x33efdf[_0xb550('0x35')]:_0x2380c0[_0xb550('0x2f')];if(_0x3efedd['query'][_0xb550('0x45')]){_0x33efdf[_0xb550('0x3f')]=[{'all':!![]}];}_0x33efdf=_[_0xb550('0x3d')]({},_0x33efdf,_0x3efedd[_0xb550('0x46')]);return db[_0xb550('0x2b')][_0xb550('0x47')](_0x33efdf)[_0xb550('0x25')](handleEntityNotFound(_0x59555f,null))[_0xb550('0x25')](respondWithResult(_0x59555f,null))[_0xb550('0x42')](handleError(_0x59555f,null));};exports[_0xb550('0x48')]=function(_0x12481d,_0x24dbb7){return db[_0xb550('0x2b')]['create'](_0x12481d[_0xb550('0x49')],{})[_0xb550('0x25')](respondWithResult(_0x24dbb7,0xc9))[_0xb550('0x42')](handleError(_0x24dbb7,null));};exports['update']=function(_0x476079,_0x25f03f){if(_0x476079[_0xb550('0x49')]['id']){delete _0x476079[_0xb550('0x49')]['id'];}return db['SugarcrmConfiguration'][_0xb550('0x47')]({'where':{'id':_0x476079['params']['id']}})[_0xb550('0x25')](handleEntityNotFound(_0x25f03f,null))[_0xb550('0x25')](saveUpdates(_0x476079[_0xb550('0x49')],null))['then'](respondWithResult(_0x25f03f,null))[_0xb550('0x42')](handleError(_0x25f03f,null));};exports[_0xb550('0x4a')]=function(_0x4ef120,_0x34ed11){return db[_0xb550('0x2b')][_0xb550('0x47')]({'where':{'id':_0x4ef120[_0xb550('0x44')]['id']}})[_0xb550('0x25')](handleEntityNotFound(_0x34ed11,null))[_0xb550('0x25')](removeEntity(_0x34ed11,null))[_0xb550('0x42')](handleError(_0x34ed11,null));};exports['getFields']=function(_0x4482b9,_0x24b1d0,_0x283a23){var _0x1299ec={};var _0x30016a={};var _0x4b9bb5;var _0x2eb1f7;return db['SugarcrmConfiguration'][_0xb550('0x4b')]({'where':{'id':_0x4482b9[_0xb550('0x44')]['id']}})[_0xb550('0x25')](handleEntityNotFound(_0x24b1d0,null))[_0xb550('0x25')](function(_0x577f7d){if(_0x577f7d){_0x4b9bb5=_0x577f7d;_0x30016a[_0xb550('0x2f')]=_[_0xb550('0x30')](db[_0xb550('0x4c')][_0xb550('0x2c')]);_0x30016a[_0xb550('0x31')]=_[_0xb550('0x30')](_0x4482b9[_0xb550('0x31')]);_0x30016a[_0xb550('0x32')]=_[_0xb550('0x33')](_0x30016a[_0xb550('0x2f')],_0x30016a[_0xb550('0x31')]);_0x1299ec[_0xb550('0x35')]=_[_0xb550('0x33')](_0x30016a[_0xb550('0x2f')],qs[_0xb550('0x34')](_0x4482b9[_0xb550('0x31')][_0xb550('0x34')]));_0x1299ec[_0xb550('0x35')]=_0x1299ec[_0xb550('0x35')][_0xb550('0x36')]?_0x1299ec['attributes']:_0x30016a[_0xb550('0x2f')];_0x1299ec[_0xb550('0x39')]=qs['sort'](_0x4482b9[_0xb550('0x31')][_0xb550('0x3a')]);_0x1299ec['where']=qs[_0xb550('0x32')](_[_0xb550('0x4d')](_0x4482b9['query'],_0x30016a[_0xb550('0x32')]));if(_0x4482b9[_0xb550('0x31')][_0xb550('0x3c')]){_0x1299ec[_0xb550('0x3b')]=_['merge'](_0x1299ec['where'],{'$or':_['map'](_0x1299ec[_0xb550('0x35')],function(_0x59cd53){var _0x32bbd={};_0x32bbd[_0x59cd53]={'$like':'%'+_0x4482b9[_0xb550('0x31')][_0xb550('0x3c')]+'%'};return _0x32bbd;})});}_0x1299ec=_[_0xb550('0x3d')]({},_0x1299ec,_0x4482b9[_0xb550('0x46')]);return _0x4b9bb5['getFields'](_0x1299ec);}})[_0xb550('0x25')](function(_0xbe575b){if(_0xbe575b){_0x2eb1f7=_0xbe575b[_0xb550('0x36')];if(!_0x4482b9[_0xb550('0x31')][_0xb550('0x4e')](_0xb550('0x37'))){_0x1299ec['limit']=qs[_0xb550('0x38')](_0x4482b9[_0xb550('0x31')][_0xb550('0x38')]);_0x1299ec['offset']=qs['offset'](_0x4482b9[_0xb550('0x31')][_0xb550('0x1d')]);}return _0x4b9bb5[_0xb550('0x4f')](_0x1299ec);}})[_0xb550('0x25')](function(_0x5c6ae4){if(_0x5c6ae4){return _0x5c6ae4?{'count':_0x2eb1f7,'rows':_0x5c6ae4}:null;}})['then'](respondWithResult(_0x24b1d0,null))['catch'](handleError(_0x24b1d0,null));};exports[_0xb550('0x50')]=function(_0xb28378,_0x2f562b,_0x2758d8){var _0x430ef5={};var _0x2590b3={};var _0x5666aa;var _0x1d5885;return db[_0xb550('0x2b')][_0xb550('0x4b')]({'where':{'id':_0xb28378[_0xb550('0x44')]['id']}})[_0xb550('0x25')](handleEntityNotFound(_0x2f562b,null))[_0xb550('0x25')](function(_0x371c5d){if(_0x371c5d){_0x5666aa=_0x371c5d;_0x2590b3[_0xb550('0x2f')]=_[_0xb550('0x30')](db[_0xb550('0x4c')][_0xb550('0x2c')]);_0x2590b3[_0xb550('0x31')]=_[_0xb550('0x30')](_0xb28378['query']);_0x2590b3[_0xb550('0x32')]=_[_0xb550('0x33')](_0x2590b3[_0xb550('0x2f')],_0x2590b3[_0xb550('0x31')]);_0x430ef5['attributes']=_[_0xb550('0x33')](_0x2590b3[_0xb550('0x2f')],qs[_0xb550('0x34')](_0xb28378[_0xb550('0x31')][_0xb550('0x34')]));_0x430ef5[_0xb550('0x35')]=_0x430ef5[_0xb550('0x35')]['length']?_0x430ef5[_0xb550('0x35')]:_0x2590b3[_0xb550('0x2f')];_0x430ef5[_0xb550('0x39')]=qs[_0xb550('0x3a')](_0xb28378['query'][_0xb550('0x3a')]);_0x430ef5['where']=qs['filters'](_[_0xb550('0x4d')](_0xb28378[_0xb550('0x31')],_0x2590b3[_0xb550('0x32')]));if(_0xb28378[_0xb550('0x31')][_0xb550('0x3c')]){_0x430ef5[_0xb550('0x3b')]=_[_0xb550('0x3d')](_0x430ef5[_0xb550('0x3b')],{'$or':_[_0xb550('0x2a')](_0x430ef5[_0xb550('0x35')],function(_0xcdb375){var _0x13842e={};_0x13842e[_0xcdb375]={'$like':'%'+_0xb28378[_0xb550('0x31')][_0xb550('0x3c')]+'%'};return _0x13842e;})});}_0x430ef5=_[_0xb550('0x3d')]({},_0x430ef5,_0xb28378[_0xb550('0x46')]);return _0x5666aa[_0xb550('0x50')](_0x430ef5);}})[_0xb550('0x25')](function(_0x56fc6e){if(_0x56fc6e){_0x1d5885=_0x56fc6e[_0xb550('0x36')];if(!_0xb28378['query'][_0xb550('0x4e')](_0xb550('0x37'))){_0x430ef5[_0xb550('0x38')]=qs[_0xb550('0x38')](_0xb28378[_0xb550('0x31')][_0xb550('0x38')]);_0x430ef5[_0xb550('0x1d')]=qs[_0xb550('0x1d')](_0xb28378[_0xb550('0x31')][_0xb550('0x1d')]);}return _0x5666aa[_0xb550('0x50')](_0x430ef5);}})[_0xb550('0x25')](function(_0x21d4c0){if(_0x21d4c0){return _0x21d4c0?{'count':_0x1d5885,'rows':_0x21d4c0}:null;}})[_0xb550('0x25')](respondWithResult(_0x2f562b,null))[_0xb550('0x42')](handleError(_0x2f562b,null));};exports[_0xb550('0x51')]=function(_0x25fc73,_0x1d321c,_0x568f6e){var _0x18b251={};var _0x19e805={};var _0x38a4ed;var _0xa8dcf4;return db[_0xb550('0x2b')][_0xb550('0x4b')]({'where':{'id':_0x25fc73[_0xb550('0x44')]['id']}})[_0xb550('0x25')](handleEntityNotFound(_0x1d321c,null))[_0xb550('0x25')](function(_0x51d132){if(_0x51d132){_0x38a4ed=_0x51d132;_0x19e805[_0xb550('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x19e805['query']=_[_0xb550('0x30')](_0x25fc73[_0xb550('0x31')]);_0x19e805[_0xb550('0x32')]=_['intersection'](_0x19e805[_0xb550('0x2f')],_0x19e805[_0xb550('0x31')]);_0x18b251[_0xb550('0x35')]=_['intersection'](_0x19e805['model'],qs[_0xb550('0x34')](_0x25fc73['query']['fields']));_0x18b251[_0xb550('0x35')]=_0x18b251['attributes'][_0xb550('0x36')]?_0x18b251[_0xb550('0x35')]:_0x19e805[_0xb550('0x2f')];_0x18b251[_0xb550('0x39')]=qs[_0xb550('0x3a')](_0x25fc73[_0xb550('0x31')][_0xb550('0x3a')]);_0x18b251[_0xb550('0x3b')]=qs[_0xb550('0x32')](_['pick'](_0x25fc73[_0xb550('0x31')],_0x19e805[_0xb550('0x32')]));if(_0x25fc73[_0xb550('0x31')][_0xb550('0x3c')]){_0x18b251[_0xb550('0x3b')]=_[_0xb550('0x3d')](_0x18b251[_0xb550('0x3b')],{'$or':_['map'](_0x18b251['attributes'],function(_0x13d27b){var _0x346b56={};_0x346b56[_0x13d27b]={'$like':'%'+_0x25fc73[_0xb550('0x31')][_0xb550('0x3c')]+'%'};return _0x346b56;})});}_0x18b251=_[_0xb550('0x3d')]({},_0x18b251,_0x25fc73[_0xb550('0x46')]);return _0x38a4ed[_0xb550('0x51')](_0x18b251);}})[_0xb550('0x25')](function(_0x279d6f){if(_0x279d6f){_0xa8dcf4=_0x279d6f[_0xb550('0x36')];if(!_0x25fc73['query'][_0xb550('0x4e')](_0xb550('0x37'))){_0x18b251[_0xb550('0x38')]=qs[_0xb550('0x38')](_0x25fc73[_0xb550('0x31')][_0xb550('0x38')]);_0x18b251['offset']=qs[_0xb550('0x1d')](_0x25fc73[_0xb550('0x31')]['offset']);}return _0x38a4ed[_0xb550('0x51')](_0x18b251);}})[_0xb550('0x25')](function(_0x558961){if(_0x558961){return _0x558961?{'count':_0xa8dcf4,'rows':_0x558961}:null;}})[_0xb550('0x25')](respondWithResult(_0x1d321c,null))[_0xb550('0x42')](handleError(_0x1d321c,null));}; \ No newline at end of file +var _0xcbc7=['set','Content-Range','json','apply','reject','update','then','destroy','name','send','index','fieldName','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','SugarcrmConfiguration','findAll','rows','catch','fields','find','create','body','params','getFields','findOne','rawAttributes','getSubjects','SugarcrmField','getDescriptions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit'];(function(_0x115350,_0x59e728){var _0x1510a9=function(_0x5d67e6){while(--_0x5d67e6){_0x115350['push'](_0x115350['shift']());}};_0x1510a9(++_0x59e728);}(_0xcbc7,0xd1));var _0x7cbc=function(_0x247a1e,_0x24f903){_0x247a1e=_0x247a1e-0x0;var _0x40ed26=_0xcbc7[_0x247a1e];return _0x40ed26;};'use strict';var emlformat=require(_0x7cbc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cbc('0x1'));var rp=require(_0x7cbc('0x2'));var moment=require(_0x7cbc('0x3'));var BPromise=require(_0x7cbc('0x4'));var Mustache=require(_0x7cbc('0x5'));var util=require(_0x7cbc('0x6'));var path=require(_0x7cbc('0x7'));var sox=require(_0x7cbc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7cbc('0x9'));var _=require(_0x7cbc('0xa'));var squel=require(_0x7cbc('0xb'));var crypto=require(_0x7cbc('0xc'));var jsforce=require(_0x7cbc('0xd'));var deskjs=require(_0x7cbc('0xe'));var toCsv=require(_0x7cbc('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cbc('0x10'));var authService=require(_0x7cbc('0x11'));var qs=require(_0x7cbc('0x12'));var as=require(_0x7cbc('0x13'));var hardwareService=require(_0x7cbc('0x14'));var logger=require(_0x7cbc('0x15'))('api');var utils=require(_0x7cbc('0x16'));var config=require(_0x7cbc('0x17'));var licenseUtil=require(_0x7cbc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294312,_0x43bd9d){_0x43bd9d=_0x43bd9d||0xcc;return function(_0x3d0ee9){if(_0x3d0ee9){return _0x294312[_0x7cbc('0x19')](_0x43bd9d);}return _0x294312[_0x7cbc('0x1a')](_0x43bd9d)[_0x7cbc('0x1b')]();};}function respondWithResult(_0x4a0c9b,_0x19bff5){_0x19bff5=_0x19bff5||0xc8;return function(_0x28d7a9){if(_0x28d7a9){return _0x4a0c9b[_0x7cbc('0x1a')](_0x19bff5)['json'](_0x28d7a9);}};}function respondWithFilteredResult(_0x5eaeb9,_0x42f823){return function(_0x2a92e7){if(_0x2a92e7){var _0x4ea98a=typeof _0x42f823['offset']==='undefined'&&typeof _0x42f823['limit']==='undefined';var _0x3033de=_0x2a92e7[_0x7cbc('0x1c')];var _0x3e8cba=_0x4ea98a?0x0:_0x42f823[_0x7cbc('0x1d')];var _0x1f5c89=_0x4ea98a?_0x2a92e7[_0x7cbc('0x1c')]:_0x42f823['offset']+_0x42f823[_0x7cbc('0x1e')];var _0x49d455;if(_0x1f5c89>=_0x3033de){_0x1f5c89=_0x3033de;_0x49d455=0xc8;}else{_0x49d455=0xce;}_0x5eaeb9[_0x7cbc('0x1a')](_0x49d455);return _0x5eaeb9[_0x7cbc('0x1f')](_0x7cbc('0x20'),_0x3e8cba+'-'+_0x1f5c89+'/'+_0x3033de)[_0x7cbc('0x21')](_0x2a92e7);}return null;};}function patchUpdates(_0xc9811d){return function(_0x2afa93){try{jsonpatch[_0x7cbc('0x22')](_0x2afa93,_0xc9811d,!![]);}catch(_0x2b8e10){return BPromise[_0x7cbc('0x23')](_0x2b8e10);}return _0x2afa93['save']();};}function saveUpdates(_0x2f56c1,_0x2a7e11){return function(_0x396646){if(_0x396646){return _0x396646[_0x7cbc('0x24')](_0x2f56c1)[_0x7cbc('0x25')](function(_0x2d7041){return _0x2d7041;});}return null;};}function removeEntity(_0x363975,_0x201567){return function(_0x56307a){if(_0x56307a){return _0x56307a[_0x7cbc('0x26')]()[_0x7cbc('0x25')](function(){_0x363975[_0x7cbc('0x1a')](0xcc)[_0x7cbc('0x1b')]();});}};}function handleEntityNotFound(_0x4d58b3,_0x314837){return function(_0x32d2e0){if(!_0x32d2e0){_0x4d58b3[_0x7cbc('0x19')](0x194);}return _0x32d2e0;};}function handleError(_0x31d696,_0x72862c){_0x72862c=_0x72862c||0x1f4;return function(_0x20f95b){logger['error'](_0x20f95b['stack']);if(_0x20f95b[_0x7cbc('0x27')]){delete _0x20f95b[_0x7cbc('0x27')];}_0x31d696['status'](_0x72862c)[_0x7cbc('0x28')](_0x20f95b);};}exports[_0x7cbc('0x29')]=function(_0x4afe92,_0x1428f1){var _0x27fe98={},_0x40b514={},_0x280ed6={'count':0x0,'rows':[]};var _0x5b545b=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x146945){return{'name':_0x146945[_0x7cbc('0x2a')],'type':_0x146945[_0x7cbc('0x2b')][_0x7cbc('0x2c')]};});_0x40b514['model']=_['map'](_0x5b545b,_0x7cbc('0x27'));_0x40b514[_0x7cbc('0x2d')]=_[_0x7cbc('0x2e')](_0x4afe92['query']);_0x40b514['filters']=_[_0x7cbc('0x2f')](_0x40b514[_0x7cbc('0x30')],_0x40b514[_0x7cbc('0x2d')]);_0x27fe98['attributes']=_[_0x7cbc('0x2f')](_0x40b514[_0x7cbc('0x30')],qs['fields'](_0x4afe92[_0x7cbc('0x2d')]['fields']));_0x27fe98[_0x7cbc('0x31')]=_0x27fe98[_0x7cbc('0x31')][_0x7cbc('0x32')]?_0x27fe98[_0x7cbc('0x31')]:_0x40b514[_0x7cbc('0x30')];if(!_0x4afe92[_0x7cbc('0x2d')][_0x7cbc('0x33')](_0x7cbc('0x34'))){_0x27fe98['limit']=qs[_0x7cbc('0x1e')](_0x4afe92['query'][_0x7cbc('0x1e')]);_0x27fe98['offset']=qs['offset'](_0x4afe92[_0x7cbc('0x2d')][_0x7cbc('0x1d')]);}_0x27fe98[_0x7cbc('0x35')]=qs[_0x7cbc('0x36')](_0x4afe92[_0x7cbc('0x2d')]['sort']);_0x27fe98[_0x7cbc('0x37')]=qs[_0x7cbc('0x38')](_[_0x7cbc('0x39')](_0x4afe92[_0x7cbc('0x2d')],_0x40b514[_0x7cbc('0x38')]),_0x5b545b);if(_0x4afe92[_0x7cbc('0x2d')][_0x7cbc('0x3a')]){_0x27fe98[_0x7cbc('0x37')]=_[_0x7cbc('0x3b')](_0x27fe98[_0x7cbc('0x37')],{'$or':_[_0x7cbc('0x3c')](_0x5b545b,function(_0x4e657f){if(_0x4e657f[_0x7cbc('0x2b')]!==_0x7cbc('0x3d')){var _0x369af7={};_0x369af7[_0x4e657f[_0x7cbc('0x27')]]={'$like':'%'+_0x4afe92[_0x7cbc('0x2d')][_0x7cbc('0x3a')]+'%'};return _0x369af7;}})});}_0x27fe98=_[_0x7cbc('0x3b')]({},_0x27fe98,_0x4afe92[_0x7cbc('0x3e')]);var _0x5970b0={'where':_0x27fe98[_0x7cbc('0x37')]};return db['SugarcrmConfiguration']['count'](_0x5970b0)[_0x7cbc('0x25')](function(_0x266ea5){_0x280ed6['count']=_0x266ea5;if(_0x4afe92[_0x7cbc('0x2d')][_0x7cbc('0x3f')]){_0x27fe98[_0x7cbc('0x40')]=[{'all':!![]}];}return db[_0x7cbc('0x41')][_0x7cbc('0x42')](_0x27fe98);})[_0x7cbc('0x25')](function(_0x469c9a){_0x280ed6[_0x7cbc('0x43')]=_0x469c9a;return _0x280ed6;})['then'](respondWithFilteredResult(_0x1428f1,_0x27fe98))[_0x7cbc('0x44')](handleError(_0x1428f1,null));};exports['show']=function(_0x4b79fb,_0x505276){var _0x4e59b9={'raw':![],'where':{'id':_0x4b79fb['params']['id']}},_0x12d26c={};_0x12d26c[_0x7cbc('0x30')]=_[_0x7cbc('0x2e')](db[_0x7cbc('0x41')]['rawAttributes']);_0x12d26c['query']=_[_0x7cbc('0x2e')](_0x4b79fb[_0x7cbc('0x2d')]);_0x12d26c[_0x7cbc('0x38')]=_[_0x7cbc('0x2f')](_0x12d26c[_0x7cbc('0x30')],_0x12d26c[_0x7cbc('0x2d')]);_0x4e59b9[_0x7cbc('0x31')]=_[_0x7cbc('0x2f')](_0x12d26c[_0x7cbc('0x30')],qs[_0x7cbc('0x45')](_0x4b79fb['query'][_0x7cbc('0x45')]));_0x4e59b9[_0x7cbc('0x31')]=_0x4e59b9[_0x7cbc('0x31')]['length']?_0x4e59b9[_0x7cbc('0x31')]:_0x12d26c[_0x7cbc('0x30')];if(_0x4b79fb[_0x7cbc('0x2d')][_0x7cbc('0x3f')]){_0x4e59b9['include']=[{'all':!![]}];}_0x4e59b9=_[_0x7cbc('0x3b')]({},_0x4e59b9,_0x4b79fb[_0x7cbc('0x3e')]);return db[_0x7cbc('0x41')][_0x7cbc('0x46')](_0x4e59b9)[_0x7cbc('0x25')](handleEntityNotFound(_0x505276,null))[_0x7cbc('0x25')](respondWithResult(_0x505276,null))[_0x7cbc('0x44')](handleError(_0x505276,null));};exports[_0x7cbc('0x47')]=function(_0x1280b8,_0x284005){return db[_0x7cbc('0x41')][_0x7cbc('0x47')](_0x1280b8[_0x7cbc('0x48')],{})[_0x7cbc('0x25')](respondWithResult(_0x284005,0xc9))[_0x7cbc('0x44')](handleError(_0x284005,null));};exports[_0x7cbc('0x24')]=function(_0x5cc5b3,_0x1c164b){if(_0x5cc5b3[_0x7cbc('0x48')]['id']){delete _0x5cc5b3['body']['id'];}return db[_0x7cbc('0x41')][_0x7cbc('0x46')]({'where':{'id':_0x5cc5b3[_0x7cbc('0x49')]['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x1c164b,null))[_0x7cbc('0x25')](saveUpdates(_0x5cc5b3[_0x7cbc('0x48')],null))['then'](respondWithResult(_0x1c164b,null))['catch'](handleError(_0x1c164b,null));};exports['destroy']=function(_0x51ce37,_0x4e7e0d){return db[_0x7cbc('0x41')][_0x7cbc('0x46')]({'where':{'id':_0x51ce37[_0x7cbc('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e7e0d,null))[_0x7cbc('0x25')](removeEntity(_0x4e7e0d,null))[_0x7cbc('0x44')](handleError(_0x4e7e0d,null));};exports[_0x7cbc('0x4a')]=function(_0x2a6e74,_0x34cb51,_0x132acd){var _0x15fbd7={};var _0x146a55={};var _0x62dfb4;var _0x516f3d;return db[_0x7cbc('0x41')][_0x7cbc('0x4b')]({'where':{'id':_0x2a6e74[_0x7cbc('0x49')]['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x34cb51,null))[_0x7cbc('0x25')](function(_0x2bd9c0){if(_0x2bd9c0){_0x62dfb4=_0x2bd9c0;_0x146a55['model']=_[_0x7cbc('0x2e')](db['SugarcrmField'][_0x7cbc('0x4c')]);_0x146a55[_0x7cbc('0x2d')]=_[_0x7cbc('0x2e')](_0x2a6e74[_0x7cbc('0x2d')]);_0x146a55['filters']=_['intersection'](_0x146a55[_0x7cbc('0x30')],_0x146a55['query']);_0x15fbd7[_0x7cbc('0x31')]=_['intersection'](_0x146a55[_0x7cbc('0x30')],qs['fields'](_0x2a6e74['query'][_0x7cbc('0x45')]));_0x15fbd7[_0x7cbc('0x31')]=_0x15fbd7[_0x7cbc('0x31')][_0x7cbc('0x32')]?_0x15fbd7[_0x7cbc('0x31')]:_0x146a55[_0x7cbc('0x30')];_0x15fbd7[_0x7cbc('0x35')]=qs[_0x7cbc('0x36')](_0x2a6e74[_0x7cbc('0x2d')][_0x7cbc('0x36')]);_0x15fbd7[_0x7cbc('0x37')]=qs[_0x7cbc('0x38')](_[_0x7cbc('0x39')](_0x2a6e74[_0x7cbc('0x2d')],_0x146a55[_0x7cbc('0x38')]));if(_0x2a6e74[_0x7cbc('0x2d')][_0x7cbc('0x3a')]){_0x15fbd7[_0x7cbc('0x37')]=_[_0x7cbc('0x3b')](_0x15fbd7[_0x7cbc('0x37')],{'$or':_['map'](_0x15fbd7[_0x7cbc('0x31')],function(_0xfffec1){var _0x458ce3={};_0x458ce3[_0xfffec1]={'$like':'%'+_0x2a6e74[_0x7cbc('0x2d')][_0x7cbc('0x3a')]+'%'};return _0x458ce3;})});}_0x15fbd7=_['merge']({},_0x15fbd7,_0x2a6e74[_0x7cbc('0x3e')]);return _0x62dfb4[_0x7cbc('0x4a')](_0x15fbd7);}})[_0x7cbc('0x25')](function(_0x249279){if(_0x249279){_0x516f3d=_0x249279[_0x7cbc('0x32')];if(!_0x2a6e74[_0x7cbc('0x2d')][_0x7cbc('0x33')](_0x7cbc('0x34'))){_0x15fbd7[_0x7cbc('0x1e')]=qs[_0x7cbc('0x1e')](_0x2a6e74['query']['limit']);_0x15fbd7[_0x7cbc('0x1d')]=qs[_0x7cbc('0x1d')](_0x2a6e74[_0x7cbc('0x2d')][_0x7cbc('0x1d')]);}return _0x62dfb4[_0x7cbc('0x4a')](_0x15fbd7);}})[_0x7cbc('0x25')](function(_0x2df7ab){if(_0x2df7ab){return _0x2df7ab?{'count':_0x516f3d,'rows':_0x2df7ab}:null;}})[_0x7cbc('0x25')](respondWithResult(_0x34cb51,null))[_0x7cbc('0x44')](handleError(_0x34cb51,null));};exports[_0x7cbc('0x4d')]=function(_0x1d1036,_0x14ecdb,_0x1ea620){var _0x5dac23={};var _0x167a25={};var _0x49ab8b;var _0x6b3408;return db['SugarcrmConfiguration'][_0x7cbc('0x4b')]({'where':{'id':_0x1d1036['params']['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x14ecdb,null))[_0x7cbc('0x25')](function(_0x574a11){if(_0x574a11){_0x49ab8b=_0x574a11;_0x167a25[_0x7cbc('0x30')]=_[_0x7cbc('0x2e')](db[_0x7cbc('0x4e')][_0x7cbc('0x4c')]);_0x167a25['query']=_[_0x7cbc('0x2e')](_0x1d1036[_0x7cbc('0x2d')]);_0x167a25[_0x7cbc('0x38')]=_[_0x7cbc('0x2f')](_0x167a25[_0x7cbc('0x30')],_0x167a25[_0x7cbc('0x2d')]);_0x5dac23[_0x7cbc('0x31')]=_[_0x7cbc('0x2f')](_0x167a25[_0x7cbc('0x30')],qs['fields'](_0x1d1036[_0x7cbc('0x2d')][_0x7cbc('0x45')]));_0x5dac23[_0x7cbc('0x31')]=_0x5dac23['attributes'][_0x7cbc('0x32')]?_0x5dac23['attributes']:_0x167a25[_0x7cbc('0x30')];_0x5dac23[_0x7cbc('0x35')]=qs[_0x7cbc('0x36')](_0x1d1036[_0x7cbc('0x2d')]['sort']);_0x5dac23[_0x7cbc('0x37')]=qs[_0x7cbc('0x38')](_[_0x7cbc('0x39')](_0x1d1036[_0x7cbc('0x2d')],_0x167a25[_0x7cbc('0x38')]));if(_0x1d1036[_0x7cbc('0x2d')]['filter']){_0x5dac23[_0x7cbc('0x37')]=_[_0x7cbc('0x3b')](_0x5dac23[_0x7cbc('0x37')],{'$or':_['map'](_0x5dac23['attributes'],function(_0x3a1b5b){var _0xb1277a={};_0xb1277a[_0x3a1b5b]={'$like':'%'+_0x1d1036[_0x7cbc('0x2d')]['filter']+'%'};return _0xb1277a;})});}_0x5dac23=_[_0x7cbc('0x3b')]({},_0x5dac23,_0x1d1036[_0x7cbc('0x3e')]);return _0x49ab8b[_0x7cbc('0x4d')](_0x5dac23);}})['then'](function(_0x2a4ed8){if(_0x2a4ed8){_0x6b3408=_0x2a4ed8[_0x7cbc('0x32')];if(!_0x1d1036[_0x7cbc('0x2d')]['hasOwnProperty']('nolimit')){_0x5dac23[_0x7cbc('0x1e')]=qs[_0x7cbc('0x1e')](_0x1d1036['query'][_0x7cbc('0x1e')]);_0x5dac23[_0x7cbc('0x1d')]=qs[_0x7cbc('0x1d')](_0x1d1036['query'][_0x7cbc('0x1d')]);}return _0x49ab8b[_0x7cbc('0x4d')](_0x5dac23);}})[_0x7cbc('0x25')](function(_0x2f44a4){if(_0x2f44a4){return _0x2f44a4?{'count':_0x6b3408,'rows':_0x2f44a4}:null;}})[_0x7cbc('0x25')](respondWithResult(_0x14ecdb,null))[_0x7cbc('0x44')](handleError(_0x14ecdb,null));};exports[_0x7cbc('0x4f')]=function(_0x5007ce,_0x551cad,_0x1d8650){var _0x3f07df={};var _0x828f1a={};var _0x3bde46;var _0xa7bd55;return db[_0x7cbc('0x41')]['findOne']({'where':{'id':_0x5007ce[_0x7cbc('0x49')]['id']}})[_0x7cbc('0x25')](handleEntityNotFound(_0x551cad,null))[_0x7cbc('0x25')](function(_0x137532){if(_0x137532){_0x3bde46=_0x137532;_0x828f1a[_0x7cbc('0x30')]=_[_0x7cbc('0x2e')](db[_0x7cbc('0x4e')][_0x7cbc('0x4c')]);_0x828f1a['query']=_[_0x7cbc('0x2e')](_0x5007ce[_0x7cbc('0x2d')]);_0x828f1a['filters']=_['intersection'](_0x828f1a[_0x7cbc('0x30')],_0x828f1a[_0x7cbc('0x2d')]);_0x3f07df['attributes']=_['intersection'](_0x828f1a[_0x7cbc('0x30')],qs['fields'](_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x45')]));_0x3f07df['attributes']=_0x3f07df[_0x7cbc('0x31')][_0x7cbc('0x32')]?_0x3f07df[_0x7cbc('0x31')]:_0x828f1a['model'];_0x3f07df[_0x7cbc('0x35')]=qs[_0x7cbc('0x36')](_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x36')]);_0x3f07df[_0x7cbc('0x37')]=qs['filters'](_[_0x7cbc('0x39')](_0x5007ce[_0x7cbc('0x2d')],_0x828f1a['filters']));if(_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x3a')]){_0x3f07df[_0x7cbc('0x37')]=_[_0x7cbc('0x3b')](_0x3f07df[_0x7cbc('0x37')],{'$or':_[_0x7cbc('0x3c')](_0x3f07df[_0x7cbc('0x31')],function(_0x2f5e62){var _0x3a5e6b={};_0x3a5e6b[_0x2f5e62]={'$like':'%'+_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x3a')]+'%'};return _0x3a5e6b;})});}_0x3f07df=_['merge']({},_0x3f07df,_0x5007ce[_0x7cbc('0x3e')]);return _0x3bde46[_0x7cbc('0x4f')](_0x3f07df);}})[_0x7cbc('0x25')](function(_0x2ac1f1){if(_0x2ac1f1){_0xa7bd55=_0x2ac1f1[_0x7cbc('0x32')];if(!_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x33')](_0x7cbc('0x34'))){_0x3f07df[_0x7cbc('0x1e')]=qs[_0x7cbc('0x1e')](_0x5007ce[_0x7cbc('0x2d')]['limit']);_0x3f07df['offset']=qs[_0x7cbc('0x1d')](_0x5007ce[_0x7cbc('0x2d')][_0x7cbc('0x1d')]);}return _0x3bde46[_0x7cbc('0x4f')](_0x3f07df);}})[_0x7cbc('0x25')](function(_0x3ae5b0){if(_0x3ae5b0){return _0x3ae5b0?{'count':_0xa7bd55,'rows':_0x3ae5b0}:null;}})['then'](respondWithResult(_0x551cad,null))['catch'](handleError(_0x551cad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 81778a9..372a301 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 _0xeb04=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','bluebird','request-promise','path','rimraf'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xeb04,0x12e));var _0x4eb0=function(_0x5dcfc7,_0x5b0cdf){_0x5dcfc7=_0x5dcfc7-0x0;var _0x2248ad=_0xeb04[_0x5dcfc7];return _0x2248ad;};'use strict';var _=require('lodash');var util=require(_0x4eb0('0x0'));var logger=require('../../config/logger')(_0x4eb0('0x1'));var moment=require('moment');var BPromise=require(_0x4eb0('0x2'));var rp=require(_0x4eb0('0x3'));var fs=require('fs');var path=require(_0x4eb0('0x4'));var rimraf=require(_0x4eb0('0x5'));var config=require('../../config/environment');var attributes=require(_0x4eb0('0x6'));module[_0x4eb0('0x7')]=function(_0x1ca87f,_0x24c146){return _0x1ca87f[_0x4eb0('0x8')](_0x4eb0('0x9'),attributes,{'tableName':_0x4eb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc934=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','int_sugarcrm_configurations','lodash'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0xc934,0x18f));var _0x4c93=function(_0x2102f0,_0xf0780d){_0x2102f0=_0x2102f0-0x0;var _0x1a4e97=_0xc934[_0x2102f0];return _0x1a4e97;};'use strict';var _=require(_0x4c93('0x0'));var util=require(_0x4c93('0x1'));var logger=require(_0x4c93('0x2'))(_0x4c93('0x3'));var moment=require('moment');var BPromise=require(_0x4c93('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c93('0x5'));var rimraf=require(_0x4c93('0x6'));var config=require(_0x4c93('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0xb7f752,_0x53147a){return _0xb7f752[_0x4c93('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0x4c93('0x9'),'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 1d535ca..76414f7 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 _0xd681=['SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','debug'];(function(_0x11b01b,_0x495d36){var _0x584fdd=function(_0x2a0469){while(--_0x2a0469){_0x11b01b['push'](_0x11b01b['shift']());}};_0x584fdd(++_0x495d36);}(_0xd681,0xc5));var _0x1d68=function(_0x1e68fc,_0x1cac65){_0x1e68fc=_0x1e68fc-0x0;var _0x1ce4e0=_0xd681[_0x1e68fc];return _0x1ce4e0;};'use strict';var _=require(_0x1d68('0x0'));var util=require(_0x1d68('0x1'));var moment=require('moment');var BPromise=require(_0x1d68('0x2'));var rs=require(_0x1d68('0x3'));var fs=require('fs');var Redis=require(_0x1d68('0x4'));var db=require(_0x1d68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d68('0x6'))(_0x1d68('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d68('0x8'));var client=jayson[_0x1d68('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d30d6,_0x442340,_0x2f75d0){return new BPromise(function(_0x3e8ce3,_0x4ebd73){return client['request'](_0x5d30d6,_0x2f75d0)[_0x1d68('0xa')](function(_0x4f424d){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x442340,'request\x20sent');logger[_0x1d68('0xb')](_0x1d68('0xc'),_0x442340,_0x1d68('0xd'),JSON['stringify'](_0x4f424d));if(_0x4f424d[_0x1d68('0xe')]){if(_0x4f424d[_0x1d68('0xe')][_0x1d68('0xf')]===0x1f4){logger[_0x1d68('0xe')](_0x1d68('0x10'),_0x442340,_0x4f424d[_0x1d68('0xe')][_0x1d68('0x11')]);return _0x4ebd73(_0x4f424d['error'][_0x1d68('0x11')]);}logger[_0x1d68('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x442340,_0x4f424d['error'][_0x1d68('0x11')]);return _0x3e8ce3(_0x4f424d['error'][_0x1d68('0x11')]);}else{logger[_0x1d68('0x12')](_0x1d68('0x10'),_0x442340,_0x1d68('0xd'));_0x3e8ce3(_0x4f424d['result'][_0x1d68('0x11')]);}})['catch'](function(_0x3e7115){logger[_0x1d68('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x442340,_0x3e7115);_0x4ebd73(_0x3e7115);});});} \ No newline at end of file +var _0xdc53=['jayson/promise','client','http','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0xdc53,0x186));var _0x3dc5=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xdc53[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0x3dc5('0x0'));var util=require(_0x3dc5('0x1'));var moment=require(_0x3dc5('0x2'));var BPromise=require(_0x3dc5('0x3'));var rs=require(_0x3dc5('0x4'));var fs=require('fs');var Redis=require(_0x3dc5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dc5('0x6'));var logger=require(_0x3dc5('0x7'))(_0x3dc5('0x8'));var config=require(_0x3dc5('0x9'));var jayson=require(_0x3dc5('0xa'));var client=jayson[_0x3dc5('0xb')][_0x3dc5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ea3d1,_0x3284f1,_0x5897d1){return new BPromise(function(_0x2f7f27,_0x2aac3a){return client['request'](_0x2ea3d1,_0x5897d1)[_0x3dc5('0xd')](function(_0x45e720){logger[_0x3dc5('0xe')](_0x3dc5('0xf'),_0x3284f1,'request\x20sent');logger[_0x3dc5('0x10')](_0x3dc5('0x11'),_0x3284f1,_0x3dc5('0x12'),JSON[_0x3dc5('0x13')](_0x45e720));if(_0x45e720[_0x3dc5('0x14')]){if(_0x45e720['error'][_0x3dc5('0x15')]===0x1f4){logger[_0x3dc5('0x14')](_0x3dc5('0xf'),_0x3284f1,_0x45e720['error'][_0x3dc5('0x16')]);return _0x2aac3a(_0x45e720[_0x3dc5('0x14')]['message']);}logger[_0x3dc5('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3284f1,_0x45e720[_0x3dc5('0x14')][_0x3dc5('0x16')]);return _0x2f7f27(_0x45e720[_0x3dc5('0x14')][_0x3dc5('0x16')]);}else{logger['info'](_0x3dc5('0xf'),_0x3284f1,_0x3dc5('0x12'));_0x2f7f27(_0x45e720[_0x3dc5('0x17')][_0x3dc5('0x16')]);}})[_0x3dc5('0x18')](function(_0x567d51){logger[_0x3dc5('0x14')](_0x3dc5('0xf'),_0x3284f1,_0x567d51);_0x2aac3a(_0x567d51);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 79c032f..e4004d8 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 _0x4fba=['index','post','put','/:id','update','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x46986e,_0x2ea222){var _0x30e994=function(_0x253c60){while(--_0x253c60){_0x46986e['push'](_0x46986e['shift']());}};_0x30e994(++_0x2ea222);}(_0x4fba,0xe7));var _0xa4fb=function(_0x2a8c5e,_0x34c22f){_0x2a8c5e=_0x2a8c5e-0x0;var _0x4667af=_0x4fba[_0x2a8c5e];return _0x4667af;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4fb('0x0'));var timeout=require(_0xa4fb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa4fb('0x2'));var auth=require(_0xa4fb('0x3'));var interaction=require(_0xa4fb('0x4'));var config=require(_0xa4fb('0x5'));var controller=require(_0xa4fb('0x6'));router[_0xa4fb('0x7')]('/',auth[_0xa4fb('0x8')](),controller[_0xa4fb('0x9')]);router[_0xa4fb('0x7')]('/:id',auth[_0xa4fb('0x8')](),controller['show']);router[_0xa4fb('0xa')]('/',auth[_0xa4fb('0x8')](),controller['create']);router[_0xa4fb('0xb')](_0xa4fb('0xc'),auth['isAuthenticated'](),controller[_0xa4fb('0xd')]);router[_0xa4fb('0xe')](_0xa4fb('0xc'),auth['isAuthenticated'](),controller[_0xa4fb('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf6d7=['../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','put','update','destroy','multer','connect-timeout','Router','fs-extra'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf6d7,0x88));var _0x7f6d=function(_0x1c08f6,_0x14c077){_0x1c08f6=_0x1c08f6-0x0;var _0xbc156a=_0xf6d7[_0x1c08f6];return _0xbc156a;};'use strict';var multer=require(_0x7f6d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7f6d('0x1'));var express=require('express');var router=express[_0x7f6d('0x2')]();var fs_extra=require(_0x7f6d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7f6d('0x4'));var config=require('../../config/environment');var controller=require(_0x7f6d('0x5'));router[_0x7f6d('0x6')]('/',auth[_0x7f6d('0x7')](),controller[_0x7f6d('0x8')]);router['get'](_0x7f6d('0x9'),auth[_0x7f6d('0x7')](),controller['show']);router[_0x7f6d('0xa')]('/',auth[_0x7f6d('0x7')](),controller['create']);router[_0x7f6d('0xb')](_0x7f6d('0x9'),auth[_0x7f6d('0x7')](),controller[_0x7f6d('0xc')]);router['delete'](_0x7f6d('0x9'),auth['isAuthenticated'](),controller[_0x7f6d('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 425e904..4149a60 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 _0xe036=['ENUM','string','variable','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x3441e9,_0x269c8a){var _0x7f9ada=function(_0x4e62fd){while(--_0x4e62fd){_0x3441e9['push'](_0x3441e9['shift']());}};_0x7f9ada(++_0x269c8a);}(_0xe036,0x8e));var _0x6e03=function(_0x4ecc65,_0x229539){_0x4ecc65=_0x4ecc65-0x0;var _0x42244d=_0xe036[_0x4ecc65];return _0x42244d;};'use strict';var Sequelize=require(_0x6e03('0x0'));module[_0x6e03('0x1')]={'type':{'type':Sequelize[_0x6e03('0x2')](_0x6e03('0x3'),_0x6e03('0x4'),'customVariable','keyValue',_0x6e03('0x5')),'defaultValue':_0x6e03('0x3')},'content':{'type':Sequelize[_0x6e03('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6e03('0x2')]('string',_0x6e03('0x4'),_0x6e03('0x7'))},'keyContent':{'type':Sequelize[_0x6e03('0x6')]},'idField':{'type':Sequelize[_0x6e03('0x6')]},'nameField':{'type':Sequelize[_0x6e03('0x6')]},'customField':{'type':Sequelize[_0x6e03('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e03('0x6')]}}; \ No newline at end of file +var _0x8033=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1ebaae,_0x270f11){var _0x53b153=function(_0x138c71){while(--_0x138c71){_0x1ebaae['push'](_0x1ebaae['shift']());}};_0x53b153(++_0x270f11);}(_0x8033,0x159));var _0x3803=function(_0x1680bc,_0x301d5d){_0x1680bc=_0x1680bc-0x0;var _0xa31eaf=_0x8033[_0x1680bc];return _0xa31eaf;};'use strict';var Sequelize=require(_0x3803('0x0'));module[_0x3803('0x1')]={'type':{'type':Sequelize[_0x3803('0x2')](_0x3803('0x3'),_0x3803('0x4'),_0x3803('0x5'),_0x3803('0x6'),_0x3803('0x7')),'defaultValue':_0x3803('0x3')},'content':{'type':Sequelize[_0x3803('0x8')]},'key':{'type':Sequelize[_0x3803('0x8')]},'keyType':{'type':Sequelize[_0x3803('0x2')](_0x3803('0x3'),_0x3803('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3803('0x8')]},'idField':{'type':Sequelize[_0x3803('0x8')]},'nameField':{'type':Sequelize[_0x3803('0x8')]},'customField':{'type':Sequelize[_0x3803('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 814b99f..969398c 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 _0x78d1=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','name','index','map','SugarcrmField','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra'];(function(_0x572fe1,_0x289e35){var _0x306218=function(_0x59ddde){while(--_0x59ddde){_0x572fe1['push'](_0x572fe1['shift']());}};_0x306218(++_0x289e35);}(_0x78d1,0x157));var _0x178d=function(_0x41c578,_0x1e3e43){_0x41c578=_0x41c578-0x0;var _0x9db2ae=_0x78d1[_0x41c578];return _0x9db2ae;};'use strict';var emlformat=require(_0x178d('0x0'));var rimraf=require(_0x178d('0x1'));var zipdir=require(_0x178d('0x2'));var jsonpatch=require(_0x178d('0x3'));var rp=require(_0x178d('0x4'));var moment=require(_0x178d('0x5'));var BPromise=require(_0x178d('0x6'));var Mustache=require('mustache');var util=require(_0x178d('0x7'));var path=require(_0x178d('0x8'));var sox=require(_0x178d('0x9'));var csv=require(_0x178d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x178d('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x178d('0xc'));var deskjs=require(_0x178d('0xd'));var toCsv=require(_0x178d('0xa'));var querystring=require(_0x178d('0xe'));var Papa=require(_0x178d('0xf'));var Redis=require(_0x178d('0x10'));var authService=require(_0x178d('0x11'));var qs=require(_0x178d('0x12'));var as=require(_0x178d('0x13'));var hardwareService=require(_0x178d('0x14'));var logger=require(_0x178d('0x15'))(_0x178d('0x16'));var utils=require(_0x178d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x178d('0x18'));var db=require(_0x178d('0x19'))['db'];function respondWithStatusCode(_0x5009e8,_0xcba213){_0xcba213=_0xcba213||0xcc;return function(_0x25a6a1){if(_0x25a6a1){return _0x5009e8[_0x178d('0x1a')](_0xcba213);}return _0x5009e8[_0x178d('0x1b')](_0xcba213)[_0x178d('0x1c')]();};}function respondWithResult(_0x18d5b8,_0x4fbf22){_0x4fbf22=_0x4fbf22||0xc8;return function(_0x37b68b){if(_0x37b68b){return _0x18d5b8['status'](_0x4fbf22)[_0x178d('0x1d')](_0x37b68b);}};}function respondWithFilteredResult(_0x124e28,_0x442644){return function(_0x485296){if(_0x485296){var _0x4922c2=typeof _0x442644[_0x178d('0x1e')]==='undefined'&&typeof _0x442644['limit']===_0x178d('0x1f');var _0x4f582a=_0x485296[_0x178d('0x20')];var _0x61330c=_0x4922c2?0x0:_0x442644[_0x178d('0x1e')];var _0x5b7926=_0x4922c2?_0x485296[_0x178d('0x20')]:_0x442644[_0x178d('0x1e')]+_0x442644[_0x178d('0x21')];var _0x239575;if(_0x5b7926>=_0x4f582a){_0x5b7926=_0x4f582a;_0x239575=0xc8;}else{_0x239575=0xce;}_0x124e28['status'](_0x239575);return _0x124e28[_0x178d('0x22')](_0x178d('0x23'),_0x61330c+'-'+_0x5b7926+'/'+_0x4f582a)['json'](_0x485296);}return null;};}function patchUpdates(_0xbde3c6){return function(_0x54d35b){try{jsonpatch['apply'](_0x54d35b,_0xbde3c6,!![]);}catch(_0x586fc2){return BPromise[_0x178d('0x24')](_0x586fc2);}return _0x54d35b[_0x178d('0x25')]();};}function saveUpdates(_0xaf8e73,_0x7fecc8){return function(_0x19b32b){if(_0x19b32b){return _0x19b32b[_0x178d('0x26')](_0xaf8e73)[_0x178d('0x27')](function(_0x37c7c9){return _0x37c7c9;});}return null;};}function removeEntity(_0x518567,_0x5cf3ed){return function(_0xc9d63b){if(_0xc9d63b){return _0xc9d63b['destroy']()[_0x178d('0x27')](function(){_0x518567['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9484ab,_0x21d34a){return function(_0x5c1efc){if(!_0x5c1efc){_0x9484ab[_0x178d('0x1a')](0x194);}return _0x5c1efc;};}function handleError(_0x4e1f2b,_0x3da218){_0x3da218=_0x3da218||0x1f4;return function(_0x3a496f){logger['error'](_0x3a496f['stack']);if(_0x3a496f['name']){delete _0x3a496f[_0x178d('0x28')];}_0x4e1f2b[_0x178d('0x1b')](_0x3da218)['send'](_0x3a496f);};}exports[_0x178d('0x29')]=function(_0x3bd458,_0x26da9b){var _0x1f344d={},_0x1e7adf={},_0x4b7241={'count':0x0,'rows':[]};var _0x25c69c=_[_0x178d('0x2a')](db[_0x178d('0x2b')]['rawAttributes'],function(_0x3d00e2){return{'name':_0x3d00e2[_0x178d('0x2c')],'type':_0x3d00e2[_0x178d('0x2d')][_0x178d('0x2e')]};});_0x1e7adf[_0x178d('0x2f')]=_['map'](_0x25c69c,_0x178d('0x28'));_0x1e7adf['query']=_[_0x178d('0x30')](_0x3bd458[_0x178d('0x31')]);_0x1e7adf[_0x178d('0x32')]=_['intersection'](_0x1e7adf[_0x178d('0x2f')],_0x1e7adf['query']);_0x1f344d['attributes']=_[_0x178d('0x33')](_0x1e7adf[_0x178d('0x2f')],qs['fields'](_0x3bd458[_0x178d('0x31')][_0x178d('0x34')]));_0x1f344d[_0x178d('0x35')]=_0x1f344d[_0x178d('0x35')][_0x178d('0x36')]?_0x1f344d[_0x178d('0x35')]:_0x1e7adf['model'];if(!_0x3bd458[_0x178d('0x31')][_0x178d('0x37')](_0x178d('0x38'))){_0x1f344d[_0x178d('0x21')]=qs['limit'](_0x3bd458[_0x178d('0x31')]['limit']);_0x1f344d[_0x178d('0x1e')]=qs[_0x178d('0x1e')](_0x3bd458['query']['offset']);}_0x1f344d['order']=qs['sort'](_0x3bd458[_0x178d('0x31')][_0x178d('0x39')]);_0x1f344d[_0x178d('0x3a')]=qs[_0x178d('0x32')](_[_0x178d('0x3b')](_0x3bd458[_0x178d('0x31')],_0x1e7adf[_0x178d('0x32')]),_0x25c69c);if(_0x3bd458[_0x178d('0x31')][_0x178d('0x3c')]){_0x1f344d[_0x178d('0x3a')]=_['merge'](_0x1f344d[_0x178d('0x3a')],{'$or':_[_0x178d('0x2a')](_0x25c69c,function(_0x279b68){if(_0x279b68[_0x178d('0x2d')]!=='VIRTUAL'){var _0x46a9c1={};_0x46a9c1[_0x279b68[_0x178d('0x28')]]={'$like':'%'+_0x3bd458[_0x178d('0x31')][_0x178d('0x3c')]+'%'};return _0x46a9c1;}})});}_0x1f344d=_[_0x178d('0x3d')]({},_0x1f344d,_0x3bd458['options']);var _0x3958ae={'where':_0x1f344d['where']};return db[_0x178d('0x2b')]['count'](_0x3958ae)['then'](function(_0x4f10ad){_0x4b7241['count']=_0x4f10ad;if(_0x3bd458[_0x178d('0x31')][_0x178d('0x3e')]){_0x1f344d[_0x178d('0x3f')]=[{'all':!![]}];}return db[_0x178d('0x2b')][_0x178d('0x40')](_0x1f344d);})[_0x178d('0x27')](function(_0x14e2bb){_0x4b7241['rows']=_0x14e2bb;return _0x4b7241;})['then'](respondWithFilteredResult(_0x26da9b,_0x1f344d))[_0x178d('0x41')](handleError(_0x26da9b,null));};exports['show']=function(_0x52d707,_0x1bf615){var _0x5bac04={'raw':!![],'where':{'id':_0x52d707['params']['id']}},_0x25569a={};_0x25569a[_0x178d('0x2f')]=_['keys'](db[_0x178d('0x2b')]['rawAttributes']);_0x25569a['query']=_['keys'](_0x52d707[_0x178d('0x31')]);_0x25569a[_0x178d('0x32')]=_['intersection'](_0x25569a[_0x178d('0x2f')],_0x25569a[_0x178d('0x31')]);_0x5bac04[_0x178d('0x35')]=_['intersection'](_0x25569a[_0x178d('0x2f')],qs[_0x178d('0x34')](_0x52d707[_0x178d('0x31')][_0x178d('0x34')]));_0x5bac04[_0x178d('0x35')]=_0x5bac04['attributes'][_0x178d('0x36')]?_0x5bac04[_0x178d('0x35')]:_0x25569a[_0x178d('0x2f')];if(_0x52d707[_0x178d('0x31')]['includeAll']){_0x5bac04[_0x178d('0x3f')]=[{'all':!![]}];}_0x5bac04=_[_0x178d('0x3d')]({},_0x5bac04,_0x52d707[_0x178d('0x42')]);return db[_0x178d('0x2b')][_0x178d('0x43')](_0x5bac04)[_0x178d('0x27')](handleEntityNotFound(_0x1bf615,null))['then'](respondWithResult(_0x1bf615,null))[_0x178d('0x41')](handleError(_0x1bf615,null));};exports[_0x178d('0x44')]=function(_0x54d0d9,_0x1c8fb2){return db['SugarcrmField'][_0x178d('0x44')](_0x54d0d9[_0x178d('0x45')],{})[_0x178d('0x27')](respondWithResult(_0x1c8fb2,0xc9))[_0x178d('0x41')](handleError(_0x1c8fb2,null));};exports[_0x178d('0x26')]=function(_0x388b97,_0x1d5a06){if(_0x388b97['body']['id']){delete _0x388b97[_0x178d('0x45')]['id'];}return db[_0x178d('0x2b')]['find']({'where':{'id':_0x388b97[_0x178d('0x46')]['id']}})[_0x178d('0x27')](handleEntityNotFound(_0x1d5a06,null))[_0x178d('0x27')](saveUpdates(_0x388b97[_0x178d('0x45')],null))['then'](respondWithResult(_0x1d5a06,null))[_0x178d('0x41')](handleError(_0x1d5a06,null));};exports['destroy']=function(_0x35e475,_0x2128ea){return db[_0x178d('0x2b')]['find']({'where':{'id':_0x35e475[_0x178d('0x46')]['id']}})[_0x178d('0x27')](handleEntityNotFound(_0x2128ea,null))['then'](removeEntity(_0x2128ea,null))[_0x178d('0x41')](handleError(_0x2128ea,null));}; \ No newline at end of file +var _0xa747=['sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x37afef,_0x4329f8){var _0x316c4b=function(_0x163c3d){while(--_0x163c3d){_0x37afef['push'](_0x37afef['shift']());}};_0x316c4b(++_0x4329f8);}(_0xa747,0xa2));var _0x7a74=function(_0x237f8c,_0x25e2e6){_0x237f8c=_0x237f8c-0x0;var _0x5d2580=_0xa747[_0x237f8c];return _0x5d2580;};'use strict';var emlformat=require(_0x7a74('0x0'));var rimraf=require(_0x7a74('0x1'));var zipdir=require(_0x7a74('0x2'));var jsonpatch=require(_0x7a74('0x3'));var rp=require('request-promise');var moment=require(_0x7a74('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a74('0x5'));var util=require(_0x7a74('0x6'));var path=require(_0x7a74('0x7'));var sox=require(_0x7a74('0x8'));var csv=require('to-csv');var ejs=require(_0x7a74('0x9'));var fs=require('fs');var fs_extra=require(_0x7a74('0xa'));var _=require(_0x7a74('0xb'));var squel=require(_0x7a74('0xc'));var crypto=require(_0x7a74('0xd'));var jsforce=require(_0x7a74('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7a74('0xf'));var querystring=require(_0x7a74('0x10'));var Papa=require(_0x7a74('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7a74('0x12'));var as=require(_0x7a74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a74('0x14'))(_0x7a74('0x15'));var utils=require('../../config/utils');var config=require(_0x7a74('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2386ce,_0x32152a){_0x32152a=_0x32152a||0xcc;return function(_0x2d362e){if(_0x2d362e){return _0x2386ce[_0x7a74('0x17')](_0x32152a);}return _0x2386ce[_0x7a74('0x18')](_0x32152a)[_0x7a74('0x19')]();};}function respondWithResult(_0x439f5b,_0x2a6422){_0x2a6422=_0x2a6422||0xc8;return function(_0xb89b0a){if(_0xb89b0a){return _0x439f5b['status'](_0x2a6422)[_0x7a74('0x1a')](_0xb89b0a);}};}function respondWithFilteredResult(_0x47eacd,_0xadeea0){return function(_0x1b3429){if(_0x1b3429){var _0x3a4a85=typeof _0xadeea0[_0x7a74('0x1b')]===_0x7a74('0x1c')&&typeof _0xadeea0['limit']===_0x7a74('0x1c');var _0x2d2d5a=_0x1b3429[_0x7a74('0x1d')];var _0x3239e3=_0x3a4a85?0x0:_0xadeea0[_0x7a74('0x1b')];var _0x5e963d=_0x3a4a85?_0x1b3429[_0x7a74('0x1d')]:_0xadeea0[_0x7a74('0x1b')]+_0xadeea0['limit'];var _0x1445c2;if(_0x5e963d>=_0x2d2d5a){_0x5e963d=_0x2d2d5a;_0x1445c2=0xc8;}else{_0x1445c2=0xce;}_0x47eacd[_0x7a74('0x18')](_0x1445c2);return _0x47eacd[_0x7a74('0x1e')](_0x7a74('0x1f'),_0x3239e3+'-'+_0x5e963d+'/'+_0x2d2d5a)[_0x7a74('0x1a')](_0x1b3429);}return null;};}function patchUpdates(_0x221e48){return function(_0x4de1f0){try{jsonpatch[_0x7a74('0x20')](_0x4de1f0,_0x221e48,!![]);}catch(_0x5e34b6){return BPromise[_0x7a74('0x21')](_0x5e34b6);}return _0x4de1f0['save']();};}function saveUpdates(_0x3b73e1,_0x5eeb9f){return function(_0x315346){if(_0x315346){return _0x315346['update'](_0x3b73e1)[_0x7a74('0x22')](function(_0x25708a){return _0x25708a;});}return null;};}function removeEntity(_0x53e3d3,_0x47a1c9){return function(_0x112efb){if(_0x112efb){return _0x112efb[_0x7a74('0x23')]()[_0x7a74('0x22')](function(){_0x53e3d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540a7e,_0x130d13){return function(_0x33e602){if(!_0x33e602){_0x540a7e[_0x7a74('0x17')](0x194);}return _0x33e602;};}function handleError(_0xed207d,_0x2909c8){_0x2909c8=_0x2909c8||0x1f4;return function(_0x880b6d){logger[_0x7a74('0x24')](_0x880b6d[_0x7a74('0x25')]);if(_0x880b6d[_0x7a74('0x26')]){delete _0x880b6d[_0x7a74('0x26')];}_0xed207d[_0x7a74('0x18')](_0x2909c8)['send'](_0x880b6d);};}exports[_0x7a74('0x27')]=function(_0x534ad6,_0x3773a6){var _0x4c3633={},_0x225ba4={},_0x565b2e={'count':0x0,'rows':[]};var _0x4b5081=_[_0x7a74('0x28')](db[_0x7a74('0x29')][_0x7a74('0x2a')],function(_0x1765be){return{'name':_0x1765be[_0x7a74('0x2b')],'type':_0x1765be[_0x7a74('0x2c')][_0x7a74('0x2d')]};});_0x225ba4[_0x7a74('0x2e')]=_[_0x7a74('0x28')](_0x4b5081,_0x7a74('0x26'));_0x225ba4[_0x7a74('0x2f')]=_[_0x7a74('0x30')](_0x534ad6[_0x7a74('0x2f')]);_0x225ba4[_0x7a74('0x31')]=_['intersection'](_0x225ba4[_0x7a74('0x2e')],_0x225ba4[_0x7a74('0x2f')]);_0x4c3633[_0x7a74('0x32')]=_[_0x7a74('0x33')](_0x225ba4[_0x7a74('0x2e')],qs[_0x7a74('0x34')](_0x534ad6[_0x7a74('0x2f')][_0x7a74('0x34')]));_0x4c3633[_0x7a74('0x32')]=_0x4c3633[_0x7a74('0x32')][_0x7a74('0x35')]?_0x4c3633[_0x7a74('0x32')]:_0x225ba4[_0x7a74('0x2e')];if(!_0x534ad6[_0x7a74('0x2f')][_0x7a74('0x36')](_0x7a74('0x37'))){_0x4c3633[_0x7a74('0x38')]=qs[_0x7a74('0x38')](_0x534ad6[_0x7a74('0x2f')][_0x7a74('0x38')]);_0x4c3633[_0x7a74('0x1b')]=qs[_0x7a74('0x1b')](_0x534ad6['query'][_0x7a74('0x1b')]);}_0x4c3633['order']=qs[_0x7a74('0x39')](_0x534ad6[_0x7a74('0x2f')][_0x7a74('0x39')]);_0x4c3633[_0x7a74('0x3a')]=qs[_0x7a74('0x31')](_[_0x7a74('0x3b')](_0x534ad6[_0x7a74('0x2f')],_0x225ba4['filters']),_0x4b5081);if(_0x534ad6['query'][_0x7a74('0x3c')]){_0x4c3633[_0x7a74('0x3a')]=_[_0x7a74('0x3d')](_0x4c3633[_0x7a74('0x3a')],{'$or':_[_0x7a74('0x28')](_0x4b5081,function(_0x55b05b){if(_0x55b05b[_0x7a74('0x2c')]!==_0x7a74('0x3e')){var _0x545c86={};_0x545c86[_0x55b05b[_0x7a74('0x26')]]={'$like':'%'+_0x534ad6[_0x7a74('0x2f')]['filter']+'%'};return _0x545c86;}})});}_0x4c3633=_['merge']({},_0x4c3633,_0x534ad6['options']);var _0x2f41ba={'where':_0x4c3633[_0x7a74('0x3a')]};return db[_0x7a74('0x29')]['count'](_0x2f41ba)['then'](function(_0x307d5c){_0x565b2e['count']=_0x307d5c;if(_0x534ad6[_0x7a74('0x2f')][_0x7a74('0x3f')]){_0x4c3633[_0x7a74('0x40')]=[{'all':!![]}];}return db[_0x7a74('0x29')][_0x7a74('0x41')](_0x4c3633);})[_0x7a74('0x22')](function(_0x514e49){_0x565b2e['rows']=_0x514e49;return _0x565b2e;})[_0x7a74('0x22')](respondWithFilteredResult(_0x3773a6,_0x4c3633))[_0x7a74('0x42')](handleError(_0x3773a6,null));};exports['show']=function(_0x2d08f5,_0x48c97b){var _0x2b1c6b={'raw':!![],'where':{'id':_0x2d08f5['params']['id']}},_0x37c316={};_0x37c316[_0x7a74('0x2e')]=_[_0x7a74('0x30')](db['SugarcrmField'][_0x7a74('0x2a')]);_0x37c316[_0x7a74('0x2f')]=_['keys'](_0x2d08f5[_0x7a74('0x2f')]);_0x37c316[_0x7a74('0x31')]=_[_0x7a74('0x33')](_0x37c316[_0x7a74('0x2e')],_0x37c316[_0x7a74('0x2f')]);_0x2b1c6b['attributes']=_[_0x7a74('0x33')](_0x37c316[_0x7a74('0x2e')],qs[_0x7a74('0x34')](_0x2d08f5[_0x7a74('0x2f')][_0x7a74('0x34')]));_0x2b1c6b[_0x7a74('0x32')]=_0x2b1c6b['attributes'][_0x7a74('0x35')]?_0x2b1c6b[_0x7a74('0x32')]:_0x37c316[_0x7a74('0x2e')];if(_0x2d08f5[_0x7a74('0x2f')][_0x7a74('0x3f')]){_0x2b1c6b[_0x7a74('0x40')]=[{'all':!![]}];}_0x2b1c6b=_[_0x7a74('0x3d')]({},_0x2b1c6b,_0x2d08f5[_0x7a74('0x43')]);return db[_0x7a74('0x29')][_0x7a74('0x44')](_0x2b1c6b)[_0x7a74('0x22')](handleEntityNotFound(_0x48c97b,null))['then'](respondWithResult(_0x48c97b,null))[_0x7a74('0x42')](handleError(_0x48c97b,null));};exports[_0x7a74('0x45')]=function(_0x5976bf,_0x1cde1c){return db[_0x7a74('0x29')][_0x7a74('0x45')](_0x5976bf[_0x7a74('0x46')],{})['then'](respondWithResult(_0x1cde1c,0xc9))['catch'](handleError(_0x1cde1c,null));};exports[_0x7a74('0x47')]=function(_0x3d83fa,_0x24e3a6){if(_0x3d83fa[_0x7a74('0x46')]['id']){delete _0x3d83fa[_0x7a74('0x46')]['id'];}return db[_0x7a74('0x29')][_0x7a74('0x44')]({'where':{'id':_0x3d83fa[_0x7a74('0x48')]['id']}})[_0x7a74('0x22')](handleEntityNotFound(_0x24e3a6,null))[_0x7a74('0x22')](saveUpdates(_0x3d83fa[_0x7a74('0x46')],null))['then'](respondWithResult(_0x24e3a6,null))[_0x7a74('0x42')](handleError(_0x24e3a6,null));};exports[_0x7a74('0x23')]=function(_0x1d30cc,_0x2b6c44){return db[_0x7a74('0x29')][_0x7a74('0x44')]({'where':{'id':_0x1d30cc[_0x7a74('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b6c44,null))[_0x7a74('0x22')](removeEntity(_0x2b6c44,null))[_0x7a74('0x42')](handleError(_0x2b6c44,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a12876f..6bf1c36 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 _0xbea3=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x17c7f7,_0x402af8){var _0xf196dc=function(_0x381d3f){while(--_0x381d3f){_0x17c7f7['push'](_0x17c7f7['shift']());}};_0xf196dc(++_0x402af8);}(_0xbea3,0xdf));var _0x3bea=function(_0x1e7c9b,_0x1758a0){_0x1e7c9b=_0x1e7c9b-0x0;var _0x9d0b5b=_0xbea3[_0x1e7c9b];return _0x9d0b5b;};'use strict';var _=require(_0x3bea('0x0'));var util=require('util');var logger=require(_0x3bea('0x1'))(_0x3bea('0x2'));var moment=require(_0x3bea('0x3'));var BPromise=require(_0x3bea('0x4'));var rp=require(_0x3bea('0x5'));var fs=require('fs');var path=require(_0x3bea('0x6'));var rimraf=require(_0x3bea('0x7'));var config=require(_0x3bea('0x8'));var attributes=require(_0x3bea('0x9'));module[_0x3bea('0xa')]=function(_0x4d8b6b,_0x2e4640){return _0x4d8b6b[_0x3bea('0xb')](_0x3bea('0xc'),attributes,{'tableName':_0x3bea('0xd'),'paranoid':![],'indexes':[{'name':_0x3bea('0xe'),'fields':[_0x3bea('0xf'),_0x3bea('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4980=['define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5d0235,_0x28b00d){var _0x1420dc=function(_0x4e869a){while(--_0x4e869a){_0x5d0235['push'](_0x5d0235['shift']());}};_0x1420dc(++_0x28b00d);}(_0x4980,0xc8));var _0x0498=function(_0xff0854,_0x50fd52){_0xff0854=_0xff0854-0x0;var _0x12f6bf=_0x4980[_0xff0854];return _0x12f6bf;};'use strict';var _=require('lodash');var util=require(_0x0498('0x0'));var logger=require(_0x0498('0x1'))('api');var moment=require(_0x0498('0x2'));var BPromise=require(_0x0498('0x3'));var rp=require(_0x0498('0x4'));var fs=require('fs');var path=require(_0x0498('0x5'));var rimraf=require('rimraf');var config=require(_0x0498('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x0498('0x7')]=function(_0x26c7d0,_0x69304){return _0x26c7d0[_0x0498('0x8')](_0x0498('0x9'),attributes,{'tableName':_0x0498('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x0498('0xb'),_0x0498('0xc')],'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 b377d2b..f4d029d 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 _0x54d1=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x15044a,_0x42f0d7){var _0x2b0308=function(_0x37c68d){while(--_0x37c68d){_0x15044a['push'](_0x15044a['shift']());}};_0x2b0308(++_0x42f0d7);}(_0x54d1,0x199));var _0x154d=function(_0x31af75,_0x404ca9){_0x31af75=_0x31af75-0x0;var _0x1adee8=_0x54d1[_0x31af75];return _0x1adee8;};'use strict';var _=require(_0x154d('0x0'));var util=require(_0x154d('0x1'));var moment=require(_0x154d('0x2'));var BPromise=require(_0x154d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x154d('0x4'));var db=require(_0x154d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x154d('0x6'))(_0x154d('0x7'));var config=require(_0x154d('0x8'));var jayson=require(_0x154d('0x9'));var client=jayson['client'][_0x154d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48bd37,_0x1e24a9,_0x7410aa){return new BPromise(function(_0x4d91e8,_0x4bfe4a){return client[_0x154d('0xb')](_0x48bd37,_0x7410aa)[_0x154d('0xc')](function(_0x428ac9){logger[_0x154d('0xd')](_0x154d('0xe'),_0x1e24a9,_0x154d('0xf'));logger[_0x154d('0x10')](_0x154d('0x11'),_0x1e24a9,'request\x20sent',JSON[_0x154d('0x12')](_0x428ac9));if(_0x428ac9[_0x154d('0x13')]){if(_0x428ac9[_0x154d('0x13')]['code']===0x1f4){logger[_0x154d('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1e24a9,_0x428ac9[_0x154d('0x13')][_0x154d('0x14')]);return _0x4bfe4a(_0x428ac9[_0x154d('0x13')][_0x154d('0x14')]);}logger[_0x154d('0x13')](_0x154d('0xe'),_0x1e24a9,_0x428ac9['error']['message']);return _0x4d91e8(_0x428ac9[_0x154d('0x13')]['message']);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x1e24a9,'request\x20sent');_0x4d91e8(_0x428ac9[_0x154d('0x15')][_0x154d('0x14')]);}})[_0x154d('0x16')](function(_0x1f223c){logger[_0x154d('0x13')](_0x154d('0xe'),_0x1e24a9,_0x1f223c);_0x4bfe4a(_0x1f223c);});});} \ No newline at end of file +var _0x9295=['message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s'];(function(_0x5b5a44,_0x5ac308){var _0x339d7f=function(_0xbdabe8){while(--_0xbdabe8){_0x5b5a44['push'](_0x5b5a44['shift']());}};_0x339d7f(++_0x5ac308);}(_0x9295,0x1b8));var _0x5929=function(_0x171bfb,_0x109369){_0x171bfb=_0x171bfb-0x0;var _0x20b1a8=_0x9295[_0x171bfb];return _0x20b1a8;};'use strict';var _=require('lodash');var util=require(_0x5929('0x0'));var moment=require(_0x5929('0x1'));var BPromise=require(_0x5929('0x2'));var rs=require(_0x5929('0x3'));var fs=require('fs');var Redis=require(_0x5929('0x4'));var db=require(_0x5929('0x5'))['db'];var utils=require(_0x5929('0x6'));var logger=require('../../config/logger')(_0x5929('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5929('0x8')][_0x5929('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147445,_0x4f616e,_0x4a3273){return new BPromise(function(_0x5a1e9c,_0x26cffb){return client['request'](_0x147445,_0x4a3273)[_0x5929('0xa')](function(_0x39fea2){logger[_0x5929('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x4f616e,'request\x20sent');logger['debug'](_0x5929('0xc'),_0x4f616e,'request\x20sent',JSON[_0x5929('0xd')](_0x39fea2));if(_0x39fea2['error']){if(_0x39fea2[_0x5929('0xe')]['code']===0x1f4){logger[_0x5929('0xe')](_0x5929('0xf'),_0x4f616e,_0x39fea2[_0x5929('0xe')][_0x5929('0x10')]);return _0x26cffb(_0x39fea2[_0x5929('0xe')][_0x5929('0x10')]);}logger[_0x5929('0xe')](_0x5929('0xf'),_0x4f616e,_0x39fea2[_0x5929('0xe')]['message']);return _0x5a1e9c(_0x39fea2['error'][_0x5929('0x10')]);}else{logger['info'](_0x5929('0xf'),_0x4f616e,_0x5929('0x11'));_0x5a1e9c(_0x39fea2['result']['message']);}})[_0x5929('0x12')](function(_0x8cf3fd){logger['error'](_0x5929('0xf'),_0x4f616e,_0x8cf3fd);_0x26cffb(_0x8cf3fd);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index aface3f..7aed527 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 _0xa3e6=['destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','/:id','update','delete'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x44b160,_0x4d2c9c){_0x44b160=_0x44b160-0x0;var _0xea8e54=_0xa3e6[_0x44b160];return _0xea8e54;};'use strict';var multer=require(_0x6a3e('0x0'));var util=require('util');var path=require(_0x6a3e('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a3e('0x2'));var router=express[_0x6a3e('0x3')]();var fs_extra=require(_0x6a3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6a3e('0x5'));var config=require('../../config/environment');var controller=require(_0x6a3e('0x6'));router[_0x6a3e('0x7')]('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x9')]);router[_0x6a3e('0x7')]('/:id',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xa')]);router['get']('/:id/configurations',auth[_0x6a3e('0x8')](),controller['getConfigurations']);router['get'](_0x6a3e('0xb'),auth['isAuthenticated'](),controller[_0x6a3e('0xc')]);router['post']('/',auth[_0x6a3e('0x8')](),controller[_0x6a3e('0xd')]);router[_0x6a3e('0xe')](_0x6a3e('0xf'),auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x10')]);router['put'](_0x6a3e('0x11'),auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x12')]);router[_0x6a3e('0x13')](_0x6a3e('0x11'),auth[_0x6a3e('0x8')](),controller[_0x6a3e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0c6d=['../../components/interaction/service','isAuthenticated','index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x2f0057,_0x448b27){var _0x17f2c3=function(_0x12efc3){while(--_0x12efc3){_0x2f0057['push'](_0x2f0057['shift']());}};_0x17f2c3(++_0x448b27);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x348a55,_0x497044){_0x348a55=_0x348a55-0x0;var _0x13af08=_0x0c6d[_0x348a55];return _0x13af08;};'use strict';var multer=require('multer');var util=require(_0xd0c6('0x0'));var path=require(_0xd0c6('0x1'));var timeout=require(_0xd0c6('0x2'));var express=require(_0xd0c6('0x3'));var router=express[_0xd0c6('0x4')]();var fs_extra=require(_0xd0c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0c6('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x8')]);router[_0xd0c6('0x9')]('/:id',auth[_0xd0c6('0x7')](),controller['show']);router[_0xd0c6('0x9')](_0xd0c6('0xa'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xb')]);router[_0xd0c6('0x9')](_0xd0c6('0xc'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0xd')]);router[_0xd0c6('0xe')]('/',auth['isAuthenticated'](),controller[_0xd0c6('0xf')]);router['post']('/:id/configurations',auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x10')]);router[_0xd0c6('0x11')](_0xd0c6('0x12'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x13')]);router[_0xd0c6('0x14')](_0xd0c6('0x12'),auth[_0xd0c6('0x7')](),controller[_0xd0c6('0x15')]);module[_0xd0c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index cdde788..61e70bc 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 _0xc19e=['STRING','HelpDesk'];(function(_0x114c47,_0x1ee06b){var _0x4a869b=function(_0x2a8e86){while(--_0x2a8e86){_0x114c47['push'](_0x114c47['shift']());}};_0x4a869b(++_0x1ee06b);}(_0xc19e,0x1c8));var _0xec19=function(_0x2827f5,_0x85ca0){_0x2827f5=_0x2827f5-0x0;var _0x420b45=_0xc19e[_0x2827f5];return _0x420b45;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xec19('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xec19('0x0')]},'username':{'type':Sequelize[_0xec19('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec19('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xac84=['STRING','HelpDesk','sequelize','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xac84,0x15a));var _0x4ac8=function(_0x4c32bc,_0x3cefe4){_0x4c32bc=_0x4c32bc-0x0;var _0x26a3b4=_0xac84[_0x4c32bc];return _0x26a3b4;};'use strict';var Sequelize=require(_0x4ac8('0x0'));module[_0x4ac8('0x1')]={'name':{'type':Sequelize[_0x4ac8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4ac8('0x2')],'allowNull':![],'defaultValue':_0x4ac8('0x3')},'remoteUri':{'type':Sequelize[_0x4ac8('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4ac8('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4ac8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7e3c976..f2c71fb 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 _0x1f13=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack','send','index','map','VtigerAccount','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','length','merge','options','find','catch','create','body','params','findOne','nolimit','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerConfiguration','VtigerField','md5','getFields','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','startsWith','cf_','picklist','picklistValues','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x1f13,0x15b));var _0x31f1=function(_0x4379d6,_0x49f894){_0x4379d6=_0x4379d6-0x0;var _0x227e22=_0x1f13[_0x4379d6];return _0x227e22;};'use strict';var emlformat=require(_0x31f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31f1('0x1'));var jsonpatch=require(_0x31f1('0x2'));var rp=require(_0x31f1('0x3'));var moment=require(_0x31f1('0x4'));var BPromise=require(_0x31f1('0x5'));var Mustache=require(_0x31f1('0x6'));var util=require(_0x31f1('0x7'));var path=require(_0x31f1('0x8'));var sox=require('sox');var csv=require(_0x31f1('0x9'));var ejs=require(_0x31f1('0xa'));var fs=require('fs');var fs_extra=require(_0x31f1('0xb'));var _=require(_0x31f1('0xc'));var squel=require('squel');var crypto=require(_0x31f1('0xd'));var jsforce=require(_0x31f1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x31f1('0x9'));var querystring=require(_0x31f1('0xf'));var Papa=require(_0x31f1('0x10'));var Redis=require(_0x31f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x31f1('0x12'));var as=require(_0x31f1('0x13'));var hardwareService=require(_0x31f1('0x14'));var logger=require(_0x31f1('0x15'))(_0x31f1('0x16'));var utils=require(_0x31f1('0x17'));var config=require(_0x31f1('0x18'));var licenseUtil=require(_0x31f1('0x19'));var db=require(_0x31f1('0x1a'))['db'];var integrations=require(_0x31f1('0x1b'));function respondWithStatusCode(_0x146a19,_0x2fa288){_0x2fa288=_0x2fa288||0xcc;return function(_0x2d1c87){if(_0x2d1c87){return _0x146a19[_0x31f1('0x1c')](_0x2fa288);}return _0x146a19[_0x31f1('0x1d')](_0x2fa288)[_0x31f1('0x1e')]();};}function respondWithResult(_0x375b2f,_0x2e5ee3){_0x2e5ee3=_0x2e5ee3||0xc8;return function(_0x12ff4b){if(_0x12ff4b){return _0x375b2f[_0x31f1('0x1d')](_0x2e5ee3)[_0x31f1('0x1f')](_0x12ff4b);}};}function respondWithFilteredResult(_0x365d2c,_0x58ab3b){return function(_0xe2bc79){if(_0xe2bc79){var _0x243c5e=typeof _0x58ab3b[_0x31f1('0x20')]===_0x31f1('0x21')&&typeof _0x58ab3b['limit']===_0x31f1('0x21');var _0x9b5c9b=_0xe2bc79[_0x31f1('0x22')];var _0x1a3fb4=_0x243c5e?0x0:_0x58ab3b[_0x31f1('0x20')];var _0x3507ce=_0x243c5e?_0xe2bc79['count']:_0x58ab3b[_0x31f1('0x20')]+_0x58ab3b[_0x31f1('0x23')];var _0x445d59;if(_0x3507ce>=_0x9b5c9b){_0x3507ce=_0x9b5c9b;_0x445d59=0xc8;}else{_0x445d59=0xce;}_0x365d2c['status'](_0x445d59);return _0x365d2c['set'](_0x31f1('0x24'),_0x1a3fb4+'-'+_0x3507ce+'/'+_0x9b5c9b)[_0x31f1('0x1f')](_0xe2bc79);}return null;};}function patchUpdates(_0x461823){return function(_0x30da7c){try{jsonpatch['apply'](_0x30da7c,_0x461823,!![]);}catch(_0x35e2f3){return BPromise[_0x31f1('0x25')](_0x35e2f3);}return _0x30da7c['save']();};}function saveUpdates(_0x317738,_0x1e2678){return function(_0x16149f){if(_0x16149f){return _0x16149f[_0x31f1('0x26')](_0x317738)[_0x31f1('0x27')](function(_0x2bce0c){return _0x2bce0c;});}return null;};}function removeEntity(_0x59ce7d,_0x39a68b){return function(_0x11637d){if(_0x11637d){return _0x11637d[_0x31f1('0x28')]()['then'](function(){_0x59ce7d[_0x31f1('0x1d')](0xcc)[_0x31f1('0x1e')]();});}};}function handleEntityNotFound(_0x3e5cfb,_0x45bf3a){return function(_0x480bbd){if(!_0x480bbd){_0x3e5cfb['sendStatus'](0x194);}return _0x480bbd;};}function handleError(_0x3fef00,_0x385d12){_0x385d12=_0x385d12||0x1f4;return function(_0x59b8d0){logger[_0x31f1('0x29')](_0x59b8d0[_0x31f1('0x2a')]);if(_0x59b8d0['name']){delete _0x59b8d0['name'];}_0x3fef00[_0x31f1('0x1d')](_0x385d12)[_0x31f1('0x2b')](_0x59b8d0);};}exports[_0x31f1('0x2c')]=function(_0x21b36d,_0x3ceb4a){var _0x23ae33={},_0x363dbf={},_0x29e8bb={'count':0x0,'rows':[]};var _0x4343aa=_[_0x31f1('0x2d')](db[_0x31f1('0x2e')]['rawAttributes'],function(_0x573230){return{'name':_0x573230[_0x31f1('0x2f')],'type':_0x573230[_0x31f1('0x30')]['key']};});_0x363dbf[_0x31f1('0x31')]=_[_0x31f1('0x2d')](_0x4343aa,_0x31f1('0x32'));_0x363dbf[_0x31f1('0x33')]=_[_0x31f1('0x34')](_0x21b36d['query']);_0x363dbf[_0x31f1('0x35')]=_['intersection'](_0x363dbf['model'],_0x363dbf[_0x31f1('0x33')]);_0x23ae33[_0x31f1('0x36')]=_[_0x31f1('0x37')](_0x363dbf[_0x31f1('0x31')],qs[_0x31f1('0x38')](_0x21b36d[_0x31f1('0x33')]['fields']));_0x23ae33['attributes']=_0x23ae33[_0x31f1('0x36')]['length']?_0x23ae33[_0x31f1('0x36')]:_0x363dbf[_0x31f1('0x31')];if(!_0x21b36d[_0x31f1('0x33')][_0x31f1('0x39')]('nolimit')){_0x23ae33[_0x31f1('0x23')]=qs[_0x31f1('0x23')](_0x21b36d[_0x31f1('0x33')][_0x31f1('0x23')]);_0x23ae33['offset']=qs[_0x31f1('0x20')](_0x21b36d[_0x31f1('0x33')]['offset']);}_0x23ae33[_0x31f1('0x3a')]=qs[_0x31f1('0x3b')](_0x21b36d[_0x31f1('0x33')][_0x31f1('0x3b')]);_0x23ae33[_0x31f1('0x3c')]=qs['filters'](_[_0x31f1('0x3d')](_0x21b36d[_0x31f1('0x33')],_0x363dbf[_0x31f1('0x35')]),_0x4343aa);if(_0x21b36d[_0x31f1('0x33')][_0x31f1('0x3e')]){_0x23ae33[_0x31f1('0x3c')]=_['merge'](_0x23ae33['where'],{'$or':_['map'](_0x4343aa,function(_0x37b1ac){if(_0x37b1ac[_0x31f1('0x30')]!==_0x31f1('0x3f')){var _0x50138d={};_0x50138d[_0x37b1ac[_0x31f1('0x32')]]={'$like':'%'+_0x21b36d[_0x31f1('0x33')][_0x31f1('0x3e')]+'%'};return _0x50138d;}})});}_0x23ae33=_['merge']({},_0x23ae33,_0x21b36d['options']);var _0x151033={'where':_0x23ae33[_0x31f1('0x3c')]};return db['VtigerAccount'][_0x31f1('0x22')](_0x151033)[_0x31f1('0x27')](function(_0x3cdcfd){_0x29e8bb[_0x31f1('0x22')]=_0x3cdcfd;if(_0x21b36d[_0x31f1('0x33')][_0x31f1('0x40')]){_0x23ae33[_0x31f1('0x41')]=[{'all':!![]}];}return db[_0x31f1('0x2e')][_0x31f1('0x42')](_0x23ae33);})[_0x31f1('0x27')](function(_0x521c7f){_0x29e8bb['rows']=_0x521c7f;return _0x29e8bb;})[_0x31f1('0x27')](respondWithFilteredResult(_0x3ceb4a,_0x23ae33))['catch'](handleError(_0x3ceb4a,null));};exports[_0x31f1('0x43')]=function(_0x49b60d,_0x4f5f26){var _0x17c406={'raw':![],'where':{'id':_0x49b60d['params']['id']}},_0x4cbe2={};_0x4cbe2['model']=_[_0x31f1('0x34')](db[_0x31f1('0x2e')]['rawAttributes']);_0x4cbe2[_0x31f1('0x33')]=_[_0x31f1('0x34')](_0x49b60d[_0x31f1('0x33')]);_0x4cbe2[_0x31f1('0x35')]=_[_0x31f1('0x37')](_0x4cbe2['model'],_0x4cbe2[_0x31f1('0x33')]);_0x17c406[_0x31f1('0x36')]=_['intersection'](_0x4cbe2[_0x31f1('0x31')],qs['fields'](_0x49b60d[_0x31f1('0x33')][_0x31f1('0x38')]));_0x17c406[_0x31f1('0x36')]=_0x17c406[_0x31f1('0x36')][_0x31f1('0x44')]?_0x17c406['attributes']:_0x4cbe2['model'];if(_0x49b60d['query'][_0x31f1('0x40')]){_0x17c406[_0x31f1('0x41')]=[{'all':!![]}];}_0x17c406=_[_0x31f1('0x45')]({},_0x17c406,_0x49b60d[_0x31f1('0x46')]);return db[_0x31f1('0x2e')][_0x31f1('0x47')](_0x17c406)[_0x31f1('0x27')](handleEntityNotFound(_0x4f5f26,null))[_0x31f1('0x27')](respondWithResult(_0x4f5f26,null))[_0x31f1('0x48')](handleError(_0x4f5f26,null));};exports[_0x31f1('0x49')]=function(_0x21cae4,_0x34267e){return db['VtigerAccount'][_0x31f1('0x49')](_0x21cae4['body'],{})[_0x31f1('0x27')](respondWithResult(_0x34267e,0xc9))[_0x31f1('0x48')](handleError(_0x34267e,null));};exports[_0x31f1('0x26')]=function(_0x2cd1e7,_0x426a37){if(_0x2cd1e7[_0x31f1('0x4a')]['id']){delete _0x2cd1e7['body']['id'];}return db['VtigerAccount'][_0x31f1('0x47')]({'where':{'id':_0x2cd1e7[_0x31f1('0x4b')]['id']}})[_0x31f1('0x27')](handleEntityNotFound(_0x426a37,null))[_0x31f1('0x27')](saveUpdates(_0x2cd1e7['body'],null))[_0x31f1('0x27')](respondWithResult(_0x426a37,null))['catch'](handleError(_0x426a37,null));};exports[_0x31f1('0x28')]=function(_0x473f22,_0x378e9f){return db[_0x31f1('0x2e')][_0x31f1('0x47')]({'where':{'id':_0x473f22[_0x31f1('0x4b')]['id']}})[_0x31f1('0x27')](handleEntityNotFound(_0x378e9f,null))[_0x31f1('0x27')](removeEntity(_0x378e9f,null))['catch'](handleError(_0x378e9f,null));};exports['getConfigurations']=function(_0x1af2e4,_0xf7ea07,_0x29bdbe){var _0x5b2b7d={};var _0x17ae39={};var _0x3b0ea7;var _0x33c3bc;return db[_0x31f1('0x2e')][_0x31f1('0x4c')]({'where':{'id':_0x1af2e4[_0x31f1('0x4b')]['id']}})[_0x31f1('0x27')](handleEntityNotFound(_0xf7ea07,null))[_0x31f1('0x27')](function(_0x10818b){if(_0x10818b){_0x3b0ea7=_0x10818b;_0x17ae39['model']=_[_0x31f1('0x34')](db['VtigerConfiguration']['rawAttributes']);_0x17ae39['query']=_['keys'](_0x1af2e4[_0x31f1('0x33')]);_0x17ae39[_0x31f1('0x35')]=_[_0x31f1('0x37')](_0x17ae39[_0x31f1('0x31')],_0x17ae39[_0x31f1('0x33')]);_0x5b2b7d[_0x31f1('0x36')]=_['intersection'](_0x17ae39[_0x31f1('0x31')],qs[_0x31f1('0x38')](_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x38')]));_0x5b2b7d['attributes']=_0x5b2b7d[_0x31f1('0x36')][_0x31f1('0x44')]?_0x5b2b7d[_0x31f1('0x36')]:_0x17ae39['model'];_0x5b2b7d[_0x31f1('0x3a')]=qs[_0x31f1('0x3b')](_0x1af2e4[_0x31f1('0x33')]['sort']);_0x5b2b7d[_0x31f1('0x3c')]=qs[_0x31f1('0x35')](_[_0x31f1('0x3d')](_0x1af2e4[_0x31f1('0x33')],_0x17ae39[_0x31f1('0x35')]));if(_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x3e')]){_0x5b2b7d[_0x31f1('0x3c')]=_['merge'](_0x5b2b7d[_0x31f1('0x3c')],{'$or':_['map'](_0x5b2b7d[_0x31f1('0x36')],function(_0x56c2a3){var _0x505ae1={};_0x505ae1[_0x56c2a3]={'$like':'%'+_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x3e')]+'%'};return _0x505ae1;})});}_0x5b2b7d=_['merge']({},_0x5b2b7d,_0x1af2e4[_0x31f1('0x46')]);return _0x3b0ea7['getConfigurations'](_0x5b2b7d);}})[_0x31f1('0x27')](function(_0x6eb608){if(_0x6eb608){_0x33c3bc=_0x6eb608[_0x31f1('0x44')];if(!_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x39')](_0x31f1('0x4d'))){_0x5b2b7d[_0x31f1('0x23')]=qs[_0x31f1('0x23')](_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x23')]);_0x5b2b7d[_0x31f1('0x20')]=qs[_0x31f1('0x20')](_0x1af2e4[_0x31f1('0x33')][_0x31f1('0x20')]);}return _0x3b0ea7[_0x31f1('0x4e')](_0x5b2b7d);}})[_0x31f1('0x27')](function(_0xb15b5){if(_0xb15b5){return _0xb15b5?{'count':_0x33c3bc,'rows':_0xb15b5}:null;}})[_0x31f1('0x27')](respondWithResult(_0xf7ea07,null))[_0x31f1('0x48')](handleError(_0xf7ea07,null));};exports[_0x31f1('0x4f')]=function(_0x23d0f0,_0x48e59d,_0x2bc93a){if(_0x23d0f0[_0x31f1('0x4a')]['id']){delete _0x23d0f0[_0x31f1('0x4a')]['id'];}return db[_0x31f1('0x2e')]['findOne']({'where':{'id':_0x23d0f0[_0x31f1('0x4b')]['id']}})[_0x31f1('0x27')](handleEntityNotFound(_0x48e59d,null))['then'](function(_0x242acc){if(_0x242acc){_0x23d0f0['body'][_0x31f1('0x50')]=_0x242acc['id'];_0x23d0f0[_0x31f1('0x4a')][_0x31f1('0x51')]=integrations[_0x31f1('0x52')](_0x23d0f0[_0x31f1('0x4a')][_0x31f1('0x53')],_0x23d0f0[_0x31f1('0x4a')][_0x31f1('0x30')]);_0x23d0f0[_0x31f1('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x23d0f0[_0x31f1('0x4a')][_0x31f1('0x53')],_0x23d0f0[_0x31f1('0x4a')][_0x31f1('0x30')]);return db[_0x31f1('0x54')][_0x31f1('0x49')](_0x23d0f0[_0x31f1('0x4a')],{'include':[{'model':db[_0x31f1('0x55')],'as':_0x31f1('0x51')},{'model':db[_0x31f1('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x48e59d,null))[_0x31f1('0x48')](handleError(_0x48e59d,null));};var md5=require(_0x31f1('0x56'));exports[_0x31f1('0x57')]=function(_0x41e218,_0x367f7a,_0x117e1b){var _0x16c3f7=null;var _0x36b78d=null;var _0xfbf42a=null;var _0x53239e=null;var _0x5a84fd='';return db[_0x31f1('0x2e')]['findOne']({'where':{'id':_0x41e218[_0x31f1('0x4b')]['id']},'attributes':['id',_0x31f1('0x32'),'username','description',_0x31f1('0x58'),_0x31f1('0x59'),_0x31f1('0x5a'),_0x31f1('0x5b')]})[_0x31f1('0x27')](handleEntityNotFound(_0x367f7a,null))[_0x31f1('0x27')](function(_0x2a8c23){if(_0x2a8c23){_0x16c3f7=_0x2a8c23[_0x31f1('0x5c')];_0x36b78d=_0x2a8c23[_0x31f1('0x5b')];_0xfbf42a=_0x2a8c23[_0x31f1('0x58')];_0x5a84fd=_0x2a8c23[_0x31f1('0x59')];var _0x427100=_0x5a84fd[_0x31f1('0x5d')](-0x1);if(_0x427100==='/'){_0x5a84fd=_0x5a84fd[_0x31f1('0x5e')](0x0,_0x5a84fd[_0x31f1('0x5f')](_0x427100));}_0x53239e=util[_0x31f1('0x60')](_0x31f1('0x61'),_0x5a84fd);var _0x422d38={'method':_0x31f1('0x62'),'uri':_0x53239e,'qs':{'operation':_0x31f1('0x63'),'username':_0x2a8c23[_0x31f1('0x5c')]},'json':!![]};return rp(_0x422d38);}})[_0x31f1('0x27')](function(_0x218928){if(_0x218928[_0x31f1('0x64')]){var _0x2c3e97={'method':_0x31f1('0x65'),'uri':_0x53239e,'form':{'operation':_0x31f1('0x66'),'username':_0x16c3f7,'accessKey':md5(_0x218928[_0x31f1('0x67')][_0x31f1('0x68')]+_0x36b78d)},'json':!![]};return rp(_0x2c3e97);}})[_0x31f1('0x27')](function(_0x2aef9c){if(_0x2aef9c[_0x31f1('0x64')]){var _0x127a44={'method':_0x31f1('0x62'),'uri':_0x53239e,'qs':{'operation':_0x31f1('0x69'),'username':_0x16c3f7,'sessionName':_0x2aef9c[_0x31f1('0x67')][_0x31f1('0x6a')],'elementType':_0xfbf42a},'json':!![]};return rp(_0x127a44);}})[_0x31f1('0x27')](function(_0x597379){if(_0x597379[_0x31f1('0x64')]){var _0x45b579=[_0x31f1('0x6b'),_0x31f1('0x6c'),_0x31f1('0x6d')];_[_0x31f1('0x6e')](_0x597379['result'][_0x31f1('0x38')],function(_0x49c2be){return _0x45b579[_0x31f1('0x6f')](_0x49c2be[_0x31f1('0x30')]['name']);});_[_0x31f1('0x6e')](_0x597379[_0x31f1('0x67')][_0x31f1('0x38')],function(_0x56a5db){return _0x56a5db['editable']==='false';});return{'count':_0x597379[_0x31f1('0x67')][_0x31f1('0x38')][_0x31f1('0x44')],'rows':_[_0x31f1('0x2d')](_0x597379[_0x31f1('0x67')][_0x31f1('0x38')],function(_0x58f139){return{'id':_0x58f139[_0x31f1('0x32')],'name':_0x58f139['label'],'custom':_[_0x31f1('0x70')](_0x58f139[_0x31f1('0x32')],_0x31f1('0x71'))?!![]:![],'options':_0x58f139['type'][_0x31f1('0x32')]===_0x31f1('0x72')&&_0x58f139[_0x31f1('0x30')][_0x31f1('0x73')]['length']>0x0?_[_0x31f1('0x2d')](_0x58f139[_0x31f1('0x30')][_0x31f1('0x73')],function(_0x3d3b8e){return{'name':_0x3d3b8e[_0x31f1('0x74')],'value':_0x3d3b8e[_0x31f1('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x367f7a,null))[_0x31f1('0x48')](function(_0x55cea9){console['log']('vTiger\x20error:\x20'+_0x55cea9);var _0x258ce9=_0x41e218[_0x31f1('0x33')][_0x31f1('0x76')]?0x1f4:_0x55cea9[_0x31f1('0x77')]||0x1f4;logger['error'](_0x31f1('0x78'),_0x31f1('0x57'),_0x258ce9,JSON[_0x31f1('0x79')](_0x55cea9));delete _0x55cea9[_0x31f1('0x32')];if(_0x258ce9===0x191){_0x258ce9=0x190;}_0x367f7a[_0x31f1('0x1d')](_0x258ce9)[_0x31f1('0x2b')](_0x41e218[_0x31f1('0x33')][_0x31f1('0x76')]?{'message':_0x31f1('0x7a'),'statusCode':_0x55cea9['statusCode']}:_0x55cea9);});}; \ No newline at end of file +var _0x5eef=['test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','fields','includeAll','include','find','catch','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','remoteUri','username','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','result','sessionName','autogenerated','reference','owner','label','startsWith','picklistValues','value','vTiger\x20error:\x20'];(function(_0x2b31f9,_0x14fdae){var _0x248e0f=function(_0x217244){while(--_0x217244){_0x2b31f9['push'](_0x2b31f9['shift']());}};_0x248e0f(++_0x14fdae);}(_0x5eef,0x1dd));var _0xf5ee=function(_0x134f77,_0x3d96bb){_0x134f77=_0x134f77-0x0;var _0x2d7508=_0x5eef[_0x134f77];return _0x2d7508;};'use strict';var emlformat=require(_0xf5ee('0x0'));var rimraf=require(_0xf5ee('0x1'));var zipdir=require(_0xf5ee('0x2'));var jsonpatch=require(_0xf5ee('0x3'));var rp=require(_0xf5ee('0x4'));var moment=require(_0xf5ee('0x5'));var BPromise=require(_0xf5ee('0x6'));var Mustache=require(_0xf5ee('0x7'));var util=require(_0xf5ee('0x8'));var path=require(_0xf5ee('0x9'));var sox=require(_0xf5ee('0xa'));var csv=require(_0xf5ee('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5ee('0xc'));var _=require(_0xf5ee('0xd'));var squel=require(_0xf5ee('0xe'));var crypto=require(_0xf5ee('0xf'));var jsforce=require(_0xf5ee('0x10'));var deskjs=require(_0xf5ee('0x11'));var toCsv=require(_0xf5ee('0xb'));var querystring=require(_0xf5ee('0x12'));var Papa=require(_0xf5ee('0x13'));var Redis=require('ioredis');var authService=require(_0xf5ee('0x14'));var qs=require(_0xf5ee('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5ee('0x16'));var logger=require('../../config/logger')(_0xf5ee('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf5ee('0x18'));var db=require(_0xf5ee('0x19'))['db'];var integrations=require(_0xf5ee('0x1a'));function respondWithStatusCode(_0x5af4ce,_0x197726){_0x197726=_0x197726||0xcc;return function(_0x32bbcf){if(_0x32bbcf){return _0x5af4ce[_0xf5ee('0x1b')](_0x197726);}return _0x5af4ce['status'](_0x197726)[_0xf5ee('0x1c')]();};}function respondWithResult(_0x525b3d,_0x35d2be){_0x35d2be=_0x35d2be||0xc8;return function(_0xf7d170){if(_0xf7d170){return _0x525b3d['status'](_0x35d2be)['json'](_0xf7d170);}};}function respondWithFilteredResult(_0x53e4cd,_0x3112bd){return function(_0x10d205){if(_0x10d205){var _0x1bcbed=typeof _0x3112bd[_0xf5ee('0x1d')]===_0xf5ee('0x1e')&&typeof _0x3112bd[_0xf5ee('0x1f')]===_0xf5ee('0x1e');var _0x992147=_0x10d205['count'];var _0x3ac87e=_0x1bcbed?0x0:_0x3112bd[_0xf5ee('0x1d')];var _0x385d26=_0x1bcbed?_0x10d205['count']:_0x3112bd[_0xf5ee('0x1d')]+_0x3112bd[_0xf5ee('0x1f')];var _0x3559ab;if(_0x385d26>=_0x992147){_0x385d26=_0x992147;_0x3559ab=0xc8;}else{_0x3559ab=0xce;}_0x53e4cd[_0xf5ee('0x20')](_0x3559ab);return _0x53e4cd[_0xf5ee('0x21')](_0xf5ee('0x22'),_0x3ac87e+'-'+_0x385d26+'/'+_0x992147)['json'](_0x10d205);}return null;};}function patchUpdates(_0x3ab4c9){return function(_0x28bd73){try{jsonpatch[_0xf5ee('0x23')](_0x28bd73,_0x3ab4c9,!![]);}catch(_0x28951f){return BPromise[_0xf5ee('0x24')](_0x28951f);}return _0x28bd73[_0xf5ee('0x25')]();};}function saveUpdates(_0x4dad8c,_0x1b3f80){return function(_0x33de37){if(_0x33de37){return _0x33de37[_0xf5ee('0x26')](_0x4dad8c)[_0xf5ee('0x27')](function(_0x52e1af){return _0x52e1af;});}return null;};}function removeEntity(_0x154dc9,_0x3e8318){return function(_0x17d469){if(_0x17d469){return _0x17d469[_0xf5ee('0x28')]()['then'](function(){_0x154dc9['status'](0xcc)[_0xf5ee('0x1c')]();});}};}function handleEntityNotFound(_0xd468d0,_0x27f6c2){return function(_0x15e971){if(!_0x15e971){_0xd468d0[_0xf5ee('0x1b')](0x194);}return _0x15e971;};}function handleError(_0x199569,_0x4e14f6){_0x4e14f6=_0x4e14f6||0x1f4;return function(_0x4b4f75){logger['error'](_0x4b4f75[_0xf5ee('0x29')]);if(_0x4b4f75[_0xf5ee('0x2a')]){delete _0x4b4f75[_0xf5ee('0x2a')];}_0x199569['status'](_0x4e14f6)[_0xf5ee('0x2b')](_0x4b4f75);};}exports['index']=function(_0x1814f9,_0x1df815){var _0x2b8b2f={},_0x2511b6={},_0x498169={'count':0x0,'rows':[]};var _0xba1069=_[_0xf5ee('0x2c')](db[_0xf5ee('0x2d')][_0xf5ee('0x2e')],function(_0x27dbe9){return{'name':_0x27dbe9['fieldName'],'type':_0x27dbe9[_0xf5ee('0x2f')][_0xf5ee('0x30')]};});_0x2511b6[_0xf5ee('0x31')]=_[_0xf5ee('0x2c')](_0xba1069,'name');_0x2511b6[_0xf5ee('0x32')]=_[_0xf5ee('0x33')](_0x1814f9[_0xf5ee('0x32')]);_0x2511b6[_0xf5ee('0x34')]=_['intersection'](_0x2511b6[_0xf5ee('0x31')],_0x2511b6[_0xf5ee('0x32')]);_0x2b8b2f[_0xf5ee('0x35')]=_[_0xf5ee('0x36')](_0x2511b6[_0xf5ee('0x31')],qs['fields'](_0x1814f9[_0xf5ee('0x32')]['fields']));_0x2b8b2f[_0xf5ee('0x35')]=_0x2b8b2f[_0xf5ee('0x35')][_0xf5ee('0x37')]?_0x2b8b2f[_0xf5ee('0x35')]:_0x2511b6[_0xf5ee('0x31')];if(!_0x1814f9['query'][_0xf5ee('0x38')](_0xf5ee('0x39'))){_0x2b8b2f[_0xf5ee('0x1f')]=qs[_0xf5ee('0x1f')](_0x1814f9['query']['limit']);_0x2b8b2f['offset']=qs[_0xf5ee('0x1d')](_0x1814f9[_0xf5ee('0x32')][_0xf5ee('0x1d')]);}_0x2b8b2f[_0xf5ee('0x3a')]=qs[_0xf5ee('0x3b')](_0x1814f9[_0xf5ee('0x32')][_0xf5ee('0x3b')]);_0x2b8b2f['where']=qs[_0xf5ee('0x34')](_[_0xf5ee('0x3c')](_0x1814f9['query'],_0x2511b6[_0xf5ee('0x34')]),_0xba1069);if(_0x1814f9[_0xf5ee('0x32')][_0xf5ee('0x3d')]){_0x2b8b2f[_0xf5ee('0x3e')]=_[_0xf5ee('0x3f')](_0x2b8b2f[_0xf5ee('0x3e')],{'$or':_['map'](_0xba1069,function(_0x22cdf9){if(_0x22cdf9['type']!==_0xf5ee('0x40')){var _0x4f06ac={};_0x4f06ac[_0x22cdf9[_0xf5ee('0x2a')]]={'$like':'%'+_0x1814f9[_0xf5ee('0x32')][_0xf5ee('0x3d')]+'%'};return _0x4f06ac;}})});}_0x2b8b2f=_['merge']({},_0x2b8b2f,_0x1814f9[_0xf5ee('0x41')]);var _0xdf4d37={'where':_0x2b8b2f[_0xf5ee('0x3e')]};return db[_0xf5ee('0x2d')][_0xf5ee('0x42')](_0xdf4d37)[_0xf5ee('0x27')](function(_0x15e8c9){_0x498169[_0xf5ee('0x42')]=_0x15e8c9;if(_0x1814f9[_0xf5ee('0x32')]['includeAll']){_0x2b8b2f['include']=[{'all':!![]}];}return db[_0xf5ee('0x2d')][_0xf5ee('0x43')](_0x2b8b2f);})['then'](function(_0x53a185){_0x498169[_0xf5ee('0x44')]=_0x53a185;return _0x498169;})[_0xf5ee('0x27')](respondWithFilteredResult(_0x1df815,_0x2b8b2f))['catch'](handleError(_0x1df815,null));};exports[_0xf5ee('0x45')]=function(_0x1c7431,_0x21d98b){var _0x367672={'raw':![],'where':{'id':_0x1c7431[_0xf5ee('0x46')]['id']}},_0x39a485={};_0x39a485['model']=_[_0xf5ee('0x33')](db['VtigerAccount']['rawAttributes']);_0x39a485[_0xf5ee('0x32')]=_[_0xf5ee('0x33')](_0x1c7431[_0xf5ee('0x32')]);_0x39a485[_0xf5ee('0x34')]=_['intersection'](_0x39a485[_0xf5ee('0x31')],_0x39a485[_0xf5ee('0x32')]);_0x367672[_0xf5ee('0x35')]=_['intersection'](_0x39a485[_0xf5ee('0x31')],qs['fields'](_0x1c7431['query'][_0xf5ee('0x47')]));_0x367672[_0xf5ee('0x35')]=_0x367672['attributes']['length']?_0x367672[_0xf5ee('0x35')]:_0x39a485['model'];if(_0x1c7431[_0xf5ee('0x32')][_0xf5ee('0x48')]){_0x367672[_0xf5ee('0x49')]=[{'all':!![]}];}_0x367672=_[_0xf5ee('0x3f')]({},_0x367672,_0x1c7431[_0xf5ee('0x41')]);return db['VtigerAccount'][_0xf5ee('0x4a')](_0x367672)[_0xf5ee('0x27')](handleEntityNotFound(_0x21d98b,null))[_0xf5ee('0x27')](respondWithResult(_0x21d98b,null))[_0xf5ee('0x4b')](handleError(_0x21d98b,null));};exports[_0xf5ee('0x4c')]=function(_0x592ea2,_0x58fbef){return db['VtigerAccount'][_0xf5ee('0x4c')](_0x592ea2[_0xf5ee('0x4d')],{})['then'](respondWithResult(_0x58fbef,0xc9))[_0xf5ee('0x4b')](handleError(_0x58fbef,null));};exports['update']=function(_0x2726d2,_0x455a03){if(_0x2726d2[_0xf5ee('0x4d')]['id']){delete _0x2726d2[_0xf5ee('0x4d')]['id'];}return db['VtigerAccount'][_0xf5ee('0x4a')]({'where':{'id':_0x2726d2[_0xf5ee('0x46')]['id']}})[_0xf5ee('0x27')](handleEntityNotFound(_0x455a03,null))[_0xf5ee('0x27')](saveUpdates(_0x2726d2[_0xf5ee('0x4d')],null))[_0xf5ee('0x27')](respondWithResult(_0x455a03,null))[_0xf5ee('0x4b')](handleError(_0x455a03,null));};exports[_0xf5ee('0x28')]=function(_0x5df120,_0x390fd2){return db[_0xf5ee('0x2d')][_0xf5ee('0x4a')]({'where':{'id':_0x5df120['params']['id']}})[_0xf5ee('0x27')](handleEntityNotFound(_0x390fd2,null))[_0xf5ee('0x27')](removeEntity(_0x390fd2,null))[_0xf5ee('0x4b')](handleError(_0x390fd2,null));};exports['getConfigurations']=function(_0x174043,_0x513152,_0x236ebb){var _0x1b3409={};var _0x5aeec4={};var _0x173ab3;var _0x14c263;return db[_0xf5ee('0x2d')][_0xf5ee('0x4e')]({'where':{'id':_0x174043[_0xf5ee('0x46')]['id']}})[_0xf5ee('0x27')](handleEntityNotFound(_0x513152,null))['then'](function(_0x23a2a0){if(_0x23a2a0){_0x173ab3=_0x23a2a0;_0x5aeec4[_0xf5ee('0x31')]=_[_0xf5ee('0x33')](db[_0xf5ee('0x4f')]['rawAttributes']);_0x5aeec4[_0xf5ee('0x32')]=_[_0xf5ee('0x33')](_0x174043[_0xf5ee('0x32')]);_0x5aeec4[_0xf5ee('0x34')]=_[_0xf5ee('0x36')](_0x5aeec4[_0xf5ee('0x31')],_0x5aeec4[_0xf5ee('0x32')]);_0x1b3409[_0xf5ee('0x35')]=_[_0xf5ee('0x36')](_0x5aeec4[_0xf5ee('0x31')],qs['fields'](_0x174043[_0xf5ee('0x32')]['fields']));_0x1b3409[_0xf5ee('0x35')]=_0x1b3409[_0xf5ee('0x35')][_0xf5ee('0x37')]?_0x1b3409[_0xf5ee('0x35')]:_0x5aeec4[_0xf5ee('0x31')];_0x1b3409[_0xf5ee('0x3a')]=qs[_0xf5ee('0x3b')](_0x174043[_0xf5ee('0x32')][_0xf5ee('0x3b')]);_0x1b3409[_0xf5ee('0x3e')]=qs[_0xf5ee('0x34')](_[_0xf5ee('0x3c')](_0x174043[_0xf5ee('0x32')],_0x5aeec4['filters']));if(_0x174043[_0xf5ee('0x32')][_0xf5ee('0x3d')]){_0x1b3409['where']=_[_0xf5ee('0x3f')](_0x1b3409['where'],{'$or':_[_0xf5ee('0x2c')](_0x1b3409[_0xf5ee('0x35')],function(_0xdea239){var _0x1e9f33={};_0x1e9f33[_0xdea239]={'$like':'%'+_0x174043[_0xf5ee('0x32')][_0xf5ee('0x3d')]+'%'};return _0x1e9f33;})});}_0x1b3409=_[_0xf5ee('0x3f')]({},_0x1b3409,_0x174043[_0xf5ee('0x41')]);return _0x173ab3['getConfigurations'](_0x1b3409);}})[_0xf5ee('0x27')](function(_0x16f032){if(_0x16f032){_0x14c263=_0x16f032[_0xf5ee('0x37')];if(!_0x174043[_0xf5ee('0x32')][_0xf5ee('0x38')](_0xf5ee('0x39'))){_0x1b3409[_0xf5ee('0x1f')]=qs[_0xf5ee('0x1f')](_0x174043['query'][_0xf5ee('0x1f')]);_0x1b3409[_0xf5ee('0x1d')]=qs[_0xf5ee('0x1d')](_0x174043[_0xf5ee('0x32')][_0xf5ee('0x1d')]);}return _0x173ab3[_0xf5ee('0x50')](_0x1b3409);}})[_0xf5ee('0x27')](function(_0x347c9b){if(_0x347c9b){return _0x347c9b?{'count':_0x14c263,'rows':_0x347c9b}:null;}})['then'](respondWithResult(_0x513152,null))[_0xf5ee('0x4b')](handleError(_0x513152,null));};exports[_0xf5ee('0x51')]=function(_0x4f31c0,_0x431644,_0x22a167){if(_0x4f31c0[_0xf5ee('0x4d')]['id']){delete _0x4f31c0[_0xf5ee('0x4d')]['id'];}return db[_0xf5ee('0x2d')][_0xf5ee('0x4e')]({'where':{'id':_0x4f31c0[_0xf5ee('0x46')]['id']}})[_0xf5ee('0x27')](handleEntityNotFound(_0x431644,null))['then'](function(_0x30ca4f){if(_0x30ca4f){_0x4f31c0[_0xf5ee('0x4d')][_0xf5ee('0x52')]=_0x30ca4f['id'];_0x4f31c0[_0xf5ee('0x4d')][_0xf5ee('0x53')]=integrations[_0xf5ee('0x54')](_0x4f31c0['body'][_0xf5ee('0x55')],_0x4f31c0[_0xf5ee('0x4d')][_0xf5ee('0x2f')]);_0x4f31c0['body'][_0xf5ee('0x56')]=integrations[_0xf5ee('0x57')](_0x4f31c0[_0xf5ee('0x4d')][_0xf5ee('0x55')],_0x4f31c0['body'][_0xf5ee('0x2f')]);return db[_0xf5ee('0x4f')][_0xf5ee('0x4c')](_0x4f31c0[_0xf5ee('0x4d')],{'include':[{'model':db[_0xf5ee('0x58')],'as':_0xf5ee('0x53')},{'model':db[_0xf5ee('0x58')],'as':_0xf5ee('0x56')}]});}return null;})[_0xf5ee('0x27')](respondWithResult(_0x431644,null))[_0xf5ee('0x4b')](handleError(_0x431644,null));};var md5=require('md5');exports[_0xf5ee('0x59')]=function(_0x4e1684,_0x88ad96,_0x1da02c){var _0x87c34f=null;var _0x3dc6d9=null;var _0x320c1f=null;var _0x4de9ab=null;var _0x3fc973='';return db[_0xf5ee('0x2d')]['findOne']({'where':{'id':_0x4e1684[_0xf5ee('0x46')]['id']},'attributes':['id','name','username',_0xf5ee('0x5a'),_0xf5ee('0x5b'),_0xf5ee('0x5c'),'serverUrl','accessKey']})['then'](handleEntityNotFound(_0x88ad96,null))['then'](function(_0x2b3072){if(_0x2b3072){_0x87c34f=_0x2b3072[_0xf5ee('0x5d')];_0x3dc6d9=_0x2b3072[_0xf5ee('0x5e')];_0x320c1f=_0x2b3072[_0xf5ee('0x5b')];_0x3fc973=_0x2b3072[_0xf5ee('0x5c')];var _0x537f12=_0x3fc973[_0xf5ee('0x5f')](-0x1);if(_0x537f12==='/'){_0x3fc973=_0x3fc973[_0xf5ee('0x60')](0x0,_0x3fc973['lastIndexOf'](_0x537f12));}_0x4de9ab=util[_0xf5ee('0x61')](_0xf5ee('0x62'),_0x3fc973);var _0x23032b={'method':_0xf5ee('0x63'),'uri':_0x4de9ab,'qs':{'operation':_0xf5ee('0x64'),'username':_0x2b3072[_0xf5ee('0x5d')]},'json':!![]};return rp(_0x23032b);}})[_0xf5ee('0x27')](function(_0x19e7aa){if(_0x19e7aa[_0xf5ee('0x65')]){var _0x443d45={'method':_0xf5ee('0x66'),'uri':_0x4de9ab,'form':{'operation':'login','username':_0x87c34f,'accessKey':md5(_0x19e7aa[_0xf5ee('0x67')]['token']+_0x3dc6d9)},'json':!![]};return rp(_0x443d45);}})[_0xf5ee('0x27')](function(_0x1d27cb){if(_0x1d27cb[_0xf5ee('0x65')]){var _0x10cd50={'method':_0xf5ee('0x63'),'uri':_0x4de9ab,'qs':{'operation':'describe','username':_0x87c34f,'sessionName':_0x1d27cb['result'][_0xf5ee('0x68')],'elementType':_0x320c1f},'json':!![]};return rp(_0x10cd50);}})['then'](function(_0x2942c4){if(_0x2942c4[_0xf5ee('0x65')]){var _0x3ec70f=[_0xf5ee('0x69'),_0xf5ee('0x6a'),_0xf5ee('0x6b')];_['remove'](_0x2942c4['result'][_0xf5ee('0x47')],function(_0x237038){return _0x3ec70f['includes'](_0x237038[_0xf5ee('0x2f')][_0xf5ee('0x2a')]);});_['remove'](_0x2942c4[_0xf5ee('0x67')][_0xf5ee('0x47')],function(_0x585a8f){return _0x585a8f['editable']==='false';});return{'count':_0x2942c4[_0xf5ee('0x67')][_0xf5ee('0x47')]['length'],'rows':_['map'](_0x2942c4[_0xf5ee('0x67')][_0xf5ee('0x47')],function(_0x117ce2){return{'id':_0x117ce2[_0xf5ee('0x2a')],'name':_0x117ce2[_0xf5ee('0x6c')],'custom':_[_0xf5ee('0x6d')](_0x117ce2[_0xf5ee('0x2a')],'cf_')?!![]:![],'options':_0x117ce2[_0xf5ee('0x2f')][_0xf5ee('0x2a')]==='picklist'&&_0x117ce2[_0xf5ee('0x2f')][_0xf5ee('0x6e')]['length']>0x0?_['map'](_0x117ce2[_0xf5ee('0x2f')][_0xf5ee('0x6e')],function(_0x55f0bb){return{'name':_0x55f0bb['label'],'value':_0x55f0bb[_0xf5ee('0x6f')]};}):[]};})};}})[_0xf5ee('0x27')](respondWithResult(_0x88ad96,null))[_0xf5ee('0x4b')](function(_0x18c80f){console['log'](_0xf5ee('0x70')+_0x18c80f);var _0x2493de=_0x4e1684['query'][_0xf5ee('0x71')]?0x1f4:_0x18c80f['statusCode']||0x1f4;logger['error'](_0xf5ee('0x72'),'getFields',_0x2493de,JSON[_0xf5ee('0x73')](_0x18c80f));delete _0x18c80f[_0xf5ee('0x2a')];if(_0x2493de===0x191){_0x2493de=0x190;}_0x88ad96['status'](_0x2493de)['send'](_0x4e1684['query'][_0xf5ee('0x71')]?{'message':_0xf5ee('0x74'),'statusCode':_0x18c80f[_0xf5ee('0x75')]}:_0x18c80f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8be6a06..8f5d884 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 _0x9a72=['../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a72,0xb4));var _0x29a7=function(_0x561630,_0x56875e){_0x561630=_0x561630-0x0;var _0x4f3870=_0x9a72[_0x561630];return _0x4f3870;};'use strict';var _=require(_0x29a7('0x0'));var util=require(_0x29a7('0x1'));var logger=require(_0x29a7('0x2'))(_0x29a7('0x3'));var moment=require(_0x29a7('0x4'));var BPromise=require(_0x29a7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29a7('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x29a7('0x7'));module[_0x29a7('0x8')]=function(_0x24a80c,_0x3b48f3){return _0x24a80c[_0x29a7('0x9')]('VtigerAccount',attributes,{'tableName':_0x29a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38ec=['api','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x3b46d6,_0x1438c7){var _0x141de1=function(_0x57fdea){while(--_0x57fdea){_0x3b46d6['push'](_0x3b46d6['shift']());}};_0x141de1(++_0x1438c7);}(_0x38ec,0xa6));var _0xc38e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x38ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc38e('0x0'));var util=require(_0xc38e('0x1'));var logger=require(_0xc38e('0x2'))(_0xc38e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc38e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc38e('0x5'));var config=require(_0xc38e('0x6'));var attributes=require(_0xc38e('0x7'));var integrations=require(_0xc38e('0x8'));module[_0xc38e('0x9')]=function(_0x585eb3,_0x317ef6){return _0x585eb3[_0xc38e('0xa')](_0xc38e('0xb'),attributes,{'tableName':_0xc38e('0xc'),'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 a26c2f0..15deaea 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 _0x1775=['stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','where','attributes','limit','map','include','model','ShowVtigerAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5a2559,_0x1e087a){var _0x57cae1=function(_0x31e67c){while(--_0x31e67c){_0x5a2559['push'](_0x5a2559['shift']());}};_0x57cae1(++_0x1e087a);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['findAll']({'raw':_0x1b4102[_0x5177('0x1c')]?_0x1b4102['options'][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1e')]||null:null,'attributes':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'limit':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')][_0x5177('0x20')]||null:null,'include':_0x1b4102[_0x5177('0x1c')]?_0x1b4102[_0x5177('0x1c')]['include']?_[_0x5177('0x21')](_0x1b4102['options'][_0x5177('0x22')],function(_0x2c68d8){return{'model':db[_0x2c68d8[_0x5177('0x23')]],'as':_0x2c68d8['as'],'attributes':_0x2c68d8[_0x5177('0x1f')],'include':_0x2c68d8['include']?_[_0x5177('0x21')](_0x2c68d8['include'],function(_0x564139){return{'model':db[_0x564139[_0x5177('0x23')]],'as':_0x564139['as'],'attributes':_0x564139[_0x5177('0x1f')],'include':_0x564139['include']?_[_0x5177('0x21')](_0x564139['include'],function(_0x231d35){return{'model':db[_0x231d35[_0x5177('0x23')]],'as':_0x231d35['as'],'attributes':_0x231d35['attributes']};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x2554ec){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON['stringify'](_0x2554ec));_0x3e6944(_0x2554ec);})['catch'](function(_0x45cf20){logger[_0x5177('0x14')](_0x5177('0x1a'),_0x45cf20[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4[_0x5177('0x14')](0x1f4,_0x45cf20[_0x5177('0x17')]));});});};exports[_0x5177('0x24')]=function(_0x72dced){var _0x49f6f1=this;return new Promise(function(_0x42e1db,_0x2233a2){return db['VtigerAccount'][_0x5177('0x25')]({'raw':_0x72dced['options']?_0x72dced[_0x5177('0x1c')][_0x5177('0x1d')]===undefined?!![]:![]:!![],'where':_0x72dced[_0x5177('0x1c')]?_0x72dced['options']['where']||null:null,'attributes':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x1f')]||null:null,'include':_0x72dced[_0x5177('0x1c')]?_0x72dced[_0x5177('0x1c')][_0x5177('0x22')]?_[_0x5177('0x21')](_0x72dced[_0x5177('0x1c')]['include'],function(_0x459ac6){return{'model':db[_0x459ac6[_0x5177('0x23')]],'as':_0x459ac6['as'],'attributes':_0x459ac6['attributes'],'include':_0x459ac6[_0x5177('0x22')]?_[_0x5177('0x21')](_0x459ac6[_0x5177('0x22')],function(_0x8727c6){return{'model':db[_0x8727c6[_0x5177('0x23')]],'as':_0x8727c6['as'],'attributes':_0x8727c6[_0x5177('0x1f')],'include':_0x8727c6['include']?_[_0x5177('0x21')](_0x8727c6[_0x5177('0x22')],function(_0x28b1d5){return{'model':db[_0x28b1d5[_0x5177('0x23')]],'as':_0x28b1d5['as'],'attributes':_0x28b1d5[_0x5177('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5177('0xe')](function(_0x1bb1e3){logger['info'](_0x5177('0x24'),_0x72dced);logger[_0x5177('0x10')]('ShowVtigerAccount',_0x72dced,JSON['stringify'](_0x1bb1e3));_0x42e1db(_0x1bb1e3);})[_0x5177('0x19')](function(_0x188cec){logger[_0x5177('0x14')](_0x5177('0x24'),_0x188cec[_0x5177('0x17')],_0x72dced);_0x2233a2(_0x49f6f1[_0x5177('0x14')](0x1f4,_0x188cec[_0x5177('0x17')]));});});}; \ No newline at end of file +var _0xac4a=['info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','model','attributes','map','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x3146d5,_0x1cd2db){var _0x45cd2c=function(_0xffeb06){while(--_0xffeb06){_0x3146d5['push'](_0x3146d5['shift']());}};_0x45cd2c(++_0x1cd2db);}(_0xac4a,0x13f));var _0xaac4=function(_0x49f033,_0x2ce1ce){_0x49f033=_0x49f033-0x0;var _0xfef4d5=_0xac4a[_0x49f033];return _0xfef4d5;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')]({'raw':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x52085a['options']?_0x52085a[_0xaac4('0x18')]['attributes']||null:null,'limit':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1b')]||null:null,'include':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')]?_['map'](_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x174860){return{'model':db[_0x174860[_0xaac4('0x1d')]],'as':_0x174860['as'],'attributes':_0x174860[_0xaac4('0x1e')],'include':_0x174860[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x174860['include'],function(_0x24186b){return{'model':db[_0x24186b['model']],'as':_0x24186b['as'],'attributes':_0x24186b['attributes'],'include':_0x24186b['include']?_['map'](_0x24186b[_0xaac4('0x1c')],function(_0x17d25f){return{'model':db[_0x17d25f[_0xaac4('0x1d')]],'as':_0x17d25f['as'],'attributes':_0x17d25f[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0xa')](function(_0x249a5d){logger[_0xaac4('0xb')](_0xaac4('0x15'),_0x52085a);logger[_0xaac4('0xc')](_0xaac4('0x15'),_0x52085a,JSON['stringify'](_0x249a5d));_0x5b6fd6(_0x249a5d);})[_0xaac4('0x14')](function(_0x16b33c){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x16b33c[_0xaac4('0x12')],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x16b33c['message']));});});};exports[_0xaac4('0x20')]=function(_0x5d2c9a){var _0x2df7e3=this;return new Promise(function(_0xab5d04,_0x182343){return db[_0xaac4('0x16')]['find']({'raw':_0x5d2c9a['options']?_0x5d2c9a['options'][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1e')]||null:null,'include':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x3b93e5){return{'model':db[_0x3b93e5[_0xaac4('0x1d')]],'as':_0x3b93e5['as'],'attributes':_0x3b93e5['attributes'],'include':_0x3b93e5['include']?_[_0xaac4('0x1f')](_0x3b93e5[_0xaac4('0x1c')],function(_0xa07d0){return{'model':db[_0xa07d0['model']],'as':_0xa07d0['as'],'attributes':_0xa07d0[_0xaac4('0x1e')],'include':_0xa07d0[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0xa07d0[_0xaac4('0x1c')],function(_0x1ec59d){return{'model':db[_0x1ec59d[_0xaac4('0x1d')]],'as':_0x1ec59d['as'],'attributes':_0x1ec59d[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36591a){logger[_0xaac4('0xb')](_0xaac4('0x20'),_0x5d2c9a);logger['debug'](_0xaac4('0x20'),_0x5d2c9a,JSON['stringify'](_0x36591a));_0xab5d04(_0x36591a);})['catch'](function(_0x344d05){logger[_0xaac4('0x10')](_0xaac4('0x20'),_0x344d05['message'],_0x5d2c9a);_0x182343(_0x2df7e3['error'](0x1f4,_0x344d05[_0xaac4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e2fd6cd..b3b48bf 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 _0xa8cc=['fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x5814bc,_0x33431b){var _0x1a93f9=function(_0x31fb50){while(--_0x31fb50){_0x5814bc['push'](_0x5814bc['shift']());}};_0x1a93f9(++_0x33431b);}(_0xa8cc,0x1b5));var _0xca8c=function(_0x22f6a2,_0x213710){_0x22f6a2=_0x22f6a2-0x0;var _0x523b84=_0xa8cc[_0x22f6a2];return _0x523b84;};'use strict';var multer=require('multer');var util=require(_0xca8c('0x0'));var path=require(_0xca8c('0x1'));var timeout=require(_0xca8c('0x2'));var express=require('express');var router=express[_0xca8c('0x3')]();var fs_extra=require(_0xca8c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xca8c('0x5'));var controller=require(_0xca8c('0x6'));router[_0xca8c('0x7')]('/',auth[_0xca8c('0x8')](),controller[_0xca8c('0x9')]);router[_0xca8c('0x7')]('/:id',auth[_0xca8c('0x8')](),controller['show']);router['get'](_0xca8c('0xa'),auth[_0xca8c('0x8')](),controller[_0xca8c('0xb')]);router['get']('/:id/subjects',auth[_0xca8c('0x8')](),controller['getSubjects']);router[_0xca8c('0x7')](_0xca8c('0xc'),auth[_0xca8c('0x8')](),controller[_0xca8c('0xd')]);router[_0xca8c('0xe')]('/',auth[_0xca8c('0x8')](),controller['create']);router[_0xca8c('0xf')](_0xca8c('0x10'),auth[_0xca8c('0x8')](),controller[_0xca8c('0x11')]);router[_0xca8c('0x12')](_0xca8c('0x10'),auth[_0xca8c('0x8')](),controller[_0xca8c('0x13')]);module[_0xca8c('0x14')]=router; \ No newline at end of file +var _0x8577=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','destroy','multer','util','path'];(function(_0x18c4c8,_0xa10b92){var _0x115bc0=function(_0x50f7a8){while(--_0x50f7a8){_0x18c4c8['push'](_0x18c4c8['shift']());}};_0x115bc0(++_0xa10b92);}(_0x8577,0xa5));var _0x7857=function(_0x3e143a,_0x558381){_0x3e143a=_0x3e143a-0x0;var _0x1e0a0e=_0x8577[_0x3e143a];return _0x1e0a0e;};'use strict';var multer=require(_0x7857('0x0'));var util=require(_0x7857('0x1'));var path=require(_0x7857('0x2'));var timeout=require(_0x7857('0x3'));var express=require(_0x7857('0x4'));var router=express[_0x7857('0x5')]();var fs_extra=require(_0x7857('0x6'));var auth=require(_0x7857('0x7'));var interaction=require(_0x7857('0x8'));var config=require(_0x7857('0x9'));var controller=require(_0x7857('0xa'));router[_0x7857('0xb')]('/',auth[_0x7857('0xc')](),controller[_0x7857('0xd')]);router[_0x7857('0xb')](_0x7857('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7857('0xb')](_0x7857('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x7857('0xb')]('/:id/subjects',auth[_0x7857('0xc')](),controller[_0x7857('0x10')]);router['get'](_0x7857('0x11'),auth[_0x7857('0xc')](),controller[_0x7857('0x12')]);router['post']('/',auth[_0x7857('0xc')](),controller[_0x7857('0x13')]);router['put'](_0x7857('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7857('0xe'),auth[_0x7857('0xc')](),controller[_0x7857('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1604b0d..519d2cb 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 _0xedaa=['STRING','sequelize','exports'];(function(_0x5a183a,_0x97d123){var _0x500fbd=function(_0x5feb69){while(--_0x5feb69){_0x5a183a['push'](_0x5a183a['shift']());}};_0x500fbd(++_0x97d123);}(_0xedaa,0x160));var _0xaeda=function(_0x2a53d1,_0x49b9ce){_0x2a53d1=_0x2a53d1-0x0;var _0x869acb=_0xedaa[_0x2a53d1];return _0x869acb;};'use strict';var Sequelize=require(_0xaeda('0x0'));module[_0xaeda('0x1')]={'name':{'type':Sequelize[_0xaeda('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4fa=['STRING'];(function(_0x58afc2,_0xde2265){var _0x5555ab=function(_0x1a3528){while(--_0x1a3528){_0x58afc2['push'](_0x58afc2['shift']());}};_0x5555ab(++_0xde2265);}(_0xd4fa,0x107));var _0xad4f=function(_0x1a124d,_0x3e04b0){_0x1a124d=_0x1a124d-0x0;var _0x5f0830=_0xd4fa[_0x1a124d];return _0x5f0830;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xad4f('0x0')]},'description':{'type':Sequelize[_0xad4f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 9c34b3e..dd257b0 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 _0x794c=['rows','catch','params','rawAttributes','include','find','create','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','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','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','VtigerConfiguration','includeAll','findAll'];(function(_0xc39458,_0x411661){var _0x3ab0c0=function(_0x428d0c){while(--_0x428d0c){_0xc39458['push'](_0xc39458['shift']());}};_0x3ab0c0(++_0x411661);}(_0x794c,0x199));var _0xc794=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x794c[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc794('0x0'));var zipdir=require(_0xc794('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc794('0x2'));var moment=require(_0xc794('0x3'));var BPromise=require(_0xc794('0x4'));var Mustache=require('mustache');var util=require(_0xc794('0x5'));var path=require(_0xc794('0x6'));var sox=require('sox');var csv=require(_0xc794('0x7'));var ejs=require(_0xc794('0x8'));var fs=require('fs');var fs_extra=require(_0xc794('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc794('0xa'));var jsforce=require(_0xc794('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc794('0xc'));var Papa=require('papaparse');var Redis=require(_0xc794('0xd'));var authService=require(_0xc794('0xe'));var qs=require(_0xc794('0xf'));var as=require(_0xc794('0x10'));var hardwareService=require(_0xc794('0x11'));var logger=require(_0xc794('0x12'))(_0xc794('0x13'));var utils=require(_0xc794('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc794('0x15'));var db=require(_0xc794('0x16'))['db'];function respondWithStatusCode(_0x3f09d4,_0x140142){_0x140142=_0x140142||0xcc;return function(_0x1f3e0c){if(_0x1f3e0c){return _0x3f09d4[_0xc794('0x17')](_0x140142);}return _0x3f09d4['status'](_0x140142)['end']();};}function respondWithResult(_0xb5af4f,_0x376e28){_0x376e28=_0x376e28||0xc8;return function(_0x473c53){if(_0x473c53){return _0xb5af4f[_0xc794('0x18')](_0x376e28)[_0xc794('0x19')](_0x473c53);}};}function respondWithFilteredResult(_0x154f75,_0xa6434b){return function(_0x32290b){if(_0x32290b){var _0x350789=typeof _0xa6434b[_0xc794('0x1a')]===_0xc794('0x1b')&&typeof _0xa6434b['limit']===_0xc794('0x1b');var _0x1e7cce=_0x32290b[_0xc794('0x1c')];var _0x13614c=_0x350789?0x0:_0xa6434b['offset'];var _0x2e1838=_0x350789?_0x32290b['count']:_0xa6434b[_0xc794('0x1a')]+_0xa6434b[_0xc794('0x1d')];var _0x1fc6b3;if(_0x2e1838>=_0x1e7cce){_0x2e1838=_0x1e7cce;_0x1fc6b3=0xc8;}else{_0x1fc6b3=0xce;}_0x154f75[_0xc794('0x18')](_0x1fc6b3);return _0x154f75[_0xc794('0x1e')](_0xc794('0x1f'),_0x13614c+'-'+_0x2e1838+'/'+_0x1e7cce)[_0xc794('0x19')](_0x32290b);}return null;};}function patchUpdates(_0x3e6969){return function(_0x2ded97){try{jsonpatch[_0xc794('0x20')](_0x2ded97,_0x3e6969,!![]);}catch(_0x3f5bec){return BPromise['reject'](_0x3f5bec);}return _0x2ded97[_0xc794('0x21')]();};}function saveUpdates(_0x349911,_0x284337){return function(_0x271b7d){if(_0x271b7d){return _0x271b7d[_0xc794('0x22')](_0x349911)[_0xc794('0x23')](function(_0x29ddfc){return _0x29ddfc;});}return null;};}function removeEntity(_0x5dc4f3,_0x2669f6){return function(_0x1558cc){if(_0x1558cc){return _0x1558cc[_0xc794('0x24')]()[_0xc794('0x23')](function(){_0x5dc4f3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59075a,_0x25618f){return function(_0x1e63d9){if(!_0x1e63d9){_0x59075a[_0xc794('0x17')](0x194);}return _0x1e63d9;};}function handleError(_0x1c0e70,_0x296957){_0x296957=_0x296957||0x1f4;return function(_0x525b04){logger[_0xc794('0x25')](_0x525b04[_0xc794('0x26')]);if(_0x525b04['name']){delete _0x525b04[_0xc794('0x27')];}_0x1c0e70[_0xc794('0x18')](_0x296957)['send'](_0x525b04);};}exports[_0xc794('0x28')]=function(_0x4cb212,_0x117f16){var _0x38bdca={},_0x1f54b2={},_0x3ad3ca={'count':0x0,'rows':[]};var _0x1c1193=_[_0xc794('0x29')](db['VtigerConfiguration']['rawAttributes'],function(_0x13977a){return{'name':_0x13977a[_0xc794('0x2a')],'type':_0x13977a['type'][_0xc794('0x2b')]};});_0x1f54b2[_0xc794('0x2c')]=_[_0xc794('0x29')](_0x1c1193,'name');_0x1f54b2['query']=_[_0xc794('0x2d')](_0x4cb212[_0xc794('0x2e')]);_0x1f54b2[_0xc794('0x2f')]=_[_0xc794('0x30')](_0x1f54b2[_0xc794('0x2c')],_0x1f54b2[_0xc794('0x2e')]);_0x38bdca[_0xc794('0x31')]=_[_0xc794('0x30')](_0x1f54b2['model'],qs[_0xc794('0x32')](_0x4cb212[_0xc794('0x2e')][_0xc794('0x32')]));_0x38bdca[_0xc794('0x31')]=_0x38bdca[_0xc794('0x31')][_0xc794('0x33')]?_0x38bdca[_0xc794('0x31')]:_0x1f54b2['model'];if(!_0x4cb212[_0xc794('0x2e')][_0xc794('0x34')](_0xc794('0x35'))){_0x38bdca['limit']=qs['limit'](_0x4cb212[_0xc794('0x2e')][_0xc794('0x1d')]);_0x38bdca[_0xc794('0x1a')]=qs['offset'](_0x4cb212[_0xc794('0x2e')][_0xc794('0x1a')]);}_0x38bdca['order']=qs[_0xc794('0x36')](_0x4cb212[_0xc794('0x2e')][_0xc794('0x36')]);_0x38bdca[_0xc794('0x37')]=qs[_0xc794('0x2f')](_[_0xc794('0x38')](_0x4cb212['query'],_0x1f54b2[_0xc794('0x2f')]),_0x1c1193);if(_0x4cb212[_0xc794('0x2e')][_0xc794('0x39')]){_0x38bdca['where']=_[_0xc794('0x3a')](_0x38bdca[_0xc794('0x37')],{'$or':_[_0xc794('0x29')](_0x1c1193,function(_0x104576){if(_0x104576[_0xc794('0x3b')]!==_0xc794('0x3c')){var _0x987cdc={};_0x987cdc[_0x104576['name']]={'$like':'%'+_0x4cb212['query']['filter']+'%'};return _0x987cdc;}})});}_0x38bdca=_[_0xc794('0x3a')]({},_0x38bdca,_0x4cb212[_0xc794('0x3d')]);var _0x551f09={'where':_0x38bdca['where']};return db[_0xc794('0x3e')][_0xc794('0x1c')](_0x551f09)[_0xc794('0x23')](function(_0x244aed){_0x3ad3ca['count']=_0x244aed;if(_0x4cb212['query'][_0xc794('0x3f')]){_0x38bdca['include']=[{'all':!![]}];}return db[_0xc794('0x3e')][_0xc794('0x40')](_0x38bdca);})[_0xc794('0x23')](function(_0x66043a){_0x3ad3ca[_0xc794('0x41')]=_0x66043a;return _0x3ad3ca;})[_0xc794('0x23')](respondWithFilteredResult(_0x117f16,_0x38bdca))[_0xc794('0x42')](handleError(_0x117f16,null));};exports['show']=function(_0x1d1766,_0x2774f9){var _0x4e57ae={'raw':![],'where':{'id':_0x1d1766[_0xc794('0x43')]['id']}},_0x5e969b={};_0x5e969b[_0xc794('0x2c')]=_[_0xc794('0x2d')](db[_0xc794('0x3e')][_0xc794('0x44')]);_0x5e969b[_0xc794('0x2e')]=_[_0xc794('0x2d')](_0x1d1766[_0xc794('0x2e')]);_0x5e969b['filters']=_[_0xc794('0x30')](_0x5e969b['model'],_0x5e969b[_0xc794('0x2e')]);_0x4e57ae[_0xc794('0x31')]=_[_0xc794('0x30')](_0x5e969b[_0xc794('0x2c')],qs['fields'](_0x1d1766['query'][_0xc794('0x32')]));_0x4e57ae[_0xc794('0x31')]=_0x4e57ae[_0xc794('0x31')][_0xc794('0x33')]?_0x4e57ae['attributes']:_0x5e969b['model'];if(_0x1d1766['query'][_0xc794('0x3f')]){_0x4e57ae[_0xc794('0x45')]=[{'all':!![]}];}_0x4e57ae=_['merge']({},_0x4e57ae,_0x1d1766[_0xc794('0x3d')]);return db[_0xc794('0x3e')][_0xc794('0x46')](_0x4e57ae)[_0xc794('0x23')](handleEntityNotFound(_0x2774f9,null))['then'](respondWithResult(_0x2774f9,null))['catch'](handleError(_0x2774f9,null));};exports[_0xc794('0x47')]=function(_0xbc4a0e,_0x423628){return db[_0xc794('0x3e')][_0xc794('0x47')](_0xbc4a0e[_0xc794('0x48')],{})[_0xc794('0x23')](respondWithResult(_0x423628,0xc9))[_0xc794('0x42')](handleError(_0x423628,null));};exports['update']=function(_0x2e65ba,_0x2b243b){if(_0x2e65ba['body']['id']){delete _0x2e65ba['body']['id'];}return db[_0xc794('0x3e')][_0xc794('0x46')]({'where':{'id':_0x2e65ba[_0xc794('0x43')]['id']}})[_0xc794('0x23')](handleEntityNotFound(_0x2b243b,null))['then'](saveUpdates(_0x2e65ba[_0xc794('0x48')],null))[_0xc794('0x23')](respondWithResult(_0x2b243b,null))[_0xc794('0x42')](handleError(_0x2b243b,null));};exports[_0xc794('0x24')]=function(_0x2d4442,_0x2955af){return db['VtigerConfiguration']['find']({'where':{'id':_0x2d4442[_0xc794('0x43')]['id']}})['then'](handleEntityNotFound(_0x2955af,null))[_0xc794('0x23')](removeEntity(_0x2955af,null))[_0xc794('0x42')](handleError(_0x2955af,null));};exports[_0xc794('0x49')]=function(_0x1613ce,_0x573abf,_0x6689b8){var _0x738980={};var _0x1f1e00={};var _0xa8d0de;var _0x1e39c3;return db[_0xc794('0x3e')][_0xc794('0x4a')]({'where':{'id':_0x1613ce[_0xc794('0x43')]['id']}})['then'](handleEntityNotFound(_0x573abf,null))['then'](function(_0x930e86){if(_0x930e86){_0xa8d0de=_0x930e86;_0x1f1e00['model']=_[_0xc794('0x2d')](db[_0xc794('0x4b')]['rawAttributes']);_0x1f1e00[_0xc794('0x2e')]=_['keys'](_0x1613ce[_0xc794('0x2e')]);_0x1f1e00[_0xc794('0x2f')]=_[_0xc794('0x30')](_0x1f1e00['model'],_0x1f1e00[_0xc794('0x2e')]);_0x738980[_0xc794('0x31')]=_[_0xc794('0x30')](_0x1f1e00[_0xc794('0x2c')],qs[_0xc794('0x32')](_0x1613ce[_0xc794('0x2e')]['fields']));_0x738980['attributes']=_0x738980[_0xc794('0x31')][_0xc794('0x33')]?_0x738980[_0xc794('0x31')]:_0x1f1e00['model'];_0x738980[_0xc794('0x4c')]=qs[_0xc794('0x36')](_0x1613ce[_0xc794('0x2e')][_0xc794('0x36')]);_0x738980[_0xc794('0x37')]=qs[_0xc794('0x2f')](_[_0xc794('0x38')](_0x1613ce[_0xc794('0x2e')],_0x1f1e00[_0xc794('0x2f')]));if(_0x1613ce[_0xc794('0x2e')][_0xc794('0x39')]){_0x738980[_0xc794('0x37')]=_['merge'](_0x738980[_0xc794('0x37')],{'$or':_[_0xc794('0x29')](_0x738980['attributes'],function(_0x88809f){var _0x42c01c={};_0x42c01c[_0x88809f]={'$like':'%'+_0x1613ce['query'][_0xc794('0x39')]+'%'};return _0x42c01c;})});}_0x738980=_[_0xc794('0x3a')]({},_0x738980,_0x1613ce[_0xc794('0x3d')]);return _0xa8d0de['getFields'](_0x738980);}})['then'](function(_0x3873e2){if(_0x3873e2){_0x1e39c3=_0x3873e2[_0xc794('0x33')];if(!_0x1613ce[_0xc794('0x2e')][_0xc794('0x34')](_0xc794('0x35'))){_0x738980[_0xc794('0x1d')]=qs['limit'](_0x1613ce['query'][_0xc794('0x1d')]);_0x738980[_0xc794('0x1a')]=qs[_0xc794('0x1a')](_0x1613ce[_0xc794('0x2e')][_0xc794('0x1a')]);}return _0xa8d0de['getFields'](_0x738980);}})['then'](function(_0x1280f5){if(_0x1280f5){return _0x1280f5?{'count':_0x1e39c3,'rows':_0x1280f5}:null;}})[_0xc794('0x23')](respondWithResult(_0x573abf,null))[_0xc794('0x42')](handleError(_0x573abf,null));};exports[_0xc794('0x4d')]=function(_0x1947cd,_0x53c127,_0x3fab4a){var _0x421c6e={};var _0x445820={};var _0xc8cde3;var _0x4baa0d;return db[_0xc794('0x3e')][_0xc794('0x4a')]({'where':{'id':_0x1947cd[_0xc794('0x43')]['id']}})[_0xc794('0x23')](handleEntityNotFound(_0x53c127,null))['then'](function(_0x5562d8){if(_0x5562d8){_0xc8cde3=_0x5562d8;_0x445820[_0xc794('0x2c')]=_[_0xc794('0x2d')](db[_0xc794('0x4b')][_0xc794('0x44')]);_0x445820[_0xc794('0x2e')]=_['keys'](_0x1947cd[_0xc794('0x2e')]);_0x445820[_0xc794('0x2f')]=_[_0xc794('0x30')](_0x445820[_0xc794('0x2c')],_0x445820[_0xc794('0x2e')]);_0x421c6e[_0xc794('0x31')]=_[_0xc794('0x30')](_0x445820['model'],qs[_0xc794('0x32')](_0x1947cd[_0xc794('0x2e')][_0xc794('0x32')]));_0x421c6e['attributes']=_0x421c6e[_0xc794('0x31')][_0xc794('0x33')]?_0x421c6e[_0xc794('0x31')]:_0x445820[_0xc794('0x2c')];_0x421c6e[_0xc794('0x4c')]=qs['sort'](_0x1947cd['query'][_0xc794('0x36')]);_0x421c6e[_0xc794('0x37')]=qs['filters'](_[_0xc794('0x38')](_0x1947cd[_0xc794('0x2e')],_0x445820[_0xc794('0x2f')]));if(_0x1947cd[_0xc794('0x2e')][_0xc794('0x39')]){_0x421c6e[_0xc794('0x37')]=_[_0xc794('0x3a')](_0x421c6e[_0xc794('0x37')],{'$or':_[_0xc794('0x29')](_0x421c6e[_0xc794('0x31')],function(_0x57ce5b){var _0x18bfd9={};_0x18bfd9[_0x57ce5b]={'$like':'%'+_0x1947cd[_0xc794('0x2e')][_0xc794('0x39')]+'%'};return _0x18bfd9;})});}_0x421c6e=_[_0xc794('0x3a')]({},_0x421c6e,_0x1947cd[_0xc794('0x3d')]);return _0xc8cde3[_0xc794('0x4d')](_0x421c6e);}})['then'](function(_0x59c823){if(_0x59c823){_0x4baa0d=_0x59c823[_0xc794('0x33')];if(!_0x1947cd[_0xc794('0x2e')][_0xc794('0x34')]('nolimit')){_0x421c6e[_0xc794('0x1d')]=qs[_0xc794('0x1d')](_0x1947cd[_0xc794('0x2e')][_0xc794('0x1d')]);_0x421c6e[_0xc794('0x1a')]=qs[_0xc794('0x1a')](_0x1947cd[_0xc794('0x2e')][_0xc794('0x1a')]);}return _0xc8cde3[_0xc794('0x4d')](_0x421c6e);}})[_0xc794('0x23')](function(_0x1fcc59){if(_0x1fcc59){return _0x1fcc59?{'count':_0x4baa0d,'rows':_0x1fcc59}:null;}})[_0xc794('0x23')](respondWithResult(_0x53c127,null))[_0xc794('0x42')](handleError(_0x53c127,null));};exports[_0xc794('0x4e')]=function(_0x4a97b8,_0x3a26f8,_0x4924b4){var _0x8a57b5={};var _0x1b385d={};var _0x2901c4;var _0x1a9e89;return db[_0xc794('0x3e')]['findOne']({'where':{'id':_0x4a97b8[_0xc794('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a26f8,null))[_0xc794('0x23')](function(_0x4e29a){if(_0x4e29a){_0x2901c4=_0x4e29a;_0x1b385d['model']=_[_0xc794('0x2d')](db[_0xc794('0x4b')][_0xc794('0x44')]);_0x1b385d[_0xc794('0x2e')]=_[_0xc794('0x2d')](_0x4a97b8[_0xc794('0x2e')]);_0x1b385d[_0xc794('0x2f')]=_[_0xc794('0x30')](_0x1b385d['model'],_0x1b385d[_0xc794('0x2e')]);_0x8a57b5[_0xc794('0x31')]=_['intersection'](_0x1b385d[_0xc794('0x2c')],qs['fields'](_0x4a97b8[_0xc794('0x2e')][_0xc794('0x32')]));_0x8a57b5['attributes']=_0x8a57b5[_0xc794('0x31')]['length']?_0x8a57b5[_0xc794('0x31')]:_0x1b385d[_0xc794('0x2c')];_0x8a57b5[_0xc794('0x4c')]=qs[_0xc794('0x36')](_0x4a97b8['query'][_0xc794('0x36')]);_0x8a57b5['where']=qs[_0xc794('0x2f')](_['pick'](_0x4a97b8[_0xc794('0x2e')],_0x1b385d['filters']));if(_0x4a97b8[_0xc794('0x2e')][_0xc794('0x39')]){_0x8a57b5[_0xc794('0x37')]=_['merge'](_0x8a57b5['where'],{'$or':_[_0xc794('0x29')](_0x8a57b5['attributes'],function(_0x44368b){var _0x440447={};_0x440447[_0x44368b]={'$like':'%'+_0x4a97b8[_0xc794('0x2e')][_0xc794('0x39')]+'%'};return _0x440447;})});}_0x8a57b5=_[_0xc794('0x3a')]({},_0x8a57b5,_0x4a97b8[_0xc794('0x3d')]);return _0x2901c4[_0xc794('0x4e')](_0x8a57b5);}})[_0xc794('0x23')](function(_0xdbb947){if(_0xdbb947){_0x1a9e89=_0xdbb947[_0xc794('0x33')];if(!_0x4a97b8[_0xc794('0x2e')][_0xc794('0x34')](_0xc794('0x35'))){_0x8a57b5[_0xc794('0x1d')]=qs[_0xc794('0x1d')](_0x4a97b8[_0xc794('0x2e')][_0xc794('0x1d')]);_0x8a57b5[_0xc794('0x1a')]=qs[_0xc794('0x1a')](_0x4a97b8[_0xc794('0x2e')][_0xc794('0x1a')]);}return _0x2901c4[_0xc794('0x4e')](_0x8a57b5);}})[_0xc794('0x23')](function(_0x59e76d){if(_0x59e76d){return _0x59e76d?{'count':_0x1a9e89,'rows':_0x59e76d}:null;}})[_0xc794('0x23')](respondWithResult(_0x3a26f8,null))[_0xc794('0x42')](handleError(_0x3a26f8,null));}; \ No newline at end of file +var _0xf6ec=['fast-json-patch','moment','bluebird','mustache','util','path','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','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','keys','VtigerField','pick','getSubjects','getDescriptions','rimraf','zip-dir'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf6ec,0x198));var _0xcf6e=function(_0x92b320,_0x3e1dec){_0x92b320=_0x92b320-0x0;var _0x13e355=_0xf6ec[_0x92b320];return _0x13e355;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf6e('0x0'));var zipdir=require(_0xcf6e('0x1'));var jsonpatch=require(_0xcf6e('0x2'));var rp=require('request-promise');var moment=require(_0xcf6e('0x3'));var BPromise=require(_0xcf6e('0x4'));var Mustache=require(_0xcf6e('0x5'));var util=require(_0xcf6e('0x6'));var path=require(_0xcf6e('0x7'));var sox=require(_0xcf6e('0x8'));var csv=require(_0xcf6e('0x9'));var ejs=require(_0xcf6e('0xa'));var fs=require('fs');var fs_extra=require(_0xcf6e('0xb'));var _=require(_0xcf6e('0xc'));var squel=require('squel');var crypto=require(_0xcf6e('0xd'));var jsforce=require(_0xcf6e('0xe'));var deskjs=require(_0xcf6e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf6e('0x10'));var Papa=require(_0xcf6e('0x11'));var Redis=require('ioredis');var authService=require(_0xcf6e('0x12'));var qs=require(_0xcf6e('0x13'));var as=require(_0xcf6e('0x14'));var hardwareService=require(_0xcf6e('0x15'));var logger=require('../../config/logger')(_0xcf6e('0x16'));var utils=require(_0xcf6e('0x17'));var config=require(_0xcf6e('0x18'));var licenseUtil=require(_0xcf6e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x323318,_0x3b2731){_0x3b2731=_0x3b2731||0xcc;return function(_0x4230d8){if(_0x4230d8){return _0x323318[_0xcf6e('0x1a')](_0x3b2731);}return _0x323318['status'](_0x3b2731)[_0xcf6e('0x1b')]();};}function respondWithResult(_0x1ef256,_0x25ef83){_0x25ef83=_0x25ef83||0xc8;return function(_0x9fa48a){if(_0x9fa48a){return _0x1ef256['status'](_0x25ef83)[_0xcf6e('0x1c')](_0x9fa48a);}};}function respondWithFilteredResult(_0x233a7f,_0x241aa9){return function(_0x265ee1){if(_0x265ee1){var _0x429ee3=typeof _0x241aa9['offset']===_0xcf6e('0x1d')&&typeof _0x241aa9[_0xcf6e('0x1e')]===_0xcf6e('0x1d');var _0x33f0ad=_0x265ee1[_0xcf6e('0x1f')];var _0x3e5a63=_0x429ee3?0x0:_0x241aa9[_0xcf6e('0x20')];var _0x207a9f=_0x429ee3?_0x265ee1[_0xcf6e('0x1f')]:_0x241aa9[_0xcf6e('0x20')]+_0x241aa9[_0xcf6e('0x1e')];var _0x1c02b6;if(_0x207a9f>=_0x33f0ad){_0x207a9f=_0x33f0ad;_0x1c02b6=0xc8;}else{_0x1c02b6=0xce;}_0x233a7f[_0xcf6e('0x21')](_0x1c02b6);return _0x233a7f[_0xcf6e('0x22')](_0xcf6e('0x23'),_0x3e5a63+'-'+_0x207a9f+'/'+_0x33f0ad)[_0xcf6e('0x1c')](_0x265ee1);}return null;};}function patchUpdates(_0x23e66a){return function(_0x34262c){try{jsonpatch['apply'](_0x34262c,_0x23e66a,!![]);}catch(_0xe85766){return BPromise[_0xcf6e('0x24')](_0xe85766);}return _0x34262c[_0xcf6e('0x25')]();};}function saveUpdates(_0x143c6a,_0x4c54b2){return function(_0x140218){if(_0x140218){return _0x140218[_0xcf6e('0x26')](_0x143c6a)[_0xcf6e('0x27')](function(_0x2c0b66){return _0x2c0b66;});}return null;};}function removeEntity(_0x4f8817,_0x4ef26d){return function(_0x220e61){if(_0x220e61){return _0x220e61[_0xcf6e('0x28')]()[_0xcf6e('0x27')](function(){_0x4f8817[_0xcf6e('0x21')](0xcc)[_0xcf6e('0x1b')]();});}};}function handleEntityNotFound(_0x41c92b,_0x24baa5){return function(_0x1cf5a8){if(!_0x1cf5a8){_0x41c92b[_0xcf6e('0x1a')](0x194);}return _0x1cf5a8;};}function handleError(_0xbc6dd,_0x244b97){_0x244b97=_0x244b97||0x1f4;return function(_0x34a500){logger[_0xcf6e('0x29')](_0x34a500[_0xcf6e('0x2a')]);if(_0x34a500[_0xcf6e('0x2b')]){delete _0x34a500[_0xcf6e('0x2b')];}_0xbc6dd[_0xcf6e('0x21')](_0x244b97)['send'](_0x34a500);};}exports['index']=function(_0x22a597,_0x3a9d8d){var _0x33768c={},_0x30f46a={},_0x3a79f6={'count':0x0,'rows':[]};var _0x14438f=_[_0xcf6e('0x2c')](db[_0xcf6e('0x2d')][_0xcf6e('0x2e')],function(_0x4f20c5){return{'name':_0x4f20c5[_0xcf6e('0x2f')],'type':_0x4f20c5[_0xcf6e('0x30')][_0xcf6e('0x31')]};});_0x30f46a[_0xcf6e('0x32')]=_[_0xcf6e('0x2c')](_0x14438f,_0xcf6e('0x2b'));_0x30f46a[_0xcf6e('0x33')]=_['keys'](_0x22a597[_0xcf6e('0x33')]);_0x30f46a[_0xcf6e('0x34')]=_[_0xcf6e('0x35')](_0x30f46a[_0xcf6e('0x32')],_0x30f46a[_0xcf6e('0x33')]);_0x33768c[_0xcf6e('0x36')]=_[_0xcf6e('0x35')](_0x30f46a['model'],qs[_0xcf6e('0x37')](_0x22a597[_0xcf6e('0x33')][_0xcf6e('0x37')]));_0x33768c[_0xcf6e('0x36')]=_0x33768c[_0xcf6e('0x36')][_0xcf6e('0x38')]?_0x33768c[_0xcf6e('0x36')]:_0x30f46a[_0xcf6e('0x32')];if(!_0x22a597[_0xcf6e('0x33')][_0xcf6e('0x39')](_0xcf6e('0x3a'))){_0x33768c[_0xcf6e('0x1e')]=qs[_0xcf6e('0x1e')](_0x22a597['query'][_0xcf6e('0x1e')]);_0x33768c['offset']=qs[_0xcf6e('0x20')](_0x22a597['query'][_0xcf6e('0x20')]);}_0x33768c[_0xcf6e('0x3b')]=qs[_0xcf6e('0x3c')](_0x22a597[_0xcf6e('0x33')][_0xcf6e('0x3c')]);_0x33768c['where']=qs[_0xcf6e('0x34')](_['pick'](_0x22a597[_0xcf6e('0x33')],_0x30f46a['filters']),_0x14438f);if(_0x22a597['query']['filter']){_0x33768c[_0xcf6e('0x3d')]=_[_0xcf6e('0x3e')](_0x33768c[_0xcf6e('0x3d')],{'$or':_[_0xcf6e('0x2c')](_0x14438f,function(_0x1a5b81){if(_0x1a5b81[_0xcf6e('0x30')]!=='VIRTUAL'){var _0x374135={};_0x374135[_0x1a5b81[_0xcf6e('0x2b')]]={'$like':'%'+_0x22a597[_0xcf6e('0x33')][_0xcf6e('0x3f')]+'%'};return _0x374135;}})});}_0x33768c=_[_0xcf6e('0x3e')]({},_0x33768c,_0x22a597[_0xcf6e('0x40')]);var _0xcf566d={'where':_0x33768c[_0xcf6e('0x3d')]};return db[_0xcf6e('0x2d')]['count'](_0xcf566d)[_0xcf6e('0x27')](function(_0x212f6d){_0x3a79f6['count']=_0x212f6d;if(_0x22a597['query'][_0xcf6e('0x41')]){_0x33768c[_0xcf6e('0x42')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xcf6e('0x43')](_0x33768c);})[_0xcf6e('0x27')](function(_0x1c87a9){_0x3a79f6[_0xcf6e('0x44')]=_0x1c87a9;return _0x3a79f6;})[_0xcf6e('0x27')](respondWithFilteredResult(_0x3a9d8d,_0x33768c))[_0xcf6e('0x45')](handleError(_0x3a9d8d,null));};exports[_0xcf6e('0x46')]=function(_0x419b73,_0x5b6d40){var _0x2310bc={'raw':![],'where':{'id':_0x419b73[_0xcf6e('0x47')]['id']}},_0x39dcfe={};_0x39dcfe['model']=_['keys'](db[_0xcf6e('0x2d')]['rawAttributes']);_0x39dcfe[_0xcf6e('0x33')]=_['keys'](_0x419b73[_0xcf6e('0x33')]);_0x39dcfe['filters']=_[_0xcf6e('0x35')](_0x39dcfe[_0xcf6e('0x32')],_0x39dcfe[_0xcf6e('0x33')]);_0x2310bc[_0xcf6e('0x36')]=_[_0xcf6e('0x35')](_0x39dcfe[_0xcf6e('0x32')],qs[_0xcf6e('0x37')](_0x419b73[_0xcf6e('0x33')]['fields']));_0x2310bc[_0xcf6e('0x36')]=_0x2310bc[_0xcf6e('0x36')][_0xcf6e('0x38')]?_0x2310bc[_0xcf6e('0x36')]:_0x39dcfe[_0xcf6e('0x32')];if(_0x419b73[_0xcf6e('0x33')][_0xcf6e('0x41')]){_0x2310bc[_0xcf6e('0x42')]=[{'all':!![]}];}_0x2310bc=_[_0xcf6e('0x3e')]({},_0x2310bc,_0x419b73[_0xcf6e('0x40')]);return db[_0xcf6e('0x2d')][_0xcf6e('0x48')](_0x2310bc)[_0xcf6e('0x27')](handleEntityNotFound(_0x5b6d40,null))[_0xcf6e('0x27')](respondWithResult(_0x5b6d40,null))[_0xcf6e('0x45')](handleError(_0x5b6d40,null));};exports[_0xcf6e('0x49')]=function(_0xbd78e,_0x55e608){return db[_0xcf6e('0x2d')]['create'](_0xbd78e[_0xcf6e('0x4a')],{})[_0xcf6e('0x27')](respondWithResult(_0x55e608,0xc9))[_0xcf6e('0x45')](handleError(_0x55e608,null));};exports['update']=function(_0x2d5225,_0x219969){if(_0x2d5225[_0xcf6e('0x4a')]['id']){delete _0x2d5225[_0xcf6e('0x4a')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x2d5225[_0xcf6e('0x47')]['id']}})[_0xcf6e('0x27')](handleEntityNotFound(_0x219969,null))[_0xcf6e('0x27')](saveUpdates(_0x2d5225[_0xcf6e('0x4a')],null))[_0xcf6e('0x27')](respondWithResult(_0x219969,null))[_0xcf6e('0x45')](handleError(_0x219969,null));};exports['destroy']=function(_0x1f4611,_0x504b83){return db[_0xcf6e('0x2d')]['find']({'where':{'id':_0x1f4611[_0xcf6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x504b83,null))[_0xcf6e('0x27')](removeEntity(_0x504b83,null))[_0xcf6e('0x45')](handleError(_0x504b83,null));};exports[_0xcf6e('0x4b')]=function(_0x20244c,_0x597fc4,_0x2075d7){var _0x4c8668={};var _0x391b7d={};var _0x3d1dd7;var _0x1a7f08;return db['VtigerConfiguration'][_0xcf6e('0x4c')]({'where':{'id':_0x20244c['params']['id']}})['then'](handleEntityNotFound(_0x597fc4,null))[_0xcf6e('0x27')](function(_0x1f2ecd){if(_0x1f2ecd){_0x3d1dd7=_0x1f2ecd;_0x391b7d[_0xcf6e('0x32')]=_[_0xcf6e('0x4d')](db[_0xcf6e('0x4e')][_0xcf6e('0x2e')]);_0x391b7d['query']=_[_0xcf6e('0x4d')](_0x20244c[_0xcf6e('0x33')]);_0x391b7d[_0xcf6e('0x34')]=_[_0xcf6e('0x35')](_0x391b7d[_0xcf6e('0x32')],_0x391b7d[_0xcf6e('0x33')]);_0x4c8668['attributes']=_[_0xcf6e('0x35')](_0x391b7d[_0xcf6e('0x32')],qs[_0xcf6e('0x37')](_0x20244c[_0xcf6e('0x33')]['fields']));_0x4c8668['attributes']=_0x4c8668[_0xcf6e('0x36')]['length']?_0x4c8668['attributes']:_0x391b7d[_0xcf6e('0x32')];_0x4c8668[_0xcf6e('0x3b')]=qs['sort'](_0x20244c[_0xcf6e('0x33')][_0xcf6e('0x3c')]);_0x4c8668[_0xcf6e('0x3d')]=qs[_0xcf6e('0x34')](_[_0xcf6e('0x4f')](_0x20244c[_0xcf6e('0x33')],_0x391b7d[_0xcf6e('0x34')]));if(_0x20244c[_0xcf6e('0x33')][_0xcf6e('0x3f')]){_0x4c8668[_0xcf6e('0x3d')]=_[_0xcf6e('0x3e')](_0x4c8668[_0xcf6e('0x3d')],{'$or':_[_0xcf6e('0x2c')](_0x4c8668[_0xcf6e('0x36')],function(_0x1d465f){var _0x576552={};_0x576552[_0x1d465f]={'$like':'%'+_0x20244c['query'][_0xcf6e('0x3f')]+'%'};return _0x576552;})});}_0x4c8668=_['merge']({},_0x4c8668,_0x20244c[_0xcf6e('0x40')]);return _0x3d1dd7[_0xcf6e('0x4b')](_0x4c8668);}})[_0xcf6e('0x27')](function(_0x2f9292){if(_0x2f9292){_0x1a7f08=_0x2f9292[_0xcf6e('0x38')];if(!_0x20244c[_0xcf6e('0x33')][_0xcf6e('0x39')](_0xcf6e('0x3a'))){_0x4c8668[_0xcf6e('0x1e')]=qs[_0xcf6e('0x1e')](_0x20244c[_0xcf6e('0x33')][_0xcf6e('0x1e')]);_0x4c8668[_0xcf6e('0x20')]=qs[_0xcf6e('0x20')](_0x20244c['query'][_0xcf6e('0x20')]);}return _0x3d1dd7[_0xcf6e('0x4b')](_0x4c8668);}})[_0xcf6e('0x27')](function(_0x1902ba){if(_0x1902ba){return _0x1902ba?{'count':_0x1a7f08,'rows':_0x1902ba}:null;}})['then'](respondWithResult(_0x597fc4,null))[_0xcf6e('0x45')](handleError(_0x597fc4,null));};exports['getSubjects']=function(_0x2dc812,_0x58c3be,_0xbb3a58){var _0x30a60f={};var _0x1a5277={};var _0x1b020d;var _0x23bc3c;return db['VtigerConfiguration'][_0xcf6e('0x4c')]({'where':{'id':_0x2dc812[_0xcf6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x58c3be,null))[_0xcf6e('0x27')](function(_0x189d6d){if(_0x189d6d){_0x1b020d=_0x189d6d;_0x1a5277['model']=_[_0xcf6e('0x4d')](db[_0xcf6e('0x4e')][_0xcf6e('0x2e')]);_0x1a5277['query']=_[_0xcf6e('0x4d')](_0x2dc812['query']);_0x1a5277['filters']=_[_0xcf6e('0x35')](_0x1a5277[_0xcf6e('0x32')],_0x1a5277['query']);_0x30a60f['attributes']=_[_0xcf6e('0x35')](_0x1a5277[_0xcf6e('0x32')],qs[_0xcf6e('0x37')](_0x2dc812['query'][_0xcf6e('0x37')]));_0x30a60f[_0xcf6e('0x36')]=_0x30a60f[_0xcf6e('0x36')][_0xcf6e('0x38')]?_0x30a60f[_0xcf6e('0x36')]:_0x1a5277[_0xcf6e('0x32')];_0x30a60f[_0xcf6e('0x3b')]=qs['sort'](_0x2dc812[_0xcf6e('0x33')][_0xcf6e('0x3c')]);_0x30a60f[_0xcf6e('0x3d')]=qs[_0xcf6e('0x34')](_[_0xcf6e('0x4f')](_0x2dc812['query'],_0x1a5277[_0xcf6e('0x34')]));if(_0x2dc812['query'][_0xcf6e('0x3f')]){_0x30a60f[_0xcf6e('0x3d')]=_[_0xcf6e('0x3e')](_0x30a60f[_0xcf6e('0x3d')],{'$or':_['map'](_0x30a60f['attributes'],function(_0x43e32c){var _0x33878f={};_0x33878f[_0x43e32c]={'$like':'%'+_0x2dc812['query'][_0xcf6e('0x3f')]+'%'};return _0x33878f;})});}_0x30a60f=_['merge']({},_0x30a60f,_0x2dc812[_0xcf6e('0x40')]);return _0x1b020d[_0xcf6e('0x50')](_0x30a60f);}})[_0xcf6e('0x27')](function(_0x20959a){if(_0x20959a){_0x23bc3c=_0x20959a[_0xcf6e('0x38')];if(!_0x2dc812['query'][_0xcf6e('0x39')](_0xcf6e('0x3a'))){_0x30a60f['limit']=qs[_0xcf6e('0x1e')](_0x2dc812['query'][_0xcf6e('0x1e')]);_0x30a60f['offset']=qs[_0xcf6e('0x20')](_0x2dc812['query'][_0xcf6e('0x20')]);}return _0x1b020d[_0xcf6e('0x50')](_0x30a60f);}})[_0xcf6e('0x27')](function(_0x547606){if(_0x547606){return _0x547606?{'count':_0x23bc3c,'rows':_0x547606}:null;}})['then'](respondWithResult(_0x58c3be,null))[_0xcf6e('0x45')](handleError(_0x58c3be,null));};exports[_0xcf6e('0x51')]=function(_0x1f641c,_0x301f06,_0x4c118e){var _0x7e6b4a={};var _0x112194={};var _0x22c2b7;var _0x59b75c;return db['VtigerConfiguration'][_0xcf6e('0x4c')]({'where':{'id':_0x1f641c[_0xcf6e('0x47')]['id']}})['then'](handleEntityNotFound(_0x301f06,null))['then'](function(_0x1139e7){if(_0x1139e7){_0x22c2b7=_0x1139e7;_0x112194[_0xcf6e('0x32')]=_[_0xcf6e('0x4d')](db['VtigerField'][_0xcf6e('0x2e')]);_0x112194[_0xcf6e('0x33')]=_['keys'](_0x1f641c[_0xcf6e('0x33')]);_0x112194[_0xcf6e('0x34')]=_[_0xcf6e('0x35')](_0x112194[_0xcf6e('0x32')],_0x112194[_0xcf6e('0x33')]);_0x7e6b4a[_0xcf6e('0x36')]=_[_0xcf6e('0x35')](_0x112194[_0xcf6e('0x32')],qs[_0xcf6e('0x37')](_0x1f641c[_0xcf6e('0x33')][_0xcf6e('0x37')]));_0x7e6b4a[_0xcf6e('0x36')]=_0x7e6b4a[_0xcf6e('0x36')][_0xcf6e('0x38')]?_0x7e6b4a[_0xcf6e('0x36')]:_0x112194['model'];_0x7e6b4a[_0xcf6e('0x3b')]=qs['sort'](_0x1f641c[_0xcf6e('0x33')][_0xcf6e('0x3c')]);_0x7e6b4a[_0xcf6e('0x3d')]=qs[_0xcf6e('0x34')](_[_0xcf6e('0x4f')](_0x1f641c[_0xcf6e('0x33')],_0x112194[_0xcf6e('0x34')]));if(_0x1f641c[_0xcf6e('0x33')][_0xcf6e('0x3f')]){_0x7e6b4a[_0xcf6e('0x3d')]=_[_0xcf6e('0x3e')](_0x7e6b4a[_0xcf6e('0x3d')],{'$or':_[_0xcf6e('0x2c')](_0x7e6b4a['attributes'],function(_0x40bb75){var _0x2be528={};_0x2be528[_0x40bb75]={'$like':'%'+_0x1f641c[_0xcf6e('0x33')][_0xcf6e('0x3f')]+'%'};return _0x2be528;})});}_0x7e6b4a=_[_0xcf6e('0x3e')]({},_0x7e6b4a,_0x1f641c['options']);return _0x22c2b7[_0xcf6e('0x51')](_0x7e6b4a);}})[_0xcf6e('0x27')](function(_0x346001){if(_0x346001){_0x59b75c=_0x346001[_0xcf6e('0x38')];if(!_0x1f641c[_0xcf6e('0x33')][_0xcf6e('0x39')](_0xcf6e('0x3a'))){_0x7e6b4a[_0xcf6e('0x1e')]=qs['limit'](_0x1f641c[_0xcf6e('0x33')]['limit']);_0x7e6b4a[_0xcf6e('0x20')]=qs[_0xcf6e('0x20')](_0x1f641c[_0xcf6e('0x33')]['offset']);}return _0x22c2b7['getDescriptions'](_0x7e6b4a);}})[_0xcf6e('0x27')](function(_0x7667ff){if(_0x7667ff){return _0x7667ff?{'count':_0x59b75c,'rows':_0x7667ff}:null;}})['then'](respondWithResult(_0x301f06,null))[_0xcf6e('0x45')](handleError(_0x301f06,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index aecdca8..e7edc94 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 _0x4a8c=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x542bf0,_0xf6efa6){var _0x3906cb=function(_0x41151f){while(--_0x41151f){_0x542bf0['push'](_0x542bf0['shift']());}};_0x3906cb(++_0xf6efa6);}(_0x4a8c,0x1e0));var _0xc4a8=function(_0x1daed1,_0x340956){_0x1daed1=_0x1daed1-0x0;var _0x2541a8=_0x4a8c[_0x1daed1];return _0x2541a8;};'use strict';var _=require(_0xc4a8('0x0'));var util=require(_0xc4a8('0x1'));var logger=require(_0xc4a8('0x2'))(_0xc4a8('0x3'));var moment=require(_0xc4a8('0x4'));var BPromise=require(_0xc4a8('0x5'));var rp=require(_0xc4a8('0x6'));var fs=require('fs');var path=require(_0xc4a8('0x7'));var rimraf=require(_0xc4a8('0x8'));var config=require(_0xc4a8('0x9'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xc4a8('0xa')]=function(_0x4028b8,_0x302e4e){return _0x4028b8[_0xc4a8('0xb')](_0xc4a8('0xc'),attributes,{'tableName':_0xc4a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc1=['api','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x97c9f8,_0x22e005){var _0x1df252=function(_0x529af9){while(--_0x529af9){_0x97c9f8['push'](_0x97c9f8['shift']());}};_0x1df252(++_0x22e005);}(_0x9bc1,0x1b6));var _0x19bc=function(_0x228acb,_0x3d4196){_0x228acb=_0x228acb-0x0;var _0x294939=_0x9bc1[_0x228acb];return _0x294939;};'use strict';var _=require(_0x19bc('0x0'));var util=require(_0x19bc('0x1'));var logger=require('../../config/logger')(_0x19bc('0x2'));var moment=require('moment');var BPromise=require(_0x19bc('0x3'));var rp=require(_0x19bc('0x4'));var fs=require('fs');var path=require(_0x19bc('0x5'));var rimraf=require('rimraf');var config=require(_0x19bc('0x6'));var attributes=require(_0x19bc('0x7'));module[_0x19bc('0x8')]=function(_0x26b571,_0x2f6144){return _0x26b571['define'](_0x19bc('0x9'),attributes,{'tableName':_0x19bc('0xa'),'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 415c642..9849982 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 _0xee6c=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x56d26a,_0x49c226){var _0x161abc=function(_0x351ba5){while(--_0x351ba5){_0x56d26a['push'](_0x56d26a['shift']());}};_0x161abc(++_0x49c226);}(_0xee6c,0xad));var _0xcee6=function(_0x597acc,_0x2515d2){_0x597acc=_0x597acc-0x0;var _0x7d6000=_0xee6c[_0x597acc];return _0x7d6000;};'use strict';var _=require('lodash');var util=require(_0xcee6('0x0'));var moment=require(_0xcee6('0x1'));var BPromise=require(_0xcee6('0x2'));var rs=require(_0xcee6('0x3'));var fs=require('fs');var Redis=require(_0xcee6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcee6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xcee6('0x6'));var jayson=require(_0xcee6('0x7'));var client=jayson[_0xcee6('0x8')][_0xcee6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57b4d2,_0x21b662,_0x5e29f5){return new BPromise(function(_0x5d28ee,_0x383c0d){return client[_0xcee6('0xa')](_0x57b4d2,_0x5e29f5)[_0xcee6('0xb')](function(_0x3f06c7){logger[_0xcee6('0xc')](_0xcee6('0xd'),_0x21b662,_0xcee6('0xe'));logger[_0xcee6('0xf')](_0xcee6('0x10'),_0x21b662,_0xcee6('0xe'),JSON[_0xcee6('0x11')](_0x3f06c7));if(_0x3f06c7['error']){if(_0x3f06c7['error'][_0xcee6('0x12')]===0x1f4){logger['error'](_0xcee6('0xd'),_0x21b662,_0x3f06c7[_0xcee6('0x13')]['message']);return _0x383c0d(_0x3f06c7['error'][_0xcee6('0x14')]);}logger[_0xcee6('0x13')](_0xcee6('0xd'),_0x21b662,_0x3f06c7['error']['message']);return _0x5d28ee(_0x3f06c7[_0xcee6('0x13')][_0xcee6('0x14')]);}else{logger[_0xcee6('0xc')](_0xcee6('0xd'),_0x21b662,'request\x20sent');_0x5d28ee(_0x3f06c7[_0xcee6('0x15')][_0xcee6('0x14')]);}})[_0xcee6('0x16')](function(_0x4c8595){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x21b662,_0x4c8595);_0x383c0d(_0x4c8595);});});} \ No newline at end of file +var _0x4e74=['../../config/logger','rpc','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4179ff,_0x47ad33){var _0x3dc378=function(_0x5774a6){while(--_0x5774a6){_0x4179ff['push'](_0x4179ff['shift']());}};_0x3dc378(++_0x47ad33);}(_0x4e74,0x12a));var _0x44e7=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x4e74[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x44e7('0x0'));var util=require('util');var moment=require(_0x44e7('0x1'));var BPromise=require(_0x44e7('0x2'));var rs=require(_0x44e7('0x3'));var fs=require('fs');var Redis=require(_0x44e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44e7('0x5'));var logger=require(_0x44e7('0x6'))(_0x44e7('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f3c92,_0x1121d5,_0x49801b){return new BPromise(function(_0x1ab4ac,_0x5f4312){return client['request'](_0x1f3c92,_0x49801b)[_0x44e7('0x9')](function(_0x17c262){logger[_0x44e7('0xa')](_0x44e7('0xb'),_0x1121d5,_0x44e7('0xc'));logger[_0x44e7('0xd')](_0x44e7('0xe'),_0x1121d5,_0x44e7('0xc'),JSON['stringify'](_0x17c262));if(_0x17c262['error']){if(_0x17c262[_0x44e7('0xf')][_0x44e7('0x10')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1121d5,_0x17c262['error'][_0x44e7('0x11')]);return _0x5f4312(_0x17c262['error']['message']);}logger[_0x44e7('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x1121d5,_0x17c262[_0x44e7('0xf')][_0x44e7('0x11')]);return _0x1ab4ac(_0x17c262[_0x44e7('0xf')]['message']);}else{logger[_0x44e7('0xa')](_0x44e7('0xb'),_0x1121d5,_0x44e7('0xc'));_0x1ab4ac(_0x17c262['result']['message']);}})[_0x44e7('0x12')](function(_0x4cfa8c){logger[_0x44e7('0xf')](_0x44e7('0xb'),_0x1121d5,_0x4cfa8c);_0x5f4312(_0x4cfa8c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d1af822..7275af4 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 _0x2a44=['update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','isAuthenticated','show','create','/:id'];(function(_0x3996e2,_0x5a4ed5){var _0x586f0c=function(_0x45a867){while(--_0x45a867){_0x3996e2['push'](_0x3996e2['shift']());}};_0x586f0c(++_0x5a4ed5);}(_0x2a44,0x17e));var _0x42a4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a44[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42a4('0x0'));var timeout=require(_0x42a4('0x1'));var express=require(_0x42a4('0x2'));var router=express[_0x42a4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x42a4('0x4'));var interaction=require(_0x42a4('0x5'));var config=require(_0x42a4('0x6'));var controller=require(_0x42a4('0x7'));router[_0x42a4('0x8')]('/',auth['isAuthenticated'](),controller[_0x42a4('0x9')]);router[_0x42a4('0x8')]('/:id',auth[_0x42a4('0xa')](),controller[_0x42a4('0xb')]);router['post']('/',auth[_0x42a4('0xa')](),controller[_0x42a4('0xc')]);router['put'](_0x42a4('0xd'),auth[_0x42a4('0xa')](),controller[_0x42a4('0xe')]);router[_0x42a4('0xf')](_0x42a4('0xd'),auth['isAuthenticated'](),controller[_0x42a4('0x10')]);module[_0x42a4('0x11')]=router; \ No newline at end of file +var _0x8a28=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','path'];(function(_0x34247a,_0xb9fc7){var _0x53aa73=function(_0x4d0ea8){while(--_0x4d0ea8){_0x34247a['push'](_0x34247a['shift']());}};_0x53aa73(++_0xb9fc7);}(_0x8a28,0x1c1));var _0x88a2=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x8a28[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x88a2('0x0'));var timeout=require(_0x88a2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x88a2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x88a2('0x3'));var config=require(_0x88a2('0x4'));var controller=require(_0x88a2('0x5'));router[_0x88a2('0x6')]('/',auth[_0x88a2('0x7')](),controller[_0x88a2('0x8')]);router[_0x88a2('0x6')](_0x88a2('0x9'),auth[_0x88a2('0x7')](),controller[_0x88a2('0xa')]);router[_0x88a2('0xb')]('/',auth[_0x88a2('0x7')](),controller[_0x88a2('0xc')]);router[_0x88a2('0xd')]('/:id',auth[_0x88a2('0x7')](),controller[_0x88a2('0xe')]);router[_0x88a2('0xf')](_0x88a2('0x9'),auth[_0x88a2('0x7')](),controller[_0x88a2('0x10')]);module[_0x88a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9a49bee..ccf78e4 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 _0x5425=['variable','customVariable','STRING','ENUM','sequelize','exports','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5425,0x1d2));var _0x5542=function(_0x3f678a,_0xd9c863){_0x3f678a=_0x3f678a-0x0;var _0xdb1195=_0x5425[_0x3f678a];return _0xdb1195;};'use strict';var Sequelize=require(_0x5542('0x0'));module[_0x5542('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5542('0x2'),_0x5542('0x3'),_0x5542('0x4'),'keyValue','picklist'),'defaultValue':_0x5542('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5542('0x5')]},'keyType':{'type':Sequelize[_0x5542('0x6')](_0x5542('0x2'),_0x5542('0x3'),_0x5542('0x4'))},'keyContent':{'type':Sequelize[_0x5542('0x5')]},'idField':{'type':Sequelize[_0x5542('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5542('0x5')]}}; \ No newline at end of file +var _0x0997=['variable','customVariable','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x3ea29e,_0x82b54b){var _0xafdea8=function(_0x5752b7){while(--_0x5752b7){_0x3ea29e['push'](_0x3ea29e['shift']());}};_0xafdea8(++_0x82b54b);}(_0x0997,0x9d));var _0x7099=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0997[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x7099('0x0')]={'type':{'type':Sequelize[_0x7099('0x1')](_0x7099('0x2'),_0x7099('0x3'),_0x7099('0x4'),'keyValue',_0x7099('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7099('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7099('0x1')](_0x7099('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7099('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7099('0x6')]},'customField':{'type':Sequelize[_0x7099('0x7')],'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 ca1c7b4..027e93d 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 _0xccbe=['keys','intersection','model','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','params','filters','include','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','query'];(function(_0x7fb8c5,_0x409ea5){var _0x1bccbe=function(_0x33a4d4){while(--_0x33a4d4){_0x7fb8c5['push'](_0x7fb8c5['shift']());}};_0x1bccbe(++_0x409ea5);}(_0xccbe,0x13f));var _0xeccb=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0xccbe[_0x39758d];return _0x44ac11;};'use strict';var emlformat=require(_0xeccb('0x0'));var rimraf=require(_0xeccb('0x1'));var zipdir=require(_0xeccb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeccb('0x3'));var moment=require(_0xeccb('0x4'));var BPromise=require(_0xeccb('0x5'));var Mustache=require(_0xeccb('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeccb('0x7'));var csv=require(_0xeccb('0x8'));var ejs=require(_0xeccb('0x9'));var fs=require('fs');var fs_extra=require(_0xeccb('0xa'));var _=require(_0xeccb('0xb'));var squel=require(_0xeccb('0xc'));var crypto=require('crypto');var jsforce=require(_0xeccb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeccb('0x8'));var querystring=require(_0xeccb('0xe'));var Papa=require(_0xeccb('0xf'));var Redis=require(_0xeccb('0x10'));var authService=require(_0xeccb('0x11'));var qs=require(_0xeccb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeccb('0x13'));var logger=require(_0xeccb('0x14'))('api');var utils=require(_0xeccb('0x15'));var config=require(_0xeccb('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30441d,_0x1013fa){_0x1013fa=_0x1013fa||0xcc;return function(_0x44f1d9){if(_0x44f1d9){return _0x30441d[_0xeccb('0x17')](_0x1013fa);}return _0x30441d['status'](_0x1013fa)['end']();};}function respondWithResult(_0x67d9a7,_0x4c9ab2){_0x4c9ab2=_0x4c9ab2||0xc8;return function(_0x22ee46){if(_0x22ee46){return _0x67d9a7[_0xeccb('0x18')](_0x4c9ab2)[_0xeccb('0x19')](_0x22ee46);}};}function respondWithFilteredResult(_0xfbce45,_0x215e6f){return function(_0x5b70a4){if(_0x5b70a4){var _0x1833d6=typeof _0x215e6f[_0xeccb('0x1a')]===_0xeccb('0x1b')&&typeof _0x215e6f[_0xeccb('0x1c')]===_0xeccb('0x1b');var _0x324163=_0x5b70a4[_0xeccb('0x1d')];var _0x500cb0=_0x1833d6?0x0:_0x215e6f['offset'];var _0x493339=_0x1833d6?_0x5b70a4[_0xeccb('0x1d')]:_0x215e6f['offset']+_0x215e6f[_0xeccb('0x1c')];var _0x2abe77;if(_0x493339>=_0x324163){_0x493339=_0x324163;_0x2abe77=0xc8;}else{_0x2abe77=0xce;}_0xfbce45[_0xeccb('0x18')](_0x2abe77);return _0xfbce45[_0xeccb('0x1e')](_0xeccb('0x1f'),_0x500cb0+'-'+_0x493339+'/'+_0x324163)['json'](_0x5b70a4);}return null;};}function patchUpdates(_0x4cdb7a){return function(_0x1e564c){try{jsonpatch[_0xeccb('0x20')](_0x1e564c,_0x4cdb7a,!![]);}catch(_0x2c4c39){return BPromise[_0xeccb('0x21')](_0x2c4c39);}return _0x1e564c[_0xeccb('0x22')]();};}function saveUpdates(_0x429663,_0xb7b365){return function(_0x20557b){if(_0x20557b){return _0x20557b[_0xeccb('0x23')](_0x429663)['then'](function(_0x2bc914){return _0x2bc914;});}return null;};}function removeEntity(_0xeaede,_0x1c5593){return function(_0xf789f0){if(_0xf789f0){return _0xf789f0[_0xeccb('0x24')]()[_0xeccb('0x25')](function(){_0xeaede[_0xeccb('0x18')](0xcc)[_0xeccb('0x26')]();});}};}function handleEntityNotFound(_0x521ee6,_0x116dec){return function(_0x694623){if(!_0x694623){_0x521ee6['sendStatus'](0x194);}return _0x694623;};}function handleError(_0x404f8c,_0x271c66){_0x271c66=_0x271c66||0x1f4;return function(_0x4e753f){logger[_0xeccb('0x27')](_0x4e753f[_0xeccb('0x28')]);if(_0x4e753f[_0xeccb('0x29')]){delete _0x4e753f[_0xeccb('0x29')];}_0x404f8c[_0xeccb('0x18')](_0x271c66)[_0xeccb('0x2a')](_0x4e753f);};}exports[_0xeccb('0x2b')]=function(_0x5a4d49,_0x5bb1de){var _0x5311b6={},_0xf89a8={},_0x3c8844={'count':0x0,'rows':[]};var _0x23bbcd=_[_0xeccb('0x2c')](db[_0xeccb('0x2d')][_0xeccb('0x2e')],function(_0x5b25d8){return{'name':_0x5b25d8[_0xeccb('0x2f')],'type':_0x5b25d8[_0xeccb('0x30')][_0xeccb('0x31')]};});_0xf89a8['model']=_[_0xeccb('0x2c')](_0x23bbcd,_0xeccb('0x29'));_0xf89a8[_0xeccb('0x32')]=_[_0xeccb('0x33')](_0x5a4d49[_0xeccb('0x32')]);_0xf89a8['filters']=_[_0xeccb('0x34')](_0xf89a8[_0xeccb('0x35')],_0xf89a8[_0xeccb('0x32')]);_0x5311b6[_0xeccb('0x36')]=_[_0xeccb('0x34')](_0xf89a8['model'],qs[_0xeccb('0x37')](_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x37')]));_0x5311b6[_0xeccb('0x36')]=_0x5311b6[_0xeccb('0x36')][_0xeccb('0x38')]?_0x5311b6['attributes']:_0xf89a8[_0xeccb('0x35')];if(!_0x5a4d49['query']['hasOwnProperty'](_0xeccb('0x39'))){_0x5311b6['limit']=qs[_0xeccb('0x1c')](_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x1c')]);_0x5311b6[_0xeccb('0x1a')]=qs[_0xeccb('0x1a')](_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x1a')]);}_0x5311b6[_0xeccb('0x3a')]=qs['sort'](_0x5a4d49['query']['sort']);_0x5311b6[_0xeccb('0x3b')]=qs['filters'](_[_0xeccb('0x3c')](_0x5a4d49[_0xeccb('0x32')],_0xf89a8['filters']),_0x23bbcd);if(_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x3d')]){_0x5311b6[_0xeccb('0x3b')]=_['merge'](_0x5311b6['where'],{'$or':_[_0xeccb('0x2c')](_0x23bbcd,function(_0x4b5fb0){if(_0x4b5fb0[_0xeccb('0x30')]!==_0xeccb('0x3e')){var _0x439667={};_0x439667[_0x4b5fb0[_0xeccb('0x29')]]={'$like':'%'+_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x3d')]+'%'};return _0x439667;}})});}_0x5311b6=_[_0xeccb('0x3f')]({},_0x5311b6,_0x5a4d49[_0xeccb('0x40')]);var _0x329e64={'where':_0x5311b6[_0xeccb('0x3b')]};return db[_0xeccb('0x2d')][_0xeccb('0x1d')](_0x329e64)[_0xeccb('0x25')](function(_0x841d97){_0x3c8844[_0xeccb('0x1d')]=_0x841d97;if(_0x5a4d49[_0xeccb('0x32')][_0xeccb('0x41')]){_0x5311b6['include']=[{'all':!![]}];}return db[_0xeccb('0x2d')][_0xeccb('0x42')](_0x5311b6);})['then'](function(_0x5ea71f){_0x3c8844['rows']=_0x5ea71f;return _0x3c8844;})[_0xeccb('0x25')](respondWithFilteredResult(_0x5bb1de,_0x5311b6))['catch'](handleError(_0x5bb1de,null));};exports['show']=function(_0x9d5246,_0x50ac45){var _0x59e17a={'raw':!![],'where':{'id':_0x9d5246[_0xeccb('0x43')]['id']}},_0x25b819={};_0x25b819[_0xeccb('0x35')]=_[_0xeccb('0x33')](db['VtigerField'][_0xeccb('0x2e')]);_0x25b819[_0xeccb('0x32')]=_[_0xeccb('0x33')](_0x9d5246[_0xeccb('0x32')]);_0x25b819[_0xeccb('0x44')]=_[_0xeccb('0x34')](_0x25b819['model'],_0x25b819['query']);_0x59e17a[_0xeccb('0x36')]=_[_0xeccb('0x34')](_0x25b819[_0xeccb('0x35')],qs[_0xeccb('0x37')](_0x9d5246[_0xeccb('0x32')][_0xeccb('0x37')]));_0x59e17a[_0xeccb('0x36')]=_0x59e17a[_0xeccb('0x36')][_0xeccb('0x38')]?_0x59e17a['attributes']:_0x25b819[_0xeccb('0x35')];if(_0x9d5246['query'][_0xeccb('0x41')]){_0x59e17a[_0xeccb('0x45')]=[{'all':!![]}];}_0x59e17a=_[_0xeccb('0x3f')]({},_0x59e17a,_0x9d5246[_0xeccb('0x40')]);return db[_0xeccb('0x2d')][_0xeccb('0x46')](_0x59e17a)[_0xeccb('0x25')](handleEntityNotFound(_0x50ac45,null))[_0xeccb('0x25')](respondWithResult(_0x50ac45,null))[_0xeccb('0x47')](handleError(_0x50ac45,null));};exports['create']=function(_0x9d67bc,_0x30fbe5){return db[_0xeccb('0x2d')][_0xeccb('0x48')](_0x9d67bc[_0xeccb('0x49')],{})[_0xeccb('0x25')](respondWithResult(_0x30fbe5,0xc9))[_0xeccb('0x47')](handleError(_0x30fbe5,null));};exports['update']=function(_0xec6d61,_0x287a97){if(_0xec6d61[_0xeccb('0x49')]['id']){delete _0xec6d61[_0xeccb('0x49')]['id'];}return db[_0xeccb('0x2d')][_0xeccb('0x46')]({'where':{'id':_0xec6d61['params']['id']}})['then'](handleEntityNotFound(_0x287a97,null))['then'](saveUpdates(_0xec6d61[_0xeccb('0x49')],null))[_0xeccb('0x25')](respondWithResult(_0x287a97,null))[_0xeccb('0x47')](handleError(_0x287a97,null));};exports[_0xeccb('0x24')]=function(_0x5d49a1,_0x576f0d){return db[_0xeccb('0x2d')][_0xeccb('0x46')]({'where':{'id':_0x5d49a1['params']['id']}})[_0xeccb('0x25')](handleEntityNotFound(_0x576f0d,null))[_0xeccb('0x25')](removeEntity(_0x576f0d,null))[_0xeccb('0x47')](handleError(_0x576f0d,null));}; \ No newline at end of file +var _0xf2c3=['util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VtigerField','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x14bf63,_0xdbd373){var _0x410d22=function(_0x2e5e3a){while(--_0x2e5e3a){_0x14bf63['push'](_0x14bf63['shift']());}};_0x410d22(++_0xdbd373);}(_0xf2c3,0x171));var _0x3f2c=function(_0x17f668,_0x567a9f){_0x17f668=_0x17f668-0x0;var _0x2b6a19=_0xf2c3[_0x17f668];return _0x2b6a19;};'use strict';var emlformat=require(_0x3f2c('0x0'));var rimraf=require(_0x3f2c('0x1'));var zipdir=require(_0x3f2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f2c('0x3'));var moment=require(_0x3f2c('0x4'));var BPromise=require(_0x3f2c('0x5'));var Mustache=require('mustache');var util=require(_0x3f2c('0x6'));var path=require(_0x3f2c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f2c('0x8'));var fs=require('fs');var fs_extra=require(_0x3f2c('0x9'));var _=require(_0x3f2c('0xa'));var squel=require(_0x3f2c('0xb'));var crypto=require(_0x3f2c('0xc'));var jsforce=require(_0x3f2c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f2c('0xe'));var Papa=require('papaparse');var Redis=require(_0x3f2c('0xf'));var authService=require(_0x3f2c('0x10'));var qs=require(_0x3f2c('0x11'));var as=require(_0x3f2c('0x12'));var hardwareService=require(_0x3f2c('0x13'));var logger=require(_0x3f2c('0x14'))('api');var utils=require(_0x3f2c('0x15'));var config=require(_0x3f2c('0x16'));var licenseUtil=require(_0x3f2c('0x17'));var db=require(_0x3f2c('0x18'))['db'];function respondWithStatusCode(_0x653a63,_0x59064d){_0x59064d=_0x59064d||0xcc;return function(_0x10927f){if(_0x10927f){return _0x653a63[_0x3f2c('0x19')](_0x59064d);}return _0x653a63[_0x3f2c('0x1a')](_0x59064d)[_0x3f2c('0x1b')]();};}function respondWithResult(_0x4d33ea,_0x3e246f){_0x3e246f=_0x3e246f||0xc8;return function(_0x4bd147){if(_0x4bd147){return _0x4d33ea[_0x3f2c('0x1a')](_0x3e246f)[_0x3f2c('0x1c')](_0x4bd147);}};}function respondWithFilteredResult(_0x5bf70b,_0x2897b3){return function(_0x55bb05){if(_0x55bb05){var _0x40d9a8=typeof _0x2897b3[_0x3f2c('0x1d')]===_0x3f2c('0x1e')&&typeof _0x2897b3[_0x3f2c('0x1f')]===_0x3f2c('0x1e');var _0xafb5b4=_0x55bb05[_0x3f2c('0x20')];var _0x1a2a01=_0x40d9a8?0x0:_0x2897b3[_0x3f2c('0x1d')];var _0x2c8eaa=_0x40d9a8?_0x55bb05[_0x3f2c('0x20')]:_0x2897b3[_0x3f2c('0x1d')]+_0x2897b3[_0x3f2c('0x1f')];var _0x4152b6;if(_0x2c8eaa>=_0xafb5b4){_0x2c8eaa=_0xafb5b4;_0x4152b6=0xc8;}else{_0x4152b6=0xce;}_0x5bf70b[_0x3f2c('0x1a')](_0x4152b6);return _0x5bf70b[_0x3f2c('0x21')](_0x3f2c('0x22'),_0x1a2a01+'-'+_0x2c8eaa+'/'+_0xafb5b4)[_0x3f2c('0x1c')](_0x55bb05);}return null;};}function patchUpdates(_0x36ac56){return function(_0x5c6be8){try{jsonpatch['apply'](_0x5c6be8,_0x36ac56,!![]);}catch(_0x36e464){return BPromise[_0x3f2c('0x23')](_0x36e464);}return _0x5c6be8[_0x3f2c('0x24')]();};}function saveUpdates(_0x17494c,_0xad151b){return function(_0x5d8b95){if(_0x5d8b95){return _0x5d8b95[_0x3f2c('0x25')](_0x17494c)[_0x3f2c('0x26')](function(_0x43862f){return _0x43862f;});}return null;};}function removeEntity(_0x399484,_0x56ca81){return function(_0x3c7025){if(_0x3c7025){return _0x3c7025['destroy']()[_0x3f2c('0x26')](function(){_0x399484[_0x3f2c('0x1a')](0xcc)[_0x3f2c('0x1b')]();});}};}function handleEntityNotFound(_0xb08cb,_0x846bbc){return function(_0x21b84f){if(!_0x21b84f){_0xb08cb['sendStatus'](0x194);}return _0x21b84f;};}function handleError(_0x21b30c,_0x428860){_0x428860=_0x428860||0x1f4;return function(_0x3688ec){logger[_0x3f2c('0x27')](_0x3688ec[_0x3f2c('0x28')]);if(_0x3688ec[_0x3f2c('0x29')]){delete _0x3688ec[_0x3f2c('0x29')];}_0x21b30c[_0x3f2c('0x1a')](_0x428860)[_0x3f2c('0x2a')](_0x3688ec);};}exports[_0x3f2c('0x2b')]=function(_0x525f6c,_0x3164c2){var _0x2ecf9b={},_0x52fda0={},_0x2db902={'count':0x0,'rows':[]};var _0xf24eea=_[_0x3f2c('0x2c')](db[_0x3f2c('0x2d')][_0x3f2c('0x2e')],function(_0x1f39d3){return{'name':_0x1f39d3['fieldName'],'type':_0x1f39d3[_0x3f2c('0x2f')]['key']};});_0x52fda0['model']=_[_0x3f2c('0x2c')](_0xf24eea,'name');_0x52fda0[_0x3f2c('0x30')]=_[_0x3f2c('0x31')](_0x525f6c[_0x3f2c('0x30')]);_0x52fda0[_0x3f2c('0x32')]=_[_0x3f2c('0x33')](_0x52fda0[_0x3f2c('0x34')],_0x52fda0[_0x3f2c('0x30')]);_0x2ecf9b['attributes']=_['intersection'](_0x52fda0['model'],qs[_0x3f2c('0x35')](_0x525f6c[_0x3f2c('0x30')][_0x3f2c('0x35')]));_0x2ecf9b[_0x3f2c('0x36')]=_0x2ecf9b[_0x3f2c('0x36')][_0x3f2c('0x37')]?_0x2ecf9b[_0x3f2c('0x36')]:_0x52fda0[_0x3f2c('0x34')];if(!_0x525f6c['query']['hasOwnProperty'](_0x3f2c('0x38'))){_0x2ecf9b[_0x3f2c('0x1f')]=qs[_0x3f2c('0x1f')](_0x525f6c[_0x3f2c('0x30')][_0x3f2c('0x1f')]);_0x2ecf9b[_0x3f2c('0x1d')]=qs[_0x3f2c('0x1d')](_0x525f6c[_0x3f2c('0x30')][_0x3f2c('0x1d')]);}_0x2ecf9b[_0x3f2c('0x39')]=qs[_0x3f2c('0x3a')](_0x525f6c[_0x3f2c('0x30')][_0x3f2c('0x3a')]);_0x2ecf9b[_0x3f2c('0x3b')]=qs['filters'](_[_0x3f2c('0x3c')](_0x525f6c[_0x3f2c('0x30')],_0x52fda0[_0x3f2c('0x32')]),_0xf24eea);if(_0x525f6c[_0x3f2c('0x30')]['filter']){_0x2ecf9b[_0x3f2c('0x3b')]=_['merge'](_0x2ecf9b['where'],{'$or':_['map'](_0xf24eea,function(_0x3621b5){if(_0x3621b5[_0x3f2c('0x2f')]!==_0x3f2c('0x3d')){var _0x57e2a2={};_0x57e2a2[_0x3621b5[_0x3f2c('0x29')]]={'$like':'%'+_0x525f6c[_0x3f2c('0x30')]['filter']+'%'};return _0x57e2a2;}})});}_0x2ecf9b=_[_0x3f2c('0x3e')]({},_0x2ecf9b,_0x525f6c[_0x3f2c('0x3f')]);var _0x2f566f={'where':_0x2ecf9b[_0x3f2c('0x3b')]};return db['VtigerField'][_0x3f2c('0x20')](_0x2f566f)[_0x3f2c('0x26')](function(_0x1e865e){_0x2db902[_0x3f2c('0x20')]=_0x1e865e;if(_0x525f6c[_0x3f2c('0x30')][_0x3f2c('0x40')]){_0x2ecf9b[_0x3f2c('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0x3f2c('0x42')](_0x2ecf9b);})[_0x3f2c('0x26')](function(_0x3c1efc){_0x2db902[_0x3f2c('0x43')]=_0x3c1efc;return _0x2db902;})[_0x3f2c('0x26')](respondWithFilteredResult(_0x3164c2,_0x2ecf9b))[_0x3f2c('0x44')](handleError(_0x3164c2,null));};exports[_0x3f2c('0x45')]=function(_0x27947d,_0x106a69){var _0x499a67={'raw':!![],'where':{'id':_0x27947d[_0x3f2c('0x46')]['id']}},_0x206b26={};_0x206b26[_0x3f2c('0x34')]=_['keys'](db[_0x3f2c('0x2d')][_0x3f2c('0x2e')]);_0x206b26[_0x3f2c('0x30')]=_['keys'](_0x27947d[_0x3f2c('0x30')]);_0x206b26[_0x3f2c('0x32')]=_['intersection'](_0x206b26[_0x3f2c('0x34')],_0x206b26[_0x3f2c('0x30')]);_0x499a67['attributes']=_['intersection'](_0x206b26[_0x3f2c('0x34')],qs['fields'](_0x27947d['query'][_0x3f2c('0x35')]));_0x499a67[_0x3f2c('0x36')]=_0x499a67[_0x3f2c('0x36')]['length']?_0x499a67[_0x3f2c('0x36')]:_0x206b26['model'];if(_0x27947d[_0x3f2c('0x30')][_0x3f2c('0x40')]){_0x499a67[_0x3f2c('0x41')]=[{'all':!![]}];}_0x499a67=_['merge']({},_0x499a67,_0x27947d[_0x3f2c('0x3f')]);return db[_0x3f2c('0x2d')][_0x3f2c('0x47')](_0x499a67)[_0x3f2c('0x26')](handleEntityNotFound(_0x106a69,null))[_0x3f2c('0x26')](respondWithResult(_0x106a69,null))[_0x3f2c('0x44')](handleError(_0x106a69,null));};exports[_0x3f2c('0x48')]=function(_0x1683fa,_0x34f91e){return db[_0x3f2c('0x2d')]['create'](_0x1683fa[_0x3f2c('0x49')],{})['then'](respondWithResult(_0x34f91e,0xc9))[_0x3f2c('0x44')](handleError(_0x34f91e,null));};exports[_0x3f2c('0x25')]=function(_0x257991,_0x765a67){if(_0x257991[_0x3f2c('0x49')]['id']){delete _0x257991[_0x3f2c('0x49')]['id'];}return db['VtigerField'][_0x3f2c('0x47')]({'where':{'id':_0x257991['params']['id']}})['then'](handleEntityNotFound(_0x765a67,null))[_0x3f2c('0x26')](saveUpdates(_0x257991['body'],null))[_0x3f2c('0x26')](respondWithResult(_0x765a67,null))[_0x3f2c('0x44')](handleError(_0x765a67,null));};exports[_0x3f2c('0x4a')]=function(_0x31ccd7,_0x33b117){return db['VtigerField'][_0x3f2c('0x47')]({'where':{'id':_0x31ccd7[_0x3f2c('0x46')]['id']}})[_0x3f2c('0x26')](handleEntityNotFound(_0x33b117,null))['then'](removeEntity(_0x33b117,null))['catch'](handleError(_0x33b117,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4a85940..8700454 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 _0x1db7=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','vtiger_unique_index','FieldId'];(function(_0x300602,_0x52f31e){var _0x589c8c=function(_0x2fa270){while(--_0x2fa270){_0x300602['push'](_0x300602['shift']());}};_0x589c8c(++_0x52f31e);}(_0x1db7,0x120));var _0x71db=function(_0x485208,_0x1e09cf){_0x485208=_0x485208-0x0;var _0x579237=_0x1db7[_0x485208];return _0x579237;};'use strict';var _=require(_0x71db('0x0'));var util=require(_0x71db('0x1'));var logger=require(_0x71db('0x2'))('api');var moment=require(_0x71db('0x3'));var BPromise=require(_0x71db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x71db('0x5'));var config=require(_0x71db('0x6'));var attributes=require(_0x71db('0x7'));module[_0x71db('0x8')]=function(_0x24a2af,_0x1fd59c){return _0x24a2af[_0x71db('0x9')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x71db('0xa'),'fields':['idField',_0x71db('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19a7=['request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x19a7,0xaf));var _0x719a=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x19a7[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x719a('0x0'));var util=require(_0x719a('0x1'));var logger=require('../../config/logger')(_0x719a('0x2'));var moment=require(_0x719a('0x3'));var BPromise=require(_0x719a('0x4'));var rp=require(_0x719a('0x5'));var fs=require('fs');var path=require(_0x719a('0x6'));var rimraf=require(_0x719a('0x7'));var config=require(_0x719a('0x8'));var attributes=require(_0x719a('0x9'));module[_0x719a('0xa')]=function(_0x499d49,_0x246411){return _0x499d49[_0x719a('0xb')]('VtigerField',attributes,{'tableName':_0x719a('0xc'),'paranoid':![],'indexes':[{'name':_0x719a('0xd'),'fields':[_0x719a('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index a2f7f49..4f2fe21 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 _0x2ada=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x2ada,0x18e));var _0xa2ad=function(_0x83d48e,_0x507328){_0x83d48e=_0x83d48e-0x0;var _0x26f1d1=_0x2ada[_0x83d48e];return _0x26f1d1;};'use strict';var _=require(_0xa2ad('0x0'));var util=require(_0xa2ad('0x1'));var moment=require(_0xa2ad('0x2'));var BPromise=require(_0xa2ad('0x3'));var rs=require(_0xa2ad('0x4'));var fs=require('fs');var Redis=require(_0xa2ad('0x5'));var db=require(_0xa2ad('0x6'))['db'];var utils=require(_0xa2ad('0x7'));var logger=require(_0xa2ad('0x8'))(_0xa2ad('0x9'));var config=require(_0xa2ad('0xa'));var jayson=require(_0xa2ad('0xb'));var client=jayson['client'][_0xa2ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x266944,_0x33e37b,_0x45d878){return new BPromise(function(_0x3f3c54,_0x2f701f){return client[_0xa2ad('0xd')](_0x266944,_0x45d878)[_0xa2ad('0xe')](function(_0x53c31f){logger[_0xa2ad('0xf')]('VtigerField,\x20%s,\x20%s',_0x33e37b,_0xa2ad('0x10'));logger[_0xa2ad('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x33e37b,'request\x20sent',JSON['stringify'](_0x53c31f));if(_0x53c31f[_0xa2ad('0x12')]){if(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x13')]===0x1f4){logger[_0xa2ad('0x12')]('VtigerField,\x20%s,\x20%s',_0x33e37b,_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);return _0x2f701f(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x33e37b,_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);return _0x3f3c54(_0x53c31f[_0xa2ad('0x12')][_0xa2ad('0x14')]);}else{logger['info'](_0xa2ad('0x15'),_0x33e37b,_0xa2ad('0x10'));_0x3f3c54(_0x53c31f[_0xa2ad('0x16')][_0xa2ad('0x14')]);}})[_0xa2ad('0x17')](function(_0x477617){logger['error'](_0xa2ad('0x15'),_0x33e37b,_0x477617);_0x2f701f(_0x477617);});});} \ No newline at end of file +var _0xf5d9=['info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xf5d9,0xb2));var _0x9f5d=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xf5d9[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x9f5d('0x0'));var util=require(_0x9f5d('0x1'));var moment=require(_0x9f5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f5d('0x3'));var fs=require('fs');var Redis=require(_0x9f5d('0x4'));var db=require(_0x9f5d('0x5'))['db'];var utils=require(_0x9f5d('0x6'));var logger=require('../../config/logger')(_0x9f5d('0x7'));var config=require(_0x9f5d('0x8'));var jayson=require(_0x9f5d('0x9'));var client=jayson[_0x9f5d('0xa')][_0x9f5d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b01e7,_0x23bfd3,_0x52e96c){return new BPromise(function(_0x237003,_0x431290){return client[_0x9f5d('0xc')](_0x4b01e7,_0x52e96c)[_0x9f5d('0xd')](function(_0x577b45){logger['info'](_0x9f5d('0xe'),_0x23bfd3,_0x9f5d('0xf'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x23bfd3,_0x9f5d('0xf'),JSON[_0x9f5d('0x10')](_0x577b45));if(_0x577b45[_0x9f5d('0x11')]){if(_0x577b45[_0x9f5d('0x11')][_0x9f5d('0x12')]===0x1f4){logger[_0x9f5d('0x11')](_0x9f5d('0xe'),_0x23bfd3,_0x577b45['error']['message']);return _0x431290(_0x577b45[_0x9f5d('0x11')][_0x9f5d('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x23bfd3,_0x577b45['error']['message']);return _0x237003(_0x577b45[_0x9f5d('0x11')][_0x9f5d('0x13')]);}else{logger[_0x9f5d('0x14')](_0x9f5d('0xe'),_0x23bfd3,_0x9f5d('0xf'));_0x237003(_0x577b45['result'][_0x9f5d('0x13')]);}})[_0x9f5d('0x15')](function(_0x28a2cd){logger[_0x9f5d('0x11')](_0x9f5d('0xe'),_0x23bfd3,_0x28a2cd);_0x431290(_0x28a2cd);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8b1e481..efbfd50 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 _0x8e9f=['index','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated'];(function(_0xf89dac,_0x108b28){var _0x47b619=function(_0x58e1f7){while(--_0x58e1f7){_0xf89dac['push'](_0xf89dac['shift']());}};_0x47b619(++_0x108b28);}(_0x8e9f,0x1ef));var _0xf8e9=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8e9f[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0xf8e9('0x0'));var util=require('util');var path=require(_0xf8e9('0x1'));var timeout=require(_0xf8e9('0x2'));var express=require(_0xf8e9('0x3'));var router=express[_0xf8e9('0x4')]();var fs_extra=require(_0xf8e9('0x5'));var auth=require(_0xf8e9('0x6'));var interaction=require(_0xf8e9('0x7'));var config=require(_0xf8e9('0x8'));var controller=require(_0xf8e9('0x9'));router['get']('/',auth[_0xf8e9('0xa')](),controller[_0xf8e9('0xb')]);router[_0xf8e9('0xc')]('/:id',auth[_0xf8e9('0xa')](),controller['show']);router[_0xf8e9('0xc')](_0xf8e9('0xd'),auth[_0xf8e9('0xa')](),controller[_0xf8e9('0xe')]);router[_0xf8e9('0xc')](_0xf8e9('0xf'),auth['isAuthenticated'](),controller[_0xf8e9('0x10')]);router['post']('/',auth[_0xf8e9('0xa')](),controller['create']);router[_0xf8e9('0x11')](_0xf8e9('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xf8e9('0x12')](_0xf8e9('0x13'),auth[_0xf8e9('0xa')](),controller['update']);router[_0xf8e9('0x14')]('/:id',auth[_0xf8e9('0xa')](),controller['destroy']);module[_0xf8e9('0x15')]=router; \ No newline at end of file +var _0xc079=['/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations'];(function(_0x53a133,_0x52f173){var _0x150dd2=function(_0xd51358){while(--_0xd51358){_0x53a133['push'](_0x53a133['shift']());}};_0x150dd2(++_0x52f173);}(_0xc079,0xc2));var _0x9c07=function(_0x1ed41c,_0x5d5fbf){_0x1ed41c=_0x1ed41c-0x0;var _0x3c686a=_0xc079[_0x1ed41c];return _0x3c686a;};'use strict';var multer=require(_0x9c07('0x0'));var util=require(_0x9c07('0x1'));var path=require('path');var timeout=require(_0x9c07('0x2'));var express=require(_0x9c07('0x3'));var router=express[_0x9c07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9c07('0x5'));var config=require(_0x9c07('0x6'));var controller=require(_0x9c07('0x7'));router[_0x9c07('0x8')]('/',auth[_0x9c07('0x9')](),controller['index']);router[_0x9c07('0x8')](_0x9c07('0xa'),auth[_0x9c07('0x9')](),controller[_0x9c07('0xb')]);router[_0x9c07('0x8')](_0x9c07('0xc'),auth[_0x9c07('0x9')](),controller['getConfigurations']);router[_0x9c07('0x8')](_0x9c07('0xd'),auth['isAuthenticated'](),controller[_0x9c07('0xe')]);router[_0x9c07('0xf')]('/',auth[_0x9c07('0x9')](),controller[_0x9c07('0x10')]);router['post']('/:id/configurations',auth[_0x9c07('0x9')](),controller[_0x9c07('0x11')]);router[_0x9c07('0x12')](_0x9c07('0xa'),auth[_0x9c07('0x9')](),controller[_0x9c07('0x13')]);router[_0x9c07('0x14')](_0x9c07('0xa'),auth[_0x9c07('0x9')](),controller[_0x9c07('0x15')]);module[_0x9c07('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 23998f7..1ea25b4 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 _0xc14a=['STRING','remoteUri','password','token','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc14a,0xa9));var _0xac14=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc14a[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xac14('0x0'));module[_0xac14('0x1')]={'name':{'type':Sequelize[_0xac14('0x2')]},'description':{'type':Sequelize[_0xac14('0x2')]},'username':{'type':Sequelize[_0xac14('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xac14('0x2')]},'token':{'type':Sequelize[_0xac14('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xac14('0x3')},'authType':{'type':Sequelize['ENUM'](_0xac14('0x4'),_0xac14('0x5')),'defaultValue':_0xac14('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xac14('0x6')](_0xac14('0x7'),_0xac14('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x781d=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x3ba5bd,_0x490551){var _0x19a9ef=function(_0x46dbba){while(--_0x46dbba){_0x3ba5bd['push'](_0x3ba5bd['shift']());}};_0x19a9ef(++_0x490551);}(_0x781d,0x14a));var _0xd781=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x781d[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'password':{'type':Sequelize[_0xd781('0x2')]},'token':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'authType':{'type':Sequelize[_0xd781('0x5')](_0xd781('0x6'),_0xd781('0x7')),'defaultValue':_0xd781('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd781('0x5')](_0xd781('0x8'),_0xd781('0x9')),'defaultValue':_0xd781('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4729bf8..bbbad7e 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(_0x2c985e,_0x1a3dd6){var _0xac6c72=function(_0x48cf5d){while(--_0x48cf5d){_0x2c985e['push'](_0x2c985e['shift']());}};_0xac6c72(++_0x1a3dd6);}(_0x9c00,0x1a0));var _0x09c0=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0x9c00[_0x485f35];return _0x2ad118;};'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 _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x17b07f,_0x27a4a4){var _0x12c1cc=function(_0x90f8eb){while(--_0x90f8eb){_0x17b07f['push'](_0x17b07f['shift']());}};_0x12c1cc(++_0x27a4a4);}(_0x63a5,0x18e));var _0x563a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x63a5[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 6d4194d..da483d0 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 _0xbc97=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_zendesk_accounts','util','api','moment','bluebird'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbc97,0x1b8));var _0x7bc9=function(_0x391180,_0x26a224){_0x391180=_0x391180-0x0;var _0x46720c=_0xbc97[_0x391180];return _0x46720c;};'use strict';var _=require('lodash');var util=require(_0x7bc9('0x0'));var logger=require('../../config/logger')(_0x7bc9('0x1'));var moment=require(_0x7bc9('0x2'));var BPromise=require(_0x7bc9('0x3'));var rp=require(_0x7bc9('0x4'));var fs=require('fs');var path=require(_0x7bc9('0x5'));var rimraf=require(_0x7bc9('0x6'));var config=require(_0x7bc9('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x7bc9('0x8'));module[_0x7bc9('0x9')]=function(_0x5b6d26,_0xcda7d4){return _0x5b6d26[_0x7bc9('0xa')]('ZendeskAccount',attributes,{'tableName':_0x7bc9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd33=['request-promise','rimraf','../../config/environment','exports','ZendeskAccount','util','../../config/logger','api','bluebird'];(function(_0x491ea7,_0x3d64a9){var _0x287d07=function(_0x46a76b){while(--_0x46a76b){_0x491ea7['push'](_0x491ea7['shift']());}};_0x287d07(++_0x3d64a9);}(_0xcd33,0x8c));var _0x3cd3=function(_0x2a11b4,_0x43625c){_0x2a11b4=_0x2a11b4-0x0;var _0xaf3cf=_0xcd33[_0x2a11b4];return _0xaf3cf;};'use strict';var _=require('lodash');var util=require(_0x3cd3('0x0'));var logger=require(_0x3cd3('0x1'))(_0x3cd3('0x2'));var moment=require('moment');var BPromise=require(_0x3cd3('0x3'));var rp=require(_0x3cd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cd3('0x5'));var config=require(_0x3cd3('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3cd3('0x7')]=function(_0x5e03ad,_0x5bb33e){return _0x5e03ad['define'](_0x3cd3('0x8'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 3bdb866..b872b42 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 _0x0b08=['code','error','message','info','result','catch','GetZendeskAccount','options','raw','map','include','model','attributes','ZendeskAccount','where','ShowZendeskAccount','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x0b08,0x108));var _0x80b0=function(_0x31c81b,_0x4a2b1c){_0x31c81b=_0x31c81b-0x0;var _0x52ab34=_0x0b08[_0x31c81b];return _0x52ab34;};'use strict';var _=require(_0x80b0('0x0'));var util=require(_0x80b0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x80b0('0x2'));var fs=require('fs');var Redis=require(_0x80b0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x80b0('0x4'))('rpc');var config=require(_0x80b0('0x5'));var jayson=require(_0x80b0('0x6'));var client=jayson['client'][_0x80b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2df105,_0x12c577,_0x2bf228){return new BPromise(function(_0x1076d5,_0x53b433){return client[_0x80b0('0x8')](_0x2df105,_0x2bf228)[_0x80b0('0x9')](function(_0x76cdf0){logger['info'](_0x80b0('0xa'),_0x12c577,_0x80b0('0xb'));logger[_0x80b0('0xc')](_0x80b0('0xd'),_0x12c577,_0x80b0('0xb'),JSON[_0x80b0('0xe')](_0x76cdf0));if(_0x76cdf0['error']){if(_0x76cdf0['error'][_0x80b0('0xf')]===0x1f4){logger[_0x80b0('0x10')](_0x80b0('0xa'),_0x12c577,_0x76cdf0[_0x80b0('0x10')][_0x80b0('0x11')]);return _0x53b433(_0x76cdf0['error'][_0x80b0('0x11')]);}logger[_0x80b0('0x10')](_0x80b0('0xa'),_0x12c577,_0x76cdf0[_0x80b0('0x10')][_0x80b0('0x11')]);return _0x1076d5(_0x76cdf0[_0x80b0('0x10')][_0x80b0('0x11')]);}else{logger[_0x80b0('0x12')](_0x80b0('0xa'),_0x12c577,'request\x20sent');_0x1076d5(_0x76cdf0[_0x80b0('0x13')]['message']);}})[_0x80b0('0x14')](function(_0x4abe8e){logger['error'](_0x80b0('0xa'),_0x12c577,_0x4abe8e);_0x53b433(_0x4abe8e);});});}exports[_0x80b0('0x15')]=function(_0x2c1c06){var _0x156fe7=this;return new Promise(function(_0x362257,_0x9bfdf0){return db['ZendeskAccount']['findAll']({'raw':_0x2c1c06['options']?_0x2c1c06[_0x80b0('0x16')][_0x80b0('0x17')]===undefined?!![]:![]:!![],'where':_0x2c1c06['options']?_0x2c1c06[_0x80b0('0x16')]['where']||null:null,'attributes':_0x2c1c06[_0x80b0('0x16')]?_0x2c1c06[_0x80b0('0x16')]['attributes']||null:null,'limit':_0x2c1c06[_0x80b0('0x16')]?_0x2c1c06[_0x80b0('0x16')]['limit']||null:null,'include':_0x2c1c06[_0x80b0('0x16')]?_0x2c1c06[_0x80b0('0x16')]['include']?_[_0x80b0('0x18')](_0x2c1c06[_0x80b0('0x16')][_0x80b0('0x19')],function(_0x4df008){return{'model':db[_0x4df008[_0x80b0('0x1a')]],'as':_0x4df008['as'],'attributes':_0x4df008[_0x80b0('0x1b')],'include':_0x4df008['include']?_[_0x80b0('0x18')](_0x4df008['include'],function(_0x3bc4b2){return{'model':db[_0x3bc4b2[_0x80b0('0x1a')]],'as':_0x3bc4b2['as'],'attributes':_0x3bc4b2[_0x80b0('0x1b')],'include':_0x3bc4b2[_0x80b0('0x19')]?_[_0x80b0('0x18')](_0x3bc4b2[_0x80b0('0x19')],function(_0x5ea9a2){return{'model':db[_0x5ea9a2[_0x80b0('0x1a')]],'as':_0x5ea9a2['as'],'attributes':_0x5ea9a2[_0x80b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x80b0('0x9')](function(_0xc96977){logger[_0x80b0('0x12')](_0x80b0('0x15'),_0x2c1c06);logger['debug'](_0x80b0('0x15'),_0x2c1c06,JSON[_0x80b0('0xe')](_0xc96977));_0x362257(_0xc96977);})['catch'](function(_0x401b59){logger[_0x80b0('0x10')](_0x80b0('0x15'),_0x401b59[_0x80b0('0x11')],_0x2c1c06);_0x9bfdf0(_0x156fe7[_0x80b0('0x10')](0x1f4,_0x401b59[_0x80b0('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x4b5012){var _0x4184ff=this;return new Promise(function(_0x4c8f85,_0x2ab5b6){return db[_0x80b0('0x1c')]['find']({'raw':_0x4b5012[_0x80b0('0x16')]?_0x4b5012[_0x80b0('0x16')][_0x80b0('0x17')]===undefined?!![]:![]:!![],'where':_0x4b5012[_0x80b0('0x16')]?_0x4b5012[_0x80b0('0x16')][_0x80b0('0x1d')]||null:null,'attributes':_0x4b5012[_0x80b0('0x16')]?_0x4b5012[_0x80b0('0x16')][_0x80b0('0x1b')]||null:null,'include':_0x4b5012[_0x80b0('0x16')]?_0x4b5012[_0x80b0('0x16')][_0x80b0('0x19')]?_[_0x80b0('0x18')](_0x4b5012[_0x80b0('0x16')]['include'],function(_0x507b1c){return{'model':db[_0x507b1c['model']],'as':_0x507b1c['as'],'attributes':_0x507b1c[_0x80b0('0x1b')],'include':_0x507b1c[_0x80b0('0x19')]?_[_0x80b0('0x18')](_0x507b1c[_0x80b0('0x19')],function(_0x50ddf9){return{'model':db[_0x50ddf9[_0x80b0('0x1a')]],'as':_0x50ddf9['as'],'attributes':_0x50ddf9[_0x80b0('0x1b')],'include':_0x50ddf9['include']?_['map'](_0x50ddf9['include'],function(_0x170be5){return{'model':db[_0x170be5[_0x80b0('0x1a')]],'as':_0x170be5['as'],'attributes':_0x170be5[_0x80b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x80b0('0x9')](function(_0x2b763d){logger['info'](_0x80b0('0x1e'),_0x4b5012);logger['debug'](_0x80b0('0x1e'),_0x4b5012,JSON[_0x80b0('0xe')](_0x2b763d));_0x4c8f85(_0x2b763d);})[_0x80b0('0x14')](function(_0x5a66e2){logger[_0x80b0('0x10')](_0x80b0('0x1e'),_0x5a66e2[_0x80b0('0x11')],_0x4b5012);_0x2ab5b6(_0x4184ff[_0x80b0('0x10')](0x1f4,_0x5a66e2[_0x80b0('0x11')]));});});}; \ No newline at end of file +var _0x1375=['stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0xcecfab,_0x527bfb){var _0x5b2282=function(_0x2e1d1b){while(--_0x2e1d1b){_0xcecfab['push'](_0xcecfab['shift']());}};_0x5b2282(++_0x527bfb);}(_0x1375,0x170));var _0x5137=function(_0x8fd7ac,_0x257caf){_0x8fd7ac=_0x8fd7ac-0x0;var _0x320d82=_0x1375[_0x8fd7ac];return _0x320d82;};'use strict';var _=require(_0x5137('0x0'));var util=require(_0x5137('0x1'));var moment=require(_0x5137('0x2'));var BPromise=require('bluebird');var rs=require(_0x5137('0x3'));var fs=require('fs');var Redis=require(_0x5137('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5137('0x5'));var logger=require(_0x5137('0x6'))(_0x5137('0x7'));var config=require(_0x5137('0x8'));var jayson=require(_0x5137('0x9'));var client=jayson[_0x5137('0xa')][_0x5137('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2da232,_0x242481,_0x3f3143){return new BPromise(function(_0x435957,_0xfa622e){return client[_0x5137('0xc')](_0x2da232,_0x3f3143)[_0x5137('0xd')](function(_0x44f5cd){logger[_0x5137('0xe')](_0x5137('0xf'),_0x242481,_0x5137('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x242481,_0x5137('0x10'),JSON[_0x5137('0x11')](_0x44f5cd));if(_0x44f5cd[_0x5137('0x12')]){if(_0x44f5cd['error'][_0x5137('0x13')]===0x1f4){logger['error'](_0x5137('0xf'),_0x242481,_0x44f5cd[_0x5137('0x12')]['message']);return _0xfa622e(_0x44f5cd['error'][_0x5137('0x14')]);}logger[_0x5137('0x12')](_0x5137('0xf'),_0x242481,_0x44f5cd[_0x5137('0x12')][_0x5137('0x14')]);return _0x435957(_0x44f5cd[_0x5137('0x12')][_0x5137('0x14')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x242481,_0x5137('0x10'));_0x435957(_0x44f5cd['result'][_0x5137('0x14')]);}})[_0x5137('0x15')](function(_0x13ca57){logger['error'](_0x5137('0xf'),_0x242481,_0x13ca57);_0xfa622e(_0x13ca57);});});}exports[_0x5137('0x16')]=function(_0x32378d){var _0xad7083=this;return new Promise(function(_0x34a32f,_0x504c32){return db[_0x5137('0x17')][_0x5137('0x18')]({'raw':_0x32378d['options']?_0x32378d[_0x5137('0x19')][_0x5137('0x1a')]===undefined?!![]:![]:!![],'where':_0x32378d[_0x5137('0x19')]?_0x32378d[_0x5137('0x19')][_0x5137('0x1b')]||null:null,'attributes':_0x32378d[_0x5137('0x19')]?_0x32378d[_0x5137('0x19')][_0x5137('0x1c')]||null:null,'limit':_0x32378d[_0x5137('0x19')]?_0x32378d['options'][_0x5137('0x1d')]||null:null,'include':_0x32378d[_0x5137('0x19')]?_0x32378d[_0x5137('0x19')]['include']?_[_0x5137('0x1e')](_0x32378d['options'][_0x5137('0x1f')],function(_0x3c3220){return{'model':db[_0x3c3220['model']],'as':_0x3c3220['as'],'attributes':_0x3c3220['attributes'],'include':_0x3c3220[_0x5137('0x1f')]?_[_0x5137('0x1e')](_0x3c3220[_0x5137('0x1f')],function(_0x2cf94b){return{'model':db[_0x2cf94b[_0x5137('0x20')]],'as':_0x2cf94b['as'],'attributes':_0x2cf94b[_0x5137('0x1c')],'include':_0x2cf94b[_0x5137('0x1f')]?_[_0x5137('0x1e')](_0x2cf94b[_0x5137('0x1f')],function(_0x4399ad){return{'model':db[_0x4399ad[_0x5137('0x20')]],'as':_0x4399ad['as'],'attributes':_0x4399ad[_0x5137('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5137('0xd')](function(_0x13f38f){logger['info'](_0x5137('0x16'),_0x32378d);logger['debug']('GetZendeskAccount',_0x32378d,JSON['stringify'](_0x13f38f));_0x34a32f(_0x13f38f);})[_0x5137('0x15')](function(_0x3b4b3b){logger['error'](_0x5137('0x16'),_0x3b4b3b[_0x5137('0x14')],_0x32378d);_0x504c32(_0xad7083[_0x5137('0x12')](0x1f4,_0x3b4b3b[_0x5137('0x14')]));});});};exports[_0x5137('0x21')]=function(_0x4add85){var _0x187046=this;return new Promise(function(_0x2af31f,_0x2f866f){return db[_0x5137('0x17')][_0x5137('0x22')]({'raw':_0x4add85[_0x5137('0x19')]?_0x4add85['options']['raw']===undefined?!![]:![]:!![],'where':_0x4add85['options']?_0x4add85['options'][_0x5137('0x1b')]||null:null,'attributes':_0x4add85[_0x5137('0x19')]?_0x4add85['options'][_0x5137('0x1c')]||null:null,'include':_0x4add85[_0x5137('0x19')]?_0x4add85['options']['include']?_['map'](_0x4add85[_0x5137('0x19')][_0x5137('0x1f')],function(_0x4f9390){return{'model':db[_0x4f9390[_0x5137('0x20')]],'as':_0x4f9390['as'],'attributes':_0x4f9390[_0x5137('0x1c')],'include':_0x4f9390[_0x5137('0x1f')]?_[_0x5137('0x1e')](_0x4f9390[_0x5137('0x1f')],function(_0x36faa9){return{'model':db[_0x36faa9[_0x5137('0x20')]],'as':_0x36faa9['as'],'attributes':_0x36faa9[_0x5137('0x1c')],'include':_0x36faa9[_0x5137('0x1f')]?_[_0x5137('0x1e')](_0x36faa9[_0x5137('0x1f')],function(_0x23eec2){return{'model':db[_0x23eec2['model']],'as':_0x23eec2['as'],'attributes':_0x23eec2[_0x5137('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a113c){logger[_0x5137('0xe')]('ShowZendeskAccount',_0x4add85);logger['debug'](_0x5137('0x21'),_0x4add85,JSON[_0x5137('0x11')](_0x3a113c));_0x2af31f(_0x3a113c);})[_0x5137('0x15')](function(_0x23720a){logger[_0x5137('0x12')](_0x5137('0x21'),_0x23720a['message'],_0x4add85);_0x2f866f(_0x187046['error'](0x1f4,_0x23720a[_0x5137('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 4043ecf..10ec38b 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 _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x211834,_0x56a433){var _0x55e44f=function(_0x20fb24){while(--_0x20fb24){_0x211834['push'](_0x211834['shift']());}};_0x55e44f(++_0x56a433);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2789,_0x6d23c6){_0x3e2789=_0x3e2789-0x0;var _0x4371ba=_0xb10b[_0x3e2789];return _0x4371ba;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x1bad26,_0x5399a9){var _0x48c76a=function(_0x213765){while(--_0x213765){_0x1bad26['push'](_0x1bad26['shift']());}};_0x48c76a(++_0x5399a9);}(_0x087b,0x11a));var _0xb087=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x087b[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 516dc39..7e204a5 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 _0x796b=['STRING'];(function(_0x85edeb,_0x1e63cd){var _0x19973b=function(_0xa8d56f){while(--_0xa8d56f){_0x85edeb['push'](_0x85edeb['shift']());}};_0x19973b(++_0x1e63cd);}(_0x796b,0xbb));var _0xb796=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x796b[_0x59162a];return _0x35e50d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb796('0x0')]},'description':{'type':Sequelize[_0xb796('0x0')]}}; \ No newline at end of file +var _0xab20=['sequelize','exports','STRING'];(function(_0x3d88c8,_0x59af71){var _0x4e5fd8=function(_0x4251e7){while(--_0x4251e7){_0x3d88c8['push'](_0x3d88c8['shift']());}};_0x4e5fd8(++_0x59af71);}(_0xab20,0x1f2));var _0x0ab2=function(_0x15a26f,_0x4e8151){_0x15a26f=_0x15a26f-0x0;var _0xf158d=_0xab20[_0x15a26f];return _0xf158d;};'use strict';var Sequelize=require(_0x0ab2('0x0'));module[_0x0ab2('0x1')]={'name':{'type':Sequelize[_0x0ab2('0x2')]},'description':{'type':Sequelize[_0x0ab2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 3d772ac..e5b4885 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 _0xe31c=['count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','type','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','getFields','getSubjects','getDescriptions','findOne','ZendeskField','getTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset'];(function(_0x109d0,_0xcbf079){var _0x2078f4=function(_0x249ee2){while(--_0x249ee2){_0x109d0['push'](_0x109d0['shift']());}};_0x2078f4(++_0xcbf079);}(_0xe31c,0xdb));var _0xce31=function(_0x716450,_0xfb6316){_0x716450=_0x716450-0x0;var _0x3b5d7a=_0xe31c[_0x716450];return _0x3b5d7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce31('0x0'));var zipdir=require(_0xce31('0x1'));var jsonpatch=require(_0xce31('0x2'));var rp=require(_0xce31('0x3'));var moment=require(_0xce31('0x4'));var BPromise=require(_0xce31('0x5'));var Mustache=require(_0xce31('0x6'));var util=require(_0xce31('0x7'));var path=require(_0xce31('0x8'));var sox=require(_0xce31('0x9'));var csv=require(_0xce31('0xa'));var ejs=require(_0xce31('0xb'));var fs=require('fs');var fs_extra=require(_0xce31('0xc'));var _=require(_0xce31('0xd'));var squel=require(_0xce31('0xe'));var crypto=require(_0xce31('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xce31('0x10'));var toCsv=require(_0xce31('0xa'));var querystring=require('querystring');var Papa=require(_0xce31('0x11'));var Redis=require(_0xce31('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce31('0x13'));var hardwareService=require(_0xce31('0x14'));var logger=require(_0xce31('0x15'))(_0xce31('0x16'));var utils=require(_0xce31('0x17'));var config=require(_0xce31('0x18'));var licenseUtil=require(_0xce31('0x19'));var db=require(_0xce31('0x1a'))['db'];function respondWithStatusCode(_0x414f24,_0x59a269){_0x59a269=_0x59a269||0xcc;return function(_0x270a93){if(_0x270a93){return _0x414f24[_0xce31('0x1b')](_0x59a269);}return _0x414f24[_0xce31('0x1c')](_0x59a269)[_0xce31('0x1d')]();};}function respondWithResult(_0x21a8e7,_0x207a07){_0x207a07=_0x207a07||0xc8;return function(_0x46cb24){if(_0x46cb24){return _0x21a8e7[_0xce31('0x1c')](_0x207a07)[_0xce31('0x1e')](_0x46cb24);}};}function respondWithFilteredResult(_0x28ce31,_0xeae3b6){return function(_0x3591fa){if(_0x3591fa){var _0x49998e=typeof _0xeae3b6['offset']==='undefined'&&typeof _0xeae3b6[_0xce31('0x1f')]==='undefined';var _0x4f2442=_0x3591fa['count'];var _0x5e851c=_0x49998e?0x0:_0xeae3b6[_0xce31('0x20')];var _0x59807c=_0x49998e?_0x3591fa[_0xce31('0x21')]:_0xeae3b6[_0xce31('0x20')]+_0xeae3b6[_0xce31('0x1f')];var _0xdf4c5e;if(_0x59807c>=_0x4f2442){_0x59807c=_0x4f2442;_0xdf4c5e=0xc8;}else{_0xdf4c5e=0xce;}_0x28ce31[_0xce31('0x1c')](_0xdf4c5e);return _0x28ce31['set'](_0xce31('0x22'),_0x5e851c+'-'+_0x59807c+'/'+_0x4f2442)[_0xce31('0x1e')](_0x3591fa);}return null;};}function patchUpdates(_0x212fca){return function(_0x468adb){try{jsonpatch[_0xce31('0x23')](_0x468adb,_0x212fca,!![]);}catch(_0x5dd10a){return BPromise[_0xce31('0x24')](_0x5dd10a);}return _0x468adb[_0xce31('0x25')]();};}function saveUpdates(_0x5ab9ff,_0x597146){return function(_0x2854a9){if(_0x2854a9){return _0x2854a9[_0xce31('0x26')](_0x5ab9ff)[_0xce31('0x27')](function(_0x129e98){return _0x129e98;});}return null;};}function removeEntity(_0x1521d6,_0x18c666){return function(_0x4cb149){if(_0x4cb149){return _0x4cb149[_0xce31('0x28')]()[_0xce31('0x27')](function(){_0x1521d6[_0xce31('0x1c')](0xcc)[_0xce31('0x1d')]();});}};}function handleEntityNotFound(_0x1813ed,_0x224597){return function(_0x12bbb3){if(!_0x12bbb3){_0x1813ed[_0xce31('0x1b')](0x194);}return _0x12bbb3;};}function handleError(_0x3637c1,_0x3c097a){_0x3c097a=_0x3c097a||0x1f4;return function(_0x15b6a4){logger[_0xce31('0x29')](_0x15b6a4[_0xce31('0x2a')]);if(_0x15b6a4[_0xce31('0x2b')]){delete _0x15b6a4[_0xce31('0x2b')];}_0x3637c1[_0xce31('0x1c')](_0x3c097a)[_0xce31('0x2c')](_0x15b6a4);};}exports[_0xce31('0x2d')]=function(_0x186b58,_0x39bb29){var _0x551093={},_0x3af598={},_0x1b6321={'count':0x0,'rows':[]};var _0x5ac9b6=_[_0xce31('0x2e')](db[_0xce31('0x2f')][_0xce31('0x30')],function(_0x58568e){return{'name':_0x58568e[_0xce31('0x31')],'type':_0x58568e['type']['key']};});_0x3af598[_0xce31('0x32')]=_['map'](_0x5ac9b6,_0xce31('0x2b'));_0x3af598[_0xce31('0x33')]=_['keys'](_0x186b58[_0xce31('0x33')]);_0x3af598['filters']=_['intersection'](_0x3af598[_0xce31('0x32')],_0x3af598['query']);_0x551093[_0xce31('0x34')]=_[_0xce31('0x35')](_0x3af598['model'],qs['fields'](_0x186b58[_0xce31('0x33')][_0xce31('0x36')]));_0x551093[_0xce31('0x34')]=_0x551093[_0xce31('0x34')][_0xce31('0x37')]?_0x551093[_0xce31('0x34')]:_0x3af598[_0xce31('0x32')];if(!_0x186b58[_0xce31('0x33')][_0xce31('0x38')](_0xce31('0x39'))){_0x551093[_0xce31('0x1f')]=qs[_0xce31('0x1f')](_0x186b58[_0xce31('0x33')]['limit']);_0x551093[_0xce31('0x20')]=qs[_0xce31('0x20')](_0x186b58[_0xce31('0x33')][_0xce31('0x20')]);}_0x551093[_0xce31('0x3a')]=qs[_0xce31('0x3b')](_0x186b58[_0xce31('0x33')][_0xce31('0x3b')]);_0x551093['where']=qs['filters'](_[_0xce31('0x3c')](_0x186b58['query'],_0x3af598[_0xce31('0x3d')]),_0x5ac9b6);if(_0x186b58[_0xce31('0x33')][_0xce31('0x3e')]){_0x551093[_0xce31('0x3f')]=_['merge'](_0x551093['where'],{'$or':_[_0xce31('0x2e')](_0x5ac9b6,function(_0x5ea427){if(_0x5ea427[_0xce31('0x40')]!=='VIRTUAL'){var _0x359068={};_0x359068[_0x5ea427[_0xce31('0x2b')]]={'$like':'%'+_0x186b58['query'][_0xce31('0x3e')]+'%'};return _0x359068;}})});}_0x551093=_[_0xce31('0x41')]({},_0x551093,_0x186b58[_0xce31('0x42')]);var _0x4165fc={'where':_0x551093[_0xce31('0x3f')]};return db[_0xce31('0x2f')][_0xce31('0x21')](_0x4165fc)[_0xce31('0x27')](function(_0xa9618f){_0x1b6321[_0xce31('0x21')]=_0xa9618f;if(_0x186b58[_0xce31('0x33')]['includeAll']){_0x551093[_0xce31('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0x551093);})[_0xce31('0x27')](function(_0x460bc5){_0x1b6321[_0xce31('0x44')]=_0x460bc5;return _0x1b6321;})['then'](respondWithFilteredResult(_0x39bb29,_0x551093))[_0xce31('0x45')](handleError(_0x39bb29,null));};exports[_0xce31('0x46')]=function(_0x16b1fd,_0xaa0768){var _0x3040d1={'raw':![],'where':{'id':_0x16b1fd[_0xce31('0x47')]['id']}},_0x272953={};_0x272953[_0xce31('0x32')]=_[_0xce31('0x48')](db[_0xce31('0x2f')][_0xce31('0x30')]);_0x272953[_0xce31('0x33')]=_['keys'](_0x16b1fd[_0xce31('0x33')]);_0x272953[_0xce31('0x3d')]=_[_0xce31('0x35')](_0x272953[_0xce31('0x32')],_0x272953['query']);_0x3040d1[_0xce31('0x34')]=_['intersection'](_0x272953['model'],qs[_0xce31('0x36')](_0x16b1fd['query'][_0xce31('0x36')]));_0x3040d1[_0xce31('0x34')]=_0x3040d1[_0xce31('0x34')][_0xce31('0x37')]?_0x3040d1[_0xce31('0x34')]:_0x272953[_0xce31('0x32')];if(_0x16b1fd[_0xce31('0x33')][_0xce31('0x49')]){_0x3040d1['include']=[{'all':!![]}];}_0x3040d1=_[_0xce31('0x41')]({},_0x3040d1,_0x16b1fd[_0xce31('0x42')]);return db[_0xce31('0x2f')][_0xce31('0x4a')](_0x3040d1)[_0xce31('0x27')](handleEntityNotFound(_0xaa0768,null))['then'](respondWithResult(_0xaa0768,null))[_0xce31('0x45')](handleError(_0xaa0768,null));};exports['create']=function(_0x32ad09,_0x1e9e89){return db[_0xce31('0x2f')][_0xce31('0x4b')](_0x32ad09['body'],{})[_0xce31('0x27')](respondWithResult(_0x1e9e89,0xc9))['catch'](handleError(_0x1e9e89,null));};exports[_0xce31('0x26')]=function(_0x1d9fb0,_0x4f0513){if(_0x1d9fb0[_0xce31('0x4c')]['id']){delete _0x1d9fb0['body']['id'];}return db[_0xce31('0x2f')][_0xce31('0x4a')]({'where':{'id':_0x1d9fb0['params']['id']}})[_0xce31('0x27')](handleEntityNotFound(_0x4f0513,null))[_0xce31('0x27')](saveUpdates(_0x1d9fb0[_0xce31('0x4c')],null))['then'](respondWithResult(_0x4f0513,null))[_0xce31('0x45')](handleError(_0x4f0513,null));};exports[_0xce31('0x28')]=function(_0x4167ef,_0x4824f9){return db['ZendeskConfiguration'][_0xce31('0x4a')]({'where':{'id':_0x4167ef[_0xce31('0x47')]['id']}})[_0xce31('0x27')](handleEntityNotFound(_0x4824f9,null))['then'](removeEntity(_0x4824f9,null))[_0xce31('0x45')](handleError(_0x4824f9,null));};exports[_0xce31('0x4d')]=function(_0x5370d9,_0x449697,_0x5c12a3){var _0x5a7f38={};var _0x4a23ee={};var _0xc2b7e0;var _0x4c34ca;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5370d9[_0xce31('0x47')]['id']}})[_0xce31('0x27')](handleEntityNotFound(_0x449697,null))[_0xce31('0x27')](function(_0x41bbb6){if(_0x41bbb6){_0xc2b7e0=_0x41bbb6;_0x4a23ee[_0xce31('0x32')]=_[_0xce31('0x48')](db['ZendeskField'][_0xce31('0x30')]);_0x4a23ee[_0xce31('0x33')]=_[_0xce31('0x48')](_0x5370d9['query']);_0x4a23ee[_0xce31('0x3d')]=_[_0xce31('0x35')](_0x4a23ee[_0xce31('0x32')],_0x4a23ee[_0xce31('0x33')]);_0x5a7f38['attributes']=_['intersection'](_0x4a23ee[_0xce31('0x32')],qs[_0xce31('0x36')](_0x5370d9[_0xce31('0x33')][_0xce31('0x36')]));_0x5a7f38['attributes']=_0x5a7f38[_0xce31('0x34')][_0xce31('0x37')]?_0x5a7f38[_0xce31('0x34')]:_0x4a23ee[_0xce31('0x32')];_0x5a7f38[_0xce31('0x3a')]=qs[_0xce31('0x3b')](_0x5370d9[_0xce31('0x33')][_0xce31('0x3b')]);_0x5a7f38['where']=qs[_0xce31('0x3d')](_[_0xce31('0x3c')](_0x5370d9[_0xce31('0x33')],_0x4a23ee[_0xce31('0x3d')]));if(_0x5370d9[_0xce31('0x33')][_0xce31('0x3e')]){_0x5a7f38[_0xce31('0x3f')]=_[_0xce31('0x41')](_0x5a7f38[_0xce31('0x3f')],{'$or':_[_0xce31('0x2e')](_0x5a7f38[_0xce31('0x34')],function(_0x5f17b1){var _0x3edb9c={};_0x3edb9c[_0x5f17b1]={'$like':'%'+_0x5370d9[_0xce31('0x33')][_0xce31('0x3e')]+'%'};return _0x3edb9c;})});}_0x5a7f38=_['merge']({},_0x5a7f38,_0x5370d9[_0xce31('0x42')]);return _0xc2b7e0[_0xce31('0x4d')](_0x5a7f38);}})[_0xce31('0x27')](function(_0x622805){if(_0x622805){_0x4c34ca=_0x622805['length'];if(!_0x5370d9['query'][_0xce31('0x38')](_0xce31('0x39'))){_0x5a7f38[_0xce31('0x1f')]=qs[_0xce31('0x1f')](_0x5370d9[_0xce31('0x33')]['limit']);_0x5a7f38[_0xce31('0x20')]=qs[_0xce31('0x20')](_0x5370d9['query']['offset']);}return _0xc2b7e0[_0xce31('0x4d')](_0x5a7f38);}})[_0xce31('0x27')](function(_0x34fbba){if(_0x34fbba){return _0x34fbba?{'count':_0x4c34ca,'rows':_0x34fbba}:null;}})[_0xce31('0x27')](respondWithResult(_0x449697,null))['catch'](handleError(_0x449697,null));};exports['getSubjects']=function(_0xae23f6,_0x7fc7f2,_0x165d18){var _0x1a25f0={};var _0x5ecd16={};var _0x132a2c;var _0x33d334;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xae23f6[_0xce31('0x47')]['id']}})[_0xce31('0x27')](handleEntityNotFound(_0x7fc7f2,null))[_0xce31('0x27')](function(_0x4fbbf6){if(_0x4fbbf6){_0x132a2c=_0x4fbbf6;_0x5ecd16['model']=_[_0xce31('0x48')](db['ZendeskField'][_0xce31('0x30')]);_0x5ecd16[_0xce31('0x33')]=_[_0xce31('0x48')](_0xae23f6['query']);_0x5ecd16[_0xce31('0x3d')]=_['intersection'](_0x5ecd16[_0xce31('0x32')],_0x5ecd16['query']);_0x1a25f0[_0xce31('0x34')]=_[_0xce31('0x35')](_0x5ecd16['model'],qs[_0xce31('0x36')](_0xae23f6[_0xce31('0x33')][_0xce31('0x36')]));_0x1a25f0[_0xce31('0x34')]=_0x1a25f0[_0xce31('0x34')][_0xce31('0x37')]?_0x1a25f0['attributes']:_0x5ecd16[_0xce31('0x32')];_0x1a25f0[_0xce31('0x3a')]=qs[_0xce31('0x3b')](_0xae23f6['query'][_0xce31('0x3b')]);_0x1a25f0['where']=qs[_0xce31('0x3d')](_[_0xce31('0x3c')](_0xae23f6[_0xce31('0x33')],_0x5ecd16[_0xce31('0x3d')]));if(_0xae23f6[_0xce31('0x33')][_0xce31('0x3e')]){_0x1a25f0['where']=_['merge'](_0x1a25f0['where'],{'$or':_['map'](_0x1a25f0[_0xce31('0x34')],function(_0x588e47){var _0x2886e5={};_0x2886e5[_0x588e47]={'$like':'%'+_0xae23f6[_0xce31('0x33')][_0xce31('0x3e')]+'%'};return _0x2886e5;})});}_0x1a25f0=_['merge']({},_0x1a25f0,_0xae23f6[_0xce31('0x42')]);return _0x132a2c[_0xce31('0x4e')](_0x1a25f0);}})[_0xce31('0x27')](function(_0x29df53){if(_0x29df53){_0x33d334=_0x29df53[_0xce31('0x37')];if(!_0xae23f6[_0xce31('0x33')][_0xce31('0x38')](_0xce31('0x39'))){_0x1a25f0['limit']=qs[_0xce31('0x1f')](_0xae23f6['query'][_0xce31('0x1f')]);_0x1a25f0[_0xce31('0x20')]=qs['offset'](_0xae23f6['query'][_0xce31('0x20')]);}return _0x132a2c[_0xce31('0x4e')](_0x1a25f0);}})[_0xce31('0x27')](function(_0x16317a){if(_0x16317a){return _0x16317a?{'count':_0x33d334,'rows':_0x16317a}:null;}})[_0xce31('0x27')](respondWithResult(_0x7fc7f2,null))[_0xce31('0x45')](handleError(_0x7fc7f2,null));};exports[_0xce31('0x4f')]=function(_0x4e11ff,_0x1a830f,_0x75203c){var _0x49ddb4={};var _0x557668={};var _0x1542e6;var _0x18661a;return db['ZendeskConfiguration'][_0xce31('0x50')]({'where':{'id':_0x4e11ff[_0xce31('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a830f,null))[_0xce31('0x27')](function(_0x546d83){if(_0x546d83){_0x1542e6=_0x546d83;_0x557668[_0xce31('0x32')]=_[_0xce31('0x48')](db[_0xce31('0x51')][_0xce31('0x30')]);_0x557668[_0xce31('0x33')]=_['keys'](_0x4e11ff['query']);_0x557668[_0xce31('0x3d')]=_[_0xce31('0x35')](_0x557668[_0xce31('0x32')],_0x557668[_0xce31('0x33')]);_0x49ddb4['attributes']=_[_0xce31('0x35')](_0x557668['model'],qs[_0xce31('0x36')](_0x4e11ff['query']['fields']));_0x49ddb4[_0xce31('0x34')]=_0x49ddb4[_0xce31('0x34')][_0xce31('0x37')]?_0x49ddb4['attributes']:_0x557668['model'];_0x49ddb4['order']=qs[_0xce31('0x3b')](_0x4e11ff['query'][_0xce31('0x3b')]);_0x49ddb4[_0xce31('0x3f')]=qs[_0xce31('0x3d')](_[_0xce31('0x3c')](_0x4e11ff[_0xce31('0x33')],_0x557668['filters']));if(_0x4e11ff['query']['filter']){_0x49ddb4[_0xce31('0x3f')]=_[_0xce31('0x41')](_0x49ddb4['where'],{'$or':_[_0xce31('0x2e')](_0x49ddb4['attributes'],function(_0x436977){var _0x488241={};_0x488241[_0x436977]={'$like':'%'+_0x4e11ff[_0xce31('0x33')][_0xce31('0x3e')]+'%'};return _0x488241;})});}_0x49ddb4=_['merge']({},_0x49ddb4,_0x4e11ff[_0xce31('0x42')]);return _0x1542e6[_0xce31('0x4f')](_0x49ddb4);}})[_0xce31('0x27')](function(_0x4235c5){if(_0x4235c5){_0x18661a=_0x4235c5[_0xce31('0x37')];if(!_0x4e11ff['query'][_0xce31('0x38')](_0xce31('0x39'))){_0x49ddb4[_0xce31('0x1f')]=qs[_0xce31('0x1f')](_0x4e11ff[_0xce31('0x33')]['limit']);_0x49ddb4['offset']=qs[_0xce31('0x20')](_0x4e11ff[_0xce31('0x33')][_0xce31('0x20')]);}return _0x1542e6[_0xce31('0x4f')](_0x49ddb4);}})[_0xce31('0x27')](function(_0x2a4b25){if(_0x2a4b25){return _0x2a4b25?{'count':_0x18661a,'rows':_0x2a4b25}:null;}})[_0xce31('0x27')](respondWithResult(_0x1a830f,null))[_0xce31('0x45')](handleError(_0x1a830f,null));};exports[_0xce31('0x52')]=function(_0x2ceea2,_0xd3e6ba,_0x3c816f){var _0x431ddd={};var _0x4c8db0={};var _0x34cbee;var _0x390305;return db[_0xce31('0x2f')][_0xce31('0x50')]({'where':{'id':_0x2ceea2['params']['id']}})[_0xce31('0x27')](handleEntityNotFound(_0xd3e6ba,null))[_0xce31('0x27')](function(_0x2a4935){if(_0x2a4935){_0x34cbee=_0x2a4935;_0x4c8db0[_0xce31('0x32')]=_['keys'](db['Tag'][_0xce31('0x30')]);_0x4c8db0[_0xce31('0x33')]=_[_0xce31('0x48')](_0x2ceea2[_0xce31('0x33')]);_0x4c8db0['filters']=_[_0xce31('0x35')](_0x4c8db0[_0xce31('0x32')],_0x4c8db0[_0xce31('0x33')]);_0x431ddd[_0xce31('0x34')]=_['intersection'](_0x4c8db0[_0xce31('0x32')],qs[_0xce31('0x36')](_0x2ceea2[_0xce31('0x33')][_0xce31('0x36')]));_0x431ddd[_0xce31('0x34')]=_0x431ddd[_0xce31('0x34')]['length']?_0x431ddd[_0xce31('0x34')]:_0x4c8db0['model'];_0x431ddd['order']=qs[_0xce31('0x3b')](_0x2ceea2[_0xce31('0x33')][_0xce31('0x3b')]);_0x431ddd[_0xce31('0x3f')]=qs[_0xce31('0x3d')](_[_0xce31('0x3c')](_0x2ceea2[_0xce31('0x33')],_0x4c8db0['filters']));if(_0x2ceea2[_0xce31('0x33')][_0xce31('0x3e')]){_0x431ddd['where']=_[_0xce31('0x41')](_0x431ddd[_0xce31('0x3f')],{'$or':_[_0xce31('0x2e')](_0x431ddd['attributes'],function(_0x26588e){var _0x3d0d12={};_0x3d0d12[_0x26588e]={'$like':'%'+_0x2ceea2[_0xce31('0x33')][_0xce31('0x3e')]+'%'};return _0x3d0d12;})});}_0x431ddd=_[_0xce31('0x41')]({},_0x431ddd,_0x2ceea2[_0xce31('0x42')]);return _0x34cbee[_0xce31('0x52')](_0x431ddd);}})['then'](function(_0x3ace98){if(_0x3ace98){_0x390305=_0x3ace98[_0xce31('0x37')];if(!_0x2ceea2[_0xce31('0x33')]['hasOwnProperty'](_0xce31('0x39'))){_0x431ddd[_0xce31('0x1f')]=qs[_0xce31('0x1f')](_0x2ceea2[_0xce31('0x33')]['limit']);_0x431ddd[_0xce31('0x20')]=qs[_0xce31('0x20')](_0x2ceea2[_0xce31('0x33')][_0xce31('0x20')]);}return _0x34cbee['getTags'](_0x431ddd);}})[_0xce31('0x27')](function(_0x54c008){if(_0x54c008){return _0x54c008?{'count':_0x390305,'rows':_0x54c008}:null;}})[_0xce31('0x27')](respondWithResult(_0xd3e6ba,null))[_0xce31('0x45')](handleError(_0xd3e6ba,null));};exports['setTags']=function(_0x15bd18,_0x1d136a,_0x3fb276){if(_0x15bd18[_0xce31('0x4c')]['id']){delete _0x15bd18[_0xce31('0x4c')]['id'];}return db[_0xce31('0x2f')]['findOne']({'where':{'id':_0x15bd18[_0xce31('0x47')]['id']}})[_0xce31('0x27')](handleEntityNotFound(_0x1d136a,null))[_0xce31('0x27')](function(_0x41ab2e){if(_0x41ab2e){return _0x41ab2e['setTags'](_0x15bd18['body'][_0xce31('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1d136a,null))[_0xce31('0x45')](handleError(_0x1d136a,null));}; \ No newline at end of file +var _0xd343=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','ZendeskConfiguration','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','destroy','getFields','findOne','length','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x2d8d81,_0x34a16c){var _0x3ad30e=function(_0x59df08){while(--_0x59df08){_0x2d8d81['push'](_0x2d8d81['shift']());}};_0x3ad30e(++_0x34a16c);}(_0xd343,0x197));var _0x3d34=function(_0x4865ad,_0x4b0f40){_0x4865ad=_0x4865ad-0x0;var _0x5d231e=_0xd343[_0x4865ad];return _0x5d231e;};'use strict';var emlformat=require(_0x3d34('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3d34('0x1'));var rp=require(_0x3d34('0x2'));var moment=require('moment');var BPromise=require(_0x3d34('0x3'));var Mustache=require('mustache');var util=require(_0x3d34('0x4'));var path=require(_0x3d34('0x5'));var sox=require(_0x3d34('0x6'));var csv=require(_0x3d34('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d34('0x8'));var squel=require(_0x3d34('0x9'));var crypto=require(_0x3d34('0xa'));var jsforce=require(_0x3d34('0xb'));var deskjs=require(_0x3d34('0xc'));var toCsv=require(_0x3d34('0x7'));var querystring=require(_0x3d34('0xd'));var Papa=require(_0x3d34('0xe'));var Redis=require(_0x3d34('0xf'));var authService=require(_0x3d34('0x10'));var qs=require(_0x3d34('0x11'));var as=require(_0x3d34('0x12'));var hardwareService=require(_0x3d34('0x13'));var logger=require('../../config/logger')(_0x3d34('0x14'));var utils=require(_0x3d34('0x15'));var config=require(_0x3d34('0x16'));var licenseUtil=require(_0x3d34('0x17'));var db=require(_0x3d34('0x18'))['db'];function respondWithStatusCode(_0xb18164,_0x22596c){_0x22596c=_0x22596c||0xcc;return function(_0x5c190c){if(_0x5c190c){return _0xb18164['sendStatus'](_0x22596c);}return _0xb18164[_0x3d34('0x19')](_0x22596c)[_0x3d34('0x1a')]();};}function respondWithResult(_0x30182c,_0x4f25f2){_0x4f25f2=_0x4f25f2||0xc8;return function(_0x350eb1){if(_0x350eb1){return _0x30182c[_0x3d34('0x19')](_0x4f25f2)[_0x3d34('0x1b')](_0x350eb1);}};}function respondWithFilteredResult(_0x894acd,_0x45f223){return function(_0x128584){if(_0x128584){var _0x1c5d6e=typeof _0x45f223[_0x3d34('0x1c')]===_0x3d34('0x1d')&&typeof _0x45f223['limit']===_0x3d34('0x1d');var _0x30a221=_0x128584[_0x3d34('0x1e')];var _0x136c50=_0x1c5d6e?0x0:_0x45f223[_0x3d34('0x1c')];var _0x5e54c7=_0x1c5d6e?_0x128584['count']:_0x45f223['offset']+_0x45f223[_0x3d34('0x1f')];var _0x12ddc1;if(_0x5e54c7>=_0x30a221){_0x5e54c7=_0x30a221;_0x12ddc1=0xc8;}else{_0x12ddc1=0xce;}_0x894acd['status'](_0x12ddc1);return _0x894acd['set'](_0x3d34('0x20'),_0x136c50+'-'+_0x5e54c7+'/'+_0x30a221)['json'](_0x128584);}return null;};}function patchUpdates(_0x357364){return function(_0x1ed117){try{jsonpatch[_0x3d34('0x21')](_0x1ed117,_0x357364,!![]);}catch(_0x5c25a1){return BPromise[_0x3d34('0x22')](_0x5c25a1);}return _0x1ed117[_0x3d34('0x23')]();};}function saveUpdates(_0x45586c,_0x3f0b81){return function(_0x36881f){if(_0x36881f){return _0x36881f[_0x3d34('0x24')](_0x45586c)[_0x3d34('0x25')](function(_0x34a934){return _0x34a934;});}return null;};}function removeEntity(_0x2fa80b,_0x3c141f){return function(_0x4e6ffe){if(_0x4e6ffe){return _0x4e6ffe['destroy']()['then'](function(){_0x2fa80b['status'](0xcc)[_0x3d34('0x1a')]();});}};}function handleEntityNotFound(_0x3ad487,_0x43ccd1){return function(_0x1d78eb){if(!_0x1d78eb){_0x3ad487[_0x3d34('0x26')](0x194);}return _0x1d78eb;};}function handleError(_0x193d2a,_0x46cb91){_0x46cb91=_0x46cb91||0x1f4;return function(_0x421ce8){logger[_0x3d34('0x27')](_0x421ce8[_0x3d34('0x28')]);if(_0x421ce8[_0x3d34('0x29')]){delete _0x421ce8[_0x3d34('0x29')];}_0x193d2a[_0x3d34('0x19')](_0x46cb91)['send'](_0x421ce8);};}exports[_0x3d34('0x2a')]=function(_0x51a9e2,_0x4e2e43){var _0xfcecad={},_0x50bf85={},_0x2e5873={'count':0x0,'rows':[]};var _0x706757=_[_0x3d34('0x2b')](db[_0x3d34('0x2c')]['rawAttributes'],function(_0x4920b3){return{'name':_0x4920b3[_0x3d34('0x2d')],'type':_0x4920b3[_0x3d34('0x2e')][_0x3d34('0x2f')]};});_0x50bf85['model']=_[_0x3d34('0x2b')](_0x706757,_0x3d34('0x29'));_0x50bf85[_0x3d34('0x30')]=_[_0x3d34('0x31')](_0x51a9e2[_0x3d34('0x30')]);_0x50bf85[_0x3d34('0x32')]=_[_0x3d34('0x33')](_0x50bf85['model'],_0x50bf85[_0x3d34('0x30')]);_0xfcecad[_0x3d34('0x34')]=_[_0x3d34('0x33')](_0x50bf85['model'],qs[_0x3d34('0x35')](_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x35')]));_0xfcecad['attributes']=_0xfcecad[_0x3d34('0x34')]['length']?_0xfcecad['attributes']:_0x50bf85[_0x3d34('0x36')];if(!_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x37')](_0x3d34('0x38'))){_0xfcecad['limit']=qs[_0x3d34('0x1f')](_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x1f')]);_0xfcecad[_0x3d34('0x1c')]=qs[_0x3d34('0x1c')](_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x1c')]);}_0xfcecad[_0x3d34('0x39')]=qs[_0x3d34('0x3a')](_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x3a')]);_0xfcecad[_0x3d34('0x3b')]=qs[_0x3d34('0x32')](_[_0x3d34('0x3c')](_0x51a9e2[_0x3d34('0x30')],_0x50bf85[_0x3d34('0x32')]),_0x706757);if(_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x3d')]){_0xfcecad[_0x3d34('0x3b')]=_[_0x3d34('0x3e')](_0xfcecad[_0x3d34('0x3b')],{'$or':_[_0x3d34('0x2b')](_0x706757,function(_0x4af3af){if(_0x4af3af[_0x3d34('0x2e')]!==_0x3d34('0x3f')){var _0x91196d={};_0x91196d[_0x4af3af['name']]={'$like':'%'+_0x51a9e2[_0x3d34('0x30')][_0x3d34('0x3d')]+'%'};return _0x91196d;}})});}_0xfcecad=_[_0x3d34('0x3e')]({},_0xfcecad,_0x51a9e2[_0x3d34('0x40')]);var _0x6d7825={'where':_0xfcecad['where']};return db['ZendeskConfiguration'][_0x3d34('0x1e')](_0x6d7825)[_0x3d34('0x25')](function(_0x380486){_0x2e5873['count']=_0x380486;if(_0x51a9e2['query'][_0x3d34('0x41')]){_0xfcecad['include']=[{'all':!![]}];}return db[_0x3d34('0x2c')][_0x3d34('0x42')](_0xfcecad);})[_0x3d34('0x25')](function(_0x14d823){_0x2e5873['rows']=_0x14d823;return _0x2e5873;})['then'](respondWithFilteredResult(_0x4e2e43,_0xfcecad))[_0x3d34('0x43')](handleError(_0x4e2e43,null));};exports['show']=function(_0x3e34b2,_0x15ea45){var _0x5733b9={'raw':![],'where':{'id':_0x3e34b2[_0x3d34('0x44')]['id']}},_0x1bb23c={};_0x1bb23c[_0x3d34('0x36')]=_[_0x3d34('0x31')](db['ZendeskConfiguration'][_0x3d34('0x45')]);_0x1bb23c[_0x3d34('0x30')]=_[_0x3d34('0x31')](_0x3e34b2[_0x3d34('0x30')]);_0x1bb23c[_0x3d34('0x32')]=_['intersection'](_0x1bb23c['model'],_0x1bb23c[_0x3d34('0x30')]);_0x5733b9[_0x3d34('0x34')]=_[_0x3d34('0x33')](_0x1bb23c['model'],qs['fields'](_0x3e34b2['query'][_0x3d34('0x35')]));_0x5733b9['attributes']=_0x5733b9[_0x3d34('0x34')]['length']?_0x5733b9[_0x3d34('0x34')]:_0x1bb23c['model'];if(_0x3e34b2[_0x3d34('0x30')][_0x3d34('0x41')]){_0x5733b9[_0x3d34('0x46')]=[{'all':!![]}];}_0x5733b9=_[_0x3d34('0x3e')]({},_0x5733b9,_0x3e34b2[_0x3d34('0x40')]);return db[_0x3d34('0x2c')][_0x3d34('0x47')](_0x5733b9)[_0x3d34('0x25')](handleEntityNotFound(_0x15ea45,null))[_0x3d34('0x25')](respondWithResult(_0x15ea45,null))[_0x3d34('0x43')](handleError(_0x15ea45,null));};exports['create']=function(_0x9488b7,_0xff7b8d){return db[_0x3d34('0x2c')][_0x3d34('0x48')](_0x9488b7[_0x3d34('0x49')],{})[_0x3d34('0x25')](respondWithResult(_0xff7b8d,0xc9))[_0x3d34('0x43')](handleError(_0xff7b8d,null));};exports['update']=function(_0x5cfd19,_0x55963d){if(_0x5cfd19['body']['id']){delete _0x5cfd19['body']['id'];}return db[_0x3d34('0x2c')][_0x3d34('0x47')]({'where':{'id':_0x5cfd19['params']['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x55963d,null))[_0x3d34('0x25')](saveUpdates(_0x5cfd19['body'],null))[_0x3d34('0x25')](respondWithResult(_0x55963d,null))[_0x3d34('0x43')](handleError(_0x55963d,null));};exports[_0x3d34('0x4a')]=function(_0x227756,_0xcd2361){return db['ZendeskConfiguration'][_0x3d34('0x47')]({'where':{'id':_0x227756[_0x3d34('0x44')]['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0xcd2361,null))[_0x3d34('0x25')](removeEntity(_0xcd2361,null))['catch'](handleError(_0xcd2361,null));};exports[_0x3d34('0x4b')]=function(_0x1e6cd9,_0x315671,_0x2e4dd9){var _0x115772={};var _0x126577={};var _0x1ade82;var _0xc04ae3;return db['ZendeskConfiguration'][_0x3d34('0x4c')]({'where':{'id':_0x1e6cd9[_0x3d34('0x44')]['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x315671,null))[_0x3d34('0x25')](function(_0x3a5698){if(_0x3a5698){_0x1ade82=_0x3a5698;_0x126577[_0x3d34('0x36')]=_[_0x3d34('0x31')](db['ZendeskField']['rawAttributes']);_0x126577[_0x3d34('0x30')]=_[_0x3d34('0x31')](_0x1e6cd9[_0x3d34('0x30')]);_0x126577[_0x3d34('0x32')]=_[_0x3d34('0x33')](_0x126577[_0x3d34('0x36')],_0x126577[_0x3d34('0x30')]);_0x115772[_0x3d34('0x34')]=_[_0x3d34('0x33')](_0x126577['model'],qs[_0x3d34('0x35')](_0x1e6cd9['query'][_0x3d34('0x35')]));_0x115772[_0x3d34('0x34')]=_0x115772['attributes'][_0x3d34('0x4d')]?_0x115772['attributes']:_0x126577[_0x3d34('0x36')];_0x115772[_0x3d34('0x39')]=qs[_0x3d34('0x3a')](_0x1e6cd9[_0x3d34('0x30')]['sort']);_0x115772['where']=qs[_0x3d34('0x32')](_[_0x3d34('0x3c')](_0x1e6cd9[_0x3d34('0x30')],_0x126577[_0x3d34('0x32')]));if(_0x1e6cd9[_0x3d34('0x30')]['filter']){_0x115772[_0x3d34('0x3b')]=_['merge'](_0x115772[_0x3d34('0x3b')],{'$or':_[_0x3d34('0x2b')](_0x115772[_0x3d34('0x34')],function(_0x3cd72f){var _0x552e32={};_0x552e32[_0x3cd72f]={'$like':'%'+_0x1e6cd9[_0x3d34('0x30')]['filter']+'%'};return _0x552e32;})});}_0x115772=_[_0x3d34('0x3e')]({},_0x115772,_0x1e6cd9[_0x3d34('0x40')]);return _0x1ade82[_0x3d34('0x4b')](_0x115772);}})[_0x3d34('0x25')](function(_0x22df87){if(_0x22df87){_0xc04ae3=_0x22df87[_0x3d34('0x4d')];if(!_0x1e6cd9[_0x3d34('0x30')][_0x3d34('0x37')]('nolimit')){_0x115772[_0x3d34('0x1f')]=qs[_0x3d34('0x1f')](_0x1e6cd9[_0x3d34('0x30')]['limit']);_0x115772[_0x3d34('0x1c')]=qs[_0x3d34('0x1c')](_0x1e6cd9[_0x3d34('0x30')]['offset']);}return _0x1ade82[_0x3d34('0x4b')](_0x115772);}})['then'](function(_0x9ae359){if(_0x9ae359){return _0x9ae359?{'count':_0xc04ae3,'rows':_0x9ae359}:null;}})[_0x3d34('0x25')](respondWithResult(_0x315671,null))['catch'](handleError(_0x315671,null));};exports[_0x3d34('0x4e')]=function(_0x4ce5df,_0x5b9edb,_0x4ac302){var _0x13b603={};var _0x2156bb={};var _0x13bc13;var _0x351eb8;return db[_0x3d34('0x2c')][_0x3d34('0x4c')]({'where':{'id':_0x4ce5df[_0x3d34('0x44')]['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x5b9edb,null))[_0x3d34('0x25')](function(_0x50d1bc){if(_0x50d1bc){_0x13bc13=_0x50d1bc;_0x2156bb[_0x3d34('0x36')]=_['keys'](db[_0x3d34('0x4f')][_0x3d34('0x45')]);_0x2156bb[_0x3d34('0x30')]=_['keys'](_0x4ce5df[_0x3d34('0x30')]);_0x2156bb[_0x3d34('0x32')]=_[_0x3d34('0x33')](_0x2156bb[_0x3d34('0x36')],_0x2156bb[_0x3d34('0x30')]);_0x13b603[_0x3d34('0x34')]=_[_0x3d34('0x33')](_0x2156bb[_0x3d34('0x36')],qs[_0x3d34('0x35')](_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x35')]));_0x13b603['attributes']=_0x13b603[_0x3d34('0x34')][_0x3d34('0x4d')]?_0x13b603[_0x3d34('0x34')]:_0x2156bb[_0x3d34('0x36')];_0x13b603['order']=qs['sort'](_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x3a')]);_0x13b603['where']=qs['filters'](_['pick'](_0x4ce5df[_0x3d34('0x30')],_0x2156bb[_0x3d34('0x32')]));if(_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x3d')]){_0x13b603[_0x3d34('0x3b')]=_[_0x3d34('0x3e')](_0x13b603[_0x3d34('0x3b')],{'$or':_[_0x3d34('0x2b')](_0x13b603[_0x3d34('0x34')],function(_0x74255c){var _0x42a3d1={};_0x42a3d1[_0x74255c]={'$like':'%'+_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x3d')]+'%'};return _0x42a3d1;})});}_0x13b603=_[_0x3d34('0x3e')]({},_0x13b603,_0x4ce5df[_0x3d34('0x40')]);return _0x13bc13[_0x3d34('0x4e')](_0x13b603);}})[_0x3d34('0x25')](function(_0x293a7d){if(_0x293a7d){_0x351eb8=_0x293a7d[_0x3d34('0x4d')];if(!_0x4ce5df['query'][_0x3d34('0x37')]('nolimit')){_0x13b603[_0x3d34('0x1f')]=qs[_0x3d34('0x1f')](_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x1f')]);_0x13b603[_0x3d34('0x1c')]=qs[_0x3d34('0x1c')](_0x4ce5df[_0x3d34('0x30')][_0x3d34('0x1c')]);}return _0x13bc13[_0x3d34('0x4e')](_0x13b603);}})[_0x3d34('0x25')](function(_0x21f1f3){if(_0x21f1f3){return _0x21f1f3?{'count':_0x351eb8,'rows':_0x21f1f3}:null;}})[_0x3d34('0x25')](respondWithResult(_0x5b9edb,null))[_0x3d34('0x43')](handleError(_0x5b9edb,null));};exports[_0x3d34('0x50')]=function(_0x3ef183,_0x4f41ac,_0x37deb3){var _0x355654={};var _0x42931b={};var _0x4ac874;var _0x2f0e6b;return db[_0x3d34('0x2c')][_0x3d34('0x4c')]({'where':{'id':_0x3ef183[_0x3d34('0x44')]['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x4f41ac,null))[_0x3d34('0x25')](function(_0x1c3500){if(_0x1c3500){_0x4ac874=_0x1c3500;_0x42931b[_0x3d34('0x36')]=_[_0x3d34('0x31')](db[_0x3d34('0x4f')][_0x3d34('0x45')]);_0x42931b['query']=_['keys'](_0x3ef183[_0x3d34('0x30')]);_0x42931b[_0x3d34('0x32')]=_[_0x3d34('0x33')](_0x42931b[_0x3d34('0x36')],_0x42931b[_0x3d34('0x30')]);_0x355654[_0x3d34('0x34')]=_[_0x3d34('0x33')](_0x42931b[_0x3d34('0x36')],qs[_0x3d34('0x35')](_0x3ef183[_0x3d34('0x30')][_0x3d34('0x35')]));_0x355654['attributes']=_0x355654[_0x3d34('0x34')][_0x3d34('0x4d')]?_0x355654['attributes']:_0x42931b[_0x3d34('0x36')];_0x355654[_0x3d34('0x39')]=qs['sort'](_0x3ef183[_0x3d34('0x30')][_0x3d34('0x3a')]);_0x355654[_0x3d34('0x3b')]=qs[_0x3d34('0x32')](_['pick'](_0x3ef183['query'],_0x42931b[_0x3d34('0x32')]));if(_0x3ef183[_0x3d34('0x30')][_0x3d34('0x3d')]){_0x355654[_0x3d34('0x3b')]=_[_0x3d34('0x3e')](_0x355654['where'],{'$or':_['map'](_0x355654['attributes'],function(_0x329bb7){var _0x37d567={};_0x37d567[_0x329bb7]={'$like':'%'+_0x3ef183[_0x3d34('0x30')][_0x3d34('0x3d')]+'%'};return _0x37d567;})});}_0x355654=_[_0x3d34('0x3e')]({},_0x355654,_0x3ef183['options']);return _0x4ac874['getDescriptions'](_0x355654);}})[_0x3d34('0x25')](function(_0x170c8c){if(_0x170c8c){_0x2f0e6b=_0x170c8c['length'];if(!_0x3ef183[_0x3d34('0x30')][_0x3d34('0x37')](_0x3d34('0x38'))){_0x355654['limit']=qs[_0x3d34('0x1f')](_0x3ef183[_0x3d34('0x30')]['limit']);_0x355654[_0x3d34('0x1c')]=qs[_0x3d34('0x1c')](_0x3ef183[_0x3d34('0x30')][_0x3d34('0x1c')]);}return _0x4ac874[_0x3d34('0x50')](_0x355654);}})[_0x3d34('0x25')](function(_0x491312){if(_0x491312){return _0x491312?{'count':_0x2f0e6b,'rows':_0x491312}:null;}})[_0x3d34('0x25')](respondWithResult(_0x4f41ac,null))[_0x3d34('0x43')](handleError(_0x4f41ac,null));};exports[_0x3d34('0x51')]=function(_0xaabd5b,_0x5564bc,_0x1447d7){var _0x52b56a={};var _0xfd7a48={};var _0x4afe6e;var _0x247bf0;return db[_0x3d34('0x2c')][_0x3d34('0x4c')]({'where':{'id':_0xaabd5b[_0x3d34('0x44')]['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x5564bc,null))[_0x3d34('0x25')](function(_0x22e837){if(_0x22e837){_0x4afe6e=_0x22e837;_0xfd7a48[_0x3d34('0x36')]=_[_0x3d34('0x31')](db[_0x3d34('0x52')][_0x3d34('0x45')]);_0xfd7a48[_0x3d34('0x30')]=_[_0x3d34('0x31')](_0xaabd5b[_0x3d34('0x30')]);_0xfd7a48[_0x3d34('0x32')]=_['intersection'](_0xfd7a48['model'],_0xfd7a48['query']);_0x52b56a['attributes']=_[_0x3d34('0x33')](_0xfd7a48[_0x3d34('0x36')],qs[_0x3d34('0x35')](_0xaabd5b[_0x3d34('0x30')][_0x3d34('0x35')]));_0x52b56a['attributes']=_0x52b56a[_0x3d34('0x34')][_0x3d34('0x4d')]?_0x52b56a[_0x3d34('0x34')]:_0xfd7a48['model'];_0x52b56a['order']=qs[_0x3d34('0x3a')](_0xaabd5b['query'][_0x3d34('0x3a')]);_0x52b56a[_0x3d34('0x3b')]=qs[_0x3d34('0x32')](_[_0x3d34('0x3c')](_0xaabd5b[_0x3d34('0x30')],_0xfd7a48[_0x3d34('0x32')]));if(_0xaabd5b[_0x3d34('0x30')]['filter']){_0x52b56a[_0x3d34('0x3b')]=_[_0x3d34('0x3e')](_0x52b56a[_0x3d34('0x3b')],{'$or':_[_0x3d34('0x2b')](_0x52b56a[_0x3d34('0x34')],function(_0x1be685){var _0xe4a0d={};_0xe4a0d[_0x1be685]={'$like':'%'+_0xaabd5b[_0x3d34('0x30')][_0x3d34('0x3d')]+'%'};return _0xe4a0d;})});}_0x52b56a=_['merge']({},_0x52b56a,_0xaabd5b['options']);return _0x4afe6e['getTags'](_0x52b56a);}})[_0x3d34('0x25')](function(_0xc674e7){if(_0xc674e7){_0x247bf0=_0xc674e7[_0x3d34('0x4d')];if(!_0xaabd5b[_0x3d34('0x30')][_0x3d34('0x37')]('nolimit')){_0x52b56a[_0x3d34('0x1f')]=qs[_0x3d34('0x1f')](_0xaabd5b[_0x3d34('0x30')][_0x3d34('0x1f')]);_0x52b56a[_0x3d34('0x1c')]=qs['offset'](_0xaabd5b[_0x3d34('0x30')]['offset']);}return _0x4afe6e['getTags'](_0x52b56a);}})[_0x3d34('0x25')](function(_0x2bf2c2){if(_0x2bf2c2){return _0x2bf2c2?{'count':_0x247bf0,'rows':_0x2bf2c2}:null;}})['then'](respondWithResult(_0x5564bc,null))[_0x3d34('0x43')](handleError(_0x5564bc,null));};exports[_0x3d34('0x53')]=function(_0xb0b0b5,_0x5035e3,_0x50290d){if(_0xb0b0b5[_0x3d34('0x49')]['id']){delete _0xb0b0b5['body']['id'];}return db[_0x3d34('0x2c')][_0x3d34('0x4c')]({'where':{'id':_0xb0b0b5['params']['id']}})[_0x3d34('0x25')](handleEntityNotFound(_0x5035e3,null))[_0x3d34('0x25')](function(_0x2fd92e){if(_0x2fd92e){return _0x2fd92e[_0x3d34('0x53')](_0xb0b0b5[_0x3d34('0x49')][_0x3d34('0x54')]||[]);}return null;})[_0x3d34('0x25')](respondWithResult(_0x5035e3,null))[_0x3d34('0x43')](handleError(_0x5035e3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ec533ba..7b4ec88 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 _0xdd4f=['exports','define','ZendeskConfiguration','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x48e683,_0x398f00){_0x48e683=_0x48e683-0x0;var _0x4b1382=_0xdd4f[_0x48e683];return _0x4b1382;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fa=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x3770c8,_0x4c3e51){var _0x33d6ff=function(_0x5e1f08){while(--_0x5e1f08){_0x3770c8['push'](_0x3770c8['shift']());}};_0x33d6ff(++_0x4c3e51);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x17d2cc,_0xed435){_0x17d2cc=_0x17d2cc-0x0;var _0x3e27ed=_0xa5fa[_0x17d2cc];return _0x3e27ed;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var logger=require(_0xaa5f('0x1'))(_0xaa5f('0x2'));var moment=require(_0xaa5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xaa5f('0x4'));var fs=require('fs');var path=require(_0xaa5f('0x5'));var rimraf=require('rimraf');var config=require(_0xaa5f('0x6'));var attributes=require(_0xaa5f('0x7'));module[_0xaa5f('0x8')]=function(_0x20744d,_0x3d1489){return _0x20744d[_0xaa5f('0x9')](_0xaa5f('0xa'),attributes,{'tableName':_0xaa5f('0xb'),'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 cc2ced1..876795c 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 _0x9382=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x9382,0x19c));var _0x2938=function(_0x25ce63,_0x15c419){_0x25ce63=_0x25ce63-0x0;var _0x30a93b=_0x9382[_0x25ce63];return _0x30a93b;};'use strict';var _=require(_0x2938('0x0'));var util=require(_0x2938('0x1'));var moment=require(_0x2938('0x2'));var BPromise=require(_0x2938('0x3'));var rs=require(_0x2938('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2938('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2938('0x6'))(_0x2938('0x7'));var config=require(_0x2938('0x8'));var jayson=require(_0x2938('0x9'));var client=jayson[_0x2938('0xa')][_0x2938('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22aba1,_0x29b069,_0x54dfe0){return new BPromise(function(_0x500876,_0x2dc712){return client[_0x2938('0xc')](_0x22aba1,_0x54dfe0)[_0x2938('0xd')](function(_0x4daf4d){logger[_0x2938('0xe')](_0x2938('0xf'),_0x29b069,_0x2938('0x10'));logger['debug'](_0x2938('0x11'),_0x29b069,_0x2938('0x10'),JSON[_0x2938('0x12')](_0x4daf4d));if(_0x4daf4d['error']){if(_0x4daf4d[_0x2938('0x13')][_0x2938('0x14')]===0x1f4){logger[_0x2938('0x13')](_0x2938('0xf'),_0x29b069,_0x4daf4d['error'][_0x2938('0x15')]);return _0x2dc712(_0x4daf4d[_0x2938('0x13')]['message']);}logger[_0x2938('0x13')](_0x2938('0xf'),_0x29b069,_0x4daf4d['error'][_0x2938('0x15')]);return _0x500876(_0x4daf4d['error'][_0x2938('0x15')]);}else{logger[_0x2938('0xe')](_0x2938('0xf'),_0x29b069,_0x2938('0x10'));_0x500876(_0x4daf4d[_0x2938('0x16')][_0x2938('0x15')]);}})[_0x2938('0x17')](function(_0x2ff5f3){logger[_0x2938('0x13')](_0x2938('0xf'),_0x29b069,_0x2ff5f3);_0x2dc712(_0x2ff5f3);});});} \ No newline at end of file +var _0xab91=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x327121,_0x3e97a7){var _0x2b81da=function(_0x2fae4c){while(--_0x2fae4c){_0x327121['push'](_0x327121['shift']());}};_0x2b81da(++_0x3e97a7);}(_0xab91,0x1ad));var _0x1ab9=function(_0x4dca4f,_0x3d3989){_0x4dca4f=_0x4dca4f-0x0;var _0xb1f24e=_0xab91[_0x4dca4f];return _0xb1f24e;};'use strict';var _=require(_0x1ab9('0x0'));var util=require(_0x1ab9('0x1'));var moment=require(_0x1ab9('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ab9('0x3'));var fs=require('fs');var Redis=require(_0x1ab9('0x4'));var db=require(_0x1ab9('0x5'))['db'];var utils=require(_0x1ab9('0x6'));var logger=require(_0x1ab9('0x7'))(_0x1ab9('0x8'));var config=require(_0x1ab9('0x9'));var jayson=require(_0x1ab9('0xa'));var client=jayson[_0x1ab9('0xb')][_0x1ab9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1bdce7,_0x50eb20,_0x11a6a0){return new BPromise(function(_0x3b0d6e,_0x4e13bf){return client[_0x1ab9('0xd')](_0x1bdce7,_0x11a6a0)[_0x1ab9('0xe')](function(_0x338307){logger[_0x1ab9('0xf')](_0x1ab9('0x10'),_0x50eb20,'request\x20sent');logger[_0x1ab9('0x11')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50eb20,_0x1ab9('0x12'),JSON['stringify'](_0x338307));if(_0x338307['error']){if(_0x338307[_0x1ab9('0x13')][_0x1ab9('0x14')]===0x1f4){logger[_0x1ab9('0x13')](_0x1ab9('0x10'),_0x50eb20,_0x338307[_0x1ab9('0x13')][_0x1ab9('0x15')]);return _0x4e13bf(_0x338307[_0x1ab9('0x13')][_0x1ab9('0x15')]);}logger[_0x1ab9('0x13')](_0x1ab9('0x10'),_0x50eb20,_0x338307[_0x1ab9('0x13')][_0x1ab9('0x15')]);return _0x3b0d6e(_0x338307[_0x1ab9('0x13')][_0x1ab9('0x15')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x50eb20,_0x1ab9('0x12'));_0x3b0d6e(_0x338307['result'][_0x1ab9('0x15')]);}})[_0x1ab9('0x16')](function(_0x421a85){logger[_0x1ab9('0x13')](_0x1ab9('0x10'),_0x50eb20,_0x421a85);_0x4e13bf(_0x421a85);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2764362..5c3bd19 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 _0x349d=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x1c7a99,_0x411a45){var _0x2ea3a8=function(_0x53b353){while(--_0x53b353){_0x1c7a99['push'](_0x1c7a99['shift']());}};_0x2ea3a8(++_0x411a45);}(_0x349d,0x1ea));var _0xd349=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x349d[_0x19ef2b];return _0x4df537;};'use strict';var multer=require(_0xd349('0x0'));var util=require(_0xd349('0x1'));var path=require('path');var timeout=require(_0xd349('0x2'));var express=require(_0xd349('0x3'));var router=express[_0xd349('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd349('0x5'));var interaction=require(_0xd349('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xd349('0x7')]('/',auth['isAuthenticated'](),controller[_0xd349('0x8')]);router[_0xd349('0x7')](_0xd349('0x9'),auth[_0xd349('0xa')](),controller[_0xd349('0xb')]);router[_0xd349('0xc')]('/',auth[_0xd349('0xa')](),controller['create']);router[_0xd349('0xd')]('/:id',auth[_0xd349('0xa')](),controller[_0xd349('0xe')]);router[_0xd349('0xf')](_0xd349('0x9'),auth[_0xd349('0xa')](),controller[_0xd349('0x10')]);module[_0xd349('0x11')]=router; \ No newline at end of file +var _0x086a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x2cde59,_0x15e1aa){var _0x428a2d=function(_0x21a2da){while(--_0x21a2da){_0x2cde59['push'](_0x2cde59['shift']());}};_0x428a2d(++_0x15e1aa);}(_0x086a,0x1e3));var _0xa086=function(_0x259148,_0x49468d){_0x259148=_0x259148-0x0;var _0x1716c5=_0x086a[_0x259148];return _0x1716c5;};'use strict';var multer=require(_0xa086('0x0'));var util=require('util');var path=require(_0xa086('0x1'));var timeout=require(_0xa086('0x2'));var express=require(_0xa086('0x3'));var router=express[_0xa086('0x4')]();var fs_extra=require(_0xa086('0x5'));var auth=require(_0xa086('0x6'));var interaction=require(_0xa086('0x7'));var config=require(_0xa086('0x8'));var controller=require(_0xa086('0x9'));router[_0xa086('0xa')]('/',auth[_0xa086('0xb')](),controller['index']);router[_0xa086('0xa')](_0xa086('0xc'),auth['isAuthenticated'](),controller[_0xa086('0xd')]);router['post']('/',auth[_0xa086('0xb')](),controller[_0xa086('0xe')]);router[_0xa086('0xf')](_0xa086('0xc'),auth[_0xa086('0xb')](),controller['update']);router[_0xa086('0x10')](_0xa086('0xc'),auth[_0xa086('0xb')](),controller[_0xa086('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6f740ce..9721de9 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 _0xdbb6=['sequelize','exports','ENUM','string','STRING','variable','customVariable','BOOLEAN'];(function(_0x2fa15e,_0x10f0b6){var _0x30c934=function(_0x4204d3){while(--_0x4204d3){_0x2fa15e['push'](_0x2fa15e['shift']());}};_0x30c934(++_0x10f0b6);}(_0xdbb6,0x110));var _0x6dbb=function(_0x169e88,_0x9f4c1f){_0x169e88=_0x169e88-0x0;var _0x56bbd8=_0xdbb6[_0x169e88];return _0x56bbd8;};'use strict';var Sequelize=require(_0x6dbb('0x0'));module[_0x6dbb('0x1')]={'type':{'type':Sequelize[_0x6dbb('0x2')](_0x6dbb('0x3'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0x6dbb('0x3')},'content':{'type':Sequelize[_0x6dbb('0x4')]},'key':{'type':Sequelize[_0x6dbb('0x4')]},'keyType':{'type':Sequelize[_0x6dbb('0x2')](_0x6dbb('0x3'),_0x6dbb('0x5'),_0x6dbb('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6dbb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6dbb('0x4')]}}; \ No newline at end of file +var _0xa475=['BOOLEAN','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x1668e0,_0x3330be){var _0x441291=function(_0xfbe03d){while(--_0xfbe03d){_0x1668e0['push'](_0x1668e0['shift']());}};_0x441291(++_0x3330be);}(_0xa475,0x12e));var _0x5a47=function(_0x563627,_0x2ccbd7){_0x563627=_0x563627-0x0;var _0x59bc3e=_0xa475[_0x563627];return _0x59bc3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5a47('0x0')](_0x5a47('0x1'),_0x5a47('0x2'),_0x5a47('0x3'),'keyValue',_0x5a47('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a47('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x5a47('0x1'),_0x5a47('0x2'),_0x5a47('0x3'))},'keyContent':{'type':Sequelize[_0x5a47('0x5')]},'idField':{'type':Sequelize[_0x5a47('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5a47('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a47('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index bbac9cf..93068e6 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 _0x93ea=['include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x26b3cf,_0x47ea38){var _0x4a009d=function(_0x46cf05){while(--_0x46cf05){_0x26b3cf['push'](_0x26b3cf['shift']());}};_0x4a009d(++_0x47ea38);}(_0x93ea,0x131));var _0xa93e=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0x93ea[_0x5bc5fe];return _0x298ea7;};'use strict';var emlformat=require(_0xa93e('0x0'));var rimraf=require(_0xa93e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa93e('0x2'));var rp=require(_0xa93e('0x3'));var moment=require('moment');var BPromise=require(_0xa93e('0x4'));var Mustache=require(_0xa93e('0x5'));var util=require(_0xa93e('0x6'));var path=require(_0xa93e('0x7'));var sox=require(_0xa93e('0x8'));var csv=require(_0xa93e('0x9'));var ejs=require(_0xa93e('0xa'));var fs=require('fs');var fs_extra=require(_0xa93e('0xb'));var _=require(_0xa93e('0xc'));var squel=require(_0xa93e('0xd'));var crypto=require(_0xa93e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa93e('0xf'));var toCsv=require(_0xa93e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa93e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa93e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa93e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xa93e('0x13'));var config=require(_0xa93e('0x14'));var licenseUtil=require(_0xa93e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x414eab,_0x2c0be3){_0x2c0be3=_0x2c0be3||0xcc;return function(_0x1915ff){if(_0x1915ff){return _0x414eab[_0xa93e('0x16')](_0x2c0be3);}return _0x414eab['status'](_0x2c0be3)[_0xa93e('0x17')]();};}function respondWithResult(_0x5dfc7d,_0x4b801c){_0x4b801c=_0x4b801c||0xc8;return function(_0x5cc5b2){if(_0x5cc5b2){return _0x5dfc7d[_0xa93e('0x18')](_0x4b801c)[_0xa93e('0x19')](_0x5cc5b2);}};}function respondWithFilteredResult(_0x3cdbe3,_0x343a83){return function(_0x3a0f6e){if(_0x3a0f6e){var _0x48aa10=typeof _0x343a83[_0xa93e('0x1a')]===_0xa93e('0x1b')&&typeof _0x343a83[_0xa93e('0x1c')]==='undefined';var _0x3e0be0=_0x3a0f6e[_0xa93e('0x1d')];var _0xbae991=_0x48aa10?0x0:_0x343a83['offset'];var _0x1e3bc2=_0x48aa10?_0x3a0f6e['count']:_0x343a83['offset']+_0x343a83[_0xa93e('0x1c')];var _0xa82fde;if(_0x1e3bc2>=_0x3e0be0){_0x1e3bc2=_0x3e0be0;_0xa82fde=0xc8;}else{_0xa82fde=0xce;}_0x3cdbe3[_0xa93e('0x18')](_0xa82fde);return _0x3cdbe3[_0xa93e('0x1e')](_0xa93e('0x1f'),_0xbae991+'-'+_0x1e3bc2+'/'+_0x3e0be0)[_0xa93e('0x19')](_0x3a0f6e);}return null;};}function patchUpdates(_0x8e99ba){return function(_0x3c9aca){try{jsonpatch['apply'](_0x3c9aca,_0x8e99ba,!![]);}catch(_0x2b73a6){return BPromise[_0xa93e('0x20')](_0x2b73a6);}return _0x3c9aca[_0xa93e('0x21')]();};}function saveUpdates(_0x3c99b9,_0x235273){return function(_0x5915f6){if(_0x5915f6){return _0x5915f6[_0xa93e('0x22')](_0x3c99b9)[_0xa93e('0x23')](function(_0x42aa9b){return _0x42aa9b;});}return null;};}function removeEntity(_0x5dafd6,_0x13ca26){return function(_0x344dcc){if(_0x344dcc){return _0x344dcc[_0xa93e('0x24')]()['then'](function(){_0x5dafd6['status'](0xcc)[_0xa93e('0x17')]();});}};}function handleEntityNotFound(_0x407920,_0x5e2a09){return function(_0x58f24a){if(!_0x58f24a){_0x407920['sendStatus'](0x194);}return _0x58f24a;};}function handleError(_0x902cda,_0x384c6f){_0x384c6f=_0x384c6f||0x1f4;return function(_0x2e72da){logger[_0xa93e('0x25')](_0x2e72da[_0xa93e('0x26')]);if(_0x2e72da[_0xa93e('0x27')]){delete _0x2e72da[_0xa93e('0x27')];}_0x902cda['status'](_0x384c6f)[_0xa93e('0x28')](_0x2e72da);};}exports[_0xa93e('0x29')]=function(_0x5023af,_0x334e62){var _0x464ec5={},_0x2f3c3e={},_0x5cef20={'count':0x0,'rows':[]};var _0x429c9c=_[_0xa93e('0x2a')](db[_0xa93e('0x2b')][_0xa93e('0x2c')],function(_0x3ecb5b){return{'name':_0x3ecb5b[_0xa93e('0x2d')],'type':_0x3ecb5b['type']['key']};});_0x2f3c3e[_0xa93e('0x2e')]=_[_0xa93e('0x2a')](_0x429c9c,_0xa93e('0x27'));_0x2f3c3e[_0xa93e('0x2f')]=_[_0xa93e('0x30')](_0x5023af[_0xa93e('0x2f')]);_0x2f3c3e['filters']=_[_0xa93e('0x31')](_0x2f3c3e[_0xa93e('0x2e')],_0x2f3c3e[_0xa93e('0x2f')]);_0x464ec5[_0xa93e('0x32')]=_[_0xa93e('0x31')](_0x2f3c3e[_0xa93e('0x2e')],qs['fields'](_0x5023af[_0xa93e('0x2f')][_0xa93e('0x33')]));_0x464ec5[_0xa93e('0x32')]=_0x464ec5[_0xa93e('0x32')][_0xa93e('0x34')]?_0x464ec5[_0xa93e('0x32')]:_0x2f3c3e['model'];if(!_0x5023af['query'][_0xa93e('0x35')](_0xa93e('0x36'))){_0x464ec5[_0xa93e('0x1c')]=qs['limit'](_0x5023af[_0xa93e('0x2f')]['limit']);_0x464ec5[_0xa93e('0x1a')]=qs[_0xa93e('0x1a')](_0x5023af[_0xa93e('0x2f')][_0xa93e('0x1a')]);}_0x464ec5[_0xa93e('0x37')]=qs[_0xa93e('0x38')](_0x5023af['query'][_0xa93e('0x38')]);_0x464ec5[_0xa93e('0x39')]=qs[_0xa93e('0x3a')](_[_0xa93e('0x3b')](_0x5023af['query'],_0x2f3c3e[_0xa93e('0x3a')]),_0x429c9c);if(_0x5023af[_0xa93e('0x2f')][_0xa93e('0x3c')]){_0x464ec5[_0xa93e('0x39')]=_[_0xa93e('0x3d')](_0x464ec5['where'],{'$or':_[_0xa93e('0x2a')](_0x429c9c,function(_0x18702c){if(_0x18702c[_0xa93e('0x3e')]!==_0xa93e('0x3f')){var _0x42d470={};_0x42d470[_0x18702c[_0xa93e('0x27')]]={'$like':'%'+_0x5023af[_0xa93e('0x2f')][_0xa93e('0x3c')]+'%'};return _0x42d470;}})});}_0x464ec5=_[_0xa93e('0x3d')]({},_0x464ec5,_0x5023af['options']);var _0x2c1977={'where':_0x464ec5['where']};return db[_0xa93e('0x2b')][_0xa93e('0x1d')](_0x2c1977)[_0xa93e('0x23')](function(_0x25bb85){_0x5cef20[_0xa93e('0x1d')]=_0x25bb85;if(_0x5023af['query'][_0xa93e('0x40')]){_0x464ec5[_0xa93e('0x41')]=[{'all':!![]}];}return db[_0xa93e('0x2b')][_0xa93e('0x42')](_0x464ec5);})[_0xa93e('0x23')](function(_0x52fe67){_0x5cef20['rows']=_0x52fe67;return _0x5cef20;})[_0xa93e('0x23')](respondWithFilteredResult(_0x334e62,_0x464ec5))[_0xa93e('0x43')](handleError(_0x334e62,null));};exports[_0xa93e('0x44')]=function(_0x48d7a9,_0x176ae4){var _0x148b88={'raw':!![],'where':{'id':_0x48d7a9[_0xa93e('0x45')]['id']}},_0x1d923f={};_0x1d923f[_0xa93e('0x2e')]=_['keys'](db[_0xa93e('0x2b')][_0xa93e('0x2c')]);_0x1d923f[_0xa93e('0x2f')]=_[_0xa93e('0x30')](_0x48d7a9[_0xa93e('0x2f')]);_0x1d923f[_0xa93e('0x3a')]=_[_0xa93e('0x31')](_0x1d923f[_0xa93e('0x2e')],_0x1d923f[_0xa93e('0x2f')]);_0x148b88[_0xa93e('0x32')]=_[_0xa93e('0x31')](_0x1d923f[_0xa93e('0x2e')],qs[_0xa93e('0x33')](_0x48d7a9[_0xa93e('0x2f')]['fields']));_0x148b88['attributes']=_0x148b88['attributes'][_0xa93e('0x34')]?_0x148b88[_0xa93e('0x32')]:_0x1d923f['model'];if(_0x48d7a9[_0xa93e('0x2f')]['includeAll']){_0x148b88['include']=[{'all':!![]}];}_0x148b88=_[_0xa93e('0x3d')]({},_0x148b88,_0x48d7a9[_0xa93e('0x46')]);return db[_0xa93e('0x2b')][_0xa93e('0x47')](_0x148b88)[_0xa93e('0x23')](handleEntityNotFound(_0x176ae4,null))[_0xa93e('0x23')](respondWithResult(_0x176ae4,null))[_0xa93e('0x43')](handleError(_0x176ae4,null));};exports[_0xa93e('0x48')]=function(_0x416f4f,_0x545ffe){return db[_0xa93e('0x2b')][_0xa93e('0x48')](_0x416f4f[_0xa93e('0x49')],{})[_0xa93e('0x23')](respondWithResult(_0x545ffe,0xc9))[_0xa93e('0x43')](handleError(_0x545ffe,null));};exports[_0xa93e('0x22')]=function(_0x44ac5f,_0x57582b){if(_0x44ac5f['body']['id']){delete _0x44ac5f[_0xa93e('0x49')]['id'];}return db[_0xa93e('0x2b')][_0xa93e('0x47')]({'where':{'id':_0x44ac5f[_0xa93e('0x45')]['id']}})[_0xa93e('0x23')](handleEntityNotFound(_0x57582b,null))[_0xa93e('0x23')](saveUpdates(_0x44ac5f['body'],null))['then'](respondWithResult(_0x57582b,null))[_0xa93e('0x43')](handleError(_0x57582b,null));};exports[_0xa93e('0x24')]=function(_0x5bbf01,_0x143318){return db[_0xa93e('0x2b')][_0xa93e('0x47')]({'where':{'id':_0x5bbf01[_0xa93e('0x45')]['id']}})[_0xa93e('0x23')](handleEntityNotFound(_0x143318,null))[_0xa93e('0x23')](removeEntity(_0x143318,null))[_0xa93e('0x43')](handleError(_0x143318,null));}; \ No newline at end of file +var _0xc975=['query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','catch','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','ZendeskField','rawAttributes','fieldName','type'];(function(_0x487105,_0x371cba){var _0x841de1=function(_0xb72554){while(--_0xb72554){_0x487105['push'](_0x487105['shift']());}};_0x841de1(++_0x371cba);}(_0xc975,0x1ce));var _0x5c97=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc975[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x5c97('0x0'));var rimraf=require(_0x5c97('0x1'));var zipdir=require(_0x5c97('0x2'));var jsonpatch=require(_0x5c97('0x3'));var rp=require(_0x5c97('0x4'));var moment=require(_0x5c97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5c97('0x6'));var util=require(_0x5c97('0x7'));var path=require(_0x5c97('0x8'));var sox=require(_0x5c97('0x9'));var csv=require(_0x5c97('0xa'));var ejs=require(_0x5c97('0xb'));var fs=require('fs');var fs_extra=require(_0x5c97('0xc'));var _=require(_0x5c97('0xd'));var squel=require(_0x5c97('0xe'));var crypto=require(_0x5c97('0xf'));var jsforce=require(_0x5c97('0x10'));var deskjs=require(_0x5c97('0x11'));var toCsv=require(_0x5c97('0xa'));var querystring=require(_0x5c97('0x12'));var Papa=require(_0x5c97('0x13'));var Redis=require('ioredis');var authService=require(_0x5c97('0x14'));var qs=require(_0x5c97('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c97('0x16'));var logger=require(_0x5c97('0x17'))('api');var utils=require(_0x5c97('0x18'));var config=require(_0x5c97('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2746f9,_0x36a4c7){_0x36a4c7=_0x36a4c7||0xcc;return function(_0x4fa803){if(_0x4fa803){return _0x2746f9[_0x5c97('0x1a')](_0x36a4c7);}return _0x2746f9[_0x5c97('0x1b')](_0x36a4c7)[_0x5c97('0x1c')]();};}function respondWithResult(_0x317eda,_0x39ae7e){_0x39ae7e=_0x39ae7e||0xc8;return function(_0x534184){if(_0x534184){return _0x317eda[_0x5c97('0x1b')](_0x39ae7e)[_0x5c97('0x1d')](_0x534184);}};}function respondWithFilteredResult(_0x119764,_0x4ff0ee){return function(_0x541017){if(_0x541017){var _0x4f3ee2=typeof _0x4ff0ee[_0x5c97('0x1e')]===_0x5c97('0x1f')&&typeof _0x4ff0ee[_0x5c97('0x20')]==='undefined';var _0x4c7085=_0x541017['count'];var _0x576a35=_0x4f3ee2?0x0:_0x4ff0ee['offset'];var _0x1d3623=_0x4f3ee2?_0x541017[_0x5c97('0x21')]:_0x4ff0ee['offset']+_0x4ff0ee['limit'];var _0x20b643;if(_0x1d3623>=_0x4c7085){_0x1d3623=_0x4c7085;_0x20b643=0xc8;}else{_0x20b643=0xce;}_0x119764['status'](_0x20b643);return _0x119764['set'](_0x5c97('0x22'),_0x576a35+'-'+_0x1d3623+'/'+_0x4c7085)[_0x5c97('0x1d')](_0x541017);}return null;};}function patchUpdates(_0x580df6){return function(_0x12c01c){try{jsonpatch[_0x5c97('0x23')](_0x12c01c,_0x580df6,!![]);}catch(_0x9742bc){return BPromise[_0x5c97('0x24')](_0x9742bc);}return _0x12c01c[_0x5c97('0x25')]();};}function saveUpdates(_0x4b1abd,_0x20b915){return function(_0x10158c){if(_0x10158c){return _0x10158c[_0x5c97('0x26')](_0x4b1abd)[_0x5c97('0x27')](function(_0x451e1e){return _0x451e1e;});}return null;};}function removeEntity(_0x44481f,_0x1fe864){return function(_0x2223be){if(_0x2223be){return _0x2223be[_0x5c97('0x28')]()['then'](function(){_0x44481f[_0x5c97('0x1b')](0xcc)[_0x5c97('0x1c')]();});}};}function handleEntityNotFound(_0x2dbffc,_0xdb9d34){return function(_0x15d4d8){if(!_0x15d4d8){_0x2dbffc[_0x5c97('0x1a')](0x194);}return _0x15d4d8;};}function handleError(_0x384795,_0x46b0fd){_0x46b0fd=_0x46b0fd||0x1f4;return function(_0x536551){logger['error'](_0x536551['stack']);if(_0x536551[_0x5c97('0x29')]){delete _0x536551[_0x5c97('0x29')];}_0x384795[_0x5c97('0x1b')](_0x46b0fd)[_0x5c97('0x2a')](_0x536551);};}exports[_0x5c97('0x2b')]=function(_0x30742a,_0x54287b){var _0x7d4021={},_0x431e3a={},_0x321150={'count':0x0,'rows':[]};var _0x41c0b6=_[_0x5c97('0x2c')](db[_0x5c97('0x2d')][_0x5c97('0x2e')],function(_0x451003){return{'name':_0x451003[_0x5c97('0x2f')],'type':_0x451003[_0x5c97('0x30')]['key']};});_0x431e3a['model']=_[_0x5c97('0x2c')](_0x41c0b6,'name');_0x431e3a[_0x5c97('0x31')]=_[_0x5c97('0x32')](_0x30742a[_0x5c97('0x31')]);_0x431e3a[_0x5c97('0x33')]=_[_0x5c97('0x34')](_0x431e3a[_0x5c97('0x35')],_0x431e3a[_0x5c97('0x31')]);_0x7d4021[_0x5c97('0x36')]=_['intersection'](_0x431e3a['model'],qs['fields'](_0x30742a[_0x5c97('0x31')][_0x5c97('0x37')]));_0x7d4021[_0x5c97('0x36')]=_0x7d4021[_0x5c97('0x36')]['length']?_0x7d4021[_0x5c97('0x36')]:_0x431e3a[_0x5c97('0x35')];if(!_0x30742a['query'][_0x5c97('0x38')]('nolimit')){_0x7d4021[_0x5c97('0x20')]=qs[_0x5c97('0x20')](_0x30742a[_0x5c97('0x31')][_0x5c97('0x20')]);_0x7d4021[_0x5c97('0x1e')]=qs[_0x5c97('0x1e')](_0x30742a[_0x5c97('0x31')][_0x5c97('0x1e')]);}_0x7d4021[_0x5c97('0x39')]=qs[_0x5c97('0x3a')](_0x30742a[_0x5c97('0x31')][_0x5c97('0x3a')]);_0x7d4021[_0x5c97('0x3b')]=qs[_0x5c97('0x33')](_[_0x5c97('0x3c')](_0x30742a['query'],_0x431e3a[_0x5c97('0x33')]),_0x41c0b6);if(_0x30742a['query']['filter']){_0x7d4021[_0x5c97('0x3b')]=_[_0x5c97('0x3d')](_0x7d4021['where'],{'$or':_['map'](_0x41c0b6,function(_0x35df4f){if(_0x35df4f[_0x5c97('0x30')]!==_0x5c97('0x3e')){var _0xa27f31={};_0xa27f31[_0x35df4f[_0x5c97('0x29')]]={'$like':'%'+_0x30742a[_0x5c97('0x31')][_0x5c97('0x3f')]+'%'};return _0xa27f31;}})});}_0x7d4021=_[_0x5c97('0x3d')]({},_0x7d4021,_0x30742a[_0x5c97('0x40')]);var _0x140ab9={'where':_0x7d4021[_0x5c97('0x3b')]};return db[_0x5c97('0x2d')][_0x5c97('0x21')](_0x140ab9)[_0x5c97('0x27')](function(_0x12d23d){_0x321150['count']=_0x12d23d;if(_0x30742a[_0x5c97('0x31')]['includeAll']){_0x7d4021[_0x5c97('0x41')]=[{'all':!![]}];}return db[_0x5c97('0x2d')]['findAll'](_0x7d4021);})[_0x5c97('0x27')](function(_0x529476){_0x321150['rows']=_0x529476;return _0x321150;})['then'](respondWithFilteredResult(_0x54287b,_0x7d4021))[_0x5c97('0x42')](handleError(_0x54287b,null));};exports['show']=function(_0x1e1ae7,_0x3bc3fd){var _0x51de70={'raw':!![],'where':{'id':_0x1e1ae7['params']['id']}},_0x382e7c={};_0x382e7c['model']=_[_0x5c97('0x32')](db[_0x5c97('0x2d')][_0x5c97('0x2e')]);_0x382e7c['query']=_[_0x5c97('0x32')](_0x1e1ae7[_0x5c97('0x31')]);_0x382e7c[_0x5c97('0x33')]=_[_0x5c97('0x34')](_0x382e7c['model'],_0x382e7c[_0x5c97('0x31')]);_0x51de70[_0x5c97('0x36')]=_['intersection'](_0x382e7c[_0x5c97('0x35')],qs['fields'](_0x1e1ae7['query'][_0x5c97('0x37')]));_0x51de70[_0x5c97('0x36')]=_0x51de70['attributes'][_0x5c97('0x43')]?_0x51de70[_0x5c97('0x36')]:_0x382e7c[_0x5c97('0x35')];if(_0x1e1ae7[_0x5c97('0x31')][_0x5c97('0x44')]){_0x51de70[_0x5c97('0x41')]=[{'all':!![]}];}_0x51de70=_[_0x5c97('0x3d')]({},_0x51de70,_0x1e1ae7[_0x5c97('0x40')]);return db[_0x5c97('0x2d')][_0x5c97('0x45')](_0x51de70)[_0x5c97('0x27')](handleEntityNotFound(_0x3bc3fd,null))[_0x5c97('0x27')](respondWithResult(_0x3bc3fd,null))[_0x5c97('0x42')](handleError(_0x3bc3fd,null));};exports[_0x5c97('0x46')]=function(_0x2cf252,_0x2c8f4d){return db[_0x5c97('0x2d')][_0x5c97('0x46')](_0x2cf252['body'],{})[_0x5c97('0x27')](respondWithResult(_0x2c8f4d,0xc9))[_0x5c97('0x42')](handleError(_0x2c8f4d,null));};exports[_0x5c97('0x26')]=function(_0x122c98,_0x30d254){if(_0x122c98[_0x5c97('0x47')]['id']){delete _0x122c98['body']['id'];}return db[_0x5c97('0x2d')][_0x5c97('0x45')]({'where':{'id':_0x122c98['params']['id']}})['then'](handleEntityNotFound(_0x30d254,null))[_0x5c97('0x27')](saveUpdates(_0x122c98[_0x5c97('0x47')],null))[_0x5c97('0x27')](respondWithResult(_0x30d254,null))[_0x5c97('0x42')](handleError(_0x30d254,null));};exports['destroy']=function(_0x31d8a5,_0xc7da5e){return db[_0x5c97('0x2d')]['find']({'where':{'id':_0x31d8a5[_0x5c97('0x48')]['id']}})['then'](handleEntityNotFound(_0xc7da5e,null))[_0x5c97('0x27')](removeEntity(_0xc7da5e,null))[_0x5c97('0x42')](handleError(_0xc7da5e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 20bf045..5adf714 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 _0x1fcf=['moment','bluebird','request-promise','path','rimraf','define','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x101671,_0xe86508){var _0x2a83d1=function(_0x53064c){while(--_0x53064c){_0x101671['push'](_0x101671['shift']());}};_0x2a83d1(++_0xe86508);}(_0x1fcf,0xbf));var _0xf1fc=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x1fcf[_0x39d39d];return _0x577ac3;};'use strict';var _=require(_0xf1fc('0x0'));var util=require(_0xf1fc('0x1'));var logger=require(_0xf1fc('0x2'))(_0xf1fc('0x3'));var moment=require(_0xf1fc('0x4'));var BPromise=require(_0xf1fc('0x5'));var rp=require(_0xf1fc('0x6'));var fs=require('fs');var path=require(_0xf1fc('0x7'));var rimraf=require(_0xf1fc('0x8'));var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x1bd0b3,_0x3c1974){return _0x1bd0b3[_0xf1fc('0x9')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf1fc('0xa'),'fields':[_0xf1fc('0xb'),_0xf1fc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x599f=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x599f,0x1c0));var _0xf599=function(_0x21450c,_0x1191da){_0x21450c=_0x21450c-0x0;var _0x1219e0=_0x599f[_0x21450c];return _0x1219e0;};'use strict';var _=require(_0xf599('0x0'));var util=require(_0xf599('0x1'));var logger=require(_0xf599('0x2'))(_0xf599('0x3'));var moment=require('moment');var BPromise=require(_0xf599('0x4'));var rp=require(_0xf599('0x5'));var fs=require('fs');var path=require(_0xf599('0x6'));var rimraf=require(_0xf599('0x7'));var config=require(_0xf599('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xf599('0x9')]=function(_0x1088e8,_0x42dd02){return _0x1088e8[_0xf599('0xa')](_0xf599('0xb'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf599('0xc'),'fields':[_0xf599('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 20d74d6..bfcd839 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 _0xfb5b=['bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment'];(function(_0x3ffca5,_0xcc2d5a){var _0x29a8fb=function(_0x231055){while(--_0x231055){_0x3ffca5['push'](_0x3ffca5['shift']());}};_0x29a8fb(++_0xcc2d5a);}(_0xfb5b,0xe2));var _0xbfb5=function(_0x30781e,_0x48457f){_0x30781e=_0x30781e-0x0;var _0x22da8c=_0xfb5b[_0x30781e];return _0x22da8c;};'use strict';var _=require(_0xbfb5('0x0'));var util=require('util');var moment=require(_0xbfb5('0x1'));var BPromise=require(_0xbfb5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfb5('0x4'))(_0xbfb5('0x5'));var config=require('../../config/environment');var jayson=require(_0xbfb5('0x6'));var client=jayson[_0xbfb5('0x7')][_0xbfb5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d8597,_0x27600d,_0x4e8570){return new BPromise(function(_0xfc7068,_0x229b9b){return client[_0xbfb5('0x9')](_0x2d8597,_0x4e8570)['then'](function(_0x1277ec){logger['info'](_0xbfb5('0xa'),_0x27600d,_0xbfb5('0xb'));logger[_0xbfb5('0xc')](_0xbfb5('0xd'),_0x27600d,'request\x20sent',JSON['stringify'](_0x1277ec));if(_0x1277ec[_0xbfb5('0xe')]){if(_0x1277ec['error'][_0xbfb5('0xf')]===0x1f4){logger[_0xbfb5('0xe')]('ZendeskField,\x20%s,\x20%s',_0x27600d,_0x1277ec[_0xbfb5('0xe')]['message']);return _0x229b9b(_0x1277ec[_0xbfb5('0xe')][_0xbfb5('0x10')]);}logger[_0xbfb5('0xe')](_0xbfb5('0xa'),_0x27600d,_0x1277ec[_0xbfb5('0xe')]['message']);return _0xfc7068(_0x1277ec['error'][_0xbfb5('0x10')]);}else{logger[_0xbfb5('0x11')](_0xbfb5('0xa'),_0x27600d,_0xbfb5('0xb'));_0xfc7068(_0x1277ec['result']['message']);}})[_0xbfb5('0x12')](function(_0x202446){logger[_0xbfb5('0xe')](_0xbfb5('0xa'),_0x27600d,_0x202446);_0x229b9b(_0x202446);});});} \ No newline at end of file +var _0x423c=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x423c,0x7c));var _0xc423=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x423c[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xc423('0x0'));var util=require(_0xc423('0x1'));var moment=require(_0xc423('0x2'));var BPromise=require(_0xc423('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc423('0x4'));var db=require(_0xc423('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc423('0x6'))(_0xc423('0x7'));var config=require(_0xc423('0x8'));var jayson=require(_0xc423('0x9'));var client=jayson[_0xc423('0xa')][_0xc423('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20ff44,_0x4a6706,_0x3d3ff5){return new BPromise(function(_0x22fe0c,_0x18ea1a){return client[_0xc423('0xc')](_0x20ff44,_0x3d3ff5)[_0xc423('0xd')](function(_0x245c58){logger['info'](_0xc423('0xe'),_0x4a6706,_0xc423('0xf'));logger[_0xc423('0x10')](_0xc423('0x11'),_0x4a6706,_0xc423('0xf'),JSON[_0xc423('0x12')](_0x245c58));if(_0x245c58[_0xc423('0x13')]){if(_0x245c58[_0xc423('0x13')]['code']===0x1f4){logger[_0xc423('0x13')]('ZendeskField,\x20%s,\x20%s',_0x4a6706,_0x245c58['error']['message']);return _0x18ea1a(_0x245c58[_0xc423('0x13')][_0xc423('0x14')]);}logger[_0xc423('0x13')](_0xc423('0xe'),_0x4a6706,_0x245c58[_0xc423('0x13')]['message']);return _0x22fe0c(_0x245c58['error'][_0xc423('0x14')]);}else{logger['info'](_0xc423('0xe'),_0x4a6706,_0xc423('0xf'));_0x22fe0c(_0x245c58[_0xc423('0x15')][_0xc423('0x14')]);}})[_0xc423('0x16')](function(_0x246871){logger['error'](_0xc423('0xe'),_0x4a6706,_0x246871);_0x18ea1a(_0x246871);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3da552d..7cafedc 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 _0x4026=['/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4026,0x181));var _0x6402=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4026[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6402('0x0'));var util=require(_0x6402('0x1'));var path=require(_0x6402('0x2'));var timeout=require(_0x6402('0x3'));var express=require(_0x6402('0x4'));var router=express['Router']();var fs_extra=require(_0x6402('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6402('0x6'));var config=require('../../config/environment');var controller=require(_0x6402('0x7'));router[_0x6402('0x8')]('/',auth[_0x6402('0x9')](),controller[_0x6402('0xa')]);router['get'](_0x6402('0xb'),auth[_0x6402('0x9')](),controller['show']);router['get'](_0x6402('0xc'),auth[_0x6402('0x9')](),controller[_0x6402('0xd')]);router[_0x6402('0x8')](_0x6402('0xe'),auth[_0x6402('0x9')](),controller['getFields']);router[_0x6402('0xf')]('/',auth[_0x6402('0x9')](),controller[_0x6402('0x10')]);router['post']('/:id/configurations',auth[_0x6402('0x9')](),controller[_0x6402('0x11')]);router[_0x6402('0x12')]('/:id',auth[_0x6402('0x9')](),controller[_0x6402('0x13')]);router['delete'](_0x6402('0xb'),auth[_0x6402('0x9')](),controller[_0x6402('0x14')]);module[_0x6402('0x15')]=router; \ No newline at end of file +var _0xd051=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x1de471,_0x4291ea){var _0x472ed0=function(_0x2feafb){while(--_0x2feafb){_0x1de471['push'](_0x1de471['shift']());}};_0x472ed0(++_0x4291ea);}(_0xd051,0xc5));var _0x1d05=function(_0x2f5100,_0x565cbe){_0x2f5100=_0x2f5100-0x0;var _0x40c4bc=_0xd051[_0x2f5100];return _0x40c4bc;};'use strict';var multer=require(_0x1d05('0x0'));var util=require(_0x1d05('0x1'));var path=require(_0x1d05('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d05('0x3'));var router=express[_0x1d05('0x4')]();var fs_extra=require(_0x1d05('0x5'));var auth=require(_0x1d05('0x6'));var interaction=require(_0x1d05('0x7'));var config=require(_0x1d05('0x8'));var controller=require(_0x1d05('0x9'));router[_0x1d05('0xa')]('/',auth[_0x1d05('0xb')](),controller[_0x1d05('0xc')]);router[_0x1d05('0xa')](_0x1d05('0xd'),auth[_0x1d05('0xb')](),controller[_0x1d05('0xe')]);router[_0x1d05('0xa')](_0x1d05('0xf'),auth[_0x1d05('0xb')](),controller['getConfigurations']);router['get'](_0x1d05('0x10'),auth['isAuthenticated'](),controller[_0x1d05('0x11')]);router[_0x1d05('0x12')]('/',auth['isAuthenticated'](),controller[_0x1d05('0x13')]);router['post'](_0x1d05('0xf'),auth[_0x1d05('0xb')](),controller[_0x1d05('0x14')]);router[_0x1d05('0x15')](_0x1d05('0xd'),auth[_0x1d05('0xb')](),controller[_0x1d05('0x16')]);router[_0x1d05('0x17')](_0x1d05('0xd'),auth[_0x1d05('0xb')](),controller[_0x1d05('0x18')]);module[_0x1d05('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 44fc0d5..e1ad091 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 _0x5b02=['exports','STRING','sequelize'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5b02,0xe9));var _0x25b0=function(_0x17df51,_0x5853fa){_0x17df51=_0x17df51-0x0;var _0x546fe0=_0x5b02[_0x17df51];return _0x546fe0;};'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 +var _0x55e0=['STRING','sequelize','exports'];(function(_0x4121cc,_0x3b5a38){var _0x25ec50=function(_0x185805){while(--_0x185805){_0x4121cc['push'](_0x4121cc['shift']());}};_0x25ec50(++_0x3b5a38);}(_0x55e0,0xdc));var _0x055e=function(_0x27b6f4,_0x34d0dd){_0x27b6f4=_0x27b6f4-0x0;var _0x25bb8f=_0x55e0[_0x27b6f4];return _0x25bb8f;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'name':{'type':Sequelize[_0x055e('0x2')]},'description':{'type':Sequelize[_0x055e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x055e('0x2')]},'clientSecret':{'type':Sequelize[_0x055e('0x2')]},'serverUrl':{'type':Sequelize[_0x055e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x055e('0x2')]},'refreshToken':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9936e70..3060b6a 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 _0x6e85=['keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','ZohoAccount','includeAll','rows','catch','show','include','create','body','find','params','getConfigurations','ZohoConfiguration','sort','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','Zoho-oauthtoken\x20','error','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x5acae7,_0x2b246f){var _0x53f922=function(_0x4c8a0f){while(--_0x4c8a0f){_0x5acae7['push'](_0x5acae7['shift']());}};_0x53f922(++_0x2b246f);}(_0x6e85,0x15c));var _0x56e8=function(_0x1281fb,_0x14603b){_0x1281fb=_0x1281fb-0x0;var _0x2e1746=_0x6e85[_0x1281fb];return _0x2e1746;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56e8('0x0'));var zipdir=require(_0x56e8('0x1'));var jsonpatch=require(_0x56e8('0x2'));var rp=require('request-promise');var moment=require(_0x56e8('0x3'));var BPromise=require(_0x56e8('0x4'));var Mustache=require(_0x56e8('0x5'));var util=require(_0x56e8('0x6'));var path=require(_0x56e8('0x7'));var sox=require(_0x56e8('0x8'));var csv=require(_0x56e8('0x9'));var ejs=require(_0x56e8('0xa'));var fs=require('fs');var fs_extra=require(_0x56e8('0xb'));var _=require(_0x56e8('0xc'));var squel=require('squel');var crypto=require(_0x56e8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x56e8('0x9'));var querystring=require(_0x56e8('0xe'));var Papa=require(_0x56e8('0xf'));var Redis=require(_0x56e8('0x10'));var authService=require(_0x56e8('0x11'));var qs=require(_0x56e8('0x12'));var as=require(_0x56e8('0x13'));var hardwareService=require(_0x56e8('0x14'));var logger=require(_0x56e8('0x15'))(_0x56e8('0x16'));var utils=require(_0x56e8('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x56e8('0x18'))['db'];var integrations=require(_0x56e8('0x19'));function respondWithStatusCode(_0x342b86,_0x1ef60e){_0x1ef60e=_0x1ef60e||0xcc;return function(_0x705b70){if(_0x705b70){return _0x342b86[_0x56e8('0x1a')](_0x1ef60e);}return _0x342b86['status'](_0x1ef60e)[_0x56e8('0x1b')]();};}function respondWithResult(_0x739a99,_0x488bdf){_0x488bdf=_0x488bdf||0xc8;return function(_0x40dce6){if(_0x40dce6){return _0x739a99[_0x56e8('0x1c')](_0x488bdf)[_0x56e8('0x1d')](_0x40dce6);}};}function respondWithFilteredResult(_0x3d4e7c,_0x41a358){return function(_0x4269e5){if(_0x4269e5){var _0x1ae50c=typeof _0x41a358[_0x56e8('0x1e')]==='undefined'&&typeof _0x41a358[_0x56e8('0x1f')]===_0x56e8('0x20');var _0x30a6f8=_0x4269e5['count'];var _0x90b6d2=_0x1ae50c?0x0:_0x41a358[_0x56e8('0x1e')];var _0x90e868=_0x1ae50c?_0x4269e5[_0x56e8('0x21')]:_0x41a358['offset']+_0x41a358[_0x56e8('0x1f')];var _0x4e5ab1;if(_0x90e868>=_0x30a6f8){_0x90e868=_0x30a6f8;_0x4e5ab1=0xc8;}else{_0x4e5ab1=0xce;}_0x3d4e7c[_0x56e8('0x1c')](_0x4e5ab1);return _0x3d4e7c[_0x56e8('0x22')](_0x56e8('0x23'),_0x90b6d2+'-'+_0x90e868+'/'+_0x30a6f8)[_0x56e8('0x1d')](_0x4269e5);}return null;};}function patchUpdates(_0x2c144b){return function(_0x5a5990){try{jsonpatch[_0x56e8('0x24')](_0x5a5990,_0x2c144b,!![]);}catch(_0x426511){return BPromise['reject'](_0x426511);}return _0x5a5990[_0x56e8('0x25')]();};}function saveUpdates(_0x1d2c19,_0x618e5a){return function(_0xc7f859){if(_0xc7f859){return _0xc7f859[_0x56e8('0x26')](_0x1d2c19)['then'](function(_0x110e6f){return _0x110e6f;});}return null;};}function removeEntity(_0x25c812,_0x8341c0){return function(_0x15ee9b){if(_0x15ee9b){return _0x15ee9b[_0x56e8('0x27')]()[_0x56e8('0x28')](function(){_0x25c812[_0x56e8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25465e,_0xf306dd){return function(_0x441f97){if(!_0x441f97){_0x25465e[_0x56e8('0x1a')](0x194);}return _0x441f97;};}function handleError(_0x175fda,_0x3082b8){_0x3082b8=_0x3082b8||0x1f4;return function(_0x4c87d5){logger['error'](_0x4c87d5[_0x56e8('0x29')]);if(_0x4c87d5[_0x56e8('0x2a')]){delete _0x4c87d5[_0x56e8('0x2a')];}_0x175fda[_0x56e8('0x1c')](_0x3082b8)[_0x56e8('0x2b')](_0x4c87d5);};}exports[_0x56e8('0x2c')]=function(_0x45775b,_0x36936e){var _0x1b4b9f={},_0x49273a={},_0x7fd8fb={'count':0x0,'rows':[]};var _0x2010ca=_[_0x56e8('0x2d')](db['ZohoAccount'][_0x56e8('0x2e')],function(_0x149df2){return{'name':_0x149df2[_0x56e8('0x2f')],'type':_0x149df2[_0x56e8('0x30')][_0x56e8('0x31')]};});_0x49273a[_0x56e8('0x32')]=_[_0x56e8('0x2d')](_0x2010ca,_0x56e8('0x2a'));_0x49273a['query']=_[_0x56e8('0x33')](_0x45775b[_0x56e8('0x34')]);_0x49273a[_0x56e8('0x35')]=_['intersection'](_0x49273a[_0x56e8('0x32')],_0x49273a[_0x56e8('0x34')]);_0x1b4b9f[_0x56e8('0x36')]=_[_0x56e8('0x37')](_0x49273a[_0x56e8('0x32')],qs[_0x56e8('0x38')](_0x45775b[_0x56e8('0x34')]['fields']));_0x1b4b9f[_0x56e8('0x36')]=_0x1b4b9f[_0x56e8('0x36')][_0x56e8('0x39')]?_0x1b4b9f['attributes']:_0x49273a[_0x56e8('0x32')];if(!_0x45775b[_0x56e8('0x34')][_0x56e8('0x3a')](_0x56e8('0x3b'))){_0x1b4b9f['limit']=qs[_0x56e8('0x1f')](_0x45775b[_0x56e8('0x34')][_0x56e8('0x1f')]);_0x1b4b9f['offset']=qs[_0x56e8('0x1e')](_0x45775b[_0x56e8('0x34')][_0x56e8('0x1e')]);}_0x1b4b9f[_0x56e8('0x3c')]=qs['sort'](_0x45775b[_0x56e8('0x34')]['sort']);_0x1b4b9f[_0x56e8('0x3d')]=qs[_0x56e8('0x35')](_[_0x56e8('0x3e')](_0x45775b[_0x56e8('0x34')],_0x49273a['filters']),_0x2010ca);if(_0x45775b[_0x56e8('0x34')][_0x56e8('0x3f')]){_0x1b4b9f['where']=_[_0x56e8('0x40')](_0x1b4b9f[_0x56e8('0x3d')],{'$or':_[_0x56e8('0x2d')](_0x2010ca,function(_0x901aca){if(_0x901aca[_0x56e8('0x30')]!=='VIRTUAL'){var _0x574018={};_0x574018[_0x901aca['name']]={'$like':'%'+_0x45775b[_0x56e8('0x34')]['filter']+'%'};return _0x574018;}})});}_0x1b4b9f=_['merge']({},_0x1b4b9f,_0x45775b[_0x56e8('0x41')]);var _0x5d8e55={'where':_0x1b4b9f[_0x56e8('0x3d')]};return db[_0x56e8('0x42')][_0x56e8('0x21')](_0x5d8e55)['then'](function(_0x49f3ab){_0x7fd8fb[_0x56e8('0x21')]=_0x49f3ab;if(_0x45775b['query'][_0x56e8('0x43')]){_0x1b4b9f['include']=[{'all':!![]}];}return db[_0x56e8('0x42')]['findAll'](_0x1b4b9f);})[_0x56e8('0x28')](function(_0x566114){_0x7fd8fb[_0x56e8('0x44')]=_0x566114;return _0x7fd8fb;})[_0x56e8('0x28')](respondWithFilteredResult(_0x36936e,_0x1b4b9f))[_0x56e8('0x45')](handleError(_0x36936e,null));};exports[_0x56e8('0x46')]=function(_0x5cc1af,_0x2ff0dd){var _0x5a47ef={'raw':![],'where':{'id':_0x5cc1af['params']['id']}},_0x5a5381={};_0x5a5381['model']=_['keys'](db[_0x56e8('0x42')]['rawAttributes']);_0x5a5381['query']=_[_0x56e8('0x33')](_0x5cc1af[_0x56e8('0x34')]);_0x5a5381[_0x56e8('0x35')]=_[_0x56e8('0x37')](_0x5a5381['model'],_0x5a5381[_0x56e8('0x34')]);_0x5a47ef[_0x56e8('0x36')]=_[_0x56e8('0x37')](_0x5a5381[_0x56e8('0x32')],qs[_0x56e8('0x38')](_0x5cc1af[_0x56e8('0x34')]['fields']));_0x5a47ef['attributes']=_0x5a47ef[_0x56e8('0x36')]['length']?_0x5a47ef[_0x56e8('0x36')]:_0x5a5381[_0x56e8('0x32')];if(_0x5cc1af[_0x56e8('0x34')][_0x56e8('0x43')]){_0x5a47ef[_0x56e8('0x47')]=[{'all':!![]}];}_0x5a47ef=_[_0x56e8('0x40')]({},_0x5a47ef,_0x5cc1af['options']);return db['ZohoAccount']['find'](_0x5a47ef)[_0x56e8('0x28')](handleEntityNotFound(_0x2ff0dd,null))[_0x56e8('0x28')](respondWithResult(_0x2ff0dd,null))[_0x56e8('0x45')](handleError(_0x2ff0dd,null));};exports[_0x56e8('0x48')]=function(_0xaee451,_0xf5ad91){return db[_0x56e8('0x42')][_0x56e8('0x48')](_0xaee451[_0x56e8('0x49')],{})['then'](respondWithResult(_0xf5ad91,0xc9))[_0x56e8('0x45')](handleError(_0xf5ad91,null));};exports['update']=function(_0x3445b8,_0x19c23e){if(_0x3445b8['body']['id']){delete _0x3445b8[_0x56e8('0x49')]['id'];}return db[_0x56e8('0x42')][_0x56e8('0x4a')]({'where':{'id':_0x3445b8['params']['id']}})[_0x56e8('0x28')](handleEntityNotFound(_0x19c23e,null))[_0x56e8('0x28')](saveUpdates(_0x3445b8[_0x56e8('0x49')],null))['then'](respondWithResult(_0x19c23e,null))[_0x56e8('0x45')](handleError(_0x19c23e,null));};exports[_0x56e8('0x27')]=function(_0x3de138,_0x52f066){return db[_0x56e8('0x42')][_0x56e8('0x4a')]({'where':{'id':_0x3de138[_0x56e8('0x4b')]['id']}})[_0x56e8('0x28')](handleEntityNotFound(_0x52f066,null))['then'](removeEntity(_0x52f066,null))[_0x56e8('0x45')](handleError(_0x52f066,null));};exports[_0x56e8('0x4c')]=function(_0x1acd63,_0x230d2d,_0x1fc23c){var _0x44247f={};var _0x2c48aa={};var _0x43b6aa;var _0x3c5eaa;return db['ZohoAccount']['findOne']({'where':{'id':_0x1acd63[_0x56e8('0x4b')]['id']}})[_0x56e8('0x28')](handleEntityNotFound(_0x230d2d,null))[_0x56e8('0x28')](function(_0x38d42a){if(_0x38d42a){_0x43b6aa=_0x38d42a;_0x2c48aa[_0x56e8('0x32')]=_[_0x56e8('0x33')](db[_0x56e8('0x4d')][_0x56e8('0x2e')]);_0x2c48aa[_0x56e8('0x34')]=_[_0x56e8('0x33')](_0x1acd63['query']);_0x2c48aa[_0x56e8('0x35')]=_[_0x56e8('0x37')](_0x2c48aa[_0x56e8('0x32')],_0x2c48aa[_0x56e8('0x34')]);_0x44247f[_0x56e8('0x36')]=_['intersection'](_0x2c48aa['model'],qs[_0x56e8('0x38')](_0x1acd63['query']['fields']));_0x44247f['attributes']=_0x44247f[_0x56e8('0x36')][_0x56e8('0x39')]?_0x44247f[_0x56e8('0x36')]:_0x2c48aa[_0x56e8('0x32')];_0x44247f[_0x56e8('0x3c')]=qs[_0x56e8('0x4e')](_0x1acd63[_0x56e8('0x34')][_0x56e8('0x4e')]);_0x44247f['where']=qs['filters'](_['pick'](_0x1acd63[_0x56e8('0x34')],_0x2c48aa[_0x56e8('0x35')]));if(_0x1acd63[_0x56e8('0x34')][_0x56e8('0x3f')]){_0x44247f[_0x56e8('0x3d')]=_['merge'](_0x44247f[_0x56e8('0x3d')],{'$or':_[_0x56e8('0x2d')](_0x44247f['attributes'],function(_0x277cce){var _0x1120f9={};_0x1120f9[_0x277cce]={'$like':'%'+_0x1acd63[_0x56e8('0x34')][_0x56e8('0x3f')]+'%'};return _0x1120f9;})});}_0x44247f=_['merge']({},_0x44247f,_0x1acd63[_0x56e8('0x41')]);return _0x43b6aa[_0x56e8('0x4c')](_0x44247f);}})['then'](function(_0x4aa2c0){if(_0x4aa2c0){_0x3c5eaa=_0x4aa2c0[_0x56e8('0x39')];if(!_0x1acd63['query'][_0x56e8('0x3a')]('nolimit')){_0x44247f[_0x56e8('0x1f')]=qs[_0x56e8('0x1f')](_0x1acd63[_0x56e8('0x34')][_0x56e8('0x1f')]);_0x44247f['offset']=qs['offset'](_0x1acd63[_0x56e8('0x34')][_0x56e8('0x1e')]);}return _0x43b6aa[_0x56e8('0x4c')](_0x44247f);}})[_0x56e8('0x28')](function(_0x144408){if(_0x144408){return _0x144408?{'count':_0x3c5eaa,'rows':_0x144408}:null;}})[_0x56e8('0x28')](respondWithResult(_0x230d2d,null))[_0x56e8('0x45')](handleError(_0x230d2d,null));};exports[_0x56e8('0x4f')]=function(_0x3b9e5c,_0x385732,_0x4c6ad0){if(_0x3b9e5c[_0x56e8('0x49')]['id']){delete _0x3b9e5c[_0x56e8('0x49')]['id'];}return db[_0x56e8('0x42')][_0x56e8('0x50')]({'where':{'id':_0x3b9e5c[_0x56e8('0x4b')]['id']}})[_0x56e8('0x28')](handleEntityNotFound(_0x385732,null))[_0x56e8('0x28')](function(_0x9975c7){if(_0x9975c7){_0x3b9e5c[_0x56e8('0x49')][_0x56e8('0x51')]=_0x9975c7['id'];_0x3b9e5c[_0x56e8('0x49')][_0x56e8('0x52')]=integrations[_0x56e8('0x53')](_0x3b9e5c[_0x56e8('0x49')][_0x56e8('0x54')],_0x3b9e5c[_0x56e8('0x49')][_0x56e8('0x30')]);_0x3b9e5c['body']['Descriptions']=integrations[_0x56e8('0x55')](_0x3b9e5c[_0x56e8('0x49')][_0x56e8('0x54')],_0x3b9e5c[_0x56e8('0x49')]['type']);return db[_0x56e8('0x4d')][_0x56e8('0x48')](_0x3b9e5c[_0x56e8('0x49')],{'include':[{'model':db[_0x56e8('0x56')],'as':_0x56e8('0x52')},{'model':db[_0x56e8('0x56')],'as':_0x56e8('0x57')}]});}return null;})[_0x56e8('0x28')](respondWithResult(_0x385732,null))[_0x56e8('0x45')](handleError(_0x385732,null));};function getAccessToken(_0x3be972){return new Promise(function(_0x4b0b78,_0x4cc436){var _0x2e8253;switch(_0x3be972[_0x56e8('0x58')]){case'US':_0x2e8253='https://accounts.zoho.com';break;case'AU':_0x2e8253=_0x56e8('0x59');break;case'EU':_0x2e8253=_0x56e8('0x5a');break;case'IN':_0x2e8253=_0x56e8('0x5b');break;case'CN':_0x2e8253='https://accounts.zoho.com.cn';break;default:_0x2e8253=_0x56e8('0x5a');break;}var _0x51ffed={'method':_0x56e8('0x5c'),'uri':_0x2e8253+_0x56e8('0x5d'),'qs':{'refresh_token':_0x3be972[_0x56e8('0x5e')],'client_id':_0x3be972[_0x56e8('0x5f')],'client_secret':_0x3be972['clientSecret'],'grant_type':_0x56e8('0x60')},'json':!![]};return rp(_0x51ffed)[_0x56e8('0x28')](function(_0x2bbd4c){if(_0x2bbd4c[_0x56e8('0x61')]){_0x4b0b78(_0x2bbd4c[_0x56e8('0x61')]);}else{_0x4cc436(_0x56e8('0x62'));}})[_0x56e8('0x45')](function(_0x1f1d49){_0x4cc436(_0x1f1d49);});});}exports[_0x56e8('0x63')]=function(_0x2d9408,_0xa699df,_0x3854dd){var _0x287388,_0x4386c5,_0x5af44b,_0x2454bf,_0x200605;return db[_0x56e8('0x42')][_0x56e8('0x50')]({'where':{'id':_0x2d9408[_0x56e8('0x4b')]['id']},'attributes':['id',_0x56e8('0x64'),_0x56e8('0x58'),_0x56e8('0x5f'),'clientSecret',_0x56e8('0x65'),_0x56e8('0x66'),_0x56e8('0x5e')]})[_0x56e8('0x28')](handleEntityNotFound(_0xa699df,null))[_0x56e8('0x28')](function(_0x5c7114){_0x200605=_0x5c7114;_0x287388=_0x200605[_0x56e8('0x64')];_0x4386c5=_0x287388===_0x56e8('0x67')?'eu':_0x56e8('0x68');_0x5af44b=_0x200605['serverUrl'];var _0x482e1a=_0x5af44b[_0x56e8('0x69')](-0x1);if(_0x482e1a==='/'||_0x482e1a==='\x5c'||_0x482e1a===':'){_0x5af44b=_0x5af44b[_0x56e8('0x6a')](0x0,_0x5af44b[_0x56e8('0x6b')](_0x482e1a));}if(!_0x200605[_0x56e8('0x5e')]){throw new Error(_0x56e8('0x6c'));}return getAccessToken(_0x200605);})[_0x56e8('0x28')](function(_0x14c081){if(_0x14c081){return rp({'method':_0x56e8('0x6d'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4386c5),'qs':{'module':'Calls'},'headers':{'Authorization':_0x56e8('0x6e')+_0x14c081},'json':!![]});}})['then'](function(_0x58a5f7){if(_0x58a5f7){if(_0x58a5f7['response']&&_0x58a5f7['response'][_0x56e8('0x6f')]){throw new Error(_0x58a5f7[_0x56e8('0x70')][_0x56e8('0x6f')][_0x56e8('0x71')]);}var _0x2ae573=[];var _0x4fbdda=[];var _0x13dec1=[_0x56e8('0x72'),_0x56e8('0x73'),_0x56e8('0x74'),_0x56e8('0x75'),_0x56e8('0x76'),_0x56e8('0x77'),_0x56e8('0x78'),'Call_Type'];_0x4fbdda=_[_0x56e8('0x79')](_0x58a5f7[_0x56e8('0x38')],function(_0x17f364){return _0x13dec1[_0x56e8('0x7a')](_0x17f364[_0x56e8('0x7b')]);});for(var _0x549707=0x0;_0x549707<_0x4fbdda['length'];_0x549707++){if(_0x4fbdda[_0x549707]['system_mandatory']===![]){_0x2ae573['push']({'id':_0x4fbdda[_0x549707]['id'],'name':_0x4fbdda[_0x549707][_0x56e8('0x7c')],'custom':_0x4fbdda[_0x549707][_0x56e8('0x7d')],'options':_0x4fbdda[_0x549707][_0x56e8('0x7e')]==='picklist'&&_0x4fbdda[_0x549707][_0x56e8('0x7f')]['length']>-0x1?_[_0x56e8('0x2d')](_0x4fbdda[_0x549707]['pick_list_values'],function(_0x3cc5d0){return{'name':_0x3cc5d0,'value':_0x3cc5d0};}):[]});}}return{'count':_0x2ae573[_0x56e8('0x39')],'rows':_0x2ae573};}else{return{'count':0x0,'rows':[]};}})[_0x56e8('0x28')](respondWithResult(_0xa699df,null))[_0x56e8('0x45')](function(_0x4d1900){var _0xdf40ce=_0x2d9408[_0x56e8('0x34')][_0x56e8('0x80')]?0x1f4:_0x4d1900[_0x56e8('0x81')]||0x1f4;logger['error'](_0x56e8('0x82'),_0x56e8('0x63'),_0xdf40ce,JSON[_0x56e8('0x83')](_0x4d1900));delete _0x4d1900[_0x56e8('0x2a')];if(_0xdf40ce===0x191){_0xdf40ce=0x190;}_0xa699df[_0x56e8('0x1c')](_0xdf40ce)[_0x56e8('0x2b')](_0x2d9408['query'][_0x56e8('0x80')]?{'message':_0x56e8('0x84'),'statusCode':_0x4d1900[_0x56e8('0x81')]}:_0x4d1900);});}; \ No newline at end of file +var _0x849a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','update','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','host','zoho.eu','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','api_name','system_mandatory','push','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','reject','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','key','model'];(function(_0x45a494,_0x125692){var _0x29b471=function(_0x518de3){while(--_0x518de3){_0x45a494['push'](_0x45a494['shift']());}};_0x29b471(++_0x125692);}(_0x849a,0x1ba));var _0xa849=function(_0x38a919,_0x2e78b5){_0x38a919=_0x38a919-0x0;var _0x10b5ae=_0x849a[_0x38a919];return _0x10b5ae;};'use strict';var emlformat=require(_0xa849('0x0'));var rimraf=require(_0xa849('0x1'));var zipdir=require(_0xa849('0x2'));var jsonpatch=require(_0xa849('0x3'));var rp=require(_0xa849('0x4'));var moment=require('moment');var BPromise=require(_0xa849('0x5'));var Mustache=require(_0xa849('0x6'));var util=require(_0xa849('0x7'));var path=require(_0xa849('0x8'));var sox=require(_0xa849('0x9'));var csv=require(_0xa849('0xa'));var ejs=require(_0xa849('0xb'));var fs=require('fs');var fs_extra=require(_0xa849('0xc'));var _=require('lodash');var squel=require(_0xa849('0xd'));var crypto=require('crypto');var jsforce=require(_0xa849('0xe'));var deskjs=require(_0xa849('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa849('0x10'));var Papa=require(_0xa849('0x11'));var Redis=require(_0xa849('0x12'));var authService=require(_0xa849('0x13'));var qs=require(_0xa849('0x14'));var as=require(_0xa849('0x15'));var hardwareService=require(_0xa849('0x16'));var logger=require(_0xa849('0x17'))(_0xa849('0x18'));var utils=require(_0xa849('0x19'));var config=require(_0xa849('0x1a'));var licenseUtil=require(_0xa849('0x1b'));var db=require(_0xa849('0x1c'))['db'];var integrations=require(_0xa849('0x1d'));function respondWithStatusCode(_0x42b68b,_0x4597e5){_0x4597e5=_0x4597e5||0xcc;return function(_0x1c3f9c){if(_0x1c3f9c){return _0x42b68b[_0xa849('0x1e')](_0x4597e5);}return _0x42b68b[_0xa849('0x1f')](_0x4597e5)[_0xa849('0x20')]();};}function respondWithResult(_0x10e8ab,_0xc6a8fd){_0xc6a8fd=_0xc6a8fd||0xc8;return function(_0x4c472d){if(_0x4c472d){return _0x10e8ab[_0xa849('0x1f')](_0xc6a8fd)[_0xa849('0x21')](_0x4c472d);}};}function respondWithFilteredResult(_0x2231bf,_0x55707c){return function(_0x38c319){if(_0x38c319){var _0xe6348f=typeof _0x55707c[_0xa849('0x22')]===_0xa849('0x23')&&typeof _0x55707c[_0xa849('0x24')]===_0xa849('0x23');var _0x215c21=_0x38c319[_0xa849('0x25')];var _0x4aa02d=_0xe6348f?0x0:_0x55707c[_0xa849('0x22')];var _0x34c26d=_0xe6348f?_0x38c319[_0xa849('0x25')]:_0x55707c[_0xa849('0x22')]+_0x55707c[_0xa849('0x24')];var _0xb839f3;if(_0x34c26d>=_0x215c21){_0x34c26d=_0x215c21;_0xb839f3=0xc8;}else{_0xb839f3=0xce;}_0x2231bf['status'](_0xb839f3);return _0x2231bf[_0xa849('0x26')](_0xa849('0x27'),_0x4aa02d+'-'+_0x34c26d+'/'+_0x215c21)[_0xa849('0x21')](_0x38c319);}return null;};}function patchUpdates(_0x255afb){return function(_0x48bd5e){try{jsonpatch[_0xa849('0x28')](_0x48bd5e,_0x255afb,!![]);}catch(_0x547997){return BPromise[_0xa849('0x29')](_0x547997);}return _0x48bd5e['save']();};}function saveUpdates(_0xe41c13,_0x2bec){return function(_0x117c6a){if(_0x117c6a){return _0x117c6a['update'](_0xe41c13)[_0xa849('0x2a')](function(_0x556c93){return _0x556c93;});}return null;};}function removeEntity(_0x4f1a0c,_0x1df158){return function(_0x4e08be){if(_0x4e08be){return _0x4e08be[_0xa849('0x2b')]()['then'](function(){_0x4f1a0c[_0xa849('0x1f')](0xcc)[_0xa849('0x20')]();});}};}function handleEntityNotFound(_0x21231b,_0x3bd2c5){return function(_0x54deae){if(!_0x54deae){_0x21231b[_0xa849('0x1e')](0x194);}return _0x54deae;};}function handleError(_0x2aecf1,_0x4fcb93){_0x4fcb93=_0x4fcb93||0x1f4;return function(_0x241cb4){logger[_0xa849('0x2c')](_0x241cb4[_0xa849('0x2d')]);if(_0x241cb4[_0xa849('0x2e')]){delete _0x241cb4[_0xa849('0x2e')];}_0x2aecf1[_0xa849('0x1f')](_0x4fcb93)[_0xa849('0x2f')](_0x241cb4);};}exports[_0xa849('0x30')]=function(_0x71a6a1,_0xa8aa4f){var _0x1708e3={},_0x5eedd4={},_0x48ec9d={'count':0x0,'rows':[]};var _0x58b8e3=_[_0xa849('0x31')](db[_0xa849('0x32')]['rawAttributes'],function(_0x151c18){return{'name':_0x151c18[_0xa849('0x33')],'type':_0x151c18['type'][_0xa849('0x34')]};});_0x5eedd4[_0xa849('0x35')]=_[_0xa849('0x31')](_0x58b8e3,_0xa849('0x2e'));_0x5eedd4[_0xa849('0x36')]=_[_0xa849('0x37')](_0x71a6a1[_0xa849('0x36')]);_0x5eedd4[_0xa849('0x38')]=_[_0xa849('0x39')](_0x5eedd4[_0xa849('0x35')],_0x5eedd4['query']);_0x1708e3[_0xa849('0x3a')]=_[_0xa849('0x39')](_0x5eedd4[_0xa849('0x35')],qs[_0xa849('0x3b')](_0x71a6a1['query'][_0xa849('0x3b')]));_0x1708e3[_0xa849('0x3a')]=_0x1708e3[_0xa849('0x3a')][_0xa849('0x3c')]?_0x1708e3[_0xa849('0x3a')]:_0x5eedd4['model'];if(!_0x71a6a1[_0xa849('0x36')][_0xa849('0x3d')](_0xa849('0x3e'))){_0x1708e3[_0xa849('0x24')]=qs['limit'](_0x71a6a1[_0xa849('0x36')]['limit']);_0x1708e3[_0xa849('0x22')]=qs[_0xa849('0x22')](_0x71a6a1[_0xa849('0x36')][_0xa849('0x22')]);}_0x1708e3[_0xa849('0x3f')]=qs[_0xa849('0x40')](_0x71a6a1[_0xa849('0x36')][_0xa849('0x40')]);_0x1708e3[_0xa849('0x41')]=qs[_0xa849('0x38')](_[_0xa849('0x42')](_0x71a6a1[_0xa849('0x36')],_0x5eedd4[_0xa849('0x38')]),_0x58b8e3);if(_0x71a6a1[_0xa849('0x36')]['filter']){_0x1708e3[_0xa849('0x41')]=_[_0xa849('0x43')](_0x1708e3[_0xa849('0x41')],{'$or':_[_0xa849('0x31')](_0x58b8e3,function(_0x4c0da2){if(_0x4c0da2[_0xa849('0x44')]!==_0xa849('0x45')){var _0x7fd710={};_0x7fd710[_0x4c0da2[_0xa849('0x2e')]]={'$like':'%'+_0x71a6a1[_0xa849('0x36')][_0xa849('0x46')]+'%'};return _0x7fd710;}})});}_0x1708e3=_[_0xa849('0x43')]({},_0x1708e3,_0x71a6a1[_0xa849('0x47')]);var _0x19bbd4={'where':_0x1708e3['where']};return db[_0xa849('0x32')][_0xa849('0x25')](_0x19bbd4)[_0xa849('0x2a')](function(_0x52b9b3){_0x48ec9d[_0xa849('0x25')]=_0x52b9b3;if(_0x71a6a1['query']['includeAll']){_0x1708e3[_0xa849('0x48')]=[{'all':!![]}];}return db[_0xa849('0x32')][_0xa849('0x49')](_0x1708e3);})[_0xa849('0x2a')](function(_0x1f609f){_0x48ec9d[_0xa849('0x4a')]=_0x1f609f;return _0x48ec9d;})[_0xa849('0x2a')](respondWithFilteredResult(_0xa8aa4f,_0x1708e3))['catch'](handleError(_0xa8aa4f,null));};exports[_0xa849('0x4b')]=function(_0x1be6c3,_0x1f9e6c){var _0x741698={'raw':![],'where':{'id':_0x1be6c3['params']['id']}},_0xe107af={};_0xe107af[_0xa849('0x35')]=_[_0xa849('0x37')](db[_0xa849('0x32')][_0xa849('0x4c')]);_0xe107af['query']=_[_0xa849('0x37')](_0x1be6c3['query']);_0xe107af[_0xa849('0x38')]=_[_0xa849('0x39')](_0xe107af[_0xa849('0x35')],_0xe107af[_0xa849('0x36')]);_0x741698['attributes']=_[_0xa849('0x39')](_0xe107af[_0xa849('0x35')],qs[_0xa849('0x3b')](_0x1be6c3[_0xa849('0x36')][_0xa849('0x3b')]));_0x741698['attributes']=_0x741698[_0xa849('0x3a')][_0xa849('0x3c')]?_0x741698['attributes']:_0xe107af[_0xa849('0x35')];if(_0x1be6c3['query'][_0xa849('0x4d')]){_0x741698[_0xa849('0x48')]=[{'all':!![]}];}_0x741698=_['merge']({},_0x741698,_0x1be6c3[_0xa849('0x47')]);return db[_0xa849('0x32')][_0xa849('0x4e')](_0x741698)['then'](handleEntityNotFound(_0x1f9e6c,null))[_0xa849('0x2a')](respondWithResult(_0x1f9e6c,null))[_0xa849('0x4f')](handleError(_0x1f9e6c,null));};exports[_0xa849('0x50')]=function(_0xfa50d2,_0x2ca0cb){return db['ZohoAccount'][_0xa849('0x50')](_0xfa50d2[_0xa849('0x51')],{})[_0xa849('0x2a')](respondWithResult(_0x2ca0cb,0xc9))['catch'](handleError(_0x2ca0cb,null));};exports[_0xa849('0x52')]=function(_0x3a196f,_0x4ae7e2){if(_0x3a196f['body']['id']){delete _0x3a196f[_0xa849('0x51')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x3a196f[_0xa849('0x53')]['id']}})['then'](handleEntityNotFound(_0x4ae7e2,null))[_0xa849('0x2a')](saveUpdates(_0x3a196f[_0xa849('0x51')],null))[_0xa849('0x2a')](respondWithResult(_0x4ae7e2,null))[_0xa849('0x4f')](handleError(_0x4ae7e2,null));};exports[_0xa849('0x2b')]=function(_0x2314b0,_0x15e3d0){return db[_0xa849('0x32')][_0xa849('0x4e')]({'where':{'id':_0x2314b0['params']['id']}})['then'](handleEntityNotFound(_0x15e3d0,null))[_0xa849('0x2a')](removeEntity(_0x15e3d0,null))[_0xa849('0x4f')](handleError(_0x15e3d0,null));};exports[_0xa849('0x54')]=function(_0xcad211,_0x2ce32a,_0x5a0dbc){var _0x40959f={};var _0x58c33d={};var _0x2fb86f;var _0xdded84;return db[_0xa849('0x32')][_0xa849('0x55')]({'where':{'id':_0xcad211[_0xa849('0x53')]['id']}})[_0xa849('0x2a')](handleEntityNotFound(_0x2ce32a,null))[_0xa849('0x2a')](function(_0x54e685){if(_0x54e685){_0x2fb86f=_0x54e685;_0x58c33d['model']=_['keys'](db[_0xa849('0x56')][_0xa849('0x4c')]);_0x58c33d[_0xa849('0x36')]=_[_0xa849('0x37')](_0xcad211[_0xa849('0x36')]);_0x58c33d[_0xa849('0x38')]=_[_0xa849('0x39')](_0x58c33d[_0xa849('0x35')],_0x58c33d['query']);_0x40959f[_0xa849('0x3a')]=_[_0xa849('0x39')](_0x58c33d[_0xa849('0x35')],qs[_0xa849('0x3b')](_0xcad211['query'][_0xa849('0x3b')]));_0x40959f[_0xa849('0x3a')]=_0x40959f[_0xa849('0x3a')][_0xa849('0x3c')]?_0x40959f[_0xa849('0x3a')]:_0x58c33d['model'];_0x40959f[_0xa849('0x3f')]=qs['sort'](_0xcad211[_0xa849('0x36')][_0xa849('0x40')]);_0x40959f[_0xa849('0x41')]=qs[_0xa849('0x38')](_[_0xa849('0x42')](_0xcad211[_0xa849('0x36')],_0x58c33d[_0xa849('0x38')]));if(_0xcad211[_0xa849('0x36')][_0xa849('0x46')]){_0x40959f[_0xa849('0x41')]=_['merge'](_0x40959f[_0xa849('0x41')],{'$or':_['map'](_0x40959f[_0xa849('0x3a')],function(_0x114136){var _0x1f716f={};_0x1f716f[_0x114136]={'$like':'%'+_0xcad211[_0xa849('0x36')][_0xa849('0x46')]+'%'};return _0x1f716f;})});}_0x40959f=_['merge']({},_0x40959f,_0xcad211['options']);return _0x2fb86f[_0xa849('0x54')](_0x40959f);}})[_0xa849('0x2a')](function(_0x18eff6){if(_0x18eff6){_0xdded84=_0x18eff6[_0xa849('0x3c')];if(!_0xcad211[_0xa849('0x36')][_0xa849('0x3d')](_0xa849('0x3e'))){_0x40959f[_0xa849('0x24')]=qs['limit'](_0xcad211[_0xa849('0x36')]['limit']);_0x40959f[_0xa849('0x22')]=qs[_0xa849('0x22')](_0xcad211[_0xa849('0x36')][_0xa849('0x22')]);}return _0x2fb86f[_0xa849('0x54')](_0x40959f);}})['then'](function(_0x156f35){if(_0x156f35){return _0x156f35?{'count':_0xdded84,'rows':_0x156f35}:null;}})[_0xa849('0x2a')](respondWithResult(_0x2ce32a,null))[_0xa849('0x4f')](handleError(_0x2ce32a,null));};exports[_0xa849('0x57')]=function(_0x2db752,_0x130c71,_0x3c2e85){if(_0x2db752[_0xa849('0x51')]['id']){delete _0x2db752[_0xa849('0x51')]['id'];}return db[_0xa849('0x32')][_0xa849('0x55')]({'where':{'id':_0x2db752[_0xa849('0x53')]['id']}})[_0xa849('0x2a')](handleEntityNotFound(_0x130c71,null))['then'](function(_0x4986da){if(_0x4986da){_0x2db752['body']['AccountId']=_0x4986da['id'];_0x2db752[_0xa849('0x51')][_0xa849('0x58')]=integrations[_0xa849('0x59')](_0x2db752['body'][_0xa849('0x5a')],_0x2db752['body'][_0xa849('0x44')]);_0x2db752[_0xa849('0x51')]['Descriptions']=integrations[_0xa849('0x5b')](_0x2db752[_0xa849('0x51')][_0xa849('0x5a')],_0x2db752[_0xa849('0x51')][_0xa849('0x44')]);return db[_0xa849('0x56')]['create'](_0x2db752[_0xa849('0x51')],{'include':[{'model':db['ZohoField'],'as':_0xa849('0x58')},{'model':db[_0xa849('0x5c')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x130c71,null))[_0xa849('0x4f')](handleError(_0x130c71,null));};function getAccessToken(_0x145b43){return new Promise(function(_0x21d593,_0x43b710){var _0x32fc88;switch(_0x145b43[_0xa849('0x5d')]){case'US':_0x32fc88='https://accounts.zoho.com';break;case'AU':_0x32fc88=_0xa849('0x5e');break;case'EU':_0x32fc88=_0xa849('0x5f');break;case'IN':_0x32fc88=_0xa849('0x60');break;case'CN':_0x32fc88=_0xa849('0x61');break;default:_0x32fc88='https://accounts.zoho.eu';break;}var _0x1ee13d={'method':_0xa849('0x62'),'uri':_0x32fc88+'/oauth/v2/token','qs':{'refresh_token':_0x145b43[_0xa849('0x63')],'client_id':_0x145b43[_0xa849('0x64')],'client_secret':_0x145b43[_0xa849('0x65')],'grant_type':_0xa849('0x66')},'json':!![]};return rp(_0x1ee13d)[_0xa849('0x2a')](function(_0x305999){if(_0x305999[_0xa849('0x67')]){_0x21d593(_0x305999[_0xa849('0x67')]);}else{_0x43b710('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x36883e){_0x43b710(_0x36883e);});});}exports[_0xa849('0x68')]=function(_0x1e76c3,_0x170962,_0x5556ad){var _0x818629,_0x3e71c2,_0x505f2f,_0x328310,_0x2ee777;return db['ZohoAccount'][_0xa849('0x55')]({'where':{'id':_0x1e76c3[_0xa849('0x53')]['id']},'attributes':['id','host','zone',_0xa849('0x64'),'clientSecret',_0xa849('0x69'),'code',_0xa849('0x63')]})[_0xa849('0x2a')](handleEntityNotFound(_0x170962,null))[_0xa849('0x2a')](function(_0x301dc3){_0x2ee777=_0x301dc3;_0x818629=_0x2ee777[_0xa849('0x6a')];_0x3e71c2=_0x818629===_0xa849('0x6b')?'eu':'com';_0x505f2f=_0x2ee777[_0xa849('0x69')];var _0x560a16=_0x505f2f['slice'](-0x1);if(_0x560a16==='/'||_0x560a16==='\x5c'||_0x560a16===':'){_0x505f2f=_0x505f2f['substring'](0x0,_0x505f2f[_0xa849('0x6c')](_0x560a16));}if(!_0x2ee777[_0xa849('0x63')]){throw new Error(_0xa849('0x6d'));}return getAccessToken(_0x2ee777);})[_0xa849('0x2a')](function(_0x1a21af){if(_0x1a21af){return rp({'method':_0xa849('0x6e'),'uri':util[_0xa849('0x6f')](_0xa849('0x70'),_0x3e71c2),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa849('0x71')+_0x1a21af},'json':!![]});}})[_0xa849('0x2a')](function(_0xe18cb6){if(_0xe18cb6){if(_0xe18cb6['response']&&_0xe18cb6[_0xa849('0x72')][_0xa849('0x2c')]){throw new Error(_0xe18cb6[_0xa849('0x72')][_0xa849('0x2c')]['message']);}var _0x3fc68c=[];var _0x52bee8=[];var _0x549ccf=[_0xa849('0x73'),'Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type'];_0x52bee8=_['remove'](_0xe18cb6['fields'],function(_0x431591){return _0x549ccf['includes'](_0x431591[_0xa849('0x74')]);});for(var _0x4cefbf=0x0;_0x4cefbf<_0x52bee8[_0xa849('0x3c')];_0x4cefbf++){if(_0x52bee8[_0x4cefbf][_0xa849('0x75')]===![]){_0x3fc68c[_0xa849('0x76')]({'id':_0x52bee8[_0x4cefbf]['id'],'name':_0x52bee8[_0x4cefbf]['display_label'],'custom':_0x52bee8[_0x4cefbf]['custom_field'],'options':_0x52bee8[_0x4cefbf]['data_type']===_0xa849('0x77')&&_0x52bee8[_0x4cefbf]['pick_list_values'][_0xa849('0x3c')]>-0x1?_['map'](_0x52bee8[_0x4cefbf][_0xa849('0x78')],function(_0x57991c){return{'name':_0x57991c,'value':_0x57991c};}):[]});}}return{'count':_0x3fc68c[_0xa849('0x3c')],'rows':_0x3fc68c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x170962,null))[_0xa849('0x4f')](function(_0x46cdef){var _0x33d31b=_0x1e76c3[_0xa849('0x36')][_0xa849('0x79')]?0x1f4:_0x46cdef[_0xa849('0x7a')]||0x1f4;logger[_0xa849('0x2c')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x33d31b,JSON['stringify'](_0x46cdef));delete _0x46cdef[_0xa849('0x2e')];if(_0x33d31b===0x191){_0x33d31b=0x190;}_0x170962[_0xa849('0x1f')](_0x33d31b)[_0xa849('0x2f')](_0x1e76c3['query']['test']?{'message':_0xa849('0x7b'),'statusCode':_0x46cdef[_0xa849('0x7a')]}:_0x46cdef);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 807ee27..9e1f6f4 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 _0x9cc6=['ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','POST','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','then','parse','refreshToken','info','format','name','error'];(function(_0x239a37,_0x1675c8){var _0x46db3c=function(_0x3c02a2){while(--_0x3c02a2){_0x239a37['push'](_0x239a37['shift']());}};_0x46db3c(++_0x1675c8);}(_0x9cc6,0x1f1));var _0x69cc=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x9cc6[_0x79b649];return _0x1af9b1;};'use strict';var _=require(_0x69cc('0x0'));var util=require(_0x69cc('0x1'));var logger=require(_0x69cc('0x2'))(_0x69cc('0x3'));var moment=require(_0x69cc('0x4'));var BPromise=require(_0x69cc('0x5'));var rp=require(_0x69cc('0x6'));var fs=require('fs');var path=require(_0x69cc('0x7'));var rimraf=require('rimraf');var config=require(_0x69cc('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x69cc('0x9')]=function(_0x16cbcc,_0x370839){return _0x16cbcc['define'](_0x69cc('0xa'),attributes,{'tableName':_0x69cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c5220,_0x5a2e,_0xbbd82a){if(_0x3c5220[_0x69cc('0xc')]('zone')||_0x3c5220[_0x69cc('0xc')]('serverUrl')||_0x3c5220[_0x69cc('0xc')](_0x69cc('0xd'))||_0x3c5220[_0x69cc('0xc')](_0x69cc('0xe'))||_0x3c5220[_0x69cc('0xc')](_0x69cc('0xf'))||_0x3c5220['changed'](_0x69cc('0x10'))){var _0x59b74e,_0x552c3d;_0x59b74e=_0x3c5220[_0x69cc('0x11')];var _0x3c3868=_0x59b74e[_0x69cc('0x12')](-0x1);if(_0x3c3868==='/'||_0x3c3868==='\x5c'||_0x3c3868===':'){_0x59b74e=_0x59b74e[_0x69cc('0x13')](0x0,_0x59b74e[_0x69cc('0x14')](_0x3c3868));}switch(_0x3c5220[_0x69cc('0x15')]){case'US':_0x552c3d=_0x69cc('0x16');break;case'AU':_0x552c3d=_0x69cc('0x17');break;case'IN':_0x552c3d=_0x69cc('0x18');break;case'CN':_0x552c3d=_0x69cc('0x19');break;default:_0x552c3d=_0x69cc('0x1a');break;}var _0x375544={'method':'POST','uri':_0x552c3d+_0x69cc('0x1b'),'form':{'grant_type':_0x69cc('0x1c'),'client_id':_0x3c5220[_0x69cc('0xd')],'client_secret':_0x3c5220[_0x69cc('0xe')],'redirect_uri':_0x3c5220[_0x69cc('0x11')],'code':_0x3c5220[_0x69cc('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x375544)[_0x69cc('0x1d')](function(_0x17194c){var _0x2c31de=JSON[_0x69cc('0x1e')](_0x17194c);if(_0x2c31de['refresh_token']){_0x3c5220[_0x69cc('0x1f')]=_0x2c31de['refresh_token'];logger[_0x69cc('0x20')](util[_0x69cc('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c5220[_0x69cc('0x22')],_0x3c5220['id']));}else{logger[_0x69cc('0x23')](util[_0x69cc('0x21')](_0x69cc('0x24'),_0x3c5220[_0x69cc('0x22')],_0x3c5220['id']),util[_0x69cc('0x25')](_0x2c31de,{'showHidden':![],'depth':null}));}return _0xbbd82a(null,_0x5a2e);})['catch'](function(_0x8d3f7c){logger[_0x69cc('0x23')](util[_0x69cc('0x21')](_0x69cc('0x24'),_0x3c5220['name'],_0x3c5220['id']),util[_0x69cc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0xbbd82a(_0x8d3f7c);});}else{return _0xbbd82a(null,_0x5a2e);}},'beforeUpdate':function(_0x5941ec,_0x400a43,_0x454762){if(_0x5941ec[_0x69cc('0xc')]('zone')||_0x5941ec[_0x69cc('0xc')](_0x69cc('0x11'))||_0x5941ec[_0x69cc('0xc')](_0x69cc('0xd'))||_0x5941ec[_0x69cc('0xc')](_0x69cc('0xe'))||_0x5941ec[_0x69cc('0xc')]('code')||_0x5941ec['changed'](_0x69cc('0x10'))){var _0x49ac4e,_0x56b407;_0x49ac4e=_0x5941ec[_0x69cc('0x11')];var _0x2a76fc=_0x49ac4e['slice'](-0x1);if(_0x2a76fc==='/'||_0x2a76fc==='\x5c'||_0x2a76fc===':'){_0x49ac4e=_0x49ac4e[_0x69cc('0x13')](0x0,_0x49ac4e[_0x69cc('0x14')](_0x2a76fc));}switch(_0x5941ec[_0x69cc('0x15')]){case'US':_0x56b407=_0x69cc('0x16');break;case'AU':_0x56b407=_0x69cc('0x17');break;case'IN':_0x56b407='https://accounts.zoho.in';break;case'CN':_0x56b407=_0x69cc('0x19');break;default:_0x56b407=_0x69cc('0x1a');break;}var _0x142731={'method':_0x69cc('0x26'),'uri':_0x56b407+_0x69cc('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x5941ec['clientId'],'client_secret':_0x5941ec[_0x69cc('0xe')],'redirect_uri':_0x5941ec[_0x69cc('0x11')],'code':_0x5941ec[_0x69cc('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x142731)[_0x69cc('0x1d')](function(_0x1b4377){var _0x24c1e4=JSON[_0x69cc('0x1e')](_0x1b4377);if(_0x24c1e4[_0x69cc('0x27')]){_0x5941ec[_0x69cc('0x1f')]=_0x24c1e4[_0x69cc('0x27')];logger[_0x69cc('0x20')](util[_0x69cc('0x21')](_0x69cc('0x28'),_0x5941ec[_0x69cc('0x22')],_0x5941ec['id']));}else{logger[_0x69cc('0x23')](util[_0x69cc('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5941ec['name'],_0x5941ec['id']),util[_0x69cc('0x25')](_0x24c1e4,{'showHidden':![],'depth':null}));}return _0x454762(null,_0x400a43);})['catch'](function(_0x4be6ac){logger['error'](util[_0x69cc('0x21')](_0x69cc('0x24'),_0x5941ec[_0x69cc('0x22')],_0x5941ec['id']),util[_0x69cc('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x454762(_0x4be6ac);});}else{return _0x454762(null,_0x400a43);}}}});}; \ No newline at end of file +var _0x9a15=['api','bluebird','request-promise','../../config/environment','./intZohoAccount.attributes','exports','define','changed','zone','serverUrl','clientId','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','https://accounts.zoho.in','/oauth/v2/token','clientSecret','refreshToken','format','catch','lodash','util','../../config/logger'];(function(_0x478315,_0x276bbc){var _0x5b20f8=function(_0x3bf5ad){while(--_0x3bf5ad){_0x478315['push'](_0x478315['shift']());}};_0x5b20f8(++_0x276bbc);}(_0x9a15,0xca));var _0x59a1=function(_0x19d751,_0x21938e){_0x19d751=_0x19d751-0x0;var _0x337c88=_0x9a15[_0x19d751];return _0x337c88;};'use strict';var _=require(_0x59a1('0x0'));var util=require(_0x59a1('0x1'));var logger=require(_0x59a1('0x2'))(_0x59a1('0x3'));var moment=require('moment');var BPromise=require(_0x59a1('0x4'));var rp=require(_0x59a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x59a1('0x6'));var attributes=require(_0x59a1('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x59a1('0x8')]=function(_0x212eb4,_0x479e81){return _0x212eb4[_0x59a1('0x9')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2132dc,_0x22125e,_0x323acc){if(_0x2132dc[_0x59a1('0xa')](_0x59a1('0xb'))||_0x2132dc['changed'](_0x59a1('0xc'))||_0x2132dc[_0x59a1('0xa')](_0x59a1('0xd'))||_0x2132dc[_0x59a1('0xa')]('clientSecret')||_0x2132dc[_0x59a1('0xa')]('code')||_0x2132dc[_0x59a1('0xa')](_0x59a1('0xe'))){var _0xa6be31,_0x3d75c5;_0xa6be31=_0x2132dc[_0x59a1('0xc')];var _0x5718df=_0xa6be31[_0x59a1('0xf')](-0x1);if(_0x5718df==='/'||_0x5718df==='\x5c'||_0x5718df===':'){_0xa6be31=_0xa6be31[_0x59a1('0x10')](0x0,_0xa6be31[_0x59a1('0x11')](_0x5718df));}switch(_0x2132dc[_0x59a1('0xb')]){case'US':_0x3d75c5=_0x59a1('0x12');break;case'AU':_0x3d75c5=_0x59a1('0x13');break;case'IN':_0x3d75c5='https://accounts.zoho.in';break;case'CN':_0x3d75c5=_0x59a1('0x14');break;default:_0x3d75c5=_0x59a1('0x15');break;}var _0x626d34={'method':_0x59a1('0x16'),'uri':_0x3d75c5+'/oauth/v2/token','form':{'grant_type':_0x59a1('0x17'),'client_id':_0x2132dc[_0x59a1('0xd')],'client_secret':_0x2132dc['clientSecret'],'redirect_uri':_0x2132dc[_0x59a1('0xc')],'code':_0x2132dc[_0x59a1('0x18')]},'headers':{'Content-Type':_0x59a1('0x19')}};return rp(_0x626d34)[_0x59a1('0x1a')](function(_0x4b641c){var _0x3dff34=JSON[_0x59a1('0x1b')](_0x4b641c);if(_0x3dff34['refresh_token']){_0x2132dc['refreshToken']=_0x3dff34[_0x59a1('0x1c')];logger[_0x59a1('0x1d')](util['format'](_0x59a1('0x1e'),_0x2132dc[_0x59a1('0x1f')],_0x2132dc['id']));}else{logger[_0x59a1('0x20')](util['format'](_0x59a1('0x21'),_0x2132dc[_0x59a1('0x1f')],_0x2132dc['id']),util[_0x59a1('0x22')](_0x3dff34,{'showHidden':![],'depth':null}));}return _0x323acc(null,_0x22125e);})['catch'](function(_0x2be9ec){logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2132dc['name'],_0x2132dc['id']),util[_0x59a1('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x323acc(_0x2be9ec);});}else{return _0x323acc(null,_0x22125e);}},'beforeUpdate':function(_0x47eff1,_0x479f83,_0x6e1510){if(_0x47eff1[_0x59a1('0xa')](_0x59a1('0xb'))||_0x47eff1[_0x59a1('0xa')]('serverUrl')||_0x47eff1[_0x59a1('0xa')](_0x59a1('0xd'))||_0x47eff1[_0x59a1('0xa')]('clientSecret')||_0x47eff1['changed']('code')||_0x47eff1['changed'](_0x59a1('0xe'))){var _0xe24ba4,_0x33d83d;_0xe24ba4=_0x47eff1[_0x59a1('0xc')];var _0x4be176=_0xe24ba4[_0x59a1('0xf')](-0x1);if(_0x4be176==='/'||_0x4be176==='\x5c'||_0x4be176===':'){_0xe24ba4=_0xe24ba4[_0x59a1('0x10')](0x0,_0xe24ba4[_0x59a1('0x11')](_0x4be176));}switch(_0x47eff1[_0x59a1('0xb')]){case'US':_0x33d83d='https://accounts.zoho.com';break;case'AU':_0x33d83d=_0x59a1('0x13');break;case'IN':_0x33d83d=_0x59a1('0x23');break;case'CN':_0x33d83d='https://accounts.zoho.com.cn';break;default:_0x33d83d=_0x59a1('0x15');break;}var _0x39655e={'method':'POST','uri':_0x33d83d+_0x59a1('0x24'),'form':{'grant_type':_0x59a1('0x17'),'client_id':_0x47eff1[_0x59a1('0xd')],'client_secret':_0x47eff1[_0x59a1('0x25')],'redirect_uri':_0x47eff1['serverUrl'],'code':_0x47eff1['code']},'headers':{'Content-Type':_0x59a1('0x19')}};return rp(_0x39655e)[_0x59a1('0x1a')](function(_0xbd8164){var _0x2ec137=JSON[_0x59a1('0x1b')](_0xbd8164);if(_0x2ec137[_0x59a1('0x1c')]){_0x47eff1[_0x59a1('0x26')]=_0x2ec137[_0x59a1('0x1c')];logger[_0x59a1('0x1d')](util['format'](_0x59a1('0x1e'),_0x47eff1[_0x59a1('0x1f')],_0x47eff1['id']));}else{logger[_0x59a1('0x20')](util[_0x59a1('0x27')](_0x59a1('0x21'),_0x47eff1[_0x59a1('0x1f')],_0x47eff1['id']),util[_0x59a1('0x22')](_0x2ec137,{'showHidden':![],'depth':null}));}return _0x6e1510(null,_0x479f83);})[_0x59a1('0x28')](function(_0x304ff7){logger[_0x59a1('0x20')](util[_0x59a1('0x27')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x47eff1[_0x59a1('0x1f')],_0x47eff1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x6e1510(_0x304ff7);});}else{return _0x6e1510(null,_0x479f83);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4e1b1ba..2e1ccfe 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 _0x543b=['client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','then','find','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x31cacc,_0x498135){var _0x3e5640=function(_0x4baa72){while(--_0x4baa72){_0x31cacc['push'](_0x31cacc['shift']());}};_0x3e5640(++_0x498135);}(_0x543b,0x18d));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require(_0xb543('0x4'));var db=require(_0xb543('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x6'))(_0xb543('0x7'));var config=require(_0xb543('0x8'));var jayson=require(_0xb543('0x9'));var client=jayson[_0xb543('0xa')][_0xb543('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208c95,_0x338142,_0x21bb48){return new BPromise(function(_0x307a74,_0x2a2c1f){return client[_0xb543('0xc')](_0x208c95,_0x21bb48)['then'](function(_0xa94776){logger['info'](_0xb543('0xd'),_0x338142,_0xb543('0xe'));logger[_0xb543('0xf')](_0xb543('0x10'),_0x338142,_0xb543('0xe'),JSON[_0xb543('0x11')](_0xa94776));if(_0xa94776['error']){if(_0xa94776[_0xb543('0x12')][_0xb543('0x13')]===0x1f4){logger[_0xb543('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x2a2c1f(_0xa94776[_0xb543('0x12')]['message']);}logger['error'](_0xb543('0xd'),_0x338142,_0xa94776[_0xb543('0x12')][_0xb543('0x14')]);return _0x307a74(_0xa94776[_0xb543('0x12')]['message']);}else{logger[_0xb543('0x15')](_0xb543('0xd'),_0x338142,_0xb543('0xe'));_0x307a74(_0xa94776[_0xb543('0x16')]['message']);}})[_0xb543('0x17')](function(_0x5230df){logger[_0xb543('0x12')](_0xb543('0xd'),_0x338142,_0x5230df);_0x2a2c1f(_0x5230df);});});}exports[_0xb543('0x18')]=function(_0x13e268){var _0x595818=this;return new Promise(function(_0x399ce8,_0x403bea){return db[_0xb543('0x19')]['findAll']({'raw':_0x13e268['options']?_0x13e268[_0xb543('0x1a')][_0xb543('0x1b')]===undefined?!![]:![]:!![],'where':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1c')]||null:null,'attributes':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1d')]||null:null,'limit':_0x13e268['options']?_0x13e268[_0xb543('0x1a')][_0xb543('0x1e')]||null:null,'include':_0x13e268[_0xb543('0x1a')]?_0x13e268[_0xb543('0x1a')][_0xb543('0x1f')]?_[_0xb543('0x20')](_0x13e268['options']['include'],function(_0x5d4ac2){return{'model':db[_0x5d4ac2['model']],'as':_0x5d4ac2['as'],'attributes':_0x5d4ac2[_0xb543('0x1d')],'include':_0x5d4ac2[_0xb543('0x1f')]?_['map'](_0x5d4ac2['include'],function(_0x426969){return{'model':db[_0x426969[_0xb543('0x21')]],'as':_0x426969['as'],'attributes':_0x426969[_0xb543('0x1d')],'include':_0x426969['include']?_[_0xb543('0x20')](_0x426969['include'],function(_0x2ee119){return{'model':db[_0x2ee119[_0xb543('0x21')]],'as':_0x2ee119['as'],'attributes':_0x2ee119[_0xb543('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb543('0x22')](function(_0x27f68f){logger['info'](_0xb543('0x18'),_0x13e268);logger['debug']('GetZohoAccount',_0x13e268,JSON[_0xb543('0x11')](_0x27f68f));_0x399ce8(_0x27f68f);})[_0xb543('0x17')](function(_0x3cb2ed){logger[_0xb543('0x12')](_0xb543('0x18'),_0x3cb2ed[_0xb543('0x14')],_0x13e268);_0x403bea(_0x595818['error'](0x1f4,_0x3cb2ed[_0xb543('0x14')]));});});};exports['ShowZohoAccount']=function(_0x376fb6){var _0xf47fe4=this;return new Promise(function(_0x2830a8,_0x44f62c){return db['ZohoAccount'][_0xb543('0x23')]({'raw':_0x376fb6['options']?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1b')]===undefined?!![]:![]:!![],'where':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')]['where']||null:null,'attributes':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1d')]||null:null,'include':_0x376fb6[_0xb543('0x1a')]?_0x376fb6[_0xb543('0x1a')][_0xb543('0x1f')]?_['map'](_0x376fb6[_0xb543('0x1a')][_0xb543('0x1f')],function(_0xbe3807){return{'model':db[_0xbe3807['model']],'as':_0xbe3807['as'],'attributes':_0xbe3807['attributes'],'include':_0xbe3807[_0xb543('0x1f')]?_[_0xb543('0x20')](_0xbe3807[_0xb543('0x1f')],function(_0x2ff717){return{'model':db[_0x2ff717[_0xb543('0x21')]],'as':_0x2ff717['as'],'attributes':_0x2ff717[_0xb543('0x1d')],'include':_0x2ff717[_0xb543('0x1f')]?_[_0xb543('0x20')](_0x2ff717[_0xb543('0x1f')],function(_0x5c4ad0){return{'model':db[_0x5c4ad0[_0xb543('0x21')]],'as':_0x5c4ad0['as'],'attributes':_0x5c4ad0[_0xb543('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fb62e){logger[_0xb543('0x15')](_0xb543('0x24'),_0x376fb6);logger['debug'](_0xb543('0x24'),_0x376fb6,JSON[_0xb543('0x11')](_0x2fb62e));_0x2830a8(_0x2fb62e);})['catch'](function(_0xcc59d9){logger[_0xb543('0x12')](_0xb543('0x24'),_0xcc59d9['message'],_0x376fb6);_0x44f62c(_0xf47fe4['error'](0x1f4,_0xcc59d9[_0xb543('0x14')]));});});}; \ No newline at end of file +var _0x5360=['ZohoAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','find','ShowZohoAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5360,0x157));var _0x0536=function(_0x10ca01,_0x184f53){_0x10ca01=_0x10ca01-0x0;var _0x3624be=_0x5360[_0x10ca01];return _0x3624be;};'use strict';var _=require(_0x0536('0x0'));var util=require(_0x0536('0x1'));var moment=require(_0x0536('0x2'));var BPromise=require(_0x0536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0536('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0536('0x5'))(_0x0536('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19c89e,_0x1122a2,_0x27cac6){return new BPromise(function(_0x4974ad,_0x180b94){return client[_0x0536('0x8')](_0x19c89e,_0x27cac6)[_0x0536('0x9')](function(_0x5b78e2){logger[_0x0536('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x1122a2,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1122a2,_0x0536('0xb'),JSON[_0x0536('0xc')](_0x5b78e2));if(_0x5b78e2[_0x0536('0xd')]){if(_0x5b78e2[_0x0536('0xd')][_0x0536('0xe')]===0x1f4){logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);return _0x180b94(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}logger[_0x0536('0xd')](_0x0536('0xf'),_0x1122a2,_0x5b78e2['error'][_0x0536('0x10')]);return _0x4974ad(_0x5b78e2[_0x0536('0xd')][_0x0536('0x10')]);}else{logger[_0x0536('0xa')](_0x0536('0xf'),_0x1122a2,'request\x20sent');_0x4974ad(_0x5b78e2[_0x0536('0x11')][_0x0536('0x10')]);}})[_0x0536('0x12')](function(_0x1ff4f9){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1122a2,_0x1ff4f9);_0x180b94(_0x1ff4f9);});});}exports[_0x0536('0x13')]=function(_0x25fb28){var _0x193286=this;return new Promise(function(_0x5c676c,_0x585970){return db[_0x0536('0x14')][_0x0536('0x15')]({'raw':_0x25fb28['options']?_0x25fb28[_0x0536('0x16')][_0x0536('0x17')]===undefined?!![]:![]:!![],'where':_0x25fb28[_0x0536('0x16')]?_0x25fb28[_0x0536('0x16')][_0x0536('0x18')]||null:null,'attributes':_0x25fb28['options']?_0x25fb28[_0x0536('0x16')]['attributes']||null:null,'limit':_0x25fb28['options']?_0x25fb28[_0x0536('0x16')][_0x0536('0x19')]||null:null,'include':_0x25fb28[_0x0536('0x16')]?_0x25fb28[_0x0536('0x16')][_0x0536('0x1a')]?_[_0x0536('0x1b')](_0x25fb28[_0x0536('0x16')]['include'],function(_0x475b87){return{'model':db[_0x475b87[_0x0536('0x1c')]],'as':_0x475b87['as'],'attributes':_0x475b87['attributes'],'include':_0x475b87[_0x0536('0x1a')]?_[_0x0536('0x1b')](_0x475b87[_0x0536('0x1a')],function(_0x4e3287){return{'model':db[_0x4e3287[_0x0536('0x1c')]],'as':_0x4e3287['as'],'attributes':_0x4e3287[_0x0536('0x1d')],'include':_0x4e3287[_0x0536('0x1a')]?_['map'](_0x4e3287[_0x0536('0x1a')],function(_0x334b46){return{'model':db[_0x334b46[_0x0536('0x1c')]],'as':_0x334b46['as'],'attributes':_0x334b46[_0x0536('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0536('0x9')](function(_0x83fa55){logger[_0x0536('0xa')](_0x0536('0x13'),_0x25fb28);logger[_0x0536('0x1e')](_0x0536('0x13'),_0x25fb28,JSON['stringify'](_0x83fa55));_0x5c676c(_0x83fa55);})[_0x0536('0x12')](function(_0x36d4d7){logger['error'](_0x0536('0x13'),_0x36d4d7[_0x0536('0x10')],_0x25fb28);_0x585970(_0x193286[_0x0536('0xd')](0x1f4,_0x36d4d7[_0x0536('0x10')]));});});};exports['ShowZohoAccount']=function(_0x2e5ad0){var _0x562ce1=this;return new Promise(function(_0x4a74d3,_0x2d8700){return db[_0x0536('0x14')][_0x0536('0x1f')]({'raw':_0x2e5ad0[_0x0536('0x16')]?_0x2e5ad0[_0x0536('0x16')][_0x0536('0x17')]===undefined?!![]:![]:!![],'where':_0x2e5ad0['options']?_0x2e5ad0[_0x0536('0x16')][_0x0536('0x18')]||null:null,'attributes':_0x2e5ad0['options']?_0x2e5ad0[_0x0536('0x16')]['attributes']||null:null,'include':_0x2e5ad0[_0x0536('0x16')]?_0x2e5ad0[_0x0536('0x16')][_0x0536('0x1a')]?_[_0x0536('0x1b')](_0x2e5ad0[_0x0536('0x16')][_0x0536('0x1a')],function(_0x4a07f5){return{'model':db[_0x4a07f5[_0x0536('0x1c')]],'as':_0x4a07f5['as'],'attributes':_0x4a07f5['attributes'],'include':_0x4a07f5['include']?_[_0x0536('0x1b')](_0x4a07f5[_0x0536('0x1a')],function(_0x931a3a){return{'model':db[_0x931a3a['model']],'as':_0x931a3a['as'],'attributes':_0x931a3a[_0x0536('0x1d')],'include':_0x931a3a[_0x0536('0x1a')]?_[_0x0536('0x1b')](_0x931a3a[_0x0536('0x1a')],function(_0x368b91){return{'model':db[_0x368b91['model']],'as':_0x368b91['as'],'attributes':_0x368b91[_0x0536('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0536('0x9')](function(_0x1897d3){logger[_0x0536('0xa')](_0x0536('0x20'),_0x2e5ad0);logger['debug'](_0x0536('0x20'),_0x2e5ad0,JSON['stringify'](_0x1897d3));_0x4a74d3(_0x1897d3);})[_0x0536('0x12')](function(_0x413ee8){logger[_0x0536('0xd')]('ShowZohoAccount',_0x413ee8[_0x0536('0x10')],_0x2e5ad0);_0x2d8700(_0x562ce1[_0x0536('0xd')](0x1f4,_0x413ee8[_0x0536('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3d5a0cf..b28f45b 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 _0xc5a4=['post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc5a4,0xc5));var _0x4c5a=function(_0x49b18f,_0x579a0e){_0x49b18f=_0x49b18f-0x0;var _0x584f63=_0xc5a4[_0x49b18f];return _0x584f63;};'use strict';var multer=require(_0x4c5a('0x0'));var util=require(_0x4c5a('0x1'));var path=require(_0x4c5a('0x2'));var timeout=require(_0x4c5a('0x3'));var express=require(_0x4c5a('0x4'));var router=express['Router']();var fs_extra=require(_0x4c5a('0x5'));var auth=require(_0x4c5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c5a('0x7'));var controller=require(_0x4c5a('0x8'));router[_0x4c5a('0x9')]('/',auth[_0x4c5a('0xa')](),controller[_0x4c5a('0xb')]);router[_0x4c5a('0x9')](_0x4c5a('0xc'),auth['isAuthenticated'](),controller[_0x4c5a('0xd')]);router['get'](_0x4c5a('0xe'),auth[_0x4c5a('0xa')](),controller[_0x4c5a('0xf')]);router[_0x4c5a('0x9')](_0x4c5a('0x10'),auth[_0x4c5a('0xa')](),controller['getSubjects']);router[_0x4c5a('0x9')](_0x4c5a('0x11'),auth['isAuthenticated'](),controller[_0x4c5a('0x12')]);router[_0x4c5a('0x13')]('/',auth['isAuthenticated'](),controller[_0x4c5a('0x14')]);router[_0x4c5a('0x15')](_0x4c5a('0xc'),auth['isAuthenticated'](),controller[_0x4c5a('0x16')]);router[_0x4c5a('0x17')](_0x4c5a('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd295=['/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','create'];(function(_0x144be7,_0x5e79a0){var _0x25df53=function(_0x3bc19e){while(--_0x3bc19e){_0x144be7['push'](_0x144be7['shift']());}};_0x25df53(++_0x5e79a0);}(_0xd295,0x1bb));var _0x5d29=function(_0x292df5,_0x5eace1){_0x292df5=_0x292df5-0x0;var _0x5ee807=_0xd295[_0x292df5];return _0x5ee807;};'use strict';var multer=require(_0x5d29('0x0'));var util=require(_0x5d29('0x1'));var path=require(_0x5d29('0x2'));var timeout=require(_0x5d29('0x3'));var express=require(_0x5d29('0x4'));var router=express[_0x5d29('0x5')]();var fs_extra=require(_0x5d29('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5d29('0x7'));var config=require(_0x5d29('0x8'));var controller=require('./intZohoConfiguration.controller');router[_0x5d29('0x9')]('/',auth[_0x5d29('0xa')](),controller[_0x5d29('0xb')]);router[_0x5d29('0x9')]('/:id',auth[_0x5d29('0xa')](),controller[_0x5d29('0xc')]);router[_0x5d29('0x9')](_0x5d29('0xd'),auth['isAuthenticated'](),controller[_0x5d29('0xe')]);router[_0x5d29('0x9')]('/:id/subjects',auth[_0x5d29('0xa')](),controller[_0x5d29('0xf')]);router[_0x5d29('0x9')]('/:id/descriptions',auth[_0x5d29('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x5d29('0x10')]);router['put'](_0x5d29('0x11'),auth[_0x5d29('0xa')](),controller[_0x5d29('0x12')]);router['delete'](_0x5d29('0x11'),auth[_0x5d29('0xa')](),controller[_0x5d29('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index b61f130..c3818ea 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 _0xa208=['exports','STRING','ENUM','lead','nothing','contact_lead','contact'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xa208,0x1e3));var _0x8a20=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xa208[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require('sequelize');module[_0x8a20('0x0')]={'name':{'type':Sequelize[_0x8a20('0x1')]},'moduleCreate':{'type':Sequelize[_0x8a20('0x2')](_0x8a20('0x3'),'contact',_0x8a20('0x4')),'defaultValue':_0x8a20('0x3')},'moduleSearch':{'type':Sequelize[_0x8a20('0x2')](_0x8a20('0x5'),_0x8a20('0x6'),_0x8a20('0x3')),'defaultValue':_0x8a20('0x5')},'description':{'type':Sequelize[_0x8a20('0x1')]}}; \ No newline at end of file +var _0x6b9e=['STRING','ENUM','contact','nothing','contact_lead','lead','exports'];(function(_0x512738,_0x52ef6b){var _0x1bdb2b=function(_0x24d1ff){while(--_0x24d1ff){_0x512738['push'](_0x512738['shift']());}};_0x1bdb2b(++_0x52ef6b);}(_0x6b9e,0x16b));var _0xe6b9=function(_0x29c3a9,_0x150076){_0x29c3a9=_0x29c3a9-0x0;var _0x2b1f5b=_0x6b9e[_0x29c3a9];return _0x2b1f5b;};'use strict';var Sequelize=require('sequelize');module[_0xe6b9('0x0')]={'name':{'type':Sequelize[_0xe6b9('0x1')]},'moduleCreate':{'type':Sequelize[_0xe6b9('0x2')]('lead',_0xe6b9('0x3'),_0xe6b9('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe6b9('0x2')](_0xe6b9('0x5'),'contact',_0xe6b9('0x6')),'defaultValue':_0xe6b9('0x5')},'description':{'type':Sequelize[_0xe6b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 053a06c..de539f1 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 _0x92d3=['apply','reject','save','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','update','params','body','destroy','getFields','findOne','order','sort','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92d3,0x117));var _0x392d=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x92d3[_0x1e3671];return _0x48d5f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x392d('0x0'));var zipdir=require(_0x392d('0x1'));var jsonpatch=require(_0x392d('0x2'));var rp=require('request-promise');var moment=require(_0x392d('0x3'));var BPromise=require(_0x392d('0x4'));var Mustache=require(_0x392d('0x5'));var util=require(_0x392d('0x6'));var path=require(_0x392d('0x7'));var sox=require(_0x392d('0x8'));var csv=require(_0x392d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x392d('0xa'));var _=require(_0x392d('0xb'));var squel=require(_0x392d('0xc'));var crypto=require('crypto');var jsforce=require(_0x392d('0xd'));var deskjs=require(_0x392d('0xe'));var toCsv=require(_0x392d('0x9'));var querystring=require('querystring');var Papa=require(_0x392d('0xf'));var Redis=require(_0x392d('0x10'));var authService=require(_0x392d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x392d('0x12'));var logger=require(_0x392d('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x392d('0x14'));var licenseUtil=require(_0x392d('0x15'));var db=require(_0x392d('0x16'))['db'];function respondWithStatusCode(_0x5ea442,_0x3369f2){_0x3369f2=_0x3369f2||0xcc;return function(_0x1b985f){if(_0x1b985f){return _0x5ea442[_0x392d('0x17')](_0x3369f2);}return _0x5ea442[_0x392d('0x18')](_0x3369f2)[_0x392d('0x19')]();};}function respondWithResult(_0x1f80f1,_0x4ad052){_0x4ad052=_0x4ad052||0xc8;return function(_0x1626e6){if(_0x1626e6){return _0x1f80f1[_0x392d('0x18')](_0x4ad052)[_0x392d('0x1a')](_0x1626e6);}};}function respondWithFilteredResult(_0x61a6ee,_0xd20b5a){return function(_0x3af1b8){if(_0x3af1b8){var _0xb2c0a2=typeof _0xd20b5a[_0x392d('0x1b')]===_0x392d('0x1c')&&typeof _0xd20b5a[_0x392d('0x1d')]===_0x392d('0x1c');var _0xa17a80=_0x3af1b8[_0x392d('0x1e')];var _0x5c0949=_0xb2c0a2?0x0:_0xd20b5a[_0x392d('0x1b')];var _0xd8601e=_0xb2c0a2?_0x3af1b8[_0x392d('0x1e')]:_0xd20b5a['offset']+_0xd20b5a[_0x392d('0x1d')];var _0x343fb2;if(_0xd8601e>=_0xa17a80){_0xd8601e=_0xa17a80;_0x343fb2=0xc8;}else{_0x343fb2=0xce;}_0x61a6ee[_0x392d('0x18')](_0x343fb2);return _0x61a6ee[_0x392d('0x1f')](_0x392d('0x20'),_0x5c0949+'-'+_0xd8601e+'/'+_0xa17a80)[_0x392d('0x1a')](_0x3af1b8);}return null;};}function patchUpdates(_0x482804){return function(_0x36d951){try{jsonpatch[_0x392d('0x21')](_0x36d951,_0x482804,!![]);}catch(_0x545d9f){return BPromise[_0x392d('0x22')](_0x545d9f);}return _0x36d951[_0x392d('0x23')]();};}function saveUpdates(_0x494eab,_0x3fa22a){return function(_0x422094){if(_0x422094){return _0x422094['update'](_0x494eab)['then'](function(_0x1fc259){return _0x1fc259;});}return null;};}function removeEntity(_0x37d826,_0x352b8a){return function(_0x173a07){if(_0x173a07){return _0x173a07['destroy']()[_0x392d('0x24')](function(){_0x37d826[_0x392d('0x18')](0xcc)[_0x392d('0x19')]();});}};}function handleEntityNotFound(_0xf0b98b,_0x3fb308){return function(_0xbc5c2f){if(!_0xbc5c2f){_0xf0b98b['sendStatus'](0x194);}return _0xbc5c2f;};}function handleError(_0x1a2203,_0x56626f){_0x56626f=_0x56626f||0x1f4;return function(_0x16f4d7){logger[_0x392d('0x25')](_0x16f4d7[_0x392d('0x26')]);if(_0x16f4d7[_0x392d('0x27')]){delete _0x16f4d7[_0x392d('0x27')];}_0x1a2203[_0x392d('0x18')](_0x56626f)[_0x392d('0x28')](_0x16f4d7);};}exports[_0x392d('0x29')]=function(_0x29b37f,_0x87d80c){var _0x2446ca={},_0x1a6bab={},_0x266aea={'count':0x0,'rows':[]};var _0x7db2af=_[_0x392d('0x2a')](db[_0x392d('0x2b')][_0x392d('0x2c')],function(_0x52fb62){return{'name':_0x52fb62['fieldName'],'type':_0x52fb62[_0x392d('0x2d')][_0x392d('0x2e')]};});_0x1a6bab[_0x392d('0x2f')]=_[_0x392d('0x2a')](_0x7db2af,_0x392d('0x27'));_0x1a6bab[_0x392d('0x30')]=_[_0x392d('0x31')](_0x29b37f[_0x392d('0x30')]);_0x1a6bab[_0x392d('0x32')]=_['intersection'](_0x1a6bab[_0x392d('0x2f')],_0x1a6bab[_0x392d('0x30')]);_0x2446ca['attributes']=_[_0x392d('0x33')](_0x1a6bab['model'],qs[_0x392d('0x34')](_0x29b37f[_0x392d('0x30')]['fields']));_0x2446ca[_0x392d('0x35')]=_0x2446ca[_0x392d('0x35')][_0x392d('0x36')]?_0x2446ca[_0x392d('0x35')]:_0x1a6bab['model'];if(!_0x29b37f['query']['hasOwnProperty'](_0x392d('0x37'))){_0x2446ca[_0x392d('0x1d')]=qs['limit'](_0x29b37f[_0x392d('0x30')][_0x392d('0x1d')]);_0x2446ca['offset']=qs['offset'](_0x29b37f[_0x392d('0x30')][_0x392d('0x1b')]);}_0x2446ca['order']=qs['sort'](_0x29b37f[_0x392d('0x30')]['sort']);_0x2446ca[_0x392d('0x38')]=qs[_0x392d('0x32')](_[_0x392d('0x39')](_0x29b37f[_0x392d('0x30')],_0x1a6bab[_0x392d('0x32')]),_0x7db2af);if(_0x29b37f[_0x392d('0x30')][_0x392d('0x3a')]){_0x2446ca[_0x392d('0x38')]=_[_0x392d('0x3b')](_0x2446ca[_0x392d('0x38')],{'$or':_[_0x392d('0x2a')](_0x7db2af,function(_0x3c8cce){if(_0x3c8cce['type']!==_0x392d('0x3c')){var _0xac9cb4={};_0xac9cb4[_0x3c8cce['name']]={'$like':'%'+_0x29b37f[_0x392d('0x30')]['filter']+'%'};return _0xac9cb4;}})});}_0x2446ca=_[_0x392d('0x3b')]({},_0x2446ca,_0x29b37f[_0x392d('0x3d')]);var _0x4ee171={'where':_0x2446ca[_0x392d('0x38')]};return db['ZohoConfiguration'][_0x392d('0x1e')](_0x4ee171)[_0x392d('0x24')](function(_0x3c4a69){_0x266aea[_0x392d('0x1e')]=_0x3c4a69;if(_0x29b37f[_0x392d('0x30')][_0x392d('0x3e')]){_0x2446ca[_0x392d('0x3f')]=[{'all':!![]}];}return db[_0x392d('0x2b')]['findAll'](_0x2446ca);})[_0x392d('0x24')](function(_0x30f93f){_0x266aea['rows']=_0x30f93f;return _0x266aea;})['then'](respondWithFilteredResult(_0x87d80c,_0x2446ca))[_0x392d('0x40')](handleError(_0x87d80c,null));};exports['show']=function(_0x4a30d7,_0x2973eb){var _0x50b846={'raw':![],'where':{'id':_0x4a30d7['params']['id']}},_0x59f132={};_0x59f132[_0x392d('0x2f')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x59f132[_0x392d('0x30')]=_[_0x392d('0x31')](_0x4a30d7[_0x392d('0x30')]);_0x59f132[_0x392d('0x32')]=_[_0x392d('0x33')](_0x59f132[_0x392d('0x2f')],_0x59f132[_0x392d('0x30')]);_0x50b846[_0x392d('0x35')]=_['intersection'](_0x59f132[_0x392d('0x2f')],qs[_0x392d('0x34')](_0x4a30d7[_0x392d('0x30')]['fields']));_0x50b846[_0x392d('0x35')]=_0x50b846[_0x392d('0x35')][_0x392d('0x36')]?_0x50b846['attributes']:_0x59f132[_0x392d('0x2f')];if(_0x4a30d7[_0x392d('0x30')][_0x392d('0x3e')]){_0x50b846[_0x392d('0x3f')]=[{'all':!![]}];}_0x50b846=_[_0x392d('0x3b')]({},_0x50b846,_0x4a30d7[_0x392d('0x3d')]);return db[_0x392d('0x2b')][_0x392d('0x41')](_0x50b846)[_0x392d('0x24')](handleEntityNotFound(_0x2973eb,null))[_0x392d('0x24')](respondWithResult(_0x2973eb,null))[_0x392d('0x40')](handleError(_0x2973eb,null));};exports[_0x392d('0x42')]=function(_0x22dbb8,_0x4846d4){return db[_0x392d('0x2b')]['create'](_0x22dbb8['body'],{})[_0x392d('0x24')](respondWithResult(_0x4846d4,0xc9))['catch'](handleError(_0x4846d4,null));};exports[_0x392d('0x43')]=function(_0x3f6b07,_0x209536){if(_0x3f6b07['body']['id']){delete _0x3f6b07['body']['id'];}return db[_0x392d('0x2b')][_0x392d('0x41')]({'where':{'id':_0x3f6b07[_0x392d('0x44')]['id']}})[_0x392d('0x24')](handleEntityNotFound(_0x209536,null))[_0x392d('0x24')](saveUpdates(_0x3f6b07[_0x392d('0x45')],null))['then'](respondWithResult(_0x209536,null))['catch'](handleError(_0x209536,null));};exports[_0x392d('0x46')]=function(_0x45edef,_0x2ba221){return db[_0x392d('0x2b')][_0x392d('0x41')]({'where':{'id':_0x45edef[_0x392d('0x44')]['id']}})[_0x392d('0x24')](handleEntityNotFound(_0x2ba221,null))[_0x392d('0x24')](removeEntity(_0x2ba221,null))[_0x392d('0x40')](handleError(_0x2ba221,null));};exports[_0x392d('0x47')]=function(_0x7efd24,_0x2e9dc9,_0x12e404){var _0x51812f={};var _0x5c4982={};var _0x392081;var _0x1ccd93;return db[_0x392d('0x2b')][_0x392d('0x48')]({'where':{'id':_0x7efd24[_0x392d('0x44')]['id']}})[_0x392d('0x24')](handleEntityNotFound(_0x2e9dc9,null))[_0x392d('0x24')](function(_0x139d06){if(_0x139d06){_0x392081=_0x139d06;_0x5c4982['model']=_['keys'](db['ZohoField'][_0x392d('0x2c')]);_0x5c4982[_0x392d('0x30')]=_[_0x392d('0x31')](_0x7efd24[_0x392d('0x30')]);_0x5c4982[_0x392d('0x32')]=_[_0x392d('0x33')](_0x5c4982[_0x392d('0x2f')],_0x5c4982[_0x392d('0x30')]);_0x51812f['attributes']=_[_0x392d('0x33')](_0x5c4982['model'],qs[_0x392d('0x34')](_0x7efd24['query']['fields']));_0x51812f[_0x392d('0x35')]=_0x51812f[_0x392d('0x35')][_0x392d('0x36')]?_0x51812f[_0x392d('0x35')]:_0x5c4982[_0x392d('0x2f')];_0x51812f[_0x392d('0x49')]=qs[_0x392d('0x4a')](_0x7efd24[_0x392d('0x30')]['sort']);_0x51812f[_0x392d('0x38')]=qs[_0x392d('0x32')](_['pick'](_0x7efd24[_0x392d('0x30')],_0x5c4982[_0x392d('0x32')]));if(_0x7efd24['query'][_0x392d('0x3a')]){_0x51812f[_0x392d('0x38')]=_[_0x392d('0x3b')](_0x51812f[_0x392d('0x38')],{'$or':_[_0x392d('0x2a')](_0x51812f[_0x392d('0x35')],function(_0x5adc58){var _0x28621b={};_0x28621b[_0x5adc58]={'$like':'%'+_0x7efd24[_0x392d('0x30')][_0x392d('0x3a')]+'%'};return _0x28621b;})});}_0x51812f=_[_0x392d('0x3b')]({},_0x51812f,_0x7efd24['options']);return _0x392081['getFields'](_0x51812f);}})[_0x392d('0x24')](function(_0x5dc4a3){if(_0x5dc4a3){_0x1ccd93=_0x5dc4a3[_0x392d('0x36')];if(!_0x7efd24['query'][_0x392d('0x4b')](_0x392d('0x37'))){_0x51812f['limit']=qs[_0x392d('0x1d')](_0x7efd24[_0x392d('0x30')][_0x392d('0x1d')]);_0x51812f[_0x392d('0x1b')]=qs['offset'](_0x7efd24[_0x392d('0x30')]['offset']);}return _0x392081[_0x392d('0x47')](_0x51812f);}})['then'](function(_0xfd0236){if(_0xfd0236){return _0xfd0236?{'count':_0x1ccd93,'rows':_0xfd0236}:null;}})[_0x392d('0x24')](respondWithResult(_0x2e9dc9,null))[_0x392d('0x40')](handleError(_0x2e9dc9,null));};exports[_0x392d('0x4c')]=function(_0x22773d,_0x218699,_0x4e60a0){var _0x4233ef={};var _0x5ee837={};var _0x3b3f30;var _0x1bd5df;return db[_0x392d('0x2b')][_0x392d('0x48')]({'where':{'id':_0x22773d[_0x392d('0x44')]['id']}})[_0x392d('0x24')](handleEntityNotFound(_0x218699,null))[_0x392d('0x24')](function(_0x51e4ed){if(_0x51e4ed){_0x3b3f30=_0x51e4ed;_0x5ee837[_0x392d('0x2f')]=_[_0x392d('0x31')](db['ZohoField']['rawAttributes']);_0x5ee837['query']=_['keys'](_0x22773d[_0x392d('0x30')]);_0x5ee837[_0x392d('0x32')]=_[_0x392d('0x33')](_0x5ee837['model'],_0x5ee837[_0x392d('0x30')]);_0x4233ef['attributes']=_['intersection'](_0x5ee837[_0x392d('0x2f')],qs[_0x392d('0x34')](_0x22773d[_0x392d('0x30')][_0x392d('0x34')]));_0x4233ef[_0x392d('0x35')]=_0x4233ef[_0x392d('0x35')][_0x392d('0x36')]?_0x4233ef[_0x392d('0x35')]:_0x5ee837[_0x392d('0x2f')];_0x4233ef[_0x392d('0x49')]=qs[_0x392d('0x4a')](_0x22773d['query']['sort']);_0x4233ef['where']=qs[_0x392d('0x32')](_[_0x392d('0x39')](_0x22773d['query'],_0x5ee837[_0x392d('0x32')]));if(_0x22773d[_0x392d('0x30')][_0x392d('0x3a')]){_0x4233ef[_0x392d('0x38')]=_[_0x392d('0x3b')](_0x4233ef[_0x392d('0x38')],{'$or':_[_0x392d('0x2a')](_0x4233ef[_0x392d('0x35')],function(_0x5a2e4f){var _0x5eedfd={};_0x5eedfd[_0x5a2e4f]={'$like':'%'+_0x22773d[_0x392d('0x30')][_0x392d('0x3a')]+'%'};return _0x5eedfd;})});}_0x4233ef=_[_0x392d('0x3b')]({},_0x4233ef,_0x22773d[_0x392d('0x3d')]);return _0x3b3f30[_0x392d('0x4c')](_0x4233ef);}})[_0x392d('0x24')](function(_0xa19795){if(_0xa19795){_0x1bd5df=_0xa19795[_0x392d('0x36')];if(!_0x22773d[_0x392d('0x30')]['hasOwnProperty'](_0x392d('0x37'))){_0x4233ef[_0x392d('0x1d')]=qs['limit'](_0x22773d[_0x392d('0x30')][_0x392d('0x1d')]);_0x4233ef[_0x392d('0x1b')]=qs[_0x392d('0x1b')](_0x22773d[_0x392d('0x30')]['offset']);}return _0x3b3f30[_0x392d('0x4c')](_0x4233ef);}})['then'](function(_0x5c0e66){if(_0x5c0e66){return _0x5c0e66?{'count':_0x1bd5df,'rows':_0x5c0e66}:null;}})['then'](respondWithResult(_0x218699,null))[_0x392d('0x40')](handleError(_0x218699,null));};exports[_0x392d('0x4d')]=function(_0x532123,_0x560e5c,_0x3bc989){var _0x585fab={};var _0x35cbd7={};var _0x1834b8;var _0x25eedf;return db[_0x392d('0x2b')][_0x392d('0x48')]({'where':{'id':_0x532123[_0x392d('0x44')]['id']}})['then'](handleEntityNotFound(_0x560e5c,null))[_0x392d('0x24')](function(_0x30c682){if(_0x30c682){_0x1834b8=_0x30c682;_0x35cbd7[_0x392d('0x2f')]=_[_0x392d('0x31')](db['ZohoField'][_0x392d('0x2c')]);_0x35cbd7['query']=_[_0x392d('0x31')](_0x532123[_0x392d('0x30')]);_0x35cbd7[_0x392d('0x32')]=_[_0x392d('0x33')](_0x35cbd7[_0x392d('0x2f')],_0x35cbd7[_0x392d('0x30')]);_0x585fab[_0x392d('0x35')]=_['intersection'](_0x35cbd7[_0x392d('0x2f')],qs[_0x392d('0x34')](_0x532123['query'][_0x392d('0x34')]));_0x585fab[_0x392d('0x35')]=_0x585fab[_0x392d('0x35')][_0x392d('0x36')]?_0x585fab[_0x392d('0x35')]:_0x35cbd7['model'];_0x585fab[_0x392d('0x49')]=qs[_0x392d('0x4a')](_0x532123[_0x392d('0x30')][_0x392d('0x4a')]);_0x585fab['where']=qs[_0x392d('0x32')](_[_0x392d('0x39')](_0x532123['query'],_0x35cbd7['filters']));if(_0x532123[_0x392d('0x30')][_0x392d('0x3a')]){_0x585fab[_0x392d('0x38')]=_[_0x392d('0x3b')](_0x585fab['where'],{'$or':_[_0x392d('0x2a')](_0x585fab[_0x392d('0x35')],function(_0x69520b){var _0x1cbe37={};_0x1cbe37[_0x69520b]={'$like':'%'+_0x532123[_0x392d('0x30')][_0x392d('0x3a')]+'%'};return _0x1cbe37;})});}_0x585fab=_['merge']({},_0x585fab,_0x532123[_0x392d('0x3d')]);return _0x1834b8['getDescriptions'](_0x585fab);}})[_0x392d('0x24')](function(_0x3b5550){if(_0x3b5550){_0x25eedf=_0x3b5550[_0x392d('0x36')];if(!_0x532123[_0x392d('0x30')][_0x392d('0x4b')](_0x392d('0x37'))){_0x585fab[_0x392d('0x1d')]=qs[_0x392d('0x1d')](_0x532123[_0x392d('0x30')][_0x392d('0x1d')]);_0x585fab[_0x392d('0x1b')]=qs[_0x392d('0x1b')](_0x532123[_0x392d('0x30')][_0x392d('0x1b')]);}return _0x1834b8['getDescriptions'](_0x585fab);}})['then'](function(_0x1a1563){if(_0x1a1563){return _0x1a1563?{'count':_0x25eedf,'rows':_0x1a1563}:null;}})[_0x392d('0x24')](respondWithResult(_0x560e5c,null))[_0x392d('0x40')](handleError(_0x560e5c,null));}; \ No newline at end of file +var _0xb5a3=['limit','Content-Range','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','rows','catch','show','params','include','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x245f04,_0x164ee4){var _0x4533eb=function(_0x3a2caa){while(--_0x3a2caa){_0x245f04['push'](_0x245f04['shift']());}};_0x4533eb(++_0x164ee4);}(_0xb5a3,0x169));var _0x3b5a=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xb5a3[_0x49cb71];return _0x3a50fd;};'use strict';var emlformat=require(_0x3b5a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b5a('0x1'));var jsonpatch=require(_0x3b5a('0x2'));var rp=require(_0x3b5a('0x3'));var moment=require(_0x3b5a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b5a('0x5'));var util=require(_0x3b5a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3b5a('0x7'));var ejs=require(_0x3b5a('0x8'));var fs=require('fs');var fs_extra=require(_0x3b5a('0x9'));var _=require(_0x3b5a('0xa'));var squel=require('squel');var crypto=require(_0x3b5a('0xb'));var jsforce=require(_0x3b5a('0xc'));var deskjs=require(_0x3b5a('0xd'));var toCsv=require(_0x3b5a('0x7'));var querystring=require(_0x3b5a('0xe'));var Papa=require(_0x3b5a('0xf'));var Redis=require('ioredis');var authService=require(_0x3b5a('0x10'));var qs=require(_0x3b5a('0x11'));var as=require(_0x3b5a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b5a('0x13'))(_0x3b5a('0x14'));var utils=require(_0x3b5a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3b5a('0x16'))['db'];function respondWithStatusCode(_0x1f08ea,_0x2afe6c){_0x2afe6c=_0x2afe6c||0xcc;return function(_0x386d83){if(_0x386d83){return _0x1f08ea[_0x3b5a('0x17')](_0x2afe6c);}return _0x1f08ea[_0x3b5a('0x18')](_0x2afe6c)[_0x3b5a('0x19')]();};}function respondWithResult(_0x37b331,_0x3904fb){_0x3904fb=_0x3904fb||0xc8;return function(_0x5546a8){if(_0x5546a8){return _0x37b331[_0x3b5a('0x18')](_0x3904fb)[_0x3b5a('0x1a')](_0x5546a8);}};}function respondWithFilteredResult(_0x3fb86a,_0x578f3d){return function(_0x52cee1){if(_0x52cee1){var _0x2a77e0=typeof _0x578f3d[_0x3b5a('0x1b')]===_0x3b5a('0x1c')&&typeof _0x578f3d[_0x3b5a('0x1d')]===_0x3b5a('0x1c');var _0x46a701=_0x52cee1['count'];var _0x266ec4=_0x2a77e0?0x0:_0x578f3d[_0x3b5a('0x1b')];var _0x8afe36=_0x2a77e0?_0x52cee1['count']:_0x578f3d[_0x3b5a('0x1b')]+_0x578f3d['limit'];var _0x4b0177;if(_0x8afe36>=_0x46a701){_0x8afe36=_0x46a701;_0x4b0177=0xc8;}else{_0x4b0177=0xce;}_0x3fb86a['status'](_0x4b0177);return _0x3fb86a['set'](_0x3b5a('0x1e'),_0x266ec4+'-'+_0x8afe36+'/'+_0x46a701)[_0x3b5a('0x1a')](_0x52cee1);}return null;};}function patchUpdates(_0x2af0c2){return function(_0x5b049f){try{jsonpatch['apply'](_0x5b049f,_0x2af0c2,!![]);}catch(_0x223372){return BPromise[_0x3b5a('0x1f')](_0x223372);}return _0x5b049f[_0x3b5a('0x20')]();};}function saveUpdates(_0x1f6b5d,_0x42220e){return function(_0x123af7){if(_0x123af7){return _0x123af7[_0x3b5a('0x21')](_0x1f6b5d)[_0x3b5a('0x22')](function(_0x336449){return _0x336449;});}return null;};}function removeEntity(_0x54d827,_0x87fe60){return function(_0xa1cf50){if(_0xa1cf50){return _0xa1cf50[_0x3b5a('0x23')]()[_0x3b5a('0x22')](function(){_0x54d827[_0x3b5a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa26bc7,_0xbe4b4d){return function(_0x22ce47){if(!_0x22ce47){_0xa26bc7[_0x3b5a('0x17')](0x194);}return _0x22ce47;};}function handleError(_0x588a4a,_0x2f7eaf){_0x2f7eaf=_0x2f7eaf||0x1f4;return function(_0x277c5b){logger['error'](_0x277c5b[_0x3b5a('0x24')]);if(_0x277c5b[_0x3b5a('0x25')]){delete _0x277c5b[_0x3b5a('0x25')];}_0x588a4a[_0x3b5a('0x18')](_0x2f7eaf)['send'](_0x277c5b);};}exports[_0x3b5a('0x26')]=function(_0x455309,_0x204c6a){var _0xbc2a63={},_0x1921f9={},_0x5345da={'count':0x0,'rows':[]};var _0x143277=_[_0x3b5a('0x27')](db['ZohoConfiguration'][_0x3b5a('0x28')],function(_0x57918c){return{'name':_0x57918c[_0x3b5a('0x29')],'type':_0x57918c[_0x3b5a('0x2a')][_0x3b5a('0x2b')]};});_0x1921f9['model']=_[_0x3b5a('0x27')](_0x143277,_0x3b5a('0x25'));_0x1921f9[_0x3b5a('0x2c')]=_[_0x3b5a('0x2d')](_0x455309['query']);_0x1921f9[_0x3b5a('0x2e')]=_[_0x3b5a('0x2f')](_0x1921f9[_0x3b5a('0x30')],_0x1921f9[_0x3b5a('0x2c')]);_0xbc2a63[_0x3b5a('0x31')]=_[_0x3b5a('0x2f')](_0x1921f9[_0x3b5a('0x30')],qs[_0x3b5a('0x32')](_0x455309[_0x3b5a('0x2c')][_0x3b5a('0x32')]));_0xbc2a63[_0x3b5a('0x31')]=_0xbc2a63[_0x3b5a('0x31')][_0x3b5a('0x33')]?_0xbc2a63[_0x3b5a('0x31')]:_0x1921f9['model'];if(!_0x455309[_0x3b5a('0x2c')][_0x3b5a('0x34')](_0x3b5a('0x35'))){_0xbc2a63[_0x3b5a('0x1d')]=qs['limit'](_0x455309[_0x3b5a('0x2c')]['limit']);_0xbc2a63['offset']=qs[_0x3b5a('0x1b')](_0x455309['query'][_0x3b5a('0x1b')]);}_0xbc2a63[_0x3b5a('0x36')]=qs[_0x3b5a('0x37')](_0x455309['query'][_0x3b5a('0x37')]);_0xbc2a63['where']=qs[_0x3b5a('0x2e')](_[_0x3b5a('0x38')](_0x455309['query'],_0x1921f9[_0x3b5a('0x2e')]),_0x143277);if(_0x455309[_0x3b5a('0x2c')][_0x3b5a('0x39')]){_0xbc2a63[_0x3b5a('0x3a')]=_[_0x3b5a('0x3b')](_0xbc2a63[_0x3b5a('0x3a')],{'$or':_[_0x3b5a('0x27')](_0x143277,function(_0x2d9a51){if(_0x2d9a51[_0x3b5a('0x2a')]!==_0x3b5a('0x3c')){var _0xf1c725={};_0xf1c725[_0x2d9a51[_0x3b5a('0x25')]]={'$like':'%'+_0x455309['query'][_0x3b5a('0x39')]+'%'};return _0xf1c725;}})});}_0xbc2a63=_['merge']({},_0xbc2a63,_0x455309[_0x3b5a('0x3d')]);var _0x402b02={'where':_0xbc2a63['where']};return db[_0x3b5a('0x3e')]['count'](_0x402b02)[_0x3b5a('0x22')](function(_0x40ab1c){_0x5345da[_0x3b5a('0x3f')]=_0x40ab1c;if(_0x455309['query'][_0x3b5a('0x40')]){_0xbc2a63['include']=[{'all':!![]}];}return db[_0x3b5a('0x3e')]['findAll'](_0xbc2a63);})[_0x3b5a('0x22')](function(_0x131457){_0x5345da[_0x3b5a('0x41')]=_0x131457;return _0x5345da;})[_0x3b5a('0x22')](respondWithFilteredResult(_0x204c6a,_0xbc2a63))[_0x3b5a('0x42')](handleError(_0x204c6a,null));};exports[_0x3b5a('0x43')]=function(_0x237b1b,_0x104492){var _0xd946a4={'raw':![],'where':{'id':_0x237b1b[_0x3b5a('0x44')]['id']}},_0x12ae8b={};_0x12ae8b['model']=_[_0x3b5a('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x12ae8b[_0x3b5a('0x2c')]=_[_0x3b5a('0x2d')](_0x237b1b[_0x3b5a('0x2c')]);_0x12ae8b[_0x3b5a('0x2e')]=_['intersection'](_0x12ae8b[_0x3b5a('0x30')],_0x12ae8b[_0x3b5a('0x2c')]);_0xd946a4[_0x3b5a('0x31')]=_[_0x3b5a('0x2f')](_0x12ae8b[_0x3b5a('0x30')],qs['fields'](_0x237b1b[_0x3b5a('0x2c')]['fields']));_0xd946a4[_0x3b5a('0x31')]=_0xd946a4[_0x3b5a('0x31')][_0x3b5a('0x33')]?_0xd946a4[_0x3b5a('0x31')]:_0x12ae8b[_0x3b5a('0x30')];if(_0x237b1b['query'][_0x3b5a('0x40')]){_0xd946a4[_0x3b5a('0x45')]=[{'all':!![]}];}_0xd946a4=_['merge']({},_0xd946a4,_0x237b1b['options']);return db[_0x3b5a('0x3e')][_0x3b5a('0x46')](_0xd946a4)[_0x3b5a('0x22')](handleEntityNotFound(_0x104492,null))[_0x3b5a('0x22')](respondWithResult(_0x104492,null))['catch'](handleError(_0x104492,null));};exports[_0x3b5a('0x47')]=function(_0x9ee262,_0x1542dd){return db[_0x3b5a('0x3e')][_0x3b5a('0x47')](_0x9ee262[_0x3b5a('0x48')],{})[_0x3b5a('0x22')](respondWithResult(_0x1542dd,0xc9))[_0x3b5a('0x42')](handleError(_0x1542dd,null));};exports['update']=function(_0x432410,_0x4868ca){if(_0x432410[_0x3b5a('0x48')]['id']){delete _0x432410[_0x3b5a('0x48')]['id'];}return db[_0x3b5a('0x3e')][_0x3b5a('0x46')]({'where':{'id':_0x432410[_0x3b5a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4868ca,null))[_0x3b5a('0x22')](saveUpdates(_0x432410['body'],null))['then'](respondWithResult(_0x4868ca,null))[_0x3b5a('0x42')](handleError(_0x4868ca,null));};exports[_0x3b5a('0x23')]=function(_0x57ff9e,_0x456663){return db['ZohoConfiguration']['find']({'where':{'id':_0x57ff9e[_0x3b5a('0x44')]['id']}})[_0x3b5a('0x22')](handleEntityNotFound(_0x456663,null))[_0x3b5a('0x22')](removeEntity(_0x456663,null))[_0x3b5a('0x42')](handleError(_0x456663,null));};exports[_0x3b5a('0x49')]=function(_0x39dd76,_0xfbbcf0,_0x1c6b98){var _0x2adff8={};var _0x5ae0da={};var _0x251b13;var _0x30f3c6;return db[_0x3b5a('0x3e')][_0x3b5a('0x4a')]({'where':{'id':_0x39dd76[_0x3b5a('0x44')]['id']}})[_0x3b5a('0x22')](handleEntityNotFound(_0xfbbcf0,null))['then'](function(_0x393611){if(_0x393611){_0x251b13=_0x393611;_0x5ae0da['model']=_['keys'](db[_0x3b5a('0x4b')][_0x3b5a('0x28')]);_0x5ae0da[_0x3b5a('0x2c')]=_[_0x3b5a('0x2d')](_0x39dd76[_0x3b5a('0x2c')]);_0x5ae0da[_0x3b5a('0x2e')]=_[_0x3b5a('0x2f')](_0x5ae0da['model'],_0x5ae0da[_0x3b5a('0x2c')]);_0x2adff8['attributes']=_[_0x3b5a('0x2f')](_0x5ae0da[_0x3b5a('0x30')],qs[_0x3b5a('0x32')](_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x32')]));_0x2adff8['attributes']=_0x2adff8[_0x3b5a('0x31')][_0x3b5a('0x33')]?_0x2adff8['attributes']:_0x5ae0da[_0x3b5a('0x30')];_0x2adff8[_0x3b5a('0x36')]=qs[_0x3b5a('0x37')](_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x37')]);_0x2adff8[_0x3b5a('0x3a')]=qs[_0x3b5a('0x2e')](_[_0x3b5a('0x38')](_0x39dd76['query'],_0x5ae0da[_0x3b5a('0x2e')]));if(_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x39')]){_0x2adff8[_0x3b5a('0x3a')]=_['merge'](_0x2adff8[_0x3b5a('0x3a')],{'$or':_['map'](_0x2adff8['attributes'],function(_0x478709){var _0x416467={};_0x416467[_0x478709]={'$like':'%'+_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x39')]+'%'};return _0x416467;})});}_0x2adff8=_[_0x3b5a('0x3b')]({},_0x2adff8,_0x39dd76[_0x3b5a('0x3d')]);return _0x251b13[_0x3b5a('0x49')](_0x2adff8);}})['then'](function(_0x2d0ac0){if(_0x2d0ac0){_0x30f3c6=_0x2d0ac0['length'];if(!_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x34')](_0x3b5a('0x35'))){_0x2adff8[_0x3b5a('0x1d')]=qs[_0x3b5a('0x1d')](_0x39dd76[_0x3b5a('0x2c')][_0x3b5a('0x1d')]);_0x2adff8[_0x3b5a('0x1b')]=qs['offset'](_0x39dd76[_0x3b5a('0x2c')]['offset']);}return _0x251b13[_0x3b5a('0x49')](_0x2adff8);}})[_0x3b5a('0x22')](function(_0x3711db){if(_0x3711db){return _0x3711db?{'count':_0x30f3c6,'rows':_0x3711db}:null;}})[_0x3b5a('0x22')](respondWithResult(_0xfbbcf0,null))[_0x3b5a('0x42')](handleError(_0xfbbcf0,null));};exports['getSubjects']=function(_0x1254b2,_0x241d36,_0xfde309){var _0x5d7f8a={};var _0x21175b={};var _0x29a899;var _0x21d082;return db[_0x3b5a('0x3e')][_0x3b5a('0x4a')]({'where':{'id':_0x1254b2[_0x3b5a('0x44')]['id']}})[_0x3b5a('0x22')](handleEntityNotFound(_0x241d36,null))[_0x3b5a('0x22')](function(_0x49035f){if(_0x49035f){_0x29a899=_0x49035f;_0x21175b['model']=_[_0x3b5a('0x2d')](db[_0x3b5a('0x4b')][_0x3b5a('0x28')]);_0x21175b[_0x3b5a('0x2c')]=_[_0x3b5a('0x2d')](_0x1254b2[_0x3b5a('0x2c')]);_0x21175b[_0x3b5a('0x2e')]=_['intersection'](_0x21175b['model'],_0x21175b['query']);_0x5d7f8a['attributes']=_['intersection'](_0x21175b[_0x3b5a('0x30')],qs['fields'](_0x1254b2[_0x3b5a('0x2c')][_0x3b5a('0x32')]));_0x5d7f8a[_0x3b5a('0x31')]=_0x5d7f8a['attributes']['length']?_0x5d7f8a[_0x3b5a('0x31')]:_0x21175b[_0x3b5a('0x30')];_0x5d7f8a['order']=qs['sort'](_0x1254b2[_0x3b5a('0x2c')][_0x3b5a('0x37')]);_0x5d7f8a[_0x3b5a('0x3a')]=qs[_0x3b5a('0x2e')](_[_0x3b5a('0x38')](_0x1254b2[_0x3b5a('0x2c')],_0x21175b[_0x3b5a('0x2e')]));if(_0x1254b2[_0x3b5a('0x2c')][_0x3b5a('0x39')]){_0x5d7f8a[_0x3b5a('0x3a')]=_['merge'](_0x5d7f8a[_0x3b5a('0x3a')],{'$or':_['map'](_0x5d7f8a['attributes'],function(_0x235e6b){var _0xa006a0={};_0xa006a0[_0x235e6b]={'$like':'%'+_0x1254b2['query'][_0x3b5a('0x39')]+'%'};return _0xa006a0;})});}_0x5d7f8a=_['merge']({},_0x5d7f8a,_0x1254b2[_0x3b5a('0x3d')]);return _0x29a899[_0x3b5a('0x4c')](_0x5d7f8a);}})[_0x3b5a('0x22')](function(_0x538521){if(_0x538521){_0x21d082=_0x538521['length'];if(!_0x1254b2[_0x3b5a('0x2c')][_0x3b5a('0x34')](_0x3b5a('0x35'))){_0x5d7f8a['limit']=qs['limit'](_0x1254b2[_0x3b5a('0x2c')][_0x3b5a('0x1d')]);_0x5d7f8a[_0x3b5a('0x1b')]=qs[_0x3b5a('0x1b')](_0x1254b2['query']['offset']);}return _0x29a899[_0x3b5a('0x4c')](_0x5d7f8a);}})[_0x3b5a('0x22')](function(_0x3c910f){if(_0x3c910f){return _0x3c910f?{'count':_0x21d082,'rows':_0x3c910f}:null;}})[_0x3b5a('0x22')](respondWithResult(_0x241d36,null))['catch'](handleError(_0x241d36,null));};exports['getDescriptions']=function(_0x43b5c0,_0xf14c4,_0x1b3945){var _0x425d64={};var _0x3f9bdb={};var _0x317bde;var _0x510879;return db[_0x3b5a('0x3e')][_0x3b5a('0x4a')]({'where':{'id':_0x43b5c0[_0x3b5a('0x44')]['id']}})[_0x3b5a('0x22')](handleEntityNotFound(_0xf14c4,null))[_0x3b5a('0x22')](function(_0x31f4cd){if(_0x31f4cd){_0x317bde=_0x31f4cd;_0x3f9bdb[_0x3b5a('0x30')]=_['keys'](db['ZohoField'][_0x3b5a('0x28')]);_0x3f9bdb[_0x3b5a('0x2c')]=_[_0x3b5a('0x2d')](_0x43b5c0[_0x3b5a('0x2c')]);_0x3f9bdb['filters']=_[_0x3b5a('0x2f')](_0x3f9bdb[_0x3b5a('0x30')],_0x3f9bdb[_0x3b5a('0x2c')]);_0x425d64[_0x3b5a('0x31')]=_[_0x3b5a('0x2f')](_0x3f9bdb[_0x3b5a('0x30')],qs[_0x3b5a('0x32')](_0x43b5c0['query'][_0x3b5a('0x32')]));_0x425d64['attributes']=_0x425d64[_0x3b5a('0x31')][_0x3b5a('0x33')]?_0x425d64[_0x3b5a('0x31')]:_0x3f9bdb[_0x3b5a('0x30')];_0x425d64[_0x3b5a('0x36')]=qs['sort'](_0x43b5c0['query'][_0x3b5a('0x37')]);_0x425d64[_0x3b5a('0x3a')]=qs[_0x3b5a('0x2e')](_[_0x3b5a('0x38')](_0x43b5c0['query'],_0x3f9bdb['filters']));if(_0x43b5c0[_0x3b5a('0x2c')][_0x3b5a('0x39')]){_0x425d64[_0x3b5a('0x3a')]=_[_0x3b5a('0x3b')](_0x425d64[_0x3b5a('0x3a')],{'$or':_[_0x3b5a('0x27')](_0x425d64[_0x3b5a('0x31')],function(_0x3961af){var _0x2dac98={};_0x2dac98[_0x3961af]={'$like':'%'+_0x43b5c0['query'][_0x3b5a('0x39')]+'%'};return _0x2dac98;})});}_0x425d64=_['merge']({},_0x425d64,_0x43b5c0[_0x3b5a('0x3d')]);return _0x317bde[_0x3b5a('0x4d')](_0x425d64);}})[_0x3b5a('0x22')](function(_0xed1806){if(_0xed1806){_0x510879=_0xed1806[_0x3b5a('0x33')];if(!_0x43b5c0[_0x3b5a('0x2c')][_0x3b5a('0x34')](_0x3b5a('0x35'))){_0x425d64['limit']=qs[_0x3b5a('0x1d')](_0x43b5c0[_0x3b5a('0x2c')][_0x3b5a('0x1d')]);_0x425d64[_0x3b5a('0x1b')]=qs[_0x3b5a('0x1b')](_0x43b5c0[_0x3b5a('0x2c')][_0x3b5a('0x1b')]);}return _0x317bde[_0x3b5a('0x4d')](_0x425d64);}})[_0x3b5a('0x22')](function(_0xfe9dc2){if(_0xfe9dc2){return _0xfe9dc2?{'count':_0x510879,'rows':_0xfe9dc2}:null;}})[_0x3b5a('0x22')](respondWithResult(_0xf14c4,null))[_0x3b5a('0x42')](handleError(_0xf14c4,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a4bd465..63e9a29 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 _0x345c=['bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','api','moment'];(function(_0x3f7b4b,_0x1c8d09){var _0x34bfb8=function(_0x5f389f){while(--_0x5f389f){_0x3f7b4b['push'](_0x3f7b4b['shift']());}};_0x34bfb8(++_0x1c8d09);}(_0x345c,0x1ad));var _0xc345=function(_0x382628,_0x1d505a){_0x382628=_0x382628-0x0;var _0x169384=_0x345c[_0x382628];return _0x169384;};'use strict';var _=require(_0xc345('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc345('0x1'));var moment=require(_0xc345('0x2'));var BPromise=require(_0xc345('0x3'));var rp=require(_0xc345('0x4'));var fs=require('fs');var path=require(_0xc345('0x5'));var rimraf=require('rimraf');var config=require(_0xc345('0x6'));var attributes=require(_0xc345('0x7'));module[_0xc345('0x8')]=function(_0x2b449f,_0x36aa93){return _0x2b449f[_0xc345('0x9')](_0xc345('0xa'),attributes,{'tableName':_0xc345('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fca=['define','ZohoConfiguration','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x2fca,0xe6));var _0xa2fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fca[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xa2fc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2fc('0x1'));var moment=require(_0xa2fc('0x2'));var BPromise=require(_0xa2fc('0x3'));var rp=require(_0xa2fc('0x4'));var fs=require('fs');var path=require(_0xa2fc('0x5'));var rimraf=require(_0xa2fc('0x6'));var config=require(_0xa2fc('0x7'));var attributes=require(_0xa2fc('0x8'));module[_0xa2fc('0x9')]=function(_0x1c58f7,_0x43bde8){return _0x1c58f7[_0xa2fc('0xa')](_0xa2fc('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 8aada39..c8737e0 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 _0xf050=['rpc','../../config/environment','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf050,0x169));var _0x0f05=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0xf050[_0x5caabb];return _0x2929d8;};'use strict';var _=require('lodash');var util=require(_0x0f05('0x0'));var moment=require(_0x0f05('0x1'));var BPromise=require(_0x0f05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f05('0x3'));var db=require(_0x0f05('0x4'))['db'];var utils=require(_0x0f05('0x5'));var logger=require(_0x0f05('0x6'))(_0x0f05('0x7'));var config=require(_0x0f05('0x8'));var jayson=require(_0x0f05('0x9'));var client=jayson[_0x0f05('0xa')][_0x0f05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41430f,_0x259bd5,_0x97a5c6){return new BPromise(function(_0x4f5eab,_0xd929f7){return client[_0x0f05('0xc')](_0x41430f,_0x97a5c6)['then'](function(_0x413341){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x259bd5,'request\x20sent');logger['debug'](_0x0f05('0xd'),_0x259bd5,_0x0f05('0xe'),JSON[_0x0f05('0xf')](_0x413341));if(_0x413341[_0x0f05('0x10')]){if(_0x413341[_0x0f05('0x10')][_0x0f05('0x11')]===0x1f4){logger['error'](_0x0f05('0x12'),_0x259bd5,_0x413341[_0x0f05('0x10')][_0x0f05('0x13')]);return _0xd929f7(_0x413341[_0x0f05('0x10')][_0x0f05('0x13')]);}logger[_0x0f05('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x259bd5,_0x413341['error'][_0x0f05('0x13')]);return _0x4f5eab(_0x413341[_0x0f05('0x10')][_0x0f05('0x13')]);}else{logger[_0x0f05('0x14')](_0x0f05('0x12'),_0x259bd5,_0x0f05('0xe'));_0x4f5eab(_0x413341[_0x0f05('0x15')]['message']);}})[_0x0f05('0x16')](function(_0x5ac3c1){logger['error'](_0x0f05('0x12'),_0x259bd5,_0x5ac3c1);_0xd929f7(_0x5ac3c1);});});} \ No newline at end of file +var _0xcda1=['request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x9861b9,_0x23397d){var _0x740f43=function(_0x25672c){while(--_0x25672c){_0x9861b9['push'](_0x9861b9['shift']());}};_0x740f43(++_0x23397d);}(_0xcda1,0x112));var _0x1cda=function(_0x31aa0d,_0x51baa2){_0x31aa0d=_0x31aa0d-0x0;var _0x82db50=_0xcda1[_0x31aa0d];return _0x82db50;};'use strict';var _=require(_0x1cda('0x0'));var util=require(_0x1cda('0x1'));var moment=require(_0x1cda('0x2'));var BPromise=require('bluebird');var rs=require(_0x1cda('0x3'));var fs=require('fs');var Redis=require(_0x1cda('0x4'));var db=require(_0x1cda('0x5'))['db'];var utils=require(_0x1cda('0x6'));var logger=require(_0x1cda('0x7'))('rpc');var config=require(_0x1cda('0x8'));var jayson=require(_0x1cda('0x9'));var client=jayson[_0x1cda('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9300c,_0x3ec9ae,_0x300151){return new BPromise(function(_0x48b160,_0x5dd5e9){return client[_0x1cda('0xb')](_0xd9300c,_0x300151)[_0x1cda('0xc')](function(_0x511566){logger['info'](_0x1cda('0xd'),_0x3ec9ae,_0x1cda('0xe'));logger[_0x1cda('0xf')](_0x1cda('0x10'),_0x3ec9ae,_0x1cda('0xe'),JSON[_0x1cda('0x11')](_0x511566));if(_0x511566[_0x1cda('0x12')]){if(_0x511566['error'][_0x1cda('0x13')]===0x1f4){logger[_0x1cda('0x12')](_0x1cda('0xd'),_0x3ec9ae,_0x511566[_0x1cda('0x12')][_0x1cda('0x14')]);return _0x5dd5e9(_0x511566['error'][_0x1cda('0x14')]);}logger[_0x1cda('0x12')](_0x1cda('0xd'),_0x3ec9ae,_0x511566[_0x1cda('0x12')]['message']);return _0x48b160(_0x511566[_0x1cda('0x12')][_0x1cda('0x14')]);}else{logger[_0x1cda('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x3ec9ae,_0x1cda('0xe'));_0x48b160(_0x511566[_0x1cda('0x16')][_0x1cda('0x14')]);}})[_0x1cda('0x17')](function(_0x3db05d){logger['error'](_0x1cda('0xd'),_0x3ec9ae,_0x3db05d);_0x5dd5e9(_0x3db05d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index c1f514b..87c8e24 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 _0xc89e=['express','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','connect-timeout'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xc89e,0xca));var _0xec89=function(_0x468e8d,_0x539229){_0x468e8d=_0x468e8d-0x0;var _0x239684=_0xc89e[_0x468e8d];return _0x239684;};'use strict';var multer=require(_0xec89('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec89('0x1'));var express=require(_0xec89('0x2'));var router=express[_0xec89('0x3')]();var fs_extra=require(_0xec89('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec89('0x5'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xec89('0x6')]('/',auth['isAuthenticated'](),controller[_0xec89('0x7')]);router[_0xec89('0x6')](_0xec89('0x8'),auth[_0xec89('0x9')](),controller[_0xec89('0xa')]);router[_0xec89('0xb')]('/',auth[_0xec89('0x9')](),controller[_0xec89('0xc')]);router['put']('/:id',auth[_0xec89('0x9')](),controller[_0xec89('0xd')]);router[_0xec89('0xe')](_0xec89('0x8'),auth[_0xec89('0x9')](),controller[_0xec89('0xf')]);module[_0xec89('0x10')]=router; \ No newline at end of file +var _0xef79=['multer','util','path','connect-timeout','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1bcbc8,_0x10a03f){var _0x166b4e=function(_0xd589cc){while(--_0xd589cc){_0x1bcbc8['push'](_0x1bcbc8['shift']());}};_0x166b4e(++_0x10a03f);}(_0xef79,0x156));var _0x9ef7=function(_0x131aef,_0x1e6921){_0x131aef=_0x131aef-0x0;var _0x28341f=_0xef79[_0x131aef];return _0x28341f;};'use strict';var multer=require(_0x9ef7('0x0'));var util=require(_0x9ef7('0x1'));var path=require(_0x9ef7('0x2'));var timeout=require(_0x9ef7('0x3'));var express=require('express');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(_0x9ef7('0x4'));var controller=require(_0x9ef7('0x5'));router[_0x9ef7('0x6')]('/',auth[_0x9ef7('0x7')](),controller[_0x9ef7('0x8')]);router['get'](_0x9ef7('0x9'),auth[_0x9ef7('0x7')](),controller[_0x9ef7('0xa')]);router[_0x9ef7('0xb')]('/',auth[_0x9ef7('0x7')](),controller[_0x9ef7('0xc')]);router[_0x9ef7('0xd')]('/:id',auth[_0x9ef7('0x7')](),controller[_0x9ef7('0xe')]);router[_0x9ef7('0xf')](_0x9ef7('0x9'),auth[_0x9ef7('0x7')](),controller[_0x9ef7('0x10')]);module[_0x9ef7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8cc8a3a..ccc7ad2 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 _0x5cbd=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5f025f,_0x420828){var _0x5c1c62=function(_0xb4fae6){while(--_0xb4fae6){_0x5f025f['push'](_0x5f025f['shift']());}};_0x5c1c62(++_0x420828);}(_0x5cbd,0x8f));var _0xd5cb=function(_0x3e4b62,_0x5aec71){_0x3e4b62=_0x3e4b62-0x0;var _0x9aef97=_0x5cbd[_0x3e4b62];return _0x9aef97;};'use strict';var Sequelize=require(_0xd5cb('0x0'));module[_0xd5cb('0x1')]={'type':{'type':Sequelize[_0xd5cb('0x2')](_0xd5cb('0x3'),_0xd5cb('0x4'),_0xd5cb('0x5'),_0xd5cb('0x6'),_0xd5cb('0x7')),'defaultValue':_0xd5cb('0x3')},'content':{'type':Sequelize[_0xd5cb('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd5cb('0x2')]('string',_0xd5cb('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd5cb('0x8')]},'customField':{'type':Sequelize[_0xd5cb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd5cb('0x8')]}}; \ No newline at end of file +var _0xdbec=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x5699ce,_0xd655c1){var _0x2439b1=function(_0x583635){while(--_0x583635){_0x5699ce['push'](_0x5699ce['shift']());}};_0x2439b1(++_0xd655c1);}(_0xdbec,0x155));var _0xcdbe=function(_0x1153be,_0x485b3c){_0x1153be=_0x1153be-0x0;var _0x296101=_0xdbec[_0x1153be];return _0x296101;};'use strict';var Sequelize=require(_0xcdbe('0x0'));module[_0xcdbe('0x1')]={'type':{'type':Sequelize[_0xcdbe('0x2')](_0xcdbe('0x3'),_0xcdbe('0x4'),_0xcdbe('0x5'),_0xcdbe('0x6'),'picklist'),'defaultValue':_0xcdbe('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcdbe('0x7')]},'keyType':{'type':Sequelize[_0xcdbe('0x2')](_0xcdbe('0x3'),_0xcdbe('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xcdbe('0x7')]},'nameField':{'type':Sequelize[_0xcdbe('0x7')]},'customField':{'type':Sequelize[_0xcdbe('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcdbe('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index f35551f..29a4a49 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 _0x49a3=['filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys'];(function(_0x3822c8,_0x498e82){var _0x12e14c=function(_0x1578ee){while(--_0x1578ee){_0x3822c8['push'](_0x3822c8['shift']());}};_0x12e14c(++_0x498e82);}(_0x49a3,0xe6));var _0x349a=function(_0x2717f7,_0xb2dde5){_0x2717f7=_0x2717f7-0x0;var _0x4621e8=_0x49a3[_0x2717f7];return _0x4621e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x349a('0x0'));var zipdir=require(_0x349a('0x1'));var jsonpatch=require(_0x349a('0x2'));var rp=require(_0x349a('0x3'));var moment=require(_0x349a('0x4'));var BPromise=require(_0x349a('0x5'));var Mustache=require(_0x349a('0x6'));var util=require(_0x349a('0x7'));var path=require(_0x349a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x349a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x349a('0xa'));var crypto=require(_0x349a('0xb'));var jsforce=require(_0x349a('0xc'));var deskjs=require(_0x349a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x349a('0xe'));var Papa=require('papaparse');var Redis=require(_0x349a('0xf'));var authService=require(_0x349a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x349a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x349a('0x12'))('api');var utils=require(_0x349a('0x13'));var config=require(_0x349a('0x14'));var licenseUtil=require(_0x349a('0x15'));var db=require(_0x349a('0x16'))['db'];function respondWithStatusCode(_0x1f4379,_0x55f750){_0x55f750=_0x55f750||0xcc;return function(_0x54b1ef){if(_0x54b1ef){return _0x1f4379['sendStatus'](_0x55f750);}return _0x1f4379[_0x349a('0x17')](_0x55f750)['end']();};}function respondWithResult(_0x599e8f,_0x1088f9){_0x1088f9=_0x1088f9||0xc8;return function(_0x41c60d){if(_0x41c60d){return _0x599e8f['status'](_0x1088f9)['json'](_0x41c60d);}};}function respondWithFilteredResult(_0x1a5084,_0x302fba){return function(_0x35313c){if(_0x35313c){var _0x55d4bd=typeof _0x302fba['offset']===_0x349a('0x18')&&typeof _0x302fba[_0x349a('0x19')]===_0x349a('0x18');var _0x503585=_0x35313c['count'];var _0x270919=_0x55d4bd?0x0:_0x302fba[_0x349a('0x1a')];var _0xbe04f4=_0x55d4bd?_0x35313c[_0x349a('0x1b')]:_0x302fba[_0x349a('0x1a')]+_0x302fba[_0x349a('0x19')];var _0x5d4b24;if(_0xbe04f4>=_0x503585){_0xbe04f4=_0x503585;_0x5d4b24=0xc8;}else{_0x5d4b24=0xce;}_0x1a5084[_0x349a('0x17')](_0x5d4b24);return _0x1a5084[_0x349a('0x1c')](_0x349a('0x1d'),_0x270919+'-'+_0xbe04f4+'/'+_0x503585)[_0x349a('0x1e')](_0x35313c);}return null;};}function patchUpdates(_0x2439b7){return function(_0x24b723){try{jsonpatch[_0x349a('0x1f')](_0x24b723,_0x2439b7,!![]);}catch(_0x375b8f){return BPromise[_0x349a('0x20')](_0x375b8f);}return _0x24b723[_0x349a('0x21')]();};}function saveUpdates(_0x282d7e,_0x9bec07){return function(_0x19ae61){if(_0x19ae61){return _0x19ae61[_0x349a('0x22')](_0x282d7e)[_0x349a('0x23')](function(_0x10e2d2){return _0x10e2d2;});}return null;};}function removeEntity(_0x431ddc,_0x3eb886){return function(_0x362c3d){if(_0x362c3d){return _0x362c3d[_0x349a('0x24')]()[_0x349a('0x23')](function(){_0x431ddc['status'](0xcc)[_0x349a('0x25')]();});}};}function handleEntityNotFound(_0x2c64c7,_0x5760c4){return function(_0x369fd1){if(!_0x369fd1){_0x2c64c7[_0x349a('0x26')](0x194);}return _0x369fd1;};}function handleError(_0x20888f,_0x2fd09b){_0x2fd09b=_0x2fd09b||0x1f4;return function(_0x251559){logger['error'](_0x251559['stack']);if(_0x251559[_0x349a('0x27')]){delete _0x251559[_0x349a('0x27')];}_0x20888f[_0x349a('0x17')](_0x2fd09b)[_0x349a('0x28')](_0x251559);};}exports[_0x349a('0x29')]=function(_0x5b3365,_0xdcce4d){var _0x20078b={},_0x55ee50={},_0x540a87={'count':0x0,'rows':[]};var _0x4b826=_[_0x349a('0x2a')](db[_0x349a('0x2b')][_0x349a('0x2c')],function(_0x21b3f4){return{'name':_0x21b3f4['fieldName'],'type':_0x21b3f4[_0x349a('0x2d')][_0x349a('0x2e')]};});_0x55ee50[_0x349a('0x2f')]=_[_0x349a('0x2a')](_0x4b826,_0x349a('0x27'));_0x55ee50[_0x349a('0x30')]=_[_0x349a('0x31')](_0x5b3365[_0x349a('0x30')]);_0x55ee50[_0x349a('0x32')]=_[_0x349a('0x33')](_0x55ee50['model'],_0x55ee50[_0x349a('0x30')]);_0x20078b[_0x349a('0x34')]=_[_0x349a('0x33')](_0x55ee50[_0x349a('0x2f')],qs[_0x349a('0x35')](_0x5b3365[_0x349a('0x30')][_0x349a('0x35')]));_0x20078b['attributes']=_0x20078b[_0x349a('0x34')]['length']?_0x20078b[_0x349a('0x34')]:_0x55ee50[_0x349a('0x2f')];if(!_0x5b3365[_0x349a('0x30')][_0x349a('0x36')]('nolimit')){_0x20078b[_0x349a('0x19')]=qs[_0x349a('0x19')](_0x5b3365[_0x349a('0x30')][_0x349a('0x19')]);_0x20078b[_0x349a('0x1a')]=qs[_0x349a('0x1a')](_0x5b3365[_0x349a('0x30')][_0x349a('0x1a')]);}_0x20078b[_0x349a('0x37')]=qs[_0x349a('0x38')](_0x5b3365[_0x349a('0x30')][_0x349a('0x38')]);_0x20078b[_0x349a('0x39')]=qs['filters'](_['pick'](_0x5b3365[_0x349a('0x30')],_0x55ee50[_0x349a('0x32')]),_0x4b826);if(_0x5b3365['query'][_0x349a('0x3a')]){_0x20078b[_0x349a('0x39')]=_[_0x349a('0x3b')](_0x20078b[_0x349a('0x39')],{'$or':_[_0x349a('0x2a')](_0x4b826,function(_0x48f97e){if(_0x48f97e['type']!==_0x349a('0x3c')){var _0x5e2af2={};_0x5e2af2[_0x48f97e[_0x349a('0x27')]]={'$like':'%'+_0x5b3365[_0x349a('0x30')]['filter']+'%'};return _0x5e2af2;}})});}_0x20078b=_[_0x349a('0x3b')]({},_0x20078b,_0x5b3365[_0x349a('0x3d')]);var _0x4a4507={'where':_0x20078b['where']};return db[_0x349a('0x2b')]['count'](_0x4a4507)['then'](function(_0x223228){_0x540a87['count']=_0x223228;if(_0x5b3365[_0x349a('0x30')]['includeAll']){_0x20078b[_0x349a('0x3e')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x20078b);})[_0x349a('0x23')](function(_0xa0fe72){_0x540a87[_0x349a('0x3f')]=_0xa0fe72;return _0x540a87;})['then'](respondWithFilteredResult(_0xdcce4d,_0x20078b))[_0x349a('0x40')](handleError(_0xdcce4d,null));};exports['show']=function(_0x1c64e9,_0xbb2b0c){var _0x3d4458={'raw':!![],'where':{'id':_0x1c64e9[_0x349a('0x41')]['id']}},_0x38e022={};_0x38e022[_0x349a('0x2f')]=_[_0x349a('0x31')](db[_0x349a('0x2b')][_0x349a('0x2c')]);_0x38e022[_0x349a('0x30')]=_[_0x349a('0x31')](_0x1c64e9[_0x349a('0x30')]);_0x38e022[_0x349a('0x32')]=_[_0x349a('0x33')](_0x38e022[_0x349a('0x2f')],_0x38e022[_0x349a('0x30')]);_0x3d4458[_0x349a('0x34')]=_[_0x349a('0x33')](_0x38e022[_0x349a('0x2f')],qs[_0x349a('0x35')](_0x1c64e9['query'][_0x349a('0x35')]));_0x3d4458[_0x349a('0x34')]=_0x3d4458['attributes']['length']?_0x3d4458[_0x349a('0x34')]:_0x38e022[_0x349a('0x2f')];if(_0x1c64e9[_0x349a('0x30')][_0x349a('0x42')]){_0x3d4458['include']=[{'all':!![]}];}_0x3d4458=_['merge']({},_0x3d4458,_0x1c64e9[_0x349a('0x3d')]);return db[_0x349a('0x2b')][_0x349a('0x43')](_0x3d4458)['then'](handleEntityNotFound(_0xbb2b0c,null))['then'](respondWithResult(_0xbb2b0c,null))[_0x349a('0x40')](handleError(_0xbb2b0c,null));};exports[_0x349a('0x44')]=function(_0x37b950,_0x50f11e){return db['ZohoField'][_0x349a('0x44')](_0x37b950[_0x349a('0x45')],{})['then'](respondWithResult(_0x50f11e,0xc9))[_0x349a('0x40')](handleError(_0x50f11e,null));};exports[_0x349a('0x22')]=function(_0x362ef1,_0x57a775){if(_0x362ef1['body']['id']){delete _0x362ef1[_0x349a('0x45')]['id'];}return db['ZohoField'][_0x349a('0x43')]({'where':{'id':_0x362ef1[_0x349a('0x41')]['id']}})[_0x349a('0x23')](handleEntityNotFound(_0x57a775,null))['then'](saveUpdates(_0x362ef1[_0x349a('0x45')],null))[_0x349a('0x23')](respondWithResult(_0x57a775,null))[_0x349a('0x40')](handleError(_0x57a775,null));};exports[_0x349a('0x24')]=function(_0x5e490e,_0x45b053){return db[_0x349a('0x2b')][_0x349a('0x43')]({'where':{'id':_0x5e490e[_0x349a('0x41')]['id']}})[_0x349a('0x23')](handleEntityNotFound(_0x45b053,null))[_0x349a('0x23')](removeEntity(_0x45b053,null))[_0x349a('0x40')](handleError(_0x45b053,null));}; \ No newline at end of file +var _0xa5a4=['merge','VIRTUAL','filter','options','ZohoField','includeAll','findAll','rows','catch','show','keys','rawAttributes','intersection','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xa5a4,0xaf));var _0x4a5a=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xa5a4[_0x5a2285];return _0x48f6ed;};'use strict';var emlformat=require(_0x4a5a('0x0'));var rimraf=require(_0x4a5a('0x1'));var zipdir=require(_0x4a5a('0x2'));var jsonpatch=require(_0x4a5a('0x3'));var rp=require(_0x4a5a('0x4'));var moment=require(_0x4a5a('0x5'));var BPromise=require(_0x4a5a('0x6'));var Mustache=require(_0x4a5a('0x7'));var util=require(_0x4a5a('0x8'));var path=require(_0x4a5a('0x9'));var sox=require(_0x4a5a('0xa'));var csv=require(_0x4a5a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a5a('0xc'));var _=require(_0x4a5a('0xd'));var squel=require(_0x4a5a('0xe'));var crypto=require(_0x4a5a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x4a5a('0x10'));var toCsv=require(_0x4a5a('0xb'));var querystring=require(_0x4a5a('0x11'));var Papa=require('papaparse');var Redis=require(_0x4a5a('0x12'));var authService=require(_0x4a5a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a5a('0x14'));var logger=require('../../config/logger')(_0x4a5a('0x15'));var utils=require('../../config/utils');var config=require(_0x4a5a('0x16'));var licenseUtil=require(_0x4a5a('0x17'));var db=require(_0x4a5a('0x18'))['db'];function respondWithStatusCode(_0x2b2ca3,_0x4f5d05){_0x4f5d05=_0x4f5d05||0xcc;return function(_0x42af3e){if(_0x42af3e){return _0x2b2ca3[_0x4a5a('0x19')](_0x4f5d05);}return _0x2b2ca3['status'](_0x4f5d05)[_0x4a5a('0x1a')]();};}function respondWithResult(_0x25c659,_0x468892){_0x468892=_0x468892||0xc8;return function(_0x431075){if(_0x431075){return _0x25c659[_0x4a5a('0x1b')](_0x468892)[_0x4a5a('0x1c')](_0x431075);}};}function respondWithFilteredResult(_0x30f2b5,_0x3389a4){return function(_0x14f1ec){if(_0x14f1ec){var _0x4728e2=typeof _0x3389a4[_0x4a5a('0x1d')]==='undefined'&&typeof _0x3389a4[_0x4a5a('0x1e')]==='undefined';var _0x7f46ca=_0x14f1ec[_0x4a5a('0x1f')];var _0x4c2fa2=_0x4728e2?0x0:_0x3389a4['offset'];var _0x59b54c=_0x4728e2?_0x14f1ec['count']:_0x3389a4['offset']+_0x3389a4['limit'];var _0x38661e;if(_0x59b54c>=_0x7f46ca){_0x59b54c=_0x7f46ca;_0x38661e=0xc8;}else{_0x38661e=0xce;}_0x30f2b5[_0x4a5a('0x1b')](_0x38661e);return _0x30f2b5['set'](_0x4a5a('0x20'),_0x4c2fa2+'-'+_0x59b54c+'/'+_0x7f46ca)[_0x4a5a('0x1c')](_0x14f1ec);}return null;};}function patchUpdates(_0x5be26f){return function(_0x49ce9f){try{jsonpatch[_0x4a5a('0x21')](_0x49ce9f,_0x5be26f,!![]);}catch(_0x325eff){return BPromise[_0x4a5a('0x22')](_0x325eff);}return _0x49ce9f[_0x4a5a('0x23')]();};}function saveUpdates(_0x2f985c,_0x48da08){return function(_0x54a79c){if(_0x54a79c){return _0x54a79c['update'](_0x2f985c)[_0x4a5a('0x24')](function(_0x10df82){return _0x10df82;});}return null;};}function removeEntity(_0x17b0fc,_0x445e62){return function(_0x3d1973){if(_0x3d1973){return _0x3d1973[_0x4a5a('0x25')]()[_0x4a5a('0x24')](function(){_0x17b0fc[_0x4a5a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17fc46,_0xa935f9){return function(_0x27ad7c){if(!_0x27ad7c){_0x17fc46[_0x4a5a('0x19')](0x194);}return _0x27ad7c;};}function handleError(_0x44517b,_0x46086d){_0x46086d=_0x46086d||0x1f4;return function(_0x5a8492){logger[_0x4a5a('0x26')](_0x5a8492[_0x4a5a('0x27')]);if(_0x5a8492['name']){delete _0x5a8492[_0x4a5a('0x28')];}_0x44517b[_0x4a5a('0x1b')](_0x46086d)[_0x4a5a('0x29')](_0x5a8492);};}exports[_0x4a5a('0x2a')]=function(_0x123984,_0x43f980){var _0x407c0c={},_0x50933c={},_0x59a59e={'count':0x0,'rows':[]};var _0x67cc2b=_[_0x4a5a('0x2b')](db['ZohoField']['rawAttributes'],function(_0x44fc50){return{'name':_0x44fc50[_0x4a5a('0x2c')],'type':_0x44fc50[_0x4a5a('0x2d')][_0x4a5a('0x2e')]};});_0x50933c[_0x4a5a('0x2f')]=_[_0x4a5a('0x2b')](_0x67cc2b,_0x4a5a('0x28'));_0x50933c[_0x4a5a('0x30')]=_['keys'](_0x123984['query']);_0x50933c[_0x4a5a('0x31')]=_['intersection'](_0x50933c[_0x4a5a('0x2f')],_0x50933c[_0x4a5a('0x30')]);_0x407c0c[_0x4a5a('0x32')]=_['intersection'](_0x50933c[_0x4a5a('0x2f')],qs[_0x4a5a('0x33')](_0x123984[_0x4a5a('0x30')][_0x4a5a('0x33')]));_0x407c0c['attributes']=_0x407c0c['attributes'][_0x4a5a('0x34')]?_0x407c0c[_0x4a5a('0x32')]:_0x50933c[_0x4a5a('0x2f')];if(!_0x123984['query'][_0x4a5a('0x35')](_0x4a5a('0x36'))){_0x407c0c[_0x4a5a('0x1e')]=qs[_0x4a5a('0x1e')](_0x123984[_0x4a5a('0x30')][_0x4a5a('0x1e')]);_0x407c0c[_0x4a5a('0x1d')]=qs[_0x4a5a('0x1d')](_0x123984[_0x4a5a('0x30')][_0x4a5a('0x1d')]);}_0x407c0c[_0x4a5a('0x37')]=qs[_0x4a5a('0x38')](_0x123984[_0x4a5a('0x30')][_0x4a5a('0x38')]);_0x407c0c[_0x4a5a('0x39')]=qs[_0x4a5a('0x31')](_[_0x4a5a('0x3a')](_0x123984[_0x4a5a('0x30')],_0x50933c[_0x4a5a('0x31')]),_0x67cc2b);if(_0x123984['query']['filter']){_0x407c0c[_0x4a5a('0x39')]=_[_0x4a5a('0x3b')](_0x407c0c['where'],{'$or':_[_0x4a5a('0x2b')](_0x67cc2b,function(_0x4c7d17){if(_0x4c7d17[_0x4a5a('0x2d')]!==_0x4a5a('0x3c')){var _0xac1cb2={};_0xac1cb2[_0x4c7d17[_0x4a5a('0x28')]]={'$like':'%'+_0x123984[_0x4a5a('0x30')][_0x4a5a('0x3d')]+'%'};return _0xac1cb2;}})});}_0x407c0c=_[_0x4a5a('0x3b')]({},_0x407c0c,_0x123984[_0x4a5a('0x3e')]);var _0x4ca49a={'where':_0x407c0c[_0x4a5a('0x39')]};return db[_0x4a5a('0x3f')][_0x4a5a('0x1f')](_0x4ca49a)[_0x4a5a('0x24')](function(_0x492bdd){_0x59a59e[_0x4a5a('0x1f')]=_0x492bdd;if(_0x123984['query'][_0x4a5a('0x40')]){_0x407c0c['include']=[{'all':!![]}];}return db[_0x4a5a('0x3f')][_0x4a5a('0x41')](_0x407c0c);})['then'](function(_0x51e3e0){_0x59a59e[_0x4a5a('0x42')]=_0x51e3e0;return _0x59a59e;})[_0x4a5a('0x24')](respondWithFilteredResult(_0x43f980,_0x407c0c))[_0x4a5a('0x43')](handleError(_0x43f980,null));};exports[_0x4a5a('0x44')]=function(_0x22400e,_0x46b75d){var _0x551fd3={'raw':!![],'where':{'id':_0x22400e['params']['id']}},_0x57fa6a={};_0x57fa6a[_0x4a5a('0x2f')]=_[_0x4a5a('0x45')](db['ZohoField'][_0x4a5a('0x46')]);_0x57fa6a[_0x4a5a('0x30')]=_['keys'](_0x22400e[_0x4a5a('0x30')]);_0x57fa6a[_0x4a5a('0x31')]=_[_0x4a5a('0x47')](_0x57fa6a['model'],_0x57fa6a[_0x4a5a('0x30')]);_0x551fd3[_0x4a5a('0x32')]=_[_0x4a5a('0x47')](_0x57fa6a[_0x4a5a('0x2f')],qs[_0x4a5a('0x33')](_0x22400e[_0x4a5a('0x30')][_0x4a5a('0x33')]));_0x551fd3[_0x4a5a('0x32')]=_0x551fd3[_0x4a5a('0x32')][_0x4a5a('0x34')]?_0x551fd3[_0x4a5a('0x32')]:_0x57fa6a[_0x4a5a('0x2f')];if(_0x22400e[_0x4a5a('0x30')]['includeAll']){_0x551fd3[_0x4a5a('0x48')]=[{'all':!![]}];}_0x551fd3=_['merge']({},_0x551fd3,_0x22400e[_0x4a5a('0x3e')]);return db[_0x4a5a('0x3f')][_0x4a5a('0x49')](_0x551fd3)[_0x4a5a('0x24')](handleEntityNotFound(_0x46b75d,null))[_0x4a5a('0x24')](respondWithResult(_0x46b75d,null))[_0x4a5a('0x43')](handleError(_0x46b75d,null));};exports[_0x4a5a('0x4a')]=function(_0x1bd98b,_0xca6ead){return db[_0x4a5a('0x3f')][_0x4a5a('0x4a')](_0x1bd98b[_0x4a5a('0x4b')],{})[_0x4a5a('0x24')](respondWithResult(_0xca6ead,0xc9))[_0x4a5a('0x43')](handleError(_0xca6ead,null));};exports[_0x4a5a('0x4c')]=function(_0x46b324,_0x4c7feb){if(_0x46b324[_0x4a5a('0x4b')]['id']){delete _0x46b324['body']['id'];}return db[_0x4a5a('0x3f')]['find']({'where':{'id':_0x46b324['params']['id']}})[_0x4a5a('0x24')](handleEntityNotFound(_0x4c7feb,null))['then'](saveUpdates(_0x46b324['body'],null))['then'](respondWithResult(_0x4c7feb,null))[_0x4a5a('0x43')](handleError(_0x4c7feb,null));};exports[_0x4a5a('0x25')]=function(_0x28645d,_0x3580fa){return db[_0x4a5a('0x3f')][_0x4a5a('0x49')]({'where':{'id':_0x28645d[_0x4a5a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3580fa,null))[_0x4a5a('0x24')](removeEntity(_0x3580fa,null))[_0x4a5a('0x43')](handleError(_0x3580fa,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9eb4009..a5d15ef 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 _0x627e=['define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xfb282b,_0x4ce42a){var _0x1ac9ba=function(_0x3e7cc5){while(--_0x3e7cc5){_0xfb282b['push'](_0xfb282b['shift']());}};_0x1ac9ba(++_0x4ce42a);}(_0x627e,0x14a));var _0xe627=function(_0x11e458,_0x48d7f9){_0x11e458=_0x11e458-0x0;var _0x140bab=_0x627e[_0x11e458];return _0x140bab;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x1a1a3d,_0x3f2791){return _0x1a1a3d[_0xe627('0x8')](_0xe627('0x9'),attributes,{'tableName':_0xe627('0xa'),'paranoid':![],'indexes':[{'name':_0xe627('0xb'),'fields':['idField',_0xe627('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x5d2f39,_0x11e2f4){var _0x3df8f6=function(_0x50eeaf){while(--_0x50eeaf){_0x5d2f39['push'](_0x5d2f39['shift']());}};_0x3df8f6(++_0x11e2f4);}(_0x5204,0xdf));var _0x4520=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x5204[_0x314a8c];return _0x1d4607;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'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 2a23eb7..8dae36f 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 _0xf256=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util'];(function(_0x26a5ef,_0x19659b){var _0x32d7bd=function(_0x364588){while(--_0x364588){_0x26a5ef['push'](_0x26a5ef['shift']());}};_0x32d7bd(++_0x19659b);}(_0xf256,0x125));var _0x6f25=function(_0x2fa690,_0x4c665e){_0x2fa690=_0x2fa690-0x0;var _0x2d85e3=_0xf256[_0x2fa690];return _0x2d85e3;};'use strict';var _=require('lodash');var util=require(_0x6f25('0x0'));var moment=require(_0x6f25('0x1'));var BPromise=require(_0x6f25('0x2'));var rs=require(_0x6f25('0x3'));var fs=require('fs');var Redis=require(_0x6f25('0x4'));var db=require(_0x6f25('0x5'))['db'];var utils=require(_0x6f25('0x6'));var logger=require(_0x6f25('0x7'))('rpc');var config=require(_0x6f25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f25('0x9')][_0x6f25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c455f,_0x26d881,_0xc48653){return new BPromise(function(_0x1b1760,_0x1eebb5){return client[_0x6f25('0xb')](_0x3c455f,_0xc48653)['then'](function(_0x29ae9a){logger['info'](_0x6f25('0xc'),_0x26d881,'request\x20sent');logger[_0x6f25('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x26d881,_0x6f25('0xe'),JSON[_0x6f25('0xf')](_0x29ae9a));if(_0x29ae9a['error']){if(_0x29ae9a[_0x6f25('0x10')][_0x6f25('0x11')]===0x1f4){logger[_0x6f25('0x10')]('ZohoField,\x20%s,\x20%s',_0x26d881,_0x29ae9a[_0x6f25('0x10')][_0x6f25('0x12')]);return _0x1eebb5(_0x29ae9a[_0x6f25('0x10')][_0x6f25('0x12')]);}logger[_0x6f25('0x10')](_0x6f25('0xc'),_0x26d881,_0x29ae9a[_0x6f25('0x10')][_0x6f25('0x12')]);return _0x1b1760(_0x29ae9a[_0x6f25('0x10')]['message']);}else{logger['info'](_0x6f25('0xc'),_0x26d881,'request\x20sent');_0x1b1760(_0x29ae9a[_0x6f25('0x13')][_0x6f25('0x12')]);}})[_0x6f25('0x14')](function(_0x21acb7){logger[_0x6f25('0x10')](_0x6f25('0xc'),_0x26d881,_0x21acb7);_0x1eebb5(_0x21acb7);});});} \ No newline at end of file +var _0x0bd0=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','moment','../../mysqldb'];(function(_0x3c6ff6,_0x4e136a){var _0x4ac5ba=function(_0x1da29e){while(--_0x1da29e){_0x3c6ff6['push'](_0x3c6ff6['shift']());}};_0x4ac5ba(++_0x4e136a);}(_0x0bd0,0x1a1));var _0x00bd=function(_0x119ded,_0x497e72){_0x119ded=_0x119ded-0x0;var _0x22108b=_0x0bd0[_0x119ded];return _0x22108b;};'use strict';var _=require(_0x00bd('0x0'));var util=require('util');var moment=require(_0x00bd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00bd('0x2'))['db'];var utils=require(_0x00bd('0x3'));var logger=require(_0x00bd('0x4'))(_0x00bd('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00bd('0x6')][_0x00bd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bd74f,_0x2ab472,_0x12086b){return new BPromise(function(_0x5e431e,_0x2c846a){return client[_0x00bd('0x8')](_0x5bd74f,_0x12086b)[_0x00bd('0x9')](function(_0x37c28f){logger[_0x00bd('0xa')]('ZohoField,\x20%s,\x20%s',_0x2ab472,'request\x20sent');logger['debug'](_0x00bd('0xb'),_0x2ab472,_0x00bd('0xc'),JSON[_0x00bd('0xd')](_0x37c28f));if(_0x37c28f['error']){if(_0x37c28f['error'][_0x00bd('0xe')]===0x1f4){logger[_0x00bd('0xf')]('ZohoField,\x20%s,\x20%s',_0x2ab472,_0x37c28f[_0x00bd('0xf')][_0x00bd('0x10')]);return _0x2c846a(_0x37c28f['error'][_0x00bd('0x10')]);}logger[_0x00bd('0xf')]('ZohoField,\x20%s,\x20%s',_0x2ab472,_0x37c28f[_0x00bd('0xf')]['message']);return _0x5e431e(_0x37c28f['error'][_0x00bd('0x10')]);}else{logger[_0x00bd('0xa')](_0x00bd('0x11'),_0x2ab472,_0x00bd('0xc'));_0x5e431e(_0x37c28f[_0x00bd('0x12')][_0x00bd('0x10')]);}})[_0x00bd('0x13')](function(_0x180428){logger[_0x00bd('0xf')](_0x00bd('0x11'),_0x2ab472,_0x180428);_0x2c846a(_0x180428);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 61f0876..ae20e13 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x99a230,_0xe70e96){var _0xd903cf=function(_0x2bf598){while(--_0x2bf598){_0x99a230['push'](_0x99a230['shift']());}};_0xd903cf(++_0xe70e96);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2ce286,_0x4104e4){var _0x4c471f=function(_0x43326c){while(--_0x43326c){_0x2ce286['push'](_0x2ce286['shift']());}};_0x4c471f(++_0x4104e4);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c0af88a..46e388d 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 _0x8985=['sequelize','exports','STRING','app.js','BOOLEAN','state'];(function(_0x558705,_0x3257da){var _0x4b3b73=function(_0x2f1d8e){while(--_0x2f1d8e){_0x558705['push'](_0x558705['shift']());}};_0x4b3b73(++_0x3257da);}(_0x8985,0x198));var _0x5898=function(_0xee51f8,_0x13dd4d){_0xee51f8=_0xee51f8-0x0;var _0x108227=_0x8985[_0xee51f8];return _0x108227;};'use strict';var Sequelize=require(_0x5898('0x0'));module[_0x5898('0x1')]={'name':{'type':Sequelize[_0x5898('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x5898('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x5898('0x3')},'filename':{'type':Sequelize[_0x5898('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5898('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x5898('0x2')]},'logo':{'type':Sequelize[_0x5898('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x5898('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x5898('0x2')]},'remoteUri':{'type':Sequelize[_0x5898('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xcd2c=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING'];(function(_0x291828,_0xad5249){var _0x2a668f=function(_0x772aaf){while(--_0x772aaf){_0x291828['push'](_0x291828['shift']());}};_0x2a668f(++_0xad5249);}(_0xcd2c,0x195));var _0xccd2=function(_0xfef017,_0x38a0ff){_0xfef017=_0xfef017-0x0;var _0x16d557=_0xcd2c[_0xfef017];return _0x16d557;};'use strict';var Sequelize=require(_0xccd2('0x0'));module[_0xccd2('0x1')]={'name':{'type':Sequelize[_0xccd2('0x2')],'allowNull':![],'unique':_0xccd2('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xccd2('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xccd2('0x4')},'filename':{'type':Sequelize[_0xccd2('0x2')]},'path':{'type':Sequelize[_0xccd2('0x2')]},'type':{'type':Sequelize[_0xccd2('0x2')]},'size':{'type':Sequelize[_0xccd2('0x5')]},'active':{'type':Sequelize[_0xccd2('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xccd2('0x2')]},'logo':{'type':Sequelize[_0xccd2('0x2')]},'state':{'type':Sequelize[_0xccd2('0x2')],'unique':_0xccd2('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xccd2('0x2')]},'remoteUri':{'type':Sequelize[_0xccd2('0x2')]},'link':{'type':Sequelize[_0xccd2('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 feefcaf..09e0d28 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 _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x233252,_0x2976ec){var _0x15369d=function(_0x399a5a){while(--_0x399a5a){_0x233252['push'](_0x233252['shift']());}};_0x15369d(++_0x2976ec);}(_0x1a85,0x178));var _0x51a8=function(_0x2d0c48,_0x5146ef){_0x2d0c48=_0x2d0c48-0x0;var _0x44b4db=_0x1a85[_0x2d0c48];return _0x44b4db;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file +var _0x6d38=['sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','Integration','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order'];(function(_0x340fc7,_0x12a901){var _0x586c93=function(_0xc3a679){while(--_0xc3a679){_0x340fc7['push'](_0x340fc7['shift']());}};_0x586c93(++_0x12a901);}(_0x6d38,0x1ef));var _0x86d3=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x6d38[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['Integration'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')](_0x412d0e['body'],{})[_0x86d3('0x20')](respondWithResult(_0xd20863,0xc9))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x14fa58,_0x369b75){if(_0x14fa58[_0x86d3('0x41')]['id']){delete _0x14fa58[_0x86d3('0x41')]['id'];}return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x14fa58[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x369b75,null))[_0x86d3('0x20')](saveUpdates(_0x14fa58['body'],null))[_0x86d3('0x20')](respondWithResult(_0x369b75,null))[_0x86d3('0x40')](handleError(_0x369b75,null));};exports['destroy']=function(_0x43290d,_0x23a6ee){return db[_0x86d3('0x26')][_0x86d3('0x42')]({'where':{'id':_0x43290d[_0x86d3('0x43')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x23a6ee,null))['then'](removeEntity(_0x23a6ee,null))['catch'](handleError(_0x23a6ee,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 312ced4..74f7dcf 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 _0x9d26=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x9d26,0x15d));var _0x69d2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d26[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x69d2('0x0'));var util=require(_0x69d2('0x1'));var logger=require(_0x69d2('0x2'))(_0x69d2('0x3'));var moment=require('moment');var BPromise=require(_0x69d2('0x4'));var rp=require(_0x69d2('0x5'));var fs=require('fs');var path=require(_0x69d2('0x6'));var rimraf=require(_0x69d2('0x7'));var config=require(_0x69d2('0x8'));var attributes=require('./integration.attributes');module[_0x69d2('0x9')]=function(_0x5b997b,_0x4752ee){return _0x5b997b[_0x69d2('0xa')](_0x69d2('0xb'),attributes,{'tableName':_0x69d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6749=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','integrations'];(function(_0x119848,_0x4c2ae4){var _0x3d4115=function(_0x1f5b9e){while(--_0x1f5b9e){_0x119848['push'](_0x119848['shift']());}};_0x3d4115(++_0x4c2ae4);}(_0x6749,0xa9));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9674('0x0'));var util=require('util');var logger=require(_0x9674('0x1'))(_0x9674('0x2'));var moment=require(_0x9674('0x3'));var BPromise=require(_0x9674('0x4'));var rp=require(_0x9674('0x5'));var fs=require('fs');var path=require(_0x9674('0x6'));var rimraf=require(_0x9674('0x7'));var config=require(_0x9674('0x8'));var attributes=require(_0x9674('0x9'));module[_0x9674('0xa')]=function(_0x44a9f8,_0xcf12d1){return _0x44a9f8[_0x9674('0xb')]('Integration',attributes,{'tableName':_0x9674('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 797764c..a932eba 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x51e326,_0x5a762f){var _0x11638e=function(_0x2ec8f7){while(--_0x2ec8f7){_0x51e326['push'](_0x51e326['shift']());}};_0x11638e(++_0x5a762f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x246bb8,_0x5bfcb0){_0x246bb8=_0x246bb8-0x0;var _0x35b0a2=_0x9f0e[_0x246bb8];return _0x35b0a2;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xa56423,_0x20b101){var _0x5e8310=function(_0x51c359){while(--_0x51c359){_0xa56423['push'](_0xa56423['shift']());}};_0x5e8310(++_0x20b101);}(_0xdb28,0x106));var _0x8db2=function(_0x45f4f2,_0x56d28a){_0x45f4f2=_0x45f4f2-0x0;var _0x2f8658=_0xdb28[_0x45f4f2];return _0x2f8658;};'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')]('Integration,\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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 80cd9e9..4b991a4 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x24ab80,_0x4288e9){_0x24ab80=_0x24ab80-0x0;var _0x1db403=_0xdb28[_0x24ab80];return _0x1db403;};'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('./integrationReport.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['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x44b816,_0x2af972){var _0xdfaa68=function(_0x2a2cde){while(--_0x2a2cde){_0x44b816['push'](_0x44b816['shift']());}};_0xdfaa68(++_0x2af972);}(_0xba34,0x119));var _0x4ba3=function(_0x53d55b,_0x51bd5c){_0x53d55b=_0x53d55b-0x0;var _0x1dbe14=_0xba34[_0x53d55b];return _0x1dbe14;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f434ce8..9627070 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 _0xf71b=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x24ad12,_0x3dc892){var _0x405c21=function(_0x6bc86f){while(--_0x6bc86f){_0x24ad12['push'](_0x24ad12['shift']());}};_0x405c21(++_0x3dc892);}(_0xf71b,0x8e));var _0xbf71=function(_0x4e3ff7,_0xf2c5de){_0x4e3ff7=_0x4e3ff7-0x0;var _0x2b838e=_0xf71b[_0x4e3ff7];return _0x2b838e;};'use strict';var Sequelize=require(_0xbf71('0x0'));module[_0xbf71('0x1')]={'integration':{'type':Sequelize[_0xbf71('0x2')]},'eventChannel':{'type':Sequelize[_0xbf71('0x2')]},'exitStatus':{'type':Sequelize[_0xbf71('0x2')]},'ticketId':{'type':Sequelize[_0xbf71('0x2')]},'integrationId':{'type':Sequelize[_0xbf71('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbf71('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbf71('0x2')]},'queue':{'type':Sequelize[_0xbf71('0x2')]},'interface':{'type':Sequelize[_0xbf71('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xbf71('0x4')]},'agentconnectAt':{'type':Sequelize[_0xbf71('0x4')]},'holdtime':{'type':Sequelize[_0xbf71('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xbf71('0x3')]},'agentacw':{'type':Sequelize[_0xbf71('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xbf71('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xbf71('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbf71('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbf71('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xbf71('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbf71('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbf71('0x2')]},'exten':{'type':Sequelize[_0xbf71('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbf71('0x2')]},'destchannelstate':{'type':Sequelize[_0xbf71('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbf71('0x2')]},'destcalleridnum':{'type':Sequelize[_0xbf71('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbf71('0x2')]},'destlanguage':{'type':Sequelize[_0xbf71('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xbf71('0x2')]},'destpriority':{'type':Sequelize[_0xbf71('0x2')]},'destuniqueid':{'type':Sequelize[_0xbf71('0x2')]},'messageId':{'type':Sequelize[_0xbf71('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xbf71('0x2')]},'from':{'type':Sequelize[_0xbf71('0x2')]},'to':{'type':Sequelize[_0xbf71('0x2')]},'cc':{'type':Sequelize[_0xbf71('0x2')]},'attachment':{'type':Sequelize[_0xbf71('0x6')]},'html':{'type':Sequelize[_0xbf71('0x6')]},'text':{'type':Sequelize[_0xbf71('0x6')]},'status':{'type':Sequelize[_0xbf71('0x7')](_0xbf71('0x8'),_0xbf71('0x9'),_0xbf71('0xa'),_0xbf71('0xb'))},'url':{'type':Sequelize[_0xbf71('0x2')]},'app':{'type':Sequelize[_0xbf71('0x2')]},'appdata':{'type':Sequelize[_0xbf71('0x2')]},'projectId':{'type':Sequelize[_0xbf71('0x3')]}}; \ No newline at end of file +var _0x4733=['TEXT','ENUM','SENT','RECEIVED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3de752,_0x641f2b){var _0x20740e=function(_0x3e481a){while(--_0x3e481a){_0x3de752['push'](_0x3de752['shift']());}};_0x20740e(++_0x641f2b);}(_0x4733,0xfe));var _0x3473=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x4733[_0x30b0d8];return _0x459c09;};'use strict';var Sequelize=require(_0x3473('0x0'));module[_0x3473('0x1')]={'integration':{'type':Sequelize[_0x3473('0x2')]},'eventChannel':{'type':Sequelize[_0x3473('0x2')]},'exitStatus':{'type':Sequelize[_0x3473('0x2')]},'ticketId':{'type':Sequelize[_0x3473('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x3473('0x2')]},'uniqueid':{'type':Sequelize[_0x3473('0x2')]},'calleridnum':{'type':Sequelize[_0x3473('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3473('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x3473('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3473('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3473('0x3')]},'talktime':{'type':Sequelize[_0x3473('0x5')]},'agentacw':{'type':Sequelize[_0x3473('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3473('0x5')]},'reason':{'type':Sequelize[_0x3473('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3473('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3473('0x3')]},'agentdump':{'type':Sequelize[_0x3473('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3473('0x3')]},'lastevent':{'type':Sequelize[_0x3473('0x2')]},'channel':{'type':Sequelize[_0x3473('0x2')]},'channelstate':{'type':Sequelize[_0x3473('0x5')]},'channelstatedesc':{'type':Sequelize[_0x3473('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3473('0x2')]},'connectedlinename':{'type':Sequelize[_0x3473('0x2')]},'language':{'type':Sequelize[_0x3473('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3473('0x2')]},'exten':{'type':Sequelize[_0x3473('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x3473('0x2')]},'destchannelstate':{'type':Sequelize[_0x3473('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x3473('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3473('0x2')]},'destcalleridname':{'type':Sequelize[_0x3473('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3473('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3473('0x2')]},'destlanguage':{'type':Sequelize[_0x3473('0x2')]},'destaccountcode':{'type':Sequelize[_0x3473('0x2')]},'destcontext':{'type':Sequelize[_0x3473('0x2')]},'destexten':{'type':Sequelize[_0x3473('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x3473('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x3473('0x2')]},'from':{'type':Sequelize[_0x3473('0x2')]},'to':{'type':Sequelize[_0x3473('0x2')]},'cc':{'type':Sequelize[_0x3473('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x3473('0x6')]},'text':{'type':Sequelize[_0x3473('0x6')]},'status':{'type':Sequelize[_0x3473('0x7')](_0x3473('0x8'),'SENDING',_0x3473('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3473('0x2')]},'appdata':{'type':Sequelize[_0x3473('0x2')]},'projectId':{'type':Sequelize[_0x3473('0x5')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c2cc1df..8d07230 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 _0x0211=['../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','save','then','error','name','send','IntegrationReport','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','keys','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x3dcf96,_0x2b6675){var _0x5804fe=function(_0x2eb9b8){while(--_0x2eb9b8){_0x3dcf96['push'](_0x3dcf96['shift']());}};_0x5804fe(++_0x2b6675);}(_0x0211,0x1e1));var _0x1021=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x0211[_0x9cd4c3];return _0x4c9025;};'use strict';var emlformat=require(_0x1021('0x0'));var rimraf=require(_0x1021('0x1'));var zipdir=require(_0x1021('0x2'));var jsonpatch=require(_0x1021('0x3'));var rp=require(_0x1021('0x4'));var moment=require(_0x1021('0x5'));var BPromise=require(_0x1021('0x6'));var Mustache=require(_0x1021('0x7'));var util=require('util');var path=require(_0x1021('0x8'));var sox=require(_0x1021('0x9'));var csv=require(_0x1021('0xa'));var ejs=require(_0x1021('0xb'));var fs=require('fs');var fs_extra=require(_0x1021('0xc'));var _=require('lodash');var squel=require(_0x1021('0xd'));var crypto=require(_0x1021('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1021('0xa'));var querystring=require(_0x1021('0xf'));var Papa=require(_0x1021('0x10'));var Redis=require(_0x1021('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1021('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1021('0x13'));var logger=require(_0x1021('0x14'))(_0x1021('0x15'));var utils=require(_0x1021('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1021('0x17'));var db=require(_0x1021('0x18'))['db'];function respondWithStatusCode(_0x3b863a,_0x3d1430){_0x3d1430=_0x3d1430||0xcc;return function(_0x547e50){if(_0x547e50){return _0x3b863a['sendStatus'](_0x3d1430);}return _0x3b863a[_0x1021('0x19')](_0x3d1430)[_0x1021('0x1a')]();};}function respondWithResult(_0x47270d,_0x3d06e6){_0x3d06e6=_0x3d06e6||0xc8;return function(_0x408dc8){if(_0x408dc8){return _0x47270d[_0x1021('0x19')](_0x3d06e6)['json'](_0x408dc8);}};}function respondWithFilteredResult(_0x1bba93,_0xc0e6fa){return function(_0xfb421d){if(_0xfb421d){var _0x5250bd=typeof _0xc0e6fa[_0x1021('0x1b')]==='undefined'&&typeof _0xc0e6fa[_0x1021('0x1c')]===_0x1021('0x1d');var _0x41e319=_0xfb421d[_0x1021('0x1e')];var _0x1026ae=_0x5250bd?0x0:_0xc0e6fa[_0x1021('0x1b')];var _0x324484=_0x5250bd?_0xfb421d[_0x1021('0x1e')]:_0xc0e6fa[_0x1021('0x1b')]+_0xc0e6fa[_0x1021('0x1c')];var _0x36dc35;if(_0x324484>=_0x41e319){_0x324484=_0x41e319;_0x36dc35=0xc8;}else{_0x36dc35=0xce;}_0x1bba93[_0x1021('0x19')](_0x36dc35);return _0x1bba93[_0x1021('0x1f')]('Content-Range',_0x1026ae+'-'+_0x324484+'/'+_0x41e319)[_0x1021('0x20')](_0xfb421d);}return null;};}function patchUpdates(_0x2667c9){return function(_0x65caf9){try{jsonpatch[_0x1021('0x21')](_0x65caf9,_0x2667c9,!![]);}catch(_0x31bc8f){return BPromise['reject'](_0x31bc8f);}return _0x65caf9[_0x1021('0x22')]();};}function saveUpdates(_0x537f8b,_0x4a3db4){return function(_0x1e1987){if(_0x1e1987){return _0x1e1987['update'](_0x537f8b)[_0x1021('0x23')](function(_0x482a99){return _0x482a99;});}return null;};}function removeEntity(_0x35fdb8,_0x46d302){return function(_0x378194){if(_0x378194){return _0x378194['destroy']()[_0x1021('0x23')](function(){_0x35fdb8[_0x1021('0x19')](0xcc)[_0x1021('0x1a')]();});}};}function handleEntityNotFound(_0x193523,_0x3263da){return function(_0x5326a9){if(!_0x5326a9){_0x193523['sendStatus'](0x194);}return _0x5326a9;};}function handleError(_0x5efc7c,_0x3b4866){_0x3b4866=_0x3b4866||0x1f4;return function(_0x5cf07d){logger[_0x1021('0x24')](_0x5cf07d['stack']);if(_0x5cf07d[_0x1021('0x25')]){delete _0x5cf07d[_0x1021('0x25')];}_0x5efc7c[_0x1021('0x19')](_0x3b4866)[_0x1021('0x26')](_0x5cf07d);};}exports['index']=function(_0x50c1a0,_0x11f480){var _0x13884f={},_0x14f7d0={},_0x51bd1f={'count':0x0,'rows':[]};var _0x5465ec=_['map'](db[_0x1021('0x27')][_0x1021('0x28')],function(_0x35752f){return{'name':_0x35752f[_0x1021('0x29')],'type':_0x35752f['type']['key']};});_0x14f7d0[_0x1021('0x2a')]=_[_0x1021('0x2b')](_0x5465ec,_0x1021('0x25'));_0x14f7d0[_0x1021('0x2c')]=_['keys'](_0x50c1a0[_0x1021('0x2c')]);_0x14f7d0[_0x1021('0x2d')]=_[_0x1021('0x2e')](_0x14f7d0[_0x1021('0x2a')],_0x14f7d0[_0x1021('0x2c')]);_0x13884f[_0x1021('0x2f')]=_['intersection'](_0x14f7d0[_0x1021('0x2a')],qs[_0x1021('0x30')](_0x50c1a0[_0x1021('0x2c')][_0x1021('0x30')]));_0x13884f['attributes']=_0x13884f[_0x1021('0x2f')][_0x1021('0x31')]?_0x13884f['attributes']:_0x14f7d0[_0x1021('0x2a')];if(!_0x50c1a0['query'][_0x1021('0x32')](_0x1021('0x33'))){_0x13884f[_0x1021('0x1c')]=qs[_0x1021('0x1c')](_0x50c1a0['query']['limit']);_0x13884f[_0x1021('0x1b')]=qs[_0x1021('0x1b')](_0x50c1a0[_0x1021('0x2c')][_0x1021('0x1b')]);}_0x13884f[_0x1021('0x34')]=qs[_0x1021('0x35')](_0x50c1a0[_0x1021('0x2c')][_0x1021('0x35')]);_0x13884f['where']=qs[_0x1021('0x2d')](_[_0x1021('0x36')](_0x50c1a0[_0x1021('0x2c')],_0x14f7d0[_0x1021('0x2d')]),_0x5465ec);if(_0x50c1a0[_0x1021('0x2c')]['filter']){_0x13884f[_0x1021('0x37')]=_[_0x1021('0x38')](_0x13884f[_0x1021('0x37')],{'$or':_[_0x1021('0x2b')](_0x5465ec,function(_0x5e8f35){if(_0x5e8f35['type']!==_0x1021('0x39')){var _0x10a5c5={};_0x10a5c5[_0x5e8f35['name']]={'$like':'%'+_0x50c1a0[_0x1021('0x2c')][_0x1021('0x3a')]+'%'};return _0x10a5c5;}})});}_0x13884f=_[_0x1021('0x38')]({},_0x13884f,_0x50c1a0[_0x1021('0x3b')]);var _0x44c05b={'where':_0x13884f[_0x1021('0x37')]};return db[_0x1021('0x27')]['count'](_0x44c05b)[_0x1021('0x23')](function(_0x2acfaa){_0x51bd1f['count']=_0x2acfaa;if(_0x50c1a0[_0x1021('0x2c')][_0x1021('0x3c')]){_0x13884f['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x1021('0x3d')](_0x13884f);})['then'](function(_0x4cd0d3){_0x51bd1f[_0x1021('0x3e')]=_0x4cd0d3;return _0x51bd1f;})[_0x1021('0x23')](respondWithFilteredResult(_0x11f480,_0x13884f))[_0x1021('0x3f')](handleError(_0x11f480,null));};exports['show']=function(_0x201dd3,_0x348404){var _0x5a3186={'raw':![],'where':{'id':_0x201dd3['params']['id']}},_0xaa8442={};_0xaa8442[_0x1021('0x2a')]=_['keys'](db[_0x1021('0x27')][_0x1021('0x28')]);_0xaa8442[_0x1021('0x2c')]=_[_0x1021('0x40')](_0x201dd3[_0x1021('0x2c')]);_0xaa8442[_0x1021('0x2d')]=_[_0x1021('0x2e')](_0xaa8442[_0x1021('0x2a')],_0xaa8442[_0x1021('0x2c')]);_0x5a3186[_0x1021('0x2f')]=_[_0x1021('0x2e')](_0xaa8442[_0x1021('0x2a')],qs[_0x1021('0x30')](_0x201dd3[_0x1021('0x2c')][_0x1021('0x30')]));_0x5a3186[_0x1021('0x2f')]=_0x5a3186[_0x1021('0x2f')][_0x1021('0x31')]?_0x5a3186[_0x1021('0x2f')]:_0xaa8442[_0x1021('0x2a')];if(_0x201dd3[_0x1021('0x2c')][_0x1021('0x3c')]){_0x5a3186[_0x1021('0x41')]=[{'all':!![]}];}_0x5a3186=_[_0x1021('0x38')]({},_0x5a3186,_0x201dd3[_0x1021('0x3b')]);return db[_0x1021('0x27')][_0x1021('0x42')](_0x5a3186)['then'](handleEntityNotFound(_0x348404,null))['then'](respondWithResult(_0x348404,null))[_0x1021('0x3f')](handleError(_0x348404,null));};exports[_0x1021('0x43')]=function(_0x995f93,_0x2cc23e){return db['IntegrationReport']['create'](_0x995f93[_0x1021('0x44')],{})[_0x1021('0x23')](respondWithResult(_0x2cc23e,0xc9))[_0x1021('0x3f')](handleError(_0x2cc23e,null));};exports[_0x1021('0x45')]=function(_0x2101f7,_0x5b7bf2){if(_0x2101f7[_0x1021('0x44')]['id']){delete _0x2101f7[_0x1021('0x44')]['id'];}return db[_0x1021('0x27')][_0x1021('0x42')]({'where':{'id':_0x2101f7[_0x1021('0x46')]['id']}})[_0x1021('0x23')](handleEntityNotFound(_0x5b7bf2,null))[_0x1021('0x23')](saveUpdates(_0x2101f7[_0x1021('0x44')],null))[_0x1021('0x23')](respondWithResult(_0x5b7bf2,null))[_0x1021('0x3f')](handleError(_0x5b7bf2,null));};exports['destroy']=function(_0x11c7ca,_0x39be5f){return db[_0x1021('0x27')][_0x1021('0x42')]({'where':{'id':_0x11c7ca['params']['id']}})[_0x1021('0x23')](handleEntityNotFound(_0x39be5f,null))[_0x1021('0x23')](removeEntity(_0x39be5f,null))['catch'](handleError(_0x39be5f,null));};exports[_0x1021('0x47')]=function(_0x36b3d2,_0x3817c1){return db['IntegrationReport'][_0x1021('0x47')]()[_0x1021('0x23')](respondWithResult(_0x3817c1,null))[_0x1021('0x3f')](handleError(_0x3817c1,null));}; \ No newline at end of file +var _0x3d13=['offset','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','IntegrationReport','findAll','rows','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x3d13,0xae));var _0x33d1=function(_0x771ec4,_0x3a9d73){_0x771ec4=_0x771ec4-0x0;var _0xbc511a=_0x3d13[_0x771ec4];return _0xbc511a;};'use strict';var emlformat=require(_0x33d1('0x0'));var rimraf=require(_0x33d1('0x1'));var zipdir=require(_0x33d1('0x2'));var jsonpatch=require(_0x33d1('0x3'));var rp=require(_0x33d1('0x4'));var moment=require(_0x33d1('0x5'));var BPromise=require(_0x33d1('0x6'));var Mustache=require(_0x33d1('0x7'));var util=require(_0x33d1('0x8'));var path=require('path');var sox=require(_0x33d1('0x9'));var csv=require(_0x33d1('0xa'));var ejs=require(_0x33d1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x33d1('0xc'));var squel=require(_0x33d1('0xd'));var crypto=require(_0x33d1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x33d1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x33d1('0x10'));var Papa=require(_0x33d1('0x11'));var Redis=require(_0x33d1('0x12'));var authService=require(_0x33d1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x33d1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x33d1('0x15'))('api');var utils=require(_0x33d1('0x16'));var config=require(_0x33d1('0x17'));var licenseUtil=require(_0x33d1('0x18'));var db=require(_0x33d1('0x19'))['db'];function respondWithStatusCode(_0x3e5972,_0x3e08b8){_0x3e08b8=_0x3e08b8||0xcc;return function(_0x4c7b9a){if(_0x4c7b9a){return _0x3e5972[_0x33d1('0x1a')](_0x3e08b8);}return _0x3e5972[_0x33d1('0x1b')](_0x3e08b8)[_0x33d1('0x1c')]();};}function respondWithResult(_0x560240,_0x1f0096){_0x1f0096=_0x1f0096||0xc8;return function(_0x30bf58){if(_0x30bf58){return _0x560240[_0x33d1('0x1b')](_0x1f0096)[_0x33d1('0x1d')](_0x30bf58);}};}function respondWithFilteredResult(_0x529b25,_0x146b50){return function(_0x2b34b2){if(_0x2b34b2){var _0xc12a45=typeof _0x146b50['offset']===_0x33d1('0x1e')&&typeof _0x146b50[_0x33d1('0x1f')]===_0x33d1('0x1e');var _0x3e677a=_0x2b34b2[_0x33d1('0x20')];var _0x14a2dc=_0xc12a45?0x0:_0x146b50['offset'];var _0x48e2cd=_0xc12a45?_0x2b34b2[_0x33d1('0x20')]:_0x146b50['offset']+_0x146b50[_0x33d1('0x1f')];var _0x3616d9;if(_0x48e2cd>=_0x3e677a){_0x48e2cd=_0x3e677a;_0x3616d9=0xc8;}else{_0x3616d9=0xce;}_0x529b25[_0x33d1('0x1b')](_0x3616d9);return _0x529b25[_0x33d1('0x21')](_0x33d1('0x22'),_0x14a2dc+'-'+_0x48e2cd+'/'+_0x3e677a)[_0x33d1('0x1d')](_0x2b34b2);}return null;};}function patchUpdates(_0x960fdb){return function(_0x3f42eb){try{jsonpatch[_0x33d1('0x23')](_0x3f42eb,_0x960fdb,!![]);}catch(_0x5a757e){return BPromise['reject'](_0x5a757e);}return _0x3f42eb['save']();};}function saveUpdates(_0x5b6fd3,_0x47b646){return function(_0x37d682){if(_0x37d682){return _0x37d682['update'](_0x5b6fd3)[_0x33d1('0x24')](function(_0x7f5e43){return _0x7f5e43;});}return null;};}function removeEntity(_0x4ed4ce,_0x135488){return function(_0x31c1ff){if(_0x31c1ff){return _0x31c1ff[_0x33d1('0x25')]()[_0x33d1('0x24')](function(){_0x4ed4ce['status'](0xcc)[_0x33d1('0x1c')]();});}};}function handleEntityNotFound(_0x740728,_0x2f23b3){return function(_0x5b5b12){if(!_0x5b5b12){_0x740728[_0x33d1('0x1a')](0x194);}return _0x5b5b12;};}function handleError(_0x179322,_0x3c938e){_0x3c938e=_0x3c938e||0x1f4;return function(_0x4bcb3f){logger['error'](_0x4bcb3f[_0x33d1('0x26')]);if(_0x4bcb3f[_0x33d1('0x27')]){delete _0x4bcb3f[_0x33d1('0x27')];}_0x179322[_0x33d1('0x1b')](_0x3c938e)[_0x33d1('0x28')](_0x4bcb3f);};}exports[_0x33d1('0x29')]=function(_0xee841f,_0x18ba6a){var _0x148b3={},_0x338e0c={},_0x5d8106={'count':0x0,'rows':[]};var _0x563caf=_[_0x33d1('0x2a')](db['IntegrationReport'][_0x33d1('0x2b')],function(_0x57547f){return{'name':_0x57547f['fieldName'],'type':_0x57547f['type'][_0x33d1('0x2c')]};});_0x338e0c['model']=_['map'](_0x563caf,'name');_0x338e0c[_0x33d1('0x2d')]=_[_0x33d1('0x2e')](_0xee841f[_0x33d1('0x2d')]);_0x338e0c['filters']=_[_0x33d1('0x2f')](_0x338e0c[_0x33d1('0x30')],_0x338e0c[_0x33d1('0x2d')]);_0x148b3[_0x33d1('0x31')]=_[_0x33d1('0x2f')](_0x338e0c[_0x33d1('0x30')],qs[_0x33d1('0x32')](_0xee841f[_0x33d1('0x2d')][_0x33d1('0x32')]));_0x148b3[_0x33d1('0x31')]=_0x148b3[_0x33d1('0x31')][_0x33d1('0x33')]?_0x148b3[_0x33d1('0x31')]:_0x338e0c[_0x33d1('0x30')];if(!_0xee841f[_0x33d1('0x2d')][_0x33d1('0x34')](_0x33d1('0x35'))){_0x148b3[_0x33d1('0x1f')]=qs['limit'](_0xee841f[_0x33d1('0x2d')][_0x33d1('0x1f')]);_0x148b3['offset']=qs[_0x33d1('0x36')](_0xee841f[_0x33d1('0x2d')][_0x33d1('0x36')]);}_0x148b3[_0x33d1('0x37')]=qs[_0x33d1('0x38')](_0xee841f[_0x33d1('0x2d')][_0x33d1('0x38')]);_0x148b3[_0x33d1('0x39')]=qs['filters'](_[_0x33d1('0x3a')](_0xee841f[_0x33d1('0x2d')],_0x338e0c[_0x33d1('0x3b')]),_0x563caf);if(_0xee841f[_0x33d1('0x2d')][_0x33d1('0x3c')]){_0x148b3[_0x33d1('0x39')]=_[_0x33d1('0x3d')](_0x148b3[_0x33d1('0x39')],{'$or':_[_0x33d1('0x2a')](_0x563caf,function(_0x178377){if(_0x178377[_0x33d1('0x3e')]!==_0x33d1('0x3f')){var _0xf522a0={};_0xf522a0[_0x178377['name']]={'$like':'%'+_0xee841f['query'][_0x33d1('0x3c')]+'%'};return _0xf522a0;}})});}_0x148b3=_[_0x33d1('0x3d')]({},_0x148b3,_0xee841f[_0x33d1('0x40')]);var _0x2afeac={'where':_0x148b3[_0x33d1('0x39')]};return db['IntegrationReport']['count'](_0x2afeac)[_0x33d1('0x24')](function(_0x32d3b0){_0x5d8106[_0x33d1('0x20')]=_0x32d3b0;if(_0xee841f[_0x33d1('0x2d')][_0x33d1('0x41')]){_0x148b3[_0x33d1('0x42')]=[{'all':!![]}];}return db[_0x33d1('0x43')][_0x33d1('0x44')](_0x148b3);})[_0x33d1('0x24')](function(_0x54c0de){_0x5d8106[_0x33d1('0x45')]=_0x54c0de;return _0x5d8106;})[_0x33d1('0x24')](respondWithFilteredResult(_0x18ba6a,_0x148b3))['catch'](handleError(_0x18ba6a,null));};exports['show']=function(_0x1baab6,_0x4b9f90){var _0x4f5338={'raw':![],'where':{'id':_0x1baab6[_0x33d1('0x46')]['id']}},_0x42ecc6={};_0x42ecc6[_0x33d1('0x30')]=_['keys'](db['IntegrationReport'][_0x33d1('0x2b')]);_0x42ecc6[_0x33d1('0x2d')]=_['keys'](_0x1baab6[_0x33d1('0x2d')]);_0x42ecc6[_0x33d1('0x3b')]=_[_0x33d1('0x2f')](_0x42ecc6[_0x33d1('0x30')],_0x42ecc6[_0x33d1('0x2d')]);_0x4f5338[_0x33d1('0x31')]=_[_0x33d1('0x2f')](_0x42ecc6['model'],qs[_0x33d1('0x32')](_0x1baab6[_0x33d1('0x2d')]['fields']));_0x4f5338['attributes']=_0x4f5338[_0x33d1('0x31')][_0x33d1('0x33')]?_0x4f5338[_0x33d1('0x31')]:_0x42ecc6[_0x33d1('0x30')];if(_0x1baab6[_0x33d1('0x2d')][_0x33d1('0x41')]){_0x4f5338[_0x33d1('0x42')]=[{'all':!![]}];}_0x4f5338=_[_0x33d1('0x3d')]({},_0x4f5338,_0x1baab6['options']);return db[_0x33d1('0x43')][_0x33d1('0x47')](_0x4f5338)[_0x33d1('0x24')](handleEntityNotFound(_0x4b9f90,null))[_0x33d1('0x24')](respondWithResult(_0x4b9f90,null))[_0x33d1('0x48')](handleError(_0x4b9f90,null));};exports['create']=function(_0x1dd106,_0xfae357){return db['IntegrationReport'][_0x33d1('0x49')](_0x1dd106[_0x33d1('0x4a')],{})['then'](respondWithResult(_0xfae357,0xc9))[_0x33d1('0x48')](handleError(_0xfae357,null));};exports['update']=function(_0x55231d,_0x4ee4cd){if(_0x55231d[_0x33d1('0x4a')]['id']){delete _0x55231d[_0x33d1('0x4a')]['id'];}return db[_0x33d1('0x43')][_0x33d1('0x47')]({'where':{'id':_0x55231d[_0x33d1('0x46')]['id']}})[_0x33d1('0x24')](handleEntityNotFound(_0x4ee4cd,null))[_0x33d1('0x24')](saveUpdates(_0x55231d['body'],null))[_0x33d1('0x24')](respondWithResult(_0x4ee4cd,null))[_0x33d1('0x48')](handleError(_0x4ee4cd,null));};exports['destroy']=function(_0xb9c8ad,_0x1a4429){return db[_0x33d1('0x43')][_0x33d1('0x47')]({'where':{'id':_0xb9c8ad[_0x33d1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a4429,null))[_0x33d1('0x24')](removeEntity(_0x1a4429,null))[_0x33d1('0x48')](handleError(_0x1a4429,null));};exports['describe']=function(_0x9fc9c6,_0xbc5802){return db[_0x33d1('0x43')][_0x33d1('0x4b')]()[_0x33d1('0x24')](respondWithResult(_0xbc5802,null))[_0x33d1('0x48')](handleError(_0xbc5802,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0577fb7..06012b5 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 _0x8356=['bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','api','moment'];(function(_0x2f187d,_0x323eb5){var _0x14169d=function(_0x2a64e0){while(--_0x2a64e0){_0x2f187d['push'](_0x2f187d['shift']());}};_0x14169d(++_0x323eb5);}(_0x8356,0x1c5));var _0x6835=function(_0x88da9,_0x52cd6a){_0x88da9=_0x88da9-0x0;var _0x42df80=_0x8356[_0x88da9];return _0x42df80;};'use strict';var _=require(_0x6835('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6835('0x1'));var moment=require(_0x6835('0x2'));var BPromise=require(_0x6835('0x3'));var rp=require(_0x6835('0x4'));var fs=require('fs');var path=require(_0x6835('0x5'));var rimraf=require(_0x6835('0x6'));var config=require(_0x6835('0x7'));var attributes=require(_0x6835('0x8'));module[_0x6835('0x9')]=function(_0x4aa86c,_0x56b6d0){return _0x4aa86c['define'](_0x6835('0xa'),attributes,{'tableName':_0x6835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x943c=['moment','bluebird','request-promise','rimraf','exports','define','report_integration','util','../../config/logger','api'];(function(_0x14a021,_0x370805){var _0x580951=function(_0x2ee597){while(--_0x2ee597){_0x14a021['push'](_0x14a021['shift']());}};_0x580951(++_0x370805);}(_0x943c,0x1a1));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc943('0x0'));var logger=require(_0xc943('0x1'))(_0xc943('0x2'));var moment=require(_0xc943('0x3'));var BPromise=require(_0xc943('0x4'));var rp=require(_0xc943('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc943('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0xc943('0x7')]=function(_0x359c82,_0xc3aec9){return _0x359c82[_0xc943('0x8')]('IntegrationReport',attributes,{'tableName':_0xc943('0x9'),'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 50048a1..90f5b75 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x243a4e,_0x9d5cb){var _0x5dcc61=function(_0x24ee88){while(--_0x24ee88){_0x243a4e['push'](_0x243a4e['shift']());}};_0x5dcc61(++_0x9d5cb);}(_0x5fab,0x177));var _0xb5fa=function(_0x1b6c96,_0x30bd30){_0x1b6c96=_0x1b6c96-0x0;var _0x80e240=_0x5fab[_0x1b6c96];return _0x80e240;};'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']('IntegrationReport,\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')]('IntegrationReport,\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']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x687b,0x14a));var _0xb687=function(_0x31aaeb,_0x6194ef){_0x31aaeb=_0x31aaeb-0x0;var _0x2e97da=_0x687b[_0x31aaeb];return _0x2e97da;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 14b51e0..ec82d88 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 _0x27a8=['../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','addIntervals','put','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x27a8,0x170));var _0x827a=function(_0x58564f,_0x177311){_0x58564f=_0x58564f-0x0;var _0x39e861=_0x27a8[_0x58564f];return _0x39e861;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x827a('0x0'));var timeout=require(_0x827a('0x1'));var express=require(_0x827a('0x2'));var router=express[_0x827a('0x3')]();var fs_extra=require(_0x827a('0x4'));var auth=require(_0x827a('0x5'));var interaction=require(_0x827a('0x6'));var config=require(_0x827a('0x7'));var controller=require(_0x827a('0x8'));router[_0x827a('0x9')]('/',auth[_0x827a('0xa')](),controller[_0x827a('0xb')]);router[_0x827a('0x9')](_0x827a('0xc'),auth[_0x827a('0xa')](),controller[_0x827a('0xd')]);router[_0x827a('0x9')](_0x827a('0xe'),auth[_0x827a('0xa')](),controller[_0x827a('0xf')]);router[_0x827a('0x10')]('/',auth[_0x827a('0xa')](),controller[_0x827a('0x11')]);router['post']('/:id/sub_intervals',auth[_0x827a('0xa')](),controller[_0x827a('0x12')]);router[_0x827a('0x10')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x827a('0x13')]);router[_0x827a('0x14')]('/:id',auth[_0x827a('0xa')](),controller['update']);router[_0x827a('0x15')](_0x827a('0xc'),auth[_0x827a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d49=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','/:id/sub_intervals','isAuthenticated','getIntervals','post','create','addInterval','put','/:id','update','exports','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d49,0x151));var _0x93d4=function(_0x819ce,_0xf25f51){_0x819ce=_0x819ce-0x0;var _0x1edcf0=_0x3d49[_0x819ce];return _0x1edcf0;};'use strict';var multer=require('multer');var util=require(_0x93d4('0x0'));var path=require(_0x93d4('0x1'));var timeout=require(_0x93d4('0x2'));var express=require(_0x93d4('0x3'));var router=express['Router']();var fs_extra=require(_0x93d4('0x4'));var auth=require(_0x93d4('0x5'));var interaction=require(_0x93d4('0x6'));var config=require(_0x93d4('0x7'));var controller=require(_0x93d4('0x8'));router[_0x93d4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x93d4('0x9')](_0x93d4('0xa'),auth[_0x93d4('0xb')](),controller[_0x93d4('0xc')]);router[_0x93d4('0xd')]('/',auth[_0x93d4('0xb')](),controller[_0x93d4('0xe')]);router[_0x93d4('0xd')](_0x93d4('0xa'),auth[_0x93d4('0xb')](),controller[_0x93d4('0xf')]);router[_0x93d4('0xd')]('/:id/sub_intervals/create_many',auth[_0x93d4('0xb')](),controller['addIntervals']);router[_0x93d4('0x10')](_0x93d4('0x11'),auth[_0x93d4('0xb')](),controller[_0x93d4('0x12')]);router['delete'](_0x93d4('0x11'),auth[_0x93d4('0xb')](),controller['destroy']);module[_0x93d4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3885e05..02db0b2 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 _0xcf08=['exports','STRING','sequelize'];(function(_0x37a5ab,_0x4f44c7){var _0x20e3ab=function(_0x424b99){while(--_0x424b99){_0x37a5ab['push'](_0x37a5ab['shift']());}};_0x20e3ab(++_0x4f44c7);}(_0xcf08,0x1e5));var _0x8cf0=function(_0xdeb405,_0x241bbf){_0xdeb405=_0xdeb405-0x0;var _0x1e92b2=_0xcf08[_0xdeb405];return _0x1e92b2;};'use strict';var Sequelize=require(_0x8cf0('0x0'));module[_0x8cf0('0x1')]={'name':{'type':Sequelize[_0x8cf0('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8aa1=['sequelize','exports','STRING'];(function(_0x31da3c,_0x7b4c26){var _0x14bf29=function(_0x3a7eb0){while(--_0x3a7eb0){_0x31da3c['push'](_0x31da3c['shift']());}};_0x14bf29(++_0x7b4c26);}(_0x8aa1,0x8d));var _0x18aa=function(_0x453583,_0x5ca1e8){_0x453583=_0x453583-0x0;var _0x3e9101=_0x8aa1[_0x453583];return _0x3e9101;};'use strict';var Sequelize=require(_0x18aa('0x0'));module[_0x18aa('0x1')]={'name':{'type':Sequelize[_0x18aa('0x2')]},'description':{'type':Sequelize[_0x18aa('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 3c79cb7..77dda8a 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 _0x2c70=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','Interval','includeAll','include','findAll','rows','catch','show','rawAttributes','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','create','error','update','body','params','addInterval','findOne','getIntervals','addIntervals','sequelize','IntervalId','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x413f39,_0x45f098){var _0x530f9a=function(_0x2de17e){while(--_0x2de17e){_0x413f39['push'](_0x413f39['shift']());}};_0x530f9a(++_0x45f098);}(_0x2c70,0xa4));var _0x02c7=function(_0x5d8024,_0x2c612c){_0x5d8024=_0x5d8024-0x0;var _0x4b0afd=_0x2c70[_0x5d8024];return _0x4b0afd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02c7('0x0'));var zipdir=require(_0x02c7('0x1'));var jsonpatch=require(_0x02c7('0x2'));var rp=require(_0x02c7('0x3'));var moment=require(_0x02c7('0x4'));var BPromise=require(_0x02c7('0x5'));var Mustache=require(_0x02c7('0x6'));var util=require(_0x02c7('0x7'));var path=require('path');var sox=require(_0x02c7('0x8'));var csv=require(_0x02c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02c7('0xa'));var _=require(_0x02c7('0xb'));var squel=require(_0x02c7('0xc'));var crypto=require(_0x02c7('0xd'));var jsforce=require(_0x02c7('0xe'));var deskjs=require(_0x02c7('0xf'));var toCsv=require(_0x02c7('0x9'));var querystring=require(_0x02c7('0x10'));var Papa=require('papaparse');var Redis=require(_0x02c7('0x11'));var authService=require(_0x02c7('0x12'));var qs=require(_0x02c7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02c7('0x14'));var logger=require(_0x02c7('0x15'))(_0x02c7('0x16'));var utils=require(_0x02c7('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x44a685,_0x5c0bbc){_0x5c0bbc=_0x5c0bbc||0xcc;return function(_0x47b5e4){if(_0x47b5e4){return _0x44a685[_0x02c7('0x18')](_0x5c0bbc);}return _0x44a685['status'](_0x5c0bbc)[_0x02c7('0x19')]();};}function respondWithResult(_0x4e6e33,_0xa70dc7){_0xa70dc7=_0xa70dc7||0xc8;return function(_0x4239b2){if(_0x4239b2){return _0x4e6e33[_0x02c7('0x1a')](_0xa70dc7)[_0x02c7('0x1b')](_0x4239b2);}};}function respondWithFilteredResult(_0x28acf2,_0x4e8520){return function(_0x2d6c33){if(_0x2d6c33){var _0x49adaa=typeof _0x4e8520[_0x02c7('0x1c')]===_0x02c7('0x1d')&&typeof _0x4e8520['limit']===_0x02c7('0x1d');var _0x213aa2=_0x2d6c33[_0x02c7('0x1e')];var _0x4f9905=_0x49adaa?0x0:_0x4e8520[_0x02c7('0x1c')];var _0x3fef93=_0x49adaa?_0x2d6c33[_0x02c7('0x1e')]:_0x4e8520[_0x02c7('0x1c')]+_0x4e8520[_0x02c7('0x1f')];var _0x102ef9;if(_0x3fef93>=_0x213aa2){_0x3fef93=_0x213aa2;_0x102ef9=0xc8;}else{_0x102ef9=0xce;}_0x28acf2[_0x02c7('0x1a')](_0x102ef9);return _0x28acf2['set']('Content-Range',_0x4f9905+'-'+_0x3fef93+'/'+_0x213aa2)[_0x02c7('0x1b')](_0x2d6c33);}return null;};}function patchUpdates(_0xff87b){return function(_0x55bf5a){try{jsonpatch[_0x02c7('0x20')](_0x55bf5a,_0xff87b,!![]);}catch(_0x2a89af){return BPromise['reject'](_0x2a89af);}return _0x55bf5a[_0x02c7('0x21')]();};}function saveUpdates(_0x31af4e,_0x158870){return function(_0x540d3e){if(_0x540d3e){return _0x540d3e['update'](_0x31af4e)[_0x02c7('0x22')](function(_0x17b9ae){return _0x17b9ae;});}return null;};}function removeEntity(_0x2922d6,_0x576a56){return function(_0x50678a){if(_0x50678a){return _0x50678a[_0x02c7('0x23')]()[_0x02c7('0x22')](function(){var _0x1a3087=_0x50678a[_0x02c7('0x24')]({'plain':!![]});var _0x32ae61='Intervals';return db[_0x02c7('0x25')][_0x02c7('0x23')]({'where':{'type':_0x32ae61,'resourceId':_0x1a3087['id']}})[_0x02c7('0x22')](function(){return _0x50678a;});})[_0x02c7('0x22')](function(){_0x2922d6[_0x02c7('0x1a')](0xcc)[_0x02c7('0x19')]();});}};}function handleEntityNotFound(_0x3e0b42,_0x5aaa44){return function(_0x3b465c){if(!_0x3b465c){_0x3e0b42[_0x02c7('0x18')](0x194);}return _0x3b465c;};}function handleError(_0x4e7211,_0x37b0a4){_0x37b0a4=_0x37b0a4||0x1f4;return function(_0xaa7f3b){logger['error'](_0xaa7f3b[_0x02c7('0x26')]);if(_0xaa7f3b[_0x02c7('0x27')]){delete _0xaa7f3b['name'];}_0x4e7211[_0x02c7('0x1a')](_0x37b0a4)[_0x02c7('0x28')](_0xaa7f3b);};}exports[_0x02c7('0x29')]=function(_0x5e72de,_0x73993e){var _0x184f1b={},_0x2dd463={},_0x224d51={'count':0x0,'rows':[]};var _0x4f47fa=_[_0x02c7('0x2a')](db['Interval']['rawAttributes'],function(_0x4f5f15){return{'name':_0x4f5f15[_0x02c7('0x2b')],'type':_0x4f5f15[_0x02c7('0x2c')][_0x02c7('0x2d')]};});_0x2dd463['model']=_[_0x02c7('0x2a')](_0x4f47fa,_0x02c7('0x27'));_0x2dd463['query']=_[_0x02c7('0x2e')](_0x5e72de[_0x02c7('0x2f')]);_0x2dd463['filters']=_[_0x02c7('0x30')](_0x2dd463[_0x02c7('0x31')],_0x2dd463['query']);_0x184f1b[_0x02c7('0x32')]=_[_0x02c7('0x30')](_0x2dd463[_0x02c7('0x31')],qs[_0x02c7('0x33')](_0x5e72de[_0x02c7('0x2f')]['fields']));_0x184f1b['attributes']=_0x184f1b[_0x02c7('0x32')][_0x02c7('0x34')]?_0x184f1b[_0x02c7('0x32')]:_0x2dd463['model'];if(!_0x5e72de[_0x02c7('0x2f')]['hasOwnProperty'](_0x02c7('0x35'))){_0x184f1b[_0x02c7('0x1f')]=qs[_0x02c7('0x1f')](_0x5e72de[_0x02c7('0x2f')]['limit']);_0x184f1b['offset']=qs['offset'](_0x5e72de['query'][_0x02c7('0x1c')]);}_0x184f1b[_0x02c7('0x36')]=qs[_0x02c7('0x37')](_0x5e72de[_0x02c7('0x2f')]['sort']);_0x184f1b[_0x02c7('0x38')]=qs[_0x02c7('0x39')](_[_0x02c7('0x3a')](_0x5e72de[_0x02c7('0x2f')],_0x2dd463[_0x02c7('0x39')]),_0x4f47fa);if(_0x5e72de[_0x02c7('0x2f')][_0x02c7('0x3b')]){_0x184f1b[_0x02c7('0x38')]=_[_0x02c7('0x3c')](_0x184f1b[_0x02c7('0x38')],{'$or':_[_0x02c7('0x2a')](_0x4f47fa,function(_0xf9570){if(_0xf9570[_0x02c7('0x2c')]!=='VIRTUAL'){var _0x5cbcae={};_0x5cbcae[_0xf9570[_0x02c7('0x27')]]={'$like':'%'+_0x5e72de['query'][_0x02c7('0x3b')]+'%'};return _0x5cbcae;}})});}_0x184f1b=_[_0x02c7('0x3c')]({},_0x184f1b,_0x5e72de[_0x02c7('0x3d')]);var _0x108ea5={'where':_0x184f1b[_0x02c7('0x38')]};return db[_0x02c7('0x3e')]['count'](_0x108ea5)[_0x02c7('0x22')](function(_0x548738){_0x224d51[_0x02c7('0x1e')]=_0x548738;if(_0x5e72de[_0x02c7('0x2f')][_0x02c7('0x3f')]){_0x184f1b[_0x02c7('0x40')]=[{'all':!![]}];}return db[_0x02c7('0x3e')][_0x02c7('0x41')](_0x184f1b);})[_0x02c7('0x22')](function(_0x1b1957){_0x224d51[_0x02c7('0x42')]=_0x1b1957;return _0x224d51;})['then'](respondWithFilteredResult(_0x73993e,_0x184f1b))[_0x02c7('0x43')](handleError(_0x73993e,null));};exports[_0x02c7('0x44')]=function(_0x2bffd8,_0x4e9503){var _0x2ef716={'raw':!![],'where':{'id':_0x2bffd8['params']['id']}},_0x1ae60f={};_0x1ae60f['model']=_[_0x02c7('0x2e')](db[_0x02c7('0x3e')][_0x02c7('0x45')]);_0x1ae60f[_0x02c7('0x2f')]=_['keys'](_0x2bffd8['query']);_0x1ae60f['filters']=_[_0x02c7('0x30')](_0x1ae60f['model'],_0x1ae60f[_0x02c7('0x2f')]);_0x2ef716['attributes']=_[_0x02c7('0x30')](_0x1ae60f[_0x02c7('0x31')],qs[_0x02c7('0x33')](_0x2bffd8[_0x02c7('0x2f')][_0x02c7('0x33')]));_0x2ef716[_0x02c7('0x32')]=_0x2ef716[_0x02c7('0x32')][_0x02c7('0x34')]?_0x2ef716[_0x02c7('0x32')]:_0x1ae60f[_0x02c7('0x31')];if(_0x2bffd8[_0x02c7('0x2f')][_0x02c7('0x3f')]){_0x2ef716[_0x02c7('0x40')]=[{'all':!![]}];}_0x2ef716=_['merge']({},_0x2ef716,_0x2bffd8[_0x02c7('0x3d')]);return db[_0x02c7('0x3e')][_0x02c7('0x46')](_0x2ef716)[_0x02c7('0x22')](handleEntityNotFound(_0x4e9503,null))[_0x02c7('0x22')](respondWithResult(_0x4e9503,null))[_0x02c7('0x43')](handleError(_0x4e9503,null));};exports['create']=function(_0x4a87b5,_0x4faaed){return db[_0x02c7('0x3e')]['create'](_0x4a87b5['body'],{})[_0x02c7('0x22')](function(_0x50d580){var _0x318dc1=_0x4a87b5['user'][_0x02c7('0x24')]({'plain':!![]});if(!_0x318dc1)throw new Error(_0x02c7('0x47'));if(_0x318dc1[_0x02c7('0x48')]===_0x02c7('0x49')){var _0x1a5877=_0x50d580[_0x02c7('0x24')]({'plain':!![]});var _0x544a91=_0x02c7('0x4a');return db[_0x02c7('0x4b')][_0x02c7('0x46')]({'where':{'name':_0x544a91,'userProfileId':_0x318dc1[_0x02c7('0x4c')]},'raw':!![]})[_0x02c7('0x22')](function(_0x1af21e){if(_0x1af21e&&_0x1af21e[_0x02c7('0x4d')]===0x0){return db[_0x02c7('0x25')][_0x02c7('0x4e')]({'name':_0x1a5877['name'],'resourceId':_0x1a5877['id'],'type':_0x1af21e[_0x02c7('0x27')],'sectionId':_0x1af21e['id']},{})[_0x02c7('0x22')](function(){return _0x50d580;});}else{return _0x50d580;}})[_0x02c7('0x43')](function(_0x44003e){logger[_0x02c7('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44003e);throw _0x44003e;});}return _0x50d580;})[_0x02c7('0x22')](respondWithResult(_0x4faaed,0xc9))[_0x02c7('0x43')](handleError(_0x4faaed,null));};exports[_0x02c7('0x50')]=function(_0x1fc9fb,_0xbea481){if(_0x1fc9fb[_0x02c7('0x51')]['id']){delete _0x1fc9fb[_0x02c7('0x51')]['id'];}return db[_0x02c7('0x3e')]['find']({'where':{'id':_0x1fc9fb[_0x02c7('0x52')]['id']}})[_0x02c7('0x22')](handleEntityNotFound(_0xbea481,null))[_0x02c7('0x22')](saveUpdates(_0x1fc9fb[_0x02c7('0x51')],null))[_0x02c7('0x22')](respondWithResult(_0xbea481,null))[_0x02c7('0x43')](handleError(_0xbea481,null));};exports[_0x02c7('0x23')]=function(_0x516a7d,_0x57d1db){return db[_0x02c7('0x3e')]['find']({'where':{'id':_0x516a7d[_0x02c7('0x52')]['id']}})[_0x02c7('0x22')](handleEntityNotFound(_0x57d1db,null))[_0x02c7('0x22')](removeEntity(_0x57d1db,null))['catch'](handleError(_0x57d1db,null));};exports[_0x02c7('0x53')]=function(_0xe0bb,_0x1429be,_0x6cbbb1){if(_0xe0bb[_0x02c7('0x51')]['id']){delete _0xe0bb[_0x02c7('0x51')]['id'];}return db[_0x02c7('0x3e')][_0x02c7('0x46')]({'where':{'id':_0xe0bb[_0x02c7('0x52')]['id']}})[_0x02c7('0x22')](handleEntityNotFound(_0x1429be,null))[_0x02c7('0x22')](function(_0x2f9c90){if(_0x2f9c90){_0xe0bb[_0x02c7('0x51')]['IntervalId']=_0x2f9c90['id'];return db['Interval'][_0x02c7('0x4e')](_0xe0bb[_0x02c7('0x51')]);}})['then'](respondWithResult(_0x1429be,null))['catch'](handleError(_0x1429be,null));};exports['getIntervals']=function(_0x21295a,_0x307d34,_0x5a4755){var _0xf1568e={};var _0x2d3fcd={};var _0x189d78;var _0x590e1c;return db['Interval'][_0x02c7('0x54')]({'where':{'id':_0x21295a[_0x02c7('0x52')]['id']}})[_0x02c7('0x22')](handleEntityNotFound(_0x307d34,null))[_0x02c7('0x22')](function(_0x3e8a86){if(_0x3e8a86){_0x189d78=_0x3e8a86;_0x2d3fcd[_0x02c7('0x31')]=_[_0x02c7('0x2e')](db[_0x02c7('0x3e')][_0x02c7('0x45')]);_0x2d3fcd[_0x02c7('0x2f')]=_[_0x02c7('0x2e')](_0x21295a[_0x02c7('0x2f')]);_0x2d3fcd['filters']=_['intersection'](_0x2d3fcd['model'],_0x2d3fcd['query']);_0xf1568e[_0x02c7('0x32')]=_[_0x02c7('0x30')](_0x2d3fcd[_0x02c7('0x31')],qs[_0x02c7('0x33')](_0x21295a[_0x02c7('0x2f')]['fields']));_0xf1568e['attributes']=_0xf1568e[_0x02c7('0x32')][_0x02c7('0x34')]?_0xf1568e[_0x02c7('0x32')]:_0x2d3fcd['model'];_0xf1568e[_0x02c7('0x36')]=qs[_0x02c7('0x37')](_0x21295a[_0x02c7('0x2f')][_0x02c7('0x37')]);_0xf1568e[_0x02c7('0x38')]=qs['filters'](_['pick'](_0x21295a[_0x02c7('0x2f')],_0x2d3fcd[_0x02c7('0x39')]));if(_0x21295a[_0x02c7('0x2f')][_0x02c7('0x3b')]){_0xf1568e[_0x02c7('0x38')]=_['merge'](_0xf1568e[_0x02c7('0x38')],{'$or':_['map'](_0xf1568e[_0x02c7('0x32')],function(_0x452dcd){var _0x6e2260={};_0x6e2260[_0x452dcd]={'$like':'%'+_0x21295a['query']['filter']+'%'};return _0x6e2260;})});}_0xf1568e=_[_0x02c7('0x3c')]({},_0xf1568e,_0x21295a[_0x02c7('0x3d')]);return _0x189d78[_0x02c7('0x55')](_0xf1568e);}})[_0x02c7('0x22')](function(_0x3722f5){if(_0x3722f5){_0x590e1c=_0x3722f5['length'];if(!_0x21295a['query']['hasOwnProperty'](_0x02c7('0x35'))){_0xf1568e[_0x02c7('0x1f')]=qs[_0x02c7('0x1f')](_0x21295a['query'][_0x02c7('0x1f')]);_0xf1568e['offset']=qs[_0x02c7('0x1c')](_0x21295a[_0x02c7('0x2f')]['offset']);}return _0x189d78[_0x02c7('0x55')](_0xf1568e);}})['then'](function(_0x154a5d){if(_0x154a5d){return _0x154a5d?{'count':_0x590e1c,'rows':_0x154a5d}:null;}})[_0x02c7('0x22')](respondWithResult(_0x307d34,null))[_0x02c7('0x43')](handleError(_0x307d34,null));};exports[_0x02c7('0x56')]=function(_0x479ad1,_0x1325b4,_0x14e550){return db[_0x02c7('0x3e')]['findOne']({'where':{'id':_0x479ad1['params']['id']}})[_0x02c7('0x22')](handleEntityNotFound(_0x1325b4,null))[_0x02c7('0x22')](function(_0x534a66){if(_0x534a66){return db[_0x02c7('0x57')]['transaction'](function(_0xa7d55b){return db[_0x02c7('0x3e')][_0x02c7('0x23')]({'where':{'IntervalId':_0x479ad1[_0x02c7('0x52')]['id']},'transaction':_0xa7d55b})['then'](function(_0x39f06e){var _0x26309d=_[_0x02c7('0x2a')](_0x479ad1['body'],function(_0x550ebe){delete _0x550ebe['id'];_0x550ebe[_0x02c7('0x58')]=_0x479ad1['params']['id'];return _0x550ebe;});return db[_0x02c7('0x3e')][_0x02c7('0x59')](_0x26309d,{'transaction':_0xa7d55b});});})[_0x02c7('0x22')](function(){return db['Interval'][_0x02c7('0x41')]({'where':{'IntervalId':_0x479ad1['params']['id']}});});}})[_0x02c7('0x22')](respondWithResult(_0x1325b4,null))[_0x02c7('0x43')](handleError(_0x1325b4,null));}; \ No newline at end of file +var _0xb954=['includeAll','include','rows','catch','keys','intersection','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','body','find','params','addInterval','getIntervals','findOne','length','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','rawAttributes','type','map','filters','attributes','model','fields','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Interval'];(function(_0x2c5ec6,_0x2b60d7){var _0x475e3c=function(_0x3c7bf1){while(--_0x3c7bf1){_0x2c5ec6['push'](_0x2c5ec6['shift']());}};_0x475e3c(++_0x2b60d7);}(_0xb954,0x1c6));var _0x4b95=function(_0xe22435,_0x27157f){_0xe22435=_0xe22435-0x0;var _0x4fa237=_0xb954[_0xe22435];return _0x4fa237;};'use strict';var emlformat=require(_0x4b95('0x0'));var rimraf=require(_0x4b95('0x1'));var zipdir=require(_0x4b95('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b95('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b95('0x4'));var util=require(_0x4b95('0x5'));var path=require(_0x4b95('0x6'));var sox=require(_0x4b95('0x7'));var csv=require(_0x4b95('0x8'));var ejs=require(_0x4b95('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4b95('0xa'));var crypto=require(_0x4b95('0xb'));var jsforce=require(_0x4b95('0xc'));var deskjs=require(_0x4b95('0xd'));var toCsv=require(_0x4b95('0x8'));var querystring=require(_0x4b95('0xe'));var Papa=require(_0x4b95('0xf'));var Redis=require(_0x4b95('0x10'));var authService=require(_0x4b95('0x11'));var qs=require(_0x4b95('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b95('0x13'));var logger=require(_0x4b95('0x14'))(_0x4b95('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xe0272c,_0x718d0d){_0x718d0d=_0x718d0d||0xcc;return function(_0x49dd53){if(_0x49dd53){return _0xe0272c[_0x4b95('0x16')](_0x718d0d);}return _0xe0272c[_0x4b95('0x17')](_0x718d0d)[_0x4b95('0x18')]();};}function respondWithResult(_0x384dfe,_0x43b024){_0x43b024=_0x43b024||0xc8;return function(_0xc1245e){if(_0xc1245e){return _0x384dfe[_0x4b95('0x17')](_0x43b024)['json'](_0xc1245e);}};}function respondWithFilteredResult(_0x2ab64e,_0x74a228){return function(_0x381a92){if(_0x381a92){var _0x3d7b50=typeof _0x74a228[_0x4b95('0x19')]===_0x4b95('0x1a')&&typeof _0x74a228[_0x4b95('0x1b')]==='undefined';var _0x612bf=_0x381a92[_0x4b95('0x1c')];var _0x464b94=_0x3d7b50?0x0:_0x74a228[_0x4b95('0x19')];var _0x1bbe39=_0x3d7b50?_0x381a92[_0x4b95('0x1c')]:_0x74a228['offset']+_0x74a228['limit'];var _0xf47d4c;if(_0x1bbe39>=_0x612bf){_0x1bbe39=_0x612bf;_0xf47d4c=0xc8;}else{_0xf47d4c=0xce;}_0x2ab64e[_0x4b95('0x17')](_0xf47d4c);return _0x2ab64e['set'](_0x4b95('0x1d'),_0x464b94+'-'+_0x1bbe39+'/'+_0x612bf)[_0x4b95('0x1e')](_0x381a92);}return null;};}function patchUpdates(_0x1cbc28){return function(_0x2adc8e){try{jsonpatch[_0x4b95('0x1f')](_0x2adc8e,_0x1cbc28,!![]);}catch(_0x4654dc){return BPromise['reject'](_0x4654dc);}return _0x2adc8e[_0x4b95('0x20')]();};}function saveUpdates(_0x2066e7,_0x118245){return function(_0x9687fc){if(_0x9687fc){return _0x9687fc[_0x4b95('0x21')](_0x2066e7)[_0x4b95('0x22')](function(_0x1ffee8){return _0x1ffee8;});}return null;};}function removeEntity(_0xdfc96b,_0x45294a){return function(_0x20ace2){if(_0x20ace2){return _0x20ace2[_0x4b95('0x23')]()[_0x4b95('0x22')](function(){var _0x45a690=_0x20ace2[_0x4b95('0x24')]({'plain':!![]});var _0x5abf32=_0x4b95('0x25');return db[_0x4b95('0x26')][_0x4b95('0x23')]({'where':{'type':_0x5abf32,'resourceId':_0x45a690['id']}})[_0x4b95('0x22')](function(){return _0x20ace2;});})[_0x4b95('0x22')](function(){_0xdfc96b[_0x4b95('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ff69f,_0x3c63b9){return function(_0xec51ef){if(!_0xec51ef){_0x3ff69f[_0x4b95('0x16')](0x194);}return _0xec51ef;};}function handleError(_0x5b9473,_0x4dd598){_0x4dd598=_0x4dd598||0x1f4;return function(_0x395517){logger['error'](_0x395517[_0x4b95('0x27')]);if(_0x395517[_0x4b95('0x28')]){delete _0x395517[_0x4b95('0x28')];}_0x5b9473[_0x4b95('0x17')](_0x4dd598)[_0x4b95('0x29')](_0x395517);};}exports[_0x4b95('0x2a')]=function(_0x592256,_0x4f4cbb){var _0x2b359d={},_0x472298={},_0x5976d2={'count':0x0,'rows':[]};var _0x597b17=_['map'](db['Interval'][_0x4b95('0x2b')],function(_0x3c2f64){return{'name':_0x3c2f64['fieldName'],'type':_0x3c2f64[_0x4b95('0x2c')]['key']};});_0x472298['model']=_[_0x4b95('0x2d')](_0x597b17,_0x4b95('0x28'));_0x472298['query']=_['keys'](_0x592256['query']);_0x472298[_0x4b95('0x2e')]=_['intersection'](_0x472298['model'],_0x472298['query']);_0x2b359d[_0x4b95('0x2f')]=_['intersection'](_0x472298[_0x4b95('0x30')],qs[_0x4b95('0x31')](_0x592256[_0x4b95('0x32')][_0x4b95('0x31')]));_0x2b359d['attributes']=_0x2b359d['attributes']['length']?_0x2b359d[_0x4b95('0x2f')]:_0x472298[_0x4b95('0x30')];if(!_0x592256['query'][_0x4b95('0x33')](_0x4b95('0x34'))){_0x2b359d[_0x4b95('0x1b')]=qs['limit'](_0x592256[_0x4b95('0x32')][_0x4b95('0x1b')]);_0x2b359d[_0x4b95('0x19')]=qs['offset'](_0x592256['query'][_0x4b95('0x19')]);}_0x2b359d[_0x4b95('0x35')]=qs['sort'](_0x592256[_0x4b95('0x32')][_0x4b95('0x36')]);_0x2b359d['where']=qs[_0x4b95('0x2e')](_[_0x4b95('0x37')](_0x592256[_0x4b95('0x32')],_0x472298['filters']),_0x597b17);if(_0x592256[_0x4b95('0x32')][_0x4b95('0x38')]){_0x2b359d[_0x4b95('0x39')]=_[_0x4b95('0x3a')](_0x2b359d[_0x4b95('0x39')],{'$or':_[_0x4b95('0x2d')](_0x597b17,function(_0x1b833b){if(_0x1b833b[_0x4b95('0x2c')]!==_0x4b95('0x3b')){var _0x28d2ac={};_0x28d2ac[_0x1b833b[_0x4b95('0x28')]]={'$like':'%'+_0x592256[_0x4b95('0x32')][_0x4b95('0x38')]+'%'};return _0x28d2ac;}})});}_0x2b359d=_[_0x4b95('0x3a')]({},_0x2b359d,_0x592256[_0x4b95('0x3c')]);var _0x1d5c45={'where':_0x2b359d[_0x4b95('0x39')]};return db[_0x4b95('0x3d')][_0x4b95('0x1c')](_0x1d5c45)[_0x4b95('0x22')](function(_0x5b3336){_0x5976d2[_0x4b95('0x1c')]=_0x5b3336;if(_0x592256[_0x4b95('0x32')][_0x4b95('0x3e')]){_0x2b359d[_0x4b95('0x3f')]=[{'all':!![]}];}return db[_0x4b95('0x3d')]['findAll'](_0x2b359d);})[_0x4b95('0x22')](function(_0x57a8cf){_0x5976d2[_0x4b95('0x40')]=_0x57a8cf;return _0x5976d2;})[_0x4b95('0x22')](respondWithFilteredResult(_0x4f4cbb,_0x2b359d))[_0x4b95('0x41')](handleError(_0x4f4cbb,null));};exports['show']=function(_0x15e28d,_0x1bcdb7){var _0x604b34={'raw':!![],'where':{'id':_0x15e28d['params']['id']}},_0x12043e={};_0x12043e['model']=_[_0x4b95('0x42')](db[_0x4b95('0x3d')][_0x4b95('0x2b')]);_0x12043e['query']=_[_0x4b95('0x42')](_0x15e28d['query']);_0x12043e[_0x4b95('0x2e')]=_[_0x4b95('0x43')](_0x12043e[_0x4b95('0x30')],_0x12043e['query']);_0x604b34['attributes']=_[_0x4b95('0x43')](_0x12043e[_0x4b95('0x30')],qs[_0x4b95('0x31')](_0x15e28d[_0x4b95('0x32')][_0x4b95('0x31')]));_0x604b34[_0x4b95('0x2f')]=_0x604b34[_0x4b95('0x2f')]['length']?_0x604b34[_0x4b95('0x2f')]:_0x12043e[_0x4b95('0x30')];if(_0x15e28d[_0x4b95('0x32')][_0x4b95('0x3e')]){_0x604b34[_0x4b95('0x3f')]=[{'all':!![]}];}_0x604b34=_[_0x4b95('0x3a')]({},_0x604b34,_0x15e28d['options']);return db['Interval']['find'](_0x604b34)['then'](handleEntityNotFound(_0x1bcdb7,null))['then'](respondWithResult(_0x1bcdb7,null))[_0x4b95('0x41')](handleError(_0x1bcdb7,null));};exports[_0x4b95('0x44')]=function(_0x4ca14c,_0x514d8e){return db['Interval']['create'](_0x4ca14c['body'],{})['then'](function(_0xafe336){var _0x4ff268=_0x4ca14c['user']['get']({'plain':!![]});if(!_0x4ff268)throw new Error(_0x4b95('0x45'));if(_0x4ff268['role']===_0x4b95('0x46')){var _0x4caedd=_0xafe336['get']({'plain':!![]});var _0xd9b6fa='Intervals';return db[_0x4b95('0x47')]['find']({'where':{'name':_0xd9b6fa,'userProfileId':_0x4ff268[_0x4b95('0x48')]},'raw':!![]})[_0x4b95('0x22')](function(_0x2146b5){if(_0x2146b5&&_0x2146b5[_0x4b95('0x49')]===0x0){return db[_0x4b95('0x26')][_0x4b95('0x44')]({'name':_0x4caedd[_0x4b95('0x28')],'resourceId':_0x4caedd['id'],'type':_0x2146b5[_0x4b95('0x28')],'sectionId':_0x2146b5['id']},{})[_0x4b95('0x22')](function(){return _0xafe336;});}else{return _0xafe336;}})['catch'](function(_0x5c8e6c){logger[_0x4b95('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c8e6c);throw _0x5c8e6c;});}return _0xafe336;})[_0x4b95('0x22')](respondWithResult(_0x514d8e,0xc9))[_0x4b95('0x41')](handleError(_0x514d8e,null));};exports[_0x4b95('0x21')]=function(_0x52b7bb,_0x182ae9){if(_0x52b7bb[_0x4b95('0x4b')]['id']){delete _0x52b7bb[_0x4b95('0x4b')]['id'];}return db[_0x4b95('0x3d')][_0x4b95('0x4c')]({'where':{'id':_0x52b7bb[_0x4b95('0x4d')]['id']}})[_0x4b95('0x22')](handleEntityNotFound(_0x182ae9,null))[_0x4b95('0x22')](saveUpdates(_0x52b7bb[_0x4b95('0x4b')],null))[_0x4b95('0x22')](respondWithResult(_0x182ae9,null))[_0x4b95('0x41')](handleError(_0x182ae9,null));};exports['destroy']=function(_0x3259c6,_0x5d1ba4){return db[_0x4b95('0x3d')][_0x4b95('0x4c')]({'where':{'id':_0x3259c6['params']['id']}})['then'](handleEntityNotFound(_0x5d1ba4,null))[_0x4b95('0x22')](removeEntity(_0x5d1ba4,null))['catch'](handleError(_0x5d1ba4,null));};exports[_0x4b95('0x4e')]=function(_0x22d3a6,_0x44aeea,_0x349baa){if(_0x22d3a6[_0x4b95('0x4b')]['id']){delete _0x22d3a6[_0x4b95('0x4b')]['id'];}return db[_0x4b95('0x3d')][_0x4b95('0x4c')]({'where':{'id':_0x22d3a6['params']['id']}})[_0x4b95('0x22')](handleEntityNotFound(_0x44aeea,null))[_0x4b95('0x22')](function(_0x27c38c){if(_0x27c38c){_0x22d3a6[_0x4b95('0x4b')]['IntervalId']=_0x27c38c['id'];return db[_0x4b95('0x3d')][_0x4b95('0x44')](_0x22d3a6[_0x4b95('0x4b')]);}})[_0x4b95('0x22')](respondWithResult(_0x44aeea,null))[_0x4b95('0x41')](handleError(_0x44aeea,null));};exports[_0x4b95('0x4f')]=function(_0xf61fc3,_0xbd3d96,_0x452145){var _0x587d29={};var _0x251469={};var _0x2a2907;var _0x29c82d;return db[_0x4b95('0x3d')][_0x4b95('0x50')]({'where':{'id':_0xf61fc3[_0x4b95('0x4d')]['id']}})[_0x4b95('0x22')](handleEntityNotFound(_0xbd3d96,null))[_0x4b95('0x22')](function(_0x44cd0c){if(_0x44cd0c){_0x2a2907=_0x44cd0c;_0x251469[_0x4b95('0x30')]=_[_0x4b95('0x42')](db['Interval'][_0x4b95('0x2b')]);_0x251469[_0x4b95('0x32')]=_[_0x4b95('0x42')](_0xf61fc3[_0x4b95('0x32')]);_0x251469[_0x4b95('0x2e')]=_[_0x4b95('0x43')](_0x251469[_0x4b95('0x30')],_0x251469[_0x4b95('0x32')]);_0x587d29['attributes']=_[_0x4b95('0x43')](_0x251469[_0x4b95('0x30')],qs[_0x4b95('0x31')](_0xf61fc3['query'][_0x4b95('0x31')]));_0x587d29['attributes']=_0x587d29['attributes'][_0x4b95('0x51')]?_0x587d29[_0x4b95('0x2f')]:_0x251469[_0x4b95('0x30')];_0x587d29[_0x4b95('0x35')]=qs['sort'](_0xf61fc3[_0x4b95('0x32')][_0x4b95('0x36')]);_0x587d29['where']=qs[_0x4b95('0x2e')](_['pick'](_0xf61fc3[_0x4b95('0x32')],_0x251469[_0x4b95('0x2e')]));if(_0xf61fc3[_0x4b95('0x32')]['filter']){_0x587d29[_0x4b95('0x39')]=_['merge'](_0x587d29['where'],{'$or':_[_0x4b95('0x2d')](_0x587d29[_0x4b95('0x2f')],function(_0x2cf10b){var _0x484b19={};_0x484b19[_0x2cf10b]={'$like':'%'+_0xf61fc3[_0x4b95('0x32')][_0x4b95('0x38')]+'%'};return _0x484b19;})});}_0x587d29=_['merge']({},_0x587d29,_0xf61fc3[_0x4b95('0x3c')]);return _0x2a2907['getIntervals'](_0x587d29);}})[_0x4b95('0x22')](function(_0x16bcc1){if(_0x16bcc1){_0x29c82d=_0x16bcc1['length'];if(!_0xf61fc3['query'][_0x4b95('0x33')](_0x4b95('0x34'))){_0x587d29[_0x4b95('0x1b')]=qs[_0x4b95('0x1b')](_0xf61fc3[_0x4b95('0x32')][_0x4b95('0x1b')]);_0x587d29[_0x4b95('0x19')]=qs[_0x4b95('0x19')](_0xf61fc3['query'][_0x4b95('0x19')]);}return _0x2a2907['getIntervals'](_0x587d29);}})[_0x4b95('0x22')](function(_0x2b2447){if(_0x2b2447){return _0x2b2447?{'count':_0x29c82d,'rows':_0x2b2447}:null;}})[_0x4b95('0x22')](respondWithResult(_0xbd3d96,null))[_0x4b95('0x41')](handleError(_0xbd3d96,null));};exports['addIntervals']=function(_0x3a5c24,_0x14eb91,_0x3849df){return db['Interval'][_0x4b95('0x50')]({'where':{'id':_0x3a5c24[_0x4b95('0x4d')]['id']}})[_0x4b95('0x22')](handleEntityNotFound(_0x14eb91,null))[_0x4b95('0x22')](function(_0x1f3019){if(_0x1f3019){return db[_0x4b95('0x52')][_0x4b95('0x53')](function(_0x43aea6){return db[_0x4b95('0x3d')][_0x4b95('0x23')]({'where':{'IntervalId':_0x3a5c24['params']['id']},'transaction':_0x43aea6})[_0x4b95('0x22')](function(_0x57c81a){var _0x14b7ec=_[_0x4b95('0x2d')](_0x3a5c24['body'],function(_0x202023){delete _0x202023['id'];_0x202023[_0x4b95('0x54')]=_0x3a5c24[_0x4b95('0x4d')]['id'];return _0x202023;});return db[_0x4b95('0x3d')][_0x4b95('0x55')](_0x14b7ec,{'transaction':_0x43aea6});});})[_0x4b95('0x22')](function(){return db[_0x4b95('0x3d')]['findAll']({'where':{'IntervalId':_0x3a5c24[_0x4b95('0x4d')]['id']}});});}})['then'](respondWithResult(_0x14eb91,null))['catch'](handleError(_0x14eb91,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 599a25c..6d93e7c 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 _0x71ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','util'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x71ca,0x176));var _0xa71c=function(_0x50b835,_0x429e7c){_0x50b835=_0x50b835-0x0;var _0x410894=_0x71ca[_0x50b835];return _0x410894;};'use strict';var _=require('lodash');var util=require(_0xa71c('0x0'));var logger=require(_0xa71c('0x1'))('api');var moment=require(_0xa71c('0x2'));var BPromise=require(_0xa71c('0x3'));var rp=require(_0xa71c('0x4'));var fs=require('fs');var path=require(_0xa71c('0x5'));var rimraf=require(_0xa71c('0x6'));var config=require(_0xa71c('0x7'));var attributes=require(_0xa71c('0x8'));var extensions=require(_0xa71c('0x9'));module[_0xa71c('0xa')]=function(_0x5b03c2,_0x3f9450){return _0x5b03c2[_0xa71c('0xb')](_0xa71c('0xc'),attributes,{'tableName':_0xa71c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43010c,_0x5c38b9){extensions['rewrite'](_0x5b03c2,_0x43010c);},'afterBulkCreate':function(_0x3145de,_0xe93fbc,_0xdd2887){_0xdd2887();extensions[_0xa71c('0xe')](_0x5b03c2,_0x3145de[0x0]);},'afterUpdate':function(_0x59d4ad,_0x2a2ace){extensions[_0xa71c('0xe')](_0x5b03c2,_0x59d4ad);},'afterDestroy':function(_0x577fe1,_0x604a48){extensions[_0xa71c('0xe')](_0x5b03c2,_0x577fe1);}}});}; \ No newline at end of file +var _0xebe6=['bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment'];(function(_0x4850e8,_0x290e5c){var _0xf4b605=function(_0x2fed30){while(--_0x2fed30){_0x4850e8['push'](_0x4850e8['shift']());}};_0xf4b605(++_0x290e5c);}(_0xebe6,0x11b));var _0x6ebe=function(_0x32083e,_0x130a41){_0x32083e=_0x32083e-0x0;var _0x1efcc7=_0xebe6[_0x32083e];return _0x1efcc7;};'use strict';var _=require('lodash');var util=require(_0x6ebe('0x0'));var logger=require(_0x6ebe('0x1'))('api');var moment=require(_0x6ebe('0x2'));var BPromise=require(_0x6ebe('0x3'));var rp=require(_0x6ebe('0x4'));var fs=require('fs');var path=require(_0x6ebe('0x5'));var rimraf=require('rimraf');var config=require(_0x6ebe('0x6'));var attributes=require(_0x6ebe('0x7'));var extensions=require(_0x6ebe('0x8'));module['exports']=function(_0x222a89,_0x34ca73){return _0x222a89[_0x6ebe('0x9')](_0x6ebe('0xa'),attributes,{'tableName':_0x6ebe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f19a0,_0x5d88fa){extensions[_0x6ebe('0xc')](_0x222a89,_0x1f19a0);},'afterBulkCreate':function(_0x82c657,_0x4ee3f0,_0x411156){_0x411156();extensions[_0x6ebe('0xc')](_0x222a89,_0x82c657[0x0]);},'afterUpdate':function(_0x2c60d6,_0x932f96){extensions['rewrite'](_0x222a89,_0x2c60d6);},'afterDestroy':function(_0x5e757b,_0x31e6aa){extensions[_0x6ebe('0xc')](_0x222a89,_0x5e757b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5ffdf61..538ec24 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(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 7dc21c2..59f9df6 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(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'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(_0x533cbd,_0x20fbe8){var _0x4f436f=function(_0x586ee0){while(--_0x586ee0){_0x533cbd['push'](_0x533cbd['shift']());}};_0x4f436f(++_0x20fbe8);}(_0xdb28,0x106));var _0x8db2=function(_0x93e49e,_0x40409c){_0x93e49e=_0x93e49e-0x0;var _0x224416=_0xdb28[_0x93e49e];return _0x224416;};'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 8ebea28..e6cbb57 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 _0x6b4d=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','data','end','statusCode','json','parse','error'];(function(_0xf37717,_0x5afacc){var _0x992835=function(_0x1d9e55){while(--_0x1d9e55){_0xf37717['push'](_0xf37717['shift']());}};_0x992835(++_0x5afacc);}(_0x6b4d,0x1e7));var _0xd6b4=function(_0x29b4e1,_0x37b75a){_0x29b4e1=_0x29b4e1-0x0;var _0x2ed003=_0x6b4d[_0x29b4e1];return _0x2ed003;};'use strict';var BPromise=require(_0xd6b4('0x0'));var https=require(_0xd6b4('0x1'));var logger=require(_0xd6b4('0x2'))(_0xd6b4('0x3'));var USERNAME=_0xd6b4('0x4');var PASSWORD=_0xd6b4('0x5');function openIssue(_0x21974a,_0x20f702){var _0x2f0952={'fields':{'project':{'key':_0x21974a['key']||'MOTGUI'},'summary':(_0x21974a[_0xd6b4('0x6')]||_0xd6b4('0x7'))+_0xd6b4('0x8')+_0x21974a['ip'],'description':_0x21974a[_0xd6b4('0x9')]||JSON[_0xd6b4('0xa')](_0x21974a),'issuetype':{'name':_0x21974a[_0xd6b4('0xb')]||_0xd6b4('0xc')}}};_0x2f0952[_0xd6b4('0xd')]['customfield_11500']=_0x21974a['email'];_0x2f0952[_0xd6b4('0xd')][_0xd6b4('0xe')]=_0x21974a[_0xd6b4('0xf')];_0x2f0952['fields'][_0xd6b4('0x10')]=_0x21974a[_0xd6b4('0x11')];_0x2f0952[_0xd6b4('0xd')]['customfield_11503']=_0x21974a['name'];_0x2f0952[_0xd6b4('0xd')][_0xd6b4('0x12')]=_0x21974a[_0xd6b4('0x13')];_0x2f0952[_0xd6b4('0xd')]['customfield_10102']=_0x21974a['ip'];var _0x2341d3={'host':_0xd6b4('0x14'),'port':0x1bb,'path':_0xd6b4('0x15'),'method':_0xd6b4('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xd6b4('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xd6b4('0x18')](_0xd6b4('0x19'))}};var _0x55ae7e=JSON[_0xd6b4('0xa')](_0x2f0952);var _0x111727=https[_0xd6b4('0x1a')](_0x2341d3,function(_0x6b2464){_0x6b2464['setEncoding']('utf8');var _0x226a8c='';_0x6b2464['on'](_0xd6b4('0x1b'),function(_0xf73ff4){_0x226a8c+=_0xf73ff4;});_0x6b2464['on'](_0xd6b4('0x1c'),function(){if(_0x20f702){return _0x20f702['status'](_0x6b2464[_0xd6b4('0x1d')])[_0xd6b4('0x1e')](JSON[_0xd6b4('0x1f')](_0x226a8c));}});});_0x111727['on'](_0xd6b4('0x20'),function(_0x12a46f){if(_0x20f702){return _0x20f702['status'](0x1f4)[_0xd6b4('0x1e')]({'errors':[{'message':_0xd6b4('0x21'),'type':_0xd6b4('0x22')}]});}});_0x111727['write'](_0x55ae7e);_0x111727['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x412c4b,_0x97ff2e){_0x412c4b[_0xd6b4('0x23')]['ip']=_0x412c4b['headers'][_0xd6b4('0x24')]||_0x412c4b[_0xd6b4('0x25')][_0xd6b4('0x26')]||_0x412c4b['socket'][_0xd6b4('0x26')]||_0x412c4b[_0xd6b4('0x25')][_0xd6b4('0x27')][_0xd6b4('0x26')];return openIssue(_0x412c4b[_0xd6b4('0x23')],_0x97ff2e);}; \ No newline at end of file +var _0x1f1d=['customfield_11500','email','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','setEncoding','utf8','data','end','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','key','summary','Report','\x20from\x20','description','stringify','issuetype'];(function(_0x15b7df,_0x3f5aca){var _0x38d392=function(_0x4f20e3){while(--_0x4f20e3){_0x15b7df['push'](_0x15b7df['shift']());}};_0x38d392(++_0x3f5aca);}(_0x1f1d,0x1ad));var _0xd1f1=function(_0x276ece,_0x503313){_0x276ece=_0x276ece-0x0;var _0x55bd9c=_0x1f1d[_0x276ece];return _0x55bd9c;};'use strict';var BPromise=require(_0xd1f1('0x0'));var https=require(_0xd1f1('0x1'));var logger=require(_0xd1f1('0x2'))(_0xd1f1('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x53683f,_0x53fc03){var _0xc9160f={'fields':{'project':{'key':_0x53683f[_0xd1f1('0x4')]||'MOTGUI'},'summary':(_0x53683f[_0xd1f1('0x5')]||_0xd1f1('0x6'))+_0xd1f1('0x7')+_0x53683f['ip'],'description':_0x53683f[_0xd1f1('0x8')]||JSON[_0xd1f1('0x9')](_0x53683f),'issuetype':{'name':_0x53683f[_0xd1f1('0xa')]||'Bug'}}};_0xc9160f['fields'][_0xd1f1('0xb')]=_0x53683f[_0xd1f1('0xc')];_0xc9160f[_0xd1f1('0xd')]['customfield_11501']=_0x53683f['oldToken'];_0xc9160f[_0xd1f1('0xd')][_0xd1f1('0xe')]=_0x53683f[_0xd1f1('0xf')];_0xc9160f[_0xd1f1('0xd')][_0xd1f1('0x10')]=_0x53683f[_0xd1f1('0x11')];_0xc9160f['fields'][_0xd1f1('0x12')]=_0x53683f[_0xd1f1('0x13')];_0xc9160f[_0xd1f1('0xd')][_0xd1f1('0x14')]=_0x53683f['ip'];var _0x436c1a={'host':_0xd1f1('0x15'),'port':0x1bb,'path':_0xd1f1('0x16'),'method':_0xd1f1('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xd1f1('0x18'),'Authorization':_0xd1f1('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xd1f1('0x1a'))}};var _0x50e50b=JSON[_0xd1f1('0x9')](_0xc9160f);var _0x10289d=https['request'](_0x436c1a,function(_0x2647ce){_0x2647ce[_0xd1f1('0x1b')](_0xd1f1('0x1c'));var _0x56303d='';_0x2647ce['on'](_0xd1f1('0x1d'),function(_0x1bd6af){_0x56303d+=_0x1bd6af;});_0x2647ce['on'](_0xd1f1('0x1e'),function(){if(_0x53fc03){return _0x53fc03[_0xd1f1('0x1f')](_0x2647ce[_0xd1f1('0x20')])['json'](JSON['parse'](_0x56303d));}});});_0x10289d['on'](_0xd1f1('0x21'),function(_0x1c82e1){if(_0x53fc03){return _0x53fc03['status'](0x1f4)[_0xd1f1('0x22')]({'errors':[{'message':_0xd1f1('0x23'),'type':'api.jira'}]});}});_0x10289d[_0xd1f1('0x24')](_0x50e50b);_0x10289d[_0xd1f1('0x1e')]();}exports['openIssue']=openIssue;exports[_0xd1f1('0x25')]=function(_0x251664,_0x55448b){_0x251664[_0xd1f1('0x26')]['ip']=_0x251664[_0xd1f1('0x27')][_0xd1f1('0x28')]||_0x251664['connection']['remoteAddress']||_0x251664['socket'][_0xd1f1('0x29')]||_0x251664[_0xd1f1('0x2a')][_0xd1f1('0x2b')]['remoteAddress'];return openIssue(_0x251664[_0xd1f1('0x26')],_0x55448b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8a0883f..91c8250 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x310c0a,_0x4ec103){var _0x599109=function(_0x18a58b){while(--_0x18a58b){_0x310c0a['push'](_0x310c0a['shift']());}};_0x599109(++_0x4ec103);}(_0xa75b,0x170));var _0xba75=function(_0x471065,_0x1a8991){_0x471065=_0x471065-0x0;var _0x591f22=_0xa75b[_0x471065];return _0x591f22;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x19de4b,_0x1fe0b7){var _0xbd260=function(_0xb317bd){while(--_0xb317bd){_0x19de4b['push'](_0x19de4b['shift']());}};_0xbd260(++_0x1fe0b7);}(_0x5b02,0xe9));var _0x25b0=function(_0x1b25dc,_0x3fe01b){_0x1b25dc=_0x1b25dc-0x0;var _0x356fad=_0x5b02[_0x1b25dc];return _0x356fad;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 34af7b7..ffad409 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x3f0711,_0x2d5cac){_0x3f0711=_0x3f0711-0x0;var _0x12e42e=_0x7a54[_0x3f0711];return _0x12e42e;};'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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7a54,0x106));var _0x47a5=function(_0x5f546c,_0x35cdb9){_0x5f546c=_0x5f546c-0x0;var _0x3d2932=_0x7a54[_0x5f546c];return _0x3d2932;};'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 d547789..5b9b47d 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 _0xf8b2=['sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','JscriptyAnswerReport','include','findAll','then','rows','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x296db4,_0x3244dc){var _0x44e41c=function(_0x3c2119){while(--_0x3c2119){_0x296db4['push'](_0x296db4['shift']());}};_0x44e41c(++_0x3244dc);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x310eb9,_0x1aed15){_0x310eb9=_0x310eb9-0x0;var _0x28915c=_0xf8b2[_0x310eb9];return _0x28915c;};'use strict';var emlformat=require(_0x2f8b('0x0'));var rimraf=require(_0x2f8b('0x1'));var zipdir=require(_0x2f8b('0x2'));var jsonpatch=require(_0x2f8b('0x3'));var rp=require(_0x2f8b('0x4'));var moment=require(_0x2f8b('0x5'));var BPromise=require(_0x2f8b('0x6'));var Mustache=require(_0x2f8b('0x7'));var util=require('util');var path=require('path');var sox=require(_0x2f8b('0x8'));var csv=require(_0x2f8b('0x9'));var ejs=require(_0x2f8b('0xa'));var fs=require('fs');var fs_extra=require(_0x2f8b('0xb'));var _=require(_0x2f8b('0xc'));var squel=require(_0x2f8b('0xd'));var crypto=require(_0x2f8b('0xe'));var jsforce=require(_0x2f8b('0xf'));var deskjs=require(_0x2f8b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f8b('0x11'));var Papa=require(_0x2f8b('0x12'));var Redis=require(_0x2f8b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f8b('0x14'));var as=require(_0x2f8b('0x15'));var hardwareService=require(_0x2f8b('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2f8b('0x17'));var config=require(_0x2f8b('0x18'));var licenseUtil=require(_0x2f8b('0x19'));var db=require(_0x2f8b('0x1a'))['db'];function respondWithStatusCode(_0x175111,_0x4cb1e0){_0x4cb1e0=_0x4cb1e0||0xcc;return function(_0x16d5a2){if(_0x16d5a2){return _0x175111['sendStatus'](_0x4cb1e0);}return _0x175111[_0x2f8b('0x1b')](_0x4cb1e0)[_0x2f8b('0x1c')]();};}function respondWithResult(_0x1b6a17,_0x15634){_0x15634=_0x15634||0xc8;return function(_0xf9cbe0){if(_0xf9cbe0){return _0x1b6a17[_0x2f8b('0x1b')](_0x15634)[_0x2f8b('0x1d')](_0xf9cbe0);}};}function respondWithFilteredResult(_0x2b6003,_0x532fe4){return function(_0x14a248){if(_0x14a248){var _0xdec711=typeof _0x532fe4[_0x2f8b('0x1e')]===_0x2f8b('0x1f')&&typeof _0x532fe4[_0x2f8b('0x20')]===_0x2f8b('0x1f');var _0x3d65ee=_0x14a248[_0x2f8b('0x21')];var _0x35ec40=_0xdec711?0x0:_0x532fe4['offset'];var _0x23dd63=_0xdec711?_0x14a248[_0x2f8b('0x21')]:_0x532fe4[_0x2f8b('0x1e')]+_0x532fe4['limit'];var _0xdc8171;if(_0x23dd63>=_0x3d65ee){_0x23dd63=_0x3d65ee;_0xdc8171=0xc8;}else{_0xdc8171=0xce;}_0x2b6003['status'](_0xdc8171);return _0x2b6003[_0x2f8b('0x22')](_0x2f8b('0x23'),_0x35ec40+'-'+_0x23dd63+'/'+_0x3d65ee)[_0x2f8b('0x1d')](_0x14a248);}return null;};}function patchUpdates(_0x26d78f){return function(_0x3be6dc){try{jsonpatch['apply'](_0x3be6dc,_0x26d78f,!![]);}catch(_0x29c2f3){return BPromise[_0x2f8b('0x24')](_0x29c2f3);}return _0x3be6dc[_0x2f8b('0x25')]();};}function saveUpdates(_0x17b251,_0x3ad38b){return function(_0x1ffbae){if(_0x1ffbae){return _0x1ffbae[_0x2f8b('0x26')](_0x17b251)['then'](function(_0x273950){return _0x273950;});}return null;};}function removeEntity(_0x23f73c,_0x3560c4){return function(_0x41e12b){if(_0x41e12b){return _0x41e12b[_0x2f8b('0x27')]()['then'](function(){_0x23f73c[_0x2f8b('0x1b')](0xcc)[_0x2f8b('0x1c')]();});}};}function handleEntityNotFound(_0x152492,_0x46a95a){return function(_0x183e51){if(!_0x183e51){_0x152492[_0x2f8b('0x28')](0x194);}return _0x183e51;};}function handleError(_0x45e313,_0x347f5a){_0x347f5a=_0x347f5a||0x1f4;return function(_0x4145b3){logger['error'](_0x4145b3[_0x2f8b('0x29')]);if(_0x4145b3['name']){delete _0x4145b3[_0x2f8b('0x2a')];}_0x45e313[_0x2f8b('0x1b')](_0x347f5a)[_0x2f8b('0x2b')](_0x4145b3);};}exports[_0x2f8b('0x2c')]=function(_0x72b23b,_0x4adacd){var _0x2cfbea={},_0x5cc78c={},_0x5207a8={'count':0x0,'rows':[]};var _0x194e75=_[_0x2f8b('0x2d')](db['JscriptyAnswerReport'][_0x2f8b('0x2e')],function(_0x20d80c){return{'name':_0x20d80c[_0x2f8b('0x2f')],'type':_0x20d80c[_0x2f8b('0x30')][_0x2f8b('0x31')]};});_0x5cc78c[_0x2f8b('0x32')]=_['map'](_0x194e75,_0x2f8b('0x2a'));_0x5cc78c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0x72b23b[_0x2f8b('0x33')]);_0x5cc78c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x5cc78c[_0x2f8b('0x32')],_0x5cc78c['query']);_0x2cfbea[_0x2f8b('0x37')]=_['intersection'](_0x5cc78c[_0x2f8b('0x32')],qs[_0x2f8b('0x38')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x38')]));_0x2cfbea[_0x2f8b('0x37')]=_0x2cfbea[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x2cfbea[_0x2f8b('0x37')]:_0x5cc78c[_0x2f8b('0x32')];if(!_0x72b23b['query']['hasOwnProperty'](_0x2f8b('0x3a'))){_0x2cfbea[_0x2f8b('0x20')]=qs[_0x2f8b('0x20')](_0x72b23b[_0x2f8b('0x33')]['limit']);_0x2cfbea[_0x2f8b('0x1e')]=qs[_0x2f8b('0x1e')](_0x72b23b[_0x2f8b('0x33')][_0x2f8b('0x1e')]);}_0x2cfbea[_0x2f8b('0x3b')]=qs['sort'](_0x72b23b['query'][_0x2f8b('0x3c')]);_0x2cfbea[_0x2f8b('0x3d')]=qs[_0x2f8b('0x35')](_[_0x2f8b('0x3e')](_0x72b23b[_0x2f8b('0x33')],_0x5cc78c[_0x2f8b('0x35')]),_0x194e75);if(_0x72b23b[_0x2f8b('0x33')]['filter']){_0x2cfbea[_0x2f8b('0x3d')]=_[_0x2f8b('0x3f')](_0x2cfbea['where'],{'$or':_[_0x2f8b('0x2d')](_0x194e75,function(_0x4594b2){if(_0x4594b2[_0x2f8b('0x30')]!=='VIRTUAL'){var _0xa1d8de={};_0xa1d8de[_0x4594b2[_0x2f8b('0x2a')]]={'$like':'%'+_0x72b23b['query'][_0x2f8b('0x40')]+'%'};return _0xa1d8de;}})});}_0x2cfbea=_[_0x2f8b('0x3f')]({},_0x2cfbea,_0x72b23b['options']);var _0x92b37a={'where':_0x2cfbea['where']};return db[_0x2f8b('0x41')][_0x2f8b('0x21')](_0x92b37a)['then'](function(_0x9030da){_0x5207a8[_0x2f8b('0x21')]=_0x9030da;if(_0x72b23b[_0x2f8b('0x33')]['includeAll']){_0x2cfbea[_0x2f8b('0x42')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x2f8b('0x43')](_0x2cfbea);})[_0x2f8b('0x44')](function(_0x1ff6e7){_0x5207a8[_0x2f8b('0x45')]=_0x1ff6e7;return _0x5207a8;})[_0x2f8b('0x44')](respondWithFilteredResult(_0x4adacd,_0x2cfbea))[_0x2f8b('0x46')](handleError(_0x4adacd,null));};exports[_0x2f8b('0x47')]=function(_0xa2fc94,_0x1c0b64){var _0x40577c={'raw':!![],'where':{'id':_0xa2fc94[_0x2f8b('0x48')]['id']}},_0x45c92c={};_0x45c92c[_0x2f8b('0x32')]=_[_0x2f8b('0x34')](db[_0x2f8b('0x41')][_0x2f8b('0x2e')]);_0x45c92c[_0x2f8b('0x33')]=_[_0x2f8b('0x34')](_0xa2fc94[_0x2f8b('0x33')]);_0x45c92c[_0x2f8b('0x35')]=_[_0x2f8b('0x36')](_0x45c92c[_0x2f8b('0x32')],_0x45c92c[_0x2f8b('0x33')]);_0x40577c[_0x2f8b('0x37')]=_[_0x2f8b('0x36')](_0x45c92c['model'],qs['fields'](_0xa2fc94['query'][_0x2f8b('0x38')]));_0x40577c['attributes']=_0x40577c[_0x2f8b('0x37')][_0x2f8b('0x39')]?_0x40577c[_0x2f8b('0x37')]:_0x45c92c['model'];if(_0xa2fc94[_0x2f8b('0x33')]['includeAll']){_0x40577c[_0x2f8b('0x42')]=[{'all':!![]}];}_0x40577c=_['merge']({},_0x40577c,_0xa2fc94[_0x2f8b('0x49')]);return db[_0x2f8b('0x41')]['find'](_0x40577c)[_0x2f8b('0x44')](handleEntityNotFound(_0x1c0b64,null))[_0x2f8b('0x44')](respondWithResult(_0x1c0b64,null))[_0x2f8b('0x46')](handleError(_0x1c0b64,null));};exports[_0x2f8b('0x4a')]=function(_0x1e6ac2,_0x465d59){return db[_0x2f8b('0x41')][_0x2f8b('0x4a')](_0x1e6ac2[_0x2f8b('0x4b')],{})['then'](respondWithResult(_0x465d59,0xc9))[_0x2f8b('0x46')](handleError(_0x465d59,null));};exports[_0x2f8b('0x26')]=function(_0x2d79f9,_0x1bb257){if(_0x2d79f9[_0x2f8b('0x4b')]['id']){delete _0x2d79f9['body']['id'];}return db[_0x2f8b('0x41')][_0x2f8b('0x4c')]({'where':{'id':_0x2d79f9[_0x2f8b('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bb257,null))[_0x2f8b('0x44')](saveUpdates(_0x2d79f9['body'],null))[_0x2f8b('0x44')](respondWithResult(_0x1bb257,null))[_0x2f8b('0x46')](handleError(_0x1bb257,null));};exports[_0x2f8b('0x27')]=function(_0x3a25bb,_0x17b855){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x3a25bb['params']['id']}})[_0x2f8b('0x44')](handleEntityNotFound(_0x17b855,null))[_0x2f8b('0x44')](removeEntity(_0x17b855,null))[_0x2f8b('0x46')](handleError(_0x17b855,null));};exports[_0x2f8b('0x4d')]=function(_0x49e047,_0x5ea07d){return db[_0x2f8b('0x41')][_0x2f8b('0x4d')]()[_0x2f8b('0x44')](respondWithResult(_0x5ea07d,null))[_0x2f8b('0x46')](handleError(_0x5ea07d,null));}; \ No newline at end of file +var _0xc949=['eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','findAll','catch','rawAttributes','intersection','include','find','create','body','params','describe'];(function(_0x5e2021,_0xd3694e){var _0x1ca981=function(_0x56edf1){while(--_0x56edf1){_0x5e2021['push'](_0x5e2021['shift']());}};_0x1ca981(++_0xd3694e);}(_0xc949,0x181));var _0x9c94=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xc949[_0x3ce3c];return _0x55a2c9;};'use strict';var emlformat=require(_0x9c94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c94('0x1'));var jsonpatch=require(_0x9c94('0x2'));var rp=require(_0x9c94('0x3'));var moment=require(_0x9c94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c94('0x5'));var util=require(_0x9c94('0x6'));var path=require('path');var sox=require(_0x9c94('0x7'));var csv=require(_0x9c94('0x8'));var ejs=require(_0x9c94('0x9'));var fs=require('fs');var fs_extra=require(_0x9c94('0xa'));var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x8'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=typeof _0x4f0013['offset']===_0x9c94('0x1f')&&typeof _0x4f0013['limit']===_0x9c94('0x1f');var _0x33bd19=_0xe52641['count'];var _0x201e04=_0x4d6308?0x0:_0x4f0013[_0x9c94('0x20')];var _0x412804=_0x4d6308?_0xe52641[_0x9c94('0x21')]:_0x4f0013[_0x9c94('0x20')]+_0x4f0013[_0x9c94('0x22')];var _0x3e361c;if(_0x412804>=_0x33bd19){_0x412804=_0x33bd19;_0x3e361c=0xc8;}else{_0x3e361c=0xce;}_0x26e629['status'](_0x3e361c);return _0x26e629[_0x9c94('0x23')](_0x9c94('0x24'),_0x201e04+'-'+_0x412804+'/'+_0x33bd19)['json'](_0xe52641);}return null;};}function patchUpdates(_0x141801){return function(_0x845304){try{jsonpatch[_0x9c94('0x25')](_0x845304,_0x141801,!![]);}catch(_0x326b38){return BPromise[_0x9c94('0x26')](_0x326b38);}return _0x845304[_0x9c94('0x27')]();};}function saveUpdates(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x28')](_0xadab16)[_0x9c94('0x29')](function(_0xe9280a){return _0xe9280a;});}return null;};}function removeEntity(_0x44d732,_0x8c0b7f){return function(_0x5b1020){if(_0x5b1020){return _0x5b1020[_0x9c94('0x2a')]()[_0x9c94('0x29')](function(){_0x44d732['status'](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x2c3d25,_0x4795bb){return function(_0x335184){if(!_0x335184){_0x2c3d25[_0x9c94('0x1b')](0x194);}return _0x335184;};}function handleError(_0x4dd38e,_0xc18230){_0xc18230=_0xc18230||0x1f4;return function(_0x45cf4d){logger['error'](_0x45cf4d[_0x9c94('0x2b')]);if(_0x45cf4d['name']){delete _0x45cf4d[_0x9c94('0x2c')];}_0x4dd38e[_0x9c94('0x1c')](_0xc18230)[_0x9c94('0x2d')](_0x45cf4d);};}exports[_0x9c94('0x2e')]=function(_0x1581c0,_0x3f2622){var _0xf30dd1={},_0x561fdc={},_0x5a6b1c={'count':0x0,'rows':[]};var _0xc4a819=_[_0x9c94('0x2f')](db[_0x9c94('0x30')]['rawAttributes'],function(_0x25a6b9){return{'name':_0x25a6b9['fieldName'],'type':_0x25a6b9[_0x9c94('0x31')][_0x9c94('0x32')]};});_0x561fdc[_0x9c94('0x33')]=_['map'](_0xc4a819,'name');_0x561fdc[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x1581c0[_0x9c94('0x34')]);_0x561fdc['filters']=_['intersection'](_0x561fdc['model'],_0x561fdc['query']);_0xf30dd1[_0x9c94('0x36')]=_['intersection'](_0x561fdc[_0x9c94('0x33')],qs[_0x9c94('0x37')](_0x1581c0['query']['fields']));_0xf30dd1[_0x9c94('0x36')]=_0xf30dd1[_0x9c94('0x36')][_0x9c94('0x38')]?_0xf30dd1[_0x9c94('0x36')]:_0x561fdc[_0x9c94('0x33')];if(!_0x1581c0[_0x9c94('0x34')][_0x9c94('0x39')](_0x9c94('0x3a'))){_0xf30dd1[_0x9c94('0x22')]=qs[_0x9c94('0x22')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x22')]);_0xf30dd1[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x1581c0[_0x9c94('0x34')][_0x9c94('0x20')]);}_0xf30dd1[_0x9c94('0x3b')]=qs[_0x9c94('0x3c')](_0x1581c0['query'][_0x9c94('0x3c')]);_0xf30dd1[_0x9c94('0x3d')]=qs[_0x9c94('0x3e')](_[_0x9c94('0x3f')](_0x1581c0[_0x9c94('0x34')],_0x561fdc[_0x9c94('0x3e')]),_0xc4a819);if(_0x1581c0[_0x9c94('0x34')]['filter']){_0xf30dd1[_0x9c94('0x3d')]=_['merge'](_0xf30dd1[_0x9c94('0x3d')],{'$or':_[_0x9c94('0x2f')](_0xc4a819,function(_0x442d46){if(_0x442d46[_0x9c94('0x31')]!=='VIRTUAL'){var _0x245278={};_0x245278[_0x442d46['name']]={'$like':'%'+_0x1581c0[_0x9c94('0x34')][_0x9c94('0x40')]+'%'};return _0x245278;}})});}_0xf30dd1=_[_0x9c94('0x41')]({},_0xf30dd1,_0x1581c0['options']);var _0x21e9f7={'where':_0xf30dd1['where']};return db[_0x9c94('0x30')]['count'](_0x21e9f7)['then'](function(_0x9a75f0){_0x5a6b1c[_0x9c94('0x21')]=_0x9a75f0;if(_0x1581c0[_0x9c94('0x34')][_0x9c94('0x42')]){_0xf30dd1['include']=[{'all':!![]}];}return db[_0x9c94('0x30')][_0x9c94('0x43')](_0xf30dd1);})[_0x9c94('0x29')](function(_0x360960){_0x5a6b1c['rows']=_0x360960;return _0x5a6b1c;})[_0x9c94('0x29')](respondWithFilteredResult(_0x3f2622,_0xf30dd1))[_0x9c94('0x44')](handleError(_0x3f2622,null));};exports['show']=function(_0x24e74c,_0x3d8b31){var _0x2a5bd5={'raw':!![],'where':{'id':_0x24e74c['params']['id']}},_0x5e6a90={};_0x5e6a90[_0x9c94('0x33')]=_[_0x9c94('0x35')](db[_0x9c94('0x30')][_0x9c94('0x45')]);_0x5e6a90[_0x9c94('0x34')]=_[_0x9c94('0x35')](_0x24e74c[_0x9c94('0x34')]);_0x5e6a90[_0x9c94('0x3e')]=_[_0x9c94('0x46')](_0x5e6a90[_0x9c94('0x33')],_0x5e6a90[_0x9c94('0x34')]);_0x2a5bd5['attributes']=_[_0x9c94('0x46')](_0x5e6a90['model'],qs[_0x9c94('0x37')](_0x24e74c[_0x9c94('0x34')][_0x9c94('0x37')]));_0x2a5bd5[_0x9c94('0x36')]=_0x2a5bd5[_0x9c94('0x36')][_0x9c94('0x38')]?_0x2a5bd5[_0x9c94('0x36')]:_0x5e6a90['model'];if(_0x24e74c['query'][_0x9c94('0x42')]){_0x2a5bd5[_0x9c94('0x47')]=[{'all':!![]}];}_0x2a5bd5=_[_0x9c94('0x41')]({},_0x2a5bd5,_0x24e74c['options']);return db[_0x9c94('0x30')][_0x9c94('0x48')](_0x2a5bd5)['then'](handleEntityNotFound(_0x3d8b31,null))['then'](respondWithResult(_0x3d8b31,null))['catch'](handleError(_0x3d8b31,null));};exports['create']=function(_0x2b94e0,_0x5362f4){return db['JscriptyAnswerReport'][_0x9c94('0x49')](_0x2b94e0['body'],{})[_0x9c94('0x29')](respondWithResult(_0x5362f4,0xc9))[_0x9c94('0x44')](handleError(_0x5362f4,null));};exports[_0x9c94('0x28')]=function(_0x205f51,_0x22eaa4){if(_0x205f51['body']['id']){delete _0x205f51[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x30')][_0x9c94('0x48')]({'where':{'id':_0x205f51[_0x9c94('0x4b')]['id']}})[_0x9c94('0x29')](handleEntityNotFound(_0x22eaa4,null))[_0x9c94('0x29')](saveUpdates(_0x205f51['body'],null))[_0x9c94('0x29')](respondWithResult(_0x22eaa4,null))['catch'](handleError(_0x22eaa4,null));};exports[_0x9c94('0x2a')]=function(_0x38bb48,_0x426c0f){return db['JscriptyAnswerReport'][_0x9c94('0x48')]({'where':{'id':_0x38bb48[_0x9c94('0x4b')]['id']}})['then'](handleEntityNotFound(_0x426c0f,null))[_0x9c94('0x29')](removeEntity(_0x426c0f,null))['catch'](handleError(_0x426c0f,null));};exports[_0x9c94('0x4c')]=function(_0x3aa1dd,_0x537c78){return db['JscriptyAnswerReport'][_0x9c94('0x4c')]()['then'](respondWithResult(_0x537c78,null))[_0x9c94('0x44')](handleError(_0x537c78,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4f18821..194e11a 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 _0x7403=['JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define'];(function(_0x9b14ee,_0x574340){var _0xc3fa3c=function(_0x44476d){while(--_0x44476d){_0x9b14ee['push'](_0x9b14ee['shift']());}};_0xc3fa3c(++_0x574340);}(_0x7403,0xb6));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3740('0x0'));var util=require('util');var logger=require(_0x3740('0x1'))('api');var moment=require(_0x3740('0x2'));var BPromise=require(_0x3740('0x3'));var rp=require(_0x3740('0x4'));var fs=require('fs');var path=require(_0x3740('0x5'));var rimraf=require(_0x3740('0x6'));var config=require(_0x3740('0x7'));var attributes=require(_0x3740('0x8'));module['exports']=function(_0x49a1b4,_0x24d3d3){return _0x49a1b4[_0x3740('0x9')](_0x3740('0xa'),attributes,{'tableName':_0x3740('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8897=['../../config/environment','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b5256,_0x10179d){var _0x2ffa09=function(_0x42c686){while(--_0x42c686){_0x1b5256['push'](_0x1b5256['shift']());}};_0x2ffa09(++_0x10179d);}(_0x8897,0x1b4));var _0x7889=function(_0x4543f6,_0x4ced4a){_0x4543f6=_0x4543f6-0x0;var _0x317dbc=_0x8897[_0x4543f6];return _0x317dbc;};'use strict';var _=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var logger=require(_0x7889('0x2'))('api');var moment=require(_0x7889('0x3'));var BPromise=require(_0x7889('0x4'));var rp=require(_0x7889('0x5'));var fs=require('fs');var path=require(_0x7889('0x6'));var rimraf=require(_0x7889('0x7'));var config=require(_0x7889('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x7889('0x9')]=function(_0x42507c,_0x16cc14){return _0x42507c[_0x7889('0xa')](_0x7889('0xb'),attributes,{'tableName':'report_jscripty_answers','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 f202057..440e16e 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 _0xe4c7=['client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xf6b597,_0x2b368f){var _0x599665=function(_0x574b03){while(--_0x574b03){_0xf6b597['push'](_0xf6b597['shift']());}};_0x599665(++_0x2b368f);}(_0xe4c7,0x157));var _0x7e4c=function(_0x2d0b84,_0x34682d){_0x2d0b84=_0x2d0b84-0x0;var _0x8d0088=_0xe4c7[_0x2d0b84];return _0x8d0088;};'use strict';var _=require('lodash');var util=require(_0x7e4c('0x0'));var moment=require('moment');var BPromise=require(_0x7e4c('0x1'));var rs=require(_0x7e4c('0x2'));var fs=require('fs');var Redis=require(_0x7e4c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e4c('0x4'));var logger=require(_0x7e4c('0x5'))(_0x7e4c('0x6'));var config=require(_0x7e4c('0x7'));var jayson=require(_0x7e4c('0x8'));var client=jayson[_0x7e4c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d4e11,_0x5cd845,_0x10b818){return new BPromise(function(_0x3a6914,_0x1013f4){return client[_0x7e4c('0xa')](_0x5d4e11,_0x10b818)[_0x7e4c('0xb')](function(_0x2af65a){logger['info'](_0x7e4c('0xc'),_0x5cd845,_0x7e4c('0xd'));logger[_0x7e4c('0xe')](_0x7e4c('0xf'),_0x5cd845,_0x7e4c('0xd'),JSON[_0x7e4c('0x10')](_0x2af65a));if(_0x2af65a[_0x7e4c('0x11')]){if(_0x2af65a[_0x7e4c('0x11')]['code']===0x1f4){logger[_0x7e4c('0x11')](_0x7e4c('0xc'),_0x5cd845,_0x2af65a['error'][_0x7e4c('0x12')]);return _0x1013f4(_0x2af65a[_0x7e4c('0x11')][_0x7e4c('0x12')]);}logger[_0x7e4c('0x11')](_0x7e4c('0xc'),_0x5cd845,_0x2af65a[_0x7e4c('0x11')][_0x7e4c('0x12')]);return _0x3a6914(_0x2af65a[_0x7e4c('0x11')][_0x7e4c('0x12')]);}else{logger[_0x7e4c('0x13')](_0x7e4c('0xc'),_0x5cd845,_0x7e4c('0xd'));_0x3a6914(_0x2af65a[_0x7e4c('0x14')]['message']);}})[_0x7e4c('0x15')](function(_0x32baa7){logger[_0x7e4c('0x11')](_0x7e4c('0xc'),_0x5cd845,_0x32baa7);_0x1013f4(_0x32baa7);});});} \ No newline at end of file +var _0x4025=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x53033e,_0xfdf47){var _0x316a7a=function(_0x992dff){while(--_0x992dff){_0x53033e['push'](_0x53033e['shift']());}};_0x316a7a(++_0xfdf47);}(_0x4025,0x170));var _0x5402=function(_0x2e3f03,_0x1181f0){_0x2e3f03=_0x2e3f03-0x0;var _0x2373e5=_0x4025[_0x2e3f03];return _0x2373e5;};'use strict';var _=require(_0x5402('0x0'));var util=require(_0x5402('0x1'));var moment=require(_0x5402('0x2'));var BPromise=require(_0x5402('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5402('0x4'));var db=require(_0x5402('0x5'))['db'];var utils=require(_0x5402('0x6'));var logger=require(_0x5402('0x7'))(_0x5402('0x8'));var config=require(_0x5402('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5402('0xa')][_0x5402('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45340e,_0xd5b07a,_0x3d73f1){return new BPromise(function(_0x311e5c,_0x463bf9){return client[_0x5402('0xc')](_0x45340e,_0x3d73f1)['then'](function(_0xee72d9){logger[_0x5402('0xd')](_0x5402('0xe'),_0xd5b07a,_0x5402('0xf'));logger[_0x5402('0x10')](_0x5402('0x11'),_0xd5b07a,_0x5402('0xf'),JSON[_0x5402('0x12')](_0xee72d9));if(_0xee72d9[_0x5402('0x13')]){if(_0xee72d9[_0x5402('0x13')][_0x5402('0x14')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xd5b07a,_0xee72d9['error']['message']);return _0x463bf9(_0xee72d9[_0x5402('0x13')][_0x5402('0x15')]);}logger[_0x5402('0x13')](_0x5402('0xe'),_0xd5b07a,_0xee72d9['error']['message']);return _0x311e5c(_0xee72d9[_0x5402('0x13')]['message']);}else{logger[_0x5402('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xd5b07a,_0x5402('0xf'));_0x311e5c(_0xee72d9[_0x5402('0x16')][_0x5402('0x15')]);}})[_0x5402('0x17')](function(_0x8b8e1f){logger['error'](_0x5402('0xe'),_0xd5b07a,_0x8b8e1f);_0x463bf9(_0x8b8e1f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 6fa53c0..f0fb52c 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 _0xa86c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','getSummary','create','post','clone','delete','destroy','multer','util','path','express','Router'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xa86c,0x103));var _0xca86=function(_0x18e696,_0x566133){_0x18e696=_0x18e696-0x0;var _0x1e4f52=_0xa86c[_0x18e696];return _0x1e4f52;};'use strict';var multer=require(_0xca86('0x0'));var util=require(_0xca86('0x1'));var path=require(_0xca86('0x2'));var timeout=require('connect-timeout');var express=require(_0xca86('0x3'));var router=express[_0xca86('0x4')]();var fs_extra=require(_0xca86('0x5'));var auth=require(_0xca86('0x6'));var interaction=require(_0xca86('0x7'));var config=require(_0xca86('0x8'));var controller=require(_0xca86('0x9'));router[_0xca86('0xa')]('/',auth['isAuthenticated'](),controller[_0xca86('0xb')]);router[_0xca86('0xa')](_0xca86('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xca86('0xa')](_0xca86('0xd'),auth[_0xca86('0xe')](),controller[_0xca86('0xf')]);router[_0xca86('0xa')](_0xca86('0x10'),auth[_0xca86('0xe')](),controller[_0xca86('0x11')]);router[_0xca86('0xa')]('/:id/summary',auth['isAuthenticated'](),timeout('30s'),controller[_0xca86('0x12')]);router['post']('/',auth[_0xca86('0xe')](),controller[_0xca86('0x13')]);router[_0xca86('0x14')]('/:id/clone',auth[_0xca86('0xe')](),controller[_0xca86('0x15')]);router['put'](_0xca86('0xc'),auth[_0xca86('0xe')](),controller['update']);router[_0xca86('0x16')](_0xca86('0xc'),auth['isAuthenticated'](),controller[_0xca86('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4847=['/:id/clone','clone','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getAnswers','post'];(function(_0x14178f,_0xb845d){var _0x5504a2=function(_0x49b3a0){while(--_0x49b3a0){_0x14178f['push'](_0x14178f['shift']());}};_0x5504a2(++_0xb845d);}(_0x4847,0xf6));var _0x7484=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x4847[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x7484('0x0'));var util=require('util');var path=require(_0x7484('0x1'));var timeout=require(_0x7484('0x2'));var express=require(_0x7484('0x3'));var router=express['Router']();var fs_extra=require(_0x7484('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7484('0x5'));var controller=require(_0x7484('0x6'));router['get']('/',auth[_0x7484('0x7')](),controller[_0x7484('0x8')]);router[_0x7484('0x9')](_0x7484('0xa'),auth[_0x7484('0x7')](),controller[_0x7484('0xb')]);router[_0x7484('0x9')]('/:id/sessions',auth[_0x7484('0x7')](),controller['getSessions']);router['get']('/:id/answers',auth['isAuthenticated'](),controller[_0x7484('0xc')]);router[_0x7484('0x9')]('/:id/summary',auth[_0x7484('0x7')](),timeout('30s'),controller['getSummary']);router[_0x7484('0xd')]('/',auth[_0x7484('0x7')](),controller['create']);router[_0x7484('0xd')](_0x7484('0xe'),auth[_0x7484('0x7')](),controller[_0x7484('0xf')]);router[_0x7484('0x10')](_0x7484('0xa'),auth[_0x7484('0x7')](),controller[_0x7484('0x11')]);router[_0x7484('0x12')](_0x7484('0xa'),auth['isAuthenticated'](),controller[_0x7484('0x13')]);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 9b685a0..aafce30 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 _0x6d39=['lodash','util','STRING','name','TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x4a6f8,_0x5bace2){var _0x139cb0=function(_0x382ba4){while(--_0x382ba4){_0x4a6f8['push'](_0x4a6f8['shift']());}};_0x139cb0(++_0x5bace2);}(_0x6d39,0x13b));var _0x96d3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6d39[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x96d3('0x0'));var util=require(_0x96d3('0x1'));module['exports']={'name':{'type':Sequelize[_0x96d3('0x2')],'unique':_0x96d3('0x3')},'description':{'type':Sequelize[_0x96d3('0x2')]},'formData':{'type':Sequelize[_0x96d3('0x4')](_0x96d3('0x5')),'set':function(_0xbb1e7b){if(_[_0x96d3('0x6')](_0xbb1e7b)){this['setDataValue']('formData',JSON[_0x96d3('0x7')](_0xbb1e7b));}else if(_[_0x96d3('0x8')](_0xbb1e7b)){this[_0x96d3('0x9')](_0x96d3('0xa'),_0xbb1e7b);}else{this[_0x96d3('0x9')]('formData',util[_0x96d3('0xb')](_0x96d3('0xc'),this[_0x96d3('0xd')](_0x96d3('0x3'))||'',this[_0x96d3('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x96d3('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x96d3('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x5597=['setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','util','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5597,0xbc));var _0x7559=function(_0x4229f7,_0x24fb37){_0x4229f7=_0x4229f7-0x0;var _0x214a13=_0x5597[_0x4229f7];return _0x214a13;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x7559('0x0'));module[_0x7559('0x1')]={'name':{'type':Sequelize[_0x7559('0x2')],'unique':_0x7559('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7559('0x4')](_0x7559('0x5')),'set':function(_0x34597c){if(_[_0x7559('0x6')](_0x34597c)){this[_0x7559('0x7')](_0x7559('0x8'),JSON['stringify'](_0x34597c));}else if(_[_0x7559('0x9')](_0x34597c)){this['setDataValue']('formData',_0x34597c);}else{this['setDataValue'](_0x7559('0x8'),util[_0x7559('0xa')](_0x7559('0xb'),this[_0x7559('0xc')](_0x7559('0x3'))||'',this[_0x7559('0xc')](_0x7559('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7559('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 3b7af33..60f699a 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 _0x85ed=['api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','fieldName','type','key','query','keys','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2ea02f,_0x3525ce){var _0x28a380=function(_0x2ebabc){while(--_0x2ebabc){_0x2ea02f['push'](_0x2ea02f['shift']());}};_0x28a380(++_0x3525ce);}(_0x85ed,0x66));var _0xd85e=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x85ed[_0xabfec4];return _0x7bafa2;};'use strict';var emlformat=require(_0xd85e('0x0'));var rimraf=require(_0xd85e('0x1'));var zipdir=require(_0xd85e('0x2'));var jsonpatch=require(_0xd85e('0x3'));var rp=require(_0xd85e('0x4'));var moment=require(_0xd85e('0x5'));var BPromise=require(_0xd85e('0x6'));var Mustache=require('mustache');var util=require(_0xd85e('0x7'));var path=require(_0xd85e('0x8'));var sox=require(_0xd85e('0x9'));var csv=require(_0xd85e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd85e('0xb'));var _=require(_0xd85e('0xc'));var squel=require('squel');var crypto=require(_0xd85e('0xd'));var jsforce=require(_0xd85e('0xe'));var deskjs=require(_0xd85e('0xf'));var toCsv=require(_0xd85e('0xa'));var querystring=require('querystring');var Papa=require(_0xd85e('0x10'));var Redis=require(_0xd85e('0x11'));var authService=require(_0xd85e('0x12'));var qs=require(_0xd85e('0x13'));var as=require(_0xd85e('0x14'));var hardwareService=require(_0xd85e('0x15'));var logger=require('../../config/logger')(_0xd85e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd85e('0x17'));var db=require(_0xd85e('0x18'))['db'];function respondWithStatusCode(_0x5e9b20,_0x374652){_0x374652=_0x374652||0xcc;return function(_0x7d5918){if(_0x7d5918){return _0x5e9b20[_0xd85e('0x19')](_0x374652);}return _0x5e9b20['status'](_0x374652)[_0xd85e('0x1a')]();};}function respondWithResult(_0x33addd,_0xe0c8df){_0xe0c8df=_0xe0c8df||0xc8;return function(_0x32a52c){if(_0x32a52c){return _0x33addd[_0xd85e('0x1b')](_0xe0c8df)['json'](_0x32a52c);}};}function respondWithFilteredResult(_0x356b3f,_0x5ba31d){return function(_0x3aa5f6){if(_0x3aa5f6){var _0x3123a3=typeof _0x5ba31d[_0xd85e('0x1c')]==='undefined'&&typeof _0x5ba31d[_0xd85e('0x1d')]===_0xd85e('0x1e');var _0x56b412=_0x3aa5f6[_0xd85e('0x1f')];var _0x673820=_0x3123a3?0x0:_0x5ba31d[_0xd85e('0x1c')];var _0x4c432d=_0x3123a3?_0x3aa5f6[_0xd85e('0x1f')]:_0x5ba31d[_0xd85e('0x1c')]+_0x5ba31d[_0xd85e('0x1d')];var _0x1dfff9;if(_0x4c432d>=_0x56b412){_0x4c432d=_0x56b412;_0x1dfff9=0xc8;}else{_0x1dfff9=0xce;}_0x356b3f[_0xd85e('0x1b')](_0x1dfff9);return _0x356b3f[_0xd85e('0x20')](_0xd85e('0x21'),_0x673820+'-'+_0x4c432d+'/'+_0x56b412)[_0xd85e('0x22')](_0x3aa5f6);}return null;};}function patchUpdates(_0x2e0c94){return function(_0x3834ad){try{jsonpatch['apply'](_0x3834ad,_0x2e0c94,!![]);}catch(_0x255785){return BPromise[_0xd85e('0x23')](_0x255785);}return _0x3834ad[_0xd85e('0x24')]();};}function saveUpdates(_0x2ef958,_0xe9991){return function(_0x595199){if(_0x595199){return _0x595199[_0xd85e('0x25')](_0x2ef958)[_0xd85e('0x26')](function(_0x194173){return _0x194173;});}return null;};}function removeEntity(_0x4f620e,_0x45c727){return function(_0x44168e){if(_0x44168e){return _0x44168e[_0xd85e('0x27')]()[_0xd85e('0x26')](function(){var _0x26e64a=_0x44168e[_0xd85e('0x28')]({'plain':!![]});var _0x5604ae=_0xd85e('0x29');return db[_0xd85e('0x2a')][_0xd85e('0x27')]({'where':{'type':_0x5604ae,'resourceId':_0x26e64a['id']}})[_0xd85e('0x26')](function(){return _0x44168e;});})[_0xd85e('0x26')](function(){_0x4f620e[_0xd85e('0x1b')](0xcc)[_0xd85e('0x1a')]();});}};}function handleEntityNotFound(_0x1d659e,_0x540149){return function(_0x5e0914){if(!_0x5e0914){_0x1d659e[_0xd85e('0x19')](0x194);}return _0x5e0914;};}function handleError(_0x2fab0f,_0x3000cf){_0x3000cf=_0x3000cf||0x1f4;return function(_0x5dc7ac){logger['error'](_0x5dc7ac[_0xd85e('0x2b')]);if(_0x5dc7ac['name']){delete _0x5dc7ac[_0xd85e('0x2c')];}_0x2fab0f[_0xd85e('0x1b')](_0x3000cf)[_0xd85e('0x2d')](_0x5dc7ac);};}exports[_0xd85e('0x2e')]=function(_0x49cd47,_0x5ec4e9){var _0x5c5d9e={},_0x5c9879={},_0x5d4154={'count':0x0,'rows':[]};var _0x385823=_[_0xd85e('0x2f')](db[_0xd85e('0x30')]['rawAttributes'],function(_0x6a901d){return{'name':_0x6a901d[_0xd85e('0x31')],'type':_0x6a901d[_0xd85e('0x32')][_0xd85e('0x33')]};});_0x5c9879['model']=_[_0xd85e('0x2f')](_0x385823,_0xd85e('0x2c'));_0x5c9879[_0xd85e('0x34')]=_[_0xd85e('0x35')](_0x49cd47[_0xd85e('0x34')]);_0x5c9879['filters']=_[_0xd85e('0x36')](_0x5c9879['model'],_0x5c9879['query']);_0x5c5d9e[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x5c9879[_0xd85e('0x38')],qs['fields'](_0x49cd47['query'][_0xd85e('0x39')]));_0x5c5d9e['attributes']=_0x5c5d9e[_0xd85e('0x37')]['length']?_0x5c5d9e['attributes']:_0x5c9879[_0xd85e('0x38')];if(!_0x49cd47[_0xd85e('0x34')]['hasOwnProperty'](_0xd85e('0x3a'))){_0x5c5d9e[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x1d')]);_0x5c5d9e[_0xd85e('0x1c')]=qs[_0xd85e('0x1c')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x1c')]);}_0x5c5d9e[_0xd85e('0x3b')]=qs[_0xd85e('0x3c')](_0x49cd47[_0xd85e('0x34')][_0xd85e('0x3c')]);_0x5c5d9e[_0xd85e('0x3d')]=qs['filters'](_[_0xd85e('0x3e')](_0x49cd47[_0xd85e('0x34')],_0x5c9879[_0xd85e('0x3f')]),_0x385823);if(_0x49cd47[_0xd85e('0x34')][_0xd85e('0x40')]){_0x5c5d9e[_0xd85e('0x3d')]=_[_0xd85e('0x41')](_0x5c5d9e[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x385823,function(_0x34349f){if(_0x34349f[_0xd85e('0x32')]!==_0xd85e('0x42')){var _0x2b3848={};_0x2b3848[_0x34349f[_0xd85e('0x2c')]]={'$like':'%'+_0x49cd47['query'][_0xd85e('0x40')]+'%'};return _0x2b3848;}})});}_0x5c5d9e=_[_0xd85e('0x41')]({},_0x5c5d9e,_0x49cd47[_0xd85e('0x43')]);var _0x5363ae={'where':_0x5c5d9e['where']};return db[_0xd85e('0x30')][_0xd85e('0x1f')](_0x5363ae)[_0xd85e('0x26')](function(_0x562cbd){_0x5d4154[_0xd85e('0x1f')]=_0x562cbd;if(_0x49cd47[_0xd85e('0x34')][_0xd85e('0x44')]){_0x5c5d9e[_0xd85e('0x45')]=[{'all':!![]}];}return db[_0xd85e('0x30')][_0xd85e('0x46')](_0x5c5d9e);})[_0xd85e('0x26')](function(_0x304fb2){_0x5d4154[_0xd85e('0x47')]=_0x304fb2;return _0x5d4154;})[_0xd85e('0x26')](respondWithFilteredResult(_0x5ec4e9,_0x5c5d9e))['catch'](handleError(_0x5ec4e9,null));};exports[_0xd85e('0x48')]=function(_0x564355,_0x141db){var _0x22e004={'raw':![],'where':{'id':_0x564355[_0xd85e('0x49')]['id']}},_0x15b997={};_0x15b997[_0xd85e('0x38')]=_[_0xd85e('0x35')](db[_0xd85e('0x30')][_0xd85e('0x4a')]);_0x15b997[_0xd85e('0x34')]=_[_0xd85e('0x35')](_0x564355[_0xd85e('0x34')]);_0x15b997['filters']=_['intersection'](_0x15b997[_0xd85e('0x38')],_0x15b997[_0xd85e('0x34')]);_0x22e004[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x15b997[_0xd85e('0x38')],qs['fields'](_0x564355['query'][_0xd85e('0x39')]));_0x22e004[_0xd85e('0x37')]=_0x22e004[_0xd85e('0x37')][_0xd85e('0x4b')]?_0x22e004[_0xd85e('0x37')]:_0x15b997[_0xd85e('0x38')];if(_0x564355[_0xd85e('0x34')]['includeAll']){_0x22e004[_0xd85e('0x45')]=[{'all':!![]}];}_0x22e004=_[_0xd85e('0x41')]({},_0x22e004,_0x564355[_0xd85e('0x43')]);return db[_0xd85e('0x30')][_0xd85e('0x4c')](_0x22e004)[_0xd85e('0x26')](handleEntityNotFound(_0x141db,null))[_0xd85e('0x26')](respondWithResult(_0x141db,null))[_0xd85e('0x4d')](handleError(_0x141db,null));};exports[_0xd85e('0x4e')]=function(_0x29773a,_0x11945f){return db[_0xd85e('0x30')][_0xd85e('0x4e')](_0x29773a[_0xd85e('0x4f')],{})[_0xd85e('0x26')](function(_0x402c4f){var _0x530b97=_0x29773a[_0xd85e('0x50')][_0xd85e('0x28')]({'plain':!![]});if(!_0x530b97)throw new Error(_0xd85e('0x51'));if(_0x530b97[_0xd85e('0x52')]==='user'){var _0x464bbd=_0x402c4f[_0xd85e('0x28')]({'plain':!![]});var _0x2a5bbb='Projects';return db[_0xd85e('0x53')][_0xd85e('0x4c')]({'where':{'name':_0x2a5bbb,'userProfileId':_0x530b97[_0xd85e('0x54')]},'raw':!![]})['then'](function(_0x6de8ae){if(_0x6de8ae&&_0x6de8ae[_0xd85e('0x55')]===0x0){return db['UserProfileResource'][_0xd85e('0x4e')]({'name':_0x464bbd[_0xd85e('0x2c')],'resourceId':_0x464bbd['id'],'type':_0x6de8ae['name'],'sectionId':_0x6de8ae['id']},{})[_0xd85e('0x26')](function(){return _0x402c4f;});}else{return _0x402c4f;}})[_0xd85e('0x4d')](function(_0x23b83a){logger[_0xd85e('0x56')](_0xd85e('0x57'),_0x23b83a);throw _0x23b83a;});}return _0x402c4f;})[_0xd85e('0x26')](respondWithResult(_0x11945f,0xc9))[_0xd85e('0x4d')](handleError(_0x11945f,null));};exports['clone']=function(_0x17049c,_0x132cd6){var _0x70f6bf={'where':{'id':_0x17049c[_0xd85e('0x49')]['id']}},_0x25c241={};_0x25c241['model']=_[_0xd85e('0x35')](db['JscriptyProject'][_0xd85e('0x4a')]);_0x70f6bf['attributes']=_['intersection'](_0x25c241[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x17049c[_0xd85e('0x34')]['fields']));_0x70f6bf[_0xd85e('0x37')]=_0x70f6bf['attributes'][_0xd85e('0x4b')]?_0x70f6bf['attributes']:_0x25c241['model'];if(_0x17049c[_0xd85e('0x34')][_0xd85e('0x44')]){_0x70f6bf[_0xd85e('0x45')]=[{'all':!![]}];}_0x70f6bf=_[_0xd85e('0x41')]({},_0x70f6bf,_0x17049c[_0xd85e('0x43')]);return db[_0xd85e('0x30')][_0xd85e('0x4c')](_0x70f6bf)[_0xd85e('0x26')](handleEntityNotFound(_0x132cd6,null))[_0xd85e('0x26')](function(_0x4be7d6){if(_0x4be7d6){var _0x4985b6=_0x4be7d6[_0xd85e('0x28')]({'plain':!![]});_0x4985b6=qs[_0xd85e('0x58')](_0x4985b6,['id',_0xd85e('0x59'),'updatedAt']);_0x17049c[_0xd85e('0x4f')]=_[_0xd85e('0x58')](_0x17049c[_0xd85e('0x4f')],['id',_0xd85e('0x59'),'updatedAt']);return db[_0xd85e('0x30')][_0xd85e('0x4e')](_[_0xd85e('0x41')](_0x4985b6,_0x17049c['body']),{'include':_0x17049c['query'][_0xd85e('0x44')]?[{'all':!![]}]:undefined})[_0xd85e('0x26')](function(_0x1dca75){var _0x5b9ff6=_0x17049c[_0xd85e('0x50')][_0xd85e('0x28')]({'plain':!![]});if(!_0x5b9ff6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b9ff6[_0xd85e('0x52')]===_0xd85e('0x50')){var _0x180e0a=_0x1dca75[_0xd85e('0x28')]({'plain':!![]});var _0x1e421a=_0xd85e('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x1e421a,'userProfileId':_0x5b9ff6[_0xd85e('0x54')]},'raw':!![]})['then'](function(_0x28988d){if(_0x28988d&&_0x28988d[_0xd85e('0x55')]===0x0){return db[_0xd85e('0x2a')][_0xd85e('0x4e')]({'name':_0x180e0a[_0xd85e('0x2c')],'resourceId':_0x180e0a['id'],'type':_0x28988d['name'],'sectionId':_0x28988d['id']},{})[_0xd85e('0x26')](function(){return _0x1dca75;});}else{return _0x1dca75;}})['catch'](function(_0x3b8a30){logger[_0xd85e('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b8a30);throw _0x3b8a30;});}return _0x1dca75;});}})[_0xd85e('0x26')](respondWithResult(_0x132cd6,0xc9))[_0xd85e('0x4d')](handleError(_0x132cd6,null));};exports['update']=function(_0x14de94,_0x118420){if(_0x14de94[_0xd85e('0x4f')]['id']){delete _0x14de94['body']['id'];}return db[_0xd85e('0x30')][_0xd85e('0x4c')]({'where':{'id':_0x14de94[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x118420,null))[_0xd85e('0x26')](saveUpdates(_0x14de94[_0xd85e('0x4f')],null))[_0xd85e('0x26')](respondWithResult(_0x118420,null))['catch'](handleError(_0x118420,null));};exports[_0xd85e('0x27')]=function(_0x215632,_0x54528a){return db['JscriptyProject'][_0xd85e('0x4c')]({'where':{'id':_0x215632[_0xd85e('0x49')]['id']}})['then'](handleEntityNotFound(_0x54528a,null))[_0xd85e('0x26')](removeEntity(_0x54528a,null))[_0xd85e('0x4d')](handleError(_0x54528a,null));};exports[_0xd85e('0x5a')]=function(_0x3f2e6e,_0x3a5305,_0x496156){var _0x4382bf={'raw':!![],'where':{}};var _0xf4f01c={};var _0x15b741={'count':0x0,'rows':[]};return db[_0xd85e('0x30')][_0xd85e('0x5b')]({'where':{'id':_0x3f2e6e[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x3a5305,null))[_0xd85e('0x26')](function(_0x4290a2){if(_0x4290a2){_0xf4f01c[_0xd85e('0x38')]=_[_0xd85e('0x35')](db[_0xd85e('0x5c')][_0xd85e('0x4a')]);_0xf4f01c[_0xd85e('0x34')]=_['keys'](_0x3f2e6e[_0xd85e('0x34')]);_0xf4f01c['filters']=_[_0xd85e('0x36')](_0xf4f01c[_0xd85e('0x38')],_0xf4f01c[_0xd85e('0x34')]);_0x4382bf[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0xf4f01c[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x3f2e6e['query'][_0xd85e('0x39')]));_0x4382bf[_0xd85e('0x37')]=_0x4382bf[_0xd85e('0x37')][_0xd85e('0x4b')]?_0x4382bf[_0xd85e('0x37')]:_0xf4f01c[_0xd85e('0x38')];if(!_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x5d')]('nolimit')){_0x4382bf[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x1d')]);_0x4382bf[_0xd85e('0x1c')]=qs[_0xd85e('0x1c')](_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x1c')]);}_0x4382bf['order']=qs[_0xd85e('0x3c')](_0x3f2e6e[_0xd85e('0x34')]['sort']);_0x4382bf[_0xd85e('0x3d')]=qs[_0xd85e('0x3f')](_[_0xd85e('0x3e')](_0x3f2e6e[_0xd85e('0x34')],_0xf4f01c[_0xd85e('0x3f')]));_0x4382bf[_0xd85e('0x3d')][_0xd85e('0x5e')]=_0x4290a2['id'];if(_0x3f2e6e[_0xd85e('0x34')][_0xd85e('0x40')]){_0x4382bf['where']=_[_0xd85e('0x41')](_0x4382bf[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x4382bf[_0xd85e('0x37')],function(_0x4892f2){var _0x2f284e={};_0x2f284e[_0x4892f2]={'$like':'%'+_0x3f2e6e['query'][_0xd85e('0x40')]+'%'};return _0x2f284e;})});}_0x4382bf=_[_0xd85e('0x41')]({},_0x4382bf,_0x3f2e6e['options']);return db[_0xd85e('0x5c')][_0xd85e('0x1f')]({'where':_0x4382bf[_0xd85e('0x3d')]})[_0xd85e('0x26')](function(_0x675b22){_0x15b741[_0xd85e('0x1f')]=_0x675b22;if(_0x3f2e6e['query'][_0xd85e('0x44')]){_0x4382bf['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xd85e('0x46')](_0x4382bf);})[_0xd85e('0x26')](function(_0xbfbd04){_0x15b741[_0xd85e('0x47')]=_0xbfbd04;return _0x15b741;});}})[_0xd85e('0x26')](respondWithFilteredResult(_0x3a5305,_0x4382bf))[_0xd85e('0x4d')](handleError(_0x3a5305,null));};exports[_0xd85e('0x5f')]=function(_0x467da8,_0x39491b,_0x4d704f){var _0x177d4f={'raw':!![],'where':{}};var _0x3494fa={};var _0x4e8e49={'count':0x0,'rows':[]};return db[_0xd85e('0x30')][_0xd85e('0x5b')]({'where':{'id':_0x467da8[_0xd85e('0x49')]['id']}})[_0xd85e('0x26')](handleEntityNotFound(_0x39491b,null))[_0xd85e('0x26')](function(_0x4cd435){if(_0x4cd435){_0x3494fa[_0xd85e('0x38')]=_['keys'](db[_0xd85e('0x60')][_0xd85e('0x4a')]);_0x3494fa['query']=_[_0xd85e('0x35')](_0x467da8[_0xd85e('0x34')]);_0x3494fa[_0xd85e('0x3f')]=_[_0xd85e('0x36')](_0x3494fa['model'],_0x3494fa[_0xd85e('0x34')]);_0x177d4f[_0xd85e('0x37')]=_[_0xd85e('0x36')](_0x3494fa[_0xd85e('0x38')],qs[_0xd85e('0x39')](_0x467da8['query']['fields']));_0x177d4f[_0xd85e('0x37')]=_0x177d4f['attributes'][_0xd85e('0x4b')]?_0x177d4f[_0xd85e('0x37')]:_0x3494fa[_0xd85e('0x38')];if(!_0x467da8[_0xd85e('0x34')][_0xd85e('0x5d')]('nolimit')){_0x177d4f[_0xd85e('0x1d')]=qs[_0xd85e('0x1d')](_0x467da8['query'][_0xd85e('0x1d')]);_0x177d4f['offset']=qs[_0xd85e('0x1c')](_0x467da8['query'][_0xd85e('0x1c')]);}_0x177d4f[_0xd85e('0x3b')]=qs['sort'](_0x467da8['query'][_0xd85e('0x3c')]);_0x177d4f[_0xd85e('0x3d')]=qs[_0xd85e('0x3f')](_[_0xd85e('0x3e')](_0x467da8['query'],_0x3494fa[_0xd85e('0x3f')]));_0x177d4f[_0xd85e('0x3d')][_0xd85e('0x5e')]=_0x4cd435['id'];if(_0x467da8[_0xd85e('0x34')]['filter']){_0x177d4f[_0xd85e('0x3d')]=_['merge'](_0x177d4f[_0xd85e('0x3d')],{'$or':_[_0xd85e('0x2f')](_0x177d4f[_0xd85e('0x37')],function(_0xc48ea0){var _0x2c98ef={};_0x2c98ef[_0xc48ea0]={'$like':'%'+_0x467da8[_0xd85e('0x34')][_0xd85e('0x40')]+'%'};return _0x2c98ef;})});}_0x177d4f=_[_0xd85e('0x41')]({},_0x177d4f,_0x467da8[_0xd85e('0x43')]);return db[_0xd85e('0x60')][_0xd85e('0x1f')]({'where':_0x177d4f[_0xd85e('0x3d')]})[_0xd85e('0x26')](function(_0x300356){_0x4e8e49[_0xd85e('0x1f')]=_0x300356;if(_0x467da8[_0xd85e('0x34')][_0xd85e('0x44')]){_0x177d4f[_0xd85e('0x45')]=[{'all':!![]}];}return db[_0xd85e('0x60')][_0xd85e('0x46')](_0x177d4f);})['then'](function(_0x15c870){_0x4e8e49[_0xd85e('0x47')]=_0x15c870;return _0x4e8e49;});}})[_0xd85e('0x26')](respondWithFilteredResult(_0x39491b,_0x177d4f))[_0xd85e('0x4d')](handleError(_0x39491b,null));};function char(_0x2b4c67){return _0xd85e('0x61')===typeof _0x2b4c67?String[_0xd85e('0x62')][_0xd85e('0x63')](null,arguments):_0x2b4c67;}function needsEncapsulation(_0x2fe071){return!!_0x2fe071&&(_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0xd))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0xa))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0x2c))>=0x0||_0x2fe071[_0xd85e('0x64')]()[_0xd85e('0x65')](char(0x22))>=0x0);}function encapsulate(_0x4831dd){var _0x576770=char(0x22),_0x167a9b='\x5c'+char(0x22),_0x5c821d=_0x4831dd['toString']()[_0xd85e('0x66')](new RegExp(_0x576770,'g'),_0x167a9b);return _0x576770+_0x5c821d+_0x576770;}exports[_0xd85e('0x67')]=function(_0x427e81,_0x3b9038,_0x38597c){var _0x428f06,_0x14e23e;var _0x251d8c={'where':{'ProjectId':_0x427e81[_0xd85e('0x49')]['id']}};if(_0x427e81[_0xd85e('0x34')]['startTime']){_0x251d8c[_0xd85e('0x3d')][_0xd85e('0x68')]=JSON[_0xd85e('0x69')](_0x427e81[_0xd85e('0x34')][_0xd85e('0x6a')]);}return db['JscriptySessionReport'][_0xd85e('0x46')](_0x251d8c)[_0xd85e('0x26')](handleEntityNotFound(_0x3b9038,null))['then'](function(_0x3fca9f){if(_0x3fca9f){_0x428f06=_0x3fca9f;return db[_0xd85e('0x6b')]['findAll']({'where':{'SessionId':{'$in':_[_0xd85e('0x2f')](_0x428f06,'id')},'ProjectId':_0x427e81[_0xd85e('0x49')]['id']},'order':_0xd85e('0x6c')});}})['then'](handleEntityNotFound(_0x3b9038,null))[_0xd85e('0x26')](function(_0x3d037a){if(_0x3d037a){_0x14e23e=_0x3d037a;var _0x5f402f={};for(var _0x49fbfe=0x0,_0x2cfb57=_0x14e23e[_0xd85e('0x4b')];_0x49fbfe<_0x2cfb57;_0x49fbfe++){if(!_0x5f402f['hasOwnProperty'](_0x14e23e[_0x49fbfe][_0xd85e('0x6d')])){_0x5f402f[_0x14e23e[_0x49fbfe][_0xd85e('0x6d')]]=needsEncapsulation(_0x14e23e[_0x49fbfe]['question'])?encapsulate(_0x14e23e[_0x49fbfe][_0xd85e('0x6e')]):_0x14e23e[_0x49fbfe][_0xd85e('0x6e')];}}var _0x3ef8cf=[],_0x474fb3={};for(var _0x4ed082=0x0,_0x1e6494=_0x428f06['length'];_0x4ed082<_0x1e6494;_0x4ed082++){_0x474fb3={'ProjectId':_0x427e81[_0xd85e('0x49')]['id'],'SessionId':_0x428f06[_0x4ed082]['id'],'StartTime':moment(_0x428f06[_0x4ed082][_0xd85e('0x68')])[_0xd85e('0x6f')](_0xd85e('0x70'))};for(var _0x2a1b92=0x0,_0x1c5b76=_0x14e23e['length'];_0x2a1b92<_0x1c5b76;_0x2a1b92++){if(_0x14e23e[_0x2a1b92]['SessionId']==_0x428f06[_0x4ed082]['id']&&_0x5f402f['hasOwnProperty'](_0x14e23e[_0x2a1b92][_0xd85e('0x6d')])){_0x474fb3[_0x5f402f[_0x14e23e[_0x2a1b92][_0xd85e('0x6d')]]]=_0x14e23e[_0x2a1b92][_0xd85e('0x71')];}}for(var _0x26f69f in _0x5f402f){if(!_0x474fb3[_0xd85e('0x5d')](_0x5f402f[_0x26f69f])){_0x474fb3[_0x5f402f[_0x26f69f]]=null;}}_0x3ef8cf[_0xd85e('0x72')](_0x474fb3);}return _0x3ef8cf;}})['then'](function(_0x6a15b6){if(!_[_0xd85e('0x73')](_0x6a15b6)){var _0x4f22bc=toCsv(_0x6a15b6);var _0xa1816b=Date[_0xd85e('0x74')]();fs[_0xd85e('0x75')](util[_0xd85e('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b),_0x4f22bc);_0x3b9038[_0xd85e('0x76')](_0xd85e('0x77'),_0xd85e('0x78')+util[_0xd85e('0x6f')]('Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b));_0x3b9038[_0xd85e('0x76')](_0xd85e('0x79'),_0xd85e('0x7a'));return _0x3b9038[_0xd85e('0x7b')](util[_0xd85e('0x6f')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x427e81[_0xd85e('0x49')]['id'],_0xa1816b));}else{return _0x3b9038[_0xd85e('0x19')](0xcc);}})[_0xd85e('0x4d')](handleError(_0x3b9038,null));}; \ No newline at end of file +var _0x1219=['attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','map','JscriptyProject','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','catch','show','keys','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','rawAttributes','omit','createdAt','updatedAt','role','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','getSummary','startTime','parse','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','answer','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition'];(function(_0x221f71,_0x221c04){var _0x2df2e5=function(_0x242926){while(--_0x242926){_0x221f71['push'](_0x221f71['shift']());}};_0x2df2e5(++_0x221c04);}(_0x1219,0x17c));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9121('0x0'));var rimraf=require(_0x9121('0x1'));var zipdir=require(_0x9121('0x2'));var jsonpatch=require(_0x9121('0x3'));var rp=require(_0x9121('0x4'));var moment=require('moment');var BPromise=require(_0x9121('0x5'));var Mustache=require('mustache');var util=require(_0x9121('0x6'));var path=require(_0x9121('0x7'));var sox=require(_0x9121('0x8'));var csv=require(_0x9121('0x9'));var ejs=require(_0x9121('0xa'));var fs=require('fs');var fs_extra=require(_0x9121('0xb'));var _=require(_0x9121('0xc'));var squel=require(_0x9121('0xd'));var crypto=require(_0x9121('0xe'));var jsforce=require(_0x9121('0xf'));var deskjs=require(_0x9121('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9121('0x11'));var Papa=require(_0x9121('0x12'));var Redis=require(_0x9121('0x13'));var authService=require(_0x9121('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9121('0x15'));var hardwareService=require(_0x9121('0x16'));var logger=require(_0x9121('0x17'))(_0x9121('0x18'));var utils=require(_0x9121('0x19'));var config=require(_0x9121('0x1a'));var licenseUtil=require(_0x9121('0x1b'));var db=require(_0x9121('0x1c'))['db'];function respondWithStatusCode(_0x4470d0,_0x8a3dd1){_0x8a3dd1=_0x8a3dd1||0xcc;return function(_0x3e54fc){if(_0x3e54fc){return _0x4470d0[_0x9121('0x1d')](_0x8a3dd1);}return _0x4470d0[_0x9121('0x1e')](_0x8a3dd1)[_0x9121('0x1f')]();};}function respondWithResult(_0x3d1213,_0x505265){_0x505265=_0x505265||0xc8;return function(_0x106fe1){if(_0x106fe1){return _0x3d1213[_0x9121('0x1e')](_0x505265)[_0x9121('0x20')](_0x106fe1);}};}function respondWithFilteredResult(_0x35b2bf,_0x292aa0){return function(_0x4606a2){if(_0x4606a2){var _0x49c6aa=typeof _0x292aa0['offset']===_0x9121('0x21')&&typeof _0x292aa0[_0x9121('0x22')]===_0x9121('0x21');var _0xb8873a=_0x4606a2['count'];var _0x5bc064=_0x49c6aa?0x0:_0x292aa0[_0x9121('0x23')];var _0x40e9cc=_0x49c6aa?_0x4606a2['count']:_0x292aa0[_0x9121('0x23')]+_0x292aa0[_0x9121('0x22')];var _0x88b2e4;if(_0x40e9cc>=_0xb8873a){_0x40e9cc=_0xb8873a;_0x88b2e4=0xc8;}else{_0x88b2e4=0xce;}_0x35b2bf[_0x9121('0x1e')](_0x88b2e4);return _0x35b2bf['set'](_0x9121('0x24'),_0x5bc064+'-'+_0x40e9cc+'/'+_0xb8873a)['json'](_0x4606a2);}return null;};}function patchUpdates(_0x47d5cc){return function(_0x33ac3f){try{jsonpatch[_0x9121('0x25')](_0x33ac3f,_0x47d5cc,!![]);}catch(_0x1e1d2a){return BPromise[_0x9121('0x26')](_0x1e1d2a);}return _0x33ac3f[_0x9121('0x27')]();};}function saveUpdates(_0x4d568e,_0x1d3174){return function(_0xefb0a5){if(_0xefb0a5){return _0xefb0a5[_0x9121('0x28')](_0x4d568e)[_0x9121('0x29')](function(_0x5a6cd1){return _0x5a6cd1;});}return null;};}function removeEntity(_0x510bb3,_0x40daca){return function(_0x29b864){if(_0x29b864){return _0x29b864[_0x9121('0x2a')]()['then'](function(){var _0x34d48d=_0x29b864[_0x9121('0x2b')]({'plain':!![]});var _0x59b142=_0x9121('0x2c');return db[_0x9121('0x2d')][_0x9121('0x2a')]({'where':{'type':_0x59b142,'resourceId':_0x34d48d['id']}})[_0x9121('0x29')](function(){return _0x29b864;});})[_0x9121('0x29')](function(){_0x510bb3[_0x9121('0x1e')](0xcc)[_0x9121('0x1f')]();});}};}function handleEntityNotFound(_0x2b840c,_0x16326b){return function(_0x3f6f5f){if(!_0x3f6f5f){_0x2b840c[_0x9121('0x1d')](0x194);}return _0x3f6f5f;};}function handleError(_0xc15261,_0x2a69e2){_0x2a69e2=_0x2a69e2||0x1f4;return function(_0x71b6cf){logger[_0x9121('0x2e')](_0x71b6cf[_0x9121('0x2f')]);if(_0x71b6cf[_0x9121('0x30')]){delete _0x71b6cf['name'];}_0xc15261['status'](_0x2a69e2)[_0x9121('0x31')](_0x71b6cf);};}exports['index']=function(_0x3b4144,_0x23b1ed){var _0x541ba2={},_0x473cd3={},_0xaa36ea={'count':0x0,'rows':[]};var _0xd38da=_[_0x9121('0x32')](db[_0x9121('0x33')]['rawAttributes'],function(_0x53e433){return{'name':_0x53e433['fieldName'],'type':_0x53e433[_0x9121('0x34')][_0x9121('0x35')]};});_0x473cd3['model']=_[_0x9121('0x32')](_0xd38da,_0x9121('0x30'));_0x473cd3[_0x9121('0x36')]=_['keys'](_0x3b4144[_0x9121('0x36')]);_0x473cd3[_0x9121('0x37')]=_[_0x9121('0x38')](_0x473cd3[_0x9121('0x39')],_0x473cd3[_0x9121('0x36')]);_0x541ba2[_0x9121('0x3a')]=_[_0x9121('0x38')](_0x473cd3[_0x9121('0x39')],qs[_0x9121('0x3b')](_0x3b4144[_0x9121('0x36')][_0x9121('0x3b')]));_0x541ba2['attributes']=_0x541ba2[_0x9121('0x3a')][_0x9121('0x3c')]?_0x541ba2[_0x9121('0x3a')]:_0x473cd3[_0x9121('0x39')];if(!_0x3b4144[_0x9121('0x36')][_0x9121('0x3d')]('nolimit')){_0x541ba2['limit']=qs['limit'](_0x3b4144[_0x9121('0x36')][_0x9121('0x22')]);_0x541ba2[_0x9121('0x23')]=qs[_0x9121('0x23')](_0x3b4144['query']['offset']);}_0x541ba2[_0x9121('0x3e')]=qs[_0x9121('0x3f')](_0x3b4144[_0x9121('0x36')][_0x9121('0x3f')]);_0x541ba2['where']=qs[_0x9121('0x37')](_[_0x9121('0x40')](_0x3b4144[_0x9121('0x36')],_0x473cd3['filters']),_0xd38da);if(_0x3b4144[_0x9121('0x36')][_0x9121('0x41')]){_0x541ba2[_0x9121('0x42')]=_['merge'](_0x541ba2[_0x9121('0x42')],{'$or':_['map'](_0xd38da,function(_0x2e8c48){if(_0x2e8c48[_0x9121('0x34')]!==_0x9121('0x43')){var _0x3432ae={};_0x3432ae[_0x2e8c48[_0x9121('0x30')]]={'$like':'%'+_0x3b4144[_0x9121('0x36')]['filter']+'%'};return _0x3432ae;}})});}_0x541ba2=_[_0x9121('0x44')]({},_0x541ba2,_0x3b4144[_0x9121('0x45')]);var _0x158cec={'where':_0x541ba2[_0x9121('0x42')]};return db['JscriptyProject'][_0x9121('0x46')](_0x158cec)['then'](function(_0x533628){_0xaa36ea[_0x9121('0x46')]=_0x533628;if(_0x3b4144['query'][_0x9121('0x47')]){_0x541ba2['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x9121('0x48')](_0x541ba2);})['then'](function(_0x24e009){_0xaa36ea['rows']=_0x24e009;return _0xaa36ea;})[_0x9121('0x29')](respondWithFilteredResult(_0x23b1ed,_0x541ba2))[_0x9121('0x49')](handleError(_0x23b1ed,null));};exports[_0x9121('0x4a')]=function(_0x15c70a,_0x3c86c8){var _0x3c44e8={'raw':![],'where':{'id':_0x15c70a['params']['id']}},_0x4070ac={};_0x4070ac[_0x9121('0x39')]=_[_0x9121('0x4b')](db[_0x9121('0x33')]['rawAttributes']);_0x4070ac[_0x9121('0x36')]=_[_0x9121('0x4b')](_0x15c70a[_0x9121('0x36')]);_0x4070ac[_0x9121('0x37')]=_[_0x9121('0x38')](_0x4070ac[_0x9121('0x39')],_0x4070ac[_0x9121('0x36')]);_0x3c44e8[_0x9121('0x3a')]=_[_0x9121('0x38')](_0x4070ac['model'],qs[_0x9121('0x3b')](_0x15c70a[_0x9121('0x36')][_0x9121('0x3b')]));_0x3c44e8[_0x9121('0x3a')]=_0x3c44e8[_0x9121('0x3a')][_0x9121('0x3c')]?_0x3c44e8[_0x9121('0x3a')]:_0x4070ac[_0x9121('0x39')];if(_0x15c70a[_0x9121('0x36')]['includeAll']){_0x3c44e8[_0x9121('0x4c')]=[{'all':!![]}];}_0x3c44e8=_[_0x9121('0x44')]({},_0x3c44e8,_0x15c70a[_0x9121('0x45')]);return db['JscriptyProject'][_0x9121('0x4d')](_0x3c44e8)[_0x9121('0x29')](handleEntityNotFound(_0x3c86c8,null))[_0x9121('0x29')](respondWithResult(_0x3c86c8,null))[_0x9121('0x49')](handleError(_0x3c86c8,null));};exports[_0x9121('0x4e')]=function(_0x471de8,_0x31164a){return db[_0x9121('0x33')]['create'](_0x471de8[_0x9121('0x4f')],{})[_0x9121('0x29')](function(_0x5ca666){var _0x2fc356=_0x471de8[_0x9121('0x50')]['get']({'plain':!![]});if(!_0x2fc356)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fc356['role']===_0x9121('0x50')){var _0x4ddc77=_0x5ca666[_0x9121('0x2b')]({'plain':!![]});var _0x3ab1a3=_0x9121('0x2c');return db[_0x9121('0x51')]['find']({'where':{'name':_0x3ab1a3,'userProfileId':_0x2fc356[_0x9121('0x52')]},'raw':!![]})['then'](function(_0x336dbd){if(_0x336dbd&&_0x336dbd[_0x9121('0x53')]===0x0){return db[_0x9121('0x2d')][_0x9121('0x4e')]({'name':_0x4ddc77[_0x9121('0x30')],'resourceId':_0x4ddc77['id'],'type':_0x336dbd[_0x9121('0x30')],'sectionId':_0x336dbd['id']},{})['then'](function(){return _0x5ca666;});}else{return _0x5ca666;}})['catch'](function(_0x4c8a53){logger[_0x9121('0x2e')](_0x9121('0x54'),_0x4c8a53);throw _0x4c8a53;});}return _0x5ca666;})[_0x9121('0x29')](respondWithResult(_0x31164a,0xc9))[_0x9121('0x49')](handleError(_0x31164a,null));};exports[_0x9121('0x55')]=function(_0x3bdf22,_0x418e5c){var _0x25a053={'where':{'id':_0x3bdf22[_0x9121('0x56')]['id']}},_0x392fae={};_0x392fae['model']=_[_0x9121('0x4b')](db[_0x9121('0x33')][_0x9121('0x57')]);_0x25a053[_0x9121('0x3a')]=_['intersection'](_0x392fae[_0x9121('0x39')],qs[_0x9121('0x3b')](_0x3bdf22['query']['fields']));_0x25a053[_0x9121('0x3a')]=_0x25a053[_0x9121('0x3a')][_0x9121('0x3c')]?_0x25a053['attributes']:_0x392fae['model'];if(_0x3bdf22[_0x9121('0x36')][_0x9121('0x47')]){_0x25a053[_0x9121('0x4c')]=[{'all':!![]}];}_0x25a053=_['merge']({},_0x25a053,_0x3bdf22[_0x9121('0x45')]);return db[_0x9121('0x33')][_0x9121('0x4d')](_0x25a053)['then'](handleEntityNotFound(_0x418e5c,null))[_0x9121('0x29')](function(_0x42845f){if(_0x42845f){var _0x2c16c9=_0x42845f[_0x9121('0x2b')]({'plain':!![]});_0x2c16c9=qs[_0x9121('0x58')](_0x2c16c9,['id',_0x9121('0x59'),_0x9121('0x5a')]);_0x3bdf22[_0x9121('0x4f')]=_[_0x9121('0x58')](_0x3bdf22[_0x9121('0x4f')],['id',_0x9121('0x59'),'updatedAt']);return db[_0x9121('0x33')][_0x9121('0x4e')](_[_0x9121('0x44')](_0x2c16c9,_0x3bdf22[_0x9121('0x4f')]),{'include':_0x3bdf22['query'][_0x9121('0x47')]?[{'all':!![]}]:undefined})['then'](function(_0x3c2c4d){var _0x59be78=_0x3bdf22[_0x9121('0x50')][_0x9121('0x2b')]({'plain':!![]});if(!_0x59be78)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59be78[_0x9121('0x5b')]===_0x9121('0x50')){var _0x48501a=_0x3c2c4d[_0x9121('0x2b')]({'plain':!![]});var _0x2107f1='Projects';return db[_0x9121('0x51')][_0x9121('0x4d')]({'where':{'name':_0x2107f1,'userProfileId':_0x59be78['userProfileId']},'raw':!![]})[_0x9121('0x29')](function(_0x27e4cc){if(_0x27e4cc&&_0x27e4cc[_0x9121('0x53')]===0x0){return db[_0x9121('0x2d')]['create']({'name':_0x48501a['name'],'resourceId':_0x48501a['id'],'type':_0x27e4cc[_0x9121('0x30')],'sectionId':_0x27e4cc['id']},{})[_0x9121('0x29')](function(){return _0x3c2c4d;});}else{return _0x3c2c4d;}})[_0x9121('0x49')](function(_0xc0dbb2){logger[_0x9121('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc0dbb2);throw _0xc0dbb2;});}return _0x3c2c4d;});}})[_0x9121('0x29')](respondWithResult(_0x418e5c,0xc9))[_0x9121('0x49')](handleError(_0x418e5c,null));};exports[_0x9121('0x28')]=function(_0x4ed7f5,_0x408d87){if(_0x4ed7f5[_0x9121('0x4f')]['id']){delete _0x4ed7f5[_0x9121('0x4f')]['id'];}return db[_0x9121('0x33')]['find']({'where':{'id':_0x4ed7f5[_0x9121('0x56')]['id']}})['then'](handleEntityNotFound(_0x408d87,null))['then'](saveUpdates(_0x4ed7f5['body'],null))[_0x9121('0x29')](respondWithResult(_0x408d87,null))[_0x9121('0x49')](handleError(_0x408d87,null));};exports[_0x9121('0x2a')]=function(_0x3e0b23,_0x292e89){return db[_0x9121('0x33')][_0x9121('0x4d')]({'where':{'id':_0x3e0b23[_0x9121('0x56')]['id']}})[_0x9121('0x29')](handleEntityNotFound(_0x292e89,null))[_0x9121('0x29')](removeEntity(_0x292e89,null))[_0x9121('0x49')](handleError(_0x292e89,null));};exports[_0x9121('0x5c')]=function(_0x73ae63,_0x421bfb,_0x4e83d5){var _0x38e482={'raw':!![],'where':{}};var _0x8a4f39={};var _0x5c9ee9={'count':0x0,'rows':[]};return db[_0x9121('0x33')][_0x9121('0x5d')]({'where':{'id':_0x73ae63[_0x9121('0x56')]['id']}})[_0x9121('0x29')](handleEntityNotFound(_0x421bfb,null))[_0x9121('0x29')](function(_0x1f8ba4){if(_0x1f8ba4){_0x8a4f39[_0x9121('0x39')]=_[_0x9121('0x4b')](db[_0x9121('0x5e')][_0x9121('0x57')]);_0x8a4f39['query']=_[_0x9121('0x4b')](_0x73ae63[_0x9121('0x36')]);_0x8a4f39[_0x9121('0x37')]=_[_0x9121('0x38')](_0x8a4f39[_0x9121('0x39')],_0x8a4f39[_0x9121('0x36')]);_0x38e482['attributes']=_[_0x9121('0x38')](_0x8a4f39[_0x9121('0x39')],qs[_0x9121('0x3b')](_0x73ae63['query'][_0x9121('0x3b')]));_0x38e482['attributes']=_0x38e482['attributes']['length']?_0x38e482['attributes']:_0x8a4f39[_0x9121('0x39')];if(!_0x73ae63[_0x9121('0x36')][_0x9121('0x3d')](_0x9121('0x5f'))){_0x38e482[_0x9121('0x22')]=qs[_0x9121('0x22')](_0x73ae63[_0x9121('0x36')][_0x9121('0x22')]);_0x38e482[_0x9121('0x23')]=qs[_0x9121('0x23')](_0x73ae63[_0x9121('0x36')][_0x9121('0x23')]);}_0x38e482[_0x9121('0x3e')]=qs[_0x9121('0x3f')](_0x73ae63[_0x9121('0x36')][_0x9121('0x3f')]);_0x38e482[_0x9121('0x42')]=qs[_0x9121('0x37')](_['pick'](_0x73ae63[_0x9121('0x36')],_0x8a4f39[_0x9121('0x37')]));_0x38e482[_0x9121('0x42')][_0x9121('0x60')]=_0x1f8ba4['id'];if(_0x73ae63['query'][_0x9121('0x41')]){_0x38e482[_0x9121('0x42')]=_[_0x9121('0x44')](_0x38e482[_0x9121('0x42')],{'$or':_[_0x9121('0x32')](_0x38e482[_0x9121('0x3a')],function(_0x34d270){var _0x4db4b3={};_0x4db4b3[_0x34d270]={'$like':'%'+_0x73ae63[_0x9121('0x36')]['filter']+'%'};return _0x4db4b3;})});}_0x38e482=_['merge']({},_0x38e482,_0x73ae63[_0x9121('0x45')]);return db[_0x9121('0x5e')][_0x9121('0x46')]({'where':_0x38e482[_0x9121('0x42')]})[_0x9121('0x29')](function(_0x38ff26){_0x5c9ee9[_0x9121('0x46')]=_0x38ff26;if(_0x73ae63[_0x9121('0x36')]['includeAll']){_0x38e482[_0x9121('0x4c')]=[{'all':!![]}];}return db[_0x9121('0x5e')][_0x9121('0x48')](_0x38e482);})[_0x9121('0x29')](function(_0x154f7f){_0x5c9ee9[_0x9121('0x61')]=_0x154f7f;return _0x5c9ee9;});}})[_0x9121('0x29')](respondWithFilteredResult(_0x421bfb,_0x38e482))[_0x9121('0x49')](handleError(_0x421bfb,null));};exports[_0x9121('0x62')]=function(_0x48f001,_0x58be5f,_0x29cd79){var _0x2448b4={'raw':!![],'where':{}};var _0x5144d7={};var _0x56bfc8={'count':0x0,'rows':[]};return db[_0x9121('0x33')][_0x9121('0x5d')]({'where':{'id':_0x48f001['params']['id']}})['then'](handleEntityNotFound(_0x58be5f,null))[_0x9121('0x29')](function(_0x167543){if(_0x167543){_0x5144d7[_0x9121('0x39')]=_[_0x9121('0x4b')](db['JscriptyAnswerReport'][_0x9121('0x57')]);_0x5144d7[_0x9121('0x36')]=_[_0x9121('0x4b')](_0x48f001[_0x9121('0x36')]);_0x5144d7['filters']=_[_0x9121('0x38')](_0x5144d7[_0x9121('0x39')],_0x5144d7[_0x9121('0x36')]);_0x2448b4[_0x9121('0x3a')]=_[_0x9121('0x38')](_0x5144d7[_0x9121('0x39')],qs[_0x9121('0x3b')](_0x48f001[_0x9121('0x36')][_0x9121('0x3b')]));_0x2448b4['attributes']=_0x2448b4[_0x9121('0x3a')][_0x9121('0x3c')]?_0x2448b4[_0x9121('0x3a')]:_0x5144d7[_0x9121('0x39')];if(!_0x48f001[_0x9121('0x36')][_0x9121('0x3d')]('nolimit')){_0x2448b4[_0x9121('0x22')]=qs['limit'](_0x48f001['query'][_0x9121('0x22')]);_0x2448b4[_0x9121('0x23')]=qs[_0x9121('0x23')](_0x48f001[_0x9121('0x36')][_0x9121('0x23')]);}_0x2448b4['order']=qs[_0x9121('0x3f')](_0x48f001[_0x9121('0x36')][_0x9121('0x3f')]);_0x2448b4[_0x9121('0x42')]=qs[_0x9121('0x37')](_[_0x9121('0x40')](_0x48f001[_0x9121('0x36')],_0x5144d7[_0x9121('0x37')]));_0x2448b4[_0x9121('0x42')]['ProjectId']=_0x167543['id'];if(_0x48f001[_0x9121('0x36')]['filter']){_0x2448b4['where']=_['merge'](_0x2448b4[_0x9121('0x42')],{'$or':_['map'](_0x2448b4[_0x9121('0x3a')],function(_0x34c729){var _0x5bd880={};_0x5bd880[_0x34c729]={'$like':'%'+_0x48f001['query']['filter']+'%'};return _0x5bd880;})});}_0x2448b4=_[_0x9121('0x44')]({},_0x2448b4,_0x48f001[_0x9121('0x45')]);return db[_0x9121('0x63')]['count']({'where':_0x2448b4[_0x9121('0x42')]})[_0x9121('0x29')](function(_0x17afd0){_0x56bfc8[_0x9121('0x46')]=_0x17afd0;if(_0x48f001[_0x9121('0x36')][_0x9121('0x47')]){_0x2448b4['include']=[{'all':!![]}];}return db[_0x9121('0x63')][_0x9121('0x48')](_0x2448b4);})[_0x9121('0x29')](function(_0x4fb0da){_0x56bfc8[_0x9121('0x61')]=_0x4fb0da;return _0x56bfc8;});}})['then'](respondWithFilteredResult(_0x58be5f,_0x2448b4))[_0x9121('0x49')](handleError(_0x58be5f,null));};function char(_0x7a2074){return _0x9121('0x64')===typeof _0x7a2074?String[_0x9121('0x65')]['apply'](null,arguments):_0x7a2074;}function needsEncapsulation(_0x478d0a){return!!_0x478d0a&&(_0x478d0a['toString']()[_0x9121('0x66')](char(0xd))>=0x0||_0x478d0a['toString']()[_0x9121('0x66')](char(0xa))>=0x0||_0x478d0a[_0x9121('0x67')]()[_0x9121('0x66')](char(0x2c))>=0x0||_0x478d0a[_0x9121('0x67')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x486965){var _0x141c68=char(0x22),_0x1ea5c1='\x5c'+char(0x22),_0x394f9f=_0x486965['toString']()['replace'](new RegExp(_0x141c68,'g'),_0x1ea5c1);return _0x141c68+_0x394f9f+_0x141c68;}exports[_0x9121('0x68')]=function(_0x30370,_0x510887,_0x44b332){var _0x375512,_0x2311b2;var _0x3f3c49={'where':{'ProjectId':_0x30370[_0x9121('0x56')]['id']}};if(_0x30370[_0x9121('0x36')][_0x9121('0x69')]){_0x3f3c49[_0x9121('0x42')]['starttime']=JSON[_0x9121('0x6a')](_0x30370[_0x9121('0x36')]['startTime']);}return db[_0x9121('0x5e')][_0x9121('0x48')](_0x3f3c49)[_0x9121('0x29')](handleEntityNotFound(_0x510887,null))[_0x9121('0x29')](function(_0x439fe0){if(_0x439fe0){_0x375512=_0x439fe0;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0x9121('0x32')](_0x375512,'id')},'ProjectId':_0x30370['params']['id']},'order':_0x9121('0x6b')});}})['then'](handleEntityNotFound(_0x510887,null))[_0x9121('0x29')](function(_0x544c00){if(_0x544c00){_0x2311b2=_0x544c00;var _0xad4d33={};for(var _0x2273f3=0x0,_0x305d5a=_0x2311b2[_0x9121('0x3c')];_0x2273f3<_0x305d5a;_0x2273f3++){if(!_0xad4d33[_0x9121('0x3d')](_0x2311b2[_0x2273f3][_0x9121('0x6c')])){_0xad4d33[_0x2311b2[_0x2273f3][_0x9121('0x6c')]]=needsEncapsulation(_0x2311b2[_0x2273f3][_0x9121('0x6d')])?encapsulate(_0x2311b2[_0x2273f3][_0x9121('0x6d')]):_0x2311b2[_0x2273f3]['question'];}}var _0x29c238=[],_0x4e2781={};for(var _0x374d27=0x0,_0x204cd5=_0x375512[_0x9121('0x3c')];_0x374d27<_0x204cd5;_0x374d27++){_0x4e2781={'ProjectId':_0x30370[_0x9121('0x56')]['id'],'SessionId':_0x375512[_0x374d27]['id'],'StartTime':moment(_0x375512[_0x374d27][_0x9121('0x6e')])['format'](_0x9121('0x6f'))};for(var _0x56ac2a=0x0,_0x41a0c0=_0x2311b2[_0x9121('0x3c')];_0x56ac2a<_0x41a0c0;_0x56ac2a++){if(_0x2311b2[_0x56ac2a]['SessionId']==_0x375512[_0x374d27]['id']&&_0xad4d33[_0x9121('0x3d')](_0x2311b2[_0x56ac2a][_0x9121('0x6c')])){_0x4e2781[_0xad4d33[_0x2311b2[_0x56ac2a][_0x9121('0x6c')]]]=_0x2311b2[_0x56ac2a][_0x9121('0x70')];}}for(var _0x39a808 in _0xad4d33){if(!_0x4e2781[_0x9121('0x3d')](_0xad4d33[_0x39a808])){_0x4e2781[_0xad4d33[_0x39a808]]=null;}}_0x29c238['push'](_0x4e2781);}return _0x29c238;}})['then'](function(_0x5bd56b){if(!_[_0x9121('0x71')](_0x5bd56b)){var _0x1b6e6e=toCsv(_0x5bd56b);var _0x230ac4=Date[_0x9121('0x72')]();fs[_0x9121('0x73')](util[_0x9121('0x74')](_0x9121('0x75'),_0x30370[_0x9121('0x56')]['id'],_0x230ac4),_0x1b6e6e);_0x510887[_0x9121('0x76')](_0x9121('0x77'),_0x9121('0x78')+util['format'](_0x9121('0x79'),_0x30370[_0x9121('0x56')]['id'],_0x230ac4));_0x510887[_0x9121('0x76')](_0x9121('0x7a'),_0x9121('0x7b'));return _0x510887[_0x9121('0x7c')](util[_0x9121('0x74')](_0x9121('0x75'),_0x30370['params']['id'],_0x230ac4));}else{return _0x510887['sendStatus'](0xcc);}})[_0x9121('0x49')](handleError(_0x510887,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 8582f88..c9d7747 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 _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b1f,0x195));var _0xf4b1=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x4b1f[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c3=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3332193..1be2fb5 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x5c06e0,_0x2a946e){_0x5c06e0=_0x5c06e0-0x0;var _0x678eec=_0xac4a[_0x5c06e0];return _0x678eec;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x0713=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5481b8,_0x59aed6){var _0x4e43ae=function(_0x71c070){while(--_0x71c070){_0x5481b8['push'](_0x5481b8['shift']());}};_0x4e43ae(++_0x59aed6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 3dfacf3..866d3d7 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 _0x515e=['describe','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index'];(function(_0x4b161b,_0x184eac){var _0x263bcd=function(_0x1ab332){while(--_0x1ab332){_0x4b161b['push'](_0x4b161b['shift']());}};_0x263bcd(++_0x184eac);}(_0x515e,0xea));var _0xe515=function(_0xa06e0b,_0x6c2305){_0xa06e0b=_0xa06e0b-0x0;var _0x14142f=_0x515e[_0xa06e0b];return _0x14142f;};'use strict';var multer=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var path=require('path');var timeout=require(_0xe515('0x2'));var express=require(_0xe515('0x3'));var router=express[_0xe515('0x4')]();var fs_extra=require(_0xe515('0x5'));var auth=require(_0xe515('0x6'));var interaction=require(_0xe515('0x7'));var config=require(_0xe515('0x8'));var controller=require(_0xe515('0x9'));router[_0xe515('0xa')]('/',auth[_0xe515('0xb')](),controller[_0xe515('0xc')]);router[_0xe515('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xe515('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe515('0xe')]);router[_0xe515('0xf')]('/',auth[_0xe515('0xb')](),controller[_0xe515('0x10')]);router['put']('/:id',auth[_0xe515('0xb')](),controller['update']);router[_0xe515('0x11')]('/:id',auth[_0xe515('0xb')](),controller['destroy']);module[_0xe515('0x12')]=router; \ No newline at end of file +var _0x059d=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x059d,0x129));var _0xd059=function(_0x560e6f,_0xa6ab8a){_0x560e6f=_0x560e6f-0x0;var _0x1fa039=_0x059d[_0x560e6f];return _0x1fa039;};'use strict';var multer=require(_0xd059('0x0'));var util=require(_0xd059('0x1'));var path=require(_0xd059('0x2'));var timeout=require('connect-timeout');var express=require(_0xd059('0x3'));var router=express[_0xd059('0x4')]();var fs_extra=require(_0xd059('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd059('0x6'));var config=require(_0xd059('0x7'));var controller=require(_0xd059('0x8'));router[_0xd059('0x9')]('/',auth[_0xd059('0xa')](),controller[_0xd059('0xb')]);router[_0xd059('0x9')](_0xd059('0xc'),auth[_0xd059('0xa')](),controller['describe']);router[_0xd059('0x9')](_0xd059('0xd'),auth['isAuthenticated'](),controller[_0xd059('0xe')]);router['post']('/',auth[_0xd059('0xa')](),controller['create']);router[_0xd059('0xf')](_0xd059('0xd'),auth[_0xd059('0xa')](),controller[_0xd059('0x10')]);router['delete'](_0xd059('0xd'),auth[_0xd059('0xa')](),controller[_0xd059('0x11')]);module[_0xd059('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 a6fcce9..328f388 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(_0x2d7641,_0x4afd6b){_0x2d7641=_0x2d7641-0x0;var _0x5bff7b=_0x7a54[_0x2d7641];return _0x5bff7b;};'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(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0x16e82f,_0x531e7b){_0x16e82f=_0x16e82f-0x0;var _0x452ce7=_0x7a54[_0x16e82f];return _0x452ce7;};'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 1722693..68a1270 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 _0x0001=['mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0001,0x17a));var _0x1000=function(_0x563c94,_0x381625){_0x563c94=_0x563c94-0x0;var _0x18b486=_0x0001[_0x563c94];return _0x18b486;};'use strict';var emlformat=require(_0x1000('0x0'));var rimraf=require(_0x1000('0x1'));var zipdir=require(_0x1000('0x2'));var jsonpatch=require(_0x1000('0x3'));var rp=require(_0x1000('0x4'));var moment=require(_0x1000('0x5'));var BPromise=require(_0x1000('0x6'));var Mustache=require(_0x1000('0x7'));var util=require(_0x1000('0x8'));var path=require(_0x1000('0x9'));var sox=require('sox');var csv=require(_0x1000('0xa'));var ejs=require(_0x1000('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1000('0xc'));var jsforce=require(_0x1000('0xd'));var deskjs=require(_0x1000('0xe'));var toCsv=require(_0x1000('0xa'));var querystring=require(_0x1000('0xf'));var Papa=require('papaparse');var Redis=require(_0x1000('0x10'));var authService=require(_0x1000('0x11'));var qs=require(_0x1000('0x12'));var as=require(_0x1000('0x13'));var hardwareService=require(_0x1000('0x14'));var logger=require(_0x1000('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1000('0x16'));var licenseUtil=require(_0x1000('0x17'));var db=require(_0x1000('0x18'))['db'];function respondWithStatusCode(_0x11f176,_0x4012dd){_0x4012dd=_0x4012dd||0xcc;return function(_0x150956){if(_0x150956){return _0x11f176[_0x1000('0x19')](_0x4012dd);}return _0x11f176[_0x1000('0x1a')](_0x4012dd)[_0x1000('0x1b')]();};}function respondWithResult(_0x49f57f,_0x4027fb){_0x4027fb=_0x4027fb||0xc8;return function(_0x14bb09){if(_0x14bb09){return _0x49f57f[_0x1000('0x1a')](_0x4027fb)['json'](_0x14bb09);}};}function respondWithFilteredResult(_0x3ae785,_0x575008){return function(_0x2a72c3){if(_0x2a72c3){var _0x476fe4=typeof _0x575008[_0x1000('0x1c')]===_0x1000('0x1d')&&typeof _0x575008[_0x1000('0x1e')]===_0x1000('0x1d');var _0x119735=_0x2a72c3[_0x1000('0x1f')];var _0x158166=_0x476fe4?0x0:_0x575008[_0x1000('0x1c')];var _0xa05dfb=_0x476fe4?_0x2a72c3[_0x1000('0x1f')]:_0x575008[_0x1000('0x1c')]+_0x575008['limit'];var _0xde741b;if(_0xa05dfb>=_0x119735){_0xa05dfb=_0x119735;_0xde741b=0xc8;}else{_0xde741b=0xce;}_0x3ae785[_0x1000('0x1a')](_0xde741b);return _0x3ae785[_0x1000('0x20')]('Content-Range',_0x158166+'-'+_0xa05dfb+'/'+_0x119735)[_0x1000('0x21')](_0x2a72c3);}return null;};}function patchUpdates(_0x572ad2){return function(_0x230ba1){try{jsonpatch['apply'](_0x230ba1,_0x572ad2,!![]);}catch(_0x2fcd8d){return BPromise[_0x1000('0x22')](_0x2fcd8d);}return _0x230ba1[_0x1000('0x23')]();};}function saveUpdates(_0xde9426,_0x31b254){return function(_0x199f29){if(_0x199f29){return _0x199f29['update'](_0xde9426)['then'](function(_0x313f91){return _0x313f91;});}return null;};}function removeEntity(_0x4d09e0,_0x1d430c){return function(_0x427ee9){if(_0x427ee9){return _0x427ee9[_0x1000('0x24')]()[_0x1000('0x25')](function(){_0x4d09e0[_0x1000('0x1a')](0xcc)[_0x1000('0x1b')]();});}};}function handleEntityNotFound(_0x48be1b,_0x41843e){return function(_0x4cd0a6){if(!_0x4cd0a6){_0x48be1b[_0x1000('0x19')](0x194);}return _0x4cd0a6;};}function handleError(_0xf745a8,_0x4901c2){_0x4901c2=_0x4901c2||0x1f4;return function(_0x26e93d){logger[_0x1000('0x26')](_0x26e93d['stack']);if(_0x26e93d[_0x1000('0x27')]){delete _0x26e93d[_0x1000('0x27')];}_0xf745a8[_0x1000('0x1a')](_0x4901c2)[_0x1000('0x28')](_0x26e93d);};}exports[_0x1000('0x29')]=function(_0x4ec8aa,_0x4854c8){var _0x567e88={},_0x15883c={},_0x1e6d30={'count':0x0,'rows':[]};var _0x35dbe6=_[_0x1000('0x2a')](db[_0x1000('0x2b')][_0x1000('0x2c')],function(_0x4d267c){return{'name':_0x4d267c[_0x1000('0x2d')],'type':_0x4d267c[_0x1000('0x2e')]['key']};});_0x15883c[_0x1000('0x2f')]=_[_0x1000('0x2a')](_0x35dbe6,'name');_0x15883c['query']=_['keys'](_0x4ec8aa['query']);_0x15883c[_0x1000('0x30')]=_[_0x1000('0x31')](_0x15883c[_0x1000('0x2f')],_0x15883c[_0x1000('0x32')]);_0x567e88[_0x1000('0x33')]=_[_0x1000('0x31')](_0x15883c['model'],qs[_0x1000('0x34')](_0x4ec8aa['query'][_0x1000('0x34')]));_0x567e88[_0x1000('0x33')]=_0x567e88[_0x1000('0x33')][_0x1000('0x35')]?_0x567e88[_0x1000('0x33')]:_0x15883c[_0x1000('0x2f')];if(!_0x4ec8aa[_0x1000('0x32')][_0x1000('0x36')](_0x1000('0x37'))){_0x567e88['limit']=qs['limit'](_0x4ec8aa[_0x1000('0x32')][_0x1000('0x1e')]);_0x567e88['offset']=qs[_0x1000('0x1c')](_0x4ec8aa[_0x1000('0x32')][_0x1000('0x1c')]);}_0x567e88[_0x1000('0x38')]=qs[_0x1000('0x39')](_0x4ec8aa[_0x1000('0x32')][_0x1000('0x39')]);_0x567e88[_0x1000('0x3a')]=qs[_0x1000('0x30')](_[_0x1000('0x3b')](_0x4ec8aa[_0x1000('0x32')],_0x15883c[_0x1000('0x30')]),_0x35dbe6);if(_0x4ec8aa['query']['filter']){_0x567e88['where']=_[_0x1000('0x3c')](_0x567e88['where'],{'$or':_['map'](_0x35dbe6,function(_0x583482){if(_0x583482[_0x1000('0x2e')]!==_0x1000('0x3d')){var _0x4a1b32={};_0x4a1b32[_0x583482['name']]={'$like':'%'+_0x4ec8aa['query'][_0x1000('0x3e')]+'%'};return _0x4a1b32;}})});}_0x567e88=_['merge']({},_0x567e88,_0x4ec8aa['options']);var _0x5a8b3b={'where':_0x567e88['where']};return db[_0x1000('0x2b')][_0x1000('0x1f')](_0x5a8b3b)['then'](function(_0xa580e3){_0x1e6d30[_0x1000('0x1f')]=_0xa580e3;if(_0x4ec8aa[_0x1000('0x32')][_0x1000('0x3f')]){_0x567e88[_0x1000('0x40')]=[{'all':!![]}];}return db[_0x1000('0x2b')][_0x1000('0x41')](_0x567e88);})[_0x1000('0x25')](function(_0x3c060c){_0x1e6d30[_0x1000('0x42')]=_0x3c060c;return _0x1e6d30;})[_0x1000('0x25')](respondWithFilteredResult(_0x4854c8,_0x567e88))[_0x1000('0x43')](handleError(_0x4854c8,null));};exports[_0x1000('0x44')]=function(_0x1ab767,_0x1149ba){var _0x50ce19={'raw':!![],'where':{'id':_0x1ab767[_0x1000('0x45')]['id']}},_0x1f5c7b={};_0x1f5c7b[_0x1000('0x2f')]=_['keys'](db[_0x1000('0x2b')][_0x1000('0x2c')]);_0x1f5c7b[_0x1000('0x32')]=_[_0x1000('0x46')](_0x1ab767[_0x1000('0x32')]);_0x1f5c7b[_0x1000('0x30')]=_[_0x1000('0x31')](_0x1f5c7b[_0x1000('0x2f')],_0x1f5c7b[_0x1000('0x32')]);_0x50ce19['attributes']=_[_0x1000('0x31')](_0x1f5c7b[_0x1000('0x2f')],qs[_0x1000('0x34')](_0x1ab767[_0x1000('0x32')][_0x1000('0x34')]));_0x50ce19[_0x1000('0x33')]=_0x50ce19[_0x1000('0x33')][_0x1000('0x35')]?_0x50ce19['attributes']:_0x1f5c7b[_0x1000('0x2f')];if(_0x1ab767[_0x1000('0x32')][_0x1000('0x3f')]){_0x50ce19[_0x1000('0x40')]=[{'all':!![]}];}_0x50ce19=_[_0x1000('0x3c')]({},_0x50ce19,_0x1ab767[_0x1000('0x47')]);return db[_0x1000('0x2b')][_0x1000('0x48')](_0x50ce19)[_0x1000('0x25')](handleEntityNotFound(_0x1149ba,null))[_0x1000('0x25')](respondWithResult(_0x1149ba,null))[_0x1000('0x43')](handleError(_0x1149ba,null));};exports[_0x1000('0x49')]=function(_0x86c151,_0xd33c89){return db[_0x1000('0x2b')][_0x1000('0x49')](_0x86c151[_0x1000('0x4a')],{})[_0x1000('0x25')](respondWithResult(_0xd33c89,0xc9))[_0x1000('0x43')](handleError(_0xd33c89,null));};exports[_0x1000('0x4b')]=function(_0x20c266,_0x599630){if(_0x20c266[_0x1000('0x4a')]['id']){delete _0x20c266['body']['id'];}return db[_0x1000('0x2b')][_0x1000('0x48')]({'where':{'id':_0x20c266[_0x1000('0x45')]['id']}})[_0x1000('0x25')](handleEntityNotFound(_0x599630,null))[_0x1000('0x25')](saveUpdates(_0x20c266[_0x1000('0x4a')],null))['then'](respondWithResult(_0x599630,null))[_0x1000('0x43')](handleError(_0x599630,null));};exports[_0x1000('0x24')]=function(_0x3305ac,_0x18859e){return db[_0x1000('0x2b')]['find']({'where':{'id':_0x3305ac[_0x1000('0x45')]['id']}})[_0x1000('0x25')](handleEntityNotFound(_0x18859e,null))[_0x1000('0x25')](removeEntity(_0x18859e,null))[_0x1000('0x43')](handleError(_0x18859e,null));};exports[_0x1000('0x4c')]=function(_0xeefff0,_0x2b6ee0){return db[_0x1000('0x2b')][_0x1000('0x4c')]()[_0x1000('0x25')](respondWithResult(_0x2b6ee0,null))[_0x1000('0x43')](handleError(_0x2b6ee0,null));}; \ No newline at end of file +var _0x12c3=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','JscriptyQuestionReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','keys','find','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x12c3,0x1bb));var _0x312c=function(_0x1efe53,_0x1d5b34){_0x1efe53=_0x1efe53-0x0;var _0x17e4c0=_0x12c3[_0x1efe53];return _0x17e4c0;};'use strict';var emlformat=require(_0x312c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x312c('0x1'));var jsonpatch=require(_0x312c('0x2'));var rp=require(_0x312c('0x3'));var moment=require('moment');var BPromise=require(_0x312c('0x4'));var Mustache=require(_0x312c('0x5'));var util=require(_0x312c('0x6'));var path=require(_0x312c('0x7'));var sox=require(_0x312c('0x8'));var csv=require(_0x312c('0x9'));var ejs=require(_0x312c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x312c('0xb'));var squel=require('squel');var crypto=require(_0x312c('0xc'));var jsforce=require(_0x312c('0xd'));var deskjs=require(_0x312c('0xe'));var toCsv=require(_0x312c('0x9'));var querystring=require(_0x312c('0xf'));var Papa=require(_0x312c('0x10'));var Redis=require(_0x312c('0x11'));var authService=require(_0x312c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x312c('0x13'));var hardwareService=require(_0x312c('0x14'));var logger=require(_0x312c('0x15'))(_0x312c('0x16'));var utils=require(_0x312c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x312c('0x18'));var db=require(_0x312c('0x19'))['db'];function respondWithStatusCode(_0x1ec701,_0x28fb22){_0x28fb22=_0x28fb22||0xcc;return function(_0x491c54){if(_0x491c54){return _0x1ec701[_0x312c('0x1a')](_0x28fb22);}return _0x1ec701[_0x312c('0x1b')](_0x28fb22)[_0x312c('0x1c')]();};}function respondWithResult(_0x18ab5a,_0x1f5980){_0x1f5980=_0x1f5980||0xc8;return function(_0x59b250){if(_0x59b250){return _0x18ab5a[_0x312c('0x1b')](_0x1f5980)[_0x312c('0x1d')](_0x59b250);}};}function respondWithFilteredResult(_0x1967e4,_0xe20f5d){return function(_0x14a5e7){if(_0x14a5e7){var _0x2d08aa=typeof _0xe20f5d['offset']===_0x312c('0x1e')&&typeof _0xe20f5d[_0x312c('0x1f')]===_0x312c('0x1e');var _0x5c2b3f=_0x14a5e7[_0x312c('0x20')];var _0x3e4582=_0x2d08aa?0x0:_0xe20f5d['offset'];var _0x386fa8=_0x2d08aa?_0x14a5e7[_0x312c('0x20')]:_0xe20f5d[_0x312c('0x21')]+_0xe20f5d[_0x312c('0x1f')];var _0xed55c2;if(_0x386fa8>=_0x5c2b3f){_0x386fa8=_0x5c2b3f;_0xed55c2=0xc8;}else{_0xed55c2=0xce;}_0x1967e4[_0x312c('0x1b')](_0xed55c2);return _0x1967e4[_0x312c('0x22')](_0x312c('0x23'),_0x3e4582+'-'+_0x386fa8+'/'+_0x5c2b3f)['json'](_0x14a5e7);}return null;};}function patchUpdates(_0x183440){return function(_0x50fd82){try{jsonpatch[_0x312c('0x24')](_0x50fd82,_0x183440,!![]);}catch(_0x2e9de0){return BPromise[_0x312c('0x25')](_0x2e9de0);}return _0x50fd82[_0x312c('0x26')]();};}function saveUpdates(_0x561ef2,_0x2f74f2){return function(_0x53aba4){if(_0x53aba4){return _0x53aba4[_0x312c('0x27')](_0x561ef2)[_0x312c('0x28')](function(_0x26e4b5){return _0x26e4b5;});}return null;};}function removeEntity(_0x27c664,_0x37f442){return function(_0x1030d8){if(_0x1030d8){return _0x1030d8[_0x312c('0x29')]()[_0x312c('0x28')](function(){_0x27c664[_0x312c('0x1b')](0xcc)[_0x312c('0x1c')]();});}};}function handleEntityNotFound(_0x1aeb12,_0x36b3f1){return function(_0x2b84b5){if(!_0x2b84b5){_0x1aeb12[_0x312c('0x1a')](0x194);}return _0x2b84b5;};}function handleError(_0xb84a83,_0x42ea7d){_0x42ea7d=_0x42ea7d||0x1f4;return function(_0xaa0f00){logger[_0x312c('0x2a')](_0xaa0f00[_0x312c('0x2b')]);if(_0xaa0f00[_0x312c('0x2c')]){delete _0xaa0f00['name'];}_0xb84a83['status'](_0x42ea7d)['send'](_0xaa0f00);};}exports[_0x312c('0x2d')]=function(_0x331f99,_0x5b5c68){var _0x30f4ba={},_0x78bb6f={},_0x545d0a={'count':0x0,'rows':[]};var _0x2162c4=_['map'](db[_0x312c('0x2e')][_0x312c('0x2f')],function(_0x8ca586){return{'name':_0x8ca586['fieldName'],'type':_0x8ca586[_0x312c('0x30')][_0x312c('0x31')]};});_0x78bb6f[_0x312c('0x32')]=_[_0x312c('0x33')](_0x2162c4,'name');_0x78bb6f[_0x312c('0x34')]=_['keys'](_0x331f99['query']);_0x78bb6f[_0x312c('0x35')]=_[_0x312c('0x36')](_0x78bb6f[_0x312c('0x32')],_0x78bb6f['query']);_0x30f4ba[_0x312c('0x37')]=_[_0x312c('0x36')](_0x78bb6f[_0x312c('0x32')],qs['fields'](_0x331f99['query'][_0x312c('0x38')]));_0x30f4ba['attributes']=_0x30f4ba['attributes'][_0x312c('0x39')]?_0x30f4ba['attributes']:_0x78bb6f[_0x312c('0x32')];if(!_0x331f99[_0x312c('0x34')][_0x312c('0x3a')](_0x312c('0x3b'))){_0x30f4ba[_0x312c('0x1f')]=qs[_0x312c('0x1f')](_0x331f99[_0x312c('0x34')][_0x312c('0x1f')]);_0x30f4ba[_0x312c('0x21')]=qs['offset'](_0x331f99[_0x312c('0x34')][_0x312c('0x21')]);}_0x30f4ba[_0x312c('0x3c')]=qs[_0x312c('0x3d')](_0x331f99[_0x312c('0x34')][_0x312c('0x3d')]);_0x30f4ba[_0x312c('0x3e')]=qs[_0x312c('0x35')](_[_0x312c('0x3f')](_0x331f99[_0x312c('0x34')],_0x78bb6f[_0x312c('0x35')]),_0x2162c4);if(_0x331f99[_0x312c('0x34')]['filter']){_0x30f4ba[_0x312c('0x3e')]=_[_0x312c('0x40')](_0x30f4ba[_0x312c('0x3e')],{'$or':_[_0x312c('0x33')](_0x2162c4,function(_0x2e3700){if(_0x2e3700['type']!==_0x312c('0x41')){var _0x223fe1={};_0x223fe1[_0x2e3700['name']]={'$like':'%'+_0x331f99[_0x312c('0x34')][_0x312c('0x42')]+'%'};return _0x223fe1;}})});}_0x30f4ba=_[_0x312c('0x40')]({},_0x30f4ba,_0x331f99[_0x312c('0x43')]);var _0x460d0b={'where':_0x30f4ba[_0x312c('0x3e')]};return db['JscriptyQuestionReport'][_0x312c('0x20')](_0x460d0b)[_0x312c('0x28')](function(_0x1fa4b2){_0x545d0a[_0x312c('0x20')]=_0x1fa4b2;if(_0x331f99[_0x312c('0x34')]['includeAll']){_0x30f4ba[_0x312c('0x44')]=[{'all':!![]}];}return db[_0x312c('0x2e')]['findAll'](_0x30f4ba);})[_0x312c('0x28')](function(_0x1f2525){_0x545d0a[_0x312c('0x45')]=_0x1f2525;return _0x545d0a;})[_0x312c('0x28')](respondWithFilteredResult(_0x5b5c68,_0x30f4ba))[_0x312c('0x46')](handleError(_0x5b5c68,null));};exports['show']=function(_0x376a89,_0x36c36d){var _0x261e79={'raw':!![],'where':{'id':_0x376a89[_0x312c('0x47')]['id']}},_0x62e191={};_0x62e191[_0x312c('0x32')]=_[_0x312c('0x48')](db[_0x312c('0x2e')][_0x312c('0x2f')]);_0x62e191[_0x312c('0x34')]=_['keys'](_0x376a89['query']);_0x62e191[_0x312c('0x35')]=_[_0x312c('0x36')](_0x62e191[_0x312c('0x32')],_0x62e191[_0x312c('0x34')]);_0x261e79[_0x312c('0x37')]=_['intersection'](_0x62e191[_0x312c('0x32')],qs['fields'](_0x376a89[_0x312c('0x34')][_0x312c('0x38')]));_0x261e79[_0x312c('0x37')]=_0x261e79[_0x312c('0x37')]['length']?_0x261e79['attributes']:_0x62e191[_0x312c('0x32')];if(_0x376a89['query']['includeAll']){_0x261e79[_0x312c('0x44')]=[{'all':!![]}];}_0x261e79=_['merge']({},_0x261e79,_0x376a89[_0x312c('0x43')]);return db[_0x312c('0x2e')][_0x312c('0x49')](_0x261e79)['then'](handleEntityNotFound(_0x36c36d,null))[_0x312c('0x28')](respondWithResult(_0x36c36d,null))[_0x312c('0x46')](handleError(_0x36c36d,null));};exports['create']=function(_0x1ed236,_0x4810f7){return db[_0x312c('0x2e')]['create'](_0x1ed236[_0x312c('0x4a')],{})[_0x312c('0x28')](respondWithResult(_0x4810f7,0xc9))['catch'](handleError(_0x4810f7,null));};exports[_0x312c('0x27')]=function(_0x1d36e1,_0x587a88){if(_0x1d36e1[_0x312c('0x4a')]['id']){delete _0x1d36e1[_0x312c('0x4a')]['id'];}return db[_0x312c('0x2e')][_0x312c('0x49')]({'where':{'id':_0x1d36e1[_0x312c('0x47')]['id']}})[_0x312c('0x28')](handleEntityNotFound(_0x587a88,null))['then'](saveUpdates(_0x1d36e1[_0x312c('0x4a')],null))['then'](respondWithResult(_0x587a88,null))[_0x312c('0x46')](handleError(_0x587a88,null));};exports[_0x312c('0x29')]=function(_0x2e0294,_0x2f2c3c){return db[_0x312c('0x2e')]['find']({'where':{'id':_0x2e0294['params']['id']}})['then'](handleEntityNotFound(_0x2f2c3c,null))[_0x312c('0x28')](removeEntity(_0x2f2c3c,null))[_0x312c('0x46')](handleError(_0x2f2c3c,null));};exports[_0x312c('0x4b')]=function(_0x1ae277,_0x3c84db){return db['JscriptyQuestionReport'][_0x312c('0x4b')]()[_0x312c('0x28')](respondWithResult(_0x3c84db,null))['catch'](handleError(_0x3c84db,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index de06459..3c33f38 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 _0xaf24=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x15378f,_0x5c3eaa){var _0x4742bc=function(_0x355297){while(--_0x355297){_0x15378f['push'](_0x15378f['shift']());}};_0x4742bc(++_0x5c3eaa);}(_0xaf24,0x89));var _0x4af2=function(_0x5872cb,_0x3ea3e1){_0x5872cb=_0x5872cb-0x0;var _0xe0e5a1=_0xaf24[_0x5872cb];return _0xe0e5a1;};'use strict';var _=require(_0x4af2('0x0'));var util=require(_0x4af2('0x1'));var logger=require(_0x4af2('0x2'))(_0x4af2('0x3'));var moment=require(_0x4af2('0x4'));var BPromise=require(_0x4af2('0x5'));var rp=require(_0x4af2('0x6'));var fs=require('fs');var path=require(_0x4af2('0x7'));var rimraf=require(_0x4af2('0x8'));var config=require(_0x4af2('0x9'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x4af2('0xa')]=function(_0x1dc85a,_0x203fcb){return _0x1dc85a[_0x4af2('0xb')](_0x4af2('0xc'),attributes,{'tableName':_0x4af2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf024=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api'];(function(_0x49892b,_0x4ea8ac){var _0x2f8ba2=function(_0x9d9971){while(--_0x9d9971){_0x49892b['push'](_0x49892b['shift']());}};_0x2f8ba2(++_0x4ea8ac);}(_0xf024,0x159));var _0x4f02=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xf024[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0x4f02('0x0'));var logger=require(_0x4f02('0x1'))(_0x4f02('0x2'));var moment=require(_0x4f02('0x3'));var BPromise=require(_0x4f02('0x4'));var rp=require(_0x4f02('0x5'));var fs=require('fs');var path=require(_0x4f02('0x6'));var rimraf=require(_0x4f02('0x7'));var config=require(_0x4f02('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x4f02('0x9')]=function(_0x3b388e,_0x306ed4){return _0x3b388e['define'](_0x4f02('0xa'),attributes,{'tableName':_0x4f02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 9d0ada1..8981e1e 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 _0xd48f=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x208d89,_0x56bec0){var _0xda6990=function(_0x3bfe3b){while(--_0x3bfe3b){_0x208d89['push'](_0x208d89['shift']());}};_0xda6990(++_0x56bec0);}(_0xd48f,0x162));var _0xfd48=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd48f[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0xfd48('0x0'));var util=require('util');var moment=require(_0xfd48('0x1'));var BPromise=require(_0xfd48('0x2'));var rs=require(_0xfd48('0x3'));var fs=require('fs');var Redis=require(_0xfd48('0x4'));var db=require(_0xfd48('0x5'))['db'];var utils=require(_0xfd48('0x6'));var logger=require('../../config/logger')(_0xfd48('0x7'));var config=require(_0xfd48('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfd48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5b99,_0x43a3e6,_0x546660){return new BPromise(function(_0x3f2ebd,_0x4b9cf9){return client[_0xfd48('0xa')](_0x1b5b99,_0x546660)[_0xfd48('0xb')](function(_0x539846){logger['info'](_0xfd48('0xc'),_0x43a3e6,_0xfd48('0xd'));logger[_0xfd48('0xe')](_0xfd48('0xf'),_0x43a3e6,_0xfd48('0xd'),JSON[_0xfd48('0x10')](_0x539846));if(_0x539846[_0xfd48('0x11')]){if(_0x539846[_0xfd48('0x11')][_0xfd48('0x12')]===0x1f4){logger[_0xfd48('0x11')](_0xfd48('0xc'),_0x43a3e6,_0x539846[_0xfd48('0x11')][_0xfd48('0x13')]);return _0x4b9cf9(_0x539846[_0xfd48('0x11')]['message']);}logger['error'](_0xfd48('0xc'),_0x43a3e6,_0x539846[_0xfd48('0x11')]['message']);return _0x3f2ebd(_0x539846[_0xfd48('0x11')][_0xfd48('0x13')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x43a3e6,_0xfd48('0xd'));_0x3f2ebd(_0x539846[_0xfd48('0x14')]['message']);}})['catch'](function(_0x4bcc78){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x43a3e6,_0x4bcc78);_0x4b9cf9(_0x4bcc78);});});} \ No newline at end of file +var _0x5ad4=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x51f812,_0x36212c){var _0x1ad290=function(_0x1f03b7){while(--_0x1f03b7){_0x51f812['push'](_0x51f812['shift']());}};_0x1ad290(++_0x36212c);}(_0x5ad4,0x1b6));var _0x45ad=function(_0x4f1b04,_0x4a2d07){_0x4f1b04=_0x4f1b04-0x0;var _0x133444=_0x5ad4[_0x4f1b04];return _0x133444;};'use strict';var _=require('lodash');var util=require(_0x45ad('0x0'));var moment=require('moment');var BPromise=require(_0x45ad('0x1'));var rs=require(_0x45ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x45ad('0x3'));var logger=require(_0x45ad('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x45ad('0x5'));var client=jayson[_0x45ad('0x6')][_0x45ad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d67c9,_0x39d2db,_0x1184e9){return new BPromise(function(_0xb293ed,_0x35ebef){return client[_0x45ad('0x8')](_0x2d67c9,_0x1184e9)[_0x45ad('0x9')](function(_0x3067ed){logger['info'](_0x45ad('0xa'),_0x39d2db,_0x45ad('0xb'));logger['debug'](_0x45ad('0xc'),_0x39d2db,_0x45ad('0xb'),JSON['stringify'](_0x3067ed));if(_0x3067ed[_0x45ad('0xd')]){if(_0x3067ed['error'][_0x45ad('0xe')]===0x1f4){logger['error'](_0x45ad('0xa'),_0x39d2db,_0x3067ed[_0x45ad('0xd')][_0x45ad('0xf')]);return _0x35ebef(_0x3067ed['error'][_0x45ad('0xf')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x39d2db,_0x3067ed[_0x45ad('0xd')][_0x45ad('0xf')]);return _0xb293ed(_0x3067ed[_0x45ad('0xd')][_0x45ad('0xf')]);}else{logger[_0x45ad('0x10')](_0x45ad('0xa'),_0x39d2db,_0x45ad('0xb'));_0xb293ed(_0x3067ed[_0x45ad('0x11')][_0x45ad('0xf')]);}})['catch'](function(_0x385cb1){logger[_0x45ad('0xd')](_0x45ad('0xa'),_0x39d2db,_0x385cb1);_0x35ebef(_0x385cb1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e2da160..081af7d 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 _0x72ab=['../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post','put','delete','destroy','multer','util','path','express','Router','fs-extra'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x72ab,0x1da));var _0xb72a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72ab[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb72a('0x0'));var util=require(_0xb72a('0x1'));var path=require(_0xb72a('0x2'));var timeout=require('connect-timeout');var express=require(_0xb72a('0x3'));var router=express[_0xb72a('0x4')]();var fs_extra=require(_0xb72a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb72a('0x6'));var config=require('../../config/environment');var controller=require(_0xb72a('0x7'));router[_0xb72a('0x8')]('/',auth[_0xb72a('0x9')](),controller[_0xb72a('0xa')]);router[_0xb72a('0x8')](_0xb72a('0xb'),auth[_0xb72a('0x9')](),controller[_0xb72a('0xc')]);router[_0xb72a('0x8')](_0xb72a('0xd'),auth[_0xb72a('0x9')](),controller[_0xb72a('0xe')]);router[_0xb72a('0x8')](_0xb72a('0xf'),auth[_0xb72a('0x9')](),controller['getQuestions']);router[_0xb72a('0x10')]('/',auth[_0xb72a('0x9')](),controller['create']);router[_0xb72a('0x11')]('/:id',auth[_0xb72a('0x9')](),controller['update']);router[_0xb72a('0x12')](_0xb72a('0xd'),auth[_0xb72a('0x9')](),controller[_0xb72a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5b43=['index','/describe','/:id','show','getQuestions','post','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x5b43,0x15e));var _0x35b4=function(_0x34e9dd,_0x774db3){_0x34e9dd=_0x34e9dd-0x0;var _0x2330d1=_0x5b43[_0x34e9dd];return _0x2330d1;};'use strict';var multer=require(_0x35b4('0x0'));var util=require(_0x35b4('0x1'));var path=require('path');var timeout=require(_0x35b4('0x2'));var express=require('express');var router=express[_0x35b4('0x3')]();var fs_extra=require(_0x35b4('0x4'));var auth=require(_0x35b4('0x5'));var interaction=require(_0x35b4('0x6'));var config=require('../../config/environment');var controller=require(_0x35b4('0x7'));router[_0x35b4('0x8')]('/',auth[_0x35b4('0x9')](),controller[_0x35b4('0xa')]);router[_0x35b4('0x8')](_0x35b4('0xb'),auth[_0x35b4('0x9')](),controller['describe']);router[_0x35b4('0x8')](_0x35b4('0xc'),auth[_0x35b4('0x9')](),controller[_0x35b4('0xd')]);router[_0x35b4('0x8')]('/:id/questions',auth['isAuthenticated'](),controller[_0x35b4('0xe')]);router[_0x35b4('0xf')]('/',auth[_0x35b4('0x9')](),controller['create']);router['put'](_0x35b4('0xc'),auth['isAuthenticated'](),controller[_0x35b4('0x10')]);router[_0x35b4('0x11')]('/:id',auth[_0x35b4('0x9')](),controller[_0x35b4('0x12')]);module[_0x35b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3f6ecf1..b814dfc 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 _0xe511=['DATE','STRING','BOOLEAN','moment','sequelize','exports','setDataValue','endtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x143));var _0x1e51=function(_0x54db44,_0xb3f985){_0x54db44=_0x54db44-0x0;var _0x319095=_0xe511[_0x54db44];return _0x319095;};'use strict';var moment=require(_0x1e51('0x0'));var Sequelize=require(_0x1e51('0x1'));module[_0x1e51('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3e14ad){this[_0x1e51('0x3')]('starttime',_0x3e14ad);this[_0x1e51('0x3')](_0x1e51('0x4'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1e51('0x5')]},'membername':{'type':Sequelize[_0x1e51('0x6')]},'projectname':{'type':Sequelize[_0x1e51('0x6')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x1e51('0x6')]},'calleridname':{'type':Sequelize[_0x1e51('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1e51('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ca2=['setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','exports','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5ca2,0xde));var _0x25ca=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5ca2[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x25ca('0x0')]={'starttime':{'type':Sequelize[_0x25ca('0x1')],'set':function(_0x5ee1f5){this[_0x25ca('0x2')]('starttime',_0x5ee1f5);this[_0x25ca('0x2')](_0x25ca('0x3'),moment()[_0x25ca('0x4')](_0x25ca('0x5')));}},'endtime':{'type':Sequelize[_0x25ca('0x1')]},'membername':{'type':Sequelize[_0x25ca('0x6')]},'projectname':{'type':Sequelize[_0x25ca('0x6')]},'queue':{'type':Sequelize[_0x25ca('0x6')]},'uniqueid':{'type':Sequelize[_0x25ca('0x6')]},'calleridname':{'type':Sequelize[_0x25ca('0x6')]},'calleridnum':{'type':Sequelize[_0x25ca('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 19262e3..b44da91 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 _0x2806=['nolimit','pick','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','destroy','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','find','create','body','params','describe','getQuestions','hasOwnProperty'];(function(_0x11769d,_0x982194){var _0x142756=function(_0x139802){while(--_0x139802){_0x11769d['push'](_0x11769d['shift']());}};_0x142756(++_0x982194);}(_0x2806,0xaa));var _0x6280=function(_0x564ffd,_0x5cfc4c){_0x564ffd=_0x564ffd-0x0;var _0x21d95d=_0x2806[_0x564ffd];return _0x21d95d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6280('0x0'));var zipdir=require(_0x6280('0x1'));var jsonpatch=require(_0x6280('0x2'));var rp=require(_0x6280('0x3'));var moment=require(_0x6280('0x4'));var BPromise=require(_0x6280('0x5'));var Mustache=require(_0x6280('0x6'));var util=require(_0x6280('0x7'));var path=require('path');var sox=require(_0x6280('0x8'));var csv=require(_0x6280('0x9'));var ejs=require(_0x6280('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6280('0xb'));var crypto=require(_0x6280('0xc'));var jsforce=require(_0x6280('0xd'));var deskjs=require(_0x6280('0xe'));var toCsv=require(_0x6280('0x9'));var querystring=require(_0x6280('0xf'));var Papa=require('papaparse');var Redis=require(_0x6280('0x10'));var authService=require(_0x6280('0x11'));var qs=require(_0x6280('0x12'));var as=require(_0x6280('0x13'));var hardwareService=require(_0x6280('0x14'));var logger=require(_0x6280('0x15'))(_0x6280('0x16'));var utils=require(_0x6280('0x17'));var config=require(_0x6280('0x18'));var licenseUtil=require(_0x6280('0x19'));var db=require(_0x6280('0x1a'))['db'];function respondWithStatusCode(_0x4152b0,_0x13d5c3){_0x13d5c3=_0x13d5c3||0xcc;return function(_0x4b64b0){if(_0x4b64b0){return _0x4152b0[_0x6280('0x1b')](_0x13d5c3);}return _0x4152b0[_0x6280('0x1c')](_0x13d5c3)[_0x6280('0x1d')]();};}function respondWithResult(_0x23e4b7,_0x1d8997){_0x1d8997=_0x1d8997||0xc8;return function(_0x54afe5){if(_0x54afe5){return _0x23e4b7[_0x6280('0x1c')](_0x1d8997)[_0x6280('0x1e')](_0x54afe5);}};}function respondWithFilteredResult(_0x410e1d,_0xd82778){return function(_0x40ff7e){if(_0x40ff7e){var _0xe1b2c7=typeof _0xd82778[_0x6280('0x1f')]===_0x6280('0x20')&&typeof _0xd82778[_0x6280('0x21')]==='undefined';var _0x2203fc=_0x40ff7e['count'];var _0x3a13e3=_0xe1b2c7?0x0:_0xd82778[_0x6280('0x1f')];var _0x5232a7=_0xe1b2c7?_0x40ff7e['count']:_0xd82778['offset']+_0xd82778[_0x6280('0x21')];var _0xc9efe7;if(_0x5232a7>=_0x2203fc){_0x5232a7=_0x2203fc;_0xc9efe7=0xc8;}else{_0xc9efe7=0xce;}_0x410e1d[_0x6280('0x1c')](_0xc9efe7);return _0x410e1d[_0x6280('0x22')]('Content-Range',_0x3a13e3+'-'+_0x5232a7+'/'+_0x2203fc)[_0x6280('0x1e')](_0x40ff7e);}return null;};}function patchUpdates(_0x52d152){return function(_0x4527db){try{jsonpatch[_0x6280('0x23')](_0x4527db,_0x52d152,!![]);}catch(_0x5e9409){return BPromise['reject'](_0x5e9409);}return _0x4527db[_0x6280('0x24')]();};}function saveUpdates(_0xfe5988,_0x3828d4){return function(_0x4ce9d1){if(_0x4ce9d1){return _0x4ce9d1[_0x6280('0x25')](_0xfe5988)['then'](function(_0xa035b9){return _0xa035b9;});}return null;};}function removeEntity(_0xa0b06f,_0x3fe432){return function(_0x33381a){if(_0x33381a){return _0x33381a[_0x6280('0x26')]()[_0x6280('0x27')](function(){_0xa0b06f['status'](0xcc)[_0x6280('0x1d')]();});}};}function handleEntityNotFound(_0x16f1e6,_0x4a7133){return function(_0x2d0c67){if(!_0x2d0c67){_0x16f1e6[_0x6280('0x1b')](0x194);}return _0x2d0c67;};}function handleError(_0x36d989,_0x305341){_0x305341=_0x305341||0x1f4;return function(_0x50a4d4){logger[_0x6280('0x28')](_0x50a4d4[_0x6280('0x29')]);if(_0x50a4d4[_0x6280('0x2a')]){delete _0x50a4d4[_0x6280('0x2a')];}_0x36d989[_0x6280('0x1c')](_0x305341)[_0x6280('0x2b')](_0x50a4d4);};}exports[_0x6280('0x2c')]=function(_0x40af5c,_0xe987d3){var _0x245936={},_0x3e45f9={},_0x59b020={'count':0x0,'rows':[]};var _0xa669e3=_[_0x6280('0x2d')](db[_0x6280('0x2e')][_0x6280('0x2f')],function(_0x35704e){return{'name':_0x35704e[_0x6280('0x30')],'type':_0x35704e[_0x6280('0x31')][_0x6280('0x32')]};});_0x3e45f9[_0x6280('0x33')]=_[_0x6280('0x2d')](_0xa669e3,_0x6280('0x2a'));_0x3e45f9['query']=_[_0x6280('0x34')](_0x40af5c[_0x6280('0x35')]);_0x3e45f9[_0x6280('0x36')]=_['intersection'](_0x3e45f9[_0x6280('0x33')],_0x3e45f9[_0x6280('0x35')]);_0x245936[_0x6280('0x37')]=_[_0x6280('0x38')](_0x3e45f9[_0x6280('0x33')],qs['fields'](_0x40af5c[_0x6280('0x35')][_0x6280('0x39')]));_0x245936[_0x6280('0x37')]=_0x245936[_0x6280('0x37')][_0x6280('0x3a')]?_0x245936[_0x6280('0x37')]:_0x3e45f9['model'];if(!_0x40af5c[_0x6280('0x35')]['hasOwnProperty']('nolimit')){_0x245936[_0x6280('0x21')]=qs[_0x6280('0x21')](_0x40af5c[_0x6280('0x35')][_0x6280('0x21')]);_0x245936['offset']=qs[_0x6280('0x1f')](_0x40af5c[_0x6280('0x35')]['offset']);}_0x245936[_0x6280('0x3b')]=qs['sort'](_0x40af5c[_0x6280('0x35')][_0x6280('0x3c')]);_0x245936[_0x6280('0x3d')]=qs[_0x6280('0x36')](_['pick'](_0x40af5c[_0x6280('0x35')],_0x3e45f9[_0x6280('0x36')]),_0xa669e3);if(_0x40af5c[_0x6280('0x35')][_0x6280('0x3e')]){_0x245936['where']=_[_0x6280('0x3f')](_0x245936[_0x6280('0x3d')],{'$or':_[_0x6280('0x2d')](_0xa669e3,function(_0x2c6d5f){if(_0x2c6d5f[_0x6280('0x31')]!==_0x6280('0x40')){var _0x3a0c67={};_0x3a0c67[_0x2c6d5f['name']]={'$like':'%'+_0x40af5c['query']['filter']+'%'};return _0x3a0c67;}})});}_0x245936=_[_0x6280('0x3f')]({},_0x245936,_0x40af5c[_0x6280('0x41')]);var _0x4dba21={'where':_0x245936['where']};return db[_0x6280('0x2e')][_0x6280('0x42')](_0x4dba21)[_0x6280('0x27')](function(_0xc0ecf6){_0x59b020[_0x6280('0x42')]=_0xc0ecf6;if(_0x40af5c[_0x6280('0x35')]['includeAll']){_0x245936[_0x6280('0x43')]=[{'all':!![]}];}return db[_0x6280('0x2e')][_0x6280('0x44')](_0x245936);})['then'](function(_0x2849c1){_0x59b020[_0x6280('0x45')]=_0x2849c1;return _0x59b020;})[_0x6280('0x27')](respondWithFilteredResult(_0xe987d3,_0x245936))[_0x6280('0x46')](handleError(_0xe987d3,null));};exports[_0x6280('0x47')]=function(_0x351492,_0x33a06e){var _0x47316e={'raw':!![],'where':{'id':_0x351492['params']['id']}},_0x2339cd={};_0x2339cd['model']=_['keys'](db[_0x6280('0x2e')][_0x6280('0x2f')]);_0x2339cd[_0x6280('0x35')]=_['keys'](_0x351492[_0x6280('0x35')]);_0x2339cd['filters']=_[_0x6280('0x38')](_0x2339cd[_0x6280('0x33')],_0x2339cd[_0x6280('0x35')]);_0x47316e['attributes']=_['intersection'](_0x2339cd[_0x6280('0x33')],qs[_0x6280('0x39')](_0x351492['query'][_0x6280('0x39')]));_0x47316e[_0x6280('0x37')]=_0x47316e[_0x6280('0x37')][_0x6280('0x3a')]?_0x47316e[_0x6280('0x37')]:_0x2339cd[_0x6280('0x33')];if(_0x351492[_0x6280('0x35')]['includeAll']){_0x47316e['include']=[{'all':!![]}];}_0x47316e=_[_0x6280('0x3f')]({},_0x47316e,_0x351492[_0x6280('0x41')]);return db['JscriptySessionReport'][_0x6280('0x48')](_0x47316e)[_0x6280('0x27')](handleEntityNotFound(_0x33a06e,null))[_0x6280('0x27')](respondWithResult(_0x33a06e,null))[_0x6280('0x46')](handleError(_0x33a06e,null));};exports['create']=function(_0x3273ec,_0x31ebd6){return db['JscriptySessionReport'][_0x6280('0x49')](_0x3273ec['body'],{})['then'](respondWithResult(_0x31ebd6,0xc9))['catch'](handleError(_0x31ebd6,null));};exports[_0x6280('0x25')]=function(_0x37d230,_0x25b9ef){if(_0x37d230[_0x6280('0x4a')]['id']){delete _0x37d230[_0x6280('0x4a')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x37d230[_0x6280('0x4b')]['id']}})[_0x6280('0x27')](handleEntityNotFound(_0x25b9ef,null))[_0x6280('0x27')](saveUpdates(_0x37d230[_0x6280('0x4a')],null))[_0x6280('0x27')](respondWithResult(_0x25b9ef,null))['catch'](handleError(_0x25b9ef,null));};exports[_0x6280('0x26')]=function(_0x40841f,_0x5707bb){return db[_0x6280('0x2e')]['find']({'where':{'id':_0x40841f[_0x6280('0x4b')]['id']}})[_0x6280('0x27')](handleEntityNotFound(_0x5707bb,null))[_0x6280('0x27')](removeEntity(_0x5707bb,null))[_0x6280('0x46')](handleError(_0x5707bb,null));};exports[_0x6280('0x4c')]=function(_0x109761,_0xf66957){return db[_0x6280('0x2e')][_0x6280('0x4c')]()['then'](respondWithResult(_0xf66957,null))[_0x6280('0x46')](handleError(_0xf66957,null));};exports[_0x6280('0x4d')]=function(_0x43c3ec,_0x588088,_0x3fcd53){var _0x2d4fbc={'raw':!![],'where':{}};var _0xf3b1e4={};var _0x183ee1={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x43c3ec[_0x6280('0x4b')]['id']}})[_0x6280('0x27')](handleEntityNotFound(_0x588088,null))[_0x6280('0x27')](function(_0x519b7b){if(_0x519b7b){_0xf3b1e4['model']=_[_0x6280('0x34')](db['JscriptyQuestionReport'][_0x6280('0x2f')]);_0xf3b1e4[_0x6280('0x35')]=_['keys'](_0x43c3ec[_0x6280('0x35')]);_0xf3b1e4['filters']=_[_0x6280('0x38')](_0xf3b1e4[_0x6280('0x33')],_0xf3b1e4[_0x6280('0x35')]);_0x2d4fbc[_0x6280('0x37')]=_['intersection'](_0xf3b1e4[_0x6280('0x33')],qs[_0x6280('0x39')](_0x43c3ec[_0x6280('0x35')]['fields']));_0x2d4fbc[_0x6280('0x37')]=_0x2d4fbc[_0x6280('0x37')][_0x6280('0x3a')]?_0x2d4fbc[_0x6280('0x37')]:_0xf3b1e4[_0x6280('0x33')];if(!_0x43c3ec[_0x6280('0x35')][_0x6280('0x4e')](_0x6280('0x4f'))){_0x2d4fbc[_0x6280('0x21')]=qs[_0x6280('0x21')](_0x43c3ec[_0x6280('0x35')]['limit']);_0x2d4fbc[_0x6280('0x1f')]=qs[_0x6280('0x1f')](_0x43c3ec[_0x6280('0x35')][_0x6280('0x1f')]);}_0x2d4fbc[_0x6280('0x3b')]=qs[_0x6280('0x3c')](_0x43c3ec['query'][_0x6280('0x3c')]);_0x2d4fbc['where']=qs[_0x6280('0x36')](_[_0x6280('0x50')](_0x43c3ec[_0x6280('0x35')],_0xf3b1e4[_0x6280('0x36')]));_0x2d4fbc[_0x6280('0x3d')][_0x6280('0x51')]=_0x519b7b['id'];if(_0x43c3ec['query']['filter']){_0x2d4fbc[_0x6280('0x3d')]=_[_0x6280('0x3f')](_0x2d4fbc[_0x6280('0x3d')],{'$or':_['map'](_0x2d4fbc['attributes'],function(_0x1134ee){var _0x40a72b={};_0x40a72b[_0x1134ee]={'$like':'%'+_0x43c3ec[_0x6280('0x35')]['filter']+'%'};return _0x40a72b;})});}_0x2d4fbc=_[_0x6280('0x3f')]({},_0x2d4fbc,_0x43c3ec[_0x6280('0x41')]);return db[_0x6280('0x52')][_0x6280('0x42')]({'where':_0x2d4fbc[_0x6280('0x3d')]})[_0x6280('0x27')](function(_0x2face0){_0x183ee1[_0x6280('0x42')]=_0x2face0;if(_0x43c3ec['query']['includeAll']){_0x2d4fbc[_0x6280('0x43')]=[{'all':!![]}];}return db[_0x6280('0x52')][_0x6280('0x44')](_0x2d4fbc);})['then'](function(_0x178955){_0x183ee1[_0x6280('0x45')]=_0x178955;return _0x183ee1;});}})[_0x6280('0x27')](respondWithFilteredResult(_0x588088,_0x2d4fbc))[_0x6280('0x46')](handleError(_0x588088,null));}; \ No newline at end of file +var _0x6d31=['apply','reject','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','catch','create','body','find','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0x6d31,0x110));var _0x16d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d31[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16d3('0x0'));var zipdir=require(_0x16d3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d3('0x2'));var moment=require(_0x16d3('0x3'));var BPromise=require(_0x16d3('0x4'));var Mustache=require(_0x16d3('0x5'));var util=require('util');var path=require(_0x16d3('0x6'));var sox=require('sox');var csv=require(_0x16d3('0x7'));var ejs=require(_0x16d3('0x8'));var fs=require('fs');var fs_extra=require(_0x16d3('0x9'));var _=require(_0x16d3('0xa'));var squel=require('squel');var crypto=require(_0x16d3('0xb'));var jsforce=require('jsforce');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(_0x16d3('0xc'));var qs=require(_0x16d3('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16d3('0xe'));var logger=require('../../config/logger')(_0x16d3('0xf'));var utils=require(_0x16d3('0x10'));var config=require(_0x16d3('0x11'));var licenseUtil=require(_0x16d3('0x12'));var db=require(_0x16d3('0x13'))['db'];function respondWithStatusCode(_0x1abcea,_0x34e481){_0x34e481=_0x34e481||0xcc;return function(_0x2d9acb){if(_0x2d9acb){return _0x1abcea['sendStatus'](_0x34e481);}return _0x1abcea[_0x16d3('0x14')](_0x34e481)[_0x16d3('0x15')]();};}function respondWithResult(_0x27a74f,_0x5b46d3){_0x5b46d3=_0x5b46d3||0xc8;return function(_0x5555d1){if(_0x5555d1){return _0x27a74f[_0x16d3('0x14')](_0x5b46d3)[_0x16d3('0x16')](_0x5555d1);}};}function respondWithFilteredResult(_0x12382f,_0x22dd77){return function(_0x9ad27a){if(_0x9ad27a){var _0x5b8285=typeof _0x22dd77['offset']===_0x16d3('0x17')&&typeof _0x22dd77[_0x16d3('0x18')]===_0x16d3('0x17');var _0x43dd0c=_0x9ad27a[_0x16d3('0x19')];var _0x4b481d=_0x5b8285?0x0:_0x22dd77[_0x16d3('0x1a')];var _0x5375d5=_0x5b8285?_0x9ad27a[_0x16d3('0x19')]:_0x22dd77[_0x16d3('0x1a')]+_0x22dd77[_0x16d3('0x18')];var _0x3d6ffd;if(_0x5375d5>=_0x43dd0c){_0x5375d5=_0x43dd0c;_0x3d6ffd=0xc8;}else{_0x3d6ffd=0xce;}_0x12382f[_0x16d3('0x14')](_0x3d6ffd);return _0x12382f[_0x16d3('0x1b')]('Content-Range',_0x4b481d+'-'+_0x5375d5+'/'+_0x43dd0c)[_0x16d3('0x16')](_0x9ad27a);}return null;};}function patchUpdates(_0x2b6b9e){return function(_0xa61990){try{jsonpatch[_0x16d3('0x1c')](_0xa61990,_0x2b6b9e,!![]);}catch(_0x1b24f7){return BPromise[_0x16d3('0x1d')](_0x1b24f7);}return _0xa61990[_0x16d3('0x1e')]();};}function saveUpdates(_0x26db50,_0x384742){return function(_0x5c3545){if(_0x5c3545){return _0x5c3545[_0x16d3('0x1f')](_0x26db50)['then'](function(_0x2cca78){return _0x2cca78;});}return null;};}function removeEntity(_0x4723f0,_0x43fa22){return function(_0x5957e0){if(_0x5957e0){return _0x5957e0['destroy']()[_0x16d3('0x20')](function(){_0x4723f0[_0x16d3('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14bf1f,_0x900cca){return function(_0x54139d){if(!_0x54139d){_0x14bf1f['sendStatus'](0x194);}return _0x54139d;};}function handleError(_0x18e179,_0x33736b){_0x33736b=_0x33736b||0x1f4;return function(_0x1fef77){logger[_0x16d3('0x21')](_0x1fef77[_0x16d3('0x22')]);if(_0x1fef77[_0x16d3('0x23')]){delete _0x1fef77[_0x16d3('0x23')];}_0x18e179[_0x16d3('0x14')](_0x33736b)[_0x16d3('0x24')](_0x1fef77);};}exports[_0x16d3('0x25')]=function(_0x241509,_0x2d783d){var _0x5c28e0={},_0xe0716c={},_0x19b132={'count':0x0,'rows':[]};var _0x1bb01a=_[_0x16d3('0x26')](db[_0x16d3('0x27')][_0x16d3('0x28')],function(_0x4004f9){return{'name':_0x4004f9['fieldName'],'type':_0x4004f9[_0x16d3('0x29')]['key']};});_0xe0716c[_0x16d3('0x2a')]=_[_0x16d3('0x26')](_0x1bb01a,_0x16d3('0x23'));_0xe0716c[_0x16d3('0x2b')]=_[_0x16d3('0x2c')](_0x241509[_0x16d3('0x2b')]);_0xe0716c[_0x16d3('0x2d')]=_['intersection'](_0xe0716c[_0x16d3('0x2a')],_0xe0716c[_0x16d3('0x2b')]);_0x5c28e0['attributes']=_[_0x16d3('0x2e')](_0xe0716c[_0x16d3('0x2a')],qs[_0x16d3('0x2f')](_0x241509[_0x16d3('0x2b')][_0x16d3('0x2f')]));_0x5c28e0[_0x16d3('0x30')]=_0x5c28e0[_0x16d3('0x30')]['length']?_0x5c28e0['attributes']:_0xe0716c[_0x16d3('0x2a')];if(!_0x241509[_0x16d3('0x2b')][_0x16d3('0x31')](_0x16d3('0x32'))){_0x5c28e0['limit']=qs[_0x16d3('0x18')](_0x241509[_0x16d3('0x2b')][_0x16d3('0x18')]);_0x5c28e0['offset']=qs[_0x16d3('0x1a')](_0x241509[_0x16d3('0x2b')]['offset']);}_0x5c28e0[_0x16d3('0x33')]=qs[_0x16d3('0x34')](_0x241509[_0x16d3('0x2b')][_0x16d3('0x34')]);_0x5c28e0[_0x16d3('0x35')]=qs[_0x16d3('0x2d')](_['pick'](_0x241509[_0x16d3('0x2b')],_0xe0716c['filters']),_0x1bb01a);if(_0x241509[_0x16d3('0x2b')][_0x16d3('0x36')]){_0x5c28e0[_0x16d3('0x35')]=_[_0x16d3('0x37')](_0x5c28e0['where'],{'$or':_[_0x16d3('0x26')](_0x1bb01a,function(_0x29f53c){if(_0x29f53c[_0x16d3('0x29')]!==_0x16d3('0x38')){var _0x511cf6={};_0x511cf6[_0x29f53c[_0x16d3('0x23')]]={'$like':'%'+_0x241509[_0x16d3('0x2b')][_0x16d3('0x36')]+'%'};return _0x511cf6;}})});}_0x5c28e0=_[_0x16d3('0x37')]({},_0x5c28e0,_0x241509[_0x16d3('0x39')]);var _0x2ba73c={'where':_0x5c28e0[_0x16d3('0x35')]};return db['JscriptySessionReport'][_0x16d3('0x19')](_0x2ba73c)[_0x16d3('0x20')](function(_0x56be33){_0x19b132[_0x16d3('0x19')]=_0x56be33;if(_0x241509['query'][_0x16d3('0x3a')]){_0x5c28e0[_0x16d3('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x16d3('0x3c')](_0x5c28e0);})[_0x16d3('0x20')](function(_0x921527){_0x19b132[_0x16d3('0x3d')]=_0x921527;return _0x19b132;})[_0x16d3('0x20')](respondWithFilteredResult(_0x2d783d,_0x5c28e0))['catch'](handleError(_0x2d783d,null));};exports[_0x16d3('0x3e')]=function(_0x1801bc,_0x5d354a){var _0x3ba002={'raw':!![],'where':{'id':_0x1801bc[_0x16d3('0x3f')]['id']}},_0xef413c={};_0xef413c[_0x16d3('0x2a')]=_[_0x16d3('0x2c')](db[_0x16d3('0x27')][_0x16d3('0x28')]);_0xef413c[_0x16d3('0x2b')]=_[_0x16d3('0x2c')](_0x1801bc[_0x16d3('0x2b')]);_0xef413c[_0x16d3('0x2d')]=_[_0x16d3('0x2e')](_0xef413c['model'],_0xef413c[_0x16d3('0x2b')]);_0x3ba002[_0x16d3('0x30')]=_[_0x16d3('0x2e')](_0xef413c[_0x16d3('0x2a')],qs[_0x16d3('0x2f')](_0x1801bc[_0x16d3('0x2b')][_0x16d3('0x2f')]));_0x3ba002['attributes']=_0x3ba002['attributes'][_0x16d3('0x40')]?_0x3ba002['attributes']:_0xef413c[_0x16d3('0x2a')];if(_0x1801bc[_0x16d3('0x2b')][_0x16d3('0x3a')]){_0x3ba002[_0x16d3('0x3b')]=[{'all':!![]}];}_0x3ba002=_[_0x16d3('0x37')]({},_0x3ba002,_0x1801bc['options']);return db[_0x16d3('0x27')]['find'](_0x3ba002)[_0x16d3('0x20')](handleEntityNotFound(_0x5d354a,null))['then'](respondWithResult(_0x5d354a,null))[_0x16d3('0x41')](handleError(_0x5d354a,null));};exports[_0x16d3('0x42')]=function(_0x79e210,_0xc584b0){return db[_0x16d3('0x27')][_0x16d3('0x42')](_0x79e210[_0x16d3('0x43')],{})[_0x16d3('0x20')](respondWithResult(_0xc584b0,0xc9))[_0x16d3('0x41')](handleError(_0xc584b0,null));};exports['update']=function(_0x2df9f1,_0xca1829){if(_0x2df9f1[_0x16d3('0x43')]['id']){delete _0x2df9f1[_0x16d3('0x43')]['id'];}return db['JscriptySessionReport'][_0x16d3('0x44')]({'where':{'id':_0x2df9f1['params']['id']}})[_0x16d3('0x20')](handleEntityNotFound(_0xca1829,null))['then'](saveUpdates(_0x2df9f1[_0x16d3('0x43')],null))[_0x16d3('0x20')](respondWithResult(_0xca1829,null))['catch'](handleError(_0xca1829,null));};exports['destroy']=function(_0x4500cd,_0x259008){return db['JscriptySessionReport'][_0x16d3('0x44')]({'where':{'id':_0x4500cd[_0x16d3('0x3f')]['id']}})[_0x16d3('0x20')](handleEntityNotFound(_0x259008,null))[_0x16d3('0x20')](removeEntity(_0x259008,null))['catch'](handleError(_0x259008,null));};exports[_0x16d3('0x45')]=function(_0x1b8574,_0x12616b){return db[_0x16d3('0x27')]['describe']()[_0x16d3('0x20')](respondWithResult(_0x12616b,null))['catch'](handleError(_0x12616b,null));};exports[_0x16d3('0x46')]=function(_0xeebcd0,_0x426860,_0xbd1bf4){var _0x152063={'raw':!![],'where':{}};var _0x597ecb={};var _0x5272a7={'count':0x0,'rows':[]};return db[_0x16d3('0x27')][_0x16d3('0x47')]({'where':{'id':_0xeebcd0[_0x16d3('0x3f')]['id']}})[_0x16d3('0x20')](handleEntityNotFound(_0x426860,null))[_0x16d3('0x20')](function(_0x38f468){if(_0x38f468){_0x597ecb['model']=_[_0x16d3('0x2c')](db['JscriptyQuestionReport'][_0x16d3('0x28')]);_0x597ecb['query']=_[_0x16d3('0x2c')](_0xeebcd0[_0x16d3('0x2b')]);_0x597ecb[_0x16d3('0x2d')]=_['intersection'](_0x597ecb[_0x16d3('0x2a')],_0x597ecb['query']);_0x152063[_0x16d3('0x30')]=_['intersection'](_0x597ecb['model'],qs[_0x16d3('0x2f')](_0xeebcd0['query'][_0x16d3('0x2f')]));_0x152063[_0x16d3('0x30')]=_0x152063['attributes'][_0x16d3('0x40')]?_0x152063[_0x16d3('0x30')]:_0x597ecb[_0x16d3('0x2a')];if(!_0xeebcd0[_0x16d3('0x2b')][_0x16d3('0x31')](_0x16d3('0x32'))){_0x152063[_0x16d3('0x18')]=qs[_0x16d3('0x18')](_0xeebcd0[_0x16d3('0x2b')][_0x16d3('0x18')]);_0x152063[_0x16d3('0x1a')]=qs[_0x16d3('0x1a')](_0xeebcd0['query']['offset']);}_0x152063[_0x16d3('0x33')]=qs['sort'](_0xeebcd0[_0x16d3('0x2b')][_0x16d3('0x34')]);_0x152063['where']=qs[_0x16d3('0x2d')](_[_0x16d3('0x48')](_0xeebcd0[_0x16d3('0x2b')],_0x597ecb['filters']));_0x152063[_0x16d3('0x35')][_0x16d3('0x49')]=_0x38f468['id'];if(_0xeebcd0['query'][_0x16d3('0x36')]){_0x152063[_0x16d3('0x35')]=_[_0x16d3('0x37')](_0x152063[_0x16d3('0x35')],{'$or':_[_0x16d3('0x26')](_0x152063[_0x16d3('0x30')],function(_0x59ea67){var _0xb24ba3={};_0xb24ba3[_0x59ea67]={'$like':'%'+_0xeebcd0[_0x16d3('0x2b')]['filter']+'%'};return _0xb24ba3;})});}_0x152063=_['merge']({},_0x152063,_0xeebcd0[_0x16d3('0x39')]);return db[_0x16d3('0x4a')][_0x16d3('0x19')]({'where':_0x152063[_0x16d3('0x35')]})['then'](function(_0xb1e65e){_0x5272a7['count']=_0xb1e65e;if(_0xeebcd0[_0x16d3('0x2b')][_0x16d3('0x3a')]){_0x152063['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x16d3('0x3c')](_0x152063);})[_0x16d3('0x20')](function(_0x1a8fda){_0x5272a7['rows']=_0x1a8fda;return _0x5272a7;});}})[_0x16d3('0x20')](respondWithFilteredResult(_0x426860,_0x152063))['catch'](handleError(_0x426860,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 52e7b83..57ffae7 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 _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x4b3f3e,_0x47dfcc){_0x4b3f3e=_0x4b3f3e-0x0;var _0x921fc3=_0xfdbd[_0x4b3f3e];return _0x921fc3;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2ef237,_0x355cdf){var _0x31865e=function(_0x21abf9){while(--_0x21abf9){_0x2ef237['push'](_0x2ef237['shift']());}};_0x31865e(++_0x355cdf);}(_0x7046,0x144));var _0x6704=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7046[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 8f4debb..5df77f2 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xd2f9b5,_0x235231){var _0x161a92=function(_0x3d85ab){while(--_0x3d85ab){_0xd2f9b5['push'](_0xd2f9b5['shift']());}};_0x161a92(++_0x235231);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x82c4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1af1e1,_0x37bc24){var _0x5f3450=function(_0x1dc6fd){while(--_0x1dc6fd){_0x1af1e1['push'](_0x1af1e1['shift']());}};_0x5f3450(++_0x37bc24);}(_0x82c4,0x1ca));var _0x482c=function(_0x4ffe5f,_0xbb38e9){_0x4ffe5f=_0x4ffe5f-0x0;var _0x5792e8=_0x82c4[_0x4ffe5f];return _0x5792e8;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index bc9a12a..1c23617 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 _0x9ac5=['/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','update'];(function(_0x5f1c93,_0x49305e){var _0x109137=function(_0x1ca1eb){while(--_0x1ca1eb){_0x5f1c93['push'](_0x5f1c93['shift']());}};_0x109137(++_0x49305e);}(_0x9ac5,0x16b));var _0x59ac=function(_0x290074,_0x271e7c){_0x290074=_0x290074-0x0;var _0x561898=_0x9ac5[_0x290074];return _0x561898;};'use strict';var multer=require(_0x59ac('0x0'));var util=require(_0x59ac('0x1'));var path=require(_0x59ac('0x2'));var timeout=require(_0x59ac('0x3'));var express=require(_0x59ac('0x4'));var router=express['Router']();var fs_extra=require(_0x59ac('0x5'));var auth=require(_0x59ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x59ac('0x7'));var controller=require('./license.controller');router[_0x59ac('0x8')]('/',controller[_0x59ac('0x9')]);router['put']('/:id',auth[_0x59ac('0xa')](),controller[_0x59ac('0xb')]);router[_0x59ac('0x8')](_0x59ac('0xc'),auth[_0x59ac('0xa')](),controller[_0x59ac('0xd')]);module[_0x59ac('0xe')]=router; \ No newline at end of file +var _0xf016=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','update','get','/download_log_file','isAuthenticated','downloadLogFile','util'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xf016,0xdf));var _0x6f01=function(_0x33402a,_0x3a90c3){_0x33402a=_0x33402a-0x0;var _0x535f50=_0xf016[_0x33402a];return _0x535f50;};'use strict';var multer=require('multer');var util=require(_0x6f01('0x0'));var path=require(_0x6f01('0x1'));var timeout=require(_0x6f01('0x2'));var express=require(_0x6f01('0x3'));var router=express[_0x6f01('0x4')]();var fs_extra=require(_0x6f01('0x5'));var auth=require(_0x6f01('0x6'));var interaction=require(_0x6f01('0x7'));var config=require(_0x6f01('0x8'));var controller=require('./license.controller');router['get']('/',controller[_0x6f01('0x9')]);router[_0x6f01('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6f01('0xb')]);router[_0x6f01('0xc')](_0x6f01('0xd'),auth[_0x6f01('0xe')](),controller[_0x6f01('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 88d0c30..6141f46 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 _0x17cd=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x17cd,0x106));var _0xd17c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x17cd[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xd17c('0x0'));module[_0xd17c('0x1')]={'license':{'type':Sequelize[_0xd17c('0x2')]},'data1':{'type':Sequelize[_0xd17c('0x3')]},'data2':{'type':Sequelize[_0xd17c('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xd17c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf2b3=['sequelize','STRING','INTEGER'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf2b3,0x165));var _0x3f2b=function(_0xae122b,_0xbd693b){_0xae122b=_0xae122b-0x0;var _0x3b1a6b=_0xf2b3[_0xae122b];return _0x3b1a6b;};'use strict';var Sequelize=require(_0x3f2b('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x3f2b('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x3f2b('0x2')],'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 23fa8de..1e44a06 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 _0xdea3=['keys','rawAttributes','query','filters','attributes','intersection','fields','length','merge','options','getLicense','body','License','find','get','key','demo','catch','downloadLogFile','license-info.log','join','xcally','Content-disposition','attachment;\x20filename=','text/plain','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','sendStatus','error','stack','name','send','index','model'];(function(_0x12630e,_0x58cce6){var _0x1a8d08=function(_0x1e5998){while(--_0x1e5998){_0x12630e['push'](_0x12630e['shift']());}};_0x1a8d08(++_0x58cce6);}(_0xdea3,0xa1));var _0x3dea=function(_0x41e0e5,_0x4762f7){_0x41e0e5=_0x41e0e5-0x0;var _0x2752c8=_0xdea3[_0x41e0e5];return _0x2752c8;};'use strict';var emlformat=require(_0x3dea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3dea('0x1'));var rp=require(_0x3dea('0x2'));var moment=require('moment');var BPromise=require(_0x3dea('0x3'));var Mustache=require(_0x3dea('0x4'));var util=require(_0x3dea('0x5'));var path=require('path');var sox=require(_0x3dea('0x6'));var csv=require(_0x3dea('0x7'));var ejs=require(_0x3dea('0x8'));var fs=require('fs');var fs_extra=require(_0x3dea('0x9'));var _=require(_0x3dea('0xa'));var squel=require(_0x3dea('0xb'));var crypto=require('crypto');var jsforce=require(_0x3dea('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3dea('0x7'));var querystring=require(_0x3dea('0xd'));var Papa=require(_0x3dea('0xe'));var Redis=require(_0x3dea('0xf'));var authService=require(_0x3dea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3dea('0x11'));var hardwareService=require(_0x3dea('0x12'));var logger=require(_0x3dea('0x13'))(_0x3dea('0x14'));var utils=require(_0x3dea('0x15'));var config=require(_0x3dea('0x16'));var licenseUtil=require(_0x3dea('0x17'));var db=require(_0x3dea('0x18'))['db'];function respondWithStatusCode(_0x1e75d0,_0x5480e1){_0x5480e1=_0x5480e1||0xcc;return function(_0x318fd0){if(_0x318fd0){return _0x1e75d0['sendStatus'](_0x5480e1);}return _0x1e75d0[_0x3dea('0x19')](_0x5480e1)[_0x3dea('0x1a')]();};}function respondWithResult(_0x172d88,_0x7fcf21){_0x7fcf21=_0x7fcf21||0xc8;return function(_0x4d8a19){if(_0x4d8a19){return _0x172d88[_0x3dea('0x19')](_0x7fcf21)[_0x3dea('0x1b')](_0x4d8a19);}};}function respondWithFilteredResult(_0x1680eb,_0x5e5c9e){return function(_0x21719e){if(_0x21719e){var _0x112c36=typeof _0x5e5c9e[_0x3dea('0x1c')]===_0x3dea('0x1d')&&typeof _0x5e5c9e['limit']===_0x3dea('0x1d');var _0x12d313=_0x21719e[_0x3dea('0x1e')];var _0x4425b9=_0x112c36?0x0:_0x5e5c9e[_0x3dea('0x1c')];var _0x17d919=_0x112c36?_0x21719e['count']:_0x5e5c9e[_0x3dea('0x1c')]+_0x5e5c9e[_0x3dea('0x1f')];var _0x51d6f0;if(_0x17d919>=_0x12d313){_0x17d919=_0x12d313;_0x51d6f0=0xc8;}else{_0x51d6f0=0xce;}_0x1680eb['status'](_0x51d6f0);return _0x1680eb[_0x3dea('0x20')](_0x3dea('0x21'),_0x4425b9+'-'+_0x17d919+'/'+_0x12d313)[_0x3dea('0x1b')](_0x21719e);}return null;};}function patchUpdates(_0x3b2f81){return function(_0x3ad6fc){try{jsonpatch[_0x3dea('0x22')](_0x3ad6fc,_0x3b2f81,!![]);}catch(_0x4fa15c){return BPromise['reject'](_0x4fa15c);}return _0x3ad6fc['save']();};}function saveUpdates(_0x4df376,_0x580da0){return function(_0x54d361){if(_0x54d361){return _0x54d361['update'](_0x4df376)['then'](function(_0x1b2e46){return _0x1b2e46;});}return null;};}function removeEntity(_0xcb2159,_0x433bdb){return function(_0x4703f8){if(_0x4703f8){return _0x4703f8['destroy']()[_0x3dea('0x23')](function(){_0xcb2159[_0x3dea('0x19')](0xcc)[_0x3dea('0x1a')]();});}};}function handleEntityNotFound(_0x265e28,_0x269529){return function(_0x3f6aab){if(!_0x3f6aab){_0x265e28[_0x3dea('0x24')](0x194);}return _0x3f6aab;};}function handleError(_0x5571d3,_0x485737){_0x485737=_0x485737||0x1f4;return function(_0x57a171){logger[_0x3dea('0x25')](_0x57a171[_0x3dea('0x26')]);if(_0x57a171[_0x3dea('0x27')]){delete _0x57a171[_0x3dea('0x27')];}_0x5571d3[_0x3dea('0x19')](_0x485737)[_0x3dea('0x28')](_0x57a171);};}var utilLicense=require(_0x3dea('0x17'));exports[_0x3dea('0x29')]=function(_0x4f2320,_0x178a7d){var _0xe09e4a={'raw':!![],'where':{'id':0x1}},_0x4971={};_0x4971[_0x3dea('0x2a')]=_[_0x3dea('0x2b')](db['License'][_0x3dea('0x2c')]);_0x4971[_0x3dea('0x2d')]=_[_0x3dea('0x2b')](_0x4f2320['query']);_0x4971[_0x3dea('0x2e')]=_['intersection'](_0x4971['model'],_0x4971[_0x3dea('0x2d')]);_0xe09e4a[_0x3dea('0x2f')]=_[_0x3dea('0x30')](_0x4971[_0x3dea('0x2a')],qs['fields'](_0x4f2320['query'][_0x3dea('0x31')]));_0xe09e4a[_0x3dea('0x2f')]=_0xe09e4a['attributes'][_0x3dea('0x32')]?_0xe09e4a[_0x3dea('0x2f')]:_0x4971[_0x3dea('0x2a')];_0xe09e4a=_[_0x3dea('0x33')]({},_0xe09e4a,_0x4f2320[_0x3dea('0x34')]);return utilLicense[_0x3dea('0x35')](_0xe09e4a)['then'](respondWithResult(_0x178a7d,null))['catch'](handleError(_0x178a7d,null));};exports['update']=function(_0x189dac,_0x1f5056){if(_0x189dac['body']['id']){delete _0x189dac[_0x3dea('0x36')]['id'];}return db[_0x3dea('0x37')][_0x3dea('0x38')]({'where':{'id':_0x189dac['params']['id']}})[_0x3dea('0x23')](handleEntityNotFound(_0x1f5056,null))['then'](function(_0x309b6b){var _0xd450fc=_0x309b6b[_0x3dea('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0xd450fc,_0x189dac[_0x3dea('0x36')][_0x3dea('0x3a')]);})[_0x3dea('0x23')](function(_0x4bf6f5){if(!_0x4bf6f5[_0x3dea('0x3b')]){return saveUpdates(_0x189dac[_0x3dea('0x36')],null);}return _0x4bf6f5;})[_0x3dea('0x23')](respondWithResult(_0x1f5056,null))[_0x3dea('0x3c')](handleError(_0x1f5056,null));};exports[_0x3dea('0x3d')]=function(_0x2b9f6a,_0x12a03b){var _0x6ca9a7=_0x3dea('0x3e');var _0x22a007=path[_0x3dea('0x3f')]('/var','log',_0x3dea('0x40'),_0x6ca9a7);_0x12a03b['setHeader'](_0x3dea('0x41'),_0x3dea('0x42')+_0x6ca9a7);_0x12a03b[_0x3dea('0x20')]('Content-Type',_0x3dea('0x43'));_0x12a03b['download'](_0x22a007);}; \ No newline at end of file +var _0x1204=['Content-Range','apply','reject','update','destroy','then','error','stack','name','../../config/license/util','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','find','params','get','checkLicense','body','key','catch','license-info.log','join','/var','log','setHeader','attachment;\x20filename=','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1204,0x1b5));var _0x4120=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1204[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4120('0x0'));var rimraf=require(_0x4120('0x1'));var zipdir=require(_0x4120('0x2'));var jsonpatch=require(_0x4120('0x3'));var rp=require('request-promise');var moment=require(_0x4120('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4120('0x5'));var util=require('util');var path=require(_0x4120('0x6'));var sox=require(_0x4120('0x7'));var csv=require(_0x4120('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4120('0x9'));var _=require('lodash');var squel=require(_0x4120('0xa'));var crypto=require(_0x4120('0xb'));var jsforce=require(_0x4120('0xc'));var deskjs=require(_0x4120('0xd'));var toCsv=require(_0x4120('0x8'));var querystring=require('querystring');var Papa=require(_0x4120('0xe'));var Redis=require(_0x4120('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4120('0x10'));var as=require(_0x4120('0x11'));var hardwareService=require(_0x4120('0x12'));var logger=require(_0x4120('0x13'))(_0x4120('0x14'));var utils=require(_0x4120('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4120('0x16'))['db'];function respondWithStatusCode(_0x2c00f4,_0x5cc110){_0x5cc110=_0x5cc110||0xcc;return function(_0x5ba9c8){if(_0x5ba9c8){return _0x2c00f4[_0x4120('0x17')](_0x5cc110);}return _0x2c00f4[_0x4120('0x18')](_0x5cc110)[_0x4120('0x19')]();};}function respondWithResult(_0x33afa4,_0x187965){_0x187965=_0x187965||0xc8;return function(_0x41c291){if(_0x41c291){return _0x33afa4[_0x4120('0x18')](_0x187965)[_0x4120('0x1a')](_0x41c291);}};}function respondWithFilteredResult(_0xb419e8,_0x4d6377){return function(_0x1e786b){if(_0x1e786b){var _0x44db4e=typeof _0x4d6377['offset']===_0x4120('0x1b')&&typeof _0x4d6377['limit']===_0x4120('0x1b');var _0x460d9c=_0x1e786b[_0x4120('0x1c')];var _0x4ab1e5=_0x44db4e?0x0:_0x4d6377[_0x4120('0x1d')];var _0x27f015=_0x44db4e?_0x1e786b[_0x4120('0x1c')]:_0x4d6377[_0x4120('0x1d')]+_0x4d6377[_0x4120('0x1e')];var _0x4f4339;if(_0x27f015>=_0x460d9c){_0x27f015=_0x460d9c;_0x4f4339=0xc8;}else{_0x4f4339=0xce;}_0xb419e8[_0x4120('0x18')](_0x4f4339);return _0xb419e8[_0x4120('0x1f')](_0x4120('0x20'),_0x4ab1e5+'-'+_0x27f015+'/'+_0x460d9c)[_0x4120('0x1a')](_0x1e786b);}return null;};}function patchUpdates(_0x4291ce){return function(_0x282bd3){try{jsonpatch[_0x4120('0x21')](_0x282bd3,_0x4291ce,!![]);}catch(_0x1ac6a3){return BPromise[_0x4120('0x22')](_0x1ac6a3);}return _0x282bd3['save']();};}function saveUpdates(_0x3b2bad,_0x1b7177){return function(_0x57e532){if(_0x57e532){return _0x57e532[_0x4120('0x23')](_0x3b2bad)['then'](function(_0x1f09c3){return _0x1f09c3;});}return null;};}function removeEntity(_0x3a8db5,_0x51e232){return function(_0x17b9f2){if(_0x17b9f2){return _0x17b9f2[_0x4120('0x24')]()[_0x4120('0x25')](function(){_0x3a8db5[_0x4120('0x18')](0xcc)[_0x4120('0x19')]();});}};}function handleEntityNotFound(_0x3cdc5f,_0x47c32a){return function(_0x361117){if(!_0x361117){_0x3cdc5f['sendStatus'](0x194);}return _0x361117;};}function handleError(_0xc284be,_0x3c6a40){_0x3c6a40=_0x3c6a40||0x1f4;return function(_0x2ccaf1){logger[_0x4120('0x26')](_0x2ccaf1[_0x4120('0x27')]);if(_0x2ccaf1[_0x4120('0x28')]){delete _0x2ccaf1[_0x4120('0x28')];}_0xc284be[_0x4120('0x18')](_0x3c6a40)['send'](_0x2ccaf1);};}var utilLicense=require(_0x4120('0x29'));exports['index']=function(_0x36a641,_0x1874c1){var _0x31f348={'raw':!![],'where':{'id':0x1}},_0x8056ba={};_0x8056ba[_0x4120('0x2a')]=_[_0x4120('0x2b')](db[_0x4120('0x2c')][_0x4120('0x2d')]);_0x8056ba['query']=_[_0x4120('0x2b')](_0x36a641[_0x4120('0x2e')]);_0x8056ba['filters']=_[_0x4120('0x2f')](_0x8056ba[_0x4120('0x2a')],_0x8056ba[_0x4120('0x2e')]);_0x31f348[_0x4120('0x30')]=_['intersection'](_0x8056ba[_0x4120('0x2a')],qs[_0x4120('0x31')](_0x36a641['query'][_0x4120('0x31')]));_0x31f348['attributes']=_0x31f348[_0x4120('0x30')]['length']?_0x31f348[_0x4120('0x30')]:_0x8056ba[_0x4120('0x2a')];_0x31f348=_[_0x4120('0x32')]({},_0x31f348,_0x36a641['options']);return utilLicense[_0x4120('0x33')](_0x31f348)[_0x4120('0x25')](respondWithResult(_0x1874c1,null))['catch'](handleError(_0x1874c1,null));};exports['update']=function(_0x11eb81,_0x159812){if(_0x11eb81['body']['id']){delete _0x11eb81['body']['id'];}return db['License'][_0x4120('0x34')]({'where':{'id':_0x11eb81[_0x4120('0x35')]['id']}})[_0x4120('0x25')](handleEntityNotFound(_0x159812,null))['then'](function(_0x111dde){var _0x3e3976=_0x111dde[_0x4120('0x36')]({'plain':!![]});return utilLicense[_0x4120('0x37')](_0x3e3976,_0x11eb81[_0x4120('0x38')][_0x4120('0x39')]);})['then'](function(_0x4de3b5){if(!_0x4de3b5['demo']){return saveUpdates(_0x11eb81[_0x4120('0x38')],null);}return _0x4de3b5;})[_0x4120('0x25')](respondWithResult(_0x159812,null))[_0x4120('0x3a')](handleError(_0x159812,null));};exports['downloadLogFile']=function(_0x3f81a1,_0x4f90b1){var _0x482307=_0x4120('0x3b');var _0x151cc9=path[_0x4120('0x3c')](_0x4120('0x3d'),_0x4120('0x3e'),'xcally',_0x482307);_0x4f90b1[_0x4120('0x3f')]('Content-disposition',_0x4120('0x40')+_0x482307);_0x4f90b1[_0x4120('0x1f')]('Content-Type',_0x4120('0x41'));_0x4f90b1[_0x4120('0x42')](_0x151cc9);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d22ddb6..95a1574 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 _0xc4dc=['path','rimraf','./license.attributes','define','License','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x28bdb5,_0x908235){var _0x2e5335=function(_0x4917ac){while(--_0x4917ac){_0x28bdb5['push'](_0x28bdb5['shift']());}};_0x2e5335(++_0x908235);}(_0xc4dc,0x19c));var _0xcc4d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc4dc[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xcc4d('0x0'));var util=require('util');var logger=require(_0xcc4d('0x1'))(_0xcc4d('0x2'));var moment=require(_0xcc4d('0x3'));var BPromise=require(_0xcc4d('0x4'));var rp=require(_0xcc4d('0x5'));var fs=require('fs');var path=require(_0xcc4d('0x6'));var rimraf=require(_0xcc4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc4d('0x8'));module['exports']=function(_0x26e88f,_0x41f214){return _0x26e88f[_0xcc4d('0x9')](_0xcc4d('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dce=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','license','lodash','util'];(function(_0x54503b,_0x127702){var _0x530910=function(_0x2721e0){while(--_0x2721e0){_0x54503b['push'](_0x54503b['shift']());}};_0x530910(++_0x127702);}(_0x3dce,0xc4));var _0xe3dc=function(_0x3e0839,_0x569998){_0x3e0839=_0x3e0839-0x0;var _0x5abd75=_0x3dce[_0x3e0839];return _0x5abd75;};'use strict';var _=require(_0xe3dc('0x0'));var util=require(_0xe3dc('0x1'));var logger=require(_0xe3dc('0x2'))(_0xe3dc('0x3'));var moment=require(_0xe3dc('0x4'));var BPromise=require(_0xe3dc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3dc('0x6'));var rimraf=require('rimraf');var config=require(_0xe3dc('0x7'));var attributes=require('./license.attributes');module[_0xe3dc('0x8')]=function(_0x267ff0,_0x293a87){return _0x267ff0[_0xe3dc('0x9')]('License',attributes,{'tableName':_0xe3dc('0xa'),'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 7e32a4e..e126415 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 _0x2104=['http','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x2104,0x11b));var _0x4210=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x2104[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x4210('0x0'));var util=require(_0x4210('0x1'));var moment=require(_0x4210('0x2'));var BPromise=require(_0x4210('0x3'));var rs=require(_0x4210('0x4'));var fs=require('fs');var Redis=require(_0x4210('0x5'));var db=require(_0x4210('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4210('0x7'));var config=require(_0x4210('0x8'));var jayson=require(_0x4210('0x9'));var client=jayson[_0x4210('0xa')][_0x4210('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5609ff,_0x34c50d,_0x47abc2){return new BPromise(function(_0x56388e,_0x423460){return client['request'](_0x5609ff,_0x47abc2)['then'](function(_0x5db05f){logger[_0x4210('0xc')]('License,\x20%s,\x20%s',_0x34c50d,_0x4210('0xd'));logger[_0x4210('0xe')](_0x4210('0xf'),_0x34c50d,'request\x20sent',JSON['stringify'](_0x5db05f));if(_0x5db05f['error']){if(_0x5db05f[_0x4210('0x10')][_0x4210('0x11')]===0x1f4){logger[_0x4210('0x10')](_0x4210('0x12'),_0x34c50d,_0x5db05f['error'][_0x4210('0x13')]);return _0x423460(_0x5db05f[_0x4210('0x10')]['message']);}logger[_0x4210('0x10')]('License,\x20%s,\x20%s',_0x34c50d,_0x5db05f[_0x4210('0x10')][_0x4210('0x13')]);return _0x56388e(_0x5db05f[_0x4210('0x10')][_0x4210('0x13')]);}else{logger[_0x4210('0xc')](_0x4210('0x12'),_0x34c50d,'request\x20sent');_0x56388e(_0x5db05f[_0x4210('0x14')][_0x4210('0x13')]);}})['catch'](function(_0x4650fb){logger[_0x4210('0x10')](_0x4210('0x12'),_0x34c50d,_0x4650fb);_0x423460(_0x4650fb);});});} \ No newline at end of file +var _0xb4f8=['error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','License,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51f864,_0x373f1b){var _0x4c1f57=function(_0x21929f){while(--_0x21929f){_0x51f864['push'](_0x51f864['shift']());}};_0x4c1f57(++_0x373f1b);}(_0xb4f8,0x1cb));var _0x8b4f=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xb4f8[_0x5ac1e5];return _0x1bccc6;};'use strict';var _=require('lodash');var util=require(_0x8b4f('0x0'));var moment=require(_0x8b4f('0x1'));var BPromise=require(_0x8b4f('0x2'));var rs=require(_0x8b4f('0x3'));var fs=require('fs');var Redis=require(_0x8b4f('0x4'));var db=require(_0x8b4f('0x5'))['db'];var utils=require(_0x8b4f('0x6'));var logger=require(_0x8b4f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b4f('0x8'));var client=jayson[_0x8b4f('0x9')][_0x8b4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c0b2a,_0x2e3769,_0x7f876e){return new BPromise(function(_0x37d6be,_0x353f24){return client['request'](_0x4c0b2a,_0x7f876e)[_0x8b4f('0xb')](function(_0x383f73){logger[_0x8b4f('0xc')](_0x8b4f('0xd'),_0x2e3769,'request\x20sent');logger['debug'](_0x8b4f('0xe'),_0x2e3769,_0x8b4f('0xf'),JSON['stringify'](_0x383f73));if(_0x383f73['error']){if(_0x383f73[_0x8b4f('0x10')]['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x2e3769,_0x383f73['error'][_0x8b4f('0x11')]);return _0x353f24(_0x383f73[_0x8b4f('0x10')][_0x8b4f('0x11')]);}logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x2e3769,_0x383f73['error'][_0x8b4f('0x11')]);return _0x37d6be(_0x383f73['error'][_0x8b4f('0x11')]);}else{logger[_0x8b4f('0xc')]('License,\x20%s,\x20%s',_0x2e3769,_0x8b4f('0xf'));_0x37d6be(_0x383f73[_0x8b4f('0x12')][_0x8b4f('0x11')]);}})['catch'](function(_0x4be56b){logger[_0x8b4f('0x10')](_0x8b4f('0xd'),_0x2e3769,_0x4be56b);_0x353f24(_0x4be56b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1d4ab48..8b43308 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 _0xab80=['getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','addAgents','put','update','delete','removeDispositions','removeAnswers','destroy','removeAgents','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0xab80,0x1ba));var _0x0ab8=function(_0x112701,_0x57249e){_0x112701=_0x112701-0x0;var _0x4d263d=_0xab80[_0x112701];return _0x4d263d;};'use strict';var multer=require(_0x0ab8('0x0'));var util=require(_0x0ab8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ab8('0x2'));var router=express[_0x0ab8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0ab8('0x4'));var interaction=require(_0x0ab8('0x5'));var config=require(_0x0ab8('0x6'));var controller=require(_0x0ab8('0x7'));router[_0x0ab8('0x8')]('/',auth[_0x0ab8('0x9')](),controller[_0x0ab8('0xa')]);router[_0x0ab8('0x8')](_0x0ab8('0xb'),auth['isAuthenticated'](),controller[_0x0ab8('0xc')]);router['get'](_0x0ab8('0xd'),auth['isAuthenticated'](),controller[_0x0ab8('0xe')]);router[_0x0ab8('0x8')](_0x0ab8('0xf'),auth['isAuthenticated'](),controller[_0x0ab8('0x10')]);router['get'](_0x0ab8('0x11'),auth['isAuthenticated'](),controller[_0x0ab8('0x12')]);router[_0x0ab8('0x8')](_0x0ab8('0x13'),auth[_0x0ab8('0x9')](),controller['getImap']);router['get'](_0x0ab8('0x14'),auth[_0x0ab8('0x9')](),controller['getSmtp']);router['get'](_0x0ab8('0x15'),auth['isAuthenticated'](),controller[_0x0ab8('0x16')]);router['get'](_0x0ab8('0x17'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x18')]);router['get'](_0x0ab8('0x19'),auth[_0x0ab8('0x9')](),controller['getMessages']);router[_0x0ab8('0x8')](_0x0ab8('0x1a'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x1b')]);router[_0x0ab8('0x8')](_0x0ab8('0x1c'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x1d')]);router[_0x0ab8('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0ab8('0x1f')]);router[_0x0ab8('0x1e')](_0x0ab8('0x11'),auth['isAuthenticated'](),controller[_0x0ab8('0x20')]);router[_0x0ab8('0x1e')]('/',auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x21')]);router[_0x0ab8('0x1e')](_0x0ab8('0x13'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x22')]);router[_0x0ab8('0x1e')](_0x0ab8('0x14'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x23')]);router[_0x0ab8('0x1e')](_0x0ab8('0x15'),auth[_0x0ab8('0x9')](),controller['addInteraction']);router[_0x0ab8('0x1e')](_0x0ab8('0x17'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x24')]);router[_0x0ab8('0x1e')](_0x0ab8('0x25'),auth[_0x0ab8('0x9')](),controller['send']);router[_0x0ab8('0x1e')](_0x0ab8('0x1c'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x26')]);router[_0x0ab8('0x27')](_0x0ab8('0xd'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x28')]);router[_0x0ab8('0x29')]('/:id/dispositions',auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x2a')]);router[_0x0ab8('0x29')](_0x0ab8('0x11'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x2b')]);router[_0x0ab8('0x29')](_0x0ab8('0x13'),auth[_0x0ab8('0x9')](),controller['removeImap']);router[_0x0ab8('0x29')](_0x0ab8('0x14'),auth[_0x0ab8('0x9')](),controller['removeSmtp']);router[_0x0ab8('0x29')]('/:id',auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x2c')]);router[_0x0ab8('0x29')](_0x0ab8('0x1c'),auth[_0x0ab8('0x9')](),controller[_0x0ab8('0x2d')]);module['exports']=router; \ No newline at end of file +var _0xf318=['delete','removeDispositions','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addAgents','put','update'];(function(_0x48dd9c,_0x48f8b2){var _0x383bbb=function(_0x5a1bd5){while(--_0x5a1bd5){_0x48dd9c['push'](_0x48dd9c['shift']());}};_0x383bbb(++_0x48f8b2);}(_0xf318,0x8f));var _0x8f31=function(_0xfd7055,_0x47e9b4){_0xfd7055=_0xfd7055-0x0;var _0x520c97=_0xf318[_0xfd7055];return _0x520c97;};'use strict';var multer=require(_0x8f31('0x0'));var util=require(_0x8f31('0x1'));var path=require(_0x8f31('0x2'));var timeout=require(_0x8f31('0x3'));var express=require(_0x8f31('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8f31('0x5'));var interaction=require(_0x8f31('0x6'));var config=require(_0x8f31('0x7'));var controller=require('./mailAccount.controller');router[_0x8f31('0x8')]('/',auth[_0x8f31('0x9')](),controller[_0x8f31('0xa')]);router[_0x8f31('0x8')]('/describe',auth[_0x8f31('0x9')](),controller[_0x8f31('0xb')]);router[_0x8f31('0x8')](_0x8f31('0xc'),auth[_0x8f31('0x9')](),controller[_0x8f31('0xd')]);router[_0x8f31('0x8')](_0x8f31('0xe'),auth['isAuthenticated'](),controller[_0x8f31('0xf')]);router['get'](_0x8f31('0x10'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x11')]);router[_0x8f31('0x8')](_0x8f31('0x12'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x13')]);router[_0x8f31('0x8')]('/:id/out_servers',auth[_0x8f31('0x9')](),controller[_0x8f31('0x14')]);router[_0x8f31('0x8')](_0x8f31('0x15'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x16')]);router[_0x8f31('0x8')](_0x8f31('0x17'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x18')]);router['get'](_0x8f31('0x19'),auth['isAuthenticated'](),controller[_0x8f31('0x1a')]);router[_0x8f31('0x8')](_0x8f31('0x1b'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x1c')]);router[_0x8f31('0x8')](_0x8f31('0x1d'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x1e')]);router[_0x8f31('0x1f')](_0x8f31('0xe'),auth['isAuthenticated'](),controller[_0x8f31('0x20')]);router[_0x8f31('0x1f')](_0x8f31('0x10'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x21')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8f31('0x22')]);router[_0x8f31('0x1f')](_0x8f31('0x12'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x23')]);router[_0x8f31('0x1f')]('/:id/out_servers',auth[_0x8f31('0x9')](),controller[_0x8f31('0x24')]);router[_0x8f31('0x1f')]('/:id/interactions',auth[_0x8f31('0x9')](),controller[_0x8f31('0x25')]);router[_0x8f31('0x1f')](_0x8f31('0x17'),auth[_0x8f31('0x9')](),controller['addApplications']);router[_0x8f31('0x1f')]('/:id/send',auth[_0x8f31('0x9')](),controller['send']);router[_0x8f31('0x1f')](_0x8f31('0x1d'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x26')]);router[_0x8f31('0x27')](_0x8f31('0xc'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x28')]);router[_0x8f31('0x29')](_0x8f31('0xe'),auth[_0x8f31('0x9')](),controller[_0x8f31('0x2a')]);router[_0x8f31('0x29')](_0x8f31('0x10'),auth[_0x8f31('0x9')](),controller['removeAnswers']);router['delete'](_0x8f31('0x12'),auth[_0x8f31('0x9')](),controller['removeImap']);router['delete']('/:id/out_servers',auth[_0x8f31('0x9')](),controller[_0x8f31('0x2b')]);router[_0x8f31('0x29')](_0x8f31('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x8f31('0x29')]('/:id/users',auth['isAuthenticated'](),controller[_0x8f31('0x2c')]);module[_0x8f31('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 6e5cfd5..c306396 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 _0x1750=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','custom','provider','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1750,0x1f3));var _0x0175=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1750[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x0175('0x0'));module['exports']={'description':{'type':Sequelize[_0x0175('0x1')]},'name':{'type':Sequelize[_0x0175('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x0175('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0175('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x0175('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x0175('0x3')]},'markAsUnread':{'type':Sequelize[_0x0175('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0175('0x1')],'allowNull':![],'defaultValue':_0x0175('0x4')},'fontSize':{'type':Sequelize[_0x0175('0x5')](0x2)[_0x0175('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0175('0x3')],'defaultValue':function(){return _0x0175('0x7');}},'notificationSound':{'type':Sequelize[_0x0175('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0175('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0175('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0175('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0175('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x0175('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0175('0x2')],'defaultValue':![],'comment':_0x0175('0x9'),'set':function(_0x490d7b){if(!_0x490d7b)this[_0x0175('0xa')](_0x0175('0xb'),null);this[_0x0175('0xa')](_0x0175('0xc'),_0x490d7b);}},'provider':{'type':Sequelize[_0x0175('0xd')](_0x0175('0xe'),'hotmail',_0x0175('0xf'),_0x0175('0x10')),'defaultValue':null,'get':function(){if(!this[_0x0175('0x11')]('provider'))return _0x0175('0x12');return this['getDataValue'](_0x0175('0x13'));},'set':function(_0x310670){if(_0x310670===_0x0175('0x12'))_0x310670=null;return this[_0x0175('0xa')](_0x0175('0x13'),_0x310670);}}}; \ No newline at end of file +var _0x30a1=['BOOLEAN','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','ENUM','gmail','hotmail','yahoo','getDataValue','provider','custom','setDataValue','sequelize','STRING'];(function(_0x37eaf3,_0x100cc6){var _0x47d01a=function(_0x262e3f){while(--_0x262e3f){_0x37eaf3['push'](_0x37eaf3['shift']());}};_0x47d01a(++_0x100cc6);}(_0x30a1,0x1de));var _0x130a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a1[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x130a('0x0'));module['exports']={'description':{'type':Sequelize[_0x130a('0x1')]},'name':{'type':Sequelize[_0x130a('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x130a('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x130a('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x130a('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x130a('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x130a('0x3')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x130a('0x4')],'defaultValue':function(){return _0x130a('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x130a('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x130a('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x130a('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x130a('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x130a('0x3')],'allowNull':!![],'defaultValue':null,'comment':_0x130a('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x130a('0x2')],'defaultValue':![],'comment':_0x130a('0x7'),'set':function(_0x3f5b0c){if(!_0x3f5b0c)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x3f5b0c);}},'provider':{'type':Sequelize[_0x130a('0x8')](_0x130a('0x9'),_0x130a('0xa'),_0x130a('0xb'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x130a('0xc')](_0x130a('0xd')))return _0x130a('0xe');return this['getDataValue'](_0x130a('0xd'));},'set':function(_0x29570f){if(_0x29570f==='custom')_0x29570f=null;return this[_0x130a('0xf')](_0x130a('0xd'),_0x29570f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ffda820..c4b4b46 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 _0x0644=['Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','api','../../config/environment','defaults','redis','localhost','./mailAccount.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','destroy','get','MailAccounts','end','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','pass','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','findAll','rows','show','keys','include','find','body','provider','custom','params','describe','addDisposition','MailAccountId','Disposition','getDispositions','order','includeAll','removeDispositions','ids','CannedAnswer','create','getAnswers','findOne','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','User','Owner','internal','Tag','Tags','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','stack','finally','json','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp'];(function(_0x1f05fa,_0x2511b0){var _0x707082=function(_0x2f470a){while(--_0x2f470a){_0x1f05fa['push'](_0x1f05fa['shift']());}};_0x707082(++_0x2511b0);}(_0x0644,0xc5));var _0x4064=function(_0xd7f562,_0x459ec8){_0xd7f562=_0xd7f562-0x0;var _0x5957da=_0x0644[_0xd7f562];return _0x5957da;};'use strict';var moment=require(_0x4064('0x0'));var BPromise=require(_0x4064('0x1'));var util=require(_0x4064('0x2'));var path=require(_0x4064('0x3'));var _=require(_0x4064('0x4'));var juice=require(_0x4064('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4064('0x6'));var config=require(_0x4064('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4064('0x8')](config[_0x4064('0x9')],{'host':_0x4064('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4064('0x9')]));require(_0x4064('0xb'))['register'](socket);var jayson=require(_0x4064('0xc'));var client=jayson[_0x4064('0xd')][_0x4064('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x2ea793,_0x4a9886,_0x4c7a58,_0x255a25){return new BPromise(function(_0x372fcd,_0x4d63e9){var _0x344986=_0x255a25||client;return _0x344986['request'](_0x2ea793,_0x4c7a58)[_0x4064('0xf')](function(_0x5ce93c){logger[_0x4064('0x10')]('MailAccount,\x20%s,\x20%s',_0x4a9886,_0x4064('0x11'));logger[_0x4064('0x12')](_0x4064('0x13'),_0x4a9886,_0x4064('0x11'),JSON[_0x4064('0x14')](_0x5ce93c));if(_0x5ce93c[_0x4064('0x15')]){if(_0x5ce93c['error'][_0x4064('0x16')]===0x1f4){logger[_0x4064('0x15')](_0x4064('0x17'),_0x4a9886,_0x5ce93c[_0x4064('0x15')]['message']);return _0x4d63e9(_0x5ce93c[_0x4064('0x15')][_0x4064('0x18')]);}logger[_0x4064('0x15')](_0x4064('0x17'),_0x4a9886,_0x5ce93c[_0x4064('0x15')][_0x4064('0x18')]);return _0x372fcd(_0x5ce93c[_0x4064('0x15')][_0x4064('0x18')]);}else{logger[_0x4064('0x10')](_0x4064('0x17'),_0x4a9886,_0x4064('0x11'));_0x372fcd(_0x5ce93c[_0x4064('0x19')][_0x4064('0x18')]);}})[_0x4064('0x1a')](function(_0x46aa9d){logger[_0x4064('0x15')](_0x4064('0x17'),_0x4a9886,_0x46aa9d);_0x4d63e9(_0x46aa9d);});});}function respondWithStatusCode(_0x3c4d69,_0xe9fb68){_0xe9fb68=_0xe9fb68||0xcc;return function(_0x51cece){if(_0x51cece){return _0x3c4d69['sendStatus'](_0xe9fb68);}return _0x3c4d69[_0x4064('0x1b')](_0xe9fb68)['end']();};}function respondWithResult(_0x36fdcf,_0x324f74){_0x324f74=_0x324f74||0xc8;return function(_0x21b258){if(_0x21b258){return _0x36fdcf[_0x4064('0x1b')](_0x324f74)['json'](_0x21b258);}};}function respondWithFilteredResult(_0x4e65fb,_0x27f880){return function(_0x190dec){if(_0x190dec){var _0x517df0=typeof _0x27f880['offset']===_0x4064('0x1c')&&typeof _0x27f880[_0x4064('0x1d')]==='undefined';var _0x3074f9=_0x190dec[_0x4064('0x1e')];var _0x23b1af=_0x517df0?0x0:_0x27f880[_0x4064('0x1f')];var _0x486d06=_0x517df0?_0x190dec['count']:_0x27f880['offset']+_0x27f880[_0x4064('0x1d')];var _0x22ca9d;if(_0x486d06>=_0x3074f9){_0x486d06=_0x3074f9;_0x22ca9d=0xc8;}else{_0x22ca9d=0xce;}_0x4e65fb[_0x4064('0x1b')](_0x22ca9d);return _0x4e65fb[_0x4064('0x20')](_0x4064('0x21'),_0x23b1af+'-'+_0x486d06+'/'+_0x3074f9)['json'](_0x190dec);}return null;};}function saveUpdates(_0x26702b){return function(_0x56f0df){if(_0x56f0df){return _0x56f0df['update'](_0x26702b)[_0x4064('0xf')](function(_0x1294c8){return _0x1294c8;});}return null;};}function removeEntity(_0x58077d){return function(_0x4e0581){if(_0x4e0581){return _0x4e0581[_0x4064('0x22')]()['then'](function(){var _0x4c657f=_0x4e0581[_0x4064('0x23')]({'plain':!![]});var _0x26bbc5=_0x4064('0x24');return db['UserProfileResource'][_0x4064('0x22')]({'where':{'type':_0x26bbc5,'resourceId':_0x4c657f['id']}})[_0x4064('0xf')](function(){return _0x4e0581;});})['then'](function(){_0x58077d['status'](0xcc)[_0x4064('0x25')]();});}};}function handleEntityNotFound(_0x332e15){return function(_0x2e8749){if(!_0x2e8749){_0x332e15[_0x4064('0x26')](0x194);}return _0x2e8749;};}function handleError(_0x1c7b39,_0x3a20ea){_0x3a20ea=_0x3a20ea||0x1f4;return function(_0x36d9f6){logger[_0x4064('0x15')](_0x36d9f6['stack']);if(_0x36d9f6[_0x4064('0x27')]){delete _0x36d9f6[_0x4064('0x27')];}_0x1c7b39['status'](_0x3a20ea)[_0x4064('0x28')](_0x36d9f6);};}function getImapHost(_0x48e24e){switch(_0x48e24e){case _0x4064('0x29'):return _0x4064('0x2a');case _0x4064('0x2b'):return _0x4064('0x2c');case _0x4064('0x2d'):return _0x4064('0x2e');case _0x4064('0x2f'):return _0x4064('0x30');}throw new Error(_0x4064('0x31'),_0x48e24e);}function getSmtpHost(_0x26d247){switch(_0x26d247){case _0x4064('0x29'):return _0x4064('0x32');case _0x4064('0x2b'):return _0x4064('0x33');case _0x4064('0x2d'):return _0x4064('0x34');case'outlook365':return'smtp.office365.com';}throw new Error(_0x4064('0x31'),_0x26d247);}function getAuthenticationOptions(_0x47b7c5,_0x30684e){var _0x2a5eb9={};var _0x6c1ab6={};if(_0x47b7c5){_0x2a5eb9[_0x4064('0x35')]=_0x6c1ab6[_0x4064('0x35')]=_0x30684e[_0x4064('0x36')];_0x2a5eb9[_0x4064('0x37')]=_0x6c1ab6['pass']=_0x30684e[_0x4064('0x37')];if(_0x30684e[_0x4064('0x38')]){_0x2a5eb9[_0x4064('0x38')]=_0x6c1ab6[_0x4064('0x38')]=!![];_0x2a5eb9[_0x4064('0x39')]=_0x6c1ab6[_0x4064('0x39')]=_0x30684e[_0x4064('0x39')];_0x2a5eb9[_0x4064('0x37')]=_0x6c1ab6['pass']=null;}else{_0x2a5eb9[_0x4064('0x39')]=_0x6c1ab6[_0x4064('0x39')]=null;}_0x2a5eb9[_0x4064('0x3a')]=getImapHost(_0x47b7c5);_0x2a5eb9[_0x4064('0x3b')]=0x3e1;_0x6c1ab6['host']=getSmtpHost(_0x47b7c5);_0x6c1ab6[_0x4064('0x3b')]=0x24b;_0x6c1ab6[_0x4064('0x3c')]=![];_0x2a5eb9['service']=_0x6c1ab6[_0x4064('0x3d')]=null;}else{if(_0x30684e[_0x4064('0x3e')]){_0x2a5eb9[_0x4064('0x35')]=_0x6c1ab6[_0x4064('0x35')]=_0x30684e[_0x4064('0x36')];_0x2a5eb9['password']=_0x6c1ab6[_0x4064('0x3f')]=_0x30684e[_0x4064('0x37')];}else{_0x2a5eb9[_0x4064('0x3e')]=_0x6c1ab6[_0x4064('0x3e')]=![];_0x2a5eb9['user']=_0x6c1ab6[_0x4064('0x35')]=null;_0x2a5eb9[_0x4064('0x37')]=_0x6c1ab6[_0x4064('0x3f')]=null;}_0x2a5eb9[_0x4064('0x3a')]=_0x30684e[_0x4064('0x40')][_0x4064('0x3a')];_0x2a5eb9['port']=_0x30684e[_0x4064('0x40')][_0x4064('0x3b')];_0x6c1ab6[_0x4064('0x3a')]=_0x30684e[_0x4064('0x41')]['host'];_0x6c1ab6[_0x4064('0x3b')]=_0x30684e['Smtp'][_0x4064('0x3b')];}return{'Imap':_0x2a5eb9,'Smtp':_0x6c1ab6};}exports['index']=function(_0x5a24e8,_0x1a1a9a){var _0x164d1c={'include':[{'model':db[_0x4064('0x42')],'as':_0x4064('0x40')},{'model':db[_0x4064('0x43')],'as':_0x4064('0x41')},{'model':db[_0x4064('0x44')],'as':_0x4064('0x45')}]},_0x371107={},_0x2abaa8={'count':0x0,'rows':[]};var _0x1455f1=_[_0x4064('0x46')](db[_0x4064('0x47')][_0x4064('0x48')],function(_0x6d9bcc){return{'name':_0x6d9bcc[_0x4064('0x49')],'type':_0x6d9bcc[_0x4064('0x4a')]['key']};});_0x371107['model']=_[_0x4064('0x46')](_0x1455f1,_0x4064('0x27'));_0x371107[_0x4064('0x4b')]=_['keys'](_0x5a24e8['query']);_0x371107[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x371107[_0x4064('0x4e')],_0x371107[_0x4064('0x4b')]);_0x164d1c[_0x4064('0x4f')]=_['intersection'](_0x371107[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x5a24e8['query'][_0x4064('0x50')]));_0x164d1c[_0x4064('0x4f')]=_0x164d1c['attributes'][_0x4064('0x51')]?_0x164d1c[_0x4064('0x4f')]:_0x371107[_0x4064('0x4e')];if(!_0x5a24e8['query'][_0x4064('0x52')](_0x4064('0x53'))){_0x164d1c['limit']=qs[_0x4064('0x1d')](_0x5a24e8[_0x4064('0x4b')][_0x4064('0x1d')]);_0x164d1c[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0x5a24e8[_0x4064('0x4b')][_0x4064('0x1f')]);}_0x164d1c['order']=qs[_0x4064('0x54')](_0x5a24e8[_0x4064('0x4b')][_0x4064('0x54')]);_0x164d1c['where']=qs[_0x4064('0x4c')](_[_0x4064('0x55')](_0x5a24e8['query'],_0x371107[_0x4064('0x4c')]),_0x1455f1);if(_0x5a24e8['query'][_0x4064('0x56')]){_0x164d1c[_0x4064('0x57')]=_[_0x4064('0x58')](_0x164d1c[_0x4064('0x57')],{'$or':_[_0x4064('0x46')](_0x1455f1,function(_0x52d198){if(_0x52d198[_0x4064('0x4a')]!=='VIRTUAL'){var _0x2e1e5={};_0x2e1e5[_0x52d198['name']]={'$like':'%'+_0x5a24e8[_0x4064('0x4b')][_0x4064('0x56')]+'%'};return _0x2e1e5;}})});}_0x164d1c=_[_0x4064('0x58')]({},_0x164d1c,_0x5a24e8[_0x4064('0x59')]);var _0x279a19={'where':_0x164d1c[_0x4064('0x57')]};return db[_0x4064('0x47')][_0x4064('0x1e')](_0x279a19)[_0x4064('0xf')](function(_0xd511f8){_0x2abaa8[_0x4064('0x1e')]=_0xd511f8;if(_0x5a24e8[_0x4064('0x4b')]['includeAll']){_0x164d1c['include']=[{'all':!![]}];}return db[_0x4064('0x47')][_0x4064('0x5a')](_0x164d1c);})[_0x4064('0xf')](function(_0x4dde0a){_0x2abaa8[_0x4064('0x5b')]=_0x4dde0a;return _0x2abaa8;})['then'](respondWithFilteredResult(_0x1a1a9a,_0x164d1c))[_0x4064('0x1a')](handleError(_0x1a1a9a,null));};exports[_0x4064('0x5c')]=function(_0x44e2f0,_0x1dd951){var _0x2c2311={'raw':![],'where':{'id':_0x44e2f0['params']['id']},'include':[{'model':db[_0x4064('0x42')],'as':'Imap'},{'model':db[_0x4064('0x43')],'as':_0x4064('0x41')},{'model':db['Pause'],'as':_0x4064('0x45')}]},_0x45e8e1={};_0x45e8e1[_0x4064('0x4e')]=_[_0x4064('0x5d')](db[_0x4064('0x47')][_0x4064('0x48')]);_0x45e8e1[_0x4064('0x4b')]=_[_0x4064('0x5d')](_0x44e2f0[_0x4064('0x4b')]);_0x45e8e1[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x45e8e1['model'],_0x45e8e1['query']);_0x2c2311[_0x4064('0x4f')]=_[_0x4064('0x4d')](_0x45e8e1[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x44e2f0['query'][_0x4064('0x50')]));_0x2c2311['attributes']=_0x2c2311['attributes']['length']?_0x2c2311[_0x4064('0x4f')]:_0x45e8e1[_0x4064('0x4e')];if(_0x44e2f0[_0x4064('0x4b')]['includeAll']){_0x2c2311[_0x4064('0x5e')]=[{'all':!![]}];}_0x2c2311=_[_0x4064('0x58')]({},_0x2c2311,_0x44e2f0[_0x4064('0x59')]);return db[_0x4064('0x47')][_0x4064('0x5f')](_0x2c2311)['then'](handleEntityNotFound(_0x1dd951,null))['then'](respondWithResult(_0x1dd951,null))[_0x4064('0x1a')](handleError(_0x1dd951,null));};exports['update']=function(_0x562d8f,_0x2b1e7a){if(_0x562d8f['body']['id']){delete _0x562d8f[_0x4064('0x60')]['id'];}var _0x28d2cc=_0x562d8f[_0x4064('0x60')][_0x4064('0x61')]===_0x4064('0x62')?null:_0x562d8f[_0x4064('0x60')]['provider'];var _0x1d3e02=_0x562d8f[_0x4064('0x60')][_0x4064('0x40')]||{};var _0x41e69d=_0x562d8f[_0x4064('0x60')][_0x4064('0x41')]||{};if(_0x28d2cc){_0x1d3e02[_0x4064('0x3a')]=getImapHost(_0x28d2cc);_0x1d3e02[_0x4064('0x3b')]=0x3e1;_0x41e69d[_0x4064('0x3a')]=getSmtpHost(_0x28d2cc);_0x41e69d[_0x4064('0x3b')]=0x24b;_0x41e69d[_0x4064('0x3c')]=![];}if(_0x41e69d[_0x4064('0x38')]){_0x41e69d[_0x4064('0x3c')]=![];}else{_0x41e69d[_0x4064('0x39')]=null;}if(!_0x1d3e02[_0x4064('0x38')])_0x1d3e02[_0x4064('0x39')]=null;_0x562d8f[_0x4064('0x60')][_0x4064('0x40')]=_0x1d3e02;_0x562d8f[_0x4064('0x60')]['Smtp']=_0x41e69d;return db['MailAccount'][_0x4064('0x5f')]({'where':{'id':_0x562d8f[_0x4064('0x63')]['id']},'include':[{'model':db[_0x4064('0x42')],'as':_0x4064('0x40')},{'model':db[_0x4064('0x43')],'as':'Smtp'},{'model':db[_0x4064('0x44')],'as':_0x4064('0x45')}]})[_0x4064('0xf')](handleEntityNotFound(_0x2b1e7a,null))[_0x4064('0xf')](function(_0x3bb957){if(!_0x3bb957)throw new Error('Mail\x20Account\x20not\x20found');if(_0x3bb957[_0x4064('0x3d')])delete _0x562d8f[_0x4064('0x60')][_0x4064('0x40')];return _0x3bb957;})[_0x4064('0xf')](saveUpdates(_0x562d8f[_0x4064('0x60')],null))[_0x4064('0xf')](function(_0x429254){if(!_0x562d8f[_0x4064('0x60')]['Imap'])return _0x429254;return db[_0x4064('0x42')]['update'](_0x562d8f[_0x4064('0x60')][_0x4064('0x40')],{'where':{'MailAccountId':_0x429254['id']}})[_0x4064('0xf')](function(){return _0x429254;});})['then'](function(_0x21c2ce){if(!_0x562d8f[_0x4064('0x60')][_0x4064('0x41')])return _0x21c2ce;return db['MailServerOut']['update'](_0x562d8f[_0x4064('0x60')]['Smtp'],{'where':{'MailAccountId':_0x21c2ce['id']}})['then'](function(){return _0x21c2ce;});})['then'](respondWithResult(_0x2b1e7a,null))['catch'](handleError(_0x2b1e7a,null));};exports[_0x4064('0x64')]=function(_0x5f3586,_0x12ca5c){return db[_0x4064('0x47')][_0x4064('0x64')]()[_0x4064('0xf')](respondWithResult(_0x12ca5c,null))[_0x4064('0x1a')](handleError(_0x12ca5c,null));};exports[_0x4064('0x65')]=function(_0x29dcdc,_0x2d9d3d){if(_0x29dcdc[_0x4064('0x60')]['id']){delete _0x29dcdc[_0x4064('0x60')]['id'];}return db[_0x4064('0x47')]['find']({'where':{'id':_0x29dcdc[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x2d9d3d,null))['then'](function(_0x2c04cb){if(_0x2c04cb){_0x29dcdc[_0x4064('0x60')][_0x4064('0x66')]=_0x2c04cb['id'];return db[_0x4064('0x67')]['create'](_0x29dcdc[_0x4064('0x60')]);}})[_0x4064('0xf')](respondWithResult(_0x2d9d3d,null))[_0x4064('0x1a')](handleError(_0x2d9d3d,null));};exports[_0x4064('0x68')]=function(_0x44f51c,_0x2728f1){var _0x595d21={'raw':![],'where':{}};var _0x43efeb={};var _0x5b4d66={'count':0x0,'rows':[]};return db[_0x4064('0x47')]['findOne']({'where':{'id':_0x44f51c[_0x4064('0x63')]['id']}})['then'](handleEntityNotFound(_0x2728f1,null))[_0x4064('0xf')](function(_0x1f3285){if(_0x1f3285){_0x43efeb['model']=_[_0x4064('0x5d')](db[_0x4064('0x67')][_0x4064('0x48')]);_0x43efeb[_0x4064('0x4b')]=_[_0x4064('0x5d')](_0x44f51c[_0x4064('0x4b')]);_0x43efeb[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x43efeb[_0x4064('0x4e')],_0x43efeb[_0x4064('0x4b')]);_0x595d21[_0x4064('0x4f')]=_[_0x4064('0x4d')](_0x43efeb['model'],qs[_0x4064('0x50')](_0x44f51c[_0x4064('0x4b')][_0x4064('0x50')]));_0x595d21[_0x4064('0x4f')]=_0x595d21[_0x4064('0x4f')][_0x4064('0x51')]?_0x595d21[_0x4064('0x4f')]:_0x43efeb[_0x4064('0x4e')];if(!_0x44f51c['query'][_0x4064('0x52')](_0x4064('0x53'))){_0x595d21[_0x4064('0x1d')]=qs[_0x4064('0x1d')](_0x44f51c[_0x4064('0x4b')][_0x4064('0x1d')]);_0x595d21[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0x44f51c[_0x4064('0x4b')]['offset']);}_0x595d21[_0x4064('0x69')]=qs[_0x4064('0x54')](_0x44f51c[_0x4064('0x4b')][_0x4064('0x54')]);_0x595d21[_0x4064('0x57')]=qs[_0x4064('0x4c')](_[_0x4064('0x55')](_0x44f51c[_0x4064('0x4b')],_0x43efeb['filters']));_0x595d21[_0x4064('0x57')]['MailAccountId']=_0x1f3285['id'];if(_0x44f51c[_0x4064('0x4b')][_0x4064('0x56')]){_0x595d21[_0x4064('0x57')]=_[_0x4064('0x58')](_0x595d21[_0x4064('0x57')],{'$or':_['map'](_0x595d21[_0x4064('0x4f')],function(_0x123d66){var _0x244863={};_0x244863[_0x123d66]={'$like':'%'+_0x44f51c[_0x4064('0x4b')]['filter']+'%'};return _0x244863;})});}_0x595d21=_[_0x4064('0x58')]({},_0x595d21,_0x44f51c[_0x4064('0x59')]);return db[_0x4064('0x67')][_0x4064('0x1e')]({'where':_0x595d21[_0x4064('0x57')]})['then'](function(_0xeb1fc9){_0x5b4d66[_0x4064('0x1e')]=_0xeb1fc9;if(_0x44f51c[_0x4064('0x4b')][_0x4064('0x6a')]){_0x595d21[_0x4064('0x5e')]=[{'all':!![]}];}return db[_0x4064('0x67')][_0x4064('0x5a')](_0x595d21);})[_0x4064('0xf')](function(_0x200834){_0x5b4d66['rows']=_0x200834;return _0x5b4d66;});}})['then'](respondWithFilteredResult(_0x2728f1,_0x595d21))[_0x4064('0x1a')](handleError(_0x2728f1,null));};exports[_0x4064('0x6b')]=function(_0x3c5ecc,_0x1f2d71){return db['MailAccount'][_0x4064('0x5f')]({'where':{'id':_0x3c5ecc[_0x4064('0x63')]['id']}})['then'](handleEntityNotFound(_0x1f2d71,null))['then'](function(_0x21dec5){if(_0x21dec5){return _0x21dec5['removeDispositions'](_0x3c5ecc[_0x4064('0x4b')][_0x4064('0x6c')]);}})['then'](respondWithStatusCode(_0x1f2d71,null))[_0x4064('0x1a')](handleError(_0x1f2d71,null));};exports['addAnswer']=function(_0x5c6ce7,_0x5a37ea){if(_0x5c6ce7[_0x4064('0x60')]['id']){delete _0x5c6ce7[_0x4064('0x60')]['id'];}return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x5c6ce7[_0x4064('0x63')]['id']}})['then'](handleEntityNotFound(_0x5a37ea,null))[_0x4064('0xf')](function(_0x33f0c7){if(_0x33f0c7){_0x5c6ce7[_0x4064('0x60')][_0x4064('0x66')]=_0x33f0c7['id'];return db[_0x4064('0x6d')][_0x4064('0x6e')](_0x5c6ce7[_0x4064('0x60')]);}})['then'](respondWithResult(_0x5a37ea,null))[_0x4064('0x1a')](handleError(_0x5a37ea,null));};exports[_0x4064('0x6f')]=function(_0x38cac3,_0x117a2b){var _0x39ef4f={'raw':![],'where':{}};var _0x45918b={};var _0x2019d9={'count':0x0,'rows':[]};return db[_0x4064('0x47')][_0x4064('0x70')]({'where':{'id':_0x38cac3['params']['id']}})['then'](handleEntityNotFound(_0x117a2b,null))['then'](function(_0x114142){if(_0x114142){_0x45918b['model']=_[_0x4064('0x5d')](db[_0x4064('0x6d')]['rawAttributes']);_0x45918b[_0x4064('0x4b')]=_['keys'](_0x38cac3[_0x4064('0x4b')]);_0x45918b[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x45918b[_0x4064('0x4e')],_0x45918b[_0x4064('0x4b')]);_0x39ef4f[_0x4064('0x4f')]=_[_0x4064('0x4d')](_0x45918b[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x38cac3[_0x4064('0x4b')][_0x4064('0x50')]));_0x39ef4f[_0x4064('0x4f')]=_0x39ef4f[_0x4064('0x4f')][_0x4064('0x51')]?_0x39ef4f[_0x4064('0x4f')]:_0x45918b[_0x4064('0x4e')];if(!_0x38cac3[_0x4064('0x4b')][_0x4064('0x52')]('nolimit')){_0x39ef4f[_0x4064('0x1d')]=qs[_0x4064('0x1d')](_0x38cac3[_0x4064('0x4b')]['limit']);_0x39ef4f['offset']=qs[_0x4064('0x1f')](_0x38cac3[_0x4064('0x4b')][_0x4064('0x1f')]);}_0x39ef4f[_0x4064('0x69')]=qs['sort'](_0x38cac3['query'][_0x4064('0x54')]);_0x39ef4f[_0x4064('0x57')]=qs[_0x4064('0x4c')](_[_0x4064('0x55')](_0x38cac3['query'],_0x45918b[_0x4064('0x4c')]));_0x39ef4f['where'][_0x4064('0x66')]=_0x114142['id'];if(_0x38cac3['query'][_0x4064('0x56')]){_0x39ef4f[_0x4064('0x57')]=_[_0x4064('0x58')](_0x39ef4f[_0x4064('0x57')],{'$or':_[_0x4064('0x46')](_0x39ef4f[_0x4064('0x4f')],function(_0x83b94d){var _0xf3b74b={};_0xf3b74b[_0x83b94d]={'$like':'%'+_0x38cac3[_0x4064('0x4b')][_0x4064('0x56')]+'%'};return _0xf3b74b;})});}_0x39ef4f=_[_0x4064('0x58')]({},_0x39ef4f,_0x38cac3[_0x4064('0x59')]);return db[_0x4064('0x6d')][_0x4064('0x1e')]({'where':_0x39ef4f[_0x4064('0x57')]})[_0x4064('0xf')](function(_0x57f137){_0x2019d9['count']=_0x57f137;if(_0x38cac3[_0x4064('0x4b')]['includeAll']){_0x39ef4f['include']=[{'all':!![]}];}return db[_0x4064('0x6d')][_0x4064('0x5a')](_0x39ef4f);})[_0x4064('0xf')](function(_0x162379){_0x2019d9[_0x4064('0x5b')]=_0x162379;return _0x2019d9;});}})['then'](respondWithFilteredResult(_0x117a2b,_0x39ef4f))[_0x4064('0x1a')](handleError(_0x117a2b,null));};exports[_0x4064('0x71')]=function(_0x556abb,_0x501592){return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x556abb[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x501592,null))[_0x4064('0xf')](function(_0x1829ce){if(_0x1829ce){return _0x1829ce[_0x4064('0x71')](_0x556abb['query'][_0x4064('0x6c')]);}})[_0x4064('0xf')](respondWithStatusCode(_0x501592,null))[_0x4064('0x1a')](handleError(_0x501592,null));};exports['create']=function(_0x268d28,_0x5ad2c3){var _0xcbe010={'name':_0x268d28[_0x4064('0x60')][_0x4064('0x27')],'key':_0x268d28['body']['key'],'provider':_0x268d28[_0x4064('0x60')][_0x4064('0x61')]==='custom'?null:_0x268d28['body'][_0x4064('0x61')],'email':_0x268d28[_0x4064('0x60')][_0x4064('0x72')],'ListId':_0x268d28[_0x4064('0x60')]['ListId'],'active':!_[_0x4064('0x73')](_0x268d28[_0x4064('0x60')][_0x4064('0x74')])?_0x268d28['body'][_0x4064('0x74')]:!![],'description':_0x268d28['body'][_0x4064('0x75')]||null};var _0x2b5151=getAuthenticationOptions(_0xcbe010[_0x4064('0x61')],_0x268d28['body']);_0xcbe010[_0x4064('0x40')]=_0x2b5151[_0x4064('0x40')];_0xcbe010[_0x4064('0x41')]=_0x2b5151[_0x4064('0x41')];return db[_0x4064('0x47')][_0x4064('0x6e')](_0xcbe010,{'include':[{'model':db['MailServerOut'],'as':_0x4064('0x41')},{'model':db[_0x4064('0x42')],'as':_0x4064('0x40')}]})[_0x4064('0xf')](function(_0x519a2c){var _0x17736b=_0x268d28['user'][_0x4064('0x23')]({'plain':!![]});if(!_0x17736b)throw new Error(_0x4064('0x76'));if(_0x17736b['role']===_0x4064('0x35')){var _0x5893ef=_0x519a2c[_0x4064('0x23')]({'plain':!![]});return db[_0x4064('0x77')][_0x4064('0x5f')]({'where':{'name':_0x4064('0x24'),'userProfileId':_0x17736b[_0x4064('0x78')]},'raw':!![]})[_0x4064('0xf')](function(_0x17a305){if(_0x17a305&&_0x17a305[_0x4064('0x79')]===0x0){return db['UserProfileResource'][_0x4064('0x6e')]({'name':_0x5893ef['name'],'resourceId':_0x5893ef['id'],'type':_0x17a305[_0x4064('0x27')],'sectionId':_0x17a305['id']},{})[_0x4064('0xf')](function(){return _0x519a2c;});}else{return _0x519a2c;}})['catch'](function(_0x99c1e5){logger['error'](_0x4064('0x7a'),_0x99c1e5);throw _0x99c1e5;});}return _0x519a2c;})[_0x4064('0xf')](respondWithResult(_0x5ad2c3,0xc9))[_0x4064('0x1a')](handleError(_0x5ad2c3,null));};exports['getImap']=function(_0x4400f4,_0x2a3cf9){return db['MailAccount'][_0x4064('0x70')]({'where':{'id':_0x4400f4[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x2a3cf9,null))['then'](function(_0x3267c3){if(_0x3267c3){return _0x3267c3[_0x4064('0x7b')]();}return null;})[_0x4064('0xf')](respondWithResult(_0x2a3cf9,null))[_0x4064('0x1a')](handleError(_0x2a3cf9,null));};exports[_0x4064('0x7c')]=function(_0x16699e,_0x587a8f){if(_0x16699e[_0x4064('0x60')]['id']){delete _0x16699e[_0x4064('0x60')]['id'];}return db[_0x4064('0x47')]['find']({'where':{'id':_0x16699e['params']['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x587a8f,null))[_0x4064('0xf')](function(_0x309354){if(_0x309354){_0x16699e[_0x4064('0x60')]['MailAccountId']=_0x309354['id'];return db['MailServerIn'][_0x4064('0x6e')](_0x16699e[_0x4064('0x60')]);}})[_0x4064('0xf')](respondWithResult(_0x587a8f,null))[_0x4064('0x1a')](handleError(_0x587a8f,null));};exports['removeImap']=function(_0x1eba8f,_0x43b7a2){return db[_0x4064('0x47')][_0x4064('0x70')]({'where':{'id':_0x1eba8f[_0x4064('0x63')]['id']}})['then'](handleEntityNotFound(_0x43b7a2,null))['then'](function(_0x17a623){if(_0x17a623){return _0x17a623['setImap'](null);}return null;})[_0x4064('0xf')](respondWithStatusCode(_0x43b7a2,null))[_0x4064('0x1a')](handleError(_0x43b7a2,null));};exports[_0x4064('0x7d')]=function(_0x42f577,_0x14c490){return db[_0x4064('0x47')][_0x4064('0x70')]({'where':{'id':_0x42f577[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x14c490,null))['then'](function(_0x3077ee){if(_0x3077ee){return _0x3077ee['getSmtp']();}return null;})[_0x4064('0xf')](respondWithResult(_0x14c490,null))[_0x4064('0x1a')](handleError(_0x14c490,null));};exports[_0x4064('0x7e')]=function(_0x381f2a,_0xb87584){if(_0x381f2a[_0x4064('0x60')]['id']){delete _0x381f2a[_0x4064('0x60')]['id'];}return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x381f2a[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0xb87584,null))[_0x4064('0xf')](function(_0x9010fa){if(_0x9010fa){_0x381f2a[_0x4064('0x60')]['MailAccountId']=_0x9010fa['id'];return db['MailServerOut'][_0x4064('0x6e')](_0x381f2a[_0x4064('0x60')]);}})[_0x4064('0xf')](respondWithResult(_0xb87584,null))['catch'](handleError(_0xb87584,null));};exports[_0x4064('0x7f')]=function(_0x1662da,_0x170c58){return db['MailAccount'][_0x4064('0x70')]({'where':{'id':_0x1662da[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x170c58,null))['then'](function(_0x337e0d){if(_0x337e0d){return _0x337e0d['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x170c58,null))[_0x4064('0x1a')](handleError(_0x170c58,null));};exports[_0x4064('0x80')]=function(_0x185e94,_0x25b934){return db[_0x4064('0x81')]['find']({'where':{'id':_0x185e94['params']['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x25b934,null))[_0x4064('0xf')](function(_0x2b24d6){if(_0x2b24d6){return _0x2b24d6[_0x4064('0x80')](_0x185e94[_0x4064('0x60')]['ids'],_['omit'](_0x185e94['body'],[_0x4064('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x25b934,null))[_0x4064('0x1a')](handleError(_0x25b934,null));};exports[_0x4064('0x82')]=function(_0x4668e8,_0x13b6a1){var _0x50d2fb={'raw':![],'where':{}};var _0x24a20a={};var _0x38c7b4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x4668e8[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x13b6a1,null))[_0x4064('0xf')](function(_0x16f1ac){if(_0x16f1ac){_0x24a20a[_0x4064('0x4e')]=_[_0x4064('0x5d')](db[_0x4064('0x81')][_0x4064('0x48')]);_0x24a20a[_0x4064('0x4b')]=_[_0x4064('0x5d')](_0x4668e8[_0x4064('0x4b')]);_0x24a20a[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x24a20a[_0x4064('0x4e')],_0x24a20a[_0x4064('0x4b')]);_0x50d2fb[_0x4064('0x4f')]=_[_0x4064('0x4d')](_0x24a20a[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x4668e8[_0x4064('0x4b')]['fields']));_0x50d2fb[_0x4064('0x4f')]=_0x50d2fb[_0x4064('0x4f')][_0x4064('0x51')]?_0x50d2fb[_0x4064('0x4f')]:_0x24a20a[_0x4064('0x4e')];if(!_0x4668e8[_0x4064('0x4b')][_0x4064('0x52')]('nolimit')){_0x50d2fb[_0x4064('0x1d')]=qs[_0x4064('0x1d')](_0x4668e8[_0x4064('0x4b')][_0x4064('0x1d')]);_0x50d2fb[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0x4668e8['query'][_0x4064('0x1f')]);}_0x50d2fb[_0x4064('0x69')]=qs[_0x4064('0x54')](_0x4668e8[_0x4064('0x4b')][_0x4064('0x54')]);_0x50d2fb[_0x4064('0x57')]=qs[_0x4064('0x4c')](_['pick'](_0x4668e8['query'],_0x24a20a[_0x4064('0x4c')]));_0x50d2fb[_0x4064('0x57')][_0x4064('0x66')]=_0x16f1ac['id'];if(_0x4668e8[_0x4064('0x4b')][_0x4064('0x56')]){_0x50d2fb['where']=_[_0x4064('0x58')](_0x50d2fb[_0x4064('0x57')],{'$or':_[_0x4064('0x46')](_0x50d2fb[_0x4064('0x4f')],function(_0xd46f0a){var _0x305e32={};_0x305e32[_0xd46f0a]={'$like':'%'+_0x4668e8['query'][_0x4064('0x56')]+'%'};return _0x305e32;})});}_0x50d2fb=_[_0x4064('0x58')]({},_0x50d2fb,_0x4668e8['options']);return db['MailInteraction'][_0x4064('0x1e')]({'where':_0x50d2fb[_0x4064('0x57')]})[_0x4064('0xf')](function(_0x22de52){_0x38c7b4['count']=_0x22de52;if(_0x4668e8[_0x4064('0x4b')][_0x4064('0x6a')]){_0x50d2fb['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4064('0x83')],'as':_0x4064('0x84'),'attributes':[_0x4064('0x27'),'fullname',_0x4064('0x85')],'required':![]},{'model':db[_0x4064('0x86')],'as':_0x4064('0x87'),'attributes':['id',_0x4064('0x27'),'color'],'where':_0x4668e8[_0x4064('0x4b')][_0x4064('0x88')]?{'id':_0x4668e8[_0x4064('0x4b')][_0x4064('0x88')]}:undefined,'required':_0x4668e8['query'][_0x4064('0x88')]?!![]:![]}];}return db[_0x4064('0x81')]['findAll'](_0x50d2fb);})[_0x4064('0xf')](function(_0x141ea8){_0x38c7b4[_0x4064('0x5b')]=_0x141ea8;return _0x38c7b4;});}})['then'](respondWithFilteredResult(_0x13b6a1,_0x50d2fb))[_0x4064('0x1a')](handleError(_0x13b6a1,null));};exports[_0x4064('0x89')]=function addApplications(_0x403ce6,_0x5b45e4){var _0x4cad92=_0x403ce6[_0x4064('0x63')]['id'];var _0x1811d9=_0x403ce6[_0x4064('0x60')];var _0x4f10ef=0xc8;var _0x58ae13=null;return db[_0x4064('0x8a')][_0x4064('0x8b')]({'isolationLevel':db[_0x4064('0x8a')]['Transaction'][_0x4064('0x8c')][_0x4064('0x8d')]},function(_0x23b296){return db['MailAccount'][_0x4064('0x70')]({'where':{'id':_0x4cad92},'transaction':_0x23b296})['then'](function(_0x420ca7){if(_0x420ca7){return db[_0x4064('0x8e')][_0x4064('0x22')]({'where':{'MailAccountId':_0x4cad92},'transaction':_0x23b296})[_0x4064('0xf')](function(){var _0x244019=_[_0x4064('0x46')](_0x1811d9,function(_0x5f4e18){_0x5f4e18[_0x4064('0x66')]=_0x4cad92;return _0x5f4e18;});return db[_0x4064('0x8e')][_0x4064('0x8f')](_0x244019,{'transaction':_0x23b296});});}else{_0x4f10ef=0x194;_0x58ae13=[];}});})[_0x4064('0xf')](function(){if(_0x4f10ef!==0x194){return db[_0x4064('0x8e')][_0x4064('0x90')]({'where':{'MailAccountId':_0x4cad92},'order':'priority'})[_0x4064('0xf')](function(_0x4dff53){_0x58ae13=_0x4dff53;});}})['catch'](function(_0x47842e){_0x4f10ef=0x1f4;logger['error'](_0x47842e[_0x4064('0x91')]);if(_0x47842e[_0x4064('0x27')]){delete _0x47842e[_0x4064('0x27')];}_0x58ae13=_0x47842e;})[_0x4064('0x92')](function(){if(_0x58ae13===null){_0x5b45e4[_0x4064('0x26')](_0x4f10ef);}else{if(_0x4f10ef===0x1f4){_0x5b45e4[_0x4064('0x1b')](_0x4f10ef)[_0x4064('0x28')](_0x58ae13);}else{_0x5b45e4[_0x4064('0x1b')](_0x4f10ef)[_0x4064('0x93')](_0x58ae13);}}});};exports[_0x4064('0x94')]=function(_0xb2c5ad,_0x8f0390){var _0x1c62ff={};var _0x2e1b37={};var _0x1647f3;var _0x34ca33;return db['MailAccount'][_0x4064('0x70')]({'where':{'id':_0xb2c5ad[_0x4064('0x63')]['id']}})['then'](handleEntityNotFound(_0x8f0390,null))[_0x4064('0xf')](function(_0x17c77f){if(_0x17c77f){_0x1647f3=_0x17c77f;_0x2e1b37[_0x4064('0x4e')]=_[_0x4064('0x5d')](db[_0x4064('0x8e')][_0x4064('0x48')]);_0x2e1b37[_0x4064('0x4b')]=_[_0x4064('0x5d')](_0xb2c5ad[_0x4064('0x4b')]);_0x2e1b37[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x2e1b37[_0x4064('0x4e')],_0x2e1b37[_0x4064('0x4b')]);_0x1c62ff[_0x4064('0x4f')]=_['intersection'](_0x2e1b37['model'],qs[_0x4064('0x50')](_0xb2c5ad[_0x4064('0x4b')]['fields']));_0x1c62ff[_0x4064('0x4f')]=_0x1c62ff[_0x4064('0x4f')]['length']?_0x1c62ff[_0x4064('0x4f')]:_0x2e1b37[_0x4064('0x4e')];_0x1c62ff[_0x4064('0x69')]=qs[_0x4064('0x54')](_0xb2c5ad[_0x4064('0x4b')][_0x4064('0x54')]);_0x1c62ff[_0x4064('0x57')]=qs[_0x4064('0x4c')](_[_0x4064('0x55')](_0xb2c5ad[_0x4064('0x4b')],_0x2e1b37[_0x4064('0x4c')]));if(_0xb2c5ad['query'][_0x4064('0x56')]){_0x1c62ff['where']=_[_0x4064('0x58')](_0x1c62ff['where'],{'$or':_['map'](_0x1c62ff[_0x4064('0x4f')],function(_0x44a3a8){var _0x5f0d7c={};_0x5f0d7c[_0x44a3a8]={'$like':'%'+_0xb2c5ad[_0x4064('0x4b')]['filter']+'%'};return _0x5f0d7c;})});}_0x1c62ff=_[_0x4064('0x58')]({},_0x1c62ff,_0xb2c5ad[_0x4064('0x59')]);return _0x1647f3['getApplications'](_0x1c62ff);}})[_0x4064('0xf')](function(_0x1d0b42){if(_0x1d0b42){_0x34ca33=_0x1d0b42[_0x4064('0x51')];if(!_0xb2c5ad[_0x4064('0x4b')][_0x4064('0x52')]('nolimit')){_0x1c62ff['limit']=qs[_0x4064('0x1d')](_0xb2c5ad[_0x4064('0x4b')]['limit']);_0x1c62ff[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0xb2c5ad[_0x4064('0x4b')][_0x4064('0x1f')]);}return _0x1647f3[_0x4064('0x94')](_0x1c62ff);}})['then'](function(_0xa1d638){if(_0xa1d638){return _0xa1d638?{'count':_0x34ca33,'rows':_0xa1d638}:null;}})[_0x4064('0xf')](respondWithResult(_0x8f0390,null))[_0x4064('0x1a')](handleError(_0x8f0390,null));};exports['getMessages']=function(_0x17d125,_0x306d96){var _0x176625={'raw':!![],'where':{}};var _0x5796dc={};var _0x4a56ef={'count':0x0,'rows':[]};return db['MailAccount'][_0x4064('0x70')]({'where':{'id':_0x17d125['params']['id']}})['then'](handleEntityNotFound(_0x306d96,null))['then'](function(_0x1323fc){if(_0x1323fc){_0x5796dc['model']=_[_0x4064('0x5d')](db[_0x4064('0x95')][_0x4064('0x48')]);_0x5796dc[_0x4064('0x4b')]=_['keys'](_0x17d125[_0x4064('0x4b')]);_0x5796dc[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x5796dc[_0x4064('0x4e')],_0x5796dc[_0x4064('0x4b')]);_0x176625['attributes']=_['intersection'](_0x5796dc[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x17d125[_0x4064('0x4b')][_0x4064('0x50')]));_0x176625[_0x4064('0x4f')]=_0x176625[_0x4064('0x4f')][_0x4064('0x51')]?_0x176625['attributes']:_0x5796dc[_0x4064('0x4e')];if(!_0x17d125[_0x4064('0x4b')][_0x4064('0x52')](_0x4064('0x53'))){_0x176625[_0x4064('0x1d')]=qs[_0x4064('0x1d')](_0x17d125[_0x4064('0x4b')][_0x4064('0x1d')]);_0x176625[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0x17d125[_0x4064('0x4b')][_0x4064('0x1f')]);}_0x176625[_0x4064('0x69')]=qs['sort'](_0x17d125[_0x4064('0x4b')][_0x4064('0x54')]);_0x176625[_0x4064('0x57')]=qs['filters'](_[_0x4064('0x55')](_0x17d125[_0x4064('0x4b')],_0x5796dc[_0x4064('0x4c')]));_0x176625[_0x4064('0x57')]['MailAccountId']=_0x1323fc['id'];if(_0x17d125[_0x4064('0x4b')][_0x4064('0x56')]){_0x176625[_0x4064('0x57')]=_['merge'](_0x176625[_0x4064('0x57')],{'$or':_['map'](_0x176625[_0x4064('0x4f')],function(_0x5e2b79){var _0x25621b={};_0x25621b[_0x5e2b79]={'$like':'%'+_0x17d125[_0x4064('0x4b')][_0x4064('0x56')]+'%'};return _0x25621b;})});}if(_0x17d125[_0x4064('0x4b')]['$gte']){var _0x3b8d06=_0x17d125[_0x4064('0x4b')][_0x4064('0x96')][_0x4064('0x97')](',');var _0x41e941={};_0x41e941[_0x3b8d06[0x0]]={'$gte':moment(_0x3b8d06[0x1])[_0x4064('0x98')](_0x4064('0x99'))};_0x176625[_0x4064('0x57')]=_['merge'](_0x176625[_0x4064('0x57')],_0x41e941);}_0x176625=_['merge']({},_0x176625,_0x17d125[_0x4064('0x59')]);return db[_0x4064('0x95')][_0x4064('0x1e')]({'where':_0x176625[_0x4064('0x57')]})[_0x4064('0xf')](function(_0x578960){_0x4a56ef[_0x4064('0x1e')]=_0x578960;if(_0x17d125['query']['includeAll']){_0x176625[_0x4064('0x5e')]=[{'all':!![]}];}return db[_0x4064('0x95')][_0x4064('0x5a')](_0x176625);})['then'](function(_0x1000a8){if(_0x17d125[_0x4064('0x4b')][_0x4064('0x9a')]===_0x4064('0x9b')){for(var _0x5478fe=0x0;_0x5478fe<_0x1000a8[_0x4064('0x51')];_0x5478fe++){_0x1000a8[_0x5478fe][_0x4064('0x60')]=juice(_0x1000a8[_0x5478fe][_0x4064('0x60')]);}}_0x4a56ef[_0x4064('0x5b')]=_0x1000a8;return _0x4a56ef;});}})[_0x4064('0xf')](respondWithFilteredResult(_0x306d96,_0x176625))[_0x4064('0x1a')](handleError(_0x306d96,null));};exports[_0x4064('0x28')]=function(_0x5a7e39,_0x5ab0c8){var _0x494d51,_0x1f2740={},_0x1090d5;if(_0x5a7e39[_0x4064('0x60')]['to']){_0x1090d5=_0x5a7e39[_0x4064('0x60')]['to']['split'](',')[0x0];}return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x5a7e39[_0x4064('0x63')]['id']},'include':[{'model':db[_0x4064('0x9c')],'as':_0x4064('0x9d'),'include':[{'model':db[_0x4064('0x9e')],'as':_0x4064('0x9f'),'where':{'email':_0x1090d5},'limit':0x1,'order':[[_0x4064('0xa0'),'DESC']]}]},{'model':db[_0x4064('0x43')],'as':_0x4064('0x41'),'raw':!![],'include':[{'model':db[_0x4064('0xa1')],'as':_0x4064('0xa1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5ab0c8,null))['then'](function(_0xfb8ea){if(!_0xfb8ea)return;_0x494d51=_0xfb8ea;if(!_0xfb8ea['Smtp'])throw new Error(_0x4064('0xa2'));if(_[_0x4064('0x73')](_0x5a7e39[_0x4064('0x60')][_0x4064('0xa3')])){_0x5a7e39[_0x4064('0x60')][_0x4064('0xa3')]=util[_0x4064('0x98')]('%s\x20<%s>',_0xfb8ea[_0x4064('0x27')],_0xfb8ea[_0x4064('0x72')]||_0xfb8ea[_0x4064('0x41')]['user']);}if(_0x5a7e39['body'][_0x4064('0xa4')]&&_0x5a7e39[_0x4064('0x60')][_0x4064('0xa4')][_0x4064('0x51')]){for(var _0x1f5980=0x0;_0x1f5980<_0x5a7e39[_0x4064('0x60')][_0x4064('0xa4')]['length'];_0x1f5980+=0x1){_0x5a7e39[_0x4064('0x60')][_0x4064('0xa4')][_0x1f5980]={'filename':_0x5a7e39[_0x4064('0x60')][_0x4064('0xa4')][_0x1f5980][_0x4064('0x27')],'path':path[_0x4064('0xa5')](config['root'],_0x4064('0xa6'),_0x5a7e39[_0x4064('0x60')]['attachments'][_0x1f5980][_0x4064('0xa7')])};}}var _0x2caf30=_0xfb8ea[_0x4064('0xa8')]();return respondWithRpcPromise(_0x4064('0xa9'),'sendMail',{'account':_0x2caf30,'message':_0x5a7e39[_0x4064('0x60')]});})['then'](function(_0xf55143){if(!_0xf55143)return;_0x1f2740=_0xf55143;if(!_0x494d51[_0x4064('0x9d')])throw new Error(_0x4064('0xaa'));if(_0x494d51[_0x4064('0x9d')][_0x4064('0x9f')][_0x4064('0x51')])return _0x494d51['List'][_0x4064('0x9f')][0x0];return db['CmContact']['create'](_[_0x4064('0x8')](_0x5a7e39['body'],{'firstName':_0x5a7e39[_0x4064('0x60')]['to'],'email':_0x5a7e39[_0x4064('0x60')]['to'],'phone':_0x5a7e39['body']['to'],'ListId':_0x494d51[_0x4064('0xab')]}));})[_0x4064('0xf')](function(_0x14dd8b){if(!_0x14dd8b)return;var _0xe72d42={'UserId':_0x5a7e39['user']['id'],'ContactId':_0x14dd8b['id'],'MailAccountId':_0x494d51['id'],'inReplyTo':_0x1f2740[_0x4064('0xac')],'to':_0x5a7e39[_0x4064('0x60')][_0x4064('0xa3')],'cc':_0x5a7e39[_0x4064('0x60')]['cc'],'subject':_0x5a7e39['body'][_0x4064('0xad')],'attach':_0x5a7e39[_0x4064('0x60')][_0x4064('0xae')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x4064('0x98')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4064('0xaf'),'Messages':[_['merge'](_0x5a7e39['body'],{'messageId':_0x1f2740[_0x4064('0xac')],'sentAt':moment()[_0x4064('0x98')](_0x4064('0x99')),'read':!![],'MailAccountId':_0x494d51['id'],'UserId':_0x5a7e39[_0x4064('0x35')]['id'],'ContactId':_0x14dd8b['id']})]};if(_0x5a7e39['body'][_0x4064('0xb0')]){_0xe72d42=_['merge'](_0xe72d42,_0x5a7e39['body']['Interaction']);}return db[_0x4064('0x81')][_0x4064('0x6e')](_0xe72d42,{'include':[{'model':db[_0x4064('0x95')],'as':_0x4064('0xb1')}]});})['then'](respondWithResult(_0x5ab0c8,null))['catch'](handleError(_0x5ab0c8,null));};exports[_0x4064('0xb2')]=function(_0x51f3eb,_0x329202){return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x51f3eb[_0x4064('0x63')]['id']},'include':[{'model':db[_0x4064('0x43')],'as':_0x4064('0x41'),'raw':!![],'include':[{'model':db[_0x4064('0xa1')],'as':_0x4064('0xa1'),'raw':!![]}]}]})[_0x4064('0xf')](handleEntityNotFound(_0x329202,null))['then'](function(_0x2e3e1e){if(!_0x2e3e1e[_0x4064('0x41')])return;var _0x2977c9=_0x2e3e1e['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x4064('0xb2'),{'account':_0x2977c9});})[_0x4064('0xf')](respondWithResult(_0x329202,null))[_0x4064('0x1a')](handleError(_0x329202,null));};exports[_0x4064('0x22')]=function(_0x508ed2,_0x4e89f1){return db['MailAccount'][_0x4064('0x5f')]({'where':{'id':_0x508ed2[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x4e89f1,null))[_0x4064('0xf')](function(_0x5486b1){if(_0x5486b1&&_0x5486b1[_0x4064('0x3d')]){throw new db[(_0x4064('0xb3'))]['ValidationError'](_0x4064('0xb4'));}return _0x5486b1;})[_0x4064('0xf')](removeEntity(_0x4e89f1,null))[_0x4064('0x1a')](handleError(_0x4e89f1,null));};exports[_0x4064('0xb5')]=function(_0x14f19a,_0x54b2fe){return db[_0x4064('0x47')][_0x4064('0x5f')]({'where':{'id':_0x14f19a['params']['id']}})['then'](handleEntityNotFound(_0x54b2fe,null))['then'](function(_0x5afc6f){if(_0x5afc6f){return _0x5afc6f[_0x4064('0xb5')](_0x14f19a['body'][_0x4064('0x6c')],_['omit'](_0x14f19a[_0x4064('0x60')],[_0x4064('0x6c'),'id'])||{})[_0x4064('0xb6')](function(_0x474751){for(var _0x30eb61=0x0;_0x30eb61<_0x14f19a['body'][_0x4064('0x6c')]['length'];_0x30eb61+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x14f19a[_0x4064('0x60')]['ids'][_0x30eb61]),'MailAccountId':Number(_0x14f19a[_0x4064('0x63')]['id'])});}return _0x474751;});}})[_0x4064('0xf')](respondWithResult(_0x54b2fe,null))[_0x4064('0x1a')](handleError(_0x54b2fe,null));};exports[_0x4064('0xb7')]=function(_0x56a9df,_0x2f2a10){return db['MailAccount']['find']({'where':{'id':_0x56a9df[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x2f2a10,null))[_0x4064('0xf')](function(_0x2e4659){if(_0x2e4659){return _0x2e4659[_0x4064('0xb7')](_0x56a9df[_0x4064('0x4b')][_0x4064('0x6c')])[_0x4064('0xf')](function(){if(_[_0x4064('0xb8')](_0x56a9df[_0x4064('0x4b')][_0x4064('0x6c')])){for(var _0x324e6d=0x0;_0x324e6d<_0x56a9df[_0x4064('0x4b')][_0x4064('0x6c')][_0x4064('0x51')];_0x324e6d+=0x1){socket[_0x4064('0xb9')](_0x4064('0xba'),{'UserId':Number(_0x56a9df[_0x4064('0x4b')][_0x4064('0x6c')][_0x324e6d]),'MailAccountId':Number(_0x56a9df[_0x4064('0x63')]['id'])});}}else{socket[_0x4064('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x56a9df[_0x4064('0x4b')]['ids']),'MailAccountId':Number(_0x56a9df[_0x4064('0x63')]['id'])});}});}})[_0x4064('0xf')](respondWithStatusCode(_0x2f2a10,null))['catch'](handleError(_0x2f2a10,null));};exports['getAgents']=function(_0x50d7c6,_0x2407e9){var _0x55ac02={};var _0x3fef76={};var _0x54e75e;var _0x1c7b2f;return db[_0x4064('0x47')][_0x4064('0x70')]({'where':{'id':_0x50d7c6[_0x4064('0x63')]['id']}})[_0x4064('0xf')](handleEntityNotFound(_0x2407e9,null))[_0x4064('0xf')](function(_0x5234b2){if(_0x5234b2){_0x54e75e=_0x5234b2;_0x3fef76[_0x4064('0x4e')]=_[_0x4064('0x5d')](db['User'][_0x4064('0x48')]);_0x3fef76[_0x4064('0x4b')]=_[_0x4064('0x5d')](_0x50d7c6[_0x4064('0x4b')]);_0x3fef76[_0x4064('0x4c')]=_[_0x4064('0x4d')](_0x3fef76[_0x4064('0x4e')],_0x3fef76[_0x4064('0x4b')]);_0x55ac02[_0x4064('0x4f')]=_[_0x4064('0x4d')](_0x3fef76[_0x4064('0x4e')],qs[_0x4064('0x50')](_0x50d7c6[_0x4064('0x4b')][_0x4064('0x50')]));_0x55ac02['attributes']=_0x55ac02[_0x4064('0x4f')][_0x4064('0x51')]?_0x55ac02[_0x4064('0x4f')]:_0x3fef76[_0x4064('0x4e')];_0x55ac02['order']=qs[_0x4064('0x54')](_0x50d7c6['query'][_0x4064('0x54')]);_0x55ac02[_0x4064('0x57')]=qs[_0x4064('0x4c')](_[_0x4064('0x55')](_0x50d7c6[_0x4064('0x4b')],_0x3fef76['filters']));if(_0x50d7c6[_0x4064('0x4b')][_0x4064('0x56')]){_0x55ac02[_0x4064('0x57')]=_[_0x4064('0x58')](_0x55ac02[_0x4064('0x57')],{'$or':_[_0x4064('0x46')](_0x55ac02['attributes'],function(_0x2d85fb){var _0xb77116={};_0xb77116[_0x2d85fb]={'$like':'%'+_0x50d7c6['query']['filter']+'%'};return _0xb77116;})});}_0x55ac02=_[_0x4064('0x58')]({},_0x55ac02,_0x50d7c6[_0x4064('0x59')]);return _0x54e75e[_0x4064('0xbb')](_0x55ac02);}})['then'](function(_0x25959b){if(_0x25959b){_0x1c7b2f=_0x25959b[_0x4064('0x51')];if(!_0x50d7c6[_0x4064('0x4b')][_0x4064('0x52')]('nolimit')){_0x55ac02[_0x4064('0x1d')]=qs['limit'](_0x50d7c6[_0x4064('0x4b')]['limit']);_0x55ac02[_0x4064('0x1f')]=qs[_0x4064('0x1f')](_0x50d7c6[_0x4064('0x4b')]['offset']);}return _0x54e75e[_0x4064('0xbb')](_0x55ac02);}})[_0x4064('0xf')](function(_0x4b772c){if(_0x4b772c){return _0x4b772c?{'count':_0x1c7b2f,'rows':_0x4b772c}:null;}})[_0x4064('0xf')](respondWithResult(_0x2407e9,null))[_0x4064('0x1a')](handleError(_0x2407e9,null));}; \ No newline at end of file +var _0xab85=['yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','Pause','keys','find','body','provider','custom','describe','addDisposition','MailAccountId','Disposition','create','findOne','order','includeAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','Contacts','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','MailAccounts','stack','name','gmail','imap.gmail.com'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xab85,0x15d));var _0x5ab8=function(_0x5be621,_0x5aaf80){_0x5be621=_0x5be621-0x0;var _0x4f29cc=_0xab85[_0x5be621];return _0x4f29cc;};'use strict';var moment=require(_0x5ab8('0x0'));var BPromise=require(_0x5ab8('0x1'));var util=require(_0x5ab8('0x2'));var path=require(_0x5ab8('0x3'));var _=require(_0x5ab8('0x4'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x5ab8('0x5'));var logger=require(_0x5ab8('0x6'))(_0x5ab8('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5ab8('0x8')]=_[_0x5ab8('0x9')](config[_0x5ab8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5ab8('0xa'))(new Redis(config[_0x5ab8('0x8')]));require(_0x5ab8('0xb'))[_0x5ab8('0xc')](socket);var jayson=require(_0x5ab8('0xd'));var client=jayson[_0x5ab8('0xe')][_0x5ab8('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x207dbb,_0x443fb4,_0x20ba57,_0x2fbc9e){return new BPromise(function(_0x3cd951,_0x57354d){var _0x3489a4=_0x2fbc9e||client;return _0x3489a4['request'](_0x207dbb,_0x20ba57)[_0x5ab8('0x10')](function(_0x37285d){logger[_0x5ab8('0x11')](_0x5ab8('0x12'),_0x443fb4,_0x5ab8('0x13'));logger[_0x5ab8('0x14')](_0x5ab8('0x15'),_0x443fb4,'request\x20sent',JSON[_0x5ab8('0x16')](_0x37285d));if(_0x37285d[_0x5ab8('0x17')]){if(_0x37285d[_0x5ab8('0x17')]['code']===0x1f4){logger[_0x5ab8('0x17')](_0x5ab8('0x12'),_0x443fb4,_0x37285d[_0x5ab8('0x17')][_0x5ab8('0x18')]);return _0x57354d(_0x37285d[_0x5ab8('0x17')][_0x5ab8('0x18')]);}logger[_0x5ab8('0x17')](_0x5ab8('0x12'),_0x443fb4,_0x37285d[_0x5ab8('0x17')][_0x5ab8('0x18')]);return _0x3cd951(_0x37285d[_0x5ab8('0x17')][_0x5ab8('0x18')]);}else{logger[_0x5ab8('0x11')](_0x5ab8('0x12'),_0x443fb4,_0x5ab8('0x13'));_0x3cd951(_0x37285d[_0x5ab8('0x19')][_0x5ab8('0x18')]);}})[_0x5ab8('0x1a')](function(_0x20c162){logger[_0x5ab8('0x17')](_0x5ab8('0x12'),_0x443fb4,_0x20c162);_0x57354d(_0x20c162);});});}function respondWithStatusCode(_0x5b685f,_0x4a9ee9){_0x4a9ee9=_0x4a9ee9||0xcc;return function(_0x46ca98){if(_0x46ca98){return _0x5b685f[_0x5ab8('0x1b')](_0x4a9ee9);}return _0x5b685f[_0x5ab8('0x1c')](_0x4a9ee9)[_0x5ab8('0x1d')]();};}function respondWithResult(_0xa94765,_0x435fb1){_0x435fb1=_0x435fb1||0xc8;return function(_0x1f09b2){if(_0x1f09b2){return _0xa94765[_0x5ab8('0x1c')](_0x435fb1)[_0x5ab8('0x1e')](_0x1f09b2);}};}function respondWithFilteredResult(_0x1f1731,_0x2201ba){return function(_0x6eaa79){if(_0x6eaa79){var _0x5baaf4=typeof _0x2201ba['offset']===_0x5ab8('0x1f')&&typeof _0x2201ba[_0x5ab8('0x20')]==='undefined';var _0xad4d31=_0x6eaa79[_0x5ab8('0x21')];var _0x1d0f0c=_0x5baaf4?0x0:_0x2201ba[_0x5ab8('0x22')];var _0x17d004=_0x5baaf4?_0x6eaa79[_0x5ab8('0x21')]:_0x2201ba[_0x5ab8('0x22')]+_0x2201ba[_0x5ab8('0x20')];var _0x100f47;if(_0x17d004>=_0xad4d31){_0x17d004=_0xad4d31;_0x100f47=0xc8;}else{_0x100f47=0xce;}_0x1f1731[_0x5ab8('0x1c')](_0x100f47);return _0x1f1731[_0x5ab8('0x23')](_0x5ab8('0x24'),_0x1d0f0c+'-'+_0x17d004+'/'+_0xad4d31)[_0x5ab8('0x1e')](_0x6eaa79);}return null;};}function saveUpdates(_0x10ba90){return function(_0x21c820){if(_0x21c820){return _0x21c820[_0x5ab8('0x25')](_0x10ba90)[_0x5ab8('0x10')](function(_0x3f91b4){return _0x3f91b4;});}return null;};}function removeEntity(_0x1be55e){return function(_0x5dd3a2){if(_0x5dd3a2){return _0x5dd3a2[_0x5ab8('0x26')]()['then'](function(){var _0x15c20b=_0x5dd3a2[_0x5ab8('0x27')]({'plain':!![]});var _0x154419=_0x5ab8('0x28');return db['UserProfileResource'][_0x5ab8('0x26')]({'where':{'type':_0x154419,'resourceId':_0x15c20b['id']}})[_0x5ab8('0x10')](function(){return _0x5dd3a2;});})[_0x5ab8('0x10')](function(){_0x1be55e[_0x5ab8('0x1c')](0xcc)[_0x5ab8('0x1d')]();});}};}function handleEntityNotFound(_0x18a2b7){return function(_0x951c8f){if(!_0x951c8f){_0x18a2b7['sendStatus'](0x194);}return _0x951c8f;};}function handleError(_0x498812,_0x384887){_0x384887=_0x384887||0x1f4;return function(_0xc11986){logger['error'](_0xc11986[_0x5ab8('0x29')]);if(_0xc11986['name']){delete _0xc11986[_0x5ab8('0x2a')];}_0x498812['status'](_0x384887)['send'](_0xc11986);};}function getImapHost(_0x329056){switch(_0x329056){case _0x5ab8('0x2b'):return _0x5ab8('0x2c');case _0x5ab8('0x2d'):return _0x5ab8('0x2e');case _0x5ab8('0x2f'):return _0x5ab8('0x30');case _0x5ab8('0x31'):return _0x5ab8('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x329056);}function getSmtpHost(_0x45a23d){switch(_0x45a23d){case'gmail':return'smtp.gmail.com';case _0x5ab8('0x2d'):return _0x5ab8('0x33');case _0x5ab8('0x2f'):return _0x5ab8('0x34');case _0x5ab8('0x31'):return _0x5ab8('0x35');}throw new Error(_0x5ab8('0x36'),_0x45a23d);}function getAuthenticationOptions(_0x549357,_0x13c80b){var _0x59542b={};var _0x58e7ba={};if(_0x549357){_0x59542b['user']=_0x58e7ba[_0x5ab8('0x37')]=_0x13c80b['username'];_0x59542b[_0x5ab8('0x38')]=_0x58e7ba['pass']=_0x13c80b[_0x5ab8('0x38')];if(_0x13c80b[_0x5ab8('0x39')]){_0x59542b[_0x5ab8('0x39')]=_0x58e7ba[_0x5ab8('0x39')]=!![];_0x59542b[_0x5ab8('0x3a')]=_0x58e7ba[_0x5ab8('0x3a')]=_0x13c80b['CloudProviderId'];_0x59542b[_0x5ab8('0x38')]=_0x58e7ba[_0x5ab8('0x3b')]=null;}else{_0x59542b[_0x5ab8('0x3a')]=_0x58e7ba[_0x5ab8('0x3a')]=null;}_0x59542b['host']=getImapHost(_0x549357);_0x59542b[_0x5ab8('0x3c')]=0x3e1;_0x58e7ba[_0x5ab8('0x3d')]=getSmtpHost(_0x549357);_0x58e7ba[_0x5ab8('0x3c')]=0x24b;_0x58e7ba[_0x5ab8('0x3e')]=![];_0x59542b[_0x5ab8('0x3f')]=_0x58e7ba[_0x5ab8('0x3f')]=null;}else{if(_0x13c80b[_0x5ab8('0x40')]){_0x59542b['user']=_0x58e7ba[_0x5ab8('0x37')]=_0x13c80b[_0x5ab8('0x41')];_0x59542b['password']=_0x58e7ba[_0x5ab8('0x3b')]=_0x13c80b[_0x5ab8('0x38')];}else{_0x59542b['authentication']=_0x58e7ba[_0x5ab8('0x40')]=![];_0x59542b[_0x5ab8('0x37')]=_0x58e7ba['user']=null;_0x59542b['password']=_0x58e7ba[_0x5ab8('0x3b')]=null;}_0x59542b[_0x5ab8('0x3d')]=_0x13c80b['Imap']['host'];_0x59542b[_0x5ab8('0x3c')]=_0x13c80b[_0x5ab8('0x42')][_0x5ab8('0x3c')];_0x58e7ba[_0x5ab8('0x3d')]=_0x13c80b['Smtp']['host'];_0x58e7ba[_0x5ab8('0x3c')]=_0x13c80b[_0x5ab8('0x43')][_0x5ab8('0x3c')];}return{'Imap':_0x59542b,'Smtp':_0x58e7ba};}exports[_0x5ab8('0x44')]=function(_0x36f3a7,_0x35a05d){var _0x533fa3={'include':[{'model':db[_0x5ab8('0x45')],'as':'Imap'},{'model':db[_0x5ab8('0x46')],'as':_0x5ab8('0x43')},{'model':db['Pause'],'as':_0x5ab8('0x47')}]},_0x19c022={},_0xe0f3ee={'count':0x0,'rows':[]};var _0xb21ae3=_[_0x5ab8('0x48')](db[_0x5ab8('0x49')][_0x5ab8('0x4a')],function(_0x271764){return{'name':_0x271764[_0x5ab8('0x4b')],'type':_0x271764[_0x5ab8('0x4c')][_0x5ab8('0x4d')]};});_0x19c022[_0x5ab8('0x4e')]=_[_0x5ab8('0x48')](_0xb21ae3,_0x5ab8('0x2a'));_0x19c022['query']=_['keys'](_0x36f3a7[_0x5ab8('0x4f')]);_0x19c022[_0x5ab8('0x50')]=_['intersection'](_0x19c022[_0x5ab8('0x4e')],_0x19c022[_0x5ab8('0x4f')]);_0x533fa3[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x19c022[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x36f3a7[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x533fa3[_0x5ab8('0x51')]=_0x533fa3[_0x5ab8('0x51')][_0x5ab8('0x54')]?_0x533fa3[_0x5ab8('0x51')]:_0x19c022['model'];if(!_0x36f3a7['query'][_0x5ab8('0x55')](_0x5ab8('0x56'))){_0x533fa3[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x36f3a7[_0x5ab8('0x4f')][_0x5ab8('0x20')]);_0x533fa3[_0x5ab8('0x22')]=qs[_0x5ab8('0x22')](_0x36f3a7[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}_0x533fa3['order']=qs[_0x5ab8('0x57')](_0x36f3a7['query'][_0x5ab8('0x57')]);_0x533fa3[_0x5ab8('0x58')]=qs['filters'](_[_0x5ab8('0x59')](_0x36f3a7[_0x5ab8('0x4f')],_0x19c022[_0x5ab8('0x50')]),_0xb21ae3);if(_0x36f3a7[_0x5ab8('0x4f')][_0x5ab8('0x5a')]){_0x533fa3[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x533fa3[_0x5ab8('0x58')],{'$or':_[_0x5ab8('0x48')](_0xb21ae3,function(_0x5eb81e){if(_0x5eb81e[_0x5ab8('0x4c')]!==_0x5ab8('0x5c')){var _0xa1b2a2={};_0xa1b2a2[_0x5eb81e[_0x5ab8('0x2a')]]={'$like':'%'+_0x36f3a7[_0x5ab8('0x4f')][_0x5ab8('0x5a')]+'%'};return _0xa1b2a2;}})});}_0x533fa3=_['merge']({},_0x533fa3,_0x36f3a7[_0x5ab8('0x5d')]);var _0xb654f6={'where':_0x533fa3['where']};return db[_0x5ab8('0x49')][_0x5ab8('0x21')](_0xb654f6)[_0x5ab8('0x10')](function(_0x2b43e9){_0xe0f3ee[_0x5ab8('0x21')]=_0x2b43e9;if(_0x36f3a7['query']['includeAll']){_0x533fa3[_0x5ab8('0x5e')]=[{'all':!![]}];}return db[_0x5ab8('0x49')][_0x5ab8('0x5f')](_0x533fa3);})[_0x5ab8('0x10')](function(_0x14632b){_0xe0f3ee[_0x5ab8('0x60')]=_0x14632b;return _0xe0f3ee;})[_0x5ab8('0x10')](respondWithFilteredResult(_0x35a05d,_0x533fa3))[_0x5ab8('0x1a')](handleError(_0x35a05d,null));};exports['show']=function(_0x108b88,_0x250c8c){var _0x1d3351={'raw':![],'where':{'id':_0x108b88[_0x5ab8('0x61')]['id']},'include':[{'model':db[_0x5ab8('0x45')],'as':'Imap'},{'model':db[_0x5ab8('0x46')],'as':_0x5ab8('0x43')},{'model':db[_0x5ab8('0x62')],'as':_0x5ab8('0x47')}]},_0x6e39bd={};_0x6e39bd[_0x5ab8('0x4e')]=_[_0x5ab8('0x63')](db[_0x5ab8('0x49')][_0x5ab8('0x4a')]);_0x6e39bd[_0x5ab8('0x4f')]=_['keys'](_0x108b88[_0x5ab8('0x4f')]);_0x6e39bd['filters']=_[_0x5ab8('0x52')](_0x6e39bd[_0x5ab8('0x4e')],_0x6e39bd[_0x5ab8('0x4f')]);_0x1d3351[_0x5ab8('0x51')]=_['intersection'](_0x6e39bd[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x108b88[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x1d3351[_0x5ab8('0x51')]=_0x1d3351[_0x5ab8('0x51')][_0x5ab8('0x54')]?_0x1d3351[_0x5ab8('0x51')]:_0x6e39bd[_0x5ab8('0x4e')];if(_0x108b88[_0x5ab8('0x4f')]['includeAll']){_0x1d3351[_0x5ab8('0x5e')]=[{'all':!![]}];}_0x1d3351=_['merge']({},_0x1d3351,_0x108b88['options']);return db[_0x5ab8('0x49')][_0x5ab8('0x64')](_0x1d3351)[_0x5ab8('0x10')](handleEntityNotFound(_0x250c8c,null))[_0x5ab8('0x10')](respondWithResult(_0x250c8c,null))[_0x5ab8('0x1a')](handleError(_0x250c8c,null));};exports['update']=function(_0x6de27c,_0x20ec21){if(_0x6de27c[_0x5ab8('0x65')]['id']){delete _0x6de27c[_0x5ab8('0x65')]['id'];}var _0x312021=_0x6de27c[_0x5ab8('0x65')][_0x5ab8('0x66')]===_0x5ab8('0x67')?null:_0x6de27c[_0x5ab8('0x65')]['provider'];var _0x44fc53=_0x6de27c['body']['Imap']||{};var _0x49a49b=_0x6de27c[_0x5ab8('0x65')][_0x5ab8('0x43')]||{};if(_0x312021){_0x44fc53['host']=getImapHost(_0x312021);_0x44fc53['port']=0x3e1;_0x49a49b['host']=getSmtpHost(_0x312021);_0x49a49b[_0x5ab8('0x3c')]=0x24b;_0x49a49b[_0x5ab8('0x3e')]=![];}if(_0x49a49b[_0x5ab8('0x39')]){_0x49a49b[_0x5ab8('0x3e')]=![];}else{_0x49a49b['CloudProviderId']=null;}if(!_0x44fc53[_0x5ab8('0x39')])_0x44fc53[_0x5ab8('0x3a')]=null;_0x6de27c[_0x5ab8('0x65')]['Imap']=_0x44fc53;_0x6de27c['body'][_0x5ab8('0x43')]=_0x49a49b;return db['MailAccount'][_0x5ab8('0x64')]({'where':{'id':_0x6de27c['params']['id']},'include':[{'model':db[_0x5ab8('0x45')],'as':_0x5ab8('0x42')},{'model':db[_0x5ab8('0x46')],'as':_0x5ab8('0x43')},{'model':db[_0x5ab8('0x62')],'as':'mandatoryDispositionPause'}]})[_0x5ab8('0x10')](handleEntityNotFound(_0x20ec21,null))[_0x5ab8('0x10')](function(_0x145b9d){if(!_0x145b9d)throw new Error('Mail\x20Account\x20not\x20found');if(_0x145b9d[_0x5ab8('0x3f')])delete _0x6de27c[_0x5ab8('0x65')][_0x5ab8('0x42')];return _0x145b9d;})[_0x5ab8('0x10')](saveUpdates(_0x6de27c[_0x5ab8('0x65')],null))[_0x5ab8('0x10')](function(_0xd790ae){if(!_0x6de27c['body'][_0x5ab8('0x42')])return _0xd790ae;return db['MailServerIn'][_0x5ab8('0x25')](_0x6de27c[_0x5ab8('0x65')][_0x5ab8('0x42')],{'where':{'MailAccountId':_0xd790ae['id']}})['then'](function(){return _0xd790ae;});})[_0x5ab8('0x10')](function(_0x4a6645){if(!_0x6de27c['body']['Smtp'])return _0x4a6645;return db[_0x5ab8('0x46')][_0x5ab8('0x25')](_0x6de27c[_0x5ab8('0x65')][_0x5ab8('0x43')],{'where':{'MailAccountId':_0x4a6645['id']}})[_0x5ab8('0x10')](function(){return _0x4a6645;});})[_0x5ab8('0x10')](respondWithResult(_0x20ec21,null))[_0x5ab8('0x1a')](handleError(_0x20ec21,null));};exports[_0x5ab8('0x68')]=function(_0xb38c9,_0x117639){return db[_0x5ab8('0x49')][_0x5ab8('0x68')]()[_0x5ab8('0x10')](respondWithResult(_0x117639,null))['catch'](handleError(_0x117639,null));};exports[_0x5ab8('0x69')]=function(_0x52cebc,_0x386b5e){if(_0x52cebc[_0x5ab8('0x65')]['id']){delete _0x52cebc[_0x5ab8('0x65')]['id'];}return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x52cebc[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x386b5e,null))[_0x5ab8('0x10')](function(_0x39b351){if(_0x39b351){_0x52cebc[_0x5ab8('0x65')][_0x5ab8('0x6a')]=_0x39b351['id'];return db[_0x5ab8('0x6b')][_0x5ab8('0x6c')](_0x52cebc['body']);}})[_0x5ab8('0x10')](respondWithResult(_0x386b5e,null))['catch'](handleError(_0x386b5e,null));};exports['getDispositions']=function(_0x19d0c8,_0x545540){var _0x55472f={'raw':![],'where':{}};var _0x131572={};var _0x2cb03e={'count':0x0,'rows':[]};return db[_0x5ab8('0x49')][_0x5ab8('0x6d')]({'where':{'id':_0x19d0c8[_0x5ab8('0x61')]['id']}})['then'](handleEntityNotFound(_0x545540,null))['then'](function(_0x25e982){if(_0x25e982){_0x131572[_0x5ab8('0x4e')]=_[_0x5ab8('0x63')](db[_0x5ab8('0x6b')][_0x5ab8('0x4a')]);_0x131572[_0x5ab8('0x4f')]=_[_0x5ab8('0x63')](_0x19d0c8[_0x5ab8('0x4f')]);_0x131572['filters']=_[_0x5ab8('0x52')](_0x131572['model'],_0x131572[_0x5ab8('0x4f')]);_0x55472f[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x131572[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x19d0c8['query'][_0x5ab8('0x53')]));_0x55472f[_0x5ab8('0x51')]=_0x55472f['attributes'][_0x5ab8('0x54')]?_0x55472f[_0x5ab8('0x51')]:_0x131572[_0x5ab8('0x4e')];if(!_0x19d0c8[_0x5ab8('0x4f')]['hasOwnProperty'](_0x5ab8('0x56'))){_0x55472f[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x19d0c8['query'][_0x5ab8('0x20')]);_0x55472f[_0x5ab8('0x22')]=qs['offset'](_0x19d0c8[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}_0x55472f[_0x5ab8('0x6e')]=qs[_0x5ab8('0x57')](_0x19d0c8['query'][_0x5ab8('0x57')]);_0x55472f[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_['pick'](_0x19d0c8[_0x5ab8('0x4f')],_0x131572[_0x5ab8('0x50')]));_0x55472f[_0x5ab8('0x58')][_0x5ab8('0x6a')]=_0x25e982['id'];if(_0x19d0c8[_0x5ab8('0x4f')][_0x5ab8('0x5a')]){_0x55472f['where']=_[_0x5ab8('0x5b')](_0x55472f[_0x5ab8('0x58')],{'$or':_[_0x5ab8('0x48')](_0x55472f[_0x5ab8('0x51')],function(_0x2f4496){var _0x32f011={};_0x32f011[_0x2f4496]={'$like':'%'+_0x19d0c8[_0x5ab8('0x4f')][_0x5ab8('0x5a')]+'%'};return _0x32f011;})});}_0x55472f=_[_0x5ab8('0x5b')]({},_0x55472f,_0x19d0c8[_0x5ab8('0x5d')]);return db[_0x5ab8('0x6b')][_0x5ab8('0x21')]({'where':_0x55472f['where']})[_0x5ab8('0x10')](function(_0x13fa82){_0x2cb03e['count']=_0x13fa82;if(_0x19d0c8[_0x5ab8('0x4f')][_0x5ab8('0x6f')]){_0x55472f[_0x5ab8('0x5e')]=[{'all':!![]}];}return db[_0x5ab8('0x6b')][_0x5ab8('0x5f')](_0x55472f);})['then'](function(_0x5b0723){_0x2cb03e['rows']=_0x5b0723;return _0x2cb03e;});}})[_0x5ab8('0x10')](respondWithFilteredResult(_0x545540,_0x55472f))[_0x5ab8('0x1a')](handleError(_0x545540,null));};exports[_0x5ab8('0x70')]=function(_0x1518d4,_0x3a2c59){return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x1518d4[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x3a2c59,null))[_0x5ab8('0x10')](function(_0x2ab71b){if(_0x2ab71b){return _0x2ab71b['removeDispositions'](_0x1518d4[_0x5ab8('0x4f')][_0x5ab8('0x71')]);}})['then'](respondWithStatusCode(_0x3a2c59,null))[_0x5ab8('0x1a')](handleError(_0x3a2c59,null));};exports[_0x5ab8('0x72')]=function(_0x3f17f8,_0x277cd2){if(_0x3f17f8[_0x5ab8('0x65')]['id']){delete _0x3f17f8['body']['id'];}return db[_0x5ab8('0x49')]['find']({'where':{'id':_0x3f17f8[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x277cd2,null))[_0x5ab8('0x10')](function(_0x411219){if(_0x411219){_0x3f17f8[_0x5ab8('0x65')][_0x5ab8('0x6a')]=_0x411219['id'];return db['CannedAnswer'][_0x5ab8('0x6c')](_0x3f17f8[_0x5ab8('0x65')]);}})[_0x5ab8('0x10')](respondWithResult(_0x277cd2,null))[_0x5ab8('0x1a')](handleError(_0x277cd2,null));};exports[_0x5ab8('0x73')]=function(_0x53f077,_0x137799){var _0x3e3daf={'raw':![],'where':{}};var _0x3accdf={};var _0x464b05={'count':0x0,'rows':[]};return db[_0x5ab8('0x49')]['findOne']({'where':{'id':_0x53f077[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x137799,null))[_0x5ab8('0x10')](function(_0x41df68){if(_0x41df68){_0x3accdf[_0x5ab8('0x4e')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x3accdf[_0x5ab8('0x4f')]=_[_0x5ab8('0x63')](_0x53f077[_0x5ab8('0x4f')]);_0x3accdf[_0x5ab8('0x50')]=_[_0x5ab8('0x52')](_0x3accdf['model'],_0x3accdf['query']);_0x3e3daf[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x3accdf['model'],qs[_0x5ab8('0x53')](_0x53f077[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x3e3daf[_0x5ab8('0x51')]=_0x3e3daf[_0x5ab8('0x51')][_0x5ab8('0x54')]?_0x3e3daf[_0x5ab8('0x51')]:_0x3accdf[_0x5ab8('0x4e')];if(!_0x53f077[_0x5ab8('0x4f')]['hasOwnProperty'](_0x5ab8('0x56'))){_0x3e3daf[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x53f077[_0x5ab8('0x4f')][_0x5ab8('0x20')]);_0x3e3daf[_0x5ab8('0x22')]=qs['offset'](_0x53f077[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}_0x3e3daf[_0x5ab8('0x6e')]=qs[_0x5ab8('0x57')](_0x53f077['query'][_0x5ab8('0x57')]);_0x3e3daf[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_[_0x5ab8('0x59')](_0x53f077[_0x5ab8('0x4f')],_0x3accdf[_0x5ab8('0x50')]));_0x3e3daf[_0x5ab8('0x58')]['MailAccountId']=_0x41df68['id'];if(_0x53f077[_0x5ab8('0x4f')][_0x5ab8('0x5a')]){_0x3e3daf[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x3e3daf[_0x5ab8('0x58')],{'$or':_['map'](_0x3e3daf['attributes'],function(_0x56e7bc){var _0x520d50={};_0x520d50[_0x56e7bc]={'$like':'%'+_0x53f077[_0x5ab8('0x4f')]['filter']+'%'};return _0x520d50;})});}_0x3e3daf=_['merge']({},_0x3e3daf,_0x53f077['options']);return db[_0x5ab8('0x74')][_0x5ab8('0x21')]({'where':_0x3e3daf[_0x5ab8('0x58')]})[_0x5ab8('0x10')](function(_0x310b72){_0x464b05[_0x5ab8('0x21')]=_0x310b72;if(_0x53f077['query'][_0x5ab8('0x6f')]){_0x3e3daf[_0x5ab8('0x5e')]=[{'all':!![]}];}return db[_0x5ab8('0x74')][_0x5ab8('0x5f')](_0x3e3daf);})[_0x5ab8('0x10')](function(_0x3e8c0b){_0x464b05[_0x5ab8('0x60')]=_0x3e8c0b;return _0x464b05;});}})[_0x5ab8('0x10')](respondWithFilteredResult(_0x137799,_0x3e3daf))['catch'](handleError(_0x137799,null));};exports[_0x5ab8('0x75')]=function(_0x347b07,_0xcb6acd){return db[_0x5ab8('0x49')]['find']({'where':{'id':_0x347b07[_0x5ab8('0x61')]['id']}})['then'](handleEntityNotFound(_0xcb6acd,null))[_0x5ab8('0x10')](function(_0x15269f){if(_0x15269f){return _0x15269f[_0x5ab8('0x75')](_0x347b07['query']['ids']);}})['then'](respondWithStatusCode(_0xcb6acd,null))[_0x5ab8('0x1a')](handleError(_0xcb6acd,null));};exports['create']=function(_0x35c198,_0x5ba0d7){var _0x192f18={'name':_0x35c198[_0x5ab8('0x65')]['name'],'key':_0x35c198['body']['key'],'provider':_0x35c198['body'][_0x5ab8('0x66')]==='custom'?null:_0x35c198[_0x5ab8('0x65')][_0x5ab8('0x66')],'email':_0x35c198[_0x5ab8('0x65')][_0x5ab8('0x76')],'ListId':_0x35c198['body'][_0x5ab8('0x77')],'active':!_[_0x5ab8('0x78')](_0x35c198[_0x5ab8('0x65')]['active'])?_0x35c198[_0x5ab8('0x65')][_0x5ab8('0x79')]:!![],'description':_0x35c198[_0x5ab8('0x65')]['description']||null};var _0x45b919=getAuthenticationOptions(_0x192f18[_0x5ab8('0x66')],_0x35c198[_0x5ab8('0x65')]);_0x192f18[_0x5ab8('0x42')]=_0x45b919[_0x5ab8('0x42')];_0x192f18[_0x5ab8('0x43')]=_0x45b919[_0x5ab8('0x43')];return db[_0x5ab8('0x49')]['create'](_0x192f18,{'include':[{'model':db[_0x5ab8('0x46')],'as':_0x5ab8('0x43')},{'model':db[_0x5ab8('0x45')],'as':'Imap'}]})[_0x5ab8('0x10')](function(_0x1869c7){var _0xb28495=_0x35c198[_0x5ab8('0x37')][_0x5ab8('0x27')]({'plain':!![]});if(!_0xb28495)throw new Error(_0x5ab8('0x7a'));if(_0xb28495[_0x5ab8('0x7b')]===_0x5ab8('0x37')){var _0x9e9a75=_0x1869c7[_0x5ab8('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x5ab8('0x64')]({'where':{'name':_0x5ab8('0x28'),'userProfileId':_0xb28495[_0x5ab8('0x7c')]},'raw':!![]})[_0x5ab8('0x10')](function(_0x306c9d){if(_0x306c9d&&_0x306c9d[_0x5ab8('0x7d')]===0x0){return db[_0x5ab8('0x7e')]['create']({'name':_0x9e9a75[_0x5ab8('0x2a')],'resourceId':_0x9e9a75['id'],'type':_0x306c9d['name'],'sectionId':_0x306c9d['id']},{})[_0x5ab8('0x10')](function(){return _0x1869c7;});}else{return _0x1869c7;}})[_0x5ab8('0x1a')](function(_0x21e33e){logger[_0x5ab8('0x17')](_0x5ab8('0x7f'),_0x21e33e);throw _0x21e33e;});}return _0x1869c7;})[_0x5ab8('0x10')](respondWithResult(_0x5ba0d7,0xc9))['catch'](handleError(_0x5ba0d7,null));};exports[_0x5ab8('0x80')]=function(_0x2d93b1,_0x566a60){return db[_0x5ab8('0x49')][_0x5ab8('0x6d')]({'where':{'id':_0x2d93b1[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x566a60,null))[_0x5ab8('0x10')](function(_0x534368){if(_0x534368){return _0x534368[_0x5ab8('0x80')]();}return null;})[_0x5ab8('0x10')](respondWithResult(_0x566a60,null))['catch'](handleError(_0x566a60,null));};exports[_0x5ab8('0x81')]=function(_0x5f4200,_0x31c107){if(_0x5f4200[_0x5ab8('0x65')]['id']){delete _0x5f4200[_0x5ab8('0x65')]['id'];}return db['MailAccount'][_0x5ab8('0x64')]({'where':{'id':_0x5f4200['params']['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x31c107,null))[_0x5ab8('0x10')](function(_0x3ea333){if(_0x3ea333){_0x5f4200[_0x5ab8('0x65')][_0x5ab8('0x6a')]=_0x3ea333['id'];return db[_0x5ab8('0x45')][_0x5ab8('0x6c')](_0x5f4200[_0x5ab8('0x65')]);}})[_0x5ab8('0x10')](respondWithResult(_0x31c107,null))[_0x5ab8('0x1a')](handleError(_0x31c107,null));};exports['removeImap']=function(_0x333ac4,_0x3eba0d){return db[_0x5ab8('0x49')][_0x5ab8('0x6d')]({'where':{'id':_0x333ac4[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x3eba0d,null))[_0x5ab8('0x10')](function(_0x5ded43){if(_0x5ded43){return _0x5ded43[_0x5ab8('0x82')](null);}return null;})[_0x5ab8('0x10')](respondWithStatusCode(_0x3eba0d,null))['catch'](handleError(_0x3eba0d,null));};exports[_0x5ab8('0x83')]=function(_0xaca6a5,_0x4802a1){return db['MailAccount'][_0x5ab8('0x6d')]({'where':{'id':_0xaca6a5[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x4802a1,null))[_0x5ab8('0x10')](function(_0x395afa){if(_0x395afa){return _0x395afa['getSmtp']();}return null;})['then'](respondWithResult(_0x4802a1,null))[_0x5ab8('0x1a')](handleError(_0x4802a1,null));};exports[_0x5ab8('0x84')]=function(_0x2a7314,_0x1d1c32){if(_0x2a7314[_0x5ab8('0x65')]['id']){delete _0x2a7314['body']['id'];}return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x2a7314[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x1d1c32,null))['then'](function(_0x1583dd){if(_0x1583dd){_0x2a7314[_0x5ab8('0x65')][_0x5ab8('0x6a')]=_0x1583dd['id'];return db['MailServerOut'][_0x5ab8('0x6c')](_0x2a7314[_0x5ab8('0x65')]);}})[_0x5ab8('0x10')](respondWithResult(_0x1d1c32,null))[_0x5ab8('0x1a')](handleError(_0x1d1c32,null));};exports['removeSmtp']=function(_0x5ad586,_0x419fd7){return db[_0x5ab8('0x49')]['findOne']({'where':{'id':_0x5ad586[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x419fd7,null))[_0x5ab8('0x10')](function(_0x27baa8){if(_0x27baa8){return _0x27baa8[_0x5ab8('0x85')](null);}return null;})[_0x5ab8('0x10')](respondWithStatusCode(_0x419fd7,null))[_0x5ab8('0x1a')](handleError(_0x419fd7,null));};exports[_0x5ab8('0x86')]=function(_0x124759,_0xba5672){return db[_0x5ab8('0x87')][_0x5ab8('0x64')]({'where':{'id':_0x124759[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0xba5672,null))[_0x5ab8('0x10')](function(_0x3579d0){if(_0x3579d0){return _0x3579d0[_0x5ab8('0x86')](_0x124759[_0x5ab8('0x65')]['ids'],_[_0x5ab8('0x88')](_0x124759[_0x5ab8('0x65')],[_0x5ab8('0x71'),'id'])||{});}})[_0x5ab8('0x10')](respondWithResult(_0xba5672,null))[_0x5ab8('0x1a')](handleError(_0xba5672,null));};exports[_0x5ab8('0x89')]=function(_0x4f310a,_0x34ffe2){var _0x5ee6b0={'raw':![],'where':{}};var _0x15522f={};var _0x4907a7={'count':0x0,'rows':[]};return db['MailAccount'][_0x5ab8('0x6d')]({'where':{'id':_0x4f310a['params']['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x34ffe2,null))['then'](function(_0x11e6b2){if(_0x11e6b2){_0x15522f['model']=_[_0x5ab8('0x63')](db[_0x5ab8('0x87')][_0x5ab8('0x4a')]);_0x15522f['query']=_['keys'](_0x4f310a[_0x5ab8('0x4f')]);_0x15522f[_0x5ab8('0x50')]=_['intersection'](_0x15522f[_0x5ab8('0x4e')],_0x15522f[_0x5ab8('0x4f')]);_0x5ee6b0[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x15522f[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x4f310a['query'][_0x5ab8('0x53')]));_0x5ee6b0[_0x5ab8('0x51')]=_0x5ee6b0[_0x5ab8('0x51')][_0x5ab8('0x54')]?_0x5ee6b0[_0x5ab8('0x51')]:_0x15522f[_0x5ab8('0x4e')];if(!_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x55')](_0x5ab8('0x56'))){_0x5ee6b0[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x20')]);_0x5ee6b0[_0x5ab8('0x22')]=qs[_0x5ab8('0x22')](_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}_0x5ee6b0['order']=qs[_0x5ab8('0x57')](_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x57')]);_0x5ee6b0[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_[_0x5ab8('0x59')](_0x4f310a[_0x5ab8('0x4f')],_0x15522f[_0x5ab8('0x50')]));_0x5ee6b0[_0x5ab8('0x58')][_0x5ab8('0x6a')]=_0x11e6b2['id'];if(_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x5a')]){_0x5ee6b0[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x5ee6b0[_0x5ab8('0x58')],{'$or':_[_0x5ab8('0x48')](_0x5ee6b0[_0x5ab8('0x51')],function(_0xd87ac5){var _0x4d4431={};_0x4d4431[_0xd87ac5]={'$like':'%'+_0x4f310a['query'][_0x5ab8('0x5a')]+'%'};return _0x4d4431;})});}_0x5ee6b0=_['merge']({},_0x5ee6b0,_0x4f310a[_0x5ab8('0x5d')]);return db['MailInteraction']['count']({'where':_0x5ee6b0[_0x5ab8('0x58')]})['then'](function(_0xee862d){_0x4907a7[_0x5ab8('0x21')]=_0xee862d;if(_0x4f310a['query'][_0x5ab8('0x6f')]){_0x5ee6b0['include']=[{'model':db[_0x5ab8('0x8a')],'as':_0x5ab8('0x8b'),'required':![]},{'model':db[_0x5ab8('0x8c')],'as':_0x5ab8('0x8d'),'attributes':['name',_0x5ab8('0x8e'),_0x5ab8('0x8f')],'required':![]},{'model':db[_0x5ab8('0x90')],'as':'Tags','attributes':['id','name','color'],'where':_0x4f310a['query'][_0x5ab8('0x91')]?{'id':_0x4f310a[_0x5ab8('0x4f')]['tag']}:undefined,'required':_0x4f310a[_0x5ab8('0x4f')][_0x5ab8('0x91')]?!![]:![]}];}return db[_0x5ab8('0x87')][_0x5ab8('0x5f')](_0x5ee6b0);})['then'](function(_0x405a9e){_0x4907a7['rows']=_0x405a9e;return _0x4907a7;});}})['then'](respondWithFilteredResult(_0x34ffe2,_0x5ee6b0))[_0x5ab8('0x1a')](handleError(_0x34ffe2,null));};exports[_0x5ab8('0x92')]=function addApplications(_0x26c431,_0x2661c5){var _0x47a42f=_0x26c431[_0x5ab8('0x61')]['id'];var _0x56cf76=_0x26c431['body'];var _0xff72b=0xc8;var _0x1ccf96=null;return db[_0x5ab8('0x93')][_0x5ab8('0x94')]({'isolationLevel':db['sequelize'][_0x5ab8('0x95')][_0x5ab8('0x96')][_0x5ab8('0x97')]},function(_0x9015c0){return db[_0x5ab8('0x49')][_0x5ab8('0x6d')]({'where':{'id':_0x47a42f},'transaction':_0x9015c0})[_0x5ab8('0x10')](function(_0x161df7){if(_0x161df7){return db[_0x5ab8('0x98')]['destroy']({'where':{'MailAccountId':_0x47a42f},'transaction':_0x9015c0})[_0x5ab8('0x10')](function(){var _0x1cc403=_[_0x5ab8('0x48')](_0x56cf76,function(_0x3c38b2){_0x3c38b2[_0x5ab8('0x6a')]=_0x47a42f;return _0x3c38b2;});return db['MailApplication'][_0x5ab8('0x99')](_0x1cc403,{'transaction':_0x9015c0});});}else{_0xff72b=0x194;_0x1ccf96=[];}});})[_0x5ab8('0x10')](function(){if(_0xff72b!==0x194){return db[_0x5ab8('0x98')]['findAndCountAll']({'where':{'MailAccountId':_0x47a42f},'order':_0x5ab8('0x9a')})['then'](function(_0x502aaf){_0x1ccf96=_0x502aaf;});}})['catch'](function(_0x4f0a64){_0xff72b=0x1f4;logger['error'](_0x4f0a64[_0x5ab8('0x29')]);if(_0x4f0a64[_0x5ab8('0x2a')]){delete _0x4f0a64[_0x5ab8('0x2a')];}_0x1ccf96=_0x4f0a64;})[_0x5ab8('0x9b')](function(){if(_0x1ccf96===null){_0x2661c5['sendStatus'](_0xff72b);}else{if(_0xff72b===0x1f4){_0x2661c5[_0x5ab8('0x1c')](_0xff72b)[_0x5ab8('0x9c')](_0x1ccf96);}else{_0x2661c5[_0x5ab8('0x1c')](_0xff72b)[_0x5ab8('0x1e')](_0x1ccf96);}}});};exports[_0x5ab8('0x9d')]=function(_0x320324,_0x9fb3d4){var _0x4db22a={};var _0x440d65={};var _0x227729;var _0x3f189f;return db[_0x5ab8('0x49')]['findOne']({'where':{'id':_0x320324[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x9fb3d4,null))[_0x5ab8('0x10')](function(_0x2e4c87){if(_0x2e4c87){_0x227729=_0x2e4c87;_0x440d65[_0x5ab8('0x4e')]=_[_0x5ab8('0x63')](db['MailApplication']['rawAttributes']);_0x440d65[_0x5ab8('0x4f')]=_[_0x5ab8('0x63')](_0x320324['query']);_0x440d65[_0x5ab8('0x50')]=_[_0x5ab8('0x52')](_0x440d65[_0x5ab8('0x4e')],_0x440d65[_0x5ab8('0x4f')]);_0x4db22a[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x440d65[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x320324[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x4db22a['attributes']=_0x4db22a[_0x5ab8('0x51')][_0x5ab8('0x54')]?_0x4db22a['attributes']:_0x440d65[_0x5ab8('0x4e')];_0x4db22a[_0x5ab8('0x6e')]=qs[_0x5ab8('0x57')](_0x320324['query'][_0x5ab8('0x57')]);_0x4db22a[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_[_0x5ab8('0x59')](_0x320324['query'],_0x440d65[_0x5ab8('0x50')]));if(_0x320324[_0x5ab8('0x4f')]['filter']){_0x4db22a[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x4db22a['where'],{'$or':_['map'](_0x4db22a['attributes'],function(_0x5d3e85){var _0x5f3769={};_0x5f3769[_0x5d3e85]={'$like':'%'+_0x320324[_0x5ab8('0x4f')][_0x5ab8('0x5a')]+'%'};return _0x5f3769;})});}_0x4db22a=_[_0x5ab8('0x5b')]({},_0x4db22a,_0x320324[_0x5ab8('0x5d')]);return _0x227729[_0x5ab8('0x9d')](_0x4db22a);}})[_0x5ab8('0x10')](function(_0x4f5df0){if(_0x4f5df0){_0x3f189f=_0x4f5df0[_0x5ab8('0x54')];if(!_0x320324[_0x5ab8('0x4f')][_0x5ab8('0x55')](_0x5ab8('0x56'))){_0x4db22a[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x320324['query'][_0x5ab8('0x20')]);_0x4db22a['offset']=qs['offset'](_0x320324[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}return _0x227729[_0x5ab8('0x9d')](_0x4db22a);}})[_0x5ab8('0x10')](function(_0xf8b29f){if(_0xf8b29f){return _0xf8b29f?{'count':_0x3f189f,'rows':_0xf8b29f}:null;}})[_0x5ab8('0x10')](respondWithResult(_0x9fb3d4,null))['catch'](handleError(_0x9fb3d4,null));};exports[_0x5ab8('0x9e')]=function(_0x1e4718,_0x559573){var _0x203e4a={'raw':!![],'where':{}};var _0x1a20b4={};var _0x2fe540={'count':0x0,'rows':[]};return db[_0x5ab8('0x49')]['findOne']({'where':{'id':_0x1e4718[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x559573,null))['then'](function(_0x231c35){if(_0x231c35){_0x1a20b4[_0x5ab8('0x4e')]=_['keys'](db[_0x5ab8('0x9f')][_0x5ab8('0x4a')]);_0x1a20b4[_0x5ab8('0x4f')]=_['keys'](_0x1e4718[_0x5ab8('0x4f')]);_0x1a20b4[_0x5ab8('0x50')]=_[_0x5ab8('0x52')](_0x1a20b4[_0x5ab8('0x4e')],_0x1a20b4[_0x5ab8('0x4f')]);_0x203e4a[_0x5ab8('0x51')]=_[_0x5ab8('0x52')](_0x1a20b4[_0x5ab8('0x4e')],qs['fields'](_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x203e4a[_0x5ab8('0x51')]=_0x203e4a[_0x5ab8('0x51')]['length']?_0x203e4a[_0x5ab8('0x51')]:_0x1a20b4[_0x5ab8('0x4e')];if(!_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0x55')](_0x5ab8('0x56'))){_0x203e4a[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0x20')]);_0x203e4a[_0x5ab8('0x22')]=qs[_0x5ab8('0x22')](_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}_0x203e4a[_0x5ab8('0x6e')]=qs['sort'](_0x1e4718[_0x5ab8('0x4f')]['sort']);_0x203e4a[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_[_0x5ab8('0x59')](_0x1e4718[_0x5ab8('0x4f')],_0x1a20b4[_0x5ab8('0x50')]));_0x203e4a[_0x5ab8('0x58')][_0x5ab8('0x6a')]=_0x231c35['id'];if(_0x1e4718['query'][_0x5ab8('0x5a')]){_0x203e4a['where']=_['merge'](_0x203e4a[_0x5ab8('0x58')],{'$or':_[_0x5ab8('0x48')](_0x203e4a[_0x5ab8('0x51')],function(_0x42abb9){var _0x2f3686={};_0x2f3686[_0x42abb9]={'$like':'%'+_0x1e4718[_0x5ab8('0x4f')]['filter']+'%'};return _0x2f3686;})});}if(_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0xa0')]){var _0x1dd17a=_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0xa0')][_0x5ab8('0xa1')](',');var _0x53e16a={};_0x53e16a[_0x1dd17a[0x0]]={'$gte':moment(_0x1dd17a[0x1])[_0x5ab8('0xa2')](_0x5ab8('0xa3'))};_0x203e4a[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x203e4a[_0x5ab8('0x58')],_0x53e16a);}_0x203e4a=_[_0x5ab8('0x5b')]({},_0x203e4a,_0x1e4718['options']);return db[_0x5ab8('0x9f')][_0x5ab8('0x21')]({'where':_0x203e4a[_0x5ab8('0x58')]})[_0x5ab8('0x10')](function(_0x1115f3){_0x2fe540['count']=_0x1115f3;if(_0x1e4718[_0x5ab8('0x4f')][_0x5ab8('0x6f')]){_0x203e4a['include']=[{'all':!![]}];}return db[_0x5ab8('0x9f')][_0x5ab8('0x5f')](_0x203e4a);})[_0x5ab8('0x10')](function(_0x4dfc39){if(_0x1e4718['query'][_0x5ab8('0xa4')]===_0x5ab8('0xa5')){for(var _0x2f14b5=0x0;_0x2f14b5<_0x4dfc39[_0x5ab8('0x54')];_0x2f14b5++){_0x4dfc39[_0x2f14b5][_0x5ab8('0x65')]=juice(_0x4dfc39[_0x2f14b5][_0x5ab8('0x65')]);}}_0x2fe540[_0x5ab8('0x60')]=_0x4dfc39;return _0x2fe540;});}})['then'](respondWithFilteredResult(_0x559573,_0x203e4a))[_0x5ab8('0x1a')](handleError(_0x559573,null));};exports[_0x5ab8('0x9c')]=function(_0x1ecca1,_0x4a5f07){var _0xe3b508,_0x53b09d={},_0x35d0cb;if(_0x1ecca1[_0x5ab8('0x65')]['to']){_0x35d0cb=_0x1ecca1['body']['to'][_0x5ab8('0xa1')](',')[0x0];}return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x1ecca1[_0x5ab8('0x61')]['id']},'include':[{'model':db[_0x5ab8('0xa6')],'as':_0x5ab8('0xa7'),'include':[{'model':db[_0x5ab8('0x8a')],'as':'Contacts','where':{'email':_0x35d0cb},'limit':0x1,'order':[[_0x5ab8('0xa8'),_0x5ab8('0xa9')]]}]},{'model':db[_0x5ab8('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x5ab8('0xaa'),'raw':!![]}]}]})[_0x5ab8('0x10')](handleEntityNotFound(_0x4a5f07,null))[_0x5ab8('0x10')](function(_0x6fb386){if(!_0x6fb386)return;_0xe3b508=_0x6fb386;if(!_0x6fb386[_0x5ab8('0x43')])throw new Error(_0x5ab8('0xab'));if(_[_0x5ab8('0x78')](_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xac')])){_0x1ecca1[_0x5ab8('0x65')]['from']=util[_0x5ab8('0xa2')](_0x5ab8('0xad'),_0x6fb386[_0x5ab8('0x2a')],_0x6fb386[_0x5ab8('0x76')]||_0x6fb386[_0x5ab8('0x43')][_0x5ab8('0x37')]);}if(_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xae')]&&_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xae')][_0x5ab8('0x54')]){for(var _0x4e20a7=0x0;_0x4e20a7<_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xae')][_0x5ab8('0x54')];_0x4e20a7+=0x1){_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xae')][_0x4e20a7]={'filename':_0x1ecca1['body']['attachments'][_0x4e20a7]['name'],'path':path[_0x5ab8('0xaf')](config['root'],_0x5ab8('0xb0'),_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xae')][_0x4e20a7]['basename'])};}}var _0x59e9ca=_0x6fb386[_0x5ab8('0xb1')]();return respondWithRpcPromise(_0x5ab8('0xb2'),'sendMail',{'account':_0x59e9ca,'message':_0x1ecca1[_0x5ab8('0x65')]});})[_0x5ab8('0x10')](function(_0x41fc33){if(!_0x41fc33)return;_0x53b09d=_0x41fc33;if(!_0xe3b508[_0x5ab8('0xa7')])throw new Error(_0x5ab8('0xb3'));if(_0xe3b508[_0x5ab8('0xa7')][_0x5ab8('0xb4')][_0x5ab8('0x54')])return _0xe3b508[_0x5ab8('0xa7')][_0x5ab8('0xb4')][0x0];return db[_0x5ab8('0x8a')]['create'](_[_0x5ab8('0x9')](_0x1ecca1['body'],{'firstName':_0x1ecca1['body']['to'],'email':_0x1ecca1['body']['to'],'phone':_0x1ecca1['body']['to'],'ListId':_0xe3b508['ListId']}));})['then'](function(_0x507bb0){if(!_0x507bb0)return;var _0x190aac={'UserId':_0x1ecca1[_0x5ab8('0x37')]['id'],'ContactId':_0x507bb0['id'],'MailAccountId':_0xe3b508['id'],'inReplyTo':_0x53b09d[_0x5ab8('0xb5')],'to':_0x1ecca1['body'][_0x5ab8('0xac')],'cc':_0x1ecca1['body']['cc'],'subject':_0x1ecca1['body'][_0x5ab8('0xb6')],'attach':_0x1ecca1[_0x5ab8('0x65')]['attach'],'firstMsgDirection':_0x5ab8('0xb7'),'lastMsgAt':moment()[_0x5ab8('0xa2')](_0x5ab8('0xa3')),'lastMsgDirection':_0x5ab8('0xb7'),'Messages':[_['merge'](_0x1ecca1[_0x5ab8('0x65')],{'messageId':_0x53b09d[_0x5ab8('0xb5')],'sentAt':moment()['format'](_0x5ab8('0xa3')),'read':!![],'MailAccountId':_0xe3b508['id'],'UserId':_0x1ecca1[_0x5ab8('0x37')]['id'],'ContactId':_0x507bb0['id']})]};if(_0x1ecca1[_0x5ab8('0x65')][_0x5ab8('0xb8')]){_0x190aac=_[_0x5ab8('0x5b')](_0x190aac,_0x1ecca1['body']['Interaction']);}return db[_0x5ab8('0x87')][_0x5ab8('0x6c')](_0x190aac,{'include':[{'model':db[_0x5ab8('0x9f')],'as':'Messages'}]});})[_0x5ab8('0x10')](respondWithResult(_0x4a5f07,null))['catch'](handleError(_0x4a5f07,null));};exports[_0x5ab8('0xb9')]=function(_0x11f4f6,_0x48ad36){return db['MailAccount'][_0x5ab8('0x64')]({'where':{'id':_0x11f4f6['params']['id']},'include':[{'model':db[_0x5ab8('0x46')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5ab8('0xaa')],'as':_0x5ab8('0xaa'),'raw':!![]}]}]})[_0x5ab8('0x10')](handleEntityNotFound(_0x48ad36,null))['then'](function(_0x5c6c58){if(!_0x5c6c58[_0x5ab8('0x43')])return;var _0x243658=_0x5c6c58['getSmtpOptions']();return respondWithRpcPromise(_0x5ab8('0xba'),'verifySmtp',{'account':_0x243658});})[_0x5ab8('0x10')](respondWithResult(_0x48ad36,null))[_0x5ab8('0x1a')](handleError(_0x48ad36,null));};exports[_0x5ab8('0x26')]=function(_0xa7d0c6,_0x385bba){return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0xa7d0c6[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x385bba,null))[_0x5ab8('0x10')](function(_0xf02b28){if(_0xf02b28&&_0xf02b28[_0x5ab8('0x3f')]){throw new db[(_0x5ab8('0xbb'))][(_0x5ab8('0xbc'))](_0x5ab8('0xbd'));}return _0xf02b28;})[_0x5ab8('0x10')](removeEntity(_0x385bba,null))[_0x5ab8('0x1a')](handleError(_0x385bba,null));};exports['addAgents']=function(_0x9da43b,_0x4e7839){return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x9da43b[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x4e7839,null))['then'](function(_0x44caec){if(_0x44caec){return _0x44caec[_0x5ab8('0xbe')](_0x9da43b[_0x5ab8('0x65')][_0x5ab8('0x71')],_['omit'](_0x9da43b[_0x5ab8('0x65')],[_0x5ab8('0x71'),'id'])||{})['spread'](function(_0xe1076f){for(var _0x111319=0x0;_0x111319<_0x9da43b[_0x5ab8('0x65')]['ids'][_0x5ab8('0x54')];_0x111319+=0x1){socket['emit'](_0x5ab8('0xbf'),{'UserId':Number(_0x9da43b[_0x5ab8('0x65')][_0x5ab8('0x71')][_0x111319]),'MailAccountId':Number(_0x9da43b[_0x5ab8('0x61')]['id'])});}return _0xe1076f;});}})[_0x5ab8('0x10')](respondWithResult(_0x4e7839,null))[_0x5ab8('0x1a')](handleError(_0x4e7839,null));};exports['removeAgents']=function(_0x2fc8c8,_0xa416eb){return db[_0x5ab8('0x49')][_0x5ab8('0x64')]({'where':{'id':_0x2fc8c8[_0x5ab8('0x61')]['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0xa416eb,null))[_0x5ab8('0x10')](function(_0x1dc482){if(_0x1dc482){return _0x1dc482[_0x5ab8('0xc0')](_0x2fc8c8[_0x5ab8('0x4f')][_0x5ab8('0x71')])[_0x5ab8('0x10')](function(){if(_[_0x5ab8('0xc1')](_0x2fc8c8[_0x5ab8('0x4f')][_0x5ab8('0x71')])){for(var _0x16d38e=0x0;_0x16d38e<_0x2fc8c8[_0x5ab8('0x4f')][_0x5ab8('0x71')][_0x5ab8('0x54')];_0x16d38e+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2fc8c8['query'][_0x5ab8('0x71')][_0x16d38e]),'MailAccountId':Number(_0x2fc8c8[_0x5ab8('0x61')]['id'])});}}else{socket[_0x5ab8('0xc2')](_0x5ab8('0xc3'),{'UserId':Number(_0x2fc8c8['query'][_0x5ab8('0x71')]),'MailAccountId':Number(_0x2fc8c8[_0x5ab8('0x61')]['id'])});}});}})[_0x5ab8('0x10')](respondWithStatusCode(_0xa416eb,null))['catch'](handleError(_0xa416eb,null));};exports['getAgents']=function(_0x2eb675,_0x233dbb){var _0x436423={};var _0x2235d6={};var _0x257398;var _0x133f4d;return db['MailAccount'][_0x5ab8('0x6d')]({'where':{'id':_0x2eb675['params']['id']}})[_0x5ab8('0x10')](handleEntityNotFound(_0x233dbb,null))[_0x5ab8('0x10')](function(_0x241c8e){if(_0x241c8e){_0x257398=_0x241c8e;_0x2235d6[_0x5ab8('0x4e')]=_[_0x5ab8('0x63')](db[_0x5ab8('0x8c')][_0x5ab8('0x4a')]);_0x2235d6['query']=_[_0x5ab8('0x63')](_0x2eb675['query']);_0x2235d6['filters']=_[_0x5ab8('0x52')](_0x2235d6[_0x5ab8('0x4e')],_0x2235d6['query']);_0x436423[_0x5ab8('0x51')]=_['intersection'](_0x2235d6[_0x5ab8('0x4e')],qs[_0x5ab8('0x53')](_0x2eb675[_0x5ab8('0x4f')][_0x5ab8('0x53')]));_0x436423['attributes']=_0x436423[_0x5ab8('0x51')]['length']?_0x436423[_0x5ab8('0x51')]:_0x2235d6['model'];_0x436423[_0x5ab8('0x6e')]=qs[_0x5ab8('0x57')](_0x2eb675[_0x5ab8('0x4f')]['sort']);_0x436423[_0x5ab8('0x58')]=qs[_0x5ab8('0x50')](_['pick'](_0x2eb675[_0x5ab8('0x4f')],_0x2235d6[_0x5ab8('0x50')]));if(_0x2eb675[_0x5ab8('0x4f')][_0x5ab8('0x5a')]){_0x436423[_0x5ab8('0x58')]=_[_0x5ab8('0x5b')](_0x436423[_0x5ab8('0x58')],{'$or':_[_0x5ab8('0x48')](_0x436423[_0x5ab8('0x51')],function(_0x3ddb23){var _0x158174={};_0x158174[_0x3ddb23]={'$like':'%'+_0x2eb675[_0x5ab8('0x4f')]['filter']+'%'};return _0x158174;})});}_0x436423=_[_0x5ab8('0x5b')]({},_0x436423,_0x2eb675[_0x5ab8('0x5d')]);return _0x257398[_0x5ab8('0xc4')](_0x436423);}})[_0x5ab8('0x10')](function(_0x5889a3){if(_0x5889a3){_0x133f4d=_0x5889a3[_0x5ab8('0x54')];if(!_0x2eb675[_0x5ab8('0x4f')][_0x5ab8('0x55')](_0x5ab8('0x56'))){_0x436423[_0x5ab8('0x20')]=qs[_0x5ab8('0x20')](_0x2eb675[_0x5ab8('0x4f')][_0x5ab8('0x20')]);_0x436423['offset']=qs[_0x5ab8('0x22')](_0x2eb675[_0x5ab8('0x4f')][_0x5ab8('0x22')]);}return _0x257398[_0x5ab8('0xc4')](_0x436423);}})[_0x5ab8('0x10')](function(_0x287104){if(_0x287104){return _0x287104?{'count':_0x133f4d,'rows':_0x287104}:null;}})['then'](respondWithResult(_0x233dbb,null))[_0x5ab8('0x1a')](handleError(_0x233dbb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 67eb34d..9ab67eb 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 _0x63f1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0xcc5d8f,_0x3ad5b8){var _0x545741=function(_0x274219){while(--_0x274219){_0xcc5d8f['push'](_0xcc5d8f['shift']());}};_0x545741(++_0x3ad5b8);}(_0x63f1,0x1da));var _0x163f=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x63f1[_0x3070dc];return _0x431489;};'use strict';var EventEmitter=require(_0x163f('0x0'));var MailAccount=require(_0x163f('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x163f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x163f('0x3'),'afterDestroy':_0x163f('0x4')};function emitEvent(_0x48cffd){return function(_0x2b49d9,_0x282f1c,_0x5c0cad){MailAccountEvents[_0x163f('0x5')](_0x48cffd+':'+_0x2b49d9['id'],_0x2b49d9);MailAccountEvents[_0x163f('0x5')](_0x48cffd,_0x2b49d9);_0x5c0cad(null);};}for(var e in events){if(events[_0x163f('0x6')](e)){var event=events[e];MailAccount[_0x163f('0x7')](e,emitEvent(event));}}module[_0x163f('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xf9e5=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','MailAccount'];(function(_0x5e2eb5,_0x3f4e6c){var _0x180baf=function(_0x3e97d1){while(--_0x3e97d1){_0x5e2eb5['push'](_0x5e2eb5['shift']());}};_0x180baf(++_0x3f4e6c);}(_0xf9e5,0x89));var _0x5f9e=function(_0x198b6d,_0x1cd7ee){_0x198b6d=_0x198b6d-0x0;var _0x45b166=_0xf9e5[_0x198b6d];return _0x45b166;};'use strict';var EventEmitter=require(_0x5f9e('0x0'));var MailAccount=require(_0x5f9e('0x1'))['db'][_0x5f9e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5f9e('0x3')](0x0);var events={'afterCreate':_0x5f9e('0x4'),'afterUpdate':_0x5f9e('0x5'),'afterDestroy':_0x5f9e('0x6')};function emitEvent(_0x4e7665){return function(_0x15b4ed,_0x25c34c,_0x596261){MailAccountEvents[_0x5f9e('0x7')](_0x4e7665+':'+_0x15b4ed['id'],_0x15b4ed);MailAccountEvents['emit'](_0x4e7665,_0x15b4ed);_0x596261(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x5f9e('0x8')](e,emitEvent(event));}}module[_0x5f9e('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 7f21688..831d0af 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 _0x7d1b=['Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','CloudProvider','data5','auth','./mailAccount.attributes','exports','mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication'];(function(_0x5a979b,_0x17a473){var _0x1abd9a=function(_0x48e37c){while(--_0x48e37c){_0x5a979b['push'](_0x5a979b['shift']());}};_0x1abd9a(++_0x17a473);}(_0x7d1b,0x149));var _0xb7d1=function(_0x1d5365,_0x4f2b67){_0x1d5365=_0x1d5365-0x0;var _0x1faf4d=_0x7d1b[_0x1d5365];return _0x1faf4d;};'use strict';var attributes=require(_0xb7d1('0x0'));module[_0xb7d1('0x1')]=function(_0x420c9b){return _0x420c9b['define']('MailAccount',attributes,{'tableName':_0xb7d1('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x47be09=this;var _0xe719c6={'id':_0x47be09['id'],'tls':{'rejectUnauthorized':![]}};if(_0x47be09[_0xb7d1('0x3')]!==_0xb7d1('0x4')){_0xe719c6[_0xb7d1('0x5')]=_0x47be09[_0xb7d1('0x3')];}else{_0xe719c6['host']=_0x47be09['Smtp'][_0xb7d1('0x6')];_0xe719c6[_0xb7d1('0x7')]=_0x47be09[_0xb7d1('0x8')][_0xb7d1('0x7')];_0xe719c6[_0xb7d1('0x9')]=_0x47be09[_0xb7d1('0x8')][_0xb7d1('0x9')];}if(_0x47be09[_0xb7d1('0x8')][_0xb7d1('0xa')]){if(_0x47be09['Smtp']['modernAuthentication']){if(!_0x47be09['Smtp']['CloudProvider'])throw new Error(_0xb7d1('0xb'));_0xe719c6['auth']={'type':_0xb7d1('0xc'),'user':_0x47be09[_0xb7d1('0x8')][_0xb7d1('0xd')],'accessToken':_0x47be09[_0xb7d1('0x8')][_0xb7d1('0xe')][_0xb7d1('0xf')]};}else{_0xe719c6[_0xb7d1('0x10')]={'user':_0x47be09[_0xb7d1('0x8')][_0xb7d1('0xd')],'pass':_0x47be09['Smtp']['pass']};}}return _0xe719c6;}}});}; \ No newline at end of file +var _0x3838=['port','secure','authentication','modernAuthentication','CloudProvider','auth','OAuth2','user','pass','MailAccount','mail_accounts','provider','custom','service','host','Smtp'];(function(_0xc5fc99,_0x1563d2){var _0x33c71a=function(_0x83a4e9){while(--_0x83a4e9){_0xc5fc99['push'](_0xc5fc99['shift']());}};_0x33c71a(++_0x1563d2);}(_0x3838,0x1e9));var _0x8383=function(_0x4a7637,_0x4c4f80){_0x4a7637=_0x4a7637-0x0;var _0x2934db=_0x3838[_0x4a7637];return _0x2934db;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x26cdb2){return _0x26cdb2['define'](_0x8383('0x0'),attributes,{'tableName':_0x8383('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3b157=this;var _0x4c6525={'id':_0x3b157['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b157[_0x8383('0x2')]!==_0x8383('0x3')){_0x4c6525[_0x8383('0x4')]=_0x3b157[_0x8383('0x2')];}else{_0x4c6525[_0x8383('0x5')]=_0x3b157[_0x8383('0x6')][_0x8383('0x5')];_0x4c6525[_0x8383('0x7')]=_0x3b157['Smtp'][_0x8383('0x7')];_0x4c6525['secure']=_0x3b157[_0x8383('0x6')][_0x8383('0x8')];}if(_0x3b157[_0x8383('0x6')][_0x8383('0x9')]){if(_0x3b157[_0x8383('0x6')][_0x8383('0xa')]){if(!_0x3b157['Smtp'][_0x8383('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4c6525[_0x8383('0xc')]={'type':_0x8383('0xd'),'user':_0x3b157[_0x8383('0x6')][_0x8383('0xe')],'accessToken':_0x3b157[_0x8383('0x6')]['CloudProvider']['data5']};}else{_0x4c6525[_0x8383('0xc')]={'user':_0x3b157['Smtp'][_0x8383('0xe')],'pass':_0x3b157[_0x8383('0x6')][_0x8383('0xf')]};}}return _0x4c6525;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3f9d3a2..570fc26 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 _0xc2c7=['defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','raw','options','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','DESC','MailApplication','Smtp','CloudProvider','get','omit','Applications','applications','orderBy','asc','autoclose','push','close','Contacts','length','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x59464b,_0x153962){var _0x319d80=function(_0x2018c1){while(--_0x2018c1){_0x59464b['push'](_0x59464b['shift']());}};_0x319d80(++_0x153962);}(_0xc2c7,0x134));var _0x7c2c=function(_0x3a1cf0,_0x102485){_0x3a1cf0=_0x3a1cf0-0x0;var _0x414f57=_0xc2c7[_0x3a1cf0];return _0x414f57;};'use strict';var _=require('lodash');var moment=require(_0x7c2c('0x0'));var BPromise=require(_0x7c2c('0x1'));var rs=require(_0x7c2c('0x2'));var Redis=require(_0x7c2c('0x3'));var db=require(_0x7c2c('0x4'))['db'];var logger=require(_0x7c2c('0x5'))(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c2c('0x8')]({'port':0x232c});config[_0x7c2c('0x9')]=_[_0x7c2c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2c('0x9')]));require(_0x7c2c('0xb'))[_0x7c2c('0xc')](socket);function respondWithRpcPromise(_0x3b780b,_0x279cff,_0x57b107){return new BPromise(function(_0x3093d2,_0x307bec){return client[_0x7c2c('0xd')](_0x3b780b,_0x57b107)[_0x7c2c('0xe')](function(_0x2587ec){logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x279cff,_0x7c2c('0x11'));logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x279cff,_0x7c2c('0x11'),JSON[_0x7c2c('0x14')](_0x2587ec));if(_0x2587ec[_0x7c2c('0x15')]){if(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x16')]===0x1f4){logger[_0x7c2c('0x15')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x2587ec['error'][_0x7c2c('0x17')]);return _0x307bec(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x17')]);}logger['error'](_0x7c2c('0x10'),_0x279cff,_0x2587ec[_0x7c2c('0x15')]['message']);return _0x3093d2(_0x2587ec[_0x7c2c('0x15')]['message']);}else{logger[_0x7c2c('0xf')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x7c2c('0x11'));_0x3093d2(_0x2587ec[_0x7c2c('0x18')][_0x7c2c('0x17')]);}})[_0x7c2c('0x19')](function(_0x17df4a){logger[_0x7c2c('0x15')](_0x7c2c('0x10'),_0x279cff,_0x17df4a);_0x307bec(_0x17df4a);});});}exports[_0x7c2c('0x1a')]=function(_0x2d356e){var _0x39c5f3=this;return new Promise(function(_0x40eaef,_0x2381b4){return db['MailAccount'][_0x7c2c('0x1b')]({'raw':_0x2d356e['options']?_0x2d356e['options'][_0x7c2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1e')]||null:null,'attributes':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'limit':_0x2d356e['options']?_0x2d356e[_0x7c2c('0x1d')]['limit']||null:null,'include':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x2d356e[_0x7c2c('0x1d')]['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x22')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1f')],'include':_0x4d6ec7[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x4d6ec7[_0x7c2c('0x20')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x22')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes'],'include':_0xa8e145[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0xa8e145[_0x7c2c('0x20')],function(_0x22d03f){return{'model':db[_0x22d03f[_0x7c2c('0x22')]],'as':_0x22d03f['as'],'attributes':_0x22d03f[_0x7c2c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0x26f472){logger[_0x7c2c('0xf')]('GetMailAccount',_0x2d356e);logger[_0x7c2c('0x12')](_0x7c2c('0x1a'),_0x2d356e,JSON[_0x7c2c('0x14')](_0x26f472));_0x40eaef(_0x26f472);})[_0x7c2c('0x19')](function(_0x53ad23){logger[_0x7c2c('0x15')](_0x7c2c('0x1a'),_0x53ad23[_0x7c2c('0x17')],_0x2d356e);_0x2381b4(_0x39c5f3[_0x7c2c('0x15')](0x1f4,_0x53ad23[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x23')]=function(_0x463ef7){var _0x57af44=this;return new Promise(function(_0x1969f4,_0x1acf75){return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'raw':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['raw']===undefined?!![]:![]:!![],'where':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['where']||null:null,'attributes':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'include':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x20')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x22')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1f')],'include':_0x204968[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x204968[_0x7c2c('0x20')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x22')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1f')],'include':_0x3230a1['include']?_['map'](_0x3230a1[_0x7c2c('0x20')],function(_0x4acc5d){return{'model':db[_0x4acc5d['model']],'as':_0x4acc5d['as'],'attributes':_0x4acc5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0xc77f11){if(_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x26')]===!![])_0xc77f11[_0x7c2c('0x27')](_0x7c2c('0x28'),_0xc77f11[_0x7c2c('0x29')]());logger[_0x7c2c('0xf')](_0x7c2c('0x23'),_0x463ef7);logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x463ef7,JSON['stringify'](_0xc77f11));_0x1969f4(_0xc77f11);})['catch'](function(_0x3920b6){logger[_0x7c2c('0x15')](_0x7c2c('0x23'),_0x3920b6[_0x7c2c('0x17')],_0x463ef7);_0x1acf75(_0x57af44['error'](0x1f4,_0x3920b6[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x2a')]=function(_0x93e2a8){var _0x45fddf=this;return new Promise(function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'body':_0x93e2a8[_0x7c2c('0x2b')],'channel':_0x7c2c('0x2c')};var _0x4e1f79=_[_0x7c2c('0x2d')](_['keys'](db[_0x7c2c('0x2e')][_0x7c2c('0x2f')]),['createdAt',_0x7c2c('0x30'),'CompanyId',_0x7c2c('0x31')]);var _0x33b2be=![];if(_0x93e2a8[_0x7c2c('0x2b')]['id']){delete _0x93e2a8[_0x7c2c('0x2b')]['id'];}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')]['from'])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x32')));}if(_[_0x7c2c('0x33')](_0x93e2a8[_0x7c2c('0x2b')]['body'])||_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x2b')]===''){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x34')));}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}if(!_[_0x7c2c('0x36')](_0x4e1f79,_0x93e2a8[_0x7c2c('0x2b')]['mapKey'])){return _0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}var _0x51e3b7={};_0x51e3b7[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'where':{'id':_0x93e2a8[_0x7c2c('0x38')]['id']},'include':[{'model':db[_0x7c2c('0x39')],'as':_0x7c2c('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51e3b7,'limit':0x1,'order':[[_0x7c2c('0x30'),_0x7c2c('0x3b')]]}]},{'model':db[_0x7c2c('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7c2c('0x3d'),'include':[{'model':db[_0x7c2c('0x3e')],'as':_0x7c2c('0x3e')}]}]})[_0x7c2c('0xe')](function(_0x5f3de8){if(_0x5f3de8&&_0x5f3de8['List']){var _0x587667=_0x5f3de8[_0x7c2c('0x3f')]({'plain':!![]});_0x12c9cd[_0x7c2c('0x38')]=_[_0x7c2c('0x40')](_0x587667,[_0x7c2c('0x41'),_0x7c2c('0x3a')]);_0x12c9cd['account'][_0x7c2c('0x28')]=_0x5f3de8[_0x7c2c('0x29')]();_0x12c9cd['applications']=_0x587667[_0x7c2c('0x41')];_0x12c9cd['list']=_0x587667[_0x7c2c('0x3a')];_0x12c9cd[_0x7c2c('0x42')]=_[_0x7c2c('0x43')](_0x12c9cd['applications'],['priority'],[_0x7c2c('0x44')]);if(_0x12c9cd['account']&&_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x45')]){_0x12c9cd['applications'][_0x7c2c('0x46')]({'id':0x0,'priority':_0x12c9cd[_0x7c2c('0x42')]['length']+0x1,'app':_0x7c2c('0x47'),'appdata':_0x7c2c('0x45'),'interval':'*,*,*,*'});}if(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x41')]){delete _0x12c9cd[_0x7c2c('0x38')]['Applications'];}if(_0x12c9cd[_0x7c2c('0x38')]['List']){delete _0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x3a')];}if(_0x587667['List'][_0x7c2c('0x48')][_0x7c2c('0x49')]){return _0x587667[_0x7c2c('0x3a')][_0x7c2c('0x48')][0x0];}var _0x481b9e=_[_0x7c2c('0xa')](_0x93e2a8[_0x7c2c('0x2b')],{'firstName':_0x93e2a8['body'][_0x7c2c('0x37')],'ListId':_0x587667['ListId']});_0x481b9e[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x2e')]['create'](_0x481b9e);}else{throw new Error(_0x7c2c('0x4a'));}})[_0x7c2c('0xe')](function(_0x4c4661){_0x12c9cd['contact']=_0x4c4661;if(_0x4c4661){if(!_0x93e2a8['body'][_0x7c2c('0x17')]['messageId']){_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x4b')]=rs[_0x7c2c('0x4c')]()+'\x20'+_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x37')];}var _0x1ee34d={'ContactId':_0x4c4661['id'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'inReplyTo':_0x93e2a8[_0x7c2c('0x2b')]['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8[_0x7c2c('0x2b')]['message']['attach'],'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7c2c('0x25')]({'where':{'closed':![],'MailAccountId':_0x93e2a8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x7c2c('0x50'),'attributes':[_0x7c2c('0x4b')],'where':{'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x51')]}}]})[_0x7c2c('0xe')](function(_0x2d4459){if(_0x2d4459){return[_0x2d4459,![]];}return db[_0x7c2c('0x52')][_0x7c2c('0x53')](_0x1ee34d)[_0x7c2c('0xe')](function(_0xd01d59){return[_0xd01d59,!![]];});});}else{throw new Error(_0x7c2c('0x54'));}})[_0x7c2c('0x55')](function(_0x3d44f8,_0x559005){if(_0x3d44f8){_0x33b2be=_0x559005;if(!_0x559005){return _0x3d44f8[_0x7c2c('0x56')]({'inReplyTo':_0x93e2a8['body']['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['subject'],'attach':_0x3d44f8[_0x7c2c('0x57')]?_0x3d44f8[_0x7c2c('0x57')]:_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x57')],'substatus':null,'substatusAt':moment()[_0x7c2c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'});}else{return _0x3d44f8;}}})['then'](function(_0x39d319){_0x12c9cd[_0x7c2c('0x58')]=_0x39d319['get']({'plain':!![]});_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x59')]=_0x33b2be;return db['MailMessage']['create']({'body':_0x93e2a8[_0x7c2c('0x2b')]['body'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'MailInteractionId':_0x39d319['id'],'direction':'in','ContactId':_0x12c9cd['contact']['id'],'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['messageId'],'from':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x37')],'to':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['to'],'cc':_0x93e2a8['body'][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x57')],'Attachments':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5a')],'originTo':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5b')],'originCc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5c')],'bcc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5d')],'ChatWebsiteId':_0x93e2a8['body']['message'][_0x7c2c('0x5e')]||null,'originChannel':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['originChannel']||_0x7c2c('0x5f'),'ChatOfflineMessageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7c2c('0x60')],'as':_0x7c2c('0x61')}]});})[_0x7c2c('0xe')](function(_0x8f8b42){_0x12c9cd['message']=_0x8f8b42;if(_0x12c9cd[_0x7c2c('0x58')]['UserId']){return db[_0x7c2c('0x62')]['find']({'attributes':['id',_0x7c2c('0x63')],'where':{'id':_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x64')]}})[_0x7c2c('0xe')](function(_0x43eb9d){if(_0x43eb9d){_0x12c9cd[_0x7c2c('0x42')][_0x7c2c('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43eb9d[_0x7c2c('0x63')]+','+(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x66')]||0xa),'interval':_0x7c2c('0x67')});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);})['then'](function(_0x2d75b8){_0x18e288(_0x2d75b8);})[_0x7c2c('0x19')](function(_0x2391a7){_0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,_0x2391a7[_0x7c2c('0x17')]));});});}; \ No newline at end of file +var _0x9f0e=['updatedAt','ListId','from','from\x20is\x20mandatory','isNil','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','account','List','Contacts','DESC','Applications','MailServerOut','Smtp','CloudProvider','get','omit','getSmtpOptions','applications','orderBy','asc','autoclose','push','close','*,*,*,*','length','defaults','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','Contact\x20not\x20found','update','interaction','created','MailMessage','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','where','attributes','limit','include','map','model','debug','ShowMailAccount','find','raw','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact'];(function(_0x8647bd,_0x56f5f1){var _0x391239=function(_0x359309){while(--_0x359309){_0x8647bd['push'](_0x8647bd['shift']());}};_0x391239(++_0x56f5f1);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2e55f0,_0xc02dad){_0x2e55f0=_0x2e55f0-0x0;var _0x3da669=_0x9f0e[_0x2e55f0];return _0x3da669;};'use strict';var _=require(_0xe9f0('0x0'));var moment=require(_0xe9f0('0x1'));var BPromise=require(_0xe9f0('0x2'));var rs=require(_0xe9f0('0x3'));var Redis=require(_0xe9f0('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xe9f0('0x5'));var config=require(_0xe9f0('0x6'));var jayson=require(_0xe9f0('0x7'));var client=jayson[_0xe9f0('0x8')][_0xe9f0('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xe9f0('0xa')],{'host':_0xe9f0('0xb'),'port':0x18eb});var socket=require(_0xe9f0('0xc'))(new Redis(config['redis']));require(_0xe9f0('0xd'))[_0xe9f0('0xe')](socket);function respondWithRpcPromise(_0x20d602,_0x3386a8,_0xa523c0){return new BPromise(function(_0x240932,_0x807322){return client[_0xe9f0('0xf')](_0x20d602,_0xa523c0)[_0xe9f0('0x10')](function(_0x5352e0){logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));logger['debug'](_0xe9f0('0x14'),_0x3386a8,'request\x20sent',JSON[_0xe9f0('0x15')](_0x5352e0));if(_0x5352e0[_0xe9f0('0x16')]){if(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x17')]===0x1f4){logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0['error'][_0xe9f0('0x18')]);return _0x807322(_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);}logger['error'](_0xe9f0('0x12'),_0x3386a8,_0x5352e0[_0xe9f0('0x16')][_0xe9f0('0x18')]);return _0x240932(_0x5352e0['error'][_0xe9f0('0x18')]);}else{logger[_0xe9f0('0x11')](_0xe9f0('0x12'),_0x3386a8,_0xe9f0('0x13'));_0x240932(_0x5352e0[_0xe9f0('0x19')][_0xe9f0('0x18')]);}})[_0xe9f0('0x1a')](function(_0x59bf5a){logger[_0xe9f0('0x16')](_0xe9f0('0x12'),_0x3386a8,_0x59bf5a);_0x807322(_0x59bf5a);});});}exports[_0xe9f0('0x1b')]=function(_0x5c4182){var _0x35e841=this;return new Promise(function(_0x30b8c7,_0x1698cf){return db[_0xe9f0('0x1c')]['findAll']({'raw':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c4182['options']?_0x5c4182['options'][_0xe9f0('0x1e')]||null:null,'attributes':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x1f')]||null:null,'limit':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182['options'][_0xe9f0('0x20')]||null:null,'include':_0x5c4182[_0xe9f0('0x1d')]?_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x5c4182[_0xe9f0('0x1d')][_0xe9f0('0x21')],function(_0x1321bb){return{'model':db[_0x1321bb[_0xe9f0('0x23')]],'as':_0x1321bb['as'],'attributes':_0x1321bb[_0xe9f0('0x1f')],'include':_0x1321bb['include']?_[_0xe9f0('0x22')](_0x1321bb[_0xe9f0('0x21')],function(_0x2ddfba){return{'model':db[_0x2ddfba[_0xe9f0('0x23')]],'as':_0x2ddfba['as'],'attributes':_0x2ddfba['attributes'],'include':_0x2ddfba[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x2ddfba[_0xe9f0('0x21')],function(_0x1f98a7){return{'model':db[_0x1f98a7[_0xe9f0('0x23')]],'as':_0x1f98a7['as'],'attributes':_0x1f98a7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0xdc16bc){logger[_0xe9f0('0x11')](_0xe9f0('0x1b'),_0x5c4182);logger[_0xe9f0('0x24')](_0xe9f0('0x1b'),_0x5c4182,JSON[_0xe9f0('0x15')](_0xdc16bc));_0x30b8c7(_0xdc16bc);})[_0xe9f0('0x1a')](function(_0x2b6503){logger[_0xe9f0('0x16')](_0xe9f0('0x1b'),_0x2b6503[_0xe9f0('0x18')],_0x5c4182);_0x1698cf(_0x35e841[_0xe9f0('0x16')](0x1f4,_0x2b6503[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x25')]=function(_0x2097c4){var _0x80e3ac=this;return new Promise(function(_0x3e1846,_0x2e7535){return db[_0xe9f0('0x1c')][_0xe9f0('0x26')]({'raw':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4[_0xe9f0('0x1d')][_0xe9f0('0x27')]===undefined?!![]:![]:!![],'where':_0x2097c4['options']?_0x2097c4['options']['where']||null:null,'attributes':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x1f')]||null:null,'include':_0x2097c4[_0xe9f0('0x1d')]?_0x2097c4['options'][_0xe9f0('0x21')]?_['map'](_0x2097c4['options']['include'],function(_0x165440){return{'model':db[_0x165440[_0xe9f0('0x23')]],'as':_0x165440['as'],'attributes':_0x165440['attributes'],'include':_0x165440[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x165440[_0xe9f0('0x21')],function(_0x4d4186){return{'model':db[_0x4d4186['model']],'as':_0x4d4186['as'],'attributes':_0x4d4186[_0xe9f0('0x1f')],'include':_0x4d4186[_0xe9f0('0x21')]?_[_0xe9f0('0x22')](_0x4d4186['include'],function(_0x3ca032){return{'model':db[_0x3ca032[_0xe9f0('0x23')]],'as':_0x3ca032['as'],'attributes':_0x3ca032[_0xe9f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe9f0('0x10')](function(_0x2b38de){if(_0x2097c4['options'][_0xe9f0('0x28')]===!![])_0x2b38de[_0xe9f0('0x29')](_0xe9f0('0x2a'),_0x2b38de['getSmtpOptions']());logger[_0xe9f0('0x11')](_0xe9f0('0x25'),_0x2097c4);logger['debug'](_0xe9f0('0x25'),_0x2097c4,JSON['stringify'](_0x2b38de));_0x3e1846(_0x2b38de);})[_0xe9f0('0x1a')](function(_0x55c0bd){logger['error']('ShowMailAccount',_0x55c0bd['message'],_0x2097c4);_0x2e7535(_0x80e3ac['error'](0x1f4,_0x55c0bd[_0xe9f0('0x18')]));});});};exports[_0xe9f0('0x2b')]=function(_0x2d8f93){var _0x40c2c6=this;return new Promise(function(_0x2560c6,_0xd9b61b){var _0x3d4eb7={'body':_0x2d8f93[_0xe9f0('0x2c')],'channel':_0xe9f0('0x2d')};var _0x4e1c68=_[_0xe9f0('0x2e')](_[_0xe9f0('0x2f')](db[_0xe9f0('0x30')]['rawAttributes']),['createdAt',_0xe9f0('0x31'),'CompanyId',_0xe9f0('0x32')]);var _0x52613a=![];if(_0x2d8f93[_0xe9f0('0x2c')]['id']){delete _0x2d8f93[_0xe9f0('0x2c')]['id'];}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x34')));}if(_[_0xe9f0('0x35')](_0x2d8f93['body'][_0xe9f0('0x2c')])||_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x2c')]===''){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x36')));}if(_['isNil'](_0x2d8f93[_0xe9f0('0x2c')]['mapKey'])){return _0xd9b61b(_0x40c2c6['error'](0x1f4,_0xe9f0('0x37')+_0x4e1c68));}if(!_[_0xe9f0('0x38')](_0x4e1c68,_0x2d8f93['body'][_0xe9f0('0x39')])){return _0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xe9f0('0x3a')+_0x4e1c68));}var _0x7b167b={};_0x7b167b[_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x39')]]=_0x2d8f93[_0xe9f0('0x2c')]['from'];return db[_0xe9f0('0x1c')]['find']({'where':{'id':_0x2d8f93[_0xe9f0('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0xe9f0('0x3c'),'include':[{'model':db['CmContact'],'as':_0xe9f0('0x3d'),'where':_0x7b167b,'limit':0x1,'order':[[_0xe9f0('0x31'),_0xe9f0('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xe9f0('0x3f')},{'model':db[_0xe9f0('0x40')],'as':_0xe9f0('0x41'),'include':[{'model':db[_0xe9f0('0x42')],'as':_0xe9f0('0x42')}]}]})[_0xe9f0('0x10')](function(_0x6ece3f){if(_0x6ece3f&&_0x6ece3f[_0xe9f0('0x3c')]){var _0x18fc2b=_0x6ece3f[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x3b')]=_[_0xe9f0('0x44')](_0x18fc2b,['Applications','List']);_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x2a')]=_0x6ece3f[_0xe9f0('0x45')]();_0x3d4eb7['applications']=_0x18fc2b[_0xe9f0('0x3f')];_0x3d4eb7['list']=_0x18fc2b[_0xe9f0('0x3c')];_0x3d4eb7[_0xe9f0('0x46')]=_[_0xe9f0('0x47')](_0x3d4eb7[_0xe9f0('0x46')],['priority'],[_0xe9f0('0x48')]);if(_0x3d4eb7[_0xe9f0('0x3b')]&&_0x3d4eb7['account'][_0xe9f0('0x49')]){_0x3d4eb7[_0xe9f0('0x46')][_0xe9f0('0x4a')]({'id':0x0,'priority':_0x3d4eb7[_0xe9f0('0x46')]['length']+0x1,'app':_0xe9f0('0x4b'),'appdata':_0xe9f0('0x49'),'interval':_0xe9f0('0x4c')});}if(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')]){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3f')];}if(_0x3d4eb7[_0xe9f0('0x3b')]['List']){delete _0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x3c')];}if(_0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][_0xe9f0('0x4d')]){return _0x18fc2b[_0xe9f0('0x3c')][_0xe9f0('0x3d')][0x0];}var _0xec9b3c=_[_0xe9f0('0x4e')](_0x2d8f93[_0xe9f0('0x2c')],{'firstName':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')],'ListId':_0x18fc2b[_0xe9f0('0x32')]});_0xec9b3c[_0x2d8f93[_0xe9f0('0x2c')]['mapKey']]=_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x33')];return db[_0xe9f0('0x30')]['create'](_0xec9b3c);}else{throw new Error('List\x20not\x20found');}})[_0xe9f0('0x10')](function(_0x57b904){_0x3d4eb7[_0xe9f0('0x4f')]=_0x57b904;if(_0x57b904){if(!_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId']){_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')]=rs[_0xe9f0('0x51')]()+'\x20'+_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x33')];}var _0x28a66e={'ContactId':_0x57b904['id'],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'inReplyTo':_0x2d8f93['body']['message'][_0xe9f0('0x50')],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')]['message']['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93['body'][_0xe9f0('0x18')][_0xe9f0('0x53')],'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'};return db[_0xe9f0('0x56')]['find']({'where':{'closed':![],'MailAccountId':_0x2d8f93['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xe9f0('0x57'),'attributes':[_0xe9f0('0x50')],'where':{'messageId':_0x2d8f93['body'][_0xe9f0('0x18')]['inReplyTo']}}]})['then'](function(_0x156c65){if(_0x156c65){return[_0x156c65,![]];}return db[_0xe9f0('0x56')][_0xe9f0('0x58')](_0x28a66e)[_0xe9f0('0x10')](function(_0x1d2fb2){return[_0x1d2fb2,!![]];});});}else{throw new Error(_0xe9f0('0x59'));}})['spread'](function(_0x5e4ad4,_0x1255e6){if(_0x5e4ad4){_0x52613a=_0x1255e6;if(!_0x1255e6){return _0x5e4ad4[_0xe9f0('0x5a')]({'inReplyTo':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['messageId'],'to':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x33')],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x5e4ad4[_0xe9f0('0x53')]?_0x5e4ad4[_0xe9f0('0x53')]:_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgAt':moment()[_0xe9f0('0x54')](_0xe9f0('0x55')),'lastMsgDirection':'in'});}else{return _0x5e4ad4;}}})[_0xe9f0('0x10')](function(_0x42aab8){_0x3d4eb7[_0xe9f0('0x5b')]=_0x42aab8[_0xe9f0('0x43')]({'plain':!![]});_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x5c')]=_0x52613a;return db[_0xe9f0('0x5d')][_0xe9f0('0x58')]({'body':_0x2d8f93['body'][_0xe9f0('0x2c')],'MailAccountId':_0x2d8f93[_0xe9f0('0x3b')]['id'],'MailInteractionId':_0x42aab8['id'],'direction':'in','ContactId':_0x3d4eb7[_0xe9f0('0x4f')]['id'],'messageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x50')],'from':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x33')],'to':_0x2d8f93[_0xe9f0('0x2c')]['message']['to'],'cc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['cc'],'subject':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x52')],'attach':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x53')],'Attachments':_0x2d8f93[_0xe9f0('0x2c')]['message']['attachments'],'originTo':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5e')],'originCc':_0x2d8f93[_0xe9f0('0x2c')]['message'][_0xe9f0('0x5f')],'bcc':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x60')],'ChatWebsiteId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x61')]||null,'originChannel':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')]['originChannel']||_0xe9f0('0x62'),'ChatOfflineMessageId':_0x2d8f93[_0xe9f0('0x2c')][_0xe9f0('0x18')][_0xe9f0('0x63')]||null},{'include':[{'model':db[_0xe9f0('0x64')],'as':_0xe9f0('0x65')}]});})[_0xe9f0('0x10')](function(_0x114033){_0x3d4eb7['message']=_0x114033;if(_0x3d4eb7[_0xe9f0('0x5b')][_0xe9f0('0x66')]){return db[_0xe9f0('0x67')][_0xe9f0('0x26')]({'attributes':['id',_0xe9f0('0x68')],'where':{'id':_0x3d4eb7[_0xe9f0('0x5b')]['UserId']}})[_0xe9f0('0x10')](function(_0x568a13){if(_0x568a13){_0x3d4eb7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xe9f0('0x69'),'appdata':_0x568a13[_0xe9f0('0x68')]+','+(_0x3d4eb7[_0xe9f0('0x3b')][_0xe9f0('0x6a')]||0xa),'interval':_0xe9f0('0x4c')});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);});}return respondWithRpcPromise(_0xe9f0('0x6b'),_0xe9f0('0x6c'),_0x3d4eb7);})['then'](function(_0x3b5047){_0x2560c6(_0x3b5047);})[_0xe9f0('0x1a')](function(_0xef6284){_0xd9b61b(_0x40c2c6[_0xe9f0('0x16')](0x1f4,_0xef6284[_0xe9f0('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index bb01b9b..40705da 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 _0xbf21=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','emit'];(function(_0x36b935,_0x1e45e0){var _0x4376cc=function(_0x164992){while(--_0x164992){_0x36b935['push'](_0x36b935['shift']());}};_0x4376cc(++_0x1e45e0);}(_0xbf21,0xec));var _0x1bf2=function(_0xf0466e,_0x36428e){_0xf0466e=_0xf0466e-0x0;var _0x204885=_0xbf21[_0xf0466e];return _0x204885;};'use strict';var MailAccountEvents=require(_0x1bf2('0x0'));var events=[_0x1bf2('0x1'),_0x1bf2('0x2'),'update'];function createListener(_0x1f2d01,_0x4d5951){return function(_0x55642d){_0x4d5951[_0x1bf2('0x3')](_0x1f2d01,_0x55642d);};}function removeListener(_0x2dcdb7,_0x3e142b){return function(){MailAccountEvents[_0x1bf2('0x4')](_0x2dcdb7,_0x3e142b);};}exports[_0x1bf2('0x5')]=function(_0x3dc735){for(var _0x2e2640=0x0,_0x397ae6=events[_0x1bf2('0x6')];_0x2e2640<_0x397ae6;_0x2e2640++){var _0x5798cb=events[_0x2e2640];var _0xf32845=createListener(_0x1bf2('0x7')+_0x5798cb,_0x3dc735);MailAccountEvents['on'](_0x5798cb,_0xf32845);}}; \ No newline at end of file +var _0xd081=['save','remove','update','length','mailAccount:','./mailAccount.events'];(function(_0x1e26dd,_0xee7e86){var _0x5a1ced=function(_0x341772){while(--_0x341772){_0x1e26dd['push'](_0x1e26dd['shift']());}};_0x5a1ced(++_0xee7e86);}(_0xd081,0x13d));var _0x1d08=function(_0x251c3a,_0x564d73){_0x251c3a=_0x251c3a-0x0;var _0x689ba9=_0xd081[_0x251c3a];return _0x689ba9;};'use strict';var MailAccountEvents=require(_0x1d08('0x0'));var events=[_0x1d08('0x1'),_0x1d08('0x2'),_0x1d08('0x3')];function createListener(_0x117fe5,_0x875065){return function(_0x219c2f){_0x875065['emit'](_0x117fe5,_0x219c2f);};}function removeListener(_0x3aa286,_0x58dcb8){return function(){MailAccountEvents['removeListener'](_0x3aa286,_0x58dcb8);};}exports['register']=function(_0x3d4d99){for(var _0x515d66=0x0,_0x3e6ee1=events[_0x1d08('0x4')];_0x515d66<_0x3e6ee1;_0x515d66++){var _0x3b9d20=events[_0x515d66];var _0x7cdf7e=createListener(_0x1d08('0x5')+_0x3b9d20,_0x3d4d99);MailAccountEvents['on'](_0x3b9d20,_0x7cdf7e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f9b1a7b..2030067 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 _0x008c=['get','/:id','isAuthenticated','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0xe82b28,_0x5e43e9){var _0x297902=function(_0x5108cd){while(--_0x5108cd){_0xe82b28['push'](_0xe82b28['shift']());}};_0x297902(++_0x5e43e9);}(_0x008c,0x14a));var _0xc008=function(_0x131390,_0xd0846e){_0x131390=_0x131390-0x0;var _0x550870=_0x008c[_0x131390];return _0x550870;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')](_0xc008('0xb'),auth[_0xc008('0xc')](),controller['show']);router[_0xc008('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xe')]);router[_0xc008('0xf')](_0xc008('0xb'),auth[_0xc008('0xc')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0xf8a2=['destroy','util','connect-timeout','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','put','/:id','update','delete'];(function(_0x374dd1,_0x236497){var _0x235677=function(_0x68ff17){while(--_0x68ff17){_0x374dd1['push'](_0x374dd1['shift']());}};_0x235677(++_0x236497);}(_0xf8a2,0x1e1));var _0x2f8a=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xf8a2[_0x59b439];return _0x521ea3;};'use strict';var multer=require('multer');var util=require(_0x2f8a('0x0'));var path=require('path');var timeout=require(_0x2f8a('0x1'));var express=require(_0x2f8a('0x2'));var router=express[_0x2f8a('0x3')]();var fs_extra=require(_0x2f8a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f8a('0x5'));var controller=require(_0x2f8a('0x6'));router[_0x2f8a('0x7')]('/:id',auth[_0x2f8a('0x8')](),controller[_0x2f8a('0x9')]);router[_0x2f8a('0xa')](_0x2f8a('0xb'),auth[_0x2f8a('0x8')](),controller[_0x2f8a('0xc')]);router[_0x2f8a('0xd')](_0x2f8a('0xb'),auth['isAuthenticated'](),controller[_0x2f8a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index a3c01ed..adef95d 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 _0x0cef=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x5d8792,_0x4f5438){var _0x986d0e=function(_0x1d4b83){while(--_0x1d4b83){_0x5d8792['push'](_0x5d8792['shift']());}};_0x986d0e(++_0x4f5438);}(_0x0cef,0x141));var _0xf0ce=function(_0x8307e3,_0x48eb78){_0x8307e3=_0x8307e3-0x0;var _0x492db9=_0x0cef[_0x8307e3];return _0x492db9;};'use strict';var Sequelize=require(_0xf0ce('0x0'));module[_0xf0ce('0x1')]={'priority':{'type':Sequelize[_0xf0ce('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf0ce('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf0ce('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf0ce('0x3')],'defaultValue':_0xf0ce('0x5')}}; \ No newline at end of file +var _0x07a2=['sequelize','exports','STRING','noop','TEXT','*,*,*,*'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x07a2,0x12c));var _0x207a=function(_0x54e217,_0x243297){_0x54e217=_0x54e217-0x0;var _0x590ead=_0x07a2[_0x54e217];return _0x590ead;};'use strict';var Sequelize=require(_0x207a('0x0'));module[_0x207a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x207a('0x2')],'allowNull':![],'defaultValue':_0x207a('0x3')},'appdata':{'type':Sequelize[_0x207a('0x4')]()},'description':{'type':Sequelize[_0x207a('0x2')]},'interval':{'type':Sequelize[_0x207a('0x2')],'defaultValue':_0x207a('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 7797107..799b0c0 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 _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5d50d7,_0x339501){_0x5d50d7=_0x5d50d7-0x0;var _0x4acb68=_0xbdb7[_0x5d50d7];return _0x4acb68;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x1ffe79,_0x42f1f4){var _0x455932=function(_0x6603b2){while(--_0x6603b2){_0x1ffe79['push'](_0x1ffe79['shift']());}};_0x455932(++_0x42f1f4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3a7390,_0x4292be){_0x3a7390=_0x3a7390-0x0;var _0x5623bc=_0xb43b[_0x3a7390];return _0x5623bc;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 94bda4b..e619cdb 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 _0x1389=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications'];(function(_0x1ffe75,_0x59931f){var _0x56bcdc=function(_0x1c1760){while(--_0x1c1760){_0x1ffe75['push'](_0x1ffe75['shift']());}};_0x56bcdc(++_0x59931f);}(_0x1389,0x10f));var _0x9138=function(_0x56fa19,_0x301641){_0x56fa19=_0x56fa19-0x0;var _0x54fcd7=_0x1389[_0x56fa19];return _0x54fcd7;};'use strict';var _=require(_0x9138('0x0'));var util=require(_0x9138('0x1'));var logger=require(_0x9138('0x2'))(_0x9138('0x3'));var moment=require(_0x9138('0x4'));var BPromise=require(_0x9138('0x5'));var rp=require(_0x9138('0x6'));var fs=require('fs');var path=require(_0x9138('0x7'));var rimraf=require(_0x9138('0x8'));var config=require(_0x9138('0x9'));var attributes=require(_0x9138('0xa'));module[_0x9138('0xb')]=function(_0x53c959,_0x47f6f1){return _0x53c959['define'](_0x9138('0xc'),attributes,{'tableName':_0x9138('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9138('0xe')});}; \ No newline at end of file +var _0xc28e=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x31a43e,_0x1994ec){var _0x417c91=function(_0x515797){while(--_0x515797){_0x31a43e['push'](_0x31a43e['shift']());}};_0x417c91(++_0x1994ec);}(_0xc28e,0x168));var _0xec28=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0xc28e[_0x3d4876];return _0x58ca9d;};'use strict';var _=require(_0xec28('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec28('0x1'));var moment=require(_0xec28('0x2'));var BPromise=require(_0xec28('0x3'));var rp=require(_0xec28('0x4'));var fs=require('fs');var path=require(_0xec28('0x5'));var rimraf=require(_0xec28('0x6'));var config=require(_0xec28('0x7'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x1e18c7,_0x29254d){return _0x1e18c7['define'](_0xec28('0x8'),attributes,{'tableName':_0xec28('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xec28('0xa'),'collate':_0xec28('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b187d81..a89dea4 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 _0x15fe=['MailApplication','body','options','raw','limit','UpdateMailApplication','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x15fe,0x158));var _0xe15f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x15fe[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe15f('0x0'));var util=require(_0xe15f('0x1'));var moment=require(_0xe15f('0x2'));var BPromise=require(_0xe15f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe15f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe15f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe15f('0x6'));var client=jayson[_0xe15f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11c4b0,_0x2b5d67,_0x511b5c){return new BPromise(function(_0x5bf622,_0x2ac311){return client[_0xe15f('0x8')](_0x11c4b0,_0x511b5c)[_0xe15f('0x9')](function(_0x4b91e3){logger[_0xe15f('0xa')](_0xe15f('0xb'),_0x2b5d67,'request\x20sent');logger[_0xe15f('0xc')](_0xe15f('0xd'),_0x2b5d67,'request\x20sent',JSON[_0xe15f('0xe')](_0x4b91e3));if(_0x4b91e3['error']){if(_0x4b91e3[_0xe15f('0xf')][_0xe15f('0x10')]===0x1f4){logger[_0xe15f('0xf')](_0xe15f('0xb'),_0x2b5d67,_0x4b91e3[_0xe15f('0xf')][_0xe15f('0x11')]);return _0x2ac311(_0x4b91e3[_0xe15f('0xf')][_0xe15f('0x11')]);}logger[_0xe15f('0xf')](_0xe15f('0xb'),_0x2b5d67,_0x4b91e3[_0xe15f('0xf')]['message']);return _0x5bf622(_0x4b91e3['error'][_0xe15f('0x11')]);}else{logger[_0xe15f('0xa')](_0xe15f('0xb'),_0x2b5d67,'request\x20sent');_0x5bf622(_0x4b91e3[_0xe15f('0x12')]['message']);}})[_0xe15f('0x13')](function(_0x132734){logger[_0xe15f('0xf')]('MailApplication,\x20%s,\x20%s',_0x2b5d67,_0x132734);_0x2ac311(_0x132734);});});}exports['UpdateMailApplication']=function(_0x16d4bc){var _0x308556=this;return new Promise(function(_0x3dd00e,_0x1d43ad){return db[_0xe15f('0x14')]['update'](_0x16d4bc[_0xe15f('0x15')],{'raw':_0x16d4bc[_0xe15f('0x16')]?_0x16d4bc[_0xe15f('0x16')][_0xe15f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16d4bc[_0xe15f('0x16')]?_0x16d4bc['options']['where']||null:null,'attributes':_0x16d4bc[_0xe15f('0x16')]?_0x16d4bc['options']['attributes']||null:null,'limit':_0x16d4bc[_0xe15f('0x16')]?_0x16d4bc[_0xe15f('0x16')][_0xe15f('0x18')]||null:null})[_0xe15f('0x9')](function(_0x207d67){logger[_0xe15f('0xa')](_0xe15f('0x19'),_0x16d4bc);logger[_0xe15f('0xc')](_0xe15f('0x19'),_0x16d4bc,JSON[_0xe15f('0xe')](_0x207d67));_0x3dd00e(_0x207d67);})[_0xe15f('0x13')](function(_0x4dd293){logger['error'](_0xe15f('0x19'),_0x4dd293[_0xe15f('0x11')],_0x16d4bc);_0x1d43ad(_0x308556[_0xe15f('0xf')](0x1f4,_0x4dd293['message']));});});}; \ No newline at end of file +var _0xb7aa=['info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb7aa,0x11a));var _0xab7a=function(_0x59b8e0,_0x22b70c){_0x59b8e0=_0x59b8e0-0x0;var _0x2ce593=_0xb7aa[_0x59b8e0];return _0x2ce593;};'use strict';var _=require(_0xab7a('0x0'));var util=require(_0xab7a('0x1'));var moment=require(_0xab7a('0x2'));var BPromise=require(_0xab7a('0x3'));var rs=require(_0xab7a('0x4'));var fs=require('fs');var Redis=require(_0xab7a('0x5'));var db=require(_0xab7a('0x6'))['db'];var utils=require(_0xab7a('0x7'));var logger=require(_0xab7a('0x8'))(_0xab7a('0x9'));var config=require('../../config/environment');var jayson=require(_0xab7a('0xa'));var client=jayson[_0xab7a('0xb')][_0xab7a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29ef15,_0x4e775f,_0x99ac82){return new BPromise(function(_0x1e3b23,_0x520d21){return client[_0xab7a('0xd')](_0x29ef15,_0x99ac82)[_0xab7a('0xe')](function(_0x40e6e6){logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));logger[_0xab7a('0x12')](_0xab7a('0x13'),_0x4e775f,_0xab7a('0x11'),JSON[_0xab7a('0x14')](_0x40e6e6));if(_0x40e6e6['error']){if(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x16')]===0x1f4){logger[_0xab7a('0x15')](_0xab7a('0x10'),_0x4e775f,_0x40e6e6['error'][_0xab7a('0x17')]);return _0x520d21(_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);}logger[_0xab7a('0x15')]('MailApplication,\x20%s,\x20%s',_0x4e775f,_0x40e6e6[_0xab7a('0x15')][_0xab7a('0x17')]);return _0x1e3b23(_0x40e6e6['error'][_0xab7a('0x17')]);}else{logger[_0xab7a('0xf')](_0xab7a('0x10'),_0x4e775f,_0xab7a('0x11'));_0x1e3b23(_0x40e6e6[_0xab7a('0x18')]['message']);}})[_0xab7a('0x19')](function(_0x19eeb7){logger['error'](_0xab7a('0x10'),_0x4e775f,_0x19eeb7);_0x520d21(_0x19eeb7);});});}exports[_0xab7a('0x1a')]=function(_0x187f51){var _0xc3bb41=this;return new Promise(function(_0x10b630,_0x14b2b5){return db[_0xab7a('0x1b')]['update'](_0x187f51[_0xab7a('0x1c')],{'raw':_0x187f51[_0xab7a('0x1d')]?_0x187f51[_0xab7a('0x1d')][_0xab7a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x187f51[_0xab7a('0x1d')]?_0x187f51[_0xab7a('0x1d')][_0xab7a('0x1f')]||null:null,'attributes':_0x187f51[_0xab7a('0x1d')]?_0x187f51[_0xab7a('0x1d')][_0xab7a('0x20')]||null:null,'limit':_0x187f51[_0xab7a('0x1d')]?_0x187f51['options']['limit']||null:null})['then'](function(_0x60ad2b){logger[_0xab7a('0xf')](_0xab7a('0x1a'),_0x187f51);logger[_0xab7a('0x12')](_0xab7a('0x1a'),_0x187f51,JSON[_0xab7a('0x14')](_0x60ad2b));_0x10b630(_0x60ad2b);})[_0xab7a('0x19')](function(_0x533680){logger['error'](_0xab7a('0x1a'),_0x533680['message'],_0x187f51);_0x14b2b5(_0xc3bb41['error'](0x1f4,_0x533680[_0xab7a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bf2daf6..3e23794 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 _0x9e75=['get','isAuthenticated','/describe','describe','/:id','/:id/messages','/:id/download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller'];(function(_0x50392a,_0x2d4ed9){var _0x417b0a=function(_0x1e278f){while(--_0x1e278f){_0x50392a['push'](_0x50392a['shift']());}};_0x417b0a(++_0x2d4ed9);}(_0x9e75,0x1f1));var _0x59e7=function(_0x3d1ca1,_0x1a2991){_0x3d1ca1=_0x3d1ca1-0x0;var _0x3c4dd6=_0x9e75[_0x3d1ca1];return _0x3c4dd6;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x59e7('0x0'));var interaction=require(_0x59e7('0x1'));var controller=require(_0x59e7('0x2'));router[_0x59e7('0x3')]('/',auth[_0x59e7('0x4')](),controller['index']);router[_0x59e7('0x3')](_0x59e7('0x5'),auth[_0x59e7('0x4')](),controller[_0x59e7('0x6')]);router[_0x59e7('0x3')](_0x59e7('0x7'),auth[_0x59e7('0x4')](),controller['show']);router['get'](_0x59e7('0x8'),auth[_0x59e7('0x4')](),controller['getMessages']);router[_0x59e7('0x3')](_0x59e7('0x9'),auth[_0x59e7('0x4')](),controller['download']);router[_0x59e7('0xa')]('/',auth[_0x59e7('0x4')](),controller[_0x59e7('0xb')]);router['post']('/:id/messages',auth[_0x59e7('0x4')](),controller[_0x59e7('0xc')]);router[_0x59e7('0xa')]('/:id/tags',auth[_0x59e7('0x4')](),interaction[_0x59e7('0xd')](_0x59e7('0xe'),_0x59e7('0xf')),controller[_0x59e7('0x10')]);router[_0x59e7('0x11')](_0x59e7('0x7'),auth['isAuthenticated'](),interaction[_0x59e7('0xd')](_0x59e7('0xe'),_0x59e7('0x12')),controller[_0x59e7('0x13')]);router[_0x59e7('0x14')]('/:id',auth[_0x59e7('0x4')](),interaction[_0x59e7('0xd')](_0x59e7('0xe'),_0x59e7('0x15')),controller[_0x59e7('0x16')]);router[_0x59e7('0x14')](_0x59e7('0x17'),auth[_0x59e7('0x4')](),controller['removeTags']);module[_0x59e7('0x18')]=router; \ No newline at end of file +var _0x679a=['addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x61fd3a,_0x15a094){var _0x546d6b=function(_0x47f6e9){while(--_0x47f6e9){_0x61fd3a['push'](_0x61fd3a['shift']());}};_0x546d6b(++_0x15a094);}(_0x679a,0x11f));var _0xa679=function(_0x5ec823,_0x3a6689){_0x5ec823=_0x5ec823-0x0;var _0x86098a=_0x679a[_0x5ec823];return _0x86098a;};'use strict';var express=require(_0xa679('0x0'));var router=express[_0xa679('0x1')]();var auth=require(_0xa679('0x2'));var interaction=require(_0xa679('0x3'));var controller=require(_0xa679('0x4'));router['get']('/',auth[_0xa679('0x5')](),controller[_0xa679('0x6')]);router[_0xa679('0x7')](_0xa679('0x8'),auth[_0xa679('0x5')](),controller[_0xa679('0x9')]);router[_0xa679('0x7')](_0xa679('0xa'),auth[_0xa679('0x5')](),controller['show']);router[_0xa679('0x7')](_0xa679('0xb'),auth['isAuthenticated'](),controller[_0xa679('0xc')]);router['get']('/:id/download',auth[_0xa679('0x5')](),controller[_0xa679('0xd')]);router['post']('/',auth[_0xa679('0x5')](),controller[_0xa679('0xe')]);router[_0xa679('0xf')](_0xa679('0xb'),auth[_0xa679('0x5')](),controller[_0xa679('0x10')]);router[_0xa679('0xf')](_0xa679('0x11'),auth['isAuthenticated'](),interaction[_0xa679('0x12')](_0xa679('0x13'),_0xa679('0x14')),controller[_0xa679('0x15')]);router['put'](_0xa679('0xa'),auth[_0xa679('0x5')](),interaction[_0xa679('0x12')](_0xa679('0x13'),_0xa679('0x16')),controller[_0xa679('0x17')]);router[_0xa679('0x18')](_0xa679('0xa'),auth['isAuthenticated'](),interaction[_0xa679('0x12')]('mail',_0xa679('0x19')),controller[_0xa679('0x1a')]);router[_0xa679('0x18')](_0xa679('0x11'),auth[_0xa679('0x5')](),controller['removeTags']);module[_0xa679('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4593e71..e1d7f91 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 _0xb764=['STRING','TEXT','out','ENUM','iconv','BOOLEAN','DATE'];(function(_0x2e7044,_0x5409b8){var _0x26a3c2=function(_0x4cd168){while(--_0x4cd168){_0x2e7044['push'](_0x2e7044['shift']());}};_0x26a3c2(++_0x5409b8);}(_0xb764,0x97));var _0x4b76=function(_0x15aa31,_0x1c477e){_0x15aa31=_0x15aa31-0x0;var _0x3d4570=_0xb764[_0x15aa31];return _0x3d4570;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4b76('0x0'));module['exports']={'closed':{'type':Sequelize[_0x4b76('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4b76('0x2')]},'disposition':{'type':Sequelize[_0x4b76('0x3')]},'secondDisposition':{'type':Sequelize[_0x4b76('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4b76('0x4')]('long')},'subject':{'type':Sequelize[_0x4b76('0x4')]()},'attach':{'type':Sequelize[_0x4b76('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4b76('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4b76('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4b76('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x4b76('0x6')]('in',_0x4b76('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4b76('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bdc=['iconv','exports','BOOLEAN','STRING','TEXT','DATE','out','ENUM','sequelize'];(function(_0xde258e,_0x796a92){var _0xfbe25e=function(_0x156d4d){while(--_0x156d4d){_0xde258e['push'](_0xde258e['shift']());}};_0xfbe25e(++_0x796a92);}(_0x4bdc,0x155));var _0xc4bd=function(_0x6b4d1b,_0x4fff98){_0x6b4d1b=_0x6b4d1b-0x0;var _0x158544=_0x4bdc[_0x6b4d1b];return _0x158544;};'use strict';var Sequelize=require(_0xc4bd('0x0'));var iconv=require(_0xc4bd('0x1'));module[_0xc4bd('0x2')]={'closed':{'type':Sequelize[_0xc4bd('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc4bd('0x4')]},'secondDisposition':{'type':Sequelize[_0xc4bd('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc4bd('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc4bd('0x5')]('long')},'subject':{'type':Sequelize[_0xc4bd('0x5')]()},'attach':{'type':Sequelize[_0xc4bd('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc4bd('0x6')]},'substatus':{'type':Sequelize[_0xc4bd('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc4bd('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc4bd('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc4bd('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc4bd('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4a410e4..efdad79 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 _0xf3cc=['unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','mkdirSync','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','Content-Range','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','plainBody','-id','lastMsgText','trimStart','catch','talking','answered','unmanaged','total','closed','UserId','waiting','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','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.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','order','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','MailInteraction','a.key','Account.key','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','intersection','includeAll','include','create','body','describe','ids','omit','getMessages','sort','format','YYYY-MM-DD\x20HH:mm:ss','findAll','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download'];(function(_0x4a93e9,_0x5b569f){var _0x4b3ba7=function(_0x483c02){while(--_0x483c02){_0x4a93e9['push'](_0x4a93e9['shift']());}};_0x4b3ba7(++_0x5b569f);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x5673c6,_0xc302ec){_0x5673c6=_0x5673c6-0x0;var _0x130bd9=_0xf3cc[_0x5673c6];return _0x130bd9;};'use strict';var emlformat=require(_0xcf3c('0x0'));var rimraf=require(_0xcf3c('0x1'));var zipdir=require(_0xcf3c('0x2'));var moment=require(_0xcf3c('0x3'));var BPromise=require('bluebird');var util=require(_0xcf3c('0x4'));var path=require(_0xcf3c('0x5'));var fs=require('fs');var _=require(_0xcf3c('0x6'));var squel=require('squel');var juice=require(_0xcf3c('0x7'));var Redis=require(_0xcf3c('0x8'));var qs=require('../../components/parsers/qs');var as=require(_0xcf3c('0x9'));var logger=require(_0xcf3c('0xa'))(_0xcf3c('0xb'));var config=require(_0xcf3c('0xc'));var db=require(_0xcf3c('0xd'))['db'];var htmlEntities=require(_0xcf3c('0xe'));config[_0xcf3c('0xf')]=_[_0xcf3c('0x10')](config[_0xcf3c('0xf')],{'host':_0xcf3c('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf3c('0x12'))[_0xcf3c('0x13')](socket);function respondWithStatusCode(_0x3022f2,_0x3775d1){_0x3775d1=_0x3775d1||0xcc;return function(_0x46e82c){if(_0x46e82c){return _0x3022f2[_0xcf3c('0x14')](_0x3775d1);}return _0x3022f2[_0xcf3c('0x15')](_0x3775d1)[_0xcf3c('0x16')]();};}function respondWithResult(_0x5b1526,_0x245b88){_0x245b88=_0x245b88||0xc8;return function(_0x389b0f){if(_0x389b0f){return _0x5b1526['status'](_0x245b88)[_0xcf3c('0x17')](_0x389b0f);}};}function respondWithFilteredResult(_0x4e6c38,_0x55ef34){return function(_0x56261f){if(_0x56261f){var _0x3fd714=typeof _0x55ef34['offset']===_0xcf3c('0x18')&&typeof _0x55ef34[_0xcf3c('0x19')]==='undefined';var _0x3e759f=_0x56261f['count'];var _0x30d023=_0x3fd714?0x0:_0x55ef34[_0xcf3c('0x1a')];var _0x146f3a=_0x3fd714?_0x56261f['count']:_0x55ef34[_0xcf3c('0x1a')]+_0x55ef34[_0xcf3c('0x19')];var _0x395159;if(_0x146f3a>=_0x3e759f){_0x146f3a=_0x3e759f;_0x395159=0xc8;}else{_0x395159=0xce;}_0x4e6c38[_0xcf3c('0x15')](_0x395159);return _0x4e6c38['set'](_0xcf3c('0x1b'),_0x30d023+'-'+_0x146f3a+'/'+_0x3e759f)[_0xcf3c('0x17')](_0x56261f);}return null;};}function saveUpdates(_0x25ebf3){return function(_0xecb4b5){if(_0xecb4b5){return _0xecb4b5[_0xcf3c('0x1c')](_0x25ebf3)[_0xcf3c('0x1d')](function(_0xf22c4e){return _0xf22c4e;});}return null;};}function removeEntity(_0x391e9b){return function(_0x36d828){if(_0x36d828){return _0x36d828[_0xcf3c('0x1e')]()[_0xcf3c('0x1d')](function(){_0x391e9b[_0xcf3c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca9b8){return function(_0x54cd87){if(!_0x54cd87){_0x3ca9b8[_0xcf3c('0x14')](0x194);}return _0x54cd87;};}function handleError(_0x1228c1,_0x5dddc1){_0x5dddc1=_0x5dddc1||0x1f4;return function(_0x1bd0f2){logger[_0xcf3c('0x1f')](_0x1bd0f2[_0xcf3c('0x20')]);if(_0x1bd0f2[_0xcf3c('0x21')]){delete _0x1bd0f2[_0xcf3c('0x21')];}_0x1228c1[_0xcf3c('0x15')](_0x5dddc1)[_0xcf3c('0x22')](_0x1bd0f2);};}function getInteractionUsers(_0x43609a,_0x58b8e5){return new BPromise(function(_0x771a9f,_0x4ce43c){try{if(_0x58b8e5[_0x43609a['id']]){_0x43609a[_0xcf3c('0x23')]=_[_0xcf3c('0x24')](_0x58b8e5[_0x43609a['id']],function(_0x42ce14){return{'id':_0x42ce14['id'],'fullname':_0x42ce14[_0xcf3c('0x25')]};});}}catch(_0x181c90){_0x4ce43c(_0x181c90);}_0x771a9f(_0x43609a);});}function getInteractionTags(_0x43c912,_0x5631f1){return new BPromise(function(_0x22c54c,_0x4e06b5){try{if(_0x43c912[_0xcf3c('0x26')]){_0x43c912[_0xcf3c('0x27')]=[];_0x43c912[_0xcf3c('0x26')]['split'](',')[_0xcf3c('0x28')](function(_0x54174a){_0x43c912[_0xcf3c('0x27')][_0xcf3c('0x29')](_0x5631f1[_0x54174a]);});}delete _0x43c912[_0xcf3c('0x26')];}catch(_0x5bdae3){_0x4e06b5(_0x5bdae3);}_0x22c54c(_0x43c912);});}function getLastMessageText(_0x5835b2){return new BPromise(function(_0xc751e8,_0x41834f){return db[_0xcf3c('0x2a')][_0xcf3c('0x2b')]({'where':{'$and':[{'MailInteractionId':_0x5835b2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xcf3c('0x2c')],'order':_0xcf3c('0x2d'),'raw':!![]})[_0xcf3c('0x1d')](function(_0x5b6193){if(_0x5b6193&&_0x5b6193[_0xcf3c('0x2c')]){_0x5835b2[_0xcf3c('0x2e')]=_[_0xcf3c('0x2f')](_0x5b6193['plainBody']);}_0xc751e8(_0x5835b2);})[_0xcf3c('0x30')](function(_0x179d2b){_0x41834f(_0x179d2b);});});}function updateMailInteraction(_0x45a611,_0x2e7b19,_0x1b15cf,_0x534f56){return new BPromise(function(_0x2aced6,_0x549fb4){return getInteractionUsers(_0x45a611,_0x1b15cf)[_0xcf3c('0x1d')](function(_0x57d644){return getInteractionTags(_0x57d644,_0x2e7b19);})[_0xcf3c('0x1d')](function(_0x1daba1){return getStateInteraction(_0x1daba1);})[_0xcf3c('0x1d')](function(_0x3280fc){if(_0x534f56){_0x2aced6(getLastMessageText(_0x3280fc));}else{_0x2aced6(_0x3280fc);}})[_0xcf3c('0x30')](function(_0x3a54bf){_0x549fb4(_0x3a54bf);});});}function getStateInteraction(_0x7933ca){return new BPromise(function(_0x36a42b){_0x7933ca['waiting']=0x0;_0x7933ca[_0xcf3c('0x31')]=0x0;_0x7933ca[_0xcf3c('0x32')]=0x0;_0x7933ca[_0xcf3c('0x33')]=0x0;_0x7933ca[_0xcf3c('0x34')]=0x0;if(!_0x7933ca[_0xcf3c('0x35')]&&!_0x7933ca[_0xcf3c('0x36')]){_0x7933ca[_0xcf3c('0x37')]+=0x1;}if(!_0x7933ca[_0xcf3c('0x35')]&&_0x7933ca[_0xcf3c('0x36')]){_0x7933ca[_0xcf3c('0x31')]+=0x1;if(_0x7933ca['waiting']){_0x7933ca[_0xcf3c('0x37')]-=0x1;}}if(_0x7933ca['closed']&&_0x7933ca['UserId']){_0x7933ca['answered']+=0x1;if(_0x7933ca[_0xcf3c('0x31')]){_0x7933ca[_0xcf3c('0x31')]-=0x1;}}if(_0x7933ca[_0xcf3c('0x35')]&&!_0x7933ca[_0xcf3c('0x36')]){_0x7933ca['unmanaged']+=0x1;if(_0x7933ca['waiting']){_0x7933ca[_0xcf3c('0x37')]-=0x1;}}_0x7933ca[_0xcf3c('0x34')]+=0x1;_0x36a42b(_0x7933ca);});}exports[_0xcf3c('0x38')]=function(_0x9c753f,_0x26870c){var _0x99a4e0={},_0x551960={},_0x292f15={'count':0x0,'rows':[]};var _0x2f655d=_[_0xcf3c('0x24')](db['MailInteraction'][_0xcf3c('0x39')],function(_0x4b7495){return{'name':_0x4b7495['fieldName'],'type':_0x4b7495[_0xcf3c('0x3a')][_0xcf3c('0x3b')]};});_0x551960[_0xcf3c('0x3c')]=_[_0xcf3c('0x24')](_0x2f655d,_0xcf3c('0x21'));_0x551960[_0xcf3c('0x3d')]=_[_0xcf3c('0x3e')](_0x9c753f[_0xcf3c('0x3d')]);_0x551960[_0xcf3c('0x3f')]=_['intersection'](_0x551960['model'],_0x551960[_0xcf3c('0x3d')]);_0x99a4e0[_0xcf3c('0x40')]=_['intersection'](_0x551960[_0xcf3c('0x3c')],qs['fields'](_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x41')]));_0x99a4e0[_0xcf3c('0x40')]=_0x99a4e0[_0xcf3c('0x40')][_0xcf3c('0x42')]?_0x99a4e0[_0xcf3c('0x40')]:_0x551960[_0xcf3c('0x3c')];if(!_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x43')](_0xcf3c('0x44'))){_0x99a4e0[_0xcf3c('0x19')]=qs[_0xcf3c('0x19')](_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x19')]);_0x99a4e0[_0xcf3c('0x1a')]=qs[_0xcf3c('0x1a')](_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x1a')]);}_0x99a4e0['order']=qs['sort'](_0x9c753f[_0xcf3c('0x3d')]['sort']);_0x99a4e0[_0xcf3c('0x45')]=qs[_0xcf3c('0x3f')](_[_0xcf3c('0x46')](_0x9c753f[_0xcf3c('0x3d')],_0x551960[_0xcf3c('0x3f')]),_0x2f655d);var _0x525e3f=[];var _0x5b6802=squel['select']()[_0xcf3c('0x47')]('id')[_0xcf3c('0x47')]('name')[_0xcf3c('0x47')](_0xcf3c('0x48'))[_0xcf3c('0x49')](_0xcf3c('0x4a'));var _0x391976=squel[_0xcf3c('0x4b')]()[_0xcf3c('0x47')](_0xcf3c('0x4c'))[_0xcf3c('0x47')](_0xcf3c('0x4d'))[_0xcf3c('0x47')](_0xcf3c('0x4e'))['from'](_0xcf3c('0x4f'),'ui')[_0xcf3c('0x50')](_0xcf3c('0x51'),'u',_0xcf3c('0x52'));var _0x4d0be6=squel[_0xcf3c('0x4b')]()['from'](_0xcf3c('0x53'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xcf3c('0x51'),'o',_0xcf3c('0x54'))['left_join'](_0xcf3c('0x55'),'a',_0xcf3c('0x56'))[_0xcf3c('0x50')]('mail_messages','me','me.MailInteractionId\x20=\x20i.id')[_0xcf3c('0x50')](_0xcf3c('0x57'),'it','it.MailInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xcf3c('0x58'));var _0x50a78b=squel[_0xcf3c('0x59')]();var _0x5d3d9d=[];var _0x7c6af9=squel[_0xcf3c('0x59')]();var _0xe6e9d1;if(_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x5a')]){_0xe6e9d1=as['parseSearch'](_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x5a')]);var _0x26870b=_0xe6e9d1[_0xcf3c('0x5b')];for(var _0x410b19=0x0;_0x410b19<_0xe6e9d1[_0xcf3c('0x5c')][_0xcf3c('0x42')];_0x410b19++){var _0x56e093=_0xe6e9d1['conditions'][_0x410b19];var _0x52e4d3='i';var _0x1697f3=_['find'](_0x2f655d,['name',_0x56e093[_0xcf3c('0x47')]]);if(!_0x1697f3){switch(_0x56e093[_0xcf3c('0x47')]){case _0xcf3c('0x5d'):if(_0x56e093['value']==0x1){_0x4d0be6[_0xcf3c('0x5e')]('`'+_0x56e093['field']+_0xcf3c('0x5f'));}else{_0x4d0be6[_0xcf3c('0x5e')]('`'+_0x56e093[_0xcf3c('0x47')]+_0xcf3c('0x60'));}break;case _0xcf3c('0x61'):if(_0x56e093[_0xcf3c('0x62')]===_0xcf3c('0x63')){if(_0x56e093[_0xcf3c('0x64')][_0xcf3c('0x65')]('\x20')[_0xcf3c('0x42')]>0x1){_0x50a78b[_0x26870b](_0xcf3c('0x66'),qs['getFullTextValue'](_0x56e093[_0xcf3c('0x64')]),null);}else{var _0x191cfb='%'+_0x56e093[_0xcf3c('0x64')]+'%';_0x50a78b[_0x26870b](_0xcf3c('0x67'),_0x191cfb,_0x191cfb,_0x191cfb);}}else{_0x1697f3=_[_0xcf3c('0x68')](_0x2f655d,[_0xcf3c('0x21'),'ContactId']);_0x56e093[_0xcf3c('0x47')]='ContactId';_0x2ddec1=as[_0xcf3c('0x69')](_0x52e4d3,_0x1697f3['type'],_0x56e093);_0x50a78b[_0x26870b](_0x2ddec1['text'],_0x2ddec1['value'][_0xcf3c('0x6a')],_0x2ddec1[_0xcf3c('0x64')]['end']);}break;case _0xcf3c('0x6b'):var _0x138a4a=_0x56e093[_0xcf3c('0x64')][_0xcf3c('0x65')](',')[_0xcf3c('0x24')](function(_0x4518dd){return Number(_0x4518dd);});_0x138a4a['forEach'](function(_0x3873d8){_0x7c6af9['or'](_0xcf3c('0x6c'),'%,'+_0x3873d8+',%');});_0x5d3d9d=_[_0xcf3c('0x6d')](_0x5d3d9d,_0x138a4a);break;case _0xcf3c('0x6e'):if(_0x56e093[_0xcf3c('0x62')]===_0xcf3c('0x63')){_0x50a78b[_0x26870b](_0xcf3c('0x6f'),'%'+_0x56e093[_0xcf3c('0x64')]+'%',null);}else{_0x1697f3=_[_0xcf3c('0x68')](_0x2f655d,[_0xcf3c('0x21'),_0xcf3c('0x36')]);_0x56e093[_0xcf3c('0x47')]=_0xcf3c('0x36');_0x2ddec1=as[_0xcf3c('0x69')](_0x52e4d3,_0x1697f3[_0xcf3c('0x3a')],_0x56e093);_0x50a78b[_0x26870b](_0x2ddec1[_0xcf3c('0x70')],_0x2ddec1[_0xcf3c('0x64')][_0xcf3c('0x6a')],_0x2ddec1['value'][_0xcf3c('0x16')]);}break;case _0xcf3c('0x2c'):_0x2ddec1=as[_0xcf3c('0x69')]('me',null,_0x56e093);_0x50a78b[_0x26870b](_0x2ddec1[_0xcf3c('0x70')],_0x2ddec1[_0xcf3c('0x64')][_0xcf3c('0x6a')],_0x2ddec1[_0xcf3c('0x64')][_0xcf3c('0x16')]);break;}}else{var _0x2ddec1=as['buildExpression'](_0x52e4d3,_0x1697f3[_0xcf3c('0x3a')],_0x56e093);_0x50a78b[_0x26870b](_0x2ddec1['text'],_0x2ddec1[_0xcf3c('0x64')][_0xcf3c('0x6a')],_0x2ddec1[_0xcf3c('0x64')][_0xcf3c('0x16')]);}}}else{var _0x44e9ed=_(_0x9c753f['query'])['keys']()[_0xcf3c('0x24')](function(_0x5eca58){return _['some'](_0x2f655d,['name',_0x5eca58])?_0x5eca58:undefined;})[_0xcf3c('0x71')]()[_0xcf3c('0x64')]();if(!_[_0xcf3c('0x72')](_0x44e9ed)){_0x44e9ed[_0xcf3c('0x28')](function(_0x5d5664){if(_0x5d5664===_0xcf3c('0x73')){_0x4d0be6['where'](_0xcf3c('0x74'),[][_0xcf3c('0x75')](_0x9c753f[_0xcf3c('0x3d')][_0x5d5664]));}else if(_0x5d5664==='createdAt'){var _0x29c7ab=JSON[_0xcf3c('0x76')](_0x9c753f[_0xcf3c('0x3d')][_0x5d5664])[_0xcf3c('0x77')];var _0xeedd34=JSON[_0xcf3c('0x76')](_0x9c753f[_0xcf3c('0x3d')][_0x5d5664])[_0xcf3c('0x78')];_0x4d0be6[_0xcf3c('0x45')](_0xcf3c('0x79'),_0x29c7ab,_0xeedd34);}else{if(_0x9c753f[_0xcf3c('0x3d')][_0x5d5664]===_0xcf3c('0x7a')){_0x4d0be6[_0xcf3c('0x45')]('i.'+_0x5d5664+_0xcf3c('0x7b'));}else{_0x4d0be6[_0xcf3c('0x45')]('i.'+_0x5d5664+_0xcf3c('0x7c'),_0x9c753f['query'][_0x5d5664]);}}});}if(_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x7d')]){if(_0x9c753f[_0xcf3c('0x3d')]['read']==0x1){_0x4d0be6[_0xcf3c('0x5e')](_0xcf3c('0x7e'));}else{_0x4d0be6[_0xcf3c('0x5e')](_0xcf3c('0x7f'));}}if(_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x80')]){_0x5d3d9d=_[_0xcf3c('0x81')](_0x9c753f[_0xcf3c('0x3d')]['tag'])?_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x80')]:new Array(_0x9c753f['query'][_0xcf3c('0x80')]);_0x5d3d9d['forEach'](function(_0x1bb0c1){_0x7c6af9['or'](_0xcf3c('0x6c'),'%,'+_0x1bb0c1+',%');});}if(_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x82')]){var _0x4d430d=_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x82')]['replace']('\x5c','\x5c\x5c')[_0xcf3c('0x83')](/'/g,'\x27\x27');if(qs[_0xcf3c('0x84')](_0x4d430d)){_0x50a78b['or'](_0xcf3c('0x85'),_0x4d430d+'%');}else if(qs[_0xcf3c('0x86')](_0x4d430d)){_0x50a78b['or'](_0xcf3c('0x87'),_0x4d430d+'%');}else{_0x50a78b['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xcf3c('0x88')](_0x4d430d))['or'](_0xcf3c('0x89'),qs[_0xcf3c('0x88')](_0x4d430d));}}}_0x4d0be6[_0xcf3c('0x45')](_0x50a78b);_0x4d0be6[_0xcf3c('0x8a')](_0xcf3c('0x8b'));var _0x2ef478={'type':db[_0xcf3c('0x8c')]['QueryTypes'][_0xcf3c('0x8d')],'raw':!![]};var _0x1627d7=_0x4d0be6[_0xcf3c('0x8e')]();_0x1627d7[_0xcf3c('0x47')](_0xcf3c('0x8b'));_0x1627d7['field'](_0xcf3c('0x8f'),_0xcf3c('0x5d'));if(_0x99a4e0['order']){_0x99a4e0['order'][_0xcf3c('0x28')](function(_0x6e3b88){var _0x1012ec=_0x6e3b88[0x0]===_0xcf3c('0x90')?_0x6e3b88[0x0]:'i.'+_0x6e3b88[0x0];_0x4d0be6[_0xcf3c('0x91')](_0x1012ec,_0x6e3b88[0x1]===_0xcf3c('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x5d3d9d)){_0x4d0be6[_0xcf3c('0x5e')](_0x7c6af9);_0x1627d7['where']('t.id\x20IN\x20?',_0x5d3d9d);}BPromise['resolve']()['then'](function(){if(!_0xe6e9d1){if(_0x9c753f['query']['MailAccountId'])return;_0x1627d7['where'](_0xcf3c('0x93'));_0x4d0be6[_0xcf3c('0x45')](_0xcf3c('0x93'));return;}if(_0x9c753f[_0xcf3c('0x94')][_0xcf3c('0x95')]!==_0xcf3c('0x96'))return;return _0x9c753f[_0xcf3c('0x94')][_0xcf3c('0x97')]({'attributes':['id'],'raw':!![]})[_0xcf3c('0x1d')](function(_0x3b05ea){if(_['isEmpty'](_0x3b05ea)){_0x1627d7[_0xcf3c('0x45')](_0xcf3c('0x98'));_0x4d0be6['where'](_0xcf3c('0x98'));}else{_0x1627d7['where']('i.MailAccountId\x20IN\x20?',_[_0xcf3c('0x24')](_0x3b05ea,'id'));_0x4d0be6[_0xcf3c('0x45')](_0xcf3c('0x74'),_[_0xcf3c('0x24')](_0x3b05ea,'id'));}});})[_0xcf3c('0x1d')](function(){if(_0x9c753f[_0xcf3c('0x94')][_0xcf3c('0x95')]===_0xcf3c('0x96')&&!_0xe6e9d1&&!_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x73')])return[];return db[_0xcf3c('0x99')][_0xcf3c('0x3d')](_0x1627d7[_0xcf3c('0x9a')](),_0x2ef478);})['then'](function(_0x3ad2ac){_0x292f15['count']=_0x3ad2ac['length'];if(_0x292f15[_0xcf3c('0x9b')]===0x0)return[];return db[_0xcf3c('0x99')][_0xcf3c('0x3d')](_0x5b6802[_0xcf3c('0x9a')](),_0x2ef478)['then'](function(_0xaab4d){_0x525e3f=_[_0xcf3c('0x9c')](_0xaab4d,'id');_0x2ef478=_[_0xcf3c('0x9d')](_0x2ef478,{'model':db[_0xcf3c('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9c753f[_0xcf3c('0x3d')][_0xcf3c('0x41')]){_0x99a4e0[_0xcf3c('0x40')][_0xcf3c('0x28')](function(_0x131622){_0x4d0be6[_0xcf3c('0x47')]('i.'+_0x131622);});}else{_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0x8f'),_0xcf3c('0x5d'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0x9f'),_0xcf3c('0xa0'));_0x4d0be6[_0xcf3c('0x47')]('a.mandatoryDisposition',_0xcf3c('0xa1'));_0x4d0be6[_0xcf3c('0x47')]('a.email',_0xcf3c('0xa2'));_0x4d0be6['field'](_0xcf3c('0xa3'),'contactName');_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0x8b'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xa4'));_0x4d0be6['field'](_0xcf3c('0xa5'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xa6'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xa7'));_0x4d0be6[_0xcf3c('0x47')]('i.attach');_0x4d0be6['field'](_0xcf3c('0xa8'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xa9'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xaa'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xab'));_0x4d0be6['field'](_0xcf3c('0xac'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xad'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xae'));_0x4d0be6[_0xcf3c('0x47')]('i.to');_0x4d0be6['field'](_0xcf3c('0xaf'));_0x4d0be6['field'](_0xcf3c('0xb0'));_0x4d0be6[_0xcf3c('0x47')]('i.UserId');_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xb1'),'Contact.firstName');_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xb2'),_0xcf3c('0xb3'));_0x4d0be6[_0xcf3c('0x47')]('c.email',_0xcf3c('0xb4'));_0x4d0be6[_0xcf3c('0x47')]('c.phone',_0xcf3c('0xb5'));_0x4d0be6['field'](_0xcf3c('0xb6'),_0xcf3c('0xb7'));_0x4d0be6['field'](_0xcf3c('0xb8'),_0xcf3c('0xb9'));_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xba'),_0xcf3c('0xbb'));_0x4d0be6[_0xcf3c('0x47')]('o.internal','Owner.internal');_0x4d0be6[_0xcf3c('0x47')](_0xcf3c('0xbc'),_0xcf3c('0x26'));}if(_0x99a4e0[_0xcf3c('0x19')])_0x4d0be6['limit'](_0x99a4e0[_0xcf3c('0x19')]);if(_0x99a4e0['offset'])_0x4d0be6[_0xcf3c('0x1a')](_0x99a4e0[_0xcf3c('0x1a')]);return db[_0xcf3c('0x99')][_0xcf3c('0x3d')](_0x4d0be6['toString'](),_0x2ef478);})[_0xcf3c('0x1d')](function(_0xf0a123){if(_0xf0a123[_0xcf3c('0x42')]>0x0)_0x391976[_0xcf3c('0x45')](_0xcf3c('0xbd'),_['map'](_0xf0a123,'id'));return db[_0xcf3c('0x99')]['query'](_0x391976[_0xcf3c('0x9a')](),_0x2ef478)['then'](function(_0x33663e){var _0x53be65=_[_0xcf3c('0xbe')](_0x33663e,_0xcf3c('0xbf'));var _0x26640b=[];return db[_0xcf3c('0xc0')][_0xcf3c('0x2b')]({'attributes':[_0xcf3c('0xc1')],'raw':!![]})[_0xcf3c('0x1d')](function(_0x5236b9){var _0x3722a7=_0x5236b9[_0xcf3c('0xc1')];_0xf0a123['forEach'](function(_0x392483){_0x26640b[_0xcf3c('0x29')](updateMailInteraction(_0x392483,_0x525e3f,_0x53be65,_0x3722a7));});return BPromise[_0xcf3c('0xc2')](_0x26640b);});});});})[_0xcf3c('0x1d')](function(_0x1c702b){_0x292f15[_0xcf3c('0xc3')]=_0x1c702b;return _0x292f15;})[_0xcf3c('0x1d')](respondWithFilteredResult(_0x26870c,_0x99a4e0))[_0xcf3c('0x30')](handleError(_0x26870c,null));};exports[_0xcf3c('0xc4')]=function(_0x19a6e9,_0x288215){var _0x249842={'raw':![],'where':{'id':_0x19a6e9[_0xcf3c('0xc5')]['id']}},_0x152bf9={};_0x152bf9[_0xcf3c('0x3c')]=_[_0xcf3c('0x3e')](db[_0xcf3c('0x9e')]['rawAttributes']);_0x152bf9[_0xcf3c('0x3d')]=_['keys'](_0x19a6e9[_0xcf3c('0x3d')]);_0x152bf9[_0xcf3c('0x3f')]=_[_0xcf3c('0xc6')](_0x152bf9[_0xcf3c('0x3c')],_0x152bf9[_0xcf3c('0x3d')]);_0x249842[_0xcf3c('0x40')]=_['intersection'](_0x152bf9[_0xcf3c('0x3c')],qs['fields'](_0x19a6e9[_0xcf3c('0x3d')][_0xcf3c('0x41')]));_0x249842[_0xcf3c('0x40')]=_0x249842[_0xcf3c('0x40')][_0xcf3c('0x42')]?_0x249842[_0xcf3c('0x40')]:_0x152bf9[_0xcf3c('0x3c')];if(_0x19a6e9['query'][_0xcf3c('0xc7')]){_0x249842[_0xcf3c('0xc8')]=[{'all':!![]}];}_0x249842=_['merge']({},_0x249842,_0x19a6e9['options']);return db[_0xcf3c('0x9e')][_0xcf3c('0x68')](_0x249842)[_0xcf3c('0x1d')](handleEntityNotFound(_0x288215,null))['then'](respondWithResult(_0x288215,null))[_0xcf3c('0x30')](handleError(_0x288215,null));};exports[_0xcf3c('0xc9')]=function(_0x4614c3,_0x1d3173){return db[_0xcf3c('0x9e')][_0xcf3c('0xc9')](_0x4614c3['body'],{})[_0xcf3c('0x1d')](respondWithResult(_0x1d3173,0xc9))[_0xcf3c('0x30')](handleError(_0x1d3173,null));};exports[_0xcf3c('0x1c')]=function(_0x25ec48,_0x3e2c78){if(_0x25ec48[_0xcf3c('0xca')]['id']){delete _0x25ec48[_0xcf3c('0xca')]['id'];}return db[_0xcf3c('0x9e')][_0xcf3c('0x68')]({'where':{'id':_0x25ec48[_0xcf3c('0xc5')]['id']}})['then'](handleEntityNotFound(_0x3e2c78,null))['then'](saveUpdates(_0x25ec48[_0xcf3c('0xca')],null))['then'](respondWithResult(_0x3e2c78,null))[_0xcf3c('0x30')](handleError(_0x3e2c78,null));};exports['destroy']=function(_0x4ac0ba,_0x44940f){return db[_0xcf3c('0x9e')][_0xcf3c('0x68')]({'where':{'id':_0x4ac0ba['params']['id']}})['then'](handleEntityNotFound(_0x44940f,null))['then'](removeEntity(_0x44940f,null))[_0xcf3c('0x30')](handleError(_0x44940f,null));};exports[_0xcf3c('0xcb')]=function(_0x1d96cd,_0x54f947){return db[_0xcf3c('0x9e')][_0xcf3c('0xcb')]()[_0xcf3c('0x1d')](respondWithResult(_0x54f947,null))[_0xcf3c('0x30')](handleError(_0x54f947,null));};exports['addMessage']=function(_0xbd0f50,_0x41c552){return db['MailMessage'][_0xcf3c('0x68')]({'where':{'id':_0xbd0f50['params']['id']}})[_0xcf3c('0x1d')](handleEntityNotFound(_0x41c552,null))['then'](function(_0x268ab7){if(_0x268ab7){return _0x268ab7['addMessage'](_0xbd0f50[_0xcf3c('0xca')][_0xcf3c('0xcc')],_[_0xcf3c('0xcd')](_0xbd0f50[_0xcf3c('0xca')],[_0xcf3c('0xcc'),'id'])||{});}})['then'](respondWithResult(_0x41c552,null))[_0xcf3c('0x30')](handleError(_0x41c552,null));};exports[_0xcf3c('0xce')]=function(_0x169439,_0x4919fd){var _0x5d6132={'raw':![],'where':{}};var _0x280ae9={};var _0x18a7f8={'count':0x0,'rows':[]};return db['MailInteraction'][_0xcf3c('0x2b')]({'where':{'id':_0x169439[_0xcf3c('0xc5')]['id']}})[_0xcf3c('0x1d')](handleEntityNotFound(_0x4919fd,null))[_0xcf3c('0x1d')](function(_0x21a78c){if(_0x21a78c){_0x280ae9[_0xcf3c('0x3c')]=_[_0xcf3c('0x3e')](db['MailMessage'][_0xcf3c('0x39')]);_0x280ae9[_0xcf3c('0x3d')]=_['keys'](_0x169439['query']);_0x280ae9['filters']=_[_0xcf3c('0xc6')](_0x280ae9[_0xcf3c('0x3c')],_0x280ae9[_0xcf3c('0x3d')]);_0x5d6132[_0xcf3c('0x40')]=_['intersection'](_0x280ae9[_0xcf3c('0x3c')],qs[_0xcf3c('0x41')](_0x169439[_0xcf3c('0x3d')][_0xcf3c('0x41')]));_0x5d6132[_0xcf3c('0x40')]=_0x5d6132[_0xcf3c('0x40')][_0xcf3c('0x42')]?_0x5d6132[_0xcf3c('0x40')]:_0x280ae9[_0xcf3c('0x3c')];if(!_0x169439[_0xcf3c('0x3d')][_0xcf3c('0x43')](_0xcf3c('0x44'))){_0x5d6132[_0xcf3c('0x19')]=qs[_0xcf3c('0x19')](_0x169439[_0xcf3c('0x3d')]['limit']);_0x5d6132['offset']=qs['offset'](_0x169439['query'][_0xcf3c('0x1a')]);}_0x5d6132[_0xcf3c('0x91')]=qs[_0xcf3c('0xcf')](_0x169439[_0xcf3c('0x3d')]['sort']);_0x5d6132[_0xcf3c('0x45')]=qs[_0xcf3c('0x3f')](_[_0xcf3c('0x46')](_0x169439['query'],_0x280ae9[_0xcf3c('0x3f')]));_0x5d6132[_0xcf3c('0x45')][_0xcf3c('0xbf')]=_0x21a78c['id'];if(_0x169439[_0xcf3c('0x3d')]['filter']){_0x5d6132[_0xcf3c('0x45')]=_[_0xcf3c('0x9d')](_0x5d6132[_0xcf3c('0x45')],{'$or':_[_0xcf3c('0x24')](_0x5d6132[_0xcf3c('0x40')],function(_0x1cede9){var _0x17db94={};_0x17db94[_0x1cede9]={'$like':'%'+_0x169439[_0xcf3c('0x3d')][_0xcf3c('0x82')]+'%'};return _0x17db94;})});}if(_0x169439['query']['$gte']){var _0x175067=_0x169439[_0xcf3c('0x3d')][_0xcf3c('0x77')]['split'](',');var _0x3cf36c={};_0x3cf36c[_0x175067[0x0]]={'$gte':moment(_0x175067[0x1])[_0xcf3c('0xd0')](_0xcf3c('0xd1'))};_0x5d6132['where']=_[_0xcf3c('0x9d')](_0x5d6132[_0xcf3c('0x45')],_0x3cf36c);}_0x5d6132=_[_0xcf3c('0x9d')]({},_0x5d6132,_0x169439['options']);return db[_0xcf3c('0x2a')][_0xcf3c('0x9b')]({'where':_0x5d6132['where']})[_0xcf3c('0x1d')](function(_0x22af9){_0x18a7f8['count']=_0x22af9;if(_0x169439['query'][_0xcf3c('0xc7')]){_0x5d6132['include']=[{'all':!![]}];}return db['MailMessage'][_0xcf3c('0xd2')](_0x5d6132);})[_0xcf3c('0x1d')](function(_0x162e50){if(_0x169439[_0xcf3c('0x3d')]['inlineCss']===_0xcf3c('0xd3')){for(var _0x1303d6=0x0;_0x1303d6<_0x162e50[_0xcf3c('0x42')];_0x1303d6++){_0x162e50[_0x1303d6][_0xcf3c('0xca')]=juice(_0x162e50[_0x1303d6][_0xcf3c('0xca')]);}}_0x18a7f8[_0xcf3c('0xc3')]=_0x162e50;return _0x18a7f8;});}})[_0xcf3c('0x1d')](respondWithFilteredResult(_0x4919fd,_0x5d6132))[_0xcf3c('0x30')](handleError(_0x4919fd,null));};exports[_0xcf3c('0xd4')]=function(_0x1639ad,_0x5a987b){return db[_0xcf3c('0x9e')]['find']({'where':{'id':_0x1639ad['params']['id']}})['then'](handleEntityNotFound(_0x5a987b,null))['then'](function(_0x3cd139){if(_0x3cd139){return _0x3cd139[_0xcf3c('0xd5')](_0x1639ad[_0xcf3c('0xca')]['ids'],_['omit'](_0x1639ad[_0xcf3c('0xca')],['ids','id'])||{})[_0xcf3c('0xd6')](function(){return db['Tag']['findAll']({'attributes':['id',_0xcf3c('0x21'),_0xcf3c('0x48')],'where':{'id':_0x1639ad[_0xcf3c('0xca')]['ids']}});})[_0xcf3c('0x1d')](function(_0x3ddc9b){socket[_0xcf3c('0xd7')](_0xcf3c('0xd8'),{'id':Number(_0x1639ad[_0xcf3c('0xc5')]['id']),'tags':_0x3ddc9b||[]});return{'id':Number(_0x1639ad[_0xcf3c('0xc5')]['id']),'tags':_0x3ddc9b||[]};});}})['then'](respondWithResult(_0x5a987b,null))['catch'](handleError(_0x5a987b,null));};exports[_0xcf3c('0xd9')]=function(_0x3c39c9,_0x433c71){return db[_0xcf3c('0x9e')][_0xcf3c('0x68')]({'where':{'id':_0x3c39c9[_0xcf3c('0xc5')]['id']}})[_0xcf3c('0x1d')](handleEntityNotFound(_0x433c71,null))['then'](function(_0x1c2a09){if(_0x1c2a09){return _0x1c2a09[_0xcf3c('0xd9')](_0x3c39c9['query'][_0xcf3c('0xcc')]);}})['then'](respondWithStatusCode(_0x433c71,null))[_0xcf3c('0x30')](handleError(_0x433c71,null));};exports[_0xcf3c('0xda')]=function(_0x156743,_0x33917a){var _0x3fd48e=moment()[_0xcf3c('0xdb')]()[_0xcf3c('0x9a')]();var _0x188d9b=path[_0xcf3c('0xdc')](config['root'],_0xcf3c('0xdd'),_0xcf3c('0xde'),_0xcf3c('0xdf'));var _0x4a05c2=path[_0xcf3c('0xdc')](config[_0xcf3c('0xe0')],_0xcf3c('0xdd'),_0xcf3c('0xde'),_0xcf3c('0xe1'));var _0x1d0c21=path[_0xcf3c('0xdc')](_0x188d9b,_0x3fd48e);var _0x133a01=util['format'](_0xcf3c('0xe2'),_0x156743['params']['id'],_0x3fd48e);var _0x297423=path[_0xcf3c('0xdc')](_0x188d9b,_0x133a01);var _0x2ae94d=[];if(_0x156743[_0xcf3c('0x3d')][_0xcf3c('0xe1')]){_0x2ae94d[_0xcf3c('0x29')]({'model':db[_0xcf3c('0xe3')],'as':_0xcf3c('0xe4'),'raw':!![]});}var _0x357aa0=[{'model':db[_0xcf3c('0x2a')],'as':_0xcf3c('0xe5'),'attributes':['id',_0xcf3c('0xca'),_0xcf3c('0x49'),'to','cc','bcc',_0xcf3c('0xe6'),'createdAt'],'where':{'secret':![]},'order':qs[_0xcf3c('0xcf')]('id'),'include':_0x2ae94d}];return db[_0xcf3c('0x9e')][_0xcf3c('0x68')]({'where':{'id':_0x156743[_0xcf3c('0xc5')]['id']},'include':_0x357aa0})[_0xcf3c('0x1d')](handleEntityNotFound(_0x33917a,null))['then'](function(_0x5a4b85){if(_0x5a4b85&&_0x5a4b85[_0xcf3c('0xe5')]){var _0x2010f7=_0x5a4b85['get']({'plain':!![]});fs[_0xcf3c('0xe7')](_0x1d0c21);return BPromise['each'](_0x2010f7['Messages'],function(_0x53de74,_0x4f1e20){var _0x4fe25d={'from':_0x53de74[_0xcf3c('0x49')],'to':_0x53de74['to'],'subject':_0x53de74[_0xcf3c('0xe6')],'html':htmlEntities[_0xcf3c('0xe8')](_0x53de74[_0xcf3c('0xca')]),'headers':{'Date':moment(_0x53de74[_0xcf3c('0xe9')])[_0xcf3c('0xd0')](_0xcf3c('0xea'))},'attachments':[]};if(_0x53de74['cc']){_0x4fe25d[_0xcf3c('0xeb')]['Cc']=_0x53de74['cc'];}if(_0x53de74[_0xcf3c('0xec')]){_0x4fe25d['headers'][_0xcf3c('0xed')]=_0x53de74['bcc'];}return new BPromise(function(_0x288220,_0x1ae502){if(_0x53de74['Attachments']){for(var _0x5a0715=0x0;_0x5a0715<_0x53de74['Attachments'][_0xcf3c('0x42')];_0x5a0715++){var _0x42dfd3=_0x53de74['Attachments'][_0x5a0715];var _0x2ea681=path['join'](_0x4a05c2,_0x42dfd3[_0xcf3c('0xee')]);if(fs[_0xcf3c('0xef')](_0x2ea681)){_0x4fe25d[_0xcf3c('0xe1')][_0xcf3c('0x29')]({'name':_0x42dfd3[_0xcf3c('0x21')],'contentType':_0x42dfd3[_0xcf3c('0x3a')],'data':fs['readFileSync'](_0x2ea681)});}}}emlformat[_0xcf3c('0xf0')](_0x4fe25d,function(_0x4f0bab,_0xcf5a31){if(_0x4f0bab)return _0x1ae502(_0x4f0bab);fs[_0xcf3c('0xf1')](path[_0xcf3c('0xdc')](_0x1d0c21,util[_0xcf3c('0xd0')](_0xcf3c('0xf2'),_0x4f1e20)),_0xcf5a31);return _0x288220(_0xcf5a31);});});})[_0xcf3c('0x1d')](function(){return new BPromise(function(_0x523276,_0x73eaa6){zipdir(_0x1d0c21,{'saveTo':_0x297423},function(_0x3c928d,_0x2f839d){if(_0x3c928d)return _0x73eaa6(_0x3c928d);return _0x523276(_0x2f839d);});})[_0xcf3c('0x1d')](function(){return new BPromise(function(_0x675ecf,_0x4504d4){rimraf(_0x1d0c21,function(_0x46ae25){if(_0x46ae25)_0x4504d4(_0x46ae25);return _0x675ecf();});});})[_0xcf3c('0x1d')](function(){return _0x33917a[_0xcf3c('0xda')](_0x297423,_0x133a01,function(_0x28265f){if(!_0x28265f)fs[_0xcf3c('0xf3')](_0x297423);});});});}else{return _0x33917a[_0xcf3c('0x14')](0xc8);}})['catch'](handleError(_0x33917a,null));}; \ No newline at end of file +var _0x6255=['server','files','tmp','root','attachments','transcript-%d-%s.zip','Messages','bcc','mkdirSync','each','decode','headers','Attachments','basename','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','stack','name','Users','map','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','catch','waiting','talking','answered','unmanaged','total','UserId','closed','MailInteraction','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','from','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','keys','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.to','i.ContactId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','rawAttributes','includeAll','include','options','create','body','params','describe','addMessage','ids','omit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','join'];(function(_0x22cddd,_0x565a00){var _0x242892=function(_0xc2020a){while(--_0xc2020a){_0x22cddd['push'](_0x22cddd['shift']());}};_0x242892(++_0x565a00);}(_0x6255,0x1da));var _0x5625=function(_0xc12dac,_0x126684){_0xc12dac=_0xc12dac-0x0;var _0x4448f1=_0x6255[_0xc12dac];return _0x4448f1;};'use strict';var emlformat=require(_0x5625('0x0'));var rimraf=require(_0x5625('0x1'));var zipdir=require(_0x5625('0x2'));var moment=require(_0x5625('0x3'));var BPromise=require(_0x5625('0x4'));var util=require('util');var path=require(_0x5625('0x5'));var fs=require('fs');var _=require(_0x5625('0x6'));var squel=require(_0x5625('0x7'));var juice=require(_0x5625('0x8'));var Redis=require(_0x5625('0x9'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x5625('0xa'))(_0x5625('0xb'));var config=require(_0x5625('0xc'));var db=require(_0x5625('0xd'))['db'];var htmlEntities=require(_0x5625('0xe'));config[_0x5625('0xf')]=_[_0x5625('0x10')](config[_0x5625('0xf')],{'host':_0x5625('0x11'),'port':0x18eb});var socket=require(_0x5625('0x12'))(new Redis(config[_0x5625('0xf')]));require(_0x5625('0x13'))[_0x5625('0x14')](socket);function respondWithStatusCode(_0x257cec,_0x3205b1){_0x3205b1=_0x3205b1||0xcc;return function(_0x3260e9){if(_0x3260e9){return _0x257cec[_0x5625('0x15')](_0x3205b1);}return _0x257cec[_0x5625('0x16')](_0x3205b1)[_0x5625('0x17')]();};}function respondWithResult(_0x1cb368,_0x1cccea){_0x1cccea=_0x1cccea||0xc8;return function(_0x2172a8){if(_0x2172a8){return _0x1cb368[_0x5625('0x16')](_0x1cccea)[_0x5625('0x18')](_0x2172a8);}};}function respondWithFilteredResult(_0x202de4,_0x2f6dee){return function(_0x57f3d6){if(_0x57f3d6){var _0x1905ee=typeof _0x2f6dee[_0x5625('0x19')]===_0x5625('0x1a')&&typeof _0x2f6dee[_0x5625('0x1b')]===_0x5625('0x1a');var _0x159c62=_0x57f3d6[_0x5625('0x1c')];var _0x2e3ad4=_0x1905ee?0x0:_0x2f6dee[_0x5625('0x19')];var _0x5684f5=_0x1905ee?_0x57f3d6[_0x5625('0x1c')]:_0x2f6dee[_0x5625('0x19')]+_0x2f6dee['limit'];var _0x574365;if(_0x5684f5>=_0x159c62){_0x5684f5=_0x159c62;_0x574365=0xc8;}else{_0x574365=0xce;}_0x202de4['status'](_0x574365);return _0x202de4['set'](_0x5625('0x1d'),_0x2e3ad4+'-'+_0x5684f5+'/'+_0x159c62)[_0x5625('0x18')](_0x57f3d6);}return null;};}function saveUpdates(_0x3188f0){return function(_0x2a917e){if(_0x2a917e){return _0x2a917e[_0x5625('0x1e')](_0x3188f0)[_0x5625('0x1f')](function(_0x57ba91){return _0x57ba91;});}return null;};}function removeEntity(_0x5cf66c){return function(_0x49b21b){if(_0x49b21b){return _0x49b21b[_0x5625('0x20')]()[_0x5625('0x1f')](function(){_0x5cf66c['status'](0xcc)[_0x5625('0x17')]();});}};}function handleEntityNotFound(_0x2d9f53){return function(_0x17d408){if(!_0x17d408){_0x2d9f53[_0x5625('0x15')](0x194);}return _0x17d408;};}function handleError(_0x1e565e,_0xc8280d){_0xc8280d=_0xc8280d||0x1f4;return function(_0x371b9d){logger['error'](_0x371b9d[_0x5625('0x21')]);if(_0x371b9d[_0x5625('0x22')]){delete _0x371b9d[_0x5625('0x22')];}_0x1e565e['status'](_0xc8280d)['send'](_0x371b9d);};}function getInteractionUsers(_0x201c45,_0x3f43ea){return new BPromise(function(_0x3123ac,_0x4caa9d){try{if(_0x3f43ea[_0x201c45['id']]){_0x201c45[_0x5625('0x23')]=_[_0x5625('0x24')](_0x3f43ea[_0x201c45['id']],function(_0x1b956f){return{'id':_0x1b956f['id'],'fullname':_0x1b956f['fullname']};});}}catch(_0x4a4a63){_0x4caa9d(_0x4a4a63);}_0x3123ac(_0x201c45);});}function getInteractionTags(_0x30a1f8,_0xe63683){return new BPromise(function(_0x66fdf1,_0x54c57b){try{if(_0x30a1f8[_0x5625('0x25')]){_0x30a1f8[_0x5625('0x26')]=[];_0x30a1f8[_0x5625('0x25')][_0x5625('0x27')](',')[_0x5625('0x28')](function(_0x86234a){_0x30a1f8['Tags'][_0x5625('0x29')](_0xe63683[_0x86234a]);});}delete _0x30a1f8[_0x5625('0x25')];}catch(_0x59d347){_0x54c57b(_0x59d347);}_0x66fdf1(_0x30a1f8);});}function getLastMessageText(_0xab0fa0){return new BPromise(function(_0x5bf3ad,_0xd9eec7){return db[_0x5625('0x2a')][_0x5625('0x2b')]({'where':{'$and':[{'MailInteractionId':_0xab0fa0['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5625('0x2c')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5625('0x2d')],'order':_0x5625('0x2e'),'raw':!![]})[_0x5625('0x1f')](function(_0x5eeff1){if(_0x5eeff1&&_0x5eeff1[_0x5625('0x2d')]){_0xab0fa0[_0x5625('0x2f')]=_['trimStart'](_0x5eeff1[_0x5625('0x2d')]);}_0x5bf3ad(_0xab0fa0);})['catch'](function(_0x17c2eb){_0xd9eec7(_0x17c2eb);});});}function updateMailInteraction(_0x413d3b,_0x1e6bb3,_0x4c1aff,_0x322364){return new BPromise(function(_0x59f98f,_0x490583){return getInteractionUsers(_0x413d3b,_0x4c1aff)[_0x5625('0x1f')](function(_0x5039d8){return getInteractionTags(_0x5039d8,_0x1e6bb3);})['then'](function(_0x4490c1){return getStateInteraction(_0x4490c1);})[_0x5625('0x1f')](function(_0x3d36f7){if(_0x322364){_0x59f98f(getLastMessageText(_0x3d36f7));}else{_0x59f98f(_0x3d36f7);}})[_0x5625('0x30')](function(_0x5105f0){_0x490583(_0x5105f0);});});}function getStateInteraction(_0x52f162){return new BPromise(function(_0x4d18c3){_0x52f162[_0x5625('0x31')]=0x0;_0x52f162[_0x5625('0x32')]=0x0;_0x52f162[_0x5625('0x33')]=0x0;_0x52f162[_0x5625('0x34')]=0x0;_0x52f162[_0x5625('0x35')]=0x0;if(!_0x52f162['closed']&&!_0x52f162['UserId']){_0x52f162[_0x5625('0x31')]+=0x1;}if(!_0x52f162['closed']&&_0x52f162[_0x5625('0x36')]){_0x52f162[_0x5625('0x32')]+=0x1;if(_0x52f162[_0x5625('0x31')]){_0x52f162[_0x5625('0x31')]-=0x1;}}if(_0x52f162[_0x5625('0x37')]&&_0x52f162[_0x5625('0x36')]){_0x52f162['answered']+=0x1;if(_0x52f162['talking']){_0x52f162[_0x5625('0x32')]-=0x1;}}if(_0x52f162[_0x5625('0x37')]&&!_0x52f162['UserId']){_0x52f162['unmanaged']+=0x1;if(_0x52f162[_0x5625('0x31')]){_0x52f162[_0x5625('0x31')]-=0x1;}}_0x52f162[_0x5625('0x35')]+=0x1;_0x4d18c3(_0x52f162);});}exports['index']=function(_0x1c831b,_0x2a1f4d){var _0x462ed3={},_0x520c45={},_0x25e921={'count':0x0,'rows':[]};var _0x1ac65a=_[_0x5625('0x24')](db[_0x5625('0x38')]['rawAttributes'],function(_0x5f41f8){return{'name':_0x5f41f8[_0x5625('0x39')],'type':_0x5f41f8['type'][_0x5625('0x3a')]};});_0x520c45['model']=_[_0x5625('0x24')](_0x1ac65a,_0x5625('0x22'));_0x520c45[_0x5625('0x3b')]=_['keys'](_0x1c831b['query']);_0x520c45[_0x5625('0x3c')]=_[_0x5625('0x3d')](_0x520c45[_0x5625('0x3e')],_0x520c45['query']);_0x462ed3[_0x5625('0x3f')]=_[_0x5625('0x3d')](_0x520c45['model'],qs['fields'](_0x1c831b['query'][_0x5625('0x40')]));_0x462ed3[_0x5625('0x3f')]=_0x462ed3[_0x5625('0x3f')][_0x5625('0x41')]?_0x462ed3[_0x5625('0x3f')]:_0x520c45[_0x5625('0x3e')];if(!_0x1c831b['query'][_0x5625('0x42')](_0x5625('0x43'))){_0x462ed3[_0x5625('0x1b')]=qs[_0x5625('0x1b')](_0x1c831b[_0x5625('0x3b')][_0x5625('0x1b')]);_0x462ed3[_0x5625('0x19')]=qs[_0x5625('0x19')](_0x1c831b[_0x5625('0x3b')][_0x5625('0x19')]);}_0x462ed3[_0x5625('0x44')]=qs[_0x5625('0x45')](_0x1c831b[_0x5625('0x3b')][_0x5625('0x45')]);_0x462ed3[_0x5625('0x46')]=qs[_0x5625('0x3c')](_[_0x5625('0x47')](_0x1c831b['query'],_0x520c45[_0x5625('0x3c')]),_0x1ac65a);var _0x1a1931=[];var _0x1afc61=squel[_0x5625('0x48')]()[_0x5625('0x49')]('id')[_0x5625('0x49')](_0x5625('0x22'))[_0x5625('0x49')](_0x5625('0x4a'))['from']('tools_tags');var _0x587a2f=squel['select']()[_0x5625('0x49')](_0x5625('0x4b'))[_0x5625('0x49')](_0x5625('0x4c'))[_0x5625('0x49')]('ui.MailInteractionId')[_0x5625('0x4d')]('user_has_mail_interactions','ui')['left_join'](_0x5625('0x4e'),'u',_0x5625('0x4f'));var _0xc4526d=squel[_0x5625('0x48')]()[_0x5625('0x4d')](_0x5625('0x50'),'i')[_0x5625('0x51')](_0x5625('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x5625('0x4e'),'o','o.id\x20=\x20i.UserId')[_0x5625('0x51')](_0x5625('0x53'),'a',_0x5625('0x54'))[_0x5625('0x51')](_0x5625('0x55'),'me','me.MailInteractionId\x20=\x20i.id')[_0x5625('0x51')](_0x5625('0x56'),'it',_0x5625('0x57'))[_0x5625('0x51')](_0x5625('0x58'),'t','t.id\x20=\x20it.TagId');var _0x46d91b=squel[_0x5625('0x59')]();var _0x143938=[];var _0x2ec0f0=squel[_0x5625('0x59')]();var _0x150aa6;if(_0x1c831b[_0x5625('0x3b')][_0x5625('0x5a')]){_0x150aa6=as[_0x5625('0x5b')](_0x1c831b['query'][_0x5625('0x5a')]);var _0x40aaf9=_0x150aa6[_0x5625('0x5c')];for(var _0x2fca69=0x0;_0x2fca69<_0x150aa6[_0x5625('0x5d')][_0x5625('0x41')];_0x2fca69++){var _0x2ce636=_0x150aa6['conditions'][_0x2fca69];var _0x5628ff='i';var _0xaaea97=_[_0x5625('0x5e')](_0x1ac65a,[_0x5625('0x22'),_0x2ce636[_0x5625('0x49')]]);if(!_0xaaea97){switch(_0x2ce636['field']){case _0x5625('0x5f'):if(_0x2ce636[_0x5625('0x60')]==0x1){_0xc4526d[_0x5625('0x61')]('`'+_0x2ce636['field']+'`\x20=\x200');}else{_0xc4526d['having']('`'+_0x2ce636[_0x5625('0x49')]+_0x5625('0x62'));}break;case _0x5625('0x63'):if(_0x2ce636[_0x5625('0x64')]===_0x5625('0x65')){if(_0x2ce636[_0x5625('0x60')][_0x5625('0x27')]('\x20')[_0x5625('0x41')]>0x1){_0x46d91b[_0x40aaf9](_0x5625('0x66'),qs[_0x5625('0x67')](_0x2ce636[_0x5625('0x60')]),null);}else{var _0x2ce699='%'+_0x2ce636[_0x5625('0x60')]+'%';_0x46d91b[_0x40aaf9](_0x5625('0x68'),_0x2ce699,_0x2ce699,_0x2ce699);}}else{_0xaaea97=_[_0x5625('0x5e')](_0x1ac65a,[_0x5625('0x22'),'ContactId']);_0x2ce636['field']=_0x5625('0x69');_0x340583=as[_0x5625('0x6a')](_0x5628ff,_0xaaea97['type'],_0x2ce636);_0x46d91b[_0x40aaf9](_0x340583[_0x5625('0x6b')],_0x340583['value'][_0x5625('0x6c')],_0x340583['value']['end']);}break;case _0x5625('0x6d'):var _0x5e236c=_0x2ce636[_0x5625('0x60')][_0x5625('0x27')](',')[_0x5625('0x24')](function(_0x35c178){return Number(_0x35c178);});_0x5e236c[_0x5625('0x28')](function(_0x380a13){_0x2ec0f0['or'](_0x5625('0x6e'),'%,'+_0x380a13+',%');});_0x143938=_[_0x5625('0x6f')](_0x143938,_0x5e236c);break;case _0x5625('0x70'):if(_0x2ce636[_0x5625('0x64')]===_0x5625('0x65')){_0x46d91b[_0x40aaf9](_0x5625('0x71'),'%'+_0x2ce636['value']+'%',null);}else{_0xaaea97=_[_0x5625('0x5e')](_0x1ac65a,[_0x5625('0x22'),_0x5625('0x36')]);_0x2ce636[_0x5625('0x49')]=_0x5625('0x36');_0x340583=as[_0x5625('0x6a')](_0x5628ff,_0xaaea97[_0x5625('0x72')],_0x2ce636);_0x46d91b[_0x40aaf9](_0x340583[_0x5625('0x6b')],_0x340583[_0x5625('0x60')]['start'],_0x340583[_0x5625('0x60')]['end']);}break;case _0x5625('0x2d'):_0x340583=as[_0x5625('0x6a')]('me',null,_0x2ce636);_0x46d91b[_0x40aaf9](_0x340583[_0x5625('0x6b')],_0x340583[_0x5625('0x60')][_0x5625('0x6c')],_0x340583[_0x5625('0x60')][_0x5625('0x17')]);break;}}else{var _0x340583=as[_0x5625('0x6a')](_0x5628ff,_0xaaea97['type'],_0x2ce636);_0x46d91b[_0x40aaf9](_0x340583['text'],_0x340583[_0x5625('0x60')]['start'],_0x340583[_0x5625('0x60')][_0x5625('0x17')]);}}}else{var _0x1b60f7=_(_0x1c831b['query'])[_0x5625('0x73')]()[_0x5625('0x24')](function(_0x26065f){return _[_0x5625('0x74')](_0x1ac65a,[_0x5625('0x22'),_0x26065f])?_0x26065f:undefined;})[_0x5625('0x75')]()[_0x5625('0x60')]();if(!_[_0x5625('0x76')](_0x1b60f7)){_0x1b60f7['forEach'](function(_0x2e08c2){if(_0x2e08c2==='MailAccountId'){_0xc4526d[_0x5625('0x46')](_0x5625('0x77'),[][_0x5625('0x78')](_0x1c831b[_0x5625('0x3b')][_0x2e08c2]));}else if(_0x2e08c2===_0x5625('0x79')){var _0x4080b5=JSON['parse'](_0x1c831b[_0x5625('0x3b')][_0x2e08c2])['$gte'];var _0x20e854=JSON['parse'](_0x1c831b[_0x5625('0x3b')][_0x2e08c2])[_0x5625('0x7a')];_0xc4526d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4080b5,_0x20e854);}else{if(_0x1c831b[_0x5625('0x3b')][_0x2e08c2]===_0x5625('0x7b')){_0xc4526d['where']('i.'+_0x2e08c2+'\x20IS\x20NULL');}else{_0xc4526d[_0x5625('0x46')]('i.'+_0x2e08c2+_0x5625('0x7c'),_0x1c831b['query'][_0x2e08c2]);}}});}if(_0x1c831b[_0x5625('0x3b')][_0x5625('0x7d')]){if(_0x1c831b[_0x5625('0x3b')][_0x5625('0x7d')]==0x1){_0xc4526d[_0x5625('0x61')](_0x5625('0x7e'));}else{_0xc4526d[_0x5625('0x61')](_0x5625('0x7f'));}}if(_0x1c831b[_0x5625('0x3b')]['tag']){_0x143938=_[_0x5625('0x80')](_0x1c831b[_0x5625('0x3b')][_0x5625('0x81')])?_0x1c831b[_0x5625('0x3b')]['tag']:new Array(_0x1c831b[_0x5625('0x3b')][_0x5625('0x81')]);_0x143938[_0x5625('0x28')](function(_0x52d47c){_0x2ec0f0['or'](_0x5625('0x6e'),'%,'+_0x52d47c+',%');});}if(_0x1c831b[_0x5625('0x3b')][_0x5625('0x82')]){var _0x3bec8c=_0x1c831b[_0x5625('0x3b')][_0x5625('0x82')][_0x5625('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5625('0x84')](_0x3bec8c)){_0x46d91b['or'](_0x5625('0x85'),_0x3bec8c+'%');}else if(qs['isEmail'](_0x3bec8c)){_0x46d91b['or'](_0x5625('0x86'),_0x3bec8c+'%');}else{_0x46d91b['or'](_0x5625('0x87'),qs['getFullTextValue'](_0x3bec8c))['or'](_0x5625('0x88'),qs['getFullTextValue'](_0x3bec8c));}}}_0xc4526d[_0x5625('0x46')](_0x46d91b);_0xc4526d[_0x5625('0x89')](_0x5625('0x8a'));var _0x5c83da={'type':db['Sequelize'][_0x5625('0x8b')][_0x5625('0x8c')],'raw':!![]};var _0x25f359=_0xc4526d[_0x5625('0x8d')]();_0x25f359['field'](_0x5625('0x8a'));_0x25f359[_0x5625('0x49')](_0x5625('0x8e'),_0x5625('0x5f'));if(_0x462ed3['order']){_0x462ed3['order'][_0x5625('0x28')](function(_0x588dac){var _0x4f7c41=_0x588dac[0x0]===_0x5625('0x8f')?_0x588dac[0x0]:'i.'+_0x588dac[0x0];_0xc4526d[_0x5625('0x44')](_0x4f7c41,_0x588dac[0x1]===_0x5625('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x143938)){_0xc4526d[_0x5625('0x61')](_0x2ec0f0);_0x25f359['where'](_0x5625('0x91'),_0x143938);}BPromise['resolve']()[_0x5625('0x1f')](function(){if(!_0x150aa6){if(_0x1c831b[_0x5625('0x3b')][_0x5625('0x92')])return;_0x25f359[_0x5625('0x46')](_0x5625('0x93'));_0xc4526d[_0x5625('0x46')](_0x5625('0x93'));return;}if(_0x1c831b[_0x5625('0x94')][_0x5625('0x95')]!==_0x5625('0x96'))return;return _0x1c831b['user'][_0x5625('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x58ac15){if(_[_0x5625('0x76')](_0x58ac15)){_0x25f359['where'](_0x5625('0x98'));_0xc4526d[_0x5625('0x46')](_0x5625('0x98'));}else{_0x25f359['where'](_0x5625('0x77'),_[_0x5625('0x24')](_0x58ac15,'id'));_0xc4526d[_0x5625('0x46')](_0x5625('0x77'),_[_0x5625('0x24')](_0x58ac15,'id'));}});})['then'](function(){if(_0x1c831b[_0x5625('0x94')][_0x5625('0x95')]===_0x5625('0x96')&&!_0x150aa6&&!_0x1c831b[_0x5625('0x3b')][_0x5625('0x92')])return[];return db[_0x5625('0x99')][_0x5625('0x3b')](_0x25f359[_0x5625('0x9a')](),_0x5c83da);})[_0x5625('0x1f')](function(_0x405a38){_0x25e921[_0x5625('0x1c')]=_0x405a38['length'];if(_0x25e921['count']===0x0)return[];return db['sequelize']['query'](_0x1afc61[_0x5625('0x9a')](),_0x5c83da)['then'](function(_0x4c30b6){_0x1a1931=_[_0x5625('0x9b')](_0x4c30b6,'id');_0x5c83da=_[_0x5625('0x9c')](_0x5c83da,{'model':db[_0x5625('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c831b[_0x5625('0x3b')]['fields']){_0x462ed3[_0x5625('0x3f')]['forEach'](function(_0x4e821e){_0xc4526d[_0x5625('0x49')]('i.'+_0x4e821e);});}else{_0xc4526d[_0x5625('0x49')](_0x5625('0x8e'),_0x5625('0x5f'));_0xc4526d[_0x5625('0x49')](_0x5625('0x9d'),'Account.key');_0xc4526d[_0x5625('0x49')](_0x5625('0x9e'),_0x5625('0x9f'));_0xc4526d['field']('a.email',_0x5625('0xa0'));_0xc4526d[_0x5625('0x49')](_0x5625('0xa1'),_0x5625('0x8f'));_0xc4526d[_0x5625('0x49')](_0x5625('0x8a'));_0xc4526d[_0x5625('0x49')]('i.createdAt');_0xc4526d['field']('i.updatedAt');_0xc4526d['field'](_0x5625('0xa2'));_0xc4526d[_0x5625('0x49')]('i.closedAt');_0xc4526d[_0x5625('0x49')](_0x5625('0xa3'));_0xc4526d[_0x5625('0x49')](_0x5625('0xa4'));_0xc4526d['field']('i.lastMsgDirection');_0xc4526d[_0x5625('0x49')]('i.subject');_0xc4526d['field'](_0x5625('0xa5'));_0xc4526d[_0x5625('0x49')](_0x5625('0xa6'));_0xc4526d[_0x5625('0x49')]('i.thirdDisposition');_0xc4526d[_0x5625('0x49')]('i.substatus');_0xc4526d[_0x5625('0x49')](_0x5625('0xa7'));_0xc4526d[_0x5625('0x49')](_0x5625('0xa8'));_0xc4526d[_0x5625('0x49')]('i.MailAccountId');_0xc4526d[_0x5625('0x49')]('i.UserId');_0xc4526d[_0x5625('0x49')](_0x5625('0xa9'),_0x5625('0xaa'));_0xc4526d['field'](_0x5625('0xab'),_0x5625('0xac'));_0xc4526d[_0x5625('0x49')]('c.email','Contact.email');_0xc4526d[_0x5625('0x49')](_0x5625('0xad'),'Contact.phone');_0xc4526d[_0x5625('0x49')](_0x5625('0xae'),_0x5625('0xaf'));_0xc4526d[_0x5625('0x49')](_0x5625('0xb0'),_0x5625('0xb1'));_0xc4526d['field']('o.fullname','Owner.fullname');_0xc4526d[_0x5625('0x49')](_0x5625('0xb2'),'Owner.internal');_0xc4526d[_0x5625('0x49')](_0x5625('0xb3'),_0x5625('0x25'));}if(_0x462ed3['limit'])_0xc4526d[_0x5625('0x1b')](_0x462ed3[_0x5625('0x1b')]);if(_0x462ed3['offset'])_0xc4526d[_0x5625('0x19')](_0x462ed3[_0x5625('0x19')]);return db['sequelize'][_0x5625('0x3b')](_0xc4526d['toString'](),_0x5c83da);})[_0x5625('0x1f')](function(_0x235cc9){if(_0x235cc9['length']>0x0)_0x587a2f[_0x5625('0x46')](_0x5625('0xb4'),_[_0x5625('0x24')](_0x235cc9,'id'));return db['sequelize'][_0x5625('0x3b')](_0x587a2f[_0x5625('0x9a')](),_0x5c83da)[_0x5625('0x1f')](function(_0xcc806d){var _0x1b7cb4=_[_0x5625('0xb5')](_0xcc806d,_0x5625('0xb6'));var _0x24d85e=[];return db[_0x5625('0xb7')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0x5625('0x1f')](function(_0xf592c8){var _0x5dc18c=_0xf592c8[_0x5625('0xb8')];_0x235cc9[_0x5625('0x28')](function(_0x405f04){_0x24d85e[_0x5625('0x29')](updateMailInteraction(_0x405f04,_0x1a1931,_0x1b7cb4,_0x5dc18c));});return BPromise['all'](_0x24d85e);});});});})[_0x5625('0x1f')](function(_0x63f8e9){_0x25e921['rows']=_0x63f8e9;return _0x25e921;})['then'](respondWithFilteredResult(_0x2a1f4d,_0x462ed3))['catch'](handleError(_0x2a1f4d,null));};exports['show']=function(_0x3b232a,_0x2a79fc){var _0x1e5811={'raw':![],'where':{'id':_0x3b232a['params']['id']}},_0x1f79cc={};_0x1f79cc[_0x5625('0x3e')]=_[_0x5625('0x73')](db[_0x5625('0x38')][_0x5625('0xb9')]);_0x1f79cc[_0x5625('0x3b')]=_[_0x5625('0x73')](_0x3b232a[_0x5625('0x3b')]);_0x1f79cc[_0x5625('0x3c')]=_[_0x5625('0x3d')](_0x1f79cc[_0x5625('0x3e')],_0x1f79cc[_0x5625('0x3b')]);_0x1e5811[_0x5625('0x3f')]=_['intersection'](_0x1f79cc[_0x5625('0x3e')],qs[_0x5625('0x40')](_0x3b232a[_0x5625('0x3b')][_0x5625('0x40')]));_0x1e5811[_0x5625('0x3f')]=_0x1e5811[_0x5625('0x3f')][_0x5625('0x41')]?_0x1e5811[_0x5625('0x3f')]:_0x1f79cc[_0x5625('0x3e')];if(_0x3b232a[_0x5625('0x3b')][_0x5625('0xba')]){_0x1e5811[_0x5625('0xbb')]=[{'all':!![]}];}_0x1e5811=_[_0x5625('0x9c')]({},_0x1e5811,_0x3b232a[_0x5625('0xbc')]);return db[_0x5625('0x38')][_0x5625('0x5e')](_0x1e5811)[_0x5625('0x1f')](handleEntityNotFound(_0x2a79fc,null))[_0x5625('0x1f')](respondWithResult(_0x2a79fc,null))[_0x5625('0x30')](handleError(_0x2a79fc,null));};exports[_0x5625('0xbd')]=function(_0xdd096c,_0x55a731){return db['MailInteraction'][_0x5625('0xbd')](_0xdd096c['body'],{})['then'](respondWithResult(_0x55a731,0xc9))[_0x5625('0x30')](handleError(_0x55a731,null));};exports[_0x5625('0x1e')]=function(_0x8dd235,_0x5bef90){if(_0x8dd235['body']['id']){delete _0x8dd235[_0x5625('0xbe')]['id'];}return db[_0x5625('0x38')]['find']({'where':{'id':_0x8dd235['params']['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0x5bef90,null))['then'](saveUpdates(_0x8dd235[_0x5625('0xbe')],null))[_0x5625('0x1f')](respondWithResult(_0x5bef90,null))[_0x5625('0x30')](handleError(_0x5bef90,null));};exports[_0x5625('0x20')]=function(_0x53feeb,_0x5ce005){return db[_0x5625('0x38')][_0x5625('0x5e')]({'where':{'id':_0x53feeb[_0x5625('0xbf')]['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0x5ce005,null))[_0x5625('0x1f')](removeEntity(_0x5ce005,null))['catch'](handleError(_0x5ce005,null));};exports['describe']=function(_0x2c1fe5,_0x37f918){return db[_0x5625('0x38')][_0x5625('0xc0')]()[_0x5625('0x1f')](respondWithResult(_0x37f918,null))[_0x5625('0x30')](handleError(_0x37f918,null));};exports[_0x5625('0xc1')]=function(_0x550c4a,_0x1fa98b){return db[_0x5625('0x2a')][_0x5625('0x5e')]({'where':{'id':_0x550c4a['params']['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0x1fa98b,null))[_0x5625('0x1f')](function(_0x545228){if(_0x545228){return _0x545228[_0x5625('0xc1')](_0x550c4a['body'][_0x5625('0xc2')],_[_0x5625('0xc3')](_0x550c4a[_0x5625('0xbe')],[_0x5625('0xc2'),'id'])||{});}})[_0x5625('0x1f')](respondWithResult(_0x1fa98b,null))[_0x5625('0x30')](handleError(_0x1fa98b,null));};exports['getMessages']=function(_0x1b30a0,_0x57bd2c){var _0x3e46dc={'raw':![],'where':{}};var _0x3cba07={};var _0x42cadb={'count':0x0,'rows':[]};return db['MailInteraction'][_0x5625('0x2b')]({'where':{'id':_0x1b30a0[_0x5625('0xbf')]['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0x57bd2c,null))[_0x5625('0x1f')](function(_0x42133e){if(_0x42133e){_0x3cba07[_0x5625('0x3e')]=_['keys'](db[_0x5625('0x2a')][_0x5625('0xb9')]);_0x3cba07['query']=_[_0x5625('0x73')](_0x1b30a0[_0x5625('0x3b')]);_0x3cba07[_0x5625('0x3c')]=_[_0x5625('0x3d')](_0x3cba07['model'],_0x3cba07[_0x5625('0x3b')]);_0x3e46dc[_0x5625('0x3f')]=_[_0x5625('0x3d')](_0x3cba07[_0x5625('0x3e')],qs[_0x5625('0x40')](_0x1b30a0[_0x5625('0x3b')][_0x5625('0x40')]));_0x3e46dc['attributes']=_0x3e46dc[_0x5625('0x3f')][_0x5625('0x41')]?_0x3e46dc[_0x5625('0x3f')]:_0x3cba07[_0x5625('0x3e')];if(!_0x1b30a0['query'][_0x5625('0x42')](_0x5625('0x43'))){_0x3e46dc[_0x5625('0x1b')]=qs[_0x5625('0x1b')](_0x1b30a0[_0x5625('0x3b')][_0x5625('0x1b')]);_0x3e46dc['offset']=qs[_0x5625('0x19')](_0x1b30a0[_0x5625('0x3b')]['offset']);}_0x3e46dc['order']=qs['sort'](_0x1b30a0[_0x5625('0x3b')][_0x5625('0x45')]);_0x3e46dc[_0x5625('0x46')]=qs[_0x5625('0x3c')](_[_0x5625('0x47')](_0x1b30a0[_0x5625('0x3b')],_0x3cba07[_0x5625('0x3c')]));_0x3e46dc[_0x5625('0x46')]['MailInteractionId']=_0x42133e['id'];if(_0x1b30a0[_0x5625('0x3b')][_0x5625('0x82')]){_0x3e46dc['where']=_[_0x5625('0x9c')](_0x3e46dc[_0x5625('0x46')],{'$or':_[_0x5625('0x24')](_0x3e46dc[_0x5625('0x3f')],function(_0x5aa5a6){var _0x2b2143={};_0x2b2143[_0x5aa5a6]={'$like':'%'+_0x1b30a0[_0x5625('0x3b')][_0x5625('0x82')]+'%'};return _0x2b2143;})});}if(_0x1b30a0[_0x5625('0x3b')][_0x5625('0xc4')]){var _0x10f3f2=_0x1b30a0[_0x5625('0x3b')][_0x5625('0xc4')][_0x5625('0x27')](',');var _0x3845ec={};_0x3845ec[_0x10f3f2[0x0]]={'$gte':moment(_0x10f3f2[0x1])[_0x5625('0xc5')](_0x5625('0xc6'))};_0x3e46dc[_0x5625('0x46')]=_[_0x5625('0x9c')](_0x3e46dc[_0x5625('0x46')],_0x3845ec);}_0x3e46dc=_[_0x5625('0x9c')]({},_0x3e46dc,_0x1b30a0['options']);return db[_0x5625('0x2a')][_0x5625('0x1c')]({'where':_0x3e46dc['where']})[_0x5625('0x1f')](function(_0x5e28a3){_0x42cadb[_0x5625('0x1c')]=_0x5e28a3;if(_0x1b30a0['query'][_0x5625('0xba')]){_0x3e46dc[_0x5625('0xbb')]=[{'all':!![]}];}return db[_0x5625('0x2a')][_0x5625('0xc7')](_0x3e46dc);})['then'](function(_0x5e1722){if(_0x1b30a0['query'][_0x5625('0xc8')]===_0x5625('0xc9')){for(var _0x272dda=0x0;_0x272dda<_0x5e1722['length'];_0x272dda++){_0x5e1722[_0x272dda][_0x5625('0xbe')]=juice(_0x5e1722[_0x272dda]['body']);}}_0x42cadb['rows']=_0x5e1722;return _0x42cadb;});}})[_0x5625('0x1f')](respondWithFilteredResult(_0x57bd2c,_0x3e46dc))['catch'](handleError(_0x57bd2c,null));};exports[_0x5625('0xca')]=function(_0x3873b9,_0xeaccf7){return db['MailInteraction'][_0x5625('0x5e')]({'where':{'id':_0x3873b9[_0x5625('0xbf')]['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0xeaccf7,null))[_0x5625('0x1f')](function(_0x2fbab0){if(_0x2fbab0){return _0x2fbab0[_0x5625('0xcb')](_0x3873b9[_0x5625('0xbe')][_0x5625('0xc2')],_[_0x5625('0xc3')](_0x3873b9[_0x5625('0xbe')],[_0x5625('0xc2'),'id'])||{})[_0x5625('0xcc')](function(){return db[_0x5625('0x6d')][_0x5625('0xc7')]({'attributes':['id',_0x5625('0x22'),_0x5625('0x4a')],'where':{'id':_0x3873b9[_0x5625('0xbe')][_0x5625('0xc2')]}});})[_0x5625('0x1f')](function(_0x2750e1){socket[_0x5625('0xcd')](_0x5625('0xce'),{'id':Number(_0x3873b9[_0x5625('0xbf')]['id']),'tags':_0x2750e1||[]});return{'id':Number(_0x3873b9[_0x5625('0xbf')]['id']),'tags':_0x2750e1||[]};});}})[_0x5625('0x1f')](respondWithResult(_0xeaccf7,null))[_0x5625('0x30')](handleError(_0xeaccf7,null));};exports[_0x5625('0xcf')]=function(_0x155282,_0x36de29){return db[_0x5625('0x38')][_0x5625('0x5e')]({'where':{'id':_0x155282[_0x5625('0xbf')]['id']}})[_0x5625('0x1f')](handleEntityNotFound(_0x36de29,null))[_0x5625('0x1f')](function(_0x3d41ae){if(_0x3d41ae){return _0x3d41ae[_0x5625('0xcf')](_0x155282[_0x5625('0x3b')][_0x5625('0xc2')]);}})[_0x5625('0x1f')](respondWithStatusCode(_0x36de29,null))[_0x5625('0x30')](handleError(_0x36de29,null));};exports[_0x5625('0xd0')]=function(_0x1e4001,_0x1cddf1){var _0x384e0f=moment()['unix']()[_0x5625('0x9a')]();var _0x3dcb57=path[_0x5625('0xd1')](config['root'],_0x5625('0xd2'),_0x5625('0xd3'),_0x5625('0xd4'));var _0x26585c=path[_0x5625('0xd1')](config[_0x5625('0xd5')],_0x5625('0xd2'),_0x5625('0xd3'),_0x5625('0xd6'));var _0x187dd4=path[_0x5625('0xd1')](_0x3dcb57,_0x384e0f);var _0x4b85d4=util[_0x5625('0xc5')](_0x5625('0xd7'),_0x1e4001[_0x5625('0xbf')]['id'],_0x384e0f);var _0x5c1e59=path['join'](_0x3dcb57,_0x4b85d4);var _0x2f900e=[];if(_0x1e4001[_0x5625('0x3b')][_0x5625('0xd6')]){_0x2f900e[_0x5625('0x29')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x55dbc=[{'model':db[_0x5625('0x2a')],'as':_0x5625('0xd8'),'attributes':['id',_0x5625('0xbe'),'from','to','cc',_0x5625('0xd9'),'subject',_0x5625('0x79')],'where':{'secret':![]},'order':qs[_0x5625('0x45')]('id'),'include':_0x2f900e}];return db[_0x5625('0x38')][_0x5625('0x5e')]({'where':{'id':_0x1e4001[_0x5625('0xbf')]['id']},'include':_0x55dbc})[_0x5625('0x1f')](handleEntityNotFound(_0x1cddf1,null))[_0x5625('0x1f')](function(_0x3da7fd){if(_0x3da7fd&&_0x3da7fd['Messages']){var _0x4ce9c8=_0x3da7fd['get']({'plain':!![]});fs[_0x5625('0xda')](_0x187dd4);return BPromise[_0x5625('0xdb')](_0x4ce9c8['Messages'],function(_0x4fb08c,_0x536d98){var _0x1862d0={'from':_0x4fb08c[_0x5625('0x4d')],'to':_0x4fb08c['to'],'subject':_0x4fb08c['subject'],'html':htmlEntities[_0x5625('0xdc')](_0x4fb08c['body']),'headers':{'Date':moment(_0x4fb08c[_0x5625('0x79')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4fb08c['cc']){_0x1862d0[_0x5625('0xdd')]['Cc']=_0x4fb08c['cc'];}if(_0x4fb08c[_0x5625('0xd9')]){_0x1862d0['headers']['Bcc']=_0x4fb08c['bcc'];}return new BPromise(function(_0x10248b,_0x4568c3){if(_0x4fb08c[_0x5625('0xde')]){for(var _0x20daa5=0x0;_0x20daa5<_0x4fb08c[_0x5625('0xde')][_0x5625('0x41')];_0x20daa5++){var _0x4b0771=_0x4fb08c[_0x5625('0xde')][_0x20daa5];var _0x3a08bd=path[_0x5625('0xd1')](_0x26585c,_0x4b0771[_0x5625('0xdf')]);if(fs['existsSync'](_0x3a08bd)){_0x1862d0[_0x5625('0xd6')][_0x5625('0x29')]({'name':_0x4b0771['name'],'contentType':_0x4b0771[_0x5625('0x72')],'data':fs[_0x5625('0xe0')](_0x3a08bd)});}}}emlformat['build'](_0x1862d0,function(_0x232190,_0x374b69){if(_0x232190)return _0x4568c3(_0x232190);fs[_0x5625('0xe1')](path[_0x5625('0xd1')](_0x187dd4,util['format'](_0x5625('0xe2'),_0x536d98)),_0x374b69);return _0x10248b(_0x374b69);});});})['then'](function(){return new BPromise(function(_0x3e143f,_0x30e8e0){zipdir(_0x187dd4,{'saveTo':_0x5c1e59},function(_0x2fb558,_0x590728){if(_0x2fb558)return _0x30e8e0(_0x2fb558);return _0x3e143f(_0x590728);});})[_0x5625('0x1f')](function(){return new BPromise(function(_0x1f7ec5,_0x4f5e45){rimraf(_0x187dd4,function(_0x45dd8e){if(_0x45dd8e)_0x4f5e45(_0x45dd8e);return _0x1f7ec5();});});})[_0x5625('0x1f')](function(){return _0x1cddf1[_0x5625('0xd0')](_0x5c1e59,_0x4b85d4,function(_0x5868ae){if(!_0x5868ae)fs[_0x5625('0xe3')](_0x5c1e59);});});});}else{return _0x1cddf1['sendStatus'](0xc8);}})['catch'](handleError(_0x1cddf1,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ac727cf..50e0b2a 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 _0x3b16=['exports','events','../../mysqldb','MailInteraction','MailMessage','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0x3b16,0x1c1));var _0x63b1=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3b16[_0x42245d];return _0x4b211a;};'use strict';var EventEmitter=require(_0x63b1('0x0'));var MailInteraction=require(_0x63b1('0x1'))['db'][_0x63b1('0x2')];var MailMessage=require(_0x63b1('0x1'))['db'][_0x63b1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x63b1('0x4')};function emitEvent(_0x4ea9d8){return function(_0x1ce8cc,_0x309824,_0x4a445a){_0x1ce8cc[_0x63b1('0x5')]({'attributes':['id'],'raw':!![]})[_0x63b1('0x6')](function(_0x2004c9){_0x1ce8cc['setDataValue'](_0x63b1('0x7'),_0x2004c9[_0x63b1('0x8')](function(_0x483530){return{'id':_0x483530['id']};}));return MailMessage[_0x63b1('0x9')]({'where':{'MailInteractionId':_0x1ce8cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x63b1('0x6')](function(_0x530a97){_0x1ce8cc[_0x63b1('0xa')](_0x63b1('0xb'),_0x530a97[_0x63b1('0xc')]);MailInteractionEvents['emit'](_0x4ea9d8+':'+_0x1ce8cc['id'],_0x1ce8cc);MailInteractionEvents[_0x63b1('0xd')](_0x4ea9d8,_0x1ce8cc);_0x4a445a(null);})[_0x63b1('0xe')](_0x4a445a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x63b1('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x464c=['setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb'];(function(_0x5486cf,_0x3ad667){var _0x3b0cdb=function(_0x55ac25){while(--_0x55ac25){_0x5486cf['push'](_0x5486cf['shift']());}};_0x3b0cdb(++_0x3ad667);}(_0x464c,0x141));var _0xc464=function(_0x123092,_0x4655bc){_0x123092=_0x123092-0x0;var _0x2816cc=_0x464c[_0x123092];return _0x2816cc;};'use strict';var EventEmitter=require(_0xc464('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xc464('0x1')];var MailMessage=require(_0xc464('0x2'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xc464('0x3')](0x0);var events={'afterCreate':_0xc464('0x4'),'afterUpdate':_0xc464('0x5'),'afterDestroy':'remove'};function emitEvent(_0x511264){return function(_0x3671e1,_0x47ff45,_0xf731d5){_0x3671e1[_0xc464('0x6')]({'attributes':['id'],'raw':!![]})[_0xc464('0x7')](function(_0x5086be){_0x3671e1[_0xc464('0x8')]('Users',_0x5086be[_0xc464('0x9')](function(_0x5c4c84){return{'id':_0x5c4c84['id']};}));return MailMessage[_0xc464('0xa')]({'where':{'MailInteractionId':_0x3671e1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc464('0x7')](function(_0x245866){_0x3671e1[_0xc464('0x8')](_0xc464('0xb'),_0x245866[_0xc464('0xc')]);MailInteractionEvents[_0xc464('0xd')](_0x511264+':'+_0x3671e1['id'],_0x3671e1);MailInteractionEvents['emit'](_0x511264,_0x3671e1);_0xf731d5(null);})[_0xc464('0xe')](_0xf731d5(null));};}for(var e in events){if(events[_0xc464('0xf')](e)){var event=events[e];MailInteraction[_0xc464('0x10')](e,emitEvent(event));}}module[_0xc464('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0be1ddd..f65e9be 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 _0x6766=['FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models','MailMessage','update','then','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x6766,0x136));var _0x6676=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x6766[_0x2ecb67];return _0x168079;};'use strict';var _=require(_0x6676('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6676('0x1'));var moment=require(_0x6676('0x2'));var BPromise=require(_0x6676('0x3'));var rp=require(_0x6676('0x4'));var fs=require('fs');var path=require(_0x6676('0x5'));var rimraf=require(_0x6676('0x6'));var config=require(_0x6676('0x7'));var attributes=require(_0x6676('0x8'));module[_0x6676('0x9')]=function(_0x31a946,_0x3e90bd){return _0x31a946['define'](_0x6676('0xa'),attributes,{'tableName':_0x6676('0xb'),'paranoid':![],'indexes':[{'name':_0x6676('0xc'),'fields':[_0x6676('0xd'),'to'],'type':_0x6676('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3b2067,_0x213c1b,_0xb63169){if(_0x3b2067[_0x6676('0xf')]){_0x3b2067[_0x6676('0x10')]=moment()[_0x6676('0x11')](_0x6676('0x12'));}if(_0x3b2067['closed']){_0x3b2067['closedAt']=moment()['format'](_0x6676('0x12'));}_0xb63169(null,_0x213c1b);},'beforeUpdate':function(_0xddc709,_0x105d2a,_0x19417d){if(_0xddc709[_0x6676('0x13')](_0x6676('0xf'))){_0xddc709[_0x6676('0x10')]=_0xddc709['substatus']?moment()[_0x6676('0x11')](_0x6676('0x12')):null;}if(_0xddc709[_0x6676('0x13')](_0x6676('0x14'))){_0xddc709[_0x6676('0x15')]=moment()[_0x6676('0x11')](_0x6676('0x12'));_0xddc709[_0x6676('0xf')]=null;_0xddc709[_0x6676('0x10')]=null;}_0x19417d(null,_0xddc709);},'afterUpdate':function(_0x2bab26,_0xa75b04,_0x13e3e6){var _0x1fc350=_0x31a946[_0x6676('0x16')];var _0x44a343=_0x2bab26['get']({'plain':!![]});if(_0x44a343['closed']){return _0x1fc350[_0x6676('0x17')][_0x6676('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x44a343['id']}})[_0x6676('0x19')](function(){_0x13e3e6();})['catch'](function(_0x2cbb22){_0x13e3e6(_0x2cbb22);});}else{_0x13e3e6();}}},'charset':'utf8mb4','collate':_0x6676('0x1a')});}; \ No newline at end of file +var _0x0646=['MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0646,0x122));var _0x6064=function(_0x55347d,_0x5859ec){_0x55347d=_0x55347d-0x0;var _0xaf34fe=_0x0646[_0x55347d];return _0xaf34fe;};'use strict';var _=require(_0x6064('0x0'));var util=require(_0x6064('0x1'));var logger=require(_0x6064('0x2'))(_0x6064('0x3'));var moment=require(_0x6064('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6064('0x5'));var rimraf=require(_0x6064('0x6'));var config=require(_0x6064('0x7'));var attributes=require(_0x6064('0x8'));module[_0x6064('0x9')]=function(_0x438ffe,_0x2bc54b){return _0x438ffe[_0x6064('0xa')](_0x6064('0xb'),attributes,{'tableName':_0x6064('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x6064('0xd'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xade071,_0x4f17e5,_0xc9053){if(_0xade071['substatus']){_0xade071[_0x6064('0xe')]=moment()[_0x6064('0xf')](_0x6064('0x10'));}if(_0xade071[_0x6064('0x11')]){_0xade071[_0x6064('0x12')]=moment()[_0x6064('0xf')](_0x6064('0x10'));}_0xc9053(null,_0x4f17e5);},'beforeUpdate':function(_0x18f3a5,_0xd6f1a2,_0x2ab49e){if(_0x18f3a5[_0x6064('0x13')](_0x6064('0x14'))){_0x18f3a5[_0x6064('0xe')]=_0x18f3a5[_0x6064('0x14')]?moment()['format'](_0x6064('0x10')):null;}if(_0x18f3a5['changed'](_0x6064('0x11'))){_0x18f3a5[_0x6064('0x12')]=moment()['format'](_0x6064('0x10'));_0x18f3a5[_0x6064('0x14')]=null;_0x18f3a5[_0x6064('0xe')]=null;}_0x2ab49e(null,_0x18f3a5);},'afterUpdate':function(_0x180781,_0x4b8845,_0xf65023){var _0x1e61f3=_0x438ffe[_0x6064('0x15')];var _0x5f298b=_0x180781['get']({'plain':!![]});if(_0x5f298b['closed']){return _0x1e61f3[_0x6064('0x16')][_0x6064('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5f298b['id']}})['then'](function(){_0xf65023();})['catch'](function(_0x4ae0d3){_0xf65023(_0x4ae0d3);});}else{_0xf65023();}}},'charset':_0x6064('0x18'),'collate':_0x6064('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5409072..e82630f 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 _0x11d1=['localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','stringify','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2054d8,_0x2cd085){var _0xcb875d=function(_0x539978){while(--_0x539978){_0x2054d8['push'](_0x2054d8['shift']());}};_0xcb875d(++_0x2cd085);}(_0x11d1,0x184));var _0x111d=function(_0x5137a9,_0x1d28f4){_0x5137a9=_0x5137a9-0x0;var _0x5e372a=_0x11d1[_0x5137a9];return _0x5e372a;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var moment=require(_0x111d('0x1'));var BPromise=require(_0x111d('0x2'));var rs=require(_0x111d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x111d('0x4'))['db'];var utils=require(_0x111d('0x5'));var logger=require(_0x111d('0x6'))('rpc');var config=require(_0x111d('0x7'));var jayson=require(_0x111d('0x8'));var client=jayson[_0x111d('0x9')][_0x111d('0xa')]({'port':0x232a});config[_0x111d('0xb')]=_['defaults'](config['redis'],{'host':_0x111d('0xc'),'port':0x18eb});var socket=require(_0x111d('0xd'))(new Redis(config['redis']));require(_0x111d('0xe'))[_0x111d('0xf')](socket);function respondWithRpcPromise(_0x5737a1,_0x438f41,_0x1b58f0){return new BPromise(function(_0x3b8cfe,_0x156a5c){return client[_0x111d('0x10')](_0x5737a1,_0x1b58f0)[_0x111d('0x11')](function(_0x45ba31){logger[_0x111d('0x12')]('MailInteraction,\x20%s,\x20%s',_0x438f41,_0x111d('0x13'));logger[_0x111d('0x14')](_0x111d('0x15'),_0x438f41,'request\x20sent',JSON['stringify'](_0x45ba31));if(_0x45ba31[_0x111d('0x16')]){if(_0x45ba31[_0x111d('0x16')]['code']===0x1f4){logger['error'](_0x111d('0x17'),_0x438f41,_0x45ba31[_0x111d('0x16')]['message']);return _0x156a5c(_0x45ba31['error'][_0x111d('0x18')]);}logger['error'](_0x111d('0x17'),_0x438f41,_0x45ba31['error'][_0x111d('0x18')]);return _0x3b8cfe(_0x45ba31[_0x111d('0x16')][_0x111d('0x18')]);}else{logger['info'](_0x111d('0x17'),_0x438f41,_0x111d('0x13'));_0x3b8cfe(_0x45ba31['result'][_0x111d('0x18')]);}})[_0x111d('0x19')](function(_0x4e7d40){logger[_0x111d('0x16')](_0x111d('0x17'),_0x438f41,_0x4e7d40);_0x156a5c(_0x4e7d40);});});}exports[_0x111d('0x1a')]=function(_0xe9f9b4){var _0x2596a4=this;return new Promise(function(_0x533dde,_0x44711b){return db[_0x111d('0x1b')][_0x111d('0x1c')](_0xe9f9b4['body'],{'raw':_0xe9f9b4['options']?_0xe9f9b4[_0x111d('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9f9b4[_0x111d('0x1d')]?_0xe9f9b4['options']['where']||null:null,'attributes':_0xe9f9b4[_0x111d('0x1d')]?_0xe9f9b4[_0x111d('0x1d')][_0x111d('0x1e')]||null:null,'limit':_0xe9f9b4[_0x111d('0x1d')]?_0xe9f9b4['options']['limit']||null:null})[_0x111d('0x11')](function(_0xfe273){logger[_0x111d('0x12')](_0x111d('0x1a'),_0xe9f9b4);logger[_0x111d('0x14')]('UpdateMailInteraction',_0xe9f9b4,JSON[_0x111d('0x1f')](_0xfe273));_0x533dde(_0xfe273);})[_0x111d('0x19')](function(_0x3deef5){logger[_0x111d('0x16')](_0x111d('0x1a'),_0x3deef5[_0x111d('0x18')],_0xe9f9b4);_0x44711b(_0x2596a4[_0x111d('0x16')](0x1f4,_0x3deef5['message']));});});};exports[_0x111d('0x20')]=function(_0x483db1){return new Promise(function(_0x3dc121,_0x2138a7){return db[_0x111d('0x1b')][_0x111d('0x21')]({'where':_0x483db1['options']?_0x483db1[_0x111d('0x1d')][_0x111d('0x22')]||null:null})[_0x111d('0x11')](function(_0x3348a2){if(_0x3348a2){return _0x3348a2[_0x111d('0x23')](_0x483db1['body'][_0x111d('0x24')],_[_0x111d('0x25')](_0x483db1['body'],[_0x111d('0x24'),'id'])||{});}})[_0x111d('0x26')](function(_0x5336b8){logger['info'](_0x111d('0x27'),_0x483db1);logger[_0x111d('0x14')]('AddTags',_0x483db1,JSON[_0x111d('0x1f')](_0x5336b8));_0x3dc121(_0x5336b8);})['catch'](function(_0x389cd8){logger['error'](_0x111d('0x27'),_0x389cd8['message'],_0x483db1);_0x2138a7(_this[_0x111d('0x16')](0x1f4,_0x389cd8[_0x111d('0x18')]));});});}; \ No newline at end of file +var _0xb9f4=['ids','omit','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','addTags'];(function(_0x385bc7,_0x16f775){var _0x4063a4=function(_0x56b2a6){while(--_0x56b2a6){_0x385bc7['push'](_0x385bc7['shift']());}};_0x4063a4(++_0x16f775);}(_0xb9f4,0xf4));var _0x4b9f=function(_0x4f4798,_0x35fb11){_0x4f4798=_0x4f4798-0x0;var _0x444db8=_0xb9f4[_0x4f4798];return _0x444db8;};'use strict';var _=require('lodash');var util=require(_0x4b9f('0x0'));var moment=require('moment');var BPromise=require(_0x4b9f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b9f('0x2'))['db'];var utils=require(_0x4b9f('0x3'));var logger=require(_0x4b9f('0x4'))(_0x4b9f('0x5'));var config=require('../../config/environment');var jayson=require(_0x4b9f('0x6'));var client=jayson[_0x4b9f('0x7')][_0x4b9f('0x8')]({'port':0x232a});config[_0x4b9f('0x9')]=_[_0x4b9f('0xa')](config[_0x4b9f('0x9')],{'host':_0x4b9f('0xb'),'port':0x18eb});var socket=require(_0x4b9f('0xc'))(new Redis(config[_0x4b9f('0x9')]));require('./mailInteraction.socket')[_0x4b9f('0xd')](socket);function respondWithRpcPromise(_0x1530e5,_0x32b87d,_0x244a03){return new BPromise(function(_0x2053ac,_0x1a1856){return client['request'](_0x1530e5,_0x244a03)[_0x4b9f('0xe')](function(_0x29b4d2){logger[_0x4b9f('0xf')](_0x4b9f('0x10'),_0x32b87d,_0x4b9f('0x11'));logger[_0x4b9f('0x12')](_0x4b9f('0x13'),_0x32b87d,_0x4b9f('0x11'),JSON[_0x4b9f('0x14')](_0x29b4d2));if(_0x29b4d2[_0x4b9f('0x15')]){if(_0x29b4d2[_0x4b9f('0x15')][_0x4b9f('0x16')]===0x1f4){logger['error'](_0x4b9f('0x10'),_0x32b87d,_0x29b4d2['error'][_0x4b9f('0x17')]);return _0x1a1856(_0x29b4d2[_0x4b9f('0x15')][_0x4b9f('0x17')]);}logger[_0x4b9f('0x15')](_0x4b9f('0x10'),_0x32b87d,_0x29b4d2[_0x4b9f('0x15')]['message']);return _0x2053ac(_0x29b4d2['error'][_0x4b9f('0x17')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x32b87d,_0x4b9f('0x11'));_0x2053ac(_0x29b4d2['result'][_0x4b9f('0x17')]);}})[_0x4b9f('0x18')](function(_0x20ea42){logger[_0x4b9f('0x15')](_0x4b9f('0x10'),_0x32b87d,_0x20ea42);_0x1a1856(_0x20ea42);});});}exports[_0x4b9f('0x19')]=function(_0x53f8f3){var _0x798eb6=this;return new Promise(function(_0x1edc24,_0x406db4){return db['MailInteraction'][_0x4b9f('0x1a')](_0x53f8f3[_0x4b9f('0x1b')],{'raw':_0x53f8f3[_0x4b9f('0x1c')]?_0x53f8f3[_0x4b9f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53f8f3[_0x4b9f('0x1c')]?_0x53f8f3[_0x4b9f('0x1c')][_0x4b9f('0x1d')]||null:null,'attributes':_0x53f8f3[_0x4b9f('0x1c')]?_0x53f8f3[_0x4b9f('0x1c')][_0x4b9f('0x1e')]||null:null,'limit':_0x53f8f3[_0x4b9f('0x1c')]?_0x53f8f3[_0x4b9f('0x1c')][_0x4b9f('0x1f')]||null:null})[_0x4b9f('0xe')](function(_0x37dfdc){logger[_0x4b9f('0xf')](_0x4b9f('0x19'),_0x53f8f3);logger[_0x4b9f('0x12')](_0x4b9f('0x19'),_0x53f8f3,JSON[_0x4b9f('0x14')](_0x37dfdc));_0x1edc24(_0x37dfdc);})[_0x4b9f('0x18')](function(_0x18cd1c){logger[_0x4b9f('0x15')](_0x4b9f('0x19'),_0x18cd1c[_0x4b9f('0x17')],_0x53f8f3);_0x406db4(_0x798eb6[_0x4b9f('0x15')](0x1f4,_0x18cd1c[_0x4b9f('0x17')]));});});};exports[_0x4b9f('0x20')]=function(_0x313fa2){return new Promise(function(_0x21a519,_0x2dd55d){return db[_0x4b9f('0x21')][_0x4b9f('0x22')]({'where':_0x313fa2[_0x4b9f('0x1c')]?_0x313fa2[_0x4b9f('0x1c')][_0x4b9f('0x1d')]||null:null})[_0x4b9f('0xe')](function(_0x3dc7e6){if(_0x3dc7e6){return _0x3dc7e6[_0x4b9f('0x23')](_0x313fa2[_0x4b9f('0x1b')][_0x4b9f('0x24')],_[_0x4b9f('0x25')](_0x313fa2[_0x4b9f('0x1b')],[_0x4b9f('0x24'),'id'])||{});}})[_0x4b9f('0x26')](function(_0x10cacc){logger[_0x4b9f('0xf')](_0x4b9f('0x27'),_0x313fa2);logger[_0x4b9f('0x12')](_0x4b9f('0x27'),_0x313fa2,JSON[_0x4b9f('0x14')](_0x10cacc));_0x21a519(_0x10cacc);})[_0x4b9f('0x18')](function(_0x5e27f7){logger[_0x4b9f('0x15')]('AddTags',_0x5e27f7[_0x4b9f('0x17')],_0x313fa2);_0x2dd55d(_this[_0x4b9f('0x15')](0x1f4,_0x5e27f7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 37637bc..f2a161a 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 _0x20ea=['update','emit','register','length','./mailInteraction.events','remove'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x20ea,0xc4));var _0xa20e=function(_0x14dff8,_0x56fedd){_0x14dff8=_0x14dff8-0x0;var _0x5a40e1=_0x20ea[_0x14dff8];return _0x5a40e1;};'use strict';var MailInteractionEvents=require(_0xa20e('0x0'));var events=['save',_0xa20e('0x1'),_0xa20e('0x2')];function createListener(_0x2e6d1b,_0x3495ac){return function(_0x7b34eb){_0x3495ac[_0xa20e('0x3')](_0x2e6d1b,_0x7b34eb);};}function removeListener(_0x53b7f2,_0x4de033){return function(){MailInteractionEvents['removeListener'](_0x53b7f2,_0x4de033);};}exports[_0xa20e('0x4')]=function(_0x3a7aff){for(var _0x416aca=0x0,_0x800983=events[_0xa20e('0x5')];_0x416aca<_0x800983;_0x416aca++){var _0x4580b3=events[_0x416aca];var _0x560be4=createListener('mailInteraction:'+_0x4580b3,_0x3a7aff);MailInteractionEvents['on'](_0x4580b3,_0x560be4);}}; \ No newline at end of file +var _0xf445=['length','mailInteraction:','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x201f99,_0x5ec34f){var _0x3bc2c1=function(_0x20e4be){while(--_0x20e4be){_0x201f99['push'](_0x201f99['shift']());}};_0x3bc2c1(++_0x5ec34f);}(_0xf445,0x105));var _0x5f44=function(_0x163e4e,_0x44cc89){_0x163e4e=_0x163e4e-0x0;var _0x4d825c=_0xf445[_0x163e4e];return _0x4d825c;};'use strict';var MailInteractionEvents=require(_0x5f44('0x0'));var events=[_0x5f44('0x1'),_0x5f44('0x2'),_0x5f44('0x3')];function createListener(_0x2d29c1,_0x19ef79){return function(_0x4903d7){_0x19ef79['emit'](_0x2d29c1,_0x4903d7);};}function removeListener(_0x256ec3,_0x52b7e1){return function(){MailInteractionEvents[_0x5f44('0x4')](_0x256ec3,_0x52b7e1);};}exports['register']=function(_0x27e2f8){for(var _0xa0ae80=0x0,_0x1304c3=events[_0x5f44('0x5')];_0xa0ae80<_0x1304c3;_0xa0ae80++){var _0x23a8e2=events[_0xa0ae80];var _0x2eabe2=createListener(_0x5f44('0x6')+_0x23a8e2,_0x27e2f8);MailInteractionEvents['on'](_0x23a8e2,_0x2eabe2);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7e8bb3e..9515f4b 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 _0xd9dc=['/:id/download','download','post','mail','create','/:id','update','/:id/accept','accept','put','/:id/reject','reject','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','show'];(function(_0xd98ad3,_0xd1e3da){var _0x195dde=function(_0x16e36b){while(--_0x16e36b){_0xd98ad3['push'](_0xd98ad3['shift']());}};_0x195dde(++_0xd1e3da);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x184e92,_0x25c2c5){_0x184e92=_0x184e92-0x0;var _0x26151a=_0xd9dc[_0x184e92];return _0x26151a;};'use strict';var multer=require('multer');var util=require(_0xcd9d('0x0'));var path=require(_0xcd9d('0x1'));var timeout=require('connect-timeout');var express=require(_0xcd9d('0x2'));var router=express[_0xcd9d('0x3')]();var fs_extra=require(_0xcd9d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcd9d('0x5'));var config=require(_0xcd9d('0x6'));var controller=require(_0xcd9d('0x7'));router[_0xcd9d('0x8')]('/',auth[_0xcd9d('0x9')](),controller['index']);router[_0xcd9d('0x8')](_0xcd9d('0xa'),auth[_0xcd9d('0x9')](),controller[_0xcd9d('0xb')]);router[_0xcd9d('0x8')]('/:id',auth[_0xcd9d('0x9')](),controller[_0xcd9d('0xc')]);router[_0xcd9d('0x8')](_0xcd9d('0xd'),auth[_0xcd9d('0x9')](),controller[_0xcd9d('0xe')]);router[_0xcd9d('0xf')]('/',auth[_0xcd9d('0x9')](),interaction['tracked'](_0xcd9d('0x10'),'mailmessage:create'),controller[_0xcd9d('0x11')]);router['put'](_0xcd9d('0x12'),auth[_0xcd9d('0x9')](),controller[_0xcd9d('0x13')]);router['put'](_0xcd9d('0x14'),auth['isAuthenticated'](),controller[_0xcd9d('0x15')]);router[_0xcd9d('0x16')](_0xcd9d('0x17'),auth['isAuthenticated'](),controller[_0xcd9d('0x18')]);router[_0xcd9d('0x19')]('/:id',auth[_0xcd9d('0x9')](),controller['destroy']);module[_0xcd9d('0x1a')]=router; \ No newline at end of file +var _0x7d80=['reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','/:id','/:id/download','download','post','tracked','mailmessage:create','create','put','update','accept','/:id/reject'];(function(_0x1ae18b,_0x4c9ad6){var _0x59be4b=function(_0x29fa67){while(--_0x29fa67){_0x1ae18b['push'](_0x1ae18b['shift']());}};_0x59be4b(++_0x4c9ad6);}(_0x7d80,0x17a));var _0x07d8=function(_0x507434,_0x48277e){_0x507434=_0x507434-0x0;var _0x26449b=_0x7d80[_0x507434];return _0x26449b;};'use strict';var multer=require('multer');var util=require(_0x07d8('0x0'));var path=require(_0x07d8('0x1'));var timeout=require(_0x07d8('0x2'));var express=require(_0x07d8('0x3'));var router=express[_0x07d8('0x4')]();var fs_extra=require(_0x07d8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x07d8('0x6'));var config=require('../../config/environment');var controller=require(_0x07d8('0x7'));router[_0x07d8('0x8')]('/',auth[_0x07d8('0x9')](),controller['index']);router['get'](_0x07d8('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x07d8('0xb'),auth[_0x07d8('0x9')](),controller['show']);router[_0x07d8('0x8')](_0x07d8('0xc'),auth[_0x07d8('0x9')](),controller[_0x07d8('0xd')]);router[_0x07d8('0xe')]('/',auth[_0x07d8('0x9')](),interaction[_0x07d8('0xf')]('mail',_0x07d8('0x10')),controller[_0x07d8('0x11')]);router[_0x07d8('0x12')](_0x07d8('0xb'),auth[_0x07d8('0x9')](),controller[_0x07d8('0x13')]);router[_0x07d8('0x12')]('/:id/accept',auth[_0x07d8('0x9')](),controller[_0x07d8('0x14')]);router[_0x07d8('0x12')](_0x07d8('0x15'),auth[_0x07d8('0x9')](),controller[_0x07d8('0x16')]);router['delete'](_0x07d8('0xb'),auth[_0x07d8('0x9')](),controller[_0x07d8('0x17')]);module[_0x07d8('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1d96065..e05eb28 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 _0xd689=['DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash','exports','long','TEXT','medium','ENUM','out','STRING'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0xd689,0x11d));var _0x9d68=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xd689[_0x432fca];return _0x3adba4;};'use strict';var Sequelize=require(_0x9d68('0x0'));var _=require(_0x9d68('0x1'));module[_0x9d68('0x2')]={'body':{'type':Sequelize['TEXT'](_0x9d68('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9d68('0x6')]('in',_0x9d68('0x7')),'defaultValue':_0x9d68('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x9d68('0x8')]},'to':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x3'))},'cc':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x3'))},'bcc':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x3'))},'subject':{'type':Sequelize[_0x9d68('0x4')]},'sentAt':{'type':Sequelize[_0x9d68('0x9')]},'attach':{'type':Sequelize[_0x9d68('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9d68('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9d68('0x9')]},'originTo':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x3'))},'originCc':{'type':Sequelize[_0x9d68('0x4')](_0x9d68('0x3'))},'originChannel':{'type':Sequelize[_0x9d68('0x6')](_0x9d68('0xc'),_0x9d68('0xd')),'defaultValue':_0x9d68('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xcad5=['medium','BOOLEAN','STRING','DATE','INTEGER','ENUM','Email','sequelize','lodash','exports','long','TEXT'];(function(_0x5dcfc2,_0x3d5b37){var _0x34f415=function(_0x5e11a0){while(--_0x5e11a0){_0x5dcfc2['push'](_0x5dcfc2['shift']());}};_0x34f415(++_0x3d5b37);}(_0xcad5,0x1cf));var _0x5cad=function(_0x196a9b,_0x4af3ce){_0x196a9b=_0x196a9b-0x0;var _0x39f86b=_0xcad5[_0x196a9b];return _0x39f86b;};'use strict';var Sequelize=require(_0x5cad('0x0'));var _=require(_0x5cad('0x1'));module[_0x5cad('0x2')]={'body':{'type':Sequelize['TEXT'](_0x5cad('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5cad('0x4')](_0x5cad('0x5'))},'read':{'type':Sequelize[_0x5cad('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x5cad('0x7')]},'to':{'type':Sequelize['TEXT'](_0x5cad('0x3'))},'cc':{'type':Sequelize[_0x5cad('0x4')](_0x5cad('0x3'))},'bcc':{'type':Sequelize[_0x5cad('0x4')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x5cad('0x8')]},'attach':{'type':Sequelize[_0x5cad('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5cad('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5cad('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x5cad('0xa')](_0x5cad('0xb'),'Chat'),'defaultValue':_0x5cad('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 91d78a4..b78cad9 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 _0xec76=['undefined','count','limit','set','update','destroy','sendStatus','stack','name','send','index','MailMessage','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','body','describe','create','direction','out','secret','split','findOne','MailAccountId','CmList','List','Contacts','DESC','MailServerOut','attachments','join','root','server/files/attachments','basename','CmContact','defaults','ListId','SendMail','sendMail','messageId','format','accept','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','acceptmessage','reject','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','Sequelize','internal','EventManager','rejectmessage','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','localhost','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset'];(function(_0x2cc017,_0x25b198){var _0x509276=function(_0x156ef1){while(--_0x156ef1){_0x2cc017['push'](_0x2cc017['shift']());}};_0x509276(++_0x25b198);}(_0xec76,0x116));var _0x6ec7=function(_0x48fa80,_0x569cd5){_0x48fa80=_0x48fa80-0x0;var _0x4e0b92=_0xec76[_0x48fa80];return _0x4e0b92;};'use strict';var emlformat=require(_0x6ec7('0x0'));var moment=require(_0x6ec7('0x1'));var BPromise=require(_0x6ec7('0x2'));var util=require(_0x6ec7('0x3'));var path=require(_0x6ec7('0x4'));var fs=require('fs');var _=require(_0x6ec7('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x6ec7('0x6'));var logger=require(_0x6ec7('0x7'))(_0x6ec7('0x8'));var interaction_log=require(_0x6ec7('0x7'))(_0x6ec7('0x9'));var config=require(_0x6ec7('0xa'));var db=require('../../mysqldb')['db'];config[_0x6ec7('0xb')]=_['defaults'](config['redis'],{'host':_0x6ec7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ec7('0xb')]));var htmlEntities=require(_0x6ec7('0xd'));require(_0x6ec7('0xe'))[_0x6ec7('0xf')](socket);var jayson=require(_0x6ec7('0x10'));var client=jayson[_0x6ec7('0x11')][_0x6ec7('0x12')]({'port':0x232c});var client9003=jayson['client'][_0x6ec7('0x12')]({'port':0x232b});var client9002=jayson[_0x6ec7('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53dec7,_0x537748,_0x5a957e,_0x403382){return new BPromise(function(_0x432934,_0x4de322){var _0x2b4eea=_0x403382||client;return _0x2b4eea[_0x6ec7('0x13')](_0x53dec7,_0x5a957e)[_0x6ec7('0x14')](function(_0x5377a1){logger[_0x6ec7('0x15')](_0x6ec7('0x16'),_0x537748,'request\x20sent');logger['debug'](_0x6ec7('0x17'),_0x537748,'request\x20sent',JSON[_0x6ec7('0x18')](_0x5377a1));if(_0x5377a1['error']){if(_0x5377a1[_0x6ec7('0x19')][_0x6ec7('0x1a')]===0x1f4){logger[_0x6ec7('0x19')](_0x6ec7('0x16'),_0x537748,_0x5377a1[_0x6ec7('0x19')]['message']);return _0x4de322(_0x5377a1['error']['message']);}logger[_0x6ec7('0x19')](_0x6ec7('0x16'),_0x537748,_0x5377a1[_0x6ec7('0x19')][_0x6ec7('0x1b')]);return _0x432934(_0x5377a1[_0x6ec7('0x19')]['message']);}else{logger[_0x6ec7('0x15')](_0x6ec7('0x16'),_0x537748,_0x6ec7('0x1c'));_0x432934(_0x5377a1[_0x6ec7('0x1d')]['message']);}})[_0x6ec7('0x1e')](function(_0x43c373){logger[_0x6ec7('0x19')](_0x6ec7('0x16'),_0x537748,_0x43c373);_0x4de322(_0x43c373);});});}function respondWithResult(_0x13f466,_0x28b769){_0x28b769=_0x28b769||0xc8;return function(_0xbd0556){if(_0xbd0556){return _0x13f466[_0x6ec7('0x1f')](_0x28b769)[_0x6ec7('0x20')](_0xbd0556);}};}function respondWithFilteredResult(_0x14fbf6,_0x4768df){return function(_0x1e9317){if(_0x1e9317){var _0x48cc48=typeof _0x4768df[_0x6ec7('0x21')]==='undefined'&&typeof _0x4768df['limit']===_0x6ec7('0x22');var _0x288f52=_0x1e9317[_0x6ec7('0x23')];var _0x10c971=_0x48cc48?0x0:_0x4768df[_0x6ec7('0x21')];var _0x481bb4=_0x48cc48?_0x1e9317[_0x6ec7('0x23')]:_0x4768df[_0x6ec7('0x21')]+_0x4768df[_0x6ec7('0x24')];var _0x4ca78d;if(_0x481bb4>=_0x288f52){_0x481bb4=_0x288f52;_0x4ca78d=0xc8;}else{_0x4ca78d=0xce;}_0x14fbf6[_0x6ec7('0x1f')](_0x4ca78d);return _0x14fbf6[_0x6ec7('0x25')]('Content-Range',_0x10c971+'-'+_0x481bb4+'/'+_0x288f52)[_0x6ec7('0x20')](_0x1e9317);}return null;};}function saveUpdates(_0x5cc995){return function(_0x3540f9){if(_0x3540f9){return _0x3540f9[_0x6ec7('0x26')](_0x5cc995)['then'](function(_0x1d48a6){return _0x1d48a6;});}return null;};}function removeEntity(_0xf383a4){return function(_0x2e9dc4){if(_0x2e9dc4){return _0x2e9dc4[_0x6ec7('0x27')]()['then'](function(){_0xf383a4[_0x6ec7('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x506cd4){return function(_0x5051de){if(!_0x5051de){_0x506cd4[_0x6ec7('0x28')](0x194);}return _0x5051de;};}function handleError(_0x527448,_0x496330){_0x496330=_0x496330||0x1f4;return function(_0x2be993){logger[_0x6ec7('0x19')](_0x2be993[_0x6ec7('0x29')]);if(_0x2be993[_0x6ec7('0x2a')]){delete _0x2be993[_0x6ec7('0x2a')];}_0x527448['status'](_0x496330)[_0x6ec7('0x2b')](_0x2be993);};}exports[_0x6ec7('0x2c')]=function(_0x54ec9a,_0x5d13e3){var _0x5a1431={},_0x37b3d9={},_0x257677={'count':0x0,'rows':[]};var _0x4a1f4d=_['map'](db[_0x6ec7('0x2d')]['rawAttributes'],function(_0x4c9342){return{'name':_0x4c9342['fieldName'],'type':_0x4c9342['type'][_0x6ec7('0x2e')]};});_0x37b3d9[_0x6ec7('0x2f')]=_[_0x6ec7('0x30')](_0x4a1f4d,_0x6ec7('0x2a'));_0x37b3d9['query']=_[_0x6ec7('0x31')](_0x54ec9a[_0x6ec7('0x32')]);_0x37b3d9['filters']=_['intersection'](_0x37b3d9[_0x6ec7('0x2f')],_0x37b3d9[_0x6ec7('0x32')]);_0x5a1431[_0x6ec7('0x33')]=_[_0x6ec7('0x34')](_0x37b3d9[_0x6ec7('0x2f')],qs[_0x6ec7('0x35')](_0x54ec9a[_0x6ec7('0x32')][_0x6ec7('0x35')]));_0x5a1431[_0x6ec7('0x33')]=_0x5a1431['attributes'][_0x6ec7('0x36')]?_0x5a1431[_0x6ec7('0x33')]:_0x37b3d9['model'];if(!_0x54ec9a['query'][_0x6ec7('0x37')](_0x6ec7('0x38'))){_0x5a1431[_0x6ec7('0x24')]=qs[_0x6ec7('0x24')](_0x54ec9a['query'][_0x6ec7('0x24')]);_0x5a1431['offset']=qs['offset'](_0x54ec9a[_0x6ec7('0x32')][_0x6ec7('0x21')]);}_0x5a1431[_0x6ec7('0x39')]=qs[_0x6ec7('0x3a')](_0x54ec9a[_0x6ec7('0x32')][_0x6ec7('0x3a')]);_0x5a1431[_0x6ec7('0x3b')]=qs[_0x6ec7('0x3c')](_[_0x6ec7('0x3d')](_0x54ec9a[_0x6ec7('0x32')],_0x37b3d9[_0x6ec7('0x3c')]),_0x4a1f4d);if(_0x54ec9a['query']['filter']){_0x5a1431[_0x6ec7('0x3b')]=_[_0x6ec7('0x3e')](_0x5a1431['where'],{'$or':_['map'](_0x4a1f4d,function(_0x8fb066){if(_0x8fb066[_0x6ec7('0x3f')]!==_0x6ec7('0x40')){var _0xd5f641={};_0xd5f641[_0x8fb066[_0x6ec7('0x2a')]]={'$like':'%'+_0x54ec9a[_0x6ec7('0x32')]['filter']+'%'};return _0xd5f641;}})});}_0x5a1431=_[_0x6ec7('0x3e')]({},_0x5a1431,_0x54ec9a[_0x6ec7('0x41')]);var _0xa76f34={'where':_0x5a1431[_0x6ec7('0x3b')]};return db['MailMessage'][_0x6ec7('0x23')](_0xa76f34)[_0x6ec7('0x14')](function(_0x5c5483){_0x257677[_0x6ec7('0x23')]=_0x5c5483;if(_0x54ec9a[_0x6ec7('0x32')][_0x6ec7('0x42')]){_0x5a1431[_0x6ec7('0x43')]=[{'all':!![]}];}return db[_0x6ec7('0x2d')][_0x6ec7('0x44')](_0x5a1431);})[_0x6ec7('0x14')](function(_0x52ac72){_0x257677[_0x6ec7('0x45')]=_0x52ac72;return _0x257677;})[_0x6ec7('0x14')](respondWithFilteredResult(_0x5d13e3,_0x5a1431))[_0x6ec7('0x1e')](handleError(_0x5d13e3,null));};exports['show']=function(_0xa04326,_0x192b1a){var _0x22b63d={'raw':!![],'where':{'id':_0xa04326[_0x6ec7('0x46')]['id']}},_0x1d802b={};_0x1d802b[_0x6ec7('0x2f')]=_[_0x6ec7('0x31')](db[_0x6ec7('0x2d')][_0x6ec7('0x47')]);_0x1d802b[_0x6ec7('0x32')]=_[_0x6ec7('0x31')](_0xa04326[_0x6ec7('0x32')]);_0x1d802b[_0x6ec7('0x3c')]=_[_0x6ec7('0x34')](_0x1d802b[_0x6ec7('0x2f')],_0x1d802b[_0x6ec7('0x32')]);_0x22b63d[_0x6ec7('0x33')]=_[_0x6ec7('0x34')](_0x1d802b[_0x6ec7('0x2f')],qs[_0x6ec7('0x35')](_0xa04326[_0x6ec7('0x32')]['fields']));_0x22b63d[_0x6ec7('0x33')]=_0x22b63d['attributes'][_0x6ec7('0x36')]?_0x22b63d[_0x6ec7('0x33')]:_0x1d802b[_0x6ec7('0x2f')];if(_0xa04326[_0x6ec7('0x32')]['includeAll']){_0x22b63d['include']=[{'all':!![]}];}_0x22b63d=_['merge']({},_0x22b63d,_0xa04326[_0x6ec7('0x41')]);return db[_0x6ec7('0x2d')][_0x6ec7('0x48')](_0x22b63d)['then'](handleEntityNotFound(_0x192b1a,null))[_0x6ec7('0x14')](respondWithResult(_0x192b1a,null))[_0x6ec7('0x1e')](handleError(_0x192b1a,null));};exports[_0x6ec7('0x26')]=function(_0x4d88c9,_0x3d80f3){if(_0x4d88c9['body']['id']){delete _0x4d88c9[_0x6ec7('0x49')]['id'];}return db[_0x6ec7('0x2d')][_0x6ec7('0x48')]({'where':{'id':_0x4d88c9[_0x6ec7('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d80f3,null))[_0x6ec7('0x14')](saveUpdates(_0x4d88c9[_0x6ec7('0x49')],null))['then'](respondWithResult(_0x3d80f3,null))['catch'](handleError(_0x3d80f3,null));};exports['destroy']=function(_0x5bffac,_0x19f5bb){return db['MailMessage'][_0x6ec7('0x48')]({'where':{'id':_0x5bffac['params']['id']}})[_0x6ec7('0x14')](handleEntityNotFound(_0x19f5bb,null))[_0x6ec7('0x14')](removeEntity(_0x19f5bb,null))[_0x6ec7('0x1e')](handleError(_0x19f5bb,null));};exports[_0x6ec7('0x4a')]=function(_0x24d14c,_0x3b89e0){return db['MailMessage'][_0x6ec7('0x4a')]()[_0x6ec7('0x14')](respondWithResult(_0x3b89e0,null))[_0x6ec7('0x1e')](handleError(_0x3b89e0,null));};exports['create']=function(_0x528038,_0x51e5e2){return db[_0x6ec7('0x2d')][_0x6ec7('0x4b')](_0x528038[_0x6ec7('0x49')])[_0x6ec7('0x14')](function(_0xab2b8b){if(_0xab2b8b){if(_0xab2b8b[_0x6ec7('0x4c')]===_0x6ec7('0x4d')&&!_0xab2b8b[_0x6ec7('0x4e')]){var _0x40ced5,_0x5773dc,_0x1da4d9;if(_0x528038[_0x6ec7('0x49')]['to']){_0x5773dc=_0x528038[_0x6ec7('0x49')]['to'][_0x6ec7('0x4f')](',')[0x0];}return db['MailAccount'][_0x6ec7('0x50')]({'where':{'id':_0xab2b8b[_0x6ec7('0x51')]},'include':[{'model':db[_0x6ec7('0x52')],'as':_0x6ec7('0x53'),'include':[{'model':db['CmContact'],'as':_0x6ec7('0x54'),'where':{'email':_0x5773dc},'limit':0x1,'order':[['updatedAt',_0x6ec7('0x55')]]}]},{'model':db[_0x6ec7('0x56')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x6ec7('0x14')](function(_0x150050){_0x40ced5=_0x150050;if(!_0x40ced5||!_0x40ced5['Smtp'])return;var _0x2d655d=_0x40ced5['getSmtpOptions']();if(_0x528038[_0x6ec7('0x49')][_0x6ec7('0x57')]&&_0x528038[_0x6ec7('0x49')][_0x6ec7('0x57')]['length']){for(var _0x4f2d6c=0x0;_0x4f2d6c<_0x528038[_0x6ec7('0x49')][_0x6ec7('0x57')][_0x6ec7('0x36')];_0x4f2d6c+=0x1){_0x528038['body']['attachments'][_0x4f2d6c]={'filename':_0x528038[_0x6ec7('0x49')][_0x6ec7('0x57')][_0x4f2d6c][_0x6ec7('0x2a')],'path':path[_0x6ec7('0x58')](config[_0x6ec7('0x59')],_0x6ec7('0x5a'),_0x528038[_0x6ec7('0x49')][_0x6ec7('0x57')][_0x4f2d6c][_0x6ec7('0x5b')])};}}_0x1da4d9={'account':_0x2d655d,'message':_0x528038[_0x6ec7('0x49')]};return;})[_0x6ec7('0x14')](function(){if(_0x40ced5[_0x6ec7('0x53')]){if(_0x40ced5[_0x6ec7('0x53')]['Contacts'][_0x6ec7('0x36')]){return _0x40ced5['List'][_0x6ec7('0x54')][0x0];}else{return db[_0x6ec7('0x5c')][_0x6ec7('0x4b')](_[_0x6ec7('0x5d')](_0x528038[_0x6ec7('0x49')],{'firstName':_0x528038['body']['to'],'email':_0x528038[_0x6ec7('0x49')]['to'],'phone':_0x528038[_0x6ec7('0x49')]['to'],'ListId':_0x40ced5[_0x6ec7('0x5e')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x6ec7('0x14')](function(){if(_0x1da4d9){return respondWithRpcPromise(_0x6ec7('0x5f'),_0x6ec7('0x60'),_0x1da4d9,client9003)[_0x6ec7('0x14')](function(_0x4001cb){return _0xab2b8b['update']({'read':!![],'messageId':_0x4001cb[_0x6ec7('0x61')],'sentAt':moment()[_0x6ec7('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x6ec7('0x1e')](function(_0x4114f6){logger[_0x6ec7('0x19')]('%s',JSON[_0x6ec7('0x18')](_0x4114f6));return _0xab2b8b;});}return _0xab2b8b;});}return _0xab2b8b;}})['then'](respondWithResult(_0x51e5e2,0xc9))[_0x6ec7('0x1e')](handleError(_0x51e5e2,null));};exports[_0x6ec7('0x63')]=function(_0x3ef20d,_0x42adad){var _0x322951={'agent':{},'channel':'mail'};if(_0x3ef20d[_0x6ec7('0x49')]['id']){delete _0x3ef20d['body']['id'];}_0x3ef20d[_0x6ec7('0x49')]['read']=!![];_0x3ef20d[_0x6ec7('0x49')][_0x6ec7('0x64')]=moment()[_0x6ec7('0x62')](_0x6ec7('0x65'));_0x3ef20d['body']['UserId']=_0x3ef20d[_0x6ec7('0x49')][_0x6ec7('0x66')]||_0x3ef20d['user']['id'];_0x322951[_0x6ec7('0x67')]['id']=_0x3ef20d[_0x6ec7('0x49')][_0x6ec7('0x66')];return db['MailMessage'][_0x6ec7('0x48')]({'where':{'id':_0x3ef20d[_0x6ec7('0x46')]['id'],'UserId':null}})[_0x6ec7('0x14')](handleEntityNotFound(_0x42adad,null))['then'](saveUpdates(_0x3ef20d[_0x6ec7('0x49')],null))[_0x6ec7('0x14')](function(_0x44c363){if(_0x44c363){_0x322951[_0x6ec7('0x1b')]=_0x44c363['get']({'plain':!![]});return db['MailInteraction'][_0x6ec7('0x48')]({'where':{'id':_0x44c363[_0x6ec7('0x68')]}});}return null;})[_0x6ec7('0x14')](handleEntityNotFound(_0x42adad,null))['then'](function(_0x362cc9){if(_0x362cc9){return _0x362cc9['update']({'UserId':_0x3ef20d[_0x6ec7('0x49')][_0x6ec7('0x66')],'read1stAt':_[_0x6ec7('0x69')](_0x362cc9[_0x6ec7('0x6a')])?moment()['format'](_0x6ec7('0x65')):undefined});}return null;})[_0x6ec7('0x14')](function(_0x374696){if(_0x374696){_0x322951[_0x6ec7('0x6b')]=_0x374696[_0x6ec7('0x6c')]({'plain':!![]});interaction_log['info'](_0x6ec7('0x6d'),_0x3ef20d[_0x6ec7('0x6e')]['id'],_0x3ef20d['user'][_0x6ec7('0x2a')],_0x3ef20d[_0x6ec7('0x6e')][_0x6ec7('0x6f')],_0x322951[_0x6ec7('0x6b')]['id'],_0x3ef20d[_0x6ec7('0x49')]?JSON[_0x6ec7('0x18')](_0x3ef20d[_0x6ec7('0x49')]):_0x6ec7('0x70'));return respondWithRpcPromise('AcceptMessage',_0x6ec7('0x71'),_0x322951);}return null;})['then'](function(_0x542304){var _0x3450ed=_0x6ec7('0x72')+_0x542304[_0x6ec7('0x1b')]['ContactId'];return db[_0x6ec7('0x73')][_0x6ec7('0x32')](_0x3450ed,{'type':db['Sequelize'][_0x6ec7('0x74')][_0x6ec7('0x75')],'raw':!![]})[_0x6ec7('0x14')](function(_0x1e636c){return _0x1e636c;});})['then'](function(_0x5bfd59){if(_0x5bfd59){_0x322951['message'][_0x6ec7('0x76')]=_0x5bfd59[0x0];if(!_0x3ef20d[_0x6ec7('0x49')]['UserId'])return;return db[_0x6ec7('0x77')][_0x6ec7('0x48')]({'where':{'id':_0x3ef20d[_0x6ec7('0x49')]['UserId'],'role':_0x6ec7('0x67')},'attributes':['id',_0x6ec7('0x2a'),_0x6ec7('0x78'),_0x6ec7('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x128acc){if(!_0x128acc)return null;_0x322951[_0x6ec7('0x1b')][_0x6ec7('0x67')]=_0x128acc;return _0x322951;})[_0x6ec7('0x14')](function(_0x3cc425){if(_0x3cc425){if(_0x3ef20d[_0x6ec7('0x49')][_0x6ec7('0x7a')]){_0x322951[_0x6ec7('0x1b')][_0x6ec7('0x7b')]=util[_0x6ec7('0x62')](_0x6ec7('0x7c'),_0x3ef20d[_0x6ec7('0x6e')][_0x6ec7('0x2a')]);_0x322951['message']['channel']=_0x322951[_0x6ec7('0x7d')];_0x322951[_0x6ec7('0x1b')][_0x6ec7('0x7e')]=_0x322951[_0x6ec7('0x7d')];_0x322951[_0x6ec7('0x1b')][_0x6ec7('0x7f')]=_0x6ec7('0x63');_0x322951[_0x6ec7('0x1b')][_0x6ec7('0x49')]=htmlToText['fromString'](_0x322951['message'][_0x6ec7('0x49')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x6ec7('0x80'),'message':_0x322951['message']},client9002)[_0x6ec7('0x14')](function(){return _0x322951;});}return _0x322951;}return null;})[_0x6ec7('0x14')](respondWithResult(_0x42adad,null))[_0x6ec7('0x1e')](handleError(_0x42adad,null));};exports[_0x6ec7('0x81')]=function(_0x274326,_0x14a200){var _0xad2a85={'agent':{},'channel':_0x6ec7('0x82')};if(_0x274326[_0x6ec7('0x49')]['id']){delete _0x274326[_0x6ec7('0x49')]['id'];}_0x274326[_0x6ec7('0x49')][_0x6ec7('0x66')]=_0x274326[_0x6ec7('0x49')][_0x6ec7('0x66')]||_0x274326[_0x6ec7('0x6e')]['id'];_0xad2a85['agent']['id']=_0x274326['body'][_0x6ec7('0x66')];return db[_0x6ec7('0x2d')][_0x6ec7('0x48')]({'where':{'id':_0x274326[_0x6ec7('0x46')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14a200,null))[_0x6ec7('0x14')](function(_0x46069e){if(_0x46069e){_0xad2a85['message']=_0x46069e['get']({'plain':!![]});return db[_0x6ec7('0x83')][_0x6ec7('0x48')]({'where':{'id':_0x46069e['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x14a200,null))['then'](function(_0x310ba3){if(_0x310ba3){_0xad2a85[_0x6ec7('0x6b')]=_0x310ba3[_0x6ec7('0x6c')]({'plain':!![]});interaction_log[_0x6ec7('0x15')](_0x6ec7('0x84'),_0x274326[_0x6ec7('0x6e')]['id'],_0x274326[_0x6ec7('0x6e')][_0x6ec7('0x2a')],_0x274326[_0x6ec7('0x6e')][_0x6ec7('0x6f')],_0xad2a85[_0x6ec7('0x6b')]['id'],_0x274326[_0x6ec7('0x49')]?JSON[_0x6ec7('0x18')](_0x274326['body']):_0x6ec7('0x70'));return respondWithRpcPromise(_0x6ec7('0x85'),'rejectMessage',_0xad2a85);}return null;})[_0x6ec7('0x14')](function(_0x59d67a){var _0x12636e=_0x6ec7('0x72')+_0x59d67a[_0x6ec7('0x1b')]['ContactId'];return db[_0x6ec7('0x73')][_0x6ec7('0x32')](_0x12636e,{'type':db[_0x6ec7('0x86')][_0x6ec7('0x74')][_0x6ec7('0x75')],'raw':!![]})[_0x6ec7('0x14')](function(_0x29bfbe){return _0x29bfbe;});})[_0x6ec7('0x14')](function(_0x1bc626){if(_0x1bc626){_0xad2a85['message']['contact']=_0x1bc626[0x0];if(!_0x274326[_0x6ec7('0x49')]['UserId'])return;return db[_0x6ec7('0x77')][_0x6ec7('0x48')]({'where':{'id':_0x274326[_0x6ec7('0x49')][_0x6ec7('0x66')],'role':_0x6ec7('0x67')},'attributes':['id',_0x6ec7('0x2a'),'fullname','email',_0x6ec7('0x87')],'raw':!![]});}return null;})[_0x6ec7('0x14')](function(_0x242cd6){if(!_0x242cd6)return null;_0xad2a85['message'][_0x6ec7('0x67')]=_0x242cd6;return _0xad2a85;})[_0x6ec7('0x14')](function(_0x10102f){if(_0x10102f){_0x10102f[_0x6ec7('0x1b')][_0x6ec7('0x7b')]=util[_0x6ec7('0x62')](_0x6ec7('0x7c'),_0x274326[_0x6ec7('0x6e')][_0x6ec7('0x2a')]);_0x10102f[_0x6ec7('0x1b')][_0x6ec7('0x7d')]=_0xad2a85[_0x6ec7('0x7d')];_0x10102f[_0x6ec7('0x1b')][_0x6ec7('0x7e')]=_0xad2a85[_0x6ec7('0x7d')];_0x10102f[_0x6ec7('0x1b')][_0x6ec7('0x7f')]=_0x6ec7('0x81');_0x10102f[_0x6ec7('0x1b')]['body']=htmlToText['fromString'](_0xad2a85[_0x6ec7('0x1b')][_0x6ec7('0x49')]);respondWithRpcPromise(_0x6ec7('0x88'),'EventManager',{'event':_0x6ec7('0x89'),'message':_0x10102f[_0x6ec7('0x1b')]},client9002);return _0xad2a85;}return null;})[_0x6ec7('0x14')](respondWithResult(_0x14a200,null))[_0x6ec7('0x1e')](handleError(_0x14a200,null));};exports['download']=function(_0x456059,_0x3c11c6){var _0x52e25a=moment()['unix']()['toString']();var _0x56e891=path[_0x6ec7('0x58')](config[_0x6ec7('0x59')],_0x6ec7('0x8a'),'files','tmp');var _0x586e03=path['join'](config['root'],_0x6ec7('0x8a'),_0x6ec7('0x8b'),'attachments');var _0x518852=util[_0x6ec7('0x62')](_0x6ec7('0x8c'),_0x52e25a);return db[_0x6ec7('0x2d')]['find']({'where':{'id':_0x456059['params']['id']},'attributes':['id',_0x6ec7('0x49'),_0x6ec7('0x8d'),'to','cc',_0x6ec7('0x8e'),_0x6ec7('0x8f'),_0x6ec7('0x90')],'include':_0x456059[_0x6ec7('0x32')][_0x6ec7('0x57')]?[{'model':db[_0x6ec7('0x91')],'as':_0x6ec7('0x92')}]:undefined})[_0x6ec7('0x14')](handleEntityNotFound(_0x3c11c6,null))[_0x6ec7('0x14')](function(_0x836b4c){if(_0x836b4c){var _0x37b293=_0x836b4c;var _0x1c8655={'from':_0x37b293[_0x6ec7('0x8d')],'to':_0x37b293['to'],'subject':_0x37b293[_0x6ec7('0x8f')],'html':htmlEntities['decode'](_0x37b293[_0x6ec7('0x49')]),'headers':{'Date':moment(_0x37b293['createdAt'])['format'](_0x6ec7('0x93'))},'attachments':[]};if(_0x836b4c['cc']){_0x1c8655[_0x6ec7('0x94')]['Cc']=_0x836b4c['cc'];}if(_0x836b4c[_0x6ec7('0x8e')]){_0x1c8655[_0x6ec7('0x94')][_0x6ec7('0x95')]=_0x836b4c['bcc'];}return new BPromise(function(_0x429335,_0x5532f3){if(_0x836b4c[_0x6ec7('0x92')]){for(var _0x5ce139=0x0;_0x5ce139<_0x836b4c['Attachments']['length'];_0x5ce139++){var _0x16acb8=_0x836b4c[_0x6ec7('0x92')][_0x5ce139];var _0x343ce7=path[_0x6ec7('0x58')](_0x586e03,_0x16acb8[_0x6ec7('0x5b')]);if(fs['existsSync'](_0x343ce7)){_0x1c8655[_0x6ec7('0x57')][_0x6ec7('0x96')]({'name':_0x16acb8[_0x6ec7('0x2a')],'contentType':_0x16acb8[_0x6ec7('0x3f')],'data':fs[_0x6ec7('0x97')](_0x343ce7)});}}}emlformat[_0x6ec7('0x98')](_0x1c8655,function(_0x59a448,_0x5a7e21){if(_0x59a448)return _0x5532f3(_0x59a448);fs[_0x6ec7('0x99')](path[_0x6ec7('0x58')](_0x56e891,_0x518852),_0x5a7e21);return _0x429335(_0x5a7e21);});});}})[_0x6ec7('0x14')](function(_0x392fd2){if(_0x392fd2){return _0x3c11c6[_0x6ec7('0x9a')](path[_0x6ec7('0x58')](_0x56e891,_0x518852),_0x518852,function(_0x22b036){if(!_0x22b036)fs[_0x6ec7('0x9b')](path['join'](_0x56e891,_0x518852));});}})[_0x6ec7('0x1e')](handleError(_0x3c11c6,null));}; \ No newline at end of file +var _0x418b=['basename','List','Contacts','CmContact','create','defaults','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','format','UserId','user','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE: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','contact','User','fullname','email','agent','manual','interface','channel','motionChannel','event','fromString','acceptmessage','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','internal','reject','EventManager','rejectmessage','download','toString','server','files','from','subject','createdAt','Attachments','decode','headers','bcc','existsSync','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','http','client','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','keys','include','find','update','body','destroy','params','describe','direction','secret','findOne','MailAccountId','CmList','updatedAt','MailServerOut','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments'];(function(_0x532f32,_0x3bf0da){var _0x73c024=function(_0x485fd3){while(--_0x485fd3){_0x532f32['push'](_0x532f32['shift']());}};_0x73c024(++_0x3bf0da);}(_0x418b,0xd3));var _0xb418=function(_0x592464,_0x1f6edd){_0x592464=_0x592464-0x0;var _0x56ac6a=_0x418b[_0x592464];return _0x56ac6a;};'use strict';var emlformat=require(_0xb418('0x0'));var moment=require(_0xb418('0x1'));var BPromise=require(_0xb418('0x2'));var util=require(_0xb418('0x3'));var path=require(_0xb418('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xb418('0x5'));var qs=require(_0xb418('0x6'));var logger=require(_0xb418('0x7'))(_0xb418('0x8'));var interaction_log=require(_0xb418('0x7'))(_0xb418('0x9'));var config=require('../../config/environment');var db=require(_0xb418('0xa'))['db'];config[_0xb418('0xb')]=_['defaults'](config[_0xb418('0xb')],{'host':_0xb418('0xc'),'port':0x18eb});var socket=require(_0xb418('0xd'))(new Redis(config[_0xb418('0xb')]));var htmlEntities=require('html-entities');require(_0xb418('0xe'))[_0xb418('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb418('0x10')]({'port':0x232c});var client9003=jayson[_0xb418('0x11')][_0xb418('0x10')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50b515,_0x412d50,_0x108aa2,_0x5ce595){return new BPromise(function(_0x27bc73,_0x4f1daa){var _0x322aa0=_0x5ce595||client;return _0x322aa0['request'](_0x50b515,_0x108aa2)[_0xb418('0x12')](function(_0x570b68){logger[_0xb418('0x13')](_0xb418('0x14'),_0x412d50,'request\x20sent');logger['debug'](_0xb418('0x15'),_0x412d50,'request\x20sent',JSON[_0xb418('0x16')](_0x570b68));if(_0x570b68['error']){if(_0x570b68[_0xb418('0x17')][_0xb418('0x18')]===0x1f4){logger[_0xb418('0x17')](_0xb418('0x14'),_0x412d50,_0x570b68[_0xb418('0x17')][_0xb418('0x19')]);return _0x4f1daa(_0x570b68[_0xb418('0x17')][_0xb418('0x19')]);}logger[_0xb418('0x17')](_0xb418('0x14'),_0x412d50,_0x570b68[_0xb418('0x17')][_0xb418('0x19')]);return _0x27bc73(_0x570b68['error']['message']);}else{logger[_0xb418('0x13')](_0xb418('0x14'),_0x412d50,_0xb418('0x1a'));_0x27bc73(_0x570b68[_0xb418('0x1b')][_0xb418('0x19')]);}})[_0xb418('0x1c')](function(_0x555b33){logger[_0xb418('0x17')]('MailMessage,\x20%s,\x20%s',_0x412d50,_0x555b33);_0x4f1daa(_0x555b33);});});}function respondWithResult(_0x40f481,_0x300aa5){_0x300aa5=_0x300aa5||0xc8;return function(_0x2d6e82){if(_0x2d6e82){return _0x40f481[_0xb418('0x1d')](_0x300aa5)[_0xb418('0x1e')](_0x2d6e82);}};}function respondWithFilteredResult(_0x3d820d,_0x5420e2){return function(_0x1c4327){if(_0x1c4327){var _0x5cf18a=typeof _0x5420e2[_0xb418('0x1f')]===_0xb418('0x20')&&typeof _0x5420e2[_0xb418('0x21')]===_0xb418('0x20');var _0x1c9ddc=_0x1c4327['count'];var _0x536bbd=_0x5cf18a?0x0:_0x5420e2[_0xb418('0x1f')];var _0x2b7e4e=_0x5cf18a?_0x1c4327[_0xb418('0x22')]:_0x5420e2[_0xb418('0x1f')]+_0x5420e2['limit'];var _0x30b257;if(_0x2b7e4e>=_0x1c9ddc){_0x2b7e4e=_0x1c9ddc;_0x30b257=0xc8;}else{_0x30b257=0xce;}_0x3d820d[_0xb418('0x1d')](_0x30b257);return _0x3d820d[_0xb418('0x23')](_0xb418('0x24'),_0x536bbd+'-'+_0x2b7e4e+'/'+_0x1c9ddc)[_0xb418('0x1e')](_0x1c4327);}return null;};}function saveUpdates(_0x11c1e9){return function(_0x1403e0){if(_0x1403e0){return _0x1403e0['update'](_0x11c1e9)['then'](function(_0x1a431f){return _0x1a431f;});}return null;};}function removeEntity(_0x59b446){return function(_0x1c3616){if(_0x1c3616){return _0x1c3616['destroy']()[_0xb418('0x12')](function(){_0x59b446[_0xb418('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f3e8){return function(_0x4d4c6e){if(!_0x4d4c6e){_0x38f3e8[_0xb418('0x25')](0x194);}return _0x4d4c6e;};}function handleError(_0x317e51,_0x30be76){_0x30be76=_0x30be76||0x1f4;return function(_0x4fbeab){logger[_0xb418('0x17')](_0x4fbeab[_0xb418('0x26')]);if(_0x4fbeab[_0xb418('0x27')]){delete _0x4fbeab[_0xb418('0x27')];}_0x317e51['status'](_0x30be76)[_0xb418('0x28')](_0x4fbeab);};}exports[_0xb418('0x29')]=function(_0xa20624,_0x1f08d1){var _0x442ad8={},_0x42be15={},_0x526df3={'count':0x0,'rows':[]};var _0x4c36e0=_[_0xb418('0x2a')](db[_0xb418('0x2b')][_0xb418('0x2c')],function(_0x566d37){return{'name':_0x566d37[_0xb418('0x2d')],'type':_0x566d37[_0xb418('0x2e')][_0xb418('0x2f')]};});_0x42be15[_0xb418('0x30')]=_['map'](_0x4c36e0,_0xb418('0x27'));_0x42be15[_0xb418('0x31')]=_['keys'](_0xa20624['query']);_0x42be15['filters']=_[_0xb418('0x32')](_0x42be15[_0xb418('0x30')],_0x42be15['query']);_0x442ad8[_0xb418('0x33')]=_['intersection'](_0x42be15[_0xb418('0x30')],qs[_0xb418('0x34')](_0xa20624['query'][_0xb418('0x34')]));_0x442ad8[_0xb418('0x33')]=_0x442ad8[_0xb418('0x33')][_0xb418('0x35')]?_0x442ad8['attributes']:_0x42be15[_0xb418('0x30')];if(!_0xa20624[_0xb418('0x31')][_0xb418('0x36')](_0xb418('0x37'))){_0x442ad8[_0xb418('0x21')]=qs[_0xb418('0x21')](_0xa20624[_0xb418('0x31')][_0xb418('0x21')]);_0x442ad8['offset']=qs['offset'](_0xa20624[_0xb418('0x31')][_0xb418('0x1f')]);}_0x442ad8[_0xb418('0x38')]=qs['sort'](_0xa20624[_0xb418('0x31')][_0xb418('0x39')]);_0x442ad8[_0xb418('0x3a')]=qs[_0xb418('0x3b')](_['pick'](_0xa20624[_0xb418('0x31')],_0x42be15[_0xb418('0x3b')]),_0x4c36e0);if(_0xa20624['query'][_0xb418('0x3c')]){_0x442ad8['where']=_[_0xb418('0x3d')](_0x442ad8[_0xb418('0x3a')],{'$or':_[_0xb418('0x2a')](_0x4c36e0,function(_0x236dbf){if(_0x236dbf[_0xb418('0x2e')]!==_0xb418('0x3e')){var _0xc16f81={};_0xc16f81[_0x236dbf[_0xb418('0x27')]]={'$like':'%'+_0xa20624[_0xb418('0x31')][_0xb418('0x3c')]+'%'};return _0xc16f81;}})});}_0x442ad8=_[_0xb418('0x3d')]({},_0x442ad8,_0xa20624['options']);var _0x2cf1b9={'where':_0x442ad8[_0xb418('0x3a')]};return db[_0xb418('0x2b')][_0xb418('0x22')](_0x2cf1b9)[_0xb418('0x12')](function(_0x424bd9){_0x526df3['count']=_0x424bd9;if(_0xa20624['query'][_0xb418('0x3f')]){_0x442ad8['include']=[{'all':!![]}];}return db[_0xb418('0x2b')][_0xb418('0x40')](_0x442ad8);})[_0xb418('0x12')](function(_0x3fe4b4){_0x526df3[_0xb418('0x41')]=_0x3fe4b4;return _0x526df3;})[_0xb418('0x12')](respondWithFilteredResult(_0x1f08d1,_0x442ad8))[_0xb418('0x1c')](handleError(_0x1f08d1,null));};exports['show']=function(_0x5afdb6,_0x6b19c1){var _0x295d34={'raw':!![],'where':{'id':_0x5afdb6['params']['id']}},_0x1239e6={};_0x1239e6[_0xb418('0x30')]=_['keys'](db['MailMessage'][_0xb418('0x2c')]);_0x1239e6['query']=_[_0xb418('0x42')](_0x5afdb6[_0xb418('0x31')]);_0x1239e6[_0xb418('0x3b')]=_['intersection'](_0x1239e6['model'],_0x1239e6[_0xb418('0x31')]);_0x295d34[_0xb418('0x33')]=_[_0xb418('0x32')](_0x1239e6[_0xb418('0x30')],qs['fields'](_0x5afdb6[_0xb418('0x31')]['fields']));_0x295d34['attributes']=_0x295d34[_0xb418('0x33')][_0xb418('0x35')]?_0x295d34[_0xb418('0x33')]:_0x1239e6[_0xb418('0x30')];if(_0x5afdb6[_0xb418('0x31')][_0xb418('0x3f')]){_0x295d34[_0xb418('0x43')]=[{'all':!![]}];}_0x295d34=_[_0xb418('0x3d')]({},_0x295d34,_0x5afdb6['options']);return db[_0xb418('0x2b')][_0xb418('0x44')](_0x295d34)[_0xb418('0x12')](handleEntityNotFound(_0x6b19c1,null))[_0xb418('0x12')](respondWithResult(_0x6b19c1,null))[_0xb418('0x1c')](handleError(_0x6b19c1,null));};exports[_0xb418('0x45')]=function(_0x59ef89,_0x396f9a){if(_0x59ef89[_0xb418('0x46')]['id']){delete _0x59ef89[_0xb418('0x46')]['id'];}return db[_0xb418('0x2b')][_0xb418('0x44')]({'where':{'id':_0x59ef89['params']['id']}})[_0xb418('0x12')](handleEntityNotFound(_0x396f9a,null))[_0xb418('0x12')](saveUpdates(_0x59ef89['body'],null))[_0xb418('0x12')](respondWithResult(_0x396f9a,null))[_0xb418('0x1c')](handleError(_0x396f9a,null));};exports[_0xb418('0x47')]=function(_0x57e208,_0x2a5d15){return db[_0xb418('0x2b')][_0xb418('0x44')]({'where':{'id':_0x57e208[_0xb418('0x48')]['id']}})[_0xb418('0x12')](handleEntityNotFound(_0x2a5d15,null))[_0xb418('0x12')](removeEntity(_0x2a5d15,null))[_0xb418('0x1c')](handleError(_0x2a5d15,null));};exports[_0xb418('0x49')]=function(_0x46b0db,_0x121659){return db[_0xb418('0x2b')]['describe']()[_0xb418('0x12')](respondWithResult(_0x121659,null))['catch'](handleError(_0x121659,null));};exports['create']=function(_0x31238c,_0x11aab8){return db[_0xb418('0x2b')]['create'](_0x31238c[_0xb418('0x46')])[_0xb418('0x12')](function(_0x164088){if(_0x164088){if(_0x164088[_0xb418('0x4a')]==='out'&&!_0x164088[_0xb418('0x4b')]){var _0x802706,_0x36fdb8,_0x120320;if(_0x31238c[_0xb418('0x46')]['to']){_0x36fdb8=_0x31238c[_0xb418('0x46')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xb418('0x4c')]({'where':{'id':_0x164088[_0xb418('0x4d')]},'include':[{'model':db[_0xb418('0x4e')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x36fdb8},'limit':0x1,'order':[[_0xb418('0x4f'),'DESC']]}]},{'model':db[_0xb418('0x50')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xb418('0x51')],'as':_0xb418('0x51'),'raw':!![]}]}]})[_0xb418('0x12')](function(_0x4c81b4){_0x802706=_0x4c81b4;if(!_0x802706||!_0x802706['Smtp'])return;var _0x46ec0b=_0x802706[_0xb418('0x52')]();if(_0x31238c[_0xb418('0x46')][_0xb418('0x53')]&&_0x31238c[_0xb418('0x46')][_0xb418('0x53')]['length']){for(var _0x15b18f=0x0;_0x15b18f<_0x31238c[_0xb418('0x46')][_0xb418('0x53')]['length'];_0x15b18f+=0x1){_0x31238c[_0xb418('0x46')][_0xb418('0x53')][_0x15b18f]={'filename':_0x31238c[_0xb418('0x46')][_0xb418('0x53')][_0x15b18f][_0xb418('0x27')],'path':path[_0xb418('0x54')](config[_0xb418('0x55')],_0xb418('0x56'),_0x31238c['body'][_0xb418('0x53')][_0x15b18f][_0xb418('0x57')])};}}_0x120320={'account':_0x46ec0b,'message':_0x31238c['body']};return;})['then'](function(){if(_0x802706[_0xb418('0x58')]){if(_0x802706[_0xb418('0x58')][_0xb418('0x59')]['length']){return _0x802706['List'][_0xb418('0x59')][0x0];}else{return db[_0xb418('0x5a')][_0xb418('0x5b')](_[_0xb418('0x5c')](_0x31238c[_0xb418('0x46')],{'firstName':_0x31238c[_0xb418('0x46')]['to'],'email':_0x31238c['body']['to'],'phone':_0x31238c[_0xb418('0x46')]['to'],'ListId':_0x802706['ListId']}));}}else{throw new Error(_0xb418('0x5d'));}})[_0xb418('0x12')](function(){if(_0x120320){return respondWithRpcPromise(_0xb418('0x5e'),'sendMail',_0x120320,client9003)[_0xb418('0x12')](function(_0x336874){return _0x164088[_0xb418('0x45')]({'read':!![],'messageId':_0x336874[_0xb418('0x5f')],'sentAt':moment()['format'](_0xb418('0x60'))});})[_0xb418('0x1c')](function(_0x5299cf){logger[_0xb418('0x17')]('%s',JSON['stringify'](_0x5299cf));return _0x164088;});}return _0x164088;});}return _0x164088;}})['then'](respondWithResult(_0x11aab8,0xc9))[_0xb418('0x1c')](handleError(_0x11aab8,null));};exports['accept']=function(_0x15b783,_0x53c88e){var _0xc58d03={'agent':{},'channel':'mail'};if(_0x15b783['body']['id']){delete _0x15b783[_0xb418('0x46')]['id'];}_0x15b783[_0xb418('0x46')]['read']=!![];_0x15b783[_0xb418('0x46')]['readAt']=moment()[_0xb418('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x15b783['body'][_0xb418('0x62')]=_0x15b783[_0xb418('0x46')][_0xb418('0x62')]||_0x15b783[_0xb418('0x63')]['id'];_0xc58d03['agent']['id']=_0x15b783['body'][_0xb418('0x62')];return db[_0xb418('0x2b')][_0xb418('0x44')]({'where':{'id':_0x15b783[_0xb418('0x48')]['id'],'UserId':null}})[_0xb418('0x12')](handleEntityNotFound(_0x53c88e,null))[_0xb418('0x12')](saveUpdates(_0x15b783[_0xb418('0x46')],null))[_0xb418('0x12')](function(_0xb7f70e){if(_0xb7f70e){_0xc58d03[_0xb418('0x19')]=_0xb7f70e[_0xb418('0x64')]({'plain':!![]});return db[_0xb418('0x65')][_0xb418('0x44')]({'where':{'id':_0xb7f70e['MailInteractionId']}});}return null;})[_0xb418('0x12')](handleEntityNotFound(_0x53c88e,null))[_0xb418('0x12')](function(_0xc512a2){if(_0xc512a2){return _0xc512a2['update']({'UserId':_0x15b783[_0xb418('0x46')][_0xb418('0x62')],'read1stAt':_['isNil'](_0xc512a2[_0xb418('0x66')])?moment()[_0xb418('0x61')](_0xb418('0x60')):undefined});}return null;})['then'](function(_0xdec239){if(_0xdec239){_0xc58d03[_0xb418('0x67')]=_0xdec239['get']({'plain':!![]});interaction_log[_0xb418('0x13')](_0xb418('0x68'),_0x15b783[_0xb418('0x63')]['id'],_0x15b783[_0xb418('0x63')][_0xb418('0x27')],_0x15b783['user'][_0xb418('0x69')],_0xc58d03[_0xb418('0x67')]['id'],_0x15b783[_0xb418('0x46')]?JSON['stringify'](_0x15b783['body']):_0xb418('0x6a'));return respondWithRpcPromise(_0xb418('0x6b'),_0xb418('0x6c'),_0xc58d03);}return null;})[_0xb418('0x12')](function(_0x5c9ab5){var _0xe7289e=_0xb418('0x6d')+_0x5c9ab5[_0xb418('0x19')][_0xb418('0x6e')];return db['sequelize'][_0xb418('0x31')](_0xe7289e,{'type':db[_0xb418('0x6f')][_0xb418('0x70')][_0xb418('0x71')],'raw':!![]})[_0xb418('0x12')](function(_0x162040){return _0x162040;});})[_0xb418('0x12')](function(_0x293733){if(_0x293733){_0xc58d03[_0xb418('0x19')][_0xb418('0x72')]=_0x293733[0x0];if(!_0x15b783[_0xb418('0x46')][_0xb418('0x62')])return;return db[_0xb418('0x73')][_0xb418('0x44')]({'where':{'id':_0x15b783['body'][_0xb418('0x62')],'role':'agent'},'attributes':['id',_0xb418('0x27'),_0xb418('0x74'),_0xb418('0x75'),'internal'],'raw':!![]});}return null;})[_0xb418('0x12')](function(_0x14a342){if(!_0x14a342)return null;_0xc58d03[_0xb418('0x19')][_0xb418('0x76')]=_0x14a342;return _0xc58d03;})[_0xb418('0x12')](function(_0x39aa81){if(_0x39aa81){if(_0x15b783[_0xb418('0x46')][_0xb418('0x77')]){_0xc58d03[_0xb418('0x19')][_0xb418('0x78')]=util[_0xb418('0x61')]('SIP/%s',_0x15b783[_0xb418('0x63')][_0xb418('0x27')]);_0xc58d03[_0xb418('0x19')][_0xb418('0x79')]=_0xc58d03['channel'];_0xc58d03[_0xb418('0x19')][_0xb418('0x7a')]=_0xc58d03[_0xb418('0x79')];_0xc58d03[_0xb418('0x19')][_0xb418('0x7b')]='accept';_0xc58d03[_0xb418('0x19')][_0xb418('0x46')]=htmlToText[_0xb418('0x7c')](_0xc58d03['message'][_0xb418('0x46')]);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xb418('0x7d'),'message':_0xc58d03['message']},client9002)[_0xb418('0x12')](function(){return _0xc58d03;});}return _0xc58d03;}return null;})[_0xb418('0x12')](respondWithResult(_0x53c88e,null))[_0xb418('0x1c')](handleError(_0x53c88e,null));};exports['reject']=function(_0x2c432a,_0x51016c){var _0x5a2905={'agent':{},'channel':_0xb418('0x7e')};if(_0x2c432a[_0xb418('0x46')]['id']){delete _0x2c432a[_0xb418('0x46')]['id'];}_0x2c432a[_0xb418('0x46')][_0xb418('0x62')]=_0x2c432a[_0xb418('0x46')][_0xb418('0x62')]||_0x2c432a[_0xb418('0x63')]['id'];_0x5a2905['agent']['id']=_0x2c432a[_0xb418('0x46')][_0xb418('0x62')];return db[_0xb418('0x2b')][_0xb418('0x44')]({'where':{'id':_0x2c432a[_0xb418('0x48')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51016c,null))[_0xb418('0x12')](function(_0x349774){if(_0x349774){_0x5a2905[_0xb418('0x19')]=_0x349774[_0xb418('0x64')]({'plain':!![]});return db[_0xb418('0x65')][_0xb418('0x44')]({'where':{'id':_0x349774[_0xb418('0x7f')]}});}return null;})[_0xb418('0x12')](handleEntityNotFound(_0x51016c,null))[_0xb418('0x12')](function(_0x2eb235){if(_0x2eb235){_0x5a2905[_0xb418('0x67')]=_0x2eb235[_0xb418('0x64')]({'plain':!![]});interaction_log['info'](_0xb418('0x80'),_0x2c432a['user']['id'],_0x2c432a[_0xb418('0x63')][_0xb418('0x27')],_0x2c432a[_0xb418('0x63')][_0xb418('0x69')],_0x5a2905[_0xb418('0x67')]['id'],_0x2c432a['body']?JSON[_0xb418('0x16')](_0x2c432a[_0xb418('0x46')]):'null');return respondWithRpcPromise(_0xb418('0x81'),'rejectMessage',_0x5a2905);}return null;})[_0xb418('0x12')](function(_0x4487de){var _0x4612be='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4487de[_0xb418('0x19')][_0xb418('0x6e')];return db['sequelize'][_0xb418('0x31')](_0x4612be,{'type':db['Sequelize'][_0xb418('0x70')][_0xb418('0x71')],'raw':!![]})[_0xb418('0x12')](function(_0x4f2f81){return _0x4f2f81;});})['then'](function(_0x92d3b6){if(_0x92d3b6){_0x5a2905['message'][_0xb418('0x72')]=_0x92d3b6[0x0];if(!_0x2c432a[_0xb418('0x46')]['UserId'])return;return db[_0xb418('0x73')][_0xb418('0x44')]({'where':{'id':_0x2c432a['body'][_0xb418('0x62')],'role':_0xb418('0x76')},'attributes':['id',_0xb418('0x27'),'fullname',_0xb418('0x75'),_0xb418('0x82')],'raw':!![]});}return null;})[_0xb418('0x12')](function(_0x38c330){if(!_0x38c330)return null;_0x5a2905[_0xb418('0x19')][_0xb418('0x76')]=_0x38c330;return _0x5a2905;})[_0xb418('0x12')](function(_0x6e7258){if(_0x6e7258){_0x6e7258['message'][_0xb418('0x78')]=util[_0xb418('0x61')]('SIP/%s',_0x2c432a['user'][_0xb418('0x27')]);_0x6e7258[_0xb418('0x19')][_0xb418('0x79')]=_0x5a2905['channel'];_0x6e7258[_0xb418('0x19')]['motionChannel']=_0x5a2905[_0xb418('0x79')];_0x6e7258[_0xb418('0x19')][_0xb418('0x7b')]=_0xb418('0x83');_0x6e7258[_0xb418('0x19')][_0xb418('0x46')]=htmlToText[_0xb418('0x7c')](_0x5a2905[_0xb418('0x19')]['body']);respondWithRpcPromise(_0xb418('0x84'),_0xb418('0x84'),{'event':_0xb418('0x85'),'message':_0x6e7258[_0xb418('0x19')]},client9002);return _0x5a2905;}return null;})[_0xb418('0x12')](respondWithResult(_0x51016c,null))[_0xb418('0x1c')](handleError(_0x51016c,null));};exports[_0xb418('0x86')]=function(_0x86831a,_0x18e24f){var _0xa6e13b=moment()['unix']()[_0xb418('0x87')]();var _0x220006=path['join'](config['root'],_0xb418('0x88'),'files','tmp');var _0x51a36c=path['join'](config[_0xb418('0x55')],_0xb418('0x88'),_0xb418('0x89'),_0xb418('0x53'));var _0x22a5f9=util[_0xb418('0x61')]('message-%s.eml',_0xa6e13b);return db[_0xb418('0x2b')][_0xb418('0x44')]({'where':{'id':_0x86831a['params']['id']},'attributes':['id',_0xb418('0x46'),_0xb418('0x8a'),'to','cc','bcc',_0xb418('0x8b'),_0xb418('0x8c')],'include':_0x86831a[_0xb418('0x31')]['attachments']?[{'model':db['Attachment'],'as':_0xb418('0x8d')}]:undefined})[_0xb418('0x12')](handleEntityNotFound(_0x18e24f,null))[_0xb418('0x12')](function(_0x35d07e){if(_0x35d07e){var _0x5d56b3=_0x35d07e;var _0x3c75f3={'from':_0x5d56b3['from'],'to':_0x5d56b3['to'],'subject':_0x5d56b3['subject'],'html':htmlEntities[_0xb418('0x8e')](_0x5d56b3[_0xb418('0x46')]),'headers':{'Date':moment(_0x5d56b3[_0xb418('0x8c')])[_0xb418('0x61')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x35d07e['cc']){_0x3c75f3[_0xb418('0x8f')]['Cc']=_0x35d07e['cc'];}if(_0x35d07e[_0xb418('0x90')]){_0x3c75f3['headers']['Bcc']=_0x35d07e[_0xb418('0x90')];}return new BPromise(function(_0x151f43,_0x7c6d7a){if(_0x35d07e[_0xb418('0x8d')]){for(var _0xb9fad6=0x0;_0xb9fad6<_0x35d07e['Attachments'][_0xb418('0x35')];_0xb9fad6++){var _0x169290=_0x35d07e[_0xb418('0x8d')][_0xb9fad6];var _0x2ccb0c=path[_0xb418('0x54')](_0x51a36c,_0x169290[_0xb418('0x57')]);if(fs[_0xb418('0x91')](_0x2ccb0c)){_0x3c75f3[_0xb418('0x53')]['push']({'name':_0x169290['name'],'contentType':_0x169290[_0xb418('0x2e')],'data':fs[_0xb418('0x92')](_0x2ccb0c)});}}}emlformat['build'](_0x3c75f3,function(_0x108434,_0x40e235){if(_0x108434)return _0x7c6d7a(_0x108434);fs[_0xb418('0x93')](path[_0xb418('0x54')](_0x220006,_0x22a5f9),_0x40e235);return _0x151f43(_0x40e235);});});}})[_0xb418('0x12')](function(_0x47b574){if(_0x47b574){return _0x18e24f['download'](path[_0xb418('0x54')](_0x220006,_0x22a5f9),_0x22a5f9,function(_0xcc51d5){if(!_0xcc51d5)fs[_0xb418('0x94')](path[_0xb418('0x54')](_0x220006,_0x22a5f9));});}})[_0xb418('0x1c')](handleError(_0x18e24f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 58ca972..bddfa89 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 _0x6073=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x2d2d2b,_0x39c574){var _0x26eb10=function(_0x420a4c){while(--_0x420a4c){_0x2d2d2b['push'](_0x2d2d2b['shift']());}};_0x26eb10(++_0x39c574);}(_0x6073,0x1be));var _0x3607=function(_0x5f37d2,_0x11b1a6){_0x5f37d2=_0x5f37d2-0x0;var _0x305258=_0x6073[_0x5f37d2];return _0x305258;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x3607('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3607('0x1')](0x0);var events={'afterCreate':_0x3607('0x2'),'afterUpdate':_0x3607('0x3'),'afterDestroy':_0x3607('0x4')};function emitEvent(_0x960a5b){return function(_0x124ecb,_0x1e01ac,_0x464496){MailMessageEvents['emit'](_0x960a5b+':'+_0x124ecb['id'],_0x124ecb);MailMessageEvents[_0x3607('0x5')](_0x960a5b,_0x124ecb);_0x464496(null);};}for(var e in events){if(events[_0x3607('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3607('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x9228=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x25402e,_0x1ab8f2){var _0x168dbb=function(_0x440845){while(--_0x440845){_0x25402e['push'](_0x25402e['shift']());}};_0x168dbb(++_0x1ab8f2);}(_0x9228,0x12d));var _0x8922=function(_0x29ebe1,_0x1d717f){_0x29ebe1=_0x29ebe1-0x0;var _0x57ebce=_0x9228[_0x29ebe1];return _0x57ebce;};'use strict';var EventEmitter=require(_0x8922('0x0'));var MailMessage=require(_0x8922('0x1'))['db'][_0x8922('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8922('0x3')](0x0);var events={'afterCreate':_0x8922('0x4'),'afterUpdate':_0x8922('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b8367){return function(_0x54770f,_0x40bf75,_0x54e1cf){MailMessageEvents['emit'](_0x5b8367+':'+_0x54770f['id'],_0x54770f);MailMessageEvents[_0x8922('0x6')](_0x5b8367,_0x54770f);_0x54e1cf(null);};}for(var e in events){if(events[_0x8922('0x7')](e)){var event=events[e];MailMessage[_0x8922('0x8')](e,emitEvent(event));}}module[_0x8922('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 21f764c..b9c9f30 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 _0x2251=['api','moment','bluebird','request-promise','html-to-text','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x5c4817,_0x22de47){var _0x5d0287=function(_0x2c39f9){while(--_0x2c39f9){_0x5c4817['push'](_0x5c4817['shift']());}};_0x5d0287(++_0x22de47);}(_0x2251,0xe5));var _0x1225=function(_0x56b15b,_0x301bf5){_0x56b15b=_0x56b15b-0x0;var _0x2e9f5a=_0x2251[_0x56b15b];return _0x2e9f5a;};'use strict';var _=require('lodash');var util=require(_0x1225('0x0'));var logger=require(_0x1225('0x1'))(_0x1225('0x2'));var moment=require(_0x1225('0x3'));var BPromise=require(_0x1225('0x4'));var rp=require(_0x1225('0x5'));var htmlToText=require(_0x1225('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0x1225('0x7')]=function(_0x4c093f,_0x27737b){return _0x4c093f[_0x1225('0x8')](_0x1225('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1225('0xa'),'fields':[_0x1225('0xa')]},{'name':_0x1225('0xb'),'fields':[_0x1225('0xc'),_0x1225('0xd')],'type':_0x1225('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3dd3a8,_0x235390,_0x6d79df){if(_0x3dd3a8[_0x1225('0xf')]){_0x3dd3a8[_0x1225('0xc')]=htmlToText[_0x1225('0x10')](_0x3dd3a8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x6d79df(null,_0x235390);},'afterCreate':function(_0x4cf32a,_0x3b1405,_0x5d7131){var _0x3a4555=_0x4c093f[_0x1225('0x11')];var _0x17fc7f=_0x4cf32a[_0x1225('0x12')]({'plain':!![]});if(_0x17fc7f[_0x1225('0x13')][_0x1225('0x14')]()==='in'||_0x17fc7f[_0x1225('0x13')]['toLowerCase']()===_0x1225('0x15')&&!_0x17fc7f[_0x1225('0x16')]&&!_[_0x1225('0x17')](_0x17fc7f[_0x1225('0x18')])){_0x3a4555[_0x1225('0x19')]['findOne']({'where':{'id':_0x17fc7f[_0x1225('0x1a')]}})[_0x1225('0x1b')](function(_0x570ddd){if(_0x570ddd){_0x570ddd[_0x1225('0x1c')]({'lastMsgAt':_0x17fc7f['createdAt'],'lastMsgDirection':_0x17fc7f['direction'][_0x1225('0x14')]()});}})[_0x1225('0x1d')](function(_0x286865){console[_0x1225('0x1e')](_0x286865);});}_0x5d7131();}},'charset':_0x1225('0x1f'),'collate':_0x1225('0x20')});}; \ No newline at end of file +var _0x80ec=['direction','toLowerCase','out','secret','findOne','MailInteractionId','then','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','plainBody','fromString','body','models','get'];(function(_0x28a4fb,_0x8a068b){var _0x5566a5=function(_0x4b074d){while(--_0x4b074d){_0x28a4fb['push'](_0x28a4fb['shift']());}};_0x5566a5(++_0x8a068b);}(_0x80ec,0x1b8));var _0xc80e=function(_0x11da82,_0x1ce8a0){_0x11da82=_0x11da82-0x0;var _0x4d918d=_0x80ec[_0x11da82];return _0x4d918d;};'use strict';var _=require(_0xc80e('0x0'));var util=require(_0xc80e('0x1'));var logger=require(_0xc80e('0x2'))(_0xc80e('0x3'));var moment=require('moment');var BPromise=require(_0xc80e('0x4'));var rp=require('request-promise');var htmlToText=require(_0xc80e('0x5'));var fs=require('fs');var path=require(_0xc80e('0x6'));var rimraf=require(_0xc80e('0x7'));var config=require(_0xc80e('0x8'));var attributes=require(_0xc80e('0x9'));module[_0xc80e('0xa')]=function(_0x43af60,_0xfe66f3){return _0x43af60[_0xc80e('0xb')](_0xc80e('0xc'),attributes,{'tableName':_0xc80e('0xd'),'paranoid':![],'indexes':[{'name':_0xc80e('0xe'),'fields':[_0xc80e('0xe')]},{'name':_0xc80e('0xf'),'fields':['plainBody',_0xc80e('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3e3828,_0x457973,_0x542f65){if(_0x3e3828['body']){_0x3e3828[_0xc80e('0x11')]=htmlToText[_0xc80e('0x12')](_0x3e3828[_0xc80e('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x542f65(null,_0x457973);},'afterCreate':function(_0x2bbea2,_0x37e96a,_0x4b527b){var _0x4db8b5=_0x43af60[_0xc80e('0x14')];var _0x41283f=_0x2bbea2[_0xc80e('0x15')]({'plain':!![]});if(_0x41283f[_0xc80e('0x16')][_0xc80e('0x17')]()==='in'||_0x41283f[_0xc80e('0x16')][_0xc80e('0x17')]()===_0xc80e('0x18')&&!_0x41283f[_0xc80e('0x19')]&&!_['isNil'](_0x41283f['UserId'])){_0x4db8b5['MailInteraction'][_0xc80e('0x1a')]({'where':{'id':_0x41283f[_0xc80e('0x1b')]}})[_0xc80e('0x1c')](function(_0x20cce4){if(_0x20cce4){_0x20cce4[_0xc80e('0x1d')]({'lastMsgAt':_0x41283f['createdAt'],'lastMsgDirection':_0x41283f[_0xc80e('0x16')][_0xc80e('0x17')]()});}})['catch'](function(_0x45c08f){console[_0xc80e('0x1e')](_0x45c08f);});}_0x4b527b();}},'charset':_0xc80e('0x1f'),'collate':_0xc80e('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d1938af..8d1289d 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 _0xb44a=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register'];(function(_0x65a475,_0x37515f){var _0x949454=function(_0x2b198b){while(--_0x2b198b){_0x65a475['push'](_0x65a475['shift']());}};_0x949454(++_0x37515f);}(_0xb44a,0x1c2));var _0xab44=function(_0x3a3afe,_0x15da25){_0x3a3afe=_0x3a3afe-0x0;var _0x262dab=_0xb44a[_0x3a3afe];return _0x262dab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});config[_0xab44('0x8')]=_[_0xab44('0x9')](config[_0xab44('0x8')],{'host':_0xab44('0xa'),'port':0x18eb});var socket=require(_0xab44('0xb'))(new Redis(config[_0xab44('0x8')]));require(_0xab44('0xc'))[_0xab44('0xd')](socket);function respondWithRpcPromise(_0x55c7d2,_0x2a670e,_0x500a9f){return new BPromise(function(_0x15e64e,_0x5168fa){return client['request'](_0x55c7d2,_0x500a9f)[_0xab44('0xe')](function(_0x6746cc){logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));logger[_0xab44('0x12')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a670e,'request\x20sent',JSON[_0xab44('0x13')](_0x6746cc));if(_0x6746cc['error']){if(_0x6746cc[_0xab44('0x14')]['code']===0x1f4){logger[_0xab44('0x14')](_0xab44('0x10'),_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x5168fa(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2a670e,_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);return _0x15e64e(_0x6746cc[_0xab44('0x14')][_0xab44('0x15')]);}else{logger[_0xab44('0xf')](_0xab44('0x10'),_0x2a670e,_0xab44('0x11'));_0x15e64e(_0x6746cc[_0xab44('0x16')][_0xab44('0x15')]);}})[_0xab44('0x17')](function(_0x27fc7f){logger['error'](_0xab44('0x10'),_0x2a670e,_0x27fc7f);_0x5168fa(_0x27fc7f);});});}exports[_0xab44('0x18')]=function(_0x101a1b){var _0x2902ca=this;return new Promise(function(_0x29bb73,_0x5123b1){return db[_0xab44('0x19')]['create'](_0x101a1b[_0xab44('0x1a')],{'raw':_0x101a1b[_0xab44('0x1b')]?_0x101a1b[_0xab44('0x1b')][_0xab44('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3a2b1d){logger[_0xab44('0xf')](_0xab44('0x18'),_0x101a1b);logger[_0xab44('0x12')](_0xab44('0x18'),_0x101a1b,JSON[_0xab44('0x13')](_0x3a2b1d));_0x29bb73(_0x3a2b1d);})[_0xab44('0x17')](function(_0x554955){logger['error'](_0xab44('0x18'),_0x554955['message'],_0x101a1b);_0x5123b1(_0x2902ca[_0xab44('0x14')](0x1f4,_0x554955['message']));});});}; \ No newline at end of file +var _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x470670,_0x592836){var _0x34e9a5=function(_0x5e7cb9){while(--_0x5e7cb9){_0x470670['push'](_0x470670['shift']());}};_0x34e9a5(++_0x592836);}(_0xfff0,0x139));var _0x0fff=function(_0xc9056e,_0x4dca65){_0xc9056e=_0xc9056e-0x0;var _0x3526d1=_0xfff0[_0xc9056e];return _0x3526d1;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index f5f8f64..fa86237 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 _0x28a2=['save','remove','update','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x228a('0x0'));var events=[_0x228a('0x1'),_0x228a('0x2'),_0x228a('0x3')];function createListener(_0x466ef9,_0x41d4aa){return function(_0xfc342a){_0x41d4aa['emit'](_0x466ef9,_0xfc342a);};}function removeListener(_0x6efce7,_0x51e9e9){return function(){MailMessageEvents[_0x228a('0x4')](_0x6efce7,_0x51e9e9);};}exports[_0x228a('0x5')]=function(_0x17727b){for(var _0xf86d1d=0x0,_0x100a6a=events['length'];_0xf86d1d<_0x100a6a;_0xf86d1d++){var _0x270d15=events[_0xf86d1d];var _0x7767ab=createListener(_0x228a('0x6')+_0x270d15,_0x17727b);MailMessageEvents['on'](_0x270d15,_0x7767ab);}}; \ No newline at end of file +var _0xd2d7=['./mailMessage.events','update','emit','removeListener'];(function(_0x3bceea,_0x58af75){var _0x30a8d3=function(_0x1550b5){while(--_0x1550b5){_0x3bceea['push'](_0x3bceea['shift']());}};_0x30a8d3(++_0x58af75);}(_0xd2d7,0x1dc));var _0x7d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d7[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require(_0x7d2d('0x0'));var events=['save','remove',_0x7d2d('0x1')];function createListener(_0x487628,_0xa592a7){return function(_0x59f776){_0xa592a7[_0x7d2d('0x2')](_0x487628,_0x59f776);};}function removeListener(_0x12fbcd,_0x24770c){return function(){MailMessageEvents[_0x7d2d('0x3')](_0x12fbcd,_0x24770c);};}exports['register']=function(_0x14e3ed){for(var _0x97daf6=0x0,_0xe2e05f=events['length'];_0x97daf6<_0xe2e05f;_0x97daf6++){var _0x2715d4=events[_0x97daf6];var _0x40b958=createListener('mailMessage:'+_0x2715d4,_0x14e3ed);MailMessageEvents['on'](_0x2715d4,_0x40b958);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 32809f0..9296c7e 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 _0x2a74=['getMembers','/:id/teams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members'];(function(_0x219f54,_0x243919){var _0x1467b2=function(_0x2861e3){while(--_0x2861e3){_0x219f54['push'](_0x219f54['shift']());}};_0x1467b2(++_0x243919);}(_0x2a74,0xeb));var _0x42a7=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x2a74[_0x22431e];return _0xd978e9;};'use strict';var multer=require(_0x42a7('0x0'));var util=require(_0x42a7('0x1'));var path=require(_0x42a7('0x2'));var timeout=require(_0x42a7('0x3'));var express=require(_0x42a7('0x4'));var router=express[_0x42a7('0x5')]();var fs_extra=require(_0x42a7('0x6'));var auth=require(_0x42a7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x42a7('0x8'));var controller=require(_0x42a7('0x9'));router[_0x42a7('0xa')]('/',auth[_0x42a7('0xb')](),controller[_0x42a7('0xc')]);router[_0x42a7('0xa')]('/describe',auth[_0x42a7('0xb')](),controller[_0x42a7('0xd')]);router[_0x42a7('0xa')](_0x42a7('0xe'),auth['isAuthenticated'](),controller[_0x42a7('0xf')]);router[_0x42a7('0xa')](_0x42a7('0x10'),auth[_0x42a7('0xb')](),controller[_0x42a7('0x11')]);router[_0x42a7('0xa')](_0x42a7('0x12'),auth[_0x42a7('0xb')](),controller['getTeams']);router[_0x42a7('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x42a7('0x13')]);router[_0x42a7('0x14')]('/',auth[_0x42a7('0xb')](),controller['create']);router[_0x42a7('0x14')](_0x42a7('0x12'),auth[_0x42a7('0xb')](),controller[_0x42a7('0x15')]);router[_0x42a7('0x14')](_0x42a7('0x16'),auth['isAuthenticated'](),controller[_0x42a7('0x17')]);router['put'](_0x42a7('0xe'),auth[_0x42a7('0xb')](),controller[_0x42a7('0x18')]);router[_0x42a7('0x19')]('/:id',auth[_0x42a7('0xb')](),controller[_0x42a7('0x1a')]);router[_0x42a7('0x19')]('/:id/teams',auth[_0x42a7('0xb')](),controller[_0x42a7('0x1b')]);router[_0x42a7('0x19')]('/:id/users',auth[_0x42a7('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x1aed=['post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x2494e4,_0x1beafa){var _0x5025a3=function(_0x48af77){while(--_0x48af77){_0x2494e4['push'](_0x2494e4['shift']());}};_0x5025a3(++_0x1beafa);}(_0x1aed,0xb9));var _0xd1ae=function(_0x351049,_0x3a7898){_0x351049=_0x351049-0x0;var _0x4e0772=_0x1aed[_0x351049];return _0x4e0772;};'use strict';var multer=require(_0xd1ae('0x0'));var util=require(_0xd1ae('0x1'));var path=require('path');var timeout=require(_0xd1ae('0x2'));var express=require(_0xd1ae('0x3'));var router=express[_0xd1ae('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd1ae('0x5'));var interaction=require(_0xd1ae('0x6'));var config=require('../../config/environment');var controller=require(_0xd1ae('0x7'));router['get']('/',auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x9')]);router[_0xd1ae('0xa')](_0xd1ae('0xb'),auth['isAuthenticated'](),controller[_0xd1ae('0xc')]);router['get']('/:id',auth[_0xd1ae('0x8')](),controller['show']);router[_0xd1ae('0xa')](_0xd1ae('0xd'),auth[_0xd1ae('0x8')](),controller[_0xd1ae('0xe')]);router[_0xd1ae('0xa')](_0xd1ae('0xf'),auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x10')]);router['get'](_0xd1ae('0x11'),auth[_0xd1ae('0x8')](),controller['getAgents']);router[_0xd1ae('0x12')]('/',auth['isAuthenticated'](),controller[_0xd1ae('0x13')]);router[_0xd1ae('0x12')](_0xd1ae('0xf'),auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x14')]);router['post'](_0xd1ae('0x11'),auth['isAuthenticated'](),controller[_0xd1ae('0x15')]);router[_0xd1ae('0x16')](_0xd1ae('0x17'),auth['isAuthenticated'](),controller[_0xd1ae('0x18')]);router[_0xd1ae('0x19')]('/:id',auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x1a')]);router['delete'](_0xd1ae('0xf'),auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x1b')]);router[_0xd1ae('0x19')](_0xd1ae('0x11'),auth[_0xd1ae('0x8')](),controller[_0xd1ae('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index d02c42c..8ea9123 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 _0x0a08=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xcd26a9,_0x512e77){var _0x3afcbc=function(_0x40e770){while(--_0x40e770){_0xcd26a9['push'](_0xcd26a9['shift']());}};_0x3afcbc(++_0x512e77);}(_0x0a08,0x9b));var _0x80a0=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x0a08[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x80a0('0x0'));module[_0x80a0('0x1')]={'name':{'type':Sequelize[_0x80a0('0x2')],'unique':_0x80a0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x80a0('0x2')]},'timeout':{'type':Sequelize[_0x80a0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x80a0('0x5')](_0x80a0('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x919a=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x919a,0x1a2));var _0xa919=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x919a[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xa919('0x0'));module[_0xa919('0x1')]={'name':{'type':Sequelize[_0xa919('0x2')],'unique':_0xa919('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa919('0x2')]},'timeout':{'type':Sequelize[_0xa919('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa919('0x5')](_0xa919('0x6'),_0xa919('0x7'),_0xa919('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 71e2c9f..fca3093 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 _0x5a8c=['User','UserId','agent','mailPause','updatedAt','createdAt','count','format','%s/%s','SIP','getTeams','findOne','Team','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','ids','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId'];(function(_0x1a3ca9,_0xd141a9){var _0x5a2d2c=function(_0x3ba5fe){while(--_0x3ba5fe){_0x1a3ca9['push'](_0x1a3ca9['shift']());}};_0x5a2d2c(++_0xd141a9);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x5dabdb,_0x5bbc49){_0x5dabdb=_0x5dabdb-0x0;var _0x10744b=_0x5a8c[_0x5dabdb];return _0x10744b;};'use strict';var emlformat=require(_0xc5a8('0x0'));var rimraf=require(_0xc5a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc5a8('0x2'));var rp=require(_0xc5a8('0x3'));var moment=require(_0xc5a8('0x4'));var BPromise=require(_0xc5a8('0x5'));var Mustache=require('mustache');var util=require(_0xc5a8('0x6'));var path=require(_0xc5a8('0x7'));var sox=require('sox');var csv=require(_0xc5a8('0x8'));var ejs=require(_0xc5a8('0x9'));var fs=require('fs');var fs_extra=require(_0xc5a8('0xa'));var _=require(_0xc5a8('0xb'));var squel=require(_0xc5a8('0xc'));var crypto=require(_0xc5a8('0xd'));var jsforce=require(_0xc5a8('0xe'));var deskjs=require(_0xc5a8('0xf'));var toCsv=require(_0xc5a8('0x8'));var querystring=require(_0xc5a8('0x10'));var Papa=require(_0xc5a8('0x11'));var Redis=require('ioredis');var authService=require(_0xc5a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc5a8('0x13'));var hardwareService=require(_0xc5a8('0x14'));var logger=require(_0xc5a8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc5a8('0x16'));var licenseUtil=require(_0xc5a8('0x17'));var db=require(_0xc5a8('0x18'))['db'];config[_0xc5a8('0x19')]=_[_0xc5a8('0x1a')](config['redis'],{'host':_0xc5a8('0x1b'),'port':0x18eb});var socket=require(_0xc5a8('0x1c'))(new Redis(config[_0xc5a8('0x19')]));require(_0xc5a8('0x1d'))[_0xc5a8('0x1e')](socket);function respondWithStatusCode(_0x219823,_0x365df5){_0x365df5=_0x365df5||0xcc;return function(_0x26d87c){if(_0x26d87c){return _0x219823[_0xc5a8('0x1f')](_0x365df5);}return _0x219823[_0xc5a8('0x20')](_0x365df5)[_0xc5a8('0x21')]();};}function respondWithResult(_0x443376,_0x393e1c){_0x393e1c=_0x393e1c||0xc8;return function(_0x1cb591){if(_0x1cb591){return _0x443376[_0xc5a8('0x20')](_0x393e1c)[_0xc5a8('0x22')](_0x1cb591);}};}function respondWithFilteredResult(_0x22b230,_0x2fb8eb){return function(_0x506c10){if(_0x506c10){var _0x134589=typeof _0x2fb8eb[_0xc5a8('0x23')]===_0xc5a8('0x24')&&typeof _0x2fb8eb[_0xc5a8('0x25')]==='undefined';var _0x326baf=_0x506c10['count'];var _0x36cc16=_0x134589?0x0:_0x2fb8eb[_0xc5a8('0x23')];var _0x35ac5a=_0x134589?_0x506c10['count']:_0x2fb8eb['offset']+_0x2fb8eb['limit'];var _0x332ee2;if(_0x35ac5a>=_0x326baf){_0x35ac5a=_0x326baf;_0x332ee2=0xc8;}else{_0x332ee2=0xce;}_0x22b230[_0xc5a8('0x20')](_0x332ee2);return _0x22b230[_0xc5a8('0x26')](_0xc5a8('0x27'),_0x36cc16+'-'+_0x35ac5a+'/'+_0x326baf)['json'](_0x506c10);}return null;};}function patchUpdates(_0x1a8662){return function(_0x8b6473){try{jsonpatch[_0xc5a8('0x28')](_0x8b6473,_0x1a8662,!![]);}catch(_0x36d2c6){return BPromise['reject'](_0x36d2c6);}return _0x8b6473[_0xc5a8('0x29')]();};}function saveUpdates(_0x4865dd,_0x25e56d){return function(_0x4616ec){if(_0x4616ec){return _0x4616ec[_0xc5a8('0x2a')](_0x4865dd)[_0xc5a8('0x2b')](function(_0x5c8705){return _0x5c8705;});}return null;};}function removeEntity(_0x3448c1,_0x459694){return function(_0x208333){if(_0x208333){return _0x208333[_0xc5a8('0x2c')]()[_0xc5a8('0x2b')](function(){var _0x1a49ad=_0x208333[_0xc5a8('0x2d')]({'plain':!![]});var _0x165ee0='MailQueues';return db[_0xc5a8('0x2e')]['destroy']({'where':{'type':_0x165ee0,'resourceId':_0x1a49ad['id']}})[_0xc5a8('0x2b')](function(){return _0x208333;});})['then'](function(){_0x3448c1[_0xc5a8('0x20')](0xcc)[_0xc5a8('0x21')]();});}};}function handleEntityNotFound(_0x505b27,_0x10569a){return function(_0x2aa6d6){if(!_0x2aa6d6){_0x505b27[_0xc5a8('0x1f')](0x194);}return _0x2aa6d6;};}function handleError(_0x2102c7,_0xa7f8f2){_0xa7f8f2=_0xa7f8f2||0x1f4;return function(_0x2d7fae){logger[_0xc5a8('0x2f')](_0x2d7fae[_0xc5a8('0x30')]);if(_0x2d7fae[_0xc5a8('0x31')]){delete _0x2d7fae[_0xc5a8('0x31')];}_0x2102c7[_0xc5a8('0x20')](_0xa7f8f2)[_0xc5a8('0x32')](_0x2d7fae);};}exports[_0xc5a8('0x33')]=function(_0x3c1b7c,_0x434d67){var _0x25ebbd={},_0x702dba={},_0x11a820={'count':0x0,'rows':[]};var _0x450e89=_[_0xc5a8('0x34')](db[_0xc5a8('0x35')][_0xc5a8('0x36')],function(_0x2906f4){return{'name':_0x2906f4['fieldName'],'type':_0x2906f4['type'][_0xc5a8('0x37')]};});_0x702dba[_0xc5a8('0x38')]=_[_0xc5a8('0x34')](_0x450e89,'name');_0x702dba[_0xc5a8('0x39')]=_[_0xc5a8('0x3a')](_0x3c1b7c[_0xc5a8('0x39')]);_0x702dba[_0xc5a8('0x3b')]=_['intersection'](_0x702dba['model'],_0x702dba['query']);_0x25ebbd[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x702dba[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x3c1b7c[_0xc5a8('0x39')]['fields']));_0x25ebbd[_0xc5a8('0x3c')]=_0x25ebbd[_0xc5a8('0x3c')]['length']?_0x25ebbd[_0xc5a8('0x3c')]:_0x702dba['model'];if(!_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x3f')](_0xc5a8('0x40'))){_0x25ebbd[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x3c1b7c[_0xc5a8('0x39')]['limit']);_0x25ebbd[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x23')]);}_0x25ebbd[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x3c1b7c[_0xc5a8('0x39')][_0xc5a8('0x42')]);_0x25ebbd['where']=qs[_0xc5a8('0x3b')](_[_0xc5a8('0x43')](_0x3c1b7c[_0xc5a8('0x39')],_0x702dba[_0xc5a8('0x3b')]),_0x450e89);if(_0x3c1b7c['query'][_0xc5a8('0x44')]){_0x25ebbd['where']=_[_0xc5a8('0x45')](_0x25ebbd[_0xc5a8('0x46')],{'$or':_[_0xc5a8('0x34')](_0x450e89,function(_0x521f76){if(_0x521f76[_0xc5a8('0x47')]!==_0xc5a8('0x48')){var _0x1a8423={};_0x1a8423[_0x521f76['name']]={'$like':'%'+_0x3c1b7c['query']['filter']+'%'};return _0x1a8423;}})});}_0x25ebbd=_[_0xc5a8('0x45')]({},_0x25ebbd,_0x3c1b7c[_0xc5a8('0x49')]);var _0xfa8f3b={'where':_0x25ebbd['where']};return db[_0xc5a8('0x35')]['count'](_0xfa8f3b)['then'](function(_0x5b2284){_0x11a820['count']=_0x5b2284;if(_0x3c1b7c['query']['includeAll']){_0x25ebbd[_0xc5a8('0x4a')]=[{'all':!![]}];}return db[_0xc5a8('0x35')][_0xc5a8('0x4b')](_0x25ebbd);})[_0xc5a8('0x2b')](function(_0x922cc4){_0x11a820[_0xc5a8('0x4c')]=_0x922cc4;return _0x11a820;})[_0xc5a8('0x2b')](respondWithFilteredResult(_0x434d67,_0x25ebbd))[_0xc5a8('0x4d')](handleError(_0x434d67,null));};exports[_0xc5a8('0x4e')]=function(_0x4c5755,_0x1a16ef){var _0x3cd62f={'raw':!![],'where':{'id':_0x4c5755[_0xc5a8('0x4f')]['id']}},_0x18a655={};_0x18a655['model']=_[_0xc5a8('0x3a')](db[_0xc5a8('0x35')][_0xc5a8('0x36')]);_0x18a655[_0xc5a8('0x39')]=_['keys'](_0x4c5755['query']);_0x18a655[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x18a655[_0xc5a8('0x38')],_0x18a655['query']);_0x3cd62f[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x18a655[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x4c5755[_0xc5a8('0x39')]['fields']));_0x3cd62f[_0xc5a8('0x3c')]=_0x3cd62f['attributes'][_0xc5a8('0x50')]?_0x3cd62f[_0xc5a8('0x3c')]:_0x18a655['model'];if(_0x4c5755['query'][_0xc5a8('0x51')]){_0x3cd62f[_0xc5a8('0x4a')]=[{'all':!![]}];}_0x3cd62f=_['merge']({},_0x3cd62f,_0x4c5755['options']);return db[_0xc5a8('0x35')][_0xc5a8('0x52')](_0x3cd62f)[_0xc5a8('0x2b')](handleEntityNotFound(_0x1a16ef,null))[_0xc5a8('0x2b')](respondWithResult(_0x1a16ef,null))[_0xc5a8('0x4d')](handleError(_0x1a16ef,null));};exports[_0xc5a8('0x53')]=function(_0x594d7a,_0x534136){return db['MailQueue']['create'](_0x594d7a[_0xc5a8('0x54')],{})[_0xc5a8('0x2b')](function(_0x796f8a){var _0x4a930c=_0x594d7a['user'][_0xc5a8('0x2d')]({'plain':!![]});if(!_0x4a930c)throw new Error(_0xc5a8('0x55'));if(_0x4a930c['role']==='user'){var _0x65798f=_0x796f8a[_0xc5a8('0x2d')]({'plain':!![]});var _0xa227dd='MailQueues';return db[_0xc5a8('0x56')][_0xc5a8('0x52')]({'where':{'name':_0xa227dd,'userProfileId':_0x4a930c[_0xc5a8('0x57')]},'raw':!![]})[_0xc5a8('0x2b')](function(_0x3be874){if(_0x3be874&&_0x3be874[_0xc5a8('0x58')]===0x0){return db['UserProfileResource'][_0xc5a8('0x53')]({'name':_0x65798f[_0xc5a8('0x31')],'resourceId':_0x65798f['id'],'type':_0x3be874[_0xc5a8('0x31')],'sectionId':_0x3be874['id']},{})['then'](function(){return _0x796f8a;});}else{return _0x796f8a;}})[_0xc5a8('0x4d')](function(_0x86f7cc){logger[_0xc5a8('0x2f')](_0xc5a8('0x59'),_0x86f7cc);throw _0x86f7cc;});}return _0x796f8a;})[_0xc5a8('0x2b')](respondWithResult(_0x534136,0xc9))[_0xc5a8('0x4d')](handleError(_0x534136,null));};exports[_0xc5a8('0x2a')]=function(_0x2a8e77,_0x10250c){if(_0x2a8e77[_0xc5a8('0x54')]['id']){delete _0x2a8e77['body']['id'];}return db['MailQueue'][_0xc5a8('0x52')]({'where':{'id':_0x2a8e77[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x10250c,null))[_0xc5a8('0x2b')](saveUpdates(_0x2a8e77[_0xc5a8('0x54')],null))['then'](respondWithResult(_0x10250c,null))[_0xc5a8('0x4d')](handleError(_0x10250c,null));};exports[_0xc5a8('0x2c')]=function(_0x567f10,_0x15f177){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x567f10[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x15f177,null))[_0xc5a8('0x2b')](removeEntity(_0x15f177,null))[_0xc5a8('0x4d')](handleError(_0x15f177,null));};exports['describe']=function(_0x3ba2b1,_0x53b074){return db[_0xc5a8('0x35')][_0xc5a8('0x5a')]()[_0xc5a8('0x2b')](respondWithResult(_0x53b074,null))[_0xc5a8('0x4d')](handleError(_0x53b074,null));};exports[_0xc5a8('0x5b')]=function(_0x2570d6,_0x561985,_0x3a3986){var _0x1d911c={'raw':!![],'where':{}},_0x423b7e={},_0x22bfc3;return db['MailQueue']['findOne']({'where':{'id':_0x2570d6['params']['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x561985,null))['then'](function(_0x58c900){if(_0x58c900){_0x22bfc3=_0x58c900['get']({'plain':!![]});_0x423b7e[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x5c')][_0xc5a8('0x36')]);_0x423b7e['query']=_[_0xc5a8('0x3a')](_0x2570d6['query']);_0x423b7e[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x423b7e['model'],_0x423b7e[_0xc5a8('0x39')]);_0x1d911c[_0xc5a8('0x3c')]=_['intersection'](_0x423b7e[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x1d911c[_0xc5a8('0x3c')]=_0x1d911c[_0xc5a8('0x3c')][_0xc5a8('0x50')]?_0x1d911c[_0xc5a8('0x3c')]:_0x423b7e[_0xc5a8('0x38')];if(!_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x3f')](_0xc5a8('0x40'))){_0x1d911c[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x2570d6[_0xc5a8('0x39')]['limit']);_0x1d911c[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x2570d6['query'][_0xc5a8('0x23')]);}_0x1d911c[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x2570d6['query'][_0xc5a8('0x42')]);_0x1d911c['where']=qs['filters'](_['pick'](_0x2570d6[_0xc5a8('0x39')],_0x423b7e[_0xc5a8('0x3b')]));_0x1d911c[_0xc5a8('0x46')][_0xc5a8('0x5d')]=_0x58c900['id'];if(_0x2570d6[_0xc5a8('0x39')][_0xc5a8('0x44')]){_0x1d911c[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x1d911c['where'],{'$or':_[_0xc5a8('0x34')](_0x1d911c['attributes'],function(_0x3418b0){var _0x553463={};_0x553463[_0x3418b0]={'$like':'%'+_0x2570d6[_0xc5a8('0x39')]['filter']+'%'};return _0x553463;})});}_0x1d911c=_['merge']({},_0x1d911c,_0x2570d6[_0xc5a8('0x49')]);return db[_0xc5a8('0x5c')]['findAll'](_0x1d911c);}})['then'](function(_0x23a5aa){if(_0x23a5aa){return db[_0xc5a8('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x23a5aa,_0xc5a8('0x5f')),'role':_0xc5a8('0x60')},'attributes':['id',_0xc5a8('0x31'),_0xc5a8('0x61'),_0xc5a8('0x62'),_0xc5a8('0x63')]});}})[_0xc5a8('0x2b')](function(_0x1f7699){if(_0x1f7699){return{'count':_0x1f7699[_0xc5a8('0x64')],'rows':_['map'](_0x1f7699[_0xc5a8('0x4c')],function(_0x358b68){return{'membername':_0x358b68[_0xc5a8('0x31')],'UserId':_0x358b68['id'],'queue_name':_0x22bfc3[_0xc5a8('0x31')],'MailQueueId':_0x22bfc3['id'],'interface':util[_0xc5a8('0x65')](_0xc5a8('0x66'),_0xc5a8('0x67'),_0x358b68[_0xc5a8('0x31')]),'penalty':0x0,'paused':_0x358b68[_0xc5a8('0x61')],'createdAt':_0x358b68[_0xc5a8('0x63')],'updatedAt':_0x358b68['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x561985,_0x1d911c))[_0xc5a8('0x4d')](handleError(_0x561985,null));};exports[_0xc5a8('0x68')]=function(_0x374f7e,_0x5d3012,_0x25cbcb){var _0x3f5200={};var _0x3fd9d9={};var _0x5a4f99;var _0x510a99;return db[_0xc5a8('0x35')][_0xc5a8('0x69')]({'where':{'id':_0x374f7e[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x5d3012,null))['then'](function(_0x1edc2a){if(_0x1edc2a){_0x5a4f99=_0x1edc2a;_0x3fd9d9[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x6a')][_0xc5a8('0x36')]);_0x3fd9d9['query']=_[_0xc5a8('0x3a')](_0x374f7e[_0xc5a8('0x39')]);_0x3fd9d9[_0xc5a8('0x3b')]=_['intersection'](_0x3fd9d9['model'],_0x3fd9d9[_0xc5a8('0x39')]);_0x3f5200['attributes']=_[_0xc5a8('0x3d')](_0x3fd9d9[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x3f5200[_0xc5a8('0x3c')]=_0x3f5200[_0xc5a8('0x3c')]['length']?_0x3f5200[_0xc5a8('0x3c')]:_0x3fd9d9['model'];_0x3f5200[_0xc5a8('0x41')]=qs[_0xc5a8('0x42')](_0x374f7e[_0xc5a8('0x39')]['sort']);_0x3f5200[_0xc5a8('0x46')]=qs[_0xc5a8('0x3b')](_['pick'](_0x374f7e['query'],_0x3fd9d9[_0xc5a8('0x3b')]));if(_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x44')]){_0x3f5200[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x3f5200['where'],{'$or':_[_0xc5a8('0x34')](_0x3f5200[_0xc5a8('0x3c')],function(_0x465150){var _0x35708b={};_0x35708b[_0x465150]={'$like':'%'+_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x44')]+'%'};return _0x35708b;})});}_0x3f5200=_[_0xc5a8('0x45')]({},_0x3f5200,_0x374f7e[_0xc5a8('0x49')]);return _0x5a4f99[_0xc5a8('0x68')](_0x3f5200);}})[_0xc5a8('0x2b')](function(_0x470c9f){if(_0x470c9f){_0x510a99=_0x470c9f['length'];if(!_0x374f7e['query'][_0xc5a8('0x3f')]('nolimit')){_0x3f5200['limit']=qs[_0xc5a8('0x25')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x25')]);_0x3f5200[_0xc5a8('0x23')]=qs[_0xc5a8('0x23')](_0x374f7e[_0xc5a8('0x39')][_0xc5a8('0x23')]);}return _0x5a4f99[_0xc5a8('0x68')](_0x3f5200);}})[_0xc5a8('0x2b')](function(_0x350e34){if(_0x350e34){return _0x350e34?{'count':_0x510a99,'rows':_0x350e34}:null;}})[_0xc5a8('0x2b')](respondWithResult(_0x5d3012,null))[_0xc5a8('0x4d')](handleError(_0x5d3012,null));};exports['addTeams']=function(_0x2b6452,_0x58d1c2,_0x3d5c19){var _0x442da0=_0x2b6452[_0xc5a8('0x54')]['ids'];return db[_0xc5a8('0x6a')][_0xc5a8('0x4b')]({'where':{'id':_0x442da0},'attributes':['id'],'include':[{'model':db[_0xc5a8('0x5e')],'as':_0xc5a8('0x6b'),'attributes':['id',_0xc5a8('0x31'),_0xc5a8('0x6c'),_0xc5a8('0x6d'),'interface'],'raw':!![]}]})[_0xc5a8('0x2b')](function(_0x4c4a40){if(_0x4c4a40){var _0x451212=_[_0xc5a8('0x6e')](_0x4c4a40,function(_0x357879){var _0x583020=_0x357879[_0xc5a8('0x2d')]({'plain':!![]});return _0x583020[_0xc5a8('0x6b')];});return db[_0xc5a8('0x35')]['find']({'where':{'id':_0x2b6452['params']['id']}})['then'](function(_0x10d6b1){return db[_0xc5a8('0x6f')][_0xc5a8('0x70')](function(_0x4a4699){return _0x10d6b1[_0xc5a8('0x71')](_0x442da0,{'transaction':_0x4a4699})[_0xc5a8('0x2b')](function(){return BPromise[_0xc5a8('0x72')](_0x451212,function(_0x1b1e7c){return db[_0xc5a8('0x5c')][_0xc5a8('0x73')]({'where':{'UserId':_0x1b1e7c['id'],'MailQueueId':_0x2b6452[_0xc5a8('0x4f')]['id']},'transaction':_0x4a4699});});})[_0xc5a8('0x2b')](function(){_0x451212[_0xc5a8('0x74')](function(_0x2b552e){socket[_0xc5a8('0x75')](_0xc5a8('0x76'),{'UserId':_0x2b552e['id'],'MailQueueId':_0x10d6b1['id']});});});});});}})[_0xc5a8('0x2b')](respondWithStatusCode(_0x58d1c2,null))[_0xc5a8('0x4d')](handleError(_0x58d1c2,null));};exports[_0xc5a8('0x77')]=function(_0x496776,_0x1efa66,_0x8b52e9){return db[_0xc5a8('0x6a')][_0xc5a8('0x4b')]({'where':{'id':_0x496776[_0xc5a8('0x39')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc5a8('0x2b')](handleEntityNotFound(_0x1efa66,null))[_0xc5a8('0x2b')](function(_0x2df4c8){var _0x468285=_[_0xc5a8('0x34')](_0x2df4c8,'id');var _0x3eac0d=[];var _0x2569ba=[];var _0x115485=squel[_0xc5a8('0x78')]();_0x115485[_0xc5a8('0x79')](_0xc5a8('0x7a'))['from']('team_has_mail_queues','tq')['join'](_0xc5a8('0x7b'),'ut',_0xc5a8('0x7c'))[_0xc5a8('0x46')](_0xc5a8('0x7d'),_0x496776['params']['id']);for(var _0x3a967a=0x0;_0x3a967a<_0x2df4c8[_0xc5a8('0x50')];_0x3a967a+=0x1){let _0x5480ee=_0x2df4c8[_0x3a967a];for(var _0x5e4c82=0x0;_0x5e4c82<_0x5480ee['Agents'][_0xc5a8('0x50')];_0x5e4c82+=0x1){let _0x37f115=_0x5480ee[_0xc5a8('0x6b')][_0x5e4c82];var _0x26dd09=_0x115485[_0xc5a8('0x7e')]();_0x26dd09['where']('ut.UserId\x20=\x20?',_0x37f115['id']);_0x2569ba['push'](db['sequelize'][_0xc5a8('0x39')](_0x26dd09[_0xc5a8('0x7f')](),{'type':db[_0xc5a8('0x6f')][_0xc5a8('0x80')][_0xc5a8('0x81')]})[_0xc5a8('0x2b')](function(_0x347e89){if(_0x347e89[_0xc5a8('0x50')]===0x1){return _0x37f115['id'];}else{var _0x30101a=_['every'](_['map'](_0x347e89,'TeamId'),function(_0x49cb46){return _['includes'](_0x468285,_0x49cb46);});if(_0x30101a){return _0x37f115['id'];}}}));}}return BPromise[_0xc5a8('0x82')](_0x2569ba)[_0xc5a8('0x2b')](function(_0x236200){_0x3eac0d=_(_0x3eac0d)['union'](_0x236200)[_0xc5a8('0x83')]()[_0xc5a8('0x84')]();return db[_0xc5a8('0x35')]['find']({'where':{'id':_0x496776[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](function(_0x29c0fe){return db[_0xc5a8('0x6f')][_0xc5a8('0x70')](function(_0x2f8302){return _0x29c0fe['removeTeams'](_0x496776['query']['ids'],{'transaction':_0x2f8302})['then'](function(){if(!_[_0xc5a8('0x85')](_0x3eac0d)){return _0x29c0fe[_0xc5a8('0x86')](_0x3eac0d,{'transaction':_0x2f8302});}})[_0xc5a8('0x2b')](function(){_0x3eac0d['forEach'](function(_0x5b26a9){socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':_0x5b26a9,'MailQueueId':_0x29c0fe['id']});});});});});});})[_0xc5a8('0x2b')](respondWithStatusCode(_0x1efa66,null))['catch'](handleError(_0x1efa66,null));};exports['addAgents']=function(_0x1f7c09,_0x30bb1a,_0x4d868e){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x1f7c09[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x30bb1a,null))[_0xc5a8('0x2b')](function(_0x41e5f6){if(_0x41e5f6){return _0x41e5f6[_0xc5a8('0x88')](_0x1f7c09[_0xc5a8('0x54')][_0xc5a8('0x89')],_[_0xc5a8('0x8a')](_0x1f7c09[_0xc5a8('0x54')],[_0xc5a8('0x89'),'id'])||{})[_0xc5a8('0x8b')](function(_0x3e9645){for(var _0x49e87f=0x0;_0x49e87f<_0x1f7c09[_0xc5a8('0x54')]['ids'][_0xc5a8('0x50')];_0x49e87f+=0x1){socket[_0xc5a8('0x75')](_0xc5a8('0x76'),{'UserId':Number(_0x1f7c09[_0xc5a8('0x54')][_0xc5a8('0x89')][_0x49e87f]),'MailQueueId':Number(_0x1f7c09[_0xc5a8('0x4f')]['id'])});}return _0x3e9645;});}})[_0xc5a8('0x2b')](respondWithResult(_0x30bb1a,null))['catch'](handleError(_0x30bb1a,null));};exports['removeAgents']=function(_0x59a74f,_0x54b003,_0x5b8053){return db[_0xc5a8('0x35')][_0xc5a8('0x52')]({'where':{'id':_0x59a74f[_0xc5a8('0x4f')]['id']}})[_0xc5a8('0x2b')](handleEntityNotFound(_0x54b003,null))[_0xc5a8('0x2b')](function(_0x524016){if(_0x524016){return _0x524016[_0xc5a8('0x86')](_0x59a74f['query'][_0xc5a8('0x89')])[_0xc5a8('0x2b')](function(){if(_[_0xc5a8('0x8c')](_0x59a74f['query'][_0xc5a8('0x89')])){for(var _0x16c1a1=0x0;_0x16c1a1<_0x59a74f['query'][_0xc5a8('0x89')][_0xc5a8('0x50')];_0x16c1a1+=0x1){socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':Number(_0x59a74f[_0xc5a8('0x39')]['ids'][_0x16c1a1]),'MailQueueId':Number(_0x59a74f['params']['id'])});}}else{socket[_0xc5a8('0x75')](_0xc5a8('0x87'),{'UserId':Number(_0x59a74f[_0xc5a8('0x39')][_0xc5a8('0x89')]),'MailQueueId':Number(_0x59a74f[_0xc5a8('0x4f')]['id'])});}});}})[_0xc5a8('0x2b')](respondWithStatusCode(_0x54b003,null))[_0xc5a8('0x4d')](handleError(_0x54b003,null));};exports[_0xc5a8('0x8d')]=function(_0x47c50e,_0x693602,_0x4a85fa){var _0x5280e4={};var _0x378a26={};var _0x42fa60;var _0x3fa9ea;return db[_0xc5a8('0x35')][_0xc5a8('0x69')]({'where':{'id':_0x47c50e[_0xc5a8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x693602,null))[_0xc5a8('0x2b')](function(_0x537435){if(_0x537435){_0x42fa60=_0x537435;_0x378a26[_0xc5a8('0x38')]=_[_0xc5a8('0x3a')](db[_0xc5a8('0x5e')]['rawAttributes']);_0x378a26[_0xc5a8('0x39')]=_['keys'](_0x47c50e[_0xc5a8('0x39')]);_0x378a26[_0xc5a8('0x3b')]=_[_0xc5a8('0x3d')](_0x378a26[_0xc5a8('0x38')],_0x378a26[_0xc5a8('0x39')]);_0x5280e4[_0xc5a8('0x3c')]=_[_0xc5a8('0x3d')](_0x378a26[_0xc5a8('0x38')],qs[_0xc5a8('0x3e')](_0x47c50e[_0xc5a8('0x39')][_0xc5a8('0x3e')]));_0x5280e4['attributes']=_0x5280e4[_0xc5a8('0x3c')][_0xc5a8('0x50')]?_0x5280e4[_0xc5a8('0x3c')]:_0x378a26[_0xc5a8('0x38')];_0x5280e4['order']=qs[_0xc5a8('0x42')](_0x47c50e['query'][_0xc5a8('0x42')]);_0x5280e4[_0xc5a8('0x46')]=qs[_0xc5a8('0x3b')](_[_0xc5a8('0x43')](_0x47c50e[_0xc5a8('0x39')],_0x378a26[_0xc5a8('0x3b')]));if(_0x47c50e[_0xc5a8('0x39')]['filter']){_0x5280e4[_0xc5a8('0x46')]=_[_0xc5a8('0x45')](_0x5280e4['where'],{'$or':_[_0xc5a8('0x34')](_0x5280e4[_0xc5a8('0x3c')],function(_0x2dc6fe){var _0x1177bb={};_0x1177bb[_0x2dc6fe]={'$like':'%'+_0x47c50e[_0xc5a8('0x39')][_0xc5a8('0x44')]+'%'};return _0x1177bb;})});}_0x5280e4=_[_0xc5a8('0x45')]({},_0x5280e4,_0x47c50e[_0xc5a8('0x49')]);return _0x42fa60['getAgents'](_0x5280e4);}})[_0xc5a8('0x2b')](function(_0x3ab220){if(_0x3ab220){_0x3fa9ea=_0x3ab220['length'];if(!_0x47c50e[_0xc5a8('0x39')]['hasOwnProperty'](_0xc5a8('0x40'))){_0x5280e4[_0xc5a8('0x25')]=qs[_0xc5a8('0x25')](_0x47c50e['query'][_0xc5a8('0x25')]);_0x5280e4[_0xc5a8('0x23')]=qs['offset'](_0x47c50e['query'][_0xc5a8('0x23')]);}return _0x42fa60[_0xc5a8('0x8d')](_0x5280e4);}})[_0xc5a8('0x2b')](function(_0x3d5307){if(_0x3d5307){return _0x3d5307?{'count':_0x3fa9ea,'rows':_0x3d5307}:null;}})[_0xc5a8('0x2b')](respondWithResult(_0x693602,null))[_0xc5a8('0x4d')](handleError(_0x693602,null));}; \ No newline at end of file +var _0x88cc=['MailQueueId','filter','User','agent','mailPause','createdAt','format','updatedAt','getTeams','Team','ids','Agents','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','emit','removeTeams','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','destroy','then','get','MailQueues','UserProfileResource','error','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','MailQueue','includeAll','include','findAll','rows','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x88cc,0x1bd));var _0xc88c=function(_0x5abdfc,_0x385c27){_0x5abdfc=_0x5abdfc-0x0;var _0x124657=_0x88cc[_0x5abdfc];return _0x124657;};'use strict';var emlformat=require(_0xc88c('0x0'));var rimraf=require(_0xc88c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc88c('0x2'));var moment=require(_0xc88c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc88c('0x4'));var util=require(_0xc88c('0x5'));var path=require('path');var sox=require(_0xc88c('0x6'));var csv=require(_0xc88c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc88c('0x8'));var _=require(_0xc88c('0x9'));var squel=require('squel');var crypto=require(_0xc88c('0xa'));var jsforce=require(_0xc88c('0xb'));var deskjs=require(_0xc88c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc88c('0xd'));var Papa=require(_0xc88c('0xe'));var Redis=require(_0xc88c('0xf'));var authService=require(_0xc88c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc88c('0x11'));var logger=require(_0xc88c('0x12'))(_0xc88c('0x13'));var utils=require(_0xc88c('0x14'));var config=require(_0xc88c('0x15'));var licenseUtil=require(_0xc88c('0x16'));var db=require(_0xc88c('0x17'))['db'];config[_0xc88c('0x18')]=_[_0xc88c('0x19')](config['redis'],{'host':_0xc88c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc88c('0x18')]));require(_0xc88c('0x1b'))[_0xc88c('0x1c')](socket);function respondWithStatusCode(_0x2b6c9d,_0x2ba9d5){_0x2ba9d5=_0x2ba9d5||0xcc;return function(_0xbaa0e1){if(_0xbaa0e1){return _0x2b6c9d[_0xc88c('0x1d')](_0x2ba9d5);}return _0x2b6c9d[_0xc88c('0x1e')](_0x2ba9d5)[_0xc88c('0x1f')]();};}function respondWithResult(_0x2d7f87,_0x432c41){_0x432c41=_0x432c41||0xc8;return function(_0x181af7){if(_0x181af7){return _0x2d7f87[_0xc88c('0x1e')](_0x432c41)[_0xc88c('0x20')](_0x181af7);}};}function respondWithFilteredResult(_0x44ebc1,_0x434b76){return function(_0x346bed){if(_0x346bed){var _0x548a3a=typeof _0x434b76[_0xc88c('0x21')]===_0xc88c('0x22')&&typeof _0x434b76[_0xc88c('0x23')]===_0xc88c('0x22');var _0x106d86=_0x346bed[_0xc88c('0x24')];var _0xdd467d=_0x548a3a?0x0:_0x434b76[_0xc88c('0x21')];var _0x53d7b0=_0x548a3a?_0x346bed[_0xc88c('0x24')]:_0x434b76[_0xc88c('0x21')]+_0x434b76['limit'];var _0x63c7e6;if(_0x53d7b0>=_0x106d86){_0x53d7b0=_0x106d86;_0x63c7e6=0xc8;}else{_0x63c7e6=0xce;}_0x44ebc1[_0xc88c('0x1e')](_0x63c7e6);return _0x44ebc1['set'](_0xc88c('0x25'),_0xdd467d+'-'+_0x53d7b0+'/'+_0x106d86)[_0xc88c('0x20')](_0x346bed);}return null;};}function patchUpdates(_0x4abea4){return function(_0x7eb3c3){try{jsonpatch['apply'](_0x7eb3c3,_0x4abea4,!![]);}catch(_0x10651d){return BPromise[_0xc88c('0x26')](_0x10651d);}return _0x7eb3c3['save']();};}function saveUpdates(_0x693596,_0x1b3c51){return function(_0x54a46c){if(_0x54a46c){return _0x54a46c[_0xc88c('0x27')](_0x693596)['then'](function(_0xf7fb94){return _0xf7fb94;});}return null;};}function removeEntity(_0x31b1d7,_0x54d290){return function(_0x45cdd8){if(_0x45cdd8){return _0x45cdd8[_0xc88c('0x28')]()[_0xc88c('0x29')](function(){var _0x229da0=_0x45cdd8[_0xc88c('0x2a')]({'plain':!![]});var _0x3cb113=_0xc88c('0x2b');return db[_0xc88c('0x2c')][_0xc88c('0x28')]({'where':{'type':_0x3cb113,'resourceId':_0x229da0['id']}})['then'](function(){return _0x45cdd8;});})[_0xc88c('0x29')](function(){_0x31b1d7[_0xc88c('0x1e')](0xcc)[_0xc88c('0x1f')]();});}};}function handleEntityNotFound(_0x811f94,_0x19dfb9){return function(_0x536065){if(!_0x536065){_0x811f94['sendStatus'](0x194);}return _0x536065;};}function handleError(_0x4197b6,_0x331bee){_0x331bee=_0x331bee||0x1f4;return function(_0x4971fc){logger[_0xc88c('0x2d')](_0x4971fc['stack']);if(_0x4971fc['name']){delete _0x4971fc[_0xc88c('0x2e')];}_0x4197b6[_0xc88c('0x1e')](_0x331bee)[_0xc88c('0x2f')](_0x4971fc);};}exports[_0xc88c('0x30')]=function(_0x340ba0,_0x1d8134){var _0x495128={},_0x53fc62={},_0x3ba9b8={'count':0x0,'rows':[]};var _0x5c8cff=_[_0xc88c('0x31')](db['MailQueue'][_0xc88c('0x32')],function(_0x5038b3){return{'name':_0x5038b3['fieldName'],'type':_0x5038b3['type'][_0xc88c('0x33')]};});_0x53fc62[_0xc88c('0x34')]=_['map'](_0x5c8cff,'name');_0x53fc62[_0xc88c('0x35')]=_['keys'](_0x340ba0['query']);_0x53fc62[_0xc88c('0x36')]=_[_0xc88c('0x37')](_0x53fc62['model'],_0x53fc62[_0xc88c('0x35')]);_0x495128[_0xc88c('0x38')]=_[_0xc88c('0x37')](_0x53fc62[_0xc88c('0x34')],qs['fields'](_0x340ba0[_0xc88c('0x35')][_0xc88c('0x39')]));_0x495128[_0xc88c('0x38')]=_0x495128[_0xc88c('0x38')][_0xc88c('0x3a')]?_0x495128[_0xc88c('0x38')]:_0x53fc62[_0xc88c('0x34')];if(!_0x340ba0[_0xc88c('0x35')][_0xc88c('0x3b')](_0xc88c('0x3c'))){_0x495128['limit']=qs[_0xc88c('0x23')](_0x340ba0[_0xc88c('0x35')][_0xc88c('0x23')]);_0x495128[_0xc88c('0x21')]=qs[_0xc88c('0x21')](_0x340ba0[_0xc88c('0x35')][_0xc88c('0x21')]);}_0x495128[_0xc88c('0x3d')]=qs[_0xc88c('0x3e')](_0x340ba0[_0xc88c('0x35')][_0xc88c('0x3e')]);_0x495128[_0xc88c('0x3f')]=qs['filters'](_[_0xc88c('0x40')](_0x340ba0[_0xc88c('0x35')],_0x53fc62['filters']),_0x5c8cff);if(_0x340ba0[_0xc88c('0x35')]['filter']){_0x495128['where']=_[_0xc88c('0x41')](_0x495128[_0xc88c('0x3f')],{'$or':_[_0xc88c('0x31')](_0x5c8cff,function(_0x1a3117){if(_0x1a3117[_0xc88c('0x42')]!==_0xc88c('0x43')){var _0x420a54={};_0x420a54[_0x1a3117[_0xc88c('0x2e')]]={'$like':'%'+_0x340ba0[_0xc88c('0x35')]['filter']+'%'};return _0x420a54;}})});}_0x495128=_['merge']({},_0x495128,_0x340ba0[_0xc88c('0x44')]);var _0x2b1bc6={'where':_0x495128[_0xc88c('0x3f')]};return db[_0xc88c('0x45')]['count'](_0x2b1bc6)[_0xc88c('0x29')](function(_0x30b70b){_0x3ba9b8[_0xc88c('0x24')]=_0x30b70b;if(_0x340ba0[_0xc88c('0x35')][_0xc88c('0x46')]){_0x495128[_0xc88c('0x47')]=[{'all':!![]}];}return db['MailQueue'][_0xc88c('0x48')](_0x495128);})[_0xc88c('0x29')](function(_0x2abbc6){_0x3ba9b8[_0xc88c('0x49')]=_0x2abbc6;return _0x3ba9b8;})['then'](respondWithFilteredResult(_0x1d8134,_0x495128))['catch'](handleError(_0x1d8134,null));};exports[_0xc88c('0x4a')]=function(_0x23dd1c,_0x4b584f){var _0x2a81e4={'raw':!![],'where':{'id':_0x23dd1c['params']['id']}},_0x2a894e={};_0x2a894e['model']=_[_0xc88c('0x4b')](db['MailQueue']['rawAttributes']);_0x2a894e['query']=_[_0xc88c('0x4b')](_0x23dd1c['query']);_0x2a894e[_0xc88c('0x36')]=_[_0xc88c('0x37')](_0x2a894e[_0xc88c('0x34')],_0x2a894e[_0xc88c('0x35')]);_0x2a81e4[_0xc88c('0x38')]=_['intersection'](_0x2a894e[_0xc88c('0x34')],qs[_0xc88c('0x39')](_0x23dd1c[_0xc88c('0x35')]['fields']));_0x2a81e4['attributes']=_0x2a81e4[_0xc88c('0x38')]['length']?_0x2a81e4['attributes']:_0x2a894e['model'];if(_0x23dd1c['query'][_0xc88c('0x46')]){_0x2a81e4[_0xc88c('0x47')]=[{'all':!![]}];}_0x2a81e4=_['merge']({},_0x2a81e4,_0x23dd1c[_0xc88c('0x44')]);return db['MailQueue'][_0xc88c('0x4c')](_0x2a81e4)[_0xc88c('0x29')](handleEntityNotFound(_0x4b584f,null))[_0xc88c('0x29')](respondWithResult(_0x4b584f,null))[_0xc88c('0x4d')](handleError(_0x4b584f,null));};exports[_0xc88c('0x4e')]=function(_0x3db7b1,_0x4ea588){return db[_0xc88c('0x45')]['create'](_0x3db7b1[_0xc88c('0x4f')],{})[_0xc88c('0x29')](function(_0x5a426f){var _0x4fdb78=_0x3db7b1[_0xc88c('0x50')]['get']({'plain':!![]});if(!_0x4fdb78)throw new Error(_0xc88c('0x51'));if(_0x4fdb78['role']===_0xc88c('0x50')){var _0x52d83b=_0x5a426f[_0xc88c('0x2a')]({'plain':!![]});var _0x396522='MailQueues';return db[_0xc88c('0x52')][_0xc88c('0x4c')]({'where':{'name':_0x396522,'userProfileId':_0x4fdb78[_0xc88c('0x53')]},'raw':!![]})[_0xc88c('0x29')](function(_0x4643f4){if(_0x4643f4&&_0x4643f4[_0xc88c('0x54')]===0x0){return db[_0xc88c('0x2c')]['create']({'name':_0x52d83b[_0xc88c('0x2e')],'resourceId':_0x52d83b['id'],'type':_0x4643f4[_0xc88c('0x2e')],'sectionId':_0x4643f4['id']},{})[_0xc88c('0x29')](function(){return _0x5a426f;});}else{return _0x5a426f;}})['catch'](function(_0x45ab24){logger['error'](_0xc88c('0x55'),_0x45ab24);throw _0x45ab24;});}return _0x5a426f;})[_0xc88c('0x29')](respondWithResult(_0x4ea588,0xc9))[_0xc88c('0x4d')](handleError(_0x4ea588,null));};exports[_0xc88c('0x27')]=function(_0x2b0181,_0x440454){if(_0x2b0181[_0xc88c('0x4f')]['id']){delete _0x2b0181[_0xc88c('0x4f')]['id'];}return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x2b0181['params']['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x440454,null))[_0xc88c('0x29')](saveUpdates(_0x2b0181[_0xc88c('0x4f')],null))[_0xc88c('0x29')](respondWithResult(_0x440454,null))['catch'](handleError(_0x440454,null));};exports[_0xc88c('0x28')]=function(_0x5db593,_0x5138bb){return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x5db593[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x5138bb,null))[_0xc88c('0x29')](removeEntity(_0x5138bb,null))['catch'](handleError(_0x5138bb,null));};exports['describe']=function(_0x387786,_0x4e2ace){return db[_0xc88c('0x45')][_0xc88c('0x57')]()[_0xc88c('0x29')](respondWithResult(_0x4e2ace,null))[_0xc88c('0x4d')](handleError(_0x4e2ace,null));};exports[_0xc88c('0x58')]=function(_0x5a2b7b,_0x52f4ee,_0x4d9674){var _0x2ff746={'raw':!![],'where':{}},_0x255e7b={},_0x769512;return db[_0xc88c('0x45')][_0xc88c('0x59')]({'where':{'id':_0x5a2b7b[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x52f4ee,null))[_0xc88c('0x29')](function(_0x140299){if(_0x140299){_0x769512=_0x140299['get']({'plain':!![]});_0x255e7b[_0xc88c('0x34')]=_[_0xc88c('0x4b')](db[_0xc88c('0x5a')][_0xc88c('0x32')]);_0x255e7b[_0xc88c('0x35')]=_['keys'](_0x5a2b7b[_0xc88c('0x35')]);_0x255e7b[_0xc88c('0x36')]=_['intersection'](_0x255e7b['model'],_0x255e7b[_0xc88c('0x35')]);_0x2ff746[_0xc88c('0x38')]=_[_0xc88c('0x37')](_0x255e7b[_0xc88c('0x34')],qs[_0xc88c('0x39')](_0x5a2b7b[_0xc88c('0x35')][_0xc88c('0x39')]));_0x2ff746[_0xc88c('0x38')]=_0x2ff746[_0xc88c('0x38')][_0xc88c('0x3a')]?_0x2ff746[_0xc88c('0x38')]:_0x255e7b[_0xc88c('0x34')];if(!_0x5a2b7b[_0xc88c('0x35')]['hasOwnProperty'](_0xc88c('0x3c'))){_0x2ff746[_0xc88c('0x23')]=qs[_0xc88c('0x23')](_0x5a2b7b[_0xc88c('0x35')][_0xc88c('0x23')]);_0x2ff746['offset']=qs[_0xc88c('0x21')](_0x5a2b7b[_0xc88c('0x35')][_0xc88c('0x21')]);}_0x2ff746['order']=qs['sort'](_0x5a2b7b[_0xc88c('0x35')]['sort']);_0x2ff746[_0xc88c('0x3f')]=qs[_0xc88c('0x36')](_[_0xc88c('0x40')](_0x5a2b7b[_0xc88c('0x35')],_0x255e7b[_0xc88c('0x36')]));_0x2ff746[_0xc88c('0x3f')][_0xc88c('0x5b')]=_0x140299['id'];if(_0x5a2b7b['query'][_0xc88c('0x5c')]){_0x2ff746['where']=_[_0xc88c('0x41')](_0x2ff746[_0xc88c('0x3f')],{'$or':_[_0xc88c('0x31')](_0x2ff746[_0xc88c('0x38')],function(_0x3c7da7){var _0x4f1d60={};_0x4f1d60[_0x3c7da7]={'$like':'%'+_0x5a2b7b[_0xc88c('0x35')][_0xc88c('0x5c')]+'%'};return _0x4f1d60;})});}_0x2ff746=_[_0xc88c('0x41')]({},_0x2ff746,_0x5a2b7b['options']);return db[_0xc88c('0x5a')]['findAll'](_0x2ff746);}})['then'](function(_0x5071b5){if(_0x5071b5){return db[_0xc88c('0x5d')]['findAndCountAll']({'where':{'id':_[_0xc88c('0x31')](_0x5071b5,'UserId'),'role':_0xc88c('0x5e')},'attributes':['id',_0xc88c('0x2e'),_0xc88c('0x5f'),'updatedAt',_0xc88c('0x60')]});}})[_0xc88c('0x29')](function(_0x70f0b8){if(_0x70f0b8){return{'count':_0x70f0b8[_0xc88c('0x24')],'rows':_[_0xc88c('0x31')](_0x70f0b8[_0xc88c('0x49')],function(_0x4c56cb){return{'membername':_0x4c56cb[_0xc88c('0x2e')],'UserId':_0x4c56cb['id'],'queue_name':_0x769512['name'],'MailQueueId':_0x769512['id'],'interface':util[_0xc88c('0x61')]('%s/%s','SIP',_0x4c56cb['name']),'penalty':0x0,'paused':_0x4c56cb[_0xc88c('0x5f')],'createdAt':_0x4c56cb['createdAt'],'updatedAt':_0x4c56cb[_0xc88c('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc88c('0x29')](respondWithFilteredResult(_0x52f4ee,_0x2ff746))[_0xc88c('0x4d')](handleError(_0x52f4ee,null));};exports[_0xc88c('0x63')]=function(_0x175bdc,_0x449b6d,_0x41367e){var _0x2892ec={};var _0x426efe={};var _0x3243b2;var _0x479fa5;return db[_0xc88c('0x45')][_0xc88c('0x59')]({'where':{'id':_0x175bdc[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x449b6d,null))['then'](function(_0x141aba){if(_0x141aba){_0x3243b2=_0x141aba;_0x426efe['model']=_[_0xc88c('0x4b')](db[_0xc88c('0x64')]['rawAttributes']);_0x426efe[_0xc88c('0x35')]=_[_0xc88c('0x4b')](_0x175bdc[_0xc88c('0x35')]);_0x426efe['filters']=_[_0xc88c('0x37')](_0x426efe[_0xc88c('0x34')],_0x426efe['query']);_0x2892ec['attributes']=_[_0xc88c('0x37')](_0x426efe[_0xc88c('0x34')],qs[_0xc88c('0x39')](_0x175bdc[_0xc88c('0x35')]['fields']));_0x2892ec['attributes']=_0x2892ec[_0xc88c('0x38')][_0xc88c('0x3a')]?_0x2892ec[_0xc88c('0x38')]:_0x426efe[_0xc88c('0x34')];_0x2892ec['order']=qs[_0xc88c('0x3e')](_0x175bdc[_0xc88c('0x35')][_0xc88c('0x3e')]);_0x2892ec[_0xc88c('0x3f')]=qs['filters'](_[_0xc88c('0x40')](_0x175bdc['query'],_0x426efe[_0xc88c('0x36')]));if(_0x175bdc[_0xc88c('0x35')][_0xc88c('0x5c')]){_0x2892ec['where']=_[_0xc88c('0x41')](_0x2892ec[_0xc88c('0x3f')],{'$or':_['map'](_0x2892ec[_0xc88c('0x38')],function(_0x3ad15a){var _0x52fbec={};_0x52fbec[_0x3ad15a]={'$like':'%'+_0x175bdc[_0xc88c('0x35')][_0xc88c('0x5c')]+'%'};return _0x52fbec;})});}_0x2892ec=_[_0xc88c('0x41')]({},_0x2892ec,_0x175bdc[_0xc88c('0x44')]);return _0x3243b2['getTeams'](_0x2892ec);}})['then'](function(_0x42c35c){if(_0x42c35c){_0x479fa5=_0x42c35c[_0xc88c('0x3a')];if(!_0x175bdc[_0xc88c('0x35')]['hasOwnProperty'](_0xc88c('0x3c'))){_0x2892ec['limit']=qs[_0xc88c('0x23')](_0x175bdc['query'][_0xc88c('0x23')]);_0x2892ec[_0xc88c('0x21')]=qs[_0xc88c('0x21')](_0x175bdc[_0xc88c('0x35')][_0xc88c('0x21')]);}return _0x3243b2['getTeams'](_0x2892ec);}})[_0xc88c('0x29')](function(_0x271ba0){if(_0x271ba0){return _0x271ba0?{'count':_0x479fa5,'rows':_0x271ba0}:null;}})[_0xc88c('0x29')](respondWithResult(_0x449b6d,null))[_0xc88c('0x4d')](handleError(_0x449b6d,null));};exports['addTeams']=function(_0x2592ee,_0x287734,_0x115f56){var _0x4c4517=_0x2592ee['body'][_0xc88c('0x65')];return db[_0xc88c('0x64')]['findAll']({'where':{'id':_0x4c4517},'attributes':['id'],'include':[{'model':db[_0xc88c('0x5d')],'as':_0xc88c('0x66'),'attributes':['id',_0xc88c('0x2e'),'online',_0xc88c('0x67'),_0xc88c('0x68')],'raw':!![]}]})[_0xc88c('0x29')](function(_0x427266){if(_0x427266){var _0x21f67d=_['flatMap'](_0x427266,function(_0x2f0154){var _0x549f67=_0x2f0154['get']({'plain':!![]});return _0x549f67[_0xc88c('0x66')];});return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x2592ee['params']['id']}})[_0xc88c('0x29')](function(_0x2884cc){return db[_0xc88c('0x69')][_0xc88c('0x6a')](function(_0x436884){return _0x2884cc[_0xc88c('0x6b')](_0x4c4517,{'transaction':_0x436884})['then'](function(){return BPromise[_0xc88c('0x6c')](_0x21f67d,function(_0x2837be){return db['UserMailQueue'][_0xc88c('0x6d')]({'where':{'UserId':_0x2837be['id'],'MailQueueId':_0x2592ee[_0xc88c('0x56')]['id']},'transaction':_0x436884});});})[_0xc88c('0x29')](function(){_0x21f67d['forEach'](function(_0x57b68b){socket[_0xc88c('0x6e')]('userMailQueue:save',{'UserId':_0x57b68b['id'],'MailQueueId':_0x2884cc['id']});});});});});}})[_0xc88c('0x29')](respondWithStatusCode(_0x287734,null))[_0xc88c('0x4d')](handleError(_0x287734,null));};exports[_0xc88c('0x6f')]=function(_0x4760d3,_0x5d6c64,_0x3c4bb4){return db[_0xc88c('0x64')][_0xc88c('0x48')]({'where':{'id':_0x4760d3[_0xc88c('0x35')][_0xc88c('0x65')]},'attributes':['id'],'include':[{'model':db[_0xc88c('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc88c('0x29')](handleEntityNotFound(_0x5d6c64,null))['then'](function(_0x3134ce){var _0x250b69=_[_0xc88c('0x31')](_0x3134ce,'id');var _0x16199c=[];var _0x321ab3=[];var _0x1789ed=squel['select']();_0x1789ed[_0xc88c('0x70')](_0xc88c('0x71'))['from'](_0xc88c('0x72'),'tq')[_0xc88c('0x73')](_0xc88c('0x74'),'ut',_0xc88c('0x75'))[_0xc88c('0x3f')]('MailQueueId\x20=\x20?',_0x4760d3['params']['id']);for(var _0x4ddbd8=0x0;_0x4ddbd8<_0x3134ce['length'];_0x4ddbd8+=0x1){let _0xa3b76b=_0x3134ce[_0x4ddbd8];for(var _0x357ee8=0x0;_0x357ee8<_0xa3b76b[_0xc88c('0x66')][_0xc88c('0x3a')];_0x357ee8+=0x1){let _0x86bea3=_0xa3b76b['Agents'][_0x357ee8];var _0x2670c3=_0x1789ed['clone']();_0x2670c3[_0xc88c('0x3f')](_0xc88c('0x76'),_0x86bea3['id']);_0x321ab3['push'](db[_0xc88c('0x69')][_0xc88c('0x35')](_0x2670c3['toString'](),{'type':db['sequelize'][_0xc88c('0x77')][_0xc88c('0x78')]})[_0xc88c('0x29')](function(_0x20e70b){if(_0x20e70b[_0xc88c('0x3a')]===0x1){return _0x86bea3['id'];}else{var _0x145d34=_['every'](_['map'](_0x20e70b,_0xc88c('0x79')),function(_0x11f112){return _['includes'](_0x250b69,_0x11f112);});if(_0x145d34){return _0x86bea3['id'];}}}));}}return BPromise[_0xc88c('0x7a')](_0x321ab3)[_0xc88c('0x29')](function(_0x1db7ca){_0x16199c=_(_0x16199c)[_0xc88c('0x7b')](_0x1db7ca)[_0xc88c('0x7c')]()[_0xc88c('0x7d')]();return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x4760d3[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](function(_0x4d65e8){return db[_0xc88c('0x69')]['transaction'](function(_0x1f2554){return _0x4d65e8['removeTeams'](_0x4760d3[_0xc88c('0x35')][_0xc88c('0x65')],{'transaction':_0x1f2554})['then'](function(){if(!_[_0xc88c('0x7e')](_0x16199c)){return _0x4d65e8[_0xc88c('0x7f')](_0x16199c,{'transaction':_0x1f2554});}})['then'](function(){_0x16199c['forEach'](function(_0x119a93){socket[_0xc88c('0x6e')]('userMailQueue:remove',{'UserId':_0x119a93,'MailQueueId':_0x4d65e8['id']});});});});});});})[_0xc88c('0x29')](respondWithStatusCode(_0x5d6c64,null))[_0xc88c('0x4d')](handleError(_0x5d6c64,null));};exports[_0xc88c('0x80')]=function(_0x8b3851,_0x34979d,_0x35fcd9){return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x8b3851[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x34979d,null))[_0xc88c('0x29')](function(_0x19523e){if(_0x19523e){return _0x19523e[_0xc88c('0x80')](_0x8b3851[_0xc88c('0x4f')][_0xc88c('0x65')],_[_0xc88c('0x81')](_0x8b3851['body'],[_0xc88c('0x65'),'id'])||{})[_0xc88c('0x82')](function(_0x22dbe9){for(var _0x860cb0=0x0;_0x860cb0<_0x8b3851['body'][_0xc88c('0x65')][_0xc88c('0x3a')];_0x860cb0+=0x1){socket[_0xc88c('0x6e')]('userMailQueue:save',{'UserId':Number(_0x8b3851['body']['ids'][_0x860cb0]),'MailQueueId':Number(_0x8b3851['params']['id'])});}return _0x22dbe9;});}})[_0xc88c('0x29')](respondWithResult(_0x34979d,null))['catch'](handleError(_0x34979d,null));};exports[_0xc88c('0x7f')]=function(_0x336677,_0x4cad5b,_0x45413e){return db[_0xc88c('0x45')][_0xc88c('0x4c')]({'where':{'id':_0x336677['params']['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x4cad5b,null))[_0xc88c('0x29')](function(_0x9b8c57){if(_0x9b8c57){return _0x9b8c57[_0xc88c('0x7f')](_0x336677[_0xc88c('0x35')][_0xc88c('0x65')])[_0xc88c('0x29')](function(){if(_[_0xc88c('0x83')](_0x336677['query'][_0xc88c('0x65')])){for(var _0x37232b=0x0;_0x37232b<_0x336677[_0xc88c('0x35')][_0xc88c('0x65')][_0xc88c('0x3a')];_0x37232b+=0x1){socket[_0xc88c('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x336677[_0xc88c('0x35')][_0xc88c('0x65')][_0x37232b]),'MailQueueId':Number(_0x336677[_0xc88c('0x56')]['id'])});}}else{socket[_0xc88c('0x6e')](_0xc88c('0x84'),{'UserId':Number(_0x336677[_0xc88c('0x35')]['ids']),'MailQueueId':Number(_0x336677['params']['id'])});}});}})[_0xc88c('0x29')](respondWithStatusCode(_0x4cad5b,null))[_0xc88c('0x4d')](handleError(_0x4cad5b,null));};exports[_0xc88c('0x85')]=function(_0x1cb7b8,_0x4b6ccd,_0x3c3ab2){var _0x2fdab8={};var _0x47e8ca={};var _0x56197f;var _0x2eb242;return db['MailQueue'][_0xc88c('0x59')]({'where':{'id':_0x1cb7b8[_0xc88c('0x56')]['id']}})[_0xc88c('0x29')](handleEntityNotFound(_0x4b6ccd,null))['then'](function(_0x3f93bd){if(_0x3f93bd){_0x56197f=_0x3f93bd;_0x47e8ca[_0xc88c('0x34')]=_['keys'](db[_0xc88c('0x5d')][_0xc88c('0x32')]);_0x47e8ca[_0xc88c('0x35')]=_[_0xc88c('0x4b')](_0x1cb7b8['query']);_0x47e8ca[_0xc88c('0x36')]=_[_0xc88c('0x37')](_0x47e8ca[_0xc88c('0x34')],_0x47e8ca[_0xc88c('0x35')]);_0x2fdab8[_0xc88c('0x38')]=_[_0xc88c('0x37')](_0x47e8ca[_0xc88c('0x34')],qs[_0xc88c('0x39')](_0x1cb7b8[_0xc88c('0x35')][_0xc88c('0x39')]));_0x2fdab8[_0xc88c('0x38')]=_0x2fdab8['attributes'][_0xc88c('0x3a')]?_0x2fdab8[_0xc88c('0x38')]:_0x47e8ca[_0xc88c('0x34')];_0x2fdab8[_0xc88c('0x3d')]=qs[_0xc88c('0x3e')](_0x1cb7b8[_0xc88c('0x35')]['sort']);_0x2fdab8[_0xc88c('0x3f')]=qs['filters'](_['pick'](_0x1cb7b8[_0xc88c('0x35')],_0x47e8ca[_0xc88c('0x36')]));if(_0x1cb7b8[_0xc88c('0x35')][_0xc88c('0x5c')]){_0x2fdab8[_0xc88c('0x3f')]=_[_0xc88c('0x41')](_0x2fdab8[_0xc88c('0x3f')],{'$or':_[_0xc88c('0x31')](_0x2fdab8[_0xc88c('0x38')],function(_0x127e87){var _0x27e30e={};_0x27e30e[_0x127e87]={'$like':'%'+_0x1cb7b8['query']['filter']+'%'};return _0x27e30e;})});}_0x2fdab8=_[_0xc88c('0x41')]({},_0x2fdab8,_0x1cb7b8[_0xc88c('0x44')]);return _0x56197f['getAgents'](_0x2fdab8);}})[_0xc88c('0x29')](function(_0x4c76ef){if(_0x4c76ef){_0x2eb242=_0x4c76ef[_0xc88c('0x3a')];if(!_0x1cb7b8[_0xc88c('0x35')][_0xc88c('0x3b')](_0xc88c('0x3c'))){_0x2fdab8[_0xc88c('0x23')]=qs[_0xc88c('0x23')](_0x1cb7b8[_0xc88c('0x35')]['limit']);_0x2fdab8[_0xc88c('0x21')]=qs[_0xc88c('0x21')](_0x1cb7b8[_0xc88c('0x35')][_0xc88c('0x21')]);}return _0x56197f['getAgents'](_0x2fdab8);}})['then'](function(_0x3d379b){if(_0x3d379b){return _0x3d379b?{'count':_0x2eb242,'rows':_0x3d379b}:null;}})[_0xc88c('0x29')](respondWithResult(_0x4b6ccd,null))[_0xc88c('0x4d')](handleError(_0x4b6ccd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 0419db3..cd221cf 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 _0x42d4=['save','remove','emit','exports','../../mysqldb','MailQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x42d4,0x16c));var _0x442d=function(_0x71c8e,_0x1038ac){_0x71c8e=_0x71c8e-0x0;var _0x1e0ba8=_0x42d4[_0x71c8e];return _0x1e0ba8;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x442d('0x0'))['db'][_0x442d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x442d('0x2'),'afterUpdate':'update','afterDestroy':_0x442d('0x3')};function emitEvent(_0x2baf38){return function(_0x3d41aa,_0x368b32,_0x352c47){MailQueueEvents[_0x442d('0x4')](_0x2baf38+':'+_0x3d41aa['id'],_0x3d41aa);MailQueueEvents[_0x442d('0x4')](_0x2baf38,_0x3d41aa);_0x352c47(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x442d('0x5')]=MailQueueEvents; \ No newline at end of file +var _0x8c78=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x58d271,_0x4cf18a){var _0x9f50a3=function(_0x2bff75){while(--_0x2bff75){_0x58d271['push'](_0x58d271['shift']());}};_0x9f50a3(++_0x4cf18a);}(_0x8c78,0x1a9));var _0x88c7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x8c78[_0x2be8c2];return _0x97f531;};'use strict';var EventEmitter=require(_0x88c7('0x0'));var MailQueue=require(_0x88c7('0x1'))['db'][_0x88c7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x88c7('0x3')](0x0);var events={'afterCreate':_0x88c7('0x4'),'afterUpdate':_0x88c7('0x5'),'afterDestroy':_0x88c7('0x6')};function emitEvent(_0x5af6f4){return function(_0x51146d,_0x443a36,_0x26072c){MailQueueEvents[_0x88c7('0x7')](_0x5af6f4+':'+_0x51146d['id'],_0x51146d);MailQueueEvents[_0x88c7('0x7')](_0x5af6f4,_0x51146d);_0x26072c(null);};}for(var e in events){if(events[_0x88c7('0x8')](e)){var event=events[e];MailQueue[_0x88c7('0x9')](e,emitEvent(event));}}module[_0x88c7('0xa')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 5ad18f9..ed0af70 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 _0x88ce=['define','MailQueue','mail_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x17c10a,_0xc9ee44){var _0x149440=function(_0x52f2c4){while(--_0x52f2c4){_0x17c10a['push'](_0x17c10a['shift']());}};_0x149440(++_0xc9ee44);}(_0x88ce,0xc9));var _0xe88c=function(_0x473bdd,_0x1244e1){_0x473bdd=_0x473bdd-0x0;var _0x2542e2=_0x88ce[_0x473bdd];return _0x2542e2;};'use strict';var _=require(_0xe88c('0x0'));var util=require(_0xe88c('0x1'));var logger=require(_0xe88c('0x2'))(_0xe88c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe88c('0x4'));var fs=require('fs');var path=require(_0xe88c('0x5'));var rimraf=require(_0xe88c('0x6'));var config=require(_0xe88c('0x7'));var attributes=require('./mailQueue.attributes');module['exports']=function(_0x1f9fd5,_0x259563){return _0x1f9fd5[_0xe88c('0x8')](_0xe88c('0x9'),attributes,{'tableName':_0xe88c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47ed=['MailQueue','mail_queues','lodash','util','api','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x47ed,0x19a));var _0xd47e=function(_0x37a06f,_0x4062f7){_0x37a06f=_0x37a06f-0x0;var _0x54b1ca=_0x47ed[_0x37a06f];return _0x54b1ca;};'use strict';var _=require(_0xd47e('0x0'));var util=require(_0xd47e('0x1'));var logger=require('../../config/logger')(_0xd47e('0x2'));var moment=require('moment');var BPromise=require(_0xd47e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd47e('0x4'));var rimraf=require(_0xd47e('0x5'));var config=require(_0xd47e('0x6'));var attributes=require(_0xd47e('0x7'));module[_0xd47e('0x8')]=function(_0x2d560f,_0xd1dd5a){return _0x2d560f[_0xd47e('0x9')](_0xd47e('0xa'),attributes,{'tableName':_0xd47e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 6044d0f..5172e53 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 _0xda8b=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','map','include','model','debug','ShowMailQueue','find','lodash','util','moment'];(function(_0x1926f7,_0x513485){var _0x22d3ac=function(_0x25320a){while(--_0x25320a){_0x1926f7['push'](_0x1926f7['shift']());}};_0x22d3ac(++_0x513485);}(_0xda8b,0x10e));var _0xbda8=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xda8b[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xbda8('0x0'));var util=require(_0xbda8('0x1'));var moment=require(_0xbda8('0x2'));var BPromise=require(_0xbda8('0x3'));var rs=require(_0xbda8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbda8('0x5'));var logger=require('../../config/logger')(_0xbda8('0x6'));var config=require(_0xbda8('0x7'));var jayson=require(_0xbda8('0x8'));var client=jayson[_0xbda8('0x9')]['http']({'port':0x232a});config[_0xbda8('0xa')]=_[_0xbda8('0xb')](config[_0xbda8('0xa')],{'host':_0xbda8('0xc'),'port':0x18eb});var socket=require(_0xbda8('0xd'))(new Redis(config[_0xbda8('0xa')]));require(_0xbda8('0xe'))[_0xbda8('0xf')](socket);function respondWithRpcPromise(_0x33b3a7,_0x4752e0,_0x49a144){return new BPromise(function(_0x169161,_0x2a0035){return client[_0xbda8('0x10')](_0x33b3a7,_0x49a144)[_0xbda8('0x11')](function(_0x29e64f){logger[_0xbda8('0x12')](_0xbda8('0x13'),_0x4752e0,'request\x20sent');logger['debug'](_0xbda8('0x14'),_0x4752e0,'request\x20sent',JSON[_0xbda8('0x15')](_0x29e64f));if(_0x29e64f['error']){if(_0x29e64f[_0xbda8('0x16')]['code']===0x1f4){logger[_0xbda8('0x16')](_0xbda8('0x13'),_0x4752e0,_0x29e64f[_0xbda8('0x16')][_0xbda8('0x17')]);return _0x2a0035(_0x29e64f[_0xbda8('0x16')][_0xbda8('0x17')]);}logger['error'](_0xbda8('0x13'),_0x4752e0,_0x29e64f[_0xbda8('0x16')]['message']);return _0x169161(_0x29e64f[_0xbda8('0x16')]['message']);}else{logger[_0xbda8('0x12')](_0xbda8('0x13'),_0x4752e0,'request\x20sent');_0x169161(_0x29e64f[_0xbda8('0x18')][_0xbda8('0x17')]);}})[_0xbda8('0x19')](function(_0x31c219){logger['error'](_0xbda8('0x13'),_0x4752e0,_0x31c219);_0x2a0035(_0x31c219);});});}exports[_0xbda8('0x1a')]=function(_0x1f277c){var _0x5951ae=this;return new Promise(function(_0x3e3009,_0x3ebe1d){return db[_0xbda8('0x1b')][_0xbda8('0x1c')]({'raw':_0x1f277c['options']?_0x1f277c[_0xbda8('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1f277c['options']?_0x1f277c[_0xbda8('0x1d')][_0xbda8('0x1e')]||null:null,'attributes':_0x1f277c[_0xbda8('0x1d')]?_0x1f277c[_0xbda8('0x1d')][_0xbda8('0x1f')]||null:null,'limit':_0x1f277c[_0xbda8('0x1d')]?_0x1f277c['options'][_0xbda8('0x20')]||null:null,'include':_0x1f277c[_0xbda8('0x1d')]?_0x1f277c['options']['include']?_[_0xbda8('0x21')](_0x1f277c[_0xbda8('0x1d')][_0xbda8('0x22')],function(_0x513928){return{'model':db[_0x513928[_0xbda8('0x23')]],'as':_0x513928['as'],'attributes':_0x513928[_0xbda8('0x1f')],'include':_0x513928['include']?_[_0xbda8('0x21')](_0x513928[_0xbda8('0x22')],function(_0x761477){return{'model':db[_0x761477[_0xbda8('0x23')]],'as':_0x761477['as'],'attributes':_0x761477['attributes'],'include':_0x761477[_0xbda8('0x22')]?_['map'](_0x761477['include'],function(_0x526b6d){return{'model':db[_0x526b6d[_0xbda8('0x23')]],'as':_0x526b6d['as'],'attributes':_0x526b6d[_0xbda8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbda8('0x11')](function(_0x518c9d){logger[_0xbda8('0x12')](_0xbda8('0x1a'),_0x1f277c);logger[_0xbda8('0x24')]('GetMailQueue',_0x1f277c,JSON[_0xbda8('0x15')](_0x518c9d));_0x3e3009(_0x518c9d);})[_0xbda8('0x19')](function(_0x465525){logger[_0xbda8('0x16')](_0xbda8('0x1a'),_0x465525['message'],_0x1f277c);_0x3ebe1d(_0x5951ae[_0xbda8('0x16')](0x1f4,_0x465525[_0xbda8('0x17')]));});});};exports[_0xbda8('0x25')]=function(_0x3c4f38){var _0x520264=this;return new Promise(function(_0x5c083f,_0x50c710){return db[_0xbda8('0x1b')][_0xbda8('0x26')]({'raw':_0x3c4f38['options']?_0x3c4f38['options']['raw']===undefined?!![]:![]:!![],'where':_0x3c4f38[_0xbda8('0x1d')]?_0x3c4f38[_0xbda8('0x1d')]['where']||null:null,'attributes':_0x3c4f38[_0xbda8('0x1d')]?_0x3c4f38[_0xbda8('0x1d')][_0xbda8('0x1f')]||null:null,'include':_0x3c4f38['options']?_0x3c4f38['options'][_0xbda8('0x22')]?_['map'](_0x3c4f38[_0xbda8('0x1d')]['include'],function(_0x9dbe7c){return{'model':db[_0x9dbe7c[_0xbda8('0x23')]],'as':_0x9dbe7c['as'],'attributes':_0x9dbe7c[_0xbda8('0x1f')],'include':_0x9dbe7c['include']?_['map'](_0x9dbe7c[_0xbda8('0x22')],function(_0x22b356){return{'model':db[_0x22b356['model']],'as':_0x22b356['as'],'attributes':_0x22b356['attributes'],'include':_0x22b356['include']?_['map'](_0x22b356[_0xbda8('0x22')],function(_0x2601b6){return{'model':db[_0x2601b6[_0xbda8('0x23')]],'as':_0x2601b6['as'],'attributes':_0x2601b6[_0xbda8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x440e39){logger[_0xbda8('0x12')]('ShowMailQueue',_0x3c4f38);logger['debug']('ShowMailQueue',_0x3c4f38,JSON[_0xbda8('0x15')](_0x440e39));_0x5c083f(_0x440e39);})[_0xbda8('0x19')](function(_0x4be130){logger[_0xbda8('0x16')](_0xbda8('0x25'),_0x4be130[_0xbda8('0x17')],_0x3c4f38);_0x50c710(_0x520264[_0xbda8('0x16')](0x1f4,_0x4be130['message']));});});}; \ No newline at end of file +var _0xd6e9=['then','GetMailQueue','ShowMailQueue','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','limit','map','include','model','attributes'];(function(_0x428d1b,_0x558051){var _0x18d8b6=function(_0x9445b9){while(--_0x9445b9){_0x428d1b['push'](_0x428d1b['shift']());}};_0x18d8b6(++_0x558051);}(_0xd6e9,0x1b0));var _0x9d6e=function(_0x4822d6,_0x1ec19e){_0x4822d6=_0x4822d6-0x0;var _0x282488=_0xd6e9[_0x4822d6];return _0x282488;};'use strict';var _=require(_0x9d6e('0x0'));var util=require(_0x9d6e('0x1'));var moment=require(_0x9d6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d6e('0x3'));var fs=require('fs');var Redis=require(_0x9d6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9d6e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9d6e('0x6'));var jayson=require(_0x9d6e('0x7'));var client=jayson[_0x9d6e('0x8')][_0x9d6e('0x9')]({'port':0x232a});config[_0x9d6e('0xa')]=_[_0x9d6e('0xb')](config['redis'],{'host':_0x9d6e('0xc'),'port':0x18eb});var socket=require(_0x9d6e('0xd'))(new Redis(config['redis']));require(_0x9d6e('0xe'))[_0x9d6e('0xf')](socket);function respondWithRpcPromise(_0x17352f,_0xfb878f,_0x366a7b){return new BPromise(function(_0x9753a,_0x3d3408){return client['request'](_0x17352f,_0x366a7b)['then'](function(_0x16ac4f){logger[_0x9d6e('0x10')](_0x9d6e('0x11'),_0xfb878f,_0x9d6e('0x12'));logger[_0x9d6e('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0xfb878f,_0x9d6e('0x12'),JSON[_0x9d6e('0x14')](_0x16ac4f));if(_0x16ac4f[_0x9d6e('0x15')]){if(_0x16ac4f[_0x9d6e('0x15')][_0x9d6e('0x16')]===0x1f4){logger[_0x9d6e('0x15')](_0x9d6e('0x11'),_0xfb878f,_0x16ac4f[_0x9d6e('0x15')][_0x9d6e('0x17')]);return _0x3d3408(_0x16ac4f[_0x9d6e('0x15')][_0x9d6e('0x17')]);}logger['error'](_0x9d6e('0x11'),_0xfb878f,_0x16ac4f[_0x9d6e('0x15')][_0x9d6e('0x17')]);return _0x9753a(_0x16ac4f[_0x9d6e('0x15')]['message']);}else{logger[_0x9d6e('0x10')](_0x9d6e('0x11'),_0xfb878f,_0x9d6e('0x12'));_0x9753a(_0x16ac4f[_0x9d6e('0x18')]['message']);}})[_0x9d6e('0x19')](function(_0x44fdf2){logger['error'](_0x9d6e('0x11'),_0xfb878f,_0x44fdf2);_0x3d3408(_0x44fdf2);});});}exports['GetMailQueue']=function(_0xc69f1f){var _0x1deb5b=this;return new Promise(function(_0x566812,_0x287091){return db[_0x9d6e('0x1a')][_0x9d6e('0x1b')]({'raw':_0xc69f1f[_0x9d6e('0x1c')]?_0xc69f1f[_0x9d6e('0x1c')][_0x9d6e('0x1d')]===undefined?!![]:![]:!![],'where':_0xc69f1f[_0x9d6e('0x1c')]?_0xc69f1f[_0x9d6e('0x1c')][_0x9d6e('0x1e')]||null:null,'attributes':_0xc69f1f[_0x9d6e('0x1c')]?_0xc69f1f[_0x9d6e('0x1c')]['attributes']||null:null,'limit':_0xc69f1f[_0x9d6e('0x1c')]?_0xc69f1f[_0x9d6e('0x1c')][_0x9d6e('0x1f')]||null:null,'include':_0xc69f1f[_0x9d6e('0x1c')]?_0xc69f1f[_0x9d6e('0x1c')]['include']?_[_0x9d6e('0x20')](_0xc69f1f['options'][_0x9d6e('0x21')],function(_0x11d0f1){return{'model':db[_0x11d0f1[_0x9d6e('0x22')]],'as':_0x11d0f1['as'],'attributes':_0x11d0f1[_0x9d6e('0x23')],'include':_0x11d0f1[_0x9d6e('0x21')]?_[_0x9d6e('0x20')](_0x11d0f1['include'],function(_0x3672f5){return{'model':db[_0x3672f5[_0x9d6e('0x22')]],'as':_0x3672f5['as'],'attributes':_0x3672f5['attributes'],'include':_0x3672f5[_0x9d6e('0x21')]?_[_0x9d6e('0x20')](_0x3672f5['include'],function(_0x4c5eca){return{'model':db[_0x4c5eca[_0x9d6e('0x22')]],'as':_0x4c5eca['as'],'attributes':_0x4c5eca[_0x9d6e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9d6e('0x24')](function(_0x197530){logger[_0x9d6e('0x10')](_0x9d6e('0x25'),_0xc69f1f);logger[_0x9d6e('0x13')]('GetMailQueue',_0xc69f1f,JSON[_0x9d6e('0x14')](_0x197530));_0x566812(_0x197530);})[_0x9d6e('0x19')](function(_0x11ba33){logger[_0x9d6e('0x15')](_0x9d6e('0x25'),_0x11ba33[_0x9d6e('0x17')],_0xc69f1f);_0x287091(_0x1deb5b[_0x9d6e('0x15')](0x1f4,_0x11ba33[_0x9d6e('0x17')]));});});};exports[_0x9d6e('0x26')]=function(_0x3a8b69){var _0x264e94=this;return new Promise(function(_0x2a0848,_0x167d47){return db['MailQueue']['find']({'raw':_0x3a8b69[_0x9d6e('0x1c')]?_0x3a8b69[_0x9d6e('0x1c')][_0x9d6e('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a8b69[_0x9d6e('0x1c')]?_0x3a8b69[_0x9d6e('0x1c')][_0x9d6e('0x1e')]||null:null,'attributes':_0x3a8b69['options']?_0x3a8b69[_0x9d6e('0x1c')][_0x9d6e('0x23')]||null:null,'include':_0x3a8b69[_0x9d6e('0x1c')]?_0x3a8b69['options']['include']?_[_0x9d6e('0x20')](_0x3a8b69[_0x9d6e('0x1c')][_0x9d6e('0x21')],function(_0x3d6cc0){return{'model':db[_0x3d6cc0[_0x9d6e('0x22')]],'as':_0x3d6cc0['as'],'attributes':_0x3d6cc0[_0x9d6e('0x23')],'include':_0x3d6cc0[_0x9d6e('0x21')]?_[_0x9d6e('0x20')](_0x3d6cc0[_0x9d6e('0x21')],function(_0x5b120c){return{'model':db[_0x5b120c[_0x9d6e('0x22')]],'as':_0x5b120c['as'],'attributes':_0x5b120c['attributes'],'include':_0x5b120c[_0x9d6e('0x21')]?_[_0x9d6e('0x20')](_0x5b120c[_0x9d6e('0x21')],function(_0x49d780){return{'model':db[_0x49d780[_0x9d6e('0x22')]],'as':_0x49d780['as'],'attributes':_0x49d780[_0x9d6e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a7d95){logger['info'](_0x9d6e('0x26'),_0x3a8b69);logger[_0x9d6e('0x13')](_0x9d6e('0x26'),_0x3a8b69,JSON[_0x9d6e('0x14')](_0x4a7d95));_0x2a0848(_0x4a7d95);})[_0x9d6e('0x19')](function(_0x45690e){logger[_0x9d6e('0x15')]('ShowMailQueue',_0x45690e[_0x9d6e('0x17')],_0x3a8b69);_0x167d47(_0x264e94[_0x9d6e('0x15')](0x1f4,_0x45690e[_0x9d6e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1569078..752a2d3 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 _0x73aa=['mailQueue:','remove','update','removeListener','length'];(function(_0x6e3453,_0xcb3f5c){var _0x180da8=function(_0x25fe4a){while(--_0x25fe4a){_0x6e3453['push'](_0x6e3453['shift']());}};_0x180da8(++_0xcb3f5c);}(_0x73aa,0x1eb));var _0xa73a=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x73aa[_0x341e0f];return _0x59555a;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xa73a('0x0'),_0xa73a('0x1')];function createListener(_0x3bb57c,_0x14a254){return function(_0x390137){_0x14a254['emit'](_0x3bb57c,_0x390137);};}function removeListener(_0x10ab4b,_0x34f17e){return function(){MailQueueEvents[_0xa73a('0x2')](_0x10ab4b,_0x34f17e);};}exports['register']=function(_0x55b77d){for(var _0x2f533a=0x0,_0x5428f8=events[_0xa73a('0x3')];_0x2f533a<_0x5428f8;_0x2f533a++){var _0x28e0f9=events[_0x2f533a];var _0x31fe09=createListener(_0xa73a('0x4')+_0x28e0f9,_0x55b77d);MailQueueEvents['on'](_0x28e0f9,_0x31fe09);}}; \ No newline at end of file +var _0x6f0b=['update','emit','removeListener','register','length','mailQueue:','remove'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x6f0b,0xf4));var _0xb6f0=function(_0x1c89ea,_0x555c2d){_0x1c89ea=_0x1c89ea-0x0;var _0x47daec=_0x6f0b[_0x1c89ea];return _0x47daec;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xb6f0('0x0'),_0xb6f0('0x1')];function createListener(_0x57c9e4,_0x1ee266){return function(_0x20ae04){_0x1ee266[_0xb6f0('0x2')](_0x57c9e4,_0x20ae04);};}function removeListener(_0x41205a,_0x1f485f){return function(){MailQueueEvents[_0xb6f0('0x3')](_0x41205a,_0x1f485f);};}exports[_0xb6f0('0x4')]=function(_0x342039){for(var _0x46e003=0x0,_0x23c08a=events[_0xb6f0('0x5')];_0x46e003<_0x23c08a;_0x46e003++){var _0xbf4ca6=events[_0x46e003];var _0x1e6f11=createListener(_0xb6f0('0x6')+_0xbf4ca6,_0x342039);MailQueueEvents['on'](_0xbf4ca6,_0x1e6f11);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d964fc4..d8ccd2a 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 _0x98f7=['Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x98f7,0x1cf));var _0x798f=function(_0x23ff05,_0x2b570a){_0x23ff05=_0x23ff05-0x0;var _0x5e4d75=_0x98f7[_0x23ff05];return _0x5e4d75;};'use strict';var multer=require(_0x798f('0x0'));var util=require(_0x798f('0x1'));var path=require(_0x798f('0x2'));var timeout=require(_0x798f('0x3'));var express=require(_0x798f('0x4'));var router=express[_0x798f('0x5')]();var fs_extra=require(_0x798f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x798f('0x7'));var config=require('../../config/environment');var controller=require(_0x798f('0x8'));router[_0x798f('0x9')]('/',auth[_0x798f('0xa')](),controller['index']);router[_0x798f('0x9')](_0x798f('0xb'),auth[_0x798f('0xa')](),controller[_0x798f('0xc')]);router[_0x798f('0x9')](_0x798f('0xd'),auth[_0x798f('0xa')](),controller['show']);router['post']('/',auth[_0x798f('0xa')](),controller[_0x798f('0xe')]);router[_0x798f('0xf')](_0x798f('0xd'),auth[_0x798f('0xa')](),controller['update']);router['delete'](_0x798f('0xd'),auth[_0x798f('0xa')](),controller[_0x798f('0x10')]);module[_0x798f('0x11')]=router; \ No newline at end of file +var _0x517e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x18b888,_0x4b813a){var _0x41e6cd=function(_0x54daf7){while(--_0x54daf7){_0x18b888['push'](_0x18b888['shift']());}};_0x41e6cd(++_0x4b813a);}(_0x517e,0x171));var _0xe517=function(_0x7bc63a,_0x26422a){_0x7bc63a=_0x7bc63a-0x0;var _0xed898e=_0x517e[_0x7bc63a];return _0xed898e;};'use strict';var multer=require('multer');var util=require(_0xe517('0x0'));var path=require(_0xe517('0x1'));var timeout=require(_0xe517('0x2'));var express=require(_0xe517('0x3'));var router=express[_0xe517('0x4')]();var fs_extra=require(_0xe517('0x5'));var auth=require(_0xe517('0x6'));var interaction=require(_0xe517('0x7'));var config=require(_0xe517('0x8'));var controller=require('./mailQueueReport.controller');router[_0xe517('0x9')]('/',auth[_0xe517('0xa')](),controller[_0xe517('0xb')]);router[_0xe517('0x9')](_0xe517('0xc'),auth[_0xe517('0xa')](),controller[_0xe517('0xd')]);router[_0xe517('0x9')](_0xe517('0xe'),auth['isAuthenticated'](),controller[_0xe517('0xf')]);router[_0xe517('0x10')]('/',auth[_0xe517('0xa')](),controller[_0xe517('0x11')]);router[_0xe517('0x12')](_0xe517('0xe'),auth[_0xe517('0xa')](),controller[_0xe517('0x13')]);router[_0xe517('0x14')](_0xe517('0xe'),auth[_0xe517('0xa')](),controller[_0xe517('0x15')]);module[_0xe517('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e096294..0c6dc5b 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 _0x1618=['exports','STRING','DATE','moment','sequelize'];(function(_0x3d7a10,_0x21bc7b){var _0x5b0b11=function(_0x366e31){while(--_0x366e31){_0x3d7a10['push'](_0x3d7a10['shift']());}};_0x5b0b11(++_0x21bc7b);}(_0x1618,0x148));var _0x8161=function(_0x447c82,_0x407de3){_0x447c82=_0x447c82-0x0;var _0x5429aa=_0x1618[_0x447c82];return _0x5429aa;};'use strict';var moment=require(_0x8161('0x0'));var Sequelize=require(_0x8161('0x1'));module[_0x8161('0x2')]={'uniqueid':{'type':Sequelize[_0x8161('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8161('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8161('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8161('0x3')]}}; \ No newline at end of file +var _0xa0aa=['exports','STRING','DATE','moment'];(function(_0xb7c7f1,_0x107c2f){var _0x299ee2=function(_0x551f99){while(--_0x551f99){_0xb7c7f1['push'](_0xb7c7f1['shift']());}};_0x299ee2(++_0x107c2f);}(_0xa0aa,0x83));var _0xaa0a=function(_0x3df3e1,_0xf9ccd7){_0x3df3e1=_0x3df3e1-0x0;var _0x5b37aa=_0xa0aa[_0x3df3e1];return _0x5b37aa;};'use strict';var moment=require(_0xaa0a('0x0'));var Sequelize=require('sequelize');module[_0xaa0a('0x1')]={'uniqueid':{'type':Sequelize[_0xaa0a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xaa0a('0x3')]},'exitAt':{'type':Sequelize[_0xaa0a('0x3')]},'reason':{'type':Sequelize[_0xaa0a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2b064d6..56907b7 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 _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','MailQueueReport','includeAll','rows','catch','show'];(function(_0x532a08,_0x1079ab){var _0xd9c5ee=function(_0x1ce50c){while(--_0x1ce50c){_0x532a08['push'](_0x532a08['shift']());}};_0xd9c5ee(++_0x1079ab);}(_0x0295,0x1f0));var _0x5029=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0295[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['MailQueueReport'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['MailQueueReport'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file +var _0x1a37=['index','map','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1a37[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':!![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 43934b7..aacb497 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 _0xacea=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x290178,_0x2359d5){var _0x4d6f5c=function(_0x58e40f){while(--_0x58e40f){_0x290178['push'](_0x290178['shift']());}};_0x4d6f5c(++_0x2359d5);}(_0xacea,0x1a1));var _0xaace=function(_0x2e3aba,_0x13a774){_0x2e3aba=_0x2e3aba-0x0;var _0x508b87=_0xacea[_0x2e3aba];return _0x508b87;};'use strict';var _=require(_0xaace('0x0'));var util=require(_0xaace('0x1'));var logger=require(_0xaace('0x2'))('api');var moment=require(_0xaace('0x3'));var BPromise=require(_0xaace('0x4'));var rp=require(_0xaace('0x5'));var fs=require('fs');var path=require(_0xaace('0x6'));var rimraf=require(_0xaace('0x7'));var config=require(_0xaace('0x8'));var attributes=require(_0xaace('0x9'));module['exports']=function(_0x139657,_0x2a56be){return _0x139657[_0xaace('0xa')](_0xaace('0xb'),attributes,{'tableName':_0xaace('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaace('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfbde=['api','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x14724e,_0x1555bc){var _0x5d51f6=function(_0x2bb6bb){while(--_0x2bb6bb){_0x14724e['push'](_0x14724e['shift']());}};_0x5d51f6(++_0x1555bc);}(_0xfbde,0x147));var _0xefbd=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xfbde[_0x166d93];return _0xba708;};'use strict';var _=require(_0xefbd('0x0'));var util=require(_0xefbd('0x1'));var logger=require(_0xefbd('0x2'))(_0xefbd('0x3'));var moment=require(_0xefbd('0x4'));var BPromise=require('bluebird');var rp=require(_0xefbd('0x5'));var fs=require('fs');var path=require(_0xefbd('0x6'));var rimraf=require(_0xefbd('0x7'));var config=require(_0xefbd('0x8'));var attributes=require(_0xefbd('0x9'));module[_0xefbd('0xa')]=function(_0x3fae76,_0x5e9161){return _0x3fae76[_0xefbd('0xb')](_0xefbd('0xc'),attributes,{'tableName':_0xefbd('0xd'),'paranoid':![],'indexes':[{'name':_0xefbd('0xe'),'fields':[_0xefbd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index ea8531a..6a96394 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x335f37,_0x37302b){var _0x1768f4=function(_0x3ce316){while(--_0x3ce316){_0x335f37['push'](_0x335f37['shift']());}};_0x1768f4(++_0x37302b);}(_0x2ef3,0xba));var _0x32ef=function(_0x15d2e8,_0x1761e7){_0x15d2e8=_0x15d2e8-0x0;var _0x111722=_0x2ef3[_0x15d2e8];return _0x111722;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('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(_0x41bb2b,_0xe907b2){var _0x1a87ad=function(_0x10f8c6){while(--_0x10f8c6){_0x41bb2b['push'](_0x41bb2b['shift']());}};_0x1a87ad(++_0xe907b2);}(_0xadb5,0xad));var _0x5adb=function(_0x1343b3,_0x5abb96){_0x1343b3=_0x1343b3-0x0;var _0x421857=_0xadb5[_0x1343b3];return _0x421857;};'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 889d337..042cfae 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3912b2,_0x685ed2){var _0x2462a0=function(_0x1efabe){while(--_0x1efabe){_0x3912b2['push'](_0x3912b2['shift']());}};_0x2462a0(++_0x685ed2);}(_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(_0x7e5e23,_0x4347a4){var _0x5ee208=function(_0x2537a6){while(--_0x2537a6){_0x7e5e23['push'](_0x7e5e23['shift']());}};_0x5ee208(++_0x4347a4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0xcb91[_0x51639a];return _0x3abae4;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b48716b..b1ffd5c 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 _0xcef7=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x583568,_0x14631c){var _0x52c24e=function(_0x5a36ba){while(--_0x5a36ba){_0x583568['push'](_0x583568['shift']());}};_0x52c24e(++_0x14631c);}(_0xcef7,0xe3));var _0x7cef=function(_0x1b1c61,_0x2adb18){_0x1b1c61=_0x1b1c61-0x0;var _0x4ce6a6=_0xcef7[_0x1b1c61];return _0x4ce6a6;};'use strict';var Sequelize=require('sequelize');module[_0x7cef('0x0')]={'description':{'type':Sequelize[_0x7cef('0x1')]},'host':{'type':Sequelize[_0x7cef('0x1')]},'authentication':{'type':Sequelize[_0x7cef('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7cef('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7cef('0x3')]},'tls':{'type':Sequelize[_0x7cef('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x7cef('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x7cef('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x7cef('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6294=['INTEGER','INBOX','exports','STRING','BOOLEAN'];(function(_0x56a3fe,_0x20b389){var _0x56493d=function(_0x5d825f){while(--_0x5d825f){_0x56a3fe['push'](_0x56a3fe['shift']());}};_0x56493d(++_0x20b389);}(_0x6294,0xed));var _0x4629=function(_0x2ac517,_0x3b98bf){_0x2ac517=_0x2ac517-0x0;var _0x5cda74=_0x6294[_0x2ac517];return _0x5cda74;};'use strict';var Sequelize=require('sequelize');module[_0x4629('0x0')]={'description':{'type':Sequelize[_0x4629('0x1')]},'host':{'type':Sequelize[_0x4629('0x1')]},'authentication':{'type':Sequelize[_0x4629('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4629('0x1')]},'password':{'type':Sequelize[_0x4629('0x1')]},'port':{'type':Sequelize[_0x4629('0x3')]},'tls':{'type':Sequelize[_0x4629('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4629('0x1')],'defaultValue':_0x4629('0x4')},'connTimeout':{'type':Sequelize[_0x4629('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4629('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4629('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 762ad7a..4a5e9e0 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 _0xe1c8=['bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment'];(function(_0x355374,_0x887f4b){var _0x255898=function(_0x25f225){while(--_0x25f225){_0x355374['push'](_0x355374['shift']());}};_0x255898(++_0x887f4b);}(_0xe1c8,0x189));var _0x8e1c=function(_0x44787a,_0x36badf){_0x44787a=_0x44787a-0x0;var _0x29b129=_0xe1c8[_0x44787a];return _0x29b129;};'use strict';var _=require(_0x8e1c('0x0'));var util=require(_0x8e1c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e1c('0x2'));var BPromise=require(_0x8e1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e1c('0x4'));var rimraf=require(_0x8e1c('0x5'));var config=require(_0x8e1c('0x6'));var attributes=require(_0x8e1c('0x7'));module[_0x8e1c('0x8')]=function(_0x450a96,_0x12a0c0){return _0x450a96[_0x8e1c('0x9')](_0x8e1c('0xa'),attributes,{'tableName':_0x8e1c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0959=['request-promise','path','rimraf','../../config/environment','exports','define','mail_servers_in','lodash','util','../../config/logger','bluebird'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0959,0x1ca));var _0x9095=function(_0x2391b9,_0x15a92b){_0x2391b9=_0x2391b9-0x0;var _0x401fc2=_0x0959[_0x2391b9];return _0x401fc2;};'use strict';var _=require(_0x9095('0x0'));var util=require(_0x9095('0x1'));var logger=require(_0x9095('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9095('0x3'));var rp=require(_0x9095('0x4'));var fs=require('fs');var path=require(_0x9095('0x5'));var rimraf=require(_0x9095('0x6'));var config=require(_0x9095('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x9095('0x8')]=function(_0x34a1ba,_0x4680b3){return _0x34a1ba[_0x9095('0x9')]('MailServerIn',attributes,{'tableName':_0x9095('0xa'),'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 6b42139..087bc05 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 _0x5c9c=['include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit'];(function(_0x1f78cb,_0x58e9f3){var _0x2cf6b8=function(_0x5c753c){while(--_0x5c753c){_0x1f78cb['push'](_0x1f78cb['shift']());}};_0x2cf6b8(++_0x58e9f3);}(_0x5c9c,0x1d1));var _0xc5c9=function(_0x6d28db,_0x406c7a){_0x6d28db=_0x6d28db-0x0;var _0x409566=_0x5c9c[_0x6d28db];return _0x409566;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var moment=require(_0xc5c9('0x2'));var BPromise=require(_0xc5c9('0x3'));var rs=require(_0xc5c9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5c9('0x5'))['db'];var utils=require(_0xc5c9('0x6'));var logger=require(_0xc5c9('0x7'))(_0xc5c9('0x8'));var config=require(_0xc5c9('0x9'));var jayson=require(_0xc5c9('0xa'));var client=jayson['client'][_0xc5c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcdf0af,_0x558dc0,_0x3ed0f5){return new BPromise(function(_0x527849,_0x534b7f){return client['request'](_0xcdf0af,_0x3ed0f5)[_0xc5c9('0xc')](function(_0x5ca530){logger[_0xc5c9('0xd')](_0xc5c9('0xe'),_0x558dc0,_0xc5c9('0xf'));logger[_0xc5c9('0x10')](_0xc5c9('0x11'),_0x558dc0,_0xc5c9('0xf'),JSON[_0xc5c9('0x12')](_0x5ca530));if(_0x5ca530[_0xc5c9('0x13')]){if(_0x5ca530[_0xc5c9('0x13')]['code']===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x558dc0,_0x5ca530[_0xc5c9('0x13')][_0xc5c9('0x14')]);return _0x534b7f(_0x5ca530[_0xc5c9('0x13')]['message']);}logger[_0xc5c9('0x13')](_0xc5c9('0xe'),_0x558dc0,_0x5ca530[_0xc5c9('0x13')][_0xc5c9('0x14')]);return _0x527849(_0x5ca530['error'][_0xc5c9('0x14')]);}else{logger['info'](_0xc5c9('0xe'),_0x558dc0,_0xc5c9('0xf'));_0x527849(_0x5ca530['result'][_0xc5c9('0x14')]);}})[_0xc5c9('0x15')](function(_0x162e58){logger[_0xc5c9('0x13')]('MailServerIn,\x20%s,\x20%s',_0x558dc0,_0x162e58);_0x534b7f(_0x162e58);});});}exports[_0xc5c9('0x16')]=function(_0x43f6ed){var _0x56b5ca=this;return new Promise(function(_0x56939e,_0x1a97c4){return db[_0xc5c9('0x17')][_0xc5c9('0x18')]({'raw':_0x43f6ed[_0xc5c9('0x19')]?_0x43f6ed['options'][_0xc5c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x43f6ed[_0xc5c9('0x19')]?_0x43f6ed[_0xc5c9('0x19')][_0xc5c9('0x1b')]||null:null,'attributes':_0x43f6ed[_0xc5c9('0x19')]?_0x43f6ed[_0xc5c9('0x19')][_0xc5c9('0x1c')]||null:null,'limit':_0x43f6ed[_0xc5c9('0x19')]?_0x43f6ed[_0xc5c9('0x19')][_0xc5c9('0x1d')]||null:null,'include':_0x43f6ed['options']?_0x43f6ed['options'][_0xc5c9('0x1e')]?_[_0xc5c9('0x1f')](_0x43f6ed[_0xc5c9('0x19')]['include'],function(_0x2825f5){return{'model':db[_0x2825f5[_0xc5c9('0x20')]],'as':_0x2825f5['as'],'attributes':_0x2825f5[_0xc5c9('0x1c')],'include':_0x2825f5[_0xc5c9('0x1e')]?_[_0xc5c9('0x1f')](_0x2825f5[_0xc5c9('0x1e')],function(_0x596453){return{'model':db[_0x596453[_0xc5c9('0x20')]],'as':_0x596453['as'],'attributes':_0x596453['attributes'],'include':_0x596453['include']?_[_0xc5c9('0x1f')](_0x596453[_0xc5c9('0x1e')],function(_0x3c01bd){return{'model':db[_0x3c01bd[_0xc5c9('0x20')]],'as':_0x3c01bd['as'],'attributes':_0x3c01bd[_0xc5c9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc5c9('0xc')](function(_0x29bd1a){logger['info']('GetMailServerIn',_0x43f6ed);logger[_0xc5c9('0x10')]('GetMailServerIn',_0x43f6ed,JSON[_0xc5c9('0x12')](_0x29bd1a));_0x56939e(_0x29bd1a);})[_0xc5c9('0x15')](function(_0x4ded0e){logger[_0xc5c9('0x13')]('GetMailServerIn',_0x4ded0e['message'],_0x43f6ed);_0x1a97c4(_0x56b5ca[_0xc5c9('0x13')](0x1f4,_0x4ded0e[_0xc5c9('0x14')]));});});}; \ No newline at end of file +var _0x8fe0=['MailServerIn','findAll','options','raw','where','limit','map','include','model','attributes','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn'];(function(_0x40edc7,_0x433d78){var _0x1f00f5=function(_0x1fa38a){while(--_0x1fa38a){_0x40edc7['push'](_0x40edc7['shift']());}};_0x1f00f5(++_0x433d78);}(_0x8fe0,0x1ab));var _0x08fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fe0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x08fe('0x0'));var util=require(_0x08fe('0x1'));var moment=require(_0x08fe('0x2'));var BPromise=require(_0x08fe('0x3'));var rs=require(_0x08fe('0x4'));var fs=require('fs');var Redis=require(_0x08fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x08fe('0x6'));var logger=require(_0x08fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08fe('0x8'));var client=jayson[_0x08fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310562,_0x3aee0e,_0x206c14){return new BPromise(function(_0x4ffc4b,_0x4b6b76){return client['request'](_0x310562,_0x206c14)['then'](function(_0x307f2a){logger[_0x08fe('0xa')](_0x08fe('0xb'),_0x3aee0e,_0x08fe('0xc'));logger[_0x08fe('0xd')](_0x08fe('0xe'),_0x3aee0e,'request\x20sent',JSON[_0x08fe('0xf')](_0x307f2a));if(_0x307f2a[_0x08fe('0x10')]){if(_0x307f2a[_0x08fe('0x10')][_0x08fe('0x11')]===0x1f4){logger[_0x08fe('0x10')](_0x08fe('0xb'),_0x3aee0e,_0x307f2a[_0x08fe('0x10')]['message']);return _0x4b6b76(_0x307f2a[_0x08fe('0x10')]['message']);}logger[_0x08fe('0x10')](_0x08fe('0xb'),_0x3aee0e,_0x307f2a['error'][_0x08fe('0x12')]);return _0x4ffc4b(_0x307f2a[_0x08fe('0x10')][_0x08fe('0x12')]);}else{logger['info'](_0x08fe('0xb'),_0x3aee0e,_0x08fe('0xc'));_0x4ffc4b(_0x307f2a['result'][_0x08fe('0x12')]);}})[_0x08fe('0x13')](function(_0x33cd42){logger[_0x08fe('0x10')](_0x08fe('0xb'),_0x3aee0e,_0x33cd42);_0x4b6b76(_0x33cd42);});});}exports[_0x08fe('0x14')]=function(_0x598038){var _0x372b68=this;return new Promise(function(_0x2ffa0e,_0x313f02){return db[_0x08fe('0x15')][_0x08fe('0x16')]({'raw':_0x598038[_0x08fe('0x17')]?_0x598038[_0x08fe('0x17')][_0x08fe('0x18')]===undefined?!![]:![]:!![],'where':_0x598038[_0x08fe('0x17')]?_0x598038[_0x08fe('0x17')][_0x08fe('0x19')]||null:null,'attributes':_0x598038['options']?_0x598038[_0x08fe('0x17')]['attributes']||null:null,'limit':_0x598038[_0x08fe('0x17')]?_0x598038['options'][_0x08fe('0x1a')]||null:null,'include':_0x598038['options']?_0x598038['options']['include']?_[_0x08fe('0x1b')](_0x598038['options'][_0x08fe('0x1c')],function(_0x2d66db){return{'model':db[_0x2d66db[_0x08fe('0x1d')]],'as':_0x2d66db['as'],'attributes':_0x2d66db[_0x08fe('0x1e')],'include':_0x2d66db['include']?_[_0x08fe('0x1b')](_0x2d66db[_0x08fe('0x1c')],function(_0x5aa90c){return{'model':db[_0x5aa90c['model']],'as':_0x5aa90c['as'],'attributes':_0x5aa90c[_0x08fe('0x1e')],'include':_0x5aa90c[_0x08fe('0x1c')]?_[_0x08fe('0x1b')](_0x5aa90c[_0x08fe('0x1c')],function(_0x2a4fca){return{'model':db[_0x2a4fca[_0x08fe('0x1d')]],'as':_0x2a4fca['as'],'attributes':_0x2a4fca[_0x08fe('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x08fe('0x1f')](function(_0x555199){logger['info'](_0x08fe('0x14'),_0x598038);logger[_0x08fe('0xd')](_0x08fe('0x14'),_0x598038,JSON[_0x08fe('0xf')](_0x555199));_0x2ffa0e(_0x555199);})[_0x08fe('0x13')](function(_0x2d3a27){logger['error'](_0x08fe('0x14'),_0x2d3a27[_0x08fe('0x12')],_0x598038);_0x313f02(_0x372b68[_0x08fe('0x10')](0x1f4,_0x2d3a27['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 739b6d4..6240ac0 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7a54,0x106));var _0x47a5=function(_0x593ea8,_0x586b5e){_0x593ea8=_0x593ea8-0x0;var _0x314731=_0x7a54[_0x593ea8];return _0x314731;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x4421d2,_0x24c324){_0x4421d2=_0x4421d2-0x0;var _0x3b7d2a=_0x7a54[_0x4421d2];return _0x3b7d2a;};'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 6e32dc3..355785d 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 _0xb9a7=['BOOLEAN','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9a7,0x112));var _0x7b9a=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xb9a7[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x7b9a('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x7b9a('0x1')]},'authentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b9a('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf45e=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0xcd7663,_0x5b96f3){var _0x406e6c=function(_0x2051e0){while(--_0x2051e0){_0xcd7663['push'](_0xcd7663['shift']());}};_0x406e6c(++_0x5b96f3);}(_0xf45e,0x115));var _0xef45=function(_0x1443d6,_0x476eb6){_0x1443d6=_0x1443d6-0x0;var _0x42dece=_0xf45e[_0x1443d6];return _0x42dece;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'description':{'type':Sequelize[_0xef45('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xef45('0x1')]},'pass':{'type':Sequelize[_0xef45('0x1')]},'port':{'type':Sequelize[_0xef45('0x2')]},'secure':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xef45('0x1')]},'authentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xef45('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ab5496b..5213bad 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 _0xf6bf=['length','nolimit','order','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','catch','show','params','include','body','update','find','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4d247c,_0x3dff9e){var _0x42c60c=function(_0x399acd){while(--_0x399acd){_0x4d247c['push'](_0x4d247c['shift']());}};_0x42c60c(++_0x3dff9e);}(_0xf6bf,0x16c));var _0xff6b=function(_0x215c9a,_0x3dc014){_0x215c9a=_0x215c9a-0x0;var _0xdc5b49=_0xf6bf[_0x215c9a];return _0xdc5b49;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xff6b('0x0'));var jsonpatch=require(_0xff6b('0x1'));var rp=require('request-promise');var moment=require(_0xff6b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xff6b('0x3'));var util=require(_0xff6b('0x4'));var path=require('path');var sox=require(_0xff6b('0x5'));var csv=require(_0xff6b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff6b('0x7'));var _=require(_0xff6b('0x8'));var squel=require(_0xff6b('0x9'));var crypto=require('crypto');var jsforce=require(_0xff6b('0xa'));var deskjs=require(_0xff6b('0xb'));var toCsv=require(_0xff6b('0x6'));var querystring=require(_0xff6b('0xc'));var Papa=require('papaparse');var Redis=require(_0xff6b('0xd'));var authService=require(_0xff6b('0xe'));var qs=require(_0xff6b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff6b('0x10'))(_0xff6b('0x11'));var utils=require(_0xff6b('0x12'));var config=require(_0xff6b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xff6b('0x14'))['db'];function respondWithStatusCode(_0x34deb9,_0x5b2d7c){_0x5b2d7c=_0x5b2d7c||0xcc;return function(_0x11fa28){if(_0x11fa28){return _0x34deb9[_0xff6b('0x15')](_0x5b2d7c);}return _0x34deb9['status'](_0x5b2d7c)[_0xff6b('0x16')]();};}function respondWithResult(_0x39df3c,_0x5a9506){_0x5a9506=_0x5a9506||0xc8;return function(_0x252264){if(_0x252264){return _0x39df3c['status'](_0x5a9506)['json'](_0x252264);}};}function respondWithFilteredResult(_0x368efa,_0x5f5132){return function(_0x28a958){if(_0x28a958){var _0x2cfb8c=typeof _0x5f5132[_0xff6b('0x17')]===_0xff6b('0x18')&&typeof _0x5f5132[_0xff6b('0x19')]===_0xff6b('0x18');var _0x5607e8=_0x28a958['count'];var _0x38bea6=_0x2cfb8c?0x0:_0x5f5132[_0xff6b('0x17')];var _0x4b6105=_0x2cfb8c?_0x28a958[_0xff6b('0x1a')]:_0x5f5132[_0xff6b('0x17')]+_0x5f5132[_0xff6b('0x19')];var _0x5c963b;if(_0x4b6105>=_0x5607e8){_0x4b6105=_0x5607e8;_0x5c963b=0xc8;}else{_0x5c963b=0xce;}_0x368efa['status'](_0x5c963b);return _0x368efa[_0xff6b('0x1b')](_0xff6b('0x1c'),_0x38bea6+'-'+_0x4b6105+'/'+_0x5607e8)['json'](_0x28a958);}return null;};}function patchUpdates(_0x42241d){return function(_0x4e3ac7){try{jsonpatch[_0xff6b('0x1d')](_0x4e3ac7,_0x42241d,!![]);}catch(_0x286d07){return BPromise[_0xff6b('0x1e')](_0x286d07);}return _0x4e3ac7[_0xff6b('0x1f')]();};}function saveUpdates(_0x1688a5,_0x34119e){return function(_0x2fc2da){if(_0x2fc2da){return _0x2fc2da['update'](_0x1688a5)[_0xff6b('0x20')](function(_0x102c57){return _0x102c57;});}return null;};}function removeEntity(_0x44cf7b,_0x17212f){return function(_0x3ce248){if(_0x3ce248){return _0x3ce248[_0xff6b('0x21')]()['then'](function(){_0x44cf7b['status'](0xcc)[_0xff6b('0x16')]();});}};}function handleEntityNotFound(_0x5590d0,_0x4a8b55){return function(_0x4fbdd1){if(!_0x4fbdd1){_0x5590d0[_0xff6b('0x15')](0x194);}return _0x4fbdd1;};}function handleError(_0x232bc6,_0x45592f){_0x45592f=_0x45592f||0x1f4;return function(_0x4d4d4f){logger[_0xff6b('0x22')](_0x4d4d4f[_0xff6b('0x23')]);if(_0x4d4d4f['name']){delete _0x4d4d4f['name'];}_0x232bc6['status'](_0x45592f)[_0xff6b('0x24')](_0x4d4d4f);};}exports[_0xff6b('0x25')]=function(_0x2e9475,_0x433925){var _0x204551={},_0x554bbc={},_0x454d3d={'count':0x0,'rows':[]};var _0xf9bc67=_[_0xff6b('0x26')](db[_0xff6b('0x27')][_0xff6b('0x28')],function(_0x47590f){return{'name':_0x47590f['fieldName'],'type':_0x47590f[_0xff6b('0x29')][_0xff6b('0x2a')]};});_0x554bbc[_0xff6b('0x2b')]=_[_0xff6b('0x26')](_0xf9bc67,'name');_0x554bbc[_0xff6b('0x2c')]=_[_0xff6b('0x2d')](_0x2e9475['query']);_0x554bbc[_0xff6b('0x2e')]=_[_0xff6b('0x2f')](_0x554bbc[_0xff6b('0x2b')],_0x554bbc['query']);_0x204551[_0xff6b('0x30')]=_[_0xff6b('0x2f')](_0x554bbc[_0xff6b('0x2b')],qs[_0xff6b('0x31')](_0x2e9475[_0xff6b('0x2c')][_0xff6b('0x31')]));_0x204551[_0xff6b('0x30')]=_0x204551['attributes'][_0xff6b('0x32')]?_0x204551['attributes']:_0x554bbc[_0xff6b('0x2b')];if(!_0x2e9475['query']['hasOwnProperty'](_0xff6b('0x33'))){_0x204551[_0xff6b('0x19')]=qs[_0xff6b('0x19')](_0x2e9475[_0xff6b('0x2c')]['limit']);_0x204551[_0xff6b('0x17')]=qs['offset'](_0x2e9475['query']['offset']);}_0x204551[_0xff6b('0x34')]=qs['sort'](_0x2e9475[_0xff6b('0x2c')]['sort']);_0x204551[_0xff6b('0x35')]=qs[_0xff6b('0x2e')](_[_0xff6b('0x36')](_0x2e9475[_0xff6b('0x2c')],_0x554bbc[_0xff6b('0x2e')]),_0xf9bc67);if(_0x2e9475[_0xff6b('0x2c')][_0xff6b('0x37')]){_0x204551[_0xff6b('0x35')]=_[_0xff6b('0x38')](_0x204551[_0xff6b('0x35')],{'$or':_[_0xff6b('0x26')](_0xf9bc67,function(_0x5146f7){if(_0x5146f7['type']!==_0xff6b('0x39')){var _0x3454ed={};_0x3454ed[_0x5146f7[_0xff6b('0x3a')]]={'$like':'%'+_0x2e9475['query'][_0xff6b('0x37')]+'%'};return _0x3454ed;}})});}_0x204551=_[_0xff6b('0x38')]({},_0x204551,_0x2e9475[_0xff6b('0x3b')]);var _0x23cd19={'where':_0x204551[_0xff6b('0x35')]};return db[_0xff6b('0x27')][_0xff6b('0x1a')](_0x23cd19)['then'](function(_0x428613){_0x454d3d[_0xff6b('0x1a')]=_0x428613;if(_0x2e9475[_0xff6b('0x2c')][_0xff6b('0x3c')]){_0x204551['include']=[{'all':!![]}];}return db[_0xff6b('0x27')][_0xff6b('0x3d')](_0x204551);})[_0xff6b('0x20')](function(_0x2145a3){_0x454d3d['rows']=_0x2145a3;return _0x454d3d;})[_0xff6b('0x20')](respondWithFilteredResult(_0x433925,_0x204551))[_0xff6b('0x3e')](handleError(_0x433925,null));};exports[_0xff6b('0x3f')]=function(_0x44d134,_0x49fa5e){var _0x57d37f={'raw':!![],'where':{'id':_0x44d134[_0xff6b('0x40')]['id']}},_0x2af2e4={};_0x2af2e4[_0xff6b('0x2b')]=_[_0xff6b('0x2d')](db[_0xff6b('0x27')][_0xff6b('0x28')]);_0x2af2e4[_0xff6b('0x2c')]=_[_0xff6b('0x2d')](_0x44d134[_0xff6b('0x2c')]);_0x2af2e4[_0xff6b('0x2e')]=_[_0xff6b('0x2f')](_0x2af2e4[_0xff6b('0x2b')],_0x2af2e4[_0xff6b('0x2c')]);_0x57d37f[_0xff6b('0x30')]=_[_0xff6b('0x2f')](_0x2af2e4[_0xff6b('0x2b')],qs[_0xff6b('0x31')](_0x44d134[_0xff6b('0x2c')]['fields']));_0x57d37f[_0xff6b('0x30')]=_0x57d37f['attributes'][_0xff6b('0x32')]?_0x57d37f[_0xff6b('0x30')]:_0x2af2e4[_0xff6b('0x2b')];if(_0x44d134[_0xff6b('0x2c')][_0xff6b('0x3c')]){_0x57d37f[_0xff6b('0x41')]=[{'all':!![]}];}_0x57d37f=_[_0xff6b('0x38')]({},_0x57d37f,_0x44d134['options']);return db[_0xff6b('0x27')]['find'](_0x57d37f)[_0xff6b('0x20')](handleEntityNotFound(_0x49fa5e,null))['then'](respondWithResult(_0x49fa5e,null))[_0xff6b('0x3e')](handleError(_0x49fa5e,null));};exports['create']=function(_0x3b9b94,_0x564761){return db[_0xff6b('0x27')]['create'](_0x3b9b94[_0xff6b('0x42')],{})[_0xff6b('0x20')](respondWithResult(_0x564761,0xc9))[_0xff6b('0x3e')](handleError(_0x564761,null));};exports[_0xff6b('0x43')]=function(_0x587fbd,_0x26aba1){if(_0x587fbd[_0xff6b('0x42')]['id']){delete _0x587fbd[_0xff6b('0x42')]['id'];}return db['MailServerOut'][_0xff6b('0x44')]({'where':{'id':_0x587fbd['params']['id']}})[_0xff6b('0x20')](handleEntityNotFound(_0x26aba1,null))[_0xff6b('0x20')](saveUpdates(_0x587fbd[_0xff6b('0x42')],null))[_0xff6b('0x20')](respondWithResult(_0x26aba1,null))['catch'](handleError(_0x26aba1,null));};exports[_0xff6b('0x21')]=function(_0x399c02,_0x158565){return db[_0xff6b('0x27')][_0xff6b('0x44')]({'where':{'id':_0x399c02[_0xff6b('0x40')]['id']}})[_0xff6b('0x20')](handleEntityNotFound(_0x158565,null))[_0xff6b('0x20')](removeEntity(_0x158565,null))[_0xff6b('0x3e')](handleError(_0x158565,null));}; \ No newline at end of file +var _0x9b18=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','MailServerOut','includeAll','params','include','find','create','body','catch','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils'];(function(_0x4353cd,_0x45e37e){var _0xa3479e=function(_0x546ae3){while(--_0x546ae3){_0x4353cd['push'](_0x4353cd['shift']());}};_0xa3479e(++_0x45e37e);}(_0x9b18,0x152));var _0x89b1=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x9b18[_0x107f10];return _0x811cab;};'use strict';var emlformat=require(_0x89b1('0x0'));var rimraf=require(_0x89b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89b1('0x2'));var rp=require(_0x89b1('0x3'));var moment=require(_0x89b1('0x4'));var BPromise=require(_0x89b1('0x5'));var Mustache=require(_0x89b1('0x6'));var util=require(_0x89b1('0x7'));var path=require(_0x89b1('0x8'));var sox=require(_0x89b1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89b1('0xa'));var _=require(_0x89b1('0xb'));var squel=require(_0x89b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x89b1('0xd'));var deskjs=require(_0x89b1('0xe'));var toCsv=require(_0x89b1('0xf'));var querystring=require(_0x89b1('0x10'));var Papa=require('papaparse');var Redis=require(_0x89b1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x89b1('0x12'));var as=require(_0x89b1('0x13'));var hardwareService=require(_0x89b1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x89b1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x89b1('0x16'));var db=require(_0x89b1('0x17'))['db'];function respondWithStatusCode(_0x141026,_0x472fde){_0x472fde=_0x472fde||0xcc;return function(_0x337195){if(_0x337195){return _0x141026[_0x89b1('0x18')](_0x472fde);}return _0x141026[_0x89b1('0x19')](_0x472fde)['end']();};}function respondWithResult(_0x480098,_0x4ab391){_0x4ab391=_0x4ab391||0xc8;return function(_0x383e77){if(_0x383e77){return _0x480098[_0x89b1('0x19')](_0x4ab391)[_0x89b1('0x1a')](_0x383e77);}};}function respondWithFilteredResult(_0x5c8322,_0x5e6882){return function(_0x29fbdb){if(_0x29fbdb){var _0x9285b7=typeof _0x5e6882[_0x89b1('0x1b')]===_0x89b1('0x1c')&&typeof _0x5e6882['limit']===_0x89b1('0x1c');var _0x39eca1=_0x29fbdb[_0x89b1('0x1d')];var _0x2c5c3f=_0x9285b7?0x0:_0x5e6882[_0x89b1('0x1b')];var _0x4facec=_0x9285b7?_0x29fbdb[_0x89b1('0x1d')]:_0x5e6882[_0x89b1('0x1b')]+_0x5e6882['limit'];var _0x2a561c;if(_0x4facec>=_0x39eca1){_0x4facec=_0x39eca1;_0x2a561c=0xc8;}else{_0x2a561c=0xce;}_0x5c8322[_0x89b1('0x19')](_0x2a561c);return _0x5c8322[_0x89b1('0x1e')]('Content-Range',_0x2c5c3f+'-'+_0x4facec+'/'+_0x39eca1)[_0x89b1('0x1a')](_0x29fbdb);}return null;};}function patchUpdates(_0x50fd09){return function(_0xab8084){try{jsonpatch[_0x89b1('0x1f')](_0xab8084,_0x50fd09,!![]);}catch(_0x305ad6){return BPromise['reject'](_0x305ad6);}return _0xab8084[_0x89b1('0x20')]();};}function saveUpdates(_0x50619e,_0x4de946){return function(_0x693bd2){if(_0x693bd2){return _0x693bd2[_0x89b1('0x21')](_0x50619e)[_0x89b1('0x22')](function(_0x383680){return _0x383680;});}return null;};}function removeEntity(_0x240548,_0x33a00f){return function(_0xad08ee){if(_0xad08ee){return _0xad08ee['destroy']()[_0x89b1('0x22')](function(){_0x240548[_0x89b1('0x19')](0xcc)[_0x89b1('0x23')]();});}};}function handleEntityNotFound(_0x28bd99,_0x25747a){return function(_0x288c14){if(!_0x288c14){_0x28bd99[_0x89b1('0x18')](0x194);}return _0x288c14;};}function handleError(_0x2b9bee,_0x4f39fd){_0x4f39fd=_0x4f39fd||0x1f4;return function(_0xa9cae4){logger[_0x89b1('0x24')](_0xa9cae4[_0x89b1('0x25')]);if(_0xa9cae4[_0x89b1('0x26')]){delete _0xa9cae4['name'];}_0x2b9bee[_0x89b1('0x19')](_0x4f39fd)[_0x89b1('0x27')](_0xa9cae4);};}exports[_0x89b1('0x28')]=function(_0x165185,_0xbbba16){var _0x21c8e7={},_0x1ec61a={},_0x150b9f={'count':0x0,'rows':[]};var _0x4c1c76=_[_0x89b1('0x29')](db['MailServerOut'][_0x89b1('0x2a')],function(_0xd02f6d){return{'name':_0xd02f6d[_0x89b1('0x2b')],'type':_0xd02f6d['type'][_0x89b1('0x2c')]};});_0x1ec61a[_0x89b1('0x2d')]=_[_0x89b1('0x29')](_0x4c1c76,'name');_0x1ec61a[_0x89b1('0x2e')]=_[_0x89b1('0x2f')](_0x165185['query']);_0x1ec61a[_0x89b1('0x30')]=_['intersection'](_0x1ec61a['model'],_0x1ec61a[_0x89b1('0x2e')]);_0x21c8e7[_0x89b1('0x31')]=_[_0x89b1('0x32')](_0x1ec61a[_0x89b1('0x2d')],qs[_0x89b1('0x33')](_0x165185['query']['fields']));_0x21c8e7[_0x89b1('0x31')]=_0x21c8e7[_0x89b1('0x31')][_0x89b1('0x34')]?_0x21c8e7[_0x89b1('0x31')]:_0x1ec61a[_0x89b1('0x2d')];if(!_0x165185[_0x89b1('0x2e')][_0x89b1('0x35')](_0x89b1('0x36'))){_0x21c8e7[_0x89b1('0x37')]=qs[_0x89b1('0x37')](_0x165185[_0x89b1('0x2e')][_0x89b1('0x37')]);_0x21c8e7[_0x89b1('0x1b')]=qs['offset'](_0x165185['query'][_0x89b1('0x1b')]);}_0x21c8e7[_0x89b1('0x38')]=qs[_0x89b1('0x39')](_0x165185[_0x89b1('0x2e')][_0x89b1('0x39')]);_0x21c8e7[_0x89b1('0x3a')]=qs['filters'](_[_0x89b1('0x3b')](_0x165185[_0x89b1('0x2e')],_0x1ec61a[_0x89b1('0x30')]),_0x4c1c76);if(_0x165185['query']['filter']){_0x21c8e7[_0x89b1('0x3a')]=_['merge'](_0x21c8e7[_0x89b1('0x3a')],{'$or':_['map'](_0x4c1c76,function(_0x3d4752){if(_0x3d4752['type']!=='VIRTUAL'){var _0x226da6={};_0x226da6[_0x3d4752[_0x89b1('0x26')]]={'$like':'%'+_0x165185[_0x89b1('0x2e')][_0x89b1('0x3c')]+'%'};return _0x226da6;}})});}_0x21c8e7=_[_0x89b1('0x3d')]({},_0x21c8e7,_0x165185[_0x89b1('0x3e')]);var _0xfa6a0b={'where':_0x21c8e7[_0x89b1('0x3a')]};return db[_0x89b1('0x3f')][_0x89b1('0x1d')](_0xfa6a0b)['then'](function(_0x34b9b8){_0x150b9f[_0x89b1('0x1d')]=_0x34b9b8;if(_0x165185[_0x89b1('0x2e')][_0x89b1('0x40')]){_0x21c8e7['include']=[{'all':!![]}];}return db[_0x89b1('0x3f')]['findAll'](_0x21c8e7);})[_0x89b1('0x22')](function(_0x172cd1){_0x150b9f['rows']=_0x172cd1;return _0x150b9f;})[_0x89b1('0x22')](respondWithFilteredResult(_0xbbba16,_0x21c8e7))['catch'](handleError(_0xbbba16,null));};exports['show']=function(_0x3e62b7,_0x41cf1a){var _0x8eac34={'raw':!![],'where':{'id':_0x3e62b7[_0x89b1('0x41')]['id']}},_0x1f4518={};_0x1f4518[_0x89b1('0x2d')]=_[_0x89b1('0x2f')](db[_0x89b1('0x3f')][_0x89b1('0x2a')]);_0x1f4518[_0x89b1('0x2e')]=_[_0x89b1('0x2f')](_0x3e62b7[_0x89b1('0x2e')]);_0x1f4518['filters']=_[_0x89b1('0x32')](_0x1f4518[_0x89b1('0x2d')],_0x1f4518['query']);_0x8eac34[_0x89b1('0x31')]=_[_0x89b1('0x32')](_0x1f4518[_0x89b1('0x2d')],qs[_0x89b1('0x33')](_0x3e62b7[_0x89b1('0x2e')]['fields']));_0x8eac34['attributes']=_0x8eac34['attributes'][_0x89b1('0x34')]?_0x8eac34[_0x89b1('0x31')]:_0x1f4518[_0x89b1('0x2d')];if(_0x3e62b7[_0x89b1('0x2e')][_0x89b1('0x40')]){_0x8eac34[_0x89b1('0x42')]=[{'all':!![]}];}_0x8eac34=_[_0x89b1('0x3d')]({},_0x8eac34,_0x3e62b7['options']);return db[_0x89b1('0x3f')][_0x89b1('0x43')](_0x8eac34)['then'](handleEntityNotFound(_0x41cf1a,null))[_0x89b1('0x22')](respondWithResult(_0x41cf1a,null))['catch'](handleError(_0x41cf1a,null));};exports[_0x89b1('0x44')]=function(_0xb0c7f4,_0x4ffd31){return db[_0x89b1('0x3f')]['create'](_0xb0c7f4[_0x89b1('0x45')],{})[_0x89b1('0x22')](respondWithResult(_0x4ffd31,0xc9))[_0x89b1('0x46')](handleError(_0x4ffd31,null));};exports[_0x89b1('0x21')]=function(_0x309b87,_0x596428){if(_0x309b87[_0x89b1('0x45')]['id']){delete _0x309b87[_0x89b1('0x45')]['id'];}return db[_0x89b1('0x3f')][_0x89b1('0x43')]({'where':{'id':_0x309b87[_0x89b1('0x41')]['id']}})[_0x89b1('0x22')](handleEntityNotFound(_0x596428,null))[_0x89b1('0x22')](saveUpdates(_0x309b87['body'],null))[_0x89b1('0x22')](respondWithResult(_0x596428,null))[_0x89b1('0x46')](handleError(_0x596428,null));};exports[_0x89b1('0x47')]=function(_0x16d825,_0x4b484a){return db['MailServerOut'][_0x89b1('0x43')]({'where':{'id':_0x16d825[_0x89b1('0x41')]['id']}})[_0x89b1('0x22')](handleEntityNotFound(_0x4b484a,null))['then'](removeEntity(_0x4b484a,null))[_0x89b1('0x46')](handleError(_0x4b484a,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index cea9bd1..57cf74d 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 _0x5952=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define','MailServerOut','mail_servers_out'];(function(_0x2f4069,_0x74eb6c){var _0x4e5d90=function(_0x56fedf){while(--_0x56fedf){_0x2f4069['push'](_0x2f4069['shift']());}};_0x4e5d90(++_0x74eb6c);}(_0x5952,0x1ad));var _0x2595=function(_0x5e7f3e,_0x3ff220){_0x5e7f3e=_0x5e7f3e-0x0;var _0x185433=_0x5952[_0x5e7f3e];return _0x185433;};'use strict';var _=require(_0x2595('0x0'));var util=require(_0x2595('0x1'));var logger=require(_0x2595('0x2'))(_0x2595('0x3'));var moment=require('moment');var BPromise=require(_0x2595('0x4'));var rp=require(_0x2595('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2595('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerOut.attributes');module[_0x2595('0x7')]=function(_0x42ceb9,_0x4df12f){return _0x42ceb9[_0x2595('0x8')](_0x2595('0x9'),attributes,{'tableName':_0x2595('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc406=['MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x528ef8,_0x1b1681){var _0x68c11b=function(_0x22ac51){while(--_0x22ac51){_0x528ef8['push'](_0x528ef8['shift']());}};_0x68c11b(++_0x1b1681);}(_0xc406,0x10a));var _0x6c40=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc406[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6c40('0x0'));var util=require(_0x6c40('0x1'));var logger=require('../../config/logger')(_0x6c40('0x2'));var moment=require(_0x6c40('0x3'));var BPromise=require(_0x6c40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6c40('0x5'));var config=require(_0x6c40('0x6'));var attributes=require(_0x6c40('0x7'));module[_0x6c40('0x8')]=function(_0x246279,_0x53ca70){return _0x246279[_0x6c40('0x9')](_0x6c40('0xa'),attributes,{'tableName':_0x6c40('0xb'),'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 aa547f9..ba7f992 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4ce6e2,_0x44422e){var _0x3cac36=function(_0x3e7d7e){while(--_0x3e7d7e){_0x4ce6e2['push'](_0x4ce6e2['shift']());}};_0x3cac36(++_0x44422e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26a377,_0x1a33cd){_0x26a377=_0x26a377-0x0;var _0x36fd0e=_0x5f2f[_0x26a377];return _0x36fd0e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x3cfa2b,_0x59ba17){_0x3cfa2b=_0x3cfa2b-0x0;var _0x41b61b=_0x7a54[_0x3cfa2b];return _0x41b61b;};'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 6e96965..f7be447 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 _0x85cf=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a1b43,_0x5180d7){var _0x25333f=function(_0x40929d){while(--_0x40929d){_0x5a1b43['push'](_0x5a1b43['shift']());}};_0x25333f(++_0x5180d7);}(_0x85cf,0x7e));var _0xf85c=function(_0x35d34d,_0x5ee3aa){_0x35d34d=_0x35d34d-0x0;var _0xc22a03=_0x85cf[_0x35d34d];return _0xc22a03;};'use strict';var multer=require(_0xf85c('0x0'));var util=require('util');var path=require(_0xf85c('0x1'));var timeout=require(_0xf85c('0x2'));var express=require(_0xf85c('0x3'));var router=express[_0xf85c('0x4')]();var fs_extra=require(_0xf85c('0x5'));var auth=require(_0xf85c('0x6'));var interaction=require(_0xf85c('0x7'));var config=require(_0xf85c('0x8'));var controller=require(_0xf85c('0x9'));router[_0xf85c('0xa')]('/',auth[_0xf85c('0xb')](),controller['index']);router[_0xf85c('0xa')](_0xf85c('0xc'),auth[_0xf85c('0xb')](),controller[_0xf85c('0xd')]);router[_0xf85c('0xa')](_0xf85c('0xe'),auth[_0xf85c('0xb')](),controller[_0xf85c('0xf')]);router[_0xf85c('0x10')]('/',auth[_0xf85c('0xb')](),controller[_0xf85c('0x11')]);router[_0xf85c('0x12')](_0xf85c('0xe'),auth[_0xf85c('0xb')](),controller['update']);router[_0xf85c('0x13')](_0xf85c('0xe'),auth[_0xf85c('0xb')](),controller[_0xf85c('0x14')]);module[_0xf85c('0x15')]=router; \ No newline at end of file +var _0x37c9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x279835,_0x5bb907){var _0x28a2a2=function(_0x3142d1){while(--_0x3142d1){_0x279835['push'](_0x279835['shift']());}};_0x28a2a2(++_0x5bb907);}(_0x37c9,0xdb));var _0x937c=function(_0xae5de4,_0x35facf){_0xae5de4=_0xae5de4-0x0;var _0xc23112=_0x37c9[_0xae5de4];return _0xc23112;};'use strict';var multer=require(_0x937c('0x0'));var util=require(_0x937c('0x1'));var path=require(_0x937c('0x2'));var timeout=require(_0x937c('0x3'));var express=require(_0x937c('0x4'));var router=express[_0x937c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x937c('0x6'));var interaction=require(_0x937c('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x937c('0x8')](),controller[_0x937c('0x9')]);router['get']('/describe',auth[_0x937c('0x8')](),controller[_0x937c('0xa')]);router[_0x937c('0xb')](_0x937c('0xc'),auth[_0x937c('0x8')](),controller['show']);router[_0x937c('0xd')]('/',auth[_0x937c('0x8')](),controller[_0x937c('0xe')]);router[_0x937c('0xf')](_0x937c('0xc'),auth[_0x937c('0x8')](),controller[_0x937c('0x10')]);router[_0x937c('0x11')](_0x937c('0xc'),auth['isAuthenticated'](),controller[_0x937c('0x12')]);module[_0x937c('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 2a5176b..9ef6874 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 _0x06f4=['name','STRING','sequelize','exports'];(function(_0xd6682f,_0x1c2c64){var _0x51eb9a=function(_0x2f7126){while(--_0x2f7126){_0xd6682f['push'](_0xd6682f['shift']());}};_0x51eb9a(++_0x1c2c64);}(_0x06f4,0x136));var _0x406f=function(_0x287501,_0x54770b){_0x287501=_0x287501-0x0;var _0x519120=_0x06f4[_0x287501];return _0x519120;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x406f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x406f('0x3')]}}; \ No newline at end of file +var _0x4873=['exports','STRING','sequelize'];(function(_0x56571a,_0x2a94a6){var _0x29d2e7=function(_0x43833f){while(--_0x43833f){_0x56571a['push'](_0x56571a['shift']());}};_0x29d2e7(++_0x2a94a6);}(_0x4873,0x1df));var _0x3487=function(_0x231997,_0x1ff6de){_0x231997=_0x231997-0x0;var _0x1926f5=_0x4873[_0x231997];return _0x1926f5;};'use strict';var Sequelize=require(_0x3487('0x0'));module[_0x3487('0x1')]={'name':{'type':Sequelize[_0x3487('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3487('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index dbc2738..7896e85 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 _0x521d=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','keys','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x521d,0xe4));var _0xd521=function(_0x31b45d,_0xe904e4){_0x31b45d=_0x31b45d-0x0;var _0x1fd4c9=_0x521d[_0x31b45d];return _0x1fd4c9;};'use strict';var emlformat=require(_0xd521('0x0'));var rimraf=require(_0xd521('0x1'));var zipdir=require(_0xd521('0x2'));var jsonpatch=require(_0xd521('0x3'));var rp=require(_0xd521('0x4'));var moment=require(_0xd521('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd521('0x6'));var util=require(_0xd521('0x7'));var path=require(_0xd521('0x8'));var sox=require(_0xd521('0x9'));var csv=require(_0xd521('0xa'));var ejs=require(_0xd521('0xb'));var fs=require('fs');var fs_extra=require(_0xd521('0xc'));var _=require(_0xd521('0xd'));var squel=require('squel');var crypto=require(_0xd521('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd521('0xa'));var querystring=require(_0xd521('0xf'));var Papa=require(_0xd521('0x10'));var Redis=require('ioredis');var authService=require(_0xd521('0x11'));var qs=require(_0xd521('0x12'));var as=require(_0xd521('0x13'));var hardwareService=require(_0xd521('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd521('0x15'));var config=require(_0xd521('0x16'));var licenseUtil=require(_0xd521('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c354,_0x47471d){_0x47471d=_0x47471d||0xcc;return function(_0x4a4ca6){if(_0x4a4ca6){return _0x24c354[_0xd521('0x18')](_0x47471d);}return _0x24c354[_0xd521('0x19')](_0x47471d)[_0xd521('0x1a')]();};}function respondWithResult(_0x42ad1c,_0x1113f2){_0x1113f2=_0x1113f2||0xc8;return function(_0x1ae5cf){if(_0x1ae5cf){return _0x42ad1c[_0xd521('0x19')](_0x1113f2)[_0xd521('0x1b')](_0x1ae5cf);}};}function respondWithFilteredResult(_0xc8e472,_0x1eb8be){return function(_0x28d157){if(_0x28d157){var _0x27a00a=typeof _0x1eb8be['offset']===_0xd521('0x1c')&&typeof _0x1eb8be[_0xd521('0x1d')]===_0xd521('0x1c');var _0x420aaf=_0x28d157[_0xd521('0x1e')];var _0x4411f2=_0x27a00a?0x0:_0x1eb8be[_0xd521('0x1f')];var _0x1d51e1=_0x27a00a?_0x28d157[_0xd521('0x1e')]:_0x1eb8be['offset']+_0x1eb8be[_0xd521('0x1d')];var _0x27749b;if(_0x1d51e1>=_0x420aaf){_0x1d51e1=_0x420aaf;_0x27749b=0xc8;}else{_0x27749b=0xce;}_0xc8e472[_0xd521('0x19')](_0x27749b);return _0xc8e472[_0xd521('0x20')](_0xd521('0x21'),_0x4411f2+'-'+_0x1d51e1+'/'+_0x420aaf)[_0xd521('0x1b')](_0x28d157);}return null;};}function patchUpdates(_0x7c8fdb){return function(_0x51f0ac){try{jsonpatch[_0xd521('0x22')](_0x51f0ac,_0x7c8fdb,!![]);}catch(_0x2f021d){return BPromise[_0xd521('0x23')](_0x2f021d);}return _0x51f0ac[_0xd521('0x24')]();};}function saveUpdates(_0xd1b300,_0x1f5cf6){return function(_0x2fbc67){if(_0x2fbc67){return _0x2fbc67[_0xd521('0x25')](_0xd1b300)[_0xd521('0x26')](function(_0x47ed06){return _0x47ed06;});}return null;};}function removeEntity(_0x2ea942,_0x15f2b7){return function(_0x1534bd){if(_0x1534bd){return _0x1534bd[_0xd521('0x27')]()[_0xd521('0x26')](function(){_0x2ea942[_0xd521('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11568e,_0xcb8f8){return function(_0x86958a){if(!_0x86958a){_0x11568e['sendStatus'](0x194);}return _0x86958a;};}function handleError(_0x57e9e3,_0x457d57){_0x457d57=_0x457d57||0x1f4;return function(_0x5c7b80){logger[_0xd521('0x28')](_0x5c7b80[_0xd521('0x29')]);if(_0x5c7b80['name']){delete _0x5c7b80[_0xd521('0x2a')];}_0x57e9e3[_0xd521('0x19')](_0x457d57)[_0xd521('0x2b')](_0x5c7b80);};}exports[_0xd521('0x2c')]=function(_0x2e895e,_0x2d5562){var _0x37cbbe={},_0x4e7449={},_0x414d0b={'count':0x0,'rows':[]};var _0x3e8178=_[_0xd521('0x2d')](db[_0xd521('0x2e')][_0xd521('0x2f')],function(_0x5f34d3){return{'name':_0x5f34d3[_0xd521('0x30')],'type':_0x5f34d3['type'][_0xd521('0x31')]};});_0x4e7449['model']=_[_0xd521('0x2d')](_0x3e8178,'name');_0x4e7449['query']=_[_0xd521('0x32')](_0x2e895e['query']);_0x4e7449[_0xd521('0x33')]=_[_0xd521('0x34')](_0x4e7449['model'],_0x4e7449[_0xd521('0x35')]);_0x37cbbe['attributes']=_[_0xd521('0x34')](_0x4e7449[_0xd521('0x36')],qs['fields'](_0x2e895e[_0xd521('0x35')][_0xd521('0x37')]));_0x37cbbe[_0xd521('0x38')]=_0x37cbbe[_0xd521('0x38')][_0xd521('0x39')]?_0x37cbbe[_0xd521('0x38')]:_0x4e7449['model'];if(!_0x2e895e['query'][_0xd521('0x3a')](_0xd521('0x3b'))){_0x37cbbe['limit']=qs['limit'](_0x2e895e[_0xd521('0x35')]['limit']);_0x37cbbe[_0xd521('0x1f')]=qs[_0xd521('0x1f')](_0x2e895e[_0xd521('0x35')][_0xd521('0x1f')]);}_0x37cbbe[_0xd521('0x3c')]=qs['sort'](_0x2e895e['query'][_0xd521('0x3d')]);_0x37cbbe['where']=qs[_0xd521('0x33')](_['pick'](_0x2e895e['query'],_0x4e7449[_0xd521('0x33')]),_0x3e8178);if(_0x2e895e[_0xd521('0x35')][_0xd521('0x3e')]){_0x37cbbe['where']=_[_0xd521('0x3f')](_0x37cbbe[_0xd521('0x40')],{'$or':_[_0xd521('0x2d')](_0x3e8178,function(_0x45b381){if(_0x45b381[_0xd521('0x41')]!==_0xd521('0x42')){var _0x35822c={};_0x35822c[_0x45b381[_0xd521('0x2a')]]={'$like':'%'+_0x2e895e[_0xd521('0x35')][_0xd521('0x3e')]+'%'};return _0x35822c;}})});}_0x37cbbe=_[_0xd521('0x3f')]({},_0x37cbbe,_0x2e895e[_0xd521('0x43')]);var _0x17ebdf={'where':_0x37cbbe[_0xd521('0x40')]};return db[_0xd521('0x2e')]['count'](_0x17ebdf)[_0xd521('0x26')](function(_0x3b92aa){_0x414d0b[_0xd521('0x1e')]=_0x3b92aa;if(_0x2e895e[_0xd521('0x35')][_0xd521('0x44')]){_0x37cbbe[_0xd521('0x45')]=[{'all':!![]}];}return db[_0xd521('0x2e')][_0xd521('0x46')](_0x37cbbe);})[_0xd521('0x26')](function(_0x53a16f){_0x414d0b[_0xd521('0x47')]=_0x53a16f;return _0x414d0b;})[_0xd521('0x26')](respondWithFilteredResult(_0x2d5562,_0x37cbbe))[_0xd521('0x48')](handleError(_0x2d5562,null));};exports[_0xd521('0x49')]=function(_0x4d7893,_0x181c48){var _0x152f94={'raw':!![],'where':{'id':_0x4d7893[_0xd521('0x4a')]['id']}},_0x5737d1={};_0x5737d1[_0xd521('0x36')]=_[_0xd521('0x32')](db[_0xd521('0x2e')][_0xd521('0x2f')]);_0x5737d1['query']=_[_0xd521('0x32')](_0x4d7893[_0xd521('0x35')]);_0x5737d1['filters']=_['intersection'](_0x5737d1[_0xd521('0x36')],_0x5737d1[_0xd521('0x35')]);_0x152f94[_0xd521('0x38')]=_[_0xd521('0x34')](_0x5737d1[_0xd521('0x36')],qs[_0xd521('0x37')](_0x4d7893['query'][_0xd521('0x37')]));_0x152f94[_0xd521('0x38')]=_0x152f94['attributes']['length']?_0x152f94[_0xd521('0x38')]:_0x5737d1[_0xd521('0x36')];if(_0x4d7893[_0xd521('0x35')]['includeAll']){_0x152f94[_0xd521('0x45')]=[{'all':!![]}];}_0x152f94=_[_0xd521('0x3f')]({},_0x152f94,_0x4d7893[_0xd521('0x43')]);return db['MailSubstatus'][_0xd521('0x4b')](_0x152f94)[_0xd521('0x26')](handleEntityNotFound(_0x181c48,null))[_0xd521('0x26')](respondWithResult(_0x181c48,null))[_0xd521('0x48')](handleError(_0x181c48,null));};exports['create']=function(_0x1c0940,_0x410852){return db[_0xd521('0x2e')][_0xd521('0x4c')](_0x1c0940[_0xd521('0x4d')],{})[_0xd521('0x26')](respondWithResult(_0x410852,0xc9))[_0xd521('0x48')](handleError(_0x410852,null));};exports[_0xd521('0x25')]=function(_0x609b,_0x5d4003){if(_0x609b['body']['id']){delete _0x609b[_0xd521('0x4d')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x609b[_0xd521('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d4003,null))[_0xd521('0x26')](saveUpdates(_0x609b[_0xd521('0x4d')],null))[_0xd521('0x26')](respondWithResult(_0x5d4003,null))[_0xd521('0x48')](handleError(_0x5d4003,null));};exports['destroy']=function(_0x1b2f81,_0x474eda){return db[_0xd521('0x2e')][_0xd521('0x4b')]({'where':{'id':_0x1b2f81[_0xd521('0x4a')]['id']}})[_0xd521('0x26')](handleEntityNotFound(_0x474eda,null))[_0xd521('0x26')](removeEntity(_0x474eda,null))[_0xd521('0x48')](handleError(_0x474eda,null));};exports['describe']=function(_0x60a08e,_0x28258){return db[_0xd521('0x2e')]['describe']()['then'](respondWithResult(_0x28258,null))[_0xd521('0x48')](handleError(_0x28258,null));}; \ No newline at end of file +var _0x4d7e=['../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x246f92,_0xcf7bd4){var _0x2b8e7d=function(_0x9e8650){while(--_0x9e8650){_0x246f92['push'](_0x246f92['shift']());}};_0x2b8e7d(++_0xcf7bd4);}(_0x4d7e,0xba));var _0xe4d7=function(_0x5275e1,_0x11eae6){_0x5275e1=_0x5275e1-0x0;var _0x334a15=_0x4d7e[_0x5275e1];return _0x334a15;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe4d7('0x1'));var moment=require(_0xe4d7('0x2'));var BPromise=require(_0xe4d7('0x3'));var Mustache=require(_0xe4d7('0x4'));var util=require('util');var path=require(_0xe4d7('0x5'));var sox=require(_0xe4d7('0x6'));var csv=require(_0xe4d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4d7('0x8'));var squel=require(_0xe4d7('0x9'));var crypto=require(_0xe4d7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe4d7('0xb'));var toCsv=require(_0xe4d7('0x7'));var querystring=require(_0xe4d7('0xc'));var Papa=require('papaparse');var Redis=require(_0xe4d7('0xd'));var authService=require(_0xe4d7('0xe'));var qs=require(_0xe4d7('0xf'));var as=require(_0xe4d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe4d7('0x11'))(_0xe4d7('0x12'));var utils=require('../../config/utils');var config=require(_0xe4d7('0x13'));var licenseUtil=require(_0xe4d7('0x14'));var db=require(_0xe4d7('0x15'))['db'];function respondWithStatusCode(_0x3e2c23,_0x2f3483){_0x2f3483=_0x2f3483||0xcc;return function(_0x2576d5){if(_0x2576d5){return _0x3e2c23['sendStatus'](_0x2f3483);}return _0x3e2c23[_0xe4d7('0x16')](_0x2f3483)['end']();};}function respondWithResult(_0x43e422,_0xc14cc8){_0xc14cc8=_0xc14cc8||0xc8;return function(_0xd112e6){if(_0xd112e6){return _0x43e422[_0xe4d7('0x16')](_0xc14cc8)[_0xe4d7('0x17')](_0xd112e6);}};}function respondWithFilteredResult(_0x55220c,_0x343f20){return function(_0x1a337a){if(_0x1a337a){var _0x1622de=typeof _0x343f20[_0xe4d7('0x18')]===_0xe4d7('0x19')&&typeof _0x343f20[_0xe4d7('0x1a')]===_0xe4d7('0x19');var _0x2e3a0e=_0x1a337a[_0xe4d7('0x1b')];var _0x533759=_0x1622de?0x0:_0x343f20[_0xe4d7('0x18')];var _0xc557ef=_0x1622de?_0x1a337a[_0xe4d7('0x1b')]:_0x343f20[_0xe4d7('0x18')]+_0x343f20[_0xe4d7('0x1a')];var _0x2c0aa6;if(_0xc557ef>=_0x2e3a0e){_0xc557ef=_0x2e3a0e;_0x2c0aa6=0xc8;}else{_0x2c0aa6=0xce;}_0x55220c['status'](_0x2c0aa6);return _0x55220c[_0xe4d7('0x1c')](_0xe4d7('0x1d'),_0x533759+'-'+_0xc557ef+'/'+_0x2e3a0e)[_0xe4d7('0x17')](_0x1a337a);}return null;};}function patchUpdates(_0x1cfe84){return function(_0x3460a0){try{jsonpatch['apply'](_0x3460a0,_0x1cfe84,!![]);}catch(_0x1f804f){return BPromise['reject'](_0x1f804f);}return _0x3460a0[_0xe4d7('0x1e')]();};}function saveUpdates(_0x557e95,_0x2465aa){return function(_0x151126){if(_0x151126){return _0x151126[_0xe4d7('0x1f')](_0x557e95)['then'](function(_0xf4da9a){return _0xf4da9a;});}return null;};}function removeEntity(_0x2f5419,_0x15555c){return function(_0x2b6277){if(_0x2b6277){return _0x2b6277[_0xe4d7('0x20')]()[_0xe4d7('0x21')](function(){_0x2f5419[_0xe4d7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x325bf1,_0x10b11c){return function(_0x448fde){if(!_0x448fde){_0x325bf1[_0xe4d7('0x22')](0x194);}return _0x448fde;};}function handleError(_0xa27cbd,_0x14f3df){_0x14f3df=_0x14f3df||0x1f4;return function(_0x11ba63){logger[_0xe4d7('0x23')](_0x11ba63[_0xe4d7('0x24')]);if(_0x11ba63['name']){delete _0x11ba63['name'];}_0xa27cbd[_0xe4d7('0x16')](_0x14f3df)['send'](_0x11ba63);};}exports[_0xe4d7('0x25')]=function(_0x1a7655,_0x3f6252){var _0x1c6e06={},_0x248e5a={},_0x412859={'count':0x0,'rows':[]};var _0x498734=_[_0xe4d7('0x26')](db[_0xe4d7('0x27')][_0xe4d7('0x28')],function(_0x3adb29){return{'name':_0x3adb29[_0xe4d7('0x29')],'type':_0x3adb29[_0xe4d7('0x2a')][_0xe4d7('0x2b')]};});_0x248e5a[_0xe4d7('0x2c')]=_['map'](_0x498734,_0xe4d7('0x2d'));_0x248e5a[_0xe4d7('0x2e')]=_[_0xe4d7('0x2f')](_0x1a7655[_0xe4d7('0x2e')]);_0x248e5a['filters']=_[_0xe4d7('0x30')](_0x248e5a[_0xe4d7('0x2c')],_0x248e5a[_0xe4d7('0x2e')]);_0x1c6e06[_0xe4d7('0x31')]=_[_0xe4d7('0x30')](_0x248e5a['model'],qs[_0xe4d7('0x32')](_0x1a7655[_0xe4d7('0x2e')]['fields']));_0x1c6e06[_0xe4d7('0x31')]=_0x1c6e06['attributes']['length']?_0x1c6e06[_0xe4d7('0x31')]:_0x248e5a[_0xe4d7('0x2c')];if(!_0x1a7655['query']['hasOwnProperty'](_0xe4d7('0x33'))){_0x1c6e06[_0xe4d7('0x1a')]=qs[_0xe4d7('0x1a')](_0x1a7655[_0xe4d7('0x2e')][_0xe4d7('0x1a')]);_0x1c6e06[_0xe4d7('0x18')]=qs[_0xe4d7('0x18')](_0x1a7655[_0xe4d7('0x2e')]['offset']);}_0x1c6e06[_0xe4d7('0x34')]=qs[_0xe4d7('0x35')](_0x1a7655[_0xe4d7('0x2e')]['sort']);_0x1c6e06[_0xe4d7('0x36')]=qs[_0xe4d7('0x37')](_['pick'](_0x1a7655['query'],_0x248e5a[_0xe4d7('0x37')]),_0x498734);if(_0x1a7655[_0xe4d7('0x2e')][_0xe4d7('0x38')]){_0x1c6e06['where']=_[_0xe4d7('0x39')](_0x1c6e06['where'],{'$or':_[_0xe4d7('0x26')](_0x498734,function(_0x4ec1f4){if(_0x4ec1f4[_0xe4d7('0x2a')]!=='VIRTUAL'){var _0x4a6286={};_0x4a6286[_0x4ec1f4[_0xe4d7('0x2d')]]={'$like':'%'+_0x1a7655['query']['filter']+'%'};return _0x4a6286;}})});}_0x1c6e06=_[_0xe4d7('0x39')]({},_0x1c6e06,_0x1a7655[_0xe4d7('0x3a')]);var _0x3bb2cc={'where':_0x1c6e06[_0xe4d7('0x36')]};return db['MailSubstatus'][_0xe4d7('0x1b')](_0x3bb2cc)[_0xe4d7('0x21')](function(_0x8a4de9){_0x412859[_0xe4d7('0x1b')]=_0x8a4de9;if(_0x1a7655[_0xe4d7('0x2e')][_0xe4d7('0x3b')]){_0x1c6e06[_0xe4d7('0x3c')]=[{'all':!![]}];}return db[_0xe4d7('0x27')][_0xe4d7('0x3d')](_0x1c6e06);})[_0xe4d7('0x21')](function(_0x45a4b0){_0x412859['rows']=_0x45a4b0;return _0x412859;})[_0xe4d7('0x21')](respondWithFilteredResult(_0x3f6252,_0x1c6e06))[_0xe4d7('0x3e')](handleError(_0x3f6252,null));};exports['show']=function(_0x17e5b5,_0x3ced28){var _0x40aedd={'raw':!![],'where':{'id':_0x17e5b5[_0xe4d7('0x3f')]['id']}},_0x58c17b={};_0x58c17b['model']=_[_0xe4d7('0x2f')](db[_0xe4d7('0x27')][_0xe4d7('0x28')]);_0x58c17b[_0xe4d7('0x2e')]=_[_0xe4d7('0x2f')](_0x17e5b5[_0xe4d7('0x2e')]);_0x58c17b[_0xe4d7('0x37')]=_[_0xe4d7('0x30')](_0x58c17b[_0xe4d7('0x2c')],_0x58c17b['query']);_0x40aedd[_0xe4d7('0x31')]=_[_0xe4d7('0x30')](_0x58c17b['model'],qs[_0xe4d7('0x32')](_0x17e5b5[_0xe4d7('0x2e')][_0xe4d7('0x32')]));_0x40aedd[_0xe4d7('0x31')]=_0x40aedd[_0xe4d7('0x31')][_0xe4d7('0x40')]?_0x40aedd['attributes']:_0x58c17b[_0xe4d7('0x2c')];if(_0x17e5b5['query'][_0xe4d7('0x3b')]){_0x40aedd[_0xe4d7('0x3c')]=[{'all':!![]}];}_0x40aedd=_[_0xe4d7('0x39')]({},_0x40aedd,_0x17e5b5[_0xe4d7('0x3a')]);return db[_0xe4d7('0x27')][_0xe4d7('0x41')](_0x40aedd)[_0xe4d7('0x21')](handleEntityNotFound(_0x3ced28,null))[_0xe4d7('0x21')](respondWithResult(_0x3ced28,null))[_0xe4d7('0x3e')](handleError(_0x3ced28,null));};exports[_0xe4d7('0x42')]=function(_0x38fc24,_0x4bc534){return db[_0xe4d7('0x27')][_0xe4d7('0x42')](_0x38fc24[_0xe4d7('0x43')],{})[_0xe4d7('0x21')](respondWithResult(_0x4bc534,0xc9))[_0xe4d7('0x3e')](handleError(_0x4bc534,null));};exports['update']=function(_0x1f46ae,_0x44da0c){if(_0x1f46ae[_0xe4d7('0x43')]['id']){delete _0x1f46ae[_0xe4d7('0x43')]['id'];}return db[_0xe4d7('0x27')][_0xe4d7('0x41')]({'where':{'id':_0x1f46ae['params']['id']}})[_0xe4d7('0x21')](handleEntityNotFound(_0x44da0c,null))['then'](saveUpdates(_0x1f46ae['body'],null))[_0xe4d7('0x21')](respondWithResult(_0x44da0c,null))['catch'](handleError(_0x44da0c,null));};exports[_0xe4d7('0x20')]=function(_0x1db56d,_0x8ae31c){return db[_0xe4d7('0x27')][_0xe4d7('0x41')]({'where':{'id':_0x1db56d[_0xe4d7('0x3f')]['id']}})[_0xe4d7('0x21')](handleEntityNotFound(_0x8ae31c,null))[_0xe4d7('0x21')](removeEntity(_0x8ae31c,null))[_0xe4d7('0x3e')](handleError(_0x8ae31c,null));};exports[_0xe4d7('0x44')]=function(_0x3d88ab,_0x21a2fe){return db['MailSubstatus'][_0xe4d7('0x44')]()[_0xe4d7('0x21')](respondWithResult(_0x21a2fe,null))[_0xe4d7('0x3e')](handleError(_0x21a2fe,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 04e3aa1..62f4301 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 _0x5484=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x42bada,_0x4c1167){var _0x5e36ad=function(_0x3e4849){while(--_0x3e4849){_0x42bada['push'](_0x42bada['shift']());}};_0x5e36ad(++_0x4c1167);}(_0x5484,0x1f1));var _0x4548=function(_0x4498a1,_0x1da3b5){_0x4498a1=_0x4498a1-0x0;var _0x189c9f=_0x5484[_0x4498a1];return _0x189c9f;};'use strict';var EventEmitter=require(_0x4548('0x0'));var MailSubstatus=require(_0x4548('0x1'))['db'][_0x4548('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4548('0x3')](0x0);var events={'afterUpdate':_0x4548('0x4')};function emitEvent(_0xffda50){return function(_0x394500,_0x3cc7b1,_0x6bff12){MailSubstatusEvents[_0x4548('0x5')](_0xffda50+':'+_0x394500['id'],_0x394500);MailSubstatusEvents[_0x4548('0x5')](_0xffda50,_0x394500);_0x6bff12(null);};}for(var e in events){if(events[_0x4548('0x6')](e)){var event=events[e];MailSubstatus[_0x4548('0x7')](e,emitEvent(event));}}module[_0x4548('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xdd7a=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xdd7a,0xea));var _0xadd7=function(_0x6a9166,_0xeff23a){_0x6a9166=_0x6a9166-0x0;var _0xe5b2d4=_0xdd7a[_0x6a9166];return _0xe5b2d4;};'use strict';var EventEmitter=require(_0xadd7('0x0'));var MailSubstatus=require(_0xadd7('0x1'))['db'][_0xadd7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xadd7('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x515b13){return function(_0x294439,_0x29a01b,_0x543365){MailSubstatusEvents['emit'](_0x515b13+':'+_0x294439['id'],_0x294439);MailSubstatusEvents[_0xadd7('0x4')](_0x515b13,_0x294439);_0x543365(null);};}for(var e in events){if(events[_0xadd7('0x5')](e)){var event=events[e];MailSubstatus[_0xadd7('0x6')](e,emitEvent(event));}}module[_0xadd7('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4f1e6e3..bd34869 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 _0xd987=['models','define','mail_substatuses','update','name','mailSubstatus','then','./mailSubstatus.attributes','exports'];(function(_0x3ba57e,_0x2e6810){var _0x5d95cf=function(_0x8017a0){while(--_0x8017a0){_0x3ba57e['push'](_0x3ba57e['shift']());}};_0x5d95cf(++_0x2e6810);}(_0xd987,0x15d));var _0x7d98=function(_0x1b7226,_0x24cbd0){_0x1b7226=_0x1b7226-0x0;var _0x23f1bb=_0xd987[_0x1b7226];return _0x23f1bb;};'use strict';var attributes=require(_0x7d98('0x0'));module[_0x7d98('0x1')]=function(_0x3379e0){var _0x3c1f3c=_0x3379e0[_0x7d98('0x2')];return _0x3379e0[_0x7d98('0x3')]('MailSubstatus',attributes,{'tableName':_0x7d98('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b894a,_0x1592e0,_0x1341ee){return _0x3c1f3c['Condition'][_0x7d98('0x5')]({'value':_0x2b894a[_0x7d98('0x6')]},{'where':{'field':_0x7d98('0x7'),'value':_0x2b894a['_previousDataValues'][_0x7d98('0x6')]}})[_0x7d98('0x8')](function(){_0x1341ee();})['catch'](function(_0x59fbda){_0x1341ee(_0x59fbda);});}}});}; \ No newline at end of file +var _0x6335=['MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','then','catch','define'];(function(_0x3e52df,_0x3f347d){var _0x4ab783=function(_0x43e021){while(--_0x43e021){_0x3e52df['push'](_0x3e52df['shift']());}};_0x4ab783(++_0x3f347d);}(_0x6335,0x179));var _0x5633=function(_0x45a866,_0x26b837){_0x45a866=_0x45a866-0x0;var _0xe7accb=_0x6335[_0x45a866];return _0xe7accb;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0x151c30){var _0x16f9bb=_0x151c30['models'];return _0x151c30[_0x5633('0x0')](_0x5633('0x1'),attributes,{'tableName':_0x5633('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x54a2a7,_0x35c171,_0x55b6d6){return _0x16f9bb[_0x5633('0x3')][_0x5633('0x4')]({'value':_0x54a2a7['name']},{'where':{'field':_0x5633('0x5'),'value':_0x54a2a7[_0x5633('0x6')]['name']}})[_0x5633('0x7')](function(){_0x55b6d6();})[_0x5633('0x8')](function(_0x1f0328){_0x55b6d6(_0x1f0328);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 5ad917e..5df9658 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 _0xa783=['../../config/logger','rpc','../../config/environment','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x1caf55,_0x3c9817){var _0x5d6fd4=function(_0x1e6679){while(--_0x1e6679){_0x1caf55['push'](_0x1caf55['shift']());}};_0x5d6fd4(++_0x3c9817);}(_0xa783,0x1c5));var _0x3a78=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa783[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x3a78('0x0'));var util=require(_0x3a78('0x1'));var moment=require(_0x3a78('0x2'));var BPromise=require(_0x3a78('0x3'));var rs=require(_0x3a78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a78('0x5'))['db'];var utils=require(_0x3a78('0x6'));var logger=require(_0x3a78('0x7'))(_0x3a78('0x8'));var config=require(_0x3a78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a78('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6161,_0xdb6a30,_0x69fcb4){return new BPromise(function(_0x168842,_0x20922f){return client[_0x3a78('0xb')](_0x3b6161,_0x69fcb4)['then'](function(_0x4fd96a){logger[_0x3a78('0xc')](_0x3a78('0xd'),_0xdb6a30,_0x3a78('0xe'));logger[_0x3a78('0xf')](_0x3a78('0x10'),_0xdb6a30,_0x3a78('0xe'),JSON['stringify'](_0x4fd96a));if(_0x4fd96a[_0x3a78('0x11')]){if(_0x4fd96a[_0x3a78('0x11')]['code']===0x1f4){logger[_0x3a78('0x11')](_0x3a78('0xd'),_0xdb6a30,_0x4fd96a[_0x3a78('0x11')][_0x3a78('0x12')]);return _0x20922f(_0x4fd96a[_0x3a78('0x11')][_0x3a78('0x12')]);}logger['error'](_0x3a78('0xd'),_0xdb6a30,_0x4fd96a[_0x3a78('0x11')][_0x3a78('0x12')]);return _0x168842(_0x4fd96a[_0x3a78('0x11')][_0x3a78('0x12')]);}else{logger['info'](_0x3a78('0xd'),_0xdb6a30,_0x3a78('0xe'));_0x168842(_0x4fd96a[_0x3a78('0x13')][_0x3a78('0x12')]);}})['catch'](function(_0x44823f){logger[_0x3a78('0x11')](_0x3a78('0xd'),_0xdb6a30,_0x44823f);_0x20922f(_0x44823f);});});} \ No newline at end of file +var _0x9c48=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x2d486b,_0x5f213c){var _0x4291d1=function(_0x2cebcb){while(--_0x2cebcb){_0x2d486b['push'](_0x2d486b['shift']());}};_0x4291d1(++_0x5f213c);}(_0x9c48,0xa1));var _0x89c4=function(_0x540fb4,_0x464ce9){_0x540fb4=_0x540fb4-0x0;var _0x57de2c=_0x9c48[_0x540fb4];return _0x57de2c;};'use strict';var _=require(_0x89c4('0x0'));var util=require(_0x89c4('0x1'));var moment=require(_0x89c4('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c4('0x3'));var fs=require('fs');var Redis=require(_0x89c4('0x4'));var db=require(_0x89c4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89c4('0x6'));var config=require(_0x89c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x89c4('0x8')][_0x89c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d0303,_0x213a86,_0x30cdf1){return new BPromise(function(_0x7faf5,_0x26ab92){return client[_0x89c4('0xa')](_0x1d0303,_0x30cdf1)[_0x89c4('0xb')](function(_0xad4f2c){logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));logger[_0x89c4('0xf')](_0x89c4('0x10'),_0x213a86,_0x89c4('0xe'),JSON[_0x89c4('0x11')](_0xad4f2c));if(_0xad4f2c[_0x89c4('0x12')]){if(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x13')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x213a86,_0xad4f2c['error'][_0x89c4('0x14')]);return _0x26ab92(_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);}logger[_0x89c4('0x12')](_0x89c4('0xd'),_0x213a86,_0xad4f2c[_0x89c4('0x12')][_0x89c4('0x14')]);return _0x7faf5(_0xad4f2c['error'][_0x89c4('0x14')]);}else{logger[_0x89c4('0xc')](_0x89c4('0xd'),_0x213a86,_0x89c4('0xe'));_0x7faf5(_0xad4f2c['result'][_0x89c4('0x14')]);}})[_0x89c4('0x15')](function(_0xae1ed7){logger['error'](_0x89c4('0xd'),_0x213a86,_0xae1ed7);_0x26ab92(_0xae1ed7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 75f5560..1b20ffd 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 _0xbd13=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','exports','multer','util','path'];(function(_0x475eac,_0x2fa495){var _0x4ad158=function(_0x2d7c4c){while(--_0x2d7c4c){_0x475eac['push'](_0x475eac['shift']());}};_0x4ad158(++_0x2fa495);}(_0xbd13,0x177));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3bd1('0x0'));var util=require(_0x3bd1('0x1'));var path=require(_0x3bd1('0x2'));var timeout=require(_0x3bd1('0x3'));var express=require('express');var router=express[_0x3bd1('0x4')]();var fs_extra=require(_0x3bd1('0x5'));var auth=require(_0x3bd1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3bd1('0x7'));var controller=require(_0x3bd1('0x8'));router[_0x3bd1('0x9')]('/',auth[_0x3bd1('0xa')](),controller[_0x3bd1('0xb')]);router['get'](_0x3bd1('0xc'),auth['isAuthenticated'](),controller[_0x3bd1('0xd')]);router['get']('/:id',auth[_0x3bd1('0xa')](),controller[_0x3bd1('0xe')]);router[_0x3bd1('0xf')]('/',auth[_0x3bd1('0xa')](),controller[_0x3bd1('0x10')]);router[_0x3bd1('0x11')]('/:id',auth[_0x3bd1('0xa')](),controller[_0x3bd1('0x12')]);router[_0x3bd1('0x13')]('/:id',auth[_0x3bd1('0xa')](),controller['destroy']);module[_0x3bd1('0x14')]=router; \ No newline at end of file +var _0xe1ee=['path','express','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','delete','destroy','multer','util'];(function(_0x5784e6,_0xd4acb7){var _0x43c849=function(_0x10f365){while(--_0x10f365){_0x5784e6['push'](_0x5784e6['shift']());}};_0x43c849(++_0xd4acb7);}(_0xe1ee,0x1c9));var _0xee1e=function(_0x273e72,_0x2dedc3){_0x273e72=_0x273e72-0x0;var _0xeddc01=_0xe1ee[_0x273e72];return _0xeddc01;};'use strict';var multer=require(_0xee1e('0x0'));var util=require(_0xee1e('0x1'));var path=require(_0xee1e('0x2'));var timeout=require('connect-timeout');var express=require(_0xee1e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee1e('0x4'));var interaction=require(_0xee1e('0x5'));var config=require('../../config/environment');var controller=require(_0xee1e('0x6'));router['get']('/',auth[_0xee1e('0x7')](),controller[_0xee1e('0x8')]);router[_0xee1e('0x9')](_0xee1e('0xa'),auth[_0xee1e('0x7')](),controller['describe']);router[_0xee1e('0x9')](_0xee1e('0xb'),auth[_0xee1e('0x7')](),controller[_0xee1e('0xc')]);router[_0xee1e('0xd')]('/',auth[_0xee1e('0x7')](),controller[_0xee1e('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xee1e('0xf')](_0xee1e('0xb'),auth[_0xee1e('0x7')](),controller[_0xee1e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index b207d48..aa3892d 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x133fbc,_0x57016e){var _0x321783=function(_0x344152){while(--_0x344152){_0x133fbc['push'](_0x133fbc['shift']());}};_0x321783(++_0x57016e);}(_0xaa88,0x137));var _0x8aa8=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0xaa88[_0x158a58];return _0x4935d9;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2491af,_0x235274){var _0x2b2ae3=function(_0x1f43bb){while(--_0x1f43bb){_0x2491af['push'](_0x2491af['shift']());}};_0x2b2ae3(++_0x235274);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xf3cd[_0x496333];return _0x44256e;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2644ad3..97c751a 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 _0x5315=['pick','merge','filter','options','MailTransferReport','include','params','includeAll','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0x5315,0x13c));var _0x5531=function(_0x4e07ef,_0x420107){_0x4e07ef=_0x4e07ef-0x0;var _0x20cabc=_0x5315[_0x4e07ef];return _0x20cabc;};'use strict';var emlformat=require(_0x5531('0x0'));var rimraf=require(_0x5531('0x1'));var zipdir=require(_0x5531('0x2'));var jsonpatch=require(_0x5531('0x3'));var rp=require(_0x5531('0x4'));var moment=require(_0x5531('0x5'));var BPromise=require(_0x5531('0x6'));var Mustache=require(_0x5531('0x7'));var util=require(_0x5531('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5531('0x9'));var fs=require('fs');var fs_extra=require(_0x5531('0xa'));var _=require(_0x5531('0xb'));var squel=require(_0x5531('0xc'));var crypto=require(_0x5531('0xd'));var jsforce=require(_0x5531('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5531('0xf'));var querystring=require(_0x5531('0x10'));var Papa=require(_0x5531('0x11'));var Redis=require('ioredis');var authService=require(_0x5531('0x12'));var qs=require(_0x5531('0x13'));var as=require(_0x5531('0x14'));var hardwareService=require(_0x5531('0x15'));var logger=require(_0x5531('0x16'))(_0x5531('0x17'));var utils=require(_0x5531('0x18'));var config=require(_0x5531('0x19'));var licenseUtil=require(_0x5531('0x1a'));var db=require(_0x5531('0x1b'))['db'];function respondWithStatusCode(_0x38b8a3,_0x18b590){_0x18b590=_0x18b590||0xcc;return function(_0x59a7db){if(_0x59a7db){return _0x38b8a3[_0x5531('0x1c')](_0x18b590);}return _0x38b8a3[_0x5531('0x1d')](_0x18b590)[_0x5531('0x1e')]();};}function respondWithResult(_0x2a41bc,_0x30a5c8){_0x30a5c8=_0x30a5c8||0xc8;return function(_0x5434f8){if(_0x5434f8){return _0x2a41bc['status'](_0x30a5c8)[_0x5531('0x1f')](_0x5434f8);}};}function respondWithFilteredResult(_0x2f600b,_0x294a6f){return function(_0xa3f613){if(_0xa3f613){var _0x49ecd9=typeof _0x294a6f[_0x5531('0x20')]===_0x5531('0x21')&&typeof _0x294a6f[_0x5531('0x22')]===_0x5531('0x21');var _0x39c02a=_0xa3f613['count'];var _0x4f7d68=_0x49ecd9?0x0:_0x294a6f[_0x5531('0x20')];var _0x3070e0=_0x49ecd9?_0xa3f613[_0x5531('0x23')]:_0x294a6f[_0x5531('0x20')]+_0x294a6f[_0x5531('0x22')];var _0x5684ac;if(_0x3070e0>=_0x39c02a){_0x3070e0=_0x39c02a;_0x5684ac=0xc8;}else{_0x5684ac=0xce;}_0x2f600b[_0x5531('0x1d')](_0x5684ac);return _0x2f600b[_0x5531('0x24')](_0x5531('0x25'),_0x4f7d68+'-'+_0x3070e0+'/'+_0x39c02a)[_0x5531('0x1f')](_0xa3f613);}return null;};}function patchUpdates(_0x131809){return function(_0xdf5554){try{jsonpatch[_0x5531('0x26')](_0xdf5554,_0x131809,!![]);}catch(_0xcee9e9){return BPromise[_0x5531('0x27')](_0xcee9e9);}return _0xdf5554[_0x5531('0x28')]();};}function saveUpdates(_0x883194,_0x3d3031){return function(_0x45e77b){if(_0x45e77b){return _0x45e77b[_0x5531('0x29')](_0x883194)[_0x5531('0x2a')](function(_0x2afd9d){return _0x2afd9d;});}return null;};}function removeEntity(_0x5523fa,_0x5c224a){return function(_0x20ecd5){if(_0x20ecd5){return _0x20ecd5[_0x5531('0x2b')]()[_0x5531('0x2a')](function(){_0x5523fa['status'](0xcc)[_0x5531('0x1e')]();});}};}function handleEntityNotFound(_0x36c4d2,_0x13b0c5){return function(_0x4a3718){if(!_0x4a3718){_0x36c4d2[_0x5531('0x1c')](0x194);}return _0x4a3718;};}function handleError(_0x43f9d8,_0x4315da){_0x4315da=_0x4315da||0x1f4;return function(_0x2bf275){logger[_0x5531('0x2c')](_0x2bf275[_0x5531('0x2d')]);if(_0x2bf275[_0x5531('0x2e')]){delete _0x2bf275[_0x5531('0x2e')];}_0x43f9d8['status'](_0x4315da)['send'](_0x2bf275);};}exports[_0x5531('0x2f')]=function(_0x3bc543,_0xccd12a){var _0xac7a25={},_0x12ec4c={},_0x272c52={'count':0x0,'rows':[]};var _0x5ba609=_['map'](db['MailTransferReport'][_0x5531('0x30')],function(_0x4ebc44){return{'name':_0x4ebc44['fieldName'],'type':_0x4ebc44[_0x5531('0x31')][_0x5531('0x32')]};});_0x12ec4c[_0x5531('0x33')]=_[_0x5531('0x34')](_0x5ba609,_0x5531('0x2e'));_0x12ec4c[_0x5531('0x35')]=_[_0x5531('0x36')](_0x3bc543['query']);_0x12ec4c['filters']=_[_0x5531('0x37')](_0x12ec4c['model'],_0x12ec4c[_0x5531('0x35')]);_0xac7a25['attributes']=_['intersection'](_0x12ec4c['model'],qs[_0x5531('0x38')](_0x3bc543[_0x5531('0x35')]['fields']));_0xac7a25[_0x5531('0x39')]=_0xac7a25[_0x5531('0x39')][_0x5531('0x3a')]?_0xac7a25[_0x5531('0x39')]:_0x12ec4c[_0x5531('0x33')];if(!_0x3bc543[_0x5531('0x35')]['hasOwnProperty'](_0x5531('0x3b'))){_0xac7a25[_0x5531('0x22')]=qs[_0x5531('0x22')](_0x3bc543[_0x5531('0x35')]['limit']);_0xac7a25['offset']=qs['offset'](_0x3bc543['query']['offset']);}_0xac7a25[_0x5531('0x3c')]=qs[_0x5531('0x3d')](_0x3bc543['query'][_0x5531('0x3d')]);_0xac7a25[_0x5531('0x3e')]=qs[_0x5531('0x3f')](_[_0x5531('0x40')](_0x3bc543['query'],_0x12ec4c[_0x5531('0x3f')]),_0x5ba609);if(_0x3bc543[_0x5531('0x35')]['filter']){_0xac7a25['where']=_[_0x5531('0x41')](_0xac7a25['where'],{'$or':_[_0x5531('0x34')](_0x5ba609,function(_0x165210){if(_0x165210['type']!=='VIRTUAL'){var _0x3112e2={};_0x3112e2[_0x165210[_0x5531('0x2e')]]={'$like':'%'+_0x3bc543[_0x5531('0x35')][_0x5531('0x42')]+'%'};return _0x3112e2;}})});}_0xac7a25=_[_0x5531('0x41')]({},_0xac7a25,_0x3bc543[_0x5531('0x43')]);var _0x1c3888={'where':_0xac7a25['where']};return db[_0x5531('0x44')]['count'](_0x1c3888)['then'](function(_0x460fcf){_0x272c52[_0x5531('0x23')]=_0x460fcf;if(_0x3bc543[_0x5531('0x35')]['includeAll']){_0xac7a25[_0x5531('0x45')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0xac7a25);})[_0x5531('0x2a')](function(_0x135318){_0x272c52['rows']=_0x135318;return _0x272c52;})[_0x5531('0x2a')](respondWithFilteredResult(_0xccd12a,_0xac7a25))['catch'](handleError(_0xccd12a,null));};exports['show']=function(_0x8e27b1,_0x2127bc){var _0x561ef6={'raw':!![],'where':{'id':_0x8e27b1[_0x5531('0x46')]['id']}},_0x3257bb={};_0x3257bb[_0x5531('0x33')]=_[_0x5531('0x36')](db['MailTransferReport'][_0x5531('0x30')]);_0x3257bb[_0x5531('0x35')]=_[_0x5531('0x36')](_0x8e27b1[_0x5531('0x35')]);_0x3257bb[_0x5531('0x3f')]=_[_0x5531('0x37')](_0x3257bb['model'],_0x3257bb[_0x5531('0x35')]);_0x561ef6['attributes']=_[_0x5531('0x37')](_0x3257bb['model'],qs['fields'](_0x8e27b1[_0x5531('0x35')][_0x5531('0x38')]));_0x561ef6[_0x5531('0x39')]=_0x561ef6['attributes']['length']?_0x561ef6[_0x5531('0x39')]:_0x3257bb[_0x5531('0x33')];if(_0x8e27b1['query'][_0x5531('0x47')]){_0x561ef6['include']=[{'all':!![]}];}_0x561ef6=_[_0x5531('0x41')]({},_0x561ef6,_0x8e27b1[_0x5531('0x43')]);return db[_0x5531('0x44')][_0x5531('0x48')](_0x561ef6)[_0x5531('0x2a')](handleEntityNotFound(_0x2127bc,null))[_0x5531('0x2a')](respondWithResult(_0x2127bc,null))[_0x5531('0x49')](handleError(_0x2127bc,null));};exports['create']=function(_0x10b345,_0x1c2559){return db[_0x5531('0x44')]['create'](_0x10b345[_0x5531('0x4a')],{})[_0x5531('0x2a')](respondWithResult(_0x1c2559,0xc9))[_0x5531('0x49')](handleError(_0x1c2559,null));};exports[_0x5531('0x29')]=function(_0x48f51c,_0x120307){if(_0x48f51c[_0x5531('0x4a')]['id']){delete _0x48f51c[_0x5531('0x4a')]['id'];}return db[_0x5531('0x44')]['find']({'where':{'id':_0x48f51c[_0x5531('0x46')]['id']}})[_0x5531('0x2a')](handleEntityNotFound(_0x120307,null))[_0x5531('0x2a')](saveUpdates(_0x48f51c[_0x5531('0x4a')],null))['then'](respondWithResult(_0x120307,null))[_0x5531('0x49')](handleError(_0x120307,null));};exports[_0x5531('0x2b')]=function(_0x4c7de6,_0x22f2e0){return db[_0x5531('0x44')][_0x5531('0x48')]({'where':{'id':_0x4c7de6[_0x5531('0x46')]['id']}})[_0x5531('0x2a')](handleEntityNotFound(_0x22f2e0,null))[_0x5531('0x2a')](removeEntity(_0x22f2e0,null))[_0x5531('0x49')](handleError(_0x22f2e0,null));};exports[_0x5531('0x4b')]=function(_0x34953d,_0x4983d0){return db[_0x5531('0x44')][_0x5531('0x4b')]()[_0x5531('0x2a')](respondWithResult(_0x4983d0,null))[_0x5531('0x49')](handleError(_0x4983d0,null));}; \ No newline at end of file +var _0x6ce6=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','stack','send','index','MailTransferReport','rawAttributes','fieldName','type','key','model','map','name','keys','query'];(function(_0x219b1f,_0x57d0b4){var _0x288f3d=function(_0x203ab9){while(--_0x203ab9){_0x219b1f['push'](_0x219b1f['shift']());}};_0x288f3d(++_0x57d0b4);}(_0x6ce6,0xf5));var _0x66ce=function(_0x3b650f,_0x36336c){_0x3b650f=_0x3b650f-0x0;var _0x3ee682=_0x6ce6[_0x3b650f];return _0x3ee682;};'use strict';var emlformat=require(_0x66ce('0x0'));var rimraf=require(_0x66ce('0x1'));var zipdir=require(_0x66ce('0x2'));var jsonpatch=require(_0x66ce('0x3'));var rp=require(_0x66ce('0x4'));var moment=require(_0x66ce('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66ce('0x6'));var path=require('path');var sox=require(_0x66ce('0x7'));var csv=require(_0x66ce('0x8'));var ejs=require(_0x66ce('0x9'));var fs=require('fs');var fs_extra=require(_0x66ce('0xa'));var _=require('lodash');var squel=require(_0x66ce('0xb'));var crypto=require(_0x66ce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x66ce('0xd'));var toCsv=require(_0x66ce('0x8'));var querystring=require(_0x66ce('0xe'));var Papa=require('papaparse');var Redis=require(_0x66ce('0xf'));var authService=require(_0x66ce('0x10'));var qs=require(_0x66ce('0x11'));var as=require(_0x66ce('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x66ce('0x13'))(_0x66ce('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66ce('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5550ed,_0x10e8f1){_0x10e8f1=_0x10e8f1||0xcc;return function(_0x290f5d){if(_0x290f5d){return _0x5550ed['sendStatus'](_0x10e8f1);}return _0x5550ed[_0x66ce('0x16')](_0x10e8f1)[_0x66ce('0x17')]();};}function respondWithResult(_0x568c44,_0x1851d4){_0x1851d4=_0x1851d4||0xc8;return function(_0x2a0fd9){if(_0x2a0fd9){return _0x568c44[_0x66ce('0x16')](_0x1851d4)[_0x66ce('0x18')](_0x2a0fd9);}};}function respondWithFilteredResult(_0x703b58,_0x46d908){return function(_0x39219f){if(_0x39219f){var _0x474ddf=typeof _0x46d908[_0x66ce('0x19')]===_0x66ce('0x1a')&&typeof _0x46d908[_0x66ce('0x1b')]==='undefined';var _0x3c1934=_0x39219f[_0x66ce('0x1c')];var _0xfa39a9=_0x474ddf?0x0:_0x46d908[_0x66ce('0x19')];var _0x36e1c7=_0x474ddf?_0x39219f[_0x66ce('0x1c')]:_0x46d908[_0x66ce('0x19')]+_0x46d908['limit'];var _0x155595;if(_0x36e1c7>=_0x3c1934){_0x36e1c7=_0x3c1934;_0x155595=0xc8;}else{_0x155595=0xce;}_0x703b58[_0x66ce('0x16')](_0x155595);return _0x703b58[_0x66ce('0x1d')]('Content-Range',_0xfa39a9+'-'+_0x36e1c7+'/'+_0x3c1934)[_0x66ce('0x18')](_0x39219f);}return null;};}function patchUpdates(_0x558986){return function(_0x533677){try{jsonpatch[_0x66ce('0x1e')](_0x533677,_0x558986,!![]);}catch(_0x547410){return BPromise[_0x66ce('0x1f')](_0x547410);}return _0x533677['save']();};}function saveUpdates(_0x55c283,_0x234242){return function(_0x353839){if(_0x353839){return _0x353839[_0x66ce('0x20')](_0x55c283)[_0x66ce('0x21')](function(_0x3fe910){return _0x3fe910;});}return null;};}function removeEntity(_0x1421aa,_0x3de5b3){return function(_0x5496e5){if(_0x5496e5){return _0x5496e5['destroy']()[_0x66ce('0x21')](function(){_0x1421aa[_0x66ce('0x16')](0xcc)[_0x66ce('0x17')]();});}};}function handleEntityNotFound(_0xbc3248,_0xb2fed3){return function(_0x538d09){if(!_0x538d09){_0xbc3248['sendStatus'](0x194);}return _0x538d09;};}function handleError(_0x32b7ec,_0x232732){_0x232732=_0x232732||0x1f4;return function(_0x4cd43f){logger['error'](_0x4cd43f[_0x66ce('0x22')]);if(_0x4cd43f['name']){delete _0x4cd43f['name'];}_0x32b7ec[_0x66ce('0x16')](_0x232732)[_0x66ce('0x23')](_0x4cd43f);};}exports[_0x66ce('0x24')]=function(_0x6cea6b,_0x54d52a){var _0x4f9acb={},_0x2fc179={},_0x373271={'count':0x0,'rows':[]};var _0x3f445=_['map'](db[_0x66ce('0x25')][_0x66ce('0x26')],function(_0x578a6d){return{'name':_0x578a6d[_0x66ce('0x27')],'type':_0x578a6d[_0x66ce('0x28')][_0x66ce('0x29')]};});_0x2fc179[_0x66ce('0x2a')]=_[_0x66ce('0x2b')](_0x3f445,_0x66ce('0x2c'));_0x2fc179['query']=_[_0x66ce('0x2d')](_0x6cea6b[_0x66ce('0x2e')]);_0x2fc179[_0x66ce('0x2f')]=_['intersection'](_0x2fc179[_0x66ce('0x2a')],_0x2fc179[_0x66ce('0x2e')]);_0x4f9acb[_0x66ce('0x30')]=_[_0x66ce('0x31')](_0x2fc179[_0x66ce('0x2a')],qs[_0x66ce('0x32')](_0x6cea6b['query'][_0x66ce('0x32')]));_0x4f9acb[_0x66ce('0x30')]=_0x4f9acb['attributes'][_0x66ce('0x33')]?_0x4f9acb['attributes']:_0x2fc179[_0x66ce('0x2a')];if(!_0x6cea6b[_0x66ce('0x2e')][_0x66ce('0x34')]('nolimit')){_0x4f9acb['limit']=qs['limit'](_0x6cea6b[_0x66ce('0x2e')][_0x66ce('0x1b')]);_0x4f9acb[_0x66ce('0x19')]=qs[_0x66ce('0x19')](_0x6cea6b[_0x66ce('0x2e')][_0x66ce('0x19')]);}_0x4f9acb[_0x66ce('0x35')]=qs[_0x66ce('0x36')](_0x6cea6b[_0x66ce('0x2e')][_0x66ce('0x36')]);_0x4f9acb[_0x66ce('0x37')]=qs[_0x66ce('0x2f')](_[_0x66ce('0x38')](_0x6cea6b[_0x66ce('0x2e')],_0x2fc179[_0x66ce('0x2f')]),_0x3f445);if(_0x6cea6b[_0x66ce('0x2e')][_0x66ce('0x39')]){_0x4f9acb[_0x66ce('0x37')]=_[_0x66ce('0x3a')](_0x4f9acb['where'],{'$or':_[_0x66ce('0x2b')](_0x3f445,function(_0x2f6d5c){if(_0x2f6d5c[_0x66ce('0x28')]!==_0x66ce('0x3b')){var _0x467c11={};_0x467c11[_0x2f6d5c[_0x66ce('0x2c')]]={'$like':'%'+_0x6cea6b['query']['filter']+'%'};return _0x467c11;}})});}_0x4f9acb=_[_0x66ce('0x3a')]({},_0x4f9acb,_0x6cea6b[_0x66ce('0x3c')]);var _0x1a804a={'where':_0x4f9acb['where']};return db['MailTransferReport'][_0x66ce('0x1c')](_0x1a804a)['then'](function(_0x200a7b){_0x373271['count']=_0x200a7b;if(_0x6cea6b['query'][_0x66ce('0x3d')]){_0x4f9acb[_0x66ce('0x3e')]=[{'all':!![]}];}return db[_0x66ce('0x25')][_0x66ce('0x3f')](_0x4f9acb);})[_0x66ce('0x21')](function(_0x62e2bc){_0x373271[_0x66ce('0x40')]=_0x62e2bc;return _0x373271;})[_0x66ce('0x21')](respondWithFilteredResult(_0x54d52a,_0x4f9acb))[_0x66ce('0x41')](handleError(_0x54d52a,null));};exports[_0x66ce('0x42')]=function(_0x26e796,_0x5a6039){var _0x444392={'raw':!![],'where':{'id':_0x26e796[_0x66ce('0x43')]['id']}},_0xa186f2={};_0xa186f2[_0x66ce('0x2a')]=_[_0x66ce('0x2d')](db[_0x66ce('0x25')][_0x66ce('0x26')]);_0xa186f2[_0x66ce('0x2e')]=_['keys'](_0x26e796[_0x66ce('0x2e')]);_0xa186f2['filters']=_[_0x66ce('0x31')](_0xa186f2[_0x66ce('0x2a')],_0xa186f2[_0x66ce('0x2e')]);_0x444392[_0x66ce('0x30')]=_[_0x66ce('0x31')](_0xa186f2['model'],qs[_0x66ce('0x32')](_0x26e796[_0x66ce('0x2e')][_0x66ce('0x32')]));_0x444392['attributes']=_0x444392[_0x66ce('0x30')][_0x66ce('0x33')]?_0x444392[_0x66ce('0x30')]:_0xa186f2[_0x66ce('0x2a')];if(_0x26e796[_0x66ce('0x2e')][_0x66ce('0x3d')]){_0x444392['include']=[{'all':!![]}];}_0x444392=_['merge']({},_0x444392,_0x26e796['options']);return db[_0x66ce('0x25')][_0x66ce('0x44')](_0x444392)['then'](handleEntityNotFound(_0x5a6039,null))[_0x66ce('0x21')](respondWithResult(_0x5a6039,null))[_0x66ce('0x41')](handleError(_0x5a6039,null));};exports[_0x66ce('0x45')]=function(_0x98bce5,_0x24b898){return db[_0x66ce('0x25')]['create'](_0x98bce5['body'],{})[_0x66ce('0x21')](respondWithResult(_0x24b898,0xc9))['catch'](handleError(_0x24b898,null));};exports['update']=function(_0x33e197,_0x54c3c2){if(_0x33e197[_0x66ce('0x46')]['id']){delete _0x33e197[_0x66ce('0x46')]['id'];}return db[_0x66ce('0x25')][_0x66ce('0x44')]({'where':{'id':_0x33e197[_0x66ce('0x43')]['id']}})[_0x66ce('0x21')](handleEntityNotFound(_0x54c3c2,null))[_0x66ce('0x21')](saveUpdates(_0x33e197[_0x66ce('0x46')],null))['then'](respondWithResult(_0x54c3c2,null))[_0x66ce('0x41')](handleError(_0x54c3c2,null));};exports[_0x66ce('0x47')]=function(_0x5da032,_0x441fce){return db[_0x66ce('0x25')][_0x66ce('0x44')]({'where':{'id':_0x5da032['params']['id']}})[_0x66ce('0x21')](handleEntityNotFound(_0x441fce,null))[_0x66ce('0x21')](removeEntity(_0x441fce,null))[_0x66ce('0x41')](handleError(_0x441fce,null));};exports[_0x66ce('0x48')]=function(_0x1a0ec6,_0x5cbce6){return db[_0x66ce('0x25')]['describe']()[_0x66ce('0x21')](respondWithResult(_0x5cbce6,null))[_0x66ce('0x41')](handleError(_0x5cbce6,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ad05c65..2791d07 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 _0x4ff6=['MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define'];(function(_0x3596c4,_0x388bd2){var _0xbf25f9=function(_0x5c96e1){while(--_0x5c96e1){_0x3596c4['push'](_0x3596c4['shift']());}};_0xbf25f9(++_0x388bd2);}(_0x4ff6,0xd5));var _0x64ff=function(_0x1664ae,_0x7f6a88){_0x1664ae=_0x1664ae-0x0;var _0x46f581=_0x4ff6[_0x1664ae];return _0x46f581;};'use strict';var _=require('lodash');var util=require(_0x64ff('0x0'));var logger=require(_0x64ff('0x1'))(_0x64ff('0x2'));var moment=require(_0x64ff('0x3'));var BPromise=require(_0x64ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64ff('0x5'));var rimraf=require(_0x64ff('0x6'));var config=require(_0x64ff('0x7'));var attributes=require(_0x64ff('0x8'));module[_0x64ff('0x9')]=function(_0x34dacd,_0x37ad86){return _0x34dacd[_0x64ff('0xa')](_0x64ff('0xb'),attributes,{'tableName':_0x64ff('0xc'),'paranoid':![],'indexes':[{'name':_0x64ff('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e12=['exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','./mailTransferReport.attributes'];(function(_0x5be559,_0x1b3022){var _0x1a5475=function(_0x52a41b){while(--_0x52a41b){_0x5be559['push'](_0x5be559['shift']());}};_0x1a5475(++_0x1b3022);}(_0x6e12,0x154));var _0x26e1=function(_0x1ff274,_0x10e914){_0x1ff274=_0x1ff274-0x0;var _0x289f33=_0x6e12[_0x1ff274];return _0x289f33;};'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')]('MailTransferReport',attributes,{'tableName':_0x26e1('0xa'),'paranoid':![],'indexes':[{'name':_0x26e1('0xb'),'fields':[_0x26e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index b80f3df..0da17ee 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 _0xf564=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailTransferReport,\x20%s,\x20%s','message','catch'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0xf564,0xb8));var _0x4f56=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0xf564[_0x162780];return _0x1ea2dc;};'use strict';var _=require(_0x4f56('0x0'));var util=require(_0x4f56('0x1'));var moment=require(_0x4f56('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f56('0x3'));var db=require(_0x4f56('0x4'))['db'];var utils=require(_0x4f56('0x5'));var logger=require(_0x4f56('0x6'))(_0x4f56('0x7'));var config=require(_0x4f56('0x8'));var jayson=require(_0x4f56('0x9'));var client=jayson[_0x4f56('0xa')][_0x4f56('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f1b9,_0x575be5,_0x1ff89b){return new BPromise(function(_0x5be393,_0x2603aa){return client[_0x4f56('0xc')](_0x48f1b9,_0x1ff89b)[_0x4f56('0xd')](function(_0x387fa6){logger[_0x4f56('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x575be5,'request\x20sent');logger[_0x4f56('0xf')](_0x4f56('0x10'),_0x575be5,_0x4f56('0x11'),JSON[_0x4f56('0x12')](_0x387fa6));if(_0x387fa6[_0x4f56('0x13')]){if(_0x387fa6[_0x4f56('0x13')]['code']===0x1f4){logger['error'](_0x4f56('0x14'),_0x575be5,_0x387fa6['error'][_0x4f56('0x15')]);return _0x2603aa(_0x387fa6['error']['message']);}logger[_0x4f56('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x575be5,_0x387fa6['error'][_0x4f56('0x15')]);return _0x5be393(_0x387fa6[_0x4f56('0x13')]['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x575be5,_0x4f56('0x11'));_0x5be393(_0x387fa6['result'][_0x4f56('0x15')]);}})[_0x4f56('0x16')](function(_0x15d33b){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x575be5,_0x15d33b);_0x2603aa(_0x15d33b);});});} \ No newline at end of file +var _0x06a3=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x417bcb,_0x292a3d){var _0xf2fa3d=function(_0x12a9f8){while(--_0x12a9f8){_0x417bcb['push'](_0x417bcb['shift']());}};_0xf2fa3d(++_0x292a3d);}(_0x06a3,0xc2));var _0x306a=function(_0x5c8edb,_0x105253){_0x5c8edb=_0x5c8edb-0x0;var _0x5a1451=_0x06a3[_0x5c8edb];return _0x5a1451;};'use strict';var _=require(_0x306a('0x0'));var util=require('util');var moment=require(_0x306a('0x1'));var BPromise=require(_0x306a('0x2'));var rs=require(_0x306a('0x3'));var fs=require('fs');var Redis=require(_0x306a('0x4'));var db=require(_0x306a('0x5'))['db'];var utils=require(_0x306a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x306a('0x7'));var jayson=require(_0x306a('0x8'));var client=jayson[_0x306a('0x9')][_0x306a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x208176,_0x5d92ea,_0x154e3b){return new BPromise(function(_0x6fcb6d,_0x55f02d){return client['request'](_0x208176,_0x154e3b)[_0x306a('0xb')](function(_0xf1aa41){logger[_0x306a('0xc')](_0x306a('0xd'),_0x5d92ea,_0x306a('0xe'));logger[_0x306a('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5d92ea,_0x306a('0xe'),JSON[_0x306a('0x10')](_0xf1aa41));if(_0xf1aa41['error']){if(_0xf1aa41['error'][_0x306a('0x11')]===0x1f4){logger[_0x306a('0x12')](_0x306a('0xd'),_0x5d92ea,_0xf1aa41[_0x306a('0x12')][_0x306a('0x13')]);return _0x55f02d(_0xf1aa41[_0x306a('0x12')][_0x306a('0x13')]);}logger[_0x306a('0x12')](_0x306a('0xd'),_0x5d92ea,_0xf1aa41[_0x306a('0x12')]['message']);return _0x6fcb6d(_0xf1aa41[_0x306a('0x12')]['message']);}else{logger[_0x306a('0xc')](_0x306a('0xd'),_0x5d92ea,_0x306a('0xe'));_0x6fcb6d(_0xf1aa41[_0x306a('0x14')][_0x306a('0x13')]);}})[_0x306a('0x15')](function(_0x5c18ad){logger[_0x306a('0x12')](_0x306a('0xd'),_0x5d92ea,_0x5c18ad);_0x55f02d(_0x5c18ad);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index cd8ada4..c766b97 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 _0xe18d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe18d,0x14a));var _0xde18=function(_0x7f464a,_0x326a3a){_0x7f464a=_0x7f464a-0x0;var _0x5e15dd=_0xe18d[_0x7f464a];return _0x5e15dd;};'use strict';var multer=require(_0xde18('0x0'));var util=require(_0xde18('0x1'));var path=require(_0xde18('0x2'));var timeout=require(_0xde18('0x3'));var express=require(_0xde18('0x4'));var router=express['Router']();var fs_extra=require(_0xde18('0x5'));var auth=require(_0xde18('0x6'));var interaction=require(_0xde18('0x7'));var config=require(_0xde18('0x8'));var controller=require(_0xde18('0x9'));router[_0xde18('0xa')]('/',auth[_0xde18('0xb')](),controller['index']);router[_0xde18('0xa')](_0xde18('0xc'),auth[_0xde18('0xb')](),controller[_0xde18('0xd')]);router[_0xde18('0xa')](_0xde18('0xe'),auth['isAuthenticated'](),controller[_0xde18('0xf')]);router[_0xde18('0x10')]('/',auth['isAuthenticated'](),controller[_0xde18('0x11')]);router['put'](_0xde18('0xe'),auth[_0xde18('0xb')](),controller[_0xde18('0x12')]);router['delete']('/:id',auth[_0xde18('0xb')](),controller[_0xde18('0x13')]);module[_0xde18('0x14')]=router; \ No newline at end of file +var _0x06a1=['get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe'];(function(_0xc67a77,_0x5c66d6){var _0x3d5849=function(_0x2622a7){while(--_0x2622a7){_0xc67a77['push'](_0xc67a77['shift']());}};_0x3d5849(++_0x5c66d6);}(_0x06a1,0x105));var _0x106a=function(_0x2a9388,_0x4bbbb1){_0x2a9388=_0x2a9388-0x0;var _0x1ef46f=_0x06a1[_0x2a9388];return _0x1ef46f;};'use strict';var multer=require(_0x106a('0x0'));var util=require(_0x106a('0x1'));var path=require(_0x106a('0x2'));var timeout=require(_0x106a('0x3'));var express=require('express');var router=express[_0x106a('0x4')]();var fs_extra=require(_0x106a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x106a('0x6'));var config=require(_0x106a('0x7'));var controller=require('./memberReport.controller');router['get']('/',auth[_0x106a('0x8')](),controller[_0x106a('0x9')]);router['get'](_0x106a('0xa'),auth[_0x106a('0x8')](),controller[_0x106a('0xb')]);router[_0x106a('0xc')](_0x106a('0xd'),auth[_0x106a('0x8')](),controller[_0x106a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x106a('0xf')]);router[_0x106a('0x10')](_0x106a('0xd'),auth['isAuthenticated'](),controller[_0x106a('0x11')]);router[_0x106a('0x12')](_0x106a('0xd'),auth[_0x106a('0x8')](),controller[_0x106a('0x13')]);module[_0x106a('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index adf137b..7f3a0a0 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 _0x6b27=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff','setDataValue'];(function(_0x919f94,_0x105bff){var _0x2870ee=function(_0x46ba8d){while(--_0x46ba8d){_0x919f94['push'](_0x919f94['shift']());}};_0x2870ee(++_0x105bff);}(_0x6b27,0x176));var _0x76b2=function(_0x4e7757,_0x941a0d){_0x4e7757=_0x4e7757-0x0;var _0x12d83e=_0x6b27[_0x4e7757];return _0x12d83e;};'use strict';var Sequelize=require(_0x76b2('0x0'));var moment=require(_0x76b2('0x1'));module['exports']={'channel':{'type':Sequelize[_0x76b2('0x2')]},'membername':{'type':Sequelize[_0x76b2('0x2')]},'interface':{'type':Sequelize[_0x76b2('0x2')]},'type':{'type':Sequelize[_0x76b2('0x2')],'defaultValue':_0x76b2('0x3'),'comment':_0x76b2('0x4')},'duration':{'type':Sequelize[_0x76b2('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x22e99d){var _0x289036=moment(_0x22e99d);var _0x9f0380=moment(this[_0x76b2('0x6')](_0x76b2('0x7')));var _0x400295=_0x289036[_0x76b2('0x8')](_0x9f0380,'seconds');this[_0x76b2('0x9')]('exitAt',_0x22e99d);this[_0x76b2('0x9')](_0x76b2('0xa'),_0x400295>=0x0?_0x400295:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x76b2('0xb')},'data2':{'type':Sequelize[_0x76b2('0x2')],'comment':_0x76b2('0xc')},'data3':{'type':Sequelize[_0x76b2('0x2')],'comment':_0x76b2('0xd')},'data4':{'type':Sequelize[_0x76b2('0x2')],'comment':_0x76b2('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0x76b2('0xf')},'role':{'type':Sequelize[_0x76b2('0x2')]},'internal':{'type':Sequelize[_0x76b2('0x5')]},'uniqueid':{'type':Sequelize[_0x76b2('0x2')]}}; \ No newline at end of file +var _0xd081=['exitAt','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','enterAt','diff','seconds','setDataValue'];(function(_0x3fe90c,_0x231b20){var _0x12c302=function(_0x5f5cb6){while(--_0x5f5cb6){_0x3fe90c['push'](_0x3fe90c['shift']());}};_0x12c302(++_0x231b20);}(_0xd081,0x16f));var _0x1d08=function(_0x4cfc35,_0x235ea9){_0x4cfc35=_0x4cfc35-0x0;var _0x9add7a=_0xd081[_0x4cfc35];return _0x9add7a;};'use strict';var Sequelize=require(_0x1d08('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize[_0x1d08('0x1')]},'membername':{'type':Sequelize[_0x1d08('0x1')]},'interface':{'type':Sequelize[_0x1d08('0x1')]},'type':{'type':Sequelize[_0x1d08('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x1d08('0x2')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x276970){var _0x319c9f=moment(_0x276970);var _0x57f667=moment(this['getDataValue'](_0x1d08('0x3')));var _0xf6b567=_0x319c9f[_0x1d08('0x4')](_0x57f667,_0x1d08('0x5'));this[_0x1d08('0x6')](_0x1d08('0x7'),_0x276970);this[_0x1d08('0x6')]('duration',_0xf6b567>=0x0?_0xf6b567:null);}},'data1':{'type':Sequelize[_0x1d08('0x1')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x1d08('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x1d08('0x8')},'data4':{'type':Sequelize[_0x1d08('0x1')],'comment':_0x1d08('0x9')},'data5':{'type':Sequelize[_0x1d08('0x1')],'comment':_0x1d08('0xa')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x1d08('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index c351f73..5f74c40 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 _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(_0x4f8f52,_0x139a03){var _0x16c1d4=function(_0x333a1a){while(--_0x333a1a){_0x4f8f52['push'](_0x4f8f52['shift']());}};_0x16c1d4(++_0x139a03);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 +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(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x34e8,0x12c));var _0x834e=function(_0x29d55a,_0x9e6304){_0x29d55a=_0x29d55a-0x0;var _0x3629fa=_0x34e8[_0x29d55a];return _0x3629fa;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index f41f3f7..97fe5c1 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 _0x6d16=['path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','moment'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x6d16,0x169));var _0x66d1=function(_0x1396b3,_0x147dd7){_0x1396b3=_0x1396b3-0x0;var _0x540070=_0x6d16[_0x1396b3];return _0x540070;};'use strict';var _=require(_0x66d1('0x0'));var util=require('util');var logger=require(_0x66d1('0x1'))('api');var moment=require(_0x66d1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x66d1('0x3'));var rimraf=require(_0x66d1('0x4'));var config=require(_0x66d1('0x5'));var attributes=require(_0x66d1('0x6'));module[_0x66d1('0x7')]=function(_0xc3d4f1,_0x541efd){return _0xc3d4f1['define'](_0x66d1('0x8'),attributes,{'tableName':_0x66d1('0x9'),'paranoid':![],'indexes':[{'name':_0x66d1('0xa'),'fields':[_0x66d1('0xb'),_0x66d1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb14b=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash'];(function(_0x1bd9a6,_0x3b1048){var _0x33a55d=function(_0x1ca1f6){while(--_0x1ca1f6){_0x1bd9a6['push'](_0x1bd9a6['shift']());}};_0x33a55d(++_0x3b1048);}(_0xb14b,0xff));var _0xbb14=function(_0x1eee36,_0x9763d5){_0x1eee36=_0x1eee36-0x0;var _0x5581e8=_0xb14b[_0x1eee36];return _0x5581e8;};'use strict';var _=require(_0xbb14('0x0'));var util=require(_0xbb14('0x1'));var logger=require(_0xbb14('0x2'))(_0xbb14('0x3'));var moment=require(_0xbb14('0x4'));var BPromise=require(_0xbb14('0x5'));var rp=require(_0xbb14('0x6'));var fs=require('fs');var path=require(_0xbb14('0x7'));var rimraf=require('rimraf');var config=require(_0xbb14('0x8'));var attributes=require(_0xbb14('0x9'));module[_0xbb14('0xa')]=function(_0x5d48de,_0x163c49){return _0x5d48de[_0xbb14('0xb')](_0xbb14('0xc'),attributes,{'tableName':_0xbb14('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xbb14('0xe'),_0xbb14('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 6df41df..bf1c060 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 _0x02a7=['MemberReport,\x20%s,\x20%s','message','result','GetMemberReport','MemberReport','options','raw','where','attributes','include','map','model','catch','CreateMemberReport','body','UpdateMemberReport','update','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf5f8bd,_0x471efc){var _0x32ff7f=function(_0x271503){while(--_0x271503){_0xf5f8bd['push'](_0xf5f8bd['shift']());}};_0x32ff7f(++_0x471efc);}(_0x02a7,0x7a));var _0x702a=function(_0x1c9ade,_0x395041){_0x1c9ade=_0x1c9ade-0x0;var _0x444a39=_0x02a7[_0x1c9ade];return _0x444a39;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b25e,_0x1aa2c2,_0x3f2954){return new BPromise(function(_0x161dee,_0x430cf3){return client[_0x702a('0x9')](_0x26b25e,_0x3f2954)[_0x702a('0xa')](function(_0x48469e){logger[_0x702a('0xb')]('MemberReport,\x20%s,\x20%s',_0x1aa2c2,'request\x20sent');logger[_0x702a('0xc')](_0x702a('0xd'),_0x1aa2c2,_0x702a('0xe'),JSON[_0x702a('0xf')](_0x48469e));if(_0x48469e['error']){if(_0x48469e[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x48469e[_0x702a('0x10')][_0x702a('0x13')]);return _0x430cf3(_0x48469e[_0x702a('0x10')]['message']);}logger['error'](_0x702a('0x12'),_0x1aa2c2,_0x48469e['error']['message']);return _0x161dee(_0x48469e['error']['message']);}else{logger['info'](_0x702a('0x12'),_0x1aa2c2,_0x702a('0xe'));_0x161dee(_0x48469e[_0x702a('0x14')]['message']);}})['catch'](function(_0x506772){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x506772);_0x430cf3(_0x506772);});});}exports[_0x702a('0x15')]=function(_0x492cfb){var _0x290591=this;return new Promise(function(_0x5ec1b3,_0x823794){return db[_0x702a('0x16')]['findAll']({'raw':_0x492cfb['options']?_0x492cfb[_0x702a('0x17')][_0x702a('0x18')]===undefined?!![]:![]:!![],'where':_0x492cfb[_0x702a('0x17')]?_0x492cfb[_0x702a('0x17')][_0x702a('0x19')]||null:null,'attributes':_0x492cfb[_0x702a('0x17')]?_0x492cfb[_0x702a('0x17')][_0x702a('0x1a')]||null:null,'limit':_0x492cfb[_0x702a('0x17')]?_0x492cfb[_0x702a('0x17')]['limit']||null:null,'include':_0x492cfb[_0x702a('0x17')]?_0x492cfb[_0x702a('0x17')][_0x702a('0x1b')]?_[_0x702a('0x1c')](_0x492cfb[_0x702a('0x17')][_0x702a('0x1b')],function(_0x2aede0){return{'model':db[_0x2aede0[_0x702a('0x1d')]],'as':_0x2aede0['as'],'attributes':_0x2aede0[_0x702a('0x1a')],'include':_0x2aede0['include']?_[_0x702a('0x1c')](_0x2aede0[_0x702a('0x1b')],function(_0x57add6){return{'model':db[_0x57add6[_0x702a('0x1d')]],'as':_0x57add6['as'],'attributes':_0x57add6[_0x702a('0x1a')],'include':_0x57add6[_0x702a('0x1b')]?_[_0x702a('0x1c')](_0x57add6[_0x702a('0x1b')],function(_0x2eff20){return{'model':db[_0x2eff20['model']],'as':_0x2eff20['as'],'attributes':_0x2eff20[_0x702a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x702a('0xa')](function(_0x5a9d26){logger[_0x702a('0xb')](_0x702a('0x15'),_0x492cfb);logger[_0x702a('0xc')](_0x702a('0x15'),_0x492cfb,JSON[_0x702a('0xf')](_0x5a9d26));_0x5ec1b3(_0x5a9d26);})[_0x702a('0x1e')](function(_0x1596a8){logger['error'](_0x702a('0x15'),_0x1596a8[_0x702a('0x13')],_0x492cfb);_0x823794(_0x290591[_0x702a('0x10')](0x1f4,_0x1596a8[_0x702a('0x13')]));});});};exports[_0x702a('0x1f')]=function(_0x145489){var _0x5cc44b=this;return new Promise(function(_0x10e01e,_0x2a2bb3){return db['MemberReport']['create'](_0x145489[_0x702a('0x20')],{'raw':_0x145489[_0x702a('0x17')]?_0x145489['options'][_0x702a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b71ea){logger[_0x702a('0xb')](_0x702a('0x1f'),_0x145489);logger[_0x702a('0xc')]('CreateMemberReport',_0x145489,JSON[_0x702a('0xf')](_0x5b71ea));_0x10e01e(_0x5b71ea);})[_0x702a('0x1e')](function(_0x1f97a7){logger[_0x702a('0x10')](_0x702a('0x1f'),_0x1f97a7[_0x702a('0x13')],_0x145489);_0x2a2bb3(_0x5cc44b[_0x702a('0x10')](0x1f4,_0x1f97a7[_0x702a('0x13')]));});});};exports[_0x702a('0x21')]=function(_0x24d243){var _0xde244=this;return new Promise(function(_0xaa8c18,_0x17ff8d){return db[_0x702a('0x16')][_0x702a('0x22')](_0x24d243[_0x702a('0x20')],{'raw':_0x24d243[_0x702a('0x17')]?_0x24d243[_0x702a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d243[_0x702a('0x17')]?_0x24d243[_0x702a('0x17')][_0x702a('0x19')]||null:null,'attributes':_0x24d243[_0x702a('0x17')]?_0x24d243[_0x702a('0x17')][_0x702a('0x1a')]||null:null,'limit':_0x24d243[_0x702a('0x17')]?_0x24d243[_0x702a('0x17')]['limit']||null:null})[_0x702a('0xa')](function(_0x194754){logger[_0x702a('0xb')](_0x702a('0x21'),_0x24d243);logger[_0x702a('0xc')](_0x702a('0x21'),_0x24d243,JSON[_0x702a('0xf')](_0x194754));_0xaa8c18(_0x194754);})[_0x702a('0x1e')](function(_0x38fa54){logger[_0x702a('0x10')](_0x702a('0x21'),_0x38fa54[_0x702a('0x13')],_0x24d243);_0x17ff8d(_0xde244[_0x702a('0x10')](0x1f4,_0x38fa54[_0x702a('0x13')]));});});}; \ No newline at end of file +var _0x41ec=['raw','attributes','limit','include','map','model','create','body','CreateMemberReport','UpdateMemberReport','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options'];(function(_0x1512af,_0x2c623d){var _0x3e0718=function(_0xce80c7){while(--_0xce80c7){_0x1512af['push'](_0x1512af['shift']());}};_0x3e0718(++_0x2c623d);}(_0x41ec,0x143));var _0xc41e=function(_0x480202,_0x5d2046){_0x480202=_0x480202-0x0;var _0x163d81=_0x41ec[_0x480202];return _0x163d81;};'use strict';var _=require('lodash');var util=require(_0xc41e('0x0'));var moment=require('moment');var BPromise=require(_0xc41e('0x1'));var rs=require(_0xc41e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc41e('0x3'))['db'];var utils=require(_0xc41e('0x4'));var logger=require(_0xc41e('0x5'))(_0xc41e('0x6'));var config=require(_0xc41e('0x7'));var jayson=require(_0xc41e('0x8'));var client=jayson[_0xc41e('0x9')][_0xc41e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27ce38,_0x3655bf,_0x9a951a){return new BPromise(function(_0x4d941e,_0x2b8cf6){return client[_0xc41e('0xb')](_0x27ce38,_0x9a951a)[_0xc41e('0xc')](function(_0x2a7ed8){logger[_0xc41e('0xd')](_0xc41e('0xe'),_0x3655bf,_0xc41e('0xf'));logger[_0xc41e('0x10')](_0xc41e('0x11'),_0x3655bf,_0xc41e('0xf'),JSON[_0xc41e('0x12')](_0x2a7ed8));if(_0x2a7ed8['error']){if(_0x2a7ed8[_0xc41e('0x13')][_0xc41e('0x14')]===0x1f4){logger[_0xc41e('0x13')](_0xc41e('0xe'),_0x3655bf,_0x2a7ed8[_0xc41e('0x13')][_0xc41e('0x15')]);return _0x2b8cf6(_0x2a7ed8[_0xc41e('0x13')][_0xc41e('0x15')]);}logger['error'](_0xc41e('0xe'),_0x3655bf,_0x2a7ed8[_0xc41e('0x13')][_0xc41e('0x15')]);return _0x4d941e(_0x2a7ed8[_0xc41e('0x13')]['message']);}else{logger['info'](_0xc41e('0xe'),_0x3655bf,_0xc41e('0xf'));_0x4d941e(_0x2a7ed8[_0xc41e('0x16')]['message']);}})[_0xc41e('0x17')](function(_0x2ef2ca){logger['error']('MemberReport,\x20%s,\x20%s',_0x3655bf,_0x2ef2ca);_0x2b8cf6(_0x2ef2ca);});});}exports[_0xc41e('0x18')]=function(_0x5c0517){var _0x37d0d6=this;return new Promise(function(_0x23c9b6,_0x5d630f){return db[_0xc41e('0x19')][_0xc41e('0x1a')]({'raw':_0x5c0517[_0xc41e('0x1b')]?_0x5c0517[_0xc41e('0x1b')][_0xc41e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c0517[_0xc41e('0x1b')]?_0x5c0517[_0xc41e('0x1b')]['where']||null:null,'attributes':_0x5c0517[_0xc41e('0x1b')]?_0x5c0517[_0xc41e('0x1b')][_0xc41e('0x1d')]||null:null,'limit':_0x5c0517['options']?_0x5c0517[_0xc41e('0x1b')][_0xc41e('0x1e')]||null:null,'include':_0x5c0517[_0xc41e('0x1b')]?_0x5c0517['options'][_0xc41e('0x1f')]?_[_0xc41e('0x20')](_0x5c0517[_0xc41e('0x1b')]['include'],function(_0x5a06dd){return{'model':db[_0x5a06dd['model']],'as':_0x5a06dd['as'],'attributes':_0x5a06dd[_0xc41e('0x1d')],'include':_0x5a06dd[_0xc41e('0x1f')]?_['map'](_0x5a06dd['include'],function(_0x5a3e0d){return{'model':db[_0x5a3e0d[_0xc41e('0x21')]],'as':_0x5a3e0d['as'],'attributes':_0x5a3e0d[_0xc41e('0x1d')],'include':_0x5a3e0d[_0xc41e('0x1f')]?_[_0xc41e('0x20')](_0x5a3e0d[_0xc41e('0x1f')],function(_0x580b9e){return{'model':db[_0x580b9e[_0xc41e('0x21')]],'as':_0x580b9e['as'],'attributes':_0x580b9e[_0xc41e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc41e('0xc')](function(_0x5bd682){logger[_0xc41e('0xd')](_0xc41e('0x18'),_0x5c0517);logger['debug'](_0xc41e('0x18'),_0x5c0517,JSON[_0xc41e('0x12')](_0x5bd682));_0x23c9b6(_0x5bd682);})[_0xc41e('0x17')](function(_0xcb3a15){logger[_0xc41e('0x13')](_0xc41e('0x18'),_0xcb3a15[_0xc41e('0x15')],_0x5c0517);_0x5d630f(_0x37d0d6['error'](0x1f4,_0xcb3a15['message']));});});};exports['CreateMemberReport']=function(_0x3cd142){var _0x1fc6e2=this;return new Promise(function(_0x24b7ac,_0x3334f8){return db[_0xc41e('0x19')][_0xc41e('0x22')](_0x3cd142[_0xc41e('0x23')],{'raw':_0x3cd142['options']?_0x3cd142[_0xc41e('0x1b')][_0xc41e('0x1c')]===undefined?!![]:![]:!![]})[_0xc41e('0xc')](function(_0x5ca527){logger[_0xc41e('0xd')]('CreateMemberReport',_0x3cd142);logger[_0xc41e('0x10')](_0xc41e('0x24'),_0x3cd142,JSON[_0xc41e('0x12')](_0x5ca527));_0x24b7ac(_0x5ca527);})[_0xc41e('0x17')](function(_0x4df6e6){logger['error'](_0xc41e('0x24'),_0x4df6e6[_0xc41e('0x15')],_0x3cd142);_0x3334f8(_0x1fc6e2[_0xc41e('0x13')](0x1f4,_0x4df6e6[_0xc41e('0x15')]));});});};exports[_0xc41e('0x25')]=function(_0x3ce21a){var _0x53861a=this;return new Promise(function(_0x42badc,_0x3416b5){return db[_0xc41e('0x19')]['update'](_0x3ce21a[_0xc41e('0x23')],{'raw':_0x3ce21a[_0xc41e('0x1b')]?_0x3ce21a['options'][_0xc41e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ce21a[_0xc41e('0x1b')]?_0x3ce21a[_0xc41e('0x1b')][_0xc41e('0x26')]||null:null,'attributes':_0x3ce21a[_0xc41e('0x1b')]?_0x3ce21a['options']['attributes']||null:null,'limit':_0x3ce21a[_0xc41e('0x1b')]?_0x3ce21a[_0xc41e('0x1b')][_0xc41e('0x1e')]||null:null})[_0xc41e('0xc')](function(_0x29fbec){logger[_0xc41e('0xd')](_0xc41e('0x25'),_0x3ce21a);logger[_0xc41e('0x10')](_0xc41e('0x25'),_0x3ce21a,JSON['stringify'](_0x29fbec));_0x42badc(_0x29fbec);})['catch'](function(_0x465280){logger[_0xc41e('0x13')](_0xc41e('0x25'),_0x465280[_0xc41e('0x15')],_0x3ce21a);_0x3416b5(_0x53861a[_0xc41e('0x13')](0x1f4,_0x465280[_0xc41e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f72b95c..e21677f 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 _0xc180=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','multer'];(function(_0x42f83b,_0x1b8b2f){var _0x55fead=function(_0x231aed){while(--_0x231aed){_0x42f83b['push'](_0x42f83b['shift']());}};_0x55fead(++_0x1b8b2f);}(_0xc180,0x185));var _0x0c18=function(_0x2d7905,_0x5917f8){_0x2d7905=_0x2d7905-0x0;var _0x3b5d05=_0xc180[_0x2d7905];return _0x3b5d05;};'use strict';var multer=require(_0x0c18('0x0'));var util=require(_0x0c18('0x1'));var path=require(_0x0c18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c18('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c18('0x4'));var interaction=require(_0x0c18('0x5'));var config=require(_0x0c18('0x6'));var controller=require(_0x0c18('0x7'));router['get']('/',controller[_0x0c18('0x8')]);module[_0x0c18('0x9')]=router; \ No newline at end of file +var _0x7bee=['./migration.controller','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x7bee,0x13d));var _0xe7be=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7bee[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xe7be('0x0'));var path=require(_0xe7be('0x1'));var timeout=require(_0xe7be('0x2'));var express=require(_0xe7be('0x3'));var router=express[_0xe7be('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7be('0x5'));var interaction=require(_0xe7be('0x6'));var config=require('../../config/environment');var controller=require(_0xe7be('0x7'));router['get']('/',controller['index']);module[_0xe7be('0x8')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 5a33f35..6a51830 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 _0xd907=['version','sequelize'];(function(_0x33db73,_0x33c82f){var _0x568904=function(_0x1e8301){while(--_0x1e8301){_0x33db73['push'](_0x33db73['shift']());}};_0x568904(++_0x33c82f);}(_0xd907,0x153));var _0x7d90=function(_0x4ae32d,_0x256489){_0x4ae32d=_0x4ae32d-0x0;var _0x550537=_0xd907[_0x4ae32d];return _0x550537;};'use strict';var Sequelize=require(_0x7d90('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x7d90('0x1')}}; \ No newline at end of file +var _0x46d2=['STRING','version','sequelize','exports'];(function(_0xb2efe0,_0x593efb){var _0x12bf44=function(_0x2124c8){while(--_0x2124c8){_0xb2efe0['push'](_0xb2efe0['shift']());}};_0x12bf44(++_0x593efb);}(_0x46d2,0x152));var _0x246d=function(_0x3df898,_0x35298a){_0x3df898=_0x3df898-0x0;var _0xb13cf1=_0x46d2[_0x3df898];return _0xb13cf1;};'use strict';var Sequelize=require(_0x246d('0x0'));module[_0x246d('0x1')]={'version':{'type':Sequelize[_0x246d('0x2')],'unique':_0x246d('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 134e8ea..89393bc 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 _0x5e5e=['update','then','destroy','stack','name','index','map','Migration','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','set','Content-Range','apply','reject','save'];(function(_0x307060,_0x26dc3d){var _0x3a2587=function(_0x283dde){while(--_0x283dde){_0x307060['push'](_0x307060['shift']());}};_0x3a2587(++_0x26dc3d);}(_0x5e5e,0xaf));var _0xe5e5=function(_0x33e333,_0x546a2f){_0x33e333=_0x33e333-0x0;var _0x40e156=_0x5e5e[_0x33e333];return _0x40e156;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5e5('0x0'));var zipdir=require(_0xe5e5('0x1'));var jsonpatch=require(_0xe5e5('0x2'));var rp=require(_0xe5e5('0x3'));var moment=require('moment');var BPromise=require(_0xe5e5('0x4'));var Mustache=require(_0xe5e5('0x5'));var util=require('util');var path=require(_0xe5e5('0x6'));var sox=require('sox');var csv=require(_0xe5e5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5e5('0x8'));var _=require(_0xe5e5('0x9'));var squel=require(_0xe5e5('0xa'));var crypto=require(_0xe5e5('0xb'));var jsforce=require(_0xe5e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5e5('0x7'));var querystring=require(_0xe5e5('0xd'));var Papa=require(_0xe5e5('0xe'));var Redis=require(_0xe5e5('0xf'));var authService=require(_0xe5e5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe5e5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5e5('0x12'))(_0xe5e5('0x13'));var utils=require(_0xe5e5('0x14'));var config=require(_0xe5e5('0x15'));var licenseUtil=require(_0xe5e5('0x16'));var db=require(_0xe5e5('0x17'))['db'];function respondWithStatusCode(_0x26fa81,_0x1c9890){_0x1c9890=_0x1c9890||0xcc;return function(_0x3e31a8){if(_0x3e31a8){return _0x26fa81[_0xe5e5('0x18')](_0x1c9890);}return _0x26fa81['status'](_0x1c9890)[_0xe5e5('0x19')]();};}function respondWithResult(_0xfc9e1f,_0x2f73bd){_0x2f73bd=_0x2f73bd||0xc8;return function(_0x1acc9d){if(_0x1acc9d){return _0xfc9e1f[_0xe5e5('0x1a')](_0x2f73bd)[_0xe5e5('0x1b')](_0x1acc9d);}};}function respondWithFilteredResult(_0x1348f9,_0x373dc5){return function(_0x24de55){if(_0x24de55){var _0x54dc39=typeof _0x373dc5[_0xe5e5('0x1c')]===_0xe5e5('0x1d')&&typeof _0x373dc5['limit']===_0xe5e5('0x1d');var _0xa0db46=_0x24de55['count'];var _0x655340=_0x54dc39?0x0:_0x373dc5[_0xe5e5('0x1c')];var _0x2e41da=_0x54dc39?_0x24de55['count']:_0x373dc5[_0xe5e5('0x1c')]+_0x373dc5['limit'];var _0x49c2cb;if(_0x2e41da>=_0xa0db46){_0x2e41da=_0xa0db46;_0x49c2cb=0xc8;}else{_0x49c2cb=0xce;}_0x1348f9[_0xe5e5('0x1a')](_0x49c2cb);return _0x1348f9[_0xe5e5('0x1e')](_0xe5e5('0x1f'),_0x655340+'-'+_0x2e41da+'/'+_0xa0db46)['json'](_0x24de55);}return null;};}function patchUpdates(_0x42d556){return function(_0x263d95){try{jsonpatch[_0xe5e5('0x20')](_0x263d95,_0x42d556,!![]);}catch(_0x395701){return BPromise[_0xe5e5('0x21')](_0x395701);}return _0x263d95[_0xe5e5('0x22')]();};}function saveUpdates(_0x5b1c20,_0x442913){return function(_0x3a36ea){if(_0x3a36ea){return _0x3a36ea[_0xe5e5('0x23')](_0x5b1c20)[_0xe5e5('0x24')](function(_0x168907){return _0x168907;});}return null;};}function removeEntity(_0x1e712f,_0x247c14){return function(_0x55cfd9){if(_0x55cfd9){return _0x55cfd9[_0xe5e5('0x25')]()[_0xe5e5('0x24')](function(){_0x1e712f[_0xe5e5('0x1a')](0xcc)[_0xe5e5('0x19')]();});}};}function handleEntityNotFound(_0x1ad8b6,_0x7644e4){return function(_0x2bb6d0){if(!_0x2bb6d0){_0x1ad8b6['sendStatus'](0x194);}return _0x2bb6d0;};}function handleError(_0x39c653,_0x3546bc){_0x3546bc=_0x3546bc||0x1f4;return function(_0x1ea9d6){logger['error'](_0x1ea9d6[_0xe5e5('0x26')]);if(_0x1ea9d6[_0xe5e5('0x27')]){delete _0x1ea9d6['name'];}_0x39c653[_0xe5e5('0x1a')](_0x3546bc)['send'](_0x1ea9d6);};}exports[_0xe5e5('0x28')]=function(_0x11d956,_0x51f596){var _0x2f86a9={},_0x522bba={},_0x46ae0f={'count':0x0,'rows':[]};var _0x58eef4=_[_0xe5e5('0x29')](db[_0xe5e5('0x2a')]['rawAttributes'],function(_0x1bb249){return{'name':_0x1bb249[_0xe5e5('0x2b')],'type':_0x1bb249[_0xe5e5('0x2c')][_0xe5e5('0x2d')]};});_0x522bba[_0xe5e5('0x2e')]=_[_0xe5e5('0x29')](_0x58eef4,'name');_0x522bba['query']=_[_0xe5e5('0x2f')](_0x11d956[_0xe5e5('0x30')]);_0x522bba[_0xe5e5('0x31')]=_[_0xe5e5('0x32')](_0x522bba['model'],_0x522bba['query']);_0x2f86a9[_0xe5e5('0x33')]=_[_0xe5e5('0x32')](_0x522bba[_0xe5e5('0x2e')],qs[_0xe5e5('0x34')](_0x11d956[_0xe5e5('0x30')]['fields']));_0x2f86a9[_0xe5e5('0x33')]=_0x2f86a9[_0xe5e5('0x33')][_0xe5e5('0x35')]?_0x2f86a9['attributes']:_0x522bba['model'];if(!_0x11d956[_0xe5e5('0x30')][_0xe5e5('0x36')](_0xe5e5('0x37'))){_0x2f86a9['limit']=qs[_0xe5e5('0x38')](_0x11d956[_0xe5e5('0x30')]['limit']);_0x2f86a9['offset']=qs[_0xe5e5('0x1c')](_0x11d956['query']['offset']);}_0x2f86a9[_0xe5e5('0x39')]=qs[_0xe5e5('0x3a')](_0x11d956[_0xe5e5('0x30')]['sort']);_0x2f86a9[_0xe5e5('0x3b')]=qs['filters'](_[_0xe5e5('0x3c')](_0x11d956['query'],_0x522bba[_0xe5e5('0x31')]),_0x58eef4);if(_0x11d956[_0xe5e5('0x30')][_0xe5e5('0x3d')]){_0x2f86a9[_0xe5e5('0x3b')]=_[_0xe5e5('0x3e')](_0x2f86a9['where'],{'$or':_[_0xe5e5('0x29')](_0x58eef4,function(_0x3acca3){if(_0x3acca3[_0xe5e5('0x2c')]!==_0xe5e5('0x3f')){var _0x2d5e3d={};_0x2d5e3d[_0x3acca3[_0xe5e5('0x27')]]={'$like':'%'+_0x11d956[_0xe5e5('0x30')]['filter']+'%'};return _0x2d5e3d;}})});}_0x2f86a9=_[_0xe5e5('0x3e')]({},_0x2f86a9,_0x11d956[_0xe5e5('0x40')]);var _0x166788={'where':_0x2f86a9[_0xe5e5('0x3b')]};return db[_0xe5e5('0x2a')][_0xe5e5('0x41')](_0x166788)[_0xe5e5('0x24')](function(_0x301d2c){_0x46ae0f[_0xe5e5('0x41')]=_0x301d2c;if(_0x11d956[_0xe5e5('0x30')][_0xe5e5('0x42')]){_0x2f86a9[_0xe5e5('0x43')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x2f86a9);})[_0xe5e5('0x24')](function(_0x4c0ec7){_0x46ae0f[_0xe5e5('0x44')]=_0x4c0ec7;return _0x46ae0f;})[_0xe5e5('0x24')](respondWithFilteredResult(_0x51f596,_0x2f86a9))[_0xe5e5('0x45')](handleError(_0x51f596,null));}; \ No newline at end of file +var _0x719a=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js'];(function(_0x3ce05f,_0x2af64f){var _0x4efa9b=function(_0x3fda25){while(--_0x3fda25){_0x3ce05f['push'](_0x3ce05f['shift']());}};_0x4efa9b(++_0x2af64f);}(_0x719a,0xfa));var _0xa719=function(_0x13fdbd,_0x8c1cde){_0x13fdbd=_0x13fdbd-0x0;var _0x2adbed=_0x719a[_0x13fdbd];return _0x2adbed;};'use strict';var emlformat=require(_0xa719('0x0'));var rimraf=require(_0xa719('0x1'));var zipdir=require(_0xa719('0x2'));var jsonpatch=require(_0xa719('0x3'));var rp=require(_0xa719('0x4'));var moment=require(_0xa719('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa719('0x6'));var util=require(_0xa719('0x7'));var path=require('path');var sox=require(_0xa719('0x8'));var csv=require(_0xa719('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa719('0xa'));var _=require('lodash');var squel=require(_0xa719('0xb'));var crypto=require(_0xa719('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa719('0xd'));var toCsv=require(_0xa719('0x9'));var querystring=require(_0xa719('0xe'));var Papa=require(_0xa719('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa719('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa719('0x11'));var logger=require(_0xa719('0x12'))(_0xa719('0x13'));var utils=require(_0xa719('0x14'));var config=require(_0xa719('0x15'));var licenseUtil=require(_0xa719('0x16'));var db=require(_0xa719('0x17'))['db'];function respondWithStatusCode(_0x465205,_0x6ece42){_0x6ece42=_0x6ece42||0xcc;return function(_0x25a284){if(_0x25a284){return _0x465205['sendStatus'](_0x6ece42);}return _0x465205['status'](_0x6ece42)[_0xa719('0x18')]();};}function respondWithResult(_0x495de1,_0x577d5d){_0x577d5d=_0x577d5d||0xc8;return function(_0xd0ad77){if(_0xd0ad77){return _0x495de1[_0xa719('0x19')](_0x577d5d)[_0xa719('0x1a')](_0xd0ad77);}};}function respondWithFilteredResult(_0x1ca052,_0x1a541c){return function(_0x469c01){if(_0x469c01){var _0x5c05ad=typeof _0x1a541c[_0xa719('0x1b')]===_0xa719('0x1c')&&typeof _0x1a541c[_0xa719('0x1d')]==='undefined';var _0x5143e7=_0x469c01[_0xa719('0x1e')];var _0x4f4d98=_0x5c05ad?0x0:_0x1a541c[_0xa719('0x1b')];var _0x1e7248=_0x5c05ad?_0x469c01[_0xa719('0x1e')]:_0x1a541c['offset']+_0x1a541c['limit'];var _0x8aea97;if(_0x1e7248>=_0x5143e7){_0x1e7248=_0x5143e7;_0x8aea97=0xc8;}else{_0x8aea97=0xce;}_0x1ca052[_0xa719('0x19')](_0x8aea97);return _0x1ca052[_0xa719('0x1f')]('Content-Range',_0x4f4d98+'-'+_0x1e7248+'/'+_0x5143e7)[_0xa719('0x1a')](_0x469c01);}return null;};}function patchUpdates(_0x5b4989){return function(_0x4e7793){try{jsonpatch[_0xa719('0x20')](_0x4e7793,_0x5b4989,!![]);}catch(_0xe81c76){return BPromise[_0xa719('0x21')](_0xe81c76);}return _0x4e7793[_0xa719('0x22')]();};}function saveUpdates(_0x3a238d,_0x52126b){return function(_0x59de20){if(_0x59de20){return _0x59de20['update'](_0x3a238d)[_0xa719('0x23')](function(_0x598c45){return _0x598c45;});}return null;};}function removeEntity(_0x39b171,_0x5c20e1){return function(_0x385dcc){if(_0x385dcc){return _0x385dcc['destroy']()['then'](function(){_0x39b171[_0xa719('0x19')](0xcc)[_0xa719('0x18')]();});}};}function handleEntityNotFound(_0x196aee,_0x51a88c){return function(_0x4252f6){if(!_0x4252f6){_0x196aee[_0xa719('0x24')](0x194);}return _0x4252f6;};}function handleError(_0x116b5b,_0x340f44){_0x340f44=_0x340f44||0x1f4;return function(_0x340c58){logger[_0xa719('0x25')](_0x340c58[_0xa719('0x26')]);if(_0x340c58[_0xa719('0x27')]){delete _0x340c58[_0xa719('0x27')];}_0x116b5b[_0xa719('0x19')](_0x340f44)[_0xa719('0x28')](_0x340c58);};}exports[_0xa719('0x29')]=function(_0xa9aeb9,_0x5a8d0b){var _0x355bc6={},_0x764d22={},_0x5f3460={'count':0x0,'rows':[]};var _0x5811a9=_[_0xa719('0x2a')](db[_0xa719('0x2b')][_0xa719('0x2c')],function(_0x29a6a0){return{'name':_0x29a6a0[_0xa719('0x2d')],'type':_0x29a6a0[_0xa719('0x2e')]['key']};});_0x764d22[_0xa719('0x2f')]=_[_0xa719('0x2a')](_0x5811a9,_0xa719('0x27'));_0x764d22[_0xa719('0x30')]=_[_0xa719('0x31')](_0xa9aeb9[_0xa719('0x30')]);_0x764d22[_0xa719('0x32')]=_['intersection'](_0x764d22[_0xa719('0x2f')],_0x764d22[_0xa719('0x30')]);_0x355bc6[_0xa719('0x33')]=_['intersection'](_0x764d22[_0xa719('0x2f')],qs['fields'](_0xa9aeb9[_0xa719('0x30')][_0xa719('0x34')]));_0x355bc6[_0xa719('0x33')]=_0x355bc6[_0xa719('0x33')]['length']?_0x355bc6[_0xa719('0x33')]:_0x764d22['model'];if(!_0xa9aeb9[_0xa719('0x30')][_0xa719('0x35')](_0xa719('0x36'))){_0x355bc6[_0xa719('0x1d')]=qs[_0xa719('0x1d')](_0xa9aeb9[_0xa719('0x30')][_0xa719('0x1d')]);_0x355bc6['offset']=qs[_0xa719('0x1b')](_0xa9aeb9[_0xa719('0x30')][_0xa719('0x1b')]);}_0x355bc6[_0xa719('0x37')]=qs['sort'](_0xa9aeb9[_0xa719('0x30')][_0xa719('0x38')]);_0x355bc6[_0xa719('0x39')]=qs[_0xa719('0x32')](_[_0xa719('0x3a')](_0xa9aeb9[_0xa719('0x30')],_0x764d22[_0xa719('0x32')]),_0x5811a9);if(_0xa9aeb9[_0xa719('0x30')][_0xa719('0x3b')]){_0x355bc6[_0xa719('0x39')]=_[_0xa719('0x3c')](_0x355bc6[_0xa719('0x39')],{'$or':_[_0xa719('0x2a')](_0x5811a9,function(_0x293a35){if(_0x293a35[_0xa719('0x2e')]!==_0xa719('0x3d')){var _0x19cbf0={};_0x19cbf0[_0x293a35[_0xa719('0x27')]]={'$like':'%'+_0xa9aeb9['query'][_0xa719('0x3b')]+'%'};return _0x19cbf0;}})});}_0x355bc6=_['merge']({},_0x355bc6,_0xa9aeb9[_0xa719('0x3e')]);var _0x3fa678={'where':_0x355bc6['where']};return db['Migration'][_0xa719('0x1e')](_0x3fa678)[_0xa719('0x23')](function(_0x484afc){_0x5f3460[_0xa719('0x1e')]=_0x484afc;if(_0xa9aeb9['query'][_0xa719('0x3f')]){_0x355bc6[_0xa719('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x355bc6);})[_0xa719('0x23')](function(_0x36a8b4){_0x5f3460[_0xa719('0x41')]=_0x36a8b4;return _0x5f3460;})[_0xa719('0x23')](respondWithFilteredResult(_0x5a8d0b,_0x355bc6))['catch'](handleError(_0x5a8d0b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1f23efe..2a1090e 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 _0xedf1=['path','rimraf','./migration.attributes','exports','define','Migration','migrations','moment','bluebird'];(function(_0x37e155,_0x23069a){var _0x447003=function(_0x309df1){while(--_0x309df1){_0x37e155['push'](_0x37e155['shift']());}};_0x447003(++_0x23069a);}(_0xedf1,0x193));var _0x1edf=function(_0x36680a,_0x12717a){_0x36680a=_0x36680a-0x0;var _0x24b74c=_0xedf1[_0x36680a];return _0x24b74c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1edf('0x0'));var BPromise=require(_0x1edf('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1edf('0x2'));var rimraf=require(_0x1edf('0x3'));var config=require('../../config/environment');var attributes=require(_0x1edf('0x4'));module[_0x1edf('0x5')]=function(_0x2d9613,_0x1a5e6c){return _0x2d9613[_0x1edf('0x6')](_0x1edf('0x7'),attributes,{'tableName':_0x1edf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c0=['Migration','../../config/logger','api','bluebird','../../config/environment','./migration.attributes','exports'];(function(_0xd347ee,_0x27daeb){var _0x39756d=function(_0x4ebba9){while(--_0x4ebba9){_0xd347ee['push'](_0xd347ee['shift']());}};_0x39756d(++_0x27daeb);}(_0xe0c0,0x182));var _0x0e0c=function(_0x6d0a98,_0x3ac498){_0x6d0a98=_0x6d0a98-0x0;var _0x2a9ee2=_0xe0c0[_0x6d0a98];return _0x2a9ee2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0e0c('0x0'))(_0x0e0c('0x1'));var moment=require('moment');var BPromise=require(_0x0e0c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e0c('0x3'));var attributes=require(_0x0e0c('0x4'));module[_0x0e0c('0x5')]=function(_0xac1b92,_0xa4191a){return _0xac1b92['define'](_0x0e0c('0x6'),attributes,{'tableName':'migrations','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 5360552..0564905 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 _0x1152=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2c3000,_0x414590){var _0x4846df=function(_0x100a06){while(--_0x100a06){_0x2c3000['push'](_0x2c3000['shift']());}};_0x4846df(++_0x414590);}(_0x1152,0x182));var _0x2115=function(_0x32e758,_0x13c271){_0x32e758=_0x32e758-0x0;var _0x349316=_0x1152[_0x32e758];return _0x349316;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564071,_0x54cdd0,_0x5dbb85){return new BPromise(function(_0x5df6db,_0x158711){return client[_0x2115('0xb')](_0x564071,_0x5dbb85)[_0x2115('0xc')](function(_0x5156f2){logger[_0x2115('0xd')]('Migration,\x20%s,\x20%s',_0x54cdd0,'request\x20sent');logger[_0x2115('0xe')](_0x2115('0xf'),_0x54cdd0,_0x2115('0x10'),JSON['stringify'](_0x5156f2));if(_0x5156f2[_0x2115('0x11')]){if(_0x5156f2['error'][_0x2115('0x12')]===0x1f4){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x158711(_0x5156f2['error'][_0x2115('0x14')]);}logger['error'](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x5df6db(_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);}else{logger[_0x2115('0xd')](_0x2115('0x13'),_0x54cdd0,'request\x20sent');_0x5df6db(_0x5156f2[_0x2115('0x15')][_0x2115('0x14')]);}})[_0x2115('0x16')](function(_0x184c05){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x184c05);_0x158711(_0x184c05);});});} \ No newline at end of file +var _0xe99c=['../../config/environment','client','request','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x388209,_0x4bc7ee){var _0x5d9196=function(_0x4e680a){while(--_0x4e680a){_0x388209['push'](_0x388209['shift']());}};_0x5d9196(++_0x4bc7ee);}(_0xe99c,0x197));var _0xce99=function(_0x2477b9,_0x38544c){_0x2477b9=_0x2477b9-0x0;var _0x3a5836=_0xe99c[_0x2477b9];return _0x3a5836;};'use strict';var _=require(_0xce99('0x0'));var util=require('util');var moment=require(_0xce99('0x1'));var BPromise=require(_0xce99('0x2'));var rs=require(_0xce99('0x3'));var fs=require('fs');var Redis=require(_0xce99('0x4'));var db=require(_0xce99('0x5'))['db'];var utils=require(_0xce99('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xce99('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xce99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3755dd,_0x380c7c,_0x1e4c4e){return new BPromise(function(_0x732cca,_0x39df1c){return client[_0xce99('0x9')](_0x3755dd,_0x1e4c4e)[_0xce99('0xa')](function(_0x48aa48){logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));logger['debug'](_0xce99('0xd'),_0x380c7c,_0xce99('0xc'),JSON[_0xce99('0xe')](_0x48aa48));if(_0x48aa48['error']){if(_0x48aa48[_0xce99('0xf')]['code']===0x1f4){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x48aa48['error']['message']);return _0x39df1c(_0x48aa48[_0xce99('0xf')][_0xce99('0x10')]);}logger[_0xce99('0xf')]('Migration,\x20%s,\x20%s',_0x380c7c,_0x48aa48['error'][_0xce99('0x10')]);return _0x732cca(_0x48aa48['error'][_0xce99('0x10')]);}else{logger['info'](_0xce99('0xb'),_0x380c7c,_0xce99('0xc'));_0x732cca(_0x48aa48[_0xce99('0x11')]['message']);}})['catch'](function(_0x967d3d){logger[_0xce99('0xf')](_0xce99('0xb'),_0x380c7c,_0x967d3d);_0x39df1c(_0x967d3d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index e038731..d38a1cf 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 _0xb422=['../../components/interaction/service','./network.controller','isAuthenticated','index','get','show','post','put','update','delete','/:id','destroy','exports','connect-timeout','fs-extra'];(function(_0x2d6c24,_0x39bb49){var _0x4472ba=function(_0x1aaa1b){while(--_0x1aaa1b){_0x2d6c24['push'](_0x2d6c24['shift']());}};_0x4472ba(++_0x39bb49);}(_0xb422,0x85));var _0x2b42=function(_0x2e80f2,_0x4a8364){_0x2e80f2=_0x2e80f2-0x0;var _0x12ef3c=_0xb422[_0x2e80f2];return _0x12ef3c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2b42('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2b42('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x2b42('0x2'));var config=require('../../config/environment');var controller=require(_0x2b42('0x3'));router['get']('/',auth[_0x2b42('0x4')](),controller[_0x2b42('0x5')]);router[_0x2b42('0x6')]('/:id',auth[_0x2b42('0x4')](),controller[_0x2b42('0x7')]);router[_0x2b42('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2b42('0x9')]('/:id',auth[_0x2b42('0x4')](),controller[_0x2b42('0xa')]);router[_0x2b42('0xb')](_0x2b42('0xc'),auth['isAuthenticated'](),controller[_0x2b42('0xd')]);module[_0x2b42('0xe')]=router; \ No newline at end of file +var _0xd2f5=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x36a2b1,_0x340675){var _0xeb3ac5=function(_0x26dc33){while(--_0x26dc33){_0x36a2b1['push'](_0x36a2b1['shift']());}};_0xeb3ac5(++_0x340675);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x54f8aa,_0x3aea98){_0x54f8aa=_0x54f8aa-0x0;var _0x55c403=_0xd2f5[_0x54f8aa];return _0x55c403;};'use strict';var multer=require(_0x5d2f('0x0'));var util=require(_0x5d2f('0x1'));var path=require(_0x5d2f('0x2'));var timeout=require(_0x5d2f('0x3'));var express=require('express');var router=express[_0x5d2f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5d2f('0x5'));var config=require(_0x5d2f('0x6'));var controller=require(_0x5d2f('0x7'));router['get']('/',auth[_0x5d2f('0x8')](),controller[_0x5d2f('0x9')]);router[_0x5d2f('0xa')]('/:id',auth[_0x5d2f('0x8')](),controller[_0x5d2f('0xb')]);router[_0x5d2f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d2f('0xd')](_0x5d2f('0xe'),auth['isAuthenticated'](),controller[_0x5d2f('0xf')]);router[_0x5d2f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5d2f('0x11')]);module[_0x5d2f('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c644a5f..720408d 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 _0x6194=['exports','ENUM','localnet','externip','stun','STRING','sequelize'];(function(_0x55d7e2,_0x289863){var _0x20cb7b=function(_0x778efa){while(--_0x778efa){_0x55d7e2['push'](_0x55d7e2['shift']());}};_0x20cb7b(++_0x289863);}(_0x6194,0x19c));var _0x4619=function(_0x258c1c,_0x1e2696){_0x258c1c=_0x258c1c-0x0;var _0x4ac65f=_0x6194[_0x258c1c];return _0x4ac65f;};'use strict';var Sequelize=require(_0x4619('0x0'));module[_0x4619('0x1')]={'type':{'type':Sequelize[_0x4619('0x2')](_0x4619('0x3'),_0x4619('0x4'),_0x4619('0x5'),'turn')},'value':{'type':Sequelize[_0x4619('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd1b3=['exports','ENUM','localnet','externip','stun','STRING'];(function(_0x4cb99e,_0x5b1e28){var _0x3f101c=function(_0x181aed){while(--_0x181aed){_0x4cb99e['push'](_0x4cb99e['shift']());}};_0x3f101c(++_0x5b1e28);}(_0xd1b3,0x19e));var _0x3d1b=function(_0xb8e2f1,_0x369a6c){_0xb8e2f1=_0xb8e2f1-0x0;var _0x309065=_0xd1b3[_0xb8e2f1];return _0x309065;};'use strict';var Sequelize=require('sequelize');module[_0x3d1b('0x0')]={'type':{'type':Sequelize[_0x3d1b('0x1')](_0x3d1b('0x2'),_0x3d1b('0x3'),_0x3d1b('0x4'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d1b('0x5')]},'password':{'type':Sequelize[_0x3d1b('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 97b367d..ac51e80 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 _0xf1c9=['res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','STUN','/etc/asterisk/stun_xcally.conf','format','/etc/asterisk/turn_xcally.conf','util','path','ejs','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','status','json','offset','count','set','update','destroy','end','sendStatus','name','send','Network','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','create','body','toUpperCase','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','Reload'];(function(_0x131676,_0x2c6593){var _0x2dabc4=function(_0x57c1eb){while(--_0x57c1eb){_0x131676['push'](_0x131676['shift']());}};_0x2dabc4(++_0x2c6593);}(_0xf1c9,0x1b2));var _0x9f1c=function(_0x5c8424,_0x33f6ee){_0x5c8424=_0x5c8424-0x0;var _0x2fb610=_0xf1c9[_0x5c8424];return _0x2fb610;};'use strict';var util=require(_0x9f1c('0x0'));var path=require(_0x9f1c('0x1'));var ejs=require(_0x9f1c('0x2'));var fs=require('fs');var _=require(_0x9f1c('0x3'));var qs=require(_0x9f1c('0x4'));var logger=require('../../config/logger')(_0x9f1c('0x5'));var config=require('../../config/environment');var db=require(_0x9f1c('0x6'))['db'];var jayson=require(_0x9f1c('0x7'));var client=jayson[_0x9f1c('0x8')][_0x9f1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19c91f,_0xdd1bc1,_0x370bdf,_0x1d63b4){return new Promise(function(_0x15c8e3,_0xf6464b){var _0x13f44f=_0x1d63b4||client;return _0x13f44f[_0x9f1c('0xa')](_0x19c91f,_0x370bdf)[_0x9f1c('0xb')](function(_0x3d495e){logger['info'](_0x9f1c('0xc'),_0xdd1bc1,'request\x20sent');logger[_0x9f1c('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0xdd1bc1,_0x9f1c('0xe'),JSON['stringify'](_0x3d495e));if(_0x3d495e[_0x9f1c('0xf')]){if(_0x3d495e[_0x9f1c('0xf')][_0x9f1c('0x10')]===0x1f4){logger['error'](_0x9f1c('0xc'),_0xdd1bc1,_0x3d495e['error'][_0x9f1c('0x11')]);return _0xf6464b(_0x3d495e[_0x9f1c('0xf')][_0x9f1c('0x11')]);}logger[_0x9f1c('0xf')](_0x9f1c('0xc'),_0xdd1bc1,_0x3d495e[_0x9f1c('0xf')][_0x9f1c('0x11')]);return _0x15c8e3(_0x3d495e[_0x9f1c('0xf')][_0x9f1c('0x11')]);}else{logger[_0x9f1c('0x12')]('Network,\x20%s,\x20%s',_0xdd1bc1,_0x9f1c('0xe'));_0x15c8e3(_0x3d495e[_0x9f1c('0x13')][_0x9f1c('0x11')]);}})[_0x9f1c('0x14')](function(_0x2acf39){logger[_0x9f1c('0xf')](_0x9f1c('0xc'),_0xdd1bc1,_0x2acf39);_0xf6464b(_0x2acf39);});});}function respondWithResult(_0x4b80b7,_0xd5c8fc){_0xd5c8fc=_0xd5c8fc||0xc8;return function(_0x2577c7){if(_0x2577c7){return _0x4b80b7[_0x9f1c('0x15')](_0xd5c8fc)[_0x9f1c('0x16')](_0x2577c7);}};}function respondWithFilteredResult(_0x7ee27c,_0x401974){return function(_0x194fb5){if(_0x194fb5){var _0xbd9354=typeof _0x401974[_0x9f1c('0x17')]==='undefined'&&typeof _0x401974['limit']==='undefined';var _0x27c78d=_0x194fb5[_0x9f1c('0x18')];var _0x3e6977=_0xbd9354?0x0:_0x401974['offset'];var _0x3047d3=_0xbd9354?_0x194fb5[_0x9f1c('0x18')]:_0x401974[_0x9f1c('0x17')]+_0x401974['limit'];var _0x212c34;if(_0x3047d3>=_0x27c78d){_0x3047d3=_0x27c78d;_0x212c34=0xc8;}else{_0x212c34=0xce;}_0x7ee27c['status'](_0x212c34);return _0x7ee27c[_0x9f1c('0x19')]('Content-Range',_0x3e6977+'-'+_0x3047d3+'/'+_0x27c78d)['json'](_0x194fb5);}return null;};}function saveUpdates(_0x645daf){return function(_0x1a186c){if(_0x1a186c){return _0x1a186c[_0x9f1c('0x1a')](_0x645daf)[_0x9f1c('0xb')](function(_0x35d1a4){return _0x35d1a4;});}return null;};}function removeEntity(_0x3da255){return function(_0x1faad6){if(_0x1faad6){return _0x1faad6[_0x9f1c('0x1b')]()[_0x9f1c('0xb')](function(){_0x3da255['status'](0xcc)[_0x9f1c('0x1c')]();});}};}function handleEntityNotFound(_0x16f640){return function(_0x30f5b5){if(!_0x30f5b5){_0x16f640[_0x9f1c('0x1d')](0x194);}return _0x30f5b5;};}function handleError(_0x40b471,_0x37e875){_0x37e875=_0x37e875||0x1f4;return function(_0x28b359){logger[_0x9f1c('0xf')](_0x28b359['stack']);if(_0x28b359[_0x9f1c('0x1e')]){delete _0x28b359[_0x9f1c('0x1e')];}_0x40b471['status'](_0x37e875)[_0x9f1c('0x1f')](_0x28b359);};}exports['index']=function(_0x37a789,_0x29e9cf){var _0x17677f={},_0x2c3e9c={},_0x13c890={'count':0x0,'rows':[]};var _0x421b7d=_['map'](db[_0x9f1c('0x20')][_0x9f1c('0x21')],function(_0x2b2bfd){return{'name':_0x2b2bfd[_0x9f1c('0x22')],'type':_0x2b2bfd[_0x9f1c('0x23')][_0x9f1c('0x24')]};});_0x2c3e9c[_0x9f1c('0x25')]=_[_0x9f1c('0x26')](_0x421b7d,_0x9f1c('0x1e'));_0x2c3e9c[_0x9f1c('0x27')]=_[_0x9f1c('0x28')](_0x37a789['query']);_0x2c3e9c[_0x9f1c('0x29')]=_[_0x9f1c('0x2a')](_0x2c3e9c[_0x9f1c('0x25')],_0x2c3e9c[_0x9f1c('0x27')]);_0x17677f[_0x9f1c('0x2b')]=_[_0x9f1c('0x2a')](_0x2c3e9c[_0x9f1c('0x25')],qs['fields'](_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x2c')]));_0x17677f['attributes']=_0x17677f['attributes']['length']?_0x17677f[_0x9f1c('0x2b')]:_0x2c3e9c[_0x9f1c('0x25')];if(!_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x2d')]('nolimit')){_0x17677f[_0x9f1c('0x2e')]=qs[_0x9f1c('0x2e')](_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x2e')]);_0x17677f[_0x9f1c('0x17')]=qs[_0x9f1c('0x17')](_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x17')]);}_0x17677f['order']=qs[_0x9f1c('0x2f')](_0x37a789['query'][_0x9f1c('0x2f')]);_0x17677f[_0x9f1c('0x30')]=qs[_0x9f1c('0x29')](_[_0x9f1c('0x31')](_0x37a789['query'],_0x2c3e9c[_0x9f1c('0x29')]),_0x421b7d);if(_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x32')]){_0x17677f['where']=_[_0x9f1c('0x33')](_0x17677f[_0x9f1c('0x30')],{'$or':_[_0x9f1c('0x26')](_0x421b7d,function(_0x3c072c){if(_0x3c072c[_0x9f1c('0x23')]!==_0x9f1c('0x34')){var _0x3d8c2f={};_0x3d8c2f[_0x3c072c[_0x9f1c('0x1e')]]={'$like':'%'+_0x37a789[_0x9f1c('0x27')][_0x9f1c('0x32')]+'%'};return _0x3d8c2f;}})});}_0x17677f=_['merge']({},_0x17677f,_0x37a789[_0x9f1c('0x35')]);var _0x4e1d33={'where':_0x17677f[_0x9f1c('0x30')]};return db[_0x9f1c('0x20')][_0x9f1c('0x18')](_0x4e1d33)[_0x9f1c('0xb')](function(_0x3612bd){_0x13c890['count']=_0x3612bd;if(_0x37a789['query'][_0x9f1c('0x36')]){_0x17677f[_0x9f1c('0x37')]=[{'all':!![]}];}return db['Network'][_0x9f1c('0x38')](_0x17677f);})[_0x9f1c('0xb')](function(_0x15b3e7){_0x13c890[_0x9f1c('0x39')]=_0x15b3e7;return _0x13c890;})[_0x9f1c('0xb')](respondWithFilteredResult(_0x29e9cf,_0x17677f))['catch'](handleError(_0x29e9cf,null));};exports[_0x9f1c('0x3a')]=function(_0xcc8747,_0x5c1c29){var _0x2401bd={'raw':!![],'where':{'id':_0xcc8747[_0x9f1c('0x3b')]['id']}},_0x1fb7f5={};_0x1fb7f5[_0x9f1c('0x25')]=_[_0x9f1c('0x28')](db[_0x9f1c('0x20')][_0x9f1c('0x21')]);_0x1fb7f5[_0x9f1c('0x27')]=_['keys'](_0xcc8747['query']);_0x1fb7f5[_0x9f1c('0x29')]=_[_0x9f1c('0x2a')](_0x1fb7f5['model'],_0x1fb7f5['query']);_0x2401bd['attributes']=_[_0x9f1c('0x2a')](_0x1fb7f5[_0x9f1c('0x25')],qs[_0x9f1c('0x2c')](_0xcc8747[_0x9f1c('0x27')][_0x9f1c('0x2c')]));_0x2401bd[_0x9f1c('0x2b')]=_0x2401bd[_0x9f1c('0x2b')][_0x9f1c('0x3c')]?_0x2401bd[_0x9f1c('0x2b')]:_0x1fb7f5[_0x9f1c('0x25')];if(_0xcc8747[_0x9f1c('0x27')][_0x9f1c('0x36')]){_0x2401bd['include']=[{'all':!![]}];}_0x2401bd=_[_0x9f1c('0x33')]({},_0x2401bd,_0xcc8747['options']);return db[_0x9f1c('0x20')][_0x9f1c('0x3d')](_0x2401bd)[_0x9f1c('0xb')](handleEntityNotFound(_0x5c1c29,null))[_0x9f1c('0xb')](respondWithResult(_0x5c1c29,null))[_0x9f1c('0x14')](handleError(_0x5c1c29,null));};exports['create']=function(_0x307377,_0x2942cf){var _0x4c7feb;return db[_0x9f1c('0x20')][_0x9f1c('0x3e')](_0x307377[_0x9f1c('0x3f')],{'raw':!![]})[_0x9f1c('0xb')](function(_0x445d89){_0x4c7feb=_0x445d89;return db[_0x9f1c('0x20')]['findAll']({'where':{'type':_0x307377[_0x9f1c('0x3f')]['type']},'raw':!![]});})['then'](function(_0x3add51){if(_0x4c7feb[_0x9f1c('0x23')][_0x9f1c('0x40')]()=='STUN'){var _0x4bd831=fs[_0x9f1c('0x41')](path['join'](config['root'],_0x9f1c('0x42')),_0x9f1c('0x43'));var _0x1ff022=ejs[_0x9f1c('0x44')](_0x4bd831,{'networks':_0x3add51||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1ff022);return respondWithRpcPromise(_0x9f1c('0x45'),_0x9f1c('0x3e'),{'module':_0x9f1c('0x46')});}else if(_0x4c7feb['type']['toUpperCase']()==_0x9f1c('0x47')){var _0x56942a=fs[_0x9f1c('0x41')](path[_0x9f1c('0x48')](config[_0x9f1c('0x49')],_0x9f1c('0x4a')),_0x9f1c('0x43'));var _0x2794b0=ejs[_0x9f1c('0x44')](_0x56942a,{'networks':_0x3add51||[]});fs[_0x9f1c('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x2794b0);return respondWithRpcPromise('Reload',_0x9f1c('0x3e'),{'module':_0x9f1c('0x46')});}else{var _0x315233=fs['readFileSync'](path[_0x9f1c('0x48')](config['root'],_0x9f1c('0x4c')),'utf8');var _0x5a138d=ejs['render'](_0x315233,{'networks':_0x3add51||[]});fs['writeFileSync'](util['format'](_0x9f1c('0x4d'),_0x307377[_0x9f1c('0x3f')][_0x9f1c('0x23')][_0x9f1c('0x4e')]()),_0x5a138d);return respondWithRpcPromise(_0x9f1c('0x45'),_0x9f1c('0x3e'),{'module':_0x9f1c('0x4f')});}})[_0x9f1c('0xb')](function(){return _0x4c7feb;})[_0x9f1c('0xb')](respondWithResult(_0x2942cf,0xc9))[_0x9f1c('0x14')](handleError(_0x2942cf,null));};exports[_0x9f1c('0x1a')]=function(_0x20f2ad,_0x5a2ad7){var _0x3ac41f;return db[_0x9f1c('0x20')]['find']({'where':{'id':_0x20f2ad['params']['id']}})[_0x9f1c('0xb')](handleEntityNotFound(_0x5a2ad7,null))[_0x9f1c('0xb')](saveUpdates(_0x20f2ad['body'],null))[_0x9f1c('0xb')](function(_0xd6615f){if(_0xd6615f){_0x3ac41f=_0xd6615f;return db[_0x9f1c('0x20')][_0x9f1c('0x38')]({'where':{'type':_0x3ac41f[_0x9f1c('0x23')]},'raw':!![]});}return null;})[_0x9f1c('0xb')](function(_0x15a8e8){if(_0x3ac41f[_0x9f1c('0x23')][_0x9f1c('0x40')]()==_0x9f1c('0x50')){var _0x341874=fs['readFileSync'](path[_0x9f1c('0x48')](config['root'],_0x9f1c('0x42')),_0x9f1c('0x43'));var _0x583f92=ejs[_0x9f1c('0x44')](_0x341874,{'networks':_0x15a8e8||[]});fs[_0x9f1c('0x4b')](_0x9f1c('0x51'),_0x583f92);return respondWithRpcPromise('Reload',_0x9f1c('0x1a'),{'module':_0x9f1c('0x46')});}else if(_0x3ac41f['type']['toUpperCase']()==_0x9f1c('0x47')){var _0x4a93cb=fs[_0x9f1c('0x41')](path[_0x9f1c('0x48')](config['root'],_0x9f1c('0x4a')),_0x9f1c('0x43'));var _0x303706=ejs[_0x9f1c('0x44')](_0x4a93cb,{'networks':_0x15a8e8||[]});fs[_0x9f1c('0x4b')]('/etc/asterisk/turn_xcally.conf',_0x303706);return respondWithRpcPromise('Reload','update',{'module':_0x9f1c('0x46')});}else{var _0x553edd=fs['readFileSync'](path[_0x9f1c('0x48')](config[_0x9f1c('0x49')],_0x9f1c('0x4c')),_0x9f1c('0x43'));var _0x15a85d=ejs['render'](_0x553edd,{'networks':_0x15a8e8||[]});fs[_0x9f1c('0x4b')](util[_0x9f1c('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x20f2ad['body'][_0x9f1c('0x23')][_0x9f1c('0x4e')]()),_0x15a85d);return respondWithRpcPromise(_0x9f1c('0x45'),_0x9f1c('0x1a'),{'module':_0x9f1c('0x4f')});}})[_0x9f1c('0xb')](function(_0x46dc05){if(_0x46dc05){return _0x3ac41f;}return null;})[_0x9f1c('0xb')](respondWithResult(_0x5a2ad7,null))[_0x9f1c('0x14')](handleError(_0x5a2ad7,null));};exports[_0x9f1c('0x1b')]=function(_0x31b528,_0x400b62){var _0x5072fd;return db[_0x9f1c('0x20')][_0x9f1c('0x3d')]({'where':{'id':_0x31b528['params']['id']}})['then'](function(_0x316d97){_0x5072fd=_0x316d97;return _0x316d97;})[_0x9f1c('0xb')](handleEntityNotFound(_0x400b62,null))[_0x9f1c('0xb')](removeEntity(_0x400b62,null))[_0x9f1c('0xb')](function(){if(_0x5072fd){return db['Network'][_0x9f1c('0x38')]({'where':{'type':_0x5072fd[_0x9f1c('0x23')]},'raw':!![]});}})[_0x9f1c('0xb')](function(_0x2a664f){if(_0x5072fd['type'][_0x9f1c('0x40')]()==_0x9f1c('0x50')){var _0x2eaa0d=fs[_0x9f1c('0x41')](path[_0x9f1c('0x48')](config['root'],_0x9f1c('0x42')),_0x9f1c('0x43'));var _0x5da6f5=ejs[_0x9f1c('0x44')](_0x2eaa0d,{'networks':_0x2a664f||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x5da6f5);return respondWithRpcPromise(_0x9f1c('0x45'),_0x9f1c('0x1b'),{'module':_0x9f1c('0x46')});}else if(_0x5072fd[_0x9f1c('0x23')][_0x9f1c('0x40')]()==_0x9f1c('0x47')){var _0x5aa98a=fs[_0x9f1c('0x41')](path['join'](config[_0x9f1c('0x49')],_0x9f1c('0x4a')),_0x9f1c('0x43'));var _0x476cbb=ejs[_0x9f1c('0x44')](_0x5aa98a,{'networks':_0x2a664f||[]});fs['writeFileSync'](_0x9f1c('0x53'),_0x476cbb);return respondWithRpcPromise(_0x9f1c('0x45'),_0x9f1c('0x1b'),{'module':'res_stun_monitor.so'});}else{var _0x5d033e=fs[_0x9f1c('0x41')](path[_0x9f1c('0x48')](config['root'],_0x9f1c('0x4c')),_0x9f1c('0x43'));var _0x2a3ccc=ejs['render'](_0x5d033e,{'networks':_0x2a664f||[]});fs[_0x9f1c('0x4b')](util[_0x9f1c('0x52')](_0x9f1c('0x4d'),_0x5072fd['type'][_0x9f1c('0x4e')]()),_0x2a3ccc);return respondWithRpcPromise('Reload',_0x9f1c('0x1b'),{'module':_0x9f1c('0x4f')});}})[_0x9f1c('0x14')](handleError(_0x400b62,null));}; \ No newline at end of file +var _0x9cca=['TURN','utf8','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','toLowerCase','Reload','chan_sip.so','body','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Network','find','create','type','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','res_stun_monitor.so'];(function(_0x8f8dcd,_0x249623){var _0x4041bd=function(_0x874abc){while(--_0x874abc){_0x8f8dcd['push'](_0x8f8dcd['shift']());}};_0x4041bd(++_0x249623);}(_0x9cca,0x176));var _0xa9cc=function(_0x1447cf,_0xbe0d33){_0x1447cf=_0x1447cf-0x0;var _0x59a35f=_0x9cca[_0x1447cf];return _0x59a35f;};'use strict';var util=require('util');var path=require(_0xa9cc('0x0'));var ejs=require(_0xa9cc('0x1'));var fs=require('fs');var _=require(_0xa9cc('0x2'));var qs=require(_0xa9cc('0x3'));var logger=require(_0xa9cc('0x4'))(_0xa9cc('0x5'));var config=require(_0xa9cc('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa9cc('0x7'));var client=jayson[_0xa9cc('0x8')][_0xa9cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10d8d1,_0x2419dd,_0x2f4c22,_0x44493c){return new Promise(function(_0xbd72ee,_0x1c9521){var _0x27613a=_0x44493c||client;return _0x27613a[_0xa9cc('0xa')](_0x10d8d1,_0x2f4c22)['then'](function(_0x493ea6){logger[_0xa9cc('0xb')](_0xa9cc('0xc'),_0x2419dd,_0xa9cc('0xd'));logger[_0xa9cc('0xe')](_0xa9cc('0xf'),_0x2419dd,_0xa9cc('0xd'),JSON[_0xa9cc('0x10')](_0x493ea6));if(_0x493ea6[_0xa9cc('0x11')]){if(_0x493ea6['error']['code']===0x1f4){logger[_0xa9cc('0x11')]('Network,\x20%s,\x20%s',_0x2419dd,_0x493ea6[_0xa9cc('0x11')][_0xa9cc('0x12')]);return _0x1c9521(_0x493ea6[_0xa9cc('0x11')][_0xa9cc('0x12')]);}logger['error'](_0xa9cc('0xc'),_0x2419dd,_0x493ea6[_0xa9cc('0x11')][_0xa9cc('0x12')]);return _0xbd72ee(_0x493ea6[_0xa9cc('0x11')][_0xa9cc('0x12')]);}else{logger[_0xa9cc('0xb')](_0xa9cc('0xc'),_0x2419dd,_0xa9cc('0xd'));_0xbd72ee(_0x493ea6[_0xa9cc('0x13')][_0xa9cc('0x12')]);}})[_0xa9cc('0x14')](function(_0x32cbbb){logger[_0xa9cc('0x11')](_0xa9cc('0xc'),_0x2419dd,_0x32cbbb);_0x1c9521(_0x32cbbb);});});}function respondWithResult(_0x2eecdb,_0x521c86){_0x521c86=_0x521c86||0xc8;return function(_0x2011ca){if(_0x2011ca){return _0x2eecdb[_0xa9cc('0x15')](_0x521c86)[_0xa9cc('0x16')](_0x2011ca);}};}function respondWithFilteredResult(_0x460dc0,_0x311b9f){return function(_0x310151){if(_0x310151){var _0x302bf0=typeof _0x311b9f[_0xa9cc('0x17')]==='undefined'&&typeof _0x311b9f[_0xa9cc('0x18')]===_0xa9cc('0x19');var _0x1e57ff=_0x310151[_0xa9cc('0x1a')];var _0x5aaa2f=_0x302bf0?0x0:_0x311b9f[_0xa9cc('0x17')];var _0x5d9d3d=_0x302bf0?_0x310151[_0xa9cc('0x1a')]:_0x311b9f[_0xa9cc('0x17')]+_0x311b9f[_0xa9cc('0x18')];var _0x1deaef;if(_0x5d9d3d>=_0x1e57ff){_0x5d9d3d=_0x1e57ff;_0x1deaef=0xc8;}else{_0x1deaef=0xce;}_0x460dc0[_0xa9cc('0x15')](_0x1deaef);return _0x460dc0[_0xa9cc('0x1b')](_0xa9cc('0x1c'),_0x5aaa2f+'-'+_0x5d9d3d+'/'+_0x1e57ff)[_0xa9cc('0x16')](_0x310151);}return null;};}function saveUpdates(_0x5900ce){return function(_0x22332e){if(_0x22332e){return _0x22332e[_0xa9cc('0x1d')](_0x5900ce)[_0xa9cc('0x1e')](function(_0x4498e3){return _0x4498e3;});}return null;};}function removeEntity(_0x530809){return function(_0x28da06){if(_0x28da06){return _0x28da06[_0xa9cc('0x1f')]()[_0xa9cc('0x1e')](function(){_0x530809['status'](0xcc)[_0xa9cc('0x20')]();});}};}function handleEntityNotFound(_0xc5058c){return function(_0x8773ab){if(!_0x8773ab){_0xc5058c[_0xa9cc('0x21')](0x194);}return _0x8773ab;};}function handleError(_0x3aa9f7,_0x31d5c5){_0x31d5c5=_0x31d5c5||0x1f4;return function(_0x49094a){logger[_0xa9cc('0x11')](_0x49094a['stack']);if(_0x49094a[_0xa9cc('0x22')]){delete _0x49094a['name'];}_0x3aa9f7['status'](_0x31d5c5)[_0xa9cc('0x23')](_0x49094a);};}exports[_0xa9cc('0x24')]=function(_0x3370a3,_0x1d1ae1){var _0x1f47d8={},_0x944152={},_0x41cf08={'count':0x0,'rows':[]};var _0x397bbb=_[_0xa9cc('0x25')](db['Network'][_0xa9cc('0x26')],function(_0x325d35){return{'name':_0x325d35[_0xa9cc('0x27')],'type':_0x325d35['type'][_0xa9cc('0x28')]};});_0x944152[_0xa9cc('0x29')]=_[_0xa9cc('0x25')](_0x397bbb,_0xa9cc('0x22'));_0x944152[_0xa9cc('0x2a')]=_[_0xa9cc('0x2b')](_0x3370a3['query']);_0x944152['filters']=_['intersection'](_0x944152[_0xa9cc('0x29')],_0x944152[_0xa9cc('0x2a')]);_0x1f47d8['attributes']=_[_0xa9cc('0x2c')](_0x944152[_0xa9cc('0x29')],qs[_0xa9cc('0x2d')](_0x3370a3[_0xa9cc('0x2a')][_0xa9cc('0x2d')]));_0x1f47d8[_0xa9cc('0x2e')]=_0x1f47d8[_0xa9cc('0x2e')][_0xa9cc('0x2f')]?_0x1f47d8[_0xa9cc('0x2e')]:_0x944152['model'];if(!_0x3370a3['query'][_0xa9cc('0x30')](_0xa9cc('0x31'))){_0x1f47d8['limit']=qs[_0xa9cc('0x18')](_0x3370a3[_0xa9cc('0x2a')]['limit']);_0x1f47d8['offset']=qs[_0xa9cc('0x17')](_0x3370a3[_0xa9cc('0x2a')][_0xa9cc('0x17')]);}_0x1f47d8[_0xa9cc('0x32')]=qs['sort'](_0x3370a3['query'][_0xa9cc('0x33')]);_0x1f47d8[_0xa9cc('0x34')]=qs[_0xa9cc('0x35')](_[_0xa9cc('0x36')](_0x3370a3[_0xa9cc('0x2a')],_0x944152[_0xa9cc('0x35')]),_0x397bbb);if(_0x3370a3[_0xa9cc('0x2a')][_0xa9cc('0x37')]){_0x1f47d8[_0xa9cc('0x34')]=_[_0xa9cc('0x38')](_0x1f47d8[_0xa9cc('0x34')],{'$or':_[_0xa9cc('0x25')](_0x397bbb,function(_0x2980e2){if(_0x2980e2['type']!==_0xa9cc('0x39')){var _0x265acd={};_0x265acd[_0x2980e2[_0xa9cc('0x22')]]={'$like':'%'+_0x3370a3[_0xa9cc('0x2a')][_0xa9cc('0x37')]+'%'};return _0x265acd;}})});}_0x1f47d8=_['merge']({},_0x1f47d8,_0x3370a3[_0xa9cc('0x3a')]);var _0x5e4eb3={'where':_0x1f47d8[_0xa9cc('0x34')]};return db['Network'][_0xa9cc('0x1a')](_0x5e4eb3)[_0xa9cc('0x1e')](function(_0x1bb833){_0x41cf08[_0xa9cc('0x1a')]=_0x1bb833;if(_0x3370a3['query'][_0xa9cc('0x3b')]){_0x1f47d8[_0xa9cc('0x3c')]=[{'all':!![]}];}return db['Network'][_0xa9cc('0x3d')](_0x1f47d8);})[_0xa9cc('0x1e')](function(_0x1dc444){_0x41cf08[_0xa9cc('0x3e')]=_0x1dc444;return _0x41cf08;})[_0xa9cc('0x1e')](respondWithFilteredResult(_0x1d1ae1,_0x1f47d8))[_0xa9cc('0x14')](handleError(_0x1d1ae1,null));};exports[_0xa9cc('0x3f')]=function(_0x53d6c5,_0x1c7a44){var _0x5423e0={'raw':!![],'where':{'id':_0x53d6c5[_0xa9cc('0x40')]['id']}},_0x520c95={};_0x520c95[_0xa9cc('0x29')]=_[_0xa9cc('0x2b')](db[_0xa9cc('0x41')]['rawAttributes']);_0x520c95[_0xa9cc('0x2a')]=_[_0xa9cc('0x2b')](_0x53d6c5[_0xa9cc('0x2a')]);_0x520c95['filters']=_[_0xa9cc('0x2c')](_0x520c95['model'],_0x520c95[_0xa9cc('0x2a')]);_0x5423e0['attributes']=_[_0xa9cc('0x2c')](_0x520c95['model'],qs['fields'](_0x53d6c5[_0xa9cc('0x2a')][_0xa9cc('0x2d')]));_0x5423e0[_0xa9cc('0x2e')]=_0x5423e0[_0xa9cc('0x2e')][_0xa9cc('0x2f')]?_0x5423e0['attributes']:_0x520c95[_0xa9cc('0x29')];if(_0x53d6c5[_0xa9cc('0x2a')][_0xa9cc('0x3b')]){_0x5423e0[_0xa9cc('0x3c')]=[{'all':!![]}];}_0x5423e0=_[_0xa9cc('0x38')]({},_0x5423e0,_0x53d6c5[_0xa9cc('0x3a')]);return db['Network'][_0xa9cc('0x42')](_0x5423e0)[_0xa9cc('0x1e')](handleEntityNotFound(_0x1c7a44,null))[_0xa9cc('0x1e')](respondWithResult(_0x1c7a44,null))['catch'](handleError(_0x1c7a44,null));};exports[_0xa9cc('0x43')]=function(_0x2188d3,_0x354c99){var _0x214582;return db[_0xa9cc('0x41')][_0xa9cc('0x43')](_0x2188d3['body'],{'raw':!![]})['then'](function(_0x426861){_0x214582=_0x426861;return db[_0xa9cc('0x41')][_0xa9cc('0x3d')]({'where':{'type':_0x2188d3['body'][_0xa9cc('0x44')]},'raw':!![]});})['then'](function(_0x4ff160){if(_0x214582[_0xa9cc('0x44')][_0xa9cc('0x45')]()==_0xa9cc('0x46')){var _0x1c9e0d=fs[_0xa9cc('0x47')](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],_0xa9cc('0x4a')),'utf8');var _0x42fb0d=ejs['render'](_0x1c9e0d,{'networks':_0x4ff160||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x42fb0d);return respondWithRpcPromise('Reload',_0xa9cc('0x43'),{'module':_0xa9cc('0x4b')});}else if(_0x214582['type']['toUpperCase']()==_0xa9cc('0x4c')){var _0xba5c43=fs[_0xa9cc('0x47')](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],'server/files/templates/turn_multiple.ejs'),_0xa9cc('0x4d'));var _0x8b5def=ejs[_0xa9cc('0x4e')](_0xba5c43,{'networks':_0x4ff160||[]});fs['writeFileSync'](_0xa9cc('0x4f'),_0x8b5def);return respondWithRpcPromise('Reload',_0xa9cc('0x43'),{'module':_0xa9cc('0x4b')});}else{var _0x16c0f0=fs[_0xa9cc('0x47')](path['join'](config[_0xa9cc('0x49')],_0xa9cc('0x50')),_0xa9cc('0x4d'));var _0x2fc392=ejs[_0xa9cc('0x4e')](_0x16c0f0,{'networks':_0x4ff160||[]});fs[_0xa9cc('0x51')](util[_0xa9cc('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x2188d3['body'][_0xa9cc('0x44')][_0xa9cc('0x53')]()),_0x2fc392);return respondWithRpcPromise(_0xa9cc('0x54'),'create',{'module':_0xa9cc('0x55')});}})['then'](function(){return _0x214582;})['then'](respondWithResult(_0x354c99,0xc9))[_0xa9cc('0x14')](handleError(_0x354c99,null));};exports[_0xa9cc('0x1d')]=function(_0x292dee,_0x1241b3){var _0x48152a;return db[_0xa9cc('0x41')][_0xa9cc('0x42')]({'where':{'id':_0x292dee[_0xa9cc('0x40')]['id']}})[_0xa9cc('0x1e')](handleEntityNotFound(_0x1241b3,null))[_0xa9cc('0x1e')](saveUpdates(_0x292dee[_0xa9cc('0x56')],null))['then'](function(_0x37d40b){if(_0x37d40b){_0x48152a=_0x37d40b;return db[_0xa9cc('0x41')][_0xa9cc('0x3d')]({'where':{'type':_0x48152a[_0xa9cc('0x44')]},'raw':!![]});}return null;})[_0xa9cc('0x1e')](function(_0x13db14){if(_0x48152a[_0xa9cc('0x44')][_0xa9cc('0x45')]()=='STUN'){var _0x1568b0=fs['readFileSync'](path['join'](config[_0xa9cc('0x49')],_0xa9cc('0x4a')),_0xa9cc('0x4d'));var _0x65ef54=ejs[_0xa9cc('0x4e')](_0x1568b0,{'networks':_0x13db14||[]});fs[_0xa9cc('0x51')](_0xa9cc('0x57'),_0x65ef54);return respondWithRpcPromise(_0xa9cc('0x54'),_0xa9cc('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x48152a[_0xa9cc('0x44')][_0xa9cc('0x45')]()==_0xa9cc('0x4c')){var _0xd87a59=fs[_0xa9cc('0x47')](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],_0xa9cc('0x58')),_0xa9cc('0x4d'));var _0x1e7b77=ejs[_0xa9cc('0x4e')](_0xd87a59,{'networks':_0x13db14||[]});fs['writeFileSync'](_0xa9cc('0x4f'),_0x1e7b77);return respondWithRpcPromise(_0xa9cc('0x54'),'update',{'module':_0xa9cc('0x4b')});}else{var _0x45a387=fs[_0xa9cc('0x47')](path[_0xa9cc('0x48')](config['root'],_0xa9cc('0x50')),_0xa9cc('0x4d'));var _0x234ac8=ejs[_0xa9cc('0x4e')](_0x45a387,{'networks':_0x13db14||[]});fs[_0xa9cc('0x51')](util[_0xa9cc('0x52')]('/etc/asterisk/sip_xcally_%s.conf',_0x292dee[_0xa9cc('0x56')][_0xa9cc('0x44')][_0xa9cc('0x53')]()),_0x234ac8);return respondWithRpcPromise('Reload',_0xa9cc('0x1d'),{'module':'chan_sip.so'});}})[_0xa9cc('0x1e')](function(_0x4c604d){if(_0x4c604d){return _0x48152a;}return null;})[_0xa9cc('0x1e')](respondWithResult(_0x1241b3,null))[_0xa9cc('0x14')](handleError(_0x1241b3,null));};exports[_0xa9cc('0x1f')]=function(_0x2ad9ee,_0x65bc58){var _0x91724e;return db[_0xa9cc('0x41')][_0xa9cc('0x42')]({'where':{'id':_0x2ad9ee[_0xa9cc('0x40')]['id']}})['then'](function(_0x4b5bd9){_0x91724e=_0x4b5bd9;return _0x4b5bd9;})[_0xa9cc('0x1e')](handleEntityNotFound(_0x65bc58,null))['then'](removeEntity(_0x65bc58,null))[_0xa9cc('0x1e')](function(){if(_0x91724e){return db[_0xa9cc('0x41')][_0xa9cc('0x3d')]({'where':{'type':_0x91724e[_0xa9cc('0x44')]},'raw':!![]});}})['then'](function(_0x423219){if(_0x91724e[_0xa9cc('0x44')][_0xa9cc('0x45')]()==_0xa9cc('0x46')){var _0x3a552a=fs[_0xa9cc('0x47')](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],_0xa9cc('0x4a')),'utf8');var _0x3cc622=ejs[_0xa9cc('0x4e')](_0x3a552a,{'networks':_0x423219||[]});fs[_0xa9cc('0x51')](_0xa9cc('0x57'),_0x3cc622);return respondWithRpcPromise(_0xa9cc('0x54'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x91724e[_0xa9cc('0x44')][_0xa9cc('0x45')]()==_0xa9cc('0x4c')){var _0xc47f33=fs['readFileSync'](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],_0xa9cc('0x58')),_0xa9cc('0x4d'));var _0x92cef8=ejs[_0xa9cc('0x4e')](_0xc47f33,{'networks':_0x423219||[]});fs[_0xa9cc('0x51')](_0xa9cc('0x4f'),_0x92cef8);return respondWithRpcPromise(_0xa9cc('0x54'),_0xa9cc('0x1f'),{'module':_0xa9cc('0x4b')});}else{var _0x3258ef=fs['readFileSync'](path[_0xa9cc('0x48')](config[_0xa9cc('0x49')],_0xa9cc('0x50')),_0xa9cc('0x4d'));var _0x3b9e8f=ejs[_0xa9cc('0x4e')](_0x3258ef,{'networks':_0x423219||[]});fs['writeFileSync'](util[_0xa9cc('0x52')](_0xa9cc('0x59'),_0x91724e[_0xa9cc('0x44')][_0xa9cc('0x53')]()),_0x3b9e8f);return respondWithRpcPromise(_0xa9cc('0x54'),_0xa9cc('0x1f'),{'module':_0xa9cc('0x55')});}})[_0xa9cc('0x14')](handleError(_0x65bc58,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 8fdf058..19ea875 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 _0x2e54=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','lodash','api','moment'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x2e54,0x1dd));var _0x42e5=function(_0xd3c6cf,_0x23de34){_0xd3c6cf=_0xd3c6cf-0x0;var _0x41d4e9=_0x2e54[_0xd3c6cf];return _0x41d4e9;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42e5('0x1'));var moment=require(_0x42e5('0x2'));var BPromise=require(_0x42e5('0x3'));var rp=require(_0x42e5('0x4'));var fs=require('fs');var path=require(_0x42e5('0x5'));var rimraf=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var attributes=require('./network.attributes');module[_0x42e5('0x8')]=function(_0x455f48,_0x38cb1b){return _0x455f48['define'](_0x42e5('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bca=['Network','network','util','moment','request-promise','path','rimraf','./network.attributes','exports'];(function(_0x5a8487,_0x106a3c){var _0x7efdf7=function(_0x574716){while(--_0x574716){_0x5a8487['push'](_0x5a8487['shift']());}};_0x7efdf7(++_0x106a3c);}(_0x1bca,0xb6));var _0xa1bc=function(_0x34a56e,_0x2969cf){_0x34a56e=_0x34a56e-0x0;var _0x564fed=_0x1bca[_0x34a56e];return _0x564fed;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));module[_0xa1bc('0x6')]=function(_0x168b44,_0x268ced){return _0x168b44['define'](_0xa1bc('0x7'),attributes,{'tableName':_0xa1bc('0x8'),'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 4e91f43..2249ec8 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(_0x5a3386,_0x3fdfa0){var _0x122888=function(_0x5eb63e){while(--_0x5eb63e){_0x5a3386['push'](_0x5a3386['shift']());}};_0x122888(++_0x3fdfa0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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(_0x1f0d3b,_0x3b1453){_0x1f0d3b=_0x1f0d3b-0x0;var _0x5a3918=_0x7a54[_0x1f0d3b];return _0x5a3918;};'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 46821d6..791b2fa 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 _0xa885=['/:id/send','send','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents'];(function(_0xcde5cf,_0x49a7c1){var _0x400235=function(_0x594d33){while(--_0x594d33){_0xcde5cf['push'](_0xcde5cf['shift']());}};_0x400235(++_0x49a7c1);}(_0xa885,0x1b7));var _0x5a88=function(_0x54ef7c,_0x324089){_0x54ef7c=_0x54ef7c-0x0;var _0x531f95=_0xa885[_0x54ef7c];return _0x531f95;};'use strict';var multer=require(_0x5a88('0x0'));var util=require(_0x5a88('0x1'));var path=require(_0x5a88('0x2'));var timeout=require('connect-timeout');var express=require(_0x5a88('0x3'));var router=express['Router']();var fs_extra=require(_0x5a88('0x4'));var auth=require(_0x5a88('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5a88('0x6'));var controller=require(_0x5a88('0x7'));router[_0x5a88('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a88('0x9')]);router[_0x5a88('0x8')]('/describe',auth[_0x5a88('0xa')](),controller[_0x5a88('0xb')]);router[_0x5a88('0x8')](_0x5a88('0xc'),auth[_0x5a88('0xa')](),controller[_0x5a88('0xd')]);router['get']('/:id/dispositions',auth[_0x5a88('0xa')](),controller['getDispositions']);router['get'](_0x5a88('0xe'),auth[_0x5a88('0xa')](),controller[_0x5a88('0xf')]);router[_0x5a88('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x5a88('0x10')]);router[_0x5a88('0x8')](_0x5a88('0x11'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x12')]);router['get'](_0x5a88('0x13'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x14')]);router['post']('/',auth[_0x5a88('0xa')](),controller[_0x5a88('0x15')]);router[_0x5a88('0x16')]('/:id/dispositions',auth[_0x5a88('0xa')](),controller['addDisposition']);router['post'](_0x5a88('0xe'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x17')]);router[_0x5a88('0x16')](_0x5a88('0x18'),controller[_0x5a88('0x19')]);router['post'](_0x5a88('0x1a'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x1b')]);router[_0x5a88('0x16')]('/:id/users',auth[_0x5a88('0xa')](),controller[_0x5a88('0x1c')]);router['post'](_0x5a88('0x1d'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x1e')]);router[_0x5a88('0x1f')]('/:id',auth[_0x5a88('0xa')](),controller[_0x5a88('0x20')]);router[_0x5a88('0x21')](_0x5a88('0xc'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x22')]);router['delete'](_0x5a88('0x23'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x24')]);router[_0x5a88('0x21')](_0x5a88('0xe'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x25')]);router[_0x5a88('0x21')](_0x5a88('0x13'),auth[_0x5a88('0xa')](),controller[_0x5a88('0x26')]);module['exports']=router; \ No newline at end of file +var _0x96fc=['getInteractions','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./openchannelAccount.controller','get','/describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','isAuthenticated','/:id/interactions'];(function(_0x209b0a,_0x12fef1){var _0x20db2f=function(_0x38c34){while(--_0x38c34){_0x209b0a['push'](_0x209b0a['shift']());}};_0x20db2f(++_0x12fef1);}(_0x96fc,0x1b7));var _0xc96f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x96fc[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xc96f('0x0'));var path=require(_0xc96f('0x1'));var timeout=require(_0xc96f('0x2'));var express=require(_0xc96f('0x3'));var router=express[_0xc96f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc96f('0x5'));var controller=require(_0xc96f('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc96f('0x7')](_0xc96f('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xc96f('0x7')](_0xc96f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc96f('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc96f('0xa')]);router[_0xc96f('0x7')](_0xc96f('0xb'),auth['isAuthenticated'](),controller[_0xc96f('0xc')]);router[_0xc96f('0x7')](_0xc96f('0xd'),auth[_0xc96f('0xe')](),controller['getApplications']);router[_0xc96f('0x7')](_0xc96f('0xf'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x10')]);router['get'](_0xc96f('0x11'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x12')]);router[_0xc96f('0x13')]('/',auth[_0xc96f('0xe')](),controller['create']);router[_0xc96f('0x13')](_0xc96f('0x14'),auth['isAuthenticated'](),controller[_0xc96f('0x15')]);router['post'](_0xc96f('0xb'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x16')]);router[_0xc96f('0x13')](_0xc96f('0x17'),controller[_0xc96f('0x18')]);router[_0xc96f('0x13')]('/:id/applications',auth[_0xc96f('0xe')](),controller[_0xc96f('0x19')]);router[_0xc96f('0x13')](_0xc96f('0x11'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x1a')]);router[_0xc96f('0x13')]('/:id/send',auth[_0xc96f('0xe')](),controller[_0xc96f('0x1b')]);router[_0xc96f('0x1c')](_0xc96f('0x9'),auth[_0xc96f('0xe')](),controller['update']);router[_0xc96f('0x1d')](_0xc96f('0x9'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x1e')]);router[_0xc96f('0x1d')](_0xc96f('0x14'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x1f')]);router[_0xc96f('0x1d')](_0xc96f('0xb'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x20')]);router['delete'](_0xc96f('0x11'),auth[_0xc96f('0xe')](),controller[_0xc96f('0x21')]);module[_0xc96f('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 7e81222..50e44a3 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 _0x23ce=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x57f1ad,_0x4fa282){var _0x244198=function(_0x360611){while(--_0x360611){_0x57f1ad['push'](_0x57f1ad['shift']());}};_0x244198(++_0x4fa282);}(_0x23ce,0x13b));var _0xe23c=function(_0x46de1f,_0x1ac7fc){_0x46de1f=_0x46de1f-0x0;var _0x5dafe4=_0x23ce[_0x46de1f];return _0x5dafe4;};'use strict';var Sequelize=require(_0xe23c('0x0'));var rs=require(_0xe23c('0x1'));module[_0xe23c('0x2')]={'name':{'type':Sequelize[_0xe23c('0x3')],'unique':_0xe23c('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe23c('0x5')]();}},'replyUri':{'type':Sequelize[_0xe23c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xe23c('0x6');}},'notificationSound':{'type':Sequelize[_0xe23c('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xe23c('0x3')]},'queueTransfer':{'type':Sequelize[_0xe23c('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe23c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe23c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe23c('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xe23c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xe23c('0x7')],'defaultValue':![],'comment':_0xe23c('0xa'),'set':function(_0x4540a0){if(!_0x4540a0)this[_0xe23c('0xb')](_0xe23c('0xc'),null);this['setDataValue'](_0xe23c('0xd'),_0x4540a0);}}}; \ No newline at end of file +var _0x2962=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x2962,0x1d8));var _0x2296=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2962[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x2296('0x0'));var rs=require(_0x2296('0x1'));module['exports']={'name':{'type':Sequelize[_0x2296('0x2')],'unique':_0x2296('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2296('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2296('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2296('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2296('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2296('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2296('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x2296('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2296('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2296('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2296('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x2296('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2296('0x5')],'defaultValue':![],'comment':_0x2296('0x8'),'set':function(_0x49ff0e){if(!_0x49ff0e)this[_0x2296('0x9')](_0x2296('0xa'),null);this[_0x2296('0x9')](_0x2296('0xb'),_0x49ff0e);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fac787e..2330626 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 _0x630e=['Applications','applications','list','orderBy','priority','account','CmContact','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','lastName','messageId','interaction','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','fullname','internal','Tags','color','addAgents','spread','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','params','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','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','CannedAnswer','getAnswers','notify','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','Contacts','DESC','OpenchannelApplication'];(function(_0x145516,_0x5aa90b){var _0x58c743=function(_0x128197){while(--_0x128197){_0x145516['push'](_0x145516['shift']());}};_0x58c743(++_0x5aa90b);}(_0x630e,0x1af));var _0xe630=function(_0x525ad7,_0x365a33){_0x525ad7=_0x525ad7-0x0;var _0x55e7cd=_0x630e[_0x525ad7];return _0x55e7cd;};'use strict';var emlformat=require(_0xe630('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe630('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe630('0x2'));var BPromise=require(_0xe630('0x3'));var Mustache=require(_0xe630('0x4'));var util=require('util');var path=require(_0xe630('0x5'));var sox=require(_0xe630('0x6'));var csv=require(_0xe630('0x7'));var ejs=require(_0xe630('0x8'));var fs=require('fs');var fs_extra=require(_0xe630('0x9'));var _=require('lodash');var squel=require(_0xe630('0xa'));var crypto=require(_0xe630('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe630('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe630('0xd'));var Papa=require(_0xe630('0xe'));var Redis=require(_0xe630('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe630('0x10'));var hardwareService=require(_0xe630('0x11'));var logger=require(_0xe630('0x12'))(_0xe630('0x13'));var utils=require('../../config/utils');var config=require(_0xe630('0x14'));var licenseUtil=require(_0xe630('0x15'));var db=require(_0xe630('0x16'))['db'];config[_0xe630('0x17')]=_[_0xe630('0x18')](config[_0xe630('0x17')],{'host':_0xe630('0x19'),'port':0x18eb});var socket=require(_0xe630('0x1a'))(new Redis(config[_0xe630('0x17')]));require(_0xe630('0x1b'))[_0xe630('0x1c')](socket);var jayson=require(_0xe630('0x1d'));var client=jayson[_0xe630('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xe630('0x1e')][_0xe630('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3e89f7,_0x3916a5,_0x6671d0,_0x43b74a){return new BPromise(function(_0x26a2b7,_0x8a826b){var _0x1ab409=_0x43b74a||client;return _0x1ab409[_0xe630('0x20')](_0x3e89f7,_0x6671d0)[_0xe630('0x21')](function(_0x9721fa){logger[_0xe630('0x22')](_0xe630('0x23'),_0x3916a5,_0xe630('0x24'));logger[_0xe630('0x25')](_0xe630('0x26'),_0x3916a5,_0xe630('0x24'),JSON[_0xe630('0x27')](_0x9721fa));if(_0x9721fa[_0xe630('0x28')]){if(_0x9721fa[_0xe630('0x28')][_0xe630('0x29')]===0x1f4){logger[_0xe630('0x28')](_0xe630('0x23'),_0x3916a5,_0x9721fa[_0xe630('0x28')][_0xe630('0x2a')]);return _0x8a826b(_0x9721fa['error'][_0xe630('0x2a')]);}logger[_0xe630('0x28')](_0xe630('0x23'),_0x3916a5,_0x9721fa['error'][_0xe630('0x2a')]);return _0x26a2b7(_0x9721fa[_0xe630('0x28')][_0xe630('0x2a')]);}else{logger['info'](_0xe630('0x23'),_0x3916a5,_0xe630('0x24'));_0x26a2b7(_0x9721fa[_0xe630('0x2b')][_0xe630('0x2a')]);}})[_0xe630('0x2c')](function(_0x277b9f){logger[_0xe630('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x3916a5,_0x277b9f);_0x8a826b(_0x277b9f);});});}function respondWithStatusCode(_0xb2b62e,_0x14fb35){_0x14fb35=_0x14fb35||0xcc;return function(_0x4e7797){if(_0x4e7797){return _0xb2b62e[_0xe630('0x2d')](_0x14fb35);}return _0xb2b62e[_0xe630('0x2e')](_0x14fb35)[_0xe630('0x2f')]();};}function respondWithResult(_0x4b67e5,_0x5670a1){_0x5670a1=_0x5670a1||0xc8;return function(_0x5a3c30){if(_0x5a3c30){return _0x4b67e5['status'](_0x5670a1)['json'](_0x5a3c30);}};}function respondWithFilteredResult(_0x4256e3,_0x4b78bd){return function(_0x5cacc1){if(_0x5cacc1){var _0x70f17e=typeof _0x4b78bd[_0xe630('0x30')]===_0xe630('0x31')&&typeof _0x4b78bd[_0xe630('0x32')]===_0xe630('0x31');var _0x238c96=_0x5cacc1[_0xe630('0x33')];var _0x58c676=_0x70f17e?0x0:_0x4b78bd[_0xe630('0x30')];var _0x438bda=_0x70f17e?_0x5cacc1['count']:_0x4b78bd['offset']+_0x4b78bd['limit'];var _0x338e23;if(_0x438bda>=_0x238c96){_0x438bda=_0x238c96;_0x338e23=0xc8;}else{_0x338e23=0xce;}_0x4256e3['status'](_0x338e23);return _0x4256e3[_0xe630('0x34')](_0xe630('0x35'),_0x58c676+'-'+_0x438bda+'/'+_0x238c96)[_0xe630('0x36')](_0x5cacc1);}return null;};}function patchUpdates(_0xd58ec1){return function(_0x14d72b){try{jsonpatch[_0xe630('0x37')](_0x14d72b,_0xd58ec1,!![]);}catch(_0x539992){return BPromise[_0xe630('0x38')](_0x539992);}return _0x14d72b['save']();};}function saveUpdates(_0x5c8e85,_0x4cf488){return function(_0x15548c){if(_0x15548c){return _0x15548c[_0xe630('0x39')](_0x5c8e85)[_0xe630('0x21')](function(_0x556e62){return _0x556e62;});}return null;};}function removeEntity(_0x23c77d,_0x1cb1e5){return function(_0x313b19){if(_0x313b19){return _0x313b19[_0xe630('0x3a')]()[_0xe630('0x21')](function(){var _0x2e0696=_0x313b19[_0xe630('0x3b')]({'plain':!![]});var _0x4d2e92=_0xe630('0x3c');return db['UserProfileResource'][_0xe630('0x3a')]({'where':{'type':_0x4d2e92,'resourceId':_0x2e0696['id']}})[_0xe630('0x21')](function(){return _0x313b19;});})[_0xe630('0x21')](function(){_0x23c77d[_0xe630('0x2e')](0xcc)[_0xe630('0x2f')]();});}};}function handleEntityNotFound(_0x3db4ab,_0x341173){return function(_0x24d694){if(!_0x24d694){_0x3db4ab['sendStatus'](0x194);}return _0x24d694;};}function handleError(_0x31514e,_0x83cc35){_0x83cc35=_0x83cc35||0x1f4;return function(_0x4b76e1){logger['error'](_0x4b76e1['stack']);if(_0x4b76e1['name']){delete _0x4b76e1[_0xe630('0x3d')];}_0x31514e[_0xe630('0x2e')](_0x83cc35)[_0xe630('0x3e')](_0x4b76e1);};}exports[_0xe630('0x3f')]=function(_0xc43f52,_0x31b995){var _0xdbc14f={'include':[{'model':db[_0xe630('0x40')],'as':_0xe630('0x41')}]},_0x45d8cb={},_0x1786c1={'count':0x0,'rows':[]};var _0x8e973e=_[_0xe630('0x42')](db[_0xe630('0x43')][_0xe630('0x44')],function(_0xdd5093){return{'name':_0xdd5093[_0xe630('0x45')],'type':_0xdd5093[_0xe630('0x46')][_0xe630('0x47')]};});_0x45d8cb['model']=_['map'](_0x8e973e,'name');_0x45d8cb[_0xe630('0x48')]=_[_0xe630('0x49')](_0xc43f52[_0xe630('0x48')]);_0x45d8cb['filters']=_[_0xe630('0x4a')](_0x45d8cb[_0xe630('0x4b')],_0x45d8cb['query']);_0xdbc14f['attributes']=_[_0xe630('0x4a')](_0x45d8cb['model'],qs[_0xe630('0x4c')](_0xc43f52[_0xe630('0x48')][_0xe630('0x4c')]));_0xdbc14f['attributes']=_0xdbc14f[_0xe630('0x4d')][_0xe630('0x4e')]?_0xdbc14f[_0xe630('0x4d')]:_0x45d8cb[_0xe630('0x4b')];if(!_0xc43f52['query'][_0xe630('0x4f')](_0xe630('0x50'))){_0xdbc14f['limit']=qs[_0xe630('0x32')](_0xc43f52[_0xe630('0x48')][_0xe630('0x32')]);_0xdbc14f[_0xe630('0x30')]=qs['offset'](_0xc43f52[_0xe630('0x48')][_0xe630('0x30')]);}_0xdbc14f[_0xe630('0x51')]=qs['sort'](_0xc43f52[_0xe630('0x48')][_0xe630('0x52')]);_0xdbc14f[_0xe630('0x53')]=qs[_0xe630('0x54')](_['pick'](_0xc43f52[_0xe630('0x48')],_0x45d8cb['filters']),_0x8e973e);if(_0xc43f52[_0xe630('0x48')]['filter']){_0xdbc14f[_0xe630('0x53')]=_[_0xe630('0x55')](_0xdbc14f[_0xe630('0x53')],{'$or':_[_0xe630('0x42')](_0x8e973e,function(_0x12c74d){if(_0x12c74d[_0xe630('0x46')]!=='VIRTUAL'){var _0x592b35={};_0x592b35[_0x12c74d['name']]={'$like':'%'+_0xc43f52[_0xe630('0x48')][_0xe630('0x56')]+'%'};return _0x592b35;}})});}_0xdbc14f=_[_0xe630('0x55')]({},_0xdbc14f,_0xc43f52[_0xe630('0x57')]);var _0xd4c72b={'where':_0xdbc14f[_0xe630('0x53')]};return db[_0xe630('0x43')][_0xe630('0x33')](_0xd4c72b)[_0xe630('0x21')](function(_0x500f94){_0x1786c1[_0xe630('0x33')]=_0x500f94;if(_0xc43f52['query'][_0xe630('0x58')]){_0xdbc14f[_0xe630('0x59')]=[{'all':!![]}];}return db[_0xe630('0x43')][_0xe630('0x5a')](_0xdbc14f);})['then'](function(_0x3938e0){_0x1786c1['rows']=_0x3938e0;return _0x1786c1;})['then'](respondWithFilteredResult(_0x31b995,_0xdbc14f))[_0xe630('0x2c')](handleError(_0x31b995,null));};exports['show']=function(_0x4c693b,_0x12c39b){var _0x3a8f71={'raw':![],'where':{'id':_0x4c693b[_0xe630('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4e72fc={};_0x4e72fc['model']=_['keys'](db['OpenchannelAccount'][_0xe630('0x44')]);_0x4e72fc[_0xe630('0x48')]=_['keys'](_0x4c693b['query']);_0x4e72fc['filters']=_[_0xe630('0x4a')](_0x4e72fc['model'],_0x4e72fc[_0xe630('0x48')]);_0x3a8f71[_0xe630('0x4d')]=_[_0xe630('0x4a')](_0x4e72fc[_0xe630('0x4b')],qs['fields'](_0x4c693b[_0xe630('0x48')][_0xe630('0x4c')]));_0x3a8f71[_0xe630('0x4d')]=_0x3a8f71[_0xe630('0x4d')]['length']?_0x3a8f71['attributes']:_0x4e72fc[_0xe630('0x4b')];if(_0x4c693b[_0xe630('0x48')]['includeAll']){_0x3a8f71[_0xe630('0x59')]=[{'all':!![]}];}_0x3a8f71=_[_0xe630('0x55')]({},_0x3a8f71,_0x4c693b[_0xe630('0x57')]);return db[_0xe630('0x43')]['find'](_0x3a8f71)[_0xe630('0x21')](handleEntityNotFound(_0x12c39b,null))[_0xe630('0x21')](respondWithResult(_0x12c39b,null))['catch'](handleError(_0x12c39b,null));};exports[_0xe630('0x5c')]=function(_0x3ef7d6,_0x1b9279){return db[_0xe630('0x43')]['create'](_0x3ef7d6[_0xe630('0x5d')],{})[_0xe630('0x21')](function(_0x4b17b9){var _0x401d8d=_0x3ef7d6[_0xe630('0x5e')][_0xe630('0x3b')]({'plain':!![]});if(!_0x401d8d)throw new Error(_0xe630('0x5f'));if(_0x401d8d[_0xe630('0x60')]===_0xe630('0x5e')){var _0xae13d1=_0x4b17b9[_0xe630('0x3b')]({'plain':!![]});var _0x42092e=_0xe630('0x3c');return db[_0xe630('0x61')][_0xe630('0x62')]({'where':{'name':_0x42092e,'userProfileId':_0x401d8d[_0xe630('0x63')]},'raw':!![]})[_0xe630('0x21')](function(_0x568acd){if(_0x568acd&&_0x568acd[_0xe630('0x64')]===0x0){return db[_0xe630('0x65')][_0xe630('0x5c')]({'name':_0xae13d1[_0xe630('0x3d')],'resourceId':_0xae13d1['id'],'type':_0x568acd['name'],'sectionId':_0x568acd['id']},{})[_0xe630('0x21')](function(){return _0x4b17b9;});}else{return _0x4b17b9;}})[_0xe630('0x2c')](function(_0x3b5edd){logger['error'](_0xe630('0x66'),_0x3b5edd);throw _0x3b5edd;});}return _0x4b17b9;})[_0xe630('0x21')](respondWithResult(_0x1b9279,0xc9))[_0xe630('0x2c')](handleError(_0x1b9279,null));};exports['update']=function(_0x52ba69,_0x1c58e0){if(_0x52ba69[_0xe630('0x5d')]['id']){delete _0x52ba69[_0xe630('0x5d')]['id'];}return db['OpenchannelAccount'][_0xe630('0x62')]({'where':{'id':_0x52ba69['params']['id']},'include':[{'model':db[_0xe630('0x40')],'as':_0xe630('0x41')}]})[_0xe630('0x21')](handleEntityNotFound(_0x1c58e0,null))[_0xe630('0x21')](saveUpdates(_0x52ba69[_0xe630('0x5d')],null))[_0xe630('0x21')](respondWithResult(_0x1c58e0,null))[_0xe630('0x2c')](handleError(_0x1c58e0,null));};exports[_0xe630('0x3a')]=function(_0x2f52c5,_0x1898ee){return db[_0xe630('0x43')][_0xe630('0x62')]({'where':{'id':_0x2f52c5[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x1898ee,null))[_0xe630('0x21')](removeEntity(_0x1898ee,null))[_0xe630('0x2c')](handleError(_0x1898ee,null));};exports[_0xe630('0x67')]=function(_0x502d4e,_0x79e093){return db[_0xe630('0x43')][_0xe630('0x67')]()['then'](respondWithResult(_0x79e093,null))['catch'](handleError(_0x79e093,null));};exports['addDisposition']=function(_0x4c0b70,_0x23ae77,_0x44c78b){if(_0x4c0b70['body']['id']){delete _0x4c0b70[_0xe630('0x5d')]['id'];}return db[_0xe630('0x43')][_0xe630('0x62')]({'where':{'id':_0x4c0b70[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x23ae77,null))[_0xe630('0x21')](function(_0x2dd101){if(_0x2dd101){_0x4c0b70['body'][_0xe630('0x68')]=_0x2dd101['id'];return db[_0xe630('0x69')]['create'](_0x4c0b70['body']);}})[_0xe630('0x21')](respondWithResult(_0x23ae77,null))['catch'](handleError(_0x23ae77,null));};exports[_0xe630('0x6a')]=function(_0x29a50f,_0x5c1d58,_0x296ecb){var _0x102bbb={'raw':![],'where':{}};var _0x143e48={};var _0x466b45={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe630('0x6b')]({'where':{'id':_0x29a50f['params']['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x5c1d58,null))['then'](function(_0x134d87){if(_0x134d87){_0x143e48[_0xe630('0x4b')]=_[_0xe630('0x49')](db[_0xe630('0x69')][_0xe630('0x44')]);_0x143e48[_0xe630('0x48')]=_[_0xe630('0x49')](_0x29a50f[_0xe630('0x48')]);_0x143e48['filters']=_[_0xe630('0x4a')](_0x143e48[_0xe630('0x4b')],_0x143e48[_0xe630('0x48')]);_0x102bbb[_0xe630('0x4d')]=_['intersection'](_0x143e48[_0xe630('0x4b')],qs[_0xe630('0x4c')](_0x29a50f[_0xe630('0x48')][_0xe630('0x4c')]));_0x102bbb[_0xe630('0x4d')]=_0x102bbb[_0xe630('0x4d')][_0xe630('0x4e')]?_0x102bbb['attributes']:_0x143e48[_0xe630('0x4b')];if(!_0x29a50f[_0xe630('0x48')][_0xe630('0x4f')](_0xe630('0x50'))){_0x102bbb[_0xe630('0x32')]=qs[_0xe630('0x32')](_0x29a50f[_0xe630('0x48')][_0xe630('0x32')]);_0x102bbb['offset']=qs['offset'](_0x29a50f['query'][_0xe630('0x30')]);}_0x102bbb[_0xe630('0x51')]=qs[_0xe630('0x52')](_0x29a50f['query'][_0xe630('0x52')]);_0x102bbb[_0xe630('0x53')]=qs[_0xe630('0x54')](_[_0xe630('0x6c')](_0x29a50f[_0xe630('0x48')],_0x143e48['filters']));_0x102bbb['where']['OpenchannelAccountId']=_0x134d87['id'];if(_0x29a50f[_0xe630('0x48')][_0xe630('0x56')]){_0x102bbb['where']=_['merge'](_0x102bbb[_0xe630('0x53')],{'$or':_[_0xe630('0x42')](_0x102bbb[_0xe630('0x4d')],function(_0x3d51c5){var _0x1e3338={};_0x1e3338[_0x3d51c5]={'$like':'%'+_0x29a50f[_0xe630('0x48')][_0xe630('0x56')]+'%'};return _0x1e3338;})});}_0x102bbb=_[_0xe630('0x55')]({},_0x102bbb,_0x29a50f[_0xe630('0x57')]);return db['Disposition'][_0xe630('0x33')]({'where':_0x102bbb[_0xe630('0x53')]})[_0xe630('0x21')](function(_0x11ae60){_0x466b45[_0xe630('0x33')]=_0x11ae60;if(_0x29a50f['query']['includeAll']){_0x102bbb[_0xe630('0x59')]=[{'all':!![]}];}return db[_0xe630('0x69')][_0xe630('0x5a')](_0x102bbb);})[_0xe630('0x21')](function(_0x4ba853){_0x466b45[_0xe630('0x6d')]=_0x4ba853;return _0x466b45;});}})[_0xe630('0x21')](respondWithFilteredResult(_0x5c1d58,_0x102bbb))[_0xe630('0x2c')](handleError(_0x5c1d58,null));};exports[_0xe630('0x6e')]=function(_0x41ab47,_0x388e01,_0x32c6fd){return db['OpenchannelAccount'][_0xe630('0x62')]({'where':{'id':_0x41ab47[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x388e01,null))[_0xe630('0x21')](function(_0x4f2ad7){if(_0x4f2ad7){return _0x4f2ad7[_0xe630('0x6e')](_0x41ab47['query'][_0xe630('0x6f')]);}})['then'](respondWithStatusCode(_0x388e01,null))[_0xe630('0x2c')](handleError(_0x388e01,null));};exports['addAnswer']=function(_0x4ffdaa,_0x561a43,_0x27d9d7){if(_0x4ffdaa['body']['id']){delete _0x4ffdaa[_0xe630('0x5d')]['id'];}return db['OpenchannelAccount'][_0xe630('0x62')]({'where':{'id':_0x4ffdaa[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x561a43,null))[_0xe630('0x21')](function(_0x487dfd){if(_0x487dfd){_0x4ffdaa[_0xe630('0x5d')][_0xe630('0x68')]=_0x487dfd['id'];return db[_0xe630('0x70')][_0xe630('0x5c')](_0x4ffdaa[_0xe630('0x5d')]);}})[_0xe630('0x21')](respondWithResult(_0x561a43,null))['catch'](handleError(_0x561a43,null));};exports[_0xe630('0x71')]=function(_0x340af2,_0x4c08a3,_0x56507d){var _0x432174={'raw':![],'where':{}};var _0x3559a3={};var _0x4171ef={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xe630('0x6b')]({'where':{'id':_0x340af2[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x4c08a3,null))[_0xe630('0x21')](function(_0x2221d3){if(_0x2221d3){_0x3559a3[_0xe630('0x4b')]=_[_0xe630('0x49')](db[_0xe630('0x70')][_0xe630('0x44')]);_0x3559a3['query']=_[_0xe630('0x49')](_0x340af2['query']);_0x3559a3[_0xe630('0x54')]=_[_0xe630('0x4a')](_0x3559a3[_0xe630('0x4b')],_0x3559a3['query']);_0x432174['attributes']=_['intersection'](_0x3559a3[_0xe630('0x4b')],qs['fields'](_0x340af2[_0xe630('0x48')][_0xe630('0x4c')]));_0x432174[_0xe630('0x4d')]=_0x432174[_0xe630('0x4d')][_0xe630('0x4e')]?_0x432174['attributes']:_0x3559a3[_0xe630('0x4b')];if(!_0x340af2['query'][_0xe630('0x4f')]('nolimit')){_0x432174[_0xe630('0x32')]=qs['limit'](_0x340af2[_0xe630('0x48')][_0xe630('0x32')]);_0x432174['offset']=qs[_0xe630('0x30')](_0x340af2[_0xe630('0x48')][_0xe630('0x30')]);}_0x432174[_0xe630('0x51')]=qs[_0xe630('0x52')](_0x340af2[_0xe630('0x48')][_0xe630('0x52')]);_0x432174['where']=qs[_0xe630('0x54')](_[_0xe630('0x6c')](_0x340af2[_0xe630('0x48')],_0x3559a3[_0xe630('0x54')]));_0x432174[_0xe630('0x53')][_0xe630('0x68')]=_0x2221d3['id'];if(_0x340af2['query']['filter']){_0x432174[_0xe630('0x53')]=_[_0xe630('0x55')](_0x432174[_0xe630('0x53')],{'$or':_['map'](_0x432174[_0xe630('0x4d')],function(_0x490eaf){var _0xbbe5f5={};_0xbbe5f5[_0x490eaf]={'$like':'%'+_0x340af2[_0xe630('0x48')][_0xe630('0x56')]+'%'};return _0xbbe5f5;})});}_0x432174=_[_0xe630('0x55')]({},_0x432174,_0x340af2[_0xe630('0x57')]);return db[_0xe630('0x70')][_0xe630('0x33')]({'where':_0x432174[_0xe630('0x53')]})[_0xe630('0x21')](function(_0xd19642){_0x4171ef['count']=_0xd19642;if(_0x340af2['query'][_0xe630('0x58')]){_0x432174[_0xe630('0x59')]=[{'all':!![]}];}return db[_0xe630('0x70')][_0xe630('0x5a')](_0x432174);})[_0xe630('0x21')](function(_0x17290f){_0x4171ef[_0xe630('0x6d')]=_0x17290f;return _0x4171ef;});}})[_0xe630('0x21')](respondWithFilteredResult(_0x4c08a3,_0x432174))[_0xe630('0x2c')](handleError(_0x4c08a3,null));};exports['removeAnswers']=function(_0x313785,_0x3b9c04,_0x368bb2){return db[_0xe630('0x43')]['find']({'where':{'id':_0x313785[_0xe630('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b9c04,null))['then'](function(_0x31a2cb){if(_0x31a2cb){return _0x31a2cb['removeAnswers'](_0x313785[_0xe630('0x48')][_0xe630('0x6f')]);}})[_0xe630('0x21')](respondWithStatusCode(_0x3b9c04,null))[_0xe630('0x2c')](handleError(_0x3b9c04,null));};exports[_0xe630('0x72')]=function(_0x481122,_0x3e807c,_0x46b466){var _0x3b2996={'body':_0x481122[_0xe630('0x5d')],'channel':_0xe630('0x73')};var _0x3e9ba5=[];var _0x573ea5=[];var _0x2ab0a8={};var _0x287e2d=![];return db['CmContact'][_0xe630('0x67')]()[_0xe630('0x21')](function(_0xd2847e){if(!_0xd2847e){throw new db[(_0xe630('0x74'))][(_0xe630('0x75'))](_0xe630('0x76'));}_0x3e9ba5=_[_0xe630('0x77')](_[_0xe630('0x49')](_0xd2847e),['createdAt','updatedAt']);_0x573ea5=_['difference'](_[_0xe630('0x49')](_0xd2847e),['createdAt',_0xe630('0x78'),_0xe630('0x79'),'ListId']);if(_0x481122[_0xe630('0x5d')]['id']){delete _0x481122['body']['id'];}if(_[_0xe630('0x7a')](_0x481122[_0xe630('0x5d')][_0xe630('0x7b')])){throw new db[(_0xe630('0x74'))][(_0xe630('0x75'))](_0xe630('0x7c'));}if(_['isNil'](_0x481122[_0xe630('0x5d')][_0xe630('0x5d')])||_0x481122['body']['body']===''){throw new db[(_0xe630('0x74'))]['ValidationError'](_0xe630('0x7d'));}if(_[_0xe630('0x7a')](_0x481122[_0xe630('0x5d')]['mapKey'])){throw new db[(_0xe630('0x74'))][(_0xe630('0x75'))](_0xe630('0x7e')+_0x573ea5);}if(!_['includes'](_0x573ea5,_0x481122[_0xe630('0x5d')][_0xe630('0x7f')])){throw new db[(_0xe630('0x74'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x573ea5);}_0x2ab0a8[_0x481122['body'][_0xe630('0x7f')]]=_0x481122['body'][_0xe630('0x7b')];})['then'](function(){return db[_0xe630('0x43')][_0xe630('0x62')]({'where':{'id':_0x481122[_0xe630('0x5b')]['id']},'include':[{'model':db[_0xe630('0x80')],'as':_0xe630('0x81'),'include':[{'model':db['CmContact'],'as':_0xe630('0x82'),'where':_0x2ab0a8,'limit':0x1,'order':[['updatedAt',_0xe630('0x83')]]}]},{'model':db[_0xe630('0x84')],'as':_0xe630('0x85')}]});})['then'](handleEntityNotFound(_0x3e807c,null))[_0xe630('0x21')](function(_0x5cbf97){if(_0x5cbf97&&_0x5cbf97[_0xe630('0x81')]){_0x3b2996['account']=_0x5cbf97;_0x3b2996[_0xe630('0x86')]=_0x5cbf97['Applications'];_0x3b2996[_0xe630('0x87')]=_0x5cbf97[_0xe630('0x81')];_0x3b2996[_0xe630('0x86')]=_[_0xe630('0x88')](_0x3b2996[_0xe630('0x86')],[_0xe630('0x89')],['asc']);if(_0x3b2996[_0xe630('0x8a')][_0xe630('0x85')]){delete _0x3b2996[_0xe630('0x8a')]['Applications'];}if(_0x3b2996[_0xe630('0x8a')][_0xe630('0x81')]&&_0x3b2996[_0xe630('0x8a')]['List'][_0xe630('0x82')][_0xe630('0x4e')]){return _0x3b2996[_0xe630('0x8a')][_0xe630('0x81')][_0xe630('0x82')][0x0];}var _0x4a242a=_[_0xe630('0x18')](_0x481122[_0xe630('0x5d')],{'firstName':_0x481122[_0xe630('0x5d')][_0xe630('0x7b')],'ListId':_0x5cbf97['ListId']});_0x4a242a[_0x481122[_0xe630('0x5d')]['mapKey']]=_0x481122[_0xe630('0x5d')][_0xe630('0x7b')];return db[_0xe630('0x8b')][_0xe630('0x5c')](_0x4a242a,{'fields':_0x3e9ba5,'raw':!![]});}})[_0xe630('0x21')](handleEntityNotFound(_0x3e807c,null))[_0xe630('0x21')](function(_0x444d14){_0x3b2996[_0xe630('0x8c')]=_0x444d14;if(_0x444d14){var _0x1a1a30={'ContactId':_0x444d14['id'],'OpenchannelAccountId':_0x481122[_0xe630('0x5b')]['id'],'from':(_0x444d14['firstName']||'')+'\x20'+(_0x444d14['lastName']||'')};var _0x3a8cfb={'OpenchannelAccountId':_0x481122[_0xe630('0x5b')]['id'],'closed':![]};if(_0x481122[_0xe630('0x5d')][_0xe630('0x8d')]){_0x3a8cfb[_0xe630('0x8d')]=_0x481122[_0xe630('0x5d')]['threadId'];return db[_0xe630('0x8e')]['find']({'where':_0x3a8cfb})[_0xe630('0x21')](function(_0x5a61e0){if(_0x5a61e0){return[_0x5a61e0,![]];}_0x1a1a30[_0xe630('0x8d')]=_0x481122['body']['threadId'];_0x1a1a30[_0xe630('0x8f')]=_0x481122[_0xe630('0x5d')]['externalUrl'];return db['OpenchannelInteraction'][_0xe630('0x5c')](_0x1a1a30)[_0xe630('0x21')](function(_0x599880){return[_0x599880,!![]];});});}else{_0x3a8cfb[_0xe630('0x8d')]=null;}_0x3a8cfb[_0xe630('0x90')]=_0x444d14['id'];return db['OpenchannelInteraction']['find']({'where':_0x3a8cfb})['then'](function(_0x57f054){if(_0x57f054){return[_0x57f054,![]];}return db['OpenchannelInteraction'][_0xe630('0x5c')](_0x1a1a30)['then'](function(_0x12cd22){return[_0x12cd22,!![]];});});}})['spread'](function(_0x216a52,_0x45519d){if(_0x216a52){_0x287e2d=_0x45519d;if(!_0x45519d){var _0x4b60ef={'from':(_0x3b2996[_0xe630('0x8c')][_0xe630('0x91')]||'')+'\x20'+(_0x3b2996[_0xe630('0x8c')][_0xe630('0x92')]||'')};if(_0x481122[_0xe630('0x5d')][_0xe630('0x8d')]&&_0x481122[_0xe630('0x5d')][_0xe630('0x93')]&&_0x481122[_0xe630('0x5d')][_0xe630('0x8d')]!=_0x481122[_0xe630('0x5d')][_0xe630('0x93')]){_0x4b60ef[_0xe630('0x8d')]=_0x481122[_0xe630('0x5d')][_0xe630('0x93')];}return _0x216a52['update'](_0x4b60ef);}else{return _0x216a52;}}})[_0xe630('0x21')](function(_0x53ff1a){_0x3b2996['interaction']=_0x53ff1a[_0xe630('0x3b')]({'plain':!![]});_0x3b2996['interaction']['created']=_0x287e2d;if(_0x3b2996[_0xe630('0x94')]['created']){if(_0x3b2996['account'][_0xe630('0x95')]){_0x3b2996[_0xe630('0x86')][_0xe630('0x96')]({'id':0x0,'priority':_0x3b2996[_0xe630('0x86')][_0xe630('0x4e')]+0x1,'app':_0xe630('0x97'),'appdata':'unmanaged','interval':_0xe630('0x98')});}}return db[_0xe630('0x99')][_0xe630('0x5c')]({'body':_0x481122['body'][_0xe630('0x5d')],'OpenchannelAccountId':_0x481122[_0xe630('0x5b')]['id'],'OpenchannelInteractionId':_0x53ff1a['id'],'direction':'in','ContactId':_0x3b2996[_0xe630('0x8c')]['id'],'AttachmentId':_0x481122['body'][_0xe630('0x9a')]});})[_0xe630('0x21')](function(_0xb36734){_0x3b2996[_0xe630('0x2a')]=_0xb36734;if(_0x3b2996['interaction'][_0xe630('0x9b')]){return db[_0xe630('0x9c')][_0xe630('0x62')]({'attributes':['id',_0xe630('0x3d')],'where':{'id':_0x3b2996[_0xe630('0x94')][_0xe630('0x9b')]}})[_0xe630('0x21')](function(_0x252fcc){if(_0x252fcc){_0x3b2996[_0xe630('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe630('0x9d'),'appdata':_0x252fcc[_0xe630('0x3d')]+','+(_0x3b2996[_0xe630('0x8a')][_0xe630('0x9e')]||0xa),'interval':_0xe630('0x98')});_0x3b2996[_0xe630('0x9f')]=![];}return respondWithRpcPromise('Start',_0xe630('0xa0'),_0x3b2996);});}return respondWithRpcPromise(_0xe630('0xa1'),_0xe630('0xa0'),_0x3b2996);})[_0xe630('0x21')](function(_0x2d8cce){respondWithRpcPromise(_0xe630('0xa2'),'EventManager',{'event':'notify','message':_0x2d8cce},client9002);return _0x2d8cce;})[_0xe630('0x21')](respondWithResult(_0x3e807c,null))[_0xe630('0x2c')](handleError(_0x3e807c,null));};exports[_0xe630('0xa3')]=function(_0x218872,_0x172640){var _0x4bfb78=_0x218872[_0xe630('0x5b')]['id'];var _0x4f1bce=_0x218872[_0xe630('0x5d')];var _0x2075b8=0xc8;var _0x29b00b=null;return db['sequelize'][_0xe630('0xa4')]({'isolationLevel':db[_0xe630('0xa5')][_0xe630('0xa6')][_0xe630('0xa7')][_0xe630('0xa8')]},function(_0x29d178){return db[_0xe630('0x43')]['findOne']({'where':{'id':_0x4bfb78},'transaction':_0x29d178})[_0xe630('0x21')](function(_0x52232b){if(_0x52232b){return db[_0xe630('0x84')][_0xe630('0x3a')]({'where':{'OpenchannelAccountId':_0x4bfb78},'transaction':_0x29d178})['then'](function(){var _0x12158e=_[_0xe630('0x42')](_0x4f1bce,function(_0x2f81ea){_0x2f81ea['OpenchannelAccountId']=_0x4bfb78;return _0x2f81ea;});return db[_0xe630('0x84')][_0xe630('0xa9')](_0x12158e,{'transaction':_0x29d178});});}else{_0x2075b8=0x194;_0x29b00b=[];}});})['then'](function(){if(_0x2075b8!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4bfb78},'order':_0xe630('0x89')})[_0xe630('0x21')](function(_0x458ccd){_0x29b00b=_0x458ccd;});}})[_0xe630('0x2c')](function(_0x2faefa){_0x2075b8=0x1f4;logger[_0xe630('0x28')](_0x2faefa['stack']);if(_0x2faefa[_0xe630('0x3d')]){delete _0x2faefa[_0xe630('0x3d')];}_0x29b00b=_0x2faefa;})[_0xe630('0xaa')](function(){if(_0x29b00b===null){_0x172640['sendStatus'](_0x2075b8);}else{if(_0x2075b8===0x1f4){_0x172640['status'](_0x2075b8)[_0xe630('0x3e')](_0x29b00b);}else{_0x172640[_0xe630('0x2e')](_0x2075b8)[_0xe630('0x36')](_0x29b00b);}}});};exports[_0xe630('0xab')]=function(_0x81c3c9,_0x45e09c,_0x10d9d9){var _0x363344={};var _0x2224da={};var _0xab2d7b;var _0x3b4c5a;return db[_0xe630('0x43')][_0xe630('0x6b')]({'where':{'id':_0x81c3c9['params']['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x45e09c,null))['then'](function(_0x472095){if(_0x472095){_0xab2d7b=_0x472095;_0x2224da[_0xe630('0x4b')]=_[_0xe630('0x49')](db[_0xe630('0x84')][_0xe630('0x44')]);_0x2224da[_0xe630('0x48')]=_[_0xe630('0x49')](_0x81c3c9['query']);_0x2224da['filters']=_[_0xe630('0x4a')](_0x2224da[_0xe630('0x4b')],_0x2224da[_0xe630('0x48')]);_0x363344[_0xe630('0x4d')]=_['intersection'](_0x2224da[_0xe630('0x4b')],qs[_0xe630('0x4c')](_0x81c3c9[_0xe630('0x48')]['fields']));_0x363344[_0xe630('0x4d')]=_0x363344[_0xe630('0x4d')]['length']?_0x363344['attributes']:_0x2224da[_0xe630('0x4b')];_0x363344[_0xe630('0x51')]=qs[_0xe630('0x52')](_0x81c3c9['query'][_0xe630('0x52')]);_0x363344[_0xe630('0x53')]=qs[_0xe630('0x54')](_['pick'](_0x81c3c9[_0xe630('0x48')],_0x2224da[_0xe630('0x54')]));if(_0x81c3c9[_0xe630('0x48')][_0xe630('0x56')]){_0x363344[_0xe630('0x53')]=_[_0xe630('0x55')](_0x363344[_0xe630('0x53')],{'$or':_[_0xe630('0x42')](_0x363344[_0xe630('0x4d')],function(_0x8df776){var _0x3dc1b8={};_0x3dc1b8[_0x8df776]={'$like':'%'+_0x81c3c9[_0xe630('0x48')][_0xe630('0x56')]+'%'};return _0x3dc1b8;})});}_0x363344=_[_0xe630('0x55')]({},_0x363344,_0x81c3c9[_0xe630('0x57')]);return _0xab2d7b[_0xe630('0xab')](_0x363344);}})[_0xe630('0x21')](function(_0xfcaa11){if(_0xfcaa11){_0x3b4c5a=_0xfcaa11[_0xe630('0x4e')];if(!_0x81c3c9[_0xe630('0x48')][_0xe630('0x4f')](_0xe630('0x50'))){_0x363344['limit']=qs[_0xe630('0x32')](_0x81c3c9['query']['limit']);_0x363344['offset']=qs[_0xe630('0x30')](_0x81c3c9[_0xe630('0x48')][_0xe630('0x30')]);}return _0xab2d7b['getApplications'](_0x363344);}})[_0xe630('0x21')](function(_0x4fa31e){if(_0x4fa31e){return _0x4fa31e?{'count':_0x3b4c5a,'rows':_0x4fa31e}:null;}})[_0xe630('0x21')](respondWithResult(_0x45e09c,null))[_0xe630('0x2c')](handleError(_0x45e09c,null));};exports[_0xe630('0xac')]=function(_0x16acc3,_0x90b35,_0x1900ac){var _0x47531e={'raw':![],'where':{}};var _0x5dbeff={};var _0x17ee7d={'count':0x0,'rows':[]};return db[_0xe630('0x43')][_0xe630('0x6b')]({'where':{'id':_0x16acc3[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x90b35,null))['then'](function(_0x1915e8){if(_0x1915e8){_0x5dbeff[_0xe630('0x4b')]=_['keys'](db[_0xe630('0x8e')][_0xe630('0x44')]);_0x5dbeff[_0xe630('0x48')]=_['keys'](_0x16acc3[_0xe630('0x48')]);_0x5dbeff['filters']=_[_0xe630('0x4a')](_0x5dbeff['model'],_0x5dbeff[_0xe630('0x48')]);_0x47531e[_0xe630('0x4d')]=_['intersection'](_0x5dbeff[_0xe630('0x4b')],qs['fields'](_0x16acc3[_0xe630('0x48')][_0xe630('0x4c')]));_0x47531e[_0xe630('0x4d')]=_0x47531e['attributes'][_0xe630('0x4e')]?_0x47531e['attributes']:_0x5dbeff[_0xe630('0x4b')];if(!_0x16acc3[_0xe630('0x48')]['hasOwnProperty']('nolimit')){_0x47531e['limit']=qs[_0xe630('0x32')](_0x16acc3[_0xe630('0x48')][_0xe630('0x32')]);_0x47531e[_0xe630('0x30')]=qs[_0xe630('0x30')](_0x16acc3['query'][_0xe630('0x30')]);}_0x47531e[_0xe630('0x51')]=qs[_0xe630('0x52')](_0x16acc3[_0xe630('0x48')][_0xe630('0x52')]);_0x47531e[_0xe630('0x53')]=qs[_0xe630('0x54')](_[_0xe630('0x6c')](_0x16acc3[_0xe630('0x48')],_0x5dbeff[_0xe630('0x54')]));_0x47531e[_0xe630('0x53')][_0xe630('0x68')]=_0x1915e8['id'];if(_0x16acc3[_0xe630('0x48')][_0xe630('0x56')]){_0x47531e[_0xe630('0x53')]=_[_0xe630('0x55')](_0x47531e['where'],{'$or':_[_0xe630('0x42')](_0x47531e[_0xe630('0x4d')],function(_0x1f2888){var _0xa509ff={};_0xa509ff[_0x1f2888]={'$like':'%'+_0x16acc3['query'][_0xe630('0x56')]+'%'};return _0xa509ff;})});}_0x47531e=_[_0xe630('0x55')]({},_0x47531e,_0x16acc3[_0xe630('0x57')]);return db['OpenchannelInteraction'][_0xe630('0x33')]({'where':_0x47531e[_0xe630('0x53')]})[_0xe630('0x21')](function(_0x3e9afb){_0x17ee7d[_0xe630('0x33')]=_0x3e9afb;if(_0x16acc3['query'][_0xe630('0x58')]){_0x47531e[_0xe630('0x59')]=[{'model':db[_0xe630('0x8b')],'as':_0xe630('0xad'),'required':![]},{'model':db[_0xe630('0x9c')],'as':'Owner','attributes':[_0xe630('0x3d'),_0xe630('0xae'),_0xe630('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xe630('0xb0'),'attributes':['id',_0xe630('0x3d'),_0xe630('0xb1')],'where':_0x16acc3[_0xe630('0x48')]['tag']?{'id':_0x16acc3[_0xe630('0x48')]['tag']}:undefined,'required':_0x16acc3['query']['tag']?!![]:![]}];}return db[_0xe630('0x8e')][_0xe630('0x5a')](_0x47531e);})[_0xe630('0x21')](function(_0x4070c4){_0x17ee7d['rows']=_0x4070c4;return _0x17ee7d;});}})[_0xe630('0x21')](respondWithFilteredResult(_0x90b35,_0x47531e))['catch'](handleError(_0x90b35,null));};exports[_0xe630('0xb2')]=function(_0x3153f0,_0x2fdb03,_0x29f993){return db[_0xe630('0x43')]['find']({'where':{'id':_0x3153f0['params']['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x2fdb03,null))[_0xe630('0x21')](function(_0xe63851){if(_0xe63851){return _0xe63851[_0xe630('0xb2')](_0x3153f0['body'][_0xe630('0x6f')],_['omit'](_0x3153f0[_0xe630('0x5d')],['ids','id'])||{})[_0xe630('0xb3')](function(_0x5dff32){for(var _0x479113=0x0;_0x479113<_0x3153f0['body'][_0xe630('0x6f')][_0xe630('0x4e')];_0x479113+=0x1){socket[_0xe630('0xb4')](_0xe630('0xb5'),{'UserId':Number(_0x3153f0[_0xe630('0x5d')][_0xe630('0x6f')][_0x479113]),'OpenchannelAccountId':Number(_0x3153f0[_0xe630('0x5b')]['id'])});}return _0x5dff32;});}})[_0xe630('0x21')](respondWithResult(_0x2fdb03,null))[_0xe630('0x2c')](handleError(_0x2fdb03,null));};exports['removeAgents']=function(_0x186cf3,_0x5ef4a0,_0x5d9fd6){return db['OpenchannelAccount'][_0xe630('0x62')]({'where':{'id':_0x186cf3['params']['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x5ef4a0,null))[_0xe630('0x21')](function(_0x4f90be){if(_0x4f90be){return _0x4f90be[_0xe630('0xb6')](_0x186cf3[_0xe630('0x48')][_0xe630('0x6f')])['then'](function(){if(_['isArray'](_0x186cf3[_0xe630('0x48')]['ids'])){for(var _0x485ed5=0x0;_0x485ed5<_0x186cf3[_0xe630('0x48')][_0xe630('0x6f')]['length'];_0x485ed5+=0x1){socket[_0xe630('0xb4')](_0xe630('0xb7'),{'UserId':Number(_0x186cf3['query'][_0xe630('0x6f')][_0x485ed5]),'OpenchannelAccountId':Number(_0x186cf3[_0xe630('0x5b')]['id'])});}}else{socket[_0xe630('0xb4')](_0xe630('0xb7'),{'UserId':Number(_0x186cf3[_0xe630('0x48')][_0xe630('0x6f')]),'OpenchannelAccountId':Number(_0x186cf3[_0xe630('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x5ef4a0,null))[_0xe630('0x2c')](handleError(_0x5ef4a0,null));};exports[_0xe630('0xb8')]=function(_0x5507bf,_0x1836d8,_0x557afe){var _0x328895={};var _0x2d689b={};var _0x3b6201;var _0x464a65;return db[_0xe630('0x43')]['findOne']({'where':{'id':_0x5507bf[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x1836d8,null))[_0xe630('0x21')](function(_0x2074be){if(_0x2074be){_0x3b6201=_0x2074be;_0x2d689b[_0xe630('0x4b')]=_['keys'](db[_0xe630('0x9c')][_0xe630('0x44')]);_0x2d689b[_0xe630('0x48')]=_['keys'](_0x5507bf[_0xe630('0x48')]);_0x2d689b[_0xe630('0x54')]=_[_0xe630('0x4a')](_0x2d689b[_0xe630('0x4b')],_0x2d689b[_0xe630('0x48')]);_0x328895[_0xe630('0x4d')]=_['intersection'](_0x2d689b[_0xe630('0x4b')],qs[_0xe630('0x4c')](_0x5507bf[_0xe630('0x48')]['fields']));_0x328895[_0xe630('0x4d')]=_0x328895[_0xe630('0x4d')][_0xe630('0x4e')]?_0x328895[_0xe630('0x4d')]:_0x2d689b[_0xe630('0x4b')];_0x328895[_0xe630('0x51')]=qs['sort'](_0x5507bf[_0xe630('0x48')][_0xe630('0x52')]);_0x328895[_0xe630('0x53')]=qs[_0xe630('0x54')](_['pick'](_0x5507bf[_0xe630('0x48')],_0x2d689b[_0xe630('0x54')]));if(_0x5507bf[_0xe630('0x48')][_0xe630('0x56')]){_0x328895[_0xe630('0x53')]=_[_0xe630('0x55')](_0x328895[_0xe630('0x53')],{'$or':_[_0xe630('0x42')](_0x328895[_0xe630('0x4d')],function(_0x1e2841){var _0x2f9510={};_0x2f9510[_0x1e2841]={'$like':'%'+_0x5507bf[_0xe630('0x48')][_0xe630('0x56')]+'%'};return _0x2f9510;})});}_0x328895=_[_0xe630('0x55')]({},_0x328895,_0x5507bf[_0xe630('0x57')]);return _0x3b6201['getAgents'](_0x328895);}})[_0xe630('0x21')](function(_0x26174d){if(_0x26174d){_0x464a65=_0x26174d[_0xe630('0x4e')];if(!_0x5507bf[_0xe630('0x48')][_0xe630('0x4f')]('nolimit')){_0x328895[_0xe630('0x32')]=qs[_0xe630('0x32')](_0x5507bf[_0xe630('0x48')][_0xe630('0x32')]);_0x328895[_0xe630('0x30')]=qs['offset'](_0x5507bf[_0xe630('0x48')][_0xe630('0x30')]);}return _0x3b6201[_0xe630('0xb8')](_0x328895);}})[_0xe630('0x21')](function(_0x2e3367){if(_0x2e3367){return _0x2e3367?{'count':_0x464a65,'rows':_0x2e3367}:null;}})[_0xe630('0x21')](respondWithResult(_0x1836d8,null))['catch'](handleError(_0x1836d8,null));};exports['send']=function(_0x3a80bf,_0x39fb04,_0x394a31){var _0x3a0936,_0x3eb657,_0xa97b1;if(_[_0xe630('0x7a')](_0x3a80bf[_0xe630('0x5d')][_0xe630('0x5d')])||_0x3a80bf['body'][_0xe630('0x5d')]===''){throw new db[(_0xe630('0x74'))][(_0xe630('0x75'))](_0xe630('0x7d'));}if(_[_0xe630('0x7a')](_0x3a80bf[_0xe630('0x5d')]['to'])){}_0x3a0936=_0x3a80bf[_0xe630('0x5d')]['to'];return db[_0xe630('0x43')][_0xe630('0x6b')]({'where':{'id':_0x3a80bf[_0xe630('0x5b')]['id']}})[_0xe630('0x21')](handleEntityNotFound(_0x39fb04,null))[_0xe630('0x21')](function(_0x4536e1){if(_0x4536e1){return db['OpenchannelAccount'][_0xe630('0x62')]({'where':{'id':_0x4536e1['id']},'include':[{'model':db[_0xe630('0x80')],'as':_0xe630('0x81'),'include':[{'model':db[_0xe630('0x8b')],'as':_0xe630('0x82'),'where':{[_0x4536e1[_0xe630('0x7f')]]:_0x3a0936},'limit':0x1,'order':[[_0xe630('0x78'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x39fb04,null))[_0xe630('0x21')](function(_0x5e31ad){if(_0x5e31ad&&_0x5e31ad['List']){_0x3eb657=_0x5e31ad['get']({'plain':!![]});if(_0x3eb657[_0xe630('0x81')]&&_0x3eb657[_0xe630('0x81')][_0xe630('0x82')][_0xe630('0x4e')]){return _0x3eb657[_0xe630('0x81')][_0xe630('0x82')][0x0];}return db[_0xe630('0x8b')]['create'](_[_0xe630('0x18')](_0x3a80bf[_0xe630('0x5d')],{'firstName':_0x3a0936,[_0x5e31ad[_0xe630('0x7f')]]:_0x3a0936,'phone':_0x3a0936,'ListId':_0x3eb657['ListId']}));}})[_0xe630('0x21')](handleEntityNotFound(_0x39fb04,null))[_0xe630('0x21')](function(_0x27bdee){if(_0x27bdee){_0xa97b1=_0x27bdee;return db[_0xe630('0x8e')]['find']({'where':{'ContactId':_0xa97b1['id'],'closed':![],'OpenchannelAccountId':_0x3eb657['id']}})[_0xe630('0x21')](function(_0x227ec3){if(_0x227ec3){return[_0x227ec3,![]];}return db['OpenchannelInteraction'][_0xe630('0x5c')]({'UserId':_0x3a80bf['user']['id'],'ContactId':_0xa97b1['id'],'OpenchannelAccountId':_0x3eb657['id'],'lastMsgDirection':'out','firstMsgDirection':_0xe630('0xb9'),'Messages':[_[_0xe630('0x55')](_0x3a80bf['body'],{'read':![],'body':_0x3a80bf[_0xe630('0x5d')][_0xe630('0x5d')],'OpenchannelAccountId':_0x3eb657['id'],'UserId':_0x3a80bf[_0xe630('0x5e')]['id'],'ContactId':_0xa97b1['id']})]},{'include':[{'model':db[_0xe630('0x99')],'as':_0xe630('0xba')}]})[_0xe630('0x21')](function(_0x59ca04){return[_0x59ca04,!![]];});});}})[_0xe630('0xb3')](function(_0x39afa3,_0x188168){if(_0x188168){return _0x39afa3;}return db['OpenchannelMessage'][_0xe630('0x5c')](_[_0xe630('0x55')](_0x3a80bf[_0xe630('0x5d')],{'read':![],'body':_0x3a80bf[_0xe630('0x5d')][_0xe630('0x5d')],'OpenchannelAccountId':_0x3eb657['id'],'OpenchannelInteractionId':_0x39afa3['id'],'UserId':_0x3a80bf[_0xe630('0x5e')]['id'],'ContactId':_0xa97b1['id']}))['then'](function(_0x1fa9c4){_0x39afa3['dataValues'][_0xe630('0xba')]=[];_0x39afa3[_0xe630('0xbb')][_0xe630('0xba')][_0xe630('0x96')](_0x1fa9c4[_0xe630('0xbb')]);return _0x39afa3;});});}})['then'](respondWithResult(_0x39fb04,null))['catch'](handleError(_0x39fb04,null));}; \ No newline at end of file +var _0x6a24=['priority','stack','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','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','./openchannelAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','OpenchannelAccounts','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','include','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','CmList','List','CmContact','Contacts','DESC','Applications','applications','list','asc','account','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','ISOLATION_LEVELS','OpenchannelApplication','findAndCountAll'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6a24,0xd1));var _0x46a2=function(_0xb87f26,_0x3b9470){_0xb87f26=_0xb87f26-0x0;var _0x592e40=_0x6a24[_0xb87f26];return _0x592e40;};'use strict';var emlformat=require(_0x46a2('0x0'));var rimraf=require(_0x46a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46a2('0x2'));var rp=require(_0x46a2('0x3'));var moment=require(_0x46a2('0x4'));var BPromise=require(_0x46a2('0x5'));var Mustache=require(_0x46a2('0x6'));var util=require('util');var path=require(_0x46a2('0x7'));var sox=require(_0x46a2('0x8'));var csv=require('to-csv');var ejs=require(_0x46a2('0x9'));var fs=require('fs');var fs_extra=require(_0x46a2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x46a2('0xb'));var jsforce=require(_0x46a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x46a2('0xd'));var querystring=require('querystring');var Papa=require(_0x46a2('0xe'));var Redis=require('ioredis');var authService=require(_0x46a2('0xf'));var qs=require(_0x46a2('0x10'));var as=require(_0x46a2('0x11'));var hardwareService=require(_0x46a2('0x12'));var logger=require(_0x46a2('0x13'))(_0x46a2('0x14'));var utils=require(_0x46a2('0x15'));var config=require(_0x46a2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x46a2('0x17')]=_[_0x46a2('0x18')](config['redis'],{'host':_0x46a2('0x19'),'port':0x18eb});var socket=require(_0x46a2('0x1a'))(new Redis(config[_0x46a2('0x17')]));require(_0x46a2('0x1b'))[_0x46a2('0x1c')](socket);var jayson=require(_0x46a2('0x1d'));var client=jayson[_0x46a2('0x1e')][_0x46a2('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c81e8,_0x2deb20,_0x5eeaba,_0xead4f8){return new BPromise(function(_0x2d755b,_0x5b7c65){var _0xa2eb96=_0xead4f8||client;return _0xa2eb96[_0x46a2('0x20')](_0x3c81e8,_0x5eeaba)['then'](function(_0x27250b){logger[_0x46a2('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x2deb20,_0x46a2('0x22'));logger[_0x46a2('0x23')](_0x46a2('0x24'),_0x2deb20,_0x46a2('0x22'),JSON[_0x46a2('0x25')](_0x27250b));if(_0x27250b[_0x46a2('0x26')]){if(_0x27250b[_0x46a2('0x26')][_0x46a2('0x27')]===0x1f4){logger[_0x46a2('0x26')](_0x46a2('0x28'),_0x2deb20,_0x27250b[_0x46a2('0x26')][_0x46a2('0x29')]);return _0x5b7c65(_0x27250b[_0x46a2('0x26')]['message']);}logger[_0x46a2('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x2deb20,_0x27250b[_0x46a2('0x26')][_0x46a2('0x29')]);return _0x2d755b(_0x27250b['error'][_0x46a2('0x29')]);}else{logger[_0x46a2('0x21')](_0x46a2('0x28'),_0x2deb20,_0x46a2('0x22'));_0x2d755b(_0x27250b['result'][_0x46a2('0x29')]);}})[_0x46a2('0x2a')](function(_0x1e48f5){logger[_0x46a2('0x26')](_0x46a2('0x28'),_0x2deb20,_0x1e48f5);_0x5b7c65(_0x1e48f5);});});}function respondWithStatusCode(_0x295f15,_0x3e9554){_0x3e9554=_0x3e9554||0xcc;return function(_0xfa9e13){if(_0xfa9e13){return _0x295f15[_0x46a2('0x2b')](_0x3e9554);}return _0x295f15[_0x46a2('0x2c')](_0x3e9554)[_0x46a2('0x2d')]();};}function respondWithResult(_0x582ada,_0x2b4d9f){_0x2b4d9f=_0x2b4d9f||0xc8;return function(_0x704a19){if(_0x704a19){return _0x582ada[_0x46a2('0x2c')](_0x2b4d9f)[_0x46a2('0x2e')](_0x704a19);}};}function respondWithFilteredResult(_0x435155,_0x33f42a){return function(_0x577fd2){if(_0x577fd2){var _0x185647=typeof _0x33f42a[_0x46a2('0x2f')]===_0x46a2('0x30')&&typeof _0x33f42a[_0x46a2('0x31')]===_0x46a2('0x30');var _0x511bea=_0x577fd2[_0x46a2('0x32')];var _0x4bb07e=_0x185647?0x0:_0x33f42a[_0x46a2('0x2f')];var _0x97a3bf=_0x185647?_0x577fd2[_0x46a2('0x32')]:_0x33f42a[_0x46a2('0x2f')]+_0x33f42a[_0x46a2('0x31')];var _0x1910c9;if(_0x97a3bf>=_0x511bea){_0x97a3bf=_0x511bea;_0x1910c9=0xc8;}else{_0x1910c9=0xce;}_0x435155[_0x46a2('0x2c')](_0x1910c9);return _0x435155[_0x46a2('0x33')](_0x46a2('0x34'),_0x4bb07e+'-'+_0x97a3bf+'/'+_0x511bea)['json'](_0x577fd2);}return null;};}function patchUpdates(_0x3ad9a7){return function(_0x3e83ea){try{jsonpatch[_0x46a2('0x35')](_0x3e83ea,_0x3ad9a7,!![]);}catch(_0x26864c){return BPromise[_0x46a2('0x36')](_0x26864c);}return _0x3e83ea['save']();};}function saveUpdates(_0x54e08c,_0x46dd8f){return function(_0x244b07){if(_0x244b07){return _0x244b07[_0x46a2('0x37')](_0x54e08c)[_0x46a2('0x38')](function(_0x800299){return _0x800299;});}return null;};}function removeEntity(_0x43845d,_0x504195){return function(_0x4d04ac){if(_0x4d04ac){return _0x4d04ac[_0x46a2('0x39')]()['then'](function(){var _0x462374=_0x4d04ac[_0x46a2('0x3a')]({'plain':!![]});var _0x45b470=_0x46a2('0x3b');return db['UserProfileResource'][_0x46a2('0x39')]({'where':{'type':_0x45b470,'resourceId':_0x462374['id']}})[_0x46a2('0x38')](function(){return _0x4d04ac;});})[_0x46a2('0x38')](function(){_0x43845d[_0x46a2('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d533,_0x3f7d3f){return function(_0x244c4b){if(!_0x244c4b){_0x30d533[_0x46a2('0x2b')](0x194);}return _0x244c4b;};}function handleError(_0x4fa161,_0x356c98){_0x356c98=_0x356c98||0x1f4;return function(_0x5bddad){logger[_0x46a2('0x26')](_0x5bddad['stack']);if(_0x5bddad[_0x46a2('0x3c')]){delete _0x5bddad[_0x46a2('0x3c')];}_0x4fa161['status'](_0x356c98)[_0x46a2('0x3d')](_0x5bddad);};}exports['index']=function(_0x50aa8b,_0x25aa1d){var _0x39e15f={'include':[{'model':db[_0x46a2('0x3e')],'as':_0x46a2('0x3f')}]},_0x41c56d={},_0x160efd={'count':0x0,'rows':[]};var _0x482ed8=_[_0x46a2('0x40')](db[_0x46a2('0x41')][_0x46a2('0x42')],function(_0x4449c5){return{'name':_0x4449c5[_0x46a2('0x43')],'type':_0x4449c5[_0x46a2('0x44')][_0x46a2('0x45')]};});_0x41c56d[_0x46a2('0x46')]=_[_0x46a2('0x40')](_0x482ed8,_0x46a2('0x3c'));_0x41c56d['query']=_[_0x46a2('0x47')](_0x50aa8b[_0x46a2('0x48')]);_0x41c56d[_0x46a2('0x49')]=_[_0x46a2('0x4a')](_0x41c56d['model'],_0x41c56d[_0x46a2('0x48')]);_0x39e15f[_0x46a2('0x4b')]=_[_0x46a2('0x4a')](_0x41c56d[_0x46a2('0x46')],qs[_0x46a2('0x4c')](_0x50aa8b['query'][_0x46a2('0x4c')]));_0x39e15f['attributes']=_0x39e15f[_0x46a2('0x4b')][_0x46a2('0x4d')]?_0x39e15f['attributes']:_0x41c56d[_0x46a2('0x46')];if(!_0x50aa8b[_0x46a2('0x48')][_0x46a2('0x4e')](_0x46a2('0x4f'))){_0x39e15f[_0x46a2('0x31')]=qs[_0x46a2('0x31')](_0x50aa8b[_0x46a2('0x48')][_0x46a2('0x31')]);_0x39e15f[_0x46a2('0x2f')]=qs[_0x46a2('0x2f')](_0x50aa8b['query'][_0x46a2('0x2f')]);}_0x39e15f[_0x46a2('0x50')]=qs[_0x46a2('0x51')](_0x50aa8b[_0x46a2('0x48')][_0x46a2('0x51')]);_0x39e15f['where']=qs[_0x46a2('0x49')](_[_0x46a2('0x52')](_0x50aa8b[_0x46a2('0x48')],_0x41c56d[_0x46a2('0x49')]),_0x482ed8);if(_0x50aa8b[_0x46a2('0x48')]['filter']){_0x39e15f[_0x46a2('0x53')]=_['merge'](_0x39e15f[_0x46a2('0x53')],{'$or':_[_0x46a2('0x40')](_0x482ed8,function(_0x47944a){if(_0x47944a[_0x46a2('0x44')]!==_0x46a2('0x54')){var _0x1328db={};_0x1328db[_0x47944a[_0x46a2('0x3c')]]={'$like':'%'+_0x50aa8b[_0x46a2('0x48')][_0x46a2('0x55')]+'%'};return _0x1328db;}})});}_0x39e15f=_[_0x46a2('0x56')]({},_0x39e15f,_0x50aa8b['options']);var _0x369015={'where':_0x39e15f[_0x46a2('0x53')]};return db[_0x46a2('0x41')][_0x46a2('0x32')](_0x369015)['then'](function(_0x2396b4){_0x160efd['count']=_0x2396b4;if(_0x50aa8b[_0x46a2('0x48')][_0x46a2('0x57')]){_0x39e15f['include']=[{'all':!![]}];}return db[_0x46a2('0x41')]['findAll'](_0x39e15f);})[_0x46a2('0x38')](function(_0x76ccd3){_0x160efd[_0x46a2('0x58')]=_0x76ccd3;return _0x160efd;})[_0x46a2('0x38')](respondWithFilteredResult(_0x25aa1d,_0x39e15f))[_0x46a2('0x2a')](handleError(_0x25aa1d,null));};exports[_0x46a2('0x59')]=function(_0x541de9,_0x4b9be7){var _0x395f77={'raw':![],'where':{'id':_0x541de9[_0x46a2('0x5a')]['id']},'include':[{'model':db[_0x46a2('0x3e')],'as':_0x46a2('0x3f')}]},_0x1a5cf4={};_0x1a5cf4[_0x46a2('0x46')]=_[_0x46a2('0x47')](db['OpenchannelAccount'][_0x46a2('0x42')]);_0x1a5cf4[_0x46a2('0x48')]=_[_0x46a2('0x47')](_0x541de9[_0x46a2('0x48')]);_0x1a5cf4[_0x46a2('0x49')]=_[_0x46a2('0x4a')](_0x1a5cf4[_0x46a2('0x46')],_0x1a5cf4['query']);_0x395f77[_0x46a2('0x4b')]=_[_0x46a2('0x4a')](_0x1a5cf4['model'],qs[_0x46a2('0x4c')](_0x541de9[_0x46a2('0x48')]['fields']));_0x395f77[_0x46a2('0x4b')]=_0x395f77[_0x46a2('0x4b')]['length']?_0x395f77[_0x46a2('0x4b')]:_0x1a5cf4[_0x46a2('0x46')];if(_0x541de9['query']['includeAll']){_0x395f77['include']=[{'all':!![]}];}_0x395f77=_['merge']({},_0x395f77,_0x541de9[_0x46a2('0x5b')]);return db['OpenchannelAccount']['find'](_0x395f77)[_0x46a2('0x38')](handleEntityNotFound(_0x4b9be7,null))[_0x46a2('0x38')](respondWithResult(_0x4b9be7,null))[_0x46a2('0x2a')](handleError(_0x4b9be7,null));};exports[_0x46a2('0x5c')]=function(_0x17223e,_0x323609){return db[_0x46a2('0x41')][_0x46a2('0x5c')](_0x17223e[_0x46a2('0x5d')],{})[_0x46a2('0x38')](function(_0x4c840d){var _0x5070a6=_0x17223e[_0x46a2('0x5e')][_0x46a2('0x3a')]({'plain':!![]});if(!_0x5070a6)throw new Error(_0x46a2('0x5f'));if(_0x5070a6['role']===_0x46a2('0x5e')){var _0x58841d=_0x4c840d[_0x46a2('0x3a')]({'plain':!![]});var _0x576db3='OpenchannelAccounts';return db[_0x46a2('0x60')]['find']({'where':{'name':_0x576db3,'userProfileId':_0x5070a6[_0x46a2('0x61')]},'raw':!![]})['then'](function(_0x3e5660){if(_0x3e5660&&_0x3e5660['autoAssociation']===0x0){return db[_0x46a2('0x62')]['create']({'name':_0x58841d[_0x46a2('0x3c')],'resourceId':_0x58841d['id'],'type':_0x3e5660[_0x46a2('0x3c')],'sectionId':_0x3e5660['id']},{})['then'](function(){return _0x4c840d;});}else{return _0x4c840d;}})[_0x46a2('0x2a')](function(_0x3827af){logger[_0x46a2('0x26')](_0x46a2('0x63'),_0x3827af);throw _0x3827af;});}return _0x4c840d;})[_0x46a2('0x38')](respondWithResult(_0x323609,0xc9))[_0x46a2('0x2a')](handleError(_0x323609,null));};exports[_0x46a2('0x37')]=function(_0x19a1c3,_0x2e987a){if(_0x19a1c3[_0x46a2('0x5d')]['id']){delete _0x19a1c3[_0x46a2('0x5d')]['id'];}return db['OpenchannelAccount'][_0x46a2('0x64')]({'where':{'id':_0x19a1c3[_0x46a2('0x5a')]['id']},'include':[{'model':db[_0x46a2('0x3e')],'as':_0x46a2('0x3f')}]})[_0x46a2('0x38')](handleEntityNotFound(_0x2e987a,null))[_0x46a2('0x38')](saveUpdates(_0x19a1c3[_0x46a2('0x5d')],null))[_0x46a2('0x38')](respondWithResult(_0x2e987a,null))[_0x46a2('0x2a')](handleError(_0x2e987a,null));};exports[_0x46a2('0x39')]=function(_0x45f91c,_0x3184f6){return db['OpenchannelAccount']['find']({'where':{'id':_0x45f91c['params']['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x3184f6,null))[_0x46a2('0x38')](removeEntity(_0x3184f6,null))[_0x46a2('0x2a')](handleError(_0x3184f6,null));};exports[_0x46a2('0x65')]=function(_0x190bc3,_0x359151){return db[_0x46a2('0x41')]['describe']()[_0x46a2('0x38')](respondWithResult(_0x359151,null))['catch'](handleError(_0x359151,null));};exports['addDisposition']=function(_0x44a691,_0x44f112,_0x171697){if(_0x44a691['body']['id']){delete _0x44a691[_0x46a2('0x5d')]['id'];}return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x44a691[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x44f112,null))[_0x46a2('0x38')](function(_0x2dabab){if(_0x2dabab){_0x44a691[_0x46a2('0x5d')][_0x46a2('0x66')]=_0x2dabab['id'];return db[_0x46a2('0x67')]['create'](_0x44a691[_0x46a2('0x5d')]);}})[_0x46a2('0x38')](respondWithResult(_0x44f112,null))[_0x46a2('0x2a')](handleError(_0x44f112,null));};exports[_0x46a2('0x68')]=function(_0x430007,_0x2e1d5b,_0x3cbe9d){var _0x4c2bc3={'raw':![],'where':{}};var _0x28938e={};var _0x6f55f1={'count':0x0,'rows':[]};return db[_0x46a2('0x41')][_0x46a2('0x69')]({'where':{'id':_0x430007['params']['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x2e1d5b,null))[_0x46a2('0x38')](function(_0x342544){if(_0x342544){_0x28938e[_0x46a2('0x46')]=_['keys'](db[_0x46a2('0x67')][_0x46a2('0x42')]);_0x28938e[_0x46a2('0x48')]=_[_0x46a2('0x47')](_0x430007[_0x46a2('0x48')]);_0x28938e[_0x46a2('0x49')]=_[_0x46a2('0x4a')](_0x28938e['model'],_0x28938e['query']);_0x4c2bc3[_0x46a2('0x4b')]=_[_0x46a2('0x4a')](_0x28938e['model'],qs[_0x46a2('0x4c')](_0x430007[_0x46a2('0x48')]['fields']));_0x4c2bc3[_0x46a2('0x4b')]=_0x4c2bc3[_0x46a2('0x4b')]['length']?_0x4c2bc3[_0x46a2('0x4b')]:_0x28938e[_0x46a2('0x46')];if(!_0x430007[_0x46a2('0x48')][_0x46a2('0x4e')](_0x46a2('0x4f'))){_0x4c2bc3[_0x46a2('0x31')]=qs[_0x46a2('0x31')](_0x430007[_0x46a2('0x48')]['limit']);_0x4c2bc3[_0x46a2('0x2f')]=qs[_0x46a2('0x2f')](_0x430007['query']['offset']);}_0x4c2bc3[_0x46a2('0x50')]=qs[_0x46a2('0x51')](_0x430007['query']['sort']);_0x4c2bc3[_0x46a2('0x53')]=qs['filters'](_[_0x46a2('0x52')](_0x430007[_0x46a2('0x48')],_0x28938e[_0x46a2('0x49')]));_0x4c2bc3[_0x46a2('0x53')]['OpenchannelAccountId']=_0x342544['id'];if(_0x430007['query'][_0x46a2('0x55')]){_0x4c2bc3[_0x46a2('0x53')]=_[_0x46a2('0x56')](_0x4c2bc3[_0x46a2('0x53')],{'$or':_[_0x46a2('0x40')](_0x4c2bc3[_0x46a2('0x4b')],function(_0x33a25a){var _0x26c58f={};_0x26c58f[_0x33a25a]={'$like':'%'+_0x430007[_0x46a2('0x48')][_0x46a2('0x55')]+'%'};return _0x26c58f;})});}_0x4c2bc3=_['merge']({},_0x4c2bc3,_0x430007['options']);return db[_0x46a2('0x67')][_0x46a2('0x32')]({'where':_0x4c2bc3['where']})[_0x46a2('0x38')](function(_0x1e2ef4){_0x6f55f1[_0x46a2('0x32')]=_0x1e2ef4;if(_0x430007['query'][_0x46a2('0x57')]){_0x4c2bc3[_0x46a2('0x6a')]=[{'all':!![]}];}return db[_0x46a2('0x67')][_0x46a2('0x6b')](_0x4c2bc3);})[_0x46a2('0x38')](function(_0x82cd99){_0x6f55f1[_0x46a2('0x58')]=_0x82cd99;return _0x6f55f1;});}})[_0x46a2('0x38')](respondWithFilteredResult(_0x2e1d5b,_0x4c2bc3))['catch'](handleError(_0x2e1d5b,null));};exports[_0x46a2('0x6c')]=function(_0x330d17,_0x5a19d0,_0x55a110){return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x330d17[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x5a19d0,null))['then'](function(_0xd55ba1){if(_0xd55ba1){return _0xd55ba1['removeDispositions'](_0x330d17[_0x46a2('0x48')][_0x46a2('0x6d')]);}})[_0x46a2('0x38')](respondWithStatusCode(_0x5a19d0,null))[_0x46a2('0x2a')](handleError(_0x5a19d0,null));};exports[_0x46a2('0x6e')]=function(_0x3b17a1,_0x563730,_0x47e3a4){if(_0x3b17a1['body']['id']){delete _0x3b17a1['body']['id'];}return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x3b17a1[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x563730,null))['then'](function(_0x4f2176){if(_0x4f2176){_0x3b17a1[_0x46a2('0x5d')]['OpenchannelAccountId']=_0x4f2176['id'];return db[_0x46a2('0x6f')][_0x46a2('0x5c')](_0x3b17a1[_0x46a2('0x5d')]);}})[_0x46a2('0x38')](respondWithResult(_0x563730,null))[_0x46a2('0x2a')](handleError(_0x563730,null));};exports[_0x46a2('0x70')]=function(_0x3cff74,_0x5a5780,_0x3e1e07){var _0x9acd30={'raw':![],'where':{}};var _0x4cd9b0={};var _0x41613f={'count':0x0,'rows':[]};return db[_0x46a2('0x41')][_0x46a2('0x69')]({'where':{'id':_0x3cff74[_0x46a2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5a5780,null))['then'](function(_0x5008a6){if(_0x5008a6){_0x4cd9b0[_0x46a2('0x46')]=_[_0x46a2('0x47')](db[_0x46a2('0x6f')][_0x46a2('0x42')]);_0x4cd9b0['query']=_[_0x46a2('0x47')](_0x3cff74[_0x46a2('0x48')]);_0x4cd9b0['filters']=_[_0x46a2('0x4a')](_0x4cd9b0[_0x46a2('0x46')],_0x4cd9b0[_0x46a2('0x48')]);_0x9acd30[_0x46a2('0x4b')]=_['intersection'](_0x4cd9b0['model'],qs[_0x46a2('0x4c')](_0x3cff74[_0x46a2('0x48')]['fields']));_0x9acd30[_0x46a2('0x4b')]=_0x9acd30[_0x46a2('0x4b')][_0x46a2('0x4d')]?_0x9acd30[_0x46a2('0x4b')]:_0x4cd9b0[_0x46a2('0x46')];if(!_0x3cff74['query'][_0x46a2('0x4e')](_0x46a2('0x4f'))){_0x9acd30[_0x46a2('0x31')]=qs[_0x46a2('0x31')](_0x3cff74[_0x46a2('0x48')][_0x46a2('0x31')]);_0x9acd30['offset']=qs[_0x46a2('0x2f')](_0x3cff74[_0x46a2('0x48')][_0x46a2('0x2f')]);}_0x9acd30['order']=qs[_0x46a2('0x51')](_0x3cff74[_0x46a2('0x48')][_0x46a2('0x51')]);_0x9acd30[_0x46a2('0x53')]=qs[_0x46a2('0x49')](_['pick'](_0x3cff74[_0x46a2('0x48')],_0x4cd9b0[_0x46a2('0x49')]));_0x9acd30[_0x46a2('0x53')]['OpenchannelAccountId']=_0x5008a6['id'];if(_0x3cff74[_0x46a2('0x48')][_0x46a2('0x55')]){_0x9acd30[_0x46a2('0x53')]=_[_0x46a2('0x56')](_0x9acd30[_0x46a2('0x53')],{'$or':_[_0x46a2('0x40')](_0x9acd30['attributes'],function(_0x32e168){var _0x2bcf7d={};_0x2bcf7d[_0x32e168]={'$like':'%'+_0x3cff74[_0x46a2('0x48')][_0x46a2('0x55')]+'%'};return _0x2bcf7d;})});}_0x9acd30=_[_0x46a2('0x56')]({},_0x9acd30,_0x3cff74[_0x46a2('0x5b')]);return db[_0x46a2('0x6f')]['count']({'where':_0x9acd30['where']})[_0x46a2('0x38')](function(_0x50de13){_0x41613f['count']=_0x50de13;if(_0x3cff74['query'][_0x46a2('0x57')]){_0x9acd30['include']=[{'all':!![]}];}return db[_0x46a2('0x6f')][_0x46a2('0x6b')](_0x9acd30);})['then'](function(_0x5e5ab4){_0x41613f[_0x46a2('0x58')]=_0x5e5ab4;return _0x41613f;});}})['then'](respondWithFilteredResult(_0x5a5780,_0x9acd30))['catch'](handleError(_0x5a5780,null));};exports[_0x46a2('0x71')]=function(_0x4c59f1,_0x5e98eb,_0x3aa8aa){return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x4c59f1[_0x46a2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e98eb,null))[_0x46a2('0x38')](function(_0x1ac66f){if(_0x1ac66f){return _0x1ac66f[_0x46a2('0x71')](_0x4c59f1[_0x46a2('0x48')][_0x46a2('0x6d')]);}})[_0x46a2('0x38')](respondWithStatusCode(_0x5e98eb,null))[_0x46a2('0x2a')](handleError(_0x5e98eb,null));};exports['notify']=function(_0x3d6b9f,_0x50cc30,_0x265485){var _0x12a25e={'body':_0x3d6b9f['body'],'channel':_0x46a2('0x72')};var _0x14e618=[];var _0x162b5f=[];var _0x3ffa62={};var _0x540959=![];return db['CmContact'][_0x46a2('0x65')]()[_0x46a2('0x38')](function(_0x1b06e7){if(!_0x1b06e7){throw new db['Sequelize'][(_0x46a2('0x73'))](_0x46a2('0x74'));}_0x14e618=_[_0x46a2('0x75')](_[_0x46a2('0x47')](_0x1b06e7),[_0x46a2('0x76'),'updatedAt']);_0x162b5f=_[_0x46a2('0x75')](_[_0x46a2('0x47')](_0x1b06e7),[_0x46a2('0x76'),_0x46a2('0x77'),_0x46a2('0x78'),_0x46a2('0x79')]);if(_0x3d6b9f[_0x46a2('0x5d')]['id']){delete _0x3d6b9f[_0x46a2('0x5d')]['id'];}if(_[_0x46a2('0x7a')](_0x3d6b9f[_0x46a2('0x5d')]['from'])){throw new db[(_0x46a2('0x7b'))][(_0x46a2('0x73'))](_0x46a2('0x7c'));}if(_['isNil'](_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x5d')])||_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x5d')]===''){throw new db[(_0x46a2('0x7b'))][(_0x46a2('0x73'))](_0x46a2('0x7d'));}if(_[_0x46a2('0x7a')](_0x3d6b9f[_0x46a2('0x5d')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x46a2('0x7e')+_0x162b5f);}if(!_[_0x46a2('0x7f')](_0x162b5f,_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x80')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x162b5f);}_0x3ffa62[_0x3d6b9f[_0x46a2('0x5d')]['mapKey']]=_0x3d6b9f['body'][_0x46a2('0x81')];})['then'](function(){return db[_0x46a2('0x41')]['find']({'where':{'id':_0x3d6b9f[_0x46a2('0x5a')]['id']},'include':[{'model':db[_0x46a2('0x82')],'as':_0x46a2('0x83'),'include':[{'model':db[_0x46a2('0x84')],'as':_0x46a2('0x85'),'where':_0x3ffa62,'limit':0x1,'order':[[_0x46a2('0x77'),_0x46a2('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0x46a2('0x87')}]});})[_0x46a2('0x38')](handleEntityNotFound(_0x50cc30,null))[_0x46a2('0x38')](function(_0x522c70){if(_0x522c70&&_0x522c70[_0x46a2('0x83')]){_0x12a25e['account']=_0x522c70;_0x12a25e[_0x46a2('0x88')]=_0x522c70[_0x46a2('0x87')];_0x12a25e[_0x46a2('0x89')]=_0x522c70[_0x46a2('0x83')];_0x12a25e['applications']=_['orderBy'](_0x12a25e[_0x46a2('0x88')],['priority'],[_0x46a2('0x8a')]);if(_0x12a25e[_0x46a2('0x8b')][_0x46a2('0x87')]){delete _0x12a25e[_0x46a2('0x8b')][_0x46a2('0x87')];}if(_0x12a25e[_0x46a2('0x8b')][_0x46a2('0x83')]&&_0x12a25e[_0x46a2('0x8b')][_0x46a2('0x83')][_0x46a2('0x85')][_0x46a2('0x4d')]){return _0x12a25e[_0x46a2('0x8b')][_0x46a2('0x83')]['Contacts'][0x0];}var _0x34ac83=_[_0x46a2('0x18')](_0x3d6b9f['body'],{'firstName':_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x81')],'ListId':_0x522c70[_0x46a2('0x79')]});_0x34ac83[_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x80')]]=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x81')];return db[_0x46a2('0x84')][_0x46a2('0x5c')](_0x34ac83,{'fields':_0x14e618,'raw':!![]});}})['then'](handleEntityNotFound(_0x50cc30,null))['then'](function(_0x16941e){_0x12a25e[_0x46a2('0x8c')]=_0x16941e;if(_0x16941e){var _0x359219={'ContactId':_0x16941e['id'],'OpenchannelAccountId':_0x3d6b9f['params']['id'],'from':(_0x16941e[_0x46a2('0x8d')]||'')+'\x20'+(_0x16941e['lastName']||'')};var _0x30990d={'OpenchannelAccountId':_0x3d6b9f[_0x46a2('0x5a')]['id'],'closed':![]};if(_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x8e')]){_0x30990d['threadId']=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x8e')];return db[_0x46a2('0x8f')][_0x46a2('0x64')]({'where':_0x30990d})['then'](function(_0x356327){if(_0x356327){return[_0x356327,![]];}_0x359219[_0x46a2('0x8e')]=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x8e')];_0x359219['externalUrl']=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x90')];return db[_0x46a2('0x8f')][_0x46a2('0x5c')](_0x359219)['then'](function(_0x335844){return[_0x335844,!![]];});});}else{_0x30990d[_0x46a2('0x8e')]=null;}_0x30990d[_0x46a2('0x91')]=_0x16941e['id'];return db['OpenchannelInteraction'][_0x46a2('0x64')]({'where':_0x30990d})[_0x46a2('0x38')](function(_0x2f3d4f){if(_0x2f3d4f){return[_0x2f3d4f,![]];}return db[_0x46a2('0x8f')]['create'](_0x359219)[_0x46a2('0x38')](function(_0x12702c){return[_0x12702c,!![]];});});}})[_0x46a2('0x92')](function(_0x2bbab3,_0x1c402){if(_0x2bbab3){_0x540959=_0x1c402;if(!_0x1c402){var _0x40dd93={'from':(_0x12a25e['contact'][_0x46a2('0x8d')]||'')+'\x20'+(_0x12a25e['contact'][_0x46a2('0x93')]||'')};if(_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x8e')]&&_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x94')]&&_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x8e')]!=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x94')]){_0x40dd93[_0x46a2('0x8e')]=_0x3d6b9f[_0x46a2('0x5d')][_0x46a2('0x94')];}return _0x2bbab3[_0x46a2('0x37')](_0x40dd93);}else{return _0x2bbab3;}}})['then'](function(_0x2f1b6d){_0x12a25e[_0x46a2('0x95')]=_0x2f1b6d[_0x46a2('0x3a')]({'plain':!![]});_0x12a25e[_0x46a2('0x95')][_0x46a2('0x96')]=_0x540959;if(_0x12a25e[_0x46a2('0x95')][_0x46a2('0x96')]){if(_0x12a25e[_0x46a2('0x8b')]['autoclose']){_0x12a25e[_0x46a2('0x88')][_0x46a2('0x97')]({'id':0x0,'priority':_0x12a25e[_0x46a2('0x88')][_0x46a2('0x4d')]+0x1,'app':_0x46a2('0x98'),'appdata':'unmanaged','interval':_0x46a2('0x99')});}}return db[_0x46a2('0x9a')][_0x46a2('0x5c')]({'body':_0x3d6b9f['body'][_0x46a2('0x5d')],'OpenchannelAccountId':_0x3d6b9f[_0x46a2('0x5a')]['id'],'OpenchannelInteractionId':_0x2f1b6d['id'],'direction':'in','ContactId':_0x12a25e['contact']['id'],'AttachmentId':_0x3d6b9f['body'][_0x46a2('0x9b')]});})[_0x46a2('0x38')](function(_0x30804b){_0x12a25e[_0x46a2('0x29')]=_0x30804b;if(_0x12a25e[_0x46a2('0x95')]['UserId']){return db[_0x46a2('0x9c')][_0x46a2('0x64')]({'attributes':['id',_0x46a2('0x3c')],'where':{'id':_0x12a25e[_0x46a2('0x95')][_0x46a2('0x9d')]}})[_0x46a2('0x38')](function(_0x75ca65){if(_0x75ca65){_0x12a25e['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x46a2('0x9e'),'appdata':_0x75ca65[_0x46a2('0x3c')]+','+(_0x12a25e[_0x46a2('0x8b')][_0x46a2('0x9f')]||0xa),'interval':'*,*,*,*'});_0x12a25e[_0x46a2('0xa0')]=![];}return respondWithRpcPromise(_0x46a2('0xa1'),_0x46a2('0xa2'),_0x12a25e);});}return respondWithRpcPromise(_0x46a2('0xa1'),_0x46a2('0xa2'),_0x12a25e);})[_0x46a2('0x38')](function(_0x3fa56f){respondWithRpcPromise(_0x46a2('0xa3'),'EventManager',{'event':_0x46a2('0xa4'),'message':_0x3fa56f},client9002);return _0x3fa56f;})['then'](respondWithResult(_0x50cc30,null))[_0x46a2('0x2a')](handleError(_0x50cc30,null));};exports[_0x46a2('0xa5')]=function(_0x3eb9a1,_0x246502){var _0xc2a33=_0x3eb9a1[_0x46a2('0x5a')]['id'];var _0x3f9557=_0x3eb9a1['body'];var _0x5dceb5=0xc8;var _0xd68ed2=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x46a2('0xa6')]['READ_COMMITTED']},function(_0xd6edb1){return db['OpenchannelAccount'][_0x46a2('0x69')]({'where':{'id':_0xc2a33},'transaction':_0xd6edb1})[_0x46a2('0x38')](function(_0x2b73b6){if(_0x2b73b6){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0xc2a33},'transaction':_0xd6edb1})[_0x46a2('0x38')](function(){var _0x376144=_[_0x46a2('0x40')](_0x3f9557,function(_0x41cd3e){_0x41cd3e['OpenchannelAccountId']=_0xc2a33;return _0x41cd3e;});return db['OpenchannelApplication']['bulkCreate'](_0x376144,{'transaction':_0xd6edb1});});}else{_0x5dceb5=0x194;_0xd68ed2=[];}});})[_0x46a2('0x38')](function(){if(_0x5dceb5!==0x194){return db[_0x46a2('0xa7')][_0x46a2('0xa8')]({'where':{'OpenchannelAccountId':_0xc2a33},'order':_0x46a2('0xa9')})[_0x46a2('0x38')](function(_0x1ab85d){_0xd68ed2=_0x1ab85d;});}})[_0x46a2('0x2a')](function(_0x368b71){_0x5dceb5=0x1f4;logger[_0x46a2('0x26')](_0x368b71[_0x46a2('0xaa')]);if(_0x368b71[_0x46a2('0x3c')]){delete _0x368b71[_0x46a2('0x3c')];}_0xd68ed2=_0x368b71;})[_0x46a2('0xab')](function(){if(_0xd68ed2===null){_0x246502[_0x46a2('0x2b')](_0x5dceb5);}else{if(_0x5dceb5===0x1f4){_0x246502[_0x46a2('0x2c')](_0x5dceb5)[_0x46a2('0x3d')](_0xd68ed2);}else{_0x246502[_0x46a2('0x2c')](_0x5dceb5)['json'](_0xd68ed2);}}});};exports[_0x46a2('0xac')]=function(_0x3cee12,_0x488942,_0x57eb01){var _0x51fbde={};var _0x5bec2f={};var _0x464800;var _0x422aae;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3cee12[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x488942,null))[_0x46a2('0x38')](function(_0xcd7a4c){if(_0xcd7a4c){_0x464800=_0xcd7a4c;_0x5bec2f['model']=_[_0x46a2('0x47')](db['OpenchannelApplication'][_0x46a2('0x42')]);_0x5bec2f[_0x46a2('0x48')]=_[_0x46a2('0x47')](_0x3cee12['query']);_0x5bec2f['filters']=_['intersection'](_0x5bec2f[_0x46a2('0x46')],_0x5bec2f[_0x46a2('0x48')]);_0x51fbde[_0x46a2('0x4b')]=_[_0x46a2('0x4a')](_0x5bec2f[_0x46a2('0x46')],qs[_0x46a2('0x4c')](_0x3cee12[_0x46a2('0x48')]['fields']));_0x51fbde[_0x46a2('0x4b')]=_0x51fbde[_0x46a2('0x4b')][_0x46a2('0x4d')]?_0x51fbde[_0x46a2('0x4b')]:_0x5bec2f[_0x46a2('0x46')];_0x51fbde[_0x46a2('0x50')]=qs[_0x46a2('0x51')](_0x3cee12['query'][_0x46a2('0x51')]);_0x51fbde[_0x46a2('0x53')]=qs[_0x46a2('0x49')](_['pick'](_0x3cee12[_0x46a2('0x48')],_0x5bec2f[_0x46a2('0x49')]));if(_0x3cee12[_0x46a2('0x48')][_0x46a2('0x55')]){_0x51fbde[_0x46a2('0x53')]=_[_0x46a2('0x56')](_0x51fbde[_0x46a2('0x53')],{'$or':_['map'](_0x51fbde['attributes'],function(_0x966c2c){var _0x2f3b4b={};_0x2f3b4b[_0x966c2c]={'$like':'%'+_0x3cee12[_0x46a2('0x48')]['filter']+'%'};return _0x2f3b4b;})});}_0x51fbde=_['merge']({},_0x51fbde,_0x3cee12['options']);return _0x464800['getApplications'](_0x51fbde);}})['then'](function(_0x30b5ad){if(_0x30b5ad){_0x422aae=_0x30b5ad[_0x46a2('0x4d')];if(!_0x3cee12[_0x46a2('0x48')]['hasOwnProperty'](_0x46a2('0x4f'))){_0x51fbde['limit']=qs['limit'](_0x3cee12[_0x46a2('0x48')][_0x46a2('0x31')]);_0x51fbde['offset']=qs[_0x46a2('0x2f')](_0x3cee12[_0x46a2('0x48')][_0x46a2('0x2f')]);}return _0x464800['getApplications'](_0x51fbde);}})[_0x46a2('0x38')](function(_0x11ce9d){if(_0x11ce9d){return _0x11ce9d?{'count':_0x422aae,'rows':_0x11ce9d}:null;}})['then'](respondWithResult(_0x488942,null))[_0x46a2('0x2a')](handleError(_0x488942,null));};exports[_0x46a2('0xad')]=function(_0x5df064,_0x435f8f,_0x2bf3b9){var _0x4dde1d={'raw':![],'where':{}};var _0x4296d3={};var _0x2f9cb2={'count':0x0,'rows':[]};return db[_0x46a2('0x41')][_0x46a2('0x69')]({'where':{'id':_0x5df064['params']['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x435f8f,null))['then'](function(_0x3cdc3c){if(_0x3cdc3c){_0x4296d3[_0x46a2('0x46')]=_['keys'](db[_0x46a2('0x8f')]['rawAttributes']);_0x4296d3[_0x46a2('0x48')]=_[_0x46a2('0x47')](_0x5df064[_0x46a2('0x48')]);_0x4296d3[_0x46a2('0x49')]=_[_0x46a2('0x4a')](_0x4296d3['model'],_0x4296d3['query']);_0x4dde1d[_0x46a2('0x4b')]=_['intersection'](_0x4296d3[_0x46a2('0x46')],qs[_0x46a2('0x4c')](_0x5df064[_0x46a2('0x48')][_0x46a2('0x4c')]));_0x4dde1d['attributes']=_0x4dde1d['attributes'][_0x46a2('0x4d')]?_0x4dde1d['attributes']:_0x4296d3[_0x46a2('0x46')];if(!_0x5df064[_0x46a2('0x48')][_0x46a2('0x4e')](_0x46a2('0x4f'))){_0x4dde1d['limit']=qs[_0x46a2('0x31')](_0x5df064['query'][_0x46a2('0x31')]);_0x4dde1d['offset']=qs['offset'](_0x5df064[_0x46a2('0x48')][_0x46a2('0x2f')]);}_0x4dde1d[_0x46a2('0x50')]=qs['sort'](_0x5df064[_0x46a2('0x48')]['sort']);_0x4dde1d[_0x46a2('0x53')]=qs['filters'](_[_0x46a2('0x52')](_0x5df064[_0x46a2('0x48')],_0x4296d3[_0x46a2('0x49')]));_0x4dde1d[_0x46a2('0x53')]['OpenchannelAccountId']=_0x3cdc3c['id'];if(_0x5df064[_0x46a2('0x48')][_0x46a2('0x55')]){_0x4dde1d[_0x46a2('0x53')]=_[_0x46a2('0x56')](_0x4dde1d[_0x46a2('0x53')],{'$or':_[_0x46a2('0x40')](_0x4dde1d[_0x46a2('0x4b')],function(_0x43343e){var _0x294a46={};_0x294a46[_0x43343e]={'$like':'%'+_0x5df064[_0x46a2('0x48')]['filter']+'%'};return _0x294a46;})});}_0x4dde1d=_[_0x46a2('0x56')]({},_0x4dde1d,_0x5df064['options']);return db['OpenchannelInteraction'][_0x46a2('0x32')]({'where':_0x4dde1d[_0x46a2('0x53')]})['then'](function(_0x3fd5f5){_0x2f9cb2[_0x46a2('0x32')]=_0x3fd5f5;if(_0x5df064[_0x46a2('0x48')][_0x46a2('0x57')]){_0x4dde1d['include']=[{'model':db[_0x46a2('0x84')],'as':'Contact','required':![]},{'model':db[_0x46a2('0x9c')],'as':_0x46a2('0xae'),'attributes':[_0x46a2('0x3c'),_0x46a2('0xaf'),_0x46a2('0xb0')],'required':![]},{'model':db[_0x46a2('0xb1')],'as':'Tags','attributes':['id',_0x46a2('0x3c'),'color'],'where':_0x5df064['query']['tag']?{'id':_0x5df064[_0x46a2('0x48')][_0x46a2('0xb2')]}:undefined,'required':_0x5df064[_0x46a2('0x48')][_0x46a2('0xb2')]?!![]:![]}];}return db[_0x46a2('0x8f')]['findAll'](_0x4dde1d);})['then'](function(_0x499993){_0x2f9cb2['rows']=_0x499993;return _0x2f9cb2;});}})[_0x46a2('0x38')](respondWithFilteredResult(_0x435f8f,_0x4dde1d))[_0x46a2('0x2a')](handleError(_0x435f8f,null));};exports[_0x46a2('0xb3')]=function(_0x40d647,_0x11e797,_0x11efa2){return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x40d647[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x11e797,null))[_0x46a2('0x38')](function(_0x2148f6){if(_0x2148f6){return _0x2148f6[_0x46a2('0xb3')](_0x40d647[_0x46a2('0x5d')][_0x46a2('0x6d')],_[_0x46a2('0xb4')](_0x40d647[_0x46a2('0x5d')],[_0x46a2('0x6d'),'id'])||{})[_0x46a2('0x92')](function(_0x715fd0){for(var _0x589c6d=0x0;_0x589c6d<_0x40d647[_0x46a2('0x5d')][_0x46a2('0x6d')][_0x46a2('0x4d')];_0x589c6d+=0x1){socket[_0x46a2('0xb5')](_0x46a2('0xb6'),{'UserId':Number(_0x40d647[_0x46a2('0x5d')]['ids'][_0x589c6d]),'OpenchannelAccountId':Number(_0x40d647[_0x46a2('0x5a')]['id'])});}return _0x715fd0;});}})[_0x46a2('0x38')](respondWithResult(_0x11e797,null))['catch'](handleError(_0x11e797,null));};exports[_0x46a2('0xb7')]=function(_0x31304c,_0x1535f8,_0x50a60b){return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x31304c['params']['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x1535f8,null))[_0x46a2('0x38')](function(_0x18e6c5){if(_0x18e6c5){return _0x18e6c5[_0x46a2('0xb7')](_0x31304c[_0x46a2('0x48')][_0x46a2('0x6d')])[_0x46a2('0x38')](function(){if(_[_0x46a2('0xb8')](_0x31304c[_0x46a2('0x48')][_0x46a2('0x6d')])){for(var _0x3459e0=0x0;_0x3459e0<_0x31304c[_0x46a2('0x48')][_0x46a2('0x6d')][_0x46a2('0x4d')];_0x3459e0+=0x1){socket[_0x46a2('0xb5')](_0x46a2('0xb9'),{'UserId':Number(_0x31304c[_0x46a2('0x48')][_0x46a2('0x6d')][_0x3459e0]),'OpenchannelAccountId':Number(_0x31304c[_0x46a2('0x5a')]['id'])});}}else{socket[_0x46a2('0xb5')](_0x46a2('0xb9'),{'UserId':Number(_0x31304c[_0x46a2('0x48')][_0x46a2('0x6d')]),'OpenchannelAccountId':Number(_0x31304c[_0x46a2('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x1535f8,null))[_0x46a2('0x2a')](handleError(_0x1535f8,null));};exports[_0x46a2('0xba')]=function(_0x38260f,_0x533521,_0x35c172){var _0x5c1692={};var _0x27475b={};var _0x31bd6a;var _0x3f3432;return db[_0x46a2('0x41')][_0x46a2('0x69')]({'where':{'id':_0x38260f[_0x46a2('0x5a')]['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x533521,null))['then'](function(_0x123bda){if(_0x123bda){_0x31bd6a=_0x123bda;_0x27475b['model']=_[_0x46a2('0x47')](db[_0x46a2('0x9c')][_0x46a2('0x42')]);_0x27475b['query']=_[_0x46a2('0x47')](_0x38260f['query']);_0x27475b['filters']=_[_0x46a2('0x4a')](_0x27475b[_0x46a2('0x46')],_0x27475b[_0x46a2('0x48')]);_0x5c1692['attributes']=_[_0x46a2('0x4a')](_0x27475b[_0x46a2('0x46')],qs[_0x46a2('0x4c')](_0x38260f[_0x46a2('0x48')][_0x46a2('0x4c')]));_0x5c1692['attributes']=_0x5c1692[_0x46a2('0x4b')][_0x46a2('0x4d')]?_0x5c1692['attributes']:_0x27475b[_0x46a2('0x46')];_0x5c1692['order']=qs[_0x46a2('0x51')](_0x38260f[_0x46a2('0x48')][_0x46a2('0x51')]);_0x5c1692[_0x46a2('0x53')]=qs[_0x46a2('0x49')](_[_0x46a2('0x52')](_0x38260f[_0x46a2('0x48')],_0x27475b['filters']));if(_0x38260f['query']['filter']){_0x5c1692['where']=_[_0x46a2('0x56')](_0x5c1692['where'],{'$or':_['map'](_0x5c1692['attributes'],function(_0x3b70c8){var _0xc534be={};_0xc534be[_0x3b70c8]={'$like':'%'+_0x38260f[_0x46a2('0x48')][_0x46a2('0x55')]+'%'};return _0xc534be;})});}_0x5c1692=_[_0x46a2('0x56')]({},_0x5c1692,_0x38260f[_0x46a2('0x5b')]);return _0x31bd6a[_0x46a2('0xba')](_0x5c1692);}})[_0x46a2('0x38')](function(_0x14315f){if(_0x14315f){_0x3f3432=_0x14315f[_0x46a2('0x4d')];if(!_0x38260f[_0x46a2('0x48')][_0x46a2('0x4e')](_0x46a2('0x4f'))){_0x5c1692['limit']=qs['limit'](_0x38260f[_0x46a2('0x48')][_0x46a2('0x31')]);_0x5c1692[_0x46a2('0x2f')]=qs[_0x46a2('0x2f')](_0x38260f[_0x46a2('0x48')]['offset']);}return _0x31bd6a[_0x46a2('0xba')](_0x5c1692);}})[_0x46a2('0x38')](function(_0x3f0727){if(_0x3f0727){return _0x3f0727?{'count':_0x3f3432,'rows':_0x3f0727}:null;}})[_0x46a2('0x38')](respondWithResult(_0x533521,null))['catch'](handleError(_0x533521,null));};exports[_0x46a2('0x3d')]=function(_0x4bd60,_0x19fd6f,_0x34b87d){var _0x59763e,_0xcd7e11,_0x64cade;if(_['isNil'](_0x4bd60[_0x46a2('0x5d')][_0x46a2('0x5d')])||_0x4bd60[_0x46a2('0x5d')]['body']===''){throw new db[(_0x46a2('0x7b'))]['ValidationError'](_0x46a2('0x7d'));}if(_[_0x46a2('0x7a')](_0x4bd60['body']['to'])){}_0x59763e=_0x4bd60[_0x46a2('0x5d')]['to'];return db[_0x46a2('0x41')][_0x46a2('0x69')]({'where':{'id':_0x4bd60['params']['id']}})[_0x46a2('0x38')](handleEntityNotFound(_0x19fd6f,null))[_0x46a2('0x38')](function(_0x314b7b){if(_0x314b7b){return db[_0x46a2('0x41')][_0x46a2('0x64')]({'where':{'id':_0x314b7b['id']},'include':[{'model':db['CmList'],'as':_0x46a2('0x83'),'include':[{'model':db['CmContact'],'as':_0x46a2('0x85'),'where':{[_0x314b7b[_0x46a2('0x80')]]:_0x59763e},'limit':0x1,'order':[[_0x46a2('0x77'),_0x46a2('0x86')]]}]}]})[_0x46a2('0x38')](handleEntityNotFound(_0x19fd6f,null))[_0x46a2('0x38')](function(_0xab6290){if(_0xab6290&&_0xab6290[_0x46a2('0x83')]){_0xcd7e11=_0xab6290['get']({'plain':!![]});if(_0xcd7e11['List']&&_0xcd7e11[_0x46a2('0x83')][_0x46a2('0x85')][_0x46a2('0x4d')]){return _0xcd7e11[_0x46a2('0x83')][_0x46a2('0x85')][0x0];}return db['CmContact'][_0x46a2('0x5c')](_[_0x46a2('0x18')](_0x4bd60[_0x46a2('0x5d')],{'firstName':_0x59763e,[_0xab6290[_0x46a2('0x80')]]:_0x59763e,'phone':_0x59763e,'ListId':_0xcd7e11[_0x46a2('0x79')]}));}})['then'](handleEntityNotFound(_0x19fd6f,null))[_0x46a2('0x38')](function(_0x4893d8){if(_0x4893d8){_0x64cade=_0x4893d8;return db[_0x46a2('0x8f')][_0x46a2('0x64')]({'where':{'ContactId':_0x64cade['id'],'closed':![],'OpenchannelAccountId':_0xcd7e11['id']}})[_0x46a2('0x38')](function(_0x4a8144){if(_0x4a8144){return[_0x4a8144,![]];}return db[_0x46a2('0x8f')][_0x46a2('0x5c')]({'UserId':_0x4bd60[_0x46a2('0x5e')]['id'],'ContactId':_0x64cade['id'],'OpenchannelAccountId':_0xcd7e11['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x46a2('0x56')](_0x4bd60[_0x46a2('0x5d')],{'read':![],'body':_0x4bd60[_0x46a2('0x5d')]['body'],'OpenchannelAccountId':_0xcd7e11['id'],'UserId':_0x4bd60[_0x46a2('0x5e')]['id'],'ContactId':_0x64cade['id']})]},{'include':[{'model':db[_0x46a2('0x9a')],'as':_0x46a2('0xbb')}]})[_0x46a2('0x38')](function(_0x64e02b){return[_0x64e02b,!![]];});});}})[_0x46a2('0x92')](function(_0x4a0cdc,_0x51f474){if(_0x51f474){return _0x4a0cdc;}return db[_0x46a2('0x9a')][_0x46a2('0x5c')](_[_0x46a2('0x56')](_0x4bd60['body'],{'read':![],'body':_0x4bd60[_0x46a2('0x5d')]['body'],'OpenchannelAccountId':_0xcd7e11['id'],'OpenchannelInteractionId':_0x4a0cdc['id'],'UserId':_0x4bd60[_0x46a2('0x5e')]['id'],'ContactId':_0x64cade['id']}))[_0x46a2('0x38')](function(_0x15253e){_0x4a0cdc['dataValues'][_0x46a2('0xbb')]=[];_0x4a0cdc[_0x46a2('0xbc')][_0x46a2('0xbb')][_0x46a2('0x97')](_0x15253e[_0x46a2('0xbc')]);return _0x4a0cdc;});});}})[_0x46a2('0x38')](respondWithResult(_0x19fd6f,null))[_0x46a2('0x2a')](handleError(_0x19fd6f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1baba3c..84481ec 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 _0x55e0=['remove','emit','hook','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x5459c6,_0x4f3f18){var _0x3380e0=function(_0x52e4cc){while(--_0x52e4cc){_0x5459c6['push'](_0x5459c6['shift']());}};_0x3380e0(++_0x4f3f18);}(_0x55e0,0xdc));var _0x055e=function(_0x58ec42,_0x2b57b0){_0x58ec42=_0x58ec42-0x0;var _0x32093e=_0x55e0[_0x58ec42];return _0x32093e;};'use strict';var EventEmitter=require(_0x055e('0x0'));var OpenchannelAccount=require(_0x055e('0x1'))['db'][_0x055e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x055e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x055e('0x4')};function emitEvent(_0x2d9bd5){return function(_0x33cd7b,_0x2773e4,_0x157473){OpenchannelAccountEvents[_0x055e('0x5')](_0x2d9bd5+':'+_0x33cd7b['id'],_0x33cd7b);OpenchannelAccountEvents['emit'](_0x2d9bd5,_0x33cd7b);_0x157473(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x055e('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x3a100b,_0x19752f){var _0x224e77=function(_0x506389){while(--_0x506389){_0x3a100b['push'](_0x3a100b['shift']());}};_0x224e77(++_0x19752f);}(_0x1be1,0x192));var _0x11be=function(_0x382a75,_0x4df8ef){_0x382a75=_0x382a75-0x0;var _0xd107f9=_0x1be1[_0x382a75];return _0xd107f9;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index a250242..d237149 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(_0x356c30,_0x377465){var _0x2f51db=function(_0xe61456){while(--_0xe61456){_0x356c30['push'](_0x356c30['shift']());}};_0x2f51db(++_0x377465);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0xff4df0,_0x52402f){var _0x51a77b=function(_0x5c27de){while(--_0x5c27de){_0xff4df0['push'](_0xff4df0['shift']());}};_0x51a77b(++_0x52402f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 e508e2d..b389a5a 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 _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xeffd,0x6b));var _0xdeff=function(_0xedcd73,_0xa3c772){_0xedcd73=_0xedcd73-0x0;var _0x3a531b=_0xeffd[_0xedcd73];return _0x3a531b;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file +var _0x2547=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x2547,0x1cd));var _0x7254=function(_0x507459,_0x1271ca){_0x507459=_0x507459-0x0;var _0x3a641d=_0x2547[_0x507459];return _0x3a641d;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var moment=require(_0x7254('0x1'));var BPromise=require(_0x7254('0x2'));var rs=require(_0x7254('0x3'));var fs=require('fs');var Redis=require(_0x7254('0x4'));var db=require(_0x7254('0x5'))['db'];var utils=require(_0x7254('0x6'));var logger=require(_0x7254('0x7'))('rpc');var config=require(_0x7254('0x8'));var jayson=require(_0x7254('0x9'));var client=jayson[_0x7254('0xa')][_0x7254('0xb')]({'port':0x232a});config['redis']=_[_0x7254('0xc')](config[_0x7254('0xd')],{'host':_0x7254('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7254('0xd')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x51a750,_0x3036ab,_0x30086e){return new BPromise(function(_0x31d5a5,_0x310c21){return client[_0x7254('0xf')](_0x51a750,_0x30086e)[_0x7254('0x10')](function(_0x4d19e8){logger[_0x7254('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x3036ab,_0x7254('0x12'));logger['debug'](_0x7254('0x13'),_0x3036ab,_0x7254('0x12'),JSON[_0x7254('0x14')](_0x4d19e8));if(_0x4d19e8[_0x7254('0x15')]){if(_0x4d19e8[_0x7254('0x15')][_0x7254('0x16')]===0x1f4){logger[_0x7254('0x15')](_0x7254('0x17'),_0x3036ab,_0x4d19e8[_0x7254('0x15')][_0x7254('0x18')]);return _0x310c21(_0x4d19e8[_0x7254('0x15')][_0x7254('0x18')]);}logger[_0x7254('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x3036ab,_0x4d19e8[_0x7254('0x15')][_0x7254('0x18')]);return _0x31d5a5(_0x4d19e8[_0x7254('0x15')][_0x7254('0x18')]);}else{logger[_0x7254('0x11')](_0x7254('0x17'),_0x3036ab,_0x7254('0x12'));_0x31d5a5(_0x4d19e8['result'][_0x7254('0x18')]);}})[_0x7254('0x19')](function(_0x1fb71c){logger[_0x7254('0x15')](_0x7254('0x17'),_0x3036ab,_0x1fb71c);_0x310c21(_0x1fb71c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 3d9b3f1..3096b35 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 _0x4a3c=['update','emit','removeListener','register','./openchannelAccount.events','remove'];(function(_0x2a4277,_0x15e9bb){var _0x165aa0=function(_0x5da4ae){while(--_0x5da4ae){_0x2a4277['push'](_0x2a4277['shift']());}};_0x165aa0(++_0x15e9bb);}(_0x4a3c,0x13c));var _0xc4a3=function(_0x54931c,_0x3e6809){_0x54931c=_0x54931c-0x0;var _0x4696aa=_0x4a3c[_0x54931c];return _0x4696aa;};'use strict';var OpenchannelAccountEvents=require(_0xc4a3('0x0'));var events=['save',_0xc4a3('0x1'),_0xc4a3('0x2')];function createListener(_0x353760,_0x132afa){return function(_0x296209){_0x132afa[_0xc4a3('0x3')](_0x353760,_0x296209);};}function removeListener(_0xea7843,_0x5785ed){return function(){OpenchannelAccountEvents[_0xc4a3('0x4')](_0xea7843,_0x5785ed);};}exports[_0xc4a3('0x5')]=function(_0x26db49){for(var _0x3a4100=0x0,_0x4b1c84=events['length'];_0x3a4100<_0x4b1c84;_0x3a4100++){var _0x596b01=events[_0x3a4100];var _0xc11c29=createListener('openchannelAccount:'+_0x596b01,_0x26db49);OpenchannelAccountEvents['on'](_0x596b01,_0xc11c29);}}; \ No newline at end of file +var _0xdfe9=['remove','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0xae9024,_0x17f58e){var _0x23e7d3=function(_0x5911fb){while(--_0x5911fb){_0xae9024['push'](_0xae9024['shift']());}};_0x23e7d3(++_0x17f58e);}(_0xdfe9,0xc3));var _0x9dfe=function(_0xfd923e,_0x482de1){_0xfd923e=_0xfd923e-0x0;var _0x17068c=_0xdfe9[_0xfd923e];return _0x17068c;};'use strict';var OpenchannelAccountEvents=require(_0x9dfe('0x0'));var events=['save',_0x9dfe('0x1'),'update'];function createListener(_0x4c67d6,_0x32bd98){return function(_0x2d3b4e){_0x32bd98[_0x9dfe('0x2')](_0x4c67d6,_0x2d3b4e);};}function removeListener(_0x35fd64,_0x1ed50f){return function(){OpenchannelAccountEvents[_0x9dfe('0x3')](_0x35fd64,_0x1ed50f);};}exports[_0x9dfe('0x4')]=function(_0x3678b1){for(var _0x2b0d0b=0x0,_0x3471f0=events[_0x9dfe('0x5')];_0x2b0d0b<_0x3471f0;_0x2b0d0b++){var _0x5e0faf=events[_0x2b0d0b];var _0x377c1e=createListener(_0x9dfe('0x6')+_0x5e0faf,_0x3678b1);OpenchannelAccountEvents['on'](_0x5e0faf,_0x377c1e);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index aa11ff0..81aee46 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 _0x90d0=['/:id','isAuthenticated','show','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','index','get'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x90d0,0x149));var _0x090d=function(_0x297269,_0x568256){_0x297269=_0x297269-0x0;var _0x4ba584=_0x90d0[_0x297269];return _0x4ba584;};'use strict';var multer=require(_0x090d('0x0'));var util=require(_0x090d('0x1'));var path=require(_0x090d('0x2'));var timeout=require('connect-timeout');var express=require(_0x090d('0x3'));var router=express[_0x090d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x090d('0x5'));var interaction=require(_0x090d('0x6'));var config=require(_0x090d('0x7'));var controller=require(_0x090d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x090d('0x9')]);router[_0x090d('0xa')](_0x090d('0xb'),auth[_0x090d('0xc')](),controller[_0x090d('0xd')]);router['post']('/',auth[_0x090d('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x090d('0xe')]('/:id',auth[_0x090d('0xc')](),controller[_0x090d('0xf')]);module[_0x090d('0x10')]=router; \ No newline at end of file +var _0x572f=['update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x42f91d,_0x3ff8b4){var _0x49d3fb=function(_0x2b942d){while(--_0x2b942d){_0x42f91d['push'](_0x42f91d['shift']());}};_0x49d3fb(++_0x3ff8b4);}(_0x572f,0x1c4));var _0xf572=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x572f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xf572('0x0'));var util=require(_0xf572('0x1'));var path=require(_0xf572('0x2'));var timeout=require('connect-timeout');var express=require(_0xf572('0x3'));var router=express[_0xf572('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf572('0x5'));var interaction=require(_0xf572('0x6'));var config=require(_0xf572('0x7'));var controller=require('./openchannelApplication.controller');router[_0xf572('0x8')]('/',auth[_0xf572('0x9')](),controller[_0xf572('0xa')]);router['get'](_0xf572('0xb'),auth[_0xf572('0x9')](),controller[_0xf572('0xc')]);router[_0xf572('0xd')]('/',auth[_0xf572('0x9')](),controller[_0xf572('0xe')]);router[_0xf572('0xf')](_0xf572('0xb'),auth[_0xf572('0x9')](),controller[_0xf572('0x10')]);router['delete'](_0xf572('0xb'),auth[_0xf572('0x9')](),controller[_0xf572('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index d0a3457..49c9cf2 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 _0x6fed=['*,*,*,*','exports','noop','TEXT'];(function(_0xacb1e2,_0x55e0ab){var _0x463815=function(_0x413c3b){while(--_0x413c3b){_0xacb1e2['push'](_0xacb1e2['shift']());}};_0x463815(++_0x55e0ab);}(_0x6fed,0x1ad));var _0xd6fe=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6fed[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xd6fe('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd6fe('0x1')},'appdata':{'type':Sequelize[_0xd6fe('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd6fe('0x3')}}; \ No newline at end of file +var _0x172f=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x357bad,_0x35b4f6){var _0x251196=function(_0xdf9dbe){while(--_0xdf9dbe){_0x357bad['push'](_0x357bad['shift']());}};_0x251196(++_0x35b4f6);}(_0x172f,0x1a1));var _0xf172=function(_0x446430,_0x47922f){_0x446430=_0x446430-0x0;var _0x3b47d6=_0x172f[_0x446430];return _0x3b47d6;};'use strict';var Sequelize=require(_0xf172('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf172('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf172('0x2')],'allowNull':![],'defaultValue':_0xf172('0x3')},'appdata':{'type':Sequelize[_0xf172('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf172('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f1baa0e..de3884b 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 _0x709f=['sendStatus','status','end','offset','undefined','limit','json','save','then','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','OpenchannelApplication','count','include','findAll','rows','catch','show','keys','options','create','body','update','find','params','destroy','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3bfa9b,_0x38075f){var _0x2be554=function(_0x5a2442){while(--_0x5a2442){_0x3bfa9b['push'](_0x3bfa9b['shift']());}};_0x2be554(++_0x38075f);}(_0x709f,0xb4));var _0xf709=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0x709f[_0x35387d];return _0x3aba56;};'use strict';var emlformat=require(_0xf709('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf709('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf709('0x2'));var moment=require(_0xf709('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf709('0x4'));var util=require(_0xf709('0x5'));var path=require(_0xf709('0x6'));var sox=require(_0xf709('0x7'));var csv=require(_0xf709('0x8'));var ejs=require(_0xf709('0x9'));var fs=require('fs');var fs_extra=require(_0xf709('0xa'));var _=require('lodash');var squel=require(_0xf709('0xb'));var crypto=require(_0xf709('0xc'));var jsforce=require(_0xf709('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf709('0x8'));var querystring=require(_0xf709('0xe'));var Papa=require(_0xf709('0xf'));var Redis=require(_0xf709('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf709('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf709('0x12'))(_0xf709('0x13'));var utils=require(_0xf709('0x14'));var config=require(_0xf709('0x15'));var licenseUtil=require(_0xf709('0x16'));var db=require(_0xf709('0x17'))['db'];function respondWithStatusCode(_0x212b95,_0x5b2514){_0x5b2514=_0x5b2514||0xcc;return function(_0x4f3c6b){if(_0x4f3c6b){return _0x212b95[_0xf709('0x18')](_0x5b2514);}return _0x212b95[_0xf709('0x19')](_0x5b2514)[_0xf709('0x1a')]();};}function respondWithResult(_0x4b3ada,_0x5ccfc5){_0x5ccfc5=_0x5ccfc5||0xc8;return function(_0x3671c8){if(_0x3671c8){return _0x4b3ada[_0xf709('0x19')](_0x5ccfc5)['json'](_0x3671c8);}};}function respondWithFilteredResult(_0x186e24,_0x3f589e){return function(_0x20fdfd){if(_0x20fdfd){var _0x1726d2=typeof _0x3f589e[_0xf709('0x1b')]===_0xf709('0x1c')&&typeof _0x3f589e[_0xf709('0x1d')]===_0xf709('0x1c');var _0xf0fd8f=_0x20fdfd['count'];var _0x407aee=_0x1726d2?0x0:_0x3f589e[_0xf709('0x1b')];var _0x35b132=_0x1726d2?_0x20fdfd['count']:_0x3f589e[_0xf709('0x1b')]+_0x3f589e[_0xf709('0x1d')];var _0x1b3d74;if(_0x35b132>=_0xf0fd8f){_0x35b132=_0xf0fd8f;_0x1b3d74=0xc8;}else{_0x1b3d74=0xce;}_0x186e24['status'](_0x1b3d74);return _0x186e24['set']('Content-Range',_0x407aee+'-'+_0x35b132+'/'+_0xf0fd8f)[_0xf709('0x1e')](_0x20fdfd);}return null;};}function patchUpdates(_0xd35db0){return function(_0x29fc6e){try{jsonpatch['apply'](_0x29fc6e,_0xd35db0,!![]);}catch(_0x37cd2a){return BPromise['reject'](_0x37cd2a);}return _0x29fc6e[_0xf709('0x1f')]();};}function saveUpdates(_0xfb18f6,_0xad8f35){return function(_0x1b10e4){if(_0x1b10e4){return _0x1b10e4['update'](_0xfb18f6)['then'](function(_0x2eb761){return _0x2eb761;});}return null;};}function removeEntity(_0x1ec341,_0x517a2a){return function(_0x54ba27){if(_0x54ba27){return _0x54ba27['destroy']()[_0xf709('0x20')](function(){_0x1ec341[_0xf709('0x19')](0xcc)[_0xf709('0x1a')]();});}};}function handleEntityNotFound(_0x2b0c57,_0x4c32bb){return function(_0x238870){if(!_0x238870){_0x2b0c57[_0xf709('0x18')](0x194);}return _0x238870;};}function handleError(_0x495689,_0x2eae59){_0x2eae59=_0x2eae59||0x1f4;return function(_0x3a1f4a){logger['error'](_0x3a1f4a[_0xf709('0x21')]);if(_0x3a1f4a[_0xf709('0x22')]){delete _0x3a1f4a['name'];}_0x495689['status'](_0x2eae59)['send'](_0x3a1f4a);};}exports[_0xf709('0x23')]=function(_0x3648be,_0x22148a){var _0x159ae3={},_0x30d4b4={},_0x26d834={'count':0x0,'rows':[]};var _0x3251d9=_[_0xf709('0x24')](db['OpenchannelApplication'][_0xf709('0x25')],function(_0x5b4b24){return{'name':_0x5b4b24[_0xf709('0x26')],'type':_0x5b4b24['type'][_0xf709('0x27')]};});_0x30d4b4[_0xf709('0x28')]=_[_0xf709('0x24')](_0x3251d9,'name');_0x30d4b4[_0xf709('0x29')]=_['keys'](_0x3648be['query']);_0x30d4b4[_0xf709('0x2a')]=_[_0xf709('0x2b')](_0x30d4b4[_0xf709('0x28')],_0x30d4b4['query']);_0x159ae3[_0xf709('0x2c')]=_[_0xf709('0x2b')](_0x30d4b4[_0xf709('0x28')],qs['fields'](_0x3648be[_0xf709('0x29')][_0xf709('0x2d')]));_0x159ae3[_0xf709('0x2c')]=_0x159ae3[_0xf709('0x2c')][_0xf709('0x2e')]?_0x159ae3[_0xf709('0x2c')]:_0x30d4b4[_0xf709('0x28')];if(!_0x3648be['query'][_0xf709('0x2f')]('nolimit')){_0x159ae3[_0xf709('0x1d')]=qs['limit'](_0x3648be[_0xf709('0x29')][_0xf709('0x1d')]);_0x159ae3[_0xf709('0x1b')]=qs[_0xf709('0x1b')](_0x3648be[_0xf709('0x29')][_0xf709('0x1b')]);}_0x159ae3['order']=qs[_0xf709('0x30')](_0x3648be[_0xf709('0x29')][_0xf709('0x30')]);_0x159ae3[_0xf709('0x31')]=qs['filters'](_['pick'](_0x3648be['query'],_0x30d4b4['filters']),_0x3251d9);if(_0x3648be[_0xf709('0x29')][_0xf709('0x32')]){_0x159ae3[_0xf709('0x31')]=_[_0xf709('0x33')](_0x159ae3[_0xf709('0x31')],{'$or':_[_0xf709('0x24')](_0x3251d9,function(_0x2d15b9){if(_0x2d15b9[_0xf709('0x34')]!=='VIRTUAL'){var _0x27f850={};_0x27f850[_0x2d15b9[_0xf709('0x22')]]={'$like':'%'+_0x3648be[_0xf709('0x29')]['filter']+'%'};return _0x27f850;}})});}_0x159ae3=_[_0xf709('0x33')]({},_0x159ae3,_0x3648be['options']);var _0x236749={'where':_0x159ae3['where']};return db[_0xf709('0x35')][_0xf709('0x36')](_0x236749)[_0xf709('0x20')](function(_0x4afb10){_0x26d834['count']=_0x4afb10;if(_0x3648be[_0xf709('0x29')]['includeAll']){_0x159ae3[_0xf709('0x37')]=[{'all':!![]}];}return db[_0xf709('0x35')][_0xf709('0x38')](_0x159ae3);})[_0xf709('0x20')](function(_0x14853a){_0x26d834[_0xf709('0x39')]=_0x14853a;return _0x26d834;})[_0xf709('0x20')](respondWithFilteredResult(_0x22148a,_0x159ae3))[_0xf709('0x3a')](handleError(_0x22148a,null));};exports[_0xf709('0x3b')]=function(_0x5b97e6,_0x2d1ba1){var _0x323a5a={'raw':!![],'where':{'id':_0x5b97e6['params']['id']}},_0x589e87={};_0x589e87[_0xf709('0x28')]=_[_0xf709('0x3c')](db[_0xf709('0x35')][_0xf709('0x25')]);_0x589e87[_0xf709('0x29')]=_['keys'](_0x5b97e6[_0xf709('0x29')]);_0x589e87[_0xf709('0x2a')]=_['intersection'](_0x589e87[_0xf709('0x28')],_0x589e87[_0xf709('0x29')]);_0x323a5a[_0xf709('0x2c')]=_['intersection'](_0x589e87[_0xf709('0x28')],qs[_0xf709('0x2d')](_0x5b97e6['query']['fields']));_0x323a5a[_0xf709('0x2c')]=_0x323a5a[_0xf709('0x2c')][_0xf709('0x2e')]?_0x323a5a[_0xf709('0x2c')]:_0x589e87['model'];if(_0x5b97e6[_0xf709('0x29')]['includeAll']){_0x323a5a[_0xf709('0x37')]=[{'all':!![]}];}_0x323a5a=_[_0xf709('0x33')]({},_0x323a5a,_0x5b97e6[_0xf709('0x3d')]);return db[_0xf709('0x35')]['find'](_0x323a5a)[_0xf709('0x20')](handleEntityNotFound(_0x2d1ba1,null))['then'](respondWithResult(_0x2d1ba1,null))[_0xf709('0x3a')](handleError(_0x2d1ba1,null));};exports[_0xf709('0x3e')]=function(_0x21cbca,_0x81fc1d){return db[_0xf709('0x35')][_0xf709('0x3e')](_0x21cbca[_0xf709('0x3f')],{})[_0xf709('0x20')](respondWithResult(_0x81fc1d,0xc9))[_0xf709('0x3a')](handleError(_0x81fc1d,null));};exports[_0xf709('0x40')]=function(_0x494cf7,_0x2bbf31){if(_0x494cf7[_0xf709('0x3f')]['id']){delete _0x494cf7[_0xf709('0x3f')]['id'];}return db[_0xf709('0x35')][_0xf709('0x41')]({'where':{'id':_0x494cf7[_0xf709('0x42')]['id']}})[_0xf709('0x20')](handleEntityNotFound(_0x2bbf31,null))[_0xf709('0x20')](saveUpdates(_0x494cf7[_0xf709('0x3f')],null))[_0xf709('0x20')](respondWithResult(_0x2bbf31,null))[_0xf709('0x3a')](handleError(_0x2bbf31,null));};exports[_0xf709('0x43')]=function(_0x875621,_0x3b31d8){return db['OpenchannelApplication'][_0xf709('0x41')]({'where':{'id':_0x875621[_0xf709('0x42')]['id']}})[_0xf709('0x20')](handleEntityNotFound(_0x3b31d8,null))[_0xf709('0x20')](removeEntity(_0x3b31d8,null))[_0xf709('0x3a')](handleError(_0x3b31d8,null));}; \ No newline at end of file +var _0xfef5=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','OpenchannelApplication','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x5e81d4,_0x3a8a2d){var _0xd1047b=function(_0x351903){while(--_0x351903){_0x5e81d4['push'](_0x5e81d4['shift']());}};_0xd1047b(++_0x3a8a2d);}(_0xfef5,0x1b5));var _0x5fef=function(_0x17cda5,_0x429359){_0x17cda5=_0x17cda5-0x0;var _0x572440=_0xfef5[_0x17cda5];return _0x572440;};'use strict';var emlformat=require(_0x5fef('0x0'));var rimraf=require(_0x5fef('0x1'));var zipdir=require(_0x5fef('0x2'));var jsonpatch=require(_0x5fef('0x3'));var rp=require(_0x5fef('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fef('0x5'));var util=require(_0x5fef('0x6'));var path=require(_0x5fef('0x7'));var sox=require('sox');var csv=require(_0x5fef('0x8'));var ejs=require(_0x5fef('0x9'));var fs=require('fs');var fs_extra=require(_0x5fef('0xa'));var _=require('lodash');var squel=require(_0x5fef('0xb'));var crypto=require(_0x5fef('0xc'));var jsforce=require(_0x5fef('0xd'));var deskjs=require(_0x5fef('0xe'));var toCsv=require(_0x5fef('0x8'));var querystring=require(_0x5fef('0xf'));var Papa=require(_0x5fef('0x10'));var Redis=require(_0x5fef('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5fef('0x12'));var as=require(_0x5fef('0x13'));var hardwareService=require(_0x5fef('0x14'));var logger=require(_0x5fef('0x15'))(_0x5fef('0x16'));var utils=require(_0x5fef('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5fef('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ca42e,_0x500fa9){_0x500fa9=_0x500fa9||0xcc;return function(_0x394e28){if(_0x394e28){return _0x3ca42e[_0x5fef('0x19')](_0x500fa9);}return _0x3ca42e['status'](_0x500fa9)['end']();};}function respondWithResult(_0x577900,_0x5e5d10){_0x5e5d10=_0x5e5d10||0xc8;return function(_0x2079d5){if(_0x2079d5){return _0x577900[_0x5fef('0x1a')](_0x5e5d10)['json'](_0x2079d5);}};}function respondWithFilteredResult(_0xa3a4d7,_0x43e9f8){return function(_0x299de3){if(_0x299de3){var _0x54d5f6=typeof _0x43e9f8[_0x5fef('0x1b')]===_0x5fef('0x1c')&&typeof _0x43e9f8[_0x5fef('0x1d')]===_0x5fef('0x1c');var _0x42b713=_0x299de3[_0x5fef('0x1e')];var _0xecbdcf=_0x54d5f6?0x0:_0x43e9f8[_0x5fef('0x1b')];var _0x42a974=_0x54d5f6?_0x299de3[_0x5fef('0x1e')]:_0x43e9f8[_0x5fef('0x1b')]+_0x43e9f8[_0x5fef('0x1d')];var _0x11bc81;if(_0x42a974>=_0x42b713){_0x42a974=_0x42b713;_0x11bc81=0xc8;}else{_0x11bc81=0xce;}_0xa3a4d7[_0x5fef('0x1a')](_0x11bc81);return _0xa3a4d7[_0x5fef('0x1f')](_0x5fef('0x20'),_0xecbdcf+'-'+_0x42a974+'/'+_0x42b713)[_0x5fef('0x21')](_0x299de3);}return null;};}function patchUpdates(_0x596056){return function(_0xedcd00){try{jsonpatch[_0x5fef('0x22')](_0xedcd00,_0x596056,!![]);}catch(_0xbf81f8){return BPromise[_0x5fef('0x23')](_0xbf81f8);}return _0xedcd00[_0x5fef('0x24')]();};}function saveUpdates(_0x45b7db,_0x563b86){return function(_0x4ab065){if(_0x4ab065){return _0x4ab065[_0x5fef('0x25')](_0x45b7db)[_0x5fef('0x26')](function(_0x13c079){return _0x13c079;});}return null;};}function removeEntity(_0x3f08b4,_0x411d0e){return function(_0x642eaa){if(_0x642eaa){return _0x642eaa['destroy']()['then'](function(){_0x3f08b4[_0x5fef('0x1a')](0xcc)[_0x5fef('0x27')]();});}};}function handleEntityNotFound(_0x57114e,_0x299c01){return function(_0xd6eeb1){if(!_0xd6eeb1){_0x57114e['sendStatus'](0x194);}return _0xd6eeb1;};}function handleError(_0x10fd54,_0x2e3d10){_0x2e3d10=_0x2e3d10||0x1f4;return function(_0x13763e){logger[_0x5fef('0x28')](_0x13763e[_0x5fef('0x29')]);if(_0x13763e[_0x5fef('0x2a')]){delete _0x13763e[_0x5fef('0x2a')];}_0x10fd54[_0x5fef('0x1a')](_0x2e3d10)[_0x5fef('0x2b')](_0x13763e);};}exports[_0x5fef('0x2c')]=function(_0x11813a,_0x717ee){var _0x20a179={},_0x5227f6={},_0x2111a9={'count':0x0,'rows':[]};var _0x24d58d=_[_0x5fef('0x2d')](db['OpenchannelApplication'][_0x5fef('0x2e')],function(_0x3878e5){return{'name':_0x3878e5[_0x5fef('0x2f')],'type':_0x3878e5[_0x5fef('0x30')][_0x5fef('0x31')]};});_0x5227f6[_0x5fef('0x32')]=_['map'](_0x24d58d,_0x5fef('0x2a'));_0x5227f6[_0x5fef('0x33')]=_[_0x5fef('0x34')](_0x11813a[_0x5fef('0x33')]);_0x5227f6[_0x5fef('0x35')]=_['intersection'](_0x5227f6[_0x5fef('0x32')],_0x5227f6[_0x5fef('0x33')]);_0x20a179['attributes']=_[_0x5fef('0x36')](_0x5227f6[_0x5fef('0x32')],qs[_0x5fef('0x37')](_0x11813a[_0x5fef('0x33')][_0x5fef('0x37')]));_0x20a179[_0x5fef('0x38')]=_0x20a179['attributes'][_0x5fef('0x39')]?_0x20a179[_0x5fef('0x38')]:_0x5227f6[_0x5fef('0x32')];if(!_0x11813a[_0x5fef('0x33')][_0x5fef('0x3a')](_0x5fef('0x3b'))){_0x20a179[_0x5fef('0x1d')]=qs[_0x5fef('0x1d')](_0x11813a[_0x5fef('0x33')][_0x5fef('0x1d')]);_0x20a179[_0x5fef('0x1b')]=qs[_0x5fef('0x1b')](_0x11813a[_0x5fef('0x33')][_0x5fef('0x1b')]);}_0x20a179['order']=qs[_0x5fef('0x3c')](_0x11813a[_0x5fef('0x33')][_0x5fef('0x3c')]);_0x20a179[_0x5fef('0x3d')]=qs[_0x5fef('0x35')](_[_0x5fef('0x3e')](_0x11813a[_0x5fef('0x33')],_0x5227f6[_0x5fef('0x35')]),_0x24d58d);if(_0x11813a['query'][_0x5fef('0x3f')]){_0x20a179[_0x5fef('0x3d')]=_['merge'](_0x20a179[_0x5fef('0x3d')],{'$or':_['map'](_0x24d58d,function(_0x485a64){if(_0x485a64[_0x5fef('0x30')]!=='VIRTUAL'){var _0xa54e97={};_0xa54e97[_0x485a64[_0x5fef('0x2a')]]={'$like':'%'+_0x11813a['query'][_0x5fef('0x3f')]+'%'};return _0xa54e97;}})});}_0x20a179=_[_0x5fef('0x40')]({},_0x20a179,_0x11813a['options']);var _0x404a31={'where':_0x20a179[_0x5fef('0x3d')]};return db['OpenchannelApplication']['count'](_0x404a31)[_0x5fef('0x26')](function(_0x123f06){_0x2111a9[_0x5fef('0x1e')]=_0x123f06;if(_0x11813a[_0x5fef('0x33')]['includeAll']){_0x20a179[_0x5fef('0x41')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5fef('0x42')](_0x20a179);})[_0x5fef('0x26')](function(_0x3f1049){_0x2111a9[_0x5fef('0x43')]=_0x3f1049;return _0x2111a9;})[_0x5fef('0x26')](respondWithFilteredResult(_0x717ee,_0x20a179))[_0x5fef('0x44')](handleError(_0x717ee,null));};exports[_0x5fef('0x45')]=function(_0x247825,_0x547b11){var _0x2c139f={'raw':!![],'where':{'id':_0x247825[_0x5fef('0x46')]['id']}},_0x105e74={};_0x105e74[_0x5fef('0x32')]=_[_0x5fef('0x34')](db[_0x5fef('0x47')][_0x5fef('0x2e')]);_0x105e74[_0x5fef('0x33')]=_[_0x5fef('0x34')](_0x247825[_0x5fef('0x33')]);_0x105e74['filters']=_[_0x5fef('0x36')](_0x105e74[_0x5fef('0x32')],_0x105e74['query']);_0x2c139f[_0x5fef('0x38')]=_[_0x5fef('0x36')](_0x105e74[_0x5fef('0x32')],qs[_0x5fef('0x37')](_0x247825[_0x5fef('0x33')][_0x5fef('0x37')]));_0x2c139f['attributes']=_0x2c139f['attributes'][_0x5fef('0x39')]?_0x2c139f[_0x5fef('0x38')]:_0x105e74[_0x5fef('0x32')];if(_0x247825['query'][_0x5fef('0x48')]){_0x2c139f[_0x5fef('0x41')]=[{'all':!![]}];}_0x2c139f=_['merge']({},_0x2c139f,_0x247825['options']);return db[_0x5fef('0x47')]['find'](_0x2c139f)[_0x5fef('0x26')](handleEntityNotFound(_0x547b11,null))['then'](respondWithResult(_0x547b11,null))[_0x5fef('0x44')](handleError(_0x547b11,null));};exports[_0x5fef('0x49')]=function(_0x5b63dd,_0x1a74f2){return db[_0x5fef('0x47')][_0x5fef('0x49')](_0x5b63dd['body'],{})[_0x5fef('0x26')](respondWithResult(_0x1a74f2,0xc9))[_0x5fef('0x44')](handleError(_0x1a74f2,null));};exports[_0x5fef('0x25')]=function(_0x3847e5,_0x323db){if(_0x3847e5[_0x5fef('0x4a')]['id']){delete _0x3847e5[_0x5fef('0x4a')]['id'];}return db[_0x5fef('0x47')][_0x5fef('0x4b')]({'where':{'id':_0x3847e5[_0x5fef('0x46')]['id']}})['then'](handleEntityNotFound(_0x323db,null))['then'](saveUpdates(_0x3847e5[_0x5fef('0x4a')],null))[_0x5fef('0x26')](respondWithResult(_0x323db,null))['catch'](handleError(_0x323db,null));};exports['destroy']=function(_0x1b5a2d,_0x1bb981){return db[_0x5fef('0x47')]['find']({'where':{'id':_0x1b5a2d[_0x5fef('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bb981,null))['then'](removeEntity(_0x1bb981,null))['catch'](handleError(_0x1bb981,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 46042d0..8a2fda3 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 _0xb00f=['../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3b4967,_0x267d42){var _0x47fc11=function(_0x5b6c4b){while(--_0x5b6c4b){_0x3b4967['push'](_0x3b4967['shift']());}};_0x47fc11(++_0x267d42);}(_0xb00f,0x151));var _0xfb00=function(_0x2eac58,_0x4d49e1){_0x2eac58=_0x2eac58-0x0;var _0x1fd1fe=_0xb00f[_0x2eac58];return _0x1fd1fe;};'use strict';var _=require(_0xfb00('0x0'));var util=require(_0xfb00('0x1'));var logger=require(_0xfb00('0x2'))(_0xfb00('0x3'));var moment=require(_0xfb00('0x4'));var BPromise=require(_0xfb00('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb00('0x6'));var rimraf=require(_0xfb00('0x7'));var config=require(_0xfb00('0x8'));var attributes=require(_0xfb00('0x9'));module['exports']=function(_0x880745,_0x1df91f){return _0x880745[_0xfb00('0xa')](_0xfb00('0xb'),attributes,{'tableName':_0xfb00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb00('0xd'),'collate':_0xfb00('0xe')});}; \ No newline at end of file +var _0xfa52=['lodash','util','api','moment','request-promise','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x45380c,_0xc10e5d){var _0x26fccb=function(_0xef8e45){while(--_0xef8e45){_0x45380c['push'](_0x45380c['shift']());}};_0x26fccb(++_0xc10e5d);}(_0xfa52,0x6e));var _0x2fa5=function(_0x2cef68,_0x11eec8){_0x2cef68=_0x2cef68-0x0;var _0x4b427f=_0xfa52[_0x2cef68];return _0x4b427f;};'use strict';var _=require(_0x2fa5('0x0'));var util=require(_0x2fa5('0x1'));var logger=require('../../config/logger')(_0x2fa5('0x2'));var moment=require(_0x2fa5('0x3'));var BPromise=require('bluebird');var rp=require(_0x2fa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fa5('0x5'));var config=require('../../config/environment');var attributes=require(_0x2fa5('0x6'));module['exports']=function(_0x386f96,_0x4b7036){return _0x386f96[_0x2fa5('0x7')](_0x2fa5('0x8'),attributes,{'tableName':_0x2fa5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2fa5('0xa'),'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 3200fff..ffc047f 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 _0x057b=['rpc','../../config/environment','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','attributes','limit','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3411b4,_0x360a78){var _0x29b2d3=function(_0x17e4f1){while(--_0x17e4f1){_0x3411b4['push'](_0x3411b4['shift']());}};_0x29b2d3(++_0x360a78);}(_0x057b,0x11c));var _0xb057=function(_0x4da99a,_0x11269f){_0x4da99a=_0x4da99a-0x0;var _0xa67bb3=_0x057b[_0x4da99a];return _0xa67bb3;};'use strict';var _=require('lodash');var util=require(_0xb057('0x0'));var moment=require('moment');var BPromise=require(_0xb057('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb057('0x2'));var db=require(_0xb057('0x3'))['db'];var utils=require(_0xb057('0x4'));var logger=require(_0xb057('0x5'))(_0xb057('0x6'));var config=require(_0xb057('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb057('0x8')][_0xb057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcd03,_0xac9583,_0x2cdb03){return new BPromise(function(_0x22dd93,_0x49b8af){return client[_0xb057('0xa')](_0x3bcd03,_0x2cdb03)[_0xb057('0xb')](function(_0xe7d794){logger[_0xb057('0xc')](_0xb057('0xd'),_0xac9583,'request\x20sent');logger[_0xb057('0xe')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xac9583,_0xb057('0xf'),JSON[_0xb057('0x10')](_0xe7d794));if(_0xe7d794[_0xb057('0x11')]){if(_0xe7d794[_0xb057('0x11')][_0xb057('0x12')]===0x1f4){logger[_0xb057('0x11')](_0xb057('0xd'),_0xac9583,_0xe7d794['error'][_0xb057('0x13')]);return _0x49b8af(_0xe7d794[_0xb057('0x11')][_0xb057('0x13')]);}logger[_0xb057('0x11')](_0xb057('0xd'),_0xac9583,_0xe7d794[_0xb057('0x11')][_0xb057('0x13')]);return _0x22dd93(_0xe7d794[_0xb057('0x11')][_0xb057('0x13')]);}else{logger['info'](_0xb057('0xd'),_0xac9583,_0xb057('0xf'));_0x22dd93(_0xe7d794[_0xb057('0x14')][_0xb057('0x13')]);}})['catch'](function(_0xe5e97){logger[_0xb057('0x11')](_0xb057('0xd'),_0xac9583,_0xe5e97);_0x49b8af(_0xe5e97);});});}exports[_0xb057('0x15')]=function(_0xedef1){var _0x2463f6=this;return new Promise(function(_0x40cc14,_0x279a5b){return db[_0xb057('0x16')]['update'](_0xedef1['body'],{'raw':_0xedef1[_0xb057('0x17')]?_0xedef1[_0xb057('0x17')][_0xb057('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedef1[_0xb057('0x17')]?_0xedef1[_0xb057('0x17')][_0xb057('0x19')]||null:null,'attributes':_0xedef1[_0xb057('0x17')]?_0xedef1[_0xb057('0x17')][_0xb057('0x1a')]||null:null,'limit':_0xedef1[_0xb057('0x17')]?_0xedef1[_0xb057('0x17')][_0xb057('0x1b')]||null:null})[_0xb057('0xb')](function(_0x24997c){logger[_0xb057('0xc')](_0xb057('0x15'),_0xedef1);logger[_0xb057('0xe')](_0xb057('0x15'),_0xedef1,JSON[_0xb057('0x10')](_0x24997c));_0x40cc14(_0x24997c);})[_0xb057('0x1c')](function(_0x631f16){logger[_0xb057('0x11')](_0xb057('0x15'),_0x631f16[_0xb057('0x13')],_0xedef1);_0x279a5b(_0x2463f6[_0xb057('0x11')](0x1f4,_0x631f16['message']));});});}; \ No newline at end of file +var _0xabdf=['code','message','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','then','UpdateOpenchannelApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3445e8,_0x54c1fd){var _0xec9046=function(_0x26537d){while(--_0x26537d){_0x3445e8['push'](_0x3445e8['shift']());}};_0xec9046(++_0x54c1fd);}(_0xabdf,0x13f));var _0xfabd=function(_0x5b8a92,_0x1e6117){_0x5b8a92=_0x5b8a92-0x0;var _0x97ad43=_0xabdf[_0x5b8a92];return _0x97ad43;};'use strict';var _=require(_0xfabd('0x0'));var util=require(_0xfabd('0x1'));var moment=require(_0xfabd('0x2'));var BPromise=require(_0xfabd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfabd('0x4'));var db=require(_0xfabd('0x5'))['db'];var utils=require(_0xfabd('0x6'));var logger=require(_0xfabd('0x7'))(_0xfabd('0x8'));var config=require(_0xfabd('0x9'));var jayson=require(_0xfabd('0xa'));var client=jayson[_0xfabd('0xb')][_0xfabd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ff366,_0x33d5a9,_0x1cd23c){return new BPromise(function(_0x33309f,_0x2d0ef8){return client[_0xfabd('0xd')](_0x1ff366,_0x1cd23c)['then'](function(_0x2f73a9){logger[_0xfabd('0xe')](_0xfabd('0xf'),_0x33d5a9,_0xfabd('0x10'));logger[_0xfabd('0x11')](_0xfabd('0x12'),_0x33d5a9,_0xfabd('0x10'),JSON[_0xfabd('0x13')](_0x2f73a9));if(_0x2f73a9[_0xfabd('0x14')]){if(_0x2f73a9[_0xfabd('0x14')][_0xfabd('0x15')]===0x1f4){logger[_0xfabd('0x14')](_0xfabd('0xf'),_0x33d5a9,_0x2f73a9[_0xfabd('0x14')]['message']);return _0x2d0ef8(_0x2f73a9['error'][_0xfabd('0x16')]);}logger[_0xfabd('0x14')](_0xfabd('0xf'),_0x33d5a9,_0x2f73a9[_0xfabd('0x14')]['message']);return _0x33309f(_0x2f73a9['error'][_0xfabd('0x16')]);}else{logger[_0xfabd('0xe')](_0xfabd('0xf'),_0x33d5a9,_0xfabd('0x10'));_0x33309f(_0x2f73a9[_0xfabd('0x17')][_0xfabd('0x16')]);}})[_0xfabd('0x18')](function(_0x2b4e69){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x33d5a9,_0x2b4e69);_0x2d0ef8(_0x2b4e69);});});}exports['UpdateOpenchannelApplication']=function(_0x140a46){var _0x273232=this;return new Promise(function(_0x42a467,_0x4b6b21){return db[_0xfabd('0x19')][_0xfabd('0x1a')](_0x140a46[_0xfabd('0x1b')],{'raw':_0x140a46[_0xfabd('0x1c')]?_0x140a46[_0xfabd('0x1c')][_0xfabd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x140a46[_0xfabd('0x1c')]?_0x140a46[_0xfabd('0x1c')][_0xfabd('0x1e')]||null:null,'attributes':_0x140a46[_0xfabd('0x1c')]?_0x140a46[_0xfabd('0x1c')][_0xfabd('0x1f')]||null:null,'limit':_0x140a46[_0xfabd('0x1c')]?_0x140a46[_0xfabd('0x1c')]['limit']||null:null})[_0xfabd('0x20')](function(_0x105d2c){logger[_0xfabd('0xe')](_0xfabd('0x21'),_0x140a46);logger[_0xfabd('0x11')](_0xfabd('0x21'),_0x140a46,JSON[_0xfabd('0x13')](_0x105d2c));_0x42a467(_0x105d2c);})['catch'](function(_0x34ead8){logger[_0xfabd('0x14')](_0xfabd('0x21'),_0x34ead8['message'],_0x140a46);_0x4b6b21(_0x273232[_0xfabd('0x14')](0x1f4,_0x34ead8[_0xfabd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 4e013c4..66d4e1a 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 _0x9bc2=['/:id/tags','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage'];(function(_0x164c47,_0x5debd9){var _0x288bd7=function(_0x290c40){while(--_0x290c40){_0x164c47['push'](_0x164c47['shift']());}};_0x288bd7(++_0x5debd9);}(_0x9bc2,0x121));var _0x29bc=function(_0x584970,_0x252e31){_0x584970=_0x584970-0x0;var _0x2b70d3=_0x9bc2[_0x584970];return _0x2b70d3;};'use strict';var multer=require(_0x29bc('0x0'));var util=require(_0x29bc('0x1'));var path=require(_0x29bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x29bc('0x3'));var router=express[_0x29bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29bc('0x5'));var config=require(_0x29bc('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x29bc('0x7')]('/',auth[_0x29bc('0x8')](),controller[_0x29bc('0x9')]);router[_0x29bc('0x7')](_0x29bc('0xa'),auth[_0x29bc('0x8')](),controller[_0x29bc('0xb')]);router[_0x29bc('0x7')](_0x29bc('0xc'),auth['isAuthenticated'](),controller[_0x29bc('0xd')]);router[_0x29bc('0x7')](_0x29bc('0xe'),auth[_0x29bc('0x8')](),controller[_0x29bc('0xf')]);router[_0x29bc('0x7')]('/:id/download',auth[_0x29bc('0x8')](),controller['download']);router[_0x29bc('0x10')]('/',auth['isAuthenticated'](),controller[_0x29bc('0x11')]);router[_0x29bc('0x10')](_0x29bc('0xe'),auth[_0x29bc('0x8')](),controller[_0x29bc('0x12')]);router[_0x29bc('0x10')](_0x29bc('0x13'),auth[_0x29bc('0x8')](),interaction[_0x29bc('0x14')]('openchannel',_0x29bc('0x15')),controller['addTags']);router[_0x29bc('0x16')](_0x29bc('0xc'),auth[_0x29bc('0x8')](),interaction['tracked']('openchannel',_0x29bc('0x17')),controller[_0x29bc('0x18')]);router[_0x29bc('0x19')]('/:id',auth[_0x29bc('0x8')](),interaction[_0x29bc('0x14')]('openchannel',_0x29bc('0x1a')),controller['destroy']);router[_0x29bc('0x19')](_0x29bc('0x13'),auth[_0x29bc('0x8')](),controller[_0x29bc('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xe8ed=['connect-timeout','express','fs-extra','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','describe','/:id','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','update','delete','removeTags','exports','multer','util','path'];(function(_0x271b20,_0x43e134){var _0x476e32=function(_0x2dfa9b){while(--_0x2dfa9b){_0x271b20['push'](_0x271b20['shift']());}};_0x476e32(++_0x43e134);}(_0xe8ed,0x192));var _0xde8e=function(_0x294df7,_0x383acd){_0x294df7=_0x294df7-0x0;var _0x52baa8=_0xe8ed[_0x294df7];return _0x52baa8;};'use strict';var multer=require(_0xde8e('0x0'));var util=require(_0xde8e('0x1'));var path=require(_0xde8e('0x2'));var timeout=require(_0xde8e('0x3'));var express=require(_0xde8e('0x4'));var router=express['Router']();var fs_extra=require(_0xde8e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xde8e('0x6'));var controller=require(_0xde8e('0x7'));router[_0xde8e('0x8')]('/',auth[_0xde8e('0x9')](),controller[_0xde8e('0xa')]);router[_0xde8e('0x8')]('/describe',auth[_0xde8e('0x9')](),controller[_0xde8e('0xb')]);router[_0xde8e('0x8')](_0xde8e('0xc'),auth[_0xde8e('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xde8e('0xd')]);router[_0xde8e('0x8')]('/:id/download',auth[_0xde8e('0x9')](),controller[_0xde8e('0xe')]);router['post']('/',auth[_0xde8e('0x9')](),controller['create']);router[_0xde8e('0xf')](_0xde8e('0x10'),auth[_0xde8e('0x9')](),controller[_0xde8e('0x11')]);router[_0xde8e('0xf')](_0xde8e('0x12'),auth[_0xde8e('0x9')](),interaction[_0xde8e('0x13')](_0xde8e('0x14'),_0xde8e('0x15')),controller[_0xde8e('0x16')]);router['put'](_0xde8e('0xc'),auth[_0xde8e('0x9')](),interaction['tracked'](_0xde8e('0x14'),'openchannelinteraction:update'),controller[_0xde8e('0x17')]);router[_0xde8e('0x18')](_0xde8e('0xc'),auth['isAuthenticated'](),interaction[_0xde8e('0x13')]('openchannel','openchannelinteraction:destroy'),controller['destroy']);router[_0xde8e('0x18')](_0xde8e('0x12'),auth[_0xde8e('0x9')](),controller[_0xde8e('0x19')]);module[_0xde8e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ab7a4eb..2338d7f 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 _0x56e6=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x19f3eb,_0x860c71){var _0x54be4e=function(_0x47b3b6){while(--_0x47b3b6){_0x19f3eb['push'](_0x19f3eb['shift']());}};_0x54be4e(++_0x860c71);}(_0x56e6,0x6b));var _0x656e=function(_0x1aab9d,_0x503b9e){_0x1aab9d=_0x1aab9d-0x0;var _0x3840b2=_0x56e6[_0x1aab9d];return _0x3840b2;};'use strict';var Sequelize=require(_0x656e('0x0'));module[_0x656e('0x1')]={'closed':{'type':Sequelize[_0x656e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x656e('0x3')]},'disposition':{'type':Sequelize[_0x656e('0x4')]},'secondDisposition':{'type':Sequelize[_0x656e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x656e('0x4')]},'read1stAt':{'type':Sequelize[_0x656e('0x3')]},'threadId':{'type':Sequelize[_0x656e('0x4')]},'externalUrl':{'type':Sequelize[_0x656e('0x4')]},'lastMsgAt':{'type':Sequelize[_0x656e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x656e('0x5')]('in',_0x656e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x656e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x656e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x656e('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa5ca=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x46306f,_0x5aef14){var _0x16a27f=function(_0x5526fd){while(--_0x5526fd){_0x46306f['push'](_0x46306f['shift']());}};_0x16a27f(++_0x5aef14);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xa5ca[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]={'closed':{'type':Sequelize[_0xaa5c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa5c('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa5c('0x3')]},'note':{'type':Sequelize[_0xaa5c('0x3')]},'read1stAt':{'type':Sequelize[_0xaa5c('0x4')]},'threadId':{'type':Sequelize[_0xaa5c('0x3')]},'externalUrl':{'type':Sequelize[_0xaa5c('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xaa5c('0x5')]('in',_0xaa5c('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xaa5c('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ace23cd..f4c2ce4 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 _0x26ff=['OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','start','text','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','having','`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?','i.from\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','role','toString','sequelize','merge','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','push','all','rows','catch','show','params','includeAll','include','options','create','update','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','pick','OpenchannelInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','color','openchannelInteractionTags:save','removeTags','download','unix','server','files','tmp','join','root','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','closedAt','disposition','threadId','Public','basename','pipe','createWriteStream','createdAt','out','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','ejs','lodash','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','error','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','unmanaged','total','closed','UserId','waiting','talking','index','map'];(function(_0x8afd9d,_0x50ca14){var _0x171472=function(_0x3b900a){while(--_0x3b900a){_0x8afd9d['push'](_0x8afd9d['shift']());}};_0x171472(++_0x50ca14);}(_0x26ff,0x19a));var _0xf26f=function(_0x1acec8,_0x2e2d6){_0x1acec8=_0x1acec8-0x0;var _0x11fb6c=_0x26ff[_0x1acec8];return _0x11fb6c;};'use strict';var rimraf=require(_0xf26f('0x0'));var zipdir=require(_0xf26f('0x1'));var moment=require(_0xf26f('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xf26f('0x3'));var fs=require('fs');var _=require(_0xf26f('0x4'));var squel=require('squel');var Redis=require(_0xf26f('0x5'));var qs=require('../../components/parsers/qs');var as=require(_0xf26f('0x6'));var pdf=require(_0xf26f('0x7'));var logger=require(_0xf26f('0x8'))(_0xf26f('0x9'));var config=require(_0xf26f('0xa'));var db=require('../../mysqldb')['db'];config[_0xf26f('0xb')]=_[_0xf26f('0xc')](config[_0xf26f('0xb')],{'host':_0xf26f('0xd'),'port':0x18eb});var socket=require(_0xf26f('0xe'))(new Redis(config[_0xf26f('0xb')]));require('./openchannelInteraction.socket')[_0xf26f('0xf')](socket);function respondWithStatusCode(_0xc0afa,_0x1fce84){_0x1fce84=_0x1fce84||0xcc;return function(_0x4f92ba){if(_0x4f92ba){return _0xc0afa[_0xf26f('0x10')](_0x1fce84);}return _0xc0afa[_0xf26f('0x11')](_0x1fce84)[_0xf26f('0x12')]();};}function respondWithResult(_0x12a45c,_0x3dd30b){_0x3dd30b=_0x3dd30b||0xc8;return function(_0x2d8a97){if(_0x2d8a97){return _0x12a45c['status'](_0x3dd30b)[_0xf26f('0x13')](_0x2d8a97);}};}function respondWithFilteredResult(_0x4578c0,_0x51cfeb){return function(_0x2c8c5a){if(_0x2c8c5a){var _0x3cb331=typeof _0x51cfeb[_0xf26f('0x14')]==='undefined'&&typeof _0x51cfeb[_0xf26f('0x15')]===_0xf26f('0x16');var _0x20580e=_0x2c8c5a[_0xf26f('0x17')];var _0x59b79e=_0x3cb331?0x0:_0x51cfeb['offset'];var _0x3ad26a=_0x3cb331?_0x2c8c5a[_0xf26f('0x17')]:_0x51cfeb['offset']+_0x51cfeb[_0xf26f('0x15')];var _0x3b1444;if(_0x3ad26a>=_0x20580e){_0x3ad26a=_0x20580e;_0x3b1444=0xc8;}else{_0x3b1444=0xce;}_0x4578c0[_0xf26f('0x11')](_0x3b1444);return _0x4578c0[_0xf26f('0x18')](_0xf26f('0x19'),_0x59b79e+'-'+_0x3ad26a+'/'+_0x20580e)[_0xf26f('0x13')](_0x2c8c5a);}return null;};}function saveUpdates(_0x557e28){return function(_0x359c97){if(_0x359c97){return _0x359c97['update'](_0x557e28)['then'](function(_0x1acf8c){return _0x1acf8c;});}return null;};}function removeEntity(_0x18d909){return function(_0x2bd4a7){if(_0x2bd4a7){return _0x2bd4a7[_0xf26f('0x1a')]()[_0xf26f('0x1b')](function(){_0x18d909[_0xf26f('0x11')](0xcc)[_0xf26f('0x12')]();});}};}function handleEntityNotFound(_0x1e8026){return function(_0x3a4c21){if(!_0x3a4c21){_0x1e8026['sendStatus'](0x194);}return _0x3a4c21;};}function handleError(_0x4642f0,_0x9f026c){_0x9f026c=_0x9f026c||0x1f4;return function(_0x54ee73){logger[_0xf26f('0x1c')](_0x54ee73[_0xf26f('0x1d')]);if(_0x54ee73[_0xf26f('0x1e')]){delete _0x54ee73[_0xf26f('0x1e')];}_0x4642f0[_0xf26f('0x11')](_0x9f026c)[_0xf26f('0x1f')](_0x54ee73);};}function getInteractionUsers(_0x51f686,_0x91a7a2){return new Promise(function(_0x22acc9,_0x1cc1f4){try{if(_0x91a7a2[_0x51f686['id']]){_0x51f686[_0xf26f('0x20')]=_['map'](_0x91a7a2[_0x51f686['id']],function(_0x4cf88b){return{'id':_0x4cf88b['id'],'fullname':_0x4cf88b[_0xf26f('0x21')]};});}}catch(_0x334180){_0x1cc1f4(_0x334180);}_0x22acc9(_0x51f686);});}function getInteractionTags(_0x2d691b,_0x250816){return new Promise(function(_0x5d3929,_0x52a9bf){try{if(_0x2d691b[_0xf26f('0x22')]){_0x2d691b['Tags']=[];_0x2d691b['TagIds'][_0xf26f('0x23')](',')[_0xf26f('0x24')](function(_0x4a472b){_0x2d691b[_0xf26f('0x25')]['push'](_0x250816[_0x4a472b]);});}delete _0x2d691b[_0xf26f('0x22')];}catch(_0x5245e6){_0x52a9bf(_0x5245e6);}_0x5d3929(_0x2d691b);});}function updateOpenchannelInteraction(_0x7cd07a,_0x2d90ce,_0x23e27f){return new Promise(function(_0x365856,_0x5ddf31){return getInteractionUsers(_0x7cd07a,_0x23e27f)[_0xf26f('0x1b')](function(_0x2df41a){return getInteractionTags(_0x2df41a,_0x2d90ce);})[_0xf26f('0x1b')](function(_0x37fddd){return getStateInteraction(_0x37fddd);})[_0xf26f('0x1b')](function(_0x56db11){_0x365856(_0x56db11);})['catch'](function(_0x237c03){_0x5ddf31(_0x237c03);});});}function getStateInteraction(_0x110f11){return new Promise(function(_0x273ece){_0x110f11['waiting']=0x0;_0x110f11['talking']=0x0;_0x110f11['answered']=0x0;_0x110f11[_0xf26f('0x26')]=0x0;_0x110f11[_0xf26f('0x27')]=0x0;if(!_0x110f11[_0xf26f('0x28')]&&!_0x110f11[_0xf26f('0x29')]){_0x110f11[_0xf26f('0x2a')]+=0x1;}if(!_0x110f11[_0xf26f('0x28')]&&_0x110f11['UserId']){_0x110f11['talking']+=0x1;if(_0x110f11['waiting']){_0x110f11[_0xf26f('0x2a')]-=0x1;}}if(_0x110f11[_0xf26f('0x28')]&&_0x110f11[_0xf26f('0x29')]){_0x110f11['answered']+=0x1;if(_0x110f11['talking']){_0x110f11[_0xf26f('0x2b')]-=0x1;}}if(_0x110f11[_0xf26f('0x28')]&&!_0x110f11[_0xf26f('0x29')]){_0x110f11['unmanaged']+=0x1;if(_0x110f11[_0xf26f('0x2a')]){_0x110f11['waiting']-=0x1;}}_0x110f11[_0xf26f('0x27')]+=0x1;_0x273ece(_0x110f11);});}exports[_0xf26f('0x2c')]=function(_0x1d3474,_0x5eeab6){var _0x58ee03={},_0x4f70c9={},_0x21f3ee={'count':0x0,'rows':[]};var _0x5eadda=_[_0xf26f('0x2d')](db[_0xf26f('0x2e')][_0xf26f('0x2f')],function(_0x1f446f){return{'name':_0x1f446f[_0xf26f('0x30')],'type':_0x1f446f[_0xf26f('0x31')][_0xf26f('0x32')]};});_0x4f70c9[_0xf26f('0x33')]=_['map'](_0x5eadda,_0xf26f('0x1e'));_0x4f70c9[_0xf26f('0x34')]=_[_0xf26f('0x35')](_0x1d3474[_0xf26f('0x34')]);_0x4f70c9['filters']=_[_0xf26f('0x36')](_0x4f70c9[_0xf26f('0x33')],_0x4f70c9[_0xf26f('0x34')]);_0x58ee03[_0xf26f('0x37')]=_[_0xf26f('0x36')](_0x4f70c9[_0xf26f('0x33')],qs[_0xf26f('0x38')](_0x1d3474[_0xf26f('0x34')][_0xf26f('0x38')]));_0x58ee03['attributes']=_0x58ee03[_0xf26f('0x37')][_0xf26f('0x39')]?_0x58ee03[_0xf26f('0x37')]:_0x4f70c9[_0xf26f('0x33')];if(!_0x1d3474[_0xf26f('0x34')][_0xf26f('0x3a')](_0xf26f('0x3b'))){_0x58ee03[_0xf26f('0x15')]=qs[_0xf26f('0x15')](_0x1d3474[_0xf26f('0x34')][_0xf26f('0x15')]);_0x58ee03[_0xf26f('0x14')]=qs[_0xf26f('0x14')](_0x1d3474[_0xf26f('0x34')][_0xf26f('0x14')]);}_0x58ee03[_0xf26f('0x3c')]=qs[_0xf26f('0x3d')](_0x1d3474[_0xf26f('0x34')]['sort']);_0x58ee03[_0xf26f('0x3e')]=qs[_0xf26f('0x3f')](_['pick'](_0x1d3474['query'],_0x4f70c9[_0xf26f('0x3f')]),_0x5eadda);var _0xb04144=[];var _0xd87e5=squel[_0xf26f('0x40')]()[_0xf26f('0x41')]('id')[_0xf26f('0x41')]('name')[_0xf26f('0x41')]('color')[_0xf26f('0x42')]('tools_tags');var _0x22a9f9=squel[_0xf26f('0x40')]()[_0xf26f('0x41')](_0xf26f('0x43'))[_0xf26f('0x41')](_0xf26f('0x44'))[_0xf26f('0x41')](_0xf26f('0x45'))['from'](_0xf26f('0x46'),'ui')[_0xf26f('0x47')](_0xf26f('0x48'),'u','u.id\x20=\x20ui.UserId');var _0x5c61ae=squel[_0xf26f('0x40')]()['from'](_0xf26f('0x49'),'i')[_0xf26f('0x47')](_0xf26f('0x4a'),'c',_0xf26f('0x4b'))['left_join']('users','o',_0xf26f('0x4c'))[_0xf26f('0x47')](_0xf26f('0x4d'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xf26f('0x4e'),'me',_0xf26f('0x4f'))[_0xf26f('0x47')](_0xf26f('0x50'),'it',_0xf26f('0x51'))['left_join'](_0xf26f('0x52'),'t','t.id\x20=\x20it.TagId');var _0x5842ab=squel[_0xf26f('0x53')]();var _0x36554e=[];var _0x3f5f74=squel['expr']();var _0x3bf57a;if(_0x1d3474['query']['search']){_0x3bf57a=as['parseSearch'](_0x1d3474[_0xf26f('0x34')][_0xf26f('0x54')]);var _0x1bc42f=_0x3bf57a[_0xf26f('0x55')];for(var _0x4e85f3=0x0;_0x4e85f3<_0x3bf57a['conditions']['length'];_0x4e85f3++){var _0x4ded4b=_0x3bf57a[_0xf26f('0x56')][_0x4e85f3];var _0x5d7769='i';var _0x4b8ea8=_[_0xf26f('0x57')](_0x5eadda,[_0xf26f('0x1e'),_0x4ded4b[_0xf26f('0x41')]]);if(!_0x4b8ea8){switch(_0x4ded4b[_0xf26f('0x41')]){case _0xf26f('0x58'):if(_0x4ded4b[_0xf26f('0x59')]==0x1){_0x5c61ae['having']('`'+_0x4ded4b[_0xf26f('0x41')]+'`\x20=\x200');}else{_0x5c61ae['having']('`'+_0x4ded4b[_0xf26f('0x41')]+_0xf26f('0x5a'));}break;case _0xf26f('0x5b'):if(_0x4ded4b[_0xf26f('0x5c')]==='$substring'){if(_0x4ded4b[_0xf26f('0x59')][_0xf26f('0x23')]('\x20')['length']>0x1){_0x5842ab[_0x1bc42f](_0xf26f('0x5d'),qs[_0xf26f('0x5e')](_0x4ded4b[_0xf26f('0x59')]),null);}else{var _0x3e4185='%'+_0x4ded4b[_0xf26f('0x59')]+'%';_0x5842ab[_0x1bc42f](_0xf26f('0x5f'),_0x3e4185,_0x3e4185,_0x3e4185);}}else{_0x4b8ea8=_[_0xf26f('0x57')](_0x5eadda,['name',_0xf26f('0x60')]);_0x4ded4b[_0xf26f('0x41')]=_0xf26f('0x60');_0x29662e=as['buildExpression'](_0x5d7769,_0x4b8ea8[_0xf26f('0x31')],_0x4ded4b);_0x5842ab[_0x1bc42f](_0x29662e['text'],_0x29662e[_0xf26f('0x59')]['start'],_0x29662e['value'][_0xf26f('0x12')]);}break;case _0xf26f('0x61'):var _0x323378=_0x4ded4b[_0xf26f('0x59')][_0xf26f('0x23')](',')[_0xf26f('0x2d')](function(_0x53525b){return Number(_0x53525b);});_0x323378['forEach'](function(_0x446968){_0x3f5f74['or'](_0xf26f('0x62'),'%,'+_0x446968+',%');});_0x36554e=_[_0xf26f('0x63')](_0x36554e,_0x323378);break;case'User':if(_0x4ded4b[_0xf26f('0x5c')]===_0xf26f('0x64')){_0x5842ab[_0x1bc42f](_0xf26f('0x65'),'%'+_0x4ded4b[_0xf26f('0x59')]+'%',null);}else{_0x4b8ea8=_['find'](_0x5eadda,[_0xf26f('0x1e'),_0xf26f('0x29')]);_0x4ded4b[_0xf26f('0x41')]=_0xf26f('0x29');_0x29662e=as['buildExpression'](_0x5d7769,_0x4b8ea8['type'],_0x4ded4b);_0x5842ab[_0x1bc42f](_0x29662e['text'],_0x29662e[_0xf26f('0x59')]['start'],_0x29662e[_0xf26f('0x59')][_0xf26f('0x12')]);}break;case _0xf26f('0x66'):_0x29662e=as[_0xf26f('0x67')]('me',null,_0x4ded4b);_0x5842ab[_0x1bc42f](_0x29662e['text'],_0x29662e['value'][_0xf26f('0x68')],_0x29662e[_0xf26f('0x59')][_0xf26f('0x12')]);break;}}else{var _0x29662e=as['buildExpression'](_0x5d7769,_0x4b8ea8[_0xf26f('0x31')],_0x4ded4b);_0x5842ab[_0x1bc42f](_0x29662e[_0xf26f('0x69')],_0x29662e[_0xf26f('0x59')][_0xf26f('0x68')],_0x29662e[_0xf26f('0x59')][_0xf26f('0x12')]);}}}else{var _0x5b64c2=_(_0x1d3474[_0xf26f('0x34')])[_0xf26f('0x35')]()[_0xf26f('0x2d')](function(_0x698726){return _[_0xf26f('0x6a')](_0x5eadda,[_0xf26f('0x1e'),_0x698726])?_0x698726:undefined;})[_0xf26f('0x6b')]()['value']();if(!_[_0xf26f('0x6c')](_0x5b64c2)){_0x5b64c2[_0xf26f('0x24')](function(_0x5e33dc){if(_0x5e33dc===_0xf26f('0x6d')){_0x5c61ae['where'](_0xf26f('0x6e'),[][_0xf26f('0x6f')](_0x1d3474['query'][_0x5e33dc]));}else if(_0x5e33dc==='createdAt'){var _0x2cd661=JSON[_0xf26f('0x70')](_0x1d3474[_0xf26f('0x34')][_0x5e33dc])['$gte'];var _0x4c811f=JSON[_0xf26f('0x70')](_0x1d3474['query'][_0x5e33dc])['$lte'];_0x5c61ae[_0xf26f('0x3e')](_0xf26f('0x71'),_0x2cd661,_0x4c811f);}else{if(_0x1d3474[_0xf26f('0x34')][_0x5e33dc]===_0xf26f('0x72')){_0x5c61ae[_0xf26f('0x3e')]('i.'+_0x5e33dc+'\x20IS\x20NULL');}else{_0x5c61ae['where']('i.'+_0x5e33dc+'\x20=\x20?',_0x1d3474['query'][_0x5e33dc]);}}});}if(_0x1d3474['query'][_0xf26f('0x73')]){if(_0x1d3474[_0xf26f('0x34')][_0xf26f('0x73')]==0x1){_0x5c61ae[_0xf26f('0x74')](_0xf26f('0x75'));}else{_0x5c61ae[_0xf26f('0x74')](_0xf26f('0x76'));}}if(_0x1d3474[_0xf26f('0x34')][_0xf26f('0x77')]){_0x36554e=_[_0xf26f('0x78')](_0x1d3474[_0xf26f('0x34')][_0xf26f('0x77')])?_0x1d3474[_0xf26f('0x34')]['tag']:new Array(_0x1d3474[_0xf26f('0x34')][_0xf26f('0x77')]);_0x36554e[_0xf26f('0x24')](function(_0x3c412e){_0x3f5f74['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c412e+',%');});}if(_0x1d3474['query'][_0xf26f('0x79')]){var _0x56d7f9=_0x1d3474['query'][_0xf26f('0x79')][_0xf26f('0x7a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xf26f('0x7b')](_0x56d7f9)){_0x5842ab['or'](_0xf26f('0x7c'),_0x56d7f9+'%');}else{_0x5842ab['or'](_0xf26f('0x7d'),qs[_0xf26f('0x5e')](_0x56d7f9))['or'](_0xf26f('0x7e'),_0x56d7f9+'%');}_0x5842ab['or'](_0xf26f('0x7f'),_0x56d7f9+'%');}}_0x5c61ae[_0xf26f('0x3e')](_0x5842ab);_0x5c61ae['group']('i.id');var _0x2fd560={'type':db[_0xf26f('0x80')][_0xf26f('0x81')][_0xf26f('0x82')],'raw':!![]};var _0x4bcd65=_0x5c61ae[_0xf26f('0x83')]();_0x4bcd65[_0xf26f('0x41')]('i.id');_0x4bcd65[_0xf26f('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf26f('0x58'));if(_0x58ee03[_0xf26f('0x3c')]){_0x58ee03[_0xf26f('0x3c')][_0xf26f('0x24')](function(_0x4c453b){var _0x2a6799=_0x4c453b[0x0]==='contactName'?_0x4c453b[0x0]:'i.'+_0x4c453b[0x0];_0x5c61ae[_0xf26f('0x3c')](_0x2a6799,_0x4c453b[0x1]===_0xf26f('0x84')?![]:!![]);});}if(!_[_0xf26f('0x6c')](_0x36554e)){_0x5c61ae[_0xf26f('0x74')](_0x3f5f74);_0x4bcd65[_0xf26f('0x3e')](_0xf26f('0x85'),_0x36554e);}Promise[_0xf26f('0x86')]()['then'](function(){if(!_0x3bf57a){if(_0x1d3474['query']['OpenchannelAccountId'])return;_0x4bcd65['where'](_0xf26f('0x87'));_0x5c61ae[_0xf26f('0x3e')](_0xf26f('0x87'));return;}if(_0x1d3474[_0xf26f('0x88')]['role']!==_0xf26f('0x89'))return;return _0x1d3474[_0xf26f('0x88')][_0xf26f('0x8a')]({'attributes':['id'],'raw':!![]})[_0xf26f('0x1b')](function(_0x62bf1f){if(_[_0xf26f('0x6c')](_0x62bf1f)){_0x4bcd65[_0xf26f('0x3e')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x5c61ae[_0xf26f('0x3e')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x4bcd65[_0xf26f('0x3e')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xf26f('0x2d')](_0x62bf1f,'id'));_0x5c61ae[_0xf26f('0x3e')](_0xf26f('0x6e'),_[_0xf26f('0x2d')](_0x62bf1f,'id'));}});})[_0xf26f('0x1b')](function(){if(_0x1d3474[_0xf26f('0x88')][_0xf26f('0x8b')]===_0xf26f('0x89')&&!_0x3bf57a&&!_0x1d3474['query'][_0xf26f('0x6d')])return[];return db['sequelize']['query'](_0x4bcd65[_0xf26f('0x8c')](),_0x2fd560);})[_0xf26f('0x1b')](function(_0x19be88){_0x21f3ee[_0xf26f('0x17')]=_0x19be88[_0xf26f('0x39')];if(_0x21f3ee[_0xf26f('0x17')]===0x0)return[];return db[_0xf26f('0x8d')][_0xf26f('0x34')](_0xd87e5[_0xf26f('0x8c')](),_0x2fd560)[_0xf26f('0x1b')](function(_0x51e3ed){_0xb04144=_['keyBy'](_0x51e3ed,'id');_0x2fd560=_[_0xf26f('0x8e')](_0x2fd560,{'model':db[_0xf26f('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1d3474[_0xf26f('0x34')][_0xf26f('0x38')]){_0x58ee03['attributes'][_0xf26f('0x24')](function(_0x33df04){_0x5c61ae[_0xf26f('0x41')]('i.'+_0x33df04);});}else{_0x5c61ae[_0xf26f('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf26f('0x58'));_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x8f'),'Account.key');_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x90'),'Account.mandatoryDisposition');_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x91'),_0xf26f('0x92'));_0x5c61ae['field']('i.*');_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x93'),_0xf26f('0x94'));_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x95'),_0xf26f('0x96'));_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x97'),_0xf26f('0x98'));_0x5c61ae['field'](_0xf26f('0x99'),_0xf26f('0x9a'));_0x5c61ae[_0xf26f('0x41')]('c.mobile','Contact.mobile');_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x9b'),_0xf26f('0x9c'));_0x5c61ae[_0xf26f('0x41')](_0xf26f('0x9d'),'Owner.fullname');_0x5c61ae['field'](_0xf26f('0x9e'),_0xf26f('0x9f'));_0x5c61ae[_0xf26f('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xf26f('0x22'));}if(_0x58ee03[_0xf26f('0x15')])_0x5c61ae['limit'](_0x58ee03[_0xf26f('0x15')]);if(_0x58ee03[_0xf26f('0x14')])_0x5c61ae[_0xf26f('0x14')](_0x58ee03[_0xf26f('0x14')]);return db[_0xf26f('0x8d')][_0xf26f('0x34')](_0x5c61ae[_0xf26f('0x8c')](),_0x2fd560);})[_0xf26f('0x1b')](function(_0x18bd1b){if(_0x18bd1b[_0xf26f('0x39')]>0x0)_0x22a9f9[_0xf26f('0x3e')](_0xf26f('0xa0'),_[_0xf26f('0x2d')](_0x18bd1b,'id'));return db['sequelize']['query'](_0x22a9f9[_0xf26f('0x8c')](),_0x2fd560)['then'](function(_0x250fc9){var _0x26e42a=_['groupBy'](_0x250fc9,'OpenchannelInteractionId');var _0x2265da=[];_0x18bd1b['forEach'](function(_0x4a06d9){_0x2265da[_0xf26f('0xa1')](updateOpenchannelInteraction(_0x4a06d9,_0xb04144,_0x26e42a));});return Promise[_0xf26f('0xa2')](_0x2265da);});});})[_0xf26f('0x1b')](function(_0x244387){_0x21f3ee[_0xf26f('0xa3')]=_0x244387;return _0x21f3ee;})[_0xf26f('0x1b')](respondWithFilteredResult(_0x5eeab6,_0x58ee03))[_0xf26f('0xa4')](handleError(_0x5eeab6,null));};exports[_0xf26f('0xa5')]=function(_0x5c65a3,_0x38b471){var _0x6d24a4={};if(_0x5c65a3['query'][_0xf26f('0x31')]&&_0x5c65a3[_0xf26f('0x34')][_0xf26f('0x31')]==='from'){_0x6d24a4['from']=_0x5c65a3[_0xf26f('0xa6')]['id'];}else{_0x6d24a4['id']=_0x5c65a3[_0xf26f('0xa6')]['id'];}var _0x178033={'raw':![],'where':_0x6d24a4},_0x46491f={};_0x46491f[_0xf26f('0x33')]=_['keys'](db['OpenchannelInteraction'][_0xf26f('0x2f')]);_0x46491f[_0xf26f('0x34')]=_[_0xf26f('0x35')](_0x5c65a3[_0xf26f('0x34')]);_0x46491f[_0xf26f('0x3f')]=_[_0xf26f('0x36')](_0x46491f[_0xf26f('0x33')],_0x46491f[_0xf26f('0x34')]);_0x178033[_0xf26f('0x37')]=_['intersection'](_0x46491f[_0xf26f('0x33')],qs['fields'](_0x5c65a3[_0xf26f('0x34')]['fields']));_0x178033[_0xf26f('0x37')]=_0x178033[_0xf26f('0x37')][_0xf26f('0x39')]?_0x178033[_0xf26f('0x37')]:_0x46491f[_0xf26f('0x33')];if(_0x5c65a3[_0xf26f('0x34')][_0xf26f('0xa7')]){_0x178033[_0xf26f('0xa8')]=[{'all':!![]}];}_0x178033=_['merge']({},_0x178033,_0x5c65a3[_0xf26f('0xa9')]);return db[_0xf26f('0x2e')]['find'](_0x178033)[_0xf26f('0x1b')](handleEntityNotFound(_0x38b471,null))[_0xf26f('0x1b')](respondWithResult(_0x38b471,null))[_0xf26f('0xa4')](handleError(_0x38b471,null));};exports['create']=function(_0x2099c5,_0x11f005){return db[_0xf26f('0x2e')][_0xf26f('0xaa')](_0x2099c5[_0xf26f('0x66')],{})['then'](respondWithResult(_0x11f005,0xc9))['catch'](handleError(_0x11f005,null));};exports[_0xf26f('0xab')]=function(_0x5d65b1,_0x2a4e24){if(_0x5d65b1[_0xf26f('0x66')]['id']){delete _0x5d65b1['body']['id'];}return db['OpenchannelInteraction'][_0xf26f('0x57')]({'where':{'id':_0x5d65b1[_0xf26f('0xa6')]['id']}})['then'](handleEntityNotFound(_0x2a4e24,null))['then'](saveUpdates(_0x5d65b1[_0xf26f('0x66')],null))[_0xf26f('0x1b')](respondWithResult(_0x2a4e24,null))['catch'](handleError(_0x2a4e24,null));};exports[_0xf26f('0x1a')]=function(_0x212610,_0x12ec49){return db[_0xf26f('0x2e')][_0xf26f('0x57')]({'where':{'id':_0x212610[_0xf26f('0xa6')]['id']}})[_0xf26f('0x1b')](handleEntityNotFound(_0x12ec49,null))[_0xf26f('0x1b')](removeEntity(_0x12ec49,null))[_0xf26f('0xa4')](handleError(_0x12ec49,null));};exports[_0xf26f('0xac')]=function(_0x2291dc,_0x39b447){return db[_0xf26f('0x2e')]['describe']()[_0xf26f('0x1b')](respondWithResult(_0x39b447,null))[_0xf26f('0xa4')](handleError(_0x39b447,null));};exports[_0xf26f('0xad')]=function(_0x216f16,_0x461e77){return db[_0xf26f('0xae')][_0xf26f('0x57')]({'where':{'id':_0x216f16[_0xf26f('0xa6')]['id']}})[_0xf26f('0x1b')](handleEntityNotFound(_0x461e77,null))['then'](function(_0x20195a){if(_0x20195a){return _0x20195a[_0xf26f('0xad')](_0x216f16[_0xf26f('0x66')][_0xf26f('0xaf')],_['omit'](_0x216f16['body'],['ids','id'])||{});}})[_0xf26f('0x1b')](respondWithResult(_0x461e77,null))[_0xf26f('0xa4')](handleError(_0x461e77,null));};exports[_0xf26f('0xb0')]=function(_0x5dcfca,_0x2081c4){var _0x4150c1={'raw':![],'where':{}};var _0x584955={};var _0xd01416={'count':0x0,'rows':[]};return db[_0xf26f('0x2e')][_0xf26f('0xb1')]({'where':{'id':_0x5dcfca[_0xf26f('0xa6')]['id']}})[_0xf26f('0x1b')](handleEntityNotFound(_0x2081c4,null))[_0xf26f('0x1b')](function(_0x19f83e){if(_0x19f83e){_0x584955['model']=_[_0xf26f('0x35')](db[_0xf26f('0xae')][_0xf26f('0x2f')]);_0x584955[_0xf26f('0x34')]=_[_0xf26f('0x35')](_0x5dcfca[_0xf26f('0x34')]);_0x584955[_0xf26f('0x3f')]=_[_0xf26f('0x36')](_0x584955[_0xf26f('0x33')],_0x584955[_0xf26f('0x34')]);_0x4150c1[_0xf26f('0x37')]=_[_0xf26f('0x36')](_0x584955[_0xf26f('0x33')],qs['fields'](_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x38')]));_0x4150c1[_0xf26f('0x37')]=_0x4150c1['attributes'][_0xf26f('0x39')]?_0x4150c1[_0xf26f('0x37')]:_0x584955[_0xf26f('0x33')];if(!_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x3a')]('nolimit')){_0x4150c1['limit']=qs['limit'](_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x15')]);_0x4150c1[_0xf26f('0x14')]=qs[_0xf26f('0x14')](_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x14')]);}_0x4150c1[_0xf26f('0x3c')]=qs[_0xf26f('0x3d')](_0x5dcfca[_0xf26f('0x34')]['sort']);_0x4150c1[_0xf26f('0x3e')]=qs['filters'](_[_0xf26f('0xb2')](_0x5dcfca[_0xf26f('0x34')],_0x584955['filters']));_0x4150c1[_0xf26f('0x3e')][_0xf26f('0xb3')]=_0x19f83e['id'];if(_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x79')]){_0x4150c1['where']=_['merge'](_0x4150c1['where'],{'$or':_['map'](_0x4150c1[_0xf26f('0x37')],function(_0x5e6fce){var _0x185010={};_0x185010[_0x5e6fce]={'$like':'%'+_0x5dcfca[_0xf26f('0x34')][_0xf26f('0x79')]+'%'};return _0x185010;})});}if(_0x5dcfca['query'][_0xf26f('0xb4')]){var _0x5ae64e=_0x5dcfca[_0xf26f('0x34')][_0xf26f('0xb4')][_0xf26f('0x23')](',');var _0x53fb18={};_0x53fb18[_0x5ae64e[0x0]]={'$gte':moment(_0x5ae64e[0x1])[_0xf26f('0xb5')](_0xf26f('0xb6'))};_0x4150c1[_0xf26f('0x3e')]=_[_0xf26f('0x8e')](_0x4150c1['where'],_0x53fb18);}_0x4150c1=_[_0xf26f('0x8e')]({},_0x4150c1,_0x5dcfca['options']);return db[_0xf26f('0xae')]['count']({'where':_0x4150c1['where']})[_0xf26f('0x1b')](function(_0x361ee7){_0xd01416['count']=_0x361ee7;if(_0x5dcfca['query'][_0xf26f('0xa7')]){_0x4150c1[_0xf26f('0xa8')]=[{'all':!![]}];}return db[_0xf26f('0xae')]['findAll'](_0x4150c1);})[_0xf26f('0x1b')](function(_0x4fd815){_0xd01416[_0xf26f('0xa3')]=_0x4fd815;return _0xd01416;});}})[_0xf26f('0x1b')](respondWithFilteredResult(_0x2081c4,_0x4150c1))[_0xf26f('0xa4')](handleError(_0x2081c4,null));};exports[_0xf26f('0xb7')]=function(_0xfd9369,_0x4430bb){return db[_0xf26f('0x2e')]['find']({'where':{'id':_0xfd9369[_0xf26f('0xa6')]['id']}})[_0xf26f('0x1b')](handleEntityNotFound(_0x4430bb,null))['then'](function(_0x65f043){if(_0x65f043){return _0x65f043[_0xf26f('0xb8')](_0xfd9369[_0xf26f('0x66')][_0xf26f('0xaf')],_[_0xf26f('0xb9')](_0xfd9369[_0xf26f('0x66')],[_0xf26f('0xaf'),'id'])||{})[_0xf26f('0xba')](function(){return db[_0xf26f('0x61')]['findAll']({'attributes':['id',_0xf26f('0x1e'),_0xf26f('0xbb')],'where':{'id':_0xfd9369[_0xf26f('0x66')][_0xf26f('0xaf')]}});})[_0xf26f('0x1b')](function(_0x241084){socket['emit'](_0xf26f('0xbc'),{'id':Number(_0xfd9369[_0xf26f('0xa6')]['id']),'tags':_0x241084||[]});return{'id':Number(_0xfd9369['params']['id']),'tags':_0x241084||[]};});}})[_0xf26f('0x1b')](respondWithResult(_0x4430bb,null))['catch'](handleError(_0x4430bb,null));};exports[_0xf26f('0xbd')]=function(_0x1d5ace,_0x525374){return db[_0xf26f('0x2e')]['find']({'where':{'id':_0x1d5ace[_0xf26f('0xa6')]['id']}})[_0xf26f('0x1b')](handleEntityNotFound(_0x525374,null))[_0xf26f('0x1b')](function(_0xacfa25){if(_0xacfa25){return _0xacfa25['removeTags'](_0x1d5ace[_0xf26f('0x34')][_0xf26f('0xaf')]);}})[_0xf26f('0x1b')](respondWithStatusCode(_0x525374,null))['catch'](handleError(_0x525374,null));};exports[_0xf26f('0xbe')]=function(_0x423be7,_0x4db553){var _0x3d16ca=moment()[_0xf26f('0xbf')]()['toString']();var _0x38f962=path['join'](config['root'],_0xf26f('0xc0'),_0xf26f('0xc1'),_0xf26f('0xc2'));var _0x7cbbfc=path[_0xf26f('0xc3')](config[_0xf26f('0xc4')],_0xf26f('0xc0'),_0xf26f('0xc1'),'attachments');var _0x2b6767=path[_0xf26f('0xc3')](_0x38f962,_0x3d16ca);var _0x12738b=util[_0xf26f('0xb5')](_0xf26f('0xc5'),_0x423be7[_0xf26f('0xa6')]['id'],_0x3d16ca);var _0x40f2ff=path[_0xf26f('0xc3')](_0x38f962,_0x12738b);var _0x168b36=[];_0x168b36[_0xf26f('0xa1')]({'model':db['User'],'as':_0xf26f('0xc6'),'attributes':['id',_0xf26f('0x21')],'raw':!![]});_0x168b36['push']({'model':db['CmContact'],'as':_0xf26f('0x5b'),'attributes':['id',_0xf26f('0xc7'),_0xf26f('0xc8')],'raw':!![]});if(_0x423be7['query']['attachments']){_0x168b36[_0xf26f('0xa1')]({'model':db[_0xf26f('0xc9')],'as':'Attachment','raw':!![]});}var _0x9b6964=[{'model':db['OpenchannelMessage'],'as':_0xf26f('0xca'),'attributes':['id',_0xf26f('0x66'),'createdAt',_0xf26f('0xcb'),'secret',_0xf26f('0x73')],'include':_0x168b36}];_0x9b6964[_0xf26f('0xa1')]({'model':db[_0xf26f('0xcc')],'as':_0xf26f('0xcd'),'attributes':['id',_0xf26f('0x1e')]});_0x9b6964[_0xf26f('0xa1')]({'model':db[_0xf26f('0xc6')],'as':_0xf26f('0xce'),'attributes':['id',_0xf26f('0x21')]});return db[_0xf26f('0x2e')]['find']({'where':{'id':_0x423be7[_0xf26f('0xa6')]['id']},'include':_0x9b6964})[_0xf26f('0x1b')](handleEntityNotFound(_0x4db553,null))[_0xf26f('0x1b')](function(_0x22eb60){if(_0x22eb60){var _0x38a732=_0x22eb60['get']({'plain':!![]});fs[_0xf26f('0xcf')](_0x2b6767);var _0x38dae0={'channel':'Openchannel','account':_0x38a732[_0xf26f('0xcd')][_0xf26f('0x1e')],'agent':_0x38a732[_0xf26f('0xce')]?_0x38a732[_0xf26f('0xce')][_0xf26f('0x21')]:_0xf26f('0xd0'),'createdAt':moment(_0x38a732['createdAt'])[_0xf26f('0xb5')](_0xf26f('0xb6'))[_0xf26f('0x8c')](),'closedAt':_0x38a732[_0xf26f('0x28')]?moment(_0x38a732[_0xf26f('0xd1')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x38a732[_0xf26f('0xd2')],'visibility':_0x38a732[_0xf26f('0xd3')]?_0xf26f('0xd4'):'Private','messages':_(_0x38a732[_0xf26f('0xca')])['filter']({'secret':![]})[_0xf26f('0x2d')](function(_0x2d3ed3){if(_0x2d3ed3[_0xf26f('0xc9')]){var _0x4c9475=path['join'](_0x7cbbfc,_0x2d3ed3[_0xf26f('0xc9')][_0xf26f('0xd5')]);if(fs['existsSync'](_0x4c9475)){fs['createReadStream'](_0x4c9475)[_0xf26f('0xd6')](fs[_0xf26f('0xd7')](path[_0xf26f('0xc3')](_0x2b6767,_0x2d3ed3[_0xf26f('0xc9')][_0xf26f('0xd5')])));}}return{'date':moment(_0x2d3ed3[_0xf26f('0xd8')])[_0xf26f('0xb5')](_0xf26f('0xb6'))['toString'](),'sender':_0x2d3ed3[_0xf26f('0xcb')]===_0xf26f('0xd9')?_0x2d3ed3[_0xf26f('0xc6')]?_0x2d3ed3[_0xf26f('0xc6')]['fullname']:'System':_0x2d3ed3[_0xf26f('0x5b')][_0xf26f('0xc7')]+(_0x2d3ed3['Contact']['lastName']?'\x20'+_0x2d3ed3['Contact'][_0xf26f('0xc8')]:''),'body':_0x2d3ed3['Attachment']?_0x2d3ed3[_0xf26f('0xc9')]['basename']:_0x2d3ed3[_0xf26f('0x66')],'direction':_0x2d3ed3['direction']===_0xf26f('0xd9')?'A':'C','secret':_0x2d3ed3[_0xf26f('0xda')],'read':_0x2d3ed3[_0xf26f('0x73')],'attachment':_0x2d3ed3[_0xf26f('0xc9')]};})[_0xf26f('0x59')]()};return ejs[_0xf26f('0xdb')](path[_0xf26f('0xc3')](config[_0xf26f('0xc4')],_0xf26f('0xc0'),_0xf26f('0xdc'),_0xf26f('0xdd')),{'interaction':_0x38dae0})[_0xf26f('0x1b')](function(_0x20b048){var _0x42cf1a=path[_0xf26f('0xc3')](_0x2b6767,_0xf26f('0xde')+_0x38a732['id']+'-'+_0x3d16ca+_0xf26f('0xdf'));var _0x288754={'path':_0x42cf1a,'channel':_0xf26f('0xe0'),'interactionId':_0x38a732['id']};return pdf[_0xf26f('0xe1')](_0x20b048,_0x288754);})['then'](function(){return new Promise(function(_0x4a7e2e,_0x25b060){zipdir(_0x2b6767,{'saveTo':_0x40f2ff},function(_0x4b71b9,_0xa00789){if(_0x4b71b9)return _0x25b060(_0x4b71b9);return _0x4a7e2e(_0xa00789);});})[_0xf26f('0x1b')](function(){return new Promise(function(_0x20c29d,_0x4ed88c){rimraf(_0x2b6767,function(_0x4bd7e6){if(_0x4bd7e6)_0x4ed88c(_0x4bd7e6);return _0x20c29d();});});})[_0xf26f('0x1b')](function(){return _0x4db553[_0xf26f('0xbe')](_0x40f2ff,_0x12738b,function(_0x55a808){if(_0x55a808){logger[_0xf26f('0x1c')](_0xf26f('0xe2'),_0x55a808);}else{fs[_0xf26f('0xe3')](_0x40f2ff);}});});});}else{return _0x4db553[_0xf26f('0x10')](0xc8);}})[_0xf26f('0xa4')](handleError(_0x4db553,null));}; \ No newline at end of file +var _0xd48c=['views','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','OpenchannelAccountId','where','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`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?','i.from\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','count','merge','Account.key','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','include','create','describe','addMessage','OpenchannelMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','setTags','spread','Tag','findAll','color','removeTags','download','unix','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','fullname','CmContact','lastName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closedAt','threadId','existsSync','pipe','createWriteStream','basename','out','System','firstName','renderFile'];(function(_0x169f47,_0x35884c){var _0x23f0c3=function(_0x549bb7){while(--_0x549bb7){_0x169f47['push'](_0x169f47['shift']());}};_0x23f0c3(++_0x35884c);}(_0xd48c,0xee));var _0xcd48=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0xd48c[_0x7abd7];return _0x3a2577;};'use strict';var rimraf=require(_0xcd48('0x0'));var zipdir=require(_0xcd48('0x1'));var moment=require(_0xcd48('0x2'));var util=require(_0xcd48('0x3'));var path=require(_0xcd48('0x4'));var ejs=require(_0xcd48('0x5'));var fs=require('fs');var _=require(_0xcd48('0x6'));var squel=require(_0xcd48('0x7'));var Redis=require(_0xcd48('0x8'));var qs=require(_0xcd48('0x9'));var as=require(_0xcd48('0xa'));var pdf=require(_0xcd48('0xb'));var logger=require(_0xcd48('0xc'))(_0xcd48('0xd'));var config=require(_0xcd48('0xe'));var db=require(_0xcd48('0xf'))['db'];config[_0xcd48('0x10')]=_['defaults'](config[_0xcd48('0x10')],{'host':_0xcd48('0x11'),'port':0x18eb});var socket=require(_0xcd48('0x12'))(new Redis(config[_0xcd48('0x10')]));require('./openchannelInteraction.socket')[_0xcd48('0x13')](socket);function respondWithStatusCode(_0x5f1217,_0x2f23bf){_0x2f23bf=_0x2f23bf||0xcc;return function(_0x1494ad){if(_0x1494ad){return _0x5f1217['sendStatus'](_0x2f23bf);}return _0x5f1217['status'](_0x2f23bf)['end']();};}function respondWithResult(_0x21c2bf,_0x118895){_0x118895=_0x118895||0xc8;return function(_0x23c937){if(_0x23c937){return _0x21c2bf[_0xcd48('0x14')](_0x118895)[_0xcd48('0x15')](_0x23c937);}};}function respondWithFilteredResult(_0x3cfecf,_0x30195d){return function(_0x200ae6){if(_0x200ae6){var _0x2270eb=typeof _0x30195d[_0xcd48('0x16')]===_0xcd48('0x17')&&typeof _0x30195d[_0xcd48('0x18')]===_0xcd48('0x17');var _0x327b7b=_0x200ae6['count'];var _0x4a591d=_0x2270eb?0x0:_0x30195d[_0xcd48('0x16')];var _0x10af66=_0x2270eb?_0x200ae6['count']:_0x30195d['offset']+_0x30195d[_0xcd48('0x18')];var _0x30aab4;if(_0x10af66>=_0x327b7b){_0x10af66=_0x327b7b;_0x30aab4=0xc8;}else{_0x30aab4=0xce;}_0x3cfecf['status'](_0x30aab4);return _0x3cfecf['set'](_0xcd48('0x19'),_0x4a591d+'-'+_0x10af66+'/'+_0x327b7b)['json'](_0x200ae6);}return null;};}function saveUpdates(_0xa9df07){return function(_0x19852f){if(_0x19852f){return _0x19852f[_0xcd48('0x1a')](_0xa9df07)['then'](function(_0xcc1b7f){return _0xcc1b7f;});}return null;};}function removeEntity(_0x169b6c){return function(_0x1905c4){if(_0x1905c4){return _0x1905c4[_0xcd48('0x1b')]()[_0xcd48('0x1c')](function(){_0x169b6c[_0xcd48('0x14')](0xcc)[_0xcd48('0x1d')]();});}};}function handleEntityNotFound(_0x509cb7){return function(_0x5c5693){if(!_0x5c5693){_0x509cb7[_0xcd48('0x1e')](0x194);}return _0x5c5693;};}function handleError(_0x151d0f,_0x2a8e80){_0x2a8e80=_0x2a8e80||0x1f4;return function(_0x2577f3){logger[_0xcd48('0x1f')](_0x2577f3[_0xcd48('0x20')]);if(_0x2577f3['name']){delete _0x2577f3[_0xcd48('0x21')];}_0x151d0f[_0xcd48('0x14')](_0x2a8e80)['send'](_0x2577f3);};}function getInteractionUsers(_0x51948c,_0xac2e80){return new Promise(function(_0x21100b,_0x59f112){try{if(_0xac2e80[_0x51948c['id']]){_0x51948c[_0xcd48('0x22')]=_[_0xcd48('0x23')](_0xac2e80[_0x51948c['id']],function(_0x1e2a91){return{'id':_0x1e2a91['id'],'fullname':_0x1e2a91['fullname']};});}}catch(_0x6b92cb){_0x59f112(_0x6b92cb);}_0x21100b(_0x51948c);});}function getInteractionTags(_0x4f77b8,_0x349858){return new Promise(function(_0x11f9be,_0x27f698){try{if(_0x4f77b8[_0xcd48('0x24')]){_0x4f77b8[_0xcd48('0x25')]=[];_0x4f77b8[_0xcd48('0x24')][_0xcd48('0x26')](',')[_0xcd48('0x27')](function(_0x46c246){_0x4f77b8[_0xcd48('0x25')][_0xcd48('0x28')](_0x349858[_0x46c246]);});}delete _0x4f77b8[_0xcd48('0x24')];}catch(_0x39abb7){_0x27f698(_0x39abb7);}_0x11f9be(_0x4f77b8);});}function updateOpenchannelInteraction(_0x21a9e8,_0x558bc0,_0x587b51){return new Promise(function(_0x1f1650,_0x4d3e64){return getInteractionUsers(_0x21a9e8,_0x587b51)[_0xcd48('0x1c')](function(_0x5a1a8b){return getInteractionTags(_0x5a1a8b,_0x558bc0);})['then'](function(_0x572000){return getStateInteraction(_0x572000);})[_0xcd48('0x1c')](function(_0x1c13ad){_0x1f1650(_0x1c13ad);})[_0xcd48('0x29')](function(_0x2b3f41){_0x4d3e64(_0x2b3f41);});});}function getStateInteraction(_0xd9b39c){return new Promise(function(_0x3220e6){_0xd9b39c[_0xcd48('0x2a')]=0x0;_0xd9b39c[_0xcd48('0x2b')]=0x0;_0xd9b39c[_0xcd48('0x2c')]=0x0;_0xd9b39c[_0xcd48('0x2d')]=0x0;_0xd9b39c[_0xcd48('0x2e')]=0x0;if(!_0xd9b39c[_0xcd48('0x2f')]&&!_0xd9b39c['UserId']){_0xd9b39c[_0xcd48('0x2a')]+=0x1;}if(!_0xd9b39c[_0xcd48('0x2f')]&&_0xd9b39c[_0xcd48('0x30')]){_0xd9b39c[_0xcd48('0x2b')]+=0x1;if(_0xd9b39c[_0xcd48('0x2a')]){_0xd9b39c[_0xcd48('0x2a')]-=0x1;}}if(_0xd9b39c[_0xcd48('0x2f')]&&_0xd9b39c[_0xcd48('0x30')]){_0xd9b39c[_0xcd48('0x2c')]+=0x1;if(_0xd9b39c['talking']){_0xd9b39c[_0xcd48('0x2b')]-=0x1;}}if(_0xd9b39c['closed']&&!_0xd9b39c[_0xcd48('0x30')]){_0xd9b39c['unmanaged']+=0x1;if(_0xd9b39c['waiting']){_0xd9b39c[_0xcd48('0x2a')]-=0x1;}}_0xd9b39c[_0xcd48('0x2e')]+=0x1;_0x3220e6(_0xd9b39c);});}exports[_0xcd48('0x31')]=function(_0x19702c,_0x15c356){var _0x3bdfba={},_0x215b0f={},_0x17237e={'count':0x0,'rows':[]};var _0x8c35c1=_[_0xcd48('0x23')](db[_0xcd48('0x32')][_0xcd48('0x33')],function(_0x15bd46){return{'name':_0x15bd46[_0xcd48('0x34')],'type':_0x15bd46[_0xcd48('0x35')]['key']};});_0x215b0f[_0xcd48('0x36')]=_['map'](_0x8c35c1,_0xcd48('0x21'));_0x215b0f[_0xcd48('0x37')]=_[_0xcd48('0x38')](_0x19702c[_0xcd48('0x37')]);_0x215b0f[_0xcd48('0x39')]=_['intersection'](_0x215b0f[_0xcd48('0x36')],_0x215b0f['query']);_0x3bdfba[_0xcd48('0x3a')]=_[_0xcd48('0x3b')](_0x215b0f[_0xcd48('0x36')],qs[_0xcd48('0x3c')](_0x19702c[_0xcd48('0x37')]['fields']));_0x3bdfba[_0xcd48('0x3a')]=_0x3bdfba['attributes'][_0xcd48('0x3d')]?_0x3bdfba['attributes']:_0x215b0f['model'];if(!_0x19702c[_0xcd48('0x37')][_0xcd48('0x3e')](_0xcd48('0x3f'))){_0x3bdfba[_0xcd48('0x18')]=qs[_0xcd48('0x18')](_0x19702c['query']['limit']);_0x3bdfba['offset']=qs[_0xcd48('0x16')](_0x19702c[_0xcd48('0x37')]['offset']);}_0x3bdfba[_0xcd48('0x40')]=qs[_0xcd48('0x41')](_0x19702c[_0xcd48('0x37')][_0xcd48('0x41')]);_0x3bdfba['where']=qs[_0xcd48('0x39')](_[_0xcd48('0x42')](_0x19702c['query'],_0x215b0f[_0xcd48('0x39')]),_0x8c35c1);var _0x5c9d06=[];var _0x5b96b5=squel[_0xcd48('0x43')]()['field']('id')['field']('name')[_0xcd48('0x44')]('color')[_0xcd48('0x45')](_0xcd48('0x46'));var _0x3e769b=squel['select']()[_0xcd48('0x44')](_0xcd48('0x47'))[_0xcd48('0x44')](_0xcd48('0x48'))[_0xcd48('0x44')](_0xcd48('0x49'))['from']('user_has_openchannel_interactions','ui')['left_join'](_0xcd48('0x4a'),'u',_0xcd48('0x4b'));var _0xc91851=squel[_0xcd48('0x43')]()[_0xcd48('0x45')](_0xcd48('0x4c'),'i')[_0xcd48('0x4d')](_0xcd48('0x4e'),'c',_0xcd48('0x4f'))['left_join'](_0xcd48('0x4a'),'o',_0xcd48('0x50'))[_0xcd48('0x4d')](_0xcd48('0x51'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xcd48('0x4d')](_0xcd48('0x52'),'me',_0xcd48('0x53'))[_0xcd48('0x4d')](_0xcd48('0x54'),'it',_0xcd48('0x55'))[_0xcd48('0x4d')](_0xcd48('0x46'),'t',_0xcd48('0x56'));var _0x423f16=squel[_0xcd48('0x57')]();var _0xc4c0a0=[];var _0x57175a=squel[_0xcd48('0x57')]();var _0x3e9b20;if(_0x19702c[_0xcd48('0x37')][_0xcd48('0x58')]){_0x3e9b20=as[_0xcd48('0x59')](_0x19702c[_0xcd48('0x37')][_0xcd48('0x58')]);var _0x3f1cab=_0x3e9b20[_0xcd48('0x5a')];for(var _0x1534c2=0x0;_0x1534c2<_0x3e9b20[_0xcd48('0x5b')][_0xcd48('0x3d')];_0x1534c2++){var _0x5d0f15=_0x3e9b20[_0xcd48('0x5b')][_0x1534c2];var _0x2789a6='i';var _0x1fa81d=_[_0xcd48('0x5c')](_0x8c35c1,[_0xcd48('0x21'),_0x5d0f15[_0xcd48('0x44')]]);if(!_0x1fa81d){switch(_0x5d0f15['field']){case'unreadMessages':if(_0x5d0f15[_0xcd48('0x5d')]==0x1){_0xc91851[_0xcd48('0x5e')]('`'+_0x5d0f15['field']+_0xcd48('0x5f'));}else{_0xc91851['having']('`'+_0x5d0f15[_0xcd48('0x44')]+_0xcd48('0x60'));}break;case _0xcd48('0x61'):if(_0x5d0f15['operator']===_0xcd48('0x62')){if(_0x5d0f15['value']['split']('\x20')[_0xcd48('0x3d')]>0x1){_0x423f16[_0x3f1cab](_0xcd48('0x63'),qs[_0xcd48('0x64')](_0x5d0f15[_0xcd48('0x5d')]),null);}else{var _0x4c82de='%'+_0x5d0f15[_0xcd48('0x5d')]+'%';_0x423f16[_0x3f1cab](_0xcd48('0x65'),_0x4c82de,_0x4c82de,_0x4c82de);}}else{_0x1fa81d=_[_0xcd48('0x5c')](_0x8c35c1,[_0xcd48('0x21'),_0xcd48('0x66')]);_0x5d0f15[_0xcd48('0x44')]=_0xcd48('0x66');_0x3e22c5=as[_0xcd48('0x67')](_0x2789a6,_0x1fa81d[_0xcd48('0x35')],_0x5d0f15);_0x423f16[_0x3f1cab](_0x3e22c5[_0xcd48('0x68')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x69')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x1d')]);}break;case'Tag':var _0x418868=_0x5d0f15[_0xcd48('0x5d')][_0xcd48('0x26')](',')[_0xcd48('0x23')](function(_0x18b06f){return Number(_0x18b06f);});_0x418868[_0xcd48('0x27')](function(_0x103d45){_0x57175a['or'](_0xcd48('0x6a'),'%,'+_0x103d45+',%');});_0xc4c0a0=_[_0xcd48('0x6b')](_0xc4c0a0,_0x418868);break;case _0xcd48('0x6c'):if(_0x5d0f15[_0xcd48('0x6d')]==='$substring'){_0x423f16[_0x3f1cab](_0xcd48('0x6e'),'%'+_0x5d0f15[_0xcd48('0x5d')]+'%',null);}else{_0x1fa81d=_['find'](_0x8c35c1,[_0xcd48('0x21'),_0xcd48('0x30')]);_0x5d0f15['field']='UserId';_0x3e22c5=as['buildExpression'](_0x2789a6,_0x1fa81d['type'],_0x5d0f15);_0x423f16[_0x3f1cab](_0x3e22c5[_0xcd48('0x68')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x69')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x1d')]);}break;case _0xcd48('0x6f'):_0x3e22c5=as[_0xcd48('0x67')]('me',null,_0x5d0f15);_0x423f16[_0x3f1cab](_0x3e22c5[_0xcd48('0x68')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x69')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x1d')]);break;}}else{var _0x3e22c5=as['buildExpression'](_0x2789a6,_0x1fa81d[_0xcd48('0x35')],_0x5d0f15);_0x423f16[_0x3f1cab](_0x3e22c5[_0xcd48('0x68')],_0x3e22c5[_0xcd48('0x5d')][_0xcd48('0x69')],_0x3e22c5['value'][_0xcd48('0x1d')]);}}}else{var _0x5bdf2a=_(_0x19702c[_0xcd48('0x37')])[_0xcd48('0x38')]()[_0xcd48('0x23')](function(_0x5b9448){return _[_0xcd48('0x70')](_0x8c35c1,[_0xcd48('0x21'),_0x5b9448])?_0x5b9448:undefined;})[_0xcd48('0x71')]()['value']();if(!_[_0xcd48('0x72')](_0x5bdf2a)){_0x5bdf2a[_0xcd48('0x27')](function(_0x49dc92){if(_0x49dc92===_0xcd48('0x73')){_0xc91851[_0xcd48('0x74')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xcd48('0x75')](_0x19702c[_0xcd48('0x37')][_0x49dc92]));}else if(_0x49dc92==='createdAt'){var _0x1d515c=JSON['parse'](_0x19702c[_0xcd48('0x37')][_0x49dc92])['$gte'];var _0xf83a28=JSON[_0xcd48('0x76')](_0x19702c[_0xcd48('0x37')][_0x49dc92])[_0xcd48('0x77')];_0xc91851[_0xcd48('0x74')](_0xcd48('0x78'),_0x1d515c,_0xf83a28);}else{if(_0x19702c[_0xcd48('0x37')][_0x49dc92]===_0xcd48('0x79')){_0xc91851['where']('i.'+_0x49dc92+_0xcd48('0x7a'));}else{_0xc91851[_0xcd48('0x74')]('i.'+_0x49dc92+'\x20=\x20?',_0x19702c[_0xcd48('0x37')][_0x49dc92]);}}});}if(_0x19702c[_0xcd48('0x37')][_0xcd48('0x7b')]){if(_0x19702c['query'][_0xcd48('0x7b')]==0x1){_0xc91851[_0xcd48('0x5e')](_0xcd48('0x7c'));}else{_0xc91851['having'](_0xcd48('0x7d'));}}if(_0x19702c[_0xcd48('0x37')][_0xcd48('0x7e')]){_0xc4c0a0=_['isArray'](_0x19702c[_0xcd48('0x37')][_0xcd48('0x7e')])?_0x19702c['query'][_0xcd48('0x7e')]:new Array(_0x19702c[_0xcd48('0x37')][_0xcd48('0x7e')]);_0xc4c0a0[_0xcd48('0x27')](function(_0x5afc79){_0x57175a['or'](_0xcd48('0x6a'),'%,'+_0x5afc79+',%');});}if(_0x19702c['query'][_0xcd48('0x7f')]){var _0x19c6c4=_0x19702c[_0xcd48('0x37')][_0xcd48('0x7f')][_0xcd48('0x80')]('\x5c','\x5c\x5c')[_0xcd48('0x80')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x19c6c4)){_0x423f16['or'](_0xcd48('0x81'),_0x19c6c4+'%');}else{_0x423f16['or'](_0xcd48('0x82'),qs[_0xcd48('0x64')](_0x19c6c4))['or'](_0xcd48('0x83'),_0x19c6c4+'%');}_0x423f16['or'](_0xcd48('0x84'),_0x19c6c4+'%');}}_0xc91851[_0xcd48('0x74')](_0x423f16);_0xc91851[_0xcd48('0x85')](_0xcd48('0x86'));var _0x5cb2f4={'type':db[_0xcd48('0x87')]['QueryTypes']['SELECT'],'raw':!![]};var _0x5a51f0=_0xc91851[_0xcd48('0x88')]();_0x5a51f0[_0xcd48('0x44')]('i.id');_0x5a51f0[_0xcd48('0x44')](_0xcd48('0x89'),_0xcd48('0x8a'));if(_0x3bdfba['order']){_0x3bdfba['order'][_0xcd48('0x27')](function(_0x366632){var _0x3644f9=_0x366632[0x0]==='contactName'?_0x366632[0x0]:'i.'+_0x366632[0x0];_0xc91851[_0xcd48('0x40')](_0x3644f9,_0x366632[0x1]===_0xcd48('0x8b')?![]:!![]);});}if(!_[_0xcd48('0x72')](_0xc4c0a0)){_0xc91851[_0xcd48('0x5e')](_0x57175a);_0x5a51f0[_0xcd48('0x74')](_0xcd48('0x8c'),_0xc4c0a0);}Promise[_0xcd48('0x8d')]()[_0xcd48('0x1c')](function(){if(!_0x3e9b20){if(_0x19702c[_0xcd48('0x37')][_0xcd48('0x73')])return;_0x5a51f0[_0xcd48('0x74')](_0xcd48('0x8e'));_0xc91851[_0xcd48('0x74')](_0xcd48('0x8e'));return;}if(_0x19702c[_0xcd48('0x8f')][_0xcd48('0x90')]!==_0xcd48('0x91'))return;return _0x19702c[_0xcd48('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x2b067c){if(_[_0xcd48('0x72')](_0x2b067c)){_0x5a51f0[_0xcd48('0x74')](_0xcd48('0x92'));_0xc91851['where'](_0xcd48('0x92'));}else{_0x5a51f0[_0xcd48('0x74')](_0xcd48('0x93'),_[_0xcd48('0x23')](_0x2b067c,'id'));_0xc91851[_0xcd48('0x74')](_0xcd48('0x93'),_['map'](_0x2b067c,'id'));}});})['then'](function(){if(_0x19702c['user'][_0xcd48('0x90')]===_0xcd48('0x91')&&!_0x3e9b20&&!_0x19702c[_0xcd48('0x37')][_0xcd48('0x73')])return[];return db[_0xcd48('0x94')]['query'](_0x5a51f0[_0xcd48('0x95')](),_0x5cb2f4);})[_0xcd48('0x1c')](function(_0x4e09e5){_0x17237e[_0xcd48('0x96')]=_0x4e09e5[_0xcd48('0x3d')];if(_0x17237e[_0xcd48('0x96')]===0x0)return[];return db[_0xcd48('0x94')][_0xcd48('0x37')](_0x5b96b5[_0xcd48('0x95')](),_0x5cb2f4)[_0xcd48('0x1c')](function(_0x52e420){_0x5c9d06=_['keyBy'](_0x52e420,'id');_0x5cb2f4=_[_0xcd48('0x97')](_0x5cb2f4,{'model':db[_0xcd48('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19702c[_0xcd48('0x37')][_0xcd48('0x3c')]){_0x3bdfba[_0xcd48('0x3a')][_0xcd48('0x27')](function(_0x22226d){_0xc91851['field']('i.'+_0x22226d);});}else{_0xc91851[_0xcd48('0x44')](_0xcd48('0x89'),'unreadMessages');_0xc91851['field']('a.key',_0xcd48('0x98'));_0xc91851['field']('a.mandatoryDisposition',_0xcd48('0x99'));_0xc91851[_0xcd48('0x44')](_0xcd48('0x9a'),_0xcd48('0x9b'));_0xc91851['field'](_0xcd48('0x9c'));_0xc91851[_0xcd48('0x44')](_0xcd48('0x9d'),_0xcd48('0x9e'));_0xc91851['field'](_0xcd48('0x9f'),'Contact.lastName');_0xc91851[_0xcd48('0x44')](_0xcd48('0xa0'),_0xcd48('0xa1'));_0xc91851[_0xcd48('0x44')](_0xcd48('0xa2'),_0xcd48('0xa3'));_0xc91851[_0xcd48('0x44')](_0xcd48('0xa4'),_0xcd48('0xa5'));_0xc91851[_0xcd48('0x44')]('c.fax',_0xcd48('0xa6'));_0xc91851[_0xcd48('0x44')]('o.fullname',_0xcd48('0xa7'));_0xc91851['field']('o.internal',_0xcd48('0xa8'));_0xc91851[_0xcd48('0x44')](_0xcd48('0xa9'),_0xcd48('0x24'));}if(_0x3bdfba[_0xcd48('0x18')])_0xc91851[_0xcd48('0x18')](_0x3bdfba[_0xcd48('0x18')]);if(_0x3bdfba[_0xcd48('0x16')])_0xc91851[_0xcd48('0x16')](_0x3bdfba['offset']);return db[_0xcd48('0x94')][_0xcd48('0x37')](_0xc91851[_0xcd48('0x95')](),_0x5cb2f4);})['then'](function(_0x224052){if(_0x224052[_0xcd48('0x3d')]>0x0)_0x3e769b[_0xcd48('0x74')](_0xcd48('0xaa'),_['map'](_0x224052,'id'));return db[_0xcd48('0x94')][_0xcd48('0x37')](_0x3e769b[_0xcd48('0x95')](),_0x5cb2f4)[_0xcd48('0x1c')](function(_0x3cfee0){var _0x2f5bf0=_[_0xcd48('0xab')](_0x3cfee0,_0xcd48('0xac'));var _0x4b216b=[];_0x224052['forEach'](function(_0x13fa28){_0x4b216b[_0xcd48('0x28')](updateOpenchannelInteraction(_0x13fa28,_0x5c9d06,_0x2f5bf0));});return Promise[_0xcd48('0xad')](_0x4b216b);});});})[_0xcd48('0x1c')](function(_0x5d772c){_0x17237e['rows']=_0x5d772c;return _0x17237e;})[_0xcd48('0x1c')](respondWithFilteredResult(_0x15c356,_0x3bdfba))['catch'](handleError(_0x15c356,null));};exports['show']=function(_0x398e0c,_0x1d3645){var _0x43d0aa={};if(_0x398e0c[_0xcd48('0x37')][_0xcd48('0x35')]&&_0x398e0c[_0xcd48('0x37')][_0xcd48('0x35')]===_0xcd48('0x45')){_0x43d0aa[_0xcd48('0x45')]=_0x398e0c['params']['id'];}else{_0x43d0aa['id']=_0x398e0c[_0xcd48('0xae')]['id'];}var _0xb2901b={'raw':![],'where':_0x43d0aa},_0x360520={};_0x360520[_0xcd48('0x36')]=_[_0xcd48('0x38')](db[_0xcd48('0x32')][_0xcd48('0x33')]);_0x360520[_0xcd48('0x37')]=_['keys'](_0x398e0c['query']);_0x360520[_0xcd48('0x39')]=_[_0xcd48('0x3b')](_0x360520[_0xcd48('0x36')],_0x360520[_0xcd48('0x37')]);_0xb2901b[_0xcd48('0x3a')]=_[_0xcd48('0x3b')](_0x360520[_0xcd48('0x36')],qs[_0xcd48('0x3c')](_0x398e0c['query']['fields']));_0xb2901b[_0xcd48('0x3a')]=_0xb2901b[_0xcd48('0x3a')][_0xcd48('0x3d')]?_0xb2901b[_0xcd48('0x3a')]:_0x360520[_0xcd48('0x36')];if(_0x398e0c[_0xcd48('0x37')]['includeAll']){_0xb2901b[_0xcd48('0xaf')]=[{'all':!![]}];}_0xb2901b=_[_0xcd48('0x97')]({},_0xb2901b,_0x398e0c['options']);return db['OpenchannelInteraction'][_0xcd48('0x5c')](_0xb2901b)[_0xcd48('0x1c')](handleEntityNotFound(_0x1d3645,null))[_0xcd48('0x1c')](respondWithResult(_0x1d3645,null))[_0xcd48('0x29')](handleError(_0x1d3645,null));};exports['create']=function(_0x2ed5c6,_0x245eba){return db['OpenchannelInteraction'][_0xcd48('0xb0')](_0x2ed5c6['body'],{})['then'](respondWithResult(_0x245eba,0xc9))[_0xcd48('0x29')](handleError(_0x245eba,null));};exports[_0xcd48('0x1a')]=function(_0x5cd9f7,_0x12a524){if(_0x5cd9f7['body']['id']){delete _0x5cd9f7['body']['id'];}return db[_0xcd48('0x32')]['find']({'where':{'id':_0x5cd9f7[_0xcd48('0xae')]['id']}})['then'](handleEntityNotFound(_0x12a524,null))[_0xcd48('0x1c')](saveUpdates(_0x5cd9f7[_0xcd48('0x6f')],null))[_0xcd48('0x1c')](respondWithResult(_0x12a524,null))[_0xcd48('0x29')](handleError(_0x12a524,null));};exports[_0xcd48('0x1b')]=function(_0x4b0949,_0x17024b){return db[_0xcd48('0x32')][_0xcd48('0x5c')]({'where':{'id':_0x4b0949[_0xcd48('0xae')]['id']}})['then'](handleEntityNotFound(_0x17024b,null))[_0xcd48('0x1c')](removeEntity(_0x17024b,null))[_0xcd48('0x29')](handleError(_0x17024b,null));};exports[_0xcd48('0xb1')]=function(_0xdfdc41,_0x19f988){return db[_0xcd48('0x32')]['describe']()[_0xcd48('0x1c')](respondWithResult(_0x19f988,null))[_0xcd48('0x29')](handleError(_0x19f988,null));};exports[_0xcd48('0xb2')]=function(_0x147bf6,_0x5302d5){return db[_0xcd48('0xb3')][_0xcd48('0x5c')]({'where':{'id':_0x147bf6['params']['id']}})[_0xcd48('0x1c')](handleEntityNotFound(_0x5302d5,null))['then'](function(_0x314c3a){if(_0x314c3a){return _0x314c3a[_0xcd48('0xb2')](_0x147bf6[_0xcd48('0x6f')][_0xcd48('0xb4')],_[_0xcd48('0xb5')](_0x147bf6[_0xcd48('0x6f')],[_0xcd48('0xb4'),'id'])||{});}})[_0xcd48('0x1c')](respondWithResult(_0x5302d5,null))[_0xcd48('0x29')](handleError(_0x5302d5,null));};exports['getMessages']=function(_0x5ecd3f,_0x7dc718){var _0x215948={'raw':![],'where':{}};var _0x328e37={};var _0x397e8c={'count':0x0,'rows':[]};return db[_0xcd48('0x32')][_0xcd48('0xb6')]({'where':{'id':_0x5ecd3f[_0xcd48('0xae')]['id']}})[_0xcd48('0x1c')](handleEntityNotFound(_0x7dc718,null))[_0xcd48('0x1c')](function(_0x45304a){if(_0x45304a){_0x328e37[_0xcd48('0x36')]=_[_0xcd48('0x38')](db[_0xcd48('0xb3')][_0xcd48('0x33')]);_0x328e37[_0xcd48('0x37')]=_[_0xcd48('0x38')](_0x5ecd3f['query']);_0x328e37[_0xcd48('0x39')]=_[_0xcd48('0x3b')](_0x328e37['model'],_0x328e37[_0xcd48('0x37')]);_0x215948[_0xcd48('0x3a')]=_[_0xcd48('0x3b')](_0x328e37[_0xcd48('0x36')],qs[_0xcd48('0x3c')](_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x3c')]));_0x215948[_0xcd48('0x3a')]=_0x215948['attributes'][_0xcd48('0x3d')]?_0x215948[_0xcd48('0x3a')]:_0x328e37[_0xcd48('0x36')];if(!_0x5ecd3f[_0xcd48('0x37')]['hasOwnProperty'](_0xcd48('0x3f'))){_0x215948['limit']=qs[_0xcd48('0x18')](_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x18')]);_0x215948[_0xcd48('0x16')]=qs[_0xcd48('0x16')](_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x16')]);}_0x215948['order']=qs[_0xcd48('0x41')](_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x41')]);_0x215948['where']=qs['filters'](_[_0xcd48('0x42')](_0x5ecd3f[_0xcd48('0x37')],_0x328e37[_0xcd48('0x39')]));_0x215948[_0xcd48('0x74')][_0xcd48('0xac')]=_0x45304a['id'];if(_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x7f')]){_0x215948[_0xcd48('0x74')]=_[_0xcd48('0x97')](_0x215948[_0xcd48('0x74')],{'$or':_[_0xcd48('0x23')](_0x215948[_0xcd48('0x3a')],function(_0xc5385){var _0x2697da={};_0x2697da[_0xc5385]={'$like':'%'+_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0x7f')]+'%'};return _0x2697da;})});}if(_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0xb7')]){var _0x4bf588=_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0xb7')][_0xcd48('0x26')](',');var _0x32ca69={};_0x32ca69[_0x4bf588[0x0]]={'$gte':moment(_0x4bf588[0x1])[_0xcd48('0xb8')](_0xcd48('0xb9'))};_0x215948[_0xcd48('0x74')]=_[_0xcd48('0x97')](_0x215948[_0xcd48('0x74')],_0x32ca69);}_0x215948=_['merge']({},_0x215948,_0x5ecd3f[_0xcd48('0xba')]);return db[_0xcd48('0xb3')][_0xcd48('0x96')]({'where':_0x215948[_0xcd48('0x74')]})[_0xcd48('0x1c')](function(_0x5b9488){_0x397e8c[_0xcd48('0x96')]=_0x5b9488;if(_0x5ecd3f[_0xcd48('0x37')][_0xcd48('0xbb')]){_0x215948[_0xcd48('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x215948);})[_0xcd48('0x1c')](function(_0x3aea98){_0x397e8c[_0xcd48('0xbc')]=_0x3aea98;return _0x397e8c;});}})[_0xcd48('0x1c')](respondWithFilteredResult(_0x7dc718,_0x215948))['catch'](handleError(_0x7dc718,null));};exports[_0xcd48('0xbd')]=function(_0x28fe82,_0xd88182){return db[_0xcd48('0x32')][_0xcd48('0x5c')]({'where':{'id':_0x28fe82[_0xcd48('0xae')]['id']}})[_0xcd48('0x1c')](handleEntityNotFound(_0xd88182,null))['then'](function(_0x1d926d){if(_0x1d926d){return _0x1d926d[_0xcd48('0xbe')](_0x28fe82[_0xcd48('0x6f')][_0xcd48('0xb4')],_[_0xcd48('0xb5')](_0x28fe82[_0xcd48('0x6f')],['ids','id'])||{})[_0xcd48('0xbf')](function(){return db[_0xcd48('0xc0')][_0xcd48('0xc1')]({'attributes':['id',_0xcd48('0x21'),_0xcd48('0xc2')],'where':{'id':_0x28fe82[_0xcd48('0x6f')]['ids']}});})[_0xcd48('0x1c')](function(_0x1cb739){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x28fe82['params']['id']),'tags':_0x1cb739||[]});return{'id':Number(_0x28fe82['params']['id']),'tags':_0x1cb739||[]};});}})[_0xcd48('0x1c')](respondWithResult(_0xd88182,null))['catch'](handleError(_0xd88182,null));};exports[_0xcd48('0xc3')]=function(_0x59144a,_0x45fa31){return db[_0xcd48('0x32')][_0xcd48('0x5c')]({'where':{'id':_0x59144a[_0xcd48('0xae')]['id']}})[_0xcd48('0x1c')](handleEntityNotFound(_0x45fa31,null))[_0xcd48('0x1c')](function(_0x4d1bef){if(_0x4d1bef){return _0x4d1bef['removeTags'](_0x59144a['query'][_0xcd48('0xb4')]);}})[_0xcd48('0x1c')](respondWithStatusCode(_0x45fa31,null))[_0xcd48('0x29')](handleError(_0x45fa31,null));};exports[_0xcd48('0xc4')]=function(_0x45d928,_0x601861){var _0x5b4957=moment()[_0xcd48('0xc5')]()['toString']();var _0x3ba8aa=path['join'](config['root'],_0xcd48('0xc6'),_0xcd48('0xc7'),_0xcd48('0xc8'));var _0x337de0=path[_0xcd48('0xc9')](config[_0xcd48('0xca')],_0xcd48('0xc6'),'files',_0xcd48('0xcb'));var _0x3a9d84=path[_0xcd48('0xc9')](_0x3ba8aa,_0x5b4957);var _0x3cb49a=util[_0xcd48('0xb8')](_0xcd48('0xcc'),_0x45d928[_0xcd48('0xae')]['id'],_0x5b4957);var _0x10e0da=path['join'](_0x3ba8aa,_0x3cb49a);var _0x5aa31d=[];_0x5aa31d['push']({'model':db[_0xcd48('0x6c')],'as':_0xcd48('0x6c'),'attributes':['id',_0xcd48('0xcd')],'raw':!![]});_0x5aa31d[_0xcd48('0x28')]({'model':db[_0xcd48('0xce')],'as':_0xcd48('0x61'),'attributes':['id','firstName',_0xcd48('0xcf')],'raw':!![]});if(_0x45d928[_0xcd48('0x37')][_0xcd48('0xcb')]){_0x5aa31d[_0xcd48('0x28')]({'model':db['Attachment'],'as':_0xcd48('0xd0'),'raw':!![]});}var _0x3bf44e=[{'model':db[_0xcd48('0xb3')],'as':_0xcd48('0xd1'),'attributes':['id','body',_0xcd48('0xd2'),_0xcd48('0xd3'),'secret',_0xcd48('0x7b')],'include':_0x5aa31d}];_0x3bf44e[_0xcd48('0x28')]({'model':db[_0xcd48('0xd4')],'as':_0xcd48('0xd5'),'attributes':['id','name']});_0x3bf44e[_0xcd48('0x28')]({'model':db[_0xcd48('0x6c')],'as':_0xcd48('0xd6'),'attributes':['id',_0xcd48('0xcd')]});return db[_0xcd48('0x32')][_0xcd48('0x5c')]({'where':{'id':_0x45d928[_0xcd48('0xae')]['id']},'include':_0x3bf44e})[_0xcd48('0x1c')](handleEntityNotFound(_0x601861,null))[_0xcd48('0x1c')](function(_0x14e8af){if(_0x14e8af){var _0x566444=_0x14e8af[_0xcd48('0xd7')]({'plain':!![]});fs[_0xcd48('0xd8')](_0x3a9d84);var _0x206ce0={'channel':_0xcd48('0xd9'),'account':_0x566444[_0xcd48('0xd5')][_0xcd48('0x21')],'agent':_0x566444[_0xcd48('0xd6')]?_0x566444[_0xcd48('0xd6')][_0xcd48('0xcd')]:'N.A.','createdAt':moment(_0x566444[_0xcd48('0xd2')])['format'](_0xcd48('0xb9'))[_0xcd48('0x95')](),'closedAt':_0x566444[_0xcd48('0x2f')]?moment(_0x566444[_0xcd48('0xda')])[_0xcd48('0xb8')](_0xcd48('0xb9'))[_0xcd48('0x95')]():'','disposition':_0x566444['disposition'],'visibility':_0x566444[_0xcd48('0xdb')]?'Public':'Private','messages':_(_0x566444['Messages'])['filter']({'secret':![]})[_0xcd48('0x23')](function(_0x602c7b){if(_0x602c7b[_0xcd48('0xd0')]){var _0x540eac=path['join'](_0x337de0,_0x602c7b[_0xcd48('0xd0')]['basename']);if(fs[_0xcd48('0xdc')](_0x540eac)){fs['createReadStream'](_0x540eac)[_0xcd48('0xdd')](fs[_0xcd48('0xde')](path['join'](_0x3a9d84,_0x602c7b[_0xcd48('0xd0')][_0xcd48('0xdf')])));}}return{'date':moment(_0x602c7b[_0xcd48('0xd2')])['format'](_0xcd48('0xb9'))['toString'](),'sender':_0x602c7b[_0xcd48('0xd3')]===_0xcd48('0xe0')?_0x602c7b[_0xcd48('0x6c')]?_0x602c7b[_0xcd48('0x6c')][_0xcd48('0xcd')]:_0xcd48('0xe1'):_0x602c7b[_0xcd48('0x61')][_0xcd48('0xe2')]+(_0x602c7b[_0xcd48('0x61')][_0xcd48('0xcf')]?'\x20'+_0x602c7b[_0xcd48('0x61')][_0xcd48('0xcf')]:''),'body':_0x602c7b[_0xcd48('0xd0')]?_0x602c7b[_0xcd48('0xd0')][_0xcd48('0xdf')]:_0x602c7b[_0xcd48('0x6f')],'direction':_0x602c7b[_0xcd48('0xd3')]===_0xcd48('0xe0')?'A':'C','secret':_0x602c7b['secret'],'read':_0x602c7b[_0xcd48('0x7b')],'attachment':_0x602c7b[_0xcd48('0xd0')]};})[_0xcd48('0x5d')]()};return ejs[_0xcd48('0xe3')](path[_0xcd48('0xc9')](config[_0xcd48('0xca')],'server',_0xcd48('0xe4'),'downloadInteraction.ejs'),{'interaction':_0x206ce0})['then'](function(_0xa5b2d3){var _0x3ea845=path['join'](_0x3a9d84,'transcript-'+_0x566444['id']+'-'+_0x5b4957+_0xcd48('0xe5'));var _0x17fcf1={'path':_0x3ea845,'channel':_0xcd48('0xd9'),'interactionId':_0x566444['id']};return pdf[_0xcd48('0xe6')](_0xa5b2d3,_0x17fcf1);})[_0xcd48('0x1c')](function(){return new Promise(function(_0x545aa1,_0x3fb2b0){zipdir(_0x3a9d84,{'saveTo':_0x10e0da},function(_0x47be24,_0x514b1b){if(_0x47be24)return _0x3fb2b0(_0x47be24);return _0x545aa1(_0x514b1b);});})[_0xcd48('0x1c')](function(){return new Promise(function(_0x3c9afe,_0x45bc7a){rimraf(_0x3a9d84,function(_0x4d87e4){if(_0x4d87e4)_0x45bc7a(_0x4d87e4);return _0x3c9afe();});});})['then'](function(){return _0x601861[_0xcd48('0xc4')](_0x10e0da,_0x3cb49a,function(_0x8a8c56){if(_0x8a8c56){logger[_0xcd48('0x1f')](_0xcd48('0xe7'),_0x8a8c56);}else{fs[_0xcd48('0xe8')](_0x10e0da);}});});});}else{return _0x601861[_0xcd48('0x1e')](0xc8);}})[_0xcd48('0x29')](handleError(_0x601861,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cd1b29a..8fc4600 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 _0x9296=['map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','OpenchannelMessage','update','remove','getUsers','then','setDataValue'];(function(_0x3d8626,_0x270f36){var _0x41284e=function(_0x131b11){while(--_0x131b11){_0x3d8626['push'](_0x3d8626['shift']());}};_0x41284e(++_0x270f36);}(_0x9296,0x18f));var _0x6929=function(_0x1843ab,_0x4e0613){_0x1843ab=_0x1843ab-0x0;var _0x1ba44e=_0x9296[_0x1843ab];return _0x1ba44e;};'use strict';var EventEmitter=require(_0x6929('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x6929('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6929('0x2'),'afterDestroy':_0x6929('0x3')};function emitEvent(_0x4dfcfc){return function(_0x3e38df,_0x6a1de3,_0x186d0b){_0x3e38df[_0x6929('0x4')]({'attributes':['id'],'raw':!![]})[_0x6929('0x5')](function(_0x452d78){_0x3e38df[_0x6929('0x6')]('Users',_0x452d78[_0x6929('0x7')](function(_0x5c8744){return{'id':_0x5c8744['id']};}));return OpenchannelMessage[_0x6929('0x8')]({'where':{'OpenchannelInteractionId':_0x3e38df['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6929('0x5')](function(_0x1d02b1){_0x3e38df[_0x6929('0x6')](_0x6929('0x9'),_0x1d02b1['length']);OpenchannelInteractionEvents[_0x6929('0xa')](_0x4dfcfc+':'+_0x3e38df['id'],_0x3e38df);OpenchannelInteractionEvents[_0x6929('0xa')](_0x4dfcfc,_0x3e38df);_0x186d0b(null);})[_0x6929('0xb')](_0x186d0b(null));};}for(var e in events){if(events[_0x6929('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x6929('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc2d1=['save','update','getUsers','setDataValue','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x30c552,_0x2b82e5){var _0x19b79c=function(_0x4a8e42){while(--_0x4a8e42){_0x30c552['push'](_0x30c552['shift']());}};_0x19b79c(++_0x2b82e5);}(_0xc2d1,0x175));var _0x1c2d=function(_0x1b284b,_0x4d09ed){_0x1b284b=_0x1b284b-0x0;var _0x39df49=_0xc2d1[_0x1b284b];return _0x39df49;};'use strict';var EventEmitter=require(_0x1c2d('0x0'));var OpenchannelInteraction=require(_0x1c2d('0x1'))['db'][_0x1c2d('0x2')];var OpenchannelMessage=require(_0x1c2d('0x1'))['db'][_0x1c2d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1c2d('0x4')](0x0);var events={'afterCreate':_0x1c2d('0x5'),'afterUpdate':_0x1c2d('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3ce955){return function(_0x470105,_0x446cca,_0x19bb11){_0x470105[_0x1c2d('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2020bb){_0x470105[_0x1c2d('0x8')]('Users',_0x2020bb[_0x1c2d('0x9')](function(_0x3ba1ac){return{'id':_0x3ba1ac['id']};}));return OpenchannelMessage[_0x1c2d('0xa')]({'where':{'OpenchannelInteractionId':_0x470105['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c2d('0xb')](function(_0x5c31f5){_0x470105['setDataValue'](_0x1c2d('0xc'),_0x5c31f5[_0x1c2d('0xd')]);OpenchannelInteractionEvents[_0x1c2d('0xe')](_0x3ce955+':'+_0x470105['id'],_0x470105);OpenchannelInteractionEvents['emit'](_0x3ce955,_0x470105);_0x19bb11(null);})[_0x1c2d('0xf')](_0x19bb11(null));};}for(var e in events){if(events[_0x1c2d('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x1c2d('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 41858b8..8193104 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 _0xf527=['bluebird','request-promise','path','../../config/environment','exports','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf527,0x1bd));var _0x7f52=function(_0x1671c7,_0x36f775){_0x1671c7=_0x1671c7-0x0;var _0x160b76=_0xf527[_0x1671c7];return _0x160b76;};'use strict';var _=require(_0x7f52('0x0'));var util=require(_0x7f52('0x1'));var logger=require('../../config/logger')(_0x7f52('0x2'));var moment=require('moment');var BPromise=require(_0x7f52('0x3'));var rp=require(_0x7f52('0x4'));var fs=require('fs');var path=require(_0x7f52('0x5'));var rimraf=require('rimraf');var config=require(_0x7f52('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x7f52('0x7')]=function(_0x46fbfc,_0x12e858){return _0x46fbfc['define'](_0x7f52('0x8'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7f52('0x9'),'collate':_0x7f52('0xa'),'hooks':{'beforeUpdate':function(_0xd1c22d,_0x210f4c,_0x4d66ca){if(_0xd1c22d[_0x7f52('0xb')](_0x7f52('0xc'))){_0xd1c22d[_0x7f52('0xd')]=moment()[_0x7f52('0xe')](_0x7f52('0xf'));}_0x4d66ca(null,_0xd1c22d);}}});}; \ No newline at end of file +var _0x38e9=['define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x4afc6f,_0x43faa2){var _0x5660e3=function(_0x186025){while(--_0x186025){_0x4afc6f['push'](_0x4afc6f['shift']());}};_0x5660e3(++_0x43faa2);}(_0x38e9,0x1b7));var _0x938e=function(_0x360ec,_0x585d47){_0x360ec=_0x360ec-0x0;var _0xf03953=_0x38e9[_0x360ec];return _0xf03953;};'use strict';var _=require(_0x938e('0x0'));var util=require(_0x938e('0x1'));var logger=require(_0x938e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x938e('0x3'));var rp=require(_0x938e('0x4'));var fs=require('fs');var path=require(_0x938e('0x5'));var rimraf=require('rimraf');var config=require(_0x938e('0x6'));var attributes=require(_0x938e('0x7'));module[_0x938e('0x8')]=function(_0x29f1cd,_0x5b8786){return _0x29f1cd[_0x938e('0x9')]('OpenchannelInteraction',attributes,{'tableName':_0x938e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x938e('0xb'),'collate':_0x938e('0xc'),'hooks':{'beforeUpdate':function(_0x2c0bdd,_0x5d7bf6,_0x18c175){if(_0x2c0bdd[_0x938e('0xd')]('closed')){_0x2c0bdd[_0x938e('0xe')]=moment()[_0x938e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18c175(null,_0x2c0bdd);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index cae07a8..62ca36f 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 _0x9d52=['error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9d52,0x10e));var _0x29d5=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x9d52[_0xcaf223];return _0x17e00d;};'use strict';var _=require('lodash');var util=require(_0x29d5('0x0'));var moment=require(_0x29d5('0x1'));var BPromise=require(_0x29d5('0x2'));var rs=require(_0x29d5('0x3'));var fs=require('fs');var Redis=require(_0x29d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x29d5('0x5'));var logger=require(_0x29d5('0x6'))('rpc');var config=require(_0x29d5('0x7'));var jayson=require(_0x29d5('0x8'));var client=jayson[_0x29d5('0x9')][_0x29d5('0xa')]({'port':0x232a});config['redis']=_[_0x29d5('0xb')](config['redis'],{'host':_0x29d5('0xc'),'port':0x18eb});var socket=require(_0x29d5('0xd'))(new Redis(config[_0x29d5('0xe')]));require(_0x29d5('0xf'))[_0x29d5('0x10')](socket);function respondWithRpcPromise(_0x50083f,_0x451f17,_0x62df7){return new BPromise(function(_0x18aff8,_0x557e57){return client[_0x29d5('0x11')](_0x50083f,_0x62df7)[_0x29d5('0x12')](function(_0x1caf24){logger[_0x29d5('0x13')](_0x29d5('0x14'),_0x451f17,_0x29d5('0x15'));logger['debug'](_0x29d5('0x16'),_0x451f17,_0x29d5('0x15'),JSON[_0x29d5('0x17')](_0x1caf24));if(_0x1caf24['error']){if(_0x1caf24[_0x29d5('0x18')][_0x29d5('0x19')]===0x1f4){logger[_0x29d5('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x451f17,_0x1caf24[_0x29d5('0x18')]['message']);return _0x557e57(_0x1caf24[_0x29d5('0x18')][_0x29d5('0x1a')]);}logger['error'](_0x29d5('0x14'),_0x451f17,_0x1caf24[_0x29d5('0x18')][_0x29d5('0x1a')]);return _0x18aff8(_0x1caf24['error'][_0x29d5('0x1a')]);}else{logger[_0x29d5('0x13')](_0x29d5('0x14'),_0x451f17,'request\x20sent');_0x18aff8(_0x1caf24[_0x29d5('0x1b')]['message']);}})[_0x29d5('0x1c')](function(_0x2e2430){logger[_0x29d5('0x18')](_0x29d5('0x14'),_0x451f17,_0x2e2430);_0x557e57(_0x2e2430);});});}exports[_0x29d5('0x1d')]=function(_0xe3c8ee){var _0x4765a0=this;return new Promise(function(_0x1a2cdf,_0x41f926){return db[_0x29d5('0x1e')][_0x29d5('0x1f')](_0xe3c8ee['body'],{'raw':_0xe3c8ee['options']?_0xe3c8ee[_0x29d5('0x20')][_0x29d5('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3c8ee[_0x29d5('0x20')]?_0xe3c8ee[_0x29d5('0x20')][_0x29d5('0x22')]||null:null,'attributes':_0xe3c8ee['options']?_0xe3c8ee[_0x29d5('0x20')]['attributes']||null:null,'limit':_0xe3c8ee[_0x29d5('0x20')]?_0xe3c8ee[_0x29d5('0x20')]['limit']||null:null})[_0x29d5('0x12')](function(_0x251354){logger[_0x29d5('0x13')](_0x29d5('0x1d'),_0xe3c8ee);logger['debug']('UpdateOpenchannelInteraction',_0xe3c8ee,JSON[_0x29d5('0x17')](_0x251354));_0x1a2cdf(_0x251354);})[_0x29d5('0x1c')](function(_0x3ba3bc){logger[_0x29d5('0x18')](_0x29d5('0x1d'),_0x3ba3bc[_0x29d5('0x1a')],_0xe3c8ee);_0x41f926(_0x4765a0['error'](0x1f4,_0x3ba3bc[_0x29d5('0x1a')]));});});};exports[_0x29d5('0x23')]=function(_0x272d9e){return new Promise(function(_0x51cb77,_0x9f30ef){return db['OpenchannelInteraction'][_0x29d5('0x24')]({'where':_0x272d9e[_0x29d5('0x20')]?_0x272d9e[_0x29d5('0x20')]['where']||null:null})[_0x29d5('0x12')](function(_0x3a7075){if(_0x3a7075){return _0x3a7075[_0x29d5('0x25')](_0x272d9e['body'][_0x29d5('0x26')],_[_0x29d5('0x27')](_0x272d9e['body'],[_0x29d5('0x26'),'id'])||{});}})['spread'](function(_0x4da0c5){logger[_0x29d5('0x13')](_0x29d5('0x28'),_0x272d9e);logger[_0x29d5('0x29')]('AddTags',_0x272d9e,JSON[_0x29d5('0x17')](_0x4da0c5));_0x51cb77(_0x4da0c5);})['catch'](function(_0x2227dd){logger[_0x29d5('0x18')](_0x29d5('0x28'),_0x2227dd[_0x29d5('0x1a')],_0x272d9e);_0x9f30ef(_this[_0x29d5('0x18')](0x1f4,_0x2227dd[_0x29d5('0x1a')]));});});}; \ No newline at end of file +var _0x249a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelInteraction.socket','register','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','OpenchannelInteraction','body','options','raw','where','limit','UpdateOpenchannelInteraction','stringify','catch','AddTagsToOpenchannelInteraction','addTags','ids','spread','AddTags','lodash','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x249a,0x12d));var _0xa249=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x249a[_0x39d544];return _0x5a5ff2;};'use strict';var _=require(_0xa249('0x0'));var util=require('util');var moment=require(_0xa249('0x1'));var BPromise=require(_0xa249('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa249('0x3'));var db=require(_0xa249('0x4'))['db'];var utils=require(_0xa249('0x5'));var logger=require(_0xa249('0x6'))('rpc');var config=require(_0xa249('0x7'));var jayson=require(_0xa249('0x8'));var client=jayson[_0xa249('0x9')][_0xa249('0xa')]({'port':0x232a});config[_0xa249('0xb')]=_[_0xa249('0xc')](config[_0xa249('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa249('0xd'))[_0xa249('0xe')](socket);function respondWithRpcPromise(_0x58f6a2,_0x5cf117,_0x3edf87){return new BPromise(function(_0x4ce09f,_0x5bb1d4){return client['request'](_0x58f6a2,_0x3edf87)[_0xa249('0xf')](function(_0x5333dd){logger[_0xa249('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5cf117,_0xa249('0x11'));logger[_0xa249('0x12')](_0xa249('0x13'),_0x5cf117,_0xa249('0x11'),JSON['stringify'](_0x5333dd));if(_0x5333dd['error']){if(_0x5333dd[_0xa249('0x14')][_0xa249('0x15')]===0x1f4){logger['error'](_0xa249('0x16'),_0x5cf117,_0x5333dd[_0xa249('0x14')][_0xa249('0x17')]);return _0x5bb1d4(_0x5333dd['error'][_0xa249('0x17')]);}logger[_0xa249('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5cf117,_0x5333dd[_0xa249('0x14')][_0xa249('0x17')]);return _0x4ce09f(_0x5333dd[_0xa249('0x14')]['message']);}else{logger[_0xa249('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5cf117,_0xa249('0x11'));_0x4ce09f(_0x5333dd['result'][_0xa249('0x17')]);}})['catch'](function(_0x48fe61){logger[_0xa249('0x14')](_0xa249('0x16'),_0x5cf117,_0x48fe61);_0x5bb1d4(_0x48fe61);});});}exports['UpdateOpenchannelInteraction']=function(_0x46a50b){var _0x5c7f2a=this;return new Promise(function(_0x193d6e,_0x2131a2){return db[_0xa249('0x18')]['update'](_0x46a50b[_0xa249('0x19')],{'raw':_0x46a50b['options']?_0x46a50b[_0xa249('0x1a')][_0xa249('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a50b[_0xa249('0x1a')]?_0x46a50b[_0xa249('0x1a')][_0xa249('0x1c')]||null:null,'attributes':_0x46a50b[_0xa249('0x1a')]?_0x46a50b['options']['attributes']||null:null,'limit':_0x46a50b[_0xa249('0x1a')]?_0x46a50b[_0xa249('0x1a')][_0xa249('0x1d')]||null:null})[_0xa249('0xf')](function(_0x9f929e){logger[_0xa249('0x10')]('UpdateOpenchannelInteraction',_0x46a50b);logger[_0xa249('0x12')](_0xa249('0x1e'),_0x46a50b,JSON[_0xa249('0x1f')](_0x9f929e));_0x193d6e(_0x9f929e);})[_0xa249('0x20')](function(_0x2ba001){logger[_0xa249('0x14')]('UpdateOpenchannelInteraction',_0x2ba001[_0xa249('0x17')],_0x46a50b);_0x2131a2(_0x5c7f2a[_0xa249('0x14')](0x1f4,_0x2ba001['message']));});});};exports[_0xa249('0x21')]=function(_0x550403){return new Promise(function(_0x3e060c,_0x4e4207){return db[_0xa249('0x18')]['find']({'where':_0x550403['options']?_0x550403['options']['where']||null:null})[_0xa249('0xf')](function(_0x2d270f){if(_0x2d270f){return _0x2d270f[_0xa249('0x22')](_0x550403[_0xa249('0x19')][_0xa249('0x23')],_['omit'](_0x550403[_0xa249('0x19')],[_0xa249('0x23'),'id'])||{});}})[_0xa249('0x24')](function(_0x5dcf13){logger[_0xa249('0x10')](_0xa249('0x25'),_0x550403);logger[_0xa249('0x12')](_0xa249('0x25'),_0x550403,JSON[_0xa249('0x1f')](_0x5dcf13));_0x3e060c(_0x5dcf13);})[_0xa249('0x20')](function(_0x3c6b4a){logger['error'](_0xa249('0x25'),_0x3c6b4a[_0xa249('0x17')],_0x550403);_0x4e4207(_this[_0xa249('0x14')](0x1f4,_0x3c6b4a[_0xa249('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 596eb82..1bb0b94 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 _0xde97=['save','remove','update','emit','removeListener','register','./openchannelInteraction.events'];(function(_0x4f814c,_0x3e2c4b){var _0x37bccf=function(_0x40f774){while(--_0x40f774){_0x4f814c['push'](_0x4f814c['shift']());}};_0x37bccf(++_0x3e2c4b);}(_0xde97,0x1d4));var _0x7de9=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xde97[_0x173113];return _0x3bea89;};'use strict';var OpenchannelInteractionEvents=require(_0x7de9('0x0'));var events=[_0x7de9('0x1'),_0x7de9('0x2'),_0x7de9('0x3')];function createListener(_0x408991,_0x34c2ad){return function(_0x2006e2){_0x34c2ad[_0x7de9('0x4')](_0x408991,_0x2006e2);};}function removeListener(_0xb59ee7,_0x482385){return function(){OpenchannelInteractionEvents[_0x7de9('0x5')](_0xb59ee7,_0x482385);};}exports[_0x7de9('0x6')]=function(_0x19d90d){for(var _0x2139e3=0x0,_0x4ad91c=events['length'];_0x2139e3<_0x4ad91c;_0x2139e3++){var _0x42662a=events[_0x2139e3];var _0x542edb=createListener('openchannelInteraction:'+_0x42662a,_0x19d90d);OpenchannelInteractionEvents['on'](_0x42662a,_0x542edb);}}; \ No newline at end of file +var _0x8a5c=['remove','emit','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save'];(function(_0x504805,_0x2d0e85){var _0x485eee=function(_0x20e646){while(--_0x20e646){_0x504805['push'](_0x504805['shift']());}};_0x485eee(++_0x2d0e85);}(_0x8a5c,0x101));var _0xc8a5=function(_0x19d9fe,_0x3daae0){_0x19d9fe=_0x19d9fe-0x0;var _0x36884f=_0x8a5c[_0x19d9fe];return _0x36884f;};'use strict';var OpenchannelInteractionEvents=require(_0xc8a5('0x0'));var events=[_0xc8a5('0x1'),_0xc8a5('0x2'),'update'];function createListener(_0x476358,_0x1947ec){return function(_0x191500){_0x1947ec[_0xc8a5('0x3')](_0x476358,_0x191500);};}function removeListener(_0x463584,_0x2abdaf){return function(){OpenchannelInteractionEvents[_0xc8a5('0x4')](_0x463584,_0x2abdaf);};}exports[_0xc8a5('0x5')]=function(_0x1d5c16){for(var _0x1c9a5c=0x0,_0x362cc7=events['length'];_0x1c9a5c<_0x362cc7;_0x1c9a5c++){var _0x3106e2=events[_0x1c9a5c];var _0x41f141=createListener(_0xc8a5('0x6')+_0x3106e2,_0x1d5c16);OpenchannelInteractionEvents['on'](_0x3106e2,_0x41f141);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9fde8fd..9bf4f95 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x591f27,_0x36a050){var _0x464a4a=function(_0x5026a3){while(--_0x5026a3){_0x591f27['push'](_0x591f27['shift']());}};_0x464a4a(++_0x36a050);}(_0xe706,0xa3));var _0x6e70=function(_0x4f8100,_0x928620){_0x4f8100=_0x4f8100-0x0;var _0x360262=_0xe706[_0x4f8100];return _0x360262;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x5a31ac,_0x5983d6){var _0x2908a8=function(_0x220d49){while(--_0x220d49){_0x5a31ac['push'](_0x5a31ac['shift']());}};_0x2908a8(++_0x5983d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 167185a..e19e14b 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 _0x2cae=['out','DATE','STRING','sequelize','exports','BOOLEAN'];(function(_0x1e502e,_0x1f0461){var _0x92be9=function(_0x483676){while(--_0x483676){_0x1e502e['push'](_0x1e502e['shift']());}};_0x92be9(++_0x1f0461);}(_0x2cae,0x16b));var _0xe2ca=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x2cae[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0xe2ca('0x0'));module[_0xe2ca('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe2ca('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2ca('0x3')),'defaultValue':_0xe2ca('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe2ca('0x4')]},'providerName':{'type':Sequelize[_0xe2ca('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xac4a=['exports','TEXT','medium','BOOLEAN','out','DATE','STRING','sequelize'];(function(_0x423707,_0x5ee5dc){var _0x49f562=function(_0x28a2a0){while(--_0x28a2a0){_0x423707['push'](_0x423707['shift']());}};_0x49f562(++_0x5ee5dc);}(_0xac4a,0x13f));var _0xaac4=function(_0x169f51,_0x5d2c5d){_0x169f51=_0x169f51-0x0;var _0x59bd49=_0xac4a[_0x169f51];return _0x59bd49;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'body':{'type':Sequelize[_0xaac4('0x2')](_0xaac4('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaac4('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xaac4('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaac4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaac4('0x6')]},'providerName':{'type':Sequelize[_0xaac4('0x7')]},'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 976f7c9..1cfd106 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 _0x19d0=['end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields','length','create','body','find','describe','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','Sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','openchannel-interactions','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status'];(function(_0x4f31f6,_0x1ff7a6){var _0x4c11ee=function(_0x2b4bb5){while(--_0x2b4bb5){_0x4f31f6['push'](_0x4f31f6['shift']());}};_0x4c11ee(++_0x1ff7a6);}(_0x19d0,0xd9));var _0x019d=function(_0x57da1e,_0x311ec3){_0x57da1e=_0x57da1e-0x0;var _0x18fa2c=_0x19d0[_0x57da1e];return _0x18fa2c;};'use strict';var emlformat=require(_0x019d('0x0'));var rimraf=require(_0x019d('0x1'));var zipdir=require(_0x019d('0x2'));var jsonpatch=require(_0x019d('0x3'));var rp=require(_0x019d('0x4'));var moment=require(_0x019d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x019d('0x6'));var util=require(_0x019d('0x7'));var path=require(_0x019d('0x8'));var sox=require(_0x019d('0x9'));var csv=require(_0x019d('0xa'));var ejs=require(_0x019d('0xb'));var fs=require('fs');var fs_extra=require(_0x019d('0xc'));var _=require(_0x019d('0xd'));var squel=require(_0x019d('0xe'));var crypto=require(_0x019d('0xf'));var jsforce=require(_0x019d('0x10'));var deskjs=require(_0x019d('0x11'));var toCsv=require(_0x019d('0xa'));var querystring=require(_0x019d('0x12'));var Papa=require(_0x019d('0x13'));var Redis=require(_0x019d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x019d('0x15'));var as=require(_0x019d('0x16'));var hardwareService=require(_0x019d('0x17'));var logger=require(_0x019d('0x18'))(_0x019d('0x19'));var utils=require(_0x019d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x019d('0x1b'));var db=require('../../mysqldb')['db'];config[_0x019d('0x1c')]=_['defaults'](config[_0x019d('0x1c')],{'host':_0x019d('0x1d'),'port':0x18eb});var socket=require(_0x019d('0x1e'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x019d('0x1f')](socket);var jayson=require(_0x019d('0x20'));var client=jayson['client'][_0x019d('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebd56,_0x4a449e,_0x513a6e,_0x1c820d){return new BPromise(function(_0x281058,_0x50f685){var _0x19951a=_0x1c820d||client;return _0x19951a['request'](_0x1ebd56,_0x513a6e)[_0x019d('0x22')](function(_0x12e732){logger[_0x019d('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x4a449e,_0x019d('0x24'));logger[_0x019d('0x25')](_0x019d('0x26'),_0x4a449e,'request\x20sent',JSON[_0x019d('0x27')](_0x12e732));if(_0x12e732[_0x019d('0x28')]){if(_0x12e732[_0x019d('0x28')][_0x019d('0x29')]===0x1f4){logger[_0x019d('0x28')](_0x019d('0x2a'),_0x4a449e,_0x12e732[_0x019d('0x28')]['message']);return _0x50f685(_0x12e732['error']['message']);}logger[_0x019d('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x4a449e,_0x12e732['error'][_0x019d('0x2b')]);return _0x281058(_0x12e732['error']['message']);}else{logger[_0x019d('0x23')](_0x019d('0x2a'),_0x4a449e,_0x019d('0x24'));_0x281058(_0x12e732['result']['message']);}})[_0x019d('0x2c')](function(_0x1b3644){logger['error'](_0x019d('0x2a'),_0x4a449e,_0x1b3644);_0x50f685(_0x1b3644);});});}function respondWithStatusCode(_0x553cae,_0x331327){_0x331327=_0x331327||0xcc;return function(_0x3027ed){if(_0x3027ed){return _0x553cae[_0x019d('0x2d')](_0x331327);}return _0x553cae[_0x019d('0x2e')](_0x331327)[_0x019d('0x2f')]();};}function respondWithResult(_0x22f525,_0xe375c8){_0xe375c8=_0xe375c8||0xc8;return function(_0xd01f13){if(_0xd01f13){return _0x22f525[_0x019d('0x2e')](_0xe375c8)[_0x019d('0x30')](_0xd01f13);}};}function respondWithFilteredResult(_0x1db0a1,_0x4be13e){return function(_0x53186c){if(_0x53186c){var _0x2cae7a=typeof _0x4be13e[_0x019d('0x31')]===_0x019d('0x32')&&typeof _0x4be13e[_0x019d('0x33')]===_0x019d('0x32');var _0x2f5184=_0x53186c[_0x019d('0x34')];var _0x51a6fe=_0x2cae7a?0x0:_0x4be13e[_0x019d('0x31')];var _0x471cda=_0x2cae7a?_0x53186c[_0x019d('0x34')]:_0x4be13e[_0x019d('0x31')]+_0x4be13e[_0x019d('0x33')];var _0x5893cf;if(_0x471cda>=_0x2f5184){_0x471cda=_0x2f5184;_0x5893cf=0xc8;}else{_0x5893cf=0xce;}_0x1db0a1[_0x019d('0x2e')](_0x5893cf);return _0x1db0a1[_0x019d('0x35')]('Content-Range',_0x51a6fe+'-'+_0x471cda+'/'+_0x2f5184)[_0x019d('0x30')](_0x53186c);}return null;};}function patchUpdates(_0x51bc40){return function(_0x15a703){try{jsonpatch[_0x019d('0x36')](_0x15a703,_0x51bc40,!![]);}catch(_0x284100){return BPromise[_0x019d('0x37')](_0x284100);}return _0x15a703[_0x019d('0x38')]();};}function saveUpdates(_0x325e8c,_0x567163){return function(_0x3ff494){if(_0x3ff494){return _0x3ff494[_0x019d('0x39')](_0x325e8c)['then'](function(_0x40f69f){return _0x40f69f;});}return null;};}function removeEntity(_0x560e5d,_0x3812a9){return function(_0x31771b){if(_0x31771b){return _0x31771b[_0x019d('0x3a')]()[_0x019d('0x22')](function(){_0x560e5d[_0x019d('0x2e')](0xcc)[_0x019d('0x2f')]();});}};}function handleEntityNotFound(_0x529a91,_0x2b7840){return function(_0x52129b){if(!_0x52129b){_0x529a91[_0x019d('0x2d')](0x194);}return _0x52129b;};}function handleError(_0x270651,_0x430231){_0x430231=_0x430231||0x1f4;return function(_0x26757c){logger['error'](_0x26757c[_0x019d('0x3b')]);if(_0x26757c[_0x019d('0x3c')]){delete _0x26757c['name'];}_0x270651[_0x019d('0x2e')](_0x430231)[_0x019d('0x3d')](_0x26757c);};}exports['index']=function(_0x5b3fde,_0x1f17c0){var _0x45401c={},_0x12f811={},_0x4695de={'count':0x0,'rows':[]};var _0x405471=_[_0x019d('0x3e')](db[_0x019d('0x3f')][_0x019d('0x40')],function(_0x1fb259){return{'name':_0x1fb259[_0x019d('0x41')],'type':_0x1fb259['type'][_0x019d('0x42')]};});_0x12f811['model']=_[_0x019d('0x3e')](_0x405471,_0x019d('0x3c'));_0x12f811['query']=_[_0x019d('0x43')](_0x5b3fde['query']);_0x12f811['filters']=_[_0x019d('0x44')](_0x12f811[_0x019d('0x45')],_0x12f811['query']);_0x45401c['attributes']=_[_0x019d('0x44')](_0x12f811[_0x019d('0x45')],qs['fields'](_0x5b3fde[_0x019d('0x46')]['fields']));_0x45401c['attributes']=_0x45401c[_0x019d('0x47')]['length']?_0x45401c[_0x019d('0x47')]:_0x12f811[_0x019d('0x45')];if(!_0x5b3fde['query'][_0x019d('0x48')]('nolimit')){_0x45401c[_0x019d('0x33')]=qs[_0x019d('0x33')](_0x5b3fde[_0x019d('0x46')][_0x019d('0x33')]);_0x45401c['offset']=qs['offset'](_0x5b3fde[_0x019d('0x46')]['offset']);}_0x45401c[_0x019d('0x49')]=qs[_0x019d('0x4a')](_0x5b3fde[_0x019d('0x46')]['sort']);_0x45401c[_0x019d('0x4b')]=qs[_0x019d('0x4c')](_[_0x019d('0x4d')](_0x5b3fde[_0x019d('0x46')],_0x12f811[_0x019d('0x4c')]),_0x405471);if(_0x5b3fde['query'][_0x019d('0x4e')]){_0x45401c[_0x019d('0x4b')]=_[_0x019d('0x4f')](_0x45401c[_0x019d('0x4b')],{'$or':_['map'](_0x405471,function(_0x4c6da9){if(_0x4c6da9[_0x019d('0x50')]!==_0x019d('0x51')){var _0x2c06b6={};_0x2c06b6[_0x4c6da9[_0x019d('0x3c')]]={'$like':'%'+_0x5b3fde['query'][_0x019d('0x4e')]+'%'};return _0x2c06b6;}})});}_0x45401c=_['merge']({},_0x45401c,_0x5b3fde[_0x019d('0x52')]);var _0x29792={'where':_0x45401c[_0x019d('0x4b')]};return db[_0x019d('0x3f')][_0x019d('0x34')](_0x29792)[_0x019d('0x22')](function(_0x29a2a0){_0x4695de[_0x019d('0x34')]=_0x29a2a0;if(_0x5b3fde[_0x019d('0x46')][_0x019d('0x53')]){_0x45401c[_0x019d('0x54')]=[{'all':!![]}];}return db[_0x019d('0x3f')]['findAll'](_0x45401c);})[_0x019d('0x22')](function(_0x5ec20c){_0x4695de[_0x019d('0x55')]=_0x5ec20c;return _0x4695de;})[_0x019d('0x22')](respondWithFilteredResult(_0x1f17c0,_0x45401c))[_0x019d('0x2c')](handleError(_0x1f17c0,null));};exports[_0x019d('0x56')]=function(_0x104868,_0x2629d0){var _0x2c6985={'raw':!![],'where':{'id':_0x104868[_0x019d('0x57')]['id']}},_0x109672={};_0x109672[_0x019d('0x45')]=_[_0x019d('0x43')](db[_0x019d('0x3f')][_0x019d('0x40')]);_0x109672['query']=_[_0x019d('0x43')](_0x104868[_0x019d('0x46')]);_0x109672[_0x019d('0x4c')]=_[_0x019d('0x44')](_0x109672[_0x019d('0x45')],_0x109672[_0x019d('0x46')]);_0x2c6985[_0x019d('0x47')]=_[_0x019d('0x44')](_0x109672[_0x019d('0x45')],qs[_0x019d('0x58')](_0x104868[_0x019d('0x46')][_0x019d('0x58')]));_0x2c6985[_0x019d('0x47')]=_0x2c6985['attributes'][_0x019d('0x59')]?_0x2c6985[_0x019d('0x47')]:_0x109672[_0x019d('0x45')];if(_0x104868['query'][_0x019d('0x53')]){_0x2c6985[_0x019d('0x54')]=[{'all':!![]}];}_0x2c6985=_[_0x019d('0x4f')]({},_0x2c6985,_0x104868[_0x019d('0x52')]);return db[_0x019d('0x3f')]['find'](_0x2c6985)[_0x019d('0x22')](handleEntityNotFound(_0x2629d0,null))['then'](respondWithResult(_0x2629d0,null))[_0x019d('0x2c')](handleError(_0x2629d0,null));};exports[_0x019d('0x5a')]=function(_0x5312b6,_0x1433da){return db['OpenchannelMessage']['create'](_0x5312b6[_0x019d('0x5b')],{})[_0x019d('0x22')](respondWithResult(_0x1433da,0xc9))[_0x019d('0x2c')](handleError(_0x1433da,null));};exports['update']=function(_0x1d14b3,_0x120493){if(_0x1d14b3['body']['id']){delete _0x1d14b3[_0x019d('0x5b')]['id'];}return db[_0x019d('0x3f')][_0x019d('0x5c')]({'where':{'id':_0x1d14b3[_0x019d('0x57')]['id']}})[_0x019d('0x22')](handleEntityNotFound(_0x120493,null))[_0x019d('0x22')](saveUpdates(_0x1d14b3['body'],null))[_0x019d('0x22')](respondWithResult(_0x120493,null))[_0x019d('0x2c')](handleError(_0x120493,null));};exports[_0x019d('0x3a')]=function(_0x5f2290,_0x4e11c4){return db[_0x019d('0x3f')][_0x019d('0x5c')]({'where':{'id':_0x5f2290[_0x019d('0x57')]['id']}})[_0x019d('0x22')](handleEntityNotFound(_0x4e11c4,null))[_0x019d('0x22')](removeEntity(_0x4e11c4,null))[_0x019d('0x2c')](handleError(_0x4e11c4,null));};exports[_0x019d('0x5d')]=function(_0x23988b,_0x3a06c5){return db[_0x019d('0x3f')][_0x019d('0x5d')]()[_0x019d('0x22')](respondWithResult(_0x3a06c5,null))['catch'](handleError(_0x3a06c5,null));};var interaction_log=require(_0x019d('0x18'))('openchannel-interactions');exports['accept']=function(_0x2ae978,_0x4a6f77,_0x207550){var _0x3f6c32={'agent':{},'channel':_0x019d('0x5e')};if(_0x2ae978[_0x019d('0x5b')]['id']){delete _0x2ae978[_0x019d('0x5b')]['id'];}_0x2ae978[_0x019d('0x5b')][_0x019d('0x5f')]=!![];_0x2ae978[_0x019d('0x5b')][_0x019d('0x60')]=moment()['format'](_0x019d('0x61'));_0x2ae978[_0x019d('0x5b')][_0x019d('0x62')]=_0x2ae978['body'][_0x019d('0x62')]||_0x2ae978[_0x019d('0x63')]['id'];_0x3f6c32[_0x019d('0x64')]['id']=_0x2ae978[_0x019d('0x5b')][_0x019d('0x62')];return db[_0x019d('0x3f')]['find']({'where':{'id':_0x2ae978['params']['id'],'UserId':null}})[_0x019d('0x22')](handleEntityNotFound(_0x4a6f77,null))[_0x019d('0x22')](saveUpdates(_0x2ae978[_0x019d('0x5b')],null))['then'](function(_0x38ef00){if(_0x38ef00){_0x3f6c32[_0x019d('0x2b')]=_0x38ef00['get']({'plain':!![]});return db[_0x019d('0x65')][_0x019d('0x5c')]({'where':{'id':_0x38ef00['OpenchannelInteractionId']}});}return null;})[_0x019d('0x22')](handleEntityNotFound(_0x4a6f77,null))[_0x019d('0x22')](function(_0x2f7229){if(_0x2f7229){return _0x2f7229[_0x019d('0x39')]({'UserId':_0x2ae978[_0x019d('0x5b')][_0x019d('0x62')],'read1stAt':_[_0x019d('0x66')](_0x2f7229[_0x019d('0x67')])?moment()[_0x019d('0x68')](_0x019d('0x61')):undefined});}return null;})[_0x019d('0x22')](function(_0x715654){if(_0x715654){_0x3f6c32[_0x019d('0x69')]=_0x715654['get']({'plain':!![]});interaction_log[_0x019d('0x23')](_0x019d('0x6a'),_0x2ae978[_0x019d('0x63')]['id'],_0x2ae978[_0x019d('0x63')][_0x019d('0x3c')],_0x2ae978[_0x019d('0x63')]['role'],_0x3f6c32[_0x019d('0x69')]['id'],_0x2ae978[_0x019d('0x5b')]?JSON[_0x019d('0x27')](_0x2ae978[_0x019d('0x5b')]):_0x019d('0x6b'));return respondWithRpcPromise(_0x019d('0x6c'),_0x019d('0x6d'),_0x3f6c32);}return null;})[_0x019d('0x22')](function(_0x111508){var _0x3be99a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x111508[_0x019d('0x2b')]['ContactId'];return db['sequelize'][_0x019d('0x46')](_0x3be99a,{'type':db[_0x019d('0x6e')]['QueryTypes'][_0x019d('0x6f')],'raw':!![]})['then'](function(_0x579049){return _0x579049;});})[_0x019d('0x22')](function(_0x289918){if(_0x289918){_0x3f6c32[_0x019d('0x2b')][_0x019d('0x70')]=_0x289918[0x0];if(!_0x2ae978[_0x019d('0x5b')][_0x019d('0x62')])return;return db[_0x019d('0x71')]['find']({'where':{'id':_0x2ae978[_0x019d('0x5b')][_0x019d('0x62')],'role':_0x019d('0x64')},'attributes':['id',_0x019d('0x3c'),_0x019d('0x72'),_0x019d('0x73'),_0x019d('0x74')],'raw':!![]});}return null;})['then'](function(_0x2aea89){if(!_0x2aea89)return null;_0x3f6c32[_0x019d('0x2b')][_0x019d('0x64')]=_0x2aea89;return _0x3f6c32;})[_0x019d('0x22')](function(_0xb40d32){if(_0xb40d32){if(_0x2ae978[_0x019d('0x5b')][_0x019d('0x75')]){_0x3f6c32[_0x019d('0x2b')]['interface']=util['format'](_0x019d('0x76'),_0x2ae978['user'][_0x019d('0x3c')]);_0x3f6c32[_0x019d('0x2b')][_0x019d('0x77')]=_0x3f6c32[_0x019d('0x77')];_0x3f6c32[_0x019d('0x2b')][_0x019d('0x78')]=_0x3f6c32['channel'];_0x3f6c32[_0x019d('0x2b')]['event']='accept';return respondWithRpcPromise(_0x019d('0x79'),_0x019d('0x79'),{'event':'acceptmessage','message':_0x3f6c32[_0x019d('0x2b')]},client9002)['then'](function(){return _0x3f6c32;});}return _0x3f6c32;}return null;})[_0x019d('0x22')](respondWithResult(_0x4a6f77,null))['catch'](handleError(_0x4a6f77,null));};var interaction_log=require(_0x019d('0x18'))(_0x019d('0x7a'));exports[_0x019d('0x37')]=function(_0x4593c7,_0x3904d3,_0x4f09e8){var _0x150fbc={'agent':{},'channel':_0x019d('0x5e')};if(_0x4593c7['body']['id']){delete _0x4593c7['body']['id'];}_0x4593c7[_0x019d('0x5b')]['UserId']=_0x4593c7[_0x019d('0x5b')][_0x019d('0x62')]||_0x4593c7[_0x019d('0x63')]['id'];_0x150fbc[_0x019d('0x64')]['id']=_0x4593c7[_0x019d('0x5b')]['UserId'];return db[_0x019d('0x3f')][_0x019d('0x5c')]({'where':{'id':_0x4593c7[_0x019d('0x57')]['id'],'UserId':null}})[_0x019d('0x22')](handleEntityNotFound(_0x3904d3,null))[_0x019d('0x22')](function(_0xf99dab){if(_0xf99dab){_0x150fbc[_0x019d('0x2b')]=_0xf99dab['get']({'plain':!![]});return db[_0x019d('0x65')][_0x019d('0x5c')]({'where':{'id':_0xf99dab['OpenchannelInteractionId']}});}return null;})[_0x019d('0x22')](handleEntityNotFound(_0x3904d3,null))[_0x019d('0x22')](function(_0x132f37){if(_0x132f37){_0x150fbc[_0x019d('0x69')]=_0x132f37[_0x019d('0x7b')]({'plain':!![]});interaction_log[_0x019d('0x23')](_0x019d('0x7c'),_0x4593c7[_0x019d('0x63')]['id'],_0x4593c7[_0x019d('0x63')][_0x019d('0x3c')],_0x4593c7['user'][_0x019d('0x7d')],_0x150fbc['interaction']['id'],_0x4593c7[_0x019d('0x5b')]?JSON[_0x019d('0x27')](_0x4593c7[_0x019d('0x5b')]):_0x019d('0x6b'));return respondWithRpcPromise(_0x019d('0x7e'),'rejectMessage',_0x150fbc);}return null;})[_0x019d('0x22')](function(_0x17566f){var _0xb8088b=_0x019d('0x7f')+_0x17566f[_0x019d('0x2b')][_0x019d('0x80')];return db[_0x019d('0x81')][_0x019d('0x46')](_0xb8088b,{'type':db['Sequelize']['QueryTypes'][_0x019d('0x6f')],'raw':!![]})[_0x019d('0x22')](function(_0x5d1c49){return _0x5d1c49;});})['then'](function(_0x35dbfb){if(_0x35dbfb){_0x150fbc[_0x019d('0x2b')][_0x019d('0x70')]=_0x35dbfb[0x0];if(!_0x4593c7['body'][_0x019d('0x62')])return;return db[_0x019d('0x71')][_0x019d('0x5c')]({'where':{'id':_0x4593c7[_0x019d('0x5b')][_0x019d('0x62')],'role':_0x019d('0x64')},'attributes':['id',_0x019d('0x3c'),_0x019d('0x72'),'email',_0x019d('0x74')],'raw':!![]});}return null;})['then'](function(_0x22832e){if(!_0x22832e)return null;_0x150fbc['message']['agent']=_0x22832e;return _0x150fbc;})[_0x019d('0x22')](function(_0x501c93){if(_0x501c93){_0x501c93[_0x019d('0x2b')][_0x019d('0x82')]=util[_0x019d('0x68')](_0x019d('0x76'),_0x4593c7[_0x019d('0x63')]['name']);_0x501c93[_0x019d('0x2b')][_0x019d('0x77')]=_0x150fbc[_0x019d('0x77')];_0x501c93['message'][_0x019d('0x78')]=_0x150fbc[_0x019d('0x77')];_0x501c93[_0x019d('0x2b')]['event']=_0x019d('0x37');respondWithRpcPromise('EventManager',_0x019d('0x79'),{'event':_0x019d('0x83'),'message':_0x501c93[_0x019d('0x2b')]},client9002);return _0x150fbc;}return null;})[_0x019d('0x22')](respondWithResult(_0x3904d3,null))[_0x019d('0x2c')](handleError(_0x3904d3,null));}; \ No newline at end of file +var _0x58c0=['model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','create','update','body','destroy','describe','openchannel-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','fullname','email','internal','manual','interface','format','SIP/%s','motionChannel','channel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes'];(function(_0x26647a,_0x4bcaf3){var _0x1dd311=function(_0x136475){while(--_0x136475){_0x26647a['push'](_0x26647a['shift']());}};_0x1dd311(++_0x4bcaf3);}(_0x58c0,0x1de));var _0x058c=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x58c0[_0x1df7b8];return _0x29d911;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x058c('0x0'));var zipdir=require(_0x058c('0x1'));var jsonpatch=require(_0x058c('0x2'));var rp=require(_0x058c('0x3'));var moment=require(_0x058c('0x4'));var BPromise=require(_0x058c('0x5'));var Mustache=require(_0x058c('0x6'));var util=require('util');var path=require(_0x058c('0x7'));var sox=require(_0x058c('0x8'));var csv=require(_0x058c('0x9'));var ejs=require(_0x058c('0xa'));var fs=require('fs');var fs_extra=require(_0x058c('0xb'));var _=require(_0x058c('0xc'));var squel=require('squel');var crypto=require(_0x058c('0xd'));var jsforce=require(_0x058c('0xe'));var deskjs=require(_0x058c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x058c('0x10'));var Papa=require(_0x058c('0x11'));var Redis=require('ioredis');var authService=require(_0x058c('0x12'));var qs=require(_0x058c('0x13'));var as=require(_0x058c('0x14'));var hardwareService=require(_0x058c('0x15'));var logger=require(_0x058c('0x16'))('api');var utils=require(_0x058c('0x17'));var config=require(_0x058c('0x18'));var licenseUtil=require(_0x058c('0x19'));var db=require(_0x058c('0x1a'))['db'];config[_0x058c('0x1b')]=_[_0x058c('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x058c('0x1d'))(new Redis(config[_0x058c('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x058c('0x1e'));var client=jayson['client'][_0x058c('0x1f')]({'port':0x232c});var client9002=jayson[_0x058c('0x20')][_0x058c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5c14c6,_0x46b194,_0x15582a,_0x14d9ab){return new BPromise(function(_0x4dded5,_0x56ff0b){var _0x303599=_0x14d9ab||client;return _0x303599['request'](_0x5c14c6,_0x15582a)[_0x058c('0x21')](function(_0x2a57c1){logger[_0x058c('0x22')](_0x058c('0x23'),_0x46b194,_0x058c('0x24'));logger[_0x058c('0x25')](_0x058c('0x26'),_0x46b194,'request\x20sent',JSON['stringify'](_0x2a57c1));if(_0x2a57c1['error']){if(_0x2a57c1['error'][_0x058c('0x27')]===0x1f4){logger[_0x058c('0x28')](_0x058c('0x23'),_0x46b194,_0x2a57c1['error'][_0x058c('0x29')]);return _0x56ff0b(_0x2a57c1[_0x058c('0x28')][_0x058c('0x29')]);}logger[_0x058c('0x28')](_0x058c('0x23'),_0x46b194,_0x2a57c1[_0x058c('0x28')][_0x058c('0x29')]);return _0x4dded5(_0x2a57c1[_0x058c('0x28')][_0x058c('0x29')]);}else{logger[_0x058c('0x22')](_0x058c('0x23'),_0x46b194,_0x058c('0x24'));_0x4dded5(_0x2a57c1[_0x058c('0x2a')]['message']);}})[_0x058c('0x2b')](function(_0x1db895){logger[_0x058c('0x28')](_0x058c('0x23'),_0x46b194,_0x1db895);_0x56ff0b(_0x1db895);});});}function respondWithStatusCode(_0x453b50,_0x2bcf97){_0x2bcf97=_0x2bcf97||0xcc;return function(_0x5706e1){if(_0x5706e1){return _0x453b50[_0x058c('0x2c')](_0x2bcf97);}return _0x453b50['status'](_0x2bcf97)['end']();};}function respondWithResult(_0x187b73,_0x5d84c8){_0x5d84c8=_0x5d84c8||0xc8;return function(_0x5d2737){if(_0x5d2737){return _0x187b73[_0x058c('0x2d')](_0x5d84c8)[_0x058c('0x2e')](_0x5d2737);}};}function respondWithFilteredResult(_0x2ba90b,_0x3ba9ca){return function(_0x37367a){if(_0x37367a){var _0x5e8e45=typeof _0x3ba9ca[_0x058c('0x2f')]===_0x058c('0x30')&&typeof _0x3ba9ca['limit']===_0x058c('0x30');var _0xd33248=_0x37367a[_0x058c('0x31')];var _0x2e559f=_0x5e8e45?0x0:_0x3ba9ca[_0x058c('0x2f')];var _0x14c8f8=_0x5e8e45?_0x37367a[_0x058c('0x31')]:_0x3ba9ca['offset']+_0x3ba9ca[_0x058c('0x32')];var _0x5f4d12;if(_0x14c8f8>=_0xd33248){_0x14c8f8=_0xd33248;_0x5f4d12=0xc8;}else{_0x5f4d12=0xce;}_0x2ba90b[_0x058c('0x2d')](_0x5f4d12);return _0x2ba90b['set'](_0x058c('0x33'),_0x2e559f+'-'+_0x14c8f8+'/'+_0xd33248)[_0x058c('0x2e')](_0x37367a);}return null;};}function patchUpdates(_0x3025ce){return function(_0x554068){try{jsonpatch['apply'](_0x554068,_0x3025ce,!![]);}catch(_0x9f183d){return BPromise[_0x058c('0x34')](_0x9f183d);}return _0x554068[_0x058c('0x35')]();};}function saveUpdates(_0x4d7aee,_0x3de12b){return function(_0x1768ed){if(_0x1768ed){return _0x1768ed['update'](_0x4d7aee)['then'](function(_0x3b3b7e){return _0x3b3b7e;});}return null;};}function removeEntity(_0x3e2b38,_0x38727a){return function(_0x35fec9){if(_0x35fec9){return _0x35fec9['destroy']()[_0x058c('0x21')](function(){_0x3e2b38[_0x058c('0x2d')](0xcc)[_0x058c('0x36')]();});}};}function handleEntityNotFound(_0x1a3f13,_0x27bb9d){return function(_0x138ae0){if(!_0x138ae0){_0x1a3f13[_0x058c('0x2c')](0x194);}return _0x138ae0;};}function handleError(_0x514a13,_0x1b7ef0){_0x1b7ef0=_0x1b7ef0||0x1f4;return function(_0x321c99){logger[_0x058c('0x28')](_0x321c99[_0x058c('0x37')]);if(_0x321c99['name']){delete _0x321c99[_0x058c('0x38')];}_0x514a13[_0x058c('0x2d')](_0x1b7ef0)[_0x058c('0x39')](_0x321c99);};}exports[_0x058c('0x3a')]=function(_0x1b9c2e,_0x47108f){var _0x3e6cda={},_0x16deb5={},_0x47870a={'count':0x0,'rows':[]};var _0x91da84=_[_0x058c('0x3b')](db[_0x058c('0x3c')][_0x058c('0x3d')],function(_0x8d705e){return{'name':_0x8d705e['fieldName'],'type':_0x8d705e['type']['key']};});_0x16deb5[_0x058c('0x3e')]=_[_0x058c('0x3b')](_0x91da84,'name');_0x16deb5[_0x058c('0x3f')]=_['keys'](_0x1b9c2e['query']);_0x16deb5[_0x058c('0x40')]=_[_0x058c('0x41')](_0x16deb5['model'],_0x16deb5['query']);_0x3e6cda[_0x058c('0x42')]=_['intersection'](_0x16deb5[_0x058c('0x3e')],qs[_0x058c('0x43')](_0x1b9c2e[_0x058c('0x3f')]['fields']));_0x3e6cda[_0x058c('0x42')]=_0x3e6cda[_0x058c('0x42')]['length']?_0x3e6cda[_0x058c('0x42')]:_0x16deb5[_0x058c('0x3e')];if(!_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x44')](_0x058c('0x45'))){_0x3e6cda['limit']=qs[_0x058c('0x32')](_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x32')]);_0x3e6cda[_0x058c('0x2f')]=qs[_0x058c('0x2f')](_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x2f')]);}_0x3e6cda[_0x058c('0x46')]=qs['sort'](_0x1b9c2e['query'][_0x058c('0x47')]);_0x3e6cda[_0x058c('0x48')]=qs['filters'](_[_0x058c('0x49')](_0x1b9c2e[_0x058c('0x3f')],_0x16deb5[_0x058c('0x40')]),_0x91da84);if(_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x4a')]){_0x3e6cda[_0x058c('0x48')]=_[_0x058c('0x4b')](_0x3e6cda['where'],{'$or':_[_0x058c('0x3b')](_0x91da84,function(_0x58820d){if(_0x58820d[_0x058c('0x4c')]!==_0x058c('0x4d')){var _0x106c48={};_0x106c48[_0x58820d[_0x058c('0x38')]]={'$like':'%'+_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x4a')]+'%'};return _0x106c48;}})});}_0x3e6cda=_[_0x058c('0x4b')]({},_0x3e6cda,_0x1b9c2e[_0x058c('0x4e')]);var _0x4e4d06={'where':_0x3e6cda[_0x058c('0x48')]};return db[_0x058c('0x3c')][_0x058c('0x31')](_0x4e4d06)[_0x058c('0x21')](function(_0x2c01e6){_0x47870a[_0x058c('0x31')]=_0x2c01e6;if(_0x1b9c2e[_0x058c('0x3f')][_0x058c('0x4f')]){_0x3e6cda['include']=[{'all':!![]}];}return db[_0x058c('0x3c')][_0x058c('0x50')](_0x3e6cda);})[_0x058c('0x21')](function(_0x5a5791){_0x47870a[_0x058c('0x51')]=_0x5a5791;return _0x47870a;})['then'](respondWithFilteredResult(_0x47108f,_0x3e6cda))[_0x058c('0x2b')](handleError(_0x47108f,null));};exports[_0x058c('0x52')]=function(_0x1197e1,_0x4dbadb){var _0x33f647={'raw':!![],'where':{'id':_0x1197e1[_0x058c('0x53')]['id']}},_0x21ca2d={};_0x21ca2d[_0x058c('0x3e')]=_[_0x058c('0x54')](db['OpenchannelMessage']['rawAttributes']);_0x21ca2d[_0x058c('0x3f')]=_[_0x058c('0x54')](_0x1197e1[_0x058c('0x3f')]);_0x21ca2d[_0x058c('0x40')]=_[_0x058c('0x41')](_0x21ca2d[_0x058c('0x3e')],_0x21ca2d[_0x058c('0x3f')]);_0x33f647[_0x058c('0x42')]=_[_0x058c('0x41')](_0x21ca2d[_0x058c('0x3e')],qs[_0x058c('0x43')](_0x1197e1[_0x058c('0x3f')][_0x058c('0x43')]));_0x33f647[_0x058c('0x42')]=_0x33f647[_0x058c('0x42')][_0x058c('0x55')]?_0x33f647[_0x058c('0x42')]:_0x21ca2d['model'];if(_0x1197e1[_0x058c('0x3f')][_0x058c('0x4f')]){_0x33f647[_0x058c('0x56')]=[{'all':!![]}];}_0x33f647=_[_0x058c('0x4b')]({},_0x33f647,_0x1197e1[_0x058c('0x4e')]);return db[_0x058c('0x3c')][_0x058c('0x57')](_0x33f647)['then'](handleEntityNotFound(_0x4dbadb,null))[_0x058c('0x21')](respondWithResult(_0x4dbadb,null))[_0x058c('0x2b')](handleError(_0x4dbadb,null));};exports[_0x058c('0x58')]=function(_0x377fa1,_0x5f4f1a){return db[_0x058c('0x3c')][_0x058c('0x58')](_0x377fa1['body'],{})[_0x058c('0x21')](respondWithResult(_0x5f4f1a,0xc9))['catch'](handleError(_0x5f4f1a,null));};exports[_0x058c('0x59')]=function(_0x4a099c,_0x3d8095){if(_0x4a099c[_0x058c('0x5a')]['id']){delete _0x4a099c['body']['id'];}return db[_0x058c('0x3c')][_0x058c('0x57')]({'where':{'id':_0x4a099c['params']['id']}})[_0x058c('0x21')](handleEntityNotFound(_0x3d8095,null))[_0x058c('0x21')](saveUpdates(_0x4a099c[_0x058c('0x5a')],null))['then'](respondWithResult(_0x3d8095,null))[_0x058c('0x2b')](handleError(_0x3d8095,null));};exports[_0x058c('0x5b')]=function(_0x23afeb,_0x318d63){return db[_0x058c('0x3c')][_0x058c('0x57')]({'where':{'id':_0x23afeb[_0x058c('0x53')]['id']}})[_0x058c('0x21')](handleEntityNotFound(_0x318d63,null))[_0x058c('0x21')](removeEntity(_0x318d63,null))[_0x058c('0x2b')](handleError(_0x318d63,null));};exports['describe']=function(_0x436f0b,_0x3949cb){return db[_0x058c('0x3c')][_0x058c('0x5c')]()[_0x058c('0x21')](respondWithResult(_0x3949cb,null))[_0x058c('0x2b')](handleError(_0x3949cb,null));};var interaction_log=require('../../config/logger')(_0x058c('0x5d'));exports[_0x058c('0x5e')]=function(_0x35e851,_0x17bffd,_0x2d19b1){var _0x143ff5={'agent':{},'channel':'openchannel'};if(_0x35e851[_0x058c('0x5a')]['id']){delete _0x35e851['body']['id'];}_0x35e851['body'][_0x058c('0x5f')]=!![];_0x35e851[_0x058c('0x5a')][_0x058c('0x60')]=moment()['format'](_0x058c('0x61'));_0x35e851['body']['UserId']=_0x35e851[_0x058c('0x5a')]['UserId']||_0x35e851['user']['id'];_0x143ff5[_0x058c('0x62')]['id']=_0x35e851['body']['UserId'];return db[_0x058c('0x3c')][_0x058c('0x57')]({'where':{'id':_0x35e851[_0x058c('0x53')]['id'],'UserId':null}})[_0x058c('0x21')](handleEntityNotFound(_0x17bffd,null))[_0x058c('0x21')](saveUpdates(_0x35e851[_0x058c('0x5a')],null))[_0x058c('0x21')](function(_0x538a6c){if(_0x538a6c){_0x143ff5['message']=_0x538a6c[_0x058c('0x63')]({'plain':!![]});return db[_0x058c('0x64')][_0x058c('0x57')]({'where':{'id':_0x538a6c[_0x058c('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x17bffd,null))[_0x058c('0x21')](function(_0x32881b){if(_0x32881b){return _0x32881b['update']({'UserId':_0x35e851[_0x058c('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x32881b['read1stAt'])?moment()['format'](_0x058c('0x61')):undefined});}return null;})['then'](function(_0x280373){if(_0x280373){_0x143ff5['interaction']=_0x280373[_0x058c('0x63')]({'plain':!![]});interaction_log[_0x058c('0x22')](_0x058c('0x66'),_0x35e851[_0x058c('0x67')]['id'],_0x35e851[_0x058c('0x67')][_0x058c('0x38')],_0x35e851[_0x058c('0x67')][_0x058c('0x68')],_0x143ff5[_0x058c('0x69')]['id'],_0x35e851['body']?JSON[_0x058c('0x6a')](_0x35e851[_0x058c('0x5a')]):_0x058c('0x6b'));return respondWithRpcPromise(_0x058c('0x6c'),_0x058c('0x6d'),_0x143ff5);}return null;})[_0x058c('0x21')](function(_0x334784){var _0x389544=_0x058c('0x6e')+_0x334784['message'][_0x058c('0x6f')];return db[_0x058c('0x70')]['query'](_0x389544,{'type':db[_0x058c('0x71')][_0x058c('0x72')][_0x058c('0x73')],'raw':!![]})[_0x058c('0x21')](function(_0x2d2c6b){return _0x2d2c6b;});})[_0x058c('0x21')](function(_0x55cbd6){if(_0x55cbd6){_0x143ff5[_0x058c('0x29')][_0x058c('0x74')]=_0x55cbd6[0x0];if(!_0x35e851[_0x058c('0x5a')][_0x058c('0x75')])return;return db[_0x058c('0x76')]['find']({'where':{'id':_0x35e851[_0x058c('0x5a')][_0x058c('0x75')],'role':_0x058c('0x62')},'attributes':['id','name',_0x058c('0x77'),_0x058c('0x78'),_0x058c('0x79')],'raw':!![]});}return null;})[_0x058c('0x21')](function(_0x48fb92){if(!_0x48fb92)return null;_0x143ff5[_0x058c('0x29')][_0x058c('0x62')]=_0x48fb92;return _0x143ff5;})['then'](function(_0x4bbce4){if(_0x4bbce4){if(_0x35e851[_0x058c('0x5a')][_0x058c('0x7a')]){_0x143ff5[_0x058c('0x29')][_0x058c('0x7b')]=util[_0x058c('0x7c')](_0x058c('0x7d'),_0x35e851[_0x058c('0x67')]['name']);_0x143ff5['message']['channel']=_0x143ff5['channel'];_0x143ff5[_0x058c('0x29')][_0x058c('0x7e')]=_0x143ff5[_0x058c('0x7f')];_0x143ff5[_0x058c('0x29')]['event']=_0x058c('0x5e');return respondWithRpcPromise(_0x058c('0x80'),_0x058c('0x80'),{'event':_0x058c('0x81'),'message':_0x143ff5[_0x058c('0x29')]},client9002)[_0x058c('0x21')](function(){return _0x143ff5;});}return _0x143ff5;}return null;})[_0x058c('0x21')](respondWithResult(_0x17bffd,null))[_0x058c('0x2b')](handleError(_0x17bffd,null));};var interaction_log=require(_0x058c('0x16'))(_0x058c('0x5d'));exports[_0x058c('0x34')]=function(_0x2d4009,_0x228603,_0x4838ab){var _0x3910ae={'agent':{},'channel':_0x058c('0x82')};if(_0x2d4009[_0x058c('0x5a')]['id']){delete _0x2d4009[_0x058c('0x5a')]['id'];}_0x2d4009[_0x058c('0x5a')]['UserId']=_0x2d4009['body'][_0x058c('0x75')]||_0x2d4009[_0x058c('0x67')]['id'];_0x3910ae['agent']['id']=_0x2d4009[_0x058c('0x5a')][_0x058c('0x75')];return db[_0x058c('0x3c')]['find']({'where':{'id':_0x2d4009[_0x058c('0x53')]['id'],'UserId':null}})[_0x058c('0x21')](handleEntityNotFound(_0x228603,null))['then'](function(_0x557f84){if(_0x557f84){_0x3910ae[_0x058c('0x29')]=_0x557f84[_0x058c('0x63')]({'plain':!![]});return db[_0x058c('0x64')][_0x058c('0x57')]({'where':{'id':_0x557f84[_0x058c('0x65')]}});}return null;})[_0x058c('0x21')](handleEntityNotFound(_0x228603,null))[_0x058c('0x21')](function(_0x43415b){if(_0x43415b){_0x3910ae[_0x058c('0x69')]=_0x43415b[_0x058c('0x63')]({'plain':!![]});interaction_log[_0x058c('0x22')](_0x058c('0x83'),_0x2d4009['user']['id'],_0x2d4009[_0x058c('0x67')]['name'],_0x2d4009[_0x058c('0x67')][_0x058c('0x68')],_0x3910ae[_0x058c('0x69')]['id'],_0x2d4009['body']?JSON[_0x058c('0x6a')](_0x2d4009[_0x058c('0x5a')]):_0x058c('0x6b'));return respondWithRpcPromise(_0x058c('0x84'),_0x058c('0x85'),_0x3910ae);}return null;})[_0x058c('0x21')](function(_0x913dfa){var _0x40bbd9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x913dfa['message'][_0x058c('0x6f')];return db[_0x058c('0x70')][_0x058c('0x3f')](_0x40bbd9,{'type':db[_0x058c('0x71')][_0x058c('0x72')]['SELECT'],'raw':!![]})[_0x058c('0x21')](function(_0x45fa67){return _0x45fa67;});})['then'](function(_0x4b2109){if(_0x4b2109){_0x3910ae[_0x058c('0x29')][_0x058c('0x74')]=_0x4b2109[0x0];if(!_0x2d4009[_0x058c('0x5a')][_0x058c('0x75')])return;return db[_0x058c('0x76')]['find']({'where':{'id':_0x2d4009['body']['UserId'],'role':_0x058c('0x62')},'attributes':['id',_0x058c('0x38'),'fullname','email',_0x058c('0x79')],'raw':!![]});}return null;})['then'](function(_0x5887e5){if(!_0x5887e5)return null;_0x3910ae[_0x058c('0x29')][_0x058c('0x62')]=_0x5887e5;return _0x3910ae;})[_0x058c('0x21')](function(_0x39643e){if(_0x39643e){_0x39643e['message'][_0x058c('0x7b')]=util[_0x058c('0x7c')](_0x058c('0x7d'),_0x2d4009[_0x058c('0x67')][_0x058c('0x38')]);_0x39643e[_0x058c('0x29')][_0x058c('0x7f')]=_0x3910ae[_0x058c('0x7f')];_0x39643e[_0x058c('0x29')]['motionChannel']=_0x3910ae[_0x058c('0x7f')];_0x39643e[_0x058c('0x29')]['event']='reject';respondWithRpcPromise(_0x058c('0x80'),_0x058c('0x80'),{'event':_0x058c('0x86'),'message':_0x39643e[_0x058c('0x29')]},client9002);return _0x3910ae;}return null;})[_0x058c('0x21')](respondWithResult(_0x228603,null))[_0x058c('0x2b')](handleError(_0x228603,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e6c3d19..ff124dc 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 _0xf87a=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5a1596,_0x4529d3){var _0x33d650=function(_0x46d189){while(--_0x46d189){_0x5a1596['push'](_0x5a1596['shift']());}};_0x33d650(++_0x4529d3);}(_0xf87a,0xb7));var _0xaf87=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf87a[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xaf87('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xaf87('0x1')](0x0);var events={'afterCreate':_0xaf87('0x2'),'afterUpdate':_0xaf87('0x3'),'afterDestroy':_0xaf87('0x4')};function emitEvent(_0x362d95){return function(_0x5f389e,_0x242a02,_0x2fd47d){OpenchannelMessageEvents[_0xaf87('0x5')](_0x362d95+':'+_0x5f389e['id'],_0x5f389e);OpenchannelMessageEvents['emit'](_0x362d95,_0x5f389e);_0x2fd47d(null);};}for(var e in events){if(events[_0xaf87('0x6')](e)){var event=events[e];OpenchannelMessage[_0xaf87('0x7')](e,emitEvent(event));}}module[_0xaf87('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3b4b=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x522138,_0x47a9b8){var _0x4297be=function(_0x40f3dd){while(--_0x40f3dd){_0x522138['push'](_0x522138['shift']());}};_0x4297be(++_0x47a9b8);}(_0x3b4b,0x1d8));var _0xb3b4=function(_0x5f2be8,_0x2368d6){_0x5f2be8=_0x5f2be8-0x0;var _0x370237=_0x3b4b[_0x5f2be8];return _0x370237;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xb3b4('0x0'))['db'][_0xb3b4('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb3b4('0x2')](0x0);var events={'afterCreate':_0xb3b4('0x3'),'afterUpdate':_0xb3b4('0x4'),'afterDestroy':_0xb3b4('0x5')};function emitEvent(_0x5745fa){return function(_0x225b53,_0x297f29,_0x63833b){OpenchannelMessageEvents[_0xb3b4('0x6')](_0x5745fa+':'+_0x225b53['id'],_0x225b53);OpenchannelMessageEvents['emit'](_0x5745fa,_0x225b53);_0x63833b(null);};}for(var e in events){if(events[_0xb3b4('0x7')](e)){var event=events[e];OpenchannelMessage[_0xb3b4('0x8')](e,emitEvent(event));}}module[_0xb3b4('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index ccbdf54..eb6aa40 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 _0x175a=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','omit','POST','method','GET','Interaction','threadId','inspect','finally','utf8mb4','lodash','util'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0x175a,0x12a));var _0xa175=function(_0x490985,_0x4a8c59){_0x490985=_0x490985-0x0;var _0x13629d=_0x175a[_0x490985];return _0x13629d;};'use strict';var _=require(_0xa175('0x0'));var util=require(_0xa175('0x1'));var logger=require(_0xa175('0x2'))('api');var moment=require(_0xa175('0x3'));var BPromise=require(_0xa175('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa175('0x5'));var rimraf=require(_0xa175('0x6'));var config=require(_0xa175('0x7'));var attributes=require(_0xa175('0x8'));module['exports']=function(_0x1e10eb,_0x399400){return _0x1e10eb['define']('OpenchannelMessage',attributes,{'tableName':_0xa175('0x9'),'paranoid':![],'indexes':[{'name':_0xa175('0xa'),'fields':[_0xa175('0xb')],'type':_0xa175('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38db7c,_0x2db947,_0x4bcc70){var _0x3457a6=_0x1e10eb[_0xa175('0xd')];var _0x49f39a=_0x38db7c[_0xa175('0xe')]({'plain':!![]});if(_0x49f39a[_0xa175('0xf')]['toLowerCase']()==='in'||_0x49f39a[_0xa175('0xf')][_0xa175('0x10')]()===_0xa175('0x11')&&!_0x49f39a[_0xa175('0x12')]&&!_[_0xa175('0x13')](_0x49f39a[_0xa175('0x14')])){_0x3457a6[_0xa175('0x15')][_0xa175('0x16')]({'where':{'id':_0x49f39a[_0xa175('0x17')]}})[_0xa175('0x18')](function(_0x5ce2cc){if(_0x5ce2cc){_0x5ce2cc[_0xa175('0x19')]({'lastMsgAt':_0x49f39a[_0xa175('0x1a')],'lastMsgDirection':_0x49f39a['direction'][_0xa175('0x10')]()});}})[_0xa175('0x1b')](function(_0x5a5188){console[_0xa175('0x1c')](_0x5a5188);});}if(_0x49f39a[_0xa175('0xf')]===_0xa175('0x11')&&!_0x49f39a[_0xa175('0x12')]){var _0x4d87ae;_0x3457a6[_0xa175('0x1d')]['describe']()['then'](function(_0x5cfccf){return _0x3457a6['OpenchannelAccount'][_0xa175('0x1e')]({'where':{'id':_0x49f39a[_0xa175('0x1f')]},'include':[{'model':_0x3457a6[_0xa175('0x15')],'as':_0xa175('0x20'),'where':{'id':_0x49f39a[_0xa175('0x17')]},'limit':0x1,'include':[{'model':_0x3457a6[_0xa175('0x1d')],'as':_0xa175('0x21'),'attributes':_[_0xa175('0x22')](_0x5cfccf)}]}]});})[_0xa175('0x18')](function(_0x4bcb4a){_0x4d87ae=_0x4bcb4a['get']({'plain':!![]});if(_0x4d87ae&&_0x4d87ae[_0xa175('0x23')]){logger[_0xa175('0x24')](_0xa175('0x25'),_0xa175('0x26'),util[_0xa175('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x49f39a['id'],_0x4d87ae['replyUri']));if(_0x4d87ae[_0xa175('0x20')]&&_0x4d87ae[_0xa175('0x20')][_0xa175('0x28')]){_0x49f39a['Interaction']=_[_0xa175('0x29')](_0x4d87ae[_0xa175('0x20')][0x0],_0xa175('0x21'));_0x49f39a[_0xa175('0x21')]=_0x4d87ae[_0xa175('0x20')][0x0][_0xa175('0x21')];}var _0x2db947={'method':_0xa175('0x2a'),'uri':encodeURI(_0x4d87ae[_0xa175('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2db947[_0xa175('0x2b')]){case _0xa175('0x2c'):_0x2db947['qs']=_0x49f39a;break;case _0xa175('0x2a'):_0x2db947[_0xa175('0xb')]=_0x49f39a;break;}return rp(_0x2db947)[_0xa175('0x18')](function(_0x43a48b){logger[_0xa175('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0xa175('0x26'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x49f39a['id'],_0x4d87ae['replyUri']));if(_0x43a48b[_0xa175('0xb')]['threadId']&&_0x43a48b[_0xa175('0xb')]['threadId']!=_0x49f39a[_0xa175('0x2d')][_0xa175('0x2e')]){return _0x3457a6[_0xa175('0x15')]['update']({'threadId':_0x43a48b[_0xa175('0xb')][_0xa175('0x2e')]},{'where':{'id':_0x49f39a['Interaction']['id']}});}else{return;}})[_0xa175('0x18')](function(){return _0x38db7c[_0xa175('0x19')]({'read':!![]});})[_0xa175('0x1b')](function(_0x4b6b98){logger[_0xa175('0x1c')]('OpenchannelMessage,\x20%s,\x20%s',_0xa175('0x26'),util[_0xa175('0x2f')](_0x4b6b98,{'showHidden':![],'depth':null}));_0x4bcc70();});}else{_0x4bcc70();}})[_0xa175('0x30')](function(){_0x4bcc70();});}else{_0x4bcc70();}}},'charset':_0xa175('0x31'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x31a0=['../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','then','update','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x26922e,_0x515588){var _0x4b69cf=function(_0x495b9a){while(--_0x495b9a){_0x26922e['push'](_0x26922e['shift']());}};_0x4b69cf(++_0x515588);}(_0x31a0,0x1b2));var _0x031a=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x31a0[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x031a('0x0'));var util=require(_0x031a('0x1'));var logger=require(_0x031a('0x2'))('api');var moment=require(_0x031a('0x3'));var BPromise=require(_0x031a('0x4'));var rp=require(_0x031a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x031a('0x6'));var attributes=require(_0x031a('0x7'));module[_0x031a('0x8')]=function(_0x53ce51,_0x2507ec){return _0x53ce51['define'](_0x031a('0x9'),attributes,{'tableName':_0x031a('0xa'),'paranoid':![],'indexes':[{'name':_0x031a('0xb'),'fields':[_0x031a('0xc')],'type':_0x031a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x306f13,_0x45967a,_0x3e7eee){var _0x3cd486=_0x53ce51[_0x031a('0xe')];var _0x6009fe=_0x306f13[_0x031a('0xf')]({'plain':!![]});if(_0x6009fe[_0x031a('0x10')][_0x031a('0x11')]()==='in'||_0x6009fe[_0x031a('0x10')][_0x031a('0x11')]()===_0x031a('0x12')&&!_0x6009fe['secret']&&!_[_0x031a('0x13')](_0x6009fe[_0x031a('0x14')])){_0x3cd486[_0x031a('0x15')][_0x031a('0x16')]({'where':{'id':_0x6009fe['OpenchannelInteractionId']}})[_0x031a('0x17')](function(_0x8e1afc){if(_0x8e1afc){_0x8e1afc[_0x031a('0x18')]({'lastMsgAt':_0x6009fe['createdAt'],'lastMsgDirection':_0x6009fe['direction']['toLowerCase']()});}})[_0x031a('0x19')](function(_0x36e1bf){console['error'](_0x36e1bf);});}if(_0x6009fe['direction']===_0x031a('0x12')&&!_0x6009fe[_0x031a('0x1a')]){var _0x159ed0;_0x3cd486[_0x031a('0x1b')][_0x031a('0x1c')]()[_0x031a('0x17')](function(_0x32a1cb){return _0x3cd486[_0x031a('0x1d')][_0x031a('0x1e')]({'where':{'id':_0x6009fe[_0x031a('0x1f')]},'include':[{'model':_0x3cd486[_0x031a('0x15')],'as':_0x031a('0x20'),'where':{'id':_0x6009fe[_0x031a('0x21')]},'limit':0x1,'include':[{'model':_0x3cd486[_0x031a('0x1b')],'as':_0x031a('0x22'),'attributes':_[_0x031a('0x23')](_0x32a1cb)}]}]});})[_0x031a('0x17')](function(_0x23647a){_0x159ed0=_0x23647a['get']({'plain':!![]});if(_0x159ed0&&_0x159ed0[_0x031a('0x24')]){logger[_0x031a('0x25')](_0x031a('0x26'),_0x031a('0x27'),util['format'](_0x031a('0x28'),_0x6009fe['id'],_0x159ed0[_0x031a('0x24')]));if(_0x159ed0[_0x031a('0x20')]&&_0x159ed0[_0x031a('0x20')][_0x031a('0x29')]){_0x6009fe['Interaction']=_[_0x031a('0x2a')](_0x159ed0[_0x031a('0x20')][0x0],_0x031a('0x22'));_0x6009fe[_0x031a('0x22')]=_0x159ed0[_0x031a('0x20')][0x0][_0x031a('0x22')];}var _0x45967a={'method':_0x031a('0x2b'),'uri':encodeURI(_0x159ed0[_0x031a('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x45967a[_0x031a('0x2c')]){case _0x031a('0x2d'):_0x45967a['qs']=_0x6009fe;break;case'POST':_0x45967a[_0x031a('0xc')]=_0x6009fe;break;}return rp(_0x45967a)[_0x031a('0x17')](function(_0x2172b4){logger['info'](_0x031a('0x26'),_0x031a('0x27'),util[_0x031a('0x2e')](_0x031a('0x2f'),_0x6009fe['id'],_0x159ed0[_0x031a('0x24')]));if(_0x2172b4[_0x031a('0xc')][_0x031a('0x30')]&&_0x2172b4[_0x031a('0xc')][_0x031a('0x30')]!=_0x6009fe[_0x031a('0x31')]['threadId']){return _0x3cd486['OpenchannelInteraction']['update']({'threadId':_0x2172b4[_0x031a('0xc')][_0x031a('0x30')]},{'where':{'id':_0x6009fe[_0x031a('0x31')]['id']}});}else{return;}})[_0x031a('0x17')](function(){return _0x306f13[_0x031a('0x18')]({'read':!![]});})[_0x031a('0x19')](function(_0x4f27fb){logger[_0x031a('0x32')](_0x031a('0x26'),_0x031a('0x27'),util[_0x031a('0x33')](_0x4f27fb,{'showHidden':![],'depth':null}));_0x3e7eee();});}else{_0x3e7eee();}})[_0x031a('0x34')](function(){_0x3e7eee();});}else{_0x3e7eee();}}},'charset':_0x031a('0x35'),'collate':_0x031a('0x36')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 539afb4..dab685f 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3ddbed,_0x209ece){var _0x104788=function(_0x1a52ac){while(--_0x1a52ac){_0x3ddbed['push'](_0x3ddbed['shift']());}};_0x104788(++_0x209ece);}(_0x5f2f,0x73));var _0xf5f2=function(_0x651906,_0x2295cd){_0x651906=_0x651906-0x0;var _0x45bffa=_0x5f2f[_0x651906];return _0x45bffa;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x5764c1,_0x46db21){var _0x27b21e=function(_0x4d6fac){while(--_0x4d6fac){_0x5764c1['push'](_0x5764c1['shift']());}};_0x27b21e(++_0x46db21);}(_0xadb5,0xad));var _0x5adb=function(_0x256978,_0x306c41){_0x256978=_0x256978-0x0;var _0x3f93a4=_0xadb5[_0x256978];return _0x3f93a4;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1bd07e2..99e9a14 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 _0xc7e1=['update','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x34145e,_0x689e31){var _0x27ed04=function(_0x297fc7){while(--_0x297fc7){_0x34145e['push'](_0x34145e['shift']());}};_0x27ed04(++_0x689e31);}(_0xc7e1,0x15d));var _0x1c7e=function(_0x5b1191,_0x1dba16){_0x5b1191=_0x5b1191-0x0;var _0x47c28e=_0xc7e1[_0x5b1191];return _0x47c28e;};'use strict';var OpenchannelMessageEvents=require(_0x1c7e('0x0'));var events=[_0x1c7e('0x1'),_0x1c7e('0x2'),_0x1c7e('0x3')];function createListener(_0x27a3fb,_0x14b023){return function(_0x13cbd0){_0x14b023['emit'](_0x27a3fb,_0x13cbd0);};}function removeListener(_0x3e01d3,_0x1b30ef){return function(){OpenchannelMessageEvents[_0x1c7e('0x4')](_0x3e01d3,_0x1b30ef);};}exports[_0x1c7e('0x5')]=function(_0x5bec3d){for(var _0x26437f=0x0,_0x11bd52=events[_0x1c7e('0x6')];_0x26437f<_0x11bd52;_0x26437f++){var _0x582c85=events[_0x26437f];var _0x45ab10=createListener(_0x1c7e('0x7')+_0x582c85,_0x5bec3d);OpenchannelMessageEvents['on'](_0x582c85,_0x45ab10);}}; \ No newline at end of file +var _0x99a3=['register','length','./openchannelMessage.events','save','remove','update','emit'];(function(_0x13f0e1,_0xd6af){var _0x589f26=function(_0xe6dbf2){while(--_0xe6dbf2){_0x13f0e1['push'](_0x13f0e1['shift']());}};_0x589f26(++_0xd6af);}(_0x99a3,0x14b));var _0x399a=function(_0x337e2b,_0x483b3b){_0x337e2b=_0x337e2b-0x0;var _0x569e62=_0x99a3[_0x337e2b];return _0x569e62;};'use strict';var OpenchannelMessageEvents=require(_0x399a('0x0'));var events=[_0x399a('0x1'),_0x399a('0x2'),_0x399a('0x3')];function createListener(_0x505c55,_0x3d3ea8){return function(_0x1f5fb8){_0x3d3ea8[_0x399a('0x4')](_0x505c55,_0x1f5fb8);};}function removeListener(_0x4bf134,_0x438271){return function(){OpenchannelMessageEvents['removeListener'](_0x4bf134,_0x438271);};}exports[_0x399a('0x5')]=function(_0x3762a4){for(var _0x52e383=0x0,_0x6cf9e0=events[_0x399a('0x6')];_0x52e383<_0x6cf9e0;_0x52e383++){var _0x4f7e4d=events[_0x52e383];var _0xf65fcd=createListener('openchannelMessage:'+_0x4f7e4d,_0x3762a4);OpenchannelMessageEvents['on'](_0x4f7e4d,_0xf65fcd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e475ee6..6acf067 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 _0x48b7=['getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','/:id/teams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/users'];(function(_0x14ea4f,_0x5c73e5){var _0x32f0e4=function(_0x1049fc){while(--_0x1049fc){_0x14ea4f['push'](_0x14ea4f['shift']());}};_0x32f0e4(++_0x5c73e5);}(_0x48b7,0x1ec));var _0x748b=function(_0x5f0723,_0x1635ce){_0x5f0723=_0x5f0723-0x0;var _0x384d01=_0x48b7[_0x5f0723];return _0x384d01;};'use strict';var multer=require(_0x748b('0x0'));var util=require(_0x748b('0x1'));var path=require(_0x748b('0x2'));var timeout=require(_0x748b('0x3'));var express=require(_0x748b('0x4'));var router=express[_0x748b('0x5')]();var fs_extra=require(_0x748b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x748b('0x7'));var config=require(_0x748b('0x8'));var controller=require(_0x748b('0x9'));router[_0x748b('0xa')]('/',auth[_0x748b('0xb')](),controller[_0x748b('0xc')]);router[_0x748b('0xa')](_0x748b('0xd'),auth[_0x748b('0xb')](),controller[_0x748b('0xe')]);router[_0x748b('0xa')](_0x748b('0xf'),auth[_0x748b('0xb')](),controller[_0x748b('0x10')]);router[_0x748b('0xa')](_0x748b('0x11'),auth[_0x748b('0xb')](),controller[_0x748b('0x12')]);router[_0x748b('0xa')]('/:id/teams',auth[_0x748b('0xb')](),controller['getTeams']);router[_0x748b('0xa')](_0x748b('0x13'),auth[_0x748b('0xb')](),controller[_0x748b('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x748b('0x15')]);router[_0x748b('0x16')]('/:id/teams',auth[_0x748b('0xb')](),controller[_0x748b('0x17')]);router[_0x748b('0x16')](_0x748b('0x13'),auth[_0x748b('0xb')](),controller[_0x748b('0x18')]);router[_0x748b('0x19')]('/:id',auth[_0x748b('0xb')](),controller[_0x748b('0x1a')]);router[_0x748b('0x1b')](_0x748b('0xf'),auth[_0x748b('0xb')](),controller[_0x748b('0x1c')]);router[_0x748b('0x1b')](_0x748b('0x1d'),auth[_0x748b('0xb')](),controller['removeTeams']);router[_0x748b('0x1b')](_0x748b('0x13'),auth[_0x748b('0xb')](),controller[_0x748b('0x1e')]);module[_0x748b('0x1f')]=router; \ No newline at end of file +var _0xd82a=['update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','create','post','addAgents'];(function(_0x3b267f,_0x2a7dd9){var _0x4c0cd8=function(_0x5c20c6){while(--_0x5c20c6){_0x3b267f['push'](_0x3b267f['shift']());}};_0x4c0cd8(++_0x2a7dd9);}(_0xd82a,0xc9));var _0xad82=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xd82a[_0xd0b415];return _0x2bdf2c;};'use strict';var multer=require(_0xad82('0x0'));var util=require(_0xad82('0x1'));var path=require('path');var timeout=require(_0xad82('0x2'));var express=require(_0xad82('0x3'));var router=express['Router']();var fs_extra=require(_0xad82('0x4'));var auth=require(_0xad82('0x5'));var interaction=require(_0xad82('0x6'));var config=require(_0xad82('0x7'));var controller=require(_0xad82('0x8'));router[_0xad82('0x9')]('/',auth[_0xad82('0xa')](),controller[_0xad82('0xb')]);router[_0xad82('0x9')](_0xad82('0xc'),auth[_0xad82('0xa')](),controller[_0xad82('0xd')]);router[_0xad82('0x9')](_0xad82('0xe'),auth[_0xad82('0xa')](),controller[_0xad82('0xf')]);router[_0xad82('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xad82('0x10')]);router['get'](_0xad82('0x11'),auth[_0xad82('0xa')](),controller['getTeams']);router['get'](_0xad82('0x12'),auth[_0xad82('0xa')](),controller[_0xad82('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xad82('0x14')]);router[_0xad82('0x15')](_0xad82('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xad82('0x15')](_0xad82('0x12'),auth['isAuthenticated'](),controller[_0xad82('0x16')]);router['put'](_0xad82('0xe'),auth[_0xad82('0xa')](),controller[_0xad82('0x17')]);router[_0xad82('0x18')](_0xad82('0xe'),auth[_0xad82('0xa')](),controller[_0xad82('0x19')]);router['delete']('/:id/teams',auth[_0xad82('0xa')](),controller[_0xad82('0x1a')]);router[_0xad82('0x18')](_0xad82('0x12'),auth[_0xad82('0xa')](),controller['removeAgents']);module[_0xad82('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index db3a13b..6737842 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 _0xb5ad=['STRING','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x1c111d,_0x478d2f){var _0x4d17f0=function(_0xcd6da4){while(--_0xcd6da4){_0x1c111d['push'](_0x1c111d['shift']());}};_0x4d17f0(++_0x478d2f);}(_0xb5ad,0x160));var _0xdb5a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb5ad[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0xdb5a('0x0'));module[_0xdb5a('0x1')]={'name':{'type':Sequelize[_0xdb5a('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdb5a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xdb5a('0x3')](_0xdb5a('0x4'),'beepall',_0xdb5a('0x5'))}}; \ No newline at end of file +var _0xf538=['rrmemory','sequelize','INTEGER','ENUM'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf538,0xa9));var _0x8f53=function(_0x2bd007,_0x281ba0){_0x2bd007=_0x2bd007-0x0;var _0x53c252=_0xf538[_0x2bd007];return _0x53c252;};'use strict';var Sequelize=require(_0x8f53('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8f53('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8f53('0x2')](_0x8f53('0x3'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 78b6456..b433e8b 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 _0x8305=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','includeAll','include','findAll','catch','show','params','length','options','create','body','get','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','OpenchannelQueueId','filter','UserOpenchannelQueue','User','findAndCountAll','UserId','updatedAt','createdAt','rows','%s/%s','openchannelPause','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','forEach','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','save','update','then','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x8305,0x1e8));var _0x5830=function(_0x49fd1f,_0x5db8ee){_0x49fd1f=_0x49fd1f-0x0;var _0x489d90=_0x8305[_0x49fd1f];return _0x489d90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5830('0x0'));var zipdir=require(_0x5830('0x1'));var jsonpatch=require(_0x5830('0x2'));var rp=require(_0x5830('0x3'));var moment=require(_0x5830('0x4'));var BPromise=require(_0x5830('0x5'));var Mustache=require(_0x5830('0x6'));var util=require(_0x5830('0x7'));var path=require(_0x5830('0x8'));var sox=require(_0x5830('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5830('0xa'));var _=require(_0x5830('0xb'));var squel=require(_0x5830('0xc'));var crypto=require(_0x5830('0xd'));var jsforce=require(_0x5830('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5830('0xf'));var Papa=require(_0x5830('0x10'));var Redis=require(_0x5830('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5830('0x12'));var as=require(_0x5830('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5830('0x14'));var utils=require(_0x5830('0x15'));var config=require(_0x5830('0x16'));var licenseUtil=require(_0x5830('0x17'));var db=require('../../mysqldb')['db'];config[_0x5830('0x18')]=_['defaults'](config[_0x5830('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5830('0x19'))(new Redis(config[_0x5830('0x18')]));require(_0x5830('0x1a'))[_0x5830('0x1b')](socket);function respondWithStatusCode(_0x39f2da,_0x381693){_0x381693=_0x381693||0xcc;return function(_0x512b95){if(_0x512b95){return _0x39f2da[_0x5830('0x1c')](_0x381693);}return _0x39f2da[_0x5830('0x1d')](_0x381693)[_0x5830('0x1e')]();};}function respondWithResult(_0x536b0f,_0x15bd3a){_0x15bd3a=_0x15bd3a||0xc8;return function(_0x19aa0e){if(_0x19aa0e){return _0x536b0f['status'](_0x15bd3a)['json'](_0x19aa0e);}};}function respondWithFilteredResult(_0x4f3a29,_0x1144e6){return function(_0x2d296b){if(_0x2d296b){var _0x3275fb=typeof _0x1144e6['offset']===_0x5830('0x1f')&&typeof _0x1144e6[_0x5830('0x20')]==='undefined';var _0x88eefa=_0x2d296b[_0x5830('0x21')];var _0x186b44=_0x3275fb?0x0:_0x1144e6[_0x5830('0x22')];var _0x3b5dc=_0x3275fb?_0x2d296b[_0x5830('0x21')]:_0x1144e6['offset']+_0x1144e6['limit'];var _0xd11c7e;if(_0x3b5dc>=_0x88eefa){_0x3b5dc=_0x88eefa;_0xd11c7e=0xc8;}else{_0xd11c7e=0xce;}_0x4f3a29[_0x5830('0x1d')](_0xd11c7e);return _0x4f3a29[_0x5830('0x23')](_0x5830('0x24'),_0x186b44+'-'+_0x3b5dc+'/'+_0x88eefa)[_0x5830('0x25')](_0x2d296b);}return null;};}function patchUpdates(_0x25c5f3){return function(_0x549694){try{jsonpatch['apply'](_0x549694,_0x25c5f3,!![]);}catch(_0x1ef65c){return BPromise['reject'](_0x1ef65c);}return _0x549694[_0x5830('0x26')]();};}function saveUpdates(_0x425cc4,_0x11db82){return function(_0x34bde6){if(_0x34bde6){return _0x34bde6[_0x5830('0x27')](_0x425cc4)[_0x5830('0x28')](function(_0x40eb12){return _0x40eb12;});}return null;};}function removeEntity(_0x46a77e,_0x426ea0){return function(_0x16209a){if(_0x16209a){return _0x16209a['destroy']()[_0x5830('0x28')](function(){var _0x2ca0ca=_0x16209a['get']({'plain':!![]});var _0x26ca1a=_0x5830('0x29');return db[_0x5830('0x2a')][_0x5830('0x2b')]({'where':{'type':_0x26ca1a,'resourceId':_0x2ca0ca['id']}})[_0x5830('0x28')](function(){return _0x16209a;});})[_0x5830('0x28')](function(){_0x46a77e[_0x5830('0x1d')](0xcc)[_0x5830('0x1e')]();});}};}function handleEntityNotFound(_0x43c43b,_0x51a5ec){return function(_0x14d9d5){if(!_0x14d9d5){_0x43c43b[_0x5830('0x1c')](0x194);}return _0x14d9d5;};}function handleError(_0x467af2,_0x222222){_0x222222=_0x222222||0x1f4;return function(_0x3fb8d0){logger[_0x5830('0x2c')](_0x3fb8d0[_0x5830('0x2d')]);if(_0x3fb8d0[_0x5830('0x2e')]){delete _0x3fb8d0[_0x5830('0x2e')];}_0x467af2[_0x5830('0x1d')](_0x222222)['send'](_0x3fb8d0);};}exports['index']=function(_0x489bb2,_0x54ab8e){var _0x280712={},_0x28fae4={},_0x4e5619={'count':0x0,'rows':[]};var _0x1c27c5=_[_0x5830('0x2f')](db[_0x5830('0x30')][_0x5830('0x31')],function(_0x468df6){return{'name':_0x468df6[_0x5830('0x32')],'type':_0x468df6[_0x5830('0x33')][_0x5830('0x34')]};});_0x28fae4[_0x5830('0x35')]=_[_0x5830('0x2f')](_0x1c27c5,_0x5830('0x2e'));_0x28fae4[_0x5830('0x36')]=_[_0x5830('0x37')](_0x489bb2[_0x5830('0x36')]);_0x28fae4[_0x5830('0x38')]=_['intersection'](_0x28fae4[_0x5830('0x35')],_0x28fae4[_0x5830('0x36')]);_0x280712['attributes']=_[_0x5830('0x39')](_0x28fae4[_0x5830('0x35')],qs[_0x5830('0x3a')](_0x489bb2[_0x5830('0x36')][_0x5830('0x3a')]));_0x280712[_0x5830('0x3b')]=_0x280712['attributes']['length']?_0x280712[_0x5830('0x3b')]:_0x28fae4['model'];if(!_0x489bb2[_0x5830('0x36')][_0x5830('0x3c')](_0x5830('0x3d'))){_0x280712[_0x5830('0x20')]=qs[_0x5830('0x20')](_0x489bb2[_0x5830('0x36')][_0x5830('0x20')]);_0x280712[_0x5830('0x22')]=qs[_0x5830('0x22')](_0x489bb2[_0x5830('0x36')][_0x5830('0x22')]);}_0x280712[_0x5830('0x3e')]=qs[_0x5830('0x3f')](_0x489bb2[_0x5830('0x36')][_0x5830('0x3f')]);_0x280712['where']=qs[_0x5830('0x38')](_[_0x5830('0x40')](_0x489bb2['query'],_0x28fae4[_0x5830('0x38')]),_0x1c27c5);if(_0x489bb2[_0x5830('0x36')]['filter']){_0x280712[_0x5830('0x41')]=_[_0x5830('0x42')](_0x280712['where'],{'$or':_[_0x5830('0x2f')](_0x1c27c5,function(_0x27c037){if(_0x27c037[_0x5830('0x33')]!=='VIRTUAL'){var _0x2f5b5e={};_0x2f5b5e[_0x27c037['name']]={'$like':'%'+_0x489bb2[_0x5830('0x36')]['filter']+'%'};return _0x2f5b5e;}})});}_0x280712=_[_0x5830('0x42')]({},_0x280712,_0x489bb2['options']);var _0x472718={'where':_0x280712[_0x5830('0x41')]};return db[_0x5830('0x30')][_0x5830('0x21')](_0x472718)[_0x5830('0x28')](function(_0x48d29b){_0x4e5619['count']=_0x48d29b;if(_0x489bb2[_0x5830('0x36')][_0x5830('0x43')]){_0x280712[_0x5830('0x44')]=[{'all':!![]}];}return db[_0x5830('0x30')][_0x5830('0x45')](_0x280712);})[_0x5830('0x28')](function(_0x275894){_0x4e5619['rows']=_0x275894;return _0x4e5619;})[_0x5830('0x28')](respondWithFilteredResult(_0x54ab8e,_0x280712))[_0x5830('0x46')](handleError(_0x54ab8e,null));};exports[_0x5830('0x47')]=function(_0x546ecb,_0x2414f1){var _0x23126b={'raw':!![],'where':{'id':_0x546ecb[_0x5830('0x48')]['id']}},_0x351716={};_0x351716[_0x5830('0x35')]=_['keys'](db['OpenchannelQueue']['rawAttributes']);_0x351716[_0x5830('0x36')]=_[_0x5830('0x37')](_0x546ecb['query']);_0x351716[_0x5830('0x38')]=_[_0x5830('0x39')](_0x351716[_0x5830('0x35')],_0x351716[_0x5830('0x36')]);_0x23126b['attributes']=_[_0x5830('0x39')](_0x351716[_0x5830('0x35')],qs[_0x5830('0x3a')](_0x546ecb[_0x5830('0x36')][_0x5830('0x3a')]));_0x23126b[_0x5830('0x3b')]=_0x23126b['attributes'][_0x5830('0x49')]?_0x23126b[_0x5830('0x3b')]:_0x351716['model'];if(_0x546ecb[_0x5830('0x36')][_0x5830('0x43')]){_0x23126b[_0x5830('0x44')]=[{'all':!![]}];}_0x23126b=_[_0x5830('0x42')]({},_0x23126b,_0x546ecb[_0x5830('0x4a')]);return db['OpenchannelQueue']['find'](_0x23126b)[_0x5830('0x28')](handleEntityNotFound(_0x2414f1,null))[_0x5830('0x28')](respondWithResult(_0x2414f1,null))['catch'](handleError(_0x2414f1,null));};exports[_0x5830('0x4b')]=function(_0x4ed3b9,_0x1d63f6){return db['OpenchannelQueue']['create'](_0x4ed3b9[_0x5830('0x4c')],{})['then'](function(_0x209757){var _0x2b8515=_0x4ed3b9['user'][_0x5830('0x4d')]({'plain':!![]});if(!_0x2b8515)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8515[_0x5830('0x4e')]===_0x5830('0x4f')){var _0x6088b9=_0x209757[_0x5830('0x4d')]({'plain':!![]});var _0x179405=_0x5830('0x29');return db['UserProfileSection'][_0x5830('0x50')]({'where':{'name':_0x179405,'userProfileId':_0x2b8515[_0x5830('0x51')]},'raw':!![]})[_0x5830('0x28')](function(_0x1e188b){if(_0x1e188b&&_0x1e188b[_0x5830('0x52')]===0x0){return db[_0x5830('0x2a')][_0x5830('0x4b')]({'name':_0x6088b9[_0x5830('0x2e')],'resourceId':_0x6088b9['id'],'type':_0x1e188b[_0x5830('0x2e')],'sectionId':_0x1e188b['id']},{})[_0x5830('0x28')](function(){return _0x209757;});}else{return _0x209757;}})[_0x5830('0x46')](function(_0x247145){logger['error'](_0x5830('0x53'),_0x247145);throw _0x247145;});}return _0x209757;})['then'](respondWithResult(_0x1d63f6,0xc9))[_0x5830('0x46')](handleError(_0x1d63f6,null));};exports[_0x5830('0x27')]=function(_0x1241a5,_0x3e072d){if(_0x1241a5['body']['id']){delete _0x1241a5[_0x5830('0x4c')]['id'];}return db[_0x5830('0x30')][_0x5830('0x50')]({'where':{'id':_0x1241a5[_0x5830('0x48')]['id']}})[_0x5830('0x28')](handleEntityNotFound(_0x3e072d,null))[_0x5830('0x28')](saveUpdates(_0x1241a5[_0x5830('0x4c')],null))[_0x5830('0x28')](respondWithResult(_0x3e072d,null))[_0x5830('0x46')](handleError(_0x3e072d,null));};exports[_0x5830('0x2b')]=function(_0xdef7a,_0x238ca5){return db[_0x5830('0x30')]['find']({'where':{'id':_0xdef7a[_0x5830('0x48')]['id']}})[_0x5830('0x28')](handleEntityNotFound(_0x238ca5,null))[_0x5830('0x28')](removeEntity(_0x238ca5,null))['catch'](handleError(_0x238ca5,null));};exports['describe']=function(_0x1ce2e6,_0x1a4963){return db[_0x5830('0x30')][_0x5830('0x54')]()['then'](respondWithResult(_0x1a4963,null))[_0x5830('0x46')](handleError(_0x1a4963,null));};exports[_0x5830('0x55')]=function(_0x2c37eb,_0x1a42bc,_0x5b986e){var _0x2be5d6={'raw':!![],'where':{}},_0x31c5a5={},_0x487845;return db[_0x5830('0x30')][_0x5830('0x56')]({'where':{'id':_0x2c37eb[_0x5830('0x48')]['id']}})[_0x5830('0x28')](handleEntityNotFound(_0x1a42bc,null))[_0x5830('0x28')](function(_0x20a78b){if(_0x20a78b){_0x487845=_0x20a78b[_0x5830('0x4d')]({'plain':!![]});_0x31c5a5[_0x5830('0x35')]=_[_0x5830('0x37')](db['UserOpenchannelQueue'][_0x5830('0x31')]);_0x31c5a5['query']=_[_0x5830('0x37')](_0x2c37eb[_0x5830('0x36')]);_0x31c5a5[_0x5830('0x38')]=_[_0x5830('0x39')](_0x31c5a5[_0x5830('0x35')],_0x31c5a5[_0x5830('0x36')]);_0x2be5d6[_0x5830('0x3b')]=_['intersection'](_0x31c5a5[_0x5830('0x35')],qs[_0x5830('0x3a')](_0x2c37eb[_0x5830('0x36')]['fields']));_0x2be5d6[_0x5830('0x3b')]=_0x2be5d6[_0x5830('0x3b')][_0x5830('0x49')]?_0x2be5d6[_0x5830('0x3b')]:_0x31c5a5['model'];if(!_0x2c37eb[_0x5830('0x36')]['hasOwnProperty'](_0x5830('0x3d'))){_0x2be5d6[_0x5830('0x20')]=qs[_0x5830('0x20')](_0x2c37eb[_0x5830('0x36')][_0x5830('0x20')]);_0x2be5d6[_0x5830('0x22')]=qs[_0x5830('0x22')](_0x2c37eb[_0x5830('0x36')][_0x5830('0x22')]);}_0x2be5d6[_0x5830('0x3e')]=qs[_0x5830('0x3f')](_0x2c37eb[_0x5830('0x36')]['sort']);_0x2be5d6[_0x5830('0x41')]=qs[_0x5830('0x38')](_[_0x5830('0x40')](_0x2c37eb[_0x5830('0x36')],_0x31c5a5[_0x5830('0x38')]));_0x2be5d6[_0x5830('0x41')][_0x5830('0x57')]=_0x20a78b['id'];if(_0x2c37eb[_0x5830('0x36')][_0x5830('0x58')]){_0x2be5d6[_0x5830('0x41')]=_[_0x5830('0x42')](_0x2be5d6['where'],{'$or':_['map'](_0x2be5d6['attributes'],function(_0x3b48f3){var _0x544b90={};_0x544b90[_0x3b48f3]={'$like':'%'+_0x2c37eb[_0x5830('0x36')]['filter']+'%'};return _0x544b90;})});}_0x2be5d6=_[_0x5830('0x42')]({},_0x2be5d6,_0x2c37eb['options']);return db[_0x5830('0x59')]['findAll'](_0x2be5d6);}})[_0x5830('0x28')](function(_0x1fd4bd){if(_0x1fd4bd){return db[_0x5830('0x5a')][_0x5830('0x5b')]({'where':{'id':_['map'](_0x1fd4bd,_0x5830('0x5c')),'role':'agent'},'attributes':['id','name','openchannelPause',_0x5830('0x5d'),_0x5830('0x5e')]});}})[_0x5830('0x28')](function(_0x2e0eba){if(_0x2e0eba){return{'count':_0x2e0eba[_0x5830('0x21')],'rows':_[_0x5830('0x2f')](_0x2e0eba[_0x5830('0x5f')],function(_0x18e649){return{'membername':_0x18e649[_0x5830('0x2e')],'UserId':_0x18e649['id'],'queue_name':_0x487845[_0x5830('0x2e')],'OpenchannelQueueId':_0x487845['id'],'interface':util['format'](_0x5830('0x60'),'SIP',_0x18e649['name']),'penalty':0x0,'paused':_0x18e649[_0x5830('0x61')],'createdAt':_0x18e649[_0x5830('0x5e')],'updatedAt':_0x18e649[_0x5830('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1a42bc,_0x2be5d6))[_0x5830('0x46')](handleError(_0x1a42bc,null));};exports[_0x5830('0x62')]=function(_0x2f0647,_0x328ae5,_0x2d5605){var _0x2eb939={};var _0x443f58={};var _0x44e2bf;var _0x376e00;return db[_0x5830('0x30')][_0x5830('0x56')]({'where':{'id':_0x2f0647[_0x5830('0x48')]['id']}})[_0x5830('0x28')](handleEntityNotFound(_0x328ae5,null))[_0x5830('0x28')](function(_0xf4876c){if(_0xf4876c){_0x44e2bf=_0xf4876c;_0x443f58[_0x5830('0x35')]=_[_0x5830('0x37')](db[_0x5830('0x63')][_0x5830('0x31')]);_0x443f58[_0x5830('0x36')]=_['keys'](_0x2f0647['query']);_0x443f58[_0x5830('0x38')]=_[_0x5830('0x39')](_0x443f58[_0x5830('0x35')],_0x443f58[_0x5830('0x36')]);_0x2eb939['attributes']=_[_0x5830('0x39')](_0x443f58[_0x5830('0x35')],qs[_0x5830('0x3a')](_0x2f0647[_0x5830('0x36')][_0x5830('0x3a')]));_0x2eb939[_0x5830('0x3b')]=_0x2eb939[_0x5830('0x3b')][_0x5830('0x49')]?_0x2eb939['attributes']:_0x443f58[_0x5830('0x35')];_0x2eb939[_0x5830('0x3e')]=qs[_0x5830('0x3f')](_0x2f0647['query'][_0x5830('0x3f')]);_0x2eb939['where']=qs['filters'](_[_0x5830('0x40')](_0x2f0647['query'],_0x443f58[_0x5830('0x38')]));if(_0x2f0647[_0x5830('0x36')]['filter']){_0x2eb939[_0x5830('0x41')]=_['merge'](_0x2eb939[_0x5830('0x41')],{'$or':_[_0x5830('0x2f')](_0x2eb939[_0x5830('0x3b')],function(_0x2dc430){var _0x20c21c={};_0x20c21c[_0x2dc430]={'$like':'%'+_0x2f0647[_0x5830('0x36')][_0x5830('0x58')]+'%'};return _0x20c21c;})});}_0x2eb939=_[_0x5830('0x42')]({},_0x2eb939,_0x2f0647[_0x5830('0x4a')]);return _0x44e2bf[_0x5830('0x62')](_0x2eb939);}})['then'](function(_0x172601){if(_0x172601){_0x376e00=_0x172601[_0x5830('0x49')];if(!_0x2f0647[_0x5830('0x36')]['hasOwnProperty'](_0x5830('0x3d'))){_0x2eb939[_0x5830('0x20')]=qs['limit'](_0x2f0647[_0x5830('0x36')][_0x5830('0x20')]);_0x2eb939[_0x5830('0x22')]=qs['offset'](_0x2f0647[_0x5830('0x36')][_0x5830('0x22')]);}return _0x44e2bf[_0x5830('0x62')](_0x2eb939);}})[_0x5830('0x28')](function(_0x3b7181){if(_0x3b7181){return _0x3b7181?{'count':_0x376e00,'rows':_0x3b7181}:null;}})[_0x5830('0x28')](respondWithResult(_0x328ae5,null))[_0x5830('0x46')](handleError(_0x328ae5,null));};exports[_0x5830('0x64')]=function(_0x92b466,_0x65c409,_0xe442ed){var _0x1022f7=_0x92b466[_0x5830('0x4c')][_0x5830('0x65')];return db[_0x5830('0x63')][_0x5830('0x45')]({'where':{'id':_0x1022f7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5830('0x66'),'attributes':['id',_0x5830('0x2e'),'online',_0x5830('0x67'),_0x5830('0x68')],'raw':!![]}]})[_0x5830('0x28')](function(_0x2984e8){if(_0x2984e8){var _0x9ce319=_['flatMap'](_0x2984e8,function(_0x3b67a5){var _0x17a2ae=_0x3b67a5['get']({'plain':!![]});return _0x17a2ae[_0x5830('0x66')];});return db[_0x5830('0x30')][_0x5830('0x50')]({'where':{'id':_0x92b466[_0x5830('0x48')]['id']}})[_0x5830('0x28')](function(_0x337b0d){return db[_0x5830('0x69')]['transaction'](function(_0x17d6c0){return _0x337b0d[_0x5830('0x64')](_0x1022f7,{'transaction':_0x17d6c0})[_0x5830('0x28')](function(){return BPromise[_0x5830('0x6a')](_0x9ce319,function(_0x56ba3a){return db[_0x5830('0x59')][_0x5830('0x6b')]({'where':{'UserId':_0x56ba3a['id'],'OpenchannelQueueId':_0x92b466[_0x5830('0x48')]['id']},'transaction':_0x17d6c0});});})[_0x5830('0x28')](function(){_0x9ce319[_0x5830('0x6c')](function(_0x3373cb){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x3373cb['id'],'OpenchannelQueueId':_0x337b0d['id']});});});});});}})['then'](respondWithStatusCode(_0x65c409,null))[_0x5830('0x46')](handleError(_0x65c409,null));};exports['removeTeams']=function(_0x5f3017,_0x38bba8,_0x4caf25){return db['Team'][_0x5830('0x45')]({'where':{'id':_0x5f3017[_0x5830('0x36')][_0x5830('0x65')]},'attributes':['id'],'include':[{'model':db[_0x5830('0x5a')],'as':_0x5830('0x66'),'attributes':['id'],'raw':!![]}]})[_0x5830('0x28')](handleEntityNotFound(_0x38bba8,null))[_0x5830('0x28')](function(_0x1b685d){var _0x3327e3=_[_0x5830('0x2f')](_0x1b685d,'id');var _0x541a24=[];var _0x1d36fc=[];var _0x248c1b=squel['select']();_0x248c1b[_0x5830('0x6d')](_0x5830('0x6e'))['from']('team_has_openchannel_queues','tq')[_0x5830('0x6f')](_0x5830('0x70'),'ut',_0x5830('0x71'))['where'](_0x5830('0x72'),_0x5f3017[_0x5830('0x48')]['id']);for(var _0x163714=0x0;_0x163714<_0x1b685d[_0x5830('0x49')];_0x163714+=0x1){let _0x2f405d=_0x1b685d[_0x163714];for(var _0x31be2b=0x0;_0x31be2b<_0x2f405d['Agents'][_0x5830('0x49')];_0x31be2b+=0x1){let _0x596e2a=_0x2f405d['Agents'][_0x31be2b];var _0x2b626d=_0x248c1b[_0x5830('0x73')]();_0x2b626d[_0x5830('0x41')]('ut.UserId\x20=\x20?',_0x596e2a['id']);_0x1d36fc['push'](db[_0x5830('0x69')][_0x5830('0x36')](_0x2b626d[_0x5830('0x74')](),{'type':db[_0x5830('0x69')][_0x5830('0x75')][_0x5830('0x76')]})[_0x5830('0x28')](function(_0x41f759){if(_0x41f759[_0x5830('0x49')]===0x1){return _0x596e2a['id'];}else{var _0x21936e=_['every'](_[_0x5830('0x2f')](_0x41f759,'TeamId'),function(_0xbddf5c){return _[_0x5830('0x77')](_0x3327e3,_0xbddf5c);});if(_0x21936e){return _0x596e2a['id'];}}}));}}return BPromise[_0x5830('0x78')](_0x1d36fc)[_0x5830('0x28')](function(_0x46fba2){_0x541a24=_(_0x541a24)[_0x5830('0x79')](_0x46fba2)[_0x5830('0x7a')]()[_0x5830('0x7b')]();return db['OpenchannelQueue'][_0x5830('0x50')]({'where':{'id':_0x5f3017[_0x5830('0x48')]['id']}})['then'](function(_0x403166){return db[_0x5830('0x69')][_0x5830('0x7c')](function(_0x8abea4){return _0x403166[_0x5830('0x7d')](_0x5f3017[_0x5830('0x36')][_0x5830('0x65')],{'transaction':_0x8abea4})['then'](function(){if(!_[_0x5830('0x7e')](_0x541a24)){return _0x403166[_0x5830('0x7f')](_0x541a24,{'transaction':_0x8abea4});}})[_0x5830('0x28')](function(){_0x541a24[_0x5830('0x6c')](function(_0x427ed3){socket[_0x5830('0x80')](_0x5830('0x81'),{'UserId':_0x427ed3,'OpenchannelQueueId':_0x403166['id']});});});});});});})[_0x5830('0x28')](respondWithStatusCode(_0x38bba8,null))[_0x5830('0x46')](handleError(_0x38bba8,null));};exports[_0x5830('0x82')]=function(_0xf00cc1,_0x59c5b5,_0x594963){return db[_0x5830('0x30')][_0x5830('0x50')]({'where':{'id':_0xf00cc1['params']['id']}})['then'](handleEntityNotFound(_0x59c5b5,null))[_0x5830('0x28')](function(_0x1fe31e){if(_0x1fe31e){return _0x1fe31e[_0x5830('0x82')](_0xf00cc1[_0x5830('0x4c')][_0x5830('0x65')],_['omit'](_0xf00cc1[_0x5830('0x4c')],[_0x5830('0x65'),'id'])||{})[_0x5830('0x83')](function(_0x2b1702){for(var _0x23f684=0x0;_0x23f684<_0xf00cc1[_0x5830('0x4c')][_0x5830('0x65')]['length'];_0x23f684+=0x1){socket[_0x5830('0x80')](_0x5830('0x84'),{'UserId':Number(_0xf00cc1[_0x5830('0x4c')][_0x5830('0x65')][_0x23f684]),'OpenchannelQueueId':Number(_0xf00cc1[_0x5830('0x48')]['id'])});}return _0x2b1702;});}})[_0x5830('0x28')](respondWithResult(_0x59c5b5,null))['catch'](handleError(_0x59c5b5,null));};exports['removeAgents']=function(_0x170f09,_0x7eca89,_0x1ca73c){return db[_0x5830('0x30')][_0x5830('0x50')]({'where':{'id':_0x170f09[_0x5830('0x48')]['id']}})['then'](handleEntityNotFound(_0x7eca89,null))[_0x5830('0x28')](function(_0x30111d){if(_0x30111d){return _0x30111d['removeAgents'](_0x170f09['query'][_0x5830('0x65')])[_0x5830('0x28')](function(){if(_[_0x5830('0x85')](_0x170f09[_0x5830('0x36')][_0x5830('0x65')])){for(var _0xd30cfb=0x0;_0xd30cfb<_0x170f09[_0x5830('0x36')][_0x5830('0x65')][_0x5830('0x49')];_0xd30cfb+=0x1){socket[_0x5830('0x80')](_0x5830('0x81'),{'UserId':Number(_0x170f09[_0x5830('0x36')][_0x5830('0x65')][_0xd30cfb]),'OpenchannelQueueId':Number(_0x170f09[_0x5830('0x48')]['id'])});}}else{socket['emit'](_0x5830('0x81'),{'UserId':Number(_0x170f09[_0x5830('0x36')]['ids']),'OpenchannelQueueId':Number(_0x170f09[_0x5830('0x48')]['id'])});}});}})[_0x5830('0x28')](respondWithStatusCode(_0x7eca89,null))['catch'](handleError(_0x7eca89,null));};exports[_0x5830('0x86')]=function(_0x54b96,_0x104692,_0xeb3f06){var _0x23d830={};var _0x4bc58c={};var _0x5b1709;var _0x58aa3f;return db[_0x5830('0x30')][_0x5830('0x56')]({'where':{'id':_0x54b96['params']['id']}})[_0x5830('0x28')](handleEntityNotFound(_0x104692,null))[_0x5830('0x28')](function(_0x33e25b){if(_0x33e25b){_0x5b1709=_0x33e25b;_0x4bc58c[_0x5830('0x35')]=_['keys'](db[_0x5830('0x5a')][_0x5830('0x31')]);_0x4bc58c['query']=_[_0x5830('0x37')](_0x54b96[_0x5830('0x36')]);_0x4bc58c[_0x5830('0x38')]=_[_0x5830('0x39')](_0x4bc58c[_0x5830('0x35')],_0x4bc58c[_0x5830('0x36')]);_0x23d830['attributes']=_[_0x5830('0x39')](_0x4bc58c[_0x5830('0x35')],qs['fields'](_0x54b96[_0x5830('0x36')]['fields']));_0x23d830[_0x5830('0x3b')]=_0x23d830[_0x5830('0x3b')]['length']?_0x23d830[_0x5830('0x3b')]:_0x4bc58c[_0x5830('0x35')];_0x23d830[_0x5830('0x3e')]=qs['sort'](_0x54b96['query'][_0x5830('0x3f')]);_0x23d830[_0x5830('0x41')]=qs[_0x5830('0x38')](_['pick'](_0x54b96[_0x5830('0x36')],_0x4bc58c[_0x5830('0x38')]));if(_0x54b96[_0x5830('0x36')][_0x5830('0x58')]){_0x23d830[_0x5830('0x41')]=_[_0x5830('0x42')](_0x23d830[_0x5830('0x41')],{'$or':_['map'](_0x23d830[_0x5830('0x3b')],function(_0x24721b){var _0xf961f1={};_0xf961f1[_0x24721b]={'$like':'%'+_0x54b96[_0x5830('0x36')][_0x5830('0x58')]+'%'};return _0xf961f1;})});}_0x23d830=_[_0x5830('0x42')]({},_0x23d830,_0x54b96[_0x5830('0x4a')]);return _0x5b1709[_0x5830('0x86')](_0x23d830);}})[_0x5830('0x28')](function(_0x339549){if(_0x339549){_0x58aa3f=_0x339549[_0x5830('0x49')];if(!_0x54b96[_0x5830('0x36')][_0x5830('0x3c')](_0x5830('0x3d'))){_0x23d830['limit']=qs['limit'](_0x54b96[_0x5830('0x36')][_0x5830('0x20')]);_0x23d830[_0x5830('0x22')]=qs[_0x5830('0x22')](_0x54b96['query']['offset']);}return _0x5b1709[_0x5830('0x86')](_0x23d830);}})[_0x5830('0x28')](function(_0x2d3ecb){if(_0x2d3ecb){return _0x2d3ecb?{'count':_0x58aa3f,'rows':_0x2d3ecb}:null;}})[_0x5830('0x28')](respondWithResult(_0x104692,null))[_0x5830('0x46')](handleError(_0x104692,null));}; \ No newline at end of file +var _0xde62=['each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','emit','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','index','map','OpenchannelQueue','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','update','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','sequelize'];(function(_0x3bcf98,_0x131ff2){var _0x58baa3=function(_0x4bfad5){while(--_0x4bfad5){_0x3bcf98['push'](_0x3bcf98['shift']());}};_0x58baa3(++_0x131ff2);}(_0xde62,0x1c1));var _0x2de6=function(_0x351ad2,_0x5aaa37){_0x351ad2=_0x351ad2-0x0;var _0x316205=_0xde62[_0x351ad2];return _0x316205;};'use strict';var emlformat=require(_0x2de6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2de6('0x1'));var jsonpatch=require(_0x2de6('0x2'));var rp=require(_0x2de6('0x3'));var moment=require(_0x2de6('0x4'));var BPromise=require(_0x2de6('0x5'));var Mustache=require(_0x2de6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2de6('0x7'));var csv=require(_0x2de6('0x8'));var ejs=require(_0x2de6('0x9'));var fs=require('fs');var fs_extra=require(_0x2de6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2de6('0xb'));var jsforce=require(_0x2de6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2de6('0x8'));var querystring=require(_0x2de6('0xd'));var Papa=require(_0x2de6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2de6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2de6('0x10'));var logger=require(_0x2de6('0x11'))(_0x2de6('0x12'));var utils=require(_0x2de6('0x13'));var config=require(_0x2de6('0x14'));var licenseUtil=require(_0x2de6('0x15'));var db=require(_0x2de6('0x16'))['db'];config[_0x2de6('0x17')]=_[_0x2de6('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2de6('0x19'))(new Redis(config[_0x2de6('0x17')]));require('./openchannelQueue.socket')[_0x2de6('0x1a')](socket);function respondWithStatusCode(_0x5c068e,_0x138fc2){_0x138fc2=_0x138fc2||0xcc;return function(_0x120bc9){if(_0x120bc9){return _0x5c068e[_0x2de6('0x1b')](_0x138fc2);}return _0x5c068e['status'](_0x138fc2)['end']();};}function respondWithResult(_0x5e7ee6,_0x2627d0){_0x2627d0=_0x2627d0||0xc8;return function(_0x1cbe74){if(_0x1cbe74){return _0x5e7ee6[_0x2de6('0x1c')](_0x2627d0)[_0x2de6('0x1d')](_0x1cbe74);}};}function respondWithFilteredResult(_0x16d425,_0x28cac2){return function(_0x5f1a20){if(_0x5f1a20){var _0x579494=typeof _0x28cac2[_0x2de6('0x1e')]===_0x2de6('0x1f')&&typeof _0x28cac2[_0x2de6('0x20')]===_0x2de6('0x1f');var _0x1a7ac5=_0x5f1a20['count'];var _0x159fd5=_0x579494?0x0:_0x28cac2[_0x2de6('0x1e')];var _0x3eecb3=_0x579494?_0x5f1a20['count']:_0x28cac2[_0x2de6('0x1e')]+_0x28cac2[_0x2de6('0x20')];var _0x3d2ac2;if(_0x3eecb3>=_0x1a7ac5){_0x3eecb3=_0x1a7ac5;_0x3d2ac2=0xc8;}else{_0x3d2ac2=0xce;}_0x16d425[_0x2de6('0x1c')](_0x3d2ac2);return _0x16d425[_0x2de6('0x21')](_0x2de6('0x22'),_0x159fd5+'-'+_0x3eecb3+'/'+_0x1a7ac5)[_0x2de6('0x1d')](_0x5f1a20);}return null;};}function patchUpdates(_0x5c631b){return function(_0x3933b2){try{jsonpatch['apply'](_0x3933b2,_0x5c631b,!![]);}catch(_0x514658){return BPromise[_0x2de6('0x23')](_0x514658);}return _0x3933b2[_0x2de6('0x24')]();};}function saveUpdates(_0x2b96e1,_0x2af078){return function(_0x521929){if(_0x521929){return _0x521929['update'](_0x2b96e1)[_0x2de6('0x25')](function(_0x1ca4a0){return _0x1ca4a0;});}return null;};}function removeEntity(_0x32e569,_0x30683c){return function(_0x37b285){if(_0x37b285){return _0x37b285[_0x2de6('0x26')]()['then'](function(){var _0x42ecf8=_0x37b285[_0x2de6('0x27')]({'plain':!![]});var _0x3e1675=_0x2de6('0x28');return db[_0x2de6('0x29')][_0x2de6('0x26')]({'where':{'type':_0x3e1675,'resourceId':_0x42ecf8['id']}})[_0x2de6('0x25')](function(){return _0x37b285;});})[_0x2de6('0x25')](function(){_0x32e569[_0x2de6('0x1c')](0xcc)[_0x2de6('0x2a')]();});}};}function handleEntityNotFound(_0x4ae306,_0x562bdc){return function(_0x3bbaa2){if(!_0x3bbaa2){_0x4ae306['sendStatus'](0x194);}return _0x3bbaa2;};}function handleError(_0x41365f,_0x4e7d9d){_0x4e7d9d=_0x4e7d9d||0x1f4;return function(_0x98d4f4){logger[_0x2de6('0x2b')](_0x98d4f4[_0x2de6('0x2c')]);if(_0x98d4f4[_0x2de6('0x2d')]){delete _0x98d4f4['name'];}_0x41365f[_0x2de6('0x1c')](_0x4e7d9d)['send'](_0x98d4f4);};}exports[_0x2de6('0x2e')]=function(_0x5bd926,_0x1c56c9){var _0x51911c={},_0x428ff8={},_0x11a77c={'count':0x0,'rows':[]};var _0x511365=_[_0x2de6('0x2f')](db[_0x2de6('0x30')][_0x2de6('0x31')],function(_0x236ff1){return{'name':_0x236ff1['fieldName'],'type':_0x236ff1[_0x2de6('0x32')]['key']};});_0x428ff8[_0x2de6('0x33')]=_[_0x2de6('0x2f')](_0x511365,_0x2de6('0x2d'));_0x428ff8[_0x2de6('0x34')]=_[_0x2de6('0x35')](_0x5bd926['query']);_0x428ff8['filters']=_['intersection'](_0x428ff8[_0x2de6('0x33')],_0x428ff8['query']);_0x51911c[_0x2de6('0x36')]=_[_0x2de6('0x37')](_0x428ff8['model'],qs[_0x2de6('0x38')](_0x5bd926[_0x2de6('0x34')][_0x2de6('0x38')]));_0x51911c['attributes']=_0x51911c[_0x2de6('0x36')][_0x2de6('0x39')]?_0x51911c[_0x2de6('0x36')]:_0x428ff8[_0x2de6('0x33')];if(!_0x5bd926[_0x2de6('0x34')][_0x2de6('0x3a')](_0x2de6('0x3b'))){_0x51911c[_0x2de6('0x20')]=qs[_0x2de6('0x20')](_0x5bd926[_0x2de6('0x34')][_0x2de6('0x20')]);_0x51911c[_0x2de6('0x1e')]=qs[_0x2de6('0x1e')](_0x5bd926[_0x2de6('0x34')][_0x2de6('0x1e')]);}_0x51911c[_0x2de6('0x3c')]=qs[_0x2de6('0x3d')](_0x5bd926[_0x2de6('0x34')][_0x2de6('0x3d')]);_0x51911c['where']=qs[_0x2de6('0x3e')](_[_0x2de6('0x3f')](_0x5bd926[_0x2de6('0x34')],_0x428ff8[_0x2de6('0x3e')]),_0x511365);if(_0x5bd926[_0x2de6('0x34')][_0x2de6('0x40')]){_0x51911c[_0x2de6('0x41')]=_[_0x2de6('0x42')](_0x51911c[_0x2de6('0x41')],{'$or':_[_0x2de6('0x2f')](_0x511365,function(_0x52779b){if(_0x52779b[_0x2de6('0x32')]!==_0x2de6('0x43')){var _0x5798d4={};_0x5798d4[_0x52779b[_0x2de6('0x2d')]]={'$like':'%'+_0x5bd926[_0x2de6('0x34')]['filter']+'%'};return _0x5798d4;}})});}_0x51911c=_[_0x2de6('0x42')]({},_0x51911c,_0x5bd926[_0x2de6('0x44')]);var _0x593043={'where':_0x51911c[_0x2de6('0x41')]};return db[_0x2de6('0x30')][_0x2de6('0x45')](_0x593043)['then'](function(_0x4cf9d7){_0x11a77c[_0x2de6('0x45')]=_0x4cf9d7;if(_0x5bd926[_0x2de6('0x34')][_0x2de6('0x46')]){_0x51911c[_0x2de6('0x47')]=[{'all':!![]}];}return db[_0x2de6('0x30')][_0x2de6('0x48')](_0x51911c);})['then'](function(_0x36a724){_0x11a77c[_0x2de6('0x49')]=_0x36a724;return _0x11a77c;})['then'](respondWithFilteredResult(_0x1c56c9,_0x51911c))['catch'](handleError(_0x1c56c9,null));};exports[_0x2de6('0x4a')]=function(_0xe3190,_0x261c6a){var _0xf74058={'raw':!![],'where':{'id':_0xe3190[_0x2de6('0x4b')]['id']}},_0x15b30c={};_0x15b30c['model']=_[_0x2de6('0x35')](db[_0x2de6('0x30')]['rawAttributes']);_0x15b30c['query']=_[_0x2de6('0x35')](_0xe3190['query']);_0x15b30c['filters']=_[_0x2de6('0x37')](_0x15b30c[_0x2de6('0x33')],_0x15b30c[_0x2de6('0x34')]);_0xf74058[_0x2de6('0x36')]=_[_0x2de6('0x37')](_0x15b30c['model'],qs['fields'](_0xe3190['query'][_0x2de6('0x38')]));_0xf74058[_0x2de6('0x36')]=_0xf74058[_0x2de6('0x36')][_0x2de6('0x39')]?_0xf74058[_0x2de6('0x36')]:_0x15b30c[_0x2de6('0x33')];if(_0xe3190[_0x2de6('0x34')][_0x2de6('0x46')]){_0xf74058[_0x2de6('0x47')]=[{'all':!![]}];}_0xf74058=_[_0x2de6('0x42')]({},_0xf74058,_0xe3190[_0x2de6('0x44')]);return db[_0x2de6('0x30')]['find'](_0xf74058)[_0x2de6('0x25')](handleEntityNotFound(_0x261c6a,null))[_0x2de6('0x25')](respondWithResult(_0x261c6a,null))[_0x2de6('0x4c')](handleError(_0x261c6a,null));};exports['create']=function(_0x2eab03,_0x152ce3){return db[_0x2de6('0x30')][_0x2de6('0x4d')](_0x2eab03[_0x2de6('0x4e')],{})[_0x2de6('0x25')](function(_0x216589){var _0x2f840a=_0x2eab03['user']['get']({'plain':!![]});if(!_0x2f840a)throw new Error(_0x2de6('0x4f'));if(_0x2f840a['role']===_0x2de6('0x50')){var _0x367657=_0x216589[_0x2de6('0x27')]({'plain':!![]});var _0x12cea7='OpenchannelQueues';return db['UserProfileSection'][_0x2de6('0x51')]({'where':{'name':_0x12cea7,'userProfileId':_0x2f840a[_0x2de6('0x52')]},'raw':!![]})[_0x2de6('0x25')](function(_0x24b59a){if(_0x24b59a&&_0x24b59a[_0x2de6('0x53')]===0x0){return db['UserProfileResource'][_0x2de6('0x4d')]({'name':_0x367657[_0x2de6('0x2d')],'resourceId':_0x367657['id'],'type':_0x24b59a[_0x2de6('0x2d')],'sectionId':_0x24b59a['id']},{})[_0x2de6('0x25')](function(){return _0x216589;});}else{return _0x216589;}})['catch'](function(_0x8a99eb){logger[_0x2de6('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8a99eb);throw _0x8a99eb;});}return _0x216589;})[_0x2de6('0x25')](respondWithResult(_0x152ce3,0xc9))['catch'](handleError(_0x152ce3,null));};exports[_0x2de6('0x54')]=function(_0x140491,_0x1e7adf){if(_0x140491[_0x2de6('0x4e')]['id']){delete _0x140491[_0x2de6('0x4e')]['id'];}return db[_0x2de6('0x30')]['find']({'where':{'id':_0x140491[_0x2de6('0x4b')]['id']}})[_0x2de6('0x25')](handleEntityNotFound(_0x1e7adf,null))[_0x2de6('0x25')](saveUpdates(_0x140491[_0x2de6('0x4e')],null))['then'](respondWithResult(_0x1e7adf,null))[_0x2de6('0x4c')](handleError(_0x1e7adf,null));};exports[_0x2de6('0x26')]=function(_0x409c47,_0x276a7d){return db[_0x2de6('0x30')][_0x2de6('0x51')]({'where':{'id':_0x409c47['params']['id']}})[_0x2de6('0x25')](handleEntityNotFound(_0x276a7d,null))['then'](removeEntity(_0x276a7d,null))[_0x2de6('0x4c')](handleError(_0x276a7d,null));};exports[_0x2de6('0x55')]=function(_0x1122bf,_0x42bca5){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x42bca5,null))['catch'](handleError(_0x42bca5,null));};exports[_0x2de6('0x56')]=function(_0x3a1e33,_0x7cab72,_0x2fa7bd){var _0x39574c={'raw':!![],'where':{}},_0x39e662={},_0x19dd6b;return db['OpenchannelQueue'][_0x2de6('0x57')]({'where':{'id':_0x3a1e33[_0x2de6('0x4b')]['id']}})[_0x2de6('0x25')](handleEntityNotFound(_0x7cab72,null))['then'](function(_0x299eee){if(_0x299eee){_0x19dd6b=_0x299eee['get']({'plain':!![]});_0x39e662[_0x2de6('0x33')]=_[_0x2de6('0x35')](db[_0x2de6('0x58')][_0x2de6('0x31')]);_0x39e662[_0x2de6('0x34')]=_['keys'](_0x3a1e33[_0x2de6('0x34')]);_0x39e662['filters']=_[_0x2de6('0x37')](_0x39e662[_0x2de6('0x33')],_0x39e662[_0x2de6('0x34')]);_0x39574c[_0x2de6('0x36')]=_[_0x2de6('0x37')](_0x39e662[_0x2de6('0x33')],qs[_0x2de6('0x38')](_0x3a1e33[_0x2de6('0x34')][_0x2de6('0x38')]));_0x39574c['attributes']=_0x39574c[_0x2de6('0x36')][_0x2de6('0x39')]?_0x39574c[_0x2de6('0x36')]:_0x39e662[_0x2de6('0x33')];if(!_0x3a1e33[_0x2de6('0x34')]['hasOwnProperty'](_0x2de6('0x3b'))){_0x39574c[_0x2de6('0x20')]=qs[_0x2de6('0x20')](_0x3a1e33[_0x2de6('0x34')][_0x2de6('0x20')]);_0x39574c['offset']=qs['offset'](_0x3a1e33[_0x2de6('0x34')][_0x2de6('0x1e')]);}_0x39574c[_0x2de6('0x3c')]=qs[_0x2de6('0x3d')](_0x3a1e33[_0x2de6('0x34')][_0x2de6('0x3d')]);_0x39574c[_0x2de6('0x41')]=qs['filters'](_[_0x2de6('0x3f')](_0x3a1e33[_0x2de6('0x34')],_0x39e662[_0x2de6('0x3e')]));_0x39574c[_0x2de6('0x41')][_0x2de6('0x59')]=_0x299eee['id'];if(_0x3a1e33['query'][_0x2de6('0x40')]){_0x39574c[_0x2de6('0x41')]=_[_0x2de6('0x42')](_0x39574c[_0x2de6('0x41')],{'$or':_['map'](_0x39574c[_0x2de6('0x36')],function(_0x54b6b2){var _0x446596={};_0x446596[_0x54b6b2]={'$like':'%'+_0x3a1e33[_0x2de6('0x34')][_0x2de6('0x40')]+'%'};return _0x446596;})});}_0x39574c=_['merge']({},_0x39574c,_0x3a1e33[_0x2de6('0x44')]);return db[_0x2de6('0x58')][_0x2de6('0x48')](_0x39574c);}})[_0x2de6('0x25')](function(_0x23e676){if(_0x23e676){return db[_0x2de6('0x5a')][_0x2de6('0x5b')]({'where':{'id':_['map'](_0x23e676,_0x2de6('0x5c')),'role':_0x2de6('0x5d')},'attributes':['id',_0x2de6('0x2d'),'openchannelPause',_0x2de6('0x5e'),_0x2de6('0x5f')]});}})[_0x2de6('0x25')](function(_0x3f6142){if(_0x3f6142){return{'count':_0x3f6142['count'],'rows':_[_0x2de6('0x2f')](_0x3f6142[_0x2de6('0x49')],function(_0x226f6e){return{'membername':_0x226f6e[_0x2de6('0x2d')],'UserId':_0x226f6e['id'],'queue_name':_0x19dd6b[_0x2de6('0x2d')],'OpenchannelQueueId':_0x19dd6b['id'],'interface':util['format'](_0x2de6('0x60'),_0x2de6('0x61'),_0x226f6e[_0x2de6('0x2d')]),'penalty':0x0,'paused':_0x226f6e[_0x2de6('0x62')],'createdAt':_0x226f6e[_0x2de6('0x5f')],'updatedAt':_0x226f6e[_0x2de6('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7cab72,_0x39574c))['catch'](handleError(_0x7cab72,null));};exports[_0x2de6('0x63')]=function(_0x5385c7,_0x570783,_0x4ad1d5){var _0x11861c={};var _0x2592f2={};var _0xf4596d;var _0x36ca32;return db[_0x2de6('0x30')][_0x2de6('0x57')]({'where':{'id':_0x5385c7[_0x2de6('0x4b')]['id']}})[_0x2de6('0x25')](handleEntityNotFound(_0x570783,null))[_0x2de6('0x25')](function(_0x1499e3){if(_0x1499e3){_0xf4596d=_0x1499e3;_0x2592f2[_0x2de6('0x33')]=_[_0x2de6('0x35')](db[_0x2de6('0x64')][_0x2de6('0x31')]);_0x2592f2[_0x2de6('0x34')]=_[_0x2de6('0x35')](_0x5385c7[_0x2de6('0x34')]);_0x2592f2['filters']=_['intersection'](_0x2592f2[_0x2de6('0x33')],_0x2592f2['query']);_0x11861c['attributes']=_[_0x2de6('0x37')](_0x2592f2[_0x2de6('0x33')],qs[_0x2de6('0x38')](_0x5385c7[_0x2de6('0x34')]['fields']));_0x11861c[_0x2de6('0x36')]=_0x11861c[_0x2de6('0x36')][_0x2de6('0x39')]?_0x11861c[_0x2de6('0x36')]:_0x2592f2[_0x2de6('0x33')];_0x11861c[_0x2de6('0x3c')]=qs[_0x2de6('0x3d')](_0x5385c7[_0x2de6('0x34')]['sort']);_0x11861c['where']=qs['filters'](_[_0x2de6('0x3f')](_0x5385c7[_0x2de6('0x34')],_0x2592f2[_0x2de6('0x3e')]));if(_0x5385c7[_0x2de6('0x34')][_0x2de6('0x40')]){_0x11861c[_0x2de6('0x41')]=_[_0x2de6('0x42')](_0x11861c['where'],{'$or':_[_0x2de6('0x2f')](_0x11861c[_0x2de6('0x36')],function(_0x25918a){var _0x1f1d0c={};_0x1f1d0c[_0x25918a]={'$like':'%'+_0x5385c7['query']['filter']+'%'};return _0x1f1d0c;})});}_0x11861c=_[_0x2de6('0x42')]({},_0x11861c,_0x5385c7[_0x2de6('0x44')]);return _0xf4596d[_0x2de6('0x63')](_0x11861c);}})[_0x2de6('0x25')](function(_0x247a6c){if(_0x247a6c){_0x36ca32=_0x247a6c[_0x2de6('0x39')];if(!_0x5385c7['query'][_0x2de6('0x3a')](_0x2de6('0x3b'))){_0x11861c[_0x2de6('0x20')]=qs['limit'](_0x5385c7[_0x2de6('0x34')]['limit']);_0x11861c['offset']=qs['offset'](_0x5385c7[_0x2de6('0x34')][_0x2de6('0x1e')]);}return _0xf4596d['getTeams'](_0x11861c);}})['then'](function(_0x45f511){if(_0x45f511){return _0x45f511?{'count':_0x36ca32,'rows':_0x45f511}:null;}})['then'](respondWithResult(_0x570783,null))[_0x2de6('0x4c')](handleError(_0x570783,null));};exports[_0x2de6('0x65')]=function(_0x1d10b7,_0x52b954,_0xd853e3){var _0x4fc347=_0x1d10b7[_0x2de6('0x4e')][_0x2de6('0x66')];return db[_0x2de6('0x64')][_0x2de6('0x48')]({'where':{'id':_0x4fc347},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2de6('0x67'),'attributes':['id','name',_0x2de6('0x68'),_0x2de6('0x69'),'interface'],'raw':!![]}]})[_0x2de6('0x25')](function(_0x5b3104){if(_0x5b3104){var _0x5b065b=_['flatMap'](_0x5b3104,function(_0x2da87c){var _0x473760=_0x2da87c[_0x2de6('0x27')]({'plain':!![]});return _0x473760[_0x2de6('0x67')];});return db['OpenchannelQueue'][_0x2de6('0x51')]({'where':{'id':_0x1d10b7[_0x2de6('0x4b')]['id']}})['then'](function(_0x4340c2){return db[_0x2de6('0x6a')]['transaction'](function(_0x17c78a){return _0x4340c2['addTeams'](_0x4fc347,{'transaction':_0x17c78a})[_0x2de6('0x25')](function(){return BPromise[_0x2de6('0x6b')](_0x5b065b,function(_0x3236b9){return db['UserOpenchannelQueue'][_0x2de6('0x6c')]({'where':{'UserId':_0x3236b9['id'],'OpenchannelQueueId':_0x1d10b7[_0x2de6('0x4b')]['id']},'transaction':_0x17c78a});});})[_0x2de6('0x25')](function(){_0x5b065b[_0x2de6('0x6d')](function(_0x5c31b4){socket['emit'](_0x2de6('0x6e'),{'UserId':_0x5c31b4['id'],'OpenchannelQueueId':_0x4340c2['id']});});});});});}})[_0x2de6('0x25')](respondWithStatusCode(_0x52b954,null))[_0x2de6('0x4c')](handleError(_0x52b954,null));};exports[_0x2de6('0x6f')]=function(_0x372dd0,_0x526d64,_0x5b4ea3){return db['Team'][_0x2de6('0x48')]({'where':{'id':_0x372dd0[_0x2de6('0x34')][_0x2de6('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2de6('0x67'),'attributes':['id'],'raw':!![]}]})[_0x2de6('0x25')](handleEntityNotFound(_0x526d64,null))[_0x2de6('0x25')](function(_0x45c155){var _0x24c3b1=_[_0x2de6('0x2f')](_0x45c155,'id');var _0x1f0672=[];var _0x1fbeb9=[];var _0x4fd25b=squel[_0x2de6('0x70')]();_0x4fd25b[_0x2de6('0x71')](_0x2de6('0x72'))[_0x2de6('0x73')](_0x2de6('0x74'),'tq')[_0x2de6('0x75')](_0x2de6('0x76'),'ut',_0x2de6('0x77'))[_0x2de6('0x41')](_0x2de6('0x78'),_0x372dd0[_0x2de6('0x4b')]['id']);for(var _0x367a09=0x0;_0x367a09<_0x45c155[_0x2de6('0x39')];_0x367a09+=0x1){let _0x55b02c=_0x45c155[_0x367a09];for(var _0x2cbaf4=0x0;_0x2cbaf4<_0x55b02c[_0x2de6('0x67')][_0x2de6('0x39')];_0x2cbaf4+=0x1){let _0x4895eb=_0x55b02c[_0x2de6('0x67')][_0x2cbaf4];var _0x48d10a=_0x4fd25b[_0x2de6('0x79')]();_0x48d10a[_0x2de6('0x41')](_0x2de6('0x7a'),_0x4895eb['id']);_0x1fbeb9['push'](db[_0x2de6('0x6a')][_0x2de6('0x34')](_0x48d10a['toString'](),{'type':db[_0x2de6('0x6a')][_0x2de6('0x7b')][_0x2de6('0x7c')]})['then'](function(_0x4eda92){if(_0x4eda92[_0x2de6('0x39')]===0x1){return _0x4895eb['id'];}else{var _0x33d9d9=_[_0x2de6('0x7d')](_[_0x2de6('0x2f')](_0x4eda92,_0x2de6('0x7e')),function(_0x199279){return _['includes'](_0x24c3b1,_0x199279);});if(_0x33d9d9){return _0x4895eb['id'];}}}));}}return BPromise[_0x2de6('0x7f')](_0x1fbeb9)[_0x2de6('0x25')](function(_0x451210){_0x1f0672=_(_0x1f0672)[_0x2de6('0x80')](_0x451210)[_0x2de6('0x81')]()[_0x2de6('0x82')]();return db[_0x2de6('0x30')][_0x2de6('0x51')]({'where':{'id':_0x372dd0['params']['id']}})[_0x2de6('0x25')](function(_0x5845dd){return db['sequelize']['transaction'](function(_0x3eff49){return _0x5845dd[_0x2de6('0x6f')](_0x372dd0[_0x2de6('0x34')][_0x2de6('0x66')],{'transaction':_0x3eff49})[_0x2de6('0x25')](function(){if(!_[_0x2de6('0x83')](_0x1f0672)){return _0x5845dd[_0x2de6('0x84')](_0x1f0672,{'transaction':_0x3eff49});}})[_0x2de6('0x25')](function(){_0x1f0672[_0x2de6('0x6d')](function(_0x54e0d1){socket['emit'](_0x2de6('0x85'),{'UserId':_0x54e0d1,'OpenchannelQueueId':_0x5845dd['id']});});});});});});})['then'](respondWithStatusCode(_0x526d64,null))[_0x2de6('0x4c')](handleError(_0x526d64,null));};exports[_0x2de6('0x86')]=function(_0x88677,_0x5e96a1,_0x367de8){return db[_0x2de6('0x30')][_0x2de6('0x51')]({'where':{'id':_0x88677[_0x2de6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e96a1,null))[_0x2de6('0x25')](function(_0xb1ace5){if(_0xb1ace5){return _0xb1ace5['addAgents'](_0x88677[_0x2de6('0x4e')][_0x2de6('0x66')],_['omit'](_0x88677['body'],['ids','id'])||{})[_0x2de6('0x87')](function(_0x5e4f1c){for(var _0x3a1287=0x0;_0x3a1287<_0x88677[_0x2de6('0x4e')]['ids'][_0x2de6('0x39')];_0x3a1287+=0x1){socket['emit'](_0x2de6('0x6e'),{'UserId':Number(_0x88677['body'][_0x2de6('0x66')][_0x3a1287]),'OpenchannelQueueId':Number(_0x88677[_0x2de6('0x4b')]['id'])});}return _0x5e4f1c;});}})[_0x2de6('0x25')](respondWithResult(_0x5e96a1,null))[_0x2de6('0x4c')](handleError(_0x5e96a1,null));};exports[_0x2de6('0x84')]=function(_0x235112,_0x4ed37f,_0x2202c5){return db[_0x2de6('0x30')][_0x2de6('0x51')]({'where':{'id':_0x235112['params']['id']}})['then'](handleEntityNotFound(_0x4ed37f,null))['then'](function(_0x456466){if(_0x456466){return _0x456466['removeAgents'](_0x235112[_0x2de6('0x34')][_0x2de6('0x66')])['then'](function(){if(_[_0x2de6('0x88')](_0x235112[_0x2de6('0x34')][_0x2de6('0x66')])){for(var _0x1974c4=0x0;_0x1974c4<_0x235112[_0x2de6('0x34')][_0x2de6('0x66')][_0x2de6('0x39')];_0x1974c4+=0x1){socket[_0x2de6('0x89')](_0x2de6('0x85'),{'UserId':Number(_0x235112['query'][_0x2de6('0x66')][_0x1974c4]),'OpenchannelQueueId':Number(_0x235112[_0x2de6('0x4b')]['id'])});}}else{socket['emit'](_0x2de6('0x85'),{'UserId':Number(_0x235112[_0x2de6('0x34')]['ids']),'OpenchannelQueueId':Number(_0x235112[_0x2de6('0x4b')]['id'])});}});}})[_0x2de6('0x25')](respondWithStatusCode(_0x4ed37f,null))['catch'](handleError(_0x4ed37f,null));};exports[_0x2de6('0x8a')]=function(_0x203f79,_0xde1a11,_0x46491f){var _0x20f720={};var _0x3f50ca={};var _0x4c42e9;var _0x4cc1fc;return db['OpenchannelQueue'][_0x2de6('0x57')]({'where':{'id':_0x203f79['params']['id']}})['then'](handleEntityNotFound(_0xde1a11,null))[_0x2de6('0x25')](function(_0x19d7b7){if(_0x19d7b7){_0x4c42e9=_0x19d7b7;_0x3f50ca[_0x2de6('0x33')]=_[_0x2de6('0x35')](db['User'][_0x2de6('0x31')]);_0x3f50ca[_0x2de6('0x34')]=_[_0x2de6('0x35')](_0x203f79[_0x2de6('0x34')]);_0x3f50ca['filters']=_[_0x2de6('0x37')](_0x3f50ca['model'],_0x3f50ca[_0x2de6('0x34')]);_0x20f720[_0x2de6('0x36')]=_[_0x2de6('0x37')](_0x3f50ca[_0x2de6('0x33')],qs[_0x2de6('0x38')](_0x203f79[_0x2de6('0x34')][_0x2de6('0x38')]));_0x20f720[_0x2de6('0x36')]=_0x20f720[_0x2de6('0x36')][_0x2de6('0x39')]?_0x20f720['attributes']:_0x3f50ca[_0x2de6('0x33')];_0x20f720[_0x2de6('0x3c')]=qs[_0x2de6('0x3d')](_0x203f79[_0x2de6('0x34')][_0x2de6('0x3d')]);_0x20f720[_0x2de6('0x41')]=qs[_0x2de6('0x3e')](_[_0x2de6('0x3f')](_0x203f79[_0x2de6('0x34')],_0x3f50ca[_0x2de6('0x3e')]));if(_0x203f79[_0x2de6('0x34')][_0x2de6('0x40')]){_0x20f720['where']=_[_0x2de6('0x42')](_0x20f720[_0x2de6('0x41')],{'$or':_[_0x2de6('0x2f')](_0x20f720[_0x2de6('0x36')],function(_0x194243){var _0x55e06b={};_0x55e06b[_0x194243]={'$like':'%'+_0x203f79[_0x2de6('0x34')][_0x2de6('0x40')]+'%'};return _0x55e06b;})});}_0x20f720=_[_0x2de6('0x42')]({},_0x20f720,_0x203f79[_0x2de6('0x44')]);return _0x4c42e9['getAgents'](_0x20f720);}})[_0x2de6('0x25')](function(_0x5e5321){if(_0x5e5321){_0x4cc1fc=_0x5e5321['length'];if(!_0x203f79[_0x2de6('0x34')][_0x2de6('0x3a')]('nolimit')){_0x20f720[_0x2de6('0x20')]=qs[_0x2de6('0x20')](_0x203f79[_0x2de6('0x34')][_0x2de6('0x20')]);_0x20f720[_0x2de6('0x1e')]=qs['offset'](_0x203f79[_0x2de6('0x34')][_0x2de6('0x1e')]);}return _0x4c42e9['getAgents'](_0x20f720);}})['then'](function(_0x1e4b35){if(_0x1e4b35){return _0x1e4b35?{'count':_0x4cc1fc,'rows':_0x1e4b35}:null;}})[_0x2de6('0x25')](respondWithResult(_0xde1a11,null))[_0x2de6('0x4c')](handleError(_0xde1a11,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index f09d2be..c820d74 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 _0x0e89=['../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x54245a,_0x400128){var _0x14ab2f=function(_0x380cdf){while(--_0x380cdf){_0x54245a['push'](_0x54245a['shift']());}};_0x14ab2f(++_0x400128);}(_0x0e89,0x77));var _0x90e8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0e89[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0x90e8('0x0'));var OpenchannelQueue=require(_0x90e8('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x90e8('0x2')](0x0);var events={'afterCreate':_0x90e8('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a7983){return function(_0x2659b1,_0x5ead76,_0x49b5a6){OpenchannelQueueEvents[_0x90e8('0x4')](_0x4a7983+':'+_0x2659b1['id'],_0x2659b1);OpenchannelQueueEvents[_0x90e8('0x4')](_0x4a7983,_0x2659b1);_0x49b5a6(null);};}for(var e in events){if(events[_0x90e8('0x5')](e)){var event=events[e];OpenchannelQueue[_0x90e8('0x6')](e,emitEvent(event));}}module[_0x90e8('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7d5a=['events','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x28e89e,_0xdac59d){var _0x1a8201=function(_0x104b21){while(--_0x104b21){_0x28e89e['push'](_0x28e89e['shift']());}};_0x1a8201(++_0xdac59d);}(_0x7d5a,0x195));var _0xa7d5=function(_0x1594ae,_0x5235ba){_0x1594ae=_0x1594ae-0x0;var _0x1538d6=_0x7d5a[_0x1594ae];return _0x1538d6;};'use strict';var EventEmitter=require(_0xa7d5('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xa7d5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa7d5('0x2')](0x0);var events={'afterCreate':_0xa7d5('0x3'),'afterUpdate':_0xa7d5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c99a3){return function(_0x2feaa6,_0xd5695d,_0x6b7d46){OpenchannelQueueEvents[_0xa7d5('0x5')](_0x5c99a3+':'+_0x2feaa6['id'],_0x2feaa6);OpenchannelQueueEvents['emit'](_0x5c99a3,_0x2feaa6);_0x6b7d46(null);};}for(var e in events){if(events[_0xa7d5('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa7d5('0x7')](e,emitEvent(event));}}module[_0xa7d5('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 75726fd..3ccd8ca 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 _0x78ad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0xe00717,_0x2fa896){var _0xac3475=function(_0x51dbe6){while(--_0x51dbe6){_0xe00717['push'](_0xe00717['shift']());}};_0xac3475(++_0x2fa896);}(_0x78ad,0x14d));var _0xd78a=function(_0x5d5159,_0x495ed4){_0x5d5159=_0x5d5159-0x0;var _0x349e57=_0x78ad[_0x5d5159];return _0x349e57;};'use strict';var _=require(_0xd78a('0x0'));var util=require(_0xd78a('0x1'));var logger=require(_0xd78a('0x2'))(_0xd78a('0x3'));var moment=require(_0xd78a('0x4'));var BPromise=require(_0xd78a('0x5'));var rp=require(_0xd78a('0x6'));var fs=require('fs');var path=require(_0xd78a('0x7'));var rimraf=require(_0xd78a('0x8'));var config=require(_0xd78a('0x9'));var attributes=require(_0xd78a('0xa'));module[_0xd78a('0xb')]=function(_0x82f4bc,_0x1b10c4){return _0x82f4bc[_0xd78a('0xc')](_0xd78a('0xd'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18b3=['exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x1300ec,_0x3ff267){var _0x2c13c9=function(_0x58d88){while(--_0x58d88){_0x1300ec['push'](_0x1300ec['shift']());}};_0x2c13c9(++_0x3ff267);}(_0x18b3,0xa0));var _0x318b=function(_0x49b052,_0x3670f4){_0x49b052=_0x49b052-0x0;var _0x1edb70=_0x18b3[_0x49b052];return _0x1edb70;};'use strict';var _=require(_0x318b('0x0'));var util=require('util');var logger=require(_0x318b('0x1'))(_0x318b('0x2'));var moment=require('moment');var BPromise=require(_0x318b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x318b('0x4'));var rimraf=require(_0x318b('0x5'));var config=require(_0x318b('0x6'));var attributes=require(_0x318b('0x7'));module[_0x318b('0x8')]=function(_0x22a185,_0x344a91){return _0x22a185[_0x318b('0x9')](_0x318b('0xa'),attributes,{'tableName':_0x318b('0xb'),'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 c8f262d..a729f94 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 _0xe743=['ShowOpenchannelQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch'];(function(_0x13dbe6,_0x31984b){var _0x242052=function(_0x4557b1){while(--_0x4557b1){_0x13dbe6['push'](_0x13dbe6['shift']());}};_0x242052(++_0x31984b);}(_0xe743,0xc0));var _0x3e74=function(_0x5058d4,_0x93e040){_0x5058d4=_0x5058d4-0x0;var _0x1377b4=_0xe743[_0x5058d4];return _0x1377b4;};'use strict';var _=require('lodash');var util=require(_0x3e74('0x0'));var moment=require(_0x3e74('0x1'));var BPromise=require(_0x3e74('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e74('0x3'));var db=require(_0x3e74('0x4'))['db'];var utils=require(_0x3e74('0x5'));var logger=require(_0x3e74('0x6'))(_0x3e74('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e74('0x8')]['http']({'port':0x232a});config[_0x3e74('0x9')]=_[_0x3e74('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e74('0xb'))(new Redis(config[_0x3e74('0x9')]));require('./openchannelQueue.socket')[_0x3e74('0xc')](socket);function respondWithRpcPromise(_0x160df7,_0x3ebbcf,_0x239a1d){return new BPromise(function(_0x422e07,_0x18e9cc){return client[_0x3e74('0xd')](_0x160df7,_0x239a1d)[_0x3e74('0xe')](function(_0x4a9ea2){logger[_0x3e74('0xf')](_0x3e74('0x10'),_0x3ebbcf,_0x3e74('0x11'));logger['debug'](_0x3e74('0x12'),_0x3ebbcf,_0x3e74('0x11'),JSON['stringify'](_0x4a9ea2));if(_0x4a9ea2[_0x3e74('0x13')]){if(_0x4a9ea2[_0x3e74('0x13')][_0x3e74('0x14')]===0x1f4){logger[_0x3e74('0x13')](_0x3e74('0x10'),_0x3ebbcf,_0x4a9ea2['error'][_0x3e74('0x15')]);return _0x18e9cc(_0x4a9ea2[_0x3e74('0x13')][_0x3e74('0x15')]);}logger[_0x3e74('0x13')](_0x3e74('0x10'),_0x3ebbcf,_0x4a9ea2[_0x3e74('0x13')][_0x3e74('0x15')]);return _0x422e07(_0x4a9ea2[_0x3e74('0x13')][_0x3e74('0x15')]);}else{logger[_0x3e74('0xf')](_0x3e74('0x10'),_0x3ebbcf,_0x3e74('0x11'));_0x422e07(_0x4a9ea2[_0x3e74('0x16')]['message']);}})['catch'](function(_0x4c0970){logger[_0x3e74('0x13')](_0x3e74('0x10'),_0x3ebbcf,_0x4c0970);_0x18e9cc(_0x4c0970);});});}exports[_0x3e74('0x17')]=function(_0x261554){var _0x5dcd98=this;return new Promise(function(_0x3471ef,_0x4e80c8){return db[_0x3e74('0x18')]['findAll']({'raw':_0x261554[_0x3e74('0x19')]?_0x261554[_0x3e74('0x19')][_0x3e74('0x1a')]===undefined?!![]:![]:!![],'where':_0x261554[_0x3e74('0x19')]?_0x261554[_0x3e74('0x19')][_0x3e74('0x1b')]||null:null,'attributes':_0x261554[_0x3e74('0x19')]?_0x261554['options'][_0x3e74('0x1c')]||null:null,'limit':_0x261554[_0x3e74('0x19')]?_0x261554['options'][_0x3e74('0x1d')]||null:null,'include':_0x261554[_0x3e74('0x19')]?_0x261554['options'][_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x261554[_0x3e74('0x19')]['include'],function(_0x55fead){return{'model':db[_0x55fead[_0x3e74('0x20')]],'as':_0x55fead['as'],'attributes':_0x55fead['attributes'],'include':_0x55fead[_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x55fead[_0x3e74('0x1e')],function(_0x3344c3){return{'model':db[_0x3344c3['model']],'as':_0x3344c3['as'],'attributes':_0x3344c3['attributes'],'include':_0x3344c3[_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x3344c3[_0x3e74('0x1e')],function(_0x44696c){return{'model':db[_0x44696c[_0x3e74('0x20')]],'as':_0x44696c['as'],'attributes':_0x44696c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3e74('0xe')](function(_0x1cf09d){logger[_0x3e74('0xf')]('GetOpenchannelQueue',_0x261554);logger[_0x3e74('0x21')](_0x3e74('0x17'),_0x261554,JSON[_0x3e74('0x22')](_0x1cf09d));_0x3471ef(_0x1cf09d);})[_0x3e74('0x23')](function(_0x1eb311){logger[_0x3e74('0x13')]('GetOpenchannelQueue',_0x1eb311[_0x3e74('0x15')],_0x261554);_0x4e80c8(_0x5dcd98[_0x3e74('0x13')](0x1f4,_0x1eb311[_0x3e74('0x15')]));});});};exports[_0x3e74('0x24')]=function(_0x2c3639){var _0x315871=this;return new Promise(function(_0x3913e8,_0x2c48d5){return db[_0x3e74('0x18')][_0x3e74('0x25')]({'raw':_0x2c3639[_0x3e74('0x19')]?_0x2c3639['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c3639[_0x3e74('0x19')]?_0x2c3639[_0x3e74('0x19')]['where']||null:null,'attributes':_0x2c3639['options']?_0x2c3639[_0x3e74('0x19')][_0x3e74('0x1c')]||null:null,'include':_0x2c3639[_0x3e74('0x19')]?_0x2c3639['options'][_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x2c3639[_0x3e74('0x19')][_0x3e74('0x1e')],function(_0x1fac63){return{'model':db[_0x1fac63['model']],'as':_0x1fac63['as'],'attributes':_0x1fac63[_0x3e74('0x1c')],'include':_0x1fac63[_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x1fac63['include'],function(_0x4b29ee){return{'model':db[_0x4b29ee['model']],'as':_0x4b29ee['as'],'attributes':_0x4b29ee['attributes'],'include':_0x4b29ee[_0x3e74('0x1e')]?_[_0x3e74('0x1f')](_0x4b29ee['include'],function(_0x4f42d7){return{'model':db[_0x4f42d7['model']],'as':_0x4f42d7['as'],'attributes':_0x4f42d7[_0x3e74('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e74('0xe')](function(_0x43f966){logger[_0x3e74('0xf')](_0x3e74('0x24'),_0x2c3639);logger[_0x3e74('0x21')](_0x3e74('0x24'),_0x2c3639,JSON['stringify'](_0x43f966));_0x3913e8(_0x43f966);})[_0x3e74('0x23')](function(_0x423ec2){logger[_0x3e74('0x13')]('ShowOpenchannelQueue',_0x423ec2[_0x3e74('0x15')],_0x2c3639);_0x2c48d5(_0x315871[_0x3e74('0x13')](0x1f4,_0x423ec2[_0x3e74('0x15')]));});});}; \ No newline at end of file +var _0x902b=['../../config/logger','rpc','http','redis','defaults','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetOpenchannelQueue','options','raw','where','attributes','include','map','model','stringify','OpenchannelQueue','find','then','ShowOpenchannelQueue','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x902b,0xa1));var _0xb902=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x902b[_0x2aec52];return _0x3b8835;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb902('0x0'));var BPromise=require(_0xb902('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb902('0x2'))['db'];var utils=require(_0xb902('0x3'));var logger=require(_0xb902('0x4'))(_0xb902('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb902('0x6')]({'port':0x232a});config[_0xb902('0x7')]=_[_0xb902('0x8')](config[_0xb902('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb902('0x9'))[_0xb902('0xa')](socket);function respondWithRpcPromise(_0x44c968,_0x390d37,_0x362c74){return new BPromise(function(_0x299ca6,_0x21b9cb){return client['request'](_0x44c968,_0x362c74)['then'](function(_0x11100f){logger[_0xb902('0xb')](_0xb902('0xc'),_0x390d37,'request\x20sent');logger[_0xb902('0xd')](_0xb902('0xe'),_0x390d37,_0xb902('0xf'),JSON['stringify'](_0x11100f));if(_0x11100f[_0xb902('0x10')]){if(_0x11100f[_0xb902('0x10')][_0xb902('0x11')]===0x1f4){logger['error'](_0xb902('0xc'),_0x390d37,_0x11100f[_0xb902('0x10')][_0xb902('0x12')]);return _0x21b9cb(_0x11100f[_0xb902('0x10')]['message']);}logger[_0xb902('0x10')](_0xb902('0xc'),_0x390d37,_0x11100f[_0xb902('0x10')][_0xb902('0x12')]);return _0x299ca6(_0x11100f[_0xb902('0x10')][_0xb902('0x12')]);}else{logger[_0xb902('0xb')](_0xb902('0xc'),_0x390d37,_0xb902('0xf'));_0x299ca6(_0x11100f['result'][_0xb902('0x12')]);}})[_0xb902('0x13')](function(_0x2fc235){logger[_0xb902('0x10')](_0xb902('0xc'),_0x390d37,_0x2fc235);_0x21b9cb(_0x2fc235);});});}exports[_0xb902('0x14')]=function(_0x705c01){var _0x4c2eb8=this;return new Promise(function(_0x2e7369,_0xacc5f1){return db['OpenchannelQueue']['findAll']({'raw':_0x705c01[_0xb902('0x15')]?_0x705c01['options'][_0xb902('0x16')]===undefined?!![]:![]:!![],'where':_0x705c01[_0xb902('0x15')]?_0x705c01[_0xb902('0x15')][_0xb902('0x17')]||null:null,'attributes':_0x705c01[_0xb902('0x15')]?_0x705c01[_0xb902('0x15')][_0xb902('0x18')]||null:null,'limit':_0x705c01['options']?_0x705c01[_0xb902('0x15')]['limit']||null:null,'include':_0x705c01['options']?_0x705c01['options'][_0xb902('0x19')]?_[_0xb902('0x1a')](_0x705c01['options'][_0xb902('0x19')],function(_0x71ab8c){return{'model':db[_0x71ab8c[_0xb902('0x1b')]],'as':_0x71ab8c['as'],'attributes':_0x71ab8c[_0xb902('0x18')],'include':_0x71ab8c[_0xb902('0x19')]?_[_0xb902('0x1a')](_0x71ab8c[_0xb902('0x19')],function(_0x2e2786){return{'model':db[_0x2e2786[_0xb902('0x1b')]],'as':_0x2e2786['as'],'attributes':_0x2e2786[_0xb902('0x18')],'include':_0x2e2786[_0xb902('0x19')]?_[_0xb902('0x1a')](_0x2e2786[_0xb902('0x19')],function(_0x1da09b){return{'model':db[_0x1da09b[_0xb902('0x1b')]],'as':_0x1da09b['as'],'attributes':_0x1da09b[_0xb902('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b5bb8){logger[_0xb902('0xb')](_0xb902('0x14'),_0x705c01);logger[_0xb902('0xd')]('GetOpenchannelQueue',_0x705c01,JSON[_0xb902('0x1c')](_0x3b5bb8));_0x2e7369(_0x3b5bb8);})['catch'](function(_0x3dd6d9){logger[_0xb902('0x10')](_0xb902('0x14'),_0x3dd6d9[_0xb902('0x12')],_0x705c01);_0xacc5f1(_0x4c2eb8['error'](0x1f4,_0x3dd6d9[_0xb902('0x12')]));});});};exports['ShowOpenchannelQueue']=function(_0x556794){var _0x272962=this;return new Promise(function(_0x44b78c,_0xcf50fd){return db[_0xb902('0x1d')][_0xb902('0x1e')]({'raw':_0x556794['options']?_0x556794['options'][_0xb902('0x16')]===undefined?!![]:![]:!![],'where':_0x556794[_0xb902('0x15')]?_0x556794[_0xb902('0x15')][_0xb902('0x17')]||null:null,'attributes':_0x556794[_0xb902('0x15')]?_0x556794[_0xb902('0x15')][_0xb902('0x18')]||null:null,'include':_0x556794[_0xb902('0x15')]?_0x556794[_0xb902('0x15')][_0xb902('0x19')]?_[_0xb902('0x1a')](_0x556794[_0xb902('0x15')][_0xb902('0x19')],function(_0x508eb4){return{'model':db[_0x508eb4[_0xb902('0x1b')]],'as':_0x508eb4['as'],'attributes':_0x508eb4[_0xb902('0x18')],'include':_0x508eb4['include']?_['map'](_0x508eb4[_0xb902('0x19')],function(_0x1eb7f6){return{'model':db[_0x1eb7f6[_0xb902('0x1b')]],'as':_0x1eb7f6['as'],'attributes':_0x1eb7f6[_0xb902('0x18')],'include':_0x1eb7f6['include']?_[_0xb902('0x1a')](_0x1eb7f6[_0xb902('0x19')],function(_0x150edb){return{'model':db[_0x150edb[_0xb902('0x1b')]],'as':_0x150edb['as'],'attributes':_0x150edb[_0xb902('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb902('0x1f')](function(_0x28e7ed){logger[_0xb902('0xb')](_0xb902('0x20'),_0x556794);logger['debug']('ShowOpenchannelQueue',_0x556794,JSON[_0xb902('0x1c')](_0x28e7ed));_0x44b78c(_0x28e7ed);})['catch'](function(_0x347db3){logger[_0xb902('0x10')]('ShowOpenchannelQueue',_0x347db3[_0xb902('0x12')],_0x556794);_0xcf50fd(_0x272962['error'](0x1f4,_0x347db3['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index de17883..82fc0bc 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 _0xb688=['length','openchannelQueue:','./openchannelQueue.events','save','remove','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb688,0x64));var _0x8b68=function(_0x523552,_0x56545a){_0x523552=_0x523552-0x0;var _0x43444b=_0xb688[_0x523552];return _0x43444b;};'use strict';var OpenchannelQueueEvents=require(_0x8b68('0x0'));var events=[_0x8b68('0x1'),_0x8b68('0x2'),'update'];function createListener(_0x164cc8,_0x1cbfb5){return function(_0x2ed6bf){_0x1cbfb5['emit'](_0x164cc8,_0x2ed6bf);};}function removeListener(_0x205b5e,_0x233301){return function(){OpenchannelQueueEvents[_0x8b68('0x3')](_0x205b5e,_0x233301);};}exports[_0x8b68('0x4')]=function(_0x558e6c){for(var _0x53b1fd=0x0,_0x30eef2=events[_0x8b68('0x5')];_0x53b1fd<_0x30eef2;_0x53b1fd++){var _0xb1799=events[_0x53b1fd];var _0x7a3560=createListener(_0x8b68('0x6')+_0xb1799,_0x558e6c);OpenchannelQueueEvents['on'](_0xb1799,_0x7a3560);}}; \ No newline at end of file +var _0xfad6=['openchannelQueue:','./openchannelQueue.events','save','remove','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfad6,0x104));var _0x6fad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfad6[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x6fad('0x0'));var events=[_0x6fad('0x1'),_0x6fad('0x2'),'update'];function createListener(_0x3bd92d,_0x14d81b){return function(_0x473129){_0x14d81b[_0x6fad('0x3')](_0x3bd92d,_0x473129);};}function removeListener(_0x12a5f4,_0x18c30d){return function(){OpenchannelQueueEvents['removeListener'](_0x12a5f4,_0x18c30d);};}exports[_0x6fad('0x4')]=function(_0x309188){for(var _0x1c99ad=0x0,_0x1dd99e=events[_0x6fad('0x5')];_0x1c99ad<_0x1dd99e;_0x1c99ad++){var _0x3545b4=events[_0x1c99ad];var _0x59ab37=createListener(_0x6fad('0x6')+_0x3545b4,_0x309188);OpenchannelQueueEvents['on'](_0x3545b4,_0x59ab37);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 43160d7..5d6f25e 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 _0x5492=['update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','put'];(function(_0x41575b,_0x34be1b){var _0x516b4b=function(_0x38014f){while(--_0x38014f){_0x41575b['push'](_0x41575b['shift']());}};_0x516b4b(++_0x34be1b);}(_0x5492,0x17e));var _0x2549=function(_0x40bb60,_0x191d52){_0x40bb60=_0x40bb60-0x0;var _0x138bc2=_0x5492[_0x40bb60];return _0x138bc2;};'use strict';var multer=require(_0x2549('0x0'));var util=require('util');var path=require(_0x2549('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2549('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2549('0x3'));var interaction=require(_0x2549('0x4'));var config=require(_0x2549('0x5'));var controller=require(_0x2549('0x6'));router['get']('/',auth[_0x2549('0x7')](),controller['index']);router[_0x2549('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2549('0x9')]);router[_0x2549('0x8')](_0x2549('0xa'),auth['isAuthenticated'](),controller[_0x2549('0xb')]);router[_0x2549('0xc')]('/',auth[_0x2549('0x7')](),controller['create']);router[_0x2549('0xd')](_0x2549('0xa'),auth[_0x2549('0x7')](),controller[_0x2549('0xe')]);router[_0x2549('0xf')](_0x2549('0xa'),auth['isAuthenticated'](),controller[_0x2549('0x10')]);module[_0x2549('0x11')]=router; \ No newline at end of file +var _0x1729=['destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','post','create','put','/:id','update','delete'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x1729,0x1b7));var _0x9172=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x1729[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9172('0x0'));var timeout=require('connect-timeout');var express=require(_0x9172('0x1'));var router=express[_0x9172('0x2')]();var fs_extra=require(_0x9172('0x3'));var auth=require(_0x9172('0x4'));var interaction=require(_0x9172('0x5'));var config=require(_0x9172('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0x9172('0x7')]('/',auth[_0x9172('0x8')](),controller['index']);router['get'](_0x9172('0x9'),auth[_0x9172('0x8')](),controller['describe']);router[_0x9172('0x7')]('/:id',auth[_0x9172('0x8')](),controller[_0x9172('0xa')]);router[_0x9172('0xb')]('/',auth[_0x9172('0x8')](),controller[_0x9172('0xc')]);router[_0x9172('0xd')](_0x9172('0xe'),auth[_0x9172('0x8')](),controller[_0x9172('0xf')]);router[_0x9172('0x10')](_0x9172('0xe'),auth[_0x9172('0x8')](),controller[_0x9172('0x11')]);module[_0x9172('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 779a7ad..f433708 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 _0xdada=['sequelize','exports','STRING','DATE','moment'];(function(_0x316560,_0x5b629a){var _0xaf0103=function(_0x10e1cc){while(--_0x10e1cc){_0x316560['push'](_0x316560['shift']());}};_0xaf0103(++_0x5b629a);}(_0xdada,0xc2));var _0xadad=function(_0x4f8448,_0x529ce0){_0x4f8448=_0x4f8448-0x0;var _0x2bf972=_0xdada[_0x4f8448];return _0x2bf972;};'use strict';var moment=require(_0xadad('0x0'));var Sequelize=require(_0xadad('0x1'));module[_0xadad('0x2')]={'uniqueid':{'type':Sequelize[_0xadad('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xadad('0x3')]},'joinAt':{'type':Sequelize[_0xadad('0x4')]},'leaveAt':{'type':Sequelize[_0xadad('0x4')]},'acceptAt':{'type':Sequelize[_0xadad('0x4')]},'exitAt':{'type':Sequelize[_0xadad('0x4')]},'reason':{'type':Sequelize[_0xadad('0x3')]}}; \ No newline at end of file +var _0x34f2=['STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x34f2,0x15a));var _0x234f=function(_0x41b2ce,_0x3e568d){_0x41b2ce=_0x41b2ce-0x0;var _0x5cb6fc=_0x34f2[_0x41b2ce];return _0x5cb6fc;};'use strict';var moment=require(_0x234f('0x0'));var Sequelize=require(_0x234f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x234f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x234f('0x2')]},'joinAt':{'type':Sequelize[_0x234f('0x3')]},'leaveAt':{'type':Sequelize[_0x234f('0x3')]},'acceptAt':{'type':Sequelize[_0x234f('0x3')]},'exitAt':{'type':Sequelize[_0x234f('0x3')]},'reason':{'type':Sequelize[_0x234f('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0a55897..710aa9e 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 _0x0b52=['../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','rimraf','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b52,0x18d));var _0x20b5=function(_0x32c819,_0x47238b){_0x32c819=_0x32c819-0x0;var _0x11846e=_0x0b52[_0x32c819];return _0x11846e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20b5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x20b5('0x2'));var util=require('util');var path=require(_0x20b5('0x3'));var sox=require(_0x20b5('0x4'));var csv=require(_0x20b5('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x20b5('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x20b5('0x7'));var jsforce=require(_0x20b5('0x8'));var deskjs=require(_0x20b5('0x9'));var toCsv=require(_0x20b5('0x5'));var querystring=require(_0x20b5('0xa'));var Papa=require(_0x20b5('0xb'));var Redis=require(_0x20b5('0xc'));var authService=require(_0x20b5('0xd'));var qs=require(_0x20b5('0xe'));var as=require(_0x20b5('0xf'));var hardwareService=require(_0x20b5('0x10'));var logger=require(_0x20b5('0x11'))('api');var utils=require(_0x20b5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x20b5('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x618bc4,_0x295313){_0x295313=_0x295313||0xcc;return function(_0x5cdaa8){if(_0x5cdaa8){return _0x618bc4[_0x20b5('0x14')](_0x295313);}return _0x618bc4['status'](_0x295313)['end']();};}function respondWithResult(_0x43ff40,_0x24f482){_0x24f482=_0x24f482||0xc8;return function(_0x550669){if(_0x550669){return _0x43ff40[_0x20b5('0x15')](_0x24f482)[_0x20b5('0x16')](_0x550669);}};}function respondWithFilteredResult(_0xae8d4a,_0x296d9e){return function(_0x1ee412){if(_0x1ee412){var _0x550428=typeof _0x296d9e[_0x20b5('0x17')]==='undefined'&&typeof _0x296d9e['limit']===_0x20b5('0x18');var _0x4843f6=_0x1ee412[_0x20b5('0x19')];var _0x40e6ca=_0x550428?0x0:_0x296d9e[_0x20b5('0x17')];var _0xc4e777=_0x550428?_0x1ee412[_0x20b5('0x19')]:_0x296d9e[_0x20b5('0x17')]+_0x296d9e[_0x20b5('0x1a')];var _0x46037e;if(_0xc4e777>=_0x4843f6){_0xc4e777=_0x4843f6;_0x46037e=0xc8;}else{_0x46037e=0xce;}_0xae8d4a[_0x20b5('0x15')](_0x46037e);return _0xae8d4a[_0x20b5('0x1b')](_0x20b5('0x1c'),_0x40e6ca+'-'+_0xc4e777+'/'+_0x4843f6)[_0x20b5('0x16')](_0x1ee412);}return null;};}function patchUpdates(_0x21262f){return function(_0x31cc67){try{jsonpatch['apply'](_0x31cc67,_0x21262f,!![]);}catch(_0x3e9c34){return BPromise[_0x20b5('0x1d')](_0x3e9c34);}return _0x31cc67[_0x20b5('0x1e')]();};}function saveUpdates(_0x327f0e,_0x3d1ebf){return function(_0x3b8afc){if(_0x3b8afc){return _0x3b8afc['update'](_0x327f0e)[_0x20b5('0x1f')](function(_0x2f6272){return _0x2f6272;});}return null;};}function removeEntity(_0x2b596b,_0x349429){return function(_0xca16b9){if(_0xca16b9){return _0xca16b9['destroy']()['then'](function(){_0x2b596b[_0x20b5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e645c,_0x22bbef){return function(_0x370a16){if(!_0x370a16){_0x1e645c[_0x20b5('0x14')](0x194);}return _0x370a16;};}function handleError(_0x2b022b,_0x38c183){_0x38c183=_0x38c183||0x1f4;return function(_0x56fa1a){logger[_0x20b5('0x20')](_0x56fa1a[_0x20b5('0x21')]);if(_0x56fa1a[_0x20b5('0x22')]){delete _0x56fa1a[_0x20b5('0x22')];}_0x2b022b[_0x20b5('0x15')](_0x38c183)[_0x20b5('0x23')](_0x56fa1a);};}exports[_0x20b5('0x24')]=function(_0x2cc4ec,_0x33b635){var _0x518f27={},_0x405073={},_0x24ef10={'count':0x0,'rows':[]};var _0x1d87e5=_['map'](db[_0x20b5('0x25')][_0x20b5('0x26')],function(_0x2733e4){return{'name':_0x2733e4[_0x20b5('0x27')],'type':_0x2733e4[_0x20b5('0x28')][_0x20b5('0x29')]};});_0x405073['model']=_[_0x20b5('0x2a')](_0x1d87e5,'name');_0x405073['query']=_['keys'](_0x2cc4ec[_0x20b5('0x2b')]);_0x405073[_0x20b5('0x2c')]=_[_0x20b5('0x2d')](_0x405073[_0x20b5('0x2e')],_0x405073[_0x20b5('0x2b')]);_0x518f27[_0x20b5('0x2f')]=_[_0x20b5('0x2d')](_0x405073[_0x20b5('0x2e')],qs[_0x20b5('0x30')](_0x2cc4ec[_0x20b5('0x2b')][_0x20b5('0x30')]));_0x518f27['attributes']=_0x518f27[_0x20b5('0x2f')]['length']?_0x518f27[_0x20b5('0x2f')]:_0x405073['model'];if(!_0x2cc4ec[_0x20b5('0x2b')]['hasOwnProperty'](_0x20b5('0x31'))){_0x518f27['limit']=qs[_0x20b5('0x1a')](_0x2cc4ec[_0x20b5('0x2b')][_0x20b5('0x1a')]);_0x518f27['offset']=qs['offset'](_0x2cc4ec[_0x20b5('0x2b')]['offset']);}_0x518f27['order']=qs['sort'](_0x2cc4ec[_0x20b5('0x2b')][_0x20b5('0x32')]);_0x518f27['where']=qs['filters'](_[_0x20b5('0x33')](_0x2cc4ec[_0x20b5('0x2b')],_0x405073[_0x20b5('0x2c')]),_0x1d87e5);if(_0x2cc4ec[_0x20b5('0x2b')][_0x20b5('0x34')]){_0x518f27[_0x20b5('0x35')]=_[_0x20b5('0x36')](_0x518f27['where'],{'$or':_[_0x20b5('0x2a')](_0x1d87e5,function(_0x1e43f7){if(_0x1e43f7[_0x20b5('0x28')]!==_0x20b5('0x37')){var _0x13f367={};_0x13f367[_0x1e43f7[_0x20b5('0x22')]]={'$like':'%'+_0x2cc4ec[_0x20b5('0x2b')][_0x20b5('0x34')]+'%'};return _0x13f367;}})});}_0x518f27=_['merge']({},_0x518f27,_0x2cc4ec['options']);var _0x51ad6d={'where':_0x518f27[_0x20b5('0x35')]};return db[_0x20b5('0x25')][_0x20b5('0x19')](_0x51ad6d)[_0x20b5('0x1f')](function(_0x121c30){_0x24ef10['count']=_0x121c30;if(_0x2cc4ec['query'][_0x20b5('0x38')]){_0x518f27[_0x20b5('0x39')]=[{'all':!![]}];}return db[_0x20b5('0x25')][_0x20b5('0x3a')](_0x518f27);})[_0x20b5('0x1f')](function(_0x38c7e2){_0x24ef10[_0x20b5('0x3b')]=_0x38c7e2;return _0x24ef10;})[_0x20b5('0x1f')](respondWithFilteredResult(_0x33b635,_0x518f27))[_0x20b5('0x3c')](handleError(_0x33b635,null));};exports['show']=function(_0x185e90,_0x2889a1){var _0x40410a={'raw':!![],'where':{'id':_0x185e90['params']['id']}},_0x2f4591={};_0x2f4591[_0x20b5('0x2e')]=_[_0x20b5('0x3d')](db[_0x20b5('0x25')][_0x20b5('0x26')]);_0x2f4591[_0x20b5('0x2b')]=_[_0x20b5('0x3d')](_0x185e90[_0x20b5('0x2b')]);_0x2f4591[_0x20b5('0x2c')]=_['intersection'](_0x2f4591[_0x20b5('0x2e')],_0x2f4591['query']);_0x40410a[_0x20b5('0x2f')]=_[_0x20b5('0x2d')](_0x2f4591[_0x20b5('0x2e')],qs[_0x20b5('0x30')](_0x185e90[_0x20b5('0x2b')][_0x20b5('0x30')]));_0x40410a[_0x20b5('0x2f')]=_0x40410a[_0x20b5('0x2f')][_0x20b5('0x3e')]?_0x40410a[_0x20b5('0x2f')]:_0x2f4591['model'];if(_0x185e90[_0x20b5('0x2b')][_0x20b5('0x38')]){_0x40410a['include']=[{'all':!![]}];}_0x40410a=_[_0x20b5('0x36')]({},_0x40410a,_0x185e90[_0x20b5('0x3f')]);return db[_0x20b5('0x25')][_0x20b5('0x40')](_0x40410a)[_0x20b5('0x1f')](handleEntityNotFound(_0x2889a1,null))[_0x20b5('0x1f')](respondWithResult(_0x2889a1,null))[_0x20b5('0x3c')](handleError(_0x2889a1,null));};exports['create']=function(_0x2061d6,_0x17f3cf){return db[_0x20b5('0x25')][_0x20b5('0x41')](_0x2061d6[_0x20b5('0x42')],{})[_0x20b5('0x1f')](respondWithResult(_0x17f3cf,0xc9))[_0x20b5('0x3c')](handleError(_0x17f3cf,null));};exports['update']=function(_0x43a2a6,_0x398c74){if(_0x43a2a6['body']['id']){delete _0x43a2a6[_0x20b5('0x42')]['id'];}return db[_0x20b5('0x25')][_0x20b5('0x40')]({'where':{'id':_0x43a2a6[_0x20b5('0x43')]['id']}})['then'](handleEntityNotFound(_0x398c74,null))[_0x20b5('0x1f')](saveUpdates(_0x43a2a6[_0x20b5('0x42')],null))[_0x20b5('0x1f')](respondWithResult(_0x398c74,null))[_0x20b5('0x3c')](handleError(_0x398c74,null));};exports['destroy']=function(_0x2651d0,_0x36114b){return db[_0x20b5('0x25')][_0x20b5('0x40')]({'where':{'id':_0x2651d0[_0x20b5('0x43')]['id']}})[_0x20b5('0x1f')](handleEntityNotFound(_0x36114b,null))['then'](removeEntity(_0x36114b,null))[_0x20b5('0x3c')](handleError(_0x36114b,null));};exports[_0x20b5('0x44')]=function(_0x4b641c,_0x5c7c1c){return db[_0x20b5('0x25')][_0x20b5('0x44')]()[_0x20b5('0x1f')](respondWithResult(_0x5c7c1c,null))[_0x20b5('0x3c')](handleError(_0x5c7c1c,null));}; \ No newline at end of file +var _0x8345=['describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8345,0xf7));var _0x5834=function(_0x21cbcd,_0x4ba851){_0x21cbcd=_0x21cbcd-0x0;var _0x59a138=_0x8345[_0x21cbcd];return _0x59a138;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5834('0x0'));var zipdir=require(_0x5834('0x1'));var jsonpatch=require(_0x5834('0x2'));var rp=require(_0x5834('0x3'));var moment=require(_0x5834('0x4'));var BPromise=require(_0x5834('0x5'));var Mustache=require(_0x5834('0x6'));var util=require(_0x5834('0x7'));var path=require(_0x5834('0x8'));var sox=require(_0x5834('0x9'));var csv=require('to-csv');var ejs=require(_0x5834('0xa'));var fs=require('fs');var fs_extra=require(_0x5834('0xb'));var _=require(_0x5834('0xc'));var squel=require(_0x5834('0xd'));var crypto=require(_0x5834('0xe'));var jsforce=require(_0x5834('0xf'));var deskjs=require(_0x5834('0x10'));var toCsv=require(_0x5834('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5834('0x12'));var authService=require(_0x5834('0x13'));var qs=require(_0x5834('0x14'));var as=require(_0x5834('0x15'));var hardwareService=require(_0x5834('0x16'));var logger=require(_0x5834('0x17'))(_0x5834('0x18'));var utils=require(_0x5834('0x19'));var config=require(_0x5834('0x1a'));var licenseUtil=require(_0x5834('0x1b'));var db=require(_0x5834('0x1c'))['db'];function respondWithStatusCode(_0x5e12f8,_0x1de2e8){_0x1de2e8=_0x1de2e8||0xcc;return function(_0x5eea5c){if(_0x5eea5c){return _0x5e12f8[_0x5834('0x1d')](_0x1de2e8);}return _0x5e12f8[_0x5834('0x1e')](_0x1de2e8)[_0x5834('0x1f')]();};}function respondWithResult(_0x2a6f82,_0x5698bf){_0x5698bf=_0x5698bf||0xc8;return function(_0x176e7c){if(_0x176e7c){return _0x2a6f82[_0x5834('0x1e')](_0x5698bf)[_0x5834('0x20')](_0x176e7c);}};}function respondWithFilteredResult(_0x66a251,_0x382954){return function(_0x2d2ff4){if(_0x2d2ff4){var _0x40be0a=typeof _0x382954['offset']===_0x5834('0x21')&&typeof _0x382954[_0x5834('0x22')]===_0x5834('0x21');var _0x4fd959=_0x2d2ff4[_0x5834('0x23')];var _0x1be6f0=_0x40be0a?0x0:_0x382954[_0x5834('0x24')];var _0x3d8cfc=_0x40be0a?_0x2d2ff4[_0x5834('0x23')]:_0x382954[_0x5834('0x24')]+_0x382954[_0x5834('0x22')];var _0x356332;if(_0x3d8cfc>=_0x4fd959){_0x3d8cfc=_0x4fd959;_0x356332=0xc8;}else{_0x356332=0xce;}_0x66a251[_0x5834('0x1e')](_0x356332);return _0x66a251[_0x5834('0x25')](_0x5834('0x26'),_0x1be6f0+'-'+_0x3d8cfc+'/'+_0x4fd959)[_0x5834('0x20')](_0x2d2ff4);}return null;};}function patchUpdates(_0xe34c94){return function(_0x29f86e){try{jsonpatch[_0x5834('0x27')](_0x29f86e,_0xe34c94,!![]);}catch(_0x49404e){return BPromise[_0x5834('0x28')](_0x49404e);}return _0x29f86e[_0x5834('0x29')]();};}function saveUpdates(_0x3baa40,_0x3dc17c){return function(_0x364d15){if(_0x364d15){return _0x364d15[_0x5834('0x2a')](_0x3baa40)[_0x5834('0x2b')](function(_0x362db7){return _0x362db7;});}return null;};}function removeEntity(_0x1f82c3,_0x38b888){return function(_0x1f3cc6){if(_0x1f3cc6){return _0x1f3cc6[_0x5834('0x2c')]()[_0x5834('0x2b')](function(){_0x1f82c3['status'](0xcc)[_0x5834('0x1f')]();});}};}function handleEntityNotFound(_0x358c26,_0x7e0b66){return function(_0x25b662){if(!_0x25b662){_0x358c26[_0x5834('0x1d')](0x194);}return _0x25b662;};}function handleError(_0x2b72ee,_0x4c27f3){_0x4c27f3=_0x4c27f3||0x1f4;return function(_0x2b22d5){logger[_0x5834('0x2d')](_0x2b22d5['stack']);if(_0x2b22d5[_0x5834('0x2e')]){delete _0x2b22d5[_0x5834('0x2e')];}_0x2b72ee['status'](_0x4c27f3)[_0x5834('0x2f')](_0x2b22d5);};}exports[_0x5834('0x30')]=function(_0x4f5598,_0x1aec5e){var _0x353740={},_0x9bec6a={},_0x41aeab={'count':0x0,'rows':[]};var _0x45ea28=_[_0x5834('0x31')](db[_0x5834('0x32')]['rawAttributes'],function(_0x244f56){return{'name':_0x244f56[_0x5834('0x33')],'type':_0x244f56[_0x5834('0x34')][_0x5834('0x35')]};});_0x9bec6a['model']=_['map'](_0x45ea28,'name');_0x9bec6a[_0x5834('0x36')]=_['keys'](_0x4f5598[_0x5834('0x36')]);_0x9bec6a[_0x5834('0x37')]=_[_0x5834('0x38')](_0x9bec6a['model'],_0x9bec6a[_0x5834('0x36')]);_0x353740[_0x5834('0x39')]=_[_0x5834('0x38')](_0x9bec6a[_0x5834('0x3a')],qs[_0x5834('0x3b')](_0x4f5598[_0x5834('0x36')][_0x5834('0x3b')]));_0x353740[_0x5834('0x39')]=_0x353740[_0x5834('0x39')][_0x5834('0x3c')]?_0x353740['attributes']:_0x9bec6a[_0x5834('0x3a')];if(!_0x4f5598[_0x5834('0x36')]['hasOwnProperty'](_0x5834('0x3d'))){_0x353740[_0x5834('0x22')]=qs[_0x5834('0x22')](_0x4f5598[_0x5834('0x36')][_0x5834('0x22')]);_0x353740[_0x5834('0x24')]=qs[_0x5834('0x24')](_0x4f5598['query'][_0x5834('0x24')]);}_0x353740[_0x5834('0x3e')]=qs['sort'](_0x4f5598[_0x5834('0x36')][_0x5834('0x3f')]);_0x353740['where']=qs[_0x5834('0x37')](_[_0x5834('0x40')](_0x4f5598[_0x5834('0x36')],_0x9bec6a[_0x5834('0x37')]),_0x45ea28);if(_0x4f5598['query']['filter']){_0x353740[_0x5834('0x41')]=_[_0x5834('0x42')](_0x353740[_0x5834('0x41')],{'$or':_['map'](_0x45ea28,function(_0x1c533d){if(_0x1c533d['type']!==_0x5834('0x43')){var _0x26aec8={};_0x26aec8[_0x1c533d[_0x5834('0x2e')]]={'$like':'%'+_0x4f5598[_0x5834('0x36')][_0x5834('0x44')]+'%'};return _0x26aec8;}})});}_0x353740=_['merge']({},_0x353740,_0x4f5598[_0x5834('0x45')]);var _0x5a5dba={'where':_0x353740[_0x5834('0x41')]};return db[_0x5834('0x32')]['count'](_0x5a5dba)[_0x5834('0x2b')](function(_0xaa4b36){_0x41aeab['count']=_0xaa4b36;if(_0x4f5598[_0x5834('0x36')][_0x5834('0x46')]){_0x353740['include']=[{'all':!![]}];}return db[_0x5834('0x32')][_0x5834('0x47')](_0x353740);})['then'](function(_0x2feb5f){_0x41aeab[_0x5834('0x48')]=_0x2feb5f;return _0x41aeab;})[_0x5834('0x2b')](respondWithFilteredResult(_0x1aec5e,_0x353740))['catch'](handleError(_0x1aec5e,null));};exports[_0x5834('0x49')]=function(_0x36622e,_0x58f7e7){var _0x3994bd={'raw':!![],'where':{'id':_0x36622e[_0x5834('0x4a')]['id']}},_0x5d7e4c={};_0x5d7e4c[_0x5834('0x3a')]=_['keys'](db[_0x5834('0x32')]['rawAttributes']);_0x5d7e4c[_0x5834('0x36')]=_[_0x5834('0x4b')](_0x36622e[_0x5834('0x36')]);_0x5d7e4c[_0x5834('0x37')]=_['intersection'](_0x5d7e4c[_0x5834('0x3a')],_0x5d7e4c[_0x5834('0x36')]);_0x3994bd[_0x5834('0x39')]=_[_0x5834('0x38')](_0x5d7e4c[_0x5834('0x3a')],qs[_0x5834('0x3b')](_0x36622e[_0x5834('0x36')][_0x5834('0x3b')]));_0x3994bd[_0x5834('0x39')]=_0x3994bd['attributes'][_0x5834('0x3c')]?_0x3994bd[_0x5834('0x39')]:_0x5d7e4c['model'];if(_0x36622e[_0x5834('0x36')][_0x5834('0x46')]){_0x3994bd[_0x5834('0x4c')]=[{'all':!![]}];}_0x3994bd=_[_0x5834('0x42')]({},_0x3994bd,_0x36622e['options']);return db[_0x5834('0x32')][_0x5834('0x4d')](_0x3994bd)[_0x5834('0x2b')](handleEntityNotFound(_0x58f7e7,null))[_0x5834('0x2b')](respondWithResult(_0x58f7e7,null))[_0x5834('0x4e')](handleError(_0x58f7e7,null));};exports[_0x5834('0x4f')]=function(_0x343124,_0x5ccdca){return db[_0x5834('0x32')][_0x5834('0x4f')](_0x343124[_0x5834('0x50')],{})[_0x5834('0x2b')](respondWithResult(_0x5ccdca,0xc9))['catch'](handleError(_0x5ccdca,null));};exports[_0x5834('0x2a')]=function(_0xec852,_0x1e9138){if(_0xec852['body']['id']){delete _0xec852[_0x5834('0x50')]['id'];}return db[_0x5834('0x32')][_0x5834('0x4d')]({'where':{'id':_0xec852[_0x5834('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e9138,null))[_0x5834('0x2b')](saveUpdates(_0xec852['body'],null))['then'](respondWithResult(_0x1e9138,null))[_0x5834('0x4e')](handleError(_0x1e9138,null));};exports['destroy']=function(_0xbc44c8,_0x4f129f){return db[_0x5834('0x32')][_0x5834('0x4d')]({'where':{'id':_0xbc44c8['params']['id']}})[_0x5834('0x2b')](handleEntityNotFound(_0x4f129f,null))[_0x5834('0x2b')](removeEntity(_0x4f129f,null))[_0x5834('0x4e')](handleError(_0x4f129f,null));};exports[_0x5834('0x51')]=function(_0x18240c,_0x4610de){return db[_0x5834('0x32')][_0x5834('0x51')]()[_0x5834('0x2b')](respondWithResult(_0x4610de,null))['catch'](handleError(_0x4610de,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 884bb38..e105510 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x464bb1,_0x272354){var _0x35e068=function(_0x391870){while(--_0x391870){_0x464bb1['push'](_0x464bb1['shift']());}};_0x35e068(++_0x272354);}(_0x326f,0xd1));var _0xf326=function(_0x68981d,_0x5881ee){_0x68981d=_0x68981d-0x0;var _0x68f9f3=_0x326f[_0x68981d];return _0x68f9f3;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x1de94d,_0x30499c){var _0x507fed=function(_0x1c4e48){while(--_0x1c4e48){_0x1de94d['push'](_0x1de94d['shift']());}};_0x507fed(++_0x30499c);}(_0xe14b,0x93));var _0xbe14=function(_0x391802,_0xde0fd){_0x391802=_0x391802-0x0;var _0x3aa73b=_0xe14b[_0x391802];return _0x3aa73b;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c01e86c..9fcdfb3 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 _0x1c3d=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x14703f,_0xf399a3){var _0x348792=function(_0x161177){while(--_0x161177){_0x14703f['push'](_0x14703f['shift']());}};_0x348792(++_0xf399a3);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x18ec40,_0x2ea3d4){_0x18ec40=_0x18ec40-0x0;var _0x51b4f8=_0x1c3d[_0x18ec40];return _0x51b4f8;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var moment=require(_0xd1c3('0x1'));var BPromise=require(_0xd1c3('0x2'));var rs=require(_0xd1c3('0x3'));var fs=require('fs');var Redis=require(_0xd1c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1c3('0x5'))(_0xd1c3('0x6'));var config=require(_0xd1c3('0x7'));var jayson=require(_0xd1c3('0x8'));var client=jayson[_0xd1c3('0x9')][_0xd1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5adcb7,_0x398766,_0x420ab0){return new BPromise(function(_0x5db2f0,_0x1afc71){return client[_0xd1c3('0xb')](_0x5adcb7,_0x420ab0)[_0xd1c3('0xc')](function(_0x18556c){logger[_0xd1c3('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,'request\x20sent');logger[_0xd1c3('0xe')](_0xd1c3('0xf'),_0x398766,_0xd1c3('0x10'),JSON[_0xd1c3('0x11')](_0x18556c));if(_0x18556c[_0xd1c3('0x12')]){if(_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x13')]===0x1f4){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x18556c['error'][_0xd1c3('0x15')]);return _0x1afc71(_0x18556c['error']['message']);}logger[_0xd1c3('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x15')]);return _0x5db2f0(_0x18556c[_0xd1c3('0x12')]['message']);}else{logger[_0xd1c3('0xd')](_0xd1c3('0x14'),_0x398766,_0xd1c3('0x10'));_0x5db2f0(_0x18556c[_0xd1c3('0x16')][_0xd1c3('0x15')]);}})[_0xd1c3('0x17')](function(_0x586fa7){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x586fa7);_0x1afc71(_0x586fa7);});});}exports[_0xd1c3('0x18')]=function(_0x5d26c2){var _0x53a5e1=this;return new Promise(function(_0x14f6cb,_0x3a1a74){return db[_0xd1c3('0x19')][_0xd1c3('0x1a')](_0x5d26c2[_0xd1c3('0x1b')],{'raw':_0x5d26c2['options']?_0x5d26c2[_0xd1c3('0x1c')][_0xd1c3('0x1d')]===undefined?!![]:![]:!![]})[_0xd1c3('0xc')](function(_0x588f4e){logger['info'](_0xd1c3('0x18'),_0x5d26c2);logger[_0xd1c3('0xe')]('CreateOpenchannelQueueReport',_0x5d26c2,JSON['stringify'](_0x588f4e));_0x14f6cb(_0x588f4e);})[_0xd1c3('0x17')](function(_0xc45d5d){logger[_0xd1c3('0x12')](_0xd1c3('0x18'),_0xc45d5d[_0xd1c3('0x15')],_0x5d26c2);_0x3a1a74(_0x53a5e1[_0xd1c3('0x12')](0x1f4,_0xc45d5d[_0xd1c3('0x15')]));});});};exports[_0xd1c3('0x1e')]=function(_0x33c380){var _0x218ef1=this;return new Promise(function(_0x5a9d5d,_0x56091a){return db[_0xd1c3('0x19')][_0xd1c3('0x1f')](_0x33c380[_0xd1c3('0x1b')],{'raw':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x20')]||null:null,'attributes':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x21')]||null:null,'limit':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x22')]||null:null})['then'](function(_0x57309e){logger[_0xd1c3('0xd')](_0xd1c3('0x1e'),_0x33c380);logger[_0xd1c3('0xe')](_0xd1c3('0x1e'),_0x33c380,JSON[_0xd1c3('0x11')](_0x57309e));_0x5a9d5d(_0x57309e);})['catch'](function(_0x331bad){logger[_0xd1c3('0x12')]('UpdateOpenchannelQueueReport',_0x331bad[_0xd1c3('0x15')],_0x33c380);_0x56091a(_0x218ef1['error'](0x1f4,_0x331bad[_0xd1c3('0x15')]));});});}; \ No newline at end of file +var _0x0833=['code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4632a6,_0xb3ab12){var _0x13d821=function(_0x52e37c){while(--_0x52e37c){_0x4632a6['push'](_0x4632a6['shift']());}};_0x13d821(++_0xb3ab12);}(_0x0833,0x1bd));var _0x3083=function(_0x921413,_0x510888){_0x921413=_0x921413-0x0;var _0x3e1b36=_0x0833[_0x921413];return _0x3e1b36;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var moment=require(_0x3083('0x2'));var BPromise=require(_0x3083('0x3'));var rs=require(_0x3083('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3083('0x5'))('rpc');var config=require(_0x3083('0x6'));var jayson=require(_0x3083('0x7'));var client=jayson[_0x3083('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9c3a,_0x1378a5,_0x529df1){return new BPromise(function(_0x5591b0,_0x4f51da){return client[_0x3083('0x9')](_0x2f9c3a,_0x529df1)['then'](function(_0x5cce3c){logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));logger[_0x3083('0xd')](_0x3083('0xe'),_0x1378a5,_0x3083('0xc'),JSON[_0x3083('0xf')](_0x5cce3c));if(_0x5cce3c[_0x3083('0x10')]){if(_0x5cce3c[_0x3083('0x10')][_0x3083('0x11')]===0x1f4){logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c[_0x3083('0x10')][_0x3083('0x12')]);return _0x4f51da(_0x5cce3c[_0x3083('0x10')]['message']);}logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c['error'][_0x3083('0x12')]);return _0x5591b0(_0x5cce3c[_0x3083('0x10')]['message']);}else{logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));_0x5591b0(_0x5cce3c[_0x3083('0x13')][_0x3083('0x12')]);}})[_0x3083('0x14')](function(_0xecb368){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x1378a5,_0xecb368);_0x4f51da(_0xecb368);});});}exports['CreateOpenchannelQueueReport']=function(_0x424c59){var _0x57fdf7=this;return new Promise(function(_0x3bbfe3,_0x2cdeca){return db[_0x3083('0x15')][_0x3083('0x16')](_0x424c59[_0x3083('0x17')],{'raw':_0x424c59[_0x3083('0x18')]?_0x424c59[_0x3083('0x18')][_0x3083('0x19')]===undefined?!![]:![]:!![]})[_0x3083('0x1a')](function(_0x164988){logger[_0x3083('0xa')](_0x3083('0x1b'),_0x424c59);logger[_0x3083('0xd')](_0x3083('0x1b'),_0x424c59,JSON['stringify'](_0x164988));_0x3bbfe3(_0x164988);})['catch'](function(_0x4dc9ad){logger['error'](_0x3083('0x1b'),_0x4dc9ad[_0x3083('0x12')],_0x424c59);_0x2cdeca(_0x57fdf7[_0x3083('0x10')](0x1f4,_0x4dc9ad[_0x3083('0x12')]));});});};exports[_0x3083('0x1c')]=function(_0x4170ab){var _0x266370=this;return new Promise(function(_0x2f9bfa,_0x4501b2){return db['OpenchannelQueueReport'][_0x3083('0x1d')](_0x4170ab['body'],{'raw':_0x4170ab['options']?_0x4170ab[_0x3083('0x18')][_0x3083('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4170ab[_0x3083('0x18')]?_0x4170ab[_0x3083('0x18')][_0x3083('0x1e')]||null:null,'attributes':_0x4170ab[_0x3083('0x18')]?_0x4170ab['options'][_0x3083('0x1f')]||null:null,'limit':_0x4170ab[_0x3083('0x18')]?_0x4170ab[_0x3083('0x18')][_0x3083('0x20')]||null:null})['then'](function(_0x3055d2){logger['info']('UpdateOpenchannelQueueReport',_0x4170ab);logger[_0x3083('0xd')](_0x3083('0x1c'),_0x4170ab,JSON[_0x3083('0xf')](_0x3055d2));_0x2f9bfa(_0x3055d2);})['catch'](function(_0x1a8b75){logger[_0x3083('0x10')](_0x3083('0x1c'),_0x1a8b75[_0x3083('0x12')],_0x4170ab);_0x4501b2(_0x266370[_0x3083('0x10')](0x1f4,_0x1a8b75[_0x3083('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 7ec657d..abc2135 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 _0x3cc6=['util','path','connect-timeout','express','Router','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0x3cc6,0x10e));var _0x63cc=function(_0x40e444,_0x1e848b){_0x40e444=_0x40e444-0x0;var _0x3c1fe5=_0x3cc6[_0x40e444];return _0x3c1fe5;};'use strict';var multer=require('multer');var util=require(_0x63cc('0x0'));var path=require(_0x63cc('0x1'));var timeout=require(_0x63cc('0x2'));var express=require(_0x63cc('0x3'));var router=express[_0x63cc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x63cc('0x5'));var controller=require(_0x63cc('0x6'));router[_0x63cc('0x7')]('/',auth[_0x63cc('0x8')](),controller[_0x63cc('0x9')]);router[_0x63cc('0x7')](_0x63cc('0xa'),auth[_0x63cc('0x8')](),controller[_0x63cc('0xb')]);router['get'](_0x63cc('0xc'),auth[_0x63cc('0x8')](),controller['show']);router[_0x63cc('0xd')]('/',auth['isAuthenticated'](),controller[_0x63cc('0xe')]);router['put'](_0x63cc('0xc'),auth[_0x63cc('0x8')](),controller['update']);router[_0x63cc('0xf')](_0x63cc('0xc'),auth[_0x63cc('0x8')](),controller[_0x63cc('0x10')]);module[_0x63cc('0x11')]=router; \ No newline at end of file +var _0xc64f=['put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xbd2a3,_0x29f8c3){var _0x437157=function(_0x219ccc){while(--_0x219ccc){_0xbd2a3['push'](_0xbd2a3['shift']());}};_0x437157(++_0x29f8c3);}(_0xc64f,0x15b));var _0xfc64=function(_0x2ee5bc,_0x2c9eb4){_0x2ee5bc=_0x2ee5bc-0x0;var _0x23b485=_0xc64f[_0x2ee5bc];return _0x23b485;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc64('0x0'));var timeout=require(_0xfc64('0x1'));var express=require('express');var router=express[_0xfc64('0x2')]();var fs_extra=require(_0xfc64('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfc64('0x4'));var config=require('../../config/environment');var controller=require(_0xfc64('0x5'));router[_0xfc64('0x6')]('/',auth[_0xfc64('0x7')](),controller[_0xfc64('0x8')]);router[_0xfc64('0x6')](_0xfc64('0x9'),auth[_0xfc64('0x7')](),controller[_0xfc64('0xa')]);router[_0xfc64('0x6')](_0xfc64('0xb'),auth[_0xfc64('0x7')](),controller[_0xfc64('0xc')]);router[_0xfc64('0xd')]('/',auth[_0xfc64('0x7')](),controller['create']);router[_0xfc64('0xe')](_0xfc64('0xb'),auth[_0xfc64('0x7')](),controller[_0xfc64('0xf')]);router[_0xfc64('0x10')](_0xfc64('0xb'),auth[_0xfc64('0x7')](),controller[_0xfc64('0x11')]);module[_0xfc64('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e23af61..5fb4d35 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(_0x5d79d5,_0x592070){var _0x18275f=function(_0x1f8190){while(--_0x1f8190){_0x5d79d5['push'](_0x5d79d5['shift']());}};_0x18275f(++_0x592070);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x131c81,_0x12fe63){var _0x241e7a=function(_0x3e48b7){while(--_0x3e48b7){_0x131c81['push'](_0x131c81['shift']());}};_0x241e7a(++_0x12fe63);}(_0x54ef,0x112));var _0xf54e=function(_0x2927a2,_0x32626b){_0x2927a2=_0x2927a2-0x0;var _0x5592f2=_0x54ef[_0x2927a2];return _0x5592f2;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 908c70b..c890b76 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 _0x1441=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring'];(function(_0x10d0d1,_0x5bf504){var _0x5a4041=function(_0x716874){while(--_0x716874){_0x10d0d1['push'](_0x10d0d1['shift']());}};_0x5a4041(++_0x5bf504);}(_0x1441,0xca));var _0x1144=function(_0x25e7de,_0x24b676){_0x25e7de=_0x25e7de-0x0;var _0x5cd6b8=_0x1441[_0x25e7de];return _0x5cd6b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1144('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1144('0x1'));var moment=require(_0x1144('0x2'));var BPromise=require(_0x1144('0x3'));var Mustache=require(_0x1144('0x4'));var util=require(_0x1144('0x5'));var path=require('path');var sox=require(_0x1144('0x6'));var csv=require(_0x1144('0x7'));var ejs=require(_0x1144('0x8'));var fs=require('fs');var fs_extra=require(_0x1144('0x9'));var _=require(_0x1144('0xa'));var squel=require(_0x1144('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1144('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1144('0xd'));var Papa=require(_0x1144('0xe'));var Redis=require(_0x1144('0xf'));var authService=require(_0x1144('0x10'));var qs=require(_0x1144('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1144('0x12'));var logger=require('../../config/logger')(_0x1144('0x13'));var utils=require(_0x1144('0x14'));var config=require(_0x1144('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348624,_0x59ecbc){_0x59ecbc=_0x59ecbc||0xcc;return function(_0x40c9be){if(_0x40c9be){return _0x348624[_0x1144('0x16')](_0x59ecbc);}return _0x348624[_0x1144('0x17')](_0x59ecbc)['end']();};}function respondWithResult(_0x582e5f,_0x4343cc){_0x4343cc=_0x4343cc||0xc8;return function(_0x441d71){if(_0x441d71){return _0x582e5f[_0x1144('0x17')](_0x4343cc)[_0x1144('0x18')](_0x441d71);}};}function respondWithFilteredResult(_0x1b42a9,_0x530bd9){return function(_0x1c3f62){if(_0x1c3f62){var _0x401457=typeof _0x530bd9['offset']==='undefined'&&typeof _0x530bd9['limit']===_0x1144('0x19');var _0x419656=_0x1c3f62[_0x1144('0x1a')];var _0x291201=_0x401457?0x0:_0x530bd9[_0x1144('0x1b')];var _0x2cb076=_0x401457?_0x1c3f62['count']:_0x530bd9[_0x1144('0x1b')]+_0x530bd9['limit'];var _0x4320fa;if(_0x2cb076>=_0x419656){_0x2cb076=_0x419656;_0x4320fa=0xc8;}else{_0x4320fa=0xce;}_0x1b42a9['status'](_0x4320fa);return _0x1b42a9[_0x1144('0x1c')](_0x1144('0x1d'),_0x291201+'-'+_0x2cb076+'/'+_0x419656)['json'](_0x1c3f62);}return null;};}function patchUpdates(_0x3cda84){return function(_0x25dabc){try{jsonpatch[_0x1144('0x1e')](_0x25dabc,_0x3cda84,!![]);}catch(_0x30abc8){return BPromise['reject'](_0x30abc8);}return _0x25dabc[_0x1144('0x1f')]();};}function saveUpdates(_0x913b18,_0x163099){return function(_0x451fdf){if(_0x451fdf){return _0x451fdf[_0x1144('0x20')](_0x913b18)[_0x1144('0x21')](function(_0x278098){return _0x278098;});}return null;};}function removeEntity(_0x5807f7,_0x1b7d42){return function(_0x424df9){if(_0x424df9){return _0x424df9[_0x1144('0x22')]()[_0x1144('0x21')](function(){_0x5807f7[_0x1144('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31732e,_0x1a71fd){return function(_0x15399f){if(!_0x15399f){_0x31732e[_0x1144('0x16')](0x194);}return _0x15399f;};}function handleError(_0x4d3522,_0x2671f0){_0x2671f0=_0x2671f0||0x1f4;return function(_0x550548){logger['error'](_0x550548[_0x1144('0x23')]);if(_0x550548[_0x1144('0x24')]){delete _0x550548[_0x1144('0x24')];}_0x4d3522['status'](_0x2671f0)[_0x1144('0x25')](_0x550548);};}exports[_0x1144('0x26')]=function(_0xa72417,_0x88d716){var _0x5a76ed={},_0x5188c8={},_0x117237={'count':0x0,'rows':[]};var _0x425144=_[_0x1144('0x27')](db[_0x1144('0x28')][_0x1144('0x29')],function(_0x5f54cc){return{'name':_0x5f54cc[_0x1144('0x2a')],'type':_0x5f54cc['type']['key']};});_0x5188c8[_0x1144('0x2b')]=_[_0x1144('0x27')](_0x425144,'name');_0x5188c8[_0x1144('0x2c')]=_['keys'](_0xa72417[_0x1144('0x2c')]);_0x5188c8[_0x1144('0x2d')]=_['intersection'](_0x5188c8[_0x1144('0x2b')],_0x5188c8[_0x1144('0x2c')]);_0x5a76ed[_0x1144('0x2e')]=_[_0x1144('0x2f')](_0x5188c8['model'],qs['fields'](_0xa72417[_0x1144('0x2c')][_0x1144('0x30')]));_0x5a76ed[_0x1144('0x2e')]=_0x5a76ed[_0x1144('0x2e')][_0x1144('0x31')]?_0x5a76ed[_0x1144('0x2e')]:_0x5188c8[_0x1144('0x2b')];if(!_0xa72417[_0x1144('0x2c')][_0x1144('0x32')](_0x1144('0x33'))){_0x5a76ed[_0x1144('0x34')]=qs['limit'](_0xa72417[_0x1144('0x2c')][_0x1144('0x34')]);_0x5a76ed[_0x1144('0x1b')]=qs[_0x1144('0x1b')](_0xa72417[_0x1144('0x2c')][_0x1144('0x1b')]);}_0x5a76ed[_0x1144('0x35')]=qs[_0x1144('0x36')](_0xa72417[_0x1144('0x2c')][_0x1144('0x36')]);_0x5a76ed[_0x1144('0x37')]=qs['filters'](_[_0x1144('0x38')](_0xa72417['query'],_0x5188c8[_0x1144('0x2d')]),_0x425144);if(_0xa72417[_0x1144('0x2c')][_0x1144('0x39')]){_0x5a76ed[_0x1144('0x37')]=_[_0x1144('0x3a')](_0x5a76ed[_0x1144('0x37')],{'$or':_[_0x1144('0x27')](_0x425144,function(_0x4ca66c){if(_0x4ca66c[_0x1144('0x3b')]!==_0x1144('0x3c')){var _0x4e05e5={};_0x4e05e5[_0x4ca66c[_0x1144('0x24')]]={'$like':'%'+_0xa72417[_0x1144('0x2c')][_0x1144('0x39')]+'%'};return _0x4e05e5;}})});}_0x5a76ed=_[_0x1144('0x3a')]({},_0x5a76ed,_0xa72417[_0x1144('0x3d')]);var _0x100687={'where':_0x5a76ed['where']};return db[_0x1144('0x28')][_0x1144('0x1a')](_0x100687)[_0x1144('0x21')](function(_0x31a61c){_0x117237[_0x1144('0x1a')]=_0x31a61c;if(_0xa72417['query'][_0x1144('0x3e')]){_0x5a76ed['include']=[{'all':!![]}];}return db[_0x1144('0x28')]['findAll'](_0x5a76ed);})[_0x1144('0x21')](function(_0x251333){_0x117237[_0x1144('0x3f')]=_0x251333;return _0x117237;})['then'](respondWithFilteredResult(_0x88d716,_0x5a76ed))[_0x1144('0x40')](handleError(_0x88d716,null));};exports[_0x1144('0x41')]=function(_0x320c79,_0x42125b){var _0x5f383b={'raw':!![],'where':{'id':_0x320c79[_0x1144('0x42')]['id']}},_0x11eaf4={};_0x11eaf4[_0x1144('0x2b')]=_[_0x1144('0x43')](db[_0x1144('0x28')][_0x1144('0x29')]);_0x11eaf4['query']=_['keys'](_0x320c79['query']);_0x11eaf4[_0x1144('0x2d')]=_[_0x1144('0x2f')](_0x11eaf4[_0x1144('0x2b')],_0x11eaf4[_0x1144('0x2c')]);_0x5f383b[_0x1144('0x2e')]=_[_0x1144('0x2f')](_0x11eaf4['model'],qs[_0x1144('0x30')](_0x320c79[_0x1144('0x2c')]['fields']));_0x5f383b[_0x1144('0x2e')]=_0x5f383b[_0x1144('0x2e')]['length']?_0x5f383b[_0x1144('0x2e')]:_0x11eaf4[_0x1144('0x2b')];if(_0x320c79[_0x1144('0x2c')][_0x1144('0x3e')]){_0x5f383b['include']=[{'all':!![]}];}_0x5f383b=_['merge']({},_0x5f383b,_0x320c79[_0x1144('0x3d')]);return db[_0x1144('0x28')]['find'](_0x5f383b)[_0x1144('0x21')](handleEntityNotFound(_0x42125b,null))[_0x1144('0x21')](respondWithResult(_0x42125b,null))[_0x1144('0x40')](handleError(_0x42125b,null));};exports[_0x1144('0x44')]=function(_0x1fd529,_0x262f0d){return db[_0x1144('0x28')][_0x1144('0x44')](_0x1fd529[_0x1144('0x45')],{})[_0x1144('0x21')](respondWithResult(_0x262f0d,0xc9))['catch'](handleError(_0x262f0d,null));};exports[_0x1144('0x20')]=function(_0x5808dc,_0x585efc){if(_0x5808dc[_0x1144('0x45')]['id']){delete _0x5808dc[_0x1144('0x45')]['id'];}return db[_0x1144('0x28')][_0x1144('0x46')]({'where':{'id':_0x5808dc[_0x1144('0x42')]['id']}})[_0x1144('0x21')](handleEntityNotFound(_0x585efc,null))[_0x1144('0x21')](saveUpdates(_0x5808dc[_0x1144('0x45')],null))[_0x1144('0x21')](respondWithResult(_0x585efc,null))[_0x1144('0x40')](handleError(_0x585efc,null));};exports[_0x1144('0x22')]=function(_0x4aea98,_0x3bd289){return db[_0x1144('0x28')][_0x1144('0x46')]({'where':{'id':_0x4aea98[_0x1144('0x42')]['id']}})[_0x1144('0x21')](handleEntityNotFound(_0x3bd289,null))[_0x1144('0x21')](removeEntity(_0x3bd289,null))['catch'](handleError(_0x3bd289,null));};exports[_0x1144('0x47')]=function(_0x3dbb85,_0x51c46a){return db['OpenchannelTransferReport'][_0x1144('0x47')]()[_0x1144('0x21')](respondWithResult(_0x51c46a,null))[_0x1144('0x40')](handleError(_0x51c46a,null));}; \ No newline at end of file +var _0x09cd=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','limit','undefined','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','fields','find','create','body','params','describe','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x09cd,0x113));var _0xd09c=function(_0x5e7607,_0x50c30e){_0x5e7607=_0x5e7607-0x0;var _0x513d4e=_0x09cd[_0x5e7607];return _0x513d4e;};'use strict';var emlformat=require(_0xd09c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd09c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd09c('0x2'));var Mustache=require(_0xd09c('0x3'));var util=require(_0xd09c('0x4'));var path=require(_0xd09c('0x5'));var sox=require(_0xd09c('0x6'));var csv=require('to-csv');var ejs=require(_0xd09c('0x7'));var fs=require('fs');var fs_extra=require(_0xd09c('0x8'));var _=require(_0xd09c('0x9'));var squel=require(_0xd09c('0xa'));var crypto=require(_0xd09c('0xb'));var jsforce=require(_0xd09c('0xc'));var deskjs=require(_0xd09c('0xd'));var toCsv=require(_0xd09c('0xe'));var querystring=require('querystring');var Papa=require(_0xd09c('0xf'));var Redis=require(_0xd09c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd09c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd09c('0x12'));var utils=require(_0xd09c('0x13'));var config=require(_0xd09c('0x14'));var licenseUtil=require(_0xd09c('0x15'));var db=require(_0xd09c('0x16'))['db'];function respondWithStatusCode(_0x4cb605,_0x3ceb19){_0x3ceb19=_0x3ceb19||0xcc;return function(_0x32de20){if(_0x32de20){return _0x4cb605[_0xd09c('0x17')](_0x3ceb19);}return _0x4cb605['status'](_0x3ceb19)['end']();};}function respondWithResult(_0x4c17fa,_0x2d88c1){_0x2d88c1=_0x2d88c1||0xc8;return function(_0x538441){if(_0x538441){return _0x4c17fa['status'](_0x2d88c1)['json'](_0x538441);}};}function respondWithFilteredResult(_0x4073dc,_0x432692){return function(_0x4fcae8){if(_0x4fcae8){var _0x1369fa=typeof _0x432692[_0xd09c('0x18')]==='undefined'&&typeof _0x432692[_0xd09c('0x19')]===_0xd09c('0x1a');var _0x3dba31=_0x4fcae8['count'];var _0x21f712=_0x1369fa?0x0:_0x432692[_0xd09c('0x18')];var _0x23666b=_0x1369fa?_0x4fcae8['count']:_0x432692[_0xd09c('0x18')]+_0x432692[_0xd09c('0x19')];var _0x404ff4;if(_0x23666b>=_0x3dba31){_0x23666b=_0x3dba31;_0x404ff4=0xc8;}else{_0x404ff4=0xce;}_0x4073dc[_0xd09c('0x1b')](_0x404ff4);return _0x4073dc[_0xd09c('0x1c')](_0xd09c('0x1d'),_0x21f712+'-'+_0x23666b+'/'+_0x3dba31)['json'](_0x4fcae8);}return null;};}function patchUpdates(_0x645087){return function(_0xdffc4e){try{jsonpatch[_0xd09c('0x1e')](_0xdffc4e,_0x645087,!![]);}catch(_0x56a6b8){return BPromise[_0xd09c('0x1f')](_0x56a6b8);}return _0xdffc4e['save']();};}function saveUpdates(_0x101c1d,_0x8634bf){return function(_0x3364c7){if(_0x3364c7){return _0x3364c7[_0xd09c('0x20')](_0x101c1d)[_0xd09c('0x21')](function(_0x47cfa4){return _0x47cfa4;});}return null;};}function removeEntity(_0x3ba74e,_0xa0d41a){return function(_0x1c0c5a){if(_0x1c0c5a){return _0x1c0c5a[_0xd09c('0x22')]()[_0xd09c('0x21')](function(){_0x3ba74e[_0xd09c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50609a,_0x454af5){return function(_0x141119){if(!_0x141119){_0x50609a[_0xd09c('0x17')](0x194);}return _0x141119;};}function handleError(_0x1ee2ab,_0x383871){_0x383871=_0x383871||0x1f4;return function(_0x1fc193){logger['error'](_0x1fc193[_0xd09c('0x23')]);if(_0x1fc193[_0xd09c('0x24')]){delete _0x1fc193[_0xd09c('0x24')];}_0x1ee2ab[_0xd09c('0x1b')](_0x383871)[_0xd09c('0x25')](_0x1fc193);};}exports[_0xd09c('0x26')]=function(_0x54b112,_0x294429){var _0x45f884={},_0x2d294d={},_0x5ad190={'count':0x0,'rows':[]};var _0x2619bd=_['map'](db[_0xd09c('0x27')][_0xd09c('0x28')],function(_0xe71664){return{'name':_0xe71664['fieldName'],'type':_0xe71664[_0xd09c('0x29')]['key']};});_0x2d294d['model']=_[_0xd09c('0x2a')](_0x2619bd,'name');_0x2d294d[_0xd09c('0x2b')]=_[_0xd09c('0x2c')](_0x54b112[_0xd09c('0x2b')]);_0x2d294d[_0xd09c('0x2d')]=_[_0xd09c('0x2e')](_0x2d294d[_0xd09c('0x2f')],_0x2d294d[_0xd09c('0x2b')]);_0x45f884[_0xd09c('0x30')]=_[_0xd09c('0x2e')](_0x2d294d[_0xd09c('0x2f')],qs['fields'](_0x54b112[_0xd09c('0x2b')]['fields']));_0x45f884['attributes']=_0x45f884[_0xd09c('0x30')][_0xd09c('0x31')]?_0x45f884[_0xd09c('0x30')]:_0x2d294d[_0xd09c('0x2f')];if(!_0x54b112['query'][_0xd09c('0x32')](_0xd09c('0x33'))){_0x45f884[_0xd09c('0x19')]=qs[_0xd09c('0x19')](_0x54b112[_0xd09c('0x2b')][_0xd09c('0x19')]);_0x45f884[_0xd09c('0x18')]=qs['offset'](_0x54b112[_0xd09c('0x2b')]['offset']);}_0x45f884[_0xd09c('0x34')]=qs[_0xd09c('0x35')](_0x54b112['query'][_0xd09c('0x35')]);_0x45f884[_0xd09c('0x36')]=qs[_0xd09c('0x2d')](_['pick'](_0x54b112[_0xd09c('0x2b')],_0x2d294d[_0xd09c('0x2d')]),_0x2619bd);if(_0x54b112['query']['filter']){_0x45f884['where']=_[_0xd09c('0x37')](_0x45f884[_0xd09c('0x36')],{'$or':_[_0xd09c('0x2a')](_0x2619bd,function(_0x279ee0){if(_0x279ee0[_0xd09c('0x29')]!==_0xd09c('0x38')){var _0x39aaa9={};_0x39aaa9[_0x279ee0[_0xd09c('0x24')]]={'$like':'%'+_0x54b112['query'][_0xd09c('0x39')]+'%'};return _0x39aaa9;}})});}_0x45f884=_['merge']({},_0x45f884,_0x54b112[_0xd09c('0x3a')]);var _0x5e4713={'where':_0x45f884['where']};return db[_0xd09c('0x27')][_0xd09c('0x3b')](_0x5e4713)[_0xd09c('0x21')](function(_0x547f43){_0x5ad190[_0xd09c('0x3b')]=_0x547f43;if(_0x54b112['query'][_0xd09c('0x3c')]){_0x45f884[_0xd09c('0x3d')]=[{'all':!![]}];}return db[_0xd09c('0x27')][_0xd09c('0x3e')](_0x45f884);})[_0xd09c('0x21')](function(_0x1d6812){_0x5ad190['rows']=_0x1d6812;return _0x5ad190;})['then'](respondWithFilteredResult(_0x294429,_0x45f884))[_0xd09c('0x3f')](handleError(_0x294429,null));};exports[_0xd09c('0x40')]=function(_0x5bd244,_0x2d69cd){var _0x431871={'raw':!![],'where':{'id':_0x5bd244['params']['id']}},_0x1d516f={};_0x1d516f[_0xd09c('0x2f')]=_[_0xd09c('0x2c')](db['OpenchannelTransferReport'][_0xd09c('0x28')]);_0x1d516f[_0xd09c('0x2b')]=_['keys'](_0x5bd244[_0xd09c('0x2b')]);_0x1d516f[_0xd09c('0x2d')]=_[_0xd09c('0x2e')](_0x1d516f[_0xd09c('0x2f')],_0x1d516f[_0xd09c('0x2b')]);_0x431871[_0xd09c('0x30')]=_['intersection'](_0x1d516f[_0xd09c('0x2f')],qs[_0xd09c('0x41')](_0x5bd244[_0xd09c('0x2b')][_0xd09c('0x41')]));_0x431871[_0xd09c('0x30')]=_0x431871[_0xd09c('0x30')][_0xd09c('0x31')]?_0x431871[_0xd09c('0x30')]:_0x1d516f['model'];if(_0x5bd244[_0xd09c('0x2b')][_0xd09c('0x3c')]){_0x431871[_0xd09c('0x3d')]=[{'all':!![]}];}_0x431871=_[_0xd09c('0x37')]({},_0x431871,_0x5bd244['options']);return db['OpenchannelTransferReport'][_0xd09c('0x42')](_0x431871)[_0xd09c('0x21')](handleEntityNotFound(_0x2d69cd,null))[_0xd09c('0x21')](respondWithResult(_0x2d69cd,null))[_0xd09c('0x3f')](handleError(_0x2d69cd,null));};exports[_0xd09c('0x43')]=function(_0x403f7f,_0x4c0369){return db['OpenchannelTransferReport']['create'](_0x403f7f[_0xd09c('0x44')],{})[_0xd09c('0x21')](respondWithResult(_0x4c0369,0xc9))[_0xd09c('0x3f')](handleError(_0x4c0369,null));};exports[_0xd09c('0x20')]=function(_0x19a4e5,_0x4fc578){if(_0x19a4e5[_0xd09c('0x44')]['id']){delete _0x19a4e5[_0xd09c('0x44')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x19a4e5['params']['id']}})[_0xd09c('0x21')](handleEntityNotFound(_0x4fc578,null))[_0xd09c('0x21')](saveUpdates(_0x19a4e5[_0xd09c('0x44')],null))[_0xd09c('0x21')](respondWithResult(_0x4fc578,null))[_0xd09c('0x3f')](handleError(_0x4fc578,null));};exports['destroy']=function(_0x31ce98,_0xf7c79c){return db['OpenchannelTransferReport'][_0xd09c('0x42')]({'where':{'id':_0x31ce98[_0xd09c('0x45')]['id']}})[_0xd09c('0x21')](handleEntityNotFound(_0xf7c79c,null))[_0xd09c('0x21')](removeEntity(_0xf7c79c,null))[_0xd09c('0x3f')](handleError(_0xf7c79c,null));};exports['describe']=function(_0x1a9c77,_0x5becc0){return db['OpenchannelTransferReport'][_0xd09c('0x46')]()[_0xd09c('0x21')](respondWithResult(_0x5becc0,null))[_0xd09c('0x3f')](handleError(_0x5becc0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index aeaad89..d5a9ea1 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 _0x4b38=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1078b4,_0x14eaf9){var _0x7ba7c7=function(_0x8c5cb2){while(--_0x8c5cb2){_0x1078b4['push'](_0x1078b4['shift']());}};_0x7ba7c7(++_0x14eaf9);}(_0x4b38,0x12a));var _0x84b3=function(_0x5b9769,_0xf5b80c){_0x5b9769=_0x5b9769-0x0;var _0x521739=_0x4b38[_0x5b9769];return _0x521739;};'use strict';var _=require(_0x84b3('0x0'));var util=require(_0x84b3('0x1'));var logger=require(_0x84b3('0x2'))(_0x84b3('0x3'));var moment=require(_0x84b3('0x4'));var BPromise=require(_0x84b3('0x5'));var rp=require(_0x84b3('0x6'));var fs=require('fs');var path=require(_0x84b3('0x7'));var rimraf=require(_0x84b3('0x8'));var config=require(_0x84b3('0x9'));var attributes=require(_0x84b3('0xa'));module[_0x84b3('0xb')]=function(_0x30ffb3,_0x29c814){return _0x30ffb3[_0x84b3('0xc')](_0x84b3('0xd'),attributes,{'tableName':_0x84b3('0xe'),'paranoid':![],'indexes':[{'name':_0x84b3('0xf'),'fields':[_0x84b3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7190=['uniqueid','lodash','util','moment','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x7190,0xf1));var _0x0719=function(_0x329f42,_0x2de7e7){_0x329f42=_0x329f42-0x0;var _0x3618f0=_0x7190[_0x329f42];return _0x3618f0;};'use strict';var _=require(_0x0719('0x0'));var util=require(_0x0719('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0719('0x2'));var BPromise=require('bluebird');var rp=require(_0x0719('0x3'));var fs=require('fs');var path=require(_0x0719('0x4'));var rimraf=require('rimraf');var config=require(_0x0719('0x5'));var attributes=require(_0x0719('0x6'));module[_0x0719('0x7')]=function(_0x16f0e7,_0x521202){return _0x16f0e7[_0x0719('0x8')](_0x0719('0x9'),attributes,{'tableName':_0x0719('0xa'),'paranoid':![],'indexes':[{'name':_0x0719('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index a554a5a..cf1bdac 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 _0xf52f=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x2ba439,_0x4a256e){var _0x1af613=function(_0x37bcfa){while(--_0x37bcfa){_0x2ba439['push'](_0x2ba439['shift']());}};_0x1af613(++_0x4a256e);}(_0xf52f,0x113));var _0xff52=function(_0x3be1a7,_0x1b1f31){_0x3be1a7=_0x3be1a7-0x0;var _0x6648ac=_0xf52f[_0x3be1a7];return _0x6648ac;};'use strict';var _=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var moment=require(_0xff52('0x2'));var BPromise=require('bluebird');var rs=require(_0xff52('0x3'));var fs=require('fs');var Redis=require(_0xff52('0x4'));var db=require(_0xff52('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff52('0x6'))(_0xff52('0x7'));var config=require('../../config/environment');var jayson=require(_0xff52('0x8'));var client=jayson[_0xff52('0x9')][_0xff52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328920,_0x64f10b,_0x17af4a){return new BPromise(function(_0x2e80a0,_0x10dcbe){return client[_0xff52('0xb')](_0x328920,_0x17af4a)[_0xff52('0xc')](function(_0x34f1f9){logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));logger[_0xff52('0x10')](_0xff52('0x11'),_0x64f10b,_0xff52('0xf'),JSON[_0xff52('0x12')](_0x34f1f9));if(_0x34f1f9[_0xff52('0x13')]){if(_0x34f1f9['error']['code']===0x1f4){logger[_0xff52('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x64f10b,_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);return _0x10dcbe(_0x34f1f9[_0xff52('0x13')][_0xff52('0x14')]);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x64f10b,_0x34f1f9['error'][_0xff52('0x14')]);return _0x2e80a0(_0x34f1f9['error']['message']);}else{logger[_0xff52('0xd')](_0xff52('0xe'),_0x64f10b,_0xff52('0xf'));_0x2e80a0(_0x34f1f9[_0xff52('0x15')][_0xff52('0x14')]);}})['catch'](function(_0x853d6b){logger['error'](_0xff52('0xe'),_0x64f10b,_0x853d6b);_0x10dcbe(_0x853d6b);});});} \ No newline at end of file +var _0x815b=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x815b,0xb4));var _0xb815=function(_0x2477b1,_0x502b59){_0x2477b1=_0x2477b1-0x0;var _0x34d8bf=_0x815b[_0x2477b1];return _0x34d8bf;};'use strict';var _=require(_0xb815('0x0'));var util=require(_0xb815('0x1'));var moment=require(_0xb815('0x2'));var BPromise=require(_0xb815('0x3'));var rs=require(_0xb815('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb815('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb815('0x6'));var config=require(_0xb815('0x7'));var jayson=require(_0xb815('0x8'));var client=jayson['client'][_0xb815('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a40,_0x4930f6,_0xeba45d){return new BPromise(function(_0x479b09,_0x4d0873){return client[_0xb815('0xa')](_0x3f7a40,_0xeba45d)[_0xb815('0xb')](function(_0x3f8c27){logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));logger[_0xb815('0xf')](_0xb815('0x10'),_0x4930f6,'request\x20sent',JSON[_0xb815('0x11')](_0x3f8c27));if(_0x3f8c27[_0xb815('0x12')]){if(_0x3f8c27[_0xb815('0x12')][_0xb815('0x13')]===0x1f4){logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')]['message']);return _0x4d0873(_0x3f8c27['error'][_0xb815('0x14')]);}logger[_0xb815('0x12')](_0xb815('0xd'),_0x4930f6,_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);return _0x479b09(_0x3f8c27[_0xb815('0x12')][_0xb815('0x14')]);}else{logger[_0xb815('0xc')](_0xb815('0xd'),_0x4930f6,_0xb815('0xe'));_0x479b09(_0x3f8c27[_0xb815('0x15')][_0xb815('0x14')]);}})[_0xb815('0x16')](function(_0x52d8dd){logger['error'](_0xb815('0xd'),_0x4930f6,_0x52d8dd);_0x4d0873(_0x52d8dd);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 488726c..cfe0798 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 _0x6fd3=['isAuthenticated','index','/:id','show','post','create','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get'];(function(_0x59e7be,_0x4acb8c){var _0x258e32=function(_0x5d6f2f){while(--_0x5d6f2f){_0x59e7be['push'](_0x59e7be['shift']());}};_0x258e32(++_0x4acb8c);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x386b1b,_0x10b035){_0x386b1b=_0x386b1b-0x0;var _0x5d0645=_0x6fd3[_0x386b1b];return _0x5d0645;};'use strict';var multer=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var path=require(_0x36fd('0x2'));var timeout=require(_0x36fd('0x3'));var express=require(_0x36fd('0x4'));var router=express['Router']();var fs_extra=require(_0x36fd('0x5'));var auth=require(_0x36fd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x36fd('0x7'));var controller=require(_0x36fd('0x8'));router[_0x36fd('0x9')]('/',auth[_0x36fd('0xa')](),controller[_0x36fd('0xb')]);router[_0x36fd('0x9')](_0x36fd('0xc'),auth[_0x36fd('0xa')](),controller[_0x36fd('0xd')]);router[_0x36fd('0xe')]('/',auth[_0x36fd('0xa')](),controller[_0x36fd('0xf')]);router['put'](_0x36fd('0xc'),auth['isAuthenticated'](),controller[_0x36fd('0x10')]);router['delete'](_0x36fd('0xc'),auth[_0x36fd('0xa')](),controller['destroy']);module[_0x36fd('0x11')]=router; \ No newline at end of file +var _0x8408=['connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','path'];(function(_0x5c563f,_0x52411d){var _0x1efc92=function(_0x41f482){while(--_0x41f482){_0x5c563f['push'](_0x5c563f['shift']());}};_0x1efc92(++_0x52411d);}(_0x8408,0x1ce));var _0x8840=function(_0x1c0c7c,_0x2ede87){_0x1c0c7c=_0x1c0c7c-0x0;var _0x1eeae0=_0x8408[_0x1c0c7c];return _0x1eeae0;};'use strict';var multer=require(_0x8840('0x0'));var util=require('util');var path=require(_0x8840('0x1'));var timeout=require(_0x8840('0x2'));var express=require(_0x8840('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8840('0x4'));var config=require(_0x8840('0x5'));var controller=require('./pause.controller');router[_0x8840('0x6')]('/',auth['isAuthenticated'](),controller[_0x8840('0x7')]);router[_0x8840('0x6')](_0x8840('0x8'),auth[_0x8840('0x9')](),controller[_0x8840('0xa')]);router['post']('/',auth[_0x8840('0x9')](),controller[_0x8840('0xb')]);router[_0x8840('0xc')](_0x8840('0x8'),auth[_0x8840('0x9')](),controller[_0x8840('0xd')]);router[_0x8840('0xe')](_0x8840('0x8'),auth['isAuthenticated'](),controller[_0x8840('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 791d038..16585c2 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 _0x2e8c=['sequelize','exports','STRING','name'];(function(_0x544861,_0x31753d){var _0x2dd0df=function(_0x147439){while(--_0x147439){_0x544861['push'](_0x544861['shift']());}};_0x2dd0df(++_0x31753d);}(_0x2e8c,0xd0));var _0xc2e8=function(_0xd88cfa,_0x234dcd){_0xd88cfa=_0xd88cfa-0x0;var _0x1a4edf=_0x2e8c[_0xd88cfa];return _0x1a4edf;};'use strict';var Sequelize=require(_0xc2e8('0x0'));module[_0xc2e8('0x1')]={'name':{'type':Sequelize[_0xc2e8('0x2')],'unique':_0xc2e8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc2e8('0x2')]}}; \ No newline at end of file +var _0x157b=['name','STRING','sequelize','exports'];(function(_0x1a4191,_0x4384a4){var _0x2c1d7d=function(_0xc027c0){while(--_0xc027c0){_0x1a4191['push'](_0x1a4191['shift']());}};_0x2c1d7d(++_0x4384a4);}(_0x157b,0x13e));var _0xb157=function(_0x114a2e,_0x430f9d){_0x114a2e=_0x114a2e-0x0;var _0x3aad57=_0x157b[_0x114a2e];return _0x3aad57;};'use strict';var Sequelize=require(_0xb157('0x0'));module[_0xb157('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb157('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xb157('0x3')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index cbb59e6..4be000f 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 _0x1849=['squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','end','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','nolimit','sort','where','filters','pick','filter','merge','options','Pause','includeAll','include','findAll','rows','show','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x1849,0xed));var _0x9184=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x1849[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9184('0x0'));var zipdir=require(_0x9184('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9184('0x2'));var moment=require('moment');var BPromise=require(_0x9184('0x3'));var Mustache=require('mustache');var util=require(_0x9184('0x4'));var path=require(_0x9184('0x5'));var sox=require('sox');var csv=require(_0x9184('0x6'));var ejs=require(_0x9184('0x7'));var fs=require('fs');var fs_extra=require(_0x9184('0x8'));var _=require('lodash');var squel=require(_0x9184('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9184('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9184('0xb'));var Papa=require(_0x9184('0xc'));var Redis=require(_0x9184('0xd'));var authService=require(_0x9184('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x9184('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9184('0x10'))(_0x9184('0x11'));var utils=require(_0x9184('0x12'));var config=require(_0x9184('0x13'));var licenseUtil=require(_0x9184('0x14'));var db=require(_0x9184('0x15'))['db'];function respondWithStatusCode(_0x2d1361,_0x4c9cca){_0x4c9cca=_0x4c9cca||0xcc;return function(_0xf334e8){if(_0xf334e8){return _0x2d1361[_0x9184('0x16')](_0x4c9cca);}return _0x2d1361['status'](_0x4c9cca)['end']();};}function respondWithResult(_0x19e157,_0x6a068){_0x6a068=_0x6a068||0xc8;return function(_0x51ae2c){if(_0x51ae2c){return _0x19e157[_0x9184('0x17')](_0x6a068)[_0x9184('0x18')](_0x51ae2c);}};}function respondWithFilteredResult(_0x389a07,_0xc0fede){return function(_0x29fe6e){if(_0x29fe6e){var _0x417482=typeof _0xc0fede['offset']==='undefined'&&typeof _0xc0fede[_0x9184('0x19')]===_0x9184('0x1a');var _0x1e8d94=_0x29fe6e[_0x9184('0x1b')];var _0x2ad8ef=_0x417482?0x0:_0xc0fede['offset'];var _0x408e60=_0x417482?_0x29fe6e[_0x9184('0x1b')]:_0xc0fede[_0x9184('0x1c')]+_0xc0fede[_0x9184('0x19')];var _0xb9707e;if(_0x408e60>=_0x1e8d94){_0x408e60=_0x1e8d94;_0xb9707e=0xc8;}else{_0xb9707e=0xce;}_0x389a07[_0x9184('0x17')](_0xb9707e);return _0x389a07[_0x9184('0x1d')](_0x9184('0x1e'),_0x2ad8ef+'-'+_0x408e60+'/'+_0x1e8d94)[_0x9184('0x18')](_0x29fe6e);}return null;};}function patchUpdates(_0x55ceaf){return function(_0x4f965c){try{jsonpatch[_0x9184('0x1f')](_0x4f965c,_0x55ceaf,!![]);}catch(_0x105ea8){return BPromise[_0x9184('0x20')](_0x105ea8);}return _0x4f965c[_0x9184('0x21')]();};}function saveUpdates(_0x5ea26b,_0x588a53){return function(_0x4ca358){if(_0x4ca358){return _0x4ca358[_0x9184('0x22')](_0x5ea26b)[_0x9184('0x23')](function(_0x1a1250){return _0x1a1250;});}return null;};}function removeEntity(_0x504163,_0x4589c3){return function(_0x1e2eff){if(_0x1e2eff){return _0x1e2eff[_0x9184('0x24')]()['then'](function(){var _0x5375c0=_0x1e2eff['get']({'plain':!![]});var _0x12ed72=_0x9184('0x25');return db[_0x9184('0x26')][_0x9184('0x24')]({'where':{'type':_0x12ed72,'resourceId':_0x5375c0['id']}})[_0x9184('0x23')](function(){return _0x1e2eff;});})['then'](function(){_0x504163[_0x9184('0x17')](0xcc)[_0x9184('0x27')]();});}};}function handleEntityNotFound(_0x2feebf,_0x3a2846){return function(_0x165200){if(!_0x165200){_0x2feebf[_0x9184('0x16')](0x194);}return _0x165200;};}function handleError(_0x452cb6,_0x2867ee){_0x2867ee=_0x2867ee||0x1f4;return function(_0x5eb390){logger[_0x9184('0x28')](_0x5eb390[_0x9184('0x29')]);if(_0x5eb390['name']){delete _0x5eb390['name'];}_0x452cb6[_0x9184('0x17')](_0x2867ee)[_0x9184('0x2a')](_0x5eb390);};}exports[_0x9184('0x2b')]=function(_0x5d22d9,_0x48a386){var _0x241112={},_0x203ae7={},_0x53ca04={'count':0x0,'rows':[]};var _0xa4021f=_[_0x9184('0x2c')](db['Pause'][_0x9184('0x2d')],function(_0x332046){return{'name':_0x332046[_0x9184('0x2e')],'type':_0x332046[_0x9184('0x2f')][_0x9184('0x30')]};});_0x203ae7[_0x9184('0x31')]=_['map'](_0xa4021f,_0x9184('0x32'));_0x203ae7[_0x9184('0x33')]=_[_0x9184('0x34')](_0x5d22d9[_0x9184('0x33')]);_0x203ae7['filters']=_[_0x9184('0x35')](_0x203ae7[_0x9184('0x31')],_0x203ae7[_0x9184('0x33')]);_0x241112[_0x9184('0x36')]=_['intersection'](_0x203ae7[_0x9184('0x31')],qs['fields'](_0x5d22d9['query']['fields']));_0x241112[_0x9184('0x36')]=_0x241112[_0x9184('0x36')]['length']?_0x241112[_0x9184('0x36')]:_0x203ae7['model'];if(!_0x5d22d9['query']['hasOwnProperty'](_0x9184('0x37'))){_0x241112[_0x9184('0x19')]=qs[_0x9184('0x19')](_0x5d22d9[_0x9184('0x33')][_0x9184('0x19')]);_0x241112[_0x9184('0x1c')]=qs[_0x9184('0x1c')](_0x5d22d9[_0x9184('0x33')][_0x9184('0x1c')]);}_0x241112['order']=qs['sort'](_0x5d22d9['query'][_0x9184('0x38')]);_0x241112[_0x9184('0x39')]=qs[_0x9184('0x3a')](_[_0x9184('0x3b')](_0x5d22d9[_0x9184('0x33')],_0x203ae7[_0x9184('0x3a')]),_0xa4021f);if(_0x5d22d9[_0x9184('0x33')][_0x9184('0x3c')]){_0x241112[_0x9184('0x39')]=_[_0x9184('0x3d')](_0x241112[_0x9184('0x39')],{'$or':_[_0x9184('0x2c')](_0xa4021f,function(_0x244977){if(_0x244977[_0x9184('0x2f')]!=='VIRTUAL'){var _0xe1f308={};_0xe1f308[_0x244977['name']]={'$like':'%'+_0x5d22d9['query']['filter']+'%'};return _0xe1f308;}})});}_0x241112=_[_0x9184('0x3d')]({},_0x241112,_0x5d22d9[_0x9184('0x3e')]);var _0x1f98ba={'where':_0x241112[_0x9184('0x39')]};return db[_0x9184('0x3f')][_0x9184('0x1b')](_0x1f98ba)[_0x9184('0x23')](function(_0x337abc){_0x53ca04[_0x9184('0x1b')]=_0x337abc;if(_0x5d22d9[_0x9184('0x33')][_0x9184('0x40')]){_0x241112[_0x9184('0x41')]=[{'all':!![]}];}return db[_0x9184('0x3f')][_0x9184('0x42')](_0x241112);})['then'](function(_0x4d887a){_0x53ca04[_0x9184('0x43')]=_0x4d887a;return _0x53ca04;})['then'](respondWithFilteredResult(_0x48a386,_0x241112))['catch'](handleError(_0x48a386,null));};exports[_0x9184('0x44')]=function(_0x217199,_0x472ad1){var _0x574ab7={'raw':!![],'where':{'id':_0x217199[_0x9184('0x45')]['id']}},_0x3dd781={};_0x3dd781[_0x9184('0x31')]=_['keys'](db['Pause'][_0x9184('0x2d')]);_0x3dd781[_0x9184('0x33')]=_['keys'](_0x217199[_0x9184('0x33')]);_0x3dd781[_0x9184('0x3a')]=_[_0x9184('0x35')](_0x3dd781[_0x9184('0x31')],_0x3dd781[_0x9184('0x33')]);_0x574ab7[_0x9184('0x36')]=_['intersection'](_0x3dd781[_0x9184('0x31')],qs[_0x9184('0x46')](_0x217199[_0x9184('0x33')]['fields']));_0x574ab7[_0x9184('0x36')]=_0x574ab7['attributes']['length']?_0x574ab7[_0x9184('0x36')]:_0x3dd781[_0x9184('0x31')];if(_0x217199[_0x9184('0x33')][_0x9184('0x40')]){_0x574ab7['include']=[{'all':!![]}];}_0x574ab7=_[_0x9184('0x3d')]({},_0x574ab7,_0x217199[_0x9184('0x3e')]);return db['Pause'][_0x9184('0x47')](_0x574ab7)[_0x9184('0x23')](handleEntityNotFound(_0x472ad1,null))['then'](respondWithResult(_0x472ad1,null))['catch'](handleError(_0x472ad1,null));};exports[_0x9184('0x48')]=function(_0x469945,_0x1197f9){return db[_0x9184('0x3f')][_0x9184('0x48')](_0x469945[_0x9184('0x49')],{})[_0x9184('0x23')](function(_0x3375dd){var _0x4cbaa9=_0x469945[_0x9184('0x4a')][_0x9184('0x4b')]({'plain':!![]});if(!_0x4cbaa9)throw new Error(_0x9184('0x4c'));if(_0x4cbaa9[_0x9184('0x4d')]===_0x9184('0x4a')){var _0x10f68e=_0x3375dd['get']({'plain':!![]});var _0xdf443=_0x9184('0x25');return db[_0x9184('0x4e')]['find']({'where':{'name':_0xdf443,'userProfileId':_0x4cbaa9[_0x9184('0x4f')]},'raw':!![]})[_0x9184('0x23')](function(_0x59ad29){if(_0x59ad29&&_0x59ad29['autoAssociation']===0x0){return db[_0x9184('0x26')]['create']({'name':_0x10f68e['name'],'resourceId':_0x10f68e['id'],'type':_0x59ad29[_0x9184('0x32')],'sectionId':_0x59ad29['id']},{})[_0x9184('0x23')](function(){return _0x3375dd;});}else{return _0x3375dd;}})['catch'](function(_0x1bfa8c){logger[_0x9184('0x28')](_0x9184('0x50'),_0x1bfa8c);throw _0x1bfa8c;});}return _0x3375dd;})[_0x9184('0x23')](respondWithResult(_0x1197f9,0xc9))[_0x9184('0x51')](handleError(_0x1197f9,null));};exports[_0x9184('0x22')]=function(_0x189862,_0x2bcad6){if(_0x189862[_0x9184('0x49')]['id']){delete _0x189862[_0x9184('0x49')]['id'];}return db[_0x9184('0x3f')][_0x9184('0x47')]({'where':{'id':_0x189862['params']['id']}})[_0x9184('0x23')](handleEntityNotFound(_0x2bcad6,null))[_0x9184('0x23')](saveUpdates(_0x189862['body'],null))['then'](respondWithResult(_0x2bcad6,null))['catch'](handleError(_0x2bcad6,null));};exports['destroy']=function(_0x54c975,_0x3c8033){return db[_0x9184('0x3f')][_0x9184('0x47')]({'where':{'id':_0x54c975[_0x9184('0x45')]['id']}})[_0x9184('0x23')](handleEntityNotFound(_0x3c8033,null))[_0x9184('0x23')](removeEntity(_0x3c8033,null))[_0x9184('0x51')](handleError(_0x3c8033,null));}; \ No newline at end of file +var _0x186d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','destroy','then','get','Pauses','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x186d,0xe8));var _0xd186=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0x186d[_0x51ab83];return _0x14b6de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd186('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd186('0x1'));var rp=require(_0xd186('0x2'));var moment=require(_0xd186('0x3'));var BPromise=require(_0xd186('0x4'));var Mustache=require(_0xd186('0x5'));var util=require(_0xd186('0x6'));var path=require(_0xd186('0x7'));var sox=require(_0xd186('0x8'));var csv=require(_0xd186('0x9'));var ejs=require(_0xd186('0xa'));var fs=require('fs');var fs_extra=require(_0xd186('0xb'));var _=require(_0xd186('0xc'));var squel=require('squel');var crypto=require(_0xd186('0xd'));var jsforce=require(_0xd186('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd186('0x9'));var querystring=require('querystring');var Papa=require(_0xd186('0xf'));var Redis=require(_0xd186('0x10'));var authService=require(_0xd186('0x11'));var qs=require(_0xd186('0x12'));var as=require(_0xd186('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd186('0x14'));var utils=require(_0xd186('0x15'));var config=require(_0xd186('0x16'));var licenseUtil=require(_0xd186('0x17'));var db=require(_0xd186('0x18'))['db'];function respondWithStatusCode(_0x3a7d84,_0x3d401b){_0x3d401b=_0x3d401b||0xcc;return function(_0x42e17b){if(_0x42e17b){return _0x3a7d84[_0xd186('0x19')](_0x3d401b);}return _0x3a7d84[_0xd186('0x1a')](_0x3d401b)[_0xd186('0x1b')]();};}function respondWithResult(_0x28e5a6,_0x265e02){_0x265e02=_0x265e02||0xc8;return function(_0x279ffe){if(_0x279ffe){return _0x28e5a6[_0xd186('0x1a')](_0x265e02)[_0xd186('0x1c')](_0x279ffe);}};}function respondWithFilteredResult(_0x260db4,_0x313517){return function(_0x5a1d6a){if(_0x5a1d6a){var _0x1253f7=typeof _0x313517['offset']===_0xd186('0x1d')&&typeof _0x313517['limit']===_0xd186('0x1d');var _0x371258=_0x5a1d6a[_0xd186('0x1e')];var _0x4c4cde=_0x1253f7?0x0:_0x313517[_0xd186('0x1f')];var _0x3884e3=_0x1253f7?_0x5a1d6a[_0xd186('0x1e')]:_0x313517[_0xd186('0x1f')]+_0x313517[_0xd186('0x20')];var _0x520bad;if(_0x3884e3>=_0x371258){_0x3884e3=_0x371258;_0x520bad=0xc8;}else{_0x520bad=0xce;}_0x260db4[_0xd186('0x1a')](_0x520bad);return _0x260db4[_0xd186('0x21')](_0xd186('0x22'),_0x4c4cde+'-'+_0x3884e3+'/'+_0x371258)[_0xd186('0x1c')](_0x5a1d6a);}return null;};}function patchUpdates(_0x2ab10a){return function(_0x5710d9){try{jsonpatch[_0xd186('0x23')](_0x5710d9,_0x2ab10a,!![]);}catch(_0x56e24e){return BPromise['reject'](_0x56e24e);}return _0x5710d9[_0xd186('0x24')]();};}function saveUpdates(_0x2568d4,_0x9c6ad6){return function(_0xfe5b2d){if(_0xfe5b2d){return _0xfe5b2d['update'](_0x2568d4)['then'](function(_0x34e96a){return _0x34e96a;});}return null;};}function removeEntity(_0x3c559f,_0x4b2a94){return function(_0x1ca01b){if(_0x1ca01b){return _0x1ca01b[_0xd186('0x25')]()[_0xd186('0x26')](function(){var _0x5e0d28=_0x1ca01b[_0xd186('0x27')]({'plain':!![]});var _0x4b3c6e=_0xd186('0x28');return db[_0xd186('0x29')]['destroy']({'where':{'type':_0x4b3c6e,'resourceId':_0x5e0d28['id']}})[_0xd186('0x26')](function(){return _0x1ca01b;});})[_0xd186('0x26')](function(){_0x3c559f[_0xd186('0x1a')](0xcc)[_0xd186('0x1b')]();});}};}function handleEntityNotFound(_0x155736,_0x140245){return function(_0x37a7ff){if(!_0x37a7ff){_0x155736['sendStatus'](0x194);}return _0x37a7ff;};}function handleError(_0x318105,_0xfdf367){_0xfdf367=_0xfdf367||0x1f4;return function(_0x360fac){logger['error'](_0x360fac[_0xd186('0x2a')]);if(_0x360fac[_0xd186('0x2b')]){delete _0x360fac[_0xd186('0x2b')];}_0x318105['status'](_0xfdf367)[_0xd186('0x2c')](_0x360fac);};}exports[_0xd186('0x2d')]=function(_0x1df3e8,_0x5837d6){var _0x264f07={},_0x5da7f0={},_0x1dcd78={'count':0x0,'rows':[]};var _0x2fb32b=_['map'](db[_0xd186('0x2e')][_0xd186('0x2f')],function(_0x29e60e){return{'name':_0x29e60e[_0xd186('0x30')],'type':_0x29e60e[_0xd186('0x31')]['key']};});_0x5da7f0['model']=_[_0xd186('0x32')](_0x2fb32b,_0xd186('0x2b'));_0x5da7f0[_0xd186('0x33')]=_[_0xd186('0x34')](_0x1df3e8['query']);_0x5da7f0[_0xd186('0x35')]=_[_0xd186('0x36')](_0x5da7f0[_0xd186('0x37')],_0x5da7f0[_0xd186('0x33')]);_0x264f07[_0xd186('0x38')]=_[_0xd186('0x36')](_0x5da7f0[_0xd186('0x37')],qs[_0xd186('0x39')](_0x1df3e8[_0xd186('0x33')][_0xd186('0x39')]));_0x264f07[_0xd186('0x38')]=_0x264f07[_0xd186('0x38')]['length']?_0x264f07[_0xd186('0x38')]:_0x5da7f0[_0xd186('0x37')];if(!_0x1df3e8[_0xd186('0x33')][_0xd186('0x3a')](_0xd186('0x3b'))){_0x264f07['limit']=qs[_0xd186('0x20')](_0x1df3e8[_0xd186('0x33')][_0xd186('0x20')]);_0x264f07[_0xd186('0x1f')]=qs[_0xd186('0x1f')](_0x1df3e8['query'][_0xd186('0x1f')]);}_0x264f07['order']=qs['sort'](_0x1df3e8[_0xd186('0x33')][_0xd186('0x3c')]);_0x264f07[_0xd186('0x3d')]=qs[_0xd186('0x35')](_['pick'](_0x1df3e8['query'],_0x5da7f0['filters']),_0x2fb32b);if(_0x1df3e8[_0xd186('0x33')][_0xd186('0x3e')]){_0x264f07[_0xd186('0x3d')]=_[_0xd186('0x3f')](_0x264f07[_0xd186('0x3d')],{'$or':_['map'](_0x2fb32b,function(_0x45793f){if(_0x45793f[_0xd186('0x31')]!==_0xd186('0x40')){var _0x49598c={};_0x49598c[_0x45793f['name']]={'$like':'%'+_0x1df3e8[_0xd186('0x33')][_0xd186('0x3e')]+'%'};return _0x49598c;}})});}_0x264f07=_[_0xd186('0x3f')]({},_0x264f07,_0x1df3e8[_0xd186('0x41')]);var _0x67217a={'where':_0x264f07['where']};return db[_0xd186('0x2e')]['count'](_0x67217a)[_0xd186('0x26')](function(_0x398f73){_0x1dcd78[_0xd186('0x1e')]=_0x398f73;if(_0x1df3e8[_0xd186('0x33')][_0xd186('0x42')]){_0x264f07[_0xd186('0x43')]=[{'all':!![]}];}return db[_0xd186('0x2e')][_0xd186('0x44')](_0x264f07);})[_0xd186('0x26')](function(_0x56675e){_0x1dcd78[_0xd186('0x45')]=_0x56675e;return _0x1dcd78;})[_0xd186('0x26')](respondWithFilteredResult(_0x5837d6,_0x264f07))[_0xd186('0x46')](handleError(_0x5837d6,null));};exports['show']=function(_0x1a97e2,_0x1ae248){var _0x227590={'raw':!![],'where':{'id':_0x1a97e2[_0xd186('0x47')]['id']}},_0x447b8a={};_0x447b8a[_0xd186('0x37')]=_['keys'](db['Pause'][_0xd186('0x2f')]);_0x447b8a['query']=_[_0xd186('0x34')](_0x1a97e2[_0xd186('0x33')]);_0x447b8a[_0xd186('0x35')]=_['intersection'](_0x447b8a[_0xd186('0x37')],_0x447b8a[_0xd186('0x33')]);_0x227590[_0xd186('0x38')]=_[_0xd186('0x36')](_0x447b8a[_0xd186('0x37')],qs[_0xd186('0x39')](_0x1a97e2[_0xd186('0x33')][_0xd186('0x39')]));_0x227590[_0xd186('0x38')]=_0x227590[_0xd186('0x38')][_0xd186('0x48')]?_0x227590[_0xd186('0x38')]:_0x447b8a[_0xd186('0x37')];if(_0x1a97e2['query']['includeAll']){_0x227590[_0xd186('0x43')]=[{'all':!![]}];}_0x227590=_[_0xd186('0x3f')]({},_0x227590,_0x1a97e2[_0xd186('0x41')]);return db[_0xd186('0x2e')][_0xd186('0x49')](_0x227590)['then'](handleEntityNotFound(_0x1ae248,null))[_0xd186('0x26')](respondWithResult(_0x1ae248,null))[_0xd186('0x46')](handleError(_0x1ae248,null));};exports[_0xd186('0x4a')]=function(_0x44be91,_0x58c75a){return db[_0xd186('0x2e')][_0xd186('0x4a')](_0x44be91[_0xd186('0x4b')],{})['then'](function(_0x2a58d6){var _0x505853=_0x44be91[_0xd186('0x4c')][_0xd186('0x27')]({'plain':!![]});if(!_0x505853)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x505853[_0xd186('0x4d')]===_0xd186('0x4c')){var _0x499c65=_0x2a58d6[_0xd186('0x27')]({'plain':!![]});var _0x4b6aae=_0xd186('0x28');return db[_0xd186('0x4e')][_0xd186('0x49')]({'where':{'name':_0x4b6aae,'userProfileId':_0x505853[_0xd186('0x4f')]},'raw':!![]})['then'](function(_0xccc1c7){if(_0xccc1c7&&_0xccc1c7[_0xd186('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x499c65['name'],'resourceId':_0x499c65['id'],'type':_0xccc1c7[_0xd186('0x2b')],'sectionId':_0xccc1c7['id']},{})[_0xd186('0x26')](function(){return _0x2a58d6;});}else{return _0x2a58d6;}})[_0xd186('0x46')](function(_0xd20fcc){logger[_0xd186('0x51')](_0xd186('0x52'),_0xd20fcc);throw _0xd20fcc;});}return _0x2a58d6;})[_0xd186('0x26')](respondWithResult(_0x58c75a,0xc9))[_0xd186('0x46')](handleError(_0x58c75a,null));};exports[_0xd186('0x53')]=function(_0x15e8f2,_0x2f9825){if(_0x15e8f2[_0xd186('0x4b')]['id']){delete _0x15e8f2[_0xd186('0x4b')]['id'];}return db['Pause'][_0xd186('0x49')]({'where':{'id':_0x15e8f2['params']['id']}})[_0xd186('0x26')](handleEntityNotFound(_0x2f9825,null))[_0xd186('0x26')](saveUpdates(_0x15e8f2[_0xd186('0x4b')],null))[_0xd186('0x26')](respondWithResult(_0x2f9825,null))[_0xd186('0x46')](handleError(_0x2f9825,null));};exports[_0xd186('0x25')]=function(_0x554930,_0x573682){return db[_0xd186('0x2e')][_0xd186('0x49')]({'where':{'id':_0x554930[_0xd186('0x47')]['id']}})['then'](handleEntityNotFound(_0x573682,null))['then'](removeEntity(_0x573682,null))[_0xd186('0x46')](handleError(_0x573682,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 67e50cd..71cc8e4 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x34abce,_0x5bb6b6){var _0x5efaa6=function(_0x40a979){while(--_0x40a979){_0x34abce['push'](_0x34abce['shift']());}};_0x5efaa6(++_0x5bb6b6);}(_0x53ec,0x192));var _0xc53e=function(_0x5001b4,_0x362ed5){_0x5001b4=_0x5001b4-0x0;var _0x44ffa7=_0x53ec[_0x5001b4];return _0x44ffa7;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index c376d3d..764e3a3 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(_0x45f92a,_0x2221b4){var _0x1bd051=function(_0x180c53){while(--_0x180c53){_0x45f92a['push'](_0x45f92a['shift']());}};_0x1bd051(++_0x2221b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x50d17b,_0x17cc5e){_0x50d17b=_0x50d17b-0x0;var _0x35038b=_0xb10b[_0x50d17b];return _0x35038b;};'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(_0x313f8a,_0x64c17c){var _0x160395=function(_0xe8618e){while(--_0xe8618e){_0x313f8a['push'](_0x313f8a['shift']());}};_0x160395(++_0x64c17c);}(_0x7a54,0x106));var _0x47a5=function(_0x127435,_0x441cd4){_0x127435=_0x127435-0x0;var _0x11470e=_0x7a54[_0x127435];return _0x11470e;};'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 d79e85d..002ad35 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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x3f55fc,_0x5a28c3){var _0x4bd46e=function(_0x3a8e5e){while(--_0x3a8e5e){_0x3f55fc['push'](_0x3f55fc['shift']());}};_0x4bd46e(++_0x5a28c3);}(_0xe14d,0x1ee));var _0xde14=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xe14d[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file +var _0xd0bb=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','/:id','show','download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','webhookPost','put','update','delete','exports','multer','util','path','express','fs-extra'];(function(_0x32f616,_0x373411){var _0x52f6ee=function(_0x463964){while(--_0x463964){_0x32f616['push'](_0x32f616['shift']());}};_0x52f6ee(++_0x373411);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x369a41,_0x5ed95c){_0x369a41=_0x369a41-0x0;var _0x16807d=_0xd0bb[_0x369a41];return _0x16807d;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./plugin.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),controller['webhookGet']);router[_0xbd0b('0x7')](_0xbd0b('0xb'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xc')]);router[_0xbd0b('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xbd0b('0xd')]);var upload=multer({'storage':multer[_0xbd0b('0xe')]({'destination':function(_0x4a69ff,_0x26b834,_0x196beb){_0x196beb(null,path['join'](config[_0xbd0b('0xf')],_0xbd0b('0x10')));},'filename':function(_0x3a4b28,_0x315ed9,_0x2621bf){_0x315ed9[_0xbd0b('0x11')]=_0x315ed9[_0xbd0b('0x11')][_0xbd0b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2621bf(null,util[_0xbd0b('0x13')](_0xbd0b('0x14'),path[_0xbd0b('0x15')](_0x315ed9['originalname'],path[_0xbd0b('0x16')](_0x315ed9['originalname'])),Date['now'](),path[_0xbd0b('0x16')](_0x315ed9[_0xbd0b('0x11')])));}})});router[_0xbd0b('0x17')]('/',upload[_0xbd0b('0x18')](_0xbd0b('0x19')),controller['upload']);router['post'](_0xbd0b('0xa'),controller[_0xbd0b('0x1a')]);router[_0xbd0b('0x1b')](_0xbd0b('0xb'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x1c')]);router['delete'](_0xbd0b('0xb'),auth['isAuthenticated'](),controller[_0xbd0b('0x1d')]);module[_0xbd0b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 27f60d0..9c64c86 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 _0x629f=['STRING','ENUM','html','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x165082,_0x4f70fe){var _0x762f1f=function(_0x30494f){while(--_0x30494f){_0x165082['push'](_0x165082['shift']());}};_0x762f1f(++_0x4f70fe);}(_0x629f,0x174));var _0xf629=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x629f[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xf629('0x0'));module[_0xf629('0x1')]={'name':{'type':Sequelize[_0xf629('0x2')]},'type':{'type':Sequelize[_0xf629('0x3')](_0xf629('0x4'),'script')},'description':{'type':Sequelize[_0xf629('0x5')]},'version':{'type':Sequelize[_0xf629('0x5')]},'path':{'type':Sequelize[_0xf629('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf629('0x6')],'defaultValue':0x0,'comment':_0xf629('0x7')},'sidebar':{'type':Sequelize[_0xf629('0x3')]('adminOnly','agentOnly',_0xf629('0x8'),_0xf629('0x9')),'defaultValue':_0xf629('0x8'),'comment':_0xf629('0xa')},'icon':{'type':Sequelize[_0xf629('0x2')]},'adminUrl':{'type':Sequelize[_0xf629('0x2')]},'agentUrl':{'type':Sequelize[_0xf629('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xf629('0x2')]}}; \ No newline at end of file +var _0x2f59=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2f59,0x115));var _0x92f5=function(_0x2afb28,_0x19e8b0){_0x2afb28=_0x2afb28-0x0;var _0x41d764=_0x2f59[_0x2afb28];return _0x41d764;};'use strict';var Sequelize=require('sequelize');module[_0x92f5('0x0')]={'name':{'type':Sequelize[_0x92f5('0x1')]},'type':{'type':Sequelize[_0x92f5('0x2')](_0x92f5('0x3'),'script')},'description':{'type':Sequelize[_0x92f5('0x4')]},'version':{'type':Sequelize[_0x92f5('0x4')]},'path':{'type':Sequelize[_0x92f5('0x1')],'comment':_0x92f5('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x92f5('0x6')},'sidebar':{'type':Sequelize[_0x92f5('0x2')](_0x92f5('0x7'),_0x92f5('0x8'),'always',_0x92f5('0x9')),'defaultValue':'always','comment':_0x92f5('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x92f5('0x1')]},'agentUrl':{'type':Sequelize[_0x92f5('0x1')]},'scriptName':{'type':Sequelize[_0x92f5('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5f50da3..6166799 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 _0x298d=['Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','update','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','resolve','content-type','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Plugins','UserProfileResource','name','send','index','map','Plugin','rawAttributes','type','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','download','path','join','root','format','basename','createWriteStream','zip','warning','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','node_modules/**/*','close','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','readdirSync','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','parameters','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test'];(function(_0x71df20,_0x49f7e6){var _0x10b022=function(_0x268b89){while(--_0x268b89){_0x71df20['push'](_0x71df20['shift']());}};_0x10b022(++_0x49f7e6);}(_0x298d,0x173));var _0xd298=function(_0x5a2e75,_0x14c054){_0x5a2e75=_0x5a2e75-0x0;var _0x265fce=_0x298d[_0x5a2e75];return _0x265fce;};'use strict';var emlformat=require(_0xd298('0x0'));var rimraf=require(_0xd298('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd298('0x2'));var moment=require(_0xd298('0x3'));var BPromise=require(_0xd298('0x4'));var Mustache=require(_0xd298('0x5'));var util=require(_0xd298('0x6'));var path=require('path');var sox=require(_0xd298('0x7'));var csv=require(_0xd298('0x8'));var ejs=require(_0xd298('0x9'));var fs=require('fs');var fs_extra=require(_0xd298('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd298('0xb'));var jsforce=require(_0xd298('0xc'));var deskjs=require(_0xd298('0xd'));var toCsv=require(_0xd298('0x8'));var querystring=require(_0xd298('0xe'));var Papa=require(_0xd298('0xf'));var extract=require(_0xd298('0x10'));var rimraf=require(_0xd298('0x1'));var archiver=require(_0xd298('0x11'));var Redis=require(_0xd298('0x12'));var authService=require(_0xd298('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd298('0x14'));var hardwareService=require(_0xd298('0x15'));var logger=require('../../config/logger')(_0xd298('0x16'));var utils=require(_0xd298('0x17'));var config=require(_0xd298('0x18'));var licenseUtil=require(_0xd298('0x19'));var db=require('../../mysqldb')['db'];config[_0xd298('0x1a')]=_[_0xd298('0x1b')](config[_0xd298('0x1a')],{'host':_0xd298('0x1c'),'port':0x18eb});var socket=require(_0xd298('0x1d'))(new Redis(config[_0xd298('0x1a')]));require('./plugin.socket')[_0xd298('0x1e')](socket);function respondWithStatusCode(_0x11c253,_0x536c96){_0x536c96=_0x536c96||0xcc;return function(_0x8a02ce){if(_0x8a02ce){return _0x11c253[_0xd298('0x1f')](_0x536c96);}return _0x11c253[_0xd298('0x20')](_0x536c96)[_0xd298('0x21')]();};}function respondWithResult(_0x21de81,_0x25b778){_0x25b778=_0x25b778||0xc8;return function(_0xfa1870){if(_0xfa1870){return _0x21de81['status'](_0x25b778)[_0xd298('0x22')](_0xfa1870);}};}function respondWithFilteredResult(_0x1ce3b8,_0x29962c){return function(_0x73e4c0){if(_0x73e4c0){var _0x8b4324=typeof _0x29962c[_0xd298('0x23')]===_0xd298('0x24')&&typeof _0x29962c[_0xd298('0x25')]===_0xd298('0x24');var _0x49ce2d=_0x73e4c0['count'];var _0x1ed596=_0x8b4324?0x0:_0x29962c[_0xd298('0x23')];var _0x34b324=_0x8b4324?_0x73e4c0[_0xd298('0x26')]:_0x29962c['offset']+_0x29962c[_0xd298('0x25')];var _0x3b183f;if(_0x34b324>=_0x49ce2d){_0x34b324=_0x49ce2d;_0x3b183f=0xc8;}else{_0x3b183f=0xce;}_0x1ce3b8[_0xd298('0x20')](_0x3b183f);return _0x1ce3b8[_0xd298('0x27')](_0xd298('0x28'),_0x1ed596+'-'+_0x34b324+'/'+_0x49ce2d)['json'](_0x73e4c0);}return null;};}function patchUpdates(_0x35b841){return function(_0x2e87e3){try{jsonpatch[_0xd298('0x29')](_0x2e87e3,_0x35b841,!![]);}catch(_0xef608a){return BPromise[_0xd298('0x2a')](_0xef608a);}return _0x2e87e3['save']();};}function saveUpdates(_0x13a233,_0x1f38b3){return function(_0x30ddfb){if(_0x30ddfb){return _0x30ddfb['update'](_0x13a233)[_0xd298('0x2b')](function(_0x16fbc4){return _0x16fbc4;});}return null;};}function removeEntity(_0xaa1792,_0x380c4b){return function(_0x3e5df3){if(_0x3e5df3){return _0x3e5df3[_0xd298('0x2c')]()[_0xd298('0x2b')](function(){var _0x397dca=_0x3e5df3[_0xd298('0x2d')]({'plain':!![]});var _0x510b29=_0xd298('0x2e');return db[_0xd298('0x2f')][_0xd298('0x2c')]({'where':{'type':_0x510b29,'resourceId':_0x397dca['id']}})[_0xd298('0x2b')](function(){return _0x3e5df3;});})['then'](function(){_0xaa1792[_0xd298('0x20')](0xcc)[_0xd298('0x21')]();});}};}function handleEntityNotFound(_0x2bd838,_0x14fdb4){return function(_0x3b96e9){if(!_0x3b96e9){_0x2bd838[_0xd298('0x1f')](0x194);}return _0x3b96e9;};}function handleError(_0x1072cf,_0x20d874){_0x20d874=_0x20d874||0x1f4;return function(_0x5c5e2d){logger['error'](_0x5c5e2d['stack']);if(_0x5c5e2d[_0xd298('0x30')]){delete _0x5c5e2d[_0xd298('0x30')];}_0x1072cf[_0xd298('0x20')](_0x20d874)[_0xd298('0x31')](_0x5c5e2d);};}exports[_0xd298('0x32')]=function(_0x21f03a,_0x178cc3){var _0x3b38ff={},_0x26d79c={},_0x6ea7eb={'count':0x0,'rows':[]};var _0x16b59a=_[_0xd298('0x33')](db[_0xd298('0x34')][_0xd298('0x35')],function(_0x2b4843){return{'name':_0x2b4843['fieldName'],'type':_0x2b4843[_0xd298('0x36')]['key']};});_0x26d79c['model']=_['map'](_0x16b59a,_0xd298('0x30'));_0x26d79c[_0xd298('0x37')]=_['keys'](_0x21f03a[_0xd298('0x37')]);_0x26d79c[_0xd298('0x38')]=_[_0xd298('0x39')](_0x26d79c[_0xd298('0x3a')],_0x26d79c[_0xd298('0x37')]);_0x3b38ff['attributes']=_[_0xd298('0x39')](_0x26d79c[_0xd298('0x3a')],qs[_0xd298('0x3b')](_0x21f03a[_0xd298('0x37')][_0xd298('0x3b')]));_0x3b38ff['attributes']=_0x3b38ff[_0xd298('0x3c')]['length']?_0x3b38ff[_0xd298('0x3c')]:_0x26d79c[_0xd298('0x3a')];if(!_0x21f03a[_0xd298('0x37')][_0xd298('0x3d')]('nolimit')){_0x3b38ff[_0xd298('0x25')]=qs[_0xd298('0x25')](_0x21f03a[_0xd298('0x37')][_0xd298('0x25')]);_0x3b38ff[_0xd298('0x23')]=qs['offset'](_0x21f03a['query'][_0xd298('0x23')]);}_0x3b38ff[_0xd298('0x3e')]=qs[_0xd298('0x3f')](_0x21f03a['query'][_0xd298('0x3f')]);_0x3b38ff[_0xd298('0x40')]=qs[_0xd298('0x38')](_['pick'](_0x21f03a[_0xd298('0x37')],_0x26d79c[_0xd298('0x38')]),_0x16b59a);if(_0x21f03a[_0xd298('0x37')][_0xd298('0x41')]){_0x3b38ff[_0xd298('0x40')]=_[_0xd298('0x42')](_0x3b38ff['where'],{'$or':_['map'](_0x16b59a,function(_0x6e833c){if(_0x6e833c[_0xd298('0x36')]!==_0xd298('0x43')){var _0x35461a={};_0x35461a[_0x6e833c[_0xd298('0x30')]]={'$like':'%'+_0x21f03a[_0xd298('0x37')][_0xd298('0x41')]+'%'};return _0x35461a;}})});}_0x3b38ff=_['merge']({},_0x3b38ff,_0x21f03a[_0xd298('0x44')]);var _0x587875={'where':_0x3b38ff[_0xd298('0x40')]};return db['Plugin'][_0xd298('0x26')](_0x587875)[_0xd298('0x2b')](function(_0x30ac7a){_0x6ea7eb[_0xd298('0x26')]=_0x30ac7a;if(_0x21f03a[_0xd298('0x37')][_0xd298('0x45')]){_0x3b38ff[_0xd298('0x46')]=[{'all':!![]}];}return db['Plugin'][_0xd298('0x47')](_0x3b38ff);})['then'](function(_0x2d4751){_0x6ea7eb[_0xd298('0x48')]=_0x2d4751;return _0x6ea7eb;})[_0xd298('0x2b')](respondWithFilteredResult(_0x178cc3,_0x3b38ff))[_0xd298('0x49')](handleError(_0x178cc3,null));};exports[_0xd298('0x4a')]=function(_0x889c4b,_0x32cc01){var _0x28163f={'raw':!![],'where':{'id':_0x889c4b[_0xd298('0x4b')]['id']}},_0x44dcf9={};_0x44dcf9[_0xd298('0x3a')]=_[_0xd298('0x4c')](db[_0xd298('0x34')][_0xd298('0x35')]);_0x44dcf9[_0xd298('0x37')]=_[_0xd298('0x4c')](_0x889c4b[_0xd298('0x37')]);_0x44dcf9[_0xd298('0x38')]=_[_0xd298('0x39')](_0x44dcf9[_0xd298('0x3a')],_0x44dcf9['query']);_0x28163f[_0xd298('0x3c')]=_[_0xd298('0x39')](_0x44dcf9[_0xd298('0x3a')],qs[_0xd298('0x3b')](_0x889c4b[_0xd298('0x37')][_0xd298('0x3b')]));_0x28163f[_0xd298('0x3c')]=_0x28163f[_0xd298('0x3c')][_0xd298('0x4d')]?_0x28163f[_0xd298('0x3c')]:_0x44dcf9[_0xd298('0x3a')];if(_0x889c4b[_0xd298('0x37')]['includeAll']){_0x28163f[_0xd298('0x46')]=[{'all':!![]}];}_0x28163f=_[_0xd298('0x42')]({},_0x28163f,_0x889c4b[_0xd298('0x44')]);return db[_0xd298('0x34')][_0xd298('0x4e')](_0x28163f)['then'](handleEntityNotFound(_0x32cc01,null))[_0xd298('0x2b')](respondWithResult(_0x32cc01,null))[_0xd298('0x49')](handleError(_0x32cc01,null));};exports[_0xd298('0x4f')]=function(_0x159e47,_0x40c3d4,_0x16b909){return db[_0xd298('0x34')][_0xd298('0x4e')]({'where':{'id':_0x159e47['params']['id']},'attributes':[_0xd298('0x30'),_0xd298('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x40c3d4,null))[_0xd298('0x2b')](function(_0x2abefa){if(_0x2abefa){var _0x41983e=path[_0xd298('0x51')](config[_0xd298('0x52')],'server/files/plugins',util[_0xd298('0x53')]('%s.zip',path[_0xd298('0x54')](_0x2abefa[_0xd298('0x50')])));var _0x5e7912=fs[_0xd298('0x55')](_0x41983e);var _0x132411=archiver(_0xd298('0x56'),{'zlib':{'level':0x9}});_0x132411['on'](_0xd298('0x57'),function(_0x253c2e){if(_0x253c2e['code']===_0xd298('0x58')){logger[_0xd298('0x59')](_0x253c2e);}else{throw new db[(_0xd298('0x5a'))][(_0xd298('0x5b'))](_0xd298('0x5c'));}});_0x132411['on'](_0xd298('0x59'),function(_0x1e1d40){throw new db['Sequelize']['Error'](_0xd298('0x5c'));});_0x132411[_0xd298('0x5d')](_0x5e7912);_0x132411[_0xd298('0x5e')](_0xd298('0x5f'),{'cwd':path['join'](config[_0xd298('0x52')],_0xd298('0x60'),path['dirname'](_0x2abefa['path'])),'ignore':[path['join'](path[_0xd298('0x54')](_0x2abefa[_0xd298('0x50')]),_0xd298('0x61')),path[_0xd298('0x51')](path[_0xd298('0x54')](_0x2abefa[_0xd298('0x50')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x5e7912['on'](_0xd298('0x62'),function(){if(!fs['existsSync'](_0x41983e)){throw new db[(_0xd298('0x5a'))][(_0xd298('0x5b'))](_0xd298('0x63'));}return _0x40c3d4[_0xd298('0x4f')](_0x41983e,util['format'](_0xd298('0x64'),path[_0xd298('0x54')](_0x2abefa[_0xd298('0x50')])),function(_0x36d93b){if(_0x36d93b){throw new db['Sequelize']['Error'](_0xd298('0x65'));}fs[_0xd298('0x66')](_0x41983e);logger['info']('Download\x20completed');logger[_0xd298('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xd298('0x49')](handleError(_0x40c3d4,null));};exports[_0xd298('0x68')]=function(_0x35f2ea,_0x7f737c,_0x26bec4){var _0x4b2376=path[_0xd298('0x54')](_0x35f2ea[_0xd298('0x69')][_0xd298('0x6a')],path[_0xd298('0x6b')](_0x35f2ea[_0xd298('0x69')][_0xd298('0x6a')]));var _0x444a88=path['join'](config[_0xd298('0x52')],'server/files/plugins',_0x35f2ea['file'][_0xd298('0x6a')]);var _0x2f0269=path[_0xd298('0x51')](config[_0xd298('0x52')],_0xd298('0x60'),_0x4b2376);logger[_0xd298('0x67')](_0xd298('0x6c'),_0x444a88);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x2f0269);try{fs[_0xd298('0x6d')](_0x444a88,parseInt(_0xd298('0x6e'),0x8));extract(_0x444a88,{'dir':_0x2f0269},function(_0x34473f){if(_0x34473f){logger[_0xd298('0x59')](_0x34473f);handleError(_0x34473f,!![]);};var _0x3ee978=fs['readdirSync'](_0x2f0269);if(_0x3ee978[_0xd298('0x4d')]>0x1){removeReferences(_0x444a88,_0x2f0269);logger[_0xd298('0x59')]('Invalid\x20plugin\x20structure');return _0x26bec4(new Error('Invalid\x20plugin\x20structure'));}var _0x598f36=fs[_0xd298('0x6f')](path[_0xd298('0x51')](_0x2f0269,_0x3ee978[0x0]));if(_0x598f36[_0xd298('0x70')]()){removeReferences(_0x444a88,_0x2f0269);logger['error'](_0xd298('0x71'));return _0x26bec4(new Error('Invalid\x20plugin\x20structure'));}if(_0x598f36[_0xd298('0x72')]()){var _0x298560=fs[_0xd298('0x73')](path[_0xd298('0x51')](_0x2f0269,_0x3ee978[0x0]));if(_0x298560['length']===0x0){removeReferences(_0x444a88,_0x2f0269);logger[_0xd298('0x59')](_0xd298('0x71'));return _0x26bec4(new Error(_0xd298('0x71')));}var _0x387790=_0x298560['some'](function(_0x4374ec){return _0x4374ec===_0xd298('0x74');});if(!_0x387790){return _0x26bec4(new Error(_0xd298('0x75')));}var _0x3c64de=fs[_0xd298('0x76')](path[_0xd298('0x51')](_0x2f0269,_0x3ee978[0x0],'manifest.json'));var _0xfced42=JSON['parse'](_0x3c64de);if(_0xd298('0x24')==typeof _0xfced42[_0xd298('0x30')]){return _0x26bec4(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xd298('0x24')==typeof _0xfced42[_0xd298('0x36')]){return _0x26bec4(new Error(_0xd298('0x77')));}if('undefined'==typeof _0xfced42['version']){return _0x26bec4(new Error(_0xd298('0x78')));}if(_0xd298('0x24')==typeof _0xfced42['parameters']){return _0x26bec4(new Error(_0xd298('0x79')));}if(_0xfced42[_0xd298('0x36')]===_0xd298('0x7a')){if('undefined'==typeof _0xfced42['parameters'][_0xd298('0x7b')]){return _0x26bec4(new Error(_0xd298('0x7c')));}if('undefined'==typeof _0xfced42['parameters'][_0xd298('0x7b')][_0xd298('0x7d')]&&_0xd298('0x24')==typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x7b')]['agent']){return _0x26bec4(new Error(_0xd298('0x7f')));}}else if(_0xfced42['type']===_0xd298('0x80')){if(_0xd298('0x24')==typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x81')]){return _0x26bec4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xd298('0x24')==typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x82')]){return _0x26bec4(new Error(_0xd298('0x83')));}}else{return _0x26bec4(new Error(_0xd298('0x84')));}var _0x234bcd=_0xfced42[_0xd298('0x30')];var _0x4369c9=_0xfced42[_0xd298('0x85')];var _0x4b28a3=_0xfced42['type'];var _0x2b7a3a=_0xfced42[_0xd298('0x86')]?_0xfced42[_0xd298('0x86')]:'always';var _0x19c957=_0xfced42[_0xd298('0x87')]?_0xfced42['icon']:_0xd298('0x88');var _0x3dd1e9='';var _0xdc32b='';var _0x5b30d3='';var _0x1e0ef2='';var _0x36c8e1=_0xfced42[_0xd298('0x89')];if(_0x4b28a3==='html'){if('undefined'!=typeof _0xfced42['parameters'][_0xd298('0x7b')][_0xd298('0x7d')]){var _0x28b157=_0xfced42[_0xd298('0x7e')][_0xd298('0x7b')][_0xd298('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x28b157)){_0x3dd1e9=path[_0xd298('0x51')](_0xd298('0x8a'),_0x4b2376,_0x3ee978[0x0],_0x28b157);}else{_0x3dd1e9=_0x28b157;}}else{logger[_0xd298('0x67')](_0xd298('0x8b'));}if(_0xd298('0x24')!=typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x7b')][_0xd298('0x8c')]){var _0x2131ee=_0xfced42['parameters']['views'][_0xd298('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0xd298('0x8d')](_0x2131ee)){_0xdc32b=path[_0xd298('0x51')](_0xd298('0x8a'),_0x4b2376,_0x3ee978[0x0],_0x2131ee);}else{_0xdc32b=_0x2131ee;}}else{logger[_0xd298('0x67')](_0xd298('0x8e'));}}else if(_0x4b28a3===_0xd298('0x80')){_0x5b30d3=_0xfced42[_0xd298('0x7e')][_0xd298('0x81')];_0x1e0ef2=_0xfced42[_0xd298('0x7e')]['scriptPath'];if('undefined'!=typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x7b')]){if(_0xd298('0x24')!=typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x7b')][_0xd298('0x7d')]){var _0x28b157=_0xfced42['parameters'][_0xd298('0x7b')][_0xd298('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x28b157)){_0x3dd1e9=path['join'](_0xd298('0x8a'),_0x4b2376,_0x3ee978[0x0],_0x28b157);}else{_0x3dd1e9=_0x28b157;}}if('undefined'!=typeof _0xfced42[_0xd298('0x7e')][_0xd298('0x7b')][_0xd298('0x8c')]){var _0x2131ee=_0xfced42[_0xd298('0x7e')]['views'][_0xd298('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2131ee)){_0xdc32b=path[_0xd298('0x51')](_0xd298('0x8a'),_0x4b2376,_0x3ee978[0x0],_0x2131ee);}else{_0xdc32b=_0x2131ee;}}}}var _0x533dba={'name':_0x234bcd,'description':_0x4369c9,'path':path[_0xd298('0x51')](_0x4b2376,_0x3ee978[0x0]),'type':_0x4b28a3,'sidebar':_0x2b7a3a,'icon':_0x19c957,'adminUrl':_0x3dd1e9,'agentUrl':_0xdc32b,'scriptName':_0x5b30d3,'scriptPath':_0x1e0ef2,'version':_0x36c8e1};removeReferences(_0x444a88,null);return db[_0xd298('0x34')][_0xd298('0x8f')](_0x533dba)[_0xd298('0x2b')](function(_0x2b076d){var _0x2a534e={'role':_0x35f2ea['body'][_0xd298('0x90')],'userProfileId':_0x35f2ea[_0xd298('0x91')][_0xd298('0x92')]};if(!_0x2a534e)throw new Error(_0xd298('0x93'));if(_0x2a534e[_0xd298('0x90')]===_0xd298('0x94')){var _0x5eb0f3=_0x2b076d[_0xd298('0x2d')]({'plain':!![]});return db[_0xd298('0x95')]['find']({'where':{'name':_0xd298('0x2e'),'userProfileId':_0x2a534e[_0xd298('0x92')]},'raw':!![]})[_0xd298('0x2b')](function(_0x2afe6c){if(_0x2afe6c&&_0x2afe6c[_0xd298('0x96')]===0x0){return db['UserProfileResource'][_0xd298('0x8f')]({'name':_0x5eb0f3[_0xd298('0x30')],'resourceId':_0x5eb0f3['id'],'type':_0x2afe6c[_0xd298('0x30')],'sectionId':_0x2afe6c['id']},{})[_0xd298('0x2b')](function(){return _0x2b076d;});}else{return _0x2b076d;}})['catch'](function(_0x499237){logger[_0xd298('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x499237);throw _0x499237;});}return _0x2b076d;})[_0xd298('0x2b')](respondWithResult(_0x7f737c,null))['catch'](handleError(_0x7f737c,null));}});}catch(_0x2b96f1){_0x7f737c[_0xd298('0x20')](0x1f4)[_0xd298('0x31')](_0x2b96f1);}};function removeReferences(_0x45abc2,_0x1ad7f8){try{if(_0x45abc2){fs[_0xd298('0x66')](_0x45abc2);logger[_0xd298('0x67')](_0xd298('0x97'));}if(_0x1ad7f8){rimraf(_0x1ad7f8,function(){});logger[_0xd298('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x219ceb){logger['error'](_0x219ceb);}}exports[_0xd298('0x98')]=function(_0x3956de,_0x58b50d,_0x3e4f2b){return db[_0xd298('0x34')][_0xd298('0x4e')]({'where':{'id':_0x3956de[_0xd298('0x4b')]['id']}})[_0xd298('0x2b')](handleEntityNotFound(_0x58b50d,null))['then'](saveUpdates(_0x3956de['body'],null))[_0xd298('0x2b')](respondWithResult(_0x58b50d,null))[_0xd298('0x49')](handleError(_0x58b50d,null));};exports[_0xd298('0x99')]=function(_0x2c5d30,_0x3d4892,_0x466e32){return db[_0xd298('0x34')]['find']({'where':{'id':_0x2c5d30[_0xd298('0x4b')]['id']}})[_0xd298('0x2b')](function(_0x4b7a67){if(_0x4b7a67){return _0x4b7a67[_0xd298('0x2c')]();}})['then'](function(_0x4421a2){rimraf(path['join'](config[_0xd298('0x52')],_0xd298('0x60'),path[_0xd298('0x9a')](_0x4421a2[_0xd298('0x50')])),function(){});return _0x4421a2;})[_0xd298('0x2b')](handleEntityNotFound(_0x3d4892,null))[_0xd298('0x2b')](respondWithStatusCode(_0x3d4892,null))['catch'](handleError(_0x3d4892,null));};exports[_0xd298('0x9b')]=function(_0x389f5b,_0x11a9d2,_0x54c2c3){return BPromise['resolve']()[_0xd298('0x2b')](function(){if(!_0x389f5b[_0xd298('0x37')][_0xd298('0x50')]){throw new Error(_0xd298('0x9c'));}if(!_0x389f5b[_0xd298('0x37')][_0xd298('0x9d')]){throw new Error(_0xd298('0x9e'));}var _0x3330cd=_0x389f5b['query'][_0xd298('0x9f')]?_0x389f5b['query'][_0xd298('0x9f')]+':'+_0x389f5b[_0xd298('0x37')][_0xd298('0x9d')]:_0xd298('0xa0')+_0x389f5b[_0xd298('0x37')]['port'];var _0x458a2b=_0x389f5b[_0xd298('0x37')][_0xd298('0x22')]?_0x389f5b[_0xd298('0x37')][_0xd298('0x22')]:!![];var _0x54bc68=_0x389f5b[_0xd298('0x37')][_0xd298('0xa1')]?_0x389f5b[_0xd298('0x37')][_0xd298('0xa1')]:null;var _0x46abb5={'method':_0x389f5b[_0xd298('0xa2')],'uri':util[_0xd298('0x53')](_0xd298('0xa3'),_0x3330cd,_0x389f5b[_0xd298('0x37')][_0xd298('0x50')]),'json':_0x458a2b,'resolveWithFullResponse':!![],'encoding':_0x54bc68,'qs':_0x389f5b[_0xd298('0x37')]};if(_0x389f5b[_0xd298('0xa4')]){_0x46abb5[_0xd298('0xa4')]=_0x389f5b[_0xd298('0xa4')];if(_0x46abb5[_0xd298('0xa4')][_0xd298('0xa5')]){delete _0x46abb5['headers'][_0xd298('0xa5')];}}if(_0x46abb5[_0xd298('0xa4')]['content-type']){delete _0x46abb5[_0xd298('0xa4')]['content-type'];}return rp(_0x46abb5);})[_0xd298('0x2b')](function(_0x3d31d2){if(_0x3d31d2){_0x11a9d2['set'](_0x3d31d2[_0xd298('0xa4')]);logger[_0xd298('0x67')](_0x3d31d2['body']);if(_[_0xd298('0xa6')](_0x389f5b['query'][_0xd298('0x50')],_0xd298('0x4f'))&&_0x3d31d2['statusCode']==0x1f4){return _0x11a9d2[_0xd298('0x1f')](_0x3d31d2['statusCode']);}else{return _0x11a9d2['status'](_0x3d31d2[_0xd298('0xa7')])['send'](_0x3d31d2[_0xd298('0x91')]);}}else{return _0x11a9d2['sendStatus'](0xc8);}})[_0xd298('0x49')](handleError(_0x11a9d2,null));};exports[_0xd298('0xa8')]=function(_0x42d1e5,_0x22309c,_0x503ec9){return BPromise[_0xd298('0xa9')]()[_0xd298('0x2b')](function(){if(!_0x42d1e5[_0xd298('0x37')][_0xd298('0x50')]){throw new Error(_0xd298('0x9c'));}if(!_0x42d1e5[_0xd298('0x37')][_0xd298('0x9d')]){throw new Error(_0xd298('0x9e'));}var _0x3a9ec9=_0x42d1e5['query'][_0xd298('0x9f')]?_0x42d1e5['query'][_0xd298('0x9f')]+':'+_0x42d1e5[_0xd298('0x37')][_0xd298('0x9d')]:'http://localhost:'+_0x42d1e5[_0xd298('0x37')][_0xd298('0x9d')];var _0x8bdf2d=_0x42d1e5[_0xd298('0x37')]['json']?_0x42d1e5[_0xd298('0x37')][_0xd298('0x22')]:!![];var _0x226f70=_0x42d1e5[_0xd298('0x37')][_0xd298('0xa1')]?_0x42d1e5['query'][_0xd298('0xa1')]:null;var _0x1efd01={'method':_0x42d1e5[_0xd298('0xa2')],'uri':util[_0xd298('0x53')](_0xd298('0xa3'),_0x3a9ec9,_0x42d1e5[_0xd298('0x37')]['path']),'json':_0x8bdf2d,'resolveWithFullResponse':!![],'encoding':_0x226f70,'body':_0x42d1e5['body']};if(_0x42d1e5['headers']){_0x1efd01[_0xd298('0xa4')]=_0x42d1e5[_0xd298('0xa4')];if(_0x1efd01[_0xd298('0xa4')][_0xd298('0xa5')]){delete _0x1efd01[_0xd298('0xa4')][_0xd298('0xa5')];}}if(_0x1efd01[_0xd298('0xa4')][_0xd298('0xaa')]){delete _0x1efd01[_0xd298('0xa4')][_0xd298('0xaa')];}return rp(_0x1efd01);})[_0xd298('0x2b')](function(_0x5cce7c){if(_0x5cce7c){_0x22309c['set'](_0x5cce7c['headers']);logger[_0xd298('0x67')](_0x5cce7c['body']);return _0x22309c['status'](_0x5cce7c['statusCode'])[_0xd298('0x31')](_0x5cce7c[_0xd298('0x91')]);}else{return _0x22309c['sendStatus'](0xc8);}})[_0xd298('0x49')](handleError(_0x22309c,null));}; \ No newline at end of file +var _0x837d=['icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','destroy','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','method','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','rimraf','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','Plugins','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','Plugin','includeAll','include','findAll','rows','show','params','length','find','catch','download','join','root','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x837d,0x17e));var _0xd837=function(_0x529fc0,_0x33f8f7){_0x529fc0=_0x529fc0-0x0;var _0x34df48=_0x837d[_0x529fc0];return _0x34df48;};'use strict';var emlformat=require(_0xd837('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd837('0x1'));var rp=require('request-promise');var moment=require(_0xd837('0x2'));var BPromise=require(_0xd837('0x3'));var Mustache=require(_0xd837('0x4'));var util=require('util');var path=require(_0xd837('0x5'));var sox=require(_0xd837('0x6'));var csv=require(_0xd837('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd837('0x8'));var _=require(_0xd837('0x9'));var squel=require('squel');var crypto=require(_0xd837('0xa'));var jsforce=require(_0xd837('0xb'));var deskjs=require(_0xd837('0xc'));var toCsv=require(_0xd837('0x7'));var querystring=require(_0xd837('0xd'));var Papa=require(_0xd837('0xe'));var extract=require('extract-zip');var rimraf=require(_0xd837('0xf'));var archiver=require(_0xd837('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd837('0x11'));var as=require(_0xd837('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd837('0x13'))(_0xd837('0x14'));var utils=require(_0xd837('0x15'));var config=require(_0xd837('0x16'));var licenseUtil=require(_0xd837('0x17'));var db=require(_0xd837('0x18'))['db'];config[_0xd837('0x19')]=_[_0xd837('0x1a')](config[_0xd837('0x19')],{'host':_0xd837('0x1b'),'port':0x18eb});var socket=require(_0xd837('0x1c'))(new Redis(config[_0xd837('0x19')]));require(_0xd837('0x1d'))['register'](socket);function respondWithStatusCode(_0x4bbf85,_0x1e712c){_0x1e712c=_0x1e712c||0xcc;return function(_0x4c293b){if(_0x4c293b){return _0x4bbf85['sendStatus'](_0x1e712c);}return _0x4bbf85['status'](_0x1e712c)[_0xd837('0x1e')]();};}function respondWithResult(_0x58f710,_0x1e58a1){_0x1e58a1=_0x1e58a1||0xc8;return function(_0x5d5e69){if(_0x5d5e69){return _0x58f710[_0xd837('0x1f')](_0x1e58a1)[_0xd837('0x20')](_0x5d5e69);}};}function respondWithFilteredResult(_0x5edcbc,_0x3872d1){return function(_0x39007a){if(_0x39007a){var _0x160c6b=typeof _0x3872d1[_0xd837('0x21')]===_0xd837('0x22')&&typeof _0x3872d1[_0xd837('0x23')]==='undefined';var _0xb780a7=_0x39007a[_0xd837('0x24')];var _0x364961=_0x160c6b?0x0:_0x3872d1[_0xd837('0x21')];var _0x1eeff9=_0x160c6b?_0x39007a[_0xd837('0x24')]:_0x3872d1[_0xd837('0x21')]+_0x3872d1[_0xd837('0x23')];var _0x1a8c4a;if(_0x1eeff9>=_0xb780a7){_0x1eeff9=_0xb780a7;_0x1a8c4a=0xc8;}else{_0x1a8c4a=0xce;}_0x5edcbc[_0xd837('0x1f')](_0x1a8c4a);return _0x5edcbc['set'](_0xd837('0x25'),_0x364961+'-'+_0x1eeff9+'/'+_0xb780a7)[_0xd837('0x20')](_0x39007a);}return null;};}function patchUpdates(_0x2567a9){return function(_0x127e8f){try{jsonpatch[_0xd837('0x26')](_0x127e8f,_0x2567a9,!![]);}catch(_0x4881b3){return BPromise[_0xd837('0x27')](_0x4881b3);}return _0x127e8f[_0xd837('0x28')]();};}function saveUpdates(_0x52d804,_0xe0ca93){return function(_0x14860d){if(_0x14860d){return _0x14860d[_0xd837('0x29')](_0x52d804)[_0xd837('0x2a')](function(_0x264823){return _0x264823;});}return null;};}function removeEntity(_0x84b874,_0x49c725){return function(_0x578f9a){if(_0x578f9a){return _0x578f9a['destroy']()['then'](function(){var _0x1fb0b0=_0x578f9a[_0xd837('0x2b')]({'plain':!![]});var _0x43cd5a=_0xd837('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x43cd5a,'resourceId':_0x1fb0b0['id']}})[_0xd837('0x2a')](function(){return _0x578f9a;});})[_0xd837('0x2a')](function(){_0x84b874[_0xd837('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e802f,_0x3e8185){return function(_0x5dace8){if(!_0x5dace8){_0x5e802f[_0xd837('0x2d')](0x194);}return _0x5dace8;};}function handleError(_0x3c20ca,_0x15ccd6){_0x15ccd6=_0x15ccd6||0x1f4;return function(_0x5dc2f2){logger[_0xd837('0x2e')](_0x5dc2f2[_0xd837('0x2f')]);if(_0x5dc2f2[_0xd837('0x30')]){delete _0x5dc2f2[_0xd837('0x30')];}_0x3c20ca[_0xd837('0x1f')](_0x15ccd6)[_0xd837('0x31')](_0x5dc2f2);};}exports[_0xd837('0x32')]=function(_0xd20853,_0x5959f6){var _0x566eed={},_0x474835={},_0x49ad40={'count':0x0,'rows':[]};var _0x1256b3=_[_0xd837('0x33')](db['Plugin'][_0xd837('0x34')],function(_0x42929d){return{'name':_0x42929d[_0xd837('0x35')],'type':_0x42929d[_0xd837('0x36')][_0xd837('0x37')]};});_0x474835['model']=_[_0xd837('0x33')](_0x1256b3,_0xd837('0x30'));_0x474835[_0xd837('0x38')]=_['keys'](_0xd20853[_0xd837('0x38')]);_0x474835[_0xd837('0x39')]=_['intersection'](_0x474835[_0xd837('0x3a')],_0x474835[_0xd837('0x38')]);_0x566eed['attributes']=_[_0xd837('0x3b')](_0x474835[_0xd837('0x3a')],qs[_0xd837('0x3c')](_0xd20853[_0xd837('0x38')]['fields']));_0x566eed['attributes']=_0x566eed['attributes']['length']?_0x566eed[_0xd837('0x3d')]:_0x474835[_0xd837('0x3a')];if(!_0xd20853['query'][_0xd837('0x3e')]('nolimit')){_0x566eed[_0xd837('0x23')]=qs[_0xd837('0x23')](_0xd20853['query'][_0xd837('0x23')]);_0x566eed[_0xd837('0x21')]=qs[_0xd837('0x21')](_0xd20853[_0xd837('0x38')][_0xd837('0x21')]);}_0x566eed['order']=qs['sort'](_0xd20853[_0xd837('0x38')][_0xd837('0x3f')]);_0x566eed[_0xd837('0x40')]=qs[_0xd837('0x39')](_['pick'](_0xd20853[_0xd837('0x38')],_0x474835['filters']),_0x1256b3);if(_0xd20853[_0xd837('0x38')]['filter']){_0x566eed[_0xd837('0x40')]=_[_0xd837('0x41')](_0x566eed[_0xd837('0x40')],{'$or':_['map'](_0x1256b3,function(_0x2ac492){if(_0x2ac492[_0xd837('0x36')]!==_0xd837('0x42')){var _0x40c8fc={};_0x40c8fc[_0x2ac492[_0xd837('0x30')]]={'$like':'%'+_0xd20853[_0xd837('0x38')]['filter']+'%'};return _0x40c8fc;}})});}_0x566eed=_[_0xd837('0x41')]({},_0x566eed,_0xd20853['options']);var _0x1adf03={'where':_0x566eed['where']};return db[_0xd837('0x43')]['count'](_0x1adf03)[_0xd837('0x2a')](function(_0x22a800){_0x49ad40['count']=_0x22a800;if(_0xd20853[_0xd837('0x38')][_0xd837('0x44')]){_0x566eed[_0xd837('0x45')]=[{'all':!![]}];}return db[_0xd837('0x43')][_0xd837('0x46')](_0x566eed);})[_0xd837('0x2a')](function(_0x1d5f17){_0x49ad40[_0xd837('0x47')]=_0x1d5f17;return _0x49ad40;})['then'](respondWithFilteredResult(_0x5959f6,_0x566eed))['catch'](handleError(_0x5959f6,null));};exports[_0xd837('0x48')]=function(_0x19da06,_0x5b53a5){var _0x9508b0={'raw':!![],'where':{'id':_0x19da06[_0xd837('0x49')]['id']}},_0x23855e={};_0x23855e[_0xd837('0x3a')]=_['keys'](db[_0xd837('0x43')][_0xd837('0x34')]);_0x23855e[_0xd837('0x38')]=_['keys'](_0x19da06[_0xd837('0x38')]);_0x23855e['filters']=_[_0xd837('0x3b')](_0x23855e[_0xd837('0x3a')],_0x23855e[_0xd837('0x38')]);_0x9508b0['attributes']=_[_0xd837('0x3b')](_0x23855e[_0xd837('0x3a')],qs['fields'](_0x19da06[_0xd837('0x38')][_0xd837('0x3c')]));_0x9508b0[_0xd837('0x3d')]=_0x9508b0[_0xd837('0x3d')][_0xd837('0x4a')]?_0x9508b0['attributes']:_0x23855e[_0xd837('0x3a')];if(_0x19da06[_0xd837('0x38')][_0xd837('0x44')]){_0x9508b0['include']=[{'all':!![]}];}_0x9508b0=_[_0xd837('0x41')]({},_0x9508b0,_0x19da06['options']);return db[_0xd837('0x43')][_0xd837('0x4b')](_0x9508b0)[_0xd837('0x2a')](handleEntityNotFound(_0x5b53a5,null))[_0xd837('0x2a')](respondWithResult(_0x5b53a5,null))[_0xd837('0x4c')](handleError(_0x5b53a5,null));};exports[_0xd837('0x4d')]=function(_0x30eca5,_0x256db0,_0x4fb9a1){return db['Plugin'][_0xd837('0x4b')]({'where':{'id':_0x30eca5[_0xd837('0x49')]['id']},'attributes':[_0xd837('0x30'),_0xd837('0x5')],'raw':!![]})[_0xd837('0x2a')](handleEntityNotFound(_0x256db0,null))[_0xd837('0x2a')](function(_0x1b9a0e){if(_0x1b9a0e){var _0x1f499c=path[_0xd837('0x4e')](config[_0xd837('0x4f')],'server/files/plugins',util[_0xd837('0x50')](_0xd837('0x51'),path[_0xd837('0x52')](_0x1b9a0e[_0xd837('0x5')])));var _0x5f166b=fs[_0xd837('0x53')](_0x1f499c);var _0x5d9afc=archiver(_0xd837('0x54'),{'zlib':{'level':0x9}});_0x5d9afc['on']('warning',function(_0x52a156){if(_0x52a156[_0xd837('0x55')]===_0xd837('0x56')){logger['error'](_0x52a156);}else{throw new db[(_0xd837('0x57'))]['Error'](_0xd837('0x58'));}});_0x5d9afc['on'](_0xd837('0x2e'),function(_0x25b483){throw new db[(_0xd837('0x57'))][(_0xd837('0x59'))](_0xd837('0x58'));});_0x5d9afc[_0xd837('0x5a')](_0x5f166b);_0x5d9afc[_0xd837('0x5b')](_0xd837('0x5c'),{'cwd':path['join'](config['root'],_0xd837('0x5d'),path[_0xd837('0x5e')](_0x1b9a0e['path'])),'ignore':[path['join'](path[_0xd837('0x52')](_0x1b9a0e['path']),_0xd837('0x5f')),path[_0xd837('0x4e')](path[_0xd837('0x52')](_0x1b9a0e[_0xd837('0x5')]),_0xd837('0x60'))],'nodir':!![]})['finalize']();_0x5f166b['on'](_0xd837('0x61'),function(){if(!fs[_0xd837('0x62')](_0x1f499c)){throw new db[(_0xd837('0x57'))]['Error'](_0xd837('0x63'));}return _0x256db0[_0xd837('0x4d')](_0x1f499c,util['format'](_0xd837('0x51'),path[_0xd837('0x52')](_0x1b9a0e[_0xd837('0x5')])),function(_0x4d4b1e){if(_0x4d4b1e){throw new db[(_0xd837('0x57'))][(_0xd837('0x59'))](_0xd837('0x64'));}fs[_0xd837('0x65')](_0x1f499c);logger[_0xd837('0x66')](_0xd837('0x67'));logger[_0xd837('0x66')](_0xd837('0x68'));});});}return null;})[_0xd837('0x4c')](handleError(_0x256db0,null));};exports[_0xd837('0x69')]=function(_0x16dd18,_0x3f0979,_0x35c320){var _0x343927=path[_0xd837('0x52')](_0x16dd18[_0xd837('0x6a')]['filename'],path[_0xd837('0x6b')](_0x16dd18[_0xd837('0x6a')][_0xd837('0x6c')]));var _0x59879b=path[_0xd837('0x4e')](config[_0xd837('0x4f')],_0xd837('0x5d'),_0x16dd18[_0xd837('0x6a')][_0xd837('0x6c')]);var _0x3804c6=path[_0xd837('0x4e')](config[_0xd837('0x4f')],_0xd837('0x5d'),_0x343927);logger[_0xd837('0x66')](_0xd837('0x6d'),_0x59879b);logger[_0xd837('0x66')](_0xd837('0x6e'),_0x3804c6);try{fs[_0xd837('0x6f')](_0x59879b,parseInt('0777',0x8));extract(_0x59879b,{'dir':_0x3804c6},function(_0x4df629){if(_0x4df629){logger[_0xd837('0x2e')](_0x4df629);handleError(_0x4df629,!![]);};var _0x210863=fs['readdirSync'](_0x3804c6);if(_0x210863['length']>0x1){removeReferences(_0x59879b,_0x3804c6);logger[_0xd837('0x2e')](_0xd837('0x70'));return _0x35c320(new Error('Invalid\x20plugin\x20structure'));}var _0x5c7b8b=fs[_0xd837('0x71')](path[_0xd837('0x4e')](_0x3804c6,_0x210863[0x0]));if(_0x5c7b8b[_0xd837('0x72')]()){removeReferences(_0x59879b,_0x3804c6);logger['error'](_0xd837('0x70'));return _0x35c320(new Error(_0xd837('0x70')));}if(_0x5c7b8b['isDirectory']()){var _0x4d45b1=fs[_0xd837('0x73')](path[_0xd837('0x4e')](_0x3804c6,_0x210863[0x0]));if(_0x4d45b1['length']===0x0){removeReferences(_0x59879b,_0x3804c6);logger[_0xd837('0x2e')]('Invalid\x20plugin\x20structure');return _0x35c320(new Error(_0xd837('0x70')));}var _0x4bf334=_0x4d45b1[_0xd837('0x74')](function(_0x494e11){return _0x494e11===_0xd837('0x75');});if(!_0x4bf334){return _0x35c320(new Error(_0xd837('0x76')));}var _0x397d33=fs[_0xd837('0x77')](path['join'](_0x3804c6,_0x210863[0x0],_0xd837('0x75')));var _0x4268e1=JSON['parse'](_0x397d33);if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x30')]){return _0x35c320(new Error(_0xd837('0x78')));}if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x36')]){return _0x35c320(new Error(_0xd837('0x79')));}if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7a')]){return _0x35c320(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')]){return _0x35c320(new Error(_0xd837('0x7c')));}if(_0x4268e1[_0xd837('0x36')]===_0xd837('0x7d')){if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')]['views']){return _0x35c320(new Error(_0xd837('0x7e')));}if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x80')]&&_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x81')]){return _0x35c320(new Error(_0xd837('0x82')));}}else if(_0x4268e1['type']===_0xd837('0x83')){if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x84')]){return _0x35c320(new Error(_0xd837('0x85')));}if(_0xd837('0x22')==typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x86')]){return _0x35c320(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x35c320(new Error(_0xd837('0x87')));}var _0xdd2992=_0x4268e1[_0xd837('0x30')];var _0x5a8b87=_0x4268e1[_0xd837('0x88')];var _0x7818d3=_0x4268e1[_0xd837('0x36')];var _0x59cac5=_0x4268e1[_0xd837('0x89')]?_0x4268e1['sidebar']:_0xd837('0x8a');var _0x22af42=_0x4268e1[_0xd837('0x8b')]?_0x4268e1['icon']:_0xd837('0x8c');var _0x39427c='';var _0x23c679='';var _0x2979c6='';var _0xaf7255='';var _0x327180=_0x4268e1[_0xd837('0x7a')];if(_0x7818d3===_0xd837('0x7d')){if('undefined'!=typeof _0x4268e1[_0xd837('0x7b')]['views'][_0xd837('0x80')]){var _0x1f04ed=_0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd837('0x8d')](_0x1f04ed)){_0x39427c=path['join'](_0xd837('0x8e'),_0x343927,_0x210863[0x0],_0x1f04ed);}else{_0x39427c=_0x1f04ed;}}else{logger[_0xd837('0x66')](_0xd837('0x8f'));}if(_0xd837('0x22')!=typeof _0x4268e1['parameters'][_0xd837('0x7f')][_0xd837('0x81')]){var _0x23f1e8=_0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xd837('0x8d')](_0x23f1e8)){_0x23c679=path['join'](_0xd837('0x8e'),_0x343927,_0x210863[0x0],_0x23f1e8);}else{_0x23c679=_0x23f1e8;}}else{logger[_0xd837('0x66')](_0xd837('0x90'));}}else if(_0x7818d3===_0xd837('0x83')){_0x2979c6=_0x4268e1[_0xd837('0x7b')][_0xd837('0x84')];_0xaf7255=_0x4268e1[_0xd837('0x7b')][_0xd837('0x86')];if(_0xd837('0x22')!=typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')]){if(_0xd837('0x22')!=typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x80')]){var _0x1f04ed=_0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xd837('0x8d')](_0x1f04ed)){_0x39427c=path[_0xd837('0x4e')](_0xd837('0x8e'),_0x343927,_0x210863[0x0],_0x1f04ed);}else{_0x39427c=_0x1f04ed;}}if('undefined'!=typeof _0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x81')]){var _0x23f1e8=_0x4268e1[_0xd837('0x7b')][_0xd837('0x7f')][_0xd837('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xd837('0x8d')](_0x23f1e8)){_0x23c679=path['join'](_0xd837('0x8e'),_0x343927,_0x210863[0x0],_0x23f1e8);}else{_0x23c679=_0x23f1e8;}}}}var _0x15f0e1={'name':_0xdd2992,'description':_0x5a8b87,'path':path[_0xd837('0x4e')](_0x343927,_0x210863[0x0]),'type':_0x7818d3,'sidebar':_0x59cac5,'icon':_0x22af42,'adminUrl':_0x39427c,'agentUrl':_0x23c679,'scriptName':_0x2979c6,'scriptPath':_0xaf7255,'version':_0x327180};removeReferences(_0x59879b,null);return db[_0xd837('0x43')][_0xd837('0x91')](_0x15f0e1)[_0xd837('0x2a')](function(_0x2ea8fa){var _0x1719ec={'role':_0x16dd18[_0xd837('0x92')][_0xd837('0x93')],'userProfileId':_0x16dd18[_0xd837('0x92')][_0xd837('0x94')]};if(!_0x1719ec)throw new Error(_0xd837('0x95'));if(_0x1719ec[_0xd837('0x93')]===_0xd837('0x96')){var _0x19800a=_0x2ea8fa[_0xd837('0x2b')]({'plain':!![]});return db[_0xd837('0x97')][_0xd837('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x1719ec[_0xd837('0x94')]},'raw':!![]})[_0xd837('0x2a')](function(_0x4d1abb){if(_0x4d1abb&&_0x4d1abb[_0xd837('0x98')]===0x0){return db['UserProfileResource'][_0xd837('0x91')]({'name':_0x19800a[_0xd837('0x30')],'resourceId':_0x19800a['id'],'type':_0x4d1abb[_0xd837('0x30')],'sectionId':_0x4d1abb['id']},{})['then'](function(){return _0x2ea8fa;});}else{return _0x2ea8fa;}})[_0xd837('0x4c')](function(_0x2daaa1){logger['error'](_0xd837('0x99'),_0x2daaa1);throw _0x2daaa1;});}return _0x2ea8fa;})[_0xd837('0x2a')](respondWithResult(_0x3f0979,null))[_0xd837('0x4c')](handleError(_0x3f0979,null));}});}catch(_0x1c89b1){_0x3f0979[_0xd837('0x1f')](0x1f4)[_0xd837('0x31')](_0x1c89b1);}};function removeReferences(_0x4da76a,_0x4be3f4){try{if(_0x4da76a){fs[_0xd837('0x65')](_0x4da76a);logger[_0xd837('0x66')](_0xd837('0x9a'));}if(_0x4be3f4){rimraf(_0x4be3f4,function(){});logger['info'](_0xd837('0x9b'));}}catch(_0x5bebcd){logger[_0xd837('0x2e')](_0x5bebcd);}}exports[_0xd837('0x29')]=function(_0xf227b6,_0x24e64f,_0x35816d){return db[_0xd837('0x43')][_0xd837('0x4b')]({'where':{'id':_0xf227b6['params']['id']}})[_0xd837('0x2a')](handleEntityNotFound(_0x24e64f,null))['then'](saveUpdates(_0xf227b6[_0xd837('0x92')],null))[_0xd837('0x2a')](respondWithResult(_0x24e64f,null))[_0xd837('0x4c')](handleError(_0x24e64f,null));};exports[_0xd837('0x9c')]=function(_0x187303,_0x4f358a,_0x88cfe6){return db[_0xd837('0x43')][_0xd837('0x4b')]({'where':{'id':_0x187303['params']['id']}})['then'](function(_0x450aaa){if(_0x450aaa){return _0x450aaa[_0xd837('0x9d')]();}})[_0xd837('0x2a')](function(_0x528052){rimraf(path[_0xd837('0x4e')](config['root'],_0xd837('0x5d'),path[_0xd837('0x5e')](_0x528052[_0xd837('0x5')])),function(){});return _0x528052;})[_0xd837('0x2a')](handleEntityNotFound(_0x4f358a,null))[_0xd837('0x2a')](respondWithStatusCode(_0x4f358a,null))[_0xd837('0x4c')](handleError(_0x4f358a,null));};exports[_0xd837('0x9e')]=function(_0x5da1d2,_0x3b85b5,_0x45f524){return BPromise[_0xd837('0x9f')]()[_0xd837('0x2a')](function(){if(!_0x5da1d2[_0xd837('0x38')][_0xd837('0x5')]){throw new Error(_0xd837('0xa0'));}if(!_0x5da1d2[_0xd837('0x38')][_0xd837('0xa1')]){throw new Error(_0xd837('0xa2'));}var _0x2ec885=_0x5da1d2[_0xd837('0x38')][_0xd837('0xa3')]?_0x5da1d2[_0xd837('0x38')][_0xd837('0xa3')]+':'+_0x5da1d2['query'][_0xd837('0xa1')]:'http://localhost:'+_0x5da1d2[_0xd837('0x38')]['port'];var _0x5b12cb=_0x5da1d2[_0xd837('0x38')][_0xd837('0x20')]?_0x5da1d2[_0xd837('0x38')]['json']:!![];var _0x37a754=_0x5da1d2[_0xd837('0x38')][_0xd837('0xa4')]?_0x5da1d2['query'][_0xd837('0xa4')]:null;var _0x2cb708={'method':_0x5da1d2['method'],'uri':util[_0xd837('0x50')](_0xd837('0xa5'),_0x2ec885,_0x5da1d2[_0xd837('0x38')]['path']),'json':_0x5b12cb,'resolveWithFullResponse':!![],'encoding':_0x37a754,'qs':_0x5da1d2['query']};if(_0x5da1d2['headers']){_0x2cb708['headers']=_0x5da1d2[_0xd837('0xa6')];if(_0x2cb708[_0xd837('0xa6')][_0xd837('0xa7')]){delete _0x2cb708[_0xd837('0xa6')][_0xd837('0xa7')];}}if(_0x2cb708[_0xd837('0xa6')][_0xd837('0xa8')]){delete _0x2cb708[_0xd837('0xa6')][_0xd837('0xa8')];}return rp(_0x2cb708);})['then'](function(_0x2dcf69){if(_0x2dcf69){_0x3b85b5[_0xd837('0xa9')](_0x2dcf69[_0xd837('0xa6')]);logger['info'](_0x2dcf69['body']);if(_[_0xd837('0xaa')](_0x5da1d2[_0xd837('0x38')][_0xd837('0x5')],_0xd837('0x4d'))&&_0x2dcf69[_0xd837('0xab')]==0x1f4){return _0x3b85b5['sendStatus'](_0x2dcf69[_0xd837('0xab')]);}else{return _0x3b85b5[_0xd837('0x1f')](_0x2dcf69[_0xd837('0xab')])['send'](_0x2dcf69[_0xd837('0x92')]);}}else{return _0x3b85b5['sendStatus'](0xc8);}})['catch'](handleError(_0x3b85b5,null));};exports[_0xd837('0xac')]=function(_0x482e28,_0x27cfdb,_0x47b17a){return BPromise[_0xd837('0x9f')]()[_0xd837('0x2a')](function(){if(!_0x482e28[_0xd837('0x38')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x482e28[_0xd837('0x38')][_0xd837('0xa1')]){throw new Error(_0xd837('0xa2'));}var _0x33c2b2=_0x482e28['query']['hostname']?_0x482e28[_0xd837('0x38')]['hostname']+':'+_0x482e28[_0xd837('0x38')][_0xd837('0xa1')]:'http://localhost:'+_0x482e28[_0xd837('0x38')][_0xd837('0xa1')];var _0x424dd8=_0x482e28['query']['json']?_0x482e28[_0xd837('0x38')][_0xd837('0x20')]:!![];var _0x233ab0=_0x482e28[_0xd837('0x38')]['encoding']?_0x482e28['query'][_0xd837('0xa4')]:null;var _0x11310a={'method':_0x482e28[_0xd837('0xad')],'uri':util[_0xd837('0x50')](_0xd837('0xa5'),_0x33c2b2,_0x482e28['query'][_0xd837('0x5')]),'json':_0x424dd8,'resolveWithFullResponse':!![],'encoding':_0x233ab0,'body':_0x482e28[_0xd837('0x92')]};if(_0x482e28[_0xd837('0xa6')]){_0x11310a['headers']=_0x482e28['headers'];if(_0x11310a[_0xd837('0xa6')][_0xd837('0xa7')]){delete _0x11310a[_0xd837('0xa6')][_0xd837('0xa7')];}}if(_0x11310a['headers'][_0xd837('0xa8')]){delete _0x11310a[_0xd837('0xa6')][_0xd837('0xa8')];}return rp(_0x11310a);})[_0xd837('0x2a')](function(_0x110419){if(_0x110419){_0x27cfdb[_0xd837('0xa9')](_0x110419['headers']);logger[_0xd837('0x66')](_0x110419['body']);return _0x27cfdb[_0xd837('0x1f')](_0x110419[_0xd837('0xab')])[_0xd837('0x31')](_0x110419[_0xd837('0x92')]);}else{return _0x27cfdb['sendStatus'](0xc8);}})['catch'](handleError(_0x27cfdb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b63250a..0117a40 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 _0x297f=['../../mysqldb','save','update','remove','emit','hasOwnProperty','events'];(function(_0x509803,_0x28fb49){var _0x2c4dd=function(_0x54511f){while(--_0x54511f){_0x509803['push'](_0x509803['shift']());}};_0x2c4dd(++_0x28fb49);}(_0x297f,0x1f0));var _0xf297=function(_0x5b0b4a,_0xb9aacd){_0x5b0b4a=_0x5b0b4a-0x0;var _0x206adc=_0x297f[_0x5b0b4a];return _0x206adc;};'use strict';var EventEmitter=require(_0xf297('0x0'));var Plugin=require(_0xf297('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf297('0x2'),'afterUpdate':_0xf297('0x3'),'afterDestroy':_0xf297('0x4')};function emitEvent(_0x39ec01){return function(_0x586413,_0x462efe,_0x4a736d){PluginEvents[_0xf297('0x5')](_0x39ec01+':'+_0x586413['id'],_0x586413);PluginEvents[_0xf297('0x5')](_0x39ec01,_0x586413);_0x4a736d(null);};}for(var e in events){if(events[_0xf297('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x1f36a5,_0x42653e){_0x1f36a5=_0x1f36a5-0x0;var _0x47899d=_0xe14b[_0x1f36a5];return _0x47899d;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var Plugin=require(_0xbe14('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){PluginEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);PluginEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];Plugin[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('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 40bbdbd..a187ce5 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 _0xb172=['moment','bluebird','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','util','../../config/logger'];(function(_0x2dca8c,_0x223457){var _0x3a2d12=function(_0x16c2b1){while(--_0x16c2b1){_0x2dca8c['push'](_0x2dca8c['shift']());}};_0x3a2d12(++_0x223457);}(_0xb172,0x75));var _0x2b17=function(_0x1be155,_0x3092bb){_0x1be155=_0x1be155-0x0;var _0x24c84e=_0xb172[_0x1be155];return _0x24c84e;};'use strict';var _=require(_0x2b17('0x0'));var util=require(_0x2b17('0x1'));var logger=require(_0x2b17('0x2'))('api');var moment=require(_0x2b17('0x3'));var BPromise=require(_0x2b17('0x4'));var rp=require(_0x2b17('0x5'));var fs=require('fs');var path=require(_0x2b17('0x6'));var rimraf=require(_0x2b17('0x7'));var config=require('../../config/environment');var attributes=require(_0x2b17('0x8'));module[_0x2b17('0x9')]=function(_0x2a44e1,_0x161c81){return _0x2a44e1[_0x2b17('0xa')]('Plugin',attributes,{'tableName':_0x2b17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a99=['./plugin.attributes','Plugin','plugins','lodash','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x4a99,0x1aa));var _0x94a9=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4a99[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x94a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x94a9('0x1'));var moment=require(_0x94a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x94a9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x94a9('0x4'));var config=require(_0x94a9('0x5'));var attributes=require(_0x94a9('0x6'));module['exports']=function(_0x3cad6a,_0x1b86d8){return _0x3cad6a['define'](_0x94a9('0x7'),attributes,{'tableName':_0x94a9('0x8'),'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 50c9fb7..e56a133 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 _0x2059=['client','http','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x527021,_0x154a92){var _0x4b896a=function(_0x9617c5){while(--_0x9617c5){_0x527021['push'](_0x527021['shift']());}};_0x4b896a(++_0x154a92);}(_0x2059,0xf6));var _0x9205=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2059[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x9205('0x0'));var util=require('util');var moment=require(_0x9205('0x1'));var BPromise=require(_0x9205('0x2'));var rs=require(_0x9205('0x3'));var fs=require('fs');var Redis=require(_0x9205('0x4'));var db=require(_0x9205('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9205('0x6'))(_0x9205('0x7'));var config=require(_0x9205('0x8'));var jayson=require(_0x9205('0x9'));var client=jayson[_0x9205('0xa')][_0x9205('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9205('0xc')],{'host':_0x9205('0xd'),'port':0x18eb});var socket=require(_0x9205('0xe'))(new Redis(config[_0x9205('0xc')]));require(_0x9205('0xf'))['register'](socket);function respondWithRpcPromise(_0x3e0b40,_0x410afa,_0xb596aa){return new BPromise(function(_0x3a5bfe,_0x9a51a3){return client[_0x9205('0x10')](_0x3e0b40,_0xb596aa)[_0x9205('0x11')](function(_0x33b5c8){logger[_0x9205('0x12')](_0x9205('0x13'),_0x410afa,'request\x20sent');logger[_0x9205('0x14')](_0x9205('0x15'),_0x410afa,'request\x20sent',JSON[_0x9205('0x16')](_0x33b5c8));if(_0x33b5c8[_0x9205('0x17')]){if(_0x33b5c8[_0x9205('0x17')][_0x9205('0x18')]===0x1f4){logger[_0x9205('0x17')]('Plugin,\x20%s,\x20%s',_0x410afa,_0x33b5c8[_0x9205('0x17')][_0x9205('0x19')]);return _0x9a51a3(_0x33b5c8[_0x9205('0x17')]['message']);}logger[_0x9205('0x17')]('Plugin,\x20%s,\x20%s',_0x410afa,_0x33b5c8[_0x9205('0x17')]['message']);return _0x3a5bfe(_0x33b5c8[_0x9205('0x17')]['message']);}else{logger[_0x9205('0x12')](_0x9205('0x13'),_0x410afa,'request\x20sent');_0x3a5bfe(_0x33b5c8[_0x9205('0x1a')][_0x9205('0x19')]);}})[_0x9205('0x1b')](function(_0xe15a28){logger[_0x9205('0x17')](_0x9205('0x13'),_0x410afa,_0xe15a28);_0x9a51a3(_0xe15a28);});});}exports[_0x9205('0x1c')]=function(_0x54dc42){var _0x24d864=this;return new Promise(function(_0x4042af,_0xf2f5fe){return db['Plugin'][_0x9205('0x1d')](_0x54dc42['body'],{'raw':_0x54dc42[_0x9205('0x1e')]?_0x54dc42[_0x9205('0x1e')][_0x9205('0x1f')]===undefined?!![]:![]:!![]})[_0x9205('0x11')](function(_0x14807e){logger[_0x9205('0x12')](_0x9205('0x1c'),_0x54dc42);logger[_0x9205('0x14')](_0x9205('0x1c'),_0x54dc42,JSON[_0x9205('0x16')](_0x14807e));_0x4042af(_0x14807e);})[_0x9205('0x1b')](function(_0x5a89b4){logger['error'](_0x9205('0x1c'),_0x5a89b4[_0x9205('0x19')],_0x54dc42);_0xf2f5fe(_0x24d864[_0x9205('0x17')](0x1f4,_0x5a89b4[_0x9205('0x19')]));});});}; \ No newline at end of file +var _0xf1f5=['./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreatePlugin','Plugin','create','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x305706,_0x3c138f){var _0x72fdaa=function(_0x1d7b26){while(--_0x1d7b26){_0x305706['push'](_0x305706['shift']());}};_0x72fdaa(++_0x3c138f);}(_0xf1f5,0x1e1));var _0x5f1f=function(_0x51e1d5,_0x399588){_0x51e1d5=_0x51e1d5-0x0;var _0x105666=_0xf1f5[_0x51e1d5];return _0x105666;};'use strict';var _=require('lodash');var util=require(_0x5f1f('0x0'));var moment=require(_0x5f1f('0x1'));var BPromise=require(_0x5f1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f1f('0x3'));var db=require(_0x5f1f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f1f('0x5'))(_0x5f1f('0x6'));var config=require('../../config/environment');var jayson=require(_0x5f1f('0x7'));var client=jayson['client'][_0x5f1f('0x8')]({'port':0x232a});config[_0x5f1f('0x9')]=_[_0x5f1f('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5f1f('0xb'))(new Redis(config['redis']));require(_0x5f1f('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b0179,_0x23908d,_0x566ee2){return new BPromise(function(_0x38cc06,_0x192776){return client[_0x5f1f('0xd')](_0x5b0179,_0x566ee2)[_0x5f1f('0xe')](function(_0x508cd3){logger[_0x5f1f('0xf')](_0x5f1f('0x10'),_0x23908d,_0x5f1f('0x11'));logger[_0x5f1f('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x23908d,'request\x20sent',JSON[_0x5f1f('0x13')](_0x508cd3));if(_0x508cd3['error']){if(_0x508cd3[_0x5f1f('0x14')][_0x5f1f('0x15')]===0x1f4){logger[_0x5f1f('0x14')](_0x5f1f('0x10'),_0x23908d,_0x508cd3[_0x5f1f('0x14')]['message']);return _0x192776(_0x508cd3[_0x5f1f('0x14')][_0x5f1f('0x16')]);}logger[_0x5f1f('0x14')](_0x5f1f('0x10'),_0x23908d,_0x508cd3[_0x5f1f('0x14')][_0x5f1f('0x16')]);return _0x38cc06(_0x508cd3[_0x5f1f('0x14')][_0x5f1f('0x16')]);}else{logger[_0x5f1f('0xf')](_0x5f1f('0x10'),_0x23908d,_0x5f1f('0x11'));_0x38cc06(_0x508cd3['result'][_0x5f1f('0x16')]);}})[_0x5f1f('0x17')](function(_0x1fcf07){logger[_0x5f1f('0x14')](_0x5f1f('0x10'),_0x23908d,_0x1fcf07);_0x192776(_0x1fcf07);});});}exports[_0x5f1f('0x18')]=function(_0x367a8a){var _0x1834b1=this;return new Promise(function(_0x5ab40,_0x4d375c){return db[_0x5f1f('0x19')][_0x5f1f('0x1a')](_0x367a8a['body'],{'raw':_0x367a8a[_0x5f1f('0x1b')]?_0x367a8a[_0x5f1f('0x1b')][_0x5f1f('0x1c')]===undefined?!![]:![]:!![]})[_0x5f1f('0xe')](function(_0x1da9c1){logger[_0x5f1f('0xf')](_0x5f1f('0x18'),_0x367a8a);logger['debug'](_0x5f1f('0x18'),_0x367a8a,JSON['stringify'](_0x1da9c1));_0x5ab40(_0x1da9c1);})['catch'](function(_0x4a6ede){logger[_0x5f1f('0x14')](_0x5f1f('0x18'),_0x4a6ede[_0x5f1f('0x16')],_0x367a8a);_0x4d375c(_0x1834b1[_0x5f1f('0x14')](0x1f4,_0x4a6ede['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3148c65..541f10d 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 _0xbe9f=['./plugin.events','save','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x3ef711,_0x1d82a3){var _0x36baed=function(_0x4476a5){while(--_0x4476a5){_0x3ef711['push'](_0x3ef711['shift']());}};_0x36baed(++_0x1d82a3);}(_0xbe9f,0x99));var _0xfbe9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xbe9f[_0x1203f];return _0x365f0a;};'use strict';var PluginEvents=require(_0xfbe9('0x0'));var events=[_0xfbe9('0x1'),_0xfbe9('0x2'),_0xfbe9('0x3')];function createListener(_0x552a45,_0x1bd0fd){return function(_0x5701d9){_0x1bd0fd[_0xfbe9('0x4')](_0x552a45,_0x5701d9);};}function removeListener(_0x5eda8e,_0x33dfa8){return function(){PluginEvents[_0xfbe9('0x5')](_0x5eda8e,_0x33dfa8);};}exports[_0xfbe9('0x6')]=function(_0x194a49){for(var _0x332c0d=0x0,_0x468f20=events[_0xfbe9('0x7')];_0x332c0d<_0x468f20;_0x332c0d++){var _0x26ecb1=events[_0x332c0d];var _0x14abe7=createListener(_0xfbe9('0x8')+_0x26ecb1,_0x194a49);PluginEvents['on'](_0x26ecb1,_0x14abe7);}}; \ No newline at end of file +var _0xcfb6=['register','removeListener'];(function(_0xf6bb7d,_0x8af4f5){var _0x132764=function(_0x4f6309){while(--_0x4f6309){_0xf6bb7d['push'](_0xf6bb7d['shift']());}};_0x132764(++_0x8af4f5);}(_0xcfb6,0x109));var _0x6cfb=function(_0xd1b4d7,_0x28b2c1){_0xd1b4d7=_0xd1b4d7-0x0;var _0x3002ec=_0xcfb6[_0xd1b4d7];return _0x3002ec;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove','update'];function createListener(_0x2a3dad,_0x48fb4e){return function(_0x4cec02){_0x48fb4e['emit'](_0x2a3dad,_0x4cec02);};}function removeListener(_0xc8f7fd,_0x5fac62){return function(){PluginEvents[_0x6cfb('0x0')](_0xc8f7fd,_0x5fac62);};}exports[_0x6cfb('0x1')]=function(_0x37906d){for(var _0x3cc2e3=0x0,_0x25ce5a=events['length'];_0x3cc2e3<_0x25ce5a;_0x3cc2e3++){var _0x2f9e40=events[_0x3cc2e3];var _0x308251=createListener('plugin:'+_0x2f9e40,_0x37906d);PluginEvents['on'](_0x2f9e40,_0x308251);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 69cba22..635060f 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(_0x50283c,_0x271b3c){var _0x349787=function(_0x59e19b){while(--_0x59e19b){_0x50283c['push'](_0x50283c['shift']());}};_0x349787(++_0x271b3c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x3db2d3,_0x3c4dc5){var _0x32f6de=function(_0x5860da){while(--_0x5860da){_0x3db2d3['push'](_0x3db2d3['shift']());}};_0x32f6de(++_0x3c4dc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 1726a9d..9653edc 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 _0x0565=['script','../../files/plugins','cwd','chdir','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','npm\x20install','index','list','then','reject','express','length','catch','show','describe','body'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x0565,0xf2));var _0x5056=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x0565[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x5056('0x0'));var pm2=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var path=require(_0x5056('0x4'));var exec=require(_0x5056('0x5'))[_0x5056('0x6')];var BPromise=require(_0x5056('0x7'));function handleEntityNotFound(_0x3657a8,_0x2b0883){return function(_0x554040){if(!_0x554040){_0x3657a8[_0x5056('0x8')](0x194);;}return _0x554040;};}function respondWithResult(_0x105ea8,_0x1143df){_0x1143df=_0x1143df||0xc8;return function(_0x22afb7){if(_0x22afb7){return _0x105ea8['status'](_0x1143df)['json'](_0x22afb7);}return null;};}function handleError(_0x38f74,_0x223c92){_0x223c92=_0x223c92||0x1f4;return function(_0x417065){logger[_0x5056('0x9')](_0x417065[_0x5056('0xa')]);if(_0x417065[_0x5056('0xb')]){delete _0x417065[_0x5056('0xb')];}_0x38f74[_0x5056('0xc')](_0x223c92)['send'](_0x417065);};}function execChildProcess(){return new BPromise(function(_0x78f7e4,_0xf04ea3){exec(_0x5056('0xd'),function(_0x5ab4b2,_0x4c0255,_0x17f43e){logger['info'](_0x4c0255);logger['info'](_0x17f43e);if(_0x5ab4b2){logger['error'](_0x5ab4b2);return _0xf04ea3(_0x5ab4b2);}return _0x78f7e4(_0x4c0255);});});}exports[_0x5056('0xe')]=function(_0x4b183a,_0x3e523b){return pm2[_0x5056('0xf')]()[_0x5056('0x10')](function(_0x543cee){if(_0x543cee){var _0x1e8b64=_[_0x5056('0x11')](_0x543cee,function(_0x15f52d){return _0x15f52d[_0x5056('0xb')]===_0x5056('0x12')||_0x15f52d[_0x5056('0xb')]==='motion2';});return{'rows':_0x1e8b64,'count':_0x1e8b64[_0x5056('0x13')]};}return null;})['then'](respondWithResult(_0x3e523b,null))[_0x5056('0x14')](handleError(_0x3e523b,null));};exports[_0x5056('0x15')]=function(_0x1c0ee9,_0x1f2ac6){return pm2[_0x5056('0x16')](_0x1c0ee9['params']['id'])[_0x5056('0x10')](respondWithResult(_0x1f2ac6,null))[_0x5056('0x10')](handleEntityNotFound(_0x1f2ac6,null))['catch'](handleError(_0x1f2ac6,null));};exports['create']=function(_0x20776c,_0x517bf3){if(_0x20776c[_0x5056('0x17')][_0x5056('0xb')]&&_0x20776c[_0x5056('0x17')][_0x5056('0x18')]){var _0x33035c=path['join'](__dirname,_0x5056('0x19'),_0x20776c[_0x5056('0x17')]['script']);var _0x271efc=process[_0x5056('0x1a')]();process[_0x5056('0x1b')](path['dirname'](_0x33035c));return execChildProcess()[_0x5056('0x10')](function(_0x26a3c2){process['chdir'](_0x271efc);return pm2['start']({'name':_0x20776c[_0x5056('0x17')][_0x5056('0xb')],'script':_0x33035c});})[_0x5056('0x10')](function(_0x37f7b5){pm2['dump']();return _0x37f7b5[0x0];})[_0x5056('0x10')](respondWithResult(_0x517bf3,0xc9))[_0x5056('0x14')](handleError(_0x517bf3,null));}else{return _0x517bf3['status'](0x1f4)[_0x5056('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5056('0x1d')]=function(_0x39d539,_0x1106e5){if(_0x39d539[_0x5056('0x17')]['id']){delete _0x39d539[_0x5056('0x17')]['id'];}var _0x50f2a8={'online':_0x5056('0x1e'),'stopped':_0x5056('0x1f')};if(_0x50f2a8[_0x5056('0x20')](_0x39d539[_0x5056('0x17')]['status'])){return pm2[_0x50f2a8[_0x39d539[_0x5056('0x17')]['status']]](_0x39d539[_0x5056('0x21')]['id'])['then'](respondWithResult(_0x1106e5,0xc8))['catch'](handleError(_0x1106e5,null));}else{return _0x1106e5['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x22')});}};exports['destroy']=function(_0x27f4be,_0x2c5728){if(_0x27f4be[_0x5056('0x17')]['id']){delete _0x27f4be[_0x5056('0x17')]['id'];}if(_0x27f4be[_0x5056('0x21')]['id']){return pm2[_0x5056('0x23')](_0x27f4be[_0x5056('0x21')]['id'])[_0x5056('0x10')](function(_0xd1aa24){pm2[_0x5056('0x24')]();return _0xd1aa24[0x0];})[_0x5056('0x10')](respondWithResult(_0x2c5728,null))['catch'](handleError(_0x2c5728,null));}else{return _0x2c5728['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x25')});}}; \ No newline at end of file +var _0xaa88=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','status','json','error','stack','name','send','info','list','express','motion2','length','then','catch','show','describe','create','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa88,0x137));var _0x8aa8=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0xaa88[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0x8aa8('0x0'));var pm2=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var path=require('path');var exec=require(_0x8aa8('0x4'))[_0x8aa8('0x5')];var BPromise=require(_0x8aa8('0x6'));function handleEntityNotFound(_0x3b2c88,_0x3e3b70){return function(_0x350e8b){if(!_0x350e8b){_0x3b2c88['sendStatus'](0x194);;}return _0x350e8b;};}function respondWithResult(_0x5bda0d,_0x460042){_0x460042=_0x460042||0xc8;return function(_0x5264ff){if(_0x5264ff){return _0x5bda0d[_0x8aa8('0x7')](_0x460042)[_0x8aa8('0x8')](_0x5264ff);}return null;};}function handleError(_0x27c08d,_0x40826f){_0x40826f=_0x40826f||0x1f4;return function(_0x4adfb9){logger[_0x8aa8('0x9')](_0x4adfb9[_0x8aa8('0xa')]);if(_0x4adfb9[_0x8aa8('0xb')]){delete _0x4adfb9['name'];}_0x27c08d[_0x8aa8('0x7')](_0x40826f)[_0x8aa8('0xc')](_0x4adfb9);};}function execChildProcess(){return new BPromise(function(_0x357e05,_0x33cc5c){exec('npm\x20install',function(_0x3f8100,_0x30c114,_0x50787d){logger[_0x8aa8('0xd')](_0x30c114);logger[_0x8aa8('0xd')](_0x50787d);if(_0x3f8100){logger[_0x8aa8('0x9')](_0x3f8100);return _0x33cc5c(_0x3f8100);}return _0x357e05(_0x30c114);});});}exports['index']=function(_0x3b9f74,_0x179e33){return pm2[_0x8aa8('0xe')]()['then'](function(_0x391642){if(_0x391642){var _0x4af534=_['reject'](_0x391642,function(_0x433e95){return _0x433e95[_0x8aa8('0xb')]===_0x8aa8('0xf')||_0x433e95[_0x8aa8('0xb')]===_0x8aa8('0x10');});return{'rows':_0x4af534,'count':_0x4af534[_0x8aa8('0x11')]};}return null;})[_0x8aa8('0x12')](respondWithResult(_0x179e33,null))[_0x8aa8('0x13')](handleError(_0x179e33,null));};exports[_0x8aa8('0x14')]=function(_0x4e8ce3,_0x4843f5){return pm2[_0x8aa8('0x15')](_0x4e8ce3['params']['id'])['then'](respondWithResult(_0x4843f5,null))[_0x8aa8('0x12')](handleEntityNotFound(_0x4843f5,null))['catch'](handleError(_0x4843f5,null));};exports[_0x8aa8('0x16')]=function(_0x41092b,_0x2a9f56){if(_0x41092b[_0x8aa8('0x17')]['name']&&_0x41092b[_0x8aa8('0x17')][_0x8aa8('0x18')]){var _0x2825fd=path[_0x8aa8('0x19')](__dirname,_0x8aa8('0x1a'),_0x41092b[_0x8aa8('0x17')]['script']);var _0x26cf63=process['cwd']();process[_0x8aa8('0x1b')](path['dirname'](_0x2825fd));return execChildProcess()[_0x8aa8('0x12')](function(_0x557e4e){process[_0x8aa8('0x1b')](_0x26cf63);return pm2[_0x8aa8('0x1c')]({'name':_0x41092b[_0x8aa8('0x17')]['name'],'script':_0x2825fd});})[_0x8aa8('0x12')](function(_0xe978ab){pm2[_0x8aa8('0x1d')]();return _0xe978ab[0x0];})['then'](respondWithResult(_0x2a9f56,0xc9))['catch'](handleError(_0x2a9f56,null));}else{return _0x2a9f56[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x1e')});}};exports[_0x8aa8('0x1f')]=function(_0x24143e,_0x4a8212){if(_0x24143e[_0x8aa8('0x17')]['id']){delete _0x24143e['body']['id'];}var _0x2a0ff2={'online':_0x8aa8('0x20'),'stopped':_0x8aa8('0x21')};if(_0x2a0ff2['hasOwnProperty'](_0x24143e['body'][_0x8aa8('0x7')])){return pm2[_0x2a0ff2[_0x24143e['body'][_0x8aa8('0x7')]]](_0x24143e[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](respondWithResult(_0x4a8212,0xc8))[_0x8aa8('0x13')](handleError(_0x4a8212,null));}else{return _0x4a8212[_0x8aa8('0x7')](0x1f4)['send']({'message':_0x8aa8('0x23')});}};exports[_0x8aa8('0x24')]=function(_0x4b67f5,_0x99f74e){if(_0x4b67f5[_0x8aa8('0x17')]['id']){delete _0x4b67f5[_0x8aa8('0x17')]['id'];}if(_0x4b67f5['params']['id']){return pm2[_0x8aa8('0x25')](_0x4b67f5[_0x8aa8('0x22')]['id'])[_0x8aa8('0x12')](function(_0x423b02){pm2[_0x8aa8('0x1d')]();return _0x423b02[0x0];})[_0x8aa8('0x12')](respondWithResult(_0x99f74e,null))[_0x8aa8('0x13')](handleError(_0x99f74e,null));}else{return _0x99f74e[_0x8aa8('0x7')](0x1f4)[_0x8aa8('0xc')]({'message':_0x8aa8('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6a0fe1b..fef0d0e 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 _0x355a=['/agents','getAgents','/queues','isAuthenticated','getQueues','Router','../../components/auth/service','./realtime.controller','get'];(function(_0xd60627,_0x148e5f){var _0x2381dd=function(_0x5b7d55){while(--_0x5b7d55){_0xd60627['push'](_0xd60627['shift']());}};_0x2381dd(++_0x148e5f);}(_0x355a,0x10a));var _0xa355=function(_0x15b5b7,_0x5bea6d){_0x15b5b7=_0x15b5b7-0x0;var _0x431dff=_0x355a[_0x15b5b7];return _0x431dff;};'use strict';var express=require('express');var router=express[_0xa355('0x0')]();var auth=require(_0xa355('0x1'));var controller=require(_0xa355('0x2'));router[_0xa355('0x3')](_0xa355('0x4'),auth['isAuthenticated'](),controller[_0xa355('0x5')]);router[_0xa355('0x3')](_0xa355('0x6'),auth[_0xa355('0x7')](),controller[_0xa355('0x8')]);module['exports']=router; \ No newline at end of file +var _0xe0a5=['isAuthenticated','getAgents','getQueues','exports','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x22cb5f,_0x2cdd63){var _0x274d36=function(_0x421472){while(--_0x421472){_0x22cb5f['push'](_0x22cb5f['shift']());}};_0x274d36(++_0x2cdd63);}(_0xe0a5,0x13f));var _0x5e0a=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xe0a5[_0x35e75a];return _0xb23c7f;};'use strict';var express=require('express');var router=express[_0x5e0a('0x0')]();var auth=require(_0x5e0a('0x1'));var controller=require(_0x5e0a('0x2'));router[_0x5e0a('0x3')](_0x5e0a('0x4'),auth[_0x5e0a('0x5')](),controller[_0x5e0a('0x6')]);router[_0x5e0a('0x3')]('/queues',auth[_0x5e0a('0x5')](),controller[_0x5e0a('0x7')]);module[_0x5e0a('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index e6bddb0..f7febcf 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 _0x423c=['order','globalQueueFilter','rawAttributes','fieldName','key','role','agent','raw','isEmpty','where','user','nolimit','UserProfile','findAndCountAll','count','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','getOptions','userProfileId','type','outbound','QueueCampaigns','getResources','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','status','Content-Range','json','error','stack','send','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','voice','startCase','Queues','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','talking','paused','push','pTalking','message','dialActive','Trunk','startProgressive','erlangCallToSecond','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','available','waiting','originated','pick','filter','name','length','busy','some','internal','toString','find','UserId','online','voiceStatus','User','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','sms','openchannel','includes','toLowerCase','Invalid\x20channel','isArray','getAgents','uniq','value','split','fields','DESC','ASC','sort','globalStatus','pauseType','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','faxCurrentCapacity','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','resolve','query','channel'];(function(_0x4617db,_0x3c1565){var _0x5c6844=function(_0x3e3334){while(--_0x3e3334){_0x4617db['push'](_0x4617db['shift']());}};_0x5c6844(++_0x3c1565);}(_0x423c,0xba));var _0xc423=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x423c[_0x6cf19c];return _0xce14f3;};'use strict';var util=require(_0xc423('0x0'));var _=require(_0xc423('0x1'));var jayson=require('jayson/promise');var qs=require(_0xc423('0x2'));var logger=require(_0xc423('0x3'))(_0xc423('0x4'));var db=require(_0xc423('0x5'))['db'];var amiClient=jayson[_0xc423('0x6')][_0xc423('0x7')]({'port':0x232a});var routingClient=jayson[_0xc423('0x6')][_0xc423('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x721202,_0x160ac8){return function(_0x4e7199){if(_0x4e7199){var _0x2592ce=typeof _0x160ac8[_0xc423('0x8')]===_0xc423('0x9')&&typeof _0x160ac8[_0xc423('0xa')]===_0xc423('0x9');var _0x592f20=_0x4e7199['count'];var _0x1ca04e=_0x2592ce?0x0:_0x160ac8[_0xc423('0x8')];var _0x50d9e0=_0x2592ce?_0x4e7199['count']:_0x160ac8[_0xc423('0x8')]+_0x160ac8['limit'];var _0x55fc04;if(_0x50d9e0>=_0x592f20){_0x50d9e0=_0x592f20;_0x55fc04=0xc8;}else{_0x55fc04=0xce;}_0x721202[_0xc423('0xb')](_0x55fc04);return _0x721202['set'](_0xc423('0xc'),_0x1ca04e+'-'+_0x50d9e0+'/'+_0x592f20)[_0xc423('0xd')](_0x4e7199);}return null;};}function handleError(_0x1a6823,_0x3d8128){_0x3d8128=_0x3d8128||0x1f4;return function(_0x5ede8f){logger[_0xc423('0xe')](_0x5ede8f[_0xc423('0xf')]);if(_0x5ede8f['name']){delete _0x5ede8f['name'];}_0x1a6823[_0xc423('0xb')](_0x3d8128)[_0xc423('0x10')](_0x5ede8f);};}function getRealtimeAgents(){return new Promise(function(_0x22dc97,_0x431ff4){return amiClient['request']('Agents',{})[_0xc423('0x11')](function(_0x18e3e1){if(_0x18e3e1[_0xc423('0xe')])throw new Error(_0xc423('0x12'));var _0x1ae200=_0x18e3e1['result'];return routingClient[_0xc423('0x13')](_0xc423('0x14'),{})[_0xc423('0x11')](function(_0x2157ec){if(_0x2157ec[_0xc423('0xe')])throw new Error(_0xc423('0x15'));var _0x2f422f=_0x2157ec[_0xc423('0x16')];return _0x22dc97(_[_0xc423('0x17')]({},_0x1ae200,_0x2f422f));});})[_0xc423('0x18')](function(_0x827442){_0x431ff4(_0x827442);});});}function getRealtimeQueues(_0x6c4c79,_0xac61b7){return new Promise(function(_0xfaefc6,_0x2f215a){var _0x27aebf=_0xac61b7===_0xc423('0x19')?amiClient:routingClient;return _0x27aebf[_0xc423('0x13')](_[_0xc423('0x1a')](_0xac61b7)+_0xc423('0x1b'),_0x6c4c79)[_0xc423('0x11')](function(_0x1db97a){if(_0x1db97a[_0xc423('0xe')])throw new Error(util['format'](_0xc423('0x1c'),_0xac61b7));return _0xfaefc6(_0x1db97a['result']);})[_0xc423('0x18')](function(_0x5b3fbd){_0x2f215a(_0x5b3fbd);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5745e5,_0x1ca8a7){return amiClient[_0xc423('0x13')]('VoiceQueuesChannels',{})['then'](function(_0x5728b2){if(_0x5728b2[_0xc423('0xe')])throw new Error(_0xc423('0x1d'));return _0x5745e5(_0x5728b2[_0xc423('0x16')]);})[_0xc423('0x18')](function(_0x56ef27){_0x1ca8a7(_0x56ef27);});});}function initializeQueues(_0x4c8060,_0x596cc7,_0x3c31ed,_0x13c782){var _0x6b064=[_0xc423('0x1e'),'available','waiting',_0xc423('0x1f'),_0xc423('0x20')];if(_0x3c31ed===_0xc423('0x19')&&_0x13c782==='outbound'){_0x6b064[_0xc423('0x21')](_0xc423('0x22'),'originated',_0xc423('0x23'),_0xc423('0x24'),'dialMethod',_0xc423('0x25'),'startPredictive',_0xc423('0x26'),'erlangCalls',_0xc423('0x27'),'erlangAbandonmentRate','erlangBusyFactor',_0xc423('0x28'),_0xc423('0x29'),_0xc423('0x2a'),_0xc423('0x2b'),_0xc423('0x2c'),_0xc423('0x2d'),_0xc423('0x2e'),'predictiveIntervalDroppedCallsCallersExit',_0xc423('0x2f'),_0xc423('0x30'));}return _0x4c8060[_0xc423('0x31')](function(_0x376bdb){var _0x2fdec6=_0x376bdb[_0xc423('0x32')]({'plain':!![]});_0x2fdec6[_0xc423('0x33')]=[];_0x2fdec6[_0xc423('0x20')]=0x0;_0x2fdec6[_0xc423('0x34')]=0x0;_0x2fdec6[_0xc423('0x1e')]=0x0;_0x2fdec6[_0xc423('0x35')]=0x0;_0x2fdec6[_0xc423('0x36')]=0x0;if(_0x3c31ed==='voice'){_0x2fdec6[_0xc423('0x1f')]=0x0;_0x2fdec6['busy']=0x0;if(_0x13c782==='outbound'){_0x2fdec6[_0xc423('0x22')]=0x0;_0x2fdec6[_0xc423('0x37')]=0x0;}}var _0x582f28=_['find'](_0x596cc7,['id',_0x2fdec6['id']]);if(_0x582f28)_[_0xc423('0x17')](_0x2fdec6,_[_0xc423('0x38')](_0x582f28,_0x6b064));return _0x2fdec6;});}function updateAgentVoiceStatus(_0x370065,_0x26ee2c,_0x495e84){var _0x2ebe1f=_[_0xc423('0x39')](_0x495e84,['queue',_0x26ee2c[_0xc423('0x3a')]]);if(_0x2ebe1f[_0xc423('0x3b')]===0x0)return _0x370065[_0xc423('0x3c')]=!![];if(_[_0xc423('0x3d')](_0x2ebe1f,['connectedlinenum',_0x370065[_0xc423('0x3e')][_0xc423('0x3f')]()]))return _0x370065[_0xc423('0x1f')]=!![];if(!_0x370065[_0xc423('0x1f')])return _0x370065['busy']=!![];}function getVoiceQueueAgents(_0x4c9651,_0xd9c79f,_0x41c0d5,_0x10e561){var _0x551308=_[_0xc423('0x40')](_0xd9c79f,['id',_0x4c9651['id']]);if(!_0x551308)return _0x4c9651;return _0x551308['getMembers']({'raw':!![]})[_0xc423('0x11')](function(_0xbee7a7){for(var _0x97ab65=0x0;_0x97ab65<_0xbee7a7[_0xc423('0x3b')];_0x97ab65++){var _0x3486fd=_[_0xc423('0x40')](_0x41c0d5,['id',_0xbee7a7[_0x97ab65][_0xc423('0x41')]]);if(!_0x3486fd){_0x3486fd={'id':_0xbee7a7[_0x97ab65][_0xc423('0x41')],'name':_0xbee7a7[_0x97ab65][_0xc423('0x41')],'accountcode':'','online':![]};}var _0x5a741e={'id':_0x3486fd['id'],'name':_0x3486fd[_0xc423('0x3a')],'internal':_0x3486fd['accountcode'],'online':Boolean(_0x3486fd[_0xc423('0x42')]),'paused':Boolean(_0xbee7a7[_0x97ab65][_0xc423('0x20')])};if(_0x3486fd[_0xc423('0x43')]===_0xc423('0x1f'))updateAgentVoiceStatus(_0x5a741e,_0x4c9651,_0x10e561);if(_0x5a741e[_0xc423('0x42')])_0x4c9651[_0xc423('0x34')]++;if(_0x5a741e[_0xc423('0x3c')])_0x4c9651[_0xc423('0x3c')]++;if(_0x5a741e[_0xc423('0x20')]&&!_0x5a741e[_0xc423('0x3c')]&&!_0x5a741e[_0xc423('0x1f')])_0x4c9651[_0xc423('0x20')]++;_0x4c9651['agents'][_0xc423('0x21')](_0x5a741e);}return _0x4c9651;});}function getQueueAgents(_0x469bd6,_0x402037,_0x5e3f02){var _0x1f25d1=_0xc423('0x44')+_[_0xc423('0x1a')](_0x5e3f02)+_0xc423('0x45');var _0x4d8449=_0x5e3f02+'Pause';return db[_0x1f25d1][_0xc423('0x46')]({'where':{[_[_0xc423('0x1a')](_0x5e3f02)+_0xc423('0x47')]:_0x469bd6['id']},'raw':!![]})[_0xc423('0x11')](function(_0x18dd41){for(var _0x2df472=0x0;_0x2df472<_0x18dd41[_0xc423('0x3b')];_0x2df472++){var _0x475620=_['find'](_0x402037,['id',_0x18dd41[_0x2df472]['UserId']]);if(!_0x475620){_0x475620={'id':_0x18dd41[_0x2df472][_0xc423('0x41')],'name':_0x18dd41[_0x2df472]['UserId'],'online':![],['pauseField']:![]};}var _0x42279f={'id':_0x475620['id'],'name':_0x475620[_0xc423('0x3a')],'online':Boolean(_0x475620[_0xc423('0x42')]),'paused':Boolean(_0x475620[_0x4d8449])};if(_0x42279f[_0xc423('0x42')])_0x469bd6[_0xc423('0x34')]++;_0x469bd6['agents'][_0xc423('0x21')](_0x42279f);}return _0x469bd6;});}function isIdle(_0xb8c442){return _0xb8c442===_0xc423('0x48')||_0xb8c442===_0xc423('0x49')||_0xb8c442===_0xc423('0x4a')||_0xb8c442===_0xc423('0x4b')||_[_0xc423('0x4c')](_0xb8c442);}function isAgentPaused(_0x4594ea,_0x25dc66){var _0x22acc3=[_0x4594ea[_0xc423('0x4d')],_0x4594ea[_0xc423('0x4e')],_0x4594ea[_0xc423('0x4f')],_0x4594ea[_0xc423('0x50')],_0x4594ea[_0xc423('0x51')],_0x4594ea[_0xc423('0x52')],_0x4594ea[_0xc423('0x53')]];if(!_0x25dc66)return _[_0xc423('0x54')](_0x22acc3);var _0x389997=_[_0xc423('0x39')](_0x22acc3);return _0x389997[_0xc423('0x3b')]>0x0&&_0x389997[_0xc423('0x3b')]<_0x22acc3[_0xc423('0x3b')]?!![]:![];}function isAgentIdle(_0x3b4f26){if(_0x3b4f26[_0xc423('0x43')]!==_0xc423('0x48')&&_0x3b4f26[_0xc423('0x52')]){_0x3b4f26[_0xc423('0x43')]=_0xc423('0x55');return![];}return _[_0xc423('0x54')]([_0x3b4f26[_0xc423('0x56')],_0x3b4f26[_0xc423('0x57')],_0x3b4f26[_0xc423('0x58')],_0x3b4f26[_0xc423('0x59')],_0x3b4f26[_0xc423('0x5a')],_0x3b4f26[_0xc423('0x43')],_0x3b4f26[_0xc423('0x5b')]],isIdle);}function getAgentStatus(_0x163b4c){var _0x28866c='unknown';if(isAgentPaused(_0x163b4c))_0x28866c='pause';else if(isAgentPaused(_0x163b4c,!![]))_0x28866c=_0xc423('0x5c');else if(isAgentIdle(_0x163b4c))_0x28866c=_0xc423('0x48');else _0x28866c=_0xc423('0x3c');return _0x28866c;}function validateChannel(_0x4b3b27){var _0x563f40=[_0xc423('0x5d'),'chat',_0xc423('0x5e'),_0xc423('0x5f'),'fax','whatsapp',_0xc423('0x19')];if(!_[_0xc423('0x60')](_0x563f40,_0x4b3b27[_0xc423('0x61')]()))throw new Error(_0xc423('0x62'));return _0x4b3b27[_0xc423('0x61')]();}function getFilteredAgentIds(_0x4af925,_0x2a6249){var _0x93ff16=_[_0xc423('0x63')](_0x4af925)?_0x4af925:[_0x4af925];var _0x2691e2=_[_0xc423('0x31')](_0x93ff16,function(_0x34101d){return db[_0x2a6249]['findOne']({'where':{'name':_0x34101d}})[_0xc423('0x11')](function(_0x5ec9bf){if(!_0x5ec9bf)return[];return _0x5ec9bf[_0xc423('0x64')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x2691e2)['then'](function(_0x2892f1){var _0x22b33d=_(_0x2892f1)['flatten']()[_0xc423('0x31')]('id')[_0xc423('0x65')]()[_0xc423('0x66')]();return _0x22b33d;});}function getUpdatedSortOptions(_0x5b4b18){var _0xf8dcc6={'fields':[],'order':null};var _0x3a474e=_0x5b4b18[_0xc423('0x67')](',');_0xf8dcc6[_0xc423('0x68')]=_['filter'](_0x3a474e,function(_0x484df4){if(!_0x484df4[_0xc423('0x60')]('globalStatus'))return!![];_0xf8dcc6['order']=_['startsWith'](_0x484df4,'-')?_0xc423('0x69'):_0xc423('0x6a');return![];});return _0xf8dcc6;}function orderAgentsByStatus(_0x587a46,_0x13ccad){return _0x587a46[_0xc423('0x6b')](function(_0x2f4598,_0x279794){if(_0x2f4598['globalStatus']===_0x279794['globalStatus']&&_0x2f4598[_0xc423('0x6c')]===_0xc423('0x55')){if(_0x13ccad===_0xc423('0x69'))return(_0x2f4598[_0xc423('0x6d')]||'')<(_0x279794[_0xc423('0x6d')]||'')?0x1:-0x1;return _0x2f4598[_0xc423('0x6d')]<_0x279794[_0xc423('0x6d')]?-0x1:0x1;}else{if(_0x13ccad==='DESC')return _0x2f4598[_0xc423('0x6c')]<_0x279794[_0xc423('0x6c')]?0x1:-0x1;return _0x2f4598['globalStatus']<_0x279794['globalStatus']?-0x1:0x1;}});}exports['getAgents']=function(_0x45524b,_0x41dd0f){var _0x563769={'count':0x0,'rows':[]},_0x42a88c={},_0x5d6345,_0x25fea9,_0x56a4d8,_0x3a8687,_0x2dcac6=[_0xc423('0x6e'),'online',_0xc423('0x6f'),_0xc423('0x70'),_0xc423('0x6d'),_0xc423('0x70'),'internal',_0xc423('0x71'),_0xc423('0x4d'),_0xc423('0x50'),_0xc423('0x4f'),_0xc423('0x51'),_0xc423('0x53'),'faxPause',_0xc423('0x52'),_0xc423('0x72'),_0xc423('0x73'),_0xc423('0x74'),_0xc423('0x75'),'whatsappCapacity',_0xc423('0x76'),'chatCurrentCapacity',_0xc423('0x77'),'mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity',_0xc423('0x78'),'chatStatus','openchannelStatus',_0xc423('0x58'),'smsStatus',_0xc423('0x5b'),'faxStatus','voiceStatus','chatStatusTime',_0xc423('0x79'),_0xc423('0x7a'),_0xc423('0x7b'),_0xc423('0x7c'),'faxStatusTime','voiceStatusTime',_0xc423('0x7d'),_0xc423('0x7e'),'screenrecording',_0xc423('0x7f'),_0xc423('0x80'),'routealias'],_0x1a8261=['chatPause',_0xc423('0x50'),_0xc423('0x4f'),_0xc423('0x51'),_0xc423('0x53'),_0xc423('0x4e'),_0xc423('0x52'),'online'];Promise[_0xc423('0x81')]()[_0xc423('0x11')](function(){if(_0x45524b[_0xc423('0x82')][_0xc423('0x83')])_0x5d6345=validateChannel(_0x45524b['query'][_0xc423('0x83')]);if(!_0x45524b[_0xc423('0x82')]['sort']||!_0x45524b['query'][_0xc423('0x6b')]['includes'](_0xc423('0x6c')))return;var _0x4403e7=getUpdatedSortOptions(_0x45524b['query']['sort']);_0x45524b[_0xc423('0x82')]['sort']=_0x4403e7[_0xc423('0x68')]['join'](',');_0x25fea9=_0x4403e7[_0xc423('0x84')];})[_0xc423('0x11')](function(){if(!_0x45524b['query']['globalQueueFilter'])return[];var _0x2abdc7=_[_0xc423('0x1a')](_0x5d6345)+_0xc423('0x45');return getFilteredAgentIds(_0x45524b[_0xc423('0x82')][_0xc423('0x85')],_0x2abdc7);})['then'](function(_0x1c1081){var _0x444b18=_['map'](db[_0xc423('0x44')][_0xc423('0x86')],function(_0x2586ed){return{'name':_0x2586ed[_0xc423('0x87')],'type':_0x2586ed['type'][_0xc423('0x88')]};});_0x45524b[_0xc423('0x82')][_0xc423('0x89')]=_0xc423('0x8a');_0x45524b[_0xc423('0x82')][_0xc423('0x42')]=!![];_0x42a88c=qs['getOptions'](_0x444b18,_0x45524b);_0x42a88c[_0xc423('0x8b')]=!![];if(!_[_0xc423('0x8c')](_0x1c1081)){_0x42a88c[_0xc423('0x8d')]=_[_0xc423('0x17')](_0x42a88c['where'],{'$and':[{'id':{'$in':_0x1c1081}}]});}else if(!_[_0xc423('0x8c')](_0x45524b[_0xc423('0x82')][_0xc423('0x85')])){return _0x563769;}if(_0x45524b[_0xc423('0x8e')][_0xc423('0x89')]===_0xc423('0x8e')){var _0x2f05b3={'params':{'id':_0x45524b[_0xc423('0x8e')]['userProfileId']},'query':{'section':_0xc423('0x14'),'role':_0xc423('0x8a'),'online':!![],'nolimit':_0x45524b['query'][_0xc423('0x8f')],'sort':_0x45524b[_0xc423('0x82')]['sort'],'filter':_0x45524b[_0xc423('0x82')]['filter'],'raw':!![],'ids':_0x1c1081}};return db[_0xc423('0x90')]['getResources'](_0x2f05b3);}return db[_0xc423('0x44')][_0xc423('0x91')](_0x42a88c);})[_0xc423('0x11')](function(_0x2a7474){_0x563769[_0xc423('0x92')]=_0x2a7474[_0xc423('0x92')];_0x56a4d8=_0x2a7474[_0xc423('0x93')];return getRealtimeAgents();})[_0xc423('0x11')](function(_0x59bd4c){_0x3a8687=_0x59bd4c[_0xc423('0x93')];return _0x56a4d8[_0xc423('0x31')](function(_0x524da3){var _0x3bb193=_[_0xc423('0x40')](_0x3a8687,['id',_0x524da3['id']]);if(_0x3bb193)_[_0xc423('0x17')](_0x524da3,_[_0xc423('0x38')](_[_0xc423('0x94')](_0x3bb193,_0x1a8261),_0x2dcac6));_0x524da3['globalStatus']=getAgentStatus(_0x524da3);return _0x524da3;});})[_0xc423('0x11')](function(_0x202cc8){var _0x3b52a2;if(_0x45524b[_0xc423('0x82')][_0xc423('0x95')]){_0x3b52a2=_[_0xc423('0x39')](_0x202cc8,[_0xc423('0x6c'),_0x45524b[_0xc423('0x82')]['globalStatusFilter']]);if(_0x45524b[_0xc423('0x82')][_0xc423('0x96')]){_0x3b52a2=_[_0xc423('0x39')](_0x3b52a2,[_0xc423('0x6d'),_0x45524b[_0xc423('0x82')][_0xc423('0x96')]]);}}if(_0x3b52a2)_0x202cc8=_0x3b52a2;if(!_0x25fea9)return _0x202cc8;return orderAgentsByStatus(_0x202cc8,_0x25fea9);})[_0xc423('0x11')](function(_0x4ba58c){_0x563769['rows']=_0x4ba58c;return _0x563769;})[_0xc423('0x11')](respondWithFilteredResult(_0x41dd0f,_0x42a88c))[_0xc423('0x18')](handleError(_0x41dd0f,null));};exports[_0xc423('0x97')]=function(_0x227cd5,_0x2d5d1d){var _0x3e74b3={'count':0x0,'rows':[]},_0x4c7073={},_0x7a965b,_0x546d6d,_0x20761d,_0x562c66,_0x2462be;Promise[_0xc423('0x81')]()[_0xc423('0x11')](function(){if(_0x227cd5[_0xc423('0x82')][_0xc423('0x83')])_0x7a965b=validateChannel(_0x227cd5[_0xc423('0x82')][_0xc423('0x83')]);var _0x551cc4=_['startCase'](_0x7a965b)+_0xc423('0x45');var _0x46a625=_['map'](db[_0x551cc4][_0xc423('0x86')],function(_0x27dd31){return{'name':_0x27dd31['fieldName'],'type':_0x27dd31['type'][_0xc423('0x88')]};});_0x4c7073=qs[_0xc423('0x98')](_0x46a625,_0x227cd5);if(_0x227cd5[_0xc423('0x8e')][_0xc423('0x89')]===_0xc423('0x8e')){var _0x6897d7={'params':{'id':_0x227cd5[_0xc423('0x8e')][_0xc423('0x99')]},'query':{'section':_0x7a965b==='voice'&&_0x227cd5[_0xc423('0x82')][_0xc423('0x9a')]===_0xc423('0x9b')?_0xc423('0x9c'):_[_0xc423('0x1a')](_0x7a965b)+_0xc423('0x1b'),'type':_0x227cd5['query']['type'],'nolimit':!![],'sort':_0xc423('0x3a'),'filter':_0x227cd5[_0xc423('0x82')]['filter']}};return db[_0xc423('0x90')][_0xc423('0x9d')](_0x6897d7);}return db[_0x551cc4]['findAndCountAll'](_0x4c7073);})[_0xc423('0x11')](function(_0x904c77){_0x3e74b3[_0xc423('0x92')]=_0x904c77[_0xc423('0x92')];_0x546d6d=_0x904c77[_0xc423('0x93')];return getRealtimeQueues(_0x227cd5,_0x7a965b);})[_0xc423('0x11')](function(_0x3188e0){_0x562c66=_0x3188e0[_0xc423('0x93')];return getRealtimeAgents();})[_0xc423('0x11')](function(_0x269303){_0x20761d=_0x269303['rows'];if(_0x7a965b!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xc423('0x11')](function(_0x245e0d){_0x2462be=_0x245e0d?_0x245e0d[_0xc423('0x93')]:[];return initializeQueues(_0x546d6d,_0x562c66,_0x7a965b,_0x227cd5[_0xc423('0x82')][_0xc423('0x9a')]);})[_0xc423('0x11')](function(_0x2a0c8d){var _0x19fd5a=_0x2a0c8d[_0xc423('0x31')](function(_0x1dfe22){if(_0x7a965b==='voice')return getVoiceQueueAgents(_0x1dfe22,_0x546d6d,_0x20761d,_0x2462be);else return getQueueAgents(_0x1dfe22,_0x20761d,_0x7a965b);});return Promise[_0xc423('0x9e')](_0x19fd5a);})[_0xc423('0x11')](function(_0x219572){_0x3e74b3[_0xc423('0x93')]=_0x219572;return _0x3e74b3;})['then'](respondWithFilteredResult(_0x2d5d1d,_0x4c7073))['catch'](handleError(_0x2d5d1d,null));}; \ No newline at end of file +var _0xdc27=['whatsappPause','every','filter','chatStatus','faxStatus','mailStatus','pause','chat','fax','includes','toLowerCase','Invalid\x20channel','isArray','findOne','getAgents','all','split','globalStatus','startsWith','DESC','sort','pauseType','lastLoginAt','lastPauseAt','address','openchannelPause','smsPause','voicePause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','mailStatusTime','smsStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','fields','join','order','globalQueueFilter','rawAttributes','type','key','role','agent','getOptions','isEmpty','where','merge','user','userProfileId','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','Queue','fieldName','QueueCampaigns','util','lodash','jayson/promise','../../config/logger','api','../../mysqldb','client','http','undefined','limit','offset','count','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','available','waiting','talking','paused','pTalking','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','map','get','agents','loggedInDb','outbound','originated','find','pick','length','busy','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','push','User','startCase','Pause','findAll','QueueId','idle','unknown','ringing','chatPause','faxPause','mailPause'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0xdc27,0xea));var _0x7dc2=function(_0x17a92b,_0x35de45){_0x17a92b=_0x17a92b-0x0;var _0x1e31c7=_0xdc27[_0x17a92b];return _0x1e31c7;};'use strict';var util=require(_0x7dc2('0x0'));var _=require(_0x7dc2('0x1'));var jayson=require(_0x7dc2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x7dc2('0x3'))(_0x7dc2('0x4'));var db=require(_0x7dc2('0x5'))['db'];var amiClient=jayson[_0x7dc2('0x6')][_0x7dc2('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0x7dc2('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x3c8ef3,_0x47f599){return function(_0x48d21f){if(_0x48d21f){var _0x4d7534=typeof _0x47f599['offset']===_0x7dc2('0x8')&&typeof _0x47f599[_0x7dc2('0x9')]==='undefined';var _0x54b545=_0x48d21f['count'];var _0x9832e3=_0x4d7534?0x0:_0x47f599[_0x7dc2('0xa')];var _0x160570=_0x4d7534?_0x48d21f[_0x7dc2('0xb')]:_0x47f599['offset']+_0x47f599[_0x7dc2('0x9')];var _0x5bf6f4;if(_0x160570>=_0x54b545){_0x160570=_0x54b545;_0x5bf6f4=0xc8;}else{_0x5bf6f4=0xce;}_0x3c8ef3[_0x7dc2('0xc')](_0x5bf6f4);return _0x3c8ef3[_0x7dc2('0xd')](_0x7dc2('0xe'),_0x9832e3+'-'+_0x160570+'/'+_0x54b545)[_0x7dc2('0xf')](_0x48d21f);}return null;};}function handleError(_0x375134,_0x58bd62){_0x58bd62=_0x58bd62||0x1f4;return function(_0x407162){logger[_0x7dc2('0x10')](_0x407162[_0x7dc2('0x11')]);if(_0x407162[_0x7dc2('0x12')]){delete _0x407162[_0x7dc2('0x12')];}_0x375134[_0x7dc2('0xc')](_0x58bd62)[_0x7dc2('0x13')](_0x407162);};}function getRealtimeAgents(){return new Promise(function(_0x1203be,_0xf26f97){return amiClient[_0x7dc2('0x14')](_0x7dc2('0x15'),{})[_0x7dc2('0x16')](function(_0x30c035){if(_0x30c035[_0x7dc2('0x10')])throw new Error(_0x7dc2('0x17'));var _0xd5e2d3=_0x30c035[_0x7dc2('0x18')];return routingClient[_0x7dc2('0x14')](_0x7dc2('0x15'),{})[_0x7dc2('0x16')](function(_0x20f53d){if(_0x20f53d[_0x7dc2('0x10')])throw new Error(_0x7dc2('0x19'));var _0x2442bb=_0x20f53d[_0x7dc2('0x18')];return _0x1203be(_['merge']({},_0xd5e2d3,_0x2442bb));});})[_0x7dc2('0x1a')](function(_0x1da569){_0xf26f97(_0x1da569);});});}function getRealtimeQueues(_0x450e79,_0x7a2639){return new Promise(function(_0x4c3a0d,_0x448568){var _0x1c53d2=_0x7a2639===_0x7dc2('0x1b')?amiClient:routingClient;return _0x1c53d2[_0x7dc2('0x14')](_['startCase'](_0x7a2639)+_0x7dc2('0x1c'),_0x450e79)[_0x7dc2('0x16')](function(_0x43c6fb){if(_0x43c6fb[_0x7dc2('0x10')])throw new Error(util[_0x7dc2('0x1d')](_0x7dc2('0x1e'),_0x7a2639));return _0x4c3a0d(_0x43c6fb[_0x7dc2('0x18')]);})[_0x7dc2('0x1a')](function(_0x2464a5){_0x448568(_0x2464a5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x52e26c,_0x4416de){return amiClient[_0x7dc2('0x14')](_0x7dc2('0x1f'),{})['then'](function(_0x33a711){if(_0x33a711[_0x7dc2('0x10')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x52e26c(_0x33a711['result']);})[_0x7dc2('0x1a')](function(_0x27a7d7){_0x4416de(_0x27a7d7);});});}function initializeQueues(_0x2ee67e,_0x381ce4,_0x56ab9d,_0x1a2db7){var _0x20e966=['loggedIn',_0x7dc2('0x20'),_0x7dc2('0x21'),_0x7dc2('0x22'),_0x7dc2('0x23')];if(_0x56ab9d==='voice'&&_0x1a2db7==='outbound'){_0x20e966['push'](_0x7dc2('0x24'),'originated',_0x7dc2('0x25'),'dialActive',_0x7dc2('0x26'),_0x7dc2('0x27'),_0x7dc2('0x28'),_0x7dc2('0x29'),_0x7dc2('0x2a'),_0x7dc2('0x2b'),_0x7dc2('0x2c'),_0x7dc2('0x2d'),_0x7dc2('0x2e'),_0x7dc2('0x2f'),'dialPredictiveIntervalMinThreshold',_0x7dc2('0x30'),_0x7dc2('0x31'),'predictiveIntervalAnsweredCalls',_0x7dc2('0x32'),_0x7dc2('0x33'),'predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime');}return _0x2ee67e[_0x7dc2('0x34')](function(_0x38db90){var _0x11e9e9=_0x38db90[_0x7dc2('0x35')]({'plain':!![]});_0x11e9e9[_0x7dc2('0x36')]=[];_0x11e9e9[_0x7dc2('0x23')]=0x0;_0x11e9e9[_0x7dc2('0x37')]=0x0;_0x11e9e9['loggedIn']=0x0;_0x11e9e9[_0x7dc2('0x20')]=0x0;_0x11e9e9[_0x7dc2('0x21')]=0x0;if(_0x56ab9d===_0x7dc2('0x1b')){_0x11e9e9[_0x7dc2('0x22')]=0x0;_0x11e9e9['busy']=0x0;if(_0x1a2db7===_0x7dc2('0x38')){_0x11e9e9[_0x7dc2('0x24')]=0x0;_0x11e9e9[_0x7dc2('0x39')]=0x0;}}var _0x4efef7=_[_0x7dc2('0x3a')](_0x381ce4,['id',_0x11e9e9['id']]);if(_0x4efef7)_['merge'](_0x11e9e9,_[_0x7dc2('0x3b')](_0x4efef7,_0x20e966));return _0x11e9e9;});}function updateAgentVoiceStatus(_0x2b0e5c,_0x2f204a,_0x2ae870){var _0xbe2fce=_['filter'](_0x2ae870,['queue',_0x2f204a[_0x7dc2('0x12')]]);if(_0xbe2fce[_0x7dc2('0x3c')]===0x0)return _0x2b0e5c[_0x7dc2('0x3d')]=!![];if(_['some'](_0xbe2fce,[_0x7dc2('0x3e'),_0x2b0e5c[_0x7dc2('0x3f')][_0x7dc2('0x40')]()]))return _0x2b0e5c[_0x7dc2('0x22')]=!![];if(!_0x2b0e5c[_0x7dc2('0x22')])return _0x2b0e5c[_0x7dc2('0x3d')]=!![];}function getVoiceQueueAgents(_0x4eb510,_0x538af7,_0x1879fd,_0x33b7e8){var _0x996fd1=_['find'](_0x538af7,['id',_0x4eb510['id']]);if(!_0x996fd1)return _0x4eb510;return _0x996fd1[_0x7dc2('0x41')]({'raw':!![]})[_0x7dc2('0x16')](function(_0x3952e6){for(var _0x283a0b=0x0;_0x283a0b<_0x3952e6[_0x7dc2('0x3c')];_0x283a0b++){var _0x472c24=_[_0x7dc2('0x3a')](_0x1879fd,['id',_0x3952e6[_0x283a0b]['UserId']]);if(!_0x472c24){_0x472c24={'id':_0x3952e6[_0x283a0b][_0x7dc2('0x42')],'name':_0x3952e6[_0x283a0b][_0x7dc2('0x42')],'accountcode':'','online':![]};}var _0x26bc4e={'id':_0x472c24['id'],'name':_0x472c24[_0x7dc2('0x12')],'internal':_0x472c24[_0x7dc2('0x43')],'online':Boolean(_0x472c24[_0x7dc2('0x44')]),'paused':Boolean(_0x3952e6[_0x283a0b][_0x7dc2('0x23')])};if(_0x472c24[_0x7dc2('0x45')]===_0x7dc2('0x22'))updateAgentVoiceStatus(_0x26bc4e,_0x4eb510,_0x33b7e8);if(_0x26bc4e[_0x7dc2('0x44')])_0x4eb510[_0x7dc2('0x37')]++;if(_0x26bc4e[_0x7dc2('0x3d')])_0x4eb510[_0x7dc2('0x3d')]++;if(_0x26bc4e[_0x7dc2('0x23')]&&!_0x26bc4e['busy']&&!_0x26bc4e[_0x7dc2('0x22')])_0x4eb510[_0x7dc2('0x23')]++;_0x4eb510[_0x7dc2('0x36')][_0x7dc2('0x46')](_0x26bc4e);}return _0x4eb510;});}function getQueueAgents(_0x29f7de,_0x4dccaf,_0x47f33b){var _0x4ab47d=_0x7dc2('0x47')+_[_0x7dc2('0x48')](_0x47f33b)+'Queue';var _0x2e0ed6=_0x47f33b+_0x7dc2('0x49');return db[_0x4ab47d][_0x7dc2('0x4a')]({'where':{[_[_0x7dc2('0x48')](_0x47f33b)+_0x7dc2('0x4b')]:_0x29f7de['id']},'raw':!![]})[_0x7dc2('0x16')](function(_0x3e71b9){for(var _0x319bfd=0x0;_0x319bfd<_0x3e71b9[_0x7dc2('0x3c')];_0x319bfd++){var _0x2d46ba=_[_0x7dc2('0x3a')](_0x4dccaf,['id',_0x3e71b9[_0x319bfd][_0x7dc2('0x42')]]);if(!_0x2d46ba){_0x2d46ba={'id':_0x3e71b9[_0x319bfd][_0x7dc2('0x42')],'name':_0x3e71b9[_0x319bfd][_0x7dc2('0x42')],'online':![],['pauseField']:![]};}var _0x378c43={'id':_0x2d46ba['id'],'name':_0x2d46ba['name'],'online':Boolean(_0x2d46ba['online']),'paused':Boolean(_0x2d46ba[_0x2e0ed6])};if(_0x378c43['online'])_0x29f7de[_0x7dc2('0x37')]++;_0x29f7de['agents'][_0x7dc2('0x46')](_0x378c43);}return _0x29f7de;});}function isIdle(_0x24386b){return _0x24386b===_0x7dc2('0x4c')||_0x24386b===_0x7dc2('0x4d')||_0x24386b==='unavailable'||_0x24386b===_0x7dc2('0x4e')||_['isNil'](_0x24386b);}function isAgentPaused(_0x132e51,_0x47d70b){var _0x5c8ef4=[_0x132e51[_0x7dc2('0x4f')],_0x132e51[_0x7dc2('0x50')],_0x132e51[_0x7dc2('0x51')],_0x132e51['openchannelPause'],_0x132e51['smsPause'],_0x132e51['voicePause'],_0x132e51[_0x7dc2('0x52')]];if(!_0x47d70b)return _[_0x7dc2('0x53')](_0x5c8ef4);var _0x4ae6d1=_[_0x7dc2('0x54')](_0x5c8ef4);return _0x4ae6d1['length']>0x0&&_0x4ae6d1[_0x7dc2('0x3c')]<_0x5c8ef4[_0x7dc2('0x3c')]?!![]:![];}function isAgentIdle(_0x34baa3){if(_0x34baa3['voiceStatus']!==_0x7dc2('0x4c')&&_0x34baa3['voicePause']){_0x34baa3[_0x7dc2('0x45')]='pause';return![];}return _[_0x7dc2('0x53')]([_0x34baa3[_0x7dc2('0x55')],_0x34baa3[_0x7dc2('0x56')],_0x34baa3[_0x7dc2('0x57')],_0x34baa3['openchannelStatus'],_0x34baa3['smsStatus'],_0x34baa3[_0x7dc2('0x45')],_0x34baa3['whatsappStatus']],isIdle);}function getAgentStatus(_0x9c7b1){var _0x5aad98=_0x7dc2('0x4d');if(isAgentPaused(_0x9c7b1))_0x5aad98=_0x7dc2('0x58');else if(isAgentPaused(_0x9c7b1,!![]))_0x5aad98='*pause';else if(isAgentIdle(_0x9c7b1))_0x5aad98=_0x7dc2('0x4c');else _0x5aad98=_0x7dc2('0x3d');return _0x5aad98;}function validateChannel(_0x527f9b){var _0x560bee=['mail',_0x7dc2('0x59'),'sms','openchannel',_0x7dc2('0x5a'),'whatsapp',_0x7dc2('0x1b')];if(!_[_0x7dc2('0x5b')](_0x560bee,_0x527f9b[_0x7dc2('0x5c')]()))throw new Error(_0x7dc2('0x5d'));return _0x527f9b[_0x7dc2('0x5c')]();}function getFilteredAgentIds(_0x10b0a0,_0x4710c8){var _0x461859=_[_0x7dc2('0x5e')](_0x10b0a0)?_0x10b0a0:[_0x10b0a0];var _0x2122d5=_['map'](_0x461859,function(_0x49bbdb){return db[_0x4710c8][_0x7dc2('0x5f')]({'where':{'name':_0x49bbdb}})[_0x7dc2('0x16')](function(_0x211622){if(!_0x211622)return[];return _0x211622[_0x7dc2('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7dc2('0x61')](_0x2122d5)[_0x7dc2('0x16')](function(_0x4a67ef){var _0x2e42ee=_(_0x4a67ef)['flatten']()[_0x7dc2('0x34')]('id')['uniq']()['value']();return _0x2e42ee;});}function getUpdatedSortOptions(_0x607ef){var _0x1f7191={'fields':[],'order':null};var _0x1bf8bc=_0x607ef[_0x7dc2('0x62')](',');_0x1f7191['fields']=_[_0x7dc2('0x54')](_0x1bf8bc,function(_0x215c18){if(!_0x215c18[_0x7dc2('0x5b')](_0x7dc2('0x63')))return!![];_0x1f7191['order']=_[_0x7dc2('0x64')](_0x215c18,'-')?_0x7dc2('0x65'):'ASC';return![];});return _0x1f7191;}function orderAgentsByStatus(_0xe81969,_0x36f7b7){return _0xe81969[_0x7dc2('0x66')](function(_0x109d31,_0x52503f){if(_0x109d31['globalStatus']===_0x52503f[_0x7dc2('0x63')]&&_0x109d31['globalStatus']===_0x7dc2('0x58')){if(_0x36f7b7==='DESC')return(_0x109d31[_0x7dc2('0x67')]||'')<(_0x52503f[_0x7dc2('0x67')]||'')?0x1:-0x1;return _0x109d31[_0x7dc2('0x67')]<_0x52503f[_0x7dc2('0x67')]?-0x1:0x1;}else{if(_0x36f7b7===_0x7dc2('0x65'))return _0x109d31[_0x7dc2('0x63')]<_0x52503f[_0x7dc2('0x63')]?0x1:-0x1;return _0x109d31[_0x7dc2('0x63')]<_0x52503f[_0x7dc2('0x63')]?-0x1:0x1;}});}exports[_0x7dc2('0x60')]=function(_0x2fe1c2,_0x19d437){var _0x49e3f7={'count':0x0,'rows':[]},_0x5c0512={},_0x22639c,_0x64f36f,_0x53c740,_0x8270ed,_0x364075=['userpic',_0x7dc2('0x44'),_0x7dc2('0x68'),_0x7dc2('0x69'),_0x7dc2('0x67'),'lastPauseAt','internal',_0x7dc2('0x6a'),'chatPause',_0x7dc2('0x6b'),_0x7dc2('0x51'),_0x7dc2('0x6c'),_0x7dc2('0x52'),_0x7dc2('0x50'),_0x7dc2('0x6d'),_0x7dc2('0x6e'),'openchannelCapacity',_0x7dc2('0x6f'),_0x7dc2('0x70'),_0x7dc2('0x71'),_0x7dc2('0x72'),_0x7dc2('0x73'),_0x7dc2('0x74'),_0x7dc2('0x75'),_0x7dc2('0x76'),_0x7dc2('0x77'),_0x7dc2('0x78'),_0x7dc2('0x55'),'openchannelStatus',_0x7dc2('0x57'),'smsStatus',_0x7dc2('0x79'),'faxStatus',_0x7dc2('0x45'),'chatStatusTime','openchannelStatusTime',_0x7dc2('0x7a'),_0x7dc2('0x7b'),'whatsappStatusTime','faxStatusTime','voiceStatusTime',_0x7dc2('0x7c'),_0x7dc2('0x7d'),_0x7dc2('0x7e'),'phoneBarEnableScreenRecordingByAgent',_0x7dc2('0x7f'),_0x7dc2('0x80')],_0x464fb4=[_0x7dc2('0x4f'),_0x7dc2('0x6b'),_0x7dc2('0x51'),'smsPause',_0x7dc2('0x52'),_0x7dc2('0x50'),_0x7dc2('0x6d'),'online'];Promise[_0x7dc2('0x81')]()[_0x7dc2('0x16')](function(){if(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x83')])_0x22639c=validateChannel(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x83')]);if(!_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x66')]||!_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x66')][_0x7dc2('0x5b')](_0x7dc2('0x63')))return;var _0x1edf67=getUpdatedSortOptions(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x66')]);_0x2fe1c2['query'][_0x7dc2('0x66')]=_0x1edf67[_0x7dc2('0x84')][_0x7dc2('0x85')](',');_0x64f36f=_0x1edf67[_0x7dc2('0x86')];})[_0x7dc2('0x16')](function(){if(!_0x2fe1c2[_0x7dc2('0x82')]['globalQueueFilter'])return[];var _0x47eaaa=_[_0x7dc2('0x48')](_0x22639c)+'Queue';return getFilteredAgentIds(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x87')],_0x47eaaa);})[_0x7dc2('0x16')](function(_0x3fe1aa){var _0x24722e=_[_0x7dc2('0x34')](db[_0x7dc2('0x47')][_0x7dc2('0x88')],function(_0x37ab2e){return{'name':_0x37ab2e['fieldName'],'type':_0x37ab2e[_0x7dc2('0x89')][_0x7dc2('0x8a')]};});_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x8b')]=_0x7dc2('0x8c');_0x2fe1c2['query'][_0x7dc2('0x44')]=!![];_0x5c0512=qs[_0x7dc2('0x8d')](_0x24722e,_0x2fe1c2);_0x5c0512['raw']=!![];if(!_[_0x7dc2('0x8e')](_0x3fe1aa)){_0x5c0512[_0x7dc2('0x8f')]=_[_0x7dc2('0x90')](_0x5c0512[_0x7dc2('0x8f')],{'$and':[{'id':{'$in':_0x3fe1aa}}]});}else if(!_[_0x7dc2('0x8e')](_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x87')])){return _0x49e3f7;}if(_0x2fe1c2['user']['role']===_0x7dc2('0x91')){var _0x9c97b9={'params':{'id':_0x2fe1c2[_0x7dc2('0x91')][_0x7dc2('0x92')]},'query':{'section':_0x7dc2('0x15'),'role':_0x7dc2('0x8c'),'online':!![],'nolimit':_0x2fe1c2[_0x7dc2('0x82')]['nolimit'],'sort':_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x66')],'filter':_0x2fe1c2[_0x7dc2('0x82')]['filter'],'raw':!![],'ids':_0x3fe1aa}};return db[_0x7dc2('0x93')][_0x7dc2('0x94')](_0x9c97b9);}return db[_0x7dc2('0x47')][_0x7dc2('0x95')](_0x5c0512);})[_0x7dc2('0x16')](function(_0x5aded2){_0x49e3f7[_0x7dc2('0xb')]=_0x5aded2[_0x7dc2('0xb')];_0x53c740=_0x5aded2[_0x7dc2('0x96')];return getRealtimeAgents();})[_0x7dc2('0x16')](function(_0x3d9edc){_0x8270ed=_0x3d9edc[_0x7dc2('0x96')];return _0x53c740[_0x7dc2('0x34')](function(_0x2729ed){var _0x46d23a=_['find'](_0x8270ed,['id',_0x2729ed['id']]);if(_0x46d23a)_[_0x7dc2('0x90')](_0x2729ed,_[_0x7dc2('0x3b')](_[_0x7dc2('0x97')](_0x46d23a,_0x464fb4),_0x364075));_0x2729ed['globalStatus']=getAgentStatus(_0x2729ed);return _0x2729ed;});})[_0x7dc2('0x16')](function(_0x237627){var _0x37a872;if(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x98')]){_0x37a872=_[_0x7dc2('0x54')](_0x237627,[_0x7dc2('0x63'),_0x2fe1c2[_0x7dc2('0x82')]['globalStatusFilter']]);if(_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x99')]){_0x37a872=_[_0x7dc2('0x54')](_0x37a872,[_0x7dc2('0x67'),_0x2fe1c2[_0x7dc2('0x82')][_0x7dc2('0x99')]]);}}if(_0x37a872)_0x237627=_0x37a872;if(!_0x64f36f)return _0x237627;return orderAgentsByStatus(_0x237627,_0x64f36f);})[_0x7dc2('0x16')](function(_0x41186e){_0x49e3f7[_0x7dc2('0x96')]=_0x41186e;return _0x49e3f7;})['then'](respondWithFilteredResult(_0x19d437,_0x5c0512))['catch'](handleError(_0x19d437,null));};exports[_0x7dc2('0x9a')]=function(_0x41b579,_0x1a3e15){var _0x2cc80d={'count':0x0,'rows':[]},_0x1d2843={},_0x142a9c,_0x37325f,_0x34a155,_0x39ff56,_0x815452;Promise['resolve']()['then'](function(){if(_0x41b579['query'][_0x7dc2('0x83')])_0x142a9c=validateChannel(_0x41b579[_0x7dc2('0x82')]['channel']);var _0x5b3e7c=_[_0x7dc2('0x48')](_0x142a9c)+_0x7dc2('0x9b');var _0x58bfa6=_[_0x7dc2('0x34')](db[_0x5b3e7c][_0x7dc2('0x88')],function(_0x41256d){return{'name':_0x41256d[_0x7dc2('0x9c')],'type':_0x41256d[_0x7dc2('0x89')][_0x7dc2('0x8a')]};});_0x1d2843=qs[_0x7dc2('0x8d')](_0x58bfa6,_0x41b579);if(_0x41b579[_0x7dc2('0x91')][_0x7dc2('0x8b')]===_0x7dc2('0x91')){var _0x4a7471={'params':{'id':_0x41b579[_0x7dc2('0x91')][_0x7dc2('0x92')]},'query':{'section':_0x142a9c===_0x7dc2('0x1b')&&_0x41b579[_0x7dc2('0x82')][_0x7dc2('0x89')]==='outbound'?_0x7dc2('0x9d'):_['startCase'](_0x142a9c)+_0x7dc2('0x1c'),'type':_0x41b579[_0x7dc2('0x82')]['type'],'nolimit':!![],'sort':_0x7dc2('0x12'),'filter':_0x41b579['query']['filter']}};return db['UserProfile'][_0x7dc2('0x94')](_0x4a7471);}return db[_0x5b3e7c][_0x7dc2('0x95')](_0x1d2843);})[_0x7dc2('0x16')](function(_0x3f0738){_0x2cc80d['count']=_0x3f0738[_0x7dc2('0xb')];_0x37325f=_0x3f0738[_0x7dc2('0x96')];return getRealtimeQueues(_0x41b579,_0x142a9c);})[_0x7dc2('0x16')](function(_0x29eaed){_0x39ff56=_0x29eaed[_0x7dc2('0x96')];return getRealtimeAgents();})[_0x7dc2('0x16')](function(_0xcebd6c){_0x34a155=_0xcebd6c['rows'];if(_0x142a9c!=_0x7dc2('0x1b'))return;return getRealtimeVoiceQueueChannels();})[_0x7dc2('0x16')](function(_0x4e52cc){_0x815452=_0x4e52cc?_0x4e52cc['rows']:[];return initializeQueues(_0x37325f,_0x39ff56,_0x142a9c,_0x41b579[_0x7dc2('0x82')][_0x7dc2('0x89')]);})[_0x7dc2('0x16')](function(_0x53b3ae){var _0xa1bdd4=_0x53b3ae['map'](function(_0x4b0521){if(_0x142a9c===_0x7dc2('0x1b'))return getVoiceQueueAgents(_0x4b0521,_0x37325f,_0x34a155,_0x815452);else return getQueueAgents(_0x4b0521,_0x34a155,_0x142a9c);});return Promise[_0x7dc2('0x61')](_0xa1bdd4);})[_0x7dc2('0x16')](function(_0x221e5d){_0x2cc80d['rows']=_0x221e5d;return _0x2cc80d;})[_0x7dc2('0x16')](respondWithFilteredResult(_0x1a3e15,_0x1d2843))[_0x7dc2('0x1a')](handleError(_0x1a3e15,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9a1628b..7a1e46a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c622c,_0x3bc4ff){var _0x3641a7=function(_0x2d5eca){while(--_0x2d5eca){_0x5c622c['push'](_0x5c622c['shift']());}};_0x3641a7(++_0x3bc4ff);}(_0xe706,0xa3));var _0x6e70=function(_0x3a096c,_0x1f9d72){_0x3a096c=_0x3a096c-0x0;var _0x44a6a4=_0xe706[_0x3a096c];return _0x44a6a4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2b6d46,_0x11867e){var _0x555bdb=function(_0x11122d){while(--_0x11122d){_0x2b6d46['push'](_0x2b6d46['shift']());}};_0x555bdb(++_0x11867e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 33423d0..212fcf5 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 _0x1a28=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x123333,_0x3027b0){var _0x253ce2=function(_0x3c22d7){while(--_0x3c22d7){_0x123333['push'](_0x123333['shift']());}};_0x253ce2(++_0x3027b0);}(_0x1a28,0x10e));var _0x81a2=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x1a28[_0x378891];return _0xfbfda2;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'state':{'type':Sequelize[_0x81a2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x81a2('0x3')]},'scheduledat':{'type':Sequelize[_0x81a2('0x4')]},'uniqueid':{'type':Sequelize[_0x81a2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x81a2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x81a2('0x3')]},'campaigntype':{'type':Sequelize[_0x81a2('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa87e=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0xc2ee77,_0x3d65b1){var _0x1afeb2=function(_0x435af8){while(--_0x435af8){_0xc2ee77['push'](_0xc2ee77['shift']());}};_0x1afeb2(++_0x3d65b1);}(_0xa87e,0x1c2));var _0xea87=function(_0x5bb5de,_0x192c4c){_0x5bb5de=_0x5bb5de-0x0;var _0x15de2b=_0xa87e[_0x5bb5de];return _0x15de2b;};'use strict';var Sequelize=require(_0xea87('0x0'));module[_0xea87('0x1')]={'state':{'type':Sequelize[_0xea87('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xea87('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xea87('0x3')]},'starttime':{'type':Sequelize[_0xea87('0x4')]},'responsetime':{'type':Sequelize[_0xea87('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xea87('0x3')]},'campaigntype':{'type':Sequelize[_0xea87('0x3')]},'membername':{'type':Sequelize[_0xea87('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 99a4cdf..0dbf169 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 _0xaefe=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x242f65,_0x3afbe7){var _0x10dc70=function(_0x24b760){while(--_0x24b760){_0x242f65['push'](_0x242f65['shift']());}};_0x10dc70(++_0x3afbe7);}(_0xaefe,0x139));var _0xeaef=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xaefe[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xeaef('0x0'));var util=require(_0xeaef('0x1'));var logger=require(_0xeaef('0x2'))(_0xeaef('0x3'));var moment=require(_0xeaef('0x4'));var BPromise=require(_0xeaef('0x5'));var rp=require(_0xeaef('0x6'));var fs=require('fs');var path=require(_0xeaef('0x7'));var rimraf=require(_0xeaef('0x8'));var config=require(_0xeaef('0x9'));var attributes=require(_0xeaef('0xa'));module['exports']=function(_0x210f7b,_0x174470){return _0x210f7b[_0xeaef('0xb')](_0xeaef('0xc'),attributes,{'tableName':_0xeaef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2df3=['define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xfae43b,_0x1c8d47){var _0x226f4e=function(_0xa12c37){while(--_0xa12c37){_0xfae43b['push'](_0xfae43b['shift']());}};_0x226f4e(++_0x1c8d47);}(_0x2df3,0x107));var _0x32df=function(_0x58ab56,_0x123c7c){_0x58ab56=_0x58ab56-0x0;var _0x5ec03e=_0x2df3[_0x58ab56];return _0x5ec03e;};'use strict';var _=require('lodash');var util=require(_0x32df('0x0'));var logger=require(_0x32df('0x1'))(_0x32df('0x2'));var moment=require(_0x32df('0x3'));var BPromise=require(_0x32df('0x4'));var rp=require(_0x32df('0x5'));var fs=require('fs');var path=require(_0x32df('0x6'));var rimraf=require(_0x32df('0x7'));var config=require(_0x32df('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x32df('0x9')]=function(_0x1f2591,_0x282540){return _0x1f2591[_0x32df('0xa')](_0x32df('0xb'),attributes,{'tableName':_0x32df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ae2d6f9..723bc46 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 _0x3fe9=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then'];(function(_0x1fd8f3,_0x71eecf){var _0x17cb3b=function(_0x49c067){while(--_0x49c067){_0x1fd8f3['push'](_0x1fd8f3['shift']());}};_0x17cb3b(++_0x71eecf);}(_0x3fe9,0x106));var _0x93fe=function(_0x281448,_0x35f65a){_0x281448=_0x281448-0x0;var _0x58b162=_0x3fe9[_0x281448];return _0x58b162;};'use strict';var _=require(_0x93fe('0x0'));var util=require(_0x93fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93fe('0x2'));var fs=require('fs');var Redis=require(_0x93fe('0x3'));var db=require(_0x93fe('0x4'))['db'];var utils=require(_0x93fe('0x5'));var logger=require('../../config/logger')(_0x93fe('0x6'));var config=require(_0x93fe('0x7'));var jayson=require(_0x93fe('0x8'));var client=jayson[_0x93fe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f7195,_0x40b7d3,_0x148776){return new BPromise(function(_0x34cd8a,_0x4fc055){return client[_0x93fe('0xa')](_0x3f7195,_0x148776)['then'](function(_0x5b0b5d){logger['info'](_0x93fe('0xb'),_0x40b7d3,_0x93fe('0xc'));logger[_0x93fe('0xd')](_0x93fe('0xe'),_0x40b7d3,_0x93fe('0xc'),JSON['stringify'](_0x5b0b5d));if(_0x5b0b5d[_0x93fe('0xf')]){if(_0x5b0b5d[_0x93fe('0xf')][_0x93fe('0x10')]===0x1f4){logger[_0x93fe('0xf')](_0x93fe('0xb'),_0x40b7d3,_0x5b0b5d['error'][_0x93fe('0x11')]);return _0x4fc055(_0x5b0b5d[_0x93fe('0xf')][_0x93fe('0x11')]);}logger[_0x93fe('0xf')](_0x93fe('0xb'),_0x40b7d3,_0x5b0b5d['error'][_0x93fe('0x11')]);return _0x34cd8a(_0x5b0b5d['error'][_0x93fe('0x11')]);}else{logger[_0x93fe('0x12')](_0x93fe('0xb'),_0x40b7d3,'request\x20sent');_0x34cd8a(_0x5b0b5d[_0x93fe('0x13')][_0x93fe('0x11')]);}})[_0x93fe('0x14')](function(_0x268508){logger[_0x93fe('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x40b7d3,_0x268508);_0x4fc055(_0x268508);});});}exports[_0x93fe('0x15')]=function(_0x142f70){var _0x426141=this;return new Promise(function(_0x294103,_0x139fe3){return db[_0x93fe('0x16')][_0x93fe('0x17')](_0x142f70[_0x93fe('0x18')],{'raw':_0x142f70['options']?_0x142f70[_0x93fe('0x19')][_0x93fe('0x1a')]===undefined?!![]:![]:!![]})[_0x93fe('0x1b')](function(_0xfc826d){logger[_0x93fe('0x12')](_0x93fe('0x15'),_0x142f70);logger['debug'](_0x93fe('0x15'),_0x142f70,JSON[_0x93fe('0x1c')](_0xfc826d));_0x294103(_0xfc826d);})[_0x93fe('0x14')](function(_0x361916){logger['error'](_0x93fe('0x15'),_0x361916[_0x93fe('0x11')],_0x142f70);_0x139fe3(_0x426141[_0x93fe('0xf')](0x1f4,_0x361916[_0x93fe('0x11')]));});});}; \ No newline at end of file +var _0xfa5d=['../../config/environment','jayson/promise','http','then','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','randomstring','ioredis','../../config/logger'];(function(_0x3f4759,_0x4360b4){var _0x449c3c=function(_0x15667b){while(--_0x15667b){_0x3f4759['push'](_0x3f4759['shift']());}};_0x449c3c(++_0x4360b4);}(_0xfa5d,0x19e));var _0xdfa5=function(_0x3e7aeb,_0x3eb769){_0x3e7aeb=_0x3e7aeb-0x0;var _0x17945e=_0xfa5d[_0x3e7aeb];return _0x17945e;};'use strict';var _=require(_0xdfa5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfa5('0x1'));var fs=require('fs');var Redis=require(_0xdfa5('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdfa5('0x3'))('rpc');var config=require(_0xdfa5('0x4'));var jayson=require(_0xdfa5('0x5'));var client=jayson['client'][_0xdfa5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4adbed,_0x11f237,_0x16c8de){return new BPromise(function(_0x527510,_0x376ea9){return client['request'](_0x4adbed,_0x16c8de)[_0xdfa5('0x7')](function(_0x64995c){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x11f237,_0xdfa5('0x8'));logger[_0xdfa5('0x9')](_0xdfa5('0xa'),_0x11f237,_0xdfa5('0x8'),JSON[_0xdfa5('0xb')](_0x64995c));if(_0x64995c[_0xdfa5('0xc')]){if(_0x64995c[_0xdfa5('0xc')]['code']===0x1f4){logger['error'](_0xdfa5('0xd'),_0x11f237,_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);return _0x376ea9(_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);}logger[_0xdfa5('0xc')](_0xdfa5('0xd'),_0x11f237,_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);return _0x527510(_0x64995c[_0xdfa5('0xc')][_0xdfa5('0xe')]);}else{logger['info'](_0xdfa5('0xd'),_0x11f237,_0xdfa5('0x8'));_0x527510(_0x64995c['result'][_0xdfa5('0xe')]);}})[_0xdfa5('0xf')](function(_0x5b0dab){logger[_0xdfa5('0xc')](_0xdfa5('0xd'),_0x11f237,_0x5b0dab);_0x376ea9(_0x5b0dab);});});}exports['CreateReportAgentPreview']=function(_0x2a98c4){var _0x35ecea=this;return new Promise(function(_0xe8ba17,_0x518ab7){return db[_0xdfa5('0x10')][_0xdfa5('0x11')](_0x2a98c4[_0xdfa5('0x12')],{'raw':_0x2a98c4[_0xdfa5('0x13')]?_0x2a98c4[_0xdfa5('0x13')][_0xdfa5('0x14')]===undefined?!![]:![]:!![]})[_0xdfa5('0x7')](function(_0x1dbe1e){logger['info'](_0xdfa5('0x15'),_0x2a98c4);logger[_0xdfa5('0x9')](_0xdfa5('0x15'),_0x2a98c4,JSON[_0xdfa5('0xb')](_0x1dbe1e));_0xe8ba17(_0x1dbe1e);})[_0xdfa5('0xf')](function(_0x49bad7){logger[_0xdfa5('0xc')]('CreateReportAgentPreview',_0x49bad7[_0xdfa5('0xe')],_0x2a98c4);_0x518ab7(_0x35ecea[_0xdfa5('0xc')](0x1f4,_0x49bad7[_0xdfa5('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index aa79e93..d948f35 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 _0x0c83=['/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','util','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','/telephones','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0x3c34bc,_0x9369eb){var _0x3b4410=function(_0x51a593){while(--_0x51a593){_0x3c34bc['push'](_0x3c34bc['shift']());}};_0x3b4410(++_0x9369eb);}(_0x0c83,0xc1));var _0x30c8=function(_0x1f4b4d,_0x129edd){_0x1f4b4d=_0x1f4b4d-0x0;var _0x4bbc2f=_0x0c83[_0x1f4b4d];return _0x4bbc2f;};'use strict';var multer=require(_0x30c8('0x0'));var util=require(_0x30c8('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x30c8('0x2'));var controller=require(_0x30c8('0x3'));router[_0x30c8('0x4')](_0x30c8('0x5'),auth['isAuthenticated'](),controller[_0x30c8('0x6')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x30c8('0x7')]);router[_0x30c8('0x4')](_0x30c8('0x8'),auth[_0x30c8('0x9')](),controller[_0x30c8('0xa')]);router[_0x30c8('0x4')](_0x30c8('0xb'),auth[_0x30c8('0x9')](),controller['voiceQueues']);router[_0x30c8('0x4')]('/chat/queues',auth[_0x30c8('0x9')](),controller[_0x30c8('0xc')]);router[_0x30c8('0x4')]('/mail/queues',auth['isAuthenticated'](),controller[_0x30c8('0xd')]);router[_0x30c8('0x4')](_0x30c8('0xe'),auth['isAuthenticated'](),controller[_0x30c8('0xf')]);router[_0x30c8('0x4')](_0x30c8('0x10'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x11')]);router[_0x30c8('0x4')](_0x30c8('0x12'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x13')]);router['get']('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x30c8('0x14')]);router[_0x30c8('0x4')](_0x30c8('0x15'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x16')]);router[_0x30c8('0x4')]('/voice/queues/preview/:id',auth[_0x30c8('0x9')](),controller[_0x30c8('0x17')]);router[_0x30c8('0x4')]('/voice/queues/channels',auth[_0x30c8('0x9')](),controller['voiceQueuesChannels']);router['get'](_0x30c8('0x18'),auth[_0x30c8('0x9')](),controller['voiceQueuesChannel']);router[_0x30c8('0x4')](_0x30c8('0x19'),auth['isAuthenticated'](),controller[_0x30c8('0x1a')]);router[_0x30c8('0x4')](_0x30c8('0x1b'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x1c')]);router[_0x30c8('0x4')]('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x30c8('0x1d')]);router[_0x30c8('0x1e')](_0x30c8('0x1f'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x20')]);router[_0x30c8('0x4')](_0x30c8('0x21'),auth['isAuthenticated'](),controller[_0x30c8('0x22')]);router[_0x30c8('0x4')]('/outbound/channels',auth[_0x30c8('0x9')](),controller[_0x30c8('0x23')]);router['get']('/agents',auth['isAuthenticated'](),controller[_0x30c8('0x24')]);router[_0x30c8('0x1e')](_0x30c8('0x25'),auth[_0x30c8('0x9')](),controller['agentCapacity']);router[_0x30c8('0x4')](_0x30c8('0x26'),auth[_0x30c8('0x9')](),controller['telephones']);router['get']('/trunks',auth[_0x30c8('0x9')](),controller[_0x30c8('0x27')]);router[_0x30c8('0x4')](_0x30c8('0x28'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x29')]);router[_0x30c8('0x4')]('/fax/accounts',auth[_0x30c8('0x9')](),controller[_0x30c8('0x2a')]);router['get'](_0x30c8('0x2b'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x2c')]);router[_0x30c8('0x4')](_0x30c8('0x2d'),auth['isAuthenticated'](),controller[_0x30c8('0x2e')]);router[_0x30c8('0x4')](_0x30c8('0x2f'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x30c8('0x30'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x31')]);router[_0x30c8('0x4')](_0x30c8('0x32'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x33')]);router['get'](_0x30c8('0x34'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x35')]);router[_0x30c8('0x4')](_0x30c8('0x36'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x37')]);router[_0x30c8('0x38')](_0x30c8('0x39'),auth[_0x30c8('0x9')](),controller['queueNotify'](_0x30c8('0x3a')));router[_0x30c8('0x4')](_0x30c8('0x3b'),auth['isAuthenticated'](),controller[_0x30c8('0x3c')]);router[_0x30c8('0x38')](_0x30c8('0x3d'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x3e')](_0x30c8('0x3f')));router[_0x30c8('0x4')](_0x30c8('0x40'),auth[_0x30c8('0x9')](),controller['showChatQueues']);router['post'](_0x30c8('0x41'),auth[_0x30c8('0x9')](),controller['queueNotify'](_0x30c8('0x42')));router[_0x30c8('0x4')](_0x30c8('0x43'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x44')]);router[_0x30c8('0x38')](_0x30c8('0x45'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x3e')]('openchannel'));router['get'](_0x30c8('0x46'),auth[_0x30c8('0x9')](),controller['showOpenchannelQueues']);router[_0x30c8('0x38')](_0x30c8('0x47'),auth[_0x30c8('0x9')](),controller['queueNotify'](_0x30c8('0x48')));router[_0x30c8('0x38')](_0x30c8('0x49'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x3e')](_0x30c8('0x4a')));router[_0x30c8('0x4')](_0x30c8('0x4b'),auth[_0x30c8('0x9')](),controller[_0x30c8('0x4c')]);router[_0x30c8('0x4')](_0x30c8('0x4d'),auth[_0x30c8('0x9')](),controller['showWhatsappQueues']);router[_0x30c8('0x38')]('/agents/:id/notify',auth[_0x30c8('0x9')](),controller[_0x30c8('0x4e')]);module[_0x30c8('0x4f')]=router; \ No newline at end of file +var _0xef52=['/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','path','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xef52,0x1c2));var _0x2ef5=function(_0x3b0999,_0x3c9835){_0x3b0999=_0x3b0999-0x0;var _0x585226=_0xef52[_0x3b0999];return _0x585226;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2ef5('0x0'));var express=require(_0x2ef5('0x1'));var router=express['Router']();var auth=require(_0x2ef5('0x2'));var controller=require(_0x2ef5('0x3'));router['get'](_0x2ef5('0x4'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x6')]);router[_0x2ef5('0x7')](_0x2ef5('0x8'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x9')]);router['get'](_0x2ef5('0xa'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0xb')]);router['get'](_0x2ef5('0xc'),auth['isAuthenticated'](),controller[_0x2ef5('0xd')]);router[_0x2ef5('0x7')]('/chat/queues',auth[_0x2ef5('0x5')](),controller[_0x2ef5('0xe')]);router[_0x2ef5('0x7')](_0x2ef5('0xf'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x10')]);router['get'](_0x2ef5('0x11'),auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0x2ef5('0x12'),auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x2ef5('0x7')]('/sms/queues',auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x13')]);router['get'](_0x2ef5('0x14'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x15')]);router[_0x2ef5('0x7')](_0x2ef5('0x16'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x17')]);router[_0x2ef5('0x7')](_0x2ef5('0x18'),auth[_0x2ef5('0x5')](),controller['voiceQueuesPreview']);router[_0x2ef5('0x7')](_0x2ef5('0x19'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x1a')]);router[_0x2ef5('0x7')](_0x2ef5('0x1b'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x1c')]);router[_0x2ef5('0x7')](_0x2ef5('0x1d'),auth['isAuthenticated'](),controller[_0x2ef5('0x1e')]);router['get'](_0x2ef5('0x1f'),auth['isAuthenticated'](),controller[_0x2ef5('0x20')]);router[_0x2ef5('0x7')](_0x2ef5('0x21'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x22')]);router[_0x2ef5('0x23')](_0x2ef5('0x21'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x24')]);router[_0x2ef5('0x7')](_0x2ef5('0x25'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x26')]);router[_0x2ef5('0x7')]('/outbound/channels',auth[_0x2ef5('0x5')](),controller['outboundChannels']);router[_0x2ef5('0x7')](_0x2ef5('0x27'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x28')]);router['put'](_0x2ef5('0x29'),auth[_0x2ef5('0x5')](),controller['agentCapacity']);router[_0x2ef5('0x7')](_0x2ef5('0x2a'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x2b')]);router[_0x2ef5('0x7')](_0x2ef5('0x2c'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x2d')]);router['get'](_0x2ef5('0x2e'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x2f')]);router[_0x2ef5('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x2ef5('0x7')]('/chat/queues/waitinginteractions',auth[_0x2ef5('0x5')](),controller['chatQueuesWaitingInteractions']);router[_0x2ef5('0x7')](_0x2ef5('0x30'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x31')]);router[_0x2ef5('0x7')](_0x2ef5('0x32'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2ef5('0x7')](_0x2ef5('0x33'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x34')]);router[_0x2ef5('0x7')](_0x2ef5('0x35'),auth['isAuthenticated'](),controller[_0x2ef5('0x36')]);router[_0x2ef5('0x7')](_0x2ef5('0x37'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x38')]);router['get'](_0x2ef5('0x39'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x3a')]);router[_0x2ef5('0x3b')](_0x2ef5('0x3c'),auth[_0x2ef5('0x5')](),controller['queueNotify']('mail'));router[_0x2ef5('0x7')](_0x2ef5('0x3d'),auth[_0x2ef5('0x5')](),controller['showMailQueues']);router[_0x2ef5('0x3b')](_0x2ef5('0x3e'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x3f')](_0x2ef5('0x40')));router['get'](_0x2ef5('0x41'),auth[_0x2ef5('0x5')](),controller['showChatQueues']);router[_0x2ef5('0x3b')](_0x2ef5('0x42'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x3f')](_0x2ef5('0x43')));router[_0x2ef5('0x7')](_0x2ef5('0x44'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x45')]);router[_0x2ef5('0x3b')]('/openchannel/queues/:id/notify',auth[_0x2ef5('0x5')](),controller['queueNotify']('openchannel'));router['get'](_0x2ef5('0x46'),auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x47')]);router[_0x2ef5('0x3b')](_0x2ef5('0x48'),auth[_0x2ef5('0x5')](),controller['queueNotify']('sms'));router[_0x2ef5('0x3b')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x2ef5('0x49')));router[_0x2ef5('0x7')]('/sms/queues/:id',auth[_0x2ef5('0x5')](),controller[_0x2ef5('0x4a')]);router[_0x2ef5('0x7')](_0x2ef5('0x4b'),auth[_0x2ef5('0x5')](),controller['showWhatsappQueues']);router[_0x2ef5('0x3b')](_0x2ef5('0x4c'),auth[_0x2ef5('0x5')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e601f56..dd04fbd 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 _0x7da7=['value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','isNil','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','create','Start','Account','queue','agentNotify','channel','User','Agent\x20not\x20found','InteractionId','bluebird','moment','lodash','../../config/logger','api','client','http','request','error','message','catch','status','json','name','send','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','then','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agentCapacity','interaction','user','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','SIP/%s','INTERACTION','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','showWhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x7da7,0x10d));var _0x77da=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x7da7[_0x4653f7];return _0x5454da;};'use strict';var BPromise=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));var _=require(_0x77da('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x77da('0x3'))(_0x77da('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x77da('0x5')][_0x77da('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x77da('0x6')]({'port':0x232b});var routingClient=jayson[_0x77da('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){var _0x910e5b=_0x1191de?_0x1191de:amiClient;return _0x910e5b[_0x77da('0x7')](_0x30afe0,_0x47cf1d)['then'](function(_0x40c86e){if(_0x40c86e[_0x77da('0x8')]){if(_0x40c86e[_0x77da('0x8')]['code']===0x1f4){return _0x37c5ab(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}return _0x13992e(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}else{_0x13992e(_0x40c86e['result']);}})[_0x77da('0xa')](function(_0x3bcea0){_0x37c5ab(_0x3bcea0);});});}function respondWithResult(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xc8;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0xb')](_0x5d6e2f)[_0x77da('0xc')](_0x4a7748);}return _0x2acc65['sendStatus'](0x194);};}function handleError(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0x1f4;return function(_0x355719){logger[_0x77da('0x8')](_0x355719['stack']);if(_0x355719[_0x77da('0xd')]){delete _0x355719['name'];}_0x3b0ff2[_0x77da('0xb')](_0x369df0)[_0x77da('0xe')](_0x355719);};}function findById(_0x1b0e17){return function(_0x4500c4){if(!_['isNil'](_0x1b0e17)&&!_['isNil'](_0x4500c4)&&!_['isNil'](_0x4500c4['rows'])){return _[_0x77da('0xf')](_0x4500c4[_0x77da('0x10')],function(_0x289887){return _0x289887['id']==_0x1b0e17;});}return null;};}exports[_0x77da('0x11')]=function(_0x19a00c,_0x12d2b1){return respondWithRpcPromise(_0x77da('0x12'),_0x19a00c[_0x77da('0x13')])['then'](respondWithResult(_0x12d2b1,null))['catch'](handleError(_0x12d2b1,null));};exports[_0x77da('0x14')]=function(_0x4d1512,_0x507979){return respondWithRpcPromise(_0x77da('0x15'),_[_0x77da('0x16')](_0x4d1512[_0x77da('0x13')],_0x4d1512['params']))['then'](respondWithResult(_0x507979,null))[_0x77da('0xa')](handleError(_0x507979,null));};exports['voiceChannelStopMixMonitor']=function(_0x175ac4,_0x1c27aa){return respondWithRpcPromise(_0x77da('0x17'),_[_0x77da('0x16')](_0x175ac4[_0x77da('0x13')],_0x175ac4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x1c27aa,null))['catch'](handleError(_0x1c27aa,null));};exports['voiceQueues']=function(_0xfd160,_0x2d009f){return respondWithRpcPromise(_0x77da('0x1a'),_0xfd160[_0x77da('0x13')])['then'](respondWithResult(_0x2d009f,null))[_0x77da('0xa')](handleError(_0x2d009f,null));};exports[_0x77da('0x1b')]=function(_0x470c9f,_0x36115b){return respondWithRpcPromise(_0x77da('0x1a'),_0x470c9f['query'])[_0x77da('0x19')](findById(_0x470c9f[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x36115b,null))[_0x77da('0xa')](handleError(_0x36115b,null));};exports['updateVoiceQueue']=function(_0x5b4638,_0x4d395a){return respondWithRpcPromise(_0x77da('0x1c'),_[_0x77da('0x16')](_0x5b4638[_0x77da('0x1d')],_0x5b4638[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x4d395a,null))['catch'](handleError(_0x4d395a,null));};exports[_0x77da('0x1e')]=function(_0x26f5a0,_0x356bfb){return respondWithRpcPromise(_0x77da('0x1f'),_[_0x77da('0x16')](_0x26f5a0[_0x77da('0x13')],_0x26f5a0['params']))[_0x77da('0x19')](respondWithResult(_0x356bfb,null))[_0x77da('0xa')](handleError(_0x356bfb,null));};exports[_0x77da('0x20')]=function(_0x38643a,_0x3c3c64){return respondWithRpcPromise(_0x77da('0x21'),_0x38643a[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x3c3c64,null))['catch'](handleError(_0x3c3c64,null));};exports['voiceQueuesChannel']=function(_0x1366b4,_0x8e6181){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x77da('0x16')](_0x1366b4[_0x77da('0x13')],_0x1366b4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x8e6181,null))[_0x77da('0xa')](handleError(_0x8e6181,null));};exports[_0x77da('0x22')]=function(_0x20d1cc,_0x5c4a03){return respondWithRpcPromise(_0x77da('0x23'),_['merge'](_0x20d1cc['query'],_0x20d1cc['params']))[_0x77da('0x19')](respondWithResult(_0x5c4a03,null))['catch'](handleError(_0x5c4a03,null));};exports[_0x77da('0x24')]=function(_0xdac1a4,_0xce9df2){return respondWithRpcPromise(_0x77da('0x25'),_[_0x77da('0x16')](_0xdac1a4[_0x77da('0x13')],_0xdac1a4[_0x77da('0x18')]))['then'](respondWithResult(_0xce9df2,null))[_0x77da('0xa')](handleError(_0xce9df2,null));};exports[_0x77da('0x26')]=function(_0x1ca53a,_0x32785f){return respondWithRpcPromise(_0x77da('0x27'),_0x1ca53a[_0x77da('0x13')])['then'](respondWithResult(_0x32785f,null))[_0x77da('0xa')](handleError(_0x32785f,null));};exports[_0x77da('0x28')]=function(_0x2cd190,_0x4d04cd){return respondWithRpcPromise(_0x77da('0x29'),_0x2cd190['query'])['then'](respondWithResult(_0x4d04cd,null))['catch'](handleError(_0x4d04cd,null));};exports['agents']=function(_0x19f9f7,_0x1adba5){var _0xebdea1;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')])['then'](function(_0xf79c20){_0xebdea1=_0xf79c20;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')],routingClient);})[_0x77da('0x19')](function(_0x290667){return _[_0x77da('0x16')]({},_0x290667,_0xebdea1);})[_0x77da('0x19')](respondWithResult(_0x1adba5,null))['catch'](handleError(_0x1adba5,null));};exports[_0x77da('0x2a')]=function(_0x1f48bd,_0x44717a){if(_0x1f48bd[_0x77da('0x1d')]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]&&_0x1f48bd['user']&&_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]){for(var _0x21de41 in _0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]){if(_0x1f48bd[_0x77da('0x1d')]['interaction'][_0x77da('0x2d')](_0x21de41)){db['MemberReport'][_0x77da('0x2e')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')]?{'$notIn':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]}:{'$ne':null}}})[_0x77da('0x19')](function(_0x1bb77c){var _0x5964da=moment()[_0x77da('0x30')](_0x77da('0x31'));for(var _0x46f289=0x0,_0x287cf0=_0x1bb77c[_0x77da('0x2f')];_0x46f289<_0x287cf0;_0x46f289+=0x1){_0x1bb77c[_0x46f289][_0x77da('0x32')]({'exitAt':_0x5964da});}});for(var _0x558023=0x0;_0x558023<_0x1f48bd['body'][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')];_0x558023+=0x1){db[_0x77da('0x33')][_0x77da('0x34')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023],'exitAt':null},'defaults':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'interface':_['isNil'](_0x1f48bd[_0x77da('0x2c')]['interface'])?util['format'](_0x77da('0x35'),_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]):_0x1f48bd[_0x77da('0x2c')]['interface'],'type':_0x77da('0x36'),'enterAt':moment()[_0x77da('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x77da('0x37'),'internal':_0x1f48bd[_0x77da('0x2c')]['internal'],'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023]}});}}}}return respondWithRpcPromise(_0x77da('0x38'),{'id':_0x1f48bd[_0x77da('0x18')]['id'],'capacity':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x39')]},routingClient)[_0x77da('0x19')](respondWithResult(_0x44717a,null))[_0x77da('0xa')](handleError(_0x44717a,null));};exports[_0x77da('0x3a')]=function(_0x3a34a8,_0x52aa0a){return respondWithRpcPromise(_0x77da('0x3b'),_0x3a34a8['query'])[_0x77da('0x19')](respondWithResult(_0x52aa0a,null))[_0x77da('0xa')](handleError(_0x52aa0a,null));};exports[_0x77da('0x3c')]=function(_0x2eca67,_0x374179){return respondWithRpcPromise(_0x77da('0x3d'),_0x2eca67[_0x77da('0x13')])['then'](respondWithResult(_0x374179,null))[_0x77da('0xa')](handleError(_0x374179,null));};exports[_0x77da('0x3e')]=function(_0x1a7115,_0x353be9){return respondWithRpcPromise('Campaigns',_0x1a7115[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x353be9,null))[_0x77da('0xa')](handleError(_0x353be9,null));};exports['chatQueues']=function(_0x5a7ba7,_0x332763){return respondWithRpcPromise(_0x77da('0x3f'),_0x5a7ba7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x332763,null))[_0x77da('0xa')](handleError(_0x332763,null));};exports['showChatQueues']=function(_0x50437b,_0x365e91){return respondWithRpcPromise(_0x77da('0x3f'),_0x50437b['query'],routingClient)[_0x77da('0x19')](findById(_0x50437b[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x365e91,null))['catch'](handleError(_0x365e91,null));};exports[_0x77da('0x40')]=function(_0x111260,_0x5a5309){return respondWithRpcPromise(_0x77da('0x41'),_0x111260[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x5a5309,null))[_0x77da('0xa')](handleError(_0x5a5309,null));};exports[_0x77da('0x42')]=function(_0x99ac27,_0x1dc4ab){return respondWithRpcPromise(_0x77da('0x41'),_0x99ac27[_0x77da('0x13')],routingClient)['then'](findById(_0x99ac27[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1dc4ab,null))[_0x77da('0xa')](handleError(_0x1dc4ab,null));};exports[_0x77da('0x43')]=function(_0x329c6b,_0x3a0160){return respondWithRpcPromise('MailAccounts',_0x329c6b[_0x77da('0x13')],mailClient)[_0x77da('0x19')](respondWithResult(_0x3a0160,null))[_0x77da('0xa')](handleError(_0x3a0160,null));};exports['openchannelQueues']=function(_0x3e5dd9,_0x2f7cd8){return respondWithRpcPromise(_0x77da('0x44'),_0x3e5dd9[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2f7cd8,null))[_0x77da('0xa')](handleError(_0x2f7cd8,null));};exports[_0x77da('0x45')]=function(_0x53a9ee,_0x100094){return respondWithRpcPromise('OpenchannelQueues',_0x53a9ee[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x53a9ee[_0x77da('0x18')]['id']))['then'](respondWithResult(_0x100094,null))[_0x77da('0xa')](handleError(_0x100094,null));};exports[_0x77da('0x46')]=function(_0x282481,_0x30ea29){return respondWithRpcPromise('SmsQueues',_0x282481['query'],routingClient)['then'](respondWithResult(_0x30ea29,null))[_0x77da('0xa')](handleError(_0x30ea29,null));};exports[_0x77da('0x47')]=function(_0x2c4d7c,_0x2c7c8e){return respondWithRpcPromise(_0x77da('0x48'),_0x2c4d7c[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x2c4d7c[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x2c7c8e,null))[_0x77da('0xa')](handleError(_0x2c7c8e,null));};exports['whatsappQueues']=function(_0x3028ca,_0x6dd79f){return respondWithRpcPromise('WhatsappQueues',_0x3028ca['query'],routingClient)[_0x77da('0x19')](respondWithResult(_0x6dd79f,null))['catch'](handleError(_0x6dd79f,null));};exports[_0x77da('0x49')]=function(_0x1adab0,_0x1ff554){return respondWithRpcPromise('WhatsappQueues',_0x1adab0[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x1adab0[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1ff554,null))[_0x77da('0xa')](handleError(_0x1ff554,null));};exports['faxQueues']=function(_0x1f4c49,_0x20a636){return respondWithRpcPromise('FaxQueues',_0x1f4c49[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x20a636,null))[_0x77da('0xa')](handleError(_0x20a636,null));};exports[_0x77da('0x4a')]=function(_0x14496e,_0xdf9393){return respondWithRpcPromise(_0x77da('0x4b'),_0x14496e['query'],routingClient)[_0x77da('0x19')](findById(_0x14496e['params']['id']))[_0x77da('0x19')](respondWithResult(_0xdf9393,null))[_0x77da('0xa')](handleError(_0xdf9393,null));};exports[_0x77da('0x4c')]=function(_0x19b514,_0x470619){return respondWithRpcPromise(_0x77da('0x4d'),_0x19b514[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x470619,null))[_0x77da('0xa')](handleError(_0x470619,null));};exports[_0x77da('0x4e')]=function(_0x3c9ca7,_0x19065e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3c9ca7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x19065e,null))[_0x77da('0xa')](handleError(_0x19065e,null));};exports[_0x77da('0x4f')]=function(_0x57b710,_0x293b5c){return respondWithRpcPromise(_0x77da('0x50'),_0x57b710[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x293b5c,null))[_0x77da('0xa')](handleError(_0x293b5c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x579314,_0x2a4f85){return respondWithRpcPromise(_0x77da('0x51'),_0x579314[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2a4f85,null))[_0x77da('0xa')](handleError(_0x2a4f85,null));};exports[_0x77da('0x52')]=function(_0x14dec8,_0xf95d48){return respondWithRpcPromise(_0x77da('0x51'),_0x14dec8['query'],routingClient)[_0x77da('0x19')](function(_0xfcf09c){if(_0x14dec8[_0x77da('0x13')][_0x77da('0x53')]!==undefined){var _0x17175=_(_0xfcf09c['rows'])[_0x77da('0x54')]([_0x14dec8[_0x77da('0x13')][_0x77da('0x53')],_0x14dec8[_0x77da('0x18')]['id']])[_0x77da('0x55')](_0x77da('0x56'))[_0x77da('0x57')]()[_0x77da('0x58')]();return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x4df868){return _0x17175['indexOf'](_0x4df868['queue_id'])>-0x1;});}else{return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x41fb81){return _0x41fb81['queue_id']===parseInt(_0x14dec8['params']['id']);});}})[_0x77da('0x19')](respondWithResult(_0xf95d48,null))[_0x77da('0xa')](handleError(_0xf95d48,null));};exports[_0x77da('0x59')]=function(_0x3a42e5,_0x1a92fd){return respondWithRpcPromise(_0x77da('0x5a'),_0x3a42e5[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x1a92fd,null))[_0x77da('0xa')](handleError(_0x1a92fd,null));};exports[_0x77da('0x5b')]=function(_0x27a462,_0x4cbd40){return respondWithRpcPromise(_0x77da('0x5c'),_0x27a462['query'],routingClient)['then'](respondWithResult(_0x4cbd40,null))[_0x77da('0xa')](handleError(_0x4cbd40,null));};exports['faxQueuesWaitingInteractions']=function(_0x4f9121,_0x22de60){return respondWithRpcPromise(_0x77da('0x5d'),_0x4f9121[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x22de60,null))['catch'](handleError(_0x22de60,null));};exports[_0x77da('0x5e')]=function(_0x4f1ae0){return function(_0x278f20,_0x1b85aa){var _0x554c44,_0x31834a;var _0x505520=_[_0x77da('0x5f')](_0x4f1ae0);var _0x45b0a5=_0x4f1ae0===_0x77da('0x60')?_0x77da('0x61'):'Account';return db[_0x505520+_0x77da('0x62')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x278f20[_0x77da('0x18')]['id']}})[_0x77da('0x19')](function(_0x3fd7c8){if(_[_0x77da('0x64')](_0x3fd7c8)){throw new Error(_0x505520+_0x77da('0x65'));}_0x554c44=_0x3fd7c8;return db[_0x505520+'Message']['findOne']({'where':{'id':_0x278f20[_0x77da('0x1d')][_0x77da('0x66')]},'include':[{'model':db[_0x505520+_0x77da('0x67')],'as':'Interaction'},{'model':db[_0x505520+_0x45b0a5],'as':'Account'}]});})['then'](function(_0x5aaafb){if(_[_0x77da('0x64')](_0x5aaafb)){throw new Error(_0x505520+_0x77da('0x68'));}_0x31834a=_0x5aaafb;return _0x5aaafb[_0x77da('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1636d6={'uniqueid':_0x4f1ae0+'.'+_0x31834a['id']+'.'+_0x31834a['Interaction']['id'],'FromUserId':_0x278f20[_0x77da('0x2c')]['id'],'type':'queue'};_0x1636d6[_0x505520+_0x77da('0x6a')]=_0x31834a['id'];_0x1636d6[_0x505520+'InteractionId']=_0x31834a[_0x77da('0x67')]['id'];_0x1636d6[_0x77da('0x6b')+_0x505520+_0x45b0a5+'Id']=_0x31834a['Account']['id'];_0x1636d6['To'+_0x505520+_0x77da('0x6c')]=_0x554c44['id'];return db[_0x505520+_0x77da('0x6d')][_0x77da('0x6e')](_0x1636d6);})[_0x77da('0x19')](function(){return respondWithRpcPromise(_0x77da('0x6f'),{'channel':_0x4f1ae0,'interaction':_0x31834a[_0x77da('0x67')],'message':_0x31834a,'account':_0x31834a[_0x77da('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x71'),'appdata':_0x554c44[_0x77da('0xd')]+','+(_0x31834a['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x1b85aa,null))[_0x77da('0xa')](handleError(_0x1b85aa,null));};};exports[_0x77da('0x72')]=function(_0x56efcf,_0x186d22){var _0x52638b,_0x5e93b1;if(_[_0x77da('0x64')](_0x56efcf[_0x77da('0x1d')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x3c0cde=_0x56efcf[_0x77da('0x1d')][_0x77da('0x73')];var _0x5d9750=_[_0x77da('0x5f')](_0x3c0cde);var _0x5384d2=_0x3c0cde===_0x77da('0x60')?_0x77da('0x61'):_0x77da('0x70');return db[_0x77da('0x74')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x56efcf[_0x77da('0x18')]['id'],'role':'agent'}})[_0x77da('0x19')](function(_0x2410ae){if(_[_0x77da('0x64')](_0x2410ae)){throw new Error(_0x77da('0x75'));}_0x52638b=_0x2410ae;return db[_0x5d9750+'Message'][_0x77da('0x63')]({'where':{'id':_0x56efcf['body'][_0x77da('0x66')]},'include':[{'model':db[_0x5d9750+_0x77da('0x67')],'as':_0x77da('0x67')},{'model':db[_0x5d9750+_0x5384d2],'as':_0x77da('0x70')}]});})[_0x77da('0x19')](function(_0x2c3bcc){if(_[_0x77da('0x64')](_0x2c3bcc)){throw new Error(_0x5d9750+_0x77da('0x68'));}_0x5e93b1=_0x2c3bcc;return _0x2c3bcc['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x77da('0x19')](function(){var _0x3132f0={'uniqueid':_0x3c0cde+'.'+_0x5e93b1['id']+'.'+_0x5e93b1[_0x77da('0x67')]['id'],'FromUserId':_0x56efcf[_0x77da('0x2c')]['id'],'type':_0x77da('0x71'),'ToUserId':_0x52638b['id']};_0x3132f0[_0x5d9750+_0x77da('0x6a')]=_0x5e93b1['id'];_0x3132f0[_0x5d9750+_0x77da('0x76')]=_0x5e93b1[_0x77da('0x67')]['id'];_0x3132f0['From'+_0x5d9750+_0x5384d2+'Id']=_0x5e93b1['Account']['id'];return db[_0x5d9750+_0x77da('0x6d')][_0x77da('0x6e')](_0x3132f0);})[_0x77da('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x3c0cde,'interaction':_0x5e93b1[_0x77da('0x67')],'message':_0x5e93b1,'account':_0x5e93b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x37'),'appdata':_0x52638b[_0x77da('0xd')]+','+(_0x5e93b1[_0x77da('0x70')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x186d22,null))['catch'](handleError(_0x186d22,null));}; \ No newline at end of file +var _0xa41a=['name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','hasOwnProperty','MemberReport','findAll','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','user','INTERACTION','interface','SIP/%s','agent','AgentCapacity','capacity','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','Account','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','status','json','sendStatus','stack'];(function(_0x2f9bee,_0x17fc35){var _0xbf6df0=function(_0x2b3612){while(--_0x2b3612){_0x2f9bee['push'](_0x2f9bee['shift']());}};_0xbf6df0(++_0x17fc35);}(_0xa41a,0x6b));var _0xaa41=function(_0x4a04c7,_0x199475){_0x4a04c7=_0x4a04c7-0x0;var _0x1bad73=_0xa41a[_0x4a04c7];return _0x1bad73;};'use strict';var BPromise=require(_0xaa41('0x0'));var moment=require(_0xaa41('0x1'));var _=require('lodash');var util=require(_0xaa41('0x2'));var db=require(_0xaa41('0x3'))['db'];var logger=require(_0xaa41('0x4'))(_0xaa41('0x5'));var jayson=require(_0xaa41('0x6'));var amiClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232a});var mailClient=jayson[_0xaa41('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){var _0x31df43=_0x179545?_0x179545:amiClient;return _0x31df43[_0xaa41('0x9')](_0x54bc5a,_0x5b1fff)[_0xaa41('0xa')](function(_0x1cc344){if(_0x1cc344[_0xaa41('0xb')]){if(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xc')]===0x1f4){return _0x588ab4(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xd')]);}return _0x202cce(_0x1cc344['error'][_0xaa41('0xd')]);}else{_0x202cce(_0x1cc344[_0xaa41('0xe')]);}})['catch'](function(_0x54827c){_0x588ab4(_0x54827c);});});}function respondWithResult(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xc8;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0xf')](_0x518b5b)[_0xaa41('0x10')](_0x19bd69);}return _0x1d0a54[_0xaa41('0x11')](0x194);};}function handleError(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0x1f4;return function(_0x1e9d7f){logger[_0xaa41('0xb')](_0x1e9d7f[_0xaa41('0x12')]);if(_0x1e9d7f[_0xaa41('0x13')]){delete _0x1e9d7f[_0xaa41('0x13')];}_0x6f9ade[_0xaa41('0xf')](_0x4eaf81)[_0xaa41('0x14')](_0x1e9d7f);};}function findById(_0x550ad5){return function(_0x2d868a){if(!_[_0xaa41('0x15')](_0x550ad5)&&!_[_0xaa41('0x15')](_0x2d868a)&&!_[_0xaa41('0x15')](_0x2d868a[_0xaa41('0x16')])){return _[_0xaa41('0x17')](_0x2d868a[_0xaa41('0x16')],function(_0x46e6d3){return _0x46e6d3['id']==_0x550ad5;});}return null;};}exports[_0xaa41('0x18')]=function(_0x4fe1a4,_0x5cd936){return respondWithRpcPromise(_0xaa41('0x19'),_0x4fe1a4[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5cd936,null))['catch'](handleError(_0x5cd936,null));};exports[_0xaa41('0x1b')]=function(_0x1f692b,_0x4e768e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xaa41('0x1c')](_0x1f692b['query'],_0x1f692b[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4e768e,null))[_0xaa41('0x1e')](handleError(_0x4e768e,null));};exports[_0xaa41('0x1f')]=function(_0x1d623c,_0x4eb01f){return respondWithRpcPromise(_0xaa41('0x20'),_[_0xaa41('0x1c')](_0x1d623c[_0xaa41('0x1a')],_0x1d623c[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4eb01f,null))[_0xaa41('0x1e')](handleError(_0x4eb01f,null));};exports['voiceQueues']=function(_0x5795f4,_0x16aec5){return respondWithRpcPromise('VoiceQueues',_0x5795f4['query'])[_0xaa41('0xa')](respondWithResult(_0x16aec5,null))['catch'](handleError(_0x16aec5,null));};exports['showVoiceQueues']=function(_0x2d0ac0,_0x9c8c21){return respondWithRpcPromise(_0xaa41('0x21'),_0x2d0ac0[_0xaa41('0x1a')])[_0xaa41('0xa')](findById(_0x2d0ac0[_0xaa41('0x1d')]['id']))['then'](respondWithResult(_0x9c8c21,null))[_0xaa41('0x1e')](handleError(_0x9c8c21,null));};exports[_0xaa41('0x22')]=function(_0x63c18c,_0x9a16e3){return respondWithRpcPromise(_0xaa41('0x23'),_[_0xaa41('0x1c')](_0x63c18c[_0xaa41('0x24')],_0x63c18c[_0xaa41('0x1d')]))['then'](respondWithResult(_0x9a16e3,null))[_0xaa41('0x1e')](handleError(_0x9a16e3,null));};exports['voiceQueuesPreview']=function(_0x5dad80,_0x714537){return respondWithRpcPromise(_0xaa41('0x25'),_['merge'](_0x5dad80[_0xaa41('0x1a')],_0x5dad80[_0xaa41('0x1d')]))['then'](respondWithResult(_0x714537,null))['catch'](handleError(_0x714537,null));};exports['voiceQueuesChannels']=function(_0x1cf3da,_0x2f5cc0){return respondWithRpcPromise(_0xaa41('0x26'),_0x1cf3da[_0xaa41('0x1a')])['then'](respondWithResult(_0x2f5cc0,null))[_0xaa41('0x1e')](handleError(_0x2f5cc0,null));};exports[_0xaa41('0x27')]=function(_0x3e0204,_0x4de770){return respondWithRpcPromise(_0xaa41('0x28'),_[_0xaa41('0x1c')](_0x3e0204[_0xaa41('0x1a')],_0x3e0204['params']))[_0xaa41('0xa')](respondWithResult(_0x4de770,null))[_0xaa41('0x1e')](handleError(_0x4de770,null));};exports['voiceQueuesChannelHangup']=function(_0x23eb50,_0x13b6d4){return respondWithRpcPromise(_0xaa41('0x29'),_['merge'](_0x23eb50[_0xaa41('0x1a')],_0x23eb50['params']))[_0xaa41('0xa')](respondWithResult(_0x13b6d4,null))[_0xaa41('0x1e')](handleError(_0x13b6d4,null));};exports[_0xaa41('0x2a')]=function(_0x49b77a,_0x526377){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xaa41('0x1c')](_0x49b77a[_0xaa41('0x1a')],_0x49b77a[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x526377,null))['catch'](handleError(_0x526377,null));};exports['outbound']=function(_0x267999,_0x5673c){return respondWithRpcPromise(_0xaa41('0x2b'),_0x267999[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5673c,null))[_0xaa41('0x1e')](handleError(_0x5673c,null));};exports[_0xaa41('0x2c')]=function(_0x5e9879,_0x3adc28){return respondWithRpcPromise(_0xaa41('0x2d'),_0x5e9879[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x3adc28,null))['catch'](handleError(_0x3adc28,null));};exports['agents']=function(_0x42b759,_0x275fa3){var _0x5eae08;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759['query'])[_0xaa41('0xa')](function(_0x25f2df){_0x5eae08=_0x25f2df;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759[_0xaa41('0x1a')],routingClient);})[_0xaa41('0xa')](function(_0x12ba1a){return _[_0xaa41('0x1c')]({},_0x12ba1a,_0x5eae08);})[_0xaa41('0xa')](respondWithResult(_0x275fa3,null))['catch'](handleError(_0x275fa3,null));};exports[_0xaa41('0x2f')]=function(_0x2abf39,_0x35c685){if(_0x2abf39[_0xaa41('0x24')]&&_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]&&_0x2abf39['user']&&_0x2abf39['user'][_0xaa41('0x13')]){for(var _0x4f9086 in _0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]){if(_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0xaa41('0x31')](_0x4f9086)){db[_0xaa41('0x32')][_0xaa41('0x33')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2abf39['body'][_0xaa41('0x30')][_0x4f9086]&&_0x2abf39['body']['interaction'][_0x4f9086]['length']?{'$notIn':_0x2abf39[_0xaa41('0x24')]['interaction'][_0x4f9086]}:{'$ne':null}}})[_0xaa41('0xa')](function(_0x198716){var _0x4a6882=moment()['format'](_0xaa41('0x34'));for(var _0x1b7b97=0x0,_0x1bb973=_0x198716[_0xaa41('0x35')];_0x1b7b97<_0x1bb973;_0x1b7b97+=0x1){_0x198716[_0x1b7b97][_0xaa41('0x36')]({'exitAt':_0x4a6882});}});for(var _0x337993=0x0;_0x337993<_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0xaa41('0x35')];_0x337993+=0x1){db['MemberReport'][_0xaa41('0x37')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39[_0xaa41('0x38')][_0xaa41('0x13')],'type':_0xaa41('0x39'),'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993],'exitAt':null},'defaults':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'interface':_[_0xaa41('0x15')](_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')])?util['format'](_0xaa41('0x3b'),_0x2abf39['user']['name']):_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')],'type':_0xaa41('0x39'),'enterAt':moment()['format'](_0xaa41('0x34')),'role':_0xaa41('0x3c'),'internal':_0x2abf39[_0xaa41('0x38')]['internal'],'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993]}});}}}}return respondWithRpcPromise(_0xaa41('0x3d'),{'id':_0x2abf39[_0xaa41('0x1d')]['id'],'capacity':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x3e')]},routingClient)[_0xaa41('0xa')](respondWithResult(_0x35c685,null))[_0xaa41('0x1e')](handleError(_0x35c685,null));};exports['telephones']=function(_0x9f0a81,_0x5bef5f){return respondWithRpcPromise('Telephones',_0x9f0a81[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5bef5f,null))[_0xaa41('0x1e')](handleError(_0x5bef5f,null));};exports[_0xaa41('0x3f')]=function(_0x14aab0,_0x288db3){return respondWithRpcPromise(_0xaa41('0x40'),_0x14aab0[_0xaa41('0x1a')])['then'](respondWithResult(_0x288db3,null))[_0xaa41('0x1e')](handleError(_0x288db3,null));};exports[_0xaa41('0x41')]=function(_0x1d518f,_0x4f9e92){return respondWithRpcPromise(_0xaa41('0x42'),_0x1d518f[_0xaa41('0x1a')])['then'](respondWithResult(_0x4f9e92,null))[_0xaa41('0x1e')](handleError(_0x4f9e92,null));};exports[_0xaa41('0x43')]=function(_0x283b3b,_0x4e5a2e){return respondWithRpcPromise(_0xaa41('0x44'),_0x283b3b[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x4e5a2e,null))['catch'](handleError(_0x4e5a2e,null));};exports[_0xaa41('0x45')]=function(_0x3cd14f,_0x3a29d2){return respondWithRpcPromise('ChatQueues',_0x3cd14f[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x3cd14f[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x3a29d2,null))[_0xaa41('0x1e')](handleError(_0x3a29d2,null));};exports['mailQueues']=function(_0x2ae70c,_0x57cb70){return respondWithRpcPromise('MailQueues',_0x2ae70c[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x57cb70,null))[_0xaa41('0x1e')](handleError(_0x57cb70,null));};exports[_0xaa41('0x46')]=function(_0x169ddf,_0x5e83e1){return respondWithRpcPromise(_0xaa41('0x47'),_0x169ddf[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x169ddf[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5e83e1,null))[_0xaa41('0x1e')](handleError(_0x5e83e1,null));};exports[_0xaa41('0x48')]=function(_0x337059,_0x3f91f3){return respondWithRpcPromise('MailAccounts',_0x337059[_0xaa41('0x1a')],mailClient)[_0xaa41('0xa')](respondWithResult(_0x3f91f3,null))[_0xaa41('0x1e')](handleError(_0x3f91f3,null));};exports['openchannelQueues']=function(_0x3fe47a,_0x2caf5c){return respondWithRpcPromise(_0xaa41('0x49'),_0x3fe47a[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2caf5c,null))[_0xaa41('0x1e')](handleError(_0x2caf5c,null));};exports[_0xaa41('0x4a')]=function(_0x5ea056,_0x55a85c){return respondWithRpcPromise('OpenchannelQueues',_0x5ea056['query'],routingClient)['then'](findById(_0x5ea056['params']['id']))[_0xaa41('0xa')](respondWithResult(_0x55a85c,null))['catch'](handleError(_0x55a85c,null));};exports['smsQueues']=function(_0x24c6f3,_0x40a524){return respondWithRpcPromise(_0xaa41('0x4b'),_0x24c6f3[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x40a524,null))[_0xaa41('0x1e')](handleError(_0x40a524,null));};exports[_0xaa41('0x4c')]=function(_0x1ddb6c,_0x46822f){return respondWithRpcPromise(_0xaa41('0x4b'),_0x1ddb6c[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x1ddb6c[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x46822f,null))['catch'](handleError(_0x46822f,null));};exports[_0xaa41('0x4d')]=function(_0x2d2af8,_0x50170f){return respondWithRpcPromise('WhatsappQueues',_0x2d2af8['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x50170f,null))['catch'](handleError(_0x50170f,null));};exports[_0xaa41('0x4e')]=function(_0x5c8028,_0x5423b6){return respondWithRpcPromise(_0xaa41('0x4f'),_0x5c8028['query'],routingClient)[_0xaa41('0xa')](findById(_0x5c8028[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5423b6,null))[_0xaa41('0x1e')](handleError(_0x5423b6,null));};exports['faxQueues']=function(_0x5be61b,_0x339db3){return respondWithRpcPromise(_0xaa41('0x50'),_0x5be61b['query'],routingClient)['then'](respondWithResult(_0x339db3,null))[_0xaa41('0x1e')](handleError(_0x339db3,null));};exports[_0xaa41('0x51')]=function(_0x304694,_0xbeafb5){return respondWithRpcPromise(_0xaa41('0x50'),_0x304694['query'],routingClient)[_0xaa41('0xa')](findById(_0x304694['params']['id']))['then'](respondWithResult(_0xbeafb5,null))['catch'](handleError(_0xbeafb5,null));};exports[_0xaa41('0x52')]=function(_0x19ec63,_0x436362){return respondWithRpcPromise('FaxAccounts',_0x19ec63[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x436362,null))[_0xaa41('0x1e')](handleError(_0x436362,null));};exports[_0xaa41('0x53')]=function(_0x457515,_0x3ffbf8){return respondWithRpcPromise(_0xaa41('0x54'),_0x457515['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x3ffbf8,null))[_0xaa41('0x1e')](handleError(_0x3ffbf8,null));};exports[_0xaa41('0x55')]=function(_0x175ca9,_0x51ff61){return respondWithRpcPromise(_0xaa41('0x56'),_0x175ca9['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x51ff61,null))[_0xaa41('0x1e')](handleError(_0x51ff61,null));};exports[_0xaa41('0x57')]=function(_0x143ef0,_0x491cad){return respondWithRpcPromise(_0xaa41('0x58'),_0x143ef0[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x491cad,null))[_0xaa41('0x1e')](handleError(_0x491cad,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x140d78,_0x50197b){return respondWithRpcPromise(_0xaa41('0x58'),_0x140d78[_0xaa41('0x1a')],routingClient)['then'](function(_0x1ac05e){if(_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')]!==undefined){var _0x582d79=_(_0x1ac05e[_0xaa41('0x16')])[_0xaa41('0x5a')]([_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')],_0x140d78[_0xaa41('0x1d')]['id']])[_0xaa41('0x5b')](_0xaa41('0x5c'))['uniq']()[_0xaa41('0x5d')]();return _0x1ac05e[_0xaa41('0x16')][_0xaa41('0x5a')](function(_0x530982){return _0x582d79['indexOf'](_0x530982[_0xaa41('0x5c')])>-0x1;});}else{return _0x1ac05e[_0xaa41('0x16')]['filter'](function(_0x1ce957){return _0x1ce957[_0xaa41('0x5c')]===parseInt(_0x140d78['params']['id']);});}})[_0xaa41('0xa')](respondWithResult(_0x50197b,null))[_0xaa41('0x1e')](handleError(_0x50197b,null));};exports[_0xaa41('0x5e')]=function(_0xe8731,_0x46feb2){return respondWithRpcPromise(_0xaa41('0x5f'),_0xe8731[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x46feb2,null))['catch'](handleError(_0x46feb2,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x397526,_0x481db9){return respondWithRpcPromise(_0xaa41('0x60'),_0x397526[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x481db9,null))['catch'](handleError(_0x481db9,null));};exports[_0xaa41('0x61')]=function(_0x404c38,_0x2d7493){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x404c38[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2d7493,null))['catch'](handleError(_0x2d7493,null));};exports[_0xaa41('0x62')]=function(_0x4de25c){return function(_0x53faf4,_0x3f6a2b){var _0x34d0e4,_0x5eded3;var _0x5a8cb0=_[_0xaa41('0x63')](_0x4de25c);var _0x1726ec=_0x4de25c===_0xaa41('0x64')?_0xaa41('0x65'):'Account';return db[_0x5a8cb0+_0xaa41('0x66')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0x53faf4[_0xaa41('0x1d')]['id']}})['then'](function(_0x1ad3aa){if(_[_0xaa41('0x15')](_0x1ad3aa)){throw new Error(_0x5a8cb0+_0xaa41('0x68'));}_0x34d0e4=_0x1ad3aa;return db[_0x5a8cb0+'Message'][_0xaa41('0x67')]({'where':{'id':_0x53faf4['body']['messageId']},'include':[{'model':db[_0x5a8cb0+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x5a8cb0+_0x1726ec],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x9e8ebb){if(_[_0xaa41('0x15')](_0x9e8ebb)){throw new Error(_0x5a8cb0+'\x20Message\x20not\x20found');}_0x5eded3=_0x9e8ebb;return _0x9e8ebb[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x1a2deb={'uniqueid':_0x4de25c+'.'+_0x5eded3['id']+'.'+_0x5eded3[_0xaa41('0x69')]['id'],'FromUserId':_0x53faf4[_0xaa41('0x38')]['id'],'type':'queue'};_0x1a2deb[_0x5a8cb0+_0xaa41('0x6b')]=_0x5eded3['id'];_0x1a2deb[_0x5a8cb0+'InteractionId']=_0x5eded3[_0xaa41('0x69')]['id'];_0x1a2deb[_0xaa41('0x6c')+_0x5a8cb0+_0x1726ec+'Id']=_0x5eded3[_0xaa41('0x6d')]['id'];_0x1a2deb['To'+_0x5a8cb0+_0xaa41('0x6e')]=_0x34d0e4['id'];return db[_0x5a8cb0+_0xaa41('0x6f')][_0xaa41('0x70')](_0x1a2deb);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x4de25c,'interaction':_0x5eded3[_0xaa41('0x69')],'message':_0x5eded3,'account':_0x5eded3[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaa41('0x72'),'appdata':_0x34d0e4['name']+','+(_0x5eded3[_0xaa41('0x6d')][_0xaa41('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x3f6a2b,null))['catch'](handleError(_0x3f6a2b,null));};};exports[_0xaa41('0x74')]=function(_0xb44b1f,_0x472eb3){var _0x38d759,_0x2dc55e;if(_[_0xaa41('0x15')](_0xb44b1f[_0xaa41('0x24')]['channel'])){throw new Error(_0xaa41('0x75'));}var _0x1d50db=_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x76')];var _0x585ce7=_[_0xaa41('0x63')](_0x1d50db);var _0x5c9beb=_0x1d50db===_0xaa41('0x64')?_0xaa41('0x65'):_0xaa41('0x6d');return db[_0xaa41('0x77')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0xb44b1f['params']['id'],'role':_0xaa41('0x3c')}})[_0xaa41('0xa')](function(_0x5819ac){if(_[_0xaa41('0x15')](_0x5819ac)){throw new Error(_0xaa41('0x78'));}_0x38d759=_0x5819ac;return db[_0x585ce7+_0xaa41('0x79')][_0xaa41('0x67')]({'where':{'id':_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x7a')]},'include':[{'model':db[_0x585ce7+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x585ce7+_0x5c9beb],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x39d3cc){if(_[_0xaa41('0x15')](_0x39d3cc)){throw new Error(_0x585ce7+_0xaa41('0x7b'));}_0x2dc55e=_0x39d3cc;return _0x39d3cc[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x5489be={'uniqueid':_0x1d50db+'.'+_0x2dc55e['id']+'.'+_0x2dc55e['Interaction']['id'],'FromUserId':_0xb44b1f['user']['id'],'type':_0xaa41('0x72'),'ToUserId':_0x38d759['id']};_0x5489be[_0x585ce7+_0xaa41('0x6b')]=_0x2dc55e['id'];_0x5489be[_0x585ce7+'InteractionId']=_0x2dc55e[_0xaa41('0x69')]['id'];_0x5489be[_0xaa41('0x6c')+_0x585ce7+_0x5c9beb+'Id']=_0x2dc55e['Account']['id'];return db[_0x585ce7+_0xaa41('0x6f')][_0xaa41('0x70')](_0x5489be);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x1d50db,'interaction':_0x2dc55e['Interaction'],'message':_0x2dc55e,'account':_0x2dc55e[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x38d759[_0xaa41('0x13')]+','+(_0x2dc55e[_0xaa41('0x6d')][_0xaa41('0x7c')]||0x12c),'interval':_0xaa41('0x7d')}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x472eb3,null))[_0xaa41('0x1e')](handleError(_0x472eb3,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d98fe8e..d5b7657 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 _0xa427=['run','create','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id/run'];(function(_0x2b7e24,_0x5376a9){var _0x44c7a5=function(_0x4c42ce){while(--_0x4c42ce){_0x2b7e24['push'](_0x2b7e24['shift']());}};_0x44c7a5(++_0x5376a9);}(_0xa427,0x192));var _0x7a42=function(_0x1bf0f1,_0x6163ba){_0x1bf0f1=_0x1bf0f1-0x0;var _0x58112d=_0xa427[_0x1bf0f1];return _0x58112d;};'use strict';var multer=require(_0x7a42('0x0'));var util=require('util');var path=require(_0x7a42('0x1'));var timeout=require(_0x7a42('0x2'));var express=require(_0x7a42('0x3'));var router=express[_0x7a42('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a42('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a42('0x6'));var controller=require(_0x7a42('0x7'));router[_0x7a42('0x8')]('/',auth[_0x7a42('0x9')](),controller[_0x7a42('0xa')]);router[_0x7a42('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x7a42('0xb'),auth[_0x7a42('0x9')](),controller[_0x7a42('0xc')]);router['post']('/',auth[_0x7a42('0x9')](),controller[_0x7a42('0xd')]);router['put'](_0x7a42('0xe'),auth[_0x7a42('0x9')](),controller[_0x7a42('0xf')]);router[_0x7a42('0x10')](_0x7a42('0xe'),auth['isAuthenticated'](),controller[_0x7a42('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7b0c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0xa6b940,_0x3c7f35){var _0x36f197=function(_0x49719b){while(--_0x49719b){_0xa6b940['push'](_0xa6b940['shift']());}};_0x36f197(++_0x3c7f35);}(_0x7b0c,0x1dc));var _0xc7b0=function(_0x2093c9,_0x296416){_0x2093c9=_0x2093c9-0x0;var _0x66ec5c=_0x7b0c[_0x2093c9];return _0x66ec5c;};'use strict';var multer=require(_0xc7b0('0x0'));var util=require(_0xc7b0('0x1'));var path=require(_0xc7b0('0x2'));var timeout=require(_0xc7b0('0x3'));var express=require(_0xc7b0('0x4'));var router=express[_0xc7b0('0x5')]();var fs_extra=require(_0xc7b0('0x6'));var auth=require(_0xc7b0('0x7'));var interaction=require(_0xc7b0('0x8'));var config=require(_0xc7b0('0x9'));var controller=require(_0xc7b0('0xa'));router[_0xc7b0('0xb')]('/',auth[_0xc7b0('0xc')](),controller[_0xc7b0('0xd')]);router['get']('/:id',auth[_0xc7b0('0xc')](),controller[_0xc7b0('0xe')]);router[_0xc7b0('0xb')](_0xc7b0('0xf'),auth['isAuthenticated'](),controller[_0xc7b0('0x10')]);router['post']('/',auth[_0xc7b0('0xc')](),controller['create']);router['put'](_0xc7b0('0x11'),auth[_0xc7b0('0xc')](),controller['update']);router['delete'](_0xc7b0('0x11'),auth[_0xc7b0('0xc')](),controller[_0xc7b0('0x12')]);module[_0xc7b0('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c8a5cc6..054984c 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 _0xeba7=['DATE','ENUM','years','months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','BOOLEAN','sequelize','STRING','0\x200\x20*\x20*\x20*'];(function(_0x2bca6d,_0x2d411d){var _0x64f307=function(_0x40fbce){while(--_0x40fbce){_0x2bca6d['push'](_0x2bca6d['shift']());}};_0x64f307(++_0x2d411d);}(_0xeba7,0x9f));var _0x7eba=function(_0x144a81,_0x2f1712){_0x144a81=_0x144a81-0x0;var _0x327604=_0xeba7[_0x144a81];return _0x327604;};'use strict';var Sequelize=require(_0x7eba('0x0'));module['exports']={'name':{'type':Sequelize[_0x7eba('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7eba('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7eba('0x1')],'allowNull':![],'defaultValue':_0x7eba('0x2')},'startAt':{'type':Sequelize[_0x7eba('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7eba('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7eba('0x4')](_0x7eba('0x5'),'quarters',_0x7eba('0x6'),_0x7eba('0x7'),_0x7eba('0x8'),_0x7eba('0x9'),_0x7eba('0xa')),'allowNull':![],'defaultValue':_0x7eba('0x8')},'output':{'type':Sequelize[_0x7eba('0x4')](_0x7eba('0xb'),_0x7eba('0xc'),_0x7eba('0xd')),'allowNull':![],'defaultValue':_0x7eba('0xb')},'type':{'type':Sequelize[_0x7eba('0x4')](_0x7eba('0xe'),_0x7eba('0xf')),'allowNull':![],'defaultValue':_0x7eba('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7eba('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x7eba('0x10')]},'sendIfEmpty':{'type':Sequelize[_0x7eba('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6117=['months','weeks','days','hours','minutes','csv','pdf','xlsx','custom','default','TEXT','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x6117,0x128));var _0x7611=function(_0x2f02fe,_0x5e4a1){_0x2f02fe=_0x2f02fe-0x0;var _0x20514d=_0x6117[_0x2f02fe];return _0x20514d;};'use strict';var Sequelize=require('sequelize');module[_0x7611('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7611('0x1')]},'active':{'type':Sequelize[_0x7611('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7611('0x3')},'startAt':{'type':Sequelize[_0x7611('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7611('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x7611('0x6'),_0x7611('0x7'),_0x7611('0x8'),_0x7611('0x9'),_0x7611('0xa'),_0x7611('0xb'),_0x7611('0xc')),'allowNull':![],'defaultValue':_0x7611('0xa')},'output':{'type':Sequelize['ENUM'](_0x7611('0xd'),_0x7611('0xe'),_0x7611('0xf')),'allowNull':![],'defaultValue':_0x7611('0xd')},'type':{'type':Sequelize['ENUM'](_0x7611('0x10'),_0x7611('0x11')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x7611('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7611('0x1')]},'cc':{'type':Sequelize[_0x7611('0x12')]},'bcc':{'type':Sequelize[_0x7611('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x7611('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c9bbf9e..5bac352 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 _0x589a=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','map','Schedule','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','fields','includeAll','options','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','../../config/schedule','run','eml-format','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra'];(function(_0x5d3cab,_0x346aeb){var _0xd28b31=function(_0x35c8d9){while(--_0x35c8d9){_0x5d3cab['push'](_0x5d3cab['shift']());}};_0xd28b31(++_0x346aeb);}(_0x589a,0x13f));var _0xa589=function(_0x1524e9,_0x3a01dd){_0x1524e9=_0x1524e9-0x0;var _0x5b0c3a=_0x589a[_0x1524e9];return _0x5b0c3a;};'use strict';var emlformat=require(_0xa589('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa589('0x1'));var rp=require('request-promise');var moment=require(_0xa589('0x2'));var BPromise=require(_0xa589('0x3'));var Mustache=require('mustache');var util=require(_0xa589('0x4'));var path=require(_0xa589('0x5'));var sox=require(_0xa589('0x6'));var csv=require('to-csv');var ejs=require(_0xa589('0x7'));var fs=require('fs');var fs_extra=require(_0xa589('0x8'));var _=require(_0xa589('0x9'));var squel=require(_0xa589('0xa'));var crypto=require(_0xa589('0xb'));var jsforce=require(_0xa589('0xc'));var deskjs=require(_0xa589('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa589('0xe'));var Papa=require(_0xa589('0xf'));var Redis=require(_0xa589('0x10'));var authService=require(_0xa589('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa589('0x12'));var logger=require(_0xa589('0x13'))(_0xa589('0x14'));var utils=require(_0xa589('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa589('0x16'))['db'];function respondWithStatusCode(_0x5ee265,_0x5c9435){_0x5c9435=_0x5c9435||0xcc;return function(_0xc6b116){if(_0xc6b116){return _0x5ee265['sendStatus'](_0x5c9435);}return _0x5ee265['status'](_0x5c9435)['end']();};}function respondWithResult(_0x1a48e2,_0x28fbd6){_0x28fbd6=_0x28fbd6||0xc8;return function(_0x23389c){if(_0x23389c){return _0x1a48e2[_0xa589('0x17')](_0x28fbd6)[_0xa589('0x18')](_0x23389c);}};}function respondWithFilteredResult(_0x19ed41,_0x557f26){return function(_0x4838a5){if(_0x4838a5){var _0x2ba052=typeof _0x557f26['offset']===_0xa589('0x19')&&typeof _0x557f26[_0xa589('0x1a')]===_0xa589('0x19');var _0x57a7b0=_0x4838a5[_0xa589('0x1b')];var _0x43860c=_0x2ba052?0x0:_0x557f26[_0xa589('0x1c')];var _0x5b4296=_0x2ba052?_0x4838a5[_0xa589('0x1b')]:_0x557f26[_0xa589('0x1c')]+_0x557f26['limit'];var _0x2639ef;if(_0x5b4296>=_0x57a7b0){_0x5b4296=_0x57a7b0;_0x2639ef=0xc8;}else{_0x2639ef=0xce;}_0x19ed41[_0xa589('0x17')](_0x2639ef);return _0x19ed41[_0xa589('0x1d')](_0xa589('0x1e'),_0x43860c+'-'+_0x5b4296+'/'+_0x57a7b0)[_0xa589('0x18')](_0x4838a5);}return null;};}function patchUpdates(_0x228dca){return function(_0xe35337){try{jsonpatch[_0xa589('0x1f')](_0xe35337,_0x228dca,!![]);}catch(_0xb979d6){return BPromise[_0xa589('0x20')](_0xb979d6);}return _0xe35337['save']();};}function saveUpdates(_0x467469,_0x5f338c){return function(_0x39c05d){if(_0x39c05d){return _0x39c05d[_0xa589('0x21')](_0x467469)[_0xa589('0x22')](function(_0x129d19){return _0x129d19;});}return null;};}function removeEntity(_0x3d0baa,_0x5e0584){return function(_0x45712e){if(_0x45712e){return _0x45712e[_0xa589('0x23')]()[_0xa589('0x22')](function(){var _0xe44fdf=_0x45712e['get']({'plain':!![]});var _0x82fbea=_0xa589('0x24');return db[_0xa589('0x25')]['destroy']({'where':{'type':_0x82fbea,'resourceId':_0xe44fdf['id']}})['then'](function(){return _0x45712e;});})[_0xa589('0x22')](function(){_0x3d0baa[_0xa589('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf996e6,_0x34a06a){return function(_0x1561d0){if(!_0x1561d0){_0xf996e6[_0xa589('0x26')](0x194);}return _0x1561d0;};}function handleError(_0x3206da,_0x11b918){_0x11b918=_0x11b918||0x1f4;return function(_0x59b2be){logger[_0xa589('0x27')](_0x59b2be[_0xa589('0x28')]);if(_0x59b2be[_0xa589('0x29')]){delete _0x59b2be[_0xa589('0x29')];}_0x3206da['status'](_0x11b918)[_0xa589('0x2a')](_0x59b2be);};}exports['index']=function(_0x16001f,_0x40b35a){var _0x5dc373={},_0x18014d={},_0x905e1d={'count':0x0,'rows':[]};var _0x167d26=_[_0xa589('0x2b')](db[_0xa589('0x2c')]['rawAttributes'],function(_0x31f650){return{'name':_0x31f650[_0xa589('0x2d')],'type':_0x31f650[_0xa589('0x2e')][_0xa589('0x2f')]};});_0x18014d[_0xa589('0x30')]=_['map'](_0x167d26,_0xa589('0x29'));_0x18014d['query']=_[_0xa589('0x31')](_0x16001f[_0xa589('0x32')]);_0x18014d[_0xa589('0x33')]=_[_0xa589('0x34')](_0x18014d[_0xa589('0x30')],_0x18014d[_0xa589('0x32')]);_0x5dc373['attributes']=_[_0xa589('0x34')](_0x18014d['model'],qs['fields'](_0x16001f[_0xa589('0x32')]['fields']));_0x5dc373[_0xa589('0x35')]=_0x5dc373[_0xa589('0x35')][_0xa589('0x36')]?_0x5dc373[_0xa589('0x35')]:_0x18014d[_0xa589('0x30')];if(!_0x16001f[_0xa589('0x32')]['hasOwnProperty'](_0xa589('0x37'))){_0x5dc373[_0xa589('0x1a')]=qs[_0xa589('0x1a')](_0x16001f[_0xa589('0x32')]['limit']);_0x5dc373[_0xa589('0x1c')]=qs[_0xa589('0x1c')](_0x16001f[_0xa589('0x32')][_0xa589('0x1c')]);}_0x5dc373['order']=qs['sort'](_0x16001f[_0xa589('0x32')][_0xa589('0x38')]);_0x5dc373[_0xa589('0x39')]=qs[_0xa589('0x33')](_[_0xa589('0x3a')](_0x16001f[_0xa589('0x32')],_0x18014d[_0xa589('0x33')]),_0x167d26);if(_0x16001f[_0xa589('0x32')][_0xa589('0x3b')]){_0x5dc373[_0xa589('0x39')]=_['merge'](_0x5dc373[_0xa589('0x39')],{'$or':_[_0xa589('0x2b')](_0x167d26,function(_0x37ff79){if(_0x37ff79['type']!==_0xa589('0x3c')){var _0x398ba0={};_0x398ba0[_0x37ff79['name']]={'$like':'%'+_0x16001f[_0xa589('0x32')]['filter']+'%'};return _0x398ba0;}})});}_0x5dc373=_[_0xa589('0x3d')]({},_0x5dc373,_0x16001f['options']);var _0x34a9b5={'where':_0x5dc373[_0xa589('0x39')]};return db[_0xa589('0x2c')][_0xa589('0x1b')](_0x34a9b5)[_0xa589('0x22')](function(_0x4c6831){_0x905e1d['count']=_0x4c6831;if(_0x16001f[_0xa589('0x32')]['includeAll']){_0x5dc373[_0xa589('0x3e')]=[{'all':!![]}];}return db[_0xa589('0x2c')][_0xa589('0x3f')](_0x5dc373);})[_0xa589('0x22')](function(_0x5f181a){_0x905e1d[_0xa589('0x40')]=_0x5f181a;return _0x905e1d;})[_0xa589('0x22')](respondWithFilteredResult(_0x40b35a,_0x5dc373))[_0xa589('0x41')](handleError(_0x40b35a,null));};exports['show']=function(_0x2bb600,_0x4d441f){var _0x14c8d7={'raw':![],'where':{'id':_0x2bb600[_0xa589('0x42')]['id']}},_0x19c2c0={};_0x19c2c0[_0xa589('0x30')]=_[_0xa589('0x31')](db[_0xa589('0x2c')][_0xa589('0x43')]);_0x19c2c0[_0xa589('0x32')]=_[_0xa589('0x31')](_0x2bb600['query']);_0x19c2c0['filters']=_[_0xa589('0x34')](_0x19c2c0['model'],_0x19c2c0[_0xa589('0x32')]);_0x14c8d7[_0xa589('0x35')]=_[_0xa589('0x34')](_0x19c2c0[_0xa589('0x30')],qs[_0xa589('0x44')](_0x2bb600[_0xa589('0x32')][_0xa589('0x44')]));_0x14c8d7[_0xa589('0x35')]=_0x14c8d7[_0xa589('0x35')][_0xa589('0x36')]?_0x14c8d7[_0xa589('0x35')]:_0x19c2c0[_0xa589('0x30')];if(_0x2bb600[_0xa589('0x32')][_0xa589('0x45')]){_0x14c8d7[_0xa589('0x3e')]=[{'all':!![]}];}_0x14c8d7=_[_0xa589('0x3d')]({},_0x14c8d7,_0x2bb600[_0xa589('0x46')]);return db['Schedule']['find'](_0x14c8d7)[_0xa589('0x22')](handleEntityNotFound(_0x4d441f,null))[_0xa589('0x22')](respondWithResult(_0x4d441f,null))[_0xa589('0x41')](handleError(_0x4d441f,null));};exports[_0xa589('0x47')]=function(_0xf6b7f,_0x2cff01){return db[_0xa589('0x2c')][_0xa589('0x47')](_0xf6b7f[_0xa589('0x48')],{})[_0xa589('0x22')](function(_0x122304){var _0x596912=_0xf6b7f[_0xa589('0x49')][_0xa589('0x4a')]({'plain':!![]});if(!_0x596912)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x596912[_0xa589('0x4b')]==='user'){var _0xe15346=_0x122304[_0xa589('0x4a')]({'plain':!![]});var _0x11f467=_0xa589('0x24');return db[_0xa589('0x4c')][_0xa589('0x4d')]({'where':{'name':_0x11f467,'userProfileId':_0x596912[_0xa589('0x4e')]},'raw':!![]})['then'](function(_0x231f72){if(_0x231f72&&_0x231f72[_0xa589('0x4f')]===0x0){return db[_0xa589('0x25')]['create']({'name':_0xe15346[_0xa589('0x29')],'resourceId':_0xe15346['id'],'type':_0x231f72[_0xa589('0x29')],'sectionId':_0x231f72['id']},{})[_0xa589('0x22')](function(){return _0x122304;});}else{return _0x122304;}})[_0xa589('0x41')](function(_0x16b170){logger[_0xa589('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16b170);throw _0x16b170;});}return _0x122304;})[_0xa589('0x22')](respondWithResult(_0x2cff01,0xc9))[_0xa589('0x41')](handleError(_0x2cff01,null));};exports[_0xa589('0x21')]=function(_0x1a093e,_0x1c1a89){if(_0x1a093e['body']['id']){delete _0x1a093e['body']['id'];}return db[_0xa589('0x2c')][_0xa589('0x4d')]({'where':{'id':_0x1a093e['params']['id']}})[_0xa589('0x22')](handleEntityNotFound(_0x1c1a89,null))[_0xa589('0x22')](saveUpdates(_0x1a093e['body'],null))[_0xa589('0x22')](respondWithResult(_0x1c1a89,null))['catch'](handleError(_0x1c1a89,null));};exports['destroy']=function(_0x14241f,_0xd03f79){return db[_0xa589('0x2c')][_0xa589('0x4d')]({'where':{'id':_0x14241f[_0xa589('0x42')]['id']}})[_0xa589('0x22')](handleEntityNotFound(_0xd03f79,null))[_0xa589('0x22')](removeEntity(_0xd03f79,null))[_0xa589('0x41')](handleError(_0xd03f79,null));};exports['run']=function(_0x8380c8,_0x1b0c73,_0x4c54f8){var _0x4b776a=require(_0xa589('0x50'));return db['Schedule'][_0xa589('0x4d')]({'where':{'id':_0x8380c8[_0xa589('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x1b0c73,null))[_0xa589('0x22')](function(){_0x4b776a[_0xa589('0x51')](_0x8380c8[_0xa589('0x42')]['id']);})['then'](respondWithStatusCode(_0x1b0c73,null))[_0xa589('0x41')](handleError(_0x1b0c73,null));}; \ No newline at end of file +var _0x3f26=['index','map','Schedule','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','sendStatus','name','send'];(function(_0x50d150,_0x43895f){var _0x9a32e1=function(_0x289c8b){while(--_0x289c8b){_0x50d150['push'](_0x50d150['shift']());}};_0x9a32e1(++_0x43895f);}(_0x3f26,0x79));var _0x63f2=function(_0xa1d35f,_0x3a59c0){_0xa1d35f=_0xa1d35f-0x0;var _0x2048db=_0x3f26[_0xa1d35f];return _0x2048db;};'use strict';var emlformat=require(_0x63f2('0x0'));var rimraf=require(_0x63f2('0x1'));var zipdir=require(_0x63f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f2('0x3'));var moment=require(_0x63f2('0x4'));var BPromise=require(_0x63f2('0x5'));var Mustache=require('mustache');var util=require(_0x63f2('0x6'));var path=require(_0x63f2('0x7'));var sox=require(_0x63f2('0x8'));var csv=require(_0x63f2('0x9'));var ejs=require(_0x63f2('0xa'));var fs=require('fs');var fs_extra=require(_0x63f2('0xb'));var _=require(_0x63f2('0xc'));var squel=require(_0x63f2('0xd'));var crypto=require(_0x63f2('0xe'));var jsforce=require(_0x63f2('0xf'));var deskjs=require(_0x63f2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x63f2('0x11'));var Papa=require(_0x63f2('0x12'));var Redis=require('ioredis');var authService=require(_0x63f2('0x13'));var qs=require(_0x63f2('0x14'));var as=require(_0x63f2('0x15'));var hardwareService=require(_0x63f2('0x16'));var logger=require(_0x63f2('0x17'))(_0x63f2('0x18'));var utils=require('../../config/utils');var config=require(_0x63f2('0x19'));var licenseUtil=require(_0x63f2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3132c1,_0x3cbe17){_0x3cbe17=_0x3cbe17||0xcc;return function(_0x1dae56){if(_0x1dae56){return _0x3132c1['sendStatus'](_0x3cbe17);}return _0x3132c1[_0x63f2('0x1b')](_0x3cbe17)[_0x63f2('0x1c')]();};}function respondWithResult(_0x471c74,_0x5f2fc3){_0x5f2fc3=_0x5f2fc3||0xc8;return function(_0x4572fd){if(_0x4572fd){return _0x471c74[_0x63f2('0x1b')](_0x5f2fc3)[_0x63f2('0x1d')](_0x4572fd);}};}function respondWithFilteredResult(_0x371f47,_0x160e53){return function(_0xcd0bcf){if(_0xcd0bcf){var _0x36eb27=typeof _0x160e53[_0x63f2('0x1e')]===_0x63f2('0x1f')&&typeof _0x160e53[_0x63f2('0x20')]===_0x63f2('0x1f');var _0xc890fa=_0xcd0bcf[_0x63f2('0x21')];var _0x542889=_0x36eb27?0x0:_0x160e53['offset'];var _0x5fcbac=_0x36eb27?_0xcd0bcf[_0x63f2('0x21')]:_0x160e53[_0x63f2('0x1e')]+_0x160e53[_0x63f2('0x20')];var _0x54b72c;if(_0x5fcbac>=_0xc890fa){_0x5fcbac=_0xc890fa;_0x54b72c=0xc8;}else{_0x54b72c=0xce;}_0x371f47[_0x63f2('0x1b')](_0x54b72c);return _0x371f47[_0x63f2('0x22')](_0x63f2('0x23'),_0x542889+'-'+_0x5fcbac+'/'+_0xc890fa)[_0x63f2('0x1d')](_0xcd0bcf);}return null;};}function patchUpdates(_0x30cf3b){return function(_0x1017f5){try{jsonpatch[_0x63f2('0x24')](_0x1017f5,_0x30cf3b,!![]);}catch(_0xac66f4){return BPromise['reject'](_0xac66f4);}return _0x1017f5[_0x63f2('0x25')]();};}function saveUpdates(_0xbfd1e0,_0x58d5f0){return function(_0x1ad85a){if(_0x1ad85a){return _0x1ad85a[_0x63f2('0x26')](_0xbfd1e0)[_0x63f2('0x27')](function(_0x22491b){return _0x22491b;});}return null;};}function removeEntity(_0x45d5d5,_0x4f55cc){return function(_0x21c899){if(_0x21c899){return _0x21c899[_0x63f2('0x28')]()[_0x63f2('0x27')](function(){var _0x3b648d=_0x21c899[_0x63f2('0x29')]({'plain':!![]});var _0x48edc2='Scheduler';return db['UserProfileResource'][_0x63f2('0x28')]({'where':{'type':_0x48edc2,'resourceId':_0x3b648d['id']}})['then'](function(){return _0x21c899;});})[_0x63f2('0x27')](function(){_0x45d5d5[_0x63f2('0x1b')](0xcc)[_0x63f2('0x1c')]();});}};}function handleEntityNotFound(_0x2e19d9,_0x2c4fb4){return function(_0x388b3c){if(!_0x388b3c){_0x2e19d9[_0x63f2('0x2a')](0x194);}return _0x388b3c;};}function handleError(_0x188722,_0x899795){_0x899795=_0x899795||0x1f4;return function(_0x3c9132){logger['error'](_0x3c9132['stack']);if(_0x3c9132[_0x63f2('0x2b')]){delete _0x3c9132[_0x63f2('0x2b')];}_0x188722[_0x63f2('0x1b')](_0x899795)[_0x63f2('0x2c')](_0x3c9132);};}exports[_0x63f2('0x2d')]=function(_0x55052c,_0x4d0dd7){var _0x32dbd7={},_0x12aa20={},_0x4ab3bb={'count':0x0,'rows':[]};var _0x1d5e02=_[_0x63f2('0x2e')](db[_0x63f2('0x2f')][_0x63f2('0x30')],function(_0x199a59){return{'name':_0x199a59['fieldName'],'type':_0x199a59['type'][_0x63f2('0x31')]};});_0x12aa20['model']=_[_0x63f2('0x2e')](_0x1d5e02,'name');_0x12aa20['query']=_[_0x63f2('0x32')](_0x55052c[_0x63f2('0x33')]);_0x12aa20[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0x12aa20[_0x63f2('0x36')],_0x12aa20[_0x63f2('0x33')]);_0x32dbd7[_0x63f2('0x37')]=_['intersection'](_0x12aa20[_0x63f2('0x36')],qs[_0x63f2('0x38')](_0x55052c[_0x63f2('0x33')]['fields']));_0x32dbd7[_0x63f2('0x37')]=_0x32dbd7[_0x63f2('0x37')][_0x63f2('0x39')]?_0x32dbd7[_0x63f2('0x37')]:_0x12aa20[_0x63f2('0x36')];if(!_0x55052c[_0x63f2('0x33')][_0x63f2('0x3a')](_0x63f2('0x3b'))){_0x32dbd7['limit']=qs[_0x63f2('0x20')](_0x55052c['query'][_0x63f2('0x20')]);_0x32dbd7['offset']=qs['offset'](_0x55052c[_0x63f2('0x33')]['offset']);}_0x32dbd7['order']=qs[_0x63f2('0x3c')](_0x55052c['query']['sort']);_0x32dbd7[_0x63f2('0x3d')]=qs[_0x63f2('0x34')](_[_0x63f2('0x3e')](_0x55052c[_0x63f2('0x33')],_0x12aa20[_0x63f2('0x34')]),_0x1d5e02);if(_0x55052c['query'][_0x63f2('0x3f')]){_0x32dbd7['where']=_[_0x63f2('0x40')](_0x32dbd7[_0x63f2('0x3d')],{'$or':_[_0x63f2('0x2e')](_0x1d5e02,function(_0x17fa3f){if(_0x17fa3f[_0x63f2('0x41')]!=='VIRTUAL'){var _0x50a4a4={};_0x50a4a4[_0x17fa3f[_0x63f2('0x2b')]]={'$like':'%'+_0x55052c[_0x63f2('0x33')][_0x63f2('0x3f')]+'%'};return _0x50a4a4;}})});}_0x32dbd7=_[_0x63f2('0x40')]({},_0x32dbd7,_0x55052c['options']);var _0xddddfb={'where':_0x32dbd7[_0x63f2('0x3d')]};return db[_0x63f2('0x2f')][_0x63f2('0x21')](_0xddddfb)[_0x63f2('0x27')](function(_0x12aaa9){_0x4ab3bb[_0x63f2('0x21')]=_0x12aaa9;if(_0x55052c[_0x63f2('0x33')][_0x63f2('0x42')]){_0x32dbd7[_0x63f2('0x43')]=[{'all':!![]}];}return db['Schedule'][_0x63f2('0x44')](_0x32dbd7);})[_0x63f2('0x27')](function(_0x3403f6){_0x4ab3bb['rows']=_0x3403f6;return _0x4ab3bb;})[_0x63f2('0x27')](respondWithFilteredResult(_0x4d0dd7,_0x32dbd7))[_0x63f2('0x45')](handleError(_0x4d0dd7,null));};exports[_0x63f2('0x46')]=function(_0x12e665,_0x5cc6d4){var _0x39c846={'raw':![],'where':{'id':_0x12e665['params']['id']}},_0x4887f6={};_0x4887f6['model']=_[_0x63f2('0x32')](db[_0x63f2('0x2f')]['rawAttributes']);_0x4887f6[_0x63f2('0x33')]=_[_0x63f2('0x32')](_0x12e665[_0x63f2('0x33')]);_0x4887f6[_0x63f2('0x34')]=_[_0x63f2('0x35')](_0x4887f6['model'],_0x4887f6[_0x63f2('0x33')]);_0x39c846[_0x63f2('0x37')]=_[_0x63f2('0x35')](_0x4887f6[_0x63f2('0x36')],qs['fields'](_0x12e665['query'][_0x63f2('0x38')]));_0x39c846[_0x63f2('0x37')]=_0x39c846[_0x63f2('0x37')][_0x63f2('0x39')]?_0x39c846[_0x63f2('0x37')]:_0x4887f6[_0x63f2('0x36')];if(_0x12e665[_0x63f2('0x33')]['includeAll']){_0x39c846['include']=[{'all':!![]}];}_0x39c846=_[_0x63f2('0x40')]({},_0x39c846,_0x12e665['options']);return db[_0x63f2('0x2f')][_0x63f2('0x47')](_0x39c846)[_0x63f2('0x27')](handleEntityNotFound(_0x5cc6d4,null))['then'](respondWithResult(_0x5cc6d4,null))[_0x63f2('0x45')](handleError(_0x5cc6d4,null));};exports[_0x63f2('0x48')]=function(_0x3ae3f0,_0x1c987e){return db['Schedule'][_0x63f2('0x48')](_0x3ae3f0[_0x63f2('0x49')],{})[_0x63f2('0x27')](function(_0x4f5dfc){var _0x48765b=_0x3ae3f0[_0x63f2('0x4a')][_0x63f2('0x29')]({'plain':!![]});if(!_0x48765b)throw new Error(_0x63f2('0x4b'));if(_0x48765b[_0x63f2('0x4c')]===_0x63f2('0x4a')){var _0x1c850b=_0x4f5dfc[_0x63f2('0x29')]({'plain':!![]});var _0x5f2bd7='Scheduler';return db[_0x63f2('0x4d')][_0x63f2('0x47')]({'where':{'name':_0x5f2bd7,'userProfileId':_0x48765b[_0x63f2('0x4e')]},'raw':!![]})[_0x63f2('0x27')](function(_0x13b666){if(_0x13b666&&_0x13b666[_0x63f2('0x4f')]===0x0){return db['UserProfileResource'][_0x63f2('0x48')]({'name':_0x1c850b[_0x63f2('0x2b')],'resourceId':_0x1c850b['id'],'type':_0x13b666[_0x63f2('0x2b')],'sectionId':_0x13b666['id']},{})[_0x63f2('0x27')](function(){return _0x4f5dfc;});}else{return _0x4f5dfc;}})[_0x63f2('0x45')](function(_0x22a868){logger['error'](_0x63f2('0x50'),_0x22a868);throw _0x22a868;});}return _0x4f5dfc;})[_0x63f2('0x27')](respondWithResult(_0x1c987e,0xc9))[_0x63f2('0x45')](handleError(_0x1c987e,null));};exports['update']=function(_0x111840,_0x55c6f1){if(_0x111840['body']['id']){delete _0x111840[_0x63f2('0x49')]['id'];}return db[_0x63f2('0x2f')]['find']({'where':{'id':_0x111840[_0x63f2('0x51')]['id']}})[_0x63f2('0x27')](handleEntityNotFound(_0x55c6f1,null))[_0x63f2('0x27')](saveUpdates(_0x111840['body'],null))[_0x63f2('0x27')](respondWithResult(_0x55c6f1,null))[_0x63f2('0x45')](handleError(_0x55c6f1,null));};exports[_0x63f2('0x28')]=function(_0xf031e5,_0x4ed8eb){return db[_0x63f2('0x2f')][_0x63f2('0x47')]({'where':{'id':_0xf031e5['params']['id']}})[_0x63f2('0x27')](handleEntityNotFound(_0x4ed8eb,null))[_0x63f2('0x27')](removeEntity(_0x4ed8eb,null))[_0x63f2('0x45')](handleError(_0x4ed8eb,null));};exports[_0x63f2('0x52')]=function(_0xaeedf6,_0x4b71d2,_0x38a61c){var _0x8b267d=require('../../config/schedule');return db['Schedule'][_0x63f2('0x47')]({'where':{'id':_0xaeedf6['params']['id']},'raw':!![]})[_0x63f2('0x27')](handleEntityNotFound(_0x4b71d2,null))[_0x63f2('0x27')](function(){_0x8b267d[_0x63f2('0x52')](_0xaeedf6[_0x63f2('0x51')]['id']);})[_0x63f2('0x27')](respondWithStatusCode(_0x4b71d2,null))[_0x63f2('0x45')](handleError(_0x4b71d2,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 02645c1..4fa5686 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 _0xe0c7=['Schedule','tools_schedules','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define'];(function(_0x590eb2,_0x2b4f39){var _0x1d1c2c=function(_0x38eda0){while(--_0x38eda0){_0x590eb2['push'](_0x590eb2['shift']());}};_0x1d1c2c(++_0x2b4f39);}(_0xe0c7,0x10a));var _0x7e0c=function(_0x5d0e5a,_0x5e21c2){_0x5d0e5a=_0x5d0e5a-0x0;var _0x5849bf=_0xe0c7[_0x5d0e5a];return _0x5849bf;};'use strict';var _=require(_0x7e0c('0x0'));var util=require(_0x7e0c('0x1'));var logger=require(_0x7e0c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7e0c('0x3'));var rp=require(_0x7e0c('0x4'));var fs=require('fs');var path=require(_0x7e0c('0x5'));var rimraf=require('rimraf');var config=require(_0x7e0c('0x6'));var attributes=require(_0x7e0c('0x7'));module[_0x7e0c('0x8')]=function(_0x23aa1d,_0x3d3d1b){return _0x23aa1d[_0x7e0c('0x9')](_0x7e0c('0xa'),attributes,{'tableName':_0x7e0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x511f=['./schedule.attributes','Schedule','tools_schedules','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e4ff2,_0x30c8e7){var _0x49a1c7=function(_0x2256d1){while(--_0x2256d1){_0x4e4ff2['push'](_0x4e4ff2['shift']());}};_0x49a1c7(++_0x30c8e7);}(_0x511f,0x1db));var _0xf511=function(_0x3cb939,_0x24c013){_0x3cb939=_0x3cb939-0x0;var _0x2b511d=_0x511f[_0x3cb939];return _0x2b511d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf511('0x0'))(_0xf511('0x1'));var moment=require(_0xf511('0x2'));var BPromise=require(_0xf511('0x3'));var rp=require(_0xf511('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf511('0x5'));module['exports']=function(_0x3ae6ba,_0x2faaed){return _0x3ae6ba['define'](_0xf511('0x6'),attributes,{'tableName':_0xf511('0x7'),'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 3b6832c..1f91099 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 _0x16d9=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x517557,_0x45ca85){var _0x4b1ed6=function(_0x3b1d0a){while(--_0x3b1d0a){_0x517557['push'](_0x517557['shift']());}};_0x4b1ed6(++_0x45ca85);}(_0x16d9,0x71));var _0x916d=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x16d9[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x916d('0x0'));var util=require('util');var moment=require(_0x916d('0x1'));var BPromise=require(_0x916d('0x2'));var rs=require(_0x916d('0x3'));var fs=require('fs');var Redis=require(_0x916d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x916d('0x5'));var logger=require(_0x916d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x916d('0x7')][_0x916d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b4c30,_0x150148,_0x591f6e){return new BPromise(function(_0x252a0e,_0x4682ec){return client[_0x916d('0x9')](_0x5b4c30,_0x591f6e)['then'](function(_0x496e4c){logger[_0x916d('0xa')](_0x916d('0xb'),_0x150148,_0x916d('0xc'));logger['debug'](_0x916d('0xd'),_0x150148,'request\x20sent',JSON[_0x916d('0xe')](_0x496e4c));if(_0x496e4c[_0x916d('0xf')]){if(_0x496e4c[_0x916d('0xf')]['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x150148,_0x496e4c[_0x916d('0xf')][_0x916d('0x10')]);return _0x4682ec(_0x496e4c['error']['message']);}logger['error'](_0x916d('0xb'),_0x150148,_0x496e4c['error'][_0x916d('0x10')]);return _0x252a0e(_0x496e4c[_0x916d('0xf')][_0x916d('0x10')]);}else{logger[_0x916d('0xa')](_0x916d('0xb'),_0x150148,'request\x20sent');_0x252a0e(_0x496e4c[_0x916d('0x11')][_0x916d('0x10')]);}})[_0x916d('0x12')](function(_0x4b5e89){logger[_0x916d('0xf')](_0x916d('0xb'),_0x150148,_0x4b5e89);_0x4682ec(_0x4b5e89);});});} \ No newline at end of file +var _0x26b5=['stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent'];(function(_0xc817b1,_0x260920){var _0x232cc0=function(_0x4fe67a){while(--_0x4fe67a){_0xc817b1['push'](_0xc817b1['shift']());}};_0x232cc0(++_0x260920);}(_0x26b5,0x8c));var _0x526b=function(_0x3cf37a,_0x4b8a49){_0x3cf37a=_0x3cf37a-0x0;var _0x53675c=_0x26b5[_0x3cf37a];return _0x53675c;};'use strict';var _=require(_0x526b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x526b('0x1'));var fs=require('fs');var Redis=require(_0x526b('0x2'));var db=require(_0x526b('0x3'))['db'];var utils=require(_0x526b('0x4'));var logger=require(_0x526b('0x5'))(_0x526b('0x6'));var config=require(_0x526b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x526b('0x8')][_0x526b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3decb0,_0x1be5fd,_0xf73dea){return new BPromise(function(_0x3d5e40,_0x6cc4be){return client[_0x526b('0xa')](_0x3decb0,_0xf73dea)[_0x526b('0xb')](function(_0x1b8a57){logger['info']('Schedule,\x20%s,\x20%s',_0x1be5fd,'request\x20sent');logger[_0x526b('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1be5fd,_0x526b('0xd'),JSON[_0x526b('0xe')](_0x1b8a57));if(_0x1b8a57[_0x526b('0xf')]){if(_0x1b8a57['error'][_0x526b('0x10')]===0x1f4){logger['error'](_0x526b('0x11'),_0x1be5fd,_0x1b8a57['error'][_0x526b('0x12')]);return _0x6cc4be(_0x1b8a57['error'][_0x526b('0x12')]);}logger[_0x526b('0xf')](_0x526b('0x11'),_0x1be5fd,_0x1b8a57[_0x526b('0xf')][_0x526b('0x12')]);return _0x3d5e40(_0x1b8a57[_0x526b('0xf')]['message']);}else{logger[_0x526b('0x13')](_0x526b('0x11'),_0x1be5fd,_0x526b('0xd'));_0x3d5e40(_0x1b8a57[_0x526b('0x14')][_0x526b('0x12')]);}})[_0x526b('0x15')](function(_0x64d0e7){logger[_0x526b('0xf')](_0x526b('0x11'),_0x1be5fd,_0x64d0e7);_0x6cc4be(_0x64d0e7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 1c14e6c..bf58507 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 _0x5d35=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x5430bb,_0x468423){var _0x207476=function(_0xaa84c){while(--_0xaa84c){_0x5430bb['push'](_0x5430bb['shift']());}};_0x207476(++_0x468423);}(_0x5d35,0x153));var _0x55d3=function(_0x1ef19a,_0x1afc26){_0x1ef19a=_0x1ef19a-0x0;var _0x2707c0=_0x5d35[_0x1ef19a];return _0x2707c0;};'use strict';var multer=require(_0x55d3('0x0'));var util=require('util');var path=require(_0x55d3('0x1'));var timeout=require(_0x55d3('0x2'));var express=require(_0x55d3('0x3'));var router=express[_0x55d3('0x4')]();var fs_extra=require(_0x55d3('0x5'));var auth=require(_0x55d3('0x6'));var interaction=require(_0x55d3('0x7'));var config=require(_0x55d3('0x8'));var controller=require(_0x55d3('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x55d3('0xa')]('/describe',auth[_0x55d3('0xb')](),controller[_0x55d3('0xc')]);router[_0x55d3('0xa')](_0x55d3('0xd'),auth['isAuthenticated'](),controller[_0x55d3('0xe')]);router[_0x55d3('0xa')](_0x55d3('0xf'),auth['isAuthenticated'](),controller[_0x55d3('0x10')]);router[_0x55d3('0x11')]('/',auth[_0x55d3('0xb')](),controller[_0x55d3('0x12')]);router['put'](_0x55d3('0xd'),auth['isAuthenticated'](),controller[_0x55d3('0x13')]);router[_0x55d3('0x14')](_0x55d3('0xd'),auth[_0x55d3('0xb')](),controller[_0x55d3('0x15')]);module[_0x55d3('0x16')]=router; \ No newline at end of file +var _0xcd5e=['/:id','show','/:id/download','post','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x7c344,_0x158b3d){var _0x3639cf=function(_0x15c448){while(--_0x15c448){_0x7c344['push'](_0x7c344['shift']());}};_0x3639cf(++_0x158b3d);}(_0xcd5e,0x126));var _0xecd5=function(_0x3bf233,_0x50fb57){_0x3bf233=_0x3bf233-0x0;var _0x3d97cb=_0xcd5e[_0x3bf233];return _0x3d97cb;};'use strict';var multer=require(_0xecd5('0x0'));var util=require(_0xecd5('0x1'));var path=require(_0xecd5('0x2'));var timeout=require('connect-timeout');var express=require(_0xecd5('0x3'));var router=express[_0xecd5('0x4')]();var fs_extra=require(_0xecd5('0x5'));var auth=require(_0xecd5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xecd5('0x7'));var controller=require('./screenRecording.controller');router[_0xecd5('0x8')]('/',auth[_0xecd5('0x9')](),controller['index']);router['get'](_0xecd5('0xa'),auth[_0xecd5('0x9')](),controller[_0xecd5('0xb')]);router[_0xecd5('0x8')](_0xecd5('0xc'),auth[_0xecd5('0x9')](),controller[_0xecd5('0xd')]);router[_0xecd5('0x8')](_0xecd5('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xecd5('0xf')]('/',auth[_0xecd5('0x9')](),controller['create']);router['put'](_0xecd5('0xc'),auth[_0xecd5('0x9')](),controller['update']);router[_0xecd5('0x10')](_0xecd5('0xc'),auth[_0xecd5('0x9')](),controller[_0xecd5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index d91fb46..62a2bf3 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 _0xb19a=['MM-DD-YYYY\x20HH:mm','format','toString','createdAt','sequelize','../../config/environment','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE'];(function(_0x11ab1e,_0x42885c){var _0x2507ea=function(_0x205436){while(--_0x205436){_0x11ab1e['push'](_0x11ab1e['shift']());}};_0x2507ea(++_0x42885c);}(_0xb19a,0xd0));var _0xab19=function(_0x2ecc2c,_0x3bf3f9){_0x2ecc2c=_0x2ecc2c-0x0;var _0x1d33de=_0xb19a[_0x2ecc2c];return _0x1d33de;};'use strict';var Sequelize=require(_0xab19('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xab19('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xab19('0x2')](_0xab19('0x3'))?path[_0xab19('0x4')](this[_0xab19('0x2')](_0xab19('0x3'))):undefined;}},'interactionid':{'type':Sequelize[_0xab19('0x5')]},'channel':{'type':Sequelize[_0xab19('0x5')]},'value':{'type':Sequelize['STRING'],'set':function(_0x9d5c1d){var _0x131291=_0x9d5c1d['replace'](/\\/g,'/');this[_0xab19('0x6')]('value',_0x131291);}},'rating':{'type':Sequelize[_0xab19('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xab19('0x7')],'set':function(_0x2c6a67){this[_0xab19('0x6')](_0xab19('0x8'),moment()[_0xab19('0x9')](_0x2c6a67,'ms'));this[_0xab19('0x6')](_0xab19('0xa'),moment());this[_0xab19('0x6')](_0xab19('0xb'),_0x2c6a67);}},'startedAt':{'type':Sequelize[_0xab19('0xc')],'get':function(){return moment(this[_0xab19('0x2')]('startedAt'))['format'](_0xab19('0xd'))['toString']();}},'closedAt':{'type':Sequelize[_0xab19('0xc')],'get':function(){return moment(this[_0xab19('0x2')](_0xab19('0xa')))[_0xab19('0xe')](_0xab19('0xd'))[_0xab19('0xf')]();}},'createdAt':{'type':Sequelize[_0xab19('0xc')],'get':function(){return moment(this['getDataValue'](_0xab19('0x10')))[_0xab19('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xab19('0xf')]();}},'updatedAt':{'type':Sequelize[_0xab19('0xc')],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0xab19('0xe')](_0xab19('0xd'))[_0xab19('0xf')]();}}}; \ No newline at end of file +var _0x723c=['format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','exports','getDataValue','value','extname','STRING','setDataValue','INTEGER','subtract','closedAt','DATE','startedAt'];(function(_0x4eaa26,_0x42539c){var _0x28b8dc=function(_0x34701b){while(--_0x34701b){_0x4eaa26['push'](_0x4eaa26['shift']());}};_0x28b8dc(++_0x42539c);}(_0x723c,0x1ad));var _0xc723=function(_0x17bcaa,_0x50720e){_0x17bcaa=_0x17bcaa-0x0;var _0x1b297f=_0x723c[_0x17bcaa];return _0x1b297f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc723('0x0'));var path=require(_0xc723('0x1'));var config=require('../../config/environment');module[_0xc723('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc723('0x3')](_0xc723('0x4'))?path[_0xc723('0x5')](this[_0xc723('0x3')](_0xc723('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xc723('0x6')]},'channel':{'type':Sequelize[_0xc723('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x94e3de){var _0x3e887f=_0x94e3de['replace'](/\\/g,'/');this[_0xc723('0x7')](_0xc723('0x4'),_0x3e887f);}},'rating':{'type':Sequelize[_0xc723('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc723('0x8')],'set':function(_0x3d17ff){this['setDataValue']('startedAt',moment()[_0xc723('0x9')](_0x3d17ff,'ms'));this[_0xc723('0x7')](_0xc723('0xa'),moment());this[_0xc723('0x7')]('duration',_0x3d17ff);}},'startedAt':{'type':Sequelize[_0xc723('0xb')],'get':function(){return moment(this[_0xc723('0x3')](_0xc723('0xc')))[_0xc723('0xd')](_0xc723('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0xc723('0xb')],'get':function(){return moment(this[_0xc723('0x3')](_0xc723('0xa')))[_0xc723('0xd')](_0xc723('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xc723('0xb')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xc723('0xd')](_0xc723('0xe'))[_0xc723('0xf')]();}},'updatedAt':{'type':Sequelize[_0xc723('0xb')],'get':function(){return moment(this[_0xc723('0x3')](_0xc723('0x10')))[_0xc723('0xd')](_0xc723('0xe'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 9fb8356..6ce801f 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 _0x5fc3=['status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','secrets','join','Sequelize','ValidationError','filename','unlink','message','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x94e3a2,_0x9d73a0){var _0x426847=function(_0x42b9a9){while(--_0x42b9a9){_0x94e3a2['push'](_0x94e3a2['shift']());}};_0x426847(++_0x9d73a0);}(_0x5fc3,0xa8));var _0x35fc=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x5fc3[_0xa4c85];return _0x172c1f;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x2d')](_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26')),[_0x35fc('0x2e')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x26b7cb[_0x35fc('0x2f')]);_0x9f3c8a[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x9f3c8a['model'],_0x9f3c8a['query']);_0x383837[_0x35fc('0x33')]=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs[_0x35fc('0x34')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x34')]));_0x383837[_0x35fc('0x33')]=_0x383837[_0x35fc('0x33')]['length']?_0x383837[_0x35fc('0x33')]:_0x9f3c8a[_0x35fc('0x2c')];if(!_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x35')](_0x35fc('0x36'))){_0x383837[_0x35fc('0x1c')]=qs['limit'](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x1c')]);_0x383837[_0x35fc('0x1a')]=qs['offset'](_0x26b7cb[_0x35fc('0x2f')]['offset']);}_0x383837[_0x35fc('0x37')]=qs[_0x35fc('0x38')](_0x26b7cb[_0x35fc('0x2f')][_0x35fc('0x38')]);_0x383837['where']=qs['filters'](_['pick'](_0x26b7cb[_0x35fc('0x2f')],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2f')]['filter']){_0x383837[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x383837[_0x35fc('0x39')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x1c10e0){if(_0x1c10e0[_0x35fc('0x2b')]!==_0x35fc('0x3b')){var _0x4ec0dc={};_0x4ec0dc[_0x1c10e0[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb[_0x35fc('0x2f')]['filter']+'%'};return _0x4ec0dc;}})});}_0x383837=_[_0x35fc('0x3a')]({},_0x383837,_0x26b7cb[_0x35fc('0x3c')]);var _0x1aac67={'where':_0x383837[_0x35fc('0x39')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1aac67)['then'](function(_0x3f6480){_0x3735da[_0x35fc('0x1d')]=_0x3f6480;if(_0x26b7cb[_0x35fc('0x2f')]['includeAll']){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db[_0x35fc('0x29')]['findAll'](_0x383837);})[_0x35fc('0x24')](function(_0x280af1){_0x3735da[_0x35fc('0x3e')]=_0x280af1;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x3f')](handleError(_0x645eac,null));};exports[_0x35fc('0x40')]=function(_0x211b70,_0x3ec51f){var _0x5a7e9e={'raw':![],'where':{'id':_0x211b70[_0x35fc('0x41')]['id']}},_0x596e83={};_0x596e83[_0x35fc('0x2c')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x596e83[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x211b70['query']);_0x596e83[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x596e83[_0x35fc('0x2c')],_0x596e83[_0x35fc('0x2f')]);_0x5a7e9e['attributes']=_['intersection'](_0x596e83['model'],qs['fields'](_0x211b70['query'][_0x35fc('0x34')]));_0x5a7e9e[_0x35fc('0x33')]=_0x5a7e9e['attributes'][_0x35fc('0x42')]?_0x5a7e9e['attributes']:_0x596e83[_0x35fc('0x2c')];if(_0x211b70[_0x35fc('0x2f')][_0x35fc('0x43')]){_0x5a7e9e[_0x35fc('0x3d')]=[{'all':!![]}];}_0x5a7e9e=_[_0x35fc('0x3a')]({},_0x5a7e9e,_0x211b70['options']);return db[_0x35fc('0x29')][_0x35fc('0x44')](_0x5a7e9e)['then'](handleEntityNotFound(_0x3ec51f,null))[_0x35fc('0x24')](respondWithResult(_0x3ec51f,null))[_0x35fc('0x3f')](handleError(_0x3ec51f,null));};exports[_0x35fc('0x45')]=function(_0x211746,_0x5bc8c3){return db[_0x35fc('0x29')]['create'](_0x211746['body'],{})[_0x35fc('0x24')](respondWithResult(_0x5bc8c3,0xc9))[_0x35fc('0x3f')](handleError(_0x5bc8c3,null));};exports[_0x35fc('0x23')]=function(_0xca8aef,_0xf2ca20){if(_0xca8aef[_0x35fc('0x46')]['id']){delete _0xca8aef[_0x35fc('0x46')]['id'];}delete _0xca8aef[_0x35fc('0x46')]['duration'];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x47')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x48')];delete _0xca8aef[_0x35fc('0x46')][_0x35fc('0x49')];return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0xca8aef[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0xf2ca20,null))[_0x35fc('0x24')](saveUpdates(_0xca8aef[_0x35fc('0x46')],null))[_0x35fc('0x24')](respondWithResult(_0xf2ca20,null))[_0x35fc('0x3f')](handleError(_0xf2ca20,null));};exports['describe']=function(_0x553ed6,_0x144f77){return db[_0x35fc('0x29')][_0x35fc('0x4a')]()[_0x35fc('0x24')](respondWithResult(_0x144f77,null))[_0x35fc('0x3f')](handleError(_0x144f77,null));};exports[_0x35fc('0x4b')]=function(_0x4a4798,_0x4f024c,_0x388521){var _0x19b2ce=require(_0x35fc('0x4c'));var _0x38bc78=![];var _0x5b2595={};if(_0x4a4798[_0x35fc('0x2f')][_0x35fc('0x2b')]&&_0x4a4798['query'][_0x35fc('0x2b')]===_0x35fc('0x4d')){_0x5b2595['uniqueid']=_0x4a4798[_0x35fc('0x41')]['id'];}else{_0x5b2595['id']=_0x4a4798[_0x35fc('0x41')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':_0x5b2595,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4f024c,null))['then'](function(_0x240338){if(_0x240338){var _0x2ea8d6=path['join'](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x240338[_0x35fc('0x49')]);var _0x145854=util[_0x35fc('0x2e')]('%s.cypher',_0x2ea8d6);if(fs[_0x35fc('0x50')](_0x145854)){_0x38bc78=!![];return _0x19b2ce[_0x35fc('0x51')](_0x145854,_0x2ea8d6,config[_0x35fc('0x52')]['recording'])[_0x35fc('0x24')](function(){return _0x240338;});}return _0x240338;}})[_0x35fc('0x24')](function(_0x47fb1a){if(_0x47fb1a){var _0x35a676=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x47fb1a[_0x35fc('0x49')]);if(!fs[_0x35fc('0x50')](_0x35a676)){throw new db[(_0x35fc('0x54'))][(_0x35fc('0x55'))]('ScreenRecording\x20not\x20found');}if(_0x47fb1a[_0x35fc('0x56')]){return _0x4f024c[_0x35fc('0x4b')](_0x35a676,_0x47fb1a[_0x35fc('0x56')]+path['extname'](_0x35a676),function(){if(_0x38bc78){fs[_0x35fc('0x57')](_0x35a676);}});}else{return _0x4f024c['download'](_0x35a676,function(_0x4ceacc){if(_0x38bc78){fs['unlink'](_0x35a676);}});}}})[_0x35fc('0x3f')](function(_0xb1c68a){if(_0xb1c68a[_0x35fc('0x58')]===_0x35fc('0x59')){_0x4f024c[_0x35fc('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f024c,null);}});};exports['destroy']=function(_0x4faef4,_0x51d231){return db[_0x35fc('0x29')][_0x35fc('0x44')]({'where':{'id':_0x4faef4[_0x35fc('0x41')]['id']}})[_0x35fc('0x24')](function(_0x511e8b){if(_[_0x35fc('0x5a')](_0x511e8b)){throw new ReferenceError(_0x35fc('0x5b'));}return _0x511e8b;})[_0x35fc('0x24')](function(_0x1b0063){var _0x37bea1=path[_0x35fc('0x53')](config[_0x35fc('0x4e')],_0x35fc('0x4f'),_0x1b0063[_0x35fc('0x49')]);logger['info'](_0x35fc('0x5c'),_0x37bea1);if(!_['isNil'](_0x1b0063[_0x35fc('0x49')])&&fs[_0x35fc('0x50')](_0x37bea1)){logger[_0x35fc('0x5d')](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}_0x37bea1=_0x37bea1+'.cypher';if(!_['isNil'](_0x1b0063['value'])&&fs[_0x35fc('0x50')](_0x37bea1)){logger['info'](_0x35fc('0x5e')+_0x37bea1+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x35fc('0x5f')](_0x37bea1);}return _0x1b0063;})['then'](function(_0x42a53a){if(!_0x42a53a)throw new InternalError();return _0x42a53a[_0x35fc('0x25')]();})[_0x35fc('0x24')](function(){_0x51d231[_0x35fc('0x18')](0xcc)['end']();})[_0x35fc('0x3f')](handleError(_0x51d231,null));}; \ No newline at end of file +var _0x2eb2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf'];(function(_0x4ecbbc,_0x473214){var _0x2b7bda=function(_0x561b08){while(--_0x561b08){_0x4ecbbc['push'](_0x4ecbbc['shift']());}};_0x2b7bda(++_0x473214);}(_0x2eb2,0x19f));var _0x22eb=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x2eb2[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x2c')](_['map'](_0x1599c7,_0x22eb('0x24')),[_0x22eb('0x2d')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x49dd59[_0x22eb('0x2e')]);_0x44cf91[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x44cf91[_0x22eb('0x32')],_0x44cf91[_0x22eb('0x2e')]);_0x25e5bc[_0x22eb('0x33')]=_['intersection'](_0x44cf91['model'],qs[_0x22eb('0x34')](_0x49dd59['query']['fields']));_0x25e5bc[_0x22eb('0x33')]=_0x25e5bc[_0x22eb('0x33')][_0x22eb('0x35')]?_0x25e5bc[_0x22eb('0x33')]:_0x44cf91[_0x22eb('0x32')];if(!_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x36')](_0x22eb('0x37'))){_0x25e5bc[_0x22eb('0x38')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc['offset']=qs['offset'](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x19')]);}_0x25e5bc['order']=qs[_0x22eb('0x39')](_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x39')]);_0x25e5bc[_0x22eb('0x3a')]=qs[_0x22eb('0x30')](_['pick'](_0x49dd59[_0x22eb('0x2e')],_0x44cf91[_0x22eb('0x30')]),_0x1599c7);if(_0x49dd59['query'][_0x22eb('0x3b')]){_0x25e5bc[_0x22eb('0x3a')]=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x3a')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x5382eb){if(_0x5382eb['type']!==_0x22eb('0x3d')){var _0x6cd651={};_0x6cd651[_0x5382eb['name']]={'$like':'%'+_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3b')]+'%'};return _0x6cd651;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59['options']);var _0x1d977c={'where':_0x25e5bc[_0x22eb('0x3a')]};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x1d977c)[_0x22eb('0x20')](function(_0x39778e){_0x7c0119['count']=_0x39778e;if(_0x49dd59[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x25e5bc['include']=[{'all':!![]}];}return db[_0x22eb('0x27')][_0x22eb('0x3f')](_0x25e5bc);})[_0x22eb('0x20')](function(_0x30cb10){_0x7c0119[_0x22eb('0x40')]=_0x30cb10;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x41')](handleError(_0x2a950e,null));};exports[_0x22eb('0x42')]=function(_0x1bafa3,_0x82ace8){var _0x3e1826={'raw':![],'where':{'id':_0x1bafa3[_0x22eb('0x43')]['id']}},_0x1cf1e0={};_0x1cf1e0[_0x22eb('0x32')]=_[_0x22eb('0x2f')](db[_0x22eb('0x27')][_0x22eb('0x28')]);_0x1cf1e0[_0x22eb('0x2e')]=_['keys'](_0x1bafa3[_0x22eb('0x2e')]);_0x1cf1e0[_0x22eb('0x30')]=_['intersection'](_0x1cf1e0[_0x22eb('0x32')],_0x1cf1e0[_0x22eb('0x2e')]);_0x3e1826['attributes']=_['intersection'](_0x1cf1e0['model'],qs[_0x22eb('0x34')](_0x1bafa3[_0x22eb('0x2e')]['fields']));_0x3e1826['attributes']=_0x3e1826[_0x22eb('0x33')][_0x22eb('0x35')]?_0x3e1826[_0x22eb('0x33')]:_0x1cf1e0[_0x22eb('0x32')];if(_0x1bafa3[_0x22eb('0x2e')][_0x22eb('0x3e')]){_0x3e1826[_0x22eb('0x44')]=[{'all':!![]}];}_0x3e1826=_[_0x22eb('0x3c')]({},_0x3e1826,_0x1bafa3['options']);return db['ScreenRecording'][_0x22eb('0x45')](_0x3e1826)['then'](handleEntityNotFound(_0x82ace8,null))[_0x22eb('0x20')](respondWithResult(_0x82ace8,null))['catch'](handleError(_0x82ace8,null));};exports[_0x22eb('0x46')]=function(_0x5c41c0,_0x4b2f86){return db['ScreenRecording']['create'](_0x5c41c0[_0x22eb('0x47')],{})['then'](respondWithResult(_0x4b2f86,0xc9))[_0x22eb('0x41')](handleError(_0x4b2f86,null));};exports[_0x22eb('0x1f')]=function(_0x490bef,_0x24e6ba){if(_0x490bef['body']['id']){delete _0x490bef[_0x22eb('0x47')]['id'];}delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x48')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x49')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4a')];delete _0x490bef[_0x22eb('0x47')][_0x22eb('0x4b')];return db['ScreenRecording'][_0x22eb('0x45')]({'where':{'id':_0x490bef[_0x22eb('0x43')]['id']}})['then'](handleEntityNotFound(_0x24e6ba,null))[_0x22eb('0x20')](saveUpdates(_0x490bef[_0x22eb('0x47')],null))[_0x22eb('0x20')](respondWithResult(_0x24e6ba,null))[_0x22eb('0x41')](handleError(_0x24e6ba,null));};exports['describe']=function(_0x6c0600,_0x169ae1){return db[_0x22eb('0x27')][_0x22eb('0x4c')]()[_0x22eb('0x20')](respondWithResult(_0x169ae1,null))[_0x22eb('0x41')](handleError(_0x169ae1,null));};exports['download']=function(_0x29d7ca,_0x4e5b9f,_0x3ff406){var _0x5eecef=require(_0x22eb('0x4d'));var _0x254b53=![];var _0x4028ef={};if(_0x29d7ca[_0x22eb('0x2e')][_0x22eb('0x2a')]&&_0x29d7ca['query']['type']===_0x22eb('0x4e')){_0x4028ef[_0x22eb('0x4e')]=_0x29d7ca['params']['id'];}else{_0x4028ef['id']=_0x29d7ca[_0x22eb('0x43')]['id'];}return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':_0x4028ef,'attributes':['id',_0x22eb('0x4b')],'raw':!![]})[_0x22eb('0x20')](handleEntityNotFound(_0x4e5b9f,null))[_0x22eb('0x20')](function(_0x3a8588){if(_0x3a8588){var _0x35c997=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x3a8588['value']);var _0x19cadf=util[_0x22eb('0x2d')](_0x22eb('0x52'),_0x35c997);if(fs[_0x22eb('0x53')](_0x19cadf)){_0x254b53=!![];return _0x5eecef[_0x22eb('0x54')](_0x19cadf,_0x35c997,config[_0x22eb('0x55')][_0x22eb('0x56')])[_0x22eb('0x20')](function(){return _0x3a8588;});}return _0x3a8588;}})[_0x22eb('0x20')](function(_0x9f8465){if(_0x9f8465){var _0x3e9ab5=path[_0x22eb('0x4f')](config[_0x22eb('0x50')],_0x22eb('0x51'),_0x9f8465['value']);if(!fs['existsSync'](_0x3e9ab5)){throw new db[(_0x22eb('0x57'))][(_0x22eb('0x58'))](_0x22eb('0x59'));}if(_0x9f8465[_0x22eb('0x5a')]){return _0x4e5b9f[_0x22eb('0x5b')](_0x3e9ab5,_0x9f8465['filename']+path[_0x22eb('0x5c')](_0x3e9ab5),function(){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}else{return _0x4e5b9f['download'](_0x3e9ab5,function(_0x485408){if(_0x254b53){fs[_0x22eb('0x5d')](_0x3e9ab5);}});}}})[_0x22eb('0x41')](function(_0xb5c8ae){if(_0xb5c8ae[_0x22eb('0x5e')]===_0x22eb('0x59')){_0x4e5b9f[_0x22eb('0x17')](0x194)[_0x22eb('0x25')](_0x22eb('0x5f'));}else{return handleError(_0x4e5b9f,null);}});};exports[_0x22eb('0x21')]=function(_0x19b579,_0x164645){return db[_0x22eb('0x27')][_0x22eb('0x45')]({'where':{'id':_0x19b579[_0x22eb('0x43')]['id']}})['then'](function(_0x29dd8b){if(_[_0x22eb('0x60')](_0x29dd8b)){throw new ReferenceError(_0x22eb('0x61'));}return _0x29dd8b;})['then'](function(_0x1787ec){var _0x5ac4c5=path[_0x22eb('0x4f')](config['root'],_0x22eb('0x51'),_0x1787ec[_0x22eb('0x4b')]);logger['info'](_0x22eb('0x62'),_0x5ac4c5);if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs['existsSync'](_0x5ac4c5)){logger[_0x22eb('0x63')](_0x22eb('0x64')+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}_0x5ac4c5=_0x5ac4c5+_0x22eb('0x67');if(!_[_0x22eb('0x60')](_0x1787ec['value'])&&fs[_0x22eb('0x53')](_0x5ac4c5)){logger['info']('File:\x20\x22'+_0x5ac4c5+_0x22eb('0x65'));fs[_0x22eb('0x66')](_0x5ac4c5);}return _0x1787ec;})[_0x22eb('0x20')](function(_0x22b5c6){if(!_0x22b5c6)throw new InternalError();return _0x22b5c6[_0x22eb('0x21')]();})[_0x22eb('0x20')](function(){_0x164645[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();})['catch'](handleError(_0x164645,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 79ad861..d4634b7 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 _0x5d33=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x5c3ca6,_0x323d1c){var _0x5ae244=function(_0x483e44){while(--_0x483e44){_0x5c3ca6['push'](_0x5c3ca6['shift']());}};_0x5ae244(++_0x323d1c);}(_0x5d33,0x13f));var _0x35d3=function(_0x248fb0,_0x523b48){_0x248fb0=_0x248fb0-0x0;var _0x58076d=_0x5d33[_0x248fb0];return _0x58076d;};'use strict';var _=require(_0x35d3('0x0'));var util=require(_0x35d3('0x1'));var logger=require(_0x35d3('0x2'))(_0x35d3('0x3'));var moment=require(_0x35d3('0x4'));var BPromise=require(_0x35d3('0x5'));var rp=require(_0x35d3('0x6'));var fs=require('fs');var path=require(_0x35d3('0x7'));var rimraf=require(_0x35d3('0x8'));var config=require(_0x35d3('0x9'));var attributes=require(_0x35d3('0xa'));module['exports']=function(_0x2bfedc,_0x4df9d0){return _0x2bfedc['define'](_0x35d3('0xb'),attributes,{'tableName':_0x35d3('0xc'),'paranoid':![],'indexes':[{'name':_0x35d3('0xd'),'fields':[_0x35d3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa10c=['api','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger'];(function(_0x53e2e0,_0x5c8734){var _0x246e62=function(_0x29ea87){while(--_0x29ea87){_0x53e2e0['push'](_0x53e2e0['shift']());}};_0x246e62(++_0x5c8734);}(_0xa10c,0x9a));var _0xca10=function(_0x4c1b84,_0x4904e0){_0x4c1b84=_0x4c1b84-0x0;var _0x17af29=_0xa10c[_0x4c1b84];return _0x17af29;};'use strict';var _=require('lodash');var util=require(_0xca10('0x0'));var logger=require(_0xca10('0x1'))(_0xca10('0x2'));var moment=require('moment');var BPromise=require(_0xca10('0x3'));var rp=require(_0xca10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca10('0x5'));var config=require(_0xca10('0x6'));var attributes=require(_0xca10('0x7'));module[_0xca10('0x8')]=function(_0x2ea328,_0x29a753){return _0x2ea328[_0xca10('0x9')]('ScreenRecording',attributes,{'tableName':_0xca10('0xa'),'paranoid':![],'indexes':[{'name':_0xca10('0xb'),'fields':[_0xca10('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 2e3c1e1..0b0bf1a 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 _0xc4d2=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird'];(function(_0x1956f2,_0x52ce03){var _0x1e79cc=function(_0x2ad5ec){while(--_0x2ad5ec){_0x1956f2['push'](_0x1956f2['shift']());}};_0x1e79cc(++_0x52ce03);}(_0xc4d2,0x177));var _0x2c4d=function(_0x1b3ba2,_0x3740ef){_0x1b3ba2=_0x1b3ba2-0x0;var _0x1c5589=_0xc4d2[_0x1b3ba2];return _0x1c5589;};'use strict';var _=require(_0x2c4d('0x0'));var util=require(_0x2c4d('0x1'));var moment=require('moment');var BPromise=require(_0x2c4d('0x2'));var rs=require(_0x2c4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c4d('0x4'));var logger=require(_0x2c4d('0x5'))(_0x2c4d('0x6'));var config=require(_0x2c4d('0x7'));var jayson=require(_0x2c4d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0306,_0x2a340b,_0x15ac71){return new BPromise(function(_0x5e8429,_0x1425e2){return client[_0x2c4d('0x9')](_0x5a0306,_0x15ac71)[_0x2c4d('0xa')](function(_0x3abad6){logger[_0x2c4d('0xb')](_0x2c4d('0xc'),_0x2a340b,_0x2c4d('0xd'));logger['debug'](_0x2c4d('0xe'),_0x2a340b,_0x2c4d('0xd'),JSON['stringify'](_0x3abad6));if(_0x3abad6[_0x2c4d('0xf')]){if(_0x3abad6[_0x2c4d('0xf')][_0x2c4d('0x10')]===0x1f4){logger[_0x2c4d('0xf')](_0x2c4d('0xc'),_0x2a340b,_0x3abad6['error']['message']);return _0x1425e2(_0x3abad6['error']['message']);}logger[_0x2c4d('0xf')](_0x2c4d('0xc'),_0x2a340b,_0x3abad6[_0x2c4d('0xf')][_0x2c4d('0x11')]);return _0x5e8429(_0x3abad6[_0x2c4d('0xf')][_0x2c4d('0x11')]);}else{logger[_0x2c4d('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x2a340b,_0x2c4d('0xd'));_0x5e8429(_0x3abad6['result'][_0x2c4d('0x11')]);}})['catch'](function(_0x17960a){logger[_0x2c4d('0xf')](_0x2c4d('0xc'),_0x2a340b,_0x17960a);_0x1425e2(_0x17960a);});});} \ No newline at end of file +var _0xacc7=['../../config/environment','client','http','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ScreenRecording,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xacc7,0x70));var _0x7acc=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0xacc7[_0x60878f];return _0x1fbefb;};'use strict';var _=require(_0x7acc('0x0'));var util=require(_0x7acc('0x1'));var moment=require(_0x7acc('0x2'));var BPromise=require(_0x7acc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7acc('0x4'));var db=require(_0x7acc('0x5'))['db'];var utils=require(_0x7acc('0x6'));var logger=require(_0x7acc('0x7'))('rpc');var config=require(_0x7acc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7acc('0x9')][_0x7acc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba7d1,_0x5c4458,_0x1b21a4){return new BPromise(function(_0x4ce51c,_0x2be1fa){return client[_0x7acc('0xb')](_0x5ba7d1,_0x1b21a4)[_0x7acc('0xc')](function(_0x1fbbe0){logger[_0x7acc('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x5c4458,_0x7acc('0xe'));logger[_0x7acc('0xf')](_0x7acc('0x10'),_0x5c4458,_0x7acc('0xe'),JSON[_0x7acc('0x11')](_0x1fbbe0));if(_0x1fbbe0[_0x7acc('0x12')]){if(_0x1fbbe0[_0x7acc('0x12')][_0x7acc('0x13')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5c4458,_0x1fbbe0['error']['message']);return _0x2be1fa(_0x1fbbe0[_0x7acc('0x12')][_0x7acc('0x14')]);}logger[_0x7acc('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x5c4458,_0x1fbbe0[_0x7acc('0x12')]['message']);return _0x4ce51c(_0x1fbbe0[_0x7acc('0x12')][_0x7acc('0x14')]);}else{logger[_0x7acc('0xd')](_0x7acc('0x15'),_0x5c4458,_0x7acc('0xe'));_0x4ce51c(_0x1fbbe0[_0x7acc('0x16')]['message']);}})[_0x7acc('0x17')](function(_0x16e57d){logger[_0x7acc('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x5c4458,_0x16e57d);_0x2be1fa(_0x16e57d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 8b844c5..cd2afa8 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 _0xf56c=['gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','file','server/files/images/logos/','logologin','single','/:id/preferred','favicon','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin'];(function(_0x463e5f,_0x515c14){var _0x586587=function(_0x5b85a8){while(--_0x5b85a8){_0x463e5f['push'](_0x463e5f['shift']());}};_0x586587(++_0x515c14);}(_0xf56c,0x86));var _0xcf56=function(_0x1d3e48,_0x2868c6){_0x1d3e48=_0x1d3e48-0x0;var _0x1c07c9=_0xf56c[_0x1d3e48];return _0x1c07c9;};'use strict';var multer=require('multer');var util=require(_0xcf56('0x0'));var path=require(_0xcf56('0x1'));var timeout=require(_0xcf56('0x2'));var express=require(_0xcf56('0x3'));var router=express[_0xcf56('0x4')]();var fs_extra=require(_0xcf56('0x5'));var auth=require(_0xcf56('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf56('0x7'));var controller=require(_0xcf56('0x8'));router['get']('/',auth[_0xcf56('0x9')](),controller[_0xcf56('0xa')]);router['get']('/now',controller['getDate']);router[_0xcf56('0xb')](_0xcf56('0xc'),controller[_0xcf56('0xd')]);router[_0xcf56('0xb')](_0xcf56('0xe'),controller[_0xcf56('0xf')]);router[_0xcf56('0xb')](_0xcf56('0x10'),controller[_0xcf56('0x11')]);router['get']('/:id/gdpr',controller[_0xcf56('0x12')]);router[_0xcf56('0xb')]('/:id/preferred',controller[_0xcf56('0x13')]);router[_0xcf56('0xb')](_0xcf56('0x14'),controller[_0xcf56('0x15')]);var upload=multer({'storage':multer[_0xcf56('0x16')]({'destination':function(_0x82773f,_0x8f323d,_0x1f9944){_0x1f9944(null,path[_0xcf56('0x17')](config[_0xcf56('0x18')],'server/files/images/logos/'));},'filename':function(_0x51b6c7,_0x63e518,_0x4afc73){_0x4afc73(null,util[_0xcf56('0x19')](_0xcf56('0x1a'),_0xcf56('0x1b'),path[_0xcf56('0x1c')](_0x63e518[_0xcf56('0x1d')])));}})});router[_0xcf56('0x1e')](_0xcf56('0xe'),upload['single'](_0xcf56('0x1f')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25adef,_0x3cc9d3,_0x332067){_0x332067(null,path[_0xcf56('0x17')](config['root'],_0xcf56('0x20')));},'filename':function(_0x428508,_0x89e269,_0x27ed05){_0x27ed05(null,util[_0xcf56('0x19')](_0xcf56('0x1a'),_0xcf56('0x21'),path[_0xcf56('0x1c')](_0x89e269['originalname'])));}})});router[_0xcf56('0x1e')](_0xcf56('0x10'),upload[_0xcf56('0x22')](_0xcf56('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a871d,_0x3921ef,_0x569808){_0x569808(null,path[_0xcf56('0x17')](config[_0xcf56('0x18')],'server/files/images/logos/'));},'filename':function(_0x3ad92a,_0x246f5b,_0x5d21a5){_0x5d21a5(null,util[_0xcf56('0x19')]('%s%s','preferred',path['extname'](_0x246f5b[_0xcf56('0x1d')])));}})});router[_0xcf56('0x1e')](_0xcf56('0x23'),upload[_0xcf56('0x22')](_0xcf56('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0xcf56('0x16')]({'destination':function(_0x1c8875,_0x510b35,_0x13f4f1){_0x13f4f1(null,path['join'](config[_0xcf56('0x18')],_0xcf56('0x20')));},'filename':function(_0x2bd1e4,_0x84ebbd,_0x22327e){_0x22327e(null,util['format']('%s%s',_0xcf56('0x24'),path[_0xcf56('0x1c')](_0x84ebbd[_0xcf56('0x1d')])));}})});router['post'](_0xcf56('0x14'),upload['single'](_0xcf56('0x1f')),controller['addFavicon']);router['put'](_0xcf56('0xc'),auth[_0xcf56('0x9')](),controller['update']);module[_0xcf56('0x25')]=router; \ No newline at end of file +var _0x4eee=['get','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage','root','server/files/images/logos/','format','logo','originalname','file','join','%s%s','logologin','extname','post','single','favicon','/:id/favicon','addFavicon','put','/:id','update','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','show'];(function(_0x22ad0c,_0x56e8a1){var _0x3787a9=function(_0x1d87a9){while(--_0x1d87a9){_0x22ad0c['push'](_0x22ad0c['shift']());}};_0x3787a9(++_0x56e8a1);}(_0x4eee,0x6d));var _0xe4ee=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0x4eee[_0x191154];return _0x3dcd73;};'use strict';var multer=require(_0xe4ee('0x0'));var util=require(_0xe4ee('0x1'));var path=require(_0xe4ee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4ee('0x3')]();var fs_extra=require(_0xe4ee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe4ee('0x5'));var config=require(_0xe4ee('0x6'));var controller=require(_0xe4ee('0x7'));router['get']('/',auth[_0xe4ee('0x8')](),controller[_0xe4ee('0x9')]);router['get']('/now',controller['getDate']);router['get']('/:id',controller[_0xe4ee('0xa')]);router[_0xe4ee('0xb')](_0xe4ee('0xc'),controller[_0xe4ee('0xd')]);router[_0xe4ee('0xb')](_0xe4ee('0xe'),controller[_0xe4ee('0xf')]);router[_0xe4ee('0xb')](_0xe4ee('0x10'),controller[_0xe4ee('0x11')]);router['get'](_0xe4ee('0x12'),controller['getPreferred']);router[_0xe4ee('0xb')]('/:id/favicon',controller[_0xe4ee('0x13')]);var upload=multer({'storage':multer[_0xe4ee('0x14')]({'destination':function(_0xbf4106,_0x230c4f,_0x166520){_0x166520(null,path['join'](config[_0xe4ee('0x15')],_0xe4ee('0x16')));},'filename':function(_0x39b0e0,_0x1eaa8a,_0x404812){_0x404812(null,util[_0xe4ee('0x17')]('%s%s',_0xe4ee('0x18'),path['extname'](_0x1eaa8a[_0xe4ee('0x19')])));}})});router['post'](_0xe4ee('0xc'),upload['single'](_0xe4ee('0x1a')),controller['addLogo']);var upload=multer({'storage':multer[_0xe4ee('0x14')]({'destination':function(_0xddec8,_0x5c15de,_0xfe94ec){_0xfe94ec(null,path[_0xe4ee('0x1b')](config[_0xe4ee('0x15')],'server/files/images/logos/'));},'filename':function(_0xf01962,_0x145e88,_0x2fbda2){_0x2fbda2(null,util['format'](_0xe4ee('0x1c'),_0xe4ee('0x1d'),path[_0xe4ee('0x1e')](_0x145e88[_0xe4ee('0x19')])));}})});router[_0xe4ee('0x1f')](_0xe4ee('0xe'),upload[_0xe4ee('0x20')](_0xe4ee('0x1a')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xe4ee('0x14')]({'destination':function(_0x46f1dc,_0x4b2f37,_0x450db9){_0x450db9(null,path[_0xe4ee('0x1b')](config[_0xe4ee('0x15')],_0xe4ee('0x16')));},'filename':function(_0x1c5863,_0x34f70a,_0x1d68e3){_0x1d68e3(null,util[_0xe4ee('0x17')](_0xe4ee('0x1c'),'preferred',path['extname'](_0x34f70a[_0xe4ee('0x19')])));}})});router[_0xe4ee('0x1f')](_0xe4ee('0x12'),upload[_0xe4ee('0x20')](_0xe4ee('0x1a')),controller['addPreferred']);var upload=multer({'storage':multer[_0xe4ee('0x14')]({'destination':function(_0x501a5e,_0x329abc,_0x267b74){_0x267b74(null,path['join'](config['root'],_0xe4ee('0x16')));},'filename':function(_0x197de6,_0x8b28ed,_0x3d7eca){_0x3d7eca(null,util['format'](_0xe4ee('0x1c'),_0xe4ee('0x21'),path[_0xe4ee('0x1e')](_0x8b28ed['originalname'])));}})});router[_0xe4ee('0x1f')](_0xe4ee('0x22'),upload[_0xe4ee('0x20')]('file'),controller[_0xe4ee('0x23')]);router[_0xe4ee('0x24')](_0xe4ee('0x25'),auth[_0xe4ee('0x8')](),controller[_0xe4ee('0x26')]);module[_0xe4ee('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index fd92c2f..3481fd2 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x455728,_0x1c5cdc){var _0x9dc13c=function(_0x4a36a2){while(--_0x4a36a2){_0x455728['push'](_0x455728['shift']());}};_0x9dc13c(++_0x1c5cdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x49b181,_0x36fad6){var _0x52e383=function(_0xab812){while(--_0xab812){_0x49b181['push'](_0x49b181['shift']());}};_0x52e383(++_0x36fad6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9551ac4..11a37f9 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 _0x6824=['addFavicon','default_favicon.ico','getDate','now','utcOffset','format','eml-format','rimraf','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','sendStatus','stack','name','send','index','map','Setting','rawAttributes','type','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','options','includeAll','include','findAll','rows','show','params','length','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','favicon','defaultLogo','default_loginLogo.svg','default','securePassword','addPreferred','getPreferred','default_preferred.png','ValidationError'];(function(_0x38bf94,_0x173992){var _0x4a92e0=function(_0x692581){while(--_0x692581){_0x38bf94['push'](_0x38bf94['shift']());}};_0x4a92e0(++_0x173992);}(_0x6824,0x80));var _0x4682=function(_0x1a78f3,_0x4dfde8){_0x1a78f3=_0x1a78f3-0x0;var _0x1cf507=_0x6824[_0x1a78f3];return _0x1cf507;};'use strict';var emlformat=require(_0x4682('0x0'));var rimraf=require(_0x4682('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4682('0x2'));var moment=require('moment');var BPromise=require(_0x4682('0x3'));var Mustache=require('mustache');var util=require(_0x4682('0x4'));var path=require(_0x4682('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4682('0x6'));var fs=require('fs');var fs_extra=require(_0x4682('0x7'));var _=require(_0x4682('0x8'));var squel=require('squel');var crypto=require(_0x4682('0x9'));var jsforce=require(_0x4682('0xa'));var deskjs=require(_0x4682('0xb'));var toCsv=require(_0x4682('0xc'));var querystring=require(_0x4682('0xd'));var Papa=require('papaparse');var Redis=require(_0x4682('0xe'));var authService=require(_0x4682('0xf'));var qs=require(_0x4682('0x10'));var as=require(_0x4682('0x11'));var hardwareService=require(_0x4682('0x12'));var logger=require(_0x4682('0x13'))(_0x4682('0x14'));var utils=require(_0x4682('0x15'));var config=require(_0x4682('0x16'));var licenseUtil=require(_0x4682('0x17'));var db=require(_0x4682('0x18'))['db'];var jayson=require(_0x4682('0x19'));var client=jayson['client'][_0x4682('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x298d37,_0xfd65c4,_0x6a61d7,_0x27b506){return new BPromise(function(_0x5491cb,_0x3ae81e){var _0x33f348=_0x27b506||client;return _0x33f348[_0x4682('0x1b')](_0x298d37,_0x6a61d7)[_0x4682('0x1c')](function(_0xa192d1){logger['info'](_0x4682('0x1d'),_0xfd65c4,_0x4682('0x1e'));logger[_0x4682('0x1f')](_0x4682('0x20'),_0xfd65c4,_0x4682('0x1e'),JSON[_0x4682('0x21')](_0xa192d1));if(_0xa192d1[_0x4682('0x22')]){if(_0xa192d1[_0x4682('0x22')][_0x4682('0x23')]===0x1f4){logger['error'](_0x4682('0x1d'),_0xfd65c4,_0xa192d1[_0x4682('0x22')][_0x4682('0x24')]);return _0x3ae81e(_0xa192d1[_0x4682('0x22')][_0x4682('0x24')]);}logger[_0x4682('0x22')](_0x4682('0x1d'),_0xfd65c4,_0xa192d1[_0x4682('0x22')][_0x4682('0x24')]);return _0x5491cb(_0xa192d1[_0x4682('0x22')][_0x4682('0x24')]);}else{logger[_0x4682('0x25')](_0x4682('0x1d'),_0xfd65c4,_0x4682('0x1e'));_0x5491cb(_0xa192d1['result']['message']);}})[_0x4682('0x26')](function(_0x49d9ba){logger[_0x4682('0x22')](_0x4682('0x1d'),_0xfd65c4,_0x49d9ba);_0x3ae81e(_0x49d9ba);});});}function respondWithStatusCode(_0x192f50,_0xb6c9e2){_0xb6c9e2=_0xb6c9e2||0xcc;return function(_0x30309c){if(_0x30309c){return _0x192f50['sendStatus'](_0xb6c9e2);}return _0x192f50['status'](_0xb6c9e2)[_0x4682('0x27')]();};}function respondWithResult(_0x1e15c8,_0x4f8fb9){_0x4f8fb9=_0x4f8fb9||0xc8;return function(_0x18a106){if(_0x18a106){return _0x1e15c8[_0x4682('0x28')](_0x4f8fb9)['json'](_0x18a106);}};}function respondWithFilteredResult(_0x1959f6,_0x2d116d){return function(_0x2236f7){if(_0x2236f7){var _0x167971=typeof _0x2d116d[_0x4682('0x29')]===_0x4682('0x2a')&&typeof _0x2d116d[_0x4682('0x2b')]===_0x4682('0x2a');var _0x35f1bc=_0x2236f7[_0x4682('0x2c')];var _0x2955e1=_0x167971?0x0:_0x2d116d[_0x4682('0x29')];var _0x4e0f5d=_0x167971?_0x2236f7[_0x4682('0x2c')]:_0x2d116d[_0x4682('0x29')]+_0x2d116d['limit'];var _0x427309;if(_0x4e0f5d>=_0x35f1bc){_0x4e0f5d=_0x35f1bc;_0x427309=0xc8;}else{_0x427309=0xce;}_0x1959f6[_0x4682('0x28')](_0x427309);return _0x1959f6[_0x4682('0x2d')](_0x4682('0x2e'),_0x2955e1+'-'+_0x4e0f5d+'/'+_0x35f1bc)[_0x4682('0x2f')](_0x2236f7);}return null;};}function patchUpdates(_0x29e5e5){return function(_0x20e189){try{jsonpatch[_0x4682('0x30')](_0x20e189,_0x29e5e5,!![]);}catch(_0x31e223){return BPromise[_0x4682('0x31')](_0x31e223);}return _0x20e189[_0x4682('0x32')]();};}function saveUpdates(_0x4b6b01,_0x18cb59){return function(_0x134c94){if(_0x134c94){return _0x134c94[_0x4682('0x33')](_0x4b6b01)[_0x4682('0x1c')](function(_0x540c71){return _0x540c71;});}return null;};}function removeEntity(_0x223057,_0x21e2f4){return function(_0x3ba6bb){if(_0x3ba6bb){return _0x3ba6bb['destroy']()['then'](function(){_0x223057[_0x4682('0x28')](0xcc)[_0x4682('0x27')]();});}};}function handleEntityNotFound(_0x7a8ae0,_0x581dba){return function(_0x1598a5){if(!_0x1598a5){_0x7a8ae0[_0x4682('0x34')](0x194);}return _0x1598a5;};}function handleError(_0x6603ae,_0x44d514){_0x44d514=_0x44d514||0x1f4;return function(_0x4b330b){logger[_0x4682('0x22')](_0x4b330b[_0x4682('0x35')]);if(_0x4b330b['name']){delete _0x4b330b[_0x4682('0x36')];}_0x6603ae[_0x4682('0x28')](_0x44d514)[_0x4682('0x37')](_0x4b330b);};}exports[_0x4682('0x38')]=function(_0x4bf8d6,_0x1cf9e4){var _0x2f78c8={},_0x27f920={},_0x1cc205={'count':0x0,'rows':[]};var _0x568272=_[_0x4682('0x39')](db[_0x4682('0x3a')][_0x4682('0x3b')],function(_0x31653f){return{'name':_0x31653f['fieldName'],'type':_0x31653f[_0x4682('0x3c')]['key']};});_0x27f920['model']=_[_0x4682('0x39')](_0x568272,'name');_0x27f920['query']=_['keys'](_0x4bf8d6[_0x4682('0x3d')]);_0x27f920['filters']=_[_0x4682('0x3e')](_0x27f920[_0x4682('0x3f')],_0x27f920[_0x4682('0x3d')]);_0x2f78c8['attributes']=_[_0x4682('0x3e')](_0x27f920['model'],qs['fields'](_0x4bf8d6['query'][_0x4682('0x40')]));_0x2f78c8[_0x4682('0x41')]=_0x2f78c8[_0x4682('0x41')]['length']?_0x2f78c8[_0x4682('0x41')]:_0x27f920[_0x4682('0x3f')];if(!_0x4bf8d6[_0x4682('0x3d')][_0x4682('0x42')](_0x4682('0x43'))){_0x2f78c8[_0x4682('0x2b')]=qs[_0x4682('0x2b')](_0x4bf8d6[_0x4682('0x3d')][_0x4682('0x2b')]);_0x2f78c8[_0x4682('0x29')]=qs[_0x4682('0x29')](_0x4bf8d6['query'][_0x4682('0x29')]);}_0x2f78c8[_0x4682('0x44')]=qs[_0x4682('0x45')](_0x4bf8d6[_0x4682('0x3d')][_0x4682('0x45')]);_0x2f78c8['where']=qs[_0x4682('0x46')](_[_0x4682('0x47')](_0x4bf8d6[_0x4682('0x3d')],_0x27f920[_0x4682('0x46')]),_0x568272);if(_0x4bf8d6[_0x4682('0x3d')][_0x4682('0x48')]){_0x2f78c8[_0x4682('0x49')]=_['merge'](_0x2f78c8['where'],{'$or':_[_0x4682('0x39')](_0x568272,function(_0xc9b2f6){if(_0xc9b2f6[_0x4682('0x3c')]!=='VIRTUAL'){var _0x95306e={};_0x95306e[_0xc9b2f6[_0x4682('0x36')]]={'$like':'%'+_0x4bf8d6[_0x4682('0x3d')]['filter']+'%'};return _0x95306e;}})});}_0x2f78c8=_['merge']({},_0x2f78c8,_0x4bf8d6[_0x4682('0x4a')]);var _0x4742a4={'where':_0x2f78c8[_0x4682('0x49')]};return db[_0x4682('0x3a')][_0x4682('0x2c')](_0x4742a4)[_0x4682('0x1c')](function(_0x45e89f){_0x1cc205[_0x4682('0x2c')]=_0x45e89f;if(_0x4bf8d6[_0x4682('0x3d')][_0x4682('0x4b')]){_0x2f78c8[_0x4682('0x4c')]=[{'all':!![]}];}return db[_0x4682('0x3a')][_0x4682('0x4d')](_0x2f78c8);})['then'](function(_0x7ba12d){_0x1cc205[_0x4682('0x4e')]=_0x7ba12d;return _0x1cc205;})[_0x4682('0x1c')](respondWithFilteredResult(_0x1cf9e4,_0x2f78c8))['catch'](handleError(_0x1cf9e4,null));};exports[_0x4682('0x4f')]=function(_0x4ce1f3,_0x4afb37){var _0x3aaeed={'raw':![],'where':{'id':_0x4ce1f3[_0x4682('0x50')]['id']}},_0x249e2f={};_0x249e2f[_0x4682('0x3f')]=_['keys'](db[_0x4682('0x3a')][_0x4682('0x3b')]);_0x249e2f[_0x4682('0x3d')]=_['keys'](_0x4ce1f3[_0x4682('0x3d')]);_0x249e2f[_0x4682('0x46')]=_[_0x4682('0x3e')](_0x249e2f['model'],_0x249e2f[_0x4682('0x3d')]);_0x3aaeed[_0x4682('0x41')]=_[_0x4682('0x3e')](_0x249e2f['model'],qs['fields'](_0x4ce1f3[_0x4682('0x3d')]['fields']));_0x3aaeed[_0x4682('0x41')]=_0x3aaeed['attributes'][_0x4682('0x51')]?_0x3aaeed['attributes']:_0x249e2f['model'];if(_0x4ce1f3[_0x4682('0x3d')]['includeAll']){_0x3aaeed['include']=[{'all':!![]}];}_0x3aaeed=_['merge']({},_0x3aaeed,_0x4ce1f3[_0x4682('0x4a')]);return db[_0x4682('0x3a')][_0x4682('0x52')](_0x3aaeed)['then'](handleEntityNotFound(_0x4afb37,null))[_0x4682('0x1c')](respondWithResult(_0x4afb37,null))[_0x4682('0x26')](handleError(_0x4afb37,null));};exports[_0x4682('0x33')]=function(_0x3135b2,_0x657b8d){if(_0x3135b2['body']['id']){delete _0x3135b2[_0x4682('0x53')]['id'];}return db['Setting'][_0x4682('0x52')]({'where':{'id':_0x3135b2[_0x4682('0x50')]['id']}})[_0x4682('0x1c')](handleEntityNotFound(_0x657b8d,null))[_0x4682('0x1c')](saveUpdates(_0x3135b2[_0x4682('0x53')],null))[_0x4682('0x1c')](respondWithResult(_0x657b8d,null))[_0x4682('0x26')](handleError(_0x657b8d,null));};exports[_0x4682('0x54')]=function(_0x30949b,_0x33e8b2,_0x3d6db1){if(_0x30949b[_0x4682('0x55')]&&_0x30949b[_0x4682('0x55')][_0x4682('0x56')]){_0x30949b[_0x4682('0x53')]['logo']=_0x30949b[_0x4682('0x55')][_0x4682('0x56')];}return db[_0x4682('0x3a')][_0x4682('0x52')]({'where':{'id':_0x30949b[_0x4682('0x50')]['id']}})[_0x4682('0x1c')](handleEntityNotFound(_0x33e8b2,null))[_0x4682('0x1c')](saveUpdates(_0x30949b[_0x4682('0x53')],null))[_0x4682('0x1c')](respondWithResult(_0x33e8b2,null))[_0x4682('0x26')](handleError(_0x33e8b2,null));};exports['addLogoLogin']=function(_0xc6b88,_0x31f1f3,_0x4a0cf0){if(_0xc6b88['file']&&_0xc6b88['file'][_0x4682('0x56')]){_0xc6b88[_0x4682('0x53')][_0x4682('0x57')]=_0xc6b88['file'][_0x4682('0x56')];}return db['Setting'][_0x4682('0x52')]({'where':{'id':_0xc6b88[_0x4682('0x50')]['id']}})[_0x4682('0x1c')](handleEntityNotFound(_0x31f1f3,null))[_0x4682('0x1c')](saveUpdates(_0xc6b88['body'],null))[_0x4682('0x1c')](respondWithResult(_0x31f1f3,null))[_0x4682('0x26')](handleError(_0x31f1f3,null));};var utilLicense=require(_0x4682('0x17'));exports[_0x4682('0x58')]=function(_0x26a9fd,_0xcd5583,_0x1dbde7){var _0x266891=_0x4682('0x59');var _0x31e2a7={'custom':![]};return utilLicense[_0x4682('0x5a')]()[_0x4682('0x1c')](function(_0x5f51b8){if(_0x5f51b8){_0x31e2a7=_0x5f51b8;}return db[_0x4682('0x3a')][_0x4682('0x52')]({'where':{'id':_0x26a9fd[_0x4682('0x50')]['id']},'attributes':[_0x4682('0x5b'),_0x4682('0x57'),_0x4682('0x5c'),'favicon','defaultLogo',_0x4682('0x5d'),_0x4682('0x5e'),_0x4682('0x5f')],'raw':!![]});})[_0x4682('0x1c')](handleEntityNotFound(_0xcd5583,null))[_0x4682('0x1c')](function(_0x18b7cf){if(_0x18b7cf){var _0xb78d18=_0x18b7cf['logo']&&fs[_0x4682('0x60')](path[_0x4682('0x61')](config[_0x4682('0x62')],_0x266891,_[_0x4682('0x63')](_0x18b7cf[_0x4682('0x5b')])))?path[_0x4682('0x61')](config[_0x4682('0x62')],_0x266891,_['toLower'](_0x18b7cf['logo'])):path[_0x4682('0x61')](config[_0x4682('0x62')],_0x266891,_[_0x4682('0x63')](_0x4682('0x64')));var _0x13650b='default'+_[_0x4682('0x65')]('logo');if(_0x18b7cf[_0x13650b]||!_0x31e2a7[_0x4682('0x66')]){_0xb78d18=path[_0x4682('0x61')](config[_0x4682('0x62')],_0x266891,_[_0x4682('0x63')](_0x4682('0x64')));}if(!fs['existsSync'](_0xb78d18)){throw new db[(_0x4682('0x67'))]['ValidationError'](_[_0x4682('0x65')](_0x4682('0x5b'))+_0x4682('0x68'));}return _0xcd5583[_0x4682('0x69')](_0xb78d18);}})[_0x4682('0x26')](handleError(_0xcd5583,null));};var utilLicense=require(_0x4682('0x17'));exports[_0x4682('0x6a')]=function(_0x5ca64f,_0x48e527,_0x4086f3){var _0x214e5b=_0x4682('0x59');var _0x451f83={'custom':![]};return utilLicense[_0x4682('0x5a')]()[_0x4682('0x1c')](function(_0x4bc667){if(_0x4bc667){_0x451f83=_0x4bc667;}return db['Setting'][_0x4682('0x52')]({'where':{'id':_0x5ca64f[_0x4682('0x50')]['id']},'attributes':[_0x4682('0x5b'),_0x4682('0x57'),'preferred',_0x4682('0x6b'),_0x4682('0x6c'),_0x4682('0x5d'),_0x4682('0x5e'),_0x4682('0x5f')],'raw':!![]});})[_0x4682('0x1c')](handleEntityNotFound(_0x48e527,null))[_0x4682('0x1c')](function(_0x3dccfa){if(_0x3dccfa){var _0x5ec21b=_0x3dccfa[_0x4682('0x57')]&&fs[_0x4682('0x60')](path['join'](config[_0x4682('0x62')],_0x214e5b,_['toLower'](_0x3dccfa[_0x4682('0x57')])))?path[_0x4682('0x61')](config[_0x4682('0x62')],_0x214e5b,_['toLower'](_0x3dccfa[_0x4682('0x57')])):path[_0x4682('0x61')](config[_0x4682('0x62')],_0x214e5b,_[_0x4682('0x63')](_0x4682('0x6d')));var _0x536e39=_0x4682('0x6e')+_[_0x4682('0x65')](_0x4682('0x57'));if(_0x3dccfa[_0x536e39]||!_0x451f83['custom']){_0x5ec21b=path[_0x4682('0x61')](config['root'],_0x214e5b,_[_0x4682('0x63')]('default_loginLogo.svg'));}if(!fs[_0x4682('0x60')](_0x5ec21b)){throw new db[(_0x4682('0x67'))]['ValidationError'](_[_0x4682('0x65')](_0x4682('0x57'))+_0x4682('0x68'));}return _0x48e527[_0x4682('0x69')](_0x5ec21b);}})[_0x4682('0x26')](handleError(_0x48e527,null));};exports['gdpr']=function(_0x5e6e7b,_0x50760f){return db[_0x4682('0x3a')]['find']({'where':{'id':_0x5e6e7b[_0x4682('0x50')]['id']},'attributes':[_0x4682('0x6f')]})[_0x4682('0x1c')](respondWithResult(_0x50760f,null))[_0x4682('0x26')](handleError(_0x50760f,null));};exports[_0x4682('0x70')]=function(_0x4079bf,_0x3daa67,_0x4cfd95){if(_0x4079bf[_0x4682('0x55')]&&_0x4079bf['file'][_0x4682('0x56')]){_0x4079bf['body'][_0x4682('0x5c')]=_0x4079bf['file'][_0x4682('0x56')];}return db[_0x4682('0x3a')]['find']({'where':{'id':_0x4079bf[_0x4682('0x50')]['id']}})['then'](handleEntityNotFound(_0x3daa67,null))[_0x4682('0x1c')](saveUpdates(_0x4079bf[_0x4682('0x53')],null))[_0x4682('0x1c')](respondWithResult(_0x3daa67,null))[_0x4682('0x26')](handleError(_0x3daa67,null));};var utilLicense=require(_0x4682('0x17'));exports[_0x4682('0x71')]=function(_0x37eed7,_0x2d7e19,_0x20bfe8){var _0x1d2949='server/files/images/logos';var _0x3c6244={'custom':![]};return utilLicense['getLicense']()[_0x4682('0x1c')](function(_0x54b8bc){if(_0x54b8bc){_0x3c6244=_0x54b8bc;}return db[_0x4682('0x3a')][_0x4682('0x52')]({'where':{'id':_0x37eed7[_0x4682('0x50')]['id']},'attributes':['logo',_0x4682('0x57'),_0x4682('0x5c'),'favicon',_0x4682('0x6c'),_0x4682('0x5d'),'defaultPreferred',_0x4682('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x2d7e19,null))[_0x4682('0x1c')](function(_0x38ae35){if(_0x38ae35){var _0x3282e0=_0x38ae35[_0x4682('0x5c')]&&fs[_0x4682('0x60')](path['join'](config['root'],_0x1d2949,_[_0x4682('0x63')](_0x38ae35[_0x4682('0x5c')])))?path['join'](config[_0x4682('0x62')],_0x1d2949,_['toLower'](_0x38ae35['preferred'])):path['join'](config[_0x4682('0x62')],_0x1d2949,_[_0x4682('0x63')](_0x4682('0x72')));var _0x3d8aeb=_0x4682('0x6e')+_[_0x4682('0x65')]('preferred');if(_0x38ae35[_0x3d8aeb]||!_0x3c6244[_0x4682('0x66')]||!_0x3c6244['preferred']){_0x3282e0=path[_0x4682('0x61')](config[_0x4682('0x62')],_0x1d2949,_[_0x4682('0x63')](_0x4682('0x72')));}if(!fs[_0x4682('0x60')](_0x3282e0)){throw new db['Sequelize'][(_0x4682('0x73'))](_['upperFirst']('preferred')+_0x4682('0x68'));}return _0x2d7e19[_0x4682('0x69')](_0x3282e0);}})['catch'](handleError(_0x2d7e19,null));};exports[_0x4682('0x74')]=function(_0x3d4c20,_0x562cac,_0x40e430){if(_0x3d4c20['file']&&_0x3d4c20[_0x4682('0x55')][_0x4682('0x56')]){_0x3d4c20[_0x4682('0x53')][_0x4682('0x6b')]=_0x3d4c20[_0x4682('0x55')][_0x4682('0x56')];}return db[_0x4682('0x3a')][_0x4682('0x52')]({'where':{'id':_0x3d4c20[_0x4682('0x50')]['id']}})['then'](handleEntityNotFound(_0x562cac,null))[_0x4682('0x1c')](saveUpdates(_0x3d4c20[_0x4682('0x53')],null))[_0x4682('0x1c')](respondWithResult(_0x562cac,null))[_0x4682('0x26')](handleError(_0x562cac,null));};var utilLicense=require(_0x4682('0x17'));exports['getFavicon']=function(_0x166d07,_0x3d174a,_0x19aa54){var _0x260591='server/files/images/logos';var _0x5bbf8e={'custom':![]};return utilLicense[_0x4682('0x5a')]()['then'](function(_0x3e1752){if(_0x3e1752){_0x5bbf8e=_0x3e1752;}return db[_0x4682('0x3a')][_0x4682('0x52')]({'where':{'id':_0x166d07[_0x4682('0x50')]['id']},'attributes':[_0x4682('0x5b'),'loginLogo','preferred',_0x4682('0x6b'),'defaultLogo','defaultLoginLogo',_0x4682('0x5e'),_0x4682('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x3d174a,null))[_0x4682('0x1c')](function(_0x2d6964){if(_0x2d6964){var _0x572aad=_0x2d6964[_0x4682('0x6b')]&&fs[_0x4682('0x60')](path[_0x4682('0x61')](config['root'],_0x260591,_[_0x4682('0x63')](_0x2d6964[_0x4682('0x6b')])))?path[_0x4682('0x61')](config[_0x4682('0x62')],_0x260591,_['toLower'](_0x2d6964[_0x4682('0x6b')])):path[_0x4682('0x61')](config[_0x4682('0x62')],_0x260591,_['toLower']('default_favicon.ico'));var _0x1c42e2=_0x4682('0x6e')+_['upperFirst'](_0x4682('0x6b'));if(_0x2d6964[_0x1c42e2]||!_0x5bbf8e[_0x4682('0x66')]){_0x572aad=path[_0x4682('0x61')](config[_0x4682('0x62')],_0x260591,_[_0x4682('0x63')](_0x4682('0x75')));}if(!fs[_0x4682('0x60')](_0x572aad)){throw new db[(_0x4682('0x67'))][(_0x4682('0x73'))](_[_0x4682('0x65')](_0x4682('0x6b'))+_0x4682('0x68'));}return _0x3d174a[_0x4682('0x69')](_0x572aad);}})[_0x4682('0x26')](handleError(_0x3d174a,null));};exports[_0x4682('0x76')]=function(_0xbf87bd,_0x10234b){var _0x41007f={'offset':moment()['utcOffset']()};_0x41007f[_0x4682('0x77')]=moment()[_0x4682('0x78')](_0x41007f[_0x4682('0x29')])[_0x4682('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x10234b[_0x4682('0x28')](0xc8)[_0x4682('0x37')](_0x41007f);}; \ No newline at end of file +var _0x3a32=['preferred','defaultLogo','defaultFavicon','existsSync','join','root','toLower','logo','default_logo.svg','default','custom','\x20not\x20found','download','getLogoLogin','getLicense','favicon','defaultPreferred','default_loginLogo.svg','upperFirst','Sequelize','gdpr','getPreferred','defaultLoginLogo','default_preferred.png','ValidationError','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','params','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x3a32,0x9b));var _0x23a3=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x3a32[_0x4bfac3];return _0x15f0f2;};'use strict';var emlformat=require(_0x23a3('0x0'));var rimraf=require(_0x23a3('0x1'));var zipdir=require(_0x23a3('0x2'));var jsonpatch=require(_0x23a3('0x3'));var rp=require(_0x23a3('0x4'));var moment=require(_0x23a3('0x5'));var BPromise=require(_0x23a3('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x23a3('0x7'));var sox=require(_0x23a3('0x8'));var csv=require('to-csv');var ejs=require(_0x23a3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23a3('0xa'));var squel=require(_0x23a3('0xb'));var crypto=require(_0x23a3('0xc'));var jsforce=require(_0x23a3('0xd'));var deskjs=require(_0x23a3('0xe'));var toCsv=require(_0x23a3('0xf'));var querystring=require('querystring');var Papa=require(_0x23a3('0x10'));var Redis=require(_0x23a3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x23a3('0x12'));var hardwareService=require(_0x23a3('0x13'));var logger=require(_0x23a3('0x14'))('api');var utils=require(_0x23a3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x23a3('0x16'));var db=require(_0x23a3('0x17'))['db'];var jayson=require(_0x23a3('0x18'));var client=jayson['client'][_0x23a3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x33e0b7,_0x2a738b,_0x214324,_0x2af741){return new BPromise(function(_0x52243b,_0x3c0e0e){var _0x1e78ac=_0x2af741||client;return _0x1e78ac['request'](_0x33e0b7,_0x214324)[_0x23a3('0x1a')](function(_0xcd0167){logger['info'](_0x23a3('0x1b'),_0x2a738b,_0x23a3('0x1c'));logger[_0x23a3('0x1d')](_0x23a3('0x1e'),_0x2a738b,_0x23a3('0x1c'),JSON[_0x23a3('0x1f')](_0xcd0167));if(_0xcd0167[_0x23a3('0x20')]){if(_0xcd0167[_0x23a3('0x20')]['code']===0x1f4){logger[_0x23a3('0x20')](_0x23a3('0x1b'),_0x2a738b,_0xcd0167['error']['message']);return _0x3c0e0e(_0xcd0167[_0x23a3('0x20')][_0x23a3('0x21')]);}logger[_0x23a3('0x20')](_0x23a3('0x1b'),_0x2a738b,_0xcd0167[_0x23a3('0x20')][_0x23a3('0x21')]);return _0x52243b(_0xcd0167[_0x23a3('0x20')][_0x23a3('0x21')]);}else{logger[_0x23a3('0x22')](_0x23a3('0x1b'),_0x2a738b,_0x23a3('0x1c'));_0x52243b(_0xcd0167['result'][_0x23a3('0x21')]);}})[_0x23a3('0x23')](function(_0x16288e){logger[_0x23a3('0x20')](_0x23a3('0x1b'),_0x2a738b,_0x16288e);_0x3c0e0e(_0x16288e);});});}function respondWithStatusCode(_0x264d1a,_0x509aa3){_0x509aa3=_0x509aa3||0xcc;return function(_0x48a73c){if(_0x48a73c){return _0x264d1a['sendStatus'](_0x509aa3);}return _0x264d1a[_0x23a3('0x24')](_0x509aa3)['end']();};}function respondWithResult(_0x38b014,_0x525b5f){_0x525b5f=_0x525b5f||0xc8;return function(_0x47539d){if(_0x47539d){return _0x38b014['status'](_0x525b5f)[_0x23a3('0x25')](_0x47539d);}};}function respondWithFilteredResult(_0x307493,_0x5d7cbc){return function(_0x333998){if(_0x333998){var _0xc9462b=typeof _0x5d7cbc[_0x23a3('0x26')]===_0x23a3('0x27')&&typeof _0x5d7cbc[_0x23a3('0x28')]==='undefined';var _0x1ceaf0=_0x333998[_0x23a3('0x29')];var _0x3be09c=_0xc9462b?0x0:_0x5d7cbc[_0x23a3('0x26')];var _0x6bdfa8=_0xc9462b?_0x333998[_0x23a3('0x29')]:_0x5d7cbc[_0x23a3('0x26')]+_0x5d7cbc[_0x23a3('0x28')];var _0x4a66d1;if(_0x6bdfa8>=_0x1ceaf0){_0x6bdfa8=_0x1ceaf0;_0x4a66d1=0xc8;}else{_0x4a66d1=0xce;}_0x307493[_0x23a3('0x24')](_0x4a66d1);return _0x307493[_0x23a3('0x2a')](_0x23a3('0x2b'),_0x3be09c+'-'+_0x6bdfa8+'/'+_0x1ceaf0)[_0x23a3('0x25')](_0x333998);}return null;};}function patchUpdates(_0x232fcd){return function(_0x54ba3f){try{jsonpatch[_0x23a3('0x2c')](_0x54ba3f,_0x232fcd,!![]);}catch(_0x197ffb){return BPromise[_0x23a3('0x2d')](_0x197ffb);}return _0x54ba3f[_0x23a3('0x2e')]();};}function saveUpdates(_0x77309d,_0x1296fd){return function(_0xf3fd43){if(_0xf3fd43){return _0xf3fd43[_0x23a3('0x2f')](_0x77309d)[_0x23a3('0x1a')](function(_0x200b63){return _0x200b63;});}return null;};}function removeEntity(_0x3ea707,_0x233554){return function(_0x5e00ac){if(_0x5e00ac){return _0x5e00ac[_0x23a3('0x30')]()[_0x23a3('0x1a')](function(){_0x3ea707[_0x23a3('0x24')](0xcc)[_0x23a3('0x31')]();});}};}function handleEntityNotFound(_0x5dd97a,_0x121e53){return function(_0x2495de){if(!_0x2495de){_0x5dd97a['sendStatus'](0x194);}return _0x2495de;};}function handleError(_0x58dd84,_0x5cedd4){_0x5cedd4=_0x5cedd4||0x1f4;return function(_0x4543dc){logger[_0x23a3('0x20')](_0x4543dc[_0x23a3('0x32')]);if(_0x4543dc[_0x23a3('0x33')]){delete _0x4543dc['name'];}_0x58dd84[_0x23a3('0x24')](_0x5cedd4)[_0x23a3('0x34')](_0x4543dc);};}exports[_0x23a3('0x35')]=function(_0x5cf5fc,_0x175a33){var _0x542274={},_0xd57d5d={},_0x4dbc90={'count':0x0,'rows':[]};var _0x2f540f=_[_0x23a3('0x36')](db[_0x23a3('0x37')][_0x23a3('0x38')],function(_0x3ed79d){return{'name':_0x3ed79d[_0x23a3('0x39')],'type':_0x3ed79d[_0x23a3('0x3a')][_0x23a3('0x3b')]};});_0xd57d5d[_0x23a3('0x3c')]=_['map'](_0x2f540f,_0x23a3('0x33'));_0xd57d5d[_0x23a3('0x3d')]=_[_0x23a3('0x3e')](_0x5cf5fc[_0x23a3('0x3d')]);_0xd57d5d[_0x23a3('0x3f')]=_[_0x23a3('0x40')](_0xd57d5d[_0x23a3('0x3c')],_0xd57d5d[_0x23a3('0x3d')]);_0x542274[_0x23a3('0x41')]=_[_0x23a3('0x40')](_0xd57d5d[_0x23a3('0x3c')],qs[_0x23a3('0x42')](_0x5cf5fc[_0x23a3('0x3d')]['fields']));_0x542274[_0x23a3('0x41')]=_0x542274[_0x23a3('0x41')][_0x23a3('0x43')]?_0x542274[_0x23a3('0x41')]:_0xd57d5d[_0x23a3('0x3c')];if(!_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x44')](_0x23a3('0x45'))){_0x542274['limit']=qs[_0x23a3('0x28')](_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x28')]);_0x542274[_0x23a3('0x26')]=qs[_0x23a3('0x26')](_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x26')]);}_0x542274[_0x23a3('0x46')]=qs[_0x23a3('0x47')](_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x47')]);_0x542274[_0x23a3('0x48')]=qs[_0x23a3('0x3f')](_[_0x23a3('0x49')](_0x5cf5fc[_0x23a3('0x3d')],_0xd57d5d[_0x23a3('0x3f')]),_0x2f540f);if(_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x4a')]){_0x542274['where']=_[_0x23a3('0x4b')](_0x542274[_0x23a3('0x48')],{'$or':_[_0x23a3('0x36')](_0x2f540f,function(_0x2337dc){if(_0x2337dc[_0x23a3('0x3a')]!==_0x23a3('0x4c')){var _0x32b007={};_0x32b007[_0x2337dc[_0x23a3('0x33')]]={'$like':'%'+_0x5cf5fc[_0x23a3('0x3d')]['filter']+'%'};return _0x32b007;}})});}_0x542274=_[_0x23a3('0x4b')]({},_0x542274,_0x5cf5fc[_0x23a3('0x4d')]);var _0x180e5f={'where':_0x542274[_0x23a3('0x48')]};return db[_0x23a3('0x37')][_0x23a3('0x29')](_0x180e5f)[_0x23a3('0x1a')](function(_0x10eee1){_0x4dbc90[_0x23a3('0x29')]=_0x10eee1;if(_0x5cf5fc[_0x23a3('0x3d')][_0x23a3('0x4e')]){_0x542274[_0x23a3('0x4f')]=[{'all':!![]}];}return db[_0x23a3('0x37')]['findAll'](_0x542274);})['then'](function(_0x6e1525){_0x4dbc90['rows']=_0x6e1525;return _0x4dbc90;})[_0x23a3('0x1a')](respondWithFilteredResult(_0x175a33,_0x542274))[_0x23a3('0x23')](handleError(_0x175a33,null));};exports['show']=function(_0x56fad9,_0x48d1ce){var _0xdb61f4={'raw':![],'where':{'id':_0x56fad9[_0x23a3('0x50')]['id']}},_0x4e2c87={};_0x4e2c87[_0x23a3('0x3c')]=_[_0x23a3('0x3e')](db[_0x23a3('0x37')][_0x23a3('0x38')]);_0x4e2c87[_0x23a3('0x3d')]=_[_0x23a3('0x3e')](_0x56fad9[_0x23a3('0x3d')]);_0x4e2c87['filters']=_[_0x23a3('0x40')](_0x4e2c87['model'],_0x4e2c87[_0x23a3('0x3d')]);_0xdb61f4['attributes']=_[_0x23a3('0x40')](_0x4e2c87[_0x23a3('0x3c')],qs[_0x23a3('0x42')](_0x56fad9['query'][_0x23a3('0x42')]));_0xdb61f4['attributes']=_0xdb61f4['attributes']['length']?_0xdb61f4[_0x23a3('0x41')]:_0x4e2c87[_0x23a3('0x3c')];if(_0x56fad9[_0x23a3('0x3d')][_0x23a3('0x4e')]){_0xdb61f4['include']=[{'all':!![]}];}_0xdb61f4=_[_0x23a3('0x4b')]({},_0xdb61f4,_0x56fad9[_0x23a3('0x4d')]);return db[_0x23a3('0x37')][_0x23a3('0x51')](_0xdb61f4)[_0x23a3('0x1a')](handleEntityNotFound(_0x48d1ce,null))[_0x23a3('0x1a')](respondWithResult(_0x48d1ce,null))[_0x23a3('0x23')](handleError(_0x48d1ce,null));};exports[_0x23a3('0x2f')]=function(_0x377122,_0x490bbd){if(_0x377122[_0x23a3('0x52')]['id']){delete _0x377122[_0x23a3('0x52')]['id'];}return db[_0x23a3('0x37')][_0x23a3('0x51')]({'where':{'id':_0x377122[_0x23a3('0x50')]['id']}})[_0x23a3('0x1a')](handleEntityNotFound(_0x490bbd,null))[_0x23a3('0x1a')](saveUpdates(_0x377122[_0x23a3('0x52')],null))[_0x23a3('0x1a')](respondWithResult(_0x490bbd,null))[_0x23a3('0x23')](handleError(_0x490bbd,null));};exports[_0x23a3('0x53')]=function(_0x7cc184,_0x25b6a9,_0xb67c4c){if(_0x7cc184['file']&&_0x7cc184[_0x23a3('0x54')][_0x23a3('0x55')]){_0x7cc184[_0x23a3('0x52')]['logo']=_0x7cc184['file'][_0x23a3('0x55')];}return db[_0x23a3('0x37')][_0x23a3('0x51')]({'where':{'id':_0x7cc184[_0x23a3('0x50')]['id']}})[_0x23a3('0x1a')](handleEntityNotFound(_0x25b6a9,null))['then'](saveUpdates(_0x7cc184[_0x23a3('0x52')],null))[_0x23a3('0x1a')](respondWithResult(_0x25b6a9,null))[_0x23a3('0x23')](handleError(_0x25b6a9,null));};exports['addLogoLogin']=function(_0x10a786,_0x3062ee,_0x2806e1){if(_0x10a786['file']&&_0x10a786[_0x23a3('0x54')][_0x23a3('0x55')]){_0x10a786[_0x23a3('0x52')][_0x23a3('0x56')]=_0x10a786[_0x23a3('0x54')]['filename'];}return db[_0x23a3('0x37')][_0x23a3('0x51')]({'where':{'id':_0x10a786['params']['id']}})[_0x23a3('0x1a')](handleEntityNotFound(_0x3062ee,null))[_0x23a3('0x1a')](saveUpdates(_0x10a786[_0x23a3('0x52')],null))[_0x23a3('0x1a')](respondWithResult(_0x3062ee,null))[_0x23a3('0x23')](handleError(_0x3062ee,null));};var utilLicense=require(_0x23a3('0x16'));exports[_0x23a3('0x57')]=function(_0x472389,_0x3cf59d,_0x41aeab){var _0x2a2f6e=_0x23a3('0x58');var _0x40dcfd={'custom':![]};return utilLicense['getLicense']()[_0x23a3('0x1a')](function(_0x4f8354){if(_0x4f8354){_0x40dcfd=_0x4f8354;}return db[_0x23a3('0x37')][_0x23a3('0x51')]({'where':{'id':_0x472389[_0x23a3('0x50')]['id']},'attributes':['logo','loginLogo',_0x23a3('0x59'),'favicon',_0x23a3('0x5a'),'defaultLoginLogo','defaultPreferred',_0x23a3('0x5b')],'raw':!![]});})[_0x23a3('0x1a')](handleEntityNotFound(_0x3cf59d,null))[_0x23a3('0x1a')](function(_0x5a84c7){if(_0x5a84c7){var _0x20d085=_0x5a84c7['logo']&&fs[_0x23a3('0x5c')](path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x2a2f6e,_[_0x23a3('0x5f')](_0x5a84c7[_0x23a3('0x60')])))?path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x2a2f6e,_[_0x23a3('0x5f')](_0x5a84c7[_0x23a3('0x60')])):path['join'](config[_0x23a3('0x5e')],_0x2a2f6e,_['toLower'](_0x23a3('0x61')));var _0x4bbc91=_0x23a3('0x62')+_['upperFirst'](_0x23a3('0x60'));if(_0x5a84c7[_0x4bbc91]||!_0x40dcfd[_0x23a3('0x63')]){_0x20d085=path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x2a2f6e,_[_0x23a3('0x5f')]('default_logo.svg'));}if(!fs[_0x23a3('0x5c')](_0x20d085)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x23a3('0x60'))+_0x23a3('0x64'));}return _0x3cf59d[_0x23a3('0x65')](_0x20d085);}})['catch'](handleError(_0x3cf59d,null));};var utilLicense=require(_0x23a3('0x16'));exports[_0x23a3('0x66')]=function(_0x267cbf,_0x317e1b,_0x1611b0){var _0xbca1d6=_0x23a3('0x58');var _0x21d5c7={'custom':![]};return utilLicense[_0x23a3('0x67')]()[_0x23a3('0x1a')](function(_0x56cb41){if(_0x56cb41){_0x21d5c7=_0x56cb41;}return db['Setting'][_0x23a3('0x51')]({'where':{'id':_0x267cbf['params']['id']},'attributes':[_0x23a3('0x60'),_0x23a3('0x56'),_0x23a3('0x59'),_0x23a3('0x68'),_0x23a3('0x5a'),'defaultLoginLogo',_0x23a3('0x69'),'defaultFavicon'],'raw':!![]});})[_0x23a3('0x1a')](handleEntityNotFound(_0x317e1b,null))[_0x23a3('0x1a')](function(_0x5e77d4){if(_0x5e77d4){var _0x17e3bd=_0x5e77d4[_0x23a3('0x56')]&&fs['existsSync'](path['join'](config[_0x23a3('0x5e')],_0xbca1d6,_['toLower'](_0x5e77d4[_0x23a3('0x56')])))?path[_0x23a3('0x5d')](config['root'],_0xbca1d6,_['toLower'](_0x5e77d4[_0x23a3('0x56')])):path[_0x23a3('0x5d')](config['root'],_0xbca1d6,_[_0x23a3('0x5f')](_0x23a3('0x6a')));var _0x412721='default'+_[_0x23a3('0x6b')](_0x23a3('0x56'));if(_0x5e77d4[_0x412721]||!_0x21d5c7[_0x23a3('0x63')]){_0x17e3bd=path[_0x23a3('0x5d')](config['root'],_0xbca1d6,_[_0x23a3('0x5f')](_0x23a3('0x6a')));}if(!fs['existsSync'](_0x17e3bd)){throw new db[(_0x23a3('0x6c'))]['ValidationError'](_['upperFirst'](_0x23a3('0x56'))+_0x23a3('0x64'));}return _0x317e1b[_0x23a3('0x65')](_0x17e3bd);}})[_0x23a3('0x23')](handleError(_0x317e1b,null));};exports[_0x23a3('0x6d')]=function(_0x56eff0,_0x2eb7ca){return db[_0x23a3('0x37')][_0x23a3('0x51')]({'where':{'id':_0x56eff0[_0x23a3('0x50')]['id']},'attributes':['securePassword']})[_0x23a3('0x1a')](respondWithResult(_0x2eb7ca,null))[_0x23a3('0x23')](handleError(_0x2eb7ca,null));};exports['addPreferred']=function(_0x5ecafa,_0x4041ba,_0x1a82a0){if(_0x5ecafa['file']&&_0x5ecafa[_0x23a3('0x54')][_0x23a3('0x55')]){_0x5ecafa[_0x23a3('0x52')][_0x23a3('0x59')]=_0x5ecafa['file']['filename'];}return db['Setting'][_0x23a3('0x51')]({'where':{'id':_0x5ecafa[_0x23a3('0x50')]['id']}})['then'](handleEntityNotFound(_0x4041ba,null))[_0x23a3('0x1a')](saveUpdates(_0x5ecafa[_0x23a3('0x52')],null))[_0x23a3('0x1a')](respondWithResult(_0x4041ba,null))[_0x23a3('0x23')](handleError(_0x4041ba,null));};var utilLicense=require(_0x23a3('0x16'));exports[_0x23a3('0x6e')]=function(_0x295fb5,_0x5631c4,_0x281939){var _0x6386c7=_0x23a3('0x58');var _0x3013c5={'custom':![]};return utilLicense[_0x23a3('0x67')]()[_0x23a3('0x1a')](function(_0x13768b){if(_0x13768b){_0x3013c5=_0x13768b;}return db['Setting'][_0x23a3('0x51')]({'where':{'id':_0x295fb5[_0x23a3('0x50')]['id']},'attributes':['logo','loginLogo',_0x23a3('0x59'),_0x23a3('0x68'),_0x23a3('0x5a'),_0x23a3('0x6f'),_0x23a3('0x69'),_0x23a3('0x5b')],'raw':!![]});})[_0x23a3('0x1a')](handleEntityNotFound(_0x5631c4,null))['then'](function(_0x311c98){if(_0x311c98){var _0x35d53f=_0x311c98[_0x23a3('0x59')]&&fs[_0x23a3('0x5c')](path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x6386c7,_[_0x23a3('0x5f')](_0x311c98[_0x23a3('0x59')])))?path[_0x23a3('0x5d')](config['root'],_0x6386c7,_['toLower'](_0x311c98[_0x23a3('0x59')])):path['join'](config[_0x23a3('0x5e')],_0x6386c7,_[_0x23a3('0x5f')]('default_preferred.png'));var _0x17b477=_0x23a3('0x62')+_[_0x23a3('0x6b')](_0x23a3('0x59'));if(_0x311c98[_0x17b477]||!_0x3013c5[_0x23a3('0x63')]||!_0x3013c5[_0x23a3('0x59')]){_0x35d53f=path['join'](config[_0x23a3('0x5e')],_0x6386c7,_[_0x23a3('0x5f')](_0x23a3('0x70')));}if(!fs[_0x23a3('0x5c')](_0x35d53f)){throw new db[(_0x23a3('0x6c'))][(_0x23a3('0x71'))](_[_0x23a3('0x6b')](_0x23a3('0x59'))+'\x20not\x20found');}return _0x5631c4['download'](_0x35d53f);}})['catch'](handleError(_0x5631c4,null));};exports[_0x23a3('0x72')]=function(_0x11d65c,_0x1bf3ab,_0x49419d){if(_0x11d65c[_0x23a3('0x54')]&&_0x11d65c[_0x23a3('0x54')]['filename']){_0x11d65c[_0x23a3('0x52')][_0x23a3('0x68')]=_0x11d65c['file'][_0x23a3('0x55')];}return db[_0x23a3('0x37')]['find']({'where':{'id':_0x11d65c[_0x23a3('0x50')]['id']}})[_0x23a3('0x1a')](handleEntityNotFound(_0x1bf3ab,null))['then'](saveUpdates(_0x11d65c[_0x23a3('0x52')],null))[_0x23a3('0x1a')](respondWithResult(_0x1bf3ab,null))['catch'](handleError(_0x1bf3ab,null));};var utilLicense=require(_0x23a3('0x16'));exports[_0x23a3('0x73')]=function(_0x573a17,_0x52356c,_0x9d9d1){var _0x22076a=_0x23a3('0x58');var _0x1b8e30={'custom':![]};return utilLicense[_0x23a3('0x67')]()[_0x23a3('0x1a')](function(_0x509d9f){if(_0x509d9f){_0x1b8e30=_0x509d9f;}return db['Setting']['find']({'where':{'id':_0x573a17[_0x23a3('0x50')]['id']},'attributes':[_0x23a3('0x60'),_0x23a3('0x56'),'preferred',_0x23a3('0x68'),_0x23a3('0x5a'),_0x23a3('0x6f'),_0x23a3('0x69'),_0x23a3('0x5b')],'raw':!![]});})[_0x23a3('0x1a')](handleEntityNotFound(_0x52356c,null))[_0x23a3('0x1a')](function(_0x43f674){if(_0x43f674){var _0x53c5ac=_0x43f674[_0x23a3('0x68')]&&fs[_0x23a3('0x5c')](path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x22076a,_[_0x23a3('0x5f')](_0x43f674[_0x23a3('0x68')])))?path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x22076a,_[_0x23a3('0x5f')](_0x43f674['favicon'])):path[_0x23a3('0x5d')](config[_0x23a3('0x5e')],_0x22076a,_[_0x23a3('0x5f')]('default_favicon.ico'));var _0x10a2ec=_0x23a3('0x62')+_[_0x23a3('0x6b')](_0x23a3('0x68'));if(_0x43f674[_0x10a2ec]||!_0x1b8e30['custom']){_0x53c5ac=path['join'](config[_0x23a3('0x5e')],_0x22076a,_[_0x23a3('0x5f')](_0x23a3('0x74')));}if(!fs['existsSync'](_0x53c5ac)){throw new db['Sequelize']['ValidationError'](_[_0x23a3('0x6b')]('favicon')+_0x23a3('0x64'));}return _0x52356c[_0x23a3('0x65')](_0x53c5ac);}})[_0x23a3('0x23')](handleError(_0x52356c,null));};exports[_0x23a3('0x75')]=function(_0x3fff2b,_0x674f54){var _0x1962b6={'offset':moment()[_0x23a3('0x76')]()};_0x1962b6[_0x23a3('0x77')]=moment()[_0x23a3('0x76')](_0x1962b6['offset'])[_0x23a3('0x78')](_0x23a3('0x79'));return _0x674f54[_0x23a3('0x24')](0xc8)[_0x23a3('0x34')](_0x1962b6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0ee751c..0b77741 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0x008c,0x188));var _0xc008=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x008c[_0x1b7368];return _0x25d54c;};'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')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x55ca,0x126));var _0xa55c=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x55ca[_0x2bc2a2];return _0x20de67;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index fb26351..3da76e9 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 _0x5bb2=['stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug'];(function(_0x548f51,_0xe85f24){var _0x269fb1=function(_0x5bda54){while(--_0x5bda54){_0x548f51['push'](_0x548f51['shift']());}};_0x269fb1(++_0xe85f24);}(_0x5bb2,0x197));var _0x25bb=function(_0x4dcaab,_0x35b92b){_0x4dcaab=_0x4dcaab-0x0;var _0x169d83=_0x5bb2[_0x4dcaab];return _0x169d83;};'use strict';var _=require(_0x25bb('0x0'));var util=require(_0x25bb('0x1'));var moment=require(_0x25bb('0x2'));var BPromise=require(_0x25bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x25bb('0x5'))('rpc');var config=require(_0x25bb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x25bb('0x7')][_0x25bb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d873b,_0x54d333,_0x46d854){return new BPromise(function(_0x4be0b5,_0x34c8a0){return client[_0x25bb('0x9')](_0x1d873b,_0x46d854)['then'](function(_0x33085b){logger[_0x25bb('0xa')]('Setting,\x20%s,\x20%s',_0x54d333,_0x25bb('0xb'));logger[_0x25bb('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0x54d333,_0x25bb('0xb'),JSON[_0x25bb('0xd')](_0x33085b));if(_0x33085b[_0x25bb('0xe')]){if(_0x33085b['error'][_0x25bb('0xf')]===0x1f4){logger[_0x25bb('0xe')](_0x25bb('0x10'),_0x54d333,_0x33085b[_0x25bb('0xe')][_0x25bb('0x11')]);return _0x34c8a0(_0x33085b[_0x25bb('0xe')]['message']);}logger[_0x25bb('0xe')](_0x25bb('0x10'),_0x54d333,_0x33085b[_0x25bb('0xe')]['message']);return _0x4be0b5(_0x33085b[_0x25bb('0xe')][_0x25bb('0x11')]);}else{logger[_0x25bb('0xa')](_0x25bb('0x10'),_0x54d333,_0x25bb('0xb'));_0x4be0b5(_0x33085b[_0x25bb('0x12')][_0x25bb('0x11')]);}})[_0x25bb('0x13')](function(_0xb4f09d){logger[_0x25bb('0xe')](_0x25bb('0x10'),_0x54d333,_0xb4f09d);_0x34c8a0(_0xb4f09d);});});}exports[_0x25bb('0x14')]=function(_0x539a86){var _0x46deb6=this;return new Promise(function(_0x5cab34,_0x249af6){return db['Setting'][_0x25bb('0x15')]({'raw':_0x539a86['options']?_0x539a86[_0x25bb('0x16')][_0x25bb('0x17')]===undefined?!![]:![]:!![],'where':_0x539a86[_0x25bb('0x16')]?_0x539a86[_0x25bb('0x16')][_0x25bb('0x18')]||null:null,'attributes':_0x539a86[_0x25bb('0x16')]?_0x539a86[_0x25bb('0x16')][_0x25bb('0x19')]||null:null,'include':_0x539a86[_0x25bb('0x16')]?_0x539a86[_0x25bb('0x16')][_0x25bb('0x1a')]?_[_0x25bb('0x1b')](_0x539a86[_0x25bb('0x16')]['include'],function(_0x17ff56){return{'model':db[_0x17ff56[_0x25bb('0x1c')]],'as':_0x17ff56['as'],'attributes':_0x17ff56[_0x25bb('0x19')],'include':_0x17ff56[_0x25bb('0x1a')]?_['map'](_0x17ff56[_0x25bb('0x1a')],function(_0x12e456){return{'model':db[_0x12e456['model']],'as':_0x12e456['as'],'attributes':_0x12e456[_0x25bb('0x19')],'include':_0x12e456[_0x25bb('0x1a')]?_[_0x25bb('0x1b')](_0x12e456[_0x25bb('0x1a')],function(_0x6f61af){return{'model':db[_0x6f61af['model']],'as':_0x6f61af['as'],'attributes':_0x6f61af['attributes']};}):[]};}):[]};}):[]:[]})[_0x25bb('0x1d')](function(_0x3efd6c){logger[_0x25bb('0xa')](_0x25bb('0x14'),_0x539a86);logger[_0x25bb('0xc')]('ShowSetting',_0x539a86,JSON[_0x25bb('0xd')](_0x3efd6c));_0x5cab34(_0x3efd6c);})[_0x25bb('0x13')](function(_0x388b12){logger[_0x25bb('0xe')](_0x25bb('0x14'),_0x388b12[_0x25bb('0x11')],_0x539a86);_0x249af6(_0x46deb6[_0x25bb('0xe')](0x1f4,_0x388b12[_0x25bb('0x11')]));});});}; \ No newline at end of file +var _0x56b3=['moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','stringify','lodash'];(function(_0x45deec,_0x125d7f){var _0x29b6b3=function(_0x12a0d9){while(--_0x12a0d9){_0x45deec['push'](_0x45deec['shift']());}};_0x29b6b3(++_0x125d7f);}(_0x56b3,0xb3));var _0x356b=function(_0x322bef,_0x4890d4){_0x322bef=_0x322bef-0x0;var _0x229e60=_0x56b3[_0x322bef];return _0x229e60;};'use strict';var _=require(_0x356b('0x0'));var util=require('util');var moment=require(_0x356b('0x1'));var BPromise=require('bluebird');var rs=require(_0x356b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x356b('0x3'))['db'];var utils=require(_0x356b('0x4'));var logger=require(_0x356b('0x5'))(_0x356b('0x6'));var config=require(_0x356b('0x7'));var jayson=require(_0x356b('0x8'));var client=jayson['client'][_0x356b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33979f,_0x42ba97,_0x220792){return new BPromise(function(_0x3cdbef,_0x2d9473){return client['request'](_0x33979f,_0x220792)[_0x356b('0xa')](function(_0x1fea99){logger['info'](_0x356b('0xb'),_0x42ba97,_0x356b('0xc'));logger[_0x356b('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x42ba97,_0x356b('0xc'),JSON['stringify'](_0x1fea99));if(_0x1fea99[_0x356b('0xe')]){if(_0x1fea99[_0x356b('0xe')][_0x356b('0xf')]===0x1f4){logger[_0x356b('0xe')]('Setting,\x20%s,\x20%s',_0x42ba97,_0x1fea99[_0x356b('0xe')][_0x356b('0x10')]);return _0x2d9473(_0x1fea99[_0x356b('0xe')][_0x356b('0x10')]);}logger[_0x356b('0xe')](_0x356b('0xb'),_0x42ba97,_0x1fea99[_0x356b('0xe')][_0x356b('0x10')]);return _0x3cdbef(_0x1fea99[_0x356b('0xe')][_0x356b('0x10')]);}else{logger[_0x356b('0x11')](_0x356b('0xb'),_0x42ba97,_0x356b('0xc'));_0x3cdbef(_0x1fea99['result'][_0x356b('0x10')]);}})[_0x356b('0x12')](function(_0x97903f){logger[_0x356b('0xe')]('Setting,\x20%s,\x20%s',_0x42ba97,_0x97903f);_0x2d9473(_0x97903f);});});}exports[_0x356b('0x13')]=function(_0x105655){var _0x2943c1=this;return new Promise(function(_0x3074e9,_0x1def58){return db[_0x356b('0x14')][_0x356b('0x15')]({'raw':_0x105655[_0x356b('0x16')]?_0x105655[_0x356b('0x16')][_0x356b('0x17')]===undefined?!![]:![]:!![],'where':_0x105655['options']?_0x105655[_0x356b('0x16')][_0x356b('0x18')]||null:null,'attributes':_0x105655[_0x356b('0x16')]?_0x105655[_0x356b('0x16')][_0x356b('0x19')]||null:null,'include':_0x105655[_0x356b('0x16')]?_0x105655[_0x356b('0x16')][_0x356b('0x1a')]?_[_0x356b('0x1b')](_0x105655[_0x356b('0x16')][_0x356b('0x1a')],function(_0x507f86){return{'model':db[_0x507f86[_0x356b('0x1c')]],'as':_0x507f86['as'],'attributes':_0x507f86[_0x356b('0x19')],'include':_0x507f86['include']?_[_0x356b('0x1b')](_0x507f86['include'],function(_0x33bfef){return{'model':db[_0x33bfef[_0x356b('0x1c')]],'as':_0x33bfef['as'],'attributes':_0x33bfef[_0x356b('0x19')],'include':_0x33bfef[_0x356b('0x1a')]?_[_0x356b('0x1b')](_0x33bfef[_0x356b('0x1a')],function(_0x55b2fc){return{'model':db[_0x55b2fc['model']],'as':_0x55b2fc['as'],'attributes':_0x55b2fc[_0x356b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x356b('0xa')](function(_0x45253a){logger[_0x356b('0x11')](_0x356b('0x13'),_0x105655);logger['debug']('ShowSetting',_0x105655,JSON[_0x356b('0x1d')](_0x45253a));_0x3074e9(_0x45253a);})['catch'](function(_0x127962){logger['error'](_0x356b('0x13'),_0x127962['message'],_0x105655);_0x1def58(_0x2943c1[_0x356b('0xe')](0x1f4,_0x127962[_0x356b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b9dd846..0b1628d 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 _0x5fab=['create','post','/:id/dispositions','addAnswer','/:id/notify','notify','addApplications','status','addAgents','put','update','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x3480e9,_0x1ce980){var _0x389aad=function(_0x4b6bda){while(--_0x4b6bda){_0x3480e9['push'](_0x3480e9['shift']());}};_0x389aad(++_0x1ce980);}(_0x5fab,0x177));var _0xb5fa=function(_0x3ed98d,_0x2f4af7){_0x3ed98d=_0x3ed98d-0x0;var _0x2b81e0=_0x5fab[_0x3ed98d];return _0x2b81e0;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['get']('/:id/dispositions',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0xa')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0xa')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller['getApplications']);router[_0xb5fa('0xa')](_0xb5fa('0x14'),auth['isAuthenticated'](),controller[_0xb5fa('0x15')]);router['get'](_0xb5fa('0x16'),controller[_0xb5fa('0x17')]);router[_0xb5fa('0xa')](_0xb5fa('0x18'),auth[_0xb5fa('0xb')](),controller['getAgents']);router['post']('/',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x19')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1b'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xb5fa('0x1a')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1c')]);router[_0xb5fa('0x1a')](_0xb5fa('0x1d'),controller[_0xb5fa('0x1e')]);router[_0xb5fa('0x1a')](_0xb5fa('0x13'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x1f')]);router[_0xb5fa('0x1a')]('/:id/send',auth[_0xb5fa('0xb')](),controller['send']);router[_0xb5fa('0x1a')]('/:id/status',controller[_0xb5fa('0x20')]);router[_0xb5fa('0x1a')]('/:id/users',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x21')]);router[_0xb5fa('0x22')]('/:id',auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x23')]);router[_0xb5fa('0x24')]('/:id',auth[_0xb5fa('0xb')](),controller['destroy']);router[_0xb5fa('0x24')](_0xb5fa('0x1b'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x25')]);router[_0xb5fa('0x24')](_0xb5fa('0x11'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xb5fa('0x27')]=router; \ No newline at end of file +var _0x814b=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated'];(function(_0x307cec,_0x1cf922){var _0x285c73=function(_0x2602e7){while(--_0x2602e7){_0x307cec['push'](_0x307cec['shift']());}};_0x285c73(++_0x1cf922);}(_0x814b,0x1a2));var _0xb814=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x814b[_0x15ca1a];return _0x507626;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0xa')](_0xb814('0x16'),auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0xa')](_0xb814('0x18'),controller[_0xb814('0x19')]);router[_0xb814('0xa')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router[_0xb814('0x1c')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x1e')]);router['post'](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x1f')]);router[_0xb814('0x1c')]('/:id/notify',controller['notify']);router['post'](_0xb814('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0xb814('0x1c')](_0xb814('0x20'),auth[_0xb814('0xb')](),controller['send']);router[_0xb814('0x1c')]('/:id/status',controller[_0xb814('0x21')]);router[_0xb814('0x1c')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x22')]);router[_0xb814('0x23')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x24')]);router['delete'](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x25')]);router[_0xb814('0x26')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x27')]);router['delete'](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x28')]);router[_0xb814('0x26')](_0xb814('0x1a'),auth[_0xb814('0xb')](),controller[_0xb814('0x29')]);module[_0xb814('0x2a')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 97fad13..5ac6d9c 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 _0xff4f=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xff4f,0x15e));var _0xfff4=function(_0x2f3b06,_0x121505){_0x2f3b06=_0x2f3b06-0x0;var _0x74ea0e=_0xff4f[_0x2f3b06];return _0x74ea0e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfff4('0x0'));module[_0xfff4('0x1')]={'name':{'type':Sequelize[_0xfff4('0x2')],'unique':_0xfff4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xfff4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xfff4('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xfff4('0x2')],'defaultValue':function(){return rs[_0xfff4('0x4')]();}},'phone':{'type':Sequelize[_0xfff4('0x2')]},'type':{'type':Sequelize[_0xfff4('0x5')]('twilio',_0xfff4('0x6'),_0xfff4('0x7'),_0xfff4('0x8'),_0xfff4('0x9'),_0xfff4('0xa'),'bandwidth',_0xfff4('0xb'),_0xfff4('0xc'),_0xfff4('0xd'))},'accountSid':{'type':Sequelize[_0xfff4('0x2')]},'authId':{'type':Sequelize[_0xfff4('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xfff4('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xfff4('0x2')]},'password':{'type':Sequelize[_0xfff4('0x2')]},'apiKey':{'type':Sequelize[_0xfff4('0x2')]},'applicationId':{'type':Sequelize[_0xfff4('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xfff4('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfff4('0xf')],'defaultValue':function(){return _0xfff4('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfff4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfff4('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfff4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfff4('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfff4('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfff4('0x11')],'comment':_0xfff4('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xfff4('0xe')],'defaultValue':![],'comment':_0xfff4('0x13'),'set':function(_0xc476a){if(!_0xc476a)this['setDataValue'](_0xfff4('0x14'),null);this[_0xfff4('0x15')](_0xfff4('0x16'),_0xc476a);}}}; \ No newline at end of file +var _0xc7a5=['sequelize','randomstring','exports','name','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x3e478c,_0x152670){var _0x29ef89=function(_0x3d0d77){while(--_0x3d0d77){_0x3e478c['push'](_0x3e478c['shift']());}};_0x29ef89(++_0x152670);}(_0xc7a5,0x1e4));var _0x5c7a=function(_0x4b025d,_0x506030){_0x4b025d=_0x4b025d-0x0;var _0x479740=_0xc7a5[_0x4b025d];return _0x479740;};'use strict';var Sequelize=require(_0x5c7a('0x0'));var rs=require(_0x5c7a('0x1'));module[_0x5c7a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x5c7a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5c7a('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x5c7a('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x5c7a('0x4')],'defaultValue':function(){return rs[_0x5c7a('0x5')]();}},'phone':{'type':Sequelize[_0x5c7a('0x4')]},'type':{'type':Sequelize[_0x5c7a('0x6')]('twilio',_0x5c7a('0x7'),_0x5c7a('0x8'),_0x5c7a('0x9'),_0x5c7a('0xa'),_0x5c7a('0xb'),_0x5c7a('0xc'),_0x5c7a('0xd'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x5c7a('0x4')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5c7a('0x4')]},'smsMethod':{'type':Sequelize[_0x5c7a('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5c7a('0x4')]},'password':{'type':Sequelize[_0x5c7a('0x4')]},'apiKey':{'type':Sequelize[_0x5c7a('0x4')]},'applicationId':{'type':Sequelize[_0x5c7a('0x4')]},'accountId':{'type':Sequelize[_0x5c7a('0x4')]},'senderString':{'type':Sequelize[_0x5c7a('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5c7a('0xe')],'defaultValue':function(){return _0x5c7a('0xf');}},'notificationSound':{'type':Sequelize[_0x5c7a('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5c7a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5c7a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5c7a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5c7a('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5c7a('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5c7a('0x11')],'comment':_0x5c7a('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c6404){if(!_0x3c6404)this[_0x5c7a('0x13')](_0x5c7a('0x14'),null);this['setDataValue'](_0x5c7a('0x15'),_0x3c6404);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 03ce8e4..43fd8f2 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 _0xaa5c=['agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','findAndCountAll','priority','stack','finally','getApplications','getInteractions','Owner','fullname','Tag','Tags','tag','findAll','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','DESC','defaults','out','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','client','http','request','info','request\x20sent','debug','error','SmsAccount,\x20%s,\x20%s','result','message','catch','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','update','destroy','then','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','rows','show','params','SmsAccount','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','nolimit','pick','SmsAccountId','options','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','skebby','sender','text','connectel','from','clicksend','message_id','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','updatedAt','list','SmsInteraction','spread','interaction','autoclose','unmanaged','created','SmsMessage','AttachmentId','UserId','User','unshift'];(function(_0x3b1922,_0x413476){var _0x154e0b=function(_0x2eeb84){while(--_0x2eeb84){_0x3b1922['push'](_0x3b1922['shift']());}};_0x154e0b(++_0x413476);}(_0xaa5c,0x125));var _0xcaa5=function(_0x180da3,_0xb073ea){_0x180da3=_0x180da3-0x0;var _0x1f5a88=_0xaa5c[_0x180da3];return _0x1f5a88;};'use strict';var emlformat=require(_0xcaa5('0x0'));var rimraf=require(_0xcaa5('0x1'));var zipdir=require(_0xcaa5('0x2'));var jsonpatch=require(_0xcaa5('0x3'));var rp=require('request-promise');var moment=require(_0xcaa5('0x4'));var BPromise=require(_0xcaa5('0x5'));var Mustache=require(_0xcaa5('0x6'));var util=require('util');var path=require(_0xcaa5('0x7'));var sox=require(_0xcaa5('0x8'));var csv=require('to-csv');var ejs=require(_0xcaa5('0x9'));var fs=require('fs');var fs_extra=require(_0xcaa5('0xa'));var _=require(_0xcaa5('0xb'));var squel=require(_0xcaa5('0xc'));var crypto=require(_0xcaa5('0xd'));var jsforce=require(_0xcaa5('0xe'));var deskjs=require(_0xcaa5('0xf'));var toCsv=require(_0xcaa5('0x10'));var querystring=require(_0xcaa5('0x11'));var Papa=require(_0xcaa5('0x12'));var Redis=require('ioredis');var authService=require(_0xcaa5('0x13'));var qs=require(_0xcaa5('0x14'));var as=require(_0xcaa5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa5('0x16'))('api');var utils=require(_0xcaa5('0x17'));var config=require(_0xcaa5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaa5('0x19'))['db'];config['redis']=_['defaults'](config[_0xcaa5('0x1a')],{'host':_0xcaa5('0x1b'),'port':0x18eb});var socket=require(_0xcaa5('0x1c'))(new Redis(config['redis']));require(_0xcaa5('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xcaa5('0x1e')][_0xcaa5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2d952c,_0x263923,_0x5ea212,_0x429e3b){return new BPromise(function(_0x548bb6,_0x53ec77){var _0x1a439c=_0x429e3b||client;return _0x1a439c[_0xcaa5('0x20')](_0x2d952c,_0x5ea212)['then'](function(_0x166d52){logger[_0xcaa5('0x21')]('SmsAccount,\x20%s,\x20%s',_0x263923,_0xcaa5('0x22'));logger[_0xcaa5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x263923,_0xcaa5('0x22'),JSON['stringify'](_0x166d52));if(_0x166d52[_0xcaa5('0x24')]){if(_0x166d52['error']['code']===0x1f4){logger[_0xcaa5('0x24')](_0xcaa5('0x25'),_0x263923,_0x166d52[_0xcaa5('0x24')]['message']);return _0x53ec77(_0x166d52[_0xcaa5('0x24')]['message']);}logger['error'](_0xcaa5('0x25'),_0x263923,_0x166d52[_0xcaa5('0x24')]['message']);return _0x548bb6(_0x166d52[_0xcaa5('0x24')]['message']);}else{logger[_0xcaa5('0x21')](_0xcaa5('0x25'),_0x263923,'request\x20sent');_0x548bb6(_0x166d52[_0xcaa5('0x26')][_0xcaa5('0x27')]);}})[_0xcaa5('0x28')](function(_0x1ac928){logger[_0xcaa5('0x24')](_0xcaa5('0x25'),_0x263923,_0x1ac928);_0x53ec77(_0x1ac928);});});}function respondWithStatusCode(_0x576758,_0x23aace){_0x23aace=_0x23aace||0xcc;return function(_0x1e5849){if(_0x1e5849){return _0x576758[_0xcaa5('0x29')](_0x23aace);}return _0x576758['status'](_0x23aace)[_0xcaa5('0x2a')]();};}function respondWithResult(_0x3fb40e,_0x306c57){_0x306c57=_0x306c57||0xc8;return function(_0x2b35d5){if(_0x2b35d5){return _0x3fb40e[_0xcaa5('0x2b')](_0x306c57)['json'](_0x2b35d5);}};}function respondWithFilteredResult(_0xf3afb6,_0x23e4e8){return function(_0x393604){if(_0x393604){var _0x160e88=typeof _0x23e4e8[_0xcaa5('0x2c')]==='undefined'&&typeof _0x23e4e8[_0xcaa5('0x2d')]==='undefined';var _0x40a829=_0x393604[_0xcaa5('0x2e')];var _0x2576df=_0x160e88?0x0:_0x23e4e8[_0xcaa5('0x2c')];var _0x151c48=_0x160e88?_0x393604[_0xcaa5('0x2e')]:_0x23e4e8[_0xcaa5('0x2c')]+_0x23e4e8[_0xcaa5('0x2d')];var _0x7aad5a;if(_0x151c48>=_0x40a829){_0x151c48=_0x40a829;_0x7aad5a=0xc8;}else{_0x7aad5a=0xce;}_0xf3afb6['status'](_0x7aad5a);return _0xf3afb6[_0xcaa5('0x2f')](_0xcaa5('0x30'),_0x2576df+'-'+_0x151c48+'/'+_0x40a829)[_0xcaa5('0x31')](_0x393604);}return null;};}function patchUpdates(_0x547e44){return function(_0x3ddf03){try{jsonpatch[_0xcaa5('0x32')](_0x3ddf03,_0x547e44,!![]);}catch(_0x3cfc8b){return BPromise['reject'](_0x3cfc8b);}return _0x3ddf03['save']();};}function saveUpdates(_0x16499f,_0x38984c){return function(_0x536ead){if(_0x536ead){return _0x536ead[_0xcaa5('0x33')](_0x16499f)['then'](function(_0x68b17b){return _0x68b17b;});}return null;};}function removeEntity(_0x4896df,_0x17a011){return function(_0x359ce5){if(_0x359ce5){return _0x359ce5[_0xcaa5('0x34')]()[_0xcaa5('0x35')](function(){var _0x7b0f8a=_0x359ce5['get']({'plain':!![]});var _0x288f8a=_0xcaa5('0x36');return db[_0xcaa5('0x37')][_0xcaa5('0x34')]({'where':{'type':_0x288f8a,'resourceId':_0x7b0f8a['id']}})['then'](function(){return _0x359ce5;});})[_0xcaa5('0x35')](function(){_0x4896df[_0xcaa5('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1624fd,_0x54d902){return function(_0xb7fd0d){if(!_0xb7fd0d){_0x1624fd['sendStatus'](0x194);}return _0xb7fd0d;};}function handleError(_0x2615c3,_0x29c0ee){_0x29c0ee=_0x29c0ee||0x1f4;return function(_0x691eac){logger[_0xcaa5('0x24')](_0x691eac['stack']);if(_0x691eac[_0xcaa5('0x38')]){delete _0x691eac[_0xcaa5('0x38')];}_0x2615c3[_0xcaa5('0x2b')](_0x29c0ee)[_0xcaa5('0x39')](_0x691eac);};}exports['index']=function(_0x26248c,_0x12f0da){var _0x1b328f={'include':[{'model':db[_0xcaa5('0x3a')],'as':_0xcaa5('0x3b')}]},_0x530ed6={},_0x3830ec={'count':0x0,'rows':[]};var _0x4d3aef=_[_0xcaa5('0x3c')](db['SmsAccount'][_0xcaa5('0x3d')],function(_0x2f649b){return{'name':_0x2f649b[_0xcaa5('0x3e')],'type':_0x2f649b[_0xcaa5('0x3f')][_0xcaa5('0x40')]};});_0x530ed6[_0xcaa5('0x41')]=_['map'](_0x4d3aef,_0xcaa5('0x38'));_0x530ed6[_0xcaa5('0x42')]=_[_0xcaa5('0x43')](_0x26248c[_0xcaa5('0x42')]);_0x530ed6['filters']=_[_0xcaa5('0x44')](_0x530ed6['model'],_0x530ed6[_0xcaa5('0x42')]);_0x1b328f[_0xcaa5('0x45')]=_[_0xcaa5('0x44')](_0x530ed6[_0xcaa5('0x41')],qs[_0xcaa5('0x46')](_0x26248c[_0xcaa5('0x42')][_0xcaa5('0x46')]));_0x1b328f[_0xcaa5('0x45')]=_0x1b328f[_0xcaa5('0x45')][_0xcaa5('0x47')]?_0x1b328f[_0xcaa5('0x45')]:_0x530ed6[_0xcaa5('0x41')];if(!_0x26248c[_0xcaa5('0x42')][_0xcaa5('0x48')]('nolimit')){_0x1b328f[_0xcaa5('0x2d')]=qs['limit'](_0x26248c[_0xcaa5('0x42')][_0xcaa5('0x2d')]);_0x1b328f[_0xcaa5('0x2c')]=qs[_0xcaa5('0x2c')](_0x26248c['query'][_0xcaa5('0x2c')]);}_0x1b328f[_0xcaa5('0x49')]=qs[_0xcaa5('0x4a')](_0x26248c['query'][_0xcaa5('0x4a')]);_0x1b328f[_0xcaa5('0x4b')]=qs['filters'](_['pick'](_0x26248c[_0xcaa5('0x42')],_0x530ed6[_0xcaa5('0x4c')]),_0x4d3aef);if(_0x26248c[_0xcaa5('0x42')]['filter']){_0x1b328f[_0xcaa5('0x4b')]=_[_0xcaa5('0x4d')](_0x1b328f['where'],{'$or':_['map'](_0x4d3aef,function(_0x24fa84){if(_0x24fa84['type']!==_0xcaa5('0x4e')){var _0x4f4aaf={};_0x4f4aaf[_0x24fa84['name']]={'$like':'%'+_0x26248c[_0xcaa5('0x42')][_0xcaa5('0x4f')]+'%'};return _0x4f4aaf;}})});}_0x1b328f=_[_0xcaa5('0x4d')]({},_0x1b328f,_0x26248c['options']);var _0x55ed4e={'where':_0x1b328f[_0xcaa5('0x4b')]};return db['SmsAccount']['count'](_0x55ed4e)[_0xcaa5('0x35')](function(_0x48ae90){_0x3830ec[_0xcaa5('0x2e')]=_0x48ae90;if(_0x26248c['query'][_0xcaa5('0x50')]){_0x1b328f[_0xcaa5('0x51')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1b328f);})[_0xcaa5('0x35')](function(_0x11a8af){_0x3830ec[_0xcaa5('0x52')]=_0x11a8af;return _0x3830ec;})['then'](respondWithFilteredResult(_0x12f0da,_0x1b328f))[_0xcaa5('0x28')](handleError(_0x12f0da,null));};exports[_0xcaa5('0x53')]=function(_0x44253a,_0x4e554a){var _0x12d5f3={'raw':![],'where':{'id':_0x44253a[_0xcaa5('0x54')]['id']},'include':[{'model':db[_0xcaa5('0x3a')],'as':_0xcaa5('0x3b')}]},_0x3e6ed1={};_0x3e6ed1['model']=_['keys'](db[_0xcaa5('0x55')]['rawAttributes']);_0x3e6ed1[_0xcaa5('0x42')]=_['keys'](_0x44253a[_0xcaa5('0x42')]);_0x3e6ed1[_0xcaa5('0x4c')]=_[_0xcaa5('0x44')](_0x3e6ed1[_0xcaa5('0x41')],_0x3e6ed1['query']);_0x12d5f3['attributes']=_[_0xcaa5('0x44')](_0x3e6ed1['model'],qs[_0xcaa5('0x46')](_0x44253a['query'][_0xcaa5('0x46')]));_0x12d5f3[_0xcaa5('0x45')]=_0x12d5f3[_0xcaa5('0x45')][_0xcaa5('0x47')]?_0x12d5f3['attributes']:_0x3e6ed1['model'];if(_0x44253a[_0xcaa5('0x42')][_0xcaa5('0x50')]){_0x12d5f3[_0xcaa5('0x51')]=[{'all':!![]}];}_0x12d5f3=_[_0xcaa5('0x4d')]({},_0x12d5f3,_0x44253a['options']);return db[_0xcaa5('0x55')][_0xcaa5('0x56')](_0x12d5f3)[_0xcaa5('0x35')](handleEntityNotFound(_0x4e554a,null))[_0xcaa5('0x35')](respondWithResult(_0x4e554a,null))[_0xcaa5('0x28')](handleError(_0x4e554a,null));};exports[_0xcaa5('0x57')]=function(_0x4642c3,_0x492c8f){return db['SmsAccount']['create'](_0x4642c3[_0xcaa5('0x58')],{})['then'](function(_0x450f2a){var _0x2b032a=_0x4642c3['user'][_0xcaa5('0x59')]({'plain':!![]});if(!_0x2b032a)throw new Error(_0xcaa5('0x5a'));if(_0x2b032a[_0xcaa5('0x5b')]===_0xcaa5('0x5c')){var _0x2e38da=_0x450f2a[_0xcaa5('0x59')]({'plain':!![]});var _0x898dae='SmsAccounts';return db[_0xcaa5('0x5d')][_0xcaa5('0x56')]({'where':{'name':_0x898dae,'userProfileId':_0x2b032a[_0xcaa5('0x5e')]},'raw':!![]})[_0xcaa5('0x35')](function(_0x6d51f){if(_0x6d51f&&_0x6d51f[_0xcaa5('0x5f')]===0x0){return db['UserProfileResource'][_0xcaa5('0x57')]({'name':_0x2e38da['name'],'resourceId':_0x2e38da['id'],'type':_0x6d51f[_0xcaa5('0x38')],'sectionId':_0x6d51f['id']},{})[_0xcaa5('0x35')](function(){return _0x450f2a;});}else{return _0x450f2a;}})[_0xcaa5('0x28')](function(_0x1046b9){logger[_0xcaa5('0x24')](_0xcaa5('0x60'),_0x1046b9);throw _0x1046b9;});}return _0x450f2a;})[_0xcaa5('0x35')](respondWithResult(_0x492c8f,0xc9))[_0xcaa5('0x28')](handleError(_0x492c8f,null));};exports['update']=function(_0x27735d,_0x3b59d4){if(_0x27735d[_0xcaa5('0x58')]['id']){delete _0x27735d[_0xcaa5('0x58')]['id'];}return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x27735d[_0xcaa5('0x54')]['id']},'include':[{'model':db[_0xcaa5('0x3a')],'as':_0xcaa5('0x3b')}]})['then'](handleEntityNotFound(_0x3b59d4,null))['then'](saveUpdates(_0x27735d[_0xcaa5('0x58')],null))[_0xcaa5('0x35')](respondWithResult(_0x3b59d4,null))[_0xcaa5('0x28')](handleError(_0x3b59d4,null));};exports['destroy']=function(_0x2c9351,_0x300809){return db[_0xcaa5('0x55')]['find']({'where':{'id':_0x2c9351[_0xcaa5('0x54')]['id']}})['then'](handleEntityNotFound(_0x300809,null))['then'](removeEntity(_0x300809,null))[_0xcaa5('0x28')](handleError(_0x300809,null));};exports[_0xcaa5('0x61')]=function(_0x5a15b6,_0x2ca20a){return db[_0xcaa5('0x55')][_0xcaa5('0x61')]()[_0xcaa5('0x35')](respondWithResult(_0x2ca20a,null))['catch'](handleError(_0x2ca20a,null));};exports[_0xcaa5('0x62')]=function(_0x7c36ec,_0x57da9a,_0x25c8e2){if(_0x7c36ec[_0xcaa5('0x58')]['id']){delete _0x7c36ec[_0xcaa5('0x58')]['id'];}return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x7c36ec['params']['id']}})['then'](handleEntityNotFound(_0x57da9a,null))[_0xcaa5('0x35')](function(_0xba0fd1){if(_0xba0fd1){_0x7c36ec[_0xcaa5('0x58')]['SmsAccountId']=_0xba0fd1['id'];return db['Disposition'][_0xcaa5('0x57')](_0x7c36ec[_0xcaa5('0x58')]);}})[_0xcaa5('0x35')](respondWithResult(_0x57da9a,null))[_0xcaa5('0x28')](handleError(_0x57da9a,null));};exports[_0xcaa5('0x63')]=function(_0x5d8b06,_0x5a2766,_0x1de35f){var _0x3a6f8a={'raw':![],'where':{}};var _0x184b73={};var _0x55e699={'count':0x0,'rows':[]};return db[_0xcaa5('0x55')][_0xcaa5('0x64')]({'where':{'id':_0x5d8b06[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x5a2766,null))['then'](function(_0x206aac){if(_0x206aac){_0x184b73['model']=_[_0xcaa5('0x43')](db[_0xcaa5('0x65')][_0xcaa5('0x3d')]);_0x184b73['query']=_[_0xcaa5('0x43')](_0x5d8b06[_0xcaa5('0x42')]);_0x184b73['filters']=_[_0xcaa5('0x44')](_0x184b73[_0xcaa5('0x41')],_0x184b73[_0xcaa5('0x42')]);_0x3a6f8a[_0xcaa5('0x45')]=_[_0xcaa5('0x44')](_0x184b73[_0xcaa5('0x41')],qs[_0xcaa5('0x46')](_0x5d8b06['query'][_0xcaa5('0x46')]));_0x3a6f8a[_0xcaa5('0x45')]=_0x3a6f8a[_0xcaa5('0x45')]['length']?_0x3a6f8a[_0xcaa5('0x45')]:_0x184b73['model'];if(!_0x5d8b06[_0xcaa5('0x42')][_0xcaa5('0x48')](_0xcaa5('0x66'))){_0x3a6f8a[_0xcaa5('0x2d')]=qs[_0xcaa5('0x2d')](_0x5d8b06['query']['limit']);_0x3a6f8a[_0xcaa5('0x2c')]=qs[_0xcaa5('0x2c')](_0x5d8b06['query'][_0xcaa5('0x2c')]);}_0x3a6f8a[_0xcaa5('0x49')]=qs[_0xcaa5('0x4a')](_0x5d8b06[_0xcaa5('0x42')][_0xcaa5('0x4a')]);_0x3a6f8a[_0xcaa5('0x4b')]=qs['filters'](_[_0xcaa5('0x67')](_0x5d8b06[_0xcaa5('0x42')],_0x184b73['filters']));_0x3a6f8a[_0xcaa5('0x4b')][_0xcaa5('0x68')]=_0x206aac['id'];if(_0x5d8b06[_0xcaa5('0x42')][_0xcaa5('0x4f')]){_0x3a6f8a[_0xcaa5('0x4b')]=_['merge'](_0x3a6f8a[_0xcaa5('0x4b')],{'$or':_['map'](_0x3a6f8a['attributes'],function(_0x492b27){var _0x2bd29d={};_0x2bd29d[_0x492b27]={'$like':'%'+_0x5d8b06[_0xcaa5('0x42')]['filter']+'%'};return _0x2bd29d;})});}_0x3a6f8a=_[_0xcaa5('0x4d')]({},_0x3a6f8a,_0x5d8b06[_0xcaa5('0x69')]);return db[_0xcaa5('0x65')][_0xcaa5('0x2e')]({'where':_0x3a6f8a[_0xcaa5('0x4b')]})[_0xcaa5('0x35')](function(_0xc9a646){_0x55e699[_0xcaa5('0x2e')]=_0xc9a646;if(_0x5d8b06[_0xcaa5('0x42')][_0xcaa5('0x50')]){_0x3a6f8a[_0xcaa5('0x51')]=[{'all':!![]}];}return db[_0xcaa5('0x65')]['findAll'](_0x3a6f8a);})['then'](function(_0x254d01){_0x55e699[_0xcaa5('0x52')]=_0x254d01;return _0x55e699;});}})[_0xcaa5('0x35')](respondWithFilteredResult(_0x5a2766,_0x3a6f8a))['catch'](handleError(_0x5a2766,null));};exports[_0xcaa5('0x6a')]=function(_0x4f8b2f,_0x59e00c,_0x34b956){return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x4f8b2f['params']['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x59e00c,null))[_0xcaa5('0x35')](function(_0x1d6a78){if(_0x1d6a78){return _0x1d6a78[_0xcaa5('0x6a')](_0x4f8b2f['query'][_0xcaa5('0x6b')]);}})[_0xcaa5('0x35')](respondWithStatusCode(_0x59e00c,null))[_0xcaa5('0x28')](handleError(_0x59e00c,null));};exports[_0xcaa5('0x6c')]=function(_0x3e84db,_0x1738d2,_0x12aa43){if(_0x3e84db[_0xcaa5('0x58')]['id']){delete _0x3e84db[_0xcaa5('0x58')]['id'];}return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x3e84db['params']['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x1738d2,null))[_0xcaa5('0x35')](function(_0x51cc76){if(_0x51cc76){_0x3e84db[_0xcaa5('0x58')][_0xcaa5('0x68')]=_0x51cc76['id'];return db['CannedAnswer']['create'](_0x3e84db['body']);}})[_0xcaa5('0x35')](respondWithResult(_0x1738d2,null))[_0xcaa5('0x28')](handleError(_0x1738d2,null));};exports[_0xcaa5('0x6d')]=function(_0x265421,_0x56ea04,_0x3e9d54){var _0x57e328={'raw':![],'where':{}};var _0x75f929={};var _0x20a294={'count':0x0,'rows':[]};return db[_0xcaa5('0x55')][_0xcaa5('0x64')]({'where':{'id':_0x265421[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x56ea04,null))[_0xcaa5('0x35')](function(_0x44ac10){if(_0x44ac10){_0x75f929[_0xcaa5('0x41')]=_[_0xcaa5('0x43')](db[_0xcaa5('0x6e')][_0xcaa5('0x3d')]);_0x75f929[_0xcaa5('0x42')]=_['keys'](_0x265421['query']);_0x75f929[_0xcaa5('0x4c')]=_[_0xcaa5('0x44')](_0x75f929[_0xcaa5('0x41')],_0x75f929['query']);_0x57e328['attributes']=_[_0xcaa5('0x44')](_0x75f929['model'],qs[_0xcaa5('0x46')](_0x265421[_0xcaa5('0x42')]['fields']));_0x57e328[_0xcaa5('0x45')]=_0x57e328[_0xcaa5('0x45')][_0xcaa5('0x47')]?_0x57e328[_0xcaa5('0x45')]:_0x75f929[_0xcaa5('0x41')];if(!_0x265421[_0xcaa5('0x42')][_0xcaa5('0x48')](_0xcaa5('0x66'))){_0x57e328[_0xcaa5('0x2d')]=qs[_0xcaa5('0x2d')](_0x265421[_0xcaa5('0x42')][_0xcaa5('0x2d')]);_0x57e328[_0xcaa5('0x2c')]=qs[_0xcaa5('0x2c')](_0x265421[_0xcaa5('0x42')][_0xcaa5('0x2c')]);}_0x57e328['order']=qs[_0xcaa5('0x4a')](_0x265421[_0xcaa5('0x42')][_0xcaa5('0x4a')]);_0x57e328[_0xcaa5('0x4b')]=qs[_0xcaa5('0x4c')](_['pick'](_0x265421[_0xcaa5('0x42')],_0x75f929[_0xcaa5('0x4c')]));_0x57e328[_0xcaa5('0x4b')][_0xcaa5('0x68')]=_0x44ac10['id'];if(_0x265421[_0xcaa5('0x42')][_0xcaa5('0x4f')]){_0x57e328[_0xcaa5('0x4b')]=_['merge'](_0x57e328['where'],{'$or':_['map'](_0x57e328[_0xcaa5('0x45')],function(_0x51ef2c){var _0x4b54a3={};_0x4b54a3[_0x51ef2c]={'$like':'%'+_0x265421[_0xcaa5('0x42')]['filter']+'%'};return _0x4b54a3;})});}_0x57e328=_[_0xcaa5('0x4d')]({},_0x57e328,_0x265421[_0xcaa5('0x69')]);return db[_0xcaa5('0x6e')][_0xcaa5('0x2e')]({'where':_0x57e328[_0xcaa5('0x4b')]})[_0xcaa5('0x35')](function(_0x37d2ec){_0x20a294[_0xcaa5('0x2e')]=_0x37d2ec;if(_0x265421[_0xcaa5('0x42')][_0xcaa5('0x50')]){_0x57e328['include']=[{'all':!![]}];}return db[_0xcaa5('0x6e')]['findAll'](_0x57e328);})[_0xcaa5('0x35')](function(_0x509fed){_0x20a294['rows']=_0x509fed;return _0x20a294;});}})[_0xcaa5('0x35')](respondWithFilteredResult(_0x56ea04,_0x57e328))['catch'](handleError(_0x56ea04,null));};exports[_0xcaa5('0x6f')]=function(_0x935a63,_0x4bc251,_0x733ce2){return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x935a63[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x4bc251,null))[_0xcaa5('0x35')](function(_0x321d27){if(_0x321d27){return _0x321d27[_0xcaa5('0x6f')](_0x935a63[_0xcaa5('0x42')]['ids']);}})[_0xcaa5('0x35')](respondWithStatusCode(_0x4bc251,null))[_0xcaa5('0x28')](handleError(_0x4bc251,null));};exports[_0xcaa5('0x70')]=function(_0x10f66f,_0x28212b,_0x2fa813){var _0x178de0={'channel':_0xcaa5('0x71')};var _0x242a7b=[];var _0x28c4d1=[];var _0x2bdf37={};return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x10f66f[_0xcaa5('0x54')]['id']},'include':[{'model':db[_0xcaa5('0x72')],'as':_0xcaa5('0x73')}]})[_0xcaa5('0x35')](handleEntityNotFound(_0x28212b,null))['then'](function(_0x1f59e3){_0x178de0[_0xcaa5('0x74')]=_0x1f59e3;_0x178de0[_0xcaa5('0x75')]=_[_0xcaa5('0x76')](_0x1f59e3[_0xcaa5('0x73')],['priority'],[_0xcaa5('0x77')]);if(_0x178de0[_0xcaa5('0x74')][_0xcaa5('0x73')]){delete _0x178de0[_0xcaa5('0x74')][_0xcaa5('0x73')];}return db['CmContact'][_0xcaa5('0x61')]();})[_0xcaa5('0x35')](function(_0x57b6fa){if(!_0x57b6fa){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0x7a'));}_0x242a7b=_['difference'](_[_0xcaa5('0x43')](_0x57b6fa),[_0xcaa5('0x7b'),'updatedAt']);_0x28c4d1=_[_0xcaa5('0x7c')](_[_0xcaa5('0x43')](_0x57b6fa),[_0xcaa5('0x7b'),'updatedAt',_0xcaa5('0x7d'),_0xcaa5('0x7e')]);_0x178de0[_0xcaa5('0x58')]={'mapKey':_0xcaa5('0x7f')};if(_0x178de0[_0xcaa5('0x74')][_0xcaa5('0x3f')]){switch(_0x178de0['account'][_0xcaa5('0x3f')]){case _0xcaa5('0x80'):_0x178de0[_0xcaa5('0x58')]['from']=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x81')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x82')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x83')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x84')];break;case _0xcaa5('0x85'):_0x178de0[_0xcaa5('0x58')]['from']='+'+_0x10f66f['body'][_0xcaa5('0x86')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x87')];break;case _0xcaa5('0x88'):_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x89')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x27')];break;case _0xcaa5('0x8a'):_0x178de0['body'][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x89')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f['body'][_0xcaa5('0x58')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x83')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x8b')];break;case'plivo':_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x81')];_0x178de0['body']['body']=_0x10f66f[_0xcaa5('0x58')]['Text'];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x83')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x8c')];break;case _0xcaa5('0x8d'):_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]='+'+_0x10f66f['body'][_0xcaa5('0x8e')][0x0][_0xcaa5('0x89')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x8e')][0x0][_0xcaa5('0x87')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x83')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x8e')][0x0][_0xcaa5('0x83')];break;case _0xcaa5('0x8f'):_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x90')];_0x178de0[_0xcaa5('0x58')]['body']=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x91')][_0xcaa5('0x27')];break;case _0xcaa5('0x92'):_0x178de0[_0xcaa5('0x58')]['from']=_0x10f66f['body'][_0xcaa5('0x93')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f['body'][_0xcaa5('0x87')];_0x178de0['body']['messageId']=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x94')];break;case _0xcaa5('0x95'):_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x83')]=_0x10f66f[_0xcaa5('0x58')][0x0][_0xcaa5('0x27')]['id'];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][0x0][_0xcaa5('0x27')][_0xcaa5('0x89')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][0x0][_0xcaa5('0x27')][_0xcaa5('0x87')];break;case _0xcaa5('0x96'):_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x89')];_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x27')];_0x178de0[_0xcaa5('0x58')]['messageId']=_0x10f66f[_0xcaa5('0x58')][_0xcaa5('0x97')];break;}}if(_0x178de0['body']['id']){delete _0x178de0[_0xcaa5('0x58')]['id'];}if(_[_0xcaa5('0x98')](_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')])){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0x99'));}if(_['isNil'](_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')])||_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x58')]===''){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcaa5('0x98')](_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x9a')])){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0x9b')+_0x28c4d1);}if(!_[_0xcaa5('0x9c')](_0x28c4d1,_0x178de0['body']['mapKey'])){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0x9d')+_0x28c4d1);}_0x2bdf37[_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x9a')]]=_0x178de0['body'][_0xcaa5('0x89')];return db['CmList']['find']({'where':{'id':_0x178de0[_0xcaa5('0x74')][_0xcaa5('0x7e')]},'include':[{'model':db[_0xcaa5('0x9e')],'as':_0xcaa5('0x9f'),'where':_0x2bdf37,'limit':0x1,'order':[[_0xcaa5('0xa0'),'DESC']]}]});})[_0xcaa5('0x35')](handleEntityNotFound(_0x28212b,null))[_0xcaa5('0x35')](function(_0x3b0fce){if(_0x3b0fce){_0x178de0[_0xcaa5('0xa1')]=_['omit'](_0x3b0fce,[_0xcaa5('0x9f')]);if(_0x3b0fce['Contacts']['length']){return _0x3b0fce['Contacts'][0x0];}var _0x231ff0=_['defaults'](_0x178de0[_0xcaa5('0x58')],{'firstName':_0x178de0['body'][_0xcaa5('0x89')],'ListId':_0x3b0fce['id']});_0x231ff0[_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x9a')]]=_0x178de0[_0xcaa5('0x58')][_0xcaa5('0x89')];return db['CmContact'][_0xcaa5('0x57')](_0x231ff0,{'fields':_0x242a7b,'raw':!![]});}})[_0xcaa5('0x35')](handleEntityNotFound(_0x28212b,null))[_0xcaa5('0x35')](function(_0x11abc2){if(_0x11abc2){_0x178de0['contact']=_0x11abc2;var _0x237e7f={'ContactId':_0x11abc2['id'],'phone':_0x178de0['body']['from'],'SmsAccountId':_0x10f66f[_0xcaa5('0x54')]['id']};var _0x2f215c={'ContactId':_0x11abc2['id'],'SmsAccountId':_0x10f66f[_0xcaa5('0x54')]['id'],'closed':![]};return db[_0xcaa5('0xa2')][_0xcaa5('0x56')]({'where':_0x2f215c})[_0xcaa5('0x35')](function(_0x511e7a){if(_0x511e7a){return[_0x511e7a,![]];}return db[_0xcaa5('0xa2')][_0xcaa5('0x57')](_0x237e7f)[_0xcaa5('0x35')](function(_0xbf1cb4){return[_0xbf1cb4,!![]];});});}})[_0xcaa5('0xa3')](function(_0x4230b6,_0x56a779){_0x178de0['interaction']=_0x4230b6[_0xcaa5('0x59')]({'plain':!![]});_0x178de0[_0xcaa5('0xa4')]['created']=![];if(_0x56a779){if(_0x178de0['account'][_0xcaa5('0xa5')]){_0x178de0[_0xcaa5('0x75')]['push']({'id':0x0,'priority':_0x178de0[_0xcaa5('0x75')]['length']+0x1,'app':'close','appdata':_0xcaa5('0xa6'),'interval':'*,*,*,*'});}_0x178de0[_0xcaa5('0xa4')][_0xcaa5('0xa7')]=!![];}return db[_0xcaa5('0xa8')][_0xcaa5('0x57')]({'phone':_0x178de0['body'][_0xcaa5('0x89')],'messageId':_0x178de0['body'][_0xcaa5('0x83')],'body':_0x178de0['body'][_0xcaa5('0x58')],'SmsAccountId':_0x10f66f[_0xcaa5('0x54')]['id'],'SmsInteractionId':_0x4230b6['id'],'direction':'in','ContactId':_0x4230b6['ContactId'],'AttachmentId':_0x178de0['body'][_0xcaa5('0xa9')]});})[_0xcaa5('0x35')](function(_0x3c780e){_0x178de0[_0xcaa5('0x27')]=_0x3c780e;if(_0x178de0[_0xcaa5('0xa4')][_0xcaa5('0xaa')]){return db[_0xcaa5('0xab')][_0xcaa5('0x56')]({'attributes':['id',_0xcaa5('0x38')],'where':{'id':_0x178de0[_0xcaa5('0xa4')][_0xcaa5('0xaa')]}})[_0xcaa5('0x35')](function(_0x4fc46f){if(_0x4fc46f){_0x178de0[_0xcaa5('0x75')][_0xcaa5('0xac')]({'id':0x0,'priority':0x0,'app':_0xcaa5('0xad'),'appdata':_0x4fc46f['name']+','+(_0x178de0[_0xcaa5('0x74')][_0xcaa5('0xae')]||0xa),'interval':_0xcaa5('0xaf')});}return respondWithRpcPromise('Start',_0xcaa5('0xb0'),_0x178de0);});}return respondWithRpcPromise(_0xcaa5('0xb1'),'startRouting',_0x178de0);})[_0xcaa5('0x35')](function(_0x184bba){if(_0x184bba){var _0x2d110=0xc8;var _0x14846c=_0xcaa5('0xb2');logger['info'](_0xcaa5('0xb3'),_0x14846c,_0x2d110,'entity\x20found');logger[_0xcaa5('0x23')](_0xcaa5('0xb4'),_0x14846c,_0x2d110,_0xcaa5('0xb5'),JSON['stringify'](_0x184bba));if(_0x178de0['account'][_0xcaa5('0x3f')]===_0xcaa5('0x80')){return _0x28212b[_0xcaa5('0x2b')](_0x2d110)['set'](_0xcaa5('0xb6'),_0xcaa5('0xb7'))[_0xcaa5('0x39')](_0xcaa5('0xb8'));}else{return _0x28212b[_0xcaa5('0x2b')](_0x2d110)['json'](_0x184bba);}}})['catch'](handleError(_0x28212b,null));};exports['addApplications']=function(_0x2c2e50,_0x23e624){var _0x226700=_0x2c2e50[_0xcaa5('0x54')]['id'];var _0xb55052=_0x2c2e50[_0xcaa5('0x58')];var _0x1bbeb2=0xc8;var _0x4b5e59=null;return db[_0xcaa5('0xb9')][_0xcaa5('0xba')]({'isolationLevel':db['sequelize']['Transaction'][_0xcaa5('0xbb')]['READ_COMMITTED']},function(_0x25477c){return db['SmsAccount']['findOne']({'where':{'id':_0x226700},'transaction':_0x25477c})[_0xcaa5('0x35')](function(_0x482a04){if(_0x482a04){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x226700},'transaction':_0x25477c})[_0xcaa5('0x35')](function(){var _0x541474=_[_0xcaa5('0x3c')](_0xb55052,function(_0x5aca75){_0x5aca75[_0xcaa5('0x68')]=_0x226700;return _0x5aca75;});return db['SmsApplication']['bulkCreate'](_0x541474,{'transaction':_0x25477c});});}else{_0x1bbeb2=0x194;_0x4b5e59=[];}});})[_0xcaa5('0x35')](function(){if(_0x1bbeb2!==0x194){return db[_0xcaa5('0x72')][_0xcaa5('0xbc')]({'where':{'SmsAccountId':_0x226700},'order':_0xcaa5('0xbd')})[_0xcaa5('0x35')](function(_0xe978f5){_0x4b5e59=_0xe978f5;});}})[_0xcaa5('0x28')](function(_0x22c0de){_0x1bbeb2=0x1f4;logger[_0xcaa5('0x24')](_0x22c0de[_0xcaa5('0xbe')]);if(_0x22c0de[_0xcaa5('0x38')]){delete _0x22c0de[_0xcaa5('0x38')];}_0x4b5e59=_0x22c0de;})[_0xcaa5('0xbf')](function(){if(_0x4b5e59===null){_0x23e624[_0xcaa5('0x29')](_0x1bbeb2);}else{if(_0x1bbeb2===0x1f4){_0x23e624[_0xcaa5('0x2b')](_0x1bbeb2)[_0xcaa5('0x39')](_0x4b5e59);}else{_0x23e624[_0xcaa5('0x2b')](_0x1bbeb2)[_0xcaa5('0x31')](_0x4b5e59);}}});};exports[_0xcaa5('0xc0')]=function(_0x303420,_0x20bced,_0x2e6dc8){var _0x2115d3={};var _0x1ed0e4={};var _0x405ffa;var _0x33dfcb;return db[_0xcaa5('0x55')][_0xcaa5('0x64')]({'where':{'id':_0x303420[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x20bced,null))[_0xcaa5('0x35')](function(_0x234874){if(_0x234874){_0x405ffa=_0x234874;_0x1ed0e4[_0xcaa5('0x41')]=_[_0xcaa5('0x43')](db[_0xcaa5('0x72')][_0xcaa5('0x3d')]);_0x1ed0e4['query']=_[_0xcaa5('0x43')](_0x303420['query']);_0x1ed0e4[_0xcaa5('0x4c')]=_['intersection'](_0x1ed0e4[_0xcaa5('0x41')],_0x1ed0e4[_0xcaa5('0x42')]);_0x2115d3[_0xcaa5('0x45')]=_[_0xcaa5('0x44')](_0x1ed0e4[_0xcaa5('0x41')],qs[_0xcaa5('0x46')](_0x303420['query'][_0xcaa5('0x46')]));_0x2115d3[_0xcaa5('0x45')]=_0x2115d3[_0xcaa5('0x45')]['length']?_0x2115d3[_0xcaa5('0x45')]:_0x1ed0e4[_0xcaa5('0x41')];_0x2115d3[_0xcaa5('0x49')]=qs[_0xcaa5('0x4a')](_0x303420['query'][_0xcaa5('0x4a')]);_0x2115d3[_0xcaa5('0x4b')]=qs[_0xcaa5('0x4c')](_[_0xcaa5('0x67')](_0x303420['query'],_0x1ed0e4[_0xcaa5('0x4c')]));if(_0x303420['query']['filter']){_0x2115d3['where']=_[_0xcaa5('0x4d')](_0x2115d3[_0xcaa5('0x4b')],{'$or':_['map'](_0x2115d3['attributes'],function(_0x534a88){var _0x59a3dd={};_0x59a3dd[_0x534a88]={'$like':'%'+_0x303420[_0xcaa5('0x42')][_0xcaa5('0x4f')]+'%'};return _0x59a3dd;})});}_0x2115d3=_[_0xcaa5('0x4d')]({},_0x2115d3,_0x303420['options']);return _0x405ffa[_0xcaa5('0xc0')](_0x2115d3);}})[_0xcaa5('0x35')](function(_0x4210d0){if(_0x4210d0){_0x33dfcb=_0x4210d0[_0xcaa5('0x47')];if(!_0x303420[_0xcaa5('0x42')][_0xcaa5('0x48')](_0xcaa5('0x66'))){_0x2115d3[_0xcaa5('0x2d')]=qs[_0xcaa5('0x2d')](_0x303420[_0xcaa5('0x42')][_0xcaa5('0x2d')]);_0x2115d3[_0xcaa5('0x2c')]=qs[_0xcaa5('0x2c')](_0x303420['query']['offset']);}return _0x405ffa[_0xcaa5('0xc0')](_0x2115d3);}})[_0xcaa5('0x35')](function(_0xb6da0b){if(_0xb6da0b){return _0xb6da0b?{'count':_0x33dfcb,'rows':_0xb6da0b}:null;}})[_0xcaa5('0x35')](respondWithResult(_0x20bced,null))[_0xcaa5('0x28')](handleError(_0x20bced,null));};exports[_0xcaa5('0xc1')]=function(_0x97a43d,_0x313ed4,_0xacb620){var _0x8054bb={'raw':![],'where':{}};var _0x4f440c={};var _0x5b00c9={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x97a43d[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x313ed4,null))['then'](function(_0x26374e){if(_0x26374e){_0x4f440c[_0xcaa5('0x41')]=_[_0xcaa5('0x43')](db[_0xcaa5('0xa2')][_0xcaa5('0x3d')]);_0x4f440c[_0xcaa5('0x42')]=_[_0xcaa5('0x43')](_0x97a43d[_0xcaa5('0x42')]);_0x4f440c['filters']=_[_0xcaa5('0x44')](_0x4f440c[_0xcaa5('0x41')],_0x4f440c[_0xcaa5('0x42')]);_0x8054bb[_0xcaa5('0x45')]=_[_0xcaa5('0x44')](_0x4f440c[_0xcaa5('0x41')],qs[_0xcaa5('0x46')](_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0x46')]));_0x8054bb[_0xcaa5('0x45')]=_0x8054bb[_0xcaa5('0x45')][_0xcaa5('0x47')]?_0x8054bb['attributes']:_0x4f440c[_0xcaa5('0x41')];if(!_0x97a43d['query'][_0xcaa5('0x48')]('nolimit')){_0x8054bb[_0xcaa5('0x2d')]=qs[_0xcaa5('0x2d')](_0x97a43d['query'][_0xcaa5('0x2d')]);_0x8054bb[_0xcaa5('0x2c')]=qs[_0xcaa5('0x2c')](_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0x2c')]);}_0x8054bb[_0xcaa5('0x49')]=qs[_0xcaa5('0x4a')](_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0x4a')]);_0x8054bb[_0xcaa5('0x4b')]=qs['filters'](_[_0xcaa5('0x67')](_0x97a43d[_0xcaa5('0x42')],_0x4f440c[_0xcaa5('0x4c')]));_0x8054bb['where'][_0xcaa5('0x68')]=_0x26374e['id'];if(_0x97a43d[_0xcaa5('0x42')]['filter']){_0x8054bb[_0xcaa5('0x4b')]=_['merge'](_0x8054bb['where'],{'$or':_['map'](_0x8054bb['attributes'],function(_0x3c25df){var _0x2409c7={};_0x2409c7[_0x3c25df]={'$like':'%'+_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0x4f')]+'%'};return _0x2409c7;})});}_0x8054bb=_[_0xcaa5('0x4d')]({},_0x8054bb,_0x97a43d['options']);return db[_0xcaa5('0xa2')][_0xcaa5('0x2e')]({'where':_0x8054bb[_0xcaa5('0x4b')]})[_0xcaa5('0x35')](function(_0x25c030){_0x5b00c9['count']=_0x25c030;if(_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0x50')]){_0x8054bb['include']=[{'model':db[_0xcaa5('0x9e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xcaa5('0xc2'),'attributes':[_0xcaa5('0x38'),_0xcaa5('0xc3'),'internal'],'required':![]},{'model':db[_0xcaa5('0xc4')],'as':_0xcaa5('0xc5'),'attributes':['id',_0xcaa5('0x38'),'color'],'where':_0x97a43d[_0xcaa5('0x42')][_0xcaa5('0xc6')]?{'id':_0x97a43d['query']['tag']}:undefined,'required':_0x97a43d[_0xcaa5('0x42')]['tag']?!![]:![]}];}return db[_0xcaa5('0xa2')][_0xcaa5('0xc7')](_0x8054bb);})[_0xcaa5('0x35')](function(_0x4a35a3){_0x5b00c9[_0xcaa5('0x52')]=_0x4a35a3;return _0x5b00c9;});}})[_0xcaa5('0x35')](respondWithFilteredResult(_0x313ed4,_0x8054bb))[_0xcaa5('0x28')](handleError(_0x313ed4,null));};exports[_0xcaa5('0x39')]=function(_0x329c82,_0x244210,_0x35da6d){var _0xd6d0d0,_0x24150b,_0x3ecefe;if(_[_0xcaa5('0x98')](_0x329c82['body'][_0xcaa5('0x58')])||_0x329c82[_0xcaa5('0x58')][_0xcaa5('0x58')]===''){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0xc8'));}if(_[_0xcaa5('0x98')](_0x329c82[_0xcaa5('0x58')]['to'])){throw new db[(_0xcaa5('0x78'))][(_0xcaa5('0x79'))](_0xcaa5('0xc9'));}_0xd6d0d0=_0x329c82[_0xcaa5('0x58')]['to'];return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x329c82[_0xcaa5('0x54')]['id']},'include':[{'model':db[_0xcaa5('0xca')],'as':_0xcaa5('0xcb'),'include':[{'model':db['CmContact'],'as':_0xcaa5('0x9f'),'where':{'mobile':_0xd6d0d0},'limit':0x1,'order':[[_0xcaa5('0xa0'),_0xcaa5('0xcc')]]}]}]})[_0xcaa5('0x35')](handleEntityNotFound(_0x244210,null))[_0xcaa5('0x35')](function(_0x4c4e3b){if(_0x4c4e3b&&_0x4c4e3b[_0xcaa5('0xcb')]){_0x24150b=_0x4c4e3b['get']({'plain':!![]});if(_0x24150b['List']&&_0x24150b['List'][_0xcaa5('0x9f')][_0xcaa5('0x47')]){return _0x24150b[_0xcaa5('0xcb')][_0xcaa5('0x9f')][0x0];}return db[_0xcaa5('0x9e')][_0xcaa5('0x57')](_[_0xcaa5('0xcd')](_0x329c82[_0xcaa5('0x58')],{'firstName':_0xd6d0d0,'mobile':_0xd6d0d0,'phone':_0xd6d0d0,'ListId':_0x24150b['ListId']}));}})[_0xcaa5('0x35')](handleEntityNotFound(_0x244210,null))[_0xcaa5('0x35')](function(_0x4d5121){if(_0x4d5121){_0x3ecefe=_0x4d5121;return db['SmsInteraction'][_0xcaa5('0x56')]({'where':{'ContactId':_0x3ecefe['id'],'closed':![],'SmsAccountId':_0x24150b['id']}})['then'](function(_0x187b87){if(_0x187b87){return[_0x187b87,![]];}return db[_0xcaa5('0xa2')]['create']({'UserId':_0x329c82[_0xcaa5('0x5c')]['id'],'ContactId':_0x3ecefe['id'],'SmsAccountId':_0x24150b['id'],'phone':_0xd6d0d0,'firstMsgDirection':_0xcaa5('0xce'),'Messages':[_[_0xcaa5('0x4d')](_0x329c82[_0xcaa5('0x58')],{'read':![],'body':_0x329c82[_0xcaa5('0x58')][_0xcaa5('0x58')],'phone':_0xd6d0d0,'SmsAccountId':_0x24150b['id'],'UserId':_0x329c82[_0xcaa5('0x5c')]['id'],'ContactId':_0x3ecefe['id']})]},{'include':[{'model':db[_0xcaa5('0xa8')],'as':'Messages'}]})[_0xcaa5('0x35')](function(_0x19e5d2){return[_0x19e5d2,!![]];});});}})[_0xcaa5('0xa3')](function(_0x17f104,_0x295141){if(_0x295141){return _0x17f104;}return db[_0xcaa5('0xa8')]['create'](_['merge'](_0x329c82['body'],{'read':![],'body':_0x329c82[_0xcaa5('0x58')]['body'],'phone':_0xd6d0d0,'SmsAccountId':_0x24150b['id'],'SmsInteractionId':_0x17f104['id'],'UserId':_0x329c82[_0xcaa5('0x5c')]['id'],'ContactId':_0x3ecefe['id']}))['then'](function(_0x3d6cac){_0x17f104[_0xcaa5('0xcf')]['Messages']=[];_0x17f104[_0xcaa5('0xcf')]['Messages']['push'](_0x3d6cac[_0xcaa5('0xcf')]);return _0x17f104;});})[_0xcaa5('0x35')](respondWithResult(_0x244210,null))[_0xcaa5('0x28')](handleError(_0x244210,null));};exports[_0xcaa5('0x2b')]=function(_0x49a36c,_0x5441ad,_0x2510b4){if(_0x49a36c['body']['id']){delete _0x49a36c[_0xcaa5('0x58')]['id'];}var _0x143677,_0x2dbc27,_0x4e1600;return db[_0xcaa5('0x55')]['find']({'where':{'id':_0x49a36c['params']['id']}})['then'](handleEntityNotFound(_0x5441ad,null))[_0xcaa5('0x35')](function(_0x323b17){if(_0x323b17){_0x4e1600=_0x323b17;logger[_0xcaa5('0x23')](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0xd0'),_0x323b17[_0xcaa5('0x3f')],util['inspect'](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));switch(_0x323b17[_0xcaa5('0x3f')]){case _0xcaa5('0x85'):if(_0x49a36c['body']['skebby_dispatch_id']&&_0x49a36c[_0xcaa5('0x58')]['status']){_0x2dbc27=_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0x2b')];return db[_0xcaa5('0xa8')][_0xcaa5('0x56')]({'where':{'messageId':_0x49a36c['body'][_0xcaa5('0xd1')]}});}break;case'connectel':if(_0x49a36c['body'][_0xcaa5('0xd2')]&&_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0xd3')]){_0x2dbc27=_0x49a36c['body'][_0xcaa5('0xd3')];return db[_0xcaa5('0xa8')][_0xcaa5('0x56')]({'where':{'messageId':_0x49a36c[_0xcaa5('0x58')]['requestid']}});}break;case _0xcaa5('0x8a'):if(_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0x8b')]&&_0x49a36c['body'][_0xcaa5('0xd4')]){_0x2dbc27=_0x49a36c['body'][_0xcaa5('0xd4')];return db['SmsMessage'][_0xcaa5('0x56')]({'where':{'messageId':_0x49a36c[_0xcaa5('0x58')]['message_id']}});}break;case _0xcaa5('0x8d'):var _0x247cea=_0x49a36c['body'][_0xcaa5('0x8e')][0x0];if(_0x247cea[_0xcaa5('0x83')]&&_0x247cea[_0xcaa5('0x2b')][_0xcaa5('0xd5')]==='DELIVERED'){_0x2dbc27=_0x247cea[_0xcaa5('0x2b')][_0xcaa5('0xd5')];return db[_0xcaa5('0xa8')][_0xcaa5('0x56')]({'where':{'messageId':_0x247cea[_0xcaa5('0x83')]}});}break;case'clickatell':if(_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0x83')]&&_0x49a36c[_0xcaa5('0x58')]['status']){_0x2dbc27=_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0x2b')];return db[_0xcaa5('0xa8')][_0xcaa5('0x56')]({'where':{'messageId':_0x49a36c[_0xcaa5('0x58')]['messageId']}});}break;case _0xcaa5('0x95'):if(_0x49a36c[_0xcaa5('0x58')][0x0][_0xcaa5('0x27')]['id']){_0x2dbc27=_0x49a36c[_0xcaa5('0x58')][0x0]['type'];return db[_0xcaa5('0xa8')][_0xcaa5('0x56')]({'where':{'messageId':_0x49a36c['body'][0x0][_0xcaa5('0x27')]['id']}});}break;case _0xcaa5('0x96'):if(_0x49a36c['body'][_0xcaa5('0xd6')]&&_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0x2b')]){_0x2dbc27=_0x49a36c[_0xcaa5('0x58')]['status'];return db[_0xcaa5('0xa8')]['find']({'where':{'messageId':_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x5441ad,null))['then'](function(_0x252e4c){if(_0x252e4c){_0x143677=_0x252e4c;switch(_0x4e1600[_0xcaa5('0x3f')]){case _0xcaa5('0x85'):if(_0x2dbc27===_0xcaa5('0xd7')){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0x85'),util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2dbc27==='1'){return _0x143677['update']({'read':!![]});}else{logger['error'](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0x85'),util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcaa5('0x8a'):if(!_0x49a36c[_0xcaa5('0x58')][_0xcaa5('0xd9')]&&_0x2dbc27>=0xc8&&_0x2dbc27<=0xce){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0x8a'),util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcaa5('0x8d'):var _0xd5ed89=_0x49a36c['body']['results'][0x0];if(_0xd5ed89['status']['groupName']===_0xcaa5('0xd7')){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),'status','infobip',util['inspect'](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2dbc27==_0xcaa5('0xda')||_0x2dbc27==_0xcaa5('0xdb')){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0x92'),util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcaa5('0x95'):if(_0x2dbc27==_0xcaa5('0xdc')){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),'status',_0xcaa5('0x95'),util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;case _0xcaa5('0x96'):if(_0x2dbc27===_0xcaa5('0xdd')||_0x2dbc27===_0xcaa5('0xde')){return _0x143677[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),_0xcaa5('0x2b'),'intelepeer',util[_0xcaa5('0xd8')](_0x49a36c[_0xcaa5('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x143677;}})['then'](respondWithResult(_0x5441ad,null))[_0xcaa5('0x28')](handleError(_0x5441ad,null));};exports[_0xcaa5('0xdf')]=function(_0xac3a83,_0x2e63a0,_0x170a7b){var _0x2bc904,_0x197468,_0x1f5b44;return db[_0xcaa5('0x55')]['find']({'where':{'id':_0xac3a83['params']['id']}})['then'](handleEntityNotFound(_0x2e63a0,null))['then'](function(_0x37b8cb){if(_0x37b8cb){_0x1f5b44=_0x37b8cb;logger['debug'](_0xcaa5('0xb3'),_0xcaa5('0x2b'),_0xcaa5('0xd0'),_0x37b8cb[_0xcaa5('0x3f')],util['inspect'](_0xac3a83[_0xcaa5('0x42')],{'showHidden':![],'depth':null}));switch(_0x37b8cb['type']){case'csc':if(_0xac3a83[_0xcaa5('0x42')]['message-id']&&_0xac3a83[_0xcaa5('0x42')][_0xcaa5('0xe0')]){_0x197468=_0xac3a83['query'][_0xcaa5('0xe0')];return db[_0xcaa5('0xa8')]['find']({'where':{'messageId':_0xac3a83[_0xcaa5('0x42')][_0xcaa5('0xe1')]}});}break;}}})['then'](handleEntityNotFound(_0x2e63a0,null))['then'](function(_0x3031d5){if(_0x3031d5){_0x2bc904=_0x3031d5;switch(_0x1f5b44[_0xcaa5('0x3f')]){case'csc':if(_0x197468==='2'||_0x197468==='6'){return _0x2bc904[_0xcaa5('0x33')]({'read':!![]});}else{logger[_0xcaa5('0x24')](_0xcaa5('0xb3'),'status',_0xcaa5('0x8f'),util[_0xcaa5('0xd8')](_0xac3a83[_0xcaa5('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x2bc904;}})[_0xcaa5('0x35')](respondWithResult(_0x2e63a0,null))[_0xcaa5('0x28')](handleError(_0x2e63a0,null));};exports[_0xcaa5('0xe2')]=function(_0x2cecf0,_0x100bfa,_0x459a60){return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0x2cecf0[_0xcaa5('0x54')]['id']}})['then'](handleEntityNotFound(_0x100bfa,null))['then'](function(_0x5022da){if(_0x5022da){return _0x5022da[_0xcaa5('0xe2')](_0x2cecf0[_0xcaa5('0x58')]['ids'],_[_0xcaa5('0xe3')](_0x2cecf0[_0xcaa5('0x58')],[_0xcaa5('0x6b'),'id'])||{})[_0xcaa5('0xa3')](function(_0x46019f){for(var _0x235e12=0x0;_0x235e12<_0x2cecf0[_0xcaa5('0x58')][_0xcaa5('0x6b')][_0xcaa5('0x47')];_0x235e12+=0x1){socket[_0xcaa5('0xe4')](_0xcaa5('0xe5'),{'UserId':Number(_0x2cecf0[_0xcaa5('0x58')][_0xcaa5('0x6b')][_0x235e12]),'SmsAccountId':Number(_0x2cecf0[_0xcaa5('0x54')]['id'])});}return _0x46019f;});}})[_0xcaa5('0x35')](respondWithResult(_0x100bfa,null))[_0xcaa5('0x28')](handleError(_0x100bfa,null));};exports[_0xcaa5('0xe6')]=function(_0xc57469,_0x20e70d,_0x549a55){return db[_0xcaa5('0x55')][_0xcaa5('0x56')]({'where':{'id':_0xc57469[_0xcaa5('0x54')]['id']}})[_0xcaa5('0x35')](handleEntityNotFound(_0x20e70d,null))['then'](function(_0x3258aa){if(_0x3258aa){return _0x3258aa[_0xcaa5('0xe6')](_0xc57469[_0xcaa5('0x42')][_0xcaa5('0x6b')])[_0xcaa5('0x35')](function(){if(_['isArray'](_0xc57469['query'][_0xcaa5('0x6b')])){for(var _0x4e6bbf=0x0;_0x4e6bbf<_0xc57469[_0xcaa5('0x42')]['ids']['length'];_0x4e6bbf+=0x1){socket[_0xcaa5('0xe4')](_0xcaa5('0xe7'),{'UserId':Number(_0xc57469[_0xcaa5('0x42')][_0xcaa5('0x6b')][_0x4e6bbf]),'SmsAccountId':Number(_0xc57469[_0xcaa5('0x54')]['id'])});}}else{socket[_0xcaa5('0xe4')]('userSmsAccount:remove',{'UserId':Number(_0xc57469['query']['ids']),'SmsAccountId':Number(_0xc57469[_0xcaa5('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x20e70d,null))[_0xcaa5('0x28')](handleError(_0x20e70d,null));};exports['getAgents']=function(_0x28efba,_0x560ab5,_0x55879e){var _0x31c4ef={};var _0x3cc396={};var _0x5801b5;var _0x53d36f;return db['SmsAccount'][_0xcaa5('0x64')]({'where':{'id':_0x28efba[_0xcaa5('0x54')]['id']}})['then'](handleEntityNotFound(_0x560ab5,null))[_0xcaa5('0x35')](function(_0x3af990){if(_0x3af990){_0x5801b5=_0x3af990;_0x3cc396['model']=_['keys'](db[_0xcaa5('0xab')][_0xcaa5('0x3d')]);_0x3cc396[_0xcaa5('0x42')]=_[_0xcaa5('0x43')](_0x28efba['query']);_0x3cc396[_0xcaa5('0x4c')]=_[_0xcaa5('0x44')](_0x3cc396[_0xcaa5('0x41')],_0x3cc396[_0xcaa5('0x42')]);_0x31c4ef['attributes']=_['intersection'](_0x3cc396['model'],qs[_0xcaa5('0x46')](_0x28efba[_0xcaa5('0x42')][_0xcaa5('0x46')]));_0x31c4ef[_0xcaa5('0x45')]=_0x31c4ef[_0xcaa5('0x45')][_0xcaa5('0x47')]?_0x31c4ef[_0xcaa5('0x45')]:_0x3cc396[_0xcaa5('0x41')];_0x31c4ef[_0xcaa5('0x49')]=qs['sort'](_0x28efba['query'][_0xcaa5('0x4a')]);_0x31c4ef[_0xcaa5('0x4b')]=qs[_0xcaa5('0x4c')](_[_0xcaa5('0x67')](_0x28efba['query'],_0x3cc396['filters']));if(_0x28efba[_0xcaa5('0x42')][_0xcaa5('0x4f')]){_0x31c4ef[_0xcaa5('0x4b')]=_[_0xcaa5('0x4d')](_0x31c4ef[_0xcaa5('0x4b')],{'$or':_[_0xcaa5('0x3c')](_0x31c4ef['attributes'],function(_0x4a985d){var _0xed0bb4={};_0xed0bb4[_0x4a985d]={'$like':'%'+_0x28efba[_0xcaa5('0x42')][_0xcaa5('0x4f')]+'%'};return _0xed0bb4;})});}_0x31c4ef=_[_0xcaa5('0x4d')]({},_0x31c4ef,_0x28efba[_0xcaa5('0x69')]);return _0x5801b5[_0xcaa5('0xe8')](_0x31c4ef);}})[_0xcaa5('0x35')](function(_0x3533ac){if(_0x3533ac){_0x53d36f=_0x3533ac['length'];if(!_0x28efba[_0xcaa5('0x42')][_0xcaa5('0x48')](_0xcaa5('0x66'))){_0x31c4ef[_0xcaa5('0x2d')]=qs['limit'](_0x28efba['query'][_0xcaa5('0x2d')]);_0x31c4ef[_0xcaa5('0x2c')]=qs['offset'](_0x28efba[_0xcaa5('0x42')][_0xcaa5('0x2c')]);}return _0x5801b5[_0xcaa5('0xe8')](_0x31c4ef);}})['then'](function(_0x3696e7){if(_0x3696e7){return _0x3696e7?{'count':_0x53d36f,'rows':_0x3696e7}:null;}})[_0xcaa5('0x35')](respondWithResult(_0x560ab5,null))[_0xcaa5('0x28')](handleError(_0x560ab5,null));}; \ No newline at end of file +var _0xb186=['requestid','message_id','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','SmsAccounts','stack','name','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','SmsApplication','account','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','twilio','from','From','Body','messageId','MessageSid','skebby','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','\x0a','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb186,0xf2));var _0x6b18=function(_0x3bde2c,_0x3584cf){_0x3bde2c=_0x3bde2c-0x0;var _0x18abbe=_0xb186[_0x3bde2c];return _0x18abbe;};'use strict';var emlformat=require(_0x6b18('0x0'));var rimraf=require(_0x6b18('0x1'));var zipdir=require(_0x6b18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b18('0x3'));var moment=require(_0x6b18('0x4'));var BPromise=require(_0x6b18('0x5'));var Mustache=require(_0x6b18('0x6'));var util=require(_0x6b18('0x7'));var path=require('path');var sox=require(_0x6b18('0x8'));var csv=require(_0x6b18('0x9'));var ejs=require(_0x6b18('0xa'));var fs=require('fs');var fs_extra=require(_0x6b18('0xb'));var _=require(_0x6b18('0xc'));var squel=require(_0x6b18('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b18('0xe'));var deskjs=require(_0x6b18('0xf'));var toCsv=require(_0x6b18('0x9'));var querystring=require('querystring');var Papa=require(_0x6b18('0x10'));var Redis=require(_0x6b18('0x11'));var authService=require(_0x6b18('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b18('0x13'));var logger=require('../../config/logger')(_0x6b18('0x14'));var utils=require(_0x6b18('0x15'));var config=require(_0x6b18('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b18('0x17'))['db'];config[_0x6b18('0x18')]=_[_0x6b18('0x19')](config['redis'],{'host':_0x6b18('0x1a'),'port':0x18eb});var socket=require(_0x6b18('0x1b'))(new Redis(config[_0x6b18('0x18')]));require('./smsAccount.socket')[_0x6b18('0x1c')](socket);var jayson=require(_0x6b18('0x1d'));var client=jayson[_0x6b18('0x1e')][_0x6b18('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0xb01fb6,_0xff0f37,_0x4d1009,_0x4c8fa3){return new BPromise(function(_0xb49aeb,_0x4da450){var _0xf0667d=_0x4c8fa3||client;return _0xf0667d['request'](_0xb01fb6,_0x4d1009)[_0x6b18('0x20')](function(_0x5e466b){logger[_0x6b18('0x21')](_0x6b18('0x22'),_0xff0f37,_0x6b18('0x23'));logger[_0x6b18('0x24')](_0x6b18('0x25'),_0xff0f37,_0x6b18('0x23'),JSON[_0x6b18('0x26')](_0x5e466b));if(_0x5e466b['error']){if(_0x5e466b[_0x6b18('0x27')][_0x6b18('0x28')]===0x1f4){logger[_0x6b18('0x27')](_0x6b18('0x22'),_0xff0f37,_0x5e466b[_0x6b18('0x27')][_0x6b18('0x29')]);return _0x4da450(_0x5e466b[_0x6b18('0x27')]['message']);}logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s',_0xff0f37,_0x5e466b[_0x6b18('0x27')][_0x6b18('0x29')]);return _0xb49aeb(_0x5e466b['error'][_0x6b18('0x29')]);}else{logger[_0x6b18('0x21')](_0x6b18('0x22'),_0xff0f37,_0x6b18('0x23'));_0xb49aeb(_0x5e466b['result'][_0x6b18('0x29')]);}})[_0x6b18('0x2a')](function(_0x29ec9c){logger[_0x6b18('0x27')](_0x6b18('0x22'),_0xff0f37,_0x29ec9c);_0x4da450(_0x29ec9c);});});}function respondWithStatusCode(_0xef8852,_0x45d056){_0x45d056=_0x45d056||0xcc;return function(_0x4170ce){if(_0x4170ce){return _0xef8852[_0x6b18('0x2b')](_0x45d056);}return _0xef8852[_0x6b18('0x2c')](_0x45d056)[_0x6b18('0x2d')]();};}function respondWithResult(_0x2848b8,_0x11c295){_0x11c295=_0x11c295||0xc8;return function(_0x1b6a84){if(_0x1b6a84){return _0x2848b8[_0x6b18('0x2c')](_0x11c295)[_0x6b18('0x2e')](_0x1b6a84);}};}function respondWithFilteredResult(_0x356b56,_0x504c50){return function(_0x46d753){if(_0x46d753){var _0x13603f=typeof _0x504c50[_0x6b18('0x2f')]===_0x6b18('0x30')&&typeof _0x504c50[_0x6b18('0x31')]===_0x6b18('0x30');var _0xbeef9d=_0x46d753['count'];var _0x33928c=_0x13603f?0x0:_0x504c50[_0x6b18('0x2f')];var _0x144405=_0x13603f?_0x46d753[_0x6b18('0x32')]:_0x504c50['offset']+_0x504c50[_0x6b18('0x31')];var _0x5fd431;if(_0x144405>=_0xbeef9d){_0x144405=_0xbeef9d;_0x5fd431=0xc8;}else{_0x5fd431=0xce;}_0x356b56['status'](_0x5fd431);return _0x356b56[_0x6b18('0x33')](_0x6b18('0x34'),_0x33928c+'-'+_0x144405+'/'+_0xbeef9d)[_0x6b18('0x2e')](_0x46d753);}return null;};}function patchUpdates(_0x73ea34){return function(_0x5109de){try{jsonpatch['apply'](_0x5109de,_0x73ea34,!![]);}catch(_0x220d85){return BPromise[_0x6b18('0x35')](_0x220d85);}return _0x5109de[_0x6b18('0x36')]();};}function saveUpdates(_0x1ae72d,_0x9faa15){return function(_0x3e893b){if(_0x3e893b){return _0x3e893b[_0x6b18('0x37')](_0x1ae72d)[_0x6b18('0x20')](function(_0x356e70){return _0x356e70;});}return null;};}function removeEntity(_0x8fe328,_0x48ea34){return function(_0x380d77){if(_0x380d77){return _0x380d77[_0x6b18('0x38')]()[_0x6b18('0x20')](function(){var _0xd14865=_0x380d77[_0x6b18('0x39')]({'plain':!![]});var _0x5aafc7=_0x6b18('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5aafc7,'resourceId':_0xd14865['id']}})[_0x6b18('0x20')](function(){return _0x380d77;});})[_0x6b18('0x20')](function(){_0x8fe328[_0x6b18('0x2c')](0xcc)[_0x6b18('0x2d')]();});}};}function handleEntityNotFound(_0x101dd6,_0x25611a){return function(_0x430c9d){if(!_0x430c9d){_0x101dd6[_0x6b18('0x2b')](0x194);}return _0x430c9d;};}function handleError(_0x5da0e3,_0x5034d0){_0x5034d0=_0x5034d0||0x1f4;return function(_0x12733b){logger[_0x6b18('0x27')](_0x12733b[_0x6b18('0x3b')]);if(_0x12733b[_0x6b18('0x3c')]){delete _0x12733b['name'];}_0x5da0e3[_0x6b18('0x2c')](_0x5034d0)['send'](_0x12733b);};}exports[_0x6b18('0x3d')]=function(_0xe99579,_0x16b805){var _0x5bafc3={'include':[{'model':db[_0x6b18('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3a99d2={},_0x15ace7={'count':0x0,'rows':[]};var _0x38065d=_[_0x6b18('0x3f')](db[_0x6b18('0x40')][_0x6b18('0x41')],function(_0x180e19){return{'name':_0x180e19[_0x6b18('0x42')],'type':_0x180e19[_0x6b18('0x43')][_0x6b18('0x44')]};});_0x3a99d2['model']=_[_0x6b18('0x3f')](_0x38065d,'name');_0x3a99d2[_0x6b18('0x45')]=_[_0x6b18('0x46')](_0xe99579['query']);_0x3a99d2['filters']=_[_0x6b18('0x47')](_0x3a99d2['model'],_0x3a99d2['query']);_0x5bafc3['attributes']=_['intersection'](_0x3a99d2[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0xe99579[_0x6b18('0x45')][_0x6b18('0x49')]));_0x5bafc3[_0x6b18('0x4a')]=_0x5bafc3[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0x5bafc3['attributes']:_0x3a99d2[_0x6b18('0x48')];if(!_0xe99579[_0x6b18('0x45')]['hasOwnProperty'](_0x6b18('0x4c'))){_0x5bafc3[_0x6b18('0x31')]=qs[_0x6b18('0x31')](_0xe99579[_0x6b18('0x45')]['limit']);_0x5bafc3[_0x6b18('0x2f')]=qs[_0x6b18('0x2f')](_0xe99579['query'][_0x6b18('0x2f')]);}_0x5bafc3[_0x6b18('0x4d')]=qs[_0x6b18('0x4e')](_0xe99579[_0x6b18('0x45')]['sort']);_0x5bafc3[_0x6b18('0x4f')]=qs[_0x6b18('0x50')](_[_0x6b18('0x51')](_0xe99579[_0x6b18('0x45')],_0x3a99d2[_0x6b18('0x50')]),_0x38065d);if(_0xe99579[_0x6b18('0x45')]['filter']){_0x5bafc3[_0x6b18('0x4f')]=_['merge'](_0x5bafc3[_0x6b18('0x4f')],{'$or':_[_0x6b18('0x3f')](_0x38065d,function(_0x3fe741){if(_0x3fe741['type']!==_0x6b18('0x52')){var _0x1b09bc={};_0x1b09bc[_0x3fe741[_0x6b18('0x3c')]]={'$like':'%'+_0xe99579['query'][_0x6b18('0x53')]+'%'};return _0x1b09bc;}})});}_0x5bafc3=_['merge']({},_0x5bafc3,_0xe99579[_0x6b18('0x54')]);var _0xc11831={'where':_0x5bafc3[_0x6b18('0x4f')]};return db[_0x6b18('0x40')][_0x6b18('0x32')](_0xc11831)[_0x6b18('0x20')](function(_0x3a40be){_0x15ace7[_0x6b18('0x32')]=_0x3a40be;if(_0xe99579[_0x6b18('0x45')][_0x6b18('0x55')]){_0x5bafc3[_0x6b18('0x56')]=[{'all':!![]}];}return db[_0x6b18('0x40')][_0x6b18('0x57')](_0x5bafc3);})[_0x6b18('0x20')](function(_0x4f49ae){_0x15ace7[_0x6b18('0x58')]=_0x4f49ae;return _0x15ace7;})['then'](respondWithFilteredResult(_0x16b805,_0x5bafc3))[_0x6b18('0x2a')](handleError(_0x16b805,null));};exports[_0x6b18('0x59')]=function(_0x4a9c20,_0xef26dd){var _0x452f55={'raw':![],'where':{'id':_0x4a9c20['params']['id']},'include':[{'model':db[_0x6b18('0x3e')],'as':_0x6b18('0x5a')}]},_0x409416={};_0x409416[_0x6b18('0x48')]=_[_0x6b18('0x46')](db[_0x6b18('0x40')][_0x6b18('0x41')]);_0x409416['query']=_[_0x6b18('0x46')](_0x4a9c20[_0x6b18('0x45')]);_0x409416[_0x6b18('0x50')]=_['intersection'](_0x409416['model'],_0x409416[_0x6b18('0x45')]);_0x452f55[_0x6b18('0x4a')]=_[_0x6b18('0x47')](_0x409416[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0x4a9c20[_0x6b18('0x45')][_0x6b18('0x49')]));_0x452f55[_0x6b18('0x4a')]=_0x452f55[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0x452f55['attributes']:_0x409416[_0x6b18('0x48')];if(_0x4a9c20['query'][_0x6b18('0x55')]){_0x452f55[_0x6b18('0x56')]=[{'all':!![]}];}_0x452f55=_[_0x6b18('0x5b')]({},_0x452f55,_0x4a9c20['options']);return db['SmsAccount']['find'](_0x452f55)[_0x6b18('0x20')](handleEntityNotFound(_0xef26dd,null))[_0x6b18('0x20')](respondWithResult(_0xef26dd,null))[_0x6b18('0x2a')](handleError(_0xef26dd,null));};exports[_0x6b18('0x5c')]=function(_0x2a1107,_0x4fc034){return db[_0x6b18('0x40')][_0x6b18('0x5c')](_0x2a1107[_0x6b18('0x5d')],{})[_0x6b18('0x20')](function(_0x9c465e){var _0x1f78f9=_0x2a1107[_0x6b18('0x5e')][_0x6b18('0x39')]({'plain':!![]});if(!_0x1f78f9)throw new Error(_0x6b18('0x5f'));if(_0x1f78f9['role']===_0x6b18('0x5e')){var _0x4860c5=_0x9c465e[_0x6b18('0x39')]({'plain':!![]});var _0x5b87ab=_0x6b18('0x3a');return db[_0x6b18('0x60')][_0x6b18('0x61')]({'where':{'name':_0x5b87ab,'userProfileId':_0x1f78f9[_0x6b18('0x62')]},'raw':!![]})['then'](function(_0x388c07){if(_0x388c07&&_0x388c07['autoAssociation']===0x0){return db['UserProfileResource'][_0x6b18('0x5c')]({'name':_0x4860c5['name'],'resourceId':_0x4860c5['id'],'type':_0x388c07[_0x6b18('0x3c')],'sectionId':_0x388c07['id']},{})[_0x6b18('0x20')](function(){return _0x9c465e;});}else{return _0x9c465e;}})[_0x6b18('0x2a')](function(_0x3ac27b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ac27b);throw _0x3ac27b;});}return _0x9c465e;})[_0x6b18('0x20')](respondWithResult(_0x4fc034,0xc9))[_0x6b18('0x2a')](handleError(_0x4fc034,null));};exports['update']=function(_0x131c58,_0x4095a7){if(_0x131c58[_0x6b18('0x5d')]['id']){delete _0x131c58[_0x6b18('0x5d')]['id'];}return db[_0x6b18('0x40')][_0x6b18('0x61')]({'where':{'id':_0x131c58[_0x6b18('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x6b18('0x5a')}]})[_0x6b18('0x20')](handleEntityNotFound(_0x4095a7,null))[_0x6b18('0x20')](saveUpdates(_0x131c58['body'],null))[_0x6b18('0x20')](respondWithResult(_0x4095a7,null))[_0x6b18('0x2a')](handleError(_0x4095a7,null));};exports[_0x6b18('0x38')]=function(_0x563521,_0x370d2c){return db[_0x6b18('0x40')][_0x6b18('0x61')]({'where':{'id':_0x563521['params']['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x370d2c,null))[_0x6b18('0x20')](removeEntity(_0x370d2c,null))['catch'](handleError(_0x370d2c,null));};exports[_0x6b18('0x64')]=function(_0x3fced0,_0x242534){return db[_0x6b18('0x40')][_0x6b18('0x64')]()[_0x6b18('0x20')](respondWithResult(_0x242534,null))[_0x6b18('0x2a')](handleError(_0x242534,null));};exports[_0x6b18('0x65')]=function(_0x9da53b,_0x4c22af,_0x33d1c3){if(_0x9da53b[_0x6b18('0x5d')]['id']){delete _0x9da53b['body']['id'];}return db['SmsAccount'][_0x6b18('0x61')]({'where':{'id':_0x9da53b['params']['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x4c22af,null))[_0x6b18('0x20')](function(_0x417286){if(_0x417286){_0x9da53b['body'][_0x6b18('0x66')]=_0x417286['id'];return db[_0x6b18('0x67')][_0x6b18('0x5c')](_0x9da53b[_0x6b18('0x5d')]);}})[_0x6b18('0x20')](respondWithResult(_0x4c22af,null))[_0x6b18('0x2a')](handleError(_0x4c22af,null));};exports[_0x6b18('0x68')]=function(_0x48f103,_0x1e49b8,_0x4ce385){var _0x387fdd={'raw':![],'where':{}};var _0x23d7b9={};var _0x9c7b7d={'count':0x0,'rows':[]};return db[_0x6b18('0x40')][_0x6b18('0x69')]({'where':{'id':_0x48f103[_0x6b18('0x63')]['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x1e49b8,null))[_0x6b18('0x20')](function(_0x20736c){if(_0x20736c){_0x23d7b9[_0x6b18('0x48')]=_[_0x6b18('0x46')](db[_0x6b18('0x67')]['rawAttributes']);_0x23d7b9['query']=_[_0x6b18('0x46')](_0x48f103[_0x6b18('0x45')]);_0x23d7b9[_0x6b18('0x50')]=_['intersection'](_0x23d7b9['model'],_0x23d7b9[_0x6b18('0x45')]);_0x387fdd['attributes']=_['intersection'](_0x23d7b9['model'],qs[_0x6b18('0x49')](_0x48f103[_0x6b18('0x45')][_0x6b18('0x49')]));_0x387fdd['attributes']=_0x387fdd[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0x387fdd['attributes']:_0x23d7b9[_0x6b18('0x48')];if(!_0x48f103[_0x6b18('0x45')][_0x6b18('0x6a')](_0x6b18('0x4c'))){_0x387fdd['limit']=qs[_0x6b18('0x31')](_0x48f103[_0x6b18('0x45')]['limit']);_0x387fdd['offset']=qs[_0x6b18('0x2f')](_0x48f103[_0x6b18('0x45')]['offset']);}_0x387fdd[_0x6b18('0x4d')]=qs[_0x6b18('0x4e')](_0x48f103[_0x6b18('0x45')][_0x6b18('0x4e')]);_0x387fdd['where']=qs[_0x6b18('0x50')](_[_0x6b18('0x51')](_0x48f103[_0x6b18('0x45')],_0x23d7b9[_0x6b18('0x50')]));_0x387fdd['where'][_0x6b18('0x66')]=_0x20736c['id'];if(_0x48f103[_0x6b18('0x45')]['filter']){_0x387fdd['where']=_[_0x6b18('0x5b')](_0x387fdd[_0x6b18('0x4f')],{'$or':_[_0x6b18('0x3f')](_0x387fdd[_0x6b18('0x4a')],function(_0x3969c1){var _0xba234a={};_0xba234a[_0x3969c1]={'$like':'%'+_0x48f103[_0x6b18('0x45')][_0x6b18('0x53')]+'%'};return _0xba234a;})});}_0x387fdd=_[_0x6b18('0x5b')]({},_0x387fdd,_0x48f103[_0x6b18('0x54')]);return db[_0x6b18('0x67')][_0x6b18('0x32')]({'where':_0x387fdd[_0x6b18('0x4f')]})[_0x6b18('0x20')](function(_0x194497){_0x9c7b7d[_0x6b18('0x32')]=_0x194497;if(_0x48f103['query'][_0x6b18('0x55')]){_0x387fdd['include']=[{'all':!![]}];}return db[_0x6b18('0x67')]['findAll'](_0x387fdd);})['then'](function(_0x3a6e2a){_0x9c7b7d[_0x6b18('0x58')]=_0x3a6e2a;return _0x9c7b7d;});}})[_0x6b18('0x20')](respondWithFilteredResult(_0x1e49b8,_0x387fdd))['catch'](handleError(_0x1e49b8,null));};exports[_0x6b18('0x6b')]=function(_0x39a2b9,_0x45c400,_0x3110c5){return db['SmsAccount'][_0x6b18('0x61')]({'where':{'id':_0x39a2b9['params']['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x45c400,null))[_0x6b18('0x20')](function(_0x353605){if(_0x353605){return _0x353605[_0x6b18('0x6b')](_0x39a2b9[_0x6b18('0x45')][_0x6b18('0x6c')]);}})['then'](respondWithStatusCode(_0x45c400,null))[_0x6b18('0x2a')](handleError(_0x45c400,null));};exports['addAnswer']=function(_0x7191b4,_0x18b7d8,_0x38a088){if(_0x7191b4[_0x6b18('0x5d')]['id']){delete _0x7191b4[_0x6b18('0x5d')]['id'];}return db[_0x6b18('0x40')][_0x6b18('0x61')]({'where':{'id':_0x7191b4[_0x6b18('0x63')]['id']}})['then'](handleEntityNotFound(_0x18b7d8,null))[_0x6b18('0x20')](function(_0x363e5e){if(_0x363e5e){_0x7191b4['body'][_0x6b18('0x66')]=_0x363e5e['id'];return db[_0x6b18('0x6d')][_0x6b18('0x5c')](_0x7191b4[_0x6b18('0x5d')]);}})[_0x6b18('0x20')](respondWithResult(_0x18b7d8,null))['catch'](handleError(_0x18b7d8,null));};exports[_0x6b18('0x6e')]=function(_0x4267e6,_0x5490ae,_0x279b88){var _0xfc3565={'raw':![],'where':{}};var _0x40f02a={};var _0x1d37a4={'count':0x0,'rows':[]};return db[_0x6b18('0x40')][_0x6b18('0x69')]({'where':{'id':_0x4267e6[_0x6b18('0x63')]['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x5490ae,null))[_0x6b18('0x20')](function(_0x26082f){if(_0x26082f){_0x40f02a['model']=_[_0x6b18('0x46')](db['CannedAnswer'][_0x6b18('0x41')]);_0x40f02a[_0x6b18('0x45')]=_[_0x6b18('0x46')](_0x4267e6[_0x6b18('0x45')]);_0x40f02a[_0x6b18('0x50')]=_[_0x6b18('0x47')](_0x40f02a[_0x6b18('0x48')],_0x40f02a[_0x6b18('0x45')]);_0xfc3565['attributes']=_['intersection'](_0x40f02a[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0x4267e6[_0x6b18('0x45')][_0x6b18('0x49')]));_0xfc3565['attributes']=_0xfc3565[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0xfc3565[_0x6b18('0x4a')]:_0x40f02a[_0x6b18('0x48')];if(!_0x4267e6[_0x6b18('0x45')][_0x6b18('0x6a')](_0x6b18('0x4c'))){_0xfc3565[_0x6b18('0x31')]=qs[_0x6b18('0x31')](_0x4267e6[_0x6b18('0x45')][_0x6b18('0x31')]);_0xfc3565[_0x6b18('0x2f')]=qs[_0x6b18('0x2f')](_0x4267e6['query'][_0x6b18('0x2f')]);}_0xfc3565[_0x6b18('0x4d')]=qs['sort'](_0x4267e6['query']['sort']);_0xfc3565[_0x6b18('0x4f')]=qs[_0x6b18('0x50')](_['pick'](_0x4267e6[_0x6b18('0x45')],_0x40f02a[_0x6b18('0x50')]));_0xfc3565[_0x6b18('0x4f')]['SmsAccountId']=_0x26082f['id'];if(_0x4267e6[_0x6b18('0x45')][_0x6b18('0x53')]){_0xfc3565[_0x6b18('0x4f')]=_['merge'](_0xfc3565[_0x6b18('0x4f')],{'$or':_[_0x6b18('0x3f')](_0xfc3565[_0x6b18('0x4a')],function(_0x5ddb4b){var _0x31323a={};_0x31323a[_0x5ddb4b]={'$like':'%'+_0x4267e6[_0x6b18('0x45')]['filter']+'%'};return _0x31323a;})});}_0xfc3565=_[_0x6b18('0x5b')]({},_0xfc3565,_0x4267e6[_0x6b18('0x54')]);return db[_0x6b18('0x6d')]['count']({'where':_0xfc3565[_0x6b18('0x4f')]})[_0x6b18('0x20')](function(_0x5d366e){_0x1d37a4[_0x6b18('0x32')]=_0x5d366e;if(_0x4267e6['query'][_0x6b18('0x55')]){_0xfc3565['include']=[{'all':!![]}];}return db[_0x6b18('0x6d')][_0x6b18('0x57')](_0xfc3565);})[_0x6b18('0x20')](function(_0x449280){_0x1d37a4[_0x6b18('0x58')]=_0x449280;return _0x1d37a4;});}})[_0x6b18('0x20')](respondWithFilteredResult(_0x5490ae,_0xfc3565))[_0x6b18('0x2a')](handleError(_0x5490ae,null));};exports[_0x6b18('0x6f')]=function(_0x47cecd,_0x431206,_0x4ea8ee){return db[_0x6b18('0x40')]['find']({'where':{'id':_0x47cecd['params']['id']}})['then'](handleEntityNotFound(_0x431206,null))[_0x6b18('0x20')](function(_0x27683a){if(_0x27683a){return _0x27683a['removeAnswers'](_0x47cecd[_0x6b18('0x45')][_0x6b18('0x6c')]);}})[_0x6b18('0x20')](respondWithStatusCode(_0x431206,null))[_0x6b18('0x2a')](handleError(_0x431206,null));};exports['notify']=function(_0x237039,_0x758250,_0x59a878){var _0xc10ed1={'channel':'sms'};var _0x4a5c4c=[];var _0x39ca0f=[];var _0x5edbe5={};return db['SmsAccount'][_0x6b18('0x61')]({'where':{'id':_0x237039[_0x6b18('0x63')]['id']},'include':[{'model':db[_0x6b18('0x70')],'as':'Applications'}]})[_0x6b18('0x20')](handleEntityNotFound(_0x758250,null))[_0x6b18('0x20')](function(_0x3c5f6a){_0xc10ed1[_0x6b18('0x71')]=_0x3c5f6a;_0xc10ed1['applications']=_['orderBy'](_0x3c5f6a[_0x6b18('0x72')],[_0x6b18('0x73')],[_0x6b18('0x74')]);if(_0xc10ed1['account']['Applications']){delete _0xc10ed1[_0x6b18('0x71')][_0x6b18('0x72')];}return db[_0x6b18('0x75')][_0x6b18('0x64')]();})[_0x6b18('0x20')](function(_0x32adc8){if(!_0x32adc8){throw new db[(_0x6b18('0x76'))][(_0x6b18('0x77'))](_0x6b18('0x78'));}_0x4a5c4c=_[_0x6b18('0x79')](_[_0x6b18('0x46')](_0x32adc8),[_0x6b18('0x7a'),_0x6b18('0x7b')]);_0x39ca0f=_[_0x6b18('0x79')](_['keys'](_0x32adc8),[_0x6b18('0x7a'),'updatedAt','CompanyId','ListId']);_0xc10ed1[_0x6b18('0x5d')]={'mapKey':'mobile'};if(_0xc10ed1[_0x6b18('0x71')]['type']){switch(_0xc10ed1['account'][_0x6b18('0x43')]){case _0x6b18('0x7c'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x7e')];_0xc10ed1[_0x6b18('0x5d')]['body']=_0x237039[_0x6b18('0x5d')][_0x6b18('0x7f')];_0xc10ed1['body'][_0x6b18('0x80')]=_0x237039['body'][_0x6b18('0x81')];break;case _0x6b18('0x82'):_0xc10ed1[_0x6b18('0x5d')]['from']='+'+_0x237039[_0x6b18('0x5d')]['sender'];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')]=_0x237039['body'][_0x6b18('0x83')];break;case _0x6b18('0x84'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039['body'][_0x6b18('0x7d')];_0xc10ed1['body'][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x29')];break;case _0x6b18('0x85'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039['body'][_0x6b18('0x7d')];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x5d')];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x80')]=_0x237039[_0x6b18('0x5d')]['message_id'];break;case _0x6b18('0x86'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x7e')];_0xc10ed1['body'][_0x6b18('0x5d')]=_0x237039['body'][_0x6b18('0x87')];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x80')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x88')];break;case _0x6b18('0x89'):_0xc10ed1['body'][_0x6b18('0x7d')]='+'+_0x237039[_0x6b18('0x5d')]['results'][0x0]['from'];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x8a')][0x0][_0x6b18('0x83')];_0xc10ed1['body'][_0x6b18('0x80')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x8a')][0x0][_0x6b18('0x80')];break;case _0x6b18('0x8b'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039['body'][_0x6b18('0x8c')];_0xc10ed1['body'][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x8d')][_0x6b18('0x29')];break;case _0x6b18('0x8e'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039['body']['fromNumber'];_0xc10ed1['body'][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x83')];_0xc10ed1[_0x6b18('0x5d')]['messageId']=_0x237039['body'][_0x6b18('0x8f')];break;case _0x6b18('0x90'):_0xc10ed1[_0x6b18('0x5d')]['messageId']=_0x237039['body'][0x0][_0x6b18('0x29')]['id'];_0xc10ed1[_0x6b18('0x5d')]['from']=_0x237039[_0x6b18('0x5d')][0x0]['message'][_0x6b18('0x7d')];_0xc10ed1[_0x6b18('0x5d')]['body']=_0x237039['body'][0x0]['message']['text'];break;case _0x6b18('0x91'):_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')]=_0x237039[_0x6b18('0x5d')]['from'];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')]=_0x237039[_0x6b18('0x5d')][_0x6b18('0x29')];_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x80')]=_0x237039[_0x6b18('0x5d')]['refid'];break;}}if(_0xc10ed1[_0x6b18('0x5d')]['id']){delete _0xc10ed1[_0x6b18('0x5d')]['id'];}if(_[_0x6b18('0x92')](_0xc10ed1['body'][_0x6b18('0x7d')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x6b18('0x92')](_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')])||_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')]===''){throw new db[(_0x6b18('0x76'))][(_0x6b18('0x77'))](_0x6b18('0x93'));}if(_[_0x6b18('0x92')](_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x94')])){throw new db['Sequelize'][(_0x6b18('0x77'))](_0x6b18('0x95')+_0x39ca0f);}if(!_[_0x6b18('0x96')](_0x39ca0f,_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x94')])){throw new db[(_0x6b18('0x76'))]['ValidationError'](_0x6b18('0x97')+_0x39ca0f);}_0x5edbe5[_0xc10ed1[_0x6b18('0x5d')]['mapKey']]=_0xc10ed1[_0x6b18('0x5d')]['from'];return db[_0x6b18('0x98')][_0x6b18('0x61')]({'where':{'id':_0xc10ed1[_0x6b18('0x71')][_0x6b18('0x99')]},'include':[{'model':db['CmContact'],'as':_0x6b18('0x9a'),'where':_0x5edbe5,'limit':0x1,'order':[['updatedAt',_0x6b18('0x9b')]]}]});})[_0x6b18('0x20')](handleEntityNotFound(_0x758250,null))[_0x6b18('0x20')](function(_0x25a5b8){if(_0x25a5b8){_0xc10ed1['list']=_[_0x6b18('0x9c')](_0x25a5b8,['Contacts']);if(_0x25a5b8[_0x6b18('0x9a')][_0x6b18('0x4b')]){return _0x25a5b8['Contacts'][0x0];}var _0x3006bd=_[_0x6b18('0x19')](_0xc10ed1[_0x6b18('0x5d')],{'firstName':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')],'ListId':_0x25a5b8['id']});_0x3006bd[_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x94')]]=_0xc10ed1[_0x6b18('0x5d')]['from'];return db['CmContact'][_0x6b18('0x5c')](_0x3006bd,{'fields':_0x4a5c4c,'raw':!![]});}})[_0x6b18('0x20')](handleEntityNotFound(_0x758250,null))[_0x6b18('0x20')](function(_0x342229){if(_0x342229){_0xc10ed1[_0x6b18('0x9d')]=_0x342229;var _0x18b569={'ContactId':_0x342229['id'],'phone':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')],'SmsAccountId':_0x237039[_0x6b18('0x63')]['id']};var _0x2b2f61={'ContactId':_0x342229['id'],'SmsAccountId':_0x237039['params']['id'],'closed':![]};return db[_0x6b18('0x9e')]['find']({'where':_0x2b2f61})[_0x6b18('0x20')](function(_0x420d2b){if(_0x420d2b){return[_0x420d2b,![]];}return db['SmsInteraction']['create'](_0x18b569)[_0x6b18('0x20')](function(_0x4c889d){return[_0x4c889d,!![]];});});}})[_0x6b18('0x9f')](function(_0x21bbd7,_0x30cef5){_0xc10ed1[_0x6b18('0xa0')]=_0x21bbd7[_0x6b18('0x39')]({'plain':!![]});_0xc10ed1[_0x6b18('0xa0')][_0x6b18('0xa1')]=![];if(_0x30cef5){if(_0xc10ed1[_0x6b18('0x71')][_0x6b18('0xa2')]){_0xc10ed1[_0x6b18('0xa3')][_0x6b18('0xa4')]({'id':0x0,'priority':_0xc10ed1[_0x6b18('0xa3')][_0x6b18('0x4b')]+0x1,'app':_0x6b18('0xa5'),'appdata':_0x6b18('0xa6'),'interval':_0x6b18('0xa7')});}_0xc10ed1['interaction']['created']=!![];}return db[_0x6b18('0xa8')]['create']({'phone':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x7d')],'messageId':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x80')],'body':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0x5d')],'SmsAccountId':_0x237039[_0x6b18('0x63')]['id'],'SmsInteractionId':_0x21bbd7['id'],'direction':'in','ContactId':_0x21bbd7['ContactId'],'AttachmentId':_0xc10ed1[_0x6b18('0x5d')][_0x6b18('0xa9')]});})[_0x6b18('0x20')](function(_0x576af0){_0xc10ed1['message']=_0x576af0;if(_0xc10ed1[_0x6b18('0xa0')][_0x6b18('0xaa')]){return db[_0x6b18('0xab')][_0x6b18('0x61')]({'attributes':['id','name'],'where':{'id':_0xc10ed1[_0x6b18('0xa0')][_0x6b18('0xaa')]}})[_0x6b18('0x20')](function(_0x2e7351){if(_0x2e7351){_0xc10ed1['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6b18('0xac'),'appdata':_0x2e7351[_0x6b18('0x3c')]+','+(_0xc10ed1[_0x6b18('0x71')][_0x6b18('0xad')]||0xa),'interval':_0x6b18('0xa7')});}return respondWithRpcPromise(_0x6b18('0xae'),_0x6b18('0xaf'),_0xc10ed1);});}return respondWithRpcPromise(_0x6b18('0xae'),_0x6b18('0xaf'),_0xc10ed1);})[_0x6b18('0x20')](function(_0x55694e){if(_0x55694e){var _0x20409d=0xc8;var _0x8a338e=_0x6b18('0xb0');logger['info'](_0x6b18('0x25'),_0x8a338e,_0x20409d,_0x6b18('0xb1'));logger[_0x6b18('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x8a338e,_0x20409d,'entity\x20found',JSON[_0x6b18('0x26')](_0x55694e));if(_0xc10ed1[_0x6b18('0x71')][_0x6b18('0x43')]===_0x6b18('0x7c')){return _0x758250['status'](_0x20409d)[_0x6b18('0x33')](_0x6b18('0xb2'),_0x6b18('0xb3'))['send'](_0x6b18('0xb4'));}else{return _0x758250[_0x6b18('0x2c')](_0x20409d)[_0x6b18('0x2e')](_0x55694e);}}})[_0x6b18('0x2a')](handleError(_0x758250,null));};exports['addApplications']=function(_0x2175c1,_0x5a8b25){var _0x140d59=_0x2175c1[_0x6b18('0x63')]['id'];var _0x407a12=_0x2175c1[_0x6b18('0x5d')];var _0x3a1d82=0xc8;var _0x16de27=null;return db['sequelize'][_0x6b18('0xb5')]({'isolationLevel':db[_0x6b18('0xb6')][_0x6b18('0xb7')][_0x6b18('0xb8')][_0x6b18('0xb9')]},function(_0x20d39c){return db[_0x6b18('0x40')][_0x6b18('0x69')]({'where':{'id':_0x140d59},'transaction':_0x20d39c})[_0x6b18('0x20')](function(_0x3afd42){if(_0x3afd42){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x140d59},'transaction':_0x20d39c})[_0x6b18('0x20')](function(){var _0x5c181f=_[_0x6b18('0x3f')](_0x407a12,function(_0x39c97b){_0x39c97b[_0x6b18('0x66')]=_0x140d59;return _0x39c97b;});return db[_0x6b18('0x70')][_0x6b18('0xba')](_0x5c181f,{'transaction':_0x20d39c});});}else{_0x3a1d82=0x194;_0x16de27=[];}});})[_0x6b18('0x20')](function(){if(_0x3a1d82!==0x194){return db[_0x6b18('0x70')][_0x6b18('0xbb')]({'where':{'SmsAccountId':_0x140d59},'order':_0x6b18('0x73')})[_0x6b18('0x20')](function(_0x22fc15){_0x16de27=_0x22fc15;});}})[_0x6b18('0x2a')](function(_0x1053be){_0x3a1d82=0x1f4;logger[_0x6b18('0x27')](_0x1053be['stack']);if(_0x1053be[_0x6b18('0x3c')]){delete _0x1053be[_0x6b18('0x3c')];}_0x16de27=_0x1053be;})[_0x6b18('0xbc')](function(){if(_0x16de27===null){_0x5a8b25[_0x6b18('0x2b')](_0x3a1d82);}else{if(_0x3a1d82===0x1f4){_0x5a8b25[_0x6b18('0x2c')](_0x3a1d82)[_0x6b18('0xbd')](_0x16de27);}else{_0x5a8b25['status'](_0x3a1d82)[_0x6b18('0x2e')](_0x16de27);}}});};exports[_0x6b18('0xbe')]=function(_0x29d8f2,_0x36b1df,_0x36ee9b){var _0x1cf10f={};var _0x328076={};var _0x5ecfac;var _0x552e00;return db[_0x6b18('0x40')][_0x6b18('0x69')]({'where':{'id':_0x29d8f2['params']['id']}})['then'](handleEntityNotFound(_0x36b1df,null))['then'](function(_0x4025a5){if(_0x4025a5){_0x5ecfac=_0x4025a5;_0x328076[_0x6b18('0x48')]=_[_0x6b18('0x46')](db[_0x6b18('0x70')][_0x6b18('0x41')]);_0x328076[_0x6b18('0x45')]=_[_0x6b18('0x46')](_0x29d8f2['query']);_0x328076['filters']=_[_0x6b18('0x47')](_0x328076[_0x6b18('0x48')],_0x328076[_0x6b18('0x45')]);_0x1cf10f[_0x6b18('0x4a')]=_[_0x6b18('0x47')](_0x328076[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0x29d8f2['query']['fields']));_0x1cf10f[_0x6b18('0x4a')]=_0x1cf10f[_0x6b18('0x4a')]['length']?_0x1cf10f[_0x6b18('0x4a')]:_0x328076[_0x6b18('0x48')];_0x1cf10f[_0x6b18('0x4d')]=qs[_0x6b18('0x4e')](_0x29d8f2[_0x6b18('0x45')][_0x6b18('0x4e')]);_0x1cf10f[_0x6b18('0x4f')]=qs[_0x6b18('0x50')](_['pick'](_0x29d8f2['query'],_0x328076[_0x6b18('0x50')]));if(_0x29d8f2[_0x6b18('0x45')][_0x6b18('0x53')]){_0x1cf10f['where']=_[_0x6b18('0x5b')](_0x1cf10f[_0x6b18('0x4f')],{'$or':_[_0x6b18('0x3f')](_0x1cf10f[_0x6b18('0x4a')],function(_0x236eb1){var _0xfaf2dc={};_0xfaf2dc[_0x236eb1]={'$like':'%'+_0x29d8f2[_0x6b18('0x45')][_0x6b18('0x53')]+'%'};return _0xfaf2dc;})});}_0x1cf10f=_[_0x6b18('0x5b')]({},_0x1cf10f,_0x29d8f2['options']);return _0x5ecfac['getApplications'](_0x1cf10f);}})['then'](function(_0x36fe2d){if(_0x36fe2d){_0x552e00=_0x36fe2d[_0x6b18('0x4b')];if(!_0x29d8f2['query'][_0x6b18('0x6a')](_0x6b18('0x4c'))){_0x1cf10f['limit']=qs[_0x6b18('0x31')](_0x29d8f2[_0x6b18('0x45')]['limit']);_0x1cf10f[_0x6b18('0x2f')]=qs['offset'](_0x29d8f2[_0x6b18('0x45')]['offset']);}return _0x5ecfac['getApplications'](_0x1cf10f);}})[_0x6b18('0x20')](function(_0x2fd086){if(_0x2fd086){return _0x2fd086?{'count':_0x552e00,'rows':_0x2fd086}:null;}})['then'](respondWithResult(_0x36b1df,null))[_0x6b18('0x2a')](handleError(_0x36b1df,null));};exports[_0x6b18('0xbf')]=function(_0x2c9b75,_0xb1b89f,_0x1f3c71){var _0x447e97={'raw':![],'where':{}};var _0x252a9c={};var _0x153a92={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x2c9b75[_0x6b18('0x63')]['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0xb1b89f,null))[_0x6b18('0x20')](function(_0x39f086){if(_0x39f086){_0x252a9c[_0x6b18('0x48')]=_['keys'](db[_0x6b18('0x9e')]['rawAttributes']);_0x252a9c[_0x6b18('0x45')]=_['keys'](_0x2c9b75[_0x6b18('0x45')]);_0x252a9c[_0x6b18('0x50')]=_[_0x6b18('0x47')](_0x252a9c[_0x6b18('0x48')],_0x252a9c[_0x6b18('0x45')]);_0x447e97[_0x6b18('0x4a')]=_[_0x6b18('0x47')](_0x252a9c[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x49')]));_0x447e97[_0x6b18('0x4a')]=_0x447e97[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0x447e97[_0x6b18('0x4a')]:_0x252a9c[_0x6b18('0x48')];if(!_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x6a')]('nolimit')){_0x447e97[_0x6b18('0x31')]=qs[_0x6b18('0x31')](_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x31')]);_0x447e97[_0x6b18('0x2f')]=qs[_0x6b18('0x2f')](_0x2c9b75[_0x6b18('0x45')]['offset']);}_0x447e97[_0x6b18('0x4d')]=qs[_0x6b18('0x4e')](_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x4e')]);_0x447e97[_0x6b18('0x4f')]=qs['filters'](_[_0x6b18('0x51')](_0x2c9b75[_0x6b18('0x45')],_0x252a9c[_0x6b18('0x50')]));_0x447e97[_0x6b18('0x4f')][_0x6b18('0x66')]=_0x39f086['id'];if(_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x53')]){_0x447e97[_0x6b18('0x4f')]=_[_0x6b18('0x5b')](_0x447e97[_0x6b18('0x4f')],{'$or':_['map'](_0x447e97[_0x6b18('0x4a')],function(_0x5241f8){var _0x4931e1={};_0x4931e1[_0x5241f8]={'$like':'%'+_0x2c9b75[_0x6b18('0x45')][_0x6b18('0x53')]+'%'};return _0x4931e1;})});}_0x447e97=_[_0x6b18('0x5b')]({},_0x447e97,_0x2c9b75[_0x6b18('0x54')]);return db['SmsInteraction'][_0x6b18('0x32')]({'where':_0x447e97[_0x6b18('0x4f')]})[_0x6b18('0x20')](function(_0x4361ce){_0x153a92['count']=_0x4361ce;if(_0x2c9b75[_0x6b18('0x45')]['includeAll']){_0x447e97['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x6b18('0xab')],'as':'Owner','attributes':[_0x6b18('0x3c'),_0x6b18('0xc0'),_0x6b18('0xc1')],'required':![]},{'model':db[_0x6b18('0xc2')],'as':_0x6b18('0xc3'),'attributes':['id',_0x6b18('0x3c'),_0x6b18('0xc4')],'where':_0x2c9b75['query'][_0x6b18('0xc5')]?{'id':_0x2c9b75[_0x6b18('0x45')]['tag']}:undefined,'required':_0x2c9b75[_0x6b18('0x45')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x6b18('0x57')](_0x447e97);})['then'](function(_0x46f1d5){_0x153a92[_0x6b18('0x58')]=_0x46f1d5;return _0x153a92;});}})[_0x6b18('0x20')](respondWithFilteredResult(_0xb1b89f,_0x447e97))['catch'](handleError(_0xb1b89f,null));};exports[_0x6b18('0xbd')]=function(_0x31f34b,_0x4a404e,_0x3bf9a2){var _0x15c927,_0x3736a3,_0x5d9480;if(_[_0x6b18('0x92')](_0x31f34b[_0x6b18('0x5d')][_0x6b18('0x5d')])||_0x31f34b[_0x6b18('0x5d')][_0x6b18('0x5d')]===''){throw new db[(_0x6b18('0x76'))][(_0x6b18('0x77'))](_0x6b18('0x93'));}if(_[_0x6b18('0x92')](_0x31f34b[_0x6b18('0x5d')]['to'])){throw new db[(_0x6b18('0x76'))]['ValidationError']('to\x20is\x20mandatory');}_0x15c927=_0x31f34b[_0x6b18('0x5d')]['to'];return db[_0x6b18('0x40')]['find']({'where':{'id':_0x31f34b['params']['id']},'include':[{'model':db[_0x6b18('0x98')],'as':'List','include':[{'model':db[_0x6b18('0x75')],'as':_0x6b18('0x9a'),'where':{'mobile':_0x15c927},'limit':0x1,'order':[[_0x6b18('0x7b'),_0x6b18('0x9b')]]}]}]})['then'](handleEntityNotFound(_0x4a404e,null))['then'](function(_0x10d8ca){if(_0x10d8ca&&_0x10d8ca[_0x6b18('0xc6')]){_0x3736a3=_0x10d8ca['get']({'plain':!![]});if(_0x3736a3[_0x6b18('0xc6')]&&_0x3736a3['List']['Contacts'][_0x6b18('0x4b')]){return _0x3736a3[_0x6b18('0xc6')][_0x6b18('0x9a')][0x0];}return db[_0x6b18('0x75')][_0x6b18('0x5c')](_[_0x6b18('0x19')](_0x31f34b['body'],{'firstName':_0x15c927,'mobile':_0x15c927,'phone':_0x15c927,'ListId':_0x3736a3[_0x6b18('0x99')]}));}})[_0x6b18('0x20')](handleEntityNotFound(_0x4a404e,null))[_0x6b18('0x20')](function(_0x25b469){if(_0x25b469){_0x5d9480=_0x25b469;return db[_0x6b18('0x9e')][_0x6b18('0x61')]({'where':{'ContactId':_0x5d9480['id'],'closed':![],'SmsAccountId':_0x3736a3['id']}})[_0x6b18('0x20')](function(_0x2aa63a){if(_0x2aa63a){return[_0x2aa63a,![]];}return db[_0x6b18('0x9e')][_0x6b18('0x5c')]({'UserId':_0x31f34b[_0x6b18('0x5e')]['id'],'ContactId':_0x5d9480['id'],'SmsAccountId':_0x3736a3['id'],'phone':_0x15c927,'firstMsgDirection':_0x6b18('0xc7'),'Messages':[_['merge'](_0x31f34b['body'],{'read':![],'body':_0x31f34b['body'][_0x6b18('0x5d')],'phone':_0x15c927,'SmsAccountId':_0x3736a3['id'],'UserId':_0x31f34b['user']['id'],'ContactId':_0x5d9480['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x6b18('0xc8')}]})[_0x6b18('0x20')](function(_0x35b4a0){return[_0x35b4a0,!![]];});});}})[_0x6b18('0x9f')](function(_0x389502,_0x384503){if(_0x384503){return _0x389502;}return db[_0x6b18('0xa8')][_0x6b18('0x5c')](_[_0x6b18('0x5b')](_0x31f34b['body'],{'read':![],'body':_0x31f34b[_0x6b18('0x5d')][_0x6b18('0x5d')],'phone':_0x15c927,'SmsAccountId':_0x3736a3['id'],'SmsInteractionId':_0x389502['id'],'UserId':_0x31f34b[_0x6b18('0x5e')]['id'],'ContactId':_0x5d9480['id']}))[_0x6b18('0x20')](function(_0x4a9cd8){_0x389502[_0x6b18('0xc9')]['Messages']=[];_0x389502[_0x6b18('0xc9')][_0x6b18('0xc8')][_0x6b18('0xa4')](_0x4a9cd8[_0x6b18('0xc9')]);return _0x389502;});})[_0x6b18('0x20')](respondWithResult(_0x4a404e,null))[_0x6b18('0x2a')](handleError(_0x4a404e,null));};exports[_0x6b18('0x2c')]=function(_0x18dfe6,_0x531d6a,_0x4f8846){if(_0x18dfe6[_0x6b18('0x5d')]['id']){delete _0x18dfe6['body']['id'];}var _0x3eb17f,_0x15d444,_0x192d95;return db['SmsAccount'][_0x6b18('0x61')]({'where':{'id':_0x18dfe6[_0x6b18('0x63')]['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x531d6a,null))['then'](function(_0x4d8c03){if(_0x4d8c03){_0x192d95=_0x4d8c03;logger[_0x6b18('0x24')](_0x6b18('0x25'),_0x6b18('0x2c'),_0x6b18('0xca'),_0x4d8c03[_0x6b18('0x43')],util[_0x6b18('0xcb')](_0x18dfe6['body'],{'showHidden':![],'depth':null}));switch(_0x4d8c03['type']){case _0x6b18('0x82'):if(_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xcc')]&&_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0x2c')]){_0x15d444=_0x18dfe6['body'][_0x6b18('0x2c')];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x18dfe6[_0x6b18('0x5d')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x18dfe6[_0x6b18('0x5d')]['requestid']&&_0x18dfe6[_0x6b18('0x5d')]['statusInt']){_0x15d444=_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xcd')];return db['SmsMessage']['find']({'where':{'messageId':_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xce')]}});}break;case _0x6b18('0x85'):if(_0x18dfe6['body'][_0x6b18('0xcf')]&&_0x18dfe6[_0x6b18('0x5d')]['status_code']){_0x15d444=_0x18dfe6[_0x6b18('0x5d')]['status_code'];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xcf')]}});}break;case _0x6b18('0x89'):var _0xfe8f07=_0x18dfe6['body'][_0x6b18('0x8a')][0x0];if(_0xfe8f07[_0x6b18('0x80')]&&_0xfe8f07[_0x6b18('0x2c')][_0x6b18('0xd0')]===_0x6b18('0xd1')){_0x15d444=_0xfe8f07[_0x6b18('0x2c')]['groupName'];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0xfe8f07['messageId']}});}break;case _0x6b18('0x8e'):if(_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0x80')]&&_0x18dfe6['body'][_0x6b18('0x2c')]){_0x15d444=_0x18dfe6['body'][_0x6b18('0x2c')];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x18dfe6['body'][_0x6b18('0x80')]}});}break;case'bandwidth':if(_0x18dfe6[_0x6b18('0x5d')][0x0][_0x6b18('0x29')]['id']){_0x15d444=_0x18dfe6[_0x6b18('0x5d')][0x0][_0x6b18('0x43')];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x18dfe6[_0x6b18('0x5d')][0x0]['message']['id']}});}break;case _0x6b18('0x91'):if(_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xd2')]&&_0x18dfe6[_0x6b18('0x5d')]['status']){_0x15d444=_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0x2c')];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0xd2')]}});}break;}}})[_0x6b18('0x20')](handleEntityNotFound(_0x531d6a,null))[_0x6b18('0x20')](function(_0x1fbc91){if(_0x1fbc91){_0x3eb17f=_0x1fbc91;switch(_0x192d95['type']){case _0x6b18('0x82'):if(_0x15d444==='DELIVERED'){return _0x3eb17f[_0x6b18('0x37')]({'read':!![]});}else{logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0x82'),util[_0x6b18('0xcb')](_0x18dfe6['body'],{'showHidden':![],'depth':null}));}break;case _0x6b18('0x84'):if(_0x15d444==='1'){return _0x3eb17f[_0x6b18('0x37')]({'read':!![]});}else{logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0x82'),util[_0x6b18('0xcb')](_0x18dfe6[_0x6b18('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x6b18('0x85'):if(!_0x18dfe6['body']['error_code']&&_0x15d444>=0xc8&&_0x15d444<=0xce){return _0x3eb17f['update']({'read':!![]});}else{logger[_0x6b18('0x27')](_0x6b18('0x25'),_0x6b18('0x2c'),_0x6b18('0x85'),util['inspect'](_0x18dfe6['body'],{'showHidden':![],'depth':null}));}break;case _0x6b18('0x89'):var _0x2e7a44=_0x18dfe6[_0x6b18('0x5d')][_0x6b18('0x8a')][0x0];if(_0x2e7a44[_0x6b18('0x2c')][_0x6b18('0xd0')]===_0x6b18('0xd1')){return _0x3eb17f['update']({'read':!![]});}else{logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0x89'),util['inspect'](_0x18dfe6['body'],{'showHidden':![],'depth':null}));}break;case _0x6b18('0x8e'):if(_0x15d444==_0x6b18('0xd3')||_0x15d444==_0x6b18('0xd4')){return _0x3eb17f[_0x6b18('0x37')]({'read':!![]});}else{logger[_0x6b18('0x27')](_0x6b18('0x25'),_0x6b18('0x2c'),_0x6b18('0x8e'),util[_0x6b18('0xcb')](_0x18dfe6['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x15d444==_0x6b18('0xd5')){return _0x3eb17f[_0x6b18('0x37')]({'read':!![]});}else{logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0x90'),util[_0x6b18('0xcb')](_0x18dfe6['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x15d444===_0x6b18('0xd6')||_0x15d444===_0x6b18('0xd7')){return _0x3eb17f[_0x6b18('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util['inspect'](_0x18dfe6[_0x6b18('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x3eb17f;}})[_0x6b18('0x20')](respondWithResult(_0x531d6a,null))[_0x6b18('0x2a')](handleError(_0x531d6a,null));};exports['statusGet']=function(_0x3787bc,_0x56c2a5,_0x5e476d){var _0x53913c,_0x1d0c15,_0x568039;return db[_0x6b18('0x40')][_0x6b18('0x61')]({'where':{'id':_0x3787bc['params']['id']}})['then'](handleEntityNotFound(_0x56c2a5,null))['then'](function(_0x57a645){if(_0x57a645){_0x568039=_0x57a645;logger[_0x6b18('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0xca'),_0x57a645[_0x6b18('0x43')],util[_0x6b18('0xcb')](_0x3787bc[_0x6b18('0x45')],{'showHidden':![],'depth':null}));switch(_0x57a645[_0x6b18('0x43')]){case _0x6b18('0x8b'):if(_0x3787bc[_0x6b18('0x45')][_0x6b18('0xd8')]&&_0x3787bc[_0x6b18('0x45')][_0x6b18('0xd9')]){_0x1d0c15=_0x3787bc[_0x6b18('0x45')][_0x6b18('0xd9')];return db[_0x6b18('0xa8')][_0x6b18('0x61')]({'where':{'messageId':_0x3787bc['query'][_0x6b18('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0x56c2a5,null))[_0x6b18('0x20')](function(_0x357b03){if(_0x357b03){_0x53913c=_0x357b03;switch(_0x568039['type']){case _0x6b18('0x8b'):if(_0x1d0c15==='2'||_0x1d0c15==='6'){return _0x53913c['update']({'read':!![]});}else{logger[_0x6b18('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6b18('0x2c'),_0x6b18('0x8b'),util['inspect'](_0x3787bc[_0x6b18('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x53913c;}})[_0x6b18('0x20')](respondWithResult(_0x56c2a5,null))[_0x6b18('0x2a')](handleError(_0x56c2a5,null));};exports['addAgents']=function(_0x50e3fe,_0x43166d,_0x5ed60e){return db[_0x6b18('0x40')][_0x6b18('0x61')]({'where':{'id':_0x50e3fe['params']['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x43166d,null))['then'](function(_0x37b3c2){if(_0x37b3c2){return _0x37b3c2[_0x6b18('0xda')](_0x50e3fe[_0x6b18('0x5d')][_0x6b18('0x6c')],_['omit'](_0x50e3fe[_0x6b18('0x5d')],['ids','id'])||{})[_0x6b18('0x9f')](function(_0x1b6beb){for(var _0x585036=0x0;_0x585036<_0x50e3fe['body'][_0x6b18('0x6c')][_0x6b18('0x4b')];_0x585036+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x50e3fe[_0x6b18('0x5d')][_0x6b18('0x6c')][_0x585036]),'SmsAccountId':Number(_0x50e3fe[_0x6b18('0x63')]['id'])});}return _0x1b6beb;});}})[_0x6b18('0x20')](respondWithResult(_0x43166d,null))[_0x6b18('0x2a')](handleError(_0x43166d,null));};exports[_0x6b18('0xdb')]=function(_0x4dbe56,_0x384f96,_0x5d4e23){return db['SmsAccount'][_0x6b18('0x61')]({'where':{'id':_0x4dbe56['params']['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x384f96,null))[_0x6b18('0x20')](function(_0x18129c){if(_0x18129c){return _0x18129c[_0x6b18('0xdb')](_0x4dbe56[_0x6b18('0x45')]['ids'])['then'](function(){if(_[_0x6b18('0xdc')](_0x4dbe56[_0x6b18('0x45')][_0x6b18('0x6c')])){for(var _0x998dc7=0x0;_0x998dc7<_0x4dbe56['query']['ids'][_0x6b18('0x4b')];_0x998dc7+=0x1){socket[_0x6b18('0xdd')](_0x6b18('0xde'),{'UserId':Number(_0x4dbe56[_0x6b18('0x45')]['ids'][_0x998dc7]),'SmsAccountId':Number(_0x4dbe56[_0x6b18('0x63')]['id'])});}}else{socket['emit'](_0x6b18('0xde'),{'UserId':Number(_0x4dbe56[_0x6b18('0x45')][_0x6b18('0x6c')]),'SmsAccountId':Number(_0x4dbe56[_0x6b18('0x63')]['id'])});}});}})[_0x6b18('0x20')](respondWithStatusCode(_0x384f96,null))[_0x6b18('0x2a')](handleError(_0x384f96,null));};exports['getAgents']=function(_0x5a1a73,_0x83ed6,_0x2f92b1){var _0x1d9464={};var _0x18be17={};var _0x5a621e;var _0x3ff1a8;return db[_0x6b18('0x40')][_0x6b18('0x69')]({'where':{'id':_0x5a1a73[_0x6b18('0x63')]['id']}})[_0x6b18('0x20')](handleEntityNotFound(_0x83ed6,null))[_0x6b18('0x20')](function(_0x3050e3){if(_0x3050e3){_0x5a621e=_0x3050e3;_0x18be17[_0x6b18('0x48')]=_[_0x6b18('0x46')](db[_0x6b18('0xab')][_0x6b18('0x41')]);_0x18be17[_0x6b18('0x45')]=_[_0x6b18('0x46')](_0x5a1a73['query']);_0x18be17[_0x6b18('0x50')]=_['intersection'](_0x18be17[_0x6b18('0x48')],_0x18be17[_0x6b18('0x45')]);_0x1d9464[_0x6b18('0x4a')]=_[_0x6b18('0x47')](_0x18be17[_0x6b18('0x48')],qs[_0x6b18('0x49')](_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x49')]));_0x1d9464[_0x6b18('0x4a')]=_0x1d9464[_0x6b18('0x4a')][_0x6b18('0x4b')]?_0x1d9464[_0x6b18('0x4a')]:_0x18be17[_0x6b18('0x48')];_0x1d9464[_0x6b18('0x4d')]=qs[_0x6b18('0x4e')](_0x5a1a73[_0x6b18('0x45')]['sort']);_0x1d9464[_0x6b18('0x4f')]=qs[_0x6b18('0x50')](_[_0x6b18('0x51')](_0x5a1a73['query'],_0x18be17[_0x6b18('0x50')]));if(_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x53')]){_0x1d9464[_0x6b18('0x4f')]=_[_0x6b18('0x5b')](_0x1d9464[_0x6b18('0x4f')],{'$or':_[_0x6b18('0x3f')](_0x1d9464['attributes'],function(_0x17fa7e){var _0x303497={};_0x303497[_0x17fa7e]={'$like':'%'+_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x53')]+'%'};return _0x303497;})});}_0x1d9464=_[_0x6b18('0x5b')]({},_0x1d9464,_0x5a1a73['options']);return _0x5a621e[_0x6b18('0xdf')](_0x1d9464);}})[_0x6b18('0x20')](function(_0x438910){if(_0x438910){_0x3ff1a8=_0x438910[_0x6b18('0x4b')];if(!_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x6a')](_0x6b18('0x4c'))){_0x1d9464[_0x6b18('0x31')]=qs[_0x6b18('0x31')](_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x31')]);_0x1d9464[_0x6b18('0x2f')]=qs['offset'](_0x5a1a73[_0x6b18('0x45')][_0x6b18('0x2f')]);}return _0x5a621e[_0x6b18('0xdf')](_0x1d9464);}})[_0x6b18('0x20')](function(_0x366756){if(_0x366756){return _0x366756?{'count':_0x3ff1a8,'rows':_0x366756}:null;}})[_0x6b18('0x20')](respondWithResult(_0x83ed6,null))[_0x6b18('0x2a')](handleError(_0x83ed6,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 324eec2..b87738c 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 _0xf638=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0xf638,0x6d));var _0x8f63=function(_0x42d014,_0x283bd0){_0x42d014=_0x42d014-0x0;var _0x20c44f=_0xf638[_0x42d014];return _0x20c44f;};'use strict';var EventEmitter=require(_0x8f63('0x0'));var SmsAccount=require(_0x8f63('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8f63('0x2')](0x0);var events={'afterCreate':_0x8f63('0x3'),'afterUpdate':'update','afterDestroy':_0x8f63('0x4')};function emitEvent(_0x2ad3b4){return function(_0x1cc4b4,_0x1b06cc,_0x8a17c6){SmsAccountEvents[_0x8f63('0x5')](_0x2ad3b4+':'+_0x1cc4b4['id'],_0x1cc4b4);SmsAccountEvents[_0x8f63('0x5')](_0x2ad3b4,_0x1cc4b4);_0x8a17c6(null);};}for(var e in events){if(events[_0x8f63('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x8f63('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xfa92=['hook','events','SmsAccount','setMaxListeners','remove','emit'];(function(_0x5bbd2b,_0x5a3c9e){var _0x5cbeba=function(_0x3498ff){while(--_0x3498ff){_0x5bbd2b['push'](_0x5bbd2b['shift']());}};_0x5cbeba(++_0x5a3c9e);}(_0xfa92,0x1c9));var _0x2fa9=function(_0x338728,_0x21ea47){_0x338728=_0x338728-0x0;var _0x3ec100=_0xfa92[_0x338728];return _0x3ec100;};'use strict';var EventEmitter=require(_0x2fa9('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x2fa9('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2fa9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2fa9('0x3')};function emitEvent(_0x2c8520){return function(_0x3d5fa6,_0x288d8b,_0x5b929f){SmsAccountEvents[_0x2fa9('0x4')](_0x2c8520+':'+_0x3d5fa6['id'],_0x3d5fa6);SmsAccountEvents['emit'](_0x2c8520,_0x3d5fa6);_0x5b929f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x2fa9('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 31f4abb..bdded13 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 _0x2823=['exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes'];(function(_0x1f6d62,_0x4cae24){var _0x4f1e4e=function(_0x18af6d){while(--_0x18af6d){_0x1f6d62['push'](_0x1f6d62['shift']());}};_0x4f1e4e(++_0x4cae24);}(_0x2823,0x1e3));var _0x3282=function(_0x319f00,_0x4180ed){_0x319f00=_0x319f00-0x0;var _0x195de9=_0x2823[_0x319f00];return _0x195de9;};'use strict';var _=require(_0x3282('0x0'));var util=require(_0x3282('0x1'));var logger=require(_0x3282('0x2'))('api');var moment=require(_0x3282('0x3'));var BPromise=require(_0x3282('0x4'));var rp=require(_0x3282('0x5'));var fs=require('fs');var path=require(_0x3282('0x6'));var rimraf=require(_0x3282('0x7'));var config=require('../../config/environment');var attributes=require(_0x3282('0x8'));module[_0x3282('0x9')]=function(_0x1b8c99,_0x5bc1ca){return _0x1b8c99['define'](_0x3282('0xa'),attributes,{'tableName':_0x3282('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe096=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','util','../../config/logger','api'];(function(_0x58d279,_0x747f0e){var _0x745670=function(_0xfc4c4d){while(--_0xfc4c4d){_0x58d279['push'](_0x58d279['shift']());}};_0x745670(++_0x747f0e);}(_0xe096,0xce));var _0x6e09=function(_0x4ddfe1,_0x35939d){_0x4ddfe1=_0x4ddfe1-0x0;var _0x4aaf51=_0xe096[_0x4ddfe1];return _0x4aaf51;};'use strict';var _=require('lodash');var util=require(_0x6e09('0x0'));var logger=require(_0x6e09('0x1'))(_0x6e09('0x2'));var moment=require(_0x6e09('0x3'));var BPromise=require(_0x6e09('0x4'));var rp=require(_0x6e09('0x5'));var fs=require('fs');var path=require(_0x6e09('0x6'));var rimraf=require(_0x6e09('0x7'));var config=require(_0x6e09('0x8'));var attributes=require(_0x6e09('0x9'));module['exports']=function(_0x53abd1,_0x5a5a6b){return _0x53abd1[_0x6e09('0xa')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 3e53433..f9f2a09 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 _0x0342=['then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request'];(function(_0x5b73e7,_0x40789d){var _0x594436=function(_0x4b7494){while(--_0x4b7494){_0x5b73e7['push'](_0x5b73e7['shift']());}};_0x594436(++_0x40789d);}(_0x0342,0x1e7));var _0x2034=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x0342[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x2034('0x0'));var util=require('util');var moment=require(_0x2034('0x1'));var BPromise=require(_0x2034('0x2'));var rs=require(_0x2034('0x3'));var fs=require('fs');var Redis=require(_0x2034('0x4'));var db=require(_0x2034('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2034('0x6'))('rpc');var config=require(_0x2034('0x7'));var jayson=require(_0x2034('0x8'));var client=jayson[_0x2034('0x9')][_0x2034('0xa')]({'port':0x232a});config[_0x2034('0xb')]=_[_0x2034('0xc')](config[_0x2034('0xb')],{'host':_0x2034('0xd'),'port':0x18eb});var socket=require(_0x2034('0xe'))(new Redis(config['redis']));require(_0x2034('0xf'))['register'](socket);function respondWithRpcPromise(_0x45e81c,_0x14360e,_0x1b1cf4){return new BPromise(function(_0x1957ba,_0x3a9195){return client[_0x2034('0x10')](_0x45e81c,_0x1b1cf4)[_0x2034('0x11')](function(_0x3d0ae4){logger[_0x2034('0x12')](_0x2034('0x13'),_0x14360e,_0x2034('0x14'));logger[_0x2034('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14360e,_0x2034('0x14'),JSON[_0x2034('0x16')](_0x3d0ae4));if(_0x3d0ae4[_0x2034('0x17')]){if(_0x3d0ae4[_0x2034('0x17')][_0x2034('0x18')]===0x1f4){logger[_0x2034('0x17')](_0x2034('0x13'),_0x14360e,_0x3d0ae4[_0x2034('0x17')][_0x2034('0x19')]);return _0x3a9195(_0x3d0ae4['error'][_0x2034('0x19')]);}logger[_0x2034('0x17')](_0x2034('0x13'),_0x14360e,_0x3d0ae4[_0x2034('0x17')][_0x2034('0x19')]);return _0x1957ba(_0x3d0ae4[_0x2034('0x17')][_0x2034('0x19')]);}else{logger[_0x2034('0x12')](_0x2034('0x13'),_0x14360e,_0x2034('0x14'));_0x1957ba(_0x3d0ae4[_0x2034('0x1a')][_0x2034('0x19')]);}})[_0x2034('0x1b')](function(_0x1eab38){logger[_0x2034('0x17')](_0x2034('0x13'),_0x14360e,_0x1eab38);_0x3a9195(_0x1eab38);});});}exports[_0x2034('0x1c')]=function(_0x399e7b){var _0x390cb0=this;return new Promise(function(_0xb9c40f,_0x1e9bcf){return db[_0x2034('0x1d')]['find']({'raw':_0x399e7b[_0x2034('0x1e')]?_0x399e7b[_0x2034('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x399e7b[_0x2034('0x1e')]?_0x399e7b[_0x2034('0x1e')][_0x2034('0x1f')]||null:null,'attributes':_0x399e7b[_0x2034('0x1e')]?_0x399e7b[_0x2034('0x1e')][_0x2034('0x20')]||null:null,'include':_0x399e7b[_0x2034('0x1e')]?_0x399e7b[_0x2034('0x1e')][_0x2034('0x21')]?_['map'](_0x399e7b[_0x2034('0x1e')][_0x2034('0x21')],function(_0x1f82b7){return{'model':db[_0x1f82b7['model']],'as':_0x1f82b7['as'],'attributes':_0x1f82b7['attributes'],'include':_0x1f82b7[_0x2034('0x21')]?_[_0x2034('0x22')](_0x1f82b7[_0x2034('0x21')],function(_0x4e2994){return{'model':db[_0x4e2994[_0x2034('0x23')]],'as':_0x4e2994['as'],'attributes':_0x4e2994[_0x2034('0x20')],'include':_0x4e2994['include']?_[_0x2034('0x22')](_0x4e2994[_0x2034('0x21')],function(_0xae0b8d){return{'model':db[_0xae0b8d[_0x2034('0x23')]],'as':_0xae0b8d['as'],'attributes':_0xae0b8d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2034('0x11')](function(_0x306c6e){logger[_0x2034('0x12')](_0x2034('0x1c'),_0x399e7b);logger[_0x2034('0x15')](_0x2034('0x1c'),_0x399e7b,JSON[_0x2034('0x16')](_0x306c6e));_0xb9c40f(_0x306c6e);})[_0x2034('0x1b')](function(_0x39e609){logger['error'](_0x2034('0x1c'),_0x39e609[_0x2034('0x19')],_0x399e7b);_0x1e9bcf(_0x390cb0[_0x2034('0x17')](0x1f4,_0x39e609['message']));});});}; \ No newline at end of file +var _0x4110=['then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSmsAccount','options','raw','where','attributes','include','map','model','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x4110,0x1f2));var _0x0411=function(_0x10d4e5,_0x1b684b){_0x10d4e5=_0x10d4e5-0x0;var _0x225012=_0x4110[_0x10d4e5];return _0x225012;};'use strict';var _=require('lodash');var util=require(_0x0411('0x0'));var moment=require(_0x0411('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0411('0x2'))['db'];var utils=require(_0x0411('0x3'));var logger=require(_0x0411('0x4'))(_0x0411('0x5'));var config=require(_0x0411('0x6'));var jayson=require(_0x0411('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0411('0x8')]=_[_0x0411('0x9')](config[_0x0411('0x8')],{'host':_0x0411('0xa'),'port':0x18eb});var socket=require(_0x0411('0xb'))(new Redis(config[_0x0411('0x8')]));require(_0x0411('0xc'))[_0x0411('0xd')](socket);function respondWithRpcPromise(_0x3c2c04,_0x24826d,_0x31c053){return new BPromise(function(_0x289aae,_0xb62b7b){return client['request'](_0x3c2c04,_0x31c053)[_0x0411('0xe')](function(_0x46c652){logger[_0x0411('0xf')](_0x0411('0x10'),_0x24826d,_0x0411('0x11'));logger[_0x0411('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x24826d,_0x0411('0x11'),JSON[_0x0411('0x13')](_0x46c652));if(_0x46c652[_0x0411('0x14')]){if(_0x46c652['error']['code']===0x1f4){logger[_0x0411('0x14')]('SmsAccount,\x20%s,\x20%s',_0x24826d,_0x46c652['error'][_0x0411('0x15')]);return _0xb62b7b(_0x46c652[_0x0411('0x14')][_0x0411('0x15')]);}logger[_0x0411('0x14')](_0x0411('0x10'),_0x24826d,_0x46c652['error'][_0x0411('0x15')]);return _0x289aae(_0x46c652[_0x0411('0x14')][_0x0411('0x15')]);}else{logger[_0x0411('0xf')](_0x0411('0x10'),_0x24826d,_0x0411('0x11'));_0x289aae(_0x46c652[_0x0411('0x16')][_0x0411('0x15')]);}})[_0x0411('0x17')](function(_0x4c6126){logger[_0x0411('0x14')](_0x0411('0x10'),_0x24826d,_0x4c6126);_0xb62b7b(_0x4c6126);});});}exports[_0x0411('0x18')]=function(_0x15573a){var _0x5ad045=this;return new Promise(function(_0x4d8fb5,_0x3c6810){return db['SmsAccount']['find']({'raw':_0x15573a['options']?_0x15573a[_0x0411('0x19')][_0x0411('0x1a')]===undefined?!![]:![]:!![],'where':_0x15573a[_0x0411('0x19')]?_0x15573a[_0x0411('0x19')][_0x0411('0x1b')]||null:null,'attributes':_0x15573a[_0x0411('0x19')]?_0x15573a[_0x0411('0x19')][_0x0411('0x1c')]||null:null,'include':_0x15573a[_0x0411('0x19')]?_0x15573a[_0x0411('0x19')][_0x0411('0x1d')]?_[_0x0411('0x1e')](_0x15573a[_0x0411('0x19')][_0x0411('0x1d')],function(_0x117a2b){return{'model':db[_0x117a2b[_0x0411('0x1f')]],'as':_0x117a2b['as'],'attributes':_0x117a2b[_0x0411('0x1c')],'include':_0x117a2b[_0x0411('0x1d')]?_[_0x0411('0x1e')](_0x117a2b[_0x0411('0x1d')],function(_0x56d2cf){return{'model':db[_0x56d2cf[_0x0411('0x1f')]],'as':_0x56d2cf['as'],'attributes':_0x56d2cf['attributes'],'include':_0x56d2cf[_0x0411('0x1d')]?_[_0x0411('0x1e')](_0x56d2cf[_0x0411('0x1d')],function(_0x27c95d){return{'model':db[_0x27c95d['model']],'as':_0x27c95d['as'],'attributes':_0x27c95d[_0x0411('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x19e57e){logger['info'](_0x0411('0x18'),_0x15573a);logger[_0x0411('0x12')](_0x0411('0x18'),_0x15573a,JSON[_0x0411('0x13')](_0x19e57e));_0x4d8fb5(_0x19e57e);})[_0x0411('0x17')](function(_0x2ce853){logger[_0x0411('0x14')](_0x0411('0x18'),_0x2ce853[_0x0411('0x15')],_0x15573a);_0x3c6810(_0x5ad045[_0x0411('0x14')](0x1f4,_0x2ce853['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0218ef7..40243ea 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 e2be528..0e4d992 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x210675,_0x3e47fa){var _0x573c4e=function(_0x55a6a9){while(--_0x55a6a9){_0x210675['push'](_0x210675['shift']());}};_0x573c4e(++_0x3e47fa);}(_0xe14b,0x93));var _0xbe14=function(_0x4c0444,_0x45796d){_0x4c0444=_0x4c0444-0x0;var _0x2ae7a8=_0xe14b[_0x4c0444];return _0x2ae7a8;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa808d9,_0x186110){var _0x2ae6af=function(_0x89c722){while(--_0x89c722){_0xa808d9['push'](_0xa808d9['shift']());}};_0x2ae6af(++_0x186110);}(_0x34e8,0x12c));var _0x834e=function(_0x1c177f,_0x1e351c){_0x1c177f=_0x1c177f-0x0;var _0x5acebe=_0x34e8[_0x1c177f];return _0x5acebe;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 21a6b87..cc74c60 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 _0x51bc=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3555de,_0x22e5ca){var _0x3742b5=function(_0x47f40f){while(--_0x47f40f){_0x3555de['push'](_0x3555de['shift']());}};_0x3742b5(++_0x22e5ca);}(_0x51bc,0x104));var _0xc51b=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x51bc[_0x5756c6];return _0x4b5806;};'use strict';var Sequelize=require(_0xc51b('0x0'));module[_0xc51b('0x1')]={'priority':{'type':Sequelize[_0xc51b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc51b('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc51b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc51b('0x3')],'defaultValue':_0xc51b('0x5')}}; \ No newline at end of file +var _0xbf60=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x5e8db4,_0x34fea5){var _0x1b3d7d=function(_0x4db170){while(--_0x4db170){_0x5e8db4['push'](_0x5e8db4['shift']());}};_0x1b3d7d(++_0x34fea5);}(_0xbf60,0x14a));var _0x0bf6=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0xbf60[_0x4b64a4];return _0xd19b0e;};'use strict';var Sequelize=require(_0x0bf6('0x0'));module[_0x0bf6('0x1')]={'priority':{'type':Sequelize[_0x0bf6('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0bf6('0x3')],'allowNull':![],'defaultValue':_0x0bf6('0x4')},'appdata':{'type':Sequelize[_0x0bf6('0x5')]()},'description':{'type':Sequelize[_0x0bf6('0x3')]},'interval':{'type':Sequelize[_0x0bf6('0x3')],'defaultValue':_0x0bf6('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index f3f2e76..493ce54 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 _0xb7cc=['attributes','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsApplication','include','catch','show','params','length','includeAll','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','error','stack','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields'];(function(_0x48d0dc,_0x51394a){var _0x2afebf=function(_0x1bf51a){while(--_0x1bf51a){_0x48d0dc['push'](_0x48d0dc['shift']());}};_0x2afebf(++_0x51394a);}(_0xb7cc,0x16e));var _0xcb7c=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb7cc[_0x1b6186];return _0x186121;};'use strict';var emlformat=require(_0xcb7c('0x0'));var rimraf=require(_0xcb7c('0x1'));var zipdir=require(_0xcb7c('0x2'));var jsonpatch=require(_0xcb7c('0x3'));var rp=require(_0xcb7c('0x4'));var moment=require(_0xcb7c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb7c('0x6'));var util=require('util');var path=require(_0xcb7c('0x7'));var sox=require(_0xcb7c('0x8'));var csv=require(_0xcb7c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb7c('0xa'));var _=require('lodash');var squel=require(_0xcb7c('0xb'));var crypto=require(_0xcb7c('0xc'));var jsforce=require(_0xcb7c('0xd'));var deskjs=require(_0xcb7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcb7c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcb7c('0x10'));var qs=require(_0xcb7c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7c('0x12'));var logger=require(_0xcb7c('0x13'))('api');var utils=require(_0xcb7c('0x14'));var config=require(_0xcb7c('0x15'));var licenseUtil=require(_0xcb7c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57a737,_0x4546bb){_0x4546bb=_0x4546bb||0xcc;return function(_0x124117){if(_0x124117){return _0x57a737[_0xcb7c('0x17')](_0x4546bb);}return _0x57a737[_0xcb7c('0x18')](_0x4546bb)[_0xcb7c('0x19')]();};}function respondWithResult(_0x1d26cf,_0x511663){_0x511663=_0x511663||0xc8;return function(_0x1590f7){if(_0x1590f7){return _0x1d26cf['status'](_0x511663)[_0xcb7c('0x1a')](_0x1590f7);}};}function respondWithFilteredResult(_0x578539,_0x43e5c2){return function(_0x5f3d83){if(_0x5f3d83){var _0xa87cd8=typeof _0x43e5c2[_0xcb7c('0x1b')]===_0xcb7c('0x1c')&&typeof _0x43e5c2[_0xcb7c('0x1d')]===_0xcb7c('0x1c');var _0x4674db=_0x5f3d83['count'];var _0xa19f32=_0xa87cd8?0x0:_0x43e5c2['offset'];var _0x1826e0=_0xa87cd8?_0x5f3d83[_0xcb7c('0x1e')]:_0x43e5c2[_0xcb7c('0x1b')]+_0x43e5c2[_0xcb7c('0x1d')];var _0x189ea1;if(_0x1826e0>=_0x4674db){_0x1826e0=_0x4674db;_0x189ea1=0xc8;}else{_0x189ea1=0xce;}_0x578539[_0xcb7c('0x18')](_0x189ea1);return _0x578539['set'](_0xcb7c('0x1f'),_0xa19f32+'-'+_0x1826e0+'/'+_0x4674db)[_0xcb7c('0x1a')](_0x5f3d83);}return null;};}function patchUpdates(_0x42b33d){return function(_0x37ce95){try{jsonpatch['apply'](_0x37ce95,_0x42b33d,!![]);}catch(_0x32b933){return BPromise[_0xcb7c('0x20')](_0x32b933);}return _0x37ce95['save']();};}function saveUpdates(_0x37f028,_0x8052eb){return function(_0x16d5fb){if(_0x16d5fb){return _0x16d5fb['update'](_0x37f028)[_0xcb7c('0x21')](function(_0x10fc5f){return _0x10fc5f;});}return null;};}function removeEntity(_0x2d7632,_0x44d211){return function(_0x59d70f){if(_0x59d70f){return _0x59d70f['destroy']()[_0xcb7c('0x21')](function(){_0x2d7632[_0xcb7c('0x18')](0xcc)[_0xcb7c('0x19')]();});}};}function handleEntityNotFound(_0x5aa382,_0x543e62){return function(_0x13288){if(!_0x13288){_0x5aa382[_0xcb7c('0x17')](0x194);}return _0x13288;};}function handleError(_0x1d6e17,_0x3646fb){_0x3646fb=_0x3646fb||0x1f4;return function(_0x4ee985){logger[_0xcb7c('0x22')](_0x4ee985[_0xcb7c('0x23')]);if(_0x4ee985[_0xcb7c('0x24')]){delete _0x4ee985[_0xcb7c('0x24')];}_0x1d6e17['status'](_0x3646fb)[_0xcb7c('0x25')](_0x4ee985);};}exports['index']=function(_0x57ccf4,_0x33fe46){var _0x483ca4={},_0x36ae5a={},_0x404b5e={'count':0x0,'rows':[]};var _0x25898c=_[_0xcb7c('0x26')](db['SmsApplication'][_0xcb7c('0x27')],function(_0x3b8e81){return{'name':_0x3b8e81['fieldName'],'type':_0x3b8e81[_0xcb7c('0x28')][_0xcb7c('0x29')]};});_0x36ae5a['model']=_['map'](_0x25898c,_0xcb7c('0x24'));_0x36ae5a[_0xcb7c('0x2a')]=_[_0xcb7c('0x2b')](_0x57ccf4[_0xcb7c('0x2a')]);_0x36ae5a[_0xcb7c('0x2c')]=_[_0xcb7c('0x2d')](_0x36ae5a['model'],_0x36ae5a[_0xcb7c('0x2a')]);_0x483ca4['attributes']=_[_0xcb7c('0x2d')](_0x36ae5a[_0xcb7c('0x2e')],qs[_0xcb7c('0x2f')](_0x57ccf4[_0xcb7c('0x2a')][_0xcb7c('0x2f')]));_0x483ca4['attributes']=_0x483ca4[_0xcb7c('0x30')]['length']?_0x483ca4[_0xcb7c('0x30')]:_0x36ae5a[_0xcb7c('0x2e')];if(!_0x57ccf4[_0xcb7c('0x2a')]['hasOwnProperty']('nolimit')){_0x483ca4[_0xcb7c('0x1d')]=qs[_0xcb7c('0x1d')](_0x57ccf4[_0xcb7c('0x2a')]['limit']);_0x483ca4[_0xcb7c('0x1b')]=qs[_0xcb7c('0x1b')](_0x57ccf4[_0xcb7c('0x2a')][_0xcb7c('0x1b')]);}_0x483ca4[_0xcb7c('0x31')]=qs['sort'](_0x57ccf4['query'][_0xcb7c('0x32')]);_0x483ca4[_0xcb7c('0x33')]=qs[_0xcb7c('0x2c')](_[_0xcb7c('0x34')](_0x57ccf4[_0xcb7c('0x2a')],_0x36ae5a['filters']),_0x25898c);if(_0x57ccf4[_0xcb7c('0x2a')]['filter']){_0x483ca4[_0xcb7c('0x33')]=_[_0xcb7c('0x35')](_0x483ca4[_0xcb7c('0x33')],{'$or':_['map'](_0x25898c,function(_0x2db724){if(_0x2db724['type']!==_0xcb7c('0x36')){var _0x54ef9c={};_0x54ef9c[_0x2db724[_0xcb7c('0x24')]]={'$like':'%'+_0x57ccf4[_0xcb7c('0x2a')][_0xcb7c('0x37')]+'%'};return _0x54ef9c;}})});}_0x483ca4=_['merge']({},_0x483ca4,_0x57ccf4[_0xcb7c('0x38')]);var _0x1a3b1a={'where':_0x483ca4[_0xcb7c('0x33')]};return db[_0xcb7c('0x39')][_0xcb7c('0x1e')](_0x1a3b1a)[_0xcb7c('0x21')](function(_0x3d9889){_0x404b5e['count']=_0x3d9889;if(_0x57ccf4[_0xcb7c('0x2a')]['includeAll']){_0x483ca4[_0xcb7c('0x3a')]=[{'all':!![]}];}return db[_0xcb7c('0x39')]['findAll'](_0x483ca4);})['then'](function(_0x42cb35){_0x404b5e['rows']=_0x42cb35;return _0x404b5e;})['then'](respondWithFilteredResult(_0x33fe46,_0x483ca4))[_0xcb7c('0x3b')](handleError(_0x33fe46,null));};exports[_0xcb7c('0x3c')]=function(_0x102fe2,_0x4bc09e){var _0x48f628={'raw':!![],'where':{'id':_0x102fe2[_0xcb7c('0x3d')]['id']}},_0x5cbed2={};_0x5cbed2[_0xcb7c('0x2e')]=_[_0xcb7c('0x2b')](db[_0xcb7c('0x39')][_0xcb7c('0x27')]);_0x5cbed2[_0xcb7c('0x2a')]=_[_0xcb7c('0x2b')](_0x102fe2[_0xcb7c('0x2a')]);_0x5cbed2[_0xcb7c('0x2c')]=_['intersection'](_0x5cbed2['model'],_0x5cbed2['query']);_0x48f628['attributes']=_['intersection'](_0x5cbed2[_0xcb7c('0x2e')],qs[_0xcb7c('0x2f')](_0x102fe2['query']['fields']));_0x48f628[_0xcb7c('0x30')]=_0x48f628[_0xcb7c('0x30')][_0xcb7c('0x3e')]?_0x48f628[_0xcb7c('0x30')]:_0x5cbed2[_0xcb7c('0x2e')];if(_0x102fe2[_0xcb7c('0x2a')][_0xcb7c('0x3f')]){_0x48f628['include']=[{'all':!![]}];}_0x48f628=_[_0xcb7c('0x35')]({},_0x48f628,_0x102fe2[_0xcb7c('0x38')]);return db['SmsApplication'][_0xcb7c('0x40')](_0x48f628)[_0xcb7c('0x21')](handleEntityNotFound(_0x4bc09e,null))[_0xcb7c('0x21')](respondWithResult(_0x4bc09e,null))[_0xcb7c('0x3b')](handleError(_0x4bc09e,null));};exports[_0xcb7c('0x41')]=function(_0x37a690,_0x572411){return db[_0xcb7c('0x39')][_0xcb7c('0x41')](_0x37a690[_0xcb7c('0x42')],{})['then'](respondWithResult(_0x572411,0xc9))[_0xcb7c('0x3b')](handleError(_0x572411,null));};exports[_0xcb7c('0x43')]=function(_0x1d8a00,_0x81ac68){if(_0x1d8a00[_0xcb7c('0x42')]['id']){delete _0x1d8a00[_0xcb7c('0x42')]['id'];}return db[_0xcb7c('0x39')][_0xcb7c('0x40')]({'where':{'id':_0x1d8a00[_0xcb7c('0x3d')]['id']}})[_0xcb7c('0x21')](handleEntityNotFound(_0x81ac68,null))[_0xcb7c('0x21')](saveUpdates(_0x1d8a00[_0xcb7c('0x42')],null))['then'](respondWithResult(_0x81ac68,null))[_0xcb7c('0x3b')](handleError(_0x81ac68,null));};exports[_0xcb7c('0x44')]=function(_0x839881,_0x256f21){return db['SmsApplication'][_0xcb7c('0x40')]({'where':{'id':_0x839881['params']['id']}})[_0xcb7c('0x21')](handleEntityNotFound(_0x256f21,null))['then'](removeEntity(_0x256f21,null))[_0xcb7c('0x3b')](handleError(_0x256f21,null));}; \ No newline at end of file +var _0xfcff=['offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','SmsApplication','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0x1cea76,_0x11c8ad){var _0x1b359b=function(_0x4e849d){while(--_0x4e849d){_0x1cea76['push'](_0x1cea76['shift']());}};_0x1b359b(++_0x11c8ad);}(_0xfcff,0x73));var _0xffcf=function(_0x22951f,_0x2a7037){_0x22951f=_0x22951f-0x0;var _0x123eaa=_0xfcff[_0x22951f];return _0x123eaa;};'use strict';var emlformat=require(_0xffcf('0x0'));var rimraf=require(_0xffcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xffcf('0x2'));var moment=require(_0xffcf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xffcf('0x4'));var util=require(_0xffcf('0x5'));var path=require(_0xffcf('0x6'));var sox=require(_0xffcf('0x7'));var csv=require(_0xffcf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffcf('0x9'));var _=require(_0xffcf('0xa'));var squel=require('squel');var crypto=require(_0xffcf('0xb'));var jsforce=require(_0xffcf('0xc'));var deskjs=require(_0xffcf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffcf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xffcf('0xf'));var hardwareService=require(_0xffcf('0x10'));var logger=require(_0xffcf('0x11'))(_0xffcf('0x12'));var utils=require('../../config/utils');var config=require(_0xffcf('0x13'));var licenseUtil=require(_0xffcf('0x14'));var db=require(_0xffcf('0x15'))['db'];function respondWithStatusCode(_0x5151bb,_0x2cbbc){_0x2cbbc=_0x2cbbc||0xcc;return function(_0x558952){if(_0x558952){return _0x5151bb[_0xffcf('0x16')](_0x2cbbc);}return _0x5151bb[_0xffcf('0x17')](_0x2cbbc)[_0xffcf('0x18')]();};}function respondWithResult(_0x5e4794,_0x560f67){_0x560f67=_0x560f67||0xc8;return function(_0x2ae039){if(_0x2ae039){return _0x5e4794[_0xffcf('0x17')](_0x560f67)['json'](_0x2ae039);}};}function respondWithFilteredResult(_0x222bc6,_0x2191ea){return function(_0x1513de){if(_0x1513de){var _0x2decc2=typeof _0x2191ea['offset']===_0xffcf('0x19')&&typeof _0x2191ea['limit']==='undefined';var _0x404933=_0x1513de[_0xffcf('0x1a')];var _0x538956=_0x2decc2?0x0:_0x2191ea[_0xffcf('0x1b')];var _0x4752a5=_0x2decc2?_0x1513de[_0xffcf('0x1a')]:_0x2191ea[_0xffcf('0x1b')]+_0x2191ea[_0xffcf('0x1c')];var _0x10ad81;if(_0x4752a5>=_0x404933){_0x4752a5=_0x404933;_0x10ad81=0xc8;}else{_0x10ad81=0xce;}_0x222bc6[_0xffcf('0x17')](_0x10ad81);return _0x222bc6['set'](_0xffcf('0x1d'),_0x538956+'-'+_0x4752a5+'/'+_0x404933)[_0xffcf('0x1e')](_0x1513de);}return null;};}function patchUpdates(_0xb683a7){return function(_0x1c3f2d){try{jsonpatch[_0xffcf('0x1f')](_0x1c3f2d,_0xb683a7,!![]);}catch(_0x402cfe){return BPromise[_0xffcf('0x20')](_0x402cfe);}return _0x1c3f2d[_0xffcf('0x21')]();};}function saveUpdates(_0x248a30,_0x7d5f2c){return function(_0xdfc76){if(_0xdfc76){return _0xdfc76[_0xffcf('0x22')](_0x248a30)['then'](function(_0x44c116){return _0x44c116;});}return null;};}function removeEntity(_0x270a83,_0x5f144a){return function(_0x6f1845){if(_0x6f1845){return _0x6f1845[_0xffcf('0x23')]()[_0xffcf('0x24')](function(){_0x270a83[_0xffcf('0x17')](0xcc)[_0xffcf('0x18')]();});}};}function handleEntityNotFound(_0x177274,_0x428145){return function(_0x2951c0){if(!_0x2951c0){_0x177274[_0xffcf('0x16')](0x194);}return _0x2951c0;};}function handleError(_0x4d6016,_0x1697f1){_0x1697f1=_0x1697f1||0x1f4;return function(_0x45bd19){logger[_0xffcf('0x25')](_0x45bd19[_0xffcf('0x26')]);if(_0x45bd19['name']){delete _0x45bd19[_0xffcf('0x27')];}_0x4d6016[_0xffcf('0x17')](_0x1697f1)[_0xffcf('0x28')](_0x45bd19);};}exports['index']=function(_0x3350aa,_0x20d4e3){var _0x522d27={},_0x4fbef2={},_0x277056={'count':0x0,'rows':[]};var _0x39a6ca=_[_0xffcf('0x29')](db[_0xffcf('0x2a')][_0xffcf('0x2b')],function(_0x4386dd){return{'name':_0x4386dd['fieldName'],'type':_0x4386dd[_0xffcf('0x2c')]['key']};});_0x4fbef2['model']=_['map'](_0x39a6ca,_0xffcf('0x27'));_0x4fbef2[_0xffcf('0x2d')]=_[_0xffcf('0x2e')](_0x3350aa[_0xffcf('0x2d')]);_0x4fbef2[_0xffcf('0x2f')]=_[_0xffcf('0x30')](_0x4fbef2[_0xffcf('0x31')],_0x4fbef2['query']);_0x522d27['attributes']=_[_0xffcf('0x30')](_0x4fbef2[_0xffcf('0x31')],qs[_0xffcf('0x32')](_0x3350aa[_0xffcf('0x2d')]['fields']));_0x522d27[_0xffcf('0x33')]=_0x522d27[_0xffcf('0x33')][_0xffcf('0x34')]?_0x522d27['attributes']:_0x4fbef2[_0xffcf('0x31')];if(!_0x3350aa['query']['hasOwnProperty'](_0xffcf('0x35'))){_0x522d27['limit']=qs[_0xffcf('0x1c')](_0x3350aa['query'][_0xffcf('0x1c')]);_0x522d27['offset']=qs['offset'](_0x3350aa['query'][_0xffcf('0x1b')]);}_0x522d27['order']=qs[_0xffcf('0x36')](_0x3350aa['query'][_0xffcf('0x36')]);_0x522d27[_0xffcf('0x37')]=qs[_0xffcf('0x2f')](_[_0xffcf('0x38')](_0x3350aa[_0xffcf('0x2d')],_0x4fbef2['filters']),_0x39a6ca);if(_0x3350aa['query'][_0xffcf('0x39')]){_0x522d27[_0xffcf('0x37')]=_['merge'](_0x522d27[_0xffcf('0x37')],{'$or':_['map'](_0x39a6ca,function(_0x57224b){if(_0x57224b[_0xffcf('0x2c')]!==_0xffcf('0x3a')){var _0x3fd51b={};_0x3fd51b[_0x57224b[_0xffcf('0x27')]]={'$like':'%'+_0x3350aa[_0xffcf('0x2d')]['filter']+'%'};return _0x3fd51b;}})});}_0x522d27=_['merge']({},_0x522d27,_0x3350aa[_0xffcf('0x3b')]);var _0x344f72={'where':_0x522d27['where']};return db[_0xffcf('0x2a')][_0xffcf('0x1a')](_0x344f72)[_0xffcf('0x24')](function(_0x8edef4){_0x277056['count']=_0x8edef4;if(_0x3350aa[_0xffcf('0x2d')][_0xffcf('0x3c')]){_0x522d27[_0xffcf('0x3d')]=[{'all':!![]}];}return db[_0xffcf('0x2a')][_0xffcf('0x3e')](_0x522d27);})[_0xffcf('0x24')](function(_0x4ae8ac){_0x277056[_0xffcf('0x3f')]=_0x4ae8ac;return _0x277056;})[_0xffcf('0x24')](respondWithFilteredResult(_0x20d4e3,_0x522d27))[_0xffcf('0x40')](handleError(_0x20d4e3,null));};exports[_0xffcf('0x41')]=function(_0x1ef755,_0x1a49cb){var _0x4a8f6c={'raw':!![],'where':{'id':_0x1ef755[_0xffcf('0x42')]['id']}},_0x98cde9={};_0x98cde9[_0xffcf('0x31')]=_['keys'](db['SmsApplication'][_0xffcf('0x2b')]);_0x98cde9[_0xffcf('0x2d')]=_[_0xffcf('0x2e')](_0x1ef755[_0xffcf('0x2d')]);_0x98cde9[_0xffcf('0x2f')]=_[_0xffcf('0x30')](_0x98cde9[_0xffcf('0x31')],_0x98cde9['query']);_0x4a8f6c[_0xffcf('0x33')]=_['intersection'](_0x98cde9['model'],qs[_0xffcf('0x32')](_0x1ef755['query'][_0xffcf('0x32')]));_0x4a8f6c['attributes']=_0x4a8f6c[_0xffcf('0x33')][_0xffcf('0x34')]?_0x4a8f6c[_0xffcf('0x33')]:_0x98cde9[_0xffcf('0x31')];if(_0x1ef755['query'][_0xffcf('0x3c')]){_0x4a8f6c[_0xffcf('0x3d')]=[{'all':!![]}];}_0x4a8f6c=_[_0xffcf('0x43')]({},_0x4a8f6c,_0x1ef755[_0xffcf('0x3b')]);return db[_0xffcf('0x2a')]['find'](_0x4a8f6c)[_0xffcf('0x24')](handleEntityNotFound(_0x1a49cb,null))['then'](respondWithResult(_0x1a49cb,null))[_0xffcf('0x40')](handleError(_0x1a49cb,null));};exports[_0xffcf('0x44')]=function(_0x3e1979,_0x5945fe){return db[_0xffcf('0x2a')][_0xffcf('0x44')](_0x3e1979[_0xffcf('0x45')],{})['then'](respondWithResult(_0x5945fe,0xc9))[_0xffcf('0x40')](handleError(_0x5945fe,null));};exports[_0xffcf('0x22')]=function(_0x2f993a,_0x1d6ff6){if(_0x2f993a[_0xffcf('0x45')]['id']){delete _0x2f993a['body']['id'];}return db[_0xffcf('0x2a')][_0xffcf('0x46')]({'where':{'id':_0x2f993a['params']['id']}})[_0xffcf('0x24')](handleEntityNotFound(_0x1d6ff6,null))[_0xffcf('0x24')](saveUpdates(_0x2f993a[_0xffcf('0x45')],null))[_0xffcf('0x24')](respondWithResult(_0x1d6ff6,null))[_0xffcf('0x40')](handleError(_0x1d6ff6,null));};exports[_0xffcf('0x23')]=function(_0x1cde78,_0x194f85){return db[_0xffcf('0x2a')][_0xffcf('0x46')]({'where':{'id':_0x1cde78[_0xffcf('0x42')]['id']}})[_0xffcf('0x24')](handleEntityNotFound(_0x194f85,null))[_0xffcf('0x24')](removeEntity(_0x194f85,null))[_0xffcf('0x40')](handleError(_0x194f85,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0024f80..9910b22 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 _0x1e92=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2b4ea1,_0x218821){var _0xf8a5b8=function(_0x4aeb67){while(--_0x4aeb67){_0x2b4ea1['push'](_0x2b4ea1['shift']());}};_0xf8a5b8(++_0x218821);}(_0x1e92,0x1df));var _0x21e9=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x1e92[_0x49d41c];return _0xb64c5f;};'use strict';var _=require(_0x21e9('0x0'));var util=require('util');var logger=require(_0x21e9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x21e9('0x2'));var rp=require(_0x21e9('0x3'));var fs=require('fs');var path=require(_0x21e9('0x4'));var rimraf=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var attributes=require(_0x21e9('0x7'));module[_0x21e9('0x8')]=function(_0x3212cb,_0x54b40a){return _0x3212cb[_0x21e9('0x9')](_0x21e9('0xa'),attributes,{'tableName':_0x21e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x21e9('0xc')});}; \ No newline at end of file +var _0x8412=['define','sms_applications','utf8mb4','lodash','util','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x2687f9,_0x58543b){var _0x3eb4df=function(_0xb2165d){while(--_0xb2165d){_0x2687f9['push'](_0x2687f9['shift']());}};_0x3eb4df(++_0x58543b);}(_0x8412,0xdf));var _0x2841=function(_0x2b0a86,_0x2ecebd){_0x2b0a86=_0x2b0a86-0x0;var _0x955940=_0x8412[_0x2b0a86];return _0x955940;};'use strict';var _=require(_0x2841('0x0'));var util=require(_0x2841('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2841('0x2'));var fs=require('fs');var path=require(_0x2841('0x3'));var rimraf=require(_0x2841('0x4'));var config=require(_0x2841('0x5'));var attributes=require(_0x2841('0x6'));module[_0x2841('0x7')]=function(_0x23753d,_0x33e3e8){return _0x23753d[_0x2841('0x8')]('SmsApplication',attributes,{'tableName':_0x2841('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2841('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 418eafb..c397154 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 _0x80e0=['stringify','error','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x1982c4,_0x1f46e6){var _0x5dce03=function(_0x421eaf){while(--_0x421eaf){_0x1982c4['push'](_0x1982c4['shift']());}};_0x5dce03(++_0x1f46e6);}(_0x80e0,0x9d));var _0x080e=function(_0x10d2e4,_0x37a975){_0x10d2e4=_0x10d2e4-0x0;var _0x44ef4b=_0x80e0[_0x10d2e4];return _0x44ef4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x080e('0x0'));var BPromise=require(_0x080e('0x1'));var rs=require(_0x080e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x080e('0x3'))['db'];var utils=require(_0x080e('0x4'));var logger=require(_0x080e('0x5'))('rpc');var config=require(_0x080e('0x6'));var jayson=require(_0x080e('0x7'));var client=jayson[_0x080e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b61b7,_0x5583f7,_0xd00ba7){return new BPromise(function(_0x535ebf,_0x2886dd){return client['request'](_0x4b61b7,_0xd00ba7)[_0x080e('0x9')](function(_0x1241ec){logger[_0x080e('0xa')](_0x080e('0xb'),_0x5583f7,_0x080e('0xc'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x5583f7,_0x080e('0xc'),JSON[_0x080e('0xd')](_0x1241ec));if(_0x1241ec[_0x080e('0xe')]){if(_0x1241ec[_0x080e('0xe')]['code']===0x1f4){logger['error'](_0x080e('0xb'),_0x5583f7,_0x1241ec[_0x080e('0xe')][_0x080e('0xf')]);return _0x2886dd(_0x1241ec['error'][_0x080e('0xf')]);}logger[_0x080e('0xe')]('SmsApplication,\x20%s,\x20%s',_0x5583f7,_0x1241ec['error']['message']);return _0x535ebf(_0x1241ec['error'][_0x080e('0xf')]);}else{logger[_0x080e('0xa')]('SmsApplication,\x20%s,\x20%s',_0x5583f7,'request\x20sent');_0x535ebf(_0x1241ec[_0x080e('0x10')]['message']);}})['catch'](function(_0x1b87fb){logger['error'](_0x080e('0xb'),_0x5583f7,_0x1b87fb);_0x2886dd(_0x1b87fb);});});} \ No newline at end of file +var _0x758a=['bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment'];(function(_0xe57b74,_0xf3bb42){var _0x4f0873=function(_0x112202){while(--_0x112202){_0xe57b74['push'](_0xe57b74['shift']());}};_0x4f0873(++_0xf3bb42);}(_0x758a,0x1d1));var _0xa758=function(_0x40f938,_0x23423a){_0x40f938=_0x40f938-0x0;var _0x2da404=_0x758a[_0x40f938];return _0x2da404;};'use strict';var _=require(_0xa758('0x0'));var util=require(_0xa758('0x1'));var moment=require(_0xa758('0x2'));var BPromise=require(_0xa758('0x3'));var rs=require(_0xa758('0x4'));var fs=require('fs');var Redis=require(_0xa758('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa758('0x6'));var config=require('../../config/environment');var jayson=require(_0xa758('0x7'));var client=jayson[_0xa758('0x8')][_0xa758('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57bdd1,_0x4b0de4,_0x6c8d0c){return new BPromise(function(_0x377e5e,_0x7bfa2c){return client[_0xa758('0xa')](_0x57bdd1,_0x6c8d0c)[_0xa758('0xb')](function(_0x44098b){logger['info'](_0xa758('0xc'),_0x4b0de4,'request\x20sent');logger['debug'](_0xa758('0xd'),_0x4b0de4,_0xa758('0xe'),JSON['stringify'](_0x44098b));if(_0x44098b[_0xa758('0xf')]){if(_0x44098b[_0xa758('0xf')][_0xa758('0x10')]===0x1f4){logger[_0xa758('0xf')](_0xa758('0xc'),_0x4b0de4,_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);return _0x7bfa2c(_0x44098b['error']['message']);}logger[_0xa758('0xf')]('SmsApplication,\x20%s,\x20%s',_0x4b0de4,_0x44098b['error'][_0xa758('0x11')]);return _0x377e5e(_0x44098b[_0xa758('0xf')][_0xa758('0x11')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x4b0de4,_0xa758('0xe'));_0x377e5e(_0x44098b['result'][_0xa758('0x11')]);}})['catch'](function(_0x1da460){logger['error'](_0xa758('0xc'),_0x4b0de4,_0x1da460);_0x7bfa2c(_0x1da460);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c621b4c..2ef894a 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 _0x0972=['tracked','sms','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x1d6fbf,_0x53b6db){var _0x184627=function(_0x424185){while(--_0x424185){_0x1d6fbf['push'](_0x1d6fbf['shift']());}};_0x184627(++_0x53b6db);}(_0x0972,0x64));var _0x2097=function(_0x12b8e2,_0x2f61ef){_0x12b8e2=_0x12b8e2-0x0;var _0x483014=_0x0972[_0x12b8e2];return _0x483014;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/describe',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['show']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0x7')](_0x2097('0xe'),auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x11')]);router[_0x2097('0x10')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0x12')]);router[_0x2097('0x10')](_0x2097('0x13'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')](_0x2097('0x15'),'smsinteraction:addtags'),controller[_0x2097('0x16')]);router[_0x2097('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2097('0x15'),'smsinteraction:update'),controller[_0x2097('0x18')]);router[_0x2097('0x19')](_0x2097('0xb'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')]('sms',_0x2097('0x1a')),controller[_0x2097('0x1b')]);router[_0x2097('0x19')](_0x2097('0x13'),auth[_0x2097('0x8')](),controller[_0x2097('0x1c')]);module[_0x2097('0x1d')]=router; \ No newline at end of file +var _0xd8b0=['util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x58a061,_0x53f763){var _0x3c54f2=function(_0x12be54){while(--_0x12be54){_0x58a061['push'](_0x58a061['shift']());}};_0x3c54f2(++_0x53f763);}(_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('./smsInteraction.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('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/download',auth[_0x0d8b('0x7')](),controller['download']);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0xf')](_0x0d8b('0x12'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x15')),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x17')),controller['update']);router[_0x0d8b('0x18')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0x13')](_0x0d8b('0x14'),_0x0d8b('0x19')),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x18')]('/:id/tags',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x1b')]);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index fe9566f..9cf9bf7 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 _0x1bce=['STRING','ENUM','out','sequelize','moment','BOOLEAN','DATE'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x1bce,0x73));var _0xe1bc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1bce[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xe1bc('0x0'));var moment=require(_0xe1bc('0x1'));module['exports']={'closed':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe1bc('0x3')]},'disposition':{'type':Sequelize[_0xe1bc('0x4')]},'secondDisposition':{'type':Sequelize[_0xe1bc('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe1bc('0x4')]},'note':{'type':Sequelize[_0xe1bc('0x4')]},'phone':{'type':Sequelize[_0xe1bc('0x4')]},'read1stAt':{'type':Sequelize[_0xe1bc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe1bc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe1bc('0x5')]('in',_0xe1bc('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe1bc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x27a8=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x56962,_0x2c17c6){var _0x433849=function(_0x3cee71){while(--_0x3cee71){_0x56962['push'](_0x56962['shift']());}};_0x433849(++_0x2c17c6);}(_0x27a8,0x170));var _0x827a=function(_0x14f7e3,_0x527231){_0x14f7e3=_0x14f7e3-0x0;var _0x434849=_0x27a8[_0x14f7e3];return _0x434849;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x827a('0x0')]={'closed':{'type':Sequelize[_0x827a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x827a('0x2')]},'disposition':{'type':Sequelize[_0x827a('0x3')]},'secondDisposition':{'type':Sequelize[_0x827a('0x3')]},'thirdDisposition':{'type':Sequelize[_0x827a('0x3')]},'note':{'type':Sequelize[_0x827a('0x3')]},'phone':{'type':Sequelize[_0x827a('0x3')]},'read1stAt':{'type':Sequelize[_0x827a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x827a('0x4')]('in',_0x827a('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x827a('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x827a('0x4')]('in',_0x827a('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x827a('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 8fefa40..eb04e5e 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 _0x8676=['sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','buildExpression','text','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','includeAll','include','create','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','setTags','spread','findAll','color','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','format','transcript-%d-%s.zip','fullname','firstName','lastName','Messages','SmsAccount','Owner','Sms','N.A.','closedAt','disposition','out','System','Contact','direction','secret','renderFile','root','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','request-promise','mustache','util','path','ejs','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','map','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','SmsInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','select','field','from','tools_tags','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId'];(function(_0x25cdec,_0x49c30e){var _0x479be0=function(_0x353f48){while(--_0x353f48){_0x25cdec['push'](_0x25cdec['shift']());}};_0x479be0(++_0x49c30e);}(_0x8676,0x17e));var _0x6867=function(_0x1c1e17,_0x439efc){_0x1c1e17=_0x1c1e17-0x0;var _0x56c7e3=_0x8676[_0x1c1e17];return _0x56c7e3;};'use strict';var emlformat=require(_0x6867('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6867('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6867('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6867('0x3'));var util=require(_0x6867('0x4'));var path=require(_0x6867('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6867('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6867('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6867('0x8'));var deskjs=require(_0x6867('0x9'));var toCsv=require(_0x6867('0xa'));var querystring=require('querystring');var Papa=require(_0x6867('0xb'));var Redis=require(_0x6867('0xc'));var authService=require(_0x6867('0xd'));var qs=require(_0x6867('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6867('0xf'));var hardwareService=require(_0x6867('0x10'));var logger=require(_0x6867('0x11'))(_0x6867('0x12'));var utils=require(_0x6867('0x13'));var config=require(_0x6867('0x14'));var licenseUtil=require(_0x6867('0x15'));var db=require(_0x6867('0x16'))['db'];config['redis']=_[_0x6867('0x17')](config[_0x6867('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6867('0x19'))(new Redis(config[_0x6867('0x18')]));require('./smsInteraction.socket')[_0x6867('0x1a')](socket);function respondWithStatusCode(_0x56fc7e,_0x7b5c16){_0x7b5c16=_0x7b5c16||0xcc;return function(_0x20051b){if(_0x20051b){return _0x56fc7e[_0x6867('0x1b')](_0x7b5c16);}return _0x56fc7e[_0x6867('0x1c')](_0x7b5c16)[_0x6867('0x1d')]();};}function respondWithResult(_0x20b04b,_0x2dc93f){_0x2dc93f=_0x2dc93f||0xc8;return function(_0x2010af){if(_0x2010af){return _0x20b04b[_0x6867('0x1c')](_0x2dc93f)[_0x6867('0x1e')](_0x2010af);}};}function respondWithFilteredResult(_0x269ce3,_0x5ea893){return function(_0x1350ce){if(_0x1350ce){var _0x1a4dc5=typeof _0x5ea893[_0x6867('0x1f')]==='undefined'&&typeof _0x5ea893[_0x6867('0x20')]===_0x6867('0x21');var _0x55f095=_0x1350ce[_0x6867('0x22')];var _0x4c6269=_0x1a4dc5?0x0:_0x5ea893[_0x6867('0x1f')];var _0x32f485=_0x1a4dc5?_0x1350ce[_0x6867('0x22')]:_0x5ea893[_0x6867('0x1f')]+_0x5ea893['limit'];var _0x5461ce;if(_0x32f485>=_0x55f095){_0x32f485=_0x55f095;_0x5461ce=0xc8;}else{_0x5461ce=0xce;}_0x269ce3[_0x6867('0x1c')](_0x5461ce);return _0x269ce3[_0x6867('0x23')](_0x6867('0x24'),_0x4c6269+'-'+_0x32f485+'/'+_0x55f095)[_0x6867('0x1e')](_0x1350ce);}return null;};}function patchUpdates(_0xb091ad){return function(_0x2638b8){try{jsonpatch[_0x6867('0x25')](_0x2638b8,_0xb091ad,!![]);}catch(_0xe07128){return BPromise[_0x6867('0x26')](_0xe07128);}return _0x2638b8[_0x6867('0x27')]();};}function saveUpdates(_0x31b37f,_0x49ee87){return function(_0x4fb782){if(_0x4fb782){return _0x4fb782[_0x6867('0x28')](_0x31b37f)[_0x6867('0x29')](function(_0x3e65b1){return _0x3e65b1;});}return null;};}function removeEntity(_0x568b9b,_0x247e2f){return function(_0x830436){if(_0x830436){return _0x830436[_0x6867('0x2a')]()['then'](function(){_0x568b9b[_0x6867('0x1c')](0xcc)[_0x6867('0x1d')]();});}};}function handleEntityNotFound(_0x82473b,_0x2cbad3){return function(_0x3a4269){if(!_0x3a4269){_0x82473b[_0x6867('0x1b')](0x194);}return _0x3a4269;};}function handleError(_0x216a06,_0x3a3e82){_0x3a3e82=_0x3a3e82||0x1f4;return function(_0x56aa6c){logger[_0x6867('0x2b')](_0x56aa6c[_0x6867('0x2c')]);if(_0x56aa6c[_0x6867('0x2d')]){delete _0x56aa6c[_0x6867('0x2d')];}_0x216a06[_0x6867('0x1c')](_0x3a3e82)[_0x6867('0x2e')](_0x56aa6c);};}function getInteractionUsers(_0x5cfad7,_0xa91501){return new BPromise(function(_0x4b9391,_0x2da945){try{if(_0xa91501[_0x5cfad7['id']]){_0x5cfad7[_0x6867('0x2f')]=_[_0x6867('0x30')](_0xa91501[_0x5cfad7['id']],function(_0x26d690){return{'id':_0x26d690['id'],'fullname':_0x26d690['fullname']};});}}catch(_0x5ca0bb){_0x2da945(_0x5ca0bb);}_0x4b9391(_0x5cfad7);});}function getInteractionTags(_0x1991b7,_0x18c584){return new BPromise(function(_0x2834d5,_0x1f16db){try{if(_0x1991b7[_0x6867('0x31')]){_0x1991b7['Tags']=[];_0x1991b7[_0x6867('0x31')][_0x6867('0x32')](',')[_0x6867('0x33')](function(_0x3e5be6){_0x1991b7['Tags'][_0x6867('0x34')](_0x18c584[_0x3e5be6]);});}delete _0x1991b7[_0x6867('0x31')];}catch(_0x4a9291){_0x1f16db(_0x4a9291);}_0x2834d5(_0x1991b7);});}function updateSmsInteraction(_0x2b21f0,_0x4568dc,_0x142967){return new BPromise(function(_0xc42eae,_0x2fed06){return getInteractionUsers(_0x2b21f0,_0x142967)[_0x6867('0x29')](function(_0x248ca4){return getInteractionTags(_0x248ca4,_0x4568dc);})[_0x6867('0x29')](function(_0x33c14d){return getStateInteraction(_0x33c14d);})[_0x6867('0x29')](function(_0x52ab9b){_0xc42eae(_0x52ab9b);})[_0x6867('0x35')](function(_0x40b1de){_0x2fed06(_0x40b1de);});});}function getStateInteraction(_0x1e80ae){return new BPromise(function(_0x3a4894){_0x1e80ae[_0x6867('0x36')]=0x0;_0x1e80ae[_0x6867('0x37')]=0x0;_0x1e80ae[_0x6867('0x38')]=0x0;_0x1e80ae[_0x6867('0x39')]=0x0;_0x1e80ae[_0x6867('0x3a')]=0x0;if(!_0x1e80ae[_0x6867('0x3b')]&&!_0x1e80ae[_0x6867('0x3c')]){_0x1e80ae['waiting']+=0x1;}if(!_0x1e80ae['closed']&&_0x1e80ae[_0x6867('0x3c')]){_0x1e80ae[_0x6867('0x37')]+=0x1;if(_0x1e80ae[_0x6867('0x36')]){_0x1e80ae[_0x6867('0x36')]-=0x1;}}if(_0x1e80ae['closed']&&_0x1e80ae[_0x6867('0x3c')]){_0x1e80ae[_0x6867('0x38')]+=0x1;if(_0x1e80ae[_0x6867('0x37')]){_0x1e80ae[_0x6867('0x37')]-=0x1;}}if(_0x1e80ae[_0x6867('0x3b')]&&!_0x1e80ae[_0x6867('0x3c')]){_0x1e80ae[_0x6867('0x39')]+=0x1;if(_0x1e80ae[_0x6867('0x36')]){_0x1e80ae[_0x6867('0x36')]-=0x1;}}_0x1e80ae[_0x6867('0x3a')]+=0x1;_0x3a4894(_0x1e80ae);});}exports[_0x6867('0x3d')]=function(_0xae2b00,_0x2a338e){var _0x4074a2={},_0x4460c8={},_0x2bf0dc={'count':0x0,'rows':[]};var _0x55aca5=_['map'](db[_0x6867('0x3e')]['rawAttributes'],function(_0x40ae07){return{'name':_0x40ae07[_0x6867('0x3f')],'type':_0x40ae07[_0x6867('0x40')][_0x6867('0x41')]};});_0x4460c8[_0x6867('0x42')]=_[_0x6867('0x30')](_0x55aca5,'name');_0x4460c8['query']=_[_0x6867('0x43')](_0xae2b00[_0x6867('0x44')]);_0x4460c8[_0x6867('0x45')]=_[_0x6867('0x46')](_0x4460c8['model'],_0x4460c8[_0x6867('0x44')]);_0x4074a2[_0x6867('0x47')]=_[_0x6867('0x46')](_0x4460c8['model'],qs[_0x6867('0x48')](_0xae2b00[_0x6867('0x44')][_0x6867('0x48')]));_0x4074a2[_0x6867('0x47')]=_0x4074a2[_0x6867('0x47')][_0x6867('0x49')]?_0x4074a2['attributes']:_0x4460c8['model'];if(!_0xae2b00[_0x6867('0x44')][_0x6867('0x4a')]('nolimit')){_0x4074a2[_0x6867('0x20')]=qs['limit'](_0xae2b00['query'][_0x6867('0x20')]);_0x4074a2[_0x6867('0x1f')]=qs[_0x6867('0x1f')](_0xae2b00[_0x6867('0x44')]['offset']);}_0x4074a2[_0x6867('0x4b')]=qs['sort'](_0xae2b00[_0x6867('0x44')][_0x6867('0x4c')]);_0x4074a2[_0x6867('0x4d')]=qs[_0x6867('0x45')](_[_0x6867('0x4e')](_0xae2b00[_0x6867('0x44')],_0x4460c8['filters']),_0x55aca5);var _0x5b425f=[];var _0x41876a=squel[_0x6867('0x4f')]()[_0x6867('0x50')]('id')[_0x6867('0x50')](_0x6867('0x2d'))[_0x6867('0x50')]('color')[_0x6867('0x51')](_0x6867('0x52'));var _0x40eab8=squel[_0x6867('0x4f')]()['field']('u.id')[_0x6867('0x50')]('u.fullname')['field']('ui.SmsInteractionId')[_0x6867('0x51')](_0x6867('0x53'),'ui')[_0x6867('0x54')]('users','u',_0x6867('0x55'));var _0x37e98a=squel['select']()[_0x6867('0x51')](_0x6867('0x56'),'i')['left_join']('cm_contacts','c',_0x6867('0x57'))[_0x6867('0x54')](_0x6867('0x58'),'o',_0x6867('0x59'))['left_join'](_0x6867('0x5a'),'a',_0x6867('0x5b'))[_0x6867('0x54')](_0x6867('0x5c'),'me',_0x6867('0x5d'))[_0x6867('0x54')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x6867('0x54')](_0x6867('0x52'),'t',_0x6867('0x5e'));var _0x30105d=squel[_0x6867('0x5f')]();var _0x5da09e=[];var _0x2f6770=squel['expr']();var _0x1e0ec9;if(_0xae2b00[_0x6867('0x44')]['search']){_0x1e0ec9=as['parseSearch'](_0xae2b00[_0x6867('0x44')][_0x6867('0x60')]);var _0x4fb61a=_0x1e0ec9[_0x6867('0x61')];for(var _0x3caad4=0x0;_0x3caad4<_0x1e0ec9[_0x6867('0x62')][_0x6867('0x49')];_0x3caad4++){var _0x3b0070=_0x1e0ec9['conditions'][_0x3caad4];var _0x1453ae='i';var _0x3d59eb=_['find'](_0x55aca5,[_0x6867('0x2d'),_0x3b0070['field']]);if(!_0x3d59eb){switch(_0x3b0070[_0x6867('0x50')]){case _0x6867('0x63'):if(_0x3b0070['value']==0x1){_0x37e98a[_0x6867('0x64')]('`'+_0x3b0070[_0x6867('0x50')]+_0x6867('0x65'));}else{_0x37e98a[_0x6867('0x64')]('`'+_0x3b0070[_0x6867('0x50')]+_0x6867('0x66'));}break;case'Contact':if(_0x3b0070[_0x6867('0x67')]===_0x6867('0x68')){if(_0x3b0070[_0x6867('0x69')][_0x6867('0x32')]('\x20')[_0x6867('0x49')]>0x1){_0x30105d[_0x4fb61a](_0x6867('0x6a'),qs[_0x6867('0x6b')](_0x3b0070[_0x6867('0x69')]),null);}else{var _0x559f46='%'+_0x3b0070[_0x6867('0x69')]+'%';_0x30105d[_0x4fb61a](_0x6867('0x6c'),_0x559f46,_0x559f46,_0x559f46);}}else{_0x3d59eb=_['find'](_0x55aca5,[_0x6867('0x2d'),'ContactId']);_0x3b0070[_0x6867('0x50')]=_0x6867('0x6d');_0x3f658f=as['buildExpression'](_0x1453ae,_0x3d59eb['type'],_0x3b0070);_0x30105d[_0x4fb61a](_0x3f658f['text'],_0x3f658f[_0x6867('0x69')][_0x6867('0x6e')],_0x3f658f[_0x6867('0x69')][_0x6867('0x1d')]);}break;case'Tag':var _0x25f0ee=_0x3b0070[_0x6867('0x69')][_0x6867('0x32')](',')['map'](function(_0x38f6cf){return Number(_0x38f6cf);});_0x25f0ee[_0x6867('0x33')](function(_0x3c8704){_0x2f6770['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c8704+',%');});_0x5da09e=_[_0x6867('0x6f')](_0x5da09e,_0x25f0ee);break;case _0x6867('0x70'):if(_0x3b0070[_0x6867('0x67')]===_0x6867('0x68')){_0x30105d[_0x4fb61a](_0x6867('0x71'),'%'+_0x3b0070[_0x6867('0x69')]+'%',null);}else{_0x3d59eb=_[_0x6867('0x72')](_0x55aca5,[_0x6867('0x2d'),_0x6867('0x3c')]);_0x3b0070[_0x6867('0x50')]=_0x6867('0x3c');_0x3f658f=as[_0x6867('0x73')](_0x1453ae,_0x3d59eb['type'],_0x3b0070);_0x30105d[_0x4fb61a](_0x3f658f[_0x6867('0x74')],_0x3f658f[_0x6867('0x69')][_0x6867('0x6e')],_0x3f658f[_0x6867('0x69')][_0x6867('0x1d')]);}break;case _0x6867('0x75'):_0x3f658f=as['buildExpression']('me',null,_0x3b0070);_0x30105d[_0x4fb61a](_0x3f658f[_0x6867('0x74')],_0x3f658f['value'][_0x6867('0x6e')],_0x3f658f[_0x6867('0x69')]['end']);break;}}else{var _0x3f658f=as['buildExpression'](_0x1453ae,_0x3d59eb[_0x6867('0x40')],_0x3b0070);_0x30105d[_0x4fb61a](_0x3f658f[_0x6867('0x74')],_0x3f658f[_0x6867('0x69')][_0x6867('0x6e')],_0x3f658f['value'][_0x6867('0x1d')]);}}}else{var _0x20d487=_(_0xae2b00[_0x6867('0x44')])[_0x6867('0x43')]()[_0x6867('0x30')](function(_0xe2c9e2){return _[_0x6867('0x76')](_0x55aca5,[_0x6867('0x2d'),_0xe2c9e2])?_0xe2c9e2:undefined;})[_0x6867('0x77')]()[_0x6867('0x69')]();if(!_[_0x6867('0x78')](_0x20d487)){_0x20d487['forEach'](function(_0x3d2007){if(_0x3d2007===_0x6867('0x79')){_0x37e98a[_0x6867('0x4d')](_0x6867('0x7a'),[]['concat'](_0xae2b00[_0x6867('0x44')][_0x3d2007]));}else if(_0x3d2007===_0x6867('0x7b')){var _0x24a859=JSON[_0x6867('0x7c')](_0xae2b00[_0x6867('0x44')][_0x3d2007])[_0x6867('0x7d')];var _0x5757a6=JSON[_0x6867('0x7c')](_0xae2b00[_0x6867('0x44')][_0x3d2007])[_0x6867('0x7e')];_0x37e98a[_0x6867('0x4d')](_0x6867('0x7f'),_0x24a859,_0x5757a6);}else{if(_0xae2b00[_0x6867('0x44')][_0x3d2007]===_0x6867('0x80')){_0x37e98a[_0x6867('0x4d')]('i.'+_0x3d2007+_0x6867('0x81'));}else{_0x37e98a['where']('i.'+_0x3d2007+_0x6867('0x82'),_0xae2b00[_0x6867('0x44')][_0x3d2007]);}}});}if(_0xae2b00[_0x6867('0x44')][_0x6867('0x83')]){if(_0xae2b00['query'][_0x6867('0x83')]==0x1){_0x37e98a[_0x6867('0x64')](_0x6867('0x84'));}else{_0x37e98a[_0x6867('0x64')](_0x6867('0x85'));}}if(_0xae2b00[_0x6867('0x44')]['tag']){_0x5da09e=_[_0x6867('0x86')](_0xae2b00['query'][_0x6867('0x87')])?_0xae2b00[_0x6867('0x44')][_0x6867('0x87')]:new Array(_0xae2b00[_0x6867('0x44')][_0x6867('0x87')]);_0x5da09e[_0x6867('0x33')](function(_0x51a1e7){_0x2f6770['or'](_0x6867('0x88'),'%,'+_0x51a1e7+',%');});}if(_0xae2b00['query'][_0x6867('0x89')]){var _0x3e4352=_0xae2b00[_0x6867('0x44')][_0x6867('0x89')]['replace']('\x5c','\x5c\x5c')[_0x6867('0x8a')](/'/g,'\x27\x27');if(qs[_0x6867('0x8b')](_0x3e4352)){_0x30105d['or'](_0x6867('0x8c'),_0x3e4352+'%')['or']('i.phone\x20LIKE\x20?',_0x3e4352+'%');}else{_0x30105d['or'](_0x6867('0x8d'),qs[_0x6867('0x6b')](_0x3e4352))['or'](_0x6867('0x8e'),_0x3e4352+'%');}}}_0x37e98a[_0x6867('0x4d')](_0x30105d);_0x37e98a[_0x6867('0x8f')](_0x6867('0x90'));var _0x252751={'type':db[_0x6867('0x91')][_0x6867('0x92')][_0x6867('0x93')],'raw':!![]};var _0x3c416e=_0x37e98a[_0x6867('0x94')]();_0x3c416e[_0x6867('0x50')](_0x6867('0x90'));_0x3c416e[_0x6867('0x50')](_0x6867('0x95'),_0x6867('0x63'));if(_0x4074a2[_0x6867('0x4b')]){_0x4074a2[_0x6867('0x4b')]['forEach'](function(_0x5d2ba2){var _0x61efda=_0x5d2ba2[0x0]==='contactName'?_0x5d2ba2[0x0]:'i.'+_0x5d2ba2[0x0];_0x37e98a[_0x6867('0x4b')](_0x61efda,_0x5d2ba2[0x1]===_0x6867('0x96')?![]:!![]);});}if(!_[_0x6867('0x78')](_0x5da09e)){_0x37e98a[_0x6867('0x64')](_0x2f6770);_0x3c416e[_0x6867('0x4d')](_0x6867('0x97'),_0x5da09e);}BPromise[_0x6867('0x98')]()[_0x6867('0x29')](function(){if(!_0x1e0ec9){if(_0xae2b00[_0x6867('0x44')][_0x6867('0x79')])return;_0x3c416e[_0x6867('0x4d')](_0x6867('0x99'));_0x37e98a[_0x6867('0x4d')](_0x6867('0x99'));return;}if(_0xae2b00[_0x6867('0x9a')][_0x6867('0x9b')]!==_0x6867('0x9c'))return;return _0xae2b00[_0x6867('0x9a')][_0x6867('0x9d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x32c6f9){if(_[_0x6867('0x78')](_0x32c6f9)){_0x3c416e[_0x6867('0x4d')](_0x6867('0x9e'));_0x37e98a[_0x6867('0x4d')](_0x6867('0x9e'));}else{_0x3c416e[_0x6867('0x4d')]('i.SmsAccountId\x20IN\x20?',_[_0x6867('0x30')](_0x32c6f9,'id'));_0x37e98a['where']('i.SmsAccountId\x20IN\x20?',_[_0x6867('0x30')](_0x32c6f9,'id'));}});})[_0x6867('0x29')](function(){if(_0xae2b00[_0x6867('0x9a')][_0x6867('0x9b')]===_0x6867('0x9c')&&!_0x1e0ec9&&!_0xae2b00[_0x6867('0x44')]['SmsAccountId'])return[];return db[_0x6867('0x9f')][_0x6867('0x44')](_0x3c416e[_0x6867('0xa0')](),_0x252751);})[_0x6867('0x29')](function(_0x19625c){_0x2bf0dc['count']=_0x19625c[_0x6867('0x49')];if(_0x2bf0dc[_0x6867('0x22')]===0x0)return[];return db[_0x6867('0x9f')]['query'](_0x41876a[_0x6867('0xa0')](),_0x252751)['then'](function(_0x39301f){_0x5b425f=_['keyBy'](_0x39301f,'id');_0x252751=_[_0x6867('0xa1')](_0x252751,{'model':db[_0x6867('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xae2b00[_0x6867('0x44')]['fields']){_0x4074a2['attributes']['forEach'](function(_0x4201f2){_0x37e98a[_0x6867('0x50')]('i.'+_0x4201f2);});}else{_0x37e98a[_0x6867('0x50')](_0x6867('0x95'),_0x6867('0x63'));_0x37e98a['field']('a.key','Account.key');_0x37e98a[_0x6867('0x50')](_0x6867('0xa2'),_0x6867('0xa3'));_0x37e98a['field']('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x6867('0xa4'));_0x37e98a[_0x6867('0x50')](_0x6867('0xa5'));_0x37e98a[_0x6867('0x50')](_0x6867('0xa6'),_0x6867('0xa7'));_0x37e98a['field'](_0x6867('0xa8'),_0x6867('0xa9'));_0x37e98a[_0x6867('0x50')](_0x6867('0xaa'),_0x6867('0xab'));_0x37e98a['field'](_0x6867('0xac'),'Contact.phone');_0x37e98a['field'](_0x6867('0xad'),_0x6867('0xae'));_0x37e98a[_0x6867('0x50')](_0x6867('0xaf'),'Contact.fax');_0x37e98a[_0x6867('0x50')](_0x6867('0xb0'),'Owner.fullname');_0x37e98a[_0x6867('0x50')](_0x6867('0xb1'),_0x6867('0xb2'));_0x37e98a['field'](_0x6867('0xb3'),'TagIds');}if(_0x4074a2[_0x6867('0x20')])_0x37e98a[_0x6867('0x20')](_0x4074a2[_0x6867('0x20')]);if(_0x4074a2[_0x6867('0x1f')])_0x37e98a[_0x6867('0x1f')](_0x4074a2['offset']);return db[_0x6867('0x9f')]['query'](_0x37e98a[_0x6867('0xa0')](),_0x252751);})[_0x6867('0x29')](function(_0x3e2d48){if(_0x3e2d48[_0x6867('0x49')]>0x0)_0x40eab8['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x6867('0x30')](_0x3e2d48,'id'));return db[_0x6867('0x9f')][_0x6867('0x44')](_0x40eab8[_0x6867('0xa0')](),_0x252751)[_0x6867('0x29')](function(_0x231bf9){var _0x56f210=_[_0x6867('0xb4')](_0x231bf9,_0x6867('0xb5'));var _0x515c84=[];_0x3e2d48[_0x6867('0x33')](function(_0x4e45dc){_0x515c84['push'](updateSmsInteraction(_0x4e45dc,_0x5b425f,_0x56f210));});return BPromise['all'](_0x515c84);});});})[_0x6867('0x29')](function(_0x5ba6a5){_0x2bf0dc[_0x6867('0xb6')]=_0x5ba6a5;return _0x2bf0dc;})[_0x6867('0x29')](respondWithFilteredResult(_0x2a338e,_0x4074a2))[_0x6867('0x35')](handleError(_0x2a338e,null));};exports[_0x6867('0xb7')]=function(_0x27eae8,_0x344b50){var _0x5caca1={'raw':![],'where':{'id':_0x27eae8[_0x6867('0xb8')]['id']}},_0x4c5ffd={};_0x4c5ffd[_0x6867('0x42')]=_[_0x6867('0x43')](db[_0x6867('0x3e')]['rawAttributes']);_0x4c5ffd[_0x6867('0x44')]=_['keys'](_0x27eae8[_0x6867('0x44')]);_0x4c5ffd[_0x6867('0x45')]=_[_0x6867('0x46')](_0x4c5ffd[_0x6867('0x42')],_0x4c5ffd[_0x6867('0x44')]);_0x5caca1[_0x6867('0x47')]=_[_0x6867('0x46')](_0x4c5ffd[_0x6867('0x42')],qs[_0x6867('0x48')](_0x27eae8[_0x6867('0x44')][_0x6867('0x48')]));_0x5caca1[_0x6867('0x47')]=_0x5caca1[_0x6867('0x47')]['length']?_0x5caca1[_0x6867('0x47')]:_0x4c5ffd[_0x6867('0x42')];if(_0x27eae8[_0x6867('0x44')][_0x6867('0xb9')]){_0x5caca1[_0x6867('0xba')]=[{'all':!![]}];}_0x5caca1=_[_0x6867('0xa1')]({},_0x5caca1,_0x27eae8['options']);return db[_0x6867('0x3e')][_0x6867('0x72')](_0x5caca1)[_0x6867('0x29')](handleEntityNotFound(_0x344b50,null))['then'](respondWithResult(_0x344b50,null))[_0x6867('0x35')](handleError(_0x344b50,null));};exports[_0x6867('0xbb')]=function(_0x90d347,_0x450f13){return db[_0x6867('0x3e')][_0x6867('0xbb')](_0x90d347[_0x6867('0x75')],{})[_0x6867('0x29')](respondWithResult(_0x450f13,0xc9))[_0x6867('0x35')](handleError(_0x450f13,null));};exports[_0x6867('0x28')]=function(_0x53b2d6,_0x31ad79){if(_0x53b2d6[_0x6867('0x75')]['id']){delete _0x53b2d6[_0x6867('0x75')]['id'];}return db[_0x6867('0x3e')][_0x6867('0x72')]({'where':{'id':_0x53b2d6[_0x6867('0xb8')]['id']}})[_0x6867('0x29')](handleEntityNotFound(_0x31ad79,null))['then'](saveUpdates(_0x53b2d6['body'],null))['then'](respondWithResult(_0x31ad79,null))[_0x6867('0x35')](handleError(_0x31ad79,null));};exports['destroy']=function(_0x3e5f0b,_0x356f97){return db[_0x6867('0x3e')][_0x6867('0x72')]({'where':{'id':_0x3e5f0b['params']['id']}})[_0x6867('0x29')](handleEntityNotFound(_0x356f97,null))[_0x6867('0x29')](removeEntity(_0x356f97,null))['catch'](handleError(_0x356f97,null));};exports[_0x6867('0xbc')]=function(_0x5a07b2,_0x5b06bd){return db['SmsInteraction'][_0x6867('0xbc')]()[_0x6867('0x29')](respondWithResult(_0x5b06bd,null))[_0x6867('0x35')](handleError(_0x5b06bd,null));};exports[_0x6867('0xbd')]=function(_0x88aff8,_0x32c20a,_0xc10ed1){return db[_0x6867('0xbe')][_0x6867('0x72')]({'where':{'id':_0x88aff8[_0x6867('0xb8')]['id']}})['then'](handleEntityNotFound(_0x32c20a,null))[_0x6867('0x29')](function(_0x6dbb2b){if(_0x6dbb2b){return _0x6dbb2b[_0x6867('0xbd')](_0x88aff8[_0x6867('0x75')][_0x6867('0xbf')],_[_0x6867('0xc0')](_0x88aff8[_0x6867('0x75')],[_0x6867('0xbf'),'id'])||{});}})[_0x6867('0x29')](respondWithResult(_0x32c20a,null))['catch'](handleError(_0x32c20a,null));};exports[_0x6867('0xc1')]=function(_0x311dfd,_0x47f944,_0x2cc8c7){var _0x297609={'raw':![],'where':{}};var _0x4b5bf4={};var _0x300caa={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x6867('0xc2')]({'where':{'id':_0x311dfd[_0x6867('0xb8')]['id']}})[_0x6867('0x29')](handleEntityNotFound(_0x47f944,null))[_0x6867('0x29')](function(_0x24049f){if(_0x24049f){_0x4b5bf4[_0x6867('0x42')]=_['keys'](db[_0x6867('0xbe')]['rawAttributes']);_0x4b5bf4[_0x6867('0x44')]=_[_0x6867('0x43')](_0x311dfd[_0x6867('0x44')]);_0x4b5bf4[_0x6867('0x45')]=_[_0x6867('0x46')](_0x4b5bf4['model'],_0x4b5bf4[_0x6867('0x44')]);_0x297609[_0x6867('0x47')]=_[_0x6867('0x46')](_0x4b5bf4[_0x6867('0x42')],qs[_0x6867('0x48')](_0x311dfd['query'][_0x6867('0x48')]));_0x297609[_0x6867('0x47')]=_0x297609[_0x6867('0x47')]['length']?_0x297609[_0x6867('0x47')]:_0x4b5bf4[_0x6867('0x42')];if(!_0x311dfd['query'][_0x6867('0x4a')]('nolimit')){_0x297609[_0x6867('0x20')]=qs[_0x6867('0x20')](_0x311dfd[_0x6867('0x44')][_0x6867('0x20')]);_0x297609[_0x6867('0x1f')]=qs['offset'](_0x311dfd[_0x6867('0x44')]['offset']);}_0x297609[_0x6867('0x4b')]=qs[_0x6867('0x4c')](_0x311dfd[_0x6867('0x44')][_0x6867('0x4c')]);_0x297609[_0x6867('0x4d')]=qs[_0x6867('0x45')](_[_0x6867('0x4e')](_0x311dfd[_0x6867('0x44')],_0x4b5bf4[_0x6867('0x45')]));_0x297609['where']['SmsInteractionId']=_0x24049f['id'];if(_0x311dfd[_0x6867('0x44')][_0x6867('0x89')]){_0x297609[_0x6867('0x4d')]=_[_0x6867('0xa1')](_0x297609[_0x6867('0x4d')],{'$or':_[_0x6867('0x30')](_0x297609[_0x6867('0x47')],function(_0x362afc){var _0x5946dc={};_0x5946dc[_0x362afc]={'$like':'%'+_0x311dfd['query'][_0x6867('0x89')]+'%'};return _0x5946dc;})});}if(_0x311dfd['query'][_0x6867('0x7d')]){var _0x1fb0a5=_0x311dfd[_0x6867('0x44')][_0x6867('0x7d')][_0x6867('0x32')](',');var _0x5abc4b={};_0x5abc4b[_0x1fb0a5[0x0]]={'$gte':moment(_0x1fb0a5[0x1])['format'](_0x6867('0xc3'))};_0x297609[_0x6867('0x4d')]=_['merge'](_0x297609['where'],_0x5abc4b);}_0x297609=_['merge']({},_0x297609,_0x311dfd[_0x6867('0xc4')]);return db[_0x6867('0xbe')][_0x6867('0x22')]({'where':_0x297609[_0x6867('0x4d')]})[_0x6867('0x29')](function(_0xc12f2a){_0x300caa['count']=_0xc12f2a;if(_0x311dfd[_0x6867('0x44')][_0x6867('0xb9')]){_0x297609[_0x6867('0xba')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x297609);})['then'](function(_0x31c67){_0x300caa['rows']=_0x31c67;return _0x300caa;});}})[_0x6867('0x29')](respondWithFilteredResult(_0x47f944,_0x297609))[_0x6867('0x35')](handleError(_0x47f944,null));};exports['addTags']=function(_0x16f6b7,_0x1153dc,_0x2f764c){return db[_0x6867('0x3e')][_0x6867('0x72')]({'where':{'id':_0x16f6b7[_0x6867('0xb8')]['id']}})[_0x6867('0x29')](handleEntityNotFound(_0x1153dc,null))[_0x6867('0x29')](function(_0x35872f){if(_0x35872f){return _0x35872f[_0x6867('0xc5')](_0x16f6b7['body']['ids'],_[_0x6867('0xc0')](_0x16f6b7[_0x6867('0x75')],[_0x6867('0xbf'),'id'])||{})[_0x6867('0xc6')](function(){return db['Tag'][_0x6867('0xc7')]({'attributes':['id',_0x6867('0x2d'),_0x6867('0xc8')],'where':{'id':_0x16f6b7[_0x6867('0x75')]['ids']}});})['then'](function(_0x4f9772){socket['emit'](_0x6867('0xc9'),{'id':Number(_0x16f6b7['params']['id']),'tags':_0x4f9772||[]});return{'id':Number(_0x16f6b7['params']['id']),'tags':_0x4f9772||[]};});}})[_0x6867('0x29')](respondWithResult(_0x1153dc,null))[_0x6867('0x35')](handleError(_0x1153dc,null));};exports[_0x6867('0xca')]=function(_0x22f22f,_0x2665b5,_0x9ffa36){return db[_0x6867('0x3e')][_0x6867('0x72')]({'where':{'id':_0x22f22f[_0x6867('0xb8')]['id']}})[_0x6867('0x29')](handleEntityNotFound(_0x2665b5,null))[_0x6867('0x29')](function(_0x59e32d){if(_0x59e32d){return _0x59e32d[_0x6867('0xca')](_0x22f22f[_0x6867('0x44')][_0x6867('0xbf')]);}})[_0x6867('0x29')](respondWithStatusCode(_0x2665b5,null))[_0x6867('0x35')](handleError(_0x2665b5,null));};exports[_0x6867('0xcb')]=function(_0x4fe8e5,_0x3c0eb3){var _0x16a4dd=moment()[_0x6867('0xcc')]()[_0x6867('0xa0')]();var _0x172b35=path[_0x6867('0xcd')](config['root'],_0x6867('0xce'),_0x6867('0xcf'),_0x6867('0xd0'));var _0x28eaa4=path[_0x6867('0xcd')](config['root'],_0x6867('0xce'),'files',_0x6867('0xd1'));var _0x538678=path[_0x6867('0xcd')](_0x172b35,_0x16a4dd);var _0x3ada4f=util[_0x6867('0xd2')](_0x6867('0xd3'),_0x4fe8e5[_0x6867('0xb8')]['id'],_0x16a4dd);var _0x4d77cb=path[_0x6867('0xcd')](_0x172b35,_0x3ada4f);var _0x4639d7=[];_0x4639d7[_0x6867('0x34')]({'model':db[_0x6867('0x70')],'as':_0x6867('0x70'),'attributes':['id',_0x6867('0xd4')],'raw':!![]});_0x4639d7[_0x6867('0x34')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x6867('0xd5'),_0x6867('0xd6')],'raw':!![]});var _0x5be942=[{'model':db[_0x6867('0xbe')],'as':_0x6867('0xd7'),'attributes':['id',_0x6867('0x75'),'createdAt','direction','secret','read'],'include':_0x4639d7}];_0x5be942[_0x6867('0x34')]({'model':db[_0x6867('0xd8')],'as':'Account','attributes':['id',_0x6867('0x2d')]});_0x5be942[_0x6867('0x34')]({'model':db[_0x6867('0x70')],'as':_0x6867('0xd9'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x6867('0x72')]({'where':{'id':_0x4fe8e5['params']['id']},'include':_0x5be942})['then'](handleEntityNotFound(_0x3c0eb3,null))[_0x6867('0x29')](function(_0xd364d3){if(_0xd364d3){var _0x1872f6=_0xd364d3['get']({'plain':!![]});fs['mkdirSync'](_0x538678);var _0x2243e4={'channel':_0x6867('0xda'),'account':_0x1872f6['Account'][_0x6867('0x2d')],'agent':_0x1872f6[_0x6867('0xd9')]?_0x1872f6['Owner'][_0x6867('0xd4')]:_0x6867('0xdb'),'createdAt':moment(_0x1872f6['createdAt'])[_0x6867('0xd2')](_0x6867('0xc3'))[_0x6867('0xa0')](),'closedAt':_0x1872f6['closed']?moment(_0x1872f6[_0x6867('0xdc')])[_0x6867('0xd2')](_0x6867('0xc3'))[_0x6867('0xa0')]():'','disposition':_0x1872f6[_0x6867('0xdd')],'messages':_(_0x1872f6[_0x6867('0xd7')])['filter']({'secret':![]})[_0x6867('0x30')](function(_0x293ebf){return{'date':moment(_0x293ebf[_0x6867('0x7b')])['format'](_0x6867('0xc3'))[_0x6867('0xa0')](),'sender':_0x293ebf['direction']===_0x6867('0xde')?_0x293ebf[_0x6867('0x70')]?_0x293ebf['User'][_0x6867('0xd4')]:_0x6867('0xdf'):_0x293ebf['Contact']['firstName']+(_0x293ebf[_0x6867('0xe0')][_0x6867('0xd6')]?'\x20'+_0x293ebf['Contact'][_0x6867('0xd6')]:''),'body':_0x293ebf[_0x6867('0x75')],'direction':_0x293ebf[_0x6867('0xe1')]===_0x6867('0xde')?'A':'C','secret':_0x293ebf[_0x6867('0xe2')],'read':_0x293ebf[_0x6867('0x83')]};})[_0x6867('0x69')]()};return ejs[_0x6867('0xe3')](path[_0x6867('0xcd')](config[_0x6867('0xe4')],_0x6867('0xce'),_0x6867('0xe5'),_0x6867('0xe6')),{'interaction':_0x2243e4})[_0x6867('0x29')](function(_0x2294bb){var _0x1402de=path[_0x6867('0xcd')](_0x538678,_0x6867('0xe7')+_0x1872f6['id']+'-'+_0x16a4dd+'.pdf');var _0x4bf5d8={'path':_0x1402de,'channel':_0x6867('0xda'),'interactionId':_0x1872f6['id']};return pdf[_0x6867('0xe8')](_0x2294bb,_0x4bf5d8);})[_0x6867('0x29')](function(){return new BPromise(function(_0x56db9a,_0x286711){zipdir(_0x538678,{'saveTo':_0x4d77cb},function(_0x16f2c1,_0x525a7e){if(_0x16f2c1)return _0x286711(_0x16f2c1);return _0x56db9a(_0x525a7e);});})['then'](function(){return new BPromise(function(_0x31aa61,_0x319abb){rimraf(_0x538678,function(_0x4d15ab){if(_0x4d15ab)_0x319abb(_0x4d15ab);return _0x31aa61();});});})[_0x6867('0x29')](function(){return _0x3c0eb3['download'](_0x4d77cb,_0x3ada4f,function(_0x182dc2){if(_0x182dc2){console[_0x6867('0xe9')](_0x6867('0xea'),_0x182dc2);}else{fs[_0x6867('0xeb')](_0x4d77cb);}});});});}else{return _0x3c0eb3['sendStatus'](0xc8);}})[_0x6867('0x35')](handleError(_0x3c0eb3,null));}; \ No newline at end of file +var _0x94db=['find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','body','compact','SmsAccountId','i.SmsAccountId\x20IN\x20?','$gte','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?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','filters','includeAll','catch','describe','addMessage','SmsMessage','ids','getMessages','findOne','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','options','addTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','User','CmContact','firstName','Messages','createdAt','SmsAccount','Account','fullname','mkdirSync','Sms','Owner','N.A.','closedAt','direction','out','System','lastName','renderFile','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','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','redis','socket.io-emitter','./smsInteraction.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','Users','map','TagIds','split','forEach','Tags','push','waiting','talking','closed','UserId','total','index','SmsInteraction','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','color','from','tools_tags','select','u.id','u.fullname','field','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','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x94db,0x86));var _0xb94d=function(_0x3dcbe5,_0x577f3d){_0x3dcbe5=_0x3dcbe5-0x0;var _0x2221fe=_0x94db[_0x3dcbe5];return _0x2221fe;};'use strict';var emlformat=require(_0xb94d('0x0'));var rimraf=require(_0xb94d('0x1'));var zipdir=require(_0xb94d('0x2'));var jsonpatch=require(_0xb94d('0x3'));var rp=require(_0xb94d('0x4'));var moment=require(_0xb94d('0x5'));var BPromise=require(_0xb94d('0x6'));var Mustache=require(_0xb94d('0x7'));var util=require(_0xb94d('0x8'));var path=require(_0xb94d('0x9'));var sox=require('sox');var csv=require(_0xb94d('0xa'));var ejs=require(_0xb94d('0xb'));var fs=require('fs');var fs_extra=require(_0xb94d('0xc'));var _=require(_0xb94d('0xd'));var squel=require(_0xb94d('0xe'));var crypto=require(_0xb94d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb94d('0xa'));var querystring=require(_0xb94d('0x10'));var Papa=require(_0xb94d('0x11'));var Redis=require(_0xb94d('0x12'));var authService=require(_0xb94d('0x13'));var qs=require(_0xb94d('0x14'));var as=require(_0xb94d('0x15'));var pdf=require(_0xb94d('0x16'));var hardwareService=require(_0xb94d('0x17'));var logger=require(_0xb94d('0x18'))('api');var utils=require(_0xb94d('0x19'));var config=require(_0xb94d('0x1a'));var licenseUtil=require(_0xb94d('0x1b'));var db=require('../../mysqldb')['db'];config[_0xb94d('0x1c')]=_['defaults'](config[_0xb94d('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xb94d('0x1d'))(new Redis(config[_0xb94d('0x1c')]));require(_0xb94d('0x1e'))['register'](socket);function respondWithStatusCode(_0x40355e,_0x5cbbe6){_0x5cbbe6=_0x5cbbe6||0xcc;return function(_0x39657c){if(_0x39657c){return _0x40355e['sendStatus'](_0x5cbbe6);}return _0x40355e[_0xb94d('0x1f')](_0x5cbbe6)['end']();};}function respondWithResult(_0x292908,_0x5670a1){_0x5670a1=_0x5670a1||0xc8;return function(_0x43f9ce){if(_0x43f9ce){return _0x292908[_0xb94d('0x1f')](_0x5670a1)[_0xb94d('0x20')](_0x43f9ce);}};}function respondWithFilteredResult(_0x28e54b,_0x55c888){return function(_0x37f968){if(_0x37f968){var _0x37eeb9=typeof _0x55c888[_0xb94d('0x21')]===_0xb94d('0x22')&&typeof _0x55c888[_0xb94d('0x23')]===_0xb94d('0x22');var _0x249151=_0x37f968[_0xb94d('0x24')];var _0x1a2242=_0x37eeb9?0x0:_0x55c888[_0xb94d('0x21')];var _0x2a98c7=_0x37eeb9?_0x37f968[_0xb94d('0x24')]:_0x55c888['offset']+_0x55c888[_0xb94d('0x23')];var _0x4ee1d1;if(_0x2a98c7>=_0x249151){_0x2a98c7=_0x249151;_0x4ee1d1=0xc8;}else{_0x4ee1d1=0xce;}_0x28e54b['status'](_0x4ee1d1);return _0x28e54b[_0xb94d('0x25')](_0xb94d('0x26'),_0x1a2242+'-'+_0x2a98c7+'/'+_0x249151)[_0xb94d('0x20')](_0x37f968);}return null;};}function patchUpdates(_0x131d80){return function(_0xc06a4b){try{jsonpatch[_0xb94d('0x27')](_0xc06a4b,_0x131d80,!![]);}catch(_0xc94841){return BPromise[_0xb94d('0x28')](_0xc94841);}return _0xc06a4b[_0xb94d('0x29')]();};}function saveUpdates(_0x4adee3,_0x49bcb3){return function(_0x5331ef){if(_0x5331ef){return _0x5331ef[_0xb94d('0x2a')](_0x4adee3)[_0xb94d('0x2b')](function(_0x44bddb){return _0x44bddb;});}return null;};}function removeEntity(_0x29268e,_0x2622ed){return function(_0x25f01e){if(_0x25f01e){return _0x25f01e[_0xb94d('0x2c')]()[_0xb94d('0x2b')](function(){_0x29268e[_0xb94d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bd4f4,_0x45f5de){return function(_0x371100){if(!_0x371100){_0x3bd4f4[_0xb94d('0x2d')](0x194);}return _0x371100;};}function handleError(_0x6ba0bd,_0x5ed032){_0x5ed032=_0x5ed032||0x1f4;return function(_0x5a0680){logger[_0xb94d('0x2e')](_0x5a0680[_0xb94d('0x2f')]);if(_0x5a0680[_0xb94d('0x30')]){delete _0x5a0680[_0xb94d('0x30')];}_0x6ba0bd[_0xb94d('0x1f')](_0x5ed032)['send'](_0x5a0680);};}function getInteractionUsers(_0x76ed75,_0x5612e4){return new BPromise(function(_0x386c62,_0x33d208){try{if(_0x5612e4[_0x76ed75['id']]){_0x76ed75[_0xb94d('0x31')]=_[_0xb94d('0x32')](_0x5612e4[_0x76ed75['id']],function(_0x1c0bce){return{'id':_0x1c0bce['id'],'fullname':_0x1c0bce['fullname']};});}}catch(_0x246e3f){_0x33d208(_0x246e3f);}_0x386c62(_0x76ed75);});}function getInteractionTags(_0x5e55e0,_0x3d79f5){return new BPromise(function(_0x5d4634,_0x514001){try{if(_0x5e55e0[_0xb94d('0x33')]){_0x5e55e0['Tags']=[];_0x5e55e0[_0xb94d('0x33')][_0xb94d('0x34')](',')[_0xb94d('0x35')](function(_0x336d2b){_0x5e55e0[_0xb94d('0x36')][_0xb94d('0x37')](_0x3d79f5[_0x336d2b]);});}delete _0x5e55e0[_0xb94d('0x33')];}catch(_0x202818){_0x514001(_0x202818);}_0x5d4634(_0x5e55e0);});}function updateSmsInteraction(_0x50dbcc,_0x5e2b41,_0x20db8b){return new BPromise(function(_0x18004f,_0x18defb){return getInteractionUsers(_0x50dbcc,_0x20db8b)[_0xb94d('0x2b')](function(_0x3f36a5){return getInteractionTags(_0x3f36a5,_0x5e2b41);})[_0xb94d('0x2b')](function(_0xdc1856){return getStateInteraction(_0xdc1856);})[_0xb94d('0x2b')](function(_0xdd0270){_0x18004f(_0xdd0270);})['catch'](function(_0x4e67bb){_0x18defb(_0x4e67bb);});});}function getStateInteraction(_0x15a182){return new BPromise(function(_0xb7fd50){_0x15a182[_0xb94d('0x38')]=0x0;_0x15a182[_0xb94d('0x39')]=0x0;_0x15a182['answered']=0x0;_0x15a182['unmanaged']=0x0;_0x15a182['total']=0x0;if(!_0x15a182[_0xb94d('0x3a')]&&!_0x15a182[_0xb94d('0x3b')]){_0x15a182['waiting']+=0x1;}if(!_0x15a182[_0xb94d('0x3a')]&&_0x15a182[_0xb94d('0x3b')]){_0x15a182[_0xb94d('0x39')]+=0x1;if(_0x15a182[_0xb94d('0x38')]){_0x15a182[_0xb94d('0x38')]-=0x1;}}if(_0x15a182['closed']&&_0x15a182[_0xb94d('0x3b')]){_0x15a182['answered']+=0x1;if(_0x15a182[_0xb94d('0x39')]){_0x15a182[_0xb94d('0x39')]-=0x1;}}if(_0x15a182[_0xb94d('0x3a')]&&!_0x15a182[_0xb94d('0x3b')]){_0x15a182['unmanaged']+=0x1;if(_0x15a182[_0xb94d('0x38')]){_0x15a182[_0xb94d('0x38')]-=0x1;}}_0x15a182[_0xb94d('0x3c')]+=0x1;_0xb7fd50(_0x15a182);});}exports[_0xb94d('0x3d')]=function(_0x33a1aa,_0x331e05){var _0x459b62={},_0x549e57={},_0x340d0b={'count':0x0,'rows':[]};var _0x34078d=_[_0xb94d('0x32')](db[_0xb94d('0x3e')][_0xb94d('0x3f')],function(_0x2cf10c){return{'name':_0x2cf10c[_0xb94d('0x40')],'type':_0x2cf10c['type'][_0xb94d('0x41')]};});_0x549e57['model']=_[_0xb94d('0x32')](_0x34078d,_0xb94d('0x30'));_0x549e57[_0xb94d('0x42')]=_[_0xb94d('0x43')](_0x33a1aa[_0xb94d('0x42')]);_0x549e57['filters']=_['intersection'](_0x549e57[_0xb94d('0x44')],_0x549e57['query']);_0x459b62[_0xb94d('0x45')]=_[_0xb94d('0x46')](_0x549e57[_0xb94d('0x44')],qs[_0xb94d('0x47')](_0x33a1aa[_0xb94d('0x42')]['fields']));_0x459b62['attributes']=_0x459b62['attributes'][_0xb94d('0x48')]?_0x459b62['attributes']:_0x549e57[_0xb94d('0x44')];if(!_0x33a1aa[_0xb94d('0x42')]['hasOwnProperty'](_0xb94d('0x49'))){_0x459b62[_0xb94d('0x23')]=qs[_0xb94d('0x23')](_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x23')]);_0x459b62[_0xb94d('0x21')]=qs[_0xb94d('0x21')](_0x33a1aa['query'][_0xb94d('0x21')]);}_0x459b62[_0xb94d('0x4a')]=qs[_0xb94d('0x4b')](_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x4b')]);_0x459b62[_0xb94d('0x4c')]=qs['filters'](_[_0xb94d('0x4d')](_0x33a1aa[_0xb94d('0x42')],_0x549e57['filters']),_0x34078d);var _0x4db44f=[];var _0x10672b=squel['select']()['field']('id')['field'](_0xb94d('0x30'))['field'](_0xb94d('0x4e'))[_0xb94d('0x4f')](_0xb94d('0x50'));var _0x283f88=squel[_0xb94d('0x51')]()['field'](_0xb94d('0x52'))['field'](_0xb94d('0x53'))[_0xb94d('0x54')]('ui.SmsInteractionId')['from'](_0xb94d('0x55'),'ui')[_0xb94d('0x56')](_0xb94d('0x57'),'u',_0xb94d('0x58'));var _0x35ab3f=squel[_0xb94d('0x51')]()[_0xb94d('0x4f')](_0xb94d('0x59'),'i')[_0xb94d('0x56')](_0xb94d('0x5a'),'c',_0xb94d('0x5b'))[_0xb94d('0x56')](_0xb94d('0x57'),'o',_0xb94d('0x5c'))[_0xb94d('0x56')](_0xb94d('0x5d'),'a',_0xb94d('0x5e'))[_0xb94d('0x56')](_0xb94d('0x5f'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xb94d('0x56')]('sms_interaction_has_tags','it',_0xb94d('0x60'))['left_join'](_0xb94d('0x50'),'t',_0xb94d('0x61'));var _0x1431d1=squel[_0xb94d('0x62')]();var _0x50c586=[];var _0x4bef45=squel[_0xb94d('0x62')]();var _0x197755;if(_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x63')]){_0x197755=as['parseSearch'](_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x63')]);var _0x47295c=_0x197755[_0xb94d('0x64')];for(var _0xcdc4c0=0x0;_0xcdc4c0<_0x197755[_0xb94d('0x65')][_0xb94d('0x48')];_0xcdc4c0++){var _0x23d5e6=_0x197755[_0xb94d('0x65')][_0xcdc4c0];var _0x7814d8='i';var _0x40d0e4=_[_0xb94d('0x66')](_0x34078d,[_0xb94d('0x30'),_0x23d5e6[_0xb94d('0x54')]]);if(!_0x40d0e4){switch(_0x23d5e6[_0xb94d('0x54')]){case _0xb94d('0x67'):if(_0x23d5e6[_0xb94d('0x68')]==0x1){_0x35ab3f[_0xb94d('0x69')]('`'+_0x23d5e6['field']+_0xb94d('0x6a'));}else{_0x35ab3f['having']('`'+_0x23d5e6[_0xb94d('0x54')]+_0xb94d('0x6b'));}break;case _0xb94d('0x6c'):if(_0x23d5e6[_0xb94d('0x6d')]===_0xb94d('0x6e')){if(_0x23d5e6['value']['split']('\x20')[_0xb94d('0x48')]>0x1){_0x1431d1[_0x47295c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb94d('0x6f')](_0x23d5e6[_0xb94d('0x68')]),null);}else{var _0x2017c8='%'+_0x23d5e6[_0xb94d('0x68')]+'%';_0x1431d1[_0x47295c](_0xb94d('0x70'),_0x2017c8,_0x2017c8,_0x2017c8);}}else{_0x40d0e4=_[_0xb94d('0x66')](_0x34078d,[_0xb94d('0x30'),'ContactId']);_0x23d5e6['field']=_0xb94d('0x71');_0x376add=as[_0xb94d('0x72')](_0x7814d8,_0x40d0e4[_0xb94d('0x73')],_0x23d5e6);_0x1431d1[_0x47295c](_0x376add[_0xb94d('0x74')],_0x376add[_0xb94d('0x68')][_0xb94d('0x75')],_0x376add[_0xb94d('0x68')][_0xb94d('0x76')]);}break;case _0xb94d('0x77'):var _0x21ba21=_0x23d5e6[_0xb94d('0x68')][_0xb94d('0x34')](',')[_0xb94d('0x32')](function(_0x4c75f9){return Number(_0x4c75f9);});_0x21ba21[_0xb94d('0x35')](function(_0x4c06f6){_0x4bef45['or'](_0xb94d('0x78'),'%,'+_0x4c06f6+',%');});_0x50c586=_[_0xb94d('0x79')](_0x50c586,_0x21ba21);break;case'User':if(_0x23d5e6[_0xb94d('0x6d')]===_0xb94d('0x6e')){_0x1431d1[_0x47295c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x23d5e6[_0xb94d('0x68')]+'%',null);}else{_0x40d0e4=_[_0xb94d('0x66')](_0x34078d,[_0xb94d('0x30'),_0xb94d('0x3b')]);_0x23d5e6['field']=_0xb94d('0x3b');_0x376add=as[_0xb94d('0x72')](_0x7814d8,_0x40d0e4[_0xb94d('0x73')],_0x23d5e6);_0x1431d1[_0x47295c](_0x376add[_0xb94d('0x74')],_0x376add[_0xb94d('0x68')][_0xb94d('0x75')],_0x376add[_0xb94d('0x68')][_0xb94d('0x76')]);}break;case _0xb94d('0x7a'):_0x376add=as[_0xb94d('0x72')]('me',null,_0x23d5e6);_0x1431d1[_0x47295c](_0x376add[_0xb94d('0x74')],_0x376add[_0xb94d('0x68')][_0xb94d('0x75')],_0x376add[_0xb94d('0x68')][_0xb94d('0x76')]);break;}}else{var _0x376add=as['buildExpression'](_0x7814d8,_0x40d0e4['type'],_0x23d5e6);_0x1431d1[_0x47295c](_0x376add[_0xb94d('0x74')],_0x376add['value'][_0xb94d('0x75')],_0x376add['value'][_0xb94d('0x76')]);}}}else{var _0x126ca2=_(_0x33a1aa[_0xb94d('0x42')])[_0xb94d('0x43')]()[_0xb94d('0x32')](function(_0x530d7e){return _['some'](_0x34078d,[_0xb94d('0x30'),_0x530d7e])?_0x530d7e:undefined;})[_0xb94d('0x7b')]()['value']();if(!_['isEmpty'](_0x126ca2)){_0x126ca2[_0xb94d('0x35')](function(_0x1b00e3){if(_0x1b00e3===_0xb94d('0x7c')){_0x35ab3f['where'](_0xb94d('0x7d'),[]['concat'](_0x33a1aa[_0xb94d('0x42')][_0x1b00e3]));}else if(_0x1b00e3==='createdAt'){var _0x2cc9f=JSON['parse'](_0x33a1aa[_0xb94d('0x42')][_0x1b00e3])[_0xb94d('0x7e')];var _0x23a2ba=JSON[_0xb94d('0x7f')](_0x33a1aa['query'][_0x1b00e3])[_0xb94d('0x80')];_0x35ab3f[_0xb94d('0x4c')](_0xb94d('0x81'),_0x2cc9f,_0x23a2ba);}else{if(_0x33a1aa[_0xb94d('0x42')][_0x1b00e3]===_0xb94d('0x82')){_0x35ab3f[_0xb94d('0x4c')]('i.'+_0x1b00e3+_0xb94d('0x83'));}else{_0x35ab3f['where']('i.'+_0x1b00e3+_0xb94d('0x84'),_0x33a1aa[_0xb94d('0x42')][_0x1b00e3]);}}});}if(_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x85')]){if(_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x85')]==0x1){_0x35ab3f[_0xb94d('0x69')](_0xb94d('0x86'));}else{_0x35ab3f[_0xb94d('0x69')](_0xb94d('0x87'));}}if(_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x88')]){_0x50c586=_[_0xb94d('0x89')](_0x33a1aa[_0xb94d('0x42')]['tag'])?_0x33a1aa[_0xb94d('0x42')]['tag']:new Array(_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x88')]);_0x50c586[_0xb94d('0x35')](function(_0x548c0a){_0x4bef45['or'](_0xb94d('0x78'),'%,'+_0x548c0a+',%');});}if(_0x33a1aa['query'][_0xb94d('0x8a')]){var _0x5d4633=_0x33a1aa['query'][_0xb94d('0x8a')][_0xb94d('0x8b')]('\x5c','\x5c\x5c')[_0xb94d('0x8b')](/'/g,'\x27\x27');if(qs[_0xb94d('0x8c')](_0x5d4633)){_0x1431d1['or'](_0xb94d('0x8d'),_0x5d4633+'%')['or']('i.phone\x20LIKE\x20?',_0x5d4633+'%');}else{_0x1431d1['or'](_0xb94d('0x8e'),qs['getFullTextValue'](_0x5d4633))['or'](_0xb94d('0x8f'),_0x5d4633+'%');}}}_0x35ab3f[_0xb94d('0x4c')](_0x1431d1);_0x35ab3f['group'](_0xb94d('0x90'));var _0x424ae3={'type':db['Sequelize'][_0xb94d('0x91')][_0xb94d('0x92')],'raw':!![]};var _0x23ca53=_0x35ab3f[_0xb94d('0x93')]();_0x23ca53[_0xb94d('0x54')]('i.id');_0x23ca53['field'](_0xb94d('0x94'),_0xb94d('0x67'));if(_0x459b62[_0xb94d('0x4a')]){_0x459b62[_0xb94d('0x4a')][_0xb94d('0x35')](function(_0x3f442b){var _0x15c447=_0x3f442b[0x0]===_0xb94d('0x95')?_0x3f442b[0x0]:'i.'+_0x3f442b[0x0];_0x35ab3f[_0xb94d('0x4a')](_0x15c447,_0x3f442b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xb94d('0x96')](_0x50c586)){_0x35ab3f[_0xb94d('0x69')](_0x4bef45);_0x23ca53['where'](_0xb94d('0x97'),_0x50c586);}BPromise[_0xb94d('0x98')]()[_0xb94d('0x2b')](function(){if(!_0x197755){if(_0x33a1aa[_0xb94d('0x42')]['SmsAccountId'])return;_0x23ca53[_0xb94d('0x4c')](_0xb94d('0x99'));_0x35ab3f['where'](_0xb94d('0x99'));return;}if(_0x33a1aa[_0xb94d('0x9a')][_0xb94d('0x9b')]!=='agent')return;return _0x33a1aa[_0xb94d('0x9a')][_0xb94d('0x9c')]({'attributes':['id'],'raw':!![]})['then'](function(_0x42d7cf){if(_[_0xb94d('0x96')](_0x42d7cf)){_0x23ca53[_0xb94d('0x4c')](_0xb94d('0x9d'));_0x35ab3f[_0xb94d('0x4c')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x23ca53[_0xb94d('0x4c')](_0xb94d('0x7d'),_[_0xb94d('0x32')](_0x42d7cf,'id'));_0x35ab3f[_0xb94d('0x4c')](_0xb94d('0x7d'),_[_0xb94d('0x32')](_0x42d7cf,'id'));}});})[_0xb94d('0x2b')](function(){if(_0x33a1aa[_0xb94d('0x9a')][_0xb94d('0x9b')]===_0xb94d('0x9e')&&!_0x197755&&!_0x33a1aa[_0xb94d('0x42')][_0xb94d('0x7c')])return[];return db[_0xb94d('0x9f')]['query'](_0x23ca53[_0xb94d('0xa0')](),_0x424ae3);})['then'](function(_0x4733af){_0x340d0b[_0xb94d('0x24')]=_0x4733af[_0xb94d('0x48')];if(_0x340d0b[_0xb94d('0x24')]===0x0)return[];return db[_0xb94d('0x9f')][_0xb94d('0x42')](_0x10672b['toString'](),_0x424ae3)[_0xb94d('0x2b')](function(_0x9336a4){_0x4db44f=_[_0xb94d('0xa1')](_0x9336a4,'id');_0x424ae3=_[_0xb94d('0xa2')](_0x424ae3,{'model':db[_0xb94d('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x33a1aa['query']['fields']){_0x459b62[_0xb94d('0x45')][_0xb94d('0x35')](function(_0xf27f5d){_0x35ab3f[_0xb94d('0x54')]('i.'+_0xf27f5d);});}else{_0x35ab3f[_0xb94d('0x54')](_0xb94d('0x94'),_0xb94d('0x67'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xa3'),'Account.key');_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xa4'),_0xb94d('0xa5'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xa6'),_0xb94d('0x95'));_0x35ab3f[_0xb94d('0x54')]('i.*');_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xa7'),_0xb94d('0xa8'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xa9'),_0xb94d('0xaa'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xab'),_0xb94d('0xac'));_0x35ab3f[_0xb94d('0x54')]('c.phone',_0xb94d('0xad'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xae'),_0xb94d('0xaf'));_0x35ab3f[_0xb94d('0x54')]('c.fax',_0xb94d('0xb0'));_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xb1'),'Owner.fullname');_0x35ab3f['field']('o.internal','Owner.internal');_0x35ab3f[_0xb94d('0x54')](_0xb94d('0xb2'),_0xb94d('0x33'));}if(_0x459b62[_0xb94d('0x23')])_0x35ab3f['limit'](_0x459b62[_0xb94d('0x23')]);if(_0x459b62[_0xb94d('0x21')])_0x35ab3f[_0xb94d('0x21')](_0x459b62['offset']);return db[_0xb94d('0x9f')][_0xb94d('0x42')](_0x35ab3f[_0xb94d('0xa0')](),_0x424ae3);})[_0xb94d('0x2b')](function(_0x11c17f){if(_0x11c17f['length']>0x0)_0x283f88[_0xb94d('0x4c')](_0xb94d('0xb3'),_[_0xb94d('0x32')](_0x11c17f,'id'));return db[_0xb94d('0x9f')][_0xb94d('0x42')](_0x283f88[_0xb94d('0xa0')](),_0x424ae3)['then'](function(_0x3ddaba){var _0x4b2049=_[_0xb94d('0xb4')](_0x3ddaba,_0xb94d('0xb5'));var _0x11f4a6=[];_0x11c17f['forEach'](function(_0x53c200){_0x11f4a6['push'](updateSmsInteraction(_0x53c200,_0x4db44f,_0x4b2049));});return BPromise['all'](_0x11f4a6);});});})[_0xb94d('0x2b')](function(_0x598a6a){_0x340d0b[_0xb94d('0xb6')]=_0x598a6a;return _0x340d0b;})['then'](respondWithFilteredResult(_0x331e05,_0x459b62))['catch'](handleError(_0x331e05,null));};exports[_0xb94d('0xb7')]=function(_0x4d898a,_0xa74441){var _0xbd4875={'raw':![],'where':{'id':_0x4d898a[_0xb94d('0xb8')]['id']}},_0x50d843={};_0x50d843['model']=_[_0xb94d('0x43')](db['SmsInteraction']['rawAttributes']);_0x50d843['query']=_[_0xb94d('0x43')](_0x4d898a[_0xb94d('0x42')]);_0x50d843[_0xb94d('0xb9')]=_[_0xb94d('0x46')](_0x50d843[_0xb94d('0x44')],_0x50d843[_0xb94d('0x42')]);_0xbd4875[_0xb94d('0x45')]=_[_0xb94d('0x46')](_0x50d843['model'],qs[_0xb94d('0x47')](_0x4d898a[_0xb94d('0x42')][_0xb94d('0x47')]));_0xbd4875[_0xb94d('0x45')]=_0xbd4875[_0xb94d('0x45')][_0xb94d('0x48')]?_0xbd4875[_0xb94d('0x45')]:_0x50d843[_0xb94d('0x44')];if(_0x4d898a[_0xb94d('0x42')][_0xb94d('0xba')]){_0xbd4875['include']=[{'all':!![]}];}_0xbd4875=_['merge']({},_0xbd4875,_0x4d898a['options']);return db[_0xb94d('0x3e')]['find'](_0xbd4875)[_0xb94d('0x2b')](handleEntityNotFound(_0xa74441,null))[_0xb94d('0x2b')](respondWithResult(_0xa74441,null))[_0xb94d('0xbb')](handleError(_0xa74441,null));};exports['create']=function(_0x150359,_0x5f1163){return db[_0xb94d('0x3e')]['create'](_0x150359['body'],{})[_0xb94d('0x2b')](respondWithResult(_0x5f1163,0xc9))[_0xb94d('0xbb')](handleError(_0x5f1163,null));};exports['update']=function(_0x27f207,_0x2153e8){if(_0x27f207['body']['id']){delete _0x27f207[_0xb94d('0x7a')]['id'];}return db[_0xb94d('0x3e')][_0xb94d('0x66')]({'where':{'id':_0x27f207[_0xb94d('0xb8')]['id']}})[_0xb94d('0x2b')](handleEntityNotFound(_0x2153e8,null))[_0xb94d('0x2b')](saveUpdates(_0x27f207[_0xb94d('0x7a')],null))[_0xb94d('0x2b')](respondWithResult(_0x2153e8,null))[_0xb94d('0xbb')](handleError(_0x2153e8,null));};exports['destroy']=function(_0x540e82,_0x48f119){return db[_0xb94d('0x3e')][_0xb94d('0x66')]({'where':{'id':_0x540e82['params']['id']}})[_0xb94d('0x2b')](handleEntityNotFound(_0x48f119,null))[_0xb94d('0x2b')](removeEntity(_0x48f119,null))[_0xb94d('0xbb')](handleError(_0x48f119,null));};exports[_0xb94d('0xbc')]=function(_0x4acd82,_0x5e62c5){return db[_0xb94d('0x3e')]['describe']()[_0xb94d('0x2b')](respondWithResult(_0x5e62c5,null))[_0xb94d('0xbb')](handleError(_0x5e62c5,null));};exports[_0xb94d('0xbd')]=function(_0x162ff7,_0x982d48,_0x4649d2){return db[_0xb94d('0xbe')]['find']({'where':{'id':_0x162ff7[_0xb94d('0xb8')]['id']}})[_0xb94d('0x2b')](handleEntityNotFound(_0x982d48,null))[_0xb94d('0x2b')](function(_0x14eaf5){if(_0x14eaf5){return _0x14eaf5[_0xb94d('0xbd')](_0x162ff7[_0xb94d('0x7a')][_0xb94d('0xbf')],_['omit'](_0x162ff7[_0xb94d('0x7a')],['ids','id'])||{});}})[_0xb94d('0x2b')](respondWithResult(_0x982d48,null))[_0xb94d('0xbb')](handleError(_0x982d48,null));};exports[_0xb94d('0xc0')]=function(_0x3efab9,_0xd3a624,_0x560e84){var _0x154591={'raw':![],'where':{}};var _0x288785={};var _0x50b9e1={'count':0x0,'rows':[]};return db[_0xb94d('0x3e')][_0xb94d('0xc1')]({'where':{'id':_0x3efab9[_0xb94d('0xb8')]['id']}})[_0xb94d('0x2b')](handleEntityNotFound(_0xd3a624,null))[_0xb94d('0x2b')](function(_0x4e7554){if(_0x4e7554){_0x288785[_0xb94d('0x44')]=_['keys'](db['SmsMessage'][_0xb94d('0x3f')]);_0x288785[_0xb94d('0x42')]=_[_0xb94d('0x43')](_0x3efab9[_0xb94d('0x42')]);_0x288785[_0xb94d('0xb9')]=_['intersection'](_0x288785['model'],_0x288785['query']);_0x154591['attributes']=_['intersection'](_0x288785[_0xb94d('0x44')],qs['fields'](_0x3efab9[_0xb94d('0x42')][_0xb94d('0x47')]));_0x154591[_0xb94d('0x45')]=_0x154591[_0xb94d('0x45')][_0xb94d('0x48')]?_0x154591['attributes']:_0x288785['model'];if(!_0x3efab9[_0xb94d('0x42')][_0xb94d('0xc2')](_0xb94d('0x49'))){_0x154591[_0xb94d('0x23')]=qs[_0xb94d('0x23')](_0x3efab9['query'][_0xb94d('0x23')]);_0x154591[_0xb94d('0x21')]=qs[_0xb94d('0x21')](_0x3efab9['query']['offset']);}_0x154591[_0xb94d('0x4a')]=qs[_0xb94d('0x4b')](_0x3efab9[_0xb94d('0x42')]['sort']);_0x154591[_0xb94d('0x4c')]=qs[_0xb94d('0xb9')](_['pick'](_0x3efab9[_0xb94d('0x42')],_0x288785['filters']));_0x154591['where'][_0xb94d('0xb5')]=_0x4e7554['id'];if(_0x3efab9[_0xb94d('0x42')][_0xb94d('0x8a')]){_0x154591[_0xb94d('0x4c')]=_['merge'](_0x154591[_0xb94d('0x4c')],{'$or':_['map'](_0x154591['attributes'],function(_0xe8ab66){var _0x2562c5={};_0x2562c5[_0xe8ab66]={'$like':'%'+_0x3efab9[_0xb94d('0x42')]['filter']+'%'};return _0x2562c5;})});}if(_0x3efab9[_0xb94d('0x42')]['$gte']){var _0x33c79b=_0x3efab9[_0xb94d('0x42')][_0xb94d('0x7e')]['split'](',');var _0x2d3dc1={};_0x2d3dc1[_0x33c79b[0x0]]={'$gte':moment(_0x33c79b[0x1])['format'](_0xb94d('0xc3'))};_0x154591['where']=_[_0xb94d('0xa2')](_0x154591[_0xb94d('0x4c')],_0x2d3dc1);}_0x154591=_['merge']({},_0x154591,_0x3efab9[_0xb94d('0xc4')]);return db[_0xb94d('0xbe')][_0xb94d('0x24')]({'where':_0x154591['where']})['then'](function(_0x4426d5){_0x50b9e1['count']=_0x4426d5;if(_0x3efab9[_0xb94d('0x42')]['includeAll']){_0x154591['include']=[{'all':!![]}];}return db[_0xb94d('0xbe')]['findAll'](_0x154591);})[_0xb94d('0x2b')](function(_0x3734be){_0x50b9e1[_0xb94d('0xb6')]=_0x3734be;return _0x50b9e1;});}})[_0xb94d('0x2b')](respondWithFilteredResult(_0xd3a624,_0x154591))['catch'](handleError(_0xd3a624,null));};exports[_0xb94d('0xc5')]=function(_0x4264de,_0x33716f,_0x56888a){return db[_0xb94d('0x3e')][_0xb94d('0x66')]({'where':{'id':_0x4264de['params']['id']}})['then'](handleEntityNotFound(_0x33716f,null))[_0xb94d('0x2b')](function(_0x26a25a){if(_0x26a25a){return _0x26a25a['setTags'](_0x4264de[_0xb94d('0x7a')][_0xb94d('0xbf')],_[_0xb94d('0xc6')](_0x4264de[_0xb94d('0x7a')],[_0xb94d('0xbf'),'id'])||{})[_0xb94d('0xc7')](function(){return db[_0xb94d('0x77')]['findAll']({'attributes':['id','name',_0xb94d('0x4e')],'where':{'id':_0x4264de[_0xb94d('0x7a')]['ids']}});})[_0xb94d('0x2b')](function(_0x1ccd16){socket[_0xb94d('0xc8')](_0xb94d('0xc9'),{'id':Number(_0x4264de[_0xb94d('0xb8')]['id']),'tags':_0x1ccd16||[]});return{'id':Number(_0x4264de[_0xb94d('0xb8')]['id']),'tags':_0x1ccd16||[]};});}})[_0xb94d('0x2b')](respondWithResult(_0x33716f,null))['catch'](handleError(_0x33716f,null));};exports[_0xb94d('0xca')]=function(_0x520045,_0x5f4fb7,_0x374aa7){return db[_0xb94d('0x3e')][_0xb94d('0x66')]({'where':{'id':_0x520045['params']['id']}})[_0xb94d('0x2b')](handleEntityNotFound(_0x5f4fb7,null))['then'](function(_0x24d649){if(_0x24d649){return _0x24d649[_0xb94d('0xca')](_0x520045[_0xb94d('0x42')]['ids']);}})[_0xb94d('0x2b')](respondWithStatusCode(_0x5f4fb7,null))['catch'](handleError(_0x5f4fb7,null));};exports[_0xb94d('0xcb')]=function(_0xfcf0f0,_0x5a5866){var _0x378729=moment()[_0xb94d('0xcc')]()[_0xb94d('0xa0')]();var _0xf5587a=path[_0xb94d('0xcd')](config[_0xb94d('0xce')],_0xb94d('0xcf'),_0xb94d('0xd0'),_0xb94d('0xd1'));var _0xb6f299=path[_0xb94d('0xcd')](config[_0xb94d('0xce')],_0xb94d('0xcf'),'files',_0xb94d('0xd2'));var _0x2f84cf=path[_0xb94d('0xcd')](_0xf5587a,_0x378729);var _0x324861=util[_0xb94d('0xd3')]('transcript-%d-%s.zip',_0xfcf0f0[_0xb94d('0xb8')]['id'],_0x378729);var _0x40bad9=path['join'](_0xf5587a,_0x324861);var _0x197a1e=[];_0x197a1e[_0xb94d('0x37')]({'model':db[_0xb94d('0xd4')],'as':_0xb94d('0xd4'),'attributes':['id','fullname'],'raw':!![]});_0x197a1e[_0xb94d('0x37')]({'model':db[_0xb94d('0xd5')],'as':_0xb94d('0x6c'),'attributes':['id',_0xb94d('0xd6'),'lastName'],'raw':!![]});var _0xbba94b=[{'model':db[_0xb94d('0xbe')],'as':_0xb94d('0xd7'),'attributes':['id','body',_0xb94d('0xd8'),'direction','secret',_0xb94d('0x85')],'include':_0x197a1e}];_0xbba94b[_0xb94d('0x37')]({'model':db[_0xb94d('0xd9')],'as':_0xb94d('0xda'),'attributes':['id',_0xb94d('0x30')]});_0xbba94b[_0xb94d('0x37')]({'model':db[_0xb94d('0xd4')],'as':'Owner','attributes':['id',_0xb94d('0xdb')]});return db[_0xb94d('0x3e')]['find']({'where':{'id':_0xfcf0f0[_0xb94d('0xb8')]['id']},'include':_0xbba94b})[_0xb94d('0x2b')](handleEntityNotFound(_0x5a5866,null))[_0xb94d('0x2b')](function(_0x5a626a){if(_0x5a626a){var _0x3e52ec=_0x5a626a['get']({'plain':!![]});fs[_0xb94d('0xdc')](_0x2f84cf);var _0x4414de={'channel':_0xb94d('0xdd'),'account':_0x3e52ec['Account'][_0xb94d('0x30')],'agent':_0x3e52ec[_0xb94d('0xde')]?_0x3e52ec[_0xb94d('0xde')][_0xb94d('0xdb')]:_0xb94d('0xdf'),'createdAt':moment(_0x3e52ec['createdAt'])[_0xb94d('0xd3')](_0xb94d('0xc3'))[_0xb94d('0xa0')](),'closedAt':_0x3e52ec['closed']?moment(_0x3e52ec[_0xb94d('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb94d('0xa0')]():'','disposition':_0x3e52ec['disposition'],'messages':_(_0x3e52ec['Messages'])[_0xb94d('0x8a')]({'secret':![]})[_0xb94d('0x32')](function(_0x4123c9){return{'date':moment(_0x4123c9[_0xb94d('0xd8')])[_0xb94d('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb94d('0xa0')](),'sender':_0x4123c9[_0xb94d('0xe1')]===_0xb94d('0xe2')?_0x4123c9[_0xb94d('0xd4')]?_0x4123c9[_0xb94d('0xd4')][_0xb94d('0xdb')]:_0xb94d('0xe3'):_0x4123c9['Contact'][_0xb94d('0xd6')]+(_0x4123c9[_0xb94d('0x6c')]['lastName']?'\x20'+_0x4123c9[_0xb94d('0x6c')][_0xb94d('0xe4')]:''),'body':_0x4123c9[_0xb94d('0x7a')],'direction':_0x4123c9[_0xb94d('0xe1')]===_0xb94d('0xe2')?'A':'C','secret':_0x4123c9['secret'],'read':_0x4123c9['read']};})['value']()};return ejs[_0xb94d('0xe5')](path['join'](config[_0xb94d('0xce')],_0xb94d('0xcf'),_0xb94d('0xe6'),'downloadInteraction.ejs'),{'interaction':_0x4414de})[_0xb94d('0x2b')](function(_0x34f92a){var _0x3f7acd=path[_0xb94d('0xcd')](_0x2f84cf,'transcript-'+_0x3e52ec['id']+'-'+_0x378729+_0xb94d('0xe7'));var _0x56362a={'path':_0x3f7acd,'channel':_0xb94d('0xdd'),'interactionId':_0x3e52ec['id']};return pdf[_0xb94d('0xe8')](_0x34f92a,_0x56362a);})[_0xb94d('0x2b')](function(){return new BPromise(function(_0x44d894,_0x414290){zipdir(_0x2f84cf,{'saveTo':_0x40bad9},function(_0x43789f,_0x303f53){if(_0x43789f)return _0x414290(_0x43789f);return _0x44d894(_0x303f53);});})['then'](function(){return new BPromise(function(_0x2c9c36,_0x1b26fd){rimraf(_0x2f84cf,function(_0x85d356){if(_0x85d356)_0x1b26fd(_0x85d356);return _0x2c9c36();});});})['then'](function(){return _0x5a5866[_0xb94d('0xcb')](_0x40bad9,_0x324861,function(_0x17a559){if(_0x17a559){console[_0xb94d('0xe9')](_0xb94d('0xea'),_0x17a559);}else{fs[_0xb94d('0xeb')](_0x40bad9);}});});});}else{return _0x5a5866[_0xb94d('0x2d')](0xc8);}})['catch'](handleError(_0x5a5866,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 191cf23..b2ccb57 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 _0x4213=['getUsers','setDataValue','Users','map','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4213,0x77));var _0x3421=function(_0x17e705,_0x265f00){_0x17e705=_0x17e705-0x0;var _0x58b59b=_0x4213[_0x17e705];return _0x58b59b;};'use strict';var EventEmitter=require(_0x3421('0x0'));var SmsInteraction=require(_0x3421('0x1'))['db'][_0x3421('0x2')];var SmsMessage=require(_0x3421('0x1'))['db'][_0x3421('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3421('0x4')](0x0);var events={'afterCreate':_0x3421('0x5'),'afterUpdate':'update','afterDestroy':_0x3421('0x6')};function emitEvent(_0x5c3719){return function(_0x459c5e,_0xfe969c,_0x2155f8){_0x459c5e[_0x3421('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50e464){_0x459c5e[_0x3421('0x8')](_0x3421('0x9'),_0x50e464[_0x3421('0xa')](function(_0x13b0dd){return{'id':_0x13b0dd['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x459c5e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3421('0xb')](function(_0x58d511){_0x459c5e['setDataValue'](_0x3421('0xc'),_0x58d511['length']);SmsInteractionEvents[_0x3421('0xd')](_0x5c3719+':'+_0x459c5e['id'],_0x459c5e);SmsInteractionEvents[_0x3421('0xd')](_0x5c3719,_0x459c5e);_0x2155f8(null);})[_0x3421('0xe')](_0x2155f8(null));};}for(var e in events){if(events[_0x3421('0xf')](e)){var event=events[e];SmsInteraction[_0x3421('0x10')](e,emitEvent(event));}}module[_0x3421('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0xcf66=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','remove','getUsers'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xcf66,0x71));var _0x6cf6=function(_0x5587bd,_0x427ec1){_0x5587bd=_0x5587bd-0x0;var _0x529dc6=_0xcf66[_0x5587bd];return _0x529dc6;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var SmsInteraction=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x6cf6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6cf6('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6cf6('0x5')};function emitEvent(_0x45d0d8){return function(_0x57f22f,_0x39f1d6,_0x1fbedd){_0x57f22f[_0x6cf6('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x94c6a9){_0x57f22f[_0x6cf6('0x7')](_0x6cf6('0x8'),_0x94c6a9[_0x6cf6('0x9')](function(_0x175b18){return{'id':_0x175b18['id']};}));return SmsMessage[_0x6cf6('0xa')]({'where':{'SmsInteractionId':_0x57f22f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x58378c){_0x57f22f['setDataValue'](_0x6cf6('0xb'),_0x58378c['length']);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8+':'+_0x57f22f['id'],_0x57f22f);SmsInteractionEvents[_0x6cf6('0xc')](_0x45d0d8,_0x57f22f);_0x1fbedd(null);})[_0x6cf6('0xd')](_0x1fbedd(null));};}for(var e in events){if(events[_0x6cf6('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9b21cb6..f04feeb 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 _0x46e5=['request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x46e5,0x93));var _0x546e=function(_0x290e5e,_0x6387a7){_0x290e5e=_0x290e5e-0x0;var _0x57e5ad=_0x46e5[_0x290e5e];return _0x57e5ad;};'use strict';var _=require('lodash');var util=require(_0x546e('0x0'));var logger=require(_0x546e('0x1'))(_0x546e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x546e('0x3'));var fs=require('fs');var path=require(_0x546e('0x4'));var rimraf=require(_0x546e('0x5'));var config=require(_0x546e('0x6'));var attributes=require(_0x546e('0x7'));module[_0x546e('0x8')]=function(_0x4e55b2,_0x46f7e4){return _0x4e55b2[_0x546e('0x9')]('SmsInteraction',attributes,{'tableName':_0x546e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ecc71,_0xaef17f,_0x48c532){if(_0x5ecc71[_0x546e('0xb')](_0x546e('0xc'))){_0x5ecc71[_0x546e('0xd')]=moment()['format'](_0x546e('0xe'));}_0x48c532(null,_0x5ecc71);}}});}; \ No newline at end of file +var _0xdf2f=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','request-promise','rimraf','./smsInteraction.attributes','SmsInteraction','sms_interactions'];(function(_0x1c71d2,_0x459cbe){var _0x2df03f=function(_0x2c5530){while(--_0x2c5530){_0x1c71d2['push'](_0x1c71d2['shift']());}};_0x2df03f(++_0x459cbe);}(_0xdf2f,0xe2));var _0xfdf2=function(_0x4a5c45,_0x2a918a){_0x4a5c45=_0x4a5c45-0x0;var _0x43ae1c=_0xdf2f[_0x4a5c45];return _0x43ae1c;};'use strict';var _=require(_0xfdf2('0x0'));var util=require('util');var logger=require(_0xfdf2('0x1'))('api');var moment=require(_0xfdf2('0x2'));var BPromise=require('bluebird');var rp=require(_0xfdf2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdf2('0x4'));var config=require('../../config/environment');var attributes=require(_0xfdf2('0x5'));module['exports']=function(_0x56e15e,_0x247e46){return _0x56e15e['define'](_0xfdf2('0x6'),attributes,{'tableName':_0xfdf2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b7b20,_0x38559b,_0x84b9f){if(_0x4b7b20[_0xfdf2('0x8')](_0xfdf2('0x9'))){_0x4b7b20[_0xfdf2('0xa')]=moment()[_0xfdf2('0xb')](_0xfdf2('0xc'));}_0x84b9f(null,_0x4b7b20);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3b1828f..55af54f 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 _0x8deb=['localhost','socket.io-emitter','./smsInteraction.socket','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','then','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x54dc22,_0x46a630){var _0x1eb675=function(_0x203882){while(--_0x203882){_0x54dc22['push'](_0x54dc22['shift']());}};_0x1eb675(++_0x46a630);}(_0x8deb,0xaa));var _0xb8de=function(_0x3ed7fd,_0x272a46){_0x3ed7fd=_0x3ed7fd-0x0;var _0x2960bb=_0x8deb[_0x3ed7fd];return _0x2960bb;};'use strict';var _=require(_0xb8de('0x0'));var util=require(_0xb8de('0x1'));var moment=require(_0xb8de('0x2'));var BPromise=require(_0xb8de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8de('0x5'));var logger=require(_0xb8de('0x6'))('rpc');var config=require(_0xb8de('0x7'));var jayson=require(_0xb8de('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb8de('0x9')]=_['defaults'](config['redis'],{'host':_0xb8de('0xa'),'port':0x18eb});var socket=require(_0xb8de('0xb'))(new Redis(config[_0xb8de('0x9')]));require(_0xb8de('0xc'))['register'](socket);function respondWithRpcPromise(_0x2b4674,_0x24025f,_0x52f381){return new BPromise(function(_0x5627e3,_0x1853b0){return client['request'](_0x2b4674,_0x52f381)['then'](function(_0x35c6d4){logger[_0xb8de('0xd')]('SmsInteraction,\x20%s,\x20%s',_0x24025f,_0xb8de('0xe'));logger[_0xb8de('0xf')](_0xb8de('0x10'),_0x24025f,_0xb8de('0xe'),JSON[_0xb8de('0x11')](_0x35c6d4));if(_0x35c6d4[_0xb8de('0x12')]){if(_0x35c6d4['error']['code']===0x1f4){logger['error'](_0xb8de('0x13'),_0x24025f,_0x35c6d4[_0xb8de('0x12')]['message']);return _0x1853b0(_0x35c6d4[_0xb8de('0x12')][_0xb8de('0x14')]);}logger[_0xb8de('0x12')](_0xb8de('0x13'),_0x24025f,_0x35c6d4[_0xb8de('0x12')][_0xb8de('0x14')]);return _0x5627e3(_0x35c6d4[_0xb8de('0x12')][_0xb8de('0x14')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x24025f,_0xb8de('0xe'));_0x5627e3(_0x35c6d4['result'][_0xb8de('0x14')]);}})[_0xb8de('0x15')](function(_0x219cbe){logger[_0xb8de('0x12')](_0xb8de('0x13'),_0x24025f,_0x219cbe);_0x1853b0(_0x219cbe);});});}exports[_0xb8de('0x16')]=function(_0x4e192f){var _0x5243d7=this;return new Promise(function(_0x56c83d,_0x2f3f26){return db[_0xb8de('0x17')][_0xb8de('0x18')](_0x4e192f[_0xb8de('0x19')],{'raw':_0x4e192f['options']?_0x4e192f[_0xb8de('0x1a')][_0xb8de('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e192f[_0xb8de('0x1a')]?_0x4e192f['options'][_0xb8de('0x1c')]||null:null,'attributes':_0x4e192f['options']?_0x4e192f[_0xb8de('0x1a')][_0xb8de('0x1d')]||null:null,'limit':_0x4e192f[_0xb8de('0x1a')]?_0x4e192f[_0xb8de('0x1a')]['limit']||null:null})[_0xb8de('0x1e')](function(_0x1254b1){logger[_0xb8de('0xd')](_0xb8de('0x16'),_0x4e192f);logger[_0xb8de('0xf')](_0xb8de('0x16'),_0x4e192f,JSON['stringify'](_0x1254b1));_0x56c83d(_0x1254b1);})['catch'](function(_0x17ab1e){logger[_0xb8de('0x12')]('UpdateSmsInteraction',_0x17ab1e[_0xb8de('0x14')],_0x4e192f);_0x2f3f26(_0x5243d7[_0xb8de('0x12')](0x1f4,_0x17ab1e[_0xb8de('0x14')]));});});};exports['AddTagsToSmsInteraction']=function(_0x544e42){return new Promise(function(_0x5e78a6,_0x3b4a25){return db[_0xb8de('0x17')][_0xb8de('0x1f')]({'where':_0x544e42[_0xb8de('0x1a')]?_0x544e42['options'][_0xb8de('0x1c')]||null:null})['then'](function(_0x14fdd7){if(_0x14fdd7){return _0x14fdd7[_0xb8de('0x20')](_0x544e42[_0xb8de('0x19')][_0xb8de('0x21')],_[_0xb8de('0x22')](_0x544e42['body'],['ids','id'])||{});}})['spread'](function(_0x31b007){logger[_0xb8de('0xd')](_0xb8de('0x23'),_0x544e42);logger[_0xb8de('0xf')](_0xb8de('0x23'),_0x544e42,JSON[_0xb8de('0x11')](_0x31b007));_0x5e78a6(_0x31b007);})['catch'](function(_0x27e838){logger[_0xb8de('0x12')]('AddTags',_0x27e838[_0xb8de('0x14')],_0x544e42);_0x3b4a25(_this[_0xb8de('0x12')](0x1f4,_0x27e838[_0xb8de('0x14')]));});});}; \ No newline at end of file +var _0x0e16=['request\x20sent','debug','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','update','body','options','where','attributes','catch','AddTagsToSmsInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info'];(function(_0x3ec7dc,_0x10e64d){var _0x5d1d6b=function(_0x1e4fbd){while(--_0x1e4fbd){_0x3ec7dc['push'](_0x3ec7dc['shift']());}};_0x5d1d6b(++_0x10e64d);}(_0x0e16,0x16a));var _0x60e1=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x0e16[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x60e1('0x0'));var util=require(_0x60e1('0x1'));var moment=require('moment');var BPromise=require(_0x60e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e1('0x3'));var db=require(_0x60e1('0x4'))['db'];var utils=require(_0x60e1('0x5'));var logger=require(_0x60e1('0x6'))(_0x60e1('0x7'));var config=require(_0x60e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x60e1('0x9')][_0x60e1('0xa')]({'port':0x232a});config[_0x60e1('0xb')]=_[_0x60e1('0xc')](config[_0x60e1('0xb')],{'host':_0x60e1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60e1('0xb')]));require(_0x60e1('0xe'))['register'](socket);function respondWithRpcPromise(_0x4ec387,_0x3b9ba2,_0x17d8d9){return new BPromise(function(_0x361e67,_0x20033e){return client[_0x60e1('0xf')](_0x4ec387,_0x17d8d9)[_0x60e1('0x10')](function(_0x5a7054){logger[_0x60e1('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3b9ba2,_0x60e1('0x12'));logger[_0x60e1('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3b9ba2,_0x60e1('0x12'),JSON[_0x60e1('0x14')](_0x5a7054));if(_0x5a7054['error']){if(_0x5a7054[_0x60e1('0x15')]['code']===0x1f4){logger[_0x60e1('0x15')](_0x60e1('0x16'),_0x3b9ba2,_0x5a7054[_0x60e1('0x15')][_0x60e1('0x17')]);return _0x20033e(_0x5a7054['error'][_0x60e1('0x17')]);}logger[_0x60e1('0x15')](_0x60e1('0x16'),_0x3b9ba2,_0x5a7054[_0x60e1('0x15')][_0x60e1('0x17')]);return _0x361e67(_0x5a7054[_0x60e1('0x15')]['message']);}else{logger[_0x60e1('0x11')](_0x60e1('0x16'),_0x3b9ba2,_0x60e1('0x12'));_0x361e67(_0x5a7054[_0x60e1('0x18')][_0x60e1('0x17')]);}})['catch'](function(_0xe3cac0){logger[_0x60e1('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x3b9ba2,_0xe3cac0);_0x20033e(_0xe3cac0);});});}exports[_0x60e1('0x19')]=function(_0x3b5c26){var _0x2d4006=this;return new Promise(function(_0x481ebe,_0xd0f418){return db['SmsInteraction'][_0x60e1('0x1a')](_0x3b5c26[_0x60e1('0x1b')],{'raw':_0x3b5c26[_0x60e1('0x1c')]?_0x3b5c26['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b5c26[_0x60e1('0x1c')]?_0x3b5c26[_0x60e1('0x1c')][_0x60e1('0x1d')]||null:null,'attributes':_0x3b5c26[_0x60e1('0x1c')]?_0x3b5c26[_0x60e1('0x1c')][_0x60e1('0x1e')]||null:null,'limit':_0x3b5c26['options']?_0x3b5c26['options']['limit']||null:null})['then'](function(_0x4ecf82){logger[_0x60e1('0x11')](_0x60e1('0x19'),_0x3b5c26);logger[_0x60e1('0x13')](_0x60e1('0x19'),_0x3b5c26,JSON[_0x60e1('0x14')](_0x4ecf82));_0x481ebe(_0x4ecf82);})[_0x60e1('0x1f')](function(_0x54b4f9){logger[_0x60e1('0x15')](_0x60e1('0x19'),_0x54b4f9[_0x60e1('0x17')],_0x3b5c26);_0xd0f418(_0x2d4006[_0x60e1('0x15')](0x1f4,_0x54b4f9['message']));});});};exports[_0x60e1('0x20')]=function(_0x452e6f){return new Promise(function(_0x4e005c,_0x36719a){return db['SmsInteraction']['find']({'where':_0x452e6f[_0x60e1('0x1c')]?_0x452e6f[_0x60e1('0x1c')][_0x60e1('0x1d')]||null:null})['then'](function(_0x1ea386){if(_0x1ea386){return _0x1ea386[_0x60e1('0x21')](_0x452e6f['body'][_0x60e1('0x22')],_[_0x60e1('0x23')](_0x452e6f['body'],[_0x60e1('0x22'),'id'])||{});}})[_0x60e1('0x24')](function(_0x542b0e){logger['info']('AddTags',_0x452e6f);logger[_0x60e1('0x13')](_0x60e1('0x25'),_0x452e6f,JSON[_0x60e1('0x14')](_0x542b0e));_0x4e005c(_0x542b0e);})[_0x60e1('0x1f')](function(_0x20b9ec){logger[_0x60e1('0x15')](_0x60e1('0x25'),_0x20b9ec[_0x60e1('0x17')],_0x452e6f);_0x36719a(_this[_0x60e1('0x15')](0x1f4,_0x20b9ec[_0x60e1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 51308a5..007113d 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 _0xbb7d=['smsInteraction:','./smsInteraction.events','save','update','emit','removeListener','length'];(function(_0x5d572c,_0x53581f){var _0x5797cf=function(_0x5dcdd4){while(--_0x5dcdd4){_0x5d572c['push'](_0x5d572c['shift']());}};_0x5797cf(++_0x53581f);}(_0xbb7d,0x1ac));var _0xdbb7=function(_0x53c786,_0x4cd0ce){_0x53c786=_0x53c786-0x0;var _0x2aa1f3=_0xbb7d[_0x53c786];return _0x2aa1f3;};'use strict';var SmsInteractionEvents=require(_0xdbb7('0x0'));var events=[_0xdbb7('0x1'),'remove',_0xdbb7('0x2')];function createListener(_0x37940e,_0x2a089c){return function(_0x266f89){_0x2a089c[_0xdbb7('0x3')](_0x37940e,_0x266f89);};}function removeListener(_0x495d36,_0x39c391){return function(){SmsInteractionEvents[_0xdbb7('0x4')](_0x495d36,_0x39c391);};}exports['register']=function(_0x4b19ac){for(var _0x4199d4=0x0,_0x3df67a=events[_0xdbb7('0x5')];_0x4199d4<_0x3df67a;_0x4199d4++){var _0x989c2c=events[_0x4199d4];var _0x30e9a3=createListener(_0xdbb7('0x6')+_0x989c2c,_0x4b19ac);SmsInteractionEvents['on'](_0x989c2c,_0x30e9a3);}}; \ No newline at end of file +var _0x63d9=['emit','removeListener','length','smsInteraction:','./smsInteraction.events','remove'];(function(_0x5dde61,_0x48d7d1){var _0x283467=function(_0x4d4a7e){while(--_0x4d4a7e){_0x5dde61['push'](_0x5dde61['shift']());}};_0x283467(++_0x48d7d1);}(_0x63d9,0x1c0));var _0x963d=function(_0x443d1b,_0x1d8b39){_0x443d1b=_0x443d1b-0x0;var _0x5a18dd=_0x63d9[_0x443d1b];return _0x5a18dd;};'use strict';var SmsInteractionEvents=require(_0x963d('0x0'));var events=['save',_0x963d('0x1'),'update'];function createListener(_0x36ef83,_0x2cc5b6){return function(_0x33f656){_0x2cc5b6[_0x963d('0x2')](_0x36ef83,_0x33f656);};}function removeListener(_0x53d64a,_0x556924){return function(){SmsInteractionEvents[_0x963d('0x3')](_0x53d64a,_0x556924);};}exports['register']=function(_0x281f32){for(var _0x3c8aa4=0x0,_0x1a0d57=events[_0x963d('0x4')];_0x3c8aa4<_0x1a0d57;_0x3c8aa4++){var _0xae7a46=events[_0x3c8aa4];var _0x5ba3c6=createListener(_0x963d('0x5')+_0xae7a46,_0x281f32);SmsInteractionEvents['on'](_0xae7a46,_0x5ba3c6);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 55d42b7..257c824 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 _0x6157=['tracked','smsmessage:create','/:id/status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','post'];(function(_0xf4c66e,_0x241385){var _0x158bdf=function(_0x1ea7c1){while(--_0x1ea7c1){_0xf4c66e['push'](_0xf4c66e['shift']());}};_0x158bdf(++_0x241385);}(_0x6157,0x1a0));var _0x7615=function(_0x27e753,_0x248942){_0x27e753=_0x27e753-0x0;var _0x205104=_0x6157[_0x27e753];return _0x205104;};'use strict';var multer=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var path=require('path');var timeout=require(_0x7615('0x2'));var express=require(_0x7615('0x3'));var router=express['Router']();var fs_extra=require(_0x7615('0x4'));var auth=require(_0x7615('0x5'));var interaction=require(_0x7615('0x6'));var config=require(_0x7615('0x7'));var controller=require(_0x7615('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7615('0x9'),auth[_0x7615('0xa')](),controller[_0x7615('0xb')]);router[_0x7615('0xc')](_0x7615('0xd'),auth['isAuthenticated'](),controller[_0x7615('0xe')]);router[_0x7615('0xf')]('/',auth['isAuthenticated'](),interaction[_0x7615('0x10')]('sms',_0x7615('0x11')),controller['create']);router['post'](_0x7615('0x12'),controller['status']);router[_0x7615('0x13')](_0x7615('0xd'),auth[_0x7615('0xa')](),controller[_0x7615('0x14')]);router[_0x7615('0x13')](_0x7615('0x15'),auth[_0x7615('0xa')](),controller[_0x7615('0x16')]);router['put']('/:id/reject',auth[_0x7615('0xa')](),controller[_0x7615('0x17')]);router[_0x7615('0x18')](_0x7615('0xd'),auth[_0x7615('0xa')](),controller[_0x7615('0x19')]);module[_0x7615('0x1a')]=router; \ No newline at end of file +var _0x784b=['/:id/reject','reject','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','show','tracked','sms','smsmessage:create','create','/:id/status','put','/:id','/:id/accept','accept'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x784b,0x149));var _0xb784=function(_0x5562bd,_0x783b49){_0x5562bd=_0x5562bd-0x0;var _0x2b3953=_0x784b[_0x5562bd];return _0x2b3953;};'use strict';var multer=require(_0xb784('0x0'));var util=require(_0xb784('0x1'));var path=require('path');var timeout=require(_0xb784('0x2'));var express=require('express');var router=express[_0xb784('0x3')]();var fs_extra=require(_0xb784('0x4'));var auth=require(_0xb784('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb784('0x6'));var controller=require(_0xb784('0x7'));router[_0xb784('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb784('0x8')]('/describe',auth[_0xb784('0x9')](),controller[_0xb784('0xa')]);router[_0xb784('0x8')]('/:id',auth[_0xb784('0x9')](),controller[_0xb784('0xb')]);router['post']('/',auth[_0xb784('0x9')](),interaction[_0xb784('0xc')](_0xb784('0xd'),_0xb784('0xe')),controller[_0xb784('0xf')]);router['post'](_0xb784('0x10'),controller['status']);router[_0xb784('0x11')](_0xb784('0x12'),auth[_0xb784('0x9')](),controller['update']);router['put'](_0xb784('0x13'),auth[_0xb784('0x9')](),controller[_0xb784('0x14')]);router[_0xb784('0x11')](_0xb784('0x15'),auth[_0xb784('0x9')](),controller[_0xb784('0x16')]);router['delete']('/:id',auth[_0xb784('0x9')](),controller[_0xb784('0x17')]);module[_0xb784('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 1931925..b1fc50c 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 _0xfc26=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x2e93d0,_0x5d6526){var _0x2a88a6=function(_0x9bcb0f){while(--_0x9bcb0f){_0x2e93d0['push'](_0x2e93d0['shift']());}};_0x2a88a6(++_0x5d6526);}(_0xfc26,0x115));var _0x6fc2=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xfc26[_0x35af23];return _0x340506;};'use strict';var Sequelize=require(_0x6fc2('0x0'));module['exports']={'body':{'type':Sequelize[_0x6fc2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6fc2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6fc2('0x3')]('in',_0x6fc2('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6fc2('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x6fc2('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6fc2('0x5')]},'providerResponse':{'type':Sequelize[_0x6fc2('0x1')]}}; \ No newline at end of file +var _0x5ed2=['out','STRING','DATE','BOOLEAN','sequelize','TEXT','medium','ENUM'];(function(_0x3a2c03,_0x1f945a){var _0x4f6540=function(_0x435e48){while(--_0x435e48){_0x3a2c03['push'](_0x3a2c03['shift']());}};_0x4f6540(++_0x1f945a);}(_0x5ed2,0x114));var _0x25ed=function(_0x4706af,_0x24b450){_0x4706af=_0x4706af-0x0;var _0x2f75c4=_0x5ed2[_0x4706af];return _0x2f75c4;};'use strict';var Sequelize=require(_0x25ed('0x0'));module['exports']={'body':{'type':Sequelize[_0x25ed('0x1')](_0x25ed('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x25ed('0x3')]('in',_0x25ed('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x25ed('0x5')](0xbe)},'phone':{'type':Sequelize[_0x25ed('0x5')]},'readAt':{'type':Sequelize[_0x25ed('0x6')]},'secret':{'type':Sequelize[_0x25ed('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x25ed('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 6007232..58a4dc6 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 _0x4bc7=['debug','request\x20sent','stringify','error','message','info','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','event','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','agent','internal','motionChannel','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','groupName','infobip','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s'];(function(_0x4ca9aa,_0x1ff656){var _0x2a83f1=function(_0x352c7a){while(--_0x352c7a){_0x4ca9aa['push'](_0x4ca9aa['shift']());}};_0x2a83f1(++_0x1ff656);}(_0x4bc7,0x188));var _0x74bc=function(_0x397127,_0x31429d){_0x397127=_0x397127-0x0;var _0x1d5516=_0x4bc7[_0x397127];return _0x1d5516;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x74bc('0x0'));var jsonpatch=require(_0x74bc('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x74bc('0x2'));var Mustache=require(_0x74bc('0x3'));var util=require(_0x74bc('0x4'));var path=require(_0x74bc('0x5'));var sox=require(_0x74bc('0x6'));var csv=require('to-csv');var ejs=require(_0x74bc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74bc('0x8'));var squel=require(_0x74bc('0x9'));var crypto=require(_0x74bc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74bc('0xb'));var querystring=require(_0x74bc('0xc'));var Papa=require('papaparse');var Redis=require(_0x74bc('0xd'));var authService=require(_0x74bc('0xe'));var qs=require(_0x74bc('0xf'));var as=require(_0x74bc('0x10'));var hardwareService=require(_0x74bc('0x11'));var logger=require(_0x74bc('0x12'))(_0x74bc('0x13'));var utils=require(_0x74bc('0x14'));var config=require(_0x74bc('0x15'));var licenseUtil=require(_0x74bc('0x16'));var db=require(_0x74bc('0x17'))['db'];config['redis']=_[_0x74bc('0x18')](config[_0x74bc('0x19')],{'host':_0x74bc('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x74bc('0x1b'))[_0x74bc('0x1c')](socket);var jayson=require(_0x74bc('0x1d'));var client=jayson[_0x74bc('0x1e')][_0x74bc('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x74bc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x22167d,_0x7fd952,_0xdbaec,_0x3e30da){return new BPromise(function(_0xe82f8f,_0x512490){var _0x5a97d4=_0x3e30da||client;return _0x5a97d4['request'](_0x22167d,_0xdbaec)[_0x74bc('0x20')](function(_0x3f6102){logger['info'](_0x74bc('0x21'),_0x7fd952,'request\x20sent');logger[_0x74bc('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7fd952,_0x74bc('0x23'),JSON[_0x74bc('0x24')](_0x3f6102));if(_0x3f6102[_0x74bc('0x25')]){if(_0x3f6102[_0x74bc('0x25')]['code']===0x1f4){logger[_0x74bc('0x25')](_0x74bc('0x21'),_0x7fd952,_0x3f6102[_0x74bc('0x25')][_0x74bc('0x26')]);return _0x512490(_0x3f6102[_0x74bc('0x25')][_0x74bc('0x26')]);}logger[_0x74bc('0x25')](_0x74bc('0x21'),_0x7fd952,_0x3f6102[_0x74bc('0x25')][_0x74bc('0x26')]);return _0xe82f8f(_0x3f6102['error']['message']);}else{logger[_0x74bc('0x27')](_0x74bc('0x21'),_0x7fd952,'request\x20sent');_0xe82f8f(_0x3f6102[_0x74bc('0x28')][_0x74bc('0x26')]);}})['catch'](function(_0x55a6f7){logger[_0x74bc('0x25')](_0x74bc('0x21'),_0x7fd952,_0x55a6f7);_0x512490(_0x55a6f7);});});}function respondWithStatusCode(_0x453fa1,_0xa73b10){_0xa73b10=_0xa73b10||0xcc;return function(_0x527039){if(_0x527039){return _0x453fa1[_0x74bc('0x29')](_0xa73b10);}return _0x453fa1['status'](_0xa73b10)[_0x74bc('0x2a')]();};}function respondWithResult(_0x3e589a,_0xf5be9f){_0xf5be9f=_0xf5be9f||0xc8;return function(_0x204ab8){if(_0x204ab8){return _0x3e589a[_0x74bc('0x2b')](_0xf5be9f)['json'](_0x204ab8);}};}function respondWithFilteredResult(_0x35744a,_0x2ae085){return function(_0x2c2fc4){if(_0x2c2fc4){var _0x48761f=typeof _0x2ae085[_0x74bc('0x2c')]===_0x74bc('0x2d')&&typeof _0x2ae085[_0x74bc('0x2e')]===_0x74bc('0x2d');var _0x51d5ca=_0x2c2fc4[_0x74bc('0x2f')];var _0x163985=_0x48761f?0x0:_0x2ae085[_0x74bc('0x2c')];var _0x2b76a1=_0x48761f?_0x2c2fc4['count']:_0x2ae085[_0x74bc('0x2c')]+_0x2ae085[_0x74bc('0x2e')];var _0x2f0784;if(_0x2b76a1>=_0x51d5ca){_0x2b76a1=_0x51d5ca;_0x2f0784=0xc8;}else{_0x2f0784=0xce;}_0x35744a['status'](_0x2f0784);return _0x35744a[_0x74bc('0x30')](_0x74bc('0x31'),_0x163985+'-'+_0x2b76a1+'/'+_0x51d5ca)[_0x74bc('0x32')](_0x2c2fc4);}return null;};}function patchUpdates(_0x1115ae){return function(_0x2dfad4){try{jsonpatch[_0x74bc('0x33')](_0x2dfad4,_0x1115ae,!![]);}catch(_0x89e13d){return BPromise['reject'](_0x89e13d);}return _0x2dfad4['save']();};}function saveUpdates(_0xf0db29,_0x4400d3){return function(_0x25998d){if(_0x25998d){return _0x25998d[_0x74bc('0x34')](_0xf0db29)[_0x74bc('0x20')](function(_0x4408c6){return _0x4408c6;});}return null;};}function removeEntity(_0x34c937,_0x36ecef){return function(_0x22533c){if(_0x22533c){return _0x22533c[_0x74bc('0x35')]()[_0x74bc('0x20')](function(){_0x34c937['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a19b6,_0x5d714c){return function(_0x57801e){if(!_0x57801e){_0x5a19b6[_0x74bc('0x29')](0x194);}return _0x57801e;};}function handleError(_0x2b83f0,_0x7f868e){_0x7f868e=_0x7f868e||0x1f4;return function(_0x2a079c){logger['error'](_0x2a079c['stack']);if(_0x2a079c[_0x74bc('0x36')]){delete _0x2a079c[_0x74bc('0x36')];}_0x2b83f0[_0x74bc('0x2b')](_0x7f868e)[_0x74bc('0x37')](_0x2a079c);};}exports[_0x74bc('0x38')]=function(_0x26e4ca,_0x1ca4b8){var _0x72b7ca={},_0x4358cf={},_0xf185f8={'count':0x0,'rows':[]};var _0x8edb29=_[_0x74bc('0x39')](db[_0x74bc('0x3a')][_0x74bc('0x3b')],function(_0x2d2e9d){return{'name':_0x2d2e9d[_0x74bc('0x3c')],'type':_0x2d2e9d['type'][_0x74bc('0x3d')]};});_0x4358cf['model']=_['map'](_0x8edb29,_0x74bc('0x36'));_0x4358cf[_0x74bc('0x3e')]=_[_0x74bc('0x3f')](_0x26e4ca[_0x74bc('0x3e')]);_0x4358cf[_0x74bc('0x40')]=_['intersection'](_0x4358cf[_0x74bc('0x41')],_0x4358cf[_0x74bc('0x3e')]);_0x72b7ca[_0x74bc('0x42')]=_[_0x74bc('0x43')](_0x4358cf[_0x74bc('0x41')],qs[_0x74bc('0x44')](_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x44')]));_0x72b7ca[_0x74bc('0x42')]=_0x72b7ca['attributes'][_0x74bc('0x45')]?_0x72b7ca[_0x74bc('0x42')]:_0x4358cf[_0x74bc('0x41')];if(!_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x46')]('nolimit')){_0x72b7ca[_0x74bc('0x2e')]=qs['limit'](_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x2e')]);_0x72b7ca[_0x74bc('0x2c')]=qs[_0x74bc('0x2c')](_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x2c')]);}_0x72b7ca['order']=qs['sort'](_0x26e4ca['query'][_0x74bc('0x47')]);_0x72b7ca[_0x74bc('0x48')]=qs[_0x74bc('0x40')](_[_0x74bc('0x49')](_0x26e4ca[_0x74bc('0x3e')],_0x4358cf['filters']),_0x8edb29);if(_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x4a')]){_0x72b7ca[_0x74bc('0x48')]=_[_0x74bc('0x4b')](_0x72b7ca[_0x74bc('0x48')],{'$or':_[_0x74bc('0x39')](_0x8edb29,function(_0x2c6477){if(_0x2c6477[_0x74bc('0x4c')]!==_0x74bc('0x4d')){var _0x2e69c9={};_0x2e69c9[_0x2c6477[_0x74bc('0x36')]]={'$like':'%'+_0x26e4ca[_0x74bc('0x3e')]['filter']+'%'};return _0x2e69c9;}})});}_0x72b7ca=_['merge']({},_0x72b7ca,_0x26e4ca[_0x74bc('0x4e')]);var _0x55d84d={'where':_0x72b7ca[_0x74bc('0x48')]};return db[_0x74bc('0x3a')]['count'](_0x55d84d)['then'](function(_0x1a568f){_0xf185f8[_0x74bc('0x2f')]=_0x1a568f;if(_0x26e4ca[_0x74bc('0x3e')][_0x74bc('0x4f')]){_0x72b7ca[_0x74bc('0x50')]=[{'all':!![]}];}return db[_0x74bc('0x3a')]['findAll'](_0x72b7ca);})[_0x74bc('0x20')](function(_0x71f384){_0xf185f8['rows']=_0x71f384;return _0xf185f8;})[_0x74bc('0x20')](respondWithFilteredResult(_0x1ca4b8,_0x72b7ca))[_0x74bc('0x51')](handleError(_0x1ca4b8,null));};exports[_0x74bc('0x52')]=function(_0x2f913f,_0x215530){var _0x374d36={'raw':!![],'where':{'id':_0x2f913f[_0x74bc('0x53')]['id']}},_0xbdace0={};_0xbdace0['model']=_[_0x74bc('0x3f')](db[_0x74bc('0x3a')][_0x74bc('0x3b')]);_0xbdace0[_0x74bc('0x3e')]=_[_0x74bc('0x3f')](_0x2f913f[_0x74bc('0x3e')]);_0xbdace0['filters']=_['intersection'](_0xbdace0[_0x74bc('0x41')],_0xbdace0['query']);_0x374d36[_0x74bc('0x42')]=_['intersection'](_0xbdace0[_0x74bc('0x41')],qs['fields'](_0x2f913f[_0x74bc('0x3e')][_0x74bc('0x44')]));_0x374d36['attributes']=_0x374d36[_0x74bc('0x42')]['length']?_0x374d36[_0x74bc('0x42')]:_0xbdace0['model'];if(_0x2f913f[_0x74bc('0x3e')]['includeAll']){_0x374d36[_0x74bc('0x50')]=[{'all':!![]}];}_0x374d36=_[_0x74bc('0x4b')]({},_0x374d36,_0x2f913f['options']);return db[_0x74bc('0x3a')][_0x74bc('0x54')](_0x374d36)[_0x74bc('0x20')](handleEntityNotFound(_0x215530,null))[_0x74bc('0x20')](respondWithResult(_0x215530,null))[_0x74bc('0x51')](handleError(_0x215530,null));};exports['create']=function(_0xbf6f9d,_0x4d9bba){return db['SmsMessage'][_0x74bc('0x55')](_0xbf6f9d['body'],{})[_0x74bc('0x20')](respondWithResult(_0x4d9bba,0xc9))['catch'](handleError(_0x4d9bba,null));};exports[_0x74bc('0x34')]=function(_0x3803f3,_0x95bf57){if(_0x3803f3['body']['id']){delete _0x3803f3[_0x74bc('0x56')]['id'];}return db[_0x74bc('0x3a')][_0x74bc('0x54')]({'where':{'id':_0x3803f3[_0x74bc('0x53')]['id']}})[_0x74bc('0x20')](handleEntityNotFound(_0x95bf57,null))[_0x74bc('0x20')](saveUpdates(_0x3803f3[_0x74bc('0x56')],null))[_0x74bc('0x20')](respondWithResult(_0x95bf57,null))[_0x74bc('0x51')](handleError(_0x95bf57,null));};exports['destroy']=function(_0x28bf3f,_0x3d72f3){return db['SmsMessage'][_0x74bc('0x54')]({'where':{'id':_0x28bf3f['params']['id']}})[_0x74bc('0x20')](handleEntityNotFound(_0x3d72f3,null))[_0x74bc('0x20')](removeEntity(_0x3d72f3,null))[_0x74bc('0x51')](handleError(_0x3d72f3,null));};exports[_0x74bc('0x57')]=function(_0x12d8c2,_0x84118a){return db['SmsMessage'][_0x74bc('0x57')]()[_0x74bc('0x20')](respondWithResult(_0x84118a,null))['catch'](handleError(_0x84118a,null));};var interaction_log=require(_0x74bc('0x12'))(_0x74bc('0x58'));exports[_0x74bc('0x59')]=function(_0x3731ba,_0x413fc0,_0x75eec6){var _0x42f809={'agent':{},'channel':'sms'};if(_0x3731ba[_0x74bc('0x56')]['id']){delete _0x3731ba[_0x74bc('0x56')]['id'];}_0x3731ba[_0x74bc('0x56')][_0x74bc('0x5a')]=!![];_0x3731ba[_0x74bc('0x56')]['readAt']=moment()[_0x74bc('0x5b')](_0x74bc('0x5c'));_0x3731ba[_0x74bc('0x56')][_0x74bc('0x5d')]=_0x3731ba['body'][_0x74bc('0x5d')]||_0x3731ba[_0x74bc('0x5e')]['id'];_0x42f809['agent']['id']=_0x3731ba[_0x74bc('0x56')][_0x74bc('0x5d')];return db['SmsMessage'][_0x74bc('0x54')]({'where':{'id':_0x3731ba[_0x74bc('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x413fc0,null))[_0x74bc('0x20')](saveUpdates(_0x3731ba[_0x74bc('0x56')],null))['then'](function(_0x332a2b){if(_0x332a2b){_0x42f809[_0x74bc('0x26')]=_0x332a2b[_0x74bc('0x5f')]({'plain':!![]});return db[_0x74bc('0x60')]['find']({'where':{'id':_0x332a2b[_0x74bc('0x61')]}});}return null;})[_0x74bc('0x20')](handleEntityNotFound(_0x413fc0,null))[_0x74bc('0x20')](function(_0x2c3cf5){if(_0x2c3cf5){return _0x2c3cf5[_0x74bc('0x34')]({'UserId':_0x3731ba['body'][_0x74bc('0x5d')],'read1stAt':_['isNil'](_0x2c3cf5[_0x74bc('0x62')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x74bc('0x20')](function(_0x599310){if(_0x599310){_0x42f809['interaction']=_0x599310[_0x74bc('0x5f')]({'plain':!![]});interaction_log['info'](_0x74bc('0x63'),_0x3731ba[_0x74bc('0x5e')]['id'],_0x3731ba[_0x74bc('0x5e')][_0x74bc('0x36')],_0x3731ba[_0x74bc('0x5e')][_0x74bc('0x64')],_0x42f809[_0x74bc('0x65')]['id'],_0x3731ba['body']?JSON[_0x74bc('0x24')](_0x3731ba[_0x74bc('0x56')]):_0x74bc('0x66'));return respondWithRpcPromise('AcceptMessage',_0x74bc('0x67'),_0x42f809);}return null;})[_0x74bc('0x20')](function(_0x1aea5e){var _0x30de70=_0x74bc('0x68')+_0x1aea5e[_0x74bc('0x26')][_0x74bc('0x69')];return db[_0x74bc('0x6a')][_0x74bc('0x3e')](_0x30de70,{'type':db[_0x74bc('0x6b')][_0x74bc('0x6c')][_0x74bc('0x6d')],'raw':!![]})[_0x74bc('0x20')](function(_0x2ca059){return _0x2ca059;});})[_0x74bc('0x20')](function(_0x243b93){if(_0x243b93){_0x42f809[_0x74bc('0x26')][_0x74bc('0x6e')]=_0x243b93[0x0];if(!_0x3731ba[_0x74bc('0x56')][_0x74bc('0x5d')])return;return db[_0x74bc('0x6f')]['find']({'where':{'id':_0x3731ba[_0x74bc('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x74bc('0x36'),_0x74bc('0x70'),_0x74bc('0x71'),'internal'],'raw':!![]});}return null;})['then'](function(_0x54ea30){if(!_0x54ea30)return null;_0x42f809[_0x74bc('0x26')]['agent']=_0x54ea30;return _0x42f809;})['then'](function(_0xfb3652){if(_0xfb3652){if(_0x3731ba[_0x74bc('0x56')][_0x74bc('0x72')]){_0x42f809['message'][_0x74bc('0x73')]=util[_0x74bc('0x5b')]('SIP/%s',_0x3731ba[_0x74bc('0x5e')][_0x74bc('0x36')]);_0x42f809['message'][_0x74bc('0x74')]=_0x42f809['channel'];_0x42f809['message']['motionChannel']=_0x42f809[_0x74bc('0x74')];_0x42f809[_0x74bc('0x26')][_0x74bc('0x75')]=_0x74bc('0x59');return respondWithRpcPromise('EventManager',_0x74bc('0x76'),{'event':_0x74bc('0x77'),'message':_0x42f809[_0x74bc('0x26')]},client9002)[_0x74bc('0x20')](function(){return _0x42f809;});}return _0x42f809;}return null;})[_0x74bc('0x20')](respondWithResult(_0x413fc0,null))['catch'](handleError(_0x413fc0,null));};var interaction_log=require('../../config/logger')(_0x74bc('0x58'));exports[_0x74bc('0x78')]=function(_0x1ad331,_0x234720,_0xfd30bf){var _0xe6960e={'agent':{},'channel':_0x74bc('0x79')};if(_0x1ad331[_0x74bc('0x56')]['id']){delete _0x1ad331[_0x74bc('0x56')]['id'];}_0x1ad331[_0x74bc('0x56')][_0x74bc('0x5d')]=_0x1ad331[_0x74bc('0x56')][_0x74bc('0x5d')]||_0x1ad331['user']['id'];_0xe6960e['agent']['id']=_0x1ad331[_0x74bc('0x56')]['UserId'];return db['SmsMessage'][_0x74bc('0x54')]({'where':{'id':_0x1ad331['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x234720,null))['then'](function(_0x4ff0fb){if(_0x4ff0fb){_0xe6960e[_0x74bc('0x26')]=_0x4ff0fb[_0x74bc('0x5f')]({'plain':!![]});return db[_0x74bc('0x60')][_0x74bc('0x54')]({'where':{'id':_0x4ff0fb[_0x74bc('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x234720,null))['then'](function(_0x2ab6a7){if(_0x2ab6a7){_0xe6960e['interaction']=_0x2ab6a7['get']({'plain':!![]});interaction_log['info'](_0x74bc('0x7a'),_0x1ad331[_0x74bc('0x5e')]['id'],_0x1ad331['user'][_0x74bc('0x36')],_0x1ad331[_0x74bc('0x5e')]['role'],_0xe6960e[_0x74bc('0x65')]['id'],_0x1ad331['body']?JSON[_0x74bc('0x24')](_0x1ad331[_0x74bc('0x56')]):_0x74bc('0x66'));return respondWithRpcPromise(_0x74bc('0x7b'),_0x74bc('0x7c'),_0xe6960e);}return null;})[_0x74bc('0x20')](function(_0x43eba9){var _0x24744d=_0x74bc('0x68')+_0x43eba9['message']['ContactId'];return db['sequelize'][_0x74bc('0x3e')](_0x24744d,{'type':db[_0x74bc('0x6b')][_0x74bc('0x6c')][_0x74bc('0x6d')],'raw':!![]})[_0x74bc('0x20')](function(_0x107ca1){return _0x107ca1;});})[_0x74bc('0x20')](function(_0x5b27f5){if(_0x5b27f5){_0xe6960e[_0x74bc('0x26')]['contact']=_0x5b27f5[0x0];if(!_0x1ad331['body'][_0x74bc('0x5d')])return;return db[_0x74bc('0x6f')]['find']({'where':{'id':_0x1ad331[_0x74bc('0x56')]['UserId'],'role':_0x74bc('0x7d')},'attributes':['id',_0x74bc('0x36'),_0x74bc('0x70'),_0x74bc('0x71'),_0x74bc('0x7e')],'raw':!![]});}return null;})[_0x74bc('0x20')](function(_0x4a3817){if(!_0x4a3817)return null;_0xe6960e['message']['agent']=_0x4a3817;return _0xe6960e;})['then'](function(_0x55ef04){if(_0x55ef04){_0x55ef04[_0x74bc('0x26')]['interface']=util[_0x74bc('0x5b')]('SIP/%s',_0x1ad331[_0x74bc('0x5e')][_0x74bc('0x36')]);_0x55ef04['message'][_0x74bc('0x74')]=_0xe6960e[_0x74bc('0x74')];_0x55ef04['message'][_0x74bc('0x7f')]=_0xe6960e['channel'];_0x55ef04['message'][_0x74bc('0x75')]=_0x74bc('0x78');respondWithRpcPromise(_0x74bc('0x76'),_0x74bc('0x76'),{'event':'rejectmessage','message':_0x55ef04[_0x74bc('0x26')]},client9002);return _0xe6960e;}return null;})['then'](respondWithResult(_0x234720,null))[_0x74bc('0x51')](handleError(_0x234720,null));};exports[_0x74bc('0x2b')]=function(_0x206fcb,_0x1a876a,_0x55f19b){if(_0x206fcb[_0x74bc('0x56')]['id']){delete _0x206fcb[_0x74bc('0x56')]['id'];}var _0x2b25e0;return db[_0x74bc('0x3a')][_0x74bc('0x54')]({'where':{'id':_0x206fcb[_0x74bc('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a876a,null))[_0x74bc('0x20')](function(_0x52e2de){if(_0x52e2de){_0x2b25e0=_0x52e2de;return db[_0x74bc('0x80')]['find']({'where':{'id':_0x52e2de[_0x74bc('0x81')]}});}})[_0x74bc('0x20')](handleEntityNotFound(_0x1a876a,null))['then'](function(_0x138da2){if(_0x138da2){logger['debug'](_0x74bc('0x82'),_0x74bc('0x2b'),'received\x20delivery\x20report\x20from',_0x138da2['type'],util[_0x74bc('0x83')](_0x206fcb['body'],{'showHidden':![],'depth':null}));switch(_0x138da2[_0x74bc('0x4c')]){case _0x74bc('0x84'):if(_0x206fcb['body'][_0x74bc('0x85')]&&_0x206fcb['body'][_0x74bc('0x85')]===_0x2b25e0[_0x74bc('0x86')]){return _0x2b25e0[_0x74bc('0x34')]({'read':!![]});}else{logger[_0x74bc('0x25')](_0x74bc('0x87'),_0x74bc('0x2b'),_0x74bc('0x84'),util[_0x74bc('0x83')](_0x206fcb['body'],{'showHidden':![],'depth':null}));}break;case _0x74bc('0x88'):if(_0x206fcb[_0x74bc('0x56')][_0x74bc('0x89')]&&_0x206fcb['body'][_0x74bc('0x89')]===_0x2b25e0['messageId']&&_['indexOf'](['sent',_0x74bc('0x8a')],_0x206fcb[_0x74bc('0x56')][_0x74bc('0x8b')])>=0x0){return _0x2b25e0[_0x74bc('0x34')]({'read':!![]});}else{logger[_0x74bc('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x74bc('0x2b'),'plivio',util['inspect'](_0x206fcb[_0x74bc('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5abac1=_0x206fcb[_0x74bc('0x56')]['results'][0x0];if(_0x5abac1[_0x74bc('0x2b')][_0x74bc('0x8c')]==='DELIVERED'){return _0x2b25e0[_0x74bc('0x34')]({'read':!![]});}else{logger[_0x74bc('0x25')](_0x74bc('0x87'),_0x74bc('0x2b'),_0x74bc('0x8d'),util[_0x74bc('0x83')](_0x206fcb[_0x74bc('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2b25e0;}})[_0x74bc('0x20')](respondWithResult(_0x1a876a,null))['catch'](handleError(_0x1a876a,null));}; \ No newline at end of file +var _0xf18a=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','destroy','sendStatus','name','send','map','SmsMessage','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','length','merge','find','create','body','update','describe','sms-interactions','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','sequelize','QueryTypes','fullname','email','motionChannel','rejectmessage','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash'];(function(_0x41ba6a,_0x42c5d9){var _0x315f92=function(_0x1cd96b){while(--_0x1cd96b){_0x41ba6a['push'](_0x41ba6a['shift']());}};_0x315f92(++_0x42c5d9);}(_0xf18a,0x19d));var _0xaf18=function(_0x1ffd11,_0x1feb2d){_0x1ffd11=_0x1ffd11-0x0;var _0x2262d1=_0xf18a[_0x1ffd11];return _0x2262d1;};'use strict';var emlformat=require(_0xaf18('0x0'));var rimraf=require(_0xaf18('0x1'));var zipdir=require(_0xaf18('0x2'));var jsonpatch=require(_0xaf18('0x3'));var rp=require(_0xaf18('0x4'));var moment=require(_0xaf18('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xaf18('0x6'));var sox=require(_0xaf18('0x7'));var csv=require(_0xaf18('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf18('0x9'));var squel=require('squel');var crypto=require(_0xaf18('0xa'));var jsforce=require(_0xaf18('0xb'));var deskjs=require(_0xaf18('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaf18('0xd'));var Redis=require(_0xaf18('0xe'));var authService=require(_0xaf18('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf18('0x10'));var logger=require(_0xaf18('0x11'))('api');var utils=require(_0xaf18('0x12'));var config=require(_0xaf18('0x13'));var licenseUtil=require(_0xaf18('0x14'));var db=require(_0xaf18('0x15'))['db'];config[_0xaf18('0x16')]=_[_0xaf18('0x17')](config[_0xaf18('0x16')],{'host':_0xaf18('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaf18('0x16')]));require(_0xaf18('0x19'))['register'](socket);var jayson=require(_0xaf18('0x1a'));var client=jayson[_0xaf18('0x1b')][_0xaf18('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xaf18('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4cd0cf,_0x466199,_0x38fd79,_0x40f321){return new BPromise(function(_0x5648f4,_0x3612c7){var _0x556690=_0x40f321||client;return _0x556690[_0xaf18('0x1d')](_0x4cd0cf,_0x38fd79)[_0xaf18('0x1e')](function(_0x57eb3f){logger['info'](_0xaf18('0x1f'),_0x466199,_0xaf18('0x20'));logger[_0xaf18('0x21')](_0xaf18('0x22'),_0x466199,_0xaf18('0x20'),JSON['stringify'](_0x57eb3f));if(_0x57eb3f[_0xaf18('0x23')]){if(_0x57eb3f['error'][_0xaf18('0x24')]===0x1f4){logger[_0xaf18('0x23')](_0xaf18('0x1f'),_0x466199,_0x57eb3f[_0xaf18('0x23')][_0xaf18('0x25')]);return _0x3612c7(_0x57eb3f[_0xaf18('0x23')][_0xaf18('0x25')]);}logger[_0xaf18('0x23')](_0xaf18('0x1f'),_0x466199,_0x57eb3f[_0xaf18('0x23')]['message']);return _0x5648f4(_0x57eb3f[_0xaf18('0x23')][_0xaf18('0x25')]);}else{logger[_0xaf18('0x26')](_0xaf18('0x1f'),_0x466199,_0xaf18('0x20'));_0x5648f4(_0x57eb3f[_0xaf18('0x27')][_0xaf18('0x25')]);}})[_0xaf18('0x28')](function(_0x58a531){logger[_0xaf18('0x23')](_0xaf18('0x1f'),_0x466199,_0x58a531);_0x3612c7(_0x58a531);});});}function respondWithStatusCode(_0x510d41,_0x4538a6){_0x4538a6=_0x4538a6||0xcc;return function(_0x4d797b){if(_0x4d797b){return _0x510d41['sendStatus'](_0x4538a6);}return _0x510d41[_0xaf18('0x29')](_0x4538a6)[_0xaf18('0x2a')]();};}function respondWithResult(_0x122463,_0x13512f){_0x13512f=_0x13512f||0xc8;return function(_0x41ff5e){if(_0x41ff5e){return _0x122463[_0xaf18('0x29')](_0x13512f)[_0xaf18('0x2b')](_0x41ff5e);}};}function respondWithFilteredResult(_0x332c79,_0xbb0283){return function(_0x50bde4){if(_0x50bde4){var _0x10af8a=typeof _0xbb0283['offset']===_0xaf18('0x2c')&&typeof _0xbb0283[_0xaf18('0x2d')]===_0xaf18('0x2c');var _0x4a96ac=_0x50bde4['count'];var _0x3b867=_0x10af8a?0x0:_0xbb0283[_0xaf18('0x2e')];var _0x3363f2=_0x10af8a?_0x50bde4[_0xaf18('0x2f')]:_0xbb0283['offset']+_0xbb0283[_0xaf18('0x2d')];var _0x289d61;if(_0x3363f2>=_0x4a96ac){_0x3363f2=_0x4a96ac;_0x289d61=0xc8;}else{_0x289d61=0xce;}_0x332c79[_0xaf18('0x29')](_0x289d61);return _0x332c79['set'](_0xaf18('0x30'),_0x3b867+'-'+_0x3363f2+'/'+_0x4a96ac)[_0xaf18('0x2b')](_0x50bde4);}return null;};}function patchUpdates(_0x388989){return function(_0x132c0c){try{jsonpatch[_0xaf18('0x31')](_0x132c0c,_0x388989,!![]);}catch(_0x1939c3){return BPromise[_0xaf18('0x32')](_0x1939c3);}return _0x132c0c[_0xaf18('0x33')]();};}function saveUpdates(_0x5e963d,_0x5cf5fe){return function(_0x1085e2){if(_0x1085e2){return _0x1085e2['update'](_0x5e963d)['then'](function(_0x58ebf3){return _0x58ebf3;});}return null;};}function removeEntity(_0x1cb12f,_0x3f9dc8){return function(_0x58eaa){if(_0x58eaa){return _0x58eaa[_0xaf18('0x34')]()[_0xaf18('0x1e')](function(){_0x1cb12f['status'](0xcc)[_0xaf18('0x2a')]();});}};}function handleEntityNotFound(_0x50f0eb,_0x30b2b3){return function(_0x1fe457){if(!_0x1fe457){_0x50f0eb[_0xaf18('0x35')](0x194);}return _0x1fe457;};}function handleError(_0x2dbebb,_0x58b5bb){_0x58b5bb=_0x58b5bb||0x1f4;return function(_0x45fb05){logger['error'](_0x45fb05['stack']);if(_0x45fb05[_0xaf18('0x36')]){delete _0x45fb05[_0xaf18('0x36')];}_0x2dbebb[_0xaf18('0x29')](_0x58b5bb)[_0xaf18('0x37')](_0x45fb05);};}exports['index']=function(_0x4d319a,_0x1f1c35){var _0x4d672a={},_0x204ef8={},_0x5c6d8f={'count':0x0,'rows':[]};var _0xf5b1aa=_[_0xaf18('0x38')](db[_0xaf18('0x39')]['rawAttributes'],function(_0x356a93){return{'name':_0x356a93['fieldName'],'type':_0x356a93[_0xaf18('0x3a')]['key']};});_0x204ef8[_0xaf18('0x3b')]=_[_0xaf18('0x38')](_0xf5b1aa,_0xaf18('0x36'));_0x204ef8['query']=_[_0xaf18('0x3c')](_0x4d319a[_0xaf18('0x3d')]);_0x204ef8[_0xaf18('0x3e')]=_[_0xaf18('0x3f')](_0x204ef8['model'],_0x204ef8['query']);_0x4d672a['attributes']=_[_0xaf18('0x3f')](_0x204ef8[_0xaf18('0x3b')],qs[_0xaf18('0x40')](_0x4d319a['query'][_0xaf18('0x40')]));_0x4d672a['attributes']=_0x4d672a[_0xaf18('0x41')]['length']?_0x4d672a[_0xaf18('0x41')]:_0x204ef8[_0xaf18('0x3b')];if(!_0x4d319a[_0xaf18('0x3d')][_0xaf18('0x42')]('nolimit')){_0x4d672a[_0xaf18('0x2d')]=qs['limit'](_0x4d319a['query'][_0xaf18('0x2d')]);_0x4d672a[_0xaf18('0x2e')]=qs[_0xaf18('0x2e')](_0x4d319a[_0xaf18('0x3d')][_0xaf18('0x2e')]);}_0x4d672a[_0xaf18('0x43')]=qs['sort'](_0x4d319a[_0xaf18('0x3d')][_0xaf18('0x44')]);_0x4d672a[_0xaf18('0x45')]=qs['filters'](_['pick'](_0x4d319a['query'],_0x204ef8[_0xaf18('0x3e')]),_0xf5b1aa);if(_0x4d319a[_0xaf18('0x3d')][_0xaf18('0x46')]){_0x4d672a['where']=_['merge'](_0x4d672a[_0xaf18('0x45')],{'$or':_[_0xaf18('0x38')](_0xf5b1aa,function(_0x59e1c4){if(_0x59e1c4[_0xaf18('0x3a')]!==_0xaf18('0x47')){var _0x3e7604={};_0x3e7604[_0x59e1c4[_0xaf18('0x36')]]={'$like':'%'+_0x4d319a['query'][_0xaf18('0x46')]+'%'};return _0x3e7604;}})});}_0x4d672a=_['merge']({},_0x4d672a,_0x4d319a[_0xaf18('0x48')]);var _0xabc5c7={'where':_0x4d672a[_0xaf18('0x45')]};return db['SmsMessage'][_0xaf18('0x2f')](_0xabc5c7)[_0xaf18('0x1e')](function(_0xc1e3fe){_0x5c6d8f[_0xaf18('0x2f')]=_0xc1e3fe;if(_0x4d319a['query'][_0xaf18('0x49')]){_0x4d672a[_0xaf18('0x4a')]=[{'all':!![]}];}return db[_0xaf18('0x39')][_0xaf18('0x4b')](_0x4d672a);})[_0xaf18('0x1e')](function(_0x42f830){_0x5c6d8f['rows']=_0x42f830;return _0x5c6d8f;})[_0xaf18('0x1e')](respondWithFilteredResult(_0x1f1c35,_0x4d672a))[_0xaf18('0x28')](handleError(_0x1f1c35,null));};exports[_0xaf18('0x4c')]=function(_0x256718,_0x152eeb){var _0x4b1dd4={'raw':!![],'where':{'id':_0x256718[_0xaf18('0x4d')]['id']}},_0x2a3eda={};_0x2a3eda[_0xaf18('0x3b')]=_[_0xaf18('0x3c')](db[_0xaf18('0x39')][_0xaf18('0x4e')]);_0x2a3eda[_0xaf18('0x3d')]=_['keys'](_0x256718[_0xaf18('0x3d')]);_0x2a3eda[_0xaf18('0x3e')]=_[_0xaf18('0x3f')](_0x2a3eda[_0xaf18('0x3b')],_0x2a3eda[_0xaf18('0x3d')]);_0x4b1dd4['attributes']=_[_0xaf18('0x3f')](_0x2a3eda['model'],qs[_0xaf18('0x40')](_0x256718['query']['fields']));_0x4b1dd4[_0xaf18('0x41')]=_0x4b1dd4[_0xaf18('0x41')][_0xaf18('0x4f')]?_0x4b1dd4[_0xaf18('0x41')]:_0x2a3eda['model'];if(_0x256718[_0xaf18('0x3d')]['includeAll']){_0x4b1dd4[_0xaf18('0x4a')]=[{'all':!![]}];}_0x4b1dd4=_[_0xaf18('0x50')]({},_0x4b1dd4,_0x256718['options']);return db['SmsMessage'][_0xaf18('0x51')](_0x4b1dd4)['then'](handleEntityNotFound(_0x152eeb,null))[_0xaf18('0x1e')](respondWithResult(_0x152eeb,null))[_0xaf18('0x28')](handleError(_0x152eeb,null));};exports[_0xaf18('0x52')]=function(_0x5ed1f2,_0x35fc7d){return db[_0xaf18('0x39')][_0xaf18('0x52')](_0x5ed1f2[_0xaf18('0x53')],{})['then'](respondWithResult(_0x35fc7d,0xc9))[_0xaf18('0x28')](handleError(_0x35fc7d,null));};exports[_0xaf18('0x54')]=function(_0x4549fd,_0x335788){if(_0x4549fd['body']['id']){delete _0x4549fd[_0xaf18('0x53')]['id'];}return db[_0xaf18('0x39')][_0xaf18('0x51')]({'where':{'id':_0x4549fd[_0xaf18('0x4d')]['id']}})[_0xaf18('0x1e')](handleEntityNotFound(_0x335788,null))[_0xaf18('0x1e')](saveUpdates(_0x4549fd[_0xaf18('0x53')],null))[_0xaf18('0x1e')](respondWithResult(_0x335788,null))[_0xaf18('0x28')](handleError(_0x335788,null));};exports['destroy']=function(_0x509c4e,_0x2e1378){return db[_0xaf18('0x39')][_0xaf18('0x51')]({'where':{'id':_0x509c4e[_0xaf18('0x4d')]['id']}})[_0xaf18('0x1e')](handleEntityNotFound(_0x2e1378,null))[_0xaf18('0x1e')](removeEntity(_0x2e1378,null))['catch'](handleError(_0x2e1378,null));};exports[_0xaf18('0x55')]=function(_0x162471,_0x438bca){return db[_0xaf18('0x39')][_0xaf18('0x55')]()['then'](respondWithResult(_0x438bca,null))['catch'](handleError(_0x438bca,null));};var interaction_log=require(_0xaf18('0x11'))(_0xaf18('0x56'));exports['accept']=function(_0x416e04,_0x1f5e7b,_0x54e468){var _0x42d4d0={'agent':{},'channel':_0xaf18('0x57')};if(_0x416e04[_0xaf18('0x53')]['id']){delete _0x416e04[_0xaf18('0x53')]['id'];}_0x416e04[_0xaf18('0x53')]['read']=!![];_0x416e04['body'][_0xaf18('0x58')]=moment()[_0xaf18('0x59')](_0xaf18('0x5a'));_0x416e04[_0xaf18('0x53')][_0xaf18('0x5b')]=_0x416e04['body']['UserId']||_0x416e04[_0xaf18('0x5c')]['id'];_0x42d4d0['agent']['id']=_0x416e04[_0xaf18('0x53')]['UserId'];return db['SmsMessage'][_0xaf18('0x51')]({'where':{'id':_0x416e04[_0xaf18('0x4d')]['id'],'UserId':null}})[_0xaf18('0x1e')](handleEntityNotFound(_0x1f5e7b,null))[_0xaf18('0x1e')](saveUpdates(_0x416e04['body'],null))[_0xaf18('0x1e')](function(_0x3b844a){if(_0x3b844a){_0x42d4d0[_0xaf18('0x25')]=_0x3b844a[_0xaf18('0x5d')]({'plain':!![]});return db[_0xaf18('0x5e')][_0xaf18('0x51')]({'where':{'id':_0x3b844a[_0xaf18('0x5f')]}});}return null;})[_0xaf18('0x1e')](handleEntityNotFound(_0x1f5e7b,null))[_0xaf18('0x1e')](function(_0x520713){if(_0x520713){return _0x520713[_0xaf18('0x54')]({'UserId':_0x416e04[_0xaf18('0x53')][_0xaf18('0x5b')],'read1stAt':_[_0xaf18('0x60')](_0x520713[_0xaf18('0x61')])?moment()[_0xaf18('0x59')](_0xaf18('0x5a')):undefined});}return null;})[_0xaf18('0x1e')](function(_0x305bff){if(_0x305bff){_0x42d4d0['interaction']=_0x305bff[_0xaf18('0x5d')]({'plain':!![]});interaction_log[_0xaf18('0x26')](_0xaf18('0x62'),_0x416e04['user']['id'],_0x416e04[_0xaf18('0x5c')][_0xaf18('0x36')],_0x416e04['user'][_0xaf18('0x63')],_0x42d4d0[_0xaf18('0x64')]['id'],_0x416e04[_0xaf18('0x53')]?JSON['stringify'](_0x416e04[_0xaf18('0x53')]):'null');return respondWithRpcPromise(_0xaf18('0x65'),_0xaf18('0x66'),_0x42d4d0);}return null;})[_0xaf18('0x1e')](function(_0x5f24b2){var _0x3d6cdc=_0xaf18('0x67')+_0x5f24b2['message'][_0xaf18('0x68')];return db['sequelize'][_0xaf18('0x3d')](_0x3d6cdc,{'type':db[_0xaf18('0x69')]['QueryTypes'][_0xaf18('0x6a')],'raw':!![]})[_0xaf18('0x1e')](function(_0x5c7b1c){return _0x5c7b1c;});})[_0xaf18('0x1e')](function(_0x542c18){if(_0x542c18){_0x42d4d0[_0xaf18('0x25')][_0xaf18('0x6b')]=_0x542c18[0x0];if(!_0x416e04['body']['UserId'])return;return db[_0xaf18('0x6c')][_0xaf18('0x51')]({'where':{'id':_0x416e04[_0xaf18('0x53')][_0xaf18('0x5b')],'role':_0xaf18('0x6d')},'attributes':['id',_0xaf18('0x36'),'fullname','email',_0xaf18('0x6e')],'raw':!![]});}return null;})[_0xaf18('0x1e')](function(_0x45b43d){if(!_0x45b43d)return null;_0x42d4d0['message']['agent']=_0x45b43d;return _0x42d4d0;})[_0xaf18('0x1e')](function(_0x43ec95){if(_0x43ec95){if(_0x416e04[_0xaf18('0x53')]['manual']){_0x42d4d0[_0xaf18('0x25')][_0xaf18('0x6f')]=util[_0xaf18('0x59')](_0xaf18('0x70'),_0x416e04[_0xaf18('0x5c')]['name']);_0x42d4d0[_0xaf18('0x25')][_0xaf18('0x71')]=_0x42d4d0[_0xaf18('0x71')];_0x42d4d0[_0xaf18('0x25')]['motionChannel']=_0x42d4d0[_0xaf18('0x71')];_0x42d4d0['message'][_0xaf18('0x72')]=_0xaf18('0x73');return respondWithRpcPromise(_0xaf18('0x74'),_0xaf18('0x74'),{'event':_0xaf18('0x75'),'message':_0x42d4d0[_0xaf18('0x25')]},client9002)[_0xaf18('0x1e')](function(){return _0x42d4d0;});}return _0x42d4d0;}return null;})['then'](respondWithResult(_0x1f5e7b,null))['catch'](handleError(_0x1f5e7b,null));};var interaction_log=require(_0xaf18('0x11'))(_0xaf18('0x56'));exports[_0xaf18('0x32')]=function(_0x55cd3c,_0x44f95d,_0x363268){var _0x37b6d0={'agent':{},'channel':'sms'};if(_0x55cd3c['body']['id']){delete _0x55cd3c[_0xaf18('0x53')]['id'];}_0x55cd3c['body']['UserId']=_0x55cd3c['body']['UserId']||_0x55cd3c[_0xaf18('0x5c')]['id'];_0x37b6d0[_0xaf18('0x6d')]['id']=_0x55cd3c['body'][_0xaf18('0x5b')];return db[_0xaf18('0x39')][_0xaf18('0x51')]({'where':{'id':_0x55cd3c['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44f95d,null))[_0xaf18('0x1e')](function(_0x300aa6){if(_0x300aa6){_0x37b6d0[_0xaf18('0x25')]=_0x300aa6[_0xaf18('0x5d')]({'plain':!![]});return db[_0xaf18('0x5e')][_0xaf18('0x51')]({'where':{'id':_0x300aa6[_0xaf18('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x44f95d,null))['then'](function(_0x3738e5){if(_0x3738e5){_0x37b6d0[_0xaf18('0x64')]=_0x3738e5['get']({'plain':!![]});interaction_log[_0xaf18('0x26')](_0xaf18('0x76'),_0x55cd3c[_0xaf18('0x5c')]['id'],_0x55cd3c[_0xaf18('0x5c')][_0xaf18('0x36')],_0x55cd3c['user']['role'],_0x37b6d0[_0xaf18('0x64')]['id'],_0x55cd3c[_0xaf18('0x53')]?JSON[_0xaf18('0x77')](_0x55cd3c[_0xaf18('0x53')]):'null');return respondWithRpcPromise(_0xaf18('0x78'),'rejectMessage',_0x37b6d0);}return null;})[_0xaf18('0x1e')](function(_0x1d741){var _0x5be698=_0xaf18('0x67')+_0x1d741[_0xaf18('0x25')]['ContactId'];return db[_0xaf18('0x79')][_0xaf18('0x3d')](_0x5be698,{'type':db['Sequelize'][_0xaf18('0x7a')][_0xaf18('0x6a')],'raw':!![]})[_0xaf18('0x1e')](function(_0x3b7dd7){return _0x3b7dd7;});})[_0xaf18('0x1e')](function(_0x3a5be7){if(_0x3a5be7){_0x37b6d0[_0xaf18('0x25')][_0xaf18('0x6b')]=_0x3a5be7[0x0];if(!_0x55cd3c[_0xaf18('0x53')]['UserId'])return;return db['User'][_0xaf18('0x51')]({'where':{'id':_0x55cd3c[_0xaf18('0x53')][_0xaf18('0x5b')],'role':_0xaf18('0x6d')},'attributes':['id',_0xaf18('0x36'),_0xaf18('0x7b'),_0xaf18('0x7c'),_0xaf18('0x6e')],'raw':!![]});}return null;})[_0xaf18('0x1e')](function(_0x152f27){if(!_0x152f27)return null;_0x37b6d0[_0xaf18('0x25')]['agent']=_0x152f27;return _0x37b6d0;})[_0xaf18('0x1e')](function(_0x4d7a21){if(_0x4d7a21){_0x4d7a21[_0xaf18('0x25')][_0xaf18('0x6f')]=util[_0xaf18('0x59')](_0xaf18('0x70'),_0x55cd3c[_0xaf18('0x5c')][_0xaf18('0x36')]);_0x4d7a21['message']['channel']=_0x37b6d0[_0xaf18('0x71')];_0x4d7a21['message'][_0xaf18('0x7d')]=_0x37b6d0[_0xaf18('0x71')];_0x4d7a21['message'][_0xaf18('0x72')]=_0xaf18('0x32');respondWithRpcPromise(_0xaf18('0x74'),_0xaf18('0x74'),{'event':_0xaf18('0x7e'),'message':_0x4d7a21[_0xaf18('0x25')]},client9002);return _0x37b6d0;}return null;})[_0xaf18('0x1e')](respondWithResult(_0x44f95d,null))[_0xaf18('0x28')](handleError(_0x44f95d,null));};exports[_0xaf18('0x29')]=function(_0x29db48,_0x3580e6,_0x24360f){if(_0x29db48[_0xaf18('0x53')]['id']){delete _0x29db48['body']['id'];}var _0x2c8097;return db[_0xaf18('0x39')]['find']({'where':{'id':_0x29db48[_0xaf18('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3580e6,null))[_0xaf18('0x1e')](function(_0x366158){if(_0x366158){_0x2c8097=_0x366158;return db['SmsAccount'][_0xaf18('0x51')]({'where':{'id':_0x366158['SmsAccountId']}});}})[_0xaf18('0x1e')](handleEntityNotFound(_0x3580e6,null))[_0xaf18('0x1e')](function(_0x2102a4){if(_0x2102a4){logger[_0xaf18('0x21')](_0xaf18('0x22'),_0xaf18('0x29'),'received\x20delivery\x20report\x20from',_0x2102a4['type'],util['inspect'](_0x29db48[_0xaf18('0x53')],{'showHidden':![],'depth':null}));switch(_0x2102a4[_0xaf18('0x3a')]){case'twilio':if(_0x29db48[_0xaf18('0x53')]['MessageSid']&&_0x29db48[_0xaf18('0x53')][_0xaf18('0x7f')]===_0x2c8097[_0xaf18('0x80')]){return _0x2c8097['update']({'read':!![]});}else{logger[_0xaf18('0x23')](_0xaf18('0x81'),_0xaf18('0x29'),'twilio',util[_0xaf18('0x82')](_0x29db48['body'],{'showHidden':![],'depth':null}));}break;case _0xaf18('0x83'):if(_0x29db48[_0xaf18('0x53')][_0xaf18('0x84')]&&_0x29db48[_0xaf18('0x53')][_0xaf18('0x84')]===_0x2c8097[_0xaf18('0x80')]&&_[_0xaf18('0x85')]([_0xaf18('0x86'),_0xaf18('0x87')],_0x29db48[_0xaf18('0x53')][_0xaf18('0x88')])>=0x0){return _0x2c8097[_0xaf18('0x54')]({'read':!![]});}else{logger['error'](_0xaf18('0x81'),_0xaf18('0x29'),_0xaf18('0x89'),util[_0xaf18('0x82')](_0x29db48['body'],{'showHidden':![],'depth':null}));}break;case _0xaf18('0x8a'):var _0x54b0c4=_0x29db48[_0xaf18('0x53')]['results'][0x0];if(_0x54b0c4['status'][_0xaf18('0x8b')]===_0xaf18('0x8c')){return _0x2c8097['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf18('0x29'),_0xaf18('0x8a'),util['inspect'](_0x29db48[_0xaf18('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x2c8097;}})['then'](respondWithResult(_0x3580e6,null))[_0xaf18('0x28')](handleError(_0x3580e6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ead93c0..48a2da6 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 _0x0495=['emit','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x5e75ef,_0x4ce765){var _0x3c28b2=function(_0x29a66c){while(--_0x29a66c){_0x5e75ef['push'](_0x5e75ef['shift']());}};_0x3c28b2(++_0x4ce765);}(_0x0495,0xae));var _0x5049=function(_0xb79ba7,_0x1dae55){_0xb79ba7=_0xb79ba7-0x0;var _0x2c8c32=_0x0495[_0xb79ba7];return _0x2c8c32;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x5049('0x0'))['db'][_0x5049('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5049('0x2')](0x0);var events={'afterCreate':_0x5049('0x3'),'afterUpdate':_0x5049('0x4'),'afterDestroy':_0x5049('0x5')};function emitEvent(_0x19af42){return function(_0x5b16c4,_0x27fc0b,_0x12e449){SmsMessageEvents[_0x5049('0x6')](_0x19af42+':'+_0x5b16c4['id'],_0x5b16c4);SmsMessageEvents[_0x5049('0x6')](_0x19af42,_0x5b16c4);_0x12e449(null);};}for(var e in events){if(events[_0x5049('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x5049('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x4800=['hook','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4800,0x1f0));var _0x0480=function(_0x13a219,_0x25acd3){_0x13a219=_0x13a219-0x0;var _0x50e371=_0x4800[_0x13a219];return _0x50e371;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x0480('0x0'))['db'][_0x0480('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0480('0x2')](0x0);var events={'afterCreate':_0x0480('0x3'),'afterUpdate':_0x0480('0x4'),'afterDestroy':_0x0480('0x5')};function emitEvent(_0x131544){return function(_0x33b3b8,_0x2b80d0,_0x7fe292){SmsMessageEvents[_0x0480('0x6')](_0x131544+':'+_0x33b3b8['id'],_0x33b3b8);SmsMessageEvents[_0x0480('0x6')](_0x131544,_0x33b3b8);_0x7fe292(null);};}for(var e in events){if(events[_0x0480('0x7')](e)){var event=events[e];SmsMessage[_0x0480('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 5fcb142..a68a0fc 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 _0x2913=['messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','findOne','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','login?username=','username','&password=','password','then','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','read','inspect','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','apiKey','login','text','keys','sort','md5','digest','hex','signature=','GET','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages'];(function(_0x15edd3,_0x51b2ab){var _0x48d46c=function(_0x4667d3){while(--_0x4667d3){_0x15edd3['push'](_0x15edd3['shift']());}};_0x48d46c(++_0x51b2ab);}(_0x2913,0x15e));var _0x3291=function(_0x161d01,_0x473f18){_0x161d01=_0x161d01-0x0;var _0x3a3cf2=_0x2913[_0x161d01];return _0x3a3cf2;};'use strict';var _=require('lodash');var util=require(_0x3291('0x0'));var logger=require(_0x3291('0x1'))(_0x3291('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3291('0x3'));var fs=require('fs');var path=require(_0x3291('0x4'));var rimraf=require(_0x3291('0x5'));var config=require(_0x3291('0x6'));var attributes=require(_0x3291('0x7'));module['exports']=function(_0x17a2b0,_0x232cd6){return _0x17a2b0[_0x3291('0x8')]('SmsMessage',attributes,{'tableName':_0x3291('0x9'),'paranoid':![],'indexes':[{'name':_0x3291('0xa'),'fields':[_0x3291('0xa')]},{'name':_0x3291('0xb'),'fields':[_0x3291('0xc')],'type':_0x3291('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x516960,_0x2835b3,_0x3622b7){var _0x12e484=_0x17a2b0[_0x3291('0xe')];var _0x5eddec=_0x516960[_0x3291('0xf')]({'plain':!![]});if(_0x5eddec[_0x3291('0x10')][_0x3291('0x11')]()==='in'||_0x5eddec['direction'][_0x3291('0x11')]()===_0x3291('0x12')&&!_0x5eddec[_0x3291('0x13')]&&!_[_0x3291('0x14')](_0x5eddec[_0x3291('0x15')])&&!_[_0x3291('0x14')](_0x5eddec[_0x3291('0x16')])){_0x12e484['SmsInteraction'][_0x3291('0x17')]({'where':{'id':_0x5eddec[_0x3291('0x16')]}})['then'](function(_0x2cfa97){if(_0x2cfa97){_0x2cfa97['update']({'lastMsgAt':_0x5eddec['createdAt'],'lastMsgDirection':_0x5eddec['direction'][_0x3291('0x11')]()});}})[_0x3291('0x18')](function(_0x10d943){console[_0x3291('0x19')](_0x10d943);});}if(_0x5eddec[_0x3291('0x10')]===_0x3291('0x12')&&!_0x5eddec[_0x3291('0x13')]){var _0x2260b4;_0x12e484[_0x3291('0x1a')][_0x3291('0x1b')]({'where':{'id':_0x5eddec[_0x3291('0x1c')]},'raw':!![]})['then'](function(_0xe1b6eb){_0x2260b4=_0xe1b6eb;if(_0x2260b4&&_0x2260b4[_0x3291('0x1d')]){switch(_0x2260b4[_0x3291('0x1d')]){case _0x3291('0x1e'):var _0x317bbf=require(_0x3291('0x1e'));if(_0x2260b4[_0x3291('0x1f')]&&_0x2260b4[_0x3291('0x20')]&&_0x2260b4[_0x3291('0x21')]){var _0x3f58f4=new _0x317bbf(_0x2260b4[_0x3291('0x1f')],_0x2260b4[_0x3291('0x20')]);_0x3f58f4[_0x3291('0x22')][_0x3291('0x23')]({'body':_0x5eddec[_0x3291('0xc')],'to':_0x5eddec[_0x3291('0x21')],'from':_0x2260b4[_0x3291('0x21')],'statusCallback':_0x2260b4[_0x3291('0x24')]+_0x3291('0x25')+_0x5eddec['id']+_0x3291('0x26')+_0x2260b4[_0x3291('0x27')]})['then'](function(_0x195723){if(_0x195723['sid']){return _0x516960[_0x3291('0x28')]({'messageId':_0x195723[_0x3291('0x29')]});}})[_0x3291('0x18')](function(_0x55de98){logger['error'](_0x3291('0x2a'),'afterCreate','twilio',util['inspect'](_0x55de98,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x112068=_0x3291('0x2c');if(_0x2260b4['username']&&_0x2260b4['password']){var _0x38e728={'recipient':[_0x5eddec[_0x3291('0x21')]],'message':_0x5eddec[_0x3291('0xc')],'message_type':_0x2260b4['smsMethod']};if(_0x2260b4[_0x3291('0x2d')]&&_0x2260b4[_0x3291('0x2d')]!=='SI'){_0x38e728[_0x3291('0x2e')]=_0x2260b4[_0x3291('0x21')];}var _0x48b2d5={'url':_0x112068+_0x3291('0x2f')+_0x2260b4[_0x3291('0x30')]+_0x3291('0x31')+_0x2260b4[_0x3291('0x32')],'method':'GET'};rp(_0x48b2d5)[_0x3291('0x33')](function(_0x174593){var _0x21f3aa=_0x174593[_0x3291('0x34')](';');var _0x5e443a={'user_key':_0x21f3aa[0x0],'session_key':_0x21f3aa[0x1]};_0x48b2d5={'url':_0x112068+_0x3291('0x35'),'method':_0x3291('0x36'),'headers':{'user_key':_0x5e443a[_0x3291('0x37')],'Session_key':_0x5e443a[_0x3291('0x38')]},'json':!![],'body':_0x38e728};return rp(_0x48b2d5);})['then'](function(_0x5bfbf2){if(_0x5bfbf2[_0x3291('0x39')]>=0x1){var _0x2ff924={'messageId':_0x5bfbf2[_0x3291('0x3a')]};if(_0x2260b4[_0x3291('0x2d')]!=='GP'||!_0x2260b4[_0x3291('0x3b')]){_0x2ff924['read']=!![];}return _0x516960['update'](_0x2ff924);}else{return logger[_0x3291('0x19')](_0x3291('0x2a'),'afterCreate',_0x3291('0x3c'),util['inspect'](_0x5bfbf2,{'showHidden':![],'depth':null}));}})[_0x3291('0x18')](function(_0x1267f5){return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x3c'),util['inspect'](_0x1267f5,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x3c'),_0x3291('0x3d'));}break;case _0x3291('0x3e'):if(_0x2260b4['authToken']){var _0x14609f={'recipient':_0x5eddec[_0x3291('0x21')],'message':_0x5eddec[_0x3291('0xc')],'sender':_0x2260b4[_0x3291('0x3f')]||_0x2260b4[_0x3291('0x21')],'authorization':_0x2260b4[_0x3291('0x20')]};var _0x2835b3={'method':_0x3291('0x36'),'uri':_0x3291('0x40'),'body':_0x14609f,'json':!![]};rp(_0x2835b3)[_0x3291('0x33')](function(_0x4df004){var _0x58c7ae={'messageId':_0x4df004['requestid']};if(!_0x2260b4['deliveryReport']){_0x58c7ae[_0x3291('0x41')]=!![];}return _0x516960[_0x3291('0x28')](_0x58c7ae);})[_0x3291('0x18')](function(_0x5f0826){logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x3e'),util[_0x3291('0x42')](_0x5f0826,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')](_0x3291('0x2a'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case _0x3291('0x43'):if(_0x2260b4[_0x3291('0x30')]&&_0x2260b4[_0x3291('0x32')]){var _0x14609f={'messages':[{'source':'xCALLY\x20Motion','to':_0x5eddec[_0x3291('0x21')],'body':_0x5eddec[_0x3291('0xc')],'from':_0x2260b4[_0x3291('0x3f')]||_0x2260b4[_0x3291('0x21')]}]};var _0x706faf=util[_0x3291('0x44')](_0x3291('0x45'),_0x2260b4[_0x3291('0x30')],_0x2260b4[_0x3291('0x32')]);var _0x2835b3={'method':_0x3291('0x36'),'uri':_0x3291('0x46'),'body':_0x14609f,'headers':{'Authorization':util[_0x3291('0x44')](_0x3291('0x47'),new Buffer(_0x706faf)[_0x3291('0x48')](_0x3291('0x49')))},'json':!![]};rp(_0x2835b3)[_0x3291('0x33')](function(_0x3a584f){if(_0x3a584f[_0x3291('0x4a')]>=0xc8&&_0x3a584f[_0x3291('0x4a')]<=0xce){if(_0x3a584f[_0x3291('0x4b')]&&_0x3a584f[_0x3291('0x4b')][_0x3291('0x4c')]>0x0){var _0xb382c1=_[_0x3291('0x4d')](_0x3a584f[_0x3291('0x4b')][_0x3291('0x22')]);var _0x932a83={'messageId':_0xb382c1[_0x3291('0x4e')]};if(!_0x2260b4[_0x3291('0x3b')]){_0x932a83[_0x3291('0x41')]=!![];}return _0x516960['update'](_0x932a83);}else{logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3291('0x2b'),'clickSend',util[_0x3291('0x42')](_0x3a584f,{'showHidden':![],'depth':null}));}}else{logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x4f'),util[_0x3291('0x42')](_0x3a584f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x35aeda){logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x4f'),util[_0x3291('0x42')](_0x35aeda,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3291('0x2b'),_0x3291('0x4f'),_0x3291('0x3d'));}break;case _0x3291('0x50'):if(_0x2260b4[_0x3291('0x51')]&&_0x2260b4['authToken']){var _0x14609f={'dst':_0x5eddec['phone'],'text':_0x5eddec[_0x3291('0xc')],'src':_0x2260b4[_0x3291('0x3f')]||_0x2260b4['phone'],'url':_0x2260b4[_0x3291('0x24')]+'/api/sms/messages/'+_0x5eddec['id']+_0x3291('0x26')+_0x2260b4['token']};var _0x706faf=util[_0x3291('0x44')](_0x3291('0x45'),_0x2260b4[_0x3291('0x51')],_0x2260b4['authToken']);var _0x2835b3={'method':_0x3291('0x36'),'uri':util[_0x3291('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2260b4[_0x3291('0x51')]),'body':_0x14609f,'headers':{'Authorization':util[_0x3291('0x44')](_0x3291('0x47'),new Buffer(_0x706faf)[_0x3291('0x48')](_0x3291('0x49')))},'json':!![]};rp(_0x2835b3)['then'](function(_0x954483){var _0x23f396={'messageId':_0x954483[_0x3291('0x52')][0x0]};return _0x516960[_0x3291('0x28')](_0x23f396);})['catch'](function(_0x276b7b){logger['error'](_0x3291('0x2a'),_0x3291('0x2b'),'plivo',util[_0x3291('0x42')](_0x276b7b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x3291('0x53'):if(_0x2260b4[_0x3291('0x30')]&&_0x2260b4[_0x3291('0x32')]){if(_0x2260b4[_0x3291('0x54')]){var _0x365f87={'method':'POST','uri':_0x2260b4['baseUrl']+_0x3291('0x55'),'body':{'username':_0x2260b4[_0x3291('0x30')],'password':_0x2260b4[_0x3291('0x32')]},'json':!![]};return rp(_0x365f87)[_0x3291('0x33')](function(_0x12e65c){var _0x4c9ad4={'method':_0x3291('0x36'),'uri':_0x2260b4[_0x3291('0x54')]+_0x3291('0x56'),'body':{'messages':[{'from':_0x2260b4[_0x3291('0x21')],'destinations':[{'to':_0x5eddec[_0x3291('0x21')]}],'text':_0x5eddec[_0x3291('0xc')],'notifyUrl':_0x2260b4[_0x3291('0x24')]+'/api/sms/messages/'+_0x5eddec['id']+_0x3291('0x26')+_0x2260b4[_0x3291('0x27')],'notifyContentType':'application/json','callbackData':_0x2260b4['phone']+';'+_0x5eddec[_0x3291('0xc')]}]},'headers':{'Authorization':_0x3291('0x57')+_0x12e65c['token']},'json':!![]};return rp(_0x4c9ad4)[_0x3291('0x33')](function(_0x584fef){if(_0x584fef[_0x3291('0x22')]){var _0x43863b={'messageId':_0x584fef[_0x3291('0x22')][0x0][_0x3291('0xa')]};if(!_0x2260b4['deliveryReport']){_0x43863b[_0x3291('0x41')]=!![];}return _0x516960[_0x3291('0x28')](_0x43863b);}else{return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x53'),util['inspect'](_0x584fef,{'showHidden':![],'depth':null}));}});})[_0x3291('0x18')](function(_0x2e2ab1){return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),'infobip',util[_0x3291('0x42')](_0x2e2ab1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3291('0x2b'),_0x3291('0x53'),_0x3291('0x3d'));}break;case _0x3291('0x58'):var _0x423ea3=require('crypto');if(_0x2260b4[_0x3291('0x59')]){var _0x38bb3b={};_0x38bb3b[_0x3291('0x5a')]=_0x2260b4[_0x3291('0x30')];_0x38bb3b[_0x3291('0x21')]=_0x5eddec[_0x3291('0x21')];_0x38bb3b[_0x3291('0x2e')]=_0x2260b4[_0x3291('0x21')];_0x38bb3b[_0x3291('0x5b')]=_0x5eddec[_0x3291('0xc')];_0x38bb3b['timestamp']=+new Date();var _0x1e62cd='';var _0x4911df='';var _0x325fc4=Object[_0x3291('0x5c')](_0x38bb3b);_0x325fc4[_0x3291('0x5d')]();for(var _0x1e98a3=0x0;_0x1e98a3<_0x325fc4['length'];_0x1e98a3++){if(_0x1e62cd!=''){_0x1e62cd+='&';}_0x1e62cd+=_0x325fc4[_0x1e98a3]+'='+encodeURIComponent(_0x38bb3b[_0x325fc4[_0x1e98a3]]);_0x4911df+=_0x38bb3b[_0x325fc4[_0x1e98a3]];}_0x4911df+=_0x2260b4[_0x3291('0x59')];_0x4911df=_0x423ea3['createHash'](_0x3291('0x5e'))['update'](_0x4911df)[_0x3291('0x5f')](_0x3291('0x60'));if(_0x1e62cd!==''){_0x1e62cd+='&';}_0x1e62cd+=_0x3291('0x61')+_0x4911df;var _0x48b2d5={'method':_0x3291('0x62'),'uri':_0x2260b4[_0x3291('0x54')]+'/external/get/send.php?'+_0x1e62cd,'json':!![]};return rp(_0x48b2d5)[_0x3291('0x33')](function(_0x1e5c08){var _0xe7f30a=Object[_0x3291('0x5c')](_0x1e5c08);if(_0x1e5c08[_0xe7f30a[0x0]][_0x3291('0x19')]&&parseInt(_0x1e5c08[_0xe7f30a[0x0]][_0x3291('0x19')])===0x0){var _0x4de094={'messageId':_0x1e5c08[_0xe7f30a[0x0]]['id_sms']};if(!_0x2260b4['deliveryReport']){_0x4de094['read']=!![];}return _0x516960[_0x3291('0x28')](_0x4de094);}else{return logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3291('0x58'),util[_0x3291('0x42')](_0x1e5c08[_0x3291('0x19')],{'showHidden':![],'depth':null}));}})[_0x3291('0x18')](function(_0x1a7fcb){return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x58'),util[_0x3291('0x42')](_0x1a7fcb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x58'),_0x3291('0x63'));}break;case'clickatell':if(_0x2260b4[_0x3291('0x59')]){var _0x4f6ea4={'method':_0x3291('0x36'),'uri':_0x3291('0x64'),'headers':{'Authorization':_0x2260b4[_0x3291('0x59')]},'body':{'content':_0x5eddec[_0x3291('0xc')],'to':[_0x5eddec['phone']],'from':_0x2260b4['phone'],'binary':![],'clientMessageId':_0x3291('0x65'),'charset':_0x3291('0x66')},'json':!![]};rp(_0x4f6ea4)[_0x3291('0x33')](function(_0x1f872f){if(!_0x1f872f['error']){var _0x339550={'messageId':_0x1f872f[_0x3291('0x22')][0x0][_0x3291('0x67')]};if(!_0x2260b4[_0x3291('0x3b')]){_0x339550[_0x3291('0x41')]=!![];}return _0x516960[_0x3291('0x28')](_0x339550);}else{return logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3291('0x2b'),_0x3291('0x68'),util['inspect'](_0x1f872f[_0x3291('0x19')],{'showHidden':![],'depth':null}));}})[_0x3291('0x18')](function(_0xc164ee){return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x68'),util[_0x3291('0x42')](_0xc164ee,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0x3291('0x69'):if(_0x2260b4[_0x3291('0x30')]&&_0x2260b4[_0x3291('0x32')]){var _0x706faf=util[_0x3291('0x44')](_0x3291('0x45'),_0x2260b4[_0x3291('0x30')],_0x2260b4['password']);var _0x2835b3={'method':_0x3291('0x36'),'uri':_0x3291('0x6a')+_0x2260b4[_0x3291('0x6b')]+'/messages','body':{'to':[_0x5eddec[_0x3291('0x21')]],'text':_0x5eddec[_0x3291('0xc')],'from':_0x2260b4[_0x3291('0x21')],'applicationId':_0x2260b4['applicationId']},'headers':{'Authorization':util[_0x3291('0x44')](_0x3291('0x47'),new Buffer(_0x706faf)[_0x3291('0x48')](_0x3291('0x49')))},'json':!![]};rp(_0x2835b3)['then'](function(_0x2be1d0){if(_0x2be1d0['id']){var _0x23ad51={'messageId':_0x2be1d0['id']};return _0x516960['update'](_0x23ad51);}else{logger[_0x3291('0x19')](_0x3291('0x2a'),'afterCreate',_0x3291('0x69'),util['inspect'](_0x2be1d0,{'showHidden':![],'depth':null}));}})[_0x3291('0x18')](function(_0x201865){logger[_0x3291('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3291('0x2b'),_0x3291('0x69'),util[_0x3291('0x42')](_0x201865,{'showHidden':![],'depth':null}));});}else{logger[_0x3291('0x19')](_0x3291('0x2a'),'afterCreate',_0x3291('0x69'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x3291('0x6c'):if(_0x2260b4[_0x3291('0x59')]){var _0x1dafc0={};var _0x48b2d5={'method':_0x3291('0x36'),'uri':_0x3291('0x6d'),'headers':{'Authorization':_0x3291('0x6e')+_0x2260b4[_0x3291('0x59')],'Content-Type':_0x3291('0x6f')},'body':{'from':_0x2260b4[_0x3291('0x21')],'to':_0x5eddec[_0x3291('0x21')],'text':_0x5eddec[_0x3291('0xc')]},'json':!![]};return rp(_0x48b2d5)['then'](function(_0x49c015){if(_0x49c015[_0x3291('0x70')]==0xca){_0x1dafc0['message']=_0x49c015;var _0x1ed1ee={'method':'POST','uri':_0x3291('0x71'),'headers':{'Authorization':_0x3291('0x6e')+_0x2260b4[_0x3291('0x59')],'Content-Type':_0x3291('0x6f')},'body':{'refid':_0x1dafc0[_0x3291('0x72')][_0x3291('0x73')]},'json':!![]};return rp(_0x1ed1ee)[_0x3291('0x33')](function(_0x5a8d0a){_0x1dafc0[_0x3291('0x74')]=_0x5a8d0a;var _0x5b021a={'messageId':_0x1dafc0['message'][_0x3291('0x73')],'read':!![]};return _0x516960['update'](_0x5b021a);});}else{return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),'intelepeer',util[_0x3291('0x42')](_0x49c015,{'showHidden':![],'depth':null}));}})[_0x3291('0x18')](function(_0x328311){return logger[_0x3291('0x19')](_0x3291('0x2a'),_0x3291('0x2b'),_0x3291('0x6c'),util[_0x3291('0x42')](_0x328311,{'showHidden':![],'depth':null}));});}else{return logger[_0x3291('0x19')](_0x3291('0x2a'),'afterCreate',_0x3291('0x6c'),_0x3291('0x75'));}break;}}})['finally'](function(){_0x3622b7();});}else{_0x3622b7();}}},'charset':_0x3291('0x76'),'collate':_0x3291('0x77')});}; \ No newline at end of file +var _0x1415=['SmsInteractionId','SmsInteraction','findOne','update','createdAt','error','SmsAccount','find','SmsAccountId','then','type','twilio','authToken','messages','create','phone','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','sender','password','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/status?token=','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','base64','intelepeer','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','toLowerCase','out','secret','isNil','UserId'];(function(_0x1f31fa,_0x5e96a){var _0x1b50ba=function(_0x4cbe5b){while(--_0x4cbe5b){_0x1f31fa['push'](_0x1f31fa['shift']());}};_0x1b50ba(++_0x5e96a);}(_0x1415,0x158));var _0x5141=function(_0x36caf5,_0x6f5e8){_0x36caf5=_0x36caf5-0x0;var _0x2d907b=_0x1415[_0x36caf5];return _0x2d907b;};'use strict';var _=require(_0x5141('0x0'));var util=require('util');var logger=require(_0x5141('0x1'))(_0x5141('0x2'));var moment=require(_0x5141('0x3'));var BPromise=require('bluebird');var rp=require(_0x5141('0x4'));var fs=require('fs');var path=require(_0x5141('0x5'));var rimraf=require('rimraf');var config=require(_0x5141('0x6'));var attributes=require(_0x5141('0x7'));module[_0x5141('0x8')]=function(_0x185f51,_0x4c41be){return _0x185f51[_0x5141('0x9')](_0x5141('0xa'),attributes,{'tableName':_0x5141('0xb'),'paranoid':![],'indexes':[{'name':_0x5141('0xc'),'fields':[_0x5141('0xc')]},{'name':_0x5141('0xd'),'fields':[_0x5141('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bc5f5,_0x342424,_0x4fc7e8){var _0xe4387e=_0x185f51[_0x5141('0xf')];var _0x407bf2=_0x2bc5f5[_0x5141('0x10')]({'plain':!![]});if(_0x407bf2['direction'][_0x5141('0x11')]()==='in'||_0x407bf2['direction'][_0x5141('0x11')]()===_0x5141('0x12')&&!_0x407bf2[_0x5141('0x13')]&&!_[_0x5141('0x14')](_0x407bf2[_0x5141('0x15')])&&!_[_0x5141('0x14')](_0x407bf2[_0x5141('0x16')])){_0xe4387e[_0x5141('0x17')][_0x5141('0x18')]({'where':{'id':_0x407bf2['SmsInteractionId']}})['then'](function(_0x2614de){if(_0x2614de){_0x2614de[_0x5141('0x19')]({'lastMsgAt':_0x407bf2[_0x5141('0x1a')],'lastMsgDirection':_0x407bf2['direction'][_0x5141('0x11')]()});}})['catch'](function(_0x20230b){console[_0x5141('0x1b')](_0x20230b);});}if(_0x407bf2['direction']===_0x5141('0x12')&&!_0x407bf2[_0x5141('0x13')]){var _0x1f1592;_0xe4387e[_0x5141('0x1c')][_0x5141('0x1d')]({'where':{'id':_0x407bf2[_0x5141('0x1e')]},'raw':!![]})[_0x5141('0x1f')](function(_0x5ed9ee){_0x1f1592=_0x5ed9ee;if(_0x1f1592&&_0x1f1592[_0x5141('0x20')]){switch(_0x1f1592[_0x5141('0x20')]){case _0x5141('0x21'):var _0x2d2c62=require(_0x5141('0x21'));if(_0x1f1592['accountSid']&&_0x1f1592['authToken']&&_0x1f1592['phone']){var _0x490509=new _0x2d2c62(_0x1f1592['accountSid'],_0x1f1592[_0x5141('0x22')]);_0x490509[_0x5141('0x23')][_0x5141('0x24')]({'body':_0x407bf2[_0x5141('0xe')],'to':_0x407bf2[_0x5141('0x25')],'from':_0x1f1592['phone'],'statusCallback':_0x1f1592[_0x5141('0x26')]+_0x5141('0x27')+_0x407bf2['id']+'/status?token='+_0x1f1592[_0x5141('0x28')]})[_0x5141('0x1f')](function(_0x35eaaa){if(_0x35eaaa['sid']){return _0x2bc5f5[_0x5141('0x19')]({'messageId':_0x35eaaa[_0x5141('0x29')]});}})[_0x5141('0x2a')](function(_0x58c50b){logger[_0x5141('0x1b')](_0x5141('0x2b'),'afterCreate',_0x5141('0x21'),util[_0x5141('0x2c')](_0x58c50b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5141('0x2b'),'afterCreate',_0x5141('0x21'),_0x5141('0x2d'));}break;case _0x5141('0x2e'):var _0xff8c46=_0x5141('0x2f');if(_0x1f1592['username']&&_0x1f1592['password']){var _0x5ca3cd={'recipient':[_0x407bf2['phone']],'message':_0x407bf2[_0x5141('0xe')],'message_type':_0x1f1592[_0x5141('0x30')]};if(_0x1f1592[_0x5141('0x30')]&&_0x1f1592['smsMethod']!=='SI'){_0x5ca3cd[_0x5141('0x31')]=_0x1f1592[_0x5141('0x25')];}var _0x4f2206={'url':_0xff8c46+'login?username='+_0x1f1592['username']+'&password='+_0x1f1592[_0x5141('0x32')],'method':'GET'};rp(_0x4f2206)[_0x5141('0x1f')](function(_0xdb6477){var _0x1e3aff=_0xdb6477[_0x5141('0x33')](';');var _0x2a73cf={'user_key':_0x1e3aff[0x0],'session_key':_0x1e3aff[0x1]};_0x4f2206={'url':_0xff8c46+_0x5141('0x34'),'method':_0x5141('0x35'),'headers':{'user_key':_0x2a73cf[_0x5141('0x36')],'Session_key':_0x2a73cf['session_key']},'json':!![],'body':_0x5ca3cd};return rp(_0x4f2206);})[_0x5141('0x1f')](function(_0x51f390){if(_0x51f390[_0x5141('0x37')]>=0x1){var _0xc25ba5={'messageId':_0x51f390[_0x5141('0x38')]};if(_0x1f1592[_0x5141('0x30')]!=='GP'||!_0x1f1592[_0x5141('0x39')]){_0xc25ba5[_0x5141('0x3a')]=!![];}return _0x2bc5f5[_0x5141('0x19')](_0xc25ba5);}else{return logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5141('0x2e'),util[_0x5141('0x2c')](_0x51f390,{'showHidden':![],'depth':null}));}})['catch'](function(_0xa55f6a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x2e'),util[_0x5141('0x2c')](_0xa55f6a,{'showHidden':![],'depth':null}));});}else{logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x2e'),_0x5141('0x3c'));}break;case _0x5141('0x3d'):if(_0x1f1592[_0x5141('0x22')]){var _0x39ec78={'recipient':_0x407bf2[_0x5141('0x25')],'message':_0x407bf2[_0x5141('0xe')],'sender':_0x1f1592[_0x5141('0x3e')]||_0x1f1592['phone'],'authorization':_0x1f1592[_0x5141('0x22')]};var _0x342424={'method':_0x5141('0x35'),'uri':_0x5141('0x3f'),'body':_0x39ec78,'json':!![]};rp(_0x342424)[_0x5141('0x1f')](function(_0x432353){var _0x10b9b4={'messageId':_0x432353[_0x5141('0x40')]};if(!_0x1f1592[_0x5141('0x39')]){_0x10b9b4['read']=!![];}return _0x2bc5f5[_0x5141('0x19')](_0x10b9b4);})[_0x5141('0x2a')](function(_0xb0f9a0){logger['error'](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x3d'),util[_0x5141('0x2c')](_0xb0f9a0,{'showHidden':![],'depth':null}));});}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x3d'),_0x5141('0x41'));}break;case _0x5141('0x42'):if(_0x1f1592[_0x5141('0x43')]&&_0x1f1592[_0x5141('0x32')]){var _0x39ec78={'messages':[{'source':_0x5141('0x44'),'to':_0x407bf2[_0x5141('0x25')],'body':_0x407bf2[_0x5141('0xe')],'from':_0x1f1592[_0x5141('0x3e')]||_0x1f1592[_0x5141('0x25')]}]};var _0x43f606=util[_0x5141('0x45')](_0x5141('0x46'),_0x1f1592[_0x5141('0x43')],_0x1f1592['password']);var _0x342424={'method':_0x5141('0x35'),'uri':_0x5141('0x47'),'body':_0x39ec78,'headers':{'Authorization':util[_0x5141('0x45')](_0x5141('0x48'),new Buffer(_0x43f606)[_0x5141('0x49')]('base64'))},'json':!![]};rp(_0x342424)[_0x5141('0x1f')](function(_0x44c6c2){if(_0x44c6c2[_0x5141('0x4a')]>=0xc8&&_0x44c6c2[_0x5141('0x4a')]<=0xce){if(_0x44c6c2[_0x5141('0x4b')]&&_0x44c6c2[_0x5141('0x4b')][_0x5141('0x4c')]>0x0){var _0x357d14=_[_0x5141('0x4d')](_0x44c6c2[_0x5141('0x4b')][_0x5141('0x23')]);var _0x333300={'messageId':_0x357d14['message_id']};if(!_0x1f1592[_0x5141('0x39')]){_0x333300['read']=!![];}return _0x2bc5f5[_0x5141('0x19')](_0x333300);}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),'clickSend',util['inspect'](_0x44c6c2,{'showHidden':![],'depth':null}));}}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),'afterCreate',_0x5141('0x4e'),util['inspect'](_0x44c6c2,{'showHidden':![],'depth':null}));}})[_0x5141('0x2a')](function(_0x2dc120){logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),'clickSend',util[_0x5141('0x2c')](_0x2dc120,{'showHidden':![],'depth':null}));});}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x4e'),_0x5141('0x3c'));}break;case _0x5141('0x4f'):if(_0x1f1592[_0x5141('0x50')]&&_0x1f1592[_0x5141('0x22')]){var _0x39ec78={'dst':_0x407bf2[_0x5141('0x25')],'text':_0x407bf2[_0x5141('0xe')],'src':_0x1f1592[_0x5141('0x3e')]||_0x1f1592[_0x5141('0x25')],'url':_0x1f1592[_0x5141('0x26')]+_0x5141('0x27')+_0x407bf2['id']+'/status?token='+_0x1f1592[_0x5141('0x28')]};var _0x43f606=util[_0x5141('0x45')](_0x5141('0x46'),_0x1f1592['authId'],_0x1f1592[_0x5141('0x22')]);var _0x342424={'method':'POST','uri':util[_0x5141('0x45')](_0x5141('0x51'),_0x1f1592['authId']),'body':_0x39ec78,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x43f606)[_0x5141('0x49')]('base64'))},'json':!![]};rp(_0x342424)[_0x5141('0x1f')](function(_0xc71e2e){var _0x43c9a4={'messageId':_0xc71e2e['message_uuid'][0x0]};return _0x2bc5f5[_0x5141('0x19')](_0x43c9a4);})[_0x5141('0x2a')](function(_0x26258e){logger[_0x5141('0x1b')](_0x5141('0x2b'),'afterCreate',_0x5141('0x4f'),util['inspect'](_0x26258e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5141('0x2b'),_0x5141('0x3b'),'plivo',_0x5141('0x52'));}break;case'infobip':if(_0x1f1592['username']&&_0x1f1592[_0x5141('0x32')]){if(_0x1f1592[_0x5141('0x53')]){var _0x3a1dce={'method':'POST','uri':_0x1f1592[_0x5141('0x53')]+'/auth/1/session','body':{'username':_0x1f1592[_0x5141('0x43')],'password':_0x1f1592[_0x5141('0x32')]},'json':!![]};return rp(_0x3a1dce)['then'](function(_0x43c138){var _0x53504c={'method':_0x5141('0x35'),'uri':_0x1f1592[_0x5141('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1f1592[_0x5141('0x25')],'destinations':[{'to':_0x407bf2[_0x5141('0x25')]}],'text':_0x407bf2['body'],'notifyUrl':_0x1f1592[_0x5141('0x26')]+'/api/sms/messages/'+_0x407bf2['id']+_0x5141('0x54')+_0x1f1592['token'],'notifyContentType':_0x5141('0x55'),'callbackData':_0x1f1592[_0x5141('0x25')]+';'+_0x407bf2[_0x5141('0xe')]}]},'headers':{'Authorization':_0x5141('0x56')+_0x43c138[_0x5141('0x28')]},'json':!![]};return rp(_0x53504c)[_0x5141('0x1f')](function(_0x127cf4){if(_0x127cf4[_0x5141('0x23')]){var _0x1b6f99={'messageId':_0x127cf4[_0x5141('0x23')][0x0][_0x5141('0xc')]};if(!_0x1f1592[_0x5141('0x39')]){_0x1b6f99[_0x5141('0x3a')]=!![];}return _0x2bc5f5[_0x5141('0x19')](_0x1b6f99);}else{return logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x57'),util['inspect'](_0x127cf4,{'showHidden':![],'depth':null}));}});})[_0x5141('0x2a')](function(_0x2de1ee){return logger['error'](_0x5141('0x2b'),_0x5141('0x3b'),'infobip',util['inspect'](_0x2de1ee,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5141('0x2b'),'afterCreate',_0x5141('0x57'),_0x5141('0x58'));}}else{logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x57'),_0x5141('0x3c'));}break;case _0x5141('0x59'):var _0x2e7081=require(_0x5141('0x5a'));if(_0x1f1592[_0x5141('0x5b')]){var _0x19cd84={};_0x19cd84[_0x5141('0x5c')]=_0x1f1592[_0x5141('0x43')];_0x19cd84[_0x5141('0x25')]=_0x407bf2[_0x5141('0x25')];_0x19cd84[_0x5141('0x31')]=_0x1f1592['phone'];_0x19cd84[_0x5141('0x5d')]=_0x407bf2[_0x5141('0xe')];_0x19cd84[_0x5141('0x5e')]=+new Date();var _0x54e21c='';var _0x586dcc='';var _0x13e179=Object[_0x5141('0x5f')](_0x19cd84);_0x13e179[_0x5141('0x60')]();for(var _0x392d39=0x0;_0x392d39<_0x13e179[_0x5141('0x61')];_0x392d39++){if(_0x54e21c!=''){_0x54e21c+='&';}_0x54e21c+=_0x13e179[_0x392d39]+'='+encodeURIComponent(_0x19cd84[_0x13e179[_0x392d39]]);_0x586dcc+=_0x19cd84[_0x13e179[_0x392d39]];}_0x586dcc+=_0x1f1592[_0x5141('0x5b')];_0x586dcc=_0x2e7081[_0x5141('0x62')](_0x5141('0x63'))[_0x5141('0x19')](_0x586dcc)[_0x5141('0x64')]('hex');if(_0x54e21c!==''){_0x54e21c+='&';}_0x54e21c+='signature='+_0x586dcc;var _0x4f2206={'method':_0x5141('0x65'),'uri':_0x1f1592[_0x5141('0x53')]+'/external/get/send.php?'+_0x54e21c,'json':!![]};return rp(_0x4f2206)[_0x5141('0x1f')](function(_0x4c9e27){var _0x26284f=Object['keys'](_0x4c9e27);if(_0x4c9e27[_0x26284f[0x0]]['error']&&parseInt(_0x4c9e27[_0x26284f[0x0]][_0x5141('0x1b')])===0x0){var _0x4553e1={'messageId':_0x4c9e27[_0x26284f[0x0]][_0x5141('0x66')]};if(!_0x1f1592[_0x5141('0x39')]){_0x4553e1[_0x5141('0x3a')]=!![];}return _0x2bc5f5[_0x5141('0x19')](_0x4553e1);}else{return logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x59'),util[_0x5141('0x2c')](_0x4c9e27['error'],{'showHidden':![],'depth':null}));}})[_0x5141('0x2a')](function(_0x5b0405){return logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x59'),util[_0x5141('0x2c')](_0x5b0405,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x59'),_0x5141('0x67'));}break;case _0x5141('0x68'):if(_0x1f1592['apiKey']){var _0x1621e3={'method':'POST','uri':_0x5141('0x69'),'headers':{'Authorization':_0x1f1592[_0x5141('0x5b')]},'body':{'content':_0x407bf2[_0x5141('0xe')],'to':[_0x407bf2[_0x5141('0x25')]],'from':_0x1f1592[_0x5141('0x25')],'binary':![],'clientMessageId':_0x5141('0x6a'),'charset':_0x5141('0x6b')},'json':!![]};rp(_0x1621e3)[_0x5141('0x1f')](function(_0x28a7d0){if(!_0x28a7d0[_0x5141('0x1b')]){var _0x434b4a={'messageId':_0x28a7d0['messages'][0x0][_0x5141('0x6c')]};if(!_0x1f1592['deliveryReport']){_0x434b4a[_0x5141('0x3a')]=!![];}return _0x2bc5f5[_0x5141('0x19')](_0x434b4a);}else{return logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x68'),util[_0x5141('0x2c')](_0x28a7d0[_0x5141('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3b80a2){return logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x68'),util[_0x5141('0x2c')](_0x3b80a2,{'showHidden':![],'depth':null}));});}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),'afterCreate',_0x5141('0x68'),_0x5141('0x67'));}break;case _0x5141('0x6d'):if(_0x1f1592[_0x5141('0x43')]&&_0x1f1592[_0x5141('0x32')]){var _0x43f606=util['format'](_0x5141('0x46'),_0x1f1592[_0x5141('0x43')],_0x1f1592['password']);var _0x342424={'method':_0x5141('0x35'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1f1592['accountId']+_0x5141('0x6e'),'body':{'to':[_0x407bf2[_0x5141('0x25')]],'text':_0x407bf2[_0x5141('0xe')],'from':_0x1f1592[_0x5141('0x25')],'applicationId':_0x1f1592[_0x5141('0x6f')]},'headers':{'Authorization':util[_0x5141('0x45')](_0x5141('0x48'),new Buffer(_0x43f606)[_0x5141('0x49')](_0x5141('0x70')))},'json':!![]};rp(_0x342424)['then'](function(_0x311b36){if(_0x311b36['id']){var _0x596ea6={'messageId':_0x311b36['id']};return _0x2bc5f5['update'](_0x596ea6);}else{logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x6d'),util[_0x5141('0x2c')](_0x311b36,{'showHidden':![],'depth':null}));}})[_0x5141('0x2a')](function(_0x205c28){logger[_0x5141('0x1b')](_0x5141('0x2b'),'afterCreate','bandwidth',util['inspect'](_0x205c28,{'showHidden':![],'depth':null}));});}else{logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x6d'),_0x5141('0x3c'));}break;case _0x5141('0x71'):if(_0x1f1592[_0x5141('0x5b')]){var _0x293702={};var _0x4f2206={'method':_0x5141('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x5141('0x72')+_0x1f1592[_0x5141('0x5b')],'Content-Type':_0x5141('0x55')},'body':{'from':_0x1f1592[_0x5141('0x25')],'to':_0x407bf2[_0x5141('0x25')],'text':_0x407bf2['body']},'json':!![]};return rp(_0x4f2206)[_0x5141('0x1f')](function(_0x52f68a){if(_0x52f68a['code']==0xca){_0x293702[_0x5141('0x73')]=_0x52f68a;var _0x3fd96a={'method':'POST','uri':_0x5141('0x74'),'headers':{'Authorization':_0x5141('0x72')+_0x1f1592[_0x5141('0x5b')],'Content-Type':_0x5141('0x55')},'body':{'refid':_0x293702['message'][_0x5141('0x75')]},'json':!![]};return rp(_0x3fd96a)[_0x5141('0x1f')](function(_0xb290f7){_0x293702[_0x5141('0x76')]=_0xb290f7;var _0x5409f3={'messageId':_0x293702[_0x5141('0x73')]['refid'],'read':!![]};return _0x2bc5f5[_0x5141('0x19')](_0x5409f3);});}else{return logger[_0x5141('0x1b')](_0x5141('0x2b'),_0x5141('0x3b'),'intelepeer',util['inspect'](_0x52f68a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x29fbe0){return logger[_0x5141('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5141('0x3b'),_0x5141('0x71'),util[_0x5141('0x2c')](_0x29fbe0,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x5141('0x2b'),_0x5141('0x3b'),_0x5141('0x71'),_0x5141('0x77'));}break;}}})[_0x5141('0x78')](function(){_0x4fc7e8();});}else{_0x4fc7e8();}}},'charset':_0x5141('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 15e4c40..09172b2 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 _0x40bc=['redis','defaults','localhost','register','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0x40bc,0x12f));var _0xc40b=function(_0x469942,_0x1f502a){_0x469942=_0x469942-0x0;var _0x11a28a=_0x40bc[_0x469942];return _0x11a28a;};'use strict';var _=require(_0xc40b('0x0'));var util=require(_0xc40b('0x1'));var moment=require(_0xc40b('0x2'));var BPromise=require(_0xc40b('0x3'));var rs=require(_0xc40b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc40b('0x5'))['db'];var utils=require(_0xc40b('0x6'));var logger=require(_0xc40b('0x7'))(_0xc40b('0x8'));var config=require('../../config/environment');var jayson=require(_0xc40b('0x9'));var client=jayson[_0xc40b('0xa')][_0xc40b('0xb')]({'port':0x232a});config[_0xc40b('0xc')]=_[_0xc40b('0xd')](config['redis'],{'host':_0xc40b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsMessage.socket')[_0xc40b('0xf')](socket);function respondWithRpcPromise(_0x4e74f6,_0x4f9590,_0x21773d){return new BPromise(function(_0x9a7a36,_0x22a037){return client[_0xc40b('0x10')](_0x4e74f6,_0x21773d)[_0xc40b('0x11')](function(_0x3f816b){logger[_0xc40b('0x12')]('SmsMessage,\x20%s,\x20%s',_0x4f9590,'request\x20sent');logger[_0xc40b('0x13')](_0xc40b('0x14'),_0x4f9590,_0xc40b('0x15'),JSON[_0xc40b('0x16')](_0x3f816b));if(_0x3f816b[_0xc40b('0x17')]){if(_0x3f816b[_0xc40b('0x17')][_0xc40b('0x18')]===0x1f4){logger[_0xc40b('0x17')](_0xc40b('0x19'),_0x4f9590,_0x3f816b[_0xc40b('0x17')][_0xc40b('0x1a')]);return _0x22a037(_0x3f816b['error']['message']);}logger[_0xc40b('0x17')](_0xc40b('0x19'),_0x4f9590,_0x3f816b[_0xc40b('0x17')][_0xc40b('0x1a')]);return _0x9a7a36(_0x3f816b[_0xc40b('0x17')][_0xc40b('0x1a')]);}else{logger['info'](_0xc40b('0x19'),_0x4f9590,'request\x20sent');_0x9a7a36(_0x3f816b[_0xc40b('0x1b')][_0xc40b('0x1a')]);}})[_0xc40b('0x1c')](function(_0x42d145){logger[_0xc40b('0x17')](_0xc40b('0x19'),_0x4f9590,_0x42d145);_0x22a037(_0x42d145);});});}exports['CreateSmsMessage']=function(_0x55c495){var _0x472c41=this;return new Promise(function(_0x4f7416,_0x33bf7b){return db[_0xc40b('0x1d')][_0xc40b('0x1e')](_0x55c495[_0xc40b('0x1f')],{'raw':_0x55c495[_0xc40b('0x20')]?_0x55c495[_0xc40b('0x20')][_0xc40b('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x552665){logger[_0xc40b('0x12')](_0xc40b('0x22'),_0x55c495);logger[_0xc40b('0x13')]('CreateSmsMessage',_0x55c495,JSON[_0xc40b('0x16')](_0x552665));_0x4f7416(_0x552665);})[_0xc40b('0x1c')](function(_0x4663c1){logger['error']('CreateSmsMessage',_0x4663c1[_0xc40b('0x1a')],_0x55c495);_0x33bf7b(_0x472c41[_0xc40b('0x17')](0x1f4,_0x4663c1[_0xc40b('0x1a')]));});});}; \ No newline at end of file +var _0x0328=['redis','localhost','socket.io-emitter','./smsMessage.socket','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','raw','then','debug','CreateSmsMessage','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x4ca21e,_0x21282b){var _0x207403=function(_0x484cec){while(--_0x484cec){_0x4ca21e['push'](_0x4ca21e['shift']());}};_0x207403(++_0x21282b);}(_0x0328,0x117));var _0x8032=function(_0x1b55ea,_0x1f5bf4){_0x1b55ea=_0x1b55ea-0x0;var _0x188389=_0x0328[_0x1b55ea];return _0x188389;};'use strict';var _=require(_0x8032('0x0'));var util=require(_0x8032('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8032('0x2'));var fs=require('fs');var Redis=require(_0x8032('0x3'));var db=require(_0x8032('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8032('0x5'))(_0x8032('0x6'));var config=require(_0x8032('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8032('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8032('0x9')],{'host':_0x8032('0xa'),'port':0x18eb});var socket=require(_0x8032('0xb'))(new Redis(config[_0x8032('0x9')]));require(_0x8032('0xc'))['register'](socket);function respondWithRpcPromise(_0x4bafc3,_0xd23efd,_0x2b9936){return new BPromise(function(_0x827e0,_0x32e17d){return client[_0x8032('0xd')](_0x4bafc3,_0x2b9936)['then'](function(_0xfa6f2a){logger[_0x8032('0xe')]('SmsMessage,\x20%s,\x20%s',_0xd23efd,_0x8032('0xf'));logger['debug'](_0x8032('0x10'),_0xd23efd,_0x8032('0xf'),JSON[_0x8032('0x11')](_0xfa6f2a));if(_0xfa6f2a[_0x8032('0x12')]){if(_0xfa6f2a[_0x8032('0x12')][_0x8032('0x13')]===0x1f4){logger[_0x8032('0x12')](_0x8032('0x14'),_0xd23efd,_0xfa6f2a[_0x8032('0x12')][_0x8032('0x15')]);return _0x32e17d(_0xfa6f2a[_0x8032('0x12')]['message']);}logger[_0x8032('0x12')](_0x8032('0x14'),_0xd23efd,_0xfa6f2a['error'][_0x8032('0x15')]);return _0x827e0(_0xfa6f2a[_0x8032('0x12')]['message']);}else{logger[_0x8032('0xe')](_0x8032('0x14'),_0xd23efd,_0x8032('0xf'));_0x827e0(_0xfa6f2a[_0x8032('0x16')][_0x8032('0x15')]);}})[_0x8032('0x17')](function(_0x327d00){logger['error']('SmsMessage,\x20%s,\x20%s',_0xd23efd,_0x327d00);_0x32e17d(_0x327d00);});});}exports['CreateSmsMessage']=function(_0x551d40){var _0x42397a=this;return new Promise(function(_0x5d3d82,_0x48b840){return db[_0x8032('0x18')][_0x8032('0x19')](_0x551d40[_0x8032('0x1a')],{'raw':_0x551d40[_0x8032('0x1b')]?_0x551d40['options'][_0x8032('0x1c')]===undefined?!![]:![]:!![]})[_0x8032('0x1d')](function(_0x518e48){logger[_0x8032('0xe')]('CreateSmsMessage',_0x551d40);logger[_0x8032('0x1e')](_0x8032('0x1f'),_0x551d40,JSON['stringify'](_0x518e48));_0x5d3d82(_0x518e48);})['catch'](function(_0x59d828){logger['error'](_0x8032('0x1f'),_0x59d828['message'],_0x551d40);_0x48b840(_0x42397a['error'](0x1f4,_0x59d828[_0x8032('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3cddb01..e327ce3 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 _0x3761=['./smsMessage.events','save','remove','emit','removeListener','length','smsMessage:'];(function(_0x368c1d,_0x4683cd){var _0xface06=function(_0x229fe9){while(--_0x229fe9){_0x368c1d['push'](_0x368c1d['shift']());}};_0xface06(++_0x4683cd);}(_0x3761,0x18f));var _0x1376=function(_0x483753,_0x243cc6){_0x483753=_0x483753-0x0;var _0x380839=_0x3761[_0x483753];return _0x380839;};'use strict';var SmsMessageEvents=require(_0x1376('0x0'));var events=[_0x1376('0x1'),_0x1376('0x2'),'update'];function createListener(_0x1f7171,_0x2d0c82){return function(_0x4a7811){_0x2d0c82[_0x1376('0x3')](_0x1f7171,_0x4a7811);};}function removeListener(_0x2a4a83,_0x368e58){return function(){SmsMessageEvents[_0x1376('0x4')](_0x2a4a83,_0x368e58);};}exports['register']=function(_0x2b3129){for(var _0xbe4c85=0x0,_0x54bd0f=events[_0x1376('0x5')];_0xbe4c85<_0x54bd0f;_0xbe4c85++){var _0x5f4e16=events[_0xbe4c85];var _0x2273b8=createListener(_0x1376('0x6')+_0x5f4e16,_0x2b3129);SmsMessageEvents['on'](_0x5f4e16,_0x2273b8);}}; \ No newline at end of file +var _0xbcc2=['register','length','smsMessage:','save','update','emit','removeListener'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0xbcc2,0x73));var _0x2bcc=function(_0x4d05a1,_0x3d47e4){_0x4d05a1=_0x4d05a1-0x0;var _0x27d24b=_0xbcc2[_0x4d05a1];return _0x27d24b;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x2bcc('0x0'),'remove',_0x2bcc('0x1')];function createListener(_0x125f5f,_0x21ae6e){return function(_0x3a133f){_0x21ae6e[_0x2bcc('0x2')](_0x125f5f,_0x3a133f);};}function removeListener(_0x20dafc,_0x49eb8d){return function(){SmsMessageEvents[_0x2bcc('0x3')](_0x20dafc,_0x49eb8d);};}exports[_0x2bcc('0x4')]=function(_0x3ce405){for(var _0x53d957=0x0,_0x32af11=events[_0x2bcc('0x5')];_0x53d957<_0x32af11;_0x53d957++){var _0x163a8a=events[_0x53d957];var _0x5b7df2=createListener(_0x2bcc('0x6')+_0x163a8a,_0x3ce405);SmsMessageEvents['on'](_0x163a8a,_0x5b7df2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 521e4a4..a6fcee3 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 _0x98b7=['index','/describe','describe','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','delete','/:id','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x13f3e2,_0x17b36e){var _0x17aafd=function(_0x2d49aa){while(--_0x2d49aa){_0x13f3e2['push'](_0x13f3e2['shift']());}};_0x17aafd(++_0x17b36e);}(_0x98b7,0x1a6));var _0x798b=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x98b7[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var path=require(_0x798b('0x2'));var timeout=require(_0x798b('0x3'));var express=require('express');var router=express[_0x798b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x798b('0x5'));var interaction=require(_0x798b('0x6'));var config=require(_0x798b('0x7'));var controller=require('./smsQueue.controller');router[_0x798b('0x8')]('/',auth[_0x798b('0x9')](),controller[_0x798b('0xa')]);router[_0x798b('0x8')](_0x798b('0xb'),auth[_0x798b('0x9')](),controller[_0x798b('0xc')]);router[_0x798b('0x8')]('/:id',auth[_0x798b('0x9')](),controller['show']);router['get']('/:id/members',auth[_0x798b('0x9')](),controller[_0x798b('0xd')]);router[_0x798b('0x8')](_0x798b('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x798b('0x8')](_0x798b('0xf'),auth['isAuthenticated'](),controller[_0x798b('0x10')]);router['post']('/',auth[_0x798b('0x9')](),controller[_0x798b('0x11')]);router[_0x798b('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x798b('0x13')]);router[_0x798b('0x12')](_0x798b('0xf'),auth[_0x798b('0x9')](),controller[_0x798b('0x14')]);router[_0x798b('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x798b('0x16')](_0x798b('0x17'),auth[_0x798b('0x9')](),controller[_0x798b('0x18')]);router[_0x798b('0x16')]('/:id/teams',auth[_0x798b('0x9')](),controller[_0x798b('0x19')]);router[_0x798b('0x16')](_0x798b('0xf'),auth['isAuthenticated'](),controller[_0x798b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x08a2=['getAgents','post','/:id/users','addAgents','update','delete','destroy','/:id/teams','removeTeams','removeAgents','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','index','get','isAuthenticated','describe','/:id','show','getMembers'];(function(_0x9ffdd8,_0x414bbd){var _0x222710=function(_0x500ff3){while(--_0x500ff3){_0x9ffdd8['push'](_0x9ffdd8['shift']());}};_0x222710(++_0x414bbd);}(_0x08a2,0xd2));var _0x208a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x08a2[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x208a('0x0'));var timeout=require(_0x208a('0x1'));var express=require(_0x208a('0x2'));var router=express[_0x208a('0x3')]();var fs_extra=require(_0x208a('0x4'));var auth=require(_0x208a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x208a('0x6'));var controller=require(_0x208a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x208a('0x8')]);router[_0x208a('0x9')]('/describe',auth[_0x208a('0xa')](),controller[_0x208a('0xb')]);router[_0x208a('0x9')](_0x208a('0xc'),auth[_0x208a('0xa')](),controller[_0x208a('0xd')]);router['get']('/:id/members',auth[_0x208a('0xa')](),controller[_0x208a('0xe')]);router[_0x208a('0x9')]('/:id/teams',auth[_0x208a('0xa')](),controller['getTeams']);router[_0x208a('0x9')]('/:id/users',auth[_0x208a('0xa')](),controller[_0x208a('0xf')]);router[_0x208a('0x10')]('/',auth[_0x208a('0xa')](),controller['create']);router[_0x208a('0x10')]('/:id/teams',auth[_0x208a('0xa')](),controller['addTeams']);router[_0x208a('0x10')](_0x208a('0x11'),auth[_0x208a('0xa')](),controller[_0x208a('0x12')]);router['put'](_0x208a('0xc'),auth[_0x208a('0xa')](),controller[_0x208a('0x13')]);router[_0x208a('0x14')](_0x208a('0xc'),auth[_0x208a('0xa')](),controller[_0x208a('0x15')]);router[_0x208a('0x14')](_0x208a('0x16'),auth[_0x208a('0xa')](),controller[_0x208a('0x17')]);router[_0x208a('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x208a('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d1f4ec8..737b43c 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 _0xcb6f=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x6e445b,_0xb9681b){var _0x1714b8=function(_0x3a1adb){while(--_0x3a1adb){_0x6e445b['push'](_0x6e445b['shift']());}};_0x1714b8(++_0xb9681b);}(_0xcb6f,0xf7));var _0xfcb6=function(_0x3afa17,_0xb3c013){_0x3afa17=_0x3afa17-0x0;var _0x23cd3a=_0xcb6f[_0x3afa17];return _0x23cd3a;};'use strict';var Sequelize=require(_0xfcb6('0x0'));module[_0xfcb6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcb6('0x2')]},'timeout':{'type':Sequelize[_0xfcb6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcb6('0x4')]('rrmemory','beepall',_0xfcb6('0x5'))}}; \ No newline at end of file +var _0x0ecb=['rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x1e48d4,_0x4a8aa5){var _0x52cfbc=function(_0x347c48){while(--_0x347c48){_0x1e48d4['push'](_0x1e48d4['shift']());}};_0x52cfbc(++_0x4a8aa5);}(_0x0ecb,0x1be));var _0xb0ec=function(_0x5a8e42,_0x1bdf90){_0x5a8e42=_0x5a8e42-0x0;var _0x3939ef=_0x0ecb[_0x5a8e42];return _0x3939ef;};'use strict';var Sequelize=require(_0xb0ec('0x0'));module[_0xb0ec('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb0ec('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb0ec('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb0ec('0x4'),'beepall',_0xb0ec('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2a15a2c..0733dd0 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 _0x2f25=['show','params','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','findOne','UserSmsQueue','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','smsPause','updatedAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','transaction','each','emit','removeTeams','select','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userSmsQueue:remove','omit','userSmsQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch'];(function(_0x24c5d7,_0x46f0a0){var _0x5bd02c=function(_0x5a2695){while(--_0x5a2695){_0x24c5d7['push'](_0x24c5d7['shift']());}};_0x5bd02c(++_0x46f0a0);}(_0x2f25,0x15b));var _0x52f2=function(_0x5b7586,_0x537a0e){_0x5b7586=_0x5b7586-0x0;var _0xc71adf=_0x2f25[_0x5b7586];return _0xc71adf;};'use strict';var emlformat=require(_0x52f2('0x0'));var rimraf=require(_0x52f2('0x1'));var zipdir=require(_0x52f2('0x2'));var jsonpatch=require(_0x52f2('0x3'));var rp=require(_0x52f2('0x4'));var moment=require(_0x52f2('0x5'));var BPromise=require(_0x52f2('0x6'));var Mustache=require(_0x52f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0x52f2('0x8'));var csv=require(_0x52f2('0x9'));var ejs=require(_0x52f2('0xa'));var fs=require('fs');var fs_extra=require(_0x52f2('0xb'));var _=require('lodash');var squel=require(_0x52f2('0xc'));var crypto=require(_0x52f2('0xd'));var jsforce=require(_0x52f2('0xe'));var deskjs=require(_0x52f2('0xf'));var toCsv=require(_0x52f2('0x9'));var querystring=require(_0x52f2('0x10'));var Papa=require('papaparse');var Redis=require(_0x52f2('0x11'));var authService=require(_0x52f2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52f2('0x13'));var logger=require(_0x52f2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x52f2('0x15'));var licenseUtil=require(_0x52f2('0x16'));var db=require(_0x52f2('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x52f2('0x18'),'port':0x18eb});var socket=require(_0x52f2('0x19'))(new Redis(config[_0x52f2('0x1a')]));require(_0x52f2('0x1b'))[_0x52f2('0x1c')](socket);function respondWithStatusCode(_0x4b57a3,_0x530ac3){_0x530ac3=_0x530ac3||0xcc;return function(_0x52c4a8){if(_0x52c4a8){return _0x4b57a3[_0x52f2('0x1d')](_0x530ac3);}return _0x4b57a3[_0x52f2('0x1e')](_0x530ac3)[_0x52f2('0x1f')]();};}function respondWithResult(_0x1ba270,_0x2f42d2){_0x2f42d2=_0x2f42d2||0xc8;return function(_0x5c4c7d){if(_0x5c4c7d){return _0x1ba270['status'](_0x2f42d2)['json'](_0x5c4c7d);}};}function respondWithFilteredResult(_0x1a9547,_0x1c8a57){return function(_0xb10747){if(_0xb10747){var _0x15db75=typeof _0x1c8a57[_0x52f2('0x20')]===_0x52f2('0x21')&&typeof _0x1c8a57[_0x52f2('0x22')]===_0x52f2('0x21');var _0x5a0bdf=_0xb10747[_0x52f2('0x23')];var _0x13b4c0=_0x15db75?0x0:_0x1c8a57[_0x52f2('0x20')];var _0x1efc64=_0x15db75?_0xb10747[_0x52f2('0x23')]:_0x1c8a57[_0x52f2('0x20')]+_0x1c8a57[_0x52f2('0x22')];var _0x3b77c1;if(_0x1efc64>=_0x5a0bdf){_0x1efc64=_0x5a0bdf;_0x3b77c1=0xc8;}else{_0x3b77c1=0xce;}_0x1a9547['status'](_0x3b77c1);return _0x1a9547[_0x52f2('0x24')](_0x52f2('0x25'),_0x13b4c0+'-'+_0x1efc64+'/'+_0x5a0bdf)[_0x52f2('0x26')](_0xb10747);}return null;};}function patchUpdates(_0x7b008f){return function(_0x49aa5a){try{jsonpatch[_0x52f2('0x27')](_0x49aa5a,_0x7b008f,!![]);}catch(_0x3bad5d){return BPromise[_0x52f2('0x28')](_0x3bad5d);}return _0x49aa5a[_0x52f2('0x29')]();};}function saveUpdates(_0x5a4d74,_0x736ab2){return function(_0x51872c){if(_0x51872c){return _0x51872c[_0x52f2('0x2a')](_0x5a4d74)[_0x52f2('0x2b')](function(_0x192261){return _0x192261;});}return null;};}function removeEntity(_0x387fcf,_0xeffc1a){return function(_0x148aab){if(_0x148aab){return _0x148aab[_0x52f2('0x2c')]()[_0x52f2('0x2b')](function(){var _0x3706c0=_0x148aab[_0x52f2('0x2d')]({'plain':!![]});var _0x50b8c6=_0x52f2('0x2e');return db[_0x52f2('0x2f')]['destroy']({'where':{'type':_0x50b8c6,'resourceId':_0x3706c0['id']}})['then'](function(){return _0x148aab;});})['then'](function(){_0x387fcf[_0x52f2('0x1e')](0xcc)[_0x52f2('0x1f')]();});}};}function handleEntityNotFound(_0x35aa67,_0x5cdc87){return function(_0x43444d){if(!_0x43444d){_0x35aa67[_0x52f2('0x1d')](0x194);}return _0x43444d;};}function handleError(_0x47b491,_0x1db410){_0x1db410=_0x1db410||0x1f4;return function(_0x5c88b4){logger[_0x52f2('0x30')](_0x5c88b4[_0x52f2('0x31')]);if(_0x5c88b4[_0x52f2('0x32')]){delete _0x5c88b4[_0x52f2('0x32')];}_0x47b491[_0x52f2('0x1e')](_0x1db410)[_0x52f2('0x33')](_0x5c88b4);};}exports[_0x52f2('0x34')]=function(_0x4edc90,_0x2d5db1){var _0x5a95f4={},_0x4f1062={},_0x31f262={'count':0x0,'rows':[]};var _0x112881=_[_0x52f2('0x35')](db[_0x52f2('0x36')][_0x52f2('0x37')],function(_0x70130b){return{'name':_0x70130b[_0x52f2('0x38')],'type':_0x70130b[_0x52f2('0x39')]['key']};});_0x4f1062[_0x52f2('0x3a')]=_['map'](_0x112881,_0x52f2('0x32'));_0x4f1062[_0x52f2('0x3b')]=_[_0x52f2('0x3c')](_0x4edc90['query']);_0x4f1062[_0x52f2('0x3d')]=_[_0x52f2('0x3e')](_0x4f1062[_0x52f2('0x3a')],_0x4f1062[_0x52f2('0x3b')]);_0x5a95f4[_0x52f2('0x3f')]=_[_0x52f2('0x3e')](_0x4f1062[_0x52f2('0x3a')],qs[_0x52f2('0x40')](_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x40')]));_0x5a95f4[_0x52f2('0x3f')]=_0x5a95f4[_0x52f2('0x3f')][_0x52f2('0x41')]?_0x5a95f4[_0x52f2('0x3f')]:_0x4f1062[_0x52f2('0x3a')];if(!_0x4edc90[_0x52f2('0x3b')]['hasOwnProperty'](_0x52f2('0x42'))){_0x5a95f4[_0x52f2('0x22')]=qs[_0x52f2('0x22')](_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x22')]);_0x5a95f4[_0x52f2('0x20')]=qs['offset'](_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x20')]);}_0x5a95f4[_0x52f2('0x43')]=qs[_0x52f2('0x44')](_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x44')]);_0x5a95f4[_0x52f2('0x45')]=qs[_0x52f2('0x3d')](_[_0x52f2('0x46')](_0x4edc90[_0x52f2('0x3b')],_0x4f1062['filters']),_0x112881);if(_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x47')]){_0x5a95f4[_0x52f2('0x45')]=_[_0x52f2('0x48')](_0x5a95f4[_0x52f2('0x45')],{'$or':_['map'](_0x112881,function(_0x55ddb8){if(_0x55ddb8[_0x52f2('0x39')]!==_0x52f2('0x49')){var _0x47500a={};_0x47500a[_0x55ddb8['name']]={'$like':'%'+_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x47')]+'%'};return _0x47500a;}})});}_0x5a95f4=_[_0x52f2('0x48')]({},_0x5a95f4,_0x4edc90[_0x52f2('0x4a')]);var _0x198a00={'where':_0x5a95f4[_0x52f2('0x45')]};return db[_0x52f2('0x36')][_0x52f2('0x23')](_0x198a00)[_0x52f2('0x2b')](function(_0x4413b6){_0x31f262[_0x52f2('0x23')]=_0x4413b6;if(_0x4edc90[_0x52f2('0x3b')][_0x52f2('0x4b')]){_0x5a95f4[_0x52f2('0x4c')]=[{'all':!![]}];}return db[_0x52f2('0x36')]['findAll'](_0x5a95f4);})[_0x52f2('0x2b')](function(_0x335a9e){_0x31f262[_0x52f2('0x4d')]=_0x335a9e;return _0x31f262;})[_0x52f2('0x2b')](respondWithFilteredResult(_0x2d5db1,_0x5a95f4))[_0x52f2('0x4e')](handleError(_0x2d5db1,null));};exports[_0x52f2('0x4f')]=function(_0x436aa0,_0x29a8a7){var _0x24dc60={'raw':!![],'where':{'id':_0x436aa0[_0x52f2('0x50')]['id']}},_0x1c259f={};_0x1c259f['model']=_[_0x52f2('0x3c')](db[_0x52f2('0x36')][_0x52f2('0x37')]);_0x1c259f['query']=_[_0x52f2('0x3c')](_0x436aa0['query']);_0x1c259f[_0x52f2('0x3d')]=_[_0x52f2('0x3e')](_0x1c259f[_0x52f2('0x3a')],_0x1c259f[_0x52f2('0x3b')]);_0x24dc60[_0x52f2('0x3f')]=_[_0x52f2('0x3e')](_0x1c259f[_0x52f2('0x3a')],qs[_0x52f2('0x40')](_0x436aa0['query'][_0x52f2('0x40')]));_0x24dc60['attributes']=_0x24dc60[_0x52f2('0x3f')][_0x52f2('0x41')]?_0x24dc60[_0x52f2('0x3f')]:_0x1c259f[_0x52f2('0x3a')];if(_0x436aa0[_0x52f2('0x3b')][_0x52f2('0x4b')]){_0x24dc60['include']=[{'all':!![]}];}_0x24dc60=_[_0x52f2('0x48')]({},_0x24dc60,_0x436aa0[_0x52f2('0x4a')]);return db[_0x52f2('0x36')][_0x52f2('0x51')](_0x24dc60)['then'](handleEntityNotFound(_0x29a8a7,null))[_0x52f2('0x2b')](respondWithResult(_0x29a8a7,null))[_0x52f2('0x4e')](handleError(_0x29a8a7,null));};exports[_0x52f2('0x52')]=function(_0x1a7282,_0x10802d){return db[_0x52f2('0x36')][_0x52f2('0x52')](_0x1a7282[_0x52f2('0x53')],{})['then'](function(_0xbdaa5){var _0x39aab3=_0x1a7282[_0x52f2('0x54')][_0x52f2('0x2d')]({'plain':!![]});if(!_0x39aab3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39aab3[_0x52f2('0x55')]===_0x52f2('0x54')){var _0x29b21c=_0xbdaa5[_0x52f2('0x2d')]({'plain':!![]});var _0x1c6085=_0x52f2('0x2e');return db[_0x52f2('0x56')][_0x52f2('0x51')]({'where':{'name':_0x1c6085,'userProfileId':_0x39aab3['userProfileId']},'raw':!![]})['then'](function(_0x25b9fb){if(_0x25b9fb&&_0x25b9fb[_0x52f2('0x57')]===0x0){return db[_0x52f2('0x2f')][_0x52f2('0x52')]({'name':_0x29b21c['name'],'resourceId':_0x29b21c['id'],'type':_0x25b9fb[_0x52f2('0x32')],'sectionId':_0x25b9fb['id']},{})['then'](function(){return _0xbdaa5;});}else{return _0xbdaa5;}})['catch'](function(_0x132856){logger[_0x52f2('0x30')](_0x52f2('0x58'),_0x132856);throw _0x132856;});}return _0xbdaa5;})[_0x52f2('0x2b')](respondWithResult(_0x10802d,0xc9))[_0x52f2('0x4e')](handleError(_0x10802d,null));};exports['update']=function(_0x2cb44e,_0x491240){if(_0x2cb44e[_0x52f2('0x53')]['id']){delete _0x2cb44e[_0x52f2('0x53')]['id'];}return db[_0x52f2('0x36')][_0x52f2('0x51')]({'where':{'id':_0x2cb44e['params']['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x491240,null))['then'](saveUpdates(_0x2cb44e[_0x52f2('0x53')],null))[_0x52f2('0x2b')](respondWithResult(_0x491240,null))[_0x52f2('0x4e')](handleError(_0x491240,null));};exports[_0x52f2('0x2c')]=function(_0xecad22,_0x35d116){return db['SmsQueue'][_0x52f2('0x51')]({'where':{'id':_0xecad22['params']['id']}})['then'](handleEntityNotFound(_0x35d116,null))[_0x52f2('0x2b')](removeEntity(_0x35d116,null))[_0x52f2('0x4e')](handleError(_0x35d116,null));};exports['describe']=function(_0x355985,_0x1fbccd){return db[_0x52f2('0x36')]['describe']()[_0x52f2('0x2b')](respondWithResult(_0x1fbccd,null))[_0x52f2('0x4e')](handleError(_0x1fbccd,null));};exports[_0x52f2('0x59')]=function(_0xaa0049,_0x202eb7,_0x1afac2){var _0xdae96d={'raw':!![],'where':{}},_0x1ab136={},_0x3415c1;return db[_0x52f2('0x36')][_0x52f2('0x5a')]({'where':{'id':_0xaa0049[_0x52f2('0x50')]['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x202eb7,null))['then'](function(_0x39c2fe){if(_0x39c2fe){_0x3415c1=_0x39c2fe[_0x52f2('0x2d')]({'plain':!![]});_0x1ab136['model']=_[_0x52f2('0x3c')](db[_0x52f2('0x5b')][_0x52f2('0x37')]);_0x1ab136[_0x52f2('0x3b')]=_[_0x52f2('0x3c')](_0xaa0049[_0x52f2('0x3b')]);_0x1ab136[_0x52f2('0x3d')]=_[_0x52f2('0x3e')](_0x1ab136[_0x52f2('0x3a')],_0x1ab136['query']);_0xdae96d['attributes']=_[_0x52f2('0x3e')](_0x1ab136[_0x52f2('0x3a')],qs['fields'](_0xaa0049['query'][_0x52f2('0x40')]));_0xdae96d[_0x52f2('0x3f')]=_0xdae96d['attributes']['length']?_0xdae96d[_0x52f2('0x3f')]:_0x1ab136[_0x52f2('0x3a')];if(!_0xaa0049[_0x52f2('0x3b')][_0x52f2('0x5c')](_0x52f2('0x42'))){_0xdae96d[_0x52f2('0x22')]=qs['limit'](_0xaa0049[_0x52f2('0x3b')][_0x52f2('0x22')]);_0xdae96d['offset']=qs['offset'](_0xaa0049['query'][_0x52f2('0x20')]);}_0xdae96d['order']=qs[_0x52f2('0x44')](_0xaa0049['query'][_0x52f2('0x44')]);_0xdae96d[_0x52f2('0x45')]=qs[_0x52f2('0x3d')](_[_0x52f2('0x46')](_0xaa0049[_0x52f2('0x3b')],_0x1ab136[_0x52f2('0x3d')]));_0xdae96d[_0x52f2('0x45')][_0x52f2('0x5d')]=_0x39c2fe['id'];if(_0xaa0049[_0x52f2('0x3b')][_0x52f2('0x47')]){_0xdae96d['where']=_[_0x52f2('0x48')](_0xdae96d[_0x52f2('0x45')],{'$or':_[_0x52f2('0x35')](_0xdae96d[_0x52f2('0x3f')],function(_0x40614d){var _0x4217ad={};_0x4217ad[_0x40614d]={'$like':'%'+_0xaa0049[_0x52f2('0x3b')]['filter']+'%'};return _0x4217ad;})});}_0xdae96d=_[_0x52f2('0x48')]({},_0xdae96d,_0xaa0049[_0x52f2('0x4a')]);return db[_0x52f2('0x5b')][_0x52f2('0x5e')](_0xdae96d);}})[_0x52f2('0x2b')](function(_0x4d5ad2){if(_0x4d5ad2){return db[_0x52f2('0x5f')][_0x52f2('0x60')]({'where':{'id':_[_0x52f2('0x35')](_0x4d5ad2,_0x52f2('0x61')),'role':_0x52f2('0x62')},'attributes':['id',_0x52f2('0x32'),'smsPause','updatedAt',_0x52f2('0x63')]});}})[_0x52f2('0x2b')](function(_0x4fea21){if(_0x4fea21){return{'count':_0x4fea21[_0x52f2('0x23')],'rows':_[_0x52f2('0x35')](_0x4fea21['rows'],function(_0x530122){return{'membername':_0x530122[_0x52f2('0x32')],'UserId':_0x530122['id'],'queue_name':_0x3415c1[_0x52f2('0x32')],'SmsQueueId':_0x3415c1['id'],'interface':util[_0x52f2('0x64')](_0x52f2('0x65'),_0x52f2('0x66'),_0x530122[_0x52f2('0x32')]),'penalty':0x0,'paused':_0x530122[_0x52f2('0x67')],'createdAt':_0x530122[_0x52f2('0x63')],'updatedAt':_0x530122[_0x52f2('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x52f2('0x2b')](respondWithFilteredResult(_0x202eb7,_0xdae96d))[_0x52f2('0x4e')](handleError(_0x202eb7,null));};exports[_0x52f2('0x69')]=function(_0x213cf3,_0x208d28,_0x570c02){var _0x1a24f7={};var _0x483687={};var _0x1b8af7;var _0x5c43b8;return db[_0x52f2('0x36')][_0x52f2('0x5a')]({'where':{'id':_0x213cf3['params']['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x208d28,null))[_0x52f2('0x2b')](function(_0x237499){if(_0x237499){_0x1b8af7=_0x237499;_0x483687['model']=_['keys'](db['Team'][_0x52f2('0x37')]);_0x483687['query']=_[_0x52f2('0x3c')](_0x213cf3['query']);_0x483687['filters']=_[_0x52f2('0x3e')](_0x483687[_0x52f2('0x3a')],_0x483687[_0x52f2('0x3b')]);_0x1a24f7[_0x52f2('0x3f')]=_[_0x52f2('0x3e')](_0x483687[_0x52f2('0x3a')],qs[_0x52f2('0x40')](_0x213cf3['query'][_0x52f2('0x40')]));_0x1a24f7[_0x52f2('0x3f')]=_0x1a24f7[_0x52f2('0x3f')][_0x52f2('0x41')]?_0x1a24f7[_0x52f2('0x3f')]:_0x483687['model'];_0x1a24f7[_0x52f2('0x43')]=qs['sort'](_0x213cf3[_0x52f2('0x3b')][_0x52f2('0x44')]);_0x1a24f7[_0x52f2('0x45')]=qs[_0x52f2('0x3d')](_[_0x52f2('0x46')](_0x213cf3[_0x52f2('0x3b')],_0x483687[_0x52f2('0x3d')]));if(_0x213cf3['query'][_0x52f2('0x47')]){_0x1a24f7[_0x52f2('0x45')]=_['merge'](_0x1a24f7[_0x52f2('0x45')],{'$or':_[_0x52f2('0x35')](_0x1a24f7[_0x52f2('0x3f')],function(_0x17a9ea){var _0x3c0c7e={};_0x3c0c7e[_0x17a9ea]={'$like':'%'+_0x213cf3['query']['filter']+'%'};return _0x3c0c7e;})});}_0x1a24f7=_[_0x52f2('0x48')]({},_0x1a24f7,_0x213cf3[_0x52f2('0x4a')]);return _0x1b8af7[_0x52f2('0x69')](_0x1a24f7);}})[_0x52f2('0x2b')](function(_0x4244e2){if(_0x4244e2){_0x5c43b8=_0x4244e2[_0x52f2('0x41')];if(!_0x213cf3[_0x52f2('0x3b')]['hasOwnProperty'](_0x52f2('0x42'))){_0x1a24f7['limit']=qs[_0x52f2('0x22')](_0x213cf3[_0x52f2('0x3b')][_0x52f2('0x22')]);_0x1a24f7['offset']=qs[_0x52f2('0x20')](_0x213cf3[_0x52f2('0x3b')][_0x52f2('0x20')]);}return _0x1b8af7[_0x52f2('0x69')](_0x1a24f7);}})['then'](function(_0x529ced){if(_0x529ced){return _0x529ced?{'count':_0x5c43b8,'rows':_0x529ced}:null;}})[_0x52f2('0x2b')](respondWithResult(_0x208d28,null))[_0x52f2('0x4e')](handleError(_0x208d28,null));};exports[_0x52f2('0x6a')]=function(_0x31e5a9,_0x1eaae7,_0x3409c2){var _0x41dff0=_0x31e5a9[_0x52f2('0x53')][_0x52f2('0x6b')];return db[_0x52f2('0x6c')]['findAll']({'where':{'id':_0x41dff0},'attributes':['id'],'include':[{'model':db[_0x52f2('0x5f')],'as':'Agents','attributes':['id',_0x52f2('0x32'),_0x52f2('0x6d'),_0x52f2('0x6e'),_0x52f2('0x6f')],'raw':!![]}]})[_0x52f2('0x2b')](function(_0x1edfd3){if(_0x1edfd3){var _0x481838=_[_0x52f2('0x70')](_0x1edfd3,function(_0x50f871){var _0x49856b=_0x50f871[_0x52f2('0x2d')]({'plain':!![]});return _0x49856b[_0x52f2('0x71')];});return db['SmsQueue'][_0x52f2('0x51')]({'where':{'id':_0x31e5a9['params']['id']}})[_0x52f2('0x2b')](function(_0x523a57){return db['sequelize'][_0x52f2('0x72')](function(_0x565335){return _0x523a57[_0x52f2('0x6a')](_0x41dff0,{'transaction':_0x565335})['then'](function(){return BPromise[_0x52f2('0x73')](_0x481838,function(_0x5e746a){return db[_0x52f2('0x5b')]['findOrCreate']({'where':{'UserId':_0x5e746a['id'],'SmsQueueId':_0x31e5a9[_0x52f2('0x50')]['id']},'transaction':_0x565335});});})[_0x52f2('0x2b')](function(){_0x481838['forEach'](function(_0x30fbff){socket[_0x52f2('0x74')]('userSmsQueue:save',{'UserId':_0x30fbff['id'],'SmsQueueId':_0x523a57['id']});});});});});}})[_0x52f2('0x2b')](respondWithStatusCode(_0x1eaae7,null))['catch'](handleError(_0x1eaae7,null));};exports[_0x52f2('0x75')]=function(_0x5e1aec,_0x537f4e,_0x467508){return db['Team'][_0x52f2('0x5e')]({'where':{'id':_0x5e1aec[_0x52f2('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x52f2('0x71'),'attributes':['id'],'raw':!![]}]})[_0x52f2('0x2b')](handleEntityNotFound(_0x537f4e,null))['then'](function(_0xef4dc6){var _0x4158cf=_['map'](_0xef4dc6,'id');var _0x20c067=[];var _0x4735c7=[];var _0x298def=squel[_0x52f2('0x76')]();_0x298def['field']('tq.TeamId')[_0x52f2('0x77')]('team_has_sms_queues','tq')[_0x52f2('0x78')]('user_has_teams','ut',_0x52f2('0x79'))['where']('SmsQueueId\x20=\x20?',_0x5e1aec[_0x52f2('0x50')]['id']);for(var _0x516df3=0x0;_0x516df3<_0xef4dc6['length'];_0x516df3+=0x1){let _0x55b131=_0xef4dc6[_0x516df3];for(var _0x47e668=0x0;_0x47e668<_0x55b131[_0x52f2('0x71')][_0x52f2('0x41')];_0x47e668+=0x1){let _0x3b8af5=_0x55b131[_0x52f2('0x71')][_0x47e668];var _0x2e742c=_0x298def[_0x52f2('0x7a')]();_0x2e742c[_0x52f2('0x45')](_0x52f2('0x7b'),_0x3b8af5['id']);_0x4735c7[_0x52f2('0x7c')](db[_0x52f2('0x7d')][_0x52f2('0x3b')](_0x2e742c['toString'](),{'type':db[_0x52f2('0x7d')][_0x52f2('0x7e')][_0x52f2('0x7f')]})[_0x52f2('0x2b')](function(_0xe9216c){if(_0xe9216c[_0x52f2('0x41')]===0x1){return _0x3b8af5['id'];}else{var _0x517ec1=_[_0x52f2('0x80')](_[_0x52f2('0x35')](_0xe9216c,_0x52f2('0x81')),function(_0x882f6d){return _[_0x52f2('0x82')](_0x4158cf,_0x882f6d);});if(_0x517ec1){return _0x3b8af5['id'];}}}));}}return BPromise[_0x52f2('0x83')](_0x4735c7)[_0x52f2('0x2b')](function(_0x2c425e){_0x20c067=_(_0x20c067)[_0x52f2('0x84')](_0x2c425e)[_0x52f2('0x85')]()[_0x52f2('0x86')]();return db[_0x52f2('0x36')][_0x52f2('0x51')]({'where':{'id':_0x5e1aec[_0x52f2('0x50')]['id']}})[_0x52f2('0x2b')](function(_0x4c61ff){return db['sequelize'][_0x52f2('0x72')](function(_0x11e6e3){return _0x4c61ff['removeTeams'](_0x5e1aec[_0x52f2('0x3b')][_0x52f2('0x6b')],{'transaction':_0x11e6e3})['then'](function(){if(!_[_0x52f2('0x87')](_0x20c067)){return _0x4c61ff[_0x52f2('0x88')](_0x20c067,{'transaction':_0x11e6e3});}})['then'](function(){_0x20c067[_0x52f2('0x89')](function(_0x382a35){socket['emit'](_0x52f2('0x8a'),{'UserId':_0x382a35,'SmsQueueId':_0x4c61ff['id']});});});});});});})[_0x52f2('0x2b')](respondWithStatusCode(_0x537f4e,null))[_0x52f2('0x4e')](handleError(_0x537f4e,null));};exports['addAgents']=function(_0x25f422,_0x461d34,_0x190471){return db[_0x52f2('0x36')][_0x52f2('0x51')]({'where':{'id':_0x25f422[_0x52f2('0x50')]['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x461d34,null))[_0x52f2('0x2b')](function(_0x1f9f50){if(_0x1f9f50){return _0x1f9f50['addAgents'](_0x25f422[_0x52f2('0x53')][_0x52f2('0x6b')],_[_0x52f2('0x8b')](_0x25f422['body'],[_0x52f2('0x6b'),'id'])||{})['spread'](function(_0x339823){for(var _0x34d324=0x0;_0x34d324<_0x25f422[_0x52f2('0x53')][_0x52f2('0x6b')][_0x52f2('0x41')];_0x34d324+=0x1){socket[_0x52f2('0x74')](_0x52f2('0x8c'),{'UserId':Number(_0x25f422[_0x52f2('0x53')][_0x52f2('0x6b')][_0x34d324]),'SmsQueueId':Number(_0x25f422[_0x52f2('0x50')]['id'])});}return _0x339823;});}})[_0x52f2('0x2b')](respondWithResult(_0x461d34,null))['catch'](handleError(_0x461d34,null));};exports['removeAgents']=function(_0x2beaeb,_0x1c09b2,_0x33efd7){return db[_0x52f2('0x36')][_0x52f2('0x51')]({'where':{'id':_0x2beaeb[_0x52f2('0x50')]['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x1c09b2,null))[_0x52f2('0x2b')](function(_0x441372){if(_0x441372){return _0x441372['removeAgents'](_0x2beaeb[_0x52f2('0x3b')][_0x52f2('0x6b')])[_0x52f2('0x2b')](function(){if(_['isArray'](_0x2beaeb[_0x52f2('0x3b')][_0x52f2('0x6b')])){for(var _0x1814d7=0x0;_0x1814d7<_0x2beaeb['query'][_0x52f2('0x6b')]['length'];_0x1814d7+=0x1){socket['emit'](_0x52f2('0x8a'),{'UserId':Number(_0x2beaeb[_0x52f2('0x3b')][_0x52f2('0x6b')][_0x1814d7]),'SmsQueueId':Number(_0x2beaeb[_0x52f2('0x50')]['id'])});}}else{socket[_0x52f2('0x74')](_0x52f2('0x8a'),{'UserId':Number(_0x2beaeb[_0x52f2('0x3b')][_0x52f2('0x6b')]),'SmsQueueId':Number(_0x2beaeb[_0x52f2('0x50')]['id'])});}});}})[_0x52f2('0x2b')](respondWithStatusCode(_0x1c09b2,null))[_0x52f2('0x4e')](handleError(_0x1c09b2,null));};exports[_0x52f2('0x8d')]=function(_0xc4d599,_0x18b1e5,_0x2fc774){var _0xf7dff7={};var _0x51f1d9={};var _0x3dcfd7;var _0x523c90;return db['SmsQueue'][_0x52f2('0x5a')]({'where':{'id':_0xc4d599[_0x52f2('0x50')]['id']}})[_0x52f2('0x2b')](handleEntityNotFound(_0x18b1e5,null))[_0x52f2('0x2b')](function(_0x2fe8b9){if(_0x2fe8b9){_0x3dcfd7=_0x2fe8b9;_0x51f1d9[_0x52f2('0x3a')]=_[_0x52f2('0x3c')](db[_0x52f2('0x5f')][_0x52f2('0x37')]);_0x51f1d9[_0x52f2('0x3b')]=_[_0x52f2('0x3c')](_0xc4d599[_0x52f2('0x3b')]);_0x51f1d9[_0x52f2('0x3d')]=_[_0x52f2('0x3e')](_0x51f1d9[_0x52f2('0x3a')],_0x51f1d9['query']);_0xf7dff7[_0x52f2('0x3f')]=_[_0x52f2('0x3e')](_0x51f1d9['model'],qs[_0x52f2('0x40')](_0xc4d599['query']['fields']));_0xf7dff7[_0x52f2('0x3f')]=_0xf7dff7[_0x52f2('0x3f')][_0x52f2('0x41')]?_0xf7dff7['attributes']:_0x51f1d9[_0x52f2('0x3a')];_0xf7dff7['order']=qs[_0x52f2('0x44')](_0xc4d599[_0x52f2('0x3b')][_0x52f2('0x44')]);_0xf7dff7[_0x52f2('0x45')]=qs['filters'](_['pick'](_0xc4d599[_0x52f2('0x3b')],_0x51f1d9[_0x52f2('0x3d')]));if(_0xc4d599[_0x52f2('0x3b')][_0x52f2('0x47')]){_0xf7dff7[_0x52f2('0x45')]=_[_0x52f2('0x48')](_0xf7dff7[_0x52f2('0x45')],{'$or':_['map'](_0xf7dff7['attributes'],function(_0x2ef76f){var _0x5ec533={};_0x5ec533[_0x2ef76f]={'$like':'%'+_0xc4d599['query'][_0x52f2('0x47')]+'%'};return _0x5ec533;})});}_0xf7dff7=_[_0x52f2('0x48')]({},_0xf7dff7,_0xc4d599[_0x52f2('0x4a')]);return _0x3dcfd7[_0x52f2('0x8d')](_0xf7dff7);}})[_0x52f2('0x2b')](function(_0x16fe0e){if(_0x16fe0e){_0x523c90=_0x16fe0e[_0x52f2('0x41')];if(!_0xc4d599[_0x52f2('0x3b')][_0x52f2('0x5c')](_0x52f2('0x42'))){_0xf7dff7['limit']=qs[_0x52f2('0x22')](_0xc4d599[_0x52f2('0x3b')]['limit']);_0xf7dff7['offset']=qs['offset'](_0xc4d599['query'][_0x52f2('0x20')]);}return _0x3dcfd7[_0x52f2('0x8d')](_0xf7dff7);}})[_0x52f2('0x2b')](function(_0x28139c){if(_0x28139c){return _0x28139c?{'count':_0x523c90,'rows':_0x28139c}:null;}})['then'](respondWithResult(_0x18b1e5,null))[_0x52f2('0x4e')](handleError(_0x18b1e5,null));}; \ No newline at end of file +var _0xe230=['sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','send','index','map','SmsQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','name','options','include','findAll','catch','show','params','create','body','user','role','SmsQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','filter','User','UserId','updatedAt','createdAt','format','SIP','smsPause','getTeams','pick','nolimit','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','Team','select','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe230,0x85));var _0x0e23=function(_0x3abd05,_0x4822c0){_0x3abd05=_0x3abd05-0x0;var _0x1ed361=_0xe230[_0x3abd05];return _0x1ed361;};'use strict';var emlformat=require(_0x0e23('0x0'));var rimraf=require(_0x0e23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e23('0x2'));var moment=require(_0x0e23('0x3'));var BPromise=require(_0x0e23('0x4'));var Mustache=require(_0x0e23('0x5'));var util=require(_0x0e23('0x6'));var path=require('path');var sox=require(_0x0e23('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e23('0x8'));var _=require('lodash');var squel=require(_0x0e23('0x9'));var crypto=require(_0x0e23('0xa'));var jsforce=require(_0x0e23('0xb'));var deskjs=require(_0x0e23('0xc'));var toCsv=require(_0x0e23('0xd'));var querystring=require('querystring');var Papa=require(_0x0e23('0xe'));var Redis=require('ioredis');var authService=require(_0x0e23('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0e23('0x10'));var hardwareService=require(_0x0e23('0x11'));var logger=require(_0x0e23('0x12'))(_0x0e23('0x13'));var utils=require(_0x0e23('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0e23('0x15'));var db=require(_0x0e23('0x16'))['db'];config['redis']=_[_0x0e23('0x17')](config['redis'],{'host':_0x0e23('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e23('0x19')]));require(_0x0e23('0x1a'))[_0x0e23('0x1b')](socket);function respondWithStatusCode(_0x3271da,_0xb64eda){_0xb64eda=_0xb64eda||0xcc;return function(_0x437276){if(_0x437276){return _0x3271da[_0x0e23('0x1c')](_0xb64eda);}return _0x3271da[_0x0e23('0x1d')](_0xb64eda)['end']();};}function respondWithResult(_0x25b4ef,_0x32cd1b){_0x32cd1b=_0x32cd1b||0xc8;return function(_0x13b0c0){if(_0x13b0c0){return _0x25b4ef[_0x0e23('0x1d')](_0x32cd1b)[_0x0e23('0x1e')](_0x13b0c0);}};}function respondWithFilteredResult(_0x2e30ff,_0x1764f7){return function(_0x30be62){if(_0x30be62){var _0x17a04a=typeof _0x1764f7[_0x0e23('0x1f')]===_0x0e23('0x20')&&typeof _0x1764f7[_0x0e23('0x21')]===_0x0e23('0x20');var _0x452b44=_0x30be62[_0x0e23('0x22')];var _0x2e79aa=_0x17a04a?0x0:_0x1764f7[_0x0e23('0x1f')];var _0x3e93e0=_0x17a04a?_0x30be62['count']:_0x1764f7['offset']+_0x1764f7[_0x0e23('0x21')];var _0x4cdebc;if(_0x3e93e0>=_0x452b44){_0x3e93e0=_0x452b44;_0x4cdebc=0xc8;}else{_0x4cdebc=0xce;}_0x2e30ff[_0x0e23('0x1d')](_0x4cdebc);return _0x2e30ff[_0x0e23('0x23')]('Content-Range',_0x2e79aa+'-'+_0x3e93e0+'/'+_0x452b44)[_0x0e23('0x1e')](_0x30be62);}return null;};}function patchUpdates(_0x462aab){return function(_0x3d0aeb){try{jsonpatch[_0x0e23('0x24')](_0x3d0aeb,_0x462aab,!![]);}catch(_0x109edd){return BPromise[_0x0e23('0x25')](_0x109edd);}return _0x3d0aeb[_0x0e23('0x26')]();};}function saveUpdates(_0x2de875,_0x3a21d5){return function(_0x5e4a9a){if(_0x5e4a9a){return _0x5e4a9a[_0x0e23('0x27')](_0x2de875)[_0x0e23('0x28')](function(_0x555357){return _0x555357;});}return null;};}function removeEntity(_0x1da63c,_0x1d75bf){return function(_0xb9695d){if(_0xb9695d){return _0xb9695d[_0x0e23('0x29')]()[_0x0e23('0x28')](function(){var _0x58fe02=_0xb9695d[_0x0e23('0x2a')]({'plain':!![]});var _0x4c6367='SmsQueues';return db[_0x0e23('0x2b')]['destroy']({'where':{'type':_0x4c6367,'resourceId':_0x58fe02['id']}})[_0x0e23('0x28')](function(){return _0xb9695d;});})['then'](function(){_0x1da63c['status'](0xcc)[_0x0e23('0x2c')]();});}};}function handleEntityNotFound(_0x4b57fe,_0x2f30e8){return function(_0x4d8666){if(!_0x4d8666){_0x4b57fe[_0x0e23('0x1c')](0x194);}return _0x4d8666;};}function handleError(_0x2e49f2,_0x52fe39){_0x52fe39=_0x52fe39||0x1f4;return function(_0x1ec805){logger[_0x0e23('0x2d')](_0x1ec805[_0x0e23('0x2e')]);if(_0x1ec805['name']){delete _0x1ec805['name'];}_0x2e49f2[_0x0e23('0x1d')](_0x52fe39)[_0x0e23('0x2f')](_0x1ec805);};}exports[_0x0e23('0x30')]=function(_0x4d6829,_0xd3c78c){var _0x22102c={},_0x327b0b={},_0x2d8fac={'count':0x0,'rows':[]};var _0x967a6b=_[_0x0e23('0x31')](db[_0x0e23('0x32')][_0x0e23('0x33')],function(_0x2a7248){return{'name':_0x2a7248['fieldName'],'type':_0x2a7248['type'][_0x0e23('0x34')]};});_0x327b0b[_0x0e23('0x35')]=_[_0x0e23('0x31')](_0x967a6b,'name');_0x327b0b[_0x0e23('0x36')]=_[_0x0e23('0x37')](_0x4d6829[_0x0e23('0x36')]);_0x327b0b[_0x0e23('0x38')]=_[_0x0e23('0x39')](_0x327b0b[_0x0e23('0x35')],_0x327b0b[_0x0e23('0x36')]);_0x22102c[_0x0e23('0x3a')]=_[_0x0e23('0x39')](_0x327b0b[_0x0e23('0x35')],qs['fields'](_0x4d6829[_0x0e23('0x36')][_0x0e23('0x3b')]));_0x22102c['attributes']=_0x22102c[_0x0e23('0x3a')][_0x0e23('0x3c')]?_0x22102c[_0x0e23('0x3a')]:_0x327b0b[_0x0e23('0x35')];if(!_0x4d6829['query'][_0x0e23('0x3d')]('nolimit')){_0x22102c[_0x0e23('0x21')]=qs[_0x0e23('0x21')](_0x4d6829[_0x0e23('0x36')]['limit']);_0x22102c[_0x0e23('0x1f')]=qs[_0x0e23('0x1f')](_0x4d6829[_0x0e23('0x36')][_0x0e23('0x1f')]);}_0x22102c[_0x0e23('0x3e')]=qs['sort'](_0x4d6829['query'][_0x0e23('0x3f')]);_0x22102c['where']=qs[_0x0e23('0x38')](_['pick'](_0x4d6829[_0x0e23('0x36')],_0x327b0b[_0x0e23('0x38')]),_0x967a6b);if(_0x4d6829['query']['filter']){_0x22102c[_0x0e23('0x40')]=_[_0x0e23('0x41')](_0x22102c[_0x0e23('0x40')],{'$or':_[_0x0e23('0x31')](_0x967a6b,function(_0x2f8168){if(_0x2f8168[_0x0e23('0x42')]!==_0x0e23('0x43')){var _0x534be4={};_0x534be4[_0x2f8168[_0x0e23('0x44')]]={'$like':'%'+_0x4d6829[_0x0e23('0x36')]['filter']+'%'};return _0x534be4;}})});}_0x22102c=_[_0x0e23('0x41')]({},_0x22102c,_0x4d6829[_0x0e23('0x45')]);var _0x2924e2={'where':_0x22102c[_0x0e23('0x40')]};return db[_0x0e23('0x32')]['count'](_0x2924e2)[_0x0e23('0x28')](function(_0x5c0c44){_0x2d8fac[_0x0e23('0x22')]=_0x5c0c44;if(_0x4d6829[_0x0e23('0x36')]['includeAll']){_0x22102c[_0x0e23('0x46')]=[{'all':!![]}];}return db[_0x0e23('0x32')][_0x0e23('0x47')](_0x22102c);})['then'](function(_0x39c1e2){_0x2d8fac['rows']=_0x39c1e2;return _0x2d8fac;})[_0x0e23('0x28')](respondWithFilteredResult(_0xd3c78c,_0x22102c))[_0x0e23('0x48')](handleError(_0xd3c78c,null));};exports[_0x0e23('0x49')]=function(_0x52cc3b,_0x1eb0dc){var _0x7a2c01={'raw':!![],'where':{'id':_0x52cc3b[_0x0e23('0x4a')]['id']}},_0x2288f7={};_0x2288f7[_0x0e23('0x35')]=_[_0x0e23('0x37')](db['SmsQueue'][_0x0e23('0x33')]);_0x2288f7[_0x0e23('0x36')]=_[_0x0e23('0x37')](_0x52cc3b[_0x0e23('0x36')]);_0x2288f7['filters']=_[_0x0e23('0x39')](_0x2288f7['model'],_0x2288f7[_0x0e23('0x36')]);_0x7a2c01[_0x0e23('0x3a')]=_['intersection'](_0x2288f7[_0x0e23('0x35')],qs[_0x0e23('0x3b')](_0x52cc3b[_0x0e23('0x36')]['fields']));_0x7a2c01['attributes']=_0x7a2c01[_0x0e23('0x3a')][_0x0e23('0x3c')]?_0x7a2c01['attributes']:_0x2288f7[_0x0e23('0x35')];if(_0x52cc3b['query']['includeAll']){_0x7a2c01['include']=[{'all':!![]}];}_0x7a2c01=_['merge']({},_0x7a2c01,_0x52cc3b[_0x0e23('0x45')]);return db[_0x0e23('0x32')]['find'](_0x7a2c01)[_0x0e23('0x28')](handleEntityNotFound(_0x1eb0dc,null))['then'](respondWithResult(_0x1eb0dc,null))[_0x0e23('0x48')](handleError(_0x1eb0dc,null));};exports[_0x0e23('0x4b')]=function(_0x5aa7a6,_0x185e11){return db['SmsQueue']['create'](_0x5aa7a6[_0x0e23('0x4c')],{})[_0x0e23('0x28')](function(_0x976320){var _0x2f9404=_0x5aa7a6[_0x0e23('0x4d')][_0x0e23('0x2a')]({'plain':!![]});if(!_0x2f9404)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f9404[_0x0e23('0x4e')]===_0x0e23('0x4d')){var _0x3a51da=_0x976320['get']({'plain':!![]});var _0x10f156=_0x0e23('0x4f');return db[_0x0e23('0x50')][_0x0e23('0x51')]({'where':{'name':_0x10f156,'userProfileId':_0x2f9404[_0x0e23('0x52')]},'raw':!![]})[_0x0e23('0x28')](function(_0x1c4dd5){if(_0x1c4dd5&&_0x1c4dd5['autoAssociation']===0x0){return db[_0x0e23('0x2b')][_0x0e23('0x4b')]({'name':_0x3a51da[_0x0e23('0x44')],'resourceId':_0x3a51da['id'],'type':_0x1c4dd5['name'],'sectionId':_0x1c4dd5['id']},{})[_0x0e23('0x28')](function(){return _0x976320;});}else{return _0x976320;}})[_0x0e23('0x48')](function(_0x3038b8){logger[_0x0e23('0x2d')](_0x0e23('0x53'),_0x3038b8);throw _0x3038b8;});}return _0x976320;})[_0x0e23('0x28')](respondWithResult(_0x185e11,0xc9))[_0x0e23('0x48')](handleError(_0x185e11,null));};exports[_0x0e23('0x27')]=function(_0x3432e8,_0x28041b){if(_0x3432e8[_0x0e23('0x4c')]['id']){delete _0x3432e8['body']['id'];}return db['SmsQueue']['find']({'where':{'id':_0x3432e8[_0x0e23('0x4a')]['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0x28041b,null))[_0x0e23('0x28')](saveUpdates(_0x3432e8[_0x0e23('0x4c')],null))[_0x0e23('0x28')](respondWithResult(_0x28041b,null))[_0x0e23('0x48')](handleError(_0x28041b,null));};exports[_0x0e23('0x29')]=function(_0x26b63c,_0xb26ad6){return db[_0x0e23('0x32')][_0x0e23('0x51')]({'where':{'id':_0x26b63c['params']['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0xb26ad6,null))[_0x0e23('0x28')](removeEntity(_0xb26ad6,null))[_0x0e23('0x48')](handleError(_0xb26ad6,null));};exports[_0x0e23('0x54')]=function(_0x56dfda,_0x1fef1e){return db[_0x0e23('0x32')][_0x0e23('0x54')]()[_0x0e23('0x28')](respondWithResult(_0x1fef1e,null))[_0x0e23('0x48')](handleError(_0x1fef1e,null));};exports[_0x0e23('0x55')]=function(_0x337600,_0xaaed19,_0x2be931){var _0x340f67={'raw':!![],'where':{}},_0x592d73={},_0x3835b7;return db['SmsQueue'][_0x0e23('0x56')]({'where':{'id':_0x337600[_0x0e23('0x4a')]['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0xaaed19,null))[_0x0e23('0x28')](function(_0x321c80){if(_0x321c80){_0x3835b7=_0x321c80[_0x0e23('0x2a')]({'plain':!![]});_0x592d73['model']=_[_0x0e23('0x37')](db[_0x0e23('0x57')][_0x0e23('0x33')]);_0x592d73['query']=_[_0x0e23('0x37')](_0x337600[_0x0e23('0x36')]);_0x592d73[_0x0e23('0x38')]=_['intersection'](_0x592d73[_0x0e23('0x35')],_0x592d73[_0x0e23('0x36')]);_0x340f67[_0x0e23('0x3a')]=_[_0x0e23('0x39')](_0x592d73[_0x0e23('0x35')],qs[_0x0e23('0x3b')](_0x337600['query'][_0x0e23('0x3b')]));_0x340f67[_0x0e23('0x3a')]=_0x340f67[_0x0e23('0x3a')][_0x0e23('0x3c')]?_0x340f67[_0x0e23('0x3a')]:_0x592d73['model'];if(!_0x337600[_0x0e23('0x36')][_0x0e23('0x3d')]('nolimit')){_0x340f67[_0x0e23('0x21')]=qs[_0x0e23('0x21')](_0x337600['query'][_0x0e23('0x21')]);_0x340f67[_0x0e23('0x1f')]=qs['offset'](_0x337600[_0x0e23('0x36')][_0x0e23('0x1f')]);}_0x340f67[_0x0e23('0x3e')]=qs[_0x0e23('0x3f')](_0x337600[_0x0e23('0x36')][_0x0e23('0x3f')]);_0x340f67['where']=qs['filters'](_['pick'](_0x337600[_0x0e23('0x36')],_0x592d73[_0x0e23('0x38')]));_0x340f67['where'][_0x0e23('0x58')]=_0x321c80['id'];if(_0x337600[_0x0e23('0x36')][_0x0e23('0x59')]){_0x340f67[_0x0e23('0x40')]=_[_0x0e23('0x41')](_0x340f67[_0x0e23('0x40')],{'$or':_[_0x0e23('0x31')](_0x340f67[_0x0e23('0x3a')],function(_0x178fe4){var _0x37a5a8={};_0x37a5a8[_0x178fe4]={'$like':'%'+_0x337600[_0x0e23('0x36')][_0x0e23('0x59')]+'%'};return _0x37a5a8;})});}_0x340f67=_[_0x0e23('0x41')]({},_0x340f67,_0x337600[_0x0e23('0x45')]);return db['UserSmsQueue'][_0x0e23('0x47')](_0x340f67);}})[_0x0e23('0x28')](function(_0x4749c3){if(_0x4749c3){return db[_0x0e23('0x5a')]['findAndCountAll']({'where':{'id':_['map'](_0x4749c3,_0x0e23('0x5b')),'role':'agent'},'attributes':['id',_0x0e23('0x44'),'smsPause',_0x0e23('0x5c'),_0x0e23('0x5d')]});}})[_0x0e23('0x28')](function(_0x1de181){if(_0x1de181){return{'count':_0x1de181[_0x0e23('0x22')],'rows':_[_0x0e23('0x31')](_0x1de181['rows'],function(_0x10c757){return{'membername':_0x10c757['name'],'UserId':_0x10c757['id'],'queue_name':_0x3835b7[_0x0e23('0x44')],'SmsQueueId':_0x3835b7['id'],'interface':util[_0x0e23('0x5e')]('%s/%s',_0x0e23('0x5f'),_0x10c757[_0x0e23('0x44')]),'penalty':0x0,'paused':_0x10c757[_0x0e23('0x60')],'createdAt':_0x10c757[_0x0e23('0x5d')],'updatedAt':_0x10c757[_0x0e23('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xaaed19,_0x340f67))[_0x0e23('0x48')](handleError(_0xaaed19,null));};exports[_0x0e23('0x61')]=function(_0x260231,_0x36c7f6,_0x4056ec){var _0x1c145d={};var _0x8ec13e={};var _0x4c981b;var _0x44fda5;return db['SmsQueue'][_0x0e23('0x56')]({'where':{'id':_0x260231[_0x0e23('0x4a')]['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0x36c7f6,null))[_0x0e23('0x28')](function(_0x39484a){if(_0x39484a){_0x4c981b=_0x39484a;_0x8ec13e[_0x0e23('0x35')]=_[_0x0e23('0x37')](db['Team']['rawAttributes']);_0x8ec13e[_0x0e23('0x36')]=_[_0x0e23('0x37')](_0x260231['query']);_0x8ec13e['filters']=_[_0x0e23('0x39')](_0x8ec13e[_0x0e23('0x35')],_0x8ec13e[_0x0e23('0x36')]);_0x1c145d[_0x0e23('0x3a')]=_['intersection'](_0x8ec13e[_0x0e23('0x35')],qs[_0x0e23('0x3b')](_0x260231[_0x0e23('0x36')][_0x0e23('0x3b')]));_0x1c145d[_0x0e23('0x3a')]=_0x1c145d['attributes'][_0x0e23('0x3c')]?_0x1c145d['attributes']:_0x8ec13e[_0x0e23('0x35')];_0x1c145d['order']=qs['sort'](_0x260231[_0x0e23('0x36')][_0x0e23('0x3f')]);_0x1c145d[_0x0e23('0x40')]=qs[_0x0e23('0x38')](_[_0x0e23('0x62')](_0x260231[_0x0e23('0x36')],_0x8ec13e[_0x0e23('0x38')]));if(_0x260231['query']['filter']){_0x1c145d[_0x0e23('0x40')]=_[_0x0e23('0x41')](_0x1c145d['where'],{'$or':_[_0x0e23('0x31')](_0x1c145d[_0x0e23('0x3a')],function(_0x5491fa){var _0x3029c9={};_0x3029c9[_0x5491fa]={'$like':'%'+_0x260231[_0x0e23('0x36')][_0x0e23('0x59')]+'%'};return _0x3029c9;})});}_0x1c145d=_['merge']({},_0x1c145d,_0x260231[_0x0e23('0x45')]);return _0x4c981b[_0x0e23('0x61')](_0x1c145d);}})[_0x0e23('0x28')](function(_0x1a7d17){if(_0x1a7d17){_0x44fda5=_0x1a7d17[_0x0e23('0x3c')];if(!_0x260231[_0x0e23('0x36')][_0x0e23('0x3d')](_0x0e23('0x63'))){_0x1c145d[_0x0e23('0x21')]=qs[_0x0e23('0x21')](_0x260231['query'][_0x0e23('0x21')]);_0x1c145d[_0x0e23('0x1f')]=qs[_0x0e23('0x1f')](_0x260231[_0x0e23('0x36')][_0x0e23('0x1f')]);}return _0x4c981b[_0x0e23('0x61')](_0x1c145d);}})[_0x0e23('0x28')](function(_0xb96175){if(_0xb96175){return _0xb96175?{'count':_0x44fda5,'rows':_0xb96175}:null;}})[_0x0e23('0x28')](respondWithResult(_0x36c7f6,null))[_0x0e23('0x48')](handleError(_0x36c7f6,null));};exports[_0x0e23('0x64')]=function(_0x4f5c8d,_0x12a80d,_0x17deaf){var _0xd70730=_0x4f5c8d[_0x0e23('0x4c')][_0x0e23('0x65')];return db['Team']['findAll']({'where':{'id':_0xd70730},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e23('0x66'),'attributes':['id',_0x0e23('0x44'),'online',_0x0e23('0x67'),_0x0e23('0x68')],'raw':!![]}]})[_0x0e23('0x28')](function(_0x3b5b53){if(_0x3b5b53){var _0x1ef068=_[_0x0e23('0x69')](_0x3b5b53,function(_0x4a9c21){var _0x453981=_0x4a9c21[_0x0e23('0x2a')]({'plain':!![]});return _0x453981[_0x0e23('0x66')];});return db[_0x0e23('0x32')][_0x0e23('0x51')]({'where':{'id':_0x4f5c8d[_0x0e23('0x4a')]['id']}})['then'](function(_0x4fef4a){return db[_0x0e23('0x6a')][_0x0e23('0x6b')](function(_0x5764aa){return _0x4fef4a[_0x0e23('0x64')](_0xd70730,{'transaction':_0x5764aa})[_0x0e23('0x28')](function(){return BPromise[_0x0e23('0x6c')](_0x1ef068,function(_0x3b0b96){return db['UserSmsQueue'][_0x0e23('0x6d')]({'where':{'UserId':_0x3b0b96['id'],'SmsQueueId':_0x4f5c8d[_0x0e23('0x4a')]['id']},'transaction':_0x5764aa});});})[_0x0e23('0x28')](function(){_0x1ef068[_0x0e23('0x6e')](function(_0x13fa9f){socket['emit'](_0x0e23('0x6f'),{'UserId':_0x13fa9f['id'],'SmsQueueId':_0x4fef4a['id']});});});});});}})[_0x0e23('0x28')](respondWithStatusCode(_0x12a80d,null))[_0x0e23('0x48')](handleError(_0x12a80d,null));};exports[_0x0e23('0x70')]=function(_0x467a7a,_0x209f9c,_0x1d411b){return db[_0x0e23('0x71')][_0x0e23('0x47')]({'where':{'id':_0x467a7a[_0x0e23('0x36')][_0x0e23('0x65')]},'attributes':['id'],'include':[{'model':db[_0x0e23('0x5a')],'as':_0x0e23('0x66'),'attributes':['id'],'raw':!![]}]})[_0x0e23('0x28')](handleEntityNotFound(_0x209f9c,null))[_0x0e23('0x28')](function(_0x77f39a){var _0x1be60a=_[_0x0e23('0x31')](_0x77f39a,'id');var _0x4a8609=[];var _0x1e973e=[];var _0x14e88d=squel[_0x0e23('0x72')]();_0x14e88d['field'](_0x0e23('0x73'))[_0x0e23('0x74')](_0x0e23('0x75'),'tq')[_0x0e23('0x76')](_0x0e23('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0e23('0x40')](_0x0e23('0x78'),_0x467a7a[_0x0e23('0x4a')]['id']);for(var _0x300e46=0x0;_0x300e46<_0x77f39a['length'];_0x300e46+=0x1){let _0x234b04=_0x77f39a[_0x300e46];for(var _0x3b8aab=0x0;_0x3b8aab<_0x234b04['Agents']['length'];_0x3b8aab+=0x1){let _0x5d65a0=_0x234b04[_0x0e23('0x66')][_0x3b8aab];var _0x44ab44=_0x14e88d[_0x0e23('0x79')]();_0x44ab44[_0x0e23('0x40')]('ut.UserId\x20=\x20?',_0x5d65a0['id']);_0x1e973e[_0x0e23('0x7a')](db[_0x0e23('0x6a')]['query'](_0x44ab44['toString'](),{'type':db[_0x0e23('0x6a')][_0x0e23('0x7b')][_0x0e23('0x7c')]})[_0x0e23('0x28')](function(_0x5728ec){if(_0x5728ec[_0x0e23('0x3c')]===0x1){return _0x5d65a0['id'];}else{var _0xead8de=_[_0x0e23('0x7d')](_[_0x0e23('0x31')](_0x5728ec,_0x0e23('0x7e')),function(_0x45e197){return _[_0x0e23('0x7f')](_0x1be60a,_0x45e197);});if(_0xead8de){return _0x5d65a0['id'];}}}));}}return BPromise[_0x0e23('0x80')](_0x1e973e)[_0x0e23('0x28')](function(_0x5e2d6e){_0x4a8609=_(_0x4a8609)['union'](_0x5e2d6e)[_0x0e23('0x81')]()[_0x0e23('0x82')]();return db['SmsQueue'][_0x0e23('0x51')]({'where':{'id':_0x467a7a['params']['id']}})[_0x0e23('0x28')](function(_0x43eaf6){return db[_0x0e23('0x6a')][_0x0e23('0x6b')](function(_0x27f328){return _0x43eaf6[_0x0e23('0x70')](_0x467a7a[_0x0e23('0x36')][_0x0e23('0x65')],{'transaction':_0x27f328})[_0x0e23('0x28')](function(){if(!_[_0x0e23('0x83')](_0x4a8609)){return _0x43eaf6[_0x0e23('0x84')](_0x4a8609,{'transaction':_0x27f328});}})[_0x0e23('0x28')](function(){_0x4a8609[_0x0e23('0x6e')](function(_0xec5dc1){socket[_0x0e23('0x85')](_0x0e23('0x86'),{'UserId':_0xec5dc1,'SmsQueueId':_0x43eaf6['id']});});});});});});})[_0x0e23('0x28')](respondWithStatusCode(_0x209f9c,null))[_0x0e23('0x48')](handleError(_0x209f9c,null));};exports[_0x0e23('0x87')]=function(_0x2b2b13,_0xcd546f,_0x143243){return db['SmsQueue']['find']({'where':{'id':_0x2b2b13[_0x0e23('0x4a')]['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0xcd546f,null))[_0x0e23('0x28')](function(_0xe24b29){if(_0xe24b29){return _0xe24b29[_0x0e23('0x87')](_0x2b2b13[_0x0e23('0x4c')][_0x0e23('0x65')],_[_0x0e23('0x88')](_0x2b2b13[_0x0e23('0x4c')],['ids','id'])||{})[_0x0e23('0x89')](function(_0x8b0309){for(var _0x158805=0x0;_0x158805<_0x2b2b13['body'][_0x0e23('0x65')][_0x0e23('0x3c')];_0x158805+=0x1){socket[_0x0e23('0x85')](_0x0e23('0x6f'),{'UserId':Number(_0x2b2b13['body'][_0x0e23('0x65')][_0x158805]),'SmsQueueId':Number(_0x2b2b13[_0x0e23('0x4a')]['id'])});}return _0x8b0309;});}})[_0x0e23('0x28')](respondWithResult(_0xcd546f,null))[_0x0e23('0x48')](handleError(_0xcd546f,null));};exports['removeAgents']=function(_0x16af17,_0x5ea31a,_0x1fc3c6){return db[_0x0e23('0x32')][_0x0e23('0x51')]({'where':{'id':_0x16af17[_0x0e23('0x4a')]['id']}})[_0x0e23('0x28')](handleEntityNotFound(_0x5ea31a,null))['then'](function(_0x36027f){if(_0x36027f){return _0x36027f['removeAgents'](_0x16af17[_0x0e23('0x36')][_0x0e23('0x65')])[_0x0e23('0x28')](function(){if(_[_0x0e23('0x8a')](_0x16af17[_0x0e23('0x36')][_0x0e23('0x65')])){for(var _0x3dd4d9=0x0;_0x3dd4d9<_0x16af17[_0x0e23('0x36')][_0x0e23('0x65')][_0x0e23('0x3c')];_0x3dd4d9+=0x1){socket[_0x0e23('0x85')](_0x0e23('0x86'),{'UserId':Number(_0x16af17[_0x0e23('0x36')][_0x0e23('0x65')][_0x3dd4d9]),'SmsQueueId':Number(_0x16af17[_0x0e23('0x4a')]['id'])});}}else{socket[_0x0e23('0x85')](_0x0e23('0x86'),{'UserId':Number(_0x16af17[_0x0e23('0x36')][_0x0e23('0x65')]),'SmsQueueId':Number(_0x16af17[_0x0e23('0x4a')]['id'])});}});}})[_0x0e23('0x28')](respondWithStatusCode(_0x5ea31a,null))[_0x0e23('0x48')](handleError(_0x5ea31a,null));};exports[_0x0e23('0x8b')]=function(_0x3cdc91,_0x4bb984,_0x460738){var _0x459b03={};var _0x4005b9={};var _0x3c9ea6;var _0x4b69bf;return db[_0x0e23('0x32')][_0x0e23('0x56')]({'where':{'id':_0x3cdc91[_0x0e23('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4bb984,null))[_0x0e23('0x28')](function(_0x2c88a7){if(_0x2c88a7){_0x3c9ea6=_0x2c88a7;_0x4005b9[_0x0e23('0x35')]=_[_0x0e23('0x37')](db['User'][_0x0e23('0x33')]);_0x4005b9[_0x0e23('0x36')]=_[_0x0e23('0x37')](_0x3cdc91[_0x0e23('0x36')]);_0x4005b9[_0x0e23('0x38')]=_['intersection'](_0x4005b9[_0x0e23('0x35')],_0x4005b9[_0x0e23('0x36')]);_0x459b03[_0x0e23('0x3a')]=_[_0x0e23('0x39')](_0x4005b9['model'],qs[_0x0e23('0x3b')](_0x3cdc91[_0x0e23('0x36')]['fields']));_0x459b03['attributes']=_0x459b03['attributes']['length']?_0x459b03['attributes']:_0x4005b9[_0x0e23('0x35')];_0x459b03[_0x0e23('0x3e')]=qs['sort'](_0x3cdc91[_0x0e23('0x36')]['sort']);_0x459b03[_0x0e23('0x40')]=qs['filters'](_['pick'](_0x3cdc91['query'],_0x4005b9[_0x0e23('0x38')]));if(_0x3cdc91[_0x0e23('0x36')]['filter']){_0x459b03[_0x0e23('0x40')]=_[_0x0e23('0x41')](_0x459b03[_0x0e23('0x40')],{'$or':_[_0x0e23('0x31')](_0x459b03[_0x0e23('0x3a')],function(_0x54a3f5){var _0x4bab5f={};_0x4bab5f[_0x54a3f5]={'$like':'%'+_0x3cdc91[_0x0e23('0x36')]['filter']+'%'};return _0x4bab5f;})});}_0x459b03=_[_0x0e23('0x41')]({},_0x459b03,_0x3cdc91[_0x0e23('0x45')]);return _0x3c9ea6[_0x0e23('0x8b')](_0x459b03);}})[_0x0e23('0x28')](function(_0x213578){if(_0x213578){_0x4b69bf=_0x213578['length'];if(!_0x3cdc91[_0x0e23('0x36')][_0x0e23('0x3d')](_0x0e23('0x63'))){_0x459b03[_0x0e23('0x21')]=qs[_0x0e23('0x21')](_0x3cdc91['query']['limit']);_0x459b03['offset']=qs[_0x0e23('0x1f')](_0x3cdc91[_0x0e23('0x36')]['offset']);}return _0x3c9ea6[_0x0e23('0x8b')](_0x459b03);}})[_0x0e23('0x28')](function(_0x385a3c){if(_0x385a3c){return _0x385a3c?{'count':_0x4b69bf,'rows':_0x385a3c}:null;}})[_0x0e23('0x28')](respondWithResult(_0x4bb984,null))['catch'](handleError(_0x4bb984,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 7ba569a..3f63c07 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 _0x2915=['events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5c4178,_0x11471c){var _0x384e71=function(_0x4ff0db){while(--_0x4ff0db){_0x5c4178['push'](_0x5c4178['shift']());}};_0x384e71(++_0x11471c);}(_0x2915,0x1ef));var _0x5291=function(_0x10a00b,_0x2a3c2a){_0x10a00b=_0x10a00b-0x0;var _0x349213=_0x2915[_0x10a00b];return _0x349213;};'use strict';var EventEmitter=require(_0x5291('0x0'));var SmsQueue=require(_0x5291('0x1'))['db'][_0x5291('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5291('0x3')](0x0);var events={'afterCreate':_0x5291('0x4'),'afterUpdate':_0x5291('0x5'),'afterDestroy':_0x5291('0x6')};function emitEvent(_0x4be3c5){return function(_0x5443a0,_0x3fdda3,_0x51477e){SmsQueueEvents[_0x5291('0x7')](_0x4be3c5+':'+_0x5443a0['id'],_0x5443a0);SmsQueueEvents[_0x5291('0x7')](_0x4be3c5,_0x5443a0);_0x51477e(null);};}for(var e in events){if(events[_0x5291('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xea52=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x5736fb,_0x597e0e){var _0x45bde4=function(_0x543365){while(--_0x543365){_0x5736fb['push'](_0x5736fb['shift']());}};_0x45bde4(++_0x597e0e);}(_0xea52,0x165));var _0x2ea5=function(_0x28c02d,_0x32daa3){_0x28c02d=_0x28c02d-0x0;var _0x4a81f5=_0xea52[_0x28c02d];return _0x4a81f5;};'use strict';var EventEmitter=require(_0x2ea5('0x0'));var SmsQueue=require(_0x2ea5('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2ea5('0x2')](0x0);var events={'afterCreate':_0x2ea5('0x3'),'afterUpdate':_0x2ea5('0x4'),'afterDestroy':_0x2ea5('0x5')};function emitEvent(_0x235749){return function(_0x13a719,_0xa7b8b0,_0x487176){SmsQueueEvents[_0x2ea5('0x6')](_0x235749+':'+_0x13a719['id'],_0x13a719);SmsQueueEvents[_0x2ea5('0x6')](_0x235749,_0x13a719);_0x487176(null);};}for(var e in events){if(events[_0x2ea5('0x7')](e)){var event=events[e];SmsQueue[_0x2ea5('0x8')](e,emitEvent(event));}}module[_0x2ea5('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6c16496..69599d8 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 _0x24d6=['api','bluebird','request-promise','rimraf','./smsQueue.attributes','exports','define','sms_queues','util','../../config/logger'];(function(_0x35493d,_0x17eabe){var _0x254db6=function(_0x22d1ca){while(--_0x22d1ca){_0x35493d['push'](_0x35493d['shift']());}};_0x254db6(++_0x17eabe);}(_0x24d6,0xee));var _0x624d=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0x24d6[_0x333714];return _0x4c211e;};'use strict';var _=require('lodash');var util=require(_0x624d('0x0'));var logger=require(_0x624d('0x1'))(_0x624d('0x2'));var moment=require('moment');var BPromise=require(_0x624d('0x3'));var rp=require(_0x624d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x624d('0x5'));var config=require('../../config/environment');var attributes=require(_0x624d('0x6'));module[_0x624d('0x7')]=function(_0x1cae21,_0x3edf3a){return _0x1cae21[_0x624d('0x8')]('SmsQueue',attributes,{'tableName':_0x624d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07e0=['./smsQueue.attributes','define','sms_queues','lodash','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x07e0,0x113));var _0x007e=function(_0x5d7088,_0x429f0e){_0x5d7088=_0x5d7088-0x0;var _0x4a557a=_0x07e0[_0x5d7088];return _0x4a557a;};'use strict';var _=require(_0x007e('0x0'));var util=require('util');var logger=require(_0x007e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x007e('0x2'));var rp=require(_0x007e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x007e('0x4'));var config=require('../../config/environment');var attributes=require(_0x007e('0x5'));module['exports']=function(_0x4afd45,_0x3d80a8){return _0x4afd45[_0x007e('0x6')]('SmsQueue',attributes,{'tableName':_0x007e('0x7'),'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 45b891d..83ef57e 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 _0x9b2f=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','include','map','model','ShowSmsQueue','SmsQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9b2f,0x162));var _0xf9b2=function(_0x5e8c0f,_0x1f20d9){_0x5e8c0f=_0x5e8c0f-0x0;var _0x568dbe=_0x9b2f[_0x5e8c0f];return _0x568dbe;};'use strict';var _=require(_0xf9b2('0x0'));var util=require(_0xf9b2('0x1'));var moment=require(_0xf9b2('0x2'));var BPromise=require('bluebird');var rs=require(_0xf9b2('0x3'));var fs=require('fs');var Redis=require(_0xf9b2('0x4'));var db=require(_0xf9b2('0x5'))['db'];var utils=require(_0xf9b2('0x6'));var logger=require(_0xf9b2('0x7'))(_0xf9b2('0x8'));var config=require(_0xf9b2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf9b2('0xa')]['http']({'port':0x232a});config[_0xf9b2('0xb')]=_['defaults'](config[_0xf9b2('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9b2('0xc'))(new Redis(config[_0xf9b2('0xb')]));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x22a2d8,_0x365e22,_0x59b6e8){return new BPromise(function(_0x425506,_0x5a98ad){return client['request'](_0x22a2d8,_0x59b6e8)[_0xf9b2('0xd')](function(_0x2c77f1){logger[_0xf9b2('0xe')](_0xf9b2('0xf'),_0x365e22,'request\x20sent');logger[_0xf9b2('0x10')](_0xf9b2('0x11'),_0x365e22,_0xf9b2('0x12'),JSON[_0xf9b2('0x13')](_0x2c77f1));if(_0x2c77f1[_0xf9b2('0x14')]){if(_0x2c77f1['error'][_0xf9b2('0x15')]===0x1f4){logger[_0xf9b2('0x14')](_0xf9b2('0xf'),_0x365e22,_0x2c77f1['error'][_0xf9b2('0x16')]);return _0x5a98ad(_0x2c77f1[_0xf9b2('0x14')][_0xf9b2('0x16')]);}logger[_0xf9b2('0x14')](_0xf9b2('0xf'),_0x365e22,_0x2c77f1['error'][_0xf9b2('0x16')]);return _0x425506(_0x2c77f1[_0xf9b2('0x14')][_0xf9b2('0x16')]);}else{logger[_0xf9b2('0xe')](_0xf9b2('0xf'),_0x365e22,'request\x20sent');_0x425506(_0x2c77f1[_0xf9b2('0x17')][_0xf9b2('0x16')]);}})[_0xf9b2('0x18')](function(_0x3b56e7){logger[_0xf9b2('0x14')]('SmsQueue,\x20%s,\x20%s',_0x365e22,_0x3b56e7);_0x5a98ad(_0x3b56e7);});});}exports[_0xf9b2('0x19')]=function(_0xadbe2f){var _0x44c4e0=this;return new Promise(function(_0x540224,_0x40eb6c){return db['SmsQueue'][_0xf9b2('0x1a')]({'raw':_0xadbe2f[_0xf9b2('0x1b')]?_0xadbe2f[_0xf9b2('0x1b')][_0xf9b2('0x1c')]===undefined?!![]:![]:!![],'where':_0xadbe2f[_0xf9b2('0x1b')]?_0xadbe2f[_0xf9b2('0x1b')][_0xf9b2('0x1d')]||null:null,'attributes':_0xadbe2f['options']?_0xadbe2f[_0xf9b2('0x1b')][_0xf9b2('0x1e')]||null:null,'limit':_0xadbe2f['options']?_0xadbe2f['options']['limit']||null:null,'include':_0xadbe2f[_0xf9b2('0x1b')]?_0xadbe2f['options'][_0xf9b2('0x1f')]?_[_0xf9b2('0x20')](_0xadbe2f[_0xf9b2('0x1b')]['include'],function(_0x10569b){return{'model':db[_0x10569b[_0xf9b2('0x21')]],'as':_0x10569b['as'],'attributes':_0x10569b[_0xf9b2('0x1e')],'include':_0x10569b[_0xf9b2('0x1f')]?_[_0xf9b2('0x20')](_0x10569b[_0xf9b2('0x1f')],function(_0x249a52){return{'model':db[_0x249a52[_0xf9b2('0x21')]],'as':_0x249a52['as'],'attributes':_0x249a52[_0xf9b2('0x1e')],'include':_0x249a52['include']?_['map'](_0x249a52['include'],function(_0x33f32d){return{'model':db[_0x33f32d[_0xf9b2('0x21')]],'as':_0x33f32d['as'],'attributes':_0x33f32d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9b2('0xd')](function(_0x54cd1e){logger['info'](_0xf9b2('0x19'),_0xadbe2f);logger[_0xf9b2('0x10')](_0xf9b2('0x19'),_0xadbe2f,JSON[_0xf9b2('0x13')](_0x54cd1e));_0x540224(_0x54cd1e);})['catch'](function(_0x2a761c){logger['error'](_0xf9b2('0x19'),_0x2a761c[_0xf9b2('0x16')],_0xadbe2f);_0x40eb6c(_0x44c4e0['error'](0x1f4,_0x2a761c[_0xf9b2('0x16')]));});});};exports[_0xf9b2('0x22')]=function(_0x5b2879){var _0x5116f2=this;return new Promise(function(_0x550409,_0x4e6f2d){return db[_0xf9b2('0x23')][_0xf9b2('0x24')]({'raw':_0x5b2879[_0xf9b2('0x1b')]?_0x5b2879[_0xf9b2('0x1b')][_0xf9b2('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b2879[_0xf9b2('0x1b')]?_0x5b2879[_0xf9b2('0x1b')]['where']||null:null,'attributes':_0x5b2879[_0xf9b2('0x1b')]?_0x5b2879['options'][_0xf9b2('0x1e')]||null:null,'include':_0x5b2879['options']?_0x5b2879[_0xf9b2('0x1b')][_0xf9b2('0x1f')]?_[_0xf9b2('0x20')](_0x5b2879[_0xf9b2('0x1b')]['include'],function(_0x38ed9d){return{'model':db[_0x38ed9d[_0xf9b2('0x21')]],'as':_0x38ed9d['as'],'attributes':_0x38ed9d[_0xf9b2('0x1e')],'include':_0x38ed9d[_0xf9b2('0x1f')]?_[_0xf9b2('0x20')](_0x38ed9d[_0xf9b2('0x1f')],function(_0x4c0469){return{'model':db[_0x4c0469['model']],'as':_0x4c0469['as'],'attributes':_0x4c0469[_0xf9b2('0x1e')],'include':_0x4c0469[_0xf9b2('0x1f')]?_[_0xf9b2('0x20')](_0x4c0469[_0xf9b2('0x1f')],function(_0x44f07d){return{'model':db[_0x44f07d[_0xf9b2('0x21')]],'as':_0x44f07d['as'],'attributes':_0x44f07d[_0xf9b2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf9b2('0xd')](function(_0x24cb83){logger['info'](_0xf9b2('0x22'),_0x5b2879);logger[_0xf9b2('0x10')](_0xf9b2('0x22'),_0x5b2879,JSON['stringify'](_0x24cb83));_0x550409(_0x24cb83);})[_0xf9b2('0x18')](function(_0x40358d){logger['error'](_0xf9b2('0x22'),_0x40358d[_0xf9b2('0x16')],_0x5b2879);_0x4e6f2d(_0x5116f2[_0xf9b2('0x14')](0x1f4,_0x40358d[_0xf9b2('0x16')]));});});}; \ No newline at end of file +var _0x9ad5=['./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SmsQueue','findAll','options','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','raw','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x350b86,_0xd7034d){var _0x922c2f=function(_0x49fa5c){while(--_0x49fa5c){_0x350b86['push'](_0x350b86['shift']());}};_0x922c2f(++_0xd7034d);}(_0x9ad5,0xf7));var _0x59ad=function(_0x1de3e0,_0x379c01){_0x1de3e0=_0x1de3e0-0x0;var _0x1993e2=_0x9ad5[_0x1de3e0];return _0x1993e2;};'use strict';var _=require(_0x59ad('0x0'));var util=require('util');var moment=require(_0x59ad('0x1'));var BPromise=require(_0x59ad('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59ad('0x4'))(_0x59ad('0x5'));var config=require(_0x59ad('0x6'));var jayson=require(_0x59ad('0x7'));var client=jayson[_0x59ad('0x8')][_0x59ad('0x9')]({'port':0x232a});config[_0x59ad('0xa')]=_[_0x59ad('0xb')](config[_0x59ad('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x59ad('0xa')]));require(_0x59ad('0xc'))[_0x59ad('0xd')](socket);function respondWithRpcPromise(_0x28198a,_0x304c67,_0x49b42c){return new BPromise(function(_0x2205e9,_0x23aa5b){return client[_0x59ad('0xe')](_0x28198a,_0x49b42c)[_0x59ad('0xf')](function(_0x20cb5f){logger['info'](_0x59ad('0x10'),_0x304c67,_0x59ad('0x11'));logger[_0x59ad('0x12')](_0x59ad('0x13'),_0x304c67,'request\x20sent',JSON[_0x59ad('0x14')](_0x20cb5f));if(_0x20cb5f['error']){if(_0x20cb5f[_0x59ad('0x15')]['code']===0x1f4){logger['error'](_0x59ad('0x10'),_0x304c67,_0x20cb5f[_0x59ad('0x15')][_0x59ad('0x16')]);return _0x23aa5b(_0x20cb5f['error']['message']);}logger[_0x59ad('0x15')](_0x59ad('0x10'),_0x304c67,_0x20cb5f[_0x59ad('0x15')][_0x59ad('0x16')]);return _0x2205e9(_0x20cb5f[_0x59ad('0x15')]['message']);}else{logger[_0x59ad('0x17')](_0x59ad('0x10'),_0x304c67,_0x59ad('0x11'));_0x2205e9(_0x20cb5f[_0x59ad('0x18')][_0x59ad('0x16')]);}})[_0x59ad('0x19')](function(_0x103bd9){logger[_0x59ad('0x15')](_0x59ad('0x10'),_0x304c67,_0x103bd9);_0x23aa5b(_0x103bd9);});});}exports['GetSmsQueue']=function(_0x145a99){var _0x350b49=this;return new Promise(function(_0x246468,_0x30a9af){return db[_0x59ad('0x1a')][_0x59ad('0x1b')]({'raw':_0x145a99['options']?_0x145a99[_0x59ad('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x145a99[_0x59ad('0x1c')]?_0x145a99['options'][_0x59ad('0x1d')]||null:null,'attributes':_0x145a99[_0x59ad('0x1c')]?_0x145a99[_0x59ad('0x1c')][_0x59ad('0x1e')]||null:null,'limit':_0x145a99[_0x59ad('0x1c')]?_0x145a99['options']['limit']||null:null,'include':_0x145a99[_0x59ad('0x1c')]?_0x145a99[_0x59ad('0x1c')][_0x59ad('0x1f')]?_[_0x59ad('0x20')](_0x145a99[_0x59ad('0x1c')]['include'],function(_0x4035b8){return{'model':db[_0x4035b8[_0x59ad('0x21')]],'as':_0x4035b8['as'],'attributes':_0x4035b8[_0x59ad('0x1e')],'include':_0x4035b8[_0x59ad('0x1f')]?_['map'](_0x4035b8[_0x59ad('0x1f')],function(_0x330cb5){return{'model':db[_0x330cb5['model']],'as':_0x330cb5['as'],'attributes':_0x330cb5[_0x59ad('0x1e')],'include':_0x330cb5[_0x59ad('0x1f')]?_[_0x59ad('0x20')](_0x330cb5[_0x59ad('0x1f')],function(_0xe5fa89){return{'model':db[_0xe5fa89['model']],'as':_0xe5fa89['as'],'attributes':_0xe5fa89[_0x59ad('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ce144){logger['info']('GetSmsQueue',_0x145a99);logger[_0x59ad('0x12')](_0x59ad('0x22'),_0x145a99,JSON[_0x59ad('0x14')](_0x2ce144));_0x246468(_0x2ce144);})[_0x59ad('0x19')](function(_0x3026f5){logger[_0x59ad('0x15')](_0x59ad('0x22'),_0x3026f5['message'],_0x145a99);_0x30a9af(_0x350b49['error'](0x1f4,_0x3026f5[_0x59ad('0x16')]));});});};exports[_0x59ad('0x23')]=function(_0x518e91){var _0x1bb5ad=this;return new Promise(function(_0x14f4f9,_0x2234b3){return db[_0x59ad('0x1a')]['find']({'raw':_0x518e91[_0x59ad('0x1c')]?_0x518e91[_0x59ad('0x1c')][_0x59ad('0x24')]===undefined?!![]:![]:!![],'where':_0x518e91[_0x59ad('0x1c')]?_0x518e91[_0x59ad('0x1c')]['where']||null:null,'attributes':_0x518e91['options']?_0x518e91['options'][_0x59ad('0x1e')]||null:null,'include':_0x518e91[_0x59ad('0x1c')]?_0x518e91[_0x59ad('0x1c')][_0x59ad('0x1f')]?_[_0x59ad('0x20')](_0x518e91[_0x59ad('0x1c')][_0x59ad('0x1f')],function(_0x22bb8a){return{'model':db[_0x22bb8a[_0x59ad('0x21')]],'as':_0x22bb8a['as'],'attributes':_0x22bb8a[_0x59ad('0x1e')],'include':_0x22bb8a[_0x59ad('0x1f')]?_[_0x59ad('0x20')](_0x22bb8a[_0x59ad('0x1f')],function(_0x4bb744){return{'model':db[_0x4bb744[_0x59ad('0x21')]],'as':_0x4bb744['as'],'attributes':_0x4bb744[_0x59ad('0x1e')],'include':_0x4bb744['include']?_[_0x59ad('0x20')](_0x4bb744[_0x59ad('0x1f')],function(_0x1230b2){return{'model':db[_0x1230b2['model']],'as':_0x1230b2['as'],'attributes':_0x1230b2[_0x59ad('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x59ad('0xf')](function(_0x5a96b1){logger['info']('ShowSmsQueue',_0x518e91);logger[_0x59ad('0x12')](_0x59ad('0x23'),_0x518e91,JSON[_0x59ad('0x14')](_0x5a96b1));_0x14f4f9(_0x5a96b1);})[_0x59ad('0x19')](function(_0x22c21d){logger[_0x59ad('0x15')](_0x59ad('0x23'),_0x22c21d[_0x59ad('0x16')],_0x518e91);_0x2234b3(_0x1bb5ad[_0x59ad('0x15')](0x1f4,_0x22c21d[_0x59ad('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 82f69f3..085284a 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 _0x382e=['removeListener','register','length','smsQueue:','save','update','emit'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x382e,0x1d2));var _0xe382=function(_0x3cad5d,_0x1fc02c){_0x3cad5d=_0x3cad5d-0x0;var _0x390072=_0x382e[_0x3cad5d];return _0x390072;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xe382('0x0'),'remove',_0xe382('0x1')];function createListener(_0xa113c5,_0x10b664){return function(_0x3c193d){_0x10b664[_0xe382('0x2')](_0xa113c5,_0x3c193d);};}function removeListener(_0x21ce4c,_0x248e0f){return function(){SmsQueueEvents[_0xe382('0x3')](_0x21ce4c,_0x248e0f);};}exports[_0xe382('0x4')]=function(_0x39bd64){for(var _0x5cbd95=0x0,_0x1a5ec0=events[_0xe382('0x5')];_0x5cbd95<_0x1a5ec0;_0x5cbd95++){var _0x450a16=events[_0x5cbd95];var _0x20fd8b=createListener(_0xe382('0x6')+_0x450a16,_0x39bd64);SmsQueueEvents['on'](_0x450a16,_0x20fd8b);}}; \ No newline at end of file +var _0x47a3=['remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0xf1ab8b,_0x5b72ea){var _0x55ac68=function(_0x2cd13a){while(--_0x2cd13a){_0xf1ab8b['push'](_0xf1ab8b['shift']());}};_0x55ac68(++_0x5b72ea);}(_0x47a3,0x1d2));var _0x347a=function(_0x11384d,_0x170997){_0x11384d=_0x11384d-0x0;var _0x3169f3=_0x47a3[_0x11384d];return _0x3169f3;};'use strict';var SmsQueueEvents=require(_0x347a('0x0'));var events=[_0x347a('0x1'),_0x347a('0x2'),_0x347a('0x3')];function createListener(_0x2535c9,_0x436165){return function(_0x2313ce){_0x436165[_0x347a('0x4')](_0x2535c9,_0x2313ce);};}function removeListener(_0x2f8605,_0x41428b){return function(){SmsQueueEvents[_0x347a('0x5')](_0x2f8605,_0x41428b);};}exports[_0x347a('0x6')]=function(_0x1ac892){for(var _0x337150=0x0,_0x19b400=events[_0x347a('0x7')];_0x337150<_0x19b400;_0x337150++){var _0x36dd97=events[_0x337150];var _0x18c6e8=createListener(_0x347a('0x8')+_0x36dd97,_0x1ac892);SmsQueueEvents['on'](_0x36dd97,_0x18c6e8);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 203b5e7..82066f0 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 _0x635c=['isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0xa141bb,_0x38c51c){var _0x554ed6=function(_0x2740bf){while(--_0x2740bf){_0xa141bb['push'](_0xa141bb['shift']());}};_0x554ed6(++_0x38c51c);}(_0x635c,0xa1));var _0xc635=function(_0x383576,_0xeab5ba){_0x383576=_0x383576-0x0;var _0x31fb1c=_0x635c[_0x383576];return _0x31fb1c;};'use strict';var multer=require('multer');var util=require(_0xc635('0x0'));var path=require(_0xc635('0x1'));var timeout=require(_0xc635('0x2'));var express=require(_0xc635('0x3'));var router=express['Router']();var fs_extra=require(_0xc635('0x4'));var auth=require(_0xc635('0x5'));var interaction=require(_0xc635('0x6'));var config=require(_0xc635('0x7'));var controller=require(_0xc635('0x8'));router[_0xc635('0x9')]('/',auth[_0xc635('0xa')](),controller['index']);router[_0xc635('0x9')](_0xc635('0xb'),auth[_0xc635('0xa')](),controller['describe']);router[_0xc635('0x9')](_0xc635('0xc'),auth[_0xc635('0xa')](),controller[_0xc635('0xd')]);router[_0xc635('0xe')]('/',auth[_0xc635('0xa')](),controller[_0xc635('0xf')]);router[_0xc635('0x10')](_0xc635('0xc'),auth[_0xc635('0xa')](),controller['update']);router[_0xc635('0x11')](_0xc635('0xc'),auth[_0xc635('0xa')](),controller[_0xc635('0x12')]);module['exports']=router; \ No newline at end of file +var _0xfd87=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post'];(function(_0x2c83fa,_0x1dde57){var _0x30b7f9=function(_0x5539cb){while(--_0x5539cb){_0x2c83fa['push'](_0x2c83fa['shift']());}};_0x30b7f9(++_0x1dde57);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router['get']('/',auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xc')]);router['get'](_0x7fd8('0xd'),auth[_0x7fd8('0xb')](),controller[_0x7fd8('0xe')]);router[_0x7fd8('0xf')](_0x7fd8('0x10'),auth['isAuthenticated'](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0x12')]('/',auth[_0x7fd8('0xb')](),controller['create']);router['put']('/:id',auth[_0x7fd8('0xb')](),controller['update']);router[_0x7fd8('0x13')](_0x7fd8('0x10'),auth[_0x7fd8('0xb')](),controller['destroy']);module[_0x7fd8('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 59b900c..04f9bc4 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 _0xc044=['STRING','DATE','moment','sequelize','exports'];(function(_0x3012c4,_0x510501){var _0x4e77bc=function(_0x1140e0){while(--_0x1140e0){_0x3012c4['push'](_0x3012c4['shift']());}};_0x4e77bc(++_0x510501);}(_0xc044,0xfc));var _0x4c04=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc044[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0x4c04('0x0'));var Sequelize=require(_0x4c04('0x1'));module[_0x4c04('0x2')]={'uniqueid':{'type':Sequelize[_0x4c04('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4c04('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4c04('0x4')]},'acceptAt':{'type':Sequelize[_0x4c04('0x4')]},'exitAt':{'type':Sequelize[_0x4c04('0x4')]},'reason':{'type':Sequelize[_0x4c04('0x3')]}}; \ No newline at end of file +var _0xcd88=['STRING','DATE','sequelize','exports'];(function(_0x59c662,_0x304509){var _0x20954c=function(_0x46467e){while(--_0x46467e){_0x59c662['push'](_0x59c662['shift']());}};_0x20954c(++_0x304509);}(_0xcd88,0x8e));var _0x8cd8=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0xcd88[_0x1ed116];return _0x574066;};'use strict';var moment=require('moment');var Sequelize=require(_0x8cd8('0x0'));module[_0x8cd8('0x1')]={'uniqueid':{'type':Sequelize[_0x8cd8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8cd8('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8cd8('0x3')]},'exitAt':{'type':Sequelize[_0x8cd8('0x3')]},'reason':{'type':Sequelize[_0x8cd8('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 1ffe4f8..8641d80 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 _0xe8df=['describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','save','update','then','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy'];(function(_0x263912,_0x3a9ab1){var _0x5ede9a=function(_0x5d87fc){while(--_0x5d87fc){_0x263912['push'](_0x263912['shift']());}};_0x5ede9a(++_0x3a9ab1);}(_0xe8df,0x164));var _0xfe8d=function(_0x1f86a7,_0x1bc8dd){_0x1f86a7=_0x1f86a7-0x0;var _0xee085b=_0xe8df[_0x1f86a7];return _0xee085b;};'use strict';var emlformat=require(_0xfe8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe8d('0x1'));var rp=require(_0xfe8d('0x2'));var moment=require(_0xfe8d('0x3'));var BPromise=require(_0xfe8d('0x4'));var Mustache=require(_0xfe8d('0x5'));var util=require(_0xfe8d('0x6'));var path=require(_0xfe8d('0x7'));var sox=require(_0xfe8d('0x8'));var csv=require(_0xfe8d('0x9'));var ejs=require(_0xfe8d('0xa'));var fs=require('fs');var fs_extra=require(_0xfe8d('0xb'));var _=require(_0xfe8d('0xc'));var squel=require(_0xfe8d('0xd'));var crypto=require(_0xfe8d('0xe'));var jsforce=require(_0xfe8d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfe8d('0x9'));var querystring=require('querystring');var Papa=require(_0xfe8d('0x10'));var Redis=require(_0xfe8d('0x11'));var authService=require(_0xfe8d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfe8d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe8d('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257822,_0x4e7aea){_0x4e7aea=_0x4e7aea||0xcc;return function(_0x5d0561){if(_0x5d0561){return _0x257822[_0xfe8d('0x15')](_0x4e7aea);}return _0x257822[_0xfe8d('0x16')](_0x4e7aea)[_0xfe8d('0x17')]();};}function respondWithResult(_0x17d47d,_0x2a7154){_0x2a7154=_0x2a7154||0xc8;return function(_0x422eee){if(_0x422eee){return _0x17d47d['status'](_0x2a7154)['json'](_0x422eee);}};}function respondWithFilteredResult(_0x686dd4,_0x39e197){return function(_0x54800d){if(_0x54800d){var _0x1ec392=typeof _0x39e197['offset']==='undefined'&&typeof _0x39e197[_0xfe8d('0x18')]===_0xfe8d('0x19');var _0x2b730d=_0x54800d[_0xfe8d('0x1a')];var _0x4dd454=_0x1ec392?0x0:_0x39e197[_0xfe8d('0x1b')];var _0x1e284b=_0x1ec392?_0x54800d['count']:_0x39e197[_0xfe8d('0x1b')]+_0x39e197[_0xfe8d('0x18')];var _0x5c8910;if(_0x1e284b>=_0x2b730d){_0x1e284b=_0x2b730d;_0x5c8910=0xc8;}else{_0x5c8910=0xce;}_0x686dd4[_0xfe8d('0x16')](_0x5c8910);return _0x686dd4[_0xfe8d('0x1c')]('Content-Range',_0x4dd454+'-'+_0x1e284b+'/'+_0x2b730d)[_0xfe8d('0x1d')](_0x54800d);}return null;};}function patchUpdates(_0x2ef946){return function(_0x4fca56){try{jsonpatch[_0xfe8d('0x1e')](_0x4fca56,_0x2ef946,!![]);}catch(_0x28b64a){return BPromise[_0xfe8d('0x1f')](_0x28b64a);}return _0x4fca56[_0xfe8d('0x20')]();};}function saveUpdates(_0x4510b0,_0x146c18){return function(_0x52b2ac){if(_0x52b2ac){return _0x52b2ac[_0xfe8d('0x21')](_0x4510b0)['then'](function(_0x31e80c){return _0x31e80c;});}return null;};}function removeEntity(_0x28b630,_0xff9cc0){return function(_0xc5e3fa){if(_0xc5e3fa){return _0xc5e3fa['destroy']()[_0xfe8d('0x22')](function(){_0x28b630[_0xfe8d('0x16')](0xcc)[_0xfe8d('0x17')]();});}};}function handleEntityNotFound(_0x170e85,_0x1a0ae1){return function(_0x5bd68b){if(!_0x5bd68b){_0x170e85['sendStatus'](0x194);}return _0x5bd68b;};}function handleError(_0x5da7c5,_0xbca76a){_0xbca76a=_0xbca76a||0x1f4;return function(_0x2c1b4d){logger[_0xfe8d('0x23')](_0x2c1b4d[_0xfe8d('0x24')]);if(_0x2c1b4d[_0xfe8d('0x25')]){delete _0x2c1b4d['name'];}_0x5da7c5[_0xfe8d('0x16')](_0xbca76a)[_0xfe8d('0x26')](_0x2c1b4d);};}exports[_0xfe8d('0x27')]=function(_0x424818,_0x28aa3e){var _0x3139c9={},_0x4e69a6={},_0x5b7e6={'count':0x0,'rows':[]};var _0xf1531c=_['map'](db[_0xfe8d('0x28')][_0xfe8d('0x29')],function(_0x292d78){return{'name':_0x292d78[_0xfe8d('0x2a')],'type':_0x292d78['type'][_0xfe8d('0x2b')]};});_0x4e69a6[_0xfe8d('0x2c')]=_[_0xfe8d('0x2d')](_0xf1531c,_0xfe8d('0x25'));_0x4e69a6[_0xfe8d('0x2e')]=_['keys'](_0x424818[_0xfe8d('0x2e')]);_0x4e69a6['filters']=_[_0xfe8d('0x2f')](_0x4e69a6[_0xfe8d('0x2c')],_0x4e69a6[_0xfe8d('0x2e')]);_0x3139c9[_0xfe8d('0x30')]=_['intersection'](_0x4e69a6[_0xfe8d('0x2c')],qs[_0xfe8d('0x31')](_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x31')]));_0x3139c9[_0xfe8d('0x30')]=_0x3139c9[_0xfe8d('0x30')]['length']?_0x3139c9[_0xfe8d('0x30')]:_0x4e69a6['model'];if(!_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x32')]('nolimit')){_0x3139c9['limit']=qs[_0xfe8d('0x18')](_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x18')]);_0x3139c9[_0xfe8d('0x1b')]=qs[_0xfe8d('0x1b')](_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x1b')]);}_0x3139c9['order']=qs[_0xfe8d('0x33')](_0x424818['query'][_0xfe8d('0x33')]);_0x3139c9['where']=qs['filters'](_['pick'](_0x424818['query'],_0x4e69a6[_0xfe8d('0x34')]),_0xf1531c);if(_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x35')]){_0x3139c9[_0xfe8d('0x36')]=_[_0xfe8d('0x37')](_0x3139c9[_0xfe8d('0x36')],{'$or':_[_0xfe8d('0x2d')](_0xf1531c,function(_0x57645d){if(_0x57645d['type']!==_0xfe8d('0x38')){var _0x5c2453={};_0x5c2453[_0x57645d[_0xfe8d('0x25')]]={'$like':'%'+_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x35')]+'%'};return _0x5c2453;}})});}_0x3139c9=_[_0xfe8d('0x37')]({},_0x3139c9,_0x424818[_0xfe8d('0x39')]);var _0xa68e9c={'where':_0x3139c9[_0xfe8d('0x36')]};return db[_0xfe8d('0x28')][_0xfe8d('0x1a')](_0xa68e9c)[_0xfe8d('0x22')](function(_0x188df7){_0x5b7e6[_0xfe8d('0x1a')]=_0x188df7;if(_0x424818[_0xfe8d('0x2e')][_0xfe8d('0x3a')]){_0x3139c9[_0xfe8d('0x3b')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xfe8d('0x3c')](_0x3139c9);})[_0xfe8d('0x22')](function(_0xf1b32){_0x5b7e6[_0xfe8d('0x3d')]=_0xf1b32;return _0x5b7e6;})['then'](respondWithFilteredResult(_0x28aa3e,_0x3139c9))[_0xfe8d('0x3e')](handleError(_0x28aa3e,null));};exports[_0xfe8d('0x3f')]=function(_0x55be40,_0x12e42f){var _0x4664ad={'raw':!![],'where':{'id':_0x55be40[_0xfe8d('0x40')]['id']}},_0x434a07={};_0x434a07[_0xfe8d('0x2c')]=_['keys'](db[_0xfe8d('0x28')][_0xfe8d('0x29')]);_0x434a07[_0xfe8d('0x2e')]=_['keys'](_0x55be40[_0xfe8d('0x2e')]);_0x434a07[_0xfe8d('0x34')]=_[_0xfe8d('0x2f')](_0x434a07[_0xfe8d('0x2c')],_0x434a07[_0xfe8d('0x2e')]);_0x4664ad[_0xfe8d('0x30')]=_[_0xfe8d('0x2f')](_0x434a07[_0xfe8d('0x2c')],qs['fields'](_0x55be40['query'][_0xfe8d('0x31')]));_0x4664ad[_0xfe8d('0x30')]=_0x4664ad[_0xfe8d('0x30')][_0xfe8d('0x41')]?_0x4664ad[_0xfe8d('0x30')]:_0x434a07[_0xfe8d('0x2c')];if(_0x55be40[_0xfe8d('0x2e')]['includeAll']){_0x4664ad[_0xfe8d('0x3b')]=[{'all':!![]}];}_0x4664ad=_['merge']({},_0x4664ad,_0x55be40[_0xfe8d('0x39')]);return db[_0xfe8d('0x28')][_0xfe8d('0x42')](_0x4664ad)[_0xfe8d('0x22')](handleEntityNotFound(_0x12e42f,null))[_0xfe8d('0x22')](respondWithResult(_0x12e42f,null))['catch'](handleError(_0x12e42f,null));};exports['create']=function(_0x72c0d1,_0x42493b){return db[_0xfe8d('0x28')][_0xfe8d('0x43')](_0x72c0d1[_0xfe8d('0x44')],{})[_0xfe8d('0x22')](respondWithResult(_0x42493b,0xc9))[_0xfe8d('0x3e')](handleError(_0x42493b,null));};exports[_0xfe8d('0x21')]=function(_0x37ebd3,_0x5c13d2){if(_0x37ebd3[_0xfe8d('0x44')]['id']){delete _0x37ebd3[_0xfe8d('0x44')]['id'];}return db['SmsQueueReport'][_0xfe8d('0x42')]({'where':{'id':_0x37ebd3['params']['id']}})['then'](handleEntityNotFound(_0x5c13d2,null))[_0xfe8d('0x22')](saveUpdates(_0x37ebd3[_0xfe8d('0x44')],null))[_0xfe8d('0x22')](respondWithResult(_0x5c13d2,null))['catch'](handleError(_0x5c13d2,null));};exports[_0xfe8d('0x45')]=function(_0x32b65f,_0x1a55b2){return db[_0xfe8d('0x28')][_0xfe8d('0x42')]({'where':{'id':_0x32b65f[_0xfe8d('0x40')]['id']}})[_0xfe8d('0x22')](handleEntityNotFound(_0x1a55b2,null))[_0xfe8d('0x22')](removeEntity(_0x1a55b2,null))['catch'](handleError(_0x1a55b2,null));};exports[_0xfe8d('0x46')]=function(_0x31554e,_0x1f395b){return db['SmsQueueReport']['describe']()['then'](respondWithResult(_0x1f395b,null))['catch'](handleError(_0x1f395b,null));}; \ No newline at end of file +var _0xef6b=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','SmsQueueReport','includeAll','include','findAll','rows','catch','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x1fb573,_0x334e3f){var _0xfc2cde=function(_0x44f790){while(--_0x44f790){_0x1fb573['push'](_0x1fb573['shift']());}};_0xfc2cde(++_0x334e3f);}(_0xef6b,0x1e2));var _0xbef6=function(_0x36d088,_0x516202){_0x36d088=_0x36d088-0x0;var _0x74107a=_0xef6b[_0x36d088];return _0x74107a;};'use strict';var emlformat=require(_0xbef6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbef6('0x1'));var jsonpatch=require(_0xbef6('0x2'));var rp=require(_0xbef6('0x3'));var moment=require(_0xbef6('0x4'));var BPromise=require(_0xbef6('0x5'));var Mustache=require(_0xbef6('0x6'));var util=require(_0xbef6('0x7'));var path=require(_0xbef6('0x8'));var sox=require(_0xbef6('0x9'));var csv=require(_0xbef6('0xa'));var ejs=require(_0xbef6('0xb'));var fs=require('fs');var fs_extra=require(_0xbef6('0xc'));var _=require(_0xbef6('0xd'));var squel=require(_0xbef6('0xe'));var crypto=require(_0xbef6('0xf'));var jsforce=require(_0xbef6('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbef6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbef6('0x12'));var qs=require(_0xbef6('0x13'));var as=require(_0xbef6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbef6('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbef6('0x16'));var db=require(_0xbef6('0x17'))['db'];function respondWithStatusCode(_0x16b3f6,_0x44db26){_0x44db26=_0x44db26||0xcc;return function(_0x4f20c9){if(_0x4f20c9){return _0x16b3f6[_0xbef6('0x18')](_0x44db26);}return _0x16b3f6[_0xbef6('0x19')](_0x44db26)[_0xbef6('0x1a')]();};}function respondWithResult(_0x2434b1,_0x523fe8){_0x523fe8=_0x523fe8||0xc8;return function(_0x2195c2){if(_0x2195c2){return _0x2434b1[_0xbef6('0x19')](_0x523fe8)['json'](_0x2195c2);}};}function respondWithFilteredResult(_0x402688,_0xc800d8){return function(_0x63c8f7){if(_0x63c8f7){var _0x299a34=typeof _0xc800d8[_0xbef6('0x1b')]==='undefined'&&typeof _0xc800d8[_0xbef6('0x1c')]==='undefined';var _0x2ba64b=_0x63c8f7[_0xbef6('0x1d')];var _0x24fcaa=_0x299a34?0x0:_0xc800d8[_0xbef6('0x1b')];var _0x22d5b6=_0x299a34?_0x63c8f7[_0xbef6('0x1d')]:_0xc800d8[_0xbef6('0x1b')]+_0xc800d8[_0xbef6('0x1c')];var _0x2a8c99;if(_0x22d5b6>=_0x2ba64b){_0x22d5b6=_0x2ba64b;_0x2a8c99=0xc8;}else{_0x2a8c99=0xce;}_0x402688['status'](_0x2a8c99);return _0x402688[_0xbef6('0x1e')](_0xbef6('0x1f'),_0x24fcaa+'-'+_0x22d5b6+'/'+_0x2ba64b)['json'](_0x63c8f7);}return null;};}function patchUpdates(_0xf20fb5){return function(_0x327492){try{jsonpatch[_0xbef6('0x20')](_0x327492,_0xf20fb5,!![]);}catch(_0x1e394a){return BPromise['reject'](_0x1e394a);}return _0x327492[_0xbef6('0x21')]();};}function saveUpdates(_0x4e8dea,_0x36a9e1){return function(_0x5886aa){if(_0x5886aa){return _0x5886aa['update'](_0x4e8dea)['then'](function(_0x392db6){return _0x392db6;});}return null;};}function removeEntity(_0x102916,_0x3f14e9){return function(_0x348b4d){if(_0x348b4d){return _0x348b4d[_0xbef6('0x22')]()[_0xbef6('0x23')](function(){_0x102916['status'](0xcc)[_0xbef6('0x1a')]();});}};}function handleEntityNotFound(_0x3a64bc,_0x35be1b){return function(_0x1dbca0){if(!_0x1dbca0){_0x3a64bc[_0xbef6('0x18')](0x194);}return _0x1dbca0;};}function handleError(_0x3f57a0,_0x2e630e){_0x2e630e=_0x2e630e||0x1f4;return function(_0x224d0e){logger[_0xbef6('0x24')](_0x224d0e[_0xbef6('0x25')]);if(_0x224d0e['name']){delete _0x224d0e[_0xbef6('0x26')];}_0x3f57a0[_0xbef6('0x19')](_0x2e630e)['send'](_0x224d0e);};}exports[_0xbef6('0x27')]=function(_0x42c4cb,_0x461c03){var _0x3223c7={},_0x5d1052={},_0x122253={'count':0x0,'rows':[]};var _0x3ab549=_['map'](db['SmsQueueReport'][_0xbef6('0x28')],function(_0x58f3fb){return{'name':_0x58f3fb[_0xbef6('0x29')],'type':_0x58f3fb[_0xbef6('0x2a')]['key']};});_0x5d1052[_0xbef6('0x2b')]=_[_0xbef6('0x2c')](_0x3ab549,'name');_0x5d1052[_0xbef6('0x2d')]=_[_0xbef6('0x2e')](_0x42c4cb['query']);_0x5d1052[_0xbef6('0x2f')]=_[_0xbef6('0x30')](_0x5d1052[_0xbef6('0x2b')],_0x5d1052[_0xbef6('0x2d')]);_0x3223c7[_0xbef6('0x31')]=_[_0xbef6('0x30')](_0x5d1052[_0xbef6('0x2b')],qs[_0xbef6('0x32')](_0x42c4cb[_0xbef6('0x2d')][_0xbef6('0x32')]));_0x3223c7[_0xbef6('0x31')]=_0x3223c7['attributes'][_0xbef6('0x33')]?_0x3223c7[_0xbef6('0x31')]:_0x5d1052[_0xbef6('0x2b')];if(!_0x42c4cb[_0xbef6('0x2d')][_0xbef6('0x34')](_0xbef6('0x35'))){_0x3223c7['limit']=qs[_0xbef6('0x1c')](_0x42c4cb['query'][_0xbef6('0x1c')]);_0x3223c7[_0xbef6('0x1b')]=qs[_0xbef6('0x1b')](_0x42c4cb[_0xbef6('0x2d')][_0xbef6('0x1b')]);}_0x3223c7[_0xbef6('0x36')]=qs[_0xbef6('0x37')](_0x42c4cb[_0xbef6('0x2d')]['sort']);_0x3223c7['where']=qs[_0xbef6('0x2f')](_[_0xbef6('0x38')](_0x42c4cb[_0xbef6('0x2d')],_0x5d1052[_0xbef6('0x2f')]),_0x3ab549);if(_0x42c4cb[_0xbef6('0x2d')][_0xbef6('0x39')]){_0x3223c7['where']=_['merge'](_0x3223c7['where'],{'$or':_[_0xbef6('0x2c')](_0x3ab549,function(_0x3e65d6){if(_0x3e65d6['type']!=='VIRTUAL'){var _0x53e3f7={};_0x53e3f7[_0x3e65d6[_0xbef6('0x26')]]={'$like':'%'+_0x42c4cb['query']['filter']+'%'};return _0x53e3f7;}})});}_0x3223c7=_[_0xbef6('0x3a')]({},_0x3223c7,_0x42c4cb[_0xbef6('0x3b')]);var _0x5d701d={'where':_0x3223c7[_0xbef6('0x3c')]};return db[_0xbef6('0x3d')]['count'](_0x5d701d)['then'](function(_0x4b4b6d){_0x122253[_0xbef6('0x1d')]=_0x4b4b6d;if(_0x42c4cb['query'][_0xbef6('0x3e')]){_0x3223c7[_0xbef6('0x3f')]=[{'all':!![]}];}return db[_0xbef6('0x3d')][_0xbef6('0x40')](_0x3223c7);})[_0xbef6('0x23')](function(_0x2113cf){_0x122253[_0xbef6('0x41')]=_0x2113cf;return _0x122253;})[_0xbef6('0x23')](respondWithFilteredResult(_0x461c03,_0x3223c7))[_0xbef6('0x42')](handleError(_0x461c03,null));};exports['show']=function(_0x2d465b,_0x8f2dfc){var _0x40b2e9={'raw':!![],'where':{'id':_0x2d465b['params']['id']}},_0x25196={};_0x25196[_0xbef6('0x2b')]=_[_0xbef6('0x2e')](db['SmsQueueReport'][_0xbef6('0x28')]);_0x25196[_0xbef6('0x2d')]=_[_0xbef6('0x2e')](_0x2d465b[_0xbef6('0x2d')]);_0x25196['filters']=_['intersection'](_0x25196['model'],_0x25196['query']);_0x40b2e9[_0xbef6('0x31')]=_['intersection'](_0x25196['model'],qs[_0xbef6('0x32')](_0x2d465b['query'][_0xbef6('0x32')]));_0x40b2e9[_0xbef6('0x31')]=_0x40b2e9[_0xbef6('0x31')][_0xbef6('0x33')]?_0x40b2e9[_0xbef6('0x31')]:_0x25196[_0xbef6('0x2b')];if(_0x2d465b[_0xbef6('0x2d')]['includeAll']){_0x40b2e9[_0xbef6('0x3f')]=[{'all':!![]}];}_0x40b2e9=_[_0xbef6('0x3a')]({},_0x40b2e9,_0x2d465b[_0xbef6('0x3b')]);return db[_0xbef6('0x3d')][_0xbef6('0x43')](_0x40b2e9)['then'](handleEntityNotFound(_0x8f2dfc,null))['then'](respondWithResult(_0x8f2dfc,null))[_0xbef6('0x42')](handleError(_0x8f2dfc,null));};exports[_0xbef6('0x44')]=function(_0x22417b,_0x2fed10){return db[_0xbef6('0x3d')][_0xbef6('0x44')](_0x22417b[_0xbef6('0x45')],{})[_0xbef6('0x23')](respondWithResult(_0x2fed10,0xc9))[_0xbef6('0x42')](handleError(_0x2fed10,null));};exports['update']=function(_0x28799c,_0x530393){if(_0x28799c['body']['id']){delete _0x28799c[_0xbef6('0x45')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x28799c[_0xbef6('0x46')]['id']}})[_0xbef6('0x23')](handleEntityNotFound(_0x530393,null))[_0xbef6('0x23')](saveUpdates(_0x28799c['body'],null))[_0xbef6('0x23')](respondWithResult(_0x530393,null))['catch'](handleError(_0x530393,null));};exports[_0xbef6('0x22')]=function(_0x3acc89,_0x44e8d2){return db[_0xbef6('0x3d')]['find']({'where':{'id':_0x3acc89[_0xbef6('0x46')]['id']}})[_0xbef6('0x23')](handleEntityNotFound(_0x44e8d2,null))[_0xbef6('0x23')](removeEntity(_0x44e8d2,null))['catch'](handleError(_0x44e8d2,null));};exports[_0xbef6('0x47')]=function(_0x3847c8,_0x38de5a){return db[_0xbef6('0x3d')]['describe']()[_0xbef6('0x23')](respondWithResult(_0x38de5a,null))[_0xbef6('0x42')](handleError(_0x38de5a,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 21e57a6..1b9a3e2 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xe706,0xa3));var _0x6e70=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0xe706[_0x11f0e3];return _0x2892e8;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x52d905,_0x22187b){var _0x1b7ba5=function(_0x13a82f){while(--_0x13a82f){_0x52d905['push'](_0x52d905['shift']());}};_0x1b7ba5(++_0x22187b);}(_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 8a2880c..8fd6091 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 _0x1081=['UpdateSmsQueueReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','options','raw'];(function(_0x26a426,_0xafe10a){var _0x2cea04=function(_0x11a53a){while(--_0x11a53a){_0x26a426['push'](_0x26a426['shift']());}};_0x2cea04(++_0xafe10a);}(_0x1081,0x16f));var _0x1108=function(_0x5869d6,_0x56823d){_0x5869d6=_0x5869d6-0x0;var _0x574e47=_0x1081[_0x5869d6];return _0x574e47;};'use strict';var _=require(_0x1108('0x0'));var util=require('util');var moment=require(_0x1108('0x1'));var BPromise=require('bluebird');var rs=require(_0x1108('0x2'));var fs=require('fs');var Redis=require(_0x1108('0x3'));var db=require(_0x1108('0x4'))['db'];var utils=require(_0x1108('0x5'));var logger=require(_0x1108('0x6'))(_0x1108('0x7'));var config=require(_0x1108('0x8'));var jayson=require(_0x1108('0x9'));var client=jayson[_0x1108('0xa')][_0x1108('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2faa1d,_0x45d217,_0x5497ff){return new BPromise(function(_0x5e9459,_0x18eee7){return client[_0x1108('0xc')](_0x2faa1d,_0x5497ff)[_0x1108('0xd')](function(_0x3602fa){logger[_0x1108('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x45d217,_0x1108('0xf'));logger[_0x1108('0x10')](_0x1108('0x11'),_0x45d217,'request\x20sent',JSON[_0x1108('0x12')](_0x3602fa));if(_0x3602fa[_0x1108('0x13')]){if(_0x3602fa[_0x1108('0x13')][_0x1108('0x14')]===0x1f4){logger[_0x1108('0x13')](_0x1108('0x15'),_0x45d217,_0x3602fa['error']['message']);return _0x18eee7(_0x3602fa['error'][_0x1108('0x16')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x45d217,_0x3602fa[_0x1108('0x13')][_0x1108('0x16')]);return _0x5e9459(_0x3602fa[_0x1108('0x13')]['message']);}else{logger['info'](_0x1108('0x15'),_0x45d217,'request\x20sent');_0x5e9459(_0x3602fa[_0x1108('0x17')][_0x1108('0x16')]);}})[_0x1108('0x18')](function(_0xc02512){logger[_0x1108('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x45d217,_0xc02512);_0x18eee7(_0xc02512);});});}exports[_0x1108('0x19')]=function(_0xdb78ec){var _0x397b31=this;return new Promise(function(_0x2059f0,_0x53f0d9){return db[_0x1108('0x1a')]['create'](_0xdb78ec['body'],{'raw':_0xdb78ec[_0x1108('0x1b')]?_0xdb78ec['options'][_0x1108('0x1c')]===undefined?!![]:![]:!![]})[_0x1108('0xd')](function(_0x497a6d){logger[_0x1108('0xe')](_0x1108('0x19'),_0xdb78ec);logger[_0x1108('0x10')](_0x1108('0x19'),_0xdb78ec,JSON[_0x1108('0x12')](_0x497a6d));_0x2059f0(_0x497a6d);})[_0x1108('0x18')](function(_0x12a7ce){logger[_0x1108('0x13')]('CreateSmsQueueReport',_0x12a7ce[_0x1108('0x16')],_0xdb78ec);_0x53f0d9(_0x397b31[_0x1108('0x13')](0x1f4,_0x12a7ce['message']));});});};exports[_0x1108('0x1d')]=function(_0x4135ad){var _0x271e07=this;return new Promise(function(_0xffff7a,_0x5c43da){return db[_0x1108('0x1a')][_0x1108('0x1e')](_0x4135ad['body'],{'raw':_0x4135ad[_0x1108('0x1b')]?_0x4135ad[_0x1108('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4135ad[_0x1108('0x1b')]?_0x4135ad[_0x1108('0x1b')][_0x1108('0x1f')]||null:null,'attributes':_0x4135ad['options']?_0x4135ad[_0x1108('0x1b')][_0x1108('0x20')]||null:null,'limit':_0x4135ad[_0x1108('0x1b')]?_0x4135ad['options']['limit']||null:null})[_0x1108('0xd')](function(_0x5f0c28){logger['info'](_0x1108('0x1d'),_0x4135ad);logger[_0x1108('0x10')]('UpdateSmsQueueReport',_0x4135ad,JSON[_0x1108('0x12')](_0x5f0c28));_0xffff7a(_0x5f0c28);})[_0x1108('0x18')](function(_0x2d2b44){logger[_0x1108('0x13')](_0x1108('0x1d'),_0x2d2b44[_0x1108('0x16')],_0x4135ad);_0x5c43da(_0x271e07[_0x1108('0x13')](0x1f4,_0x2d2b44[_0x1108('0x16')]));});});}; \ No newline at end of file +var _0x15c9=['request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','where','limit','stringify','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1a9a25,_0x5ec04b){var _0x21c048=function(_0x5d22de){while(--_0x5d22de){_0x1a9a25['push'](_0x1a9a25['shift']());}};_0x21c048(++_0x5ec04b);}(_0x15c9,0xf6));var _0x915c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x15c9[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x915c('0x0'));var util=require(_0x915c('0x1'));var moment=require('moment');var BPromise=require(_0x915c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x915c('0x3'))['db'];var utils=require(_0x915c('0x4'));var logger=require(_0x915c('0x5'))(_0x915c('0x6'));var config=require(_0x915c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x915c('0x8')][_0x915c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41dc29,_0x1c73ac,_0xc813b4){return new BPromise(function(_0x41b9a0,_0x172b1b){return client[_0x915c('0xa')](_0x41dc29,_0xc813b4)[_0x915c('0xb')](function(_0x5f3c12){logger['info'](_0x915c('0xc'),_0x1c73ac,_0x915c('0xd'));logger['debug'](_0x915c('0xe'),_0x1c73ac,_0x915c('0xd'),JSON['stringify'](_0x5f3c12));if(_0x5f3c12['error']){if(_0x5f3c12[_0x915c('0xf')][_0x915c('0x10')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x1c73ac,_0x5f3c12[_0x915c('0xf')]['message']);return _0x172b1b(_0x5f3c12[_0x915c('0xf')][_0x915c('0x11')]);}logger[_0x915c('0xf')](_0x915c('0xc'),_0x1c73ac,_0x5f3c12[_0x915c('0xf')][_0x915c('0x11')]);return _0x41b9a0(_0x5f3c12[_0x915c('0xf')][_0x915c('0x11')]);}else{logger[_0x915c('0x12')](_0x915c('0xc'),_0x1c73ac,_0x915c('0xd'));_0x41b9a0(_0x5f3c12[_0x915c('0x13')]['message']);}})[_0x915c('0x14')](function(_0xa7f643){logger['error'](_0x915c('0xc'),_0x1c73ac,_0xa7f643);_0x172b1b(_0xa7f643);});});}exports[_0x915c('0x15')]=function(_0x4a0466){var _0x2bb064=this;return new Promise(function(_0x5870bb,_0x3a11a2){return db[_0x915c('0x16')][_0x915c('0x17')](_0x4a0466[_0x915c('0x18')],{'raw':_0x4a0466[_0x915c('0x19')]?_0x4a0466[_0x915c('0x19')][_0x915c('0x1a')]===undefined?!![]:![]:!![]})[_0x915c('0xb')](function(_0x1ce601){logger[_0x915c('0x12')](_0x915c('0x15'),_0x4a0466);logger[_0x915c('0x1b')]('CreateSmsQueueReport',_0x4a0466,JSON['stringify'](_0x1ce601));_0x5870bb(_0x1ce601);})[_0x915c('0x14')](function(_0x315b75){logger[_0x915c('0xf')](_0x915c('0x15'),_0x315b75[_0x915c('0x11')],_0x4a0466);_0x3a11a2(_0x2bb064['error'](0x1f4,_0x315b75[_0x915c('0x11')]));});});};exports[_0x915c('0x1c')]=function(_0x244cc0){var _0x1ff35a=this;return new Promise(function(_0x8ee623,_0x4bcbc2){return db['SmsQueueReport']['update'](_0x244cc0[_0x915c('0x18')],{'raw':_0x244cc0['options']?_0x244cc0['options'][_0x915c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244cc0[_0x915c('0x19')]?_0x244cc0[_0x915c('0x19')][_0x915c('0x1d')]||null:null,'attributes':_0x244cc0[_0x915c('0x19')]?_0x244cc0[_0x915c('0x19')]['attributes']||null:null,'limit':_0x244cc0['options']?_0x244cc0[_0x915c('0x19')][_0x915c('0x1e')]||null:null})[_0x915c('0xb')](function(_0x32c4f4){logger['info']('UpdateSmsQueueReport',_0x244cc0);logger['debug'](_0x915c('0x1c'),_0x244cc0,JSON[_0x915c('0x1f')](_0x32c4f4));_0x8ee623(_0x32c4f4);})['catch'](function(_0xae2617){logger[_0x915c('0xf')](_0x915c('0x1c'),_0xae2617[_0x915c('0x11')],_0x244cc0);_0x4bcbc2(_0x1ff35a['error'](0x1f4,_0xae2617[_0x915c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index fee7149..5cdf35b 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 _0x1dcc=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0xc70a3d,_0x4ccfa4){_0xc70a3d=_0xc70a3d-0x0;var _0x16bf8d=_0x1dcc[_0xc70a3d];return _0x16bf8d;};'use strict';var multer=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var path=require(_0xc1dc('0x2'));var timeout=require(_0xc1dc('0x3'));var express=require('express');var router=express[_0xc1dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc1dc('0x5'));var interaction=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x9')]);router[_0xc1dc('0xa')]('/describe',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xb')]);router['get'](_0xc1dc('0xc'),auth['isAuthenticated'](),controller[_0xc1dc('0xd')]);router['post']('/',auth[_0xc1dc('0x8')](),controller[_0xc1dc('0xe')]);router[_0xc1dc('0xf')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller[_0xc1dc('0x10')]);router[_0xc1dc('0x11')](_0xc1dc('0xc'),auth[_0xc1dc('0x8')](),controller['destroy']);module[_0xc1dc('0x12')]=router; \ No newline at end of file +var _0x1224=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x857d84,_0x1ddc97){var _0x551230=function(_0x2c6524){while(--_0x2c6524){_0x857d84['push'](_0x857d84['shift']());}};_0x551230(++_0x1ddc97);}(_0x1224,0x10d));var _0x4122=function(_0x1e9707,_0x13dcf1){_0x1e9707=_0x1e9707-0x0;var _0x5df14a=_0x1224[_0x1e9707];return _0x5df14a;};'use strict';var multer=require(_0x4122('0x0'));var util=require(_0x4122('0x1'));var path=require(_0x4122('0x2'));var timeout=require(_0x4122('0x3'));var express=require(_0x4122('0x4'));var router=express[_0x4122('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4122('0x6'));var interaction=require(_0x4122('0x7'));var config=require(_0x4122('0x8'));var controller=require('./smsTransferReport.controller');router[_0x4122('0x9')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0xb')]);router[_0x4122('0x9')](_0x4122('0xc'),auth[_0x4122('0xa')](),controller[_0x4122('0xd')]);router[_0x4122('0x9')](_0x4122('0xe'),auth[_0x4122('0xa')](),controller[_0x4122('0xf')]);router[_0x4122('0x10')]('/',auth[_0x4122('0xa')](),controller[_0x4122('0x11')]);router[_0x4122('0x12')](_0x4122('0xe'),auth[_0x4122('0xa')](),controller[_0x4122('0x13')]);router[_0x4122('0x14')](_0x4122('0xe'),auth[_0x4122('0xa')](),controller[_0x4122('0x15')]);module[_0x4122('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3525701..b1f34c1 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x59e225,_0x190985){var _0x5dc34b=function(_0x4d0399){while(--_0x4d0399){_0x59e225['push'](_0x59e225['shift']());}};_0x5dc34b(++_0x190985);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2b9ae3,_0xd6d709){var _0x4e18a2=function(_0x397406){while(--_0x397406){_0x2b9ae3['push'](_0x2b9ae3['shift']());}};_0x4e18a2(++_0xd6d709);}(_0x34e8,0x12c));var _0x834e=function(_0x1790d2,_0x42c1fc){_0x1790d2=_0x1790d2-0x0;var _0x41f54c=_0x34e8[_0x1790d2];return _0x41f54c;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 69c67c1..3ef5eda 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 _0x9b3a=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3c4cf2,_0x4ead03){var _0x2adf57=function(_0x5bb8a0){while(--_0x5bb8a0){_0x3c4cf2['push'](_0x3c4cf2['shift']());}};_0x2adf57(++_0x4ead03);}(_0x9b3a,0x12a));var _0xa9b3=function(_0x18eaea,_0x2b8e15){_0x18eaea=_0x18eaea-0x0;var _0x4e10da=_0x9b3a[_0x18eaea];return _0x4e10da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9b3('0x0'));var zipdir=require(_0xa9b3('0x1'));var jsonpatch=require(_0xa9b3('0x2'));var rp=require(_0xa9b3('0x3'));var moment=require(_0xa9b3('0x4'));var BPromise=require(_0xa9b3('0x5'));var Mustache=require(_0xa9b3('0x6'));var util=require(_0xa9b3('0x7'));var path=require(_0xa9b3('0x8'));var sox=require(_0xa9b3('0x9'));var csv=require(_0xa9b3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9b3('0xb'));var _=require(_0xa9b3('0xc'));var squel=require(_0xa9b3('0xd'));var crypto=require(_0xa9b3('0xe'));var jsforce=require(_0xa9b3('0xf'));var deskjs=require(_0xa9b3('0x10'));var toCsv=require(_0xa9b3('0xa'));var querystring=require(_0xa9b3('0x11'));var Papa=require('papaparse');var Redis=require(_0xa9b3('0x12'));var authService=require(_0xa9b3('0x13'));var qs=require(_0xa9b3('0x14'));var as=require(_0xa9b3('0x15'));var hardwareService=require(_0xa9b3('0x16'));var logger=require('../../config/logger')(_0xa9b3('0x17'));var utils=require('../../config/utils');var config=require(_0xa9b3('0x18'));var licenseUtil=require(_0xa9b3('0x19'));var db=require(_0xa9b3('0x1a'))['db'];function respondWithStatusCode(_0x11d3b8,_0x26ee04){_0x26ee04=_0x26ee04||0xcc;return function(_0x4539ae){if(_0x4539ae){return _0x11d3b8[_0xa9b3('0x1b')](_0x26ee04);}return _0x11d3b8[_0xa9b3('0x1c')](_0x26ee04)[_0xa9b3('0x1d')]();};}function respondWithResult(_0x19782e,_0xe98094){_0xe98094=_0xe98094||0xc8;return function(_0x16a601){if(_0x16a601){return _0x19782e[_0xa9b3('0x1c')](_0xe98094)[_0xa9b3('0x1e')](_0x16a601);}};}function respondWithFilteredResult(_0x43e2dd,_0x442581){return function(_0x5c0621){if(_0x5c0621){var _0x5521d3=typeof _0x442581[_0xa9b3('0x1f')]===_0xa9b3('0x20')&&typeof _0x442581['limit']==='undefined';var _0x23d1e9=_0x5c0621['count'];var _0x3e4b5c=_0x5521d3?0x0:_0x442581[_0xa9b3('0x1f')];var _0x976fcb=_0x5521d3?_0x5c0621[_0xa9b3('0x21')]:_0x442581[_0xa9b3('0x1f')]+_0x442581[_0xa9b3('0x22')];var _0x18b1ba;if(_0x976fcb>=_0x23d1e9){_0x976fcb=_0x23d1e9;_0x18b1ba=0xc8;}else{_0x18b1ba=0xce;}_0x43e2dd[_0xa9b3('0x1c')](_0x18b1ba);return _0x43e2dd['set'](_0xa9b3('0x23'),_0x3e4b5c+'-'+_0x976fcb+'/'+_0x23d1e9)[_0xa9b3('0x1e')](_0x5c0621);}return null;};}function patchUpdates(_0x391927){return function(_0x29455a){try{jsonpatch['apply'](_0x29455a,_0x391927,!![]);}catch(_0x440953){return BPromise[_0xa9b3('0x24')](_0x440953);}return _0x29455a[_0xa9b3('0x25')]();};}function saveUpdates(_0x471895,_0x57a448){return function(_0x1354f5){if(_0x1354f5){return _0x1354f5[_0xa9b3('0x26')](_0x471895)[_0xa9b3('0x27')](function(_0x5749eb){return _0x5749eb;});}return null;};}function removeEntity(_0x4fa570,_0x528653){return function(_0x3a292a){if(_0x3a292a){return _0x3a292a[_0xa9b3('0x28')]()[_0xa9b3('0x27')](function(){_0x4fa570['status'](0xcc)[_0xa9b3('0x1d')]();});}};}function handleEntityNotFound(_0x422608,_0x155caa){return function(_0x5ac96b){if(!_0x5ac96b){_0x422608['sendStatus'](0x194);}return _0x5ac96b;};}function handleError(_0x347f3f,_0x288a27){_0x288a27=_0x288a27||0x1f4;return function(_0x37b5a9){logger[_0xa9b3('0x29')](_0x37b5a9['stack']);if(_0x37b5a9[_0xa9b3('0x2a')]){delete _0x37b5a9[_0xa9b3('0x2a')];}_0x347f3f[_0xa9b3('0x1c')](_0x288a27)[_0xa9b3('0x2b')](_0x37b5a9);};}exports[_0xa9b3('0x2c')]=function(_0x3d282b,_0x4a19de){var _0x1c111a={},_0x3c55b2={},_0x8ee7dc={'count':0x0,'rows':[]};var _0x2388fa=_['map'](db[_0xa9b3('0x2d')][_0xa9b3('0x2e')],function(_0x30c9b6){return{'name':_0x30c9b6[_0xa9b3('0x2f')],'type':_0x30c9b6[_0xa9b3('0x30')][_0xa9b3('0x31')]};});_0x3c55b2[_0xa9b3('0x32')]=_[_0xa9b3('0x33')](_0x2388fa,'name');_0x3c55b2[_0xa9b3('0x34')]=_['keys'](_0x3d282b[_0xa9b3('0x34')]);_0x3c55b2[_0xa9b3('0x35')]=_[_0xa9b3('0x36')](_0x3c55b2[_0xa9b3('0x32')],_0x3c55b2[_0xa9b3('0x34')]);_0x1c111a[_0xa9b3('0x37')]=_['intersection'](_0x3c55b2['model'],qs[_0xa9b3('0x38')](_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x38')]));_0x1c111a[_0xa9b3('0x37')]=_0x1c111a[_0xa9b3('0x37')][_0xa9b3('0x39')]?_0x1c111a[_0xa9b3('0x37')]:_0x3c55b2[_0xa9b3('0x32')];if(!_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x3a')](_0xa9b3('0x3b'))){_0x1c111a[_0xa9b3('0x22')]=qs[_0xa9b3('0x22')](_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x22')]);_0x1c111a[_0xa9b3('0x1f')]=qs[_0xa9b3('0x1f')](_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x1f')]);}_0x1c111a[_0xa9b3('0x3c')]=qs[_0xa9b3('0x3d')](_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x3d')]);_0x1c111a[_0xa9b3('0x3e')]=qs[_0xa9b3('0x35')](_['pick'](_0x3d282b[_0xa9b3('0x34')],_0x3c55b2[_0xa9b3('0x35')]),_0x2388fa);if(_0x3d282b[_0xa9b3('0x34')][_0xa9b3('0x3f')]){_0x1c111a[_0xa9b3('0x3e')]=_[_0xa9b3('0x40')](_0x1c111a['where'],{'$or':_[_0xa9b3('0x33')](_0x2388fa,function(_0x29fe6f){if(_0x29fe6f[_0xa9b3('0x30')]!==_0xa9b3('0x41')){var _0x1727a0={};_0x1727a0[_0x29fe6f[_0xa9b3('0x2a')]]={'$like':'%'+_0x3d282b['query'][_0xa9b3('0x3f')]+'%'};return _0x1727a0;}})});}_0x1c111a=_[_0xa9b3('0x40')]({},_0x1c111a,_0x3d282b[_0xa9b3('0x42')]);var _0x32ea17={'where':_0x1c111a[_0xa9b3('0x3e')]};return db[_0xa9b3('0x2d')]['count'](_0x32ea17)[_0xa9b3('0x27')](function(_0x5b3eb6){_0x8ee7dc[_0xa9b3('0x21')]=_0x5b3eb6;if(_0x3d282b['query'][_0xa9b3('0x43')]){_0x1c111a[_0xa9b3('0x44')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x1c111a);})['then'](function(_0xf8b7ce){_0x8ee7dc[_0xa9b3('0x45')]=_0xf8b7ce;return _0x8ee7dc;})[_0xa9b3('0x27')](respondWithFilteredResult(_0x4a19de,_0x1c111a))[_0xa9b3('0x46')](handleError(_0x4a19de,null));};exports['show']=function(_0x68c69b,_0x28cfcb){var _0xc1ffcd={'raw':!![],'where':{'id':_0x68c69b[_0xa9b3('0x47')]['id']}},_0x1758e4={};_0x1758e4['model']=_[_0xa9b3('0x48')](db[_0xa9b3('0x2d')][_0xa9b3('0x2e')]);_0x1758e4[_0xa9b3('0x34')]=_[_0xa9b3('0x48')](_0x68c69b[_0xa9b3('0x34')]);_0x1758e4[_0xa9b3('0x35')]=_[_0xa9b3('0x36')](_0x1758e4[_0xa9b3('0x32')],_0x1758e4[_0xa9b3('0x34')]);_0xc1ffcd[_0xa9b3('0x37')]=_[_0xa9b3('0x36')](_0x1758e4[_0xa9b3('0x32')],qs['fields'](_0x68c69b[_0xa9b3('0x34')]['fields']));_0xc1ffcd[_0xa9b3('0x37')]=_0xc1ffcd['attributes']['length']?_0xc1ffcd[_0xa9b3('0x37')]:_0x1758e4['model'];if(_0x68c69b[_0xa9b3('0x34')][_0xa9b3('0x43')]){_0xc1ffcd[_0xa9b3('0x44')]=[{'all':!![]}];}_0xc1ffcd=_['merge']({},_0xc1ffcd,_0x68c69b[_0xa9b3('0x42')]);return db[_0xa9b3('0x2d')][_0xa9b3('0x49')](_0xc1ffcd)[_0xa9b3('0x27')](handleEntityNotFound(_0x28cfcb,null))['then'](respondWithResult(_0x28cfcb,null))[_0xa9b3('0x46')](handleError(_0x28cfcb,null));};exports[_0xa9b3('0x4a')]=function(_0x384329,_0x4656f2){return db[_0xa9b3('0x2d')][_0xa9b3('0x4a')](_0x384329[_0xa9b3('0x4b')],{})['then'](respondWithResult(_0x4656f2,0xc9))[_0xa9b3('0x46')](handleError(_0x4656f2,null));};exports[_0xa9b3('0x26')]=function(_0x3b582e,_0x516326){if(_0x3b582e[_0xa9b3('0x4b')]['id']){delete _0x3b582e[_0xa9b3('0x4b')]['id'];}return db[_0xa9b3('0x2d')][_0xa9b3('0x49')]({'where':{'id':_0x3b582e[_0xa9b3('0x47')]['id']}})[_0xa9b3('0x27')](handleEntityNotFound(_0x516326,null))['then'](saveUpdates(_0x3b582e[_0xa9b3('0x4b')],null))[_0xa9b3('0x27')](respondWithResult(_0x516326,null))['catch'](handleError(_0x516326,null));};exports['destroy']=function(_0x13b4fc,_0x4553ab){return db['SmsTransferReport'][_0xa9b3('0x49')]({'where':{'id':_0x13b4fc[_0xa9b3('0x47')]['id']}})['then'](handleEntityNotFound(_0x4553ab,null))[_0xa9b3('0x27')](removeEntity(_0x4553ab,null))[_0xa9b3('0x46')](handleError(_0x4553ab,null));};exports[_0xa9b3('0x4c')]=function(_0x1ea0eb,_0x269667){return db[_0xa9b3('0x2d')][_0xa9b3('0x4c')]()[_0xa9b3('0x27')](respondWithResult(_0x269667,null))[_0xa9b3('0x46')](handleError(_0x269667,null));}; \ No newline at end of file +var _0x74a6=['save','update','destroy','then','end','sendStatus','stack','send','index','map','SmsTransferReport','rawAttributes','type','key','name','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','count','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74a6,0x115));var _0x674a=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x74a6[_0x245afe];return _0x4eefde;};'use strict';var emlformat=require(_0x674a('0x0'));var rimraf=require(_0x674a('0x1'));var zipdir=require(_0x674a('0x2'));var jsonpatch=require(_0x674a('0x3'));var rp=require(_0x674a('0x4'));var moment=require(_0x674a('0x5'));var BPromise=require(_0x674a('0x6'));var Mustache=require(_0x674a('0x7'));var util=require(_0x674a('0x8'));var path=require('path');var sox=require(_0x674a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x674a('0xa'));var squel=require(_0x674a('0xb'));var crypto=require('crypto');var jsforce=require(_0x674a('0xc'));var deskjs=require(_0x674a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x674a('0xe'));var Papa=require('papaparse');var Redis=require(_0x674a('0xf'));var authService=require(_0x674a('0x10'));var qs=require(_0x674a('0x11'));var as=require(_0x674a('0x12'));var hardwareService=require(_0x674a('0x13'));var logger=require(_0x674a('0x14'))(_0x674a('0x15'));var utils=require(_0x674a('0x16'));var config=require(_0x674a('0x17'));var licenseUtil=require(_0x674a('0x18'));var db=require(_0x674a('0x19'))['db'];function respondWithStatusCode(_0x3231b5,_0x4dff16){_0x4dff16=_0x4dff16||0xcc;return function(_0x4d4606){if(_0x4d4606){return _0x3231b5['sendStatus'](_0x4dff16);}return _0x3231b5[_0x674a('0x1a')](_0x4dff16)['end']();};}function respondWithResult(_0x49f857,_0x48d4b2){_0x48d4b2=_0x48d4b2||0xc8;return function(_0x1087d9){if(_0x1087d9){return _0x49f857['status'](_0x48d4b2)[_0x674a('0x1b')](_0x1087d9);}};}function respondWithFilteredResult(_0x49396d,_0x51c61e){return function(_0x21fc4e){if(_0x21fc4e){var _0xadbebf=typeof _0x51c61e[_0x674a('0x1c')]===_0x674a('0x1d')&&typeof _0x51c61e[_0x674a('0x1e')]===_0x674a('0x1d');var _0x527c9d=_0x21fc4e['count'];var _0x5adb94=_0xadbebf?0x0:_0x51c61e['offset'];var _0x37836f=_0xadbebf?_0x21fc4e['count']:_0x51c61e[_0x674a('0x1c')]+_0x51c61e[_0x674a('0x1e')];var _0x35d4fa;if(_0x37836f>=_0x527c9d){_0x37836f=_0x527c9d;_0x35d4fa=0xc8;}else{_0x35d4fa=0xce;}_0x49396d[_0x674a('0x1a')](_0x35d4fa);return _0x49396d[_0x674a('0x1f')](_0x674a('0x20'),_0x5adb94+'-'+_0x37836f+'/'+_0x527c9d)['json'](_0x21fc4e);}return null;};}function patchUpdates(_0x5e95ea){return function(_0x2e4c35){try{jsonpatch[_0x674a('0x21')](_0x2e4c35,_0x5e95ea,!![]);}catch(_0x3c1941){return BPromise[_0x674a('0x22')](_0x3c1941);}return _0x2e4c35[_0x674a('0x23')]();};}function saveUpdates(_0x2338d5,_0x3a2f6c){return function(_0x542d7a){if(_0x542d7a){return _0x542d7a[_0x674a('0x24')](_0x2338d5)['then'](function(_0x1bad52){return _0x1bad52;});}return null;};}function removeEntity(_0x1ddc97,_0x472647){return function(_0x3495e6){if(_0x3495e6){return _0x3495e6[_0x674a('0x25')]()[_0x674a('0x26')](function(){_0x1ddc97['status'](0xcc)[_0x674a('0x27')]();});}};}function handleEntityNotFound(_0x4dc6ae,_0x1f20d3){return function(_0x231659){if(!_0x231659){_0x4dc6ae[_0x674a('0x28')](0x194);}return _0x231659;};}function handleError(_0x19c68f,_0x4b9f70){_0x4b9f70=_0x4b9f70||0x1f4;return function(_0x380e99){logger['error'](_0x380e99[_0x674a('0x29')]);if(_0x380e99['name']){delete _0x380e99['name'];}_0x19c68f[_0x674a('0x1a')](_0x4b9f70)[_0x674a('0x2a')](_0x380e99);};}exports[_0x674a('0x2b')]=function(_0x2cbf17,_0x58c70c){var _0x2411ef={},_0x5afd6b={},_0x552faf={'count':0x0,'rows':[]};var _0x1470a7=_[_0x674a('0x2c')](db[_0x674a('0x2d')][_0x674a('0x2e')],function(_0x118fa3){return{'name':_0x118fa3['fieldName'],'type':_0x118fa3[_0x674a('0x2f')][_0x674a('0x30')]};});_0x5afd6b['model']=_[_0x674a('0x2c')](_0x1470a7,_0x674a('0x31'));_0x5afd6b[_0x674a('0x32')]=_[_0x674a('0x33')](_0x2cbf17[_0x674a('0x32')]);_0x5afd6b['filters']=_['intersection'](_0x5afd6b[_0x674a('0x34')],_0x5afd6b['query']);_0x2411ef[_0x674a('0x35')]=_['intersection'](_0x5afd6b['model'],qs[_0x674a('0x36')](_0x2cbf17[_0x674a('0x32')][_0x674a('0x36')]));_0x2411ef['attributes']=_0x2411ef[_0x674a('0x35')][_0x674a('0x37')]?_0x2411ef[_0x674a('0x35')]:_0x5afd6b[_0x674a('0x34')];if(!_0x2cbf17[_0x674a('0x32')][_0x674a('0x38')](_0x674a('0x39'))){_0x2411ef[_0x674a('0x1e')]=qs['limit'](_0x2cbf17[_0x674a('0x32')][_0x674a('0x1e')]);_0x2411ef['offset']=qs[_0x674a('0x1c')](_0x2cbf17[_0x674a('0x32')][_0x674a('0x1c')]);}_0x2411ef[_0x674a('0x3a')]=qs[_0x674a('0x3b')](_0x2cbf17[_0x674a('0x32')][_0x674a('0x3b')]);_0x2411ef[_0x674a('0x3c')]=qs[_0x674a('0x3d')](_['pick'](_0x2cbf17[_0x674a('0x32')],_0x5afd6b[_0x674a('0x3d')]),_0x1470a7);if(_0x2cbf17[_0x674a('0x32')]['filter']){_0x2411ef['where']=_[_0x674a('0x3e')](_0x2411ef[_0x674a('0x3c')],{'$or':_[_0x674a('0x2c')](_0x1470a7,function(_0x3798c3){if(_0x3798c3[_0x674a('0x2f')]!=='VIRTUAL'){var _0x5028b5={};_0x5028b5[_0x3798c3[_0x674a('0x31')]]={'$like':'%'+_0x2cbf17[_0x674a('0x32')][_0x674a('0x3f')]+'%'};return _0x5028b5;}})});}_0x2411ef=_[_0x674a('0x3e')]({},_0x2411ef,_0x2cbf17[_0x674a('0x40')]);var _0x2b3b78={'where':_0x2411ef['where']};return db[_0x674a('0x2d')][_0x674a('0x41')](_0x2b3b78)[_0x674a('0x26')](function(_0x409a1b){_0x552faf[_0x674a('0x41')]=_0x409a1b;if(_0x2cbf17[_0x674a('0x32')][_0x674a('0x42')]){_0x2411ef['include']=[{'all':!![]}];}return db[_0x674a('0x2d')][_0x674a('0x43')](_0x2411ef);})['then'](function(_0x591280){_0x552faf[_0x674a('0x44')]=_0x591280;return _0x552faf;})[_0x674a('0x26')](respondWithFilteredResult(_0x58c70c,_0x2411ef))[_0x674a('0x45')](handleError(_0x58c70c,null));};exports[_0x674a('0x46')]=function(_0x52838c,_0x10dcc3){var _0x50d5c1={'raw':!![],'where':{'id':_0x52838c[_0x674a('0x47')]['id']}},_0x3e56b1={};_0x3e56b1[_0x674a('0x34')]=_[_0x674a('0x33')](db[_0x674a('0x2d')][_0x674a('0x2e')]);_0x3e56b1[_0x674a('0x32')]=_['keys'](_0x52838c[_0x674a('0x32')]);_0x3e56b1['filters']=_[_0x674a('0x48')](_0x3e56b1['model'],_0x3e56b1[_0x674a('0x32')]);_0x50d5c1[_0x674a('0x35')]=_[_0x674a('0x48')](_0x3e56b1[_0x674a('0x34')],qs[_0x674a('0x36')](_0x52838c['query']['fields']));_0x50d5c1[_0x674a('0x35')]=_0x50d5c1['attributes'][_0x674a('0x37')]?_0x50d5c1[_0x674a('0x35')]:_0x3e56b1[_0x674a('0x34')];if(_0x52838c[_0x674a('0x32')][_0x674a('0x42')]){_0x50d5c1[_0x674a('0x49')]=[{'all':!![]}];}_0x50d5c1=_['merge']({},_0x50d5c1,_0x52838c[_0x674a('0x40')]);return db[_0x674a('0x2d')]['find'](_0x50d5c1)[_0x674a('0x26')](handleEntityNotFound(_0x10dcc3,null))[_0x674a('0x26')](respondWithResult(_0x10dcc3,null))[_0x674a('0x45')](handleError(_0x10dcc3,null));};exports[_0x674a('0x4a')]=function(_0x38de24,_0x1d9d43){return db[_0x674a('0x2d')][_0x674a('0x4a')](_0x38de24[_0x674a('0x4b')],{})[_0x674a('0x26')](respondWithResult(_0x1d9d43,0xc9))[_0x674a('0x45')](handleError(_0x1d9d43,null));};exports[_0x674a('0x24')]=function(_0x28c085,_0x5a9fd0){if(_0x28c085[_0x674a('0x4b')]['id']){delete _0x28c085['body']['id'];}return db[_0x674a('0x2d')][_0x674a('0x4c')]({'where':{'id':_0x28c085[_0x674a('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a9fd0,null))[_0x674a('0x26')](saveUpdates(_0x28c085['body'],null))[_0x674a('0x26')](respondWithResult(_0x5a9fd0,null))['catch'](handleError(_0x5a9fd0,null));};exports['destroy']=function(_0x391612,_0x1360ea){return db['SmsTransferReport'][_0x674a('0x4c')]({'where':{'id':_0x391612[_0x674a('0x47')]['id']}})[_0x674a('0x26')](handleEntityNotFound(_0x1360ea,null))[_0x674a('0x26')](removeEntity(_0x1360ea,null))[_0x674a('0x45')](handleError(_0x1360ea,null));};exports[_0x674a('0x4d')]=function(_0x2a1fe5,_0x42b57e){return db[_0x674a('0x2d')][_0x674a('0x4d')]()[_0x674a('0x26')](respondWithResult(_0x42b57e,null))['catch'](handleError(_0x42b57e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 086ac72..d09477b 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 _0x0f42=['../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5d2a88,_0x36daca){var _0x5161b0=function(_0x2ccf51){while(--_0x2ccf51){_0x5d2a88['push'](_0x5d2a88['shift']());}};_0x5161b0(++_0x36daca);}(_0x0f42,0xc9));var _0x20f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0f42[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x20f4('0x0'));var util=require(_0x20f4('0x1'));var logger=require(_0x20f4('0x2'))(_0x20f4('0x3'));var moment=require('moment');var BPromise=require(_0x20f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20f4('0x5'));var rimraf=require(_0x20f4('0x6'));var config=require(_0x20f4('0x7'));var attributes=require(_0x20f4('0x8'));module[_0x20f4('0x9')]=function(_0x53ea72,_0x4eae4d){return _0x53ea72[_0x20f4('0xa')]('SmsTransferReport',attributes,{'tableName':_0x20f4('0xb'),'paranoid':![],'indexes':[{'name':_0x20f4('0xc'),'fields':[_0x20f4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd50d=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4af6d2,_0x1f789a){var _0x11782a=function(_0x1013d4){while(--_0x1013d4){_0x4af6d2['push'](_0x4af6d2['shift']());}};_0x11782a(++_0x1f789a);}(_0xd50d,0xc9));var _0xdd50=function(_0x42f910,_0x3049ca){_0x42f910=_0x42f910-0x0;var _0x481d49=_0xd50d[_0x42f910];return _0x481d49;};'use strict';var _=require(_0xdd50('0x0'));var util=require(_0xdd50('0x1'));var logger=require(_0xdd50('0x2'))(_0xdd50('0x3'));var moment=require(_0xdd50('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd50('0x5'));var fs=require('fs');var path=require(_0xdd50('0x6'));var rimraf=require(_0xdd50('0x7'));var config=require(_0xdd50('0x8'));var attributes=require(_0xdd50('0x9'));module[_0xdd50('0xa')]=function(_0x5a7ad9,_0x3a8e93){return _0x5a7ad9['define'](_0xdd50('0xb'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xdd50('0xc'),'fields':[_0xdd50('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 52b3f86..1145482 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 _0x39a9=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x1165c3,_0x2e5475){var _0x4a3040=function(_0x57fa3c){while(--_0x57fa3c){_0x1165c3['push'](_0x1165c3['shift']());}};_0x4a3040(++_0x2e5475);}(_0x39a9,0x1d0));var _0x939a=function(_0x4ea413,_0x51ff3a){_0x4ea413=_0x4ea413-0x0;var _0x51cf25=_0x39a9[_0x4ea413];return _0x51cf25;};'use strict';var _=require(_0x939a('0x0'));var util=require(_0x939a('0x1'));var moment=require(_0x939a('0x2'));var BPromise=require(_0x939a('0x3'));var rs=require(_0x939a('0x4'));var fs=require('fs');var Redis=require(_0x939a('0x5'));var db=require(_0x939a('0x6'))['db'];var utils=require(_0x939a('0x7'));var logger=require(_0x939a('0x8'))(_0x939a('0x9'));var config=require(_0x939a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x939a('0xb')][_0x939a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12cd66,_0x1c97c1,_0x3bed20){return new BPromise(function(_0xe6a08,_0x398389){return client[_0x939a('0xd')](_0x12cd66,_0x3bed20)['then'](function(_0x382b90){logger[_0x939a('0xe')](_0x939a('0xf'),_0x1c97c1,'request\x20sent');logger[_0x939a('0x10')](_0x939a('0x11'),_0x1c97c1,_0x939a('0x12'),JSON['stringify'](_0x382b90));if(_0x382b90[_0x939a('0x13')]){if(_0x382b90[_0x939a('0x13')][_0x939a('0x14')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0x398389(_0x382b90[_0x939a('0x13')]['message']);}logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);return _0xe6a08(_0x382b90[_0x939a('0x13')][_0x939a('0x15')]);}else{logger[_0x939a('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x1c97c1,_0x939a('0x12'));_0xe6a08(_0x382b90['result'][_0x939a('0x15')]);}})['catch'](function(_0x42c937){logger[_0x939a('0x13')](_0x939a('0xf'),_0x1c97c1,_0x42c937);_0x398389(_0x42c937);});});} \ No newline at end of file +var _0x8255=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','info','SmsTransferReport,\x20%s,\x20%s','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8255,0x176));var _0x5825=function(_0x2e4e89,_0x2511a1){_0x2e4e89=_0x2e4e89-0x0;var _0x3f6e3a=_0x8255[_0x2e4e89];return _0x3f6e3a;};'use strict';var _=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var moment=require(_0x5825('0x2'));var BPromise=require(_0x5825('0x3'));var rs=require(_0x5825('0x4'));var fs=require('fs');var Redis=require(_0x5825('0x5'));var db=require(_0x5825('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x5825('0x7'));var jayson=require(_0x5825('0x8'));var client=jayson[_0x5825('0x9')][_0x5825('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x383a49,_0x3415c5,_0x27d87e){return new BPromise(function(_0x577974,_0x4975de){return client[_0x5825('0xb')](_0x383a49,_0x27d87e)[_0x5825('0xc')](function(_0x754d99){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'));logger[_0x5825('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3415c5,_0x5825('0xd'),JSON[_0x5825('0xf')](_0x754d99));if(_0x754d99['error']){if(_0x754d99[_0x5825('0x10')][_0x5825('0x11')]===0x1f4){logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99['error'][_0x5825('0x12')]);return _0x4975de(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}logger[_0x5825('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3415c5,_0x754d99[_0x5825('0x10')]['message']);return _0x577974(_0x754d99[_0x5825('0x10')][_0x5825('0x12')]);}else{logger[_0x5825('0x13')](_0x5825('0x14'),_0x3415c5,_0x5825('0xd'));_0x577974(_0x754d99['result']['message']);}})[_0x5825('0x15')](function(_0x38cd22){logger[_0x5825('0x10')](_0x5825('0x14'),_0x3415c5,_0x38cd22);_0x4975de(_0x38cd22);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 33492c9..d241f5a 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 _0x4a55=['util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','put','/:id','update','delete','exports','multer'];(function(_0x22d178,_0x4a3880){var _0xe3d17c=function(_0x1e67c1){while(--_0x1e67c1){_0x22d178['push'](_0x22d178['shift']());}};_0xe3d17c(++_0x4a3880);}(_0x4a55,0x104));var _0x54a5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4a55[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x54a5('0x0'));var util=require(_0x54a5('0x1'));var path=require(_0x54a5('0x2'));var timeout=require(_0x54a5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x54a5('0x4'));var interaction=require(_0x54a5('0x5'));var config=require(_0x54a5('0x6'));var controller=require(_0x54a5('0x7'));router[_0x54a5('0x8')]('/',auth[_0x54a5('0x9')](),controller[_0x54a5('0xa')]);router[_0x54a5('0x8')]('/:id',auth[_0x54a5('0x9')](),controller['show']);router[_0x54a5('0x8')](_0x54a5('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x54a5('0xc')]({'destination':function(_0x11bb18,_0xd94aff,_0x32e95b){_0x32e95b(null,path[_0x54a5('0xd')](config[_0x54a5('0xe')],_0x54a5('0xf')));},'filename':function(_0x5649ad,_0x29ef52,_0x52cc4a){_0x29ef52[_0x54a5('0x10')]=_0x29ef52[_0x54a5('0x10')][_0x54a5('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52cc4a(null,util[_0x54a5('0x12')]('%s-%s%s',path[_0x54a5('0x13')](_0x29ef52[_0x54a5('0x10')],path[_0x54a5('0x14')](_0x29ef52['originalname'])),Date[_0x54a5('0x15')](),path[_0x54a5('0x14')](_0x29ef52[_0x54a5('0x10')])));}})});router[_0x54a5('0x16')]('/',upload[_0x54a5('0x17')]('file'),controller['create']);router[_0x54a5('0x18')](_0x54a5('0x19'),auth['isAuthenticated'](),controller[_0x54a5('0x1a')]);router[_0x54a5('0x1b')](_0x54a5('0x19'),auth[_0x54a5('0x9')](),controller[_0x54a5('0x1b')]);module[_0x54a5('0x1c')]=router; \ No newline at end of file +var _0xe3c4=['fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','single','file','create','put','update','delete','multer','util','path','express','Router'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe3c4,0x1bd));var _0x4e3c=function(_0x595536,_0x2cee39){_0x595536=_0x595536-0x0;var _0x38cbf2=_0xe3c4[_0x595536];return _0x38cbf2;};'use strict';var multer=require(_0x4e3c('0x0'));var util=require(_0x4e3c('0x1'));var path=require(_0x4e3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e3c('0x3'));var router=express[_0x4e3c('0x4')]();var fs_extra=require(_0x4e3c('0x5'));var auth=require(_0x4e3c('0x6'));var interaction=require(_0x4e3c('0x7'));var config=require('../../config/environment');var controller=require(_0x4e3c('0x8'));router[_0x4e3c('0x9')]('/',auth[_0x4e3c('0xa')](),controller[_0x4e3c('0xb')]);router['get'](_0x4e3c('0xc'),auth[_0x4e3c('0xa')](),controller['show']);router[_0x4e3c('0x9')]('/:id/download',auth[_0x4e3c('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x4e3c('0xd')]({'destination':function(_0x1ce425,_0x50050b,_0x72efbc){_0x72efbc(null,path[_0x4e3c('0xe')](config[_0x4e3c('0xf')],_0x4e3c('0x10')));},'filename':function(_0x142728,_0x52b022,_0x2a1cea){_0x52b022[_0x4e3c('0x11')]=_0x52b022[_0x4e3c('0x11')][_0x4e3c('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a1cea(null,util[_0x4e3c('0x13')](_0x4e3c('0x14'),path[_0x4e3c('0x15')](_0x52b022['originalname'],path['extname'](_0x52b022[_0x4e3c('0x11')])),Date[_0x4e3c('0x16')](),path[_0x4e3c('0x17')](_0x52b022[_0x4e3c('0x11')])));}})});router['post']('/',upload[_0x4e3c('0x18')](_0x4e3c('0x19')),controller[_0x4e3c('0x1a')]);router[_0x4e3c('0x1b')](_0x4e3c('0xc'),auth[_0x4e3c('0xa')](),controller[_0x4e3c('0x1c')]);router[_0x4e3c('0x1d')](_0x4e3c('0xc'),auth[_0x4e3c('0xa')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 848141a..b52d383 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 _0xb40c=['FLOAT','sequelize','exports','STRING','BIGINT','INTEGER'];(function(_0x555c0b,_0x2a5cae){var _0x7f508=function(_0x1b511b){while(--_0x1b511b){_0x555c0b['push'](_0x555c0b['shift']());}};_0x7f508(++_0x2a5cae);}(_0xb40c,0x79));var _0xcb40=function(_0x48c1a8,_0x55a7aa){_0x48c1a8=_0x48c1a8-0x0;var _0x4c29ad=_0xb40c[_0x48c1a8];return _0x4c29ad;};'use strict';var Sequelize=require(_0xcb40('0x0'));module[_0xcb40('0x1')]={'name':{'type':Sequelize[_0xcb40('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xcb40('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xcb40('0x2')]},'original_format':{'type':Sequelize[_0xcb40('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xcb40('0x3')]},'original_channelCount':{'type':Sequelize[_0xcb40('0x4')]},'original_bitRate':{'type':Sequelize[_0xcb40('0x3')]},'original_sampleRate':{'type':Sequelize[_0xcb40('0x4')]},'converted_format':{'type':Sequelize[_0xcb40('0x2')]},'converted_duration':{'type':Sequelize[_0xcb40('0x5')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xcb40('0x3')]},'converted_sampleRate':{'type':Sequelize[_0xcb40('0x4')]}}; \ No newline at end of file +var _0xc1b6=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x2f04a5,_0x29fb54){var _0x48016a=function(_0x5b8e12){while(--_0x5b8e12){_0x2f04a5['push'](_0x2f04a5['shift']());}};_0x48016a(++_0x29fb54);}(_0xc1b6,0x176));var _0x6c1b=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0xc1b6[_0x3dd8dd];return _0x33e300;};'use strict';var Sequelize=require('sequelize');module[_0x6c1b('0x0')]={'name':{'type':Sequelize[_0x6c1b('0x1')],'unique':_0x6c1b('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x6c1b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x6c1b('0x1')]},'original_format':{'type':Sequelize[_0x6c1b('0x1')]},'original_duration':{'type':Sequelize[_0x6c1b('0x3')]},'original_sampleCount':{'type':Sequelize[_0x6c1b('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x6c1b('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x6c1b('0x1')]},'converted_duration':{'type':Sequelize[_0x6c1b('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x6c1b('0x4')]},'converted_channelCount':{'type':Sequelize[_0x6c1b('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6c1b('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x6c1b('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 438b44a..7d8128a 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 _0x9092=['moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','save','update','then','destroy','get','Sounds','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','options','Sound','includeAll','include','findAll','rows','catch','show','params','merge','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','wav','info','chmodSync','0777','unlinkSync','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x9092,0x1cf));var _0x2909=function(_0x4fb480,_0x5ae241){_0x4fb480=_0x4fb480-0x0;var _0x13862c=_0x9092[_0x4fb480];return _0x13862c;};'use strict';var emlformat=require(_0x2909('0x0'));var rimraf=require(_0x2909('0x1'));var zipdir=require(_0x2909('0x2'));var jsonpatch=require(_0x2909('0x3'));var rp=require(_0x2909('0x4'));var moment=require(_0x2909('0x5'));var BPromise=require(_0x2909('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2909('0x7'));var sox=require(_0x2909('0x8'));var csv=require(_0x2909('0x9'));var ejs=require(_0x2909('0xa'));var fs=require('fs');var fs_extra=require(_0x2909('0xb'));var _=require(_0x2909('0xc'));var squel=require(_0x2909('0xd'));var crypto=require(_0x2909('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2909('0xf'));var toCsv=require(_0x2909('0x9'));var querystring=require(_0x2909('0x10'));var Papa=require(_0x2909('0x11'));var Redis=require(_0x2909('0x12'));var authService=require(_0x2909('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2909('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2909('0x15'))(_0x2909('0x16'));var utils=require('../../config/utils');var config=require(_0x2909('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2909('0x18'))['db'];function respondWithStatusCode(_0x147f94,_0x2d6ec3){_0x2d6ec3=_0x2d6ec3||0xcc;return function(_0x50ed55){if(_0x50ed55){return _0x147f94[_0x2909('0x19')](_0x2d6ec3);}return _0x147f94[_0x2909('0x1a')](_0x2d6ec3)[_0x2909('0x1b')]();};}function respondWithResult(_0x798399,_0x4a675c){_0x4a675c=_0x4a675c||0xc8;return function(_0x195c97){if(_0x195c97){return _0x798399[_0x2909('0x1a')](_0x4a675c)[_0x2909('0x1c')](_0x195c97);}};}function respondWithFilteredResult(_0x5a2aac,_0x285502){return function(_0x3f10d6){if(_0x3f10d6){var _0x417070=typeof _0x285502['offset']===_0x2909('0x1d')&&typeof _0x285502[_0x2909('0x1e')]==='undefined';var _0x3f92ff=_0x3f10d6['count'];var _0xf6e7d6=_0x417070?0x0:_0x285502[_0x2909('0x1f')];var _0x7c2ba5=_0x417070?_0x3f10d6[_0x2909('0x20')]:_0x285502['offset']+_0x285502[_0x2909('0x1e')];var _0x54c1cb;if(_0x7c2ba5>=_0x3f92ff){_0x7c2ba5=_0x3f92ff;_0x54c1cb=0xc8;}else{_0x54c1cb=0xce;}_0x5a2aac['status'](_0x54c1cb);return _0x5a2aac['set']('Content-Range',_0xf6e7d6+'-'+_0x7c2ba5+'/'+_0x3f92ff)[_0x2909('0x1c')](_0x3f10d6);}return null;};}function patchUpdates(_0x38ccbd){return function(_0x25abe3){try{jsonpatch[_0x2909('0x21')](_0x25abe3,_0x38ccbd,!![]);}catch(_0xa14022){return BPromise['reject'](_0xa14022);}return _0x25abe3[_0x2909('0x22')]();};}function saveUpdates(_0x415186,_0x567a46){return function(_0x3f369f){if(_0x3f369f){return _0x3f369f[_0x2909('0x23')](_0x415186)[_0x2909('0x24')](function(_0xa20f59){return _0xa20f59;});}return null;};}function removeEntity(_0x5eda5d,_0xe8f0d8){return function(_0x155014){if(_0x155014){return _0x155014[_0x2909('0x25')]()[_0x2909('0x24')](function(){var _0x51a19d=_0x155014[_0x2909('0x26')]({'plain':!![]});var _0x150c3f=_0x2909('0x27');return db['UserProfileResource'][_0x2909('0x25')]({'where':{'type':_0x150c3f,'resourceId':_0x51a19d['id']}})[_0x2909('0x24')](function(){return _0x155014;});})[_0x2909('0x24')](function(){_0x5eda5d[_0x2909('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19b821,_0x339ae1){return function(_0x228e86){if(!_0x228e86){_0x19b821[_0x2909('0x19')](0x194);}return _0x228e86;};}function handleError(_0x4fb43e,_0x4e4fdd){_0x4e4fdd=_0x4e4fdd||0x1f4;return function(_0x118461){logger[_0x2909('0x28')](_0x118461[_0x2909('0x29')]);if(_0x118461[_0x2909('0x2a')]){delete _0x118461[_0x2909('0x2a')];}_0x4fb43e[_0x2909('0x1a')](_0x4e4fdd)['send'](_0x118461);};}exports['index']=function(_0x2f1a1e,_0x5651cb){var _0x145737={},_0x596052={},_0x215756={'count':0x0,'rows':[]};var _0x823e2f=_[_0x2909('0x2b')](db['Sound'][_0x2909('0x2c')],function(_0x1129a7){return{'name':_0x1129a7[_0x2909('0x2d')],'type':_0x1129a7[_0x2909('0x2e')][_0x2909('0x2f')]};});_0x596052[_0x2909('0x30')]=_[_0x2909('0x2b')](_0x823e2f,_0x2909('0x2a'));_0x596052[_0x2909('0x31')]=_[_0x2909('0x32')](_0x2f1a1e[_0x2909('0x31')]);_0x596052[_0x2909('0x33')]=_[_0x2909('0x34')](_0x596052[_0x2909('0x30')],_0x596052['query']);_0x145737[_0x2909('0x35')]=_[_0x2909('0x34')](_0x596052[_0x2909('0x30')],qs['fields'](_0x2f1a1e[_0x2909('0x31')][_0x2909('0x36')]));_0x145737[_0x2909('0x35')]=_0x145737[_0x2909('0x35')][_0x2909('0x37')]?_0x145737['attributes']:_0x596052['model'];if(!_0x2f1a1e[_0x2909('0x31')]['hasOwnProperty']('nolimit')){_0x145737[_0x2909('0x1e')]=qs[_0x2909('0x1e')](_0x2f1a1e['query'][_0x2909('0x1e')]);_0x145737[_0x2909('0x1f')]=qs[_0x2909('0x1f')](_0x2f1a1e[_0x2909('0x31')][_0x2909('0x1f')]);}_0x145737['order']=qs['sort'](_0x2f1a1e[_0x2909('0x31')][_0x2909('0x38')]);_0x145737['where']=qs['filters'](_['pick'](_0x2f1a1e[_0x2909('0x31')],_0x596052[_0x2909('0x33')]),_0x823e2f);if(_0x2f1a1e[_0x2909('0x31')][_0x2909('0x39')]){_0x145737[_0x2909('0x3a')]=_['merge'](_0x145737[_0x2909('0x3a')],{'$or':_['map'](_0x823e2f,function(_0x39ba4e){if(_0x39ba4e[_0x2909('0x2e')]!=='VIRTUAL'){var _0x2e1f8a={};_0x2e1f8a[_0x39ba4e['name']]={'$like':'%'+_0x2f1a1e[_0x2909('0x31')][_0x2909('0x39')]+'%'};return _0x2e1f8a;}})});}_0x145737=_['merge']({},_0x145737,_0x2f1a1e[_0x2909('0x3b')]);var _0x3df05b={'where':_0x145737[_0x2909('0x3a')]};return db[_0x2909('0x3c')][_0x2909('0x20')](_0x3df05b)[_0x2909('0x24')](function(_0x45ccb8){_0x215756[_0x2909('0x20')]=_0x45ccb8;if(_0x2f1a1e[_0x2909('0x31')][_0x2909('0x3d')]){_0x145737[_0x2909('0x3e')]=[{'all':!![]}];}return db[_0x2909('0x3c')][_0x2909('0x3f')](_0x145737);})[_0x2909('0x24')](function(_0x3b66b0){_0x215756[_0x2909('0x40')]=_0x3b66b0;return _0x215756;})[_0x2909('0x24')](respondWithFilteredResult(_0x5651cb,_0x145737))[_0x2909('0x41')](handleError(_0x5651cb,null));};exports[_0x2909('0x42')]=function(_0x5edb3a,_0x16b975){var _0x46b03d={'raw':!![],'where':{'id':_0x5edb3a[_0x2909('0x43')]['id']}},_0x47442f={};_0x47442f[_0x2909('0x30')]=_[_0x2909('0x32')](db[_0x2909('0x3c')]['rawAttributes']);_0x47442f[_0x2909('0x31')]=_[_0x2909('0x32')](_0x5edb3a[_0x2909('0x31')]);_0x47442f['filters']=_[_0x2909('0x34')](_0x47442f[_0x2909('0x30')],_0x47442f[_0x2909('0x31')]);_0x46b03d[_0x2909('0x35')]=_['intersection'](_0x47442f[_0x2909('0x30')],qs[_0x2909('0x36')](_0x5edb3a['query'][_0x2909('0x36')]));_0x46b03d[_0x2909('0x35')]=_0x46b03d['attributes'][_0x2909('0x37')]?_0x46b03d[_0x2909('0x35')]:_0x47442f[_0x2909('0x30')];if(_0x5edb3a[_0x2909('0x31')][_0x2909('0x3d')]){_0x46b03d[_0x2909('0x3e')]=[{'all':!![]}];}_0x46b03d=_[_0x2909('0x44')]({},_0x46b03d,_0x5edb3a[_0x2909('0x3b')]);return db[_0x2909('0x3c')][_0x2909('0x45')](_0x46b03d)[_0x2909('0x24')](handleEntityNotFound(_0x16b975,null))[_0x2909('0x24')](respondWithResult(_0x16b975,null))[_0x2909('0x41')](handleError(_0x16b975,null));};exports['download']=function(_0x29a629,_0x30ab73,_0x38ec14){return db[_0x2909('0x3c')][_0x2909('0x45')]({'where':{'id':_0x29a629[_0x2909('0x43')]['id']},'attributes':[_0x2909('0x2a'),_0x2909('0x46'),_0x2909('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x30ab73,null))[_0x2909('0x24')](function(_0x4abeb4){if(_0x4abeb4){if(!fs['existsSync'](path[_0x2909('0x48')](config[_0x2909('0x49')],_0x2909('0x4a'),_0x4abeb4[_0x2909('0x46')]+'.'+_0x4abeb4[_0x2909('0x47')]))){throw new db[(_0x2909('0x4b'))][(_0x2909('0x4c'))](_0x2909('0x4d'));}return _0x30ab73[_0x2909('0x4e')](path['join'](config[_0x2909('0x49')],'server/files/sounds/converted',util[_0x2909('0x4f')](_0x2909('0x50'),_0x4abeb4[_0x2909('0x46')],_0x4abeb4['converted_format'])),util[_0x2909('0x4f')](_0x2909('0x50'),_0x4abeb4[_0x2909('0x2a')],_0x4abeb4[_0x2909('0x47')]));}return null;})[_0x2909('0x41')](handleError(_0x30ab73,null));};exports[_0x2909('0x51')]=function(_0xc53e81,_0x2ca680,_0x303e41){var _0x1731bd={'name':path[_0x2909('0x52')](_0xc53e81[_0x2909('0x53')][_0x2909('0x54')],path[_0x2909('0x55')](_0xc53e81['file']['originalname'])),'save_name':path[_0x2909('0x52')](_0xc53e81[_0x2909('0x53')][_0x2909('0x56')],path[_0x2909('0x55')](_0xc53e81['file'][_0x2909('0x56')])),'original_format':path[_0x2909('0x55')](_0xc53e81[_0x2909('0x53')][_0x2909('0x54')])['substring'](0x1),'converted_format':_0x2909('0x57')};var _0x2ea77b=path[_0x2909('0x48')](config['root'],'server/files/sounds/original',_0xc53e81[_0x2909('0x53')][_0x2909('0x56')]);var _0x208136=path[_0x2909('0x48')](config[_0x2909('0x49')],_0x2909('0x4a'),util[_0x2909('0x4f')](_0x2909('0x50'),path[_0x2909('0x52')](_0xc53e81[_0x2909('0x53')][_0x2909('0x56')],path['extname'](_0xc53e81[_0x2909('0x53')][_0x2909('0x56')])),_0x1731bd[_0x2909('0x47')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x2ea77b);logger[_0x2909('0x58')]('Sound\x20upload\x20destination:\x20%s',_0x208136);try{fs[_0x2909('0x59')](_0x2ea77b,parseInt(_0x2909('0x5a'),0x8));var _0x3ae2c2=sox['transcode'](_0x2ea77b,_0x208136,{'sampleRate':0x1f40,'format':_0x2909('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3ae2c2['on']('error',function(_0x1d60f8){fs[_0x2909('0x5b')](_0x2ea77b);_0x2ca680[_0x2909('0x1a')](0x1f4)[_0x2909('0x5c')](_0x1d60f8);});_0x3ae2c2['on']('src',function(_0x37d1fa){_0x1731bd['original_duration']=isNaN(_0x37d1fa[_0x2909('0x5d')])?null:_0x37d1fa[_0x2909('0x5d')]*0x3e8;_0x1731bd[_0x2909('0x5e')]=isNaN(_0x37d1fa[_0x2909('0x5f')])?null:_0x37d1fa[_0x2909('0x5f')];_0x1731bd[_0x2909('0x60')]=isNaN(_0x37d1fa['channelCount'])?null:_0x37d1fa[_0x2909('0x61')];_0x1731bd['original_bitRate']=isNaN(_0x37d1fa['bitRate'])?null:_0x37d1fa[_0x2909('0x62')];_0x1731bd[_0x2909('0x63')]=isNaN(_0x37d1fa[_0x2909('0x64')])?null:_0x37d1fa[_0x2909('0x64')];});_0x3ae2c2['on']('dest',function(_0x19e98e){_0x1731bd[_0x2909('0x65')]=isNaN(_0x19e98e[_0x2909('0x5d')])?null:_0x19e98e[_0x2909('0x5d')]*0x3e8;_0x1731bd[_0x2909('0x66')]=isNaN(_0x19e98e[_0x2909('0x5f')])?null:_0x19e98e[_0x2909('0x5f')];_0x1731bd[_0x2909('0x67')]=isNaN(_0x19e98e[_0x2909('0x61')])?null:_0x19e98e[_0x2909('0x61')];_0x1731bd[_0x2909('0x68')]=isNaN(_0x19e98e['bitRate'])?null:_0x19e98e[_0x2909('0x62')];_0x1731bd[_0x2909('0x69')]=isNaN(_0x19e98e['sampleRate'])?null:_0x19e98e[_0x2909('0x64')];});_0x3ae2c2['on'](_0x2909('0x1b'),function(){fs[_0x2909('0x59')](_0x208136,parseInt(_0x2909('0x5a'),0x8));return db[_0x2909('0x3c')]['create'](_0x1731bd)['then'](function(_0x15585a){var _0x2c2d60={'role':_0xc53e81[_0x2909('0x6a')][_0x2909('0x6b')],'userProfileId':_0xc53e81[_0x2909('0x6a')][_0x2909('0x6c')]};if(!_0x2c2d60)throw new Error(_0x2909('0x6d'));if(_0x2c2d60[_0x2909('0x6b')]===_0x2909('0x6e')){var _0x57b8f5=_0x15585a['get']({'plain':!![]});return db[_0x2909('0x6f')][_0x2909('0x45')]({'where':{'name':_0x2909('0x27'),'userProfileId':_0x2c2d60[_0x2909('0x6c')]},'raw':!![]})[_0x2909('0x24')](function(_0x29241c){if(_0x29241c&&_0x29241c[_0x2909('0x70')]===0x0){return db[_0x2909('0x71')][_0x2909('0x51')]({'name':_0x57b8f5[_0x2909('0x2a')],'resourceId':_0x57b8f5['id'],'type':_0x29241c[_0x2909('0x2a')],'sectionId':_0x29241c['id']},{})[_0x2909('0x24')](function(){return _0x15585a;});}else{return _0x15585a;}})[_0x2909('0x41')](function(_0x3f3344){logger[_0x2909('0x28')](_0x2909('0x72'),_0x3f3344);throw _0x3f3344;});}return _0x15585a;})[_0x2909('0x24')](respondWithResult(_0x2ca680,null))[_0x2909('0x41')](handleError(_0x2ca680,null));});_0x3ae2c2['start']();}catch(_0x34d3c2){_0x2ca680[_0x2909('0x1a')](0x1f4)[_0x2909('0x5c')](_0x34d3c2);}};exports['update']=function(_0x182ba4,_0x515a86,_0x3cf5f2){return db[_0x2909('0x3c')][_0x2909('0x45')]({'where':{'id':_0x182ba4[_0x2909('0x43')]['id']}})[_0x2909('0x24')](handleEntityNotFound(_0x515a86,null))['then'](saveUpdates(_['pick'](_0x182ba4[_0x2909('0x6a')],[_0x2909('0x2a'),_0x2909('0x73')]),null))[_0x2909('0x24')](respondWithResult(_0x515a86,null))['catch'](handleError(_0x515a86,null));};exports['delete']=function(_0x590feb,_0x2f153f,_0x1303bd){return db[_0x2909('0x3c')][_0x2909('0x45')]({'where':{'id':_0x590feb[_0x2909('0x43')]['id']}})[_0x2909('0x24')](function(_0x1f6a57){if(_0x1f6a57){return _0x1f6a57[_0x2909('0x25')]();}})[_0x2909('0x24')](function(_0x3cd792){var _0x2c0a0e=path[_0x2909('0x48')](config[_0x2909('0x49')],'server/files/sounds/original',util[_0x2909('0x4f')](_0x2909('0x50'),_0x3cd792[_0x2909('0x46')],_0x3cd792[_0x2909('0x74')]));var _0x12a720=path[_0x2909('0x48')](config[_0x2909('0x49')],_0x2909('0x4a'),util[_0x2909('0x4f')](_0x2909('0x50'),_0x3cd792[_0x2909('0x46')],_0x3cd792['converted_format']));fs[_0x2909('0x5b')](_0x2c0a0e);fs[_0x2909('0x5b')](_0x12a720);return _0x3cd792;})[_0x2909('0x24')](function(_0x371d2f){if(_0x371d2f){return _0x2f153f[_0x2909('0x1a')](0xcc)[_0x2909('0x1b')]();}})[_0x2909('0x24')](handleEntityNotFound(_0x2f153f,null))[_0x2909('0x41')](handleError(_0x2f153f,null));}; \ No newline at end of file +var _0x315e=['%s.%s','basename','file','originalname','extname','filename','server/files/sounds/converted','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','server/files/sounds/original','original_format','unlinkSync','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','get','error','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','Sound','includeAll','include','findAll','rows','show','params','options','find','catch','download','save_name','converted_format','join','root','Sequelize','ValidationError','format'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x315e,0x123));var _0xe315=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x315e[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe315('0x0'));var moment=require(_0xe315('0x1'));var BPromise=require(_0xe315('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe315('0x3'));var csv=require(_0xe315('0x4'));var ejs=require(_0xe315('0x5'));var fs=require('fs');var fs_extra=require(_0xe315('0x6'));var _=require(_0xe315('0x7'));var squel=require(_0xe315('0x8'));var crypto=require(_0xe315('0x9'));var jsforce=require(_0xe315('0xa'));var deskjs=require(_0xe315('0xb'));var toCsv=require(_0xe315('0x4'));var querystring=require(_0xe315('0xc'));var Papa=require(_0xe315('0xd'));var Redis=require(_0xe315('0xe'));var authService=require(_0xe315('0xf'));var qs=require(_0xe315('0x10'));var as=require(_0xe315('0x11'));var hardwareService=require(_0xe315('0x12'));var logger=require(_0xe315('0x13'))(_0xe315('0x14'));var utils=require(_0xe315('0x15'));var config=require(_0xe315('0x16'));var licenseUtil=require(_0xe315('0x17'));var db=require(_0xe315('0x18'))['db'];function respondWithStatusCode(_0x167cc8,_0x405e28){_0x405e28=_0x405e28||0xcc;return function(_0x41b1b6){if(_0x41b1b6){return _0x167cc8[_0xe315('0x19')](_0x405e28);}return _0x167cc8['status'](_0x405e28)[_0xe315('0x1a')]();};}function respondWithResult(_0x541985,_0x30a220){_0x30a220=_0x30a220||0xc8;return function(_0x429411){if(_0x429411){return _0x541985[_0xe315('0x1b')](_0x30a220)[_0xe315('0x1c')](_0x429411);}};}function respondWithFilteredResult(_0xaedbda,_0x2e2393){return function(_0x54401c){if(_0x54401c){var _0x488639=typeof _0x2e2393[_0xe315('0x1d')]===_0xe315('0x1e')&&typeof _0x2e2393['limit']===_0xe315('0x1e');var _0x46481d=_0x54401c[_0xe315('0x1f')];var _0x52cc6f=_0x488639?0x0:_0x2e2393[_0xe315('0x1d')];var _0x4fc2f9=_0x488639?_0x54401c[_0xe315('0x1f')]:_0x2e2393['offset']+_0x2e2393[_0xe315('0x20')];var _0x83bc90;if(_0x4fc2f9>=_0x46481d){_0x4fc2f9=_0x46481d;_0x83bc90=0xc8;}else{_0x83bc90=0xce;}_0xaedbda[_0xe315('0x1b')](_0x83bc90);return _0xaedbda['set'](_0xe315('0x21'),_0x52cc6f+'-'+_0x4fc2f9+'/'+_0x46481d)[_0xe315('0x1c')](_0x54401c);}return null;};}function patchUpdates(_0x4eee48){return function(_0x3cec0b){try{jsonpatch[_0xe315('0x22')](_0x3cec0b,_0x4eee48,!![]);}catch(_0x239211){return BPromise[_0xe315('0x23')](_0x239211);}return _0x3cec0b['save']();};}function saveUpdates(_0x4cd2cb,_0x2d4092){return function(_0x497472){if(_0x497472){return _0x497472['update'](_0x4cd2cb)[_0xe315('0x24')](function(_0x31ea23){return _0x31ea23;});}return null;};}function removeEntity(_0x40bcdb,_0x29cd7b){return function(_0x10f8b7){if(_0x10f8b7){return _0x10f8b7[_0xe315('0x25')]()['then'](function(){var _0x5a80a6=_0x10f8b7[_0xe315('0x26')]({'plain':!![]});var _0x1e2fd6='Sounds';return db['UserProfileResource']['destroy']({'where':{'type':_0x1e2fd6,'resourceId':_0x5a80a6['id']}})[_0xe315('0x24')](function(){return _0x10f8b7;});})[_0xe315('0x24')](function(){_0x40bcdb[_0xe315('0x1b')](0xcc)[_0xe315('0x1a')]();});}};}function handleEntityNotFound(_0x20950e,_0x5ee667){return function(_0x408ff4){if(!_0x408ff4){_0x20950e[_0xe315('0x19')](0x194);}return _0x408ff4;};}function handleError(_0x2a7baa,_0x4a8431){_0x4a8431=_0x4a8431||0x1f4;return function(_0x4d9ae3){logger[_0xe315('0x27')](_0x4d9ae3[_0xe315('0x28')]);if(_0x4d9ae3[_0xe315('0x29')]){delete _0x4d9ae3[_0xe315('0x29')];}_0x2a7baa[_0xe315('0x1b')](_0x4a8431)[_0xe315('0x2a')](_0x4d9ae3);};}exports[_0xe315('0x2b')]=function(_0x516526,_0xa558e5){var _0x1c830e={},_0x18c18a={},_0x28929e={'count':0x0,'rows':[]};var _0x405869=_['map'](db['Sound'][_0xe315('0x2c')],function(_0x4d4692){return{'name':_0x4d4692['fieldName'],'type':_0x4d4692[_0xe315('0x2d')][_0xe315('0x2e')]};});_0x18c18a[_0xe315('0x2f')]=_[_0xe315('0x30')](_0x405869,_0xe315('0x29'));_0x18c18a['query']=_[_0xe315('0x31')](_0x516526[_0xe315('0x32')]);_0x18c18a[_0xe315('0x33')]=_[_0xe315('0x34')](_0x18c18a[_0xe315('0x2f')],_0x18c18a[_0xe315('0x32')]);_0x1c830e[_0xe315('0x35')]=_[_0xe315('0x34')](_0x18c18a[_0xe315('0x2f')],qs[_0xe315('0x36')](_0x516526['query'][_0xe315('0x36')]));_0x1c830e[_0xe315('0x35')]=_0x1c830e['attributes'][_0xe315('0x37')]?_0x1c830e['attributes']:_0x18c18a[_0xe315('0x2f')];if(!_0x516526['query'][_0xe315('0x38')](_0xe315('0x39'))){_0x1c830e[_0xe315('0x20')]=qs[_0xe315('0x20')](_0x516526[_0xe315('0x32')][_0xe315('0x20')]);_0x1c830e['offset']=qs[_0xe315('0x1d')](_0x516526[_0xe315('0x32')][_0xe315('0x1d')]);}_0x1c830e['order']=qs[_0xe315('0x3a')](_0x516526[_0xe315('0x32')][_0xe315('0x3a')]);_0x1c830e['where']=qs[_0xe315('0x33')](_['pick'](_0x516526[_0xe315('0x32')],_0x18c18a['filters']),_0x405869);if(_0x516526['query'][_0xe315('0x3b')]){_0x1c830e['where']=_[_0xe315('0x3c')](_0x1c830e[_0xe315('0x3d')],{'$or':_[_0xe315('0x30')](_0x405869,function(_0x387c1a){if(_0x387c1a[_0xe315('0x2d')]!==_0xe315('0x3e')){var _0x2940e3={};_0x2940e3[_0x387c1a['name']]={'$like':'%'+_0x516526[_0xe315('0x32')][_0xe315('0x3b')]+'%'};return _0x2940e3;}})});}_0x1c830e=_['merge']({},_0x1c830e,_0x516526['options']);var _0x4a7a89={'where':_0x1c830e['where']};return db[_0xe315('0x3f')][_0xe315('0x1f')](_0x4a7a89)[_0xe315('0x24')](function(_0x40655f){_0x28929e[_0xe315('0x1f')]=_0x40655f;if(_0x516526[_0xe315('0x32')][_0xe315('0x40')]){_0x1c830e[_0xe315('0x41')]=[{'all':!![]}];}return db[_0xe315('0x3f')][_0xe315('0x42')](_0x1c830e);})[_0xe315('0x24')](function(_0x3d464d){_0x28929e[_0xe315('0x43')]=_0x3d464d;return _0x28929e;})[_0xe315('0x24')](respondWithFilteredResult(_0xa558e5,_0x1c830e))['catch'](handleError(_0xa558e5,null));};exports[_0xe315('0x44')]=function(_0x11e931,_0xd0d87e){var _0x5bc8dc={'raw':!![],'where':{'id':_0x11e931[_0xe315('0x45')]['id']}},_0x2f525f={};_0x2f525f[_0xe315('0x2f')]=_['keys'](db[_0xe315('0x3f')][_0xe315('0x2c')]);_0x2f525f[_0xe315('0x32')]=_[_0xe315('0x31')](_0x11e931['query']);_0x2f525f[_0xe315('0x33')]=_[_0xe315('0x34')](_0x2f525f[_0xe315('0x2f')],_0x2f525f[_0xe315('0x32')]);_0x5bc8dc[_0xe315('0x35')]=_['intersection'](_0x2f525f['model'],qs[_0xe315('0x36')](_0x11e931[_0xe315('0x32')][_0xe315('0x36')]));_0x5bc8dc[_0xe315('0x35')]=_0x5bc8dc[_0xe315('0x35')][_0xe315('0x37')]?_0x5bc8dc['attributes']:_0x2f525f[_0xe315('0x2f')];if(_0x11e931['query'][_0xe315('0x40')]){_0x5bc8dc[_0xe315('0x41')]=[{'all':!![]}];}_0x5bc8dc=_[_0xe315('0x3c')]({},_0x5bc8dc,_0x11e931[_0xe315('0x46')]);return db['Sound'][_0xe315('0x47')](_0x5bc8dc)[_0xe315('0x24')](handleEntityNotFound(_0xd0d87e,null))[_0xe315('0x24')](respondWithResult(_0xd0d87e,null))[_0xe315('0x48')](handleError(_0xd0d87e,null));};exports[_0xe315('0x49')]=function(_0x134b0f,_0x2ce479,_0x27a567){return db[_0xe315('0x3f')]['find']({'where':{'id':_0x134b0f['params']['id']},'attributes':[_0xe315('0x29'),_0xe315('0x4a'),_0xe315('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x2ce479,null))['then'](function(_0x51eaac){if(_0x51eaac){if(!fs['existsSync'](path[_0xe315('0x4c')](config[_0xe315('0x4d')],'server/files/sounds/converted',_0x51eaac[_0xe315('0x4a')]+'.'+_0x51eaac['converted_format']))){throw new db[(_0xe315('0x4e'))][(_0xe315('0x4f'))]('Sound\x20not\x20found');}return _0x2ce479[_0xe315('0x49')](path[_0xe315('0x4c')](config['root'],'server/files/sounds/converted',util[_0xe315('0x50')]('%s.%s',_0x51eaac[_0xe315('0x4a')],_0x51eaac[_0xe315('0x4b')])),util[_0xe315('0x50')](_0xe315('0x51'),_0x51eaac[_0xe315('0x29')],_0x51eaac['converted_format']));}return null;})['catch'](handleError(_0x2ce479,null));};exports['create']=function(_0x4f4f4e,_0x2e6aa7,_0x14ad25){var _0x23d91b={'name':path[_0xe315('0x52')](_0x4f4f4e[_0xe315('0x53')][_0xe315('0x54')],path[_0xe315('0x55')](_0x4f4f4e[_0xe315('0x53')]['originalname'])),'save_name':path['basename'](_0x4f4f4e[_0xe315('0x53')][_0xe315('0x56')],path[_0xe315('0x55')](_0x4f4f4e[_0xe315('0x53')][_0xe315('0x56')])),'original_format':path[_0xe315('0x55')](_0x4f4f4e[_0xe315('0x53')]['originalname'])['substring'](0x1),'converted_format':'wav'};var _0x388582=path[_0xe315('0x4c')](config[_0xe315('0x4d')],'server/files/sounds/original',_0x4f4f4e[_0xe315('0x53')]['filename']);var _0xf88240=path[_0xe315('0x4c')](config['root'],_0xe315('0x57'),util[_0xe315('0x50')](_0xe315('0x51'),path[_0xe315('0x52')](_0x4f4f4e['file'][_0xe315('0x56')],path[_0xe315('0x55')](_0x4f4f4e['file'][_0xe315('0x56')])),_0x23d91b[_0xe315('0x4b')]));logger[_0xe315('0x58')]('Sound\x20upload\x20filepath:\x20%s',_0x388582);logger[_0xe315('0x58')](_0xe315('0x59'),_0xf88240);try{fs[_0xe315('0x5a')](_0x388582,parseInt(_0xe315('0x5b'),0x8));var _0x2d511b=sox['transcode'](_0x388582,_0xf88240,{'sampleRate':0x1f40,'format':_0xe315('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2d511b['on'](_0xe315('0x27'),function(_0x2c47ac){fs['unlinkSync'](_0x388582);_0x2e6aa7[_0xe315('0x1b')](0x1f4)[_0xe315('0x2a')](_0x2c47ac);});_0x2d511b['on']('src',function(_0x1adca8){_0x23d91b[_0xe315('0x5d')]=isNaN(_0x1adca8[_0xe315('0x5e')])?null:_0x1adca8[_0xe315('0x5e')]*0x3e8;_0x23d91b['original_sampleCount']=isNaN(_0x1adca8[_0xe315('0x5f')])?null:_0x1adca8[_0xe315('0x5f')];_0x23d91b[_0xe315('0x60')]=isNaN(_0x1adca8[_0xe315('0x61')])?null:_0x1adca8[_0xe315('0x61')];_0x23d91b[_0xe315('0x62')]=isNaN(_0x1adca8[_0xe315('0x63')])?null:_0x1adca8[_0xe315('0x63')];_0x23d91b[_0xe315('0x64')]=isNaN(_0x1adca8['sampleRate'])?null:_0x1adca8['sampleRate'];});_0x2d511b['on'](_0xe315('0x65'),function(_0x512a55){_0x23d91b[_0xe315('0x66')]=isNaN(_0x512a55[_0xe315('0x5e')])?null:_0x512a55[_0xe315('0x5e')]*0x3e8;_0x23d91b[_0xe315('0x67')]=isNaN(_0x512a55[_0xe315('0x5f')])?null:_0x512a55[_0xe315('0x5f')];_0x23d91b[_0xe315('0x68')]=isNaN(_0x512a55[_0xe315('0x61')])?null:_0x512a55['channelCount'];_0x23d91b[_0xe315('0x69')]=isNaN(_0x512a55[_0xe315('0x63')])?null:_0x512a55[_0xe315('0x63')];_0x23d91b['converted_sampleRate']=isNaN(_0x512a55[_0xe315('0x6a')])?null:_0x512a55['sampleRate'];});_0x2d511b['on'](_0xe315('0x1a'),function(){fs[_0xe315('0x5a')](_0xf88240,parseInt(_0xe315('0x5b'),0x8));return db[_0xe315('0x3f')]['create'](_0x23d91b)['then'](function(_0x1ba39c){var _0x36c2d6={'role':_0x4f4f4e['body'][_0xe315('0x6b')],'userProfileId':_0x4f4f4e[_0xe315('0x6c')][_0xe315('0x6d')]};if(!_0x36c2d6)throw new Error(_0xe315('0x6e'));if(_0x36c2d6[_0xe315('0x6b')]===_0xe315('0x6f')){var _0xc93285=_0x1ba39c[_0xe315('0x26')]({'plain':!![]});return db[_0xe315('0x70')][_0xe315('0x47')]({'where':{'name':_0xe315('0x71'),'userProfileId':_0x36c2d6[_0xe315('0x6d')]},'raw':!![]})['then'](function(_0x111b5d){if(_0x111b5d&&_0x111b5d[_0xe315('0x72')]===0x0){return db[_0xe315('0x73')]['create']({'name':_0xc93285[_0xe315('0x29')],'resourceId':_0xc93285['id'],'type':_0x111b5d[_0xe315('0x29')],'sectionId':_0x111b5d['id']},{})[_0xe315('0x24')](function(){return _0x1ba39c;});}else{return _0x1ba39c;}})[_0xe315('0x48')](function(_0x33dc91){logger[_0xe315('0x27')](_0xe315('0x74'),_0x33dc91);throw _0x33dc91;});}return _0x1ba39c;})[_0xe315('0x24')](respondWithResult(_0x2e6aa7,null))[_0xe315('0x48')](handleError(_0x2e6aa7,null));});_0x2d511b[_0xe315('0x75')]();}catch(_0x31345d){_0x2e6aa7[_0xe315('0x1b')](0x1f4)[_0xe315('0x2a')](_0x31345d);}};exports[_0xe315('0x76')]=function(_0x1f3f48,_0x2f29b1,_0x1ce967){return db['Sound'][_0xe315('0x47')]({'where':{'id':_0x1f3f48[_0xe315('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f29b1,null))['then'](saveUpdates(_['pick'](_0x1f3f48[_0xe315('0x6c')],['name',_0xe315('0x77')]),null))[_0xe315('0x24')](respondWithResult(_0x2f29b1,null))['catch'](handleError(_0x2f29b1,null));};exports[_0xe315('0x78')]=function(_0x281be7,_0xac3d43,_0x236dc){return db['Sound'][_0xe315('0x47')]({'where':{'id':_0x281be7[_0xe315('0x45')]['id']}})[_0xe315('0x24')](function(_0x2443fd){if(_0x2443fd){return _0x2443fd[_0xe315('0x25')]();}})['then'](function(_0x50b235){var _0x2ad578=path[_0xe315('0x4c')](config[_0xe315('0x4d')],_0xe315('0x79'),util[_0xe315('0x50')](_0xe315('0x51'),_0x50b235['save_name'],_0x50b235[_0xe315('0x7a')]));var _0x2a5d7d=path[_0xe315('0x4c')](config[_0xe315('0x4d')],_0xe315('0x57'),util['format'](_0xe315('0x51'),_0x50b235[_0xe315('0x4a')],_0x50b235['converted_format']));fs[_0xe315('0x7b')](_0x2ad578);fs[_0xe315('0x7b')](_0x2a5d7d);return _0x50b235;})['then'](function(_0x374da3){if(_0x374da3){return _0xac3d43['status'](0xcc)[_0xe315('0x1a')]();}})[_0xe315('0x24')](handleEntityNotFound(_0xac3d43,null))[_0xe315('0x48')](handleError(_0xac3d43,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c8b51f3..e8213c4 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 _0x4f22=['./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1faeb1,_0x49c808){var _0x30391f=function(_0x514e21){while(--_0x514e21){_0x1faeb1['push'](_0x1faeb1['shift']());}};_0x30391f(++_0x49c808);}(_0x4f22,0x171));var _0x24f2=function(_0x12f192,_0x2d3e94){_0x12f192=_0x12f192-0x0;var _0x491431=_0x4f22[_0x12f192];return _0x491431;};'use strict';var _=require(_0x24f2('0x0'));var util=require(_0x24f2('0x1'));var logger=require(_0x24f2('0x2'))('api');var moment=require(_0x24f2('0x3'));var BPromise=require(_0x24f2('0x4'));var rp=require(_0x24f2('0x5'));var fs=require('fs');var path=require(_0x24f2('0x6'));var rimraf=require(_0x24f2('0x7'));var config=require(_0x24f2('0x8'));var attributes=require(_0x24f2('0x9'));module[_0x24f2('0xa')]=function(_0x50cc5b,_0x54e7c8){return _0x50cc5b[_0x24f2('0xb')](_0x24f2('0xc'),attributes,{'tableName':_0x24f2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde0e=['../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f386e,_0x162e0a){var _0x29ebec=function(_0x5b76b5){while(--_0x5b76b5){_0x2f386e['push'](_0x2f386e['shift']());}};_0x29ebec(++_0x162e0a);}(_0xde0e,0x94));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xede0('0x0'));var util=require(_0xede0('0x1'));var logger=require(_0xede0('0x2'))('api');var moment=require(_0xede0('0x3'));var BPromise=require(_0xede0('0x4'));var rp=require(_0xede0('0x5'));var fs=require('fs');var path=require(_0xede0('0x6'));var rimraf=require(_0xede0('0x7'));var config=require(_0xede0('0x8'));var attributes=require(_0xede0('0x9'));module['exports']=function(_0x3f9396,_0x55b848){return _0x3f9396[_0xede0('0xa')](_0xede0('0xb'),attributes,{'tableName':_0xede0('0xc'),'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 9b53c27..8093214 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 _0xb62a=['catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','ShowSound','Sound','find','options','raw','where','include','map','model','attributes'];(function(_0x235f91,_0x4dae78){var _0xfd187=function(_0x54d4c3){while(--_0x54d4c3){_0x235f91['push'](_0x235f91['shift']());}};_0xfd187(++_0x4dae78);}(_0xb62a,0x1c1));var _0xab62=function(_0x2c8f52,_0x5a0c0b){_0x2c8f52=_0x2c8f52-0x0;var _0x39c45e=_0xb62a[_0x2c8f52];return _0x39c45e;};'use strict';var _=require(_0xab62('0x0'));var util=require('util');var moment=require(_0xab62('0x1'));var BPromise=require('bluebird');var rs=require(_0xab62('0x2'));var fs=require('fs');var Redis=require(_0xab62('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xab62('0x4'));var logger=require(_0xab62('0x5'))('rpc');var config=require(_0xab62('0x6'));var jayson=require(_0xab62('0x7'));var client=jayson[_0xab62('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54c2e4,_0x38b67d,_0x408169){return new BPromise(function(_0x471771,_0x471a1b){return client[_0xab62('0x9')](_0x54c2e4,_0x408169)[_0xab62('0xa')](function(_0x284417){logger[_0xab62('0xb')]('Sound,\x20%s,\x20%s',_0x38b67d,_0xab62('0xc'));logger[_0xab62('0xd')](_0xab62('0xe'),_0x38b67d,_0xab62('0xc'),JSON[_0xab62('0xf')](_0x284417));if(_0x284417[_0xab62('0x10')]){if(_0x284417[_0xab62('0x10')][_0xab62('0x11')]===0x1f4){logger[_0xab62('0x10')](_0xab62('0x12'),_0x38b67d,_0x284417['error']['message']);return _0x471a1b(_0x284417[_0xab62('0x10')]['message']);}logger[_0xab62('0x10')](_0xab62('0x12'),_0x38b67d,_0x284417[_0xab62('0x10')][_0xab62('0x13')]);return _0x471771(_0x284417[_0xab62('0x10')][_0xab62('0x13')]);}else{logger[_0xab62('0xb')](_0xab62('0x12'),_0x38b67d,_0xab62('0xc'));_0x471771(_0x284417[_0xab62('0x14')][_0xab62('0x13')]);}})['catch'](function(_0x2b3b18){logger[_0xab62('0x10')]('Sound,\x20%s,\x20%s',_0x38b67d,_0x2b3b18);_0x471a1b(_0x2b3b18);});});}exports[_0xab62('0x15')]=function(_0x156e11){var _0x5657d1=this;return new Promise(function(_0x5ca952,_0x156cc6){return db[_0xab62('0x16')][_0xab62('0x17')]({'raw':_0x156e11[_0xab62('0x18')]?_0x156e11[_0xab62('0x18')][_0xab62('0x19')]===undefined?!![]:![]:!![],'where':_0x156e11['options']?_0x156e11[_0xab62('0x18')][_0xab62('0x1a')]||null:null,'attributes':_0x156e11[_0xab62('0x18')]?_0x156e11[_0xab62('0x18')]['attributes']||null:null,'include':_0x156e11[_0xab62('0x18')]?_0x156e11[_0xab62('0x18')][_0xab62('0x1b')]?_[_0xab62('0x1c')](_0x156e11['options'][_0xab62('0x1b')],function(_0x39b9e2){return{'model':db[_0x39b9e2[_0xab62('0x1d')]],'as':_0x39b9e2['as'],'attributes':_0x39b9e2['attributes'],'include':_0x39b9e2[_0xab62('0x1b')]?_[_0xab62('0x1c')](_0x39b9e2[_0xab62('0x1b')],function(_0x397f94){return{'model':db[_0x397f94[_0xab62('0x1d')]],'as':_0x397f94['as'],'attributes':_0x397f94[_0xab62('0x1e')],'include':_0x397f94[_0xab62('0x1b')]?_[_0xab62('0x1c')](_0x397f94['include'],function(_0x19461b){return{'model':db[_0x19461b[_0xab62('0x1d')]],'as':_0x19461b['as'],'attributes':_0x19461b[_0xab62('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xab62('0xa')](function(_0xd38e88){logger['info'](_0xab62('0x15'),_0x156e11);logger['debug'](_0xab62('0x15'),_0x156e11,JSON[_0xab62('0xf')](_0xd38e88));_0x5ca952(_0xd38e88);})[_0xab62('0x1f')](function(_0x4d2f70){logger['error'](_0xab62('0x15'),_0x4d2f70[_0xab62('0x13')],_0x156e11);_0x156cc6(_0x5657d1['error'](0x1f4,_0x4d2f70['message']));});});}; \ No newline at end of file +var _0xe533=['map','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include','model'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe533,0x1bb));var _0x3e53=function(_0x25e1c5,_0x215b3a){_0x25e1c5=_0x25e1c5-0x0;var _0xa4a9d5=_0xe533[_0x25e1c5];return _0xa4a9d5;};'use strict';var _=require(_0x3e53('0x0'));var util=require(_0x3e53('0x1'));var moment=require(_0x3e53('0x2'));var BPromise=require(_0x3e53('0x3'));var rs=require(_0x3e53('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e53('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e53('0x6'));var config=require(_0x3e53('0x7'));var jayson=require(_0x3e53('0x8'));var client=jayson[_0x3e53('0x9')][_0x3e53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbd277b,_0x48d682,_0xd61bf){return new BPromise(function(_0x33ecd3,_0x4bb116){return client[_0x3e53('0xb')](_0xbd277b,_0xd61bf)[_0x3e53('0xc')](function(_0x4c8910){logger[_0x3e53('0xd')](_0x3e53('0xe'),_0x48d682,_0x3e53('0xf'));logger[_0x3e53('0x10')](_0x3e53('0x11'),_0x48d682,_0x3e53('0xf'),JSON[_0x3e53('0x12')](_0x4c8910));if(_0x4c8910[_0x3e53('0x13')]){if(_0x4c8910['error'][_0x3e53('0x14')]===0x1f4){logger[_0x3e53('0x13')]('Sound,\x20%s,\x20%s',_0x48d682,_0x4c8910['error'][_0x3e53('0x15')]);return _0x4bb116(_0x4c8910[_0x3e53('0x13')][_0x3e53('0x15')]);}logger[_0x3e53('0x13')](_0x3e53('0xe'),_0x48d682,_0x4c8910[_0x3e53('0x13')][_0x3e53('0x15')]);return _0x33ecd3(_0x4c8910[_0x3e53('0x13')][_0x3e53('0x15')]);}else{logger[_0x3e53('0xd')](_0x3e53('0xe'),_0x48d682,'request\x20sent');_0x33ecd3(_0x4c8910[_0x3e53('0x16')][_0x3e53('0x15')]);}})[_0x3e53('0x17')](function(_0x5c5857){logger[_0x3e53('0x13')](_0x3e53('0xe'),_0x48d682,_0x5c5857);_0x4bb116(_0x5c5857);});});}exports[_0x3e53('0x18')]=function(_0x52c1ac){var _0x54647d=this;return new Promise(function(_0x2ee7dc,_0x2a69f6){return db[_0x3e53('0x19')][_0x3e53('0x1a')]({'raw':_0x52c1ac[_0x3e53('0x1b')]?_0x52c1ac['options'][_0x3e53('0x1c')]===undefined?!![]:![]:!![],'where':_0x52c1ac[_0x3e53('0x1b')]?_0x52c1ac[_0x3e53('0x1b')][_0x3e53('0x1d')]||null:null,'attributes':_0x52c1ac[_0x3e53('0x1b')]?_0x52c1ac[_0x3e53('0x1b')][_0x3e53('0x1e')]||null:null,'include':_0x52c1ac[_0x3e53('0x1b')]?_0x52c1ac['options'][_0x3e53('0x1f')]?_['map'](_0x52c1ac[_0x3e53('0x1b')][_0x3e53('0x1f')],function(_0x3bb726){return{'model':db[_0x3bb726[_0x3e53('0x20')]],'as':_0x3bb726['as'],'attributes':_0x3bb726['attributes'],'include':_0x3bb726[_0x3e53('0x1f')]?_[_0x3e53('0x21')](_0x3bb726[_0x3e53('0x1f')],function(_0x1db00d){return{'model':db[_0x1db00d[_0x3e53('0x20')]],'as':_0x1db00d['as'],'attributes':_0x1db00d['attributes'],'include':_0x1db00d[_0x3e53('0x1f')]?_[_0x3e53('0x21')](_0x1db00d['include'],function(_0xbb51db){return{'model':db[_0xbb51db['model']],'as':_0xbb51db['as'],'attributes':_0xbb51db[_0x3e53('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3e53('0xc')](function(_0x1ed65a){logger['info'](_0x3e53('0x18'),_0x52c1ac);logger['debug'](_0x3e53('0x18'),_0x52c1ac,JSON[_0x3e53('0x12')](_0x1ed65a));_0x2ee7dc(_0x1ed65a);})[_0x3e53('0x17')](function(_0x1b7908){logger['error'](_0x3e53('0x18'),_0x1b7908['message'],_0x52c1ac);_0x2a69f6(_0x54647d[_0x3e53('0x13')](0x1f4,_0x1b7908[_0x3e53('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1fe4b8d..4b69781 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x100916,_0x25270d){var _0xa31589=function(_0x2e5f3f){while(--_0x2e5f3f){_0x100916['push'](_0x100916['shift']());}};_0xa31589(++_0x25270d);}(_0x2032,0xd9));var _0x2203=function(_0x418a63,_0x4b5d3b){_0x418a63=_0x418a63-0x0;var _0x23d9bd=_0x2032[_0x418a63];return _0x23d9bd;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x2e5de1,_0xfa1813){var _0x5706ea=function(_0x70b484){while(--_0x70b484){_0x2e5de1['push'](_0x2e5de1['shift']());}};_0x5706ea(++_0xfa1813);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xb7e7[_0x38a7ac];return _0x53061a;};'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('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('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 799d333..ab630a9 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 _0x74be=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x15f5ec,_0x158bf6){var _0x4a3b10=function(_0x1a32e6){while(--_0x1a32e6){_0x15f5ec['push'](_0x15f5ec['shift']());}};_0x4a3b10(++_0x158bf6);}(_0x74be,0x16b));var _0xe74b=function(_0x47d16e,_0x206ed7){_0x47d16e=_0x47d16e-0x0;var _0x4bd8d5=_0x74be[_0x47d16e];return _0x4bd8d5;};'use strict';var Sequelize=require(_0xe74b('0x0'));module[_0xe74b('0x1')]={'uniqueid':{'type':Sequelize[_0xe74b('0x2')]},'body':{'type':Sequelize[_0xe74b('0x3')](_0xe74b('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xe74b('0x5')]('in',_0xe74b('0x6')),'defaultValue':_0xe74b('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe74b('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe5b9=['exports','STRING','TEXT','medium','ENUM','out'];(function(_0x288245,_0x52b079){var _0x2c8196=function(_0x21bfa7){while(--_0x21bfa7){_0x288245['push'](_0x288245['shift']());}};_0x2c8196(++_0x52b079);}(_0xe5b9,0xb4));var _0x9e5b=function(_0x4def0b,_0x2f540f){_0x4def0b=_0x4def0b-0x0;var _0x59f978=_0xe5b9[_0x4def0b];return _0x59f978;};'use strict';var Sequelize=require('sequelize');module[_0x9e5b('0x0')]={'uniqueid':{'type':Sequelize[_0x9e5b('0x1')]},'body':{'type':Sequelize[_0x9e5b('0x2')](_0x9e5b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9e5b('0x4')]('in',_0x9e5b('0x5')),'defaultValue':_0x9e5b('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9e5b('0x1')]},'providerResponse':{'type':Sequelize[_0x9e5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a49d938..0007ae0 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 _0x9b05=['findAll','rows','catch','show','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','include'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x9b05,0x1cb));var _0x59b0=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x9b05[_0x39cd3c];return _0x47a0ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59b0('0x0'));var zipdir=require(_0x59b0('0x1'));var jsonpatch=require(_0x59b0('0x2'));var rp=require(_0x59b0('0x3'));var moment=require(_0x59b0('0x4'));var BPromise=require(_0x59b0('0x5'));var Mustache=require(_0x59b0('0x6'));var util=require('util');var path=require('path');var sox=require(_0x59b0('0x7'));var csv=require(_0x59b0('0x8'));var ejs=require(_0x59b0('0x9'));var fs=require('fs');var fs_extra=require(_0x59b0('0xa'));var _=require('lodash');var squel=require(_0x59b0('0xb'));var crypto=require(_0x59b0('0xc'));var jsforce=require(_0x59b0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x59b0('0x8'));var querystring=require(_0x59b0('0xe'));var Papa=require(_0x59b0('0xf'));var Redis=require('ioredis');var authService=require(_0x59b0('0x10'));var qs=require(_0x59b0('0x11'));var as=require(_0x59b0('0x12'));var hardwareService=require(_0x59b0('0x13'));var logger=require('../../config/logger')(_0x59b0('0x14'));var utils=require(_0x59b0('0x15'));var config=require(_0x59b0('0x16'));var licenseUtil=require(_0x59b0('0x17'));var db=require(_0x59b0('0x18'))['db'];function respondWithStatusCode(_0x5bb966,_0x59c3cb){_0x59c3cb=_0x59c3cb||0xcc;return function(_0x1ddfba){if(_0x1ddfba){return _0x5bb966['sendStatus'](_0x59c3cb);}return _0x5bb966[_0x59b0('0x19')](_0x59c3cb)['end']();};}function respondWithResult(_0x43f01e,_0x15c599){_0x15c599=_0x15c599||0xc8;return function(_0x4e3b7c){if(_0x4e3b7c){return _0x43f01e[_0x59b0('0x19')](_0x15c599)[_0x59b0('0x1a')](_0x4e3b7c);}};}function respondWithFilteredResult(_0x4910ef,_0x32cc9c){return function(_0xb53e4e){if(_0xb53e4e){var _0x27cda3=typeof _0x32cc9c[_0x59b0('0x1b')]===_0x59b0('0x1c')&&typeof _0x32cc9c[_0x59b0('0x1d')]==='undefined';var _0x43ba72=_0xb53e4e[_0x59b0('0x1e')];var _0x59b60f=_0x27cda3?0x0:_0x32cc9c[_0x59b0('0x1b')];var _0x143908=_0x27cda3?_0xb53e4e[_0x59b0('0x1e')]:_0x32cc9c[_0x59b0('0x1b')]+_0x32cc9c['limit'];var _0x38829f;if(_0x143908>=_0x43ba72){_0x143908=_0x43ba72;_0x38829f=0xc8;}else{_0x38829f=0xce;}_0x4910ef['status'](_0x38829f);return _0x4910ef['set'](_0x59b0('0x1f'),_0x59b60f+'-'+_0x143908+'/'+_0x43ba72)[_0x59b0('0x1a')](_0xb53e4e);}return null;};}function patchUpdates(_0xeca5d4){return function(_0xd890ca){try{jsonpatch['apply'](_0xd890ca,_0xeca5d4,!![]);}catch(_0x4f12a7){return BPromise[_0x59b0('0x20')](_0x4f12a7);}return _0xd890ca[_0x59b0('0x21')]();};}function saveUpdates(_0x5d75ba,_0x5d5768){return function(_0x225383){if(_0x225383){return _0x225383['update'](_0x5d75ba)[_0x59b0('0x22')](function(_0x5a67c1){return _0x5a67c1;});}return null;};}function removeEntity(_0x451271,_0x356f89){return function(_0x1ec11d){if(_0x1ec11d){return _0x1ec11d[_0x59b0('0x23')]()[_0x59b0('0x22')](function(){_0x451271[_0x59b0('0x19')](0xcc)[_0x59b0('0x24')]();});}};}function handleEntityNotFound(_0xf1f068,_0x4a7159){return function(_0x1c7701){if(!_0x1c7701){_0xf1f068['sendStatus'](0x194);}return _0x1c7701;};}function handleError(_0x2c66c1,_0x3a315b){_0x3a315b=_0x3a315b||0x1f4;return function(_0x41da30){logger[_0x59b0('0x25')](_0x41da30[_0x59b0('0x26')]);if(_0x41da30[_0x59b0('0x27')]){delete _0x41da30[_0x59b0('0x27')];}_0x2c66c1[_0x59b0('0x19')](_0x3a315b)[_0x59b0('0x28')](_0x41da30);};}exports[_0x59b0('0x29')]=function(_0x242adf,_0x427bb7){var _0x19ad8f={},_0x355eb0={},_0x234743={'count':0x0,'rows':[]};var _0x4af3d5=_['map'](db[_0x59b0('0x2a')][_0x59b0('0x2b')],function(_0x3b30c3){return{'name':_0x3b30c3[_0x59b0('0x2c')],'type':_0x3b30c3[_0x59b0('0x2d')][_0x59b0('0x2e')]};});_0x355eb0['model']=_['map'](_0x4af3d5,'name');_0x355eb0['query']=_[_0x59b0('0x2f')](_0x242adf[_0x59b0('0x30')]);_0x355eb0['filters']=_[_0x59b0('0x31')](_0x355eb0['model'],_0x355eb0['query']);_0x19ad8f['attributes']=_[_0x59b0('0x31')](_0x355eb0[_0x59b0('0x32')],qs['fields'](_0x242adf[_0x59b0('0x30')][_0x59b0('0x33')]));_0x19ad8f[_0x59b0('0x34')]=_0x19ad8f[_0x59b0('0x34')][_0x59b0('0x35')]?_0x19ad8f[_0x59b0('0x34')]:_0x355eb0[_0x59b0('0x32')];if(!_0x242adf[_0x59b0('0x30')][_0x59b0('0x36')]('nolimit')){_0x19ad8f['limit']=qs[_0x59b0('0x1d')](_0x242adf['query'][_0x59b0('0x1d')]);_0x19ad8f['offset']=qs[_0x59b0('0x1b')](_0x242adf['query']['offset']);}_0x19ad8f[_0x59b0('0x37')]=qs['sort'](_0x242adf[_0x59b0('0x30')][_0x59b0('0x38')]);_0x19ad8f[_0x59b0('0x39')]=qs[_0x59b0('0x3a')](_[_0x59b0('0x3b')](_0x242adf['query'],_0x355eb0['filters']),_0x4af3d5);if(_0x242adf[_0x59b0('0x30')]['filter']){_0x19ad8f[_0x59b0('0x39')]=_['merge'](_0x19ad8f[_0x59b0('0x39')],{'$or':_[_0x59b0('0x3c')](_0x4af3d5,function(_0x556c25){if(_0x556c25[_0x59b0('0x2d')]!==_0x59b0('0x3d')){var _0x360eb6={};_0x360eb6[_0x556c25[_0x59b0('0x27')]]={'$like':'%'+_0x242adf[_0x59b0('0x30')][_0x59b0('0x3e')]+'%'};return _0x360eb6;}})});}_0x19ad8f=_[_0x59b0('0x3f')]({},_0x19ad8f,_0x242adf[_0x59b0('0x40')]);var _0x30274e={'where':_0x19ad8f['where']};return db[_0x59b0('0x2a')][_0x59b0('0x1e')](_0x30274e)['then'](function(_0x56ca8e){_0x234743[_0x59b0('0x1e')]=_0x56ca8e;if(_0x242adf[_0x59b0('0x30')]['includeAll']){_0x19ad8f[_0x59b0('0x41')]=[{'all':!![]}];}return db[_0x59b0('0x2a')][_0x59b0('0x42')](_0x19ad8f);})[_0x59b0('0x22')](function(_0x14e90c){_0x234743[_0x59b0('0x43')]=_0x14e90c;return _0x234743;})['then'](respondWithFilteredResult(_0x427bb7,_0x19ad8f))[_0x59b0('0x44')](handleError(_0x427bb7,null));};exports[_0x59b0('0x45')]=function(_0x4a37d3,_0x45b6a5){var _0x11cb18={'raw':!![],'where':{'id':_0x4a37d3['params']['id']}},_0x3a722f={};_0x3a722f['model']=_[_0x59b0('0x2f')](db[_0x59b0('0x2a')][_0x59b0('0x2b')]);_0x3a722f[_0x59b0('0x30')]=_[_0x59b0('0x2f')](_0x4a37d3['query']);_0x3a722f[_0x59b0('0x3a')]=_[_0x59b0('0x31')](_0x3a722f['model'],_0x3a722f[_0x59b0('0x30')]);_0x11cb18['attributes']=_[_0x59b0('0x31')](_0x3a722f[_0x59b0('0x32')],qs['fields'](_0x4a37d3[_0x59b0('0x30')]['fields']));_0x11cb18['attributes']=_0x11cb18['attributes']['length']?_0x11cb18['attributes']:_0x3a722f[_0x59b0('0x32')];if(_0x4a37d3['query']['includeAll']){_0x11cb18[_0x59b0('0x41')]=[{'all':!![]}];}_0x11cb18=_[_0x59b0('0x3f')]({},_0x11cb18,_0x4a37d3['options']);return db[_0x59b0('0x2a')][_0x59b0('0x46')](_0x11cb18)[_0x59b0('0x22')](handleEntityNotFound(_0x45b6a5,null))[_0x59b0('0x22')](respondWithResult(_0x45b6a5,null))[_0x59b0('0x44')](handleError(_0x45b6a5,null));};exports['create']=function(_0x5f2f4c,_0x3b674b){return db[_0x59b0('0x2a')][_0x59b0('0x47')](_0x5f2f4c[_0x59b0('0x48')],{})['then'](respondWithResult(_0x3b674b,0xc9))['catch'](handleError(_0x3b674b,null));};exports[_0x59b0('0x49')]=function(_0x247c1a,_0x2e2782){if(_0x247c1a[_0x59b0('0x48')]['id']){delete _0x247c1a[_0x59b0('0x48')]['id'];}return db[_0x59b0('0x2a')][_0x59b0('0x46')]({'where':{'id':_0x247c1a['params']['id']}})[_0x59b0('0x22')](handleEntityNotFound(_0x2e2782,null))[_0x59b0('0x22')](saveUpdates(_0x247c1a[_0x59b0('0x48')],null))[_0x59b0('0x22')](respondWithResult(_0x2e2782,null))['catch'](handleError(_0x2e2782,null));};exports[_0x59b0('0x23')]=function(_0x2817d8,_0x4ff840){return db[_0x59b0('0x2a')][_0x59b0('0x46')]({'where':{'id':_0x2817d8[_0x59b0('0x4a')]['id']}})[_0x59b0('0x22')](handleEntityNotFound(_0x4ff840,null))[_0x59b0('0x22')](removeEntity(_0x4ff840,null))['catch'](handleError(_0x4ff840,null));}; \ No newline at end of file +var _0xfabd=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','error','stack','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js'];(function(_0x4d30c0,_0x3a0ae7){var _0x5b0c2e=function(_0x3d752b){while(--_0x3d752b){_0x4d30c0['push'](_0x4d30c0['shift']());}};_0x5b0c2e(++_0x3a0ae7);}(_0xfabd,0x89));var _0xdfab=function(_0x18e981,_0x518b72){_0x18e981=_0x18e981-0x0;var _0x454c65=_0xfabd[_0x18e981];return _0x454c65;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfab('0x0'));var zipdir=require(_0xdfab('0x1'));var jsonpatch=require(_0xdfab('0x2'));var rp=require(_0xdfab('0x3'));var moment=require(_0xdfab('0x4'));var BPromise=require(_0xdfab('0x5'));var Mustache=require(_0xdfab('0x6'));var util=require(_0xdfab('0x7'));var path=require('path');var sox=require(_0xdfab('0x8'));var csv=require(_0xdfab('0x9'));var ejs=require(_0xdfab('0xa'));var fs=require('fs');var fs_extra=require(_0xdfab('0xb'));var _=require(_0xdfab('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfab('0xd'));var deskjs=require(_0xdfab('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdfab('0xf'));var Papa=require(_0xdfab('0x10'));var Redis=require(_0xdfab('0x11'));var authService=require(_0xdfab('0x12'));var qs=require(_0xdfab('0x13'));var as=require(_0xdfab('0x14'));var hardwareService=require(_0xdfab('0x15'));var logger=require(_0xdfab('0x16'))(_0xdfab('0x17'));var utils=require(_0xdfab('0x18'));var config=require(_0xdfab('0x19'));var licenseUtil=require(_0xdfab('0x1a'));var db=require(_0xdfab('0x1b'))['db'];function respondWithStatusCode(_0xbf79e,_0x2d9bd0){_0x2d9bd0=_0x2d9bd0||0xcc;return function(_0x324216){if(_0x324216){return _0xbf79e[_0xdfab('0x1c')](_0x2d9bd0);}return _0xbf79e['status'](_0x2d9bd0)[_0xdfab('0x1d')]();};}function respondWithResult(_0x3e8cad,_0xbc1d86){_0xbc1d86=_0xbc1d86||0xc8;return function(_0x5ce42f){if(_0x5ce42f){return _0x3e8cad['status'](_0xbc1d86)[_0xdfab('0x1e')](_0x5ce42f);}};}function respondWithFilteredResult(_0x473cbc,_0x5c7477){return function(_0x4e2bcd){if(_0x4e2bcd){var _0x4695f5=typeof _0x5c7477[_0xdfab('0x1f')]===_0xdfab('0x20')&&typeof _0x5c7477[_0xdfab('0x21')]===_0xdfab('0x20');var _0x32d363=_0x4e2bcd[_0xdfab('0x22')];var _0x213ed5=_0x4695f5?0x0:_0x5c7477[_0xdfab('0x1f')];var _0x51c4b7=_0x4695f5?_0x4e2bcd[_0xdfab('0x22')]:_0x5c7477['offset']+_0x5c7477[_0xdfab('0x21')];var _0x5495b4;if(_0x51c4b7>=_0x32d363){_0x51c4b7=_0x32d363;_0x5495b4=0xc8;}else{_0x5495b4=0xce;}_0x473cbc[_0xdfab('0x23')](_0x5495b4);return _0x473cbc['set'](_0xdfab('0x24'),_0x213ed5+'-'+_0x51c4b7+'/'+_0x32d363)[_0xdfab('0x1e')](_0x4e2bcd);}return null;};}function patchUpdates(_0x195ef1){return function(_0xaa4ed){try{jsonpatch['apply'](_0xaa4ed,_0x195ef1,!![]);}catch(_0x6803c2){return BPromise[_0xdfab('0x25')](_0x6803c2);}return _0xaa4ed[_0xdfab('0x26')]();};}function saveUpdates(_0x4d7b19,_0x506d5c){return function(_0x18a431){if(_0x18a431){return _0x18a431[_0xdfab('0x27')](_0x4d7b19)[_0xdfab('0x28')](function(_0xcc7ccd){return _0xcc7ccd;});}return null;};}function removeEntity(_0x210880,_0x2e8210){return function(_0x31c0bf){if(_0x31c0bf){return _0x31c0bf['destroy']()[_0xdfab('0x28')](function(){_0x210880[_0xdfab('0x23')](0xcc)[_0xdfab('0x1d')]();});}};}function handleEntityNotFound(_0x6e06ff,_0x27cb30){return function(_0x242e9c){if(!_0x242e9c){_0x6e06ff['sendStatus'](0x194);}return _0x242e9c;};}function handleError(_0x4b22d4,_0x3381fe){_0x3381fe=_0x3381fe||0x1f4;return function(_0x15a365){logger[_0xdfab('0x29')](_0x15a365[_0xdfab('0x2a')]);if(_0x15a365[_0xdfab('0x2b')]){delete _0x15a365[_0xdfab('0x2b')];}_0x4b22d4['status'](_0x3381fe)['send'](_0x15a365);};}exports[_0xdfab('0x2c')]=function(_0x1210f4,_0x544b32){var _0x14c2e2={},_0x4e07fc={},_0x2ad2d4={'count':0x0,'rows':[]};var _0x6fa4b8=_['map'](db[_0xdfab('0x2d')][_0xdfab('0x2e')],function(_0x363573){return{'name':_0x363573[_0xdfab('0x2f')],'type':_0x363573[_0xdfab('0x30')][_0xdfab('0x31')]};});_0x4e07fc[_0xdfab('0x32')]=_[_0xdfab('0x33')](_0x6fa4b8,'name');_0x4e07fc[_0xdfab('0x34')]=_[_0xdfab('0x35')](_0x1210f4['query']);_0x4e07fc[_0xdfab('0x36')]=_[_0xdfab('0x37')](_0x4e07fc[_0xdfab('0x32')],_0x4e07fc[_0xdfab('0x34')]);_0x14c2e2[_0xdfab('0x38')]=_[_0xdfab('0x37')](_0x4e07fc[_0xdfab('0x32')],qs[_0xdfab('0x39')](_0x1210f4[_0xdfab('0x34')]['fields']));_0x14c2e2[_0xdfab('0x38')]=_0x14c2e2['attributes'][_0xdfab('0x3a')]?_0x14c2e2['attributes']:_0x4e07fc[_0xdfab('0x32')];if(!_0x1210f4[_0xdfab('0x34')][_0xdfab('0x3b')](_0xdfab('0x3c'))){_0x14c2e2[_0xdfab('0x21')]=qs[_0xdfab('0x21')](_0x1210f4[_0xdfab('0x34')][_0xdfab('0x21')]);_0x14c2e2['offset']=qs['offset'](_0x1210f4[_0xdfab('0x34')]['offset']);}_0x14c2e2['order']=qs['sort'](_0x1210f4['query'][_0xdfab('0x3d')]);_0x14c2e2[_0xdfab('0x3e')]=qs[_0xdfab('0x36')](_['pick'](_0x1210f4[_0xdfab('0x34')],_0x4e07fc[_0xdfab('0x36')]),_0x6fa4b8);if(_0x1210f4['query'][_0xdfab('0x3f')]){_0x14c2e2['where']=_[_0xdfab('0x40')](_0x14c2e2[_0xdfab('0x3e')],{'$or':_[_0xdfab('0x33')](_0x6fa4b8,function(_0x5d24bd){if(_0x5d24bd[_0xdfab('0x30')]!==_0xdfab('0x41')){var _0x55f011={};_0x55f011[_0x5d24bd[_0xdfab('0x2b')]]={'$like':'%'+_0x1210f4[_0xdfab('0x34')]['filter']+'%'};return _0x55f011;}})});}_0x14c2e2=_[_0xdfab('0x40')]({},_0x14c2e2,_0x1210f4[_0xdfab('0x42')]);var _0x172f9f={'where':_0x14c2e2['where']};return db[_0xdfab('0x2d')][_0xdfab('0x22')](_0x172f9f)[_0xdfab('0x28')](function(_0x866710){_0x2ad2d4[_0xdfab('0x22')]=_0x866710;if(_0x1210f4[_0xdfab('0x34')][_0xdfab('0x43')]){_0x14c2e2[_0xdfab('0x44')]=[{'all':!![]}];}return db[_0xdfab('0x2d')]['findAll'](_0x14c2e2);})['then'](function(_0x2841d2){_0x2ad2d4[_0xdfab('0x45')]=_0x2841d2;return _0x2ad2d4;})[_0xdfab('0x28')](respondWithFilteredResult(_0x544b32,_0x14c2e2))[_0xdfab('0x46')](handleError(_0x544b32,null));};exports['show']=function(_0x4322d4,_0x2f5c82){var _0x377d55={'raw':!![],'where':{'id':_0x4322d4[_0xdfab('0x47')]['id']}},_0x2dd530={};_0x2dd530[_0xdfab('0x32')]=_[_0xdfab('0x35')](db[_0xdfab('0x2d')][_0xdfab('0x2e')]);_0x2dd530['query']=_[_0xdfab('0x35')](_0x4322d4['query']);_0x2dd530[_0xdfab('0x36')]=_[_0xdfab('0x37')](_0x2dd530[_0xdfab('0x32')],_0x2dd530[_0xdfab('0x34')]);_0x377d55['attributes']=_[_0xdfab('0x37')](_0x2dd530[_0xdfab('0x32')],qs[_0xdfab('0x39')](_0x4322d4[_0xdfab('0x34')][_0xdfab('0x39')]));_0x377d55[_0xdfab('0x38')]=_0x377d55[_0xdfab('0x38')][_0xdfab('0x3a')]?_0x377d55[_0xdfab('0x38')]:_0x2dd530['model'];if(_0x4322d4[_0xdfab('0x34')]['includeAll']){_0x377d55['include']=[{'all':!![]}];}_0x377d55=_[_0xdfab('0x40')]({},_0x377d55,_0x4322d4[_0xdfab('0x42')]);return db[_0xdfab('0x2d')][_0xdfab('0x48')](_0x377d55)[_0xdfab('0x28')](handleEntityNotFound(_0x2f5c82,null))['then'](respondWithResult(_0x2f5c82,null))[_0xdfab('0x46')](handleError(_0x2f5c82,null));};exports[_0xdfab('0x49')]=function(_0x58d18d,_0x2c07d6){return db[_0xdfab('0x2d')]['create'](_0x58d18d[_0xdfab('0x4a')],{})[_0xdfab('0x28')](respondWithResult(_0x2c07d6,0xc9))[_0xdfab('0x46')](handleError(_0x2c07d6,null));};exports['update']=function(_0x52e5c6,_0x349b64){if(_0x52e5c6['body']['id']){delete _0x52e5c6[_0xdfab('0x4a')]['id'];}return db[_0xdfab('0x2d')][_0xdfab('0x48')]({'where':{'id':_0x52e5c6[_0xdfab('0x47')]['id']}})[_0xdfab('0x28')](handleEntityNotFound(_0x349b64,null))['then'](saveUpdates(_0x52e5c6[_0xdfab('0x4a')],null))['then'](respondWithResult(_0x349b64,null))[_0xdfab('0x46')](handleError(_0x349b64,null));};exports[_0xdfab('0x4b')]=function(_0x435255,_0x4b79d8){return db['SquareMessage'][_0xdfab('0x48')]({'where':{'id':_0x435255[_0xdfab('0x47')]['id']}})[_0xdfab('0x28')](handleEntityNotFound(_0x4b79d8,null))[_0xdfab('0x28')](removeEntity(_0x4b79d8,null))[_0xdfab('0x46')](handleError(_0x4b79d8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 43fcc30..20225e4 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 _0x0079=['square_messages','util','../../config/logger','api','bluebird','request-promise','path','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x3db0ea,_0x109800){var _0x209270=function(_0xd780){while(--_0xd780){_0x3db0ea['push'](_0x3db0ea['shift']());}};_0x209270(++_0x109800);}(_0x0079,0x1cf));var _0x9007=function(_0xcf8bc4,_0x5f0556){_0xcf8bc4=_0xcf8bc4-0x0;var _0x1af7b9=_0x0079[_0xcf8bc4];return _0x1af7b9;};'use strict';var _=require('lodash');var util=require(_0x9007('0x0'));var logger=require(_0x9007('0x1'))(_0x9007('0x2'));var moment=require('moment');var BPromise=require(_0x9007('0x3'));var rp=require(_0x9007('0x4'));var fs=require('fs');var path=require(_0x9007('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9007('0x6'));module[_0x9007('0x7')]=function(_0x387c73,_0x1b7997){return _0x387c73[_0x9007('0x8')](_0x9007('0x9'),attributes,{'tableName':_0x9007('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f22=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages','lodash','util'];(function(_0x263f76,_0x2ee49f){var _0x4112de=function(_0x590ef1){while(--_0x590ef1){_0x263f76['push'](_0x263f76['shift']());}};_0x4112de(++_0x2ee49f);}(_0x3f22,0xee));var _0x23f2=function(_0x312dc3,_0x2ccf42){_0x312dc3=_0x312dc3-0x0;var _0x26c82c=_0x3f22[_0x312dc3];return _0x26c82c;};'use strict';var _=require(_0x23f2('0x0'));var util=require(_0x23f2('0x1'));var logger=require(_0x23f2('0x2'))('api');var moment=require(_0x23f2('0x3'));var BPromise=require(_0x23f2('0x4'));var rp=require(_0x23f2('0x5'));var fs=require('fs');var path=require(_0x23f2('0x6'));var rimraf=require(_0x23f2('0x7'));var config=require(_0x23f2('0x8'));var attributes=require(_0x23f2('0x9'));module[_0x23f2('0xa')]=function(_0x14deb6,_0x19593d){return _0x14deb6['define']('SquareMessage',attributes,{'tableName':_0x23f2('0xb'),'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 ddc32ca..d465cba 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 _0x9297=['debug','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','options','raw'];(function(_0x49a9bc,_0x57d8d7){var _0x546fce=function(_0x9a6811){while(--_0x9a6811){_0x49a9bc['push'](_0x49a9bc['shift']());}};_0x546fce(++_0x57d8d7);}(_0x9297,0x1d5));var _0x7929=function(_0xce99cd,_0x3ffc2e){_0xce99cd=_0xce99cd-0x0;var _0x2e80b0=_0x9297[_0xce99cd];return _0x2e80b0;};'use strict';var _=require('lodash');var util=require(_0x7929('0x0'));var moment=require(_0x7929('0x1'));var BPromise=require('bluebird');var rs=require(_0x7929('0x2'));var fs=require('fs');var Redis=require(_0x7929('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7929('0x4'));var logger=require('../../config/logger')(_0x7929('0x5'));var config=require(_0x7929('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7929('0x7')][_0x7929('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14c7ed,_0x3472f4,_0x1073d5){return new BPromise(function(_0x2344d8,_0x4212a1){return client[_0x7929('0x9')](_0x14c7ed,_0x1073d5)[_0x7929('0xa')](function(_0x846fca){logger[_0x7929('0xb')](_0x7929('0xc'),_0x3472f4,_0x7929('0xd'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3472f4,_0x7929('0xd'),JSON[_0x7929('0xe')](_0x846fca));if(_0x846fca[_0x7929('0xf')]){if(_0x846fca[_0x7929('0xf')][_0x7929('0x10')]===0x1f4){logger[_0x7929('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3472f4,_0x846fca['error'][_0x7929('0x11')]);return _0x4212a1(_0x846fca['error'][_0x7929('0x11')]);}logger[_0x7929('0xf')](_0x7929('0xc'),_0x3472f4,_0x846fca[_0x7929('0xf')][_0x7929('0x11')]);return _0x2344d8(_0x846fca['error']['message']);}else{logger['info'](_0x7929('0xc'),_0x3472f4,_0x7929('0xd'));_0x2344d8(_0x846fca[_0x7929('0x12')][_0x7929('0x11')]);}})[_0x7929('0x13')](function(_0x4fce0d){logger[_0x7929('0xf')](_0x7929('0xc'),_0x3472f4,_0x4fce0d);_0x4212a1(_0x4fce0d);});});}exports[_0x7929('0x14')]=function(_0x37de50){var _0x1219a0=this;return new Promise(function(_0x4cb6f8,_0x1b5b7f){return db[_0x7929('0x15')][_0x7929('0x16')](_0x37de50['body'],{'raw':_0x37de50['options']?_0x37de50[_0x7929('0x17')][_0x7929('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x253981){logger[_0x7929('0xb')](_0x7929('0x14'),_0x37de50);logger[_0x7929('0x19')]('CreateSquareMessage',_0x37de50,JSON[_0x7929('0xe')](_0x253981));_0x4cb6f8(_0x253981);})[_0x7929('0x13')](function(_0x475506){logger['error']('CreateSquareMessage',_0x475506[_0x7929('0x11')],_0x37de50);_0x1b5b7f(_0x1219a0['error'](0x1f4,_0x475506[_0x7929('0x11')]));});});}; \ No newline at end of file +var _0x2f58=['../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareMessage','SquareMessage','create','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x48d959,_0x481edd){var _0x2f1bc1=function(_0x333c9e){while(--_0x333c9e){_0x48d959['push'](_0x48d959['shift']());}};_0x2f1bc1(++_0x481edd);}(_0x2f58,0x1c4));var _0x82f5=function(_0xd4deee,_0x4e07ea){_0xd4deee=_0xd4deee-0x0;var _0x21707a=_0x2f58[_0xd4deee];return _0x21707a;};'use strict';var _=require(_0x82f5('0x0'));var util=require(_0x82f5('0x1'));var moment=require('moment');var BPromise=require(_0x82f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82f5('0x3'));var db=require(_0x82f5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f5('0x5'))(_0x82f5('0x6'));var config=require(_0x82f5('0x7'));var jayson=require(_0x82f5('0x8'));var client=jayson[_0x82f5('0x9')][_0x82f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2902ab,_0x1ab6e9,_0x43004b){return new BPromise(function(_0xc61ca5,_0x2abfea){return client[_0x82f5('0xb')](_0x2902ab,_0x43004b)[_0x82f5('0xc')](function(_0x547446){logger[_0x82f5('0xd')](_0x82f5('0xe'),_0x1ab6e9,_0x82f5('0xf'));logger['debug'](_0x82f5('0x10'),_0x1ab6e9,'request\x20sent',JSON[_0x82f5('0x11')](_0x547446));if(_0x547446['error']){if(_0x547446['error'][_0x82f5('0x12')]===0x1f4){logger['error'](_0x82f5('0xe'),_0x1ab6e9,_0x547446[_0x82f5('0x13')]['message']);return _0x2abfea(_0x547446[_0x82f5('0x13')][_0x82f5('0x14')]);}logger[_0x82f5('0x13')](_0x82f5('0xe'),_0x1ab6e9,_0x547446[_0x82f5('0x13')][_0x82f5('0x14')]);return _0xc61ca5(_0x547446[_0x82f5('0x13')][_0x82f5('0x14')]);}else{logger[_0x82f5('0xd')](_0x82f5('0xe'),_0x1ab6e9,'request\x20sent');_0xc61ca5(_0x547446[_0x82f5('0x15')][_0x82f5('0x14')]);}})[_0x82f5('0x16')](function(_0x316c75){logger[_0x82f5('0x13')](_0x82f5('0xe'),_0x1ab6e9,_0x316c75);_0x2abfea(_0x316c75);});});}exports[_0x82f5('0x17')]=function(_0x1e27f0){var _0x3265dc=this;return new Promise(function(_0x24bfc9,_0x3c366a){return db[_0x82f5('0x18')][_0x82f5('0x19')](_0x1e27f0['body'],{'raw':_0x1e27f0['options']?_0x1e27f0['options'][_0x82f5('0x1a')]===undefined?!![]:![]:!![]})[_0x82f5('0xc')](function(_0x52fb29){logger[_0x82f5('0xd')]('CreateSquareMessage',_0x1e27f0);logger['debug'](_0x82f5('0x17'),_0x1e27f0,JSON[_0x82f5('0x11')](_0x52fb29));_0x24bfc9(_0x52fb29);})[_0x82f5('0x16')](function(_0x13ea10){logger['error'](_0x82f5('0x17'),_0x13ea10[_0x82f5('0x14')],_0x1e27f0);_0x3c366a(_0x3265dc['error'](0x1f4,_0x13ea10[_0x82f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index b632b4a..8590125 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 _0x01b4=['update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','create','put'];(function(_0x29186d,_0x4743c9){var _0x157360=function(_0x5d909c){while(--_0x5d909c){_0x29186d['push'](_0x29186d['shift']());}};_0x157360(++_0x4743c9);}(_0x01b4,0x153));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x401b('0x0'));var util=require(_0x401b('0x1'));var path=require('path');var timeout=require(_0x401b('0x2'));var express=require(_0x401b('0x3'));var router=express[_0x401b('0x4')]();var fs_extra=require(_0x401b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x401b('0x6'));var config=require('../../config/environment');var controller=require(_0x401b('0x7'));router[_0x401b('0x8')]('/',auth[_0x401b('0x9')](),controller[_0x401b('0xa')]);router[_0x401b('0x8')](_0x401b('0xb'),auth[_0x401b('0x9')](),controller[_0x401b('0xc')]);router['get']('/:id/test',auth[_0x401b('0x9')](),timeout(_0x401b('0xd')),controller[_0x401b('0xe')]);router[_0x401b('0xf')]('/',auth[_0x401b('0x9')](),controller[_0x401b('0x10')]);router[_0x401b('0x11')](_0x401b('0xb'),auth[_0x401b('0x9')](),controller[_0x401b('0x12')]);router[_0x401b('0x13')](_0x401b('0xb'),auth[_0x401b('0x9')](),controller[_0x401b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x6955=['post','create','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','show','test'];(function(_0x105d2e,_0xefc0f9){var _0x44969d=function(_0x2fca67){while(--_0x2fca67){_0x105d2e['push'](_0x105d2e['shift']());}};_0x44969d(++_0xefc0f9);}(_0x6955,0x125));var _0x5695=function(_0x11d2dd,_0x838ac5){_0x11d2dd=_0x11d2dd-0x0;var _0x428d1f=_0x6955[_0x11d2dd];return _0x428d1f;};'use strict';var multer=require('multer');var util=require(_0x5695('0x0'));var path=require(_0x5695('0x1'));var timeout=require(_0x5695('0x2'));var express=require(_0x5695('0x3'));var router=express['Router']();var fs_extra=require(_0x5695('0x4'));var auth=require(_0x5695('0x5'));var interaction=require(_0x5695('0x6'));var config=require('../../config/environment');var controller=require(_0x5695('0x7'));router[_0x5695('0x8')]('/',auth[_0x5695('0x9')](),controller[_0x5695('0xa')]);router[_0x5695('0x8')]('/:id',auth[_0x5695('0x9')](),controller[_0x5695('0xb')]);router[_0x5695('0x8')]('/:id/test',auth[_0x5695('0x9')](),timeout('15s'),controller[_0x5695('0xc')]);router[_0x5695('0xd')]('/',auth[_0x5695('0x9')](),controller[_0x5695('0xe')]);router['put']('/:id',auth[_0x5695('0x9')](),controller['update']);router['delete'](_0x5695('0xf'),auth['isAuthenticated'](),controller[_0x5695('0x10')]);module[_0x5695('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9f089a8..03428ef 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 _0x48fa=['exports','name','STRING','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x48fa,0xdf));var _0xa48f=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x48fa[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xa48f('0x0'));module[_0xa48f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xa48f('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa48f('0x3')]},'description':{'type':Sequelize[_0xa48f('0x3')]}}; \ No newline at end of file +var _0x63d0=['exports','STRING','name'];(function(_0x2899e2,_0x1f7380){var _0x49354a=function(_0x5573a6){while(--_0x5573a6){_0x2899e2['push'](_0x2899e2['shift']());}};_0x49354a(++_0x1f7380);}(_0x63d0,0x14d));var _0x063d=function(_0x1c3b85,_0x461050){_0x1c3b85=_0x1c3b85-0x0;var _0x5cf1d3=_0x63d0[_0x1c3b85];return _0x5cf1d3;};'use strict';var Sequelize=require('sequelize');module[_0x063d('0x0')]={'name':{'type':Sequelize[_0x063d('0x1')],'unique':_0x063d('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x063d('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 2a309fd..05bbae2 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 _0x2c31=['then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','send','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','show','params','length','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x438482,_0x259044){var _0x8967d6=function(_0x5b5545){while(--_0x5b5545){_0x438482['push'](_0x438482['shift']());}};_0x8967d6(++_0x259044);}(_0x2c31,0xea));var _0x12c3=function(_0x36474f,_0x162d5c){_0x36474f=_0x36474f-0x0;var _0xe12f93=_0x2c31[_0x36474f];return _0xe12f93;};'use strict';var emlformat=require(_0x12c3('0x0'));var rimraf=require(_0x12c3('0x1'));var zipdir=require(_0x12c3('0x2'));var jsonpatch=require(_0x12c3('0x3'));var rp=require(_0x12c3('0x4'));var moment=require(_0x12c3('0x5'));var BPromise=require(_0x12c3('0x6'));var Mustache=require(_0x12c3('0x7'));var util=require(_0x12c3('0x8'));var path=require(_0x12c3('0x9'));var sox=require('sox');var csv=require(_0x12c3('0xa'));var ejs=require(_0x12c3('0xb'));var fs=require('fs');var fs_extra=require(_0x12c3('0xc'));var _=require(_0x12c3('0xd'));var squel=require(_0x12c3('0xe'));var crypto=require(_0x12c3('0xf'));var jsforce=require(_0x12c3('0x10'));var deskjs=require(_0x12c3('0x11'));var toCsv=require(_0x12c3('0xa'));var querystring=require(_0x12c3('0x12'));var Papa=require(_0x12c3('0x13'));var Redis=require(_0x12c3('0x14'));var authService=require(_0x12c3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x12c3('0x16'));var hardwareService=require(_0x12c3('0x17'));var logger=require(_0x12c3('0x18'))('api');var utils=require(_0x12c3('0x19'));var config=require(_0x12c3('0x1a'));var licenseUtil=require(_0x12c3('0x1b'));var db=require(_0x12c3('0x1c'))['db'];function respondWithStatusCode(_0x39bbe3,_0x487e3c){_0x487e3c=_0x487e3c||0xcc;return function(_0x184c10){if(_0x184c10){return _0x39bbe3[_0x12c3('0x1d')](_0x487e3c);}return _0x39bbe3[_0x12c3('0x1e')](_0x487e3c)['end']();};}function respondWithResult(_0x395546,_0x1e6fce){_0x1e6fce=_0x1e6fce||0xc8;return function(_0x43248f){if(_0x43248f){return _0x395546[_0x12c3('0x1e')](_0x1e6fce)[_0x12c3('0x1f')](_0x43248f);}};}function respondWithFilteredResult(_0x42da7c,_0x58194a){return function(_0x41dd62){if(_0x41dd62){var _0x49f3fd=typeof _0x58194a[_0x12c3('0x20')]===_0x12c3('0x21')&&typeof _0x58194a['limit']===_0x12c3('0x21');var _0x25c42e=_0x41dd62['count'];var _0x307077=_0x49f3fd?0x0:_0x58194a[_0x12c3('0x20')];var _0x4136e5=_0x49f3fd?_0x41dd62[_0x12c3('0x22')]:_0x58194a[_0x12c3('0x20')]+_0x58194a[_0x12c3('0x23')];var _0x459e1e;if(_0x4136e5>=_0x25c42e){_0x4136e5=_0x25c42e;_0x459e1e=0xc8;}else{_0x459e1e=0xce;}_0x42da7c[_0x12c3('0x1e')](_0x459e1e);return _0x42da7c[_0x12c3('0x24')](_0x12c3('0x25'),_0x307077+'-'+_0x4136e5+'/'+_0x25c42e)[_0x12c3('0x1f')](_0x41dd62);}return null;};}function patchUpdates(_0x216dcf){return function(_0x104635){try{jsonpatch[_0x12c3('0x26')](_0x104635,_0x216dcf,!![]);}catch(_0x162d89){return BPromise[_0x12c3('0x27')](_0x162d89);}return _0x104635[_0x12c3('0x28')]();};}function saveUpdates(_0x3187c9,_0x2ca31d){return function(_0x136919){if(_0x136919){return _0x136919[_0x12c3('0x29')](_0x3187c9)[_0x12c3('0x2a')](function(_0x30e7a5){return _0x30e7a5;});}return null;};}function removeEntity(_0x4ecae8,_0x55cfca){return function(_0x478ace){if(_0x478ace){return _0x478ace[_0x12c3('0x2b')]()[_0x12c3('0x2a')](function(){var _0x366ae5=_0x478ace[_0x12c3('0x2c')]({'plain':!![]});var _0x56a296=_0x12c3('0x2d');return db[_0x12c3('0x2e')]['destroy']({'where':{'type':_0x56a296,'resourceId':_0x366ae5['id']}})['then'](function(){return _0x478ace;});})[_0x12c3('0x2a')](function(){_0x4ecae8[_0x12c3('0x1e')](0xcc)[_0x12c3('0x2f')]();});}};}function handleEntityNotFound(_0xddde85,_0x2b772f){return function(_0xd28528){if(!_0xd28528){_0xddde85[_0x12c3('0x1d')](0x194);}return _0xd28528;};}function handleError(_0x528bdd,_0x20a74b){_0x20a74b=_0x20a74b||0x1f4;return function(_0x452000){logger[_0x12c3('0x30')](_0x452000[_0x12c3('0x31')]);if(_0x452000[_0x12c3('0x32')]){delete _0x452000[_0x12c3('0x32')];}_0x528bdd[_0x12c3('0x1e')](_0x20a74b)[_0x12c3('0x33')](_0x452000);};}exports['index']=function(_0x2360f3,_0x225eb1){var _0x3a515e={},_0x4a5b9e={},_0xbc1fe7={'count':0x0,'rows':[]};var _0x3e9c69=_['map'](db[_0x12c3('0x34')][_0x12c3('0x35')],function(_0x176ce4){return{'name':_0x176ce4[_0x12c3('0x36')],'type':_0x176ce4[_0x12c3('0x37')][_0x12c3('0x38')]};});_0x4a5b9e[_0x12c3('0x39')]=_['map'](_0x3e9c69,_0x12c3('0x32'));_0x4a5b9e[_0x12c3('0x3a')]=_[_0x12c3('0x3b')](_0x2360f3[_0x12c3('0x3a')]);_0x4a5b9e[_0x12c3('0x3c')]=_[_0x12c3('0x3d')](_0x4a5b9e[_0x12c3('0x39')],_0x4a5b9e[_0x12c3('0x3a')]);_0x3a515e[_0x12c3('0x3e')]=_[_0x12c3('0x3d')](_0x4a5b9e[_0x12c3('0x39')],qs[_0x12c3('0x3f')](_0x2360f3['query'][_0x12c3('0x3f')]));_0x3a515e[_0x12c3('0x3e')]=_0x3a515e[_0x12c3('0x3e')]['length']?_0x3a515e[_0x12c3('0x3e')]:_0x4a5b9e[_0x12c3('0x39')];if(!_0x2360f3[_0x12c3('0x3a')][_0x12c3('0x40')](_0x12c3('0x41'))){_0x3a515e['limit']=qs[_0x12c3('0x23')](_0x2360f3['query'][_0x12c3('0x23')]);_0x3a515e['offset']=qs[_0x12c3('0x20')](_0x2360f3[_0x12c3('0x3a')]['offset']);}_0x3a515e['order']=qs['sort'](_0x2360f3[_0x12c3('0x3a')][_0x12c3('0x42')]);_0x3a515e['where']=qs[_0x12c3('0x3c')](_[_0x12c3('0x43')](_0x2360f3[_0x12c3('0x3a')],_0x4a5b9e[_0x12c3('0x3c')]),_0x3e9c69);if(_0x2360f3[_0x12c3('0x3a')][_0x12c3('0x44')]){_0x3a515e[_0x12c3('0x45')]=_[_0x12c3('0x46')](_0x3a515e['where'],{'$or':_[_0x12c3('0x47')](_0x3e9c69,function(_0x54512a){if(_0x54512a[_0x12c3('0x37')]!==_0x12c3('0x48')){var _0x4f215b={};_0x4f215b[_0x54512a[_0x12c3('0x32')]]={'$like':'%'+_0x2360f3['query'][_0x12c3('0x44')]+'%'};return _0x4f215b;}})});}_0x3a515e=_['merge']({},_0x3a515e,_0x2360f3[_0x12c3('0x49')]);var _0x1250fd={'where':_0x3a515e[_0x12c3('0x45')]};return db[_0x12c3('0x34')][_0x12c3('0x22')](_0x1250fd)[_0x12c3('0x2a')](function(_0x353885){_0xbc1fe7[_0x12c3('0x22')]=_0x353885;if(_0x2360f3[_0x12c3('0x3a')][_0x12c3('0x4a')]){_0x3a515e[_0x12c3('0x4b')]=[{'all':!![]}];}return db[_0x12c3('0x34')][_0x12c3('0x4c')](_0x3a515e);})[_0x12c3('0x2a')](function(_0xf83c27){_0xbc1fe7['rows']=_0xf83c27;return _0xbc1fe7;})[_0x12c3('0x2a')](respondWithFilteredResult(_0x225eb1,_0x3a515e))['catch'](handleError(_0x225eb1,null));};exports[_0x12c3('0x4d')]=function(_0x406e05,_0x516980){var _0x1cabb8={'raw':!![],'where':{'id':_0x406e05[_0x12c3('0x4e')]['id']}},_0x283180={};_0x283180[_0x12c3('0x39')]=_[_0x12c3('0x3b')](db[_0x12c3('0x34')][_0x12c3('0x35')]);_0x283180[_0x12c3('0x3a')]=_[_0x12c3('0x3b')](_0x406e05[_0x12c3('0x3a')]);_0x283180[_0x12c3('0x3c')]=_[_0x12c3('0x3d')](_0x283180[_0x12c3('0x39')],_0x283180[_0x12c3('0x3a')]);_0x1cabb8['attributes']=_[_0x12c3('0x3d')](_0x283180[_0x12c3('0x39')],qs[_0x12c3('0x3f')](_0x406e05[_0x12c3('0x3a')][_0x12c3('0x3f')]));_0x1cabb8[_0x12c3('0x3e')]=_0x1cabb8[_0x12c3('0x3e')][_0x12c3('0x4f')]?_0x1cabb8[_0x12c3('0x3e')]:_0x283180[_0x12c3('0x39')];if(_0x406e05[_0x12c3('0x3a')][_0x12c3('0x4a')]){_0x1cabb8[_0x12c3('0x4b')]=[{'all':!![]}];}_0x1cabb8=_[_0x12c3('0x46')]({},_0x1cabb8,_0x406e05[_0x12c3('0x49')]);return db[_0x12c3('0x34')]['find'](_0x1cabb8)[_0x12c3('0x2a')](handleEntityNotFound(_0x516980,null))[_0x12c3('0x2a')](respondWithResult(_0x516980,null))[_0x12c3('0x50')](handleError(_0x516980,null));};exports[_0x12c3('0x51')]=function(_0x54c6fc,_0x1f45ed){return db[_0x12c3('0x34')][_0x12c3('0x51')](_0x54c6fc[_0x12c3('0x52')],{})[_0x12c3('0x2a')](function(_0x10136c){var _0x276499=_0x54c6fc[_0x12c3('0x53')][_0x12c3('0x2c')]({'plain':!![]});if(!_0x276499)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x276499['role']==='user'){var _0x171312=_0x10136c[_0x12c3('0x2c')]({'plain':!![]});var _0x1ab701=_0x12c3('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x1ab701,'userProfileId':_0x276499[_0x12c3('0x54')]},'raw':!![]})[_0x12c3('0x2a')](function(_0x37125a){if(_0x37125a&&_0x37125a[_0x12c3('0x55')]===0x0){return db['UserProfileResource'][_0x12c3('0x51')]({'name':_0x171312['name'],'resourceId':_0x171312['id'],'type':_0x37125a[_0x12c3('0x32')],'sectionId':_0x37125a['id']},{})['then'](function(){return _0x10136c;});}else{return _0x10136c;}})[_0x12c3('0x50')](function(_0x5114eb){logger[_0x12c3('0x30')](_0x12c3('0x56'),_0x5114eb);throw _0x5114eb;});}return _0x10136c;})[_0x12c3('0x2a')](respondWithResult(_0x1f45ed,0xc9))[_0x12c3('0x50')](handleError(_0x1f45ed,null));};exports['update']=function(_0x4131a8,_0x5771a1){if(_0x4131a8['body']['id']){delete _0x4131a8['body']['id'];}return db[_0x12c3('0x34')]['find']({'where':{'id':_0x4131a8[_0x12c3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5771a1,null))[_0x12c3('0x2a')](saveUpdates(_0x4131a8[_0x12c3('0x52')],null))[_0x12c3('0x2a')](respondWithResult(_0x5771a1,null))[_0x12c3('0x50')](handleError(_0x5771a1,null));};exports[_0x12c3('0x2b')]=function(_0x4fdde4,_0x31be70){return db[_0x12c3('0x34')]['find']({'where':{'id':_0x4fdde4[_0x12c3('0x4e')]['id']}})[_0x12c3('0x2a')](handleEntityNotFound(_0x31be70,null))[_0x12c3('0x2a')](removeEntity(_0x31be70,null))[_0x12c3('0x50')](handleError(_0x31be70,null));};exports[_0x12c3('0x57')]=function(_0x4f8dff,_0x5bc1c3,_0x583540){var _0x30532e;return db[_0x12c3('0x34')]['find']({'where':{'id':_0x4f8dff['params']['id']},'attributes':['id','dsn']})[_0x12c3('0x2a')](handleEntityNotFound(_0x5bc1c3,null))[_0x12c3('0x2a')](function(_0x146d5f){if(_0x146d5f){var _0x1c37f3=require(_0x12c3('0x58'))();_0x1c37f3[_0x12c3('0x59')](_0x146d5f[_0x12c3('0x5a')]);_0x1c37f3[_0x12c3('0x5b')]();return _0x146d5f;}})['then'](respondWithResult(_0x5bc1c3,null))[_0x12c3('0x50')](handleError(_0x5bc1c3,null));}; \ No newline at end of file +var _0x87e4=['then','get','ODBC','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','SquareOdbc','findAll','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','catch','dsn','odbc','openSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x87e4,0x185));var _0x487e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x87e4[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x487e('0x0'));var rimraf=require(_0x487e('0x1'));var zipdir=require(_0x487e('0x2'));var jsonpatch=require(_0x487e('0x3'));var rp=require(_0x487e('0x4'));var moment=require('moment');var BPromise=require(_0x487e('0x5'));var Mustache=require(_0x487e('0x6'));var util=require(_0x487e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x487e('0x8'));var ejs=require(_0x487e('0x9'));var fs=require('fs');var fs_extra=require(_0x487e('0xa'));var _=require(_0x487e('0xb'));var squel=require(_0x487e('0xc'));var crypto=require(_0x487e('0xd'));var jsforce=require(_0x487e('0xe'));var deskjs=require(_0x487e('0xf'));var toCsv=require(_0x487e('0x8'));var querystring=require(_0x487e('0x10'));var Papa=require(_0x487e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x487e('0x12'));var as=require(_0x487e('0x13'));var hardwareService=require(_0x487e('0x14'));var logger=require(_0x487e('0x15'))('api');var utils=require(_0x487e('0x16'));var config=require(_0x487e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x487e('0x18'))['db'];function respondWithStatusCode(_0xac7aa8,_0x27a1c0){_0x27a1c0=_0x27a1c0||0xcc;return function(_0x1076fe){if(_0x1076fe){return _0xac7aa8['sendStatus'](_0x27a1c0);}return _0xac7aa8[_0x487e('0x19')](_0x27a1c0)[_0x487e('0x1a')]();};}function respondWithResult(_0x39b669,_0x405630){_0x405630=_0x405630||0xc8;return function(_0x57fe01){if(_0x57fe01){return _0x39b669[_0x487e('0x19')](_0x405630)[_0x487e('0x1b')](_0x57fe01);}};}function respondWithFilteredResult(_0x4a3dec,_0x3bf29b){return function(_0x13eb4d){if(_0x13eb4d){var _0x2f30a4=typeof _0x3bf29b[_0x487e('0x1c')]===_0x487e('0x1d')&&typeof _0x3bf29b[_0x487e('0x1e')]===_0x487e('0x1d');var _0x42e9e5=_0x13eb4d[_0x487e('0x1f')];var _0x59bd81=_0x2f30a4?0x0:_0x3bf29b[_0x487e('0x1c')];var _0x539328=_0x2f30a4?_0x13eb4d[_0x487e('0x1f')]:_0x3bf29b[_0x487e('0x1c')]+_0x3bf29b[_0x487e('0x1e')];var _0x5adbdb;if(_0x539328>=_0x42e9e5){_0x539328=_0x42e9e5;_0x5adbdb=0xc8;}else{_0x5adbdb=0xce;}_0x4a3dec[_0x487e('0x19')](_0x5adbdb);return _0x4a3dec['set'](_0x487e('0x20'),_0x59bd81+'-'+_0x539328+'/'+_0x42e9e5)[_0x487e('0x1b')](_0x13eb4d);}return null;};}function patchUpdates(_0x34e69f){return function(_0x2fae8d){try{jsonpatch[_0x487e('0x21')](_0x2fae8d,_0x34e69f,!![]);}catch(_0x6c670){return BPromise['reject'](_0x6c670);}return _0x2fae8d[_0x487e('0x22')]();};}function saveUpdates(_0x34bdeb,_0x11f436){return function(_0x5576e2){if(_0x5576e2){return _0x5576e2[_0x487e('0x23')](_0x34bdeb)[_0x487e('0x24')](function(_0x256f4c){return _0x256f4c;});}return null;};}function removeEntity(_0x2bf174,_0x3ea02d){return function(_0x392fe4){if(_0x392fe4){return _0x392fe4['destroy']()[_0x487e('0x24')](function(){var _0x32c56e=_0x392fe4[_0x487e('0x25')]({'plain':!![]});var _0x314633=_0x487e('0x26');return db[_0x487e('0x27')][_0x487e('0x28')]({'where':{'type':_0x314633,'resourceId':_0x32c56e['id']}})[_0x487e('0x24')](function(){return _0x392fe4;});})['then'](function(){_0x2bf174['status'](0xcc)[_0x487e('0x1a')]();});}};}function handleEntityNotFound(_0x307a7d,_0x31ccb5){return function(_0x231d72){if(!_0x231d72){_0x307a7d[_0x487e('0x29')](0x194);}return _0x231d72;};}function handleError(_0x3b9c8d,_0x397c19){_0x397c19=_0x397c19||0x1f4;return function(_0x570572){logger[_0x487e('0x2a')](_0x570572[_0x487e('0x2b')]);if(_0x570572[_0x487e('0x2c')]){delete _0x570572[_0x487e('0x2c')];}_0x3b9c8d[_0x487e('0x19')](_0x397c19)[_0x487e('0x2d')](_0x570572);};}exports[_0x487e('0x2e')]=function(_0x498ff1,_0x2298df){var _0xe72bb6={},_0x143510={},_0xe5f16e={'count':0x0,'rows':[]};var _0x2c1b2b=_['map'](db['SquareOdbc'][_0x487e('0x2f')],function(_0x722483){return{'name':_0x722483[_0x487e('0x30')],'type':_0x722483[_0x487e('0x31')][_0x487e('0x32')]};});_0x143510[_0x487e('0x33')]=_[_0x487e('0x34')](_0x2c1b2b,'name');_0x143510[_0x487e('0x35')]=_[_0x487e('0x36')](_0x498ff1[_0x487e('0x35')]);_0x143510[_0x487e('0x37')]=_['intersection'](_0x143510[_0x487e('0x33')],_0x143510[_0x487e('0x35')]);_0xe72bb6[_0x487e('0x38')]=_[_0x487e('0x39')](_0x143510[_0x487e('0x33')],qs[_0x487e('0x3a')](_0x498ff1[_0x487e('0x35')][_0x487e('0x3a')]));_0xe72bb6['attributes']=_0xe72bb6['attributes'][_0x487e('0x3b')]?_0xe72bb6['attributes']:_0x143510[_0x487e('0x33')];if(!_0x498ff1[_0x487e('0x35')][_0x487e('0x3c')](_0x487e('0x3d'))){_0xe72bb6[_0x487e('0x1e')]=qs[_0x487e('0x1e')](_0x498ff1[_0x487e('0x35')][_0x487e('0x1e')]);_0xe72bb6[_0x487e('0x1c')]=qs[_0x487e('0x1c')](_0x498ff1[_0x487e('0x35')][_0x487e('0x1c')]);}_0xe72bb6[_0x487e('0x3e')]=qs[_0x487e('0x3f')](_0x498ff1['query'][_0x487e('0x3f')]);_0xe72bb6[_0x487e('0x40')]=qs[_0x487e('0x37')](_['pick'](_0x498ff1['query'],_0x143510['filters']),_0x2c1b2b);if(_0x498ff1[_0x487e('0x35')][_0x487e('0x41')]){_0xe72bb6['where']=_[_0x487e('0x42')](_0xe72bb6[_0x487e('0x40')],{'$or':_[_0x487e('0x34')](_0x2c1b2b,function(_0x358c17){if(_0x358c17[_0x487e('0x31')]!==_0x487e('0x43')){var _0x1e8cf4={};_0x1e8cf4[_0x358c17[_0x487e('0x2c')]]={'$like':'%'+_0x498ff1[_0x487e('0x35')][_0x487e('0x41')]+'%'};return _0x1e8cf4;}})});}_0xe72bb6=_[_0x487e('0x42')]({},_0xe72bb6,_0x498ff1[_0x487e('0x44')]);var _0x217c13={'where':_0xe72bb6['where']};return db['SquareOdbc']['count'](_0x217c13)[_0x487e('0x24')](function(_0x7380d5){_0xe5f16e[_0x487e('0x1f')]=_0x7380d5;if(_0x498ff1['query']['includeAll']){_0xe72bb6[_0x487e('0x45')]=[{'all':!![]}];}return db[_0x487e('0x46')][_0x487e('0x47')](_0xe72bb6);})[_0x487e('0x24')](function(_0x3a1f28){_0xe5f16e['rows']=_0x3a1f28;return _0xe5f16e;})['then'](respondWithFilteredResult(_0x2298df,_0xe72bb6))['catch'](handleError(_0x2298df,null));};exports[_0x487e('0x48')]=function(_0x54c7ec,_0x498ff2){var _0x92da3b={'raw':!![],'where':{'id':_0x54c7ec[_0x487e('0x49')]['id']}},_0x50136e={};_0x50136e[_0x487e('0x33')]=_[_0x487e('0x36')](db[_0x487e('0x46')]['rawAttributes']);_0x50136e[_0x487e('0x35')]=_[_0x487e('0x36')](_0x54c7ec['query']);_0x50136e[_0x487e('0x37')]=_[_0x487e('0x39')](_0x50136e[_0x487e('0x33')],_0x50136e[_0x487e('0x35')]);_0x92da3b[_0x487e('0x38')]=_[_0x487e('0x39')](_0x50136e['model'],qs[_0x487e('0x3a')](_0x54c7ec['query']['fields']));_0x92da3b[_0x487e('0x38')]=_0x92da3b['attributes'][_0x487e('0x3b')]?_0x92da3b['attributes']:_0x50136e[_0x487e('0x33')];if(_0x54c7ec[_0x487e('0x35')]['includeAll']){_0x92da3b[_0x487e('0x45')]=[{'all':!![]}];}_0x92da3b=_[_0x487e('0x42')]({},_0x92da3b,_0x54c7ec[_0x487e('0x44')]);return db[_0x487e('0x46')][_0x487e('0x4a')](_0x92da3b)[_0x487e('0x24')](handleEntityNotFound(_0x498ff2,null))['then'](respondWithResult(_0x498ff2,null))['catch'](handleError(_0x498ff2,null));};exports['create']=function(_0x1b4a57,_0x5c52b6){return db[_0x487e('0x46')][_0x487e('0x4b')](_0x1b4a57[_0x487e('0x4c')],{})[_0x487e('0x24')](function(_0x49e3d6){var _0x434df0=_0x1b4a57[_0x487e('0x4d')][_0x487e('0x25')]({'plain':!![]});if(!_0x434df0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x434df0['role']==='user'){var _0x13ede1=_0x49e3d6['get']({'plain':!![]});var _0x243080=_0x487e('0x26');return db[_0x487e('0x4e')][_0x487e('0x4a')]({'where':{'name':_0x243080,'userProfileId':_0x434df0[_0x487e('0x4f')]},'raw':!![]})[_0x487e('0x24')](function(_0x37ff5){if(_0x37ff5&&_0x37ff5[_0x487e('0x50')]===0x0){return db[_0x487e('0x27')][_0x487e('0x4b')]({'name':_0x13ede1[_0x487e('0x2c')],'resourceId':_0x13ede1['id'],'type':_0x37ff5[_0x487e('0x2c')],'sectionId':_0x37ff5['id']},{})[_0x487e('0x24')](function(){return _0x49e3d6;});}else{return _0x49e3d6;}})['catch'](function(_0x2f0ff3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f0ff3);throw _0x2f0ff3;});}return _0x49e3d6;})[_0x487e('0x24')](respondWithResult(_0x5c52b6,0xc9))['catch'](handleError(_0x5c52b6,null));};exports[_0x487e('0x23')]=function(_0x112c8b,_0x540101){if(_0x112c8b[_0x487e('0x4c')]['id']){delete _0x112c8b[_0x487e('0x4c')]['id'];}return db['SquareOdbc'][_0x487e('0x4a')]({'where':{'id':_0x112c8b[_0x487e('0x49')]['id']}})[_0x487e('0x24')](handleEntityNotFound(_0x540101,null))[_0x487e('0x24')](saveUpdates(_0x112c8b['body'],null))[_0x487e('0x24')](respondWithResult(_0x540101,null))[_0x487e('0x51')](handleError(_0x540101,null));};exports[_0x487e('0x28')]=function(_0x2714ea,_0x3d354e){return db[_0x487e('0x46')][_0x487e('0x4a')]({'where':{'id':_0x2714ea[_0x487e('0x49')]['id']}})[_0x487e('0x24')](handleEntityNotFound(_0x3d354e,null))[_0x487e('0x24')](removeEntity(_0x3d354e,null))[_0x487e('0x51')](handleError(_0x3d354e,null));};exports['test']=function(_0xb4451f,_0x1ece33,_0x51db8c){var _0x3c059a;return db[_0x487e('0x46')][_0x487e('0x4a')]({'where':{'id':_0xb4451f['params']['id']},'attributes':['id',_0x487e('0x52')]})['then'](handleEntityNotFound(_0x1ece33,null))['then'](function(_0x551b78){if(_0x551b78){var _0xa4f82e=require(_0x487e('0x53'))();_0xa4f82e[_0x487e('0x54')](_0x551b78[_0x487e('0x52')]);_0xa4f82e['closeSync']();return _0x551b78;}})['then'](respondWithResult(_0x1ece33,null))[_0x487e('0x51')](handleError(_0x1ece33,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7da8155..51b6f62 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 _0x9ffd=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x385796,_0x22d3fa){var _0x2d2ca2=function(_0xc2615){while(--_0xc2615){_0x385796['push'](_0x385796['shift']());}};_0x2d2ca2(++_0x22d3fa);}(_0x9ffd,0xcb));var _0xd9ff=function(_0x16ce4d,_0x5a5e1c){_0x16ce4d=_0x16ce4d-0x0;var _0x33211b=_0x9ffd[_0x16ce4d];return _0x33211b;};'use strict';var _=require(_0xd9ff('0x0'));var util=require('util');var logger=require(_0xd9ff('0x1'))(_0xd9ff('0x2'));var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd9ff('0x6'));module[_0xd9ff('0x7')]=function(_0x2f15d8,_0x19fdb4){return _0x2f15d8[_0xd9ff('0x8')](_0xd9ff('0x9'),attributes,{'tableName':_0xd9ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec42=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2744b1,_0x592b9b){var _0x2bddf6=function(_0x2181ba){while(--_0x2181ba){_0x2744b1['push'](_0x2744b1['shift']());}};_0x2bddf6(++_0x592b9b);}(_0xec42,0x19b));var _0x2ec4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ec4('0x0'));var util=require(_0x2ec4('0x1'));var logger=require(_0x2ec4('0x2'))(_0x2ec4('0x3'));var moment=require('moment');var BPromise=require(_0x2ec4('0x4'));var rp=require(_0x2ec4('0x5'));var fs=require('fs');var path=require(_0x2ec4('0x6'));var rimraf=require(_0x2ec4('0x7'));var config=require(_0x2ec4('0x8'));var attributes=require(_0x2ec4('0x9'));module[_0x2ec4('0xa')]=function(_0x290bb6,_0x3c25e8){return _0x290bb6[_0x2ec4('0xb')](_0x2ec4('0xc'),attributes,{'tableName':_0x2ec4('0xd'),'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 1c82627..ca4f60d 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 _0x543c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','attributes','include','map','model','then','moment','bluebird','ioredis','../../mysqldb'];(function(_0x469f81,_0x2d9a52){var _0x1531e1=function(_0x616218){while(--_0x616218){_0x469f81['push'](_0x469f81['shift']());}};_0x1531e1(++_0x2d9a52);}(_0x543c,0x17c));var _0xc543=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x543c[_0x5a6de2];return _0x2c0525;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc543('0x0'));var BPromise=require(_0xc543('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc543('0x2'));var db=require(_0xc543('0x3'))['db'];var utils=require(_0xc543('0x4'));var logger=require(_0xc543('0x5'))(_0xc543('0x6'));var config=require(_0xc543('0x7'));var jayson=require(_0xc543('0x8'));var client=jayson[_0xc543('0x9')][_0xc543('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35360f,_0xabe6d1,_0x3ff7d6){return new BPromise(function(_0x5052b0,_0x20ac81){return client[_0xc543('0xb')](_0x35360f,_0x3ff7d6)['then'](function(_0x7c3597){logger[_0xc543('0xc')](_0xc543('0xd'),_0xabe6d1,_0xc543('0xe'));logger[_0xc543('0xf')](_0xc543('0x10'),_0xabe6d1,_0xc543('0xe'),JSON[_0xc543('0x11')](_0x7c3597));if(_0x7c3597[_0xc543('0x12')]){if(_0x7c3597[_0xc543('0x12')][_0xc543('0x13')]===0x1f4){logger[_0xc543('0x12')](_0xc543('0xd'),_0xabe6d1,_0x7c3597[_0xc543('0x12')][_0xc543('0x14')]);return _0x20ac81(_0x7c3597[_0xc543('0x12')][_0xc543('0x14')]);}logger['error'](_0xc543('0xd'),_0xabe6d1,_0x7c3597[_0xc543('0x12')][_0xc543('0x14')]);return _0x5052b0(_0x7c3597['error'][_0xc543('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0xabe6d1,'request\x20sent');_0x5052b0(_0x7c3597[_0xc543('0x15')][_0xc543('0x14')]);}})[_0xc543('0x16')](function(_0x2a218b){logger[_0xc543('0x12')](_0xc543('0xd'),_0xabe6d1,_0x2a218b);_0x20ac81(_0x2a218b);});});}exports[_0xc543('0x17')]=function(_0x20d536){var _0x792cbf=this;return new Promise(function(_0x4dfd3e,_0x4ca6e7){return db['SquareOdbc'][_0xc543('0x18')]({'raw':_0x20d536[_0xc543('0x19')]?_0x20d536['options'][_0xc543('0x1a')]===undefined?!![]:![]:!![],'where':_0x20d536[_0xc543('0x19')]?_0x20d536[_0xc543('0x19')]['where']||null:null,'attributes':_0x20d536[_0xc543('0x19')]?_0x20d536[_0xc543('0x19')][_0xc543('0x1b')]||null:null,'include':_0x20d536[_0xc543('0x19')]?_0x20d536[_0xc543('0x19')]['include']?_['map'](_0x20d536[_0xc543('0x19')][_0xc543('0x1c')],function(_0x339993){return{'model':db[_0x339993['model']],'as':_0x339993['as'],'attributes':_0x339993[_0xc543('0x1b')],'include':_0x339993[_0xc543('0x1c')]?_[_0xc543('0x1d')](_0x339993[_0xc543('0x1c')],function(_0x2113dc){return{'model':db[_0x2113dc[_0xc543('0x1e')]],'as':_0x2113dc['as'],'attributes':_0x2113dc[_0xc543('0x1b')],'include':_0x2113dc['include']?_['map'](_0x2113dc['include'],function(_0x2ca01c){return{'model':db[_0x2ca01c[_0xc543('0x1e')]],'as':_0x2ca01c['as'],'attributes':_0x2ca01c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc543('0x1f')](function(_0x40de6e){logger[_0xc543('0xc')](_0xc543('0x17'),_0x20d536);logger[_0xc543('0xf')](_0xc543('0x17'),_0x20d536,JSON[_0xc543('0x11')](_0x40de6e));_0x4dfd3e(_0x40de6e);})['catch'](function(_0x1c76a0){logger['error']('ShowSquareOdbc',_0x1c76a0['message'],_0x20d536);_0x4ca6e7(_0x792cbf[_0xc543('0x12')](0x1f4,_0x1c76a0[_0xc543('0x14')]));});});}; \ No newline at end of file +var _0x657d=['request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','find','options','raw','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x58119a,_0xef2888){var _0x547261=function(_0x290aa8){while(--_0x290aa8){_0x58119a['push'](_0x58119a['shift']());}};_0x547261(++_0xef2888);}(_0x657d,0x78));var _0xd657=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0x657d[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0xd657('0x0'));var util=require(_0xd657('0x1'));var moment=require(_0xd657('0x2'));var BPromise=require(_0xd657('0x3'));var rs=require(_0xd657('0x4'));var fs=require('fs');var Redis=require(_0xd657('0x5'));var db=require(_0xd657('0x6'))['db'];var utils=require(_0xd657('0x7'));var logger=require(_0xd657('0x8'))(_0xd657('0x9'));var config=require(_0xd657('0xa'));var jayson=require(_0xd657('0xb'));var client=jayson[_0xd657('0xc')][_0xd657('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3d38e0,_0x48929b,_0x3bb670){return new BPromise(function(_0x4210fd,_0x1f14ca){return client['request'](_0x3d38e0,_0x3bb670)[_0xd657('0xe')](function(_0x2c96ad){logger[_0xd657('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x48929b,_0xd657('0x10'));logger[_0xd657('0x11')](_0xd657('0x12'),_0x48929b,'request\x20sent',JSON[_0xd657('0x13')](_0x2c96ad));if(_0x2c96ad['error']){if(_0x2c96ad['error'][_0xd657('0x14')]===0x1f4){logger[_0xd657('0x15')](_0xd657('0x16'),_0x48929b,_0x2c96ad[_0xd657('0x15')][_0xd657('0x17')]);return _0x1f14ca(_0x2c96ad[_0xd657('0x15')][_0xd657('0x17')]);}logger[_0xd657('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x48929b,_0x2c96ad[_0xd657('0x15')][_0xd657('0x17')]);return _0x4210fd(_0x2c96ad[_0xd657('0x15')][_0xd657('0x17')]);}else{logger[_0xd657('0xf')](_0xd657('0x16'),_0x48929b,_0xd657('0x10'));_0x4210fd(_0x2c96ad[_0xd657('0x18')]['message']);}})[_0xd657('0x19')](function(_0x391b40){logger[_0xd657('0x15')](_0xd657('0x16'),_0x48929b,_0x391b40);_0x1f14ca(_0x391b40);});});}exports[_0xd657('0x1a')]=function(_0x4a03e8){var _0x199e59=this;return new Promise(function(_0x12c249,_0x3cd98a){return db['SquareOdbc'][_0xd657('0x1b')]({'raw':_0x4a03e8[_0xd657('0x1c')]?_0x4a03e8['options'][_0xd657('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a03e8[_0xd657('0x1c')]?_0x4a03e8['options']['where']||null:null,'attributes':_0x4a03e8[_0xd657('0x1c')]?_0x4a03e8[_0xd657('0x1c')]['attributes']||null:null,'include':_0x4a03e8['options']?_0x4a03e8['options'][_0xd657('0x1e')]?_['map'](_0x4a03e8[_0xd657('0x1c')][_0xd657('0x1e')],function(_0x3b1051){return{'model':db[_0x3b1051[_0xd657('0x1f')]],'as':_0x3b1051['as'],'attributes':_0x3b1051[_0xd657('0x20')],'include':_0x3b1051[_0xd657('0x1e')]?_[_0xd657('0x21')](_0x3b1051[_0xd657('0x1e')],function(_0x2625a1){return{'model':db[_0x2625a1[_0xd657('0x1f')]],'as':_0x2625a1['as'],'attributes':_0x2625a1[_0xd657('0x20')],'include':_0x2625a1[_0xd657('0x1e')]?_['map'](_0x2625a1[_0xd657('0x1e')],function(_0x470387){return{'model':db[_0x470387['model']],'as':_0x470387['as'],'attributes':_0x470387['attributes']};}):[]};}):[]};}):[]:[]})[_0xd657('0xe')](function(_0x9e11e3){logger[_0xd657('0xf')](_0xd657('0x1a'),_0x4a03e8);logger[_0xd657('0x11')]('ShowSquareOdbc',_0x4a03e8,JSON[_0xd657('0x13')](_0x9e11e3));_0x12c249(_0x9e11e3);})[_0xd657('0x19')](function(_0x143f53){logger[_0xd657('0x15')](_0xd657('0x1a'),_0x143f53['message'],_0x4a03e8);_0x3cd98a(_0x199e59['error'](0x1f4,_0x143f53[_0xd657('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 620a8ce..9fbba35 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 _0xc306=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','/:id/users','post','put','delete','exports'];(function(_0x2f6ea2,_0x4d1816){var _0x4d442d=function(_0x268a4f){while(--_0x268a4f){_0x2f6ea2['push'](_0x2f6ea2['shift']());}};_0x4d442d(++_0x4d1816);}(_0xc306,0x1a9));var _0x6c30=function(_0x5272fa,_0x30fcc2){_0x5272fa=_0x5272fa-0x0;var _0x380909=_0xc306[_0x5272fa];return _0x380909;};'use strict';var multer=require(_0x6c30('0x0'));var util=require('util');var path=require(_0x6c30('0x1'));var timeout=require(_0x6c30('0x2'));var express=require(_0x6c30('0x3'));var router=express[_0x6c30('0x4')]();var fs_extra=require(_0x6c30('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6c30('0x6'));var config=require('../../config/environment');var controller=require(_0x6c30('0x7'));router[_0x6c30('0x8')]('/',auth[_0x6c30('0x9')](),controller[_0x6c30('0xa')]);router[_0x6c30('0x8')](_0x6c30('0xb'),auth[_0x6c30('0x9')](),controller['show']);router[_0x6c30('0x8')](_0x6c30('0xc'),auth[_0x6c30('0x9')](),controller['getUsers']);router[_0x6c30('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6c30('0xd')]('/:id/users',auth['isAuthenticated'](),controller['addUsers']);router[_0x6c30('0xe')](_0x6c30('0xb'),auth[_0x6c30('0x9')](),controller['update']);router[_0x6c30('0xf')]('/:id',auth[_0x6c30('0x9')](),controller['destroy']);router['delete'](_0x6c30('0xc'),auth[_0x6c30('0x9')](),controller['removeUsers']);module[_0x6c30('0x10')]=router; \ No newline at end of file +var _0x7fee=['delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','post','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x7fee[_0x277107];return _0x1da046;};'use strict';var multer=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var path=require(_0xe7fe('0x2'));var timeout=require(_0xe7fe('0x3'));var express=require(_0xe7fe('0x4'));var router=express[_0xe7fe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe7fe('0x6'));var interaction=require(_0xe7fe('0x7'));var config=require(_0xe7fe('0x8'));var controller=require('./squareProject.controller');router[_0xe7fe('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7fe('0xa')]);router[_0xe7fe('0x9')](_0xe7fe('0xb'),auth[_0xe7fe('0xc')](),controller[_0xe7fe('0xd')]);router[_0xe7fe('0x9')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller['getUsers']);router['post']('/',auth[_0xe7fe('0xc')](),controller['create']);router[_0xe7fe('0xf')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0xe7fe('0x10')](_0xe7fe('0xb'),auth['isAuthenticated'](),controller[_0xe7fe('0x11')]);router[_0xe7fe('0x12')](_0xe7fe('0xb'),auth['isAuthenticated'](),controller[_0xe7fe('0x13')]);router[_0xe7fe('0x12')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller[_0xe7fe('0x14')]);module[_0xe7fe('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 0b22bae..d87710b 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 _0x4230=['BLOB','getDataValue','preproduction','toString','long','utf8','DATE','sequelize','exports','STRING'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x4230,0xed));var _0x0423=function(_0x644669,_0x570e6c){_0x644669=_0x644669-0x0;var _0x4ba20d=_0x4230[_0x644669];return _0x4ba20d;};'use strict';var Sequelize=require(_0x0423('0x0'));module[_0x0423('0x1')]={'name':{'type':Sequelize[_0x0423('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0423('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x0423('0x3')]('long'),'get':function(){if(this[_0x0423('0x4')](_0x0423('0x5'))){return this['getDataValue']('preproduction')[_0x0423('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x0423('0x3')](_0x0423('0x7')),'get':function(){if(this[_0x0423('0x4')]('production')){return this['getDataValue']('production')[_0x0423('0x6')](_0x0423('0x8'));}}},'savedAt':{'type':Sequelize[_0x0423('0x9')]},'publishedAt':{'type':Sequelize[_0x0423('0x9')]}}; \ No newline at end of file +var _0xbffe=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','DATE','sequelize','STRING'];(function(_0x436b2f,_0x5779ad){var _0x4f0d90=function(_0x513435){while(--_0x513435){_0x436b2f['push'](_0x436b2f['shift']());}};_0x4f0d90(++_0x5779ad);}(_0xbffe,0x1d4));var _0xebff=function(_0x4773da,_0x29a40d){_0x4773da=_0x4773da-0x0;var _0x173e22=_0xbffe[_0x4773da];return _0x173e22;};'use strict';var Sequelize=require(_0xebff('0x0'));module['exports']={'name':{'type':Sequelize[_0xebff('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xebff('0x2')]},'preproduction':{'type':Sequelize[_0xebff('0x3')]('long'),'get':function(){if(this[_0xebff('0x4')]('preproduction')){return this['getDataValue'](_0xebff('0x5'))[_0xebff('0x6')](_0xebff('0x7'));}}},'production':{'type':Sequelize[_0xebff('0x3')](_0xebff('0x8')),'get':function(){if(this[_0xebff('0x4')]('production')){return this[_0xebff('0x4')]('production')[_0xebff('0x6')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xebff('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2b6ddc5..8dead1c 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 _0x8952=['params','publish','production','addUsers','ids','removeUsers','emit','userSquareProject:remove','getUsers','order','map','hasOwnProperty','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','get','SquareProjects','agi','stringify','error','name','send','SquareProject','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x33669f,_0x430842){var _0x5c89c6=function(_0x378a72){while(--_0x378a72){_0x33669f['push'](_0x33669f['shift']());}};_0x5c89c6(++_0x430842);}(_0x8952,0x17e));var _0x2895=function(_0x481cb8,_0x42be69){_0x481cb8=_0x481cb8-0x0;var _0x3e9446=_0x8952[_0x481cb8];return _0x3e9446;};'use strict';var _=require('lodash');var Redis=require(_0x2895('0x0'));var qs=require(_0x2895('0x1'));var logger=require(_0x2895('0x2'))(_0x2895('0x3'));var config=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];config[_0x2895('0x5')]=_[_0x2895('0x6')](config[_0x2895('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x2895('0x7'))(new Redis(config[_0x2895('0x5')]));require(_0x2895('0x8'))['register'](socket);function respondWithStatusCode(_0x526c32,_0x238b4a){_0x238b4a=_0x238b4a||0xcc;return function(_0x335002){if(_0x335002){return _0x526c32[_0x2895('0x9')](_0x238b4a);}return _0x526c32[_0x2895('0xa')](_0x238b4a)[_0x2895('0xb')]();};}function respondWithResult(_0x4952fa,_0x14fb67){_0x14fb67=_0x14fb67||0xc8;return function(_0x5f2632){if(_0x5f2632){return _0x4952fa[_0x2895('0xa')](_0x14fb67)['json'](_0x5f2632);}};}function respondWithFilteredResult(_0x5e66fc,_0x56c5b9){return function(_0x9bb58c){if(_0x9bb58c){var _0x1829a2=typeof _0x56c5b9[_0x2895('0xc')]==='undefined'&&typeof _0x56c5b9[_0x2895('0xd')]===_0x2895('0xe');var _0x4b1342=_0x9bb58c[_0x2895('0xf')];var _0x2cbeb1=_0x1829a2?0x0:_0x56c5b9['offset'];var _0x590a1b=_0x1829a2?_0x9bb58c[_0x2895('0xf')]:_0x56c5b9[_0x2895('0xc')]+_0x56c5b9['limit'];var _0x2198c3;if(_0x590a1b>=_0x4b1342){_0x590a1b=_0x4b1342;_0x2198c3=0xc8;}else{_0x2198c3=0xce;}_0x5e66fc[_0x2895('0xa')](_0x2198c3);return _0x5e66fc[_0x2895('0x10')](_0x2895('0x11'),_0x2cbeb1+'-'+_0x590a1b+'/'+_0x4b1342)[_0x2895('0x12')](_0x9bb58c);}return null;};}function saveUpdates(_0x2627e6){return function(_0x6a5c7e){if(_0x6a5c7e){return _0x6a5c7e[_0x2895('0x13')](_0x2627e6)[_0x2895('0x14')](function(_0x407b86){return _0x407b86;});}return null;};}function removeEntity(_0x10a1bf){return function(_0x183b05){if(_0x183b05){return _0x183b05[_0x2895('0x15')]()[_0x2895('0x14')](function(){var _0x155124=_0x183b05[_0x2895('0x16')]({'plain':!![]});var _0x2fe8fe=_0x2895('0x17');return db['UserProfileResource']['destroy']({'where':{'type':_0x2fe8fe,'resourceId':_0x155124['id']}})['then'](function(){return _0x183b05;});})[_0x2895('0x14')](function(){var _0x12c2fb=new Redis(config[_0x2895('0x5')]);_0x12c2fb['publish'](_0x2895('0x18'),JSON[_0x2895('0x19')]({'id':_0x183b05['id'],'deleted':!![]}));})[_0x2895('0x14')](function(){_0x10a1bf[_0x2895('0xa')](0xcc)[_0x2895('0xb')]();});}};}function handleEntityNotFound(_0x5dbbfe){return function(_0x30c6c3){if(!_0x30c6c3){_0x5dbbfe[_0x2895('0x9')](0x194);}return _0x30c6c3;};}function handleError(_0x5671fa,_0x142e58){_0x142e58=_0x142e58||0x1f4;return function(_0x384357){logger[_0x2895('0x1a')](_0x384357['stack']);if(_0x384357['name']){delete _0x384357[_0x2895('0x1b')];}_0x5671fa[_0x2895('0xa')](_0x142e58)[_0x2895('0x1c')](_0x384357);};}exports['index']=function(_0x3d3320,_0x3690ce){var _0x480604={},_0x293ad3={},_0x127540={'count':0x0,'rows':[]};var _0x2cd4df=_['map'](db[_0x2895('0x1d')][_0x2895('0x1e')],function(_0x5eedfc){return{'name':_0x5eedfc[_0x2895('0x1f')],'type':_0x5eedfc['type']['key']};});_0x293ad3[_0x2895('0x20')]=_['map'](_0x2cd4df,_0x2895('0x1b'));_0x293ad3[_0x2895('0x21')]=_['keys'](_0x3d3320['query']);_0x293ad3[_0x2895('0x22')]=_[_0x2895('0x23')](_0x293ad3[_0x2895('0x20')],_0x293ad3[_0x2895('0x21')]);_0x480604[_0x2895('0x24')]=_[_0x2895('0x23')](_0x293ad3[_0x2895('0x20')],qs['fields'](_0x3d3320[_0x2895('0x21')][_0x2895('0x25')]));_0x480604[_0x2895('0x24')]=_0x480604['attributes'][_0x2895('0x26')]?_0x480604[_0x2895('0x24')]:_0x293ad3[_0x2895('0x20')];if(!_0x3d3320[_0x2895('0x21')]['hasOwnProperty'](_0x2895('0x27'))){_0x480604[_0x2895('0xd')]=qs[_0x2895('0xd')](_0x3d3320[_0x2895('0x21')][_0x2895('0xd')]);_0x480604['offset']=qs['offset'](_0x3d3320[_0x2895('0x21')][_0x2895('0xc')]);}_0x480604['order']=qs[_0x2895('0x28')](_0x3d3320['query'][_0x2895('0x28')]);_0x480604[_0x2895('0x29')]=qs['filters'](_[_0x2895('0x2a')](_0x3d3320['query'],_0x293ad3[_0x2895('0x22')]),_0x2cd4df);if(_0x3d3320['query']['filter']){_0x480604[_0x2895('0x29')]=_[_0x2895('0x2b')](_0x480604[_0x2895('0x29')],{'$or':_['map'](_0x2cd4df,function(_0x1e4348){if(_0x1e4348[_0x2895('0x2c')]!==_0x2895('0x2d')){var _0x3ff672={};_0x3ff672[_0x1e4348[_0x2895('0x1b')]]={'$like':'%'+_0x3d3320[_0x2895('0x21')][_0x2895('0x2e')]+'%'};return _0x3ff672;}})});}_0x480604=_[_0x2895('0x2b')]({},_0x480604,_0x3d3320[_0x2895('0x2f')]);var _0xa6b8c5={'where':_0x480604['where']};return db[_0x2895('0x1d')][_0x2895('0xf')](_0xa6b8c5)[_0x2895('0x14')](function(_0x1e5788){_0x127540[_0x2895('0xf')]=_0x1e5788;if(_0x3d3320[_0x2895('0x21')][_0x2895('0x30')]){_0x480604['include']=[{'all':!![]}];}return db['SquareProject'][_0x2895('0x31')](_0x480604);})[_0x2895('0x14')](function(_0x24b9e0){_0x127540[_0x2895('0x32')]=_0x24b9e0;return _0x127540;})[_0x2895('0x14')](respondWithFilteredResult(_0x3690ce,_0x480604))[_0x2895('0x33')](handleError(_0x3690ce,null));};exports['show']=function(_0x5d18ef,_0x3f083e){var _0x20208f={'raw':![],'where':{'id':_0x5d18ef['params']['id']}},_0x5ce598={};_0x5ce598[_0x2895('0x20')]=_[_0x2895('0x34')](db[_0x2895('0x1d')][_0x2895('0x1e')]);_0x5ce598[_0x2895('0x21')]=_[_0x2895('0x34')](_0x5d18ef['query']);_0x5ce598[_0x2895('0x22')]=_[_0x2895('0x23')](_0x5ce598[_0x2895('0x20')],_0x5ce598[_0x2895('0x21')]);_0x20208f['attributes']=_[_0x2895('0x23')](_0x5ce598[_0x2895('0x20')],qs[_0x2895('0x25')](_0x5d18ef[_0x2895('0x21')]['fields']));_0x20208f['attributes']=_0x20208f[_0x2895('0x24')][_0x2895('0x26')]?_0x20208f[_0x2895('0x24')]:_0x5ce598[_0x2895('0x20')];if(_0x5d18ef[_0x2895('0x21')]['includeAll']){_0x20208f['include']=[{'all':!![]}];}_0x20208f=_[_0x2895('0x2b')]({},_0x20208f,_0x5d18ef[_0x2895('0x2f')]);return db[_0x2895('0x1d')][_0x2895('0x35')](_0x20208f)[_0x2895('0x14')](handleEntityNotFound(_0x3f083e,null))[_0x2895('0x14')](respondWithResult(_0x3f083e,null))[_0x2895('0x33')](handleError(_0x3f083e,null));};exports['create']=function(_0x1a2bb0,_0x25dd5b){return db[_0x2895('0x1d')][_0x2895('0x36')](_0x1a2bb0[_0x2895('0x37')],{})[_0x2895('0x14')](function(_0x232464){var _0x299d71=_0x1a2bb0['user'][_0x2895('0x16')]({'plain':!![]});if(!_0x299d71)throw new Error(_0x2895('0x38'));if(_0x299d71[_0x2895('0x39')]==='user'){var _0xc85aa1=_0x232464[_0x2895('0x16')]({'plain':!![]});var _0x5e4f70=_0x2895('0x17');return db[_0x2895('0x3a')][_0x2895('0x35')]({'where':{'name':_0x5e4f70,'userProfileId':_0x299d71[_0x2895('0x3b')]},'raw':!![]})[_0x2895('0x14')](function(_0x3cc331){if(_0x3cc331&&_0x3cc331[_0x2895('0x3c')]===0x0){return db['UserProfileResource'][_0x2895('0x36')]({'name':_0xc85aa1[_0x2895('0x1b')],'resourceId':_0xc85aa1['id'],'type':_0x3cc331['name'],'sectionId':_0x3cc331['id']},{})['then'](function(){return _0x232464;});}else{return _0x232464;}})['catch'](function(_0x212a1f){logger[_0x2895('0x1a')](_0x2895('0x3d'),_0x212a1f);throw _0x212a1f;});}return _0x232464;})[_0x2895('0x14')](respondWithResult(_0x25dd5b,0xc9))[_0x2895('0x33')](handleError(_0x25dd5b,null));};exports[_0x2895('0x13')]=function(_0xaca46c,_0x7df911){if(_0xaca46c[_0x2895('0x37')]['id']){delete _0xaca46c[_0x2895('0x37')]['id'];}return db[_0x2895('0x1d')][_0x2895('0x35')]({'where':{'id':_0xaca46c[_0x2895('0x3e')]['id']}})[_0x2895('0x14')](handleEntityNotFound(_0x7df911,null))[_0x2895('0x14')](saveUpdates(_0xaca46c[_0x2895('0x37')],null))[_0x2895('0x14')](function(_0x3e0fde){if(!_0x3e0fde)return;var _0xbcf98=_0x3e0fde[_0x2895('0x16')]({'plain':!![]});return _0xbcf98;})[_0x2895('0x14')](function(_0x90ed5d){var _0x434f23=new Redis(config[_0x2895('0x5')]);_0x434f23[_0x2895('0x3f')](_0x2895('0x18'),JSON[_0x2895('0x19')](_[_0x2895('0x2a')](_0x90ed5d,['id',_0x2895('0x1b'),_0x2895('0x40')])));return _0x90ed5d;})[_0x2895('0x14')](respondWithResult(_0x7df911,null))['catch'](handleError(_0x7df911,null));};exports[_0x2895('0x15')]=function(_0x1f7d91,_0x2bc573){return db[_0x2895('0x1d')][_0x2895('0x35')]({'where':{'id':_0x1f7d91[_0x2895('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2bc573,null))[_0x2895('0x14')](removeEntity(_0x2bc573,null))['catch'](handleError(_0x2bc573,null));};exports[_0x2895('0x41')]=function(_0x2fed1c,_0x319795){return db[_0x2895('0x1d')][_0x2895('0x35')]({'where':{'id':_0x2fed1c['params']['id']}})['then'](handleEntityNotFound(_0x319795,null))[_0x2895('0x14')](function(_0x11d336){if(_0x11d336){return _0x11d336[_0x2895('0x41')](_0x2fed1c['body'][_0x2895('0x42')],_['omit'](_0x2fed1c[_0x2895('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x319795,null))['catch'](handleError(_0x319795,null));};exports['removeUsers']=function(_0x36177d,_0x2ff725){return db[_0x2895('0x1d')][_0x2895('0x35')]({'where':{'id':_0x36177d[_0x2895('0x3e')]['id']}})[_0x2895('0x14')](handleEntityNotFound(_0x2ff725,null))[_0x2895('0x14')](function(_0x5d186c){if(_0x5d186c){return _0x5d186c[_0x2895('0x43')](_0x36177d[_0x2895('0x21')]['ids'])[_0x2895('0x14')](function(){if(_['isArray'](_0x36177d['query'][_0x2895('0x42')])){for(var _0x14d7f9=0x0;_0x14d7f9<_0x36177d['query'][_0x2895('0x42')][_0x2895('0x26')];_0x14d7f9+=0x1){socket[_0x2895('0x44')](_0x2895('0x45'),{'UserId':Number(_0x36177d['query'][_0x2895('0x42')][_0x14d7f9]),'SquareProjectId':Number(_0x36177d['params']['id'])});}}else{socket[_0x2895('0x44')]('userSquareProject:remove',{'UserId':Number(_0x36177d['query'][_0x2895('0x42')]),'SquareProjectId':Number(_0x36177d['params']['id'])});}});}})[_0x2895('0x14')](respondWithStatusCode(_0x2ff725,null))[_0x2895('0x33')](handleError(_0x2ff725,null));};exports[_0x2895('0x46')]=function(_0x559ef3,_0x44eb51){var _0x115357={};var _0x5b6413={};var _0x52f07d;var _0x147074;return db[_0x2895('0x1d')]['findOne']({'where':{'id':_0x559ef3[_0x2895('0x3e')]['id']}})['then'](handleEntityNotFound(_0x44eb51,null))['then'](function(_0x98b64d){if(_0x98b64d){_0x52f07d=_0x98b64d;_0x5b6413[_0x2895('0x20')]=_[_0x2895('0x34')](db['User'][_0x2895('0x1e')]);_0x5b6413[_0x2895('0x21')]=_[_0x2895('0x34')](_0x559ef3[_0x2895('0x21')]);_0x5b6413[_0x2895('0x22')]=_[_0x2895('0x23')](_0x5b6413[_0x2895('0x20')],_0x5b6413['query']);_0x115357[_0x2895('0x24')]=_[_0x2895('0x23')](_0x5b6413[_0x2895('0x20')],qs[_0x2895('0x25')](_0x559ef3[_0x2895('0x21')][_0x2895('0x25')]));_0x115357[_0x2895('0x24')]=_0x115357[_0x2895('0x24')]['length']?_0x115357[_0x2895('0x24')]:_0x5b6413[_0x2895('0x20')];_0x115357[_0x2895('0x47')]=qs[_0x2895('0x28')](_0x559ef3[_0x2895('0x21')][_0x2895('0x28')]);_0x115357[_0x2895('0x29')]=qs[_0x2895('0x22')](_[_0x2895('0x2a')](_0x559ef3[_0x2895('0x21')],_0x5b6413['filters']));if(_0x559ef3[_0x2895('0x21')][_0x2895('0x2e')]){_0x115357[_0x2895('0x29')]=_[_0x2895('0x2b')](_0x115357[_0x2895('0x29')],{'$or':_[_0x2895('0x48')](_0x115357[_0x2895('0x24')],function(_0x438982){var _0x203609={};_0x203609[_0x438982]={'$like':'%'+_0x559ef3[_0x2895('0x21')]['filter']+'%'};return _0x203609;})});}_0x115357=_[_0x2895('0x2b')]({},_0x115357,_0x559ef3[_0x2895('0x2f')]);return _0x52f07d[_0x2895('0x46')](_0x115357);}})[_0x2895('0x14')](function(_0x14561d){if(_0x14561d){_0x147074=_0x14561d['length'];if(!_0x559ef3[_0x2895('0x21')][_0x2895('0x49')]('nolimit')){_0x115357['limit']=qs['limit'](_0x559ef3[_0x2895('0x21')][_0x2895('0xd')]);_0x115357[_0x2895('0xc')]=qs[_0x2895('0xc')](_0x559ef3[_0x2895('0x21')]['offset']);}return _0x52f07d['getUsers'](_0x115357);}})[_0x2895('0x14')](function(_0x580796){if(_0x580796){return _0x580796?{'count':_0x147074,'rows':_0x580796}:null;}})[_0x2895('0x14')](respondWithResult(_0x44eb51,null))['catch'](handleError(_0x44eb51,null));}; \ No newline at end of file +var _0xc4aa=['order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','keys','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','stack','name','send','index','map','SquareProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2f88ee,_0x52bedf){var _0x1ef9fb=function(_0x2ec74e){while(--_0x2ec74e){_0x2f88ee['push'](_0x2f88ee['shift']());}};_0x1ef9fb(++_0x52bedf);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xac4a('0x0'));var Redis=require(_0xac4a('0x1'));var qs=require(_0xac4a('0x2'));var logger=require(_0xac4a('0x3'))(_0xac4a('0x4'));var config=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xac4a('0x6')],{'host':_0xac4a('0x7'),'port':0x18eb});var socket=require(_0xac4a('0x8'))(new Redis(config[_0xac4a('0x6')]));require(_0xac4a('0x9'))[_0xac4a('0xa')](socket);function respondWithStatusCode(_0x3ef77c,_0x10525b){_0x10525b=_0x10525b||0xcc;return function(_0x5c6179){if(_0x5c6179){return _0x3ef77c['sendStatus'](_0x10525b);}return _0x3ef77c[_0xac4a('0xb')](_0x10525b)[_0xac4a('0xc')]();};}function respondWithResult(_0x26ec84,_0x4f4146){_0x4f4146=_0x4f4146||0xc8;return function(_0x1d182e){if(_0x1d182e){return _0x26ec84[_0xac4a('0xb')](_0x4f4146)[_0xac4a('0xd')](_0x1d182e);}};}function respondWithFilteredResult(_0x4d4acc,_0x30135d){return function(_0x488e3c){if(_0x488e3c){var _0x2f062c=typeof _0x30135d['offset']===_0xac4a('0xe')&&typeof _0x30135d[_0xac4a('0xf')]===_0xac4a('0xe');var _0x5e16aa=_0x488e3c[_0xac4a('0x10')];var _0x68424a=_0x2f062c?0x0:_0x30135d[_0xac4a('0x11')];var _0x6e00d4=_0x2f062c?_0x488e3c[_0xac4a('0x10')]:_0x30135d[_0xac4a('0x11')]+_0x30135d[_0xac4a('0xf')];var _0x33c287;if(_0x6e00d4>=_0x5e16aa){_0x6e00d4=_0x5e16aa;_0x33c287=0xc8;}else{_0x33c287=0xce;}_0x4d4acc[_0xac4a('0xb')](_0x33c287);return _0x4d4acc[_0xac4a('0x12')](_0xac4a('0x13'),_0x68424a+'-'+_0x6e00d4+'/'+_0x5e16aa)[_0xac4a('0xd')](_0x488e3c);}return null;};}function saveUpdates(_0x4a2119){return function(_0x402fff){if(_0x402fff){return _0x402fff[_0xac4a('0x14')](_0x4a2119)[_0xac4a('0x15')](function(_0x144553){return _0x144553;});}return null;};}function removeEntity(_0x3e88e3){return function(_0x387a54){if(_0x387a54){return _0x387a54[_0xac4a('0x16')]()[_0xac4a('0x15')](function(){var _0x546c5d=_0x387a54['get']({'plain':!![]});var _0x21a729=_0xac4a('0x17');return db[_0xac4a('0x18')]['destroy']({'where':{'type':_0x21a729,'resourceId':_0x546c5d['id']}})[_0xac4a('0x15')](function(){return _0x387a54;});})[_0xac4a('0x15')](function(){var _0x3752e4=new Redis(config[_0xac4a('0x6')]);_0x3752e4[_0xac4a('0x19')](_0xac4a('0x1a'),JSON[_0xac4a('0x1b')]({'id':_0x387a54['id'],'deleted':!![]}));})[_0xac4a('0x15')](function(){_0x3e88e3['status'](0xcc)[_0xac4a('0xc')]();});}};}function handleEntityNotFound(_0x3204ad){return function(_0x599787){if(!_0x599787){_0x3204ad[_0xac4a('0x1c')](0x194);}return _0x599787;};}function handleError(_0x4169c0,_0x3eacd3){_0x3eacd3=_0x3eacd3||0x1f4;return function(_0x947d8e){logger['error'](_0x947d8e[_0xac4a('0x1d')]);if(_0x947d8e[_0xac4a('0x1e')]){delete _0x947d8e[_0xac4a('0x1e')];}_0x4169c0[_0xac4a('0xb')](_0x3eacd3)[_0xac4a('0x1f')](_0x947d8e);};}exports[_0xac4a('0x20')]=function(_0x222507,_0x36054a){var _0x3e2c69={},_0x3bc318={},_0x1d0539={'count':0x0,'rows':[]};var _0x215a31=_[_0xac4a('0x21')](db[_0xac4a('0x22')][_0xac4a('0x23')],function(_0x20202c){return{'name':_0x20202c['fieldName'],'type':_0x20202c[_0xac4a('0x24')][_0xac4a('0x25')]};});_0x3bc318[_0xac4a('0x26')]=_[_0xac4a('0x21')](_0x215a31,_0xac4a('0x1e'));_0x3bc318['query']=_['keys'](_0x222507[_0xac4a('0x27')]);_0x3bc318[_0xac4a('0x28')]=_[_0xac4a('0x29')](_0x3bc318['model'],_0x3bc318['query']);_0x3e2c69[_0xac4a('0x2a')]=_[_0xac4a('0x29')](_0x3bc318[_0xac4a('0x26')],qs[_0xac4a('0x2b')](_0x222507[_0xac4a('0x27')]['fields']));_0x3e2c69[_0xac4a('0x2a')]=_0x3e2c69['attributes'][_0xac4a('0x2c')]?_0x3e2c69['attributes']:_0x3bc318[_0xac4a('0x26')];if(!_0x222507[_0xac4a('0x27')][_0xac4a('0x2d')](_0xac4a('0x2e'))){_0x3e2c69[_0xac4a('0xf')]=qs[_0xac4a('0xf')](_0x222507[_0xac4a('0x27')][_0xac4a('0xf')]);_0x3e2c69[_0xac4a('0x11')]=qs[_0xac4a('0x11')](_0x222507[_0xac4a('0x27')][_0xac4a('0x11')]);}_0x3e2c69[_0xac4a('0x2f')]=qs[_0xac4a('0x30')](_0x222507['query'][_0xac4a('0x30')]);_0x3e2c69[_0xac4a('0x31')]=qs['filters'](_[_0xac4a('0x32')](_0x222507[_0xac4a('0x27')],_0x3bc318['filters']),_0x215a31);if(_0x222507['query'][_0xac4a('0x33')]){_0x3e2c69[_0xac4a('0x31')]=_[_0xac4a('0x34')](_0x3e2c69[_0xac4a('0x31')],{'$or':_['map'](_0x215a31,function(_0x453d02){if(_0x453d02[_0xac4a('0x24')]!=='VIRTUAL'){var _0x37f2ee={};_0x37f2ee[_0x453d02[_0xac4a('0x1e')]]={'$like':'%'+_0x222507[_0xac4a('0x27')]['filter']+'%'};return _0x37f2ee;}})});}_0x3e2c69=_[_0xac4a('0x34')]({},_0x3e2c69,_0x222507[_0xac4a('0x35')]);var _0x1b5427={'where':_0x3e2c69['where']};return db[_0xac4a('0x22')][_0xac4a('0x10')](_0x1b5427)['then'](function(_0x59bebf){_0x1d0539[_0xac4a('0x10')]=_0x59bebf;if(_0x222507['query']['includeAll']){_0x3e2c69['include']=[{'all':!![]}];}return db['SquareProject'][_0xac4a('0x36')](_0x3e2c69);})[_0xac4a('0x15')](function(_0x37834b){_0x1d0539[_0xac4a('0x37')]=_0x37834b;return _0x1d0539;})[_0xac4a('0x15')](respondWithFilteredResult(_0x36054a,_0x3e2c69))[_0xac4a('0x38')](handleError(_0x36054a,null));};exports[_0xac4a('0x39')]=function(_0x2b16f0,_0x28292c){var _0x1f7721={'raw':![],'where':{'id':_0x2b16f0[_0xac4a('0x3a')]['id']}},_0x14f7d5={};_0x14f7d5['model']=_['keys'](db['SquareProject'][_0xac4a('0x23')]);_0x14f7d5[_0xac4a('0x27')]=_[_0xac4a('0x3b')](_0x2b16f0[_0xac4a('0x27')]);_0x14f7d5[_0xac4a('0x28')]=_[_0xac4a('0x29')](_0x14f7d5[_0xac4a('0x26')],_0x14f7d5[_0xac4a('0x27')]);_0x1f7721[_0xac4a('0x2a')]=_[_0xac4a('0x29')](_0x14f7d5['model'],qs[_0xac4a('0x2b')](_0x2b16f0[_0xac4a('0x27')][_0xac4a('0x2b')]));_0x1f7721[_0xac4a('0x2a')]=_0x1f7721[_0xac4a('0x2a')]['length']?_0x1f7721[_0xac4a('0x2a')]:_0x14f7d5[_0xac4a('0x26')];if(_0x2b16f0['query'][_0xac4a('0x3c')]){_0x1f7721['include']=[{'all':!![]}];}_0x1f7721=_[_0xac4a('0x34')]({},_0x1f7721,_0x2b16f0[_0xac4a('0x35')]);return db[_0xac4a('0x22')][_0xac4a('0x3d')](_0x1f7721)[_0xac4a('0x15')](handleEntityNotFound(_0x28292c,null))[_0xac4a('0x15')](respondWithResult(_0x28292c,null))[_0xac4a('0x38')](handleError(_0x28292c,null));};exports[_0xac4a('0x3e')]=function(_0x98e0c4,_0xcb002b){return db[_0xac4a('0x22')][_0xac4a('0x3e')](_0x98e0c4['body'],{})[_0xac4a('0x15')](function(_0x41d11d){var _0xeca4e9=_0x98e0c4['user'][_0xac4a('0x3f')]({'plain':!![]});if(!_0xeca4e9)throw new Error(_0xac4a('0x40'));if(_0xeca4e9['role']===_0xac4a('0x41')){var _0x5a7f6e=_0x41d11d[_0xac4a('0x3f')]({'plain':!![]});var _0xe620f6=_0xac4a('0x17');return db['UserProfileSection']['find']({'where':{'name':_0xe620f6,'userProfileId':_0xeca4e9[_0xac4a('0x42')]},'raw':!![]})['then'](function(_0x18ae96){if(_0x18ae96&&_0x18ae96['autoAssociation']===0x0){return db[_0xac4a('0x18')]['create']({'name':_0x5a7f6e[_0xac4a('0x1e')],'resourceId':_0x5a7f6e['id'],'type':_0x18ae96[_0xac4a('0x1e')],'sectionId':_0x18ae96['id']},{})[_0xac4a('0x15')](function(){return _0x41d11d;});}else{return _0x41d11d;}})[_0xac4a('0x38')](function(_0x54782f){logger[_0xac4a('0x43')](_0xac4a('0x44'),_0x54782f);throw _0x54782f;});}return _0x41d11d;})[_0xac4a('0x15')](respondWithResult(_0xcb002b,0xc9))[_0xac4a('0x38')](handleError(_0xcb002b,null));};exports[_0xac4a('0x14')]=function(_0x138876,_0x187306){if(_0x138876['body']['id']){delete _0x138876[_0xac4a('0x45')]['id'];}return db[_0xac4a('0x22')]['find']({'where':{'id':_0x138876[_0xac4a('0x3a')]['id']}})[_0xac4a('0x15')](handleEntityNotFound(_0x187306,null))[_0xac4a('0x15')](saveUpdates(_0x138876[_0xac4a('0x45')],null))['then'](function(_0x3bd846){if(!_0x3bd846)return;var _0x43cac8=_0x3bd846[_0xac4a('0x3f')]({'plain':!![]});return _0x43cac8;})[_0xac4a('0x15')](function(_0x890910){var _0x49fbc3=new Redis(config[_0xac4a('0x6')]);_0x49fbc3['publish'](_0xac4a('0x1a'),JSON[_0xac4a('0x1b')](_['pick'](_0x890910,['id','name',_0xac4a('0x46')])));return _0x890910;})[_0xac4a('0x15')](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x16')]=function(_0x31a4bf,_0x26b582){return db[_0xac4a('0x22')]['find']({'where':{'id':_0x31a4bf[_0xac4a('0x3a')]['id']}})[_0xac4a('0x15')](handleEntityNotFound(_0x26b582,null))[_0xac4a('0x15')](removeEntity(_0x26b582,null))[_0xac4a('0x38')](handleError(_0x26b582,null));};exports[_0xac4a('0x47')]=function(_0x411547,_0x36179a){return db['SquareProject'][_0xac4a('0x3d')]({'where':{'id':_0x411547[_0xac4a('0x3a')]['id']}})[_0xac4a('0x15')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x15')](function(_0x1b7231){if(_0x1b7231){return _0x1b7231[_0xac4a('0x47')](_0x411547[_0xac4a('0x45')][_0xac4a('0x48')],_[_0xac4a('0x49')](_0x411547[_0xac4a('0x45')],[_0xac4a('0x48'),'id'])||{});}})[_0xac4a('0x15')](respondWithResult(_0x36179a,null))[_0xac4a('0x38')](handleError(_0x36179a,null));};exports[_0xac4a('0x4a')]=function(_0x5222f3,_0x11c753){return db['SquareProject'][_0xac4a('0x3d')]({'where':{'id':_0x5222f3['params']['id']}})[_0xac4a('0x15')](handleEntityNotFound(_0x11c753,null))['then'](function(_0x2a30e8){if(_0x2a30e8){return _0x2a30e8['removeUsers'](_0x5222f3[_0xac4a('0x27')]['ids'])['then'](function(){if(_[_0xac4a('0x4b')](_0x5222f3[_0xac4a('0x27')][_0xac4a('0x48')])){for(var _0x3c2f84=0x0;_0x3c2f84<_0x5222f3[_0xac4a('0x27')][_0xac4a('0x48')]['length'];_0x3c2f84+=0x1){socket[_0xac4a('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x5222f3[_0xac4a('0x27')]['ids'][_0x3c2f84]),'SquareProjectId':Number(_0x5222f3[_0xac4a('0x3a')]['id'])});}}else{socket[_0xac4a('0x4c')](_0xac4a('0x4d'),{'UserId':Number(_0x5222f3[_0xac4a('0x27')][_0xac4a('0x48')]),'SquareProjectId':Number(_0x5222f3[_0xac4a('0x3a')]['id'])});}});}})[_0xac4a('0x15')](respondWithStatusCode(_0x11c753,null))[_0xac4a('0x38')](handleError(_0x11c753,null));};exports[_0xac4a('0x4e')]=function(_0x430dd0,_0x42e503){var _0x2498ad={};var _0x1fe05a={};var _0x2cc410;var _0x17ae93;return db[_0xac4a('0x22')][_0xac4a('0x4f')]({'where':{'id':_0x430dd0['params']['id']}})[_0xac4a('0x15')](handleEntityNotFound(_0x42e503,null))[_0xac4a('0x15')](function(_0x4fb812){if(_0x4fb812){_0x2cc410=_0x4fb812;_0x1fe05a[_0xac4a('0x26')]=_[_0xac4a('0x3b')](db[_0xac4a('0x50')][_0xac4a('0x23')]);_0x1fe05a[_0xac4a('0x27')]=_['keys'](_0x430dd0['query']);_0x1fe05a[_0xac4a('0x28')]=_[_0xac4a('0x29')](_0x1fe05a[_0xac4a('0x26')],_0x1fe05a[_0xac4a('0x27')]);_0x2498ad[_0xac4a('0x2a')]=_[_0xac4a('0x29')](_0x1fe05a[_0xac4a('0x26')],qs[_0xac4a('0x2b')](_0x430dd0[_0xac4a('0x27')][_0xac4a('0x2b')]));_0x2498ad[_0xac4a('0x2a')]=_0x2498ad['attributes']['length']?_0x2498ad[_0xac4a('0x2a')]:_0x1fe05a[_0xac4a('0x26')];_0x2498ad[_0xac4a('0x2f')]=qs[_0xac4a('0x30')](_0x430dd0[_0xac4a('0x27')][_0xac4a('0x30')]);_0x2498ad[_0xac4a('0x31')]=qs[_0xac4a('0x28')](_[_0xac4a('0x32')](_0x430dd0[_0xac4a('0x27')],_0x1fe05a[_0xac4a('0x28')]));if(_0x430dd0[_0xac4a('0x27')]['filter']){_0x2498ad[_0xac4a('0x31')]=_[_0xac4a('0x34')](_0x2498ad[_0xac4a('0x31')],{'$or':_[_0xac4a('0x21')](_0x2498ad['attributes'],function(_0xc61e94){var _0x5a30af={};_0x5a30af[_0xc61e94]={'$like':'%'+_0x430dd0[_0xac4a('0x27')][_0xac4a('0x33')]+'%'};return _0x5a30af;})});}_0x2498ad=_['merge']({},_0x2498ad,_0x430dd0['options']);return _0x2cc410[_0xac4a('0x4e')](_0x2498ad);}})[_0xac4a('0x15')](function(_0x13097f){if(_0x13097f){_0x17ae93=_0x13097f['length'];if(!_0x430dd0[_0xac4a('0x27')]['hasOwnProperty'](_0xac4a('0x2e'))){_0x2498ad['limit']=qs['limit'](_0x430dd0[_0xac4a('0x27')]['limit']);_0x2498ad[_0xac4a('0x11')]=qs['offset'](_0x430dd0[_0xac4a('0x27')][_0xac4a('0x11')]);}return _0x2cc410['getUsers'](_0x2498ad);}})[_0xac4a('0x15')](function(_0x54fa7a){if(_0x54fa7a){return _0x54fa7a?{'count':_0x17ae93,'rows':_0x54fa7a}:null;}})[_0xac4a('0x15')](respondWithResult(_0x42e503,null))[_0xac4a('0x38')](handleError(_0x42e503,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d793239..19327c4 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 _0xd333=['events','../../mysqldb','SquareProject','save','update','remove','emit','hook','exports'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0xd333,0x17a));var _0x3d33=function(_0x303efd,_0x535db9){_0x303efd=_0x303efd-0x0;var _0xa50b3b=_0xd333[_0x303efd];return _0xa50b3b;};'use strict';var EventEmitter=require(_0x3d33('0x0'));var SquareProject=require(_0x3d33('0x1'))['db'][_0x3d33('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3d33('0x3'),'afterUpdate':_0x3d33('0x4'),'afterDestroy':_0x3d33('0x5')};function emitEvent(_0x3b5c60){return function(_0x38d19d,_0x2d8681,_0x49c1de){SquareProjectEvents['emit'](_0x3b5c60+':'+_0x38d19d['id'],_0x38d19d);SquareProjectEvents[_0x3d33('0x6')](_0x3b5c60,_0x38d19d);_0x49c1de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x3d33('0x7')](e,emitEvent(event));}}module[_0x3d33('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x5d2c=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x14843c,_0x39b9f4){var _0xe5e2ac=function(_0xfed929){while(--_0xfed929){_0x14843c['push'](_0x14843c['shift']());}};_0xe5e2ac(++_0x39b9f4);}(_0x5d2c,0x122));var _0xc5d2=function(_0x48fab6,_0x535c8d){_0x48fab6=_0x48fab6-0x0;var _0x499cfe=_0x5d2c[_0x48fab6];return _0x499cfe;};'use strict';var EventEmitter=require(_0xc5d2('0x0'));var SquareProject=require(_0xc5d2('0x1'))['db'][_0xc5d2('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xc5d2('0x3')](0x0);var events={'afterCreate':_0xc5d2('0x4'),'afterUpdate':_0xc5d2('0x5'),'afterDestroy':_0xc5d2('0x6')};function emitEvent(_0x1f11ee){return function(_0x56757b,_0x2fa914,_0x33330d){SquareProjectEvents[_0xc5d2('0x7')](_0x1f11ee+':'+_0x56757b['id'],_0x56757b);SquareProjectEvents[_0xc5d2('0x7')](_0x1f11ee,_0x56757b);_0x33330d(null);};}for(var e in events){if(events[_0xc5d2('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xc5d2('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9859089..0b7cc39 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 _0x7941=['format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','define','square_projects','changed','preproduction','savedAt'];(function(_0x185c5e,_0x1b05f5){var _0x14053a=function(_0xd55b4){while(--_0xd55b4){_0x185c5e['push'](_0x185c5e['shift']());}};_0x14053a(++_0x1b05f5);}(_0x7941,0x179));var _0x1794=function(_0x1b4a0b,_0x376145){_0x1b4a0b=_0x1b4a0b-0x0;var _0x3a540b=_0x7941[_0x1b4a0b];return _0x3a540b;};'use strict';var _=require(_0x1794('0x0'));var util=require(_0x1794('0x1'));var logger=require(_0x1794('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1794('0x3'));var rp=require(_0x1794('0x4'));var fs=require('fs');var path=require(_0x1794('0x5'));var rimraf=require(_0x1794('0x6'));var config=require(_0x1794('0x7'));var attributes=require(_0x1794('0x8'));module['exports']=function(_0x4eaacc,_0x281f51){return _0x4eaacc[_0x1794('0x9')]('SquareProject',attributes,{'tableName':_0x1794('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b72db,_0x2f6587,_0x530848){if(_0x2b72db[_0x1794('0xb')](_0x1794('0xc'))){_0x2b72db[_0x1794('0xd')]=moment()[_0x1794('0xe')](_0x1794('0xf'));}if(_0x2b72db[_0x1794('0xb')]('production')){_0x2b72db[_0x1794('0x10')]=moment()[_0x1794('0xe')](_0x1794('0xf'));}_0x530848(null,_0x2b72db);}}});}; \ No newline at end of file +var _0x67c2=['lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','define','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x58f029,_0x157305){var _0x205fdd=function(_0x57c4d7){while(--_0x57c4d7){_0x58f029['push'](_0x58f029['shift']());}};_0x205fdd(++_0x157305);}(_0x67c2,0xc3));var _0x267c=function(_0x5e99ef,_0x43c467){_0x5e99ef=_0x5e99ef-0x0;var _0x41922c=_0x67c2[_0x5e99ef];return _0x41922c;};'use strict';var _=require(_0x267c('0x0'));var util=require('util');var logger=require(_0x267c('0x1'))('api');var moment=require(_0x267c('0x2'));var BPromise=require('bluebird');var rp=require(_0x267c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x267c('0x4'));var config=require(_0x267c('0x5'));var attributes=require(_0x267c('0x6'));module[_0x267c('0x7')]=function(_0xb0bbf1,_0x4af0ae){return _0xb0bbf1[_0x267c('0x8')]('SquareProject',attributes,{'tableName':_0x267c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a9ecb,_0x166caa,_0x180ff8){if(_0x5a9ecb[_0x267c('0xa')](_0x267c('0xb'))){_0x5a9ecb[_0x267c('0xc')]=moment()['format'](_0x267c('0xd'));}if(_0x5a9ecb[_0x267c('0xa')](_0x267c('0xe'))){_0x5a9ecb['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x180ff8(null,_0x5a9ecb);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2fdc744..fe76fbb 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 _0x67f2=['options','raw','where','attributes','limit','include','map','model','info','debug','error','message','find','then','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','findAll'];(function(_0x285d1f,_0x4746de){var _0x4fb3c4=function(_0x3f2043){while(--_0x3f2043){_0x285d1f['push'](_0x285d1f['shift']());}};_0x4fb3c4(++_0x4746de);}(_0x67f2,0x64));var _0x267f=function(_0x16d346,_0x30c788){_0x16d346=_0x16d346-0x0;var _0x281e07=_0x67f2[_0x16d346];return _0x281e07;};'use strict';var _=require('lodash');var Redis=require(_0x267f('0x0'));var db=require(_0x267f('0x1'))['db'];var logger=require(_0x267f('0x2'))(_0x267f('0x3'));var config=require(_0x267f('0x4'));config[_0x267f('0x5')]=_[_0x267f('0x6')](config[_0x267f('0x5')],{'host':_0x267f('0x7'),'port':0x18eb});var socket=require(_0x267f('0x8'))(new Redis(config[_0x267f('0x5')]));require(_0x267f('0x9'))['register'](socket);exports[_0x267f('0xa')]=function(_0x5bfeae){var _0x25dcb4=this;return new Promise(function(_0x299bc4,_0x25dd92){return db['SquareProject'][_0x267f('0xb')]({'raw':_0x5bfeae['options']?_0x5bfeae[_0x267f('0xc')][_0x267f('0xd')]===undefined?!![]:![]:!![],'where':_0x5bfeae[_0x267f('0xc')]?_0x5bfeae[_0x267f('0xc')][_0x267f('0xe')]||null:null,'attributes':_0x5bfeae[_0x267f('0xc')]?_0x5bfeae[_0x267f('0xc')][_0x267f('0xf')]||null:null,'limit':_0x5bfeae[_0x267f('0xc')]?_0x5bfeae[_0x267f('0xc')][_0x267f('0x10')]||null:null,'include':_0x5bfeae['options']?_0x5bfeae[_0x267f('0xc')][_0x267f('0x11')]?_[_0x267f('0x12')](_0x5bfeae[_0x267f('0xc')][_0x267f('0x11')],function(_0x4afd37){return{'model':db[_0x4afd37[_0x267f('0x13')]],'as':_0x4afd37['as'],'attributes':_0x4afd37[_0x267f('0xf')],'include':_0x4afd37[_0x267f('0x11')]?_[_0x267f('0x12')](_0x4afd37[_0x267f('0x11')],function(_0x12598c){return{'model':db[_0x12598c[_0x267f('0x13')]],'as':_0x12598c['as'],'attributes':_0x12598c[_0x267f('0xf')],'include':_0x12598c[_0x267f('0x11')]?_[_0x267f('0x12')](_0x12598c[_0x267f('0x11')],function(_0x206039){return{'model':db[_0x206039[_0x267f('0x13')]],'as':_0x206039['as'],'attributes':_0x206039[_0x267f('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d8ce){logger[_0x267f('0x14')](_0x267f('0xa'),_0x5bfeae);logger[_0x267f('0x15')]('GetSquareProjects',_0x5bfeae,JSON['stringify'](_0x18d8ce));_0x299bc4(_0x18d8ce);})['catch'](function(_0x10e893){logger[_0x267f('0x16')](_0x267f('0xa'),_0x10e893[_0x267f('0x17')],_0x5bfeae);_0x25dd92(_0x25dcb4[_0x267f('0x16')](0x1f4,_0x10e893['message']));});});};exports['ShowSquareProject']=function(_0x86659d){var _0x1de333=this;return new Promise(function(_0x16b166,_0x6a5e7a){return db['SquareProject'][_0x267f('0x18')]({'raw':_0x86659d[_0x267f('0xc')]?_0x86659d[_0x267f('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x86659d['options']?_0x86659d[_0x267f('0xc')][_0x267f('0xe')]||null:null,'attributes':_0x86659d[_0x267f('0xc')]?_0x86659d[_0x267f('0xc')]['attributes']||null:null,'include':_0x86659d[_0x267f('0xc')]?_0x86659d['options']['include']?_[_0x267f('0x12')](_0x86659d[_0x267f('0xc')][_0x267f('0x11')],function(_0x327c99){return{'model':db[_0x327c99[_0x267f('0x13')]],'as':_0x327c99['as'],'attributes':_0x327c99[_0x267f('0xf')],'include':_0x327c99[_0x267f('0x11')]?_[_0x267f('0x12')](_0x327c99[_0x267f('0x11')],function(_0x110c57){return{'model':db[_0x110c57[_0x267f('0x13')]],'as':_0x110c57['as'],'attributes':_0x110c57[_0x267f('0xf')],'include':_0x110c57[_0x267f('0x11')]?_[_0x267f('0x12')](_0x110c57[_0x267f('0x11')],function(_0x20b3be){return{'model':db[_0x20b3be['model']],'as':_0x20b3be['as'],'attributes':_0x20b3be[_0x267f('0xf')]};}):[]};}):[]};}):[]:[]})[_0x267f('0x19')](function(_0x3712fe){logger[_0x267f('0x14')](_0x267f('0x1a'),_0x86659d);logger['debug']('ShowSquareProject',_0x86659d,JSON[_0x267f('0x1b')](_0x3712fe));_0x16b166(_0x3712fe);})['catch'](function(_0x532dbc){logger[_0x267f('0x16')](_0x267f('0x1a'),_0x532dbc['message'],_0x86659d);_0x6a5e7a(_0x1de333[_0x267f('0x16')](0x1f4,_0x532dbc[_0x267f('0x17')]));});});}; \ No newline at end of file +var _0x130e=['./squareProject.socket','register','GetSquareProjects','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','ShowSquareProject','SquareProject','find','where','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter'];(function(_0x13b305,_0x346500){var _0x1bacb6=function(_0x8a07c9){while(--_0x8a07c9){_0x13b305['push'](_0x13b305['shift']());}};_0x1bacb6(++_0x346500);}(_0x130e,0x16b));var _0xe130=function(_0x2b9ee4,_0x181bbe){_0x2b9ee4=_0x2b9ee4-0x0;var _0x305f40=_0x130e[_0x2b9ee4];return _0x305f40;};'use strict';var _=require(_0xe130('0x0'));var Redis=require(_0xe130('0x1'));var db=require(_0xe130('0x2'))['db'];var logger=require(_0xe130('0x3'))(_0xe130('0x4'));var config=require(_0xe130('0x5'));config[_0xe130('0x6')]=_[_0xe130('0x7')](config[_0xe130('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xe130('0x8'))(new Redis(config[_0xe130('0x6')]));require(_0xe130('0x9'))[_0xe130('0xa')](socket);exports[_0xe130('0xb')]=function(_0xe92e9){var _0x12f8a2=this;return new Promise(function(_0x16e4ce,_0x2e3d72){return db['SquareProject'][_0xe130('0xc')]({'raw':_0xe92e9[_0xe130('0xd')]?_0xe92e9[_0xe130('0xd')][_0xe130('0xe')]===undefined?!![]:![]:!![],'where':_0xe92e9[_0xe130('0xd')]?_0xe92e9['options']['where']||null:null,'attributes':_0xe92e9['options']?_0xe92e9[_0xe130('0xd')][_0xe130('0xf')]||null:null,'limit':_0xe92e9[_0xe130('0xd')]?_0xe92e9[_0xe130('0xd')][_0xe130('0x10')]||null:null,'include':_0xe92e9[_0xe130('0xd')]?_0xe92e9[_0xe130('0xd')][_0xe130('0x11')]?_[_0xe130('0x12')](_0xe92e9[_0xe130('0xd')][_0xe130('0x11')],function(_0x152877){return{'model':db[_0x152877['model']],'as':_0x152877['as'],'attributes':_0x152877['attributes'],'include':_0x152877[_0xe130('0x11')]?_[_0xe130('0x12')](_0x152877[_0xe130('0x11')],function(_0x1ba3de){return{'model':db[_0x1ba3de['model']],'as':_0x1ba3de['as'],'attributes':_0x1ba3de[_0xe130('0xf')],'include':_0x1ba3de[_0xe130('0x11')]?_[_0xe130('0x12')](_0x1ba3de[_0xe130('0x11')],function(_0x4acd82){return{'model':db[_0x4acd82[_0xe130('0x13')]],'as':_0x4acd82['as'],'attributes':_0x4acd82[_0xe130('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe130('0x14')](function(_0x1aec53){logger[_0xe130('0x15')](_0xe130('0xb'),_0xe92e9);logger[_0xe130('0x16')](_0xe130('0xb'),_0xe92e9,JSON[_0xe130('0x17')](_0x1aec53));_0x16e4ce(_0x1aec53);})[_0xe130('0x18')](function(_0x4599c1){logger['error'](_0xe130('0xb'),_0x4599c1['message'],_0xe92e9);_0x2e3d72(_0x12f8a2[_0xe130('0x19')](0x1f4,_0x4599c1['message']));});});};exports[_0xe130('0x1a')]=function(_0x47e93b){var _0x25f61f=this;return new Promise(function(_0x33a849,_0x3794c0){return db[_0xe130('0x1b')][_0xe130('0x1c')]({'raw':_0x47e93b[_0xe130('0xd')]?_0x47e93b[_0xe130('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x47e93b[_0xe130('0xd')]?_0x47e93b[_0xe130('0xd')][_0xe130('0x1d')]||null:null,'attributes':_0x47e93b[_0xe130('0xd')]?_0x47e93b[_0xe130('0xd')][_0xe130('0xf')]||null:null,'include':_0x47e93b[_0xe130('0xd')]?_0x47e93b[_0xe130('0xd')][_0xe130('0x11')]?_[_0xe130('0x12')](_0x47e93b['options']['include'],function(_0x2d1a0a){return{'model':db[_0x2d1a0a[_0xe130('0x13')]],'as':_0x2d1a0a['as'],'attributes':_0x2d1a0a[_0xe130('0xf')],'include':_0x2d1a0a[_0xe130('0x11')]?_['map'](_0x2d1a0a[_0xe130('0x11')],function(_0x22cab7){return{'model':db[_0x22cab7[_0xe130('0x13')]],'as':_0x22cab7['as'],'attributes':_0x22cab7[_0xe130('0xf')],'include':_0x22cab7['include']?_[_0xe130('0x12')](_0x22cab7['include'],function(_0x3f63cd){return{'model':db[_0x3f63cd[_0xe130('0x13')]],'as':_0x3f63cd['as'],'attributes':_0x3f63cd[_0xe130('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe130('0x14')](function(_0x3b2ecc){logger[_0xe130('0x15')](_0xe130('0x1a'),_0x47e93b);logger[_0xe130('0x16')](_0xe130('0x1a'),_0x47e93b,JSON[_0xe130('0x17')](_0x3b2ecc));_0x33a849(_0x3b2ecc);})[_0xe130('0x18')](function(_0x4695ef){logger[_0xe130('0x19')](_0xe130('0x1a'),_0x4695ef[_0xe130('0x1e')],_0x47e93b);_0x3794c0(_0x25f61f[_0xe130('0x19')](0x1f4,_0x4695ef['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 841e15a..eaba5aa 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 _0x1fb9=['save','remove','update','emit','removeListener','register','length'];(function(_0x455e76,_0x152520){var _0x58d631=function(_0x2d1e04){while(--_0x2d1e04){_0x455e76['push'](_0x455e76['shift']());}};_0x58d631(++_0x152520);}(_0x1fb9,0x103));var _0x91fb=function(_0x233a4c,_0x3ef6e1){_0x233a4c=_0x233a4c-0x0;var _0x51d977=_0x1fb9[_0x233a4c];return _0x51d977;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x91fb('0x0'),_0x91fb('0x1'),_0x91fb('0x2')];function createListener(_0x25c845,_0x1731a3){return function(_0x3bb398){_0x1731a3[_0x91fb('0x3')](_0x25c845,_0x3bb398);};}function removeListener(_0x5b4853,_0x5c1878){return function(){SquareProjectEvents[_0x91fb('0x4')](_0x5b4853,_0x5c1878);};}exports[_0x91fb('0x5')]=function(_0x6b482a){for(var _0x11cfca=0x0,_0x3ae74e=events[_0x91fb('0x6')];_0x11cfca<_0x3ae74e;_0x11cfca++){var _0x4c2794=events[_0x11cfca];var _0x3f01b2=createListener('squareProject:'+_0x4c2794,_0x6b482a);SquareProjectEvents['on'](_0x4c2794,_0x3f01b2);}}; \ No newline at end of file +var _0x98cc=['register','length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x17aac7,_0x367b19){var _0x2e3e4f=function(_0x4565eb){while(--_0x4565eb){_0x17aac7['push'](_0x17aac7['shift']());}};_0x2e3e4f(++_0x367b19);}(_0x98cc,0xc9));var _0xc98c=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x98cc[_0x4b7b69];return _0x173b4c;};'use strict';var SquareProjectEvents=require(_0xc98c('0x0'));var events=[_0xc98c('0x1'),_0xc98c('0x2'),_0xc98c('0x3')];function createListener(_0x41843a,_0x8ecbfc){return function(_0xe6e56f){_0x8ecbfc[_0xc98c('0x4')](_0x41843a,_0xe6e56f);};}function removeListener(_0x25a4a5,_0x1bd95a){return function(){SquareProjectEvents[_0xc98c('0x5')](_0x25a4a5,_0x1bd95a);};}exports[_0xc98c('0x6')]=function(_0x2bbce8){for(var _0x3deb91=0x0,_0x395644=events[_0xc98c('0x7')];_0x3deb91<_0x395644;_0x3deb91++){var _0x49422a=events[_0x3deb91];var _0x218190=createListener(_0xc98c('0x8')+_0x49422a,_0x2bbce8);SquareProjectEvents['on'](_0x49422a,_0x218190);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8bfec62..924c3be 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x936936,_0x256960){var _0xf9a982=function(_0xa483a0){while(--_0xa483a0){_0x936936['push'](_0x936936['shift']());}};_0xf9a982(++_0x256960);}(_0x4975,0x86));var _0x5497=function(_0x3c103d,_0x4d92b1){_0x3c103d=_0x3c103d-0x0;var _0x3b2f6c=_0x4975[_0x3c103d];return _0x3b2f6c;};'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('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x4bdba6,_0x3d2dd2){var _0x44c028=function(_0x389aeb){while(--_0x389aeb){_0x4bdba6['push'](_0x4bdba6['shift']());}};_0x44c028(++_0x3d2dd2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('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 f9a7aaa..040ee19 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x2123cb,_0x397589){var _0x3764a=function(_0x32eee7){while(--_0x32eee7){_0x2123cb['push'](_0x2123cb['shift']());}};_0x3764a(++_0x397589);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3d862d,_0x4b46e6){_0x3d862d=_0x3d862d-0x0;var _0x46ed64=_0x8d0e[_0x3d862d];return _0x46ed64;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file +var _0x425d=['getDataValue','savePath','substring','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x323030,_0x5bbc89){var _0x90b65a=function(_0x2dda59){while(--_0x2dda59){_0x323030['push'](_0x323030['shift']());}};_0x90b65a(++_0x5bbc89);}(_0x425d,0x1e0));var _0xd425=function(_0x38301d,_0x5153a3){_0x38301d=_0x38301d-0x0;var _0x22052c=_0x425d[_0x38301d];return _0x22052c;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'callerid':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'extension':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xd425('0x1')]},'saveName':{'type':Sequelize[_0xd425('0x1')]},'filename':{'type':Sequelize[_0xd425('0x1')]},'savePath':{'type':Sequelize[_0xd425('0x1')]},'format':{'type':Sequelize[_0xd425('0x2')],'get':function(){var _0x1d2ed0='';var _0x50b061=this[_0xd425('0x3')](_0xd425('0x4'));if(_0x50b061){_0x1d2ed0=_0x50b061[_0xd425('0x5')](_0x50b061[_0xd425('0x6')]('.'));}return _0x1d2ed0;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 24da0ea..eff8a4d 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 _0x865d=['params','length','find','create','body','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','download','message','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','merge','options','SquareRecording','includeAll','include','findAll','catch','show'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x865d,0xe4));var _0xd865=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x865d[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require(_0xd865('0x0'));var rimraf=require(_0xd865('0x1'));var zipdir=require(_0xd865('0x2'));var jsonpatch=require(_0xd865('0x3'));var rp=require(_0xd865('0x4'));var moment=require(_0xd865('0x5'));var BPromise=require(_0xd865('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd865('0x7'));var csv=require(_0xd865('0x8'));var ejs=require(_0xd865('0x9'));var fs=require('fs');var fs_extra=require(_0xd865('0xa'));var _=require(_0xd865('0xb'));var squel=require(_0xd865('0xc'));var crypto=require('crypto');var jsforce=require(_0xd865('0xd'));var deskjs=require(_0xd865('0xe'));var toCsv=require(_0xd865('0x8'));var querystring=require(_0xd865('0xf'));var Papa=require('papaparse');var Redis=require(_0xd865('0x10'));var authService=require(_0xd865('0x11'));var qs=require(_0xd865('0x12'));var as=require(_0xd865('0x13'));var hardwareService=require(_0xd865('0x14'));var logger=require(_0xd865('0x15'))('api');var utils=require(_0xd865('0x16'));var config=require(_0xd865('0x17'));var licenseUtil=require(_0xd865('0x18'));var db=require(_0xd865('0x19'))['db'];function respondWithStatusCode(_0x31389d,_0x15cb19){_0x15cb19=_0x15cb19||0xcc;return function(_0x53d299){if(_0x53d299){return _0x31389d[_0xd865('0x1a')](_0x15cb19);}return _0x31389d[_0xd865('0x1b')](_0x15cb19)[_0xd865('0x1c')]();};}function respondWithResult(_0x465c1b,_0x543f27){_0x543f27=_0x543f27||0xc8;return function(_0x2d1252){if(_0x2d1252){return _0x465c1b['status'](_0x543f27)[_0xd865('0x1d')](_0x2d1252);}};}function respondWithFilteredResult(_0x4a0621,_0x108e36){return function(_0x256037){if(_0x256037){var _0x123eed=typeof _0x108e36[_0xd865('0x1e')]===_0xd865('0x1f')&&typeof _0x108e36['limit']===_0xd865('0x1f');var _0x90923e=_0x256037[_0xd865('0x20')];var _0x2ceddc=_0x123eed?0x0:_0x108e36[_0xd865('0x1e')];var _0x1c7431=_0x123eed?_0x256037[_0xd865('0x20')]:_0x108e36[_0xd865('0x1e')]+_0x108e36['limit'];var _0x349a77;if(_0x1c7431>=_0x90923e){_0x1c7431=_0x90923e;_0x349a77=0xc8;}else{_0x349a77=0xce;}_0x4a0621[_0xd865('0x1b')](_0x349a77);return _0x4a0621[_0xd865('0x21')](_0xd865('0x22'),_0x2ceddc+'-'+_0x1c7431+'/'+_0x90923e)['json'](_0x256037);}return null;};}function patchUpdates(_0x3d4b1c){return function(_0xa81453){try{jsonpatch[_0xd865('0x23')](_0xa81453,_0x3d4b1c,!![]);}catch(_0x464e3f){return BPromise[_0xd865('0x24')](_0x464e3f);}return _0xa81453[_0xd865('0x25')]();};}function saveUpdates(_0x57a1d9,_0xc0ef54){return function(_0x580774){if(_0x580774){return _0x580774[_0xd865('0x26')](_0x57a1d9)[_0xd865('0x27')](function(_0x59cb9f){return _0x59cb9f;});}return null;};}function removeEntity(_0xcb2108,_0x5a69fb){return function(_0x4e4039){if(_0x4e4039){return _0x4e4039[_0xd865('0x28')]()[_0xd865('0x27')](function(){_0xcb2108[_0xd865('0x1b')](0xcc)[_0xd865('0x1c')]();});}};}function handleEntityNotFound(_0x5f4ebe,_0x30775d){return function(_0x2c6e4e){if(!_0x2c6e4e){_0x5f4ebe['sendStatus'](0x194);}return _0x2c6e4e;};}function handleError(_0x29ad5a,_0x33a18c){_0x33a18c=_0x33a18c||0x1f4;return function(_0x283520){logger[_0xd865('0x29')](_0x283520[_0xd865('0x2a')]);if(_0x283520[_0xd865('0x2b')]){delete _0x283520[_0xd865('0x2b')];}_0x29ad5a[_0xd865('0x1b')](_0x33a18c)[_0xd865('0x2c')](_0x283520);};}exports[_0xd865('0x2d')]=function(_0x68e9ba,_0xa59679){var _0x102823={},_0x25b47a={},_0x2d3371={'count':0x0,'rows':[]};var _0x3b14d6=_[_0xd865('0x2e')](db['SquareRecording'][_0xd865('0x2f')],function(_0x479023){return{'name':_0x479023[_0xd865('0x30')],'type':_0x479023[_0xd865('0x31')][_0xd865('0x32')]};});_0x25b47a['model']=_[_0xd865('0x2e')](_0x3b14d6,_0xd865('0x2b'));_0x25b47a[_0xd865('0x33')]=_[_0xd865('0x34')](_0x68e9ba['query']);_0x25b47a[_0xd865('0x35')]=_[_0xd865('0x36')](_0x25b47a[_0xd865('0x37')],_0x25b47a['query']);_0x102823[_0xd865('0x38')]=_[_0xd865('0x36')](_0x25b47a[_0xd865('0x37')],qs[_0xd865('0x39')](_0x68e9ba[_0xd865('0x33')][_0xd865('0x39')]));_0x102823[_0xd865('0x38')]=_0x102823[_0xd865('0x38')]['length']?_0x102823[_0xd865('0x38')]:_0x25b47a[_0xd865('0x37')];if(!_0x68e9ba[_0xd865('0x33')][_0xd865('0x3a')]('nolimit')){_0x102823[_0xd865('0x3b')]=qs[_0xd865('0x3b')](_0x68e9ba[_0xd865('0x33')][_0xd865('0x3b')]);_0x102823['offset']=qs[_0xd865('0x1e')](_0x68e9ba[_0xd865('0x33')][_0xd865('0x1e')]);}_0x102823[_0xd865('0x3c')]=qs[_0xd865('0x3d')](_0x68e9ba['query'][_0xd865('0x3d')]);_0x102823[_0xd865('0x3e')]=qs[_0xd865('0x35')](_['pick'](_0x68e9ba[_0xd865('0x33')],_0x25b47a[_0xd865('0x35')]),_0x3b14d6);if(_0x68e9ba[_0xd865('0x33')][_0xd865('0x3f')]){_0x102823[_0xd865('0x3e')]=_[_0xd865('0x40')](_0x102823[_0xd865('0x3e')],{'$or':_[_0xd865('0x2e')](_0x3b14d6,function(_0x56c874){if(_0x56c874[_0xd865('0x31')]!=='VIRTUAL'){var _0x1896ec={};_0x1896ec[_0x56c874['name']]={'$like':'%'+_0x68e9ba[_0xd865('0x33')][_0xd865('0x3f')]+'%'};return _0x1896ec;}})});}_0x102823=_[_0xd865('0x40')]({},_0x102823,_0x68e9ba[_0xd865('0x41')]);var _0x1d178f={'where':_0x102823[_0xd865('0x3e')]};return db[_0xd865('0x42')]['count'](_0x1d178f)[_0xd865('0x27')](function(_0x2dbf28){_0x2d3371[_0xd865('0x20')]=_0x2dbf28;if(_0x68e9ba[_0xd865('0x33')][_0xd865('0x43')]){_0x102823[_0xd865('0x44')]=[{'all':!![]}];}return db['SquareRecording'][_0xd865('0x45')](_0x102823);})[_0xd865('0x27')](function(_0xa5955b){_0x2d3371['rows']=_0xa5955b;return _0x2d3371;})[_0xd865('0x27')](respondWithFilteredResult(_0xa59679,_0x102823))[_0xd865('0x46')](handleError(_0xa59679,null));};exports[_0xd865('0x47')]=function(_0x21cc83,_0x39c6d0){var _0x200413={'raw':!![],'where':{'id':_0x21cc83[_0xd865('0x48')]['id']}},_0x13d3e5={};_0x13d3e5[_0xd865('0x37')]=_['keys'](db['SquareRecording'][_0xd865('0x2f')]);_0x13d3e5['query']=_['keys'](_0x21cc83[_0xd865('0x33')]);_0x13d3e5[_0xd865('0x35')]=_[_0xd865('0x36')](_0x13d3e5[_0xd865('0x37')],_0x13d3e5[_0xd865('0x33')]);_0x200413[_0xd865('0x38')]=_[_0xd865('0x36')](_0x13d3e5[_0xd865('0x37')],qs['fields'](_0x21cc83[_0xd865('0x33')][_0xd865('0x39')]));_0x200413['attributes']=_0x200413[_0xd865('0x38')][_0xd865('0x49')]?_0x200413[_0xd865('0x38')]:_0x13d3e5[_0xd865('0x37')];if(_0x21cc83['query'][_0xd865('0x43')]){_0x200413[_0xd865('0x44')]=[{'all':!![]}];}_0x200413=_[_0xd865('0x40')]({},_0x200413,_0x21cc83['options']);return db[_0xd865('0x42')][_0xd865('0x4a')](_0x200413)['then'](handleEntityNotFound(_0x39c6d0,null))['then'](respondWithResult(_0x39c6d0,null))[_0xd865('0x46')](handleError(_0x39c6d0,null));};exports[_0xd865('0x4b')]=function(_0x43ba94,_0x42206f){return db['SquareRecording'][_0xd865('0x4b')](_0x43ba94[_0xd865('0x4c')],{})[_0xd865('0x27')](respondWithResult(_0x42206f,0xc9))[_0xd865('0x46')](handleError(_0x42206f,null));};exports[_0xd865('0x26')]=function(_0x17b360,_0x4506ba){if(_0x17b360[_0xd865('0x4c')]['id']){delete _0x17b360[_0xd865('0x4c')]['id'];}return db[_0xd865('0x42')][_0xd865('0x4a')]({'where':{'id':_0x17b360['params']['id']}})[_0xd865('0x27')](handleEntityNotFound(_0x4506ba,null))[_0xd865('0x27')](saveUpdates(_0x17b360[_0xd865('0x4c')],null))[_0xd865('0x27')](respondWithResult(_0x4506ba,null))[_0xd865('0x46')](handleError(_0x4506ba,null));};exports['download']=function(_0x345fec,_0x572f9b,_0x429514){var _0x672180=require(_0xd865('0x4d'));var _0x5e1f4b=![];var _0x279a10={};if(_0x345fec['query']['type']&&_0x345fec[_0xd865('0x33')][_0xd865('0x31')]===_0xd865('0x4e')){_0x279a10[_0xd865('0x4e')]=_0x345fec[_0xd865('0x48')]['id'];}else{_0x279a10['id']=_0x345fec['params']['id'];}return db[_0xd865('0x42')]['find']({'where':_0x279a10,'attributes':['id',_0xd865('0x4f'),_0xd865('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x572f9b,null))['then'](function(_0x202090){if(_0x202090){var _0x3db1ba=_0x202090['savePath'];var _0x19b190=util['format'](_0xd865('0x51'),_0x3db1ba);if(fs[_0xd865('0x52')](_0x19b190)){_0x5e1f4b=!![];return _0x672180[_0xd865('0x53')](_0x19b190,_0x3db1ba,config[_0xd865('0x54')][_0xd865('0x55')])[_0xd865('0x27')](function(){return _0x202090;});}return _0x202090;}})['then'](function(_0x1c3a6b){if(_0x1c3a6b){var _0x394741=_0x1c3a6b[_0xd865('0x4f')];if(!fs[_0xd865('0x52')](_0x394741)){throw new db[(_0xd865('0x56'))][(_0xd865('0x57'))](_0xd865('0x58'));}if(_0x1c3a6b[_0xd865('0x50')]){return _0x572f9b['download'](_0x394741,_0x1c3a6b['filename']+path[_0xd865('0x59')](_0x394741),function(){if(_0x5e1f4b){fs[_0xd865('0x5a')](_0x394741);}});}else{return _0x572f9b[_0xd865('0x5b')](_0x394741,function(_0x5e6478){if(_0x5e1f4b){fs[_0xd865('0x5a')](_0x394741);}});}}})[_0xd865('0x46')](function(_0x2b2a8b){if(_0x2b2a8b[_0xd865('0x5c')]===_0xd865('0x58')){_0x572f9b['status'](0x194)[_0xd865('0x2c')]('Not\x20found');}else{return handleError(_0x572f9b,null);}});};exports[_0xd865('0x28')]=function(_0x540d92,_0x31f8ca){return db[_0xd865('0x42')]['find']({'where':{'id':_0x540d92[_0xd865('0x48')]['id']}})[_0xd865('0x27')](function(_0x195235){if(_['isNil'](_0x195235)){throw new ReferenceError(_0xd865('0x5d'));}return _0x195235;})['then'](function(_0x502f84){var _0x3dcc9e=_0x502f84[_0xd865('0x4f')];logger['info'](_0xd865('0x5e'),_0x3dcc9e);if(!_[_0xd865('0x5f')](_0x502f84[_0xd865('0x4f')])&&fs[_0xd865('0x52')](_0x3dcc9e)){logger['info']('File:\x20\x22'+_0x3dcc9e+_0xd865('0x60'));fs[_0xd865('0x61')](_0x3dcc9e);}_0x3dcc9e=_0x3dcc9e+_0xd865('0x62');if(!_[_0xd865('0x5f')](_0x502f84[_0xd865('0x4f')])&&fs[_0xd865('0x52')](_0x3dcc9e)){logger['info'](_0xd865('0x63')+_0x3dcc9e+_0xd865('0x60'));fs['unlinkSync'](_0x3dcc9e);}return _0x502f84;})[_0xd865('0x27')](function(_0x5a3e0a){if(!_0x5a3e0a)throw new InternalError();return _0x5a3e0a[_0xd865('0x28')]();})[_0xd865('0x27')](function(){_0x31f8ca[_0xd865('0x1b')](0xcc)[_0xd865('0x1c')]();})['catch'](handleError(_0x31f8ca,null));}; \ No newline at end of file +var _0x5ff0=['recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareRecording','include','findAll','params','length','includeAll','find','catch','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile'];(function(_0x459baf,_0x332707){var _0x4a5970=function(_0x28ac61){while(--_0x28ac61){_0x459baf['push'](_0x459baf['shift']());}};_0x4a5970(++_0x332707);}(_0x5ff0,0xce));var _0x05ff=function(_0x202dcb,_0x1d3dd6){_0x202dcb=_0x202dcb-0x0;var _0x1f884a=_0x5ff0[_0x202dcb];return _0x1f884a;};'use strict';var emlformat=require(_0x05ff('0x0'));var rimraf=require(_0x05ff('0x1'));var zipdir=require(_0x05ff('0x2'));var jsonpatch=require(_0x05ff('0x3'));var rp=require(_0x05ff('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x05ff('0x5'));var util=require(_0x05ff('0x6'));var path=require(_0x05ff('0x7'));var sox=require('sox');var csv=require(_0x05ff('0x8'));var ejs=require(_0x05ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x05ff('0xa'));var crypto=require(_0x05ff('0xb'));var jsforce=require(_0x05ff('0xc'));var deskjs=require(_0x05ff('0xd'));var toCsv=require(_0x05ff('0x8'));var querystring=require('querystring');var Papa=require(_0x05ff('0xe'));var Redis=require('ioredis');var authService=require(_0x05ff('0xf'));var qs=require(_0x05ff('0x10'));var as=require(_0x05ff('0x11'));var hardwareService=require(_0x05ff('0x12'));var logger=require(_0x05ff('0x13'))('api');var utils=require(_0x05ff('0x14'));var config=require(_0x05ff('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137b30,_0x3f946e){_0x3f946e=_0x3f946e||0xcc;return function(_0x786fba){if(_0x786fba){return _0x137b30[_0x05ff('0x16')](_0x3f946e);}return _0x137b30[_0x05ff('0x17')](_0x3f946e)['end']();};}function respondWithResult(_0x832c5,_0x1192ff){_0x1192ff=_0x1192ff||0xc8;return function(_0x1ef9c6){if(_0x1ef9c6){return _0x832c5[_0x05ff('0x17')](_0x1192ff)['json'](_0x1ef9c6);}};}function respondWithFilteredResult(_0x4b21b2,_0x4082f1){return function(_0x1c7895){if(_0x1c7895){var _0x1d7b86=typeof _0x4082f1[_0x05ff('0x18')]===_0x05ff('0x19')&&typeof _0x4082f1[_0x05ff('0x1a')]===_0x05ff('0x19');var _0x52c7e6=_0x1c7895[_0x05ff('0x1b')];var _0x18d382=_0x1d7b86?0x0:_0x4082f1[_0x05ff('0x18')];var _0x3a829a=_0x1d7b86?_0x1c7895['count']:_0x4082f1[_0x05ff('0x18')]+_0x4082f1[_0x05ff('0x1a')];var _0x7feffc;if(_0x3a829a>=_0x52c7e6){_0x3a829a=_0x52c7e6;_0x7feffc=0xc8;}else{_0x7feffc=0xce;}_0x4b21b2[_0x05ff('0x17')](_0x7feffc);return _0x4b21b2[_0x05ff('0x1c')](_0x05ff('0x1d'),_0x18d382+'-'+_0x3a829a+'/'+_0x52c7e6)[_0x05ff('0x1e')](_0x1c7895);}return null;};}function patchUpdates(_0x5400c3){return function(_0x585b02){try{jsonpatch[_0x05ff('0x1f')](_0x585b02,_0x5400c3,!![]);}catch(_0x3648c1){return BPromise[_0x05ff('0x20')](_0x3648c1);}return _0x585b02['save']();};}function saveUpdates(_0x1aa8ec,_0x5962fd){return function(_0x344ee3){if(_0x344ee3){return _0x344ee3[_0x05ff('0x21')](_0x1aa8ec)[_0x05ff('0x22')](function(_0x38be24){return _0x38be24;});}return null;};}function removeEntity(_0x5092fe,_0x1f5a9b){return function(_0x5ac6aa){if(_0x5ac6aa){return _0x5ac6aa[_0x05ff('0x23')]()[_0x05ff('0x22')](function(){_0x5092fe[_0x05ff('0x17')](0xcc)[_0x05ff('0x24')]();});}};}function handleEntityNotFound(_0x1cb3a0,_0x262f6a){return function(_0x26b66e){if(!_0x26b66e){_0x1cb3a0[_0x05ff('0x16')](0x194);}return _0x26b66e;};}function handleError(_0x92e9a2,_0x51a367){_0x51a367=_0x51a367||0x1f4;return function(_0x2e0f0d){logger[_0x05ff('0x25')](_0x2e0f0d['stack']);if(_0x2e0f0d[_0x05ff('0x26')]){delete _0x2e0f0d[_0x05ff('0x26')];}_0x92e9a2[_0x05ff('0x17')](_0x51a367)['send'](_0x2e0f0d);};}exports[_0x05ff('0x27')]=function(_0xf3644d,_0x426803){var _0x349785={},_0x5ae66f={},_0xc2aabb={'count':0x0,'rows':[]};var _0x19e56c=_[_0x05ff('0x28')](db['SquareRecording'][_0x05ff('0x29')],function(_0x3d8e33){return{'name':_0x3d8e33[_0x05ff('0x2a')],'type':_0x3d8e33[_0x05ff('0x2b')][_0x05ff('0x2c')]};});_0x5ae66f[_0x05ff('0x2d')]=_[_0x05ff('0x28')](_0x19e56c,'name');_0x5ae66f[_0x05ff('0x2e')]=_[_0x05ff('0x2f')](_0xf3644d[_0x05ff('0x2e')]);_0x5ae66f[_0x05ff('0x30')]=_['intersection'](_0x5ae66f['model'],_0x5ae66f[_0x05ff('0x2e')]);_0x349785[_0x05ff('0x31')]=_[_0x05ff('0x32')](_0x5ae66f[_0x05ff('0x2d')],qs['fields'](_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x33')]));_0x349785[_0x05ff('0x31')]=_0x349785[_0x05ff('0x31')]['length']?_0x349785[_0x05ff('0x31')]:_0x5ae66f[_0x05ff('0x2d')];if(!_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x34')](_0x05ff('0x35'))){_0x349785[_0x05ff('0x1a')]=qs[_0x05ff('0x1a')](_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x1a')]);_0x349785[_0x05ff('0x18')]=qs[_0x05ff('0x18')](_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x18')]);}_0x349785[_0x05ff('0x36')]=qs[_0x05ff('0x37')](_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x37')]);_0x349785[_0x05ff('0x38')]=qs[_0x05ff('0x30')](_[_0x05ff('0x39')](_0xf3644d[_0x05ff('0x2e')],_0x5ae66f['filters']),_0x19e56c);if(_0xf3644d['query'][_0x05ff('0x3a')]){_0x349785['where']=_['merge'](_0x349785['where'],{'$or':_['map'](_0x19e56c,function(_0x98b552){if(_0x98b552[_0x05ff('0x2b')]!=='VIRTUAL'){var _0x10fecf={};_0x10fecf[_0x98b552['name']]={'$like':'%'+_0xf3644d[_0x05ff('0x2e')][_0x05ff('0x3a')]+'%'};return _0x10fecf;}})});}_0x349785=_[_0x05ff('0x3b')]({},_0x349785,_0xf3644d[_0x05ff('0x3c')]);var _0x4e5426={'where':_0x349785[_0x05ff('0x38')]};return db[_0x05ff('0x3d')][_0x05ff('0x1b')](_0x4e5426)[_0x05ff('0x22')](function(_0x3a0f9d){_0xc2aabb[_0x05ff('0x1b')]=_0x3a0f9d;if(_0xf3644d['query']['includeAll']){_0x349785[_0x05ff('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x05ff('0x3f')](_0x349785);})[_0x05ff('0x22')](function(_0x4fc58a){_0xc2aabb['rows']=_0x4fc58a;return _0xc2aabb;})['then'](respondWithFilteredResult(_0x426803,_0x349785))['catch'](handleError(_0x426803,null));};exports['show']=function(_0x58bc4d,_0x338479){var _0xab4fb3={'raw':!![],'where':{'id':_0x58bc4d[_0x05ff('0x40')]['id']}},_0x15ab4d={};_0x15ab4d[_0x05ff('0x2d')]=_[_0x05ff('0x2f')](db[_0x05ff('0x3d')][_0x05ff('0x29')]);_0x15ab4d[_0x05ff('0x2e')]=_[_0x05ff('0x2f')](_0x58bc4d[_0x05ff('0x2e')]);_0x15ab4d['filters']=_[_0x05ff('0x32')](_0x15ab4d[_0x05ff('0x2d')],_0x15ab4d[_0x05ff('0x2e')]);_0xab4fb3['attributes']=_[_0x05ff('0x32')](_0x15ab4d[_0x05ff('0x2d')],qs['fields'](_0x58bc4d[_0x05ff('0x2e')]['fields']));_0xab4fb3[_0x05ff('0x31')]=_0xab4fb3['attributes'][_0x05ff('0x41')]?_0xab4fb3[_0x05ff('0x31')]:_0x15ab4d[_0x05ff('0x2d')];if(_0x58bc4d[_0x05ff('0x2e')][_0x05ff('0x42')]){_0xab4fb3[_0x05ff('0x3e')]=[{'all':!![]}];}_0xab4fb3=_[_0x05ff('0x3b')]({},_0xab4fb3,_0x58bc4d[_0x05ff('0x3c')]);return db[_0x05ff('0x3d')][_0x05ff('0x43')](_0xab4fb3)[_0x05ff('0x22')](handleEntityNotFound(_0x338479,null))[_0x05ff('0x22')](respondWithResult(_0x338479,null))[_0x05ff('0x44')](handleError(_0x338479,null));};exports[_0x05ff('0x45')]=function(_0x1a9d80,_0x457bb1){return db[_0x05ff('0x3d')][_0x05ff('0x45')](_0x1a9d80[_0x05ff('0x46')],{})[_0x05ff('0x22')](respondWithResult(_0x457bb1,0xc9))[_0x05ff('0x44')](handleError(_0x457bb1,null));};exports['update']=function(_0x1058c7,_0x158e28){if(_0x1058c7[_0x05ff('0x46')]['id']){delete _0x1058c7[_0x05ff('0x46')]['id'];}return db['SquareRecording'][_0x05ff('0x43')]({'where':{'id':_0x1058c7['params']['id']}})[_0x05ff('0x22')](handleEntityNotFound(_0x158e28,null))['then'](saveUpdates(_0x1058c7[_0x05ff('0x46')],null))[_0x05ff('0x22')](respondWithResult(_0x158e28,null))[_0x05ff('0x44')](handleError(_0x158e28,null));};exports[_0x05ff('0x47')]=function(_0x341ef3,_0x5c67c0,_0xf74c77){var _0x1fdec4=require('../../components/encryptor');var _0x755259=![];var _0x4a1861={};if(_0x341ef3[_0x05ff('0x2e')][_0x05ff('0x2b')]&&_0x341ef3[_0x05ff('0x2e')][_0x05ff('0x2b')]===_0x05ff('0x48')){_0x4a1861[_0x05ff('0x48')]=_0x341ef3['params']['id'];}else{_0x4a1861['id']=_0x341ef3[_0x05ff('0x40')]['id'];}return db[_0x05ff('0x3d')][_0x05ff('0x43')]({'where':_0x4a1861,'attributes':['id',_0x05ff('0x49'),_0x05ff('0x4a')],'raw':!![]})[_0x05ff('0x22')](handleEntityNotFound(_0x5c67c0,null))[_0x05ff('0x22')](function(_0x516560){if(_0x516560){var _0x2ce9c8=_0x516560[_0x05ff('0x49')];var _0x3c8907=util[_0x05ff('0x4b')](_0x05ff('0x4c'),_0x2ce9c8);if(fs[_0x05ff('0x4d')](_0x3c8907)){_0x755259=!![];return _0x1fdec4[_0x05ff('0x4e')](_0x3c8907,_0x2ce9c8,config['secrets'][_0x05ff('0x4f')])[_0x05ff('0x22')](function(){return _0x516560;});}return _0x516560;}})[_0x05ff('0x22')](function(_0x4a537d){if(_0x4a537d){var _0xdc3259=_0x4a537d['savePath'];if(!fs[_0x05ff('0x4d')](_0xdc3259)){throw new db[(_0x05ff('0x50'))][(_0x05ff('0x51'))](_0x05ff('0x52'));}if(_0x4a537d['filename']){return _0x5c67c0['download'](_0xdc3259,_0x4a537d[_0x05ff('0x4a')]+path['extname'](_0xdc3259),function(){if(_0x755259){fs['unlink'](_0xdc3259);}});}else{return _0x5c67c0[_0x05ff('0x47')](_0xdc3259,function(_0x5ea52b){if(_0x755259){fs[_0x05ff('0x53')](_0xdc3259);}});}}})[_0x05ff('0x44')](function(_0x27d913){if(_0x27d913[_0x05ff('0x54')]==='SquareRecording\x20not\x20found'){_0x5c67c0[_0x05ff('0x17')](0x194)[_0x05ff('0x55')](_0x05ff('0x56'));}else{return handleError(_0x5c67c0,null);}});};exports[_0x05ff('0x23')]=function(_0x520d15,_0x2a3df5){return db['SquareRecording']['find']({'where':{'id':_0x520d15['params']['id']}})[_0x05ff('0x22')](function(_0x48aa19){if(_['isNil'](_0x48aa19)){throw new ReferenceError(_0x05ff('0x57'));}return _0x48aa19;})[_0x05ff('0x22')](function(_0x796a0c){var _0x44caf2=_0x796a0c[_0x05ff('0x49')];logger[_0x05ff('0x58')](_0x05ff('0x59'),_0x44caf2);if(!_[_0x05ff('0x5a')](_0x796a0c[_0x05ff('0x49')])&&fs[_0x05ff('0x4d')](_0x44caf2)){logger[_0x05ff('0x58')](_0x05ff('0x5b')+_0x44caf2+_0x05ff('0x5c'));fs[_0x05ff('0x5d')](_0x44caf2);}_0x44caf2=_0x44caf2+_0x05ff('0x5e');if(!_[_0x05ff('0x5a')](_0x796a0c[_0x05ff('0x49')])&&fs['existsSync'](_0x44caf2)){logger[_0x05ff('0x58')](_0x05ff('0x5b')+_0x44caf2+_0x05ff('0x5c'));fs['unlinkSync'](_0x44caf2);}return _0x796a0c;})[_0x05ff('0x22')](function(_0x4f4fd3){if(!_0x4f4fd3)throw new InternalError();return _0x4f4fd3[_0x05ff('0x23')]();})[_0x05ff('0x22')](function(){_0x2a3df5[_0x05ff('0x17')](0xcc)[_0x05ff('0x24')]();})[_0x05ff('0x44')](handleError(_0x2a3df5,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index bf2beb6..3ce68ab 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 _0x5b47=['lodash','util','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording'];(function(_0x5b4321,_0xb8b504){var _0x1a564b=function(_0x11d705){while(--_0x11d705){_0x5b4321['push'](_0x5b4321['shift']());}};_0x1a564b(++_0xb8b504);}(_0x5b47,0x120));var _0x75b4=function(_0x1ac26b,_0x49cae7){_0x1ac26b=_0x1ac26b-0x0;var _0x4952d0=_0x5b47[_0x1ac26b];return _0x4952d0;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75b4('0x2'));var rimraf=require(_0x75b4('0x3'));var config=require(_0x75b4('0x4'));var attributes=require(_0x75b4('0x5'));module[_0x75b4('0x6')]=function(_0x5f544a,_0x5ee223){return _0x5f544a['define'](_0x75b4('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcd5=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash'];(function(_0x4514a3,_0x404720){var _0x193f68=function(_0x2c1a21){while(--_0x2c1a21){_0x4514a3['push'](_0x4514a3['shift']());}};_0x193f68(++_0x404720);}(_0xdcd5,0x110));var _0x5dcd=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xdcd5[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var logger=require(_0x5dcd('0x2'))(_0x5dcd('0x3'));var moment=require(_0x5dcd('0x4'));var BPromise=require(_0x5dcd('0x5'));var rp=require(_0x5dcd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5dcd('0x7'));var config=require(_0x5dcd('0x8'));var attributes=require(_0x5dcd('0x9'));module[_0x5dcd('0xa')]=function(_0x1f13ef,_0x2c02fe){return _0x1f13ef[_0x5dcd('0xb')](_0x5dcd('0xc'),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 fa2569c..37cbeb3 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 _0xce0e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util'];(function(_0x10743d,_0x4cf792){var _0x54e952=function(_0x2c75c5){while(--_0x2c75c5){_0x10743d['push'](_0x10743d['shift']());}};_0x54e952(++_0x4cf792);}(_0xce0e,0x134));var _0xece0=function(_0x3ddee1,_0x1a33e7){_0x3ddee1=_0x3ddee1-0x0;var _0x2f3454=_0xce0e[_0x3ddee1];return _0x2f3454;};'use strict';var _=require(_0xece0('0x0'));var util=require(_0xece0('0x1'));var moment=require(_0xece0('0x2'));var BPromise=require(_0xece0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xece0('0x4'));var db=require(_0xece0('0x5'))['db'];var utils=require(_0xece0('0x6'));var logger=require(_0xece0('0x7'))(_0xece0('0x8'));var config=require('../../config/environment');var jayson=require(_0xece0('0x9'));var client=jayson[_0xece0('0xa')][_0xece0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x668aa0,_0x1c91ca,_0x33c680){return new BPromise(function(_0x3daaa3,_0x2f6872){return client[_0xece0('0xc')](_0x668aa0,_0x33c680)[_0xece0('0xd')](function(_0x28d2e0){logger[_0xece0('0xe')](_0xece0('0xf'),_0x1c91ca,'request\x20sent');logger['debug'](_0xece0('0x10'),_0x1c91ca,_0xece0('0x11'),JSON[_0xece0('0x12')](_0x28d2e0));if(_0x28d2e0[_0xece0('0x13')]){if(_0x28d2e0[_0xece0('0x13')][_0xece0('0x14')]===0x1f4){logger['error'](_0xece0('0xf'),_0x1c91ca,_0x28d2e0['error']['message']);return _0x2f6872(_0x28d2e0[_0xece0('0x13')]['message']);}logger[_0xece0('0x13')]('SquareRecording,\x20%s,\x20%s',_0x1c91ca,_0x28d2e0[_0xece0('0x13')][_0xece0('0x15')]);return _0x3daaa3(_0x28d2e0[_0xece0('0x13')][_0xece0('0x15')]);}else{logger[_0xece0('0xe')](_0xece0('0xf'),_0x1c91ca,_0xece0('0x11'));_0x3daaa3(_0x28d2e0[_0xece0('0x16')][_0xece0('0x15')]);}})[_0xece0('0x17')](function(_0x1b8acd){logger['error'](_0xece0('0xf'),_0x1c91ca,_0x1b8acd);_0x2f6872(_0x1b8acd);});});}exports[_0xece0('0x18')]=function(_0x2b1b75){var _0x529b13=this;return new Promise(function(_0x15293e,_0x471565){return db[_0xece0('0x19')][_0xece0('0x1a')](_0x2b1b75[_0xece0('0x1b')],{'raw':_0x2b1b75[_0xece0('0x1c')]?_0x2b1b75[_0xece0('0x1c')][_0xece0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4617d6){logger[_0xece0('0xe')]('CreateSquareRecording',_0x2b1b75);logger[_0xece0('0x1e')](_0xece0('0x18'),_0x2b1b75,JSON['stringify'](_0x4617d6));_0x15293e(_0x4617d6);})[_0xece0('0x17')](function(_0x53a17b){logger[_0xece0('0x13')](_0xece0('0x18'),_0x53a17b['message'],_0x2b1b75);_0x471565(_0x529b13[_0xece0('0x13')](0x1f4,_0x53a17b['message']));});});}; \ No newline at end of file +var _0xb96f=['rpc','jayson/promise','http','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareRecording,\x20%s,\x20%s','info','result','catch','CreateSquareRecording','create','options','moment','randomstring','ioredis','../../config/utils'];(function(_0x4d3924,_0x327b56){var _0x844555=function(_0x387a6d){while(--_0x387a6d){_0x4d3924['push'](_0x4d3924['shift']());}};_0x844555(++_0x327b56);}(_0xb96f,0x14c));var _0xfb96=function(_0x5cc904,_0x40487e){_0x5cc904=_0x5cc904-0x0;var _0x3d8804=_0xb96f[_0x5cc904];return _0x3d8804;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfb96('0x0'));var BPromise=require('bluebird');var rs=require(_0xfb96('0x1'));var fs=require('fs');var Redis=require(_0xfb96('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb96('0x3'));var logger=require('../../config/logger')(_0xfb96('0x4'));var config=require('../../config/environment');var jayson=require(_0xfb96('0x5'));var client=jayson['client'][_0xfb96('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2cf856,_0x522cf2,_0x31c31e){return new BPromise(function(_0x21750d,_0x250aae){return client['request'](_0x2cf856,_0x31c31e)[_0xfb96('0x7')](function(_0x2f7dad){logger['info']('SquareRecording,\x20%s,\x20%s',_0x522cf2,'request\x20sent');logger[_0xfb96('0x8')](_0xfb96('0x9'),_0x522cf2,_0xfb96('0xa'),JSON[_0xfb96('0xb')](_0x2f7dad));if(_0x2f7dad[_0xfb96('0xc')]){if(_0x2f7dad[_0xfb96('0xc')]['code']===0x1f4){logger[_0xfb96('0xc')]('SquareRecording,\x20%s,\x20%s',_0x522cf2,_0x2f7dad[_0xfb96('0xc')][_0xfb96('0xd')]);return _0x250aae(_0x2f7dad[_0xfb96('0xc')][_0xfb96('0xd')]);}logger[_0xfb96('0xc')](_0xfb96('0xe'),_0x522cf2,_0x2f7dad[_0xfb96('0xc')]['message']);return _0x21750d(_0x2f7dad[_0xfb96('0xc')][_0xfb96('0xd')]);}else{logger[_0xfb96('0xf')](_0xfb96('0xe'),_0x522cf2,_0xfb96('0xa'));_0x21750d(_0x2f7dad[_0xfb96('0x10')][_0xfb96('0xd')]);}})[_0xfb96('0x11')](function(_0x3f6cc0){logger[_0xfb96('0xc')](_0xfb96('0xe'),_0x522cf2,_0x3f6cc0);_0x250aae(_0x3f6cc0);});});}exports[_0xfb96('0x12')]=function(_0x1d9c5b){var _0x51fa43=this;return new Promise(function(_0x1c6ada,_0x5424f2){return db['SquareRecording'][_0xfb96('0x13')](_0x1d9c5b['body'],{'raw':_0x1d9c5b['options']?_0x1d9c5b[_0xfb96('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xe71f46){logger[_0xfb96('0xf')](_0xfb96('0x12'),_0x1d9c5b);logger['debug'](_0xfb96('0x12'),_0x1d9c5b,JSON[_0xfb96('0xb')](_0xe71f46));_0x1c6ada(_0xe71f46);})[_0xfb96('0x11')](function(_0x1ff67d){logger[_0xfb96('0xc')](_0xfb96('0x12'),_0x1ff67d[_0xfb96('0xd')],_0x1d9c5b);_0x5424f2(_0x51fa43[_0xfb96('0xc')](0x1f4,_0x1ff67d[_0xfb96('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 1bb3c6f..c8fe1c3 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x29881c,_0x458fa2){var _0x918f30=function(_0x419525){while(--_0x419525){_0x29881c['push'](_0x29881c['shift']());}};_0x918f30(++_0x458fa2);}(_0xb10b,0x12a));var _0xbb10=function(_0x10c2d3,_0x2f5914){_0x10c2d3=_0x10c2d3-0x0;var _0x5a0b13=_0xb10b[_0x10c2d3];return _0x5a0b13;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x14cc13,_0x18cb60){var _0x2dc79a=function(_0x4c46c5){while(--_0x4c46c5){_0x14cc13['push'](_0x14cc13['shift']());}};_0x2dc79a(++_0x18cb60);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['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 562d483..5ba93b8 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 _0xeabf=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xeabf,0x90));var _0xfeab=function(_0x29c86d,_0x114329){_0x29c86d=_0x29c86d-0x0;var _0x553d44=_0xeabf[_0x29c86d];return _0x553d44;};'use strict';var Sequelize=require(_0xfeab('0x0'));module[_0xfeab('0x1')]={'network':{'type':Sequelize[_0xfeab('0x2')]},'network_script':{'type':Sequelize[_0xfeab('0x2')]},'request':{'type':Sequelize[_0xfeab('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfeab('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfeab('0x2')]},'version':{'type':Sequelize[_0xfeab('0x2')]},'callerid':{'type':Sequelize[_0xfeab('0x2')]},'calleridname':{'type':Sequelize[_0xfeab('0x2')]},'callingpres':{'type':Sequelize[_0xfeab('0x2')]},'callingani2':{'type':Sequelize[_0xfeab('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfeab('0x2')]},'rdnis':{'type':Sequelize[_0xfeab('0x2')]},'context':{'type':Sequelize[_0xfeab('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfeab('0x2')]},'enhanced':{'type':Sequelize[_0xfeab('0x2')]},'accountcode':{'type':Sequelize[_0xfeab('0x2')]},'threadid':{'type':Sequelize[_0xfeab('0x2')]},'project_name':{'type':Sequelize[_0xfeab('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfeab('0x3')]},'bot':{'type':Sequelize[_0xfeab('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x038f=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3d66db,_0x82511){var _0x5b6644=function(_0x520d0b){while(--_0x520d0b){_0x3d66db['push'](_0x3d66db['shift']());}};_0x5b6644(++_0x82511);}(_0x038f,0x106));var _0xf038=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x038f[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0xf038('0x0'));module[_0xf038('0x1')]={'network':{'type':Sequelize[_0xf038('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xf038('0x2')]},'channel':{'type':Sequelize[_0xf038('0x2')]},'language':{'type':Sequelize[_0xf038('0x2')]},'type':{'type':Sequelize[_0xf038('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf038('0x2')]},'calleridname':{'type':Sequelize[_0xf038('0x2')]},'callingpres':{'type':Sequelize[_0xf038('0x2')]},'callingani2':{'type':Sequelize[_0xf038('0x2')]},'callington':{'type':Sequelize[_0xf038('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf038('0x2')]},'rdnis':{'type':Sequelize[_0xf038('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf038('0x2')]},'priority':{'type':Sequelize[_0xf038('0x2')]},'enhanced':{'type':Sequelize[_0xf038('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf038('0x2')]},'joinAt':{'type':Sequelize[_0xf038('0x3')]},'leaveAt':{'type':Sequelize[_0xf038('0x3')]},'bot':{'type':Sequelize[_0xf038('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index ab75e82..3f3e138 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 _0xc3c6=['json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','SquareReport','rows','catch','show','params','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1a6e19,_0x1b8010){var _0x1bdf83=function(_0x5610d5){while(--_0x5610d5){_0x1a6e19['push'](_0x1a6e19['shift']());}};_0x1bdf83(++_0x1b8010);}(_0xc3c6,0x192));var _0x6c3c=function(_0x5de9d4,_0x273f27){_0x5de9d4=_0x5de9d4-0x0;var _0x51f826=_0xc3c6[_0x5de9d4];return _0x51f826;};'use strict';var emlformat=require(_0x6c3c('0x0'));var rimraf=require(_0x6c3c('0x1'));var zipdir=require(_0x6c3c('0x2'));var jsonpatch=require(_0x6c3c('0x3'));var rp=require(_0x6c3c('0x4'));var moment=require('moment');var BPromise=require(_0x6c3c('0x5'));var Mustache=require('mustache');var util=require(_0x6c3c('0x6'));var path=require(_0x6c3c('0x7'));var sox=require(_0x6c3c('0x8'));var csv=require(_0x6c3c('0x9'));var ejs=require(_0x6c3c('0xa'));var fs=require('fs');var fs_extra=require(_0x6c3c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6c3c('0xc'));var jsforce=require(_0x6c3c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6c3c('0x9'));var querystring=require('querystring');var Papa=require(_0x6c3c('0xe'));var Redis=require(_0x6c3c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6c3c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c3c('0x11'));var logger=require('../../config/logger')(_0x6c3c('0x12'));var utils=require(_0x6c3c('0x13'));var config=require(_0x6c3c('0x14'));var licenseUtil=require(_0x6c3c('0x15'));var db=require(_0x6c3c('0x16'))['db'];function respondWithStatusCode(_0x31c4dd,_0x223855){_0x223855=_0x223855||0xcc;return function(_0x5c79db){if(_0x5c79db){return _0x31c4dd['sendStatus'](_0x223855);}return _0x31c4dd['status'](_0x223855)['end']();};}function respondWithResult(_0x5c83a9,_0x2a7b2b){_0x2a7b2b=_0x2a7b2b||0xc8;return function(_0x41c4e2){if(_0x41c4e2){return _0x5c83a9[_0x6c3c('0x17')](_0x2a7b2b)[_0x6c3c('0x18')](_0x41c4e2);}};}function respondWithFilteredResult(_0xc32c2,_0x1a6621){return function(_0x1ff3c5){if(_0x1ff3c5){var _0x1200b3=typeof _0x1a6621[_0x6c3c('0x19')]===_0x6c3c('0x1a')&&typeof _0x1a6621[_0x6c3c('0x1b')]===_0x6c3c('0x1a');var _0x17d4cd=_0x1ff3c5[_0x6c3c('0x1c')];var _0x5751dd=_0x1200b3?0x0:_0x1a6621[_0x6c3c('0x19')];var _0x3681bb=_0x1200b3?_0x1ff3c5[_0x6c3c('0x1c')]:_0x1a6621['offset']+_0x1a6621[_0x6c3c('0x1b')];var _0x3fece7;if(_0x3681bb>=_0x17d4cd){_0x3681bb=_0x17d4cd;_0x3fece7=0xc8;}else{_0x3fece7=0xce;}_0xc32c2[_0x6c3c('0x17')](_0x3fece7);return _0xc32c2[_0x6c3c('0x1d')](_0x6c3c('0x1e'),_0x5751dd+'-'+_0x3681bb+'/'+_0x17d4cd)['json'](_0x1ff3c5);}return null;};}function patchUpdates(_0x592d20){return function(_0x214f1d){try{jsonpatch['apply'](_0x214f1d,_0x592d20,!![]);}catch(_0xbfd3d){return BPromise['reject'](_0xbfd3d);}return _0x214f1d['save']();};}function saveUpdates(_0x208773,_0x2f5692){return function(_0x5f5628){if(_0x5f5628){return _0x5f5628[_0x6c3c('0x1f')](_0x208773)[_0x6c3c('0x20')](function(_0x1701c2){return _0x1701c2;});}return null;};}function removeEntity(_0x10f18d,_0x1d3872){return function(_0x17936c){if(_0x17936c){return _0x17936c[_0x6c3c('0x21')]()[_0x6c3c('0x20')](function(){_0x10f18d[_0x6c3c('0x17')](0xcc)[_0x6c3c('0x22')]();});}};}function handleEntityNotFound(_0x9322fa,_0x198a5f){return function(_0x18390f){if(!_0x18390f){_0x9322fa[_0x6c3c('0x23')](0x194);}return _0x18390f;};}function handleError(_0x222025,_0x325c44){_0x325c44=_0x325c44||0x1f4;return function(_0x56a355){logger[_0x6c3c('0x24')](_0x56a355[_0x6c3c('0x25')]);if(_0x56a355['name']){delete _0x56a355[_0x6c3c('0x26')];}_0x222025['status'](_0x325c44)['send'](_0x56a355);};}exports[_0x6c3c('0x27')]=function(_0x924a5b,_0x3c2bbe){var _0x20e11e={},_0x37eb38={},_0x465904={'count':0x0,'rows':[]};var _0x1cdb6f=_[_0x6c3c('0x28')](db['SquareReport'][_0x6c3c('0x29')],function(_0x16790f){return{'name':_0x16790f['fieldName'],'type':_0x16790f[_0x6c3c('0x2a')][_0x6c3c('0x2b')]};});_0x37eb38[_0x6c3c('0x2c')]=_[_0x6c3c('0x28')](_0x1cdb6f,_0x6c3c('0x26'));_0x37eb38[_0x6c3c('0x2d')]=_[_0x6c3c('0x2e')](_0x924a5b[_0x6c3c('0x2d')]);_0x37eb38['filters']=_[_0x6c3c('0x2f')](_0x37eb38[_0x6c3c('0x2c')],_0x37eb38['query']);_0x20e11e[_0x6c3c('0x30')]=_[_0x6c3c('0x2f')](_0x37eb38[_0x6c3c('0x2c')],qs[_0x6c3c('0x31')](_0x924a5b[_0x6c3c('0x2d')][_0x6c3c('0x31')]));_0x20e11e[_0x6c3c('0x30')]=_0x20e11e[_0x6c3c('0x30')][_0x6c3c('0x32')]?_0x20e11e[_0x6c3c('0x30')]:_0x37eb38[_0x6c3c('0x2c')];if(!_0x924a5b['query']['hasOwnProperty']('nolimit')){_0x20e11e[_0x6c3c('0x1b')]=qs[_0x6c3c('0x1b')](_0x924a5b[_0x6c3c('0x2d')]['limit']);_0x20e11e['offset']=qs[_0x6c3c('0x19')](_0x924a5b['query'][_0x6c3c('0x19')]);}_0x20e11e[_0x6c3c('0x33')]=qs[_0x6c3c('0x34')](_0x924a5b[_0x6c3c('0x2d')][_0x6c3c('0x34')]);_0x20e11e['where']=qs[_0x6c3c('0x35')](_[_0x6c3c('0x36')](_0x924a5b[_0x6c3c('0x2d')],_0x37eb38[_0x6c3c('0x35')]),_0x1cdb6f);if(_0x924a5b['query'][_0x6c3c('0x37')]){_0x20e11e[_0x6c3c('0x38')]=_['merge'](_0x20e11e[_0x6c3c('0x38')],{'$or':_[_0x6c3c('0x28')](_0x1cdb6f,function(_0x58c582){if(_0x58c582['type']!==_0x6c3c('0x39')){var _0x5da15a={};_0x5da15a[_0x58c582[_0x6c3c('0x26')]]={'$like':'%'+_0x924a5b['query'][_0x6c3c('0x37')]+'%'};return _0x5da15a;}})});}_0x20e11e=_[_0x6c3c('0x3a')]({},_0x20e11e,_0x924a5b[_0x6c3c('0x3b')]);var _0x5e2a3d={'where':_0x20e11e[_0x6c3c('0x38')]};return db[_0x6c3c('0x3c')][_0x6c3c('0x1c')](_0x5e2a3d)[_0x6c3c('0x20')](function(_0x3604d2){_0x465904[_0x6c3c('0x1c')]=_0x3604d2;if(_0x924a5b[_0x6c3c('0x2d')]['includeAll']){_0x20e11e['include']=[{'all':!![]}];}return db[_0x6c3c('0x3c')]['findAll'](_0x20e11e);})[_0x6c3c('0x20')](function(_0x4ca2c5){_0x465904[_0x6c3c('0x3d')]=_0x4ca2c5;return _0x465904;})['then'](respondWithFilteredResult(_0x3c2bbe,_0x20e11e))[_0x6c3c('0x3e')](handleError(_0x3c2bbe,null));};exports[_0x6c3c('0x3f')]=function(_0x5c8671,_0x2a0d6f){var _0x1cfb16={'raw':!![],'where':{'id':_0x5c8671[_0x6c3c('0x40')]['id']}},_0x567c48={};_0x567c48[_0x6c3c('0x2c')]=_['keys'](db[_0x6c3c('0x3c')]['rawAttributes']);_0x567c48[_0x6c3c('0x2d')]=_[_0x6c3c('0x2e')](_0x5c8671[_0x6c3c('0x2d')]);_0x567c48[_0x6c3c('0x35')]=_[_0x6c3c('0x2f')](_0x567c48[_0x6c3c('0x2c')],_0x567c48[_0x6c3c('0x2d')]);_0x1cfb16[_0x6c3c('0x30')]=_['intersection'](_0x567c48[_0x6c3c('0x2c')],qs['fields'](_0x5c8671[_0x6c3c('0x2d')][_0x6c3c('0x31')]));_0x1cfb16['attributes']=_0x1cfb16[_0x6c3c('0x30')][_0x6c3c('0x32')]?_0x1cfb16[_0x6c3c('0x30')]:_0x567c48[_0x6c3c('0x2c')];if(_0x5c8671[_0x6c3c('0x2d')][_0x6c3c('0x41')]){_0x1cfb16[_0x6c3c('0x42')]=[{'all':!![]}];}_0x1cfb16=_[_0x6c3c('0x3a')]({},_0x1cfb16,_0x5c8671['options']);return db['SquareReport'][_0x6c3c('0x43')](_0x1cfb16)['then'](handleEntityNotFound(_0x2a0d6f,null))['then'](respondWithResult(_0x2a0d6f,null))[_0x6c3c('0x3e')](handleError(_0x2a0d6f,null));};exports[_0x6c3c('0x44')]=function(_0x119990,_0x4ee9e7){return db[_0x6c3c('0x3c')]['create'](_0x119990['body'],{})[_0x6c3c('0x20')](respondWithResult(_0x4ee9e7,0xc9))[_0x6c3c('0x3e')](handleError(_0x4ee9e7,null));};exports['update']=function(_0x23e84c,_0x21fc0f){if(_0x23e84c[_0x6c3c('0x45')]['id']){delete _0x23e84c[_0x6c3c('0x45')]['id'];}return db[_0x6c3c('0x3c')][_0x6c3c('0x43')]({'where':{'id':_0x23e84c[_0x6c3c('0x40')]['id']}})['then'](handleEntityNotFound(_0x21fc0f,null))['then'](saveUpdates(_0x23e84c['body'],null))[_0x6c3c('0x20')](respondWithResult(_0x21fc0f,null))[_0x6c3c('0x3e')](handleError(_0x21fc0f,null));};exports[_0x6c3c('0x21')]=function(_0x525bef,_0x347787){return db['SquareReport'][_0x6c3c('0x43')]({'where':{'id':_0x525bef[_0x6c3c('0x40')]['id']}})[_0x6c3c('0x20')](handleEntityNotFound(_0x347787,null))[_0x6c3c('0x20')](removeEntity(_0x347787,null))['catch'](handleError(_0x347787,null));};exports[_0x6c3c('0x46')]=function(_0x26bf5e,_0x278461){return db[_0x6c3c('0x3c')]['describe']()[_0x6c3c('0x20')](respondWithResult(_0x278461,null))[_0x6c3c('0x3e')](handleError(_0x278461,null));}; \ No newline at end of file +var _0x2038=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SquareReport','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0xe38b5a,_0x29d173){var _0x2e08c2=function(_0x1eea21){while(--_0x1eea21){_0xe38b5a['push'](_0xe38b5a['shift']());}};_0x2e08c2(++_0x29d173);}(_0x2038,0x18b));var _0x8203=function(_0xc89b5f,_0x53abe6){_0xc89b5f=_0xc89b5f-0x0;var _0xfec061=_0x2038[_0xc89b5f];return _0xfec061;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8203('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8203('0x1'));var moment=require(_0x8203('0x2'));var BPromise=require(_0x8203('0x3'));var Mustache=require(_0x8203('0x4'));var util=require(_0x8203('0x5'));var path=require(_0x8203('0x6'));var sox=require(_0x8203('0x7'));var csv=require(_0x8203('0x8'));var ejs=require(_0x8203('0x9'));var fs=require('fs');var fs_extra=require(_0x8203('0xa'));var _=require(_0x8203('0xb'));var squel=require(_0x8203('0xc'));var crypto=require('crypto');var jsforce=require(_0x8203('0xd'));var deskjs=require(_0x8203('0xe'));var toCsv=require(_0x8203('0x8'));var querystring=require(_0x8203('0xf'));var Papa=require(_0x8203('0x10'));var Redis=require(_0x8203('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8203('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8203('0x13'));var logger=require(_0x8203('0x14'))(_0x8203('0x15'));var utils=require(_0x8203('0x16'));var config=require(_0x8203('0x17'));var licenseUtil=require(_0x8203('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a09c5,_0x5f39cd){_0x5f39cd=_0x5f39cd||0xcc;return function(_0x4c5af6){if(_0x4c5af6){return _0x1a09c5[_0x8203('0x19')](_0x5f39cd);}return _0x1a09c5[_0x8203('0x1a')](_0x5f39cd)['end']();};}function respondWithResult(_0x48ca90,_0x232157){_0x232157=_0x232157||0xc8;return function(_0xe76f3){if(_0xe76f3){return _0x48ca90[_0x8203('0x1a')](_0x232157)[_0x8203('0x1b')](_0xe76f3);}};}function respondWithFilteredResult(_0x13365f,_0x57298b){return function(_0x202d9f){if(_0x202d9f){var _0x3185e8=typeof _0x57298b[_0x8203('0x1c')]===_0x8203('0x1d')&&typeof _0x57298b[_0x8203('0x1e')]===_0x8203('0x1d');var _0x8e82a2=_0x202d9f['count'];var _0x56c477=_0x3185e8?0x0:_0x57298b[_0x8203('0x1c')];var _0x5db0a7=_0x3185e8?_0x202d9f[_0x8203('0x1f')]:_0x57298b[_0x8203('0x1c')]+_0x57298b[_0x8203('0x1e')];var _0x1b51e3;if(_0x5db0a7>=_0x8e82a2){_0x5db0a7=_0x8e82a2;_0x1b51e3=0xc8;}else{_0x1b51e3=0xce;}_0x13365f[_0x8203('0x1a')](_0x1b51e3);return _0x13365f[_0x8203('0x20')](_0x8203('0x21'),_0x56c477+'-'+_0x5db0a7+'/'+_0x8e82a2)[_0x8203('0x1b')](_0x202d9f);}return null;};}function patchUpdates(_0x39a71c){return function(_0x2374a8){try{jsonpatch[_0x8203('0x22')](_0x2374a8,_0x39a71c,!![]);}catch(_0xd6197){return BPromise[_0x8203('0x23')](_0xd6197);}return _0x2374a8[_0x8203('0x24')]();};}function saveUpdates(_0x520199,_0x37933a){return function(_0x29f391){if(_0x29f391){return _0x29f391['update'](_0x520199)[_0x8203('0x25')](function(_0xce5d97){return _0xce5d97;});}return null;};}function removeEntity(_0x5e7a82,_0x5c0933){return function(_0x52eaf1){if(_0x52eaf1){return _0x52eaf1[_0x8203('0x26')]()[_0x8203('0x25')](function(){_0x5e7a82[_0x8203('0x1a')](0xcc)[_0x8203('0x27')]();});}};}function handleEntityNotFound(_0x10770a,_0x2f509e){return function(_0x5296af){if(!_0x5296af){_0x10770a[_0x8203('0x19')](0x194);}return _0x5296af;};}function handleError(_0x2a6166,_0x1da87f){_0x1da87f=_0x1da87f||0x1f4;return function(_0x590d88){logger[_0x8203('0x28')](_0x590d88[_0x8203('0x29')]);if(_0x590d88['name']){delete _0x590d88[_0x8203('0x2a')];}_0x2a6166[_0x8203('0x1a')](_0x1da87f)[_0x8203('0x2b')](_0x590d88);};}exports[_0x8203('0x2c')]=function(_0x185c2f,_0x33ba31){var _0x280a29={},_0x59db04={},_0x4cbbc3={'count':0x0,'rows':[]};var _0x459c12=_[_0x8203('0x2d')](db[_0x8203('0x2e')]['rawAttributes'],function(_0x5e29d0){return{'name':_0x5e29d0['fieldName'],'type':_0x5e29d0['type'][_0x8203('0x2f')]};});_0x59db04['model']=_[_0x8203('0x2d')](_0x459c12,_0x8203('0x2a'));_0x59db04[_0x8203('0x30')]=_[_0x8203('0x31')](_0x185c2f[_0x8203('0x30')]);_0x59db04[_0x8203('0x32')]=_[_0x8203('0x33')](_0x59db04[_0x8203('0x34')],_0x59db04[_0x8203('0x30')]);_0x280a29[_0x8203('0x35')]=_['intersection'](_0x59db04[_0x8203('0x34')],qs[_0x8203('0x36')](_0x185c2f[_0x8203('0x30')][_0x8203('0x36')]));_0x280a29['attributes']=_0x280a29[_0x8203('0x35')][_0x8203('0x37')]?_0x280a29[_0x8203('0x35')]:_0x59db04[_0x8203('0x34')];if(!_0x185c2f[_0x8203('0x30')][_0x8203('0x38')](_0x8203('0x39'))){_0x280a29['limit']=qs[_0x8203('0x1e')](_0x185c2f[_0x8203('0x30')]['limit']);_0x280a29[_0x8203('0x1c')]=qs[_0x8203('0x1c')](_0x185c2f[_0x8203('0x30')][_0x8203('0x1c')]);}_0x280a29[_0x8203('0x3a')]=qs[_0x8203('0x3b')](_0x185c2f[_0x8203('0x30')][_0x8203('0x3b')]);_0x280a29[_0x8203('0x3c')]=qs['filters'](_[_0x8203('0x3d')](_0x185c2f[_0x8203('0x30')],_0x59db04[_0x8203('0x32')]),_0x459c12);if(_0x185c2f[_0x8203('0x30')][_0x8203('0x3e')]){_0x280a29['where']=_[_0x8203('0x3f')](_0x280a29[_0x8203('0x3c')],{'$or':_[_0x8203('0x2d')](_0x459c12,function(_0x3e03ea){if(_0x3e03ea['type']!==_0x8203('0x40')){var _0xbbd753={};_0xbbd753[_0x3e03ea[_0x8203('0x2a')]]={'$like':'%'+_0x185c2f['query'][_0x8203('0x3e')]+'%'};return _0xbbd753;}})});}_0x280a29=_['merge']({},_0x280a29,_0x185c2f[_0x8203('0x41')]);var _0x1649f1={'where':_0x280a29[_0x8203('0x3c')]};return db[_0x8203('0x2e')][_0x8203('0x1f')](_0x1649f1)[_0x8203('0x25')](function(_0x50b114){_0x4cbbc3['count']=_0x50b114;if(_0x185c2f[_0x8203('0x30')][_0x8203('0x42')]){_0x280a29[_0x8203('0x43')]=[{'all':!![]}];}return db[_0x8203('0x2e')]['findAll'](_0x280a29);})[_0x8203('0x25')](function(_0xc58b40){_0x4cbbc3['rows']=_0xc58b40;return _0x4cbbc3;})[_0x8203('0x25')](respondWithFilteredResult(_0x33ba31,_0x280a29))[_0x8203('0x44')](handleError(_0x33ba31,null));};exports[_0x8203('0x45')]=function(_0x2ae505,_0x5c3c80){var _0x15daa8={'raw':!![],'where':{'id':_0x2ae505[_0x8203('0x46')]['id']}},_0xcf105c={};_0xcf105c[_0x8203('0x34')]=_[_0x8203('0x31')](db[_0x8203('0x2e')][_0x8203('0x47')]);_0xcf105c[_0x8203('0x30')]=_['keys'](_0x2ae505[_0x8203('0x30')]);_0xcf105c[_0x8203('0x32')]=_[_0x8203('0x33')](_0xcf105c[_0x8203('0x34')],_0xcf105c[_0x8203('0x30')]);_0x15daa8['attributes']=_[_0x8203('0x33')](_0xcf105c[_0x8203('0x34')],qs['fields'](_0x2ae505['query'][_0x8203('0x36')]));_0x15daa8[_0x8203('0x35')]=_0x15daa8[_0x8203('0x35')][_0x8203('0x37')]?_0x15daa8[_0x8203('0x35')]:_0xcf105c[_0x8203('0x34')];if(_0x2ae505[_0x8203('0x30')]['includeAll']){_0x15daa8[_0x8203('0x43')]=[{'all':!![]}];}_0x15daa8=_[_0x8203('0x3f')]({},_0x15daa8,_0x2ae505['options']);return db[_0x8203('0x2e')][_0x8203('0x48')](_0x15daa8)[_0x8203('0x25')](handleEntityNotFound(_0x5c3c80,null))['then'](respondWithResult(_0x5c3c80,null))[_0x8203('0x44')](handleError(_0x5c3c80,null));};exports[_0x8203('0x49')]=function(_0x334ad1,_0x3f9f5a){return db[_0x8203('0x2e')]['create'](_0x334ad1[_0x8203('0x4a')],{})[_0x8203('0x25')](respondWithResult(_0x3f9f5a,0xc9))['catch'](handleError(_0x3f9f5a,null));};exports['update']=function(_0x47642e,_0x4e1d0c){if(_0x47642e[_0x8203('0x4a')]['id']){delete _0x47642e['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x47642e[_0x8203('0x46')]['id']}})[_0x8203('0x25')](handleEntityNotFound(_0x4e1d0c,null))[_0x8203('0x25')](saveUpdates(_0x47642e[_0x8203('0x4a')],null))[_0x8203('0x25')](respondWithResult(_0x4e1d0c,null))[_0x8203('0x44')](handleError(_0x4e1d0c,null));};exports[_0x8203('0x26')]=function(_0x5b9041,_0x21ea82){return db['SquareReport'][_0x8203('0x48')]({'where':{'id':_0x5b9041[_0x8203('0x46')]['id']}})[_0x8203('0x25')](handleEntityNotFound(_0x21ea82,null))[_0x8203('0x25')](removeEntity(_0x21ea82,null))['catch'](handleError(_0x21ea82,null));};exports['describe']=function(_0x390dac,_0x3813d3){return db[_0x8203('0x2e')]['describe']()[_0x8203('0x25')](respondWithResult(_0x3813d3,null))[_0x8203('0x44')](handleError(_0x3813d3,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 460c8d8..819d637 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 _0x6057=['uniqueid','project_name','leaveAt','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','report_square','uid_pname'];(function(_0x18a6c4,_0x35aebc){var _0x52532c=function(_0x5b1367){while(--_0x5b1367){_0x18a6c4['push'](_0x18a6c4['shift']());}};_0x52532c(++_0x35aebc);}(_0x6057,0x1f2));var _0x7605=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x6057[_0x2e913b];return _0x173899;};'use strict';var _=require(_0x7605('0x0'));var util=require('util');var logger=require(_0x7605('0x1'))(_0x7605('0x2'));var moment=require('moment');var BPromise=require(_0x7605('0x3'));var rp=require(_0x7605('0x4'));var fs=require('fs');var path=require(_0x7605('0x5'));var rimraf=require(_0x7605('0x6'));var config=require('../../config/environment');var attributes=require(_0x7605('0x7'));module[_0x7605('0x8')]=function(_0x1e94d4,_0x4f55eb){return _0x1e94d4[_0x7605('0x9')]('SquareReport',attributes,{'tableName':_0x7605('0xa'),'paranoid':![],'indexes':[{'name':_0x7605('0xb'),'fields':[_0x7605('0xc'),_0x7605('0xd')]},{'name':_0x7605('0xe'),'fields':[_0x7605('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9211=['report_square','uniqueid','project_name','leaveAt','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x572ffd,_0x4bdac4){var _0x2a599a=function(_0x2d5f3f){while(--_0x2d5f3f){_0x572ffd['push'](_0x572ffd['shift']());}};_0x2a599a(++_0x4bdac4);}(_0x9211,0x10e));var _0x1921=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0x9211[_0x11ce46];return _0x272001;};'use strict';var _=require(_0x1921('0x0'));var util=require(_0x1921('0x1'));var logger=require('../../config/logger')(_0x1921('0x2'));var moment=require(_0x1921('0x3'));var BPromise=require(_0x1921('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1921('0x5'));var config=require(_0x1921('0x6'));var attributes=require(_0x1921('0x7'));module['exports']=function(_0x473917,_0x1e4e12){return _0x473917[_0x1921('0x8')](_0x1921('0x9'),attributes,{'tableName':_0x1921('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1921('0xb'),_0x1921('0xc')]},{'name':_0x1921('0xd'),'fields':[_0x1921('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index b58d6f3..48ff62c 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 _0xe730=['request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareReport','SquareReport','create','options','raw','info','catch','UpdateSquareReport','update','body','where','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s'];(function(_0x21f9c2,_0x2b3d2a){var _0x3da17f=function(_0x57e2b9){while(--_0x57e2b9){_0x21f9c2['push'](_0x21f9c2['shift']());}};_0x3da17f(++_0x2b3d2a);}(_0xe730,0x1b6));var _0x0e73=function(_0xa794bd,_0x63348b){_0xa794bd=_0xa794bd-0x0;var _0x154085=_0xe730[_0xa794bd];return _0x154085;};'use strict';var _=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0e73('0x2'));var fs=require('fs');var Redis=require(_0x0e73('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e73('0x4'))('rpc');var config=require(_0x0e73('0x5'));var jayson=require(_0x0e73('0x6'));var client=jayson[_0x0e73('0x7')][_0x0e73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4598e5,_0x26bd45,_0x39415b){return new BPromise(function(_0x57077e,_0x46b719){return client[_0x0e73('0x9')](_0x4598e5,_0x39415b)[_0x0e73('0xa')](function(_0x44633a){logger['info'](_0x0e73('0xb'),_0x26bd45,_0x0e73('0xc'));logger[_0x0e73('0xd')](_0x0e73('0xe'),_0x26bd45,'request\x20sent',JSON[_0x0e73('0xf')](_0x44633a));if(_0x44633a[_0x0e73('0x10')]){if(_0x44633a[_0x0e73('0x10')][_0x0e73('0x11')]===0x1f4){logger[_0x0e73('0x10')]('SquareReport,\x20%s,\x20%s',_0x26bd45,_0x44633a[_0x0e73('0x10')]['message']);return _0x46b719(_0x44633a[_0x0e73('0x10')][_0x0e73('0x12')]);}logger[_0x0e73('0x10')](_0x0e73('0xb'),_0x26bd45,_0x44633a[_0x0e73('0x10')][_0x0e73('0x12')]);return _0x57077e(_0x44633a[_0x0e73('0x10')][_0x0e73('0x12')]);}else{logger['info'](_0x0e73('0xb'),_0x26bd45,_0x0e73('0xc'));_0x57077e(_0x44633a['result']['message']);}})['catch'](function(_0x1bc09f){logger[_0x0e73('0x10')](_0x0e73('0xb'),_0x26bd45,_0x1bc09f);_0x46b719(_0x1bc09f);});});}exports[_0x0e73('0x13')]=function(_0x4d4830){var _0x1d6d34=this;return new Promise(function(_0x8eb4fe,_0x2d4297){return db[_0x0e73('0x14')][_0x0e73('0x15')](_0x4d4830['body'],{'raw':_0x4d4830['options']?_0x4d4830[_0x0e73('0x16')][_0x0e73('0x17')]===undefined?!![]:![]:!![]})[_0x0e73('0xa')](function(_0x53ebaf){logger[_0x0e73('0x18')](_0x0e73('0x13'),_0x4d4830);logger[_0x0e73('0xd')](_0x0e73('0x13'),_0x4d4830,JSON[_0x0e73('0xf')](_0x53ebaf));_0x8eb4fe(_0x53ebaf);})[_0x0e73('0x19')](function(_0x2dd237){logger[_0x0e73('0x10')](_0x0e73('0x13'),_0x2dd237[_0x0e73('0x12')],_0x4d4830);_0x2d4297(_0x1d6d34[_0x0e73('0x10')](0x1f4,_0x2dd237[_0x0e73('0x12')]));});});};exports[_0x0e73('0x1a')]=function(_0xfd2fc2){var _0x23edf0=this;return new Promise(function(_0x58cce4,_0x10d359){return db['SquareReport'][_0x0e73('0x1b')](_0xfd2fc2[_0x0e73('0x1c')],{'raw':_0xfd2fc2[_0x0e73('0x16')]?_0xfd2fc2[_0x0e73('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfd2fc2[_0x0e73('0x16')]?_0xfd2fc2[_0x0e73('0x16')][_0x0e73('0x1d')]||null:null,'attributes':_0xfd2fc2['options']?_0xfd2fc2[_0x0e73('0x16')]['attributes']||null:null,'limit':_0xfd2fc2['options']?_0xfd2fc2[_0x0e73('0x16')]['limit']||null:null})[_0x0e73('0xa')](function(_0x2575fd){logger[_0x0e73('0x18')]('UpdateSquareReport',_0xfd2fc2);logger[_0x0e73('0xd')](_0x0e73('0x1a'),_0xfd2fc2,JSON[_0x0e73('0xf')](_0x2575fd));_0x58cce4(_0x2575fd);})['catch'](function(_0x2e585b){logger[_0x0e73('0x10')](_0x0e73('0x1a'),_0x2e585b[_0x0e73('0x12')],_0xfd2fc2);_0x10d359(_0x23edf0[_0x0e73('0x10')](0x1f4,_0x2e585b[_0x0e73('0x12')]));});});}; \ No newline at end of file +var _0x970e=['http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','body','options','raw','UpdateSquareReport','SquareReport','update','where','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x970e,0x1ab));var _0xe970=function(_0x4d8986,_0x25e393){_0x4d8986=_0x4d8986-0x0;var _0x17726e=_0x970e[_0x4d8986];return _0x17726e;};'use strict';var _=require(_0xe970('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe970('0x1'));var fs=require('fs');var Redis=require(_0xe970('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe970('0x3'));var logger=require(_0xe970('0x4'))('rpc');var config=require(_0xe970('0x5'));var jayson=require(_0xe970('0x6'));var client=jayson[_0xe970('0x7')][_0xe970('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x110efc,_0x5271f3,_0x2f37eb){return new BPromise(function(_0x8e8a9f,_0xc38369){return client['request'](_0x110efc,_0x2f37eb)[_0xe970('0x9')](function(_0x53b708){logger[_0xe970('0xa')](_0xe970('0xb'),_0x5271f3,_0xe970('0xc'));logger[_0xe970('0xd')](_0xe970('0xe'),_0x5271f3,_0xe970('0xc'),JSON[_0xe970('0xf')](_0x53b708));if(_0x53b708['error']){if(_0x53b708[_0xe970('0x10')][_0xe970('0x11')]===0x1f4){logger[_0xe970('0x10')](_0xe970('0xb'),_0x5271f3,_0x53b708[_0xe970('0x10')]['message']);return _0xc38369(_0x53b708[_0xe970('0x10')][_0xe970('0x12')]);}logger[_0xe970('0x10')](_0xe970('0xb'),_0x5271f3,_0x53b708[_0xe970('0x10')][_0xe970('0x12')]);return _0x8e8a9f(_0x53b708[_0xe970('0x10')][_0xe970('0x12')]);}else{logger[_0xe970('0xa')](_0xe970('0xb'),_0x5271f3,_0xe970('0xc'));_0x8e8a9f(_0x53b708[_0xe970('0x13')]['message']);}})[_0xe970('0x14')](function(_0x3fe40f){logger[_0xe970('0x10')]('SquareReport,\x20%s,\x20%s',_0x5271f3,_0x3fe40f);_0xc38369(_0x3fe40f);});});}exports[_0xe970('0x15')]=function(_0x300c05){var _0x27671a=this;return new Promise(function(_0x13cd55,_0x4de76b){return db['SquareReport']['create'](_0x300c05[_0xe970('0x16')],{'raw':_0x300c05[_0xe970('0x17')]?_0x300c05['options'][_0xe970('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x556612){logger['info']('CreateSquareReport',_0x300c05);logger[_0xe970('0xd')](_0xe970('0x15'),_0x300c05,JSON[_0xe970('0xf')](_0x556612));_0x13cd55(_0x556612);})[_0xe970('0x14')](function(_0x3158bf){logger[_0xe970('0x10')](_0xe970('0x15'),_0x3158bf[_0xe970('0x12')],_0x300c05);_0x4de76b(_0x27671a['error'](0x1f4,_0x3158bf[_0xe970('0x12')]));});});};exports[_0xe970('0x19')]=function(_0x29a1bb){var _0x3afc73=this;return new Promise(function(_0x1f7ea4,_0x5a6c45){return db[_0xe970('0x1a')][_0xe970('0x1b')](_0x29a1bb[_0xe970('0x16')],{'raw':_0x29a1bb[_0xe970('0x17')]?_0x29a1bb[_0xe970('0x17')][_0xe970('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29a1bb['options']?_0x29a1bb['options'][_0xe970('0x1c')]||null:null,'attributes':_0x29a1bb[_0xe970('0x17')]?_0x29a1bb[_0xe970('0x17')]['attributes']||null:null,'limit':_0x29a1bb[_0xe970('0x17')]?_0x29a1bb[_0xe970('0x17')]['limit']||null:null})[_0xe970('0x9')](function(_0x3d93af){logger[_0xe970('0xa')](_0xe970('0x19'),_0x29a1bb);logger[_0xe970('0xd')]('UpdateSquareReport',_0x29a1bb,JSON['stringify'](_0x3d93af));_0x1f7ea4(_0x3d93af);})[_0xe970('0x14')](function(_0x34c451){logger['error'](_0xe970('0x19'),_0x34c451[_0xe970('0x12')],_0x29a1bb);_0x5a6c45(_0x3afc73[_0xe970('0x10')](0x1f4,_0x34c451['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c32e396..ef4a25e 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 _0x65a4=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x428464,_0x1893ea){var _0x2c46e3=function(_0x25614e){while(--_0x25614e){_0x428464['push'](_0x428464['shift']());}};_0x2c46e3(++_0x1893ea);}(_0x65a4,0x1a2));var _0x465a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x65a4[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x465a('0x0'));var util=require(_0x465a('0x1'));var path=require(_0x465a('0x2'));var timeout=require(_0x465a('0x3'));var express=require(_0x465a('0x4'));var router=express['Router']();var fs_extra=require(_0x465a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x465a('0x6'));var config=require(_0x465a('0x7'));var controller=require(_0x465a('0x8'));router[_0x465a('0x9')]('/',auth[_0x465a('0xa')](),controller['index']);router[_0x465a('0x9')]('/describe',auth[_0x465a('0xa')](),controller[_0x465a('0xb')]);router[_0x465a('0x9')](_0x465a('0xc'),auth[_0x465a('0xa')](),controller[_0x465a('0xd')]);router[_0x465a('0xe')]('/',auth[_0x465a('0xa')](),controller[_0x465a('0xf')]);router[_0x465a('0x10')]('/:id',auth[_0x465a('0xa')](),controller['update']);router[_0x465a('0x11')]('/:id',auth[_0x465a('0xa')](),controller[_0x465a('0x12')]);module[_0x465a('0x13')]=router; \ No newline at end of file +var _0xed16=['describe','/:id','create','put','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get'];(function(_0x42deb0,_0x485781){var _0x3d23c4=function(_0x314fdd){while(--_0x314fdd){_0x42deb0['push'](_0x42deb0['shift']());}};_0x3d23c4(++_0x485781);}(_0xed16,0x15d));var _0x6ed1=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xed16[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x6ed1('0x0'));var util=require(_0x6ed1('0x1'));var path=require(_0x6ed1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ed1('0x3')]();var fs_extra=require(_0x6ed1('0x4'));var auth=require(_0x6ed1('0x5'));var interaction=require(_0x6ed1('0x6'));var config=require(_0x6ed1('0x7'));var controller=require(_0x6ed1('0x8'));router['get']('/',auth[_0x6ed1('0x9')](),controller[_0x6ed1('0xa')]);router[_0x6ed1('0xb')]('/describe',auth[_0x6ed1('0x9')](),controller[_0x6ed1('0xc')]);router[_0x6ed1('0xb')](_0x6ed1('0xd'),auth[_0x6ed1('0x9')](),controller['show']);router['post']('/',auth[_0x6ed1('0x9')](),controller[_0x6ed1('0xe')]);router[_0x6ed1('0xf')](_0x6ed1('0xd'),auth[_0x6ed1('0x9')](),controller[_0x6ed1('0x10')]);router['delete'](_0x6ed1('0xd'),auth[_0x6ed1('0x9')](),controller[_0x6ed1('0x11')]);module[_0x6ed1('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 72bd9a6..599bf38 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 _0xef31=['STRING','TEXT','sequelize','exports'];(function(_0x1882e5,_0x1cae09){var _0xa94f2f=function(_0x51c452){while(--_0x51c452){_0x1882e5['push'](_0x1882e5['shift']());}};_0xa94f2f(++_0x1cae09);}(_0xef31,0x1e2));var _0x1ef3=function(_0x682bb,_0x2dafcc){_0x682bb=_0x682bb-0x0;var _0x3c8658=_0xef31[_0x682bb];return _0x3c8658;};'use strict';var Sequelize=require(_0x1ef3('0x0'));module[_0x1ef3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ef3('0x2')]},'node':{'type':Sequelize[_0x1ef3('0x2')]},'application':{'type':Sequelize[_0x1ef3('0x2')]},'data':{'type':Sequelize[_0x1ef3('0x3')]},'project_name':{'type':Sequelize[_0x1ef3('0x2')]},'callerid':{'type':Sequelize[_0x1ef3('0x2')]}}; \ No newline at end of file +var _0x2116=['TEXT','exports','STRING'];(function(_0x2f9f9c,_0x299aa8){var _0x2c3fb9=function(_0x17483d){while(--_0x17483d){_0x2f9f9c['push'](_0x2f9f9c['shift']());}};_0x2c3fb9(++_0x299aa8);}(_0x2116,0x67));var _0x6211=function(_0x4eb0b1,_0x1621ac){_0x4eb0b1=_0x4eb0b1-0x0;var _0x1b58bd=_0x2116[_0x4eb0b1];return _0x1b58bd;};'use strict';var Sequelize=require('sequelize');module[_0x6211('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x6211('0x1')]},'application':{'type':Sequelize[_0x6211('0x1')]},'data':{'type':Sequelize[_0x6211('0x2')]},'project_name':{'type':Sequelize[_0x6211('0x1')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a1ee928..ad5e032 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 _0x5dab=['filter','merge','options','SquareDetailsReport','includeAll','include','findAll','catch','show','length','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x164f74,_0x1fb40c){var _0x23ab88=function(_0x45912e){while(--_0x45912e){_0x164f74['push'](_0x164f74['shift']());}};_0x23ab88(++_0x1fb40c);}(_0x5dab,0x1a0));var _0xb5da=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x5dab[_0x1f9f37];return _0x21c080;};'use strict';var emlformat=require(_0xb5da('0x0'));var rimraf=require(_0xb5da('0x1'));var zipdir=require(_0xb5da('0x2'));var jsonpatch=require(_0xb5da('0x3'));var rp=require(_0xb5da('0x4'));var moment=require(_0xb5da('0x5'));var BPromise=require(_0xb5da('0x6'));var Mustache=require(_0xb5da('0x7'));var util=require(_0xb5da('0x8'));var path=require(_0xb5da('0x9'));var sox=require(_0xb5da('0xa'));var csv=require('to-csv');var ejs=require(_0xb5da('0xb'));var fs=require('fs');var fs_extra=require(_0xb5da('0xc'));var _=require(_0xb5da('0xd'));var squel=require(_0xb5da('0xe'));var crypto=require('crypto');var jsforce=require(_0xb5da('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb5da('0x10'));var querystring=require(_0xb5da('0x11'));var Papa=require('papaparse');var Redis=require(_0xb5da('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb5da('0x13'));var as=require(_0xb5da('0x14'));var hardwareService=require(_0xb5da('0x15'));var logger=require(_0xb5da('0x16'))(_0xb5da('0x17'));var utils=require(_0xb5da('0x18'));var config=require(_0xb5da('0x19'));var licenseUtil=require(_0xb5da('0x1a'));var db=require(_0xb5da('0x1b'))['db'];function respondWithStatusCode(_0x1d9284,_0x165ccb){_0x165ccb=_0x165ccb||0xcc;return function(_0x28ef54){if(_0x28ef54){return _0x1d9284[_0xb5da('0x1c')](_0x165ccb);}return _0x1d9284[_0xb5da('0x1d')](_0x165ccb)[_0xb5da('0x1e')]();};}function respondWithResult(_0x362239,_0x581c87){_0x581c87=_0x581c87||0xc8;return function(_0x5f59eb){if(_0x5f59eb){return _0x362239[_0xb5da('0x1d')](_0x581c87)[_0xb5da('0x1f')](_0x5f59eb);}};}function respondWithFilteredResult(_0x480dbd,_0x5328dd){return function(_0x3480b6){if(_0x3480b6){var _0x3cf129=typeof _0x5328dd[_0xb5da('0x20')]===_0xb5da('0x21')&&typeof _0x5328dd[_0xb5da('0x22')]===_0xb5da('0x21');var _0x1ce6ab=_0x3480b6['count'];var _0x5a6172=_0x3cf129?0x0:_0x5328dd[_0xb5da('0x20')];var _0xcbbf1b=_0x3cf129?_0x3480b6[_0xb5da('0x23')]:_0x5328dd['offset']+_0x5328dd[_0xb5da('0x22')];var _0x55d805;if(_0xcbbf1b>=_0x1ce6ab){_0xcbbf1b=_0x1ce6ab;_0x55d805=0xc8;}else{_0x55d805=0xce;}_0x480dbd[_0xb5da('0x1d')](_0x55d805);return _0x480dbd['set'](_0xb5da('0x24'),_0x5a6172+'-'+_0xcbbf1b+'/'+_0x1ce6ab)[_0xb5da('0x1f')](_0x3480b6);}return null;};}function patchUpdates(_0x343c06){return function(_0x557f30){try{jsonpatch[_0xb5da('0x25')](_0x557f30,_0x343c06,!![]);}catch(_0x4037db){return BPromise[_0xb5da('0x26')](_0x4037db);}return _0x557f30[_0xb5da('0x27')]();};}function saveUpdates(_0x5f4ed4,_0x4dced9){return function(_0x57a580){if(_0x57a580){return _0x57a580[_0xb5da('0x28')](_0x5f4ed4)['then'](function(_0x5f4a32){return _0x5f4a32;});}return null;};}function removeEntity(_0x3bcc5c,_0xa1a549){return function(_0x388dce){if(_0x388dce){return _0x388dce['destroy']()[_0xb5da('0x29')](function(){_0x3bcc5c[_0xb5da('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5913f4,_0xf3acc4){return function(_0x446d3a){if(!_0x446d3a){_0x5913f4['sendStatus'](0x194);}return _0x446d3a;};}function handleError(_0x2e6846,_0x15f413){_0x15f413=_0x15f413||0x1f4;return function(_0x104806){logger[_0xb5da('0x2a')](_0x104806[_0xb5da('0x2b')]);if(_0x104806[_0xb5da('0x2c')]){delete _0x104806[_0xb5da('0x2c')];}_0x2e6846['status'](_0x15f413)['send'](_0x104806);};}exports[_0xb5da('0x2d')]=function(_0x5ee722,_0x1239ba){var _0xdb8765={},_0x21a090={},_0x31ab1f={'count':0x0,'rows':[]};var _0x42db77=_['map'](db['SquareDetailsReport'][_0xb5da('0x2e')],function(_0x41d99f){return{'name':_0x41d99f[_0xb5da('0x2f')],'type':_0x41d99f[_0xb5da('0x30')][_0xb5da('0x31')]};});_0x21a090['model']=_[_0xb5da('0x32')](_0x42db77,_0xb5da('0x2c'));_0x21a090[_0xb5da('0x33')]=_[_0xb5da('0x34')](_0x5ee722[_0xb5da('0x33')]);_0x21a090[_0xb5da('0x35')]=_['intersection'](_0x21a090[_0xb5da('0x36')],_0x21a090[_0xb5da('0x33')]);_0xdb8765[_0xb5da('0x37')]=_[_0xb5da('0x38')](_0x21a090[_0xb5da('0x36')],qs[_0xb5da('0x39')](_0x5ee722['query'][_0xb5da('0x39')]));_0xdb8765[_0xb5da('0x37')]=_0xdb8765[_0xb5da('0x37')]['length']?_0xdb8765[_0xb5da('0x37')]:_0x21a090[_0xb5da('0x36')];if(!_0x5ee722[_0xb5da('0x33')][_0xb5da('0x3a')](_0xb5da('0x3b'))){_0xdb8765[_0xb5da('0x22')]=qs['limit'](_0x5ee722[_0xb5da('0x33')][_0xb5da('0x22')]);_0xdb8765[_0xb5da('0x20')]=qs[_0xb5da('0x20')](_0x5ee722[_0xb5da('0x33')][_0xb5da('0x20')]);}_0xdb8765[_0xb5da('0x3c')]=qs['sort'](_0x5ee722[_0xb5da('0x33')][_0xb5da('0x3d')]);_0xdb8765[_0xb5da('0x3e')]=qs[_0xb5da('0x35')](_[_0xb5da('0x3f')](_0x5ee722[_0xb5da('0x33')],_0x21a090[_0xb5da('0x35')]),_0x42db77);if(_0x5ee722['query'][_0xb5da('0x40')]){_0xdb8765[_0xb5da('0x3e')]=_[_0xb5da('0x41')](_0xdb8765['where'],{'$or':_['map'](_0x42db77,function(_0x20732c){if(_0x20732c['type']!=='VIRTUAL'){var _0x28dbfc={};_0x28dbfc[_0x20732c[_0xb5da('0x2c')]]={'$like':'%'+_0x5ee722[_0xb5da('0x33')][_0xb5da('0x40')]+'%'};return _0x28dbfc;}})});}_0xdb8765=_[_0xb5da('0x41')]({},_0xdb8765,_0x5ee722[_0xb5da('0x42')]);var _0x3d02d8={'where':_0xdb8765['where']};return db[_0xb5da('0x43')]['count'](_0x3d02d8)[_0xb5da('0x29')](function(_0xb5f58d){_0x31ab1f['count']=_0xb5f58d;if(_0x5ee722['query'][_0xb5da('0x44')]){_0xdb8765[_0xb5da('0x45')]=[{'all':!![]}];}return db[_0xb5da('0x43')][_0xb5da('0x46')](_0xdb8765);})['then'](function(_0x122ce6){_0x31ab1f['rows']=_0x122ce6;return _0x31ab1f;})['then'](respondWithFilteredResult(_0x1239ba,_0xdb8765))[_0xb5da('0x47')](handleError(_0x1239ba,null));};exports[_0xb5da('0x48')]=function(_0x1f2b43,_0x50684d){var _0x2aef5b={'raw':!![],'where':{'id':_0x1f2b43['params']['id']}},_0x1af895={};_0x1af895['model']=_[_0xb5da('0x34')](db[_0xb5da('0x43')][_0xb5da('0x2e')]);_0x1af895[_0xb5da('0x33')]=_[_0xb5da('0x34')](_0x1f2b43[_0xb5da('0x33')]);_0x1af895['filters']=_[_0xb5da('0x38')](_0x1af895[_0xb5da('0x36')],_0x1af895[_0xb5da('0x33')]);_0x2aef5b[_0xb5da('0x37')]=_[_0xb5da('0x38')](_0x1af895[_0xb5da('0x36')],qs[_0xb5da('0x39')](_0x1f2b43[_0xb5da('0x33')][_0xb5da('0x39')]));_0x2aef5b['attributes']=_0x2aef5b[_0xb5da('0x37')][_0xb5da('0x49')]?_0x2aef5b['attributes']:_0x1af895[_0xb5da('0x36')];if(_0x1f2b43[_0xb5da('0x33')][_0xb5da('0x44')]){_0x2aef5b[_0xb5da('0x45')]=[{'all':!![]}];}_0x2aef5b=_['merge']({},_0x2aef5b,_0x1f2b43[_0xb5da('0x42')]);return db[_0xb5da('0x43')][_0xb5da('0x4a')](_0x2aef5b)[_0xb5da('0x29')](handleEntityNotFound(_0x50684d,null))[_0xb5da('0x29')](respondWithResult(_0x50684d,null))[_0xb5da('0x47')](handleError(_0x50684d,null));};exports[_0xb5da('0x4b')]=function(_0x5b1fc6,_0x451246){return db[_0xb5da('0x43')][_0xb5da('0x4b')](_0x5b1fc6[_0xb5da('0x4c')],{})['then'](respondWithResult(_0x451246,0xc9))[_0xb5da('0x47')](handleError(_0x451246,null));};exports[_0xb5da('0x28')]=function(_0x3c2076,_0x475f54){if(_0x3c2076[_0xb5da('0x4c')]['id']){delete _0x3c2076['body']['id'];}return db[_0xb5da('0x43')][_0xb5da('0x4a')]({'where':{'id':_0x3c2076['params']['id']}})['then'](handleEntityNotFound(_0x475f54,null))['then'](saveUpdates(_0x3c2076[_0xb5da('0x4c')],null))[_0xb5da('0x29')](respondWithResult(_0x475f54,null))['catch'](handleError(_0x475f54,null));};exports[_0xb5da('0x4d')]=function(_0x174da1,_0x43bd5f){return db[_0xb5da('0x43')][_0xb5da('0x4a')]({'where':{'id':_0x174da1[_0xb5da('0x4e')]['id']}})[_0xb5da('0x29')](handleEntityNotFound(_0x43bd5f,null))[_0xb5da('0x29')](removeEntity(_0x43bd5f,null))['catch'](handleError(_0x43bd5f,null));};exports[_0xb5da('0x4f')]=function(_0x263ae3,_0x1c3269){return db[_0xb5da('0x43')][_0xb5da('0x4f')]()[_0xb5da('0x29')](respondWithResult(_0x1c3269,null))[_0xb5da('0x47')](handleError(_0x1c3269,null));}; \ No newline at end of file +var _0xb8d2=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','params','keys','rawAttributes','find','create','body','describe','rimraf','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','name','send','index','map','fieldName','type','key','model','query'];(function(_0x3204c3,_0x855c91){var _0x608b0f=function(_0x1bb7cc){while(--_0x1bb7cc){_0x3204c3['push'](_0x3204c3['shift']());}};_0x608b0f(++_0x855c91);}(_0xb8d2,0xa4));var _0x2b8d=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xb8d2[_0x413b4d];return _0x8b810a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b8d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b8d('0x1'));var BPromise=require(_0x2b8d('0x2'));var Mustache=require(_0x2b8d('0x3'));var util=require(_0x2b8d('0x4'));var path=require('path');var sox=require(_0x2b8d('0x5'));var csv=require(_0x2b8d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b8d('0x7'));var _=require(_0x2b8d('0x8'));var squel=require(_0x2b8d('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b8d('0xa'));var deskjs=require(_0x2b8d('0xb'));var toCsv=require(_0x2b8d('0x6'));var querystring=require('querystring');var Papa=require(_0x2b8d('0xc'));var Redis=require(_0x2b8d('0xd'));var authService=require(_0x2b8d('0xe'));var qs=require(_0x2b8d('0xf'));var as=require(_0x2b8d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b8d('0x11'));var utils=require('../../config/utils');var config=require(_0x2b8d('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425183,_0x5930cd){_0x5930cd=_0x5930cd||0xcc;return function(_0x5103f6){if(_0x5103f6){return _0x425183[_0x2b8d('0x13')](_0x5930cd);}return _0x425183[_0x2b8d('0x14')](_0x5930cd)['end']();};}function respondWithResult(_0x4f0e3f,_0x1fd509){_0x1fd509=_0x1fd509||0xc8;return function(_0x238969){if(_0x238969){return _0x4f0e3f[_0x2b8d('0x14')](_0x1fd509)[_0x2b8d('0x15')](_0x238969);}};}function respondWithFilteredResult(_0x29669b,_0xa20c9f){return function(_0x2b02f6){if(_0x2b02f6){var _0x411ba4=typeof _0xa20c9f[_0x2b8d('0x16')]===_0x2b8d('0x17')&&typeof _0xa20c9f[_0x2b8d('0x18')]==='undefined';var _0x4bbb29=_0x2b02f6[_0x2b8d('0x19')];var _0x4686ef=_0x411ba4?0x0:_0xa20c9f[_0x2b8d('0x16')];var _0x36853d=_0x411ba4?_0x2b02f6[_0x2b8d('0x19')]:_0xa20c9f[_0x2b8d('0x16')]+_0xa20c9f[_0x2b8d('0x18')];var _0x3b0300;if(_0x36853d>=_0x4bbb29){_0x36853d=_0x4bbb29;_0x3b0300=0xc8;}else{_0x3b0300=0xce;}_0x29669b[_0x2b8d('0x14')](_0x3b0300);return _0x29669b[_0x2b8d('0x1a')]('Content-Range',_0x4686ef+'-'+_0x36853d+'/'+_0x4bbb29)[_0x2b8d('0x15')](_0x2b02f6);}return null;};}function patchUpdates(_0x6ef4f4){return function(_0x12d54d){try{jsonpatch[_0x2b8d('0x1b')](_0x12d54d,_0x6ef4f4,!![]);}catch(_0x48d629){return BPromise[_0x2b8d('0x1c')](_0x48d629);}return _0x12d54d[_0x2b8d('0x1d')]();};}function saveUpdates(_0x5df080,_0x2a0138){return function(_0x3980f5){if(_0x3980f5){return _0x3980f5[_0x2b8d('0x1e')](_0x5df080)[_0x2b8d('0x1f')](function(_0x5c31ee){return _0x5c31ee;});}return null;};}function removeEntity(_0x18363c,_0x4a7751){return function(_0xa9991b){if(_0xa9991b){return _0xa9991b['destroy']()[_0x2b8d('0x1f')](function(){_0x18363c[_0x2b8d('0x14')](0xcc)[_0x2b8d('0x20')]();});}};}function handleEntityNotFound(_0x3545be,_0x3b2277){return function(_0x19df3e){if(!_0x19df3e){_0x3545be[_0x2b8d('0x13')](0x194);}return _0x19df3e;};}function handleError(_0x4daa22,_0xe6948){_0xe6948=_0xe6948||0x1f4;return function(_0x5e792){logger[_0x2b8d('0x21')](_0x5e792['stack']);if(_0x5e792[_0x2b8d('0x22')]){delete _0x5e792[_0x2b8d('0x22')];}_0x4daa22['status'](_0xe6948)[_0x2b8d('0x23')](_0x5e792);};}exports[_0x2b8d('0x24')]=function(_0x5e3bb9,_0x4d3c97){var _0x35d2a5={},_0x5d88b0={},_0x38e17d={'count':0x0,'rows':[]};var _0x3ea7ce=_[_0x2b8d('0x25')](db['SquareDetailsReport']['rawAttributes'],function(_0x1bef10){return{'name':_0x1bef10[_0x2b8d('0x26')],'type':_0x1bef10[_0x2b8d('0x27')][_0x2b8d('0x28')]};});_0x5d88b0[_0x2b8d('0x29')]=_[_0x2b8d('0x25')](_0x3ea7ce,_0x2b8d('0x22'));_0x5d88b0[_0x2b8d('0x2a')]=_['keys'](_0x5e3bb9[_0x2b8d('0x2a')]);_0x5d88b0[_0x2b8d('0x2b')]=_['intersection'](_0x5d88b0[_0x2b8d('0x29')],_0x5d88b0['query']);_0x35d2a5[_0x2b8d('0x2c')]=_[_0x2b8d('0x2d')](_0x5d88b0['model'],qs[_0x2b8d('0x2e')](_0x5e3bb9['query']['fields']));_0x35d2a5[_0x2b8d('0x2c')]=_0x35d2a5[_0x2b8d('0x2c')][_0x2b8d('0x2f')]?_0x35d2a5[_0x2b8d('0x2c')]:_0x5d88b0['model'];if(!_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x30')](_0x2b8d('0x31'))){_0x35d2a5['limit']=qs[_0x2b8d('0x18')](_0x5e3bb9['query'][_0x2b8d('0x18')]);_0x35d2a5[_0x2b8d('0x16')]=qs[_0x2b8d('0x16')](_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x16')]);}_0x35d2a5[_0x2b8d('0x32')]=qs['sort'](_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x33')]);_0x35d2a5['where']=qs['filters'](_['pick'](_0x5e3bb9['query'],_0x5d88b0[_0x2b8d('0x2b')]),_0x3ea7ce);if(_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x34')]){_0x35d2a5[_0x2b8d('0x35')]=_[_0x2b8d('0x36')](_0x35d2a5[_0x2b8d('0x35')],{'$or':_[_0x2b8d('0x25')](_0x3ea7ce,function(_0x4e774a){if(_0x4e774a['type']!=='VIRTUAL'){var _0x20c392={};_0x20c392[_0x4e774a['name']]={'$like':'%'+_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x34')]+'%'};return _0x20c392;}})});}_0x35d2a5=_[_0x2b8d('0x36')]({},_0x35d2a5,_0x5e3bb9[_0x2b8d('0x37')]);var _0x265052={'where':_0x35d2a5['where']};return db['SquareDetailsReport'][_0x2b8d('0x19')](_0x265052)[_0x2b8d('0x1f')](function(_0x246750){_0x38e17d[_0x2b8d('0x19')]=_0x246750;if(_0x5e3bb9[_0x2b8d('0x2a')][_0x2b8d('0x38')]){_0x35d2a5[_0x2b8d('0x39')]=[{'all':!![]}];}return db[_0x2b8d('0x3a')][_0x2b8d('0x3b')](_0x35d2a5);})[_0x2b8d('0x1f')](function(_0x33bf63){_0x38e17d[_0x2b8d('0x3c')]=_0x33bf63;return _0x38e17d;})[_0x2b8d('0x1f')](respondWithFilteredResult(_0x4d3c97,_0x35d2a5))[_0x2b8d('0x3d')](handleError(_0x4d3c97,null));};exports['show']=function(_0x5e12b1,_0x2f73b5){var _0xd1a204={'raw':!![],'where':{'id':_0x5e12b1[_0x2b8d('0x3e')]['id']}},_0x6b7b0f={};_0x6b7b0f[_0x2b8d('0x29')]=_[_0x2b8d('0x3f')](db[_0x2b8d('0x3a')][_0x2b8d('0x40')]);_0x6b7b0f['query']=_[_0x2b8d('0x3f')](_0x5e12b1['query']);_0x6b7b0f[_0x2b8d('0x2b')]=_[_0x2b8d('0x2d')](_0x6b7b0f[_0x2b8d('0x29')],_0x6b7b0f['query']);_0xd1a204[_0x2b8d('0x2c')]=_[_0x2b8d('0x2d')](_0x6b7b0f['model'],qs[_0x2b8d('0x2e')](_0x5e12b1[_0x2b8d('0x2a')][_0x2b8d('0x2e')]));_0xd1a204[_0x2b8d('0x2c')]=_0xd1a204[_0x2b8d('0x2c')][_0x2b8d('0x2f')]?_0xd1a204[_0x2b8d('0x2c')]:_0x6b7b0f['model'];if(_0x5e12b1[_0x2b8d('0x2a')]['includeAll']){_0xd1a204['include']=[{'all':!![]}];}_0xd1a204=_[_0x2b8d('0x36')]({},_0xd1a204,_0x5e12b1[_0x2b8d('0x37')]);return db[_0x2b8d('0x3a')][_0x2b8d('0x41')](_0xd1a204)[_0x2b8d('0x1f')](handleEntityNotFound(_0x2f73b5,null))[_0x2b8d('0x1f')](respondWithResult(_0x2f73b5,null))[_0x2b8d('0x3d')](handleError(_0x2f73b5,null));};exports[_0x2b8d('0x42')]=function(_0x366f9d,_0x5e9660){return db[_0x2b8d('0x3a')][_0x2b8d('0x42')](_0x366f9d[_0x2b8d('0x43')],{})[_0x2b8d('0x1f')](respondWithResult(_0x5e9660,0xc9))[_0x2b8d('0x3d')](handleError(_0x5e9660,null));};exports[_0x2b8d('0x1e')]=function(_0x836f09,_0x44b02f){if(_0x836f09['body']['id']){delete _0x836f09[_0x2b8d('0x43')]['id'];}return db[_0x2b8d('0x3a')][_0x2b8d('0x41')]({'where':{'id':_0x836f09[_0x2b8d('0x3e')]['id']}})[_0x2b8d('0x1f')](handleEntityNotFound(_0x44b02f,null))[_0x2b8d('0x1f')](saveUpdates(_0x836f09[_0x2b8d('0x43')],null))[_0x2b8d('0x1f')](respondWithResult(_0x44b02f,null))[_0x2b8d('0x3d')](handleError(_0x44b02f,null));};exports['destroy']=function(_0x5e0d62,_0x4ee856){return db[_0x2b8d('0x3a')]['find']({'where':{'id':_0x5e0d62[_0x2b8d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ee856,null))[_0x2b8d('0x1f')](removeEntity(_0x4ee856,null))[_0x2b8d('0x3d')](handleError(_0x4ee856,null));};exports[_0x2b8d('0x44')]=function(_0x101cff,_0x789661){return db[_0x2b8d('0x3a')]['describe']()[_0x2b8d('0x1f')](respondWithResult(_0x789661,null))['catch'](handleError(_0x789661,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index b41d835..350a791 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 _0x349f=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash'];(function(_0x588d6c,_0x7189cf){var _0x616ba7=function(_0x5abbfd){while(--_0x5abbfd){_0x588d6c['push'](_0x588d6c['shift']());}};_0x616ba7(++_0x7189cf);}(_0x349f,0xa8));var _0xf349=function(_0xca7d2c,_0x455a9d){_0xca7d2c=_0xca7d2c-0x0;var _0x260d95=_0x349f[_0xca7d2c];return _0x260d95;};'use strict';var _=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var logger=require(_0xf349('0x2'))('api');var moment=require(_0xf349('0x3'));var BPromise=require(_0xf349('0x4'));var rp=require(_0xf349('0x5'));var fs=require('fs');var path=require(_0xf349('0x6'));var rimraf=require(_0xf349('0x7'));var config=require(_0xf349('0x8'));var attributes=require(_0xf349('0x9'));module[_0xf349('0xa')]=function(_0x28b227,_0x1af89b){return _0x28b227['define'](_0xf349('0xb'),attributes,{'tableName':_0xf349('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cfe=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x4142af,_0x396358){var _0x4bd460=function(_0x2ca275){while(--_0x2ca275){_0x4142af['push'](_0x4142af['shift']());}};_0x4bd460(++_0x396358);}(_0x4cfe,0x16c));var _0xe4cf=function(_0x47bbd3,_0xb53049){_0x47bbd3=_0x47bbd3-0x0;var _0x393630=_0x4cfe[_0x47bbd3];return _0x393630;};'use strict';var _=require(_0xe4cf('0x0'));var util=require(_0xe4cf('0x1'));var logger=require(_0xe4cf('0x2'))(_0xe4cf('0x3'));var moment=require(_0xe4cf('0x4'));var BPromise=require(_0xe4cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4cf('0x6'));var rimraf=require(_0xe4cf('0x7'));var config=require('../../config/environment');var attributes=require(_0xe4cf('0x8'));module[_0xe4cf('0x9')]=function(_0x3c4f77,_0x53d9c8){return _0x3c4f77[_0xe4cf('0xa')](_0xe4cf('0xb'),attributes,{'tableName':_0xe4cf('0xc'),'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 fa701a2..cbbbbc8 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 _0xcecc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','raw','CreateSquareDetailsReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info'];(function(_0x29d49c,_0x393b69){var _0x286dbb=function(_0x40b704){while(--_0x40b704){_0x29d49c['push'](_0x29d49c['shift']());}};_0x286dbb(++_0x393b69);}(_0xcecc,0x186));var _0xccec=function(_0x2c315e,_0x582a8c){_0x2c315e=_0x2c315e-0x0;var _0x2c45b3=_0xcecc[_0x2c315e];return _0x2c45b3;};'use strict';var _=require(_0xccec('0x0'));var util=require('util');var moment=require(_0xccec('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccec('0x2'));var db=require(_0xccec('0x3'))['db'];var utils=require(_0xccec('0x4'));var logger=require(_0xccec('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xccec('0x6'));var client=jayson['client'][_0xccec('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44ed01,_0x2a66e5,_0x5788aa){return new BPromise(function(_0x372ea6,_0x3d7b1a){return client['request'](_0x44ed01,_0x5788aa)[_0xccec('0x8')](function(_0xbbf504){logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,'request\x20sent');logger[_0xccec('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2a66e5,_0xccec('0xc'),JSON[_0xccec('0xd')](_0xbbf504));if(_0xbbf504['error']){if(_0xbbf504[_0xccec('0xe')][_0xccec('0xf')]===0x1f4){logger[_0xccec('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);return _0x3d7b1a(_0xbbf504[_0xccec('0xe')][_0xccec('0x10')]);}logger[_0xccec('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x2a66e5,_0xbbf504[_0xccec('0xe')]['message']);return _0x372ea6(_0xbbf504['error']['message']);}else{logger[_0xccec('0x9')](_0xccec('0xa'),_0x2a66e5,_0xccec('0xc'));_0x372ea6(_0xbbf504[_0xccec('0x11')][_0xccec('0x10')]);}})[_0xccec('0x12')](function(_0x7abe38){logger[_0xccec('0xe')](_0xccec('0xa'),_0x2a66e5,_0x7abe38);_0x3d7b1a(_0x7abe38);});});}exports['CreateSquareDetailsReport']=function(_0x518016){var _0x56b926=this;return new Promise(function(_0x970c66,_0x551d33){return db[_0xccec('0x13')][_0xccec('0x14')](_0x518016[_0xccec('0x15')],{'raw':_0x518016['options']?_0x518016[_0xccec('0x16')][_0xccec('0x17')]===undefined?!![]:![]:!![]})[_0xccec('0x8')](function(_0x4a7f08){logger[_0xccec('0x9')](_0xccec('0x18'),_0x518016);logger[_0xccec('0xb')]('CreateSquareDetailsReport',_0x518016,JSON[_0xccec('0xd')](_0x4a7f08));_0x970c66(_0x4a7f08);})['catch'](function(_0x9065a3){logger['error'](_0xccec('0x18'),_0x9065a3[_0xccec('0x10')],_0x518016);_0x551d33(_0x56b926[_0xccec('0xe')](0x1f4,_0x9065a3[_0xccec('0x10')]));});});}; \ No newline at end of file +var _0x8e3f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','stringify','lodash','util','moment'];(function(_0x4d93db,_0xbf2b8f){var _0x217d02=function(_0x40c7d1){while(--_0x40c7d1){_0x4d93db['push'](_0x4d93db['shift']());}};_0x217d02(++_0xbf2b8f);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['create'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![]})[_0xf8e3('0xc')](function(_0x11c58e){logger[_0xf8e3('0xd')](_0xf8e3('0x16'),_0x11d4cc);logger['debug'](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1b')](_0x11c58e));_0x2e27e3(_0x11c58e);})[_0xf8e3('0x15')](function(_0xccbcc0){logger['error'](_0xf8e3('0x16'),_0xccbcc0['message'],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0xccbcc0[_0xf8e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 8944d97..ed33a2f 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 _0x6efe=['killProcess','exports','express','../../components/auth/service','./system.controller','isAuthenticated','index','get'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x6efe,0x192));var _0xe6ef=function(_0x1daffe,_0x49390f){_0x1daffe=_0x1daffe-0x0;var _0x5d3114=_0x6efe[_0x1daffe];return _0x5d3114;};'use strict';var express=require(_0xe6ef('0x0'));var router=express['Router']();var auth=require(_0xe6ef('0x1'));var controller=require(_0xe6ef('0x2'));router['get']('/',auth[_0xe6ef('0x3')](),controller[_0xe6ef('0x4')]);router[_0xe6ef('0x5')]('/process/:pid/kill',auth[_0xe6ef('0x3')](),controller[_0xe6ef('0x6')]);module[_0xe6ef('0x7')]=router; \ No newline at end of file +var _0x26ad=['Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','exports'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x26ad,0xf5));var _0xd26a=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x26ad[_0xfa634c];return _0x73e478;};'use strict';var express=require('express');var router=express[_0xd26a('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xd26a('0x1'));router[_0xd26a('0x2')]('/',auth[_0xd26a('0x3')](),controller[_0xd26a('0x4')]);router[_0xd26a('0x2')](_0xd26a('0x5'),auth[_0xd26a('0x3')](),controller['killProcess']);module[_0xd26a('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 c00347d..b64685f 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 _0xf230=['systeminformation','child_process','exec','../../config/logger','api','lodash','error','inspect','status','index','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xf230,0xea));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var info=require(_0x0f23('0x0'));var exec=require(_0x0f23('0x1'))[_0x0f23('0x2')];var logger=require(_0x0f23('0x3'))(_0x0f23('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x0f23('0x5'));function handleError(_0x303b10,_0x255aef,_0x59b753){_0x255aef=_0x255aef||0x1f4;return function(_0x3e657f){logger[_0x0f23('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x59b753,_0x255aef,util[_0x0f23('0x7')](_0x3e657f,{'showHidden':![],'depth':null}));delete _0x3e657f['name'];_0x303b10[_0x0f23('0x8')](_0x255aef)['send'](_0x3e657f);};}exports[_0x0f23('0x9')]=function(_0x357270,_0x14b6a7){return info[_0x0f23('0xa')]()['then'](function(_0x372040){return _0x14b6a7['status'](0xc8)[_0x0f23('0xb')](_0x372040);})[_0x0f23('0xc')](function(_0x488b1f){return _0x14b6a7['status'](0x1f4)[_0x0f23('0xb')](_0x488b1f);});};exports[_0x0f23('0xd')]=function(_0x3e80d8,_0x6d145e){var _0x47a65c=[_0x0f23('0xe')];return new BPromise(function(_0x12a1a8,_0x1172ee){return exec(util[_0x0f23('0xf')](_0x0f23('0x10'),_0x3e80d8[_0x0f23('0x11')][_0x0f23('0x12')]),function(_0x240639,_0x3f2d8c,_0x2d9da4){if(_0x240639){return _0x1172ee(_0x240639);}return _0x12a1a8(_0x3f2d8c);});})[_0x0f23('0x13')](function(_0x26c709){var _0x4ed26d=![];var _0x10f544=_0x26c709[_0x0f23('0x14')](/\n/);for(var _0x52e976=0x0,_0x186863=_0x47a65c[_0x0f23('0x15')];_0x52e976<_0x186863,_0x4ed26d===![];_0x52e976+=0x1){if(_0x26c709[_0x0f23('0x16')](_0x47a65c[_0x52e976])>=0x0){_0x4ed26d=!![];}}if(!_0x4ed26d){throw new Error(util[_0x0f23('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3e80d8[_0x0f23('0x11')][_0x0f23('0x12')]));}process[_0x0f23('0x17')](_0x3e80d8[_0x0f23('0x11')][_0x0f23('0x12')],_0x0f23('0x18'));return _0x6d145e['status'](0xc8)[_0x0f23('0xb')]({'message':util[_0x0f23('0xf')](_0x0f23('0x19'),_0x3e80d8[_0x0f23('0x11')]['pid'])});})[_0x0f23('0xc')](handleError(_0x6d145e,null,_0x0f23('0xd')));}; \ No newline at end of file +var _0x8701=['kill','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','params','killProcess','systeminformation','child_process','exec','../../config/logger','api','lodash','error','inspect','status','send','getAllData','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x8701,0x1b6));var _0x1870=function(_0x479f15,_0x544345){_0x479f15=_0x479f15-0x0;var _0x3455f1=_0x8701[_0x479f15];return _0x3455f1;};'use strict';var info=require(_0x1870('0x0'));var exec=require(_0x1870('0x1'))[_0x1870('0x2')];var logger=require(_0x1870('0x3'))(_0x1870('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x1870('0x5'));function handleError(_0x2c0c65,_0x1af826,_0x5fb8ca){_0x1af826=_0x1af826||0x1f4;return function(_0x45e20f){logger[_0x1870('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5fb8ca,_0x1af826,util[_0x1870('0x7')](_0x45e20f,{'showHidden':![],'depth':null}));delete _0x45e20f['name'];_0x2c0c65[_0x1870('0x8')](_0x1af826)[_0x1870('0x9')](_0x45e20f);};}exports['index']=function(_0xacb1d2,_0x22c665){return info[_0x1870('0xa')]()['then'](function(_0x5a7fa8){return _0x22c665[_0x1870('0x8')](0xc8)[_0x1870('0xb')](_0x5a7fa8);})[_0x1870('0xc')](function(_0x32483e){return _0x22c665[_0x1870('0x8')](0x1f4)[_0x1870('0xb')](_0x32483e);});};exports['killProcess']=function(_0x49df00,_0x56b475){var _0x37269b=[_0x1870('0xd')];return new BPromise(function(_0x5f594a,_0x5caecf){return exec(util[_0x1870('0xe')](_0x1870('0xf'),_0x49df00['params']['pid']),function(_0x2a0281,_0x5cf87e,_0x4b3f4f){if(_0x2a0281){return _0x5caecf(_0x2a0281);}return _0x5f594a(_0x5cf87e);});})[_0x1870('0x10')](function(_0x1662ce){var _0x2cb58d=![];var _0x3251f8=_0x1662ce[_0x1870('0x11')](/\n/);for(var _0x404308=0x0,_0x36dafd=_0x37269b[_0x1870('0x12')];_0x404308<_0x36dafd,_0x2cb58d===![];_0x404308+=0x1){if(_0x1662ce[_0x1870('0x13')](_0x37269b[_0x404308])>=0x0){_0x2cb58d=!![];}}if(!_0x2cb58d){throw new Error(util[_0x1870('0xe')](_0x1870('0x14'),_0x49df00['params']['pid']));}process[_0x1870('0x15')](_0x49df00['params'][_0x1870('0x16')],_0x1870('0x17'));return _0x56b475[_0x1870('0x8')](0xc8)[_0x1870('0xb')]({'message':util[_0x1870('0xe')](_0x1870('0x18'),_0x49df00[_0x1870('0x19')][_0x1870('0x16')])});})[_0x1870('0xc')](handleError(_0x56b475,null,_0x1870('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7f932e3..d346557 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 _0x62d1=['isAuthenticated','index','post','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x48b267,_0x5958e6){var _0x1f03e6=function(_0x5a951d){while(--_0x5a951d){_0x48b267['push'](_0x48b267['shift']());}};_0x1f03e6(++_0x5958e6);}(_0x62d1,0x75));var _0x162d=function(_0x49b9ef,_0x55547f){_0x49b9ef=_0x49b9ef-0x0;var _0x4de813=_0x62d1[_0x49b9ef];return _0x4de813;};'use strict';var multer=require('multer');var util=require(_0x162d('0x0'));var path=require(_0x162d('0x1'));var timeout=require('connect-timeout');var express=require(_0x162d('0x2'));var router=express[_0x162d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x162d('0x4'));var interaction=require(_0x162d('0x5'));var config=require(_0x162d('0x6'));var controller=require(_0x162d('0x7'));router[_0x162d('0x8')]('/',auth[_0x162d('0x9')](),controller[_0x162d('0xa')]);router[_0x162d('0x8')]('/:id',auth[_0x162d('0x9')](),controller['show']);router[_0x162d('0xb')]('/',auth[_0x162d('0x9')](),controller['create']);router[_0x162d('0xc')](_0x162d('0xd'),auth[_0x162d('0x9')](),controller[_0x162d('0xe')]);router[_0x162d('0xf')](_0x162d('0xd'),auth[_0x162d('0x9')](),controller[_0x162d('0x10')]);module[_0x162d('0x11')]=router; \ No newline at end of file +var _0x287f=['get','isAuthenticated','index','show','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x287f,0xc7));var _0xf287=function(_0xb40d80,_0x4c55dc){_0xb40d80=_0xb40d80-0x0;var _0x509e3a=_0x287f[_0xb40d80];return _0x509e3a;};'use strict';var multer=require(_0xf287('0x0'));var util=require(_0xf287('0x1'));var path=require(_0xf287('0x2'));var timeout=require(_0xf287('0x3'));var express=require(_0xf287('0x4'));var router=express[_0xf287('0x5')]();var fs_extra=require(_0xf287('0x6'));var auth=require(_0xf287('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf287('0x8'));var controller=require(_0xf287('0x9'));router[_0xf287('0xa')]('/',auth[_0xf287('0xb')](),controller[_0xf287('0xc')]);router['get']('/:id',auth[_0xf287('0xb')](),controller[_0xf287('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf287('0xe'),auth[_0xf287('0xb')](),controller[_0xf287('0xf')]);router[_0xf287('0x10')](_0xf287('0xe'),auth[_0xf287('0xb')](),controller[_0xf287('0x11')]);module[_0xf287('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index edeaa08..bf85589 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 _0x793b=['name','sequelize','exports','STRING'];(function(_0x27443f,_0x3bd110){var _0x9930c9=function(_0xf8a164){while(--_0xf8a164){_0x27443f['push'](_0x27443f['shift']());}};_0x9930c9(++_0x3bd110);}(_0x793b,0x189));var _0xb793=function(_0x4fe32b,_0x407baf){_0x4fe32b=_0x4fe32b-0x0;var _0x94fd81=_0x793b[_0x4fe32b];return _0x94fd81;};'use strict';var Sequelize=require(_0xb793('0x0'));module[_0xb793('0x1')]={'name':{'type':Sequelize[_0xb793('0x2')],'unique':_0xb793('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb793('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb793('0x2')]}}; \ No newline at end of file +var _0x8130=['#0091EA','sequelize','exports','name','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8130,0x146));var _0x0813=function(_0x6be05a,_0x48e084){_0x6be05a=_0x6be05a-0x0;var _0x8147d=_0x8130[_0x6be05a];return _0x8147d;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0813('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0813('0x3')],'defaultValue':_0x0813('0x4')},'description':{'type':Sequelize[_0x0813('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5cc1f3d..ba3ab8e 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 _0x32ef=['lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Tags','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x1b87fb,_0x3e6870){var _0xc7de31=function(_0x4eaded){while(--_0x4eaded){_0x1b87fb['push'](_0x1b87fb['shift']());}};_0xc7de31(++_0x3e6870);}(_0x32ef,0xf9));var _0xf32e=function(_0x2d26b4,_0x2e1628){_0x2d26b4=_0x2d26b4-0x0;var _0x114ac0=_0x32ef[_0x2d26b4];return _0x114ac0;};'use strict';var emlformat=require(_0xf32e('0x0'));var rimraf=require(_0xf32e('0x1'));var zipdir=require(_0xf32e('0x2'));var jsonpatch=require(_0xf32e('0x3'));var rp=require(_0xf32e('0x4'));var moment=require(_0xf32e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf32e('0x6'));var util=require(_0xf32e('0x7'));var path=require('path');var sox=require(_0xf32e('0x8'));var csv=require(_0xf32e('0x9'));var ejs=require(_0xf32e('0xa'));var fs=require('fs');var fs_extra=require(_0xf32e('0xb'));var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0x9'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=typeof _0x299efa[_0xf32e('0x1d')]===_0xf32e('0x1e')&&typeof _0x299efa[_0xf32e('0x1f')]===_0xf32e('0x1e');var _0x21aa73=_0x1dd008['count'];var _0x3510ec=_0x400d25?0x0:_0x299efa[_0xf32e('0x1d')];var _0xb828b8=_0x400d25?_0x1dd008[_0xf32e('0x20')]:_0x299efa[_0xf32e('0x1d')]+_0x299efa[_0xf32e('0x1f')];var _0x2f909b;if(_0xb828b8>=_0x21aa73){_0xb828b8=_0x21aa73;_0x2f909b=0xc8;}else{_0x2f909b=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x2f909b);return _0xe324ad[_0xf32e('0x21')](_0xf32e('0x22'),_0x3510ec+'-'+_0xb828b8+'/'+_0x21aa73)[_0xf32e('0x23')](_0x1dd008);}return null;};}function patchUpdates(_0x1b169e){return function(_0x3202e1){try{jsonpatch[_0xf32e('0x24')](_0x3202e1,_0x1b169e,!![]);}catch(_0x5f2e99){return BPromise['reject'](_0x5f2e99);}return _0x3202e1[_0xf32e('0x25')]();};}function saveUpdates(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x26')](_0x57a8cb)[_0xf32e('0x27')](function(_0x35e34c){return _0x35e34c;});}return null;};}function removeEntity(_0x5409b4,_0x227405){return function(_0x4407f8){if(_0x4407f8){return _0x4407f8[_0xf32e('0x28')]()[_0xf32e('0x27')](function(){var _0x5e62eb=_0x4407f8[_0xf32e('0x29')]({'plain':!![]});var _0x1eb413=_0xf32e('0x2a');return db[_0xf32e('0x2b')][_0xf32e('0x28')]({'where':{'type':_0x1eb413,'resourceId':_0x5e62eb['id']}})[_0xf32e('0x27')](function(){return _0x4407f8;});})[_0xf32e('0x27')](function(){_0x5409b4[_0xf32e('0x1b')](0xcc)[_0xf32e('0x1c')]();});}};}function handleEntityNotFound(_0x29be62,_0x488489){return function(_0x3e6e6f){if(!_0x3e6e6f){_0x29be62[_0xf32e('0x2c')](0x194);}return _0x3e6e6f;};}function handleError(_0x3b906c,_0x4a873c){_0x4a873c=_0x4a873c||0x1f4;return function(_0x419d13){logger['error'](_0x419d13[_0xf32e('0x2d')]);if(_0x419d13['name']){delete _0x419d13[_0xf32e('0x2e')];}_0x3b906c[_0xf32e('0x1b')](_0x4a873c)[_0xf32e('0x2f')](_0x419d13);};}exports[_0xf32e('0x30')]=function(_0x32a74b,_0x4e64d4){var _0x2e2ea4={},_0x1d3c7a={},_0x175096={'count':0x0,'rows':[]};var _0x498c9c=_[_0xf32e('0x31')](db[_0xf32e('0x32')][_0xf32e('0x33')],function(_0x3b87d3){return{'name':_0x3b87d3[_0xf32e('0x34')],'type':_0x3b87d3[_0xf32e('0x35')][_0xf32e('0x36')]};});_0x1d3c7a[_0xf32e('0x37')]=_[_0xf32e('0x31')](_0x498c9c,_0xf32e('0x2e'));_0x1d3c7a[_0xf32e('0x38')]=_[_0xf32e('0x39')](_0x32a74b[_0xf32e('0x38')]);_0x1d3c7a['filters']=_[_0xf32e('0x3a')](_0x1d3c7a['model'],_0x1d3c7a[_0xf32e('0x38')]);_0x2e2ea4['attributes']=_['intersection'](_0x1d3c7a[_0xf32e('0x37')],qs[_0xf32e('0x3b')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x3b')]));_0x2e2ea4[_0xf32e('0x3c')]=_0x2e2ea4['attributes'][_0xf32e('0x3d')]?_0x2e2ea4[_0xf32e('0x3c')]:_0x1d3c7a[_0xf32e('0x37')];if(!_0x32a74b[_0xf32e('0x38')]['hasOwnProperty'](_0xf32e('0x3e'))){_0x2e2ea4[_0xf32e('0x1f')]=qs[_0xf32e('0x1f')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x1f')]);_0x2e2ea4['offset']=qs[_0xf32e('0x1d')](_0x32a74b[_0xf32e('0x38')][_0xf32e('0x1d')]);}_0x2e2ea4['order']=qs[_0xf32e('0x3f')](_0x32a74b['query'][_0xf32e('0x3f')]);_0x2e2ea4[_0xf32e('0x40')]=qs[_0xf32e('0x41')](_['pick'](_0x32a74b[_0xf32e('0x38')],_0x1d3c7a[_0xf32e('0x41')]),_0x498c9c);if(_0x32a74b[_0xf32e('0x38')][_0xf32e('0x42')]){_0x2e2ea4[_0xf32e('0x40')]=_[_0xf32e('0x43')](_0x2e2ea4['where'],{'$or':_[_0xf32e('0x31')](_0x498c9c,function(_0x26ef18){if(_0x26ef18[_0xf32e('0x35')]!==_0xf32e('0x44')){var _0x28fb71={};_0x28fb71[_0x26ef18[_0xf32e('0x2e')]]={'$like':'%'+_0x32a74b[_0xf32e('0x38')]['filter']+'%'};return _0x28fb71;}})});}_0x2e2ea4=_[_0xf32e('0x43')]({},_0x2e2ea4,_0x32a74b[_0xf32e('0x45')]);var _0x41fbb1={'where':_0x2e2ea4[_0xf32e('0x40')]};return db[_0xf32e('0x32')][_0xf32e('0x20')](_0x41fbb1)[_0xf32e('0x27')](function(_0x546b80){_0x175096[_0xf32e('0x20')]=_0x546b80;if(_0x32a74b[_0xf32e('0x38')][_0xf32e('0x46')]){_0x2e2ea4[_0xf32e('0x47')]=[{'all':!![]}];}return db[_0xf32e('0x32')][_0xf32e('0x48')](_0x2e2ea4);})[_0xf32e('0x27')](function(_0x3ce422){_0x175096[_0xf32e('0x49')]=_0x3ce422;return _0x175096;})[_0xf32e('0x27')](respondWithFilteredResult(_0x4e64d4,_0x2e2ea4))['catch'](handleError(_0x4e64d4,null));};exports[_0xf32e('0x4a')]=function(_0x1f07a6,_0xbd0442){var _0x2146e8={'raw':!![],'where':{'id':_0x1f07a6[_0xf32e('0x4b')]['id']}},_0x159dfd={};_0x159dfd['model']=_[_0xf32e('0x39')](db[_0xf32e('0x32')][_0xf32e('0x33')]);_0x159dfd[_0xf32e('0x38')]=_[_0xf32e('0x39')](_0x1f07a6['query']);_0x159dfd[_0xf32e('0x41')]=_['intersection'](_0x159dfd[_0xf32e('0x37')],_0x159dfd[_0xf32e('0x38')]);_0x2146e8['attributes']=_[_0xf32e('0x3a')](_0x159dfd['model'],qs['fields'](_0x1f07a6['query'][_0xf32e('0x3b')]));_0x2146e8[_0xf32e('0x3c')]=_0x2146e8[_0xf32e('0x3c')][_0xf32e('0x3d')]?_0x2146e8[_0xf32e('0x3c')]:_0x159dfd[_0xf32e('0x37')];if(_0x1f07a6[_0xf32e('0x38')][_0xf32e('0x46')]){_0x2146e8[_0xf32e('0x47')]=[{'all':!![]}];}_0x2146e8=_[_0xf32e('0x43')]({},_0x2146e8,_0x1f07a6[_0xf32e('0x45')]);return db[_0xf32e('0x32')][_0xf32e('0x4c')](_0x2146e8)[_0xf32e('0x27')](handleEntityNotFound(_0xbd0442,null))['then'](respondWithResult(_0xbd0442,null))[_0xf32e('0x4d')](handleError(_0xbd0442,null));};exports[_0xf32e('0x4e')]=function(_0xc83c9f,_0x4b15be){return db['Tag']['create'](_0xc83c9f[_0xf32e('0x4f')],{})[_0xf32e('0x27')](function(_0x5194e8){var _0x436b8a=_0xc83c9f[_0xf32e('0x50')]['get']({'plain':!![]});if(!_0x436b8a)throw new Error(_0xf32e('0x51'));if(_0x436b8a[_0xf32e('0x52')]===_0xf32e('0x50')){var _0x36015b=_0x5194e8[_0xf32e('0x29')]({'plain':!![]});var _0x12f8e2='Tags';return db[_0xf32e('0x53')][_0xf32e('0x4c')]({'where':{'name':_0x12f8e2,'userProfileId':_0x436b8a[_0xf32e('0x54')]},'raw':!![]})['then'](function(_0x15017b){if(_0x15017b&&_0x15017b[_0xf32e('0x55')]===0x0){return db[_0xf32e('0x2b')]['create']({'name':_0x36015b['name'],'resourceId':_0x36015b['id'],'type':_0x15017b['name'],'sectionId':_0x15017b['id']},{})[_0xf32e('0x27')](function(){return _0x5194e8;});}else{return _0x5194e8;}})[_0xf32e('0x4d')](function(_0x36b32a){logger[_0xf32e('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36b32a);throw _0x36b32a;});}return _0x5194e8;})[_0xf32e('0x27')](respondWithResult(_0x4b15be,0xc9))[_0xf32e('0x4d')](handleError(_0x4b15be,null));};exports[_0xf32e('0x26')]=function(_0x787572,_0x10f4d3){if(_0x787572['body']['id']){delete _0x787572[_0xf32e('0x4f')]['id'];}return db[_0xf32e('0x32')][_0xf32e('0x4c')]({'where':{'id':_0x787572[_0xf32e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x10f4d3,null))[_0xf32e('0x27')](saveUpdates(_0x787572['body'],null))['then'](respondWithResult(_0x10f4d3,null))[_0xf32e('0x4d')](handleError(_0x10f4d3,null));};exports[_0xf32e('0x28')]=function(_0x1a485b,_0x391cbc){return db[_0xf32e('0x32')][_0xf32e('0x4c')]({'where':{'id':_0x1a485b[_0xf32e('0x4b')]['id']}})[_0xf32e('0x27')](handleEntityNotFound(_0x391cbc,null))[_0xf32e('0x27')](removeEntity(_0x391cbc,null))[_0xf32e('0x4d')](handleError(_0x391cbc,null));}; \ No newline at end of file +var _0x54f3=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','Tag','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','role','Tags','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x964cb2,_0x301c35){var _0x397e9c=function(_0x3ec17d){while(--_0x3ec17d){_0x964cb2['push'](_0x964cb2['shift']());}};_0x397e9c(++_0x301c35);}(_0x54f3,0x120));var _0x354f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x54f3[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x354f('0x0'));var zipdir=require(_0x354f('0x1'));var jsonpatch=require(_0x354f('0x2'));var rp=require(_0x354f('0x3'));var moment=require(_0x354f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x354f('0x5'));var path=require(_0x354f('0x6'));var sox=require(_0x354f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x354f('0x8'));var _=require('lodash');var squel=require(_0x354f('0x9'));var crypto=require(_0x354f('0xa'));var jsforce=require(_0x354f('0xb'));var deskjs=require(_0x354f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x354f('0xd'));var Papa=require('papaparse');var Redis=require(_0x354f('0xe'));var authService=require(_0x354f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x354f('0x10'));var logger=require(_0x354f('0x11'))('api');var utils=require(_0x354f('0x12'));var config=require(_0x354f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x354f('0x14'))['db'];function respondWithStatusCode(_0x824bf4,_0x13d871){_0x13d871=_0x13d871||0xcc;return function(_0x97c0da){if(_0x97c0da){return _0x824bf4[_0x354f('0x15')](_0x13d871);}return _0x824bf4[_0x354f('0x16')](_0x13d871)[_0x354f('0x17')]();};}function respondWithResult(_0x4ff8e7,_0xf2e013){_0xf2e013=_0xf2e013||0xc8;return function(_0x4b811d){if(_0x4b811d){return _0x4ff8e7[_0x354f('0x16')](_0xf2e013)['json'](_0x4b811d);}};}function respondWithFilteredResult(_0x103388,_0x234484){return function(_0x18cf66){if(_0x18cf66){var _0x4cc0e9=typeof _0x234484['offset']===_0x354f('0x18')&&typeof _0x234484[_0x354f('0x19')]===_0x354f('0x18');var _0x2ef866=_0x18cf66[_0x354f('0x1a')];var _0x36402d=_0x4cc0e9?0x0:_0x234484[_0x354f('0x1b')];var _0x598777=_0x4cc0e9?_0x18cf66[_0x354f('0x1a')]:_0x234484[_0x354f('0x1b')]+_0x234484[_0x354f('0x19')];var _0x4b87dd;if(_0x598777>=_0x2ef866){_0x598777=_0x2ef866;_0x4b87dd=0xc8;}else{_0x4b87dd=0xce;}_0x103388[_0x354f('0x16')](_0x4b87dd);return _0x103388['set'](_0x354f('0x1c'),_0x36402d+'-'+_0x598777+'/'+_0x2ef866)[_0x354f('0x1d')](_0x18cf66);}return null;};}function patchUpdates(_0x5e930c){return function(_0x14c4be){try{jsonpatch[_0x354f('0x1e')](_0x14c4be,_0x5e930c,!![]);}catch(_0x4ef4f1){return BPromise['reject'](_0x4ef4f1);}return _0x14c4be[_0x354f('0x1f')]();};}function saveUpdates(_0x574753,_0x52e7cb){return function(_0xa6050f){if(_0xa6050f){return _0xa6050f[_0x354f('0x20')](_0x574753)[_0x354f('0x21')](function(_0x2f4277){return _0x2f4277;});}return null;};}function removeEntity(_0xc0d4ca,_0x158117){return function(_0x273603){if(_0x273603){return _0x273603['destroy']()[_0x354f('0x21')](function(){var _0x519d66=_0x273603['get']({'plain':!![]});var _0x22594b='Tags';return db['UserProfileResource'][_0x354f('0x22')]({'where':{'type':_0x22594b,'resourceId':_0x519d66['id']}})['then'](function(){return _0x273603;});})[_0x354f('0x21')](function(){_0xc0d4ca[_0x354f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73c95e,_0x3c5c38){return function(_0x1467e7){if(!_0x1467e7){_0x73c95e['sendStatus'](0x194);}return _0x1467e7;};}function handleError(_0x1a968d,_0x503b2d){_0x503b2d=_0x503b2d||0x1f4;return function(_0x227d9b){logger[_0x354f('0x23')](_0x227d9b[_0x354f('0x24')]);if(_0x227d9b[_0x354f('0x25')]){delete _0x227d9b['name'];}_0x1a968d[_0x354f('0x16')](_0x503b2d)[_0x354f('0x26')](_0x227d9b);};}exports[_0x354f('0x27')]=function(_0x34a498,_0x223464){var _0x55afe1={},_0x5a8208={},_0x42caa2={'count':0x0,'rows':[]};var _0x156dba=_[_0x354f('0x28')](db[_0x354f('0x29')]['rawAttributes'],function(_0x576a95){return{'name':_0x576a95[_0x354f('0x2a')],'type':_0x576a95[_0x354f('0x2b')][_0x354f('0x2c')]};});_0x5a8208[_0x354f('0x2d')]=_['map'](_0x156dba,_0x354f('0x25'));_0x5a8208[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x34a498[_0x354f('0x2e')]);_0x5a8208['filters']=_['intersection'](_0x5a8208[_0x354f('0x2d')],_0x5a8208[_0x354f('0x2e')]);_0x55afe1[_0x354f('0x30')]=_[_0x354f('0x31')](_0x5a8208[_0x354f('0x2d')],qs[_0x354f('0x32')](_0x34a498[_0x354f('0x2e')][_0x354f('0x32')]));_0x55afe1[_0x354f('0x30')]=_0x55afe1[_0x354f('0x30')][_0x354f('0x33')]?_0x55afe1['attributes']:_0x5a8208[_0x354f('0x2d')];if(!_0x34a498['query'][_0x354f('0x34')](_0x354f('0x35'))){_0x55afe1[_0x354f('0x19')]=qs[_0x354f('0x19')](_0x34a498[_0x354f('0x2e')][_0x354f('0x19')]);_0x55afe1['offset']=qs[_0x354f('0x1b')](_0x34a498[_0x354f('0x2e')]['offset']);}_0x55afe1[_0x354f('0x36')]=qs[_0x354f('0x37')](_0x34a498[_0x354f('0x2e')]['sort']);_0x55afe1[_0x354f('0x38')]=qs[_0x354f('0x39')](_[_0x354f('0x3a')](_0x34a498[_0x354f('0x2e')],_0x5a8208['filters']),_0x156dba);if(_0x34a498[_0x354f('0x2e')]['filter']){_0x55afe1[_0x354f('0x38')]=_[_0x354f('0x3b')](_0x55afe1[_0x354f('0x38')],{'$or':_[_0x354f('0x28')](_0x156dba,function(_0x27c208){if(_0x27c208['type']!=='VIRTUAL'){var _0x162a10={};_0x162a10[_0x27c208[_0x354f('0x25')]]={'$like':'%'+_0x34a498[_0x354f('0x2e')][_0x354f('0x3c')]+'%'};return _0x162a10;}})});}_0x55afe1=_[_0x354f('0x3b')]({},_0x55afe1,_0x34a498[_0x354f('0x3d')]);var _0x58ae82={'where':_0x55afe1[_0x354f('0x38')]};return db[_0x354f('0x29')][_0x354f('0x1a')](_0x58ae82)[_0x354f('0x21')](function(_0x512592){_0x42caa2[_0x354f('0x1a')]=_0x512592;if(_0x34a498[_0x354f('0x2e')][_0x354f('0x3e')]){_0x55afe1[_0x354f('0x3f')]=[{'all':!![]}];}return db[_0x354f('0x29')][_0x354f('0x40')](_0x55afe1);})['then'](function(_0x66b4cc){_0x42caa2[_0x354f('0x41')]=_0x66b4cc;return _0x42caa2;})[_0x354f('0x21')](respondWithFilteredResult(_0x223464,_0x55afe1))['catch'](handleError(_0x223464,null));};exports['show']=function(_0x7835a0,_0x433ff0){var _0xff4402={'raw':!![],'where':{'id':_0x7835a0[_0x354f('0x42')]['id']}},_0x3b34ca={};_0x3b34ca[_0x354f('0x2d')]=_[_0x354f('0x2f')](db[_0x354f('0x29')]['rawAttributes']);_0x3b34ca[_0x354f('0x2e')]=_[_0x354f('0x2f')](_0x7835a0[_0x354f('0x2e')]);_0x3b34ca[_0x354f('0x39')]=_[_0x354f('0x31')](_0x3b34ca[_0x354f('0x2d')],_0x3b34ca[_0x354f('0x2e')]);_0xff4402[_0x354f('0x30')]=_[_0x354f('0x31')](_0x3b34ca['model'],qs[_0x354f('0x32')](_0x7835a0[_0x354f('0x2e')]['fields']));_0xff4402['attributes']=_0xff4402[_0x354f('0x30')][_0x354f('0x33')]?_0xff4402[_0x354f('0x30')]:_0x3b34ca[_0x354f('0x2d')];if(_0x7835a0[_0x354f('0x2e')][_0x354f('0x3e')]){_0xff4402['include']=[{'all':!![]}];}_0xff4402=_['merge']({},_0xff4402,_0x7835a0[_0x354f('0x3d')]);return db[_0x354f('0x29')][_0x354f('0x43')](_0xff4402)[_0x354f('0x21')](handleEntityNotFound(_0x433ff0,null))[_0x354f('0x21')](respondWithResult(_0x433ff0,null))[_0x354f('0x44')](handleError(_0x433ff0,null));};exports['create']=function(_0x55f2c9,_0x6b7a2c){return db['Tag'][_0x354f('0x45')](_0x55f2c9[_0x354f('0x46')],{})[_0x354f('0x21')](function(_0x4e270d){var _0x59963e=_0x55f2c9[_0x354f('0x47')][_0x354f('0x48')]({'plain':!![]});if(!_0x59963e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59963e[_0x354f('0x49')]===_0x354f('0x47')){var _0xf71a4f=_0x4e270d[_0x354f('0x48')]({'plain':!![]});var _0xf46a61=_0x354f('0x4a');return db[_0x354f('0x4b')]['find']({'where':{'name':_0xf46a61,'userProfileId':_0x59963e[_0x354f('0x4c')]},'raw':!![]})[_0x354f('0x21')](function(_0x9ccdaa){if(_0x9ccdaa&&_0x9ccdaa[_0x354f('0x4d')]===0x0){return db[_0x354f('0x4e')]['create']({'name':_0xf71a4f[_0x354f('0x25')],'resourceId':_0xf71a4f['id'],'type':_0x9ccdaa[_0x354f('0x25')],'sectionId':_0x9ccdaa['id']},{})['then'](function(){return _0x4e270d;});}else{return _0x4e270d;}})['catch'](function(_0x44495b){logger[_0x354f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44495b);throw _0x44495b;});}return _0x4e270d;})['then'](respondWithResult(_0x6b7a2c,0xc9))[_0x354f('0x44')](handleError(_0x6b7a2c,null));};exports[_0x354f('0x20')]=function(_0x4df08f,_0x43a0b1){if(_0x4df08f[_0x354f('0x46')]['id']){delete _0x4df08f[_0x354f('0x46')]['id'];}return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x4df08f[_0x354f('0x42')]['id']}})[_0x354f('0x21')](handleEntityNotFound(_0x43a0b1,null))['then'](saveUpdates(_0x4df08f[_0x354f('0x46')],null))[_0x354f('0x21')](respondWithResult(_0x43a0b1,null))[_0x354f('0x44')](handleError(_0x43a0b1,null));};exports[_0x354f('0x22')]=function(_0x5a6baf,_0x2edb7c){return db[_0x354f('0x29')][_0x354f('0x43')]({'where':{'id':_0x5a6baf[_0x354f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2edb7c,null))[_0x354f('0x21')](removeEntity(_0x2edb7c,null))[_0x354f('0x44')](handleError(_0x2edb7c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index fe0eaac..4306c9a 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 _0xd943=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./tag.attributes','define','Tag','tools_tags'];(function(_0x15a073,_0x41994c){var _0x40ca1e=function(_0x5b8367){while(--_0x5b8367){_0x15a073['push'](_0x15a073['shift']());}};_0x40ca1e(++_0x41994c);}(_0xd943,0x114));var _0x3d94=function(_0x18e112,_0x1fa337){_0x18e112=_0x18e112-0x0;var _0x5f2e53=_0xd943[_0x18e112];return _0x5f2e53;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require(_0x3d94('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require('rimraf');var config=require(_0x3d94('0x7'));var attributes=require(_0x3d94('0x8'));module['exports']=function(_0x43a878,_0x2d2c02){return _0x43a878[_0x3d94('0x9')](_0x3d94('0xa'),attributes,{'tableName':_0x3d94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x787f=['moment','bluebird','request-promise','path','../../config/environment','exports','define','tools_tags','util','api'];(function(_0x255ec7,_0x5b751d){var _0x1d5260=function(_0x2eecd2){while(--_0x2eecd2){_0x255ec7['push'](_0x255ec7['shift']());}};_0x1d5260(++_0x5b751d);}(_0x787f,0xc6));var _0xf787=function(_0x2eaa6b,_0x5f3658){_0x2eaa6b=_0x2eaa6b-0x0;var _0x4770c9=_0x787f[_0x2eaa6b];return _0x4770c9;};'use strict';var _=require('lodash');var util=require(_0xf787('0x0'));var logger=require('../../config/logger')(_0xf787('0x1'));var moment=require(_0xf787('0x2'));var BPromise=require(_0xf787('0x3'));var rp=require(_0xf787('0x4'));var fs=require('fs');var path=require(_0xf787('0x5'));var rimraf=require('rimraf');var config=require(_0xf787('0x6'));var attributes=require('./tag.attributes');module[_0xf787('0x7')]=function(_0x3c1d33,_0x2d9af4){return _0x3c1d33[_0xf787('0x8')]('Tag',attributes,{'tableName':_0xf787('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index b8a0556..e13182b 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 _0xb903=['http','request','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','Tag,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14fdc2,_0x48c2b4){var _0x3901d6=function(_0x1a1926){while(--_0x1a1926){_0x14fdc2['push'](_0x14fdc2['shift']());}};_0x3901d6(++_0x48c2b4);}(_0xb903,0x185));var _0x3b90=function(_0x4e3a27,_0x538e2e){_0x4e3a27=_0x4e3a27-0x0;var _0x242b22=_0xb903[_0x4e3a27];return _0x242b22;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('Tag,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('Tag,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0x826a=['debug','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x826a,0x1aa));var _0xa826=function(_0x25dbc8,_0xffdcbe){_0x25dbc8=_0x25dbc8-0x0;var _0x702ef=_0x826a[_0x25dbc8];return _0x702ef;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var moment=require('moment');var BPromise=require(_0xa826('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa826('0x2'));var db=require(_0xa826('0x3'))['db'];var utils=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('rpc');var config=require(_0xa826('0x6'));var jayson=require(_0xa826('0x7'));var client=jayson[_0xa826('0x8')][_0xa826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45154f,_0x4124f5,_0x4339f9){return new BPromise(function(_0x14c2ba,_0xc348d2){return client[_0xa826('0xa')](_0x45154f,_0x4339f9)[_0xa826('0xb')](function(_0x1005e6){logger[_0xa826('0xc')](_0xa826('0xd'),_0x4124f5,_0xa826('0xe'));logger[_0xa826('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4124f5,_0xa826('0xe'),JSON['stringify'](_0x1005e6));if(_0x1005e6[_0xa826('0x10')]){if(_0x1005e6[_0xa826('0x10')][_0xa826('0x11')]===0x1f4){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')][_0xa826('0x12')]);return _0xc348d2(_0x1005e6['error'][_0xa826('0x12')]);}logger['error'](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')]['message']);return _0x14c2ba(_0x1005e6['error']['message']);}else{logger[_0xa826('0xc')]('Tag,\x20%s,\x20%s',_0x4124f5,'request\x20sent');_0x14c2ba(_0x1005e6[_0xa826('0x13')][_0xa826('0x12')]);}})[_0xa826('0x14')](function(_0x5832b9){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x5832b9);_0xc348d2(_0x5832b9);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 3424c3a..99b6d4f 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 484d47e..64955f9 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x39f3a2,_0x59a442){var _0x1da8c9=function(_0x1e905a){while(--_0x1e905a){_0x39f3a2['push'](_0x39f3a2['shift']());}};_0x1da8c9(++_0x59a442);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b0a6c6b..fdc3d52 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 _0xb9b5=['SIP/%s','all','upsert','VoicePrefixId','spread','Openchannel','removeAgents','emit','user','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','index','map','Team','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','includeAll','include','rows','catch','params','model','options','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','find','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','QueryTypes','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','Teams','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','pick','removeQueues','Queues','ids','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','findAll','online','voicePause','interface','isNil','format'];(function(_0x48891b,_0x47a650){var _0x49b81f=function(_0x4b9620){while(--_0x4b9620){_0x48891b['push'](_0x48891b['shift']());}};_0x49b81f(++_0x47a650);}(_0xb9b5,0x12e));var _0x5b9b=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xb9b5[_0x96f74c];return _0x379222;};'use strict';var emlformat=require(_0x5b9b('0x0'));var rimraf=require(_0x5b9b('0x1'));var zipdir=require(_0x5b9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b9b('0x3'));var BPromise=require(_0x5b9b('0x4'));var Mustache=require(_0x5b9b('0x5'));var util=require(_0x5b9b('0x6'));var path=require(_0x5b9b('0x7'));var sox=require(_0x5b9b('0x8'));var csv=require(_0x5b9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b9b('0xa'));var _=require('lodash');var squel=require(_0x5b9b('0xb'));var crypto=require(_0x5b9b('0xc'));var jsforce=require(_0x5b9b('0xd'));var deskjs=require(_0x5b9b('0xe'));var toCsv=require(_0x5b9b('0x9'));var querystring=require(_0x5b9b('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b9b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b9b('0x11'));var as=require(_0x5b9b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b9b('0x13'))(_0x5b9b('0x14'));var utils=require('../../config/utils');var config=require(_0x5b9b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5b9b('0x16'))['db'];config[_0x5b9b('0x17')]=_['defaults'](config[_0x5b9b('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b9b('0x17')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x519f98,_0x79170a){_0x79170a=_0x79170a||0xcc;return function(_0x414321){if(_0x414321){return _0x519f98[_0x5b9b('0x18')](_0x79170a);}return _0x519f98[_0x5b9b('0x19')](_0x79170a)['end']();};}function respondWithResult(_0x313310,_0x177581){_0x177581=_0x177581||0xc8;return function(_0x14bffa){if(_0x14bffa){return _0x313310[_0x5b9b('0x19')](_0x177581)[_0x5b9b('0x1a')](_0x14bffa);}};}function respondWithFilteredResult(_0x1ffd83,_0x4bbade){return function(_0x55eaab){if(_0x55eaab){var _0x702798=typeof _0x4bbade[_0x5b9b('0x1b')]===_0x5b9b('0x1c')&&typeof _0x4bbade[_0x5b9b('0x1d')]===_0x5b9b('0x1c');var _0x57ccd9=_0x55eaab[_0x5b9b('0x1e')];var _0x5751fe=_0x702798?0x0:_0x4bbade[_0x5b9b('0x1b')];var _0x1c2a08=_0x702798?_0x55eaab[_0x5b9b('0x1e')]:_0x4bbade[_0x5b9b('0x1b')]+_0x4bbade[_0x5b9b('0x1d')];var _0x3d76c7;if(_0x1c2a08>=_0x57ccd9){_0x1c2a08=_0x57ccd9;_0x3d76c7=0xc8;}else{_0x3d76c7=0xce;}_0x1ffd83[_0x5b9b('0x19')](_0x3d76c7);return _0x1ffd83[_0x5b9b('0x1f')](_0x5b9b('0x20'),_0x5751fe+'-'+_0x1c2a08+'/'+_0x57ccd9)[_0x5b9b('0x1a')](_0x55eaab);}return null;};}function patchUpdates(_0x7590d6){return function(_0x5a9ba1){try{jsonpatch[_0x5b9b('0x21')](_0x5a9ba1,_0x7590d6,!![]);}catch(_0x1e3e58){return BPromise[_0x5b9b('0x22')](_0x1e3e58);}return _0x5a9ba1['save']();};}function saveUpdates(_0x4970fa,_0x7370d){return function(_0x4e9031){if(_0x4e9031){return _0x4e9031['update'](_0x4970fa)[_0x5b9b('0x23')](function(_0x4e3691){return _0x4e3691;});}return null;};}function handleEntityNotFound(_0x24168f,_0x58d299){return function(_0x28397e){if(!_0x28397e){_0x24168f[_0x5b9b('0x18')](0x194);}return _0x28397e;};}function handleError(_0x43c60b,_0x27650a){_0x27650a=_0x27650a||0x1f4;return function(_0x374c24){logger[_0x5b9b('0x24')](_0x374c24[_0x5b9b('0x25')]);if(_0x374c24[_0x5b9b('0x26')]){delete _0x374c24[_0x5b9b('0x26')];}_0x43c60b[_0x5b9b('0x19')](_0x27650a)['send'](_0x374c24);};}exports[_0x5b9b('0x27')]=function(_0x25f1fa,_0x5367ee){var _0x34f519={},_0x540938={},_0x3e7df5={'count':0x0,'rows':[]};var _0x354212=_[_0x5b9b('0x28')](db[_0x5b9b('0x29')][_0x5b9b('0x2a')],function(_0x3d5d95){return{'name':_0x3d5d95['fieldName'],'type':_0x3d5d95[_0x5b9b('0x2b')][_0x5b9b('0x2c')]};});_0x540938['model']=_[_0x5b9b('0x28')](_0x354212,'name');_0x540938[_0x5b9b('0x2d')]=_[_0x5b9b('0x2e')](_0x25f1fa['query']);_0x540938[_0x5b9b('0x2f')]=_[_0x5b9b('0x30')](_0x540938['model'],_0x540938['query']);_0x34f519[_0x5b9b('0x31')]=_['intersection'](_0x540938['model'],qs[_0x5b9b('0x32')](_0x25f1fa[_0x5b9b('0x2d')][_0x5b9b('0x32')]));_0x34f519[_0x5b9b('0x31')]=_0x34f519[_0x5b9b('0x31')][_0x5b9b('0x33')]?_0x34f519[_0x5b9b('0x31')]:_0x540938['model'];if(!_0x25f1fa['query'][_0x5b9b('0x34')](_0x5b9b('0x35'))){_0x34f519[_0x5b9b('0x1d')]=qs[_0x5b9b('0x1d')](_0x25f1fa[_0x5b9b('0x2d')][_0x5b9b('0x1d')]);_0x34f519[_0x5b9b('0x1b')]=qs[_0x5b9b('0x1b')](_0x25f1fa['query'][_0x5b9b('0x1b')]);}_0x34f519[_0x5b9b('0x36')]=qs['sort'](_0x25f1fa[_0x5b9b('0x2d')]['sort']);_0x34f519[_0x5b9b('0x37')]=qs[_0x5b9b('0x2f')](_['pick'](_0x25f1fa[_0x5b9b('0x2d')],_0x540938[_0x5b9b('0x2f')]),_0x354212);if(_0x25f1fa[_0x5b9b('0x2d')][_0x5b9b('0x38')]){_0x34f519[_0x5b9b('0x37')]=_[_0x5b9b('0x39')](_0x34f519['where'],{'$or':_['map'](_0x354212,function(_0x3876eb){if(_0x3876eb[_0x5b9b('0x2b')]!=='VIRTUAL'){var _0x5324a7={};_0x5324a7[_0x3876eb['name']]={'$like':'%'+_0x25f1fa['query'][_0x5b9b('0x38')]+'%'};return _0x5324a7;}})});}_0x34f519=_[_0x5b9b('0x39')]({},_0x34f519,_0x25f1fa['options']);var _0x4941a3={'where':_0x34f519['where']};return db[_0x5b9b('0x29')][_0x5b9b('0x1e')](_0x4941a3)[_0x5b9b('0x23')](function(_0x21e204){_0x3e7df5[_0x5b9b('0x1e')]=_0x21e204;if(_0x25f1fa[_0x5b9b('0x2d')][_0x5b9b('0x3a')]){_0x34f519[_0x5b9b('0x3b')]=[{'all':!![]}];}return db[_0x5b9b('0x29')]['findAll'](_0x34f519);})[_0x5b9b('0x23')](function(_0x1cfe55){_0x3e7df5[_0x5b9b('0x3c')]=_0x1cfe55;return _0x3e7df5;})[_0x5b9b('0x23')](respondWithFilteredResult(_0x5367ee,_0x34f519))[_0x5b9b('0x3d')](handleError(_0x5367ee,null));};exports['show']=function(_0x4e6223,_0x59fc3b){var _0x59aed8={'raw':![],'where':{'id':_0x4e6223[_0x5b9b('0x3e')]['id']}},_0x388607={};_0x388607['model']=_['keys'](db[_0x5b9b('0x29')][_0x5b9b('0x2a')]);_0x388607[_0x5b9b('0x2d')]=_[_0x5b9b('0x2e')](_0x4e6223[_0x5b9b('0x2d')]);_0x388607['filters']=_[_0x5b9b('0x30')](_0x388607['model'],_0x388607[_0x5b9b('0x2d')]);_0x59aed8['attributes']=_[_0x5b9b('0x30')](_0x388607[_0x5b9b('0x3f')],qs[_0x5b9b('0x32')](_0x4e6223[_0x5b9b('0x2d')][_0x5b9b('0x32')]));_0x59aed8[_0x5b9b('0x31')]=_0x59aed8['attributes'][_0x5b9b('0x33')]?_0x59aed8[_0x5b9b('0x31')]:_0x388607['model'];if(_0x4e6223[_0x5b9b('0x2d')]['includeAll']){_0x59aed8[_0x5b9b('0x3b')]=[{'all':!![]}];}_0x59aed8=_[_0x5b9b('0x39')]({},_0x59aed8,_0x4e6223[_0x5b9b('0x40')]);return db[_0x5b9b('0x29')]['find'](_0x59aed8)[_0x5b9b('0x23')](handleEntityNotFound(_0x59fc3b,null))[_0x5b9b('0x23')](respondWithResult(_0x59fc3b,null))[_0x5b9b('0x3d')](handleError(_0x59fc3b,null));};exports[_0x5b9b('0x41')]=function(_0x55be43,_0x1f6223){return db[_0x5b9b('0x29')][_0x5b9b('0x41')](_0x55be43[_0x5b9b('0x42')],{})[_0x5b9b('0x23')](function(_0x186f1e){var _0x17514c=_0x55be43['user'][_0x5b9b('0x43')]({'plain':!![]});if(!_0x17514c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17514c[_0x5b9b('0x44')]==='user'){var _0x21fa1e=_0x186f1e[_0x5b9b('0x43')]({'plain':!![]});var _0x560a8f='Teams';return db[_0x5b9b('0x45')]['find']({'where':{'name':_0x560a8f,'userProfileId':_0x17514c[_0x5b9b('0x46')]},'raw':!![]})['then'](function(_0x3219b9){if(_0x3219b9&&_0x3219b9[_0x5b9b('0x47')]===0x0){return db[_0x5b9b('0x48')][_0x5b9b('0x41')]({'name':_0x21fa1e[_0x5b9b('0x26')],'resourceId':_0x21fa1e['id'],'type':_0x3219b9[_0x5b9b('0x26')],'sectionId':_0x3219b9['id']},{})[_0x5b9b('0x23')](function(){return _0x186f1e;});}else{return _0x186f1e;}})[_0x5b9b('0x3d')](function(_0x5aa1ae){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5aa1ae);throw _0x5aa1ae;});}return _0x186f1e;})[_0x5b9b('0x23')](respondWithResult(_0x1f6223,0xc9))[_0x5b9b('0x3d')](handleError(_0x1f6223,null));};exports[_0x5b9b('0x49')]=function(_0x359375,_0x497c5f){if(_0x359375[_0x5b9b('0x42')]['id']){delete _0x359375[_0x5b9b('0x42')]['id'];}return db[_0x5b9b('0x29')][_0x5b9b('0x4a')]({'where':{'id':_0x359375['params']['id']}})[_0x5b9b('0x23')](handleEntityNotFound(_0x497c5f,null))[_0x5b9b('0x23')](saveUpdates(_0x359375['body'],null))['then'](respondWithResult(_0x497c5f,null))[_0x5b9b('0x3d')](handleError(_0x497c5f,null));};exports[_0x5b9b('0x4b')]=function(_0x5e07d8,_0xb18228){var _0x1b9623=_0x5e07d8[_0x5b9b('0x3e')]['id'];var _0x7a7766=[];return db[_0x5b9b('0x4c')][_0x5b9b('0x4d')](function(_0x1c5dfd){var _0x4bbc77=_0x5b9b('0x4e')+_0x1b9623;return db[_0x5b9b('0x4c')][_0x5b9b('0x2d')](_0x4bbc77,{'type':db[_0x5b9b('0x4f')]['QueryTypes'][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd})[_0x5b9b('0x23')](function(_0x122b6b){_0x7a7766=_[_0x5b9b('0x28')](_0x122b6b,function(_0x4fc101){return Number(_0x4fc101['UserId']);});})['then'](function(){var _0x31e1ad='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b9623;return db['sequelize'][_0x5b9b('0x2d')](_0x31e1ad,{'type':db['Sequelize'][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})['then'](function(_0x423b4a){var _0x2c58ba=_[_0x5b9b('0x28')](_0x423b4a,function(_0x5b2f97){return Number(_0x5b2f97['VoiceQueueId']);});return db['UserVoiceQueue'][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'VoiceQueueId':{'$in':_0x2c58ba}},'transaction':_0x1c5dfd});})['then'](function(){var _0x48b0e8=_0x5b9b('0x52')+_0x1b9623;return db['sequelize']['query'](_0x48b0e8,{'type':db[_0x5b9b('0x4f')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x411aee){var _0x37915e=_[_0x5b9b('0x28')](_0x411aee,function(_0x2173fd){return Number(_0x2173fd[_0x5b9b('0x53')]);});return db[_0x5b9b('0x54')][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'MailQueueId':{'$in':_0x37915e}},'transaction':_0x1c5dfd});})['then'](function(){var _0x394e06='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b9623;return db[_0x5b9b('0x4c')][_0x5b9b('0x2d')](_0x394e06,{'type':db[_0x5b9b('0x4f')][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x3ddf77){var _0x13b8d0=_['map'](_0x3ddf77,function(_0x247683){return Number(_0x247683[_0x5b9b('0x55')]);});return db[_0x5b9b('0x56')]['destroy']({'where':{'UserId':{'$in':_0x7a7766},'SmsQueueId':{'$in':_0x13b8d0}},'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(){var _0x434cd1=_0x5b9b('0x57')+_0x1b9623;return db[_0x5b9b('0x4c')][_0x5b9b('0x2d')](_0x434cd1,{'type':db['Sequelize'][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x4a0d65){var _0x5031ec=_[_0x5b9b('0x28')](_0x4a0d65,function(_0x209a3b){return Number(_0x209a3b['ChatQueueId']);});return db[_0x5b9b('0x58')][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'ChatQueueId':{'$in':_0x5031ec}},'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(){var _0x35af57=_0x5b9b('0x59')+_0x1b9623;return db[_0x5b9b('0x4c')][_0x5b9b('0x2d')](_0x35af57,{'type':db['Sequelize'][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x35ece1){var _0x144989=_[_0x5b9b('0x28')](_0x35ece1,function(_0x5e2117){return Number(_0x5e2117['FaxQueueId']);});return db[_0x5b9b('0x5a')]['destroy']({'where':{'UserId':{'$in':_0x7a7766},'FaxQueueId':{'$in':_0x144989}},'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(){var _0x12be9a='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1b9623;return db[_0x5b9b('0x4c')][_0x5b9b('0x2d')](_0x12be9a,{'type':db[_0x5b9b('0x4f')][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x33feea){var _0x5a8468=_[_0x5b9b('0x28')](_0x33feea,function(_0x23702f){return Number(_0x23702f[_0x5b9b('0x5b')]);});return db[_0x5b9b('0x5c')][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'OpenchannelQueueId':{'$in':_0x5a8468}},'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(){var _0x3c674c=_0x5b9b('0x5d')+_0x1b9623;return db[_0x5b9b('0x4c')]['query'](_0x3c674c,{'type':db['Sequelize'][_0x5b9b('0x51')][_0x5b9b('0x50')],'raw':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x2d2452){var _0xe88831=_[_0x5b9b('0x28')](_0x2d2452,function(_0x3d0a9d){return Number(_0x3d0a9d[_0x5b9b('0x5e')]);});return db['UserWhatsappQueue'][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'WhatsappQueueId':{'$in':_0xe88831}},'transaction':_0x1c5dfd});})['then'](function(){return db[_0x5b9b('0x5f')]['find']({'where':{'TeamId':_0x1b9623}});})[_0x5b9b('0x23')](function(_0x3789c5){if(_0x3789c5===null){return;}return db[_0x5b9b('0x60')][_0x5b9b('0x4b')]({'where':{'UserId':{'$in':_0x7a7766},'VoicePrefixId':_0x3789c5['VoicePrefixId']},'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(){return db[_0x5b9b('0x29')]['destroy']({'where':{'id':_0x1b9623},'cascade':!![],'transaction':_0x1c5dfd});})[_0x5b9b('0x23')](function(_0x2eeb1a){if(_0x2eeb1a===0x0){_0xb18228['sendStatus'](0x194);}else{return db[_0x5b9b('0x48')]['destroy']({'where':{'type':_0x5b9b('0x61'),'resourceId':_0x1b9623},'cascade':!![],'transaction':_0x1c5dfd})[_0x5b9b('0x23')](function(){_0xb18228['status'](0xcc)[_0x5b9b('0x62')]();});}})[_0x5b9b('0x3d')](function(_0x1eb383){_0xb18228['status'](0x1f4)['send'](_0x1eb383);});});};exports[_0x5b9b('0x63')]=function(_0x50958a,_0x329e47,_0x2985c3){return db[_0x5b9b('0x29')][_0x5b9b('0x64')]({'where':{'id':_0x50958a[_0x5b9b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x329e47,null))[_0x5b9b('0x23')](function(_0xc439ab){if(!_0x50958a[_0x5b9b('0x2d')][_0x5b9b('0x65')]||!utils[_0x5b9b('0x66')](_0x50958a[_0x5b9b('0x2d')][_0x5b9b('0x65')])){throw new db[(_0x5b9b('0x4f'))][(_0x5b9b('0x67'))](_0x5b9b('0x68'));}var _0x4b80ad={};var _0x24dd8f={};_0x24dd8f[_0x5b9b('0x3f')]=_[_0x5b9b('0x2e')](db[_[_0x5b9b('0x69')](_0x50958a['query'][_0x5b9b('0x65')][_0x5b9b('0x6a')]())+_0x5b9b('0x6b')][_0x5b9b('0x2a')]);_0x24dd8f[_0x5b9b('0x2d')]=_['keys'](_0x50958a[_0x5b9b('0x2d')]);_0x24dd8f[_0x5b9b('0x2f')]=_['intersection'](_0x24dd8f[_0x5b9b('0x3f')],_0x24dd8f['query']);_0x4b80ad[_0x5b9b('0x31')]=_[_0x5b9b('0x30')](_0x24dd8f[_0x5b9b('0x3f')],qs['fields'](_0x50958a[_0x5b9b('0x2d')]['fields']));_0x4b80ad[_0x5b9b('0x31')]=_0x4b80ad[_0x5b9b('0x31')][_0x5b9b('0x33')]?_0x4b80ad[_0x5b9b('0x31')]:_0x24dd8f[_0x5b9b('0x3f')];_0x4b80ad['limit']=qs[_0x5b9b('0x1d')](_0x50958a['query']['limit']);_0x4b80ad['offset']=qs['offset'](_0x50958a[_0x5b9b('0x2d')][_0x5b9b('0x1b')]);_0x4b80ad[_0x5b9b('0x36')]=qs[_0x5b9b('0x6c')](_0x50958a[_0x5b9b('0x2d')][_0x5b9b('0x6c')]);_0x4b80ad['where']=qs[_0x5b9b('0x2f')](_[_0x5b9b('0x6d')](_0x50958a['query'],_0x24dd8f[_0x5b9b('0x2f')]));_0x4b80ad=_['merge']({},_0x4b80ad,_0x50958a[_0x5b9b('0x40')]);return _0xc439ab[_0x5b9b('0x43')+_['capitalize'](_0x50958a[_0x5b9b('0x2d')]['channel']['toLowerCase']())+'Queues'](_0x4b80ad);})[_0x5b9b('0x23')](respondWithResult(_0x329e47,null))[_0x5b9b('0x3d')](handleError(_0x329e47,null));};exports['addQueues']=function(_0x8b400b,_0x22568d,_0x5cf019){return db['Team'][_0x5b9b('0x64')]({'where':{'id':_0x8b400b[_0x5b9b('0x3e')]['id']}})['then'](function(_0x4fab48){if(_0x4fab48){if(!_0x8b400b[_0x5b9b('0x42')][_0x5b9b('0x65')]||!utils[_0x5b9b('0x66')](_0x8b400b['body'][_0x5b9b('0x65')])){throw new db[(_0x5b9b('0x4f'))][(_0x5b9b('0x67'))](_0x5b9b('0x68'));}return _0x4fab48['add'+_[_0x5b9b('0x69')](_0x8b400b['body']['channel']['toLowerCase']())+'Queues'](_0x8b400b['body']['ids']);}return null;})[_0x5b9b('0x23')](handleEntityNotFound(_0x22568d,null))[_0x5b9b('0x23')](respondWithStatusCode(_0x22568d,null))['catch'](handleError(_0x22568d,null));};exports[_0x5b9b('0x6e')]=function(_0x5b5eeb,_0xaa7b83,_0x3bde4e){return db[_0x5b9b('0x29')][_0x5b9b('0x64')]({'where':{'id':_0x5b5eeb['params']['id']}})[_0x5b9b('0x23')](function(_0x3dd98b){if(_0x3dd98b){if(!_0x5b5eeb[_0x5b9b('0x2d')][_0x5b9b('0x65')]||!utils[_0x5b9b('0x66')](_0x5b5eeb[_0x5b9b('0x2d')][_0x5b9b('0x65')])){throw new db['Sequelize'][(_0x5b9b('0x67'))]('Unknown\x20channel');}return _0x3dd98b['remove'+_[_0x5b9b('0x69')](_0x5b5eeb[_0x5b9b('0x2d')]['channel'][_0x5b9b('0x6a')]())+_0x5b9b('0x6f')](_0x5b5eeb[_0x5b9b('0x2d')][_0x5b9b('0x70')]);}return null;})[_0x5b9b('0x23')](handleEntityNotFound(_0xaa7b83,null))[_0x5b9b('0x23')](respondWithStatusCode(_0xaa7b83,null))[_0x5b9b('0x3d')](handleError(_0xaa7b83,null));};exports['addAgents']=function(_0x458db9,_0x13c253){var _0x2f1536=_[_0x5b9b('0x71')](_0x458db9[_0x5b9b('0x42')]['ids'])?_0x458db9[_0x5b9b('0x42')]['ids']:[_0x458db9[_0x5b9b('0x42')][_0x5b9b('0x70')]];var _0x53e379=_0x458db9[_0x5b9b('0x3e')]['id'];return db[_0x5b9b('0x29')][_0x5b9b('0x4a')]({'where':{'id':_0x53e379}})[_0x5b9b('0x23')](handleEntityNotFound(_0x13c253,null))[_0x5b9b('0x23')](function(_0x30d5ea){if(_0x30d5ea){var _0x230277=[_0x5b9b('0x72'),_0x5b9b('0x73'),_0x5b9b('0x74'),_0x5b9b('0x75'),_0x5b9b('0x76'),'Openchannel',_0x5b9b('0x77')];return db['sequelize'][_0x5b9b('0x4d')](function(_0x2d351c){var _0x9a9af5=_['map'](_0x230277,function(_0x160ea9){var _0x1dbdc0={'attributes':['id','name']};if(_0x160ea9===_0x5b9b('0x72')){_0x1dbdc0[_0x5b9b('0x78')]={'attributes':['penalty']};}return _0x30d5ea[_0x5b9b('0x43')+_0x160ea9+_0x5b9b('0x6f')](_0x1dbdc0)[_0x5b9b('0x23')](function(_0x2358f5){var _0x1c0bd5=_[_0x5b9b('0x28')](_0x2358f5,function(_0x54636e){var _0x1df07b=_['map'](_0x2f1536,function(_0x322df){var _0x11fb34={'where':{'UserId':_0x322df,[_0x160ea9+_0x5b9b('0x79')]:_0x54636e['id']},'transaction':_0x2d351c};if(_0x160ea9===_0x5b9b('0x72')){_0x11fb34['defaults']={'penalty':_0x54636e[_0x5b9b('0x7a')][_0x5b9b('0x7b')]};}return db[_0x5b9b('0x7c')+_0x160ea9+_0x5b9b('0x6b')][_0x5b9b('0x7d')](_0x11fb34)[_0x5b9b('0x23')](function(){socket['emit']('user'+_0x160ea9+_0x5b9b('0x7e'),{'UserId':_0x322df,[_0x160ea9+_0x5b9b('0x79')]:_0x54636e['id']});if(_0x160ea9!=='Voice'){return;}return db[_0x5b9b('0x7c')][_0x5b9b('0x7f')]({'where':{'id':_0x2f1536,'online':0x1},'attributes':['id',_0x5b9b('0x26'),_0x5b9b('0x80'),_0x5b9b('0x81'),_0x5b9b('0x82')],'raw':!![]})[_0x5b9b('0x23')](function(_0x4556bd){var _0x1bf363=_[_0x5b9b('0x28')](_0x4556bd,function(_0x1098f1){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1098f1[_0x5b9b('0x26')],'UserId':_0x1098f1['id'],'queue_name':_0x54636e[_0x5b9b('0x26')],'VoiceQueueId':_0x54636e['id'],'interface':_[_0x5b9b('0x83')](_0x1098f1[_0x5b9b('0x82')])?util[_0x5b9b('0x84')](_0x5b9b('0x85'),_0x1098f1[_0x5b9b('0x26')]):_0x1098f1[_0x5b9b('0x82')],'paused':_0x1098f1[_0x5b9b('0x81')]||![],'penalty':_0x54636e['TeamVoiceQueue']['penalty']},{'transaction':_0x2d351c});});return Promise['all'](_0x1bf363);});});});return Promise['all'](_0x1df07b);});return Promise[_0x5b9b('0x86')](_0x1c0bd5);})['then'](function(){return db[_0x5b9b('0x5f')]['findOne']({'where':{'teamId':_0x53e379}})['then'](function(_0x3b56fd){if(_0x3b56fd){var _0x515219=_[_0x5b9b('0x28')](_0x2f1536,function(_0x12f331){db[_0x5b9b('0x60')][_0x5b9b('0x87')]({'UserId':_0x12f331,'VoicePrefixId':_0x3b56fd[_0x5b9b('0x88')]});});return Promise[_0x5b9b('0x86')](_0x515219);}});});});return Promise[_0x5b9b('0x86')](_0x9a9af5)['then'](function(){return _0x30d5ea['addAgents'](_0x2f1536,{'transaction':_0x2d351c})[_0x5b9b('0x89')](function(_0xfab144){return _0xfab144;});});});}})[_0x5b9b('0x23')](respondWithResult(_0x13c253,null))[_0x5b9b('0x3d')](handleError(_0x13c253,null));};exports['removeAgents']=function(_0x14e372,_0x5bcc42){var _0x410025=_['isArray'](_0x14e372['query'][_0x5b9b('0x70')])?_0x14e372['query']['ids']:[_0x14e372['query'][_0x5b9b('0x70')]];var _0x14c59a=_0x14e372[_0x5b9b('0x3e')]['id'];return db[_0x5b9b('0x29')][_0x5b9b('0x4a')]({'where':{'id':_0x14c59a}})[_0x5b9b('0x23')](handleEntityNotFound(_0x5bcc42,null))[_0x5b9b('0x23')](function(_0x5c57b0){if(_0x5c57b0){var _0x3e13f6=[_0x5b9b('0x72'),_0x5b9b('0x73'),_0x5b9b('0x74'),_0x5b9b('0x75'),_0x5b9b('0x76'),_0x5b9b('0x8a'),_0x5b9b('0x77')];return db[_0x5b9b('0x4c')][_0x5b9b('0x4d')](function(_0x2eb7a4){var _0x149db7=_['map'](_0x3e13f6,function(_0x377173){var _0x5ba8e2={'attributes':['id',_0x5b9b('0x26')]};return _0x5c57b0['get'+_0x377173+_0x5b9b('0x6f')](_0x5ba8e2)[_0x5b9b('0x23')](function(_0x1893fb){var _0x2fda7f=_[_0x5b9b('0x28')](_0x1893fb,function(_0xf9188c){return _0xf9188c[_0x5b9b('0x8b')](_0x410025,{'transaction':_0x2eb7a4})[_0x5b9b('0x23')](function(){var _0x5a874a=_[_0x5b9b('0x28')](_0x410025,function(_0x3f0db2){socket[_0x5b9b('0x8c')](_0x5b9b('0x8d')+_0x377173+_0x5b9b('0x8e'),{'UserId':Number(_0x3f0db2),[_0x377173+'QueueId']:_0xf9188c['id']});if(_0x377173!=='Voice'){return;}return db[_0x5b9b('0x8f')][_0x5b9b('0x4b')]({'where':{'VoiceQueueId':_0xf9188c['id'],'UserId':_0x3f0db2},'transaction':_0x2eb7a4});});return Promise[_0x5b9b('0x86')](_0x5a874a);});});return Promise['all'](_0x2fda7f);});});return Promise[_0x5b9b('0x86')](_0x149db7)[_0x5b9b('0x23')](function(){return _0x5c57b0['removeAgents'](_0x410025,{'transaction':_0x2eb7a4});})[_0x5b9b('0x23')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x14c59a}})[_0x5b9b('0x23')](function(_0x5be652){if(_0x5be652){var _0x18a489=_[_0x5b9b('0x28')](_0x410025,function(_0x23e636){db['UserVoicePrefix'][_0x5b9b('0x4b')]({'where':{'UserId':_0x23e636,'VoicePrefixId':_0x5be652[_0x5b9b('0x88')]}});});return Promise[_0x5b9b('0x86')](_0x18a489);}});});});}})[_0x5b9b('0x23')](respondWithStatusCode(_0x5bcc42,null))[_0x5b9b('0x3d')](handleError(_0x5bcc42,null));};exports[_0x5b9b('0x90')]=function(_0x5a341c,_0xbcffb6,_0x5224cc){var _0x193fc2={};var _0x5ccd64={};var _0x99bb1a;var _0x45e15c;return db[_0x5b9b('0x29')][_0x5b9b('0x64')]({'where':{'id':_0x5a341c[_0x5b9b('0x3e')]['id']}})[_0x5b9b('0x23')](handleEntityNotFound(_0xbcffb6,null))[_0x5b9b('0x23')](function(_0x25a37e){if(_0x25a37e){_0x99bb1a=_0x25a37e;_0x5ccd64['model']=_[_0x5b9b('0x2e')](db[_0x5b9b('0x7c')][_0x5b9b('0x2a')]);_0x5ccd64[_0x5b9b('0x2d')]=_[_0x5b9b('0x2e')](_0x5a341c[_0x5b9b('0x2d')]);_0x5ccd64['filters']=_[_0x5b9b('0x30')](_0x5ccd64[_0x5b9b('0x3f')],_0x5ccd64[_0x5b9b('0x2d')]);_0x193fc2['attributes']=_[_0x5b9b('0x30')](_0x5ccd64['model'],qs['fields'](_0x5a341c[_0x5b9b('0x2d')][_0x5b9b('0x32')]));_0x193fc2[_0x5b9b('0x31')]=_0x193fc2[_0x5b9b('0x31')][_0x5b9b('0x33')]?_0x193fc2['attributes']:_0x5ccd64[_0x5b9b('0x3f')];_0x193fc2[_0x5b9b('0x36')]=qs[_0x5b9b('0x6c')](_0x5a341c['query'][_0x5b9b('0x6c')]);_0x193fc2[_0x5b9b('0x37')]=qs[_0x5b9b('0x2f')](_['pick'](_0x5a341c[_0x5b9b('0x2d')],_0x5ccd64[_0x5b9b('0x2f')]));if(_0x5a341c[_0x5b9b('0x2d')][_0x5b9b('0x38')]){_0x193fc2[_0x5b9b('0x37')]=_[_0x5b9b('0x39')](_0x193fc2[_0x5b9b('0x37')],{'$or':_[_0x5b9b('0x28')](_0x193fc2[_0x5b9b('0x31')],function(_0x5edb6e){var _0xec03fa={};_0xec03fa[_0x5edb6e]={'$like':'%'+_0x5a341c[_0x5b9b('0x2d')][_0x5b9b('0x38')]+'%'};return _0xec03fa;})});}_0x193fc2=_['merge']({},_0x193fc2,_0x5a341c[_0x5b9b('0x40')]);return _0x99bb1a[_0x5b9b('0x90')](_0x193fc2);}})[_0x5b9b('0x23')](function(_0x28ce51){if(_0x28ce51){_0x45e15c=_0x28ce51[_0x5b9b('0x33')];if(!_0x5a341c['query'][_0x5b9b('0x34')](_0x5b9b('0x35'))){_0x193fc2[_0x5b9b('0x1d')]=qs['limit'](_0x5a341c['query'][_0x5b9b('0x1d')]);_0x193fc2['offset']=qs['offset'](_0x5a341c[_0x5b9b('0x2d')][_0x5b9b('0x1b')]);}return _0x99bb1a[_0x5b9b('0x90')](_0x193fc2);}})[_0x5b9b('0x23')](function(_0x441a9f){if(_0x441a9f){return _0x441a9f?{'count':_0x45e15c,'rows':_0x441a9f}:null;}})[_0x5b9b('0x23')](respondWithResult(_0xbcffb6,null))[_0x5b9b('0x3d')](handleError(_0xbcffb6,null));}; \ No newline at end of file +var _0x88e9=['hasOwnProperty','nolimit','offset','order','sort','where','merge','filter','options','include','rows','catch','show','params','keys','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','update','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','ids','removeQueues','remove','Queues','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','addAgents','removeAgents','emit','Queue:remove','User','pick','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes'];(function(_0x50cd94,_0x4e3f38){var _0x44b6d6=function(_0x2388b9){while(--_0x2388b9){_0x50cd94['push'](_0x50cd94['shift']());}};_0x44b6d6(++_0x4e3f38);}(_0x88e9,0x198));var _0x988e=function(_0x43aec4,_0x5e9eee){_0x43aec4=_0x43aec4-0x0;var _0x2b8b99=_0x88e9[_0x43aec4];return _0x2b8b99;};'use strict';var emlformat=require(_0x988e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x988e('0x1'));var jsonpatch=require(_0x988e('0x2'));var rp=require(_0x988e('0x3'));var moment=require(_0x988e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x988e('0x5'));var util=require(_0x988e('0x6'));var path=require(_0x988e('0x7'));var sox=require(_0x988e('0x8'));var csv=require(_0x988e('0x9'));var ejs=require(_0x988e('0xa'));var fs=require('fs');var fs_extra=require(_0x988e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x988e('0xc'));var jsforce=require(_0x988e('0xd'));var deskjs=require(_0x988e('0xe'));var toCsv=require(_0x988e('0x9'));var querystring=require(_0x988e('0xf'));var Papa=require(_0x988e('0x10'));var Redis=require(_0x988e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x988e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x988e('0x13'))('api');var utils=require(_0x988e('0x14'));var config=require(_0x988e('0x15'));var licenseUtil=require(_0x988e('0x16'));var db=require('../../mysqldb')['db'];config[_0x988e('0x17')]=_['defaults'](config['redis'],{'host':_0x988e('0x18'),'port':0x18eb});var socket=require(_0x988e('0x19'))(new Redis(config['redis']));require(_0x988e('0x1a'))[_0x988e('0x1b')](socket);function respondWithStatusCode(_0x5b7f6e,_0x1be475){_0x1be475=_0x1be475||0xcc;return function(_0x5a6fba){if(_0x5a6fba){return _0x5b7f6e[_0x988e('0x1c')](_0x1be475);}return _0x5b7f6e[_0x988e('0x1d')](_0x1be475)[_0x988e('0x1e')]();};}function respondWithResult(_0x51d34d,_0x1f6a66){_0x1f6a66=_0x1f6a66||0xc8;return function(_0x4236bd){if(_0x4236bd){return _0x51d34d[_0x988e('0x1d')](_0x1f6a66)[_0x988e('0x1f')](_0x4236bd);}};}function respondWithFilteredResult(_0x40a9aa,_0xcd900){return function(_0x138377){if(_0x138377){var _0x394d9e=typeof _0xcd900['offset']===_0x988e('0x20')&&typeof _0xcd900[_0x988e('0x21')]===_0x988e('0x20');var _0x5ca189=_0x138377['count'];var _0x23ae24=_0x394d9e?0x0:_0xcd900['offset'];var _0x2571fa=_0x394d9e?_0x138377[_0x988e('0x22')]:_0xcd900['offset']+_0xcd900[_0x988e('0x21')];var _0x3e3ac9;if(_0x2571fa>=_0x5ca189){_0x2571fa=_0x5ca189;_0x3e3ac9=0xc8;}else{_0x3e3ac9=0xce;}_0x40a9aa['status'](_0x3e3ac9);return _0x40a9aa[_0x988e('0x23')](_0x988e('0x24'),_0x23ae24+'-'+_0x2571fa+'/'+_0x5ca189)['json'](_0x138377);}return null;};}function patchUpdates(_0x37119b){return function(_0x3fe5be){try{jsonpatch[_0x988e('0x25')](_0x3fe5be,_0x37119b,!![]);}catch(_0x4fb8ed){return BPromise[_0x988e('0x26')](_0x4fb8ed);}return _0x3fe5be['save']();};}function saveUpdates(_0x29b923,_0x74d6f1){return function(_0x403936){if(_0x403936){return _0x403936['update'](_0x29b923)[_0x988e('0x27')](function(_0xce6916){return _0xce6916;});}return null;};}function handleEntityNotFound(_0x5ec5cd,_0x5d35c4){return function(_0x17ba12){if(!_0x17ba12){_0x5ec5cd[_0x988e('0x1c')](0x194);}return _0x17ba12;};}function handleError(_0x1e62d9,_0xf05dfd){_0xf05dfd=_0xf05dfd||0x1f4;return function(_0xdd1abf){logger[_0x988e('0x28')](_0xdd1abf['stack']);if(_0xdd1abf[_0x988e('0x29')]){delete _0xdd1abf[_0x988e('0x29')];}_0x1e62d9[_0x988e('0x1d')](_0xf05dfd)[_0x988e('0x2a')](_0xdd1abf);};}exports[_0x988e('0x2b')]=function(_0xe49a0b,_0x188df5){var _0x219537={},_0x377939={},_0x530f80={'count':0x0,'rows':[]};var _0x356f96=_[_0x988e('0x2c')](db[_0x988e('0x2d')][_0x988e('0x2e')],function(_0x531f91){return{'name':_0x531f91[_0x988e('0x2f')],'type':_0x531f91[_0x988e('0x30')][_0x988e('0x31')]};});_0x377939[_0x988e('0x32')]=_[_0x988e('0x2c')](_0x356f96,'name');_0x377939[_0x988e('0x33')]=_['keys'](_0xe49a0b[_0x988e('0x33')]);_0x377939[_0x988e('0x34')]=_[_0x988e('0x35')](_0x377939[_0x988e('0x32')],_0x377939['query']);_0x219537['attributes']=_[_0x988e('0x35')](_0x377939[_0x988e('0x32')],qs[_0x988e('0x36')](_0xe49a0b[_0x988e('0x33')][_0x988e('0x36')]));_0x219537['attributes']=_0x219537['attributes'][_0x988e('0x37')]?_0x219537[_0x988e('0x38')]:_0x377939[_0x988e('0x32')];if(!_0xe49a0b['query'][_0x988e('0x39')](_0x988e('0x3a'))){_0x219537[_0x988e('0x21')]=qs[_0x988e('0x21')](_0xe49a0b[_0x988e('0x33')][_0x988e('0x21')]);_0x219537[_0x988e('0x3b')]=qs['offset'](_0xe49a0b['query'][_0x988e('0x3b')]);}_0x219537[_0x988e('0x3c')]=qs[_0x988e('0x3d')](_0xe49a0b[_0x988e('0x33')][_0x988e('0x3d')]);_0x219537[_0x988e('0x3e')]=qs[_0x988e('0x34')](_['pick'](_0xe49a0b[_0x988e('0x33')],_0x377939[_0x988e('0x34')]),_0x356f96);if(_0xe49a0b['query']['filter']){_0x219537[_0x988e('0x3e')]=_[_0x988e('0x3f')](_0x219537[_0x988e('0x3e')],{'$or':_[_0x988e('0x2c')](_0x356f96,function(_0x24b134){if(_0x24b134[_0x988e('0x30')]!=='VIRTUAL'){var _0x348f0f={};_0x348f0f[_0x24b134['name']]={'$like':'%'+_0xe49a0b[_0x988e('0x33')][_0x988e('0x40')]+'%'};return _0x348f0f;}})});}_0x219537=_['merge']({},_0x219537,_0xe49a0b[_0x988e('0x41')]);var _0x1089ba={'where':_0x219537[_0x988e('0x3e')]};return db[_0x988e('0x2d')]['count'](_0x1089ba)[_0x988e('0x27')](function(_0x3a84aa){_0x530f80['count']=_0x3a84aa;if(_0xe49a0b['query']['includeAll']){_0x219537[_0x988e('0x42')]=[{'all':!![]}];}return db[_0x988e('0x2d')]['findAll'](_0x219537);})[_0x988e('0x27')](function(_0x4ba0c0){_0x530f80[_0x988e('0x43')]=_0x4ba0c0;return _0x530f80;})['then'](respondWithFilteredResult(_0x188df5,_0x219537))[_0x988e('0x44')](handleError(_0x188df5,null));};exports[_0x988e('0x45')]=function(_0x28bc72,_0x5bbd6f){var _0x38d7da={'raw':![],'where':{'id':_0x28bc72[_0x988e('0x46')]['id']}},_0x2abc09={};_0x2abc09[_0x988e('0x32')]=_[_0x988e('0x47')](db[_0x988e('0x2d')][_0x988e('0x2e')]);_0x2abc09['query']=_[_0x988e('0x47')](_0x28bc72[_0x988e('0x33')]);_0x2abc09[_0x988e('0x34')]=_['intersection'](_0x2abc09[_0x988e('0x32')],_0x2abc09['query']);_0x38d7da[_0x988e('0x38')]=_[_0x988e('0x35')](_0x2abc09['model'],qs[_0x988e('0x36')](_0x28bc72[_0x988e('0x33')][_0x988e('0x36')]));_0x38d7da[_0x988e('0x38')]=_0x38d7da[_0x988e('0x38')]['length']?_0x38d7da[_0x988e('0x38')]:_0x2abc09[_0x988e('0x32')];if(_0x28bc72[_0x988e('0x33')]['includeAll']){_0x38d7da[_0x988e('0x42')]=[{'all':!![]}];}_0x38d7da=_['merge']({},_0x38d7da,_0x28bc72['options']);return db[_0x988e('0x2d')][_0x988e('0x48')](_0x38d7da)[_0x988e('0x27')](handleEntityNotFound(_0x5bbd6f,null))[_0x988e('0x27')](respondWithResult(_0x5bbd6f,null))[_0x988e('0x44')](handleError(_0x5bbd6f,null));};exports['create']=function(_0x6a847b,_0x586058){return db[_0x988e('0x2d')][_0x988e('0x49')](_0x6a847b[_0x988e('0x4a')],{})[_0x988e('0x27')](function(_0x559a7f){var _0x46c344=_0x6a847b[_0x988e('0x4b')][_0x988e('0x4c')]({'plain':!![]});if(!_0x46c344)throw new Error(_0x988e('0x4d'));if(_0x46c344[_0x988e('0x4e')]===_0x988e('0x4b')){var _0x407248=_0x559a7f[_0x988e('0x4c')]({'plain':!![]});var _0xa7b898='Teams';return db[_0x988e('0x4f')][_0x988e('0x48')]({'where':{'name':_0xa7b898,'userProfileId':_0x46c344['userProfileId']},'raw':!![]})['then'](function(_0x584424){if(_0x584424&&_0x584424['autoAssociation']===0x0){return db[_0x988e('0x50')][_0x988e('0x49')]({'name':_0x407248[_0x988e('0x29')],'resourceId':_0x407248['id'],'type':_0x584424[_0x988e('0x29')],'sectionId':_0x584424['id']},{})[_0x988e('0x27')](function(){return _0x559a7f;});}else{return _0x559a7f;}})[_0x988e('0x44')](function(_0x4c414e){logger[_0x988e('0x28')](_0x988e('0x51'),_0x4c414e);throw _0x4c414e;});}return _0x559a7f;})[_0x988e('0x27')](respondWithResult(_0x586058,0xc9))[_0x988e('0x44')](handleError(_0x586058,null));};exports[_0x988e('0x52')]=function(_0x348892,_0x22add3){if(_0x348892[_0x988e('0x4a')]['id']){delete _0x348892[_0x988e('0x4a')]['id'];}return db[_0x988e('0x2d')][_0x988e('0x48')]({'where':{'id':_0x348892['params']['id']}})[_0x988e('0x27')](handleEntityNotFound(_0x22add3,null))[_0x988e('0x27')](saveUpdates(_0x348892[_0x988e('0x4a')],null))['then'](respondWithResult(_0x22add3,null))[_0x988e('0x44')](handleError(_0x22add3,null));};exports['destroy']=function(_0x2db5aa,_0x51f484){var _0x5df0f6=_0x2db5aa[_0x988e('0x46')]['id'];var _0x353cab=[];return db[_0x988e('0x53')]['transaction'](function(_0x3ab718){var _0x28d70d=_0x988e('0x54')+_0x5df0f6;return db[_0x988e('0x53')][_0x988e('0x33')](_0x28d70d,{'type':db[_0x988e('0x55')][_0x988e('0x56')]['SELECT'],'raw':!![],'transaction':_0x3ab718})[_0x988e('0x27')](function(_0x4160a5){_0x353cab=_['map'](_0x4160a5,function(_0x276b53){return Number(_0x276b53[_0x988e('0x57')]);});})['then'](function(){var _0x22d16c=_0x988e('0x58')+_0x5df0f6;return db[_0x988e('0x53')]['query'](_0x22d16c,{'type':db['Sequelize'][_0x988e('0x56')]['SELECT'],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x3f583e){var _0x12d8dd=_[_0x988e('0x2c')](_0x3f583e,function(_0x5c161b){return Number(_0x5c161b['VoiceQueueId']);});return db[_0x988e('0x59')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'VoiceQueueId':{'$in':_0x12d8dd}},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){var _0x23cb33=_0x988e('0x5b')+_0x5df0f6;return db[_0x988e('0x53')][_0x988e('0x33')](_0x23cb33,{'type':db[_0x988e('0x55')][_0x988e('0x56')]['SELECT'],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x2d7788){var _0xb43c5=_[_0x988e('0x2c')](_0x2d7788,function(_0x2f122c){return Number(_0x2f122c[_0x988e('0x5c')]);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x353cab},'MailQueueId':{'$in':_0xb43c5}},'transaction':_0x3ab718});})['then'](function(){var _0x5bc16b=_0x988e('0x5d')+_0x5df0f6;return db[_0x988e('0x53')]['query'](_0x5bc16b,{'type':db['Sequelize'][_0x988e('0x56')]['SELECT'],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x417855){var _0x4470f8=_[_0x988e('0x2c')](_0x417855,function(_0x516db7){return Number(_0x516db7['SmsQueueId']);});return db[_0x988e('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x353cab},'SmsQueueId':{'$in':_0x4470f8}},'transaction':_0x3ab718});})['then'](function(){var _0x40bccc=_0x988e('0x5f')+_0x5df0f6;return db['sequelize']['query'](_0x40bccc,{'type':db[_0x988e('0x55')]['QueryTypes'][_0x988e('0x60')],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x8b5568){var _0x1ce518=_['map'](_0x8b5568,function(_0xea6c3b){return Number(_0xea6c3b[_0x988e('0x61')]);});return db[_0x988e('0x62')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'ChatQueueId':{'$in':_0x1ce518}},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){var _0x2b78e3='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5df0f6;return db['sequelize'][_0x988e('0x33')](_0x2b78e3,{'type':db[_0x988e('0x55')][_0x988e('0x56')][_0x988e('0x60')],'raw':!![],'transaction':_0x3ab718});})['then'](function(_0x51cdc2){var _0x178197=_['map'](_0x51cdc2,function(_0x2f98f2){return Number(_0x2f98f2[_0x988e('0x63')]);});return db[_0x988e('0x64')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'FaxQueueId':{'$in':_0x178197}},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){var _0x3bf6fe=_0x988e('0x65')+_0x5df0f6;return db[_0x988e('0x53')][_0x988e('0x33')](_0x3bf6fe,{'type':db['Sequelize'][_0x988e('0x56')][_0x988e('0x60')],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x411089){var _0x1c4655=_['map'](_0x411089,function(_0x403ec3){return Number(_0x403ec3[_0x988e('0x66')]);});return db[_0x988e('0x67')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'OpenchannelQueueId':{'$in':_0x1c4655}},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){var _0xf62f52=_0x988e('0x68')+_0x5df0f6;return db[_0x988e('0x53')][_0x988e('0x33')](_0xf62f52,{'type':db[_0x988e('0x55')][_0x988e('0x56')][_0x988e('0x60')],'raw':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x474ead){var _0xde927c=_['map'](_0x474ead,function(_0x8035a1){return Number(_0x8035a1[_0x988e('0x69')]);});return db[_0x988e('0x6a')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'WhatsappQueueId':{'$in':_0xde927c}},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){return db[_0x988e('0x6b')][_0x988e('0x48')]({'where':{'TeamId':_0x5df0f6}});})[_0x988e('0x27')](function(_0x50b75c){if(_0x50b75c===null){return;}return db[_0x988e('0x6c')][_0x988e('0x5a')]({'where':{'UserId':{'$in':_0x353cab},'VoicePrefixId':_0x50b75c[_0x988e('0x6d')]},'transaction':_0x3ab718});})[_0x988e('0x27')](function(){return db[_0x988e('0x2d')][_0x988e('0x5a')]({'where':{'id':_0x5df0f6},'cascade':!![],'transaction':_0x3ab718});})[_0x988e('0x27')](function(_0x5f5301){if(_0x5f5301===0x0){_0x51f484[_0x988e('0x1c')](0x194);}else{return db[_0x988e('0x50')][_0x988e('0x5a')]({'where':{'type':'Teams','resourceId':_0x5df0f6},'cascade':!![],'transaction':_0x3ab718})[_0x988e('0x27')](function(){_0x51f484[_0x988e('0x1d')](0xcc)[_0x988e('0x1e')]();});}})[_0x988e('0x44')](function(_0x4591ed){_0x51f484[_0x988e('0x1d')](0x1f4)[_0x988e('0x2a')](_0x4591ed);});});};exports[_0x988e('0x6e')]=function(_0x24290d,_0x4fc8e6,_0x1aedf7){return db[_0x988e('0x2d')][_0x988e('0x6f')]({'where':{'id':_0x24290d[_0x988e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fc8e6,null))['then'](function(_0x36d5e1){if(!_0x24290d[_0x988e('0x33')][_0x988e('0x70')]||!utils[_0x988e('0x71')](_0x24290d[_0x988e('0x33')][_0x988e('0x70')])){throw new db[(_0x988e('0x55'))][(_0x988e('0x72'))](_0x988e('0x73'));}var _0x3474e8={};var _0x326fdc={};_0x326fdc[_0x988e('0x32')]=_[_0x988e('0x47')](db[_[_0x988e('0x74')](_0x24290d[_0x988e('0x33')][_0x988e('0x70')][_0x988e('0x75')]())+_0x988e('0x76')][_0x988e('0x2e')]);_0x326fdc['query']=_[_0x988e('0x47')](_0x24290d[_0x988e('0x33')]);_0x326fdc[_0x988e('0x34')]=_[_0x988e('0x35')](_0x326fdc['model'],_0x326fdc[_0x988e('0x33')]);_0x3474e8[_0x988e('0x38')]=_[_0x988e('0x35')](_0x326fdc['model'],qs[_0x988e('0x36')](_0x24290d[_0x988e('0x33')][_0x988e('0x36')]));_0x3474e8['attributes']=_0x3474e8[_0x988e('0x38')][_0x988e('0x37')]?_0x3474e8['attributes']:_0x326fdc[_0x988e('0x32')];_0x3474e8[_0x988e('0x21')]=qs['limit'](_0x24290d['query']['limit']);_0x3474e8[_0x988e('0x3b')]=qs[_0x988e('0x3b')](_0x24290d['query'][_0x988e('0x3b')]);_0x3474e8[_0x988e('0x3c')]=qs[_0x988e('0x3d')](_0x24290d[_0x988e('0x33')][_0x988e('0x3d')]);_0x3474e8[_0x988e('0x3e')]=qs['filters'](_['pick'](_0x24290d[_0x988e('0x33')],_0x326fdc['filters']));_0x3474e8=_[_0x988e('0x3f')]({},_0x3474e8,_0x24290d[_0x988e('0x41')]);return _0x36d5e1[_0x988e('0x4c')+_[_0x988e('0x74')](_0x24290d[_0x988e('0x33')][_0x988e('0x70')][_0x988e('0x75')]())+'Queues'](_0x3474e8);})[_0x988e('0x27')](respondWithResult(_0x4fc8e6,null))['catch'](handleError(_0x4fc8e6,null));};exports[_0x988e('0x77')]=function(_0x11bc7e,_0x55ee61,_0x70b98b){return db['Team']['findOne']({'where':{'id':_0x11bc7e[_0x988e('0x46')]['id']}})[_0x988e('0x27')](function(_0x2dce47){if(_0x2dce47){if(!_0x11bc7e[_0x988e('0x4a')][_0x988e('0x70')]||!utils[_0x988e('0x71')](_0x11bc7e[_0x988e('0x4a')][_0x988e('0x70')])){throw new db[(_0x988e('0x55'))]['ValidationError']('Unknown\x20channel');}return _0x2dce47[_0x988e('0x78')+_[_0x988e('0x74')](_0x11bc7e['body'][_0x988e('0x70')][_0x988e('0x75')]())+'Queues'](_0x11bc7e['body'][_0x988e('0x79')]);}return null;})[_0x988e('0x27')](handleEntityNotFound(_0x55ee61,null))[_0x988e('0x27')](respondWithStatusCode(_0x55ee61,null))[_0x988e('0x44')](handleError(_0x55ee61,null));};exports[_0x988e('0x7a')]=function(_0x4fa6d9,_0x4502ad,_0x2c56c9){return db[_0x988e('0x2d')][_0x988e('0x6f')]({'where':{'id':_0x4fa6d9[_0x988e('0x46')]['id']}})['then'](function(_0xa0918c){if(_0xa0918c){if(!_0x4fa6d9['query'][_0x988e('0x70')]||!utils[_0x988e('0x71')](_0x4fa6d9['query']['channel'])){throw new db['Sequelize'][(_0x988e('0x72'))](_0x988e('0x73'));}return _0xa0918c[_0x988e('0x7b')+_[_0x988e('0x74')](_0x4fa6d9['query'][_0x988e('0x70')]['toLowerCase']())+_0x988e('0x7c')](_0x4fa6d9[_0x988e('0x33')][_0x988e('0x79')]);}return null;})[_0x988e('0x27')](handleEntityNotFound(_0x4502ad,null))['then'](respondWithStatusCode(_0x4502ad,null))[_0x988e('0x44')](handleError(_0x4502ad,null));};exports['addAgents']=function(_0x2766e6,_0x33f6f4){var _0x26133d=_[_0x988e('0x7d')](_0x2766e6[_0x988e('0x4a')][_0x988e('0x79')])?_0x2766e6[_0x988e('0x4a')][_0x988e('0x79')]:[_0x2766e6[_0x988e('0x4a')][_0x988e('0x79')]];var _0x40c648=_0x2766e6[_0x988e('0x46')]['id'];return db['Team'][_0x988e('0x48')]({'where':{'id':_0x40c648}})[_0x988e('0x27')](handleEntityNotFound(_0x33f6f4,null))['then'](function(_0x36b8c4){if(_0x36b8c4){var _0x5a17f6=[_0x988e('0x7e'),_0x988e('0x7f'),_0x988e('0x80'),_0x988e('0x81'),_0x988e('0x82'),_0x988e('0x83'),_0x988e('0x84')];return db[_0x988e('0x53')]['transaction'](function(_0x46c4fd){var _0x59745b=_['map'](_0x5a17f6,function(_0x5eb135){var _0xee80d1={'attributes':['id',_0x988e('0x29')]};if(_0x5eb135===_0x988e('0x7e')){_0xee80d1[_0x988e('0x85')]={'attributes':[_0x988e('0x86')]};}return _0x36b8c4[_0x988e('0x4c')+_0x5eb135+_0x988e('0x7c')](_0xee80d1)[_0x988e('0x27')](function(_0x4ec041){var _0x2b4a38=_['map'](_0x4ec041,function(_0x340a95){var _0x1e01b3=_[_0x988e('0x2c')](_0x26133d,function(_0x10fd63){var _0x4c08fe={'where':{'UserId':_0x10fd63,[_0x5eb135+_0x988e('0x87')]:_0x340a95['id']},'transaction':_0x46c4fd};if(_0x5eb135==='Voice'){_0x4c08fe[_0x988e('0x88')]={'penalty':_0x340a95[_0x988e('0x89')]['penalty']};}return db['User'+_0x5eb135+_0x988e('0x76')]['findOrCreate'](_0x4c08fe)[_0x988e('0x27')](function(){socket['emit']('user'+_0x5eb135+_0x988e('0x8a'),{'UserId':_0x10fd63,[_0x5eb135+_0x988e('0x87')]:_0x340a95['id']});if(_0x5eb135!==_0x988e('0x7e')){return;}return db['User'][_0x988e('0x8b')]({'where':{'id':_0x26133d,'online':0x1},'attributes':['id',_0x988e('0x29'),_0x988e('0x8c'),_0x988e('0x8d'),_0x988e('0x8e')],'raw':!![]})[_0x988e('0x27')](function(_0x15afe1){var _0x5a964f=_[_0x988e('0x2c')](_0x15afe1,function(_0x3f2a34){return db[_0x988e('0x8f')][_0x988e('0x90')]({'membername':_0x3f2a34['name'],'UserId':_0x3f2a34['id'],'queue_name':_0x340a95[_0x988e('0x29')],'VoiceQueueId':_0x340a95['id'],'interface':_[_0x988e('0x91')](_0x3f2a34[_0x988e('0x8e')])?util['format'](_0x988e('0x92'),_0x3f2a34[_0x988e('0x29')]):_0x3f2a34[_0x988e('0x8e')],'paused':_0x3f2a34['voicePause']||![],'penalty':_0x340a95['TeamVoiceQueue'][_0x988e('0x86')]},{'transaction':_0x46c4fd});});return Promise[_0x988e('0x93')](_0x5a964f);});});});return Promise[_0x988e('0x93')](_0x1e01b3);});return Promise['all'](_0x2b4a38);})['then'](function(){return db[_0x988e('0x6b')][_0x988e('0x6f')]({'where':{'teamId':_0x40c648}})['then'](function(_0x236329){if(_0x236329){var _0x47e38a=_['map'](_0x26133d,function(_0x48a19f){db[_0x988e('0x6c')]['upsert']({'UserId':_0x48a19f,'VoicePrefixId':_0x236329[_0x988e('0x6d')]});});return Promise[_0x988e('0x93')](_0x47e38a);}});});});return Promise[_0x988e('0x93')](_0x59745b)[_0x988e('0x27')](function(){return _0x36b8c4[_0x988e('0x94')](_0x26133d,{'transaction':_0x46c4fd})['spread'](function(_0x32f4aa){return _0x32f4aa;});});});}})['then'](respondWithResult(_0x33f6f4,null))[_0x988e('0x44')](handleError(_0x33f6f4,null));};exports[_0x988e('0x95')]=function(_0x384ea8,_0xdae925){var _0x565ec7=_[_0x988e('0x7d')](_0x384ea8[_0x988e('0x33')]['ids'])?_0x384ea8['query']['ids']:[_0x384ea8['query'][_0x988e('0x79')]];var _0x8737cf=_0x384ea8[_0x988e('0x46')]['id'];return db['Team']['find']({'where':{'id':_0x8737cf}})['then'](handleEntityNotFound(_0xdae925,null))['then'](function(_0x37ccef){if(_0x37ccef){var _0x2c9900=[_0x988e('0x7e'),_0x988e('0x7f'),_0x988e('0x80'),'Sms',_0x988e('0x82'),_0x988e('0x83'),_0x988e('0x84')];return db['sequelize']['transaction'](function(_0x24b32d){var _0x300828=_['map'](_0x2c9900,function(_0x55a4ad){var _0x870860={'attributes':['id',_0x988e('0x29')]};return _0x37ccef[_0x988e('0x4c')+_0x55a4ad+'Queues'](_0x870860)[_0x988e('0x27')](function(_0x2d035d){var _0x5cba6e=_[_0x988e('0x2c')](_0x2d035d,function(_0x24c1ab){return _0x24c1ab[_0x988e('0x95')](_0x565ec7,{'transaction':_0x24b32d})[_0x988e('0x27')](function(){var _0x51b9f8=_[_0x988e('0x2c')](_0x565ec7,function(_0x347c56){socket[_0x988e('0x96')](_0x988e('0x4b')+_0x55a4ad+_0x988e('0x97'),{'UserId':Number(_0x347c56),[_0x55a4ad+_0x988e('0x87')]:_0x24c1ab['id']});if(_0x55a4ad!==_0x988e('0x7e')){return;}return db[_0x988e('0x8f')][_0x988e('0x5a')]({'where':{'VoiceQueueId':_0x24c1ab['id'],'UserId':_0x347c56},'transaction':_0x24b32d});});return Promise[_0x988e('0x93')](_0x51b9f8);});});return Promise['all'](_0x5cba6e);});});return Promise['all'](_0x300828)['then'](function(){return _0x37ccef[_0x988e('0x95')](_0x565ec7,{'transaction':_0x24b32d});})['then'](function(){return db[_0x988e('0x6b')]['findOne']({'where':{'teamId':_0x8737cf}})[_0x988e('0x27')](function(_0x55d923){if(_0x55d923){var _0x58ba17=_['map'](_0x565ec7,function(_0x925922){db[_0x988e('0x6c')][_0x988e('0x5a')]({'where':{'UserId':_0x925922,'VoicePrefixId':_0x55d923['VoicePrefixId']}});});return Promise[_0x988e('0x93')](_0x58ba17);}});});});}})[_0x988e('0x27')](respondWithStatusCode(_0xdae925,null))[_0x988e('0x44')](handleError(_0xdae925,null));};exports['getAgents']=function(_0x54f913,_0x5cdfcf,_0x3d33a7){var _0x25436d={};var _0x4df3a0={};var _0x50aaab;var _0x5295a2;return db[_0x988e('0x2d')][_0x988e('0x6f')]({'where':{'id':_0x54f913[_0x988e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5cdfcf,null))['then'](function(_0xe9abf5){if(_0xe9abf5){_0x50aaab=_0xe9abf5;_0x4df3a0['model']=_[_0x988e('0x47')](db[_0x988e('0x98')]['rawAttributes']);_0x4df3a0[_0x988e('0x33')]=_[_0x988e('0x47')](_0x54f913[_0x988e('0x33')]);_0x4df3a0['filters']=_['intersection'](_0x4df3a0['model'],_0x4df3a0['query']);_0x25436d[_0x988e('0x38')]=_[_0x988e('0x35')](_0x4df3a0['model'],qs[_0x988e('0x36')](_0x54f913[_0x988e('0x33')]['fields']));_0x25436d[_0x988e('0x38')]=_0x25436d[_0x988e('0x38')][_0x988e('0x37')]?_0x25436d[_0x988e('0x38')]:_0x4df3a0[_0x988e('0x32')];_0x25436d['order']=qs[_0x988e('0x3d')](_0x54f913[_0x988e('0x33')][_0x988e('0x3d')]);_0x25436d[_0x988e('0x3e')]=qs['filters'](_[_0x988e('0x99')](_0x54f913[_0x988e('0x33')],_0x4df3a0[_0x988e('0x34')]));if(_0x54f913[_0x988e('0x33')][_0x988e('0x40')]){_0x25436d[_0x988e('0x3e')]=_['merge'](_0x25436d['where'],{'$or':_[_0x988e('0x2c')](_0x25436d[_0x988e('0x38')],function(_0x2e577c){var _0x13b62a={};_0x13b62a[_0x2e577c]={'$like':'%'+_0x54f913[_0x988e('0x33')][_0x988e('0x40')]+'%'};return _0x13b62a;})});}_0x25436d=_[_0x988e('0x3f')]({},_0x25436d,_0x54f913[_0x988e('0x41')]);return _0x50aaab[_0x988e('0x9a')](_0x25436d);}})[_0x988e('0x27')](function(_0x4da5fd){if(_0x4da5fd){_0x5295a2=_0x4da5fd[_0x988e('0x37')];if(!_0x54f913[_0x988e('0x33')][_0x988e('0x39')](_0x988e('0x3a'))){_0x25436d['limit']=qs[_0x988e('0x21')](_0x54f913[_0x988e('0x33')]['limit']);_0x25436d[_0x988e('0x3b')]=qs[_0x988e('0x3b')](_0x54f913['query'][_0x988e('0x3b')]);}return _0x50aaab[_0x988e('0x9a')](_0x25436d);}})[_0x988e('0x27')](function(_0x590c23){if(_0x590c23){return _0x590c23?{'count':_0x5295a2,'rows':_0x590c23}:null;}})[_0x988e('0x27')](respondWithResult(_0x5cdfcf,null))[_0x988e('0x44')](handleError(_0x5cdfcf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 13ecdd4..0f9240f 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 _0x6321=['exports','update','remove','emit','hasOwnProperty'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0x6321,0x1d7));var _0x1632=function(_0x1a870e,_0x18bdd1){_0x1a870e=_0x1a870e-0x0;var _0x4ef50a=_0x6321[_0x1a870e];return _0x4ef50a;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1632('0x0'),'afterDestroy':_0x1632('0x1')};function emitEvent(_0x31d07b){return function(_0xa8312b,_0x1626e8,_0xeb2b81){TeamEvents[_0x1632('0x2')](_0x31d07b+':'+_0xa8312b['id'],_0xa8312b);TeamEvents[_0x1632('0x2')](_0x31d07b,_0xa8312b);_0xeb2b81(null);};}for(var e in events){if(events[_0x1632('0x3')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x1632('0x4')]=TeamEvents; \ No newline at end of file +var _0x0ebd=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x30b1e1,_0x22c111){var _0x148a80=function(_0x164864){while(--_0x164864){_0x30b1e1['push'](_0x30b1e1['shift']());}};_0x148a80(++_0x22c111);}(_0x0ebd,0x1aa));var _0xd0eb=function(_0x1a16ed,_0x22c666){_0x1a16ed=_0x1a16ed-0x0;var _0x2b6c08=_0x0ebd[_0x1a16ed];return _0x2b6c08;};'use strict';var EventEmitter=require(_0xd0eb('0x0'));var Team=require(_0xd0eb('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xd0eb('0x2')](0x0);var events={'afterCreate':_0xd0eb('0x3'),'afterUpdate':_0xd0eb('0x4'),'afterDestroy':_0xd0eb('0x5')};function emitEvent(_0x3f9c94){return function(_0x1cb3e8,_0x13b281,_0x394f43){TeamEvents[_0xd0eb('0x6')](_0x3f9c94+':'+_0x1cb3e8['id'],_0x1cb3e8);TeamEvents['emit'](_0x3f9c94,_0x1cb3e8);_0x394f43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xd0eb('0x7')](e,emitEvent(event));}}module[_0xd0eb('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index dcffd6e..5dbaae0 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 _0x30ef=['Voice','Whatsapp','resolve','all','then','map','channel','catch','define','Team','Chat','Openchannel','Sms'];(function(_0x2890f0,_0x27dade){var _0x52b823=function(_0x4e07f0){while(--_0x4e07f0){_0x2890f0['push'](_0x2890f0['shift']());}};_0x52b823(++_0x27dade);}(_0x30ef,0xe1));var _0xf30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30ef[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x2e53cb,_0x44dbd1){var _0x5e8dca='get'+_0x44dbd1+'Queues';return _0x2e53cb[_0x5e8dca]()[_0xf30e('0x0')](function(_0x4e4cbd){return _[_0xf30e('0x1')](_0x4e4cbd,function(_0x45489e){_0x45489e['setDataValue'](_0xf30e('0x2'),_0x44dbd1);return _0x45489e;});})[_0xf30e('0x3')](function(_0x4e4f01){throw _0x4e4f01;});}module['exports']=function(_0x2240ba){return _0x2240ba[_0xf30e('0x4')](_0xf30e('0x5'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x11673a=this;var _0x414ae7=[_0xf30e('0x6'),'Fax','Mail',_0xf30e('0x7'),_0xf30e('0x8'),_0xf30e('0x9'),_0xf30e('0xa')];return Promise[_0xf30e('0xb')]()[_0xf30e('0x0')](function(){var _0x5a0f4f=_[_0xf30e('0x1')](_0x414ae7,function(_0x2e7d0f){return getQueuesByChannel(_0x11673a,_0x2e7d0f);});return Promise[_0xf30e('0xc')](_0x5a0f4f);})['catch'](function(_0x34f52a){throw _0x34f52a;});}}});}; \ No newline at end of file +var _0x67ea=['catch','Team','teams','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0x67ea,0xfa));var _0xa67e=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0x67ea[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0xa67e('0x0'));var attributes=require(_0xa67e('0x1'));function getQueuesByChannel(_0xb0a5f6,_0x26b265){var _0x3b47bb=_0xa67e('0x2')+_0x26b265+'Queues';return _0xb0a5f6[_0x3b47bb]()[_0xa67e('0x3')](function(_0x8a840c){return _[_0xa67e('0x4')](_0x8a840c,function(_0x38b1f3){_0x38b1f3['setDataValue']('channel',_0x26b265);return _0x38b1f3;});})[_0xa67e('0x5')](function(_0x500607){throw _0x500607;});}module['exports']=function(_0x2795a6){return _0x2795a6['define'](_0xa67e('0x6'),attributes,{'tableName':_0xa67e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x566360=this;var _0x4c1ed8=['Chat',_0xa67e('0x8'),'Mail',_0xa67e('0x9'),_0xa67e('0xa'),_0xa67e('0xb'),_0xa67e('0xc')];return Promise[_0xa67e('0xd')]()['then'](function(){var _0x3ecd55=_['map'](_0x4c1ed8,function(_0x409117){return getQueuesByChannel(_0x566360,_0x409117);});return Promise[_0xa67e('0xe')](_0x3ecd55);})[_0xa67e('0x5')](function(_0x23e481){throw _0x23e481;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9353635..8341ed3 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 _0x470c=['defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x25bed2,_0x345ed7){var _0x162241=function(_0x34f0b4){while(--_0x34f0b4){_0x25bed2['push'](_0x25bed2['shift']());}};_0x162241(++_0x345ed7);}(_0x470c,0x1be));var _0xc470=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x470c[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xc470('0x0'));var util=require(_0xc470('0x1'));var moment=require(_0xc470('0x2'));var BPromise=require(_0xc470('0x3'));var rs=require(_0xc470('0x4'));var fs=require('fs');var Redis=require(_0xc470('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc470('0x6'));var logger=require('../../config/logger')(_0xc470('0x7'));var config=require(_0xc470('0x8'));var jayson=require(_0xc470('0x9'));var client=jayson[_0xc470('0xa')][_0xc470('0xb')]({'port':0x232a});config[_0xc470('0xc')]=_[_0xc470('0xd')](config[_0xc470('0xc')],{'host':_0xc470('0xe'),'port':0x18eb});var socket=require(_0xc470('0xf'))(new Redis(config[_0xc470('0xc')]));require('./team.socket')[_0xc470('0x10')](socket);function respondWithRpcPromise(_0x3e6bfb,_0x584e56,_0xde35c5){return new BPromise(function(_0x344783,_0x12080c){return client[_0xc470('0x11')](_0x3e6bfb,_0xde35c5)[_0xc470('0x12')](function(_0x5e073d){logger[_0xc470('0x13')](_0xc470('0x14'),_0x584e56,_0xc470('0x15'));logger[_0xc470('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x584e56,_0xc470('0x15'),JSON['stringify'](_0x5e073d));if(_0x5e073d[_0xc470('0x17')]){if(_0x5e073d[_0xc470('0x17')][_0xc470('0x18')]===0x1f4){logger[_0xc470('0x17')](_0xc470('0x14'),_0x584e56,_0x5e073d[_0xc470('0x17')]['message']);return _0x12080c(_0x5e073d[_0xc470('0x17')]['message']);}logger[_0xc470('0x17')]('Team,\x20%s,\x20%s',_0x584e56,_0x5e073d['error'][_0xc470('0x19')]);return _0x344783(_0x5e073d[_0xc470('0x17')][_0xc470('0x19')]);}else{logger['info'](_0xc470('0x14'),_0x584e56,_0xc470('0x15'));_0x344783(_0x5e073d[_0xc470('0x1a')][_0xc470('0x19')]);}})['catch'](function(_0x29eee9){logger['error'](_0xc470('0x14'),_0x584e56,_0x29eee9);_0x12080c(_0x29eee9);});});} \ No newline at end of file +var _0x3a99=['register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./team.socket'];(function(_0x1b6808,_0x2d3f68){var _0x41050c=function(_0x3129a8){while(--_0x3129a8){_0x1b6808['push'](_0x1b6808['shift']());}};_0x41050c(++_0x2d3f68);}(_0x3a99,0x140));var _0x93a9=function(_0x1b96c6,_0x45e55a){_0x1b96c6=_0x1b96c6-0x0;var _0x4a20fa=_0x3a99[_0x1b96c6];return _0x4a20fa;};'use strict';var _=require(_0x93a9('0x0'));var util=require(_0x93a9('0x1'));var moment=require(_0x93a9('0x2'));var BPromise=require('bluebird');var rs=require(_0x93a9('0x3'));var fs=require('fs');var Redis=require(_0x93a9('0x4'));var db=require(_0x93a9('0x5'))['db'];var utils=require(_0x93a9('0x6'));var logger=require(_0x93a9('0x7'))(_0x93a9('0x8'));var config=require(_0x93a9('0x9'));var jayson=require(_0x93a9('0xa'));var client=jayson['client'][_0x93a9('0xb')]({'port':0x232a});config['redis']=_[_0x93a9('0xc')](config[_0x93a9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x93a9('0xe'))(new Redis(config[_0x93a9('0xd')]));require(_0x93a9('0xf'))[_0x93a9('0x10')](socket);function respondWithRpcPromise(_0x423ba8,_0x26ba1d,_0x50d16d){return new BPromise(function(_0x36c8b0,_0x1fa6ed){return client[_0x93a9('0x11')](_0x423ba8,_0x50d16d)[_0x93a9('0x12')](function(_0x5ab6f0){logger[_0x93a9('0x13')](_0x93a9('0x14'),_0x26ba1d,_0x93a9('0x15'));logger[_0x93a9('0x16')](_0x93a9('0x17'),_0x26ba1d,_0x93a9('0x15'),JSON['stringify'](_0x5ab6f0));if(_0x5ab6f0[_0x93a9('0x18')]){if(_0x5ab6f0[_0x93a9('0x18')][_0x93a9('0x19')]===0x1f4){logger[_0x93a9('0x18')](_0x93a9('0x14'),_0x26ba1d,_0x5ab6f0['error'][_0x93a9('0x1a')]);return _0x1fa6ed(_0x5ab6f0['error'][_0x93a9('0x1a')]);}logger[_0x93a9('0x18')](_0x93a9('0x14'),_0x26ba1d,_0x5ab6f0[_0x93a9('0x18')]['message']);return _0x36c8b0(_0x5ab6f0[_0x93a9('0x18')][_0x93a9('0x1a')]);}else{logger[_0x93a9('0x13')](_0x93a9('0x14'),_0x26ba1d,_0x93a9('0x15'));_0x36c8b0(_0x5ab6f0[_0x93a9('0x1b')]['message']);}})['catch'](function(_0x2048e7){logger['error'](_0x93a9('0x14'),_0x26ba1d,_0x2048e7);_0x1fa6ed(_0x2048e7);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b62dc66..858b361 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 _0xae7b=['team:','./team.events','save','remove','emit','register','length'];(function(_0x32115c,_0x110164){var _0x3d3b7d=function(_0x3ada0a){while(--_0x3ada0a){_0x32115c['push'](_0x32115c['shift']());}};_0x3d3b7d(++_0x110164);}(_0xae7b,0xbe));var _0xbae7=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xae7b[_0x114d1f];return _0x5b91d4;};'use strict';var TeamEvents=require(_0xbae7('0x0'));var events=[_0xbae7('0x1'),_0xbae7('0x2'),'update'];function createListener(_0x54a99e,_0x324890){return function(_0x2da494){_0x324890[_0xbae7('0x3')](_0x54a99e,_0x2da494);};}function removeListener(_0xc0d4b9,_0x49bdda){return function(){TeamEvents['removeListener'](_0xc0d4b9,_0x49bdda);};}exports[_0xbae7('0x4')]=function(_0xb625f6){for(var _0x163147=0x0,_0x56c84c=events[_0xbae7('0x5')];_0x163147<_0x56c84c;_0x163147++){var _0x539635=events[_0x163147];var _0x228a90=createListener(_0xbae7('0x6')+_0x539635,_0xb625f6);TeamEvents['on'](_0x539635,_0x228a90);}}; \ No newline at end of file +var _0x515d=['removeListener','length','save','remove','update','emit'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x515d,0x104));var _0xd515=function(_0x48cd8a,_0x33c030){_0x48cd8a=_0x48cd8a-0x0;var _0x13674d=_0x515d[_0x48cd8a];return _0x13674d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xd515('0x0'),_0xd515('0x1'),_0xd515('0x2')];function createListener(_0x2241af,_0x153f6a){return function(_0x4240ce){_0x153f6a[_0xd515('0x3')](_0x2241af,_0x4240ce);};}function removeListener(_0x442530,_0x51e08b){return function(){TeamEvents[_0xd515('0x4')](_0x442530,_0x51e08b);};}exports['register']=function(_0x4d578b){for(var _0x42daa5=0x0,_0x1130fc=events[_0xd515('0x5')];_0x42daa5<_0x1130fc;_0x42daa5++){var _0x26a25d=events[_0x42daa5];var _0x2ec6e2=createListener('team:'+_0x26a25d,_0x4d578b);TeamEvents['on'](_0x26a25d,_0x2ec6e2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index af59d8b..df088e5 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 _0xae53=['INTEGER','sequelize','exports'];(function(_0x274d4b,_0x128681){var _0x1a1f03=function(_0x420675){while(--_0x420675){_0x274d4b['push'](_0x274d4b['shift']());}};_0x1a1f03(++_0x128681);}(_0xae53,0xf7));var _0x3ae5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xae53[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x3ae5('0x0'));module[_0x3ae5('0x1')]={'TeamId':{'type':Sequelize[_0x3ae5('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3ae5('0x2')]}}; \ No newline at end of file +var _0xf822=['sequelize','INTEGER'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xf822,0x19e));var _0x2f82=function(_0x5b781e,_0x1ee368){_0x5b781e=_0x5b781e-0x0;var _0x2c5486=_0xf822[_0x5b781e];return _0x2c5486;};'use strict';var Sequelize=require(_0x2f82('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x2f82('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x2f82('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index f54c985..a39d43d 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 _0xd403=['team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd403,0x1d5));var _0x3d40=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd403[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var logger=require(_0x3d40('0x2'))(_0x3d40('0x3'));var moment=require('moment');var BPromise=require(_0x3d40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d40('0x5'));var rimraf=require(_0x3d40('0x6'));var config=require(_0x3d40('0x7'));var attributes=require(_0x3d40('0x8'));module[_0x3d40('0x9')]=function(_0xcb5864,_0x113817){return _0xcb5864[_0x3d40('0xa')](_0x3d40('0xb'),attributes,{'tableName':_0x3d40('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6b8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','team_has_voice_prefixes','util'];(function(_0x3c8a07,_0x12e015){var _0x204817=function(_0x255b36){while(--_0x255b36){_0x3c8a07['push'](_0x3c8a07['shift']());}};_0x204817(++_0x12e015);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x2cdf2a,_0x1f7d76){_0x2cdf2a=_0x2cdf2a-0x0;var _0x1c9020=_0xb6b8[_0x2cdf2a];return _0x1c9020;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));var logger=require(_0x8b6b('0x1'))(_0x8b6b('0x2'));var moment=require(_0x8b6b('0x3'));var BPromise=require(_0x8b6b('0x4'));var rp=require(_0x8b6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b6b('0x6'));var config=require(_0x8b6b('0x7'));var attributes=require(_0x8b6b('0x8'));module['exports']=function(_0x144451,_0x511688){return _0x144451['define'](_0x8b6b('0x9'),attributes,{'tableName':_0x8b6b('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 bc0713a..4bc8103 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2e1ff5,_0x210b04){var _0x6e071e=function(_0x2bfa0c){while(--_0x2bfa0c){_0x2e1ff5['push'](_0x2e1ff5['shift']());}};_0x6e071e(++_0x210b04);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d41fc,_0x58b122){var _0x51473d=function(_0x12a127){while(--_0x12a127){_0x2d41fc['push'](_0x2d41fc['shift']());}};_0x51473d(++_0x58b122);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d95ac37..82d7811 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 _0x29f9=['INTEGER'];(function(_0x602353,_0x2f3fdb){var _0x27db84=function(_0x3cff1d){while(--_0x3cff1d){_0x602353['push'](_0x602353['shift']());}};_0x27db84(++_0x2f3fdb);}(_0x29f9,0x1e2));var _0x929f=function(_0x40ad8d,_0x29cb70){_0x40ad8d=_0x40ad8d-0x0;var _0x16e9bf=_0x29f9[_0x40ad8d];return _0x16e9bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x929f('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe1e6=['sequelize'];(function(_0x3429ac,_0x521ed4){var _0x45aecf=function(_0x435a9e){while(--_0x435a9e){_0x3429ac['push'](_0x3429ac['shift']());}};_0x45aecf(++_0x521ed4);}(_0xe1e6,0x196));var _0x6e1e=function(_0x2e0bad,_0x4da4a8){_0x2e0bad=_0x2e0bad-0x0;var _0x5a9223=_0xe1e6[_0x2e0bad];return _0x5a9223;};'use strict';var Sequelize=require(_0x6e1e('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index b97dd03..8b673c8 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 _0x14ee=['team_has_voice_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x2f86e2,_0x49a64b){var _0x42cf0b=function(_0x18bef3){while(--_0x18bef3){_0x2f86e2['push'](_0x2f86e2['shift']());}};_0x42cf0b(++_0x49a64b);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe14e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe14e('0x1'));var moment=require(_0xe14e('0x2'));var BPromise=require(_0xe14e('0x3'));var rp=require(_0xe14e('0x4'));var fs=require('fs');var path=require(_0xe14e('0x5'));var rimraf=require(_0xe14e('0x6'));var config=require(_0xe14e('0x7'));var attributes=require(_0xe14e('0x8'));module['exports']=function(_0x55d396,_0x4c78d1){return _0x55d396[_0xe14e('0x9')](_0xe14e('0xa'),attributes,{'tableName':_0xe14e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d5b=['moment','request-promise','path','rimraf','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x5f3259,_0x271818){var _0x816d85=function(_0x1e1915){while(--_0x1e1915){_0x5f3259['push'](_0x5f3259['shift']());}};_0x816d85(++_0x271818);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x14996c,_0x2b7f03){_0x14996c=_0x14996c-0x0;var _0x525cf0=_0x1d5b[_0x14996c];return _0x525cf0;};'use strict';var _=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))('api');var moment=require(_0xb1d5('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1d5('0x4'));var fs=require('fs');var path=require(_0xb1d5('0x5'));var rimraf=require(_0xb1d5('0x6'));var config=require(_0xb1d5('0x7'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1413e8,_0x131721){return _0x1413e8[_0xb1d5('0x8')](_0xb1d5('0x9'),attributes,{'tableName':_0xb1d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index c985fd7..1a0958c 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 _0x209f=['client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2d39e3,_0x27dc8c){var _0x31d9c1=function(_0x3663a0){while(--_0x3663a0){_0x2d39e3['push'](_0x2d39e3['shift']());}};_0x31d9c1(++_0x27dc8c);}(_0x209f,0x199));var _0xf209=function(_0xc84a00,_0x19ef02){_0xc84a00=_0xc84a00-0x0;var _0x1453cc=_0x209f[_0xc84a00];return _0x1453cc;};'use strict';var _=require(_0xf209('0x0'));var util=require('util');var moment=require(_0xf209('0x1'));var BPromise=require(_0xf209('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf209('0x3'));var db=require(_0xf209('0x4'))['db'];var utils=require(_0xf209('0x5'));var logger=require('../../config/logger')(_0xf209('0x6'));var config=require(_0xf209('0x7'));var jayson=require(_0xf209('0x8'));var client=jayson[_0xf209('0x9')][_0xf209('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba6df,_0x10f615,_0x644a7b){return new BPromise(function(_0x453721,_0x113d68){return client[_0xf209('0xb')](_0x5ba6df,_0x644a7b)[_0xf209('0xc')](function(_0x5614a8){logger[_0xf209('0xd')](_0xf209('0xe'),_0x10f615,_0xf209('0xf'));logger[_0xf209('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x10f615,_0xf209('0xf'),JSON[_0xf209('0x11')](_0x5614a8));if(_0x5614a8[_0xf209('0x12')]){if(_0x5614a8[_0xf209('0x12')][_0xf209('0x13')]===0x1f4){logger[_0xf209('0x12')](_0xf209('0xe'),_0x10f615,_0x5614a8['error']['message']);return _0x113d68(_0x5614a8['error'][_0xf209('0x14')]);}logger[_0xf209('0x12')](_0xf209('0xe'),_0x10f615,_0x5614a8['error'][_0xf209('0x14')]);return _0x453721(_0x5614a8[_0xf209('0x12')][_0xf209('0x14')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x10f615,_0xf209('0xf'));_0x453721(_0x5614a8['result'][_0xf209('0x14')]);}})[_0xf209('0x15')](function(_0x47bdfb){logger['error'](_0xf209('0xe'),_0x10f615,_0x47bdfb);_0x113d68(_0x47bdfb);});});} \ No newline at end of file +var _0xfc0b=['../../config/environment','jayson/promise','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x530c98,_0x361d68){var _0x3152b6=function(_0x42b3cc){while(--_0x42b3cc){_0x530c98['push'](_0x530c98['shift']());}};_0x3152b6(++_0x361d68);}(_0xfc0b,0x189));var _0xbfc0=function(_0x45578e,_0x4a9341){_0x45578e=_0x45578e-0x0;var _0x125890=_0xfc0b[_0x45578e];return _0x125890;};'use strict';var _=require('lodash');var util=require(_0xbfc0('0x0'));var moment=require(_0xbfc0('0x1'));var BPromise=require(_0xbfc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfc0('0x3'))['db'];var utils=require(_0xbfc0('0x4'));var logger=require('../../config/logger')(_0xbfc0('0x5'));var config=require(_0xbfc0('0x6'));var jayson=require(_0xbfc0('0x7'));var client=jayson[_0xbfc0('0x8')][_0xbfc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x244a92,_0x71ca38,_0x3df8a6){return new BPromise(function(_0x165a45,_0x38f037){return client[_0xbfc0('0xa')](_0x244a92,_0x3df8a6)['then'](function(_0x4443c3){logger[_0xbfc0('0xb')](_0xbfc0('0xc'),_0x71ca38,_0xbfc0('0xd'));logger[_0xbfc0('0xe')](_0xbfc0('0xf'),_0x71ca38,_0xbfc0('0xd'),JSON['stringify'](_0x4443c3));if(_0x4443c3[_0xbfc0('0x10')]){if(_0x4443c3['error'][_0xbfc0('0x11')]===0x1f4){logger['error'](_0xbfc0('0xc'),_0x71ca38,_0x4443c3['error'][_0xbfc0('0x12')]);return _0x38f037(_0x4443c3['error'][_0xbfc0('0x12')]);}logger[_0xbfc0('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x71ca38,_0x4443c3[_0xbfc0('0x10')][_0xbfc0('0x12')]);return _0x165a45(_0x4443c3[_0xbfc0('0x10')][_0xbfc0('0x12')]);}else{logger[_0xbfc0('0xb')](_0xbfc0('0xc'),_0x71ca38,_0xbfc0('0xd'));_0x165a45(_0x4443c3[_0xbfc0('0x13')][_0xbfc0('0x12')]);}})[_0xbfc0('0x14')](function(_0x5e1e54){logger[_0xbfc0('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x71ca38,_0x5e1e54);_0x38f037(_0x5e1e54);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 312b62f..50f26c9 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 _0x82f8=['get','/:id','isAuthenticated','show','put','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x2f624a,_0x186113){var _0x3037b3=function(_0x3ddca8){while(--_0x3ddca8){_0x2f624a['push'](_0x2f624a['shift']());}};_0x3037b3(++_0x186113);}(_0x82f8,0x157));var _0x882f=function(_0x4b9719,_0x118f24){_0x4b9719=_0x4b9719-0x0;var _0x4ae7c0=_0x82f8[_0x4b9719];return _0x4ae7c0;};'use strict';var multer=require('multer');var util=require(_0x882f('0x0'));var path=require(_0x882f('0x1'));var timeout=require('connect-timeout');var express=require(_0x882f('0x2'));var router=express[_0x882f('0x3')]();var fs_extra=require(_0x882f('0x4'));var auth=require(_0x882f('0x5'));var interaction=require(_0x882f('0x6'));var config=require(_0x882f('0x7'));var controller=require(_0x882f('0x8'));router[_0x882f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x882f('0x9')](_0x882f('0xa'),auth[_0x882f('0xb')](),controller[_0x882f('0xc')]);router['post']('/',auth[_0x882f('0xb')](),controller['create']);router[_0x882f('0xd')]('/:id',auth[_0x882f('0xb')](),controller['update']);router['delete'](_0x882f('0xa'),auth[_0x882f('0xb')](),controller[_0x882f('0xe')]);module[_0x882f('0xf')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./template.controller'];(function(_0x546a74,_0x417150){var _0x47086e=function(_0x1ed41b){while(--_0x1ed41b){_0x546a74['push'](_0x546a74['shift']());}};_0x47086e(++_0x417150);}(_0x14a0,0x8e));var _0x014a=function(_0x4bef2b,_0x453cfd){_0x4bef2b=_0x4bef2b-0x0;var _0x42584f=_0x14a0[_0x4bef2b];return _0x42584f;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index e5eb25f..6ff1628 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 _0xfa98=['TEXT','sequelize','STRING'];(function(_0x1b3693,_0x558453){var _0x13efb2=function(_0x12d537){while(--_0x12d537){_0x1b3693['push'](_0x1b3693['shift']());}};_0x13efb2(++_0x558453);}(_0xfa98,0x6a));var _0x8fa9=function(_0x367a85,_0xfe4400){_0x367a85=_0x367a85-0x0;var _0x3283f0=_0xfa98[_0x367a85];return _0x3283f0;};'use strict';var Sequelize=require(_0x8fa9('0x0'));module['exports']={'name':{'type':Sequelize[_0x8fa9('0x1')]},'description':{'type':Sequelize[_0x8fa9('0x1')]},'html':{'type':Sequelize[_0x8fa9('0x2')]}}; \ No newline at end of file +var _0x48b7=['TEXT','sequelize','STRING'];(function(_0x5571ce,_0x3c61bc){var _0x1bdf74=function(_0xfd5ca3){while(--_0xfd5ca3){_0x5571ce['push'](_0x5571ce['shift']());}};_0x1bdf74(++_0x3c61bc);}(_0x48b7,0xe8));var _0x748b=function(_0x2665a3,_0x1bd09e){_0x2665a3=_0x2665a3-0x0;var _0x4f8fb0=_0x48b7[_0x2665a3];return _0x4f8fb0;};'use strict';var Sequelize=require(_0x748b('0x0'));module['exports']={'name':{'type':Sequelize[_0x748b('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x748b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index bbb5d61..c40167c 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 _0x4444=['fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Templates','sendStatus','error','stack','name','index','map','Template','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x4444,0x1d3));var _0x4444=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x4444[_0x1a809b];return _0x5d90e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4444('0x0'));var jsonpatch=require(_0x4444('0x1'));var rp=require(_0x4444('0x2'));var moment=require('moment');var BPromise=require(_0x4444('0x3'));var Mustache=require(_0x4444('0x4'));var util=require(_0x4444('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4444('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4444('0x7'));var _=require(_0x4444('0x8'));var squel=require(_0x4444('0x9'));var crypto=require(_0x4444('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4444('0x6'));var querystring=require(_0x4444('0xb'));var Papa=require('papaparse');var Redis=require(_0x4444('0xc'));var authService=require(_0x4444('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4444('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4444('0xf'));var utils=require('../../config/utils');var config=require(_0x4444('0x10'));var licenseUtil=require(_0x4444('0x11'));var db=require(_0x4444('0x12'))['db'];function respondWithStatusCode(_0x5232a1,_0xfe300e){_0xfe300e=_0xfe300e||0xcc;return function(_0x36bb10){if(_0x36bb10){return _0x5232a1['sendStatus'](_0xfe300e);}return _0x5232a1[_0x4444('0x13')](_0xfe300e)[_0x4444('0x14')]();};}function respondWithResult(_0x4d0f9,_0x46661b){_0x46661b=_0x46661b||0xc8;return function(_0x5031a9){if(_0x5031a9){return _0x4d0f9['status'](_0x46661b)[_0x4444('0x15')](_0x5031a9);}};}function respondWithFilteredResult(_0x294427,_0x387e1d){return function(_0x80d6e6){if(_0x80d6e6){var _0x3508a9=typeof _0x387e1d['offset']===_0x4444('0x16')&&typeof _0x387e1d[_0x4444('0x17')]===_0x4444('0x16');var _0x465db8=_0x80d6e6[_0x4444('0x18')];var _0x163f7c=_0x3508a9?0x0:_0x387e1d['offset'];var _0x3bc7ec=_0x3508a9?_0x80d6e6[_0x4444('0x18')]:_0x387e1d['offset']+_0x387e1d['limit'];var _0x2fe6f7;if(_0x3bc7ec>=_0x465db8){_0x3bc7ec=_0x465db8;_0x2fe6f7=0xc8;}else{_0x2fe6f7=0xce;}_0x294427[_0x4444('0x13')](_0x2fe6f7);return _0x294427[_0x4444('0x19')](_0x4444('0x1a'),_0x163f7c+'-'+_0x3bc7ec+'/'+_0x465db8)['json'](_0x80d6e6);}return null;};}function patchUpdates(_0x2c16de){return function(_0x482435){try{jsonpatch[_0x4444('0x1b')](_0x482435,_0x2c16de,!![]);}catch(_0x34b5b9){return BPromise[_0x4444('0x1c')](_0x34b5b9);}return _0x482435['save']();};}function saveUpdates(_0x35060c,_0x586b82){return function(_0x4ebd24){if(_0x4ebd24){return _0x4ebd24['update'](_0x35060c)[_0x4444('0x1d')](function(_0x2c79d7){return _0x2c79d7;});}return null;};}function removeEntity(_0x254a2a,_0x5ae730){return function(_0x314c4e){if(_0x314c4e){return _0x314c4e[_0x4444('0x1e')]()[_0x4444('0x1d')](function(){var _0x3a17fe=_0x314c4e[_0x4444('0x1f')]({'plain':!![]});var _0x525fe5=_0x4444('0x20');return db['UserProfileResource'][_0x4444('0x1e')]({'where':{'type':_0x525fe5,'resourceId':_0x3a17fe['id']}})[_0x4444('0x1d')](function(){return _0x314c4e;});})[_0x4444('0x1d')](function(){_0x254a2a[_0x4444('0x13')](0xcc)[_0x4444('0x14')]();});}};}function handleEntityNotFound(_0x4b3ee4,_0x19a9de){return function(_0x22a64b){if(!_0x22a64b){_0x4b3ee4[_0x4444('0x21')](0x194);}return _0x22a64b;};}function handleError(_0x1f0908,_0x3c4b1a){_0x3c4b1a=_0x3c4b1a||0x1f4;return function(_0x2d0996){logger[_0x4444('0x22')](_0x2d0996[_0x4444('0x23')]);if(_0x2d0996[_0x4444('0x24')]){delete _0x2d0996[_0x4444('0x24')];}_0x1f0908[_0x4444('0x13')](_0x3c4b1a)['send'](_0x2d0996);};}exports[_0x4444('0x25')]=function(_0x32d49c,_0x1c0178){var _0x1880d8={},_0x1069a5={},_0x487760={'count':0x0,'rows':[]};var _0x2fb0a4=_[_0x4444('0x26')](db[_0x4444('0x27')]['rawAttributes'],function(_0x5152d6){return{'name':_0x5152d6[_0x4444('0x28')],'type':_0x5152d6[_0x4444('0x29')][_0x4444('0x2a')]};});_0x1069a5[_0x4444('0x2b')]=_[_0x4444('0x26')](_0x2fb0a4,_0x4444('0x24'));_0x1069a5[_0x4444('0x2c')]=_[_0x4444('0x2d')](_0x32d49c[_0x4444('0x2c')]);_0x1069a5['filters']=_[_0x4444('0x2e')](_0x1069a5[_0x4444('0x2b')],_0x1069a5['query']);_0x1880d8[_0x4444('0x2f')]=_[_0x4444('0x2e')](_0x1069a5[_0x4444('0x2b')],qs[_0x4444('0x30')](_0x32d49c[_0x4444('0x2c')][_0x4444('0x30')]));_0x1880d8[_0x4444('0x2f')]=_0x1880d8[_0x4444('0x2f')]['length']?_0x1880d8[_0x4444('0x2f')]:_0x1069a5[_0x4444('0x2b')];if(!_0x32d49c[_0x4444('0x2c')][_0x4444('0x31')](_0x4444('0x32'))){_0x1880d8[_0x4444('0x17')]=qs[_0x4444('0x17')](_0x32d49c[_0x4444('0x2c')][_0x4444('0x17')]);_0x1880d8[_0x4444('0x33')]=qs[_0x4444('0x33')](_0x32d49c[_0x4444('0x2c')][_0x4444('0x33')]);}_0x1880d8['order']=qs[_0x4444('0x34')](_0x32d49c['query'][_0x4444('0x34')]);_0x1880d8[_0x4444('0x35')]=qs[_0x4444('0x36')](_[_0x4444('0x37')](_0x32d49c[_0x4444('0x2c')],_0x1069a5[_0x4444('0x36')]),_0x2fb0a4);if(_0x32d49c[_0x4444('0x2c')]['filter']){_0x1880d8[_0x4444('0x35')]=_[_0x4444('0x38')](_0x1880d8[_0x4444('0x35')],{'$or':_[_0x4444('0x26')](_0x2fb0a4,function(_0x29b516){if(_0x29b516[_0x4444('0x29')]!==_0x4444('0x39')){var _0x47efb7={};_0x47efb7[_0x29b516[_0x4444('0x24')]]={'$like':'%'+_0x32d49c['query'][_0x4444('0x3a')]+'%'};return _0x47efb7;}})});}_0x1880d8=_[_0x4444('0x38')]({},_0x1880d8,_0x32d49c[_0x4444('0x3b')]);var _0x8b86a9={'where':_0x1880d8[_0x4444('0x35')]};return db['Template']['count'](_0x8b86a9)['then'](function(_0xcfb98f){_0x487760[_0x4444('0x18')]=_0xcfb98f;if(_0x32d49c[_0x4444('0x2c')]['includeAll']){_0x1880d8[_0x4444('0x3c')]=[{'all':!![]}];}return db[_0x4444('0x27')][_0x4444('0x3d')](_0x1880d8);})[_0x4444('0x1d')](function(_0x720dd){_0x487760[_0x4444('0x3e')]=_0x720dd;return _0x487760;})[_0x4444('0x1d')](respondWithFilteredResult(_0x1c0178,_0x1880d8))[_0x4444('0x3f')](handleError(_0x1c0178,null));};exports[_0x4444('0x40')]=function(_0xafbc3,_0x13817e){var _0x2da445={'raw':!![],'where':{'id':_0xafbc3[_0x4444('0x41')]['id']}},_0x374c7a={};_0x374c7a['model']=_[_0x4444('0x2d')](db[_0x4444('0x27')][_0x4444('0x42')]);_0x374c7a['query']=_['keys'](_0xafbc3[_0x4444('0x2c')]);_0x374c7a[_0x4444('0x36')]=_[_0x4444('0x2e')](_0x374c7a[_0x4444('0x2b')],_0x374c7a[_0x4444('0x2c')]);_0x2da445[_0x4444('0x2f')]=_[_0x4444('0x2e')](_0x374c7a[_0x4444('0x2b')],qs[_0x4444('0x30')](_0xafbc3[_0x4444('0x2c')]['fields']));_0x2da445[_0x4444('0x2f')]=_0x2da445[_0x4444('0x2f')][_0x4444('0x43')]?_0x2da445[_0x4444('0x2f')]:_0x374c7a[_0x4444('0x2b')];if(_0xafbc3[_0x4444('0x2c')][_0x4444('0x44')]){_0x2da445[_0x4444('0x3c')]=[{'all':!![]}];}_0x2da445=_[_0x4444('0x38')]({},_0x2da445,_0xafbc3['options']);return db[_0x4444('0x27')][_0x4444('0x45')](_0x2da445)[_0x4444('0x1d')](handleEntityNotFound(_0x13817e,null))[_0x4444('0x1d')](respondWithResult(_0x13817e,null))[_0x4444('0x3f')](handleError(_0x13817e,null));};exports[_0x4444('0x46')]=function(_0x552b91,_0x491f07){return db['Template'][_0x4444('0x46')](_0x552b91[_0x4444('0x47')],{})[_0x4444('0x1d')](function(_0x2c057a){var _0xa7dde7=_0x552b91[_0x4444('0x48')][_0x4444('0x1f')]({'plain':!![]});if(!_0xa7dde7)throw new Error(_0x4444('0x49'));if(_0xa7dde7['role']===_0x4444('0x48')){var _0x46570a=_0x2c057a[_0x4444('0x1f')]({'plain':!![]});var _0x24a1ad='Templates';return db[_0x4444('0x4a')][_0x4444('0x45')]({'where':{'name':_0x24a1ad,'userProfileId':_0xa7dde7[_0x4444('0x4b')]},'raw':!![]})[_0x4444('0x1d')](function(_0x2fcde1){if(_0x2fcde1&&_0x2fcde1[_0x4444('0x4c')]===0x0){return db[_0x4444('0x4d')][_0x4444('0x46')]({'name':_0x46570a[_0x4444('0x24')],'resourceId':_0x46570a['id'],'type':_0x2fcde1[_0x4444('0x24')],'sectionId':_0x2fcde1['id']},{})['then'](function(){return _0x2c057a;});}else{return _0x2c057a;}})[_0x4444('0x3f')](function(_0x4ffd44){logger[_0x4444('0x22')](_0x4444('0x4e'),_0x4ffd44);throw _0x4ffd44;});}return _0x2c057a;})[_0x4444('0x1d')](respondWithResult(_0x491f07,0xc9))[_0x4444('0x3f')](handleError(_0x491f07,null));};exports['update']=function(_0x128dbc,_0xf1c554){if(_0x128dbc[_0x4444('0x47')]['id']){delete _0x128dbc[_0x4444('0x47')]['id'];}return db[_0x4444('0x27')][_0x4444('0x45')]({'where':{'id':_0x128dbc[_0x4444('0x41')]['id']}})[_0x4444('0x1d')](handleEntityNotFound(_0xf1c554,null))['then'](saveUpdates(_0x128dbc[_0x4444('0x47')],null))['then'](respondWithResult(_0xf1c554,null))['catch'](handleError(_0xf1c554,null));};exports[_0x4444('0x1e')]=function(_0x2776af,_0xbd08a){return db[_0x4444('0x27')][_0x4444('0x45')]({'where':{'id':_0x2776af['params']['id']}})[_0x4444('0x1d')](handleEntityNotFound(_0xbd08a,null))[_0x4444('0x1d')](removeEntity(_0xbd08a,null))[_0x4444('0x3f')](handleError(_0xbd08a,null));}; \ No newline at end of file +var _0x711d=['squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','Templates','UserProfileResource','error','stack','name','Template','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x711d,0x1d9));var _0xd711=function(_0x4a8be9,_0x37bc42){_0x4a8be9=_0x4a8be9-0x0;var _0x665e92=_0x711d[_0x4a8be9];return _0x665e92;};'use strict';var emlformat=require(_0xd711('0x0'));var rimraf=require(_0xd711('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd711('0x2'));var rp=require(_0xd711('0x3'));var moment=require(_0xd711('0x4'));var BPromise=require(_0xd711('0x5'));var Mustache=require(_0xd711('0x6'));var util=require('util');var path=require(_0xd711('0x7'));var sox=require(_0xd711('0x8'));var csv=require(_0xd711('0x9'));var ejs=require(_0xd711('0xa'));var fs=require('fs');var fs_extra=require(_0xd711('0xb'));var _=require(_0xd711('0xc'));var squel=require(_0xd711('0xd'));var crypto=require(_0xd711('0xe'));var jsforce=require(_0xd711('0xf'));var deskjs=require(_0xd711('0x10'));var toCsv=require(_0xd711('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd711('0x11'));var authService=require(_0xd711('0x12'));var qs=require(_0xd711('0x13'));var as=require(_0xd711('0x14'));var hardwareService=require(_0xd711('0x15'));var logger=require(_0xd711('0x16'))('api');var utils=require(_0xd711('0x17'));var config=require(_0xd711('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd711('0x19'))['db'];function respondWithStatusCode(_0x887dfa,_0x4285f6){_0x4285f6=_0x4285f6||0xcc;return function(_0x4bde9e){if(_0x4bde9e){return _0x887dfa[_0xd711('0x1a')](_0x4285f6);}return _0x887dfa[_0xd711('0x1b')](_0x4285f6)[_0xd711('0x1c')]();};}function respondWithResult(_0x108786,_0x45dac9){_0x45dac9=_0x45dac9||0xc8;return function(_0x465733){if(_0x465733){return _0x108786[_0xd711('0x1b')](_0x45dac9)['json'](_0x465733);}};}function respondWithFilteredResult(_0x2a3a77,_0x371ef7){return function(_0x74a250){if(_0x74a250){var _0x3ce2e1=typeof _0x371ef7[_0xd711('0x1d')]===_0xd711('0x1e')&&typeof _0x371ef7['limit']===_0xd711('0x1e');var _0xbbe8e1=_0x74a250[_0xd711('0x1f')];var _0x24503c=_0x3ce2e1?0x0:_0x371ef7[_0xd711('0x1d')];var _0xa8fa41=_0x3ce2e1?_0x74a250[_0xd711('0x1f')]:_0x371ef7[_0xd711('0x1d')]+_0x371ef7[_0xd711('0x20')];var _0x2a5564;if(_0xa8fa41>=_0xbbe8e1){_0xa8fa41=_0xbbe8e1;_0x2a5564=0xc8;}else{_0x2a5564=0xce;}_0x2a3a77[_0xd711('0x1b')](_0x2a5564);return _0x2a3a77[_0xd711('0x21')](_0xd711('0x22'),_0x24503c+'-'+_0xa8fa41+'/'+_0xbbe8e1)[_0xd711('0x23')](_0x74a250);}return null;};}function patchUpdates(_0x2be225){return function(_0xf4f97f){try{jsonpatch[_0xd711('0x24')](_0xf4f97f,_0x2be225,!![]);}catch(_0x4edc6e){return BPromise['reject'](_0x4edc6e);}return _0xf4f97f['save']();};}function saveUpdates(_0x4fc704,_0x36e71e){return function(_0x3cddca){if(_0x3cddca){return _0x3cddca[_0xd711('0x25')](_0x4fc704)[_0xd711('0x26')](function(_0x4a003b){return _0x4a003b;});}return null;};}function removeEntity(_0xd03a31,_0x3a5d6e){return function(_0x1f47db){if(_0x1f47db){return _0x1f47db[_0xd711('0x27')]()['then'](function(){var _0x288813=_0x1f47db['get']({'plain':!![]});var _0x7dc8df=_0xd711('0x28');return db[_0xd711('0x29')][_0xd711('0x27')]({'where':{'type':_0x7dc8df,'resourceId':_0x288813['id']}})[_0xd711('0x26')](function(){return _0x1f47db;});})[_0xd711('0x26')](function(){_0xd03a31[_0xd711('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f7c47,_0x44a152){return function(_0x2fff75){if(!_0x2fff75){_0x4f7c47['sendStatus'](0x194);}return _0x2fff75;};}function handleError(_0x46d015,_0x4235fb){_0x4235fb=_0x4235fb||0x1f4;return function(_0x19d89e){logger[_0xd711('0x2a')](_0x19d89e[_0xd711('0x2b')]);if(_0x19d89e['name']){delete _0x19d89e[_0xd711('0x2c')];}_0x46d015[_0xd711('0x1b')](_0x4235fb)['send'](_0x19d89e);};}exports['index']=function(_0x295b63,_0x15b1a9){var _0x5beff7={},_0x21ade8={},_0x5345bd={'count':0x0,'rows':[]};var _0x4c8697=_['map'](db[_0xd711('0x2d')][_0xd711('0x2e')],function(_0x36f78b){return{'name':_0x36f78b['fieldName'],'type':_0x36f78b[_0xd711('0x2f')][_0xd711('0x30')]};});_0x21ade8[_0xd711('0x31')]=_[_0xd711('0x32')](_0x4c8697,_0xd711('0x2c'));_0x21ade8['query']=_['keys'](_0x295b63[_0xd711('0x33')]);_0x21ade8[_0xd711('0x34')]=_[_0xd711('0x35')](_0x21ade8['model'],_0x21ade8[_0xd711('0x33')]);_0x5beff7[_0xd711('0x36')]=_[_0xd711('0x35')](_0x21ade8[_0xd711('0x31')],qs[_0xd711('0x37')](_0x295b63[_0xd711('0x33')][_0xd711('0x37')]));_0x5beff7[_0xd711('0x36')]=_0x5beff7[_0xd711('0x36')][_0xd711('0x38')]?_0x5beff7[_0xd711('0x36')]:_0x21ade8[_0xd711('0x31')];if(!_0x295b63[_0xd711('0x33')][_0xd711('0x39')](_0xd711('0x3a'))){_0x5beff7[_0xd711('0x20')]=qs['limit'](_0x295b63['query'][_0xd711('0x20')]);_0x5beff7['offset']=qs[_0xd711('0x1d')](_0x295b63['query'][_0xd711('0x1d')]);}_0x5beff7['order']=qs[_0xd711('0x3b')](_0x295b63['query'][_0xd711('0x3b')]);_0x5beff7[_0xd711('0x3c')]=qs['filters'](_[_0xd711('0x3d')](_0x295b63[_0xd711('0x33')],_0x21ade8[_0xd711('0x34')]),_0x4c8697);if(_0x295b63[_0xd711('0x33')][_0xd711('0x3e')]){_0x5beff7[_0xd711('0x3c')]=_[_0xd711('0x3f')](_0x5beff7[_0xd711('0x3c')],{'$or':_['map'](_0x4c8697,function(_0x2811bf){if(_0x2811bf[_0xd711('0x2f')]!==_0xd711('0x40')){var _0x347055={};_0x347055[_0x2811bf[_0xd711('0x2c')]]={'$like':'%'+_0x295b63[_0xd711('0x33')][_0xd711('0x3e')]+'%'};return _0x347055;}})});}_0x5beff7=_['merge']({},_0x5beff7,_0x295b63[_0xd711('0x41')]);var _0x2cf06f={'where':_0x5beff7[_0xd711('0x3c')]};return db[_0xd711('0x2d')][_0xd711('0x1f')](_0x2cf06f)[_0xd711('0x26')](function(_0x4a0d78){_0x5345bd['count']=_0x4a0d78;if(_0x295b63[_0xd711('0x33')][_0xd711('0x42')]){_0x5beff7[_0xd711('0x43')]=[{'all':!![]}];}return db[_0xd711('0x2d')]['findAll'](_0x5beff7);})[_0xd711('0x26')](function(_0x340faf){_0x5345bd[_0xd711('0x44')]=_0x340faf;return _0x5345bd;})['then'](respondWithFilteredResult(_0x15b1a9,_0x5beff7))[_0xd711('0x45')](handleError(_0x15b1a9,null));};exports[_0xd711('0x46')]=function(_0x2cb1e6,_0x2be202){var _0x3d186c={'raw':!![],'where':{'id':_0x2cb1e6[_0xd711('0x47')]['id']}},_0x767975={};_0x767975[_0xd711('0x31')]=_[_0xd711('0x48')](db[_0xd711('0x2d')][_0xd711('0x2e')]);_0x767975[_0xd711('0x33')]=_[_0xd711('0x48')](_0x2cb1e6[_0xd711('0x33')]);_0x767975[_0xd711('0x34')]=_['intersection'](_0x767975[_0xd711('0x31')],_0x767975['query']);_0x3d186c[_0xd711('0x36')]=_[_0xd711('0x35')](_0x767975[_0xd711('0x31')],qs[_0xd711('0x37')](_0x2cb1e6[_0xd711('0x33')]['fields']));_0x3d186c['attributes']=_0x3d186c[_0xd711('0x36')][_0xd711('0x38')]?_0x3d186c['attributes']:_0x767975[_0xd711('0x31')];if(_0x2cb1e6['query'][_0xd711('0x42')]){_0x3d186c['include']=[{'all':!![]}];}_0x3d186c=_[_0xd711('0x3f')]({},_0x3d186c,_0x2cb1e6[_0xd711('0x41')]);return db[_0xd711('0x2d')][_0xd711('0x49')](_0x3d186c)[_0xd711('0x26')](handleEntityNotFound(_0x2be202,null))[_0xd711('0x26')](respondWithResult(_0x2be202,null))[_0xd711('0x45')](handleError(_0x2be202,null));};exports[_0xd711('0x4a')]=function(_0x5c739e,_0x4fd6d4){return db['Template']['create'](_0x5c739e[_0xd711('0x4b')],{})[_0xd711('0x26')](function(_0x3cb622){var _0x115508=_0x5c739e[_0xd711('0x4c')][_0xd711('0x4d')]({'plain':!![]});if(!_0x115508)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115508['role']==='user'){var _0x1f3362=_0x3cb622[_0xd711('0x4d')]({'plain':!![]});var _0x3c6c84=_0xd711('0x28');return db['UserProfileSection'][_0xd711('0x49')]({'where':{'name':_0x3c6c84,'userProfileId':_0x115508[_0xd711('0x4e')]},'raw':!![]})['then'](function(_0x3ec186){if(_0x3ec186&&_0x3ec186[_0xd711('0x4f')]===0x0){return db[_0xd711('0x29')][_0xd711('0x4a')]({'name':_0x1f3362[_0xd711('0x2c')],'resourceId':_0x1f3362['id'],'type':_0x3ec186[_0xd711('0x2c')],'sectionId':_0x3ec186['id']},{})['then'](function(){return _0x3cb622;});}else{return _0x3cb622;}})[_0xd711('0x45')](function(_0x34a5ea){logger[_0xd711('0x2a')](_0xd711('0x50'),_0x34a5ea);throw _0x34a5ea;});}return _0x3cb622;})[_0xd711('0x26')](respondWithResult(_0x4fd6d4,0xc9))[_0xd711('0x45')](handleError(_0x4fd6d4,null));};exports['update']=function(_0x527c44,_0xb7554d){if(_0x527c44['body']['id']){delete _0x527c44[_0xd711('0x4b')]['id'];}return db['Template'][_0xd711('0x49')]({'where':{'id':_0x527c44[_0xd711('0x47')]['id']}})[_0xd711('0x26')](handleEntityNotFound(_0xb7554d,null))[_0xd711('0x26')](saveUpdates(_0x527c44['body'],null))[_0xd711('0x26')](respondWithResult(_0xb7554d,null))[_0xd711('0x45')](handleError(_0xb7554d,null));};exports['destroy']=function(_0x54242a,_0x250f09){return db[_0xd711('0x2d')][_0xd711('0x49')]({'where':{'id':_0x54242a['params']['id']}})[_0xd711('0x26')](handleEntityNotFound(_0x250f09,null))[_0xd711('0x26')](removeEntity(_0x250f09,null))[_0xd711('0x45')](handleError(_0x250f09,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 1889924..88ac07f 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 _0xada3=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates'];(function(_0x54775e,_0x3d59fa){var _0x650778=function(_0x356373){while(--_0x356373){_0x54775e['push'](_0x54775e['shift']());}};_0x650778(++_0x3d59fa);}(_0xada3,0x150));var _0x3ada=function(_0x539ae2,_0x196218){_0x539ae2=_0x539ae2-0x0;var _0x37e0df=_0xada3[_0x539ae2];return _0x37e0df;};'use strict';var _=require(_0x3ada('0x0'));var util=require(_0x3ada('0x1'));var logger=require(_0x3ada('0x2'))(_0x3ada('0x3'));var moment=require(_0x3ada('0x4'));var BPromise=require('bluebird');var rp=require(_0x3ada('0x5'));var fs=require('fs');var path=require(_0x3ada('0x6'));var rimraf=require(_0x3ada('0x7'));var config=require(_0x3ada('0x8'));var attributes=require(_0x3ada('0x9'));module[_0x3ada('0xa')]=function(_0x3cf712,_0x3b867f){return _0x3cf712[_0x3ada('0xb')](_0x3ada('0xc'),attributes,{'tableName':_0x3ada('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ca=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4c0ef1,_0x4b819d){var _0x133477=function(_0x4f1962){while(--_0x4f1962){_0x4c0ef1['push'](_0x4c0ef1['shift']());}};_0x133477(++_0x4b819d);}(_0xe3ca,0xb1));var _0xae3c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xe3ca[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xae3c('0x0'));var util=require('util');var logger=require(_0xae3c('0x1'))(_0xae3c('0x2'));var moment=require(_0xae3c('0x3'));var BPromise=require(_0xae3c('0x4'));var rp=require(_0xae3c('0x5'));var fs=require('fs');var path=require(_0xae3c('0x6'));var rimraf=require(_0xae3c('0x7'));var config=require(_0xae3c('0x8'));var attributes=require(_0xae3c('0x9'));module[_0xae3c('0xa')]=function(_0x33baeb,_0x22577a){return _0x33baeb[_0xae3c('0xb')](_0xae3c('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ef863c1..bbea883 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 _0x786e=['debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Template','findAll','options','where','attributes','limit','include','model','map','GetTemplate'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x786e,0x1bc));var _0xe786=function(_0x22df4d,_0xa4790a){_0x22df4d=_0x22df4d-0x0;var _0x6a2020=_0x786e[_0x22df4d];return _0x6a2020;};'use strict';var _=require(_0xe786('0x0'));var util=require(_0xe786('0x1'));var moment=require('moment');var BPromise=require(_0xe786('0x2'));var rs=require(_0xe786('0x3'));var fs=require('fs');var Redis=require(_0xe786('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe786('0x5'));var logger=require(_0xe786('0x6'))('rpc');var config=require(_0xe786('0x7'));var jayson=require(_0xe786('0x8'));var client=jayson[_0xe786('0x9')][_0xe786('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6bd3f5,_0x38a76e,_0x2c5ebf){return new BPromise(function(_0x3178df,_0x10da6c){return client[_0xe786('0xb')](_0x6bd3f5,_0x2c5ebf)[_0xe786('0xc')](function(_0x2d65a3){logger[_0xe786('0xd')](_0xe786('0xe'),_0x38a76e,_0xe786('0xf'));logger['debug'](_0xe786('0x10'),_0x38a76e,_0xe786('0xf'),JSON['stringify'](_0x2d65a3));if(_0x2d65a3['error']){if(_0x2d65a3[_0xe786('0x11')][_0xe786('0x12')]===0x1f4){logger[_0xe786('0x11')](_0xe786('0xe'),_0x38a76e,_0x2d65a3[_0xe786('0x11')][_0xe786('0x13')]);return _0x10da6c(_0x2d65a3['error'][_0xe786('0x13')]);}logger['error'](_0xe786('0xe'),_0x38a76e,_0x2d65a3['error'][_0xe786('0x13')]);return _0x3178df(_0x2d65a3[_0xe786('0x11')][_0xe786('0x13')]);}else{logger[_0xe786('0xd')](_0xe786('0xe'),_0x38a76e,'request\x20sent');_0x3178df(_0x2d65a3[_0xe786('0x14')][_0xe786('0x13')]);}})[_0xe786('0x15')](function(_0x1b6cee){logger[_0xe786('0x11')](_0xe786('0xe'),_0x38a76e,_0x1b6cee);_0x10da6c(_0x1b6cee);});});}exports['GetTemplate']=function(_0x4bd473){var _0x27601a=this;return new Promise(function(_0x5aaeca,_0x148ebd){return db[_0xe786('0x16')][_0xe786('0x17')]({'raw':_0x4bd473[_0xe786('0x18')]?_0x4bd473[_0xe786('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4bd473[_0xe786('0x18')]?_0x4bd473[_0xe786('0x18')][_0xe786('0x19')]||null:null,'attributes':_0x4bd473[_0xe786('0x18')]?_0x4bd473[_0xe786('0x18')][_0xe786('0x1a')]||null:null,'limit':_0x4bd473[_0xe786('0x18')]?_0x4bd473[_0xe786('0x18')][_0xe786('0x1b')]||null:null,'include':_0x4bd473[_0xe786('0x18')]?_0x4bd473[_0xe786('0x18')]['include']?_['map'](_0x4bd473[_0xe786('0x18')][_0xe786('0x1c')],function(_0x3e30eb){return{'model':db[_0x3e30eb[_0xe786('0x1d')]],'as':_0x3e30eb['as'],'attributes':_0x3e30eb[_0xe786('0x1a')],'include':_0x3e30eb[_0xe786('0x1c')]?_[_0xe786('0x1e')](_0x3e30eb[_0xe786('0x1c')],function(_0x551468){return{'model':db[_0x551468[_0xe786('0x1d')]],'as':_0x551468['as'],'attributes':_0x551468[_0xe786('0x1a')],'include':_0x551468['include']?_[_0xe786('0x1e')](_0x551468['include'],function(_0x597b87){return{'model':db[_0x597b87[_0xe786('0x1d')]],'as':_0x597b87['as'],'attributes':_0x597b87[_0xe786('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe786('0xc')](function(_0x1dce9c){logger[_0xe786('0xd')](_0xe786('0x1f'),_0x4bd473);logger[_0xe786('0x20')](_0xe786('0x1f'),_0x4bd473,JSON[_0xe786('0x21')](_0x1dce9c));_0x5aaeca(_0x1dce9c);})[_0xe786('0x15')](function(_0x3c1e87){logger['error'](_0xe786('0x1f'),_0x3c1e87[_0xe786('0x13')],_0x4bd473);_0x148ebd(_0x27601a[_0xe786('0x11')](0x1f4,_0x3c1e87['message']));});});}; \ No newline at end of file +var _0x608b=['map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','where','attributes'];(function(_0x4516ac,_0x5006e2){var _0x303638=function(_0x5a6744){while(--_0x5a6744){_0x4516ac['push'](_0x4516ac['shift']());}};_0x303638(++_0x5006e2);}(_0x608b,0xa9));var _0xb608=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x608b[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0xb608('0x0'));var util=require(_0xb608('0x1'));var moment=require(_0xb608('0x2'));var BPromise=require(_0xb608('0x3'));var rs=require(_0xb608('0x4'));var fs=require('fs');var Redis=require(_0xb608('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb608('0x6'));var logger=require(_0xb608('0x7'))('rpc');var config=require(_0xb608('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb608('0x9')][_0xb608('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c235,_0x4c8264,_0x18b855){return new BPromise(function(_0x206c2b,_0x41ab0e){return client[_0xb608('0xb')](_0x29c235,_0x18b855)[_0xb608('0xc')](function(_0x3e1e35){logger[_0xb608('0xd')](_0xb608('0xe'),_0x4c8264,_0xb608('0xf'));logger['debug'](_0xb608('0x10'),_0x4c8264,_0xb608('0xf'),JSON[_0xb608('0x11')](_0x3e1e35));if(_0x3e1e35['error']){if(_0x3e1e35[_0xb608('0x12')][_0xb608('0x13')]===0x1f4){logger[_0xb608('0x12')](_0xb608('0xe'),_0x4c8264,_0x3e1e35[_0xb608('0x12')][_0xb608('0x14')]);return _0x41ab0e(_0x3e1e35['error'][_0xb608('0x14')]);}logger[_0xb608('0x12')]('Template,\x20%s,\x20%s',_0x4c8264,_0x3e1e35[_0xb608('0x12')][_0xb608('0x14')]);return _0x206c2b(_0x3e1e35[_0xb608('0x12')][_0xb608('0x14')]);}else{logger[_0xb608('0xd')](_0xb608('0xe'),_0x4c8264,_0xb608('0xf'));_0x206c2b(_0x3e1e35[_0xb608('0x15')]['message']);}})[_0xb608('0x16')](function(_0x40ac38){logger[_0xb608('0x12')](_0xb608('0xe'),_0x4c8264,_0x40ac38);_0x41ab0e(_0x40ac38);});});}exports[_0xb608('0x17')]=function(_0x58b8d7){var _0x8ef415=this;return new Promise(function(_0x966b16,_0x4ddd92){return db[_0xb608('0x18')]['findAll']({'raw':_0x58b8d7[_0xb608('0x19')]?_0x58b8d7[_0xb608('0x19')][_0xb608('0x1a')]===undefined?!![]:![]:!![],'where':_0x58b8d7[_0xb608('0x19')]?_0x58b8d7[_0xb608('0x19')][_0xb608('0x1b')]||null:null,'attributes':_0x58b8d7[_0xb608('0x19')]?_0x58b8d7[_0xb608('0x19')][_0xb608('0x1c')]||null:null,'limit':_0x58b8d7[_0xb608('0x19')]?_0x58b8d7['options']['limit']||null:null,'include':_0x58b8d7[_0xb608('0x19')]?_0x58b8d7[_0xb608('0x19')]['include']?_[_0xb608('0x1d')](_0x58b8d7[_0xb608('0x19')][_0xb608('0x1e')],function(_0x38d654){return{'model':db[_0x38d654['model']],'as':_0x38d654['as'],'attributes':_0x38d654[_0xb608('0x1c')],'include':_0x38d654['include']?_[_0xb608('0x1d')](_0x38d654[_0xb608('0x1e')],function(_0x56ea1){return{'model':db[_0x56ea1[_0xb608('0x1f')]],'as':_0x56ea1['as'],'attributes':_0x56ea1[_0xb608('0x1c')],'include':_0x56ea1[_0xb608('0x1e')]?_[_0xb608('0x1d')](_0x56ea1[_0xb608('0x1e')],function(_0x2bd3dc){return{'model':db[_0x2bd3dc['model']],'as':_0x2bd3dc['as'],'attributes':_0x2bd3dc[_0xb608('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb608('0xc')](function(_0x2cc59e){logger[_0xb608('0xd')]('GetTemplate',_0x58b8d7);logger[_0xb608('0x20')]('GetTemplate',_0x58b8d7,JSON[_0xb608('0x11')](_0x2cc59e));_0x966b16(_0x2cc59e);})[_0xb608('0x16')](function(_0x34f4d3){logger['error'](_0xb608('0x17'),_0x34f4d3[_0xb608('0x14')],_0x58b8d7);_0x4ddd92(_0x8ef415[_0xb608('0x12')](0x1f4,_0x34f4d3[_0xb608('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 542e525..d86f781 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 _0xcbde=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','/:id/actions','put','delete','destroy','util'];(function(_0x83d48e,_0x507328){var _0x26f1d1=function(_0x252172){while(--_0x252172){_0x83d48e['push'](_0x83d48e['shift']());}};_0x26f1d1(++_0x507328);}(_0xcbde,0x1df));var _0xecbd=function(_0x32ea65,_0x1e05e6){_0x32ea65=_0x32ea65-0x0;var _0x2e7671=_0xcbde[_0x32ea65];return _0x2e7671;};'use strict';var multer=require('multer');var util=require(_0xecbd('0x0'));var path=require(_0xecbd('0x1'));var timeout=require(_0xecbd('0x2'));var express=require('express');var router=express[_0xecbd('0x3')]();var fs_extra=require(_0xecbd('0x4'));var auth=require(_0xecbd('0x5'));var interaction=require(_0xecbd('0x6'));var config=require(_0xecbd('0x7'));var controller=require(_0xecbd('0x8'));router[_0xecbd('0x9')]('/',auth[_0xecbd('0xa')](),controller[_0xecbd('0xb')]);router['get'](_0xecbd('0xc'),auth['isAuthenticated'](),controller[_0xecbd('0xd')]);router[_0xecbd('0x9')](_0xecbd('0xe'),auth[_0xecbd('0xa')](),controller['getAllConditions']);router[_0xecbd('0x9')]('/:id/any_conditions',auth[_0xecbd('0xa')](),controller['getAnyConditions']);router['get']('/:id/actions',auth[_0xecbd('0xa')](),controller['getActions']);router[_0xecbd('0xf')]('/',auth['isAuthenticated'](),controller[_0xecbd('0x10')]);router[_0xecbd('0xf')](_0xecbd('0xe'),auth[_0xecbd('0xa')](),controller[_0xecbd('0x11')]);router['post'](_0xecbd('0x12'),auth[_0xecbd('0xa')](),controller[_0xecbd('0x13')]);router[_0xecbd('0xf')](_0xecbd('0x14'),auth[_0xecbd('0xa')](),controller['addAction']);router[_0xecbd('0x15')](_0xecbd('0xc'),auth[_0xecbd('0xa')](),controller['update']);router[_0xecbd('0x16')](_0xecbd('0xc'),auth[_0xecbd('0xa')](),controller[_0xecbd('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe533=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAction','put','delete','destroy'];(function(_0x38dbf6,_0x11ec2b){var _0x31e46d=function(_0x5c0a76){while(--_0x5c0a76){_0x38dbf6['push'](_0x38dbf6['shift']());}};_0x31e46d(++_0x11ec2b);}(_0xe533,0x181));var _0x3e53=function(_0x4f5878,_0xc8e419){_0x4f5878=_0x4f5878-0x0;var _0x111d2b=_0xe533[_0x4f5878];return _0x111d2b;};'use strict';var multer=require(_0x3e53('0x0'));var util=require(_0x3e53('0x1'));var path=require('path');var timeout=require(_0x3e53('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e53('0x3'));var auth=require(_0x3e53('0x4'));var interaction=require(_0x3e53('0x5'));var config=require(_0x3e53('0x6'));var controller=require('./trigger.controller');router[_0x3e53('0x7')]('/',auth[_0x3e53('0x8')](),controller['index']);router[_0x3e53('0x7')](_0x3e53('0x9'),auth[_0x3e53('0x8')](),controller[_0x3e53('0xa')]);router[_0x3e53('0x7')](_0x3e53('0xb'),auth[_0x3e53('0x8')](),controller[_0x3e53('0xc')]);router[_0x3e53('0x7')]('/:id/any_conditions',auth[_0x3e53('0x8')](),controller['getAnyConditions']);router[_0x3e53('0x7')](_0x3e53('0xd'),auth['isAuthenticated'](),controller[_0x3e53('0xe')]);router[_0x3e53('0xf')]('/',auth[_0x3e53('0x8')](),controller[_0x3e53('0x10')]);router[_0x3e53('0xf')](_0x3e53('0xb'),auth[_0x3e53('0x8')](),controller[_0x3e53('0x11')]);router[_0x3e53('0xf')](_0x3e53('0x12'),auth['isAuthenticated'](),controller['addAnyCondition']);router['post'](_0x3e53('0xd'),auth[_0x3e53('0x8')](),controller[_0x3e53('0x13')]);router[_0x3e53('0x14')](_0x3e53('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3e53('0x15')](_0x3e53('0x9'),auth['isAuthenticated'](),controller[_0x3e53('0x16')]);module[_0x3e53('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2e6f62f..6bd8a87 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 _0xc53e=['sequelize','STRING','BOOLEAN'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xc53e,0x183));var _0xec53=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xc53e[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xec53('0x0'));module['exports']={'name':{'type':Sequelize[_0xec53('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xec53('0x1')]},'status':{'type':Sequelize[_0xec53('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x80d0=['STRING','BOOLEAN','sequelize'];(function(_0xe4db28,_0x4b59c6){var _0x49a32f=function(_0x3b87ac){while(--_0x3b87ac){_0xe4db28['push'](_0xe4db28['shift']());}};_0x49a32f(++_0x4b59c6);}(_0x80d0,0x1b5));var _0x080d=function(_0x5905df,_0x4fc574){_0x5905df=_0x5905df-0x0;var _0x1878f7=_0x80d0[_0x5905df];return _0x1878f7;};'use strict';var Sequelize=require(_0x080d('0x0'));module['exports']={'name':{'type':Sequelize[_0x080d('0x1')]},'channel':{'type':Sequelize[_0x080d('0x1')]},'description':{'type':Sequelize[_0x080d('0x1')]},'status':{'type':Sequelize[_0x080d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 80eb790..2f90c7d 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 _0xe335=['apply','reject','save','then','destroy','Triggers','UserProfileResource','sendStatus','error','stack','name','send','index','Trigger','rawAttributes','type','key','model','map','keys','filters','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2d5e73,_0x2bf626){var _0x167840=function(_0x4cf816){while(--_0x4cf816){_0x2d5e73['push'](_0x2d5e73['shift']());}};_0x167840(++_0x2bf626);}(_0xe335,0x104));var _0x5e33=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe335[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x5e33('0x0'));var rimraf=require(_0x5e33('0x1'));var zipdir=require(_0x5e33('0x2'));var jsonpatch=require(_0x5e33('0x3'));var rp=require(_0x5e33('0x4'));var moment=require(_0x5e33('0x5'));var BPromise=require(_0x5e33('0x6'));var Mustache=require(_0x5e33('0x7'));var util=require(_0x5e33('0x8'));var path=require('path');var sox=require(_0x5e33('0x9'));var csv=require('to-csv');var ejs=require(_0x5e33('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e33('0xb'));var squel=require('squel');var crypto=require(_0x5e33('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e33('0xd'));var querystring=require('querystring');var Papa=require(_0x5e33('0xe'));var Redis=require(_0x5e33('0xf'));var authService=require(_0x5e33('0x10'));var qs=require(_0x5e33('0x11'));var as=require(_0x5e33('0x12'));var hardwareService=require(_0x5e33('0x13'));var logger=require(_0x5e33('0x14'))('api');var utils=require(_0x5e33('0x15'));var config=require(_0x5e33('0x16'));var licenseUtil=require(_0x5e33('0x17'));var db=require(_0x5e33('0x18'))['db'];function respondWithStatusCode(_0x45419a,_0x357495){_0x357495=_0x357495||0xcc;return function(_0x5de12b){if(_0x5de12b){return _0x45419a['sendStatus'](_0x357495);}return _0x45419a['status'](_0x357495)[_0x5e33('0x19')]();};}function respondWithResult(_0x480816,_0x54c056){_0x54c056=_0x54c056||0xc8;return function(_0x44c6e7){if(_0x44c6e7){return _0x480816[_0x5e33('0x1a')](_0x54c056)[_0x5e33('0x1b')](_0x44c6e7);}};}function respondWithFilteredResult(_0x251869,_0x4d02be){return function(_0x440fd1){if(_0x440fd1){var _0x3af66=typeof _0x4d02be[_0x5e33('0x1c')]===_0x5e33('0x1d')&&typeof _0x4d02be[_0x5e33('0x1e')]===_0x5e33('0x1d');var _0xb3b48=_0x440fd1[_0x5e33('0x1f')];var _0x149e96=_0x3af66?0x0:_0x4d02be['offset'];var _0x281738=_0x3af66?_0x440fd1['count']:_0x4d02be[_0x5e33('0x1c')]+_0x4d02be[_0x5e33('0x1e')];var _0x296d73;if(_0x281738>=_0xb3b48){_0x281738=_0xb3b48;_0x296d73=0xc8;}else{_0x296d73=0xce;}_0x251869[_0x5e33('0x1a')](_0x296d73);return _0x251869[_0x5e33('0x20')](_0x5e33('0x21'),_0x149e96+'-'+_0x281738+'/'+_0xb3b48)[_0x5e33('0x1b')](_0x440fd1);}return null;};}function patchUpdates(_0x2d31ed){return function(_0x57c0bb){try{jsonpatch[_0x5e33('0x22')](_0x57c0bb,_0x2d31ed,!![]);}catch(_0x1a18a1){return BPromise[_0x5e33('0x23')](_0x1a18a1);}return _0x57c0bb[_0x5e33('0x24')]();};}function saveUpdates(_0x3b513b,_0x4e2382){return function(_0x2e8bbd){if(_0x2e8bbd){return _0x2e8bbd['update'](_0x3b513b)[_0x5e33('0x25')](function(_0x100e52){return _0x100e52;});}return null;};}function removeEntity(_0x358860,_0x332b0d){return function(_0x12896d){if(_0x12896d){return _0x12896d[_0x5e33('0x26')]()['then'](function(){var _0x3d2573=_0x12896d['get']({'plain':!![]});var _0x399e0d=_0x5e33('0x27');return db[_0x5e33('0x28')][_0x5e33('0x26')]({'where':{'type':_0x399e0d,'resourceId':_0x3d2573['id']}})['then'](function(){return _0x12896d;});})[_0x5e33('0x25')](function(){_0x358860[_0x5e33('0x1a')](0xcc)[_0x5e33('0x19')]();});}};}function handleEntityNotFound(_0x27bd94,_0x4f1812){return function(_0x4ce351){if(!_0x4ce351){_0x27bd94[_0x5e33('0x29')](0x194);}return _0x4ce351;};}function handleError(_0x59888c,_0x48da9a){_0x48da9a=_0x48da9a||0x1f4;return function(_0x44f5e0){logger[_0x5e33('0x2a')](_0x44f5e0[_0x5e33('0x2b')]);if(_0x44f5e0[_0x5e33('0x2c')]){delete _0x44f5e0[_0x5e33('0x2c')];}_0x59888c[_0x5e33('0x1a')](_0x48da9a)[_0x5e33('0x2d')](_0x44f5e0);};}exports[_0x5e33('0x2e')]=function(_0x145080,_0x4c4bc8){var _0x225bc1={},_0x578998={},_0x16d627={'count':0x0,'rows':[]};var _0x41684d=_['map'](db[_0x5e33('0x2f')][_0x5e33('0x30')],function(_0x15e32d){return{'name':_0x15e32d['fieldName'],'type':_0x15e32d[_0x5e33('0x31')][_0x5e33('0x32')]};});_0x578998[_0x5e33('0x33')]=_[_0x5e33('0x34')](_0x41684d,_0x5e33('0x2c'));_0x578998['query']=_[_0x5e33('0x35')](_0x145080['query']);_0x578998[_0x5e33('0x36')]=_['intersection'](_0x578998[_0x5e33('0x33')],_0x578998[_0x5e33('0x37')]);_0x225bc1[_0x5e33('0x38')]=_[_0x5e33('0x39')](_0x578998['model'],qs['fields'](_0x145080[_0x5e33('0x37')][_0x5e33('0x3a')]));_0x225bc1[_0x5e33('0x38')]=_0x225bc1[_0x5e33('0x38')]['length']?_0x225bc1[_0x5e33('0x38')]:_0x578998['model'];if(!_0x145080[_0x5e33('0x37')][_0x5e33('0x3b')]('nolimit')){_0x225bc1['limit']=qs['limit'](_0x145080[_0x5e33('0x37')]['limit']);_0x225bc1[_0x5e33('0x1c')]=qs[_0x5e33('0x1c')](_0x145080['query'][_0x5e33('0x1c')]);}_0x225bc1[_0x5e33('0x3c')]=qs[_0x5e33('0x3d')](_0x145080['query'][_0x5e33('0x3d')]);_0x225bc1[_0x5e33('0x3e')]=qs['filters'](_[_0x5e33('0x3f')](_0x145080['query'],_0x578998[_0x5e33('0x36')]),_0x41684d);if(_0x145080['query']['filter']){_0x225bc1['where']=_[_0x5e33('0x40')](_0x225bc1[_0x5e33('0x3e')],{'$or':_[_0x5e33('0x34')](_0x41684d,function(_0x3ebe2c){if(_0x3ebe2c[_0x5e33('0x31')]!==_0x5e33('0x41')){var _0x2de54e={};_0x2de54e[_0x3ebe2c['name']]={'$like':'%'+_0x145080[_0x5e33('0x37')][_0x5e33('0x42')]+'%'};return _0x2de54e;}})});}_0x225bc1=_['merge']({},_0x225bc1,_0x145080[_0x5e33('0x43')]);var _0x22e0d5={'where':_0x225bc1[_0x5e33('0x3e')]};return db[_0x5e33('0x2f')][_0x5e33('0x1f')](_0x22e0d5)[_0x5e33('0x25')](function(_0x313af1){_0x16d627[_0x5e33('0x1f')]=_0x313af1;if(_0x145080[_0x5e33('0x37')][_0x5e33('0x44')]){_0x225bc1[_0x5e33('0x45')]=[{'all':!![]}];}return db[_0x5e33('0x2f')][_0x5e33('0x46')](_0x225bc1);})['then'](function(_0x5bf4dd){_0x16d627['rows']=_0x5bf4dd;return _0x16d627;})[_0x5e33('0x25')](respondWithFilteredResult(_0x4c4bc8,_0x225bc1))[_0x5e33('0x47')](handleError(_0x4c4bc8,null));};exports[_0x5e33('0x48')]=function(_0x5236a2,_0x365fae){var _0x31127a={'raw':![],'where':{'id':_0x5236a2[_0x5e33('0x49')]['id']}},_0x5eb952={};_0x5eb952[_0x5e33('0x33')]=_[_0x5e33('0x35')](db['Trigger'][_0x5e33('0x30')]);_0x5eb952[_0x5e33('0x37')]=_['keys'](_0x5236a2['query']);_0x5eb952[_0x5e33('0x36')]=_['intersection'](_0x5eb952[_0x5e33('0x33')],_0x5eb952[_0x5e33('0x37')]);_0x31127a['attributes']=_[_0x5e33('0x39')](_0x5eb952[_0x5e33('0x33')],qs[_0x5e33('0x3a')](_0x5236a2[_0x5e33('0x37')][_0x5e33('0x3a')]));_0x31127a['attributes']=_0x31127a[_0x5e33('0x38')][_0x5e33('0x4a')]?_0x31127a[_0x5e33('0x38')]:_0x5eb952[_0x5e33('0x33')];if(_0x5236a2['query'][_0x5e33('0x44')]){_0x31127a[_0x5e33('0x45')]=[{'all':!![]}];}_0x31127a=_[_0x5e33('0x40')]({},_0x31127a,_0x5236a2[_0x5e33('0x43')]);return db['Trigger']['find'](_0x31127a)[_0x5e33('0x25')](handleEntityNotFound(_0x365fae,null))[_0x5e33('0x25')](respondWithResult(_0x365fae,null))[_0x5e33('0x47')](handleError(_0x365fae,null));};exports[_0x5e33('0x4b')]=function(_0x3b5236,_0x353930){return db['Trigger'][_0x5e33('0x4b')](_0x3b5236['body'],{})[_0x5e33('0x25')](function(_0x4e2d6d){var _0x385dc0=_0x3b5236['user'][_0x5e33('0x4c')]({'plain':!![]});if(!_0x385dc0)throw new Error(_0x5e33('0x4d'));if(_0x385dc0['role']===_0x5e33('0x4e')){var _0x4dc61f=_0x4e2d6d[_0x5e33('0x4c')]({'plain':!![]});var _0x1fa747=_0x5e33('0x27');return db[_0x5e33('0x4f')]['find']({'where':{'name':_0x1fa747,'userProfileId':_0x385dc0[_0x5e33('0x50')]},'raw':!![]})['then'](function(_0x49fbf1){if(_0x49fbf1&&_0x49fbf1[_0x5e33('0x51')]===0x0){return db[_0x5e33('0x28')][_0x5e33('0x4b')]({'name':_0x4dc61f[_0x5e33('0x2c')],'resourceId':_0x4dc61f['id'],'type':_0x49fbf1['name'],'sectionId':_0x49fbf1['id']},{})[_0x5e33('0x25')](function(){return _0x4e2d6d;});}else{return _0x4e2d6d;}})[_0x5e33('0x47')](function(_0x449852){logger[_0x5e33('0x2a')](_0x5e33('0x52'),_0x449852);throw _0x449852;});}return _0x4e2d6d;})[_0x5e33('0x25')](respondWithResult(_0x353930,0xc9))[_0x5e33('0x47')](handleError(_0x353930,null));};exports[_0x5e33('0x53')]=function(_0x25dd96,_0x35c46a){if(_0x25dd96['body']['id']){delete _0x25dd96['body']['id'];}return db[_0x5e33('0x2f')][_0x5e33('0x54')]({'where':{'id':_0x25dd96[_0x5e33('0x49')]['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0x35c46a,null))['then'](saveUpdates(_0x25dd96[_0x5e33('0x55')],null))[_0x5e33('0x25')](respondWithResult(_0x35c46a,null))[_0x5e33('0x47')](handleError(_0x35c46a,null));};exports['destroy']=function(_0x4b95f4,_0xe679ae){return db[_0x5e33('0x2f')][_0x5e33('0x54')]({'where':{'id':_0x4b95f4['params']['id']}})['then'](handleEntityNotFound(_0xe679ae,null))[_0x5e33('0x25')](removeEntity(_0xe679ae,null))[_0x5e33('0x47')](handleError(_0xe679ae,null));};exports[_0x5e33('0x56')]=function(_0x22c623,_0x11785f,_0xc73194){if(_0x22c623['body']['id']){delete _0x22c623[_0x5e33('0x55')]['id'];}return db[_0x5e33('0x2f')][_0x5e33('0x54')]({'where':{'id':_0x22c623['params']['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0x11785f,null))['then'](function(_0x4c6fd4){if(_0x4c6fd4){_0x22c623['body']['TriggerAllId']=_0x4c6fd4['id'];return db[_0x5e33('0x57')][_0x5e33('0x4b')](_0x22c623[_0x5e33('0x55')]);}})[_0x5e33('0x25')](respondWithResult(_0x11785f,null))['catch'](handleError(_0x11785f,null));};exports[_0x5e33('0x58')]=function(_0x466e62,_0xa1b7f8,_0x19fe42){if(_0x466e62[_0x5e33('0x55')]['id']){delete _0x466e62['body']['id'];}return db[_0x5e33('0x2f')][_0x5e33('0x54')]({'where':{'id':_0x466e62[_0x5e33('0x49')]['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0xa1b7f8,null))['then'](function(_0x177640){if(_0x177640){_0x466e62['body'][_0x5e33('0x59')]=_0x177640['id'];return db[_0x5e33('0x57')]['create'](_0x466e62['body']);}})[_0x5e33('0x25')](respondWithResult(_0xa1b7f8,null))[_0x5e33('0x47')](handleError(_0xa1b7f8,null));};exports[_0x5e33('0x5a')]=function(_0x45d641,_0x37b4b2,_0x5a8b24){var _0x4e67c4={};var _0x49dced={};var _0x2be8d2;var _0x1233f3;return db[_0x5e33('0x2f')][_0x5e33('0x5b')]({'where':{'id':_0x45d641[_0x5e33('0x49')]['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0x37b4b2,null))['then'](function(_0x1a369c){if(_0x1a369c){_0x2be8d2=_0x1a369c;_0x49dced[_0x5e33('0x33')]=_[_0x5e33('0x35')](db[_0x5e33('0x57')][_0x5e33('0x30')]);_0x49dced[_0x5e33('0x37')]=_[_0x5e33('0x35')](_0x45d641[_0x5e33('0x37')]);_0x49dced[_0x5e33('0x36')]=_['intersection'](_0x49dced[_0x5e33('0x33')],_0x49dced[_0x5e33('0x37')]);_0x4e67c4[_0x5e33('0x38')]=_['intersection'](_0x49dced['model'],qs[_0x5e33('0x3a')](_0x45d641[_0x5e33('0x37')][_0x5e33('0x3a')]));_0x4e67c4[_0x5e33('0x38')]=_0x4e67c4['attributes'][_0x5e33('0x4a')]?_0x4e67c4[_0x5e33('0x38')]:_0x49dced[_0x5e33('0x33')];_0x4e67c4['order']=qs[_0x5e33('0x3d')](_0x45d641[_0x5e33('0x37')][_0x5e33('0x3d')]);_0x4e67c4[_0x5e33('0x3e')]=qs[_0x5e33('0x36')](_[_0x5e33('0x3f')](_0x45d641['query'],_0x49dced[_0x5e33('0x36')]));if(_0x45d641[_0x5e33('0x37')]['filter']){_0x4e67c4[_0x5e33('0x3e')]=_[_0x5e33('0x40')](_0x4e67c4['where'],{'$or':_[_0x5e33('0x34')](_0x4e67c4[_0x5e33('0x38')],function(_0x5cfaf9){var _0xba97c4={};_0xba97c4[_0x5cfaf9]={'$like':'%'+_0x45d641[_0x5e33('0x37')]['filter']+'%'};return _0xba97c4;})});}_0x4e67c4=_[_0x5e33('0x40')]({},_0x4e67c4,_0x45d641[_0x5e33('0x43')]);return _0x2be8d2[_0x5e33('0x5a')](_0x4e67c4);}})[_0x5e33('0x25')](function(_0x459726){if(_0x459726){_0x1233f3=_0x459726[_0x5e33('0x4a')];if(!_0x45d641[_0x5e33('0x37')]['hasOwnProperty'](_0x5e33('0x5c'))){_0x4e67c4['limit']=qs[_0x5e33('0x1e')](_0x45d641[_0x5e33('0x37')][_0x5e33('0x1e')]);_0x4e67c4[_0x5e33('0x1c')]=qs[_0x5e33('0x1c')](_0x45d641['query']['offset']);}return _0x2be8d2['getAllConditions'](_0x4e67c4);}})[_0x5e33('0x25')](function(_0x4ebd78){if(_0x4ebd78){return _0x4ebd78?{'count':_0x1233f3,'rows':_0x4ebd78}:null;}})[_0x5e33('0x25')](respondWithResult(_0x37b4b2,null))['catch'](handleError(_0x37b4b2,null));};exports['getAnyConditions']=function(_0x1dff36,_0x467609,_0xb8435a){var _0x5b3990={};var _0x2e50f5={};var _0x51790b;var _0x3d3e8f;return db[_0x5e33('0x2f')][_0x5e33('0x5b')]({'where':{'id':_0x1dff36[_0x5e33('0x49')]['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0x467609,null))[_0x5e33('0x25')](function(_0x159d73){if(_0x159d73){_0x51790b=_0x159d73;_0x2e50f5[_0x5e33('0x33')]=_[_0x5e33('0x35')](db[_0x5e33('0x57')]['rawAttributes']);_0x2e50f5['query']=_[_0x5e33('0x35')](_0x1dff36[_0x5e33('0x37')]);_0x2e50f5[_0x5e33('0x36')]=_[_0x5e33('0x39')](_0x2e50f5[_0x5e33('0x33')],_0x2e50f5[_0x5e33('0x37')]);_0x5b3990[_0x5e33('0x38')]=_[_0x5e33('0x39')](_0x2e50f5[_0x5e33('0x33')],qs['fields'](_0x1dff36[_0x5e33('0x37')][_0x5e33('0x3a')]));_0x5b3990['attributes']=_0x5b3990[_0x5e33('0x38')][_0x5e33('0x4a')]?_0x5b3990[_0x5e33('0x38')]:_0x2e50f5['model'];_0x5b3990['order']=qs[_0x5e33('0x3d')](_0x1dff36[_0x5e33('0x37')][_0x5e33('0x3d')]);_0x5b3990[_0x5e33('0x3e')]=qs[_0x5e33('0x36')](_[_0x5e33('0x3f')](_0x1dff36[_0x5e33('0x37')],_0x2e50f5[_0x5e33('0x36')]));if(_0x1dff36[_0x5e33('0x37')][_0x5e33('0x42')]){_0x5b3990['where']=_['merge'](_0x5b3990[_0x5e33('0x3e')],{'$or':_[_0x5e33('0x34')](_0x5b3990[_0x5e33('0x38')],function(_0x19f5a6){var _0x14a719={};_0x14a719[_0x19f5a6]={'$like':'%'+_0x1dff36[_0x5e33('0x37')][_0x5e33('0x42')]+'%'};return _0x14a719;})});}_0x5b3990=_[_0x5e33('0x40')]({},_0x5b3990,_0x1dff36[_0x5e33('0x43')]);return _0x51790b[_0x5e33('0x5d')](_0x5b3990);}})['then'](function(_0x517c23){if(_0x517c23){_0x3d3e8f=_0x517c23['length'];if(!_0x1dff36[_0x5e33('0x37')][_0x5e33('0x3b')]('nolimit')){_0x5b3990[_0x5e33('0x1e')]=qs['limit'](_0x1dff36[_0x5e33('0x37')][_0x5e33('0x1e')]);_0x5b3990[_0x5e33('0x1c')]=qs[_0x5e33('0x1c')](_0x1dff36[_0x5e33('0x37')][_0x5e33('0x1c')]);}return _0x51790b[_0x5e33('0x5d')](_0x5b3990);}})[_0x5e33('0x25')](function(_0x3e881a){if(_0x3e881a){return _0x3e881a?{'count':_0x3d3e8f,'rows':_0x3e881a}:null;}})[_0x5e33('0x25')](respondWithResult(_0x467609,null))[_0x5e33('0x47')](handleError(_0x467609,null));};exports[_0x5e33('0x5e')]=function(_0x3981ca,_0x5e44be,_0x2d8349){if(_0x3981ca[_0x5e33('0x55')]['id']){delete _0x3981ca[_0x5e33('0x55')]['id'];}return db[_0x5e33('0x2f')][_0x5e33('0x54')]({'where':{'id':_0x3981ca[_0x5e33('0x49')]['id']}})['then'](handleEntityNotFound(_0x5e44be,null))[_0x5e33('0x25')](function(_0x15fe46){if(_0x15fe46){_0x3981ca[_0x5e33('0x55')][_0x5e33('0x5f')]=_0x15fe46['id'];return db['Action'][_0x5e33('0x4b')](_0x3981ca[_0x5e33('0x55')]);}})[_0x5e33('0x25')](respondWithResult(_0x5e44be,null))[_0x5e33('0x47')](handleError(_0x5e44be,null));};exports['getActions']=function(_0x2a66b5,_0x2a611d,_0x9210d3){var _0x1a9f29={};var _0x825fbd={};var _0x474700;var _0x1ebd6e;return db[_0x5e33('0x2f')][_0x5e33('0x5b')]({'where':{'id':_0x2a66b5[_0x5e33('0x49')]['id']}})[_0x5e33('0x25')](handleEntityNotFound(_0x2a611d,null))['then'](function(_0x24a35b){if(_0x24a35b){_0x474700=_0x24a35b;_0x825fbd[_0x5e33('0x33')]=_[_0x5e33('0x35')](db[_0x5e33('0x60')][_0x5e33('0x30')]);_0x825fbd[_0x5e33('0x37')]=_['keys'](_0x2a66b5[_0x5e33('0x37')]);_0x825fbd[_0x5e33('0x36')]=_[_0x5e33('0x39')](_0x825fbd[_0x5e33('0x33')],_0x825fbd[_0x5e33('0x37')]);_0x1a9f29[_0x5e33('0x38')]=_[_0x5e33('0x39')](_0x825fbd[_0x5e33('0x33')],qs[_0x5e33('0x3a')](_0x2a66b5[_0x5e33('0x37')]['fields']));_0x1a9f29[_0x5e33('0x38')]=_0x1a9f29[_0x5e33('0x38')][_0x5e33('0x4a')]?_0x1a9f29[_0x5e33('0x38')]:_0x825fbd[_0x5e33('0x33')];_0x1a9f29['order']=qs[_0x5e33('0x3d')](_0x2a66b5[_0x5e33('0x37')][_0x5e33('0x3d')]);_0x1a9f29['where']=qs[_0x5e33('0x36')](_[_0x5e33('0x3f')](_0x2a66b5[_0x5e33('0x37')],_0x825fbd[_0x5e33('0x36')]));if(_0x2a66b5['query'][_0x5e33('0x42')]){_0x1a9f29[_0x5e33('0x3e')]=_['merge'](_0x1a9f29[_0x5e33('0x3e')],{'$or':_[_0x5e33('0x34')](_0x1a9f29[_0x5e33('0x38')],function(_0x14f81b){var _0x4643f7={};_0x4643f7[_0x14f81b]={'$like':'%'+_0x2a66b5[_0x5e33('0x37')]['filter']+'%'};return _0x4643f7;})});}_0x1a9f29=_[_0x5e33('0x40')]({},_0x1a9f29,_0x2a66b5[_0x5e33('0x43')]);return _0x474700[_0x5e33('0x61')](_0x1a9f29);}})[_0x5e33('0x25')](function(_0x168435){if(_0x168435){_0x1ebd6e=_0x168435['length'];if(!_0x2a66b5[_0x5e33('0x37')][_0x5e33('0x3b')]('nolimit')){_0x1a9f29['limit']=qs[_0x5e33('0x1e')](_0x2a66b5['query']['limit']);_0x1a9f29[_0x5e33('0x1c')]=qs[_0x5e33('0x1c')](_0x2a66b5['query'][_0x5e33('0x1c')]);}return _0x474700[_0x5e33('0x61')](_0x1a9f29);}})[_0x5e33('0x25')](function(_0x2e4a6d){if(_0x2e4a6d){return _0x2e4a6d?{'count':_0x1ebd6e,'rows':_0x2e4a6d}:null;}})[_0x5e33('0x25')](respondWithResult(_0x2a611d,null))[_0x5e33('0x47')](handleError(_0x2a611d,null));}; \ No newline at end of file +var _0x0fb3=['apply','reject','save','update','then','get','Triggers','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','filters','attributes','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','keys','intersection','fields','create','body','user','role','UserProfileSection','find','autoAssociation','addAllCondition','Condition','addAnyCondition','findOne','options','getAllConditions','getAnyConditions','TriggerId','Action','getActions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x21d7eb,_0x531a19){var _0x226f63=function(_0x91fee1){while(--_0x91fee1){_0x21d7eb['push'](_0x21d7eb['shift']());}};_0x226f63(++_0x531a19);}(_0x0fb3,0xf9));var _0x30fb=function(_0x2318b9,_0x5f30b5){_0x2318b9=_0x2318b9-0x0;var _0x57c180=_0x0fb3[_0x2318b9];return _0x57c180;};'use strict';var emlformat=require(_0x30fb('0x0'));var rimraf=require(_0x30fb('0x1'));var zipdir=require(_0x30fb('0x2'));var jsonpatch=require(_0x30fb('0x3'));var rp=require(_0x30fb('0x4'));var moment=require(_0x30fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x30fb('0x6'));var util=require(_0x30fb('0x7'));var path=require(_0x30fb('0x8'));var sox=require(_0x30fb('0x9'));var csv=require(_0x30fb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x30fb('0xb'));var crypto=require(_0x30fb('0xc'));var jsforce=require(_0x30fb('0xd'));var deskjs=require(_0x30fb('0xe'));var toCsv=require(_0x30fb('0xa'));var querystring=require(_0x30fb('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30fb('0x10'));var qs=require(_0x30fb('0x11'));var as=require(_0x30fb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x30fb('0x13'))(_0x30fb('0x14'));var utils=require(_0x30fb('0x15'));var config=require(_0x30fb('0x16'));var licenseUtil=require(_0x30fb('0x17'));var db=require(_0x30fb('0x18'))['db'];function respondWithStatusCode(_0x1504f2,_0x102c51){_0x102c51=_0x102c51||0xcc;return function(_0x156dac){if(_0x156dac){return _0x1504f2['sendStatus'](_0x102c51);}return _0x1504f2[_0x30fb('0x19')](_0x102c51)['end']();};}function respondWithResult(_0x1b1102,_0x389672){_0x389672=_0x389672||0xc8;return function(_0x1096a2){if(_0x1096a2){return _0x1b1102[_0x30fb('0x19')](_0x389672)[_0x30fb('0x1a')](_0x1096a2);}};}function respondWithFilteredResult(_0x2bde70,_0x3d8f1c){return function(_0x3d59bf){if(_0x3d59bf){var _0x1fee79=typeof _0x3d8f1c[_0x30fb('0x1b')]===_0x30fb('0x1c')&&typeof _0x3d8f1c[_0x30fb('0x1d')]==='undefined';var _0x11b094=_0x3d59bf[_0x30fb('0x1e')];var _0x4f7394=_0x1fee79?0x0:_0x3d8f1c[_0x30fb('0x1b')];var _0x38cb27=_0x1fee79?_0x3d59bf[_0x30fb('0x1e')]:_0x3d8f1c[_0x30fb('0x1b')]+_0x3d8f1c[_0x30fb('0x1d')];var _0x396546;if(_0x38cb27>=_0x11b094){_0x38cb27=_0x11b094;_0x396546=0xc8;}else{_0x396546=0xce;}_0x2bde70[_0x30fb('0x19')](_0x396546);return _0x2bde70[_0x30fb('0x1f')](_0x30fb('0x20'),_0x4f7394+'-'+_0x38cb27+'/'+_0x11b094)[_0x30fb('0x1a')](_0x3d59bf);}return null;};}function patchUpdates(_0x20ef56){return function(_0x2e5acd){try{jsonpatch[_0x30fb('0x21')](_0x2e5acd,_0x20ef56,!![]);}catch(_0x5d4226){return BPromise[_0x30fb('0x22')](_0x5d4226);}return _0x2e5acd[_0x30fb('0x23')]();};}function saveUpdates(_0x56fdca,_0x433162){return function(_0x2045d4){if(_0x2045d4){return _0x2045d4[_0x30fb('0x24')](_0x56fdca)[_0x30fb('0x25')](function(_0x24d5c1){return _0x24d5c1;});}return null;};}function removeEntity(_0x3e5b14,_0x2f8393){return function(_0x18d5f3){if(_0x18d5f3){return _0x18d5f3['destroy']()[_0x30fb('0x25')](function(){var _0x4adee6=_0x18d5f3[_0x30fb('0x26')]({'plain':!![]});var _0x1ecb45=_0x30fb('0x27');return db[_0x30fb('0x28')][_0x30fb('0x29')]({'where':{'type':_0x1ecb45,'resourceId':_0x4adee6['id']}})[_0x30fb('0x25')](function(){return _0x18d5f3;});})[_0x30fb('0x25')](function(){_0x3e5b14[_0x30fb('0x19')](0xcc)[_0x30fb('0x2a')]();});}};}function handleEntityNotFound(_0x14efae,_0x3bd799){return function(_0x49c40d){if(!_0x49c40d){_0x14efae[_0x30fb('0x2b')](0x194);}return _0x49c40d;};}function handleError(_0x2e0499,_0xa92cee){_0xa92cee=_0xa92cee||0x1f4;return function(_0x2d8077){logger[_0x30fb('0x2c')](_0x2d8077[_0x30fb('0x2d')]);if(_0x2d8077['name']){delete _0x2d8077[_0x30fb('0x2e')];}_0x2e0499[_0x30fb('0x19')](_0xa92cee)[_0x30fb('0x2f')](_0x2d8077);};}exports[_0x30fb('0x30')]=function(_0x5628e3,_0x1c029e){var _0x2c3462={},_0x322cf0={},_0x6fe962={'count':0x0,'rows':[]};var _0x2267f8=_[_0x30fb('0x31')](db[_0x30fb('0x32')][_0x30fb('0x33')],function(_0x11adcc){return{'name':_0x11adcc[_0x30fb('0x34')],'type':_0x11adcc[_0x30fb('0x35')]['key']};});_0x322cf0[_0x30fb('0x36')]=_[_0x30fb('0x31')](_0x2267f8,'name');_0x322cf0[_0x30fb('0x37')]=_['keys'](_0x5628e3[_0x30fb('0x37')]);_0x322cf0[_0x30fb('0x38')]=_['intersection'](_0x322cf0['model'],_0x322cf0[_0x30fb('0x37')]);_0x2c3462[_0x30fb('0x39')]=_['intersection'](_0x322cf0['model'],qs['fields'](_0x5628e3[_0x30fb('0x37')]['fields']));_0x2c3462[_0x30fb('0x39')]=_0x2c3462[_0x30fb('0x39')][_0x30fb('0x3a')]?_0x2c3462[_0x30fb('0x39')]:_0x322cf0[_0x30fb('0x36')];if(!_0x5628e3['query']['hasOwnProperty'](_0x30fb('0x3b'))){_0x2c3462['limit']=qs[_0x30fb('0x1d')](_0x5628e3[_0x30fb('0x37')][_0x30fb('0x1d')]);_0x2c3462['offset']=qs[_0x30fb('0x1b')](_0x5628e3['query'][_0x30fb('0x1b')]);}_0x2c3462[_0x30fb('0x3c')]=qs[_0x30fb('0x3d')](_0x5628e3[_0x30fb('0x37')][_0x30fb('0x3d')]);_0x2c3462[_0x30fb('0x3e')]=qs[_0x30fb('0x38')](_[_0x30fb('0x3f')](_0x5628e3[_0x30fb('0x37')],_0x322cf0[_0x30fb('0x38')]),_0x2267f8);if(_0x5628e3[_0x30fb('0x37')]['filter']){_0x2c3462[_0x30fb('0x3e')]=_[_0x30fb('0x40')](_0x2c3462['where'],{'$or':_[_0x30fb('0x31')](_0x2267f8,function(_0x4b936e){if(_0x4b936e[_0x30fb('0x35')]!=='VIRTUAL'){var _0x1fc7de={};_0x1fc7de[_0x4b936e[_0x30fb('0x2e')]]={'$like':'%'+_0x5628e3[_0x30fb('0x37')][_0x30fb('0x41')]+'%'};return _0x1fc7de;}})});}_0x2c3462=_[_0x30fb('0x40')]({},_0x2c3462,_0x5628e3['options']);var _0xbd21e={'where':_0x2c3462[_0x30fb('0x3e')]};return db[_0x30fb('0x32')][_0x30fb('0x1e')](_0xbd21e)['then'](function(_0x15f94f){_0x6fe962[_0x30fb('0x1e')]=_0x15f94f;if(_0x5628e3['query'][_0x30fb('0x42')]){_0x2c3462[_0x30fb('0x43')]=[{'all':!![]}];}return db[_0x30fb('0x32')][_0x30fb('0x44')](_0x2c3462);})[_0x30fb('0x25')](function(_0x38c90e){_0x6fe962[_0x30fb('0x45')]=_0x38c90e;return _0x6fe962;})[_0x30fb('0x25')](respondWithFilteredResult(_0x1c029e,_0x2c3462))[_0x30fb('0x46')](handleError(_0x1c029e,null));};exports[_0x30fb('0x47')]=function(_0x5148f3,_0x35031a){var _0x50d48f={'raw':![],'where':{'id':_0x5148f3[_0x30fb('0x48')]['id']}},_0x39814d={};_0x39814d[_0x30fb('0x36')]=_[_0x30fb('0x49')](db['Trigger'][_0x30fb('0x33')]);_0x39814d[_0x30fb('0x37')]=_[_0x30fb('0x49')](_0x5148f3[_0x30fb('0x37')]);_0x39814d[_0x30fb('0x38')]=_[_0x30fb('0x4a')](_0x39814d[_0x30fb('0x36')],_0x39814d[_0x30fb('0x37')]);_0x50d48f[_0x30fb('0x39')]=_[_0x30fb('0x4a')](_0x39814d[_0x30fb('0x36')],qs[_0x30fb('0x4b')](_0x5148f3[_0x30fb('0x37')][_0x30fb('0x4b')]));_0x50d48f[_0x30fb('0x39')]=_0x50d48f['attributes'][_0x30fb('0x3a')]?_0x50d48f['attributes']:_0x39814d['model'];if(_0x5148f3[_0x30fb('0x37')][_0x30fb('0x42')]){_0x50d48f[_0x30fb('0x43')]=[{'all':!![]}];}_0x50d48f=_['merge']({},_0x50d48f,_0x5148f3['options']);return db['Trigger']['find'](_0x50d48f)['then'](handleEntityNotFound(_0x35031a,null))[_0x30fb('0x25')](respondWithResult(_0x35031a,null))[_0x30fb('0x46')](handleError(_0x35031a,null));};exports['create']=function(_0x99f28f,_0x529de5){return db[_0x30fb('0x32')][_0x30fb('0x4c')](_0x99f28f[_0x30fb('0x4d')],{})[_0x30fb('0x25')](function(_0x58c185){var _0xaddac8=_0x99f28f[_0x30fb('0x4e')][_0x30fb('0x26')]({'plain':!![]});if(!_0xaddac8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xaddac8[_0x30fb('0x4f')]===_0x30fb('0x4e')){var _0x118db5=_0x58c185[_0x30fb('0x26')]({'plain':!![]});var _0x25dc09=_0x30fb('0x27');return db[_0x30fb('0x50')][_0x30fb('0x51')]({'where':{'name':_0x25dc09,'userProfileId':_0xaddac8['userProfileId']},'raw':!![]})[_0x30fb('0x25')](function(_0x332846){if(_0x332846&&_0x332846[_0x30fb('0x52')]===0x0){return db[_0x30fb('0x28')]['create']({'name':_0x118db5[_0x30fb('0x2e')],'resourceId':_0x118db5['id'],'type':_0x332846[_0x30fb('0x2e')],'sectionId':_0x332846['id']},{})[_0x30fb('0x25')](function(){return _0x58c185;});}else{return _0x58c185;}})[_0x30fb('0x46')](function(_0x38456a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38456a);throw _0x38456a;});}return _0x58c185;})[_0x30fb('0x25')](respondWithResult(_0x529de5,0xc9))['catch'](handleError(_0x529de5,null));};exports[_0x30fb('0x24')]=function(_0xf3c0c4,_0x30febb){if(_0xf3c0c4['body']['id']){delete _0xf3c0c4['body']['id'];}return db[_0x30fb('0x32')]['find']({'where':{'id':_0xf3c0c4[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x30febb,null))[_0x30fb('0x25')](saveUpdates(_0xf3c0c4[_0x30fb('0x4d')],null))[_0x30fb('0x25')](respondWithResult(_0x30febb,null))['catch'](handleError(_0x30febb,null));};exports[_0x30fb('0x29')]=function(_0x28ab58,_0x5a68d1){return db['Trigger']['find']({'where':{'id':_0x28ab58[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x5a68d1,null))[_0x30fb('0x25')](removeEntity(_0x5a68d1,null))['catch'](handleError(_0x5a68d1,null));};exports[_0x30fb('0x53')]=function(_0x1b9e77,_0x202a1f,_0x37aad4){if(_0x1b9e77[_0x30fb('0x4d')]['id']){delete _0x1b9e77[_0x30fb('0x4d')]['id'];}return db[_0x30fb('0x32')][_0x30fb('0x51')]({'where':{'id':_0x1b9e77[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x202a1f,null))['then'](function(_0x3d7767){if(_0x3d7767){_0x1b9e77[_0x30fb('0x4d')]['TriggerAllId']=_0x3d7767['id'];return db[_0x30fb('0x54')][_0x30fb('0x4c')](_0x1b9e77[_0x30fb('0x4d')]);}})['then'](respondWithResult(_0x202a1f,null))[_0x30fb('0x46')](handleError(_0x202a1f,null));};exports[_0x30fb('0x55')]=function(_0x1ae1cb,_0x5925a5,_0x444123){if(_0x1ae1cb[_0x30fb('0x4d')]['id']){delete _0x1ae1cb['body']['id'];}return db[_0x30fb('0x32')][_0x30fb('0x51')]({'where':{'id':_0x1ae1cb[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x5925a5,null))[_0x30fb('0x25')](function(_0x4f0afb){if(_0x4f0afb){_0x1ae1cb['body']['TriggerAnyId']=_0x4f0afb['id'];return db['Condition'][_0x30fb('0x4c')](_0x1ae1cb['body']);}})[_0x30fb('0x25')](respondWithResult(_0x5925a5,null))[_0x30fb('0x46')](handleError(_0x5925a5,null));};exports['getAllConditions']=function(_0x427aa2,_0x1a4b17,_0x47b27f){var _0x561d6f={};var _0x2d071c={};var _0x3e4fab;var _0x304b87;return db[_0x30fb('0x32')][_0x30fb('0x56')]({'where':{'id':_0x427aa2[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x1a4b17,null))[_0x30fb('0x25')](function(_0x223d09){if(_0x223d09){_0x3e4fab=_0x223d09;_0x2d071c['model']=_[_0x30fb('0x49')](db['Condition'][_0x30fb('0x33')]);_0x2d071c[_0x30fb('0x37')]=_[_0x30fb('0x49')](_0x427aa2[_0x30fb('0x37')]);_0x2d071c['filters']=_[_0x30fb('0x4a')](_0x2d071c[_0x30fb('0x36')],_0x2d071c[_0x30fb('0x37')]);_0x561d6f[_0x30fb('0x39')]=_[_0x30fb('0x4a')](_0x2d071c[_0x30fb('0x36')],qs[_0x30fb('0x4b')](_0x427aa2['query'][_0x30fb('0x4b')]));_0x561d6f[_0x30fb('0x39')]=_0x561d6f[_0x30fb('0x39')]['length']?_0x561d6f[_0x30fb('0x39')]:_0x2d071c[_0x30fb('0x36')];_0x561d6f[_0x30fb('0x3c')]=qs[_0x30fb('0x3d')](_0x427aa2[_0x30fb('0x37')]['sort']);_0x561d6f[_0x30fb('0x3e')]=qs[_0x30fb('0x38')](_[_0x30fb('0x3f')](_0x427aa2['query'],_0x2d071c[_0x30fb('0x38')]));if(_0x427aa2[_0x30fb('0x37')][_0x30fb('0x41')]){_0x561d6f[_0x30fb('0x3e')]=_[_0x30fb('0x40')](_0x561d6f['where'],{'$or':_[_0x30fb('0x31')](_0x561d6f[_0x30fb('0x39')],function(_0x52b7c7){var _0x28d06b={};_0x28d06b[_0x52b7c7]={'$like':'%'+_0x427aa2[_0x30fb('0x37')]['filter']+'%'};return _0x28d06b;})});}_0x561d6f=_['merge']({},_0x561d6f,_0x427aa2[_0x30fb('0x57')]);return _0x3e4fab[_0x30fb('0x58')](_0x561d6f);}})[_0x30fb('0x25')](function(_0x164aab){if(_0x164aab){_0x304b87=_0x164aab[_0x30fb('0x3a')];if(!_0x427aa2[_0x30fb('0x37')]['hasOwnProperty'](_0x30fb('0x3b'))){_0x561d6f[_0x30fb('0x1d')]=qs[_0x30fb('0x1d')](_0x427aa2[_0x30fb('0x37')][_0x30fb('0x1d')]);_0x561d6f[_0x30fb('0x1b')]=qs[_0x30fb('0x1b')](_0x427aa2[_0x30fb('0x37')]['offset']);}return _0x3e4fab[_0x30fb('0x58')](_0x561d6f);}})[_0x30fb('0x25')](function(_0x15a39b){if(_0x15a39b){return _0x15a39b?{'count':_0x304b87,'rows':_0x15a39b}:null;}})['then'](respondWithResult(_0x1a4b17,null))[_0x30fb('0x46')](handleError(_0x1a4b17,null));};exports[_0x30fb('0x59')]=function(_0x3b67e2,_0x5627d6,_0x552a72){var _0x26f6b8={};var _0x10d2a0={};var _0x496ea7;var _0x3d1270;return db[_0x30fb('0x32')]['findOne']({'where':{'id':_0x3b67e2[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x5627d6,null))[_0x30fb('0x25')](function(_0x4f8e22){if(_0x4f8e22){_0x496ea7=_0x4f8e22;_0x10d2a0[_0x30fb('0x36')]=_[_0x30fb('0x49')](db[_0x30fb('0x54')][_0x30fb('0x33')]);_0x10d2a0[_0x30fb('0x37')]=_[_0x30fb('0x49')](_0x3b67e2['query']);_0x10d2a0['filters']=_[_0x30fb('0x4a')](_0x10d2a0[_0x30fb('0x36')],_0x10d2a0[_0x30fb('0x37')]);_0x26f6b8['attributes']=_[_0x30fb('0x4a')](_0x10d2a0[_0x30fb('0x36')],qs['fields'](_0x3b67e2[_0x30fb('0x37')][_0x30fb('0x4b')]));_0x26f6b8[_0x30fb('0x39')]=_0x26f6b8[_0x30fb('0x39')]['length']?_0x26f6b8[_0x30fb('0x39')]:_0x10d2a0['model'];_0x26f6b8[_0x30fb('0x3c')]=qs[_0x30fb('0x3d')](_0x3b67e2[_0x30fb('0x37')][_0x30fb('0x3d')]);_0x26f6b8[_0x30fb('0x3e')]=qs[_0x30fb('0x38')](_['pick'](_0x3b67e2['query'],_0x10d2a0[_0x30fb('0x38')]));if(_0x3b67e2['query'][_0x30fb('0x41')]){_0x26f6b8[_0x30fb('0x3e')]=_[_0x30fb('0x40')](_0x26f6b8[_0x30fb('0x3e')],{'$or':_[_0x30fb('0x31')](_0x26f6b8[_0x30fb('0x39')],function(_0x3851f0){var _0x35e997={};_0x35e997[_0x3851f0]={'$like':'%'+_0x3b67e2[_0x30fb('0x37')][_0x30fb('0x41')]+'%'};return _0x35e997;})});}_0x26f6b8=_[_0x30fb('0x40')]({},_0x26f6b8,_0x3b67e2[_0x30fb('0x57')]);return _0x496ea7[_0x30fb('0x59')](_0x26f6b8);}})[_0x30fb('0x25')](function(_0x37eeb9){if(_0x37eeb9){_0x3d1270=_0x37eeb9['length'];if(!_0x3b67e2[_0x30fb('0x37')]['hasOwnProperty'](_0x30fb('0x3b'))){_0x26f6b8[_0x30fb('0x1d')]=qs[_0x30fb('0x1d')](_0x3b67e2['query'][_0x30fb('0x1d')]);_0x26f6b8['offset']=qs['offset'](_0x3b67e2[_0x30fb('0x37')]['offset']);}return _0x496ea7[_0x30fb('0x59')](_0x26f6b8);}})[_0x30fb('0x25')](function(_0x427cfc){if(_0x427cfc){return _0x427cfc?{'count':_0x3d1270,'rows':_0x427cfc}:null;}})['then'](respondWithResult(_0x5627d6,null))[_0x30fb('0x46')](handleError(_0x5627d6,null));};exports['addAction']=function(_0x86f079,_0x3b9e28,_0x1d0d4c){if(_0x86f079[_0x30fb('0x4d')]['id']){delete _0x86f079['body']['id'];}return db[_0x30fb('0x32')]['find']({'where':{'id':_0x86f079[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x3b9e28,null))[_0x30fb('0x25')](function(_0x35cb7d){if(_0x35cb7d){_0x86f079['body'][_0x30fb('0x5a')]=_0x35cb7d['id'];return db[_0x30fb('0x5b')][_0x30fb('0x4c')](_0x86f079[_0x30fb('0x4d')]);}})[_0x30fb('0x25')](respondWithResult(_0x3b9e28,null))[_0x30fb('0x46')](handleError(_0x3b9e28,null));};exports[_0x30fb('0x5c')]=function(_0x337db8,_0x36533a,_0x15fdf1){var _0x11d0ee={};var _0x2db415={};var _0x2c3e2b;var _0x719e2d;return db[_0x30fb('0x32')][_0x30fb('0x56')]({'where':{'id':_0x337db8[_0x30fb('0x48')]['id']}})[_0x30fb('0x25')](handleEntityNotFound(_0x36533a,null))[_0x30fb('0x25')](function(_0x466d91){if(_0x466d91){_0x2c3e2b=_0x466d91;_0x2db415[_0x30fb('0x36')]=_[_0x30fb('0x49')](db[_0x30fb('0x5b')][_0x30fb('0x33')]);_0x2db415['query']=_[_0x30fb('0x49')](_0x337db8[_0x30fb('0x37')]);_0x2db415['filters']=_[_0x30fb('0x4a')](_0x2db415[_0x30fb('0x36')],_0x2db415[_0x30fb('0x37')]);_0x11d0ee[_0x30fb('0x39')]=_['intersection'](_0x2db415[_0x30fb('0x36')],qs[_0x30fb('0x4b')](_0x337db8[_0x30fb('0x37')][_0x30fb('0x4b')]));_0x11d0ee[_0x30fb('0x39')]=_0x11d0ee[_0x30fb('0x39')][_0x30fb('0x3a')]?_0x11d0ee['attributes']:_0x2db415[_0x30fb('0x36')];_0x11d0ee[_0x30fb('0x3c')]=qs['sort'](_0x337db8['query']['sort']);_0x11d0ee['where']=qs[_0x30fb('0x38')](_['pick'](_0x337db8[_0x30fb('0x37')],_0x2db415['filters']));if(_0x337db8['query'][_0x30fb('0x41')]){_0x11d0ee[_0x30fb('0x3e')]=_['merge'](_0x11d0ee[_0x30fb('0x3e')],{'$or':_[_0x30fb('0x31')](_0x11d0ee[_0x30fb('0x39')],function(_0x19d01e){var _0xa2c2ae={};_0xa2c2ae[_0x19d01e]={'$like':'%'+_0x337db8[_0x30fb('0x37')][_0x30fb('0x41')]+'%'};return _0xa2c2ae;})});}_0x11d0ee=_[_0x30fb('0x40')]({},_0x11d0ee,_0x337db8[_0x30fb('0x57')]);return _0x2c3e2b['getActions'](_0x11d0ee);}})[_0x30fb('0x25')](function(_0x24ba5e){if(_0x24ba5e){_0x719e2d=_0x24ba5e[_0x30fb('0x3a')];if(!_0x337db8['query'][_0x30fb('0x5d')](_0x30fb('0x3b'))){_0x11d0ee['limit']=qs[_0x30fb('0x1d')](_0x337db8[_0x30fb('0x37')]['limit']);_0x11d0ee[_0x30fb('0x1b')]=qs[_0x30fb('0x1b')](_0x337db8[_0x30fb('0x37')][_0x30fb('0x1b')]);}return _0x2c3e2b[_0x30fb('0x5c')](_0x11d0ee);}})['then'](function(_0x54fa08){if(_0x54fa08){return _0x54fa08?{'count':_0x719e2d,'rows':_0x54fa08}:null;}})['then'](respondWithResult(_0x36533a,null))['catch'](handleError(_0x36533a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e7d81da..7f66c78 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 _0x956a=['request-promise','path','rimraf','exports','Trigger','tools_triggers','util','../../config/logger','api','moment','bluebird'];(function(_0x2a8860,_0x721c6c){var _0x28a043=function(_0x10b0a1){while(--_0x10b0a1){_0x2a8860['push'](_0x2a8860['shift']());}};_0x28a043(++_0x721c6c);}(_0x956a,0xb6));var _0xa956=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x956a[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xa956('0x0'));var logger=require(_0xa956('0x1'))(_0xa956('0x2'));var moment=require(_0xa956('0x3'));var BPromise=require(_0xa956('0x4'));var rp=require(_0xa956('0x5'));var fs=require('fs');var path=require(_0xa956('0x6'));var rimraf=require(_0xa956('0x7'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xa956('0x8')]=function(_0x2b9675,_0x2ce2c8){return _0x2b9675['define'](_0xa956('0x9'),attributes,{'tableName':_0xa956('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d9b=['util','../../config/logger','api','moment','path','../../config/environment','./trigger.attributes','define','lodash'];(function(_0x1dde3c,_0xaea0c4){var _0x35bc2c=function(_0x1311ed){while(--_0x1311ed){_0x1dde3c['push'](_0x1dde3c['shift']());}};_0x35bc2c(++_0xaea0c4);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d9('0x6'));var attributes=require(_0xb8d9('0x7'));module['exports']=function(_0x5996e9,_0x529b0a){return _0x5996e9[_0xb8d9('0x8')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 423d54f..7d14e21 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 _0x0d57=['../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','findAll','options','where','attributes','limit','map','include','model','then','ShowTrigger','Trigger','find','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2546ca,_0x10e673){var _0x462782=function(_0x49f4d2){while(--_0x49f4d2){_0x2546ca['push'](_0x2546ca['shift']());}};_0x462782(++_0x10e673);}(_0x0d57,0x1a8));var _0x70d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0d57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x70d5('0x0'));var moment=require(_0x70d5('0x1'));var BPromise=require(_0x70d5('0x2'));var rs=require(_0x70d5('0x3'));var fs=require('fs');var Redis=require(_0x70d5('0x4'));var db=require(_0x70d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x70d5('0x6'))(_0x70d5('0x7'));var config=require(_0x70d5('0x8'));var jayson=require(_0x70d5('0x9'));var client=jayson[_0x70d5('0xa')][_0x70d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe40367,_0x38146e,_0x2aef49){return new BPromise(function(_0x247bc9,_0x1d277b){return client[_0x70d5('0xc')](_0xe40367,_0x2aef49)['then'](function(_0x2be3a2){logger[_0x70d5('0xd')](_0x70d5('0xe'),_0x38146e,_0x70d5('0xf'));logger[_0x70d5('0x10')](_0x70d5('0x11'),_0x38146e,'request\x20sent',JSON['stringify'](_0x2be3a2));if(_0x2be3a2[_0x70d5('0x12')]){if(_0x2be3a2[_0x70d5('0x12')][_0x70d5('0x13')]===0x1f4){logger[_0x70d5('0x12')](_0x70d5('0xe'),_0x38146e,_0x2be3a2[_0x70d5('0x12')][_0x70d5('0x14')]);return _0x1d277b(_0x2be3a2[_0x70d5('0x12')][_0x70d5('0x14')]);}logger[_0x70d5('0x12')](_0x70d5('0xe'),_0x38146e,_0x2be3a2[_0x70d5('0x12')][_0x70d5('0x14')]);return _0x247bc9(_0x2be3a2[_0x70d5('0x12')][_0x70d5('0x14')]);}else{logger[_0x70d5('0xd')](_0x70d5('0xe'),_0x38146e,_0x70d5('0xf'));_0x247bc9(_0x2be3a2['result'][_0x70d5('0x14')]);}})[_0x70d5('0x15')](function(_0x24f0d2){logger[_0x70d5('0x12')]('Trigger,\x20%s,\x20%s',_0x38146e,_0x24f0d2);_0x1d277b(_0x24f0d2);});});}exports[_0x70d5('0x16')]=function(_0x5476b3){var _0x2f1cc0=this;return new Promise(function(_0x4444ea,_0x2be2ed){return db['Trigger'][_0x70d5('0x17')]({'raw':_0x5476b3[_0x70d5('0x18')]?_0x5476b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5476b3['options']?_0x5476b3[_0x70d5('0x18')][_0x70d5('0x19')]||null:null,'attributes':_0x5476b3[_0x70d5('0x18')]?_0x5476b3['options'][_0x70d5('0x1a')]||null:null,'limit':_0x5476b3[_0x70d5('0x18')]?_0x5476b3[_0x70d5('0x18')][_0x70d5('0x1b')]||null:null,'include':_0x5476b3[_0x70d5('0x18')]?_0x5476b3['options']['include']?_[_0x70d5('0x1c')](_0x5476b3[_0x70d5('0x18')][_0x70d5('0x1d')],function(_0x239709){return{'model':db[_0x239709[_0x70d5('0x1e')]],'as':_0x239709['as'],'attributes':_0x239709['attributes'],'include':_0x239709[_0x70d5('0x1d')]?_[_0x70d5('0x1c')](_0x239709[_0x70d5('0x1d')],function(_0x212008){return{'model':db[_0x212008['model']],'as':_0x212008['as'],'attributes':_0x212008[_0x70d5('0x1a')],'include':_0x212008['include']?_['map'](_0x212008[_0x70d5('0x1d')],function(_0x20789d){return{'model':db[_0x20789d[_0x70d5('0x1e')]],'as':_0x20789d['as'],'attributes':_0x20789d['attributes']};}):[]};}):[]};}):[]:[]})[_0x70d5('0x1f')](function(_0xb3b5d9){logger[_0x70d5('0xd')](_0x70d5('0x16'),_0x5476b3);logger[_0x70d5('0x10')](_0x70d5('0x16'),_0x5476b3,JSON['stringify'](_0xb3b5d9));_0x4444ea(_0xb3b5d9);})[_0x70d5('0x15')](function(_0x1e84cd){logger[_0x70d5('0x12')](_0x70d5('0x16'),_0x1e84cd['message'],_0x5476b3);_0x2be2ed(_0x2f1cc0['error'](0x1f4,_0x1e84cd[_0x70d5('0x14')]));});});};exports[_0x70d5('0x20')]=function(_0x58b5d2){var _0x21fcdb=this;return new Promise(function(_0x19f2d6,_0x5048b9){return db[_0x70d5('0x21')][_0x70d5('0x22')]({'raw':_0x58b5d2['options']?_0x58b5d2[_0x70d5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x58b5d2[_0x70d5('0x18')]?_0x58b5d2[_0x70d5('0x18')][_0x70d5('0x19')]||null:null,'attributes':_0x58b5d2['options']?_0x58b5d2[_0x70d5('0x18')]['attributes']||null:null,'include':_0x58b5d2[_0x70d5('0x18')]?_0x58b5d2[_0x70d5('0x18')]['include']?_[_0x70d5('0x1c')](_0x58b5d2[_0x70d5('0x18')][_0x70d5('0x1d')],function(_0x51be8a){return{'model':db[_0x51be8a[_0x70d5('0x1e')]],'as':_0x51be8a['as'],'attributes':_0x51be8a[_0x70d5('0x1a')],'include':_0x51be8a['include']?_[_0x70d5('0x1c')](_0x51be8a[_0x70d5('0x1d')],function(_0x50dafb){return{'model':db[_0x50dafb[_0x70d5('0x1e')]],'as':_0x50dafb['as'],'attributes':_0x50dafb[_0x70d5('0x1a')],'include':_0x50dafb['include']?_[_0x70d5('0x1c')](_0x50dafb[_0x70d5('0x1d')],function(_0x100403){return{'model':db[_0x100403[_0x70d5('0x1e')]],'as':_0x100403['as'],'attributes':_0x100403[_0x70d5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x70d5('0x1f')](function(_0xad2778){logger[_0x70d5('0xd')](_0x70d5('0x20'),_0x58b5d2);logger['debug'](_0x70d5('0x20'),_0x58b5d2,JSON[_0x70d5('0x23')](_0xad2778));_0x19f2d6(_0xad2778);})[_0x70d5('0x15')](function(_0x5b12c9){logger['error'](_0x70d5('0x20'),_0x5b12c9[_0x70d5('0x14')],_0x58b5d2);_0x5048b9(_0x21fcdb['error'](0x1f4,_0x5b12c9[_0x70d5('0x14')]));});});}; \ No newline at end of file +var _0x1cac=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','model','attributes','debug','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x1cac,0x1a7));var _0xc1ca=function(_0x19f9bf,_0x5e02ea){_0x19f9bf=_0x19f9bf-0x0;var _0x3276db=_0x1cac[_0x19f9bf];return _0x3276db;};'use strict';var _=require(_0xc1ca('0x0'));var util=require(_0xc1ca('0x1'));var moment=require(_0xc1ca('0x2'));var BPromise=require(_0xc1ca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1ca('0x4'));var db=require(_0xc1ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1ca('0x6'))('rpc');var config=require(_0xc1ca('0x7'));var jayson=require(_0xc1ca('0x8'));var client=jayson[_0xc1ca('0x9')][_0xc1ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x242924,_0x481b8d,_0x41fd26){return new BPromise(function(_0x2c404d,_0x28d0d5){return client[_0xc1ca('0xb')](_0x242924,_0x41fd26)[_0xc1ca('0xc')](function(_0x134e5a){logger[_0xc1ca('0xd')](_0xc1ca('0xe'),_0x481b8d,_0xc1ca('0xf'));logger['debug'](_0xc1ca('0x10'),_0x481b8d,'request\x20sent',JSON[_0xc1ca('0x11')](_0x134e5a));if(_0x134e5a[_0xc1ca('0x12')]){if(_0x134e5a[_0xc1ca('0x12')]['code']===0x1f4){logger[_0xc1ca('0x12')](_0xc1ca('0xe'),_0x481b8d,_0x134e5a[_0xc1ca('0x12')][_0xc1ca('0x13')]);return _0x28d0d5(_0x134e5a[_0xc1ca('0x12')]['message']);}logger[_0xc1ca('0x12')](_0xc1ca('0xe'),_0x481b8d,_0x134e5a[_0xc1ca('0x12')]['message']);return _0x2c404d(_0x134e5a[_0xc1ca('0x12')][_0xc1ca('0x13')]);}else{logger[_0xc1ca('0xd')]('Trigger,\x20%s,\x20%s',_0x481b8d,_0xc1ca('0xf'));_0x2c404d(_0x134e5a['result'][_0xc1ca('0x13')]);}})[_0xc1ca('0x14')](function(_0x3c51ee){logger['error'](_0xc1ca('0xe'),_0x481b8d,_0x3c51ee);_0x28d0d5(_0x3c51ee);});});}exports[_0xc1ca('0x15')]=function(_0x8fa3ad){var _0x4882ee=this;return new Promise(function(_0x45690d,_0x53ef2f){return db[_0xc1ca('0x16')][_0xc1ca('0x17')]({'raw':_0x8fa3ad['options']?_0x8fa3ad[_0xc1ca('0x18')][_0xc1ca('0x19')]===undefined?!![]:![]:!![],'where':_0x8fa3ad[_0xc1ca('0x18')]?_0x8fa3ad['options'][_0xc1ca('0x1a')]||null:null,'attributes':_0x8fa3ad['options']?_0x8fa3ad[_0xc1ca('0x18')]['attributes']||null:null,'limit':_0x8fa3ad['options']?_0x8fa3ad[_0xc1ca('0x18')]['limit']||null:null,'include':_0x8fa3ad[_0xc1ca('0x18')]?_0x8fa3ad[_0xc1ca('0x18')][_0xc1ca('0x1b')]?_[_0xc1ca('0x1c')](_0x8fa3ad[_0xc1ca('0x18')][_0xc1ca('0x1b')],function(_0x1e24b8){return{'model':db[_0x1e24b8[_0xc1ca('0x1d')]],'as':_0x1e24b8['as'],'attributes':_0x1e24b8['attributes'],'include':_0x1e24b8[_0xc1ca('0x1b')]?_['map'](_0x1e24b8['include'],function(_0xa1dac7){return{'model':db[_0xa1dac7[_0xc1ca('0x1d')]],'as':_0xa1dac7['as'],'attributes':_0xa1dac7['attributes'],'include':_0xa1dac7['include']?_[_0xc1ca('0x1c')](_0xa1dac7[_0xc1ca('0x1b')],function(_0x2adeb1){return{'model':db[_0x2adeb1[_0xc1ca('0x1d')]],'as':_0x2adeb1['as'],'attributes':_0x2adeb1[_0xc1ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1ca('0xc')](function(_0x6aa78){logger[_0xc1ca('0xd')]('GetTrigger',_0x8fa3ad);logger[_0xc1ca('0x1f')](_0xc1ca('0x15'),_0x8fa3ad,JSON[_0xc1ca('0x11')](_0x6aa78));_0x45690d(_0x6aa78);})[_0xc1ca('0x14')](function(_0x66a779){logger['error'](_0xc1ca('0x15'),_0x66a779[_0xc1ca('0x13')],_0x8fa3ad);_0x53ef2f(_0x4882ee[_0xc1ca('0x12')](0x1f4,_0x66a779[_0xc1ca('0x13')]));});});};exports[_0xc1ca('0x20')]=function(_0x2d4380){var _0x423e13=this;return new Promise(function(_0x1a1ffb,_0x1fb911){return db[_0xc1ca('0x16')]['find']({'raw':_0x2d4380[_0xc1ca('0x18')]?_0x2d4380[_0xc1ca('0x18')][_0xc1ca('0x19')]===undefined?!![]:![]:!![],'where':_0x2d4380[_0xc1ca('0x18')]?_0x2d4380[_0xc1ca('0x18')][_0xc1ca('0x1a')]||null:null,'attributes':_0x2d4380[_0xc1ca('0x18')]?_0x2d4380['options'][_0xc1ca('0x1e')]||null:null,'include':_0x2d4380[_0xc1ca('0x18')]?_0x2d4380['options'][_0xc1ca('0x1b')]?_[_0xc1ca('0x1c')](_0x2d4380[_0xc1ca('0x18')]['include'],function(_0xb4c8fe){return{'model':db[_0xb4c8fe[_0xc1ca('0x1d')]],'as':_0xb4c8fe['as'],'attributes':_0xb4c8fe['attributes'],'include':_0xb4c8fe[_0xc1ca('0x1b')]?_[_0xc1ca('0x1c')](_0xb4c8fe[_0xc1ca('0x1b')],function(_0x2afa35){return{'model':db[_0x2afa35[_0xc1ca('0x1d')]],'as':_0x2afa35['as'],'attributes':_0x2afa35['attributes'],'include':_0x2afa35[_0xc1ca('0x1b')]?_[_0xc1ca('0x1c')](_0x2afa35[_0xc1ca('0x1b')],function(_0xde9fb2){return{'model':db[_0xde9fb2[_0xc1ca('0x1d')]],'as':_0xde9fb2['as'],'attributes':_0xde9fb2[_0xc1ca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc1ca('0xc')](function(_0x3953cf){logger[_0xc1ca('0xd')]('ShowTrigger',_0x2d4380);logger[_0xc1ca('0x1f')](_0xc1ca('0x20'),_0x2d4380,JSON[_0xc1ca('0x11')](_0x3953cf));_0x1a1ffb(_0x3953cf);})['catch'](function(_0x94d4ed){logger['error'](_0xc1ca('0x20'),_0x94d4ed[_0xc1ca('0x13')],_0x2d4380);_0x1fb911(_0x423e13['error'](0x1f4,_0x94d4ed[_0xc1ca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5f2706b..6e268b0 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 _0x1d81=['clone','create','put','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','isAuthenticated','index','/:id','post','/:id/clone'];(function(_0x1af1d4,_0x3e444e){var _0x15985f=function(_0x4e77a9){while(--_0x4e77a9){_0x1af1d4['push'](_0x1af1d4['shift']());}};_0x15985f(++_0x3e444e);}(_0x1d81,0xb9));var _0x11d8=function(_0x4ec9e3,_0x15fbf4){_0x4ec9e3=_0x4ec9e3-0x0;var _0x2883ce=_0x1d81[_0x4ec9e3];return _0x2883ce;};'use strict';var multer=require(_0x11d8('0x0'));var util=require(_0x11d8('0x1'));var path=require(_0x11d8('0x2'));var timeout=require(_0x11d8('0x3'));var express=require(_0x11d8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11d8('0x5'));var interaction=require(_0x11d8('0x6'));var config=require('../../config/environment');var controller=require(_0x11d8('0x7'));router['get']('/',auth[_0x11d8('0x8')](),controller[_0x11d8('0x9')]);router['get'](_0x11d8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x11d8('0xb')](_0x11d8('0xc'),auth[_0x11d8('0x8')](),controller[_0x11d8('0xd')]);router[_0x11d8('0xb')]('/',auth[_0x11d8('0x8')](),controller[_0x11d8('0xe')]);router[_0x11d8('0xf')](_0x11d8('0xa'),auth['isAuthenticated'](),controller[_0x11d8('0x10')]);router[_0x11d8('0x11')](_0x11d8('0xa'),auth[_0x11d8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5781=['isAuthenticated','/:id','post','/:id/clone','clone','create','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get'];(function(_0x5c96b3,_0x1b834b){var _0x4250ee=function(_0x757547){while(--_0x757547){_0x5c96b3['push'](_0x5c96b3['shift']());}};_0x4250ee(++_0x1b834b);}(_0x5781,0xf1));var _0x1578=function(_0x146731,_0x39faea){_0x146731=_0x146731-0x0;var _0x2e1166=_0x5781[_0x146731];return _0x2e1166;};'use strict';var multer=require(_0x1578('0x0'));var util=require(_0x1578('0x1'));var path=require(_0x1578('0x2'));var timeout=require(_0x1578('0x3'));var express=require(_0x1578('0x4'));var router=express[_0x1578('0x5')]();var fs_extra=require(_0x1578('0x6'));var auth=require(_0x1578('0x7'));var interaction=require(_0x1578('0x8'));var config=require('../../config/environment');var controller=require(_0x1578('0x9'));router[_0x1578('0xa')]('/',auth[_0x1578('0xb')](),controller['index']);router[_0x1578('0xa')](_0x1578('0xc'),auth[_0x1578('0xb')](),controller['show']);router[_0x1578('0xd')](_0x1578('0xe'),auth[_0x1578('0xb')](),controller[_0x1578('0xf')]);router[_0x1578('0xd')]('/',auth[_0x1578('0xb')](),controller[_0x1578('0x10')]);router['put'](_0x1578('0xc'),auth[_0x1578('0xb')](),controller[_0x1578('0x11')]);router['delete'](_0x1578('0xc'),auth[_0x1578('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1c9621d..2eef973 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 _0x2433=['pai','fingerprint','passive','actpass','dynamic','nonat','sequelize','exports','STRING','name','user','peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','force_rport,comedia','setDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uac','uas'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2433,0x15d));var _0x3243=function(_0x2db568,_0x41dd87){_0x2db568=_0x2db568-0x0;var _0x565f1f=_0x2433[_0x2db568];return _0x565f1f;};'use strict';var Sequelize=require(_0x3243('0x0'));module[_0x3243('0x1')]={'name':{'type':Sequelize[_0x3243('0x2')],'allowNull':![],'unique':_0x3243('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0x3243('0x4'),_0x3243('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x3243('0x2')],'allowNull':![],'defaultValue':_0x3243('0x6')},'callingpres':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x8'),_0x3243('0x9'),_0x3243('0xa'),_0x3243('0xb'),'PROHIB_NOT_SCREENED',_0x3243('0xc'),_0x3243('0xd'),_0x3243('0xe'))},'deny':{'type':Sequelize[_0x3243('0x2')]},'permit':{'type':Sequelize[_0x3243('0x2')]},'secret':{'type':Sequelize[_0x3243('0x2')]},'md5secret':{'type':Sequelize[_0x3243('0x2')]},'remotesecret':{'type':Sequelize[_0x3243('0x2')]},'transport':{'type':Sequelize[_0x3243('0x2')],'defaultValue':_0x3243('0xf'),'set':function(_0x1c9d56){this['setDataValue']('transport',_0x1c9d56?_0x1c9d56[_0x3243('0x10')](','):null);},'get':function(){return this[_0x3243('0x11')]('transport')?this[_0x3243('0x11')]('transport')['split'](','):null;},'comment':_0x3243('0x12')},'dtmfmode':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x13'),_0x3243('0x14'),_0x3243('0x15'),_0x3243('0x16'),'auto'),'defaultValue':_0x3243('0x13')},'directmedia':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no','nonat',_0x3243('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3243('0x2')],'defaultValue':_0x3243('0x19'),'set':function(_0x341588){this[_0x3243('0x1a')](_0x3243('0x1b'),_0x341588?_0x341588[_0x3243('0x10')](','):null);},'get':function(){return this[_0x3243('0x11')](_0x3243('0x1b'))?this[_0x3243('0x11')](_0x3243('0x1b'))[_0x3243('0x1c')](','):null;},'comment':_0x3243('0x1d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x3243('0x2')]},'pickupgroup':{'type':Sequelize[_0x3243('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3243('0x2')]},'language':{'type':Sequelize[_0x3243('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3243('0x2')],'allowNull':![],'defaultValue':_0x3243('0x1e'),'set':function(_0x9c16f9){this[_0x3243('0x1a')](_0x3243('0x1f'),_0x9c16f9?_0x9c16f9[_0x3243('0x10')](';'):_0x3243('0x1e'));},'get':function(){return this[_0x3243('0x11')](_0x3243('0x1f'))?this[_0x3243('0x11')](_0x3243('0x1f'))[_0x3243('0x1c')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x3243('0x2')],'defaultValue':_0x3243('0x20'),'set':function(_0x4dbc1d){this['setDataValue'](_0x3243('0x21'),_0x4dbc1d?_0x4dbc1d[_0x3243('0x10')](','):null);},'get':function(){return this[_0x3243('0x11')](_0x3243('0x21'))?this['getDataValue']('insecure')[_0x3243('0x1c')](','):null;},'comment':_0x3243('0x22')},'trustrpid':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3243('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no',_0x3243('0x23'))},'promiscredir':{'type':Sequelize[_0x3243('0x7')]('yes','no')},'useclientcode':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'accountcode':{'type':Sequelize[_0x3243('0x24')](0xb)},'setvar':{'type':Sequelize[_0x3243('0x2')]},'callerid':{'type':Sequelize[_0x3243('0x2')],'defaultValue':_0x3243('0x25')},'amaflags':{'type':Sequelize[_0x3243('0x2')]},'callcounter':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no'),'defaultValue':_0x3243('0x17')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3243('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x3243('0x7')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x3243('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no',_0x3243('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3243('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3243('0x7')]('yes','no')},'mailbox':{'type':Sequelize[_0x3243('0x2')]},'session_timers':{'type':Sequelize[_0x3243('0x7')]('accept',_0x3243('0x27'),_0x3243('0x28'))},'session_expires':{'type':Sequelize[_0x3243('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x3243('0x29'),_0x3243('0x2a')),'defaultValue':_0x3243('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x3243('0x2')]},'regexten':{'type':Sequelize[_0x3243('0x2')]},'fromdomain':{'type':Sequelize[_0x3243('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3243('0x24')](0x5)},'qualify':{'type':Sequelize[_0x3243('0x7')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3243('0x2')]},'rtptimeout':{'type':Sequelize[_0x3243('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3243('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3243('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no',_0x3243('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3243('0x2')]},'callbackextension':{'type':Sequelize[_0x3243('0x2')]},'timert1':{'type':Sequelize[_0x3243('0x24')](0xb)},'timerb':{'type':Sequelize[_0x3243('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3243('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0x3243('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x3243('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3243('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3243('0x2')]},'maxforwards':{'type':Sequelize[_0x3243('0x24')](0xb)},'encryption':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x3243('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no',_0x3243('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3243('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3243('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3243('0x2')]},'dtlscipher':{'type':Sequelize[_0x3243('0x2')]},'dtlscafile':{'type':Sequelize[_0x3243('0x2')]},'dtlscapath':{'type':Sequelize[_0x3243('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x3243('0x2d'),_0x3243('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x3243('0x2')]},'mohsuggest':{'type':Sequelize[_0x3243('0x2')]},'parkinglot':{'type':Sequelize[_0x3243('0x2')]},'description':{'type':Sequelize[_0x3243('0x2')]},'host':{'type':Sequelize[_0x3243('0x2')],'defaultValue':_0x3243('0x2f')},'canreinvite':{'type':Sequelize[_0x3243('0x7')](_0x3243('0x17'),'no',_0x3243('0x30'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3243('0x2')]},'otherFields':{'type':Sequelize[_0x3243('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x82c3=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','friend','user','STRING','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','accept','uac','uas','pai','fingerprint','active'];(function(_0x50cb74,_0x4467f5){var _0x59eef0=function(_0x2b293a){while(--_0x2b293a){_0x50cb74['push'](_0x50cb74['shift']());}};_0x59eef0(++_0x4467f5);}(_0x82c3,0x15c));var _0x382c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x82c3[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x382c('0x0'));module[_0x382c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x382c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x382c('0x3'),_0x382c('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x382c('0x5')],'allowNull':![],'defaultValue':_0x382c('0x6')},'callingpres':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x8'),'ALLOWED_PASSED_SCREEN',_0x382c('0x9'),_0x382c('0xa'),'PROHIB_NOT_SCREENED',_0x382c('0xb'),_0x382c('0xc'),_0x382c('0xd'))},'deny':{'type':Sequelize[_0x382c('0x5')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x382c('0x5')]},'md5secret':{'type':Sequelize[_0x382c('0x5')]},'remotesecret':{'type':Sequelize[_0x382c('0x5')]},'transport':{'type':Sequelize[_0x382c('0x5')],'defaultValue':_0x382c('0xe'),'set':function(_0x58e105){this[_0x382c('0xf')]('transport',_0x58e105?_0x58e105['join'](','):null);},'get':function(){return this['getDataValue'](_0x382c('0x10'))?this[_0x382c('0x11')](_0x382c('0x10'))['split'](','):null;},'comment':_0x382c('0x12')},'dtmfmode':{'type':Sequelize[_0x382c('0x7')]('rfc2833','info',_0x382c('0x13'),_0x382c('0x14'),_0x382c('0x15')),'defaultValue':_0x382c('0x16')},'directmedia':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no',_0x382c('0x18'),_0x382c('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x382c('0x5')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x382c('0x5')],'defaultValue':'force_rport,comedia','set':function(_0x4931ca){this['setDataValue']('nat',_0x4931ca?_0x4931ca[_0x382c('0x1a')](','):null);},'get':function(){return this[_0x382c('0x11')](_0x382c('0x1b'))?this[_0x382c('0x11')](_0x382c('0x1b'))[_0x382c('0x1c')](','):null;},'comment':_0x382c('0x1d')},'callgroup':{'type':Sequelize[_0x382c('0x5')]},'namedcallgroup':{'type':Sequelize[_0x382c('0x5')]},'pickupgroup':{'type':Sequelize[_0x382c('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x382c('0x5')]},'language':{'type':Sequelize[_0x382c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x382c('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize[_0x382c('0x5')],'allowNull':![],'defaultValue':_0x382c('0x1e'),'set':function(_0x5aff11){this['setDataValue'](_0x382c('0x1f'),_0x5aff11?_0x5aff11[_0x382c('0x1a')](';'):_0x382c('0x1e'));},'get':function(){return this[_0x382c('0x11')]('allow')?this[_0x382c('0x11')](_0x382c('0x1f'))[_0x382c('0x1c')](';'):null;},'comment':_0x382c('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x506ab4){this['setDataValue']('insecure',_0x506ab4?_0x506ab4[_0x382c('0x1a')](','):null);},'get':function(){return this[_0x382c('0x11')](_0x382c('0x21'))?this['getDataValue'](_0x382c('0x21'))[_0x382c('0x1c')](','):null;},'comment':_0x382c('0x22')},'trustrpid':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no',_0x382c('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no')},'accountcode':{'type':Sequelize[_0x382c('0x24')](0xb)},'setvar':{'type':Sequelize[_0x382c('0x5')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x382c('0x25')},'amaflags':{'type':Sequelize[_0x382c('0x5')]},'callcounter':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no'),'defaultValue':_0x382c('0x17')},'busylevel':{'type':Sequelize[_0x382c('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x382c('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x382c('0x5')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x382c('0x7')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x382c('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no')},'mailbox':{'type':Sequelize[_0x382c('0x5')]},'session_timers':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x382c('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x27'),_0x382c('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x382c('0x5')]},'fromdomain':{'type':Sequelize[_0x382c('0x5')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x382c('0x24')](0x5)},'qualify':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':_0x382c('0x17')},'keepalive':{'type':Sequelize[_0x382c('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x382c('0x5')]},'defaultuser':{'type':Sequelize[_0x382c('0x5')]},'rtptimeout':{'type':Sequelize[_0x382c('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x382c('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x382c('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no',_0x382c('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x382c('0x5')]},'callbackextension':{'type':Sequelize[_0x382c('0x5')]},'timert1':{'type':Sequelize[_0x382c('0x24')](0xb)},'timerb':{'type':Sequelize[_0x382c('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x382c('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x382c('0x5')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x382c('0x5')]},'maxforwards':{'type':Sequelize[_0x382c('0x24')](0xb)},'encryption':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'icesupport':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x382c('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no',_0x382c('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x382c('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x382c('0x5')]},'dtlscipher':{'type':Sequelize[_0x382c('0x5')]},'dtlscafile':{'type':Sequelize[_0x382c('0x5')]},'dtlscapath':{'type':Sequelize[_0x382c('0x5')]},'dtlssetup':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x2b'),_0x382c('0x2c'),_0x382c('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x382c('0x7')](_0x382c('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x382c('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x382c('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize[_0x382c('0x5')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x382c('0x5')]},'parkinglot':{'type':Sequelize[_0x382c('0x5')]},'description':{'type':Sequelize[_0x382c('0x5')]},'host':{'type':Sequelize[_0x382c('0x5')],'defaultValue':_0x382c('0x2e')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x382c('0x18'),_0x382c('0x19'),_0x382c('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x382c('0x5')]},'active':{'type':Sequelize[_0x382c('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x382c('0x5')],'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 6d40b9b..d5316ca 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 _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xe5b3,0x133));var _0x3e5b=function(_0x314db8,_0x5b2155){_0x314db8=_0x314db8-0x0;var _0x2dbabf=_0xe5b3[_0x314db8];return _0x2dbabf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x58bae8,_0x2d1d6a){var _0x513459=function(_0x2ca363){while(--_0x2ca363){_0x58bae8['push'](_0x58bae8['shift']());}};_0x513459(++_0x2d1d6a);}(_0x3e74,0x175));var _0x43e7=function(_0xa76706,_0x1b633d){_0xa76706=_0xa76706-0x0;var _0x93feef=_0x3e74[_0xa76706];return _0x93feef;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e9d83f2..55b9bc9 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 _0x38e0=['lodash','util','moment','request-promise','path','./trunk.attributes','exports','define','Trunk'];(function(_0x1ecb7b,_0x126d4b){var _0x5e8c13=function(_0x4dc595){while(--_0x4dc595){_0x1ecb7b['push'](_0x1ecb7b['shift']());}};_0x5e8c13(++_0x126d4b);}(_0x38e0,0xbd));var _0x038e=function(_0x23723a,_0x593357){_0x23723a=_0x23723a-0x0;var _0x178d43=_0x38e0[_0x23723a];return _0x178d43;};'use strict';var _=require(_0x038e('0x0'));var util=require(_0x038e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x038e('0x2'));var BPromise=require('bluebird');var rp=require(_0x038e('0x3'));var fs=require('fs');var path=require(_0x038e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x038e('0x5'));module[_0x038e('0x6')]=function(_0x5c90a9,_0x1dd847){return _0x5c90a9[_0x038e('0x7')](_0x038e('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b8=['api','moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','lodash','util','../../config/logger'];(function(_0x221a0f,_0x3970f6){var _0x30309e=function(_0x2a6cf4){while(--_0x2a6cf4){_0x221a0f['push'](_0x221a0f['shift']());}};_0x30309e(++_0x3970f6);}(_0x70b8,0x15d));var _0x870b=function(_0x5cbe39,_0x2049ff){_0x5cbe39=_0x5cbe39-0x0;var _0x5b404d=_0x70b8[_0x5cbe39];return _0x5b404d;};'use strict';var _=require(_0x870b('0x0'));var util=require(_0x870b('0x1'));var logger=require(_0x870b('0x2'))(_0x870b('0x3'));var moment=require(_0x870b('0x4'));var BPromise=require('bluebird');var rp=require(_0x870b('0x5'));var fs=require('fs');var path=require(_0x870b('0x6'));var rimraf=require(_0x870b('0x7'));var config=require(_0x870b('0x8'));var attributes=require(_0x870b('0x9'));module['exports']=function(_0x263a8c,_0x58839f){return _0x263a8c[_0x870b('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index e5a3f23..9a716d0 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 _0xf961=['stringify','code','error','message','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include','model','find','where','map','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xf961,0x1f1));var _0x1f96=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xf961[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var moment=require(_0x1f96('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f96('0x4'));var logger=require('../../config/logger')(_0x1f96('0x5'));var config=require(_0x1f96('0x6'));var jayson=require(_0x1f96('0x7'));var client=jayson[_0x1f96('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7a3a3c,_0x4f5bf3,_0x5ce905){return new BPromise(function(_0x21fbc6,_0x497cfc){return client['request'](_0x7a3a3c,_0x5ce905)[_0x1f96('0x9')](function(_0x3f2103){logger[_0x1f96('0xa')](_0x1f96('0xb'),_0x4f5bf3,'request\x20sent');logger[_0x1f96('0xc')](_0x1f96('0xd'),_0x4f5bf3,_0x1f96('0xe'),JSON[_0x1f96('0xf')](_0x3f2103));if(_0x3f2103['error']){if(_0x3f2103['error'][_0x1f96('0x10')]===0x1f4){logger['error'](_0x1f96('0xb'),_0x4f5bf3,_0x3f2103[_0x1f96('0x11')][_0x1f96('0x12')]);return _0x497cfc(_0x3f2103['error'][_0x1f96('0x12')]);}logger['error'](_0x1f96('0xb'),_0x4f5bf3,_0x3f2103[_0x1f96('0x11')][_0x1f96('0x12')]);return _0x21fbc6(_0x3f2103['error'][_0x1f96('0x12')]);}else{logger[_0x1f96('0xa')](_0x1f96('0xb'),_0x4f5bf3,'request\x20sent');_0x21fbc6(_0x3f2103[_0x1f96('0x13')][_0x1f96('0x12')]);}})[_0x1f96('0x14')](function(_0x3428ad){logger[_0x1f96('0x11')]('Trunk,\x20%s,\x20%s',_0x4f5bf3,_0x3428ad);_0x497cfc(_0x3428ad);});});}exports[_0x1f96('0x15')]=function(_0x1360c1){var _0x2e06d5=this;return new Promise(function(_0x20e065,_0x8a8ce4){return db[_0x1f96('0x16')]['findAll']({'raw':_0x1360c1[_0x1f96('0x17')]?_0x1360c1[_0x1f96('0x17')][_0x1f96('0x18')]===undefined?!![]:![]:!![],'where':_0x1360c1[_0x1f96('0x17')]?_0x1360c1[_0x1f96('0x17')]['where']||null:null,'attributes':_0x1360c1[_0x1f96('0x17')]?_0x1360c1[_0x1f96('0x17')][_0x1f96('0x19')]||null:null,'limit':_0x1360c1[_0x1f96('0x17')]?_0x1360c1['options'][_0x1f96('0x1a')]||null:null,'include':_0x1360c1[_0x1f96('0x17')]?_0x1360c1[_0x1f96('0x17')][_0x1f96('0x1b')]?_['map'](_0x1360c1[_0x1f96('0x17')][_0x1f96('0x1b')],function(_0xf24832){return{'model':db[_0xf24832[_0x1f96('0x1c')]],'as':_0xf24832['as'],'attributes':_0xf24832[_0x1f96('0x19')],'include':_0xf24832[_0x1f96('0x1b')]?_['map'](_0xf24832['include'],function(_0x4a8e29){return{'model':db[_0x4a8e29[_0x1f96('0x1c')]],'as':_0x4a8e29['as'],'attributes':_0x4a8e29[_0x1f96('0x19')],'include':_0x4a8e29[_0x1f96('0x1b')]?_['map'](_0x4a8e29[_0x1f96('0x1b')],function(_0x4582ad){return{'model':db[_0x4582ad['model']],'as':_0x4582ad['as'],'attributes':_0x4582ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f96('0x9')](function(_0x42569b){logger[_0x1f96('0xa')](_0x1f96('0x15'),_0x1360c1);logger[_0x1f96('0xc')](_0x1f96('0x15'),_0x1360c1,JSON[_0x1f96('0xf')](_0x42569b));_0x20e065(_0x42569b);})['catch'](function(_0x4f7ad8){logger[_0x1f96('0x11')](_0x1f96('0x15'),_0x4f7ad8[_0x1f96('0x12')],_0x1360c1);_0x8a8ce4(_0x2e06d5[_0x1f96('0x11')](0x1f4,_0x4f7ad8[_0x1f96('0x12')]));});});};exports['ShowTrunk']=function(_0x1605ee){var _0x208782=this;return new Promise(function(_0x2bf7cc,_0x5181a8){return db['Trunk'][_0x1f96('0x1d')]({'raw':_0x1605ee[_0x1f96('0x17')]?_0x1605ee[_0x1f96('0x17')][_0x1f96('0x18')]===undefined?!![]:![]:!![],'where':_0x1605ee['options']?_0x1605ee['options'][_0x1f96('0x1e')]||null:null,'attributes':_0x1605ee[_0x1f96('0x17')]?_0x1605ee[_0x1f96('0x17')][_0x1f96('0x19')]||null:null,'include':_0x1605ee[_0x1f96('0x17')]?_0x1605ee['options'][_0x1f96('0x1b')]?_[_0x1f96('0x1f')](_0x1605ee['options'][_0x1f96('0x1b')],function(_0x321946){return{'model':db[_0x321946[_0x1f96('0x1c')]],'as':_0x321946['as'],'attributes':_0x321946['attributes'],'include':_0x321946[_0x1f96('0x1b')]?_['map'](_0x321946[_0x1f96('0x1b')],function(_0x187075){return{'model':db[_0x187075[_0x1f96('0x1c')]],'as':_0x187075['as'],'attributes':_0x187075[_0x1f96('0x19')],'include':_0x187075[_0x1f96('0x1b')]?_[_0x1f96('0x1f')](_0x187075['include'],function(_0x10cafc){return{'model':db[_0x10cafc['model']],'as':_0x10cafc['as'],'attributes':_0x10cafc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x303164){logger[_0x1f96('0xa')]('ShowTrunk',_0x1605ee);logger[_0x1f96('0xc')]('ShowTrunk',_0x1605ee,JSON[_0x1f96('0xf')](_0x303164));_0x2bf7cc(_0x303164);})[_0x1f96('0x14')](function(_0x3f5e17){logger[_0x1f96('0x11')]('ShowTrunk',_0x3f5e17[_0x1f96('0x12')],_0x1605ee);_0x5181a8(_0x208782[_0x1f96('0x11')](0x1f4,_0x3f5e17[_0x1f96('0x12')]));});});}; \ No newline at end of file +var _0xd6bb=['ShowTrunk','Trunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetTrunk','findAll','options','raw','where','attributes','map','include','model','debug','stringify'];(function(_0x4eb3ec,_0x51b871){var _0x1a3de8=function(_0x179f80){while(--_0x179f80){_0x4eb3ec['push'](_0x4eb3ec['shift']());}};_0x1a3de8(++_0x51b871);}(_0xd6bb,0x16b));var _0xbd6b=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0xd6bb[_0x1d5400];return _0x21d9fe;};'use strict';var _=require(_0xbd6b('0x0'));var util=require(_0xbd6b('0x1'));var moment=require(_0xbd6b('0x2'));var BPromise=require(_0xbd6b('0x3'));var rs=require(_0xbd6b('0x4'));var fs=require('fs');var Redis=require(_0xbd6b('0x5'));var db=require(_0xbd6b('0x6'))['db'];var utils=require(_0xbd6b('0x7'));var logger=require('../../config/logger')(_0xbd6b('0x8'));var config=require(_0xbd6b('0x9'));var jayson=require(_0xbd6b('0xa'));var client=jayson[_0xbd6b('0xb')][_0xbd6b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x502e72,_0x3de3cb,_0x1c4571){return new BPromise(function(_0x257720,_0x469c27){return client['request'](_0x502e72,_0x1c4571)[_0xbd6b('0xd')](function(_0x5f2af3){logger['info'](_0xbd6b('0xe'),_0x3de3cb,_0xbd6b('0xf'));logger['debug'](_0xbd6b('0x10'),_0x3de3cb,_0xbd6b('0xf'),JSON['stringify'](_0x5f2af3));if(_0x5f2af3['error']){if(_0x5f2af3[_0xbd6b('0x11')][_0xbd6b('0x12')]===0x1f4){logger[_0xbd6b('0x11')](_0xbd6b('0xe'),_0x3de3cb,_0x5f2af3[_0xbd6b('0x11')][_0xbd6b('0x13')]);return _0x469c27(_0x5f2af3[_0xbd6b('0x11')][_0xbd6b('0x13')]);}logger[_0xbd6b('0x11')](_0xbd6b('0xe'),_0x3de3cb,_0x5f2af3[_0xbd6b('0x11')][_0xbd6b('0x13')]);return _0x257720(_0x5f2af3[_0xbd6b('0x11')]['message']);}else{logger[_0xbd6b('0x14')](_0xbd6b('0xe'),_0x3de3cb,_0xbd6b('0xf'));_0x257720(_0x5f2af3['result'][_0xbd6b('0x13')]);}})[_0xbd6b('0x15')](function(_0xa340cf){logger[_0xbd6b('0x11')](_0xbd6b('0xe'),_0x3de3cb,_0xa340cf);_0x469c27(_0xa340cf);});});}exports[_0xbd6b('0x16')]=function(_0x467288){var _0x3d8586=this;return new Promise(function(_0x59ec24,_0x31b209){return db['Trunk'][_0xbd6b('0x17')]({'raw':_0x467288['options']?_0x467288[_0xbd6b('0x18')][_0xbd6b('0x19')]===undefined?!![]:![]:!![],'where':_0x467288[_0xbd6b('0x18')]?_0x467288['options'][_0xbd6b('0x1a')]||null:null,'attributes':_0x467288[_0xbd6b('0x18')]?_0x467288[_0xbd6b('0x18')][_0xbd6b('0x1b')]||null:null,'limit':_0x467288['options']?_0x467288['options']['limit']||null:null,'include':_0x467288[_0xbd6b('0x18')]?_0x467288[_0xbd6b('0x18')]['include']?_[_0xbd6b('0x1c')](_0x467288[_0xbd6b('0x18')][_0xbd6b('0x1d')],function(_0x4d67c3){return{'model':db[_0x4d67c3[_0xbd6b('0x1e')]],'as':_0x4d67c3['as'],'attributes':_0x4d67c3[_0xbd6b('0x1b')],'include':_0x4d67c3[_0xbd6b('0x1d')]?_['map'](_0x4d67c3[_0xbd6b('0x1d')],function(_0x1eff48){return{'model':db[_0x1eff48[_0xbd6b('0x1e')]],'as':_0x1eff48['as'],'attributes':_0x1eff48[_0xbd6b('0x1b')],'include':_0x1eff48[_0xbd6b('0x1d')]?_[_0xbd6b('0x1c')](_0x1eff48[_0xbd6b('0x1d')],function(_0x38ff41){return{'model':db[_0x38ff41[_0xbd6b('0x1e')]],'as':_0x38ff41['as'],'attributes':_0x38ff41[_0xbd6b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbd6b('0xd')](function(_0x169b95){logger['info'](_0xbd6b('0x16'),_0x467288);logger[_0xbd6b('0x1f')]('GetTrunk',_0x467288,JSON[_0xbd6b('0x20')](_0x169b95));_0x59ec24(_0x169b95);})[_0xbd6b('0x15')](function(_0x49e67f){logger[_0xbd6b('0x11')]('GetTrunk',_0x49e67f[_0xbd6b('0x13')],_0x467288);_0x31b209(_0x3d8586['error'](0x1f4,_0x49e67f[_0xbd6b('0x13')]));});});};exports[_0xbd6b('0x21')]=function(_0x5efda6){var _0x3875a3=this;return new Promise(function(_0xb73d8c,_0x787c12){return db[_0xbd6b('0x22')][_0xbd6b('0x23')]({'raw':_0x5efda6[_0xbd6b('0x18')]?_0x5efda6[_0xbd6b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5efda6[_0xbd6b('0x18')]?_0x5efda6[_0xbd6b('0x18')][_0xbd6b('0x1a')]||null:null,'attributes':_0x5efda6[_0xbd6b('0x18')]?_0x5efda6['options']['attributes']||null:null,'include':_0x5efda6['options']?_0x5efda6['options']['include']?_[_0xbd6b('0x1c')](_0x5efda6['options'][_0xbd6b('0x1d')],function(_0x111c25){return{'model':db[_0x111c25[_0xbd6b('0x1e')]],'as':_0x111c25['as'],'attributes':_0x111c25[_0xbd6b('0x1b')],'include':_0x111c25[_0xbd6b('0x1d')]?_[_0xbd6b('0x1c')](_0x111c25['include'],function(_0xa11982){return{'model':db[_0xa11982['model']],'as':_0xa11982['as'],'attributes':_0xa11982[_0xbd6b('0x1b')],'include':_0xa11982[_0xbd6b('0x1d')]?_['map'](_0xa11982[_0xbd6b('0x1d')],function(_0x548022){return{'model':db[_0x548022['model']],'as':_0x548022['as'],'attributes':_0x548022['attributes']};}):[]};}):[]};}):[]:[]})[_0xbd6b('0xd')](function(_0xd96ae3){logger[_0xbd6b('0x14')](_0xbd6b('0x21'),_0x5efda6);logger[_0xbd6b('0x1f')]('ShowTrunk',_0x5efda6,JSON['stringify'](_0xd96ae3));_0xb73d8c(_0xd96ae3);})[_0xbd6b('0x15')](function(_0x6a8de5){logger['error'](_0xbd6b('0x21'),_0x6a8de5[_0xbd6b('0x13')],_0x5efda6);_0x787c12(_0x3875a3[_0xbd6b('0x11')](0x1f4,_0x6a8de5['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 2e46b2d..9585a54 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 _0xedd1=['Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update','exports','express'];(function(_0x519cb8,_0x55f45c){var _0x2b24e0=function(_0x41c5ae){while(--_0x41c5ae){_0x519cb8['push'](_0x519cb8['shift']());}};_0x2b24e0(++_0x55f45c);}(_0xedd1,0xd7));var _0x1edd=function(_0x1b2e6b,_0x2f97fb){_0x1b2e6b=_0x1b2e6b-0x0;var _0x1dd2aa=_0xedd1[_0x1b2e6b];return _0x1dd2aa;};'use strict';var express=require(_0x1edd('0x0'));var router=express[_0x1edd('0x1')]();var auth=require(_0x1edd('0x2'));var controller=require(_0x1edd('0x3'));router['put'](_0x1edd('0x4'),auth[_0x1edd('0x5')](),controller[_0x1edd('0x6')]);module[_0x1edd('0x7')]=router; \ No newline at end of file +var _0x8dcd=['./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x198752,_0x410d18){var _0x3e749b=function(_0x55c334){while(--_0x55c334){_0x198752['push'](_0x198752['shift']());}};_0x3e749b(++_0x410d18);}(_0x8dcd,0x1e5));var _0xd8dc=function(_0x486c6f,_0x3787f3){_0x486c6f=_0x486c6f-0x0;var _0x5a9f90=_0x8dcd[_0x486c6f];return _0x5a9f90;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd8dc('0x0'));router[_0xd8dc('0x1')](_0xd8dc('0x2'),auth[_0xd8dc('0x3')](),controller[_0xd8dc('0x4')]);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 f3a94e7..9c027a0 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 _0x22fc=['exports','ENUM','DATE','INTEGER','UserId','sequelize','error','warning','debug'];(function(_0x5b901a,_0x5f02bf){var _0x5b3700=function(_0x5b04ad){while(--_0x5b04ad){_0x5b901a['push'](_0x5b901a['shift']());}};_0x5b3700(++_0x5f02bf);}(_0x22fc,0x149));var _0xc22f=function(_0x8ef7e5,_0x2d1f59){_0x8ef7e5=_0x8ef7e5-0x0;var _0x3f4fb7=_0x22fc[_0x8ef7e5];return _0x3f4fb7;};'use strict';var Sequelize=require(_0xc22f('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xc22f('0x1'),_0xc22f('0x2'),'info',_0xc22f('0x3')];module[_0xc22f('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xc22f('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xc22f('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xc22f('0x7')],'unique':_0xc22f('0x8')}}; \ No newline at end of file +var _0xd7e5=['exports','ENUM','BOOLEAN','DATE','INTEGER','sequelize','error','debug'];(function(_0x7187b3,_0x300dcf){var _0x2de873=function(_0x1ec0da){while(--_0x1ec0da){_0x7187b3['push'](_0x7187b3['shift']());}};_0x2de873(++_0x300dcf);}(_0xd7e5,0x115));var _0x5d7e=function(_0x23e54a,_0x5783e9){_0x23e54a=_0x23e54a-0x0;var _0x2fc343=_0xd7e5[_0x23e54a];return _0x2fc343;};'use strict';var Sequelize=require(_0x5d7e('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x5d7e('0x1'),'warning','info',_0x5d7e('0x2')];module[_0x5d7e('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x5d7e('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x5d7e('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x5d7e('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x5d7e('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x5d7e('0x7')],'unique':'UserId'}}; \ 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 aa4058a..edaa6a5 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 _0xe009=['role','params','UserSetting','find','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','json','update','then','sendStatus','error','name','send','user'];(function(_0x3303c4,_0x27370a){var _0x1cac00=function(_0x35cedf){while(--_0x35cedf){_0x3303c4['push'](_0x3303c4['shift']());}};_0x1cac00(++_0x27370a);}(_0xe009,0x122));var _0x9e00=function(_0x2a8511,_0xbbfe1b){_0x2a8511=_0x2a8511-0x0;var _0x1e82d7=_0xe009[_0x2a8511];return _0x1e82d7;};'use strict';var _=require(_0x9e00('0x0'));var Redis=require(_0x9e00('0x1'));var logger=require(_0x9e00('0x2'))(_0x9e00('0x3'));var config=require('../../config/environment');var db=require(_0x9e00('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x9e00('0x5')]));require(_0x9e00('0x6'))[_0x9e00('0x7')](socket);config[_0x9e00('0x5')]=_[_0x9e00('0x8')](config[_0x9e00('0x5')],{'host':_0x9e00('0x9'),'port':0x18eb});function respondWithResult(_0x402bb0,_0x22417d){_0x22417d=_0x22417d||0xc8;return function(_0x1eb956){if(_0x1eb956){return _0x402bb0['status'](_0x22417d)[_0x9e00('0xa')](_0x1eb956);}};}function saveUpdates(_0x4a5402){return function(_0x5f0f40){if(_0x5f0f40){return _0x5f0f40[_0x9e00('0xb')](_0x4a5402)[_0x9e00('0xc')](function(_0x9aa2b6){return _0x9aa2b6;});}return null;};}function handleEntityNotFound(_0x278208){return function(_0x4a73fc){if(!_0x4a73fc){_0x278208[_0x9e00('0xd')](0x194);}return _0x4a73fc;};}function handleError(_0x3fdabe,_0x1f232f){_0x1f232f=_0x1f232f||0x1f4;return function(_0x484db6){logger[_0x9e00('0xe')](_0x484db6['stack']);if(_0x484db6['name']){delete _0x484db6[_0x9e00('0xf')];}_0x3fdabe['status'](_0x1f232f)[_0x9e00('0x10')](_0x484db6);};}exports[_0x9e00('0xb')]=function(_0x1d2d17,_0x344c3e){if(_0x1d2d17[_0x9e00('0x11')][_0x9e00('0x12')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x1d2d17[_0x9e00('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x9e00('0x14')][_0x9e00('0x15')]({'where':{'id':_0x1d2d17[_0x9e00('0x13')]['id']}})[_0x9e00('0xc')](handleEntityNotFound(_0x344c3e,null))['then'](saveUpdates(_0x1d2d17['body'],null))['then'](respondWithResult(_0x344c3e,null))['catch'](handleError(_0x344c3e,null));}; \ No newline at end of file +var _0xf00e=['params','Invalid\x20user\x20setting\x20id','find','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','then','name','send','user','role','admin'];(function(_0x455953,_0x2ee57d){var _0x2d7d6b=function(_0x1453b7){while(--_0x1453b7){_0x455953['push'](_0x455953['shift']());}};_0x2d7d6b(++_0x2ee57d);}(_0xf00e,0x12f));var _0xef00=function(_0x1c1cfb,_0x37340b){_0x1c1cfb=_0x1c1cfb-0x0;var _0x4281a2=_0xf00e[_0x1c1cfb];return _0x4281a2;};'use strict';var _=require(_0xef00('0x0'));var Redis=require(_0xef00('0x1'));var logger=require(_0xef00('0x2'))(_0xef00('0x3'));var config=require(_0xef00('0x4'));var db=require(_0xef00('0x5'))['db'];var socket=require(_0xef00('0x6'))(new Redis(config[_0xef00('0x7')]));require(_0xef00('0x8'))[_0xef00('0x9')](socket);config[_0xef00('0x7')]=_[_0xef00('0xa')](config[_0xef00('0x7')],{'host':_0xef00('0xb'),'port':0x18eb});function respondWithResult(_0x254f2e,_0x17ec9e){_0x17ec9e=_0x17ec9e||0xc8;return function(_0x2245a3){if(_0x2245a3){return _0x254f2e[_0xef00('0xc')](_0x17ec9e)['json'](_0x2245a3);}};}function saveUpdates(_0x1d3b1c){return function(_0x493ea7){if(_0x493ea7){return _0x493ea7['update'](_0x1d3b1c)[_0xef00('0xd')](function(_0x4f8db3){return _0x4f8db3;});}return null;};}function handleEntityNotFound(_0x4f01bc){return function(_0xc380a6){if(!_0xc380a6){_0x4f01bc['sendStatus'](0x194);}return _0xc380a6;};}function handleError(_0x2c9c22,_0x3a7b21){_0x3a7b21=_0x3a7b21||0x1f4;return function(_0x5dba5b){logger['error'](_0x5dba5b['stack']);if(_0x5dba5b['name']){delete _0x5dba5b[_0xef00('0xe')];}_0x2c9c22['status'](_0x3a7b21)[_0xef00('0xf')](_0x5dba5b);};}exports['update']=function(_0x2e693f,_0x41cd9c){if(_0x2e693f[_0xef00('0x10')][_0xef00('0x11')]!==_0xef00('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x2e693f[_0xef00('0x13')]['id'])))throw new Error(_0xef00('0x14'));return db['UserSetting'][_0xef00('0x15')]({'where':{'id':_0x2e693f[_0xef00('0x13')]['id']}})[_0xef00('0xd')](handleEntityNotFound(_0x41cd9c,null))[_0xef00('0xd')](saveUpdates(_0x2e693f['body'],null))[_0xef00('0xd')](respondWithResult(_0x41cd9c,null))[_0xef00('0x16')](handleError(_0x41cd9c,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 fb63a47..528943e 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 _0x0522=['UserSetting','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4029a7,_0x30828e){var _0x3e9a67=function(_0x3416b3){while(--_0x3416b3){_0x4029a7['push'](_0x4029a7['shift']());}};_0x3e9a67(++_0x30828e);}(_0x0522,0x94));var _0x2052=function(_0x3c6ee3,_0x21c96f){_0x3c6ee3=_0x3c6ee3-0x0;var _0x2b8461=_0x0522[_0x3c6ee3];return _0x2b8461;};'use strict';var EventEmitter=require(_0x2052('0x0'));var UserSetting=require(_0x2052('0x1'))['db'][_0x2052('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2052('0x3')](0x0);var events={'afterCreate':_0x2052('0x4'),'afterUpdate':'update','afterDestroy':_0x2052('0x5')};function emitEvent(_0x293c6d){return function(_0x15c5e5,_0x3adf2e,_0x12cb21){UserSettingEvents[_0x2052('0x6')](_0x293c6d+':'+_0x15c5e5['id'],_0x15c5e5);UserSettingEvents[_0x2052('0x6')](_0x293c6d,_0x15c5e5);_0x12cb21(null);};}for(var e in events){if(events[_0x2052('0x7')](e)){var event=events[e];UserSetting[_0x2052('0x8')](e,emitEvent(event));}}module[_0x2052('0x9')]=UserSettingEvents; \ No newline at end of file +var _0x0e90=['../../mysqldb','UserSetting','update','remove','emit','hasOwnProperty','exports'];(function(_0xa1e6d2,_0x1e1f7e){var _0x4d63ec=function(_0x51851b){while(--_0x51851b){_0xa1e6d2['push'](_0xa1e6d2['shift']());}};_0x4d63ec(++_0x1e1f7e);}(_0x0e90,0x1ce));var _0x00e9=function(_0x29c8bf,_0x294fb6){_0x29c8bf=_0x29c8bf-0x0;var _0x557430=_0x0e90[_0x29c8bf];return _0x557430;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x00e9('0x0'))['db'][_0x00e9('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x00e9('0x2'),'afterDestroy':_0x00e9('0x3')};function emitEvent(_0x398240){return function(_0x2aee5e,_0x9ce7d0,_0x546dec){UserSettingEvents['emit'](_0x398240+':'+_0x2aee5e['id'],_0x2aee5e);UserSettingEvents[_0x00e9('0x4')](_0x398240,_0x2aee5e);_0x546dec(null);};}for(var e in events){if(events[_0x00e9('0x5')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x00e9('0x6')]=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 cf11463..d71fe9d 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 _0xa75b=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa75b,0x170));var _0xba75=function(_0x216d84,_0xe13f36){_0x216d84=_0x216d84-0x0;var _0xd9bb1d=_0xa75b[_0x216d84];return _0xd9bb1d;};'use strict';var attributes=require(_0xba75('0x0'));module['exports']=function(_0x546e14){return _0x546e14[_0xba75('0x1')](_0xba75('0x2'),attributes,{'tableName':_0xba75('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3cde96){if(!_0x3cde96[_0xba75('0x4')])_0x3cde96[_0xba75('0x5')]=null;else if(_0x3cde96[_0xba75('0x5')]===null)_0x3cde96[_0xba75('0x5')]=new Date();}}});}; \ No newline at end of file +var _0xe3db=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x5c6d2f,_0x2f09be){var _0x105bc2=function(_0x8f4ee2){while(--_0x8f4ee2){_0x5c6d2f['push'](_0x5c6d2f['shift']());}};_0x105bc2(++_0x2f09be);}(_0xe3db,0xc8));var _0xbe3d=function(_0x5ce80e,_0x465124){_0x5ce80e=_0x5ce80e-0x0;var _0x1c40bd=_0xe3db[_0x5ce80e];return _0x1c40bd;};'use strict';var attributes=require(_0xbe3d('0x0'));module[_0xbe3d('0x1')]=function(_0x50b3ff){return _0x50b3ff[_0xbe3d('0x2')](_0xbe3d('0x3'),attributes,{'tableName':_0xbe3d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x411429){if(!_0x411429[_0xbe3d('0x5')])_0x411429[_0xbe3d('0x6')]=null;else if(_0x411429[_0xbe3d('0x6')]===null)_0x411429[_0xbe3d('0x6')]=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 360e0fe..34188fb 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 _0x6d47=['save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events'];(function(_0x26a391,_0x4476d6){var _0x171347=function(_0x9c113){while(--_0x9c113){_0x26a391['push'](_0x26a391['shift']());}};_0x171347(++_0x4476d6);}(_0x6d47,0x8b));var _0x76d4=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x6d47[_0x1ddedd];return _0xa3e1ac;};'use strict';var UserSettingEvents=require(_0x76d4('0x0'));var events=[_0x76d4('0x1'),_0x76d4('0x2'),_0x76d4('0x3')];function createListener(_0x5a1afb,_0x499ca8){return function(_0x29d5bc){_0x499ca8[_0x76d4('0x4')](_0x5a1afb,_0x29d5bc);if(_0x5a1afb===_0x76d4('0x5')){_0x499ca8[_0x76d4('0x4')](_0x76d4('0x6')+_0x29d5bc[_0x76d4('0x7')],_0x29d5bc);}};}exports[_0x76d4('0x8')]=function(_0x4da617){for(var _0x49ee41=0x0,_0x61129d=events['length'];_0x49ee41<_0x61129d;_0x49ee41++){var _0x47d70b=events[_0x49ee41];var _0x4bd4f5=createListener(_0x76d4('0x9')+_0x47d70b,_0x4da617);UserSettingEvents['on'](_0x47d70b,_0x4bd4f5);}}; \ No newline at end of file +var _0x50af=['register','length','user-setting:','./user-setting.events','save','remove','user-setting:update','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50af,0x1e3));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var UserSettingEvents=require(_0xf50a('0x0'));var events=[_0xf50a('0x1'),_0xf50a('0x2'),'update'];function createListener(_0x5e4118,_0x55c52f){return function(_0x37f534){_0x55c52f['emit'](_0x5e4118,_0x37f534);if(_0x5e4118===_0xf50a('0x3')){_0x55c52f['emit']('user-setting:update:user-'+_0x37f534[_0xf50a('0x4')],_0x37f534);}};}exports[_0xf50a('0x5')]=function(_0x1f31c7){for(var _0x25c780=0x0,_0xccf5de=events[_0xf50a('0x6')];_0x25c780<_0xccf5de;_0x25c780++){var _0x327a7e=events[_0x25c780];var _0x446f67=createListener(_0xf50a('0x7')+_0x327a7e,_0x1f31c7);UserSettingEvents['on'](_0x327a7e,_0x446f67);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a9cc780..e10681a 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 _0x7c65=['getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','bulkCreate','join','root','format','%s-%s','now','single','file','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','/:id/queues','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeSquareProjects','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues'];(function(_0x154eda,_0x118727){var _0x45db0c=function(_0x57aeab){while(--_0x57aeab){_0x154eda['push'](_0x154eda['shift']());}};_0x45db0c(++_0x118727);}(_0x7c65,0x13c));var _0x57c6=function(_0x1f83ec,_0xdb6dbb){_0x1f83ec=_0x1f83ec-0x0;var _0x5d328d=_0x7c65[_0x1f83ec];return _0x5d328d;};'use strict';var multer=require(_0x57c6('0x0'));var util=require('util');var path=require(_0x57c6('0x1'));var timeout=require(_0x57c6('0x2'));var express=require(_0x57c6('0x3'));var router=express['Router']();var fs_extra=require(_0x57c6('0x4'));var auth=require(_0x57c6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x57c6('0x6'));var controller=require('./user.controller');router[_0x57c6('0x7')]('/',auth[_0x57c6('0x8')](),controller[_0x57c6('0x9')]);router[_0x57c6('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x57c6('0xa')]);router[_0x57c6('0x7')](_0x57c6('0xb'),auth['isAuthenticated'](),controller[_0x57c6('0xc')]);router[_0x57c6('0x7')](_0x57c6('0xd'),auth[_0x57c6('0x8')](),controller[_0x57c6('0xe')]);router[_0x57c6('0x7')](_0x57c6('0xf'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x10')]);router[_0x57c6('0x7')](_0x57c6('0x11'),controller['getAvatar']);router[_0x57c6('0x7')](_0x57c6('0x12'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x13')]);router[_0x57c6('0x7')](_0x57c6('0x14'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x15')]);router[_0x57c6('0x7')]('/:id/queues',auth[_0x57c6('0x8')](),controller[_0x57c6('0x16')]);router[_0x57c6('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x57c6('0x17')]);router['get'](_0x57c6('0x18'),auth['isAuthenticated'](),controller['getGroups']);router[_0x57c6('0x7')](_0x57c6('0x19'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x1a')]);router['get']('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x57c6('0x1b')]);router[_0x57c6('0x7')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x57c6('0x1c')]);router[_0x57c6('0x7')](_0x57c6('0x1d'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x1e')]);router[_0x57c6('0x7')]('/:id/mail/interactions',auth[_0x57c6('0x8')](),controller[_0x57c6('0x1f')]);router[_0x57c6('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x57c6('0x20')]);router[_0x57c6('0x7')](_0x57c6('0x21'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x22')]);router[_0x57c6('0x7')](_0x57c6('0x23'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x24')]);router[_0x57c6('0x7')](_0x57c6('0x25'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x26')]);router[_0x57c6('0x7')](_0x57c6('0x27'),auth[_0x57c6('0x8')](),controller['getLists']);router[_0x57c6('0x7')](_0x57c6('0x28'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x29')]);router['get'](_0x57c6('0x2a'),auth['isAuthenticated'](),controller[_0x57c6('0x2b')]);router[_0x57c6('0x7')](_0x57c6('0x2c'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x2d')]);router['get'](_0x57c6('0x2e'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x2f')]);router[_0x57c6('0x7')](_0x57c6('0x30'),auth['isAuthenticated'](),controller[_0x57c6('0x31')]);router[_0x57c6('0x7')](_0x57c6('0x32'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x57c6('0x7')](_0x57c6('0x33'),auth['isAuthenticated'](),controller[_0x57c6('0x34')]);router[_0x57c6('0x7')](_0x57c6('0x35'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0x57c6('0x7')](_0x57c6('0x36'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x37')]);router[_0x57c6('0x7')](_0x57c6('0x38'),auth['isAuthenticated'](),controller[_0x57c6('0x39')]);router['get'](_0x57c6('0x3a'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x3b')]);router['post'](_0x57c6('0x14'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x3c')]);router['post']('/',auth[_0x57c6('0x8')](),controller[_0x57c6('0x3d')]);router[_0x57c6('0x3e')](_0x57c6('0x3f'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x40')]);router['post']('/:id/queues',auth[_0x57c6('0x8')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cfec8,_0x102a5b,_0x5eecc0){_0x5eecc0(null,path[_0x57c6('0x41')](config[_0x57c6('0x42')],'server/files/images/'));},'filename':function(_0x49fab1,_0x5f9377,_0x3087d2){_0x3087d2(null,util[_0x57c6('0x43')](_0x57c6('0x44'),Date[_0x57c6('0x45')](),_0x5f9377['originalname']));}})});router['post'](_0x57c6('0x11'),upload[_0x57c6('0x46')](_0x57c6('0x47')),controller['addAvatar']);router[_0x57c6('0x3e')](_0x57c6('0x48'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x49')]);router[_0x57c6('0x3e')](_0x57c6('0x4a'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x4b')]);router['post']('/:id/pause',auth[_0x57c6('0x8')](),controller[_0x57c6('0x4c')]);router[_0x57c6('0x3e')](_0x57c6('0x4d'),auth[_0x57c6('0x8')](),controller['unpause']);router[_0x57c6('0x3e')](_0x57c6('0x25'),auth['isAuthenticated'](),controller['addTeams']);router[_0x57c6('0x3e')]('/:id/chat_interactions',auth[_0x57c6('0x8')](),controller[_0x57c6('0x4e')]);router[_0x57c6('0x3e')](_0x57c6('0x4f'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x50')]);router[_0x57c6('0x3e')](_0x57c6('0x51'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x52')]);router['post'](_0x57c6('0x53'),auth['isAuthenticated'](),controller[_0x57c6('0x54')]);router[_0x57c6('0x3e')](_0x57c6('0x55'),auth['isAuthenticated'](),controller[_0x57c6('0x56')]);router[_0x57c6('0x3e')](_0x57c6('0x57'),auth['isAuthenticated'](),controller[_0x57c6('0x58')]);router[_0x57c6('0x3e')](_0x57c6('0x2c'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x59')]);router[_0x57c6('0x3e')](_0x57c6('0x2e'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x5a')]);router['post'](_0x57c6('0x30'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x5b')]);router['post'](_0x57c6('0x32'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x5c')]);router[_0x57c6('0x3e')](_0x57c6('0x33'),auth[_0x57c6('0x8')](),controller['addChatWebsites']);router[_0x57c6('0x3e')](_0x57c6('0x35'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x5d')]);router[_0x57c6('0x3e')](_0x57c6('0x36'),auth[_0x57c6('0x8')](),controller['addSquareProjects']);router[_0x57c6('0x3e')](_0x57c6('0x3a'),auth['isAuthenticated'](),controller[_0x57c6('0x5e')]);router[_0x57c6('0x5f')](_0x57c6('0xf'),auth[_0x57c6('0x8')](),controller['update']);router['put'](_0x57c6('0x60'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x61')]);router[_0x57c6('0x62')](_0x57c6('0x63'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x57c6('0x62')](_0x57c6('0x25'),auth[_0x57c6('0x8')](),controller['removeTeams']);router['delete'](_0x57c6('0xf'),auth['isAuthenticated'](),controller[_0x57c6('0x64')]);router[_0x57c6('0x62')](_0x57c6('0x65'),auth['isAuthenticated'](),controller[_0x57c6('0x66')]);router[_0x57c6('0x62')]('/:id/mail_interactions',auth[_0x57c6('0x8')](),controller[_0x57c6('0x67')]);router[_0x57c6('0x62')](_0x57c6('0x51'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x68')]);router[_0x57c6('0x62')]('/:id/sms_interactions',auth[_0x57c6('0x8')](),controller[_0x57c6('0x69')]);router[_0x57c6('0x62')](_0x57c6('0x55'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x6a')]);router[_0x57c6('0x62')](_0x57c6('0x57'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x6b')]);router['delete'](_0x57c6('0x2c'),auth[_0x57c6('0x8')](),controller['removeFaxAccounts']);router[_0x57c6('0x62')](_0x57c6('0x2e'),auth[_0x57c6('0x8')](),controller[_0x57c6('0x6c')]);router[_0x57c6('0x62')](_0x57c6('0x30'),auth['isAuthenticated'](),controller[_0x57c6('0x6d')]);router[_0x57c6('0x62')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x57c6('0x6e')]);router[_0x57c6('0x62')](_0x57c6('0x33'),auth[_0x57c6('0x8')](),controller['removeChatWebsites']);router[_0x57c6('0x62')](_0x57c6('0x35'),auth[_0x57c6('0x8')](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth[_0x57c6('0x8')](),controller[_0x57c6('0x6f')]);router[_0x57c6('0x62')](_0x57c6('0x3a'),auth[_0x57c6('0x8')](),controller['removeApiKey']);module[_0x57c6('0x70')]=router; \ No newline at end of file +var _0x232c=['getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','create','/create_many','join','server/files/images/','format','%s-%s','single','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','/:id/whatsapp_accounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions'];(function(_0x179d14,_0x39b315){var _0x43f681=function(_0x2e6784){while(--_0x2e6784){_0x179d14['push'](_0x179d14['shift']());}};_0x43f681(++_0x39b315);}(_0x232c,0x133));var _0xc232=function(_0x5bc5e7,_0x1036f4){_0x5bc5e7=_0x5bc5e7-0x0;var _0x4e7c7b=_0x232c[_0x5bc5e7];return _0x4e7c7b;};'use strict';var multer=require(_0xc232('0x0'));var util=require('util');var path=require(_0xc232('0x1'));var timeout=require(_0xc232('0x2'));var express=require(_0xc232('0x3'));var router=express[_0xc232('0x4')]();var fs_extra=require(_0xc232('0x5'));var auth=require(_0xc232('0x6'));var interaction=require(_0xc232('0x7'));var config=require(_0xc232('0x8'));var controller=require(_0xc232('0x9'));router[_0xc232('0xa')]('/',auth['isAuthenticated'](),controller[_0xc232('0xb')]);router['get'](_0xc232('0xc'),auth[_0xc232('0xd')](),controller[_0xc232('0xe')]);router['get'](_0xc232('0xf'),auth['isAuthenticated'](),controller[_0xc232('0x10')]);router[_0xc232('0xa')](_0xc232('0x11'),auth[_0xc232('0xd')](),controller[_0xc232('0x12')]);router[_0xc232('0xa')](_0xc232('0x13'),auth[_0xc232('0xd')](),controller[_0xc232('0x14')]);router[_0xc232('0xa')](_0xc232('0x15'),controller['getAvatar']);router['get'](_0xc232('0x16'),auth[_0xc232('0xd')](),controller['getOpenTabs']);router['get']('/:id/contacts',auth[_0xc232('0xd')](),controller['getContacts']);router[_0xc232('0xa')](_0xc232('0x17'),auth[_0xc232('0xd')](),controller[_0xc232('0x18')]);router[_0xc232('0xa')](_0xc232('0x19'),auth[_0xc232('0xd')](),controller[_0xc232('0x1a')]);router[_0xc232('0xa')](_0xc232('0x1b'),auth['isAuthenticated'](),controller[_0xc232('0x1c')]);router[_0xc232('0xa')]('/:id/recordings',auth['isAuthenticated'](),controller[_0xc232('0x1d')]);router[_0xc232('0xa')](_0xc232('0x1e'),auth['isAuthenticated'](),controller[_0xc232('0x1f')]);router[_0xc232('0xa')](_0xc232('0x20'),auth[_0xc232('0xd')](),controller[_0xc232('0x21')]);router['get'](_0xc232('0x22'),auth['isAuthenticated'](),controller[_0xc232('0x23')]);router[_0xc232('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xc232('0x24')]);router[_0xc232('0xa')](_0xc232('0x25'),auth[_0xc232('0xd')](),controller[_0xc232('0x26')]);router[_0xc232('0xa')](_0xc232('0x27'),auth[_0xc232('0xd')](),controller['getFaxInteractions']);router[_0xc232('0xa')](_0xc232('0x28'),auth[_0xc232('0xd')](),controller['getWhatsappInteractions']);router[_0xc232('0xa')](_0xc232('0x29'),auth[_0xc232('0xd')](),controller[_0xc232('0x2a')]);router[_0xc232('0xa')](_0xc232('0x2b'),auth['isAuthenticated'](),controller[_0xc232('0x2c')]);router['get']('/:id/agents',auth[_0xc232('0xd')](),controller['getAgents']);router['get'](_0xc232('0x2d'),auth[_0xc232('0xd')](),controller[_0xc232('0x2e')]);router[_0xc232('0xa')](_0xc232('0x2f'),auth['isAuthenticated'](),controller[_0xc232('0x30')]);router['get'](_0xc232('0x31'),auth[_0xc232('0xd')](),controller['getMailAccounts']);router[_0xc232('0xa')](_0xc232('0x32'),auth[_0xc232('0xd')](),controller['getOpenchannelAccounts']);router[_0xc232('0xa')](_0xc232('0x33'),auth[_0xc232('0xd')](),controller[_0xc232('0x34')]);router['get']('/:id/chat_websites',auth[_0xc232('0xd')](),controller['getChatWebsites']);router[_0xc232('0xa')]('/:id/whatsapp_accounts',auth[_0xc232('0xd')](),controller[_0xc232('0x35')]);router[_0xc232('0xa')](_0xc232('0x36'),auth[_0xc232('0xd')](),controller[_0xc232('0x37')]);router[_0xc232('0xa')](_0xc232('0x38'),auth[_0xc232('0xd')](),controller[_0xc232('0x39')]);router[_0xc232('0xa')](_0xc232('0x3a'),auth['isAuthenticated'](),controller['getApiKey']);router[_0xc232('0x3b')](_0xc232('0x3c'),auth[_0xc232('0xd')](),controller[_0xc232('0x3d')]);router[_0xc232('0x3b')]('/',auth[_0xc232('0xd')](),controller[_0xc232('0x3e')]);router[_0xc232('0x3b')](_0xc232('0x3f'),auth[_0xc232('0xd')](),controller['bulkCreate']);router[_0xc232('0x3b')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cdd24,_0x927e47,_0x5e162b){_0x5e162b(null,path[_0xc232('0x40')](config['root'],_0xc232('0x41')));},'filename':function(_0x512ffc,_0x298ee1,_0x117fc7){_0x117fc7(null,util[_0xc232('0x42')](_0xc232('0x43'),Date['now'](),_0x298ee1['originalname']));}})});router[_0xc232('0x3b')](_0xc232('0x15'),upload[_0xc232('0x44')]('file'),controller[_0xc232('0x45')]);router['post'](_0xc232('0x46'),auth[_0xc232('0xd')](),controller[_0xc232('0x47')]);router[_0xc232('0x3b')]('/:id/logout',auth['isAuthenticated'](),controller[_0xc232('0x48')]);router[_0xc232('0x3b')](_0xc232('0x49'),auth[_0xc232('0xd')](),controller[_0xc232('0x4a')]);router[_0xc232('0x3b')](_0xc232('0x4b'),auth[_0xc232('0xd')](),controller[_0xc232('0x4c')]);router[_0xc232('0x3b')](_0xc232('0x29'),auth[_0xc232('0xd')](),controller[_0xc232('0x4d')]);router[_0xc232('0x3b')](_0xc232('0x4e'),auth['isAuthenticated'](),controller[_0xc232('0x4f')]);router[_0xc232('0x3b')](_0xc232('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0xc232('0x3b')](_0xc232('0x51'),auth[_0xc232('0xd')](),controller['addFaxInteractions']);router[_0xc232('0x3b')](_0xc232('0x52'),auth[_0xc232('0xd')](),controller[_0xc232('0x53')]);router[_0xc232('0x3b')](_0xc232('0x54'),auth['isAuthenticated'](),controller[_0xc232('0x55')]);router[_0xc232('0x3b')](_0xc232('0x56'),auth[_0xc232('0xd')](),controller[_0xc232('0x57')]);router[_0xc232('0x3b')]('/:id/fax_accounts',auth[_0xc232('0xd')](),controller[_0xc232('0x58')]);router[_0xc232('0x3b')]('/:id/mail_accounts',auth[_0xc232('0xd')](),controller[_0xc232('0x59')]);router['post'](_0xc232('0x32'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0xc232('0x3b')](_0xc232('0x33'),auth[_0xc232('0xd')](),controller[_0xc232('0x5a')]);router[_0xc232('0x3b')]('/:id/chat_websites',auth[_0xc232('0xd')](),controller['addChatWebsites']);router[_0xc232('0x3b')](_0xc232('0x5b'),auth[_0xc232('0xd')](),controller['addWhatsappAccounts']);router['post']('/:id/square_projects',auth[_0xc232('0xd')](),controller[_0xc232('0x5c')]);router[_0xc232('0x3b')]('/:id/api_key',auth[_0xc232('0xd')](),controller[_0xc232('0x5d')]);router[_0xc232('0x5e')]('/:id',auth[_0xc232('0xd')](),controller[_0xc232('0x5f')]);router[_0xc232('0x5e')](_0xc232('0x60'),auth[_0xc232('0xd')](),controller[_0xc232('0x61')]);router[_0xc232('0x62')](_0xc232('0x17'),auth[_0xc232('0xd')](),controller[_0xc232('0x63')]);router[_0xc232('0x62')]('/:id/teams',auth[_0xc232('0xd')](),controller[_0xc232('0x64')]);router[_0xc232('0x62')](_0xc232('0x13'),auth[_0xc232('0xd')](),controller['destroy']);router[_0xc232('0x62')](_0xc232('0x4e'),auth[_0xc232('0xd')](),controller['removeChatInteractions']);router[_0xc232('0x62')](_0xc232('0x50'),auth[_0xc232('0xd')](),controller[_0xc232('0x65')]);router['delete']('/:id/fax_interactions',auth[_0xc232('0xd')](),controller[_0xc232('0x66')]);router['delete'](_0xc232('0x52'),auth[_0xc232('0xd')](),controller[_0xc232('0x67')]);router[_0xc232('0x62')](_0xc232('0x54'),auth[_0xc232('0xd')](),controller[_0xc232('0x68')]);router[_0xc232('0x62')](_0xc232('0x56'),auth[_0xc232('0xd')](),controller[_0xc232('0x69')]);router['delete']('/:id/fax_accounts',auth[_0xc232('0xd')](),controller[_0xc232('0x6a')]);router[_0xc232('0x62')](_0xc232('0x31'),auth[_0xc232('0xd')](),controller[_0xc232('0x6b')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xc232('0x6c')]);router[_0xc232('0x62')]('/:id/sms_accounts',auth[_0xc232('0xd')](),controller[_0xc232('0x6d')]);router['delete'](_0xc232('0x6e'),auth[_0xc232('0xd')](),controller[_0xc232('0x6f')]);router[_0xc232('0x62')](_0xc232('0x5b'),auth[_0xc232('0xd')](),controller['removeWhatsappAccounts']);router['delete'](_0xc232('0x36'),auth[_0xc232('0xd')](),controller[_0xc232('0x70')]);router[_0xc232('0x62')]('/:id/api_key',auth[_0xc232('0xd')](),controller[_0xc232('0x71')]);module[_0xc232('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a830c7c..4f20049 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 _0xe706=['admin','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','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','insecure','\x22\x22\x20<>','always','accept','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blocked','blockedAt','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM'];(function(_0x2b7a02,_0x162333){var _0x1a21fe=function(_0x547c1c){while(--_0x547c1c){_0x2b7a02['push'](_0x2b7a02['shift']());}};_0x1a21fe(++_0x162333);}(_0xe706,0xa3));var _0x6e70=function(_0x44497f,_0x528bdc){_0x44497f=_0x44497f-0x0;var _0x37a190=_0xe706[_0x44497f];return _0x37a190;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var _=require('lodash');module[_0x6e70('0x3')]={'name':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7dfbc3){this[_0x6e70('0x6')](_0x6e70('0x5'),_0x7dfbc3);this[_0x6e70('0x6')](_0x6e70('0x7'),_0x7dfbc3);},'comment':_0x6e70('0x8')},'fullname':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'set':function(_0x36357b){this[_0x6e70('0x6')](_0x6e70('0x9'),_0x36357b);this[_0x6e70('0x6')](_0x6e70('0xa'),util[_0x6e70('0xb')](_0x6e70('0xc'),_0x36357b,this[_0x6e70('0xd')](_0x6e70('0xe'))));}},'alias':{'type':Sequelize[_0x6e70('0x4')]},'email':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'unique':_0x6e70('0xf'),'validate':{'isEmail':!![]},'set':function(_0x37b3e0){if(_0x37b3e0){this[_0x6e70('0x6')]('email',_0x37b3e0['toLowerCase']());}}},'role':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x11'),_0x6e70('0x12'),_0x6e70('0x13'),_0x6e70('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':_0x6e70('0x15')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x48bc72){this[_0x6e70('0x6')]('internal',_0x48bc72);this['setDataValue'](_0x6e70('0x16'),_0x48bc72);this[_0x6e70('0x6')]('callerid',util[_0x6e70('0xb')]('\x22%s\x22\x20<%s>',this[_0x6e70('0xd')](_0x6e70('0x9')),_0x48bc72));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x6e70('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6e70('0x4')]},'userpic':{'type':Sequelize[_0x6e70('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6e70('0x18')]},'voicePause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6e70('0x18')]},'chatCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x1a')},'ipaddr':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x6e70('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1b'),'user',_0x6e70('0x1c')),'allowNull':!![],'defaultValue':_0x6e70('0x1b')},'context':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x1d')},'callingpres':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x1e'),_0x6e70('0x1f'),_0x6e70('0x20'),_0x6e70('0x21'),_0x6e70('0x22'),'PROHIB_PASSED_SCREEN',_0x6e70('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x24'),'set':function(_0x42b094){this['setDataValue'](_0x6e70('0x25'),_0x42b094?_0x42b094[_0x6e70('0x26')](','):null);},'get':function(){return this['getDataValue'](_0x6e70('0x25'))?this[_0x6e70('0xd')](_0x6e70('0x25'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x28')},'dtmfmode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x29'),_0x6e70('0x2a'),_0x6e70('0x2b'),_0x6e70('0x2c'),'auto'),'allowNull':!![],'defaultValue':_0x6e70('0x29')},'directmedia':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no',_0x6e70('0x2e'),_0x6e70('0x2f'),_0x6e70('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'defaultValue':_0x6e70('0x31'),'set':function(_0x2a5444){this[_0x6e70('0x6')](_0x6e70('0x32'),_0x2a5444?_0x2a5444['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x6e70('0xd')](_0x6e70('0x32'))[_0x6e70('0x27')](','):null;},'comment':_0x6e70('0x33')},'callgroup':{'type':Sequelize[_0x6e70('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6e70('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6e70('0x4')]},'language':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6e70('0x4')]},'disallow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x34')},'allow':{'type':Sequelize[_0x6e70('0x4')],'allowNull':![],'defaultValue':_0x6e70('0x35'),'set':function(_0x16fc7d){this['setDataValue'](_0x6e70('0x36'),_0x16fc7d?_0x16fc7d[_0x6e70('0x26')](';'):_0x6e70('0x35'));},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x36'))?this[_0x6e70('0xd')](_0x6e70('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![],'set':function(_0x83847b){this[_0x6e70('0x6')](_0x6e70('0x37'),_0x83847b?_0x83847b['join'](','):null);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x37'))?this[_0x6e70('0xd')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6e70('0x38')},'amaflags':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x6e70('0x2d')},'busylevel':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6e70('0x10')]('yes','no',_0x6e70('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3a'),'refuse','originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3b'),_0x6e70('0x3c')),'allowNull':!![],'defaultValue':_0x6e70('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','fingerprint',_0x6e70('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x3e'),_0x6e70('0x3f'),_0x6e70('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6e70('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6e70('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no','nonat',_0x6e70('0x2f'),_0x6e70('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6e70('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6e70('0x18')]},'passwordResetAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2f9be4){this[_0x6e70('0x6')](_0x6e70('0x42'),_0x2f9be4);var _0x41a861=this[_0x6e70('0x43')]({'plain':!![]});switch(_0x2f9be4){case 0x0:case 0x1:var _0x739946=_0x41a861[_0x6e70('0x25')]?_['isArray'](_0x41a861['transport'])?_0x41a861[_0x6e70('0x25')][_0x6e70('0x26')]():_0x41a861[_0x6e70('0x25')]:_0x6e70('0x24');if(_0x739946==='wss'){_0x739946='udp';}this[_0x6e70('0x6')](_0x6e70('0x25'),_0x739946);this['setDataValue']('encryption','no');this[_0x6e70('0x6')]('avpf',null);this[_0x6e70('0x6')](_0x6e70('0x44'),null);this[_0x6e70('0x6')](_0x6e70('0x45'),null);this[_0x6e70('0x6')](_0x6e70('0x46'),null);this[_0x6e70('0x6')](_0x6e70('0x47'),null);this['setDataValue'](_0x6e70('0x48'),null);this[_0x6e70('0x6')](_0x6e70('0x49'),null);this[_0x6e70('0x6')](_0x6e70('0x4a'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x6e70('0x25'),_0x6e70('0x4b'));this[_0x6e70('0x6')]('encryption','yes');this[_0x6e70('0x6')](_0x6e70('0x4c'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x44'),_0x6e70('0x2d'));this['setDataValue'](_0x6e70('0x45'),_0x6e70('0x2d'));this[_0x6e70('0x6')](_0x6e70('0x46'),'yes');this[_0x6e70('0x6')]('dtlsverify','no');this['setDataValue'](_0x6e70('0x48'),_0x6e70('0x40'));this[_0x6e70('0x6')](_0x6e70('0x49'),_0x41a861[_0x6e70('0x49')]||_0x6e70('0x4d'));this['setDataValue'](_0x6e70('0x4a'),_0x41a861[_0x6e70('0x4a')]||_0x6e70('0x4e'));this[_0x6e70('0x6')](_0x6e70('0x4f'),_0x6e70('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x6e70('0x50')],'set':function(_0xd9b4a9){this[_0x6e70('0x6')](_0x6e70('0x51'),_0xd9b4a9?_0xd9b4a9['join'](','):[]);},'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x51'))?_[_0x6e70('0x52')](this['getDataValue']('permissions')[_0x6e70('0x27')](','),function(_0x18ecf0){return parseInt(_0x18ecf0,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6e70('0x10')](_0x6e70('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6e70('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6e70('0x53')],'get':function(){return this[_0x6e70('0xd')](_0x6e70('0x54'))?this[_0x6e70('0xd')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x6e70('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6e70('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x576069){if(typeof _0x576069===_0x6e70('0x55')){var _0x21e4c2=_0x576069==='1'?!![]:_0x576069==='0'?![]:_0x576069===_0x6e70('0x56')?!![]:_0x576069==='false'?![]:![];this['setDataValue']('screenrecording',_0x21e4c2);}else{this[_0x6e70('0x6')]('screenrecording',_0x576069);}}},'blocked':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![],'set':function(_0x34237d){this[_0x6e70('0x6')](_0x6e70('0x57'),_0x34237d);if(_0x34237d===!![]){this[_0x6e70('0x6')](_0x6e70('0x58'),moment());this[_0x6e70('0x6')]('loginAttempts',0x0);}else{this[_0x6e70('0x6')](_0x6e70('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0x6e70('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6e70('0x19')](0x5)[_0x6e70('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6e70('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6e70('0x19')],'defaultValue':0x0}}; \ No newline at end of file +var _0x008c=['all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlsprivatekey','wss','dtlsverify','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x533e70,_0x16f654){var _0x4dac5d=function(_0x454068){while(--_0x454068){_0x533e70['push'](_0x533e70['shift']());}};_0x4dac5d(++_0x16f654);}(_0x008c,0x188));var _0xc008=function(_0x299d27,_0x4cbc19){_0x299d27=_0x299d27-0x0;var _0x5692a1=_0x008c[_0x299d27];return _0x5692a1;};'use strict';var Sequelize=require(_0xc008('0x0'));var moment=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));module[_0xc008('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc008('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x47063f){this[_0xc008('0x6')](_0xc008('0x5'),_0x47063f);this[_0xc008('0x6')](_0xc008('0x7'),_0x47063f);},'comment':_0xc008('0x8')},'fullname':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'set':function(_0x9c8cb2){this['setDataValue'](_0xc008('0xa'),_0x9c8cb2);this['setDataValue'](_0xc008('0xb'),util['format']('\x22%s\x22\x20<%s>',_0x9c8cb2,this[_0xc008('0xc')](_0xc008('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x1eacfa){if(_0x1eacfa){this[_0xc008('0x6')]('email',_0x1eacfa[_0xc008('0xe')]());}}},'role':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x10'),_0xc008('0x11'),_0xc008('0x12'),_0xc008('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x25e13f){this[_0xc008('0x6')](_0xc008('0xd'),_0x25e13f);this[_0xc008('0x6')](_0xc008('0x15'),_0x25e13f);this['setDataValue']('callerid',util['format'](_0xc008('0x16'),this[_0xc008('0xc')](_0xc008('0xa')),_0x25e13f));}},'salt':{'type':Sequelize[_0xc008('0x9')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xc008('0x9')]},'city':{'type':Sequelize[_0xc008('0x9')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc008('0x18')]},'chatCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc008('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x19')},'ipaddr':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'port':{'type':Sequelize[_0xc008('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x1a'),_0xc008('0x11'),'peer'),'allowNull':!![],'defaultValue':_0xc008('0x1a')},'context':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x1b')},'callingpres':{'type':Sequelize[_0xc008('0xf')]('ALLOWED_NOT_SCREENED',_0xc008('0x1c'),_0xc008('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xc008('0x1e'),_0xc008('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':_0xc008('0x20'),'set':function(_0x2b862d){this[_0xc008('0x6')](_0xc008('0x21'),_0x2b862d?_0x2b862d['join'](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x21'))?this['getDataValue'](_0xc008('0x21'))[_0xc008('0x22')](','):null;},'comment':_0xc008('0x23')},'dtmfmode':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x24'),_0xc008('0x25'),_0xc008('0x26'),_0xc008('0x27'),_0xc008('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x2a'),_0xc008('0x2b'),_0xc008('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x399b64){this[_0xc008('0x6')]('nat',_0x399b64?_0x399b64[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x2e'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xc008('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc008('0x9')]},'pickupgroup':{'type':Sequelize[_0xc008('0x9')]},'namedpickupgroup':{'type':Sequelize[_0xc008('0x9')]},'language':{'type':Sequelize[_0xc008('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc008('0x9')]},'disallow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x30')},'allow':{'type':Sequelize[_0xc008('0x9')],'allowNull':![],'defaultValue':_0xc008('0x31'),'set':function(_0x387dfd){this[_0xc008('0x6')](_0xc008('0x32'),_0x387dfd?_0x387dfd[_0xc008('0x2d')](';'):_0xc008('0x31'));},'get':function(){return this['getDataValue'](_0xc008('0x32'))?this[_0xc008('0xc')](_0xc008('0x32'))[_0xc008('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'set':function(_0x36e7ae){this[_0xc008('0x6')]('insecure',_0x36e7ae?_0x36e7ae[_0xc008('0x2d')](','):null);},'get':function(){return this[_0xc008('0xc')](_0xc008('0x33'))?this[_0xc008('0xc')](_0xc008('0x33'))['split'](','):null;},'comment':_0xc008('0x34')},'trustrpid':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'template':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xc008('0x37'),_0xc008('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x39'),_0xc008('0x3a')),'allowNull':!![],'defaultValue':_0xc008('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no',_0xc008('0x3b'),_0xc008('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x3d'),'passive',_0xc008('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc008('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc008('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc008('0xf')](_0xc008('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc008('0xf')]('yes','no',_0xc008('0x2a'),'update',_0xc008('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc008('0x9')]},'resetPasswordExpires':{'type':Sequelize[_0xc008('0x18')]},'passwordResetAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc008('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x375e71){this['setDataValue']('showWebBar',_0x375e71);var _0x37ce5e=this[_0xc008('0x41')]({'plain':!![]});switch(_0x375e71){case 0x0:case 0x1:var _0x56e755=_0x37ce5e[_0xc008('0x21')]?_[_0xc008('0x42')](_0x37ce5e[_0xc008('0x21')])?_0x37ce5e[_0xc008('0x21')][_0xc008('0x2d')]():_0x37ce5e[_0xc008('0x21')]:_0xc008('0x20');if(_0x56e755==='wss'){_0x56e755=_0xc008('0x20');}this[_0xc008('0x6')](_0xc008('0x21'),_0x56e755);this[_0xc008('0x6')](_0xc008('0x43'),'no');this[_0xc008('0x6')](_0xc008('0x44'),null);this[_0xc008('0x6')](_0xc008('0x45'),null);this[_0xc008('0x6')](_0xc008('0x46'),null);this[_0xc008('0x6')](_0xc008('0x47'),null);this[_0xc008('0x6')]('dtlsverify',null);this[_0xc008('0x6')](_0xc008('0x48'),null);this[_0xc008('0x6')]('dtlscertfile',null);this[_0xc008('0x6')](_0xc008('0x49'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xc008('0x6')](_0xc008('0x21'),_0xc008('0x4a'));this[_0xc008('0x6')](_0xc008('0x43'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x44'),_0xc008('0x29'));this[_0xc008('0x6')](_0xc008('0x45'),'yes');this[_0xc008('0x6')](_0xc008('0x46'),_0xc008('0x29'));this[_0xc008('0x6')]('dtlsenable',_0xc008('0x29'));this['setDataValue'](_0xc008('0x4b'),'no');this[_0xc008('0x6')](_0xc008('0x48'),'actpass');this[_0xc008('0x6')](_0xc008('0x4c'),_0x37ce5e[_0xc008('0x4c')]||'/etc/pki/tls/certs/motion.crt');this[_0xc008('0x6')]('dtlsprivatekey',_0x37ce5e[_0xc008('0x49')]||_0xc008('0x4d'));this[_0xc008('0x6')](_0xc008('0x4e'),_0xc008('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3c30db){this[_0xc008('0x6')]('permissions',_0x3c30db?_0x3c30db[_0xc008('0x2d')](','):[]);},'get':function(){return this['getDataValue'](_0xc008('0x4f'))?_['map'](this[_0xc008('0xc')]('permissions')[_0xc008('0x22')](','),function(_0x103d75){return parseInt(_0x103d75,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc008('0x9')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc008('0x9')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc008('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc008('0x50')],'get':function(){return this[_0xc008('0xc')](_0xc008('0x51'))?this[_0xc008('0xc')](_0xc008('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xc008('0x9')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc008('0x9')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3b2669){if(typeof _0x3b2669===_0xc008('0x52')){var _0x2edb8e=_0x3b2669==='1'?!![]:_0x3b2669==='0'?![]:_0x3b2669===_0xc008('0x53')?!![]:_0x3b2669===_0xc008('0x54')?![]:![];this[_0xc008('0x6')](_0xc008('0x55'),_0x2edb8e);}else{this['setDataValue']('screenrecording',_0x3b2669);}}},'blocked':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![],'set':function(_0x3104cd){this[_0xc008('0x6')]('blocked',_0x3104cd);if(_0x3104cd===!![]){this[_0xc008('0x6')](_0xc008('0x56'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue'](_0xc008('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0xc008('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc008('0x14')](0x5)[_0xc008('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc008('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc008('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc008('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 38e26c5..332885f 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 _0x6457=['109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','each','autoAssociation','compact','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','Queue:save','voice','get','SIP/%s','upsert','removeQueues','Unknown\x20channel','remove','isArray','Queue:remove','UserVoiceQueueRt','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','concat','CmContact','order','sort','getContacts','hasOwnProperty','color','tag','nolimit','limit','Queue','pick','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','format','LOCAL/%s@from-sip/n','intrf','user:%s','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','PAUSE','LOGININPAUSE','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','QueuePause','manual','set','%s%s','Pause','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','Team','getAssociatedQueues','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','getDataValue','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','removeAgent','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','firstName','lastName','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','teams','queues','isEmpty','inbound','flatten','lower','col','asc','desc','substring','uniqBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../config/logger','api','../../config/environment','../../config/license/util','APIBadRequestError','APINotFoundError','../../errors/api','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','client','http','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','count','offset','Content-Range','update','emit','userNotification:recalc:','destroy','role','Users','user','Agents','Telephones','telephone','filter','map','value','name','UserProfileResource','sendStatus','stack','send','index','fieldName','key','password','salt','getOptions','where','query','include','true','UserSetting','userSetting','includes','attributes','User','findAll','rows','chat','dataValues','sms','push','mail','openchannel','whatsapp','show','params','keys','rawAttributes','filters','intersection','model','fields','length','includeAll','merge','options','find','openTabs','fax','all','body','describe','addContacts','ids','omit','internal','findById','validatePasswordPattern','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','VoiceMail','fullname','email','agent','permissions','102','103','104','106','107','108'];(function(_0x43794c,_0x4b4158){var _0xa31045=function(_0x2201e7){while(--_0x2201e7){_0x43794c['push'](_0x43794c['shift']());}};_0xa31045(++_0x4b4158);}(_0x6457,0x125));var _0x7645=function(_0x1864d5,_0x5e86a5){_0x1864d5=_0x1864d5-0x0;var _0x272796=_0x6457[_0x1864d5];return _0x272796;};'use strict';var moment=require(_0x7645('0x0'));var BPromise=require(_0x7645('0x1'));var util=require(_0x7645('0x2'));var path=require(_0x7645('0x3'));var fs=require('fs');var _=require(_0x7645('0x4'));var squel=require(_0x7645('0x5'));var jayson=require(_0x7645('0x6'));var Redis=require('ioredis');var authService=require(_0x7645('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0x7645('0x8'))(_0x7645('0x9'));var utils=require('../../config/utils');var config=require(_0x7645('0xa'));var licenseUtil=require(_0x7645('0xb'));var APIBadRequestError=require('../../errors/api')[_0x7645('0xc')];var APINotFoundError=require('../../errors/api')[_0x7645('0xd')];var APIHandleError=require(_0x7645('0xe'))[_0x7645('0xf')];var db=require(_0x7645('0x10'))['db'];var socket=require(_0x7645('0x11'))(new Redis(config[_0x7645('0x12')]));require(_0x7645('0x13'))['register'](socket);config['redis']=_['defaults'](config[_0x7645('0x12')],{'host':'localhost','port':0x18eb});var client=jayson[_0x7645('0x14')][_0x7645('0x15')]({'port':0x232a});var values;function respondWithRpcPromise(_0x1359c6,_0xfff183,_0x19f5ab,_0xe254c3){return new BPromise(function(_0x6eeadf,_0x296fae){var _0x244895=_0xe254c3||client;return _0x244895[_0x7645('0x16')](_0x1359c6,_0x19f5ab)[_0x7645('0x17')](function(_0x5e97cd){logger[_0x7645('0x18')]('User,\x20%s,\x20%s',_0xfff183,_0x7645('0x19'));logger[_0x7645('0x1a')](_0x7645('0x1b'),_0xfff183,'request\x20sent',JSON[_0x7645('0x1c')](_0x5e97cd));if(_0x5e97cd[_0x7645('0x1d')]){if(_0x5e97cd[_0x7645('0x1d')][_0x7645('0x1e')]===0x1f4){logger['error'](_0x7645('0x1f'),_0xfff183,_0x5e97cd[_0x7645('0x1d')][_0x7645('0x20')]);return _0x296fae(_0x5e97cd['error'][_0x7645('0x20')]);}logger[_0x7645('0x1d')](_0x7645('0x1f'),_0xfff183,_0x5e97cd[_0x7645('0x1d')][_0x7645('0x20')]);return _0x6eeadf(_0x5e97cd[_0x7645('0x1d')][_0x7645('0x20')]);}else{logger[_0x7645('0x18')](_0x7645('0x1f'),_0xfff183,_0x7645('0x19'));_0x6eeadf(_0x5e97cd[_0x7645('0x21')]['message']);}})[_0x7645('0x22')](function(_0x5f34c6){logger['error'](_0x7645('0x1f'),_0xfff183,_0x5f34c6);_0x296fae(_0x5f34c6);});});}function respondWithStatusCode(_0x5777a1,_0x3e1008){_0x3e1008=_0x3e1008||0xcc;return function(_0x2bcecf){if(_0x2bcecf){return _0x5777a1['sendStatus'](_0x3e1008);}return _0x5777a1[_0x7645('0x23')](_0x3e1008)[_0x7645('0x24')]();};}function respondWithResult(_0x23d1c1,_0x201c6a){_0x201c6a=_0x201c6a||0xc8;return function(_0x23a112){if(_0x23a112){return _0x23d1c1[_0x7645('0x23')](_0x201c6a)[_0x7645('0x25')](_0x23a112);}};}function respondWithFilteredResult(_0x100947,_0x793476){return function(_0x3ad8f0){if(_0x3ad8f0){var _0x18ce9c=typeof _0x793476['offset']===_0x7645('0x26')&&typeof _0x793476['limit']==='undefined';var _0x45a334=_0x3ad8f0[_0x7645('0x27')];var _0x367c01=_0x18ce9c?0x0:_0x793476[_0x7645('0x28')];var _0xff91ed=_0x18ce9c?_0x3ad8f0[_0x7645('0x27')]:_0x793476[_0x7645('0x28')]+_0x793476['limit'];var _0x1f6076;if(_0xff91ed>=_0x45a334){_0xff91ed=_0x45a334;_0x1f6076=0xc8;}else{_0x1f6076=0xce;}_0x100947[_0x7645('0x23')](_0x1f6076);return _0x100947['set'](_0x7645('0x29'),_0x367c01+'-'+_0xff91ed+'/'+_0x45a334)['json'](_0x3ad8f0);}return null;};}function saveUpdates(_0x54da4d){return function(_0x19bc3c){if(_0x19bc3c){return _0x19bc3c[_0x7645('0x2a')](_0x54da4d)['then'](function(_0x3ca35a){socket[_0x7645('0x2b')](_0x7645('0x2c')+_0x3ca35a['id'],{});return _0x3ca35a;});}return null;};}function removeEntity(_0x40b298){return function(_0x16c4a4){if(_0x16c4a4){return _0x16c4a4[_0x7645('0x2d')]()[_0x7645('0x17')](function(){var _0x3f4601=_0x16c4a4['get']({'plain':!![]});if(_0x3f4601[_0x7645('0x2e')]==='admin')return;var _0x2c1263=[{'name':_0x7645('0x2f'),'value':_0x7645('0x30'),'ignore':!![]},{'name':_0x7645('0x31'),'value':'agent','ignore':![]},{'name':_0x7645('0x32'),'value':_0x7645('0x33'),'ignore':![]}];var _0x26fd65=_(_0x2c1263)[_0x7645('0x34')]('ignore')[_0x7645('0x35')](_0x7645('0x36'))['value']();if(_['includes'](_0x26fd65,_0x3f4601[_0x7645('0x2e')])){return;}var _0x3641fa=_['find'](_0x2c1263,['value',_0x3f4601[_0x7645('0x2e')]])[_0x7645('0x37')];return db[_0x7645('0x38')]['destroy']({'where':{'type':_0x3641fa,'resourceId':_0x3f4601['id']}})['then'](function(){return _0x16c4a4;});})['then'](function(){_0x40b298[_0x7645('0x23')](0xcc)[_0x7645('0x24')]();});}};}function handleEntityNotFound(_0x5aa6f5){return function(_0x5c1b9b){if(!_0x5c1b9b){_0x5aa6f5[_0x7645('0x39')](0x194);}return _0x5c1b9b;};}function handleError(_0x4822b3,_0x12f88c){_0x12f88c=_0x12f88c||0x1f4;return function(_0x4ea475){logger['error'](_0x4ea475[_0x7645('0x3a')]);if(_0x4ea475['name']){delete _0x4ea475[_0x7645('0x37')];}_0x4822b3[_0x7645('0x23')](_0x12f88c)[_0x7645('0x3b')](_0x4ea475);};}exports[_0x7645('0x3c')]=function(_0x15e6e8,_0x29ae6e){var _0x4ef854={},_0x50f43f={'count':0x0,'rows':[]};var _0x253d6b=_(db['User']['rawAttributes'])[_0x7645('0x35')](function(_0x19a4b9){return{'name':_0x19a4b9[_0x7645('0x3d')],'type':_0x19a4b9['type'][_0x7645('0x3e')]};})['filter'](function(_0x5ba1d4){return!_['includes']([_0x7645('0x3f'),_0x7645('0x40')],_0x5ba1d4[_0x7645('0x37')]);})[_0x7645('0x36')]();_0x4ef854=qs[_0x7645('0x41')](_0x253d6b,_0x15e6e8);var _0x8047e0={'where':_0x4ef854[_0x7645('0x42')]};return db['User']['count'](_0x8047e0)['then'](function(_0x59fa0f){_0x50f43f['count']=_0x59fa0f;if(_0x15e6e8[_0x7645('0x43')]['includeAll']){_0x4ef854[_0x7645('0x44')]=[{'all':!![]}];}if(_0x15e6e8['query']['userSetting']===_0x7645('0x45')){_0x4ef854[_0x7645('0x44')]=[{'model':db[_0x7645('0x46')],'as':_0x7645('0x47')}];}if(!_[_0x7645('0x48')](_0x4ef854[_0x7645('0x49')],'id')){_0x4ef854[_0x7645('0x49')]['push']('id');}return db[_0x7645('0x4a')][_0x7645('0x4b')](_0x4ef854);})[_0x7645('0x17')](function(_0x54c4cf){_0x50f43f['rows']=_0x54c4cf;if(_0x15e6e8[_0x7645('0x43')]['openTabs']==='true'){var _0xdaa937=[];for(var _0x536eae=0x0;_0x536eae<_0x50f43f[_0x7645('0x4c')]['length'];_0x536eae++){_0xdaa937['push'](get_open_tabs(_0x7645('0x4d'),_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));_0xdaa937['push'](get_open_tabs(_0x7645('0x4f'),_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));_0xdaa937[_0x7645('0x50')](get_open_tabs('fax',_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));_0xdaa937[_0x7645('0x50')](get_open_tabs(_0x7645('0x51'),_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));_0xdaa937['push'](get_open_tabs(_0x7645('0x52'),_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));_0xdaa937[_0x7645('0x50')](get_open_tabs(_0x7645('0x53'),_0x50f43f[_0x7645('0x4c')][_0x536eae][_0x7645('0x4e')]));}return BPromise['all'](_0xdaa937)['then'](function(){return _0x50f43f;});}else{return _0x50f43f;}})['then'](respondWithFilteredResult(_0x29ae6e,_0x4ef854))[_0x7645('0x22')](handleError(_0x29ae6e,null));};exports[_0x7645('0x54')]=function(_0xd60274,_0x1cf1fd){var _0x1c1cad={'raw':![],'where':{'id':_0xd60274[_0x7645('0x55')]['id']}},_0x35f2f9={};_0x35f2f9['model']=_['differenceBy'](_[_0x7645('0x56')](db[_0x7645('0x4a')][_0x7645('0x57')]),[_0x7645('0x3f'),_0x7645('0x40')]);_0x35f2f9[_0x7645('0x43')]=_[_0x7645('0x56')](_0xd60274[_0x7645('0x43')]);_0x35f2f9[_0x7645('0x58')]=_['intersection'](_0x35f2f9['model'],_0x35f2f9[_0x7645('0x43')]);_0x1c1cad[_0x7645('0x49')]=_[_0x7645('0x59')](_0x35f2f9[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0xd60274['query']['fields']));_0x1c1cad[_0x7645('0x49')]=_0x1c1cad[_0x7645('0x49')][_0x7645('0x5c')]?_0x1c1cad[_0x7645('0x49')]:_0x35f2f9['model'];if(_0xd60274[_0x7645('0x43')][_0x7645('0x5d')]){_0x1c1cad[_0x7645('0x44')]=[{'all':!![]}];}if(_0xd60274[_0x7645('0x43')][_0x7645('0x47')]===_0x7645('0x45')){_0x1c1cad[_0x7645('0x44')]=[{'model':db[_0x7645('0x46')],'as':_0x7645('0x47')}];}_0x1c1cad=_[_0x7645('0x5e')]({},_0x1c1cad,_0xd60274[_0x7645('0x5f')]);if(!_[_0x7645('0x48')](_0x1c1cad[_0x7645('0x49')],'id')){_0x1c1cad[_0x7645('0x49')][_0x7645('0x50')]('id');}return db[_0x7645('0x4a')][_0x7645('0x60')](_0x1c1cad)['then'](handleEntityNotFound(_0x1cf1fd,null))[_0x7645('0x17')](function(_0x1cbe72){var _0x4d5b3e=[];values=_0x1cbe72;if(_0xd60274[_0x7645('0x43')][_0x7645('0x61')]===_0x7645('0x45')){_0x4d5b3e['push'](get_open_tabs('chat',_0x1cbe72['dataValues']));_0x4d5b3e['push'](get_open_tabs(_0x7645('0x4f'),_0x1cbe72[_0x7645('0x4e')]));_0x4d5b3e[_0x7645('0x50')](get_open_tabs(_0x7645('0x52'),_0x1cbe72['dataValues']));_0x4d5b3e[_0x7645('0x50')](get_open_tabs(_0x7645('0x53'),_0x1cbe72['dataValues']));_0x4d5b3e[_0x7645('0x50')](get_open_tabs(_0x7645('0x62'),_0x1cbe72[_0x7645('0x4e')]));_0x4d5b3e[_0x7645('0x50')](get_open_tabs(_0x7645('0x51'),_0x1cbe72[_0x7645('0x4e')]));return BPromise[_0x7645('0x63')](_0x4d5b3e);}else{return values;}})['then'](function(){return values;})['then'](respondWithResult(_0x1cf1fd,null))[_0x7645('0x22')](handleError(_0x1cf1fd,null));};exports[_0x7645('0x2a')]=function(_0x35ec35,_0x8399a4){if(_0x35ec35[_0x7645('0x64')]['id']){delete _0x35ec35[_0x7645('0x64')]['id'];}delete _0x35ec35[_0x7645('0x64')]['role'];return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x35ec35[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x8399a4,null))[_0x7645('0x17')](saveUpdates(_0x35ec35[_0x7645('0x64')],null))['then'](respondWithResult(_0x8399a4,null))[_0x7645('0x22')](handleError(_0x8399a4,null));};exports['describe']=function(_0x256453,_0xcdc139){return db[_0x7645('0x4a')][_0x7645('0x65')]()[_0x7645('0x17')](respondWithResult(_0xcdc139,null))[_0x7645('0x22')](handleError(_0xcdc139,null));};exports[_0x7645('0x66')]=function(_0x366d62,_0x4e8d48){return db[_0x7645('0x4a')]['find']({'where':{'id':_0x366d62[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x4e8d48,null))[_0x7645('0x17')](function(_0x4298cc){if(_0x4298cc){return _0x4298cc[_0x7645('0x66')](_0x366d62[_0x7645('0x64')][_0x7645('0x67')],_[_0x7645('0x68')](_0x366d62[_0x7645('0x64')],[_0x7645('0x67'),'id'])||{});}})[_0x7645('0x17')](respondWithResult(_0x4e8d48,null))[_0x7645('0x22')](handleError(_0x4e8d48,null));};function validateUser(_0x38838e){return new BPromise(function(_0x4d5baa,_0x1c34b1){if(_0x38838e[_0x7645('0x69')])return _0x4d5baa(_0x38838e);return db['Setting'][_0x7645('0x6a')](0x1)[_0x7645('0x17')](function(_0x11cb21){if(_0x11cb21['securePassword'])authService[_0x7645('0x6b')](_0x38838e[_0x7645('0x3f')]);db[_0x7645('0x4a')][_0x7645('0x6c')](_0x7645('0x69'))['then'](function(_0x186a75){if(_['isNil'](_0x186a75)){_0x38838e[_0x7645('0x69')]=_0x11cb21[_0x7645('0x6d')]||0x1;return;}if(_[_0x7645('0x6e')](_0x11cb21[_0x7645('0x6d')])||_0x11cb21['min_internal']===_0x186a75){_0x38838e[_0x7645('0x69')]=_0x186a75+0x1;return;}if(_0x11cb21[_0x7645('0x6d')]>_0x186a75){_0x38838e[_0x7645('0x69')]=_0x11cb21[_0x7645('0x6d')];return;}return db[_0x7645('0x6f')][_0x7645('0x43')](_0x7645('0x70'),{'type':db['sequelize'][_0x7645('0x71')][_0x7645('0x72')]})['then'](function(_0x3ffb51){if(_0x3ffb51&&_0x3ffb51[_0x7645('0x5c')]){for(var _0x2d2d38=0x0,_0x52d055=_0x3ffb51[_0x7645('0x5c')];_0x2d2d38<_0x52d055&&_[_0x7645('0x6e')](_0x38838e[_0x7645('0x69')]);_0x2d2d38++){if(_0x11cb21[_0x7645('0x6d')]<=_0x3ffb51[_0x2d2d38][_0x7645('0x73')]){_0x38838e['internal']=_0x3ffb51[_0x2d2d38][_0x7645('0x73')];}else if(_0x11cb21[_0x7645('0x6d')]>_0x3ffb51[_0x2d2d38]['from']&&_0x11cb21[_0x7645('0x6d')]<=_0x3ffb51[_0x2d2d38]['to']){_0x38838e[_0x7645('0x69')]=_0x11cb21[_0x7645('0x6d')];}}}if(_[_0x7645('0x6e')](_0x38838e[_0x7645('0x69')])){_0x38838e['internal']=_0x186a75+0x1;}return _0x4d5baa(_0x38838e);});});})[_0x7645('0x22')](function(_0x2e59dc){_0x1c34b1(_0x2e59dc);});});}function updateUser(_0x570450){return new BPromise(function(_0x4410a1,_0x1c8464){try{if(_0x570450[_0x7645('0x74')]){_0x570450['mailbox']=_0x570450[_0x7645('0x69')];_0x570450[_0x7645('0x75')]={'mailbox':_0x570450['internal'],'password':_0x570450[_0x7645('0x3f')],'fullname':_0x570450[_0x7645('0x76')],'email':_0x570450[_0x7645('0x77')]};}if(_0x570450[_0x7645('0x2e')]===_0x7645('0x78')){if(!_0x570450[_0x7645('0x79')])_0x570450['permissions']=['101',_0x7645('0x7a'),_0x7645('0x7b'),'113','110',_0x7645('0x7c'),'105',_0x7645('0x7d'),_0x7645('0x7e'),_0x7645('0x7f'),_0x7645('0x80'),_0x7645('0x81'),_0x7645('0x82'),_0x7645('0x83'),_0x7645('0x84')];}_0x4410a1(_0x570450);}catch(_0x3d482c){_0x1c8464(_0x3d482c);}});}exports[_0x7645('0x85')]=function(_0x148f3c,_0x1f8546){if(_0x148f3c[_0x7645('0x30')][_0x7645('0x2e')]===_0x7645('0x78'))throw new Error(_0x7645('0x86'));if(_0x148f3c[_0x7645('0x64')][_0x7645('0x2e')]===_0x7645('0x30')&&_0x148f3c[_0x7645('0x30')]['role']!=='admin'){throw new Error(_0x7645('0x87'));}if(_0x148f3c[_0x7645('0x64')][_0x7645('0x2e')]===_0x7645('0x88')&&_0x148f3c[_0x7645('0x30')][_0x7645('0x2e')]!==_0x7645('0x88')){throw new Error(_0x7645('0x89'));}return licenseUtil['checkUserLimits']([_0x148f3c[_0x7645('0x64')]])[_0x7645('0x17')](function(){return validateUser(_0x148f3c[_0x7645('0x64')]);})[_0x7645('0x17')](function(_0x20d07e){return updateUser(_0x20d07e)[_0x7645('0x17')](function(_0x1cf40c){if(_0x1cf40c['role']===_0x7645('0x88')){_0x1cf40c[_0x7645('0x8a')]=_0x148f3c[_0x7645('0x30')][_0x7645('0x8a')];delete _0x1cf40c[_0x7645('0x8b')];}return _0x1cf40c;});})[_0x7645('0x17')](function(_0x7e802b){return db[_0x7645('0x4a')][_0x7645('0x85')](_0x7e802b,{'include':[{'model':db[_0x7645('0x75')],'as':_0x7645('0x75')}]});})[_0x7645('0x17')](function(_0xf36dac){if(_0x148f3c[_0x7645('0x64')][_0x7645('0x2e')]===_0x7645('0x30'))return _0xf36dac;if(_0x148f3c[_0x7645('0x30')][_0x7645('0x2e')]!==_0x7645('0x30'))return _0xf36dac;return db[_0x7645('0x8c')][_0x7645('0x60')]({'where':{'name':_0xf36dac['role']===_0x7645('0x78')?_0x7645('0x31'):_0x7645('0x32'),'userProfileId':_0x148f3c['user'][_0x7645('0x8b')]},'raw':!![]})['then'](function(_0x1a8b7d){if(!_0x1a8b7d||_0x1a8b7d['autoAssociation']!=0x0)return _0xf36dac;return db['UserProfileResource'][_0x7645('0x85')]({'name':_0xf36dac[_0x7645('0x37')],'resourceId':_0xf36dac['id'],'type':_0x1a8b7d['name'],'sectionId':_0x1a8b7d['id']},{})['then'](function(){return _0xf36dac;});})['catch'](function(_0x36583d){logger[_0x7645('0x1d')](_0x7645('0x8d'),_0x36583d);throw _0x36583d;});})[_0x7645('0x17')](respondWithResult(_0x1f8546,0xc9))[_0x7645('0x22')](handleError(_0x1f8546,null));};exports[_0x7645('0x8e')]=function(_0x5af3e1,_0x12a8c9){var _0x4ea7c8=_0x5af3e1['body'];var _0x5c2a01=[];if(_0x5af3e1['user']['role']===_0x7645('0x78'))throw new Error(_0x7645('0x86'));if(_['some'](_0x4ea7c8,['role','user'])&&_0x5af3e1[_0x7645('0x30')][_0x7645('0x2e')]!=='admin'){throw new Error(_0x7645('0x87'));}if(_[_0x7645('0x8f')](_0x4ea7c8,[_0x7645('0x2e'),_0x7645('0x88')])&&_0x5af3e1['user'][_0x7645('0x2e')]!==_0x7645('0x88')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x4ea7c8)[_0x7645('0x17')](function(){return validateUser(_0x4ea7c8[0x0]);})['then'](function(){for(var _0x5ca69c=0x1;_0x5ca69c<_0x4ea7c8['length'];_0x5ca69c++){var _0x3b27d8=_0x4ea7c8[_0x5ca69c-0x1][_0x7645('0x69')];if(!_0x4ea7c8[_0x5ca69c][_0x7645('0x69')])_0x4ea7c8[_0x5ca69c][_0x7645('0x69')]=_0x3b27d8+0x1;_0x5c2a01[_0x7645('0x50')](validateUser(_0x4ea7c8[_0x5ca69c]));}return BPromise[_0x7645('0x63')](_0x5c2a01);})[_0x7645('0x17')](function(){_0x5c2a01=[];for(var _0x1c0213=0x0;_0x1c0213<_0x4ea7c8[_0x7645('0x5c')];_0x1c0213++){_0x5c2a01[_0x7645('0x50')](updateUser(_0x4ea7c8[_0x1c0213]));}return BPromise[_0x7645('0x63')](_0x5c2a01);})['then'](function(){return BPromise[_0x7645('0x90')](_0x4ea7c8,function(_0x339a09){return db['User'][_0x7645('0x85')](_0x339a09,{'include':[{'model':db[_0x7645('0x75')],'as':_0x7645('0x75')}]})[_0x7645('0x17')](function(_0x4a6778){_0x339a09['id']=_0x4a6778['id'];return _0x339a09;});});})[_0x7645('0x17')](function(_0x46a00a){if(_0x5af3e1[_0x7645('0x64')]['role']===_0x7645('0x30'))return _0x46a00a;if(_0x5af3e1[_0x7645('0x30')][_0x7645('0x2e')]!==_0x7645('0x30'))return _0x46a00a;var _0x54a86a=_[_0x7645('0x8f')](_0x46a00a,function(_0x321fe6){return _0x321fe6[_0x7645('0x2e')]==='agent'||_0x321fe6[_0x7645('0x2e')]===_0x7645('0x33');});if(!_0x54a86a)return _0x46a00a;return db[_0x7645('0x8c')][_0x7645('0x4b')]({'where':{'name':{'$or':[_0x7645('0x31'),_0x7645('0x32')]},'userProfileId':_0x5af3e1[_0x7645('0x30')][_0x7645('0x8b')]},'raw':!![]})[_0x7645('0x17')](function(_0xdbc982){if(_['isEmpty'](_0xdbc982)||!_['some'](_0xdbc982,['autoAssociation',0x0]))return _0x46a00a;_0x5c2a01=[];var _0x3d74dc=_(_0xdbc982)['map'](function(_0x37da36){if(_0x37da36[_0x7645('0x91')]===0x1)return;return _0x37da36[_0x7645('0x37')]===_0x7645('0x31')?_0x7645('0x78'):_0x7645('0x33');})[_0x7645('0x92')]()[_0x7645('0x36')]();for(var _0x25d0f5=0x0;_0x25d0f5<_0x46a00a[_0x7645('0x5c')];_0x25d0f5++){if(!_[_0x7645('0x48')](_0x3d74dc,_0x46a00a[_0x25d0f5][_0x7645('0x2e')]))return;var _0x3d8b3f=_0x46a00a[_0x25d0f5][_0x7645('0x2e')]===_0x7645('0x78')?_0x7645('0x31'):_0x7645('0x32');_0x5c2a01[_0x7645('0x50')](db[_0x7645('0x38')][_0x7645('0x85')]({'name':_0x46a00a[_0x25d0f5]['name'],'resourceId':_0x46a00a[_0x25d0f5]['id'],'type':_0x3d8b3f,'sectionId':_[_0x7645('0x60')](_0xdbc982,[_0x7645('0x37'),_0x3d8b3f])['id']},{}));}return BPromise['all'](_0x5c2a01);});})[_0x7645('0x17')](respondWithResult(_0x12a8c9,0xc9))['catch'](handleError(_0x12a8c9,null));};exports[_0x7645('0x93')]=function(_0x2b5df9,_0x298da6){if(_0x2b5df9['body']['id']){delete _0x2b5df9[_0x7645('0x64')]['id'];}return db[_0x7645('0x4a')]['find']({'where':{'id':_0x2b5df9[_0x7645('0x55')]['id']}})[_0x7645('0x17')](function(_0x4a1316){if(!_0x4a1316)return null;if(_0x4a1316['id']===_0x2b5df9[_0x7645('0x30')]['id']){if(!_0x2b5df9[_0x7645('0x64')][_0x7645('0x94')]||!_0x2b5df9[_0x7645('0x64')][_0x7645('0x95')]){throw new db['Sequelize'][(_0x7645('0x96'))](_0x7645('0x97'));}if(!_0x4a1316[_0x7645('0x98')](_0x2b5df9[_0x7645('0x64')][_0x7645('0x94')])){throw new db[(_0x7645('0x99'))]['ValidationError'](_0x7645('0x9a'));}if(_0x2b5df9['body'][_0x7645('0x94')]===_0x2b5df9[_0x7645('0x64')][_0x7645('0x95')]){throw new db[(_0x7645('0x99'))]['ValidationError'](_0x7645('0x9b'));}}else if(_0x2b5df9[_0x7645('0x30')]['role']===_0x7645('0x88')){if(!_0x2b5df9[_0x7645('0x64')][_0x7645('0x95')]){throw new db['Sequelize'][(_0x7645('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x2b5df9[_0x7645('0x30')]['role']==='user'){if(!_0x2b5df9[_0x7645('0x64')][_0x7645('0x95')]){throw new db['Sequelize']['ValidationError'](_0x7645('0x9c'));}if(_0x4a1316['role']!==_0x7645('0x78')){throw new db[(_0x7645('0x99'))][(_0x7645('0x96'))]('Unauthorized');}}else{throw new db[(_0x7645('0x99'))][(_0x7645('0x96'))](_0x7645('0x86'));}return _0x4a1316;})['then'](handleEntityNotFound(_0x298da6,null))['then'](function(_0x54b59a){return db['Setting'][_0x7645('0x9d')]({'attributes':['id',_0x7645('0x9e'),'enforcePasswordHistory',_0x7645('0x9f')]})[_0x7645('0x17')](function(_0x4782f6){if(_0x4782f6[_0x7645('0x9e')])authService[_0x7645('0x6b')](_0x2b5df9[_0x7645('0x64')]['newPassword']);if(!_0x4782f6[_0x7645('0xa0')]||!_0x54b59a[_0x7645('0xa1')])return _0x54b59a;authService['validatePasswordHistory'](_0x2b5df9[_0x7645('0x64')][_0x7645('0x95')],_0x54b59a[_0x7645('0xa1')],_0x4782f6[_0x7645('0x9f')]);return _0x54b59a;})[_0x7645('0x17')](saveUpdates({'password':_0x2b5df9['body'][_0x7645('0x95')],'passwordResetAt':_0x2b5df9['user']['id']==_0x2b5df9[_0x7645('0x55')]['id']?moment():null,'previousPasswords':authService[_0x7645('0xa2')](_0x2b5df9['body'][_0x7645('0x95')],_0x54b59a[_0x7645('0xa1')])},null));})['then'](respondWithResult(_0x298da6,null))[_0x7645('0x22')](handleError(_0x298da6,null));};exports[_0x7645('0xa3')]=function(_0x351512,_0x579da6){var _0x4b1d89=_0x351512[_0x7645('0x64')][_0x7645('0xa4')];return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x351512[_0x7645('0x55')]['id']},'attributes':['id',_0x7645('0x37'),_0x7645('0x2e'),_0x7645('0xa5'),_0x7645('0xa6'),_0x7645('0xa7'),_0x7645('0xa8')]})[_0x7645('0x17')](handleEntityNotFound(_0x579da6,null))['then'](function(_0x5c937e){if(_0x5c937e){if(!utils[_0x7645('0xa9')](_0x4b1d89)){throw new db[(_0x7645('0x99'))][(_0x7645('0x96'))]('Unknown\x20channel');}return _0x5c937e[_0x7645('0xaa')+_[_0x7645('0xab')](_0x4b1d89['toLowerCase']())+_0x7645('0xac')](_0x351512[_0x7645('0x64')][_0x7645('0x67')],{'penalty':_0x351512[_0x7645('0x64')][_0x7645('0xad')]||0x0})[_0x7645('0xae')](function(_0x513987){for(var _0x2d8a50=0x0;_0x2d8a50<_0x351512['body'][_0x7645('0x67')][_0x7645('0x5c')];_0x2d8a50+=0x1){var _0x35a878={'UserId':Number(_0x351512['params']['id'])};_0x35a878[_[_0x7645('0xab')](_0x4b1d89[_0x7645('0xaf')]())+_0x7645('0xb0')]=Number(_0x351512[_0x7645('0x64')][_0x7645('0x67')][_0x2d8a50]);socket[_0x7645('0x2b')]('user'+_[_0x7645('0xab')](_0x4b1d89['toLowerCase']())+_0x7645('0xb1'),_0x35a878);}return _0x513987;})['then'](function(){if(_0x4b1d89===_0x7645('0xb2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x351512[_0x7645('0x64')][_0x7645('0x67')]||[]},'raw':!![],'attributes':['id',_0x7645('0x37')]});}})[_0x7645('0x17')](function(_0x55c943){var _0x4a0eb3=_0x5c937e[_0x7645('0xb3')]({'plain':!![]});var _0x54c268=[];if(_0x4b1d89===_0x7645('0xb2')&&_0x4a0eb3['role']==='agent'&&_0x4a0eb3['online']){for(var _0x3d4095=0x0;_0x3d4095<_0x55c943[_0x7645('0x5c')];_0x3d4095+=0x1){_0x54c268['push']({'membername':_0x4a0eb3[_0x7645('0x37')],'UserId':_0x4a0eb3['id'],'queue_name':_0x55c943[_0x3d4095][_0x7645('0x37')],'VoiceQueueId':_0x55c943[_0x3d4095]['id'],'interface':_[_0x7645('0x6e')](_0x4a0eb3[_0x7645('0xa8')])?util['format'](_0x7645('0xb4'),_0x4a0eb3[_0x7645('0x37')]):_0x4a0eb3[_0x7645('0xa8')],'paused':_0x4a0eb3[_0x7645('0xa7')]||![],'penalty':_0x351512[_0x7645('0x64')][_0x7645('0xad')]||0x0});}return BPromise[_0x7645('0x90')](_0x54c268,function(_0x43b74c){return db['UserVoiceQueueRt'][_0x7645('0xb5')](_0x43b74c);});}return _0x5c937e;});}})[_0x7645('0x17')](respondWithStatusCode(_0x579da6,null))['catch'](handleError(_0x579da6,null));};exports[_0x7645('0xb6')]=function(_0x5a2bc0,_0x19cb66){var _0x4ad5d5,_0x33279c;return db[_0x7645('0x4a')]['find']({'where':{'id':_0x5a2bc0[_0x7645('0x55')]['id']},'attributes':['id',_0x7645('0x37'),_0x7645('0x2e')]})[_0x7645('0x17')](handleEntityNotFound(_0x19cb66,null))[_0x7645('0x17')](function(_0x585c95){if(_0x585c95){_0x4ad5d5=_0x585c95;if(!_0x5a2bc0[_0x7645('0x43')][_0x7645('0xa4')]||!utils[_0x7645('0xa9')](_0x5a2bc0[_0x7645('0x43')][_0x7645('0xa4')])){throw new db['Sequelize'][(_0x7645('0x96'))](_0x7645('0xb7'));}return _0x585c95[_0x7645('0xb8')+_[_0x7645('0xab')](_0x5a2bc0['query']['channel'][_0x7645('0xaf')]())+'Queues'](_0x5a2bc0[_0x7645('0x43')][_0x7645('0x67')]);}})[_0x7645('0x17')](function(_0x1bfe5a){if(_[_0x7645('0xb9')](_0x5a2bc0[_0x7645('0x43')][_0x7645('0x67')])){for(var _0x234c4e=0x0;_0x234c4e<_0x5a2bc0['query'][_0x7645('0x67')][_0x7645('0x5c')];_0x234c4e+=0x1){_0x33279c={'UserId':Number(_0x5a2bc0[_0x7645('0x55')]['id'])};_0x33279c[_[_0x7645('0xab')](_0x5a2bc0[_0x7645('0x43')]['channel']['toLowerCase']())+_0x7645('0xb0')]=Number(_0x5a2bc0['query'][_0x7645('0x67')][_0x234c4e]);socket['emit'](_0x7645('0x30')+_[_0x7645('0xab')](_0x5a2bc0[_0x7645('0x43')][_0x7645('0xa4')][_0x7645('0xaf')]())+_0x7645('0xba'),_0x33279c);}}else{_0x33279c={'UserId':Number(_0x5a2bc0[_0x7645('0x55')]['id'])};_0x33279c[_[_0x7645('0xab')](_0x5a2bc0[_0x7645('0x43')][_0x7645('0xa4')][_0x7645('0xaf')]())+_0x7645('0xb0')]=Number(_0x5a2bc0['query']['ids']);socket['emit']('user'+_[_0x7645('0xab')](_0x5a2bc0[_0x7645('0x43')][_0x7645('0xa4')][_0x7645('0xaf')]())+_0x7645('0xba'),_0x33279c);}return _0x1bfe5a;})[_0x7645('0x17')](function(){if(_0x5a2bc0[_0x7645('0x43')]['channel']==='voice'){return db[_0x7645('0xbb')]['destroy']({'where':{'UserId':_0x5a2bc0['params']['id'],'VoiceQueueId':_0x5a2bc0[_0x7645('0x43')][_0x7645('0x67')]},'individualHooks':!![]})[_0x7645('0x17')](function(){return _0x4ad5d5;});}return _0x4ad5d5;})['then'](respondWithStatusCode(_0x19cb66,null))[_0x7645('0x22')](handleError(_0x19cb66,null));};exports['addAvatar']=function(_0x2d96a8,_0x2adff2){_0x2d96a8[_0x7645('0x64')][_0x7645('0xbc')]=_0x2d96a8[_0x7645('0xbd')][_0x7645('0xbe')];return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x2d96a8[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x2adff2,null))[_0x7645('0x17')](saveUpdates(_0x2d96a8[_0x7645('0x64')],null))[_0x7645('0x17')](respondWithResult(_0x2adff2,null))['catch'](handleError(_0x2adff2,null));};exports[_0x7645('0xbf')]=function(_0x11d97c,_0x19129a){var _0x6d0b9b=path[_0x7645('0xc0')](config[_0x7645('0xc1')],_0x7645('0xc2'));return db[_0x7645('0x4a')]['find']({'where':{'id':_0x11d97c['params']['id']},'attributes':['id',_0x7645('0xbc')],'raw':!![]})[_0x7645('0x17')](handleEntityNotFound(_0x19129a,null))[_0x7645('0x17')](function(_0x135c22){if(_0x135c22){if(_[_0x7645('0x6e')](_0x135c22[_0x7645('0xbc')])){return _0x19129a[_0x7645('0xc3')](_0x6d0b9b);}else{if(!fs['existsSync'](path[_0x7645('0xc0')](config[_0x7645('0xc1')],_0x7645('0xc4'),_0x135c22[_0x7645('0xbc')]))){return _0x19129a[_0x7645('0xc3')](_0x6d0b9b);}return _0x19129a[_0x7645('0xc3')](path[_0x7645('0xc0')](config[_0x7645('0xc1')],_0x7645('0xc4'),_0x135c22['userpic']));}}})[_0x7645('0x22')](handleError(_0x19129a,null));};exports[_0x7645('0xc5')]=function(_0x295ef4,_0x4bbaa8){return db[_0x7645('0x4a')]['find']({'where':{'id':_0x295ef4[_0x7645('0x55')]['id']},'attributes':['id']})[_0x7645('0x17')](handleEntityNotFound(_0x4bbaa8,null))[_0x7645('0x17')](function(_0x4af80c){var _0x6cf6da=[];values=_0x4af80c[_0x7645('0x4e')];_0x6cf6da[_0x7645('0x50')](get_open_tabs(_0x7645('0x4d'),_0x4af80c['dataValues']));_0x6cf6da[_0x7645('0x50')](get_open_tabs(_0x7645('0x4f'),_0x4af80c[_0x7645('0x4e')]));_0x6cf6da[_0x7645('0x50')](get_open_tabs(_0x7645('0x52'),_0x4af80c[_0x7645('0x4e')]));_0x6cf6da['push'](get_open_tabs(_0x7645('0x53'),_0x4af80c[_0x7645('0x4e')]));_0x6cf6da[_0x7645('0x50')](get_open_tabs(_0x7645('0x62'),_0x4af80c[_0x7645('0x4e')]));_0x6cf6da[_0x7645('0x50')](get_open_tabs(_0x7645('0x51'),_0x4af80c[_0x7645('0x4e')]));return BPromise['all'](_0x6cf6da);})[_0x7645('0x17')](function(_0x95e6cb){if(_0x95e6cb){var _0x597b1d=_['map'](values[_0x7645('0xc6')],function(_0x6a197c){return{'channel':'CHAT','id':_0x6a197c['id'],'createdAt':_0x6a197c[_0x7645('0xc7')]};});var _0x11fc22=_['map'](values[_0x7645('0xc8')],function(_0x34b811){return{'channel':_0x7645('0xc9'),'id':_0x34b811['id'],'createdAt':_0x34b811[_0x7645('0xc7')]};});var _0x519926=_[_0x7645('0x35')](values[_0x7645('0xca')],function(_0x29d9ff){return{'channel':_0x7645('0xcb'),'id':_0x29d9ff['id'],'createdAt':_0x29d9ff['createdAt']};});var _0x456a69=_[_0x7645('0x35')](values[_0x7645('0xcc')],function(_0x37e65c){return{'channel':_0x7645('0xcd'),'id':_0x37e65c['id'],'createdAt':_0x37e65c[_0x7645('0xc7')]};});var _0x293a49=_[_0x7645('0x35')](values[_0x7645('0xce')],function(_0x405fd2){return{'channel':'SMS','id':_0x405fd2['id'],'createdAt':_0x405fd2[_0x7645('0xc7')]};});var _0x5602a3=_[_0x7645('0x35')](values[_0x7645('0xcf')],function(_0x394019){return{'channel':_0x7645('0xd0'),'id':_0x394019['id'],'createdAt':_0x394019[_0x7645('0xc7')]};});var _0x2c847c=_[_0x7645('0xd1')](_0x597b1d,_0x11fc22,_0x519926,_0x456a69,_0x293a49,_0x5602a3);var _0x1b4b61={'count':_0x2c847c[_0x7645('0x5c')],'rows':_0x2c847c};return _0x1b4b61;}else return null;})[_0x7645('0x17')](respondWithResult(_0x4bbaa8,null))[_0x7645('0x22')](handleError(_0x4bbaa8,null));};exports['getContacts']=function(_0x383086,_0x49feb0){var _0x519367={};var _0x1089ff={};var _0x10a693;var _0x2fa8b9;return db[_0x7645('0x4a')]['findOne']({'where':{'id':_0x383086['params']['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x49feb0,null))[_0x7645('0x17')](function(_0x14a401){if(_0x14a401){_0x10a693=_0x14a401;_0x1089ff[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xd2')]['rawAttributes']);_0x1089ff[_0x7645('0x43')]=_['keys'](_0x383086[_0x7645('0x43')]);_0x1089ff['filters']=_['intersection'](_0x1089ff['model'],_0x1089ff[_0x7645('0x43')]);_0x519367[_0x7645('0x49')]=_['intersection'](_0x1089ff['model'],qs['fields'](_0x383086[_0x7645('0x43')][_0x7645('0x5b')]));_0x519367[_0x7645('0x49')]=_0x519367['attributes']['length']?_0x519367[_0x7645('0x49')]:_0x1089ff[_0x7645('0x5a')];_0x519367[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x383086[_0x7645('0x43')][_0x7645('0xd4')]);_0x519367['where']=qs[_0x7645('0x58')](_['pick'](_0x383086[_0x7645('0x43')],_0x1089ff[_0x7645('0x58')]));if(_0x383086[_0x7645('0x43')][_0x7645('0x34')]){_0x519367['where']=_[_0x7645('0x5e')](_0x519367['where'],{'$or':_[_0x7645('0x35')](_0x519367[_0x7645('0x49')],function(_0xa4a7e4){var _0x836871={};_0x836871[_0xa4a7e4]={'$like':'%'+_0x383086['query'][_0x7645('0x34')]+'%'};return _0x836871;})});}_0x519367=_['merge']({},_0x519367,_0x383086['options']);return _0x10a693[_0x7645('0xd5')](_0x519367);}})[_0x7645('0x17')](function(_0x178cb8){if(_0x178cb8){_0x2fa8b9=_0x178cb8[_0x7645('0x5c')];if(_0x383086[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0x5d'))){_0x519367['include']=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7645('0x37'),_0x7645('0xd7')],'where':_0x383086[_0x7645('0x43')][_0x7645('0xd8')]?{'id':_0x383086[_0x7645('0x43')]['tag']}:undefined,'required':_0x383086[_0x7645('0x43')][_0x7645('0xd8')]?!![]:![]}];}if(!_0x383086[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x519367['limit']=qs[_0x7645('0xda')](_0x383086['query'][_0x7645('0xda')]);_0x519367[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x383086['query']['offset']);}return _0x10a693[_0x7645('0xd5')](_0x519367);}})['then'](function(_0x5162fa){if(_0x5162fa){return _0x5162fa?{'count':_0x2fa8b9,'rows':_0x5162fa}:null;}})[_0x7645('0x17')](respondWithResult(_0x49feb0,null))[_0x7645('0x22')](handleError(_0x49feb0,null));};exports['getQueues']=function(_0x5dbcc6,_0x1f322b){var _0x28a574;var _0x1a3d7c={};var _0x195421;return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x5dbcc6[_0x7645('0x55')]['id']},'attributes':['id',_0x7645('0x37'),_0x7645('0x2e')]})[_0x7645('0x17')](handleEntityNotFound(_0x1f322b,null))[_0x7645('0x17')](function(_0x4a9f1e){if(!utils[_0x7645('0xa9')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0xa4')])){throw new db[(_0x7645('0x99'))][(_0x7645('0x96'))]('Unknown\x20channel');}_0x28a574=_0x4a9f1e;var _0x3d0f74={};_0x3d0f74['model']=_[_0x7645('0x56')](db[_[_0x7645('0xab')](_0x5dbcc6[_0x7645('0x43')]['channel'])+_0x7645('0xdb')][_0x7645('0x57')]);_0x3d0f74[_0x7645('0x43')]=_[_0x7645('0x56')](_0x5dbcc6[_0x7645('0x43')]);_0x3d0f74[_0x7645('0x58')]=_['intersection'](_0x3d0f74['model'],_0x3d0f74['query']);_0x1a3d7c['attributes']=_['intersection'](_0x3d0f74[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0x5b')]));_0x1a3d7c['attributes']=_0x1a3d7c[_0x7645('0x49')][_0x7645('0x5c')]?_0x1a3d7c[_0x7645('0x49')]:_0x3d0f74['model'];_0x1a3d7c[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x5dbcc6[_0x7645('0x43')]['sort']);_0x1a3d7c[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x5dbcc6[_0x7645('0x43')],_0x3d0f74[_0x7645('0x58')]));if(_0x5dbcc6[_0x7645('0x43')]['filter']){_0x1a3d7c[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x1a3d7c[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x1a3d7c['attributes'],function(_0x124bb8){var _0x56aefa={};_0x56aefa[_0x124bb8]={'$like':'%'+_0x5dbcc6['query'][_0x7645('0x34')]+'%'};return _0x56aefa;})});}_0x1a3d7c=_[_0x7645('0x5e')]({},_0x1a3d7c,_0x5dbcc6[_0x7645('0x5f')]);switch(_0x28a574['role']){case _0x7645('0x88'):return db[_[_0x7645('0xab')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0xa4')])+_0x7645('0xdb')][_0x7645('0x4b')](_0x1a3d7c);case _0x7645('0x30'):case _0x7645('0x78'):return _0x28a574[_0x7645('0xb3')+_[_0x7645('0xab')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0xa4')])+_0x7645('0xac')](_0x1a3d7c);default:throw new db[(_0x7645('0x99'))][(_0x7645('0x96'))](_0x7645('0xdd'));}})[_0x7645('0x17')](function(_0x44c2c1){_0x195421=_0x44c2c1[_0x7645('0x5c')];if(!_0x5dbcc6[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x1a3d7c['limit']=qs[_0x7645('0xda')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0xda')]);_0x1a3d7c[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x5dbcc6['query'][_0x7645('0x28')]);}switch(_0x28a574[_0x7645('0x2e')]){case _0x7645('0x88'):return db[_[_0x7645('0xab')](_0x5dbcc6[_0x7645('0x43')][_0x7645('0xa4')])+_0x7645('0xdb')][_0x7645('0x4b')](_0x1a3d7c);case _0x7645('0x30'):case _0x7645('0x78'):return _0x28a574[_0x7645('0xb3')+_['capitalize'](_0x5dbcc6[_0x7645('0x43')]['channel'])+_0x7645('0xac')](_0x1a3d7c);}})['then'](function(_0x323ad7){return{'count':_0x195421,'rows':_0x323ad7};})[_0x7645('0x17')](respondWithResult(_0x1f322b,null))[_0x7645('0x22')](handleError(_0x1f322b,null));};exports[_0x7645('0xde')]=function(_0x27b4fe,_0x29833f){var _0x903c81={};var _0x13b0e3={};var _0x4d1207;var _0x3056fd;return db['User']['findOne']({'where':{'id':_0x27b4fe[_0x7645('0x55')]['id']}})['then'](handleEntityNotFound(_0x29833f,null))[_0x7645('0x17')](function(_0x766306){if(_0x766306){_0x4d1207=_0x766306;_0x13b0e3['model']=_['keys'](db['UserVoiceQueueRt'][_0x7645('0x57')]);_0x13b0e3['query']=_['keys'](_0x27b4fe['query']);_0x13b0e3[_0x7645('0x58')]=_[_0x7645('0x59')](_0x13b0e3[_0x7645('0x5a')],_0x13b0e3[_0x7645('0x43')]);_0x903c81[_0x7645('0x49')]=_['intersection'](_0x13b0e3[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0x27b4fe[_0x7645('0x43')]['fields']));_0x903c81['attributes']=_0x903c81[_0x7645('0x49')][_0x7645('0x5c')]?_0x903c81[_0x7645('0x49')]:_0x13b0e3[_0x7645('0x5a')];_0x903c81['order']=qs[_0x7645('0xd4')](_0x27b4fe[_0x7645('0x43')][_0x7645('0xd4')]);_0x903c81['where']=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x27b4fe[_0x7645('0x43')],_0x13b0e3[_0x7645('0x58')]));if(_0x27b4fe['query'][_0x7645('0x34')]){_0x903c81[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x903c81['where'],{'$or':_[_0x7645('0x35')](_0x903c81[_0x7645('0x49')],function(_0x303069){var _0x5145fe={};_0x5145fe[_0x303069]={'$like':'%'+_0x27b4fe['query'][_0x7645('0x34')]+'%'};return _0x5145fe;})});}_0x903c81=_[_0x7645('0x5e')]({},_0x903c81,_0x27b4fe[_0x7645('0x5f')]);return _0x4d1207['getVoiceQueuesRt'](_0x903c81);}})[_0x7645('0x17')](function(_0x1803d2){if(_0x1803d2){_0x3056fd=_0x1803d2['length'];if(!_0x27b4fe['query'][_0x7645('0xd6')](_0x7645('0xd9'))){_0x903c81[_0x7645('0xda')]=qs['limit'](_0x27b4fe[_0x7645('0x43')]['limit']);_0x903c81['offset']=qs[_0x7645('0x28')](_0x27b4fe[_0x7645('0x43')]['offset']);}return _0x4d1207[_0x7645('0xde')](_0x903c81);}})[_0x7645('0x17')](function(_0x1ffc24){if(_0x1ffc24){return _0x1ffc24?{'count':_0x3056fd,'rows':_0x1ffc24}:null;}})[_0x7645('0x17')](respondWithResult(_0x29833f,null))['catch'](handleError(_0x29833f,null));};exports['getGroups']=function(_0x3c99c9,_0x5ec18b){var _0x3de9a0={};var _0x500c9b={};var _0x5a26c5;var _0x4288f8;return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x3c99c9['params']['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x5ec18b,null))[_0x7645('0x17')](function(_0x37f19f){if(_0x37f19f){_0x5a26c5=_0x37f19f;_0x500c9b[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xdf')]['rawAttributes']);_0x500c9b[_0x7645('0x43')]=_['keys'](_0x3c99c9[_0x7645('0x43')]);_0x500c9b[_0x7645('0x58')]=_[_0x7645('0x59')](_0x500c9b[_0x7645('0x5a')],_0x500c9b[_0x7645('0x43')]);_0x3de9a0['attributes']=_['intersection'](_0x500c9b[_0x7645('0x5a')],qs['fields'](_0x3c99c9[_0x7645('0x43')][_0x7645('0x5b')]));_0x3de9a0[_0x7645('0x49')]=_0x3de9a0[_0x7645('0x49')][_0x7645('0x5c')]?_0x3de9a0[_0x7645('0x49')]:_0x500c9b['model'];_0x3de9a0[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x3c99c9['query'][_0x7645('0xd4')]);_0x3de9a0[_0x7645('0x42')]=qs[_0x7645('0x58')](_['pick'](_0x3c99c9[_0x7645('0x43')],_0x500c9b['filters']));if(_0x3c99c9[_0x7645('0x43')][_0x7645('0x34')]){_0x3de9a0[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x3de9a0[_0x7645('0x42')],{'$or':_['map'](_0x3de9a0[_0x7645('0x49')],function(_0xfb22ef){var _0x1707d9={};_0x1707d9[_0xfb22ef]={'$like':'%'+_0x3c99c9[_0x7645('0x43')]['filter']+'%'};return _0x1707d9;})});}_0x3de9a0=_[_0x7645('0x5e')]({},_0x3de9a0,_0x3c99c9[_0x7645('0x5f')]);return _0x5a26c5[_0x7645('0xe0')](_0x3de9a0);}})['then'](function(_0x2b5b2c){if(_0x2b5b2c){_0x4288f8=_0x2b5b2c['length'];if(!_0x3c99c9[_0x7645('0x43')]['hasOwnProperty'](_0x7645('0xd9'))){_0x3de9a0[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x3c99c9[_0x7645('0x43')]['limit']);_0x3de9a0['offset']=qs['offset'](_0x3c99c9[_0x7645('0x43')][_0x7645('0x28')]);}return _0x5a26c5[_0x7645('0xe0')](_0x3de9a0);}})[_0x7645('0x17')](function(_0x28b92f){if(_0x28b92f){return _0x28b92f?{'count':_0x4288f8,'rows':_0x28b92f}:null;}})['then'](respondWithResult(_0x5ec18b,null))[_0x7645('0x22')](handleError(_0x5ec18b,null));};exports[_0x7645('0xe1')]=function(_0x354c8b,_0x2964aa){var _0x3f2349={'raw':!![],'where':{}};var _0x400ca1={};var _0x1e9944={'count':0x0,'rows':[]};return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x354c8b[_0x7645('0x55')]['id']}})['then'](handleEntityNotFound(_0x2964aa,null))[_0x7645('0x17')](function(_0x4695e8){if(_0x4695e8){_0x400ca1[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xe2')][_0x7645('0x57')]);_0x400ca1['query']=_[_0x7645('0x56')](_0x354c8b[_0x7645('0x43')]);_0x400ca1[_0x7645('0x58')]=_[_0x7645('0x59')](_0x400ca1['model'],_0x400ca1[_0x7645('0x43')]);_0x3f2349[_0x7645('0x49')]=_['intersection'](_0x400ca1['model'],qs[_0x7645('0x5b')](_0x354c8b[_0x7645('0x43')][_0x7645('0x5b')]));_0x3f2349[_0x7645('0x49')]=_0x3f2349['attributes'][_0x7645('0x5c')]?_0x3f2349[_0x7645('0x49')]:_0x400ca1[_0x7645('0x5a')];if(!_0x354c8b[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x3f2349[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x354c8b[_0x7645('0x43')][_0x7645('0xda')]);_0x3f2349[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x354c8b[_0x7645('0x43')]['offset']);}_0x3f2349[_0x7645('0xd3')]=qs['sort'](_0x354c8b[_0x7645('0x43')][_0x7645('0xd4')]);_0x3f2349[_0x7645('0x42')]=qs['filters'](_[_0x7645('0xdc')](_0x354c8b[_0x7645('0x43')],_0x400ca1[_0x7645('0x58')]));_0x3f2349['where'][_0x7645('0xe3')]=_0x4695e8['id'];if(_0x354c8b[_0x7645('0x43')][_0x7645('0x34')]){_0x3f2349[_0x7645('0x42')]=_['merge'](_0x3f2349['where'],{'$or':_[_0x7645('0x35')](_0x3f2349[_0x7645('0x49')],function(_0x59e372){var _0x2412dc={};_0x2412dc[_0x59e372]={'$like':'%'+_0x354c8b[_0x7645('0x43')]['filter']+'%'};return _0x2412dc;})});}_0x3f2349=_[_0x7645('0x5e')]({},_0x3f2349,_0x354c8b['options']);return db['VoiceRecording'][_0x7645('0x27')]({'where':_0x3f2349[_0x7645('0x42')]})['then'](function(_0x55191e){_0x1e9944['count']=_0x55191e;if(_0x354c8b['query']['includeAll']){_0x3f2349[_0x7645('0x44')]=[{'all':!![]}];}return db[_0x7645('0xe2')][_0x7645('0x4b')](_0x3f2349);})[_0x7645('0x17')](function(_0x2255c7){_0x1e9944[_0x7645('0x4c')]=_0x2255c7;return _0x1e9944;});}})[_0x7645('0x17')](respondWithFilteredResult(_0x2964aa,_0x3f2349))[_0x7645('0x22')](handleError(_0x2964aa,null));};exports[_0x7645('0xe4')]=function(_0x59f9e4,_0x59f89d){var _0x49846a={'raw':!![],'where':{}};var _0x3d8985={};var _0x58f5c4={'count':0x0,'rows':[]};return db['User'][_0x7645('0x9d')]({'where':{'id':_0x59f9e4[_0x7645('0x55')]['id']}})['then'](handleEntityNotFound(_0x59f89d,null))['then'](function(_0x12a2c9){if(_0x12a2c9){_0x3d8985['model']=_['keys'](db[_0x7645('0xe5')][_0x7645('0x57')]);_0x3d8985[_0x7645('0x43')]=_[_0x7645('0x56')](_0x59f9e4[_0x7645('0x43')]);_0x3d8985[_0x7645('0x58')]=_['intersection'](_0x3d8985[_0x7645('0x5a')],_0x3d8985[_0x7645('0x43')]);_0x49846a[_0x7645('0x49')]=_[_0x7645('0x59')](_0x3d8985['model'],qs['fields'](_0x59f9e4[_0x7645('0x43')][_0x7645('0x5b')]));_0x49846a[_0x7645('0x49')]=_0x49846a[_0x7645('0x49')][_0x7645('0x5c')]?_0x49846a[_0x7645('0x49')]:_0x3d8985[_0x7645('0x5a')];if(!_0x59f9e4[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x49846a[_0x7645('0xda')]=qs['limit'](_0x59f9e4[_0x7645('0x43')][_0x7645('0xda')]);_0x49846a[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x59f9e4[_0x7645('0x43')][_0x7645('0x28')]);}_0x49846a[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x59f9e4[_0x7645('0x43')]['sort']);_0x49846a[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x59f9e4['query'],_0x3d8985['filters']));_0x49846a[_0x7645('0x42')][_0x7645('0xe3')]=_0x12a2c9['id'];if(_0x59f9e4[_0x7645('0x43')][_0x7645('0x34')]){_0x49846a[_0x7645('0x42')]=_['merge'](_0x49846a[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x49846a[_0x7645('0x49')],function(_0x8db17a){var _0x1bdcfe={};_0x1bdcfe[_0x8db17a]={'$like':'%'+_0x59f9e4[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x1bdcfe;})});}_0x49846a=_[_0x7645('0x5e')]({},_0x49846a,_0x59f9e4[_0x7645('0x5f')]);return db['ScreenRecording']['count']({'where':_0x49846a[_0x7645('0x42')]})[_0x7645('0x17')](function(_0x13aea5){_0x58f5c4[_0x7645('0x27')]=_0x13aea5;if(_0x59f9e4[_0x7645('0x43')][_0x7645('0x5d')]){_0x49846a[_0x7645('0x44')]=[{'all':!![]}];}return db[_0x7645('0xe5')]['findAll'](_0x49846a);})[_0x7645('0x17')](function(_0x523d11){_0x58f5c4['rows']=_0x523d11;return _0x58f5c4;});}})['then'](respondWithFilteredResult(_0x59f89d,_0x49846a))['catch'](handleError(_0x59f89d,null));};exports[_0x7645('0xe6')]=function(_0x4058b5,_0x1664c0){var _0x303f80={};var _0x1ea8c8={};var _0x1c82d8;var _0x35df9c;return db['User'][_0x7645('0x9d')]({'where':{'id':_0x4058b5['params']['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x1664c0,null))[_0x7645('0x17')](function(_0x4c3d24){if(_0x4c3d24){_0x1c82d8=_0x4c3d24;_0x1ea8c8['model']=_[_0x7645('0x56')](db[_0x7645('0xe7')][_0x7645('0x57')]);_0x1ea8c8[_0x7645('0x43')]=_['keys'](_0x4058b5[_0x7645('0x43')]);_0x1ea8c8[_0x7645('0x58')]=_[_0x7645('0x59')](_0x1ea8c8[_0x7645('0x5a')],_0x1ea8c8[_0x7645('0x43')]);_0x303f80['attributes']=_[_0x7645('0x59')](_0x1ea8c8['model'],qs['fields'](_0x4058b5['query'][_0x7645('0x5b')]));_0x303f80[_0x7645('0x49')]=_0x303f80[_0x7645('0x49')]['length']?_0x303f80[_0x7645('0x49')]:_0x1ea8c8['model'];_0x303f80[_0x7645('0xd3')]=qs['sort'](_0x4058b5[_0x7645('0x43')][_0x7645('0xd4')]);_0x303f80[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x4058b5[_0x7645('0x43')],_0x1ea8c8[_0x7645('0x58')]));if(_0x4058b5[_0x7645('0x43')][_0x7645('0x34')]){_0x303f80[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x303f80[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x303f80['attributes'],function(_0x4fcfc2){var _0x1193e0={};_0x1193e0[_0x4fcfc2]={'$like':'%'+_0x4058b5['query'][_0x7645('0x34')]+'%'};return _0x1193e0;})});}_0x303f80=_[_0x7645('0x5e')]({},_0x303f80,_0x4058b5[_0x7645('0x5f')]);return _0x1c82d8['getChatInteractions'](_0x303f80);}})['then'](function(_0x4effbe){if(_0x4effbe){_0x35df9c=_0x4effbe['length'];if(!_0x4058b5[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x303f80[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x4058b5[_0x7645('0x43')][_0x7645('0xda')]);_0x303f80[_0x7645('0x28')]=qs['offset'](_0x4058b5[_0x7645('0x43')][_0x7645('0x28')]);}return _0x1c82d8[_0x7645('0xe6')](_0x303f80);}})['then'](function(_0x549708){if(_0x549708){return _0x549708?{'count':_0x35df9c,'rows':_0x549708}:null;}})[_0x7645('0x17')](respondWithResult(_0x1664c0,null))[_0x7645('0x22')](handleError(_0x1664c0,null));};exports['getOpenchannelInteractions']=function(_0x5ddc00,_0xdca6f6){var _0x27ad01={};var _0x1cee35={};var _0x673697;var _0x223f67;return db[_0x7645('0x4a')]['findOne']({'where':{'id':_0x5ddc00[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0xdca6f6,null))[_0x7645('0x17')](function(_0x3e0300){if(_0x3e0300){_0x673697=_0x3e0300;_0x1cee35[_0x7645('0x5a')]=_['keys'](db[_0x7645('0xe8')][_0x7645('0x57')]);_0x1cee35[_0x7645('0x43')]=_['keys'](_0x5ddc00[_0x7645('0x43')]);_0x1cee35[_0x7645('0x58')]=_[_0x7645('0x59')](_0x1cee35[_0x7645('0x5a')],_0x1cee35['query']);_0x27ad01[_0x7645('0x49')]=_[_0x7645('0x59')](_0x1cee35['model'],qs['fields'](_0x5ddc00['query'][_0x7645('0x5b')]));_0x27ad01[_0x7645('0x49')]=_0x27ad01[_0x7645('0x49')]['length']?_0x27ad01[_0x7645('0x49')]:_0x1cee35[_0x7645('0x5a')];_0x27ad01[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x5ddc00[_0x7645('0x43')][_0x7645('0xd4')]);_0x27ad01[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x5ddc00[_0x7645('0x43')],_0x1cee35[_0x7645('0x58')]));if(_0x5ddc00[_0x7645('0x43')]['filter']){_0x27ad01[_0x7645('0x42')]=_['merge'](_0x27ad01['where'],{'$or':_[_0x7645('0x35')](_0x27ad01[_0x7645('0x49')],function(_0x4efc44){var _0x21aad8={};_0x21aad8[_0x4efc44]={'$like':'%'+_0x5ddc00[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x21aad8;})});}_0x27ad01=_[_0x7645('0x5e')]({},_0x27ad01,_0x5ddc00[_0x7645('0x5f')]);return _0x673697[_0x7645('0xe9')](_0x27ad01);}})['then'](function(_0x3b95ac){if(_0x3b95ac){_0x223f67=_0x3b95ac[_0x7645('0x5c')];if(!_0x5ddc00[_0x7645('0x43')]['hasOwnProperty'](_0x7645('0xd9'))){_0x27ad01[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x5ddc00[_0x7645('0x43')][_0x7645('0xda')]);_0x27ad01[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x5ddc00['query']['offset']);}return _0x673697[_0x7645('0xe9')](_0x27ad01);}})[_0x7645('0x17')](function(_0x397e4a){if(_0x397e4a){return _0x397e4a?{'count':_0x223f67,'rows':_0x397e4a}:null;}})['then'](respondWithResult(_0xdca6f6,null))['catch'](handleError(_0xdca6f6,null));};exports[_0x7645('0xea')]=function(_0x90bd74,_0x53bb20){var _0x273986={'raw':!![],'where':{}};var _0x307f94={};var _0x320381={'count':0x0,'rows':[]};return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x90bd74[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x53bb20,null))['then'](function(_0x1a2105){if(_0x1a2105){_0x307f94[_0x7645('0x5a')]=_[_0x7645('0x56')](db['MailInteraction'][_0x7645('0x57')]);_0x307f94['query']=_[_0x7645('0x56')](_0x90bd74[_0x7645('0x43')]);_0x307f94[_0x7645('0x58')]=_[_0x7645('0x59')](_0x307f94['model'],_0x307f94['query']);_0x273986[_0x7645('0x49')]=_[_0x7645('0x59')](_0x307f94['model'],qs[_0x7645('0x5b')](_0x90bd74['query'][_0x7645('0x5b')]));_0x273986[_0x7645('0x49')]=_0x273986[_0x7645('0x49')][_0x7645('0x5c')]?_0x273986[_0x7645('0x49')]:_0x307f94[_0x7645('0x5a')];if(!_0x90bd74[_0x7645('0x43')]['hasOwnProperty'](_0x7645('0xd9'))){_0x273986[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x90bd74[_0x7645('0x43')][_0x7645('0xda')]);_0x273986['offset']=qs[_0x7645('0x28')](_0x90bd74['query']['offset']);}_0x273986[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x90bd74['query'][_0x7645('0xd4')]);_0x273986[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x90bd74[_0x7645('0x43')],_0x307f94[_0x7645('0x58')]));_0x273986[_0x7645('0x42')][_0x7645('0xe3')]=_0x1a2105['id'];if(_0x90bd74[_0x7645('0x43')][_0x7645('0x34')]){_0x273986[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x273986[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x273986[_0x7645('0x49')],function(_0x5edaca){var _0x191ef4={};_0x191ef4[_0x5edaca]={'$like':'%'+_0x90bd74[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x191ef4;})});}_0x273986=_['merge']({},_0x273986,_0x90bd74['options']);return db[_0x7645('0xeb')][_0x7645('0x27')]({'where':_0x273986['where']})[_0x7645('0x17')](function(_0x8e5fe3){_0x320381[_0x7645('0x27')]=_0x8e5fe3;if(_0x90bd74['query'][_0x7645('0x5d')]){_0x273986['include']=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0x273986);})['then'](function(_0x2e6cb5){_0x320381[_0x7645('0x4c')]=_0x2e6cb5;return _0x320381;});}})[_0x7645('0x17')](respondWithFilteredResult(_0x53bb20,_0x273986))[_0x7645('0x22')](handleError(_0x53bb20,null));};exports[_0x7645('0xec')]=function(_0x36eb34,_0x2f4fe1){var _0x18bd36={};var _0x58e224={};var _0x57dc6b;var _0x5eb4d7;return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x36eb34[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x2f4fe1,null))[_0x7645('0x17')](function(_0x63cf5d){if(_0x63cf5d){_0x57dc6b=_0x63cf5d;_0x58e224[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xed')][_0x7645('0x57')]);_0x58e224['query']=_[_0x7645('0x56')](_0x36eb34[_0x7645('0x43')]);_0x58e224[_0x7645('0x58')]=_[_0x7645('0x59')](_0x58e224[_0x7645('0x5a')],_0x58e224['query']);_0x18bd36[_0x7645('0x49')]=_['intersection'](_0x58e224[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0x36eb34[_0x7645('0x43')][_0x7645('0x5b')]));_0x18bd36[_0x7645('0x49')]=_0x18bd36[_0x7645('0x49')][_0x7645('0x5c')]?_0x18bd36[_0x7645('0x49')]:_0x58e224[_0x7645('0x5a')];_0x18bd36[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x36eb34[_0x7645('0x43')][_0x7645('0xd4')]);_0x18bd36[_0x7645('0x42')]=qs['filters'](_[_0x7645('0xdc')](_0x36eb34[_0x7645('0x43')],_0x58e224[_0x7645('0x58')]));if(_0x36eb34[_0x7645('0x43')][_0x7645('0x34')]){_0x18bd36[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x18bd36[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x18bd36[_0x7645('0x49')],function(_0x4091e8){var _0x690496={};_0x690496[_0x4091e8]={'$like':'%'+_0x36eb34['query'][_0x7645('0x34')]+'%'};return _0x690496;})});}_0x18bd36=_['merge']({},_0x18bd36,_0x36eb34[_0x7645('0x5f')]);return _0x57dc6b[_0x7645('0xec')](_0x18bd36);}})[_0x7645('0x17')](function(_0x1f946c){if(_0x1f946c){_0x5eb4d7=_0x1f946c[_0x7645('0x5c')];if(!_0x36eb34['query'][_0x7645('0xd6')](_0x7645('0xd9'))){_0x18bd36[_0x7645('0xda')]=qs[_0x7645('0xda')](_0x36eb34[_0x7645('0x43')][_0x7645('0xda')]);_0x18bd36['offset']=qs[_0x7645('0x28')](_0x36eb34[_0x7645('0x43')][_0x7645('0x28')]);}return _0x57dc6b['getSmsInteractions'](_0x18bd36);}})[_0x7645('0x17')](function(_0x1e0165){if(_0x1e0165){return _0x1e0165?{'count':_0x5eb4d7,'rows':_0x1e0165}:null;}})[_0x7645('0x17')](respondWithResult(_0x2f4fe1,null))[_0x7645('0x22')](handleError(_0x2f4fe1,null));};exports[_0x7645('0xee')]=function(_0xcad7d2,_0x279766){var _0x51f3d6={};var _0x5c1e2b={};var _0x240e39;var _0x4c89b8;return db[_0x7645('0x4a')]['findOne']({'where':{'id':_0xcad7d2['params']['id']}})['then'](handleEntityNotFound(_0x279766,null))[_0x7645('0x17')](function(_0x3861cd){if(_0x3861cd){_0x240e39=_0x3861cd;_0x5c1e2b[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xef')][_0x7645('0x57')]);_0x5c1e2b[_0x7645('0x43')]=_[_0x7645('0x56')](_0xcad7d2['query']);_0x5c1e2b['filters']=_[_0x7645('0x59')](_0x5c1e2b['model'],_0x5c1e2b['query']);_0x51f3d6[_0x7645('0x49')]=_['intersection'](_0x5c1e2b['model'],qs[_0x7645('0x5b')](_0xcad7d2[_0x7645('0x43')][_0x7645('0x5b')]));_0x51f3d6['attributes']=_0x51f3d6['attributes'][_0x7645('0x5c')]?_0x51f3d6[_0x7645('0x49')]:_0x5c1e2b['model'];_0x51f3d6[_0x7645('0xd3')]=qs['sort'](_0xcad7d2[_0x7645('0x43')]['sort']);_0x51f3d6[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0xcad7d2[_0x7645('0x43')],_0x5c1e2b[_0x7645('0x58')]));if(_0xcad7d2[_0x7645('0x43')][_0x7645('0x34')]){_0x51f3d6[_0x7645('0x42')]=_[_0x7645('0x5e')](_0x51f3d6[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x51f3d6[_0x7645('0x49')],function(_0x3794b4){var _0x1fd554={};_0x1fd554[_0x3794b4]={'$like':'%'+_0xcad7d2[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x1fd554;})});}_0x51f3d6=_[_0x7645('0x5e')]({},_0x51f3d6,_0xcad7d2['options']);return _0x240e39[_0x7645('0xee')](_0x51f3d6);}})[_0x7645('0x17')](function(_0x453b8f){if(_0x453b8f){_0x4c89b8=_0x453b8f[_0x7645('0x5c')];if(!_0xcad7d2[_0x7645('0x43')]['hasOwnProperty'](_0x7645('0xd9'))){_0x51f3d6[_0x7645('0xda')]=qs[_0x7645('0xda')](_0xcad7d2['query'][_0x7645('0xda')]);_0x51f3d6[_0x7645('0x28')]=qs['offset'](_0xcad7d2[_0x7645('0x43')][_0x7645('0x28')]);}return _0x240e39[_0x7645('0xee')](_0x51f3d6);}})[_0x7645('0x17')](function(_0x1cc68){if(_0x1cc68){return _0x1cc68?{'count':_0x4c89b8,'rows':_0x1cc68}:null;}})['then'](respondWithResult(_0x279766,null))[_0x7645('0x22')](handleError(_0x279766,null));};exports[_0x7645('0xf0')]=function(_0x1637e6,_0x3aa3ea){var _0x1ff70c={};var _0x3caaa9={};var _0x27245e;var _0x2bea8a;return db['User'][_0x7645('0x9d')]({'where':{'id':_0x1637e6[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x3aa3ea,null))[_0x7645('0x17')](function(_0x5dc56e){if(_0x5dc56e){_0x27245e=_0x5dc56e;_0x3caaa9[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0xf1')]['rawAttributes']);_0x3caaa9[_0x7645('0x43')]=_[_0x7645('0x56')](_0x1637e6[_0x7645('0x43')]);_0x3caaa9[_0x7645('0x58')]=_['intersection'](_0x3caaa9[_0x7645('0x5a')],_0x3caaa9[_0x7645('0x43')]);_0x1ff70c[_0x7645('0x49')]=_[_0x7645('0x59')](_0x3caaa9[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0x1637e6[_0x7645('0x43')]['fields']));_0x1ff70c[_0x7645('0x49')]=_0x1ff70c[_0x7645('0x49')][_0x7645('0x5c')]?_0x1ff70c[_0x7645('0x49')]:_0x3caaa9[_0x7645('0x5a')];_0x1ff70c[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x1637e6[_0x7645('0x43')][_0x7645('0xd4')]);_0x1ff70c['where']=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x1637e6[_0x7645('0x43')],_0x3caaa9[_0x7645('0x58')]));if(_0x1637e6[_0x7645('0x43')]['filter']){_0x1ff70c[_0x7645('0x42')]=_['merge'](_0x1ff70c['where'],{'$or':_[_0x7645('0x35')](_0x1ff70c[_0x7645('0x49')],function(_0x2b4140){var _0x578e98={};_0x578e98[_0x2b4140]={'$like':'%'+_0x1637e6[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x578e98;})});}_0x1ff70c=_[_0x7645('0x5e')]({},_0x1ff70c,_0x1637e6['options']);return _0x27245e['getWhatsappInteractions'](_0x1ff70c);}})[_0x7645('0x17')](function(_0x39c3e7){if(_0x39c3e7){_0x2bea8a=_0x39c3e7['length'];if(!_0x1637e6['query'][_0x7645('0xd6')](_0x7645('0xd9'))){_0x1ff70c['limit']=qs[_0x7645('0xda')](_0x1637e6[_0x7645('0x43')][_0x7645('0xda')]);_0x1ff70c[_0x7645('0x28')]=qs['offset'](_0x1637e6[_0x7645('0x43')][_0x7645('0x28')]);}return _0x27245e['getWhatsappInteractions'](_0x1ff70c);}})['then'](function(_0x480fb6){if(_0x480fb6){return _0x480fb6?{'count':_0x2bea8a,'rows':_0x480fb6}:null;}})['then'](respondWithResult(_0x3aa3ea,null))[_0x7645('0x22')](handleError(_0x3aa3ea,null));};exports[_0x7645('0xf2')]=function(_0x31dbdb,_0x1c28ad,_0x51b809){var _0x158347;var _0x9ddfb3;var _0x6d552b;var _0x3d3476=!_[_0x7645('0x6e')](_0x31dbdb[_0x7645('0x55')]['id'])?_0x31dbdb[_0x7645('0x55')]['id']:!_[_0x7645('0x6e')](_0x31dbdb['user']['id'])?_0x31dbdb[_0x7645('0x30')]['id']:null;return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x3d3476,'role':{'$or':[_0x7645('0x88'),_0x7645('0x30'),'agent']}},'attributes':['id',_0x7645('0x37'),_0x7645('0xf3'),_0x7645('0xf4'),_0x7645('0x2e'),_0x7645('0x69'),_0x7645('0xa6')]})[_0x7645('0x17')](function(_0x31dc72){if(_0x31dc72){if(_0x31dc72[_0x7645('0x2e')]===_0x7645('0x78')){_0x158347=_0x31dc72;if(_0x31dbdb['body'][_0x7645('0xa8')]){_0x6d552b=util[_0x7645('0xf5')](_0x7645('0xf6'),_0x158347[_0x31dbdb[_0x7645('0x64')][_0x7645('0xa8')]]);}else if(_0x31dbdb[_0x7645('0x64')]['intrf']){_0x6d552b=util[_0x7645('0xf5')](_0x7645('0xb4'),_0x31dbdb['body'][_0x7645('0xf7')]);}else{_0x6d552b=util[_0x7645('0xf5')](_0x7645('0xb4'),_0x158347['name']);}socket['to'](util['format'](_0x7645('0xf8'),_0x158347['name']))[_0x7645('0x2b')]('user:forcelogout',{'user':{'id':_0x158347['id'],'name':_0x158347[_0x7645('0x37')]},'ip':_0x31dbdb[_0x7645('0xf9')]['x-forwarded-for']||_0x31dbdb[_0x7645('0xfa')][_0x7645('0xfb')]||_0x31dbdb[_0x7645('0xfc')][_0x7645('0xfb')]||_0x31dbdb[_0x7645('0xfa')][_0x7645('0xfc')][_0x7645('0xfb')]});return db['UserVoiceQueueRt'][_0x7645('0x2d')]({'where':{'membername':_0x158347['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7645('0x96'))](_0x7645('0xfd'));}})['then'](function(){if(_0x158347){return _0x158347[_0x7645('0xfe')]({'raw':!![]});}})[_0x7645('0x17')](function(_0x4b58ad){if(_0x158347){var _0x45ad99=[];if(_0x4b58ad){_0x9ddfb3=_0x4b58ad;if(_0x9ddfb3[_0x7645('0x5c')]){for(var _0x49d200=0x0;_0x49d200<_0x9ddfb3[_0x7645('0x5c')];_0x49d200++){_0x45ad99[_0x7645('0x50')]({'membername':_0x158347[_0x7645('0x37')],'UserId':_0x158347['id'],'queue_name':_0x9ddfb3[_0x49d200][_0x7645('0x37')],'VoiceQueueId':_0x9ddfb3[_0x49d200]['id'],'interface':_0x6d552b,'paused':_0x158347[_0x7645('0xa6')]||![],'penalty':_0x9ddfb3[_0x49d200][_0x7645('0xff')]||0x0});}return BPromise['each'](_0x45ad99,function(_0x4113b5){return db[_0x7645('0xbb')][_0x7645('0xb5')](_0x4113b5);});}}}})[_0x7645('0x17')](function(){if(_0x158347){return db[_0x7645('0x100')][_0x7645('0x4b')]({'where':{'membername':_0x158347['name'],'exitAt':null}});}})[_0x7645('0x17')](function(_0x34514e){if(_0x158347){var _0x308b0f=[];_0x34514e[_0x7645('0x101')](function(_0x2b5857){_0x308b0f[_0x7645('0x50')](_0x2b5857[_0x7645('0x2a')]({'exitAt':moment()[_0x7645('0xf5')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x308b0f);}})[_0x7645('0x17')](function(){if(_0x158347){var _0x1f1148=[];var _0x1807d2=[];var _0xa70681=utils[_0x7645('0x102')]();var _0x193a8b={'membername':_0x158347['name'],'interface':_0x6d552b,'enterAt':moment()[_0x7645('0xf5')](_0x7645('0x103')),'role':_0x158347[_0x7645('0x2e')],'internal':_0x158347['internal']};_0xa70681[_0x7645('0x101')](function(_0x279d05){_0x1f1148[_0x7645('0x50')](_[_0x7645('0x5e')]({'channel':_0x279d05,'type':'LOGIN','data1':_0x31dbdb[_0x7645('0x64')]['device'],'data2':_0x6d552b},_0x193a8b));if(_0x158347[_0x7645('0xa6')]){_0x1807d2[_0x7645('0x50')](_['merge']({'channel':_0x279d05,'type':_0x7645('0x104'),'data1':_0x7645('0x105')},_0x193a8b));}});return db['MemberReport'][_0x7645('0x8e')](_0x1f1148[_0x7645('0xd1')](_0x1807d2),{'individualHooks':!![]});}})['then'](function(){if(_0x158347){return _0x158347[_0x7645('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x7645('0xf5')](_0x7645('0x103')),'voicePause':_0x158347[_0x7645('0xa6')]||![],'mailPause':_0x158347['loginInPause']||![],'chatPause':_0x158347[_0x7645('0xa6')]||![],'faxPause':_0x158347['loginInPause']||![],'smsPause':_0x158347['loginInPause']||![],'openchannelPause':_0x158347[_0x7645('0xa6')]||![],'whatsappPause':_0x158347[_0x7645('0xa6')]||![],'pauseType':_0x158347[_0x7645('0xa6')]?_0x7645('0x105'):null,'interface':_0x6d552b,'lastPauseAt':moment()[_0x7645('0xf5')](_0x7645('0x103'))});}})[_0x7645('0x17')](function(_0x37a1d4){if(_0x31dbdb['isMiddleware']){return _0x51b809();}else{return BPromise[_0x7645('0x106')](_0x37a1d4)[_0x7645('0x17')](respondWithResult(_0x1c28ad,null));}})[_0x7645('0x22')](handleError(_0x1c28ad,null));};exports[_0x7645('0x107')]=function(_0x3c820c,_0xee53c6){var _0xf897b2;return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x3c820c[_0x7645('0x55')]['id'],'role':_0x7645('0x78')},'attributes':['id','name',_0x7645('0x2e')]})[_0x7645('0x17')](handleEntityNotFound(_0xee53c6,null))[_0x7645('0x17')](function(_0x3a768c){if(_0x3a768c){_0xf897b2=_0x3a768c;return db[_0x7645('0xbb')]['destroy']({'where':{'membername':_0xf897b2[_0x7645('0x37')]},'individualHooks':!![]});}})[_0x7645('0x17')](function(){return db[_0x7645('0x100')][_0x7645('0x4b')]({'where':{'membername':_0xf897b2[_0x7645('0x37')],'exitAt':null}});})[_0x7645('0x17')](function(_0x4b7436){var _0xd082f=[];_0x4b7436[_0x7645('0x101')](function(_0x5c9b4d){_0xd082f['push'](_0x5c9b4d[_0x7645('0x2a')]({'exitAt':moment()[_0x7645('0xf5')](_0x7645('0x103'))}));});return BPromise[_0x7645('0x63')](_0xd082f);})[_0x7645('0x17')](function(){return _0xf897b2[_0x7645('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0xee53c6,null))[_0x7645('0x22')](handleError(_0xee53c6,null));};exports[_0x7645('0x108')]=function(_0x59d0a7,_0x9d8397){var _0x5a3fef;return db[_0x7645('0xbb')]['update']({'paused':0x1},{'where':{'UserId':_0x59d0a7['params']['id']},'individualHooks':!![]})[_0x7645('0x17')](function(){return db[_0x7645('0x4a')][_0x7645('0x60')]({'where':{'id':_0x59d0a7['params']['id'],'role':_0x7645('0x78')},'attributes':['id','name',_0x7645('0x2e'),_0x7645('0x69'),_0x7645('0xa8')]});})['then'](handleEntityNotFound(_0x9d8397,null))[_0x7645('0x17')](function(_0x24138a){if(_0x24138a){_0x5a3fef=_0x24138a;return respondWithRpcPromise('QueuePause',_0x7645('0x108'),{'id':_0x5a3fef['id'],'name':_0x5a3fef[_0x7645('0x37')],'pause':!![]});}})[_0x7645('0x17')](function(){if(_0x5a3fef){return db[_0x7645('0x100')][_0x7645('0x4b')]({'where':{'membername':_0x5a3fef[_0x7645('0x37')],'type':'PAUSE','exitAt':null}});}})[_0x7645('0x17')](function(_0x32bdce){if(_0x32bdce['length']){var _0xf2ec07=moment()[_0x7645('0xf5')](_0x7645('0x103'));for(var _0x21c835=0x0,_0x2eaa37=_0x32bdce[_0x7645('0x5c')];_0x21c835<_0x2eaa37;_0x21c835++){_0x32bdce[_0x21c835][_0x7645('0x109')]({'exitAt':_0xf2ec07});}}})[_0x7645('0x17')](function(){var _0x1a25b0=[];var _0x3e2a53=utils['getChannels']();_0x3e2a53[_0x7645('0x101')](function(_0x308ca4){_0x1a25b0[_0x7645('0x50')]({'channel':_0x308ca4,'membername':_0x5a3fef[_0x7645('0x37')],'interface':_['isNil'](_0x5a3fef[_0x7645('0xa8')])?util[_0x7645('0xf5')](_0x7645('0xb4'),_0x5a3fef[_0x7645('0x37')]):_0x5a3fef[_0x7645('0xa8')],'type':'PAUSE','enterAt':moment()[_0x7645('0xf5')](_0x7645('0x103')),'data1':_0x59d0a7[_0x7645('0x64')]['type']||_0x7645('0x10a'),'role':_0x5a3fef[_0x7645('0x2e')],'internal':_0x5a3fef[_0x7645('0x69')]});});return db[_0x7645('0x100')][_0x7645('0x8e')](_0x1a25b0,{'individualHooks':!![]});})[_0x7645('0x17')](function(){return _0x5a3fef[_0x7645('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59d0a7[_0x7645('0x64')]['type']||_0x7645('0x10a'),'lastPauseAt':moment()['format'](_0x7645('0x103'))});})['then'](respondWithResult(_0x9d8397,null))[_0x7645('0x22')](handleError(_0x9d8397,null));};exports[_0x7645('0x10b')]=function(_0x5de7ea,_0x449548){var _0x14d8dd;return db['User'][_0x7645('0x60')]({'where':{'id':_0x5de7ea[_0x7645('0x55')]['id']},'attributes':['id','name','role',_0x7645('0xa7'),_0x7645('0x10c'),_0x7645('0x10d'),_0x7645('0x10e'),_0x7645('0x10f'),_0x7645('0x110'),_0x7645('0x111'),'pauseType','lastPauseAt']})[_0x7645('0x17')](handleEntityNotFound(_0x449548,null))['then'](function(_0x34de64){if(_0x34de64){_0x14d8dd=_0x34de64;if(_0x5de7ea[_0x7645('0x64')][_0x7645('0xa4')]&&!utils[_0x7645('0xa9')](_0x5de7ea['body'][_0x7645('0xa4')])){throw new db['Sequelize']['ValidationError'](_0x7645('0xb7'));}switch(_0x5de7ea[_0x7645('0x64')][_0x7645('0xa4')]){case _0x7645('0xb2'):return respondWithRpcPromise(_0x7645('0x112'),_0x7645('0x10b'),{'id':_0x14d8dd['id'],'name':_0x14d8dd[_0x7645('0x37')],'pause':![]})[_0x7645('0x17')](function(){return db[_0x7645('0xbb')][_0x7645('0x2a')]({'paused':0x0},{'where':{'UserId':_0x14d8dd['id']},'individualHooks':!![]});})[_0x7645('0x17')](function(){return db[_0x7645('0x100')][_0x7645('0x60')]({'where':{'channel':_0x5de7ea[_0x7645('0x64')][_0x7645('0xa4')],'membername':_0x14d8dd['name'],'type':_0x7645('0x104'),'exitAt':null}});})[_0x7645('0x17')](function(_0x386212){if(_0x386212){return _0x386212[_0x7645('0x2a')]({'exitAt':moment()[_0x7645('0xf5')](_0x7645('0x103')),'data2':_0x7645('0x113')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x14d8dd[_0x7645('0x2a')]({'voicePause':![]});});case _0x7645('0x51'):case _0x7645('0x4d'):case'fax':case _0x7645('0x4f'):case _0x7645('0x53'):case _0x7645('0x52'):return db[_0x7645('0x100')][_0x7645('0x60')]({'where':{'channel':_0x5de7ea['body'][_0x7645('0xa4')],'membername':_0x14d8dd[_0x7645('0x37')],'type':'PAUSE','exitAt':null}})['then'](function(_0x51bd3a){if(_0x51bd3a){return _0x51bd3a[_0x7645('0x2a')]({'exitAt':moment()[_0x7645('0xf5')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7645('0x113')},{'individualHooks':!![]});}return null;})[_0x7645('0x17')](function(){var _0x22388c={};_[_0x7645('0x114')](_0x22388c,util['format'](_0x7645('0x115'),_0x5de7ea[_0x7645('0x64')][_0x7645('0xa4')],_0x7645('0x116')),![]);return _0x14d8dd[_0x7645('0x2a')](_0x22388c);});default:return respondWithRpcPromise(_0x7645('0x112'),_0x7645('0x10b'),{'id':_0x14d8dd['id'],'name':_0x14d8dd[_0x7645('0x37')],'pause':![]})[_0x7645('0x17')](function(){return db[_0x7645('0xbb')][_0x7645('0x2a')]({'paused':0x0},{'where':{'UserId':_0x14d8dd['id']}});})[_0x7645('0x17')](function(){return db['MemberReport'][_0x7645('0x4b')]({'where':{'membername':_0x14d8dd[_0x7645('0x37')],'type':_0x7645('0x104'),'exitAt':null}});})[_0x7645('0x17')](function(_0x1cf1a3){var _0x28103c=[];_0x1cf1a3[_0x7645('0x101')](function(_0x4569f9){_0x28103c['push'](_0x4569f9[_0x7645('0x2a')]({'exitAt':moment()['format'](_0x7645('0x103')),'data2':_0x7645('0x113')}));});return BPromise[_0x7645('0x63')](_0x28103c);})[_0x7645('0x17')](function(){return _0x14d8dd['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x7645('0x17')](respondWithResult(_0x449548,null))[_0x7645('0x22')](handleError(_0x449548,null));};exports[_0x7645('0x117')]=function(_0x1b7dcd,_0x113c93){var _0x39d7f5={};var _0x4c5c80={};var _0x493594;var _0x442d2e;return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x1b7dcd[_0x7645('0x55')]['id']}})[_0x7645('0x17')](handleEntityNotFound(_0x113c93,null))[_0x7645('0x17')](function(_0x11cff1){if(_0x11cff1){_0x493594=_0x11cff1;_0x4c5c80[_0x7645('0x5a')]=_[_0x7645('0x56')](db['Team'][_0x7645('0x57')]);_0x4c5c80[_0x7645('0x43')]=_[_0x7645('0x56')](_0x1b7dcd['query']);_0x4c5c80['filters']=_[_0x7645('0x59')](_0x4c5c80[_0x7645('0x5a')],_0x4c5c80[_0x7645('0x43')]);_0x39d7f5[_0x7645('0x49')]=_['intersection'](_0x4c5c80[_0x7645('0x5a')],qs['fields'](_0x1b7dcd[_0x7645('0x43')][_0x7645('0x5b')]));_0x39d7f5['attributes']=_0x39d7f5[_0x7645('0x49')]['length']?_0x39d7f5[_0x7645('0x49')]:_0x4c5c80[_0x7645('0x5a')];_0x39d7f5['order']=qs[_0x7645('0xd4')](_0x1b7dcd[_0x7645('0x43')][_0x7645('0xd4')]);_0x39d7f5[_0x7645('0x42')]=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x1b7dcd[_0x7645('0x43')],_0x4c5c80['filters']));if(_0x1b7dcd[_0x7645('0x43')]['filter']){_0x39d7f5[_0x7645('0x42')]=_['merge'](_0x39d7f5['where'],{'$or':_[_0x7645('0x35')](_0x39d7f5['attributes'],function(_0x4598ca){var _0x1f70da={};_0x1f70da[_0x4598ca]={'$like':'%'+_0x1b7dcd[_0x7645('0x43')]['filter']+'%'};return _0x1f70da;})});}_0x39d7f5=_[_0x7645('0x5e')]({},_0x39d7f5,_0x1b7dcd[_0x7645('0x5f')]);return _0x493594[_0x7645('0x117')](_0x39d7f5);}})[_0x7645('0x17')](function(_0xa3081a){if(_0xa3081a){_0x442d2e=_0xa3081a[_0x7645('0x5c')];if(!_0x1b7dcd[_0x7645('0x43')]['hasOwnProperty'](_0x7645('0xd9'))){_0x39d7f5['limit']=qs[_0x7645('0xda')](_0x1b7dcd[_0x7645('0x43')]['limit']);_0x39d7f5[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x1b7dcd[_0x7645('0x43')][_0x7645('0x28')]);}return _0x493594['getTeams'](_0x39d7f5);}})[_0x7645('0x17')](function(_0x1ae903){if(_0x1ae903){return _0x1ae903?{'count':_0x442d2e,'rows':_0x1ae903}:null;}})['then'](respondWithResult(_0x113c93,null))[_0x7645('0x22')](handleError(_0x113c93,null));};exports[_0x7645('0x118')]=function(_0x145eff,_0x63b65c){var _0x45e1cb=_0x145eff[_0x7645('0x55')]['id'];var _0x1232cd=_0x145eff[_0x7645('0x64')]?_0x145eff[_0x7645('0x64')][_0x7645('0x67')]:null;var _0x47ef3b=[];return Promise[_0x7645('0x106')]()[_0x7645('0x17')](function(){if(!_0x1232cd)throw new APIBadRequestError(_0x7645('0x119'));})[_0x7645('0x17')](function(){return db[_0x7645('0x4a')]['findOne']({'where':{'id':_0x45e1cb}});})[_0x7645('0x17')](function(_0x531fb2){if(!_0x531fb2)throw new APINotFoundError(util[_0x7645('0xf5')](_0x7645('0x11a'),_0x145eff[_0x7645('0x55')]['id']));return db[_0x7645('0x6f')]['transaction'](function(_0x2e1c93){return _0x531fb2['addTeams'](_0x1232cd,{'transaction':_0x2e1c93})[_0x7645('0x17')](function(){return db[_0x7645('0x11b')][_0x7645('0x4b')]({'where':{'id':{'$in':_0x1232cd}}});})[_0x7645('0x17')](function(_0xf317b2){var _0x1356ca=_[_0x7645('0x35')](_0xf317b2,function(_0x41e526){return _0x41e526[_0x7645('0x11c')]();});return Promise[_0x7645('0x63')](_0x1356ca);})[_0x7645('0x17')](function(_0x5aa524){_0x47ef3b=_['flattenDeep'](_0x5aa524);var _0x5c1093=_[_0x7645('0x35')](_0x47ef3b,function(_0xbada96){return _0xbada96[_0x7645('0x11d')](_0x531fb2['id'],{'transaction':_0x2e1c93});});return Promise[_0x7645('0x63')](_0x5c1093);})[_0x7645('0x17')](function(){if(!_0x531fb2[_0x7645('0xa5')])return;var _0x56d4b4=_[_0x7645('0x34')](_0x47ef3b,function(_0x3ff24b){return _0x3ff24b['getDataValue'](_0x7645('0xa4'))===_0x7645('0x11e');});var _0x324a64=_[_0x7645('0x35')](_0x56d4b4,function(_0x293b7b){return db[_0x7645('0xbb')][_0x7645('0xb5')]({'membername':_0x531fb2[_0x7645('0x37')],'UserId':_0x531fb2['id'],'queue_name':_0x293b7b[_0x7645('0x37')],'VoiceQueueId':_0x293b7b['id'],'interface':_[_0x7645('0x6e')](_0x531fb2[_0x7645('0xa8')])?util['format'](_0x7645('0xb4'),_0x531fb2[_0x7645('0x37')]):_0x531fb2[_0x7645('0xa8')],'paused':_0x531fb2[_0x7645('0xa7')]||![],'penalty':_0x531fb2['penalty']},{'transaction':_0x2e1c93});});return Promise[_0x7645('0x63')](_0x324a64);})['then'](function(){return db[_0x7645('0x11f')]['findAll']({'where':{'teamId':{'$in':_0x1232cd}}});})['then'](function(_0x5a9c3e){var _0x2cb406=_['map'](_0x5a9c3e,function(_0x2c652a){return db[_0x7645('0x120')][_0x7645('0x85')]({'UserId':_0x531fb2['id'],'VoicePrefixId':_0x2c652a['VoicePrefixId']},{'transaction':_0x2e1c93});});return Promise[_0x7645('0x63')](_0x2cb406);});});})[_0x7645('0x17')](function(){for(var _0x14907a=0x0;_0x14907a<_0x47ef3b[_0x7645('0x5c')];_0x14907a++){var _0x2acb91=_0x47ef3b[_0x14907a][_0x7645('0x121')](_0x7645('0xa4'));var _0x2db46f=_0x2acb91+'QueueId';socket[_0x7645('0x2b')]('user'+_0x2acb91+_0x7645('0xb1'),{'UserId':_0x45e1cb,['queueField']:_0x47ef3b[_0x14907a]['id']});}})[_0x7645('0x17')](respondWithStatusCode(_0x63b65c,null))[_0x7645('0x22')](APIHandleError(_0x63b65c));};exports[_0x7645('0x122')]=function(_0x524fe8,_0x42fb5f){var _0x9fed7d=_0x524fe8[_0x7645('0x55')]['id'];var _0x2a496e=null;if(_0x524fe8[_0x7645('0x43')][_0x7645('0x67')]){_0x2a496e=_[_0x7645('0xb9')](_0x524fe8[_0x7645('0x43')]['ids'])?_0x524fe8[_0x7645('0x43')]['ids']:[_0x524fe8['query']['ids']];}var _0x38f2d5=[];return Promise[_0x7645('0x106')]()[_0x7645('0x17')](function(){if(!_0x2a496e)throw new APIBadRequestError(_0x7645('0x123'));})[_0x7645('0x17')](function(){return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x9fed7d}});})[_0x7645('0x17')](function(_0x12cd66){if(!_0x12cd66)throw new APINotFoundError(util[_0x7645('0xf5')](_0x7645('0x11a'),_0x524fe8[_0x7645('0x55')]['id']));return db['sequelize'][_0x7645('0x124')](function(_0x530d3a){return _0x12cd66[_0x7645('0x122')](_0x2a496e,{'transaction':_0x530d3a})[_0x7645('0x17')](function(){return db[_0x7645('0x11b')][_0x7645('0x4b')]({'where':{'id':{'$in':_0x2a496e}}});})[_0x7645('0x17')](function(_0x2a8132){var _0x577b13=_['map'](_0x2a8132,function(_0x599b2c){return _0x599b2c[_0x7645('0x11c')]();});return Promise[_0x7645('0x63')](_0x577b13);})[_0x7645('0x17')](function(_0x5f494f){_0x38f2d5=_[_0x7645('0x125')](_0x5f494f);var _0x63f701=_['map'](_0x38f2d5,function(_0x459c04){return _0x459c04[_0x7645('0x126')](_0x12cd66['id'],{'transaction':_0x530d3a});});return Promise[_0x7645('0x63')](_0x63f701);})['then'](function(){if(!_0x12cd66[_0x7645('0xa5')])return;var _0x112d9f=_[_0x7645('0x34')](_0x38f2d5,function(_0x3cc24c){return _0x3cc24c[_0x7645('0x121')](_0x7645('0xa4'))===_0x7645('0x11e');});var _0x3f5980=_[_0x7645('0x35')](_0x112d9f,function(_0x1ae8c2){return db[_0x7645('0xbb')][_0x7645('0x2d')]({'where':{'VoiceQueueId':_0x1ae8c2['id'],'UserId':_0x12cd66['id']},'transaction':_0x530d3a});});return Promise['all'](_0x3f5980);})[_0x7645('0x17')](function(){return db[_0x7645('0x11f')][_0x7645('0x4b')]({'where':{'teamId':{'$in':_0x2a496e}}});})[_0x7645('0x17')](function(_0x3fbd94){var _0x822044=_[_0x7645('0x35')](_0x3fbd94,function(_0xd18e82){return db[_0x7645('0x120')][_0x7645('0x2d')]({'where':{'UserId':_0x12cd66['id'],'VoicePrefixId':_0xd18e82['VoicePrefixId']}},{'transaction':_0x530d3a});});return Promise[_0x7645('0x63')](_0x822044);});});})[_0x7645('0x17')](function(){for(var _0x11e563=0x0;_0x11e563<_0x38f2d5[_0x7645('0x5c')];_0x11e563++){var _0x531231=_0x38f2d5[_0x11e563]['getDataValue'](_0x7645('0xa4'));var _0x3559ed=_0x531231+_0x7645('0xb0');socket[_0x7645('0x2b')](_0x7645('0x30')+_0x531231+'Queue:remove',{'UserId':_0x9fed7d,['queueField']:_0x38f2d5[_0x11e563]['id']});}})[_0x7645('0x17')](respondWithStatusCode(_0x42fb5f,null))[_0x7645('0x22')](APIHandleError(_0x42fb5f));};exports['getLists']=function(_0x2520b4,_0x376d63){var _0x355ed7={};var _0x51a98a={};var _0x1c950c;var _0xf1737b;return db[_0x7645('0x4a')][_0x7645('0x9d')]({'where':{'id':_0x2520b4['params']['id']}})['then'](handleEntityNotFound(_0x376d63,null))['then'](function(_0x1d6df0){if(_0x1d6df0){_0x1c950c=_0x1d6df0;_0x51a98a[_0x7645('0x5a')]=_[_0x7645('0x56')](db[_0x7645('0x127')][_0x7645('0x57')]);_0x51a98a[_0x7645('0x43')]=_[_0x7645('0x56')](_0x2520b4[_0x7645('0x43')]);_0x51a98a[_0x7645('0x58')]=_[_0x7645('0x59')](_0x51a98a[_0x7645('0x5a')],_0x51a98a['query']);_0x355ed7['attributes']=_[_0x7645('0x59')](_0x51a98a['model'],qs[_0x7645('0x5b')](_0x2520b4[_0x7645('0x43')][_0x7645('0x5b')]));_0x355ed7[_0x7645('0x49')]=_0x355ed7[_0x7645('0x49')][_0x7645('0x5c')]?_0x355ed7[_0x7645('0x49')]:_0x51a98a['model'];_0x355ed7[_0x7645('0xd3')]=qs[_0x7645('0xd4')](_0x2520b4[_0x7645('0x43')][_0x7645('0xd4')]);_0x355ed7['where']=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0x2520b4[_0x7645('0x43')],_0x51a98a[_0x7645('0x58')]));if(_0x2520b4[_0x7645('0x43')][_0x7645('0x34')]){_0x355ed7[_0x7645('0x42')]=_['merge'](_0x355ed7[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x355ed7[_0x7645('0x49')],function(_0x378c3b){var _0x5c24b5={};_0x5c24b5[_0x378c3b]={'$like':'%'+_0x2520b4[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x5c24b5;})});}_0x355ed7=_[_0x7645('0x5e')]({},_0x355ed7,_0x2520b4[_0x7645('0x5f')]);return _0x1c950c['getLists'](_0x355ed7);}})[_0x7645('0x17')](function(_0x4737b3){if(_0x4737b3){_0xf1737b=_0x4737b3[_0x7645('0x5c')];if(!_0x2520b4[_0x7645('0x43')][_0x7645('0xd6')](_0x7645('0xd9'))){_0x355ed7['limit']=qs['limit'](_0x2520b4[_0x7645('0x43')][_0x7645('0xda')]);_0x355ed7[_0x7645('0x28')]=qs[_0x7645('0x28')](_0x2520b4[_0x7645('0x43')][_0x7645('0x28')]);}return _0x1c950c[_0x7645('0x128')](_0x355ed7);}})['then'](function(_0x515685){if(_0x515685){return _0x515685?{'count':_0xf1737b,'rows':_0x515685}:null;}})[_0x7645('0x17')](respondWithResult(_0x376d63,null))[_0x7645('0x22')](handleError(_0x376d63,null));};exports[_0x7645('0x129')]=function(_0xeb996c,_0x498f3a){var _0x44b80e={};var _0x407ea2={};var _0x99c473;return db['User']['findOne']({'where':{'id':_0xeb996c[_0x7645('0x55')]['id']}})['then'](handleEntityNotFound(_0x498f3a,null))[_0x7645('0x17')](function(_0x54156e){if(_0x54156e){_0x99c473=_0x54156e;_0x407ea2[_0x7645('0x5a')]=_[_0x7645('0x56')](db['User'][_0x7645('0x57')]);_0x407ea2[_0x7645('0x43')]=_[_0x7645('0x56')](_0xeb996c['query']);_0x407ea2['filters']=_[_0x7645('0x59')](_0x407ea2[_0x7645('0x5a')],_0x407ea2['query']);_0x44b80e['attributes']=_[_0x7645('0x59')](_0x407ea2[_0x7645('0x5a')],qs[_0x7645('0x5b')](_0xeb996c[_0x7645('0x43')]['fields']));_0x44b80e['attributes']=_0x44b80e[_0x7645('0x49')][_0x7645('0x5c')]?_0x44b80e[_0x7645('0x49')]:_0x407ea2[_0x7645('0x5a')];_0x44b80e[_0x7645('0xd3')]=qs['sort'](_0xeb996c[_0x7645('0x43')]['sort']);_0x44b80e['where']=qs[_0x7645('0x58')](_[_0x7645('0xdc')](_0xeb996c[_0x7645('0x43')],_0x407ea2[_0x7645('0x58')]));if(_0xeb996c[_0x7645('0x43')][_0x7645('0x34')]){_0x44b80e['where']=_[_0x7645('0x5e')](_0x44b80e[_0x7645('0x42')],{'$or':_[_0x7645('0x35')](_0x44b80e['attributes'],function(_0x1b7ee4){var _0x4bf756={};_0x4bf756[_0x1b7ee4]={'$like':'%'+_0xeb996c[_0x7645('0x43')][_0x7645('0x34')]+'%'};return _0x4bf756;})});}_0x44b80e['model']=db['User'];_0x44b80e['as']='Agents';_0x44b80e=_['merge']({},_0x44b80e,_0xeb996c['options']);return _0x99c473[_0x7645('0xfe')]({'include':[_0x44b80e]});}})[_0x7645('0x17')](function(_0x115a91){if(_0x115a91){var _0x43f9ce={},_0x117801=[];for(var _0x2b9013=0x0;_0x2b9013<_0x115a91[_0x7645('0x5c')];_0x2b9013+=0x1){for(var _0x1decd1=0x0,_0x43bdec;_0x1decd1<_0x115a91[_0x2b9013]['Agents'][_0x7645('0x5c')];_0x1decd1+=0x1){_0x43bdec=_0x115a91[_0x2b9013][_0x7645('0x31')][_0x1decd1][_0x7645('0xb3')]({'plain':!![]});_0x43f9ce[_0x43bdec['id']]=_0x43bdec;}}_0x43f9ce=_[_0x7645('0x12a')](_0x43f9ce);for(var _0x4d03db=qs[_0x7645('0x28')](_0xeb996c['query'][_0x7645('0x28')]);_0x4d03db<_0x43f9ce['length']&&_0x117801[_0x7645('0x5c')]=_0x1400d6){_0x1587da=_0x1400d6;_0xb1aa9f=0xc8;}else{_0xb1aa9f=0xce;}_0x198853['status'](_0xb1aa9f);return _0x198853[_0x3a98('0x2f')](_0x3a98('0x30'),_0x342429+'-'+_0x1587da+'/'+_0x1400d6)[_0x3a98('0x2a')](_0x252e67);}return null;};}function saveUpdates(_0x30c6f2){return function(_0x272bc6){if(_0x272bc6){return _0x272bc6[_0x3a98('0x31')](_0x30c6f2)[_0x3a98('0x1b')](function(_0x42c93a){socket[_0x3a98('0x32')]('userNotification:recalc:'+_0x42c93a['id'],{});return _0x42c93a;});}return null;};}function removeEntity(_0x70fb4e){return function(_0x2a827f){if(_0x2a827f){return _0x2a827f[_0x3a98('0x33')]()['then'](function(){var _0x515bef=_0x2a827f[_0x3a98('0x34')]({'plain':!![]});if(_0x515bef[_0x3a98('0x35')]==='admin')return;var _0x3dab30=[{'name':_0x3a98('0x36'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x3a98('0x37'),'ignore':![]},{'name':_0x3a98('0x38'),'value':_0x3a98('0x39'),'ignore':![]}];var _0x74787c=_(_0x3dab30)[_0x3a98('0x3a')](_0x3a98('0x3b'))[_0x3a98('0x3c')](_0x3a98('0x3d'))['value']();if(_[_0x3a98('0x3e')](_0x74787c,_0x515bef[_0x3a98('0x35')])){return;}var _0x5d366b=_['find'](_0x3dab30,[_0x3a98('0x3d'),_0x515bef['role']])[_0x3a98('0x3f')];return db[_0x3a98('0x40')][_0x3a98('0x33')]({'where':{'type':_0x5d366b,'resourceId':_0x515bef['id']}})[_0x3a98('0x1b')](function(){return _0x2a827f;});})[_0x3a98('0x1b')](function(){_0x70fb4e[_0x3a98('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ab3d7){return function(_0x5214ad){if(!_0x5214ad){_0x3ab3d7['sendStatus'](0x194);}return _0x5214ad;};}function handleError(_0x5b57a9,_0x2947e3){_0x2947e3=_0x2947e3||0x1f4;return function(_0xbbc4f9){logger['error'](_0xbbc4f9[_0x3a98('0x41')]);if(_0xbbc4f9[_0x3a98('0x3f')]){delete _0xbbc4f9[_0x3a98('0x3f')];}_0x5b57a9[_0x3a98('0x28')](_0x2947e3)['send'](_0xbbc4f9);};}exports['index']=function(_0x500032,_0x4d7c09){var _0x1a53c2={},_0x3ba4f4={'count':0x0,'rows':[]};var _0x13d79b=_(db[_0x3a98('0x42')][_0x3a98('0x43')])[_0x3a98('0x3c')](function(_0x4c1d4e){return{'name':_0x4c1d4e[_0x3a98('0x44')],'type':_0x4c1d4e[_0x3a98('0x45')]['key']};})[_0x3a98('0x3a')](function(_0x261635){return!_[_0x3a98('0x3e')](['password',_0x3a98('0x46')],_0x261635[_0x3a98('0x3f')]);})[_0x3a98('0x3d')]();_0x1a53c2=qs['getOptions'](_0x13d79b,_0x500032);var _0x143cbd={'where':_0x1a53c2['where']};return db[_0x3a98('0x42')][_0x3a98('0x2d')](_0x143cbd)[_0x3a98('0x1b')](function(_0x5eb3ff){_0x3ba4f4['count']=_0x5eb3ff;if(_0x500032[_0x3a98('0x47')][_0x3a98('0x48')]){_0x1a53c2['include']=[{'all':!![]}];}if(_0x500032[_0x3a98('0x47')][_0x3a98('0x49')]==='true'){_0x1a53c2['include']=[{'model':db['UserSetting'],'as':_0x3a98('0x49')}];}if(!_[_0x3a98('0x3e')](_0x1a53c2[_0x3a98('0x4a')],'id')){_0x1a53c2[_0x3a98('0x4a')][_0x3a98('0x4b')]('id');}return db[_0x3a98('0x42')]['findAll'](_0x1a53c2);})[_0x3a98('0x1b')](function(_0x497bcb){_0x3ba4f4[_0x3a98('0x4c')]=_0x497bcb;if(_0x500032[_0x3a98('0x47')][_0x3a98('0x4d')]==='true'){var _0x209665=[];for(var _0x3c693e=0x0;_0x3c693e<_0x3ba4f4[_0x3a98('0x4c')][_0x3a98('0x4e')];_0x3c693e++){_0x209665['push'](get_open_tabs(_0x3a98('0x4f'),_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e]['dataValues']));_0x209665['push'](get_open_tabs('sms',_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e]['dataValues']));_0x209665[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x50'),_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e][_0x3a98('0x51')]));_0x209665['push'](get_open_tabs('mail',_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e][_0x3a98('0x51')]));_0x209665[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x52'),_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e][_0x3a98('0x51')]));_0x209665[_0x3a98('0x4b')](get_open_tabs('whatsapp',_0x3ba4f4[_0x3a98('0x4c')][_0x3c693e][_0x3a98('0x51')]));}return BPromise[_0x3a98('0x53')](_0x209665)['then'](function(){return _0x3ba4f4;});}else{return _0x3ba4f4;}})[_0x3a98('0x1b')](respondWithFilteredResult(_0x4d7c09,_0x1a53c2))[_0x3a98('0x26')](handleError(_0x4d7c09,null));};exports['show']=function(_0x51d8b9,_0x540f04){var _0x25ce51={'raw':![],'where':{'id':_0x51d8b9[_0x3a98('0x54')]['id']}},_0x3923a7={};_0x3923a7['model']=_['differenceBy'](_[_0x3a98('0x55')](db[_0x3a98('0x42')][_0x3a98('0x43')]),[_0x3a98('0x56'),_0x3a98('0x46')]);_0x3923a7[_0x3a98('0x47')]=_['keys'](_0x51d8b9[_0x3a98('0x47')]);_0x3923a7[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x3923a7['model'],_0x3923a7['query']);_0x25ce51[_0x3a98('0x4a')]=_['intersection'](_0x3923a7[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x51d8b9[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x25ce51[_0x3a98('0x4a')]=_0x25ce51[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x25ce51['attributes']:_0x3923a7[_0x3a98('0x59')];if(_0x51d8b9[_0x3a98('0x47')][_0x3a98('0x48')]){_0x25ce51[_0x3a98('0x5b')]=[{'all':!![]}];}if(_0x51d8b9[_0x3a98('0x47')]['userSetting']===_0x3a98('0x5c')){_0x25ce51[_0x3a98('0x5b')]=[{'model':db[_0x3a98('0x5d')],'as':_0x3a98('0x49')}];}_0x25ce51=_[_0x3a98('0x5e')]({},_0x25ce51,_0x51d8b9[_0x3a98('0x5f')]);if(!_[_0x3a98('0x3e')](_0x25ce51['attributes'],'id')){_0x25ce51[_0x3a98('0x4a')]['push']('id');}return db['User'][_0x3a98('0x60')](_0x25ce51)['then'](handleEntityNotFound(_0x540f04,null))[_0x3a98('0x1b')](function(_0x37d1cb){var _0x51b74f=[];values=_0x37d1cb;if(_0x51d8b9[_0x3a98('0x47')]['openTabs']===_0x3a98('0x5c')){_0x51b74f[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x4f'),_0x37d1cb['dataValues']));_0x51b74f[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x61'),_0x37d1cb['dataValues']));_0x51b74f[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x52'),_0x37d1cb[_0x3a98('0x51')]));_0x51b74f[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x62'),_0x37d1cb['dataValues']));_0x51b74f[_0x3a98('0x4b')](get_open_tabs('fax',_0x37d1cb[_0x3a98('0x51')]));_0x51b74f['push'](get_open_tabs('mail',_0x37d1cb[_0x3a98('0x51')]));return BPromise[_0x3a98('0x53')](_0x51b74f);}else{return values;}})[_0x3a98('0x1b')](function(){return values;})[_0x3a98('0x1b')](respondWithResult(_0x540f04,null))[_0x3a98('0x26')](handleError(_0x540f04,null));};exports[_0x3a98('0x31')]=function(_0x4c4484,_0x3020cd){if(_0x4c4484[_0x3a98('0x63')]['id']){delete _0x4c4484['body']['id'];}delete _0x4c4484[_0x3a98('0x63')][_0x3a98('0x35')];return db[_0x3a98('0x42')]['find']({'where':{'id':_0x4c4484[_0x3a98('0x54')]['id']}})['then'](handleEntityNotFound(_0x3020cd,null))['then'](saveUpdates(_0x4c4484[_0x3a98('0x63')],null))['then'](respondWithResult(_0x3020cd,null))[_0x3a98('0x26')](handleError(_0x3020cd,null));};exports[_0x3a98('0x64')]=function(_0x7a1155,_0x1da7a1){return db['User'][_0x3a98('0x64')]()['then'](respondWithResult(_0x1da7a1,null))[_0x3a98('0x26')](handleError(_0x1da7a1,null));};exports[_0x3a98('0x65')]=function(_0xa7e642,_0xad6c5b){return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0xa7e642[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0xad6c5b,null))['then'](function(_0x4b3a7b){if(_0x4b3a7b){return _0x4b3a7b[_0x3a98('0x65')](_0xa7e642[_0x3a98('0x63')][_0x3a98('0x66')],_[_0x3a98('0x67')](_0xa7e642['body'],[_0x3a98('0x66'),'id'])||{});}})[_0x3a98('0x1b')](respondWithResult(_0xad6c5b,null))['catch'](handleError(_0xad6c5b,null));};function validateUser(_0x5de485){return new BPromise(function(_0x39d7ca,_0x477624){if(_0x5de485[_0x3a98('0x68')])return _0x39d7ca(_0x5de485);return db[_0x3a98('0x69')][_0x3a98('0x6a')](0x1)[_0x3a98('0x1b')](function(_0x1e4f9c){if(_0x1e4f9c[_0x3a98('0x6b')])authService['validatePasswordPattern'](_0x5de485[_0x3a98('0x56')]);db[_0x3a98('0x42')][_0x3a98('0x6c')](_0x3a98('0x68'))['then'](function(_0x2359b7){if(_[_0x3a98('0x6d')](_0x2359b7)){_0x5de485[_0x3a98('0x68')]=_0x1e4f9c[_0x3a98('0x6e')]||0x1;return;}if(_[_0x3a98('0x6d')](_0x1e4f9c[_0x3a98('0x6e')])||_0x1e4f9c[_0x3a98('0x6e')]===_0x2359b7){_0x5de485[_0x3a98('0x68')]=_0x2359b7+0x1;return;}if(_0x1e4f9c[_0x3a98('0x6e')]>_0x2359b7){_0x5de485[_0x3a98('0x68')]=_0x1e4f9c[_0x3a98('0x6e')];return;}return db[_0x3a98('0x6f')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x3a98('0x6f')][_0x3a98('0x70')][_0x3a98('0x71')]})['then'](function(_0x30f520){if(_0x30f520&&_0x30f520[_0x3a98('0x4e')]){for(var _0x839d05=0x0,_0x3bf359=_0x30f520[_0x3a98('0x4e')];_0x839d05<_0x3bf359&&_[_0x3a98('0x6d')](_0x5de485[_0x3a98('0x68')]);_0x839d05++){if(_0x1e4f9c[_0x3a98('0x6e')]<=_0x30f520[_0x839d05][_0x3a98('0x72')]){_0x5de485['internal']=_0x30f520[_0x839d05]['from'];}else if(_0x1e4f9c[_0x3a98('0x6e')]>_0x30f520[_0x839d05][_0x3a98('0x72')]&&_0x1e4f9c[_0x3a98('0x6e')]<=_0x30f520[_0x839d05]['to']){_0x5de485[_0x3a98('0x68')]=_0x1e4f9c[_0x3a98('0x6e')];}}}if(_[_0x3a98('0x6d')](_0x5de485[_0x3a98('0x68')])){_0x5de485[_0x3a98('0x68')]=_0x2359b7+0x1;}return _0x39d7ca(_0x5de485);});});})[_0x3a98('0x26')](function(_0x53360c){_0x477624(_0x53360c);});});}function updateUser(_0x395984){return new BPromise(function(_0x1ede5d,_0x5bd9d7){try{if(_0x395984['voicemail']){_0x395984[_0x3a98('0x73')]=_0x395984[_0x3a98('0x68')];_0x395984[_0x3a98('0x74')]={'mailbox':_0x395984[_0x3a98('0x68')],'password':_0x395984['password'],'fullname':_0x395984[_0x3a98('0x75')],'email':_0x395984['email']};}if(_0x395984[_0x3a98('0x35')]===_0x3a98('0x37')){if(!_0x395984[_0x3a98('0x76')])_0x395984['permissions']=[_0x3a98('0x77'),_0x3a98('0x78'),_0x3a98('0x79'),_0x3a98('0x7a'),_0x3a98('0x7b'),'104',_0x3a98('0x7c'),_0x3a98('0x7d'),_0x3a98('0x7e'),_0x3a98('0x7f'),_0x3a98('0x80'),_0x3a98('0x81'),_0x3a98('0x82'),_0x3a98('0x83'),'115'];}_0x1ede5d(_0x395984);}catch(_0x11f3ca){_0x5bd9d7(_0x11f3ca);}});}exports['create']=function(_0x4c2da5,_0x2ea0f5){if(_0x4c2da5[_0x3a98('0x84')][_0x3a98('0x35')]===_0x3a98('0x37'))throw new Error(_0x3a98('0x85'));if(_0x4c2da5[_0x3a98('0x63')]['role']===_0x3a98('0x84')&&_0x4c2da5[_0x3a98('0x84')][_0x3a98('0x35')]!==_0x3a98('0x86')){throw new Error(_0x3a98('0x87'));}if(_0x4c2da5[_0x3a98('0x63')]['role']===_0x3a98('0x86')&&_0x4c2da5['user'][_0x3a98('0x35')]!=='admin'){throw new Error(_0x3a98('0x88'));}return licenseUtil['checkUserLimits']([_0x4c2da5[_0x3a98('0x63')]])[_0x3a98('0x1b')](function(){return validateUser(_0x4c2da5[_0x3a98('0x63')]);})[_0x3a98('0x1b')](function(_0x1d99a8){return updateUser(_0x1d99a8)[_0x3a98('0x1b')](function(_0x5b9bcf){if(_0x5b9bcf[_0x3a98('0x35')]===_0x3a98('0x86')){_0x5b9bcf['settingsEnabled']=_0x4c2da5[_0x3a98('0x84')][_0x3a98('0x89')];delete _0x5b9bcf[_0x3a98('0x8a')];}return _0x5b9bcf;});})[_0x3a98('0x1b')](function(_0x5e52fe){return db[_0x3a98('0x42')]['create'](_0x5e52fe,{'include':[{'model':db['VoiceMail'],'as':_0x3a98('0x74')}]});})[_0x3a98('0x1b')](function(_0x5606a7){if(_0x4c2da5[_0x3a98('0x63')][_0x3a98('0x35')]===_0x3a98('0x84'))return _0x5606a7;if(_0x4c2da5['user'][_0x3a98('0x35')]!==_0x3a98('0x84'))return _0x5606a7;return db[_0x3a98('0x8b')][_0x3a98('0x60')]({'where':{'name':_0x5606a7['role']===_0x3a98('0x37')?_0x3a98('0x8c'):_0x3a98('0x38'),'userProfileId':_0x4c2da5['user'][_0x3a98('0x8a')]},'raw':!![]})[_0x3a98('0x1b')](function(_0x3bb393){if(!_0x3bb393||_0x3bb393[_0x3a98('0x8d')]!=0x0)return _0x5606a7;return db[_0x3a98('0x40')][_0x3a98('0x8e')]({'name':_0x5606a7[_0x3a98('0x3f')],'resourceId':_0x5606a7['id'],'type':_0x3bb393[_0x3a98('0x3f')],'sectionId':_0x3bb393['id']},{})[_0x3a98('0x1b')](function(){return _0x5606a7;});})[_0x3a98('0x26')](function(_0x37ac1b){logger[_0x3a98('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37ac1b);throw _0x37ac1b;});})[_0x3a98('0x1b')](respondWithResult(_0x2ea0f5,0xc9))['catch'](handleError(_0x2ea0f5,null));};exports[_0x3a98('0x8f')]=function(_0x326de8,_0x162d47){var _0x9cac61=_0x326de8[_0x3a98('0x63')];var _0x16d297=[];if(_0x326de8[_0x3a98('0x84')][_0x3a98('0x35')]==='agent')throw new Error(_0x3a98('0x85'));if(_['some'](_0x9cac61,['role',_0x3a98('0x84')])&&_0x326de8[_0x3a98('0x84')][_0x3a98('0x35')]!==_0x3a98('0x86')){throw new Error(_0x3a98('0x87'));}if(_[_0x3a98('0x90')](_0x9cac61,['role',_0x3a98('0x86')])&&_0x326de8[_0x3a98('0x84')][_0x3a98('0x35')]!==_0x3a98('0x86')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x3a98('0x91')](_0x9cac61)[_0x3a98('0x1b')](function(){return validateUser(_0x9cac61[0x0]);})[_0x3a98('0x1b')](function(){for(var _0x1e972f=0x1;_0x1e972f<_0x9cac61[_0x3a98('0x4e')];_0x1e972f++){var _0x5a8031=_0x9cac61[_0x1e972f-0x1][_0x3a98('0x68')];if(!_0x9cac61[_0x1e972f][_0x3a98('0x68')])_0x9cac61[_0x1e972f][_0x3a98('0x68')]=_0x5a8031+0x1;_0x16d297[_0x3a98('0x4b')](validateUser(_0x9cac61[_0x1e972f]));}return BPromise[_0x3a98('0x53')](_0x16d297);})[_0x3a98('0x1b')](function(){_0x16d297=[];for(var _0x54ea45=0x0;_0x54ea45<_0x9cac61['length'];_0x54ea45++){_0x16d297[_0x3a98('0x4b')](updateUser(_0x9cac61[_0x54ea45]));}return BPromise[_0x3a98('0x53')](_0x16d297);})[_0x3a98('0x1b')](function(){return BPromise['each'](_0x9cac61,function(_0x15a3e5){return db[_0x3a98('0x42')][_0x3a98('0x8e')](_0x15a3e5,{'include':[{'model':db[_0x3a98('0x74')],'as':_0x3a98('0x74')}]})[_0x3a98('0x1b')](function(_0x3cc489){_0x15a3e5['id']=_0x3cc489['id'];return _0x15a3e5;});});})[_0x3a98('0x1b')](function(_0x4467e6){if(_0x326de8[_0x3a98('0x63')][_0x3a98('0x35')]==='user')return _0x4467e6;if(_0x326de8[_0x3a98('0x84')][_0x3a98('0x35')]!==_0x3a98('0x84'))return _0x4467e6;var _0x1c23d3=_[_0x3a98('0x90')](_0x4467e6,function(_0x4ec9a4){return _0x4ec9a4[_0x3a98('0x35')]==='agent'||_0x4ec9a4[_0x3a98('0x35')]===_0x3a98('0x39');});if(!_0x1c23d3)return _0x4467e6;return db[_0x3a98('0x8b')][_0x3a98('0x92')]({'where':{'name':{'$or':[_0x3a98('0x8c'),_0x3a98('0x38')]},'userProfileId':_0x326de8[_0x3a98('0x84')][_0x3a98('0x8a')]},'raw':!![]})[_0x3a98('0x1b')](function(_0x3a08f0){if(_[_0x3a98('0x93')](_0x3a08f0)||!_[_0x3a98('0x90')](_0x3a08f0,['autoAssociation',0x0]))return _0x4467e6;_0x16d297=[];var _0x5257df=_(_0x3a08f0)[_0x3a98('0x3c')](function(_0x902af){if(_0x902af[_0x3a98('0x8d')]===0x1)return;return _0x902af[_0x3a98('0x3f')]===_0x3a98('0x8c')?_0x3a98('0x37'):'telephone';})[_0x3a98('0x94')]()[_0x3a98('0x3d')]();for(var _0x3fb229=0x0;_0x3fb229<_0x4467e6['length'];_0x3fb229++){if(!_[_0x3a98('0x3e')](_0x5257df,_0x4467e6[_0x3fb229][_0x3a98('0x35')]))return;var _0x2a79d3=_0x4467e6[_0x3fb229][_0x3a98('0x35')]===_0x3a98('0x37')?_0x3a98('0x8c'):_0x3a98('0x38');_0x16d297[_0x3a98('0x4b')](db[_0x3a98('0x40')][_0x3a98('0x8e')]({'name':_0x4467e6[_0x3fb229][_0x3a98('0x3f')],'resourceId':_0x4467e6[_0x3fb229]['id'],'type':_0x2a79d3,'sectionId':_[_0x3a98('0x60')](_0x3a08f0,[_0x3a98('0x3f'),_0x2a79d3])['id']},{}));}return BPromise['all'](_0x16d297);});})[_0x3a98('0x1b')](respondWithResult(_0x162d47,0xc9))['catch'](handleError(_0x162d47,null));};exports[_0x3a98('0x95')]=function(_0x4b29f2,_0x24a63d){if(_0x4b29f2['body']['id']){delete _0x4b29f2[_0x3a98('0x63')]['id'];}return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x4b29f2['params']['id']}})[_0x3a98('0x1b')](function(_0x4ce999){if(!_0x4ce999)return null;if(_0x4ce999['id']===_0x4b29f2[_0x3a98('0x84')]['id']){if(!_0x4b29f2['body']['oldPassword']||!_0x4b29f2[_0x3a98('0x63')][_0x3a98('0x96')]){throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x4ce999['authenticate'](_0x4b29f2['body']['oldPassword'])){throw new db[(_0x3a98('0x97'))]['ValidationError'](_0x3a98('0x99'));}if(_0x4b29f2[_0x3a98('0x63')][_0x3a98('0x9a')]===_0x4b29f2[_0x3a98('0x63')][_0x3a98('0x96')]){throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4b29f2[_0x3a98('0x84')][_0x3a98('0x35')]===_0x3a98('0x86')){if(!_0x4b29f2['body']['newPassword']){throw new db['Sequelize'][(_0x3a98('0x98'))](_0x3a98('0x9b'));}}else if(_0x4b29f2[_0x3a98('0x84')]['role']===_0x3a98('0x84')){if(!_0x4b29f2[_0x3a98('0x63')][_0x3a98('0x96')]){throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x4ce999[_0x3a98('0x35')]!==_0x3a98('0x37')){throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))]('Unauthorized');}}else{throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))](_0x3a98('0x85'));}return _0x4ce999;})[_0x3a98('0x1b')](handleEntityNotFound(_0x24a63d,null))[_0x3a98('0x1b')](function(_0x3d1288){return db['Setting'][_0x3a98('0x9c')]({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x5f0bb0){if(_0x5f0bb0['securePassword'])authService[_0x3a98('0x9d')](_0x4b29f2[_0x3a98('0x63')]['newPassword']);if(!_0x5f0bb0['enforcePasswordHistory']||!_0x3d1288[_0x3a98('0x9e')])return _0x3d1288;authService['validatePasswordHistory'](_0x4b29f2['body'][_0x3a98('0x96')],_0x3d1288[_0x3a98('0x9e')],_0x5f0bb0[_0x3a98('0x9f')]);return _0x3d1288;})[_0x3a98('0x1b')](saveUpdates({'password':_0x4b29f2[_0x3a98('0x63')][_0x3a98('0x96')],'passwordResetAt':_0x4b29f2['user']['id']==_0x4b29f2[_0x3a98('0x54')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4b29f2[_0x3a98('0x63')]['newPassword'],_0x3d1288[_0x3a98('0x9e')])},null));})[_0x3a98('0x1b')](respondWithResult(_0x24a63d,null))['catch'](handleError(_0x24a63d,null));};exports[_0x3a98('0xa0')]=function(_0x502212,_0x3ece5e){var _0x4c4d56=_0x502212[_0x3a98('0x63')]['channel'];return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x502212['params']['id']},'attributes':['id',_0x3a98('0x3f'),_0x3a98('0x35'),_0x3a98('0xa1'),_0x3a98('0xa2'),_0x3a98('0xa3'),_0x3a98('0xa4')]})[_0x3a98('0x1b')](handleEntityNotFound(_0x3ece5e,null))[_0x3a98('0x1b')](function(_0x3988ae){if(_0x3988ae){if(!utils[_0x3a98('0xa5')](_0x4c4d56)){throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))](_0x3a98('0xa6'));}return _0x3988ae[_0x3a98('0xa7')+_[_0x3a98('0xa8')](_0x4c4d56['toLowerCase']())+_0x3a98('0xa9')](_0x502212[_0x3a98('0x63')][_0x3a98('0x66')],{'penalty':_0x502212[_0x3a98('0x63')]['penalty']||0x0})[_0x3a98('0xaa')](function(_0x3b273f){for(var _0x2814c3=0x0;_0x2814c3<_0x502212[_0x3a98('0x63')][_0x3a98('0x66')]['length'];_0x2814c3+=0x1){var _0x4c020b={'UserId':Number(_0x502212[_0x3a98('0x54')]['id'])};_0x4c020b[_[_0x3a98('0xa8')](_0x4c4d56['toLowerCase']())+_0x3a98('0xab')]=Number(_0x502212['body']['ids'][_0x2814c3]);socket['emit'](_0x3a98('0x84')+_[_0x3a98('0xa8')](_0x4c4d56[_0x3a98('0xac')]())+_0x3a98('0xad'),_0x4c020b);}return _0x3b273f;})[_0x3a98('0x1b')](function(){if(_0x4c4d56==='voice'){return db[_0x3a98('0xae')][_0x3a98('0x92')]({'where':{'id':_0x502212['body'][_0x3a98('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x3a98('0x1b')](function(_0x7278ef){var _0x1e6031=_0x3988ae[_0x3a98('0x34')]({'plain':!![]});var _0x36539d=[];if(_0x4c4d56==='voice'&&_0x1e6031['role']===_0x3a98('0x37')&&_0x1e6031[_0x3a98('0xa1')]){for(var _0x30238c=0x0;_0x30238c<_0x7278ef[_0x3a98('0x4e')];_0x30238c+=0x1){_0x36539d['push']({'membername':_0x1e6031[_0x3a98('0x3f')],'UserId':_0x1e6031['id'],'queue_name':_0x7278ef[_0x30238c]['name'],'VoiceQueueId':_0x7278ef[_0x30238c]['id'],'interface':_[_0x3a98('0x6d')](_0x1e6031[_0x3a98('0xa4')])?util['format'](_0x3a98('0xaf'),_0x1e6031['name']):_0x1e6031[_0x3a98('0xa4')],'paused':_0x1e6031[_0x3a98('0xa3')]||![],'penalty':_0x502212['body'][_0x3a98('0xb0')]||0x0});}return BPromise[_0x3a98('0xb1')](_0x36539d,function(_0x41b6b8){return db[_0x3a98('0xb2')]['upsert'](_0x41b6b8);});}return _0x3988ae;});}})[_0x3a98('0x1b')](respondWithStatusCode(_0x3ece5e,null))[_0x3a98('0x26')](handleError(_0x3ece5e,null));};exports[_0x3a98('0xb3')]=function(_0x1f58fc,_0x3d668e){var _0x367d8c,_0x2e6b6d;return db['User']['find']({'where':{'id':_0x1f58fc[_0x3a98('0x54')]['id']},'attributes':['id',_0x3a98('0x3f'),_0x3a98('0x35')]})['then'](handleEntityNotFound(_0x3d668e,null))[_0x3a98('0x1b')](function(_0xda6d2c){if(_0xda6d2c){_0x367d8c=_0xda6d2c;if(!_0x1f58fc[_0x3a98('0x47')]['channel']||!utils['isValidChannel'](_0x1f58fc[_0x3a98('0x47')][_0x3a98('0xb4')])){throw new db[(_0x3a98('0x97'))]['ValidationError'](_0x3a98('0xa6'));}return _0xda6d2c[_0x3a98('0xb5')+_['capitalize'](_0x1f58fc[_0x3a98('0x47')]['channel'][_0x3a98('0xac')]())+'Queues'](_0x1f58fc[_0x3a98('0x47')][_0x3a98('0x66')]);}})[_0x3a98('0x1b')](function(_0x495464){if(_['isArray'](_0x1f58fc[_0x3a98('0x47')][_0x3a98('0x66')])){for(var _0x5c7723=0x0;_0x5c7723<_0x1f58fc['query'][_0x3a98('0x66')][_0x3a98('0x4e')];_0x5c7723+=0x1){_0x2e6b6d={'UserId':Number(_0x1f58fc[_0x3a98('0x54')]['id'])};_0x2e6b6d[_[_0x3a98('0xa8')](_0x1f58fc[_0x3a98('0x47')][_0x3a98('0xb4')]['toLowerCase']())+_0x3a98('0xab')]=Number(_0x1f58fc['query']['ids'][_0x5c7723]);socket[_0x3a98('0x32')](_0x3a98('0x84')+_[_0x3a98('0xa8')](_0x1f58fc['query'][_0x3a98('0xb4')][_0x3a98('0xac')]())+_0x3a98('0xb6'),_0x2e6b6d);}}else{_0x2e6b6d={'UserId':Number(_0x1f58fc['params']['id'])};_0x2e6b6d[_[_0x3a98('0xa8')](_0x1f58fc[_0x3a98('0x47')][_0x3a98('0xb4')]['toLowerCase']())+'QueueId']=Number(_0x1f58fc[_0x3a98('0x47')]['ids']);socket['emit'](_0x3a98('0x84')+_[_0x3a98('0xa8')](_0x1f58fc['query'][_0x3a98('0xb4')][_0x3a98('0xac')]())+_0x3a98('0xb6'),_0x2e6b6d);}return _0x495464;})[_0x3a98('0x1b')](function(){if(_0x1f58fc['query']['channel']==='voice'){return db['UserVoiceQueueRt'][_0x3a98('0x33')]({'where':{'UserId':_0x1f58fc['params']['id'],'VoiceQueueId':_0x1f58fc[_0x3a98('0x47')][_0x3a98('0x66')]},'individualHooks':!![]})[_0x3a98('0x1b')](function(){return _0x367d8c;});}return _0x367d8c;})['then'](respondWithStatusCode(_0x3d668e,null))[_0x3a98('0x26')](handleError(_0x3d668e,null));};exports['addAvatar']=function(_0x1d2fe7,_0x316c55){_0x1d2fe7[_0x3a98('0x63')][_0x3a98('0xb7')]=_0x1d2fe7['file'][_0x3a98('0xb8')];return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x1d2fe7[_0x3a98('0x54')]['id']}})['then'](handleEntityNotFound(_0x316c55,null))['then'](saveUpdates(_0x1d2fe7['body'],null))[_0x3a98('0x1b')](respondWithResult(_0x316c55,null))[_0x3a98('0x26')](handleError(_0x316c55,null));};exports[_0x3a98('0xb9')]=function(_0x4a4ea4,_0x415ae3){var _0x281719=path[_0x3a98('0xba')](config[_0x3a98('0xbb')],_0x3a98('0xbc'));return db['User'][_0x3a98('0x60')]({'where':{'id':_0x4a4ea4[_0x3a98('0x54')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x3a98('0x1b')](handleEntityNotFound(_0x415ae3,null))[_0x3a98('0x1b')](function(_0x142d86){if(_0x142d86){if(_[_0x3a98('0x6d')](_0x142d86[_0x3a98('0xb7')])){return _0x415ae3[_0x3a98('0xbd')](_0x281719);}else{if(!fs[_0x3a98('0xbe')](path['join'](config[_0x3a98('0xbb')],_0x3a98('0xbf'),_0x142d86[_0x3a98('0xb7')]))){return _0x415ae3[_0x3a98('0xbd')](_0x281719);}return _0x415ae3[_0x3a98('0xbd')](path[_0x3a98('0xba')](config[_0x3a98('0xbb')],'server/files/images/',_0x142d86[_0x3a98('0xb7')]));}}})['catch'](handleError(_0x415ae3,null));};exports[_0x3a98('0xc0')]=function(_0x14655c,_0x5478f8){return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x14655c['params']['id']},'attributes':['id']})[_0x3a98('0x1b')](handleEntityNotFound(_0x5478f8,null))[_0x3a98('0x1b')](function(_0x31698a){var _0x3fac40=[];values=_0x31698a['dataValues'];_0x3fac40['push'](get_open_tabs(_0x3a98('0x4f'),_0x31698a[_0x3a98('0x51')]));_0x3fac40[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0x61'),_0x31698a[_0x3a98('0x51')]));_0x3fac40[_0x3a98('0x4b')](get_open_tabs('openchannel',_0x31698a[_0x3a98('0x51')]));_0x3fac40['push'](get_open_tabs('whatsapp',_0x31698a['dataValues']));_0x3fac40['push'](get_open_tabs('fax',_0x31698a[_0x3a98('0x51')]));_0x3fac40[_0x3a98('0x4b')](get_open_tabs(_0x3a98('0xc1'),_0x31698a[_0x3a98('0x51')]));return BPromise[_0x3a98('0x53')](_0x3fac40);})['then'](function(_0x59c722){if(_0x59c722){var _0x25e6b0=_['map'](values[_0x3a98('0xc2')],function(_0x1731e6){return{'channel':_0x3a98('0xc3'),'id':_0x1731e6['id'],'createdAt':_0x1731e6[_0x3a98('0xc4')]};});var _0xa0ef11=_['map'](values[_0x3a98('0xc5')],function(_0x52c47c){return{'channel':_0x3a98('0xc6'),'id':_0x52c47c['id'],'createdAt':_0x52c47c['createdAt']};});var _0x2cfa0e=_[_0x3a98('0x3c')](values[_0x3a98('0xc7')],function(_0x50afaa){return{'channel':_0x3a98('0xc8'),'id':_0x50afaa['id'],'createdAt':_0x50afaa[_0x3a98('0xc4')]};});var _0x467fad=_[_0x3a98('0x3c')](values['MailOpenTabs'],function(_0x1ed850){return{'channel':_0x3a98('0xc9'),'id':_0x1ed850['id'],'createdAt':_0x1ed850[_0x3a98('0xc4')]};});var _0x312656=_['map'](values[_0x3a98('0xca')],function(_0x1f8f02){return{'channel':_0x3a98('0xcb'),'id':_0x1f8f02['id'],'createdAt':_0x1f8f02[_0x3a98('0xc4')]};});var _0x42d2fe=_[_0x3a98('0x3c')](values[_0x3a98('0xcc')],function(_0x15346e){return{'channel':_0x3a98('0xcd'),'id':_0x15346e['id'],'createdAt':_0x15346e[_0x3a98('0xc4')]};});var _0x2b5830=_['concat'](_0x25e6b0,_0xa0ef11,_0x2cfa0e,_0x467fad,_0x312656,_0x42d2fe);var _0x3844ec={'count':_0x2b5830[_0x3a98('0x4e')],'rows':_0x2b5830};return _0x3844ec;}else return null;})[_0x3a98('0x1b')](respondWithResult(_0x5478f8,null))[_0x3a98('0x26')](handleError(_0x5478f8,null));};exports['getContacts']=function(_0xcffbe7,_0x15bad5){var _0x51c5f1={};var _0x1eea7f={};var _0x4735f3;var _0x1018c7;return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0xcffbe7[_0x3a98('0x54')]['id']}})['then'](handleEntityNotFound(_0x15bad5,null))[_0x3a98('0x1b')](function(_0x3b39fa){if(_0x3b39fa){_0x4735f3=_0x3b39fa;_0x1eea7f[_0x3a98('0x59')]=_[_0x3a98('0x55')](db['CmContact']['rawAttributes']);_0x1eea7f[_0x3a98('0x47')]=_['keys'](_0xcffbe7[_0x3a98('0x47')]);_0x1eea7f['filters']=_['intersection'](_0x1eea7f[_0x3a98('0x59')],_0x1eea7f[_0x3a98('0x47')]);_0x51c5f1[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x1eea7f[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0xcffbe7[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x51c5f1[_0x3a98('0x4a')]=_0x51c5f1[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x51c5f1['attributes']:_0x1eea7f[_0x3a98('0x59')];_0x51c5f1['order']=qs[_0x3a98('0xce')](_0xcffbe7['query']['sort']);_0x51c5f1[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_['pick'](_0xcffbe7['query'],_0x1eea7f[_0x3a98('0x57')]));if(_0xcffbe7[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x51c5f1['where']=_[_0x3a98('0x5e')](_0x51c5f1[_0x3a98('0xcf')],{'$or':_['map'](_0x51c5f1['attributes'],function(_0x4bc95f){var _0x5443e6={};_0x5443e6[_0x4bc95f]={'$like':'%'+_0xcffbe7[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x5443e6;})});}_0x51c5f1=_[_0x3a98('0x5e')]({},_0x51c5f1,_0xcffbe7[_0x3a98('0x5f')]);return _0x4735f3['getContacts'](_0x51c5f1);}})['then'](function(_0x34b5c9){if(_0x34b5c9){_0x1018c7=_0x34b5c9[_0x3a98('0x4e')];if(_0xcffbe7[_0x3a98('0x47')]['hasOwnProperty'](_0x3a98('0x48'))){_0x51c5f1[_0x3a98('0x5b')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x3a98('0x3f'),_0x3a98('0xd0')],'where':_0xcffbe7['query'][_0x3a98('0xd1')]?{'id':_0xcffbe7[_0x3a98('0x47')][_0x3a98('0xd1')]}:undefined,'required':_0xcffbe7[_0x3a98('0x47')]['tag']?!![]:![]}];}if(!_0xcffbe7['query'][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x51c5f1['limit']=qs['limit'](_0xcffbe7['query'][_0x3a98('0x2e')]);_0x51c5f1[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0xcffbe7[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x4735f3[_0x3a98('0xd4')](_0x51c5f1);}})[_0x3a98('0x1b')](function(_0x108337){if(_0x108337){return _0x108337?{'count':_0x1018c7,'rows':_0x108337}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x15bad5,null))[_0x3a98('0x26')](handleError(_0x15bad5,null));};exports[_0x3a98('0xd5')]=function(_0x40bae5,_0x152140){var _0x365dfb;var _0x241762={};var _0x34b141;return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x40bae5[_0x3a98('0x54')]['id']},'attributes':['id','name',_0x3a98('0x35')]})[_0x3a98('0x1b')](handleEntityNotFound(_0x152140,null))[_0x3a98('0x1b')](function(_0x41b4e2){if(!utils[_0x3a98('0xa5')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xb4')])){throw new db[(_0x3a98('0x97'))]['ValidationError'](_0x3a98('0xa6'));}_0x365dfb=_0x41b4e2;var _0x124f0f={};_0x124f0f[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_[_0x3a98('0xa8')](_0x40bae5[_0x3a98('0x47')]['channel'])+_0x3a98('0xd6')]['rawAttributes']);_0x124f0f[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x40bae5[_0x3a98('0x47')]);_0x124f0f[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x124f0f[_0x3a98('0x59')],_0x124f0f[_0x3a98('0x47')]);_0x241762[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x124f0f['model'],qs['fields'](_0x40bae5[_0x3a98('0x47')]['fields']));_0x241762[_0x3a98('0x4a')]=_0x241762[_0x3a98('0x4a')]['length']?_0x241762[_0x3a98('0x4a')]:_0x124f0f[_0x3a98('0x59')];_0x241762[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xce')]);_0x241762[_0x3a98('0xcf')]=qs['filters'](_[_0x3a98('0xd8')](_0x40bae5['query'],_0x124f0f['filters']));if(_0x40bae5[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x241762['where']=_['merge'](_0x241762['where'],{'$or':_['map'](_0x241762[_0x3a98('0x4a')],function(_0x2c6e8f){var _0x22d2d2={};_0x22d2d2[_0x2c6e8f]={'$like':'%'+_0x40bae5[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x22d2d2;})});}_0x241762=_[_0x3a98('0x5e')]({},_0x241762,_0x40bae5[_0x3a98('0x5f')]);switch(_0x365dfb['role']){case _0x3a98('0x86'):return db[_['capitalize'](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xb4')])+_0x3a98('0xd6')][_0x3a98('0x92')](_0x241762);case'user':case _0x3a98('0x37'):return _0x365dfb[_0x3a98('0x34')+_[_0x3a98('0xa8')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xb4')])+_0x3a98('0xa9')](_0x241762);default:throw new db[(_0x3a98('0x97'))][(_0x3a98('0x98'))]('Unknown\x20role');}})['then'](function(_0x427315){_0x34b141=_0x427315['length'];if(!_0x40bae5[_0x3a98('0x47')][_0x3a98('0xd2')]('nolimit')){_0x241762['limit']=qs[_0x3a98('0x2e')](_0x40bae5[_0x3a98('0x47')]['limit']);_0x241762['offset']=qs[_0x3a98('0x2b')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0x2b')]);}switch(_0x365dfb['role']){case _0x3a98('0x86'):return db[_[_0x3a98('0xa8')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xb4')])+_0x3a98('0xd6')]['findAll'](_0x241762);case _0x3a98('0x84'):case _0x3a98('0x37'):return _0x365dfb[_0x3a98('0x34')+_[_0x3a98('0xa8')](_0x40bae5[_0x3a98('0x47')][_0x3a98('0xb4')])+_0x3a98('0xa9')](_0x241762);}})['then'](function(_0x304be9){return{'count':_0x34b141,'rows':_0x304be9};})['then'](respondWithResult(_0x152140,null))['catch'](handleError(_0x152140,null));};exports[_0x3a98('0xd9')]=function(_0x56a803,_0x1eb5ff){var _0x574240={};var _0x27ea28={};var _0x27d293;var _0x498e65;return db['User']['findOne']({'where':{'id':_0x56a803[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x1eb5ff,null))[_0x3a98('0x1b')](function(_0x4802d9){if(_0x4802d9){_0x27d293=_0x4802d9;_0x27ea28[_0x3a98('0x59')]=_[_0x3a98('0x55')](db['UserVoiceQueueRt'][_0x3a98('0x43')]);_0x27ea28[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x56a803[_0x3a98('0x47')]);_0x27ea28[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x27ea28[_0x3a98('0x59')],_0x27ea28[_0x3a98('0x47')]);_0x574240[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x27ea28[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x56a803[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x574240[_0x3a98('0x4a')]=_0x574240['attributes'][_0x3a98('0x4e')]?_0x574240[_0x3a98('0x4a')]:_0x27ea28[_0x3a98('0x59')];_0x574240[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x56a803[_0x3a98('0x47')][_0x3a98('0xce')]);_0x574240[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x56a803['query'],_0x27ea28[_0x3a98('0x57')]));if(_0x56a803[_0x3a98('0x47')]['filter']){_0x574240[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x574240['where'],{'$or':_[_0x3a98('0x3c')](_0x574240['attributes'],function(_0x13a1e7){var _0x5b06e0={};_0x5b06e0[_0x13a1e7]={'$like':'%'+_0x56a803[_0x3a98('0x47')]['filter']+'%'};return _0x5b06e0;})});}_0x574240=_[_0x3a98('0x5e')]({},_0x574240,_0x56a803[_0x3a98('0x5f')]);return _0x27d293[_0x3a98('0xd9')](_0x574240);}})[_0x3a98('0x1b')](function(_0x43b18e){if(_0x43b18e){_0x498e65=_0x43b18e[_0x3a98('0x4e')];if(!_0x56a803[_0x3a98('0x47')][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x574240['limit']=qs[_0x3a98('0x2e')](_0x56a803[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x574240['offset']=qs['offset'](_0x56a803[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x27d293[_0x3a98('0xd9')](_0x574240);}})[_0x3a98('0x1b')](function(_0xa587a8){if(_0xa587a8){return _0xa587a8?{'count':_0x498e65,'rows':_0xa587a8}:null;}})['then'](respondWithResult(_0x1eb5ff,null))['catch'](handleError(_0x1eb5ff,null));};exports[_0x3a98('0xda')]=function(_0x526ae7,_0x345304){var _0x5c64c5={};var _0x5e4cfc={};var _0x4f665b;var _0x15f308;return db[_0x3a98('0x42')]['findOne']({'where':{'id':_0x526ae7['params']['id']}})['then'](handleEntityNotFound(_0x345304,null))[_0x3a98('0x1b')](function(_0x3e484d){if(_0x3e484d){_0x4f665b=_0x3e484d;_0x5e4cfc['model']=_[_0x3a98('0x55')](db[_0x3a98('0xdb')][_0x3a98('0x43')]);_0x5e4cfc['query']=_[_0x3a98('0x55')](_0x526ae7[_0x3a98('0x47')]);_0x5e4cfc[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x5e4cfc[_0x3a98('0x59')],_0x5e4cfc[_0x3a98('0x47')]);_0x5c64c5[_0x3a98('0x4a')]=_['intersection'](_0x5e4cfc[_0x3a98('0x59')],qs['fields'](_0x526ae7[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x5c64c5[_0x3a98('0x4a')]=_0x5c64c5[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x5c64c5[_0x3a98('0x4a')]:_0x5e4cfc[_0x3a98('0x59')];_0x5c64c5[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x526ae7['query'][_0x3a98('0xce')]);_0x5c64c5[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x526ae7['query'],_0x5e4cfc[_0x3a98('0x57')]));if(_0x526ae7[_0x3a98('0x47')]['filter']){_0x5c64c5[_0x3a98('0xcf')]=_['merge'](_0x5c64c5[_0x3a98('0xcf')],{'$or':_['map'](_0x5c64c5[_0x3a98('0x4a')],function(_0xa6856c){var _0x2e9558={};_0x2e9558[_0xa6856c]={'$like':'%'+_0x526ae7['query']['filter']+'%'};return _0x2e9558;})});}_0x5c64c5=_[_0x3a98('0x5e')]({},_0x5c64c5,_0x526ae7[_0x3a98('0x5f')]);return _0x4f665b[_0x3a98('0xda')](_0x5c64c5);}})[_0x3a98('0x1b')](function(_0x32c6ac){if(_0x32c6ac){_0x15f308=_0x32c6ac[_0x3a98('0x4e')];if(!_0x526ae7['query'][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x5c64c5['limit']=qs['limit'](_0x526ae7[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x5c64c5['offset']=qs['offset'](_0x526ae7[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x4f665b[_0x3a98('0xda')](_0x5c64c5);}})[_0x3a98('0x1b')](function(_0x4b8b2f){if(_0x4b8b2f){return _0x4b8b2f?{'count':_0x15f308,'rows':_0x4b8b2f}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x345304,null))[_0x3a98('0x26')](handleError(_0x345304,null));};exports[_0x3a98('0xdc')]=function(_0x3769a4,_0x19c216){var _0x2186e5={'raw':!![],'where':{}};var _0x1160a3={};var _0x429be5={'count':0x0,'rows':[]};return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x3769a4[_0x3a98('0x54')]['id']}})['then'](handleEntityNotFound(_0x19c216,null))[_0x3a98('0x1b')](function(_0x50e8c2){if(_0x50e8c2){_0x1160a3[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xdd')][_0x3a98('0x43')]);_0x1160a3[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x3769a4['query']);_0x1160a3['filters']=_[_0x3a98('0x58')](_0x1160a3['model'],_0x1160a3['query']);_0x2186e5[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x1160a3[_0x3a98('0x59')],qs['fields'](_0x3769a4['query'][_0x3a98('0x5a')]));_0x2186e5[_0x3a98('0x4a')]=_0x2186e5['attributes']['length']?_0x2186e5['attributes']:_0x1160a3[_0x3a98('0x59')];if(!_0x3769a4[_0x3a98('0x47')][_0x3a98('0xd2')]('nolimit')){_0x2186e5[_0x3a98('0x2e')]=qs[_0x3a98('0x2e')](_0x3769a4['query']['limit']);_0x2186e5[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x3769a4['query'][_0x3a98('0x2b')]);}_0x2186e5[_0x3a98('0xd7')]=qs['sort'](_0x3769a4[_0x3a98('0x47')]['sort']);_0x2186e5['where']=qs[_0x3a98('0x57')](_['pick'](_0x3769a4[_0x3a98('0x47')],_0x1160a3['filters']));_0x2186e5['where']['UserId']=_0x50e8c2['id'];if(_0x3769a4[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x2186e5[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x2186e5[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x2186e5['attributes'],function(_0x382574){var _0x15da18={};_0x15da18[_0x382574]={'$like':'%'+_0x3769a4['query'][_0x3a98('0x3a')]+'%'};return _0x15da18;})});}_0x2186e5=_[_0x3a98('0x5e')]({},_0x2186e5,_0x3769a4[_0x3a98('0x5f')]);return db[_0x3a98('0xdd')][_0x3a98('0x2d')]({'where':_0x2186e5[_0x3a98('0xcf')]})['then'](function(_0x37d8dd){_0x429be5[_0x3a98('0x2d')]=_0x37d8dd;if(_0x3769a4[_0x3a98('0x47')][_0x3a98('0x48')]){_0x2186e5['include']=[{'all':!![]}];}return db[_0x3a98('0xdd')][_0x3a98('0x92')](_0x2186e5);})[_0x3a98('0x1b')](function(_0x19ad80){_0x429be5[_0x3a98('0x4c')]=_0x19ad80;return _0x429be5;});}})[_0x3a98('0x1b')](respondWithFilteredResult(_0x19c216,_0x2186e5))[_0x3a98('0x26')](handleError(_0x19c216,null));};exports[_0x3a98('0xde')]=function(_0x400728,_0x1dd9d5){var _0xa81048={'raw':!![],'where':{}};var _0x17f05d={};var _0x23a437={'count':0x0,'rows':[]};return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x400728[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x1dd9d5,null))[_0x3a98('0x1b')](function(_0x2a9d71){if(_0x2a9d71){_0x17f05d[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xdf')][_0x3a98('0x43')]);_0x17f05d[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x400728['query']);_0x17f05d[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x17f05d[_0x3a98('0x59')],_0x17f05d[_0x3a98('0x47')]);_0xa81048[_0x3a98('0x4a')]=_['intersection'](_0x17f05d[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x400728['query'][_0x3a98('0x5a')]));_0xa81048['attributes']=_0xa81048['attributes'][_0x3a98('0x4e')]?_0xa81048[_0x3a98('0x4a')]:_0x17f05d[_0x3a98('0x59')];if(!_0x400728[_0x3a98('0x47')][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0xa81048[_0x3a98('0x2e')]=qs['limit'](_0x400728[_0x3a98('0x47')][_0x3a98('0x2e')]);_0xa81048['offset']=qs[_0x3a98('0x2b')](_0x400728[_0x3a98('0x47')]['offset']);}_0xa81048[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x400728[_0x3a98('0x47')][_0x3a98('0xce')]);_0xa81048[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_['pick'](_0x400728[_0x3a98('0x47')],_0x17f05d['filters']));_0xa81048['where']['UserId']=_0x2a9d71['id'];if(_0x400728[_0x3a98('0x47')][_0x3a98('0x3a')]){_0xa81048['where']=_[_0x3a98('0x5e')](_0xa81048['where'],{'$or':_[_0x3a98('0x3c')](_0xa81048[_0x3a98('0x4a')],function(_0x36f9be){var _0x2441da={};_0x2441da[_0x36f9be]={'$like':'%'+_0x400728[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x2441da;})});}_0xa81048=_[_0x3a98('0x5e')]({},_0xa81048,_0x400728[_0x3a98('0x5f')]);return db[_0x3a98('0xdf')][_0x3a98('0x2d')]({'where':_0xa81048[_0x3a98('0xcf')]})['then'](function(_0x5cc42a){_0x23a437[_0x3a98('0x2d')]=_0x5cc42a;if(_0x400728[_0x3a98('0x47')][_0x3a98('0x48')]){_0xa81048[_0x3a98('0x5b')]=[{'all':!![]}];}return db[_0x3a98('0xdf')][_0x3a98('0x92')](_0xa81048);})[_0x3a98('0x1b')](function(_0x1d2ebd){_0x23a437[_0x3a98('0x4c')]=_0x1d2ebd;return _0x23a437;});}})[_0x3a98('0x1b')](respondWithFilteredResult(_0x1dd9d5,_0xa81048))[_0x3a98('0x26')](handleError(_0x1dd9d5,null));};exports['getChatInteractions']=function(_0x4ab39a,_0x43650d){var _0x5a7580={};var _0x459f8c={};var _0x53f28a;var _0x583cd0;return db['User']['findOne']({'where':{'id':_0x4ab39a[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x43650d,null))['then'](function(_0x380ecb){if(_0x380ecb){_0x53f28a=_0x380ecb;_0x459f8c[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xe0')][_0x3a98('0x43')]);_0x459f8c[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x4ab39a[_0x3a98('0x47')]);_0x459f8c[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x459f8c['model'],_0x459f8c[_0x3a98('0x47')]);_0x5a7580[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x459f8c[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x4ab39a[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x5a7580[_0x3a98('0x4a')]=_0x5a7580[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x5a7580[_0x3a98('0x4a')]:_0x459f8c[_0x3a98('0x59')];_0x5a7580[_0x3a98('0xd7')]=qs['sort'](_0x4ab39a[_0x3a98('0x47')][_0x3a98('0xce')]);_0x5a7580[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x4ab39a[_0x3a98('0x47')],_0x459f8c[_0x3a98('0x57')]));if(_0x4ab39a[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x5a7580[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x5a7580[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x5a7580[_0x3a98('0x4a')],function(_0x352711){var _0x2f75f9={};_0x2f75f9[_0x352711]={'$like':'%'+_0x4ab39a[_0x3a98('0x47')]['filter']+'%'};return _0x2f75f9;})});}_0x5a7580=_['merge']({},_0x5a7580,_0x4ab39a[_0x3a98('0x5f')]);return _0x53f28a['getChatInteractions'](_0x5a7580);}})[_0x3a98('0x1b')](function(_0x34fdb1){if(_0x34fdb1){_0x583cd0=_0x34fdb1[_0x3a98('0x4e')];if(!_0x4ab39a[_0x3a98('0x47')][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x5a7580[_0x3a98('0x2e')]=qs[_0x3a98('0x2e')](_0x4ab39a['query'][_0x3a98('0x2e')]);_0x5a7580[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x4ab39a[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x53f28a[_0x3a98('0xe1')](_0x5a7580);}})['then'](function(_0x105fdd){if(_0x105fdd){return _0x105fdd?{'count':_0x583cd0,'rows':_0x105fdd}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x43650d,null))['catch'](handleError(_0x43650d,null));};exports[_0x3a98('0xe2')]=function(_0x4e7a6c,_0x236f04){var _0xddb035={};var _0x128263={};var _0x4c875b;var _0x4ef854;return db['User'][_0x3a98('0x9c')]({'where':{'id':_0x4e7a6c[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x236f04,null))[_0x3a98('0x1b')](function(_0x32eaa1){if(_0x32eaa1){_0x4c875b=_0x32eaa1;_0x128263[_0x3a98('0x59')]=_['keys'](db[_0x3a98('0xe3')]['rawAttributes']);_0x128263[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x4e7a6c[_0x3a98('0x47')]);_0x128263[_0x3a98('0x57')]=_['intersection'](_0x128263[_0x3a98('0x59')],_0x128263[_0x3a98('0x47')]);_0xddb035[_0x3a98('0x4a')]=_[_0x3a98('0x58')](_0x128263[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0x5a')]));_0xddb035[_0x3a98('0x4a')]=_0xddb035['attributes']['length']?_0xddb035[_0x3a98('0x4a')]:_0x128263[_0x3a98('0x59')];_0xddb035[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0xce')]);_0xddb035['where']=qs[_0x3a98('0x57')](_['pick'](_0x4e7a6c[_0x3a98('0x47')],_0x128263[_0x3a98('0x57')]));if(_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0x3a')]){_0xddb035['where']=_['merge'](_0xddb035[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0xddb035['attributes'],function(_0x1498c8){var _0xa78e43={};_0xa78e43[_0x1498c8]={'$like':'%'+_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0xa78e43;})});}_0xddb035=_[_0x3a98('0x5e')]({},_0xddb035,_0x4e7a6c['options']);return _0x4c875b[_0x3a98('0xe2')](_0xddb035);}})[_0x3a98('0x1b')](function(_0x5e2804){if(_0x5e2804){_0x4ef854=_0x5e2804['length'];if(!_0x4e7a6c['query']['hasOwnProperty']('nolimit')){_0xddb035['limit']=qs['limit'](_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0x2e')]);_0xddb035[_0x3a98('0x2b')]=qs['offset'](_0x4e7a6c[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x4c875b[_0x3a98('0xe2')](_0xddb035);}})[_0x3a98('0x1b')](function(_0x2fac18){if(_0x2fac18){return _0x2fac18?{'count':_0x4ef854,'rows':_0x2fac18}:null;}})['then'](respondWithResult(_0x236f04,null))[_0x3a98('0x26')](handleError(_0x236f04,null));};exports[_0x3a98('0xe4')]=function(_0x17b848,_0x1a498a){var _0x3b5a7a={'raw':!![],'where':{}};var _0x4b8099={};var _0x3cb9ef={'count':0x0,'rows':[]};return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x17b848[_0x3a98('0x54')]['id']}})['then'](handleEntityNotFound(_0x1a498a,null))[_0x3a98('0x1b')](function(_0x2f5350){if(_0x2f5350){_0x4b8099['model']=_[_0x3a98('0x55')](db['MailInteraction'][_0x3a98('0x43')]);_0x4b8099['query']=_[_0x3a98('0x55')](_0x17b848[_0x3a98('0x47')]);_0x4b8099['filters']=_[_0x3a98('0x58')](_0x4b8099[_0x3a98('0x59')],_0x4b8099[_0x3a98('0x47')]);_0x3b5a7a['attributes']=_['intersection'](_0x4b8099[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x17b848[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x3b5a7a['attributes']=_0x3b5a7a[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x3b5a7a[_0x3a98('0x4a')]:_0x4b8099[_0x3a98('0x59')];if(!_0x17b848['query']['hasOwnProperty'](_0x3a98('0xd3'))){_0x3b5a7a[_0x3a98('0x2e')]=qs[_0x3a98('0x2e')](_0x17b848[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x3b5a7a[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x17b848['query']['offset']);}_0x3b5a7a[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x17b848[_0x3a98('0x47')]['sort']);_0x3b5a7a[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_['pick'](_0x17b848[_0x3a98('0x47')],_0x4b8099[_0x3a98('0x57')]));_0x3b5a7a[_0x3a98('0xcf')]['UserId']=_0x2f5350['id'];if(_0x17b848[_0x3a98('0x47')]['filter']){_0x3b5a7a[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x3b5a7a[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x3b5a7a[_0x3a98('0x4a')],function(_0x385827){var _0x5280f4={};_0x5280f4[_0x385827]={'$like':'%'+_0x17b848[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x5280f4;})});}_0x3b5a7a=_[_0x3a98('0x5e')]({},_0x3b5a7a,_0x17b848[_0x3a98('0x5f')]);return db[_0x3a98('0xe5')][_0x3a98('0x2d')]({'where':_0x3b5a7a[_0x3a98('0xcf')]})['then'](function(_0x225381){_0x3cb9ef['count']=_0x225381;if(_0x17b848[_0x3a98('0x47')][_0x3a98('0x48')]){_0x3b5a7a[_0x3a98('0x5b')]=[{'all':!![]}];}return db[_0x3a98('0xe5')][_0x3a98('0x92')](_0x3b5a7a);})[_0x3a98('0x1b')](function(_0x190131){_0x3cb9ef[_0x3a98('0x4c')]=_0x190131;return _0x3cb9ef;});}})['then'](respondWithFilteredResult(_0x1a498a,_0x3b5a7a))[_0x3a98('0x26')](handleError(_0x1a498a,null));};exports[_0x3a98('0xe6')]=function(_0x3a67d6,_0x351f99){var _0x47d204={};var _0x25aad1={};var _0x30ed53;var _0x2659ce;return db[_0x3a98('0x42')]['findOne']({'where':{'id':_0x3a67d6[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x351f99,null))[_0x3a98('0x1b')](function(_0xa79fb6){if(_0xa79fb6){_0x30ed53=_0xa79fb6;_0x25aad1[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xe7')]['rawAttributes']);_0x25aad1['query']=_[_0x3a98('0x55')](_0x3a67d6['query']);_0x25aad1[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x25aad1['model'],_0x25aad1[_0x3a98('0x47')]);_0x47d204[_0x3a98('0x4a')]=_['intersection'](_0x25aad1[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x3a67d6['query'][_0x3a98('0x5a')]));_0x47d204[_0x3a98('0x4a')]=_0x47d204['attributes'][_0x3a98('0x4e')]?_0x47d204[_0x3a98('0x4a')]:_0x25aad1[_0x3a98('0x59')];_0x47d204['order']=qs[_0x3a98('0xce')](_0x3a67d6[_0x3a98('0x47')][_0x3a98('0xce')]);_0x47d204[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x3a67d6[_0x3a98('0x47')],_0x25aad1[_0x3a98('0x57')]));if(_0x3a67d6[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x47d204['where']=_['merge'](_0x47d204[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x47d204[_0x3a98('0x4a')],function(_0x1f4c40){var _0x1419ae={};_0x1419ae[_0x1f4c40]={'$like':'%'+_0x3a67d6[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x1419ae;})});}_0x47d204=_[_0x3a98('0x5e')]({},_0x47d204,_0x3a67d6[_0x3a98('0x5f')]);return _0x30ed53[_0x3a98('0xe6')](_0x47d204);}})[_0x3a98('0x1b')](function(_0x40977a){if(_0x40977a){_0x2659ce=_0x40977a['length'];if(!_0x3a67d6[_0x3a98('0x47')][_0x3a98('0xd2')]('nolimit')){_0x47d204['limit']=qs[_0x3a98('0x2e')](_0x3a67d6[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x47d204['offset']=qs[_0x3a98('0x2b')](_0x3a67d6[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x30ed53[_0x3a98('0xe6')](_0x47d204);}})[_0x3a98('0x1b')](function(_0x12b6c9){if(_0x12b6c9){return _0x12b6c9?{'count':_0x2659ce,'rows':_0x12b6c9}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x351f99,null))['catch'](handleError(_0x351f99,null));};exports[_0x3a98('0xe8')]=function(_0x1d22b4,_0x3e4135){var _0xb39a78={};var _0x4efad1={};var _0x43eafd;var _0x222e99;return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x1d22b4['params']['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x3e4135,null))[_0x3a98('0x1b')](function(_0x508e40){if(_0x508e40){_0x43eafd=_0x508e40;_0x4efad1[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xe9')][_0x3a98('0x43')]);_0x4efad1[_0x3a98('0x47')]=_['keys'](_0x1d22b4[_0x3a98('0x47')]);_0x4efad1[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x4efad1[_0x3a98('0x59')],_0x4efad1[_0x3a98('0x47')]);_0xb39a78['attributes']=_[_0x3a98('0x58')](_0x4efad1['model'],qs['fields'](_0x1d22b4[_0x3a98('0x47')]['fields']));_0xb39a78[_0x3a98('0x4a')]=_0xb39a78[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0xb39a78[_0x3a98('0x4a')]:_0x4efad1[_0x3a98('0x59')];_0xb39a78[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x1d22b4['query'][_0x3a98('0xce')]);_0xb39a78[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x1d22b4[_0x3a98('0x47')],_0x4efad1['filters']));if(_0x1d22b4[_0x3a98('0x47')]['filter']){_0xb39a78[_0x3a98('0xcf')]=_['merge'](_0xb39a78[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0xb39a78[_0x3a98('0x4a')],function(_0x1d4503){var _0x4f2dfa={};_0x4f2dfa[_0x1d4503]={'$like':'%'+_0x1d22b4[_0x3a98('0x47')]['filter']+'%'};return _0x4f2dfa;})});}_0xb39a78=_[_0x3a98('0x5e')]({},_0xb39a78,_0x1d22b4['options']);return _0x43eafd[_0x3a98('0xe8')](_0xb39a78);}})[_0x3a98('0x1b')](function(_0x1debfa){if(_0x1debfa){_0x222e99=_0x1debfa['length'];if(!_0x1d22b4[_0x3a98('0x47')][_0x3a98('0xd2')]('nolimit')){_0xb39a78[_0x3a98('0x2e')]=qs['limit'](_0x1d22b4[_0x3a98('0x47')][_0x3a98('0x2e')]);_0xb39a78[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x1d22b4[_0x3a98('0x47')][_0x3a98('0x2b')]);}return _0x43eafd[_0x3a98('0xe8')](_0xb39a78);}})[_0x3a98('0x1b')](function(_0x34bc06){if(_0x34bc06){return _0x34bc06?{'count':_0x222e99,'rows':_0x34bc06}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x3e4135,null))[_0x3a98('0x26')](handleError(_0x3e4135,null));};exports[_0x3a98('0xea')]=function(_0xc7424a,_0x37e861){var _0x1f7525={};var _0x2075c0={};var _0x7afc74;var _0x2a6ce6;return db[_0x3a98('0x42')]['findOne']({'where':{'id':_0xc7424a['params']['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x37e861,null))[_0x3a98('0x1b')](function(_0x485220){if(_0x485220){_0x7afc74=_0x485220;_0x2075c0[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0xeb')][_0x3a98('0x43')]);_0x2075c0[_0x3a98('0x47')]=_['keys'](_0xc7424a['query']);_0x2075c0[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x2075c0[_0x3a98('0x59')],_0x2075c0['query']);_0x1f7525['attributes']=_['intersection'](_0x2075c0[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0xc7424a['query']['fields']));_0x1f7525['attributes']=_0x1f7525[_0x3a98('0x4a')][_0x3a98('0x4e')]?_0x1f7525[_0x3a98('0x4a')]:_0x2075c0['model'];_0x1f7525['order']=qs['sort'](_0xc7424a[_0x3a98('0x47')][_0x3a98('0xce')]);_0x1f7525[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_['pick'](_0xc7424a[_0x3a98('0x47')],_0x2075c0['filters']));if(_0xc7424a[_0x3a98('0x47')]['filter']){_0x1f7525[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x1f7525[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x1f7525[_0x3a98('0x4a')],function(_0x20b00b){var _0x3bdd2d={};_0x3bdd2d[_0x20b00b]={'$like':'%'+_0xc7424a[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0x3bdd2d;})});}_0x1f7525=_['merge']({},_0x1f7525,_0xc7424a[_0x3a98('0x5f')]);return _0x7afc74[_0x3a98('0xea')](_0x1f7525);}})[_0x3a98('0x1b')](function(_0x115493){if(_0x115493){_0x2a6ce6=_0x115493['length'];if(!_0xc7424a['query'][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x1f7525[_0x3a98('0x2e')]=qs[_0x3a98('0x2e')](_0xc7424a[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x1f7525[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0xc7424a['query'][_0x3a98('0x2b')]);}return _0x7afc74['getWhatsappInteractions'](_0x1f7525);}})[_0x3a98('0x1b')](function(_0x3c15e6){if(_0x3c15e6){return _0x3c15e6?{'count':_0x2a6ce6,'rows':_0x3c15e6}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x37e861,null))[_0x3a98('0x26')](handleError(_0x37e861,null));};exports[_0x3a98('0xec')]=function(_0x138ff9,_0x213227,_0x307c07){var _0x316097;var _0x88a4ab;var _0x5b0d84;var _0x5b05d2=!_[_0x3a98('0x6d')](_0x138ff9[_0x3a98('0x54')]['id'])?_0x138ff9[_0x3a98('0x54')]['id']:!_[_0x3a98('0x6d')](_0x138ff9[_0x3a98('0x84')]['id'])?_0x138ff9[_0x3a98('0x84')]['id']:null;return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x5b05d2,'role':{'$or':[_0x3a98('0x86'),'user',_0x3a98('0x37')]}},'attributes':['id','name','phone',_0x3a98('0xed'),'role',_0x3a98('0x68'),_0x3a98('0xa2')]})[_0x3a98('0x1b')](function(_0x3b5b7d){if(_0x3b5b7d){if(_0x3b5b7d[_0x3a98('0x35')]==='agent'){_0x316097=_0x3b5b7d;if(_0x138ff9[_0x3a98('0x63')][_0x3a98('0xa4')]){_0x5b0d84=util[_0x3a98('0xee')]('LOCAL/%s@from-sip/n',_0x316097[_0x138ff9[_0x3a98('0x63')]['interface']]);}else if(_0x138ff9[_0x3a98('0x63')][_0x3a98('0xef')]){_0x5b0d84=util[_0x3a98('0xee')](_0x3a98('0xaf'),_0x138ff9[_0x3a98('0x63')][_0x3a98('0xef')]);}else{_0x5b0d84=util[_0x3a98('0xee')](_0x3a98('0xaf'),_0x316097['name']);}socket['to'](util[_0x3a98('0xee')](_0x3a98('0xf0'),_0x316097[_0x3a98('0x3f')]))[_0x3a98('0x32')](_0x3a98('0xf1'),{'user':{'id':_0x316097['id'],'name':_0x316097['name']},'ip':_0x138ff9['headers'][_0x3a98('0xf2')]||_0x138ff9[_0x3a98('0xf3')]['remoteAddress']||_0x138ff9[_0x3a98('0xf4')][_0x3a98('0xf5')]||_0x138ff9['connection']['socket'][_0x3a98('0xf5')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x316097['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x3a98('0x98'))](_0x3a98('0xf6'));}})[_0x3a98('0x1b')](function(){if(_0x316097){return _0x316097[_0x3a98('0xf7')]({'raw':!![]});}})[_0x3a98('0x1b')](function(_0x4ca2ec){if(_0x316097){var _0x11b03b=[];if(_0x4ca2ec){_0x88a4ab=_0x4ca2ec;if(_0x88a4ab['length']){for(var _0x24ba57=0x0;_0x24ba57<_0x88a4ab[_0x3a98('0x4e')];_0x24ba57++){_0x11b03b[_0x3a98('0x4b')]({'membername':_0x316097[_0x3a98('0x3f')],'UserId':_0x316097['id'],'queue_name':_0x88a4ab[_0x24ba57][_0x3a98('0x3f')],'VoiceQueueId':_0x88a4ab[_0x24ba57]['id'],'interface':_0x5b0d84,'paused':_0x316097[_0x3a98('0xa2')]||![],'penalty':_0x88a4ab[_0x24ba57]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x3a98('0xb1')](_0x11b03b,function(_0x415139){return db[_0x3a98('0xb2')][_0x3a98('0xf8')](_0x415139);});}}}})[_0x3a98('0x1b')](function(){if(_0x316097){return db[_0x3a98('0xf9')]['findAll']({'where':{'membername':_0x316097[_0x3a98('0x3f')],'exitAt':null}});}})['then'](function(_0x1652d1){if(_0x316097){var _0x2a323c=[];_0x1652d1['forEach'](function(_0x42a248){_0x2a323c[_0x3a98('0x4b')](_0x42a248[_0x3a98('0x31')]({'exitAt':moment()[_0x3a98('0xee')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3a98('0x53')](_0x2a323c);}})[_0x3a98('0x1b')](function(){if(_0x316097){var _0x4f4567=[];var _0x4285d8=[];var _0x51a3cd=utils[_0x3a98('0xfa')]();var _0x2ae170={'membername':_0x316097[_0x3a98('0x3f')],'interface':_0x5b0d84,'enterAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb')),'role':_0x316097[_0x3a98('0x35')],'internal':_0x316097[_0x3a98('0x68')]};_0x51a3cd[_0x3a98('0xfc')](function(_0x25b536){_0x4f4567[_0x3a98('0x4b')](_[_0x3a98('0x5e')]({'channel':_0x25b536,'type':_0x3a98('0xfd'),'data1':_0x138ff9[_0x3a98('0x63')]['device'],'data2':_0x5b0d84},_0x2ae170));if(_0x316097[_0x3a98('0xa2')]){_0x4285d8[_0x3a98('0x4b')](_['merge']({'channel':_0x25b536,'type':_0x3a98('0xfe'),'data1':_0x3a98('0xff')},_0x2ae170));}});return db[_0x3a98('0xf9')][_0x3a98('0x8f')](_0x4f4567['concat'](_0x4285d8),{'individualHooks':!![]});}})['then'](function(){if(_0x316097){return _0x316097[_0x3a98('0x31')]({'online':!![],'lastLoginAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb')),'voicePause':_0x316097[_0x3a98('0xa2')]||![],'mailPause':_0x316097[_0x3a98('0xa2')]||![],'chatPause':_0x316097[_0x3a98('0xa2')]||![],'faxPause':_0x316097[_0x3a98('0xa2')]||![],'smsPause':_0x316097[_0x3a98('0xa2')]||![],'openchannelPause':_0x316097[_0x3a98('0xa2')]||![],'whatsappPause':_0x316097['loginInPause']||![],'pauseType':_0x316097[_0x3a98('0xa2')]?_0x3a98('0xff'):null,'interface':_0x5b0d84,'lastPauseAt':moment()[_0x3a98('0xee')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x3a98('0x1b')](function(_0xe5ce78){if(_0x138ff9[_0x3a98('0x100')]){return _0x307c07();}else{return BPromise[_0x3a98('0x101')](_0xe5ce78)['then'](respondWithResult(_0x213227,null));}})['catch'](handleError(_0x213227,null));};exports[_0x3a98('0x102')]=function(_0x3a4dab,_0x2e4259){var _0x144542;return db[_0x3a98('0x42')]['find']({'where':{'id':_0x3a4dab['params']['id'],'role':_0x3a98('0x37')},'attributes':['id',_0x3a98('0x3f'),_0x3a98('0x35')]})[_0x3a98('0x1b')](handleEntityNotFound(_0x2e4259,null))[_0x3a98('0x1b')](function(_0x585df5){if(_0x585df5){_0x144542=_0x585df5;return db[_0x3a98('0xb2')][_0x3a98('0x33')]({'where':{'membername':_0x144542[_0x3a98('0x3f')]},'individualHooks':!![]});}})['then'](function(){return db[_0x3a98('0xf9')][_0x3a98('0x92')]({'where':{'membername':_0x144542[_0x3a98('0x3f')],'exitAt':null}});})[_0x3a98('0x1b')](function(_0x1ce742){var _0x548daa=[];_0x1ce742[_0x3a98('0xfc')](function(_0x302e3d){_0x548daa[_0x3a98('0x4b')](_0x302e3d['update']({'exitAt':moment()[_0x3a98('0xee')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x3a98('0x53')](_0x548daa);})[_0x3a98('0x1b')](function(){return _0x144542[_0x3a98('0x31')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3a98('0x1b')](respondWithResult(_0x2e4259,null))[_0x3a98('0x26')](handleError(_0x2e4259,null));};exports[_0x3a98('0x103')]=function(_0x1fa277,_0x46ba61){var _0x2b79a2;return db[_0x3a98('0xb2')][_0x3a98('0x31')]({'paused':0x1},{'where':{'UserId':_0x1fa277[_0x3a98('0x54')]['id']},'individualHooks':!![]})[_0x3a98('0x1b')](function(){return db['User'][_0x3a98('0x60')]({'where':{'id':_0x1fa277[_0x3a98('0x54')]['id'],'role':_0x3a98('0x37')},'attributes':['id',_0x3a98('0x3f'),_0x3a98('0x35'),'internal',_0x3a98('0xa4')]});})[_0x3a98('0x1b')](handleEntityNotFound(_0x46ba61,null))[_0x3a98('0x1b')](function(_0x1e269b){if(_0x1e269b){_0x2b79a2=_0x1e269b;return respondWithRpcPromise(_0x3a98('0x104'),_0x3a98('0x103'),{'id':_0x2b79a2['id'],'name':_0x2b79a2[_0x3a98('0x3f')],'pause':!![]});}})[_0x3a98('0x1b')](function(){if(_0x2b79a2){return db['MemberReport'][_0x3a98('0x92')]({'where':{'membername':_0x2b79a2[_0x3a98('0x3f')],'type':_0x3a98('0xfe'),'exitAt':null}});}})['then'](function(_0x158b22){if(_0x158b22[_0x3a98('0x4e')]){var _0x382859=moment()[_0x3a98('0xee')](_0x3a98('0xfb'));for(var _0x462198=0x0,_0x1e2990=_0x158b22[_0x3a98('0x4e')];_0x462198<_0x1e2990;_0x462198++){_0x158b22[_0x462198][_0x3a98('0x105')]({'exitAt':_0x382859});}}})[_0x3a98('0x1b')](function(){var _0x3ace07=[];var _0x4969fa=utils[_0x3a98('0xfa')]();_0x4969fa[_0x3a98('0xfc')](function(_0x2fce02){_0x3ace07[_0x3a98('0x4b')]({'channel':_0x2fce02,'membername':_0x2b79a2[_0x3a98('0x3f')],'interface':_[_0x3a98('0x6d')](_0x2b79a2['interface'])?util[_0x3a98('0xee')](_0x3a98('0xaf'),_0x2b79a2['name']):_0x2b79a2[_0x3a98('0xa4')],'type':_0x3a98('0xfe'),'enterAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb')),'data1':_0x1fa277[_0x3a98('0x63')][_0x3a98('0x45')]||'DEFAULT\x20PAUSE','role':_0x2b79a2[_0x3a98('0x35')],'internal':_0x2b79a2['internal']});});return db[_0x3a98('0xf9')][_0x3a98('0x8f')](_0x3ace07,{'individualHooks':!![]});})['then'](function(){return _0x2b79a2[_0x3a98('0x31')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1fa277[_0x3a98('0x63')][_0x3a98('0x45')]||_0x3a98('0x106'),'lastPauseAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb'))});})['then'](respondWithResult(_0x46ba61,null))['catch'](handleError(_0x46ba61,null));};exports['unpause']=function(_0x41b507,_0x3f77a7){var _0xa258fd;return db[_0x3a98('0x42')][_0x3a98('0x60')]({'where':{'id':_0x41b507[_0x3a98('0x54')]['id']},'attributes':['id',_0x3a98('0x3f'),_0x3a98('0x35'),'voicePause',_0x3a98('0x107'),_0x3a98('0x108'),_0x3a98('0x109'),_0x3a98('0x10a'),_0x3a98('0x10b'),_0x3a98('0x10c'),'pauseType',_0x3a98('0x10d')]})['then'](handleEntityNotFound(_0x3f77a7,null))[_0x3a98('0x1b')](function(_0x42514e){if(_0x42514e){_0xa258fd=_0x42514e;if(_0x41b507[_0x3a98('0x63')][_0x3a98('0xb4')]&&!utils[_0x3a98('0xa5')](_0x41b507['body'][_0x3a98('0xb4')])){throw new db[(_0x3a98('0x97'))]['ValidationError'](_0x3a98('0xa6'));}switch(_0x41b507[_0x3a98('0x63')][_0x3a98('0xb4')]){case _0x3a98('0x10e'):return respondWithRpcPromise('QueuePause',_0x3a98('0x10f'),{'id':_0xa258fd['id'],'name':_0xa258fd['name'],'pause':![]})[_0x3a98('0x1b')](function(){return db[_0x3a98('0xb2')][_0x3a98('0x31')]({'paused':0x0},{'where':{'UserId':_0xa258fd['id']},'individualHooks':!![]});})[_0x3a98('0x1b')](function(){return db['MemberReport']['find']({'where':{'channel':_0x41b507['body'][_0x3a98('0xb4')],'membername':_0xa258fd[_0x3a98('0x3f')],'type':_0x3a98('0xfe'),'exitAt':null}});})[_0x3a98('0x1b')](function(_0x5d9439){if(_0x5d9439){return _0x5d9439[_0x3a98('0x31')]({'exitAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x3a98('0x1b')](function(){return _0xa258fd['update']({'voicePause':![]});});case _0x3a98('0xc1'):case'chat':case _0x3a98('0x50'):case _0x3a98('0x61'):case _0x3a98('0x62'):case _0x3a98('0x52'):return db[_0x3a98('0xf9')]['find']({'where':{'channel':_0x41b507[_0x3a98('0x63')][_0x3a98('0xb4')],'membername':_0xa258fd[_0x3a98('0x3f')],'type':'PAUSE','exitAt':null}})[_0x3a98('0x1b')](function(_0x86998a){if(_0x86998a){return _0x86998a[_0x3a98('0x31')]({'exitAt':moment()['format'](_0x3a98('0xfb')),'data2':_0x3a98('0x110')},{'individualHooks':!![]});}return null;})[_0x3a98('0x1b')](function(){var _0x19f9cc={};_[_0x3a98('0x2f')](_0x19f9cc,util[_0x3a98('0xee')](_0x3a98('0x111'),_0x41b507['body'][_0x3a98('0xb4')],_0x3a98('0x112')),![]);return _0xa258fd[_0x3a98('0x31')](_0x19f9cc);});default:return respondWithRpcPromise(_0x3a98('0x104'),_0x3a98('0x10f'),{'id':_0xa258fd['id'],'name':_0xa258fd[_0x3a98('0x3f')],'pause':![]})[_0x3a98('0x1b')](function(){return db[_0x3a98('0xb2')]['update']({'paused':0x0},{'where':{'UserId':_0xa258fd['id']}});})[_0x3a98('0x1b')](function(){return db[_0x3a98('0xf9')][_0x3a98('0x92')]({'where':{'membername':_0xa258fd[_0x3a98('0x3f')],'type':_0x3a98('0xfe'),'exitAt':null}});})['then'](function(_0x4b7abe){var _0x2b5dc5=[];_0x4b7abe[_0x3a98('0xfc')](function(_0x50d766){_0x2b5dc5[_0x3a98('0x4b')](_0x50d766['update']({'exitAt':moment()[_0x3a98('0xee')](_0x3a98('0xfb')),'data2':'manual'}));});return BPromise[_0x3a98('0x53')](_0x2b5dc5);})[_0x3a98('0x1b')](function(){return _0xa258fd['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x3f77a7,null))[_0x3a98('0x26')](handleError(_0x3f77a7,null));};exports['getTeams']=function(_0x4d5889,_0x2fca1d){var _0x52694a={};var _0x2f931b={};var _0xd6cfca;var _0x5a320d;return db[_0x3a98('0x42')][_0x3a98('0x9c')]({'where':{'id':_0x4d5889[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x2fca1d,null))[_0x3a98('0x1b')](function(_0x1e275c){if(_0x1e275c){_0xd6cfca=_0x1e275c;_0x2f931b['model']=_[_0x3a98('0x55')](db[_0x3a98('0x113')]['rawAttributes']);_0x2f931b[_0x3a98('0x47')]=_['keys'](_0x4d5889['query']);_0x2f931b[_0x3a98('0x57')]=_[_0x3a98('0x58')](_0x2f931b[_0x3a98('0x59')],_0x2f931b[_0x3a98('0x47')]);_0x52694a['attributes']=_[_0x3a98('0x58')](_0x2f931b[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x4d5889[_0x3a98('0x47')]['fields']));_0x52694a['attributes']=_0x52694a['attributes'][_0x3a98('0x4e')]?_0x52694a[_0x3a98('0x4a')]:_0x2f931b['model'];_0x52694a[_0x3a98('0xd7')]=qs['sort'](_0x4d5889['query'][_0x3a98('0xce')]);_0x52694a[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x4d5889['query'],_0x2f931b[_0x3a98('0x57')]));if(_0x4d5889[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x52694a[_0x3a98('0xcf')]=_[_0x3a98('0x5e')](_0x52694a[_0x3a98('0xcf')],{'$or':_['map'](_0x52694a[_0x3a98('0x4a')],function(_0x59be67){var _0x27e169={};_0x27e169[_0x59be67]={'$like':'%'+_0x4d5889['query'][_0x3a98('0x3a')]+'%'};return _0x27e169;})});}_0x52694a=_['merge']({},_0x52694a,_0x4d5889['options']);return _0xd6cfca['getTeams'](_0x52694a);}})['then'](function(_0x39b923){if(_0x39b923){_0x5a320d=_0x39b923[_0x3a98('0x4e')];if(!_0x4d5889[_0x3a98('0x47')][_0x3a98('0xd2')](_0x3a98('0xd3'))){_0x52694a[_0x3a98('0x2e')]=qs[_0x3a98('0x2e')](_0x4d5889['query']['limit']);_0x52694a[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x4d5889[_0x3a98('0x47')]['offset']);}return _0xd6cfca[_0x3a98('0x114')](_0x52694a);}})[_0x3a98('0x1b')](function(_0x22c79f){if(_0x22c79f){return _0x22c79f?{'count':_0x5a320d,'rows':_0x22c79f}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x2fca1d,null))[_0x3a98('0x26')](handleError(_0x2fca1d,null));};exports[_0x3a98('0x115')]=function(_0x14a01a,_0x3913b1){var _0x530226=_0x14a01a[_0x3a98('0x54')]['id'];var _0x4a6018=_0x14a01a[_0x3a98('0x63')]?_0x14a01a[_0x3a98('0x63')]['ids']:null;var _0x52c827=[];return Promise[_0x3a98('0x101')]()[_0x3a98('0x1b')](function(){if(!_0x4a6018)throw new APIBadRequestError(_0x3a98('0x116'));})[_0x3a98('0x1b')](function(){return db['User'][_0x3a98('0x9c')]({'where':{'id':_0x530226}});})[_0x3a98('0x1b')](function(_0x8421bc){if(!_0x8421bc)throw new APINotFoundError(util[_0x3a98('0xee')](_0x3a98('0x117'),_0x14a01a['params']['id']));return db['sequelize'][_0x3a98('0x118')](function(_0x1d4795){return _0x8421bc['addTeams'](_0x4a6018,{'transaction':_0x1d4795})[_0x3a98('0x1b')](function(){return db[_0x3a98('0x113')]['findAll']({'where':{'id':{'$in':_0x4a6018}}});})[_0x3a98('0x1b')](function(_0x2575fa){var _0x5b366c=_[_0x3a98('0x3c')](_0x2575fa,function(_0x3bd79f){return _0x3bd79f[_0x3a98('0x119')]();});return Promise[_0x3a98('0x53')](_0x5b366c);})['then'](function(_0xddb5cb){_0x52c827=_[_0x3a98('0x11a')](_0xddb5cb);var _0x529d69=_[_0x3a98('0x3c')](_0x52c827,function(_0x364738){return _0x364738[_0x3a98('0x11b')](_0x8421bc['id'],{'transaction':_0x1d4795});});return Promise['all'](_0x529d69);})['then'](function(){if(!_0x8421bc['online'])return;var _0x5d0185=_[_0x3a98('0x3a')](_0x52c827,function(_0x42b9d7){return _0x42b9d7[_0x3a98('0x11c')](_0x3a98('0xb4'))===_0x3a98('0x11d');});var _0x320d9a=_[_0x3a98('0x3c')](_0x5d0185,function(_0x2a937f){return db[_0x3a98('0xb2')]['upsert']({'membername':_0x8421bc[_0x3a98('0x3f')],'UserId':_0x8421bc['id'],'queue_name':_0x2a937f[_0x3a98('0x3f')],'VoiceQueueId':_0x2a937f['id'],'interface':_['isNil'](_0x8421bc[_0x3a98('0xa4')])?util[_0x3a98('0xee')](_0x3a98('0xaf'),_0x8421bc[_0x3a98('0x3f')]):_0x8421bc[_0x3a98('0xa4')],'paused':_0x8421bc[_0x3a98('0xa3')]||![],'penalty':_0x8421bc[_0x3a98('0xb0')]},{'transaction':_0x1d4795});});return Promise[_0x3a98('0x53')](_0x320d9a);})['then'](function(){return db[_0x3a98('0x11e')][_0x3a98('0x92')]({'where':{'teamId':{'$in':_0x4a6018}}});})[_0x3a98('0x1b')](function(_0x2b6bd0){var _0x5b21e3=_[_0x3a98('0x3c')](_0x2b6bd0,function(_0x51dca4){return db[_0x3a98('0x11f')][_0x3a98('0x8e')]({'UserId':_0x8421bc['id'],'VoicePrefixId':_0x51dca4[_0x3a98('0x120')]},{'transaction':_0x1d4795});});return Promise[_0x3a98('0x53')](_0x5b21e3);});});})[_0x3a98('0x1b')](function(){for(var _0x104221=0x0;_0x104221<_0x52c827[_0x3a98('0x4e')];_0x104221++){var _0x3b1e6a=_0x52c827[_0x104221][_0x3a98('0x11c')](_0x3a98('0xb4'));var _0x391e18=_0x3b1e6a+'QueueId';socket[_0x3a98('0x32')](_0x3a98('0x84')+_0x3b1e6a+_0x3a98('0xad'),{'UserId':_0x530226,['queueField']:_0x52c827[_0x104221]['id']});}})[_0x3a98('0x1b')](respondWithStatusCode(_0x3913b1,null))[_0x3a98('0x26')](APIHandleError(_0x3913b1));};exports[_0x3a98('0x121')]=function(_0x135f0f,_0x256c7a){var _0x19566c=_0x135f0f['params']['id'];var _0x1ae57c=null;if(_0x135f0f[_0x3a98('0x47')]['ids']){_0x1ae57c=_[_0x3a98('0x122')](_0x135f0f[_0x3a98('0x47')][_0x3a98('0x66')])?_0x135f0f[_0x3a98('0x47')]['ids']:[_0x135f0f[_0x3a98('0x47')][_0x3a98('0x66')]];}var _0x2f479e=[];return Promise[_0x3a98('0x101')]()[_0x3a98('0x1b')](function(){if(!_0x1ae57c)throw new APIBadRequestError(_0x3a98('0x123'));})[_0x3a98('0x1b')](function(){return db[_0x3a98('0x42')]['findOne']({'where':{'id':_0x19566c}});})[_0x3a98('0x1b')](function(_0xc63a8e){if(!_0xc63a8e)throw new APINotFoundError(util[_0x3a98('0xee')](_0x3a98('0x117'),_0x135f0f[_0x3a98('0x54')]['id']));return db['sequelize'][_0x3a98('0x118')](function(_0xef2668){return _0xc63a8e[_0x3a98('0x121')](_0x1ae57c,{'transaction':_0xef2668})['then'](function(){return db[_0x3a98('0x113')][_0x3a98('0x92')]({'where':{'id':{'$in':_0x1ae57c}}});})[_0x3a98('0x1b')](function(_0x9bbe7c){var _0x2c90d0=_[_0x3a98('0x3c')](_0x9bbe7c,function(_0x3d71d9){return _0x3d71d9[_0x3a98('0x119')]();});return Promise[_0x3a98('0x53')](_0x2c90d0);})[_0x3a98('0x1b')](function(_0x4e4e1e){_0x2f479e=_[_0x3a98('0x11a')](_0x4e4e1e);var _0xad810d=_[_0x3a98('0x3c')](_0x2f479e,function(_0x36d771){return _0x36d771[_0x3a98('0x124')](_0xc63a8e['id'],{'transaction':_0xef2668});});return Promise[_0x3a98('0x53')](_0xad810d);})[_0x3a98('0x1b')](function(){if(!_0xc63a8e[_0x3a98('0xa1')])return;var _0x33fe6d=_[_0x3a98('0x3a')](_0x2f479e,function(_0x342570){return _0x342570[_0x3a98('0x11c')](_0x3a98('0xb4'))===_0x3a98('0x11d');});var _0x15548c=_[_0x3a98('0x3c')](_0x33fe6d,function(_0x295cce){return db[_0x3a98('0xb2')][_0x3a98('0x33')]({'where':{'VoiceQueueId':_0x295cce['id'],'UserId':_0xc63a8e['id']},'transaction':_0xef2668});});return Promise[_0x3a98('0x53')](_0x15548c);})[_0x3a98('0x1b')](function(){return db[_0x3a98('0x11e')][_0x3a98('0x92')]({'where':{'teamId':{'$in':_0x1ae57c}}});})['then'](function(_0x1142b5){var _0x4bf8fc=_[_0x3a98('0x3c')](_0x1142b5,function(_0x31e2bd){return db[_0x3a98('0x11f')][_0x3a98('0x33')]({'where':{'UserId':_0xc63a8e['id'],'VoicePrefixId':_0x31e2bd['VoicePrefixId']}},{'transaction':_0xef2668});});return Promise['all'](_0x4bf8fc);});});})[_0x3a98('0x1b')](function(){for(var _0x5d94f3=0x0;_0x5d94f3<_0x2f479e[_0x3a98('0x4e')];_0x5d94f3++){var _0xbcf155=_0x2f479e[_0x5d94f3][_0x3a98('0x11c')]('channel');var _0x3bbfec=_0xbcf155+_0x3a98('0xab');socket[_0x3a98('0x32')](_0x3a98('0x84')+_0xbcf155+_0x3a98('0xb6'),{'UserId':_0x19566c,['queueField']:_0x2f479e[_0x5d94f3]['id']});}})['then'](respondWithStatusCode(_0x256c7a,null))[_0x3a98('0x26')](APIHandleError(_0x256c7a));};exports[_0x3a98('0x125')]=function(_0x3c8b12,_0x458ad8){var _0x5037f5={};var _0x38f4fe={};var _0x28a238;var _0x599fbd;return db[_0x3a98('0x42')]['findOne']({'where':{'id':_0x3c8b12['params']['id']}})['then'](handleEntityNotFound(_0x458ad8,null))[_0x3a98('0x1b')](function(_0x3c7573){if(_0x3c7573){_0x28a238=_0x3c7573;_0x38f4fe[_0x3a98('0x59')]=_[_0x3a98('0x55')](db[_0x3a98('0x126')][_0x3a98('0x43')]);_0x38f4fe[_0x3a98('0x47')]=_[_0x3a98('0x55')](_0x3c8b12[_0x3a98('0x47')]);_0x38f4fe[_0x3a98('0x57')]=_['intersection'](_0x38f4fe['model'],_0x38f4fe[_0x3a98('0x47')]);_0x5037f5[_0x3a98('0x4a')]=_['intersection'](_0x38f4fe[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x3c8b12[_0x3a98('0x47')][_0x3a98('0x5a')]));_0x5037f5[_0x3a98('0x4a')]=_0x5037f5[_0x3a98('0x4a')]['length']?_0x5037f5[_0x3a98('0x4a')]:_0x38f4fe[_0x3a98('0x59')];_0x5037f5[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x3c8b12[_0x3a98('0x47')][_0x3a98('0xce')]);_0x5037f5[_0x3a98('0xcf')]=qs['filters'](_[_0x3a98('0xd8')](_0x3c8b12[_0x3a98('0x47')],_0x38f4fe[_0x3a98('0x57')]));if(_0x3c8b12[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x5037f5[_0x3a98('0xcf')]=_['merge'](_0x5037f5[_0x3a98('0xcf')],{'$or':_[_0x3a98('0x3c')](_0x5037f5[_0x3a98('0x4a')],function(_0x5d57fd){var _0xe5bf76={};_0xe5bf76[_0x5d57fd]={'$like':'%'+_0x3c8b12[_0x3a98('0x47')][_0x3a98('0x3a')]+'%'};return _0xe5bf76;})});}_0x5037f5=_['merge']({},_0x5037f5,_0x3c8b12['options']);return _0x28a238['getLists'](_0x5037f5);}})[_0x3a98('0x1b')](function(_0x5c8584){if(_0x5c8584){_0x599fbd=_0x5c8584[_0x3a98('0x4e')];if(!_0x3c8b12[_0x3a98('0x47')]['hasOwnProperty'](_0x3a98('0xd3'))){_0x5037f5['limit']=qs['limit'](_0x3c8b12[_0x3a98('0x47')][_0x3a98('0x2e')]);_0x5037f5[_0x3a98('0x2b')]=qs[_0x3a98('0x2b')](_0x3c8b12[_0x3a98('0x47')]['offset']);}return _0x28a238[_0x3a98('0x125')](_0x5037f5);}})['then'](function(_0x44c1b4){if(_0x44c1b4){return _0x44c1b4?{'count':_0x599fbd,'rows':_0x44c1b4}:null;}})[_0x3a98('0x1b')](respondWithResult(_0x458ad8,null))[_0x3a98('0x26')](handleError(_0x458ad8,null));};exports[_0x3a98('0x127')]=function(_0x526a51,_0x208a87){var _0x3551f8={};var _0x340863={};var _0x2f6d3b;return db['User'][_0x3a98('0x9c')]({'where':{'id':_0x526a51[_0x3a98('0x54')]['id']}})[_0x3a98('0x1b')](handleEntityNotFound(_0x208a87,null))[_0x3a98('0x1b')](function(_0x5e5aac){if(_0x5e5aac){_0x2f6d3b=_0x5e5aac;_0x340863[_0x3a98('0x59')]=_['keys'](db[_0x3a98('0x42')][_0x3a98('0x43')]);_0x340863[_0x3a98('0x47')]=_['keys'](_0x526a51['query']);_0x340863['filters']=_[_0x3a98('0x58')](_0x340863['model'],_0x340863[_0x3a98('0x47')]);_0x3551f8[_0x3a98('0x4a')]=_['intersection'](_0x340863[_0x3a98('0x59')],qs[_0x3a98('0x5a')](_0x526a51['query'][_0x3a98('0x5a')]));_0x3551f8['attributes']=_0x3551f8['attributes'][_0x3a98('0x4e')]?_0x3551f8[_0x3a98('0x4a')]:_0x340863[_0x3a98('0x59')];_0x3551f8[_0x3a98('0xd7')]=qs[_0x3a98('0xce')](_0x526a51[_0x3a98('0x47')][_0x3a98('0xce')]);_0x3551f8[_0x3a98('0xcf')]=qs[_0x3a98('0x57')](_[_0x3a98('0xd8')](_0x526a51[_0x3a98('0x47')],_0x340863[_0x3a98('0x57')]));if(_0x526a51[_0x3a98('0x47')][_0x3a98('0x3a')]){_0x3551f8[_0x3a98('0xcf')]=_['merge'](_0x3551f8['where'],{'$or':_['map'](_0x3551f8['attributes'],function(_0x4382dc){var _0x1d5f27={};_0x1d5f27[_0x4382dc]={'$like':'%'+_0x526a51[_0x3a98('0x47')]['filter']+'%'};return _0x1d5f27;})});}_0x3551f8['model']=db[_0x3a98('0x42')];_0x3551f8['as']=_0x3a98('0x8c');_0x3551f8=_[_0x3a98('0x5e')]({},_0x3551f8,_0x526a51[_0x3a98('0x5f')]);return _0x2f6d3b[_0x3a98('0xf7')]({'include':[_0x3551f8]});}})[_0x3a98('0x1b')](function(_0x134065){if(_0x134065){var _0x40147f={},_0x2a8388=[];for(var _0x3fc61f=0x0;_0x3fc61f<_0x134065[_0x3a98('0x4e')];_0x3fc61f+=0x1){for(var _0x37080c=0x0,_0x2a9fc0;_0x37080c<_0x134065[_0x3fc61f][_0x3a98('0x8c')][_0x3a98('0x4e')];_0x37080c+=0x1){_0x2a9fc0=_0x134065[_0x3fc61f][_0x3a98('0x8c')][_0x37080c]['get']({'plain':!![]});_0x40147f[_0x2a9fc0['id']]=_0x2a9fc0;}}_0x40147f=_[_0x3a98('0x128')](_0x40147f);for(var _0x1995b4=qs[_0x3a98('0x2b')](_0x526a51[_0x3a98('0x47')][_0x3a98('0x2b')]);_0x1995b4<_0x40147f[_0x3a98('0x4e')]&&_0x2a8388['length']=_0x46ece6['agents']){throw new Error(_0xfe60('0x50'));}})[_0xfe60('0x10')](function(){if(_0x4e9b00){return db[_0xfe60('0x2e')][_0xfe60('0x51')]({'where':{'membername':_0x4e9b00['name']},'individualHooks':!![]});}})[_0xfe60('0x10')](function(){if(_0x4e9b00){return _0x4e9b00[_0xfe60('0x52')]({'raw':!![]});}})[_0xfe60('0x10')](function(_0x59554f){if(_0x4e9b00){if(_0x59554f){var _0x34da7d=[];_0x501b15=_0x59554f;if(_0x501b15[_0xfe60('0x53')]){for(var _0x3ca7ac=0x0;_0x3ca7ac<_0x501b15[_0xfe60('0x53')];_0x3ca7ac++){_0x34da7d[_0xfe60('0x35')](db[_0xfe60('0x2e')][_0xfe60('0x54')]({'membername':_0x4e9b00[_0xfe60('0x2a')],'UserId':_0x4e9b00['id'],'queue_name':_0x501b15[_0x3ca7ac]['name'],'VoiceQueueId':_0x501b15[_0x3ca7ac]['id'],'interface':_0xcde4da,'paused':_0x4e9b00['loginInPause']||![],'penalty':_0x501b15[_0x3ca7ac][_0xfe60('0x55')]||0x0}));}return BPromise[_0xfe60('0x49')](_0x34da7d);}}}})[_0xfe60('0x10')](function(){if(_0x4e9b00){return db['MemberReport'][_0xfe60('0x1c')]({'where':{'membername':_0x4e9b00['name'],'exitAt':null}});}})[_0xfe60('0x10')](function(_0x281545){if(_0x4e9b00){if(_0x281545&&_0x281545[_0xfe60('0x53')]){var _0x226380=[];_0x281545['forEach'](function(_0x5c9271){_0x226380['push'](_0x5c9271[_0xfe60('0x2f')]({'exitAt':moment()[_0xfe60('0x37')](_0xfe60('0x32'))}));});return BPromise[_0xfe60('0x49')](_0x226380);}}})[_0xfe60('0x10')](function(_0x261d70){if(_0x4e9b00){var _0x266125=[];var _0x38d0fc=[];var _0x4cf857=utils[_0xfe60('0x33')]();var _0x4f4003={'membername':_0x4e9b00[_0xfe60('0x2a')],'interface':_0xcde4da,'enterAt':moment()['format'](_0xfe60('0x32')),'role':_0x4e9b00[_0xfe60('0x2b')],'internal':_0x4e9b00[_0xfe60('0x2c')]};_0x4cf857['forEach'](function(_0x5850a0){_0x266125[_0xfe60('0x35')](_['merge']({'channel':_0x5850a0,'type':_0xfe60('0x56'),'data1':'callysquare','data2':_0xcde4da},_0x4f4003));if(_0x4e9b00[_0xfe60('0x57')]){_0x38d0fc['push'](_['merge']({'channel':_0x5850a0,'type':_0xfe60('0x31'),'data1':_0xfe60('0x58')},_0x4f4003));}});return db[_0xfe60('0x30')][_0xfe60('0x3c')](_0x266125[_0xfe60('0x59')](_0x38d0fc),{'individualHooks':!![]});}})[_0xfe60('0x10')](function(){if(_0x4e9b00){return _0x4e9b00['update']({'online':!![],'lastLoginAt':moment()['format'](_0xfe60('0x32')),'voicePause':_0x4e9b00['loginInPause']||![],'mailPause':_0x4e9b00[_0xfe60('0x57')]||![],'chatPause':_0x4e9b00[_0xfe60('0x57')]||![],'faxPause':_0x4e9b00[_0xfe60('0x57')]||![],'smsPause':_0x4e9b00[_0xfe60('0x57')]||![],'openchannelPause':_0x4e9b00['loginInPause']||![],'pauseType':_0x4e9b00['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xfe60('0x37')](_0xfe60('0x32')),'interface':_0xcde4da});}})[_0xfe60('0x10')](function(_0x5102e4){_0x2a592c(_0x5102e4);})[_0xfe60('0x1a')](function(_0x4c3751){_0x35d6a3(_0x2f4e07[_0xfe60('0x16')](0x1f4,_0x4c3751[_0xfe60('0x18')]));});});}; \ No newline at end of file +var _0x3b17=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetUser','User','findAll','options','attributes','limit','include','map','model','raw','where','ShowUser','PauseUser','find','name','internal','interface','UserVoiceQueueRt','update','length','updateAttributes','forEach','push','SIP/%s','format','body','type','DEFAULT\x20PAUSE','role','MemberReport','bulkCreate','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','PAUSE','system','mail','chat','fax','sms','openchannel','set','%s%s','destroy','YYYY-MM-DD\x20HH:mm:ss','all','LoginUser','findOne','phone','loginInPause','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','bluebird'];(function(_0x1a288,_0x5eb9c7){var _0x4e53d4=function(_0x5d1d9b){while(--_0x5d1d9b){_0x1a288['push'](_0x1a288['shift']());}};_0x4e53d4(++_0x5eb9c7);}(_0x3b17,0x1bb));var _0x73b1=function(_0x2416bf,_0x5de948){_0x2416bf=_0x2416bf-0x0;var _0x2bde97=_0x3b17[_0x2416bf];return _0x2bde97;};'use strict';var _=require(_0x73b1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x73b1('0x1'));var rs=require(_0x73b1('0x2'));var fs=require('fs');var Redis=require(_0x73b1('0x3'));var db=require(_0x73b1('0x4'))['db'];var utils=require(_0x73b1('0x5'));var logger=require(_0x73b1('0x6'))(_0x73b1('0x7'));var config=require(_0x73b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x73b1('0x9')]['http']({'port':0x232a});config[_0x73b1('0xa')]=_[_0x73b1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x73b1('0xc'))(new Redis(config[_0x73b1('0xa')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x4e6d49,_0x525c61,_0x2569c3){return new BPromise(function(_0x1aeb74,_0x110867){return client[_0x73b1('0xd')](_0x4e6d49,_0x2569c3)[_0x73b1('0xe')](function(_0x28998b){logger['info'](_0x73b1('0xf'),_0x525c61,_0x73b1('0x10'));logger[_0x73b1('0x11')]('User,\x20%s,\x20%s,\x20%s',_0x525c61,_0x73b1('0x10'),JSON[_0x73b1('0x12')](_0x28998b));if(_0x28998b['error']){if(_0x28998b[_0x73b1('0x13')][_0x73b1('0x14')]===0x1f4){logger[_0x73b1('0x13')](_0x73b1('0xf'),_0x525c61,_0x28998b[_0x73b1('0x13')][_0x73b1('0x15')]);return _0x110867(_0x28998b[_0x73b1('0x13')]['message']);}logger['error'](_0x73b1('0xf'),_0x525c61,_0x28998b[_0x73b1('0x13')][_0x73b1('0x15')]);return _0x1aeb74(_0x28998b[_0x73b1('0x13')][_0x73b1('0x15')]);}else{logger[_0x73b1('0x16')](_0x73b1('0xf'),_0x525c61,'request\x20sent');_0x1aeb74(_0x28998b[_0x73b1('0x17')][_0x73b1('0x15')]);}})[_0x73b1('0x18')](function(_0x52539c){logger[_0x73b1('0x13')](_0x73b1('0xf'),_0x525c61,_0x52539c);_0x110867(_0x52539c);});});}exports[_0x73b1('0x19')]=function(_0x14a13e){var _0xcbd257=this;return new Promise(function(_0xbc49c6,_0x55c6ff){return db[_0x73b1('0x1a')][_0x73b1('0x1b')]({'raw':_0x14a13e[_0x73b1('0x1c')]?_0x14a13e['options']['raw']===undefined?!![]:![]:!![],'where':_0x14a13e['options']?_0x14a13e[_0x73b1('0x1c')]['where']||null:null,'attributes':_0x14a13e[_0x73b1('0x1c')]?_0x14a13e[_0x73b1('0x1c')][_0x73b1('0x1d')]||null:null,'limit':_0x14a13e[_0x73b1('0x1c')]?_0x14a13e[_0x73b1('0x1c')][_0x73b1('0x1e')]||null:null,'include':_0x14a13e['options']?_0x14a13e['options'][_0x73b1('0x1f')]?_[_0x73b1('0x20')](_0x14a13e['options'][_0x73b1('0x1f')],function(_0x6d2595){return{'model':db[_0x6d2595[_0x73b1('0x21')]],'as':_0x6d2595['as'],'attributes':_0x6d2595[_0x73b1('0x1d')],'include':_0x6d2595[_0x73b1('0x1f')]?_[_0x73b1('0x20')](_0x6d2595['include'],function(_0x139169){return{'model':db[_0x139169[_0x73b1('0x21')]],'as':_0x139169['as'],'attributes':_0x139169[_0x73b1('0x1d')],'include':_0x139169[_0x73b1('0x1f')]?_[_0x73b1('0x20')](_0x139169[_0x73b1('0x1f')],function(_0x2fb534){return{'model':db[_0x2fb534[_0x73b1('0x21')]],'as':_0x2fb534['as'],'attributes':_0x2fb534[_0x73b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x73b1('0xe')](function(_0x2f0122){logger[_0x73b1('0x16')]('GetUser',_0x14a13e);logger['debug'](_0x73b1('0x19'),_0x14a13e,JSON[_0x73b1('0x12')](_0x2f0122));_0xbc49c6(_0x2f0122);})[_0x73b1('0x18')](function(_0x53c0b3){logger[_0x73b1('0x13')](_0x73b1('0x19'),_0x53c0b3['message'],_0x14a13e);_0x55c6ff(_0xcbd257['error'](0x1f4,_0x53c0b3['message']));});});};exports['ShowUser']=function(_0x48963e){var _0x1175aa=this;return new Promise(function(_0x539e38,_0x7f66d6){return db[_0x73b1('0x1a')]['find']({'raw':_0x48963e[_0x73b1('0x1c')]?_0x48963e['options'][_0x73b1('0x22')]===undefined?!![]:![]:!![],'where':_0x48963e[_0x73b1('0x1c')]?_0x48963e[_0x73b1('0x1c')][_0x73b1('0x23')]||null:null,'attributes':_0x48963e[_0x73b1('0x1c')]?_0x48963e[_0x73b1('0x1c')][_0x73b1('0x1d')]||null:null,'include':_0x48963e[_0x73b1('0x1c')]?_0x48963e[_0x73b1('0x1c')][_0x73b1('0x1f')]?_[_0x73b1('0x20')](_0x48963e[_0x73b1('0x1c')][_0x73b1('0x1f')],function(_0x49252b){return{'model':db[_0x49252b[_0x73b1('0x21')]],'as':_0x49252b['as'],'attributes':_0x49252b[_0x73b1('0x1d')],'include':_0x49252b[_0x73b1('0x1f')]?_[_0x73b1('0x20')](_0x49252b[_0x73b1('0x1f')],function(_0x3d61af){return{'model':db[_0x3d61af[_0x73b1('0x21')]],'as':_0x3d61af['as'],'attributes':_0x3d61af['attributes'],'include':_0x3d61af['include']?_[_0x73b1('0x20')](_0x3d61af[_0x73b1('0x1f')],function(_0x1a5337){return{'model':db[_0x1a5337[_0x73b1('0x21')]],'as':_0x1a5337['as'],'attributes':_0x1a5337[_0x73b1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x73b1('0xe')](function(_0x21dbb6){logger[_0x73b1('0x16')]('ShowUser',_0x48963e);logger['debug'](_0x73b1('0x24'),_0x48963e,JSON[_0x73b1('0x12')](_0x21dbb6));_0x539e38(_0x21dbb6);})[_0x73b1('0x18')](function(_0x18662a){logger[_0x73b1('0x13')]('ShowUser',_0x18662a['message'],_0x48963e);_0x7f66d6(_0x1175aa[_0x73b1('0x13')](0x1f4,_0x18662a[_0x73b1('0x15')]));});});};exports[_0x73b1('0x25')]=function(_0x5e15c9){var _0x34aad7=this;return new Promise(function(_0xef3965,_0x2acb61){var _0xc45690;return db[_0x73b1('0x1a')][_0x73b1('0x26')]({'where':_0x5e15c9[_0x73b1('0x1c')][_0x73b1('0x23')]||{},'attributes':['id',_0x73b1('0x27'),'role',_0x73b1('0x28'),_0x73b1('0x29')]})[_0x73b1('0xe')](function(_0x12e7e0){if(_0x12e7e0){_0xc45690=_0x12e7e0;return db[_0x73b1('0x2a')][_0x73b1('0x2b')]({'paused':0x1},{'where':{'UserId':_0xc45690['id']},'individualHooks':!![]});}})[_0x73b1('0xe')](function(){if(_0xc45690){return db['MemberReport'][_0x73b1('0x1b')]({'where':{'membername':_0xc45690[_0x73b1('0x27')],'type':'PAUSE','exitAt':null}});}})[_0x73b1('0xe')](function(_0x4658b2){if(_0xc45690){if(_0x4658b2&&_0x4658b2['length']){var _0x42e9c3=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4f750a=0x0,_0x4a2250=_0x4658b2[_0x73b1('0x2c')];_0x4f750a<_0x4a2250;_0x4f750a++){_0x4658b2[_0x4f750a][_0x73b1('0x2d')]({'exitAt':_0x42e9c3});}}}})[_0x73b1('0xe')](function(){if(_0xc45690){var _0x25c72d=[];var _0x597460=utils['getChannels']();_0x597460[_0x73b1('0x2e')](function(_0x330d0a){_0x25c72d[_0x73b1('0x2f')]({'channel':_0x330d0a,'membername':_0xc45690[_0x73b1('0x27')],'interface':_['isNil'](_0xc45690['interface'])?util['format'](_0x73b1('0x30'),_0xc45690[_0x73b1('0x27')]):_0xc45690[_0x73b1('0x29')],'type':'PAUSE','enterAt':moment()[_0x73b1('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x5e15c9[_0x73b1('0x32')][_0x73b1('0x33')]||_0x73b1('0x34'),'role':_0xc45690[_0x73b1('0x35')],'internal':_0xc45690[_0x73b1('0x28')],'uniqueid':_0x5e15c9[_0x73b1('0x32')]['uniqueid']||null});});return db[_0x73b1('0x36')][_0x73b1('0x37')](_0x25c72d,{'individualHooks':!![]});}})[_0x73b1('0xe')](function(){if(_0xc45690){return _0xc45690['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5e15c9['body']['type']||_0x73b1('0x34'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x4b4f28){_0xef3965(_0x4b4f28);})[_0x73b1('0x18')](function(_0x516116){_0x2acb61(_0x34aad7[_0x73b1('0x13')](0x1f4,_0x516116[_0x73b1('0x15')]));});});};exports[_0x73b1('0x38')]=function(_0x115ea7){var _0x542d86=this;return new Promise(function(_0x4b4ce6,_0x2d9ce8){var _0xdada28;return db[_0x73b1('0x1a')]['findOne']({'where':_0x115ea7['options'][_0x73b1('0x23')]||{},'attributes':['id','name']})[_0x73b1('0xe')](function(_0x32c84b){if(_0x32c84b){_0xdada28=_0x32c84b;if(_0x115ea7[_0x73b1('0x32')][_0x73b1('0x39')]&&!utils[_0x73b1('0x3a')](_0x115ea7['body'][_0x73b1('0x39')])){throw new Error(_0x73b1('0x3b'));}switch(_0x115ea7[_0x73b1('0x32')]['channel']){case _0x73b1('0x3c'):return db[_0x73b1('0x2a')][_0x73b1('0x2b')]({'paused':0x0},{'where':{'UserId':_0xdada28['id']}})[_0x73b1('0xe')](function(){return db[_0x73b1('0x36')][_0x73b1('0x26')]({'where':{'channel':_0x115ea7[_0x73b1('0x32')]['channel'],'membername':_0xdada28[_0x73b1('0x27')],'type':_0x73b1('0x3d'),'exitAt':null}});})[_0x73b1('0xe')](function(_0x470864){if(_0x470864){return _0x470864['update']({'exitAt':moment()[_0x73b1('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x73b1('0x3e')},{'individualHooks':!![]});}return null;})[_0x73b1('0xe')](function(){return _0xdada28['update']({'voicePause':![]});});case _0x73b1('0x3f'):case _0x73b1('0x40'):case _0x73b1('0x41'):case _0x73b1('0x42'):case _0x73b1('0x43'):case'whatsapp':return db[_0x73b1('0x36')][_0x73b1('0x26')]({'where':{'channel':_0x115ea7[_0x73b1('0x32')][_0x73b1('0x39')],'membername':_0xdada28[_0x73b1('0x27')],'type':_0x73b1('0x3d'),'exitAt':null}})['then'](function(_0xa32832){return _0xa32832[_0x73b1('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x73b1('0x3e')},{'individualHooks':!![]});})[_0x73b1('0xe')](function(){var _0x27ac27={};_[_0x73b1('0x44')](_0x27ac27,util[_0x73b1('0x31')](_0x73b1('0x45'),_0x115ea7[_0x73b1('0x32')][_0x73b1('0x39')],'Pause'),![]);return _0xdada28[_0x73b1('0x2b')](_0x27ac27);});default:return db[_0x73b1('0x2a')][_0x73b1('0x2b')]({'paused':0x0},{'where':{'UserId':_0xdada28['id']}})[_0x73b1('0xe')](function(){return db[_0x73b1('0x36')][_0x73b1('0x1b')]({'where':{'membername':_0xdada28['name'],'type':'PAUSE','exitAt':null}});})[_0x73b1('0xe')](function(_0x3604ba){var _0x2e4263=[];_0x3604ba[_0x73b1('0x2e')](function(_0x2c6e34){_0x2e4263[_0x73b1('0x2f')](_0x2c6e34[_0x73b1('0x2b')]({'exitAt':moment()[_0x73b1('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x73b1('0x3e')}));});return BPromise['all'](_0x2e4263);})[_0x73b1('0xe')](function(){return _0xdada28['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x73b1('0xe')](function(_0x4d32d1){_0x4b4ce6(_0x4d32d1);})[_0x73b1('0x18')](function(_0x1c8db6){_0x2d9ce8(_0x542d86['error'](0x1f4,_0x1c8db6[_0x73b1('0x15')]));});});};exports['LogoutUser']=function(_0x2c2ec0){var _0x4494dd=this;return new Promise(function(_0x3b4d57,_0xae6a64){var _0x27ebca;return db[_0x73b1('0x1a')]['findOne']({'where':_0x2c2ec0['options'][_0x73b1('0x23')]||{},'attributes':['id',_0x73b1('0x27')]})['then'](function(_0x277b6d){if(_0x277b6d){_0x27ebca=_0x277b6d;return db[_0x73b1('0x2a')][_0x73b1('0x46')]({'where':{'membername':_0x27ebca[_0x73b1('0x27')]},'individualHooks':!![]});}})[_0x73b1('0xe')](function(){if(_0x27ebca){return db[_0x73b1('0x36')][_0x73b1('0x1b')]({'where':{'membername':_0x27ebca[_0x73b1('0x27')],'exitAt':null}});}})[_0x73b1('0xe')](function(_0x3291f7){if(_0x27ebca){if(_0x3291f7&&_0x3291f7[_0x73b1('0x2c')]){var _0x57c529=[];_0x3291f7['forEach'](function(_0x489308){_0x57c529['push'](_0x489308['update']({'exitAt':moment()['format'](_0x73b1('0x47'))}));});return BPromise[_0x73b1('0x48')](_0x57c529);}}})[_0x73b1('0xe')](function(){if(_0x27ebca){return _0x27ebca[_0x73b1('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x915c0e){_0x3b4d57(_0x915c0e);})['catch'](function(_0x22a736){_0xae6a64(_0x4494dd[_0x73b1('0x13')](0x1f4,_0x22a736['message']));});});};exports[_0x73b1('0x49')]=function(_0x1b6b16){var _0x453be2=this;return new Promise(function(_0xbbfd0,_0x56c35a){var _0x3f954a;var _0x525918;var _0x1ec3a5;var _0x225bf0;return db[_0x73b1('0x1a')][_0x73b1('0x4a')]({'where':_0x1b6b16[_0x73b1('0x1c')][_0x73b1('0x23')]||{},'attributes':['id',_0x73b1('0x27'),'role','mobile',_0x73b1('0x4b'),_0x73b1('0x28'),_0x73b1('0x4c'),_0x73b1('0x29')]})[_0x73b1('0xe')](function(_0x4cc001){if(_0x4cc001){_0x3f954a=_0x4cc001;_0x225bf0=_0x1b6b16[_0x73b1('0x32')]['interface']?_0x1b6b16['body'][_0x73b1('0x29')]:util['format'](_0x73b1('0x30'),_0x3f954a[_0x73b1('0x27')]);return db[_0x73b1('0x1a')]['count']({'where':{'role':_0x73b1('0x4d'),'online':!![],'id':{'$ne':_0x3f954a['id']}}});}})[_0x73b1('0xe')](function(_0x385a9d){if(_0x385a9d){_0x1ec3a5=_0x385a9d;return require('../../config/license/util')[_0x73b1('0x4e')]();}})[_0x73b1('0xe')](function(_0x1555d8){if(_0x1555d8&&_0x1555d8[_0x73b1('0x4f')]&&_0x1ec3a5>=_0x1555d8[_0x73b1('0x4f')]){throw new Error(_0x73b1('0x50'));}})[_0x73b1('0xe')](function(){if(_0x3f954a){return db[_0x73b1('0x2a')][_0x73b1('0x46')]({'where':{'membername':_0x3f954a[_0x73b1('0x27')]},'individualHooks':!![]});}})[_0x73b1('0xe')](function(){if(_0x3f954a){return _0x3f954a['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5ecac3){if(_0x3f954a){if(_0x5ecac3){var _0x3f315a=[];_0x525918=_0x5ecac3;if(_0x525918[_0x73b1('0x2c')]){for(var _0x3c60a5=0x0;_0x3c60a5<_0x525918['length'];_0x3c60a5++){_0x3f315a[_0x73b1('0x2f')](db['UserVoiceQueueRt'][_0x73b1('0x51')]({'membername':_0x3f954a[_0x73b1('0x27')],'UserId':_0x3f954a['id'],'queue_name':_0x525918[_0x3c60a5]['name'],'VoiceQueueId':_0x525918[_0x3c60a5]['id'],'interface':_0x225bf0,'paused':_0x3f954a['loginInPause']||![],'penalty':_0x525918[_0x3c60a5][_0x73b1('0x52')]||0x0}));}return BPromise['all'](_0x3f315a);}}}})['then'](function(){if(_0x3f954a){return db[_0x73b1('0x36')][_0x73b1('0x1b')]({'where':{'membername':_0x3f954a['name'],'exitAt':null}});}})[_0x73b1('0xe')](function(_0x42865d){if(_0x3f954a){if(_0x42865d&&_0x42865d[_0x73b1('0x2c')]){var _0x30e898=[];_0x42865d[_0x73b1('0x2e')](function(_0x1dcc54){_0x30e898[_0x73b1('0x2f')](_0x1dcc54[_0x73b1('0x2b')]({'exitAt':moment()['format'](_0x73b1('0x47'))}));});return BPromise[_0x73b1('0x48')](_0x30e898);}}})['then'](function(_0x4a18c5){if(_0x3f954a){var _0x5d3e87=[];var _0x14f2d7=[];var _0x1ed4e3=utils[_0x73b1('0x53')]();var _0x55deed={'membername':_0x3f954a['name'],'interface':_0x225bf0,'enterAt':moment()[_0x73b1('0x31')](_0x73b1('0x47')),'role':_0x3f954a['role'],'internal':_0x3f954a['internal']};_0x1ed4e3['forEach'](function(_0x5134fb){_0x5d3e87[_0x73b1('0x2f')](_[_0x73b1('0x54')]({'channel':_0x5134fb,'type':_0x73b1('0x55'),'data1':_0x73b1('0x56'),'data2':_0x225bf0},_0x55deed));if(_0x3f954a['loginInPause']){_0x14f2d7['push'](_[_0x73b1('0x54')]({'channel':_0x5134fb,'type':_0x73b1('0x3d'),'data1':_0x73b1('0x57')},_0x55deed));}});return db['MemberReport'][_0x73b1('0x37')](_0x5d3e87[_0x73b1('0x58')](_0x14f2d7),{'individualHooks':!![]});}})[_0x73b1('0xe')](function(){if(_0x3f954a){return _0x3f954a['update']({'online':!![],'lastLoginAt':moment()['format'](_0x73b1('0x47')),'voicePause':_0x3f954a[_0x73b1('0x4c')]||![],'mailPause':_0x3f954a[_0x73b1('0x4c')]||![],'chatPause':_0x3f954a[_0x73b1('0x4c')]||![],'faxPause':_0x3f954a[_0x73b1('0x4c')]||![],'smsPause':_0x3f954a[_0x73b1('0x4c')]||![],'openchannelPause':_0x3f954a['loginInPause']||![],'pauseType':_0x3f954a['loginInPause']?_0x73b1('0x57'):null,'lastPauseAt':moment()[_0x73b1('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x225bf0});}})[_0x73b1('0xe')](function(_0x4e2466){_0xbbfd0(_0x4e2466);})[_0x73b1('0x18')](function(_0x406171){_0x56c35a(_0x453be2[_0x73b1('0x13')](0x1f4,_0x406171['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 41e021c..e438ebe 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 _0x08fa=['length','user:','./user.events','save','remove','update','removeListener','register'];(function(_0x4719b1,_0x4d3628){var _0x5cc325=function(_0x593a4d){while(--_0x593a4d){_0x4719b1['push'](_0x4719b1['shift']());}};_0x5cc325(++_0x4d3628);}(_0x08fa,0x162));var _0xa08f=function(_0x4a8060,_0x5f3dc0){_0x4a8060=_0x4a8060-0x0;var _0x2c5987=_0x08fa[_0x4a8060];return _0x2c5987;};'use strict';var UserEvents=require(_0xa08f('0x0'));var events=[_0xa08f('0x1'),_0xa08f('0x2'),_0xa08f('0x3')];function createListener(_0x15e4bf,_0x27ae29){return function(_0x36ad48){_0x27ae29['emit'](_0x15e4bf,_0x36ad48);};}function removeListener(_0x5ac16a,_0x5e606e){return function(){UserEvents[_0xa08f('0x4')](_0x5ac16a,_0x5e606e);};}exports[_0xa08f('0x5')]=function(_0x24958e){for(var _0x23da1c=0x0,_0x4817df=events[_0xa08f('0x6')];_0x23da1c<_0x4817df;_0x23da1c++){var _0x58bece=events[_0x23da1c];var _0x2549c4=createListener(_0xa08f('0x7')+_0x58bece,_0x24958e);UserEvents['on'](_0x58bece,_0x2549c4);}}; \ No newline at end of file +var _0x0c0f=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0x198e13,_0x1af848){var _0x5bd675=function(_0x92da64){while(--_0x92da64){_0x198e13['push'](_0x198e13['shift']());}};_0x5bd675(++_0x1af848);}(_0x0c0f,0xa2));var _0xf0c0=function(_0x5379a7,_0x47b15c){_0x5379a7=_0x5379a7-0x0;var _0x10c55e=_0x0c0f[_0x5379a7];return _0x10c55e;};'use strict';var UserEvents=require(_0xf0c0('0x0'));var events=[_0xf0c0('0x1'),_0xf0c0('0x2'),_0xf0c0('0x3')];function createListener(_0x52e474,_0x4cf45d){return function(_0x17427f){_0x4cf45d[_0xf0c0('0x4')](_0x52e474,_0x17427f);};}function removeListener(_0x41d164,_0x531e0d){return function(){UserEvents[_0xf0c0('0x5')](_0x41d164,_0x531e0d);};}exports[_0xf0c0('0x6')]=function(_0xe30869){for(var _0x12b229=0x0,_0x2348aa=events[_0xf0c0('0x7')];_0x12b229<_0x2348aa;_0x12b229++){var _0x10106a=events[_0x12b229];var _0x45dd01=createListener(_0xf0c0('0x8')+_0x10106a,_0xe30869);UserEvents['on'](_0x10106a,_0x45dd01);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 0330070..21b749a 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(_0x14bbdb,_0x1da52c){var _0x49a53a=function(_0x23f029){while(--_0x23f029){_0x14bbdb['push'](_0x14bbdb['shift']());}};_0x49a53a(++_0x1da52c);}(_0xedd9,0xfc));var _0x9edd=function(_0x508af2,_0xe1b79){_0x508af2=_0x508af2-0x0;var _0x233516=_0xedd9[_0x508af2];return _0x233516;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x197ce3,_0x183b31){var _0x7790af=function(_0x3f83a9){while(--_0x3f83a9){_0x197ce3['push'](_0x197ce3['shift']());}};_0x7790af(++_0x183b31);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index f1194f3..6b2ea98 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 _0x9ccf=['sequelize','exports','INTEGER'];(function(_0x2f6f5b,_0x1a6e08){var _0x342f2e=function(_0x14dff5){while(--_0x14dff5){_0x2f6f5b['push'](_0x2f6f5b['shift']());}};_0x342f2e(++_0x1a6e08);}(_0x9ccf,0x111));var _0xf9cc=function(_0x39f7b2,_0xda64e3){_0x39f7b2=_0x39f7b2-0x0;var _0x86bc34=_0x9ccf[_0x39f7b2];return _0x86bc34;};'use strict';var Sequelize=require(_0xf9cc('0x0'));module[_0xf9cc('0x1')]={'penalty':{'type':Sequelize[_0xf9cc('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x395a=['exports','INTEGER','sequelize'];(function(_0x302460,_0x115868){var _0x204063=function(_0x5cd9bb){while(--_0x5cd9bb){_0x302460['push'](_0x302460['shift']());}};_0x204063(++_0x115868);}(_0x395a,0x128));var _0xa395=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x395a[_0xef4cf0];return _0x497ad2;};'use strict';var Sequelize=require(_0xa395('0x0'));module[_0xa395('0x1')]={'penalty':{'type':Sequelize[_0xa395('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 27e4f47..55f5e23 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 _0x1bdb=['define','UserChatQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x5a1601,_0x39dede){var _0x3557c8=function(_0xec0578){while(--_0xec0578){_0x5a1601['push'](_0x5a1601['shift']());}};_0x3557c8(++_0x39dede);}(_0x1bdb,0x16e));var _0xb1bd=function(_0x43d388,_0x4f1918){_0x43d388=_0x43d388-0x0;var _0x4342d0=_0x1bdb[_0x43d388];return _0x4342d0;};'use strict';var _=require('lodash');var util=require(_0xb1bd('0x0'));var logger=require(_0xb1bd('0x1'))(_0xb1bd('0x2'));var moment=require(_0xb1bd('0x3'));var BPromise=require(_0xb1bd('0x4'));var rp=require(_0xb1bd('0x5'));var fs=require('fs');var path=require(_0xb1bd('0x6'));var rimraf=require(_0xb1bd('0x7'));var config=require(_0xb1bd('0x8'));var attributes=require(_0xb1bd('0x9'));module[_0xb1bd('0xa')]=function(_0x247012,_0x329523){return _0x247012[_0xb1bd('0xb')](_0xb1bd('0xc'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46c4=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x46c4,0x1d3));var _0x446c=function(_0xd545f7,_0x80de25){_0xd545f7=_0xd545f7-0x0;var _0x4f895f=_0x46c4[_0xd545f7];return _0x4f895f;};'use strict';var _=require(_0x446c('0x0'));var util=require(_0x446c('0x1'));var logger=require(_0x446c('0x2'))(_0x446c('0x3'));var moment=require('moment');var BPromise=require(_0x446c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x446c('0x5'));var rimraf=require(_0x446c('0x6'));var config=require(_0x446c('0x7'));var attributes=require(_0x446c('0x8'));module[_0x446c('0x9')]=function(_0x4bbfd0,_0x5a0808){return _0x4bbfd0['define'](_0x446c('0xa'),attributes,{'tableName':_0x446c('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 180e0aa..b41b787 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 _0xfe11=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xfe11,0x1ee));var _0x1fe1=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0xfe11[_0x4733d3];return _0x1b9a44;};'use strict';var _=require(_0x1fe1('0x0'));var util=require(_0x1fe1('0x1'));var moment=require(_0x1fe1('0x2'));var BPromise=require(_0x1fe1('0x3'));var rs=require(_0x1fe1('0x4'));var fs=require('fs');var Redis=require(_0x1fe1('0x5'));var db=require(_0x1fe1('0x6'))['db'];var utils=require(_0x1fe1('0x7'));var logger=require(_0x1fe1('0x8'))(_0x1fe1('0x9'));var config=require(_0x1fe1('0xa'));var jayson=require(_0x1fe1('0xb'));var client=jayson[_0x1fe1('0xc')][_0x1fe1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2294da,_0x17bc3d,_0x3f9d42){return new BPromise(function(_0x1a6212,_0x19b330){return client[_0x1fe1('0xe')](_0x2294da,_0x3f9d42)[_0x1fe1('0xf')](function(_0x39e2ff){logger[_0x1fe1('0x10')](_0x1fe1('0x11'),_0x17bc3d,_0x1fe1('0x12'));logger[_0x1fe1('0x13')](_0x1fe1('0x14'),_0x17bc3d,_0x1fe1('0x12'),JSON['stringify'](_0x39e2ff));if(_0x39e2ff[_0x1fe1('0x15')]){if(_0x39e2ff[_0x1fe1('0x15')][_0x1fe1('0x16')]===0x1f4){logger[_0x1fe1('0x15')]('UserChatQueue,\x20%s,\x20%s',_0x17bc3d,_0x39e2ff['error']['message']);return _0x19b330(_0x39e2ff[_0x1fe1('0x15')]['message']);}logger[_0x1fe1('0x15')](_0x1fe1('0x11'),_0x17bc3d,_0x39e2ff['error'][_0x1fe1('0x17')]);return _0x1a6212(_0x39e2ff[_0x1fe1('0x15')]['message']);}else{logger[_0x1fe1('0x10')](_0x1fe1('0x11'),_0x17bc3d,_0x1fe1('0x12'));_0x1a6212(_0x39e2ff[_0x1fe1('0x18')][_0x1fe1('0x17')]);}})[_0x1fe1('0x19')](function(_0x1b527d){logger[_0x1fe1('0x15')](_0x1fe1('0x11'),_0x17bc3d,_0x1b527d);_0x19b330(_0x1b527d);});});} \ No newline at end of file +var _0x4573=['request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','UserChatQueue,\x20%s,\x20%s'];(function(_0x4220f6,_0x19a2c1){var _0x3744ff=function(_0x4c8462){while(--_0x4c8462){_0x4220f6['push'](_0x4220f6['shift']());}};_0x3744ff(++_0x19a2c1);}(_0x4573,0x142));var _0x3457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3457('0x0'));var util=require(_0x3457('0x1'));var moment=require(_0x3457('0x2'));var BPromise=require(_0x3457('0x3'));var rs=require(_0x3457('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3457('0x5'))['db'];var utils=require(_0x3457('0x6'));var logger=require(_0x3457('0x7'))(_0x3457('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3457('0x9')][_0x3457('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c4f3,_0x4d1efc,_0x5d5060){return new BPromise(function(_0x433f37,_0x4004d3){return client[_0x3457('0xb')](_0x46c4f3,_0x5d5060)[_0x3457('0xc')](function(_0x10f948){logger['info'](_0x3457('0xd'),_0x4d1efc,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x4d1efc,_0x3457('0xe'),JSON[_0x3457('0xf')](_0x10f948));if(_0x10f948[_0x3457('0x10')]){if(_0x10f948[_0x3457('0x10')]['code']===0x1f4){logger[_0x3457('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4d1efc,_0x10f948[_0x3457('0x10')][_0x3457('0x11')]);return _0x4004d3(_0x10f948[_0x3457('0x10')][_0x3457('0x11')]);}logger[_0x3457('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4d1efc,_0x10f948[_0x3457('0x10')][_0x3457('0x11')]);return _0x433f37(_0x10f948['error'][_0x3457('0x11')]);}else{logger[_0x3457('0x12')](_0x3457('0xd'),_0x4d1efc,_0x3457('0xe'));_0x433f37(_0x10f948[_0x3457('0x13')][_0x3457('0x11')]);}})[_0x3457('0x14')](function(_0x506725){logger[_0x3457('0x10')](_0x3457('0xd'),_0x4d1efc,_0x506725);_0x4004d3(_0x506725);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 836f5fc..3632400 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(_0x1082ee,_0x18607a){var _0x88187e=function(_0x2b2c51){while(--_0x2b2c51){_0x1082ee['push'](_0x1082ee['shift']());}};_0x88187e(++_0x18607a);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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(_0x1f9528,_0x895f60){var _0x113ab7=function(_0x29c142){while(--_0x29c142){_0x1f9528['push'](_0x1f9528['shift']());}};_0x113ab7(++_0x895f60);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae812,_0x57767f){_0x3ae812=_0x3ae812-0x0;var _0x3f6639=_0xe706[_0x3ae812];return _0x3f6639;};'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 852753a..022022a 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 _0x72e6=['STRING','exports','INTEGER'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x72e6,0x1cf));var _0x672e=function(_0x34f9fe,_0x3596de){_0x34f9fe=_0x34f9fe-0x0;var _0x404102=_0x72e6[_0x34f9fe];return _0x404102;};'use strict';var Sequelize=require('sequelize');module[_0x672e('0x0')]={'penalty':{'type':Sequelize[_0x672e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x672e('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x672e('0x2')]}}; \ No newline at end of file +var _0x245b=['INTEGER','sequelize','exports'];(function(_0x423567,_0x1b732f){var _0x25eefc=function(_0x261248){while(--_0x261248){_0x423567['push'](_0x423567['shift']());}};_0x25eefc(++_0x1b732f);}(_0x245b,0x88));var _0xb245=function(_0x3586cb,_0x8a0a3b){_0x3586cb=_0x3586cb-0x0;var _0x22d2a8=_0x245b[_0x3586cb];return _0x22d2a8;};'use strict';var Sequelize=require(_0xb245('0x0'));module[_0xb245('0x1')]={'penalty':{'type':Sequelize[_0xb245('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb245('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index fe17abe..5f01344 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 _0x26ce=['user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','UserFaxQueue'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x26ce,0xc7));var _0xe26c=function(_0x21c802,_0x1b98b5){_0x21c802=_0x21c802-0x0;var _0x112f05=_0x26ce[_0x21c802];return _0x112f05;};'use strict';var _=require(_0xe26c('0x0'));var util=require(_0xe26c('0x1'));var logger=require(_0xe26c('0x2'))(_0xe26c('0x3'));var moment=require('moment');var BPromise=require(_0xe26c('0x4'));var rp=require(_0xe26c('0x5'));var fs=require('fs');var path=require(_0xe26c('0x6'));var rimraf=require(_0xe26c('0x7'));var config=require(_0xe26c('0x8'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3873ed,_0x4ea028){return _0x3873ed['define'](_0xe26c('0x9'),attributes,{'tableName':_0xe26c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce3e=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x137c6c,_0x250433){var _0x6baa28=function(_0x124772){while(--_0x124772){_0x137c6c['push'](_0x137c6c['shift']());}};_0x6baa28(++_0x250433);}(_0xce3e,0x169));var _0xece3=function(_0x136aa5,_0x5fc2){_0x136aa5=_0x136aa5-0x0;var _0x55698e=_0xce3e[_0x136aa5];return _0x55698e;};'use strict';var _=require(_0xece3('0x0'));var util=require(_0xece3('0x1'));var logger=require(_0xece3('0x2'))(_0xece3('0x3'));var moment=require(_0xece3('0x4'));var BPromise=require(_0xece3('0x5'));var rp=require(_0xece3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xece3('0x7'));var attributes=require(_0xece3('0x8'));module[_0xece3('0x9')]=function(_0x27fadd,_0x492265){return _0x27fadd[_0xece3('0xa')]('UserFaxQueue',attributes,{'tableName':_0xece3('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 4d0b8d9..c9240c3 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 _0x9626=['info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x9626,0x19a));var _0x6962=function(_0x54da23,_0x346b19){_0x54da23=_0x54da23-0x0;var _0x2a5e1c=_0x9626[_0x54da23];return _0x2a5e1c;};'use strict';var _=require(_0x6962('0x0'));var util=require(_0x6962('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6962('0x2'));var fs=require('fs');var Redis=require(_0x6962('0x3'));var db=require(_0x6962('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6962('0x5'));var jayson=require(_0x6962('0x6'));var client=jayson[_0x6962('0x7')][_0x6962('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cae4,_0x4a998e,_0xbcc6ea){return new BPromise(function(_0x4c4098,_0x42bd58){return client['request'](_0x3cae4,_0xbcc6ea)[_0x6962('0x9')](function(_0x5632dc){logger[_0x6962('0xa')](_0x6962('0xb'),_0x4a998e,'request\x20sent');logger[_0x6962('0xc')](_0x6962('0xd'),_0x4a998e,_0x6962('0xe'),JSON[_0x6962('0xf')](_0x5632dc));if(_0x5632dc['error']){if(_0x5632dc[_0x6962('0x10')][_0x6962('0x11')]===0x1f4){logger[_0x6962('0x10')](_0x6962('0xb'),_0x4a998e,_0x5632dc[_0x6962('0x10')][_0x6962('0x12')]);return _0x42bd58(_0x5632dc[_0x6962('0x10')][_0x6962('0x12')]);}logger['error'](_0x6962('0xb'),_0x4a998e,_0x5632dc[_0x6962('0x10')]['message']);return _0x4c4098(_0x5632dc[_0x6962('0x10')][_0x6962('0x12')]);}else{logger[_0x6962('0xa')](_0x6962('0xb'),_0x4a998e,_0x6962('0xe'));_0x4c4098(_0x5632dc['result'][_0x6962('0x12')]);}})[_0x6962('0x13')](function(_0x10103e){logger[_0x6962('0x10')](_0x6962('0xb'),_0x4a998e,_0x10103e);_0x42bd58(_0x10103e);});});} \ No newline at end of file +var _0x8e76=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x8e76,0x1d5));var _0x68e7=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8e76[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x68e7('0x0'));var util=require(_0x68e7('0x1'));var moment=require(_0x68e7('0x2'));var BPromise=require(_0x68e7('0x3'));var rs=require(_0x68e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68e7('0x5'));var logger=require(_0x68e7('0x6'))(_0x68e7('0x7'));var config=require(_0x68e7('0x8'));var jayson=require(_0x68e7('0x9'));var client=jayson[_0x68e7('0xa')][_0x68e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552bb7,_0x52b731,_0x1cbaa7){return new BPromise(function(_0x2b3f0e,_0x3c7941){return client[_0x68e7('0xc')](_0x552bb7,_0x1cbaa7)[_0x68e7('0xd')](function(_0x2ee443){logger[_0x68e7('0xe')](_0x68e7('0xf'),_0x52b731,_0x68e7('0x10'));logger[_0x68e7('0x11')](_0x68e7('0x12'),_0x52b731,_0x68e7('0x10'),JSON[_0x68e7('0x13')](_0x2ee443));if(_0x2ee443[_0x68e7('0x14')]){if(_0x2ee443[_0x68e7('0x14')][_0x68e7('0x15')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x52b731,_0x2ee443['error'][_0x68e7('0x16')]);return _0x3c7941(_0x2ee443[_0x68e7('0x14')][_0x68e7('0x16')]);}logger[_0x68e7('0x14')](_0x68e7('0xf'),_0x52b731,_0x2ee443[_0x68e7('0x14')][_0x68e7('0x16')]);return _0x2b3f0e(_0x2ee443[_0x68e7('0x14')][_0x68e7('0x16')]);}else{logger[_0x68e7('0xe')](_0x68e7('0xf'),_0x52b731,_0x68e7('0x10'));_0x2b3f0e(_0x2ee443[_0x68e7('0x17')][_0x68e7('0x16')]);}})[_0x68e7('0x18')](function(_0x216fc3){logger[_0x68e7('0x14')](_0x68e7('0xf'),_0x52b731,_0x216fc3);_0x3c7941(_0x216fc3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 13b939f..8e866a8 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x24896c,_0x3d3472){var _0x4dbcf6=function(_0x5f0d66){while(--_0x5f0d66){_0x24896c['push'](_0x24896c['shift']());}};_0x4dbcf6(++_0x3d3472);}(_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(_0x78f016,_0x2a4320){var _0x565794=function(_0x38ef6c){while(--_0x38ef6c){_0x78f016['push'](_0x78f016['shift']());}};_0x565794(++_0x2a4320);}(_0x70e0,0x17b));var _0x070e=function(_0x1f6a96,_0x2e3f18){_0x1f6a96=_0x1f6a96-0x0;var _0x401dda=_0x70e0[_0x1f6a96];return _0x401dda;};'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 9cbd6d0..6228892 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 _0xc6f8=['sequelize','exports','INTEGER'];(function(_0x97192b,_0x23eddf){var _0x2ad8ea=function(_0x55d52d){while(--_0x55d52d){_0x97192b['push'](_0x97192b['shift']());}};_0x2ad8ea(++_0x23eddf);}(_0xc6f8,0x87));var _0x8c6f=function(_0x23f61b,_0x58a08b){_0x23f61b=_0x23f61b-0x0;var _0x4d1ad0=_0xc6f8[_0x23f61b];return _0x4d1ad0;};'use strict';var Sequelize=require(_0x8c6f('0x0'));module[_0x8c6f('0x1')]={'penalty':{'type':Sequelize[_0x8c6f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x745d=['INTEGER'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x745d,0x1cb));var _0xd745=function(_0x193ae9,_0x310e7b){_0x193ae9=_0x193ae9-0x0;var _0x45c49a=_0x745d[_0x193ae9];return _0x45c49a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xd745('0x0')],'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 513844e..5c3c997 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 _0x5c8e=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','user_has_mail_queues','util'];(function(_0x16d24f,_0x4686a5){var _0x3beec6=function(_0x552ae0){while(--_0x552ae0){_0x16d24f['push'](_0x16d24f['shift']());}};_0x3beec6(++_0x4686a5);}(_0x5c8e,0x180));var _0xe5c8=function(_0x1de1f1,_0x2f7640){_0x1de1f1=_0x1de1f1-0x0;var _0x5b6987=_0x5c8e[_0x1de1f1];return _0x5b6987;};'use strict';var _=require('lodash');var util=require(_0xe5c8('0x0'));var logger=require(_0xe5c8('0x1'))(_0xe5c8('0x2'));var moment=require(_0xe5c8('0x3'));var BPromise=require(_0xe5c8('0x4'));var rp=require(_0xe5c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5c8('0x6'));var config=require(_0xe5c8('0x7'));var attributes=require('./userMailQueue.attributes');module[_0xe5c8('0x8')]=function(_0x5750d7,_0x5414d6){return _0x5750d7[_0xe5c8('0x9')]('UserMailQueue',attributes,{'tableName':_0xe5c8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93d3=['api','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x93d3,0x169));var _0x393d=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x93d3[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x393d('0x0'));var util=require(_0x393d('0x1'));var logger=require('../../config/logger')(_0x393d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x393d('0x3'));var rimraf=require(_0x393d('0x4'));var config=require(_0x393d('0x5'));var attributes=require(_0x393d('0x6'));module[_0x393d('0x7')]=function(_0x6c84e6,_0xdbeca5){return _0x6c84e6[_0x393d('0x8')](_0x393d('0x9'),attributes,{'tableName':_0x393d('0xa'),'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 c70a8df..55e7379 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3899be,_0x160c27){var _0x4a77e5=function(_0x1cc12f){while(--_0x1cc12f){_0x3899be['push'](_0x3899be['shift']());}};_0x4a77e5(++_0x160c27);}(_0x6aa7,0x178));var _0x76aa=function(_0x4a8a23,_0x3271e8){_0x4a8a23=_0x4a8a23-0x0;var _0x2305eb=_0x6aa7[_0x4a8a23];return _0x2305eb;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x44f718,_0x5ff433){var _0x1bbfee=function(_0x56dca8){while(--_0x56dca8){_0x44f718['push'](_0x44f718['shift']());}};_0x1bbfee(++_0x5ff433);}(_0x00bb,0x1d8));var _0xb00b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x00bb[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 38b5de2..46434c7 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 _0x5ddd=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','exports','multer'];(function(_0xb8fed7,_0x29b3c2){var _0x1c12fc=function(_0x519700){while(--_0x519700){_0xb8fed7['push'](_0xb8fed7['shift']());}};_0x1c12fc(++_0x29b3c2);}(_0x5ddd,0x117));var _0xd5dd=function(_0x5ee0ef,_0x34f2b1){_0x5ee0ef=_0x5ee0ef-0x0;var _0x144aab=_0x5ddd[_0x5ee0ef];return _0x144aab;};'use strict';var multer=require(_0xd5dd('0x0'));var util=require('util');var path=require(_0xd5dd('0x1'));var timeout=require('connect-timeout');var express=require(_0xd5dd('0x2'));var router=express[_0xd5dd('0x3')]();var fs_extra=require(_0xd5dd('0x4'));var auth=require(_0xd5dd('0x5'));var interaction=require(_0xd5dd('0x6'));var config=require('../../config/environment');var controller=require(_0xd5dd('0x7'));router[_0xd5dd('0x8')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0xd5dd('0x9')]=router; \ No newline at end of file +var _0xaceb=['sendUserNotification','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated'];(function(_0x48694f,_0x44690e){var _0x28aeb0=function(_0x205204){while(--_0x205204){_0x48694f['push'](_0x48694f['shift']());}};_0x28aeb0(++_0x44690e);}(_0xaceb,0xa9));var _0xbace=function(_0x3e15ca,_0x4f9c19){_0x3e15ca=_0x3e15ca-0x0;var _0x394d68=_0xaceb[_0x3e15ca];return _0x394d68;};'use strict';var multer=require(_0xbace('0x0'));var util=require(_0xbace('0x1'));var path=require(_0xbace('0x2'));var timeout=require(_0xbace('0x3'));var express=require('express');var router=express[_0xbace('0x4')]();var fs_extra=require(_0xbace('0x5'));var auth=require(_0xbace('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbace('0x7'));var controller=require(_0xbace('0x8'));router[_0xbace('0x9')]('/',auth[_0xbace('0xa')](),controller[_0xbace('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 7a2e096..7cee701 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 _0x2272=['BOOLEAN','TEXT','STRING'];(function(_0x495e48,_0x54f152){var _0x5c3108=function(_0x48de5b){while(--_0x48de5b){_0x495e48['push'](_0x495e48['shift']());}};_0x5c3108(++_0x54f152);}(_0x2272,0xf4));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x2227('0x0')]},'recipientsDescription':{'type':Sequelize[_0x2227('0x1')]},'beep':{'type':Sequelize[_0x2227('0x2')]}}; \ No newline at end of file +var _0x562a=['STRING','TEXT','BOOLEAN','sequelize','exports'];(function(_0x4c60ea,_0x1a40c0){var _0x4922db=function(_0x530112){while(--_0x530112){_0x4c60ea['push'](_0x4c60ea['shift']());}};_0x4922db(++_0x1a40c0);}(_0x562a,0x85));var _0xa562=function(_0x5f26dd,_0x26bc13){_0x5f26dd=_0x5f26dd-0x0;var _0x1d0dcd=_0x562a[_0x5f26dd];return _0x1d0dcd;};'use strict';var Sequelize=require(_0xa562('0x0'));module[_0xa562('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xa562('0x2')]},'recipientsId':{'type':Sequelize[_0xa562('0x3')]},'recipientsDescription':{'type':Sequelize[_0xa562('0x2')]},'beep':{'type':Sequelize[_0xa562('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index eb9de91..cf87622 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 _0x3ca3=['Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','union','ids','queue','replace','Queue','all','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','offset','limit','set','apply','reject','then','destroy','error','stack','send','sendUserNotification','body','hasOwnProperty','TemplateId'];(function(_0x50e7f9,_0x26c898){var _0x334f4c=function(_0x3e5737){while(--_0x3e5737){_0x50e7f9['push'](_0x50e7f9['shift']());}};_0x334f4c(++_0x26c898);}(_0x3ca3,0x162));var _0x33ca=function(_0x17b4e9,_0x5788bb){_0x17b4e9=_0x17b4e9-0x0;var _0x570209=_0x3ca3[_0x17b4e9];return _0x570209;};'use strict';var emlformat=require(_0x33ca('0x0'));var rimraf=require(_0x33ca('0x1'));var zipdir=require(_0x33ca('0x2'));var jsonpatch=require(_0x33ca('0x3'));var rp=require(_0x33ca('0x4'));var moment=require('moment');var BPromise=require(_0x33ca('0x5'));var Mustache=require(_0x33ca('0x6'));var util=require(_0x33ca('0x7'));var path=require(_0x33ca('0x8'));var sox=require(_0x33ca('0x9'));var csv=require(_0x33ca('0xa'));var ejs=require(_0x33ca('0xb'));var fs=require('fs');var fs_extra=require(_0x33ca('0xc'));var _=require(_0x33ca('0xd'));var squel=require('squel');var crypto=require(_0x33ca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x33ca('0xf'));var toCsv=require(_0x33ca('0xa'));var querystring=require(_0x33ca('0x10'));var Papa=require(_0x33ca('0x11'));var Redis=require(_0x33ca('0x12'));var authService=require(_0x33ca('0x13'));var qs=require(_0x33ca('0x14'));var as=require(_0x33ca('0x15'));var hardwareService=require(_0x33ca('0x16'));var logger=require(_0x33ca('0x17'))(_0x33ca('0x18'));var utils=require(_0x33ca('0x19'));var config=require(_0x33ca('0x1a'));var licenseUtil=require(_0x33ca('0x1b'));var db=require(_0x33ca('0x1c'))['db'];config[_0x33ca('0x1d')]=_[_0x33ca('0x1e')](config['redis'],{'host':_0x33ca('0x1f'),'port':0x18eb});var socket=require(_0x33ca('0x20'))(new Redis(config[_0x33ca('0x1d')]));require(_0x33ca('0x21'))[_0x33ca('0x22')](socket);function respondWithStatusCode(_0xc2eae3,_0x2ae85f){_0x2ae85f=_0x2ae85f||0xcc;return function(_0x3c0090){if(_0x3c0090){return _0xc2eae3[_0x33ca('0x23')](_0x2ae85f);}return _0xc2eae3[_0x33ca('0x24')](_0x2ae85f)[_0x33ca('0x25')]();};}function respondWithResult(_0x3a5d5e,_0x4b067e){_0x4b067e=_0x4b067e||0xc8;return function(_0x39c193){if(_0x39c193){return _0x3a5d5e[_0x33ca('0x24')](_0x4b067e)[_0x33ca('0x26')](_0x39c193);}};}function respondWithFilteredResult(_0x39b9c6,_0x77977){return function(_0x18b5d2){if(_0x18b5d2){var _0x3a3b8b=typeof _0x77977['offset']===_0x33ca('0x27')&&typeof _0x77977['limit']===_0x33ca('0x27');var _0x2c55c4=_0x18b5d2['count'];var _0x200d67=_0x3a3b8b?0x0:_0x77977[_0x33ca('0x28')];var _0x1ac61c=_0x3a3b8b?_0x18b5d2['count']:_0x77977[_0x33ca('0x28')]+_0x77977[_0x33ca('0x29')];var _0x15350b;if(_0x1ac61c>=_0x2c55c4){_0x1ac61c=_0x2c55c4;_0x15350b=0xc8;}else{_0x15350b=0xce;}_0x39b9c6[_0x33ca('0x24')](_0x15350b);return _0x39b9c6[_0x33ca('0x2a')]('Content-Range',_0x200d67+'-'+_0x1ac61c+'/'+_0x2c55c4)['json'](_0x18b5d2);}return null;};}function patchUpdates(_0x49df5e){return function(_0x237322){try{jsonpatch[_0x33ca('0x2b')](_0x237322,_0x49df5e,!![]);}catch(_0x53c88f){return BPromise[_0x33ca('0x2c')](_0x53c88f);}return _0x237322['save']();};}function saveUpdates(_0x58afa8,_0x48e61e){return function(_0x313bad){if(_0x313bad){return _0x313bad['update'](_0x58afa8)[_0x33ca('0x2d')](function(_0x323b29){return _0x323b29;});}return null;};}function removeEntity(_0x5d25f,_0x2fc3aa){return function(_0x48b862){if(_0x48b862){return _0x48b862[_0x33ca('0x2e')]()['then'](function(){_0x5d25f[_0x33ca('0x24')](0xcc)[_0x33ca('0x25')]();});}};}function handleEntityNotFound(_0xa1f868,_0xc3aaca){return function(_0x566118){if(!_0x566118){_0xa1f868[_0x33ca('0x23')](0x194);}return _0x566118;};}function handleError(_0x38e840,_0x96e980){_0x96e980=_0x96e980||0x1f4;return function(_0x29db80){logger[_0x33ca('0x2f')](_0x29db80[_0x33ca('0x30')]);if(_0x29db80['name']){delete _0x29db80['name'];}_0x38e840[_0x33ca('0x24')](_0x96e980)[_0x33ca('0x31')](_0x29db80);};}exports[_0x33ca('0x32')]=function(_0x2c84f5,_0x4676d1,_0x1d384f){if(!_0x2c84f5[_0x33ca('0x33')][_0x33ca('0x34')]('text')&&!_0x2c84f5[_0x33ca('0x33')]['hasOwnProperty'](_0x33ca('0x35'))){throw new db[(_0x33ca('0x36'))][(_0x33ca('0x37'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x2c84f5[_0x33ca('0x33')][_0x33ca('0x34')](_0x33ca('0x35'))&&!_0x2c84f5[_0x33ca('0x33')]['hasOwnProperty'](_0x33ca('0x38'))){throw new db['Sequelize'][(_0x33ca('0x37'))](_0x33ca('0x39'));}if(!_0x2c84f5['body'][_0x33ca('0x34')](_0x33ca('0x3a'))){throw new db['Sequelize']['ValidationError'](_0x33ca('0x3b'));}else{try{var _0x33b1d2=JSON[_0x33ca('0x3c')](_0x2c84f5[_0x33ca('0x33')][_0x33ca('0x3a')]);}catch(_0x277fe5){logger[_0x33ca('0x2f')](_0x277fe5);throw new db[(_0x33ca('0x36'))][(_0x33ca('0x37'))](_0x33ca('0x3d'));}var _0x2fd9bb=[_0x33ca('0x3e'),_0x33ca('0x3f'),_0x33ca('0x40'),'openchannelqueue','smsqueue',_0x33ca('0x41'),_0x33ca('0x42'),_0x33ca('0x43'),_0x33ca('0x44')];if(_[_0x33ca('0x45')](_0x33b1d2,function(_0x130a27){return!_[_0x33ca('0x46')](_0x2fd9bb,_0x130a27[_0x33ca('0x47')][_0x33ca('0x48')]());})){throw new db[(_0x33ca('0x36'))]['ValidationError'](_0x33ca('0x49'));}}}var _0x52ca63={};_0x52ca63[_0x33ca('0x4a')]=_0x2c84f5[_0x33ca('0x33')]['hasOwnProperty'](_0x33ca('0x4a'))?_0x2c84f5['body'][_0x33ca('0x4a')]:_0x2c84f5[_0x33ca('0x44')][_0x33ca('0x4b')];_0x52ca63[_0x33ca('0x4c')]=_['isEmpty'](_0x2c84f5['body']['recipientsDescription'])?null:_0x2c84f5['body'][_0x33ca('0x4c')];_0x52ca63[_0x33ca('0x4d')]=_0x2c84f5[_0x33ca('0x33')]['beep']||![];_0x52ca63[_0x33ca('0x4e')]=_0x2c84f5[_0x33ca('0x44')]['id'];return getContent(_0x2c84f5[_0x33ca('0x33')])[_0x33ca('0x2d')](function(_0x48c39c){_0x52ca63[_0x33ca('0x33')]=_0x48c39c;return getRecipients(_0x33b1d2);})['then'](function(_0x2cf5cc){_0x52ca63['recipientsId']=_['sortBy'](_0x2cf5cc)[_0x33ca('0x4f')](',');return db[_0x33ca('0x50')][_0x33ca('0x51')](function(_0x410a1d){return db[_0x33ca('0x52')][_0x33ca('0x53')](_0x52ca63,{'raw':!![],'transaction':_0x410a1d})[_0x33ca('0x2d')](function(_0x3d4726){var _0x1c3385={'sender':_0x52ca63[_0x33ca('0x4a')],'description':_0x52ca63[_0x33ca('0x4c')],'content':_0x52ca63[_0x33ca('0x33')],'beep':_0x52ca63['beep']};_0x2cf5cc[_0x33ca('0x54')](function(_0x212f0d){_0x1c3385[_0x33ca('0x55')]=_0x212f0d;socket['emit'](_0x33ca('0x56'),_0x1c3385);});return _0x3d4726;});});})['then'](respondWithResult(_0x4676d1,0xc9))['catch'](handleError(_0x4676d1,null));};function getContent(_0x57bc3e){return new BPromise(function(_0x20026d,_0x3130a5){if(_0x57bc3e[_0x33ca('0x57')]){_0x20026d(_0x57bc3e[_0x33ca('0x57')]);return;}return db[_0x33ca('0x58')][_0x33ca('0x59')]({'attributes':[_0x33ca('0x5a')],'where':{'id':_0x57bc3e[_0x33ca('0x35')]},'raw':!![]})[_0x33ca('0x2d')](function(_0x11a3a0){if(!_0x11a3a0)throw new db[(_0x33ca('0x36'))][(_0x33ca('0x37'))](_0x33ca('0x5b'));var _0x3ce963=Mustache[_0x33ca('0x5c')](_0x11a3a0[_0x33ca('0x5a')],_0x57bc3e[_0x33ca('0x38')]);_0x20026d(_0x3ce963);})[_0x33ca('0x5d')](function(_0x4a044f){_0x3130a5(_0x4a044f);});});}function getRecipients(_0x53d51d){return new BPromise(function(_0x497889,_0x1c97f7){var _0x2bd6ac=[];var _0x295979=[];_0x53d51d[_0x33ca('0x54')](function(_0x2c6b68){var _0x11864c=_[_0x33ca('0x5e')](_0x2c6b68[_0x33ca('0x47')]['toLowerCase']());if(_0x11864c==='User'){_0x2bd6ac=_[_0x33ca('0x5f')](_0x2bd6ac,_0x2c6b68[_0x33ca('0x60')]);}else{if(_['includes'](_0x11864c,_0x33ca('0x61')))_0x11864c=_0x11864c[_0x33ca('0x62')](_0x33ca('0x61'),_0x33ca('0x63'));_0x2c6b68[_0x33ca('0x60')][_0x33ca('0x54')](function(_0x3f1c3b){_0x295979['push'](getAgents(_0x11864c,_0x3f1c3b));});}});return BPromise[_0x33ca('0x64')](_0x295979)[_0x33ca('0x2d')](function(_0x36a7d6){_0x2bd6ac=_['union'](_0x2bd6ac,_['flatten'](_0x36a7d6));_0x497889(_0x2bd6ac);})[_0x33ca('0x5d')](function(_0x4a547f){_0x1c97f7(_0x4a547f);});});}function getAgents(_0x1340a1,_0x5626ac){return new BPromise(function(_0x1dd763,_0x125be9){return db[_0x1340a1][_0x33ca('0x59')]({'where':{'id':_0x5626ac}})[_0x33ca('0x2d')](function(_0x132a2e){return _0x132a2e['getAgents']({'attributes':['id'],'raw':!![]})[_0x33ca('0x2d')](function(_0x292dfb){var _0x41e4c0=_[_0x33ca('0x65')](_0x292dfb,'id');_0x1dd763(_0x41e4c0);});})[_0x33ca('0x5d')](function(_0x5ce9cd){_0x125be9(_0x5ce9cd);});});} \ No newline at end of file +var _0x0f49=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','end','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','replace','queue','Queue','flatten','getAgents','map','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce'];(function(_0x344808,_0x64ea2a){var _0x41b347=function(_0x398bf4){while(--_0x398bf4){_0x344808['push'](_0x344808['shift']());}};_0x41b347(++_0x64ea2a);}(_0x0f49,0xb8));var _0x90f4=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0x0f49[_0x1b8bda];return _0x1f7050;};'use strict';var emlformat=require(_0x90f4('0x0'));var rimraf=require(_0x90f4('0x1'));var zipdir=require(_0x90f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x90f4('0x3'));var BPromise=require(_0x90f4('0x4'));var Mustache=require(_0x90f4('0x5'));var util=require(_0x90f4('0x6'));var path=require('path');var sox=require(_0x90f4('0x7'));var csv=require(_0x90f4('0x8'));var ejs=require(_0x90f4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90f4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x90f4('0xb'));var deskjs=require(_0x90f4('0xc'));var toCsv=require(_0x90f4('0x8'));var querystring=require('querystring');var Papa=require(_0x90f4('0xd'));var Redis=require(_0x90f4('0xe'));var authService=require(_0x90f4('0xf'));var qs=require(_0x90f4('0x10'));var as=require(_0x90f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x90f4('0x12'))(_0x90f4('0x13'));var utils=require(_0x90f4('0x14'));var config=require(_0x90f4('0x15'));var licenseUtil=require(_0x90f4('0x16'));var db=require(_0x90f4('0x17'))['db'];config['redis']=_[_0x90f4('0x18')](config[_0x90f4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x90f4('0x1a'))(new Redis(config[_0x90f4('0x19')]));require(_0x90f4('0x1b'))[_0x90f4('0x1c')](socket);function respondWithStatusCode(_0x4dc59f,_0x3cab0f){_0x3cab0f=_0x3cab0f||0xcc;return function(_0x15c9ba){if(_0x15c9ba){return _0x4dc59f[_0x90f4('0x1d')](_0x3cab0f);}return _0x4dc59f[_0x90f4('0x1e')](_0x3cab0f)['end']();};}function respondWithResult(_0x381080,_0x963911){_0x963911=_0x963911||0xc8;return function(_0x17d046){if(_0x17d046){return _0x381080[_0x90f4('0x1e')](_0x963911)[_0x90f4('0x1f')](_0x17d046);}};}function respondWithFilteredResult(_0x301759,_0x1414c8){return function(_0x345b37){if(_0x345b37){var _0x252f74=typeof _0x1414c8[_0x90f4('0x20')]===_0x90f4('0x21')&&typeof _0x1414c8[_0x90f4('0x22')]===_0x90f4('0x21');var _0x204dd5=_0x345b37[_0x90f4('0x23')];var _0x1259aa=_0x252f74?0x0:_0x1414c8[_0x90f4('0x20')];var _0x1e565c=_0x252f74?_0x345b37[_0x90f4('0x23')]:_0x1414c8[_0x90f4('0x20')]+_0x1414c8[_0x90f4('0x22')];var _0x52c86d;if(_0x1e565c>=_0x204dd5){_0x1e565c=_0x204dd5;_0x52c86d=0xc8;}else{_0x52c86d=0xce;}_0x301759[_0x90f4('0x1e')](_0x52c86d);return _0x301759[_0x90f4('0x24')]('Content-Range',_0x1259aa+'-'+_0x1e565c+'/'+_0x204dd5)[_0x90f4('0x1f')](_0x345b37);}return null;};}function patchUpdates(_0x4f593a){return function(_0x805b1a){try{jsonpatch[_0x90f4('0x25')](_0x805b1a,_0x4f593a,!![]);}catch(_0x594b6d){return BPromise['reject'](_0x594b6d);}return _0x805b1a[_0x90f4('0x26')]();};}function saveUpdates(_0x19bce1,_0x1cd082){return function(_0x16eb0b){if(_0x16eb0b){return _0x16eb0b['update'](_0x19bce1)[_0x90f4('0x27')](function(_0x110e6c){return _0x110e6c;});}return null;};}function removeEntity(_0x14c58c,_0x10769d){return function(_0x316e25){if(_0x316e25){return _0x316e25[_0x90f4('0x28')]()[_0x90f4('0x27')](function(){_0x14c58c['status'](0xcc)[_0x90f4('0x29')]();});}};}function handleEntityNotFound(_0x43cfde,_0x4ef04f){return function(_0x36551e){if(!_0x36551e){_0x43cfde[_0x90f4('0x1d')](0x194);}return _0x36551e;};}function handleError(_0x419923,_0x1972a7){_0x1972a7=_0x1972a7||0x1f4;return function(_0x4e27fc){logger['error'](_0x4e27fc[_0x90f4('0x2a')]);if(_0x4e27fc[_0x90f4('0x2b')]){delete _0x4e27fc[_0x90f4('0x2b')];}_0x419923[_0x90f4('0x1e')](_0x1972a7)[_0x90f4('0x2c')](_0x4e27fc);};}exports[_0x90f4('0x2d')]=function(_0x393840,_0x31453e,_0x1f1772){if(!_0x393840[_0x90f4('0x2e')][_0x90f4('0x2f')]('text')&&!_0x393840[_0x90f4('0x2e')][_0x90f4('0x2f')](_0x90f4('0x30'))){throw new db[(_0x90f4('0x31'))][(_0x90f4('0x32'))](_0x90f4('0x33'));}else{if(_0x393840[_0x90f4('0x2e')][_0x90f4('0x2f')](_0x90f4('0x30'))&&!_0x393840[_0x90f4('0x2e')][_0x90f4('0x2f')](_0x90f4('0x34'))){throw new db['Sequelize'][(_0x90f4('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x393840['body'][_0x90f4('0x2f')](_0x90f4('0x35'))){throw new db[(_0x90f4('0x31'))][(_0x90f4('0x32'))](_0x90f4('0x36'));}else{try{var _0x4353ef=JSON[_0x90f4('0x37')](_0x393840['body']['recipients']);}catch(_0x1d9c30){logger[_0x90f4('0x38')](_0x1d9c30);throw new db[(_0x90f4('0x31'))][(_0x90f4('0x32'))](_0x90f4('0x39'));}var _0x4b2a3=[_0x90f4('0x3a'),_0x90f4('0x3b'),_0x90f4('0x3c'),_0x90f4('0x3d'),'smsqueue',_0x90f4('0x3e'),_0x90f4('0x3f'),_0x90f4('0x40'),_0x90f4('0x41')];if(_['some'](_0x4353ef,function(_0x3e0dc9){return!_['includes'](_0x4b2a3,_0x3e0dc9[_0x90f4('0x42')][_0x90f4('0x43')]());})){throw new db[(_0x90f4('0x31'))][(_0x90f4('0x32'))](_0x90f4('0x44'));}}}var _0x2369ca={};_0x2369ca['senderName']=_0x393840['body']['hasOwnProperty']('senderName')?_0x393840['body'][_0x90f4('0x45')]:_0x393840[_0x90f4('0x41')]['fullname'];_0x2369ca[_0x90f4('0x46')]=_[_0x90f4('0x47')](_0x393840[_0x90f4('0x2e')][_0x90f4('0x46')])?null:_0x393840[_0x90f4('0x2e')][_0x90f4('0x46')];_0x2369ca[_0x90f4('0x48')]=_0x393840[_0x90f4('0x2e')][_0x90f4('0x48')]||![];_0x2369ca[_0x90f4('0x49')]=_0x393840[_0x90f4('0x41')]['id'];return getContent(_0x393840[_0x90f4('0x2e')])[_0x90f4('0x27')](function(_0x398417){_0x2369ca[_0x90f4('0x2e')]=_0x398417;return getRecipients(_0x4353ef);})[_0x90f4('0x27')](function(_0xc15d25){_0x2369ca['recipientsId']=_[_0x90f4('0x4a')](_0xc15d25)[_0x90f4('0x4b')](',');return db[_0x90f4('0x4c')][_0x90f4('0x4d')](function(_0x7ab989){return db[_0x90f4('0x4e')][_0x90f4('0x4f')](_0x2369ca,{'raw':!![],'transaction':_0x7ab989})[_0x90f4('0x27')](function(_0x14e784){var _0x456427={'sender':_0x2369ca[_0x90f4('0x45')],'description':_0x2369ca['recipientsDescription'],'content':_0x2369ca['body'],'beep':_0x2369ca[_0x90f4('0x48')]};_0xc15d25[_0x90f4('0x50')](function(_0x1d9c87){_0x456427[_0x90f4('0x51')]=_0x1d9c87;socket['emit'](_0x90f4('0x52'),_0x456427);});return _0x14e784;});});})[_0x90f4('0x27')](respondWithResult(_0x31453e,0xc9))['catch'](handleError(_0x31453e,null));};function getContent(_0x5cb3cf){return new BPromise(function(_0x252fdd,_0x20fac6){if(_0x5cb3cf['text']){_0x252fdd(_0x5cb3cf['text']);return;}return db['Template'][_0x90f4('0x53')]({'attributes':[_0x90f4('0x54')],'where':{'id':_0x5cb3cf['TemplateId']},'raw':!![]})[_0x90f4('0x27')](function(_0x426af1){if(!_0x426af1)throw new db[(_0x90f4('0x31'))]['ValidationError'](_0x90f4('0x55'));var _0x31b964=Mustache[_0x90f4('0x56')](_0x426af1['html'],_0x5cb3cf[_0x90f4('0x34')]);_0x252fdd(_0x31b964);})[_0x90f4('0x57')](function(_0x2f1ed1){_0x20fac6(_0x2f1ed1);});});}function getRecipients(_0x278e74){return new BPromise(function(_0x3f04ee,_0x28dbd6){var _0x1ab6f1=[];var _0xbfb3b5=[];_0x278e74[_0x90f4('0x50')](function(_0x1d04b4){var _0x195884=_[_0x90f4('0x58')](_0x1d04b4[_0x90f4('0x42')][_0x90f4('0x43')]());if(_0x195884===_0x90f4('0x59')){_0x1ab6f1=_[_0x90f4('0x5a')](_0x1ab6f1,_0x1d04b4[_0x90f4('0x5b')]);}else{if(_['includes'](_0x195884,'queue'))_0x195884=_0x195884[_0x90f4('0x5c')](_0x90f4('0x5d'),_0x90f4('0x5e'));_0x1d04b4[_0x90f4('0x5b')]['forEach'](function(_0x484e58){_0xbfb3b5['push'](getAgents(_0x195884,_0x484e58));});}});return BPromise['all'](_0xbfb3b5)[_0x90f4('0x27')](function(_0x28fee0){_0x1ab6f1=_[_0x90f4('0x5a')](_0x1ab6f1,_[_0x90f4('0x5f')](_0x28fee0));_0x3f04ee(_0x1ab6f1);})[_0x90f4('0x57')](function(_0x3b9acf){_0x28dbd6(_0x3b9acf);});});}function getAgents(_0x3ed383,_0x49d924){return new BPromise(function(_0x592b31,_0x29791c){return db[_0x3ed383]['findOne']({'where':{'id':_0x49d924}})[_0x90f4('0x27')](function(_0x52e96f){return _0x52e96f[_0x90f4('0x60')]({'attributes':['id'],'raw':!![]})[_0x90f4('0x27')](function(_0x312fcf){var _0x195043=_[_0x90f4('0x61')](_0x312fcf,'id');_0x592b31(_0x195043);});})['catch'](function(_0x1c06fb){_0x29791c(_0x1c06fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e279cf1..44c2aee 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 _0x3e71=['hasOwnProperty','hook','exports','UserNotification','save','update','remove','emit'];(function(_0x2a3eb6,_0x3a0365){var _0x1da934=function(_0x36e880){while(--_0x36e880){_0x2a3eb6['push'](_0x2a3eb6['shift']());}};_0x1da934(++_0x3a0365);}(_0x3e71,0x163));var _0x13e7=function(_0x1235e4,_0x3a6d5d){_0x1235e4=_0x1235e4-0x0;var _0xd01f09=_0x3e71[_0x1235e4];return _0xd01f09;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x13e7('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x13e7('0x1'),'afterUpdate':_0x13e7('0x2'),'afterDestroy':_0x13e7('0x3')};function emitEvent(_0x33bf1e){return function(_0x4a5dfb,_0x23453e,_0x100fb0){UserNotificationEvents[_0x13e7('0x4')](_0x33bf1e+':'+_0x4a5dfb['id'],_0x4a5dfb);UserNotificationEvents[_0x13e7('0x4')](_0x33bf1e,_0x4a5dfb);_0x100fb0(null);};}for(var e in events){if(events[_0x13e7('0x5')](e)){var event=events[e];UserNotification[_0x13e7('0x6')](e,emitEvent(event));}}module[_0x13e7('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xe114=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x5bbc10,_0x552029){var _0x37936d=function(_0xf6b6fe){while(--_0xf6b6fe){_0x5bbc10['push'](_0x5bbc10['shift']());}};_0x37936d(++_0x552029);}(_0xe114,0x175));var _0x4e11=function(_0x55fd87,_0x17854a){_0x55fd87=_0x55fd87-0x0;var _0x3d022f=_0xe114[_0x55fd87];return _0x3d022f;};'use strict';var EventEmitter=require(_0x4e11('0x0'));var UserNotification=require(_0x4e11('0x1'))['db'][_0x4e11('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4e11('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4e11('0x4')};function emitEvent(_0x839c1e){return function(_0x6e4db8,_0x1cf95f,_0x349aaf){UserNotificationEvents[_0x4e11('0x5')](_0x839c1e+':'+_0x6e4db8['id'],_0x6e4db8);UserNotificationEvents[_0x4e11('0x5')](_0x839c1e,_0x6e4db8);_0x349aaf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x4e11('0x6')](e,emitEvent(event));}}module[_0x4e11('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 83aaa03..dd02023 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 _0x48eb=['path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x519873,_0x30677d){var _0x25a199=function(_0x191221){while(--_0x191221){_0x519873['push'](_0x519873['shift']());}};_0x25a199(++_0x30677d);}(_0x48eb,0x1f3));var _0xb48e=function(_0x412a1e,_0x21fa5c){_0x412a1e=_0x412a1e-0x0;var _0x3f7c1a=_0x48eb[_0x412a1e];return _0x3f7c1a;};'use strict';var _=require(_0xb48e('0x0'));var util=require(_0xb48e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb48e('0x2'));var BPromise=require(_0xb48e('0x3'));var rp=require(_0xb48e('0x4'));var fs=require('fs');var path=require(_0xb48e('0x5'));var rimraf=require(_0xb48e('0x6'));var config=require(_0xb48e('0x7'));var attributes=require('./userNotification.attributes');module[_0xb48e('0x8')]=function(_0x51e842,_0x3f2e59){return _0x51e842[_0xb48e('0x9')](_0xb48e('0xa'),attributes,{'tableName':_0xb48e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb48e('0xc'),'collate':_0xb48e('0xd')});}; \ No newline at end of file +var _0x2f87=['userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x2f87,0xe2));var _0x72f8=function(_0x4bde34,_0x895f5f){_0x4bde34=_0x4bde34-0x0;var _0x3a04dd=_0x2f87[_0x4bde34];return _0x3a04dd;};'use strict';var _=require(_0x72f8('0x0'));var util=require('util');var logger=require(_0x72f8('0x1'))(_0x72f8('0x2'));var moment=require('moment');var BPromise=require(_0x72f8('0x3'));var rp=require(_0x72f8('0x4'));var fs=require('fs');var path=require(_0x72f8('0x5'));var rimraf=require(_0x72f8('0x6'));var config=require(_0x72f8('0x7'));var attributes=require(_0x72f8('0x8'));module[_0x72f8('0x9')]=function(_0x45e204,_0x345071){return _0x45e204[_0x72f8('0xa')](_0x72f8('0xb'),attributes,{'tableName':_0x72f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x72f8('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index dc5e96f..e2b8c88 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 _0x74f9=['../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dad20,_0x586458){var _0x154240=function(_0x5745e3){while(--_0x5745e3){_0x3dad20['push'](_0x3dad20['shift']());}};_0x154240(++_0x586458);}(_0x74f9,0xc4));var _0x974f=function(_0x37dab4,_0x5322ef){_0x37dab4=_0x37dab4-0x0;var _0x42eea8=_0x74f9[_0x37dab4];return _0x42eea8;};'use strict';var _=require(_0x974f('0x0'));var util=require(_0x974f('0x1'));var moment=require('moment');var BPromise=require(_0x974f('0x2'));var rs=require(_0x974f('0x3'));var fs=require('fs');var Redis=require(_0x974f('0x4'));var db=require(_0x974f('0x5'))['db'];var utils=require(_0x974f('0x6'));var logger=require(_0x974f('0x7'))('rpc');var config=require(_0x974f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x974f('0x9')][_0x974f('0xa')]({'port':0x232a});config[_0x974f('0xb')]=_[_0x974f('0xc')](config['redis'],{'host':_0x974f('0xd'),'port':0x18eb});var socket=require(_0x974f('0xe'))(new Redis(config[_0x974f('0xb')]));require(_0x974f('0xf'))[_0x974f('0x10')](socket);function respondWithRpcPromise(_0xfa56b8,_0x54942a,_0x19a01e){return new BPromise(function(_0x3f34dd,_0x30014a){return client[_0x974f('0x11')](_0xfa56b8,_0x19a01e)[_0x974f('0x12')](function(_0x2c42b0){logger[_0x974f('0x13')](_0x974f('0x14'),_0x54942a,_0x974f('0x15'));logger[_0x974f('0x16')](_0x974f('0x17'),_0x54942a,_0x974f('0x15'),JSON[_0x974f('0x18')](_0x2c42b0));if(_0x2c42b0['error']){if(_0x2c42b0[_0x974f('0x19')][_0x974f('0x1a')]===0x1f4){logger[_0x974f('0x19')](_0x974f('0x14'),_0x54942a,_0x2c42b0[_0x974f('0x19')][_0x974f('0x1b')]);return _0x30014a(_0x2c42b0['error']['message']);}logger[_0x974f('0x19')]('UserNotification,\x20%s,\x20%s',_0x54942a,_0x2c42b0[_0x974f('0x19')][_0x974f('0x1b')]);return _0x3f34dd(_0x2c42b0[_0x974f('0x19')][_0x974f('0x1b')]);}else{logger[_0x974f('0x13')](_0x974f('0x14'),_0x54942a,_0x974f('0x15'));_0x3f34dd(_0x2c42b0[_0x974f('0x1c')]['message']);}})['catch'](function(_0x3c4ccd){logger[_0x974f('0x19')](_0x974f('0x14'),_0x54942a,_0x3c4ccd);_0x30014a(_0x3c4ccd);});});} \ No newline at end of file +var _0x914e=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x3d0198,_0x94b95c){var _0x3488b2=function(_0x1483ba){while(--_0x1483ba){_0x3d0198['push'](_0x3d0198['shift']());}};_0x3488b2(++_0x94b95c);}(_0x914e,0x19e));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe914('0x0'));var util=require(_0xe914('0x1'));var moment=require(_0xe914('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe914('0x3'));var db=require(_0xe914('0x4'))['db'];var utils=require(_0xe914('0x5'));var logger=require(_0xe914('0x6'))(_0xe914('0x7'));var config=require(_0xe914('0x8'));var jayson=require(_0xe914('0x9'));var client=jayson['client'][_0xe914('0xa')]({'port':0x232a});config[_0xe914('0xb')]=_[_0xe914('0xc')](config[_0xe914('0xb')],{'host':_0xe914('0xd'),'port':0x18eb});var socket=require(_0xe914('0xe'))(new Redis(config[_0xe914('0xb')]));require(_0xe914('0xf'))[_0xe914('0x10')](socket);function respondWithRpcPromise(_0x51bac8,_0x3777ff,_0x4c6923){return new BPromise(function(_0xbd32b6,_0x409f72){return client[_0xe914('0x11')](_0x51bac8,_0x4c6923)[_0xe914('0x12')](function(_0x2ff707){logger[_0xe914('0x13')](_0xe914('0x14'),_0x3777ff,_0xe914('0x15'));logger['debug'](_0xe914('0x16'),_0x3777ff,_0xe914('0x15'),JSON['stringify'](_0x2ff707));if(_0x2ff707[_0xe914('0x17')]){if(_0x2ff707[_0xe914('0x17')][_0xe914('0x18')]===0x1f4){logger[_0xe914('0x17')]('UserNotification,\x20%s,\x20%s',_0x3777ff,_0x2ff707['error'][_0xe914('0x19')]);return _0x409f72(_0x2ff707['error']['message']);}logger[_0xe914('0x17')](_0xe914('0x14'),_0x3777ff,_0x2ff707['error']['message']);return _0xbd32b6(_0x2ff707['error']['message']);}else{logger[_0xe914('0x13')](_0xe914('0x14'),_0x3777ff,_0xe914('0x15'));_0xbd32b6(_0x2ff707['result']['message']);}})[_0xe914('0x1a')](function(_0x204d85){logger[_0xe914('0x17')](_0xe914('0x14'),_0x3777ff,_0x204d85);_0x409f72(_0x204d85);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index cce4f2d..55aa975 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 _0x9a37=['emit','register','userNotification:','./userNotification.events','save','remove','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9a37,0x17d));var _0x79a3=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x9a37[_0x427d3a];return _0xe5c521;};'use strict';var UserNotificationEvents=require(_0x79a3('0x0'));var events=[_0x79a3('0x1'),_0x79a3('0x2'),_0x79a3('0x3')];function createListener(_0x7273ff,_0x1518cc){return function(_0x117511){_0x1518cc[_0x79a3('0x4')](_0x7273ff,_0x117511);};}function removeListener(_0x1b68e8,_0x732b92){return function(){UserNotificationEvents['removeListener'](_0x1b68e8,_0x732b92);};}exports[_0x79a3('0x5')]=function(_0x566a18){for(var _0xb857de=0x0,_0x460ad2=events['length'];_0xb857de<_0x460ad2;_0xb857de++){var _0x1ea19c=events[_0xb857de];var _0x158ff5=createListener(_0x79a3('0x6')+_0x1ea19c,_0x566a18);UserNotificationEvents['on'](_0x1ea19c,_0x158ff5);}}; \ No newline at end of file +var _0xd840=['update','emit','removeListener','register','userNotification:','save','remove'];(function(_0xa0dec3,_0x39961b){var _0x27078b=function(_0x513c5e){while(--_0x513c5e){_0xa0dec3['push'](_0xa0dec3['shift']());}};_0x27078b(++_0x39961b);}(_0xd840,0x6e));var _0x0d84=function(_0xd197a4,_0x959fe6){_0xd197a4=_0xd197a4-0x0;var _0x5048cf=_0xd840[_0xd197a4];return _0x5048cf;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0d84('0x0'),_0x0d84('0x1'),_0x0d84('0x2')];function createListener(_0x5938e7,_0x27bdb2){return function(_0x2bbf61){_0x27bdb2[_0x0d84('0x3')](_0x5938e7,_0x2bbf61);};}function removeListener(_0x74569f,_0x13ae99){return function(){UserNotificationEvents[_0x0d84('0x4')](_0x74569f,_0x13ae99);};}exports[_0x0d84('0x5')]=function(_0x1c4c05){for(var _0x4a0330=0x0,_0x201dbe=events['length'];_0x4a0330<_0x201dbe;_0x4a0330++){var _0x179213=events[_0x4a0330];var _0x1212fd=createListener(_0x0d84('0x6')+_0x179213,_0x1c4c05);UserNotificationEvents['on'](_0x179213,_0x1212fd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e68055a..1e4c19e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x174e10,_0x32f58c){var _0x4184c5=function(_0x4988aa){while(--_0x4988aa){_0x174e10['push'](_0x174e10['shift']());}};_0x4184c5(++_0x32f58c);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d0467,_0x44e0c9){var _0x39c0af=function(_0x423464){while(--_0x423464){_0x4d0467['push'](_0x4d0467['shift']());}};_0x39c0af(++_0x44e0c9);}(_0xe706,0xa3));var _0x6e70=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0xe706[_0x12b830];return _0x261dc4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 3e8798a..ee42f11 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 _0x7a44=['sequelize','INTEGER'];(function(_0x5f47e1,_0x4df8f8){var _0x3aa9c7=function(_0x26bdf2){while(--_0x26bdf2){_0x5f47e1['push'](_0x5f47e1['shift']());}};_0x3aa9c7(++_0x4df8f8);}(_0x7a44,0x196));var _0x47a4=function(_0x14207e,_0x393694){_0x14207e=_0x14207e-0x0;var _0x36d3f8=_0x7a44[_0x14207e];return _0x36d3f8;};'use strict';var Sequelize=require(_0x47a4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x47a4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e64=['sequelize','exports'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x3e64,0xa6));var _0x43e6=function(_0xc487b9,_0x13b645){_0xc487b9=_0xc487b9-0x0;var _0x239f28=_0x3e64[_0xc487b9];return _0x239f28;};'use strict';var Sequelize=require(_0x43e6('0x0'));module[_0x43e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 88f6466..02b3137 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 _0x7df2=['bluebird','path','../../config/environment','exports','define','user_has_openchannel_queues','lodash','api','moment'];(function(_0x5d8042,_0x3eb667){var _0x48c3f0=function(_0x13215b){while(--_0x13215b){_0x5d8042['push'](_0x5d8042['shift']());}};_0x48c3f0(++_0x3eb667);}(_0x7df2,0x1c8));var _0x27df=function(_0x45f35b,_0x5c8717){_0x45f35b=_0x45f35b-0x0;var _0x2b1d78=_0x7df2[_0x45f35b];return _0x2b1d78;};'use strict';var _=require(_0x27df('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x27df('0x1'));var moment=require(_0x27df('0x2'));var BPromise=require(_0x27df('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27df('0x4'));var rimraf=require('rimraf');var config=require(_0x27df('0x5'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x27df('0x6')]=function(_0x2e394,_0x4c2fbc){return _0x2e394[_0x27df('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0x27df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfff4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x111a39,_0xb24f25){var _0x15229f=function(_0x938706){while(--_0x938706){_0x111a39['push'](_0x111a39['shift']());}};_0x15229f(++_0xb24f25);}(_0xfff4,0x70));var _0x4fff=function(_0x19ac66,_0x475902){_0x19ac66=_0x19ac66-0x0;var _0x328550=_0xfff4[_0x19ac66];return _0x328550;};'use strict';var _=require(_0x4fff('0x0'));var util=require(_0x4fff('0x1'));var logger=require(_0x4fff('0x2'))(_0x4fff('0x3'));var moment=require(_0x4fff('0x4'));var BPromise=require(_0x4fff('0x5'));var rp=require(_0x4fff('0x6'));var fs=require('fs');var path=require(_0x4fff('0x7'));var rimraf=require(_0x4fff('0x8'));var config=require(_0x4fff('0x9'));var attributes=require(_0x4fff('0xa'));module[_0x4fff('0xb')]=function(_0x56ddca,_0x37d772){return _0x56ddca[_0x4fff('0xc')](_0x4fff('0xd'),attributes,{'tableName':'user_has_openchannel_queues','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 6102f24..9c0e6e8 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 _0x46f6=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x4d9a21,_0x5bc8d1){var _0x1a5d25=function(_0x23feab){while(--_0x23feab){_0x4d9a21['push'](_0x4d9a21['shift']());}};_0x1a5d25(++_0x5bc8d1);}(_0x46f6,0xf3));var _0x646f=function(_0x4307d1,_0x101a4a){_0x4307d1=_0x4307d1-0x0;var _0x518fe8=_0x46f6[_0x4307d1];return _0x518fe8;};'use strict';var _=require(_0x646f('0x0'));var util=require('util');var moment=require(_0x646f('0x1'));var BPromise=require(_0x646f('0x2'));var rs=require(_0x646f('0x3'));var fs=require('fs');var Redis=require(_0x646f('0x4'));var db=require(_0x646f('0x5'))['db'];var utils=require(_0x646f('0x6'));var logger=require(_0x646f('0x7'))(_0x646f('0x8'));var config=require('../../config/environment');var jayson=require(_0x646f('0x9'));var client=jayson['client'][_0x646f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x445c2d,_0x3333e7,_0x3efee9){return new BPromise(function(_0x244da1,_0x3ddf20){return client['request'](_0x445c2d,_0x3efee9)['then'](function(_0x620fac){logger[_0x646f('0xb')](_0x646f('0xc'),_0x3333e7,_0x646f('0xd'));logger[_0x646f('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3333e7,_0x646f('0xd'),JSON['stringify'](_0x620fac));if(_0x620fac[_0x646f('0xf')]){if(_0x620fac['error'][_0x646f('0x10')]===0x1f4){logger[_0x646f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3333e7,_0x620fac['error'][_0x646f('0x11')]);return _0x3ddf20(_0x620fac[_0x646f('0xf')][_0x646f('0x11')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3333e7,_0x620fac[_0x646f('0xf')][_0x646f('0x11')]);return _0x244da1(_0x620fac[_0x646f('0xf')][_0x646f('0x11')]);}else{logger[_0x646f('0xb')](_0x646f('0xc'),_0x3333e7,_0x646f('0xd'));_0x244da1(_0x620fac[_0x646f('0x12')][_0x646f('0x11')]);}})[_0x646f('0x13')](function(_0xe355da){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3333e7,_0xe355da);_0x3ddf20(_0xe355da);});});} \ No newline at end of file +var _0x9595=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x9595,0x18a));var _0x5959=function(_0x361475,_0x32ecc5){_0x361475=_0x361475-0x0;var _0x317cf1=_0x9595[_0x361475];return _0x317cf1;};'use strict';var _=require(_0x5959('0x0'));var util=require('util');var moment=require(_0x5959('0x1'));var BPromise=require('bluebird');var rs=require(_0x5959('0x2'));var fs=require('fs');var Redis=require(_0x5959('0x3'));var db=require(_0x5959('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5959('0x5'))(_0x5959('0x6'));var config=require('../../config/environment');var jayson=require(_0x5959('0x7'));var client=jayson[_0x5959('0x8')][_0x5959('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56133,_0x1422d0,_0x40201c){return new BPromise(function(_0x165881,_0x239668){return client[_0x5959('0xa')](_0x56133,_0x40201c)[_0x5959('0xb')](function(_0x25ec7d){logger[_0x5959('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1422d0,_0x5959('0xd'));logger[_0x5959('0xe')](_0x5959('0xf'),_0x1422d0,_0x5959('0xd'),JSON[_0x5959('0x10')](_0x25ec7d));if(_0x25ec7d[_0x5959('0x11')]){if(_0x25ec7d[_0x5959('0x11')]['code']===0x1f4){logger[_0x5959('0x11')](_0x5959('0x12'),_0x1422d0,_0x25ec7d[_0x5959('0x11')][_0x5959('0x13')]);return _0x239668(_0x25ec7d[_0x5959('0x11')][_0x5959('0x13')]);}logger[_0x5959('0x11')](_0x5959('0x12'),_0x1422d0,_0x25ec7d[_0x5959('0x11')]['message']);return _0x165881(_0x25ec7d[_0x5959('0x11')][_0x5959('0x13')]);}else{logger['info'](_0x5959('0x12'),_0x1422d0,_0x5959('0xd'));_0x165881(_0x25ec7d['result']['message']);}})[_0x5959('0x14')](function(_0x9fbdb8){logger[_0x5959('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1422d0,_0x9fbdb8);_0x239668(_0x9fbdb8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e8b0604..089dfd6 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 _0x99e1=['getSections','getResources','create','/:id/clone','clone','post','addSections','/:id/resources','addResources','put','update','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x99e1,0x8a));var _0x199e=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x99e1[_0x3a9661];return _0x5bb119;};'use strict';var multer=require(_0x199e('0x0'));var util=require(_0x199e('0x1'));var path=require(_0x199e('0x2'));var timeout=require(_0x199e('0x3'));var express=require(_0x199e('0x4'));var router=express[_0x199e('0x5')]();var fs_extra=require(_0x199e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x199e('0x7'));var config=require(_0x199e('0x8'));var controller=require(_0x199e('0x9'));router[_0x199e('0xa')]('/',auth[_0x199e('0xb')](),controller[_0x199e('0xc')]);router['get']('/describe',auth[_0x199e('0xb')](),controller[_0x199e('0xd')]);router[_0x199e('0xa')](_0x199e('0xe'),auth[_0x199e('0xb')](),controller[_0x199e('0xf')]);router[_0x199e('0xa')](_0x199e('0x10'),auth['isAuthenticated'](),controller[_0x199e('0x11')]);router[_0x199e('0xa')]('/:id/resources',auth[_0x199e('0xb')](),controller[_0x199e('0x12')]);router['post']('/',auth[_0x199e('0xb')](),controller[_0x199e('0x13')]);router['post'](_0x199e('0x14'),auth[_0x199e('0xb')](),controller[_0x199e('0x15')]);router[_0x199e('0x16')](_0x199e('0x10'),auth['isAuthenticated'](),controller[_0x199e('0x17')]);router[_0x199e('0x16')](_0x199e('0x18'),auth[_0x199e('0xb')](),controller[_0x199e('0x19')]);router[_0x199e('0x1a')]('/:id',auth[_0x199e('0xb')](),controller[_0x199e('0x1b')]);router['delete']('/:id',auth[_0x199e('0xb')](),controller[_0x199e('0x1c')]);router[_0x199e('0x1d')](_0x199e('0x10'),auth[_0x199e('0xb')](),controller['removeSections']);router[_0x199e('0x1d')](_0x199e('0x18'),auth['isAuthenticated'](),controller['removeResources']);module[_0x199e('0x1e')]=router; \ No newline at end of file +var _0x0162=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone','/:id','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout'];(function(_0x497d6d,_0xff7558){var _0x4a1d9a=function(_0x2d2fdf){while(--_0x2d2fdf){_0x497d6d['push'](_0x497d6d['shift']());}};_0x4a1d9a(++_0xff7558);}(_0x0162,0x184));var _0x2016=function(_0x50d4b7,_0x1e7aa3){_0x50d4b7=_0x50d4b7-0x0;var _0x820e1c=_0x0162[_0x50d4b7];return _0x820e1c;};'use strict';var multer=require(_0x2016('0x0'));var util=require(_0x2016('0x1'));var path=require(_0x2016('0x2'));var timeout=require(_0x2016('0x3'));var express=require('express');var router=express[_0x2016('0x4')]();var fs_extra=require(_0x2016('0x5'));var auth=require(_0x2016('0x6'));var interaction=require(_0x2016('0x7'));var config=require(_0x2016('0x8'));var controller=require('./userProfile.controller');router[_0x2016('0x9')]('/',auth[_0x2016('0xa')](),controller[_0x2016('0xb')]);router['get'](_0x2016('0xc'),auth['isAuthenticated'](),controller[_0x2016('0xd')]);router[_0x2016('0x9')]('/:id',auth[_0x2016('0xa')](),controller[_0x2016('0xe')]);router['get'](_0x2016('0xf'),auth[_0x2016('0xa')](),controller[_0x2016('0x10')]);router['get'](_0x2016('0x11'),auth['isAuthenticated'](),controller['getResources']);router[_0x2016('0x12')]('/',auth['isAuthenticated'](),controller[_0x2016('0x13')]);router[_0x2016('0x12')](_0x2016('0x14'),auth['isAuthenticated'](),controller[_0x2016('0x15')]);router[_0x2016('0x12')](_0x2016('0xf'),auth[_0x2016('0xa')](),controller['addSections']);router[_0x2016('0x12')]('/:id/resources',auth[_0x2016('0xa')](),controller['addResources']);router['put'](_0x2016('0x16'),auth[_0x2016('0xa')](),controller['update']);router[_0x2016('0x17')]('/:id',auth[_0x2016('0xa')](),controller[_0x2016('0x18')]);router[_0x2016('0x17')](_0x2016('0xf'),auth[_0x2016('0xa')](),controller[_0x2016('0x19')]);router[_0x2016('0x17')](_0x2016('0x11'),auth[_0x2016('0xa')](),controller[_0x2016('0x1a')]);module[_0x2016('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index dbc935b..b4b1f12 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 _0x64fc=['split','BOOLEAN','sequelize','exports','STRING','name','join','getDataValue','crudPermissions'];(function(_0x48f97e,_0x4e0d46){var _0x47c77b=function(_0x5f0aa3){while(--_0x5f0aa3){_0x48f97e['push'](_0x48f97e['shift']());}};_0x47c77b(++_0x4e0d46);}(_0x64fc,0x89));var _0xc64f=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x64fc[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xc64f('0x0'));module[_0xc64f('0x1')]={'name':{'type':Sequelize[_0xc64f('0x2')],'allowNull':![],'unique':_0xc64f('0x3')},'crudPermissions':{'type':Sequelize[_0xc64f('0x2')],'set':function(_0x5c695f){this['setDataValue']('crudPermissions',_0x5c695f?_0x5c695f[_0xc64f('0x4')](''):[]);},'get':function(){return this[_0xc64f('0x5')]('crudPermissions')?this[_0xc64f('0x5')](_0xc64f('0x6'))[_0xc64f('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xc64f('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xc64f('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xc64f('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xc64f('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc64f('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8266=['STRING','name','setDataValue','join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8266,0x1d4));var _0x6826=function(_0xa20483,_0x55b137){_0xa20483=_0xa20483-0x0;var _0x4f829d=_0x8266[_0xa20483];return _0x4f829d;};'use strict';var Sequelize=require(_0x6826('0x0'));module[_0x6826('0x1')]={'name':{'type':Sequelize[_0x6826('0x2')],'allowNull':![],'unique':_0x6826('0x3')},'crudPermissions':{'type':Sequelize[_0x6826('0x2')],'set':function(_0x4dfaae){this[_0x6826('0x4')]('crudPermissions',_0x4dfaae?_0x4dfaae[_0x6826('0x5')](''):[]);},'get':function(){return this[_0x6826('0x6')](_0x6826('0x7'))?this[_0x6826('0x6')](_0x6826('0x7'))[_0x6826('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6826('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6826('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6826('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6826('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6826('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6826('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f7f3c47..7833605 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 _0xb4e2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','show','length','find','create','catch','params','get','omit','createdAt','updatedAt','body','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','addSections','userProfileId','push','removeSections','getSections','filter','enabled','isEmpty','subsections','includes','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','getResources','Missing\x20section\x20parameter','nolimit','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xc2300e,_0x522e47){var _0x31345b=function(_0x174fe2){while(--_0x174fe2){_0xc2300e['push'](_0xc2300e['shift']());}};_0x31345b(++_0x522e47);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x447f35,_0x5c5c87){_0x447f35=_0x447f35-0x0;var _0x16752a=_0xb4e2[_0x447f35];return _0x16752a;};'use strict';var emlformat=require(_0x2b4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b4e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b4e('0x2'));var util=require(_0x2b4e('0x3'));var path=require(_0x2b4e('0x4'));var sox=require(_0x2b4e('0x5'));var csv=require(_0x2b4e('0x6'));var ejs=require(_0x2b4e('0x7'));var fs=require('fs');var fs_extra=require(_0x2b4e('0x8'));var _=require('lodash');var squel=require(_0x2b4e('0x9'));var crypto=require(_0x2b4e('0xa'));var jsforce=require(_0x2b4e('0xb'));var deskjs=require(_0x2b4e('0xc'));var toCsv=require(_0x2b4e('0x6'));var querystring=require(_0x2b4e('0xd'));var Papa=require(_0x2b4e('0xe'));var Redis=require(_0x2b4e('0xf'));var authService=require(_0x2b4e('0x10'));var qs=require(_0x2b4e('0x11'));var as=require(_0x2b4e('0x12'));var hardwareService=require(_0x2b4e('0x13'));var logger=require(_0x2b4e('0x14'))(_0x2b4e('0x15'));var utils=require('../../config/utils');var config=require(_0x2b4e('0x16'));var licenseUtil=require(_0x2b4e('0x17'));var db=require(_0x2b4e('0x18'))['db'];config[_0x2b4e('0x19')]=_['defaults'](config[_0x2b4e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b4e('0x1a'))(new Redis(config[_0x2b4e('0x19')]));require(_0x2b4e('0x1b'))[_0x2b4e('0x1c')](socket);function respondWithStatusCode(_0x161666,_0x94c6c8){_0x94c6c8=_0x94c6c8||0xcc;return function(_0x4a0c25){if(_0x4a0c25){return _0x161666[_0x2b4e('0x1d')](_0x94c6c8);}return _0x161666[_0x2b4e('0x1e')](_0x94c6c8)[_0x2b4e('0x1f')]();};}function respondWithResult(_0x4d329f,_0x1d39af){_0x1d39af=_0x1d39af||0xc8;return function(_0x2d6d8c){if(_0x2d6d8c){return _0x4d329f['status'](_0x1d39af)[_0x2b4e('0x20')](_0x2d6d8c);}};}function respondWithFilteredResult(_0x58dd44,_0x3d9c2d){return function(_0x30b754){if(_0x30b754){var _0xb8b550=typeof _0x3d9c2d[_0x2b4e('0x21')]===_0x2b4e('0x22')&&typeof _0x3d9c2d[_0x2b4e('0x23')]===_0x2b4e('0x22');var _0x383da2=_0x30b754[_0x2b4e('0x24')];var _0x4c8110=_0xb8b550?0x0:_0x3d9c2d[_0x2b4e('0x21')];var _0x5c920a=_0xb8b550?_0x30b754[_0x2b4e('0x24')]:_0x3d9c2d[_0x2b4e('0x21')]+_0x3d9c2d[_0x2b4e('0x23')];var _0x45f7e3;if(_0x5c920a>=_0x383da2){_0x5c920a=_0x383da2;_0x45f7e3=0xc8;}else{_0x45f7e3=0xce;}_0x58dd44['status'](_0x45f7e3);return _0x58dd44[_0x2b4e('0x25')](_0x2b4e('0x26'),_0x4c8110+'-'+_0x5c920a+'/'+_0x383da2)[_0x2b4e('0x20')](_0x30b754);}return null;};}function patchUpdates(_0x4ce70f){return function(_0x1b0b8f){try{jsonpatch[_0x2b4e('0x27')](_0x1b0b8f,_0x4ce70f,!![]);}catch(_0x487a3d){return BPromise[_0x2b4e('0x28')](_0x487a3d);}return _0x1b0b8f['save']();};}function saveUpdates(_0x26c36a,_0x3462cd){return function(_0x4911d6){if(_0x4911d6){return _0x4911d6['update'](_0x26c36a)[_0x2b4e('0x29')](function(_0x258090){return _0x258090;});}return null;};}function removeEntity(_0x2eb2e2,_0x47b641){return function(_0x327555){if(_0x327555){return _0x327555[_0x2b4e('0x2a')]()[_0x2b4e('0x29')](function(){_0x2eb2e2[_0x2b4e('0x1e')](0xcc)[_0x2b4e('0x1f')]();});}};}function handleEntityNotFound(_0x435926,_0x37c9f0){return function(_0x18289b){if(!_0x18289b){_0x435926[_0x2b4e('0x1d')](0x194);}return _0x18289b;};}function handleError(_0x54384b,_0x3daddb){_0x3daddb=_0x3daddb||0x1f4;return function(_0x2776fb){logger[_0x2b4e('0x2b')](_0x2776fb[_0x2b4e('0x2c')]);if(_0x2776fb['name']){delete _0x2776fb['name'];}_0x54384b['status'](_0x3daddb)[_0x2b4e('0x2d')](_0x2776fb);};}exports[_0x2b4e('0x2e')]=function(_0x3ada5d,_0x5377fc){var _0x1feebb={},_0x5771d7={},_0x596fb6={'count':0x0,'rows':[]};var _0x31fc89=_[_0x2b4e('0x2f')](db[_0x2b4e('0x30')][_0x2b4e('0x31')],function(_0x3ba601){return{'name':_0x3ba601[_0x2b4e('0x32')],'type':_0x3ba601[_0x2b4e('0x33')]['key']};});_0x5771d7[_0x2b4e('0x34')]=_[_0x2b4e('0x2f')](_0x31fc89,_0x2b4e('0x35'));_0x5771d7[_0x2b4e('0x36')]=_[_0x2b4e('0x37')](_0x3ada5d['query']);_0x5771d7[_0x2b4e('0x38')]=_[_0x2b4e('0x39')](_0x5771d7[_0x2b4e('0x34')],_0x5771d7[_0x2b4e('0x36')]);_0x1feebb['attributes']=_[_0x2b4e('0x39')](_0x5771d7[_0x2b4e('0x34')],qs['fields'](_0x3ada5d['query'][_0x2b4e('0x3a')]));_0x1feebb[_0x2b4e('0x3b')]=_0x1feebb[_0x2b4e('0x3b')]['length']?_0x1feebb[_0x2b4e('0x3b')]:_0x5771d7[_0x2b4e('0x34')];if(!_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x3c')]('nolimit')){_0x1feebb['limit']=qs[_0x2b4e('0x23')](_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x23')]);_0x1feebb[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x21')]);}_0x1feebb['order']=qs['sort'](_0x3ada5d['query'][_0x2b4e('0x3d')]);_0x1feebb[_0x2b4e('0x3e')]=qs[_0x2b4e('0x38')](_[_0x2b4e('0x3f')](_0x3ada5d[_0x2b4e('0x36')],_0x5771d7[_0x2b4e('0x38')]),_0x31fc89);if(_0x3ada5d['query']['filter']){_0x1feebb[_0x2b4e('0x3e')]=_['merge'](_0x1feebb[_0x2b4e('0x3e')],{'$or':_[_0x2b4e('0x2f')](_0x31fc89,function(_0x1bd74f){if(_0x1bd74f[_0x2b4e('0x33')]!==_0x2b4e('0x40')){var _0x4eb0e1={};_0x4eb0e1[_0x1bd74f[_0x2b4e('0x35')]]={'$like':'%'+_0x3ada5d[_0x2b4e('0x36')]['filter']+'%'};return _0x4eb0e1;}})});}_0x1feebb=_[_0x2b4e('0x41')]({},_0x1feebb,_0x3ada5d[_0x2b4e('0x42')]);var _0xa427b1={'where':_0x1feebb[_0x2b4e('0x3e')]};return db[_0x2b4e('0x30')][_0x2b4e('0x24')](_0xa427b1)['then'](function(_0xc07f2b){_0x596fb6['count']=_0xc07f2b;if(_0x3ada5d[_0x2b4e('0x36')][_0x2b4e('0x43')]){_0x1feebb[_0x2b4e('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x2b4e('0x45')](_0x1feebb);})[_0x2b4e('0x29')](function(_0x29cd22){_0x596fb6['rows']=_0x29cd22;return _0x596fb6;})[_0x2b4e('0x29')](respondWithFilteredResult(_0x5377fc,_0x1feebb))['catch'](handleError(_0x5377fc,null));};exports[_0x2b4e('0x46')]=function(_0x544212,_0x59d439){var _0x29a143={'raw':![],'where':{'id':_0x544212['params']['id']}},_0x43f0d2={};_0x43f0d2['model']=_[_0x2b4e('0x37')](db[_0x2b4e('0x30')][_0x2b4e('0x31')]);_0x43f0d2[_0x2b4e('0x36')]=_[_0x2b4e('0x37')](_0x544212[_0x2b4e('0x36')]);_0x43f0d2[_0x2b4e('0x38')]=_[_0x2b4e('0x39')](_0x43f0d2[_0x2b4e('0x34')],_0x43f0d2[_0x2b4e('0x36')]);_0x29a143[_0x2b4e('0x3b')]=_[_0x2b4e('0x39')](_0x43f0d2[_0x2b4e('0x34')],qs[_0x2b4e('0x3a')](_0x544212['query']['fields']));_0x29a143[_0x2b4e('0x3b')]=_0x29a143[_0x2b4e('0x3b')][_0x2b4e('0x47')]?_0x29a143[_0x2b4e('0x3b')]:_0x43f0d2[_0x2b4e('0x34')];if(_0x544212[_0x2b4e('0x36')]['includeAll']){_0x29a143[_0x2b4e('0x44')]=[{'all':!![]}];}_0x29a143=_[_0x2b4e('0x41')]({},_0x29a143,_0x544212['options']);return db['UserProfile'][_0x2b4e('0x48')](_0x29a143)[_0x2b4e('0x29')](handleEntityNotFound(_0x59d439,null))[_0x2b4e('0x29')](respondWithResult(_0x59d439,null))['catch'](handleError(_0x59d439,null));};exports[_0x2b4e('0x49')]=function(_0x25aa50,_0x4c5ce1){return db[_0x2b4e('0x30')]['create'](_0x25aa50['body'],{})[_0x2b4e('0x29')](respondWithResult(_0x4c5ce1,0xc9))[_0x2b4e('0x4a')](handleError(_0x4c5ce1,null));};exports['clone']=function(_0x1f125a,_0x354c4c){var _0x24df80={'where':{'id':_0x1f125a[_0x2b4e('0x4b')]['id']}},_0x2648c4={};_0x2648c4['model']=_[_0x2b4e('0x37')](db[_0x2b4e('0x30')]['rawAttributes']);_0x24df80[_0x2b4e('0x3b')]=_['intersection'](_0x2648c4[_0x2b4e('0x34')],qs[_0x2b4e('0x3a')](_0x1f125a[_0x2b4e('0x36')][_0x2b4e('0x3a')]));_0x24df80['attributes']=_0x24df80['attributes'][_0x2b4e('0x47')]?_0x24df80[_0x2b4e('0x3b')]:_0x2648c4[_0x2b4e('0x34')];if(_0x1f125a[_0x2b4e('0x36')]['includeAll']){_0x24df80[_0x2b4e('0x44')]=[{'all':!![]}];}_0x24df80=_[_0x2b4e('0x41')]({},_0x24df80,_0x1f125a[_0x2b4e('0x42')]);return db[_0x2b4e('0x30')][_0x2b4e('0x48')](_0x24df80)[_0x2b4e('0x29')](handleEntityNotFound(_0x354c4c,null))[_0x2b4e('0x29')](function(_0x19c058){if(_0x19c058){var _0x5ba01c=_0x19c058[_0x2b4e('0x4c')]({'plain':!![]});_0x5ba01c=qs[_0x2b4e('0x4d')](_0x5ba01c,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f'),'crudPermissions']);_0x1f125a[_0x2b4e('0x50')]=_['omit'](_0x1f125a[_0x2b4e('0x50')],['id','createdAt',_0x2b4e('0x4f')]);return db[_0x2b4e('0x51')][_0x2b4e('0x52')](function(_0x57d430){return db[_0x2b4e('0x30')][_0x2b4e('0x49')](_[_0x2b4e('0x41')](_0x5ba01c,_0x1f125a['body']),{'include':_0x1f125a[_0x2b4e('0x36')][_0x2b4e('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x57d430})[_0x2b4e('0x29')](function(_0x13304e){var _0xb3784f=_0x13304e[_0x2b4e('0x4c')]({'plain':!![]});return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0x1f125a[_0x2b4e('0x4b')]['id']},'raw':!![]})['then'](function(_0x2687f8){if(_0x2687f8){return BPromise[_0x2b4e('0x54')](_0x2687f8,function(_0xb535c5){return new BPromise(function(_0x28be71,_0x12c517){if(_0xb535c5[_0x2b4e('0x55')]===null||_0xb535c5[_0x2b4e('0x55')]===0x1)_0x28be71(null);return db[_0x2b4e('0x56')][_0x2b4e('0x45')]({'where':{'sectionId':_0xb535c5['id']},'raw':!![]})['then'](function(_0x1be990){var _0x4f2369=_[_0x2b4e('0x2f')](_0x1be990,function(_0x38748a){return qs[_0x2b4e('0x4d')](_0x38748a,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f'),_0x2b4e('0x57')]);});_0x28be71(_0x4f2369);})[_0x2b4e('0x4a')](function(_0x514500){_0x12c517(_0x514500);});})['then'](function(_0x43df80){var _0x53ae6e=qs[_0x2b4e('0x4d')](_0xb535c5,['id',_0x2b4e('0x4e'),_0x2b4e('0x4f')]);_0x53ae6e['userProfileId']=_0xb3784f['id'];if(_0x43df80)_0x53ae6e[_0x2b4e('0x58')]=_0x43df80;return _0x53ae6e;})['then'](function(_0x38c305){return db['UserProfileSection'][_0x2b4e('0x49')](_0x38c305,{'include':[{'model':db[_0x2b4e('0x56')],'as':_0x2b4e('0x58')}],'raw':!![],'transaction':_0x57d430});});})[_0x2b4e('0x29')](function(){return _0xb3784f;});}});});});}})[_0x2b4e('0x29')](respondWithResult(_0x354c4c,0xc9))['catch'](handleError(_0x354c4c,null));};exports['update']=function(_0x51e7ec,_0x563d0a){if(_0x51e7ec[_0x2b4e('0x50')]['id']){delete _0x51e7ec[_0x2b4e('0x50')]['id'];}return db[_0x2b4e('0x30')][_0x2b4e('0x48')]({'where':{'id':_0x51e7ec[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x563d0a,null))[_0x2b4e('0x29')](saveUpdates(_0x51e7ec[_0x2b4e('0x50')],null))['then'](respondWithResult(_0x563d0a,null))[_0x2b4e('0x4a')](handleError(_0x563d0a,null));};exports['destroy']=function(_0x36f454,_0x6982fa){return db[_0x2b4e('0x30')]['find']({'where':{'id':_0x36f454['params']['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x6982fa,null))[_0x2b4e('0x29')](removeEntity(_0x6982fa,null))['catch'](handleError(_0x6982fa,null));};exports[_0x2b4e('0x59')]=function(_0x92c680,_0x49d1f0){return db[_0x2b4e('0x30')]['describe']()['then'](respondWithResult(_0x49d1f0,null))[_0x2b4e('0x4a')](handleError(_0x49d1f0,null));};exports[_0x2b4e('0x5a')]=function(_0x139370,_0x93cb19){var _0x99ff6c=_0x139370[_0x2b4e('0x50')];return db[_0x2b4e('0x30')][_0x2b4e('0x48')]({'where':{'id':_0x139370[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x93cb19,null))['then'](function(_0x233cff){if(_0x233cff){return db[_0x2b4e('0x51')][_0x2b4e('0x52')](function(_0x4192f7){return db[_0x2b4e('0x53')][_0x2b4e('0x2a')]({'where':{'userProfileId':_0x139370[_0x2b4e('0x4b')]['id'],'sectionId':_[_0x2b4e('0x2f')](_0x99ff6c,function(_0xf64a84){return _0xf64a84[_0x2b4e('0x57')];})},'transaction':_0x4192f7})['then'](function(){var _0x35ecd4=_[_0x2b4e('0x2f')](_0x99ff6c,function(_0x13b678){_0x13b678[_0x2b4e('0x5b')]=_0x139370[_0x2b4e('0x4b')]['id'];return _0x13b678;});var _0x567c56=[];return BPromise[_0x2b4e('0x54')](_0x35ecd4,function(_0x3f31b8){return db[_0x2b4e('0x53')][_0x2b4e('0x49')](_0x3f31b8,{'include':[{'model':db[_0x2b4e('0x56')],'as':_0x2b4e('0x58')}],'raw':!![],'transaction':_0x4192f7})[_0x2b4e('0x29')](function(_0x403549){_0x567c56[_0x2b4e('0x5c')](_0x403549['get']({'plain':!![]}));});})[_0x2b4e('0x29')](function(){return _0x567c56;});});});}})[_0x2b4e('0x29')](function(_0x6c6663){return _0x6c6663;})[_0x2b4e('0x29')](respondWithResult(_0x93cb19,null))['catch'](handleError(_0x93cb19,null));};exports[_0x2b4e('0x5d')]=function(_0xd7e1ec,_0x4906e2){var _0x28f27b;return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0xd7e1ec[_0x2b4e('0x4b')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0x4906e2,null))['then'](function(_0x42feff){if(_0x42feff){_0x28f27b=_0x42feff;return db[_0x2b4e('0x53')][_0x2b4e('0x2a')]({'where':{'userProfileId':_0xd7e1ec['params']['id'],'sectionId':_0xd7e1ec[_0x2b4e('0x36')]['ids']}});}})[_0x2b4e('0x29')](function(){return _0x28f27b;})[_0x2b4e('0x29')](respondWithStatusCode(_0x4906e2,null))[_0x2b4e('0x4a')](handleError(_0x4906e2,null));};exports[_0x2b4e('0x5e')]=function(_0xb8c785,_0x5f9503){var _0xc0c6f7=[];var _0x49b2ff=[];return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0xb8c785[_0x2b4e('0x4b')]['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x191a93){_0xc0c6f7=_[_0x2b4e('0x5f')](_0x191a93,function(_0x195606){return _0x195606[_0x2b4e('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x195606[_0x2b4e('0x57')]);});if(!_[_0x2b4e('0x61')](_0xc0c6f7)){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0xd3f0f){return _0xd3f0f[_0x2b4e('0x57')];});}else{return;}})[_0x2b4e('0x29')](function(_0x192ab1){if(_0x192ab1)_0x49b2ff=_0x192ab1;if(_['includes'](_0x49b2ff,0x64)){var _0x3e9b79=_[_0x2b4e('0x48')](_0xc0c6f7,{'sectionId':0x64});return hasDefaultDashboard(_0x3e9b79)[_0x2b4e('0x29')](function(_0x70ac26){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x4e3e6d){if(_0x4e3e6d[_0x2b4e('0x57')]===0x64){_0x4e3e6d[_0x2b4e('0x62')]=_0x70ac26;}return _0x4e3e6d;});});}else{return;}})['then'](function(_0x542b65){if(_0x542b65)_0xc0c6f7=_0x542b65;if(_[_0x2b4e('0x63')](_0x49b2ff,0x3eb)){var _0x1fd2f2=_['find'](_0xc0c6f7,{'sectionId':0x3eb});return getCustomDashboards(_0x1fd2f2)['then'](function(_0xd65ff5){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x5467c1){if(_0x1fd2f2['enabled']){if(_0x5467c1['sectionId']===0x3eb){_0x5467c1[_0x2b4e('0x62')]=_0xd65ff5;}}else{if(_0x5467c1[_0x2b4e('0x57')]===0x64){_0x5467c1[_0x2b4e('0x62')]=_0xd65ff5;}}return _0x5467c1;});});}else{return;}})[_0x2b4e('0x29')](function(_0x3a0bc2){if(_0x3a0bc2)_0xc0c6f7=_0x3a0bc2;if(_[_0x2b4e('0x63')](_0x49b2ff,0x709)){var _0xc0c6ce=_['find'](_0xc0c6f7,{'sectionId':0x709});return getPlugins(_0xc0c6ce)[_0x2b4e('0x29')](function(_0x5ef40b){if(_0xc0c6ce['enabled']){return _[_0x2b4e('0x2f')](_0xc0c6f7,function(_0x9633b8){if(_0x9633b8[_0x2b4e('0x57')]===0x709){_0x9633b8['subsections']=_0x5ef40b;}return _0x9633b8;});}else{var _0x29767c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5ef40b};var _0x339bce=_[_0x2b4e('0x2f')](_0xc0c6f7);_0x339bce[_0x2b4e('0x5c')](_0x29767c);return _0x339bce;}});}else{return;}})[_0x2b4e('0x29')](function(_0x57df69){if(_0x57df69)_0xc0c6f7=_0x57df69;return _[_0x2b4e('0x5f')](_0xc0c6f7,['enabled',0x1]);})[_0x2b4e('0x29')](respondWithResult(_0x5f9503,null))[_0x2b4e('0x4a')](handleError(_0x5f9503,null));};function hasDefaultDashboard(_0x1320a5){var _0x5ec08b=[0x65];return new BPromise(function(_0x4b74e2,_0x3b2a2a){try{if(_0x1320a5['autoAssociation']){_0x4b74e2(_0x5ec08b);}else{return db['UserProfileResource'][_0x2b4e('0x64')]({'where':{'sectionId':_0x1320a5['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x66cf9){_0x66cf9?_0x4b74e2(_0x5ec08b):_0x4b74e2();});}}catch(_0x26b3b1){_0x3b2a2a(_0x26b3b1);}});}function getCustomDashboards(_0x2bee97){var _0x410e7f=[];return new BPromise(function(_0x437ca3,_0x3f29dd){try{if(_0x2bee97[_0x2b4e('0x55')]){return db[_0x2b4e('0x65')][_0x2b4e('0x45')]({'raw':!![]})[_0x2b4e('0x29')](function(_0x9ce521){_0x9ce521[_0x2b4e('0x66')](function(_0x841450){_0x410e7f[_0x2b4e('0x5c')](_0x841450['id']+0x1869f);});_0x437ca3(_0x410e7f);});}else{return db['UserProfileResource'][_0x2b4e('0x45')]({'where':{'sectionId':_0x2bee97['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x4aff4c){_0x4aff4c[_0x2b4e('0x66')](function(_0x24a738){_0x410e7f['push'](_0x24a738[_0x2b4e('0x67')]+0x1869f);});_0x437ca3(_0x410e7f);});}}catch(_0x21e104){_0x3f29dd(_0x21e104);}});}function getPlugins(_0x2d05cb){var _0x35d7b8=[];return new BPromise(function(_0x339fe6,_0x3f4009){try{if(_0x2d05cb[_0x2b4e('0x55')]){return db[_0x2b4e('0x68')][_0x2b4e('0x45')]({'raw':!![]})['then'](function(_0x541636){_0x541636['forEach'](function(_0x26ccfe){_0x35d7b8[_0x2b4e('0x5c')](_0x26ccfe['id']+0x15b38);});_0x339fe6(_0x35d7b8);});}else{return db[_0x2b4e('0x56')][_0x2b4e('0x45')]({'where':{'sectionId':_0x2d05cb['id']},'raw':!![]})[_0x2b4e('0x29')](function(_0x445688){_0x445688['forEach'](function(_0x1ad7d8){_0x35d7b8[_0x2b4e('0x5c')](_0x1ad7d8[_0x2b4e('0x67')]+0x15b38);});_0x339fe6(_0x35d7b8);});}}catch(_0x2adc7f){_0x3f4009(_0x2adc7f);}});}exports['addResources']=function(_0x116166,_0x1a9baf){return db['UserProfile']['find']({'where':{'id':_0x116166['params']['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x1a9baf,null))[_0x2b4e('0x29')](function(_0x40297f){if(_0x40297f){return db[_0x2b4e('0x51')]['transaction'](function(_0x54e40a){return db['UserProfileSection'][_0x2b4e('0x45')]({'where':{'userProfileId':_0x116166['params']['id']},'attributes':['id'],'raw':!![]})[_0x2b4e('0x29')](function(_0x4b030e){if(_0x4b030e){return db[_0x2b4e('0x53')]['destroy']({'where':{'userProfileId':_0x116166[_0x2b4e('0x4b')]['id'],'id':_[_0x2b4e('0x2f')](_0x4b030e,function(_0x20a03e){return _0x20a03e['id'];})},'transaction':_0x54e40a});}})['then'](function(_0x41a287){var _0xceb353=_[_0x2b4e('0x2f')](_0x116166[_0x2b4e('0x50')],function(_0x5f3381){_0x5f3381['userProfileId']=_0x116166[_0x2b4e('0x4b')]['id'];return _0x5f3381;});return db[_0x2b4e('0x53')][_0x2b4e('0x69')](_0xceb353,{'raw':!![],'transaction':_0x54e40a});})[_0x2b4e('0x29')](function(_0x3764aa){var _0x24761b=_[_0x2b4e('0x5f')](_['map'](_0x3764aa,function(_0x449c81){return _0x449c81['get']({'plain':!![]});}),{'includeAll':![]});if(_0x24761b){return db[_0x2b4e('0x53')][_0x2b4e('0x45')]({'where':{'userProfileId':_0x116166['params']['id'],'sectionId':_[_0x2b4e('0x2f')](_0x24761b,function(_0x22ba98){return _0x22ba98['sectionId'];})},'attributes':['id',_0x2b4e('0x57')],'raw':!![]})[_0x2b4e('0x29')](function(_0x52bac9){var _0x2b25c2=_[_0x2b4e('0x2f')](_0x116166[_0x2b4e('0x50')],function(_0x4690fa){_0x4690fa[_0x2b4e('0x5b')]=_0x116166['params']['id'];return _0x4690fa;});return db[_0x2b4e('0x56')][_0x2b4e('0x69')](_0x2b25c2,{'raw':!![],'transaction':_0x54e40a});});}})[_0x2b4e('0x4a')](handleError(_0x1a9baf,null));});}})[_0x2b4e('0x29')](function(_0x44c9dd){var _0x5ef212=_['map'](_0x44c9dd,function(_0x67bd37){return _0x67bd37[_0x2b4e('0x4c')]({'plain':!![]});});})['then'](respondWithResult(_0x1a9baf,null))[_0x2b4e('0x4a')](handleError(_0x1a9baf,null));};exports[_0x2b4e('0x6a')]=function(_0xa41d6b,_0x412b17,_0x2aa3fa){return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0xa41d6b[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](handleEntityNotFound(_0x412b17,null))[_0x2b4e('0x29')](function(_0x5ab8fe){if(_0x5ab8fe){return _0x5ab8fe[_0x2b4e('0x6a')](_0xa41d6b[_0x2b4e('0x36')][_0x2b4e('0x6b')]);}})[_0x2b4e('0x29')](respondWithStatusCode(_0x412b17,null))['catch'](handleError(_0x412b17,null));};exports[_0x2b4e('0x6c')]=function(_0x5920f1,_0x3711a9){var _0x1b83f4={};if(!_0x5920f1[_0x2b4e('0x36')]['section'])throw new Error(_0x2b4e('0x6d'));if(!_0x5920f1[_0x2b4e('0x36')][_0x2b4e('0x3c')](_0x2b4e('0x6e'))){_0x1b83f4[_0x2b4e('0x23')]=qs[_0x2b4e('0x23')](_0x5920f1[_0x2b4e('0x36')][_0x2b4e('0x23')]);_0x1b83f4[_0x2b4e('0x21')]=qs[_0x2b4e('0x21')](_0x5920f1['query'][_0x2b4e('0x21')]);}return db['UserProfile'][_0x2b4e('0x48')]({'where':{'id':_0x5920f1[_0x2b4e('0x4b')]['id']}})[_0x2b4e('0x29')](function(_0x5f3559){if(!_0x5f3559)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5920f1[_0x2b4e('0x4b')]['id']);return db[_0x2b4e('0x30')][_0x2b4e('0x6c')](_0x5920f1);})[_0x2b4e('0x29')](respondWithFilteredResult(_0x3711a9,_0x1b83f4))[_0x2b4e('0x4a')](handleError(_0x3711a9,null));}; \ No newline at end of file +var _0x1219=['omit','Resources','UserProfileSection','describe','addSections','sequelize','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','resourceId','Plugin','forEach','userProfileId','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','UserProfile','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','keys','include','find','create','body','clone','params','rawAttributes','get','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','UserProfileResource'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9121('0x0'));var rimraf=require(_0x9121('0x1'));var zipdir=require(_0x9121('0x2'));var jsonpatch=require(_0x9121('0x3'));var rp=require(_0x9121('0x4'));var moment=require('moment');var BPromise=require(_0x9121('0x5'));var Mustache=require('mustache');var util=require(_0x9121('0x6'));var path=require(_0x9121('0x7'));var sox=require(_0x9121('0x8'));var csv=require(_0x9121('0x9'));var ejs=require(_0x9121('0xa'));var fs=require('fs');var fs_extra=require(_0x9121('0xb'));var _=require(_0x9121('0xc'));var squel=require(_0x9121('0xd'));var crypto=require(_0x9121('0xe'));var jsforce=require(_0x9121('0xf'));var deskjs=require(_0x9121('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9121('0x11'));var Papa=require(_0x9121('0x12'));var Redis=require(_0x9121('0x13'));var authService=require(_0x9121('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9121('0x15'));var hardwareService=require(_0x9121('0x16'));var logger=require(_0x9121('0x17'))(_0x9121('0x18'));var utils=require(_0x9121('0x19'));var config=require(_0x9121('0x1a'));var licenseUtil=require(_0x9121('0x1b'));var db=require(_0x9121('0x1c'))['db'];config[_0x9121('0x1d')]=_[_0x9121('0x1e')](config[_0x9121('0x1d')],{'host':_0x9121('0x1f'),'port':0x18eb});var socket=require(_0x9121('0x20'))(new Redis(config[_0x9121('0x1d')]));require(_0x9121('0x21'))['register'](socket);function respondWithStatusCode(_0x106fe1,_0x1cd06f){_0x1cd06f=_0x1cd06f||0xcc;return function(_0xa59bd9){if(_0xa59bd9){return _0x106fe1[_0x9121('0x22')](_0x1cd06f);}return _0x106fe1[_0x9121('0x23')](_0x1cd06f)[_0x9121('0x24')]();};}function respondWithResult(_0x49c6aa,_0x5994f1){_0x5994f1=_0x5994f1||0xc8;return function(_0x21551c){if(_0x21551c){return _0x49c6aa[_0x9121('0x23')](_0x5994f1)[_0x9121('0x25')](_0x21551c);}};}function respondWithFilteredResult(_0xb8873a,_0x50fa49){return function(_0x5bc064){if(_0x5bc064){var _0xd91482=typeof _0x50fa49[_0x9121('0x26')]==='undefined'&&typeof _0x50fa49[_0x9121('0x27')]===_0x9121('0x28');var _0x88b2e4=_0x5bc064[_0x9121('0x29')];var _0x49e516=_0xd91482?0x0:_0x50fa49[_0x9121('0x26')];var _0x49c910=_0xd91482?_0x5bc064[_0x9121('0x29')]:_0x50fa49[_0x9121('0x26')]+_0x50fa49[_0x9121('0x27')];var _0x1e1d2a;if(_0x49c910>=_0x88b2e4){_0x49c910=_0x88b2e4;_0x1e1d2a=0xc8;}else{_0x1e1d2a=0xce;}_0xb8873a[_0x9121('0x23')](_0x1e1d2a);return _0xb8873a[_0x9121('0x2a')]('Content-Range',_0x49e516+'-'+_0x49c910+'/'+_0x88b2e4)[_0x9121('0x25')](_0x5bc064);}return null;};}function patchUpdates(_0xefb0a5){return function(_0x19479a){try{jsonpatch[_0x9121('0x2b')](_0x19479a,_0xefb0a5,!![]);}catch(_0x5a6cd1){return BPromise['reject'](_0x5a6cd1);}return _0x19479a[_0x9121('0x2c')]();};}function saveUpdates(_0x29b864,_0x12ffb3){return function(_0x5d3ed2){if(_0x5d3ed2){return _0x5d3ed2[_0x9121('0x2d')](_0x29b864)[_0x9121('0x2e')](function(_0x59b142){return _0x59b142;});}return null;};}function removeEntity(_0x31f5ff,_0x449317){return function(_0x405d45){if(_0x405d45){return _0x405d45[_0x9121('0x2f')]()[_0x9121('0x2e')](function(){_0x31f5ff[_0x9121('0x23')](0xcc)[_0x9121('0x24')]();});}};}function handleEntityNotFound(_0x2b840c,_0x16326b){return function(_0x3f6f5f){if(!_0x3f6f5f){_0x2b840c[_0x9121('0x22')](0x194);}return _0x3f6f5f;};}function handleError(_0xc15261,_0x2a69e2){_0x2a69e2=_0x2a69e2||0x1f4;return function(_0x71b6cf){logger[_0x9121('0x30')](_0x71b6cf[_0x9121('0x31')]);if(_0x71b6cf[_0x9121('0x32')]){delete _0x71b6cf['name'];}_0xc15261['status'](_0x2a69e2)[_0x9121('0x33')](_0x71b6cf);};}exports['index']=function(_0x3b4144,_0x23b1ed){var _0x541ba2={},_0x473cd3={},_0xaa36ea={'count':0x0,'rows':[]};var _0xd38da=_[_0x9121('0x34')](db[_0x9121('0x35')]['rawAttributes'],function(_0x53e433){return{'name':_0x53e433['fieldName'],'type':_0x53e433[_0x9121('0x36')][_0x9121('0x37')]};});_0x473cd3['model']=_[_0x9121('0x34')](_0xd38da,_0x9121('0x32'));_0x473cd3[_0x9121('0x38')]=_['keys'](_0x3b4144[_0x9121('0x38')]);_0x473cd3[_0x9121('0x39')]=_[_0x9121('0x3a')](_0x473cd3[_0x9121('0x3b')],_0x473cd3[_0x9121('0x38')]);_0x541ba2[_0x9121('0x3c')]=_[_0x9121('0x3a')](_0x473cd3[_0x9121('0x3b')],qs[_0x9121('0x3d')](_0x3b4144[_0x9121('0x38')][_0x9121('0x3d')]));_0x541ba2['attributes']=_0x541ba2[_0x9121('0x3c')][_0x9121('0x3e')]?_0x541ba2[_0x9121('0x3c')]:_0x473cd3[_0x9121('0x3b')];if(!_0x3b4144[_0x9121('0x38')][_0x9121('0x3f')]('nolimit')){_0x541ba2['limit']=qs['limit'](_0x3b4144[_0x9121('0x38')][_0x9121('0x27')]);_0x541ba2[_0x9121('0x26')]=qs[_0x9121('0x26')](_0x3b4144['query']['offset']);}_0x541ba2[_0x9121('0x40')]=qs[_0x9121('0x41')](_0x3b4144[_0x9121('0x38')][_0x9121('0x41')]);_0x541ba2['where']=qs[_0x9121('0x39')](_[_0x9121('0x42')](_0x3b4144[_0x9121('0x38')],_0x473cd3['filters']),_0xd38da);if(_0x3b4144[_0x9121('0x38')][_0x9121('0x43')]){_0x541ba2[_0x9121('0x44')]=_['merge'](_0x541ba2[_0x9121('0x44')],{'$or':_['map'](_0xd38da,function(_0x2e8c48){if(_0x2e8c48[_0x9121('0x36')]!==_0x9121('0x45')){var _0x3432ae={};_0x3432ae[_0x2e8c48[_0x9121('0x32')]]={'$like':'%'+_0x3b4144[_0x9121('0x38')]['filter']+'%'};return _0x3432ae;}})});}_0x541ba2=_[_0x9121('0x46')]({},_0x541ba2,_0x3b4144[_0x9121('0x47')]);var _0x158cec={'where':_0x541ba2[_0x9121('0x44')]};return db['UserProfile'][_0x9121('0x29')](_0x158cec)['then'](function(_0x533628){_0xaa36ea[_0x9121('0x29')]=_0x533628;if(_0x3b4144['query'][_0x9121('0x48')]){_0x541ba2['include']=[{'all':!![]}];}return db['UserProfile'][_0x9121('0x49')](_0x541ba2);})['then'](function(_0x24e009){_0xaa36ea['rows']=_0x24e009;return _0xaa36ea;})[_0x9121('0x2e')](respondWithFilteredResult(_0x23b1ed,_0x541ba2))[_0x9121('0x4a')](handleError(_0x23b1ed,null));};exports[_0x9121('0x4b')]=function(_0x15c70a,_0x3c86c8){var _0x3c44e8={'raw':![],'where':{'id':_0x15c70a['params']['id']}},_0x4070ac={};_0x4070ac[_0x9121('0x3b')]=_[_0x9121('0x4c')](db[_0x9121('0x35')]['rawAttributes']);_0x4070ac[_0x9121('0x38')]=_[_0x9121('0x4c')](_0x15c70a[_0x9121('0x38')]);_0x4070ac[_0x9121('0x39')]=_[_0x9121('0x3a')](_0x4070ac[_0x9121('0x3b')],_0x4070ac[_0x9121('0x38')]);_0x3c44e8[_0x9121('0x3c')]=_[_0x9121('0x3a')](_0x4070ac['model'],qs[_0x9121('0x3d')](_0x15c70a[_0x9121('0x38')][_0x9121('0x3d')]));_0x3c44e8[_0x9121('0x3c')]=_0x3c44e8[_0x9121('0x3c')][_0x9121('0x3e')]?_0x3c44e8[_0x9121('0x3c')]:_0x4070ac[_0x9121('0x3b')];if(_0x15c70a[_0x9121('0x38')]['includeAll']){_0x3c44e8[_0x9121('0x4d')]=[{'all':!![]}];}_0x3c44e8=_[_0x9121('0x46')]({},_0x3c44e8,_0x15c70a[_0x9121('0x47')]);return db['UserProfile'][_0x9121('0x4e')](_0x3c44e8)[_0x9121('0x2e')](handleEntityNotFound(_0x3c86c8,null))[_0x9121('0x2e')](respondWithResult(_0x3c86c8,null))[_0x9121('0x4a')](handleError(_0x3c86c8,null));};exports[_0x9121('0x4f')]=function(_0x471de8,_0x31164a){return db[_0x9121('0x35')]['create'](_0x471de8[_0x9121('0x50')],{})[_0x9121('0x2e')](respondWithResult(_0x31164a,0xc9))['catch'](handleError(_0x31164a,null));};exports[_0x9121('0x51')]=function(_0x12edbf,_0x4c67cc){var _0x5c833b={'where':{'id':_0x12edbf[_0x9121('0x52')]['id']}},_0x5af6a5={};_0x5af6a5['model']=_[_0x9121('0x4c')](db[_0x9121('0x35')][_0x9121('0x53')]);_0x5c833b[_0x9121('0x3c')]=_['intersection'](_0x5af6a5[_0x9121('0x3b')],qs['fields'](_0x12edbf[_0x9121('0x38')][_0x9121('0x3d')]));_0x5c833b[_0x9121('0x3c')]=_0x5c833b[_0x9121('0x3c')][_0x9121('0x3e')]?_0x5c833b[_0x9121('0x3c')]:_0x5af6a5['model'];if(_0x12edbf['query']['includeAll']){_0x5c833b[_0x9121('0x4d')]=[{'all':!![]}];}_0x5c833b=_[_0x9121('0x46')]({},_0x5c833b,_0x12edbf[_0x9121('0x47')]);return db[_0x9121('0x35')][_0x9121('0x4e')](_0x5c833b)[_0x9121('0x2e')](handleEntityNotFound(_0x4c67cc,null))[_0x9121('0x2e')](function(_0x25a053){if(_0x25a053){var _0x392fae=_0x25a053[_0x9121('0x54')]({'plain':!![]});_0x392fae=qs['omit'](_0x392fae,['id',_0x9121('0x55'),_0x9121('0x56'),_0x9121('0x57')]);_0x12edbf[_0x9121('0x50')]=_['omit'](_0x12edbf[_0x9121('0x50')],['id',_0x9121('0x55'),'updatedAt']);return db['sequelize'][_0x9121('0x58')](function(_0x1d2f47){return db[_0x9121('0x35')]['create'](_['merge'](_0x392fae,_0x12edbf[_0x9121('0x50')]),{'include':_0x12edbf[_0x9121('0x38')][_0x9121('0x48')]?[{'all':!![]}]:undefined,'transaction':_0x1d2f47})['then'](function(_0x356276){var _0x21b28a=_0x356276[_0x9121('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x9121('0x49')]({'where':{'userProfileId':_0x12edbf[_0x9121('0x52')]['id']},'raw':!![]})[_0x9121('0x2e')](function(_0x1955ad){if(_0x1955ad){return BPromise[_0x9121('0x59')](_0x1955ad,function(_0x6ac408){return new BPromise(function(_0x418ec8,_0x39b180){if(_0x6ac408[_0x9121('0x5a')]===null||_0x6ac408[_0x9121('0x5a')]===0x1)_0x418ec8(null);return db[_0x9121('0x5b')]['findAll']({'where':{'sectionId':_0x6ac408['id']},'raw':!![]})[_0x9121('0x2e')](function(_0x452517){var _0x1333f4=_[_0x9121('0x34')](_0x452517,function(_0x4e4806){return qs[_0x9121('0x5c')](_0x4e4806,['id','createdAt',_0x9121('0x56'),'sectionId']);});_0x418ec8(_0x1333f4);})[_0x9121('0x4a')](function(_0x121009){_0x39b180(_0x121009);});})['then'](function(_0x24066f){var _0x27208d=qs['omit'](_0x6ac408,['id',_0x9121('0x55'),_0x9121('0x56')]);_0x27208d['userProfileId']=_0x21b28a['id'];if(_0x24066f)_0x27208d[_0x9121('0x5d')]=_0x24066f;return _0x27208d;})[_0x9121('0x2e')](function(_0x52b303){return db[_0x9121('0x5e')][_0x9121('0x4f')](_0x52b303,{'include':[{'model':db[_0x9121('0x5b')],'as':_0x9121('0x5d')}],'raw':!![],'transaction':_0x1d2f47});});})['then'](function(){return _0x21b28a;});}});});});}})['then'](respondWithResult(_0x4c67cc,0xc9))[_0x9121('0x4a')](handleError(_0x4c67cc,null));};exports[_0x9121('0x2d')]=function(_0x2ff306,_0xc0dbb2){if(_0x2ff306[_0x9121('0x50')]['id']){delete _0x2ff306['body']['id'];}return db[_0x9121('0x35')][_0x9121('0x4e')]({'where':{'id':_0x2ff306[_0x9121('0x52')]['id']}})['then'](handleEntityNotFound(_0xc0dbb2,null))[_0x9121('0x2e')](saveUpdates(_0x2ff306[_0x9121('0x50')],null))[_0x9121('0x2e')](respondWithResult(_0xc0dbb2,null))[_0x9121('0x4a')](handleError(_0xc0dbb2,null));};exports['destroy']=function(_0x30ec33,_0x5dddad){return db['UserProfile']['find']({'where':{'id':_0x30ec33[_0x9121('0x52')]['id']}})[_0x9121('0x2e')](handleEntityNotFound(_0x5dddad,null))[_0x9121('0x2e')](removeEntity(_0x5dddad,null))[_0x9121('0x4a')](handleError(_0x5dddad,null));};exports[_0x9121('0x5f')]=function(_0x1d07c1,_0x3cffef){return db[_0x9121('0x35')][_0x9121('0x5f')]()[_0x9121('0x2e')](respondWithResult(_0x3cffef,null))[_0x9121('0x4a')](handleError(_0x3cffef,null));};exports[_0x9121('0x60')]=function(_0x73ae63,_0x421bfb){var _0x4e83d5=_0x73ae63[_0x9121('0x50')];return db[_0x9121('0x35')]['find']({'where':{'id':_0x73ae63[_0x9121('0x52')]['id']}})[_0x9121('0x2e')](handleEntityNotFound(_0x421bfb,null))[_0x9121('0x2e')](function(_0x27227e){if(_0x27227e){return db[_0x9121('0x61')][_0x9121('0x58')](function(_0x225dd0){return db[_0x9121('0x5e')][_0x9121('0x2f')]({'where':{'userProfileId':_0x73ae63[_0x9121('0x52')]['id'],'sectionId':_['map'](_0x4e83d5,function(_0x136ca7){return _0x136ca7[_0x9121('0x62')];})},'transaction':_0x225dd0})[_0x9121('0x2e')](function(){var _0x359995=_[_0x9121('0x34')](_0x4e83d5,function(_0x43a427){_0x43a427['userProfileId']=_0x73ae63[_0x9121('0x52')]['id'];return _0x43a427;});var _0x13113d=[];return BPromise[_0x9121('0x59')](_0x359995,function(_0x53b18c){return db[_0x9121('0x5e')]['create'](_0x53b18c,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x225dd0})['then'](function(_0x232064){_0x13113d[_0x9121('0x63')](_0x232064[_0x9121('0x54')]({'plain':!![]}));});})[_0x9121('0x2e')](function(){return _0x13113d;});});});}})[_0x9121('0x2e')](function(_0x2b4e5c){return _0x2b4e5c;})[_0x9121('0x2e')](respondWithResult(_0x421bfb,null))[_0x9121('0x4a')](handleError(_0x421bfb,null));};exports[_0x9121('0x64')]=function(_0x44d3f7,_0x147d49){var _0x2ea7b1;return db[_0x9121('0x35')][_0x9121('0x4e')]({'where':{'id':_0x44d3f7[_0x9121('0x52')]['id']},'attributes':['id',_0x9121('0x32')]})[_0x9121('0x2e')](handleEntityNotFound(_0x147d49,null))[_0x9121('0x2e')](function(_0x55a0b7){if(_0x55a0b7){_0x2ea7b1=_0x55a0b7;return db[_0x9121('0x5e')][_0x9121('0x2f')]({'where':{'userProfileId':_0x44d3f7[_0x9121('0x52')]['id'],'sectionId':_0x44d3f7[_0x9121('0x38')]['ids']}});}})[_0x9121('0x2e')](function(){return _0x2ea7b1;})[_0x9121('0x2e')](respondWithStatusCode(_0x147d49,null))[_0x9121('0x4a')](handleError(_0x147d49,null));};exports[_0x9121('0x65')]=function(_0x428ecb,_0x18d30c){var _0x34d270=[];var _0x4db4b3=[];return db[_0x9121('0x5e')]['findAll']({'where':{'userProfileId':_0x428ecb['params']['id']},'raw':!![]})[_0x9121('0x2e')](function(_0x212415){_0x34d270=_[_0x9121('0x43')](_0x212415,function(_0x4538ef){return _0x4538ef[_0x9121('0x66')]===0x1||_[_0x9121('0x67')]([0x3eb,0x709],_0x4538ef[_0x9121('0x62')]);});if(!_[_0x9121('0x68')](_0x34d270)){return _['map'](_0x34d270,function(_0xba9b1f){return _0xba9b1f[_0x9121('0x62')];});}else{return;}})[_0x9121('0x2e')](function(_0xd39747){if(_0xd39747)_0x4db4b3=_0xd39747;if(_[_0x9121('0x67')](_0x4db4b3,0x64)){var _0x34592c=_[_0x9121('0x4e')](_0x34d270,{'sectionId':0x64});return hasDefaultDashboard(_0x34592c)[_0x9121('0x2e')](function(_0x436a31){return _['map'](_0x34d270,function(_0x58be5f){if(_0x58be5f[_0x9121('0x62')]===0x64){_0x58be5f[_0x9121('0x69')]=_0x436a31;}return _0x58be5f;});});}else{return;}})['then'](function(_0x56bfc8){if(_0x56bfc8)_0x34d270=_0x56bfc8;if(_[_0x9121('0x67')](_0x4db4b3,0x3eb)){var _0x35a0a4=_['find'](_0x34d270,{'sectionId':0x3eb});return getCustomDashboards(_0x35a0a4)['then'](function(_0x3bea20){return _[_0x9121('0x34')](_0x34d270,function(_0x20b09d){if(_0x35a0a4[_0x9121('0x66')]){if(_0x20b09d['sectionId']===0x3eb){_0x20b09d[_0x9121('0x69')]=_0x3bea20;}}else{if(_0x20b09d[_0x9121('0x62')]===0x64){_0x20b09d[_0x9121('0x69')]=_0x3bea20;}}return _0x20b09d;});});}else{return;}})[_0x9121('0x2e')](function(_0x4b08c6){if(_0x4b08c6)_0x34d270=_0x4b08c6;if(_[_0x9121('0x67')](_0x4db4b3,0x709)){var _0x2a34cf=_[_0x9121('0x4e')](_0x34d270,{'sectionId':0x709});return getPlugins(_0x2a34cf)[_0x9121('0x2e')](function(_0xa6c08c){if(_0x2a34cf[_0x9121('0x66')]){return _[_0x9121('0x34')](_0x34d270,function(_0x33e282){if(_0x33e282[_0x9121('0x62')]===0x709){_0x33e282['subsections']=_0xa6c08c;}return _0x33e282;});}else{var _0x353b65={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa6c08c};var _0x167adf=_[_0x9121('0x34')](_0x34d270);_0x167adf[_0x9121('0x63')](_0x353b65);return _0x167adf;}});}else{return;}})[_0x9121('0x2e')](function(_0x2ac2d5){if(_0x2ac2d5)_0x34d270=_0x2ac2d5;return _['filter'](_0x34d270,[_0x9121('0x66'),0x1]);})['then'](respondWithResult(_0x18d30c,null))['catch'](handleError(_0x18d30c,null));};function hasDefaultDashboard(_0x2b62af){var _0x5dabad=[0x65];return new BPromise(function(_0x769ce7,_0xda3bbe){try{if(_0x2b62af[_0x9121('0x5a')]){_0x769ce7(_0x5dabad);}else{return db['UserProfileResource'][_0x9121('0x6a')]({'where':{'sectionId':_0x2b62af['id']},'raw':!![]})[_0x9121('0x2e')](function(_0x2a50ff){_0x2a50ff?_0x769ce7(_0x5dabad):_0x769ce7();});}}catch(_0x1ccfd2){_0xda3bbe(_0x1ccfd2);}});}function getCustomDashboards(_0x29e5ed){var _0x22485d=[];return new BPromise(function(_0x14aa3f,_0x2956fa){try{if(_0x29e5ed[_0x9121('0x5a')]){return db['Dashboard'][_0x9121('0x49')]({'raw':!![]})['then'](function(_0x5d36ce){_0x5d36ce['forEach'](function(_0x2bffd3){_0x22485d['push'](_0x2bffd3['id']+0x1869f);});_0x14aa3f(_0x22485d);});}else{return db[_0x9121('0x5b')][_0x9121('0x49')]({'where':{'sectionId':_0x29e5ed['id']},'raw':!![]})['then'](function(_0x4ad2e6){_0x4ad2e6['forEach'](function(_0x3c8e86){_0x22485d[_0x9121('0x63')](_0x3c8e86[_0x9121('0x6b')]+0x1869f);});_0x14aa3f(_0x22485d);});}}catch(_0x493af0){_0x2956fa(_0x493af0);}});}function getPlugins(_0x2e08f9){var _0x1d5bfa=[];return new BPromise(function(_0x17afd0,_0x12160d){try{if(_0x2e08f9[_0x9121('0x5a')]){return db[_0x9121('0x6c')]['findAll']({'raw':!![]})[_0x9121('0x2e')](function(_0x2fad72){_0x2fad72[_0x9121('0x6d')](function(_0x4fb0da){_0x1d5bfa[_0x9121('0x63')](_0x4fb0da['id']+0x15b38);});_0x17afd0(_0x1d5bfa);});}else{return db['UserProfileResource'][_0x9121('0x49')]({'where':{'sectionId':_0x2e08f9['id']},'raw':!![]})[_0x9121('0x2e')](function(_0x1c8ef2){_0x1c8ef2[_0x9121('0x6d')](function(_0x59d36a){_0x1d5bfa['push'](_0x59d36a['resourceId']+0x15b38);});_0x17afd0(_0x1d5bfa);});}}catch(_0x70af0){_0x12160d(_0x70af0);}});}exports['addResources']=function(_0x6478fb,_0x27edf1){return db[_0x9121('0x35')][_0x9121('0x4e')]({'where':{'id':_0x6478fb['params']['id']}})['then'](handleEntityNotFound(_0x27edf1,null))[_0x9121('0x2e')](function(_0x1ea5c1){if(_0x1ea5c1){return db[_0x9121('0x61')]['transaction'](function(_0x56da30){return db[_0x9121('0x5e')][_0x9121('0x49')]({'where':{'userProfileId':_0x6478fb['params']['id']},'attributes':['id'],'raw':!![]})[_0x9121('0x2e')](function(_0x375512){if(_0x375512){return db[_0x9121('0x5e')][_0x9121('0x2f')]({'where':{'userProfileId':_0x6478fb[_0x9121('0x52')]['id'],'id':_[_0x9121('0x34')](_0x375512,function(_0x1f374d){return _0x1f374d['id'];})},'transaction':_0x56da30});}})[_0x9121('0x2e')](function(_0x5b9034){var _0x2caa7f=_[_0x9121('0x34')](_0x6478fb['body'],function(_0xf31072){_0xf31072[_0x9121('0x6e')]=_0x6478fb[_0x9121('0x52')]['id'];return _0xf31072;});return db[_0x9121('0x5e')][_0x9121('0x6f')](_0x2caa7f,{'raw':!![],'transaction':_0x56da30});})['then'](function(_0x52721e){var _0x1d5e5b=_['filter'](_[_0x9121('0x34')](_0x52721e,function(_0x4845a6){return _0x4845a6[_0x9121('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x1d5e5b){return db['UserProfileSection'][_0x9121('0x49')]({'where':{'userProfileId':_0x6478fb[_0x9121('0x52')]['id'],'sectionId':_[_0x9121('0x34')](_0x1d5e5b,function(_0x455692){return _0x455692[_0x9121('0x62')];})},'attributes':['id',_0x9121('0x62')],'raw':!![]})[_0x9121('0x2e')](function(_0x26f2c8){var _0x38d995=_['map'](_0x6478fb[_0x9121('0x50')],function(_0x4e2781){_0x4e2781[_0x9121('0x6e')]=_0x6478fb[_0x9121('0x52')]['id'];return _0x4e2781;});return db[_0x9121('0x5b')][_0x9121('0x6f')](_0x38d995,{'raw':!![],'transaction':_0x56da30});});}})[_0x9121('0x4a')](handleError(_0x27edf1,null));});}})['then'](function(_0x24ac48){var _0x56ac2a=_[_0x9121('0x34')](_0x24ac48,function(_0x216aaf){return _0x216aaf['get']({'plain':!![]});});})[_0x9121('0x2e')](respondWithResult(_0x27edf1,null))[_0x9121('0x4a')](handleError(_0x27edf1,null));};exports[_0x9121('0x70')]=function(_0x163ec0,_0x39a808,_0x131056){return db['UserProfile']['find']({'where':{'id':_0x163ec0['params']['id']}})[_0x9121('0x2e')](handleEntityNotFound(_0x39a808,null))[_0x9121('0x2e')](function(_0x230ac4){if(_0x230ac4){return _0x230ac4[_0x9121('0x70')](_0x163ec0[_0x9121('0x38')][_0x9121('0x71')]);}})[_0x9121('0x2e')](respondWithStatusCode(_0x39a808,null))[_0x9121('0x4a')](handleError(_0x39a808,null));};exports[_0x9121('0x72')]=function(_0x6b5980,_0x286ef4){var _0x499d6f={};if(!_0x6b5980[_0x9121('0x38')][_0x9121('0x73')])throw new Error(_0x9121('0x74'));if(!_0x6b5980[_0x9121('0x38')][_0x9121('0x3f')](_0x9121('0x75'))){_0x499d6f[_0x9121('0x27')]=qs[_0x9121('0x27')](_0x6b5980['query']['limit']);_0x499d6f[_0x9121('0x26')]=qs[_0x9121('0x26')](_0x6b5980['query'][_0x9121('0x26')]);}return db[_0x9121('0x35')]['find']({'where':{'id':_0x6b5980[_0x9121('0x52')]['id']}})[_0x9121('0x2e')](function(_0x3267b9){if(!_0x3267b9)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x6b5980[_0x9121('0x52')]['id']);return db[_0x9121('0x35')]['getResources'](_0x6b5980);})[_0x9121('0x2e')](respondWithFilteredResult(_0x286ef4,_0x499d6f))[_0x9121('0x4a')](handleError(_0x286ef4,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 1896d5e..d093aa9 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 _0x5b47=['events','../../mysqldb','emit','exports'];(function(_0x5f139c,_0x34abe0){var _0xd3bd61=function(_0x918abc){while(--_0x918abc){_0x5f139c['push'](_0x5f139c['shift']());}};_0xd3bd61(++_0x34abe0);}(_0x5b47,0x120));var _0x75b4=function(_0x3a1353,_0x34c996){_0x3a1353=_0x3a1353-0x0;var _0x450fd6=_0x5b47[_0x3a1353];return _0x450fd6;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var UserProfile=require(_0x75b4('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17831a){return function(_0x42359f,_0x37497c,_0x1fa445){UserProfileEvents[_0x75b4('0x2')](_0x17831a+':'+_0x42359f['id'],_0x42359f);UserProfileEvents['emit'](_0x17831a,_0x42359f);_0x1fa445(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x75b4('0x3')]=UserProfileEvents; \ No newline at end of file +var _0x82c4=['UserProfile','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x82c4,0x1ca));var _0x482c=function(_0xb5179e,_0x67e31d){_0xb5179e=_0xb5179e-0x0;var _0x423511=_0x82c4[_0xb5179e];return _0x423511;};'use strict';var EventEmitter=require(_0x482c('0x0'));var UserProfile=require(_0x482c('0x1'))['db'][_0x482c('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x482c('0x3')](0x0);var events={'afterCreate':_0x482c('0x4'),'afterUpdate':_0x482c('0x5'),'afterDestroy':_0x482c('0x6')};function emitEvent(_0x56de13){return function(_0x16b0f8,_0x5f4dee,_0x4556c8){UserProfileEvents['emit'](_0x56de13+':'+_0x16b0f8['id'],_0x16b0f8);UserProfileEvents[_0x482c('0x7')](_0x56de13,_0x16b0f8);_0x4556c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x482c('0x8')](e,emitEvent(event));}}module[_0x482c('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 228e213..b3dd5f3 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 _0xd943=['contacts','parentSections','lists','CmList','companies','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','ignore','autoAssociation','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','foreignKey','forEach','merge','options','includeAll','include','reportType','DefaultReports','count','ids','CmContact','Tags','color','ThroughTags','tag','openTabs','true','rows','chat','dataValues','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','field','filter','then','associatedResources','catch','value','model','name','UserProfileResource','findAll','AnalyticExtractedReport','map','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject'];(function(_0x3facba,_0x5db0f3){var _0x36b9ec=function(_0x34801b){while(--_0x34801b){_0x3facba['push'](_0x3facba['shift']());}};_0x36b9ec(++_0x5db0f3);}(_0xd943,0x15d));var _0x3d94=function(_0x29144a,_0x126f5b){_0x29144a=_0x29144a-0x0;var _0x4e5a19=_0xd943[_0x29144a];return _0x4e5a19;};'use strict';var _=require(_0x3d94('0x0'));var attributes=require(_0x3d94('0x1'));var qs=require(_0x3d94('0x2'));var squel=require(_0x3d94('0x3'));module['exports']=function(_0x691e28){var _0x3edd1b=_0x691e28[_0x3d94('0x4')];function _0xc13b61(_0xaf8962,_0x5751f6){return new Promise(function(_0x54e692,_0x34c9c3){if(!_0x5751f6)return _0x54e692(null);var _0x51cf1f=_0x5751f6['filter']?{[_0x5751f6['filter'][_0x3d94('0x5')]]:_0x5751f6[_0x3d94('0x6')]['value']}:undefined;return _0x3edd1b[_0xaf8962]['findAll']({'where':_0x51cf1f,'raw':!![]})[_0x3d94('0x7')](function(_0x27e381){_0x5751f6[_0x3d94('0x8')]=_['map'](_0x27e381,'id');_0x54e692(_0x5751f6);})[_0x3d94('0x9')](function(_0x4ac968){_0x34c9c3(_0x4ac968);});});}function _0x39e2fa(_0x301536,_0x5f5041){return new Promise(function(_0x1897de,_0xe5c5fb){var _0x203aa0=_0x301536[_0x3d94('0x6')]?{[_0x301536[_0x3d94('0x6')]['field']]:_0x301536[_0x3d94('0x6')][_0x3d94('0xa')]}:undefined;return _0x3edd1b[_0x301536[_0x3d94('0xb')]]['findAll']({'where':_0x203aa0,'raw':!![]})[_0x3d94('0x7')](function(_0x29608d){_0x5f5041[_0x3d94('0x8')]=_['map'](_0x29608d,function(_0x14ea5f){return _0x14ea5f[_0x3d94('0xc')];});_0x1897de(_0x5f5041);})[_0x3d94('0x9')](function(_0x34098e){_0xe5c5fb(_0x34098e);});});}function _0xaf939a(_0xd8efaa,_0x31c6e8,_0x9893cb){if(!_0x31c6e8)return Promise['resolve'](null);return new Promise(function(_0x22676a,_0x1a9315){return _0x3edd1b[_0x3d94('0xd')][_0x3d94('0xe')]({'where':{'sectionId':_0x31c6e8['id']},'raw':!![]})[_0x3d94('0x7')](function(_0x3ca0e3){if(_0xd8efaa[_0x3d94('0x5')]&&_0xd8efaa['field']!=='id'){_0x31c6e8[_0x3d94('0x8')]=_['map'](_0x3ca0e3,function(_0x28bead){return _0x28bead[_0xd8efaa[_0x3d94('0x5')]];});}else{if(_0x9893cb===_0x3d94('0xf')){_0x31c6e8[_0x3d94('0x8')]=_[_0x3d94('0x10')](_0x3ca0e3,function(_0x4f0beb){return{'id':_0x4f0beb['resourceId'],'type':_0x4f0beb[_0x3d94('0x11')]};});}else{_0x31c6e8[_0x3d94('0x8')]=_[_0x3d94('0x10')](_0x3ca0e3,function(_0x4edee4){return _0x4edee4[_0x3d94('0x12')];});}}_0x22676a(_0x31c6e8);})[_0x3d94('0x9')](function(_0x123adc){_0x1a9315(_0x123adc);});});}function _0x384f76(_0x395133,_0x4093a4){var _0x295493={'parentSections':[]};switch(_0x395133[_0x3d94('0x13')]()){case _0x3d94('0x14'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x16');break;case _0x3d94('0x17'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x18');break;case _0x3d94('0x19'):_0x295493['childModel']=_0x3d94('0x1a');_0x295493['parentSections']=[{'name':_0x3d94('0x1b'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x1c')}];break;case _0x3d94('0x1d'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x1e');break;case _0x3d94('0x1f'):_0x295493['childModel']='CmContact';_0x295493[_0x3d94('0x20')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x3d94('0x21'):_0x295493['childModel']=_0x3d94('0x22');break;case _0x3d94('0x23'):_0x295493[_0x3d94('0x15')]='CmCompany';break;case _0x3d94('0x24'):_0x295493['childModel']=_0x3d94('0x25');break;case'chatqueues':_0x295493[_0x3d94('0x15')]=_0x3d94('0x26');break;case _0x3d94('0x27'):_0x295493[_0x3d94('0x15')]='ChatWebsite';break;case _0x3d94('0x28'):_0x295493['childModel']=_0x3d94('0x29');break;case _0x3d94('0x2a'):_0x295493['childModel']='FaxAccount';break;case _0x3d94('0x2b'):case _0x3d94('0x2c'):case _0x3d94('0x2d'):_0x295493['childModel']=_0x3d94('0x2e');break;case _0x3d94('0x2f'):_0x295493['childModel']=_0x3d94('0x30');break;case _0x3d94('0x31'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x32');break;case _0x3d94('0x33'):_0x295493['childModel']=_0x3d94('0x34');_0x295493[_0x3d94('0x20')]=[{'name':_0x3d94('0x35'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x36'),'model':_0x3d94('0x37'),'filter':{'field':'role','value':['agent']}},{'name':_0x3d94('0x38'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x36'),'model':_0x3d94('0x37'),'filter':{'field':_0x3d94('0x39'),'value':[_0x3d94('0x3a')]}},{'name':_0x3d94('0x3b'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x3c'),'model':_0x3d94('0x3d'),'filter':{'field':'type','value':[_0x3d94('0x3e')]}},{'name':_0x3d94('0x3f'),'field':_0x3d94('0xc'),'foreignKey':_0x3d94('0x3c'),'model':'VoiceQueue','filter':{'field':_0x3d94('0x11'),'value':[_0x3d94('0x40')]}}];break;case _0x3d94('0x41'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x42');break;case'chanspies':_0x295493[_0x3d94('0x15')]=_0x3d94('0x43');break;case _0x3d94('0x44'):_0x295493['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x295493['childModel']=_0x3d94('0x45');break;case _0x3d94('0x46'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x47');break;case _0x3d94('0x48'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x49');break;case'mailsubstatuses':_0x295493['childModel']=_0x3d94('0x4a');break;case _0x3d94('0x4b'):_0x295493['childModel']=_0x3d94('0x4c');break;case'openchannelaccounts':_0x295493[_0x3d94('0x15')]=_0x3d94('0x4d');break;case _0x3d94('0x4e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x4f');break;case'smsaccounts':_0x295493[_0x3d94('0x15')]=_0x3d94('0x50');break;case _0x3d94('0x51'):_0x295493['childModel']=_0x3d94('0x52');break;case'whatsappaccounts':_0x295493['childModel']=_0x3d94('0x53');break;case _0x3d94('0x54'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x55');break;case'voicequeues':case _0x3d94('0x56'):_0x295493['childModel']=_0x3d94('0x3d');if(_0x4093a4){_0x295493[_0x3d94('0x20')]=[{'name':_0x3d94('0x3b')},{'name':_0x3d94('0x3f')}];}break;case _0x3d94('0x57'):case _0x3d94('0x58'):case _0x3d94('0x59'):_0x295493['childModel']=_0x3d94('0x37');if(_0x4093a4){_0x295493[_0x3d94('0x20')]=[{'name':'Users','filter':{'field':'role','value':[_0x3d94('0x5a'),_0x3d94('0x5b')]},'ignore':!![]},{'name':'Agents'},{'name':_0x3d94('0x38')}];}break;case _0x3d94('0x5c'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x5d');break;case _0x3d94('0x5e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x5f');break;case _0x3d94('0x60'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x61');break;case _0x3d94('0x62'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x63');break;case _0x3d94('0x64'):_0x295493[_0x3d94('0x15')]='DeskAccount';break;case _0x3d94('0x65'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x66');break;case _0x3d94('0x67'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x37');break;case _0x3d94('0x68'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x69');break;case'dispositions':_0x295493[_0x3d94('0x15')]='Disposition';break;case _0x3d94('0x6a'):_0x295493[_0x3d94('0x15')]='Dashboard';break;case _0x3d94('0x6b'):_0x295493['childModel']='Interval';break;case _0x3d94('0x6c'):_0x295493['childModel']=_0x3d94('0x6d');break;case _0x3d94('0x6e'):_0x295493['childModel']=_0x3d94('0x6f');break;case'sounds':_0x295493['childModel']=_0x3d94('0x70');break;case _0x3d94('0x71'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x72');break;case _0x3d94('0x73'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x74');break;case _0x3d94('0x75'):_0x295493[_0x3d94('0x15')]='Trigger';break;case _0x3d94('0x76'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x77');break;case _0x3d94('0x78'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x79');break;case _0x3d94('0x7a'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x7b');break;case _0x3d94('0x7c'):_0x295493[_0x3d94('0x15')]='AnalyticExtractedReport';_0x295493[_0x3d94('0x20')]=[{'name':'Reports','field':'id','foreignKey':_0x3d94('0x7d')}];break;case _0x3d94('0x7e'):_0x295493[_0x3d94('0x15')]=_0x3d94('0x7f');break;}return _0x295493;}function _0x3a837b(_0x36428e,_0x1c503d){var _0x169aa1=_0x36428e[_0x3d94('0x80')](0x0)['toUpperCase']()+_0x36428e['slice'](0x1);var _0x46bff3={'type':_0x3edd1b['Sequelize'][_0x3d94('0x81')][_0x3d94('0x82')],'raw':!![]};return new Promise(function(_0x557bb4,_0x211f0e){var _0x2d3fdd=squel[_0x3d94('0x83')]()[_0x3d94('0x5')](_0x3d94('0x84')+_0x169aa1+_0x3d94('0x85'),'id')[_0x3d94('0x5')]('ui.createdAt')[_0x3d94('0x86')](_0x3d94('0x87')+_0x36428e+_0x3d94('0x88'),'ui')['where'](_0x3d94('0x89'),_0x1c503d['id']);return _0x3edd1b[_0x3d94('0x8a')][_0x3d94('0x8b')](_0x2d3fdd[_0x3d94('0x8c')](),_0x46bff3)['then'](function(_0x5292cc){_0x1c503d[_0x169aa1+_0x3d94('0x8d')]=_0x5292cc;_0x557bb4(_0x5292cc);})[_0x3d94('0x9')](function(_0x4190ef){_0x211f0e(_0x4190ef);});});}return _0x691e28[_0x3d94('0x8e')]('UserProfile',attributes,{'tableName':_0x3d94('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c99d1){var _0x49bfb0={'raw':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x90')],'where':{}};var _0x336e36={};var _0x4eee2b={'count':0x0,'rows':[]};var _0x3135f3=_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x91')];var _0x5747a8=_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x92')]||![];var _0x5c7aac=_0x384f76(_0x3135f3,_0x5747a8);if(!_0x5c7aac['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x3135f3+'\x27');var _0x3ac9ea=[{'name':_0x3135f3}];if(!_[_0x3d94('0x93')](_0x5c7aac[_0x3d94('0x20')]))_0x3ac9ea=_0x5c7aac[_0x3d94('0x20')];var _0x196ed6=[];for(var _0x4ecfa2=0x0;_0x4ecfa2<_0x3ac9ea[_0x3d94('0x94')];_0x4ecfa2++){_0x196ed6[_0x3d94('0x95')](_0x3edd1b[_0x3d94('0x96')][_0x3d94('0x97')]({'where':{'userProfileId':_0x1c99d1[_0x3d94('0x98')]['id'],'name':_0x3ac9ea[_0x4ecfa2][_0x3d94('0xc')]},'raw':!![]}));}return Promise['all'](_0x196ed6)[_0x3d94('0x7')](function(_0x4b6838){var _0x1f3551=_[_0x3d94('0x6')](_0x4b6838,function(_0x437fff){return _0x437fff?_0x437fff:undefined;});var _0x393ac9=_[_0x3d94('0x6')](_0x3ac9ea,[_0x3d94('0x99'),!![]]);var _0x48b108=_['isEmpty'](_0x1f3551)&&_[_0x3d94('0x93')](_0x393ac9)?null:_['union'](_0x393ac9,_0x1f3551);if(!_0x48b108)return null;var _0x56b5dc=[];for(var _0x5c5fb2=0x0;_0x5c5fb2<_0x48b108[_0x3d94('0x94')];_0x5c5fb2++){var _0x262a6a=_[_0x3d94('0x97')](_0x3ac9ea,function(_0x396146){return _0x48b108[_0x5c5fb2]?_0x396146[_0x3d94('0xc')]===_0x48b108[_0x5c5fb2][_0x3d94('0xc')]:null;});if(_0x262a6a){if(_0x48b108[_0x5c5fb2][_0x3d94('0x99')]){_0x56b5dc[_0x3d94('0x95')](_0xc13b61(_0x5c7aac['childModel'],_0x48b108[_0x5c5fb2]));}else{if(!_0x48b108[_0x5c5fb2][_0x3d94('0x9a')]){_0x56b5dc['push'](_0xaf939a(_0x262a6a,_0x48b108[_0x5c5fb2],_0x5c7aac[_0x3d94('0x15')]));}else{if(_0x262a6a[_0x3d94('0xb')]){_0x56b5dc[_0x3d94('0x95')](_0x39e2fa(_0x262a6a,_0x48b108[_0x5c5fb2]));}}}}}return Promise['all'](_0x56b5dc);})['then'](function(_0x4f0f84){var _0x426ef5=_0x4f0f84;var _0x406098=null;if(_0x426ef5){_0x406098=_0x426ef5[_0x3d94('0x94')]===0x1?_0x426ef5[0x0]:null;}if(!_0x406098&&!_0x426ef5)return _0x4eee2b;var _0x1c7ea5=_0x3edd1b[_0x5c7aac[_0x3d94('0x15')]]['rawAttributes'];_0x336e36['model']=_[_0x3d94('0x9b')](_0x1c7ea5);_0x336e36[_0x3d94('0x8b')]=_[_0x3d94('0x9b')](_0x1c99d1['query']);_0x336e36[_0x3d94('0x9c')]=_['intersection'](_0x336e36[_0x3d94('0xb')],_0x336e36[_0x3d94('0x8b')]);_0x49bfb0[_0x3d94('0x9d')]=_[_0x3d94('0x9e')](_0x336e36[_0x3d94('0xb')],qs[_0x3d94('0x9f')](_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x9f')]));_0x49bfb0[_0x3d94('0x9d')]=_0x49bfb0[_0x3d94('0x9d')][_0x3d94('0x94')]?_0x49bfb0[_0x3d94('0x9d')]:_0x336e36[_0x3d94('0xb')];if(!_0x1c99d1['query'][_0x3d94('0xa0')](_0x3d94('0xa1'))){_0x49bfb0[_0x3d94('0xa2')]=qs[_0x3d94('0xa2')](_0x1c99d1['query'][_0x3d94('0xa2')]);_0x49bfb0['offset']=qs['offset'](_0x1c99d1[_0x3d94('0x8b')]['offset']);}_0x49bfb0[_0x3d94('0xa3')]=qs[_0x3d94('0xa4')](_0x1c99d1['query'][_0x3d94('0xa4')]);_0x49bfb0['where']=qs[_0x3d94('0x9c')](_[_0x3d94('0xa5')](_0x1c99d1['query'],_0x336e36['filters']));if(_0x1c99d1['query'][_0x3d94('0x6')]){_0x49bfb0['where']=_['merge'](_0x49bfb0[_0x3d94('0xa6')],{'$or':_[_0x3d94('0x10')](_0x1c7ea5,function(_0x184c4b){if(_0x184c4b[_0x3d94('0x11')]['key']!==_0x3d94('0xa7')){var _0x3fc0e7={};_0x3fc0e7[_0x184c4b[_0x3d94('0x5')]]={'$like':'%'+_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0x6')]+'%'};return _0x3fc0e7;}})});}var _0x200cc2=[];var _0x53c0f0=null;var _0x467ccb={};if(_0x406098){_0x53c0f0=_[_0x3d94('0x97')](_0x3ac9ea,[_0x3d94('0xc'),_0x406098[_0x3d94('0xc')]]);if(_0x53c0f0[_0x3d94('0x5')]){_0x467ccb={};if(_0x5c7aac[_0x3d94('0x15')]===_0x3d94('0xf')){_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_['map'](_0x406098['associatedResources'],'id');}else{_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_0x406098[_0x3d94('0x8')];}_0x200cc2[_0x3d94('0x95')](_0x467ccb);}else{_0x49bfb0['where']['id']=_0x406098[_0x3d94('0x8')];}}else{for(var _0xa193a1=0x0;_0xa193a1<_0x426ef5[_0x3d94('0x94')];_0xa193a1++){_0x53c0f0=_[_0x3d94('0x97')](_0x3ac9ea,[_0x3d94('0xc'),_0x426ef5[_0xa193a1]['name']]);if(_0x53c0f0['field']){_0x467ccb={};_0x467ccb[_0x53c0f0[_0x3d94('0xa8')]]=_0x426ef5[_0xa193a1][_0x3d94('0x8')];_0x200cc2[_0x3d94('0x95')](_0x467ccb);}else{if(!_0x49bfb0[_0x3d94('0xa6')]['id'])_0x49bfb0[_0x3d94('0xa6')]['id']=[];_0x426ef5[_0xa193a1][_0x3d94('0x8')][_0x3d94('0xa9')](function(_0x3bcc86){_0x49bfb0[_0x3d94('0xa6')]['id'][_0x3d94('0x95')](_0x3bcc86);});}}}if(!_[_0x3d94('0x93')](_0x200cc2)){_0x49bfb0[_0x3d94('0xa6')]=_[_0x3d94('0xaa')](_0x49bfb0['where'],{'$and':{'$or':_0x200cc2}});}_0x49bfb0=_[_0x3d94('0xaa')]({},_0x49bfb0,_0x1c99d1[_0x3d94('0xab')]);if(_0x406098&&!_0x406098['autoAssociation']&&_0x5c7aac['childModel']===_0x3d94('0xf')){if(_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xac')]){_0x49bfb0[_0x3d94('0xad')]=[{'all':!![]}];}return _0x3edd1b[_0x5c7aac['childModel']]['findAll'](_0x49bfb0)[_0x3d94('0x7')](function(_0x2ec7d9){var _0x243db0=[];_0x2ec7d9[_0x3d94('0xa9')](function(_0x106b3b){var _0x5350a3;switch(_0x106b3b[_0x3d94('0xae')]){case'default':_0x5350a3=_[_0x3d94('0x97')](_0x406098[_0x3d94('0x8')],function(_0x472151){return _0x472151['id']===_0x106b3b['reportId']&&_0x472151[_0x3d94('0x11')]===_0x3d94('0xaf');});break;case'custom':_0x5350a3=_[_0x3d94('0x97')](_0x406098['associatedResources'],function(_0x3c62ec){return _0x3c62ec['id']===_0x106b3b[_0x3d94('0x7d')]&&_0x3c62ec[_0x3d94('0x11')]==='CustomReports';});break;}if(_0x5350a3)_0x243db0[_0x3d94('0x95')](_0x106b3b);});_0x4eee2b[_0x3d94('0xb0')]=_0x243db0[_0x3d94('0x94')];_0x4eee2b['rows']=_0x243db0;return _0x4eee2b;});}else{if(!_[_0x3d94('0x93')](_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb1')])){_0x49bfb0[_0x3d94('0xa6')]['id']=_0x49bfb0[_0x3d94('0xa6')]['id']?_[_0x3d94('0x9e')](_0x49bfb0[_0x3d94('0xa6')]['id'],_0x1c99d1[_0x3d94('0x8b')]['ids']):_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb1')];}return _0x3edd1b[_0x5c7aac[_0x3d94('0x15')]][_0x3d94('0xb0')]({'where':_0x49bfb0[_0x3d94('0xa6')]})[_0x3d94('0x7')](function(_0x5716fd){_0x4eee2b[_0x3d94('0xb0')]=_0x5716fd;if(_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xac')]){if(_0x5c7aac['childModel']===_0x3d94('0xb2')){_0x49bfb0['include']=[{'model':_0x3edd1b[_0x3d94('0x72')],'as':_0x3d94('0xb3'),'attributes':['id','name',_0x3d94('0xb4')],'required':_0x1c99d1[_0x3d94('0x8b')]['tag']?!![]:![]},{'model':_0x3edd1b['Tag'],'as':_0x3d94('0xb5'),'attributes':['id',_0x3d94('0xc'),'color'],'through':_0x1c99d1['query']['tag']?{'attributes':[],'where':{'TagId':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb6')]||undefined}}:{},'required':_0x1c99d1[_0x3d94('0x8b')][_0x3d94('0xb6')]?!![]:![]}];}else{_0x49bfb0[_0x3d94('0xad')]=[{'all':!![]}];}}return _0x3edd1b[_0x5c7aac['childModel']][_0x3d94('0xe')](_0x49bfb0);})[_0x3d94('0x7')](function(_0x239992){_0x4eee2b['rows']=_0x239992;if(_0x3135f3===_0x3d94('0x35')&&_0x1c99d1['query'][_0x3d94('0xb7')]===_0x3d94('0xb8')){var _0x25015e=[];for(var _0xbf625a=0x0;_0xbf625a<_0x4eee2b[_0x3d94('0xb9')]['length'];_0xbf625a++){_0x25015e['push'](_0x3a837b(_0x3d94('0xba'),_0x4eee2b[_0x3d94('0xb9')][_0xbf625a]['dataValues']));_0x25015e[_0x3d94('0x95')](_0x3a837b('sms',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e[_0x3d94('0x95')](_0x3a837b('fax',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a]['dataValues']));_0x25015e[_0x3d94('0x95')](_0x3a837b(_0x3d94('0xbc'),_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e['push'](_0x3a837b('openchannel',_0x4eee2b[_0x3d94('0xb9')][_0xbf625a][_0x3d94('0xbb')]));_0x25015e[_0x3d94('0x95')](_0x3a837b(_0x3d94('0xbd'),_0x4eee2b['rows'][_0xbf625a][_0x3d94('0xbb')]));}return Promise['all'](_0x25015e)['then'](function(){return _0x4eee2b;});}return _0x4eee2b;});}});}}});}; \ No newline at end of file +var _0xd7d1=['UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','length','UserProfileSection','find','all','ignore','isEmpty','union','push','autoAssociation','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','reportType','default','reportId','DefaultReports','custom','rows','ids','intersection','count','include','Tag','Tags','tag','openTabs','true','chat','dataValues','sms','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','name','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','childModel','JscriptyProject','contacts','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceRecording','Agents','role','agent','Telephones','membername','User','telephone','VoiceQueues','QueueCampaigns','queue','VoiceQueue','type','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','plugins','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs'];(function(_0xfcdd76,_0x4a6bb2){var _0x165ef6=function(_0x1fb4cd){while(--_0x1fb4cd){_0xfcdd76['push'](_0xfcdd76['shift']());}};_0x165ef6(++_0x4a6bb2);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2f699c,_0x3ab00a){_0x2f699c=_0x2f699c-0x0;var _0xe2d19b=_0xd7d1[_0x2f699c];return _0xe2d19b;};'use strict';var _=require(_0x1d7d('0x0'));var attributes=require(_0x1d7d('0x1'));var qs=require(_0x1d7d('0x2'));var squel=require(_0x1d7d('0x3'));module[_0x1d7d('0x4')]=function(_0x3c3a27){var _0x222e84=_0x3c3a27[_0x1d7d('0x5')];function _0x1ac097(_0x1adb6b,_0x3c0839){return new Promise(function(_0x1a2564,_0x14b2b9){if(!_0x3c0839)return _0x1a2564(null);var _0x5a8cf3=_0x3c0839[_0x1d7d('0x6')]?{[_0x3c0839[_0x1d7d('0x6')][_0x1d7d('0x7')]]:_0x3c0839[_0x1d7d('0x6')][_0x1d7d('0x8')]}:undefined;return _0x222e84[_0x1adb6b][_0x1d7d('0x9')]({'where':_0x5a8cf3,'raw':!![]})[_0x1d7d('0xa')](function(_0xa44223){_0x3c0839[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0xa44223,'id');_0x1a2564(_0x3c0839);})[_0x1d7d('0xd')](function(_0x547f7b){_0x14b2b9(_0x547f7b);});});}function _0xe6b9eb(_0x4c6809,_0x3cbca9){return new Promise(function(_0x3a7add,_0x3ddf35){var _0x30b888=_0x4c6809['filter']?{[_0x4c6809[_0x1d7d('0x6')]['field']]:_0x4c6809['filter'][_0x1d7d('0x8')]}:undefined;return _0x222e84[_0x4c6809[_0x1d7d('0xe')]]['findAll']({'where':_0x30b888,'raw':!![]})['then'](function(_0x1d3822){_0x3cbca9[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x1d3822,function(_0x183fc6){return _0x183fc6[_0x1d7d('0xf')];});_0x3a7add(_0x3cbca9);})['catch'](function(_0x28adf3){_0x3ddf35(_0x28adf3);});});}function _0x1de6cc(_0x51cbca,_0xb90a8c,_0x162c3a){if(!_0xb90a8c)return Promise[_0x1d7d('0x10')](null);return new Promise(function(_0x47826a,_0x40db4d){return _0x222e84['UserProfileResource'][_0x1d7d('0x9')]({'where':{'sectionId':_0xb90a8c['id']},'raw':!![]})[_0x1d7d('0xa')](function(_0x5cbb8f){if(_0x51cbca['field']&&_0x51cbca[_0x1d7d('0x7')]!=='id'){_0xb90a8c[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x396802){return _0x396802[_0x51cbca[_0x1d7d('0x7')]];});}else{if(_0x162c3a===_0x1d7d('0x11')){_0xb90a8c['associatedResources']=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x40c27f){return{'id':_0x40c27f[_0x1d7d('0x12')],'type':_0x40c27f['type']};});}else{_0xb90a8c[_0x1d7d('0xb')]=_[_0x1d7d('0xc')](_0x5cbb8f,function(_0x4a1cdc){return _0x4a1cdc['resourceId'];});}}_0x47826a(_0xb90a8c);})[_0x1d7d('0xd')](function(_0x264a4e){_0x40db4d(_0x264a4e);});});}function _0x3d631f(_0x5097b8,_0x377653){var _0x106376={'parentSections':[]};switch(_0x5097b8[_0x1d7d('0x13')]()){case _0x1d7d('0x14'):_0x106376['childModel']=_0x1d7d('0x15');break;case _0x1d7d('0x16'):_0x106376['childModel']='SquareOdbc';break;case _0x1d7d('0x17'):_0x106376['childModel']=_0x1d7d('0x18');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x1a'),'field':_0x1d7d('0xf'),'foreignKey':_0x1d7d('0x1b')}];break;case'projects':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x1d');break;case _0x1d7d('0x1e'):_0x106376['childModel']=_0x1d7d('0x1f');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x20'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x106376['childModel']=_0x1d7d('0x21');break;case _0x1d7d('0x22'):_0x106376['childModel']=_0x1d7d('0x23');break;case _0x1d7d('0x24'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x25');break;case _0x1d7d('0x26'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x27');break;case _0x1d7d('0x28'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x29');break;case'faxqueues':_0x106376['childModel']=_0x1d7d('0x2a');break;case _0x1d7d('0x2b'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x2c');break;case _0x1d7d('0x2d'):case _0x1d7d('0x2e'):case _0x1d7d('0x2f'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x30');break;case'contexts':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x31');break;case _0x1d7d('0x32'):_0x106376[_0x1d7d('0x1c')]='VoiceMail';break;case'voicerecordings':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x33');_0x106376['parentSections']=[{'name':_0x1d7d('0x34'),'field':_0x1d7d('0xf'),'foreignKey':'membername','model':'User','filter':{'field':_0x1d7d('0x35'),'value':[_0x1d7d('0x36')]}},{'name':_0x1d7d('0x37'),'field':_0x1d7d('0xf'),'foreignKey':_0x1d7d('0x38'),'model':_0x1d7d('0x39'),'filter':{'field':_0x1d7d('0x35'),'value':[_0x1d7d('0x3a')]}},{'name':_0x1d7d('0x3b'),'field':_0x1d7d('0xf'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0x1d7d('0x3c'),'field':'name','foreignKey':_0x1d7d('0x3d'),'model':_0x1d7d('0x3e'),'filter':{'field':_0x1d7d('0x3f'),'value':['outbound']}}];break;case _0x1d7d('0x40'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x41');break;case'chanspies':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x42');break;case _0x1d7d('0x43'):_0x106376[_0x1d7d('0x1c')]='VoicePrefix';break;case _0x1d7d('0x44'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x45');break;case _0x1d7d('0x46'):_0x106376['childModel']=_0x1d7d('0x47');break;case'mailaccounts':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x48');break;case _0x1d7d('0x49'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x4a');break;case'openchannelqueues':_0x106376['childModel']=_0x1d7d('0x4b');break;case _0x1d7d('0x4c'):_0x106376[_0x1d7d('0x1c')]='OpenchannelAccount';break;case'smsqueues':_0x106376[_0x1d7d('0x1c')]='SmsQueue';break;case _0x1d7d('0x4d'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x4e');break;case _0x1d7d('0x4f'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x50');break;case _0x1d7d('0x51'):_0x106376['childModel']=_0x1d7d('0x52');break;case _0x1d7d('0x53'):_0x106376['childModel']=_0x1d7d('0x54');break;case _0x1d7d('0x55'):case _0x1d7d('0x56'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x3e');if(_0x377653){_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x3b')},{'name':_0x1d7d('0x3c')}];}break;case _0x1d7d('0x57'):case _0x1d7d('0x58'):case _0x1d7d('0x59'):_0x106376[_0x1d7d('0x1c')]='User';if(_0x377653){_0x106376[_0x1d7d('0x19')]=[{'name':'Users','filter':{'field':_0x1d7d('0x35'),'value':['admin',_0x1d7d('0x5a')]},'ignore':!![]},{'name':_0x1d7d('0x34')},{'name':_0x1d7d('0x37')}];}break;case _0x1d7d('0x5b'):_0x106376['childModel']=_0x1d7d('0x5c');break;case'salesforceaccounts':_0x106376['childModel']=_0x1d7d('0x5d');break;case'freshdeskaccounts':_0x106376['childModel']=_0x1d7d('0x5e');break;case _0x1d7d('0x5f'):_0x106376['childModel']=_0x1d7d('0x60');break;case _0x1d7d('0x61'):_0x106376['childModel']=_0x1d7d('0x62');break;case _0x1d7d('0x63'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x64');break;case'vtigeraccounts':_0x106376['childModel']=_0x1d7d('0x39');break;case _0x1d7d('0x65'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x66');break;case _0x1d7d('0x67'):_0x106376['childModel']=_0x1d7d('0x68');break;case _0x1d7d('0x69'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6a');break;case _0x1d7d('0x6b'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6c');break;case _0x1d7d('0x6d'):_0x106376[_0x1d7d('0x1c')]='Pause';break;case _0x1d7d('0x6e'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x6f');break;case'sounds':_0x106376['childModel']=_0x1d7d('0x70');break;case _0x1d7d('0x71'):_0x106376[_0x1d7d('0x1c')]='Tag';break;case _0x1d7d('0x72'):_0x106376[_0x1d7d('0x1c')]='Template';break;case _0x1d7d('0x73'):_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x74');break;case _0x1d7d('0x75'):_0x106376['childModel']=_0x1d7d('0x76');break;case _0x1d7d('0x77'):_0x106376['childModel']='Variable';break;case _0x1d7d('0x78'):_0x106376[_0x1d7d('0x1c')]='Plugin';break;case'extractedreports':_0x106376[_0x1d7d('0x1c')]=_0x1d7d('0x11');_0x106376[_0x1d7d('0x19')]=[{'name':_0x1d7d('0x79'),'field':'id','foreignKey':'reportId'}];break;case _0x1d7d('0x7a'):_0x106376['childModel']=_0x1d7d('0x7b');break;}return _0x106376;}function _0x1b1d9e(_0x14078d,_0x5f84fe){var _0x5a4bd7=_0x14078d[_0x1d7d('0x7c')](0x0)[_0x1d7d('0x7d')]()+_0x14078d[_0x1d7d('0x7e')](0x1);var _0x226509={'type':_0x222e84[_0x1d7d('0x7f')][_0x1d7d('0x80')][_0x1d7d('0x81')],'raw':!![]};return new Promise(function(_0x2bd2a0,_0x27cebf){var _0x17c967=squel[_0x1d7d('0x82')]()[_0x1d7d('0x7')](_0x1d7d('0x83')+_0x5a4bd7+_0x1d7d('0x84'),'id')[_0x1d7d('0x7')]('ui.createdAt')[_0x1d7d('0x85')]('user_has_'+_0x14078d+_0x1d7d('0x86'),'ui')[_0x1d7d('0x87')](_0x1d7d('0x88'),_0x5f84fe['id']);return _0x222e84[_0x1d7d('0x89')][_0x1d7d('0x8a')](_0x17c967[_0x1d7d('0x8b')](),_0x226509)['then'](function(_0x9043bf){_0x5f84fe[_0x5a4bd7+_0x1d7d('0x8c')]=_0x9043bf;_0x2bd2a0(_0x9043bf);})['catch'](function(_0x2c6d03){_0x27cebf(_0x2c6d03);});});}return _0x3c3a27['define'](_0x1d7d('0x8d'),attributes,{'tableName':_0x1d7d('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x11eddd){var _0x283f77={'raw':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x8f')],'where':{}};var _0x516aa0={};var _0x3768a7={'count':0x0,'rows':[]};var _0x35a44b=_0x11eddd['query'][_0x1d7d('0x90')];var _0x3da337=_0x11eddd[_0x1d7d('0x8a')]['mergeResources']||![];var _0x3b3975=_0x3d631f(_0x35a44b,_0x3da337);if(!_0x3b3975[_0x1d7d('0x1c')])throw new Error(_0x1d7d('0x91')+_0x35a44b+'\x27');var _0x1938fe=[{'name':_0x35a44b}];if(!_['isEmpty'](_0x3b3975[_0x1d7d('0x19')]))_0x1938fe=_0x3b3975[_0x1d7d('0x19')];var _0x1e25db=[];for(var _0x18dac4=0x0;_0x18dac4<_0x1938fe[_0x1d7d('0x92')];_0x18dac4++){_0x1e25db['push'](_0x222e84[_0x1d7d('0x93')][_0x1d7d('0x94')]({'where':{'userProfileId':_0x11eddd['params']['id'],'name':_0x1938fe[_0x18dac4][_0x1d7d('0xf')]},'raw':!![]}));}return Promise[_0x1d7d('0x95')](_0x1e25db)[_0x1d7d('0xa')](function(_0x20c900){var _0x47d27e=_[_0x1d7d('0x6')](_0x20c900,function(_0x4a3159){return _0x4a3159?_0x4a3159:undefined;});var _0x3b93aa=_[_0x1d7d('0x6')](_0x1938fe,[_0x1d7d('0x96'),!![]]);var _0x5e1172=_[_0x1d7d('0x97')](_0x47d27e)&&_[_0x1d7d('0x97')](_0x3b93aa)?null:_[_0x1d7d('0x98')](_0x3b93aa,_0x47d27e);if(!_0x5e1172)return null;var _0x55ded9=[];for(var _0x45b66d=0x0;_0x45b66d<_0x5e1172['length'];_0x45b66d++){var _0x6e9ee6=_[_0x1d7d('0x94')](_0x1938fe,function(_0x131c8e){return _0x5e1172[_0x45b66d]?_0x131c8e[_0x1d7d('0xf')]===_0x5e1172[_0x45b66d][_0x1d7d('0xf')]:null;});if(_0x6e9ee6){if(_0x5e1172[_0x45b66d][_0x1d7d('0x96')]){_0x55ded9[_0x1d7d('0x99')](_0x1ac097(_0x3b3975[_0x1d7d('0x1c')],_0x5e1172[_0x45b66d]));}else{if(!_0x5e1172[_0x45b66d][_0x1d7d('0x9a')]){_0x55ded9[_0x1d7d('0x99')](_0x1de6cc(_0x6e9ee6,_0x5e1172[_0x45b66d],_0x3b3975[_0x1d7d('0x1c')]));}else{if(_0x6e9ee6['model']){_0x55ded9['push'](_0xe6b9eb(_0x6e9ee6,_0x5e1172[_0x45b66d]));}}}}}return Promise[_0x1d7d('0x95')](_0x55ded9);})[_0x1d7d('0xa')](function(_0x3b2615){var _0x5f3406=_0x3b2615;var _0x44854c=null;if(_0x5f3406){_0x44854c=_0x5f3406['length']===0x1?_0x5f3406[0x0]:null;}if(!_0x44854c&&!_0x5f3406)return _0x3768a7;var _0x139d9a=_0x222e84[_0x3b3975[_0x1d7d('0x1c')]]['rawAttributes'];_0x516aa0[_0x1d7d('0xe')]=_[_0x1d7d('0x9b')](_0x139d9a);_0x516aa0['query']=_[_0x1d7d('0x9b')](_0x11eddd[_0x1d7d('0x8a')]);_0x516aa0[_0x1d7d('0x9c')]=_['intersection'](_0x516aa0['model'],_0x516aa0[_0x1d7d('0x8a')]);_0x283f77[_0x1d7d('0x9d')]=_['intersection'](_0x516aa0[_0x1d7d('0xe')],qs[_0x1d7d('0x9e')](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x9e')]));_0x283f77['attributes']=_0x283f77[_0x1d7d('0x9d')][_0x1d7d('0x92')]?_0x283f77[_0x1d7d('0x9d')]:_0x516aa0[_0x1d7d('0xe')];if(!_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x9f')](_0x1d7d('0xa0'))){_0x283f77[_0x1d7d('0xa1')]=qs[_0x1d7d('0xa1')](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xa1')]);_0x283f77[_0x1d7d('0xa2')]=qs[_0x1d7d('0xa2')](_0x11eddd['query'][_0x1d7d('0xa2')]);}_0x283f77[_0x1d7d('0xa3')]=qs['sort'](_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xa4')]);_0x283f77['where']=qs['filters'](_['pick'](_0x11eddd[_0x1d7d('0x8a')],_0x516aa0[_0x1d7d('0x9c')]));if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x6')]){_0x283f77['where']=_[_0x1d7d('0xa5')](_0x283f77[_0x1d7d('0x87')],{'$or':_[_0x1d7d('0xc')](_0x139d9a,function(_0x1d39a9){if(_0x1d39a9['type'][_0x1d7d('0xa6')]!==_0x1d7d('0xa7')){var _0x135910={};_0x135910[_0x1d39a9[_0x1d7d('0x7')]]={'$like':'%'+_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0x6')]+'%'};return _0x135910;}})});}var _0x57abf9=[];var _0x230834=null;var _0x2d90fb={};if(_0x44854c){_0x230834=_['find'](_0x1938fe,[_0x1d7d('0xf'),_0x44854c[_0x1d7d('0xf')]]);if(_0x230834[_0x1d7d('0x7')]){_0x2d90fb={};if(_0x3b3975['childModel']===_0x1d7d('0x11')){_0x2d90fb[_0x230834['foreignKey']]=_[_0x1d7d('0xc')](_0x44854c[_0x1d7d('0xb')],'id');}else{_0x2d90fb[_0x230834['foreignKey']]=_0x44854c[_0x1d7d('0xb')];}_0x57abf9[_0x1d7d('0x99')](_0x2d90fb);}else{_0x283f77[_0x1d7d('0x87')]['id']=_0x44854c[_0x1d7d('0xb')];}}else{for(var _0x20b275=0x0;_0x20b275<_0x5f3406[_0x1d7d('0x92')];_0x20b275++){_0x230834=_[_0x1d7d('0x94')](_0x1938fe,[_0x1d7d('0xf'),_0x5f3406[_0x20b275][_0x1d7d('0xf')]]);if(_0x230834[_0x1d7d('0x7')]){_0x2d90fb={};_0x2d90fb[_0x230834[_0x1d7d('0xa8')]]=_0x5f3406[_0x20b275][_0x1d7d('0xb')];_0x57abf9['push'](_0x2d90fb);}else{if(!_0x283f77['where']['id'])_0x283f77[_0x1d7d('0x87')]['id']=[];_0x5f3406[_0x20b275][_0x1d7d('0xb')][_0x1d7d('0xa9')](function(_0x395818){_0x283f77[_0x1d7d('0x87')]['id'][_0x1d7d('0x99')](_0x395818);});}}}if(!_[_0x1d7d('0x97')](_0x57abf9)){_0x283f77[_0x1d7d('0x87')]=_[_0x1d7d('0xa5')](_0x283f77[_0x1d7d('0x87')],{'$and':{'$or':_0x57abf9}});}_0x283f77=_[_0x1d7d('0xa5')]({},_0x283f77,_0x11eddd[_0x1d7d('0xaa')]);if(_0x44854c&&!_0x44854c['autoAssociation']&&_0x3b3975[_0x1d7d('0x1c')]===_0x1d7d('0x11')){if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xab')]){_0x283f77['include']=[{'all':!![]}];}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]][_0x1d7d('0x9')](_0x283f77)[_0x1d7d('0xa')](function(_0x31cfa1){var _0x53cc1d=[];_0x31cfa1['forEach'](function(_0x5e4340){var _0x56030c;switch(_0x5e4340[_0x1d7d('0xac')]){case _0x1d7d('0xad'):_0x56030c=_['find'](_0x44854c['associatedResources'],function(_0xb5db24){return _0xb5db24['id']===_0x5e4340[_0x1d7d('0xae')]&&_0xb5db24[_0x1d7d('0x3f')]===_0x1d7d('0xaf');});break;case _0x1d7d('0xb0'):_0x56030c=_[_0x1d7d('0x94')](_0x44854c[_0x1d7d('0xb')],function(_0x35020c){return _0x35020c['id']===_0x5e4340[_0x1d7d('0xae')]&&_0x35020c[_0x1d7d('0x3f')]==='CustomReports';});break;}if(_0x56030c)_0x53cc1d[_0x1d7d('0x99')](_0x5e4340);});_0x3768a7['count']=_0x53cc1d[_0x1d7d('0x92')];_0x3768a7[_0x1d7d('0xb1')]=_0x53cc1d;return _0x3768a7;});}else{if(!_[_0x1d7d('0x97')](_0x11eddd['query'][_0x1d7d('0xb2')])){_0x283f77[_0x1d7d('0x87')]['id']=_0x283f77[_0x1d7d('0x87')]['id']?_[_0x1d7d('0xb3')](_0x283f77[_0x1d7d('0x87')]['id'],_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb2')]):_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb2')];}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]][_0x1d7d('0xb4')]({'where':_0x283f77[_0x1d7d('0x87')]})[_0x1d7d('0xa')](function(_0xd6c7ad){_0x3768a7[_0x1d7d('0xb4')]=_0xd6c7ad;if(_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xab')]){if(_0x3b3975[_0x1d7d('0x1c')]===_0x1d7d('0x1f')){_0x283f77[_0x1d7d('0xb5')]=[{'model':_0x222e84[_0x1d7d('0xb6')],'as':_0x1d7d('0xb7'),'attributes':['id',_0x1d7d('0xf'),'color'],'required':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb8')]?!![]:![]},{'model':_0x222e84[_0x1d7d('0xb6')],'as':'ThroughTags','attributes':['id',_0x1d7d('0xf'),'color'],'through':_0x11eddd['query']['tag']?{'attributes':[],'where':{'TagId':_0x11eddd['query'][_0x1d7d('0xb8')]||undefined}}:{},'required':_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb8')]?!![]:![]}];}else{_0x283f77['include']=[{'all':!![]}];}}return _0x222e84[_0x3b3975[_0x1d7d('0x1c')]]['findAll'](_0x283f77);})[_0x1d7d('0xa')](function(_0x25a34f){_0x3768a7[_0x1d7d('0xb1')]=_0x25a34f;if(_0x35a44b===_0x1d7d('0x34')&&_0x11eddd[_0x1d7d('0x8a')][_0x1d7d('0xb9')]===_0x1d7d('0xba')){var _0x171024=[];for(var _0x44baef=0x0;_0x44baef<_0x3768a7[_0x1d7d('0xb1')][_0x1d7d('0x92')];_0x44baef++){_0x171024['push'](_0x1b1d9e(_0x1d7d('0xbb'),_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024['push'](_0x1b1d9e(_0x1d7d('0xbd'),_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024['push'](_0x1b1d9e('fax',_0x3768a7[_0x1d7d('0xb1')][_0x44baef]['dataValues']));_0x171024[_0x1d7d('0x99')](_0x1b1d9e(_0x1d7d('0xbe'),_0x3768a7['rows'][_0x44baef][_0x1d7d('0xbc')]));_0x171024[_0x1d7d('0x99')](_0x1b1d9e('openchannel',_0x3768a7[_0x1d7d('0xb1')][_0x44baef][_0x1d7d('0xbc')]));_0x171024[_0x1d7d('0x99')](_0x1b1d9e(_0x1d7d('0xbf'),_0x3768a7['rows'][_0x44baef]['dataValues']));}return Promise[_0x1d7d('0x95')](_0x171024)[_0x1d7d('0xa')](function(){return _0x3768a7;});}return _0x3768a7;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7774e93..f2bf6bb 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 _0x3e0c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','defaults','redis','localhost','request','then','info','request\x20sent','debug','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x5e7f24,_0x7b595){var _0x11d440=function(_0x313759){while(--_0x313759){_0x5e7f24['push'](_0x5e7f24['shift']());}};_0x11d440(++_0x7b595);}(_0x3e0c,0x16d));var _0xc3e0=function(_0xf6bb7d,_0x8af4f5){_0xf6bb7d=_0xf6bb7d-0x0;var _0x132764=_0x3e0c[_0xf6bb7d];return _0x132764;};'use strict';var _=require(_0xc3e0('0x0'));var util=require(_0xc3e0('0x1'));var moment=require(_0xc3e0('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e0('0x3'));var fs=require('fs');var Redis=require(_0xc3e0('0x4'));var db=require(_0xc3e0('0x5'))['db'];var utils=require(_0xc3e0('0x6'));var logger=require(_0xc3e0('0x7'))('rpc');var config=require(_0xc3e0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc3e0('0x9')](config[_0xc3e0('0xa')],{'host':_0xc3e0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x433fd1,_0x33ed9c,_0xca5897){return new BPromise(function(_0x231293,_0x3f38c5){return client[_0xc3e0('0xc')](_0x433fd1,_0xca5897)[_0xc3e0('0xd')](function(_0x493aaa){logger[_0xc3e0('0xe')]('UserProfile,\x20%s,\x20%s',_0x33ed9c,_0xc3e0('0xf'));logger[_0xc3e0('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x33ed9c,_0xc3e0('0xf'),JSON['stringify'](_0x493aaa));if(_0x493aaa[_0xc3e0('0x11')]){if(_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x12')]===0x1f4){logger[_0xc3e0('0x11')](_0xc3e0('0x13'),_0x33ed9c,_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);return _0x3f38c5(_0x493aaa['error'][_0xc3e0('0x14')]);}logger[_0xc3e0('0x11')]('UserProfile,\x20%s,\x20%s',_0x33ed9c,_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);return _0x231293(_0x493aaa[_0xc3e0('0x11')][_0xc3e0('0x14')]);}else{logger[_0xc3e0('0xe')](_0xc3e0('0x13'),_0x33ed9c,_0xc3e0('0xf'));_0x231293(_0x493aaa[_0xc3e0('0x15')][_0xc3e0('0x14')]);}})[_0xc3e0('0x16')](function(_0x6b3666){logger[_0xc3e0('0x11')](_0xc3e0('0x13'),_0x33ed9c,_0x6b3666);_0x3f38c5(_0x6b3666);});});} \ No newline at end of file +var _0x5226=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x51413c,_0x37d87a){var _0x2919d7=function(_0x1feaef){while(--_0x1feaef){_0x51413c['push'](_0x51413c['shift']());}};_0x2919d7(++_0x37d87a);}(_0x5226,0x137));var _0x6522=function(_0x1fe06f,_0x160669){_0x1fe06f=_0x1fe06f-0x0;var _0x500880=_0x5226[_0x1fe06f];return _0x500880;};'use strict';var _=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var moment=require(_0x6522('0x2'));var BPromise=require(_0x6522('0x3'));var rs=require(_0x6522('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6522('0x5'))['db'];var utils=require(_0x6522('0x6'));var logger=require(_0x6522('0x7'))('rpc');var config=require(_0x6522('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6522('0x9')][_0x6522('0xa')]({'port':0x232a});config[_0x6522('0xb')]=_[_0x6522('0xc')](config[_0x6522('0xb')],{'host':_0x6522('0xd'),'port':0x18eb});var socket=require(_0x6522('0xe'))(new Redis(config['redis']));require('./userProfile.socket')[_0x6522('0xf')](socket);function respondWithRpcPromise(_0x29affd,_0x2b6404,_0x424fec){return new BPromise(function(_0x417604,_0x2c9978){return client[_0x6522('0x10')](_0x29affd,_0x424fec)[_0x6522('0x11')](function(_0x274c05){logger[_0x6522('0x12')](_0x6522('0x13'),_0x2b6404,_0x6522('0x14'));logger[_0x6522('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2b6404,_0x6522('0x14'),JSON[_0x6522('0x16')](_0x274c05));if(_0x274c05[_0x6522('0x17')]){if(_0x274c05[_0x6522('0x17')][_0x6522('0x18')]===0x1f4){logger['error'](_0x6522('0x13'),_0x2b6404,_0x274c05[_0x6522('0x17')][_0x6522('0x19')]);return _0x2c9978(_0x274c05[_0x6522('0x17')][_0x6522('0x19')]);}logger[_0x6522('0x17')](_0x6522('0x13'),_0x2b6404,_0x274c05[_0x6522('0x17')][_0x6522('0x19')]);return _0x417604(_0x274c05[_0x6522('0x17')][_0x6522('0x19')]);}else{logger[_0x6522('0x12')]('UserProfile,\x20%s,\x20%s',_0x2b6404,_0x6522('0x14'));_0x417604(_0x274c05[_0x6522('0x1a')][_0x6522('0x19')]);}})[_0x6522('0x1b')](function(_0x4e8be8){logger[_0x6522('0x17')](_0x6522('0x13'),_0x2b6404,_0x4e8be8);_0x2c9978(_0x4e8be8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 514749f..e6d36bc 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 _0xfce5=['removeListener','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x32abb9,_0x5f0d36){var _0xbaa5f5=function(_0x52670e){while(--_0x52670e){_0x32abb9['push'](_0x32abb9['shift']());}};_0xbaa5f5(++_0x5f0d36);}(_0xfce5,0x159));var _0x5fce=function(_0x31b950,_0x48a4e9){_0x31b950=_0x31b950-0x0;var _0x415d87=_0xfce5[_0x31b950];return _0x415d87;};'use strict';var UserProfileEvents=require(_0x5fce('0x0'));var events=[_0x5fce('0x1'),_0x5fce('0x2'),_0x5fce('0x3')];function createListener(_0x3f46d2,_0x165daa){return function(_0x4843a1){_0x165daa[_0x5fce('0x4')](_0x3f46d2,_0x4843a1);};}function removeListener(_0x91d17e,_0x4ac4a8){return function(){UserProfileEvents[_0x5fce('0x5')](_0x91d17e,_0x4ac4a8);};}exports['register']=function(_0x14ab9a){for(var _0x2a4c4e=0x0,_0x40a190=events['length'];_0x2a4c4e<_0x40a190;_0x2a4c4e++){var _0x124a6d=events[_0x2a4c4e];var _0x4fb2e9=createListener(_0x5fce('0x6')+_0x124a6d,_0x14ab9a);UserProfileEvents['on'](_0x124a6d,_0x4fb2e9);}}; \ No newline at end of file +var _0x6d03=['removeListener','register','length','userProfile:','save','remove'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x6d03,0xd0));var _0x36d0=function(_0x1fce7e,_0x59ed12){_0x1fce7e=_0x1fce7e-0x0;var _0x29d882=_0x6d03[_0x1fce7e];return _0x29d882;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x36d0('0x0'),_0x36d0('0x1'),'update'];function createListener(_0x31ddd7,_0x55c00b){return function(_0x1617c0){_0x55c00b['emit'](_0x31ddd7,_0x1617c0);};}function removeListener(_0x131e75,_0xbac255){return function(){UserProfileEvents[_0x36d0('0x2')](_0x131e75,_0xbac255);};}exports[_0x36d0('0x3')]=function(_0x3f5232){for(var _0x565e6c=0x0,_0x48341e=events[_0x36d0('0x4')];_0x565e6c<_0x48341e;_0x565e6c++){var _0x4cccfb=events[_0x565e6c];var _0x15edde=createListener(_0x36d0('0x5')+_0x4cccfb,_0x3f5232);UserProfileEvents['on'](_0x4cccfb,_0x15edde);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index bb54472..a010933 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 _0xa49f=['isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xa49f,0x1c3));var _0xfa49=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xa49f[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xfa49('0x0'));var util=require(_0xfa49('0x1'));var path=require(_0xfa49('0x2'));var timeout=require(_0xfa49('0x3'));var express=require(_0xfa49('0x4'));var router=express[_0xfa49('0x5')]();var fs_extra=require(_0xfa49('0x6'));var auth=require(_0xfa49('0x7'));var interaction=require(_0xfa49('0x8'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xfa49('0x9')](),controller['index']);router[_0xfa49('0xa')](_0xfa49('0xb'),auth['isAuthenticated'](),controller[_0xfa49('0xc')]);router[_0xfa49('0xa')](_0xfa49('0xd'),auth['isAuthenticated'](),controller[_0xfa49('0xe')]);router[_0xfa49('0xf')]('/',auth[_0xfa49('0x9')](),controller[_0xfa49('0x10')]);router[_0xfa49('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfa49('0x12')](_0xfa49('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfa49('0x13')]=router; \ No newline at end of file +var _0x219f=['get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index'];(function(_0xe291c1,_0x50659b){var _0x47dd47=function(_0x3c0fbe){while(--_0x3c0fbe){_0xe291c1['push'](_0xe291c1['shift']());}};_0x47dd47(++_0x50659b);}(_0x219f,0xc3));var _0xf219=function(_0x178c82,_0x127b78){_0x178c82=_0x178c82-0x0;var _0x5f129c=_0x219f[_0x178c82];return _0x5f129c;};'use strict';var multer=require(_0xf219('0x0'));var util=require(_0xf219('0x1'));var path=require(_0xf219('0x2'));var timeout=require(_0xf219('0x3'));var express=require(_0xf219('0x4'));var router=express[_0xf219('0x5')]();var fs_extra=require(_0xf219('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf219('0x7'));var config=require(_0xf219('0x8'));var controller=require(_0xf219('0x9'));router['get']('/',auth[_0xf219('0xa')](),controller[_0xf219('0xb')]);router[_0xf219('0xc')](_0xf219('0xd'),auth[_0xf219('0xa')](),controller[_0xf219('0xe')]);router[_0xf219('0xc')](_0xf219('0xf'),auth[_0xf219('0xa')](),controller[_0xf219('0x10')]);router[_0xf219('0x11')]('/',auth[_0xf219('0xa')](),controller[_0xf219('0x12')]);router[_0xf219('0x13')](_0xf219('0xf'),auth[_0xf219('0xa')](),controller[_0xf219('0x14')]);router['delete'](_0xf219('0xf'),auth[_0xf219('0xa')](),controller[_0xf219('0x15')]);module[_0xf219('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bcae0d5..9394ab4 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 _0x7391=['sequelize','STRING','INTEGER'];(function(_0x6d3959,_0x54b9ef){var _0x260363=function(_0x3b9e3b){while(--_0x3b9e3b){_0x6d3959['push'](_0x6d3959['shift']());}};_0x260363(++_0x54b9ef);}(_0x7391,0x1aa));var _0x1739=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0x7391[_0x58fbb0];return _0x1783d2;};'use strict';var Sequelize=require(_0x1739('0x0'));module['exports']={'name':{'type':Sequelize[_0x1739('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x1739('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1739('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0996=['sequelize','exports','INTEGER','STRING'];(function(_0x51e9f5,_0x559db5){var _0x2dd5b0=function(_0x508f04){while(--_0x508f04){_0x51e9f5['push'](_0x51e9f5['shift']());}};_0x2dd5b0(++_0x559db5);}(_0x0996,0x7c));var _0x6099=function(_0x5d333c,_0x4abc7b){_0x5d333c=_0x5d333c-0x0;var _0x21ff69=_0x0996[_0x5d333c];return _0x21ff69;};'use strict';var Sequelize=require(_0x6099('0x0'));module[_0x6099('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6099('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6099('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index b35d3da..2425b5b 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 _0x90b1=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','UserProfileResource','includeAll','rows','include','find','catch','body','params','describe','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'];(function(_0x179c07,_0x1491cf){var _0x59e146=function(_0xe455b8){while(--_0xe455b8){_0x179c07['push'](_0x179c07['shift']());}};_0x59e146(++_0x1491cf);}(_0x90b1,0x1bb));var _0x190b=function(_0x5e31f3,_0x26086d){_0x5e31f3=_0x5e31f3-0x0;var _0xe8f38b=_0x90b1[_0x5e31f3];return _0xe8f38b;};'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['UserProfileResource'][_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['UserProfileResource']['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['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['UserProfileResource'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));};exports[_0x190b('0x45')]=function(_0x33cc78,_0x2ea1c8){return db[_0x190b('0x3d')][_0x190b('0x45')]()[_0x190b('0x22')](respondWithResult(_0x2ea1c8,null))['catch'](handleError(_0x2ea1c8,null));}; \ No newline at end of file +var _0xef0f=['json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileResource','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','undefined','limit','count','Content-Range'];(function(_0x42f9e4,_0x221042){var _0x9b6e43=function(_0x4ba642){while(--_0x4ba642){_0x42f9e4['push'](_0x42f9e4['shift']());}};_0x9b6e43(++_0x221042);}(_0xef0f,0x168));var _0xfef0=function(_0x1de30d,_0x172762){_0x1de30d=_0x1de30d-0x0;var _0x3c1af8=_0xef0f[_0x1de30d];return _0x3c1af8;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];function respondWithStatusCode(_0x546c7a,_0x3135ab){_0x3135ab=_0x3135ab||0xcc;return function(_0x2f4e23){if(_0x2f4e23){return _0x546c7a[_0xfef0('0x1b')](_0x3135ab);}return _0x546c7a[_0xfef0('0x1c')](_0x3135ab)[_0xfef0('0x1d')]();};}function respondWithResult(_0x45599a,_0xa9f040){_0xa9f040=_0xa9f040||0xc8;return function(_0x573ae7){if(_0x573ae7){return _0x45599a[_0xfef0('0x1c')](_0xa9f040)['json'](_0x573ae7);}};}function respondWithFilteredResult(_0x4b5bcf,_0x5acdd0){return function(_0x118b8d){if(_0x118b8d){var _0x284b6d=typeof _0x5acdd0[_0xfef0('0x1e')]===_0xfef0('0x1f')&&typeof _0x5acdd0[_0xfef0('0x20')]===_0xfef0('0x1f');var _0x155833=_0x118b8d[_0xfef0('0x21')];var _0x581459=_0x284b6d?0x0:_0x5acdd0[_0xfef0('0x1e')];var _0x1642cd=_0x284b6d?_0x118b8d[_0xfef0('0x21')]:_0x5acdd0[_0xfef0('0x1e')]+_0x5acdd0[_0xfef0('0x20')];var _0x55912f;if(_0x1642cd>=_0x155833){_0x1642cd=_0x155833;_0x55912f=0xc8;}else{_0x55912f=0xce;}_0x4b5bcf[_0xfef0('0x1c')](_0x55912f);return _0x4b5bcf['set'](_0xfef0('0x22'),_0x581459+'-'+_0x1642cd+'/'+_0x155833)[_0xfef0('0x23')](_0x118b8d);}return null;};}function patchUpdates(_0x28dee1){return function(_0x48408a){try{jsonpatch[_0xfef0('0x24')](_0x48408a,_0x28dee1,!![]);}catch(_0x4c304d){return BPromise[_0xfef0('0x25')](_0x4c304d);}return _0x48408a[_0xfef0('0x26')]();};}function saveUpdates(_0x52b93b,_0x4897af){return function(_0x4b8b22){if(_0x4b8b22){return _0x4b8b22[_0xfef0('0x27')](_0x52b93b)['then'](function(_0x1f9970){return _0x1f9970;});}return null;};}function removeEntity(_0x46b34a,_0x1a8d66){return function(_0x4483f2){if(_0x4483f2){return _0x4483f2[_0xfef0('0x28')]()[_0xfef0('0x29')](function(){_0x46b34a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e20,_0x1ffaa4){return function(_0x924f6e){if(!_0x924f6e){_0x316e20[_0xfef0('0x1b')](0x194);}return _0x924f6e;};}function handleError(_0xab231c,_0xf60f2){_0xf60f2=_0xf60f2||0x1f4;return function(_0x5df04f){logger[_0xfef0('0x2a')](_0x5df04f[_0xfef0('0x2b')]);if(_0x5df04f['name']){delete _0x5df04f[_0xfef0('0x2c')];}_0xab231c[_0xfef0('0x1c')](_0xf60f2)[_0xfef0('0x2d')](_0x5df04f);};}exports[_0xfef0('0x2e')]=function(_0x37921f,_0x1ac4a3){var _0x3e3c4c={},_0x3e026a={},_0x26cb9a={'count':0x0,'rows':[]};var _0x213a91=_[_0xfef0('0x2f')](db[_0xfef0('0x30')]['rawAttributes'],function(_0x445625){return{'name':_0x445625['fieldName'],'type':_0x445625['type'][_0xfef0('0x31')]};});_0x3e026a[_0xfef0('0x32')]=_['map'](_0x213a91,'name');_0x3e026a['query']=_['keys'](_0x37921f['query']);_0x3e026a[_0xfef0('0x33')]=_[_0xfef0('0x34')](_0x3e026a[_0xfef0('0x32')],_0x3e026a['query']);_0x3e3c4c['attributes']=_['intersection'](_0x3e026a[_0xfef0('0x32')],qs['fields'](_0x37921f[_0xfef0('0x35')][_0xfef0('0x36')]));_0x3e3c4c[_0xfef0('0x37')]=_0x3e3c4c['attributes'][_0xfef0('0x38')]?_0x3e3c4c['attributes']:_0x3e026a[_0xfef0('0x32')];if(!_0x37921f[_0xfef0('0x35')][_0xfef0('0x39')](_0xfef0('0x3a'))){_0x3e3c4c[_0xfef0('0x20')]=qs[_0xfef0('0x20')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x20')]);_0x3e3c4c['offset']=qs[_0xfef0('0x1e')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x1e')]);}_0x3e3c4c[_0xfef0('0x3b')]=qs[_0xfef0('0x3c')](_0x37921f[_0xfef0('0x35')][_0xfef0('0x3c')]);_0x3e3c4c[_0xfef0('0x3d')]=qs[_0xfef0('0x33')](_[_0xfef0('0x3e')](_0x37921f[_0xfef0('0x35')],_0x3e026a[_0xfef0('0x33')]),_0x213a91);if(_0x37921f[_0xfef0('0x35')]['filter']){_0x3e3c4c[_0xfef0('0x3d')]=_['merge'](_0x3e3c4c[_0xfef0('0x3d')],{'$or':_[_0xfef0('0x2f')](_0x213a91,function(_0x1ddce6){if(_0x1ddce6['type']!==_0xfef0('0x3f')){var _0x29469e={};_0x29469e[_0x1ddce6[_0xfef0('0x2c')]]={'$like':'%'+_0x37921f['query'][_0xfef0('0x40')]+'%'};return _0x29469e;}})});}_0x3e3c4c=_[_0xfef0('0x41')]({},_0x3e3c4c,_0x37921f[_0xfef0('0x42')]);var _0x5577f4={'where':_0x3e3c4c[_0xfef0('0x3d')]};return db['UserProfileResource']['count'](_0x5577f4)[_0xfef0('0x29')](function(_0x547a5d){_0x26cb9a['count']=_0x547a5d;if(_0x37921f[_0xfef0('0x35')][_0xfef0('0x43')]){_0x3e3c4c[_0xfef0('0x44')]=[{'all':!![]}];}return db[_0xfef0('0x30')][_0xfef0('0x45')](_0x3e3c4c);})[_0xfef0('0x29')](function(_0x4dd8f8){_0x26cb9a[_0xfef0('0x46')]=_0x4dd8f8;return _0x26cb9a;})[_0xfef0('0x29')](respondWithFilteredResult(_0x1ac4a3,_0x3e3c4c))['catch'](handleError(_0x1ac4a3,null));};exports['show']=function(_0x1d554e,_0x5dc824){var _0x1fc518={'raw':![],'where':{'id':_0x1d554e[_0xfef0('0x47')]['id']}},_0x22c940={};_0x22c940[_0xfef0('0x32')]=_[_0xfef0('0x48')](db[_0xfef0('0x30')][_0xfef0('0x49')]);_0x22c940[_0xfef0('0x35')]=_['keys'](_0x1d554e[_0xfef0('0x35')]);_0x22c940['filters']=_['intersection'](_0x22c940[_0xfef0('0x32')],_0x22c940[_0xfef0('0x35')]);_0x1fc518['attributes']=_[_0xfef0('0x34')](_0x22c940['model'],qs[_0xfef0('0x36')](_0x1d554e[_0xfef0('0x35')][_0xfef0('0x36')]));_0x1fc518[_0xfef0('0x37')]=_0x1fc518['attributes'][_0xfef0('0x38')]?_0x1fc518[_0xfef0('0x37')]:_0x22c940['model'];if(_0x1d554e['query'][_0xfef0('0x43')]){_0x1fc518['include']=[{'all':!![]}];}_0x1fc518=_[_0xfef0('0x41')]({},_0x1fc518,_0x1d554e[_0xfef0('0x42')]);return db[_0xfef0('0x30')][_0xfef0('0x4a')](_0x1fc518)[_0xfef0('0x29')](handleEntityNotFound(_0x5dc824,null))[_0xfef0('0x29')](respondWithResult(_0x5dc824,null))['catch'](handleError(_0x5dc824,null));};exports[_0xfef0('0x4b')]=function(_0x559a28,_0x5a417e){return db[_0xfef0('0x30')][_0xfef0('0x4b')](_0x559a28[_0xfef0('0x4c')],{})['then'](respondWithResult(_0x5a417e,0xc9))[_0xfef0('0x4d')](handleError(_0x5a417e,null));};exports['update']=function(_0x5dd26b,_0x51f207){if(_0x5dd26b[_0xfef0('0x4c')]['id']){delete _0x5dd26b[_0xfef0('0x4c')]['id'];}return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x5dd26b[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x51f207,null))[_0xfef0('0x29')](saveUpdates(_0x5dd26b[_0xfef0('0x4c')],null))[_0xfef0('0x29')](respondWithResult(_0x51f207,null))['catch'](handleError(_0x51f207,null));};exports['destroy']=function(_0x2bebec,_0x18e5ba){return db[_0xfef0('0x30')][_0xfef0('0x4a')]({'where':{'id':_0x2bebec[_0xfef0('0x47')]['id']}})[_0xfef0('0x29')](handleEntityNotFound(_0x18e5ba,null))[_0xfef0('0x29')](removeEntity(_0x18e5ba,null))[_0xfef0('0x4d')](handleError(_0x18e5ba,null));};exports['describe']=function(_0x2466e7,_0x19e449){return db[_0xfef0('0x30')][_0xfef0('0x4e')]()[_0xfef0('0x29')](respondWithResult(_0x19e449,null))['catch'](handleError(_0x19e449,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a2fc23d..ca17f84 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 _0x33ea=['compositeIndex','resourceId','util','api','moment','bluebird','path','rimraf','exports','define','UserProfileResource','user_profile_has_resources'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x33ea,0xfe));var _0xa33e=function(_0x2ee253,_0x2ed0a3){_0x2ee253=_0x2ee253-0x0;var _0x399c36=_0x33ea[_0x2ee253];return _0x399c36;};'use strict';var _=require('lodash');var util=require(_0xa33e('0x0'));var logger=require('../../config/logger')(_0xa33e('0x1'));var moment=require(_0xa33e('0x2'));var BPromise=require(_0xa33e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa33e('0x4'));var rimraf=require(_0xa33e('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0xa33e('0x6')]=function(_0x1bc7fe,_0x1e7f36){return _0x1bc7fe[_0xa33e('0x7')](_0xa33e('0x8'),attributes,{'tableName':_0xa33e('0x9'),'paranoid':![],'indexes':[{'name':_0xa33e('0xa'),'fields':[_0xa33e('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc404=['user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2628b0,_0xa51fc9){var _0x44c69a=function(_0xd38a96){while(--_0xd38a96){_0x2628b0['push'](_0x2628b0['shift']());}};_0x44c69a(++_0xa51fc9);}(_0xc404,0x12e));var _0x4c40=function(_0x1d5871,_0x5edfee){_0x1d5871=_0x1d5871-0x0;var _0x3f82f3=_0xc404[_0x1d5871];return _0x3f82f3;};'use strict';var _=require('lodash');var util=require(_0x4c40('0x0'));var logger=require(_0x4c40('0x1'))(_0x4c40('0x2'));var moment=require(_0x4c40('0x3'));var BPromise=require(_0x4c40('0x4'));var rp=require(_0x4c40('0x5'));var fs=require('fs');var path=require(_0x4c40('0x6'));var rimraf=require(_0x4c40('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x4c40('0x8')]=function(_0x3053ed,_0x36ae6b){return _0x3053ed[_0x4c40('0x9')]('UserProfileResource',attributes,{'tableName':_0x4c40('0xa'),'paranoid':![],'indexes':[{'name':_0x4c40('0xb'),'fields':['resourceId',_0x4c40('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b7cbd35..4337e26 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 _0xb764=['then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xb764,0x1d8));var _0x4b76=function(_0x128ff0,_0x778d78){_0x128ff0=_0x128ff0-0x0;var _0x564a9c=_0xb764[_0x128ff0];return _0x564a9c;};'use strict';var _=require('lodash');var util=require(_0x4b76('0x0'));var moment=require(_0x4b76('0x1'));var BPromise=require(_0x4b76('0x2'));var rs=require(_0x4b76('0x3'));var fs=require('fs');var Redis=require(_0x4b76('0x4'));var db=require(_0x4b76('0x5'))['db'];var utils=require(_0x4b76('0x6'));var logger=require('../../config/logger')(_0x4b76('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b76('0x8'));var client=jayson[_0x4b76('0x9')][_0x4b76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34e914,_0x43ea5d,_0x599a22){return new BPromise(function(_0x5de2a8,_0x5969a3){return client[_0x4b76('0xb')](_0x34e914,_0x599a22)[_0x4b76('0xc')](function(_0xec58df){logger[_0x4b76('0xd')](_0x4b76('0xe'),_0x43ea5d,'request\x20sent');logger[_0x4b76('0xf')](_0x4b76('0x10'),_0x43ea5d,_0x4b76('0x11'),JSON['stringify'](_0xec58df));if(_0xec58df['error']){if(_0xec58df[_0x4b76('0x12')][_0x4b76('0x13')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x43ea5d,_0xec58df['error'][_0x4b76('0x14')]);return _0x5969a3(_0xec58df['error'][_0x4b76('0x14')]);}logger[_0x4b76('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x43ea5d,_0xec58df[_0x4b76('0x12')][_0x4b76('0x14')]);return _0x5de2a8(_0xec58df[_0x4b76('0x12')][_0x4b76('0x14')]);}else{logger['info'](_0x4b76('0xe'),_0x43ea5d,'request\x20sent');_0x5de2a8(_0xec58df['result'][_0x4b76('0x14')]);}})[_0x4b76('0x15')](function(_0x4b492b){logger[_0x4b76('0x12')](_0x4b76('0xe'),_0x43ea5d,_0x4b492b);_0x5969a3(_0x4b492b);});});} \ No newline at end of file +var _0xf582=['stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x473da0,_0x303c78){var _0x40fbce=function(_0x24248b){while(--_0x24248b){_0x473da0['push'](_0x473da0['shift']());}};_0x40fbce(++_0x303c78);}(_0xf582,0x75));var _0x2f58=function(_0x5d6bd6,_0x10e488){_0x5d6bd6=_0x5d6bd6-0x0;var _0x167aef=_0xf582[_0x5d6bd6];return _0x167aef;};'use strict';var _=require(_0x2f58('0x0'));var util=require(_0x2f58('0x1'));var moment=require(_0x2f58('0x2'));var BPromise=require(_0x2f58('0x3'));var rs=require(_0x2f58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f58('0x5'))['db'];var utils=require(_0x2f58('0x6'));var logger=require(_0x2f58('0x7'))('rpc');var config=require(_0x2f58('0x8'));var jayson=require(_0x2f58('0x9'));var client=jayson[_0x2f58('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e0593,_0xca07a3,_0x18b2d2){return new BPromise(function(_0x896983,_0x42fe6c){return client[_0x2f58('0xb')](_0x3e0593,_0x18b2d2)['then'](function(_0x418aec){logger[_0x2f58('0xc')]('UserProfileResource,\x20%s,\x20%s',_0xca07a3,_0x2f58('0xd'));logger['debug'](_0x2f58('0xe'),_0xca07a3,_0x2f58('0xd'),JSON[_0x2f58('0xf')](_0x418aec));if(_0x418aec[_0x2f58('0x10')]){if(_0x418aec[_0x2f58('0x10')][_0x2f58('0x11')]===0x1f4){logger[_0x2f58('0x10')]('UserProfileResource,\x20%s,\x20%s',_0xca07a3,_0x418aec[_0x2f58('0x10')][_0x2f58('0x12')]);return _0x42fe6c(_0x418aec['error']['message']);}logger[_0x2f58('0x10')](_0x2f58('0x13'),_0xca07a3,_0x418aec[_0x2f58('0x10')][_0x2f58('0x12')]);return _0x896983(_0x418aec[_0x2f58('0x10')][_0x2f58('0x12')]);}else{logger[_0x2f58('0xc')](_0x2f58('0x13'),_0xca07a3,_0x2f58('0xd'));_0x896983(_0x418aec[_0x2f58('0x14')][_0x2f58('0x12')]);}})[_0x2f58('0x15')](function(_0x234b9c){logger[_0x2f58('0x10')](_0x2f58('0x13'),_0xca07a3,_0x234b9c);_0x42fe6c(_0x234b9c);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index fbd1a5b..f609971 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 _0xe1c0=['put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xe1c0,0x97));var _0x0e1c=function(_0xf2d178,_0x12d5f1){_0xf2d178=_0xf2d178-0x0;var _0x56c421=_0xe1c0[_0xf2d178];return _0x56c421;};'use strict';var multer=require(_0x0e1c('0x0'));var util=require(_0x0e1c('0x1'));var path=require(_0x0e1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e1c('0x3'));var router=express[_0x0e1c('0x4')]();var fs_extra=require(_0x0e1c('0x5'));var auth=require(_0x0e1c('0x6'));var interaction=require(_0x0e1c('0x7'));var config=require(_0x0e1c('0x8'));var controller=require(_0x0e1c('0x9'));router[_0x0e1c('0xa')]('/',auth[_0x0e1c('0xb')](),controller[_0x0e1c('0xc')]);router[_0x0e1c('0xa')](_0x0e1c('0xd'),auth[_0x0e1c('0xb')](),controller['describe']);router[_0x0e1c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0e1c('0xe')]);router[_0x0e1c('0xf')]('/',auth[_0x0e1c('0xb')](),controller[_0x0e1c('0x10')]);router[_0x0e1c('0x11')]('/:id',auth[_0x0e1c('0xb')](),controller[_0x0e1c('0x12')]);router[_0x0e1c('0x13')]('/:id',auth[_0x0e1c('0xb')](),controller['destroy']);module[_0x0e1c('0x14')]=router; \ No newline at end of file +var _0x277f=['update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x108782,_0x196b08){var _0x3a6d2b=function(_0x28f3cd){while(--_0x28f3cd){_0x108782['push'](_0x108782['shift']());}};_0x3a6d2b(++_0x196b08);}(_0x277f,0x67));var _0xf277=function(_0x2b8ff3,_0x28b28f){_0x2b8ff3=_0x2b8ff3-0x0;var _0x40c6f4=_0x277f[_0x2b8ff3];return _0x40c6f4;};'use strict';var multer=require(_0xf277('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf277('0x1'));var express=require(_0xf277('0x2'));var router=express[_0xf277('0x3')]();var fs_extra=require(_0xf277('0x4'));var auth=require(_0xf277('0x5'));var interaction=require(_0xf277('0x6'));var config=require(_0xf277('0x7'));var controller=require(_0xf277('0x8'));router[_0xf277('0x9')]('/',auth[_0xf277('0xa')](),controller['index']);router[_0xf277('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf277('0xb')]);router['get'](_0xf277('0xc'),auth[_0xf277('0xa')](),controller[_0xf277('0xd')]);router[_0xf277('0xe')]('/',auth[_0xf277('0xa')](),controller[_0xf277('0xf')]);router[_0xf277('0x10')](_0xf277('0xc'),auth[_0xf277('0xa')](),controller[_0xf277('0x11')]);router[_0xf277('0x12')]('/:id',auth[_0xf277('0xa')](),controller[_0xf277('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6d4a96a..fb6f32a 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 _0xd824=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x265603,_0x207a59){var _0x1ab235=function(_0x750366){while(--_0x750366){_0x265603['push'](_0x265603['shift']());}};_0x1ab235(++_0x207a59);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d82('0x4')],'set':function(_0x287fbf){this[_0x4d82('0x5')]('crudPermissions',_0x287fbf?_0x287fbf['join'](''):[]);},'get':function(){return this[_0x4d82('0x6')]('crudPermissions')?this['getDataValue'](_0x4d82('0x7'))[_0x4d82('0x8')](''):[];}}}; \ No newline at end of file +var _0x3423=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x3ba9cd,_0x33adb2){var _0x1815d7=function(_0x5c2449){while(--_0x5c2449){_0x3ba9cd['push'](_0x3ba9cd['shift']());}};_0x1815d7(++_0x33adb2);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x3342('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3342('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3342('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3342('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x3342('0x0')],'set':function(_0x2207ce){this[_0x3342('0x3')](_0x3342('0x4'),_0x2207ce?_0x2207ce[_0x3342('0x5')](''):[]);},'get':function(){return this[_0x3342('0x6')](_0x3342('0x4'))?this[_0x3342('0x6')](_0x3342('0x4'))[_0x3342('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 72c2dfd..2caf0ee 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 _0xc544=['attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','UserProfileSection','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields'];(function(_0x49516f,_0x260962){var _0x2aedd9=function(_0x2bc29c){while(--_0x2bc29c){_0x49516f['push'](_0x49516f['shift']());}};_0x2aedd9(++_0x260962);}(_0xc544,0x19c));var _0x4c54=function(_0x5af59b,_0x2c3f19){_0x5af59b=_0x5af59b-0x0;var _0x46d4e6=_0xc544[_0x5af59b];return _0x46d4e6;};'use strict';var emlformat=require(_0x4c54('0x0'));var rimraf=require(_0x4c54('0x1'));var zipdir=require(_0x4c54('0x2'));var jsonpatch=require(_0x4c54('0x3'));var rp=require(_0x4c54('0x4'));var moment=require(_0x4c54('0x5'));var BPromise=require(_0x4c54('0x6'));var Mustache=require(_0x4c54('0x7'));var util=require(_0x4c54('0x8'));var path=require('path');var sox=require(_0x4c54('0x9'));var csv=require(_0x4c54('0xa'));var ejs=require(_0x4c54('0xb'));var fs=require('fs');var fs_extra=require(_0x4c54('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c54('0xd'));var jsforce=require(_0x4c54('0xe'));var deskjs=require(_0x4c54('0xf'));var toCsv=require(_0x4c54('0xa'));var querystring=require(_0x4c54('0x10'));var Papa=require(_0x4c54('0x11'));var Redis=require(_0x4c54('0x12'));var authService=require(_0x4c54('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4c54('0x14'));var hardwareService=require(_0x4c54('0x15'));var logger=require('../../config/logger')(_0x4c54('0x16'));var utils=require(_0x4c54('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4c54('0x18'));var db=require(_0x4c54('0x19'))['db'];function respondWithStatusCode(_0xbef82d,_0x545e50){_0x545e50=_0x545e50||0xcc;return function(_0x56c528){if(_0x56c528){return _0xbef82d[_0x4c54('0x1a')](_0x545e50);}return _0xbef82d[_0x4c54('0x1b')](_0x545e50)['end']();};}function respondWithResult(_0x4e217e,_0xf44744){_0xf44744=_0xf44744||0xc8;return function(_0x1a641d){if(_0x1a641d){return _0x4e217e[_0x4c54('0x1b')](_0xf44744)[_0x4c54('0x1c')](_0x1a641d);}};}function respondWithFilteredResult(_0x4e7307,_0x26accf){return function(_0xd05e44){if(_0xd05e44){var _0x4c2581=typeof _0x26accf[_0x4c54('0x1d')]==='undefined'&&typeof _0x26accf[_0x4c54('0x1e')]===_0x4c54('0x1f');var _0x4c63dc=_0xd05e44[_0x4c54('0x20')];var _0x2e0cab=_0x4c2581?0x0:_0x26accf[_0x4c54('0x1d')];var _0x23ebd2=_0x4c2581?_0xd05e44[_0x4c54('0x20')]:_0x26accf[_0x4c54('0x1d')]+_0x26accf['limit'];var _0x1abf59;if(_0x23ebd2>=_0x4c63dc){_0x23ebd2=_0x4c63dc;_0x1abf59=0xc8;}else{_0x1abf59=0xce;}_0x4e7307['status'](_0x1abf59);return _0x4e7307[_0x4c54('0x21')](_0x4c54('0x22'),_0x2e0cab+'-'+_0x23ebd2+'/'+_0x4c63dc)[_0x4c54('0x1c')](_0xd05e44);}return null;};}function patchUpdates(_0x2e36f3){return function(_0x5de8a8){try{jsonpatch[_0x4c54('0x23')](_0x5de8a8,_0x2e36f3,!![]);}catch(_0x2102d0){return BPromise['reject'](_0x2102d0);}return _0x5de8a8[_0x4c54('0x24')]();};}function saveUpdates(_0x308b69,_0x1976ad){return function(_0x1500ac){if(_0x1500ac){return _0x1500ac[_0x4c54('0x25')](_0x308b69)[_0x4c54('0x26')](function(_0x5d60e6){return _0x5d60e6;});}return null;};}function removeEntity(_0x29f2db,_0x3cd37d){return function(_0x4753af){if(_0x4753af){return _0x4753af[_0x4c54('0x27')]()[_0x4c54('0x26')](function(){_0x29f2db[_0x4c54('0x1b')](0xcc)[_0x4c54('0x28')]();});}};}function handleEntityNotFound(_0x30052a,_0xc9da5c){return function(_0x5db71d){if(!_0x5db71d){_0x30052a[_0x4c54('0x1a')](0x194);}return _0x5db71d;};}function handleError(_0x498f56,_0x32c711){_0x32c711=_0x32c711||0x1f4;return function(_0x1018b2){logger[_0x4c54('0x29')](_0x1018b2[_0x4c54('0x2a')]);if(_0x1018b2[_0x4c54('0x2b')]){delete _0x1018b2[_0x4c54('0x2b')];}_0x498f56[_0x4c54('0x1b')](_0x32c711)[_0x4c54('0x2c')](_0x1018b2);};}exports[_0x4c54('0x2d')]=function(_0x4965d7,_0x5b164c){var _0x9d9ecc={},_0x137eb0={},_0x3783aa={'count':0x0,'rows':[]};var _0x3ef796=_['map'](db['UserProfileSection'][_0x4c54('0x2e')],function(_0x1ccc9d){return{'name':_0x1ccc9d[_0x4c54('0x2f')],'type':_0x1ccc9d[_0x4c54('0x30')]['key']};});_0x137eb0[_0x4c54('0x31')]=_[_0x4c54('0x32')](_0x3ef796,_0x4c54('0x2b'));_0x137eb0['query']=_[_0x4c54('0x33')](_0x4965d7[_0x4c54('0x34')]);_0x137eb0[_0x4c54('0x35')]=_[_0x4c54('0x36')](_0x137eb0[_0x4c54('0x31')],_0x137eb0[_0x4c54('0x34')]);_0x9d9ecc['attributes']=_['intersection'](_0x137eb0['model'],qs[_0x4c54('0x37')](_0x4965d7['query'][_0x4c54('0x37')]));_0x9d9ecc[_0x4c54('0x38')]=_0x9d9ecc[_0x4c54('0x38')][_0x4c54('0x39')]?_0x9d9ecc[_0x4c54('0x38')]:_0x137eb0[_0x4c54('0x31')];if(!_0x4965d7[_0x4c54('0x34')]['hasOwnProperty'](_0x4c54('0x3a'))){_0x9d9ecc[_0x4c54('0x1e')]=qs[_0x4c54('0x1e')](_0x4965d7['query'][_0x4c54('0x1e')]);_0x9d9ecc[_0x4c54('0x1d')]=qs[_0x4c54('0x1d')](_0x4965d7[_0x4c54('0x34')][_0x4c54('0x1d')]);}_0x9d9ecc[_0x4c54('0x3b')]=qs['sort'](_0x4965d7[_0x4c54('0x34')][_0x4c54('0x3c')]);_0x9d9ecc['where']=qs[_0x4c54('0x35')](_[_0x4c54('0x3d')](_0x4965d7['query'],_0x137eb0[_0x4c54('0x35')]),_0x3ef796);if(_0x4965d7[_0x4c54('0x34')][_0x4c54('0x3e')]){_0x9d9ecc[_0x4c54('0x3f')]=_['merge'](_0x9d9ecc['where'],{'$or':_[_0x4c54('0x32')](_0x3ef796,function(_0x236205){if(_0x236205['type']!==_0x4c54('0x40')){var _0xf4a489={};_0xf4a489[_0x236205[_0x4c54('0x2b')]]={'$like':'%'+_0x4965d7[_0x4c54('0x34')]['filter']+'%'};return _0xf4a489;}})});}_0x9d9ecc=_[_0x4c54('0x41')]({},_0x9d9ecc,_0x4965d7[_0x4c54('0x42')]);var _0x59a594={'where':_0x9d9ecc['where']};return db[_0x4c54('0x43')]['count'](_0x59a594)[_0x4c54('0x26')](function(_0x5c3fbb){_0x3783aa[_0x4c54('0x20')]=_0x5c3fbb;if(_0x4965d7[_0x4c54('0x34')][_0x4c54('0x44')]){_0x9d9ecc[_0x4c54('0x45')]=[{'all':!![]}];}return db[_0x4c54('0x43')]['findAll'](_0x9d9ecc);})[_0x4c54('0x26')](function(_0x239508){_0x3783aa[_0x4c54('0x46')]=_0x239508;return _0x3783aa;})[_0x4c54('0x26')](respondWithFilteredResult(_0x5b164c,_0x9d9ecc))[_0x4c54('0x47')](handleError(_0x5b164c,null));};exports[_0x4c54('0x48')]=function(_0x33139e,_0x2627d1){var _0x5a0f63={'raw':![],'where':{'id':_0x33139e[_0x4c54('0x49')]['id']}},_0x19266b={};_0x19266b[_0x4c54('0x31')]=_[_0x4c54('0x33')](db[_0x4c54('0x43')][_0x4c54('0x2e')]);_0x19266b[_0x4c54('0x34')]=_[_0x4c54('0x33')](_0x33139e[_0x4c54('0x34')]);_0x19266b[_0x4c54('0x35')]=_[_0x4c54('0x36')](_0x19266b[_0x4c54('0x31')],_0x19266b[_0x4c54('0x34')]);_0x5a0f63[_0x4c54('0x38')]=_[_0x4c54('0x36')](_0x19266b[_0x4c54('0x31')],qs['fields'](_0x33139e['query'][_0x4c54('0x37')]));_0x5a0f63[_0x4c54('0x38')]=_0x5a0f63[_0x4c54('0x38')][_0x4c54('0x39')]?_0x5a0f63[_0x4c54('0x38')]:_0x19266b[_0x4c54('0x31')];if(_0x33139e[_0x4c54('0x34')]['includeAll']){_0x5a0f63['include']=[{'all':!![]}];}_0x5a0f63=_[_0x4c54('0x41')]({},_0x5a0f63,_0x33139e[_0x4c54('0x42')]);return db[_0x4c54('0x43')][_0x4c54('0x4a')](_0x5a0f63)['then'](handleEntityNotFound(_0x2627d1,null))[_0x4c54('0x26')](respondWithResult(_0x2627d1,null))[_0x4c54('0x47')](handleError(_0x2627d1,null));};exports[_0x4c54('0x4b')]=function(_0x4b7665,_0x2f1afd){return db[_0x4c54('0x43')][_0x4c54('0x4b')](_0x4b7665[_0x4c54('0x4c')],{})[_0x4c54('0x26')](respondWithResult(_0x2f1afd,0xc9))[_0x4c54('0x47')](handleError(_0x2f1afd,null));};exports['update']=function(_0x5d27c0,_0x105dad){if(_0x5d27c0['body']['id']){delete _0x5d27c0[_0x4c54('0x4c')]['id'];}return db[_0x4c54('0x43')]['find']({'where':{'id':_0x5d27c0[_0x4c54('0x49')]['id']}})[_0x4c54('0x26')](handleEntityNotFound(_0x105dad,null))[_0x4c54('0x26')](saveUpdates(_0x5d27c0[_0x4c54('0x4c')],null))[_0x4c54('0x26')](respondWithResult(_0x105dad,null))[_0x4c54('0x47')](handleError(_0x105dad,null));};exports[_0x4c54('0x27')]=function(_0xd585c2,_0x14ff6b){return db[_0x4c54('0x43')][_0x4c54('0x4a')]({'where':{'id':_0xd585c2['params']['id']}})[_0x4c54('0x26')](handleEntityNotFound(_0x14ff6b,null))[_0x4c54('0x26')](removeEntity(_0x14ff6b,null))[_0x4c54('0x47')](handleError(_0x14ff6b,null));};exports[_0x4c54('0x4d')]=function(_0xde464b,_0x220765){return db[_0x4c54('0x43')]['describe']()['then'](respondWithResult(_0x220765,null))[_0x4c54('0x47')](handleError(_0x220765,null));}; \ No newline at end of file +var _0xd973=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','UserProfileSection','count','includeAll','include','findAll','rows','show','keys','find','catch','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x14a3e9,_0x50501e){var _0x8d4550=function(_0x4495f4){while(--_0x4495f4){_0x14a3e9['push'](_0x14a3e9['shift']());}};_0x8d4550(++_0x50501e);}(_0xd973,0x11d));var _0x3d97=function(_0x1133dd,_0x376dd8){_0x1133dd=_0x1133dd-0x0;var _0xc360a3=_0xd973[_0x1133dd];return _0xc360a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d97('0x0'));var jsonpatch=require(_0x3d97('0x1'));var rp=require(_0x3d97('0x2'));var moment=require(_0x3d97('0x3'));var BPromise=require(_0x3d97('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3d97('0x5'));var sox=require(_0x3d97('0x6'));var csv=require(_0x3d97('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d97('0x8'));var _=require(_0x3d97('0x9'));var squel=require(_0x3d97('0xa'));var crypto=require('crypto');var jsforce=require(_0x3d97('0xb'));var deskjs=require(_0x3d97('0xc'));var toCsv=require(_0x3d97('0x7'));var querystring=require(_0x3d97('0xd'));var Papa=require(_0x3d97('0xe'));var Redis=require(_0x3d97('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3d97('0x10'));var as=require(_0x3d97('0x11'));var hardwareService=require(_0x3d97('0x12'));var logger=require(_0x3d97('0x13'))(_0x3d97('0x14'));var utils=require(_0x3d97('0x15'));var config=require(_0x3d97('0x16'));var licenseUtil=require(_0x3d97('0x17'));var db=require(_0x3d97('0x18'))['db'];function respondWithStatusCode(_0x5b19e4,_0x229cf5){_0x229cf5=_0x229cf5||0xcc;return function(_0xe70fbd){if(_0xe70fbd){return _0x5b19e4[_0x3d97('0x19')](_0x229cf5);}return _0x5b19e4[_0x3d97('0x1a')](_0x229cf5)[_0x3d97('0x1b')]();};}function respondWithResult(_0x4e7e1e,_0x2042f7){_0x2042f7=_0x2042f7||0xc8;return function(_0x5bf73e){if(_0x5bf73e){return _0x4e7e1e[_0x3d97('0x1a')](_0x2042f7)[_0x3d97('0x1c')](_0x5bf73e);}};}function respondWithFilteredResult(_0x57b036,_0x505f88){return function(_0x1a82e7){if(_0x1a82e7){var _0xf908e4=typeof _0x505f88['offset']===_0x3d97('0x1d')&&typeof _0x505f88['limit']===_0x3d97('0x1d');var _0x13a848=_0x1a82e7['count'];var _0x562098=_0xf908e4?0x0:_0x505f88[_0x3d97('0x1e')];var _0x5925b4=_0xf908e4?_0x1a82e7['count']:_0x505f88[_0x3d97('0x1e')]+_0x505f88[_0x3d97('0x1f')];var _0x530ecc;if(_0x5925b4>=_0x13a848){_0x5925b4=_0x13a848;_0x530ecc=0xc8;}else{_0x530ecc=0xce;}_0x57b036[_0x3d97('0x1a')](_0x530ecc);return _0x57b036[_0x3d97('0x20')]('Content-Range',_0x562098+'-'+_0x5925b4+'/'+_0x13a848)[_0x3d97('0x1c')](_0x1a82e7);}return null;};}function patchUpdates(_0x1ed52c){return function(_0x34b6e3){try{jsonpatch[_0x3d97('0x21')](_0x34b6e3,_0x1ed52c,!![]);}catch(_0x35ab7){return BPromise[_0x3d97('0x22')](_0x35ab7);}return _0x34b6e3['save']();};}function saveUpdates(_0x57dfb3,_0x14d822){return function(_0x4d4f9d){if(_0x4d4f9d){return _0x4d4f9d[_0x3d97('0x23')](_0x57dfb3)[_0x3d97('0x24')](function(_0x99ca07){return _0x99ca07;});}return null;};}function removeEntity(_0x204b58,_0x463be7){return function(_0x30bf4d){if(_0x30bf4d){return _0x30bf4d[_0x3d97('0x25')]()[_0x3d97('0x24')](function(){_0x204b58[_0x3d97('0x1a')](0xcc)[_0x3d97('0x1b')]();});}};}function handleEntityNotFound(_0xabd9ce,_0x4a4fe8){return function(_0x4777a2){if(!_0x4777a2){_0xabd9ce[_0x3d97('0x19')](0x194);}return _0x4777a2;};}function handleError(_0xa3926,_0x2f6787){_0x2f6787=_0x2f6787||0x1f4;return function(_0x32255f){logger[_0x3d97('0x26')](_0x32255f[_0x3d97('0x27')]);if(_0x32255f[_0x3d97('0x28')]){delete _0x32255f[_0x3d97('0x28')];}_0xa3926[_0x3d97('0x1a')](_0x2f6787)[_0x3d97('0x29')](_0x32255f);};}exports['index']=function(_0x2ac0ef,_0x14cc9b){var _0x184897={},_0x1ca4a1={},_0x35b96c={'count':0x0,'rows':[]};var _0x56743b=_['map'](db['UserProfileSection'][_0x3d97('0x2a')],function(_0x275725){return{'name':_0x275725[_0x3d97('0x2b')],'type':_0x275725['type']['key']};});_0x1ca4a1[_0x3d97('0x2c')]=_[_0x3d97('0x2d')](_0x56743b,_0x3d97('0x28'));_0x1ca4a1[_0x3d97('0x2e')]=_['keys'](_0x2ac0ef[_0x3d97('0x2e')]);_0x1ca4a1[_0x3d97('0x2f')]=_[_0x3d97('0x30')](_0x1ca4a1[_0x3d97('0x2c')],_0x1ca4a1['query']);_0x184897[_0x3d97('0x31')]=_[_0x3d97('0x30')](_0x1ca4a1['model'],qs[_0x3d97('0x32')](_0x2ac0ef[_0x3d97('0x2e')][_0x3d97('0x32')]));_0x184897[_0x3d97('0x31')]=_0x184897[_0x3d97('0x31')][_0x3d97('0x33')]?_0x184897[_0x3d97('0x31')]:_0x1ca4a1[_0x3d97('0x2c')];if(!_0x2ac0ef[_0x3d97('0x2e')][_0x3d97('0x34')](_0x3d97('0x35'))){_0x184897[_0x3d97('0x1f')]=qs[_0x3d97('0x1f')](_0x2ac0ef[_0x3d97('0x2e')][_0x3d97('0x1f')]);_0x184897['offset']=qs['offset'](_0x2ac0ef['query'][_0x3d97('0x1e')]);}_0x184897['order']=qs[_0x3d97('0x36')](_0x2ac0ef['query'][_0x3d97('0x36')]);_0x184897[_0x3d97('0x37')]=qs[_0x3d97('0x2f')](_[_0x3d97('0x38')](_0x2ac0ef['query'],_0x1ca4a1['filters']),_0x56743b);if(_0x2ac0ef[_0x3d97('0x2e')]['filter']){_0x184897[_0x3d97('0x37')]=_[_0x3d97('0x39')](_0x184897['where'],{'$or':_['map'](_0x56743b,function(_0x174167){if(_0x174167[_0x3d97('0x3a')]!==_0x3d97('0x3b')){var _0x24759e={};_0x24759e[_0x174167['name']]={'$like':'%'+_0x2ac0ef['query']['filter']+'%'};return _0x24759e;}})});}_0x184897=_['merge']({},_0x184897,_0x2ac0ef[_0x3d97('0x3c')]);var _0x390eca={'where':_0x184897[_0x3d97('0x37')]};return db[_0x3d97('0x3d')]['count'](_0x390eca)['then'](function(_0x317d45){_0x35b96c[_0x3d97('0x3e')]=_0x317d45;if(_0x2ac0ef['query'][_0x3d97('0x3f')]){_0x184897[_0x3d97('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x3d97('0x41')](_0x184897);})[_0x3d97('0x24')](function(_0x57ef67){_0x35b96c[_0x3d97('0x42')]=_0x57ef67;return _0x35b96c;})['then'](respondWithFilteredResult(_0x14cc9b,_0x184897))['catch'](handleError(_0x14cc9b,null));};exports[_0x3d97('0x43')]=function(_0x4193aa,_0x536ce9){var _0x40de35={'raw':![],'where':{'id':_0x4193aa['params']['id']}},_0x3e15c0={};_0x3e15c0[_0x3d97('0x2c')]=_[_0x3d97('0x44')](db['UserProfileSection'][_0x3d97('0x2a')]);_0x3e15c0[_0x3d97('0x2e')]=_[_0x3d97('0x44')](_0x4193aa[_0x3d97('0x2e')]);_0x3e15c0[_0x3d97('0x2f')]=_[_0x3d97('0x30')](_0x3e15c0[_0x3d97('0x2c')],_0x3e15c0[_0x3d97('0x2e')]);_0x40de35[_0x3d97('0x31')]=_[_0x3d97('0x30')](_0x3e15c0[_0x3d97('0x2c')],qs[_0x3d97('0x32')](_0x4193aa[_0x3d97('0x2e')][_0x3d97('0x32')]));_0x40de35[_0x3d97('0x31')]=_0x40de35[_0x3d97('0x31')][_0x3d97('0x33')]?_0x40de35[_0x3d97('0x31')]:_0x3e15c0[_0x3d97('0x2c')];if(_0x4193aa[_0x3d97('0x2e')][_0x3d97('0x3f')]){_0x40de35[_0x3d97('0x40')]=[{'all':!![]}];}_0x40de35=_[_0x3d97('0x39')]({},_0x40de35,_0x4193aa['options']);return db[_0x3d97('0x3d')][_0x3d97('0x45')](_0x40de35)['then'](handleEntityNotFound(_0x536ce9,null))[_0x3d97('0x24')](respondWithResult(_0x536ce9,null))[_0x3d97('0x46')](handleError(_0x536ce9,null));};exports[_0x3d97('0x47')]=function(_0x2ad2af,_0x4f0000){return db[_0x3d97('0x3d')][_0x3d97('0x47')](_0x2ad2af[_0x3d97('0x48')],{})[_0x3d97('0x24')](respondWithResult(_0x4f0000,0xc9))[_0x3d97('0x46')](handleError(_0x4f0000,null));};exports[_0x3d97('0x23')]=function(_0x265147,_0x398e7c){if(_0x265147['body']['id']){delete _0x265147[_0x3d97('0x48')]['id'];}return db['UserProfileSection'][_0x3d97('0x45')]({'where':{'id':_0x265147[_0x3d97('0x49')]['id']}})['then'](handleEntityNotFound(_0x398e7c,null))['then'](saveUpdates(_0x265147['body'],null))['then'](respondWithResult(_0x398e7c,null))[_0x3d97('0x46')](handleError(_0x398e7c,null));};exports[_0x3d97('0x25')]=function(_0x2ca543,_0x1c048c){return db[_0x3d97('0x3d')][_0x3d97('0x45')]({'where':{'id':_0x2ca543[_0x3d97('0x49')]['id']}})[_0x3d97('0x24')](handleEntityNotFound(_0x1c048c,null))['then'](removeEntity(_0x1c048c,null))['catch'](handleError(_0x1c048c,null));};exports['describe']=function(_0x54d321,_0x5397b7){return db[_0x3d97('0x3d')][_0x3d97('0x4a')]()[_0x3d97('0x24')](respondWithResult(_0x5397b7,null))['catch'](handleError(_0x5397b7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4844e99..6d04763 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 _0x229c=['../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','util','moment','path'];(function(_0x3f5af8,_0x5855dc){var _0x26ec38=function(_0x434b22){while(--_0x434b22){_0x3f5af8['push'](_0x3f5af8['shift']());}};_0x26ec38(++_0x5855dc);}(_0x229c,0xcf));var _0xc229=function(_0x2f2f4c,_0x3d6b9d){_0x2f2f4c=_0x2f2f4c-0x0;var _0x6e62e8=_0x229c[_0x2f2f4c];return _0x6e62e8;};'use strict';var _=require('lodash');var util=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc229('0x2'));var rimraf=require('rimraf');var config=require(_0xc229('0x3'));var attributes=require(_0xc229('0x4'));module[_0xc229('0x5')]=function(_0x5a0d2c,_0x44aba3){return _0x5a0d2c['define'](_0xc229('0x6'),attributes,{'tableName':_0xc229('0x7'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc229('0x8'),_0xc229('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70d7=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x16dbcd,_0x274516){var _0x34706e=function(_0x43433d){while(--_0x43433d){_0x16dbcd['push'](_0x16dbcd['shift']());}};_0x34706e(++_0x274516);}(_0x70d7,0x1ee));var _0x770d=function(_0x19ea12,_0x39f26b){_0x19ea12=_0x19ea12-0x0;var _0x61eb8a=_0x70d7[_0x19ea12];return _0x61eb8a;};'use strict';var _=require(_0x770d('0x0'));var util=require(_0x770d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x770d('0x2'));var BPromise=require(_0x770d('0x3'));var rp=require(_0x770d('0x4'));var fs=require('fs');var path=require(_0x770d('0x5'));var rimraf=require(_0x770d('0x6'));var config=require(_0x770d('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x770d('0x8')]=function(_0x273a6f,_0x360b76){return _0x273a6f[_0x770d('0x9')](_0x770d('0xa'),attributes,{'tableName':_0x770d('0xb'),'paranoid':![],'indexes':[{'name':_0x770d('0xc'),'fields':[_0x770d('0xd'),_0x770d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 9fecf64..96a349c 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 _0x1472=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2df86d,_0x5081e1){var _0x4c24b0=function(_0x55d7e8){while(--_0x55d7e8){_0x2df86d['push'](_0x2df86d['shift']());}};_0x4c24b0(++_0x5081e1);}(_0x1472,0x7a));var _0x2147=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x1472[_0x412dd8];return _0x47b96;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var moment=require(_0x2147('0x2'));var BPromise=require(_0x2147('0x3'));var rs=require(_0x2147('0x4'));var fs=require('fs');var Redis=require(_0x2147('0x5'));var db=require(_0x2147('0x6'))['db'];var utils=require(_0x2147('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x2147('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2147('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7e332a,_0x4e59be,_0xea4d6d){return new BPromise(function(_0x228dc6,_0x5cd393){return client[_0x2147('0xa')](_0x7e332a,_0xea4d6d)[_0x2147('0xb')](function(_0x5b0c26){logger[_0x2147('0xc')](_0x2147('0xd'),_0x4e59be,_0x2147('0xe'));logger[_0x2147('0xf')](_0x2147('0x10'),_0x4e59be,_0x2147('0xe'),JSON[_0x2147('0x11')](_0x5b0c26));if(_0x5b0c26[_0x2147('0x12')]){if(_0x5b0c26[_0x2147('0x12')][_0x2147('0x13')]===0x1f4){logger[_0x2147('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4e59be,_0x5b0c26[_0x2147('0x12')][_0x2147('0x14')]);return _0x5cd393(_0x5b0c26[_0x2147('0x12')][_0x2147('0x14')]);}logger[_0x2147('0x12')](_0x2147('0xd'),_0x4e59be,_0x5b0c26[_0x2147('0x12')][_0x2147('0x14')]);return _0x228dc6(_0x5b0c26[_0x2147('0x12')][_0x2147('0x14')]);}else{logger[_0x2147('0xc')](_0x2147('0xd'),_0x4e59be,'request\x20sent');_0x228dc6(_0x5b0c26[_0x2147('0x15')][_0x2147('0x14')]);}})[_0x2147('0x16')](function(_0x428f29){logger[_0x2147('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x4e59be,_0x428f29);_0x5cd393(_0x428f29);});});} \ No newline at end of file +var _0x0efc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird'];(function(_0x5ef8ab,_0x235fad){var _0x4839c0=function(_0x3acbfe){while(--_0x3acbfe){_0x5ef8ab['push'](_0x5ef8ab['shift']());}};_0x4839c0(++_0x235fad);}(_0x0efc,0x1b2));var _0xc0ef=function(_0x279de4,_0x5d552d){_0x279de4=_0x279de4-0x0;var _0x104a16=_0x0efc[_0x279de4];return _0x104a16;};'use strict';var _=require(_0xc0ef('0x0'));var util=require(_0xc0ef('0x1'));var moment=require('moment');var BPromise=require(_0xc0ef('0x2'));var rs=require(_0xc0ef('0x3'));var fs=require('fs');var Redis=require(_0xc0ef('0x4'));var db=require(_0xc0ef('0x5'))['db'];var utils=require(_0xc0ef('0x6'));var logger=require(_0xc0ef('0x7'))(_0xc0ef('0x8'));var config=require(_0xc0ef('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc0ef('0xa')][_0xc0ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d237f,_0x154f14,_0x7c5b0e){return new BPromise(function(_0x11b1ce,_0x5b5d09){return client[_0xc0ef('0xc')](_0x5d237f,_0x7c5b0e)[_0xc0ef('0xd')](function(_0x541d80){logger[_0xc0ef('0xe')](_0xc0ef('0xf'),_0x154f14,_0xc0ef('0x10'));logger[_0xc0ef('0x11')](_0xc0ef('0x12'),_0x154f14,'request\x20sent',JSON['stringify'](_0x541d80));if(_0x541d80[_0xc0ef('0x13')]){if(_0x541d80[_0xc0ef('0x13')][_0xc0ef('0x14')]===0x1f4){logger[_0xc0ef('0x13')](_0xc0ef('0xf'),_0x154f14,_0x541d80[_0xc0ef('0x13')]['message']);return _0x5b5d09(_0x541d80['error'][_0xc0ef('0x15')]);}logger[_0xc0ef('0x13')](_0xc0ef('0xf'),_0x154f14,_0x541d80[_0xc0ef('0x13')][_0xc0ef('0x15')]);return _0x11b1ce(_0x541d80[_0xc0ef('0x13')][_0xc0ef('0x15')]);}else{logger[_0xc0ef('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x154f14,'request\x20sent');_0x11b1ce(_0x541d80[_0xc0ef('0x16')][_0xc0ef('0x15')]);}})['catch'](function(_0x1b1024){logger[_0xc0ef('0x13')](_0xc0ef('0xf'),_0x154f14,_0x1b1024);_0x5b5d09(_0x1b1024);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ac96e6a..efad2f6 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x29abc4,_0x465591){var _0x4eb00f=function(_0x2043d7){while(--_0x2043d7){_0x29abc4['push'](_0x29abc4['shift']());}};_0x4eb00f(++_0x465591);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0xcb91[_0xf26c2e];return _0x46ecb4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2b3cad,_0x573629){var _0x2175c4=function(_0x2f5a4f){while(--_0x2f5a4f){_0x2b3cad['push'](_0x2b3cad['shift']());}};_0x2175c4(++_0x573629);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index cf1efd5..a0973bf 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 _0x4f5a=['sequelize','exports'];(function(_0x585e86,_0x286d47){var _0x5a6889=function(_0x39d680){while(--_0x39d680){_0x585e86['push'](_0x585e86['shift']());}};_0x5a6889(++_0x286d47);}(_0x4f5a,0xaa));var _0xa4f5=function(_0x435536,_0x33e8e9){_0x435536=_0x435536-0x0;var _0x35ad68=_0x4f5a[_0x435536];return _0x35ad68;};'use strict';var Sequelize=require(_0xa4f5('0x0'));module[_0xa4f5('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c0b=['exports','INTEGER','sequelize'];(function(_0x728110,_0x43797f){var _0x3af348=function(_0xe35014){while(--_0xe35014){_0x728110['push'](_0x728110['shift']());}};_0x3af348(++_0x43797f);}(_0x5c0b,0x77));var _0xb5c0=function(_0xd1e715,_0x2d61eb){_0xd1e715=_0xd1e715-0x0;var _0x3b279c=_0x5c0b[_0xd1e715];return _0x3b279c;};'use strict';var Sequelize=require(_0xb5c0('0x0'));module[_0xb5c0('0x1')]={'penalty':{'type':Sequelize[_0xb5c0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4b31c2b..79b298f 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 _0x9582=['bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x43ac9f,_0x283aa5){var _0xb8ee00=function(_0x257258){while(--_0x257258){_0x43ac9f['push'](_0x43ac9f['shift']());}};_0xb8ee00(++_0x283aa5);}(_0x9582,0x95));var _0x2958=function(_0x39a77c,_0x3d503e){_0x39a77c=_0x39a77c-0x0;var _0xb856d1=_0x9582[_0x39a77c];return _0xb856d1;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa809=['exports','UserSmsQueue','user_has_sms_queues','util','moment','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x5c675a,_0x185222){var _0x5177ad=function(_0x3471a8){while(--_0x3471a8){_0x5c675a['push'](_0x5c675a['shift']());}};_0x5177ad(++_0x185222);}(_0xa809,0x1f3));var _0x9a80=function(_0x4c265,_0x424e65){_0x4c265=_0x4c265-0x0;var _0x59e2c4=_0xa809[_0x4c265];return _0x59e2c4;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9a80('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var attributes=require(_0x9a80('0x4'));module[_0x9a80('0x5')]=function(_0x4c748d,_0x295910){return _0x4c748d['define'](_0x9a80('0x6'),attributes,{'tableName':_0x9a80('0x7'),'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 bec1325..17012f6 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 _0x902e=['UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x902e,0x14f));var _0xe902=function(_0x11649e,_0x2179a4){_0x11649e=_0x11649e-0x0;var _0x42dc77=_0x902e[_0x11649e];return _0x42dc77;};'use strict';var _=require(_0xe902('0x0'));var util=require(_0xe902('0x1'));var moment=require(_0xe902('0x2'));var BPromise=require(_0xe902('0x3'));var rs=require(_0xe902('0x4'));var fs=require('fs');var Redis=require(_0xe902('0x5'));var db=require(_0xe902('0x6'))['db'];var utils=require(_0xe902('0x7'));var logger=require('../../config/logger')(_0xe902('0x8'));var config=require(_0xe902('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe902('0xa')][_0xe902('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47d9d5,_0x598777,_0x53df43){return new BPromise(function(_0x1e3626,_0x5a5aae){return client[_0xe902('0xc')](_0x47d9d5,_0x53df43)[_0xe902('0xd')](function(_0x13a623){logger['info'](_0xe902('0xe'),_0x598777,_0xe902('0xf'));logger[_0xe902('0x10')](_0xe902('0x11'),_0x598777,'request\x20sent',JSON[_0xe902('0x12')](_0x13a623));if(_0x13a623['error']){if(_0x13a623[_0xe902('0x13')]['code']===0x1f4){logger['error'](_0xe902('0xe'),_0x598777,_0x13a623[_0xe902('0x13')][_0xe902('0x14')]);return _0x5a5aae(_0x13a623[_0xe902('0x13')][_0xe902('0x14')]);}logger[_0xe902('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x598777,_0x13a623['error']['message']);return _0x1e3626(_0x13a623[_0xe902('0x13')][_0xe902('0x14')]);}else{logger['info'](_0xe902('0xe'),_0x598777,'request\x20sent');_0x1e3626(_0x13a623[_0xe902('0x15')]['message']);}})['catch'](function(_0x5491b3){logger[_0xe902('0x13')](_0xe902('0xe'),_0x598777,_0x5491b3);_0x5a5aae(_0x5491b3);});});} \ No newline at end of file +var _0x90a0=['then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x90a0,0x1e7));var _0x090a=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x90a0[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x090a('0x0'));var util=require(_0x090a('0x1'));var moment=require(_0x090a('0x2'));var BPromise=require('bluebird');var rs=require(_0x090a('0x3'));var fs=require('fs');var Redis=require(_0x090a('0x4'));var db=require(_0x090a('0x5'))['db'];var utils=require(_0x090a('0x6'));var logger=require(_0x090a('0x7'))(_0x090a('0x8'));var config=require(_0x090a('0x9'));var jayson=require(_0x090a('0xa'));var client=jayson[_0x090a('0xb')][_0x090a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ab62a,_0x4dd78c,_0x5a3683){return new BPromise(function(_0x1a240f,_0x3a57ac){return client['request'](_0x5ab62a,_0x5a3683)[_0x090a('0xd')](function(_0x12596a){logger[_0x090a('0xe')](_0x090a('0xf'),_0x4dd78c,_0x090a('0x10'));logger[_0x090a('0x11')](_0x090a('0x12'),_0x4dd78c,_0x090a('0x10'),JSON[_0x090a('0x13')](_0x12596a));if(_0x12596a[_0x090a('0x14')]){if(_0x12596a[_0x090a('0x14')][_0x090a('0x15')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4dd78c,_0x12596a['error']['message']);return _0x3a57ac(_0x12596a[_0x090a('0x14')][_0x090a('0x16')]);}logger[_0x090a('0x14')](_0x090a('0xf'),_0x4dd78c,_0x12596a['error'][_0x090a('0x16')]);return _0x1a240f(_0x12596a['error'][_0x090a('0x16')]);}else{logger[_0x090a('0xe')](_0x090a('0xf'),_0x4dd78c,_0x090a('0x10'));_0x1a240f(_0x12596a[_0x090a('0x17')][_0x090a('0x16')]);}})[_0x090a('0x18')](function(_0x5e50b5){logger[_0x090a('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x4dd78c,_0x5e50b5);_0x3a57ac(_0x5e50b5);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c5ba86c..19060df 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 _0x2929=['INTEGER'];(function(_0x3ef652,_0x1f3c20){var _0x2928e9=function(_0x26a581){while(--_0x26a581){_0x3ef652['push'](_0x3ef652['shift']());}};_0x2928e9(++_0x1f3c20);}(_0x2929,0x162));var _0x9292=function(_0x49cf3e,_0x229628){_0x49cf3e=_0x49cf3e-0x0;var _0x1ba0fd=_0x2929[_0x49cf3e];return _0x1ba0fd;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x9292('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x9292('0x0')]}}; \ No newline at end of file +var _0x996c=['sequelize','exports','INTEGER'];(function(_0x3aadde,_0x50f23f){var _0x21df4e=function(_0x55a49d){while(--_0x55a49d){_0x3aadde['push'](_0x3aadde['shift']());}};_0x21df4e(++_0x50f23f);}(_0x996c,0x75));var _0xc996=function(_0x2953fc,_0x2c95f6){_0x2953fc=_0x2953fc-0x0;var _0x18992b=_0x996c[_0x2953fc];return _0x18992b;};'use strict';var Sequelize=require(_0xc996('0x0'));module[_0xc996('0x1')]={'UserId':{'type':Sequelize[_0xc996('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xc996('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 8c9f60a..f41c946 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(_0x2cfd3c,_0x13a6d3){var _0xda0bfc=function(_0x5932b8){while(--_0x5932b8){_0x2cfd3c['push'](_0x2cfd3c['shift']());}};_0xda0bfc(++_0x13a6d3);}(_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 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(_0x5632af,_0x152864){var _0x132f78=function(_0x40a33d){while(--_0x40a33d){_0x5632af['push'](_0x5632af['shift']());}};_0x132f78(++_0x152864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 da6584b..ef7120e 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19398c,_0x41639a){var _0x56db56=function(_0x1f0624){while(--_0x1f0624){_0x19398c['push'](_0x19398c['shift']());}};_0x56db56(++_0x41639a);}(_0x70e0,0x17b));var _0x070e=function(_0x16ee58,_0x165eb5){_0x16ee58=_0x16ee58-0x0;var _0x4985cf=_0x70e0[_0x16ee58];return _0x4985cf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31b876,_0x3f7e6c){var _0x3d2fc1=function(_0x15f1c5){while(--_0x15f1c5){_0x31b876['push'](_0x31b876['shift']());}};_0x3d2fc1(++_0x3f7e6c);}(_0x70e0,0x17b));var _0x070e=function(_0x37e63b,_0x195da1){_0x37e63b=_0x37e63b-0x0;var _0x2b237d=_0x70e0[_0x37e63b];return _0x2b237d;};'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 7b3c7f7..aa4e68b 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 _0x5fbe=['exports','INTEGER'];(function(_0x172c0c,_0xbdf93b){var _0x1d080b=function(_0x3b74c5){while(--_0x3b74c5){_0x172c0c['push'](_0x172c0c['shift']());}};_0x1d080b(++_0xbdf93b);}(_0x5fbe,0x11e));var _0xe5fb=function(_0x144d46,_0x2be744){_0x144d46=_0x144d46-0x0;var _0xc1dd5b=_0x5fbe[_0x144d46];return _0xc1dd5b;};'use strict';var Sequelize=require('sequelize');module[_0xe5fb('0x0')]={'penalty':{'type':Sequelize[_0xe5fb('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbdb=['sequelize','INTEGER'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0xfbdb,0x1ba));var _0xbfbd=function(_0x4c8bfd,_0x104fd8){_0x4c8bfd=_0x4c8bfd-0x0;var _0x28edf1=_0xfbdb[_0x4c8bfd];return _0x28edf1;};'use strict';var Sequelize=require(_0xbfbd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbfbd('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8d247df..95906a3 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 _0xaf96=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xaf96,0xca));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6af9('0x0'));var util=require('util');var logger=require(_0x6af9('0x1'))(_0x6af9('0x2'));var moment=require('moment');var BPromise=require(_0x6af9('0x3'));var rp=require(_0x6af9('0x4'));var fs=require('fs');var path=require(_0x6af9('0x5'));var rimraf=require(_0x6af9('0x6'));var config=require(_0x6af9('0x7'));var attributes=require(_0x6af9('0x8'));module[_0x6af9('0x9')]=function(_0x322d7d,_0x1c0d62){return _0x322d7d[_0x6af9('0xa')](_0x6af9('0xb'),attributes,{'tableName':_0x6af9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2afc=['lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0x2afc,0x190));var _0xc2af=function(_0x2b338b,_0x4a06ba){_0x2b338b=_0x2b338b-0x0;var _0x256f66=_0x2afc[_0x2b338b];return _0x256f66;};'use strict';var _=require(_0xc2af('0x0'));var util=require(_0xc2af('0x1'));var logger=require(_0xc2af('0x2'))(_0xc2af('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc2af('0x4'));var fs=require('fs');var path=require(_0xc2af('0x5'));var rimraf=require('rimraf');var config=require(_0xc2af('0x6'));var attributes=require(_0xc2af('0x7'));module[_0xc2af('0x8')]=function(_0x1fbbbd,_0x6319c3){return _0x1fbbbd['define'](_0xc2af('0x9'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index dea585c..8aad1d1 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 _0x6558=['info','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x6558,0x15a));var _0x8655=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x6558[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x8655('0x0'));var util=require(_0x8655('0x1'));var moment=require('moment');var BPromise=require(_0x8655('0x2'));var rs=require(_0x8655('0x3'));var fs=require('fs');var Redis=require(_0x8655('0x4'));var db=require(_0x8655('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8655('0x6'))(_0x8655('0x7'));var config=require(_0x8655('0x8'));var jayson=require(_0x8655('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36044e,_0x2f676e,_0x565cc5){return new BPromise(function(_0xbecd12,_0x1e44a5){return client['request'](_0x36044e,_0x565cc5)[_0x8655('0xa')](function(_0x52fdaf){logger[_0x8655('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f676e,'request\x20sent');logger[_0x8655('0xc')](_0x8655('0xd'),_0x2f676e,_0x8655('0xe'),JSON[_0x8655('0xf')](_0x52fdaf));if(_0x52fdaf[_0x8655('0x10')]){if(_0x52fdaf[_0x8655('0x10')]['code']===0x1f4){logger[_0x8655('0x10')](_0x8655('0x11'),_0x2f676e,_0x52fdaf[_0x8655('0x10')][_0x8655('0x12')]);return _0x1e44a5(_0x52fdaf['error'][_0x8655('0x12')]);}logger[_0x8655('0x10')](_0x8655('0x11'),_0x2f676e,_0x52fdaf[_0x8655('0x10')][_0x8655('0x12')]);return _0xbecd12(_0x52fdaf[_0x8655('0x10')][_0x8655('0x12')]);}else{logger[_0x8655('0xb')](_0x8655('0x11'),_0x2f676e,'request\x20sent');_0xbecd12(_0x52fdaf[_0x8655('0x13')]['message']);}})[_0x8655('0x14')](function(_0x2cb692){logger[_0x8655('0x10')](_0x8655('0x11'),_0x2f676e,_0x2cb692);_0x1e44a5(_0x2cb692);});});} \ No newline at end of file +var _0xbbce=['message','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xbbce,0xda));var _0xebbc=function(_0x3ca936,_0x3a8c61){_0x3ca936=_0x3ca936-0x0;var _0x154271=_0xbbce[_0x3ca936];return _0x154271;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xebbc('0x0'));var rs=require(_0xebbc('0x1'));var fs=require('fs');var Redis=require(_0xebbc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xebbc('0x3'));var logger=require(_0xebbc('0x4'))(_0xebbc('0x5'));var config=require(_0xebbc('0x6'));var jayson=require(_0xebbc('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb60b31,_0x4c0a75,_0x479c60){return new BPromise(function(_0x247c79,_0x3a3b5b){return client[_0xebbc('0x8')](_0xb60b31,_0x479c60)[_0xebbc('0x9')](function(_0x96ae19){logger['info'](_0xebbc('0xa'),_0x4c0a75,_0xebbc('0xb'));logger['debug'](_0xebbc('0xc'),_0x4c0a75,_0xebbc('0xb'),JSON[_0xebbc('0xd')](_0x96ae19));if(_0x96ae19[_0xebbc('0xe')]){if(_0x96ae19[_0xebbc('0xe')][_0xebbc('0xf')]===0x1f4){logger[_0xebbc('0xe')](_0xebbc('0xa'),_0x4c0a75,_0x96ae19[_0xebbc('0xe')][_0xebbc('0x10')]);return _0x3a3b5b(_0x96ae19[_0xebbc('0xe')][_0xebbc('0x10')]);}logger[_0xebbc('0xe')](_0xebbc('0xa'),_0x4c0a75,_0x96ae19['error'][_0xebbc('0x10')]);return _0x247c79(_0x96ae19[_0xebbc('0xe')][_0xebbc('0x10')]);}else{logger['info'](_0xebbc('0xa'),_0x4c0a75,_0xebbc('0xb'));_0x247c79(_0x96ae19['result']['message']);}})[_0xebbc('0x11')](function(_0x105e9e){logger[_0xebbc('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4c0a75,_0x105e9e);_0x3a3b5b(_0x105e9e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 1aae669..12773e2 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1887d9,_0x3695e2){var _0x144db4=function(_0x504223){while(--_0x504223){_0x1887d9['push'](_0x1887d9['shift']());}};_0x144db4(++_0x3695e2);}(_0x70e0,0x17b));var _0x070e=function(_0x2c1263,_0x1277e4){_0x2c1263=_0x2c1263-0x0;var _0x2a0a41=_0x70e0[_0x2c1263];return _0x2a0a41;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x208e38,_0x5d96bb){var _0x3e8e87=function(_0x1284b3){while(--_0x1284b3){_0x208e38['push'](_0x208e38['shift']());}};_0x3e8e87(++_0x5d96bb);}(_0x70e0,0x17b));var _0x070e=function(_0x3c3ea5,_0x1ece2b){_0x3c3ea5=_0x3c3ea5-0x0;var _0x482d39=_0x70e0[_0x3c3ea5];return _0x482d39;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 225ecbb..ef3e9d1 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 _0x5bc3=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x1c443f,_0x51319d){var _0x4a4a71=function(_0x355b73){while(--_0x355b73){_0x1c443f['push'](_0x1c443f['shift']());}};_0x4a4a71(++_0x51319d);}(_0x5bc3,0x157));var _0x35bc=function(_0x221e98,_0x409caa){_0x221e98=_0x221e98-0x0;var _0x55bcd5=_0x5bc3[_0x221e98];return _0x55bcd5;};'use strict';var Sequelize=require(_0x35bc('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x35bc('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x35bc('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x35bc('0x2')},'UserId':{'type':Sequelize[_0x35bc('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x35bc('0x3')],'allowNull':![],'unique':_0x35bc('0x4'),'comment':_0x35bc('0x2')},'VoiceQueueId':{'type':Sequelize[_0x35bc('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x35bc('0x4'),'comment':_0x35bc('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x35bc('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x35bc('0x2')}}; \ No newline at end of file +var _0x5419=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x5419,0x175));var _0x9541=function(_0x3318ca,_0x1effaf){_0x3318ca=_0x3318ca-0x0;var _0x38c595=_0x5419[_0x3318ca];return _0x38c595;};'use strict';var Sequelize=require(_0x9541('0x0'));module[_0x9541('0x1')]={'uniqueid':{'type':Sequelize[_0x9541('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9541('0x3')},'membername':{'type':Sequelize[_0x9541('0x4')],'allowNull':![],'comment':_0x9541('0x3')},'UserId':{'type':Sequelize[_0x9541('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9541('0x4')],'allowNull':![],'unique':_0x9541('0x5'),'comment':_0x9541('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x9541('0x4')],'allowNull':![],'unique':_0x9541('0x5'),'comment':_0x9541('0x3')},'penalty':{'type':Sequelize[_0x9541('0x2')](0xb),'defaultValue':0x0,'comment':_0x9541('0x3')},'paused':{'type':Sequelize[_0x9541('0x2')](0xb),'defaultValue':0x0,'comment':_0x9541('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2e6321e..ccd20ec 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 _0x7521=['events','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x4c147c,_0x132c49){var _0x5e8bc0=function(_0x2b2f68){while(--_0x2b2f68){_0x4c147c['push'](_0x4c147c['shift']());}};_0x5e8bc0(++_0x132c49);}(_0x7521,0x10e));var _0x1752=function(_0x2d4e16,_0xbdf00e){_0x2d4e16=_0x2d4e16-0x0;var _0x2da9bd=_0x7521[_0x2d4e16];return _0x2da9bd;};'use strict';var EventEmitter=require(_0x1752('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x1752('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1752('0x2')](0x0);var events={'afterCreate':_0x1752('0x3'),'afterUpdate':_0x1752('0x4'),'afterDestroy':_0x1752('0x5')};function emitEvent(_0x15414e){return function(_0x301ff3,_0x38588d,_0x1b8093){UserVoiceQueueRtEvents[_0x1752('0x6')](_0x15414e+':'+_0x301ff3['id'],_0x301ff3);UserVoiceQueueRtEvents[_0x1752('0x6')](_0x15414e,_0x301ff3);_0x1b8093(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x1752('0x7')](e,emitEvent(event));}}module[_0x1752('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x121c=['remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt','update'];(function(_0x3c6dce,_0x5424dd){var _0x1450e9=function(_0xd51b5c){while(--_0xd51b5c){_0x3c6dce['push'](_0x3c6dce['shift']());}};_0x1450e9(++_0x5424dd);}(_0x121c,0xc1));var _0xc121=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x121c[_0x5783f4];return _0x28e380;};'use strict';var EventEmitter=require(_0xc121('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc121('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc121('0x2'),'afterDestroy':_0xc121('0x3')};function emitEvent(_0x104dd6){return function(_0x38c6f1,_0x445f0e,_0x290cfb){UserVoiceQueueRtEvents[_0xc121('0x4')](_0x104dd6+':'+_0x38c6f1['id'],_0x38c6f1);UserVoiceQueueRtEvents['emit'](_0x104dd6,_0x38c6f1);_0x290cfb(null);};}for(var e in events){if(events[_0xc121('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xc121('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index cfbd6b4..e27ba8d 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 _0x56df=['request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x197f1e,_0x1f25ef){var _0x353b04=function(_0x26b6d3){while(--_0x26b6d3){_0x197f1e['push'](_0x197f1e['shift']());}};_0x353b04(++_0x1f25ef);}(_0x56df,0x132));var _0xf56d=function(_0x135d34,_0x23cfd0){_0x135d34=_0x135d34-0x0;var _0x4837f8=_0x56df[_0x135d34];return _0x4837f8;};'use strict';var _=require(_0xf56d('0x0'));var util=require(_0xf56d('0x1'));var logger=require(_0xf56d('0x2'))(_0xf56d('0x3'));var moment=require(_0xf56d('0x4'));var BPromise=require(_0xf56d('0x5'));var rp=require(_0xf56d('0x6'));var fs=require('fs');var path=require(_0xf56d('0x7'));var rimraf=require('rimraf');var config=require(_0xf56d('0x8'));var attributes=require(_0xf56d('0x9'));module['exports']=function(_0x524052,_0x8a1db0){return _0x524052['define'](_0xf56d('0xa'),attributes,{'tableName':_0xf56d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01fe=['./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x01fe,0xba));var _0xe01f=function(_0x4511ea,_0x365dcc){_0x4511ea=_0x4511ea-0x0;var _0x44887e=_0x01fe[_0x4511ea];return _0x44887e;};'use strict';var _=require(_0xe01f('0x0'));var util=require(_0xe01f('0x1'));var logger=require(_0xe01f('0x2'))(_0xe01f('0x3'));var moment=require(_0xe01f('0x4'));var BPromise=require(_0xe01f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe01f('0x6'));var rimraf=require(_0xe01f('0x7'));var config=require(_0xe01f('0x8'));var attributes=require(_0xe01f('0x9'));module[_0xe01f('0xa')]=function(_0x462a03,_0x353dfe){return _0x462a03['define'](_0xe01f('0xb'),attributes,{'tableName':_0xe01f('0xc'),'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 724a801..80ad5e0 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 _0xd02b=['register','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x113f52,_0x3f1541){var _0x1b8794=function(_0x30ab60){while(--_0x30ab60){_0x113f52['push'](_0x113f52['shift']());}};_0x1b8794(++_0x3f1541);}(_0xd02b,0x65));var _0xbd02=function(_0x5cd8e9,_0x38714b){_0x5cd8e9=_0x5cd8e9-0x0;var _0x3428c7=_0xd02b[_0x5cd8e9];return _0x3428c7;};'use strict';var _=require(_0xbd02('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd02('0x1'));var rs=require(_0xbd02('0x2'));var fs=require('fs');var Redis=require(_0xbd02('0x3'));var db=require(_0xbd02('0x4'))['db'];var utils=require(_0xbd02('0x5'));var logger=require(_0xbd02('0x6'))(_0xbd02('0x7'));var config=require(_0xbd02('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbd02('0x9')][_0xbd02('0xa')]({'port':0x232a});config[_0xbd02('0xb')]=_[_0xbd02('0xc')](config['redis'],{'host':_0xbd02('0xd'),'port':0x18eb});var socket=require(_0xbd02('0xe'))(new Redis(config[_0xbd02('0xb')]));require(_0xbd02('0xf'))[_0xbd02('0x10')](socket);function respondWithRpcPromise(_0x16bdb5,_0x9dc808,_0x27d88c){return new BPromise(function(_0x13418e,_0x4f599f){return client['request'](_0x16bdb5,_0x27d88c)[_0xbd02('0x11')](function(_0x202e73){logger['info'](_0xbd02('0x12'),_0x9dc808,'request\x20sent');logger[_0xbd02('0x13')](_0xbd02('0x14'),_0x9dc808,_0xbd02('0x15'),JSON[_0xbd02('0x16')](_0x202e73));if(_0x202e73[_0xbd02('0x17')]){if(_0x202e73[_0xbd02('0x17')][_0xbd02('0x18')]===0x1f4){logger[_0xbd02('0x17')](_0xbd02('0x12'),_0x9dc808,_0x202e73[_0xbd02('0x17')][_0xbd02('0x19')]);return _0x4f599f(_0x202e73[_0xbd02('0x17')][_0xbd02('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x9dc808,_0x202e73[_0xbd02('0x17')][_0xbd02('0x19')]);return _0x13418e(_0x202e73[_0xbd02('0x17')][_0xbd02('0x19')]);}else{logger['info'](_0xbd02('0x12'),_0x9dc808,'request\x20sent');_0x13418e(_0x202e73[_0xbd02('0x1a')][_0xbd02('0x19')]);}})[_0xbd02('0x1b')](function(_0x5d998a){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x9dc808,_0x5d998a);_0x4f599f(_0x5d998a);});});}exports[_0xbd02('0x1c')]=function(_0x3bc663){var _0x405531=this;return new Promise(function(_0x97e75a,_0x271fce){return db[_0xbd02('0x1d')][_0xbd02('0x1e')]({'raw':_0x3bc663[_0xbd02('0x1f')]?_0x3bc663[_0xbd02('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3bc663[_0xbd02('0x1f')]?_0x3bc663['options'][_0xbd02('0x20')]||null:null,'attributes':[[db[_0xbd02('0x21')]['fn'](_0xbd02('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0xbd02('0x23')](_0xbd02('0x24')))),_0xbd02('0x25')]]})[_0xbd02('0x11')](function(_0x43fb88){logger[_0xbd02('0x26')](_0xbd02('0x1c'),_0x3bc663);logger[_0xbd02('0x13')](_0xbd02('0x1c'),_0x3bc663,JSON[_0xbd02('0x16')](_0x43fb88));_0x97e75a(_0x43fb88);})[_0xbd02('0x1b')](function(_0x316570){logger['error'](_0xbd02('0x1c'),_0x316570[_0xbd02('0x19')],_0x3bc663);_0x271fce(_0x405531['error'](0x1f4,_0x316570[_0xbd02('0x19')]));});});}; \ No newline at end of file +var _0x4dca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','catch','util','moment'];(function(_0x1a124d,_0x3e04b0){var _0x5f0830=function(_0x1e0ce3){while(--_0x1e0ce3){_0x1a124d['push'](_0x1a124d['shift']());}};_0x5f0830(++_0x3e04b0);}(_0x4dca,0x1d2));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa4dc('0x0'));var moment=require(_0xa4dc('0x1'));var BPromise=require(_0xa4dc('0x2'));var rs=require(_0xa4dc('0x3'));var fs=require('fs');var Redis=require(_0xa4dc('0x4'));var db=require(_0xa4dc('0x5'))['db'];var utils=require(_0xa4dc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa4dc('0x7'));var jayson=require(_0xa4dc('0x8'));var client=jayson[_0xa4dc('0x9')][_0xa4dc('0xa')]({'port':0x232a});config[_0xa4dc('0xb')]=_[_0xa4dc('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa4dc('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xa4dc('0xe')](socket);function respondWithRpcPromise(_0xabc3be,_0x445bb0,_0x5b073c){return new BPromise(function(_0x2b9279,_0x345df7){return client['request'](_0xabc3be,_0x5b073c)[_0xa4dc('0xf')](function(_0x325253){logger[_0xa4dc('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x445bb0,'request\x20sent');logger['debug'](_0xa4dc('0x11'),_0x445bb0,_0xa4dc('0x12'),JSON[_0xa4dc('0x13')](_0x325253));if(_0x325253[_0xa4dc('0x14')]){if(_0x325253[_0xa4dc('0x14')]['code']===0x1f4){logger[_0xa4dc('0x14')](_0xa4dc('0x15'),_0x445bb0,_0x325253[_0xa4dc('0x14')][_0xa4dc('0x16')]);return _0x345df7(_0x325253['error'][_0xa4dc('0x16')]);}logger[_0xa4dc('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x445bb0,_0x325253['error'][_0xa4dc('0x16')]);return _0x2b9279(_0x325253['error'][_0xa4dc('0x16')]);}else{logger[_0xa4dc('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x445bb0,_0xa4dc('0x12'));_0x2b9279(_0x325253['result'][_0xa4dc('0x16')]);}})['catch'](function(_0x2f8e49){logger['error'](_0xa4dc('0x15'),_0x445bb0,_0x2f8e49);_0x345df7(_0x2f8e49);});});}exports[_0xa4dc('0x17')]=function(_0x3f11cb){var _0x39ecf5=this;return new Promise(function(_0x316f1e,_0x147374){return db[_0xa4dc('0x18')][_0xa4dc('0x19')]({'raw':_0x3f11cb[_0xa4dc('0x1a')]?_0x3f11cb['options'][_0xa4dc('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f11cb[_0xa4dc('0x1a')]?_0x3f11cb[_0xa4dc('0x1a')][_0xa4dc('0x1c')]||null:null,'attributes':[[db[_0xa4dc('0x1d')]['fn'](_0xa4dc('0x1e'),db['sequelize']['fn']('IF',db[_0xa4dc('0x1d')][_0xa4dc('0x1f')](_0xa4dc('0x20')))),_0xa4dc('0x21')]]})[_0xa4dc('0xf')](function(_0x5f336a){logger[_0xa4dc('0x10')]('GetVoiceQueueRtPauses',_0x3f11cb);logger[_0xa4dc('0x22')](_0xa4dc('0x17'),_0x3f11cb,JSON[_0xa4dc('0x13')](_0x5f336a));_0x316f1e(_0x5f336a);})[_0xa4dc('0x23')](function(_0x4d6bfc){logger[_0xa4dc('0x14')](_0xa4dc('0x17'),_0x4d6bfc[_0xa4dc('0x16')],_0x3f11cb);_0x147374(_0x39ecf5[_0xa4dc('0x14')](0x1f4,_0x4d6bfc['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c45c086..3eb12cf 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 _0x9485=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x31c19c,_0xbe4b70){var _0x1a87f7=function(_0x23cf92){while(--_0x23cf92){_0x31c19c['push'](_0x31c19c['shift']());}};_0x1a87f7(++_0xbe4b70);}(_0x9485,0x8b));var _0x5948=function(_0x51746b,_0x410210){_0x51746b=_0x51746b-0x0;var _0xdd3da8=_0x9485[_0x51746b];return _0xdd3da8;};'use strict';var UserVoiceQueueRtEvents=require(_0x5948('0x0'));var events=[_0x5948('0x1'),_0x5948('0x2'),_0x5948('0x3')];function createListener(_0x5ca17a,_0x42393d){return function(_0xc057c8){_0x42393d[_0x5948('0x4')](_0x5ca17a,_0xc057c8);};}function removeListener(_0x47b3f3,_0xcfd4b6){return function(){UserVoiceQueueRtEvents[_0x5948('0x5')](_0x47b3f3,_0xcfd4b6);};}exports[_0x5948('0x6')]=function(_0x4312a8){for(var _0x19ccdd=0x0,_0x283a13=events['length'];_0x19ccdd<_0x283a13;_0x19ccdd++){var _0x2cf314=events[_0x19ccdd];var _0x4e7f15=createListener(_0x5948('0x7')+_0x2cf314,_0x4312a8);UserVoiceQueueRtEvents['on'](_0x2cf314,_0x4e7f15);}}; \ No newline at end of file +var _0xb715=['update','userVoiceQueueRt:','save'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xb715,0x16d));var _0x5b71=function(_0x597f2a,_0x10151f){_0x597f2a=_0x597f2a-0x0;var _0x48657c=_0xb715[_0x597f2a];return _0x48657c;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x5b71('0x0'),'remove',_0x5b71('0x1')];function createListener(_0x142fff,_0x56f938){return function(_0x2ebf52){_0x56f938['emit'](_0x142fff,_0x2ebf52);};}function removeListener(_0x163202,_0x1a6819){return function(){UserVoiceQueueRtEvents['removeListener'](_0x163202,_0x1a6819);};}exports['register']=function(_0x887674){for(var _0x2a2950=0x0,_0x5a66fa=events['length'];_0x2a2950<_0x5a66fa;_0x2a2950++){var _0x4f1d28=events[_0x2a2950];var _0x37c945=createListener(_0x5b71('0x2')+_0x4f1d28,_0x887674);UserVoiceQueueRtEvents['on'](_0x4f1d28,_0x37c945);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 30e341d..f011d45 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(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_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(_0x355e2b,_0x29e306){var _0x156a4a=function(_0x5474e6){while(--_0x5474e6){_0x355e2b['push'](_0x355e2b['shift']());}};_0x156a4a(++_0x29e306);}(_0x70e0,0x17b));var _0x070e=function(_0x46465a,_0x583f33){_0x46465a=_0x46465a-0x0;var _0x166b55=_0x70e0[_0x46465a];return _0x166b55;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 4f92e48..db8736b 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 _0xb76d=['INTEGER','sequelize'];(function(_0x1e1185,_0x35ca20){var _0x50615d=function(_0x25c6be){while(--_0x25c6be){_0x1e1185['push'](_0x1e1185['shift']());}};_0x50615d(++_0x35ca20);}(_0xb76d,0x119));var _0xdb76=function(_0x413913,_0xca0413){_0x413913=_0x413913-0x0;var _0x5af817=_0xb76d[_0x413913];return _0x5af817;};'use strict';var Sequelize=require(_0xdb76('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdb76('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb36=['exports'];(function(_0x5aa0e2,_0x43edd5){var _0x5cb856=function(_0x5b2abe){while(--_0x5b2abe){_0x5aa0e2['push'](_0x5aa0e2['shift']());}};_0x5cb856(++_0x43edd5);}(_0xbb36,0x90));var _0x6bb3=function(_0x5b1b89,_0x5f3e08){_0x5b1b89=_0x5b1b89-0x0;var _0x1f3e2e=_0xbb36[_0x5b1b89];return _0x1f3e2e;};'use strict';var Sequelize=require('sequelize');module[_0x6bb3('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 4c50dc6..0b14fec 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 _0xe6a7=['moment','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xe6a7,0x1bc));var _0x7e6a=function(_0xc17776,_0x3d49b5){_0xc17776=_0xc17776-0x0;var _0x2bd391=_0xe6a7[_0xc17776];return _0x2bd391;};'use strict';var _=require(_0x7e6a('0x0'));var util=require(_0x7e6a('0x1'));var logger=require(_0x7e6a('0x2'))(_0x7e6a('0x3'));var moment=require(_0x7e6a('0x4'));var BPromise=require('bluebird');var rp=require(_0x7e6a('0x5'));var fs=require('fs');var path=require(_0x7e6a('0x6'));var rimraf=require(_0x7e6a('0x7'));var config=require(_0x7e6a('0x8'));var attributes=require(_0x7e6a('0x9'));module[_0x7e6a('0xa')]=function(_0x256343,_0x3eddf7){return _0x256343[_0x7e6a('0xb')](_0x7e6a('0xc'),attributes,{'tableName':_0x7e6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98ab=['UserWhatsappQueue','user_has_whatsapp_queues','util','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x5731b6,_0x18e5f6){var _0x1a96b0=function(_0x14591a){while(--_0x14591a){_0x5731b6['push'](_0x5731b6['shift']());}};_0x1a96b0(++_0x18e5f6);}(_0x98ab,0x16d));var _0xb98a=function(_0x36ddf7,_0x2e2ce3){_0x36ddf7=_0x36ddf7-0x0;var _0x1a52c4=_0x98ab[_0x36ddf7];return _0x1a52c4;};'use strict';var _=require('lodash');var util=require(_0xb98a('0x0'));var logger=require('../../config/logger')(_0xb98a('0x1'));var moment=require(_0xb98a('0x2'));var BPromise=require('bluebird');var rp=require(_0xb98a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb98a('0x4'));var config=require(_0xb98a('0x5'));var attributes=require(_0xb98a('0x6'));module[_0xb98a('0x7')]=function(_0x2e208c,_0x45a741){return _0x2e208c[_0xb98a('0x8')](_0xb98a('0x9'),attributes,{'tableName':_0xb98a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3e8633f..83bc637 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 _0xa78b=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xabe5ea,_0x2e1b43){var _0x3f3306=function(_0x3c4b67){while(--_0x3c4b67){_0xabe5ea['push'](_0xabe5ea['shift']());}};_0x3f3306(++_0x2e1b43);}(_0xa78b,0x1a6));var _0xba78=function(_0x5c8b05,_0x1f26da){_0x5c8b05=_0x5c8b05-0x0;var _0x225b1b=_0xa78b[_0x5c8b05];return _0x225b1b;};'use strict';var _=require(_0xba78('0x0'));var util=require(_0xba78('0x1'));var moment=require(_0xba78('0x2'));var BPromise=require('bluebird');var rs=require(_0xba78('0x3'));var fs=require('fs');var Redis=require(_0xba78('0x4'));var db=require(_0xba78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba78('0x6'))(_0xba78('0x7'));var config=require('../../config/environment');var jayson=require(_0xba78('0x8'));var client=jayson[_0xba78('0x9')][_0xba78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234f1e,_0x317223,_0x25cecf){return new BPromise(function(_0x48532d,_0x349d1e){return client[_0xba78('0xb')](_0x234f1e,_0x25cecf)[_0xba78('0xc')](function(_0x584451){logger[_0xba78('0xd')](_0xba78('0xe'),_0x317223,_0xba78('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x317223,_0xba78('0xf'),JSON[_0xba78('0x10')](_0x584451));if(_0x584451['error']){if(_0x584451[_0xba78('0x11')]['code']===0x1f4){logger[_0xba78('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x317223,_0x584451[_0xba78('0x11')][_0xba78('0x12')]);return _0x349d1e(_0x584451[_0xba78('0x11')]['message']);}logger[_0xba78('0x11')](_0xba78('0xe'),_0x317223,_0x584451['error']['message']);return _0x48532d(_0x584451[_0xba78('0x11')][_0xba78('0x12')]);}else{logger[_0xba78('0xd')](_0xba78('0xe'),_0x317223,_0xba78('0xf'));_0x48532d(_0x584451[_0xba78('0x13')]['message']);}})['catch'](function(_0x210652){logger[_0xba78('0x11')](_0xba78('0xe'),_0x317223,_0x210652);_0x349d1e(_0x210652);});});} \ No newline at end of file +var _0xff57=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x5dff8a,_0x19024a){var _0x31d669=function(_0x166d69){while(--_0x166d69){_0x5dff8a['push'](_0x5dff8a['shift']());}};_0x31d669(++_0x19024a);}(_0xff57,0x6a));var _0x7ff5=function(_0x2447b4,_0x160300){_0x2447b4=_0x2447b4-0x0;var _0x2ab0bc=_0xff57[_0x2447b4];return _0x2ab0bc;};'use strict';var _=require(_0x7ff5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ff5('0x1'));var rs=require(_0x7ff5('0x2'));var fs=require('fs');var Redis=require(_0x7ff5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ff5('0x4'));var logger=require(_0x7ff5('0x5'))(_0x7ff5('0x6'));var config=require(_0x7ff5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7ff5('0x8')][_0x7ff5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ffbc0,_0x114aaa,_0x50b1c1){return new BPromise(function(_0x387b37,_0x5bdbb1){return client[_0x7ff5('0xa')](_0x4ffbc0,_0x50b1c1)[_0x7ff5('0xb')](function(_0x587dfe){logger[_0x7ff5('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x114aaa,_0x7ff5('0xd'));logger[_0x7ff5('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x114aaa,_0x7ff5('0xd'),JSON[_0x7ff5('0xf')](_0x587dfe));if(_0x587dfe['error']){if(_0x587dfe[_0x7ff5('0x10')][_0x7ff5('0x11')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x114aaa,_0x587dfe[_0x7ff5('0x10')][_0x7ff5('0x12')]);return _0x5bdbb1(_0x587dfe['error'][_0x7ff5('0x12')]);}logger[_0x7ff5('0x10')](_0x7ff5('0x13'),_0x114aaa,_0x587dfe[_0x7ff5('0x10')][_0x7ff5('0x12')]);return _0x387b37(_0x587dfe[_0x7ff5('0x10')][_0x7ff5('0x12')]);}else{logger[_0x7ff5('0xc')](_0x7ff5('0x13'),_0x114aaa,_0x7ff5('0xd'));_0x387b37(_0x587dfe[_0x7ff5('0x14')]['message']);}})[_0x7ff5('0x15')](function(_0x1da890){logger['error'](_0x7ff5('0x13'),_0x114aaa,_0x1da890);_0x5bdbb1(_0x1da890);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index f5ac006..bcb8dd6 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 _0x3937=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','exports','multer'];(function(_0x112203,_0x2db96e){var _0x3e0e1f=function(_0x4bb469){while(--_0x4bb469){_0x112203['push'](_0x112203['shift']());}};_0x3e0e1f(++_0x2db96e);}(_0x3937,0xbf));var _0x7393=function(_0x174b74,_0x477bae){_0x174b74=_0x174b74-0x0;var _0x390664=_0x3937[_0x174b74];return _0x390664;};'use strict';var multer=require(_0x7393('0x0'));var util=require('util');var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require('express');var router=express[_0x7393('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7393('0x5'));var controller=require(_0x7393('0x6'));router[_0x7393('0x7')]('/',auth[_0x7393('0x8')](),controller[_0x7393('0x9')]);router[_0x7393('0x7')](_0x7393('0xa'),auth[_0x7393('0x8')](),controller[_0x7393('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7393('0xc')]);router[_0x7393('0xd')](_0x7393('0xa'),auth['isAuthenticated'](),controller[_0x7393('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7393('0xf')]=router; \ No newline at end of file +var _0x83f1=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0xd30c4a,_0x5497e0){var _0x592922=function(_0x5bf3a9){while(--_0x5bf3a9){_0xd30c4a['push'](_0xd30c4a['shift']());}};_0x592922(++_0x5497e0);}(_0x83f1,0x1cc));var _0x183f=function(_0x490d56,_0x57f246){_0x490d56=_0x490d56-0x0;var _0x2ee08c=_0x83f1[_0x490d56];return _0x2ee08c;};'use strict';var multer=require(_0x183f('0x0'));var util=require(_0x183f('0x1'));var path=require(_0x183f('0x2'));var timeout=require(_0x183f('0x3'));var express=require(_0x183f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x183f('0x5'));var interaction=require(_0x183f('0x6'));var config=require(_0x183f('0x7'));var controller=require(_0x183f('0x8'));router[_0x183f('0x9')]('/',auth['isAuthenticated'](),controller[_0x183f('0xa')]);router[_0x183f('0x9')](_0x183f('0xb'),auth['isAuthenticated'](),controller[_0x183f('0xc')]);router['post']('/',auth[_0x183f('0xd')](),controller[_0x183f('0xe')]);router[_0x183f('0xf')](_0x183f('0xb'),auth[_0x183f('0xd')](),controller[_0x183f('0x10')]);router[_0x183f('0x11')]('/:id',auth[_0x183f('0xd')](),controller[_0x183f('0x12')]);module[_0x183f('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 07c8c87..fc0a036 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 _0xa37e=['name','STRING'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xa37e,0x97));var _0xea37=function(_0x2ec124,_0x27820c){_0x2ec124=_0x2ec124-0x0;var _0x525d50=_0xa37e[_0x2ec124];return _0x525d50;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea37('0x0')],'unique':_0xea37('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea37('0x0')]}}; \ No newline at end of file +var _0x36da=['STRING','name','exports'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x36da,0xd7));var _0xa36d=function(_0x35ba84,_0x27b66e){_0x35ba84=_0x35ba84-0x0;var _0x20b8a1=_0x36da[_0x35ba84];return _0x20b8a1;};'use strict';var Sequelize=require('sequelize');module[_0xa36d('0x0')]={'name':{'type':Sequelize[_0xa36d('0x1')],'unique':_0xa36d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa36d('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bf7b457..599fbd1 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 _0x5f1b=['create','body','user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','then','get','Variables','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','Variable','includeAll','findAll','catch','show','params','options','find'];(function(_0x2c2dff,_0x302e28){var _0x1177a4=function(_0x2fa930){while(--_0x2fa930){_0x2c2dff['push'](_0x2c2dff['shift']());}};_0x1177a4(++_0x302e28);}(_0x5f1b,0xe9));var _0xb5f1=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x5f1b[_0x404957];return _0x4e0365;};'use strict';var emlformat=require(_0xb5f1('0x0'));var rimraf=require(_0xb5f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb5f1('0x2'));var moment=require('moment');var BPromise=require(_0xb5f1('0x3'));var Mustache=require(_0xb5f1('0x4'));var util=require(_0xb5f1('0x5'));var path=require(_0xb5f1('0x6'));var sox=require(_0xb5f1('0x7'));var csv=require(_0xb5f1('0x8'));var ejs=require(_0xb5f1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5f1('0xa'));var squel=require(_0xb5f1('0xb'));var crypto=require('crypto');var jsforce=require(_0xb5f1('0xc'));var deskjs=require(_0xb5f1('0xd'));var toCsv=require(_0xb5f1('0x8'));var querystring=require('querystring');var Papa=require(_0xb5f1('0xe'));var Redis=require(_0xb5f1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb5f1('0x10'));var as=require(_0xb5f1('0x11'));var hardwareService=require(_0xb5f1('0x12'));var logger=require(_0xb5f1('0x13'))(_0xb5f1('0x14'));var utils=require('../../config/utils');var config=require(_0xb5f1('0x15'));var licenseUtil=require(_0xb5f1('0x16'));var db=require(_0xb5f1('0x17'))['db'];function respondWithStatusCode(_0x33160c,_0x271e5e){_0x271e5e=_0x271e5e||0xcc;return function(_0x53ff39){if(_0x53ff39){return _0x33160c[_0xb5f1('0x18')](_0x271e5e);}return _0x33160c['status'](_0x271e5e)[_0xb5f1('0x19')]();};}function respondWithResult(_0x3527b7,_0x13f57c){_0x13f57c=_0x13f57c||0xc8;return function(_0x15a147){if(_0x15a147){return _0x3527b7[_0xb5f1('0x1a')](_0x13f57c)['json'](_0x15a147);}};}function respondWithFilteredResult(_0x2b6dc7,_0x4abbaf){return function(_0xcf770e){if(_0xcf770e){var _0x4f1cf2=typeof _0x4abbaf['offset']===_0xb5f1('0x1b')&&typeof _0x4abbaf[_0xb5f1('0x1c')]===_0xb5f1('0x1b');var _0x2f73e4=_0xcf770e[_0xb5f1('0x1d')];var _0x34299f=_0x4f1cf2?0x0:_0x4abbaf[_0xb5f1('0x1e')];var _0x1e8b15=_0x4f1cf2?_0xcf770e[_0xb5f1('0x1d')]:_0x4abbaf[_0xb5f1('0x1e')]+_0x4abbaf[_0xb5f1('0x1c')];var _0x31aa31;if(_0x1e8b15>=_0x2f73e4){_0x1e8b15=_0x2f73e4;_0x31aa31=0xc8;}else{_0x31aa31=0xce;}_0x2b6dc7[_0xb5f1('0x1a')](_0x31aa31);return _0x2b6dc7[_0xb5f1('0x1f')](_0xb5f1('0x20'),_0x34299f+'-'+_0x1e8b15+'/'+_0x2f73e4)[_0xb5f1('0x21')](_0xcf770e);}return null;};}function patchUpdates(_0x345fac){return function(_0x384c08){try{jsonpatch[_0xb5f1('0x22')](_0x384c08,_0x345fac,!![]);}catch(_0x31146e){return BPromise['reject'](_0x31146e);}return _0x384c08['save']();};}function saveUpdates(_0x146696,_0x1871cd){return function(_0x389035){if(_0x389035){return _0x389035[_0xb5f1('0x23')](_0x146696)['then'](function(_0x35e9ee){return _0x35e9ee;});}return null;};}function removeEntity(_0x4b3e7d,_0x27ca5b){return function(_0x266108){if(_0x266108){return _0x266108[_0xb5f1('0x24')]()[_0xb5f1('0x25')](function(){var _0x467e7d=_0x266108[_0xb5f1('0x26')]({'plain':!![]});var _0x470850=_0xb5f1('0x27');return db[_0xb5f1('0x28')]['destroy']({'where':{'type':_0x470850,'resourceId':_0x467e7d['id']}})['then'](function(){return _0x266108;});})[_0xb5f1('0x25')](function(){_0x4b3e7d['status'](0xcc)[_0xb5f1('0x19')]();});}};}function handleEntityNotFound(_0x4e8e02,_0x5cf5ea){return function(_0x5400cb){if(!_0x5400cb){_0x4e8e02[_0xb5f1('0x18')](0x194);}return _0x5400cb;};}function handleError(_0x236df8,_0x56a808){_0x56a808=_0x56a808||0x1f4;return function(_0x4d827d){logger['error'](_0x4d827d[_0xb5f1('0x29')]);if(_0x4d827d[_0xb5f1('0x2a')]){delete _0x4d827d['name'];}_0x236df8[_0xb5f1('0x1a')](_0x56a808)[_0xb5f1('0x2b')](_0x4d827d);};}exports['index']=function(_0x57b64e,_0x2a3d3d){var _0x5ab57b={},_0x15cff7={},_0x416672={'count':0x0,'rows':[]};var _0x1ba06c=_[_0xb5f1('0x2c')](db['Variable'][_0xb5f1('0x2d')],function(_0x451779){return{'name':_0x451779[_0xb5f1('0x2e')],'type':_0x451779[_0xb5f1('0x2f')][_0xb5f1('0x30')]};});_0x15cff7[_0xb5f1('0x31')]=_[_0xb5f1('0x2c')](_0x1ba06c,'name');_0x15cff7['query']=_[_0xb5f1('0x32')](_0x57b64e['query']);_0x15cff7[_0xb5f1('0x33')]=_['intersection'](_0x15cff7['model'],_0x15cff7[_0xb5f1('0x34')]);_0x5ab57b[_0xb5f1('0x35')]=_[_0xb5f1('0x36')](_0x15cff7['model'],qs['fields'](_0x57b64e[_0xb5f1('0x34')][_0xb5f1('0x37')]));_0x5ab57b[_0xb5f1('0x35')]=_0x5ab57b['attributes'][_0xb5f1('0x38')]?_0x5ab57b[_0xb5f1('0x35')]:_0x15cff7['model'];if(!_0x57b64e['query'][_0xb5f1('0x39')]('nolimit')){_0x5ab57b[_0xb5f1('0x1c')]=qs[_0xb5f1('0x1c')](_0x57b64e[_0xb5f1('0x34')]['limit']);_0x5ab57b[_0xb5f1('0x1e')]=qs['offset'](_0x57b64e['query'][_0xb5f1('0x1e')]);}_0x5ab57b['order']=qs[_0xb5f1('0x3a')](_0x57b64e[_0xb5f1('0x34')]['sort']);_0x5ab57b[_0xb5f1('0x3b')]=qs[_0xb5f1('0x33')](_[_0xb5f1('0x3c')](_0x57b64e[_0xb5f1('0x34')],_0x15cff7[_0xb5f1('0x33')]),_0x1ba06c);if(_0x57b64e['query']['filter']){_0x5ab57b[_0xb5f1('0x3b')]=_[_0xb5f1('0x3d')](_0x5ab57b[_0xb5f1('0x3b')],{'$or':_[_0xb5f1('0x2c')](_0x1ba06c,function(_0x473931){if(_0x473931[_0xb5f1('0x2f')]!==_0xb5f1('0x3e')){var _0x824d31={};_0x824d31[_0x473931[_0xb5f1('0x2a')]]={'$like':'%'+_0x57b64e[_0xb5f1('0x34')]['filter']+'%'};return _0x824d31;}})});}_0x5ab57b=_[_0xb5f1('0x3d')]({},_0x5ab57b,_0x57b64e['options']);var _0x2684fd={'where':_0x5ab57b[_0xb5f1('0x3b')]};return db[_0xb5f1('0x3f')][_0xb5f1('0x1d')](_0x2684fd)[_0xb5f1('0x25')](function(_0x3bf2ac){_0x416672[_0xb5f1('0x1d')]=_0x3bf2ac;if(_0x57b64e[_0xb5f1('0x34')][_0xb5f1('0x40')]){_0x5ab57b['include']=[{'all':!![]}];}return db['Variable'][_0xb5f1('0x41')](_0x5ab57b);})[_0xb5f1('0x25')](function(_0x5e8976){_0x416672['rows']=_0x5e8976;return _0x416672;})[_0xb5f1('0x25')](respondWithFilteredResult(_0x2a3d3d,_0x5ab57b))[_0xb5f1('0x42')](handleError(_0x2a3d3d,null));};exports[_0xb5f1('0x43')]=function(_0x113411,_0x29040a){var _0x5783f6={'raw':!![],'where':{'id':_0x113411[_0xb5f1('0x44')]['id']}},_0x565efa={};_0x565efa[_0xb5f1('0x31')]=_[_0xb5f1('0x32')](db[_0xb5f1('0x3f')]['rawAttributes']);_0x565efa[_0xb5f1('0x34')]=_[_0xb5f1('0x32')](_0x113411[_0xb5f1('0x34')]);_0x565efa[_0xb5f1('0x33')]=_[_0xb5f1('0x36')](_0x565efa[_0xb5f1('0x31')],_0x565efa[_0xb5f1('0x34')]);_0x5783f6[_0xb5f1('0x35')]=_[_0xb5f1('0x36')](_0x565efa[_0xb5f1('0x31')],qs[_0xb5f1('0x37')](_0x113411['query'][_0xb5f1('0x37')]));_0x5783f6[_0xb5f1('0x35')]=_0x5783f6[_0xb5f1('0x35')][_0xb5f1('0x38')]?_0x5783f6['attributes']:_0x565efa['model'];if(_0x113411['query'][_0xb5f1('0x40')]){_0x5783f6['include']=[{'all':!![]}];}_0x5783f6=_['merge']({},_0x5783f6,_0x113411[_0xb5f1('0x45')]);return db[_0xb5f1('0x3f')][_0xb5f1('0x46')](_0x5783f6)[_0xb5f1('0x25')](handleEntityNotFound(_0x29040a,null))[_0xb5f1('0x25')](respondWithResult(_0x29040a,null))[_0xb5f1('0x42')](handleError(_0x29040a,null));};exports[_0xb5f1('0x47')]=function(_0x3a12c7,_0x102b5f){return db['Variable'][_0xb5f1('0x47')](_0x3a12c7[_0xb5f1('0x48')],{})[_0xb5f1('0x25')](function(_0x470bd9){var _0x29564d=_0x3a12c7[_0xb5f1('0x49')][_0xb5f1('0x26')]({'plain':!![]});if(!_0x29564d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29564d[_0xb5f1('0x4a')]==='user'){var _0x20f8d4=_0x470bd9['get']({'plain':!![]});var _0x21355e=_0xb5f1('0x27');return db['UserProfileSection'][_0xb5f1('0x46')]({'where':{'name':_0x21355e,'userProfileId':_0x29564d['userProfileId']},'raw':!![]})['then'](function(_0x3f5ea2){if(_0x3f5ea2&&_0x3f5ea2['autoAssociation']===0x0){return db[_0xb5f1('0x28')][_0xb5f1('0x47')]({'name':_0x20f8d4[_0xb5f1('0x2a')],'resourceId':_0x20f8d4['id'],'type':_0x3f5ea2['name'],'sectionId':_0x3f5ea2['id']},{})['then'](function(){return _0x470bd9;});}else{return _0x470bd9;}})[_0xb5f1('0x42')](function(_0x25764a){logger['error'](_0xb5f1('0x4b'),_0x25764a);throw _0x25764a;});}return _0x470bd9;})['then'](respondWithResult(_0x102b5f,0xc9))[_0xb5f1('0x42')](handleError(_0x102b5f,null));};exports[_0xb5f1('0x23')]=function(_0x36da17,_0x2063cb){if(_0x36da17[_0xb5f1('0x48')]['id']){delete _0x36da17['body']['id'];}return db[_0xb5f1('0x3f')][_0xb5f1('0x46')]({'where':{'id':_0x36da17['params']['id']}})[_0xb5f1('0x25')](handleEntityNotFound(_0x2063cb,null))['then'](saveUpdates(_0x36da17[_0xb5f1('0x48')],null))[_0xb5f1('0x25')](respondWithResult(_0x2063cb,null))[_0xb5f1('0x42')](handleError(_0x2063cb,null));};exports[_0xb5f1('0x24')]=function(_0x1c1d3f,_0x79258){return db['Variable']['find']({'where':{'id':_0x1c1d3f[_0xb5f1('0x44')]['id']}})['then'](handleEntityNotFound(_0x79258,null))[_0xb5f1('0x25')](removeEntity(_0x79258,null))['catch'](handleError(_0x79258,null));}; \ No newline at end of file +var _0x70dd=['fieldName','type','key','map','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Variables','UserProfileResource','sendStatus','error','stack','name','index','Variable'];(function(_0x29d2a2,_0x5920dd){var _0x8aa40c=function(_0x9c4405){while(--_0x9c4405){_0x29d2a2['push'](_0x29d2a2['shift']());}};_0x8aa40c(++_0x5920dd);}(_0x70dd,0x6e));var _0xd70d=function(_0x368fa5,_0x2e7120){_0x368fa5=_0x368fa5-0x0;var _0x2eb711=_0x70dd[_0x368fa5];return _0x2eb711;};'use strict';var emlformat=require(_0xd70d('0x0'));var rimraf=require(_0xd70d('0x1'));var zipdir=require(_0xd70d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd70d('0x3'));var Mustache=require(_0xd70d('0x4'));var util=require(_0xd70d('0x5'));var path=require(_0xd70d('0x6'));var sox=require(_0xd70d('0x7'));var csv=require(_0xd70d('0x8'));var ejs=require(_0xd70d('0x9'));var fs=require('fs');var fs_extra=require(_0xd70d('0xa'));var _=require(_0xd70d('0xb'));var squel=require('squel');var crypto=require(_0xd70d('0xc'));var jsforce=require(_0xd70d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd70d('0x8'));var querystring=require('querystring');var Papa=require(_0xd70d('0xe'));var Redis=require(_0xd70d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd70d('0x10'));var hardwareService=require(_0xd70d('0x11'));var logger=require(_0xd70d('0x12'))(_0xd70d('0x13'));var utils=require('../../config/utils');var config=require(_0xd70d('0x14'));var licenseUtil=require(_0xd70d('0x15'));var db=require(_0xd70d('0x16'))['db'];function respondWithStatusCode(_0x3c6e0a,_0x401f00){_0x401f00=_0x401f00||0xcc;return function(_0x4b8d48){if(_0x4b8d48){return _0x3c6e0a['sendStatus'](_0x401f00);}return _0x3c6e0a[_0xd70d('0x17')](_0x401f00)[_0xd70d('0x18')]();};}function respondWithResult(_0x3ad34b,_0x2b0127){_0x2b0127=_0x2b0127||0xc8;return function(_0x97fc7f){if(_0x97fc7f){return _0x3ad34b[_0xd70d('0x17')](_0x2b0127)['json'](_0x97fc7f);}};}function respondWithFilteredResult(_0xc96fe1,_0x2a1580){return function(_0x2e538d){if(_0x2e538d){var _0x223ea6=typeof _0x2a1580['offset']===_0xd70d('0x19')&&typeof _0x2a1580['limit']===_0xd70d('0x19');var _0x492966=_0x2e538d[_0xd70d('0x1a')];var _0x57ca4a=_0x223ea6?0x0:_0x2a1580[_0xd70d('0x1b')];var _0x3ce7d6=_0x223ea6?_0x2e538d[_0xd70d('0x1a')]:_0x2a1580[_0xd70d('0x1b')]+_0x2a1580[_0xd70d('0x1c')];var _0x38de2c;if(_0x3ce7d6>=_0x492966){_0x3ce7d6=_0x492966;_0x38de2c=0xc8;}else{_0x38de2c=0xce;}_0xc96fe1[_0xd70d('0x17')](_0x38de2c);return _0xc96fe1[_0xd70d('0x1d')](_0xd70d('0x1e'),_0x57ca4a+'-'+_0x3ce7d6+'/'+_0x492966)['json'](_0x2e538d);}return null;};}function patchUpdates(_0x14a318){return function(_0x384ec3){try{jsonpatch[_0xd70d('0x1f')](_0x384ec3,_0x14a318,!![]);}catch(_0x369985){return BPromise[_0xd70d('0x20')](_0x369985);}return _0x384ec3['save']();};}function saveUpdates(_0x448dff,_0x21fae3){return function(_0x16bead){if(_0x16bead){return _0x16bead[_0xd70d('0x21')](_0x448dff)[_0xd70d('0x22')](function(_0x5758df){return _0x5758df;});}return null;};}function removeEntity(_0x4dbfea,_0x488567){return function(_0x18f3c5){if(_0x18f3c5){return _0x18f3c5[_0xd70d('0x23')]()[_0xd70d('0x22')](function(){var _0x507d11=_0x18f3c5['get']({'plain':!![]});var _0x556d9e=_0xd70d('0x24');return db[_0xd70d('0x25')][_0xd70d('0x23')]({'where':{'type':_0x556d9e,'resourceId':_0x507d11['id']}})[_0xd70d('0x22')](function(){return _0x18f3c5;});})['then'](function(){_0x4dbfea['status'](0xcc)[_0xd70d('0x18')]();});}};}function handleEntityNotFound(_0x1472ea,_0x289274){return function(_0x4bb09c){if(!_0x4bb09c){_0x1472ea[_0xd70d('0x26')](0x194);}return _0x4bb09c;};}function handleError(_0xb44358,_0x207ac1){_0x207ac1=_0x207ac1||0x1f4;return function(_0x5ec8eb){logger[_0xd70d('0x27')](_0x5ec8eb[_0xd70d('0x28')]);if(_0x5ec8eb[_0xd70d('0x29')]){delete _0x5ec8eb[_0xd70d('0x29')];}_0xb44358[_0xd70d('0x17')](_0x207ac1)['send'](_0x5ec8eb);};}exports[_0xd70d('0x2a')]=function(_0x2b2cf6,_0x1e61bb){var _0x33069a={},_0x4030cd={},_0x2d8dff={'count':0x0,'rows':[]};var _0xa7e3c5=_['map'](db[_0xd70d('0x2b')]['rawAttributes'],function(_0x541be8){return{'name':_0x541be8[_0xd70d('0x2c')],'type':_0x541be8[_0xd70d('0x2d')][_0xd70d('0x2e')]};});_0x4030cd['model']=_[_0xd70d('0x2f')](_0xa7e3c5,_0xd70d('0x29'));_0x4030cd['query']=_[_0xd70d('0x30')](_0x2b2cf6[_0xd70d('0x31')]);_0x4030cd[_0xd70d('0x32')]=_['intersection'](_0x4030cd['model'],_0x4030cd[_0xd70d('0x31')]);_0x33069a[_0xd70d('0x33')]=_[_0xd70d('0x34')](_0x4030cd[_0xd70d('0x35')],qs[_0xd70d('0x36')](_0x2b2cf6[_0xd70d('0x31')][_0xd70d('0x36')]));_0x33069a[_0xd70d('0x33')]=_0x33069a[_0xd70d('0x33')][_0xd70d('0x37')]?_0x33069a['attributes']:_0x4030cd[_0xd70d('0x35')];if(!_0x2b2cf6['query'][_0xd70d('0x38')](_0xd70d('0x39'))){_0x33069a[_0xd70d('0x1c')]=qs['limit'](_0x2b2cf6[_0xd70d('0x31')]['limit']);_0x33069a[_0xd70d('0x1b')]=qs[_0xd70d('0x1b')](_0x2b2cf6[_0xd70d('0x31')][_0xd70d('0x1b')]);}_0x33069a[_0xd70d('0x3a')]=qs[_0xd70d('0x3b')](_0x2b2cf6['query']['sort']);_0x33069a[_0xd70d('0x3c')]=qs[_0xd70d('0x32')](_[_0xd70d('0x3d')](_0x2b2cf6['query'],_0x4030cd[_0xd70d('0x32')]),_0xa7e3c5);if(_0x2b2cf6[_0xd70d('0x31')][_0xd70d('0x3e')]){_0x33069a['where']=_['merge'](_0x33069a[_0xd70d('0x3c')],{'$or':_['map'](_0xa7e3c5,function(_0x26e171){if(_0x26e171[_0xd70d('0x2d')]!=='VIRTUAL'){var _0x3a6a3e={};_0x3a6a3e[_0x26e171[_0xd70d('0x29')]]={'$like':'%'+_0x2b2cf6['query'][_0xd70d('0x3e')]+'%'};return _0x3a6a3e;}})});}_0x33069a=_['merge']({},_0x33069a,_0x2b2cf6['options']);var _0x26fbb6={'where':_0x33069a[_0xd70d('0x3c')]};return db[_0xd70d('0x2b')][_0xd70d('0x1a')](_0x26fbb6)[_0xd70d('0x22')](function(_0x57e42c){_0x2d8dff['count']=_0x57e42c;if(_0x2b2cf6[_0xd70d('0x31')][_0xd70d('0x3f')]){_0x33069a[_0xd70d('0x40')]=[{'all':!![]}];}return db['Variable'][_0xd70d('0x41')](_0x33069a);})[_0xd70d('0x22')](function(_0x14ae85){_0x2d8dff[_0xd70d('0x42')]=_0x14ae85;return _0x2d8dff;})[_0xd70d('0x22')](respondWithFilteredResult(_0x1e61bb,_0x33069a))[_0xd70d('0x43')](handleError(_0x1e61bb,null));};exports[_0xd70d('0x44')]=function(_0x2c05f0,_0x3af368){var _0x1213cb={'raw':!![],'where':{'id':_0x2c05f0['params']['id']}},_0x48d3ad={};_0x48d3ad['model']=_[_0xd70d('0x30')](db[_0xd70d('0x2b')][_0xd70d('0x45')]);_0x48d3ad[_0xd70d('0x31')]=_['keys'](_0x2c05f0[_0xd70d('0x31')]);_0x48d3ad['filters']=_[_0xd70d('0x34')](_0x48d3ad[_0xd70d('0x35')],_0x48d3ad[_0xd70d('0x31')]);_0x1213cb['attributes']=_['intersection'](_0x48d3ad[_0xd70d('0x35')],qs[_0xd70d('0x36')](_0x2c05f0[_0xd70d('0x31')][_0xd70d('0x36')]));_0x1213cb[_0xd70d('0x33')]=_0x1213cb['attributes'][_0xd70d('0x37')]?_0x1213cb[_0xd70d('0x33')]:_0x48d3ad[_0xd70d('0x35')];if(_0x2c05f0[_0xd70d('0x31')][_0xd70d('0x3f')]){_0x1213cb[_0xd70d('0x40')]=[{'all':!![]}];}_0x1213cb=_['merge']({},_0x1213cb,_0x2c05f0['options']);return db['Variable'][_0xd70d('0x46')](_0x1213cb)[_0xd70d('0x22')](handleEntityNotFound(_0x3af368,null))[_0xd70d('0x22')](respondWithResult(_0x3af368,null))[_0xd70d('0x43')](handleError(_0x3af368,null));};exports[_0xd70d('0x47')]=function(_0x562ebb,_0x5bece0){return db[_0xd70d('0x2b')][_0xd70d('0x47')](_0x562ebb['body'],{})[_0xd70d('0x22')](function(_0x16da89){var _0x2efabe=_0x562ebb[_0xd70d('0x48')]['get']({'plain':!![]});if(!_0x2efabe)throw new Error(_0xd70d('0x49'));if(_0x2efabe['role']==='user'){var _0x31161f=_0x16da89['get']({'plain':!![]});var _0x996403=_0xd70d('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x996403,'userProfileId':_0x2efabe['userProfileId']},'raw':!![]})[_0xd70d('0x22')](function(_0x373ce0){if(_0x373ce0&&_0x373ce0['autoAssociation']===0x0){return db[_0xd70d('0x25')][_0xd70d('0x47')]({'name':_0x31161f['name'],'resourceId':_0x31161f['id'],'type':_0x373ce0[_0xd70d('0x29')],'sectionId':_0x373ce0['id']},{})[_0xd70d('0x22')](function(){return _0x16da89;});}else{return _0x16da89;}})['catch'](function(_0x12b52e){logger['error'](_0xd70d('0x4a'),_0x12b52e);throw _0x12b52e;});}return _0x16da89;})['then'](respondWithResult(_0x5bece0,0xc9))[_0xd70d('0x43')](handleError(_0x5bece0,null));};exports['update']=function(_0x39403,_0xeb57f6){if(_0x39403[_0xd70d('0x4b')]['id']){delete _0x39403[_0xd70d('0x4b')]['id'];}return db[_0xd70d('0x2b')][_0xd70d('0x46')]({'where':{'id':_0x39403[_0xd70d('0x4c')]['id']}})[_0xd70d('0x22')](handleEntityNotFound(_0xeb57f6,null))[_0xd70d('0x22')](saveUpdates(_0x39403[_0xd70d('0x4b')],null))[_0xd70d('0x22')](respondWithResult(_0xeb57f6,null))[_0xd70d('0x43')](handleError(_0xeb57f6,null));};exports[_0xd70d('0x23')]=function(_0x2599e8,_0x2eafda){return db[_0xd70d('0x2b')][_0xd70d('0x46')]({'where':{'id':_0x2599e8[_0xd70d('0x4c')]['id']}})[_0xd70d('0x22')](handleEntityNotFound(_0x2eafda,null))[_0xd70d('0x22')](removeEntity(_0x2eafda,null))[_0xd70d('0x43')](handleError(_0x2eafda,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 72adcd6..61c216c 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 _0xfa93=['moment','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','tools_variables','lodash','api'];(function(_0x1b0394,_0x2386ff){var _0x4612cb=function(_0x26f18d){while(--_0x26f18d){_0x1b0394['push'](_0x1b0394['shift']());}};_0x4612cb(++_0x2386ff);}(_0xfa93,0x77));var _0x3fa9=function(_0x310a02,_0x34d800){_0x310a02=_0x310a02-0x0;var _0x1e4d8f=_0xfa93[_0x310a02];return _0x1e4d8f;};'use strict';var _=require(_0x3fa9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3fa9('0x1'));var moment=require(_0x3fa9('0x2'));var BPromise=require('bluebird');var rp=require(_0x3fa9('0x3'));var fs=require('fs');var path=require(_0x3fa9('0x4'));var rimraf=require(_0x3fa9('0x5'));var config=require(_0x3fa9('0x6'));var attributes=require(_0x3fa9('0x7'));module[_0x3fa9('0x8')]=function(_0x12179c,_0x133512){return _0x12179c[_0x3fa9('0x9')]('Variable',attributes,{'tableName':_0x3fa9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dc0=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','Variable','tools_variables','lodash','util'];(function(_0x29f073,_0x262576){var _0x21fcf1=function(_0x382f71){while(--_0x382f71){_0x29f073['push'](_0x29f073['shift']());}};_0x21fcf1(++_0x262576);}(_0x7dc0,0x169));var _0x07dc=function(_0x5c768b,_0x5e88a6){_0x5c768b=_0x5c768b-0x0;var _0x335af8=_0x7dc0[_0x5c768b];return _0x335af8;};'use strict';var _=require(_0x07dc('0x0'));var util=require(_0x07dc('0x1'));var logger=require(_0x07dc('0x2'))(_0x07dc('0x3'));var moment=require('moment');var BPromise=require(_0x07dc('0x4'));var rp=require(_0x07dc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x07dc('0x6'));var config=require(_0x07dc('0x7'));var attributes=require('./variable.attributes');module[_0x07dc('0x8')]=function(_0x44b7d7,_0x567e04){return _0x44b7d7['define'](_0x07dc('0x9'),attributes,{'tableName':_0x07dc('0xa'),'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 86adbda..8f6608b 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 _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(_0x922177,_0x585e4e){var _0x2fff86=function(_0x1cca6a){while(--_0x1cca6a){_0x922177['push'](_0x922177['shift']());}};_0x2fff86(++_0x585e4e);}(_0x6aa7,0x178));var _0x76aa=function(_0x269060,_0x397d2b){_0x269060=_0x269060-0x0;var _0x9c43b1=_0x6aa7[_0x269060];return _0x9c43b1;};'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 +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x37dbbb,_0x1909de){var _0x10068f=function(_0x2464b0){while(--_0x2464b0){_0x37dbbb['push'](_0x37dbbb['shift']());}};_0x10068f(++_0x1909de);}(_0x1cb9,0x14e));var _0x91cb=function(_0x475662,_0x2c7469){_0x475662=_0x475662-0x0;var _0x306b12=_0x1cb9[_0x475662];return _0x306b12;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c633166..08f8b72 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 _0xcc26=['exports','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','reset','/pull','pull','/migrations','migrations'];(function(_0x2cebd2,_0x512614){var _0x31b24d=function(_0x382116){while(--_0x382116){_0x2cebd2['push'](_0x2cebd2['shift']());}};_0x31b24d(++_0x512614);}(_0xcc26,0xb7));var _0x6cc2=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xcc26[_0x31bab3];return _0x4fd382;};'use strict';var express=require('express');var router=express[_0x6cc2('0x0')]();var auth=require(_0x6cc2('0x1'));var controller=require(_0x6cc2('0x2'));router[_0x6cc2('0x3')]('/',controller[_0x6cc2('0x4')]);router['get']('/fetch',auth[_0x6cc2('0x5')](),auth[_0x6cc2('0x6')](),controller['fetch']);router[_0x6cc2('0x3')]('/reset',auth[_0x6cc2('0x5')](),auth['canUpdate'](),controller[_0x6cc2('0x7')]);router[_0x6cc2('0x3')](_0x6cc2('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x6cc2('0x9')]);router[_0x6cc2('0x3')]('/restart',auth[_0x6cc2('0x5')](),controller['restart']);router[_0x6cc2('0x3')](_0x6cc2('0xa'),controller[_0x6cc2('0xb')]);module[_0x6cc2('0xc')]=router; \ No newline at end of file +var _0x52e8=['reset','/pull','pull','/restart','exports','express','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x5e0eff,_0xe6470f){var _0x4b7c47=function(_0x1534ce){while(--_0x1534ce){_0x5e0eff['push'](_0x5e0eff['shift']());}};_0x4b7c47(++_0xe6470f);}(_0x52e8,0x1c7));var _0x852e=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x52e8[_0x172ed7];return _0xfa8f61;};'use strict';var express=require(_0x852e('0x0'));var router=express['Router']();var auth=require(_0x852e('0x1'));var controller=require(_0x852e('0x2'));router[_0x852e('0x3')]('/',controller[_0x852e('0x4')]);router[_0x852e('0x3')](_0x852e('0x5'),auth[_0x852e('0x6')](),auth[_0x852e('0x7')](),controller[_0x852e('0x8')]);router['get'](_0x852e('0x9'),auth['isAuthenticated'](),auth[_0x852e('0x7')](),controller[_0x852e('0xa')]);router[_0x852e('0x3')](_0x852e('0xb'),auth['isAuthenticated'](),auth[_0x852e('0x7')](),controller[_0x852e('0xc')]);router[_0x852e('0x3')](_0x852e('0xd'),auth[_0x852e('0x6')](),controller['restart']);router[_0x852e('0x3')]('/migrations',controller['migrations']);module[_0x852e('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 69bbc8e..222112c 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 _0xd2b5=['pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','.js','sort','sequelize','Migration','constructor','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/pm2','../../config/logger','update','root','index','version','query','tags','latest','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x49a425,_0x3a102e){var _0x5ef8b7=function(_0x5e4431){while(--_0x5e4431){_0x49a425['push'](_0x49a425['shift']());}};_0x5ef8b7(++_0x3a102e);}(_0xd2b5,0xaa));var _0x5d2b=function(_0x2e13c5,_0x2cd4a5){_0x2e13c5=_0x2e13c5-0x0;var _0x1007f3=_0xd2b5[_0x2e13c5];return _0x1007f3;};'use strict';var Umzug=require(_0x5d2b('0x0'));var path=require(_0x5d2b('0x1'));var fs=require('fs');var _=require(_0x5d2b('0x2'));var pkginfo=require(_0x5d2b('0x3'))(module,'version');var compareVersions=require(_0x5d2b('0x4'));var exec=require('child_process')[_0x5d2b('0x5')];var db=require(_0x5d2b('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x5d2b('0x7'));var logger=require(_0x5d2b('0x8'))(_0x5d2b('0x9'));var git=require('simple-git')(config[_0x5d2b('0xa')]);exports[_0x5d2b('0xb')]=function(_0x1c7607,_0x367fbd){var _0x54a311={'current':module['exports'][_0x5d2b('0xc')],'phonebar':0x2};if(_0x1c7607[_0x5d2b('0xd')]&&_0x1c7607[_0x5d2b('0xd')]['latest']){return git['fetch']()[_0x5d2b('0xe')](function(_0x661c49,_0x1269fb){_0x54a311[_0x5d2b('0xf')]=(_0x661c49?module[_0x5d2b('0x10')][_0x5d2b('0xc')]:_0x1269fb['latest'])||_0x5d2b('0x11');return _0x367fbd[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')](_0x54a311);});}else{return _0x367fbd[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')](_0x54a311);}};exports[_0x5d2b('0x14')]=function(_0x3e00da,_0x344f3d){return git[_0x5d2b('0x14')]([_0x5d2b('0x15'),_0x5d2b('0x16')],function(_0x28fadf){if(_0x28fadf){logger[_0x5d2b('0x17')](_0x28fadf);return _0x344f3d[_0x5d2b('0x12')](0x1f4)[_0x5d2b('0x13')](_0x28fadf);}logger[_0x5d2b('0x18')]('git\x20fetch');return _0x344f3d[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':_0x5d2b('0x19')});});};exports[_0x5d2b('0x1a')]=function(_0x566193,_0x458d36){return git[_0x5d2b('0x1a')]([_0x5d2b('0x1b'),_0x5d2b('0x1c')],function(_0x4539b8){if(_0x4539b8){logger[_0x5d2b('0x17')](_0x4539b8);return _0x458d36[_0x5d2b('0x12')](0x1f4)['json'](_0x4539b8);}logger[_0x5d2b('0x18')](_0x5d2b('0x1d'));return _0x458d36[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x5d2b('0x1e')]=function(_0x35b238,_0x25e73e){exec(_0x5d2b('0x1f'),function(_0xdb7915,_0x1fee17,_0x425d99){logger[_0x5d2b('0x18')](_0x1fee17);logger[_0x5d2b('0x18')](_0x425d99);if(_0xdb7915){logger['error'](_0xdb7915);return _0x25e73e[_0x5d2b('0x12')](0x1f4)[_0x5d2b('0x13')](_0xdb7915);}return _0x25e73e[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':_0x1fee17});});};exports['restart']=function(_0x3ecff6,_0x3961a5){return pm2[_0x5d2b('0x20')](_0x5d2b('0x21'))[_0x5d2b('0x22')](function(_0x3d0a0c){logger['info'](_0x5d2b('0x23'),_0x3d0a0c);return _0x3961a5[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':_0x5d2b('0x24')});})[_0x5d2b('0x25')](function(_0x325770){logger[_0x5d2b('0x17')](_0x325770);return _0x3961a5[_0x5d2b('0x12')](0x1f4)[_0x5d2b('0x13')](_0x325770);});};exports[_0x5d2b('0x26')]=function(_0x5d4c15,_0x3cd885){var _0x4f5fa4=fs[_0x5d2b('0x27')](path[_0x5d2b('0x28')](config[_0x5d2b('0xa')],'server',_0x5d2b('0x26')));var _0x356fff=[];for(var _0x5f0c9c=0x0;_0x5f0c9c<_0x4f5fa4[_0x5d2b('0x29')];_0x5f0c9c++){var _0x18f0d4=_0x4f5fa4[_0x5f0c9c]['replace'](_0x5d2b('0x2a'),'');if(compareVersions(module[_0x5d2b('0x10')][_0x5d2b('0xc')],_0x18f0d4)===-0x1){_0x356fff['push'](_0x18f0d4);}}if(_0x356fff[_0x5d2b('0x29')]){var _0x4490dd=_0x356fff[_0x5d2b('0x2b')](compareVersions);var _0x3d2c6d=new Umzug({'storage':_0x5d2b('0x2c'),'storageOptions':{'model':db[_0x5d2b('0x2d')],'modelName':_0x5d2b('0x2d'),'columnName':_0x5d2b('0xc')},'migrations':{'params':[db[_0x5d2b('0x2c')]['getQueryInterface'](),db[_0x5d2b('0x2c')][_0x5d2b('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5d2b('0x28')](config[_0x5d2b('0xa')],_0x5d2b('0x2f'),_0x5d2b('0x26')),'pattern':/\.js$/}});_0x3d2c6d['up']({'migrations':_['map'](_0x4490dd,function(_0x2b2780){return _0x2b2780+_0x5d2b('0x2a');})})[_0x5d2b('0x22')](function(){return _0x3cd885[_0x5d2b('0x12')](0xc8)['json']({'output':_0x5d2b('0x30')+module[_0x5d2b('0x10')][_0x5d2b('0xc')]+_0x5d2b('0x31')+_['last'](_0x4490dd),'migrations':_[_0x5d2b('0x28')](_0x4490dd)});})['catch'](function(_0x51a0e9){if(_0x51a0e9 instanceof db[_0x5d2b('0x2c')]['UniqueConstraintError']){return _0x3cd885[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x3cd885[_0x5d2b('0x12')](0x1f4)[_0x5d2b('0x13')](_0x51a0e9);}});}else{return _0x3cd885[_0x5d2b('0x12')](0xc8)[_0x5d2b('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x47de=['npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','.js','exports','push','sort','sequelize','Migration','getQueryInterface','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','version','query','latest','tags','2.0.0','status','json','fetch','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x3b7c7d,_0x34525e){var _0x5b836d=function(_0x557feb){while(--_0x557feb){_0x3b7c7d['push'](_0x3b7c7d['shift']());}};_0x5b836d(++_0x34525e);}(_0x47de,0x1b8));var _0xe47d=function(_0x38c23b,_0x60b92){_0x38c23b=_0x38c23b-0x0;var _0x535ba1=_0x47de[_0x38c23b];return _0x535ba1;};'use strict';var Umzug=require(_0xe47d('0x0'));var path=require(_0xe47d('0x1'));var fs=require('fs');var _=require(_0xe47d('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xe47d('0x3'));var exec=require(_0xe47d('0x4'))[_0xe47d('0x5')];var db=require(_0xe47d('0x6'))['db'];var config=require(_0xe47d('0x7'));var pm2=require(_0xe47d('0x8'));var logger=require(_0xe47d('0x9'))('update');var git=require(_0xe47d('0xa'))(config[_0xe47d('0xb')]);exports['index']=function(_0x4afa8d,_0x199c92){var _0x398d19={'current':module['exports'][_0xe47d('0xc')],'phonebar':0x2};if(_0x4afa8d[_0xe47d('0xd')]&&_0x4afa8d['query'][_0xe47d('0xe')]){return git['fetch']()[_0xe47d('0xf')](function(_0x29232a,_0x1ece8b){_0x398d19['latest']=(_0x29232a?module['exports'][_0xe47d('0xc')]:_0x1ece8b[_0xe47d('0xe')])||_0xe47d('0x10');return _0x199c92[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')](_0x398d19);});}else{return _0x199c92['status'](0xc8)['json'](_0x398d19);}};exports['fetch']=function(_0x46f048,_0x3e0682){return git[_0xe47d('0x13')](['origin','master'],function(_0x3a956f){if(_0x3a956f){logger[_0xe47d('0x14')](_0x3a956f);return _0x3e0682[_0xe47d('0x11')](0x1f4)[_0xe47d('0x12')](_0x3a956f);}logger[_0xe47d('0x15')](_0xe47d('0x16'));return _0x3e0682[_0xe47d('0x11')](0xc8)['json']({'output':_0xe47d('0x17')});});};exports[_0xe47d('0x18')]=function(_0x2b038d,_0x4f108c){return git[_0xe47d('0x18')](['--hard','FETCH_HEAD'],function(_0x19a4a5){if(_0x19a4a5){logger['error'](_0x19a4a5);return _0x4f108c[_0xe47d('0x11')](0x1f4)[_0xe47d('0x12')](_0x19a4a5);}logger[_0xe47d('0x15')](_0xe47d('0x19'));return _0x4f108c[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')]({'output':_0xe47d('0x1a')});});};exports[_0xe47d('0x1b')]=function(_0x4e09f9,_0x3f262e){exec(_0xe47d('0x1c'),function(_0x1dce78,_0x24238e,_0x12bc28){logger['info'](_0x24238e);logger[_0xe47d('0x15')](_0x12bc28);if(_0x1dce78){logger[_0xe47d('0x14')](_0x1dce78);return _0x3f262e[_0xe47d('0x11')](0x1f4)[_0xe47d('0x12')](_0x1dce78);}return _0x3f262e[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')]({'output':_0x24238e});});};exports[_0xe47d('0x1d')]=function(_0x4604d5,_0x5baa87){return pm2[_0xe47d('0x1d')](_0xe47d('0x1e'))[_0xe47d('0x1f')](function(_0xe5e9f6){logger[_0xe47d('0x15')]('pm2\x20restart\x20motion\x20%s',_0xe5e9f6);return _0x5baa87[_0xe47d('0x11')](0xc8)['json']({'output':_0xe47d('0x20')});})[_0xe47d('0x21')](function(_0x3204ee){logger['error'](_0x3204ee);return _0x5baa87['status'](0x1f4)[_0xe47d('0x12')](_0x3204ee);});};exports[_0xe47d('0x22')]=function(_0x4d74aa,_0x218347){var _0x10e532=fs[_0xe47d('0x23')](path[_0xe47d('0x24')](config[_0xe47d('0xb')],_0xe47d('0x25'),_0xe47d('0x22')));var _0x49e69f=[];for(var _0x56ad15=0x0;_0x56ad15<_0x10e532[_0xe47d('0x26')];_0x56ad15++){var _0x485812=_0x10e532[_0x56ad15][_0xe47d('0x27')](_0xe47d('0x28'),'');if(compareVersions(module[_0xe47d('0x29')][_0xe47d('0xc')],_0x485812)===-0x1){_0x49e69f[_0xe47d('0x2a')](_0x485812);}}if(_0x49e69f['length']){var _0x5b1e41=_0x49e69f[_0xe47d('0x2b')](compareVersions);var _0x5e15c4=new Umzug({'storage':_0xe47d('0x2c'),'storageOptions':{'model':db[_0xe47d('0x2d')],'modelName':_0xe47d('0x2d'),'columnName':_0xe47d('0xc')},'migrations':{'params':[db['sequelize'][_0xe47d('0x2e')](),db[_0xe47d('0x2c')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],'server','migrations'),'pattern':/\.js$/}});_0x5e15c4['up']({'migrations':_[_0xe47d('0x2f')](_0x5b1e41,function(_0x2a4262){return _0x2a4262+_0xe47d('0x28');})})[_0xe47d('0x1f')](function(){return _0x218347[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xe47d('0x29')]['version']+_0xe47d('0x30')+_[_0xe47d('0x31')](_0x5b1e41),'migrations':_['join'](_0x5b1e41)});})[_0xe47d('0x21')](function(_0x191a6d){if(_0x191a6d instanceof db[_0xe47d('0x2c')][_0xe47d('0x32')]){return _0x218347[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')]({'output':_0xe47d('0x33')});}else{return _0x218347[_0xe47d('0x11')](0x1f4)[_0xe47d('0x12')](_0x191a6d);}});}else{return _0x218347[_0xe47d('0x11')](0xc8)[_0xe47d('0x12')]({'output':_0xe47d('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 39b2567..bfcc1bd 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 _0x2eeb=['show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get','index','isAuthenticated'];(function(_0x2ce0df,_0x4f9bb0){var _0x243c28=function(_0x17f25b){while(--_0x17f25b){_0x2ce0df['push'](_0x2ce0df['shift']());}};_0x243c28(++_0x4f9bb0);}(_0x2eeb,0xc2));var _0xb2ee=function(_0x5bff9c,_0x16d3f0){_0x5bff9c=_0x5bff9c-0x0;var _0x1d584b=_0x2eeb[_0x5bff9c];return _0x1d584b;};'use strict';var multer=require(_0xb2ee('0x0'));var util=require(_0xb2ee('0x1'));var path=require(_0xb2ee('0x2'));var timeout=require(_0xb2ee('0x3'));var express=require(_0xb2ee('0x4'));var router=express[_0xb2ee('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb2ee('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xb2ee('0x7')]('/',auth['isAuthenticated'](),controller[_0xb2ee('0x8')]);router[_0xb2ee('0x7')]('/describe',auth[_0xb2ee('0x9')](),controller['describe']);router[_0xb2ee('0x7')]('/:id',auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xa')]);router['post']('/',auth[_0xb2ee('0x9')](),controller['create']);router[_0xb2ee('0xb')](_0xb2ee('0xc'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xd')]);router[_0xb2ee('0xe')](_0xb2ee('0xc'),auth[_0xb2ee('0x9')](),controller[_0xb2ee('0xf')]);module[_0xb2ee('0x10')]=router; \ No newline at end of file +var _0xf559=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','post','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xfc5a04,_0xb77332){var _0x24b690=function(_0x544d54){while(--_0x544d54){_0xfc5a04['push'](_0xfc5a04['shift']());}};_0x24b690(++_0xb77332);}(_0xf559,0x1f0));var _0x9f55=function(_0x184bd6,_0x3bb0bd){_0x184bd6=_0x184bd6-0x0;var _0x24a967=_0xf559[_0x184bd6];return _0x24a967;};'use strict';var multer=require('multer');var util=require(_0x9f55('0x0'));var path=require(_0x9f55('0x1'));var timeout=require(_0x9f55('0x2'));var express=require(_0x9f55('0x3'));var router=express[_0x9f55('0x4')]();var fs_extra=require(_0x9f55('0x5'));var auth=require(_0x9f55('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f55('0x7'));var controller=require(_0x9f55('0x8'));router[_0x9f55('0x9')]('/',auth[_0x9f55('0xa')](),controller[_0x9f55('0xb')]);router[_0x9f55('0x9')](_0x9f55('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x9f55('0x9')](_0x9f55('0xd'),auth[_0x9f55('0xa')](),controller['show']);router[_0x9f55('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9f55('0xf')](_0x9f55('0xd'),auth[_0x9f55('0xa')](),controller['update']);router[_0x9f55('0x10')](_0x9f55('0xd'),auth[_0x9f55('0xa')](),controller['destroy']);module[_0x9f55('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e1c8890..e5c54b2 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 _0x47c5=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x548e64,_0x29e562){var _0x47d34e=function(_0x397256){while(--_0x397256){_0x548e64['push'](_0x548e64['shift']());}};_0x47d34e(++_0x29e562);}(_0x47c5,0x165));var _0x547c=function(_0xdf845c,_0x4e30e3){_0xdf845c=_0xdf845c-0x0;var _0x3c3fc0=_0x47c5[_0xdf845c];return _0x3c3fc0;};'use strict';var Sequelize=require(_0x547c('0x0'));module[_0x547c('0x1')]={'type':{'type':Sequelize[_0x547c('0x2')]},'uniqueid':{'type':Sequelize[_0x547c('0x2')]},'calleridnum':{'type':Sequelize[_0x547c('0x2')]},'calleridname':{'type':Sequelize[_0x547c('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x547c('0x2')]},'membername':{'type':Sequelize[_0x547c('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x547c('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x547c('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x547c('0x3')]},'holdtime':{'type':Sequelize[_0x547c('0x4')]},'agentcomplete':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x547c('0x4')]},'agentacw':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x547c('0x4')]},'reason':{'type':Sequelize[_0x547c('0x2')]},'lastevent':{'type':Sequelize[_0x547c('0x2')]},'channel':{'type':Sequelize[_0x547c('0x2')]},'channelstate':{'type':Sequelize[_0x547c('0x4')]},'channelstatedesc':{'type':Sequelize[_0x547c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x547c('0x2')]},'connectedlinename':{'type':Sequelize[_0x547c('0x2')]},'language':{'type':Sequelize[_0x547c('0x2')]},'accountcode':{'type':Sequelize[_0x547c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x547c('0x2')]},'priority':{'type':Sequelize[_0x547c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x547c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x547c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x547c('0x2')]},'destcalleridname':{'type':Sequelize[_0x547c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x547c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x547c('0x2')]},'destlanguage':{'type':Sequelize[_0x547c('0x2')]},'destaccountcode':{'type':Sequelize[_0x547c('0x2')]},'destcontext':{'type':Sequelize[_0x547c('0x2')]},'destexten':{'type':Sequelize[_0x547c('0x2')]},'destpriority':{'type':Sequelize[_0x547c('0x2')]},'destuniqueid':{'type':Sequelize[_0x547c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x547c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x547c('0x2')]},'transfer':{'type':Sequelize[_0x547c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x547c('0x2')],'comment':_0x547c('0x6')},'transferexten':{'type':Sequelize[_0x547c('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xdef9=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xdef9,0x1ed));var _0x9def=function(_0x2dd849,_0x3bd1bf){_0x2dd849=_0x2dd849-0x0;var _0x38ba4e=_0xdef9[_0x2dd849];return _0x38ba4e;};'use strict';var Sequelize=require(_0x9def('0x0'));module[_0x9def('0x1')]={'type':{'type':Sequelize[_0x9def('0x2')]},'uniqueid':{'type':Sequelize[_0x9def('0x2')]},'calleridnum':{'type':Sequelize[_0x9def('0x2')]},'calleridname':{'type':Sequelize[_0x9def('0x2')]},'queue':{'type':Sequelize[_0x9def('0x2')]},'interface':{'type':Sequelize[_0x9def('0x2')]},'membername':{'type':Sequelize[_0x9def('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9def('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9def('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x9def('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x9def('0x3')]},'agentdumpAt':{'type':Sequelize[_0x9def('0x3')]},'holdtime':{'type':Sequelize[_0x9def('0x4')]},'agentcomplete':{'type':Sequelize[_0x9def('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9def('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9def('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9def('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9def('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9def('0x2')]},'channelstate':{'type':Sequelize[_0x9def('0x4')]},'channelstatedesc':{'type':Sequelize[_0x9def('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9def('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9def('0x2')]},'accountcode':{'type':Sequelize[_0x9def('0x2')]},'context':{'type':Sequelize[_0x9def('0x2')]},'exten':{'type':Sequelize[_0x9def('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9def('0x2')]},'destchannelstate':{'type':Sequelize[_0x9def('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9def('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x9def('0x2')]},'destlanguage':{'type':Sequelize[_0x9def('0x2')]},'destaccountcode':{'type':Sequelize[_0x9def('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9def('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9def('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9def('0x2')]},'transfer':{'type':Sequelize[_0x9def('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9def('0x2')],'comment':_0x9def('0x6')},'transferexten':{'type':Sequelize[_0x9def('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9def('0x2')]},'agententerreason':{'type':Sequelize[_0x9def('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 e01e039..ec191ed 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(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 812b185..c1ae3fb 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 _0x8a28=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8a28,0xfd));var _0x88a2=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8a28[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x88a2('0xc'),_0x88a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x979e=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x786ca9,_0x3cc6b2){var _0x112e2d=function(_0x30757c){while(--_0x30757c){_0x786ca9['push'](_0x786ca9['shift']());}};_0x112e2d(++_0x3cc6b2);}(_0x979e,0x195));var _0xe979=function(_0x10293a,_0x51b108){_0x10293a=_0x10293a-0x0;var _0x5418cf=_0x979e[_0x10293a];return _0x5418cf;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var logger=require(_0xe979('0x2'))(_0xe979('0x3'));var moment=require('moment');var BPromise=require(_0xe979('0x4'));var rp=require(_0xe979('0x5'));var fs=require('fs');var path=require(_0xe979('0x6'));var rimraf=require(_0xe979('0x7'));var config=require(_0xe979('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0xe979('0x9')]=function(_0x580e20,_0x1a0d35){return _0x580e20[_0xe979('0xa')](_0xe979('0xb'),attributes,{'tableName':_0xe979('0xc'),'paranoid':![],'indexes':[{'fields':[_0xe979('0xd'),_0xe979('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b1e20e6..ab1db28 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 _0x3567=['UpdateVoiceAgentReport','raw','where','attributes','limit','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VoiceAgentReport','create','body','options','then','CreateVoiceAgentReport','debug'];(function(_0x2843df,_0x12376f){var _0x317a47=function(_0x3be0d7){while(--_0x3be0d7){_0x2843df['push'](_0x2843df['shift']());}};_0x317a47(++_0x12376f);}(_0x3567,0x1c7));var _0x7356=function(_0x4369dc,_0x222714){_0x4369dc=_0x4369dc-0x0;var _0x3962bb=_0x3567[_0x4369dc];return _0x3962bb;};'use strict';var _=require(_0x7356('0x0'));var util=require(_0x7356('0x1'));var moment=require('moment');var BPromise=require(_0x7356('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7356('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7356('0x4'))(_0x7356('0x5'));var config=require(_0x7356('0x6'));var jayson=require(_0x7356('0x7'));var client=jayson['client'][_0x7356('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2245,_0x2d824b,_0x6c10b0){return new BPromise(function(_0x865326,_0x5f48f1){return client[_0x7356('0x9')](_0x3e2245,_0x6c10b0)['then'](function(_0x7be50){logger[_0x7356('0xa')](_0x7356('0xb'),_0x2d824b,_0x7356('0xc'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2d824b,_0x7356('0xc'),JSON[_0x7356('0xd')](_0x7be50));if(_0x7be50[_0x7356('0xe')]){if(_0x7be50[_0x7356('0xe')]['code']===0x1f4){logger[_0x7356('0xe')](_0x7356('0xb'),_0x2d824b,_0x7be50['error']['message']);return _0x5f48f1(_0x7be50[_0x7356('0xe')][_0x7356('0xf')]);}logger[_0x7356('0xe')](_0x7356('0xb'),_0x2d824b,_0x7be50[_0x7356('0xe')][_0x7356('0xf')]);return _0x865326(_0x7be50[_0x7356('0xe')][_0x7356('0xf')]);}else{logger[_0x7356('0xa')](_0x7356('0xb'),_0x2d824b,'request\x20sent');_0x865326(_0x7be50[_0x7356('0x10')][_0x7356('0xf')]);}})[_0x7356('0x11')](function(_0x18aa7c){logger[_0x7356('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x2d824b,_0x18aa7c);_0x5f48f1(_0x18aa7c);});});}exports['CreateVoiceAgentReport']=function(_0x266492){var _0x22a0ba=this;return new Promise(function(_0xe7cc68,_0x513dd2){return db[_0x7356('0x12')][_0x7356('0x13')](_0x266492[_0x7356('0x14')],{'raw':_0x266492['options']?_0x266492[_0x7356('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x7356('0x16')](function(_0x7058bd){logger[_0x7356('0xa')](_0x7356('0x17'),_0x266492);logger[_0x7356('0x18')](_0x7356('0x17'),_0x266492,JSON[_0x7356('0xd')](_0x7058bd));_0xe7cc68(_0x7058bd);})[_0x7356('0x11')](function(_0x4213d8){logger['error'](_0x7356('0x17'),_0x4213d8[_0x7356('0xf')],_0x266492);_0x513dd2(_0x22a0ba['error'](0x1f4,_0x4213d8[_0x7356('0xf')]));});});};exports[_0x7356('0x19')]=function(_0xad1f18){var _0x42147c=this;return new Promise(function(_0x5a82c4,_0x30213d){return db[_0x7356('0x12')]['update'](_0xad1f18[_0x7356('0x14')],{'raw':_0xad1f18['options']?_0xad1f18[_0x7356('0x15')][_0x7356('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xad1f18['options']?_0xad1f18['options'][_0x7356('0x1b')]||null:null,'attributes':_0xad1f18['options']?_0xad1f18[_0x7356('0x15')][_0x7356('0x1c')]||null:null,'limit':_0xad1f18[_0x7356('0x15')]?_0xad1f18['options'][_0x7356('0x1d')]||null:null})[_0x7356('0x16')](function(_0x103e8b){logger[_0x7356('0xa')](_0x7356('0x19'),_0xad1f18);logger[_0x7356('0x18')]('UpdateVoiceAgentReport',_0xad1f18,JSON[_0x7356('0xd')](_0x103e8b));_0x5a82c4(_0x103e8b);})['catch'](function(_0x1c9110){logger[_0x7356('0xe')](_0x7356('0x19'),_0x1c9110[_0x7356('0xf')],_0xad1f18);_0x30213d(_0x42147c[_0x7356('0xe')](0x1f4,_0x1c9110[_0x7356('0xf')]));});});}; \ No newline at end of file +var _0xe0fb=['request\x20sent','stringify','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x3f3fd0,_0x2a75b7){var _0x359426=function(_0x56ce54){while(--_0x56ce54){_0x3f3fd0['push'](_0x3f3fd0['shift']());}};_0x359426(++_0x2a75b7);}(_0xe0fb,0x10f));var _0xbe0f=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe0fb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xbe0f('0x0'));var util=require(_0xbe0f('0x1'));var moment=require(_0xbe0f('0x2'));var BPromise=require(_0xbe0f('0x3'));var rs=require(_0xbe0f('0x4'));var fs=require('fs');var Redis=require(_0xbe0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe0f('0x6'));var logger=require(_0xbe0f('0x7'))(_0xbe0f('0x8'));var config=require(_0xbe0f('0x9'));var jayson=require(_0xbe0f('0xa'));var client=jayson['client'][_0xbe0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x193b3b,_0x41328a,_0x25213d){return new BPromise(function(_0x5391a6,_0x20287b){return client['request'](_0x193b3b,_0x25213d)[_0xbe0f('0xc')](function(_0x4dce7d){logger[_0xbe0f('0xd')](_0xbe0f('0xe'),_0x41328a,'request\x20sent');logger[_0xbe0f('0xf')](_0xbe0f('0x10'),_0x41328a,_0xbe0f('0x11'),JSON[_0xbe0f('0x12')](_0x4dce7d));if(_0x4dce7d['error']){if(_0x4dce7d['error'][_0xbe0f('0x13')]===0x1f4){logger[_0xbe0f('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x41328a,_0x4dce7d['error'][_0xbe0f('0x15')]);return _0x20287b(_0x4dce7d[_0xbe0f('0x14')][_0xbe0f('0x15')]);}logger[_0xbe0f('0x14')](_0xbe0f('0xe'),_0x41328a,_0x4dce7d[_0xbe0f('0x14')]['message']);return _0x5391a6(_0x4dce7d[_0xbe0f('0x14')]['message']);}else{logger[_0xbe0f('0xd')](_0xbe0f('0xe'),_0x41328a,_0xbe0f('0x11'));_0x5391a6(_0x4dce7d['result']['message']);}})[_0xbe0f('0x16')](function(_0x3f6db8){logger[_0xbe0f('0x14')]('VoiceAgentReport,\x20%s,\x20%s',_0x41328a,_0x3f6db8);_0x20287b(_0x3f6db8);});});}exports[_0xbe0f('0x17')]=function(_0x22724f){var _0x396aa7=this;return new Promise(function(_0x467e36,_0xef8a3e){return db[_0xbe0f('0x18')][_0xbe0f('0x19')](_0x22724f[_0xbe0f('0x1a')],{'raw':_0x22724f[_0xbe0f('0x1b')]?_0x22724f[_0xbe0f('0x1b')][_0xbe0f('0x1c')]===undefined?!![]:![]:!![]})[_0xbe0f('0xc')](function(_0x195961){logger['info'](_0xbe0f('0x17'),_0x22724f);logger['debug'](_0xbe0f('0x17'),_0x22724f,JSON[_0xbe0f('0x12')](_0x195961));_0x467e36(_0x195961);})[_0xbe0f('0x16')](function(_0x26ba96){logger[_0xbe0f('0x14')](_0xbe0f('0x17'),_0x26ba96['message'],_0x22724f);_0xef8a3e(_0x396aa7[_0xbe0f('0x14')](0x1f4,_0x26ba96[_0xbe0f('0x15')]));});});};exports[_0xbe0f('0x1d')]=function(_0x2ce963){var _0x205fe5=this;return new Promise(function(_0x172319,_0xcc51b9){return db[_0xbe0f('0x18')]['update'](_0x2ce963[_0xbe0f('0x1a')],{'raw':_0x2ce963[_0xbe0f('0x1b')]?_0x2ce963['options'][_0xbe0f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ce963[_0xbe0f('0x1b')]?_0x2ce963[_0xbe0f('0x1b')]['where']||null:null,'attributes':_0x2ce963[_0xbe0f('0x1b')]?_0x2ce963['options'][_0xbe0f('0x1e')]||null:null,'limit':_0x2ce963[_0xbe0f('0x1b')]?_0x2ce963[_0xbe0f('0x1b')][_0xbe0f('0x1f')]||null:null})[_0xbe0f('0xc')](function(_0x20e848){logger[_0xbe0f('0xd')](_0xbe0f('0x1d'),_0x2ce963);logger[_0xbe0f('0xf')](_0xbe0f('0x1d'),_0x2ce963,JSON[_0xbe0f('0x12')](_0x20e848));_0x172319(_0x20e848);})[_0xbe0f('0x16')](function(_0x289a86){logger[_0xbe0f('0x14')](_0xbe0f('0x1d'),_0x289a86[_0xbe0f('0x15')],_0x2ce963);_0xcc51b9(_0x205fe5['error'](0x1f4,_0x289a86[_0xbe0f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7c4b734..40f1a8b 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','isAuthenticated','show','create','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x94b31b,_0x3f1951){_0x94b31b=_0x94b31b-0x0;var _0x22d346=_0x9c5a[_0x94b31b];return _0x22d346;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./voiceCallReport.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['post']('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xd')]);router['put']('/:id',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xe')]);router[_0xa9c5('0xf')](_0xa9c5('0x10'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);module[_0xa9c5('0x12')]=router; \ No newline at end of file +var _0xeec6=['isAuthenticated','index','/describe','describe','get','show','post','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xeec6,0x1c2));var _0x6eec=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0xeec6[_0x364048];return _0x591678;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get']('/',auth[_0x6eec('0xa')](),controller[_0x6eec('0xb')]);router['get'](_0x6eec('0xc'),auth[_0x6eec('0xa')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xa')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6eec('0x11'),auth[_0x6eec('0xa')](),controller['update']);router['delete'](_0x6eec('0x11'),auth['isAuthenticated'](),controller[_0x6eec('0x12')]);module[_0x6eec('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7a1806c..b59c532 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 _0x2761=['outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax'];(function(_0x127c04,_0x211465){var _0x4ea363=function(_0x3cf2a7){while(--_0x3cf2a7){_0x127c04['push'](_0x127c04['shift']());}};_0x4ea363(++_0x211465);}(_0x2761,0x1c1));var _0x1276=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2761[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x1276('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1276('0x1')]},'type':{'type':Sequelize[_0x1276('0x2')](_0x1276('0x3'),_0x1276('0x4'),_0x1276('0x5'),_0x1276('0x6'),_0x1276('0x7'),_0x1276('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1276('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x1276('0x1')]},'destinationcontext':{'type':Sequelize[_0x1276('0x1')]},'callerid':{'type':Sequelize[_0x1276('0x1')]},'channel':{'type':Sequelize[_0x1276('0x1')]},'destinationchannel':{'type':Sequelize[_0x1276('0x1')]},'lastapplication':{'type':Sequelize[_0x1276('0x1')]},'lastdata':{'type':Sequelize[_0x1276('0x9')]},'starttime':{'type':Sequelize[_0x1276('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1276('0xa')]},'endtime':{'type':Sequelize[_0x1276('0xa')]},'duration':{'type':Sequelize[_0x1276('0xb')]},'billableseconds':{'type':Sequelize[_0x1276('0xb')]},'mohtime':{'type':Sequelize[_0x1276('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1276('0x1')]},'amaflags':{'type':Sequelize[_0x1276('0x1')]},'userfield':{'type':Sequelize[_0x1276('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x1276('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1276('0x1')]},'prefix':{'type':Sequelize[_0x1276('0x1')]},'routeid':{'type':Sequelize[_0x1276('0xb')]},'sipcallid':{'type':Sequelize[_0x1276('0x1')]}}; \ No newline at end of file +var _0x685f=['outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x685f,0xc7));var _0xf685=function(_0xd498a,_0x1be1b9){_0xd498a=_0xd498a-0x0;var _0x3e802e=_0x685f[_0xd498a];return _0x3e802e;};'use strict';var Sequelize=require(_0xf685('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xf685('0x1')]},'type':{'type':Sequelize[_0xf685('0x2')](_0xf685('0x3'),_0xf685('0x4'),_0xf685('0x5'),_0xf685('0x6'),_0xf685('0x7'),_0xf685('0x8'))},'tag':{'type':Sequelize[_0xf685('0x1')]},'accountcode':{'type':Sequelize[_0xf685('0x1')]},'source':{'type':Sequelize[_0xf685('0x1')]},'destination':{'type':Sequelize[_0xf685('0x1')]},'destinationcontext':{'type':Sequelize[_0xf685('0x1')]},'callerid':{'type':Sequelize[_0xf685('0x1')]},'channel':{'type':Sequelize[_0xf685('0x1')]},'destinationchannel':{'type':Sequelize[_0xf685('0x1')]},'lastapplication':{'type':Sequelize[_0xf685('0x1')]},'lastdata':{'type':Sequelize[_0xf685('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf685('0xa')]},'answertime':{'type':Sequelize[_0xf685('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xf685('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf685('0x1')]},'amaflags':{'type':Sequelize[_0xf685('0x1')]},'userfield':{'type':Sequelize[_0xf685('0x1')]},'userDisposition':{'type':Sequelize[_0xf685('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xf685('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xf685('0x1')]},'note':{'type':Sequelize[_0xf685('0x1')]},'prefix':{'type':Sequelize[_0xf685('0x1')]},'routeid':{'type':Sequelize[_0xf685('0xb')]},'sipcallid':{'type':Sequelize[_0xf685('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index fbdfce3..7a8718f 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 _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(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x2ef3,0xba));var _0x32ef=function(_0x5e63e6,_0x13c0da){_0x5e63e6=_0x5e63e6-0x0;var _0x1f2059=_0x2ef3[_0x5e63e6];return _0x1f2059;};'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 +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x5f2f,0x73));var _0xf5f2=function(_0x581e5b,_0x54dfd0){_0x581e5b=_0x581e5b-0x0;var _0x5f2f41=_0x5f2f[_0x581e5b];return _0x5f2f41;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1fdeb7d..a036c5d 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 _0x85d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceCallReport.attributes','exports','define','VoiceCallReport','uniqueid'];(function(_0x352573,_0xc50e6e){var _0x1a2b6f=function(_0x2c09b7){while(--_0x2c09b7){_0x352573['push'](_0x352573['shift']());}};_0x1a2b6f(++_0xc50e6e);}(_0x85d6,0x1a4));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x685d('0x0'));var util=require(_0x685d('0x1'));var logger=require(_0x685d('0x2'))(_0x685d('0x3'));var moment=require(_0x685d('0x4'));var BPromise=require(_0x685d('0x5'));var rp=require(_0x685d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x685d('0x7'));module[_0x685d('0x8')]=function(_0x15badd,_0x4464c4){return _0x15badd[_0x685d('0x9')](_0x685d('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x685d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84d1=['bluebird','request-promise','path','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','report_call','lodash','util','api','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x84d1,0xa4));var _0x184d=function(_0x373096,_0x4d37aa){_0x373096=_0x373096-0x0;var _0x14a6d0=_0x84d1[_0x373096];return _0x14a6d0;};'use strict';var _=require(_0x184d('0x0'));var util=require(_0x184d('0x1'));var logger=require('../../config/logger')(_0x184d('0x2'));var moment=require(_0x184d('0x3'));var BPromise=require(_0x184d('0x4'));var rp=require(_0x184d('0x5'));var fs=require('fs');var path=require(_0x184d('0x6'));var rimraf=require('rimraf');var config=require(_0x184d('0x7'));var attributes=require(_0x184d('0x8'));module['exports']=function(_0x4d3112,_0x738700){return _0x4d3112[_0x184d('0x9')](_0x184d('0xa'),attributes,{'tableName':_0x184d('0xb'),'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 501a521..e8240ba 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 _0x5af9=['GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','then','debug','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message'];(function(_0x25f618,_0x186a74){var _0x10c44f=function(_0x44b160){while(--_0x44b160){_0x25f618['push'](_0x25f618['shift']());}};_0x10c44f(++_0x186a74);}(_0x5af9,0x1ce));var _0x95af=function(_0x59eacf,_0x56ec4a){_0x59eacf=_0x59eacf-0x0;var _0x5d74f2=_0x5af9[_0x59eacf];return _0x5d74f2;};'use strict';var _=require(_0x95af('0x0'));var util=require(_0x95af('0x1'));var moment=require(_0x95af('0x2'));var BPromise=require(_0x95af('0x3'));var rs=require(_0x95af('0x4'));var fs=require('fs');var Redis=require(_0x95af('0x5'));var db=require(_0x95af('0x6'))['db'];var utils=require(_0x95af('0x7'));var logger=require('../../config/logger')(_0x95af('0x8'));var config=require(_0x95af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x95af('0xa')][_0x95af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb855,_0x436e26,_0x2d6111){return new BPromise(function(_0x525a2f,_0x1e5bc5){return client['request'](_0x5eb855,_0x2d6111)['then'](function(_0x28d5a8){logger[_0x95af('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x436e26,_0x95af('0xd'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x436e26,_0x95af('0xd'),JSON[_0x95af('0xe')](_0x28d5a8));if(_0x28d5a8[_0x95af('0xf')]){if(_0x28d5a8[_0x95af('0xf')][_0x95af('0x10')]===0x1f4){logger[_0x95af('0xf')](_0x95af('0x11'),_0x436e26,_0x28d5a8[_0x95af('0xf')][_0x95af('0x12')]);return _0x1e5bc5(_0x28d5a8['error']['message']);}logger[_0x95af('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x436e26,_0x28d5a8['error']['message']);return _0x525a2f(_0x28d5a8[_0x95af('0xf')][_0x95af('0x12')]);}else{logger[_0x95af('0xc')](_0x95af('0x11'),_0x436e26,_0x95af('0xd'));_0x525a2f(_0x28d5a8['result'][_0x95af('0x12')]);}})['catch'](function(_0x135ca4){logger['error'](_0x95af('0x11'),_0x436e26,_0x135ca4);_0x1e5bc5(_0x135ca4);});});}exports[_0x95af('0x13')]=function(_0x8cd3a3){var _0x3f6ecb=this;return new Promise(function(_0xe65265,_0x21e929){return db['VoiceCallReport']['findAll']({'raw':_0x8cd3a3[_0x95af('0x14')]?_0x8cd3a3[_0x95af('0x14')][_0x95af('0x15')]===undefined?!![]:![]:!![],'where':_0x8cd3a3[_0x95af('0x14')]?_0x8cd3a3[_0x95af('0x14')][_0x95af('0x16')]||null:null,'attributes':_0x8cd3a3[_0x95af('0x14')]?_0x8cd3a3[_0x95af('0x14')][_0x95af('0x17')]||null:null,'limit':_0x8cd3a3[_0x95af('0x14')]?_0x8cd3a3[_0x95af('0x14')][_0x95af('0x18')]||null:null,'include':_0x8cd3a3[_0x95af('0x14')]?_0x8cd3a3[_0x95af('0x14')][_0x95af('0x19')]?_[_0x95af('0x1a')](_0x8cd3a3[_0x95af('0x14')][_0x95af('0x19')],function(_0x57520d){return{'model':db[_0x57520d['model']],'as':_0x57520d['as'],'attributes':_0x57520d[_0x95af('0x17')],'include':_0x57520d[_0x95af('0x19')]?_['map'](_0x57520d[_0x95af('0x19')],function(_0x58d43a){return{'model':db[_0x58d43a[_0x95af('0x1b')]],'as':_0x58d43a['as'],'attributes':_0x58d43a[_0x95af('0x17')],'include':_0x58d43a[_0x95af('0x19')]?_[_0x95af('0x1a')](_0x58d43a['include'],function(_0x229ff3){return{'model':db[_0x229ff3[_0x95af('0x1b')]],'as':_0x229ff3['as'],'attributes':_0x229ff3[_0x95af('0x17')]};}):[]};}):[]};}):[]:[]})[_0x95af('0x1c')](function(_0x8a2e67){logger[_0x95af('0xc')](_0x95af('0x13'),_0x8cd3a3);logger[_0x95af('0x1d')]('GetVoiceCallReport',_0x8cd3a3,JSON[_0x95af('0xe')](_0x8a2e67));_0xe65265(_0x8a2e67);})['catch'](function(_0x23a6ee){logger['error']('GetVoiceCallReport',_0x23a6ee[_0x95af('0x12')],_0x8cd3a3);_0x21e929(_0x3f6ecb[_0x95af('0xf')](0x1f4,_0x23a6ee['message']));});});};exports[_0x95af('0x1e')]=function(_0x34f646){var _0x5d2416=this;return new Promise(function(_0x52cf45,_0x1ebaa7){return db[_0x95af('0x1f')][_0x95af('0x20')](_0x34f646[_0x95af('0x21')],{'raw':_0x34f646[_0x95af('0x14')]?_0x34f646[_0x95af('0x14')][_0x95af('0x15')]===undefined?!![]:![]:!![]})[_0x95af('0x1c')](function(_0x2275f1){logger[_0x95af('0xc')](_0x95af('0x1e'),_0x34f646);logger['debug'](_0x95af('0x1e'),_0x34f646,JSON['stringify'](_0x2275f1));_0x52cf45(_0x2275f1);})['catch'](function(_0x5be8f0){logger[_0x95af('0xf')](_0x95af('0x1e'),_0x5be8f0[_0x95af('0x12')],_0x34f646);_0x1ebaa7(_0x5d2416[_0x95af('0xf')](0x1f4,_0x5be8f0[_0x95af('0x12')]));});});};exports[_0x95af('0x22')]=function(_0x702187){var _0x331f0c=this;return new Promise(function(_0x191db4,_0x25e714){return db[_0x95af('0x1f')][_0x95af('0x23')](_0x702187['body'],{'raw':_0x702187[_0x95af('0x14')]?_0x702187[_0x95af('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x702187['options']?_0x702187[_0x95af('0x14')][_0x95af('0x16')]||null:null,'attributes':_0x702187[_0x95af('0x14')]?_0x702187['options'][_0x95af('0x17')]||null:null,'limit':_0x702187[_0x95af('0x14')]?_0x702187[_0x95af('0x14')][_0x95af('0x18')]||null:null})[_0x95af('0x1c')](function(_0x281205){logger[_0x95af('0xc')](_0x95af('0x22'),_0x702187);logger[_0x95af('0x1d')](_0x95af('0x22'),_0x702187,JSON[_0x95af('0xe')](_0x281205));_0x191db4(_0x281205);})[_0x95af('0x24')](function(_0x26b232){logger[_0x95af('0xf')](_0x95af('0x22'),_0x26b232[_0x95af('0x12')],_0x702187);_0x25e714(_0x331f0c[_0x95af('0xf')](0x1f4,_0x26b232['message']));});});}; \ No newline at end of file +var _0x7e7a=['create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','include','model','map','then','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7e7a,0xb8));var _0xa7e7=function(_0x1599aa,_0x2b48b6){_0x1599aa=_0x1599aa-0x0;var _0x2f2cb3=_0x7e7a[_0x1599aa];return _0x2f2cb3;};'use strict';var _=require(_0xa7e7('0x0'));var util=require(_0xa7e7('0x1'));var moment=require(_0xa7e7('0x2'));var BPromise=require(_0xa7e7('0x3'));var rs=require(_0xa7e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7e7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa7e7('0x6'));var client=jayson['client'][_0xa7e7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x33ae0d,_0x43e9dc,_0x2bfa7d){return new BPromise(function(_0x346e8e,_0x556f40){return client[_0xa7e7('0x8')](_0x33ae0d,_0x2bfa7d)['then'](function(_0x4d0c89){logger['info'](_0xa7e7('0x9'),_0x43e9dc,_0xa7e7('0xa'));logger[_0xa7e7('0xb')](_0xa7e7('0xc'),_0x43e9dc,_0xa7e7('0xa'),JSON[_0xa7e7('0xd')](_0x4d0c89));if(_0x4d0c89[_0xa7e7('0xe')]){if(_0x4d0c89[_0xa7e7('0xe')][_0xa7e7('0xf')]===0x1f4){logger[_0xa7e7('0xe')](_0xa7e7('0x9'),_0x43e9dc,_0x4d0c89[_0xa7e7('0xe')][_0xa7e7('0x10')]);return _0x556f40(_0x4d0c89[_0xa7e7('0xe')][_0xa7e7('0x10')]);}logger[_0xa7e7('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x43e9dc,_0x4d0c89[_0xa7e7('0xe')][_0xa7e7('0x10')]);return _0x346e8e(_0x4d0c89[_0xa7e7('0xe')][_0xa7e7('0x10')]);}else{logger[_0xa7e7('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x43e9dc,_0xa7e7('0xa'));_0x346e8e(_0x4d0c89[_0xa7e7('0x12')][_0xa7e7('0x10')]);}})[_0xa7e7('0x13')](function(_0x4b9ff3){logger[_0xa7e7('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x43e9dc,_0x4b9ff3);_0x556f40(_0x4b9ff3);});});}exports['GetVoiceCallReport']=function(_0x331c42){var _0x4daa8c=this;return new Promise(function(_0x1366ee,_0x292e77){return db[_0xa7e7('0x14')][_0xa7e7('0x15')]({'raw':_0x331c42['options']?_0x331c42[_0xa7e7('0x16')][_0xa7e7('0x17')]===undefined?!![]:![]:!![],'where':_0x331c42[_0xa7e7('0x16')]?_0x331c42[_0xa7e7('0x16')][_0xa7e7('0x18')]||null:null,'attributes':_0x331c42[_0xa7e7('0x16')]?_0x331c42[_0xa7e7('0x16')][_0xa7e7('0x19')]||null:null,'limit':_0x331c42[_0xa7e7('0x16')]?_0x331c42[_0xa7e7('0x16')]['limit']||null:null,'include':_0x331c42[_0xa7e7('0x16')]?_0x331c42['options'][_0xa7e7('0x1a')]?_['map'](_0x331c42[_0xa7e7('0x16')][_0xa7e7('0x1a')],function(_0x43c93b){return{'model':db[_0x43c93b[_0xa7e7('0x1b')]],'as':_0x43c93b['as'],'attributes':_0x43c93b['attributes'],'include':_0x43c93b[_0xa7e7('0x1a')]?_[_0xa7e7('0x1c')](_0x43c93b[_0xa7e7('0x1a')],function(_0x2acc27){return{'model':db[_0x2acc27[_0xa7e7('0x1b')]],'as':_0x2acc27['as'],'attributes':_0x2acc27[_0xa7e7('0x19')],'include':_0x2acc27['include']?_['map'](_0x2acc27[_0xa7e7('0x1a')],function(_0x477854){return{'model':db[_0x477854['model']],'as':_0x477854['as'],'attributes':_0x477854[_0xa7e7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa7e7('0x1d')](function(_0x374cdd){logger['info'](_0xa7e7('0x1e'),_0x331c42);logger[_0xa7e7('0xb')](_0xa7e7('0x1e'),_0x331c42,JSON[_0xa7e7('0xd')](_0x374cdd));_0x1366ee(_0x374cdd);})[_0xa7e7('0x13')](function(_0x252f15){logger[_0xa7e7('0xe')](_0xa7e7('0x1e'),_0x252f15[_0xa7e7('0x10')],_0x331c42);_0x292e77(_0x4daa8c['error'](0x1f4,_0x252f15[_0xa7e7('0x10')]));});});};exports[_0xa7e7('0x1f')]=function(_0x4e8b69){var _0x4a76bf=this;return new Promise(function(_0x2e93bf,_0x386c19){return db['VoiceCallReport'][_0xa7e7('0x20')](_0x4e8b69[_0xa7e7('0x21')],{'raw':_0x4e8b69[_0xa7e7('0x16')]?_0x4e8b69[_0xa7e7('0x16')][_0xa7e7('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x6b8a7c){logger[_0xa7e7('0x11')]('CreateVoiceCallReport',_0x4e8b69);logger[_0xa7e7('0xb')](_0xa7e7('0x1f'),_0x4e8b69,JSON['stringify'](_0x6b8a7c));_0x2e93bf(_0x6b8a7c);})[_0xa7e7('0x13')](function(_0x297d96){logger['error'](_0xa7e7('0x1f'),_0x297d96[_0xa7e7('0x10')],_0x4e8b69);_0x386c19(_0x4a76bf[_0xa7e7('0xe')](0x1f4,_0x297d96[_0xa7e7('0x10')]));});});};exports[_0xa7e7('0x22')]=function(_0x298297){var _0x3c06f4=this;return new Promise(function(_0x2ce3e7,_0xabf658){return db['VoiceCallReport'][_0xa7e7('0x23')](_0x298297[_0xa7e7('0x21')],{'raw':_0x298297[_0xa7e7('0x16')]?_0x298297[_0xa7e7('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x298297[_0xa7e7('0x16')]?_0x298297[_0xa7e7('0x16')][_0xa7e7('0x18')]||null:null,'attributes':_0x298297[_0xa7e7('0x16')]?_0x298297['options'][_0xa7e7('0x19')]||null:null,'limit':_0x298297[_0xa7e7('0x16')]?_0x298297[_0xa7e7('0x16')]['limit']||null:null})[_0xa7e7('0x1d')](function(_0x1b23cb){logger[_0xa7e7('0x11')](_0xa7e7('0x22'),_0x298297);logger['debug'](_0xa7e7('0x22'),_0x298297,JSON[_0xa7e7('0xd')](_0x1b23cb));_0x2ce3e7(_0x1b23cb);})[_0xa7e7('0x13')](function(_0x3d99bc){logger[_0xa7e7('0xe')](_0xa7e7('0x22'),_0x3d99bc['message'],_0x298297);_0xabf658(_0x3c06f4[_0xa7e7('0xe')](0x1f4,_0x3d99bc[_0xa7e7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6dc6b45..bb92a28 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 _0x2ceb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x30978f,_0x588e69){var _0x2fd279=function(_0x414691){while(--_0x414691){_0x30978f['push'](_0x30978f['shift']());}};_0x2fd279(++_0x588e69);}(_0x2ceb,0x75));var _0xb2ce=function(_0x29e761,_0x583a8c){_0x29e761=_0x29e761-0x0;var _0x2bf631=_0x2ceb[_0x29e761];return _0x2bf631;};'use strict';var multer=require(_0xb2ce('0x0'));var util=require(_0xb2ce('0x1'));var path=require(_0xb2ce('0x2'));var timeout=require('connect-timeout');var express=require(_0xb2ce('0x3'));var router=express[_0xb2ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb2ce('0x5'));var interaction=require(_0xb2ce('0x6'));var config=require(_0xb2ce('0x7'));var controller=require(_0xb2ce('0x8'));router['get']('/',auth[_0xb2ce('0x9')](),controller[_0xb2ce('0xa')]);router['get'](_0xb2ce('0xb'),auth[_0xb2ce('0x9')](),controller[_0xb2ce('0xc')]);router[_0xb2ce('0xd')]('/',auth[_0xb2ce('0x9')](),controller[_0xb2ce('0xe')]);router[_0xb2ce('0xf')](_0xb2ce('0xb'),auth[_0xb2ce('0x9')](),controller[_0xb2ce('0x10')]);router[_0xb2ce('0x11')](_0xb2ce('0xb'),auth[_0xb2ce('0x9')](),controller[_0xb2ce('0x12')]);module[_0xb2ce('0x13')]=router; \ No newline at end of file +var _0x37f8=['isAuthenticated','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index'];(function(_0xf92404,_0x25863f){var _0x397f91=function(_0x1781ba){while(--_0x1781ba){_0xf92404['push'](_0xf92404['shift']());}};_0x397f91(++_0x25863f);}(_0x37f8,0x1ec));var _0x837f=function(_0x27ef8c,_0x26c5c7){_0x27ef8c=_0x27ef8c-0x0;var _0x1dd8b0=_0x37f8[_0x27ef8c];return _0x1dd8b0;};'use strict';var multer=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var path=require(_0x837f('0x2'));var timeout=require(_0x837f('0x3'));var express=require(_0x837f('0x4'));var router=express[_0x837f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x837f('0x6'));var interaction=require(_0x837f('0x7'));var config=require(_0x837f('0x8'));var controller=require(_0x837f('0x9'));router[_0x837f('0xa')]('/',auth['isAuthenticated'](),controller[_0x837f('0xb')]);router[_0x837f('0xa')]('/:id',auth[_0x837f('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x837f('0xd')]('/:id',auth[_0x837f('0xc')](),controller[_0x837f('0xe')]);router[_0x837f('0xf')](_0x837f('0x10'),auth[_0x837f('0xc')](),controller['destroy']);module[_0x837f('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 bb25792..21a7dbd 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 _0xc4c7=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xc4c7,0xe8));var _0x7c4c=function(_0x1b8bda,_0x43ad31){_0x1b8bda=_0x1b8bda-0x0;var _0x1f7050=_0xc4c7[_0x1b8bda];return _0x1f7050;};'use strict';var Sequelize=require('sequelize');module[_0x7c4c('0x0')]={'name':{'type':Sequelize[_0x7c4c('0x1')]},'prefix':{'type':Sequelize[_0x7c4c('0x1')],'unique':_0x7c4c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x7c4c('0x1')],'set':function(_0x4965f5){this[_0x7c4c('0x3')](_0x7c4c('0x4'),_0x4965f5?_0x4965f5[_0x7c4c('0x5')](''):[]);},'get':function(){return this[_0x7c4c('0x6')](_0x7c4c('0x4'))?this[_0x7c4c('0x6')]('options')[_0x7c4c('0x7')](''):[];}},'auth':{'type':Sequelize[_0x7c4c('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x7c4c('0x1')]},'record':{'type':Sequelize[_0x7c4c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7c4c('0x1')]},'description':{'type':Sequelize[_0x7c4c('0x1')]}}; \ No newline at end of file +var _0x9686=['join','getDataValue','options','split','BOOLEAN','exports','STRING','name'];(function(_0xd6482a,_0x4b5055){var _0x2818a5=function(_0x4a2a68){while(--_0x4a2a68){_0xd6482a['push'](_0xd6482a['shift']());}};_0x2818a5(++_0x4b5055);}(_0x9686,0x175));var _0x6968=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9686[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x6968('0x0')]={'name':{'type':Sequelize[_0x6968('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x6968('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x163a48){this['setDataValue']('options',_0x163a48?_0x163a48[_0x6968('0x3')](''):[]);},'get':function(){return this[_0x6968('0x4')]('options')?this[_0x6968('0x4')](_0x6968('0x5'))[_0x6968('0x6')](''):[];}},'auth':{'type':Sequelize[_0x6968('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x6968('0x1')]},'record':{'type':Sequelize[_0x6968('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6968('0x1')]},'description':{'type':Sequelize[_0x6968('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index fbc23e1..ff6daac 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 _0x7d5a=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','json','apply','reject','update','then','destroy','ChanSpies','UserProfileResource','error','stack','name','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','VoiceChanSpy','count','includeAll','include','findAll','catch','params','keys','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','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','sox','to-csv','ejs'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x5df20b,_0x37221a){_0x5df20b=_0x5df20b-0x0;var _0x54279e=_0x7d5a[_0x5df20b];return _0x54279e;};'use strict';var emlformat=require(_0xa7d5('0x0'));var rimraf=require(_0xa7d5('0x1'));var zipdir=require(_0xa7d5('0x2'));var jsonpatch=require(_0xa7d5('0x3'));var rp=require(_0xa7d5('0x4'));var moment=require(_0xa7d5('0x5'));var BPromise=require(_0xa7d5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa7d5('0x7'));var sox=require(_0xa7d5('0x8'));var csv=require(_0xa7d5('0x9'));var ejs=require(_0xa7d5('0xa'));var fs=require('fs');var fs_extra=require(_0xa7d5('0xb'));var _=require(_0xa7d5('0xc'));var squel=require('squel');var crypto=require(_0xa7d5('0xd'));var jsforce=require(_0xa7d5('0xe'));var deskjs=require(_0xa7d5('0xf'));var toCsv=require(_0xa7d5('0x9'));var querystring=require(_0xa7d5('0x10'));var Papa=require(_0xa7d5('0x11'));var Redis=require(_0xa7d5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa7d5('0x13'));var as=require(_0xa7d5('0x14'));var hardwareService=require(_0xa7d5('0x15'));var logger=require('../../config/logger')(_0xa7d5('0x16'));var utils=require(_0xa7d5('0x17'));var config=require(_0xa7d5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7d5('0x19'))['db'];function respondWithStatusCode(_0x68d73a,_0x21dc2b){_0x21dc2b=_0x21dc2b||0xcc;return function(_0x32c1d1){if(_0x32c1d1){return _0x68d73a[_0xa7d5('0x1a')](_0x21dc2b);}return _0x68d73a['status'](_0x21dc2b)[_0xa7d5('0x1b')]();};}function respondWithResult(_0x244ebb,_0x474c87){_0x474c87=_0x474c87||0xc8;return function(_0x3fc942){if(_0x3fc942){return _0x244ebb[_0xa7d5('0x1c')](_0x474c87)['json'](_0x3fc942);}};}function respondWithFilteredResult(_0x207942,_0x2a1641){return function(_0x2c70e5){if(_0x2c70e5){var _0x4cfb1a=typeof _0x2a1641['offset']===_0xa7d5('0x1d')&&typeof _0x2a1641['limit']===_0xa7d5('0x1d');var _0x1f9b68=_0x2c70e5['count'];var _0x2c1383=_0x4cfb1a?0x0:_0x2a1641[_0xa7d5('0x1e')];var _0x2093e0=_0x4cfb1a?_0x2c70e5['count']:_0x2a1641['offset']+_0x2a1641[_0xa7d5('0x1f')];var _0x4c34d8;if(_0x2093e0>=_0x1f9b68){_0x2093e0=_0x1f9b68;_0x4c34d8=0xc8;}else{_0x4c34d8=0xce;}_0x207942[_0xa7d5('0x1c')](_0x4c34d8);return _0x207942['set']('Content-Range',_0x2c1383+'-'+_0x2093e0+'/'+_0x1f9b68)[_0xa7d5('0x20')](_0x2c70e5);}return null;};}function patchUpdates(_0x123241){return function(_0x106a72){try{jsonpatch[_0xa7d5('0x21')](_0x106a72,_0x123241,!![]);}catch(_0x3db378){return BPromise[_0xa7d5('0x22')](_0x3db378);}return _0x106a72['save']();};}function saveUpdates(_0x44eb76,_0x3cabaf){return function(_0x23dbc4){if(_0x23dbc4){return _0x23dbc4[_0xa7d5('0x23')](_0x44eb76)[_0xa7d5('0x24')](function(_0x54ba0a){return _0x54ba0a;});}return null;};}function removeEntity(_0x43b759,_0x164c45){return function(_0x30e1f5){if(_0x30e1f5){return _0x30e1f5[_0xa7d5('0x25')]()[_0xa7d5('0x24')](function(){var _0x1dba7e=_0x30e1f5['get']({'plain':!![]});var _0x280522=_0xa7d5('0x26');return db[_0xa7d5('0x27')][_0xa7d5('0x25')]({'where':{'type':_0x280522,'resourceId':_0x1dba7e['id']}})[_0xa7d5('0x24')](function(){return _0x30e1f5;});})[_0xa7d5('0x24')](function(){_0x43b759['status'](0xcc)[_0xa7d5('0x1b')]();});}};}function handleEntityNotFound(_0x322878,_0x23ffbe){return function(_0x306df5){if(!_0x306df5){_0x322878[_0xa7d5('0x1a')](0x194);}return _0x306df5;};}function handleError(_0x2be715,_0x3e2f44){_0x3e2f44=_0x3e2f44||0x1f4;return function(_0x2a0b71){logger[_0xa7d5('0x28')](_0x2a0b71[_0xa7d5('0x29')]);if(_0x2a0b71[_0xa7d5('0x2a')]){delete _0x2a0b71[_0xa7d5('0x2a')];}_0x2be715[_0xa7d5('0x1c')](_0x3e2f44)['send'](_0x2a0b71);};}exports['index']=function(_0x366a37,_0x29c20a){var _0x27b33f={},_0x28c932={},_0x3be201={'count':0x0,'rows':[]};var _0x35c7ab=_[_0xa7d5('0x2b')](db['VoiceChanSpy'][_0xa7d5('0x2c')],function(_0x1991c3){return{'name':_0x1991c3['fieldName'],'type':_0x1991c3['type'][_0xa7d5('0x2d')]};});_0x28c932[_0xa7d5('0x2e')]=_['map'](_0x35c7ab,'name');_0x28c932[_0xa7d5('0x2f')]=_['keys'](_0x366a37[_0xa7d5('0x2f')]);_0x28c932[_0xa7d5('0x30')]=_[_0xa7d5('0x31')](_0x28c932[_0xa7d5('0x2e')],_0x28c932[_0xa7d5('0x2f')]);_0x27b33f[_0xa7d5('0x32')]=_[_0xa7d5('0x31')](_0x28c932['model'],qs['fields'](_0x366a37['query'][_0xa7d5('0x33')]));_0x27b33f[_0xa7d5('0x32')]=_0x27b33f['attributes'][_0xa7d5('0x34')]?_0x27b33f[_0xa7d5('0x32')]:_0x28c932['model'];if(!_0x366a37['query'][_0xa7d5('0x35')](_0xa7d5('0x36'))){_0x27b33f['limit']=qs['limit'](_0x366a37['query']['limit']);_0x27b33f['offset']=qs[_0xa7d5('0x1e')](_0x366a37[_0xa7d5('0x2f')][_0xa7d5('0x1e')]);}_0x27b33f[_0xa7d5('0x37')]=qs[_0xa7d5('0x38')](_0x366a37[_0xa7d5('0x2f')]['sort']);_0x27b33f['where']=qs['filters'](_['pick'](_0x366a37[_0xa7d5('0x2f')],_0x28c932[_0xa7d5('0x30')]),_0x35c7ab);if(_0x366a37[_0xa7d5('0x2f')][_0xa7d5('0x39')]){_0x27b33f[_0xa7d5('0x3a')]=_[_0xa7d5('0x3b')](_0x27b33f['where'],{'$or':_[_0xa7d5('0x2b')](_0x35c7ab,function(_0x4547b5){if(_0x4547b5['type']!==_0xa7d5('0x3c')){var _0x16b785={};_0x16b785[_0x4547b5['name']]={'$like':'%'+_0x366a37[_0xa7d5('0x2f')][_0xa7d5('0x39')]+'%'};return _0x16b785;}})});}_0x27b33f=_[_0xa7d5('0x3b')]({},_0x27b33f,_0x366a37[_0xa7d5('0x3d')]);var _0x4a01f8={'where':_0x27b33f[_0xa7d5('0x3a')]};return db[_0xa7d5('0x3e')]['count'](_0x4a01f8)['then'](function(_0x185f2c){_0x3be201[_0xa7d5('0x3f')]=_0x185f2c;if(_0x366a37['query'][_0xa7d5('0x40')]){_0x27b33f[_0xa7d5('0x41')]=[{'all':!![]}];}return db[_0xa7d5('0x3e')][_0xa7d5('0x42')](_0x27b33f);})['then'](function(_0x11530f){_0x3be201['rows']=_0x11530f;return _0x3be201;})[_0xa7d5('0x24')](respondWithFilteredResult(_0x29c20a,_0x27b33f))[_0xa7d5('0x43')](handleError(_0x29c20a,null));};exports['show']=function(_0x2ef6f6,_0x3e8c72){var _0x57994d={'raw':![],'where':{'id':_0x2ef6f6[_0xa7d5('0x44')]['id']}},_0x5f5735={};_0x5f5735[_0xa7d5('0x2e')]=_['keys'](db[_0xa7d5('0x3e')][_0xa7d5('0x2c')]);_0x5f5735[_0xa7d5('0x2f')]=_[_0xa7d5('0x45')](_0x2ef6f6[_0xa7d5('0x2f')]);_0x5f5735['filters']=_[_0xa7d5('0x31')](_0x5f5735[_0xa7d5('0x2e')],_0x5f5735['query']);_0x57994d[_0xa7d5('0x32')]=_[_0xa7d5('0x31')](_0x5f5735[_0xa7d5('0x2e')],qs[_0xa7d5('0x33')](_0x2ef6f6[_0xa7d5('0x2f')][_0xa7d5('0x33')]));_0x57994d[_0xa7d5('0x32')]=_0x57994d[_0xa7d5('0x32')]['length']?_0x57994d[_0xa7d5('0x32')]:_0x5f5735[_0xa7d5('0x2e')];if(_0x2ef6f6[_0xa7d5('0x2f')]['includeAll']){_0x57994d['include']=[{'all':!![]}];}_0x57994d=_[_0xa7d5('0x3b')]({},_0x57994d,_0x2ef6f6[_0xa7d5('0x3d')]);return db[_0xa7d5('0x3e')][_0xa7d5('0x46')](_0x57994d)['then'](handleEntityNotFound(_0x3e8c72,null))[_0xa7d5('0x24')](respondWithResult(_0x3e8c72,null))[_0xa7d5('0x43')](handleError(_0x3e8c72,null));};exports[_0xa7d5('0x47')]=function(_0x3bef8f,_0x2ccdc5){return db[_0xa7d5('0x3e')][_0xa7d5('0x47')](_0x3bef8f['body'],{})[_0xa7d5('0x24')](function(_0x2b5bdc){var _0x22d852=_0x3bef8f['user'][_0xa7d5('0x48')]({'plain':!![]});if(!_0x22d852)throw new Error(_0xa7d5('0x49'));if(_0x22d852[_0xa7d5('0x4a')]==='user'){var _0x4e12d1=_0x2b5bdc[_0xa7d5('0x48')]({'plain':!![]});var _0x25913a='ChanSpies';return db['UserProfileSection'][_0xa7d5('0x46')]({'where':{'name':_0x25913a,'userProfileId':_0x22d852['userProfileId']},'raw':!![]})[_0xa7d5('0x24')](function(_0x4752b0){if(_0x4752b0&&_0x4752b0[_0xa7d5('0x4b')]===0x0){return db[_0xa7d5('0x27')][_0xa7d5('0x47')]({'name':_0x4e12d1[_0xa7d5('0x2a')],'resourceId':_0x4e12d1['id'],'type':_0x4752b0[_0xa7d5('0x2a')],'sectionId':_0x4752b0['id']},{})[_0xa7d5('0x24')](function(){return _0x2b5bdc;});}else{return _0x2b5bdc;}})[_0xa7d5('0x43')](function(_0x2ff4f5){logger[_0xa7d5('0x28')](_0xa7d5('0x4c'),_0x2ff4f5);throw _0x2ff4f5;});}return _0x2b5bdc;})['then'](respondWithResult(_0x2ccdc5,0xc9))[_0xa7d5('0x43')](handleError(_0x2ccdc5,null));};exports[_0xa7d5('0x23')]=function(_0x99134e,_0x1ac5f2){if(_0x99134e[_0xa7d5('0x4d')]['id']){delete _0x99134e[_0xa7d5('0x4d')]['id'];}return db[_0xa7d5('0x3e')][_0xa7d5('0x46')]({'where':{'id':_0x99134e[_0xa7d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ac5f2,null))[_0xa7d5('0x24')](saveUpdates(_0x99134e[_0xa7d5('0x4d')],null))['then'](respondWithResult(_0x1ac5f2,null))[_0xa7d5('0x43')](handleError(_0x1ac5f2,null));};exports[_0xa7d5('0x25')]=function(_0x23ad6e,_0x5842ef){return db[_0xa7d5('0x3e')][_0xa7d5('0x46')]({'where':{'id':_0x23ad6e[_0xa7d5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5842ef,null))[_0xa7d5('0x24')](removeEntity(_0x5842ef,null))[_0xa7d5('0x43')](handleError(_0x5842ef,null));}; \ No newline at end of file +var _0x4517=['nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceChanSpy','include','rows','catch','show','params','includeAll','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','body','rimraf','zip-dir','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/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x27329e,_0x538d69){var _0x1ed526=function(_0x7517f0){while(--_0x7517f0){_0x27329e['push'](_0x27329e['shift']());}};_0x1ed526(++_0x538d69);}(_0x4517,0x112));var _0x7451=function(_0x78b74b,_0x13a048){_0x78b74b=_0x78b74b-0x0;var _0x55e15a=_0x4517[_0x78b74b];return _0x55e15a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7451('0x0'));var zipdir=require(_0x7451('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7451('0x2'));var moment=require(_0x7451('0x3'));var BPromise=require(_0x7451('0x4'));var Mustache=require(_0x7451('0x5'));var util=require(_0x7451('0x6'));var path=require(_0x7451('0x7'));var sox=require(_0x7451('0x8'));var csv=require(_0x7451('0x9'));var ejs=require(_0x7451('0xa'));var fs=require('fs');var fs_extra=require(_0x7451('0xb'));var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0x9'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450463,_0x2cb40b){_0x2cb40b=_0x2cb40b||0xcc;return function(_0x4a14dc){if(_0x4a14dc){return _0x450463[_0x7451('0x1a')](_0x2cb40b);}return _0x450463[_0x7451('0x1b')](_0x2cb40b)['end']();};}function respondWithResult(_0x46811e,_0x282128){_0x282128=_0x282128||0xc8;return function(_0x110ed6){if(_0x110ed6){return _0x46811e[_0x7451('0x1b')](_0x282128)['json'](_0x110ed6);}};}function respondWithFilteredResult(_0x357ea9,_0x313385){return function(_0x408336){if(_0x408336){var _0x58c0cd=typeof _0x313385['offset']===_0x7451('0x1c')&&typeof _0x313385[_0x7451('0x1d')]===_0x7451('0x1c');var _0xa8a121=_0x408336[_0x7451('0x1e')];var _0xd47ee4=_0x58c0cd?0x0:_0x313385[_0x7451('0x1f')];var _0x1120b1=_0x58c0cd?_0x408336[_0x7451('0x1e')]:_0x313385['offset']+_0x313385[_0x7451('0x1d')];var _0x32e250;if(_0x1120b1>=_0xa8a121){_0x1120b1=_0xa8a121;_0x32e250=0xc8;}else{_0x32e250=0xce;}_0x357ea9[_0x7451('0x1b')](_0x32e250);return _0x357ea9['set'](_0x7451('0x20'),_0xd47ee4+'-'+_0x1120b1+'/'+_0xa8a121)[_0x7451('0x21')](_0x408336);}return null;};}function patchUpdates(_0x3ffb08){return function(_0x3b5d59){try{jsonpatch[_0x7451('0x22')](_0x3b5d59,_0x3ffb08,!![]);}catch(_0x293e29){return BPromise[_0x7451('0x23')](_0x293e29);}return _0x3b5d59['save']();};}function saveUpdates(_0x3a0c1e,_0x309be0){return function(_0x561e12){if(_0x561e12){return _0x561e12[_0x7451('0x24')](_0x3a0c1e)[_0x7451('0x25')](function(_0x2962f8){return _0x2962f8;});}return null;};}function removeEntity(_0x57cc15,_0x19e33b){return function(_0x21dd67){if(_0x21dd67){return _0x21dd67[_0x7451('0x26')]()[_0x7451('0x25')](function(){var _0x37bc47=_0x21dd67[_0x7451('0x27')]({'plain':!![]});var _0x3c56f1=_0x7451('0x28');return db[_0x7451('0x29')]['destroy']({'where':{'type':_0x3c56f1,'resourceId':_0x37bc47['id']}})[_0x7451('0x25')](function(){return _0x21dd67;});})[_0x7451('0x25')](function(){_0x57cc15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc793e,_0x1edcf2){return function(_0x248d83){if(!_0x248d83){_0xcc793e[_0x7451('0x1a')](0x194);}return _0x248d83;};}function handleError(_0x30ef36,_0x19547e){_0x19547e=_0x19547e||0x1f4;return function(_0x4b5b26){logger[_0x7451('0x2a')](_0x4b5b26['stack']);if(_0x4b5b26[_0x7451('0x2b')]){delete _0x4b5b26[_0x7451('0x2b')];}_0x30ef36['status'](_0x19547e)[_0x7451('0x2c')](_0x4b5b26);};}exports[_0x7451('0x2d')]=function(_0x40b6c3,_0x3a397e){var _0x17d52c={},_0x4e24f7={},_0x2071e5={'count':0x0,'rows':[]};var _0x43d305=_[_0x7451('0x2e')](db['VoiceChanSpy'][_0x7451('0x2f')],function(_0x4654e7){return{'name':_0x4654e7['fieldName'],'type':_0x4654e7['type'][_0x7451('0x30')]};});_0x4e24f7[_0x7451('0x31')]=_['map'](_0x43d305,'name');_0x4e24f7[_0x7451('0x32')]=_[_0x7451('0x33')](_0x40b6c3[_0x7451('0x32')]);_0x4e24f7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x4e24f7[_0x7451('0x31')],_0x4e24f7[_0x7451('0x32')]);_0x17d52c[_0x7451('0x36')]=_['intersection'](_0x4e24f7[_0x7451('0x31')],qs[_0x7451('0x37')](_0x40b6c3['query'][_0x7451('0x37')]));_0x17d52c[_0x7451('0x36')]=_0x17d52c[_0x7451('0x36')][_0x7451('0x38')]?_0x17d52c[_0x7451('0x36')]:_0x4e24f7[_0x7451('0x31')];if(!_0x40b6c3['query'][_0x7451('0x39')](_0x7451('0x3a'))){_0x17d52c['limit']=qs[_0x7451('0x1d')](_0x40b6c3[_0x7451('0x32')]['limit']);_0x17d52c['offset']=qs['offset'](_0x40b6c3['query']['offset']);}_0x17d52c[_0x7451('0x3b')]=qs[_0x7451('0x3c')](_0x40b6c3[_0x7451('0x32')][_0x7451('0x3c')]);_0x17d52c[_0x7451('0x3d')]=qs['filters'](_['pick'](_0x40b6c3['query'],_0x4e24f7['filters']),_0x43d305);if(_0x40b6c3['query'][_0x7451('0x3e')]){_0x17d52c[_0x7451('0x3d')]=_[_0x7451('0x3f')](_0x17d52c[_0x7451('0x3d')],{'$or':_[_0x7451('0x2e')](_0x43d305,function(_0xfa0b5a){if(_0xfa0b5a[_0x7451('0x40')]!==_0x7451('0x41')){var _0x201d96={};_0x201d96[_0xfa0b5a[_0x7451('0x2b')]]={'$like':'%'+_0x40b6c3[_0x7451('0x32')]['filter']+'%'};return _0x201d96;}})});}_0x17d52c=_['merge']({},_0x17d52c,_0x40b6c3[_0x7451('0x42')]);var _0x57f1b2={'where':_0x17d52c[_0x7451('0x3d')]};return db[_0x7451('0x43')]['count'](_0x57f1b2)['then'](function(_0x1f5bf3){_0x2071e5['count']=_0x1f5bf3;if(_0x40b6c3[_0x7451('0x32')]['includeAll']){_0x17d52c[_0x7451('0x44')]=[{'all':!![]}];}return db[_0x7451('0x43')]['findAll'](_0x17d52c);})[_0x7451('0x25')](function(_0x4c326d){_0x2071e5[_0x7451('0x45')]=_0x4c326d;return _0x2071e5;})[_0x7451('0x25')](respondWithFilteredResult(_0x3a397e,_0x17d52c))[_0x7451('0x46')](handleError(_0x3a397e,null));};exports[_0x7451('0x47')]=function(_0x44e636,_0x1d2b1e){var _0x387279={'raw':![],'where':{'id':_0x44e636[_0x7451('0x48')]['id']}},_0x1fcae7={};_0x1fcae7[_0x7451('0x31')]=_[_0x7451('0x33')](db[_0x7451('0x43')][_0x7451('0x2f')]);_0x1fcae7[_0x7451('0x32')]=_['keys'](_0x44e636[_0x7451('0x32')]);_0x1fcae7[_0x7451('0x34')]=_[_0x7451('0x35')](_0x1fcae7[_0x7451('0x31')],_0x1fcae7['query']);_0x387279[_0x7451('0x36')]=_['intersection'](_0x1fcae7['model'],qs['fields'](_0x44e636['query']['fields']));_0x387279[_0x7451('0x36')]=_0x387279[_0x7451('0x36')][_0x7451('0x38')]?_0x387279['attributes']:_0x1fcae7[_0x7451('0x31')];if(_0x44e636[_0x7451('0x32')][_0x7451('0x49')]){_0x387279[_0x7451('0x44')]=[{'all':!![]}];}_0x387279=_[_0x7451('0x3f')]({},_0x387279,_0x44e636[_0x7451('0x42')]);return db[_0x7451('0x43')][_0x7451('0x4a')](_0x387279)[_0x7451('0x25')](handleEntityNotFound(_0x1d2b1e,null))['then'](respondWithResult(_0x1d2b1e,null))['catch'](handleError(_0x1d2b1e,null));};exports['create']=function(_0xd26beb,_0x3acf1d){return db[_0x7451('0x43')]['create'](_0xd26beb['body'],{})['then'](function(_0x7c23ad){var _0x55761d=_0xd26beb['user'][_0x7451('0x27')]({'plain':!![]});if(!_0x55761d)throw new Error(_0x7451('0x4b'));if(_0x55761d[_0x7451('0x4c')]===_0x7451('0x4d')){var _0x24e028=_0x7c23ad['get']({'plain':!![]});var _0x2d39f0='ChanSpies';return db[_0x7451('0x4e')][_0x7451('0x4a')]({'where':{'name':_0x2d39f0,'userProfileId':_0x55761d[_0x7451('0x4f')]},'raw':!![]})[_0x7451('0x25')](function(_0x123d8f){if(_0x123d8f&&_0x123d8f[_0x7451('0x50')]===0x0){return db[_0x7451('0x29')][_0x7451('0x51')]({'name':_0x24e028[_0x7451('0x2b')],'resourceId':_0x24e028['id'],'type':_0x123d8f['name'],'sectionId':_0x123d8f['id']},{})['then'](function(){return _0x7c23ad;});}else{return _0x7c23ad;}})[_0x7451('0x46')](function(_0x94f802){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x94f802);throw _0x94f802;});}return _0x7c23ad;})['then'](respondWithResult(_0x3acf1d,0xc9))[_0x7451('0x46')](handleError(_0x3acf1d,null));};exports[_0x7451('0x24')]=function(_0x454a88,_0x22c4db){if(_0x454a88[_0x7451('0x52')]['id']){delete _0x454a88[_0x7451('0x52')]['id'];}return db['VoiceChanSpy'][_0x7451('0x4a')]({'where':{'id':_0x454a88['params']['id']}})['then'](handleEntityNotFound(_0x22c4db,null))['then'](saveUpdates(_0x454a88[_0x7451('0x52')],null))[_0x7451('0x25')](respondWithResult(_0x22c4db,null))[_0x7451('0x46')](handleError(_0x22c4db,null));};exports[_0x7451('0x26')]=function(_0x68fc70,_0x3aa92f){return db[_0x7451('0x43')]['find']({'where':{'id':_0x68fc70[_0x7451('0x48')]['id']}})[_0x7451('0x25')](handleEntityNotFound(_0x3aa92f,null))[_0x7451('0x25')](removeEntity(_0x3aa92f,null))[_0x7451('0x46')](handleError(_0x3aa92f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 60cf872..b048e4d 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 _0xaa5a=['SIP/%s,%s','name','options','join','record','length','concat','internal','User','findAll','catch','models','define','VoiceChanSpy','then','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','merge','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy'];(function(_0x58b896,_0x3f3923){var _0x3beb23=function(_0x398962){while(--_0x398962){_0x58b896['push'](_0x58b896['shift']());}};_0x3beb23(++_0x3f3923);}(_0xaa5a,0xea));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var BPromise=require(_0xaaa5('0x2'));var attributes=require(_0xaaa5('0x3'));var getUserApplications=function(_0x7dae30,_0x592cf1,_0x30d840){var _0x4e34a8=0x1;var _0x353e9b=[];var _0x12d9ec={'context':_0x592cf1['context']||'from-sip','exten':util[_0xaaa5('0x4')](_0xaaa5('0x5'),_0x7dae30[_0xaaa5('0x6')],_0x30d840),'type':_0xaaa5('0x7'),'isApp':![],'ChanSpyId':_0x7dae30['id'],'UserId':_0x592cf1['id']};_0x353e9b[_0xaaa5('0x8')](_[_0xaaa5('0x9')]({'app':'Set','appdata':util['format'](_0xaaa5('0xa'),_0xaaa5('0xb')),'priority':_0x4e34a8++},_0x12d9ec));if(_0x7dae30['record']){_0x353e9b[_0xaaa5('0x8')](_['merge']({'app':_0xaaa5('0xc'),'appdata':util[_0xaaa5('0x4')](_0xaaa5('0xd'),_0x7dae30['recordingFormat']),'priority':_0x4e34a8++},_0x12d9ec));}if(_0x7dae30[_0xaaa5('0xe')]){_0x353e9b[_0xaaa5('0x8')](_[_0xaaa5('0x9')]({'app':_0xaaa5('0xf'),'appdata':_0x7dae30[_0xaaa5('0x10')],'priority':_0x4e34a8++},_0x12d9ec));}_0x353e9b['push'](_[_0xaaa5('0x9')]({'app':_0xaaa5('0x11'),'appdata':util[_0xaaa5('0x4')](_0xaaa5('0x12'),_0x592cf1[_0xaaa5('0x13')],_0x7dae30[_0xaaa5('0x14')]?_0x7dae30[_0xaaa5('0x14')][_0xaaa5('0x15')](''):''),'priority':_0x4e34a8++},_0x12d9ec));if(_0x7dae30[_0xaaa5('0x16')]){_0x353e9b['push'](_['merge']({'app':'StopMixMonitor','priority':_0x4e34a8++},_0x12d9ec));}return _0x353e9b;};var getChanSpyApplications=function(_0x258e75,_0x4c24a3){var _0x1115a7=[];for(var _0x44533c=0x0,_0x484dd8=0x1;_0x44533c<_0x4c24a3[_0xaaa5('0x17')];_0x44533c++,_0x484dd8=0x1){_0x1115a7=_0x1115a7[_0xaaa5('0x18')](getUserApplications(_0x258e75,_0x4c24a3[_0x44533c],_0x4c24a3[_0x44533c][_0xaaa5('0x19')]));if(_0x4c24a3[_0x44533c][_0xaaa5('0x19')]!=_0x4c24a3[_0x44533c][_0xaaa5('0x13')]){_0x1115a7=_0x1115a7['concat'](getUserApplications(_0x258e75,_0x4c24a3[_0x44533c],_0x4c24a3[_0x44533c]['name']));}}return _0x1115a7;};var getChanSpyPromise=function(_0x1f9ea2,_0x4ee1e1){return new BPromise(function(_0xa81569,_0x2b60d4){return _0x1f9ea2[_0xaaa5('0x1a')][_0xaaa5('0x1b')]({'attributes':['id',_0xaaa5('0x13'),_0xaaa5('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x442b9d){if(_0x442b9d){return _0xa81569(getChanSpyApplications(_0x4ee1e1,_0x442b9d));}return _0xa81569([]);})[_0xaaa5('0x1c')](function(_0x239cb1){_0x2b60d4(_0x239cb1);});});};module['exports']=function(_0x4371f3,_0x4327cc){var _0x49ba6f=_0x4371f3[_0xaaa5('0x1d')];return _0x4371f3[_0xaaa5('0x1e')](_0xaaa5('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x422c73,_0x4c4986,_0x59d1ca){return getChanSpyPromise(_0x49ba6f,_0x422c73)[_0xaaa5('0x20')](function(_0x358a42){if(_0x358a42&&_0x358a42['length']){return _0x49ba6f[_0xaaa5('0x21')]['bulkCreate'](_0x358a42);}})[_0xaaa5('0x20')](function(){_0x59d1ca();})[_0xaaa5('0x1c')](function(_0x1497bb){_0x59d1ca(_0x1497bb);});},'afterUpdate':function(_0x42a53f,_0x43f912,_0x3c28ef){return _0x49ba6f['VoiceExtension'][_0xaaa5('0x22')]({'where':{'ChanSpyId':_0x42a53f['id']}})['then'](function(){return getChanSpyPromise(_0x49ba6f,_0x42a53f);})['then'](function(_0x4f7c77){if(_0x4f7c77&&_0x4f7c77[_0xaaa5('0x17')]){return _0x49ba6f['VoiceExtension'][_0xaaa5('0x23')](_0x4f7c77);}})[_0xaaa5('0x20')](function(){_0x3c28ef();})[_0xaaa5('0x1c')](function(_0xb15a4b){_0x3c28ef(_0xb15a4b);});},'afterDestroy':function(_0x52f741,_0x195493,_0x33a9da){return _0x49ba6f['VoiceExtension'][_0xaaa5('0x22')]({'where':{'ChanSpyId':_0x52f741['id']}})['then'](function(){_0x33a9da();})[_0xaaa5('0x1c')](function(_0x254182){_0x33a9da(_0x254182);});}}});}; \ No newline at end of file +var _0x78af=['merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','auth','Authenticate','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','findAll','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','util','from-sip','format','%s%s','prefix','push'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x78af,0xe1));var _0xf78a=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x78af[_0x313c96];return _0x522f53;};'use strict';var _=require('lodash');var util=require(_0xf78a('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x736291,_0x54a486,_0x42d28c){var _0x1e30ae=0x1;var _0x338997=[];var _0x577854={'context':_0x54a486['context']||_0xf78a('0x1'),'exten':util[_0xf78a('0x2')](_0xf78a('0x3'),_0x736291[_0xf78a('0x4')],_0x42d28c),'type':'system','isApp':![],'ChanSpyId':_0x736291['id'],'UserId':_0x54a486['id']};_0x338997[_0xf78a('0x5')](_[_0xf78a('0x6')]({'app':_0xf78a('0x7'),'appdata':util[_0xf78a('0x2')](_0xf78a('0x8'),_0xf78a('0x9')),'priority':_0x1e30ae++},_0x577854));if(_0x736291[_0xf78a('0xa')]){_0x338997[_0xf78a('0x5')](_[_0xf78a('0x6')]({'app':'MixMonitor','appdata':util[_0xf78a('0x2')](_0xf78a('0xb'),_0x736291['recordingFormat']),'priority':_0x1e30ae++},_0x577854));}if(_0x736291[_0xf78a('0xc')]){_0x338997[_0xf78a('0x5')](_['merge']({'app':_0xf78a('0xd'),'appdata':_0x736291['password'],'priority':_0x1e30ae++},_0x577854));}_0x338997[_0xf78a('0x5')](_[_0xf78a('0x6')]({'app':_0xf78a('0xe'),'appdata':util[_0xf78a('0x2')](_0xf78a('0xf'),_0x54a486['name'],_0x736291[_0xf78a('0x10')]?_0x736291[_0xf78a('0x10')][_0xf78a('0x11')](''):''),'priority':_0x1e30ae++},_0x577854));if(_0x736291['record']){_0x338997[_0xf78a('0x5')](_[_0xf78a('0x6')]({'app':_0xf78a('0x12'),'priority':_0x1e30ae++},_0x577854));}return _0x338997;};var getChanSpyApplications=function(_0x52cd92,_0xffe277){var _0xce3cca=[];for(var _0x3c4257=0x0,_0xdf7bdb=0x1;_0x3c4257<_0xffe277[_0xf78a('0x13')];_0x3c4257++,_0xdf7bdb=0x1){_0xce3cca=_0xce3cca[_0xf78a('0x14')](getUserApplications(_0x52cd92,_0xffe277[_0x3c4257],_0xffe277[_0x3c4257][_0xf78a('0x15')]));if(_0xffe277[_0x3c4257][_0xf78a('0x15')]!=_0xffe277[_0x3c4257][_0xf78a('0x16')]){_0xce3cca=_0xce3cca[_0xf78a('0x14')](getUserApplications(_0x52cd92,_0xffe277[_0x3c4257],_0xffe277[_0x3c4257][_0xf78a('0x16')]));}}return _0xce3cca;};var getChanSpyPromise=function(_0x464250,_0x2de71a){return new BPromise(function(_0x3dc71f,_0x175251){return _0x464250['User'][_0xf78a('0x17')]({'attributes':['id',_0xf78a('0x16'),_0xf78a('0x15')],'where':{'role':_0xf78a('0x18'),'chanspy':!![]},'raw':!![]})[_0xf78a('0x19')](function(_0x1d7077){if(_0x1d7077){return _0x3dc71f(getChanSpyApplications(_0x2de71a,_0x1d7077));}return _0x3dc71f([]);})[_0xf78a('0x1a')](function(_0x3f031d){_0x175251(_0x3f031d);});});};module[_0xf78a('0x1b')]=function(_0x221cd5,_0x5ebd2a){var _0x1851f5=_0x221cd5['models'];return _0x221cd5['define'](_0xf78a('0x1c'),attributes,{'tableName':_0xf78a('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1451b4,_0x3fbc77,_0x1eca9b){return getChanSpyPromise(_0x1851f5,_0x1451b4)[_0xf78a('0x19')](function(_0xa2a929){if(_0xa2a929&&_0xa2a929[_0xf78a('0x13')]){return _0x1851f5[_0xf78a('0x1e')]['bulkCreate'](_0xa2a929);}})[_0xf78a('0x19')](function(){_0x1eca9b();})['catch'](function(_0x106f24){_0x1eca9b(_0x106f24);});},'afterUpdate':function(_0x3c14fa,_0x42cb1a,_0x472df8){return _0x1851f5[_0xf78a('0x1e')][_0xf78a('0x1f')]({'where':{'ChanSpyId':_0x3c14fa['id']}})[_0xf78a('0x19')](function(){return getChanSpyPromise(_0x1851f5,_0x3c14fa);})[_0xf78a('0x19')](function(_0xfb0203){if(_0xfb0203&&_0xfb0203[_0xf78a('0x13')]){return _0x1851f5['VoiceExtension'][_0xf78a('0x20')](_0xfb0203);}})['then'](function(){_0x472df8();})[_0xf78a('0x1a')](function(_0x21cd23){_0x472df8(_0x21cd23);});},'afterDestroy':function(_0x5e9181,_0x190c0d,_0x222c07){return _0x1851f5[_0xf78a('0x1e')][_0xf78a('0x1f')]({'where':{'ChanSpyId':_0x5e9181['id']}})[_0xf78a('0x19')](function(){_0x222c07();})[_0xf78a('0x1a')](function(_0x3ad16b){_0x222c07(_0x3ad16b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 0e2e1fa..8603fa5 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 _0x0102=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0102,0x186));var _0x2010=function(_0x156a7d,_0x5adb83){_0x156a7d=_0x156a7d-0x0;var _0x5ef930=_0x0102[_0x156a7d];return _0x5ef930;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var moment=require(_0x2010('0x1'));var BPromise=require(_0x2010('0x2'));var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2010('0x4'));var jayson=require(_0x2010('0x5'));var client=jayson[_0x2010('0x6')][_0x2010('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4eeb67,_0x453fc0,_0x495d98){return new BPromise(function(_0x4728c0,_0x160e41){return client['request'](_0x4eeb67,_0x495d98)[_0x2010('0x8')](function(_0x3c2d98){logger[_0x2010('0x9')](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));logger[_0x2010('0xc')](_0x2010('0xd'),_0x453fc0,_0x2010('0xb'),JSON[_0x2010('0xe')](_0x3c2d98));if(_0x3c2d98[_0x2010('0xf')]){if(_0x3c2d98[_0x2010('0xf')][_0x2010('0x10')]===0x1f4){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x160e41(_0x3c2d98['error']['message']);}logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);return _0x4728c0(_0x3c2d98[_0x2010('0xf')][_0x2010('0x11')]);}else{logger['info'](_0x2010('0xa'),_0x453fc0,_0x2010('0xb'));_0x4728c0(_0x3c2d98['result'][_0x2010('0x11')]);}})[_0x2010('0x12')](function(_0x410889){logger[_0x2010('0xf')](_0x2010('0xa'),_0x453fc0,_0x410889);_0x160e41(_0x410889);});});} \ No newline at end of file +var _0x180f=['result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xb35037,_0x5c42ab){var _0x44163d=function(_0x171375){while(--_0x171375){_0xb35037['push'](_0xb35037['shift']());}};_0x44163d(++_0x5c42ab);}(_0x180f,0xf3));var _0xf180=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x180f[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xf180('0x0'));var util=require(_0xf180('0x1'));var moment=require('moment');var BPromise=require(_0xf180('0x2'));var rs=require(_0xf180('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf180('0x4'))['db'];var utils=require(_0xf180('0x5'));var logger=require(_0xf180('0x6'))(_0xf180('0x7'));var config=require(_0xf180('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf180('0x9')][_0xf180('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x513113,_0x47d87b,_0x1d6ca7){return new BPromise(function(_0x303412,_0x342a02){return client[_0xf180('0xb')](_0x513113,_0x1d6ca7)[_0xf180('0xc')](function(_0x4390be){logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,_0xf180('0xf'));logger['debug'](_0xf180('0x10'),_0x47d87b,_0xf180('0xf'),JSON[_0xf180('0x11')](_0x4390be));if(_0x4390be[_0xf180('0x12')]){if(_0x4390be[_0xf180('0x12')][_0xf180('0x13')]===0x1f4){logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x342a02(_0x4390be[_0xf180('0x12')]['message']);}logger[_0xf180('0x12')](_0xf180('0xe'),_0x47d87b,_0x4390be[_0xf180('0x12')][_0xf180('0x14')]);return _0x303412(_0x4390be['error'][_0xf180('0x14')]);}else{logger[_0xf180('0xd')](_0xf180('0xe'),_0x47d87b,'request\x20sent');_0x303412(_0x4390be[_0xf180('0x15')][_0xf180('0x14')]);}})['catch'](function(_0x115b86){logger[_0xf180('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x47d87b,_0x115b86);_0x342a02(_0x115b86);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 15cb9c1..ad858a2 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 _0x986c=['post','create','update','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id'];(function(_0x190602,_0x35909a){var _0x1f6fda=function(_0x58b33a){while(--_0x58b33a){_0x190602['push'](_0x190602['shift']());}};_0x1f6fda(++_0x35909a);}(_0x986c,0x134));var _0xc986=function(_0x4156e5,_0x3153bf){_0x4156e5=_0x4156e5-0x0;var _0x504aff=_0x986c[_0x4156e5];return _0x504aff;};'use strict';var multer=require(_0xc986('0x0'));var util=require('util');var path=require(_0xc986('0x1'));var timeout=require(_0xc986('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc986('0x3'));var auth=require(_0xc986('0x4'));var interaction=require(_0xc986('0x5'));var config=require(_0xc986('0x6'));var controller=require(_0xc986('0x7'));router['get']('/',auth[_0xc986('0x8')](),controller[_0xc986('0x9')]);router[_0xc986('0xa')](_0xc986('0xb'),auth[_0xc986('0x8')](),controller['show']);router[_0xc986('0xc')]('/',auth[_0xc986('0x8')](),controller[_0xc986('0xd')]);router['put']('/:id',auth[_0xc986('0x8')](),controller[_0xc986('0xe')]);router['delete']('/:id',auth[_0xc986('0x8')](),controller[_0xc986('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1782=['./voiceContext.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1d4506,_0x12893c){var _0x5879aa=function(_0x151d31){while(--_0x151d31){_0x1d4506['push'](_0x1d4506['shift']());}};_0x5879aa(++_0x12893c);}(_0x1782,0x1ce));var _0x2178=function(_0x5fc0a5,_0x18d70b){_0x5fc0a5=_0x5fc0a5-0x0;var _0x475d47=_0x1782[_0x5fc0a5];return _0x475d47;};'use strict';var multer=require('multer');var util=require(_0x2178('0x0'));var path=require('path');var timeout=require(_0x2178('0x1'));var express=require(_0x2178('0x2'));var router=express[_0x2178('0x3')]();var fs_extra=require(_0x2178('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2178('0x5'));var controller=require(_0x2178('0x6'));router[_0x2178('0x7')]('/',auth['isAuthenticated'](),controller[_0x2178('0x8')]);router[_0x2178('0x7')]('/:id',auth[_0x2178('0x9')](),controller[_0x2178('0xa')]);router[_0x2178('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2178('0xc')](_0x2178('0xd'),auth[_0x2178('0x9')](),controller[_0x2178('0xe')]);router[_0x2178('0xf')](_0x2178('0xd'),auth[_0x2178('0x9')](),controller[_0x2178('0x10')]);module[_0x2178('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6ca21b2..790ee4a 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 _0x84c2=['STRING','name','BOOLEAN','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x84c2,0x13b));var _0x284c=function(_0x4dcf98,_0x5b7213){_0x4dcf98=_0x4dcf98-0x0;var _0x563455=_0x84c2[_0x4dcf98];return _0x563455;};'use strict';var Sequelize=require(_0x284c('0x0'));module['exports']={'name':{'type':Sequelize[_0x284c('0x1')],'unique':_0x284c('0x2')},'description':{'type':Sequelize[_0x284c('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x284c('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbdc5=['name','BOOLEAN','exports'];(function(_0x2006e8,_0x16e3f6){var _0x5135da=function(_0x4f4712){while(--_0x4f4712){_0x2006e8['push'](_0x2006e8['shift']());}};_0x5135da(++_0x16e3f6);}(_0xbdc5,0xe0));var _0x5bdc=function(_0x36c8f9,_0x5976d0){_0x36c8f9=_0x36c8f9-0x0;var _0x104b91=_0xbdc5[_0x36c8f9];return _0x104b91;};'use strict';var Sequelize=require('sequelize');module[_0x5bdc('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5bdc('0x1')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5bdc('0x2')],'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 c6af1a2..27baaef 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 _0x3b26=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','includeAll','include','find','create','readFileSync','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','chan_sip.so','render','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','then','get','Contexts','UserProfileResource','sendStatus','stack','name','index','map','VoiceContext','rawAttributes'];(function(_0x141749,_0x477b04){var _0x3e6932=function(_0x47b3f2){while(--_0x47b3f2){_0x141749['push'](_0x141749['shift']());}};_0x3e6932(++_0x477b04);}(_0x3b26,0xfe));var _0x63b2=function(_0xd15b27,_0x2d1e19){_0xd15b27=_0xd15b27-0x0;var _0x1be546=_0x3b26[_0xd15b27];return _0x1be546;};'use strict';var emlformat=require(_0x63b2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x63b2('0x1'));var jsonpatch=require(_0x63b2('0x2'));var rp=require(_0x63b2('0x3'));var moment=require(_0x63b2('0x4'));var BPromise=require(_0x63b2('0x5'));var Mustache=require(_0x63b2('0x6'));var util=require(_0x63b2('0x7'));var path=require(_0x63b2('0x8'));var sox=require('sox');var csv=require(_0x63b2('0x9'));var ejs=require(_0x63b2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63b2('0xb'));var squel=require('squel');var crypto=require(_0x63b2('0xc'));var jsforce=require(_0x63b2('0xd'));var deskjs=require(_0x63b2('0xe'));var toCsv=require(_0x63b2('0x9'));var querystring=require(_0x63b2('0xf'));var Papa=require(_0x63b2('0x10'));var Redis=require(_0x63b2('0x11'));var authService=require(_0x63b2('0x12'));var qs=require(_0x63b2('0x13'));var as=require(_0x63b2('0x14'));var hardwareService=require(_0x63b2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x63b2('0x16'));var config=require(_0x63b2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x63b2('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x63b2('0x19')][_0x63b2('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1492ee,_0x10f92c,_0x21f0d8,_0x2909b0){return new BPromise(function(_0x2bba11,_0x503f4f){var _0x178335=_0x2909b0||client;return _0x178335['request'](_0x1492ee,_0x21f0d8)['then'](function(_0xb8afbc){logger[_0x63b2('0x1b')](_0x63b2('0x1c'),_0x10f92c,_0x63b2('0x1d'));logger[_0x63b2('0x1e')](_0x63b2('0x1f'),_0x10f92c,_0x63b2('0x1d'),JSON[_0x63b2('0x20')](_0xb8afbc));if(_0xb8afbc[_0x63b2('0x21')]){if(_0xb8afbc[_0x63b2('0x21')][_0x63b2('0x22')]===0x1f4){logger['error'](_0x63b2('0x1c'),_0x10f92c,_0xb8afbc[_0x63b2('0x21')][_0x63b2('0x23')]);return _0x503f4f(_0xb8afbc['error'][_0x63b2('0x23')]);}logger[_0x63b2('0x21')]('VoiceContext,\x20%s,\x20%s',_0x10f92c,_0xb8afbc['error'][_0x63b2('0x23')]);return _0x2bba11(_0xb8afbc[_0x63b2('0x21')][_0x63b2('0x23')]);}else{logger[_0x63b2('0x1b')](_0x63b2('0x1c'),_0x10f92c,_0x63b2('0x1d'));_0x2bba11(_0xb8afbc[_0x63b2('0x24')][_0x63b2('0x23')]);}})[_0x63b2('0x25')](function(_0xf5866c){logger[_0x63b2('0x21')](_0x63b2('0x1c'),_0x10f92c,_0xf5866c);_0x503f4f(_0xf5866c);});});}function respondWithStatusCode(_0x1b98a6,_0x3339ee){_0x3339ee=_0x3339ee||0xcc;return function(_0x236684){if(_0x236684){return _0x1b98a6['sendStatus'](_0x3339ee);}return _0x1b98a6[_0x63b2('0x26')](_0x3339ee)[_0x63b2('0x27')]();};}function respondWithResult(_0x22f699,_0xa7b2ec){_0xa7b2ec=_0xa7b2ec||0xc8;return function(_0x8a614e){if(_0x8a614e){return _0x22f699['status'](_0xa7b2ec)[_0x63b2('0x28')](_0x8a614e);}};}function respondWithFilteredResult(_0x38fd69,_0x4cf087){return function(_0x5b78f0){if(_0x5b78f0){var _0x1f7215=typeof _0x4cf087[_0x63b2('0x29')]==='undefined'&&typeof _0x4cf087[_0x63b2('0x2a')]===_0x63b2('0x2b');var _0x42d6be=_0x5b78f0['count'];var _0x2b7f08=_0x1f7215?0x0:_0x4cf087['offset'];var _0x1511b6=_0x1f7215?_0x5b78f0[_0x63b2('0x2c')]:_0x4cf087['offset']+_0x4cf087['limit'];var _0x57d813;if(_0x1511b6>=_0x42d6be){_0x1511b6=_0x42d6be;_0x57d813=0xc8;}else{_0x57d813=0xce;}_0x38fd69['status'](_0x57d813);return _0x38fd69[_0x63b2('0x2d')]('Content-Range',_0x2b7f08+'-'+_0x1511b6+'/'+_0x42d6be)[_0x63b2('0x28')](_0x5b78f0);}return null;};}function patchUpdates(_0x292042){return function(_0x1d4460){try{jsonpatch['apply'](_0x1d4460,_0x292042,!![]);}catch(_0x22dcb8){return BPromise[_0x63b2('0x2e')](_0x22dcb8);}return _0x1d4460[_0x63b2('0x2f')]();};}function saveUpdates(_0x141c84,_0x4e1e9d){return function(_0x472db1){if(_0x472db1){return _0x472db1[_0x63b2('0x30')](_0x141c84)['then'](function(_0x454b40){return _0x454b40;});}return null;};}function removeEntity(_0x500ea7,_0x61ef53){return function(_0x2a7cec){if(_0x2a7cec){return _0x2a7cec[_0x63b2('0x31')]()[_0x63b2('0x32')](function(){var _0x14fb3c=_0x2a7cec[_0x63b2('0x33')]({'plain':!![]});var _0x50fe30=_0x63b2('0x34');return db[_0x63b2('0x35')]['destroy']({'where':{'type':_0x50fe30,'resourceId':_0x14fb3c['id']}})['then'](function(){return _0x2a7cec;});})[_0x63b2('0x32')](function(){_0x500ea7[_0x63b2('0x26')](0xcc)[_0x63b2('0x27')]();});}};}function handleEntityNotFound(_0x561ad6,_0x1bd613){return function(_0x4990d3){if(!_0x4990d3){_0x561ad6[_0x63b2('0x36')](0x194);}return _0x4990d3;};}function handleError(_0x6bf7d9,_0x3c2931){_0x3c2931=_0x3c2931||0x1f4;return function(_0x3821fb){logger[_0x63b2('0x21')](_0x3821fb[_0x63b2('0x37')]);if(_0x3821fb[_0x63b2('0x38')]){delete _0x3821fb[_0x63b2('0x38')];}_0x6bf7d9[_0x63b2('0x26')](_0x3c2931)['send'](_0x3821fb);};}exports[_0x63b2('0x39')]=function(_0x5e1268,_0x34177b){var _0x1be275={},_0x258b9b={},_0x17e5cb={'count':0x0,'rows':[]};var _0x5afffb=_[_0x63b2('0x3a')](db[_0x63b2('0x3b')][_0x63b2('0x3c')],function(_0x3e03a0){return{'name':_0x3e03a0[_0x63b2('0x3d')],'type':_0x3e03a0[_0x63b2('0x3e')][_0x63b2('0x3f')]};});_0x258b9b[_0x63b2('0x40')]=_['map'](_0x5afffb,'name');_0x258b9b[_0x63b2('0x41')]=_[_0x63b2('0x42')](_0x5e1268[_0x63b2('0x41')]);_0x258b9b['filters']=_[_0x63b2('0x43')](_0x258b9b[_0x63b2('0x40')],_0x258b9b[_0x63b2('0x41')]);_0x1be275[_0x63b2('0x44')]=_[_0x63b2('0x43')](_0x258b9b[_0x63b2('0x40')],qs[_0x63b2('0x45')](_0x5e1268['query'][_0x63b2('0x45')]));_0x1be275[_0x63b2('0x44')]=_0x1be275[_0x63b2('0x44')][_0x63b2('0x46')]?_0x1be275[_0x63b2('0x44')]:_0x258b9b[_0x63b2('0x40')];if(!_0x5e1268[_0x63b2('0x41')][_0x63b2('0x47')](_0x63b2('0x48'))){_0x1be275[_0x63b2('0x2a')]=qs[_0x63b2('0x2a')](_0x5e1268[_0x63b2('0x41')][_0x63b2('0x2a')]);_0x1be275[_0x63b2('0x29')]=qs[_0x63b2('0x29')](_0x5e1268['query'][_0x63b2('0x29')]);}_0x1be275[_0x63b2('0x49')]=qs[_0x63b2('0x4a')](_0x5e1268[_0x63b2('0x41')]['sort']);_0x1be275[_0x63b2('0x4b')]=qs[_0x63b2('0x4c')](_[_0x63b2('0x4d')](_0x5e1268[_0x63b2('0x41')],_0x258b9b[_0x63b2('0x4c')]),_0x5afffb);if(_0x5e1268[_0x63b2('0x41')][_0x63b2('0x4e')]){_0x1be275['where']=_[_0x63b2('0x4f')](_0x1be275[_0x63b2('0x4b')],{'$or':_[_0x63b2('0x3a')](_0x5afffb,function(_0x5f545f){if(_0x5f545f[_0x63b2('0x3e')]!==_0x63b2('0x50')){var _0x21daa2={};_0x21daa2[_0x5f545f[_0x63b2('0x38')]]={'$like':'%'+_0x5e1268[_0x63b2('0x41')][_0x63b2('0x4e')]+'%'};return _0x21daa2;}})});}_0x1be275=_[_0x63b2('0x4f')]({},_0x1be275,_0x5e1268[_0x63b2('0x51')]);var _0x107e8e={'where':_0x1be275[_0x63b2('0x4b')]};return db['VoiceContext']['count'](_0x107e8e)['then'](function(_0x28bf1e){_0x17e5cb[_0x63b2('0x2c')]=_0x28bf1e;if(_0x5e1268[_0x63b2('0x41')]['includeAll']){_0x1be275['include']=[{'all':!![]}];}return db[_0x63b2('0x3b')][_0x63b2('0x52')](_0x1be275);})['then'](function(_0xbaeb65){_0x17e5cb[_0x63b2('0x53')]=_0xbaeb65;return _0x17e5cb;})[_0x63b2('0x32')](respondWithFilteredResult(_0x34177b,_0x1be275))[_0x63b2('0x25')](handleError(_0x34177b,null));};exports[_0x63b2('0x54')]=function(_0x4f090c,_0x360977){var _0x39914d={'raw':![],'where':{'id':_0x4f090c['params']['id']}},_0x10b858={};_0x10b858[_0x63b2('0x40')]=_[_0x63b2('0x42')](db['VoiceContext'][_0x63b2('0x3c')]);_0x10b858[_0x63b2('0x41')]=_[_0x63b2('0x42')](_0x4f090c[_0x63b2('0x41')]);_0x10b858[_0x63b2('0x4c')]=_['intersection'](_0x10b858[_0x63b2('0x40')],_0x10b858[_0x63b2('0x41')]);_0x39914d['attributes']=_[_0x63b2('0x43')](_0x10b858[_0x63b2('0x40')],qs[_0x63b2('0x45')](_0x4f090c['query'][_0x63b2('0x45')]));_0x39914d['attributes']=_0x39914d[_0x63b2('0x44')][_0x63b2('0x46')]?_0x39914d[_0x63b2('0x44')]:_0x10b858[_0x63b2('0x40')];if(_0x4f090c[_0x63b2('0x41')][_0x63b2('0x55')]){_0x39914d[_0x63b2('0x56')]=[{'all':!![]}];}_0x39914d=_[_0x63b2('0x4f')]({},_0x39914d,_0x4f090c['options']);return db[_0x63b2('0x3b')][_0x63b2('0x57')](_0x39914d)[_0x63b2('0x32')](handleEntityNotFound(_0x360977,null))[_0x63b2('0x32')](respondWithResult(_0x360977,null))[_0x63b2('0x25')](handleError(_0x360977,null));};exports[_0x63b2('0x58')]=function(_0x29ea6c,_0x4370e3,_0x8f3c90){var _0xafd475;return db[_0x63b2('0x3b')][_0x63b2('0x58')](_0x29ea6c['body'],{'raw':!![]})[_0x63b2('0x32')](function(_0x44901b){_0xafd475=_0x44901b;return db[_0x63b2('0x3b')]['findAll']({'raw':!![]});})[_0x63b2('0x32')](function(_0x531e58){var _0x3b4d49=fs[_0x63b2('0x59')](path[_0x63b2('0x5a')](config[_0x63b2('0x5b')],'server/files/templates/context.ejs'),_0x63b2('0x5c'));var _0x1077cd=ejs['render'](_0x3b4d49,{'contexts':_0x531e58||[]});fs[_0x63b2('0x5d')](_0x63b2('0x5e'),_0x1077cd);})[_0x63b2('0x32')](function(){return respondWithRpcPromise(_0x63b2('0x5f'),_0x63b2('0x58'),{'module':'chan_sip.so'});})[_0x63b2('0x32')](function(){var _0x5d40a4=_0x29ea6c[_0x63b2('0x60')][_0x63b2('0x33')]({'plain':!![]});if(!_0x5d40a4)throw new Error(_0x63b2('0x61'));if(_0x5d40a4[_0x63b2('0x62')]==='user'){var _0x237705=_0xafd475[_0x63b2('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x63b2('0x57')]({'where':{'name':_0x63b2('0x34'),'userProfileId':_0x5d40a4['userProfileId']},'raw':!![]})['then'](function(_0xc13aa3){if(_0xc13aa3&&_0xc13aa3[_0x63b2('0x63')]===0x0){return db[_0x63b2('0x35')][_0x63b2('0x58')]({'name':_0x237705[_0x63b2('0x38')],'resourceId':_0x237705['id'],'type':_0xc13aa3['name'],'sectionId':_0xc13aa3['id']},{})[_0x63b2('0x32')](function(){return _0xafd475;});}else{return _0xafd475;}})[_0x63b2('0x25')](function(_0x44c03a){logger[_0x63b2('0x21')](_0x63b2('0x64'),_0x44c03a);throw _0x44c03a;});}return _0xafd475;})[_0x63b2('0x32')](respondWithResult(_0x4370e3,0xc9))[_0x63b2('0x25')](handleError(_0x4370e3,null));};exports[_0x63b2('0x30')]=function(_0x37f15d,_0x39cfa1,_0x4c6efa){var _0x48dcb3;return db[_0x63b2('0x3b')][_0x63b2('0x57')]({'where':{'id':_0x37f15d[_0x63b2('0x65')]['id']}})['then'](handleEntityNotFound(_0x39cfa1,null))[_0x63b2('0x32')](saveUpdates(_0x37f15d['body'],null))[_0x63b2('0x32')](function(_0x4e7305){if(_0x4e7305){_0x48dcb3=_0x4e7305;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0x63b2('0x32')](function(_0x2ed068){var _0x20c3b9=fs[_0x63b2('0x59')](path[_0x63b2('0x5a')](config['root'],_0x63b2('0x66')),_0x63b2('0x5c'));var _0x52069c=ejs['render'](_0x20c3b9,{'contexts':_0x2ed068||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x52069c);})[_0x63b2('0x32')](function(){return respondWithRpcPromise('Reload',_0x63b2('0x30'),{'module':_0x63b2('0x67')});})[_0x63b2('0x32')](function(){return _0x48dcb3;})[_0x63b2('0x32')](respondWithResult(_0x39cfa1,null))[_0x63b2('0x25')](handleError(_0x39cfa1,null));};exports['destroy']=function(_0x5980f6,_0x4633f1,_0x211596){var _0x2bc296;return db['VoiceContext'][_0x63b2('0x57')]({'where':{'id':_0x5980f6[_0x63b2('0x65')]['id']}})[_0x63b2('0x32')](handleEntityNotFound(_0x4633f1,null))[_0x63b2('0x32')](removeEntity(_0x4633f1,null))[_0x63b2('0x32')](function(){return db[_0x63b2('0x3b')][_0x63b2('0x52')]({'raw':!![]});})[_0x63b2('0x32')](function(_0x159869){var _0x2a2574=fs[_0x63b2('0x59')](path[_0x63b2('0x5a')](config['root'],_0x63b2('0x66')),'utf8');var _0x2f59af=ejs[_0x63b2('0x68')](_0x2a2574,{'contexts':_0x159869});fs[_0x63b2('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2f59af);return respondWithRpcPromise(_0x63b2('0x5f'),_0x63b2('0x31'),{'module':_0x63b2('0x67')});})[_0x63b2('0x25')](handleError(_0x4633f1,null));}; \ No newline at end of file +var _0x3ca4=['rawAttributes','intersection','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','fieldName','type','key','query','keys','filters','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params'];(function(_0xe57cd6,_0x4a0767){var _0x1264e4=function(_0x2ad15c){while(--_0x2ad15c){_0xe57cd6['push'](_0xe57cd6['shift']());}};_0x1264e4(++_0x4a0767);}(_0x3ca4,0x86));var _0x43ca=function(_0x3a4e0e,_0x3ec224){_0x3a4e0e=_0x3a4e0e-0x0;var _0x53997b=_0x3ca4[_0x3a4e0e];return _0x53997b;};'use strict';var emlformat=require(_0x43ca('0x0'));var rimraf=require(_0x43ca('0x1'));var zipdir=require(_0x43ca('0x2'));var jsonpatch=require(_0x43ca('0x3'));var rp=require(_0x43ca('0x4'));var moment=require(_0x43ca('0x5'));var BPromise=require(_0x43ca('0x6'));var Mustache=require(_0x43ca('0x7'));var util=require(_0x43ca('0x8'));var path=require(_0x43ca('0x9'));var sox=require('sox');var csv=require(_0x43ca('0xa'));var ejs=require(_0x43ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43ca('0xc'));var squel=require(_0x43ca('0xd'));var crypto=require(_0x43ca('0xe'));var jsforce=require(_0x43ca('0xf'));var deskjs=require(_0x43ca('0x10'));var toCsv=require(_0x43ca('0xa'));var querystring=require(_0x43ca('0x11'));var Papa=require(_0x43ca('0x12'));var Redis=require('ioredis');var authService=require(_0x43ca('0x13'));var qs=require(_0x43ca('0x14'));var as=require(_0x43ca('0x15'));var hardwareService=require(_0x43ca('0x16'));var logger=require('../../config/logger')(_0x43ca('0x17'));var utils=require(_0x43ca('0x18'));var config=require(_0x43ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x43ca('0x1a'));var client=jayson[_0x43ca('0x1b')][_0x43ca('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5ac606,_0x37c51a,_0x572906,_0x1c5a29){return new BPromise(function(_0x34db6c,_0x53d77d){var _0x8cebd5=_0x1c5a29||client;return _0x8cebd5[_0x43ca('0x1d')](_0x5ac606,_0x572906)[_0x43ca('0x1e')](function(_0x346788){logger[_0x43ca('0x1f')](_0x43ca('0x20'),_0x37c51a,'request\x20sent');logger[_0x43ca('0x21')](_0x43ca('0x22'),_0x37c51a,'request\x20sent',JSON[_0x43ca('0x23')](_0x346788));if(_0x346788[_0x43ca('0x24')]){if(_0x346788['error'][_0x43ca('0x25')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x37c51a,_0x346788[_0x43ca('0x24')][_0x43ca('0x26')]);return _0x53d77d(_0x346788[_0x43ca('0x24')][_0x43ca('0x26')]);}logger[_0x43ca('0x24')](_0x43ca('0x20'),_0x37c51a,_0x346788[_0x43ca('0x24')][_0x43ca('0x26')]);return _0x34db6c(_0x346788[_0x43ca('0x24')][_0x43ca('0x26')]);}else{logger[_0x43ca('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x37c51a,_0x43ca('0x27'));_0x34db6c(_0x346788[_0x43ca('0x28')][_0x43ca('0x26')]);}})[_0x43ca('0x29')](function(_0x31de01){logger[_0x43ca('0x24')]('VoiceContext,\x20%s,\x20%s',_0x37c51a,_0x31de01);_0x53d77d(_0x31de01);});});}function respondWithStatusCode(_0x346e32,_0x3a83c5){_0x3a83c5=_0x3a83c5||0xcc;return function(_0x48b905){if(_0x48b905){return _0x346e32['sendStatus'](_0x3a83c5);}return _0x346e32[_0x43ca('0x2a')](_0x3a83c5)[_0x43ca('0x2b')]();};}function respondWithResult(_0x5bebb8,_0x1f2b39){_0x1f2b39=_0x1f2b39||0xc8;return function(_0x47ecae){if(_0x47ecae){return _0x5bebb8[_0x43ca('0x2a')](_0x1f2b39)[_0x43ca('0x2c')](_0x47ecae);}};}function respondWithFilteredResult(_0x27fa55,_0x8a0883){return function(_0x3d4dd9){if(_0x3d4dd9){var _0x4d4aa9=typeof _0x8a0883[_0x43ca('0x2d')]===_0x43ca('0x2e')&&typeof _0x8a0883[_0x43ca('0x2f')]===_0x43ca('0x2e');var _0x289731=_0x3d4dd9['count'];var _0xf6f4df=_0x4d4aa9?0x0:_0x8a0883[_0x43ca('0x2d')];var _0x10a7a8=_0x4d4aa9?_0x3d4dd9[_0x43ca('0x30')]:_0x8a0883[_0x43ca('0x2d')]+_0x8a0883[_0x43ca('0x2f')];var _0x466287;if(_0x10a7a8>=_0x289731){_0x10a7a8=_0x289731;_0x466287=0xc8;}else{_0x466287=0xce;}_0x27fa55['status'](_0x466287);return _0x27fa55[_0x43ca('0x31')]('Content-Range',_0xf6f4df+'-'+_0x10a7a8+'/'+_0x289731)[_0x43ca('0x2c')](_0x3d4dd9);}return null;};}function patchUpdates(_0x499444){return function(_0x2b86d5){try{jsonpatch[_0x43ca('0x32')](_0x2b86d5,_0x499444,!![]);}catch(_0x1784a9){return BPromise[_0x43ca('0x33')](_0x1784a9);}return _0x2b86d5[_0x43ca('0x34')]();};}function saveUpdates(_0x9048ec,_0x4664f0){return function(_0x535fcd){if(_0x535fcd){return _0x535fcd[_0x43ca('0x35')](_0x9048ec)[_0x43ca('0x1e')](function(_0x16a719){return _0x16a719;});}return null;};}function removeEntity(_0x155360,_0x1afa83){return function(_0x48535d){if(_0x48535d){return _0x48535d[_0x43ca('0x36')]()[_0x43ca('0x1e')](function(){var _0x12a091=_0x48535d['get']({'plain':!![]});var _0x11b2d8=_0x43ca('0x37');return db[_0x43ca('0x38')][_0x43ca('0x36')]({'where':{'type':_0x11b2d8,'resourceId':_0x12a091['id']}})['then'](function(){return _0x48535d;});})[_0x43ca('0x1e')](function(){_0x155360['status'](0xcc)[_0x43ca('0x2b')]();});}};}function handleEntityNotFound(_0x5186d4,_0x5520fe){return function(_0x5679c3){if(!_0x5679c3){_0x5186d4[_0x43ca('0x39')](0x194);}return _0x5679c3;};}function handleError(_0x4de703,_0x3d56e5){_0x3d56e5=_0x3d56e5||0x1f4;return function(_0x45fe7a){logger['error'](_0x45fe7a[_0x43ca('0x3a')]);if(_0x45fe7a[_0x43ca('0x3b')]){delete _0x45fe7a[_0x43ca('0x3b')];}_0x4de703[_0x43ca('0x2a')](_0x3d56e5)[_0x43ca('0x3c')](_0x45fe7a);};}exports[_0x43ca('0x3d')]=function(_0x4fc52f,_0x44e056){var _0x4a3063={},_0x4db432={},_0x4d2744={'count':0x0,'rows':[]};var _0x46437a=_[_0x43ca('0x3e')](db[_0x43ca('0x3f')]['rawAttributes'],function(_0x58f4bc){return{'name':_0x58f4bc[_0x43ca('0x40')],'type':_0x58f4bc[_0x43ca('0x41')][_0x43ca('0x42')]};});_0x4db432['model']=_['map'](_0x46437a,'name');_0x4db432[_0x43ca('0x43')]=_[_0x43ca('0x44')](_0x4fc52f[_0x43ca('0x43')]);_0x4db432[_0x43ca('0x45')]=_['intersection'](_0x4db432[_0x43ca('0x46')],_0x4db432['query']);_0x4a3063[_0x43ca('0x47')]=_['intersection'](_0x4db432['model'],qs['fields'](_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x48')]));_0x4a3063[_0x43ca('0x47')]=_0x4a3063[_0x43ca('0x47')]['length']?_0x4a3063[_0x43ca('0x47')]:_0x4db432['model'];if(!_0x4fc52f['query']['hasOwnProperty'](_0x43ca('0x49'))){_0x4a3063[_0x43ca('0x2f')]=qs[_0x43ca('0x2f')](_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x2f')]);_0x4a3063[_0x43ca('0x2d')]=qs[_0x43ca('0x2d')](_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x2d')]);}_0x4a3063[_0x43ca('0x4a')]=qs[_0x43ca('0x4b')](_0x4fc52f[_0x43ca('0x43')]['sort']);_0x4a3063[_0x43ca('0x4c')]=qs[_0x43ca('0x45')](_[_0x43ca('0x4d')](_0x4fc52f[_0x43ca('0x43')],_0x4db432[_0x43ca('0x45')]),_0x46437a);if(_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x4e')]){_0x4a3063['where']=_[_0x43ca('0x4f')](_0x4a3063['where'],{'$or':_['map'](_0x46437a,function(_0x1a7ecb){if(_0x1a7ecb[_0x43ca('0x41')]!==_0x43ca('0x50')){var _0x175d83={};_0x175d83[_0x1a7ecb[_0x43ca('0x3b')]]={'$like':'%'+_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x4e')]+'%'};return _0x175d83;}})});}_0x4a3063=_['merge']({},_0x4a3063,_0x4fc52f[_0x43ca('0x51')]);var _0x3335d6={'where':_0x4a3063[_0x43ca('0x4c')]};return db['VoiceContext'][_0x43ca('0x30')](_0x3335d6)['then'](function(_0x11294d){_0x4d2744[_0x43ca('0x30')]=_0x11294d;if(_0x4fc52f[_0x43ca('0x43')][_0x43ca('0x52')]){_0x4a3063[_0x43ca('0x53')]=[{'all':!![]}];}return db[_0x43ca('0x3f')][_0x43ca('0x54')](_0x4a3063);})[_0x43ca('0x1e')](function(_0x1f3cd3){_0x4d2744[_0x43ca('0x55')]=_0x1f3cd3;return _0x4d2744;})['then'](respondWithFilteredResult(_0x44e056,_0x4a3063))[_0x43ca('0x29')](handleError(_0x44e056,null));};exports[_0x43ca('0x56')]=function(_0x1e9531,_0x38ad42){var _0x506f7c={'raw':![],'where':{'id':_0x1e9531[_0x43ca('0x57')]['id']}},_0x4dba1a={};_0x4dba1a['model']=_[_0x43ca('0x44')](db[_0x43ca('0x3f')][_0x43ca('0x58')]);_0x4dba1a['query']=_[_0x43ca('0x44')](_0x1e9531['query']);_0x4dba1a[_0x43ca('0x45')]=_[_0x43ca('0x59')](_0x4dba1a[_0x43ca('0x46')],_0x4dba1a[_0x43ca('0x43')]);_0x506f7c[_0x43ca('0x47')]=_[_0x43ca('0x59')](_0x4dba1a['model'],qs[_0x43ca('0x48')](_0x1e9531[_0x43ca('0x43')][_0x43ca('0x48')]));_0x506f7c[_0x43ca('0x47')]=_0x506f7c[_0x43ca('0x47')]['length']?_0x506f7c[_0x43ca('0x47')]:_0x4dba1a['model'];if(_0x1e9531[_0x43ca('0x43')]['includeAll']){_0x506f7c[_0x43ca('0x53')]=[{'all':!![]}];}_0x506f7c=_[_0x43ca('0x4f')]({},_0x506f7c,_0x1e9531[_0x43ca('0x51')]);return db['VoiceContext'][_0x43ca('0x5a')](_0x506f7c)[_0x43ca('0x1e')](handleEntityNotFound(_0x38ad42,null))['then'](respondWithResult(_0x38ad42,null))[_0x43ca('0x29')](handleError(_0x38ad42,null));};exports['create']=function(_0x3a5ea0,_0xd63d48,_0x344ceb){var _0x3cba8d;return db[_0x43ca('0x3f')][_0x43ca('0x5b')](_0x3a5ea0[_0x43ca('0x5c')],{'raw':!![]})['then'](function(_0x25b5c8){_0x3cba8d=_0x25b5c8;return db[_0x43ca('0x3f')][_0x43ca('0x54')]({'raw':!![]});})[_0x43ca('0x1e')](function(_0x2ec811){var _0xbce19c=fs[_0x43ca('0x5d')](path[_0x43ca('0x5e')](config[_0x43ca('0x5f')],_0x43ca('0x60')),_0x43ca('0x61'));var _0x4e6752=ejs[_0x43ca('0x62')](_0xbce19c,{'contexts':_0x2ec811||[]});fs[_0x43ca('0x63')](_0x43ca('0x64'),_0x4e6752);})[_0x43ca('0x1e')](function(){return respondWithRpcPromise('Reload',_0x43ca('0x5b'),{'module':'chan_sip.so'});})[_0x43ca('0x1e')](function(){var _0xf1ff33=_0x3a5ea0[_0x43ca('0x65')][_0x43ca('0x66')]({'plain':!![]});if(!_0xf1ff33)throw new Error(_0x43ca('0x67'));if(_0xf1ff33[_0x43ca('0x68')]===_0x43ca('0x65')){var _0xef6a60=_0x3cba8d[_0x43ca('0x66')]({'plain':!![]});return db[_0x43ca('0x69')][_0x43ca('0x5a')]({'where':{'name':_0x43ca('0x37'),'userProfileId':_0xf1ff33[_0x43ca('0x6a')]},'raw':!![]})[_0x43ca('0x1e')](function(_0x3bdcc5){if(_0x3bdcc5&&_0x3bdcc5[_0x43ca('0x6b')]===0x0){return db[_0x43ca('0x38')][_0x43ca('0x5b')]({'name':_0xef6a60[_0x43ca('0x3b')],'resourceId':_0xef6a60['id'],'type':_0x3bdcc5[_0x43ca('0x3b')],'sectionId':_0x3bdcc5['id']},{})[_0x43ca('0x1e')](function(){return _0x3cba8d;});}else{return _0x3cba8d;}})['catch'](function(_0x136e50){logger[_0x43ca('0x24')](_0x43ca('0x6c'),_0x136e50);throw _0x136e50;});}return _0x3cba8d;})[_0x43ca('0x1e')](respondWithResult(_0xd63d48,0xc9))[_0x43ca('0x29')](handleError(_0xd63d48,null));};exports[_0x43ca('0x35')]=function(_0x223dff,_0x4611d4,_0x4a73f5){var _0x55bea4;return db['VoiceContext'][_0x43ca('0x5a')]({'where':{'id':_0x223dff[_0x43ca('0x57')]['id']}})[_0x43ca('0x1e')](handleEntityNotFound(_0x4611d4,null))['then'](saveUpdates(_0x223dff[_0x43ca('0x5c')],null))[_0x43ca('0x1e')](function(_0x36c5e6){if(_0x36c5e6){_0x55bea4=_0x36c5e6;return db[_0x43ca('0x3f')][_0x43ca('0x54')]({'raw':!![]});}})['then'](function(_0x2665a5){var _0x3077cf=fs[_0x43ca('0x5d')](path[_0x43ca('0x5e')](config[_0x43ca('0x5f')],_0x43ca('0x60')),_0x43ca('0x61'));var _0x548ac7=ejs[_0x43ca('0x62')](_0x3077cf,{'contexts':_0x2665a5||[]});fs[_0x43ca('0x63')](_0x43ca('0x64'),_0x548ac7);})[_0x43ca('0x1e')](function(){return respondWithRpcPromise('Reload',_0x43ca('0x35'),{'module':'chan_sip.so'});})[_0x43ca('0x1e')](function(){return _0x55bea4;})['then'](respondWithResult(_0x4611d4,null))['catch'](handleError(_0x4611d4,null));};exports[_0x43ca('0x36')]=function(_0x3f6cd0,_0x17c1de,_0x117c70){var _0x513afc;return db[_0x43ca('0x3f')][_0x43ca('0x5a')]({'where':{'id':_0x3f6cd0[_0x43ca('0x57')]['id']}})[_0x43ca('0x1e')](handleEntityNotFound(_0x17c1de,null))[_0x43ca('0x1e')](removeEntity(_0x17c1de,null))[_0x43ca('0x1e')](function(){return db[_0x43ca('0x3f')][_0x43ca('0x54')]({'raw':!![]});})[_0x43ca('0x1e')](function(_0x526cdf){var _0x5db305=fs[_0x43ca('0x5d')](path[_0x43ca('0x5e')](config['root'],_0x43ca('0x60')),'utf8');var _0x22a0ef=ejs[_0x43ca('0x62')](_0x5db305,{'contexts':_0x526cdf});fs[_0x43ca('0x63')](_0x43ca('0x64'),_0x22a0ef);return respondWithRpcPromise(_0x43ca('0x6d'),'destroy',{'module':_0x43ca('0x6e')});})[_0x43ca('0x29')](handleError(_0x17c1de,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 76b185d..b289074 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 _0x63be=['request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext','voice_contexts','util','bluebird'];(function(_0x17be93,_0x559c51){var _0x3319b3=function(_0x3b72f9){while(--_0x3b72f9){_0x17be93['push'](_0x17be93['shift']());}};_0x3319b3(++_0x559c51);}(_0x63be,0x76));var _0xe63b=function(_0x466c8a,_0x3a275f){_0x466c8a=_0x466c8a-0x0;var _0x16dc84=_0x63be[_0x466c8a];return _0x16dc84;};'use strict';var _=require('lodash');var util=require(_0xe63b('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe63b('0x1'));var rp=require(_0xe63b('0x2'));var fs=require('fs');var path=require(_0xe63b('0x3'));var rimraf=require(_0xe63b('0x4'));var config=require(_0xe63b('0x5'));var attributes=require(_0xe63b('0x6'));module[_0xe63b('0x7')]=function(_0x187c0a,_0x3b1fdd){return _0x187c0a['define'](_0xe63b('0x8'),attributes,{'tableName':_0xe63b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54a8=['request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird'];(function(_0x31a7b5,_0x307d8a){var _0x3ed7c5=function(_0x5d16f9){while(--_0x5d16f9){_0x31a7b5['push'](_0x31a7b5['shift']());}};_0x3ed7c5(++_0x307d8a);}(_0x54a8,0x19b));var _0x854a=function(_0x4a39a6,_0x5eaa0d){_0x4a39a6=_0x4a39a6-0x0;var _0x1dee5a=_0x54a8[_0x4a39a6];return _0x1dee5a;};'use strict';var _=require(_0x854a('0x0'));var util=require(_0x854a('0x1'));var logger=require(_0x854a('0x2'))(_0x854a('0x3'));var moment=require('moment');var BPromise=require(_0x854a('0x4'));var rp=require(_0x854a('0x5'));var fs=require('fs');var path=require(_0x854a('0x6'));var rimraf=require(_0x854a('0x7'));var config=require('../../config/environment');var attributes=require(_0x854a('0x8'));module[_0x854a('0x9')]=function(_0x9cfdab,_0x4e5e26){return _0x9cfdab[_0x854a('0xa')](_0x854a('0xb'),attributes,{'tableName':_0x854a('0xc'),'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 6fe0557..df15dac 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 _0x13f6=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util'];(function(_0x32faa6,_0x231c1f){var _0x1526dd=function(_0x53627b){while(--_0x53627b){_0x32faa6['push'](_0x32faa6['shift']());}};_0x1526dd(++_0x231c1f);}(_0x13f6,0x124));var _0x613f=function(_0x3c9b8d,_0x435d7f){_0x3c9b8d=_0x3c9b8d-0x0;var _0x44314f=_0x13f6[_0x3c9b8d];return _0x44314f;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});} \ No newline at end of file +var _0x7033=['client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3250fc,_0x526af6){var _0x114ef8=function(_0x5cec61){while(--_0x5cec61){_0x3250fc['push'](_0x3250fc['shift']());}};_0x114ef8(++_0x526af6);}(_0x7033,0x19e));var _0x3703=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7033[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3703('0x0'));var util=require(_0x3703('0x1'));var moment=require(_0x3703('0x2'));var BPromise=require(_0x3703('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3703('0x4'));var db=require(_0x3703('0x5'))['db'];var utils=require(_0x3703('0x6'));var logger=require(_0x3703('0x7'))(_0x3703('0x8'));var config=require(_0x3703('0x9'));var jayson=require(_0x3703('0xa'));var client=jayson[_0x3703('0xb')][_0x3703('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3a377,_0x49f22c,_0x5df816){return new BPromise(function(_0x4ca371,_0x12c111){return client[_0x3703('0xd')](_0xb3a377,_0x5df816)[_0x3703('0xe')](function(_0x41ba6e){logger[_0x3703('0xf')]('VoiceContext,\x20%s,\x20%s',_0x49f22c,_0x3703('0x10'));logger[_0x3703('0x11')](_0x3703('0x12'),_0x49f22c,'request\x20sent',JSON['stringify'](_0x41ba6e));if(_0x41ba6e[_0x3703('0x13')]){if(_0x41ba6e['error'][_0x3703('0x14')]===0x1f4){logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')]['message']);return _0x12c111(_0x41ba6e['error'][_0x3703('0x16')]);}logger[_0x3703('0x13')](_0x3703('0x15'),_0x49f22c,_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);return _0x4ca371(_0x41ba6e[_0x3703('0x13')][_0x3703('0x16')]);}else{logger[_0x3703('0xf')](_0x3703('0x15'),_0x49f22c,_0x3703('0x10'));_0x4ca371(_0x41ba6e[_0x3703('0x17')][_0x3703('0x16')]);}})[_0x3703('0x18')](function(_0x407b4){logger['error'](_0x3703('0x15'),_0x49f22c,_0x407b4);_0x12c111(_0x407b4);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d7dc56c..74f3fda 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 _0xdf8f=['describe','/:id','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','get'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdf8f,0x1ca));var _0xfdf8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdf8f[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xfdf8('0x0'));var util=require(_0xfdf8('0x1'));var path=require('path');var timeout=require(_0xfdf8('0x2'));var express=require(_0xfdf8('0x3'));var router=express[_0xfdf8('0x4')]();var fs_extra=require(_0xfdf8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdf8('0x6'));var config=require('../../config/environment');var controller=require(_0xfdf8('0x7'));router['get']('/',auth[_0xfdf8('0x8')](),controller['index']);router[_0xfdf8('0x9')]('/describe',auth[_0xfdf8('0x8')](),controller[_0xfdf8('0xa')]);router[_0xfdf8('0x9')](_0xfdf8('0xb'),auth[_0xfdf8('0x8')](),controller['show']);router['post']('/',auth[_0xfdf8('0x8')](),controller[_0xfdf8('0xc')]);router[_0xfdf8('0xd')](_0xfdf8('0xb'),auth[_0xfdf8('0x8')](),controller[_0xfdf8('0xe')]);router[_0xfdf8('0xf')](_0xfdf8('0xb'),auth[_0xfdf8('0x8')](),controller[_0xfdf8('0x10')]);module[_0xfdf8('0x11')]=router; \ No newline at end of file +var _0x7a4f=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports'];(function(_0x336267,_0x1530c0){var _0x4064af=function(_0x1b9100){while(--_0x1b9100){_0x336267['push'](_0x336267['shift']());}};_0x4064af(++_0x1530c0);}(_0x7a4f,0x17a));var _0xf7a4=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x7a4f[_0x18baf4];return _0x278ed1;};'use strict';var multer=require('multer');var util=require(_0xf7a4('0x0'));var path=require(_0xf7a4('0x1'));var timeout=require('connect-timeout');var express=require(_0xf7a4('0x2'));var router=express[_0xf7a4('0x3')]();var fs_extra=require(_0xf7a4('0x4'));var auth=require(_0xf7a4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf7a4('0x6'));var controller=require('./voiceDialReport.controller');router[_0xf7a4('0x7')]('/',auth[_0xf7a4('0x8')](),controller['index']);router[_0xf7a4('0x7')](_0xf7a4('0x9'),auth[_0xf7a4('0x8')](),controller[_0xf7a4('0xa')]);router[_0xf7a4('0x7')](_0xf7a4('0xb'),auth[_0xf7a4('0x8')](),controller[_0xf7a4('0xc')]);router[_0xf7a4('0xd')]('/',auth[_0xf7a4('0x8')](),controller[_0xf7a4('0xe')]);router[_0xf7a4('0xf')]('/:id',auth[_0xf7a4('0x8')](),controller[_0xf7a4('0x10')]);router['delete'](_0xf7a4('0xb'),auth[_0xf7a4('0x8')](),controller['destroy']);module[_0xf7a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 21308da..eb645a6 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x3e74,0x175));var _0x43e7=function(_0x57a60c,_0x3a85b6){_0x57a60c=_0x57a60c-0x0;var _0x436407=_0x3e74[_0x57a60c];return _0x436407;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1c7a05,_0x40d460){var _0x14def9=function(_0x424fb5){while(--_0x424fb5){_0x1c7a05['push'](_0x1c7a05['shift']());}};_0x14def9(++_0x40d460);}(_0x9bde,0xe1));var _0xe9bd=function(_0x43d4e2,_0x3013d4){_0x43d4e2=_0x43d4e2-0x0;var _0x4ab220=_0x9bde[_0x43d4e2];return _0x4ab220;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e9093b1..bb999ed 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 _0x7898=['VIRTUAL','filter','merge','options','count','includeAll','findAll','catch','keys','fields','include','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','length','nolimit','sort','where'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x7898,0xe9));var _0x8789=function(_0x21a314,_0xbe022b){_0x21a314=_0x21a314-0x0;var _0x3eb9f6=_0x7898[_0x21a314];return _0x3eb9f6;};'use strict';var emlformat=require(_0x8789('0x0'));var rimraf=require(_0x8789('0x1'));var zipdir=require(_0x8789('0x2'));var jsonpatch=require(_0x8789('0x3'));var rp=require(_0x8789('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8789('0x5'));var util=require(_0x8789('0x6'));var path=require(_0x8789('0x7'));var sox=require(_0x8789('0x8'));var csv=require(_0x8789('0x9'));var ejs=require(_0x8789('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8789('0xb'));var squel=require(_0x8789('0xc'));var crypto=require(_0x8789('0xd'));var jsforce=require(_0x8789('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8789('0x9'));var querystring=require(_0x8789('0xf'));var Papa=require(_0x8789('0x10'));var Redis=require(_0x8789('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8789('0x12'));var as=require(_0x8789('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8789('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8789('0x15'))['db'];function respondWithStatusCode(_0x18c6f3,_0x4e97a2){_0x4e97a2=_0x4e97a2||0xcc;return function(_0x6dca){if(_0x6dca){return _0x18c6f3[_0x8789('0x16')](_0x4e97a2);}return _0x18c6f3[_0x8789('0x17')](_0x4e97a2)[_0x8789('0x18')]();};}function respondWithResult(_0x191081,_0x4fb8eb){_0x4fb8eb=_0x4fb8eb||0xc8;return function(_0x24b696){if(_0x24b696){return _0x191081['status'](_0x4fb8eb)[_0x8789('0x19')](_0x24b696);}};}function respondWithFilteredResult(_0x23e978,_0x5028b7){return function(_0x57e663){if(_0x57e663){var _0x5e8cbf=typeof _0x5028b7['offset']===_0x8789('0x1a')&&typeof _0x5028b7[_0x8789('0x1b')]==='undefined';var _0x530857=_0x57e663['count'];var _0x1ab44f=_0x5e8cbf?0x0:_0x5028b7['offset'];var _0x3d53c6=_0x5e8cbf?_0x57e663['count']:_0x5028b7[_0x8789('0x1c')]+_0x5028b7[_0x8789('0x1b')];var _0xa68f7a;if(_0x3d53c6>=_0x530857){_0x3d53c6=_0x530857;_0xa68f7a=0xc8;}else{_0xa68f7a=0xce;}_0x23e978[_0x8789('0x17')](_0xa68f7a);return _0x23e978[_0x8789('0x1d')](_0x8789('0x1e'),_0x1ab44f+'-'+_0x3d53c6+'/'+_0x530857)[_0x8789('0x19')](_0x57e663);}return null;};}function patchUpdates(_0x29ecd9){return function(_0xc09a8b){try{jsonpatch[_0x8789('0x1f')](_0xc09a8b,_0x29ecd9,!![]);}catch(_0x37ffdb){return BPromise[_0x8789('0x20')](_0x37ffdb);}return _0xc09a8b[_0x8789('0x21')]();};}function saveUpdates(_0x4dbff4,_0x3a9247){return function(_0x4fc1b0){if(_0x4fc1b0){return _0x4fc1b0['update'](_0x4dbff4)[_0x8789('0x22')](function(_0x148fa3){return _0x148fa3;});}return null;};}function removeEntity(_0x19c6c2,_0x55fb64){return function(_0x5a4404){if(_0x5a4404){return _0x5a4404[_0x8789('0x23')]()[_0x8789('0x22')](function(){_0x19c6c2[_0x8789('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d78ff,_0x589163){return function(_0x55ed57){if(!_0x55ed57){_0x2d78ff['sendStatus'](0x194);}return _0x55ed57;};}function handleError(_0x5e6c11,_0x33f615){_0x33f615=_0x33f615||0x1f4;return function(_0x3e2e31){logger['error'](_0x3e2e31[_0x8789('0x24')]);if(_0x3e2e31[_0x8789('0x25')]){delete _0x3e2e31[_0x8789('0x25')];}_0x5e6c11['status'](_0x33f615)[_0x8789('0x26')](_0x3e2e31);};}exports[_0x8789('0x27')]=function(_0x40296d,_0x4794e4){var _0x386658={},_0x5525ad={},_0xd0dbce={'count':0x0,'rows':[]};var _0x298cb5=_[_0x8789('0x28')](db[_0x8789('0x29')][_0x8789('0x2a')],function(_0x2d3c7a){return{'name':_0x2d3c7a[_0x8789('0x2b')],'type':_0x2d3c7a[_0x8789('0x2c')][_0x8789('0x2d')]};});_0x5525ad['model']=_['map'](_0x298cb5,'name');_0x5525ad['query']=_['keys'](_0x40296d[_0x8789('0x2e')]);_0x5525ad[_0x8789('0x2f')]=_['intersection'](_0x5525ad['model'],_0x5525ad[_0x8789('0x2e')]);_0x386658[_0x8789('0x30')]=_[_0x8789('0x31')](_0x5525ad[_0x8789('0x32')],qs['fields'](_0x40296d[_0x8789('0x2e')]['fields']));_0x386658[_0x8789('0x30')]=_0x386658[_0x8789('0x30')][_0x8789('0x33')]?_0x386658[_0x8789('0x30')]:_0x5525ad[_0x8789('0x32')];if(!_0x40296d[_0x8789('0x2e')]['hasOwnProperty'](_0x8789('0x34'))){_0x386658[_0x8789('0x1b')]=qs[_0x8789('0x1b')](_0x40296d[_0x8789('0x2e')][_0x8789('0x1b')]);_0x386658[_0x8789('0x1c')]=qs[_0x8789('0x1c')](_0x40296d[_0x8789('0x2e')][_0x8789('0x1c')]);}_0x386658['order']=qs[_0x8789('0x35')](_0x40296d[_0x8789('0x2e')]['sort']);_0x386658[_0x8789('0x36')]=qs[_0x8789('0x2f')](_['pick'](_0x40296d['query'],_0x5525ad['filters']),_0x298cb5);if(_0x40296d[_0x8789('0x2e')]['filter']){_0x386658['where']=_['merge'](_0x386658[_0x8789('0x36')],{'$or':_['map'](_0x298cb5,function(_0x5aa282){if(_0x5aa282['type']!==_0x8789('0x37')){var _0x38871={};_0x38871[_0x5aa282[_0x8789('0x25')]]={'$like':'%'+_0x40296d['query'][_0x8789('0x38')]+'%'};return _0x38871;}})});}_0x386658=_[_0x8789('0x39')]({},_0x386658,_0x40296d[_0x8789('0x3a')]);var _0x209324={'where':_0x386658[_0x8789('0x36')]};return db['VoiceDialReport'][_0x8789('0x3b')](_0x209324)[_0x8789('0x22')](function(_0x916ec9){_0xd0dbce[_0x8789('0x3b')]=_0x916ec9;if(_0x40296d[_0x8789('0x2e')][_0x8789('0x3c')]){_0x386658['include']=[{'all':!![]}];}return db[_0x8789('0x29')][_0x8789('0x3d')](_0x386658);})[_0x8789('0x22')](function(_0x5e771e){_0xd0dbce['rows']=_0x5e771e;return _0xd0dbce;})[_0x8789('0x22')](respondWithFilteredResult(_0x4794e4,_0x386658))[_0x8789('0x3e')](handleError(_0x4794e4,null));};exports['show']=function(_0x433f30,_0x46daf0){var _0x46e11c={'raw':!![],'where':{'id':_0x433f30['params']['id']}},_0x24c346={};_0x24c346[_0x8789('0x32')]=_[_0x8789('0x3f')](db[_0x8789('0x29')]['rawAttributes']);_0x24c346[_0x8789('0x2e')]=_['keys'](_0x433f30[_0x8789('0x2e')]);_0x24c346[_0x8789('0x2f')]=_[_0x8789('0x31')](_0x24c346[_0x8789('0x32')],_0x24c346[_0x8789('0x2e')]);_0x46e11c[_0x8789('0x30')]=_['intersection'](_0x24c346[_0x8789('0x32')],qs['fields'](_0x433f30[_0x8789('0x2e')][_0x8789('0x40')]));_0x46e11c[_0x8789('0x30')]=_0x46e11c[_0x8789('0x30')][_0x8789('0x33')]?_0x46e11c[_0x8789('0x30')]:_0x24c346[_0x8789('0x32')];if(_0x433f30[_0x8789('0x2e')][_0x8789('0x3c')]){_0x46e11c[_0x8789('0x41')]=[{'all':!![]}];}_0x46e11c=_[_0x8789('0x39')]({},_0x46e11c,_0x433f30['options']);return db[_0x8789('0x29')]['find'](_0x46e11c)['then'](handleEntityNotFound(_0x46daf0,null))[_0x8789('0x22')](respondWithResult(_0x46daf0,null))[_0x8789('0x3e')](handleError(_0x46daf0,null));};exports['create']=function(_0x5c7c1b,_0x2f07ac){return db[_0x8789('0x29')][_0x8789('0x42')](_0x5c7c1b[_0x8789('0x43')],{})[_0x8789('0x22')](respondWithResult(_0x2f07ac,0xc9))[_0x8789('0x3e')](handleError(_0x2f07ac,null));};exports[_0x8789('0x44')]=function(_0x209f40,_0x8b71a1){if(_0x209f40[_0x8789('0x43')]['id']){delete _0x209f40['body']['id'];}return db[_0x8789('0x29')][_0x8789('0x45')]({'where':{'id':_0x209f40[_0x8789('0x46')]['id']}})[_0x8789('0x22')](handleEntityNotFound(_0x8b71a1,null))[_0x8789('0x22')](saveUpdates(_0x209f40[_0x8789('0x43')],null))[_0x8789('0x22')](respondWithResult(_0x8b71a1,null))['catch'](handleError(_0x8b71a1,null));};exports['destroy']=function(_0x2e5c15,_0x37a62e){return db[_0x8789('0x29')][_0x8789('0x45')]({'where':{'id':_0x2e5c15[_0x8789('0x46')]['id']}})[_0x8789('0x22')](handleEntityNotFound(_0x37a62e,null))[_0x8789('0x22')](removeEntity(_0x37a62e,null))[_0x8789('0x3e')](handleError(_0x37a62e,null));};exports['describe']=function(_0x2cca57,_0x4a92af){return db[_0x8789('0x29')][_0x8789('0x47')]()[_0x8789('0x22')](respondWithResult(_0x4a92af,null))[_0x8789('0x3e')](handleError(_0x4a92af,null));}; \ No newline at end of file +var _0xa756=['update','then','destroy','end','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save'];(function(_0x285c56,_0x2ff9dc){var _0x4446f7=function(_0x19a134){while(--_0x19a134){_0x285c56['push'](_0x285c56['shift']());}};_0x4446f7(++_0x2ff9dc);}(_0xa756,0x108));var _0x6a75=function(_0x3c328e,_0x133167){_0x3c328e=_0x3c328e-0x0;var _0x46b037=_0xa756[_0x3c328e];return _0x46b037;};'use strict';var emlformat=require(_0x6a75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a75('0x1'));var jsonpatch=require(_0x6a75('0x2'));var rp=require(_0x6a75('0x3'));var moment=require(_0x6a75('0x4'));var BPromise=require(_0x6a75('0x5'));var Mustache=require(_0x6a75('0x6'));var util=require(_0x6a75('0x7'));var path=require(_0x6a75('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a75('0x9'));var fs=require('fs');var fs_extra=require(_0x6a75('0xa'));var _=require(_0x6a75('0xb'));var squel=require(_0x6a75('0xc'));var crypto=require(_0x6a75('0xd'));var jsforce=require(_0x6a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6a75('0xf'));var Papa=require(_0x6a75('0x10'));var Redis=require(_0x6a75('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a75('0x12'));var logger=require(_0x6a75('0x13'))(_0x6a75('0x14'));var utils=require(_0x6a75('0x15'));var config=require(_0x6a75('0x16'));var licenseUtil=require(_0x6a75('0x17'));var db=require(_0x6a75('0x18'))['db'];function respondWithStatusCode(_0x200559,_0x34c49d){_0x34c49d=_0x34c49d||0xcc;return function(_0x349f55){if(_0x349f55){return _0x200559[_0x6a75('0x19')](_0x34c49d);}return _0x200559[_0x6a75('0x1a')](_0x34c49d)['end']();};}function respondWithResult(_0x1348ad,_0x5acf0b){_0x5acf0b=_0x5acf0b||0xc8;return function(_0x2ed66d){if(_0x2ed66d){return _0x1348ad[_0x6a75('0x1a')](_0x5acf0b)[_0x6a75('0x1b')](_0x2ed66d);}};}function respondWithFilteredResult(_0x16130b,_0x294457){return function(_0x441d74){if(_0x441d74){var _0xe7c6f2=typeof _0x294457[_0x6a75('0x1c')]==='undefined'&&typeof _0x294457[_0x6a75('0x1d')]===_0x6a75('0x1e');var _0x2838ae=_0x441d74[_0x6a75('0x1f')];var _0x5ead97=_0xe7c6f2?0x0:_0x294457[_0x6a75('0x1c')];var _0x7d1f3a=_0xe7c6f2?_0x441d74[_0x6a75('0x1f')]:_0x294457[_0x6a75('0x1c')]+_0x294457[_0x6a75('0x1d')];var _0x234282;if(_0x7d1f3a>=_0x2838ae){_0x7d1f3a=_0x2838ae;_0x234282=0xc8;}else{_0x234282=0xce;}_0x16130b[_0x6a75('0x1a')](_0x234282);return _0x16130b[_0x6a75('0x20')](_0x6a75('0x21'),_0x5ead97+'-'+_0x7d1f3a+'/'+_0x2838ae)[_0x6a75('0x1b')](_0x441d74);}return null;};}function patchUpdates(_0x330777){return function(_0x37fd2e){try{jsonpatch[_0x6a75('0x22')](_0x37fd2e,_0x330777,!![]);}catch(_0x158bae){return BPromise['reject'](_0x158bae);}return _0x37fd2e[_0x6a75('0x23')]();};}function saveUpdates(_0x6efd37,_0x2441e6){return function(_0x4b5c71){if(_0x4b5c71){return _0x4b5c71[_0x6a75('0x24')](_0x6efd37)[_0x6a75('0x25')](function(_0xcc5b93){return _0xcc5b93;});}return null;};}function removeEntity(_0x4a6a8f,_0x5329fa){return function(_0x4b4d4c){if(_0x4b4d4c){return _0x4b4d4c[_0x6a75('0x26')]()['then'](function(){_0x4a6a8f[_0x6a75('0x1a')](0xcc)[_0x6a75('0x27')]();});}};}function handleEntityNotFound(_0x32a69d,_0x590507){return function(_0x245f24){if(!_0x245f24){_0x32a69d[_0x6a75('0x19')](0x194);}return _0x245f24;};}function handleError(_0x3a61b6,_0x32bea8){_0x32bea8=_0x32bea8||0x1f4;return function(_0x11bd27){logger['error'](_0x11bd27[_0x6a75('0x28')]);if(_0x11bd27['name']){delete _0x11bd27[_0x6a75('0x29')];}_0x3a61b6['status'](_0x32bea8)[_0x6a75('0x2a')](_0x11bd27);};}exports[_0x6a75('0x2b')]=function(_0x21d963,_0x2e2263){var _0x4854e7={},_0x3d4911={},_0x5840cd={'count':0x0,'rows':[]};var _0x14ec9b=_[_0x6a75('0x2c')](db[_0x6a75('0x2d')][_0x6a75('0x2e')],function(_0x581e5b){return{'name':_0x581e5b[_0x6a75('0x2f')],'type':_0x581e5b[_0x6a75('0x30')][_0x6a75('0x31')]};});_0x3d4911['model']=_[_0x6a75('0x2c')](_0x14ec9b,_0x6a75('0x29'));_0x3d4911[_0x6a75('0x32')]=_[_0x6a75('0x33')](_0x21d963[_0x6a75('0x32')]);_0x3d4911['filters']=_['intersection'](_0x3d4911[_0x6a75('0x34')],_0x3d4911[_0x6a75('0x32')]);_0x4854e7[_0x6a75('0x35')]=_[_0x6a75('0x36')](_0x3d4911[_0x6a75('0x34')],qs[_0x6a75('0x37')](_0x21d963['query'][_0x6a75('0x37')]));_0x4854e7[_0x6a75('0x35')]=_0x4854e7[_0x6a75('0x35')][_0x6a75('0x38')]?_0x4854e7['attributes']:_0x3d4911[_0x6a75('0x34')];if(!_0x21d963[_0x6a75('0x32')]['hasOwnProperty'](_0x6a75('0x39'))){_0x4854e7[_0x6a75('0x1d')]=qs[_0x6a75('0x1d')](_0x21d963['query'][_0x6a75('0x1d')]);_0x4854e7[_0x6a75('0x1c')]=qs[_0x6a75('0x1c')](_0x21d963[_0x6a75('0x32')][_0x6a75('0x1c')]);}_0x4854e7['order']=qs[_0x6a75('0x3a')](_0x21d963[_0x6a75('0x32')][_0x6a75('0x3a')]);_0x4854e7[_0x6a75('0x3b')]=qs['filters'](_[_0x6a75('0x3c')](_0x21d963[_0x6a75('0x32')],_0x3d4911[_0x6a75('0x3d')]),_0x14ec9b);if(_0x21d963['query'][_0x6a75('0x3e')]){_0x4854e7[_0x6a75('0x3b')]=_[_0x6a75('0x3f')](_0x4854e7[_0x6a75('0x3b')],{'$or':_[_0x6a75('0x2c')](_0x14ec9b,function(_0x1a240f){if(_0x1a240f[_0x6a75('0x30')]!=='VIRTUAL'){var _0x412de7={};_0x412de7[_0x1a240f[_0x6a75('0x29')]]={'$like':'%'+_0x21d963[_0x6a75('0x32')]['filter']+'%'};return _0x412de7;}})});}_0x4854e7=_[_0x6a75('0x3f')]({},_0x4854e7,_0x21d963[_0x6a75('0x40')]);var _0x594b53={'where':_0x4854e7[_0x6a75('0x3b')]};return db[_0x6a75('0x2d')][_0x6a75('0x1f')](_0x594b53)['then'](function(_0x16c24b){_0x5840cd[_0x6a75('0x1f')]=_0x16c24b;if(_0x21d963[_0x6a75('0x32')][_0x6a75('0x41')]){_0x4854e7[_0x6a75('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x6a75('0x43')](_0x4854e7);})[_0x6a75('0x25')](function(_0x57b76a){_0x5840cd[_0x6a75('0x44')]=_0x57b76a;return _0x5840cd;})[_0x6a75('0x25')](respondWithFilteredResult(_0x2e2263,_0x4854e7))[_0x6a75('0x45')](handleError(_0x2e2263,null));};exports['show']=function(_0x3e2c5d,_0x8bb3f7){var _0x4d730a={'raw':!![],'where':{'id':_0x3e2c5d[_0x6a75('0x46')]['id']}},_0x1440e9={};_0x1440e9['model']=_[_0x6a75('0x33')](db['VoiceDialReport']['rawAttributes']);_0x1440e9[_0x6a75('0x32')]=_[_0x6a75('0x33')](_0x3e2c5d['query']);_0x1440e9['filters']=_[_0x6a75('0x36')](_0x1440e9[_0x6a75('0x34')],_0x1440e9[_0x6a75('0x32')]);_0x4d730a[_0x6a75('0x35')]=_[_0x6a75('0x36')](_0x1440e9['model'],qs[_0x6a75('0x37')](_0x3e2c5d[_0x6a75('0x32')][_0x6a75('0x37')]));_0x4d730a[_0x6a75('0x35')]=_0x4d730a[_0x6a75('0x35')]['length']?_0x4d730a[_0x6a75('0x35')]:_0x1440e9[_0x6a75('0x34')];if(_0x3e2c5d['query']['includeAll']){_0x4d730a[_0x6a75('0x42')]=[{'all':!![]}];}_0x4d730a=_[_0x6a75('0x3f')]({},_0x4d730a,_0x3e2c5d[_0x6a75('0x40')]);return db[_0x6a75('0x2d')][_0x6a75('0x47')](_0x4d730a)[_0x6a75('0x25')](handleEntityNotFound(_0x8bb3f7,null))[_0x6a75('0x25')](respondWithResult(_0x8bb3f7,null))[_0x6a75('0x45')](handleError(_0x8bb3f7,null));};exports[_0x6a75('0x48')]=function(_0x17113b,_0x56276e){return db[_0x6a75('0x2d')][_0x6a75('0x48')](_0x17113b[_0x6a75('0x49')],{})['then'](respondWithResult(_0x56276e,0xc9))['catch'](handleError(_0x56276e,null));};exports[_0x6a75('0x24')]=function(_0x2bf934,_0x3f1f88){if(_0x2bf934['body']['id']){delete _0x2bf934[_0x6a75('0x49')]['id'];}return db[_0x6a75('0x2d')][_0x6a75('0x47')]({'where':{'id':_0x2bf934[_0x6a75('0x46')]['id']}})[_0x6a75('0x25')](handleEntityNotFound(_0x3f1f88,null))['then'](saveUpdates(_0x2bf934[_0x6a75('0x49')],null))['then'](respondWithResult(_0x3f1f88,null))[_0x6a75('0x45')](handleError(_0x3f1f88,null));};exports['destroy']=function(_0x3a3793,_0x7bab52){return db[_0x6a75('0x2d')]['find']({'where':{'id':_0x3a3793[_0x6a75('0x46')]['id']}})[_0x6a75('0x25')](handleEntityNotFound(_0x7bab52,null))['then'](removeEntity(_0x7bab52,null))[_0x6a75('0x45')](handleError(_0x7bab52,null));};exports[_0x6a75('0x4a')]=function(_0x4964c1,_0x33e5de){return db['VoiceDialReport'][_0x6a75('0x4a')]()['then'](respondWithResult(_0x33e5de,null))[_0x6a75('0x45')](handleError(_0x33e5de,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0818fb4..0806eb7 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 _0xa1d0=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','VoiceDialReport','report_dial'];(function(_0xfd167a,_0x567d5a){var _0xf9c543=function(_0x57ea15){while(--_0x57ea15){_0xfd167a['push'](_0xfd167a['shift']());}};_0xf9c543(++_0x567d5a);}(_0xa1d0,0xfa));var _0x0a1d=function(_0x18957b,_0x46ddff){_0x18957b=_0x18957b-0x0;var _0x80ab51=_0xa1d0[_0x18957b];return _0x80ab51;};'use strict';var _=require('lodash');var util=require(_0x0a1d('0x0'));var logger=require(_0x0a1d('0x1'))(_0x0a1d('0x2'));var moment=require('moment');var BPromise=require(_0x0a1d('0x3'));var rp=require(_0x0a1d('0x4'));var fs=require('fs');var path=require(_0x0a1d('0x5'));var rimraf=require('rimraf');var config=require(_0x0a1d('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x5241ee,_0x203208){return _0x5241ee[_0x0a1d('0x7')](_0x0a1d('0x8'),attributes,{'tableName':_0x0a1d('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeed7=['exports','define','VoiceDialReport','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes'];(function(_0x449acc,_0x416458){var _0x15d15d=function(_0x5626a0){while(--_0x5626a0){_0x449acc['push'](_0x449acc['shift']());}};_0x15d15d(++_0x416458);}(_0xeed7,0xdf));var _0x7eed=function(_0x41e44a,_0x175fac){_0x41e44a=_0x41e44a-0x0;var _0x47695d=_0xeed7[_0x41e44a];return _0x47695d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7eed('0x0'))(_0x7eed('0x1'));var moment=require('moment');var BPromise=require(_0x7eed('0x2'));var rp=require(_0x7eed('0x3'));var fs=require('fs');var path=require(_0x7eed('0x4'));var rimraf=require(_0x7eed('0x5'));var config=require('../../config/environment');var attributes=require(_0x7eed('0x6'));module[_0x7eed('0x7')]=function(_0x5975af,_0x307a00){return _0x5975af[_0x7eed('0x8')](_0x7eed('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d9573cb..df2dbc0 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 _0x7894=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','VoiceDialReport','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','where','attributes','limit'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0x7894,0x181));var _0x4789=function(_0x31fac5,_0x7b76ac){_0x31fac5=_0x31fac5-0x0;var _0x4c27aa=_0x7894[_0x31fac5];return _0x4c27aa;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require('bluebird');var rs=require(_0x4789('0x3'));var fs=require('fs');var Redis=require(_0x4789('0x4'));var db=require(_0x4789('0x5'))['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c687a,_0x590399,_0x1ad89c){return new BPromise(function(_0x1f317f,_0x93d4fc){return client[_0x4789('0xc')](_0x2c687a,_0x1ad89c)[_0x4789('0xd')](function(_0x39a70f){logger[_0x4789('0xe')](_0x4789('0xf'),_0x590399,_0x4789('0x10'));logger[_0x4789('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x590399,_0x4789('0x10'),JSON['stringify'](_0x39a70f));if(_0x39a70f[_0x4789('0x12')]){if(_0x39a70f[_0x4789('0x12')]['code']===0x1f4){logger['error'](_0x4789('0xf'),_0x590399,_0x39a70f['error'][_0x4789('0x13')]);return _0x93d4fc(_0x39a70f[_0x4789('0x12')]['message']);}logger[_0x4789('0x12')](_0x4789('0xf'),_0x590399,_0x39a70f[_0x4789('0x12')][_0x4789('0x13')]);return _0x1f317f(_0x39a70f['error'][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xf'),_0x590399,'request\x20sent');_0x1f317f(_0x39a70f[_0x4789('0x14')]['message']);}})['catch'](function(_0x4b8f5e){logger[_0x4789('0x12')](_0x4789('0xf'),_0x590399,_0x4b8f5e);_0x93d4fc(_0x4b8f5e);});});}exports['CreateVoiceDialReport']=function(_0xb92839){var _0x5b938d=this;return new Promise(function(_0x2da0b0,_0x2d9a35){return db[_0x4789('0x15')]['create'](_0xb92839[_0x4789('0x16')],{'raw':_0xb92839[_0x4789('0x17')]?_0xb92839[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![]})[_0x4789('0xd')](function(_0x1f9ad0){logger[_0x4789('0xe')](_0x4789('0x19'),_0xb92839);logger[_0x4789('0x11')](_0x4789('0x19'),_0xb92839,JSON[_0x4789('0x1a')](_0x1f9ad0));_0x2da0b0(_0x1f9ad0);})['catch'](function(_0x2b30d1){logger[_0x4789('0x12')](_0x4789('0x19'),_0x2b30d1[_0x4789('0x13')],_0xb92839);_0x2d9a35(_0x5b938d[_0x4789('0x12')](0x1f4,_0x2b30d1[_0x4789('0x13')]));});});};exports[_0x4789('0x1b')]=function(_0x26621d){var _0xefdc10=this;return new Promise(function(_0x41f16d,_0x4c1051){return db[_0x4789('0x15')]['update'](_0x26621d[_0x4789('0x16')],{'raw':_0x26621d['options']?_0x26621d[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26621d['options']?_0x26621d[_0x4789('0x17')][_0x4789('0x1c')]||null:null,'attributes':_0x26621d['options']?_0x26621d[_0x4789('0x17')][_0x4789('0x1d')]||null:null,'limit':_0x26621d['options']?_0x26621d[_0x4789('0x17')][_0x4789('0x1e')]||null:null})[_0x4789('0xd')](function(_0x4cdbe7){logger[_0x4789('0xe')](_0x4789('0x1b'),_0x26621d);logger[_0x4789('0x11')](_0x4789('0x1b'),_0x26621d,JSON['stringify'](_0x4cdbe7));_0x41f16d(_0x4cdbe7);})[_0x4789('0x1f')](function(_0x57c61a){logger[_0x4789('0x12')](_0x4789('0x1b'),_0x57c61a[_0x4789('0x13')],_0x26621d);_0x4c1051(_0xefdc10[_0x4789('0x12')](0x1f4,_0x57c61a[_0x4789('0x13')]));});});}; \ No newline at end of file +var _0xf0a5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','update','where','attributes','limit'];(function(_0x386f5f,_0x562bae){var _0x27f02f=function(_0x3e3994){while(--_0x3e3994){_0x386f5f['push'](_0x386f5f['shift']());}};_0x27f02f(++_0x562bae);}(_0xf0a5,0xaa));var _0x5f0a=function(_0x1e5337,_0x38731f){_0x1e5337=_0x1e5337-0x0;var _0x50b6b4=_0xf0a5[_0x1e5337];return _0x50b6b4;};'use strict';var _=require(_0x5f0a('0x0'));var util=require('util');var moment=require(_0x5f0a('0x1'));var BPromise=require(_0x5f0a('0x2'));var rs=require(_0x5f0a('0x3'));var fs=require('fs');var Redis=require(_0x5f0a('0x4'));var db=require(_0x5f0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f0a('0x6'))(_0x5f0a('0x7'));var config=require(_0x5f0a('0x8'));var jayson=require(_0x5f0a('0x9'));var client=jayson['client'][_0x5f0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485a86,_0x20a548,_0x58d4c3){return new BPromise(function(_0x5edfee,_0x393d7d){return client[_0x5f0a('0xb')](_0x485a86,_0x58d4c3)[_0x5f0a('0xc')](function(_0x5101a5){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x20a548,_0x5f0a('0xd'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x20a548,'request\x20sent',JSON[_0x5f0a('0xe')](_0x5101a5));if(_0x5101a5[_0x5f0a('0xf')]){if(_0x5101a5['error'][_0x5f0a('0x10')]===0x1f4){logger[_0x5f0a('0xf')](_0x5f0a('0x11'),_0x20a548,_0x5101a5['error'][_0x5f0a('0x12')]);return _0x393d7d(_0x5101a5['error'][_0x5f0a('0x12')]);}logger[_0x5f0a('0xf')](_0x5f0a('0x11'),_0x20a548,_0x5101a5[_0x5f0a('0xf')]['message']);return _0x5edfee(_0x5101a5[_0x5f0a('0xf')]['message']);}else{logger[_0x5f0a('0x13')](_0x5f0a('0x11'),_0x20a548,_0x5f0a('0xd'));_0x5edfee(_0x5101a5[_0x5f0a('0x14')][_0x5f0a('0x12')]);}})[_0x5f0a('0x15')](function(_0x315d9b){logger[_0x5f0a('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x20a548,_0x315d9b);_0x393d7d(_0x315d9b);});});}exports[_0x5f0a('0x16')]=function(_0x5e74e2){var _0x26cbe0=this;return new Promise(function(_0x3a5be5,_0x41337d){return db[_0x5f0a('0x17')][_0x5f0a('0x18')](_0x5e74e2[_0x5f0a('0x19')],{'raw':_0x5e74e2[_0x5f0a('0x1a')]?_0x5e74e2[_0x5f0a('0x1a')][_0x5f0a('0x1b')]===undefined?!![]:![]:!![]})[_0x5f0a('0xc')](function(_0x58b68f){logger[_0x5f0a('0x13')](_0x5f0a('0x16'),_0x5e74e2);logger[_0x5f0a('0x1c')](_0x5f0a('0x16'),_0x5e74e2,JSON[_0x5f0a('0xe')](_0x58b68f));_0x3a5be5(_0x58b68f);})[_0x5f0a('0x15')](function(_0x91e026){logger[_0x5f0a('0xf')](_0x5f0a('0x16'),_0x91e026['message'],_0x5e74e2);_0x41337d(_0x26cbe0['error'](0x1f4,_0x91e026[_0x5f0a('0x12')]));});});};exports[_0x5f0a('0x1d')]=function(_0x31e383){var _0x56ccbf=this;return new Promise(function(_0x4ca16f,_0x3be36a){return db[_0x5f0a('0x17')][_0x5f0a('0x1e')](_0x31e383[_0x5f0a('0x19')],{'raw':_0x31e383[_0x5f0a('0x1a')]?_0x31e383['options'][_0x5f0a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e383[_0x5f0a('0x1a')]?_0x31e383[_0x5f0a('0x1a')][_0x5f0a('0x1f')]||null:null,'attributes':_0x31e383['options']?_0x31e383[_0x5f0a('0x1a')][_0x5f0a('0x20')]||null:null,'limit':_0x31e383[_0x5f0a('0x1a')]?_0x31e383[_0x5f0a('0x1a')][_0x5f0a('0x21')]||null:null})[_0x5f0a('0xc')](function(_0x290601){logger[_0x5f0a('0x13')](_0x5f0a('0x1d'),_0x31e383);logger[_0x5f0a('0x1c')](_0x5f0a('0x1d'),_0x31e383,JSON[_0x5f0a('0xe')](_0x290601));_0x4ca16f(_0x290601);})['catch'](function(_0x11469e){logger[_0x5f0a('0xf')](_0x5f0a('0x1d'),_0x11469e[_0x5f0a('0x12')],_0x31e383);_0x3be36a(_0x56ccbf['error'](0x1f4,_0x11469e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 6b35b26..5247fd8 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 _0xf036=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','post','addApplications','update','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5ec0b7,_0x455790){var _0x4cfc25=function(_0x528d82){while(--_0x528d82){_0x5ec0b7['push'](_0x5ec0b7['shift']());}};_0x4cfc25(++_0x455790);}(_0xf036,0x1f3));var _0x6f03=function(_0x279f84,_0x583125){_0x279f84=_0x279f84-0x0;var _0x23439c=_0xf036[_0x279f84];return _0x23439c;};'use strict';var multer=require(_0x6f03('0x0'));var util=require('util');var path=require(_0x6f03('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6f03('0x2'));var auth=require(_0x6f03('0x3'));var interaction=require(_0x6f03('0x4'));var config=require(_0x6f03('0x5'));var controller=require(_0x6f03('0x6'));router[_0x6f03('0x7')]('/',auth[_0x6f03('0x8')](),controller[_0x6f03('0x9')]);router['get'](_0x6f03('0xa'),auth[_0x6f03('0x8')](),controller['show']);router['post']('/',auth[_0x6f03('0x8')](),controller[_0x6f03('0xb')]);router[_0x6f03('0xc')]('/:id/applications',auth[_0x6f03('0x8')](),controller[_0x6f03('0xd')]);router['put'](_0x6f03('0xa'),auth[_0x6f03('0x8')](),controller[_0x6f03('0xe')]);router[_0x6f03('0xf')](_0x6f03('0xa'),auth['isAuthenticated'](),controller[_0x6f03('0x10')]);module[_0x6f03('0x11')]=router; \ No newline at end of file +var _0xa623=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','addApplications','put','update'];(function(_0x3ac98a,_0x2a2402){var _0x6ef0f0=function(_0x4b64db){while(--_0x4b64db){_0x3ac98a['push'](_0x3ac98a['shift']());}};_0x6ef0f0(++_0x2a2402);}(_0xa623,0xd4));var _0x3a62=function(_0x20f945,_0x9da2bf){_0x20f945=_0x20f945-0x0;var _0x3b56bb=_0xa623[_0x20f945];return _0x3b56bb;};'use strict';var multer=require(_0x3a62('0x0'));var util=require(_0x3a62('0x1'));var path=require('path');var timeout=require(_0x3a62('0x2'));var express=require(_0x3a62('0x3'));var router=express[_0x3a62('0x4')]();var fs_extra=require(_0x3a62('0x5'));var auth=require(_0x3a62('0x6'));var interaction=require(_0x3a62('0x7'));var config=require(_0x3a62('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0x3a62('0x9')](),controller['index']);router['get'](_0x3a62('0xa'),auth[_0x3a62('0x9')](),controller[_0x3a62('0xb')]);router[_0x3a62('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3a62('0xc')]('/:id/applications',auth[_0x3a62('0x9')](),controller[_0x3a62('0xd')]);router[_0x3a62('0xe')](_0x3a62('0xa'),auth[_0x3a62('0x9')](),controller[_0x3a62('0xf')]);router[_0x3a62('0x10')](_0x3a62('0xa'),auth['isAuthenticated'](),controller[_0x3a62('0x11')]);module[_0x3a62('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 450b507..810fa4d 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 _0x1723=['sequelize','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten'];(function(_0x3af4b5,_0x1aae9){var _0x163fef=function(_0x591eab){while(--_0x591eab){_0x3af4b5['push'](_0x3af4b5['shift']());}};_0x163fef(++_0x1aae9);}(_0x1723,0x13b));var _0x3172=function(_0x241f49,_0x25353c){_0x241f49=_0x241f49-0x0;var _0x34e64f=_0x1723[_0x241f49];return _0x34e64f;};'use strict';var Sequelize=require(_0x3172('0x0'));module['exports']={'context':{'type':Sequelize[_0x3172('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x3172('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x3172('0x2')},'tag':{'type':Sequelize[_0x3172('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3172('0x1')],'allowNull':![],'defaultValue':_0x3172('0x3')},'appdata':{'type':Sequelize[_0x3172('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3172('0x4')]('inbound',_0x3172('0x5'),_0x3172('0x6'),_0x3172('0x7'),'outbound-fax','system',_0x3172('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x3172('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3172('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x3172('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x3172('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3172('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x3172('0xc')},'answer':{'type':Sequelize[_0x3172('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2d0c7d){return this[_0x3172('0xd')](_0x3172('0xe'));}},'alias':{'type':Sequelize[_0x3172('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x06a9=['compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','sequelize','exports','STRING'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x06a9,0xd5));var _0x906a=function(_0x2ad011,_0x5ea2e0){_0x2ad011=_0x2ad011-0x0;var _0x5873e0=_0x06a9[_0x2ad011];return _0x5873e0;};'use strict';var Sequelize=require(_0x906a('0x0'));module[_0x906a('0x1')]={'context':{'type':Sequelize[_0x906a('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x906a('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x906a('0x3')},'tag':{'type':Sequelize[_0x906a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x906a('0x2')],'allowNull':![],'defaultValue':_0x906a('0x4')},'appdata':{'type':Sequelize[_0x906a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x906a('0x5')](_0x906a('0x6'),_0x906a('0x7'),'internal',_0x906a('0x8'),_0x906a('0x9'),_0x906a('0xa'),_0x906a('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x906a('0x2')]},'interval':{'type':Sequelize[_0x906a('0x2')],'allowNull':![],'defaultValue':_0x906a('0xc')},'IntervalId':{'type':Sequelize[_0x906a('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x906a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x906a('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x906a('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x906a('0xf')},'answer':{'type':Sequelize[_0x906a('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2304fc){return this[_0x906a('0x10')](_0x906a('0x11'));}},'alias':{'type':Sequelize[_0x906a('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 e5c2753..b05bd13 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 _0x0e63=['offset','undefined','limit','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','map','type','find','name','error','send','index','VoiceExtension','rawAttributes','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','merge','options','count','includeAll','rows','catch','show','params','keys','include','body','startsWith','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','internal','value','UserProfileSection','autoAssociation','update','pick','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json'];(function(_0x48ddf0,_0x324cce){var _0x4f76e3=function(_0x364ae6){while(--_0x364ae6){_0x48ddf0['push'](_0x48ddf0['shift']());}};_0x4f76e3(++_0x324cce);}(_0x0e63,0x1b2));var _0x30e6=function(_0x50a581,_0x483286){_0x50a581=_0x50a581-0x0;var _0x25efde=_0x0e63[_0x50a581];return _0x25efde;};'use strict';var _=require(_0x30e6('0x0'));var Redis=require(_0x30e6('0x1'));var qs=require(_0x30e6('0x2'));var logger=require(_0x30e6('0x3'))(_0x30e6('0x4'));var config=require(_0x30e6('0x5'));var db=require(_0x30e6('0x6'))['db'];config[_0x30e6('0x7')]=_['defaults'](config[_0x30e6('0x7')],{'host':_0x30e6('0x8'),'port':0x18eb});var socket=require(_0x30e6('0x9'))(new Redis(config['redis']));require(_0x30e6('0xa'))[_0x30e6('0xb')](socket);function respondWithStatusCode(_0x186115,_0x1696f4){_0x1696f4=_0x1696f4||0xcc;return function(_0x25b7bd){if(_0x25b7bd){return _0x186115[_0x30e6('0xc')](_0x1696f4);}return _0x186115['status'](_0x1696f4)[_0x30e6('0xd')]();};}function respondWithResult(_0x1931c6,_0x241d4a){_0x241d4a=_0x241d4a||0xc8;return function(_0x1f6a4b){if(_0x1f6a4b){return _0x1931c6[_0x30e6('0xe')](_0x241d4a)[_0x30e6('0xf')](_0x1f6a4b);}};}function respondWithFilteredResult(_0x2b9302,_0x2e5c55){return function(_0x40d945){if(_0x40d945){var _0x271910=typeof _0x2e5c55[_0x30e6('0x10')]===_0x30e6('0x11')&&typeof _0x2e5c55[_0x30e6('0x12')]==='undefined';var _0x426d2e=_0x40d945['count'];var _0x45041b=_0x271910?0x0:_0x2e5c55['offset'];var _0x3cffa9=_0x271910?_0x40d945['count']:_0x2e5c55[_0x30e6('0x10')]+_0x2e5c55[_0x30e6('0x12')];var _0x353d28;if(_0x3cffa9>=_0x426d2e){_0x3cffa9=_0x426d2e;_0x353d28=0xc8;}else{_0x353d28=0xce;}_0x2b9302[_0x30e6('0xe')](_0x353d28);return _0x2b9302[_0x30e6('0x13')](_0x30e6('0x14'),_0x45041b+'-'+_0x3cffa9+'/'+_0x426d2e)[_0x30e6('0xf')](_0x40d945);}return null;};}function removeEntity(_0x30df0c){return function(_0x4915cd){if(_0x4915cd){return _0x4915cd['destroy']()[_0x30e6('0x15')](function(){var _0x15df4c=_0x4915cd[_0x30e6('0x16')]({'plain':!![]});var _0x74d91=[{'name':_0x30e6('0x17'),'value':_0x30e6('0x18'),'ignore':![]},{'name':_0x30e6('0x19'),'value':_0x30e6('0x1a'),'ignore':![]},{'name':_0x30e6('0x1b'),'value':'internal','ignore':![]}];var _0x50d683=_(_0x74d91)[_0x30e6('0x1c')]('ignore')[_0x30e6('0x1d')]('value')['value']();if(_['includes'](_0x50d683,_0x15df4c[_0x30e6('0x1e')])){return;}var _0xe06af8=_[_0x30e6('0x1f')](_0x74d91,['value',_0x15df4c[_0x30e6('0x1e')]])[_0x30e6('0x20')];return db['UserProfileResource']['destroy']({'where':{'type':_0xe06af8,'resourceId':_0x15df4c['id']}})[_0x30e6('0x15')](function(){return _0x4915cd;});})[_0x30e6('0x15')](function(){_0x30df0c[_0x30e6('0xe')](0xcc)[_0x30e6('0xd')]();});}};}function handleEntityNotFound(_0x4ad78e){return function(_0x4e1831){if(!_0x4e1831){_0x4ad78e[_0x30e6('0xc')](0x194);}return _0x4e1831;};}function handleError(_0x3f6fe1,_0x1f04ab){_0x1f04ab=_0x1f04ab||0x1f4;return function(_0x2e9e31){logger[_0x30e6('0x21')](_0x2e9e31['stack']);if(_0x2e9e31[_0x30e6('0x20')]){delete _0x2e9e31[_0x30e6('0x20')];}_0x3f6fe1['status'](_0x1f04ab)[_0x30e6('0x22')](_0x2e9e31);};}exports[_0x30e6('0x23')]=function(_0x3eddab,_0x346c71){var _0x5a8315={},_0x1da2af={},_0x44b365={'count':0x0,'rows':[]};var _0x5e74c4=_[_0x30e6('0x1d')](db[_0x30e6('0x24')][_0x30e6('0x25')],function(_0x37732d){return{'name':_0x37732d['fieldName'],'type':_0x37732d['type'][_0x30e6('0x26')]};});_0x1da2af[_0x30e6('0x27')]=_[_0x30e6('0x1d')](_0x5e74c4,'name');_0x1da2af[_0x30e6('0x28')]=_['keys'](_0x3eddab['query']);_0x1da2af['filters']=_['intersection'](_0x1da2af['model'],_0x1da2af[_0x30e6('0x28')]);_0x5a8315[_0x30e6('0x29')]=_[_0x30e6('0x2a')](_0x1da2af['model'],qs[_0x30e6('0x2b')](_0x3eddab['query']['fields']));_0x5a8315[_0x30e6('0x29')]=_0x5a8315[_0x30e6('0x29')][_0x30e6('0x2c')]?_0x5a8315['attributes']:_0x1da2af[_0x30e6('0x27')];if(!_0x3eddab[_0x30e6('0x28')]['hasOwnProperty'](_0x30e6('0x2d'))){_0x5a8315[_0x30e6('0x12')]=qs[_0x30e6('0x12')](_0x3eddab[_0x30e6('0x28')][_0x30e6('0x12')]);_0x5a8315['offset']=qs[_0x30e6('0x10')](_0x3eddab[_0x30e6('0x28')]['offset']);}_0x5a8315[_0x30e6('0x2e')]=qs[_0x30e6('0x2f')](_0x3eddab[_0x30e6('0x28')][_0x30e6('0x2f')]);_0x5a8315[_0x30e6('0x30')]=qs[_0x30e6('0x31')](_['pick'](_0x3eddab['query'],_0x1da2af[_0x30e6('0x31')]),_0x5e74c4);if(_0x3eddab[_0x30e6('0x28')][_0x30e6('0x1c')]){_0x5a8315[_0x30e6('0x30')]=_['merge'](_0x5a8315['where'],{'$or':_[_0x30e6('0x1d')](_0x5e74c4,function(_0x4e0e14){if(_0x4e0e14[_0x30e6('0x1e')]!=='VIRTUAL'){var _0x3309c5={};_0x3309c5[_0x4e0e14[_0x30e6('0x20')]]={'$like':'%'+_0x3eddab[_0x30e6('0x28')][_0x30e6('0x1c')]+'%'};return _0x3309c5;}})});}_0x5a8315=_[_0x30e6('0x32')]({},_0x5a8315,_0x3eddab[_0x30e6('0x33')]);var _0x208817={'where':_0x5a8315[_0x30e6('0x30')]};return db['VoiceExtension'][_0x30e6('0x34')](_0x208817)['then'](function(_0x2ac86d){_0x44b365['count']=_0x2ac86d;if(_0x3eddab[_0x30e6('0x28')][_0x30e6('0x35')]){_0x5a8315['include']=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x5a8315);})[_0x30e6('0x15')](function(_0x52e3c0){_0x44b365[_0x30e6('0x36')]=_0x52e3c0;return _0x44b365;})['then'](respondWithFilteredResult(_0x346c71,_0x5a8315))[_0x30e6('0x37')](handleError(_0x346c71,null));};exports[_0x30e6('0x38')]=function(_0x58600e,_0x435c04){var _0x37f8d9={'raw':![],'where':{'id':_0x58600e[_0x30e6('0x39')]['id']}},_0x576a31={};_0x576a31[_0x30e6('0x27')]=_['keys'](db[_0x30e6('0x24')][_0x30e6('0x25')]);_0x576a31['query']=_[_0x30e6('0x3a')](_0x58600e[_0x30e6('0x28')]);_0x576a31['filters']=_[_0x30e6('0x2a')](_0x576a31[_0x30e6('0x27')],_0x576a31[_0x30e6('0x28')]);_0x37f8d9['attributes']=_[_0x30e6('0x2a')](_0x576a31[_0x30e6('0x27')],qs[_0x30e6('0x2b')](_0x58600e[_0x30e6('0x28')][_0x30e6('0x2b')]));_0x37f8d9[_0x30e6('0x29')]=_0x37f8d9[_0x30e6('0x29')][_0x30e6('0x2c')]?_0x37f8d9[_0x30e6('0x29')]:_0x576a31[_0x30e6('0x27')];if(_0x58600e[_0x30e6('0x28')][_0x30e6('0x35')]){_0x37f8d9[_0x30e6('0x3b')]=[{'all':!![]}];}_0x37f8d9=_[_0x30e6('0x32')]({},_0x37f8d9,_0x58600e[_0x30e6('0x33')]);return db[_0x30e6('0x24')]['find'](_0x37f8d9)[_0x30e6('0x15')](handleEntityNotFound(_0x435c04,null))[_0x30e6('0x15')](respondWithResult(_0x435c04,null))['catch'](handleError(_0x435c04,null));};exports['destroy']=function(_0x16c498,_0x309d61){return db[_0x30e6('0x24')][_0x30e6('0x1f')]({'where':{'id':_0x16c498[_0x30e6('0x39')]['id']}})[_0x30e6('0x15')](handleEntityNotFound(_0x309d61,null))[_0x30e6('0x15')](removeEntity(_0x309d61,null))['catch'](handleError(_0x309d61,null));};exports['create']=function(_0x52161f,_0x5c5a18){if(_0x52161f[_0x30e6('0x3c')][_0x30e6('0x1e')]===_0x30e6('0x1a')&&!_[_0x30e6('0x3d')](_0x52161f[_0x30e6('0x3c')][_0x30e6('0x3e')],'_')){_0x52161f[_0x30e6('0x3c')][_0x30e6('0x3e')]='_'[_0x30e6('0x3f')](_0x52161f[_0x30e6('0x3c')][_0x30e6('0x3e')]);}return db[_0x30e6('0x24')][_0x30e6('0x40')](_0x52161f['body'],{'raw':![]})[_0x30e6('0x15')](function(_0x477dc0){var _0x36d8e8=_0x52161f['user'][_0x30e6('0x16')]({'plain':!![]});if(!_0x36d8e8)throw new Error(_0x30e6('0x41'));if(_0x36d8e8[_0x30e6('0x42')]===_0x30e6('0x43')){var _0x1ba351=_0x477dc0[_0x30e6('0x16')]({'plain':!![]});var _0x1ffc64=[{'name':'InboundRoutes','value':_0x30e6('0x18')},{'name':'OutboundRoutes','value':_0x30e6('0x1a')},{'name':_0x30e6('0x1b'),'value':_0x30e6('0x44')}];var _0x1d8403=_[_0x30e6('0x1f')](_0x1ffc64,[_0x30e6('0x45'),_0x1ba351[_0x30e6('0x1e')]])[_0x30e6('0x20')];return db[_0x30e6('0x46')][_0x30e6('0x1f')]({'where':{'name':_0x1d8403,'userProfileId':_0x36d8e8['userProfileId']},'raw':!![]})[_0x30e6('0x15')](function(_0x27ad65){if(_0x27ad65&&_0x27ad65[_0x30e6('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x1ba351['name'],'resourceId':_0x1ba351['id'],'type':_0x27ad65[_0x30e6('0x20')],'sectionId':_0x27ad65['id']},{})[_0x30e6('0x15')](function(){return _0x477dc0;});}else{return _0x477dc0;}})[_0x30e6('0x37')](function(_0x24e8a3){logger[_0x30e6('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24e8a3);throw _0x24e8a3;});}return _0x477dc0;})['then'](respondWithResult(_0x5c5a18,0xc9))[_0x30e6('0x37')](handleError(_0x5c5a18,null));};exports[_0x30e6('0x48')]=function(_0x2e7ef4,_0x151527){if(_0x2e7ef4[_0x30e6('0x3c')]['id']){delete _0x2e7ef4[_0x30e6('0x3c')]['id'];}return db[_0x30e6('0x24')][_0x30e6('0x1f')]({'where':{'id':_0x2e7ef4[_0x30e6('0x39')]['id']}})[_0x30e6('0x15')](handleEntityNotFound(_0x151527,null))[_0x30e6('0x15')](function(_0x110a50){if(_0x110a50){return db[_0x30e6('0x24')][_0x30e6('0x48')](_[_0x30e6('0x49')](_0x2e7ef4[_0x30e6('0x3c')],[_0x30e6('0x3e'),'context',_0x30e6('0x4a'),_0x30e6('0x4b'),_0x30e6('0x4c'),_0x30e6('0x4d'),_0x30e6('0x4e')]),{'where':{'context':_0x110a50[_0x30e6('0x4f')],'exten':_0x110a50['exten']},'individualHooks':!![]})[_0x30e6('0x15')](function(_0x27ca33){return _0x27ca33;});}return null;})['then'](respondWithStatusCode(_0x151527,null))[_0x30e6('0x37')](handleError(_0x151527,null));};exports['addApplications']=function(_0x3ca03d,_0x216e06){var _0x5a9f4e=_0x3ca03d[_0x30e6('0x39')]['id'];var _0x55d16d=_0x3ca03d[_0x30e6('0x3c')];var _0x3dd35e=0xc8;var _0x1fb8bc=null;return db[_0x30e6('0x50')][_0x30e6('0x51')]({'isolationLevel':db[_0x30e6('0x50')]['Transaction'][_0x30e6('0x52')][_0x30e6('0x53')]},function(_0x335d2c){return db[_0x30e6('0x24')]['findOne']({'where':{'id':_0x5a9f4e},'transaction':_0x335d2c})[_0x30e6('0x15')](function(_0xa0bcb0){if(_0xa0bcb0){return db['VoiceExtension'][_0x30e6('0x54')]({'where':{'VoiceExtensionId':_0x5a9f4e},'transaction':_0x335d2c})[_0x30e6('0x15')](function(){var _0x29b535=_[_0x30e6('0x1d')](_0x55d16d,function(_0x1ebb01){_0x1ebb01[_0x30e6('0x55')]=_0x5a9f4e;_0x1ebb01[_0x30e6('0x56')]=!![];return _0x1ebb01;});return _0xa0bcb0['createRouting'](_0x29b535);})[_0x30e6('0x15')](function(_0x11e768){return db[_0x30e6('0x24')][_0x30e6('0x57')](_0x11e768,{'transaction':_0x335d2c});});}else{_0x3dd35e=0x194;_0x1fb8bc=[];}});})[_0x30e6('0x15')](function(){if(_0x3dd35e!==0x194){return db[_0x30e6('0x24')][_0x30e6('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5a9f4e},'order':_0x30e6('0x59')})[_0x30e6('0x15')](function(_0x1e895d){_0x1fb8bc=_0x1e895d;});}})[_0x30e6('0x37')](function(_0x2bc4b){_0x3dd35e=0x1f4;logger[_0x30e6('0x21')](_0x2bc4b['stack']);if(_0x2bc4b[_0x30e6('0x20')]){delete _0x2bc4b[_0x30e6('0x20')];}_0x1fb8bc=_0x2bc4b;})['finally'](function(){if(_0x1fb8bc===null){_0x216e06[_0x30e6('0xc')](_0x3dd35e);}else{if(_0x3dd35e===0x1f4){_0x216e06[_0x30e6('0xe')](_0x3dd35e)[_0x30e6('0x22')](_0x1fb8bc);}else{_0x216e06['status'](_0x3dd35e)['json'](_0x1fb8bc);}}});}; \ No newline at end of file +var _0x0c81=['json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','type','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','sequelize','transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status'];(function(_0x543beb,_0x5da855){var _0x4f98a0=function(_0x3dcf7b){while(--_0x3dcf7b){_0x543beb['push'](_0x543beb['shift']());}};_0x4f98a0(++_0x5da855);}(_0x0c81,0x1b9));var _0x10c8=function(_0x498118,_0x1c8762){_0x498118=_0x498118-0x0;var _0x5d5617=_0x0c81[_0x498118];return _0x5d5617;};'use strict';var _=require(_0x10c8('0x0'));var Redis=require(_0x10c8('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x10c8('0x2'))(_0x10c8('0x3'));var config=require(_0x10c8('0x4'));var db=require(_0x10c8('0x5'))['db'];config[_0x10c8('0x6')]=_[_0x10c8('0x7')](config[_0x10c8('0x6')],{'host':_0x10c8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10c8('0x6')]));require(_0x10c8('0x9'))[_0x10c8('0xa')](socket);function respondWithStatusCode(_0x55c778,_0x38b496){_0x38b496=_0x38b496||0xcc;return function(_0x5e4ee5){if(_0x5e4ee5){return _0x55c778[_0x10c8('0xb')](_0x38b496);}return _0x55c778['status'](_0x38b496)[_0x10c8('0xc')]();};}function respondWithResult(_0x2f8e15,_0x434aac){_0x434aac=_0x434aac||0xc8;return function(_0xcd905){if(_0xcd905){return _0x2f8e15[_0x10c8('0xd')](_0x434aac)[_0x10c8('0xe')](_0xcd905);}};}function respondWithFilteredResult(_0x333286,_0x2c1fc2){return function(_0x1d1717){if(_0x1d1717){var _0x2e82da=typeof _0x2c1fc2[_0x10c8('0xf')]===_0x10c8('0x10')&&typeof _0x2c1fc2[_0x10c8('0x11')]===_0x10c8('0x10');var _0x4e9ae4=_0x1d1717[_0x10c8('0x12')];var _0x3e6b6e=_0x2e82da?0x0:_0x2c1fc2[_0x10c8('0xf')];var _0x5d026c=_0x2e82da?_0x1d1717[_0x10c8('0x12')]:_0x2c1fc2['offset']+_0x2c1fc2['limit'];var _0x8f50f5;if(_0x5d026c>=_0x4e9ae4){_0x5d026c=_0x4e9ae4;_0x8f50f5=0xc8;}else{_0x8f50f5=0xce;}_0x333286['status'](_0x8f50f5);return _0x333286[_0x10c8('0x13')](_0x10c8('0x14'),_0x3e6b6e+'-'+_0x5d026c+'/'+_0x4e9ae4)[_0x10c8('0xe')](_0x1d1717);}return null;};}function removeEntity(_0x4aa814){return function(_0x276346){if(_0x276346){return _0x276346[_0x10c8('0x15')]()['then'](function(){var _0x1ccd3d=_0x276346[_0x10c8('0x16')]({'plain':!![]});var _0x5364e4=[{'name':_0x10c8('0x17'),'value':_0x10c8('0x18'),'ignore':![]},{'name':_0x10c8('0x19'),'value':_0x10c8('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0x10c8('0x1b'),'ignore':![]}];var _0x58af55=_(_0x5364e4)[_0x10c8('0x1c')](_0x10c8('0x1d'))[_0x10c8('0x1e')](_0x10c8('0x1f'))[_0x10c8('0x1f')]();if(_['includes'](_0x58af55,_0x1ccd3d['type'])){return;}var _0x1846a3=_['find'](_0x5364e4,[_0x10c8('0x1f'),_0x1ccd3d[_0x10c8('0x20')]])[_0x10c8('0x21')];return db[_0x10c8('0x22')][_0x10c8('0x15')]({'where':{'type':_0x1846a3,'resourceId':_0x1ccd3d['id']}})[_0x10c8('0x23')](function(){return _0x276346;});})['then'](function(){_0x4aa814[_0x10c8('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x367fc4){return function(_0x3f296a){if(!_0x3f296a){_0x367fc4[_0x10c8('0xb')](0x194);}return _0x3f296a;};}function handleError(_0x137161,_0x3ba9ee){_0x3ba9ee=_0x3ba9ee||0x1f4;return function(_0x21df9a){logger[_0x10c8('0x24')](_0x21df9a[_0x10c8('0x25')]);if(_0x21df9a[_0x10c8('0x21')]){delete _0x21df9a['name'];}_0x137161[_0x10c8('0xd')](_0x3ba9ee)[_0x10c8('0x26')](_0x21df9a);};}exports[_0x10c8('0x27')]=function(_0xd05401,_0x533b80){var _0x1ceb75={},_0x6bbf12={},_0x8b42b1={'count':0x0,'rows':[]};var _0x42b61f=_[_0x10c8('0x1e')](db[_0x10c8('0x28')]['rawAttributes'],function(_0x26b138){return{'name':_0x26b138['fieldName'],'type':_0x26b138[_0x10c8('0x20')]['key']};});_0x6bbf12[_0x10c8('0x29')]=_['map'](_0x42b61f,_0x10c8('0x21'));_0x6bbf12[_0x10c8('0x2a')]=_['keys'](_0xd05401[_0x10c8('0x2a')]);_0x6bbf12[_0x10c8('0x2b')]=_[_0x10c8('0x2c')](_0x6bbf12[_0x10c8('0x29')],_0x6bbf12[_0x10c8('0x2a')]);_0x1ceb75[_0x10c8('0x2d')]=_[_0x10c8('0x2c')](_0x6bbf12[_0x10c8('0x29')],qs[_0x10c8('0x2e')](_0xd05401[_0x10c8('0x2a')]['fields']));_0x1ceb75['attributes']=_0x1ceb75['attributes'][_0x10c8('0x2f')]?_0x1ceb75[_0x10c8('0x2d')]:_0x6bbf12['model'];if(!_0xd05401[_0x10c8('0x2a')][_0x10c8('0x30')](_0x10c8('0x31'))){_0x1ceb75[_0x10c8('0x11')]=qs['limit'](_0xd05401[_0x10c8('0x2a')][_0x10c8('0x11')]);_0x1ceb75['offset']=qs[_0x10c8('0xf')](_0xd05401[_0x10c8('0x2a')][_0x10c8('0xf')]);}_0x1ceb75[_0x10c8('0x32')]=qs[_0x10c8('0x33')](_0xd05401[_0x10c8('0x2a')][_0x10c8('0x33')]);_0x1ceb75[_0x10c8('0x34')]=qs[_0x10c8('0x2b')](_[_0x10c8('0x35')](_0xd05401[_0x10c8('0x2a')],_0x6bbf12[_0x10c8('0x2b')]),_0x42b61f);if(_0xd05401[_0x10c8('0x2a')][_0x10c8('0x1c')]){_0x1ceb75[_0x10c8('0x34')]=_[_0x10c8('0x36')](_0x1ceb75[_0x10c8('0x34')],{'$or':_[_0x10c8('0x1e')](_0x42b61f,function(_0x5335cc){if(_0x5335cc['type']!=='VIRTUAL'){var _0x54b2bf={};_0x54b2bf[_0x5335cc[_0x10c8('0x21')]]={'$like':'%'+_0xd05401[_0x10c8('0x2a')][_0x10c8('0x1c')]+'%'};return _0x54b2bf;}})});}_0x1ceb75=_['merge']({},_0x1ceb75,_0xd05401[_0x10c8('0x37')]);var _0x5c1982={'where':_0x1ceb75[_0x10c8('0x34')]};return db[_0x10c8('0x28')][_0x10c8('0x12')](_0x5c1982)['then'](function(_0x4638fe){_0x8b42b1[_0x10c8('0x12')]=_0x4638fe;if(_0xd05401['query'][_0x10c8('0x38')]){_0x1ceb75[_0x10c8('0x39')]=[{'all':!![]}];}return db[_0x10c8('0x28')][_0x10c8('0x3a')](_0x1ceb75);})[_0x10c8('0x23')](function(_0xf8f8dd){_0x8b42b1[_0x10c8('0x3b')]=_0xf8f8dd;return _0x8b42b1;})['then'](respondWithFilteredResult(_0x533b80,_0x1ceb75))[_0x10c8('0x3c')](handleError(_0x533b80,null));};exports[_0x10c8('0x3d')]=function(_0x654bb1,_0x489428){var _0x5461a8={'raw':![],'where':{'id':_0x654bb1[_0x10c8('0x3e')]['id']}},_0x31fab1={};_0x31fab1['model']=_['keys'](db[_0x10c8('0x28')][_0x10c8('0x3f')]);_0x31fab1['query']=_['keys'](_0x654bb1['query']);_0x31fab1[_0x10c8('0x2b')]=_[_0x10c8('0x2c')](_0x31fab1[_0x10c8('0x29')],_0x31fab1['query']);_0x5461a8['attributes']=_['intersection'](_0x31fab1[_0x10c8('0x29')],qs['fields'](_0x654bb1[_0x10c8('0x2a')][_0x10c8('0x2e')]));_0x5461a8[_0x10c8('0x2d')]=_0x5461a8[_0x10c8('0x2d')]['length']?_0x5461a8[_0x10c8('0x2d')]:_0x31fab1['model'];if(_0x654bb1[_0x10c8('0x2a')]['includeAll']){_0x5461a8[_0x10c8('0x39')]=[{'all':!![]}];}_0x5461a8=_[_0x10c8('0x36')]({},_0x5461a8,_0x654bb1['options']);return db[_0x10c8('0x28')][_0x10c8('0x40')](_0x5461a8)['then'](handleEntityNotFound(_0x489428,null))[_0x10c8('0x23')](respondWithResult(_0x489428,null))[_0x10c8('0x3c')](handleError(_0x489428,null));};exports[_0x10c8('0x15')]=function(_0x5c5998,_0x231409){return db[_0x10c8('0x28')]['find']({'where':{'id':_0x5c5998['params']['id']}})[_0x10c8('0x23')](handleEntityNotFound(_0x231409,null))[_0x10c8('0x23')](removeEntity(_0x231409,null))[_0x10c8('0x3c')](handleError(_0x231409,null));};exports[_0x10c8('0x41')]=function(_0x311cbb,_0x3f6f05){if(_0x311cbb['body'][_0x10c8('0x20')]===_0x10c8('0x1a')&&!_['startsWith'](_0x311cbb[_0x10c8('0x42')][_0x10c8('0x43')],'_')){_0x311cbb['body'][_0x10c8('0x43')]='_'['concat'](_0x311cbb[_0x10c8('0x42')][_0x10c8('0x43')]);}return db[_0x10c8('0x28')][_0x10c8('0x41')](_0x311cbb[_0x10c8('0x42')],{'raw':![]})[_0x10c8('0x23')](function(_0x49eff6){var _0x1c784d=_0x311cbb[_0x10c8('0x44')][_0x10c8('0x16')]({'plain':!![]});if(!_0x1c784d)throw new Error(_0x10c8('0x45'));if(_0x1c784d[_0x10c8('0x46')]===_0x10c8('0x44')){var _0xa30fe3=_0x49eff6[_0x10c8('0x16')]({'plain':!![]});var _0x138d37=[{'name':_0x10c8('0x17'),'value':_0x10c8('0x18')},{'name':_0x10c8('0x19'),'value':_0x10c8('0x1a')},{'name':'InternalRoutes','value':_0x10c8('0x1b')}];var _0x40c465=_[_0x10c8('0x40')](_0x138d37,[_0x10c8('0x1f'),_0xa30fe3[_0x10c8('0x20')]])[_0x10c8('0x21')];return db[_0x10c8('0x47')]['find']({'where':{'name':_0x40c465,'userProfileId':_0x1c784d[_0x10c8('0x48')]},'raw':!![]})[_0x10c8('0x23')](function(_0x4e5270){if(_0x4e5270&&_0x4e5270[_0x10c8('0x49')]===0x0){return db[_0x10c8('0x22')][_0x10c8('0x41')]({'name':_0xa30fe3[_0x10c8('0x21')],'resourceId':_0xa30fe3['id'],'type':_0x4e5270[_0x10c8('0x21')],'sectionId':_0x4e5270['id']},{})[_0x10c8('0x23')](function(){return _0x49eff6;});}else{return _0x49eff6;}})[_0x10c8('0x3c')](function(_0x5e3d0b){logger['error'](_0x10c8('0x4a'),_0x5e3d0b);throw _0x5e3d0b;});}return _0x49eff6;})['then'](respondWithResult(_0x3f6f05,0xc9))[_0x10c8('0x3c')](handleError(_0x3f6f05,null));};exports[_0x10c8('0x4b')]=function(_0x43c1b6,_0x48141a){if(_0x43c1b6[_0x10c8('0x42')]['id']){delete _0x43c1b6['body']['id'];}return db[_0x10c8('0x28')][_0x10c8('0x40')]({'where':{'id':_0x43c1b6[_0x10c8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x48141a,null))[_0x10c8('0x23')](function(_0x141475){if(_0x141475){return db[_0x10c8('0x28')][_0x10c8('0x4b')](_[_0x10c8('0x35')](_0x43c1b6[_0x10c8('0x42')],[_0x10c8('0x43'),_0x10c8('0x4c'),_0x10c8('0x4d'),_0x10c8('0x4e'),_0x10c8('0x4f'),_0x10c8('0x50'),'alias']),{'where':{'context':_0x141475['context'],'exten':_0x141475[_0x10c8('0x43')]},'individualHooks':!![]})['then'](function(_0x394f27){return _0x394f27;});}return null;})[_0x10c8('0x23')](respondWithStatusCode(_0x48141a,null))[_0x10c8('0x3c')](handleError(_0x48141a,null));};exports['addApplications']=function(_0x444482,_0x53cb61){var _0x4b966a=_0x444482[_0x10c8('0x3e')]['id'];var _0x3f1511=_0x444482[_0x10c8('0x42')];var _0x86577b=0xc8;var _0x386b11=null;return db[_0x10c8('0x51')][_0x10c8('0x52')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x10c8('0x53')]},function(_0x3d37f6){return db[_0x10c8('0x28')][_0x10c8('0x54')]({'where':{'id':_0x4b966a},'transaction':_0x3d37f6})[_0x10c8('0x23')](function(_0x18f746){if(_0x18f746){return db[_0x10c8('0x28')][_0x10c8('0x15')]({'where':{'VoiceExtensionId':_0x4b966a},'transaction':_0x3d37f6})[_0x10c8('0x23')](function(){var _0x1d5681=_[_0x10c8('0x1e')](_0x3f1511,function(_0x45f4a6){_0x45f4a6[_0x10c8('0x55')]=_0x4b966a;_0x45f4a6[_0x10c8('0x56')]=!![];return _0x45f4a6;});return _0x18f746[_0x10c8('0x57')](_0x1d5681);})[_0x10c8('0x23')](function(_0x4bc464){return db[_0x10c8('0x28')][_0x10c8('0x58')](_0x4bc464,{'transaction':_0x3d37f6});});}else{_0x86577b=0x194;_0x386b11=[];}});})[_0x10c8('0x23')](function(){if(_0x86577b!==0x194){return db[_0x10c8('0x28')][_0x10c8('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4b966a},'order':_0x10c8('0x5a')})['then'](function(_0x1602c3){_0x386b11=_0x1602c3;});}})['catch'](function(_0x3c9aeb){_0x86577b=0x1f4;logger[_0x10c8('0x24')](_0x3c9aeb['stack']);if(_0x3c9aeb[_0x10c8('0x21')]){delete _0x3c9aeb[_0x10c8('0x21')];}_0x386b11=_0x3c9aeb;})['finally'](function(){if(_0x386b11===null){_0x53cb61['sendStatus'](_0x86577b);}else{if(_0x86577b===0x1f4){_0x53cb61['status'](_0x86577b)['send'](_0x386b11);}else{_0x53cb61[_0x10c8('0xd')](_0x86577b)[_0x10c8('0xe')](_0x386b11);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 9c55908..bb7bd4a 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 _0xbfd5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xbfd5,0x162));var _0x5bfd=function(_0x4c6b28,_0x3581b0){_0x4c6b28=_0x4c6b28-0x0;var _0x53ad92=_0xbfd5[_0x4c6b28];return _0x53ad92;};'use strict';var EventEmitter=require(_0x5bfd('0x0'));var VoiceExtension=require(_0x5bfd('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5bfd('0x2')](0x0);var events={'afterCreate':_0x5bfd('0x3'),'afterUpdate':_0x5bfd('0x4'),'afterDestroy':_0x5bfd('0x5')};function emitEvent(_0x1b66b1){return function(_0x251f71,_0x773ee2,_0x13ded5){VoiceExtensionEvents[_0x5bfd('0x6')](_0x1b66b1+':'+_0x251f71['id'],_0x251f71);VoiceExtensionEvents['emit'](_0x1b66b1,_0x251f71);_0x13ded5(null);};}for(var e in events){if(events[_0x5bfd('0x7')](e)){var event=events[e];VoiceExtension[_0x5bfd('0x8')](e,emitEvent(event));}}module[_0x5bfd('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0x136b=['exports','setMaxListeners','update','remove','emit','hook'];(function(_0x329ad4,_0x467cd1){var _0xea8fa1=function(_0x1395b3){while(--_0x1395b3){_0x329ad4['push'](_0x329ad4['shift']());}};_0xea8fa1(++_0x467cd1);}(_0x136b,0xdf));var _0xb136=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x136b[_0x2b7764];return _0x848dcb;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb136('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb136('0x1'),'afterDestroy':_0xb136('0x2')};function emitEvent(_0x1451eb){return function(_0x55ffd7,_0xcee6d4,_0x58d02b){VoiceExtensionEvents[_0xb136('0x3')](_0x1451eb+':'+_0x55ffd7['id'],_0x55ffd7);VoiceExtensionEvents[_0xb136('0x3')](_0x1451eb,_0x55ffd7);_0x58d02b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0xb136('0x4')](e,emitEvent(event));}}module[_0xb136('0x5')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 9cd797c..5ba444c 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 _0x0f4d=['context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','then','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','outboundDial','appdata','priority','last','define','voice_extensions','get','concat','models','type','Set','CDR(type)='];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x2014a1,_0x404088){_0x2014a1=_0x2014a1-0x0;var _0x219dbc=_0x0f4d[_0x2014a1];return _0x219dbc;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x8b419){var _0x5c8510=_0x8b419[_0xd0f4('0x0')];function _0x2c06de(_0x3ac2a3){var _0x347170=0x2;var _0x1a9ba5=[{'type':_0x3ac2a3[_0xd0f4('0x1')],'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x3')+_0x3ac2a3['type'],'context':_0x3ac2a3[_0xd0f4('0x4')],'exten':_0x3ac2a3[_0xd0f4('0x5')],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']},{'type':_0x3ac2a3['type'],'app':_0x3ac2a3[_0xd0f4('0x6')]?_0xd0f4('0x2'):'NoOp','appdata':_0x3ac2a3[_0xd0f4('0x6')]?_0xd0f4('0x7')+_0x3ac2a3['alias']:_0xd0f4('0x8'),'context':_0x3ac2a3[_0xd0f4('0x4')],'exten':_0x3ac2a3[_0xd0f4('0x5')],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']}];if(_0x3ac2a3['type']==='inbound'){_0x1a9ba5[_0xd0f4('0x9')]({'type':_0xd0f4('0xa'),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0xb')+_0x3ac2a3['id'],'context':_0x3ac2a3[_0xd0f4('0x4')],'exten':_0x3ac2a3[_0xd0f4('0x5')],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']});}_0x1a9ba5[_0xd0f4('0x9')]({'type':_0x3ac2a3['type'],'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0xc'),'context':_0x3ac2a3['context'],'exten':_0x3ac2a3[_0xd0f4('0x5')],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']},{'type':_0x3ac2a3['type'],'app':_0xd0f4('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3ac2a3[_0xd0f4('0x4')],'exten':_0x3ac2a3['exten'],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']},{'type':_0x3ac2a3['type'],'app':'Set','appdata':_0xd0f4('0xd'),'context':_0x3ac2a3[_0xd0f4('0x4')],'exten':_0x3ac2a3[_0xd0f4('0x5')],'priority':_0x347170++,'VoiceExtensionId':_0x3ac2a3['id']});return _0x1a9ba5;}function _0x46c005(_0x2d5d3f){var _0x10acbe=0x2;var _0xe8cefc=[{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':'CDR(type)=outbound','context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0x2d5d3f[_0xd0f4('0x6')]?'Set':_0xd0f4('0xf'),'appdata':_0x2d5d3f[_0xd0f4('0x6')]?_0xd0f4('0x7')+_0x2d5d3f[_0xd0f4('0x6')]:'No\x20alias\x20set','context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x10')+(_0x2d5d3f[_0xd0f4('0x11')]?_0xd0f4('0x12')+_0x2d5d3f['cutdigits']+'}':_0xd0f4('0x13')),'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':'Set','appdata':_0xd0f4('0xb')+_0x2d5d3f['id'],'context':_0x2d5d3f['context'],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x14'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x10acbe+0x2)+_0xd0f4('0x15')+(_0x10acbe+0x1)+')','context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':_0x2d5d3f['cutdigits']?_0xd0f4('0x16')+_0x2d5d3f[_0xd0f4('0x11')]+'}':_0xd0f4('0x17'),'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0xc'),'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f['exten'],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x18'),'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f['exten'],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2d5d3f['context'],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x19')+_0x2d5d3f['id'],'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']}];if(_0x2d5d3f[_0xd0f4('0x1a')](_0xd0f4('0x1b'))&&_0x2d5d3f['recordingFormat']!==_0xd0f4('0x1c')){_0xe8cefc['push']({'type':_0xd0f4('0xe'),'app':_0xd0f4('0x2'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x2d5d3f['context'],'exten':_0x2d5d3f[_0xd0f4('0x5')],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']},{'type':'outbound','app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x1d')+_0x2d5d3f['recordingFormat']||_0xd0f4('0x1e'),'context':_0x2d5d3f[_0xd0f4('0x4')],'exten':_0x2d5d3f['exten'],'priority':_0x10acbe++,'VoiceExtensionId':_0x2d5d3f['id']});}return _0xe8cefc;}function _0x590a66(_0x3605fe,_0x1f22d3){var _0x4e2ce0=[{'name':_0xd0f4('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xd0f4('0x20'),'param':0x2},{'name':_0xd0f4('0x21'),'param':0x3}];var _0x4eb384={};var _0x3280a9=_0x1f22d3[_0xd0f4('0x22')](',');var _0x40e383=[];for(var _0x3f3ed6=0x0;_0x3f3ed6<_0x4e2ce0[_0xd0f4('0x23')];_0x3f3ed6++){switch(_0x4e2ce0[_0x3f3ed6]['name']){case _0xd0f4('0x1f'):_0x4eb384[_0xd0f4('0x1f')]=_0x3280a9[_0x4e2ce0[_0x3f3ed6][_0xd0f4('0x24')]][_0xd0f4('0x22')]('/')[0x1];_0x4eb384['phone']=_0x3280a9[_0x4e2ce0[_0x3f3ed6][_0xd0f4('0x24')]][_0xd0f4('0x22')]('/')[0x2];_0x4eb384[_0xd0f4('0x25')]=_0x4eb384[_0xd0f4('0x26')]?_0x4eb384[_0xd0f4('0x26')][_0xd0f4('0x22')]('$')[0x0]:undefined;_0x4eb384['phone']=_0x3605fe[_0xd0f4('0x11')]?(_0x4eb384[_0xd0f4('0x25')]||'')+_0xd0f4('0x12')+_0x3605fe['cutdigits']+'}':(_0x4eb384[_0xd0f4('0x25')]||'')+_0xd0f4('0x13');_0x40e383[_0x4e2ce0[_0x3f3ed6]['param']]=[_0xd0f4('0x27'),_0x4eb384[_0xd0f4('0x1f')],_0x4eb384['phone']]['join']('/');break;case _0xd0f4('0x20'):_0x4eb384[_0xd0f4('0x20')]=_0x3280a9[_0x4e2ce0[_0x3f3ed6][_0xd0f4('0x24')]];if(_0x3605fe['recordingFormat']!==_0xd0f4('0x1c')){if(_0x4eb384['options'][_0xd0f4('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x4eb384[_0xd0f4('0x20')]+=_0xd0f4('0x29');}}else{_0x4eb384[_0xd0f4('0x20')]=_0x4eb384[_0xd0f4('0x20')]['replace'](_0xd0f4('0x29'),'');}_0x40e383[_0x4e2ce0[_0x3f3ed6][_0xd0f4('0x24')]]=_0x4eb384[_0xd0f4('0x20')];break;default:_0x40e383[_0x4e2ce0[_0x3f3ed6]['param']]=_0x3280a9[_0x4e2ce0[_0x3f3ed6]['param']];}}return _0x40e383[_0xd0f4('0x2a')](',');}function _0x457e2d(_0x10491b,_0x312c14,_0x25da19){return new Promise(function(_0x2b8f94,_0x76a147){var _0x2a65e3=[];if(_[_0xd0f4('0x2b')](_0x312c14))return _0x2b8f94(_0x2a65e3);_0x5c8510[_0xd0f4('0x2c')][_0xd0f4('0x2d')]({'attributes':['id',_0xd0f4('0x2e'),'IntervalId'],'raw':!![]})[_0xd0f4('0x2f')](function(_0x234230){for(var _0x4dc71c=0x0,_0x2a9799=0x0;_0x4dc71c<_0x312c14[_0xd0f4('0x23')];_0x4dc71c++,_0x2a9799=0x0){var _0xd3dcd=_0x312c14[_0x4dc71c];var _0x2d4df6=[];var _0x209da0=[];delete _0xd3dcd['id'];if(_0xd3dcd[_0xd0f4('0x2e')]!==_0xd0f4('0x30')){_0xd3dcd['intervals']=[_0xd3dcd[_0xd0f4('0x2e')]];}else{_0xd3dcd[_0xd0f4('0x31')]=_0xd3dcd[_0xd0f4('0x32')]?_['map'](_[_0xd0f4('0x33')](_0x234230,{'IntervalId':_0xd3dcd[_0xd0f4('0x32')]}),_0xd0f4('0x2e')):[];}_0xd3dcd[_0xd0f4('0x4')]=_0x10491b[_0xd0f4('0x4')];_0xd3dcd[_0xd0f4('0x5')]=_0x10491b['exten'];if(_0xd3dcd['type'])_0xd3dcd[_0xd0f4('0x1')]=_0xd3dcd[_0xd0f4('0x1')][_0xd0f4('0x34')]();if(_0x10491b[_0xd0f4('0x1')]==='outbound'){if(_0xd3dcd[_0xd0f4('0x1a')](_0xd0f4('0x35'))&&_0xd3dcd['tag']&&_0xd3dcd[_0xd0f4('0x35')]!=='--'){_0x2d4df6[_0xd0f4('0x9')]({'type':_0xd3dcd[_0xd0f4('0x1')][_0xd0f4('0x34')](),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x36')+_0xd3dcd[_0xd0f4('0x35')],'context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b[_0xd0f4('0x5')],'priority':_0xd3dcd[_0xd0f4('0x31')][_0xd0f4('0x23')]+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});}_0x2d4df6[_0xd0f4('0x9')]({'type':_0xd3dcd[_0xd0f4('0x1')]['toLowerCase'](),'app':_0xd0f4('0x14'),'appdata':_0xd0f4('0x37')+(_0xd3dcd[_0xd0f4('0x38')]?'Set(CALLERID(all)='+_0xd3dcd[_0xd0f4('0x38')]+')':_0xd0f4('0x39')),'context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b['exten'],'priority':_0xd3dcd[_0xd0f4('0x31')]['length']+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});}else{if(_0xd3dcd[_0xd0f4('0x1a')]('answer')){if(['queue',_0xd0f4('0x3a')][_0xd0f4('0x3b')](_0xd3dcd[_0xd0f4('0x3c')][_0xd0f4('0x34')]())&&_0xd3dcd[_0xd0f4('0x3d')]!==_0xd0f4('0x3e')){if(_0xd3dcd['answer']){_0x2d4df6[_0xd0f4('0x9')]({'type':_0xd3dcd[_0xd0f4('0x1')][_0xd0f4('0x34')](),'app':_0xd0f4('0x14'),'appdata':_0xd0f4('0x3f'),'context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b['exten'],'priority':_0xd3dcd[_0xd0f4('0x31')]['length']+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});_0x2d4df6['push']({'type':_0xd3dcd[_0xd0f4('0x1')][_0xd0f4('0x34')](),'app':_0xd0f4('0x2'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b[_0xd0f4('0x5')],'priority':_0xd3dcd[_0xd0f4('0x31')][_0xd0f4('0x23')]+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});}else{_0x2d4df6[_0xd0f4('0x9')]({'type':_0xd3dcd[_0xd0f4('0x1')][_0xd0f4('0x34')](),'app':_0xd0f4('0x14'),'appdata':_0xd0f4('0x40'),'context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b['exten'],'priority':_0xd3dcd[_0xd0f4('0x31')][_0xd0f4('0x23')]+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});_0x2d4df6[_0xd0f4('0x9')]({'type':_0xd3dcd[_0xd0f4('0x1')]['toLowerCase'](),'app':_0xd0f4('0x2'),'appdata':_0xd0f4('0x41'),'context':_0x10491b[_0xd0f4('0x4')],'exten':_0x10491b[_0xd0f4('0x5')],'priority':_0xd3dcd[_0xd0f4('0x31')][_0xd0f4('0x23')]+_0x25da19+_0x2a9799++,'VoiceExtensionId':_0x10491b['id']});}}}}for(var _0x57497b=0x0;_0x57497b<_0xd3dcd['intervals'][_0xd0f4('0x23')];_0x57497b++){var _0x1fede8=_0x25da19+_0xd3dcd[_0xd0f4('0x31')][_0xd0f4('0x23')];var _0x2fd338=_0x57497b===_0xd3dcd[_0xd0f4('0x31')]['length']-0x1?_0x25da19+_0x2d4df6[_0xd0f4('0x23')]+_0x209da0[_0xd0f4('0x23')]+0x2:_0x25da19+_0x57497b+0x1;_0x2d4df6[_0xd0f4('0x42')](_0x57497b,0x0,{'type':_0x10491b['type'],'app':_0xd0f4('0x43'),'appdata':_0xd3dcd[_0xd0f4('0x31')][_0x57497b]+'?'+_0x10491b['context']+',${EXTEN},'+_0x1fede8+':'+_0x10491b[_0xd0f4('0x4')]+',${EXTEN},'+_0x2fd338,'exten':_0x10491b[_0xd0f4('0x5')],'context':_0x10491b[_0xd0f4('0x4')],'priority':_0x25da19+_0x57497b,'VoiceExtensionId':_0x10491b['id']});}if(_0xd3dcd['appType']===_0xd0f4('0x44'))_0xd3dcd[_0xd0f4('0x45')]=_0x590a66(_0x10491b,_0xd3dcd['appdata']);_0xd3dcd[_0xd0f4('0x46')]=_0x2d4df6[_0xd0f4('0x23')]?_[_0xd0f4('0x47')](_0x2d4df6)['priority']+0x1:_0x25da19;_0x2a65e3=_['concat'](_0x2a65e3,_0x2d4df6,[_0xd3dcd],_0x209da0);_0x25da19=_[_0xd0f4('0x47')](_0x2a65e3)[_0xd0f4('0x46')]+0x1;}return _0x2b8f94(_0x2a65e3);})['catch'](function(_0x351461){_0x76a147(_0x351461);});});}return _0x8b419[_0xd0f4('0x48')]('VoiceExtension',attributes,{'tableName':_0xd0f4('0x49'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1bba7d){var _0x3014cd=this[_0xd0f4('0x4a')]({'plain':!![]});var _0x2e09ac=_0x3014cd['type']===_0xd0f4('0xe')?_0x46c005(_0x3014cd):_0x2c06de(_0x3014cd);return _0x457e2d(_0x3014cd,_0x1bba7d,_['last'](_0x2e09ac)[_0xd0f4('0x46')]+0x1)[_0xd0f4('0x2f')](function(_0x403240){var _0x325970=_[_0xd0f4('0x4b')](_0x2e09ac,_0x403240);_0x325970['push']({'type':_0x3014cd['type'],'app':'Hangup','exten':_0x3014cd[_0xd0f4('0x5')],'context':_0x3014cd[_0xd0f4('0x4')],'priority':_[_0xd0f4('0x47')](_0x325970)[_0xd0f4('0x46')]+0x1,'VoiceExtensionId':_0x3014cd['id']});return _0x325970;});}}});}; \ No newline at end of file +var _0x031f=['phone','prefix','${EXTEN}','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','filter','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','priority','concat','catch','define','VoiceExtension','voice_extensions','get','last','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','length','name','param','split'];(function(_0x145b74,_0x36171d){var _0x18a5f0=function(_0xfbbd55){while(--_0xfbbd55){_0x145b74['push'](_0x145b74['shift']());}};_0x18a5f0(++_0x36171d);}(_0x031f,0x1c2));var _0xf031=function(_0x24bc60,_0x4f10d3){_0x24bc60=_0x24bc60-0x0;var _0x7abe12=_0x031f[_0x24bc60];return _0x7abe12;};'use strict';var _=require(_0xf031('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xf031('0x1')]=function(_0x4b6f45){var _0x41ba47=_0x4b6f45[_0xf031('0x2')];function _0x14a69c(_0x1df6b3){var _0x4901fd=0x2;var _0x363a55=[{'type':_0x1df6b3[_0xf031('0x3')],'app':_0xf031('0x4'),'appdata':_0xf031('0x5')+_0x1df6b3[_0xf031('0x3')],'context':_0x1df6b3[_0xf031('0x6')],'exten':_0x1df6b3[_0xf031('0x7')],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']},{'type':_0x1df6b3['type'],'app':_0x1df6b3[_0xf031('0x8')]?_0xf031('0x4'):_0xf031('0x9'),'appdata':_0x1df6b3[_0xf031('0x8')]?_0xf031('0xa')+_0x1df6b3[_0xf031('0x8')]:_0xf031('0xb'),'context':_0x1df6b3['context'],'exten':_0x1df6b3[_0xf031('0x7')],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']}];if(_0x1df6b3[_0xf031('0x3')]==='inbound'){_0x363a55[_0xf031('0xc')]({'type':_0xf031('0xd'),'app':_0xf031('0x4'),'appdata':'CDR(routeid)='+_0x1df6b3['id'],'context':_0x1df6b3['context'],'exten':_0x1df6b3['exten'],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']});}_0x363a55[_0xf031('0xc')]({'type':_0x1df6b3[_0xf031('0x3')],'app':'Set','appdata':_0xf031('0xe'),'context':_0x1df6b3[_0xf031('0x6')],'exten':_0x1df6b3[_0xf031('0x7')],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']},{'type':_0x1df6b3[_0xf031('0x3')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1df6b3['context'],'exten':_0x1df6b3[_0xf031('0x7')],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']},{'type':_0x1df6b3[_0xf031('0x3')],'app':_0xf031('0x4'),'appdata':_0xf031('0xf'),'context':_0x1df6b3['context'],'exten':_0x1df6b3[_0xf031('0x7')],'priority':_0x4901fd++,'VoiceExtensionId':_0x1df6b3['id']});return _0x363a55;}function _0x211c93(_0x480945){var _0x548e4a=0x2;var _0x3903bb=[{'type':_0xf031('0x10'),'app':_0xf031('0x4'),'appdata':_0xf031('0x11'),'context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':_0x480945[_0xf031('0x8')]?_0xf031('0x4'):_0xf031('0x9'),'appdata':_0x480945['alias']?_0xf031('0xa')+_0x480945['alias']:_0xf031('0xb'),'context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':_0xf031('0x4'),'appdata':_0xf031('0x12')+(_0x480945['cutdigits']?_0xf031('0x13')+_0x480945[_0xf031('0x14')]+'}':'${EXTEN}'),'context':_0x480945['context'],'exten':_0x480945['exten'],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':'Set','appdata':_0xf031('0x15')+_0x480945['id'],'context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':_0xf031('0x16'),'appdata':_0xf031('0x17')+(_0x548e4a+0x2)+_0xf031('0x18')+(_0x548e4a+0x1)+')','context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':'outbound','app':_0xf031('0x4'),'appdata':_0x480945['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x480945['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':'Set','appdata':_0xf031('0xe'),'context':_0x480945[_0xf031('0x6')],'exten':_0x480945['exten'],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':_0xf031('0x4'),'appdata':_0xf031('0x19'),'context':_0x480945[_0xf031('0x6')],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':_0xf031('0x4'),'appdata':_0xf031('0xf'),'context':_0x480945['context'],'exten':_0x480945[_0xf031('0x7')],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0x480945['id'],'context':_0x480945[_0xf031('0x6')],'exten':_0x480945['exten'],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']}];if(_0x480945[_0xf031('0x1a')]('recordingFormat')&&_0x480945[_0xf031('0x1b')]!==_0xf031('0x1c')){_0x3903bb[_0xf031('0xc')]({'type':_0xf031('0x10'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x480945['context'],'exten':_0x480945['exten'],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']},{'type':_0xf031('0x10'),'app':'Set','appdata':_0xf031('0x1d')+_0x480945[_0xf031('0x1b')]||'wav','context':_0x480945['context'],'exten':_0x480945['exten'],'priority':_0x548e4a++,'VoiceExtensionId':_0x480945['id']});}return _0x3903bb;}function _0x38182f(_0x30386e,_0x185cb8){var _0x97c273=[{'name':_0xf031('0x1e'),'param':0x0},{'name':_0xf031('0x1f'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0xc3adae={};var _0xb363e5=_0x185cb8['split'](',');var _0x4b5b9d=[];for(var _0x5cbb4b=0x0;_0x5cbb4b<_0x97c273[_0xf031('0x20')];_0x5cbb4b++){switch(_0x97c273[_0x5cbb4b][_0xf031('0x21')]){case'trunk':_0xc3adae[_0xf031('0x1e')]=_0xb363e5[_0x97c273[_0x5cbb4b][_0xf031('0x22')]][_0xf031('0x23')]('/')[0x1];_0xc3adae[_0xf031('0x24')]=_0xb363e5[_0x97c273[_0x5cbb4b][_0xf031('0x22')]][_0xf031('0x23')]('/')[0x2];_0xc3adae['prefix']=_0xc3adae[_0xf031('0x24')]?_0xc3adae[_0xf031('0x24')][_0xf031('0x23')]('$')[0x0]:undefined;_0xc3adae[_0xf031('0x24')]=_0x30386e[_0xf031('0x14')]?(_0xc3adae[_0xf031('0x25')]||'')+_0xf031('0x13')+_0x30386e[_0xf031('0x14')]+'}':(_0xc3adae[_0xf031('0x25')]||'')+_0xf031('0x26');_0x4b5b9d[_0x97c273[_0x5cbb4b][_0xf031('0x22')]]=['SIP',_0xc3adae[_0xf031('0x1e')],_0xc3adae['phone']][_0xf031('0x27')]('/');break;case _0xf031('0x28'):_0xc3adae[_0xf031('0x28')]=_0xb363e5[_0x97c273[_0x5cbb4b][_0xf031('0x22')]];if(_0x30386e[_0xf031('0x1b')]!==_0xf031('0x1c')){if(_0xc3adae[_0xf031('0x28')][_0xf031('0x29')](_0xf031('0x2a'))<0x0){_0xc3adae[_0xf031('0x28')]+=_0xf031('0x2a');}}else{_0xc3adae[_0xf031('0x28')]=_0xc3adae[_0xf031('0x28')][_0xf031('0x2b')](_0xf031('0x2a'),'');}_0x4b5b9d[_0x97c273[_0x5cbb4b]['param']]=_0xc3adae['options'];break;default:_0x4b5b9d[_0x97c273[_0x5cbb4b][_0xf031('0x22')]]=_0xb363e5[_0x97c273[_0x5cbb4b]['param']];}}return _0x4b5b9d[_0xf031('0x27')](',');}function _0x2e64d3(_0x3279af,_0x5bb5fd,_0x52e2b0){return new Promise(function(_0x5f4763,_0x2c8737){var _0x5ae676=[];if(_[_0xf031('0x2c')](_0x5bb5fd))return _0x5f4763(_0x5ae676);_0x41ba47[_0xf031('0x2d')][_0xf031('0x2e')]({'attributes':['id',_0xf031('0x2f'),_0xf031('0x30')],'raw':!![]})[_0xf031('0x31')](function(_0x4e933a){for(var _0x448208=0x0,_0x5830d7=0x0;_0x448208<_0x5bb5fd[_0xf031('0x20')];_0x448208++,_0x5830d7=0x0){var _0x56097c=_0x5bb5fd[_0x448208];var _0x25fff4=[];var _0x40664c=[];delete _0x56097c['id'];if(_0x56097c[_0xf031('0x2f')]!==_0xf031('0x32')){_0x56097c[_0xf031('0x33')]=[_0x56097c[_0xf031('0x2f')]];}else{_0x56097c[_0xf031('0x33')]=_0x56097c['IntervalId']?_['map'](_[_0xf031('0x34')](_0x4e933a,{'IntervalId':_0x56097c[_0xf031('0x30')]}),_0xf031('0x2f')):[];}_0x56097c[_0xf031('0x6')]=_0x3279af[_0xf031('0x6')];_0x56097c['exten']=_0x3279af[_0xf031('0x7')];if(_0x56097c[_0xf031('0x3')])_0x56097c[_0xf031('0x3')]=_0x56097c[_0xf031('0x3')]['toLowerCase']();if(_0x3279af[_0xf031('0x3')]===_0xf031('0x10')){if(_0x56097c[_0xf031('0x1a')](_0xf031('0x35'))&&_0x56097c[_0xf031('0x35')]&&_0x56097c[_0xf031('0x35')]!=='--'){_0x25fff4[_0xf031('0xc')]({'type':_0x56097c['type']['toLowerCase'](),'app':'Set','appdata':_0xf031('0x36')+_0x56097c[_0xf031('0x35')],'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af['exten'],'priority':_0x56097c[_0xf031('0x33')]['length']+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});}_0x25fff4[_0xf031('0xc')]({'type':_0x56097c[_0xf031('0x3')]['toLowerCase'](),'app':_0xf031('0x16'),'appdata':_0xf031('0x37')+(_0x56097c[_0xf031('0x38')]?'Set(CALLERID(all)='+_0x56097c[_0xf031('0x38')]+')':_0xf031('0x39')),'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af[_0xf031('0x7')],'priority':_0x56097c['intervals'][_0xf031('0x20')]+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});}else{if(_0x56097c[_0xf031('0x1a')]('answer')){if([_0xf031('0x3a'),_0xf031('0x3b')][_0xf031('0x3c')](_0x56097c[_0xf031('0x3d')][_0xf031('0x3e')]())&&_0x56097c['appType']!==_0xf031('0x3f')){if(_0x56097c['answer']){_0x25fff4[_0xf031('0xc')]({'type':_0x56097c['type'][_0xf031('0x3e')](),'app':'ExecIf','appdata':_0xf031('0x40'),'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af[_0xf031('0x7')],'priority':_0x56097c['intervals'][_0xf031('0x20')]+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});_0x25fff4[_0xf031('0xc')]({'type':_0x56097c['type'][_0xf031('0x3e')](),'app':_0xf031('0x4'),'appdata':_0xf031('0x41'),'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af[_0xf031('0x7')],'priority':_0x56097c[_0xf031('0x33')][_0xf031('0x20')]+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});}else{_0x25fff4['push']({'type':_0x56097c[_0xf031('0x3')][_0xf031('0x3e')](),'app':_0xf031('0x16'),'appdata':_0xf031('0x42'),'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af[_0xf031('0x7')],'priority':_0x56097c[_0xf031('0x33')][_0xf031('0x20')]+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});_0x25fff4[_0xf031('0xc')]({'type':_0x56097c[_0xf031('0x3')]['toLowerCase'](),'app':_0xf031('0x4'),'appdata':_0xf031('0x43'),'context':_0x3279af[_0xf031('0x6')],'exten':_0x3279af[_0xf031('0x7')],'priority':_0x56097c[_0xf031('0x33')][_0xf031('0x20')]+_0x52e2b0+_0x5830d7++,'VoiceExtensionId':_0x3279af['id']});}}}}for(var _0x4e23ae=0x0;_0x4e23ae<_0x56097c[_0xf031('0x33')][_0xf031('0x20')];_0x4e23ae++){var _0x4924c7=_0x52e2b0+_0x56097c[_0xf031('0x33')]['length'];var _0x53a62e=_0x4e23ae===_0x56097c[_0xf031('0x33')][_0xf031('0x20')]-0x1?_0x52e2b0+_0x25fff4[_0xf031('0x20')]+_0x40664c['length']+0x2:_0x52e2b0+_0x4e23ae+0x1;_0x25fff4['splice'](_0x4e23ae,0x0,{'type':_0x3279af['type'],'app':_0xf031('0x44'),'appdata':_0x56097c[_0xf031('0x33')][_0x4e23ae]+'?'+_0x3279af[_0xf031('0x6')]+_0xf031('0x45')+_0x4924c7+':'+_0x3279af[_0xf031('0x6')]+_0xf031('0x45')+_0x53a62e,'exten':_0x3279af[_0xf031('0x7')],'context':_0x3279af['context'],'priority':_0x52e2b0+_0x4e23ae,'VoiceExtensionId':_0x3279af['id']});}if(_0x56097c[_0xf031('0x46')]===_0xf031('0x47'))_0x56097c['appdata']=_0x38182f(_0x3279af,_0x56097c['appdata']);_0x56097c['priority']=_0x25fff4[_0xf031('0x20')]?_['last'](_0x25fff4)[_0xf031('0x48')]+0x1:_0x52e2b0;_0x5ae676=_[_0xf031('0x49')](_0x5ae676,_0x25fff4,[_0x56097c],_0x40664c);_0x52e2b0=_['last'](_0x5ae676)[_0xf031('0x48')]+0x1;}return _0x5f4763(_0x5ae676);})[_0xf031('0x4a')](function(_0x129d82){_0x2c8737(_0x129d82);});});}return _0x4b6f45[_0xf031('0x4b')](_0xf031('0x4c'),attributes,{'tableName':_0xf031('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4c0bf7){var _0x22a0e9=this[_0xf031('0x4e')]({'plain':!![]});var _0x54fb17=_0x22a0e9[_0xf031('0x3')]===_0xf031('0x10')?_0x211c93(_0x22a0e9):_0x14a69c(_0x22a0e9);return _0x2e64d3(_0x22a0e9,_0x4c0bf7,_[_0xf031('0x4f')](_0x54fb17)[_0xf031('0x48')]+0x1)['then'](function(_0x2d162e){var _0x561406=_[_0xf031('0x49')](_0x54fb17,_0x2d162e);_0x561406[_0xf031('0xc')]({'type':_0x22a0e9['type'],'app':_0xf031('0x50'),'exten':_0x22a0e9['exten'],'context':_0x22a0e9[_0xf031('0x6')],'priority':_['last'](_0x561406)['priority']+0x1,'VoiceExtensionId':_0x22a0e9['id']});return _0x561406;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index caf47c9..05f1121 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 _0xae24=['message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','model','map','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b0b9b,_0x1739a4){var _0x20dc47=function(_0x35604a){while(--_0x35604a){_0x5b0b9b['push'](_0x5b0b9b['shift']());}};_0x20dc47(++_0x1739a4);}(_0xae24,0x182));var _0x4ae2=function(_0x3f2150,_0x16ef9e){_0x3f2150=_0x3f2150-0x0;var _0x39adee=_0xae24[_0x3f2150];return _0x39adee;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});config[_0x4ae2('0x9')]=_[_0x4ae2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae2('0xb'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x4ae2('0xc')](socket);function respondWithRpcPromise(_0xb01e8e,_0x5c32b7,_0x3b3acc){return new BPromise(function(_0x449e1a,_0x171449){return client[_0x4ae2('0xd')](_0xb01e8e,_0x3b3acc)['then'](function(_0x19b222){logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,'request\x20sent');logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0x5c32b7,_0x4ae2('0x12'),JSON[_0x4ae2('0x13')](_0x19b222));if(_0x19b222[_0x4ae2('0x14')]){if(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x15')]===0x1f4){logger[_0x4ae2('0x14')](_0x4ae2('0xf'),_0x5c32b7,_0x19b222['error']['message']);return _0x171449(_0x19b222['error'][_0x4ae2('0x16')]);}logger[_0x4ae2('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5c32b7,_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);return _0x449e1a(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);}else{logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,_0x4ae2('0x12'));_0x449e1a(_0x19b222[_0x4ae2('0x17')][_0x4ae2('0x16')]);}})[_0x4ae2('0x18')](function(_0x4d5071){logger['error'](_0x4ae2('0xf'),_0x5c32b7,_0x4d5071);_0x171449(_0x4d5071);});});}exports[_0x4ae2('0x19')]=function(_0x51e20c){var _0x45c1bf=this;return new Promise(function(_0x343db1,_0xccb3b){return db[_0x4ae2('0x1a')][_0x4ae2('0x1b')]({'raw':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1d')]||null:null,'attributes':_0x51e20c[_0x4ae2('0x1c')]?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1e')]||null:null,'limit':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')]['limit']||null:null,'include':_0x51e20c[_0x4ae2('0x1c')]?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1f')]?_['map'](_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1f')],function(_0x2454b3){return{'model':db[_0x2454b3[_0x4ae2('0x20')]],'as':_0x2454b3['as'],'attributes':_0x2454b3[_0x4ae2('0x1e')],'include':_0x2454b3[_0x4ae2('0x1f')]?_['map'](_0x2454b3['include'],function(_0x9508d7){return{'model':db[_0x9508d7[_0x4ae2('0x20')]],'as':_0x9508d7['as'],'attributes':_0x9508d7[_0x4ae2('0x1e')],'include':_0x9508d7[_0x4ae2('0x1f')]?_[_0x4ae2('0x21')](_0x9508d7[_0x4ae2('0x1f')],function(_0x57a377){return{'model':db[_0x57a377['model']],'as':_0x57a377['as'],'attributes':_0x57a377[_0x4ae2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x554cff){logger['info'](_0x4ae2('0x19'),_0x51e20c);logger[_0x4ae2('0x10')]('GetVoiceExtension',_0x51e20c,JSON[_0x4ae2('0x13')](_0x554cff));_0x343db1(_0x554cff);})[_0x4ae2('0x18')](function(_0x3d56ea){logger[_0x4ae2('0x14')](_0x4ae2('0x19'),_0x3d56ea[_0x4ae2('0x16')],_0x51e20c);_0xccb3b(_0x45c1bf[_0x4ae2('0x14')](0x1f4,_0x3d56ea[_0x4ae2('0x16')]));});});}; \ No newline at end of file +var _0xae24=['message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','include','model','map','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x19cbc8,_0x22a854){var _0x15b910=function(_0x5ae2f0){while(--_0x5ae2f0){_0x19cbc8['push'](_0x19cbc8['shift']());}};_0x15b910(++_0x22a854);}(_0xae24,0x182));var _0x4ae2=function(_0x33e7c3,_0x3400c4){_0x33e7c3=_0x33e7c3-0x0;var _0xbf23fc=_0xae24[_0x33e7c3];return _0xbf23fc;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});config[_0x4ae2('0x9')]=_[_0x4ae2('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ae2('0xb'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0x4ae2('0xc')](socket);function respondWithRpcPromise(_0xb01e8e,_0x5c32b7,_0x3b3acc){return new BPromise(function(_0x449e1a,_0x171449){return client[_0x4ae2('0xd')](_0xb01e8e,_0x3b3acc)['then'](function(_0x19b222){logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,'request\x20sent');logger[_0x4ae2('0x10')](_0x4ae2('0x11'),_0x5c32b7,_0x4ae2('0x12'),JSON[_0x4ae2('0x13')](_0x19b222));if(_0x19b222[_0x4ae2('0x14')]){if(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x15')]===0x1f4){logger[_0x4ae2('0x14')](_0x4ae2('0xf'),_0x5c32b7,_0x19b222['error']['message']);return _0x171449(_0x19b222['error'][_0x4ae2('0x16')]);}logger[_0x4ae2('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5c32b7,_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);return _0x449e1a(_0x19b222[_0x4ae2('0x14')][_0x4ae2('0x16')]);}else{logger[_0x4ae2('0xe')](_0x4ae2('0xf'),_0x5c32b7,_0x4ae2('0x12'));_0x449e1a(_0x19b222[_0x4ae2('0x17')][_0x4ae2('0x16')]);}})[_0x4ae2('0x18')](function(_0x4d5071){logger['error'](_0x4ae2('0xf'),_0x5c32b7,_0x4d5071);_0x171449(_0x4d5071);});});}exports[_0x4ae2('0x19')]=function(_0x51e20c){var _0x45c1bf=this;return new Promise(function(_0x343db1,_0xccb3b){return db[_0x4ae2('0x1a')][_0x4ae2('0x1b')]({'raw':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1d')]||null:null,'attributes':_0x51e20c[_0x4ae2('0x1c')]?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1e')]||null:null,'limit':_0x51e20c['options']?_0x51e20c[_0x4ae2('0x1c')]['limit']||null:null,'include':_0x51e20c[_0x4ae2('0x1c')]?_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1f')]?_['map'](_0x51e20c[_0x4ae2('0x1c')][_0x4ae2('0x1f')],function(_0x2454b3){return{'model':db[_0x2454b3[_0x4ae2('0x20')]],'as':_0x2454b3['as'],'attributes':_0x2454b3[_0x4ae2('0x1e')],'include':_0x2454b3[_0x4ae2('0x1f')]?_['map'](_0x2454b3['include'],function(_0x9508d7){return{'model':db[_0x9508d7[_0x4ae2('0x20')]],'as':_0x9508d7['as'],'attributes':_0x9508d7[_0x4ae2('0x1e')],'include':_0x9508d7[_0x4ae2('0x1f')]?_[_0x4ae2('0x21')](_0x9508d7[_0x4ae2('0x1f')],function(_0x57a377){return{'model':db[_0x57a377['model']],'as':_0x57a377['as'],'attributes':_0x57a377[_0x4ae2('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x554cff){logger['info'](_0x4ae2('0x19'),_0x51e20c);logger[_0x4ae2('0x10')]('GetVoiceExtension',_0x51e20c,JSON[_0x4ae2('0x13')](_0x554cff));_0x343db1(_0x554cff);})[_0x4ae2('0x18')](function(_0x3d56ea){logger[_0x4ae2('0x14')](_0x4ae2('0x19'),_0x3d56ea[_0x4ae2('0x16')],_0x51e20c);_0xccb3b(_0x45c1bf[_0x4ae2('0x14')](0x1f4,_0x3d56ea[_0x4ae2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ed46f0f..5bed731 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 _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0x51c0eb,_0x2850d4){var _0x2728bd=function(_0x3cdf4a){while(--_0x3cdf4a){_0x51c0eb['push'](_0x51c0eb['shift']());}};_0x2728bd(++_0x2850d4);}(_0xe14b,0x93));var _0xbe14=function(_0x2c8fad,_0x1630ac){_0x2c8fad=_0x2c8fad-0x0;var _0xcbbe5a=_0xe14b[_0x2c8fad];return _0xcbbe5a;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x290c00,_0x1ae1b3){var _0x47f224=function(_0x361473){while(--_0x361473){_0x290c00['push'](_0x290c00['shift']());}};_0x47f224(++_0x1ae1b3);}(_0x53ec,0x192));var _0xc53e=function(_0x32a884,_0x183853){_0x32a884=_0x32a884-0x0;var _0x242f9b=_0x53ec[_0x32a884];return _0x242f9b;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5201027..95622bf 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 _0x66fa=['isAuthenticated','index','get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7f8b61,_0x4fa837){var _0x16e761=function(_0x1872ee){while(--_0x1872ee){_0x7f8b61['push'](_0x7f8b61['shift']());}};_0x16e761(++_0x4fa837);}(_0x66fa,0x117));var _0xa66f=function(_0x5cb310,_0x49a2bd){_0x5cb310=_0x5cb310-0x0;var _0x4443d7=_0x66fa[_0x5cb310];return _0x4443d7;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/messages',auth[_0xa66f('0x9')](),controller['getMessages']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file +var _0xa46e=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','/:id/messages','create','put','update'];(function(_0x14652e,_0x59fb87){var _0x1e3b87=function(_0x3942f2){while(--_0x3942f2){_0x14652e['push'](_0x14652e['shift']());}};_0x1e3b87(++_0x59fb87);}(_0xa46e,0x8a));var _0xea46=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xa46e[_0x2c9b79];return _0x265032;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./voiceMail.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0xea46('0xc')]);router[_0xea46('0xd')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router[_0xea46('0xf')]('/:id',auth[_0xea46('0x9')](),controller[_0xea46('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a3a97f4..d03d52d 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 _0x2295=['sequelize','exports','from-voicemail','contest_mailbox','STRING','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','mailbox'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x2295,0x143));var _0x5229=function(_0x1eeb89,_0x3adb5c){_0x1eeb89=_0x1eeb89-0x0;var _0xdc5c8d=_0x2295[_0x1eeb89];return _0xdc5c8d;};'use strict';var Sequelize=require(_0x5229('0x0'));module[_0x5229('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x5229('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x5229('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5229('0x4')],'validate':{'isEmail':!![]},'set':function(_0x13f222){this['setDataValue'](_0x5229('0x5'),typeof _0x13f222===_0x5229('0x6')&&_0x13f222[_0x5229('0x7')]()?_0x13f222['trim']():null);}},'pager':{'type':Sequelize[_0x5229('0x4')]},'tz':{'type':Sequelize[_0x5229('0x4')],'defaultValue':_0x5229('0x8')},'attach':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':_0x5229('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':_0x5229('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5229('0x4')]},'callback':{'type':Sequelize[_0x5229('0x4')]},'review':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5229('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5229('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':_0x5229('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x5229('0x9')](_0x5229('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5229('0x9')]('yes','no'),'defaultValue':_0x5229('0xa'),'allowNull':![]},'stamp':{'type':_0x5229('0xc')},'emailsubject':{'type':Sequelize[_0x5229('0x4')]},'emailbody':{'type':Sequelize[_0x5229('0x4')]},'maxsecs':{'type':Sequelize[_0x5229('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5229('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5229('0xe')](_0x5229('0xf'))+'\x20-\x20'+this[_0x5229('0xe')](_0x5229('0x10'));}}}; \ No newline at end of file +var _0xa8ed=['\x20-\x20','mailbox','exports','STRING','contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x20b966,_0x1cf3ad){var _0x14b006=function(_0x285af1){while(--_0x285af1){_0x20b966['push'](_0x20b966['shift']());}};_0x14b006(++_0x1cf3ad);}(_0xa8ed,0x1d2));var _0xda8e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xa8ed[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require('sequelize');module[_0xda8e('0x0')]={'customer_id':{'type':Sequelize[_0xda8e('0x1')]},'context':{'type':Sequelize[_0xda8e('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xda8e('0x2')},'password':{'type':Sequelize[_0xda8e('0x1')]},'fullname':{'type':Sequelize[_0xda8e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2d09ed){this[_0xda8e('0x3')](_0xda8e('0x4'),typeof _0x2d09ed===_0xda8e('0x5')&&_0x2d09ed[_0xda8e('0x6')]()?_0x2d09ed[_0xda8e('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xda8e('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':_0xda8e('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':_0xda8e('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xda8e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xda8e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xda8e('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xda8e('0x7')]('yes','no'),'defaultValue':_0xda8e('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xda8e('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xda8e('0x7')](_0xda8e('0x8'),'no'),'defaultValue':_0xda8e('0x8'),'allowNull':![]},'stamp':{'type':_0xda8e('0x9')},'emailsubject':{'type':Sequelize[_0xda8e('0x1')]},'emailbody':{'type':Sequelize[_0xda8e('0x1')]},'maxsecs':{'type':Sequelize[_0xda8e('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xda8e('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xda8e('0xb')],'get':function(){return this[_0xda8e('0xc')](_0xda8e('0xd'))+_0xda8e('0xe')+this[_0xda8e('0xc')](_0xda8e('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e6ed3ce..b87a659 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 _0x4ded=['findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','order','sort','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','name','index','map','VoiceMail','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x4548f4,_0xfa2353){var _0x3af50d=function(_0x47cb28){while(--_0x47cb28){_0x4548f4['push'](_0x4548f4['shift']());}};_0x3af50d(++_0xfa2353);}(_0x4ded,0x116));var _0xd4de=function(_0x42f622,_0x58649a){_0x42f622=_0x42f622-0x0;var _0x2eb121=_0x4ded[_0x42f622];return _0x2eb121;};'use strict';var emlformat=require(_0xd4de('0x0'));var rimraf=require(_0xd4de('0x1'));var zipdir=require(_0xd4de('0x2'));var jsonpatch=require(_0xd4de('0x3'));var rp=require(_0xd4de('0x4'));var moment=require(_0xd4de('0x5'));var BPromise=require(_0xd4de('0x6'));var Mustache=require(_0xd4de('0x7'));var util=require(_0xd4de('0x8'));var path=require(_0xd4de('0x9'));var sox=require(_0xd4de('0xa'));var csv=require(_0xd4de('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4de('0xc'));var _=require(_0xd4de('0xd'));var squel=require(_0xd4de('0xe'));var crypto=require(_0xd4de('0xf'));var jsforce=require(_0xd4de('0x10'));var deskjs=require(_0xd4de('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd4de('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd4de('0x13'));var as=require(_0xd4de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd4de('0x16'));var db=require(_0xd4de('0x17'))['db'];function respondWithStatusCode(_0x104dad,_0x2aa09d){_0x2aa09d=_0x2aa09d||0xcc;return function(_0x3ffc72){if(_0x3ffc72){return _0x104dad[_0xd4de('0x18')](_0x2aa09d);}return _0x104dad[_0xd4de('0x19')](_0x2aa09d)[_0xd4de('0x1a')]();};}function respondWithResult(_0x3e3735,_0x37cb9f){_0x37cb9f=_0x37cb9f||0xc8;return function(_0x691ba9){if(_0x691ba9){return _0x3e3735[_0xd4de('0x19')](_0x37cb9f)[_0xd4de('0x1b')](_0x691ba9);}};}function respondWithFilteredResult(_0xbb4f7e,_0x102e5b){return function(_0xa7c18b){if(_0xa7c18b){var _0x325fba=typeof _0x102e5b['offset']==='undefined'&&typeof _0x102e5b[_0xd4de('0x1c')]===_0xd4de('0x1d');var _0x17b377=_0xa7c18b[_0xd4de('0x1e')];var _0x5b1d1c=_0x325fba?0x0:_0x102e5b['offset'];var _0x1e91d5=_0x325fba?_0xa7c18b['count']:_0x102e5b[_0xd4de('0x1f')]+_0x102e5b[_0xd4de('0x1c')];var _0x50b9e3;if(_0x1e91d5>=_0x17b377){_0x1e91d5=_0x17b377;_0x50b9e3=0xc8;}else{_0x50b9e3=0xce;}_0xbb4f7e[_0xd4de('0x19')](_0x50b9e3);return _0xbb4f7e['set'](_0xd4de('0x20'),_0x5b1d1c+'-'+_0x1e91d5+'/'+_0x17b377)[_0xd4de('0x1b')](_0xa7c18b);}return null;};}function patchUpdates(_0x2bad14){return function(_0x8e8712){try{jsonpatch['apply'](_0x8e8712,_0x2bad14,!![]);}catch(_0x318658){return BPromise[_0xd4de('0x21')](_0x318658);}return _0x8e8712[_0xd4de('0x22')]();};}function saveUpdates(_0xdb3fc,_0x1c631a){return function(_0x2d092a){if(_0x2d092a){return _0x2d092a[_0xd4de('0x23')](_0xdb3fc)[_0xd4de('0x24')](function(_0x2f9de6){return _0x2f9de6;});}return null;};}function removeEntity(_0x413f68,_0x534b37){return function(_0xad333f){if(_0xad333f){return _0xad333f[_0xd4de('0x25')]()[_0xd4de('0x24')](function(){var _0x22970c=_0xad333f[_0xd4de('0x26')]({'plain':!![]});var _0x984904=_0xd4de('0x27');return db[_0xd4de('0x28')][_0xd4de('0x25')]({'where':{'type':_0x984904,'resourceId':_0x22970c['id']}})[_0xd4de('0x24')](function(){return _0xad333f;});})[_0xd4de('0x24')](function(){_0x413f68[_0xd4de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe64e4e,_0x35e2fc){return function(_0x5005b0){if(!_0x5005b0){_0xe64e4e[_0xd4de('0x18')](0x194);}return _0x5005b0;};}function handleError(_0x59b3c5,_0x44b710){_0x44b710=_0x44b710||0x1f4;return function(_0x32e407){logger[_0xd4de('0x29')](_0x32e407['stack']);if(_0x32e407[_0xd4de('0x2a')]){delete _0x32e407[_0xd4de('0x2a')];}_0x59b3c5[_0xd4de('0x19')](_0x44b710)['send'](_0x32e407);};}exports[_0xd4de('0x2b')]=function(_0x1804c7,_0x55f9f9){var _0x5103b5={},_0x5706fe={},_0x3f6491={'count':0x0,'rows':[]};var _0x496795=_[_0xd4de('0x2c')](db[_0xd4de('0x2d')][_0xd4de('0x2e')],function(_0x2e08eb){return{'name':_0x2e08eb['fieldName'],'type':_0x2e08eb[_0xd4de('0x2f')][_0xd4de('0x30')]};});_0x5706fe['model']=_[_0xd4de('0x2c')](_0x496795,_0xd4de('0x2a'));_0x5706fe['query']=_['keys'](_0x1804c7[_0xd4de('0x31')]);_0x5706fe[_0xd4de('0x32')]=_[_0xd4de('0x33')](_0x5706fe[_0xd4de('0x34')],_0x5706fe['query']);_0x5103b5[_0xd4de('0x35')]=_[_0xd4de('0x33')](_0x5706fe['model'],qs[_0xd4de('0x36')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x36')]));_0x5103b5[_0xd4de('0x35')]=_0x5103b5[_0xd4de('0x35')][_0xd4de('0x37')]?_0x5103b5['attributes']:_0x5706fe['model'];if(!_0x1804c7[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x5103b5['limit']=qs[_0xd4de('0x1c')](_0x1804c7[_0xd4de('0x31')]['limit']);_0x5103b5[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x1804c7[_0xd4de('0x31')][_0xd4de('0x1f')]);}_0x5103b5['order']=qs['sort'](_0x1804c7[_0xd4de('0x31')]['sort']);_0x5103b5[_0xd4de('0x3a')]=qs['filters'](_[_0xd4de('0x3b')](_0x1804c7[_0xd4de('0x31')],_0x5706fe[_0xd4de('0x32')]),_0x496795);if(_0x1804c7[_0xd4de('0x31')]['filter']){_0x5103b5[_0xd4de('0x3a')]=_['merge'](_0x5103b5[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x496795,function(_0x7f17b9){if(_0x7f17b9[_0xd4de('0x2f')]!==_0xd4de('0x3c')){var _0x13c256={};_0x13c256[_0x7f17b9[_0xd4de('0x2a')]]={'$like':'%'+_0x1804c7['query'][_0xd4de('0x3d')]+'%'};return _0x13c256;}})});}_0x5103b5=_[_0xd4de('0x3e')]({},_0x5103b5,_0x1804c7[_0xd4de('0x3f')]);var _0x2ec1fa={'where':_0x5103b5[_0xd4de('0x3a')]};return db['VoiceMail'][_0xd4de('0x1e')](_0x2ec1fa)[_0xd4de('0x24')](function(_0x2294e2){_0x3f6491['count']=_0x2294e2;if(_0x1804c7[_0xd4de('0x31')][_0xd4de('0x40')]){_0x5103b5[_0xd4de('0x41')]=[{'all':!![]}];}return db['VoiceMail'][_0xd4de('0x42')](_0x5103b5);})[_0xd4de('0x24')](function(_0x419c49){_0x3f6491[_0xd4de('0x43')]=_0x419c49;return _0x3f6491;})[_0xd4de('0x24')](respondWithFilteredResult(_0x55f9f9,_0x5103b5))[_0xd4de('0x44')](handleError(_0x55f9f9,null));};exports[_0xd4de('0x45')]=function(_0x5ecbbd,_0x43b542){var _0x164bde={'raw':!![],'where':{'id':_0x5ecbbd['params']['id']}},_0x58082a={};_0x58082a[_0xd4de('0x34')]=_[_0xd4de('0x46')](db[_0xd4de('0x2d')]['rawAttributes']);_0x58082a['query']=_[_0xd4de('0x46')](_0x5ecbbd[_0xd4de('0x31')]);_0x58082a['filters']=_[_0xd4de('0x33')](_0x58082a[_0xd4de('0x34')],_0x58082a[_0xd4de('0x31')]);_0x164bde[_0xd4de('0x35')]=_['intersection'](_0x58082a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x36')]));_0x164bde[_0xd4de('0x35')]=_0x164bde[_0xd4de('0x35')]['length']?_0x164bde[_0xd4de('0x35')]:_0x58082a[_0xd4de('0x34')];if(_0x5ecbbd[_0xd4de('0x31')][_0xd4de('0x40')]){_0x164bde[_0xd4de('0x41')]=[{'all':!![]}];}_0x164bde=_[_0xd4de('0x3e')]({},_0x164bde,_0x5ecbbd[_0xd4de('0x3f')]);return db[_0xd4de('0x2d')][_0xd4de('0x47')](_0x164bde)[_0xd4de('0x24')](handleEntityNotFound(_0x43b542,null))['then'](respondWithResult(_0x43b542,null))[_0xd4de('0x44')](handleError(_0x43b542,null));};exports[_0xd4de('0x48')]=function(_0x178daf,_0x518bfe){return db[_0xd4de('0x2d')][_0xd4de('0x48')](_0x178daf[_0xd4de('0x49')],{})[_0xd4de('0x24')](function(_0x42e58e){var _0xa24bb7=_0x178daf[_0xd4de('0x4a')][_0xd4de('0x26')]({'plain':!![]});if(!_0xa24bb7)throw new Error(_0xd4de('0x4b'));if(_0xa24bb7[_0xd4de('0x4c')]==='user'){var _0x3e4c7f=_0x42e58e[_0xd4de('0x26')]({'plain':!![]});var _0x215f85=_0xd4de('0x27');return db[_0xd4de('0x4d')]['find']({'where':{'name':_0x215f85,'userProfileId':_0xa24bb7['userProfileId']},'raw':!![]})[_0xd4de('0x24')](function(_0x2deedb){if(_0x2deedb&&_0x2deedb['autoAssociation']===0x0){return db['UserProfileResource'][_0xd4de('0x48')]({'name':_0x3e4c7f[_0xd4de('0x2a')],'resourceId':_0x3e4c7f['id'],'type':_0x2deedb[_0xd4de('0x2a')],'sectionId':_0x2deedb['id']},{})[_0xd4de('0x24')](function(){return _0x42e58e;});}else{return _0x42e58e;}})[_0xd4de('0x44')](function(_0x15c8cd){logger[_0xd4de('0x29')](_0xd4de('0x4e'),_0x15c8cd);throw _0x15c8cd;});}return _0x42e58e;})[_0xd4de('0x24')](respondWithResult(_0x518bfe,0xc9))[_0xd4de('0x44')](handleError(_0x518bfe,null));};exports[_0xd4de('0x23')]=function(_0x2e1780,_0x56c13e){if(_0x2e1780[_0xd4de('0x49')]['id']){delete _0x2e1780[_0xd4de('0x49')]['id'];}return db[_0xd4de('0x2d')][_0xd4de('0x47')]({'where':{'id':_0x2e1780[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x56c13e,null))['then'](saveUpdates(_0x2e1780[_0xd4de('0x49')],null))['then'](respondWithResult(_0x56c13e,null))['catch'](handleError(_0x56c13e,null));};exports[_0xd4de('0x25')]=function(_0xd79781,_0x2d1e45){return db[_0xd4de('0x2d')]['find']({'where':{'id':_0xd79781[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x2d1e45,null))[_0xd4de('0x24')](removeEntity(_0x2d1e45,null))[_0xd4de('0x44')](handleError(_0x2d1e45,null));};exports[_0xd4de('0x50')]=function(_0x4bb7df,_0x5496f7,_0x4b55cc){return db[_0xd4de('0x2d')][_0xd4de('0x51')]({'where':{'id':_0x4bb7df[_0xd4de('0x4f')]['id']}})[_0xd4de('0x24')](handleEntityNotFound(_0x5496f7,null))['then'](function(_0x35ba6f){var _0x146eaa;var _0x2e0d76={},_0x17047a={};_0x17047a['model']=_[_0xd4de('0x46')](db[_0xd4de('0x52')][_0xd4de('0x2e')]);_0x17047a[_0xd4de('0x31')]=_['keys'](_0x4bb7df['query']);_0x17047a['filters']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],_0x17047a[_0xd4de('0x31')]);_0x2e0d76['attributes']=_[_0xd4de('0x33')](_0x17047a[_0xd4de('0x34')],qs[_0xd4de('0x36')](_0x4bb7df['query'][_0xd4de('0x36')]));_0x2e0d76['attributes']=_0x2e0d76[_0xd4de('0x35')][_0xd4de('0x37')]?_0x2e0d76[_0xd4de('0x35')]:_0x17047a[_0xd4de('0x34')];if(!_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x38')](_0xd4de('0x39'))){_0x2e0d76[_0xd4de('0x1c')]=qs['limit'](_0x4bb7df[_0xd4de('0x31')]['limit']);_0x2e0d76[_0xd4de('0x1f')]=qs[_0xd4de('0x1f')](_0x4bb7df['query'][_0xd4de('0x1f')]);}_0x2e0d76[_0xd4de('0x53')]=qs[_0xd4de('0x54')](_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x54')]);_0x2e0d76[_0xd4de('0x3a')]=qs[_0xd4de('0x32')](_[_0xd4de('0x3b')](_0x4bb7df[_0xd4de('0x31')],_0x17047a[_0xd4de('0x32')]));if(_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]){_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'$or':_[_0xd4de('0x2c')](_0x2e0d76[_0xd4de('0x35')],function(_0x331f08){var _0x25628e={};_0x25628e[_0x331f08]={'$like':'%'+_0x4bb7df[_0xd4de('0x31')][_0xd4de('0x3d')]+'%'};return _0x25628e;})});}_0x2e0d76[_0xd4de('0x3a')]=_['merge'](_0x2e0d76[_0xd4de('0x3a')],{'mailboxuser':_0x35ba6f['mailbox']});_0x2e0d76=_['merge']({},_0x2e0d76,_0x4bb7df['options']);return db[_0xd4de('0x52')][_0xd4de('0x55')](_0x2e0d76)['then'](respondWithFilteredResult(_0x5496f7,_0x2e0d76));})['catch'](handleError(_0x5496f7,null));}; \ No newline at end of file +var _0x4cf8=['UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','VoiceMail','include','findAll','catch','find','create','body','user','UserProfileSection','userProfileId','params','getMessages','findOne','VoiceMailMessage','mailbox','options','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x13e724,_0x296739){_0x13e724=_0x13e724-0x0;var _0x334a44=_0x4cf8[_0x13e724];return _0x334a44;};'use strict';var emlformat=require(_0x84cf('0x0'));var rimraf=require(_0x84cf('0x1'));var zipdir=require(_0x84cf('0x2'));var jsonpatch=require(_0x84cf('0x3'));var rp=require(_0x84cf('0x4'));var moment=require(_0x84cf('0x5'));var BPromise=require(_0x84cf('0x6'));var Mustache=require(_0x84cf('0x7'));var util=require(_0x84cf('0x8'));var path=require(_0x84cf('0x9'));var sox=require(_0x84cf('0xa'));var csv=require(_0x84cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84cf('0xc'));var squel=require('squel');var crypto=require(_0x84cf('0xd'));var jsforce=require(_0x84cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x84cf('0xb'));var querystring=require(_0x84cf('0xf'));var Papa=require('papaparse');var Redis=require(_0x84cf('0x10'));var authService=require(_0x84cf('0x11'));var qs=require(_0x84cf('0x12'));var as=require(_0x84cf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x84cf('0x14'))(_0x84cf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84cf('0x16'));var db=require(_0x84cf('0x17'))['db'];function respondWithStatusCode(_0x35f852,_0x33f83e){_0x33f83e=_0x33f83e||0xcc;return function(_0x172d04){if(_0x172d04){return _0x35f852[_0x84cf('0x18')](_0x33f83e);}return _0x35f852[_0x84cf('0x19')](_0x33f83e)[_0x84cf('0x1a')]();};}function respondWithResult(_0xced48,_0x250a19){_0x250a19=_0x250a19||0xc8;return function(_0x2fc41f){if(_0x2fc41f){return _0xced48[_0x84cf('0x19')](_0x250a19)[_0x84cf('0x1b')](_0x2fc41f);}};}function respondWithFilteredResult(_0x20e79c,_0x27261b){return function(_0x167c3e){if(_0x167c3e){var _0x464e70=typeof _0x27261b[_0x84cf('0x1c')]===_0x84cf('0x1d')&&typeof _0x27261b['limit']===_0x84cf('0x1d');var _0x5d6a93=_0x167c3e[_0x84cf('0x1e')];var _0x1abe2d=_0x464e70?0x0:_0x27261b[_0x84cf('0x1c')];var _0x13ba16=_0x464e70?_0x167c3e[_0x84cf('0x1e')]:_0x27261b['offset']+_0x27261b['limit'];var _0x42d6d4;if(_0x13ba16>=_0x5d6a93){_0x13ba16=_0x5d6a93;_0x42d6d4=0xc8;}else{_0x42d6d4=0xce;}_0x20e79c[_0x84cf('0x19')](_0x42d6d4);return _0x20e79c[_0x84cf('0x1f')](_0x84cf('0x20'),_0x1abe2d+'-'+_0x13ba16+'/'+_0x5d6a93)[_0x84cf('0x1b')](_0x167c3e);}return null;};}function patchUpdates(_0x5dda3f){return function(_0x39a37b){try{jsonpatch[_0x84cf('0x21')](_0x39a37b,_0x5dda3f,!![]);}catch(_0x3ca1be){return BPromise[_0x84cf('0x22')](_0x3ca1be);}return _0x39a37b[_0x84cf('0x23')]();};}function saveUpdates(_0x54405a,_0x42fa45){return function(_0x160f86){if(_0x160f86){return _0x160f86[_0x84cf('0x24')](_0x54405a)[_0x84cf('0x25')](function(_0x3e5e94){return _0x3e5e94;});}return null;};}function removeEntity(_0x29e9e1,_0x7feb4){return function(_0x4c9d1c){if(_0x4c9d1c){return _0x4c9d1c[_0x84cf('0x26')]()[_0x84cf('0x25')](function(){var _0x1c7747=_0x4c9d1c[_0x84cf('0x27')]({'plain':!![]});var _0x1d220a=_0x84cf('0x28');return db[_0x84cf('0x29')][_0x84cf('0x26')]({'where':{'type':_0x1d220a,'resourceId':_0x1c7747['id']}})[_0x84cf('0x25')](function(){return _0x4c9d1c;});})[_0x84cf('0x25')](function(){_0x29e9e1['status'](0xcc)[_0x84cf('0x1a')]();});}};}function handleEntityNotFound(_0x17bc92,_0x2a4973){return function(_0x41a5db){if(!_0x41a5db){_0x17bc92['sendStatus'](0x194);}return _0x41a5db;};}function handleError(_0x1595dd,_0x5a428c){_0x5a428c=_0x5a428c||0x1f4;return function(_0x29455e){logger[_0x84cf('0x2a')](_0x29455e[_0x84cf('0x2b')]);if(_0x29455e[_0x84cf('0x2c')]){delete _0x29455e[_0x84cf('0x2c')];}_0x1595dd[_0x84cf('0x19')](_0x5a428c)[_0x84cf('0x2d')](_0x29455e);};}exports[_0x84cf('0x2e')]=function(_0x1bfa56,_0xb4fc5a){var _0x31dbf5={},_0x308f8f={},_0x18243d={'count':0x0,'rows':[]};var _0x44f16e=_['map'](db['VoiceMail'][_0x84cf('0x2f')],function(_0x25de3a){return{'name':_0x25de3a[_0x84cf('0x30')],'type':_0x25de3a[_0x84cf('0x31')][_0x84cf('0x32')]};});_0x308f8f[_0x84cf('0x33')]=_[_0x84cf('0x34')](_0x44f16e,_0x84cf('0x2c'));_0x308f8f['query']=_[_0x84cf('0x35')](_0x1bfa56[_0x84cf('0x36')]);_0x308f8f['filters']=_[_0x84cf('0x37')](_0x308f8f['model'],_0x308f8f[_0x84cf('0x36')]);_0x31dbf5[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x308f8f[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x1bfa56['query'][_0x84cf('0x39')]));_0x31dbf5['attributes']=_0x31dbf5['attributes'][_0x84cf('0x3a')]?_0x31dbf5[_0x84cf('0x38')]:_0x308f8f['model'];if(!_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x3b')](_0x84cf('0x3c'))){_0x31dbf5[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x1bfa56[_0x84cf('0x36')]['limit']);_0x31dbf5[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x1c')]);}_0x31dbf5[_0x84cf('0x3e')]=qs[_0x84cf('0x3f')](_0x1bfa56['query'][_0x84cf('0x3f')]);_0x31dbf5['where']=qs[_0x84cf('0x40')](_[_0x84cf('0x41')](_0x1bfa56[_0x84cf('0x36')],_0x308f8f[_0x84cf('0x40')]),_0x44f16e);if(_0x1bfa56[_0x84cf('0x36')][_0x84cf('0x42')]){_0x31dbf5[_0x84cf('0x43')]=_[_0x84cf('0x44')](_0x31dbf5[_0x84cf('0x43')],{'$or':_['map'](_0x44f16e,function(_0x44e6f0){if(_0x44e6f0['type']!==_0x84cf('0x45')){var _0xc75386={};_0xc75386[_0x44e6f0['name']]={'$like':'%'+_0x1bfa56[_0x84cf('0x36')]['filter']+'%'};return _0xc75386;}})});}_0x31dbf5=_[_0x84cf('0x44')]({},_0x31dbf5,_0x1bfa56['options']);var _0x3fc160={'where':_0x31dbf5['where']};return db[_0x84cf('0x46')][_0x84cf('0x1e')](_0x3fc160)['then'](function(_0x847ce9){_0x18243d[_0x84cf('0x1e')]=_0x847ce9;if(_0x1bfa56[_0x84cf('0x36')]['includeAll']){_0x31dbf5[_0x84cf('0x47')]=[{'all':!![]}];}return db['VoiceMail'][_0x84cf('0x48')](_0x31dbf5);})['then'](function(_0x56b0e5){_0x18243d['rows']=_0x56b0e5;return _0x18243d;})[_0x84cf('0x25')](respondWithFilteredResult(_0xb4fc5a,_0x31dbf5))[_0x84cf('0x49')](handleError(_0xb4fc5a,null));};exports['show']=function(_0x2b737e,_0x56b623){var _0x191ad8={'raw':!![],'where':{'id':_0x2b737e['params']['id']}},_0x3fe8c1={};_0x3fe8c1[_0x84cf('0x33')]=_['keys'](db[_0x84cf('0x46')]['rawAttributes']);_0x3fe8c1['query']=_['keys'](_0x2b737e['query']);_0x3fe8c1['filters']=_['intersection'](_0x3fe8c1['model'],_0x3fe8c1[_0x84cf('0x36')]);_0x191ad8[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x3fe8c1[_0x84cf('0x33')],qs['fields'](_0x2b737e[_0x84cf('0x36')]['fields']));_0x191ad8[_0x84cf('0x38')]=_0x191ad8[_0x84cf('0x38')][_0x84cf('0x3a')]?_0x191ad8[_0x84cf('0x38')]:_0x3fe8c1[_0x84cf('0x33')];if(_0x2b737e[_0x84cf('0x36')]['includeAll']){_0x191ad8[_0x84cf('0x47')]=[{'all':!![]}];}_0x191ad8=_[_0x84cf('0x44')]({},_0x191ad8,_0x2b737e['options']);return db[_0x84cf('0x46')][_0x84cf('0x4a')](_0x191ad8)[_0x84cf('0x25')](handleEntityNotFound(_0x56b623,null))['then'](respondWithResult(_0x56b623,null))['catch'](handleError(_0x56b623,null));};exports['create']=function(_0x1cf3f6,_0x104421){return db[_0x84cf('0x46')][_0x84cf('0x4b')](_0x1cf3f6[_0x84cf('0x4c')],{})[_0x84cf('0x25')](function(_0x51d725){var _0x350985=_0x1cf3f6['user'][_0x84cf('0x27')]({'plain':!![]});if(!_0x350985)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x350985['role']===_0x84cf('0x4d')){var _0xb1c3a8=_0x51d725[_0x84cf('0x27')]({'plain':!![]});var _0x55e24e='Voicemails';return db[_0x84cf('0x4e')][_0x84cf('0x4a')]({'where':{'name':_0x55e24e,'userProfileId':_0x350985[_0x84cf('0x4f')]},'raw':!![]})[_0x84cf('0x25')](function(_0x401ced){if(_0x401ced&&_0x401ced['autoAssociation']===0x0){return db[_0x84cf('0x29')][_0x84cf('0x4b')]({'name':_0xb1c3a8['name'],'resourceId':_0xb1c3a8['id'],'type':_0x401ced[_0x84cf('0x2c')],'sectionId':_0x401ced['id']},{})['then'](function(){return _0x51d725;});}else{return _0x51d725;}})['catch'](function(_0x147194){logger[_0x84cf('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x147194);throw _0x147194;});}return _0x51d725;})['then'](respondWithResult(_0x104421,0xc9))[_0x84cf('0x49')](handleError(_0x104421,null));};exports[_0x84cf('0x24')]=function(_0x2f739a,_0x1e2676){if(_0x2f739a[_0x84cf('0x4c')]['id']){delete _0x2f739a[_0x84cf('0x4c')]['id'];}return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x2f739a['params']['id']}})[_0x84cf('0x25')](handleEntityNotFound(_0x1e2676,null))[_0x84cf('0x25')](saveUpdates(_0x2f739a['body'],null))['then'](respondWithResult(_0x1e2676,null))[_0x84cf('0x49')](handleError(_0x1e2676,null));};exports[_0x84cf('0x26')]=function(_0x3912cb,_0x2a4f20){return db[_0x84cf('0x46')][_0x84cf('0x4a')]({'where':{'id':_0x3912cb[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a4f20,null))[_0x84cf('0x25')](removeEntity(_0x2a4f20,null))['catch'](handleError(_0x2a4f20,null));};exports[_0x84cf('0x51')]=function(_0x5c0122,_0x2a60bc,_0x1c2f1b){return db['VoiceMail'][_0x84cf('0x52')]({'where':{'id':_0x5c0122[_0x84cf('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a60bc,null))[_0x84cf('0x25')](function(_0x53bfb8){var _0x577d55;var _0x5cc371={},_0x50cde2={};_0x50cde2[_0x84cf('0x33')]=_[_0x84cf('0x35')](db[_0x84cf('0x53')][_0x84cf('0x2f')]);_0x50cde2['query']=_[_0x84cf('0x35')](_0x5c0122[_0x84cf('0x36')]);_0x50cde2['filters']=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],_0x50cde2[_0x84cf('0x36')]);_0x5cc371[_0x84cf('0x38')]=_[_0x84cf('0x37')](_0x50cde2[_0x84cf('0x33')],qs[_0x84cf('0x39')](_0x5c0122[_0x84cf('0x36')]['fields']));_0x5cc371[_0x84cf('0x38')]=_0x5cc371['attributes'][_0x84cf('0x3a')]?_0x5cc371[_0x84cf('0x38')]:_0x50cde2[_0x84cf('0x33')];if(!_0x5c0122[_0x84cf('0x36')][_0x84cf('0x3b')]('nolimit')){_0x5cc371[_0x84cf('0x3d')]=qs[_0x84cf('0x3d')](_0x5c0122[_0x84cf('0x36')]['limit']);_0x5cc371[_0x84cf('0x1c')]=qs[_0x84cf('0x1c')](_0x5c0122['query'][_0x84cf('0x1c')]);}_0x5cc371['order']=qs[_0x84cf('0x3f')](_0x5c0122[_0x84cf('0x36')]['sort']);_0x5cc371[_0x84cf('0x43')]=qs[_0x84cf('0x40')](_['pick'](_0x5c0122[_0x84cf('0x36')],_0x50cde2[_0x84cf('0x40')]));if(_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]){_0x5cc371['where']=_[_0x84cf('0x44')](_0x5cc371[_0x84cf('0x43')],{'$or':_['map'](_0x5cc371['attributes'],function(_0x4d40e2){var _0x1b000c={};_0x1b000c[_0x4d40e2]={'$like':'%'+_0x5c0122[_0x84cf('0x36')][_0x84cf('0x42')]+'%'};return _0x1b000c;})});}_0x5cc371['where']=_['merge'](_0x5cc371[_0x84cf('0x43')],{'mailboxuser':_0x53bfb8[_0x84cf('0x54')]});_0x5cc371=_[_0x84cf('0x44')]({},_0x5cc371,_0x5c0122[_0x84cf('0x55')]);return db[_0x84cf('0x53')][_0x84cf('0x56')](_0x5cc371)[_0x84cf('0x25')](respondWithFilteredResult(_0x2a60bc,_0x5cc371));})[_0x84cf('0x49')](handleError(_0x2a60bc,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c18a08d..62104a8 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 _0xe7d4=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','api','moment'];(function(_0x21287e,_0x4a7fc8){var _0x243c03=function(_0x4b4ea7){while(--_0x4b4ea7){_0x21287e['push'](_0x21287e['shift']());}};_0x243c03(++_0x4a7fc8);}(_0xe7d4,0xa2));var _0x4e7d=function(_0x478671,_0x14d62e){_0x478671=_0x478671-0x0;var _0x4e6417=_0xe7d4[_0x478671];return _0x4e6417;};'use strict';var _=require(_0x4e7d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e7d('0x1'));var moment=require(_0x4e7d('0x2'));var BPromise=require(_0x4e7d('0x3'));var rp=require(_0x4e7d('0x4'));var fs=require('fs');var path=require(_0x4e7d('0x5'));var rimraf=require(_0x4e7d('0x6'));var config=require(_0x4e7d('0x7'));var attributes=require(_0x4e7d('0x8'));module[_0x4e7d('0x9')]=function(_0x479c8b,_0x32fe66){return _0x479c8b['define'](_0x4e7d('0xa'),attributes,{'tableName':_0x4e7d('0xb'),'paranoid':![],'indexes':[{'name':_0x4e7d('0xc'),'fields':[_0x4e7d('0xd'),_0x4e7d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe661=['api','moment','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','mailbox','context','lodash','util','../../config/logger'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xe661,0x13f));var _0x1e66=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe661[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x1e66('0x0'));var util=require(_0x1e66('0x1'));var logger=require(_0x1e66('0x2'))(_0x1e66('0x3'));var moment=require(_0x1e66('0x4'));var BPromise=require('bluebird');var rp=require(_0x1e66('0x5'));var fs=require('fs');var path=require(_0x1e66('0x6'));var rimraf=require(_0x1e66('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e66('0x8'));module[_0x1e66('0x9')]=function(_0x41a239,_0x328cd2){return _0x41a239[_0x1e66('0xa')](_0x1e66('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x1e66('0xc'),_0x1e66('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1c253cd..5c5414e 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 _0x30d9=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x30d9,0x1e0));var _0x930d=function(_0x26c77c,_0x36865a){_0x26c77c=_0x26c77c-0x0;var _0x3bcd18=_0x30d9[_0x26c77c];return _0x3bcd18;};'use strict';var _=require(_0x930d('0x0'));var util=require(_0x930d('0x1'));var moment=require(_0x930d('0x2'));var BPromise=require(_0x930d('0x3'));var rs=require(_0x930d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x930d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x930d('0x6'))('rpc');var config=require(_0x930d('0x7'));var jayson=require(_0x930d('0x8'));var client=jayson[_0x930d('0x9')][_0x930d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c29d8,_0x5446af,_0x2fde26){return new BPromise(function(_0x2c4759,_0x3cf725){return client[_0x930d('0xb')](_0x3c29d8,_0x2fde26)['then'](function(_0x4c5bb8){logger['info'](_0x930d('0xc'),_0x5446af,_0x930d('0xd'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5446af,_0x930d('0xd'),JSON[_0x930d('0xe')](_0x4c5bb8));if(_0x4c5bb8[_0x930d('0xf')]){if(_0x4c5bb8['error']['code']===0x1f4){logger[_0x930d('0xf')](_0x930d('0xc'),_0x5446af,_0x4c5bb8[_0x930d('0xf')][_0x930d('0x10')]);return _0x3cf725(_0x4c5bb8[_0x930d('0xf')][_0x930d('0x10')]);}logger[_0x930d('0xf')]('VoiceMail,\x20%s,\x20%s',_0x5446af,_0x4c5bb8['error'][_0x930d('0x10')]);return _0x2c4759(_0x4c5bb8['error'][_0x930d('0x10')]);}else{logger[_0x930d('0x11')](_0x930d('0xc'),_0x5446af,_0x930d('0xd'));_0x2c4759(_0x4c5bb8[_0x930d('0x12')]['message']);}})[_0x930d('0x13')](function(_0x5e9c11){logger[_0x930d('0xf')](_0x930d('0xc'),_0x5446af,_0x5e9c11);_0x3cf725(_0x5e9c11);});});} \ No newline at end of file +var _0x6deb=['stringify','error','code','message','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x41e61b,_0x2cb851){var _0x1b563a=function(_0x43e684){while(--_0x43e684){_0x41e61b['push'](_0x41e61b['shift']());}};_0x1b563a(++_0x2cb851);}(_0x6deb,0x180));var _0xb6de=function(_0x8d7ea9,_0x3ab8e0){_0x8d7ea9=_0x8d7ea9-0x0;var _0x27bf7a=_0x6deb[_0x8d7ea9];return _0x27bf7a;};'use strict';var _=require(_0xb6de('0x0'));var util=require('util');var moment=require(_0xb6de('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6de('0x2'));var fs=require('fs');var Redis=require(_0xb6de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6de('0x4'));var logger=require(_0xb6de('0x5'))('rpc');var config=require(_0xb6de('0x6'));var jayson=require(_0xb6de('0x7'));var client=jayson[_0xb6de('0x8')][_0xb6de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ef5d2,_0x3baf65,_0x14f00f){return new BPromise(function(_0x32931c,_0x5a8631){return client['request'](_0x2ef5d2,_0x14f00f)[_0xb6de('0xa')](function(_0x416e8d){logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x3baf65,_0xb6de('0xd'));logger[_0xb6de('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3baf65,'request\x20sent',JSON[_0xb6de('0xf')](_0x416e8d));if(_0x416e8d['error']){if(_0x416e8d[_0xb6de('0x10')][_0xb6de('0x11')]===0x1f4){logger[_0xb6de('0x10')](_0xb6de('0xc'),_0x3baf65,_0x416e8d[_0xb6de('0x10')][_0xb6de('0x12')]);return _0x5a8631(_0x416e8d[_0xb6de('0x10')][_0xb6de('0x12')]);}logger[_0xb6de('0x10')](_0xb6de('0xc'),_0x3baf65,_0x416e8d[_0xb6de('0x10')][_0xb6de('0x12')]);return _0x32931c(_0x416e8d[_0xb6de('0x10')][_0xb6de('0x12')]);}else{logger[_0xb6de('0xb')](_0xb6de('0xc'),_0x3baf65,_0xb6de('0xd'));_0x32931c(_0x416e8d['result'][_0xb6de('0x12')]);}})['catch'](function(_0x3f99bf){logger[_0xb6de('0x10')](_0xb6de('0xc'),_0x3baf65,_0x3f99bf);_0x5a8631(_0x3f99bf);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 8ce2d9b..586e485 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 _0x47fa=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','update'];(function(_0x400974,_0x59a21b){var _0x4334ee=function(_0x4a4d15){while(--_0x4a4d15){_0x400974['push'](_0x400974['shift']());}};_0x4334ee(++_0x59a21b);}(_0x47fa,0x1b3));var _0xa47f=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x47fa[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require(_0xa47f('0x0'));var util=require(_0xa47f('0x1'));var path=require(_0xa47f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa47f('0x3')]();var fs_extra=require(_0xa47f('0x4'));var auth=require(_0xa47f('0x5'));var interaction=require(_0xa47f('0x6'));var config=require('../../config/environment');var controller=require(_0xa47f('0x7'));router[_0xa47f('0x8')]('/',auth[_0xa47f('0x9')](),controller['index']);router['get'](_0xa47f('0xa'),auth[_0xa47f('0x9')](),controller[_0xa47f('0xb')]);router[_0xa47f('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xa47f('0xc')]);router[_0xa47f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xa47f('0x9')](),controller[_0xa47f('0xe')]);router[_0xa47f('0xf')]('/:id',auth[_0xa47f('0x9')](),controller[_0xa47f('0x10')]);module[_0xa47f('0x11')]=router; \ No newline at end of file +var _0xfe2c=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xfe2c,0x102));var _0xcfe2=function(_0x41ecac,_0x18f951){_0x41ecac=_0x41ecac-0x0;var _0x1b0abc=_0xfe2c[_0x41ecac];return _0x1b0abc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcfe2('0x0'));var timeout=require(_0xcfe2('0x1'));var express=require(_0xcfe2('0x2'));var router=express[_0xcfe2('0x3')]();var fs_extra=require(_0xcfe2('0x4'));var auth=require(_0xcfe2('0x5'));var interaction=require(_0xcfe2('0x6'));var config=require(_0xcfe2('0x7'));var controller=require(_0xcfe2('0x8'));router[_0xcfe2('0x9')]('/',auth[_0xcfe2('0xa')](),controller[_0xcfe2('0xb')]);router[_0xcfe2('0x9')](_0xcfe2('0xc'),auth[_0xcfe2('0xa')](),controller[_0xcfe2('0xd')]);router['get'](_0xcfe2('0xe'),auth['isAuthenticated'](),controller[_0xcfe2('0xf')]);router[_0xcfe2('0x10')]('/',auth[_0xcfe2('0xa')](),controller[_0xcfe2('0x11')]);router[_0xcfe2('0x12')]('/:id',auth[_0xcfe2('0xa')](),controller[_0xcfe2('0x13')]);router[_0xcfe2('0x14')](_0xcfe2('0xc'),auth[_0xcfe2('0xa')](),controller['destroy']);module[_0xcfe2('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 75a66bf..152e41a 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 _0xf47c=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x434f9d,_0xe19810){var _0x5c0a3c=function(_0x5ebfcf){while(--_0x5ebfcf){_0x434f9d['push'](_0x434f9d['shift']());}};_0x5c0a3c(++_0xe19810);}(_0xf47c,0x1c2));var _0xcf47=function(_0x5957d9,_0x14afcb){_0x5957d9=_0x5957d9-0x0;var _0x5f0032=_0xf47c[_0x5957d9];return _0x5f0032;};'use strict';var Sequelize=require(_0xcf47('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf47('0x1')],'get':function(_0x38c9d6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xcf47('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xcf47('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xcf47('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xcf47('0x5')](_0xcf47('0x6'))}}; \ No newline at end of file +var _0xa568=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','VIRTUAL'];(function(_0x1a8146,_0x53831c){var _0x5c03aa=function(_0x1b6e2d){while(--_0x1b6e2d){_0x1a8146['push'](_0x1a8146['shift']());}};_0x5c03aa(++_0x53831c);}(_0xa568,0xde));var _0x8a56=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa568[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x8a56('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a56('0x1')],'get':function(_0x3d4345){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8a56('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x8a56('0x4')](_0x8a56('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x8a56('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8a56('0x6'),'defaultValue':Sequelize[_0x8a56('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 5bd23ed..474d178 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 _0x9ed1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','name','query','filters','intersection','attributes','fields','length','sort','where','pick','merge','include','rows','catch','show','params','keys','includeAll','find','create','update','body','download','msg_id','recording','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x397f51,_0xe18bba){var _0x34bfa9=function(_0x5ebe64){while(--_0x5ebe64){_0x397f51['push'](_0x397f51['shift']());}};_0x34bfa9(++_0xe18bba);}(_0x9ed1,0x128));var _0x19ed=function(_0x40e7eb,_0x2d3863){_0x40e7eb=_0x40e7eb-0x0;var _0x12cfe8=_0x9ed1[_0x40e7eb];return _0x12cfe8;};'use strict';var emlformat=require(_0x19ed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x19ed('0x1'));var rp=require(_0x19ed('0x2'));var moment=require(_0x19ed('0x3'));var BPromise=require(_0x19ed('0x4'));var Mustache=require('mustache');var util=require(_0x19ed('0x5'));var path=require(_0x19ed('0x6'));var sox=require(_0x19ed('0x7'));var csv=require(_0x19ed('0x8'));var ejs=require(_0x19ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x19ed('0xa'));var squel=require(_0x19ed('0xb'));var crypto=require(_0x19ed('0xc'));var jsforce=require(_0x19ed('0xd'));var deskjs=require(_0x19ed('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x19ed('0xf'));var Redis=require(_0x19ed('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x19ed('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x19ed('0x12'))(_0x19ed('0x13'));var utils=require(_0x19ed('0x14'));var config=require(_0x19ed('0x15'));var licenseUtil=require(_0x19ed('0x16'));var db=require(_0x19ed('0x17'))['db'];function respondWithStatusCode(_0x245052,_0x1aa163){_0x1aa163=_0x1aa163||0xcc;return function(_0x4643fc){if(_0x4643fc){return _0x245052[_0x19ed('0x18')](_0x1aa163);}return _0x245052[_0x19ed('0x19')](_0x1aa163)[_0x19ed('0x1a')]();};}function respondWithResult(_0x6bab52,_0x11bbf5){_0x11bbf5=_0x11bbf5||0xc8;return function(_0x4e7c38){if(_0x4e7c38){return _0x6bab52[_0x19ed('0x19')](_0x11bbf5)[_0x19ed('0x1b')](_0x4e7c38);}};}function respondWithFilteredResult(_0x427e94,_0xf2b590){return function(_0x114da9){if(_0x114da9){var _0x1ed819=typeof _0xf2b590[_0x19ed('0x1c')]===_0x19ed('0x1d')&&typeof _0xf2b590[_0x19ed('0x1e')]===_0x19ed('0x1d');var _0x4b11f2=_0x114da9[_0x19ed('0x1f')];var _0x44ee6c=_0x1ed819?0x0:_0xf2b590['offset'];var _0x52c431=_0x1ed819?_0x114da9[_0x19ed('0x1f')]:_0xf2b590[_0x19ed('0x1c')]+_0xf2b590[_0x19ed('0x1e')];var _0x3baa1e;if(_0x52c431>=_0x4b11f2){_0x52c431=_0x4b11f2;_0x3baa1e=0xc8;}else{_0x3baa1e=0xce;}_0x427e94[_0x19ed('0x19')](_0x3baa1e);return _0x427e94[_0x19ed('0x20')](_0x19ed('0x21'),_0x44ee6c+'-'+_0x52c431+'/'+_0x4b11f2)[_0x19ed('0x1b')](_0x114da9);}return null;};}function patchUpdates(_0x2f07d8){return function(_0x30e511){try{jsonpatch[_0x19ed('0x22')](_0x30e511,_0x2f07d8,!![]);}catch(_0x44194d){return BPromise[_0x19ed('0x23')](_0x44194d);}return _0x30e511[_0x19ed('0x24')]();};}function saveUpdates(_0x16640f,_0x2dadb1){return function(_0x5c69ab){if(_0x5c69ab){return _0x5c69ab['update'](_0x16640f)[_0x19ed('0x25')](function(_0x4aab6c){return _0x4aab6c;});}return null;};}function removeEntity(_0x2fedb3,_0x53dbf3){return function(_0x4bd424){if(_0x4bd424){return _0x4bd424[_0x19ed('0x26')]()[_0x19ed('0x25')](function(){_0x2fedb3[_0x19ed('0x19')](0xcc)[_0x19ed('0x1a')]();});}};}function handleEntityNotFound(_0x2d78ef,_0x55c3b8){return function(_0x29e577){if(!_0x29e577){_0x2d78ef[_0x19ed('0x18')](0x194);}return _0x29e577;};}function handleError(_0x24109f,_0x520397){_0x520397=_0x520397||0x1f4;return function(_0x55a7e6){logger[_0x19ed('0x27')](_0x55a7e6['stack']);if(_0x55a7e6['name']){delete _0x55a7e6['name'];}_0x24109f[_0x19ed('0x19')](_0x520397)[_0x19ed('0x28')](_0x55a7e6);};}exports[_0x19ed('0x29')]=function(_0x4e1cfc,_0x1e62e1){var _0x25220c={},_0x484eb5={},_0x58c98b={'count':0x0,'rows':[]};var _0x2a8170=_[_0x19ed('0x2a')](db[_0x19ed('0x2b')][_0x19ed('0x2c')],function(_0x2443ea){return{'name':_0x2443ea[_0x19ed('0x2d')],'type':_0x2443ea[_0x19ed('0x2e')]['key']};});_0x484eb5[_0x19ed('0x2f')]=_[_0x19ed('0x30')](_[_0x19ed('0x2a')](_0x2a8170,'name'),[_0x19ed('0x31')]);_0x484eb5[_0x19ed('0x32')]=_['keys'](_0x4e1cfc[_0x19ed('0x32')]);_0x484eb5[_0x19ed('0x33')]=_[_0x19ed('0x34')](_0x484eb5['model'],_0x484eb5[_0x19ed('0x32')]);_0x25220c[_0x19ed('0x35')]=_['intersection'](_0x484eb5[_0x19ed('0x2f')],qs[_0x19ed('0x36')](_0x4e1cfc[_0x19ed('0x32')][_0x19ed('0x36')]));_0x25220c['attributes']=_0x25220c[_0x19ed('0x35')][_0x19ed('0x37')]?_0x25220c[_0x19ed('0x35')]:_0x484eb5[_0x19ed('0x2f')];if(!_0x4e1cfc[_0x19ed('0x32')]['hasOwnProperty']('nolimit')){_0x25220c[_0x19ed('0x1e')]=qs['limit'](_0x4e1cfc[_0x19ed('0x32')][_0x19ed('0x1e')]);_0x25220c[_0x19ed('0x1c')]=qs[_0x19ed('0x1c')](_0x4e1cfc[_0x19ed('0x32')][_0x19ed('0x1c')]);}_0x25220c['order']=qs[_0x19ed('0x38')](_0x4e1cfc[_0x19ed('0x32')][_0x19ed('0x38')]);_0x25220c[_0x19ed('0x39')]=qs[_0x19ed('0x33')](_[_0x19ed('0x3a')](_0x4e1cfc[_0x19ed('0x32')],_0x484eb5[_0x19ed('0x33')]),_0x2a8170);if(_0x4e1cfc['query']['filter']){_0x25220c[_0x19ed('0x39')]=_[_0x19ed('0x3b')](_0x25220c['where'],{'$or':_['map'](_0x2a8170,function(_0x4e07ae){if(_0x4e07ae[_0x19ed('0x2e')]!=='VIRTUAL'){var _0x4e3ef6={};_0x4e3ef6[_0x4e07ae[_0x19ed('0x31')]]={'$like':'%'+_0x4e1cfc[_0x19ed('0x32')]['filter']+'%'};return _0x4e3ef6;}})});}_0x25220c=_['merge']({},_0x25220c,_0x4e1cfc['options']);var _0x590a42={'where':_0x25220c[_0x19ed('0x39')]};return db[_0x19ed('0x2b')][_0x19ed('0x1f')](_0x590a42)[_0x19ed('0x25')](function(_0x20fcda){_0x58c98b[_0x19ed('0x1f')]=_0x20fcda;if(_0x4e1cfc['query']['includeAll']){_0x25220c[_0x19ed('0x3c')]=[{'all':!![]}];}return db[_0x19ed('0x2b')]['findAll'](_0x25220c);})[_0x19ed('0x25')](function(_0x1c74c0){_0x58c98b[_0x19ed('0x3d')]=_0x1c74c0;return _0x58c98b;})[_0x19ed('0x25')](respondWithFilteredResult(_0x1e62e1,_0x25220c))[_0x19ed('0x3e')](handleError(_0x1e62e1,null));};exports[_0x19ed('0x3f')]=function(_0xe1c7be,_0x2eed46){var _0x53d14={'raw':!![],'where':{'id':_0xe1c7be[_0x19ed('0x40')]['id']}},_0x1984af={};_0x1984af[_0x19ed('0x2f')]=_['keys'](db[_0x19ed('0x2b')][_0x19ed('0x2c')]);_0x1984af[_0x19ed('0x32')]=_[_0x19ed('0x41')](_0xe1c7be[_0x19ed('0x32')]);_0x1984af[_0x19ed('0x33')]=_[_0x19ed('0x34')](_0x1984af[_0x19ed('0x2f')],_0x1984af[_0x19ed('0x32')]);_0x53d14[_0x19ed('0x35')]=_[_0x19ed('0x34')](_0x1984af['model'],qs[_0x19ed('0x36')](_0xe1c7be[_0x19ed('0x32')]['fields']));_0x53d14[_0x19ed('0x35')]=_0x53d14['attributes'][_0x19ed('0x37')]?_0x53d14[_0x19ed('0x35')]:_0x1984af[_0x19ed('0x2f')];if(_0xe1c7be[_0x19ed('0x32')][_0x19ed('0x42')]){_0x53d14['include']=[{'all':!![]}];}_0x53d14=_[_0x19ed('0x3b')]({},_0x53d14,_0xe1c7be['options']);return db[_0x19ed('0x2b')][_0x19ed('0x43')](_0x53d14)[_0x19ed('0x25')](handleEntityNotFound(_0x2eed46,null))[_0x19ed('0x25')](respondWithResult(_0x2eed46,null))['catch'](handleError(_0x2eed46,null));};exports[_0x19ed('0x44')]=function(_0x285b56,_0x53b23b){return db[_0x19ed('0x2b')][_0x19ed('0x44')](_0x285b56['body'],{})[_0x19ed('0x25')](respondWithResult(_0x53b23b,0xc9))[_0x19ed('0x3e')](handleError(_0x53b23b,null));};exports[_0x19ed('0x45')]=function(_0x7edf36,_0x1cf986){if(_0x7edf36[_0x19ed('0x46')]['id']){delete _0x7edf36[_0x19ed('0x46')]['id'];}return db['VoiceMailMessage'][_0x19ed('0x43')]({'where':{'id':_0x7edf36['params']['id']}})['then'](handleEntityNotFound(_0x1cf986,null))[_0x19ed('0x25')](saveUpdates(_0x7edf36[_0x19ed('0x46')],null))[_0x19ed('0x25')](respondWithResult(_0x1cf986,null))[_0x19ed('0x3e')](handleError(_0x1cf986,null));};exports['destroy']=function(_0x5394d4,_0x4c5f76){return db[_0x19ed('0x2b')][_0x19ed('0x43')]({'where':{'id':_0x5394d4[_0x19ed('0x40')]['id']}})[_0x19ed('0x25')](handleEntityNotFound(_0x4c5f76,null))[_0x19ed('0x25')](removeEntity(_0x4c5f76,null))[_0x19ed('0x3e')](handleError(_0x4c5f76,null));};exports[_0x19ed('0x47')]=function(_0x2bffca,_0x29f2da,_0x31c97b){return db[_0x19ed('0x2b')][_0x19ed('0x43')]({'where':{'id':_0x2bffca[_0x19ed('0x40')]['id']},'attributes':['id','recording',_0x19ed('0x48')]})['then'](handleEntityNotFound(_0x29f2da,null))[_0x19ed('0x25')](function(_0x519890){if(_0x519890){if(!_0x519890[_0x19ed('0x49')]){throw new db['Sequelize']['ValidationError'](_0x19ed('0x4a'));}var _0x388552={'Content-Type':_0x19ed('0x4b'),'Content-Disposition':_0x19ed('0x4c')};if(_0x519890[_0x19ed('0x48')]){_0x388552[_0x19ed('0x4d')]=_0x19ed('0x4e')+_0x519890[_0x19ed('0x48')]+'.wav\x22';}_0x29f2da['set'](_0x388552);return _0x29f2da[_0x19ed('0x28')](new Buffer(_0x519890[_0x19ed('0x49')]));}})[_0x19ed('0x3e')](handleError(_0x29f2da,null));}; \ No newline at end of file +var _0x0d4a=['end','json','undefined','offset','count','set','apply','reject','save','update','then','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','differenceBy','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','find','destroy','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x1dd99b,_0x2a91e3){var _0x5af57c=function(_0x4e7931){while(--_0x4e7931){_0x1dd99b['push'](_0x1dd99b['shift']());}};_0x5af57c(++_0x2a91e3);}(_0x0d4a,0x86));var _0xa0d4=function(_0x5d2985,_0x4bb772){_0x5d2985=_0x5d2985-0x0;var _0x1e74db=_0x0d4a[_0x5d2985];return _0x1e74db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0d4('0x0'));var zipdir=require(_0xa0d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa0d4('0x2'));var BPromise=require(_0xa0d4('0x3'));var Mustache=require(_0xa0d4('0x4'));var util=require('util');var path=require(_0xa0d4('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa0d4('0x6'));var fs=require('fs');var fs_extra=require(_0xa0d4('0x7'));var _=require(_0xa0d4('0x8'));var squel=require(_0xa0d4('0x9'));var crypto=require('crypto');var jsforce=require(_0xa0d4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa0d4('0xb'));var querystring=require(_0xa0d4('0xc'));var Papa=require(_0xa0d4('0xd'));var Redis=require(_0xa0d4('0xe'));var authService=require(_0xa0d4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa0d4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa0d4('0x11'))(_0xa0d4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa0d4('0x13'))['db'];function respondWithStatusCode(_0x278617,_0x112bf8){_0x112bf8=_0x112bf8||0xcc;return function(_0xd045c6){if(_0xd045c6){return _0x278617[_0xa0d4('0x14')](_0x112bf8);}return _0x278617[_0xa0d4('0x15')](_0x112bf8)[_0xa0d4('0x16')]();};}function respondWithResult(_0x3017cd,_0x3f355e){_0x3f355e=_0x3f355e||0xc8;return function(_0x2de853){if(_0x2de853){return _0x3017cd[_0xa0d4('0x15')](_0x3f355e)[_0xa0d4('0x17')](_0x2de853);}};}function respondWithFilteredResult(_0x17ac81,_0x346210){return function(_0x3c0b22){if(_0x3c0b22){var _0x735827=typeof _0x346210['offset']==='undefined'&&typeof _0x346210['limit']===_0xa0d4('0x18');var _0x3ac1e0=_0x3c0b22['count'];var _0x40cacb=_0x735827?0x0:_0x346210[_0xa0d4('0x19')];var _0x14ed39=_0x735827?_0x3c0b22[_0xa0d4('0x1a')]:_0x346210[_0xa0d4('0x19')]+_0x346210['limit'];var _0xd145;if(_0x14ed39>=_0x3ac1e0){_0x14ed39=_0x3ac1e0;_0xd145=0xc8;}else{_0xd145=0xce;}_0x17ac81[_0xa0d4('0x15')](_0xd145);return _0x17ac81[_0xa0d4('0x1b')]('Content-Range',_0x40cacb+'-'+_0x14ed39+'/'+_0x3ac1e0)[_0xa0d4('0x17')](_0x3c0b22);}return null;};}function patchUpdates(_0x2413fa){return function(_0xf95eea){try{jsonpatch[_0xa0d4('0x1c')](_0xf95eea,_0x2413fa,!![]);}catch(_0x1ac11e){return BPromise[_0xa0d4('0x1d')](_0x1ac11e);}return _0xf95eea[_0xa0d4('0x1e')]();};}function saveUpdates(_0x1ee77e,_0x492140){return function(_0x268645){if(_0x268645){return _0x268645[_0xa0d4('0x1f')](_0x1ee77e)[_0xa0d4('0x20')](function(_0x1f015b){return _0x1f015b;});}return null;};}function removeEntity(_0x39fb3c,_0x370b7b){return function(_0x19112e){if(_0x19112e){return _0x19112e['destroy']()['then'](function(){_0x39fb3c[_0xa0d4('0x15')](0xcc)[_0xa0d4('0x16')]();});}};}function handleEntityNotFound(_0x3a2794,_0x56ecdc){return function(_0x86e04c){if(!_0x86e04c){_0x3a2794[_0xa0d4('0x14')](0x194);}return _0x86e04c;};}function handleError(_0xfe23f3,_0x408178){_0x408178=_0x408178||0x1f4;return function(_0x9e3a83){logger['error'](_0x9e3a83[_0xa0d4('0x21')]);if(_0x9e3a83[_0xa0d4('0x22')]){delete _0x9e3a83['name'];}_0xfe23f3[_0xa0d4('0x15')](_0x408178)[_0xa0d4('0x23')](_0x9e3a83);};}exports[_0xa0d4('0x24')]=function(_0x511e84,_0x34a85c){var _0x2b686c={},_0x22e89f={},_0x3095b7={'count':0x0,'rows':[]};var _0x37c741=_[_0xa0d4('0x25')](db[_0xa0d4('0x26')][_0xa0d4('0x27')],function(_0x5d4e55){return{'name':_0x5d4e55[_0xa0d4('0x28')],'type':_0x5d4e55[_0xa0d4('0x29')]['key']};});_0x22e89f['model']=_[_0xa0d4('0x2a')](_['map'](_0x37c741,_0xa0d4('0x22')),[_0xa0d4('0x22')]);_0x22e89f[_0xa0d4('0x2b')]=_[_0xa0d4('0x2c')](_0x511e84[_0xa0d4('0x2b')]);_0x22e89f[_0xa0d4('0x2d')]=_[_0xa0d4('0x2e')](_0x22e89f['model'],_0x22e89f[_0xa0d4('0x2b')]);_0x2b686c[_0xa0d4('0x2f')]=_[_0xa0d4('0x2e')](_0x22e89f['model'],qs['fields'](_0x511e84['query'][_0xa0d4('0x30')]));_0x2b686c[_0xa0d4('0x2f')]=_0x2b686c[_0xa0d4('0x2f')]['length']?_0x2b686c[_0xa0d4('0x2f')]:_0x22e89f[_0xa0d4('0x31')];if(!_0x511e84[_0xa0d4('0x2b')][_0xa0d4('0x32')](_0xa0d4('0x33'))){_0x2b686c[_0xa0d4('0x34')]=qs[_0xa0d4('0x34')](_0x511e84[_0xa0d4('0x2b')][_0xa0d4('0x34')]);_0x2b686c['offset']=qs[_0xa0d4('0x19')](_0x511e84['query'][_0xa0d4('0x19')]);}_0x2b686c[_0xa0d4('0x35')]=qs[_0xa0d4('0x36')](_0x511e84['query'][_0xa0d4('0x36')]);_0x2b686c[_0xa0d4('0x37')]=qs[_0xa0d4('0x2d')](_[_0xa0d4('0x38')](_0x511e84['query'],_0x22e89f['filters']),_0x37c741);if(_0x511e84[_0xa0d4('0x2b')][_0xa0d4('0x39')]){_0x2b686c[_0xa0d4('0x37')]=_[_0xa0d4('0x3a')](_0x2b686c[_0xa0d4('0x37')],{'$or':_['map'](_0x37c741,function(_0xa8ea05){if(_0xa8ea05['type']!==_0xa0d4('0x3b')){var _0x45fcf={};_0x45fcf[_0xa8ea05['name']]={'$like':'%'+_0x511e84['query'][_0xa0d4('0x39')]+'%'};return _0x45fcf;}})});}_0x2b686c=_[_0xa0d4('0x3a')]({},_0x2b686c,_0x511e84[_0xa0d4('0x3c')]);var _0xfe178a={'where':_0x2b686c[_0xa0d4('0x37')]};return db['VoiceMailMessage']['count'](_0xfe178a)['then'](function(_0xaa3761){_0x3095b7[_0xa0d4('0x1a')]=_0xaa3761;if(_0x511e84[_0xa0d4('0x2b')][_0xa0d4('0x3d')]){_0x2b686c[_0xa0d4('0x3e')]=[{'all':!![]}];}return db[_0xa0d4('0x26')][_0xa0d4('0x3f')](_0x2b686c);})['then'](function(_0x4a8eb9){_0x3095b7[_0xa0d4('0x40')]=_0x4a8eb9;return _0x3095b7;})[_0xa0d4('0x20')](respondWithFilteredResult(_0x34a85c,_0x2b686c))[_0xa0d4('0x41')](handleError(_0x34a85c,null));};exports['show']=function(_0x26cafc,_0x5404da){var _0x4f0db9={'raw':!![],'where':{'id':_0x26cafc[_0xa0d4('0x42')]['id']}},_0x347997={};_0x347997[_0xa0d4('0x31')]=_[_0xa0d4('0x2c')](db[_0xa0d4('0x26')][_0xa0d4('0x27')]);_0x347997[_0xa0d4('0x2b')]=_['keys'](_0x26cafc[_0xa0d4('0x2b')]);_0x347997['filters']=_['intersection'](_0x347997[_0xa0d4('0x31')],_0x347997[_0xa0d4('0x2b')]);_0x4f0db9['attributes']=_[_0xa0d4('0x2e')](_0x347997[_0xa0d4('0x31')],qs['fields'](_0x26cafc['query'][_0xa0d4('0x30')]));_0x4f0db9[_0xa0d4('0x2f')]=_0x4f0db9[_0xa0d4('0x2f')][_0xa0d4('0x43')]?_0x4f0db9[_0xa0d4('0x2f')]:_0x347997[_0xa0d4('0x31')];if(_0x26cafc['query'][_0xa0d4('0x3d')]){_0x4f0db9['include']=[{'all':!![]}];}_0x4f0db9=_[_0xa0d4('0x3a')]({},_0x4f0db9,_0x26cafc[_0xa0d4('0x3c')]);return db[_0xa0d4('0x26')]['find'](_0x4f0db9)[_0xa0d4('0x20')](handleEntityNotFound(_0x5404da,null))[_0xa0d4('0x20')](respondWithResult(_0x5404da,null))[_0xa0d4('0x41')](handleError(_0x5404da,null));};exports[_0xa0d4('0x44')]=function(_0x120fc5,_0x230e62){return db[_0xa0d4('0x26')]['create'](_0x120fc5[_0xa0d4('0x45')],{})[_0xa0d4('0x20')](respondWithResult(_0x230e62,0xc9))['catch'](handleError(_0x230e62,null));};exports[_0xa0d4('0x1f')]=function(_0x1c48e4,_0x347f8d){if(_0x1c48e4[_0xa0d4('0x45')]['id']){delete _0x1c48e4[_0xa0d4('0x45')]['id'];}return db['VoiceMailMessage'][_0xa0d4('0x46')]({'where':{'id':_0x1c48e4['params']['id']}})[_0xa0d4('0x20')](handleEntityNotFound(_0x347f8d,null))['then'](saveUpdates(_0x1c48e4['body'],null))['then'](respondWithResult(_0x347f8d,null))[_0xa0d4('0x41')](handleError(_0x347f8d,null));};exports[_0xa0d4('0x47')]=function(_0x22b0f3,_0x3d4ba3){return db['VoiceMailMessage']['find']({'where':{'id':_0x22b0f3[_0xa0d4('0x42')]['id']}})[_0xa0d4('0x20')](handleEntityNotFound(_0x3d4ba3,null))[_0xa0d4('0x20')](removeEntity(_0x3d4ba3,null))[_0xa0d4('0x41')](handleError(_0x3d4ba3,null));};exports['download']=function(_0x130800,_0x175af5,_0x9b1831){return db[_0xa0d4('0x26')][_0xa0d4('0x46')]({'where':{'id':_0x130800[_0xa0d4('0x42')]['id']},'attributes':['id',_0xa0d4('0x48'),_0xa0d4('0x49')]})[_0xa0d4('0x20')](handleEntityNotFound(_0x175af5,null))[_0xa0d4('0x20')](function(_0xa8d550){if(_0xa8d550){if(!_0xa8d550[_0xa0d4('0x48')]){throw new db['Sequelize']['ValidationError'](_0xa0d4('0x4a'));}var _0x56cdf5={'Content-Type':_0xa0d4('0x4b'),'Content-Disposition':_0xa0d4('0x4c')};if(_0xa8d550[_0xa0d4('0x49')]){_0x56cdf5['Content-Disposition']='attachment;\x20filename=\x22'+_0xa8d550[_0xa0d4('0x49')]+_0xa0d4('0x4d');}_0x175af5['set'](_0x56cdf5);return _0x175af5['send'](new Buffer(_0xa8d550[_0xa0d4('0x48')]));}})[_0xa0d4('0x41')](handleError(_0x175af5,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 155a761..0ed1f99 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 _0x03da=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api'];(function(_0x4a5f6c,_0x4f532e){var _0x281ffd=function(_0x4c68e3){while(--_0x4c68e3){_0x4a5f6c['push'](_0x4a5f6c['shift']());}};_0x281ffd(++_0x4f532e);}(_0x03da,0x1b7));var _0xa03d=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x03da[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require('lodash');var util=require(_0xa03d('0x0'));var logger=require(_0xa03d('0x1'))(_0xa03d('0x2'));var moment=require('moment');var BPromise=require(_0xa03d('0x3'));var rp=require(_0xa03d('0x4'));var fs=require('fs');var path=require(_0xa03d('0x5'));var rimraf=require(_0xa03d('0x6'));var config=require(_0xa03d('0x7'));var attributes=require(_0xa03d('0x8'));module[_0xa03d('0x9')]=function(_0x30c627,_0x47cb2d){return _0x30c627['define'](_0xa03d('0xa'),attributes,{'tableName':_0xa03d('0xb'),'paranoid':![],'indexes':[{'name':_0xa03d('0xc'),'fields':[_0xa03d('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x58a1=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','dir','lodash','../../config/logger','moment','bluebird'];(function(_0x1783dd,_0x347363){var _0x2b874b=function(_0x4b3cc9){while(--_0x4b3cc9){_0x1783dd['push'](_0x1783dd['shift']());}};_0x2b874b(++_0x347363);}(_0x58a1,0x98));var _0x158a=function(_0x5be0a1,_0x49ee54){_0x5be0a1=_0x5be0a1-0x0;var _0x1e3f13=_0x58a1[_0x5be0a1];return _0x1e3f13;};'use strict';var _=require(_0x158a('0x0'));var util=require('util');var logger=require(_0x158a('0x1'))('api');var moment=require(_0x158a('0x2'));var BPromise=require(_0x158a('0x3'));var rp=require(_0x158a('0x4'));var fs=require('fs');var path=require(_0x158a('0x5'));var rimraf=require(_0x158a('0x6'));var config=require(_0x158a('0x7'));var attributes=require(_0x158a('0x8'));module[_0x158a('0x9')]=function(_0x52549f,_0x317424){return _0x52549f[_0x158a('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x158a('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x158a('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index ca7412f..e30b4a8 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 _0x193f=['message','VoiceMailMessage,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1f1283,_0x1bea3b){var _0x205041=function(_0x3f8fe4){while(--_0x3f8fe4){_0x1f1283['push'](_0x1f1283['shift']());}};_0x205041(++_0x1bea3b);}(_0x193f,0xa2));var _0xf193=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0x193f[_0x5a2d95];return _0x2c3986;};'use strict';var _=require(_0xf193('0x0'));var util=require(_0xf193('0x1'));var moment=require(_0xf193('0x2'));var BPromise=require(_0xf193('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf193('0x4'));var db=require(_0xf193('0x5'))['db'];var utils=require(_0xf193('0x6'));var logger=require(_0xf193('0x7'))('rpc');var config=require(_0xf193('0x8'));var jayson=require(_0xf193('0x9'));var client=jayson['client'][_0xf193('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cfbc8,_0x34224b,_0x34af9e){return new BPromise(function(_0x3f8e4c,_0x410b62){return client['request'](_0x1cfbc8,_0x34af9e)[_0xf193('0xb')](function(_0x2c394d){logger[_0xf193('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x34224b,_0xf193('0xd'));logger[_0xf193('0xe')](_0xf193('0xf'),_0x34224b,_0xf193('0xd'),JSON[_0xf193('0x10')](_0x2c394d));if(_0x2c394d['error']){if(_0x2c394d[_0xf193('0x11')]['code']===0x1f4){logger[_0xf193('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x34224b,_0x2c394d['error'][_0xf193('0x12')]);return _0x410b62(_0x2c394d['error'][_0xf193('0x12')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x34224b,_0x2c394d[_0xf193('0x11')]['message']);return _0x3f8e4c(_0x2c394d[_0xf193('0x11')]['message']);}else{logger[_0xf193('0xc')](_0xf193('0x13'),_0x34224b,'request\x20sent');_0x3f8e4c(_0x2c394d['result'][_0xf193('0x12')]);}})['catch'](function(_0x464044){logger['error'](_0xf193('0x13'),_0x34224b,_0x464044);_0x410b62(_0x464044);});});} \ No newline at end of file +var _0x380a=['request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x380a,0x19a));var _0xa380=function(_0x1c07c3,_0x41e664){_0x1c07c3=_0x1c07c3-0x0;var _0x3728b4=_0x380a[_0x1c07c3];return _0x3728b4;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa380('0x2'));var fs=require('fs');var Redis=require(_0xa380('0x3'));var db=require(_0xa380('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa380('0x5'))('rpc');var config=require(_0xa380('0x6'));var jayson=require(_0xa380('0x7'));var client=jayson[_0xa380('0x8')][_0xa380('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bacb1,_0x53cd76,_0x4f5c68){return new BPromise(function(_0x158651,_0x5400da){return client[_0xa380('0xa')](_0x1bacb1,_0x4f5c68)['then'](function(_0x73743c){logger[_0xa380('0xb')](_0xa380('0xc'),_0x53cd76,_0xa380('0xd'));logger[_0xa380('0xe')](_0xa380('0xf'),_0x53cd76,'request\x20sent',JSON[_0xa380('0x10')](_0x73743c));if(_0x73743c[_0xa380('0x11')]){if(_0x73743c['error'][_0xa380('0x12')]===0x1f4){logger['error'](_0xa380('0xc'),_0x53cd76,_0x73743c[_0xa380('0x11')][_0xa380('0x13')]);return _0x5400da(_0x73743c[_0xa380('0x11')][_0xa380('0x13')]);}logger[_0xa380('0x11')](_0xa380('0xc'),_0x53cd76,_0x73743c[_0xa380('0x11')]['message']);return _0x158651(_0x73743c['error'][_0xa380('0x13')]);}else{logger[_0xa380('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x53cd76,_0xa380('0xd'));_0x158651(_0x73743c[_0xa380('0x14')][_0xa380('0x13')]);}})['catch'](function(_0x17e57f){logger['error'](_0xa380('0xc'),_0x53cd76,_0x17e57f);_0x5400da(_0x17e57f);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 981f6c3..fad08b4 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 _0x6fd0=['put','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','addSound'];(function(_0x1aa39b,_0x25f6c7){var _0x168eb4=function(_0x49c0d7){while(--_0x49c0d7){_0x1aa39b['push'](_0x1aa39b['shift']());}};_0x168eb4(++_0x25f6c7);}(_0x6fd0,0x1b0));var _0x06fd=function(_0x428bb8,_0x1df593){_0x428bb8=_0x428bb8-0x0;var _0x3cbab8=_0x6fd0[_0x428bb8];return _0x3cbab8;};'use strict';var multer=require('multer');var util=require(_0x06fd('0x0'));var path=require(_0x06fd('0x1'));var timeout=require(_0x06fd('0x2'));var express=require(_0x06fd('0x3'));var router=express[_0x06fd('0x4')]();var fs_extra=require(_0x06fd('0x5'));var auth=require(_0x06fd('0x6'));var interaction=require(_0x06fd('0x7'));var config=require(_0x06fd('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x06fd('0x9')]('/',auth[_0x06fd('0xa')](),controller[_0x06fd('0xb')]);router[_0x06fd('0x9')](_0x06fd('0xc'),auth[_0x06fd('0xa')](),controller['show']);router[_0x06fd('0x9')](_0x06fd('0xd'),auth[_0x06fd('0xa')](),controller[_0x06fd('0xe')]);router[_0x06fd('0xf')]('/',auth[_0x06fd('0xa')](),controller[_0x06fd('0x10')]);router['post']('/:id/sounds',auth[_0x06fd('0xa')](),controller[_0x06fd('0x11')]);router[_0x06fd('0x12')](_0x06fd('0xc'),auth[_0x06fd('0xa')](),controller[_0x06fd('0x13')]);router['delete']('/:id',auth[_0x06fd('0xa')](),controller[_0x06fd('0x14')]);router[_0x06fd('0x15')](_0x06fd('0x16'),auth[_0x06fd('0xa')](),controller[_0x06fd('0x17')]);module[_0x06fd('0x18')]=router; \ No newline at end of file +var _0xcba0=['update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','create','post','addSound','put','/:id'];(function(_0x2bed9b,_0x2a12c7){var _0x26673d=function(_0x513109){while(--_0x513109){_0x2bed9b['push'](_0x2bed9b['shift']());}};_0x26673d(++_0x2a12c7);}(_0xcba0,0x1d4));var _0x0cba=function(_0x21b14c,_0x5f2002){_0x21b14c=_0x21b14c-0x0;var _0x9aaed5=_0xcba0[_0x21b14c];return _0x9aaed5;};'use strict';var multer=require('multer');var util=require(_0x0cba('0x0'));var path=require(_0x0cba('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x0cba('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x0cba('0x3'));var config=require('../../config/environment');var controller=require(_0x0cba('0x4'));router[_0x0cba('0x5')]('/',auth[_0x0cba('0x6')](),controller[_0x0cba('0x7')]);router[_0x0cba('0x5')]('/:id',auth[_0x0cba('0x6')](),controller[_0x0cba('0x8')]);router[_0x0cba('0x5')](_0x0cba('0x9'),auth[_0x0cba('0x6')](),controller[_0x0cba('0xa')]);router['post']('/',auth[_0x0cba('0x6')](),controller[_0x0cba('0xb')]);router[_0x0cba('0xc')](_0x0cba('0x9'),auth[_0x0cba('0x6')](),controller[_0x0cba('0xd')]);router[_0x0cba('0xe')](_0x0cba('0xf'),auth['isAuthenticated'](),controller[_0x0cba('0x10')]);router[_0x0cba('0x11')](_0x0cba('0xf'),auth[_0x0cba('0x6')](),controller[_0x0cba('0x12')]);router[_0x0cba('0x11')](_0x0cba('0x13'),auth['isAuthenticated'](),controller[_0x0cba('0x14')]);module[_0x0cba('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index bad9027..bcbf612 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 _0xa56b=['exports','STRING','name','ENUM','files','quietmp3nb','quietmp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x39a4ce,_0x4a96e8){var _0x4ed4d6=function(_0x22a113){while(--_0x22a113){_0x39a4ce['push'](_0x39a4ce['shift']());}};_0x4ed4d6(++_0x4a96e8);}(_0xa56b,0x1a1));var _0xba56=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xa56b[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0xba56('0x0'));module[_0xba56('0x1')]={'name':{'type':Sequelize[_0xba56('0x2')],'allowNull':![],'unique':_0xba56('0x3')},'mode':{'type':Sequelize[_0xba56('0x4')]('custom',_0xba56('0x5'),'mp3nb',_0xba56('0x6'),_0xba56('0x7'),'mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xba56('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xba56('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xba56('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xba56('0x2')],'allowNull':!![],'defaultValue':_0xba56('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xba56('0x9')},'defaultEntry':{'type':Sequelize[_0xba56('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1e47=['name','custom','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP','exports','STRING'];(function(_0x2211c9,_0x4d5d5e){var _0x273164=function(_0x35ffda){while(--_0x35ffda){_0x2211c9['push'](_0x2211c9['shift']());}};_0x273164(++_0x4d5d5e);}(_0x1e47,0x8a));var _0x71e4=function(_0x101204,_0x544af4){_0x101204=_0x101204-0x0;var _0xaac788=_0x1e47[_0x101204];return _0xaac788;};'use strict';var Sequelize=require('sequelize');module[_0x71e4('0x0')]={'name':{'type':Sequelize[_0x71e4('0x1')],'allowNull':![],'unique':_0x71e4('0x2')},'mode':{'type':Sequelize['ENUM'](_0x71e4('0x3'),'files','mp3nb',_0x71e4('0x4'),_0x71e4('0x5'),_0x71e4('0x6')),'allowNull':!![],'defaultValue':_0x71e4('0x7')},'directory':{'type':Sequelize[_0x71e4('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x71e4('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x71e4('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x71e4('0x1')],'allowNull':!![],'defaultValue':_0x71e4('0x8')},'format':{'type':Sequelize[_0x71e4('0x1')],'allowNull':!![]},'stamp':{'type':_0x71e4('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 9f192c6..c33c632 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 _0xe580=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','send','index','map','VoiceMusicOnHold','rawAttributes','type','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','find','catch','body','create','sequelize','transaction','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','extname','%s.%s','symlinkSync','removeSound','id2','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset'];(function(_0x3bc043,_0x226a0c){var _0x2dc021=function(_0x20f219){while(--_0x20f219){_0x3bc043['push'](_0x3bc043['shift']());}};_0x2dc021(++_0x226a0c);}(_0xe580,0xc5));var _0x0e58=function(_0x38282d,_0x174d01){_0x38282d=_0x38282d-0x0;var _0x4fbfd4=_0xe580[_0x38282d];return _0x4fbfd4;};'use strict';var emlformat=require(_0x0e58('0x0'));var rimraf=require(_0x0e58('0x1'));var zipdir=require(_0x0e58('0x2'));var jsonpatch=require(_0x0e58('0x3'));var rp=require(_0x0e58('0x4'));var moment=require('moment');var BPromise=require(_0x0e58('0x5'));var Mustache=require('mustache');var util=require(_0x0e58('0x6'));var path=require(_0x0e58('0x7'));var sox=require('sox');var csv=require(_0x0e58('0x8'));var ejs=require(_0x0e58('0x9'));var fs=require('fs');var fs_extra=require(_0x0e58('0xa'));var _=require('lodash');var squel=require(_0x0e58('0xb'));var crypto=require(_0x0e58('0xc'));var jsforce=require(_0x0e58('0xd'));var deskjs=require(_0x0e58('0xe'));var toCsv=require(_0x0e58('0x8'));var querystring=require(_0x0e58('0xf'));var Papa=require(_0x0e58('0x10'));var Redis=require(_0x0e58('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0e58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e58('0x13'));var logger=require('../../config/logger')(_0x0e58('0x14'));var utils=require(_0x0e58('0x15'));var config=require(_0x0e58('0x16'));var licenseUtil=require(_0x0e58('0x17'));var db=require(_0x0e58('0x18'))['db'];function respondWithStatusCode(_0x3acaac,_0x48933d){_0x48933d=_0x48933d||0xcc;return function(_0x50ea9f){if(_0x50ea9f){return _0x3acaac[_0x0e58('0x19')](_0x48933d);}return _0x3acaac[_0x0e58('0x1a')](_0x48933d)['end']();};}function respondWithResult(_0x1dffe3,_0xef1d9f){_0xef1d9f=_0xef1d9f||0xc8;return function(_0x37b2f1){if(_0x37b2f1){return _0x1dffe3['status'](_0xef1d9f)['json'](_0x37b2f1);}};}function respondWithFilteredResult(_0x43e59a,_0x4e26a1){return function(_0x489a4e){if(_0x489a4e){var _0x82e427=typeof _0x4e26a1['offset']==='undefined'&&typeof _0x4e26a1['limit']==='undefined';var _0xebd672=_0x489a4e[_0x0e58('0x1b')];var _0x2fcea7=_0x82e427?0x0:_0x4e26a1[_0x0e58('0x1c')];var _0x422f8a=_0x82e427?_0x489a4e[_0x0e58('0x1b')]:_0x4e26a1[_0x0e58('0x1c')]+_0x4e26a1[_0x0e58('0x1d')];var _0x2316d1;if(_0x422f8a>=_0xebd672){_0x422f8a=_0xebd672;_0x2316d1=0xc8;}else{_0x2316d1=0xce;}_0x43e59a['status'](_0x2316d1);return _0x43e59a[_0x0e58('0x1e')](_0x0e58('0x1f'),_0x2fcea7+'-'+_0x422f8a+'/'+_0xebd672)['json'](_0x489a4e);}return null;};}function patchUpdates(_0x19cf36){return function(_0x3c57e8){try{jsonpatch[_0x0e58('0x20')](_0x3c57e8,_0x19cf36,!![]);}catch(_0x507fd9){return BPromise[_0x0e58('0x21')](_0x507fd9);}return _0x3c57e8[_0x0e58('0x22')]();};}function saveUpdates(_0x2eb7de,_0x2027ff){return function(_0x58e66f){if(_0x58e66f){return _0x58e66f[_0x0e58('0x23')](_0x2eb7de)[_0x0e58('0x24')](function(_0x3fc1c5){return _0x3fc1c5;});}return null;};}function removeEntity(_0x8a46f6,_0x40ba22){return function(_0xa10b59){if(_0xa10b59){return _0xa10b59[_0x0e58('0x25')]()[_0x0e58('0x24')](function(){var _0x5ad836=_0xa10b59[_0x0e58('0x26')]({'plain':!![]});var _0x5aab74=_0x0e58('0x27');return db[_0x0e58('0x28')][_0x0e58('0x25')]({'where':{'type':_0x5aab74,'resourceId':_0x5ad836['id']}})[_0x0e58('0x24')](function(){return _0xa10b59;});})['then'](function(){_0x8a46f6[_0x0e58('0x1a')](0xcc)[_0x0e58('0x29')]();});}};}function handleEntityNotFound(_0x5a8488,_0x5e08ea){return function(_0x509164){if(!_0x509164){_0x5a8488['sendStatus'](0x194);}return _0x509164;};}function handleError(_0x54ce5f,_0xb86d6a){_0xb86d6a=_0xb86d6a||0x1f4;return function(_0x27da4){logger['error'](_0x27da4['stack']);if(_0x27da4['name']){delete _0x27da4['name'];}_0x54ce5f['status'](_0xb86d6a)[_0x0e58('0x2a')](_0x27da4);};}exports[_0x0e58('0x2b')]=function(_0x1a5005,_0x38799e){var _0x4e6989={},_0x33607={},_0x7b17de={'count':0x0,'rows':[]};var _0xee265e=_[_0x0e58('0x2c')](db[_0x0e58('0x2d')][_0x0e58('0x2e')],function(_0x219243){return{'name':_0x219243['fieldName'],'type':_0x219243[_0x0e58('0x2f')]['key']};});_0x33607[_0x0e58('0x30')]=_[_0x0e58('0x2c')](_0xee265e,_0x0e58('0x31'));_0x33607[_0x0e58('0x32')]=_[_0x0e58('0x33')](_0x1a5005[_0x0e58('0x32')]);_0x33607['filters']=_[_0x0e58('0x34')](_0x33607['model'],_0x33607[_0x0e58('0x32')]);_0x4e6989[_0x0e58('0x35')]=_[_0x0e58('0x34')](_0x33607[_0x0e58('0x30')],qs[_0x0e58('0x36')](_0x1a5005[_0x0e58('0x32')][_0x0e58('0x36')]));_0x4e6989[_0x0e58('0x35')]=_0x4e6989[_0x0e58('0x35')][_0x0e58('0x37')]?_0x4e6989[_0x0e58('0x35')]:_0x33607['model'];if(!_0x1a5005[_0x0e58('0x32')]['hasOwnProperty'](_0x0e58('0x38'))){_0x4e6989[_0x0e58('0x1d')]=qs['limit'](_0x1a5005[_0x0e58('0x32')][_0x0e58('0x1d')]);_0x4e6989[_0x0e58('0x1c')]=qs[_0x0e58('0x1c')](_0x1a5005[_0x0e58('0x32')][_0x0e58('0x1c')]);}_0x4e6989[_0x0e58('0x39')]=qs[_0x0e58('0x3a')](_0x1a5005[_0x0e58('0x32')]['sort']);delete _0x1a5005[_0x0e58('0x32')]['sort'];_0x4e6989[_0x0e58('0x3b')]=qs[_0x0e58('0x3c')](_[_0x0e58('0x3d')](_0x1a5005[_0x0e58('0x32')],_0x33607['filters']),_0xee265e);if(_0x1a5005['query']['filter']){_0x4e6989[_0x0e58('0x3b')]=_[_0x0e58('0x3e')](_0x4e6989['where'],{'$or':_['map'](_0xee265e,function(_0x193677){if(_0x193677[_0x0e58('0x2f')]!==_0x0e58('0x3f')){var _0x5b9023={};_0x5b9023[_0x193677[_0x0e58('0x31')]]={'$like':'%'+_0x1a5005['query'][_0x0e58('0x40')]+'%'};return _0x5b9023;}})});}_0x4e6989=_[_0x0e58('0x3e')]({},_0x4e6989,_0x1a5005[_0x0e58('0x41')]);var _0x102317={'where':_0x4e6989[_0x0e58('0x3b')]};return db[_0x0e58('0x2d')][_0x0e58('0x1b')](_0x102317)[_0x0e58('0x24')](function(_0x17ae3b){_0x7b17de[_0x0e58('0x1b')]=_0x17ae3b;if(_0x1a5005[_0x0e58('0x32')]['includeAll']){_0x4e6989[_0x0e58('0x42')]=[{'all':!![]}];}return db[_0x0e58('0x2d')][_0x0e58('0x43')](_0x4e6989);})[_0x0e58('0x24')](function(_0x3147ee){_0x7b17de[_0x0e58('0x44')]=_0x3147ee;return _0x7b17de;})[_0x0e58('0x24')](respondWithFilteredResult(_0x38799e,_0x4e6989))['catch'](handleError(_0x38799e,null));};exports[_0x0e58('0x45')]=function(_0x35a7d5,_0x4c8e15){var _0x24bc15={'raw':![],'where':{'id':_0x35a7d5[_0x0e58('0x46')]['id']}},_0x3c7e2b={};_0x3c7e2b[_0x0e58('0x30')]=_['keys'](db[_0x0e58('0x2d')][_0x0e58('0x2e')]);_0x3c7e2b['query']=_[_0x0e58('0x33')](_0x35a7d5[_0x0e58('0x32')]);_0x3c7e2b['filters']=_[_0x0e58('0x34')](_0x3c7e2b['model'],_0x3c7e2b[_0x0e58('0x32')]);_0x24bc15[_0x0e58('0x35')]=_[_0x0e58('0x34')](_0x3c7e2b[_0x0e58('0x30')],qs['fields'](_0x35a7d5[_0x0e58('0x32')][_0x0e58('0x36')]));_0x24bc15[_0x0e58('0x35')]=_0x24bc15[_0x0e58('0x35')][_0x0e58('0x37')]?_0x24bc15['attributes']:_0x3c7e2b[_0x0e58('0x30')];if(_0x35a7d5['query']['includeAll']){_0x24bc15[_0x0e58('0x42')]=[{'all':!![]}];}_0x24bc15=_[_0x0e58('0x3e')]({},_0x24bc15,_0x35a7d5[_0x0e58('0x41')]);return db[_0x0e58('0x2d')][_0x0e58('0x47')](_0x24bc15)[_0x0e58('0x24')](handleEntityNotFound(_0x4c8e15,null))['then'](respondWithResult(_0x4c8e15,null))[_0x0e58('0x48')](handleError(_0x4c8e15,null));};exports[_0x0e58('0x23')]=function(_0x4d2d79,_0x24b624){if(_0x4d2d79[_0x0e58('0x49')]['id']){delete _0x4d2d79[_0x0e58('0x49')]['id'];}return db[_0x0e58('0x2d')][_0x0e58('0x47')]({'where':{'id':_0x4d2d79[_0x0e58('0x46')]['id']}})[_0x0e58('0x24')](handleEntityNotFound(_0x24b624,null))['then'](saveUpdates(_0x4d2d79[_0x0e58('0x49')],null))[_0x0e58('0x24')](respondWithResult(_0x24b624,null))[_0x0e58('0x48')](handleError(_0x24b624,null));};exports[_0x0e58('0x4a')]=function(_0x38ba4c,_0x379e2b,_0x140f98){return db[_0x0e58('0x4b')][_0x0e58('0x4c')](function(_0x3a6af8){if(_0x38ba4c[_0x0e58('0x49')]['mode']===_0x0e58('0x4d')){_0x38ba4c[_0x0e58('0x49')]['directory']=path[_0x0e58('0x4e')](config[_0x0e58('0x4f')],_0x0e58('0x50'),_0x38ba4c[_0x0e58('0x49')][_0x0e58('0x31')]);}return db[_0x0e58('0x2d')][_0x0e58('0x4a')](_0x38ba4c['body'],{'transaction':_0x3a6af8})['then'](function(_0x15e9eb){if(_0x38ba4c[_0x0e58('0x49')]['mode']===_0x0e58('0x4d')){fs[_0x0e58('0x51')](_0x15e9eb[_0x0e58('0x52')],parseInt(_0x0e58('0x53'),0x8));}var _0x27c5cb=_0x38ba4c[_0x0e58('0x54')][_0x0e58('0x26')]({'plain':!![]});if(!_0x27c5cb)throw new Error(_0x0e58('0x55'));if(_0x27c5cb[_0x0e58('0x56')]===_0x0e58('0x54')){var _0x2c473c=_0x15e9eb[_0x0e58('0x26')]({'plain':!![]});return db[_0x0e58('0x57')][_0x0e58('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x27c5cb[_0x0e58('0x58')]},'raw':!![]})[_0x0e58('0x24')](function(_0x4b6d7e){if(_0x4b6d7e&&_0x4b6d7e[_0x0e58('0x59')]===0x0){return db[_0x0e58('0x28')][_0x0e58('0x4a')]({'name':_0x2c473c['name'],'resourceId':_0x2c473c['id'],'type':_0x4b6d7e[_0x0e58('0x31')],'sectionId':_0x4b6d7e['id']},{})['then'](function(){return _0x15e9eb;});}else{return _0x15e9eb;}})[_0x0e58('0x48')](function(_0x3a3af0){logger[_0x0e58('0x5a')](_0x0e58('0x5b'),_0x3a3af0);});}return _0x15e9eb;});})[_0x0e58('0x24')](respondWithResult(_0x379e2b,0xc9))['catch'](handleError(_0x379e2b,null));};exports[_0x0e58('0x25')]=function(_0x242285,_0x4d43c7,_0x534533){var _0x9e3e02;return db[_0x0e58('0x2d')][_0x0e58('0x47')]({'where':{'id':_0x242285[_0x0e58('0x46')]['id']}})[_0x0e58('0x24')](function(_0x598271){if(_0x598271){return db[_0x0e58('0x4b')][_0x0e58('0x4c')](function(_0x45726d){return _0x598271[_0x0e58('0x25')]({'transaction':_0x45726d,'raw':!![]})[_0x0e58('0x24')](function(_0x195a11){if(_0x195a11['directory']){fs[_0x0e58('0x5c')](_0x195a11[_0x0e58('0x52')])[_0x0e58('0x5d')](function(_0x456a79){fs[_0x0e58('0x5e')](path['join'](_0x195a11[_0x0e58('0x52')],_0x456a79));});fs[_0x0e58('0x5f')](_0x195a11[_0x0e58('0x52')]);}return _0x195a11;});})[_0x0e58('0x48')](function(_0x41a669){throw new db[(_0x0e58('0x60'))]['ValidationError'](_0x41a669[_0x0e58('0x61')]);});}})[_0x0e58('0x24')](handleEntityNotFound(_0x4d43c7,null))[_0x0e58('0x24')](removeEntity(_0x4d43c7,null))[_0x0e58('0x48')](handleError(_0x4d43c7,null));};exports[_0x0e58('0x62')]=function(_0x411a2c,_0x1920e7,_0x48f23c){return db[_0x0e58('0x4b')][_0x0e58('0x4c')](function(_0x37861c){var _0xa1ed66;return db[_0x0e58('0x2d')][_0x0e58('0x47')]({'where':{'id':_0x411a2c[_0x0e58('0x46')]['id']}})[_0x0e58('0x24')](function(_0x277613){if(_0x277613){_0xa1ed66=_0x277613;return _0x277613[_0x0e58('0x62')](_0x411a2c[_0x0e58('0x49')]['id'],{'transaction':_0x37861c});}})['then'](function(_0x3c1551){if(_0x3c1551){return db[_0x0e58('0x63')][_0x0e58('0x64')]({'where':{'id':_0x411a2c[_0x0e58('0x49')]['id']},'attributes':['id','name',_0x0e58('0x65'),_0x0e58('0x66'),_0x0e58('0x67')],'raw':!![]});}})['then'](function(_0x35715d){if(_0x35715d){var _0x4b32c=path[_0x0e58('0x4e')](config[_0x0e58('0x4f')],_0x0e58('0x68'),util[_0x0e58('0x69')]('%s.%s',path['basename'](_0x35715d[_0x0e58('0x65')],path[_0x0e58('0x6a')](_0x35715d[_0x0e58('0x65')])),_0x35715d[_0x0e58('0x66')]));var _0x46677e=path[_0x0e58('0x4e')](config[_0x0e58('0x4f')],_0x0e58('0x50'),_0xa1ed66[_0x0e58('0x31')],util[_0x0e58('0x69')](_0x0e58('0x6b'),_0x35715d[_0x0e58('0x31')],_0x35715d['converted_format']));fs[_0x0e58('0x6c')](_0x4b32c,_0x46677e);return _0x35715d;}})[_0x0e58('0x48')](function(_0x5cff38){throw new db['Sequelize']['ValidationError'](_0x5cff38[_0x0e58('0x61')]);});})[_0x0e58('0x24')](handleEntityNotFound(_0x1920e7,null))[_0x0e58('0x24')](respondWithResult(_0x1920e7,0xc9))['catch'](handleError(_0x1920e7,null));};exports[_0x0e58('0x6d')]=function(_0x216550,_0x69d2c5,_0x557eea){return db[_0x0e58('0x4b')][_0x0e58('0x4c')](function(_0x2ecff2){var _0x57572a;return db[_0x0e58('0x2d')][_0x0e58('0x64')]({'where':{'id':_0x216550[_0x0e58('0x46')]['id']}})['then'](handleEntityNotFound(_0x69d2c5,null))[_0x0e58('0x24')](function(_0x6a5799){if(_0x6a5799){_0x57572a=_0x6a5799;return _0x6a5799[_0x0e58('0x6d')](_0x216550['params']['id2']);}})[_0x0e58('0x24')](function(_0x55b9dd){if(_0x55b9dd){return db['Sound'][_0x0e58('0x64')]({'where':{'id':_0x216550[_0x0e58('0x46')][_0x0e58('0x6e')]},'attributes':['id',_0x0e58('0x31'),'save_name','converted_format',_0x0e58('0x67')],'raw':!![]});}})['then'](function(_0x3781e0){if(_0x3781e0){fs[_0x0e58('0x5e')](path[_0x0e58('0x4e')](_0x57572a[_0x0e58('0x52')],util[_0x0e58('0x69')]('%s.%s',_0x3781e0['name'],_0x3781e0[_0x0e58('0x66')])));return _0x3781e0;}})[_0x0e58('0x48')](function(_0x2df758){throw new db[(_0x0e58('0x60'))]['ValidationError'](_0x2df758['message']);});})[_0x0e58('0x24')](handleEntityNotFound(_0x69d2c5,null))['then'](respondWithStatusCode(_0x69d2c5,0xcc))[_0x0e58('0x48')](handleError(_0x69d2c5,null));};exports[_0x0e58('0x6f')]=function(_0x3d2e8b,_0xaf57e4,_0x536d63){var _0x36a337={};var _0x4b0187={};var _0xb628c0;var _0x64f0b4;return db[_0x0e58('0x2d')][_0x0e58('0x64')]({'where':{'id':_0x3d2e8b[_0x0e58('0x46')]['id']}})[_0x0e58('0x24')](handleEntityNotFound(_0xaf57e4,null))[_0x0e58('0x24')](function(_0x26225d){if(_0x26225d){_0xb628c0=_0x26225d;_0x4b0187[_0x0e58('0x30')]=_[_0x0e58('0x33')](db[_0x0e58('0x63')][_0x0e58('0x2e')]);_0x4b0187[_0x0e58('0x32')]=_['keys'](_0x3d2e8b[_0x0e58('0x32')]);_0x4b0187[_0x0e58('0x3c')]=_[_0x0e58('0x34')](_0x4b0187[_0x0e58('0x30')],_0x4b0187[_0x0e58('0x32')]);_0x36a337[_0x0e58('0x35')]=_[_0x0e58('0x34')](_0x4b0187[_0x0e58('0x30')],qs[_0x0e58('0x36')](_0x3d2e8b[_0x0e58('0x32')][_0x0e58('0x36')]));_0x36a337[_0x0e58('0x35')]=_0x36a337[_0x0e58('0x35')][_0x0e58('0x37')]?_0x36a337[_0x0e58('0x35')]:_0x4b0187[_0x0e58('0x30')];_0x36a337['order']=qs['sort'](_0x3d2e8b[_0x0e58('0x32')]['sort']);_0x36a337[_0x0e58('0x3b')]=qs[_0x0e58('0x3c')](_[_0x0e58('0x3d')](_0x3d2e8b[_0x0e58('0x32')],_0x4b0187['filters']));if(_0x3d2e8b['query']['filter']){_0x36a337[_0x0e58('0x3b')]=_['merge'](_0x36a337[_0x0e58('0x3b')],{'$or':_['map'](_0x36a337[_0x0e58('0x35')],function(_0x541a93){var _0x2a89ed={};_0x2a89ed[_0x541a93]={'$like':'%'+_0x3d2e8b[_0x0e58('0x32')][_0x0e58('0x40')]+'%'};return _0x2a89ed;})});}_0x36a337=_['merge']({},_0x36a337,_0x3d2e8b[_0x0e58('0x41')]);return _0xb628c0[_0x0e58('0x6f')](_0x36a337);}})[_0x0e58('0x24')](function(_0xdc79e){if(_0xdc79e){_0x64f0b4=_0xdc79e['length'];if(!_0x3d2e8b[_0x0e58('0x32')][_0x0e58('0x70')](_0x0e58('0x38'))){_0x36a337[_0x0e58('0x1d')]=qs[_0x0e58('0x1d')](_0x3d2e8b[_0x0e58('0x32')][_0x0e58('0x1d')]);_0x36a337[_0x0e58('0x1c')]=qs['offset'](_0x3d2e8b[_0x0e58('0x32')][_0x0e58('0x1c')]);}return _0xb628c0[_0x0e58('0x6f')](_0x36a337);}})[_0x0e58('0x24')](function(_0x4a03d2){if(_0x4a03d2){return _0x4a03d2?{'count':_0x64f0b4,'rows':_0x4a03d2}:null;}})['then'](respondWithResult(_0xaf57e4,null))[_0x0e58('0x48')](handleError(_0xaf57e4,null));}; \ No newline at end of file +var _0x0795=['autoAssociation','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','order','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','then','include','findAll','rows','catch','show','params','keys','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId'];(function(_0x3ff068,_0x152f76){var _0x22b407=function(_0x973d68){while(--_0x973d68){_0x3ff068['push'](_0x3ff068['shift']());}};_0x22b407(++_0x152f76);}(_0x0795,0xf7));var _0x5079=function(_0x5b0715,_0x5e13c3){_0x5b0715=_0x5b0715-0x0;var _0x5bc2a0=_0x0795[_0x5b0715];return _0x5bc2a0;};'use strict';var emlformat=require(_0x5079('0x0'));var rimraf=require(_0x5079('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5079('0x2'));var rp=require(_0x5079('0x3'));var moment=require(_0x5079('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5079('0x5'));var util=require(_0x5079('0x6'));var path=require('path');var sox=require(_0x5079('0x7'));var csv=require(_0x5079('0x8'));var ejs=require(_0x5079('0x9'));var fs=require('fs');var fs_extra=require(_0x5079('0xa'));var _=require(_0x5079('0xb'));var squel=require(_0x5079('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5079('0xd'));var toCsv=require(_0x5079('0x8'));var querystring=require(_0x5079('0xe'));var Papa=require('papaparse');var Redis=require(_0x5079('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5079('0x10'));var as=require(_0x5079('0x11'));var hardwareService=require(_0x5079('0x12'));var logger=require('../../config/logger')(_0x5079('0x13'));var utils=require(_0x5079('0x14'));var config=require(_0x5079('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5079('0x16'))['db'];function respondWithStatusCode(_0x2d3e2d,_0x2eb3f2){_0x2eb3f2=_0x2eb3f2||0xcc;return function(_0x354b88){if(_0x354b88){return _0x2d3e2d[_0x5079('0x17')](_0x2eb3f2);}return _0x2d3e2d[_0x5079('0x18')](_0x2eb3f2)[_0x5079('0x19')]();};}function respondWithResult(_0x4cd20d,_0x1869e6){_0x1869e6=_0x1869e6||0xc8;return function(_0x4e5f02){if(_0x4e5f02){return _0x4cd20d[_0x5079('0x18')](_0x1869e6)[_0x5079('0x1a')](_0x4e5f02);}};}function respondWithFilteredResult(_0x174877,_0x571f2b){return function(_0x2032e4){if(_0x2032e4){var _0x11fa17=typeof _0x571f2b[_0x5079('0x1b')]===_0x5079('0x1c')&&typeof _0x571f2b['limit']===_0x5079('0x1c');var _0x5b9b26=_0x2032e4[_0x5079('0x1d')];var _0x3ed991=_0x11fa17?0x0:_0x571f2b['offset'];var _0x409553=_0x11fa17?_0x2032e4[_0x5079('0x1d')]:_0x571f2b[_0x5079('0x1b')]+_0x571f2b['limit'];var _0x1d3623;if(_0x409553>=_0x5b9b26){_0x409553=_0x5b9b26;_0x1d3623=0xc8;}else{_0x1d3623=0xce;}_0x174877[_0x5079('0x18')](_0x1d3623);return _0x174877[_0x5079('0x1e')]('Content-Range',_0x3ed991+'-'+_0x409553+'/'+_0x5b9b26)[_0x5079('0x1a')](_0x2032e4);}return null;};}function patchUpdates(_0x344420){return function(_0x2410bf){try{jsonpatch[_0x5079('0x1f')](_0x2410bf,_0x344420,!![]);}catch(_0x5e0e6b){return BPromise['reject'](_0x5e0e6b);}return _0x2410bf['save']();};}function saveUpdates(_0x59450c,_0x4699b7){return function(_0x25c990){if(_0x25c990){return _0x25c990['update'](_0x59450c)['then'](function(_0x338cef){return _0x338cef;});}return null;};}function removeEntity(_0x416118,_0x381c7a){return function(_0x3d5a94){if(_0x3d5a94){return _0x3d5a94[_0x5079('0x20')]()['then'](function(){var _0x34263a=_0x3d5a94[_0x5079('0x21')]({'plain':!![]});var _0x200423='MusicOnHolds';return db[_0x5079('0x22')][_0x5079('0x20')]({'where':{'type':_0x200423,'resourceId':_0x34263a['id']}})['then'](function(){return _0x3d5a94;});})['then'](function(){_0x416118[_0x5079('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125958,_0x13b935){return function(_0x5da73e){if(!_0x5da73e){_0x125958[_0x5079('0x17')](0x194);}return _0x5da73e;};}function handleError(_0x3eb88e,_0x58c1df){_0x58c1df=_0x58c1df||0x1f4;return function(_0x21979a){logger[_0x5079('0x23')](_0x21979a[_0x5079('0x24')]);if(_0x21979a[_0x5079('0x25')]){delete _0x21979a['name'];}_0x3eb88e['status'](_0x58c1df)[_0x5079('0x26')](_0x21979a);};}exports[_0x5079('0x27')]=function(_0x350b77,_0x30bd9d){var _0x175e90={},_0x4725bd={},_0x571f03={'count':0x0,'rows':[]};var _0x41e0c7=_['map'](db[_0x5079('0x28')][_0x5079('0x29')],function(_0x337ba5){return{'name':_0x337ba5['fieldName'],'type':_0x337ba5[_0x5079('0x2a')][_0x5079('0x2b')]};});_0x4725bd[_0x5079('0x2c')]=_[_0x5079('0x2d')](_0x41e0c7,_0x5079('0x25'));_0x4725bd[_0x5079('0x2e')]=_['keys'](_0x350b77['query']);_0x4725bd['filters']=_[_0x5079('0x2f')](_0x4725bd[_0x5079('0x2c')],_0x4725bd[_0x5079('0x2e')]);_0x175e90[_0x5079('0x30')]=_[_0x5079('0x2f')](_0x4725bd[_0x5079('0x2c')],qs[_0x5079('0x31')](_0x350b77['query']['fields']));_0x175e90['attributes']=_0x175e90[_0x5079('0x30')][_0x5079('0x32')]?_0x175e90[_0x5079('0x30')]:_0x4725bd[_0x5079('0x2c')];if(!_0x350b77[_0x5079('0x2e')][_0x5079('0x33')](_0x5079('0x34'))){_0x175e90[_0x5079('0x35')]=qs[_0x5079('0x35')](_0x350b77[_0x5079('0x2e')]['limit']);_0x175e90[_0x5079('0x1b')]=qs[_0x5079('0x1b')](_0x350b77['query'][_0x5079('0x1b')]);}_0x175e90['order']=qs[_0x5079('0x36')](_0x350b77['query'][_0x5079('0x36')]);delete _0x350b77[_0x5079('0x2e')]['sort'];_0x175e90[_0x5079('0x37')]=qs[_0x5079('0x38')](_[_0x5079('0x39')](_0x350b77[_0x5079('0x2e')],_0x4725bd['filters']),_0x41e0c7);if(_0x350b77[_0x5079('0x2e')][_0x5079('0x3a')]){_0x175e90[_0x5079('0x37')]=_[_0x5079('0x3b')](_0x175e90[_0x5079('0x37')],{'$or':_[_0x5079('0x2d')](_0x41e0c7,function(_0x2b031c){if(_0x2b031c['type']!=='VIRTUAL'){var _0x540658={};_0x540658[_0x2b031c[_0x5079('0x25')]]={'$like':'%'+_0x350b77[_0x5079('0x2e')][_0x5079('0x3a')]+'%'};return _0x540658;}})});}_0x175e90=_[_0x5079('0x3b')]({},_0x175e90,_0x350b77[_0x5079('0x3c')]);var _0x450b7={'where':_0x175e90[_0x5079('0x37')]};return db[_0x5079('0x28')][_0x5079('0x1d')](_0x450b7)[_0x5079('0x3d')](function(_0x44dfa5){_0x571f03['count']=_0x44dfa5;if(_0x350b77[_0x5079('0x2e')]['includeAll']){_0x175e90[_0x5079('0x3e')]=[{'all':!![]}];}return db[_0x5079('0x28')][_0x5079('0x3f')](_0x175e90);})[_0x5079('0x3d')](function(_0xf4103f){_0x571f03[_0x5079('0x40')]=_0xf4103f;return _0x571f03;})[_0x5079('0x3d')](respondWithFilteredResult(_0x30bd9d,_0x175e90))[_0x5079('0x41')](handleError(_0x30bd9d,null));};exports[_0x5079('0x42')]=function(_0x102fec,_0x22f8b5){var _0x295c88={'raw':![],'where':{'id':_0x102fec[_0x5079('0x43')]['id']}},_0x43bba4={};_0x43bba4[_0x5079('0x2c')]=_[_0x5079('0x44')](db[_0x5079('0x28')][_0x5079('0x29')]);_0x43bba4[_0x5079('0x2e')]=_[_0x5079('0x44')](_0x102fec['query']);_0x43bba4[_0x5079('0x38')]=_[_0x5079('0x2f')](_0x43bba4[_0x5079('0x2c')],_0x43bba4[_0x5079('0x2e')]);_0x295c88[_0x5079('0x30')]=_['intersection'](_0x43bba4[_0x5079('0x2c')],qs[_0x5079('0x31')](_0x102fec[_0x5079('0x2e')][_0x5079('0x31')]));_0x295c88[_0x5079('0x30')]=_0x295c88['attributes'][_0x5079('0x32')]?_0x295c88[_0x5079('0x30')]:_0x43bba4['model'];if(_0x102fec[_0x5079('0x2e')]['includeAll']){_0x295c88[_0x5079('0x3e')]=[{'all':!![]}];}_0x295c88=_['merge']({},_0x295c88,_0x102fec[_0x5079('0x3c')]);return db['VoiceMusicOnHold'][_0x5079('0x45')](_0x295c88)[_0x5079('0x3d')](handleEntityNotFound(_0x22f8b5,null))['then'](respondWithResult(_0x22f8b5,null))[_0x5079('0x41')](handleError(_0x22f8b5,null));};exports[_0x5079('0x46')]=function(_0x45445b,_0xced61f){if(_0x45445b['body']['id']){delete _0x45445b[_0x5079('0x47')]['id'];}return db[_0x5079('0x28')][_0x5079('0x45')]({'where':{'id':_0x45445b[_0x5079('0x43')]['id']}})[_0x5079('0x3d')](handleEntityNotFound(_0xced61f,null))['then'](saveUpdates(_0x45445b[_0x5079('0x47')],null))[_0x5079('0x3d')](respondWithResult(_0xced61f,null))[_0x5079('0x41')](handleError(_0xced61f,null));};exports[_0x5079('0x48')]=function(_0x4208f2,_0x7aca0d,_0x1cd108){return db[_0x5079('0x49')][_0x5079('0x4a')](function(_0x23a2b4){if(_0x4208f2[_0x5079('0x47')][_0x5079('0x4b')]===_0x5079('0x4c')){_0x4208f2[_0x5079('0x47')][_0x5079('0x4d')]=path[_0x5079('0x4e')](config[_0x5079('0x4f')],_0x5079('0x50'),_0x4208f2[_0x5079('0x47')][_0x5079('0x25')]);}return db[_0x5079('0x28')][_0x5079('0x48')](_0x4208f2[_0x5079('0x47')],{'transaction':_0x23a2b4})[_0x5079('0x3d')](function(_0xa84aec){if(_0x4208f2[_0x5079('0x47')]['mode']===_0x5079('0x4c')){fs[_0x5079('0x51')](_0xa84aec[_0x5079('0x4d')],parseInt(_0x5079('0x52'),0x8));}var _0x277f5a=_0x4208f2[_0x5079('0x53')][_0x5079('0x21')]({'plain':!![]});if(!_0x277f5a)throw new Error(_0x5079('0x54'));if(_0x277f5a[_0x5079('0x55')]==='user'){var _0x3981ba=_0xa84aec[_0x5079('0x21')]({'plain':!![]});return db[_0x5079('0x56')][_0x5079('0x45')]({'where':{'name':_0x5079('0x57'),'userProfileId':_0x277f5a[_0x5079('0x58')]},'raw':!![]})[_0x5079('0x3d')](function(_0x21b8bc){if(_0x21b8bc&&_0x21b8bc[_0x5079('0x59')]===0x0){return db[_0x5079('0x22')][_0x5079('0x48')]({'name':_0x3981ba[_0x5079('0x25')],'resourceId':_0x3981ba['id'],'type':_0x21b8bc[_0x5079('0x25')],'sectionId':_0x21b8bc['id']},{})[_0x5079('0x3d')](function(){return _0xa84aec;});}else{return _0xa84aec;}})['catch'](function(_0xa4746c){logger[_0x5079('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa4746c);});}return _0xa84aec;});})[_0x5079('0x3d')](respondWithResult(_0x7aca0d,0xc9))[_0x5079('0x41')](handleError(_0x7aca0d,null));};exports[_0x5079('0x20')]=function(_0xff8d6e,_0x5f0022,_0x204ee6){var _0x2ea96e;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xff8d6e[_0x5079('0x43')]['id']}})[_0x5079('0x3d')](function(_0x79f5a9){if(_0x79f5a9){return db[_0x5079('0x49')][_0x5079('0x4a')](function(_0x59bab5){return _0x79f5a9[_0x5079('0x20')]({'transaction':_0x59bab5,'raw':!![]})[_0x5079('0x3d')](function(_0x4be3cd){if(_0x4be3cd['directory']){fs[_0x5079('0x5a')](_0x4be3cd['directory'])['forEach'](function(_0x8e534e){fs['unlinkSync'](path[_0x5079('0x4e')](_0x4be3cd['directory'],_0x8e534e));});fs[_0x5079('0x5b')](_0x4be3cd[_0x5079('0x4d')]);}return _0x4be3cd;});})['catch'](function(_0x2f518d){throw new db[(_0x5079('0x5c'))][(_0x5079('0x5d'))](_0x2f518d[_0x5079('0x5e')]);});}})[_0x5079('0x3d')](handleEntityNotFound(_0x5f0022,null))[_0x5079('0x3d')](removeEntity(_0x5f0022,null))[_0x5079('0x41')](handleError(_0x5f0022,null));};exports['addSound']=function(_0x5c0553,_0x52f626,_0x388acc){return db[_0x5079('0x49')][_0x5079('0x4a')](function(_0x45cafa){var _0xda4bf8;return db[_0x5079('0x28')][_0x5079('0x45')]({'where':{'id':_0x5c0553[_0x5079('0x43')]['id']}})[_0x5079('0x3d')](function(_0x6c6d40){if(_0x6c6d40){_0xda4bf8=_0x6c6d40;return _0x6c6d40[_0x5079('0x5f')](_0x5c0553['body']['id'],{'transaction':_0x45cafa});}})[_0x5079('0x3d')](function(_0x5a8cba){if(_0x5a8cba){return db[_0x5079('0x60')][_0x5079('0x61')]({'where':{'id':_0x5c0553[_0x5079('0x47')]['id']},'attributes':['id',_0x5079('0x25'),_0x5079('0x62'),_0x5079('0x63'),_0x5079('0x64')],'raw':!![]});}})[_0x5079('0x3d')](function(_0x43ea69){if(_0x43ea69){var _0x5a7462=path[_0x5079('0x4e')](config[_0x5079('0x4f')],_0x5079('0x65'),util[_0x5079('0x66')](_0x5079('0x67'),path[_0x5079('0x68')](_0x43ea69[_0x5079('0x62')],path[_0x5079('0x69')](_0x43ea69[_0x5079('0x62')])),_0x43ea69[_0x5079('0x63')]));var _0x133af7=path[_0x5079('0x4e')](config[_0x5079('0x4f')],'server/files/moh',_0xda4bf8[_0x5079('0x25')],util[_0x5079('0x66')](_0x5079('0x67'),_0x43ea69['name'],_0x43ea69[_0x5079('0x63')]));fs[_0x5079('0x6a')](_0x5a7462,_0x133af7);return _0x43ea69;}})[_0x5079('0x41')](function(_0x48cfbe){throw new db[(_0x5079('0x5c'))][(_0x5079('0x5d'))](_0x48cfbe['message']);});})['then'](handleEntityNotFound(_0x52f626,null))[_0x5079('0x3d')](respondWithResult(_0x52f626,0xc9))['catch'](handleError(_0x52f626,null));};exports[_0x5079('0x6b')]=function(_0x43ae2a,_0x4c4947,_0x385535){return db[_0x5079('0x49')][_0x5079('0x4a')](function(_0xd9db38){var _0x4efe62;return db[_0x5079('0x28')][_0x5079('0x61')]({'where':{'id':_0x43ae2a['params']['id']}})[_0x5079('0x3d')](handleEntityNotFound(_0x4c4947,null))[_0x5079('0x3d')](function(_0x1496f1){if(_0x1496f1){_0x4efe62=_0x1496f1;return _0x1496f1['removeSound'](_0x43ae2a[_0x5079('0x43')][_0x5079('0x6c')]);}})[_0x5079('0x3d')](function(_0x4db9c1){if(_0x4db9c1){return db[_0x5079('0x60')][_0x5079('0x61')]({'where':{'id':_0x43ae2a['params'][_0x5079('0x6c')]},'attributes':['id',_0x5079('0x25'),'save_name',_0x5079('0x63'),_0x5079('0x64')],'raw':!![]});}})[_0x5079('0x3d')](function(_0xf16a69){if(_0xf16a69){fs[_0x5079('0x6d')](path[_0x5079('0x4e')](_0x4efe62[_0x5079('0x4d')],util[_0x5079('0x66')](_0x5079('0x67'),_0xf16a69[_0x5079('0x25')],_0xf16a69[_0x5079('0x63')])));return _0xf16a69;}})[_0x5079('0x41')](function(_0x2fb2a2){throw new db[(_0x5079('0x5c'))][(_0x5079('0x5d'))](_0x2fb2a2[_0x5079('0x5e')]);});})[_0x5079('0x3d')](handleEntityNotFound(_0x4c4947,null))[_0x5079('0x3d')](respondWithStatusCode(_0x4c4947,0xcc))[_0x5079('0x41')](handleError(_0x4c4947,null));};exports[_0x5079('0x6e')]=function(_0x315c2a,_0xafc88e,_0x24cbf2){var _0x42b8fd={};var _0xc9560f={};var _0x4e2494;var _0x21553b;return db[_0x5079('0x28')][_0x5079('0x61')]({'where':{'id':_0x315c2a['params']['id']}})[_0x5079('0x3d')](handleEntityNotFound(_0xafc88e,null))[_0x5079('0x3d')](function(_0x43f27e){if(_0x43f27e){_0x4e2494=_0x43f27e;_0xc9560f[_0x5079('0x2c')]=_[_0x5079('0x44')](db[_0x5079('0x60')][_0x5079('0x29')]);_0xc9560f[_0x5079('0x2e')]=_[_0x5079('0x44')](_0x315c2a[_0x5079('0x2e')]);_0xc9560f[_0x5079('0x38')]=_['intersection'](_0xc9560f[_0x5079('0x2c')],_0xc9560f['query']);_0x42b8fd[_0x5079('0x30')]=_[_0x5079('0x2f')](_0xc9560f[_0x5079('0x2c')],qs[_0x5079('0x31')](_0x315c2a[_0x5079('0x2e')][_0x5079('0x31')]));_0x42b8fd[_0x5079('0x30')]=_0x42b8fd[_0x5079('0x30')][_0x5079('0x32')]?_0x42b8fd[_0x5079('0x30')]:_0xc9560f['model'];_0x42b8fd[_0x5079('0x6f')]=qs[_0x5079('0x36')](_0x315c2a[_0x5079('0x2e')][_0x5079('0x36')]);_0x42b8fd[_0x5079('0x37')]=qs[_0x5079('0x38')](_[_0x5079('0x39')](_0x315c2a[_0x5079('0x2e')],_0xc9560f[_0x5079('0x38')]));if(_0x315c2a[_0x5079('0x2e')][_0x5079('0x3a')]){_0x42b8fd[_0x5079('0x37')]=_[_0x5079('0x3b')](_0x42b8fd[_0x5079('0x37')],{'$or':_[_0x5079('0x2d')](_0x42b8fd['attributes'],function(_0x4063fd){var _0x537558={};_0x537558[_0x4063fd]={'$like':'%'+_0x315c2a[_0x5079('0x2e')][_0x5079('0x3a')]+'%'};return _0x537558;})});}_0x42b8fd=_[_0x5079('0x3b')]({},_0x42b8fd,_0x315c2a['options']);return _0x4e2494['getSounds'](_0x42b8fd);}})[_0x5079('0x3d')](function(_0x3ff44f){if(_0x3ff44f){_0x21553b=_0x3ff44f[_0x5079('0x32')];if(!_0x315c2a[_0x5079('0x2e')]['hasOwnProperty'](_0x5079('0x34'))){_0x42b8fd['limit']=qs['limit'](_0x315c2a[_0x5079('0x2e')][_0x5079('0x35')]);_0x42b8fd[_0x5079('0x1b')]=qs['offset'](_0x315c2a[_0x5079('0x2e')][_0x5079('0x1b')]);}return _0x4e2494['getSounds'](_0x42b8fd);}})['then'](function(_0x476095){if(_0x476095){return _0x476095?{'count':_0x21553b,'rows':_0x476095}:null;}})[_0x5079('0x3d')](respondWithResult(_0xafc88e,null))[_0x5079('0x41')](handleError(_0xafc88e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 9895290..e7c2fd2 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 _0x69f1=['voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x4fd0c3,_0x1c0e57){var _0x2e0c98=function(_0x4955c3){while(--_0x4955c3){_0x4fd0c3['push'](_0x4fd0c3['shift']());}};_0x2e0c98(++_0x1c0e57);}(_0x69f1,0x146));var _0x169f=function(_0xede275,_0x2b5ee1){_0xede275=_0xede275-0x0;var _0x32deed=_0x69f1[_0xede275];return _0x32deed;};'use strict';var _=require(_0x169f('0x0'));var util=require(_0x169f('0x1'));var logger=require(_0x169f('0x2'))(_0x169f('0x3'));var moment=require(_0x169f('0x4'));var BPromise=require('bluebird');var rp=require(_0x169f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x169f('0x6'));var config=require(_0x169f('0x7'));var attributes=require(_0x169f('0x8'));module[_0x169f('0x9')]=function(_0xe68060,_0x5de3fa){return _0xe68060[_0x169f('0xa')](_0x169f('0xb'),attributes,{'tableName':_0x169f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x4a95c4,_0x544ef3){var _0x2a2443=function(_0x4101f7){while(--_0x4101f7){_0x4a95c4['push'](_0x4a95c4['shift']());}};_0x2a2443(++_0x544ef3);}(_0xd6cb,0xde));var _0xbd6c=function(_0x1a2d35,_0x10af53){_0x1a2d35=_0x1a2d35-0x0;var _0x3099a3=_0xd6cb[_0x1a2d35];return _0x3099a3;};'use strict';var _=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var logger=require(_0xbd6c('0x2'))(_0xbd6c('0x3'));var moment=require('moment');var BPromise=require(_0xbd6c('0x4'));var rp=require(_0xbd6c('0x5'));var fs=require('fs');var path=require(_0xbd6c('0x6'));var rimraf=require(_0xbd6c('0x7'));var config=require(_0xbd6c('0x8'));var attributes=require(_0xbd6c('0x9'));module[_0xbd6c('0xa')]=function(_0x10d92b,_0x3633aa){return _0x10d92b[_0xbd6c('0xb')](_0xbd6c('0xc'),attributes,{'tableName':_0xbd6c('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 92fea1c..386baa9 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x200770,_0x4391ed){var _0x303db6=function(_0x28d957){while(--_0x28d957){_0x200770['push'](_0x200770['shift']());}};_0x303db6(++_0x4391ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x3f5677,_0x2f9db7){_0x3f5677=_0x3f5677-0x0;var _0x3cb65b=_0xedd9[_0x3f5677];return _0x3cb65b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e0470,_0x50e252){var _0x62bf5f=function(_0x1c2b00){while(--_0x1c2b00){_0x5e0470['push'](_0x5e0470['shift']());}};_0x62bf5f(++_0x50e252);}(_0xe706,0xa3));var _0x6e70=function(_0x168057,_0x18fae0){_0x168057=_0x168057-0x0;var _0x470c2f=_0xe706[_0x168057];return _0x470c2f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 57d6439..1ff49ba 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 _0x5697=['multer','path','connect-timeout','express','./voicePrefix.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','addAgents','addTeams','put','delete','removeAgents','removeTeams','exports'];(function(_0x8ef83d,_0x520c3d){var _0x4a4a19=function(_0x189336){while(--_0x189336){_0x8ef83d['push'](_0x8ef83d['shift']());}};_0x4a4a19(++_0x520c3d);}(_0x5697,0x1b5));var _0x7569=function(_0x2dfd0e,_0x13739e){_0x2dfd0e=_0x2dfd0e-0x0;var _0x343af6=_0x5697[_0x2dfd0e];return _0x343af6;};'use strict';var multer=require(_0x7569('0x0'));var util=require('util');var path=require(_0x7569('0x1'));var timeout=require(_0x7569('0x2'));var express=require(_0x7569('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7569('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7569('0x5')](_0x7569('0x6'),auth[_0x7569('0x7')](),controller[_0x7569('0x8')]);router[_0x7569('0x5')](_0x7569('0x9'),auth['isAuthenticated'](),controller[_0x7569('0xa')]);router['get'](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0xc')]);router[_0x7569('0x5')](_0x7569('0xd'),auth[_0x7569('0x7')](),controller[_0x7569('0xe')]);router[_0x7569('0xf')]('/',auth[_0x7569('0x7')](),controller['create']);router[_0x7569('0xf')](_0x7569('0xb'),auth[_0x7569('0x7')](),controller[_0x7569('0x10')]);router[_0x7569('0xf')](_0x7569('0xd'),auth['isAuthenticated'](),controller[_0x7569('0x11')]);router[_0x7569('0x12')](_0x7569('0x9'),auth[_0x7569('0x7')](),controller['update']);router[_0x7569('0x13')](_0x7569('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x7569('0x13')](_0x7569('0xb'),auth['isAuthenticated'](),controller[_0x7569('0x14')]);router[_0x7569('0x13')]('/:id/teams',auth[_0x7569('0x7')](),controller[_0x7569('0x15')]);module[_0x7569('0x16')]=router; \ No newline at end of file +var _0xea31=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','put','update','delete'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xea31,0x6b));var _0x1ea3=function(_0x913948,_0x24fa68){_0x913948=_0x913948-0x0;var _0x3f313e=_0xea31[_0x913948];return _0x3f313e;};'use strict';var multer=require(_0x1ea3('0x0'));var util=require('util');var path=require(_0x1ea3('0x1'));var timeout=require(_0x1ea3('0x2'));var express=require(_0x1ea3('0x3'));var router=express[_0x1ea3('0x4')]();var fs_extra=require(_0x1ea3('0x5'));var auth=require(_0x1ea3('0x6'));var interaction=require(_0x1ea3('0x7'));var config=require('../../config/environment');var controller=require(_0x1ea3('0x8'));router[_0x1ea3('0x9')]('/',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xb')]);router[_0x1ea3('0x9')]('/describe',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xc')]);router[_0x1ea3('0x9')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xe')]);router['get'](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x10')]);router[_0x1ea3('0x9')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x12')]);router['post']('/',auth[_0x1ea3('0xa')](),controller['create']);router[_0x1ea3('0x13')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller['addAgents']);router[_0x1ea3('0x13')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller['addTeams']);router[_0x1ea3('0x14')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x15')]);router[_0x1ea3('0x16')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller['destroy']);router[_0x1ea3('0x16')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x17')]);router[_0x1ea3('0x16')]('/:id/teams',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x18')]);module[_0x1ea3('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 1922d02..14b6549 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 _0xb3f7=['name','system-','INTEGER','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb3f7,0x10c));var _0x7b3f=function(_0x188ce6,_0x477f3f){_0x188ce6=_0x188ce6-0x0;var _0x15568c=_0xb3f7[_0x188ce6];return _0x15568c;};'use strict';var Sequelize=require('sequelize');module[_0x7b3f('0x0')]={'name':{'type':Sequelize[_0x7b3f('0x1')],'allowNull':![],'unique':_0x7b3f('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x21e378){return _0x7b3f('0x3')+this['getDataValue'](_0x7b3f('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7b3f('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x7b3f('0x4')]}}; \ No newline at end of file +var _0xd047=['sequelize','exports','name','VIRTUAL','system-','getDataValue','STRING','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd047,0x138));var _0x7d04=function(_0x262d1c,_0x24b5bb){_0x262d1c=_0x262d1c-0x0;var _0x505b7a=_0xd047[_0x262d1c];return _0x505b7a;};'use strict';var Sequelize=require(_0x7d04('0x0'));module[_0x7d04('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7d04('0x2')},'prefix':{'type':Sequelize[_0x7d04('0x3')],'get':function(_0x318d22){return _0x7d04('0x4')+this[_0x7d04('0x5')](_0x7d04('0x2'))+'-';}},'description':{'type':Sequelize[_0x7d04('0x6')]},'callerIdAll':{'type':Sequelize[_0x7d04('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x7d04('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6aa8ad9..6ee0663 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 _0x236c=['User','getAgents','getTeams','Team','pick','addTeams','findAll','Agents','online','interface','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','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','defaults','socket.io-emitter','redis','./voicePrefix.socket','register','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','UserProfileResource','sendStatus','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','destroy','params','describe','create','sequelize','transaction','get','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','context','exten','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x236c,0x155));var _0xc236=function(_0xdd1b,_0x177225){_0xdd1b=_0xdd1b-0x0;var _0x538aa1=_0x236c[_0xdd1b];return _0x538aa1;};'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'];config['redis']=_[_0xc236('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc236('0x19'))(new Redis(config[_0xc236('0x1a')]));require(_0xc236('0x1b'))[_0xc236('0x1c')](socket);function respondWithStatusCode(_0x5052db,_0x13a42b){_0x13a42b=_0x13a42b||0xcc;return function(_0x55b188){if(_0x55b188){return _0x5052db['sendStatus'](_0x13a42b);}return _0x5052db[_0xc236('0x1d')](_0x13a42b)[_0xc236('0x1e')]();};}function respondWithResult(_0x443a46,_0x1aeafc){_0x1aeafc=_0x1aeafc||0xc8;return function(_0x267913){if(_0x267913){return _0x443a46['status'](_0x1aeafc)['json'](_0x267913);}};}function respondWithFilteredResult(_0x57355b,_0x3f5884){return function(_0x76f45){if(_0x76f45){var _0x11ec65=typeof _0x3f5884['offset']===_0xc236('0x1f')&&typeof _0x3f5884['limit']==='undefined';var _0x1eafba=_0x76f45[_0xc236('0x20')];var _0x3a6183=_0x11ec65?0x0:_0x3f5884[_0xc236('0x21')];var _0x2b6d3f=_0x11ec65?_0x76f45[_0xc236('0x20')]:_0x3f5884[_0xc236('0x21')]+_0x3f5884[_0xc236('0x22')];var _0x54ffac;if(_0x2b6d3f>=_0x1eafba){_0x2b6d3f=_0x1eafba;_0x54ffac=0xc8;}else{_0x54ffac=0xce;}_0x57355b[_0xc236('0x1d')](_0x54ffac);return _0x57355b[_0xc236('0x23')]('Content-Range',_0x3a6183+'-'+_0x2b6d3f+'/'+_0x1eafba)[_0xc236('0x24')](_0x76f45);}return null;};}function patchUpdates(_0x34d73a){return function(_0x3bd41b){try{jsonpatch[_0xc236('0x25')](_0x3bd41b,_0x34d73a,!![]);}catch(_0x27afba){return BPromise[_0xc236('0x26')](_0x27afba);}return _0x3bd41b[_0xc236('0x27')]();};}function saveUpdates(_0xf921e6,_0x1d65e2){return function(_0x3b4059){if(_0x3b4059){return _0x3b4059[_0xc236('0x28')](_0xf921e6)['then'](function(_0x308cd6){return _0x308cd6;});}return null;};}function removeEntity(_0x21d78f,_0x356042){return function(_0x9017ec){if(_0x9017ec){return _0x9017ec['destroy']()[_0xc236('0x29')](function(){var _0x5da4b2=_0x9017ec['get']({'plain':!![]});var _0x15ead8='VoicePrefixes';return db[_0xc236('0x2a')]['destroy']({'where':{'type':_0x15ead8,'resourceId':_0x5da4b2['id']}})[_0xc236('0x29')](function(){return _0x9017ec;});})['then'](function(){_0x21d78f[_0xc236('0x1d')](0xcc)[_0xc236('0x1e')]();});}};}function handleEntityNotFound(_0x4f5175,_0x5a61b5){return function(_0x265c8d){if(!_0x265c8d){_0x4f5175[_0xc236('0x2b')](0x194);}return _0x265c8d;};}function handleError(_0x1f4995,_0x6ad83f){_0x6ad83f=_0x6ad83f||0x1f4;return function(_0x5f3891){logger['error'](_0x5f3891[_0xc236('0x2c')]);if(_0x5f3891['name']){delete _0x5f3891[_0xc236('0x2d')];}_0x1f4995['status'](_0x6ad83f)[_0xc236('0x2e')](_0x5f3891);};}exports[_0xc236('0x2f')]=function(_0x57c99e,_0x5a5ec3){var _0x2537f9={},_0x3053a3={},_0xbda858={'count':0x0,'rows':[]};var _0x2f64bd=_[_0xc236('0x30')](db[_0xc236('0x31')][_0xc236('0x32')],function(_0x22a2ca){return{'name':_0x22a2ca[_0xc236('0x33')],'type':_0x22a2ca['type']['key']};});_0x3053a3['model']=_[_0xc236('0x30')](_0x2f64bd,_0xc236('0x2d'));_0x3053a3[_0xc236('0x34')]=_[_0xc236('0x35')](_0x57c99e[_0xc236('0x34')]);_0x3053a3[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3053a3['model'],_0x3053a3[_0xc236('0x34')]);_0x2537f9[_0xc236('0x38')]=_[_0xc236('0x37')](_0x3053a3['model'],qs[_0xc236('0x39')](_0x57c99e[_0xc236('0x34')][_0xc236('0x39')]));_0x2537f9[_0xc236('0x38')]=_0x2537f9['attributes'][_0xc236('0x3a')]?_0x2537f9[_0xc236('0x38')]:_0x3053a3[_0xc236('0x3b')];if(!_0x57c99e[_0xc236('0x34')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x2537f9[_0xc236('0x22')]=qs[_0xc236('0x22')](_0x57c99e[_0xc236('0x34')][_0xc236('0x22')]);_0x2537f9[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x57c99e[_0xc236('0x34')][_0xc236('0x21')]);}_0x2537f9[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x57c99e[_0xc236('0x34')]['sort']);_0x2537f9['where']=qs['filters'](_['pick'](_0x57c99e[_0xc236('0x34')],_0x3053a3['filters']),_0x2f64bd);if(_0x57c99e[_0xc236('0x34')][_0xc236('0x40')]){_0x2537f9[_0xc236('0x41')]=_[_0xc236('0x42')](_0x2537f9[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x2f64bd,function(_0x427de1){if(_0x427de1[_0xc236('0x43')]!==_0xc236('0x44')){var _0x12a270={};_0x12a270[_0x427de1[_0xc236('0x2d')]]={'$like':'%'+_0x57c99e[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x12a270;}})});}_0x2537f9=_[_0xc236('0x42')]({},_0x2537f9,_0x57c99e[_0xc236('0x45')]);var _0x594ffc={'where':_0x2537f9[_0xc236('0x41')]};return db[_0xc236('0x31')]['count'](_0x594ffc)[_0xc236('0x29')](function(_0x5b0bc5){_0xbda858[_0xc236('0x20')]=_0x5b0bc5;if(_0x57c99e['query'][_0xc236('0x46')]){_0x2537f9[_0xc236('0x47')]=[{'all':!![]}];}return db[_0xc236('0x31')]['findAll'](_0x2537f9);})[_0xc236('0x29')](function(_0x429e08){_0xbda858[_0xc236('0x48')]=_0x429e08;return _0xbda858;})['then'](respondWithFilteredResult(_0x5a5ec3,_0x2537f9))[_0xc236('0x49')](handleError(_0x5a5ec3,null));};exports[_0xc236('0x4a')]=function(_0x317431,_0x408312){var _0xc35ef9={'raw':![],'where':{'id':_0x317431['params']['id']}},_0x3235b0={};_0x3235b0[_0xc236('0x3b')]=_['keys'](db[_0xc236('0x31')][_0xc236('0x32')]);_0x3235b0[_0xc236('0x34')]=_[_0xc236('0x35')](_0x317431[_0xc236('0x34')]);_0x3235b0[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3235b0['model'],_0x3235b0[_0xc236('0x34')]);_0xc35ef9['attributes']=_[_0xc236('0x37')](_0x3235b0[_0xc236('0x3b')],qs['fields'](_0x317431[_0xc236('0x34')][_0xc236('0x39')]));_0xc35ef9[_0xc236('0x38')]=_0xc35ef9[_0xc236('0x38')][_0xc236('0x3a')]?_0xc35ef9[_0xc236('0x38')]:_0x3235b0[_0xc236('0x3b')];if(_0x317431['query']['includeAll']){_0xc35ef9[_0xc236('0x47')]=[{'all':!![]}];}_0xc35ef9=_[_0xc236('0x42')]({},_0xc35ef9,_0x317431['options']);return db[_0xc236('0x31')][_0xc236('0x4b')](_0xc35ef9)[_0xc236('0x29')](handleEntityNotFound(_0x408312,null))[_0xc236('0x29')](respondWithResult(_0x408312,null))[_0xc236('0x49')](handleError(_0x408312,null));};exports[_0xc236('0x4c')]=function(_0x300523,_0x14a83d){return db[_0xc236('0x31')]['find']({'where':{'id':_0x300523[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x14a83d,null))[_0xc236('0x29')](removeEntity(_0x14a83d,null))[_0xc236('0x49')](handleError(_0x14a83d,null));};exports[_0xc236('0x4e')]=function(_0x28e6b4,_0x3ea045){return db['VoicePrefix'][_0xc236('0x4e')]()[_0xc236('0x29')](respondWithResult(_0x3ea045,null))[_0xc236('0x49')](handleError(_0x3ea045,null));};exports[_0xc236('0x4f')]=function(_0x4860d8,_0xa34c01){var _0x3e6da6;return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x9d81c8){return db['VoicePrefix'][_0xc236('0x4f')](_0x4860d8['body'],{'transaction':_0x9d81c8})[_0xc236('0x29')](function(_0x93904b){_0x3e6da6=_0x93904b[_0xc236('0x52')]({'plain':!![]});return db[_0xc236('0x53')][_0xc236('0x4b')]({'where':{'id':_0x3e6da6['VoiceExtensionId']},'raw':!![]})['then'](function(_0x3bee67){return createVoicePrefixExtensions(_0x3e6da6,_0x3bee67,_0x9d81c8);});});})[_0xc236('0x29')](function(){var _0x205d09=_0x4860d8[_0xc236('0x54')][_0xc236('0x52')]({'plain':!![]});if(!_0x205d09)throw new Error(_0xc236('0x55'));if(_0x205d09[_0xc236('0x56')]===_0xc236('0x54')){var _0x24af08=_0x3e6da6;return db[_0xc236('0x57')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x205d09[_0xc236('0x58')]},'raw':!![]})[_0xc236('0x29')](function(_0x8e19c6){if(_0x8e19c6&&_0x8e19c6[_0xc236('0x59')]===0x0){return db['UserProfileResource'][_0xc236('0x4f')]({'name':_0x24af08[_0xc236('0x2d')],'resourceId':_0x24af08['id'],'type':_0x8e19c6['name'],'sectionId':_0x8e19c6['id']},{})[_0xc236('0x29')](function(){return _0x3e6da6;});}else{return _0x3e6da6;}})[_0xc236('0x49')](function(_0x445f03){logger[_0xc236('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x445f03);throw _0x445f03;});}return _0x3e6da6;})[_0xc236('0x29')](respondWithResult(_0xa34c01,null))[_0xc236('0x49')](handleError(_0xa34c01,null));};function Extension(_0x35955c,_0x2602f8,_0x41a160,_0x1edbae){this[_0xc236('0x5b')]='from-sip';this[_0xc236('0x5c')]=_0x35955c;this['app']=_0x41a160;this[_0xc236('0x43')]=_0xc236('0x5d');this[_0xc236('0x5e')]=_0xc236('0x5f');this['priority']=_0x2602f8;this[_0xc236('0x60')]=_0x1edbae;}function createVoicePrefixExtensions(_0x3f1a5f,_0x379e99,_0x4ed4fc){return new BPromise(function(_0x175d5d,_0x2bc7f0){var _0x2ecad1=new Extension(formatPrefixName(_0x3f1a5f[_0xc236('0x61')]),0x1,_0xc236('0x62'),_0xc236('0x63'));_0x2ecad1['VoicePrefixId']=_0x3f1a5f['id'];return db['VoiceExtension'][_0xc236('0x4f')](_0x2ecad1,{'transaction':_0x4ed4fc})[_0xc236('0x29')](function(_0x125f9a){var _0x1e9ad8=_0x125f9a[_0xc236('0x52')]({'plain':!![]});var _0x4649a3=_[_0xc236('0x30')](addVoicePrefixExtensions(_0x3f1a5f,_0x379e99),function(_0x553f58){_0x553f58['VoiceExtensionId']=_0x1e9ad8['id'];_0x553f58['VoicePrefixId']=_0x3f1a5f['id'];return _0x553f58;});return db[_0xc236('0x53')][_0xc236('0x64')](_0x4649a3,{'transaction':_0x4ed4fc})[_0xc236('0x29')](function(_0x2d6b00){if(!_0x2d6b00){return _0x2bc7f0('Extensions\x20creation\x20failed');}else{return _0x175d5d(_0x2d6b00);}})['catch'](function(_0x506910){return _0x2bc7f0(_0x506910);});});;});};function addVoicePrefixExtensions(_0x528d3d,_0x145e86){var _0x5df2ba=[];var _0x20a1eb=formatPrefixName(_0x528d3d['prefix']);_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x2,_0xc236('0x66'),_0xc236('0x67')+_0x528d3d[_0xc236('0x2d')]));if(_0x528d3d[_0xc236('0x68')]){_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x3,_0xc236('0x66'),'PREFIX-CALLERIDALL='+_0x528d3d[_0xc236('0x68')]));}else{_0x5df2ba['push'](new Extension(_0x20a1eb,0x3,_0xc236('0x62'),_0xc236('0x69')));}_0x5df2ba[_0xc236('0x65')](new Extension(_0x20a1eb,0x4,_0xc236('0x6a'),_0x145e86[_0xc236('0x5b')]+','+_0xc236('0x6b')+(0x8+_0x528d3d['name'][_0xc236('0x3a')])+'}'+','+0x1));return _0x5df2ba;}function formatPrefixName(_0x94f65d){var _0x4bb0c6='_';for(var _0x2fb86f=0x0;_0x2fb86f<_0x94f65d[_0xc236('0x3a')];_0x2fb86f++){if(_0x94f65d[_0xc236('0x6c')](_0x2fb86f)=='-'){_0x4bb0c6+=_0x94f65d['charAt'](_0x2fb86f);}else{_0x4bb0c6+='['+_0x94f65d[_0xc236('0x6c')](_0x2fb86f)+']';}}_0x4bb0c6+='.';return _0x4bb0c6;}exports[_0xc236('0x28')]=function(_0x5897a1,_0x2c8f89,_0x340f7c){var _0x1c07d7=_0x5897a1[_0xc236('0x6d')];_0x1c07d7[_0xc236('0x61')]=_0xc236('0x6e')+_0x1c07d7[_0xc236('0x2d')]+'-';return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x5d627d){return db[_0xc236('0x31')][_0xc236('0x28')](_0x1c07d7,{'where':{'id':_0x1c07d7['id']},'transaction':_0x5d627d})[_0xc236('0x29')](function(){return db['VoiceExtension'][_0xc236('0x4c')]({'where':{'VoicePrefixId':_0x1c07d7['id']},'transaction':_0x5d627d})[_0xc236('0x29')](function(){return db[_0xc236('0x53')][_0xc236('0x4b')]({'where':{'id':_0x1c07d7['VoiceExtensionId']},'raw':!![]})[_0xc236('0x29')](function(_0x4a433e){return createVoicePrefixExtensions(_0x1c07d7,_0x4a433e,_0x5d627d);});});});})[_0xc236('0x29')](function(){return db['VoicePrefix'][_0xc236('0x6f')](_0x1c07d7['id']);})[_0xc236('0x29')](respondWithResult(_0x2c8f89,null))['catch'](handleError(_0x2c8f89,null));};exports['addAgents']=function(_0x4ec6d1,_0x930527,_0x4e9624){return db[_0xc236('0x31')][_0xc236('0x4b')]({'where':{'id':_0x4ec6d1['params']['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x930527,null))[_0xc236('0x29')](function(_0x4d7e8d){if(_0x4d7e8d){return _0x4d7e8d[_0xc236('0x70')](_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')],_[_0xc236('0x72')](_0x4ec6d1['body'],[_0xc236('0x71'),'id'])||{})[_0xc236('0x73')](function(_0x14cbad){for(var _0x1a27c9=0x0;_0x1a27c9<_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')][_0xc236('0x3a')];_0x1a27c9+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x4ec6d1[_0xc236('0x6d')][_0xc236('0x71')][_0x1a27c9]),'VoicePrefixId':Number(_0x4ec6d1[_0xc236('0x4d')]['id'])});}return _0x14cbad;});}})[_0xc236('0x29')](respondWithResult(_0x930527,null))[_0xc236('0x49')](handleError(_0x930527,null));};exports[_0xc236('0x74')]=function(_0x8967c,_0x1c6923,_0x4df1a5){return db['VoicePrefix'][_0xc236('0x4b')]({'where':{'id':_0x8967c['params']['id']}})[_0xc236('0x29')](handleEntityNotFound(_0x1c6923,null))[_0xc236('0x29')](function(_0x25d982){if(_0x25d982){return _0x25d982['removeAgents'](_0x8967c[_0xc236('0x34')]['ids'])[_0xc236('0x29')](function(){if(_[_0xc236('0x75')](_0x8967c[_0xc236('0x34')][_0xc236('0x71')])){for(var _0x48cf03=0x0;_0x48cf03<_0x8967c[_0xc236('0x34')][_0xc236('0x71')]['length'];_0x48cf03+=0x1){socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':Number(_0x8967c[_0xc236('0x34')][_0xc236('0x71')][_0x48cf03]),'VoicePrefixId':Number(_0x8967c[_0xc236('0x4d')]['id'])});}}else{socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':Number(_0x8967c['query'][_0xc236('0x71')]),'VoicePrefixId':Number(_0x8967c[_0xc236('0x4d')]['id'])});}});}})[_0xc236('0x29')](respondWithStatusCode(_0x1c6923,null))[_0xc236('0x49')](handleError(_0x1c6923,null));};exports['getAgents']=function(_0x3646c6,_0x1ee8d0,_0x50d1c6){var _0x40fd6d={};var _0x593b62={};var _0x25f91e;var _0xfc94e8;return db['VoicePrefix'][_0xc236('0x78')]({'where':{'id':_0x3646c6[_0xc236('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ee8d0,null))['then'](function(_0x2a9308){if(_0x2a9308){_0x25f91e=_0x2a9308;_0x593b62[_0xc236('0x3b')]=_[_0xc236('0x35')](db[_0xc236('0x79')][_0xc236('0x32')]);_0x593b62[_0xc236('0x34')]=_['keys'](_0x3646c6[_0xc236('0x34')]);_0x593b62[_0xc236('0x36')]=_[_0xc236('0x37')](_0x593b62[_0xc236('0x3b')],_0x593b62['query']);_0x40fd6d[_0xc236('0x38')]=_[_0xc236('0x37')](_0x593b62[_0xc236('0x3b')],qs[_0xc236('0x39')](_0x3646c6[_0xc236('0x34')]['fields']));_0x40fd6d['attributes']=_0x40fd6d[_0xc236('0x38')]['length']?_0x40fd6d[_0xc236('0x38')]:_0x593b62[_0xc236('0x3b')];_0x40fd6d[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x3646c6['query'][_0xc236('0x3f')]);_0x40fd6d['where']=qs[_0xc236('0x36')](_['pick'](_0x3646c6[_0xc236('0x34')],_0x593b62[_0xc236('0x36')]));if(_0x3646c6[_0xc236('0x34')][_0xc236('0x40')]){_0x40fd6d[_0xc236('0x41')]=_[_0xc236('0x42')](_0x40fd6d[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x40fd6d[_0xc236('0x38')],function(_0x577ace){var _0x4849a6={};_0x4849a6[_0x577ace]={'$like':'%'+_0x3646c6[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x4849a6;})});}_0x40fd6d=_[_0xc236('0x42')]({},_0x40fd6d,_0x3646c6[_0xc236('0x45')]);return _0x25f91e[_0xc236('0x7a')](_0x40fd6d);}})[_0xc236('0x29')](function(_0x557ad9){if(_0x557ad9){_0xfc94e8=_0x557ad9[_0xc236('0x3a')];if(!_0x3646c6[_0xc236('0x34')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x40fd6d[_0xc236('0x22')]=qs[_0xc236('0x22')](_0x3646c6[_0xc236('0x34')][_0xc236('0x22')]);_0x40fd6d[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x3646c6[_0xc236('0x34')][_0xc236('0x21')]);}return _0x25f91e[_0xc236('0x7a')](_0x40fd6d);}})[_0xc236('0x29')](function(_0x475c8f){if(_0x475c8f){return _0x475c8f?{'count':_0xfc94e8,'rows':_0x475c8f}:null;}})['then'](respondWithResult(_0x1ee8d0,null))[_0xc236('0x49')](handleError(_0x1ee8d0,null));};exports[_0xc236('0x7b')]=function(_0x17080e,_0x1070a3,_0x2bc6ed){var _0x4ed695={};var _0x424b51={};var _0x7bbb2c;var _0x1a938e;return db['VoicePrefix'][_0xc236('0x78')]({'where':{'id':_0x17080e['params']['id']}})['then'](handleEntityNotFound(_0x1070a3,null))[_0xc236('0x29')](function(_0x436845){if(_0x436845){_0x7bbb2c=_0x436845;_0x424b51[_0xc236('0x3b')]=_[_0xc236('0x35')](db[_0xc236('0x7c')]['rawAttributes']);_0x424b51[_0xc236('0x34')]=_[_0xc236('0x35')](_0x17080e[_0xc236('0x34')]);_0x424b51[_0xc236('0x36')]=_[_0xc236('0x37')](_0x424b51['model'],_0x424b51['query']);_0x4ed695[_0xc236('0x38')]=_[_0xc236('0x37')](_0x424b51[_0xc236('0x3b')],qs[_0xc236('0x39')](_0x17080e['query'][_0xc236('0x39')]));_0x4ed695[_0xc236('0x38')]=_0x4ed695[_0xc236('0x38')][_0xc236('0x3a')]?_0x4ed695[_0xc236('0x38')]:_0x424b51['model'];_0x4ed695[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x17080e[_0xc236('0x34')][_0xc236('0x3f')]);_0x4ed695[_0xc236('0x41')]=qs['filters'](_[_0xc236('0x7d')](_0x17080e[_0xc236('0x34')],_0x424b51['filters']));if(_0x17080e[_0xc236('0x34')][_0xc236('0x40')]){_0x4ed695[_0xc236('0x41')]=_[_0xc236('0x42')](_0x4ed695[_0xc236('0x41')],{'$or':_['map'](_0x4ed695[_0xc236('0x38')],function(_0x182750){var _0x32f936={};_0x32f936[_0x182750]={'$like':'%'+_0x17080e[_0xc236('0x34')][_0xc236('0x40')]+'%'};return _0x32f936;})});}_0x4ed695=_[_0xc236('0x42')]({},_0x4ed695,_0x17080e['options']);return _0x7bbb2c[_0xc236('0x7b')](_0x4ed695);}})['then'](function(_0x391ad3){if(_0x391ad3){_0x1a938e=_0x391ad3['length'];if(!_0x17080e[_0xc236('0x34')]['hasOwnProperty'](_0xc236('0x3d'))){_0x4ed695['limit']=qs[_0xc236('0x22')](_0x17080e[_0xc236('0x34')][_0xc236('0x22')]);_0x4ed695[_0xc236('0x21')]=qs[_0xc236('0x21')](_0x17080e[_0xc236('0x34')]['offset']);}return _0x7bbb2c[_0xc236('0x7b')](_0x4ed695);}})[_0xc236('0x29')](function(_0x32d1cc){if(_0x32d1cc){return _0x32d1cc?{'count':_0x1a938e,'rows':_0x32d1cc}:null;}})[_0xc236('0x29')](respondWithResult(_0x1070a3,null))[_0xc236('0x49')](handleError(_0x1070a3,null));};exports[_0xc236('0x7e')]=function(_0x424875,_0x14177d,_0x30e7b3){var _0x23fc57=_0x424875[_0xc236('0x6d')][_0xc236('0x71')];var _0x2bed4b;return db[_0xc236('0x7c')][_0xc236('0x7f')]({'where':{'id':_0x23fc57},'attributes':['id'],'include':[{'model':db[_0xc236('0x79')],'as':_0xc236('0x80'),'attributes':['id',_0xc236('0x2d'),_0xc236('0x81'),'voicePause',_0xc236('0x82')],'raw':!![]}]})[_0xc236('0x29')](function(_0x210989){if(_0x210989){_0x2bed4b=_0x210989;var _0x5164e5=_[_0xc236('0x83')](_0x210989,function(_0x32765e){var _0x4f9faf=_0x32765e[_0xc236('0x52')]({'plain':!![]});return _0x4f9faf[_0xc236('0x80')];});return db['VoicePrefix'][_0xc236('0x4b')]({'where':{'id':_0x424875[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](function(_0xfb7a98){return db['sequelize'][_0xc236('0x51')](function(_0x53287f){return _0xfb7a98[_0xc236('0x7e')](_0x23fc57,{'transaction':_0x53287f})[_0xc236('0x29')](function(){return BPromise[_0xc236('0x84')](_0x2bed4b,function(_0x2900ed){return db[_0xc236('0x85')]['upsert']({'TeamId':_0x2900ed['id'],'VoicePrefixId':_0x424875[_0xc236('0x4d')]['id']},{'transaction':_0x53287f});});})[_0xc236('0x29')](function(){return BPromise[_0xc236('0x84')](_0x5164e5,function(_0x29131a){return db[_0xc236('0x86')][_0xc236('0x87')]({'where':{'UserId':_0x29131a['id'],'VoicePrefixId':_0x424875[_0xc236('0x4d')]['id']},'transaction':_0x53287f});});})[_0xc236('0x29')](function(){_0x5164e5[_0xc236('0x88')](function(_0x833f85){socket[_0xc236('0x76')]('userVoicePrefix:save',{'UserId':_0x833f85['id'],'VoicePrefixId':_0xfb7a98['id']});});});});});}})['then'](respondWithStatusCode(_0x14177d,null))[_0xc236('0x49')](handleError(_0x14177d,null));};exports[_0xc236('0x89')]=function(_0x2207a8,_0x36fd37,_0x2494d9){return db[_0xc236('0x7c')][_0xc236('0x7f')]({'where':{'id':_0x2207a8[_0xc236('0x34')][_0xc236('0x71')]},'attributes':['id'],'include':[{'model':db[_0xc236('0x79')],'as':_0xc236('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x36fd37,null))[_0xc236('0x29')](function(_0x1669c4){var _0x29ae97=_[_0xc236('0x30')](_0x1669c4,'id');var _0x2a8f63=[];var _0x38aecf=[];var _0x2b46e4=squel[_0xc236('0x8a')]();_0x2b46e4['field']('tq.TeamId')['from'](_0xc236('0x8b'),'tq')['join'](_0xc236('0x8c'),'ut',_0xc236('0x8d'))[_0xc236('0x41')](_0xc236('0x8e'),_0x2207a8[_0xc236('0x4d')]['id']);for(var _0x43216e=0x0;_0x43216e<_0x1669c4[_0xc236('0x3a')];_0x43216e+=0x1){let _0x49d232=_0x1669c4[_0x43216e];for(var _0x870908=0x0;_0x870908<_0x49d232[_0xc236('0x80')][_0xc236('0x3a')];_0x870908+=0x1){let _0x364d8d=_0x49d232[_0xc236('0x80')][_0x870908];var _0x53cd27=_0x2b46e4[_0xc236('0x8f')]();_0x53cd27[_0xc236('0x41')](_0xc236('0x90'),_0x364d8d['id']);_0x38aecf[_0xc236('0x65')](db[_0xc236('0x50')][_0xc236('0x34')](_0x53cd27[_0xc236('0x91')](),{'type':db[_0xc236('0x50')][_0xc236('0x92')]['SELECT']})[_0xc236('0x29')](function(_0x281d3c){if(_0x281d3c[_0xc236('0x3a')]===0x1){return _0x364d8d['id'];}else{var _0x33cdb2=_['every'](_[_0xc236('0x30')](_0x281d3c,_0xc236('0x93')),function(_0x5ca99c){return _[_0xc236('0x94')](_0x29ae97,_0x5ca99c);});if(_0x33cdb2){return _0x364d8d['id'];}}}));}}return BPromise[_0xc236('0x95')](_0x38aecf)[_0xc236('0x29')](function(_0x32658a){_0x2a8f63=_(_0x2a8f63)[_0xc236('0x96')](_0x32658a)[_0xc236('0x97')]()[_0xc236('0x98')]();return db[_0xc236('0x31')]['find']({'where':{'id':_0x2207a8[_0xc236('0x4d')]['id']}})[_0xc236('0x29')](function(_0x26c461){return db[_0xc236('0x50')][_0xc236('0x51')](function(_0x57a83b){return _0x26c461[_0xc236('0x89')](_0x2207a8['query'][_0xc236('0x71')],{'transaction':_0x57a83b})[_0xc236('0x29')](function(){if(!_[_0xc236('0x99')](_0x2a8f63)){return _0x26c461[_0xc236('0x74')](_0x2a8f63,{'transaction':_0x57a83b});}})[_0xc236('0x29')](function(){_0x2a8f63[_0xc236('0x88')](function(_0x2e4215){socket[_0xc236('0x76')](_0xc236('0x77'),{'UserId':_0x2e4215,'VoicePrefixId':_0x26c461['id']});});});});});});})[_0xc236('0x29')](respondWithStatusCode(_0x36fd37,null))[_0xc236('0x49')](handleError(_0x36fd37,null));}; \ No newline at end of file +var _0x0120=['get','VoicePrefixes','UserProfileResource','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','params','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Agents','online','interface','flatMap','sequelize','addTeams','each','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','from','team_has_voice_prefixes','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x566157,_0x4d02df){var _0x49f8ac=function(_0x1e3814){while(--_0x1e3814){_0x566157['push'](_0x566157['shift']());}};_0x49f8ac(++_0x4d02df);}(_0x0120,0x6f));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];config['redis']=_[_0x0012('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0012('0x1b'))['register'](socket);function respondWithStatusCode(_0x3995fd,_0xf658bc){_0xf658bc=_0xf658bc||0xcc;return function(_0x47a6ef){if(_0x47a6ef){return _0x3995fd[_0x0012('0x1c')](_0xf658bc);}return _0x3995fd[_0x0012('0x1d')](_0xf658bc)[_0x0012('0x1e')]();};}function respondWithResult(_0x3b8dfc,_0x522e9b){_0x522e9b=_0x522e9b||0xc8;return function(_0x4e72da){if(_0x4e72da){return _0x3b8dfc[_0x0012('0x1d')](_0x522e9b)[_0x0012('0x1f')](_0x4e72da);}};}function respondWithFilteredResult(_0x3948bf,_0x2e88a8){return function(_0x1d0423){if(_0x1d0423){var _0x22ded1=typeof _0x2e88a8[_0x0012('0x20')]===_0x0012('0x21')&&typeof _0x2e88a8['limit']===_0x0012('0x21');var _0x56b0e1=_0x1d0423['count'];var _0x45d00b=_0x22ded1?0x0:_0x2e88a8[_0x0012('0x20')];var _0xa2e623=_0x22ded1?_0x1d0423[_0x0012('0x22')]:_0x2e88a8['offset']+_0x2e88a8['limit'];var _0x460d82;if(_0xa2e623>=_0x56b0e1){_0xa2e623=_0x56b0e1;_0x460d82=0xc8;}else{_0x460d82=0xce;}_0x3948bf[_0x0012('0x1d')](_0x460d82);return _0x3948bf[_0x0012('0x23')](_0x0012('0x24'),_0x45d00b+'-'+_0xa2e623+'/'+_0x56b0e1)[_0x0012('0x1f')](_0x1d0423);}return null;};}function patchUpdates(_0x2e6a2c){return function(_0x2c9a96){try{jsonpatch[_0x0012('0x25')](_0x2c9a96,_0x2e6a2c,!![]);}catch(_0x57487e){return BPromise[_0x0012('0x26')](_0x57487e);}return _0x2c9a96[_0x0012('0x27')]();};}function saveUpdates(_0x4cf4bd,_0x36cf42){return function(_0x13a78e){if(_0x13a78e){return _0x13a78e[_0x0012('0x28')](_0x4cf4bd)[_0x0012('0x29')](function(_0x42bcd7){return _0x42bcd7;});}return null;};}function removeEntity(_0x5e820b,_0x351ffd){return function(_0x18b0a7){if(_0x18b0a7){return _0x18b0a7[_0x0012('0x2a')]()[_0x0012('0x29')](function(){var _0x173cb3=_0x18b0a7[_0x0012('0x2b')]({'plain':!![]});var _0x15d48a=_0x0012('0x2c');return db[_0x0012('0x2d')][_0x0012('0x2a')]({'where':{'type':_0x15d48a,'resourceId':_0x173cb3['id']}})[_0x0012('0x29')](function(){return _0x18b0a7;});})[_0x0012('0x29')](function(){_0x5e820b[_0x0012('0x1d')](0xcc)[_0x0012('0x1e')]();});}};}function handleEntityNotFound(_0x1282bb,_0x276389){return function(_0x1b676d){if(!_0x1b676d){_0x1282bb[_0x0012('0x1c')](0x194);}return _0x1b676d;};}function handleError(_0x1c23e0,_0x291085){_0x291085=_0x291085||0x1f4;return function(_0x1bb14d){logger['error'](_0x1bb14d[_0x0012('0x2e')]);if(_0x1bb14d[_0x0012('0x2f')]){delete _0x1bb14d['name'];}_0x1c23e0[_0x0012('0x1d')](_0x291085)[_0x0012('0x30')](_0x1bb14d);};}exports[_0x0012('0x31')]=function(_0x1b6cef,_0x287b05){var _0x47d73b={},_0x13f169={},_0x187f4b={'count':0x0,'rows':[]};var _0x2e7487=_['map'](db[_0x0012('0x32')][_0x0012('0x33')],function(_0x398990){return{'name':_0x398990[_0x0012('0x34')],'type':_0x398990[_0x0012('0x35')][_0x0012('0x36')]};});_0x13f169['model']=_[_0x0012('0x37')](_0x2e7487,_0x0012('0x2f'));_0x13f169[_0x0012('0x38')]=_[_0x0012('0x39')](_0x1b6cef['query']);_0x13f169['filters']=_[_0x0012('0x3a')](_0x13f169[_0x0012('0x3b')],_0x13f169[_0x0012('0x38')]);_0x47d73b[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x13f169[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0x1b6cef['query'][_0x0012('0x3d')]));_0x47d73b[_0x0012('0x3c')]=_0x47d73b['attributes'][_0x0012('0x3e')]?_0x47d73b[_0x0012('0x3c')]:_0x13f169[_0x0012('0x3b')];if(!_0x1b6cef[_0x0012('0x38')][_0x0012('0x3f')](_0x0012('0x40'))){_0x47d73b[_0x0012('0x41')]=qs['limit'](_0x1b6cef[_0x0012('0x38')]['limit']);_0x47d73b[_0x0012('0x20')]=qs['offset'](_0x1b6cef['query'][_0x0012('0x20')]);}_0x47d73b[_0x0012('0x42')]=qs[_0x0012('0x43')](_0x1b6cef['query'][_0x0012('0x43')]);_0x47d73b[_0x0012('0x44')]=qs[_0x0012('0x45')](_[_0x0012('0x46')](_0x1b6cef[_0x0012('0x38')],_0x13f169[_0x0012('0x45')]),_0x2e7487);if(_0x1b6cef[_0x0012('0x38')][_0x0012('0x47')]){_0x47d73b['where']=_[_0x0012('0x48')](_0x47d73b[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x2e7487,function(_0x1799f2){if(_0x1799f2[_0x0012('0x35')]!==_0x0012('0x49')){var _0x375317={};_0x375317[_0x1799f2['name']]={'$like':'%'+_0x1b6cef['query'][_0x0012('0x47')]+'%'};return _0x375317;}})});}_0x47d73b=_['merge']({},_0x47d73b,_0x1b6cef[_0x0012('0x4a')]);var _0x30af1b={'where':_0x47d73b[_0x0012('0x44')]};return db[_0x0012('0x32')][_0x0012('0x22')](_0x30af1b)['then'](function(_0x1bd93a){_0x187f4b[_0x0012('0x22')]=_0x1bd93a;if(_0x1b6cef['query'][_0x0012('0x4b')]){_0x47d73b[_0x0012('0x4c')]=[{'all':!![]}];}return db[_0x0012('0x32')][_0x0012('0x4d')](_0x47d73b);})['then'](function(_0x4ba00e){_0x187f4b[_0x0012('0x4e')]=_0x4ba00e;return _0x187f4b;})['then'](respondWithFilteredResult(_0x287b05,_0x47d73b))[_0x0012('0x4f')](handleError(_0x287b05,null));};exports['show']=function(_0xdd4689,_0x1296fd){var _0x3daefd={'raw':![],'where':{'id':_0xdd4689['params']['id']}},_0x364f8e={};_0x364f8e[_0x0012('0x3b')]=_['keys'](db[_0x0012('0x32')][_0x0012('0x33')]);_0x364f8e[_0x0012('0x38')]=_[_0x0012('0x39')](_0xdd4689[_0x0012('0x38')]);_0x364f8e[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x364f8e['model'],_0x364f8e[_0x0012('0x38')]);_0x3daefd[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x364f8e[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0xdd4689[_0x0012('0x38')]['fields']));_0x3daefd['attributes']=_0x3daefd['attributes']['length']?_0x3daefd[_0x0012('0x3c')]:_0x364f8e[_0x0012('0x3b')];if(_0xdd4689[_0x0012('0x38')][_0x0012('0x4b')]){_0x3daefd[_0x0012('0x4c')]=[{'all':!![]}];}_0x3daefd=_['merge']({},_0x3daefd,_0xdd4689[_0x0012('0x4a')]);return db[_0x0012('0x32')][_0x0012('0x50')](_0x3daefd)[_0x0012('0x29')](handleEntityNotFound(_0x1296fd,null))[_0x0012('0x29')](respondWithResult(_0x1296fd,null))[_0x0012('0x4f')](handleError(_0x1296fd,null));};exports[_0x0012('0x2a')]=function(_0x26fb2b,_0x2177a6){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x26fb2b['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x2177a6,null))[_0x0012('0x29')](removeEntity(_0x2177a6,null))[_0x0012('0x4f')](handleError(_0x2177a6,null));};exports['describe']=function(_0x2d4ee7,_0x2f451b){return db[_0x0012('0x32')][_0x0012('0x51')]()[_0x0012('0x29')](respondWithResult(_0x2f451b,null))['catch'](handleError(_0x2f451b,null));};exports[_0x0012('0x52')]=function(_0x552f02,_0x430973){var _0x42f296;return db['sequelize'][_0x0012('0x53')](function(_0x19cf31){return db[_0x0012('0x32')][_0x0012('0x52')](_0x552f02[_0x0012('0x54')],{'transaction':_0x19cf31})[_0x0012('0x29')](function(_0x4e9f7e){_0x42f296=_0x4e9f7e[_0x0012('0x2b')]({'plain':!![]});return db[_0x0012('0x55')][_0x0012('0x50')]({'where':{'id':_0x42f296[_0x0012('0x56')]},'raw':!![]})['then'](function(_0x102637){return createVoicePrefixExtensions(_0x42f296,_0x102637,_0x19cf31);});});})[_0x0012('0x29')](function(){var _0x2e79aa=_0x552f02['user'][_0x0012('0x2b')]({'plain':!![]});if(!_0x2e79aa)throw new Error(_0x0012('0x57'));if(_0x2e79aa[_0x0012('0x58')]===_0x0012('0x59')){var _0x1a48d9=_0x42f296;return db[_0x0012('0x5a')][_0x0012('0x50')]({'where':{'name':_0x0012('0x2c'),'userProfileId':_0x2e79aa[_0x0012('0x5b')]},'raw':!![]})[_0x0012('0x29')](function(_0x263634){if(_0x263634&&_0x263634['autoAssociation']===0x0){return db['UserProfileResource'][_0x0012('0x52')]({'name':_0x1a48d9[_0x0012('0x2f')],'resourceId':_0x1a48d9['id'],'type':_0x263634[_0x0012('0x2f')],'sectionId':_0x263634['id']},{})[_0x0012('0x29')](function(){return _0x42f296;});}else{return _0x42f296;}})['catch'](function(_0x248497){logger[_0x0012('0x5c')](_0x0012('0x5d'),_0x248497);throw _0x248497;});}return _0x42f296;})[_0x0012('0x29')](respondWithResult(_0x430973,null))[_0x0012('0x4f')](handleError(_0x430973,null));};function Extension(_0x130045,_0x51eae3,_0x17eaff,_0x490644){this[_0x0012('0x5e')]=_0x0012('0x5f');this[_0x0012('0x60')]=_0x130045;this[_0x0012('0x61')]=_0x17eaff;this[_0x0012('0x35')]='system';this[_0x0012('0x62')]=_0x0012('0x63');this[_0x0012('0x64')]=_0x51eae3;this[_0x0012('0x65')]=_0x490644;}function createVoicePrefixExtensions(_0x2ceed5,_0x3d32c2,_0x562d6d){return new BPromise(function(_0x4e4d52,_0x4ea93b){var _0xd7db34=new Extension(formatPrefixName(_0x2ceed5[_0x0012('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0xd7db34['VoicePrefixId']=_0x2ceed5['id'];return db[_0x0012('0x55')][_0x0012('0x52')](_0xd7db34,{'transaction':_0x562d6d})[_0x0012('0x29')](function(_0x472843){var _0x1f0af9=_0x472843[_0x0012('0x2b')]({'plain':!![]});var _0x10cb5e=_[_0x0012('0x37')](addVoicePrefixExtensions(_0x2ceed5,_0x3d32c2),function(_0x2612e2){_0x2612e2[_0x0012('0x56')]=_0x1f0af9['id'];_0x2612e2['VoicePrefixId']=_0x2ceed5['id'];return _0x2612e2;});return db[_0x0012('0x55')][_0x0012('0x67')](_0x10cb5e,{'transaction':_0x562d6d})[_0x0012('0x29')](function(_0x5cfc9f){if(!_0x5cfc9f){return _0x4ea93b(_0x0012('0x68'));}else{return _0x4e4d52(_0x5cfc9f);}})[_0x0012('0x4f')](function(_0x4cba06){return _0x4ea93b(_0x4cba06);});});;});};function addVoicePrefixExtensions(_0x388466,_0x534840){var _0x2958c7=[];var _0x1661c2=formatPrefixName(_0x388466[_0x0012('0x66')]);_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x2,'Set',_0x0012('0x6a')+_0x388466[_0x0012('0x2f')]));if(_0x388466[_0x0012('0x6b')]){_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x3,_0x0012('0x6c'),_0x0012('0x6d')+_0x388466[_0x0012('0x6b')]));}else{_0x2958c7['push'](new Extension(_0x1661c2,0x3,'NoOp',_0x0012('0x6e')));}_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x4,_0x0012('0x6f'),_0x534840[_0x0012('0x5e')]+','+_0x0012('0x70')+(0x8+_0x388466[_0x0012('0x2f')][_0x0012('0x3e')])+'}'+','+0x1));return _0x2958c7;}function formatPrefixName(_0x38cc51){var _0x548487='_';for(var _0x15b058=0x0;_0x15b058<_0x38cc51[_0x0012('0x3e')];_0x15b058++){if(_0x38cc51[_0x0012('0x71')](_0x15b058)=='-'){_0x548487+=_0x38cc51[_0x0012('0x71')](_0x15b058);}else{_0x548487+='['+_0x38cc51[_0x0012('0x71')](_0x15b058)+']';}}_0x548487+='.';return _0x548487;}exports[_0x0012('0x28')]=function(_0x496ab9,_0x4fc9b1,_0x571247){var _0x49963a=_0x496ab9['body'];_0x49963a['prefix']=_0x0012('0x72')+_0x49963a[_0x0012('0x2f')]+'-';return db['sequelize'][_0x0012('0x53')](function(_0x1c93e7){return db[_0x0012('0x32')][_0x0012('0x28')](_0x49963a,{'where':{'id':_0x49963a['id']},'transaction':_0x1c93e7})[_0x0012('0x29')](function(){return db['VoiceExtension'][_0x0012('0x2a')]({'where':{'VoicePrefixId':_0x49963a['id']},'transaction':_0x1c93e7})[_0x0012('0x29')](function(){return db[_0x0012('0x55')][_0x0012('0x50')]({'where':{'id':_0x49963a[_0x0012('0x56')]},'raw':!![]})[_0x0012('0x29')](function(_0x47e12a){return createVoicePrefixExtensions(_0x49963a,_0x47e12a,_0x1c93e7);});});});})['then'](function(){return db[_0x0012('0x32')]['findById'](_0x49963a['id']);})[_0x0012('0x29')](respondWithResult(_0x4fc9b1,null))[_0x0012('0x4f')](handleError(_0x4fc9b1,null));};exports[_0x0012('0x73')]=function(_0xdd97af,_0x521a88,_0x493a0d){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0xdd97af[_0x0012('0x74')]['id']}})['then'](handleEntityNotFound(_0x521a88,null))[_0x0012('0x29')](function(_0x48d748){if(_0x48d748){return _0x48d748['addAgents'](_0xdd97af['body'][_0x0012('0x75')],_[_0x0012('0x76')](_0xdd97af['body'],[_0x0012('0x75'),'id'])||{})[_0x0012('0x77')](function(_0x574cf7){for(var _0x4e0a8f=0x0;_0x4e0a8f<_0xdd97af[_0x0012('0x54')]['ids'][_0x0012('0x3e')];_0x4e0a8f+=0x1){socket[_0x0012('0x78')]('userVoicePrefix:save',{'UserId':Number(_0xdd97af['body'][_0x0012('0x75')][_0x4e0a8f]),'VoicePrefixId':Number(_0xdd97af[_0x0012('0x74')]['id'])});}return _0x574cf7;});}})[_0x0012('0x29')](respondWithResult(_0x521a88,null))[_0x0012('0x4f')](handleError(_0x521a88,null));};exports['removeAgents']=function(_0x523419,_0x2852ac,_0x58d4dc){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x523419['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x2852ac,null))[_0x0012('0x29')](function(_0xd6f0ff){if(_0xd6f0ff){return _0xd6f0ff[_0x0012('0x79')](_0x523419[_0x0012('0x38')][_0x0012('0x75')])[_0x0012('0x29')](function(){if(_[_0x0012('0x7a')](_0x523419[_0x0012('0x38')][_0x0012('0x75')])){for(var _0x4a2ce1=0x0;_0x4a2ce1<_0x523419[_0x0012('0x38')]['ids']['length'];_0x4a2ce1+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x523419['query'][_0x0012('0x75')][_0x4a2ce1]),'VoicePrefixId':Number(_0x523419['params']['id'])});}}else{socket[_0x0012('0x78')](_0x0012('0x7b'),{'UserId':Number(_0x523419[_0x0012('0x38')]['ids']),'VoicePrefixId':Number(_0x523419[_0x0012('0x74')]['id'])});}});}})[_0x0012('0x29')](respondWithStatusCode(_0x2852ac,null))[_0x0012('0x4f')](handleError(_0x2852ac,null));};exports[_0x0012('0x7c')]=function(_0x35d36e,_0x26e6ed,_0xd6b12a){var _0x5dc5b5={};var _0x399108={};var _0x482684;var _0x526fae;return db[_0x0012('0x32')][_0x0012('0x7d')]({'where':{'id':_0x35d36e['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x26e6ed,null))['then'](function(_0xe913ef){if(_0xe913ef){_0x482684=_0xe913ef;_0x399108[_0x0012('0x3b')]=_[_0x0012('0x39')](db[_0x0012('0x7e')]['rawAttributes']);_0x399108[_0x0012('0x38')]=_[_0x0012('0x39')](_0x35d36e[_0x0012('0x38')]);_0x399108[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x399108['model'],_0x399108[_0x0012('0x38')]);_0x5dc5b5[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x399108[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0x35d36e['query'][_0x0012('0x3d')]));_0x5dc5b5['attributes']=_0x5dc5b5[_0x0012('0x3c')][_0x0012('0x3e')]?_0x5dc5b5['attributes']:_0x399108[_0x0012('0x3b')];_0x5dc5b5[_0x0012('0x42')]=qs['sort'](_0x35d36e[_0x0012('0x38')][_0x0012('0x43')]);_0x5dc5b5[_0x0012('0x44')]=qs[_0x0012('0x45')](_[_0x0012('0x46')](_0x35d36e[_0x0012('0x38')],_0x399108[_0x0012('0x45')]));if(_0x35d36e['query'][_0x0012('0x47')]){_0x5dc5b5[_0x0012('0x44')]=_[_0x0012('0x48')](_0x5dc5b5[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x5dc5b5[_0x0012('0x3c')],function(_0x203996){var _0x4da831={};_0x4da831[_0x203996]={'$like':'%'+_0x35d36e[_0x0012('0x38')][_0x0012('0x47')]+'%'};return _0x4da831;})});}_0x5dc5b5=_[_0x0012('0x48')]({},_0x5dc5b5,_0x35d36e[_0x0012('0x4a')]);return _0x482684[_0x0012('0x7c')](_0x5dc5b5);}})[_0x0012('0x29')](function(_0x119e75){if(_0x119e75){_0x526fae=_0x119e75['length'];if(!_0x35d36e[_0x0012('0x38')]['hasOwnProperty'](_0x0012('0x40'))){_0x5dc5b5[_0x0012('0x41')]=qs[_0x0012('0x41')](_0x35d36e[_0x0012('0x38')]['limit']);_0x5dc5b5[_0x0012('0x20')]=qs[_0x0012('0x20')](_0x35d36e[_0x0012('0x38')][_0x0012('0x20')]);}return _0x482684[_0x0012('0x7c')](_0x5dc5b5);}})[_0x0012('0x29')](function(_0x384731){if(_0x384731){return _0x384731?{'count':_0x526fae,'rows':_0x384731}:null;}})[_0x0012('0x29')](respondWithResult(_0x26e6ed,null))[_0x0012('0x4f')](handleError(_0x26e6ed,null));};exports[_0x0012('0x7f')]=function(_0x2cd7f9,_0x30739b,_0x529ad1){var _0x4de297={};var _0x493cf8={};var _0x10acaa;var _0x6b90b3;return db['VoicePrefix'][_0x0012('0x7d')]({'where':{'id':_0x2cd7f9['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x30739b,null))['then'](function(_0x2ecb66){if(_0x2ecb66){_0x10acaa=_0x2ecb66;_0x493cf8['model']=_['keys'](db['Team'][_0x0012('0x33')]);_0x493cf8[_0x0012('0x38')]=_['keys'](_0x2cd7f9[_0x0012('0x38')]);_0x493cf8[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x493cf8['model'],_0x493cf8[_0x0012('0x38')]);_0x4de297[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x493cf8['model'],qs[_0x0012('0x3d')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x3d')]));_0x4de297[_0x0012('0x3c')]=_0x4de297['attributes'][_0x0012('0x3e')]?_0x4de297['attributes']:_0x493cf8[_0x0012('0x3b')];_0x4de297['order']=qs[_0x0012('0x43')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x43')]);_0x4de297[_0x0012('0x44')]=qs['filters'](_[_0x0012('0x46')](_0x2cd7f9[_0x0012('0x38')],_0x493cf8['filters']));if(_0x2cd7f9[_0x0012('0x38')][_0x0012('0x47')]){_0x4de297[_0x0012('0x44')]=_[_0x0012('0x48')](_0x4de297[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x4de297['attributes'],function(_0x49cd17){var _0x5d13c2={};_0x5d13c2[_0x49cd17]={'$like':'%'+_0x2cd7f9[_0x0012('0x38')][_0x0012('0x47')]+'%'};return _0x5d13c2;})});}_0x4de297=_[_0x0012('0x48')]({},_0x4de297,_0x2cd7f9[_0x0012('0x4a')]);return _0x10acaa[_0x0012('0x7f')](_0x4de297);}})[_0x0012('0x29')](function(_0x314645){if(_0x314645){_0x6b90b3=_0x314645[_0x0012('0x3e')];if(!_0x2cd7f9[_0x0012('0x38')][_0x0012('0x3f')](_0x0012('0x40'))){_0x4de297[_0x0012('0x41')]=qs[_0x0012('0x41')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x41')]);_0x4de297[_0x0012('0x20')]=qs['offset'](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x20')]);}return _0x10acaa[_0x0012('0x7f')](_0x4de297);}})[_0x0012('0x29')](function(_0x3e8b0a){if(_0x3e8b0a){return _0x3e8b0a?{'count':_0x6b90b3,'rows':_0x3e8b0a}:null;}})[_0x0012('0x29')](respondWithResult(_0x30739b,null))[_0x0012('0x4f')](handleError(_0x30739b,null));};exports['addTeams']=function(_0x5e3240,_0x18aee3,_0x57f5a3){var _0x346739=_0x5e3240[_0x0012('0x54')][_0x0012('0x75')];var _0x270d2c;return db['Team']['findAll']({'where':{'id':_0x346739},'attributes':['id'],'include':[{'model':db[_0x0012('0x7e')],'as':_0x0012('0x80'),'attributes':['id','name',_0x0012('0x81'),'voicePause',_0x0012('0x82')],'raw':!![]}]})[_0x0012('0x29')](function(_0x22a7f8){if(_0x22a7f8){_0x270d2c=_0x22a7f8;var _0xe30fa=_[_0x0012('0x83')](_0x22a7f8,function(_0x250d30){var _0x300690=_0x250d30[_0x0012('0x2b')]({'plain':!![]});return _0x300690['Agents'];});return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x5e3240['params']['id']}})['then'](function(_0x973452){return db[_0x0012('0x84')][_0x0012('0x53')](function(_0x26fa8a){return _0x973452[_0x0012('0x85')](_0x346739,{'transaction':_0x26fa8a})[_0x0012('0x29')](function(){return BPromise[_0x0012('0x86')](_0x270d2c,function(_0x5d3b2e){return db[_0x0012('0x87')][_0x0012('0x88')]({'TeamId':_0x5d3b2e['id'],'VoicePrefixId':_0x5e3240[_0x0012('0x74')]['id']},{'transaction':_0x26fa8a});});})[_0x0012('0x29')](function(){return BPromise['each'](_0xe30fa,function(_0x558eb3){return db['UserVoicePrefix'][_0x0012('0x89')]({'where':{'UserId':_0x558eb3['id'],'VoicePrefixId':_0x5e3240[_0x0012('0x74')]['id']},'transaction':_0x26fa8a});});})[_0x0012('0x29')](function(){_0xe30fa['forEach'](function(_0x24264b){socket[_0x0012('0x78')](_0x0012('0x8a'),{'UserId':_0x24264b['id'],'VoicePrefixId':_0x973452['id']});});});});});}})[_0x0012('0x29')](respondWithStatusCode(_0x18aee3,null))['catch'](handleError(_0x18aee3,null));};exports[_0x0012('0x8b')]=function(_0x12c6fa,_0x5b1cb3,_0x5cb8b9){return db['Team'][_0x0012('0x4d')]({'where':{'id':_0x12c6fa[_0x0012('0x38')][_0x0012('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0012('0x7e')],'as':_0x0012('0x80'),'attributes':['id'],'raw':!![]}]})[_0x0012('0x29')](handleEntityNotFound(_0x5b1cb3,null))[_0x0012('0x29')](function(_0x2c186c){var _0x1c0814=_[_0x0012('0x37')](_0x2c186c,'id');var _0x1c1b75=[];var _0x272b17=[];var _0x504cba=squel['select']();_0x504cba['field']('tq.TeamId')[_0x0012('0x8c')](_0x0012('0x8d'),'tq')['join']('user_has_teams','ut',_0x0012('0x8e'))['where'](_0x0012('0x8f'),_0x12c6fa['params']['id']);for(var _0x58e8cf=0x0;_0x58e8cf<_0x2c186c[_0x0012('0x3e')];_0x58e8cf+=0x1){let _0x2c692=_0x2c186c[_0x58e8cf];for(var _0x3bad29=0x0;_0x3bad29<_0x2c692[_0x0012('0x80')]['length'];_0x3bad29+=0x1){let _0x4ccd2f=_0x2c692[_0x0012('0x80')][_0x3bad29];var _0x14b576=_0x504cba['clone']();_0x14b576[_0x0012('0x44')](_0x0012('0x90'),_0x4ccd2f['id']);_0x272b17[_0x0012('0x69')](db['sequelize'][_0x0012('0x38')](_0x14b576[_0x0012('0x91')](),{'type':db[_0x0012('0x84')][_0x0012('0x92')][_0x0012('0x93')]})['then'](function(_0x860c38){if(_0x860c38[_0x0012('0x3e')]===0x1){return _0x4ccd2f['id'];}else{var _0x316014=_['every'](_['map'](_0x860c38,_0x0012('0x94')),function(_0x50acf5){return _[_0x0012('0x95')](_0x1c0814,_0x50acf5);});if(_0x316014){return _0x4ccd2f['id'];}}}));}}return BPromise['all'](_0x272b17)[_0x0012('0x29')](function(_0x3153a3){_0x1c1b75=_(_0x1c1b75)[_0x0012('0x96')](_0x3153a3)[_0x0012('0x97')]()[_0x0012('0x98')]();return db['VoicePrefix'][_0x0012('0x50')]({'where':{'id':_0x12c6fa['params']['id']}})[_0x0012('0x29')](function(_0x343e40){return db['sequelize']['transaction'](function(_0x260d80){return _0x343e40[_0x0012('0x8b')](_0x12c6fa[_0x0012('0x38')]['ids'],{'transaction':_0x260d80})[_0x0012('0x29')](function(){if(!_[_0x0012('0x99')](_0x1c1b75)){return _0x343e40[_0x0012('0x79')](_0x1c1b75,{'transaction':_0x260d80});}})[_0x0012('0x29')](function(){_0x1c1b75['forEach'](function(_0x5d5544){socket[_0x0012('0x78')](_0x0012('0x7b'),{'UserId':_0x5d5544,'VoicePrefixId':_0x343e40['id']});});});});});});})['then'](respondWithStatusCode(_0x5b1cb3,null))[_0x0012('0x4f')](handleError(_0x5b1cb3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7fb327f..8edfeab 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 _0xa3cc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3cc,0xdd));var _0xca3c=function(_0x46d1a4,_0x49b4de){_0x46d1a4=_0x46d1a4-0x0;var _0x2b0e23=_0xa3cc[_0x46d1a4];return _0x2b0e23;};'use strict';var EventEmitter=require(_0xca3c('0x0'));var VoicePrefix=require(_0xca3c('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xca3c('0x2')](0x0);var events={'afterCreate':_0xca3c('0x3'),'afterUpdate':_0xca3c('0x4'),'afterDestroy':_0xca3c('0x5')};function emitEvent(_0x1d2cd4){return function(_0x360031,_0x130e32,_0x40c7dd){VoicePrefixEvents[_0xca3c('0x6')](_0x1d2cd4+':'+_0x360031['id'],_0x360031);VoicePrefixEvents[_0xca3c('0x6')](_0x1d2cd4,_0x360031);_0x40c7dd(null);};}for(var e in events){if(events[_0xca3c('0x7')](e)){var event=events[e];VoicePrefix[_0xca3c('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4740=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x33986b,_0x785f72){var _0x18b08c=function(_0x114dce){while(--_0x114dce){_0x33986b['push'](_0x33986b['shift']());}};_0x18b08c(++_0x785f72);}(_0x4740,0x13a));var _0x0474=function(_0x39722d,_0x10cda4){_0x39722d=_0x39722d-0x0;var _0x3b6dda=_0x4740[_0x39722d];return _0x3b6dda;};'use strict';var EventEmitter=require(_0x0474('0x0'));var VoicePrefix=require(_0x0474('0x1'))['db'][_0x0474('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0474('0x3')](0x0);var events={'afterCreate':_0x0474('0x4'),'afterUpdate':_0x0474('0x5'),'afterDestroy':_0x0474('0x6')};function emitEvent(_0x4db9fa){return function(_0x4974ae,_0x25f8af,_0x6558f5){VoicePrefixEvents[_0x0474('0x7')](_0x4db9fa+':'+_0x4974ae['id'],_0x4974ae);VoicePrefixEvents[_0x0474('0x7')](_0x4db9fa,_0x4974ae);_0x6558f5(null);};}for(var e in events){if(events[_0x0474('0x8')](e)){var event=events[e];VoicePrefix[_0x0474('0x9')](e,emitEvent(event));}}module[_0x0474('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 a2a12d0..15d48c8 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 _0xa8c2=['../../config/environment','./voicePrefix.attributes','exports','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0xa8c2,0xd5));var _0x2a8c=function(_0x53fb77,_0x442984){_0x53fb77=_0x53fb77-0x0;var _0x194496=_0xa8c2[_0x53fb77];return _0x194496;};'use strict';var _=require(_0x2a8c('0x0'));var util=require('util');var logger=require(_0x2a8c('0x1'))(_0x2a8c('0x2'));var moment=require(_0x2a8c('0x3'));var BPromise=require('bluebird');var rp=require(_0x2a8c('0x4'));var fs=require('fs');var path=require(_0x2a8c('0x5'));var rimraf=require(_0x2a8c('0x6'));var config=require(_0x2a8c('0x7'));var attributes=require(_0x2a8c('0x8'));module[_0x2a8c('0x9')]=function(_0x169bce,_0x1896da){return _0x169bce['define']('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd86b=['path','rimraf','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f8561,_0x294bd2){var _0x529730=function(_0x33baaa){while(--_0x33baaa){_0x3f8561['push'](_0x3f8561['shift']());}};_0x529730(++_0x294bd2);}(_0xd86b,0x1c2));var _0xbd86=function(_0x3034ce,_0x1421b6){_0x3034ce=_0x3034ce-0x0;var _0x4bc0e3=_0xd86b[_0x3034ce];return _0x4bc0e3;};'use strict';var _=require(_0xbd86('0x0'));var util=require('util');var logger=require(_0xbd86('0x1'))(_0xbd86('0x2'));var moment=require(_0xbd86('0x3'));var BPromise=require(_0xbd86('0x4'));var rp=require(_0xbd86('0x5'));var fs=require('fs');var path=require(_0xbd86('0x6'));var rimraf=require(_0xbd86('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd86('0x8'));module[_0xbd86('0x9')]=function(_0x329216,_0x84c994){return _0x329216['define'](_0xbd86('0xa'),attributes,{'tableName':_0xbd86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4414c2e..f7b3359 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 _0xd7d5=['localhost','socket.io-emitter','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x3e3255,_0x485196){var _0x57368e=function(_0x182722){while(--_0x182722){_0x3e3255['push'](_0x3e3255['shift']());}};_0x57368e(++_0x485196);}(_0xd7d5,0x1ea));var _0x5d7d=function(_0x408af0,_0x15f7f1){_0x408af0=_0x408af0-0x0;var _0x2fc7d0=_0xd7d5[_0x408af0];return _0x2fc7d0;};'use strict';var _=require(_0x5d7d('0x0'));var util=require(_0x5d7d('0x1'));var moment=require(_0x5d7d('0x2'));var BPromise=require(_0x5d7d('0x3'));var rs=require(_0x5d7d('0x4'));var fs=require('fs');var Redis=require(_0x5d7d('0x5'));var db=require(_0x5d7d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d7d('0x7'))('rpc');var config=require(_0x5d7d('0x8'));var jayson=require(_0x5d7d('0x9'));var client=jayson[_0x5d7d('0xa')][_0x5d7d('0xb')]({'port':0x232a});config[_0x5d7d('0xc')]=_[_0x5d7d('0xd')](config[_0x5d7d('0xc')],{'host':_0x5d7d('0xe'),'port':0x18eb});var socket=require(_0x5d7d('0xf'))(new Redis(config[_0x5d7d('0xc')]));require('./voicePrefix.socket')[_0x5d7d('0x10')](socket);function respondWithRpcPromise(_0x2d1bc4,_0x32bf2c,_0x307eb8){return new BPromise(function(_0x4b890d,_0x17512e){return client[_0x5d7d('0x11')](_0x2d1bc4,_0x307eb8)[_0x5d7d('0x12')](function(_0x139664){logger['info'](_0x5d7d('0x13'),_0x32bf2c,_0x5d7d('0x14'));logger[_0x5d7d('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x32bf2c,_0x5d7d('0x14'),JSON['stringify'](_0x139664));if(_0x139664['error']){if(_0x139664['error'][_0x5d7d('0x16')]===0x1f4){logger[_0x5d7d('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x32bf2c,_0x139664['error'][_0x5d7d('0x18')]);return _0x17512e(_0x139664[_0x5d7d('0x17')][_0x5d7d('0x18')]);}logger[_0x5d7d('0x17')](_0x5d7d('0x13'),_0x32bf2c,_0x139664['error']['message']);return _0x4b890d(_0x139664['error'][_0x5d7d('0x18')]);}else{logger[_0x5d7d('0x19')](_0x5d7d('0x13'),_0x32bf2c,_0x5d7d('0x14'));_0x4b890d(_0x139664[_0x5d7d('0x1a')][_0x5d7d('0x18')]);}})[_0x5d7d('0x1b')](function(_0x36edec){logger[_0x5d7d('0x17')](_0x5d7d('0x13'),_0x32bf2c,_0x36edec);_0x17512e(_0x36edec);});});} \ No newline at end of file +var _0x806d=['client','http','redis','defaults','localhost','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x38b18f,_0x5f5a8b){var _0x13e572=function(_0x135002){while(--_0x135002){_0x38b18f['push'](_0x38b18f['shift']());}};_0x13e572(++_0x5f5a8b);}(_0x806d,0x131));var _0xd806=function(_0x5d6030,_0x5eb64a){_0x5d6030=_0x5d6030-0x0;var _0x2ecc31=_0x806d[_0x5d6030];return _0x2ecc31;};'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});config[_0xd806('0x9')]=_[_0xd806('0xa')](config[_0xd806('0x9')],{'host':_0xd806('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd806('0x9')]));require(_0xd806('0xc'))[_0xd806('0xd')](socket);function respondWithRpcPromise(_0xf68dd6,_0x55fb02,_0x1b15ca){return new BPromise(function(_0x58d59d,_0x25c6be){return client[_0xd806('0xe')](_0xf68dd6,_0x1b15ca)['then'](function(_0x992b73){logger[_0xd806('0xf')](_0xd806('0x10'),_0x55fb02,_0xd806('0x11'));logger[_0xd806('0x12')](_0xd806('0x13'),_0x55fb02,_0xd806('0x11'),JSON[_0xd806('0x14')](_0x992b73));if(_0x992b73[_0xd806('0x15')]){if(_0x992b73[_0xd806('0x15')][_0xd806('0x16')]===0x1f4){logger['error'](_0xd806('0x10'),_0x55fb02,_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);return _0x25c6be(_0x992b73['error'][_0xd806('0x17')]);}logger['error'](_0xd806('0x10'),_0x55fb02,_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);return _0x58d59d(_0x992b73[_0xd806('0x15')][_0xd806('0x17')]);}else{logger[_0xd806('0xf')](_0xd806('0x10'),_0x55fb02,_0xd806('0x11'));_0x58d59d(_0x992b73[_0xd806('0x18')]['message']);}})[_0xd806('0x19')](function(_0x4321f3){logger[_0xd806('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x55fb02,_0x4321f3);_0x25c6be(_0x4321f3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7b99f08..b4e325c 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 _0x1491=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x1491,0x1b1));var _0x1149=function(_0x56ed51,_0x5acddc){_0x56ed51=_0x56ed51-0x0;var _0x521784=_0x1491[_0x56ed51];return _0x521784;};'use strict';var VoicePrefixEvents=require(_0x1149('0x0'));var events=[_0x1149('0x1'),_0x1149('0x2'),_0x1149('0x3')];function createListener(_0x49c2f2,_0x4138db){return function(_0x2e6865){_0x4138db[_0x1149('0x4')](_0x49c2f2,_0x2e6865);};}function removeListener(_0x17b2cc,_0x443acb){return function(){VoicePrefixEvents[_0x1149('0x5')](_0x17b2cc,_0x443acb);};}exports[_0x1149('0x6')]=function(_0x14b438){for(var _0x1ebf2b=0x0,_0xaa7515=events[_0x1149('0x7')];_0x1ebf2b<_0xaa7515;_0x1ebf2b++){var _0x3bf02f=events[_0x1ebf2b];var _0x285f6c=createListener(_0x1149('0x8')+_0x3bf02f,_0x14b438);VoicePrefixEvents['on'](_0x3bf02f,_0x285f6c);}}; \ No newline at end of file +var _0x515d=['removeListener','length','save','remove','update','emit'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x515d,0x104));var _0xd515=function(_0xd3c726,_0x47157b){_0xd3c726=_0xd3c726-0x0;var _0x1fa1cf=_0x515d[_0xd3c726];return _0x1fa1cf;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd515('0x0'),_0xd515('0x1'),_0xd515('0x2')];function createListener(_0x2241af,_0x153f6a){return function(_0x4240ce){_0x153f6a[_0xd515('0x3')](_0x2241af,_0x4240ce);};}function removeListener(_0x442530,_0x51e08b){return function(){VoicePrefixEvents[_0xd515('0x4')](_0x442530,_0x51e08b);};}exports['register']=function(_0x4d578b){for(var _0x42daa5=0x0,_0x1130fc=events[_0xd515('0x5')];_0x42daa5<_0x1130fc;_0x42daa5++){var _0x26a25d=events[_0x42daa5];var _0x2ec6e2=createListener('voicePrefix:'+_0x26a25d,_0x4d578b);VoicePrefixEvents['on'](_0x26a25d,_0x2ec6e2);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 6f1c232..250c721 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1b9b69,_0x570a41){var _0x449c00=function(_0x88acd){while(--_0x88acd){_0x1b9b69['push'](_0x1b9b69['shift']());}};_0x449c00(++_0x570a41);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x956f97,_0x429ac1){var _0x43fc6a=function(_0x2e73be){while(--_0x2e73be){_0x956f97['push'](_0x956f97['shift']());}};_0x43fc6a(++_0x429ac1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 401c247..918ab88 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 _0x1353=['UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','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)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ringall','leastrecent','fewestcalls','linear','rrordered','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','power','INTEGER','ENUM','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','Dial\x20Method.'];(function(_0x1c4a4c,_0x323452){var _0x54f849=function(_0x357119){while(--_0x357119){_0x1c4a4c['push'](_0x1c4a4c['shift']());}};_0x54f849(++_0x323452);}(_0x1353,0x11d));var _0x3135=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x1353[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x3135('0x0'));module[_0x3135('0x1')]={'name':{'type':Sequelize[_0x3135('0x2')],'allowNull':![],'unique':_0x3135('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x3135('0x4'),_0x3135('0x5')),'allowNull':![],'defaultValue':_0x3135('0x4')},'musiconhold':{'type':Sequelize[_0x3135('0x2')],'defaultValue':_0x3135('0x6')},'announce':{'type':Sequelize[_0x3135('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x3135('0x7'),_0x3135('0x8'),_0x3135('0x9'),'random','rrmemory',_0x3135('0xa'),'wrandom',_0x3135('0xb')),'allowNull':![],'defaultValue':_0x3135('0x7'),'set':function(_0x2a83f0){this['setDataValue'](_0x3135('0xc'),_0x2a83f0?_0x2a83f0:_0x3135('0xd'));},'get':function(){var _0x2c790b=this[_0x3135('0xe')](_0x3135('0xf'));var _0x275dcc=this[_0x3135('0xe')](_0x3135('0x10'));var _0x1848b8=this[_0x3135('0xe')](_0x3135('0xc'));if(_0x2c790b===_0x3135('0x4')){return _0x1848b8;}if(_0x275dcc===_0x3135('0x11')&&_0x1848b8==='rrmemory'||_0x275dcc===_0x3135('0x11')&&_0x1848b8===_0x3135('0x12')){return _0x1848b8;}if(_0x275dcc===_0x3135('0x13')||_0x275dcc==='predictive'||_0x275dcc===_0x3135('0x14')){return _0x1848b8;}return null;}},'servicelevel':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x3135('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3135('0x2')]},'weight':{'type':Sequelize[_0x3135('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':_0x3135('0x17')},'autopause':{'type':Sequelize['ENUM']('yes','no',_0x3135('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3135('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x3135('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x3135('0x16')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x3135('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x3135('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3135('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3135('0x16')]('yes','no'),'defaultValue':_0x3135('0x17')},'announce_holdtime':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no',_0x3135('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3135('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x3135('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3135('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3135('0x2')]},'queue_youarenext':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3135('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x3135('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x3135('0x2')]},'periodic_announce':{'type':Sequelize[_0x3135('0x1a')],'set':function(_0x55eff2){this[_0x3135('0x1b')](_0x3135('0x1c'),_0x55eff2?_0x55eff2[_0x3135('0x1d')](','):[]);},'get':function(){return this[_0x3135('0xe')]('periodic_announce')?this['getDataValue'](_0x3135('0x1c'))[_0x3135('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x3135('0x2')],'defaultValue':_0x3135('0x17'),'set':function(_0x2b6e3b){this[_0x3135('0x1b')]('joinempty',_0x2b6e3b?_0x2b6e3b[_0x3135('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0x3135('0x1f'))?this[_0x3135('0xe')](_0x3135('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x8130d6){this[_0x3135('0x1b')](_0x3135('0x20'),_0x8130d6?_0x8130d6[_0x3135('0x1d')](','):undefined);},'get':function(){return this[_0x3135('0xe')]('leavewhenempty')?this[_0x3135('0xe')](_0x3135('0x20'))[_0x3135('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3135('0x16')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3135('0x2')]},'description':{'type':Sequelize[_0x3135('0x2')]},'acw':{'type':Sequelize[_0x3135('0x21')],'defaultValue':0x0,'set':function(_0x2e35d0){this[_0x3135('0x1b')](_0x3135('0x22'),_0x2e35d0);if(_0x2e35d0){if(this[_0x3135('0xe')](_0x3135('0x23'))<0x2){this[_0x3135('0x1b')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3135('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3135('0x24')},'dialMethod':{'type':Sequelize[_0x3135('0x16')]('preview',_0x3135('0x13'),_0x3135('0x14'),_0x3135('0x25'),'booked'),'defaultValue':_0x3135('0x13'),'comment':_0x3135('0x26')},'dialLimitChannel':{'type':Sequelize[_0x3135('0x15')](0x4)[_0x3135('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3135('0x28')},'dialLimitQueue':{'type':Sequelize[_0x3135('0x15')](0x4)[_0x3135('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x3135('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x3135('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x3135('0x2a'),'dropRate'),'defaultValue':_0x3135('0x2b'),'comment':_0x3135('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3135('0x2d')](0x2)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x3135('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3135('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x3135('0x2')],'defaultValue':_0x3135('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x32')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3135('0x34')},'dialTimezone':{'type':Sequelize[_0x3135('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3135('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3135('0x16')](_0x3135('0x35'),_0x3135('0x36'),'onlyIfOpen'),'defaultValue':_0x3135('0x35')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x3135('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x3135('0x15')](0x9)[_0x3135('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3135('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x3135('0x15')](0x9)[_0x3135('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3135('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3135('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3135('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x3135('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3135('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3135('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3135('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3135('0x15')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3135('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3135('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3135('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3135('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3135('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x3135('0x21')],'defaultValue':0x0,'comment':_0x3135('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3135('0x16')]('DESC','ASC'),'defaultValue':_0x3135('0x41')},'dialQueueProject2':{'type':Sequelize[_0x3135('0x2')],'comment':_0x3135('0x42')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x3135('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x3135('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3135('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x3135('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3135('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x3135('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3135('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3135('0x15')](0x5)[_0x3135('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3135('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3135('0x15')],'allowNull':!![],'comment':_0x3135('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x3135('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x59089c){if(!_0x59089c)this['setDataValue'](_0x3135('0x4f'),null);this['setDataValue'](_0x3135('0x50'),_0x59089c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3135('0x15')](0x3)[_0x3135('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3135('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x3135('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3135('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x43ae=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','STRING','default','fewestcalls','random','linear','wrandom','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','progressive','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x43ae,0x1b8));var _0xe43a=function(_0x2f5828,_0x25ecbc){_0x2f5828=_0x2f5828-0x0;var _0x75aed8=_0x43ae[_0x2f5828];return _0x75aed8;};'use strict';var Sequelize=require('sequelize');module[_0xe43a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe43a('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x3'),_0xe43a('0x4')),'allowNull':![],'defaultValue':_0xe43a('0x3')},'musiconhold':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':_0xe43a('0x6')},'announce':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':''},'strategy':{'type':Sequelize[_0xe43a('0x2')]('rr','ringall','leastrecent',_0xe43a('0x7'),_0xe43a('0x8'),'rrmemory',_0xe43a('0x9'),_0xe43a('0xa'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x1e3561){this[_0xe43a('0xb')](_0xe43a('0xc'),_0x1e3561?_0x1e3561:_0xe43a('0xd'));},'get':function(){var _0x1398f3=this[_0xe43a('0xe')](_0xe43a('0xf'));var _0x1e8a0c=this[_0xe43a('0xe')](_0xe43a('0x10'));var _0xd9b59b=this[_0xe43a('0xe')](_0xe43a('0xc'));if(_0x1398f3==='inbound'){return _0xd9b59b;}if(_0x1e8a0c===_0xe43a('0x11')&&_0xd9b59b===_0xe43a('0xd')||_0x1e8a0c==='booked'&&_0xd9b59b==='roundrobin'){return _0xd9b59b;}if(_0x1e8a0c===_0xe43a('0x12')||_0x1e8a0c==='predictive'||_0x1e8a0c==='power'){return _0xd9b59b;}return null;}},'servicelevel':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe43a('0x5')]},'weight':{'type':Sequelize[_0xe43a('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xe43a('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xe43a('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe43a('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe43a('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe43a('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0xe43a('0x14'),'no',_0xe43a('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xe43a('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xe43a('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe43a('0x5')]},'queue_youarenext':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe43a('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe43a('0x5')]},'queue_quantity1':{'type':Sequelize[_0xe43a('0x5')]},'queue_quantity2':{'type':Sequelize[_0xe43a('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0xe43a('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe43a('0x17')],'set':function(_0x2e1fff){this[_0xe43a('0xb')](_0xe43a('0x18'),_0x2e1fff?_0x2e1fff[_0xe43a('0x19')](','):[]);},'get':function(){return this['getDataValue'](_0xe43a('0x18'))?this[_0xe43a('0xe')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4f6fa0){this[_0xe43a('0xb')](_0xe43a('0x1a'),_0x4f6fa0?_0x4f6fa0[_0xe43a('0x19')](','):undefined);},'get':function(){return this[_0xe43a('0xe')](_0xe43a('0x1a'))?this[_0xe43a('0xe')](_0xe43a('0x1a'))[_0xe43a('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2e11b5){this[_0xe43a('0xb')](_0xe43a('0x1c'),_0x2e11b5?_0x2e11b5[_0xe43a('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0xe43a('0x1c'))?this[_0xe43a('0xe')](_0xe43a('0x1c'))[_0xe43a('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe43a('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe43a('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xe43a('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe43a('0x5')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':0x0,'set':function(_0x991e3a){this[_0xe43a('0xb')](_0xe43a('0x1e'),_0x991e3a);if(_0x991e3a){if(this[_0xe43a('0xe')]('wrapuptime')<0x2){this[_0xe43a('0xb')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':0x0,'comment':_0xe43a('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0xe43a('0x20'),_0xe43a('0x12'),'power',_0xe43a('0x21'),_0xe43a('0x11')),'defaultValue':_0xe43a('0x12'),'comment':_0xe43a('0x22')},'dialLimitChannel':{'type':Sequelize[_0xe43a('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe43a('0x23')},'dialLimitQueue':{'type':Sequelize[_0xe43a('0x13')](0x4)[_0xe43a('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe43a('0x25')},'dialPowerLevel':{'type':Sequelize[_0xe43a('0x26')](0x2)[_0xe43a('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe43a('0x27')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe43a('0x28'),_0xe43a('0x29')),'defaultValue':_0xe43a('0x29'),'comment':_0xe43a('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe43a('0x26')](0x2)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe43a('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe43a('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x2c')},'dialQueueOptions':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':_0xe43a('0x2d'),'comment':_0xe43a('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xe43a('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe43a('0x13')](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe43a('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'comment':_0xe43a('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe43a('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe43a('0x35')},'dialTimezone':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe43a('0x5')],'defaultValue':_0xe43a('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe43a('0x2')]('always',_0xe43a('0x37'),_0xe43a('0x38')),'defaultValue':_0xe43a('0x39')},'dialAMDActive':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':0x0,'comment':_0xe43a('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe43a('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe43a('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0xe43a('0x13')](0x9)[_0xe43a('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe43a('0x13')](0x9)[_0xe43a('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe43a('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe43a('0x13')](0x9)[_0xe43a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe43a('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xe43a('0x13')](0x9)[_0xe43a('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe43a('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe43a('0x13')](0x9)[_0xe43a('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe43a('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe43a('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe43a('0x13')](0x5)[_0xe43a('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe43a('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe43a('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0xe43a('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe43a('0x42')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe43a('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe43a('0x2')](_0xe43a('0x44'),_0xe43a('0x45')),'defaultValue':_0xe43a('0x44')},'dialQueueProject2':{'type':Sequelize[_0xe43a('0x5')],'comment':_0xe43a('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe43a('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe43a('0x46')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xe43a('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe43a('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0xe43a('0x13')](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe43a('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe43a('0x13')](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe43a('0x4b')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe43a('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe43a('0x13')](0x5)[_0xe43a('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe43a('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe43a('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5690c0){if(!_0x5690c0)this[_0xe43a('0xb')](_0xe43a('0x4e'),null);this[_0xe43a('0xb')](_0xe43a('0x4f'),_0x5690c0);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe43a('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe43a('0x13')](0x3)[_0xe43a('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe43a('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 6b37920..8e3b396 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 _0xffb1=['outbound','filter','ignore','map','value','includes','type','find','name','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','UserProfileResource','CmHopper','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','Team','getTeams','addTeams','User','Agents','online','voicePause','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','isNil','format','SIP/%s','interface','forEach','emit','userVoiceQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','compact','ids','isEmpty','userVoiceQueue:remove','addAgents','spread','push','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','scheduledAt','ContactId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','COALESCE(phone,\x27\x27)','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','status','end','json','offset','undefined','limit','count','Content-Range','apply','then','destroy','get','inbound','QueueCampaigns'];(function(_0x35bdf0,_0x52c8e5){var _0x280f9e=function(_0x4777f4){while(--_0x4777f4){_0x35bdf0['push'](_0x35bdf0['shift']());}};_0x280f9e(++_0x52c8e5);}(_0xffb1,0x93));var _0x1ffb=function(_0x4f83ca,_0x46f67a){_0x4f83ca=_0x4f83ca-0x0;var _0x1fbac3=_0xffb1[_0x4f83ca];return _0x1fbac3;};'use strict';var emlformat=require(_0x1ffb('0x0'));var rimraf=require(_0x1ffb('0x1'));var zipdir=require(_0x1ffb('0x2'));var jsonpatch=require(_0x1ffb('0x3'));var rp=require(_0x1ffb('0x4'));var moment=require(_0x1ffb('0x5'));var BPromise=require(_0x1ffb('0x6'));var Mustache=require(_0x1ffb('0x7'));var util=require(_0x1ffb('0x8'));var path=require(_0x1ffb('0x9'));var sox=require('sox');var csv=require(_0x1ffb('0xa'));var ejs=require(_0x1ffb('0xb'));var fs=require('fs');var fs_extra=require(_0x1ffb('0xc'));var _=require(_0x1ffb('0xd'));var squel=require(_0x1ffb('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ffb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ffb('0x10'));var Papa=require(_0x1ffb('0x11'));var Redis=require(_0x1ffb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1ffb('0x13'));var hardwareService=require(_0x1ffb('0x14'));var logger=require('../../config/logger')(_0x1ffb('0x15'));var utils=require('../../config/utils');var config=require(_0x1ffb('0x16'));var licenseUtil=require(_0x1ffb('0x17'));var db=require(_0x1ffb('0x18'))['db'];config[_0x1ffb('0x19')]=_[_0x1ffb('0x1a')](config[_0x1ffb('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ffb('0x1b'))(new Redis(config[_0x1ffb('0x19')]));require(_0x1ffb('0x1c'))['register'](socket);function respondWithStatusCode(_0x208c0b,_0x5d1fba){_0x5d1fba=_0x5d1fba||0xcc;return function(_0x4c9431){if(_0x4c9431){return _0x208c0b['sendStatus'](_0x5d1fba);}return _0x208c0b[_0x1ffb('0x1d')](_0x5d1fba)[_0x1ffb('0x1e')]();};}function respondWithResult(_0x4c11db,_0x3e0681){_0x3e0681=_0x3e0681||0xc8;return function(_0xf343b5){if(_0xf343b5){return _0x4c11db[_0x1ffb('0x1d')](_0x3e0681)[_0x1ffb('0x1f')](_0xf343b5);}};}function respondWithFilteredResult(_0x4de448,_0x112a1f){return function(_0x4a2d6c){if(_0x4a2d6c){var _0xd004f=typeof _0x112a1f[_0x1ffb('0x20')]===_0x1ffb('0x21')&&typeof _0x112a1f[_0x1ffb('0x22')]===_0x1ffb('0x21');var _0x47b5d2=_0x4a2d6c[_0x1ffb('0x23')];var _0x59539e=_0xd004f?0x0:_0x112a1f[_0x1ffb('0x20')];var _0x1d5d3f=_0xd004f?_0x4a2d6c[_0x1ffb('0x23')]:_0x112a1f['offset']+_0x112a1f[_0x1ffb('0x22')];var _0x4dd0ba;if(_0x1d5d3f>=_0x47b5d2){_0x1d5d3f=_0x47b5d2;_0x4dd0ba=0xc8;}else{_0x4dd0ba=0xce;}_0x4de448[_0x1ffb('0x1d')](_0x4dd0ba);return _0x4de448['set'](_0x1ffb('0x24'),_0x59539e+'-'+_0x1d5d3f+'/'+_0x47b5d2)['json'](_0x4a2d6c);}return null;};}function patchUpdates(_0x3be561){return function(_0x5ac526){try{jsonpatch[_0x1ffb('0x25')](_0x5ac526,_0x3be561,!![]);}catch(_0x1a522c){return BPromise['reject'](_0x1a522c);}return _0x5ac526['save']();};}function saveUpdates(_0x5186fe,_0x16e288){return function(_0x4c9380){if(_0x4c9380){return _0x4c9380['update'](_0x5186fe)[_0x1ffb('0x26')](function(_0x391085){return _0x391085;});}return null;};}function removeEntity(_0x5b7ff5,_0x142ae0){return function(_0x4298fd){if(_0x4298fd){return _0x4298fd[_0x1ffb('0x27')]()[_0x1ffb('0x26')](function(){var _0x18dbba=_0x4298fd[_0x1ffb('0x28')]({'plain':!![]});var _0xacc9b8=[{'name':'VoiceQueues','value':_0x1ffb('0x29'),'ignore':![]},{'name':_0x1ffb('0x2a'),'value':_0x1ffb('0x2b'),'ignore':![]}];var _0x4dfa4b=_(_0xacc9b8)[_0x1ffb('0x2c')](_0x1ffb('0x2d'))[_0x1ffb('0x2e')]('value')[_0x1ffb('0x2f')]();if(_[_0x1ffb('0x30')](_0x4dfa4b,_0x18dbba[_0x1ffb('0x31')])){return;}var _0x146f3c=_[_0x1ffb('0x32')](_0xacc9b8,[_0x1ffb('0x2f'),_0x18dbba[_0x1ffb('0x31')]])[_0x1ffb('0x33')];return db['UserProfileResource'][_0x1ffb('0x27')]({'where':{'type':_0x146f3c,'resourceId':_0x18dbba['id']}})[_0x1ffb('0x26')](function(){return _0x4298fd;});})['then'](function(){_0x5b7ff5[_0x1ffb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57bdef,_0x137cfb){return function(_0x3f8331){if(!_0x3f8331){_0x57bdef[_0x1ffb('0x34')](0x194);}return _0x3f8331;};}function handleError(_0x4afe67,_0x4249c4){_0x4249c4=_0x4249c4||0x1f4;return function(_0x38688a){logger[_0x1ffb('0x35')](_0x38688a[_0x1ffb('0x36')]);if(_0x38688a[_0x1ffb('0x33')]){delete _0x38688a[_0x1ffb('0x33')];}_0x4afe67[_0x1ffb('0x1d')](_0x4249c4)[_0x1ffb('0x37')](_0x38688a);};}exports[_0x1ffb('0x38')]=function(_0x58e887,_0x456554){var _0x398c3c={},_0x1bcd96={},_0x2b7c26={'count':0x0,'rows':[]};var _0x2f58b5=_[_0x1ffb('0x2e')](db[_0x1ffb('0x39')][_0x1ffb('0x3a')],function(_0x187cbe){return{'name':_0x187cbe['fieldName'],'type':_0x187cbe[_0x1ffb('0x31')]['key']};});_0x1bcd96[_0x1ffb('0x3b')]=_['map'](_0x2f58b5,_0x1ffb('0x33'));_0x1bcd96[_0x1ffb('0x3c')]=_[_0x1ffb('0x3d')](_0x58e887[_0x1ffb('0x3c')]);_0x1bcd96[_0x1ffb('0x3e')]=_[_0x1ffb('0x3f')](_0x1bcd96['model'],_0x1bcd96[_0x1ffb('0x3c')]);_0x398c3c[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x1bcd96[_0x1ffb('0x3b')],qs['fields'](_0x58e887['query'][_0x1ffb('0x41')]));_0x398c3c[_0x1ffb('0x40')]=_0x398c3c[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x398c3c[_0x1ffb('0x40')]:_0x1bcd96['model'];if(!_0x58e887[_0x1ffb('0x3c')][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0x398c3c[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x58e887[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0x398c3c[_0x1ffb('0x20')]=qs[_0x1ffb('0x20')](_0x58e887[_0x1ffb('0x3c')]['offset']);}_0x398c3c[_0x1ffb('0x45')]=qs[_0x1ffb('0x46')](_0x58e887[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x398c3c['where']=qs[_0x1ffb('0x3e')](_['pick'](_0x58e887['query'],_0x1bcd96['filters']),_0x2f58b5);if(_0x58e887[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0x398c3c[_0x1ffb('0x47')]=_[_0x1ffb('0x48')](_0x398c3c[_0x1ffb('0x47')],{'$or':_['map'](_0x2f58b5,function(_0x4defe9){if(_0x4defe9[_0x1ffb('0x31')]!==_0x1ffb('0x49')){var _0x394809={};_0x394809[_0x4defe9[_0x1ffb('0x33')]]={'$like':'%'+_0x58e887[_0x1ffb('0x3c')]['filter']+'%'};return _0x394809;}})});}_0x398c3c=_[_0x1ffb('0x48')]({},_0x398c3c,_0x58e887[_0x1ffb('0x4a')]);var _0x530bf4={'where':_0x398c3c[_0x1ffb('0x47')]};return db['VoiceQueue'][_0x1ffb('0x23')](_0x530bf4)[_0x1ffb('0x26')](function(_0x45428c){_0x2b7c26[_0x1ffb('0x23')]=_0x45428c;if(_0x58e887[_0x1ffb('0x3c')]['includeAll']){_0x398c3c[_0x1ffb('0x4b')]=[{'all':!![]}];}return db[_0x1ffb('0x39')][_0x1ffb('0x4c')](_0x398c3c);})[_0x1ffb('0x26')](function(_0x57bbfb){_0x2b7c26['rows']=_0x57bbfb;return _0x2b7c26;})[_0x1ffb('0x26')](respondWithFilteredResult(_0x456554,_0x398c3c))[_0x1ffb('0x4d')](handleError(_0x456554,null));};exports['show']=function(_0x50c00a,_0x3d468f){var _0x487a41={'raw':![],'where':{'id':_0x50c00a[_0x1ffb('0x4e')]['id']}},_0x459578={};_0x459578[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x39')][_0x1ffb('0x3a')]);_0x459578[_0x1ffb('0x3c')]=_['keys'](_0x50c00a[_0x1ffb('0x3c')]);_0x459578[_0x1ffb('0x3e')]=_[_0x1ffb('0x3f')](_0x459578[_0x1ffb('0x3b')],_0x459578['query']);_0x487a41[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x459578[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x50c00a[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x487a41[_0x1ffb('0x40')]=_0x487a41[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x487a41[_0x1ffb('0x40')]:_0x459578[_0x1ffb('0x3b')];if(_0x50c00a[_0x1ffb('0x3c')][_0x1ffb('0x4f')]){_0x487a41[_0x1ffb('0x4b')]=[{'all':!![]}];}_0x487a41=_[_0x1ffb('0x48')]({},_0x487a41,_0x50c00a[_0x1ffb('0x4a')]);return db[_0x1ffb('0x39')][_0x1ffb('0x32')](_0x487a41)['then'](handleEntityNotFound(_0x3d468f,null))[_0x1ffb('0x26')](respondWithResult(_0x3d468f,null))['catch'](handleError(_0x3d468f,null));};exports[_0x1ffb('0x50')]=function(_0x5bed2e,_0x2c72a0){return db[_0x1ffb('0x39')][_0x1ffb('0x50')](_0x5bed2e['body'],{})['then'](function(_0x5099ab){var _0xae2f7b=_0x5bed2e[_0x1ffb('0x51')][_0x1ffb('0x28')]({'plain':!![]});if(!_0xae2f7b)throw new Error(_0x1ffb('0x52'));if(_0xae2f7b[_0x1ffb('0x53')]===_0x1ffb('0x51')){var _0x26f8c9=_0x5099ab[_0x1ffb('0x28')]({'plain':!![]});var _0x1163a4=[{'name':_0x1ffb('0x54'),'value':'inbound'},{'name':_0x1ffb('0x2a'),'value':_0x1ffb('0x2b')}];var _0x8dbf58=_['find'](_0x1163a4,['value',_0x26f8c9[_0x1ffb('0x31')]])[_0x1ffb('0x33')];return db[_0x1ffb('0x55')]['find']({'where':{'name':_0x8dbf58,'userProfileId':_0xae2f7b[_0x1ffb('0x56')]},'raw':!![]})[_0x1ffb('0x26')](function(_0x4b6af5){if(_0x4b6af5&&_0x4b6af5['autoAssociation']===0x0){return db['UserProfileResource'][_0x1ffb('0x50')]({'name':_0x26f8c9['name'],'resourceId':_0x26f8c9['id'],'type':_0x4b6af5['name'],'sectionId':_0x4b6af5['id']},{})[_0x1ffb('0x26')](function(){return _0x5099ab;});}else{return _0x5099ab;}})[_0x1ffb('0x4d')](function(_0x2eeef0){logger[_0x1ffb('0x35')](_0x1ffb('0x57'),_0x2eeef0);throw _0x2eeef0;});}return _0x5099ab;})[_0x1ffb('0x26')](respondWithResult(_0x2c72a0,0xc9))['catch'](handleError(_0x2c72a0,null));};exports['clone']=function(_0x49cb0e,_0x36db51){var _0x42c7d5={'where':{'id':_0x49cb0e['params']['id']}},_0x42a075={};_0x42a075[_0x1ffb('0x3b')]=_['keys'](db['VoiceQueue'][_0x1ffb('0x3a')]);_0x42c7d5['attributes']=_[_0x1ffb('0x3f')](_0x42a075[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x49cb0e[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x42c7d5['attributes']=_0x42c7d5[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x42c7d5[_0x1ffb('0x40')]:_0x42a075['model'];if(_0x49cb0e[_0x1ffb('0x3c')][_0x1ffb('0x4f')]){_0x42c7d5[_0x1ffb('0x4b')]=[{'all':!![]}];}_0x42c7d5=_[_0x1ffb('0x48')]({},_0x42c7d5,_0x49cb0e['options']);return db[_0x1ffb('0x39')][_0x1ffb('0x32')](_0x42c7d5)[_0x1ffb('0x26')](handleEntityNotFound(_0x36db51,null))['then'](function(_0x5944e7){if(_0x5944e7){var _0x305c6c=_0x5944e7[_0x1ffb('0x28')]({'plain':!![]});_0x305c6c=qs[_0x1ffb('0x58')](_0x305c6c,['id',_0x1ffb('0x59'),_0x1ffb('0x5a')]);_0x49cb0e[_0x1ffb('0x5b')]=_[_0x1ffb('0x58')](_0x49cb0e['body'],['id',_0x1ffb('0x59'),_0x1ffb('0x5a')]);return db[_0x1ffb('0x39')][_0x1ffb('0x50')](_[_0x1ffb('0x48')](_0x305c6c,_0x49cb0e[_0x1ffb('0x5b')]),{'include':_0x49cb0e[_0x1ffb('0x3c')]['includeAll']?[{'all':!![]}]:undefined})[_0x1ffb('0x26')](function(_0x276991){var _0x4ca4df=_0x49cb0e[_0x1ffb('0x51')][_0x1ffb('0x28')]({'plain':!![]});if(!_0x4ca4df)throw new Error(_0x1ffb('0x52'));if(_0x4ca4df[_0x1ffb('0x53')]==='user'){var _0x2473b9=_0x276991[_0x1ffb('0x28')]({'plain':!![]});var _0x263da7=[{'name':_0x1ffb('0x54'),'value':_0x1ffb('0x29')},{'name':'QueueCampaigns','value':'outbound'}];var _0x10bfbf=_[_0x1ffb('0x32')](_0x263da7,['value',_0x2473b9[_0x1ffb('0x31')]])[_0x1ffb('0x33')];return db[_0x1ffb('0x55')][_0x1ffb('0x32')]({'where':{'name':_0x10bfbf,'userProfileId':_0x4ca4df[_0x1ffb('0x56')]},'raw':!![]})[_0x1ffb('0x26')](function(_0x418e19){if(_0x418e19&&_0x418e19['autoAssociation']===0x0){return db[_0x1ffb('0x5c')][_0x1ffb('0x50')]({'name':_0x2473b9[_0x1ffb('0x33')],'resourceId':_0x2473b9['id'],'type':_0x418e19[_0x1ffb('0x33')],'sectionId':_0x418e19['id']},{})[_0x1ffb('0x26')](function(){return _0x276991;});}else{return _0x276991;}})[_0x1ffb('0x4d')](function(_0x470d36){logger[_0x1ffb('0x35')](_0x1ffb('0x57'),_0x470d36);throw _0x470d36;});}return _0x276991;});}})[_0x1ffb('0x26')](respondWithResult(_0x36db51,0xc9))[_0x1ffb('0x4d')](handleError(_0x36db51,null));};exports['update']=function(_0x544dff,_0x3656b4){if(_0x544dff[_0x1ffb('0x5b')]['id']){delete _0x544dff['body']['id'];}return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x544dff[_0x1ffb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3656b4,null))[_0x1ffb('0x26')](saveUpdates(_0x544dff[_0x1ffb('0x5b')],null))[_0x1ffb('0x26')](respondWithResult(_0x3656b4,null))[_0x1ffb('0x4d')](handleError(_0x3656b4,null));};exports[_0x1ffb('0x27')]=function(_0xd9c472,_0x4d59a1){return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0xd9c472['params']['id']}})['then'](handleEntityNotFound(_0x4d59a1,null))['then'](removeEntity(_0x4d59a1,null))[_0x1ffb('0x4d')](handleError(_0x4d59a1,null));};exports['getHoppers']=function(_0x30aa8a,_0x42eaaf,_0x473a38){var _0x162d15={'raw':![],'where':{}};var _0x214262={};var _0x4aa630={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x30aa8a[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x42eaaf,null))['then'](function(_0x573dd4){if(_0x573dd4){_0x214262[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x5d')]['rawAttributes']);_0x214262['query']=_[_0x1ffb('0x3d')](_0x30aa8a['query']);_0x214262[_0x1ffb('0x3e')]=_[_0x1ffb('0x3f')](_0x214262[_0x1ffb('0x3b')],_0x214262[_0x1ffb('0x3c')]);_0x162d15[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x214262[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x30aa8a[_0x1ffb('0x3c')]['fields']));_0x162d15[_0x1ffb('0x40')]=_0x162d15['attributes']['length']?_0x162d15[_0x1ffb('0x40')]:_0x214262[_0x1ffb('0x3b')];if(!_0x30aa8a[_0x1ffb('0x3c')]['hasOwnProperty'](_0x1ffb('0x44'))){_0x162d15[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x30aa8a['query'][_0x1ffb('0x22')]);_0x162d15[_0x1ffb('0x20')]=qs[_0x1ffb('0x20')](_0x30aa8a[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}_0x162d15[_0x1ffb('0x45')]=qs[_0x1ffb('0x46')](_0x30aa8a['query'][_0x1ffb('0x46')]);_0x162d15[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_['pick'](_0x30aa8a[_0x1ffb('0x3c')],_0x214262[_0x1ffb('0x3e')]));_0x162d15[_0x1ffb('0x47')]['VoiceQueueId']=_0x573dd4['id'];if(_0x30aa8a['query'][_0x1ffb('0x2c')]){_0x162d15['where']=_[_0x1ffb('0x48')](_0x162d15[_0x1ffb('0x47')],{'$or':_[_0x1ffb('0x2e')](_0x162d15[_0x1ffb('0x40')],function(_0x365bb0){var _0x19f7ae={};_0x19f7ae[_0x365bb0]={'$like':'%'+_0x30aa8a[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x19f7ae;})});}_0x162d15=_[_0x1ffb('0x48')]({},_0x162d15,_0x30aa8a[_0x1ffb('0x4a')]);return db[_0x1ffb('0x5d')][_0x1ffb('0x23')]({'where':_0x162d15[_0x1ffb('0x47')]})[_0x1ffb('0x26')](function(_0x1d03a5){_0x4aa630['count']=_0x1d03a5;if(_0x30aa8a['query'][_0x1ffb('0x4f')]){_0x162d15[_0x1ffb('0x4b')]=[{'all':!![]}];}return db[_0x1ffb('0x5d')][_0x1ffb('0x4c')](_0x162d15);})[_0x1ffb('0x26')](function(_0x28d05e){_0x4aa630[_0x1ffb('0x5e')]=_0x28d05e;return _0x4aa630;});}})[_0x1ffb('0x26')](respondWithFilteredResult(_0x42eaaf,_0x162d15))['catch'](handleError(_0x42eaaf,null));};exports[_0x1ffb('0x5f')]=function(_0x11070c,_0x46a208,_0x2f13e6){var _0x2adfee={'raw':!![],'where':{}};var _0x1e984a={};var _0x2695d0={'count':0x0,'rows':[]};return db[_0x1ffb('0x39')]['findOne']({'where':{'id':_0x11070c['params']['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x46a208,null))['then'](function(_0x413b59){if(_0x413b59){_0x1e984a[_0x1ffb('0x3b')]=_['keys'](db[_0x1ffb('0x60')][_0x1ffb('0x3a')]);_0x1e984a[_0x1ffb('0x3c')]=_['keys'](_0x11070c[_0x1ffb('0x3c')]);_0x1e984a[_0x1ffb('0x3e')]=_['intersection'](_0x1e984a[_0x1ffb('0x3b')],_0x1e984a[_0x1ffb('0x3c')]);_0x2adfee[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x1e984a['model'],qs[_0x1ffb('0x41')](_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x2adfee[_0x1ffb('0x40')]=_0x2adfee[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x2adfee[_0x1ffb('0x40')]:_0x1e984a[_0x1ffb('0x3b')];if(!_0x11070c[_0x1ffb('0x3c')]['hasOwnProperty'](_0x1ffb('0x44'))){_0x2adfee[_0x1ffb('0x22')]=qs['limit'](_0x11070c[_0x1ffb('0x3c')]['limit']);_0x2adfee[_0x1ffb('0x20')]=qs[_0x1ffb('0x20')](_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}_0x2adfee[_0x1ffb('0x45')]=qs[_0x1ffb('0x46')](_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x2adfee[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x11070c[_0x1ffb('0x3c')],_0x1e984a['filters']));_0x2adfee[_0x1ffb('0x47')][_0x1ffb('0x62')]=_0x413b59['id'];if(_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0x2adfee['where']=_[_0x1ffb('0x48')](_0x2adfee[_0x1ffb('0x47')],{'$or':_[_0x1ffb('0x2e')](_0x2adfee[_0x1ffb('0x40')],function(_0x114863){var _0x12dcb6={};_0x12dcb6[_0x114863]={'$like':'%'+_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x12dcb6;})});}_0x2adfee=_['merge']({},_0x2adfee,_0x11070c[_0x1ffb('0x4a')]);return db[_0x1ffb('0x60')][_0x1ffb('0x23')]({'where':_0x2adfee[_0x1ffb('0x47')]})[_0x1ffb('0x26')](function(_0xf790aa){_0x2695d0[_0x1ffb('0x23')]=_0xf790aa;if(_0x11070c[_0x1ffb('0x3c')][_0x1ffb('0x4f')]){_0x2adfee['include']=[{'all':!![]}];}return db[_0x1ffb('0x60')][_0x1ffb('0x4c')](_0x2adfee);})[_0x1ffb('0x26')](function(_0x304636){_0x2695d0['rows']=_0x304636;return _0x2695d0;});}})[_0x1ffb('0x26')](respondWithFilteredResult(_0x46a208,_0x2adfee))['catch'](handleError(_0x46a208,null));};exports[_0x1ffb('0x63')]=function(_0x51c4f3,_0x6713f0,_0x47eede){var _0x141aef={'raw':!![],'where':{}};var _0x115273={};var _0x25138f={'count':0x0,'rows':[]};return db[_0x1ffb('0x39')]['findOne']({'where':{'id':_0x51c4f3[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x6713f0,null))[_0x1ffb('0x26')](function(_0x25cd87){if(_0x25cd87){_0x115273[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x64')][_0x1ffb('0x3a')]);_0x115273[_0x1ffb('0x3c')]=_[_0x1ffb('0x3d')](_0x51c4f3[_0x1ffb('0x3c')]);_0x115273['filters']=_[_0x1ffb('0x3f')](_0x115273[_0x1ffb('0x3b')],_0x115273[_0x1ffb('0x3c')]);_0x141aef[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x115273[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x141aef[_0x1ffb('0x40')]=_0x141aef[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x141aef[_0x1ffb('0x40')]:_0x115273[_0x1ffb('0x3b')];if(!_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0x141aef[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x51c4f3[_0x1ffb('0x3c')]['limit']);_0x141aef[_0x1ffb('0x20')]=qs['offset'](_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}_0x141aef['order']=qs[_0x1ffb('0x46')](_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x141aef[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x51c4f3[_0x1ffb('0x3c')],_0x115273[_0x1ffb('0x3e')]));_0x141aef[_0x1ffb('0x47')]['VoiceQueueId']=_0x25cd87['id'];if(_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0x141aef['where']=_[_0x1ffb('0x48')](_0x141aef['where'],{'$or':_['map'](_0x141aef[_0x1ffb('0x40')],function(_0x3b0769){var _0x5db7aa={};_0x5db7aa[_0x3b0769]={'$like':'%'+_0x51c4f3[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x5db7aa;})});}_0x141aef=_[_0x1ffb('0x48')]({},_0x141aef,_0x51c4f3[_0x1ffb('0x4a')]);return db[_0x1ffb('0x64')][_0x1ffb('0x23')]({'where':_0x141aef[_0x1ffb('0x47')]})[_0x1ffb('0x26')](function(_0x22dc46){_0x25138f[_0x1ffb('0x23')]=_0x22dc46;if(_0x51c4f3['query'][_0x1ffb('0x4f')]){_0x141aef[_0x1ffb('0x4b')]=[{'all':!![]}];}return db[_0x1ffb('0x64')][_0x1ffb('0x4c')](_0x141aef);})[_0x1ffb('0x26')](function(_0x22b925){_0x25138f[_0x1ffb('0x5e')]=_0x22b925;return _0x25138f;});}})['then'](respondWithFilteredResult(_0x6713f0,_0x141aef))[_0x1ffb('0x4d')](handleError(_0x6713f0,null));};exports[_0x1ffb('0x65')]=function(_0x2d7e03,_0x1ecb1d,_0x469822){var _0x1f6571={'raw':!![],'where':{}};var _0x481845={};var _0x2d4972={'count':0x0,'rows':[]};return db[_0x1ffb('0x39')][_0x1ffb('0x66')]({'where':{'id':_0x2d7e03['params']['id']}})['then'](handleEntityNotFound(_0x1ecb1d,null))['then'](function(_0x4048aa){if(_0x4048aa){_0x481845[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x67')]['rawAttributes']);_0x481845[_0x1ffb('0x3c')]=_['keys'](_0x2d7e03[_0x1ffb('0x3c')]);_0x481845[_0x1ffb('0x3e')]=_['intersection'](_0x481845[_0x1ffb('0x3b')],_0x481845[_0x1ffb('0x3c')]);_0x1f6571['attributes']=_[_0x1ffb('0x3f')](_0x481845['model'],qs[_0x1ffb('0x41')](_0x2d7e03['query']['fields']));_0x1f6571['attributes']=_0x1f6571[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x1f6571[_0x1ffb('0x40')]:_0x481845['model'];if(!_0x2d7e03[_0x1ffb('0x3c')][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0x1f6571['limit']=qs[_0x1ffb('0x22')](_0x2d7e03[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0x1f6571['offset']=qs[_0x1ffb('0x20')](_0x2d7e03[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}_0x1f6571['order']=qs['sort'](_0x2d7e03[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x1f6571[_0x1ffb('0x47')]=qs['filters'](_[_0x1ffb('0x61')](_0x2d7e03[_0x1ffb('0x3c')],_0x481845['filters']));_0x1f6571[_0x1ffb('0x47')][_0x1ffb('0x62')]=_0x4048aa['id'];if(_0x2d7e03['query'][_0x1ffb('0x2c')]){_0x1f6571[_0x1ffb('0x47')]=_[_0x1ffb('0x48')](_0x1f6571[_0x1ffb('0x47')],{'$or':_['map'](_0x1f6571[_0x1ffb('0x40')],function(_0x31afd5){var _0x4f4807={};_0x4f4807[_0x31afd5]={'$like':'%'+_0x2d7e03[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x4f4807;})});}_0x1f6571=_[_0x1ffb('0x48')]({},_0x1f6571,_0x2d7e03['options']);return db[_0x1ffb('0x67')]['count']({'where':_0x1f6571[_0x1ffb('0x47')]})[_0x1ffb('0x26')](function(_0x96122f){_0x2d4972[_0x1ffb('0x23')]=_0x96122f;if(_0x2d7e03['query'][_0x1ffb('0x4f')]){_0x1f6571[_0x1ffb('0x4b')]=[{'all':!![]}];}return db[_0x1ffb('0x67')][_0x1ffb('0x4c')](_0x1f6571);})[_0x1ffb('0x26')](function(_0x175c70){_0x2d4972[_0x1ffb('0x5e')]=_0x175c70;return _0x2d4972;});}})['then'](respondWithFilteredResult(_0x1ecb1d,_0x1f6571))[_0x1ffb('0x4d')](handleError(_0x1ecb1d,null));};exports['getTeams']=function(_0x987abc,_0x12d8b3,_0x8082bc){var _0x1298be={};var _0x571e24={};var _0x541b18;var _0x2afe84;return db[_0x1ffb('0x39')][_0x1ffb('0x66')]({'where':{'id':_0x987abc['params']['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x12d8b3,null))[_0x1ffb('0x26')](function(_0x44133b){if(_0x44133b){_0x541b18=_0x44133b;_0x571e24[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x68')]['rawAttributes']);_0x571e24[_0x1ffb('0x3c')]=_[_0x1ffb('0x3d')](_0x987abc['query']);_0x571e24['filters']=_['intersection'](_0x571e24[_0x1ffb('0x3b')],_0x571e24[_0x1ffb('0x3c')]);_0x1298be[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x571e24[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x987abc[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x1298be[_0x1ffb('0x40')]=_0x1298be['attributes'][_0x1ffb('0x42')]?_0x1298be['attributes']:_0x571e24[_0x1ffb('0x3b')];_0x1298be[_0x1ffb('0x45')]=qs['sort'](_0x987abc[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x1298be['where']=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x987abc['query'],_0x571e24['filters']));if(_0x987abc['query'][_0x1ffb('0x2c')]){_0x1298be[_0x1ffb('0x47')]=_['merge'](_0x1298be[_0x1ffb('0x47')],{'$or':_[_0x1ffb('0x2e')](_0x1298be[_0x1ffb('0x40')],function(_0x245f78){var _0x560c68={};_0x560c68[_0x245f78]={'$like':'%'+_0x987abc['query'][_0x1ffb('0x2c')]+'%'};return _0x560c68;})});}_0x1298be=_[_0x1ffb('0x48')]({},_0x1298be,_0x987abc[_0x1ffb('0x4a')]);return _0x541b18[_0x1ffb('0x69')](_0x1298be);}})[_0x1ffb('0x26')](function(_0x4fc41a){if(_0x4fc41a){_0x2afe84=_0x4fc41a[_0x1ffb('0x42')];if(!_0x987abc[_0x1ffb('0x3c')]['hasOwnProperty']('nolimit')){_0x1298be[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x987abc[_0x1ffb('0x3c')]['limit']);_0x1298be[_0x1ffb('0x20')]=qs[_0x1ffb('0x20')](_0x987abc[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}return _0x541b18[_0x1ffb('0x69')](_0x1298be);}})['then'](function(_0x929e6e){if(_0x929e6e){return _0x929e6e?{'count':_0x2afe84,'rows':_0x929e6e}:null;}})['then'](respondWithResult(_0x12d8b3,null))[_0x1ffb('0x4d')](handleError(_0x12d8b3,null));};exports[_0x1ffb('0x6a')]=function(_0x27ecdb,_0x395d26,_0x31704c){var _0x21dfa0=_0x27ecdb[_0x1ffb('0x5b')]['teams'];var _0x305aab=_[_0x1ffb('0x2e')](_0x21dfa0,'id');return db[_0x1ffb('0x68')][_0x1ffb('0x4c')]({'where':{'id':_0x305aab},'attributes':['id'],'include':[{'model':db[_0x1ffb('0x6b')],'as':_0x1ffb('0x6c'),'attributes':['id',_0x1ffb('0x33'),_0x1ffb('0x6d'),_0x1ffb('0x6e'),'interface'],'raw':!![]}]})[_0x1ffb('0x26')](function(_0x21c2a9){if(_0x21c2a9){var _0x64a2ee=_[_0x1ffb('0x6f')](_0x21c2a9,function(_0x5e2819){var _0x3e8794=_0x5e2819[_0x1ffb('0x28')]({'plain':!![]});_0x3e8794[_0x1ffb('0x6c')]['forEach'](function(_0x25a673){_0x25a673[_0x1ffb('0x70')]=_['find'](_0x21dfa0,{'id':_0x3e8794['id']})[_0x1ffb('0x70')];});return _0x3e8794['Agents'];});return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x27ecdb[_0x1ffb('0x4e')]['id']}})['then'](function(_0x56382e){return db[_0x1ffb('0x71')][_0x1ffb('0x72')](function(_0x1489d7){return _0x56382e[_0x1ffb('0x6a')](_0x305aab,{'transaction':_0x1489d7})[_0x1ffb('0x26')](function(){return BPromise['each'](_0x21dfa0,function(_0x52f03b){return db[_0x1ffb('0x73')][_0x1ffb('0x74')]({'TeamId':_0x52f03b['id'],'VoiceQueueId':_0x27ecdb[_0x1ffb('0x4e')]['id'],'penalty':_0x52f03b[_0x1ffb('0x70')]},{'transaction':_0x1489d7});});})[_0x1ffb('0x26')](function(){return BPromise['each'](_0x64a2ee,function(_0x32f602){return db[_0x1ffb('0x75')][_0x1ffb('0x76')]({'where':{'UserId':_0x32f602['id'],'VoiceQueueId':_0x27ecdb[_0x1ffb('0x4e')]['id']},'defaults':{'penalty':_0x32f602[_0x1ffb('0x70')]},'transaction':_0x1489d7});});})['then'](function(){return BPromise[_0x1ffb('0x77')](_[_0x1ffb('0x2c')](_0x64a2ee,{'online':!![]}),function(_0x4eea1d){return db[_0x1ffb('0x78')]['upsert']({'membername':_0x4eea1d[_0x1ffb('0x33')],'UserId':_0x4eea1d['id'],'queue_name':_0x56382e[_0x1ffb('0x33')],'VoiceQueueId':_0x56382e['id'],'interface':_[_0x1ffb('0x79')](_0x4eea1d['interface'])?util[_0x1ffb('0x7a')](_0x1ffb('0x7b'),_0x4eea1d[_0x1ffb('0x33')]):_0x4eea1d[_0x1ffb('0x7c')],'paused':_0x4eea1d[_0x1ffb('0x6e')]||![],'penalty':_0x4eea1d[_0x1ffb('0x70')]},{'transaction':_0x1489d7});});})['then'](function(){_0x64a2ee[_0x1ffb('0x7d')](function(_0x1c3b27){socket[_0x1ffb('0x7e')](_0x1ffb('0x7f'),{'UserId':_0x1c3b27['id'],'VoiceQueueId':_0x56382e['id']});});});});});}})['then'](respondWithStatusCode(_0x395d26,null))[_0x1ffb('0x4d')](handleError(_0x395d26,null));};exports[_0x1ffb('0x80')]=function(_0x79530,_0x29a7e6,_0x6f4fc8){return db['Team'][_0x1ffb('0x4c')]({'where':{'id':_0x79530['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1ffb('0x6b')],'as':_0x1ffb('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x1ffb('0x26')](handleEntityNotFound(_0x29a7e6,null))[_0x1ffb('0x26')](function(_0x5c688e){var _0x34586e=_[_0x1ffb('0x2e')](_0x5c688e,'id');var _0x574899=[];var _0x4eae2a=[];var _0x9cfbf8=squel[_0x1ffb('0x81')]();_0x9cfbf8[_0x1ffb('0x82')]('tq.TeamId')[_0x1ffb('0x83')]('team_has_voice_queues','tq')[_0x1ffb('0x84')](_0x1ffb('0x85'),'ut',_0x1ffb('0x86'))[_0x1ffb('0x47')](_0x1ffb('0x87'),_0x79530[_0x1ffb('0x4e')]['id']);for(var _0x34bc64=0x0;_0x34bc64<_0x5c688e[_0x1ffb('0x42')];_0x34bc64+=0x1){let _0x4faeb2=_0x5c688e[_0x34bc64];for(var _0x23b77f=0x0;_0x23b77f<_0x4faeb2[_0x1ffb('0x6c')][_0x1ffb('0x42')];_0x23b77f+=0x1){let _0x242dd2=_0x4faeb2[_0x1ffb('0x6c')][_0x23b77f];var _0xae4c10=_0x9cfbf8[_0x1ffb('0x88')]();_0xae4c10[_0x1ffb('0x47')](_0x1ffb('0x89'),_0x242dd2['id']);_0x4eae2a['push'](db[_0x1ffb('0x71')][_0x1ffb('0x3c')](_0xae4c10[_0x1ffb('0x8a')](),{'type':db[_0x1ffb('0x71')][_0x1ffb('0x8b')][_0x1ffb('0x8c')]})['then'](function(_0x2d59de){if(_0x2d59de[_0x1ffb('0x42')]===0x1){return _0x242dd2['id'];}else{var _0x3490a6=_[_0x1ffb('0x8d')](_[_0x1ffb('0x2e')](_0x2d59de,'TeamId'),function(_0x3e6fa3){return _[_0x1ffb('0x30')](_0x34586e,_0x3e6fa3);});if(_0x3490a6){return _0x242dd2['id'];}}}));}}return BPromise[_0x1ffb('0x8e')](_0x4eae2a)[_0x1ffb('0x26')](function(_0x5b7e60){_0x574899=_(_0x574899)['union'](_0x5b7e60)[_0x1ffb('0x8f')]()['value']();return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x79530[_0x1ffb('0x4e')]['id']}})['then'](function(_0x2256d5){return db['sequelize'][_0x1ffb('0x72')](function(_0x4861b9){return _0x2256d5[_0x1ffb('0x80')](_0x79530[_0x1ffb('0x3c')][_0x1ffb('0x90')],{'transaction':_0x4861b9})[_0x1ffb('0x26')](function(){if(!_[_0x1ffb('0x91')](_0x574899)){return _0x2256d5['removeAgents'](_0x574899,{'transaction':_0x4861b9})['then'](function(){return db[_0x1ffb('0x78')]['destroy']({'where':{'VoiceQueueId':_0x79530[_0x1ffb('0x4e')]['id'],'UserId':_0x574899},'transaction':_0x4861b9});});}})['then'](function(){_0x574899[_0x1ffb('0x7d')](function(_0x3c0583){socket[_0x1ffb('0x7e')](_0x1ffb('0x92'),{'UserId':_0x3c0583,'VoiceQueueId':_0x2256d5['id']});});});});});});})[_0x1ffb('0x26')](respondWithStatusCode(_0x29a7e6,null))[_0x1ffb('0x4d')](handleError(_0x29a7e6,null));};exports[_0x1ffb('0x93')]=function(_0x1afb88,_0x14f12e,_0x24cbcd){var _0xecb28a,_0x58a1bf;return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x1afb88[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x14f12e,null))['then'](function(_0x55f9ce){if(_0x55f9ce){_0x58a1bf=_0x55f9ce;return _0x55f9ce[_0x1ffb('0x93')](_0x1afb88['body'][_0x1ffb('0x90')],_[_0x1ffb('0x58')](_0x1afb88[_0x1ffb('0x5b')],['ids','id'])||{})[_0x1ffb('0x94')](function(_0x370ebc){for(var _0x1847b8=0x0;_0x1847b8<_0x1afb88[_0x1ffb('0x5b')]['ids'][_0x1ffb('0x42')];_0x1847b8+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x1afb88[_0x1ffb('0x5b')][_0x1ffb('0x90')][_0x1847b8]),'VoiceQueueId':Number(_0x1afb88[_0x1ffb('0x4e')]['id'])});}return _0x370ebc;});}})[_0x1ffb('0x26')](function(_0x3b9c84){_0xecb28a=_0x3b9c84||[];if(_0x58a1bf){return db[_0x1ffb('0x6b')][_0x1ffb('0x4c')]({'where':{'id':_0x1afb88['body'][_0x1ffb('0x90')]},'attributes':['id','name',_0x1ffb('0x6d'),'voicePause',_0x1ffb('0x7c')],'raw':!![]});}})[_0x1ffb('0x26')](function(_0x51dcb4){if(!_[_0x1ffb('0x91')](_0x51dcb4)){var _0x57bd9f=[];for(var _0x228a6d=0x0;_0x228a6d<_0x51dcb4[_0x1ffb('0x42')];_0x228a6d++){if(_0x51dcb4[_0x228a6d][_0x1ffb('0x6d')]){_0x57bd9f[_0x1ffb('0x95')](db[_0x1ffb('0x78')]['upsert']({'membername':_0x51dcb4[_0x228a6d]['name'],'UserId':_0x51dcb4[_0x228a6d]['id'],'queue_name':_0x58a1bf[_0x1ffb('0x33')],'VoiceQueueId':_0x58a1bf['id'],'interface':_[_0x1ffb('0x79')](_0x51dcb4[_0x228a6d]['interface'])?util[_0x1ffb('0x7a')]('SIP/%s',_0x51dcb4[_0x228a6d][_0x1ffb('0x33')]):_0x51dcb4[_0x228a6d][_0x1ffb('0x7c')],'paused':_0x51dcb4[_0x228a6d][_0x1ffb('0x6e')]||![],'penalty':_0x1afb88['body']['penalty']||0x0}));}}return BPromise[_0x1ffb('0x8e')](_0x57bd9f);}})[_0x1ffb('0x26')](function(){return _0xecb28a;})[_0x1ffb('0x26')](respondWithResult(_0x14f12e,null))[_0x1ffb('0x4d')](handleError(_0x14f12e,null));};exports[_0x1ffb('0x96')]=function(_0x367ae3,_0x56e869,_0x102009){return db['VoiceQueue'][_0x1ffb('0x32')]({'where':{'id':_0x367ae3[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x56e869,null))['then'](function(_0x533820){if(_0x533820){return _0x533820['removeAgents'](_0x367ae3[_0x1ffb('0x3c')]['ids'])['then'](function(){if(_['isArray'](_0x367ae3[_0x1ffb('0x3c')][_0x1ffb('0x90')])){for(var _0x930a9a=0x0;_0x930a9a<_0x367ae3[_0x1ffb('0x3c')][_0x1ffb('0x90')]['length'];_0x930a9a+=0x1){socket[_0x1ffb('0x7e')]('userVoiceQueue:remove',{'UserId':Number(_0x367ae3[_0x1ffb('0x3c')][_0x1ffb('0x90')][_0x930a9a]),'VoiceQueueId':Number(_0x367ae3[_0x1ffb('0x4e')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x367ae3['query'][_0x1ffb('0x90')]),'VoiceQueueId':Number(_0x367ae3['params']['id'])});}});}})['then'](function(_0x2140d5){return db[_0x1ffb('0x78')]['destroy']({'where':{'VoiceQueueId':_0x367ae3[_0x1ffb('0x4e')]['id'],'UserId':_0x367ae3[_0x1ffb('0x3c')][_0x1ffb('0x90')]}})[_0x1ffb('0x26')](function(){return _0x2140d5;});})[_0x1ffb('0x26')](respondWithStatusCode(_0x56e869,null))[_0x1ffb('0x4d')](handleError(_0x56e869,null));};exports[_0x1ffb('0x97')]=function(_0x3b50b6,_0x11d94a,_0x3049af){var _0x4b1576={};var _0x4812c7={};var _0x438f95;var _0x38e267;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b50b6['params']['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x11d94a,null))[_0x1ffb('0x26')](function(_0x4181b2){if(_0x4181b2){_0x438f95=_0x4181b2;_0x4812c7[_0x1ffb('0x3b')]=_['keys'](db[_0x1ffb('0x6b')][_0x1ffb('0x3a')]);_0x4812c7[_0x1ffb('0x3c')]=_['keys'](_0x3b50b6[_0x1ffb('0x3c')]);_0x4812c7[_0x1ffb('0x3e')]=_[_0x1ffb('0x3f')](_0x4812c7[_0x1ffb('0x3b')],_0x4812c7[_0x1ffb('0x3c')]);_0x4b1576[_0x1ffb('0x40')]=_['intersection'](_0x4812c7[_0x1ffb('0x3b')],qs['fields'](_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x4b1576['attributes']=_0x4b1576[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x4b1576[_0x1ffb('0x40')]:_0x4812c7[_0x1ffb('0x3b')];_0x4b1576['order']=qs[_0x1ffb('0x46')](_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x4b1576['where']=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x3b50b6[_0x1ffb('0x3c')],_0x4812c7[_0x1ffb('0x3e')]));if(_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0x4b1576[_0x1ffb('0x47')]=_[_0x1ffb('0x48')](_0x4b1576[_0x1ffb('0x47')],{'$or':_['map'](_0x4b1576['attributes'],function(_0x1fa8ce){var _0x1d1bfd={};_0x1d1bfd[_0x1fa8ce]={'$like':'%'+_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x1d1bfd;})});}_0x4b1576=_[_0x1ffb('0x48')]({},_0x4b1576,_0x3b50b6[_0x1ffb('0x4a')]);return _0x438f95['getAgents'](_0x4b1576);}})[_0x1ffb('0x26')](function(_0x3c36e1){if(_0x3c36e1){_0x38e267=_0x3c36e1[_0x1ffb('0x42')];if(!_0x3b50b6['query'][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0x4b1576['limit']=qs[_0x1ffb('0x22')](_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0x4b1576['offset']=qs[_0x1ffb('0x20')](_0x3b50b6[_0x1ffb('0x3c')][_0x1ffb('0x20')]);}return _0x438f95[_0x1ffb('0x97')](_0x4b1576);}})[_0x1ffb('0x26')](function(_0x41cbaa){if(_0x41cbaa){return _0x41cbaa?{'count':_0x38e267,'rows':_0x41cbaa}:null;}})[_0x1ffb('0x26')](respondWithResult(_0x11d94a,null))[_0x1ffb('0x4d')](handleError(_0x11d94a,null));};exports[_0x1ffb('0x98')]=function(_0x6059ef,_0x24f169,_0x470597){var _0x39a1be={};var _0x5ec5ed={};var _0x4c81cb;var _0x272590;return db[_0x1ffb('0x39')][_0x1ffb('0x66')]({'where':{'id':_0x6059ef[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x24f169,null))[_0x1ffb('0x26')](function(_0x3a1315){if(_0x3a1315){_0x4c81cb=_0x3a1315;_0x5ec5ed[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db['UserVoiceQueueRt'][_0x1ffb('0x3a')]);_0x5ec5ed[_0x1ffb('0x3c')]=_[_0x1ffb('0x3d')](_0x6059ef[_0x1ffb('0x3c')]);_0x5ec5ed[_0x1ffb('0x3e')]=_['intersection'](_0x5ec5ed['model'],_0x5ec5ed[_0x1ffb('0x3c')]);_0x39a1be[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x5ec5ed[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x6059ef[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x39a1be['attributes']=_0x39a1be[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x39a1be[_0x1ffb('0x40')]:_0x5ec5ed[_0x1ffb('0x3b')];_0x39a1be[_0x1ffb('0x45')]=qs[_0x1ffb('0x46')](_0x6059ef[_0x1ffb('0x3c')][_0x1ffb('0x46')]);_0x39a1be[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x6059ef[_0x1ffb('0x3c')],_0x5ec5ed[_0x1ffb('0x3e')]));if(_0x6059ef['query'][_0x1ffb('0x2c')]){_0x39a1be[_0x1ffb('0x47')]=_['merge'](_0x39a1be['where'],{'$or':_[_0x1ffb('0x2e')](_0x39a1be['attributes'],function(_0x2bc2d5){var _0x5ad776={};_0x5ad776[_0x2bc2d5]={'$like':'%'+_0x6059ef[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x5ad776;})});}_0x39a1be=_[_0x1ffb('0x48')]({},_0x39a1be,_0x6059ef[_0x1ffb('0x4a')]);return _0x4c81cb['getMembers'](_0x39a1be);}})['then'](function(_0x5809ac){if(_0x5809ac){_0x272590=_0x5809ac[_0x1ffb('0x42')];if(!_0x6059ef[_0x1ffb('0x3c')][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0x39a1be[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x6059ef[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0x39a1be[_0x1ffb('0x20')]=qs[_0x1ffb('0x20')](_0x6059ef[_0x1ffb('0x3c')]['offset']);}return _0x4c81cb[_0x1ffb('0x98')](_0x39a1be);}})[_0x1ffb('0x26')](function(_0x1745dc){return _0x1745dc?{'count':_0x272590,'rows':_0x1745dc}:null;})[_0x1ffb('0x26')](respondWithResult(_0x24f169,null))[_0x1ffb('0x4d')](handleError(_0x24f169,null));};exports[_0x1ffb('0x99')]=function(_0x3dcd21,_0x1b98f4,_0x4f68d7){var _0xecb02c={};var _0x33568d={};var _0x46cff9;var _0x304bac;return db['VoiceQueue']['findOne']({'where':{'id':_0x3dcd21['params']['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x1b98f4,null))[_0x1ffb('0x26')](function(_0x503705){if(_0x503705){_0x46cff9=_0x503705;_0x33568d[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x9a')][_0x1ffb('0x3a')]);_0x33568d[_0x1ffb('0x3c')]=_['keys'](_0x3dcd21['query']);_0x33568d['filters']=_[_0x1ffb('0x3f')](_0x33568d[_0x1ffb('0x3b')],_0x33568d[_0x1ffb('0x3c')]);_0xecb02c[_0x1ffb('0x40')]=_[_0x1ffb('0x3f')](_0x33568d[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x3dcd21[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0xecb02c['attributes']=_0xecb02c[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0xecb02c[_0x1ffb('0x40')]:_0x33568d[_0x1ffb('0x3b')];_0xecb02c[_0x1ffb('0x45')]=qs[_0x1ffb('0x46')](_0x3dcd21['query'][_0x1ffb('0x46')]);_0xecb02c[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x3dcd21[_0x1ffb('0x3c')],_0x33568d[_0x1ffb('0x3e')]));if(_0x3dcd21[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0xecb02c[_0x1ffb('0x47')]=_[_0x1ffb('0x48')](_0xecb02c['where'],{'$or':_['map'](_0xecb02c['attributes'],function(_0x34c37e){var _0x3d8ee7={};_0x3d8ee7[_0x34c37e]={'$like':'%'+_0x3dcd21[_0x1ffb('0x3c')][_0x1ffb('0x2c')]+'%'};return _0x3d8ee7;})});}_0xecb02c=_[_0x1ffb('0x48')]({},_0xecb02c,_0x3dcd21[_0x1ffb('0x4a')]);return _0x46cff9[_0x1ffb('0x99')](_0xecb02c);}})[_0x1ffb('0x26')](function(_0x4443ae){if(_0x4443ae){_0x304bac=_0x4443ae['length'];if(!_0x3dcd21[_0x1ffb('0x3c')][_0x1ffb('0x43')](_0x1ffb('0x44'))){_0xecb02c[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x3dcd21[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0xecb02c['offset']=qs['offset'](_0x3dcd21['query']['offset']);}return _0x46cff9[_0x1ffb('0x99')](_0xecb02c);}})[_0x1ffb('0x26')](function(_0x3cb866){if(_0x3cb866){return _0x3cb866?{'count':_0x304bac,'rows':_0x3cb866}:null;}})[_0x1ffb('0x26')](respondWithResult(_0x1b98f4,null))[_0x1ffb('0x4d')](handleError(_0x1b98f4,null));};exports[_0x1ffb('0x9b')]=function(_0x44ee8a,_0x4975bb,_0x263950){var _0x2374f6=moment()[_0x1ffb('0x7a')](_0x1ffb('0x9c'));var _0x43845e,_0x287308;return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x44ee8a['params']['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x4975bb,null))[_0x1ffb('0x26')](function(_0x3fd91f){if(_0x3fd91f){_0x287308=_0x3fd91f;return _0x3fd91f[_0x1ffb('0x9b')](_0x44ee8a['body'][_0x1ffb('0x90')],_[_0x1ffb('0x58')](_0x44ee8a[_0x1ffb('0x5b')],[_0x1ffb('0x90'),'id'])||{});}return null;})[_0x1ffb('0x94')](function(_0x46066a){var _0x19cd31;_0x43845e=_0x46066a||[];var _0x5d983c=[];if(_0x46066a){for(var _0xc353c8=0x0;_0xc353c8<_0x46066a[_0x1ffb('0x42')];_0xc353c8+=0x1){var _0x2a4236=_0x46066a[_0xc353c8][_0x1ffb('0x28')]({'plain':!![]});_0x287308[_0x1ffb('0x9d')]=_0x44ee8a[_0x1ffb('0x5b')][_0x1ffb('0x9d')]?_0x44ee8a[_0x1ffb('0x5b')][_0x1ffb('0x9d')]:_0x287308[_0x1ffb('0x9d')];switch(_0x287308[_0x1ffb('0x9d')]){case'always':_0x19cd31=squel[_0x1ffb('0x9e')]()[_0x1ffb('0x9f')](_0x1ffb('0xa0'))[_0x1ffb('0xa1')]([_0x1ffb('0xa2'),'scheduledAt','ContactId',_0x1ffb('0xa3'),_0x1ffb('0x62'),_0x1ffb('0x59'),'updatedAt'],squel[_0x1ffb('0x81')]()[_0x1ffb('0x82')](_0x1ffb('0xa2'),_0x1ffb('0xa2'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0xa4'))[_0x1ffb('0x82')]('id',_0x1ffb('0xa5'))[_0x1ffb('0x82')](_0x2a4236['CmListId']['toString'](),_0x1ffb('0xa3'))[_0x1ffb('0x82')](_0x44ee8a[_0x1ffb('0x4e')]['id'][_0x1ffb('0x8a')](),_0x1ffb('0x62'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x59'))['field']('\x27'+_0x2374f6+'\x27',_0x1ffb('0x5a'))['from'](_0x1ffb('0xa6'))[_0x1ffb('0x47')](_0x1ffb('0xa7'))[_0x1ffb('0x47')](_0x1ffb('0xa8'),_0x2a4236[_0x1ffb('0xa9')][_0x1ffb('0x8a')]())[_0x1ffb('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0x1ffb('0x47')](_0x1ffb('0xaa'),squel[_0x1ffb('0x81')]()[_0x1ffb('0x82')](_0x1ffb('0xab'))[_0x1ffb('0x83')]('cm_hopper_final')[_0x1ffb('0x47')](_0x1ffb('0x87'),_0x44ee8a['params']['id']['toString']()))[_0x1ffb('0x47')](_0x1ffb('0xaa'),squel[_0x1ffb('0x81')]()['field']('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x1ffb('0x47')](_0x1ffb('0x87'),_0x44ee8a['params']['id'][_0x1ffb('0x8a')]())))[_0x1ffb('0x8a')]();break;case _0x1ffb('0xac'):_0x19cd31=squel[_0x1ffb('0x9e')]()[_0x1ffb('0x9f')](_0x1ffb('0xa0'))[_0x1ffb('0xa1')]([_0x1ffb('0xa2'),_0x1ffb('0xa4'),'ContactId','ListId',_0x1ffb('0x62'),_0x1ffb('0x59'),_0x1ffb('0x5a')],squel[_0x1ffb('0x81')]()['field'](_0x1ffb('0xa2'),'phone')['field']('\x27'+_0x2374f6+'\x27',_0x1ffb('0xa4'))[_0x1ffb('0x82')]('id',_0x1ffb('0xa5'))[_0x1ffb('0x82')](_0x2a4236[_0x1ffb('0xa9')]['toString'](),_0x1ffb('0xa3'))['field'](_0x44ee8a[_0x1ffb('0x4e')]['id']['toString'](),'VoiceQueueId')[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x59'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x5a'))[_0x1ffb('0x83')](_0x1ffb('0xa6'))[_0x1ffb('0x47')]('deletedAt\x20IS\x20NULL')[_0x1ffb('0x47')](_0x1ffb('0xa8'),_0x2a4236[_0x1ffb('0xa9')][_0x1ffb('0x8a')]())[_0x1ffb('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x1ffb('0xaa'),squel['select']()[_0x1ffb('0x82')](_0x1ffb('0xad'))['from'](_0x1ffb('0xa0'))[_0x1ffb('0x47')]('VoiceQueueId\x20=\x20?',_0x44ee8a[_0x1ffb('0x4e')]['id'][_0x1ffb('0x8a')]())))[_0x1ffb('0x8a')]();break;default:_0x19cd31=squel[_0x1ffb('0x9e')]()[_0x1ffb('0x9f')]('cm_hopper')[_0x1ffb('0xa1')](['phone',_0x1ffb('0xa4'),_0x1ffb('0xa5'),'ListId','VoiceQueueId',_0x1ffb('0x59'),_0x1ffb('0x5a')],squel[_0x1ffb('0x81')]()['field']('phone','phone')[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27','scheduledAt')[_0x1ffb('0x82')]('id',_0x1ffb('0xa5'))[_0x1ffb('0x82')](_0x2a4236['CmListId'][_0x1ffb('0x8a')](),'ListId')['field'](_0x44ee8a[_0x1ffb('0x4e')]['id'][_0x1ffb('0x8a')](),'VoiceQueueId')[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x59'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x5a'))[_0x1ffb('0x83')](_0x1ffb('0xa6'))[_0x1ffb('0x47')](_0x1ffb('0xa7'))[_0x1ffb('0x47')]('ListId\x20=\x20?',_0x2a4236[_0x1ffb('0xa9')][_0x1ffb('0x8a')]())['where'](_0x1ffb('0xae')))[_0x1ffb('0x8a')]();}_0x5d983c[_0x1ffb('0x95')](db[_0x1ffb('0x71')][_0x1ffb('0x3c')](_0x19cd31));}return BPromise[_0x1ffb('0x8e')](_0x5d983c);}})[_0x1ffb('0x26')](function(){var _0x1fc17c=[];var _0xbd9d9d=squel[_0x1ffb('0x9e')]()[_0x1ffb('0x9f')](_0x1ffb('0xaf'))[_0x1ffb('0xa1')]([_0x1ffb('0xb0'),_0x1ffb('0xa2'),_0x1ffb('0xb1'),_0x1ffb('0x59'),_0x1ffb('0x5a')],squel['select']()[_0x1ffb('0x82')](_0x1ffb('0xb2'))[_0x1ffb('0x82')]('ci.item')[_0x1ffb('0x82')](_0x1ffb('0xb3'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x59'))[_0x1ffb('0x82')]('\x27'+_0x2374f6+'\x27',_0x1ffb('0x5a'))[_0x1ffb('0x83')]('cm_contact_has_items','ci')[_0x1ffb('0x84')]('cm_hopper','h',_0x1ffb('0xb4'))[_0x1ffb('0x47')](_0x1ffb('0xb5'),_0x2374f6)[_0x1ffb('0x47')](_0x1ffb('0xb6'),_0x1ffb('0xb7')))[_0x1ffb('0x8a')]();_0x1fc17c[_0x1ffb('0x95')](db['sequelize'][_0x1ffb('0x3c')](_0xbd9d9d));return BPromise['all'](_0x1fc17c);})[_0x1ffb('0x26')](function(){return _0x43845e;})[_0x1ffb('0x26')](respondWithResult(_0x4975bb,null))['catch'](handleError(_0x4975bb,null));};exports[_0x1ffb('0xb8')]=function(_0x5d8c55,_0x238b32,_0x1fc1a5){return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x5d8c55[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x238b32,null))[_0x1ffb('0x26')](function(_0x79bc03){if(_0x79bc03){return _0x79bc03[_0x1ffb('0xb8')](_0x5d8c55[_0x1ffb('0x3c')][_0x1ffb('0x90')]);}})['then'](function(_0x2bd06b){if(_0x2bd06b){return db[_0x1ffb('0x5d')]['destroy']({'where':{'ListId':_0x5d8c55[_0x1ffb('0x3c')][_0x1ffb('0x90')],'VoiceQueueId':_0x5d8c55['params']['id']}})[_0x1ffb('0x26')](function(){return _0x2bd06b;});}})[_0x1ffb('0x26')](respondWithStatusCode(_0x238b32,null))[_0x1ffb('0x4d')](handleError(_0x238b32,null));};exports[_0x1ffb('0xb9')]=function(_0x44a4ef,_0x2e9b45,_0x233339){var _0x59a641={};var _0x2396d7={};var _0x5855c2;var _0x2fb4e8;return db[_0x1ffb('0x39')][_0x1ffb('0x66')]({'where':{'id':_0x44a4ef[_0x1ffb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2e9b45,null))['then'](function(_0xe32381){if(_0xe32381){_0x5855c2=_0xe32381;_0x2396d7[_0x1ffb('0x3b')]=_[_0x1ffb('0x3d')](db[_0x1ffb('0x9a')][_0x1ffb('0x3a')]);_0x2396d7[_0x1ffb('0x3c')]=_[_0x1ffb('0x3d')](_0x44a4ef[_0x1ffb('0x3c')]);_0x2396d7[_0x1ffb('0x3e')]=_[_0x1ffb('0x3f')](_0x2396d7[_0x1ffb('0x3b')],_0x2396d7['query']);_0x59a641[_0x1ffb('0x40')]=_['intersection'](_0x2396d7[_0x1ffb('0x3b')],qs[_0x1ffb('0x41')](_0x44a4ef[_0x1ffb('0x3c')][_0x1ffb('0x41')]));_0x59a641[_0x1ffb('0x40')]=_0x59a641[_0x1ffb('0x40')][_0x1ffb('0x42')]?_0x59a641[_0x1ffb('0x40')]:_0x2396d7[_0x1ffb('0x3b')];_0x59a641['order']=qs[_0x1ffb('0x46')](_0x44a4ef['query'][_0x1ffb('0x46')]);_0x59a641[_0x1ffb('0x47')]=qs[_0x1ffb('0x3e')](_[_0x1ffb('0x61')](_0x44a4ef[_0x1ffb('0x3c')],_0x2396d7['filters']));if(_0x44a4ef[_0x1ffb('0x3c')][_0x1ffb('0x2c')]){_0x59a641[_0x1ffb('0x47')]=_['merge'](_0x59a641[_0x1ffb('0x47')],{'$or':_[_0x1ffb('0x2e')](_0x59a641[_0x1ffb('0x40')],function(_0x362e7f){var _0x59c8fa={};_0x59c8fa[_0x362e7f]={'$like':'%'+_0x44a4ef['query'][_0x1ffb('0x2c')]+'%'};return _0x59c8fa;})});}_0x59a641=_[_0x1ffb('0x48')]({},_0x59a641,_0x44a4ef['options']);return _0x5855c2['getBlackLists'](_0x59a641);}})['then'](function(_0x203fc1){if(_0x203fc1){_0x2fb4e8=_0x203fc1['length'];if(!_0x44a4ef['query']['hasOwnProperty'](_0x1ffb('0x44'))){_0x59a641[_0x1ffb('0x22')]=qs[_0x1ffb('0x22')](_0x44a4ef[_0x1ffb('0x3c')][_0x1ffb('0x22')]);_0x59a641[_0x1ffb('0x20')]=qs['offset'](_0x44a4ef['query'][_0x1ffb('0x20')]);}return _0x5855c2[_0x1ffb('0xb9')](_0x59a641);}})[_0x1ffb('0x26')](function(_0x586ff7){if(_0x586ff7){return _0x586ff7?{'count':_0x2fb4e8,'rows':_0x586ff7}:null;}})['then'](respondWithResult(_0x2e9b45,null))['catch'](handleError(_0x2e9b45,null));};exports[_0x1ffb('0xba')]=function(_0x48bced,_0x31d558,_0x124c0b){var _0x2174d1,_0x2f3bf5;return db['VoiceQueue'][_0x1ffb('0x32')]({'where':{'id':_0x48bced[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x31d558,null))['then'](function(_0x28b3f5){if(_0x28b3f5){_0x2f3bf5=_0x28b3f5;return _0x28b3f5['addBlackLists'](_0x48bced[_0x1ffb('0x5b')][_0x1ffb('0x90')],_[_0x1ffb('0x58')](_0x48bced[_0x1ffb('0x5b')],[_0x1ffb('0x90'),'id'])||{});}return null;})[_0x1ffb('0x94')](function(_0x1aadfe){var _0x18cd01;_0x2174d1=_0x1aadfe||[];var _0x15bc1f=[];if(_0x1aadfe){for(var _0x2ff243=0x0;_0x2ff243<_0x1aadfe[_0x1ffb('0x42')];_0x2ff243+=0x1){var _0x4dc4a4=_0x1aadfe[_0x2ff243][_0x1ffb('0x28')]({'plain':!![]});_0x18cd01=squel['insert']()[_0x1ffb('0x9f')](_0x1ffb('0xbb'))['fromQuery']([_0x1ffb('0xa2'),_0x1ffb('0xa5'),_0x1ffb('0xa3'),_0x1ffb('0x62'),_0x1ffb('0x59'),_0x1ffb('0x5a')],squel[_0x1ffb('0x81')]()[_0x1ffb('0x82')](_0x1ffb('0xa2'),_0x1ffb('0xa2'))[_0x1ffb('0x82')]('id',_0x1ffb('0xa5'))[_0x1ffb('0x82')](_0x4dc4a4['CmListId'][_0x1ffb('0x8a')](),_0x1ffb('0xa3'))[_0x1ffb('0x82')](_0x48bced[_0x1ffb('0x4e')]['id'][_0x1ffb('0x8a')](),'VoiceQueueId')[_0x1ffb('0x82')]('NOW()','createdAt')[_0x1ffb('0x82')](_0x1ffb('0xbc'),_0x1ffb('0x5a'))['from']('cm_contacts')['where'](_0x1ffb('0xa7'))[_0x1ffb('0x47')](_0x1ffb('0xa8'),_0x4dc4a4[_0x1ffb('0xa9')][_0x1ffb('0x8a')]())[_0x1ffb('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x1ffb('0x8a')]();_0x15bc1f['push'](db[_0x1ffb('0x71')]['query'](_0x18cd01));}return BPromise[_0x1ffb('0x8e')](_0x15bc1f);}})[_0x1ffb('0x26')](function(){return _0x2174d1;})[_0x1ffb('0x26')](respondWithResult(_0x31d558,null))[_0x1ffb('0x4d')](handleError(_0x31d558,null));};exports[_0x1ffb('0xbd')]=function(_0x4c2919,_0x3e0837,_0x208dff){return db[_0x1ffb('0x39')][_0x1ffb('0x32')]({'where':{'id':_0x4c2919[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](handleEntityNotFound(_0x3e0837,null))[_0x1ffb('0x26')](function(_0x58ec51){if(_0x58ec51){return _0x58ec51[_0x1ffb('0xbd')](_0x4c2919[_0x1ffb('0x3c')][_0x1ffb('0x90')]);}})['then'](function(_0x49aaf7){if(_0x49aaf7){return db['CmHopperBlack'][_0x1ffb('0x27')]({'where':{'ListId':_0x4c2919['query']['ids'],'VoiceQueueId':_0x4c2919[_0x1ffb('0x4e')]['id']}})[_0x1ffb('0x26')](function(){return _0x49aaf7;});}})[_0x1ffb('0x26')](respondWithStatusCode(_0x3e0837,null))[_0x1ffb('0x4d')](handleError(_0x3e0837,null));}; \ No newline at end of file +var _0xed20=['cm_contacts','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','includes','type','find','value','stack','name','index','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','update','destroy','CmHopper','length','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','online','voicePause','flatMap','Agents','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','interface','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','addAgents','spread','format','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into'];(function(_0x164f07,_0x49f8f5){var _0x38ff6e=function(_0x17fb5d){while(--_0x17fb5d){_0x164f07['push'](_0x164f07['shift']());}};_0x38ff6e(++_0x49f8f5);}(_0xed20,0xce));var _0x0ed2=function(_0x41887c,_0x4d258f){_0x41887c=_0x41887c-0x0;var _0x32e434=_0xed20[_0x41887c];return _0x32e434;};'use strict';var emlformat=require(_0x0ed2('0x0'));var rimraf=require(_0x0ed2('0x1'));var zipdir=require(_0x0ed2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ed2('0x3'));var moment=require(_0x0ed2('0x4'));var BPromise=require(_0x0ed2('0x5'));var Mustache=require(_0x0ed2('0x6'));var util=require(_0x0ed2('0x7'));var path=require(_0x0ed2('0x8'));var sox=require('sox');var csv=require(_0x0ed2('0x9'));var ejs=require(_0x0ed2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed2('0xb'));var squel=require(_0x0ed2('0xc'));var crypto=require(_0x0ed2('0xd'));var jsforce=require(_0x0ed2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ed2('0x9'));var querystring=require(_0x0ed2('0xf'));var Papa=require(_0x0ed2('0x10'));var Redis=require(_0x0ed2('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ed2('0x12'));var hardwareService=require(_0x0ed2('0x13'));var logger=require(_0x0ed2('0x14'))(_0x0ed2('0x15'));var utils=require(_0x0ed2('0x16'));var config=require(_0x0ed2('0x17'));var licenseUtil=require(_0x0ed2('0x18'));var db=require(_0x0ed2('0x19'))['db'];config[_0x0ed2('0x1a')]=_[_0x0ed2('0x1b')](config[_0x0ed2('0x1a')],{'host':_0x0ed2('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0ed2('0x1a')]));require(_0x0ed2('0x1d'))[_0x0ed2('0x1e')](socket);function respondWithStatusCode(_0x11b884,_0xcbed53){_0xcbed53=_0xcbed53||0xcc;return function(_0x4be1ad){if(_0x4be1ad){return _0x11b884[_0x0ed2('0x1f')](_0xcbed53);}return _0x11b884[_0x0ed2('0x20')](_0xcbed53)[_0x0ed2('0x21')]();};}function respondWithResult(_0x5101f2,_0x41bea7){_0x41bea7=_0x41bea7||0xc8;return function(_0x565cc7){if(_0x565cc7){return _0x5101f2[_0x0ed2('0x20')](_0x41bea7)[_0x0ed2('0x22')](_0x565cc7);}};}function respondWithFilteredResult(_0xc0f621,_0x4c2726){return function(_0x50c142){if(_0x50c142){var _0x90b88e=typeof _0x4c2726[_0x0ed2('0x23')]==='undefined'&&typeof _0x4c2726[_0x0ed2('0x24')]==='undefined';var _0x25e4dc=_0x50c142[_0x0ed2('0x25')];var _0x4d5c76=_0x90b88e?0x0:_0x4c2726['offset'];var _0x585ac1=_0x90b88e?_0x50c142[_0x0ed2('0x25')]:_0x4c2726[_0x0ed2('0x23')]+_0x4c2726[_0x0ed2('0x24')];var _0x1206e3;if(_0x585ac1>=_0x25e4dc){_0x585ac1=_0x25e4dc;_0x1206e3=0xc8;}else{_0x1206e3=0xce;}_0xc0f621[_0x0ed2('0x20')](_0x1206e3);return _0xc0f621[_0x0ed2('0x26')](_0x0ed2('0x27'),_0x4d5c76+'-'+_0x585ac1+'/'+_0x25e4dc)['json'](_0x50c142);}return null;};}function patchUpdates(_0x4c1dbd){return function(_0x41f251){try{jsonpatch[_0x0ed2('0x28')](_0x41f251,_0x4c1dbd,!![]);}catch(_0x7a3157){return BPromise[_0x0ed2('0x29')](_0x7a3157);}return _0x41f251[_0x0ed2('0x2a')]();};}function saveUpdates(_0x306f97,_0x311261){return function(_0x1d742c){if(_0x1d742c){return _0x1d742c['update'](_0x306f97)[_0x0ed2('0x2b')](function(_0x24983e){return _0x24983e;});}return null;};}function removeEntity(_0x1abc6f,_0x19ffde){return function(_0x466b49){if(_0x466b49){return _0x466b49['destroy']()[_0x0ed2('0x2b')](function(){var _0x23b304=_0x466b49[_0x0ed2('0x2c')]({'plain':!![]});var _0x182471=[{'name':_0x0ed2('0x2d'),'value':_0x0ed2('0x2e'),'ignore':![]},{'name':_0x0ed2('0x2f'),'value':_0x0ed2('0x30'),'ignore':![]}];var _0x1e62a8=_(_0x182471)[_0x0ed2('0x31')]('ignore')[_0x0ed2('0x32')]('value')['value']();if(_[_0x0ed2('0x33')](_0x1e62a8,_0x23b304[_0x0ed2('0x34')])){return;}var _0x11add7=_[_0x0ed2('0x35')](_0x182471,[_0x0ed2('0x36'),_0x23b304[_0x0ed2('0x34')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x11add7,'resourceId':_0x23b304['id']}})[_0x0ed2('0x2b')](function(){return _0x466b49;});})[_0x0ed2('0x2b')](function(){_0x1abc6f[_0x0ed2('0x20')](0xcc)[_0x0ed2('0x21')]();});}};}function handleEntityNotFound(_0x53b81b,_0x2685f1){return function(_0x4f8edc){if(!_0x4f8edc){_0x53b81b[_0x0ed2('0x1f')](0x194);}return _0x4f8edc;};}function handleError(_0x793700,_0x576510){_0x576510=_0x576510||0x1f4;return function(_0x1fdfb2){logger['error'](_0x1fdfb2[_0x0ed2('0x37')]);if(_0x1fdfb2[_0x0ed2('0x38')]){delete _0x1fdfb2[_0x0ed2('0x38')];}_0x793700[_0x0ed2('0x20')](_0x576510)['send'](_0x1fdfb2);};}exports[_0x0ed2('0x39')]=function(_0x67087a,_0x4f942a){var _0x360205={},_0x375dcb={},_0x4bcfec={'count':0x0,'rows':[]};var _0x3eb860=_[_0x0ed2('0x32')](db[_0x0ed2('0x3a')][_0x0ed2('0x3b')],function(_0x3f79ca){return{'name':_0x3f79ca[_0x0ed2('0x3c')],'type':_0x3f79ca[_0x0ed2('0x34')][_0x0ed2('0x3d')]};});_0x375dcb[_0x0ed2('0x3e')]=_['map'](_0x3eb860,'name');_0x375dcb[_0x0ed2('0x3f')]=_['keys'](_0x67087a[_0x0ed2('0x3f')]);_0x375dcb[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x375dcb[_0x0ed2('0x3e')],_0x375dcb[_0x0ed2('0x3f')]);_0x360205['attributes']=_[_0x0ed2('0x41')](_0x375dcb[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x67087a[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x360205[_0x0ed2('0x43')]=_0x360205[_0x0ed2('0x43')]['length']?_0x360205['attributes']:_0x375dcb['model'];if(!_0x67087a[_0x0ed2('0x3f')][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0x360205['limit']=qs[_0x0ed2('0x24')](_0x67087a['query'][_0x0ed2('0x24')]);_0x360205[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x67087a[_0x0ed2('0x3f')][_0x0ed2('0x23')]);}_0x360205[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x67087a['query']['sort']);_0x360205[_0x0ed2('0x48')]=qs['filters'](_[_0x0ed2('0x49')](_0x67087a[_0x0ed2('0x3f')],_0x375dcb['filters']),_0x3eb860);if(_0x67087a[_0x0ed2('0x3f')][_0x0ed2('0x31')]){_0x360205['where']=_[_0x0ed2('0x4a')](_0x360205[_0x0ed2('0x48')],{'$or':_['map'](_0x3eb860,function(_0x605a5e){if(_0x605a5e['type']!==_0x0ed2('0x4b')){var _0x10f570={};_0x10f570[_0x605a5e[_0x0ed2('0x38')]]={'$like':'%'+_0x67087a['query']['filter']+'%'};return _0x10f570;}})});}_0x360205=_[_0x0ed2('0x4a')]({},_0x360205,_0x67087a[_0x0ed2('0x4c')]);var _0x3353de={'where':_0x360205[_0x0ed2('0x48')]};return db['VoiceQueue']['count'](_0x3353de)[_0x0ed2('0x2b')](function(_0x5e68dc){_0x4bcfec[_0x0ed2('0x25')]=_0x5e68dc;if(_0x67087a[_0x0ed2('0x3f')][_0x0ed2('0x4d')]){_0x360205[_0x0ed2('0x4e')]=[{'all':!![]}];}return db[_0x0ed2('0x3a')]['findAll'](_0x360205);})[_0x0ed2('0x2b')](function(_0xbc4f){_0x4bcfec['rows']=_0xbc4f;return _0x4bcfec;})[_0x0ed2('0x2b')](respondWithFilteredResult(_0x4f942a,_0x360205))['catch'](handleError(_0x4f942a,null));};exports['show']=function(_0x9416c7,_0x4374a9){var _0x1512ee={'raw':![],'where':{'id':_0x9416c7[_0x0ed2('0x4f')]['id']}},_0x27fb48={};_0x27fb48['model']=_['keys'](db[_0x0ed2('0x3a')][_0x0ed2('0x3b')]);_0x27fb48[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x9416c7[_0x0ed2('0x3f')]);_0x27fb48[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x27fb48[_0x0ed2('0x3e')],_0x27fb48[_0x0ed2('0x3f')]);_0x1512ee[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x27fb48[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x9416c7[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x1512ee[_0x0ed2('0x43')]=_0x1512ee[_0x0ed2('0x43')]['length']?_0x1512ee[_0x0ed2('0x43')]:_0x27fb48[_0x0ed2('0x3e')];if(_0x9416c7[_0x0ed2('0x3f')]['includeAll']){_0x1512ee[_0x0ed2('0x4e')]=[{'all':!![]}];}_0x1512ee=_['merge']({},_0x1512ee,_0x9416c7[_0x0ed2('0x4c')]);return db['VoiceQueue'][_0x0ed2('0x35')](_0x1512ee)[_0x0ed2('0x2b')](handleEntityNotFound(_0x4374a9,null))[_0x0ed2('0x2b')](respondWithResult(_0x4374a9,null))[_0x0ed2('0x51')](handleError(_0x4374a9,null));};exports['create']=function(_0x4c39ba,_0x3a8f20){return db['VoiceQueue'][_0x0ed2('0x52')](_0x4c39ba[_0x0ed2('0x53')],{})[_0x0ed2('0x2b')](function(_0x5eebfa){var _0x3bb879=_0x4c39ba['user'][_0x0ed2('0x2c')]({'plain':!![]});if(!_0x3bb879)throw new Error(_0x0ed2('0x54'));if(_0x3bb879[_0x0ed2('0x55')]===_0x0ed2('0x56')){var _0x219944=_0x5eebfa[_0x0ed2('0x2c')]({'plain':!![]});var _0x382dbd=[{'name':_0x0ed2('0x2d'),'value':'inbound'},{'name':_0x0ed2('0x2f'),'value':_0x0ed2('0x30')}];var _0x679da4=_[_0x0ed2('0x35')](_0x382dbd,[_0x0ed2('0x36'),_0x219944[_0x0ed2('0x34')]])[_0x0ed2('0x38')];return db[_0x0ed2('0x57')][_0x0ed2('0x35')]({'where':{'name':_0x679da4,'userProfileId':_0x3bb879[_0x0ed2('0x58')]},'raw':!![]})['then'](function(_0x14fc05){if(_0x14fc05&&_0x14fc05[_0x0ed2('0x59')]===0x0){return db[_0x0ed2('0x5a')][_0x0ed2('0x52')]({'name':_0x219944[_0x0ed2('0x38')],'resourceId':_0x219944['id'],'type':_0x14fc05[_0x0ed2('0x38')],'sectionId':_0x14fc05['id']},{})[_0x0ed2('0x2b')](function(){return _0x5eebfa;});}else{return _0x5eebfa;}})[_0x0ed2('0x51')](function(_0x3804cd){logger[_0x0ed2('0x5b')](_0x0ed2('0x5c'),_0x3804cd);throw _0x3804cd;});}return _0x5eebfa;})['then'](respondWithResult(_0x3a8f20,0xc9))[_0x0ed2('0x51')](handleError(_0x3a8f20,null));};exports['clone']=function(_0x59c5cc,_0x171907){var _0x4a96a3={'where':{'id':_0x59c5cc[_0x0ed2('0x4f')]['id']}},_0x29ba9a={};_0x29ba9a['model']=_[_0x0ed2('0x50')](db['VoiceQueue'][_0x0ed2('0x3b')]);_0x4a96a3[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x29ba9a[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x59c5cc[_0x0ed2('0x3f')]['fields']));_0x4a96a3[_0x0ed2('0x43')]=_0x4a96a3[_0x0ed2('0x43')]['length']?_0x4a96a3[_0x0ed2('0x43')]:_0x29ba9a[_0x0ed2('0x3e')];if(_0x59c5cc[_0x0ed2('0x3f')][_0x0ed2('0x4d')]){_0x4a96a3['include']=[{'all':!![]}];}_0x4a96a3=_[_0x0ed2('0x4a')]({},_0x4a96a3,_0x59c5cc['options']);return db[_0x0ed2('0x3a')]['find'](_0x4a96a3)[_0x0ed2('0x2b')](handleEntityNotFound(_0x171907,null))[_0x0ed2('0x2b')](function(_0x5c28c7){if(_0x5c28c7){var _0x12bed7=_0x5c28c7[_0x0ed2('0x2c')]({'plain':!![]});_0x12bed7=qs[_0x0ed2('0x5d')](_0x12bed7,['id',_0x0ed2('0x5e'),_0x0ed2('0x5f')]);_0x59c5cc[_0x0ed2('0x53')]=_[_0x0ed2('0x5d')](_0x59c5cc[_0x0ed2('0x53')],['id',_0x0ed2('0x5e'),_0x0ed2('0x5f')]);return db[_0x0ed2('0x3a')]['create'](_['merge'](_0x12bed7,_0x59c5cc['body']),{'include':_0x59c5cc[_0x0ed2('0x3f')][_0x0ed2('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x1f0699){var _0x1a404f=_0x59c5cc[_0x0ed2('0x56')][_0x0ed2('0x2c')]({'plain':!![]});if(!_0x1a404f)throw new Error(_0x0ed2('0x54'));if(_0x1a404f['role']==='user'){var _0x1749a0=_0x1f0699[_0x0ed2('0x2c')]({'plain':!![]});var _0x48fa75=[{'name':_0x0ed2('0x2d'),'value':'inbound'},{'name':_0x0ed2('0x2f'),'value':_0x0ed2('0x30')}];var _0x19639a=_[_0x0ed2('0x35')](_0x48fa75,['value',_0x1749a0[_0x0ed2('0x34')]])[_0x0ed2('0x38')];return db[_0x0ed2('0x57')]['find']({'where':{'name':_0x19639a,'userProfileId':_0x1a404f['userProfileId']},'raw':!![]})[_0x0ed2('0x2b')](function(_0x3f1ab8){if(_0x3f1ab8&&_0x3f1ab8[_0x0ed2('0x59')]===0x0){return db[_0x0ed2('0x5a')][_0x0ed2('0x52')]({'name':_0x1749a0['name'],'resourceId':_0x1749a0['id'],'type':_0x3f1ab8[_0x0ed2('0x38')],'sectionId':_0x3f1ab8['id']},{})['then'](function(){return _0x1f0699;});}else{return _0x1f0699;}})[_0x0ed2('0x51')](function(_0x185f86){logger[_0x0ed2('0x5b')](_0x0ed2('0x5c'),_0x185f86);throw _0x185f86;});}return _0x1f0699;});}})[_0x0ed2('0x2b')](respondWithResult(_0x171907,0xc9))['catch'](handleError(_0x171907,null));};exports[_0x0ed2('0x60')]=function(_0x2aa7fc,_0x44d8c0){if(_0x2aa7fc[_0x0ed2('0x53')]['id']){delete _0x2aa7fc['body']['id'];}return db['VoiceQueue'][_0x0ed2('0x35')]({'where':{'id':_0x2aa7fc[_0x0ed2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x44d8c0,null))['then'](saveUpdates(_0x2aa7fc['body'],null))['then'](respondWithResult(_0x44d8c0,null))[_0x0ed2('0x51')](handleError(_0x44d8c0,null));};exports[_0x0ed2('0x61')]=function(_0x16765c,_0x6c2966){return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x16765c[_0x0ed2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x6c2966,null))[_0x0ed2('0x2b')](removeEntity(_0x6c2966,null))['catch'](handleError(_0x6c2966,null));};exports['getHoppers']=function(_0x7e5eae,_0x42e723,_0x496405){var _0x40e526={'raw':![],'where':{}};var _0x164096={};var _0xbed8e={'count':0x0,'rows':[]};return db[_0x0ed2('0x3a')]['findOne']({'where':{'id':_0x7e5eae[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x42e723,null))[_0x0ed2('0x2b')](function(_0x3aeb9b){if(_0x3aeb9b){_0x164096[_0x0ed2('0x3e')]=_[_0x0ed2('0x50')](db[_0x0ed2('0x62')][_0x0ed2('0x3b')]);_0x164096[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x7e5eae[_0x0ed2('0x3f')]);_0x164096[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x164096['model'],_0x164096[_0x0ed2('0x3f')]);_0x40e526[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x164096[_0x0ed2('0x3e')],qs['fields'](_0x7e5eae[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x40e526[_0x0ed2('0x43')]=_0x40e526[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x40e526[_0x0ed2('0x43')]:_0x164096['model'];if(!_0x7e5eae[_0x0ed2('0x3f')]['hasOwnProperty']('nolimit')){_0x40e526[_0x0ed2('0x24')]=qs[_0x0ed2('0x24')](_0x7e5eae[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0x40e526[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x7e5eae['query'][_0x0ed2('0x23')]);}_0x40e526['order']=qs['sort'](_0x7e5eae['query']['sort']);_0x40e526[_0x0ed2('0x48')]=qs[_0x0ed2('0x40')](_[_0x0ed2('0x49')](_0x7e5eae['query'],_0x164096[_0x0ed2('0x40')]));_0x40e526['where'][_0x0ed2('0x64')]=_0x3aeb9b['id'];if(_0x7e5eae[_0x0ed2('0x3f')]['filter']){_0x40e526[_0x0ed2('0x48')]=_[_0x0ed2('0x4a')](_0x40e526[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x40e526[_0x0ed2('0x43')],function(_0x2d6fc4){var _0x4cd219={};_0x4cd219[_0x2d6fc4]={'$like':'%'+_0x7e5eae['query']['filter']+'%'};return _0x4cd219;})});}_0x40e526=_[_0x0ed2('0x4a')]({},_0x40e526,_0x7e5eae[_0x0ed2('0x4c')]);return db[_0x0ed2('0x62')][_0x0ed2('0x25')]({'where':_0x40e526[_0x0ed2('0x48')]})[_0x0ed2('0x2b')](function(_0x2e35e5){_0xbed8e[_0x0ed2('0x25')]=_0x2e35e5;if(_0x7e5eae[_0x0ed2('0x3f')]['includeAll']){_0x40e526[_0x0ed2('0x4e')]=[{'all':!![]}];}return db[_0x0ed2('0x62')][_0x0ed2('0x65')](_0x40e526);})[_0x0ed2('0x2b')](function(_0x34de3c){_0xbed8e[_0x0ed2('0x66')]=_0x34de3c;return _0xbed8e;});}})[_0x0ed2('0x2b')](respondWithFilteredResult(_0x42e723,_0x40e526))[_0x0ed2('0x51')](handleError(_0x42e723,null));};exports[_0x0ed2('0x67')]=function(_0x4faa4c,_0x45b5f9,_0x13d7f9){var _0xb5329e={'raw':!![],'where':{}};var _0x58fbd={};var _0x3356f8={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0ed2('0x68')]({'where':{'id':_0x4faa4c[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x45b5f9,null))[_0x0ed2('0x2b')](function(_0x1e7a5d){if(_0x1e7a5d){_0x58fbd[_0x0ed2('0x3e')]=_[_0x0ed2('0x50')](db[_0x0ed2('0x69')]['rawAttributes']);_0x58fbd[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x4faa4c['query']);_0x58fbd[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x58fbd['model'],_0x58fbd[_0x0ed2('0x3f')]);_0xb5329e['attributes']=_[_0x0ed2('0x41')](_0x58fbd[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0xb5329e[_0x0ed2('0x43')]=_0xb5329e[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0xb5329e[_0x0ed2('0x43')]:_0x58fbd[_0x0ed2('0x3e')];if(!_0x4faa4c['query'][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0xb5329e[_0x0ed2('0x24')]=qs[_0x0ed2('0x24')](_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0xb5329e[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x23')]);}_0xb5329e[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0xb5329e['where']=qs['filters'](_[_0x0ed2('0x49')](_0x4faa4c[_0x0ed2('0x3f')],_0x58fbd[_0x0ed2('0x40')]));_0xb5329e[_0x0ed2('0x48')][_0x0ed2('0x64')]=_0x1e7a5d['id'];if(_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x31')]){_0xb5329e[_0x0ed2('0x48')]=_[_0x0ed2('0x4a')](_0xb5329e['where'],{'$or':_['map'](_0xb5329e[_0x0ed2('0x43')],function(_0x498d38){var _0x252cb6={};_0x252cb6[_0x498d38]={'$like':'%'+_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x31')]+'%'};return _0x252cb6;})});}_0xb5329e=_[_0x0ed2('0x4a')]({},_0xb5329e,_0x4faa4c[_0x0ed2('0x4c')]);return db[_0x0ed2('0x69')][_0x0ed2('0x25')]({'where':_0xb5329e['where']})['then'](function(_0xbf99b7){_0x3356f8['count']=_0xbf99b7;if(_0x4faa4c[_0x0ed2('0x3f')][_0x0ed2('0x4d')]){_0xb5329e['include']=[{'all':!![]}];}return db[_0x0ed2('0x69')]['findAll'](_0xb5329e);})[_0x0ed2('0x2b')](function(_0x1d8ac6){_0x3356f8[_0x0ed2('0x66')]=_0x1d8ac6;return _0x3356f8;});}})[_0x0ed2('0x2b')](respondWithFilteredResult(_0x45b5f9,_0xb5329e))[_0x0ed2('0x51')](handleError(_0x45b5f9,null));};exports[_0x0ed2('0x6a')]=function(_0x5dd981,_0x4c85ce,_0x2d52fd){var _0x432f28={'raw':!![],'where':{}};var _0x58b79b={};var _0x331e18={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0ed2('0x68')]({'where':{'id':_0x5dd981[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x4c85ce,null))[_0x0ed2('0x2b')](function(_0x137643){if(_0x137643){_0x58b79b['model']=_[_0x0ed2('0x50')](db[_0x0ed2('0x6b')][_0x0ed2('0x3b')]);_0x58b79b[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x5dd981[_0x0ed2('0x3f')]);_0x58b79b[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x58b79b[_0x0ed2('0x3e')],_0x58b79b[_0x0ed2('0x3f')]);_0x432f28[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x58b79b[_0x0ed2('0x3e')],qs['fields'](_0x5dd981[_0x0ed2('0x3f')]['fields']));_0x432f28['attributes']=_0x432f28[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x432f28[_0x0ed2('0x43')]:_0x58b79b['model'];if(!_0x5dd981[_0x0ed2('0x3f')]['hasOwnProperty'](_0x0ed2('0x45'))){_0x432f28[_0x0ed2('0x24')]=qs['limit'](_0x5dd981['query']['limit']);_0x432f28[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x5dd981[_0x0ed2('0x3f')]['offset']);}_0x432f28[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x5dd981[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x432f28[_0x0ed2('0x48')]=qs[_0x0ed2('0x40')](_['pick'](_0x5dd981[_0x0ed2('0x3f')],_0x58b79b['filters']));_0x432f28[_0x0ed2('0x48')][_0x0ed2('0x64')]=_0x137643['id'];if(_0x5dd981[_0x0ed2('0x3f')][_0x0ed2('0x31')]){_0x432f28['where']=_[_0x0ed2('0x4a')](_0x432f28[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x432f28[_0x0ed2('0x43')],function(_0x57f843){var _0x5183c6={};_0x5183c6[_0x57f843]={'$like':'%'+_0x5dd981[_0x0ed2('0x3f')]['filter']+'%'};return _0x5183c6;})});}_0x432f28=_[_0x0ed2('0x4a')]({},_0x432f28,_0x5dd981['options']);return db['CmHopperFinal'][_0x0ed2('0x25')]({'where':_0x432f28[_0x0ed2('0x48')]})[_0x0ed2('0x2b')](function(_0x53bbd6){_0x331e18[_0x0ed2('0x25')]=_0x53bbd6;if(_0x5dd981[_0x0ed2('0x3f')]['includeAll']){_0x432f28[_0x0ed2('0x4e')]=[{'all':!![]}];}return db[_0x0ed2('0x6b')][_0x0ed2('0x65')](_0x432f28);})['then'](function(_0x452655){_0x331e18['rows']=_0x452655;return _0x331e18;});}})[_0x0ed2('0x2b')](respondWithFilteredResult(_0x4c85ce,_0x432f28))[_0x0ed2('0x51')](handleError(_0x4c85ce,null));};exports[_0x0ed2('0x6c')]=function(_0x3c8651,_0x26b8a0,_0x8fb7b9){var _0x4efbf8={'raw':!![],'where':{}};var _0x17fc4b={};var _0x136af0={'count':0x0,'rows':[]};return db[_0x0ed2('0x3a')]['findOne']({'where':{'id':_0x3c8651[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x26b8a0,null))['then'](function(_0x3354dc){if(_0x3354dc){_0x17fc4b[_0x0ed2('0x3e')]=_['keys'](db[_0x0ed2('0x6d')]['rawAttributes']);_0x17fc4b[_0x0ed2('0x3f')]=_['keys'](_0x3c8651[_0x0ed2('0x3f')]);_0x17fc4b[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x17fc4b['model'],_0x17fc4b[_0x0ed2('0x3f')]);_0x4efbf8['attributes']=_[_0x0ed2('0x41')](_0x17fc4b['model'],qs['fields'](_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x4efbf8[_0x0ed2('0x43')]=_0x4efbf8[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x4efbf8[_0x0ed2('0x43')]:_0x17fc4b[_0x0ed2('0x3e')];if(!_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0x4efbf8[_0x0ed2('0x24')]=qs['limit'](_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0x4efbf8['offset']=qs[_0x0ed2('0x23')](_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x23')]);}_0x4efbf8[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x4efbf8[_0x0ed2('0x48')]=qs['filters'](_[_0x0ed2('0x49')](_0x3c8651[_0x0ed2('0x3f')],_0x17fc4b[_0x0ed2('0x40')]));_0x4efbf8[_0x0ed2('0x48')]['VoiceQueueId']=_0x3354dc['id'];if(_0x3c8651['query'][_0x0ed2('0x31')]){_0x4efbf8[_0x0ed2('0x48')]=_[_0x0ed2('0x4a')](_0x4efbf8[_0x0ed2('0x48')],{'$or':_['map'](_0x4efbf8[_0x0ed2('0x43')],function(_0x50e9b3){var _0x3fb705={};_0x3fb705[_0x50e9b3]={'$like':'%'+_0x3c8651[_0x0ed2('0x3f')]['filter']+'%'};return _0x3fb705;})});}_0x4efbf8=_[_0x0ed2('0x4a')]({},_0x4efbf8,_0x3c8651[_0x0ed2('0x4c')]);return db[_0x0ed2('0x6d')][_0x0ed2('0x25')]({'where':_0x4efbf8[_0x0ed2('0x48')]})[_0x0ed2('0x2b')](function(_0x27d289){_0x136af0[_0x0ed2('0x25')]=_0x27d289;if(_0x3c8651[_0x0ed2('0x3f')][_0x0ed2('0x4d')]){_0x4efbf8[_0x0ed2('0x4e')]=[{'all':!![]}];}return db[_0x0ed2('0x6d')]['findAll'](_0x4efbf8);})[_0x0ed2('0x2b')](function(_0x1b500f){_0x136af0[_0x0ed2('0x66')]=_0x1b500f;return _0x136af0;});}})[_0x0ed2('0x2b')](respondWithFilteredResult(_0x26b8a0,_0x4efbf8))['catch'](handleError(_0x26b8a0,null));};exports[_0x0ed2('0x6e')]=function(_0x216859,_0x3e9047,_0x5b1433){var _0x26ce1d={};var _0x355c5c={};var _0xd9a727;var _0xf215d7;return db[_0x0ed2('0x3a')][_0x0ed2('0x68')]({'where':{'id':_0x216859[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x3e9047,null))[_0x0ed2('0x2b')](function(_0x200494){if(_0x200494){_0xd9a727=_0x200494;_0x355c5c[_0x0ed2('0x3e')]=_['keys'](db[_0x0ed2('0x6f')][_0x0ed2('0x3b')]);_0x355c5c[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x216859[_0x0ed2('0x3f')]);_0x355c5c[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x355c5c[_0x0ed2('0x3e')],_0x355c5c[_0x0ed2('0x3f')]);_0x26ce1d[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x355c5c[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x216859[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x26ce1d[_0x0ed2('0x43')]=_0x26ce1d[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x26ce1d[_0x0ed2('0x43')]:_0x355c5c['model'];_0x26ce1d[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x216859[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x26ce1d[_0x0ed2('0x48')]=qs[_0x0ed2('0x40')](_[_0x0ed2('0x49')](_0x216859['query'],_0x355c5c[_0x0ed2('0x40')]));if(_0x216859[_0x0ed2('0x3f')][_0x0ed2('0x31')]){_0x26ce1d['where']=_['merge'](_0x26ce1d[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x26ce1d[_0x0ed2('0x43')],function(_0x3df58f){var _0x3460d5={};_0x3460d5[_0x3df58f]={'$like':'%'+_0x216859[_0x0ed2('0x3f')][_0x0ed2('0x31')]+'%'};return _0x3460d5;})});}_0x26ce1d=_[_0x0ed2('0x4a')]({},_0x26ce1d,_0x216859[_0x0ed2('0x4c')]);return _0xd9a727[_0x0ed2('0x6e')](_0x26ce1d);}})['then'](function(_0x2bdbbf){if(_0x2bdbbf){_0xf215d7=_0x2bdbbf[_0x0ed2('0x63')];if(!_0x216859[_0x0ed2('0x3f')][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0x26ce1d[_0x0ed2('0x24')]=qs['limit'](_0x216859[_0x0ed2('0x3f')]['limit']);_0x26ce1d['offset']=qs[_0x0ed2('0x23')](_0x216859[_0x0ed2('0x3f')]['offset']);}return _0xd9a727[_0x0ed2('0x6e')](_0x26ce1d);}})['then'](function(_0x553c92){if(_0x553c92){return _0x553c92?{'count':_0xf215d7,'rows':_0x553c92}:null;}})[_0x0ed2('0x2b')](respondWithResult(_0x3e9047,null))[_0x0ed2('0x51')](handleError(_0x3e9047,null));};exports[_0x0ed2('0x70')]=function(_0x1a5309,_0x165b64,_0x10562b){var _0x38735f=_0x1a5309[_0x0ed2('0x53')][_0x0ed2('0x71')];var _0x36adec=_[_0x0ed2('0x32')](_0x38735f,'id');return db['Team']['findAll']({'where':{'id':_0x36adec},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0ed2('0x38'),_0x0ed2('0x72'),_0x0ed2('0x73'),'interface'],'raw':!![]}]})[_0x0ed2('0x2b')](function(_0x22d4ec){if(_0x22d4ec){var _0x368095=_[_0x0ed2('0x74')](_0x22d4ec,function(_0x9e75b2){var _0x112bf1=_0x9e75b2[_0x0ed2('0x2c')]({'plain':!![]});_0x112bf1[_0x0ed2('0x75')][_0x0ed2('0x76')](function(_0x3ba5ac){_0x3ba5ac[_0x0ed2('0x77')]=_[_0x0ed2('0x35')](_0x38735f,{'id':_0x112bf1['id']})[_0x0ed2('0x77')];});return _0x112bf1[_0x0ed2('0x75')];});return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x1a5309[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](function(_0x16ac1e){return db[_0x0ed2('0x78')][_0x0ed2('0x79')](function(_0x2f084d){return _0x16ac1e[_0x0ed2('0x70')](_0x36adec,{'transaction':_0x2f084d})['then'](function(){return BPromise[_0x0ed2('0x7a')](_0x38735f,function(_0x218b68){return db[_0x0ed2('0x7b')][_0x0ed2('0x7c')]({'TeamId':_0x218b68['id'],'VoiceQueueId':_0x1a5309[_0x0ed2('0x4f')]['id'],'penalty':_0x218b68[_0x0ed2('0x77')]},{'transaction':_0x2f084d});});})[_0x0ed2('0x2b')](function(){return BPromise[_0x0ed2('0x7a')](_0x368095,function(_0x293649){return db[_0x0ed2('0x7d')][_0x0ed2('0x7e')]({'where':{'UserId':_0x293649['id'],'VoiceQueueId':_0x1a5309['params']['id']},'defaults':{'penalty':_0x293649[_0x0ed2('0x77')]},'transaction':_0x2f084d});});})['then'](function(){return BPromise[_0x0ed2('0x7a')](_[_0x0ed2('0x31')](_0x368095,{'online':!![]}),function(_0x14d29d){return db[_0x0ed2('0x7f')][_0x0ed2('0x7c')]({'membername':_0x14d29d[_0x0ed2('0x38')],'UserId':_0x14d29d['id'],'queue_name':_0x16ac1e[_0x0ed2('0x38')],'VoiceQueueId':_0x16ac1e['id'],'interface':_['isNil'](_0x14d29d[_0x0ed2('0x80')])?util['format'](_0x0ed2('0x81'),_0x14d29d[_0x0ed2('0x38')]):_0x14d29d[_0x0ed2('0x80')],'paused':_0x14d29d[_0x0ed2('0x73')]||![],'penalty':_0x14d29d[_0x0ed2('0x77')]},{'transaction':_0x2f084d});});})[_0x0ed2('0x2b')](function(){_0x368095[_0x0ed2('0x76')](function(_0x3fa637){socket[_0x0ed2('0x82')](_0x0ed2('0x83'),{'UserId':_0x3fa637['id'],'VoiceQueueId':_0x16ac1e['id']});});});});});}})[_0x0ed2('0x2b')](respondWithStatusCode(_0x165b64,null))[_0x0ed2('0x51')](handleError(_0x165b64,null));};exports[_0x0ed2('0x84')]=function(_0x4a9c71,_0x2b3ee0,_0xfe5f83){return db[_0x0ed2('0x6f')][_0x0ed2('0x65')]({'where':{'id':_0x4a9c71[_0x0ed2('0x3f')][_0x0ed2('0x85')]},'attributes':['id'],'include':[{'model':db[_0x0ed2('0x86')],'as':_0x0ed2('0x75'),'attributes':['id'],'raw':!![]}]})[_0x0ed2('0x2b')](handleEntityNotFound(_0x2b3ee0,null))[_0x0ed2('0x2b')](function(_0x47e5b7){var _0x490e9e=_['map'](_0x47e5b7,'id');var _0x2ffc94=[];var _0x389795=[];var _0x36b7f7=squel['select']();_0x36b7f7[_0x0ed2('0x87')](_0x0ed2('0x88'))[_0x0ed2('0x89')]('team_has_voice_queues','tq')[_0x0ed2('0x8a')](_0x0ed2('0x8b'),'ut',_0x0ed2('0x8c'))[_0x0ed2('0x48')](_0x0ed2('0x8d'),_0x4a9c71['params']['id']);for(var _0x481d7a=0x0;_0x481d7a<_0x47e5b7[_0x0ed2('0x63')];_0x481d7a+=0x1){let _0x448318=_0x47e5b7[_0x481d7a];for(var _0xc40688=0x0;_0xc40688<_0x448318[_0x0ed2('0x75')][_0x0ed2('0x63')];_0xc40688+=0x1){let _0x337298=_0x448318[_0x0ed2('0x75')][_0xc40688];var _0x24d52c=_0x36b7f7[_0x0ed2('0x8e')]();_0x24d52c['where'](_0x0ed2('0x8f'),_0x337298['id']);_0x389795[_0x0ed2('0x90')](db['sequelize']['query'](_0x24d52c[_0x0ed2('0x91')](),{'type':db[_0x0ed2('0x78')]['QueryTypes'][_0x0ed2('0x92')]})['then'](function(_0x5dd4ab){if(_0x5dd4ab[_0x0ed2('0x63')]===0x1){return _0x337298['id'];}else{var _0x353826=_[_0x0ed2('0x93')](_['map'](_0x5dd4ab,_0x0ed2('0x94')),function(_0x1967c3){return _[_0x0ed2('0x33')](_0x490e9e,_0x1967c3);});if(_0x353826){return _0x337298['id'];}}}));}}return BPromise[_0x0ed2('0x95')](_0x389795)[_0x0ed2('0x2b')](function(_0x535d83){_0x2ffc94=_(_0x2ffc94)['union'](_0x535d83)[_0x0ed2('0x96')]()[_0x0ed2('0x36')]();return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x4a9c71[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](function(_0x31940f){return db[_0x0ed2('0x78')][_0x0ed2('0x79')](function(_0x4024de){return _0x31940f[_0x0ed2('0x84')](_0x4a9c71[_0x0ed2('0x3f')]['ids'],{'transaction':_0x4024de})['then'](function(){if(!_[_0x0ed2('0x97')](_0x2ffc94)){return _0x31940f[_0x0ed2('0x98')](_0x2ffc94,{'transaction':_0x4024de})[_0x0ed2('0x2b')](function(){return db['UserVoiceQueueRt'][_0x0ed2('0x61')]({'where':{'VoiceQueueId':_0x4a9c71[_0x0ed2('0x4f')]['id'],'UserId':_0x2ffc94},'transaction':_0x4024de});});}})[_0x0ed2('0x2b')](function(){_0x2ffc94[_0x0ed2('0x76')](function(_0x32a7ce){socket[_0x0ed2('0x82')]('userVoiceQueue:remove',{'UserId':_0x32a7ce,'VoiceQueueId':_0x31940f['id']});});});});});});})[_0x0ed2('0x2b')](respondWithStatusCode(_0x2b3ee0,null))[_0x0ed2('0x51')](handleError(_0x2b3ee0,null));};exports[_0x0ed2('0x99')]=function(_0x1264f4,_0x35673a,_0x54b162){var _0x53b268,_0xf46c32;return db['VoiceQueue'][_0x0ed2('0x35')]({'where':{'id':_0x1264f4['params']['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x35673a,null))[_0x0ed2('0x2b')](function(_0xc96ef3){if(_0xc96ef3){_0xf46c32=_0xc96ef3;return _0xc96ef3[_0x0ed2('0x99')](_0x1264f4[_0x0ed2('0x53')][_0x0ed2('0x85')],_[_0x0ed2('0x5d')](_0x1264f4[_0x0ed2('0x53')],[_0x0ed2('0x85'),'id'])||{})[_0x0ed2('0x9a')](function(_0x57e470){for(var _0x2f993c=0x0;_0x2f993c<_0x1264f4[_0x0ed2('0x53')]['ids'][_0x0ed2('0x63')];_0x2f993c+=0x1){socket[_0x0ed2('0x82')]('userVoiceQueue:save',{'UserId':Number(_0x1264f4['body']['ids'][_0x2f993c]),'VoiceQueueId':Number(_0x1264f4[_0x0ed2('0x4f')]['id'])});}return _0x57e470;});}})[_0x0ed2('0x2b')](function(_0x20e468){_0x53b268=_0x20e468||[];if(_0xf46c32){return db[_0x0ed2('0x86')]['findAll']({'where':{'id':_0x1264f4['body'][_0x0ed2('0x85')]},'attributes':['id',_0x0ed2('0x38'),_0x0ed2('0x72'),_0x0ed2('0x73'),_0x0ed2('0x80')],'raw':!![]});}})[_0x0ed2('0x2b')](function(_0x2fc414){if(!_['isEmpty'](_0x2fc414)){var _0x58f36d=[];for(var _0x60265e=0x0;_0x60265e<_0x2fc414[_0x0ed2('0x63')];_0x60265e++){if(_0x2fc414[_0x60265e][_0x0ed2('0x72')]){_0x58f36d[_0x0ed2('0x90')](db[_0x0ed2('0x7f')]['upsert']({'membername':_0x2fc414[_0x60265e][_0x0ed2('0x38')],'UserId':_0x2fc414[_0x60265e]['id'],'queue_name':_0xf46c32[_0x0ed2('0x38')],'VoiceQueueId':_0xf46c32['id'],'interface':_['isNil'](_0x2fc414[_0x60265e][_0x0ed2('0x80')])?util[_0x0ed2('0x9b')](_0x0ed2('0x81'),_0x2fc414[_0x60265e][_0x0ed2('0x38')]):_0x2fc414[_0x60265e][_0x0ed2('0x80')],'paused':_0x2fc414[_0x60265e][_0x0ed2('0x73')]||![],'penalty':_0x1264f4['body']['penalty']||0x0}));}}return BPromise[_0x0ed2('0x95')](_0x58f36d);}})[_0x0ed2('0x2b')](function(){return _0x53b268;})['then'](respondWithResult(_0x35673a,null))[_0x0ed2('0x51')](handleError(_0x35673a,null));};exports['removeAgents']=function(_0x5015b0,_0x1309a0,_0x219a54){return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x5015b0[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x1309a0,null))[_0x0ed2('0x2b')](function(_0x39c64b){if(_0x39c64b){return _0x39c64b[_0x0ed2('0x98')](_0x5015b0[_0x0ed2('0x3f')]['ids'])[_0x0ed2('0x2b')](function(){if(_[_0x0ed2('0x9c')](_0x5015b0[_0x0ed2('0x3f')][_0x0ed2('0x85')])){for(var _0xf5cfe=0x0;_0xf5cfe<_0x5015b0[_0x0ed2('0x3f')]['ids'][_0x0ed2('0x63')];_0xf5cfe+=0x1){socket['emit'](_0x0ed2('0x9d'),{'UserId':Number(_0x5015b0[_0x0ed2('0x3f')][_0x0ed2('0x85')][_0xf5cfe]),'VoiceQueueId':Number(_0x5015b0[_0x0ed2('0x4f')]['id'])});}}else{socket[_0x0ed2('0x82')](_0x0ed2('0x9d'),{'UserId':Number(_0x5015b0[_0x0ed2('0x3f')][_0x0ed2('0x85')]),'VoiceQueueId':Number(_0x5015b0[_0x0ed2('0x4f')]['id'])});}});}})[_0x0ed2('0x2b')](function(_0x242d3e){return db['UserVoiceQueueRt'][_0x0ed2('0x61')]({'where':{'VoiceQueueId':_0x5015b0['params']['id'],'UserId':_0x5015b0[_0x0ed2('0x3f')]['ids']}})['then'](function(){return _0x242d3e;});})[_0x0ed2('0x2b')](respondWithStatusCode(_0x1309a0,null))[_0x0ed2('0x51')](handleError(_0x1309a0,null));};exports[_0x0ed2('0x9e')]=function(_0x5c3c24,_0x52b8a3,_0x5b7fa6){var _0x138a22={};var _0x465132={};var _0x5911de;var _0x1ef6e6;return db[_0x0ed2('0x3a')][_0x0ed2('0x68')]({'where':{'id':_0x5c3c24[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x52b8a3,null))[_0x0ed2('0x2b')](function(_0x245759){if(_0x245759){_0x5911de=_0x245759;_0x465132[_0x0ed2('0x3e')]=_[_0x0ed2('0x50')](db[_0x0ed2('0x86')][_0x0ed2('0x3b')]);_0x465132[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x5c3c24['query']);_0x465132[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x465132[_0x0ed2('0x3e')],_0x465132['query']);_0x138a22[_0x0ed2('0x43')]=_['intersection'](_0x465132['model'],qs['fields'](_0x5c3c24[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x138a22[_0x0ed2('0x43')]=_0x138a22[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x138a22[_0x0ed2('0x43')]:_0x465132[_0x0ed2('0x3e')];_0x138a22['order']=qs['sort'](_0x5c3c24[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x138a22['where']=qs[_0x0ed2('0x40')](_[_0x0ed2('0x49')](_0x5c3c24[_0x0ed2('0x3f')],_0x465132[_0x0ed2('0x40')]));if(_0x5c3c24['query'][_0x0ed2('0x31')]){_0x138a22[_0x0ed2('0x48')]=_[_0x0ed2('0x4a')](_0x138a22[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x138a22[_0x0ed2('0x43')],function(_0x194b3d){var _0x4d72f8={};_0x4d72f8[_0x194b3d]={'$like':'%'+_0x5c3c24['query'][_0x0ed2('0x31')]+'%'};return _0x4d72f8;})});}_0x138a22=_[_0x0ed2('0x4a')]({},_0x138a22,_0x5c3c24[_0x0ed2('0x4c')]);return _0x5911de[_0x0ed2('0x9e')](_0x138a22);}})[_0x0ed2('0x2b')](function(_0x191090){if(_0x191090){_0x1ef6e6=_0x191090[_0x0ed2('0x63')];if(!_0x5c3c24[_0x0ed2('0x3f')][_0x0ed2('0x44')]('nolimit')){_0x138a22['limit']=qs[_0x0ed2('0x24')](_0x5c3c24['query'][_0x0ed2('0x24')]);_0x138a22[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x5c3c24[_0x0ed2('0x3f')][_0x0ed2('0x23')]);}return _0x5911de['getAgents'](_0x138a22);}})['then'](function(_0x1cda1d){if(_0x1cda1d){return _0x1cda1d?{'count':_0x1ef6e6,'rows':_0x1cda1d}:null;}})[_0x0ed2('0x2b')](respondWithResult(_0x52b8a3,null))[_0x0ed2('0x51')](handleError(_0x52b8a3,null));};exports['getMembers']=function(_0x56eff5,_0x4ec0c4,_0x397c1d){var _0x3e9dbf={};var _0x2194e9={};var _0x3076f6;var _0x39f5d1;return db[_0x0ed2('0x3a')][_0x0ed2('0x68')]({'where':{'id':_0x56eff5['params']['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x4ec0c4,null))[_0x0ed2('0x2b')](function(_0x483160){if(_0x483160){_0x3076f6=_0x483160;_0x2194e9[_0x0ed2('0x3e')]=_[_0x0ed2('0x50')](db[_0x0ed2('0x7f')][_0x0ed2('0x3b')]);_0x2194e9[_0x0ed2('0x3f')]=_[_0x0ed2('0x50')](_0x56eff5[_0x0ed2('0x3f')]);_0x2194e9[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x2194e9[_0x0ed2('0x3e')],_0x2194e9['query']);_0x3e9dbf[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x2194e9['model'],qs[_0x0ed2('0x42')](_0x56eff5[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x3e9dbf['attributes']=_0x3e9dbf[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x3e9dbf[_0x0ed2('0x43')]:_0x2194e9[_0x0ed2('0x3e')];_0x3e9dbf[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x56eff5[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x3e9dbf[_0x0ed2('0x48')]=qs[_0x0ed2('0x40')](_[_0x0ed2('0x49')](_0x56eff5['query'],_0x2194e9['filters']));if(_0x56eff5[_0x0ed2('0x3f')][_0x0ed2('0x31')]){_0x3e9dbf[_0x0ed2('0x48')]=_[_0x0ed2('0x4a')](_0x3e9dbf[_0x0ed2('0x48')],{'$or':_['map'](_0x3e9dbf[_0x0ed2('0x43')],function(_0x105b34){var _0x494d19={};_0x494d19[_0x105b34]={'$like':'%'+_0x56eff5[_0x0ed2('0x3f')]['filter']+'%'};return _0x494d19;})});}_0x3e9dbf=_[_0x0ed2('0x4a')]({},_0x3e9dbf,_0x56eff5[_0x0ed2('0x4c')]);return _0x3076f6[_0x0ed2('0x9f')](_0x3e9dbf);}})[_0x0ed2('0x2b')](function(_0x461fa5){if(_0x461fa5){_0x39f5d1=_0x461fa5[_0x0ed2('0x63')];if(!_0x56eff5[_0x0ed2('0x3f')][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0x3e9dbf[_0x0ed2('0x24')]=qs[_0x0ed2('0x24')](_0x56eff5[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0x3e9dbf[_0x0ed2('0x23')]=qs['offset'](_0x56eff5['query'][_0x0ed2('0x23')]);}return _0x3076f6['getMembers'](_0x3e9dbf);}})['then'](function(_0x2ed673){return _0x2ed673?{'count':_0x39f5d1,'rows':_0x2ed673}:null;})[_0x0ed2('0x2b')](respondWithResult(_0x4ec0c4,null))[_0x0ed2('0x51')](handleError(_0x4ec0c4,null));};exports[_0x0ed2('0xa0')]=function(_0x37fcf3,_0x369fda,_0x4d957a){var _0x4a65f0={};var _0x501b8b={};var _0x3071ed;var _0x2a8aa1;return db[_0x0ed2('0x3a')][_0x0ed2('0x68')]({'where':{'id':_0x37fcf3['params']['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x369fda,null))[_0x0ed2('0x2b')](function(_0x1405be){if(_0x1405be){_0x3071ed=_0x1405be;_0x501b8b[_0x0ed2('0x3e')]=_[_0x0ed2('0x50')](db['CmList'][_0x0ed2('0x3b')]);_0x501b8b[_0x0ed2('0x3f')]=_['keys'](_0x37fcf3[_0x0ed2('0x3f')]);_0x501b8b[_0x0ed2('0x40')]=_[_0x0ed2('0x41')](_0x501b8b[_0x0ed2('0x3e')],_0x501b8b[_0x0ed2('0x3f')]);_0x4a65f0[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x501b8b[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x37fcf3[_0x0ed2('0x3f')][_0x0ed2('0x42')]));_0x4a65f0[_0x0ed2('0x43')]=_0x4a65f0[_0x0ed2('0x43')][_0x0ed2('0x63')]?_0x4a65f0[_0x0ed2('0x43')]:_0x501b8b['model'];_0x4a65f0[_0x0ed2('0x46')]=qs[_0x0ed2('0x47')](_0x37fcf3[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x4a65f0[_0x0ed2('0x48')]=qs[_0x0ed2('0x40')](_['pick'](_0x37fcf3['query'],_0x501b8b[_0x0ed2('0x40')]));if(_0x37fcf3[_0x0ed2('0x3f')]['filter']){_0x4a65f0[_0x0ed2('0x48')]=_['merge'](_0x4a65f0[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x4a65f0[_0x0ed2('0x43')],function(_0x5ed23b){var _0x57ef2c={};_0x57ef2c[_0x5ed23b]={'$like':'%'+_0x37fcf3[_0x0ed2('0x3f')][_0x0ed2('0x31')]+'%'};return _0x57ef2c;})});}_0x4a65f0=_[_0x0ed2('0x4a')]({},_0x4a65f0,_0x37fcf3[_0x0ed2('0x4c')]);return _0x3071ed[_0x0ed2('0xa0')](_0x4a65f0);}})[_0x0ed2('0x2b')](function(_0x4e1955){if(_0x4e1955){_0x2a8aa1=_0x4e1955[_0x0ed2('0x63')];if(!_0x37fcf3[_0x0ed2('0x3f')]['hasOwnProperty'](_0x0ed2('0x45'))){_0x4a65f0[_0x0ed2('0x24')]=qs[_0x0ed2('0x24')](_0x37fcf3[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0x4a65f0[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x37fcf3[_0x0ed2('0x3f')][_0x0ed2('0x23')]);}return _0x3071ed['getLists'](_0x4a65f0);}})['then'](function(_0x91066e){if(_0x91066e){return _0x91066e?{'count':_0x2a8aa1,'rows':_0x91066e}:null;}})['then'](respondWithResult(_0x369fda,null))[_0x0ed2('0x51')](handleError(_0x369fda,null));};exports[_0x0ed2('0xa1')]=function(_0x57d584,_0x4b8e9e,_0x5baae0){var _0x1902c0=moment()['format'](_0x0ed2('0xa2'));var _0x326782,_0x484a87;return db['VoiceQueue'][_0x0ed2('0x35')]({'where':{'id':_0x57d584[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x4b8e9e,null))[_0x0ed2('0x2b')](function(_0x1331f2){if(_0x1331f2){_0x484a87=_0x1331f2;return _0x1331f2[_0x0ed2('0xa1')](_0x57d584[_0x0ed2('0x53')][_0x0ed2('0x85')],_[_0x0ed2('0x5d')](_0x57d584[_0x0ed2('0x53')],['ids','id'])||{});}return null;})['spread'](function(_0x4bbd3a){var _0x32eb8b;_0x326782=_0x4bbd3a||[];var _0x19d704=[];if(_0x4bbd3a){for(var _0x5a1e08=0x0;_0x5a1e08<_0x4bbd3a[_0x0ed2('0x63')];_0x5a1e08+=0x1){var _0x1ef7a2=_0x4bbd3a[_0x5a1e08][_0x0ed2('0x2c')]({'plain':!![]});_0x484a87[_0x0ed2('0xa3')]=_0x57d584['body'][_0x0ed2('0xa3')]?_0x57d584[_0x0ed2('0x53')][_0x0ed2('0xa3')]:_0x484a87['dialCheckDuplicateType'];switch(_0x484a87[_0x0ed2('0xa3')]){case'always':_0x32eb8b=squel[_0x0ed2('0xa4')]()['into'](_0x0ed2('0xa5'))[_0x0ed2('0xa6')]([_0x0ed2('0xa7'),_0x0ed2('0xa8'),'ContactId',_0x0ed2('0xa9'),_0x0ed2('0x64'),_0x0ed2('0x5e'),_0x0ed2('0x5f')],squel[_0x0ed2('0xaa')]()[_0x0ed2('0x87')](_0x0ed2('0xa7'),_0x0ed2('0xa7'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0xa8'))[_0x0ed2('0x87')]('id',_0x0ed2('0xab'))[_0x0ed2('0x87')](_0x1ef7a2[_0x0ed2('0xac')]['toString'](),'ListId')[_0x0ed2('0x87')](_0x57d584[_0x0ed2('0x4f')]['id']['toString'](),'VoiceQueueId')[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5e'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5f'))[_0x0ed2('0x89')]('cm_contacts')[_0x0ed2('0x48')](_0x0ed2('0xad'))[_0x0ed2('0x48')](_0x0ed2('0xae'),_0x1ef7a2['CmListId'][_0x0ed2('0x91')]())[_0x0ed2('0x48')](_0x0ed2('0xaf'))[_0x0ed2('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0ed2('0x87')](_0x0ed2('0xb0'))[_0x0ed2('0x89')](_0x0ed2('0xb1'))['where'](_0x0ed2('0x8d'),_0x57d584[_0x0ed2('0x4f')]['id']['toString']()))[_0x0ed2('0x48')](_0x0ed2('0xb2'),squel[_0x0ed2('0xaa')]()['field'](_0x0ed2('0xb3'))[_0x0ed2('0x89')](_0x0ed2('0xa5'))['where'](_0x0ed2('0x8d'),_0x57d584[_0x0ed2('0x4f')]['id']['toString']())))[_0x0ed2('0x91')]();break;case _0x0ed2('0xb4'):_0x32eb8b=squel['insert']()[_0x0ed2('0xb5')](_0x0ed2('0xa5'))[_0x0ed2('0xa6')]([_0x0ed2('0xa7'),_0x0ed2('0xa8'),_0x0ed2('0xab'),_0x0ed2('0xa9'),'VoiceQueueId',_0x0ed2('0x5e'),_0x0ed2('0x5f')],squel['select']()['field'](_0x0ed2('0xa7'),'phone')[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0xa8'))[_0x0ed2('0x87')]('id',_0x0ed2('0xab'))[_0x0ed2('0x87')](_0x1ef7a2[_0x0ed2('0xac')][_0x0ed2('0x91')](),_0x0ed2('0xa9'))['field'](_0x57d584['params']['id']['toString'](),_0x0ed2('0x64'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5e'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5f'))[_0x0ed2('0x89')](_0x0ed2('0xb6'))[_0x0ed2('0x48')]('deletedAt\x20IS\x20NULL')[_0x0ed2('0x48')](_0x0ed2('0xae'),_0x1ef7a2[_0x0ed2('0xac')][_0x0ed2('0x91')]())[_0x0ed2('0x48')](_0x0ed2('0xaf'))[_0x0ed2('0x48')](_0x0ed2('0xb2'),squel['select']()[_0x0ed2('0x87')]('COALESCE(phone,\x27\x27)')[_0x0ed2('0x89')]('cm_hopper')[_0x0ed2('0x48')](_0x0ed2('0x8d'),_0x57d584[_0x0ed2('0x4f')]['id'][_0x0ed2('0x91')]())))[_0x0ed2('0x91')]();break;default:_0x32eb8b=squel[_0x0ed2('0xa4')]()[_0x0ed2('0xb5')](_0x0ed2('0xa5'))['fromQuery']([_0x0ed2('0xa7'),_0x0ed2('0xa8'),'ContactId',_0x0ed2('0xa9'),_0x0ed2('0x64'),_0x0ed2('0x5e'),'updatedAt'],squel[_0x0ed2('0xaa')]()[_0x0ed2('0x87')]('phone',_0x0ed2('0xa7'))['field']('\x27'+_0x1902c0+'\x27',_0x0ed2('0xa8'))[_0x0ed2('0x87')]('id',_0x0ed2('0xab'))[_0x0ed2('0x87')](_0x1ef7a2[_0x0ed2('0xac')][_0x0ed2('0x91')](),_0x0ed2('0xa9'))[_0x0ed2('0x87')](_0x57d584[_0x0ed2('0x4f')]['id'][_0x0ed2('0x91')](),_0x0ed2('0x64'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5e'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5f'))['from'](_0x0ed2('0xb6'))[_0x0ed2('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0x0ed2('0xae'),_0x1ef7a2[_0x0ed2('0xac')][_0x0ed2('0x91')]())[_0x0ed2('0x48')](_0x0ed2('0xaf')))[_0x0ed2('0x91')]();}_0x19d704[_0x0ed2('0x90')](db['sequelize'][_0x0ed2('0x3f')](_0x32eb8b));}return BPromise[_0x0ed2('0x95')](_0x19d704);}})['then'](function(){var _0x32719a=[];var _0x146f10=squel['insert']()['into'](_0x0ed2('0xb7'))[_0x0ed2('0xa6')]([_0x0ed2('0xb8'),_0x0ed2('0xa7'),'OrderBy',_0x0ed2('0x5e'),_0x0ed2('0x5f')],squel[_0x0ed2('0xaa')]()[_0x0ed2('0x87')](_0x0ed2('0xb9'))[_0x0ed2('0x87')](_0x0ed2('0xba'))[_0x0ed2('0x87')](_0x0ed2('0xbb'))[_0x0ed2('0x87')]('\x27'+_0x1902c0+'\x27',_0x0ed2('0x5e'))['field']('\x27'+_0x1902c0+'\x27','updatedAt')[_0x0ed2('0x89')]('cm_contact_has_items','ci')['join']('cm_hopper','h','h.ContactId=ci.CmContactId')[_0x0ed2('0x48')]('h.scheduledat=?',_0x1902c0)[_0x0ed2('0x48')](_0x0ed2('0xbc'),'PHONE'))[_0x0ed2('0x91')]();_0x32719a['push'](db['sequelize'][_0x0ed2('0x3f')](_0x146f10));return BPromise[_0x0ed2('0x95')](_0x32719a);})['then'](function(){return _0x326782;})['then'](respondWithResult(_0x4b8e9e,null))[_0x0ed2('0x51')](handleError(_0x4b8e9e,null));};exports[_0x0ed2('0xbd')]=function(_0x5f4450,_0x4524ac,_0x7bf203){return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x5f4450[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x4524ac,null))[_0x0ed2('0x2b')](function(_0x43ca51){if(_0x43ca51){return _0x43ca51[_0x0ed2('0xbd')](_0x5f4450[_0x0ed2('0x3f')][_0x0ed2('0x85')]);}})[_0x0ed2('0x2b')](function(_0x2187a1){if(_0x2187a1){return db[_0x0ed2('0x62')][_0x0ed2('0x61')]({'where':{'ListId':_0x5f4450[_0x0ed2('0x3f')][_0x0ed2('0x85')],'VoiceQueueId':_0x5f4450[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](function(){return _0x2187a1;});}})[_0x0ed2('0x2b')](respondWithStatusCode(_0x4524ac,null))['catch'](handleError(_0x4524ac,null));};exports[_0x0ed2('0xbe')]=function(_0x1f7362,_0x1d7191,_0x3b8ccc){var _0x190064={};var _0x3c0fac={};var _0xab39da;var _0x2d82c0;return db[_0x0ed2('0x3a')][_0x0ed2('0x68')]({'where':{'id':_0x1f7362[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x1d7191,null))[_0x0ed2('0x2b')](function(_0x11b1f4){if(_0x11b1f4){_0xab39da=_0x11b1f4;_0x3c0fac[_0x0ed2('0x3e')]=_['keys'](db['CmList'][_0x0ed2('0x3b')]);_0x3c0fac[_0x0ed2('0x3f')]=_['keys'](_0x1f7362[_0x0ed2('0x3f')]);_0x3c0fac[_0x0ed2('0x40')]=_['intersection'](_0x3c0fac[_0x0ed2('0x3e')],_0x3c0fac[_0x0ed2('0x3f')]);_0x190064[_0x0ed2('0x43')]=_[_0x0ed2('0x41')](_0x3c0fac[_0x0ed2('0x3e')],qs[_0x0ed2('0x42')](_0x1f7362['query'][_0x0ed2('0x42')]));_0x190064['attributes']=_0x190064['attributes']['length']?_0x190064['attributes']:_0x3c0fac[_0x0ed2('0x3e')];_0x190064[_0x0ed2('0x46')]=qs['sort'](_0x1f7362[_0x0ed2('0x3f')][_0x0ed2('0x47')]);_0x190064['where']=qs[_0x0ed2('0x40')](_[_0x0ed2('0x49')](_0x1f7362[_0x0ed2('0x3f')],_0x3c0fac[_0x0ed2('0x40')]));if(_0x1f7362[_0x0ed2('0x3f')]['filter']){_0x190064['where']=_[_0x0ed2('0x4a')](_0x190064[_0x0ed2('0x48')],{'$or':_[_0x0ed2('0x32')](_0x190064['attributes'],function(_0xe6d32e){var _0x5c9b52={};_0x5c9b52[_0xe6d32e]={'$like':'%'+_0x1f7362[_0x0ed2('0x3f')][_0x0ed2('0x31')]+'%'};return _0x5c9b52;})});}_0x190064=_[_0x0ed2('0x4a')]({},_0x190064,_0x1f7362['options']);return _0xab39da[_0x0ed2('0xbe')](_0x190064);}})[_0x0ed2('0x2b')](function(_0x518ddf){if(_0x518ddf){_0x2d82c0=_0x518ddf['length'];if(!_0x1f7362[_0x0ed2('0x3f')][_0x0ed2('0x44')](_0x0ed2('0x45'))){_0x190064[_0x0ed2('0x24')]=qs[_0x0ed2('0x24')](_0x1f7362[_0x0ed2('0x3f')][_0x0ed2('0x24')]);_0x190064[_0x0ed2('0x23')]=qs[_0x0ed2('0x23')](_0x1f7362[_0x0ed2('0x3f')]['offset']);}return _0xab39da['getBlackLists'](_0x190064);}})['then'](function(_0x43286d){if(_0x43286d){return _0x43286d?{'count':_0x2d82c0,'rows':_0x43286d}:null;}})[_0x0ed2('0x2b')](respondWithResult(_0x1d7191,null))[_0x0ed2('0x51')](handleError(_0x1d7191,null));};exports['addBlackLists']=function(_0xed2344,_0xafa35c,_0x104482){var _0x5a3d96,_0x3fc4ca;return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0xed2344[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0xafa35c,null))[_0x0ed2('0x2b')](function(_0x3f5f95){if(_0x3f5f95){_0x3fc4ca=_0x3f5f95;return _0x3f5f95[_0x0ed2('0xbf')](_0xed2344[_0x0ed2('0x53')][_0x0ed2('0x85')],_['omit'](_0xed2344[_0x0ed2('0x53')],[_0x0ed2('0x85'),'id'])||{});}return null;})[_0x0ed2('0x9a')](function(_0x42531d){var _0x40da4e;_0x5a3d96=_0x42531d||[];var _0x5532a7=[];if(_0x42531d){for(var _0x43e903=0x0;_0x43e903<_0x42531d[_0x0ed2('0x63')];_0x43e903+=0x1){var _0x4b02e5=_0x42531d[_0x43e903][_0x0ed2('0x2c')]({'plain':!![]});_0x40da4e=squel['insert']()[_0x0ed2('0xb5')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x0ed2('0xa9'),_0x0ed2('0x64'),_0x0ed2('0x5e'),'updatedAt'],squel[_0x0ed2('0xaa')]()[_0x0ed2('0x87')](_0x0ed2('0xa7'),_0x0ed2('0xa7'))[_0x0ed2('0x87')]('id',_0x0ed2('0xab'))[_0x0ed2('0x87')](_0x4b02e5[_0x0ed2('0xac')][_0x0ed2('0x91')](),_0x0ed2('0xa9'))['field'](_0xed2344['params']['id'][_0x0ed2('0x91')](),'VoiceQueueId')[_0x0ed2('0x87')]('NOW()',_0x0ed2('0x5e'))[_0x0ed2('0x87')](_0x0ed2('0xc0'),_0x0ed2('0x5f'))[_0x0ed2('0x89')](_0x0ed2('0xb6'))['where']('deletedAt\x20IS\x20NULL')[_0x0ed2('0x48')]('ListId\x20=\x20?',_0x4b02e5[_0x0ed2('0xac')][_0x0ed2('0x91')]())[_0x0ed2('0x48')](_0x0ed2('0xaf')))[_0x0ed2('0x91')]();_0x5532a7[_0x0ed2('0x90')](db['sequelize'][_0x0ed2('0x3f')](_0x40da4e));}return BPromise[_0x0ed2('0x95')](_0x5532a7);}})[_0x0ed2('0x2b')](function(){return _0x5a3d96;})['then'](respondWithResult(_0xafa35c,null))[_0x0ed2('0x51')](handleError(_0xafa35c,null));};exports[_0x0ed2('0xc1')]=function(_0x5edc68,_0x2e01ab,_0x2e8e1d){return db[_0x0ed2('0x3a')][_0x0ed2('0x35')]({'where':{'id':_0x5edc68[_0x0ed2('0x4f')]['id']}})[_0x0ed2('0x2b')](handleEntityNotFound(_0x2e01ab,null))['then'](function(_0x2b89e7){if(_0x2b89e7){return _0x2b89e7[_0x0ed2('0xc1')](_0x5edc68[_0x0ed2('0x3f')][_0x0ed2('0x85')]);}})['then'](function(_0x3bb50c){if(_0x3bb50c){return db[_0x0ed2('0x6d')][_0x0ed2('0x61')]({'where':{'ListId':_0x5edc68[_0x0ed2('0x3f')][_0x0ed2('0x85')],'VoiceQueueId':_0x5edc68['params']['id']}})['then'](function(){return _0x3bb50c;});}})[_0x0ed2('0x2b')](respondWithStatusCode(_0x2e01ab,null))[_0x0ed2('0x51')](handleError(_0x2e01ab,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b2bd4b4..346eca5 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 _0xe175=['exports','events','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe175,0x1e5));var _0x5e17=function(_0x3dbfa1,_0x47b59b){_0x3dbfa1=_0x3dbfa1-0x0;var _0x1cb91c=_0xe175[_0x3dbfa1];return _0x1cb91c;};'use strict';var EventEmitter=require(_0x5e17('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e17('0x1'),'afterDestroy':_0x5e17('0x2')};function emitEvent(_0x5b49ec){return function(_0x50e6e,_0x3c8e54,_0x2ca697){VoiceQueueEvents['emit'](_0x5b49ec+':'+_0x50e6e['id'],_0x50e6e);VoiceQueueEvents['emit'](_0x5b49ec,_0x50e6e);_0x2ca697(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x5e17('0x3')]=VoiceQueueEvents; \ No newline at end of file +var _0x09b1=['events','../../mysqldb','VoiceQueue','save','update','emit','hasOwnProperty','exports'];(function(_0x9ea933,_0x565d76){var _0x4fdcd0=function(_0x1b1b59){while(--_0x1b1b59){_0x9ea933['push'](_0x9ea933['shift']());}};_0x4fdcd0(++_0x565d76);}(_0x09b1,0x78));var _0x109b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x09b1[_0x45783c];return _0x1161da;};'use strict';var EventEmitter=require(_0x109b('0x0'));var VoiceQueue=require(_0x109b('0x1'))['db'][_0x109b('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x109b('0x3'),'afterUpdate':_0x109b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x22d7ea){return function(_0x39584f,_0x158952,_0x18d833){VoiceQueueEvents[_0x109b('0x5')](_0x22d7ea+':'+_0x39584f['id'],_0x39584f);VoiceQueueEvents[_0x109b('0x5')](_0x22d7ea,_0x39584f);_0x18d833(null);};}for(var e in events){if(events[_0x109b('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x109b('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8d0816e..dc9e9f8 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x135cb5,_0x28e972){var _0xf89c5a=function(_0x1407f1){while(--_0x1407f1){_0x135cb5['push'](_0x135cb5['shift']());}};_0xf89c5a(++_0x28e972);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x508fa6,_0x4eeac6){var _0x3fecf8=function(_0xd87e81){while(--_0xd87e81){_0x508fa6['push'](_0x508fa6['shift']());}};_0x3fecf8(++_0x4eeac6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index afa88b4..f0e38a0 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 _0xb007=['result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_0xb007,0xfa));var _0x7b00=function(_0x3b45c1,_0x5bc0d5){_0x3b45c1=_0x3b45c1-0x0;var _0x15c208=_0xb007[_0x3b45c1];return _0x15c208;};'use strict';var _=require(_0x7b00('0x0'));var util=require(_0x7b00('0x1'));var moment=require('moment');var BPromise=require(_0x7b00('0x2'));var rs=require(_0x7b00('0x3'));var fs=require('fs');var Redis=require(_0x7b00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b00('0x5'));var logger=require(_0x7b00('0x6'))(_0x7b00('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b00('0x8')][_0x7b00('0x9')]({'port':0x232a});config[_0x7b00('0xa')]=_[_0x7b00('0xb')](config[_0x7b00('0xa')],{'host':_0x7b00('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b00('0xa')]));require(_0x7b00('0xd'))['register'](socket);function respondWithRpcPromise(_0x196527,_0xf75abb,_0x12db34){return new BPromise(function(_0xcebd9c,_0x3f368a){return client[_0x7b00('0xe')](_0x196527,_0x12db34)[_0x7b00('0xf')](function(_0x47de6d){logger[_0x7b00('0x10')](_0x7b00('0x11'),_0xf75abb,_0x7b00('0x12'));logger[_0x7b00('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xf75abb,_0x7b00('0x12'),JSON['stringify'](_0x47de6d));if(_0x47de6d[_0x7b00('0x14')]){if(_0x47de6d[_0x7b00('0x14')][_0x7b00('0x15')]===0x1f4){logger[_0x7b00('0x14')](_0x7b00('0x11'),_0xf75abb,_0x47de6d['error'][_0x7b00('0x16')]);return _0x3f368a(_0x47de6d[_0x7b00('0x14')][_0x7b00('0x16')]);}logger['error'](_0x7b00('0x11'),_0xf75abb,_0x47de6d[_0x7b00('0x14')][_0x7b00('0x16')]);return _0xcebd9c(_0x47de6d[_0x7b00('0x14')][_0x7b00('0x16')]);}else{logger[_0x7b00('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xf75abb,_0x7b00('0x12'));_0xcebd9c(_0x47de6d[_0x7b00('0x17')][_0x7b00('0x16')]);}})[_0x7b00('0x18')](function(_0x6a7463){logger[_0x7b00('0x14')]('VoiceQueue,\x20%s,\x20%s',_0xf75abb,_0x6a7463);_0x3f368a(_0x6a7463);});});}exports['GetVoiceQueue']=function(_0x1ae226){var _0x1e3ea3=this;return new Promise(function(_0x50c587,_0x12fdbb){return db[_0x7b00('0x19')][_0x7b00('0x1a')]({'raw':_0x1ae226[_0x7b00('0x1b')]?_0x1ae226[_0x7b00('0x1b')][_0x7b00('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ae226[_0x7b00('0x1b')]?_0x1ae226[_0x7b00('0x1b')][_0x7b00('0x1d')]||null:null,'attributes':_0x1ae226[_0x7b00('0x1b')]?_0x1ae226[_0x7b00('0x1b')][_0x7b00('0x1e')]||null:null,'limit':_0x1ae226[_0x7b00('0x1b')]?_0x1ae226[_0x7b00('0x1b')][_0x7b00('0x1f')]||null:null,'include':_0x1ae226[_0x7b00('0x1b')]?_0x1ae226[_0x7b00('0x1b')][_0x7b00('0x20')]?_[_0x7b00('0x21')](_0x1ae226['options']['include'],function(_0x5105c2){return{'model':db[_0x5105c2[_0x7b00('0x22')]],'as':_0x5105c2['as'],'attributes':_0x5105c2[_0x7b00('0x1e')],'include':_0x5105c2[_0x7b00('0x20')]?_[_0x7b00('0x21')](_0x5105c2[_0x7b00('0x20')],function(_0x5401ab){return{'model':db[_0x5401ab['model']],'as':_0x5401ab['as'],'attributes':_0x5401ab['attributes'],'include':_0x5401ab[_0x7b00('0x20')]?_['map'](_0x5401ab['include'],function(_0xcb111f){return{'model':db[_0xcb111f[_0x7b00('0x22')]],'as':_0xcb111f['as'],'attributes':_0xcb111f[_0x7b00('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7b00('0xf')](function(_0xaad45b){logger[_0x7b00('0x10')](_0x7b00('0x23'),_0x1ae226);logger[_0x7b00('0x13')](_0x7b00('0x23'),_0x1ae226,JSON[_0x7b00('0x24')](_0xaad45b));_0x50c587(_0xaad45b);})[_0x7b00('0x18')](function(_0x25a2e4){logger[_0x7b00('0x14')](_0x7b00('0x23'),_0x25a2e4[_0x7b00('0x16')],_0x1ae226);_0x12fdbb(_0x1e3ea3[_0x7b00('0x14')](0x1f4,_0x25a2e4['message']));});});};exports[_0x7b00('0x25')]=function(_0x5757d6){var _0x42be24=this;return new Promise(function(_0x2752d9,_0x499d98){return db[_0x7b00('0x19')][_0x7b00('0x26')]({'raw':_0x5757d6[_0x7b00('0x1b')]?_0x5757d6[_0x7b00('0x1b')][_0x7b00('0x1c')]===undefined?!![]:![]:!![],'where':_0x5757d6[_0x7b00('0x1b')]?_0x5757d6[_0x7b00('0x1b')][_0x7b00('0x1d')]||null:null,'attributes':_0x5757d6[_0x7b00('0x1b')]?_0x5757d6[_0x7b00('0x1b')][_0x7b00('0x1e')]||null:null,'include':_0x5757d6[_0x7b00('0x1b')]?_0x5757d6[_0x7b00('0x1b')][_0x7b00('0x20')]?_['map'](_0x5757d6[_0x7b00('0x1b')][_0x7b00('0x20')],function(_0x5a5fe6){return{'model':db[_0x5a5fe6[_0x7b00('0x22')]],'as':_0x5a5fe6['as'],'attributes':_0x5a5fe6[_0x7b00('0x1e')],'include':_0x5a5fe6[_0x7b00('0x20')]?_[_0x7b00('0x21')](_0x5a5fe6[_0x7b00('0x20')],function(_0xd79494){return{'model':db[_0xd79494[_0x7b00('0x22')]],'as':_0xd79494['as'],'attributes':_0xd79494[_0x7b00('0x1e')],'include':_0xd79494[_0x7b00('0x20')]?_[_0x7b00('0x21')](_0xd79494[_0x7b00('0x20')],function(_0x36cc22){return{'model':db[_0x36cc22[_0x7b00('0x22')]],'as':_0x36cc22['as'],'attributes':_0x36cc22[_0x7b00('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3517aa){logger[_0x7b00('0x10')](_0x7b00('0x25'),_0x5757d6);logger['debug'](_0x7b00('0x25'),_0x5757d6,JSON[_0x7b00('0x24')](_0x3517aa));_0x2752d9(_0x3517aa);})[_0x7b00('0x18')](function(_0x41442a){logger[_0x7b00('0x14')](_0x7b00('0x25'),_0x41442a[_0x7b00('0x16')],_0x5757d6);_0x499d98(_0x42be24[_0x7b00('0x14')](0x1f4,_0x41442a[_0x7b00('0x16')]));});});}; \ No newline at end of file +var _0xf656=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','limit','map','include','model','then','debug','VoiceQueue','find','attributes','ShowVoiceQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xf656,0x16b));var _0x6f65=function(_0x143aab,_0x4f71b2){_0x143aab=_0x143aab-0x0;var _0x3eecf1=_0xf656[_0x143aab];return _0x3eecf1;};'use strict';var _=require(_0x6f65('0x0'));var util=require(_0x6f65('0x1'));var moment=require(_0x6f65('0x2'));var BPromise=require(_0x6f65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f65('0x4'))['db'];var utils=require(_0x6f65('0x5'));var logger=require(_0x6f65('0x6'))('rpc');var config=require(_0x6f65('0x7'));var jayson=require(_0x6f65('0x8'));var client=jayson[_0x6f65('0x9')][_0x6f65('0xa')]({'port':0x232a});config[_0x6f65('0xb')]=_[_0x6f65('0xc')](config[_0x6f65('0xb')],{'host':_0x6f65('0xd'),'port':0x18eb});var socket=require(_0x6f65('0xe'))(new Redis(config[_0x6f65('0xb')]));require('./voiceQueue.socket')[_0x6f65('0xf')](socket);function respondWithRpcPromise(_0x1af3c4,_0x1ae919,_0x1e7ca1){return new BPromise(function(_0x1659e2,_0x2bf5b4){return client[_0x6f65('0x10')](_0x1af3c4,_0x1e7ca1)['then'](function(_0x3160bc){logger[_0x6f65('0x11')](_0x6f65('0x12'),_0x1ae919,'request\x20sent');logger['debug'](_0x6f65('0x13'),_0x1ae919,_0x6f65('0x14'),JSON['stringify'](_0x3160bc));if(_0x3160bc[_0x6f65('0x15')]){if(_0x3160bc['error'][_0x6f65('0x16')]===0x1f4){logger[_0x6f65('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x1ae919,_0x3160bc[_0x6f65('0x15')][_0x6f65('0x17')]);return _0x2bf5b4(_0x3160bc[_0x6f65('0x15')][_0x6f65('0x17')]);}logger[_0x6f65('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x1ae919,_0x3160bc[_0x6f65('0x15')]['message']);return _0x1659e2(_0x3160bc[_0x6f65('0x15')][_0x6f65('0x17')]);}else{logger[_0x6f65('0x11')](_0x6f65('0x12'),_0x1ae919,_0x6f65('0x14'));_0x1659e2(_0x3160bc[_0x6f65('0x18')][_0x6f65('0x17')]);}})[_0x6f65('0x19')](function(_0xfe3ee){logger[_0x6f65('0x15')](_0x6f65('0x12'),_0x1ae919,_0xfe3ee);_0x2bf5b4(_0xfe3ee);});});}exports[_0x6f65('0x1a')]=function(_0x59baab){var _0x3c310d=this;return new Promise(function(_0x266a33,_0x38179b){return db['VoiceQueue'][_0x6f65('0x1b')]({'raw':_0x59baab[_0x6f65('0x1c')]?_0x59baab[_0x6f65('0x1c')][_0x6f65('0x1d')]===undefined?!![]:![]:!![],'where':_0x59baab[_0x6f65('0x1c')]?_0x59baab['options'][_0x6f65('0x1e')]||null:null,'attributes':_0x59baab[_0x6f65('0x1c')]?_0x59baab[_0x6f65('0x1c')]['attributes']||null:null,'limit':_0x59baab[_0x6f65('0x1c')]?_0x59baab[_0x6f65('0x1c')][_0x6f65('0x1f')]||null:null,'include':_0x59baab[_0x6f65('0x1c')]?_0x59baab[_0x6f65('0x1c')]['include']?_[_0x6f65('0x20')](_0x59baab[_0x6f65('0x1c')][_0x6f65('0x21')],function(_0x5a520c){return{'model':db[_0x5a520c[_0x6f65('0x22')]],'as':_0x5a520c['as'],'attributes':_0x5a520c['attributes'],'include':_0x5a520c[_0x6f65('0x21')]?_['map'](_0x5a520c[_0x6f65('0x21')],function(_0x2cb817){return{'model':db[_0x2cb817[_0x6f65('0x22')]],'as':_0x2cb817['as'],'attributes':_0x2cb817['attributes'],'include':_0x2cb817[_0x6f65('0x21')]?_[_0x6f65('0x20')](_0x2cb817[_0x6f65('0x21')],function(_0x43c983){return{'model':db[_0x43c983['model']],'as':_0x43c983['as'],'attributes':_0x43c983['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f65('0x23')](function(_0x67127f){logger[_0x6f65('0x11')](_0x6f65('0x1a'),_0x59baab);logger[_0x6f65('0x24')]('GetVoiceQueue',_0x59baab,JSON['stringify'](_0x67127f));_0x266a33(_0x67127f);})[_0x6f65('0x19')](function(_0x2e1491){logger['error'](_0x6f65('0x1a'),_0x2e1491['message'],_0x59baab);_0x38179b(_0x3c310d['error'](0x1f4,_0x2e1491['message']));});});};exports['ShowVoiceQueue']=function(_0x6ccd2c){var _0x438d71=this;return new Promise(function(_0x54df4e,_0x302cbb){return db[_0x6f65('0x25')][_0x6f65('0x26')]({'raw':_0x6ccd2c[_0x6f65('0x1c')]?_0x6ccd2c[_0x6f65('0x1c')][_0x6f65('0x1d')]===undefined?!![]:![]:!![],'where':_0x6ccd2c[_0x6f65('0x1c')]?_0x6ccd2c[_0x6f65('0x1c')]['where']||null:null,'attributes':_0x6ccd2c['options']?_0x6ccd2c[_0x6f65('0x1c')][_0x6f65('0x27')]||null:null,'include':_0x6ccd2c[_0x6f65('0x1c')]?_0x6ccd2c['options']['include']?_[_0x6f65('0x20')](_0x6ccd2c[_0x6f65('0x1c')]['include'],function(_0x238049){return{'model':db[_0x238049[_0x6f65('0x22')]],'as':_0x238049['as'],'attributes':_0x238049[_0x6f65('0x27')],'include':_0x238049[_0x6f65('0x21')]?_['map'](_0x238049['include'],function(_0x43d868){return{'model':db[_0x43d868[_0x6f65('0x22')]],'as':_0x43d868['as'],'attributes':_0x43d868[_0x6f65('0x27')],'include':_0x43d868[_0x6f65('0x21')]?_['map'](_0x43d868['include'],function(_0x2bbd1d){return{'model':db[_0x2bbd1d[_0x6f65('0x22')]],'as':_0x2bbd1d['as'],'attributes':_0x2bbd1d[_0x6f65('0x27')]};}):[]};}):[]};}):[]:[]})[_0x6f65('0x23')](function(_0x105486){logger['info'](_0x6f65('0x28'),_0x6ccd2c);logger['debug'](_0x6f65('0x28'),_0x6ccd2c,JSON['stringify'](_0x105486));_0x54df4e(_0x105486);})[_0x6f65('0x19')](function(_0x3fe2a2){logger['error'](_0x6f65('0x28'),_0x3fe2a2[_0x6f65('0x17')],_0x6ccd2c);_0x302cbb(_0x438d71[_0x6f65('0x15')](0x1f4,_0x3fe2a2[_0x6f65('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index fda3efa..e9bddf4 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 _0x0b82=['./voiceQueue.events','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x0b82,0x157));var _0x20b8=function(_0xbe6a06,_0x4c7c18){_0xbe6a06=_0xbe6a06-0x0;var _0x336792=_0x0b82[_0xbe6a06];return _0x336792;};'use strict';var VoiceQueueEvents=require(_0x20b8('0x0'));var events=['save','remove',_0x20b8('0x1')];function createListener(_0x80bd84,_0x1d6283){return function(_0x28b68b){_0x1d6283[_0x20b8('0x2')](_0x80bd84,_0x28b68b);};}function removeListener(_0x1789d9,_0x1213ab){return function(){VoiceQueueEvents[_0x20b8('0x3')](_0x1789d9,_0x1213ab);};}exports[_0x20b8('0x4')]=function(_0x53fed1){for(var _0x3a65bb=0x0,_0x4071a2=events[_0x20b8('0x5')];_0x3a65bb<_0x4071a2;_0x3a65bb++){var _0x1e25b2=events[_0x3a65bb];var _0x3a4e78=createListener(_0x20b8('0x6')+_0x1e25b2,_0x53fed1);VoiceQueueEvents['on'](_0x1e25b2,_0x3a4e78);}}; \ No newline at end of file +var _0xc98a=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x2a3d84,_0x52e1f3){var _0x3d4c2f=function(_0x224075){while(--_0x224075){_0x2a3d84['push'](_0x2a3d84['shift']());}};_0x3d4c2f(++_0x52e1f3);}(_0xc98a,0x1d2));var _0xac98=function(_0x332924,_0x240c1c){_0x332924=_0x332924-0x0;var _0x4440e9=_0xc98a[_0x332924];return _0x4440e9;};'use strict';var VoiceQueueEvents=require(_0xac98('0x0'));var events=[_0xac98('0x1'),_0xac98('0x2'),_0xac98('0x3')];function createListener(_0x13bb59,_0x1078b8){return function(_0x31f76e){_0x1078b8[_0xac98('0x4')](_0x13bb59,_0x31f76e);};}function removeListener(_0x46f8b6,_0x53548a){return function(){VoiceQueueEvents[_0xac98('0x5')](_0x46f8b6,_0x53548a);};}exports['register']=function(_0x122caf){for(var _0x445174=0x0,_0x26103f=events[_0xac98('0x6')];_0x445174<_0x26103f;_0x445174++){var _0x4b6713=events[_0x445174];var _0x51032e=createListener(_0xac98('0x7')+_0x4b6713,_0x122caf);VoiceQueueEvents['on'](_0x4b6713,_0x51032e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 89383f0..dadc7f9 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 _0xadd7=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','getVoiceQueuesReport','show','create','put','update','delete','/:id','destroy','exports'];(function(_0x5bce6d,_0x3d3b72){var _0x4ee73c=function(_0x23dc99){while(--_0x23dc99){_0x5bce6d['push'](_0x5bce6d['shift']());}};_0x4ee73c(++_0x3d3b72);}(_0xadd7,0x1b9));var _0x7add=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xadd7[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x7add('0x0'));var path=require(_0x7add('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7add('0x2')]();var fs_extra=require(_0x7add('0x3'));var auth=require(_0x7add('0x4'));var interaction=require(_0x7add('0x5'));var config=require(_0x7add('0x6'));var controller=require(_0x7add('0x7'));router['get']('/',auth[_0x7add('0x8')](),controller[_0x7add('0x9')]);router[_0x7add('0xa')](_0x7add('0xb'),auth[_0x7add('0x8')](),controller['describe']);router[_0x7add('0xa')]('/index',auth[_0x7add('0x8')](),controller[_0x7add('0xc')]);router[_0x7add('0xa')]('/:id',auth[_0x7add('0x8')](),controller[_0x7add('0xd')]);router['post']('/',auth[_0x7add('0x8')](),controller[_0x7add('0xe')]);router[_0x7add('0xf')]('/:id',auth[_0x7add('0x8')](),controller[_0x7add('0x10')]);router[_0x7add('0x11')](_0x7add('0x12'),auth['isAuthenticated'](),controller[_0x7add('0x13')]);module[_0x7add('0x14')]=router; \ No newline at end of file +var _0x670d=['show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/index','getVoiceQueuesReport','/:id'];(function(_0xabbd36,_0x348e59){var _0x478f3a=function(_0x3a5cdc){while(--_0x3a5cdc){_0xabbd36['push'](_0xabbd36['shift']());}};_0x478f3a(++_0x348e59);}(_0x670d,0x166));var _0xd670=function(_0x301ea5,_0x589ef7){_0x301ea5=_0x301ea5-0x0;var _0x1c3b86=_0x670d[_0x301ea5];return _0x1c3b86;};'use strict';var multer=require(_0xd670('0x0'));var util=require(_0xd670('0x1'));var path=require(_0xd670('0x2'));var timeout=require(_0xd670('0x3'));var express=require(_0xd670('0x4'));var router=express[_0xd670('0x5')]();var fs_extra=require(_0xd670('0x6'));var auth=require(_0xd670('0x7'));var interaction=require(_0xd670('0x8'));var config=require(_0xd670('0x9'));var controller=require(_0xd670('0xa'));router['get']('/',auth[_0xd670('0xb')](),controller['index']);router[_0xd670('0xc')]('/describe',auth[_0xd670('0xb')](),controller['describe']);router[_0xd670('0xc')](_0xd670('0xd'),auth[_0xd670('0xb')](),controller[_0xd670('0xe')]);router[_0xd670('0xc')](_0xd670('0xf'),auth[_0xd670('0xb')](),controller[_0xd670('0x10')]);router[_0xd670('0x11')]('/',auth[_0xd670('0xb')](),controller[_0xd670('0x12')]);router[_0xd670('0x13')](_0xd670('0xf'),auth['isAuthenticated'](),controller[_0xd670('0x14')]);router[_0xd670('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2146e0f..3716bd8 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 _0xf0d4=['moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize'];(function(_0x11a377,_0x9893e2){var _0x147bb9=function(_0x49cebb){while(--_0x49cebb){_0x11a377['push'](_0x11a377['shift']());}};_0x147bb9(++_0x9893e2);}(_0xf0d4,0xa4));var _0x4f0d=function(_0x3b21f7,_0x278ae8){_0x3b21f7=_0x3b21f7-0x0;var _0x39b0da=_0xf0d4[_0x3b21f7];return _0x39b0da;};'use strict';var Sequelize=require(_0x4f0d('0x0'));var moment=require(_0x4f0d('0x1'));module['exports']={'type':{'type':Sequelize[_0x4f0d('0x2')]},'uniqueid':{'type':Sequelize[_0x4f0d('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f0d('0x2')]},'queue':{'type':Sequelize[_0x4f0d('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x4f0d('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x4f0d('0x3')],'set':function(_0x5a857f){var _0x4c308d=moment(_0x5a857f);var _0x2883eb=moment(this[_0x4f0d('0x4')](_0x4f0d('0x5')))[_0x4f0d('0x6')](_0x4f0d('0x7'));var _0x36f098=_0x4c308d[_0x4f0d('0x8')](_0x2883eb,'seconds');this[_0x4f0d('0x9')](_0x4f0d('0xa'),_0x5a857f);this[_0x4f0d('0x9')](_0x4f0d('0xb'),_0x36f098||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x4f0d('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x4f0d('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4f0d('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x4f0d('0xe')},'originalposition':{'type':Sequelize[_0x4f0d('0xc')]},'channel':{'type':Sequelize[_0x4f0d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4f0d('0x2')]},'connectedlinename':{'type':Sequelize[_0x4f0d('0x2')]},'accountcode':{'type':Sequelize[_0x4f0d('0x2')]},'context':{'type':Sequelize[_0x4f0d('0x2')]},'exten':{'type':Sequelize[_0x4f0d('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x4f0d('0xc')]},'mohtime':{'type':Sequelize[_0x4f0d('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4f0d('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x4f0d('0x2')]},'disposition':{'type':Sequelize[_0x4f0d('0x2')]},'secondDisposition':{'type':Sequelize[_0x4f0d('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x4f0d('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbf7=['YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x46833f,_0x285654){var _0xb80091=function(_0x20e771){while(--_0x20e771){_0x46833f['push'](_0x46833f['shift']());}};_0xb80091(++_0x285654);}(_0xcbf7,0x19d));var _0x7cbf=function(_0x249fd6,_0x5bd6d5){_0x249fd6=_0x249fd6-0x0;var _0x1d01e6=_0xcbf7[_0x249fd6];return _0x1d01e6;};'use strict';var Sequelize=require(_0x7cbf('0x0'));var moment=require(_0x7cbf('0x1'));module['exports']={'type':{'type':Sequelize[_0x7cbf('0x2')]},'uniqueid':{'type':Sequelize[_0x7cbf('0x2')]},'calleridnum':{'type':Sequelize[_0x7cbf('0x2')]},'calleridname':{'type':Sequelize[_0x7cbf('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7cbf('0x3')],'set':function(_0x4f081d){var _0x3b08fc=moment(_0x4f081d);var _0x3d6334=moment(this[_0x7cbf('0x4')](_0x7cbf('0x5')))[_0x7cbf('0x6')](_0x7cbf('0x7'));var _0x2e52ac=_0x3b08fc['diff'](_0x3d6334,_0x7cbf('0x8'));this[_0x7cbf('0x9')]('queuecallerleaveAt',_0x4f081d);this[_0x7cbf('0x9')](_0x7cbf('0xa'),_0x2e52ac||null);}},'position':{'type':Sequelize[_0x7cbf('0xb')]},'count':{'type':Sequelize[_0x7cbf('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x7cbf('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7cbf('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7cbf('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7cbf('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7cbf('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x7cbf('0x2')],'comment':_0x7cbf('0xd')},'originalposition':{'type':Sequelize[_0x7cbf('0xb')]},'channel':{'type':Sequelize[_0x7cbf('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7cbf('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7cbf('0x2')]},'exten':{'type':Sequelize[_0x7cbf('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x7cbf('0xb')]},'mohtime':{'type':Sequelize[_0x7cbf('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7cbf('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7cbf('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7cbf('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7cbf('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7cbf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7cbf('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7cbf('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7cbf('0xb')],'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 45ebe3e..00869f7 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 _0xef81=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xb51ce3,_0x2642d8){var _0x122270=function(_0x1ba6a6){while(--_0x1ba6a6){_0xb51ce3['push'](_0xb51ce3['shift']());}};_0x122270(++_0x2642d8);}(_0xef81,0x99));var _0x1ef8=function(_0x1a2504,_0x5ab87b){_0x1a2504=_0x1a2504-0x0;var _0x1f8525=_0xef81[_0x1a2504];return _0x1f8525;};'use strict';var emlformat=require(_0x1ef8('0x0'));var rimraf=require(_0x1ef8('0x1'));var zipdir=require(_0x1ef8('0x2'));var jsonpatch=require(_0x1ef8('0x3'));var rp=require('request-promise');var moment=require(_0x1ef8('0x4'));var BPromise=require(_0x1ef8('0x5'));var Mustache=require(_0x1ef8('0x6'));var util=require(_0x1ef8('0x7'));var path=require(_0x1ef8('0x8'));var sox=require(_0x1ef8('0x9'));var csv=require(_0x1ef8('0xa'));var ejs=require(_0x1ef8('0xb'));var fs=require('fs');var fs_extra=require(_0x1ef8('0xc'));var _=require('lodash');var squel=require(_0x1ef8('0xd'));var crypto=require(_0x1ef8('0xe'));var jsforce=require(_0x1ef8('0xf'));var deskjs=require(_0x1ef8('0x10'));var toCsv=require(_0x1ef8('0xa'));var querystring=require(_0x1ef8('0x11'));var Papa=require('papaparse');var Redis=require(_0x1ef8('0x12'));var authService=require(_0x1ef8('0x13'));var qs=require(_0x1ef8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ef8('0x15'));var logger=require(_0x1ef8('0x16'))(_0x1ef8('0x17'));var utils=require(_0x1ef8('0x18'));var config=require(_0x1ef8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ef8('0x1a'))['db'];config[_0x1ef8('0x1b')]=_['defaults'](config[_0x1ef8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ef8('0x1c'))(new Redis(config[_0x1ef8('0x1b')]));require('./voiceQueueReport.socket')[_0x1ef8('0x1d')](socket);function respondWithStatusCode(_0x17a9a3,_0x128479){_0x128479=_0x128479||0xcc;return function(_0x4f98da){if(_0x4f98da){return _0x17a9a3[_0x1ef8('0x1e')](_0x128479);}return _0x17a9a3[_0x1ef8('0x1f')](_0x128479)[_0x1ef8('0x20')]();};}function respondWithResult(_0xd7ca1f,_0x2b75a3){_0x2b75a3=_0x2b75a3||0xc8;return function(_0x3e3aec){if(_0x3e3aec){return _0xd7ca1f[_0x1ef8('0x1f')](_0x2b75a3)[_0x1ef8('0x21')](_0x3e3aec);}};}function respondWithFilteredResult(_0x60e29a,_0x560cc2){return function(_0x437b87){if(_0x437b87){var _0x36ba99=typeof _0x560cc2[_0x1ef8('0x22')]==='undefined'&&typeof _0x560cc2[_0x1ef8('0x23')]===_0x1ef8('0x24');var _0x172ac8=_0x437b87[_0x1ef8('0x25')];var _0x5984f5=_0x36ba99?0x0:_0x560cc2[_0x1ef8('0x22')];var _0x5618f6=_0x36ba99?_0x437b87[_0x1ef8('0x25')]:_0x560cc2[_0x1ef8('0x22')]+_0x560cc2[_0x1ef8('0x23')];var _0xc33306;if(_0x5618f6>=_0x172ac8){_0x5618f6=_0x172ac8;_0xc33306=0xc8;}else{_0xc33306=0xce;}_0x60e29a[_0x1ef8('0x1f')](_0xc33306);return _0x60e29a[_0x1ef8('0x26')]('Content-Range',_0x5984f5+'-'+_0x5618f6+'/'+_0x172ac8)['json'](_0x437b87);}return null;};}function patchUpdates(_0x2206e6){return function(_0x29e814){try{jsonpatch['apply'](_0x29e814,_0x2206e6,!![]);}catch(_0x58ef2e){return BPromise[_0x1ef8('0x27')](_0x58ef2e);}return _0x29e814[_0x1ef8('0x28')]();};}function saveUpdates(_0x4cc399,_0x2f0f3d){return function(_0x4fbbfd){if(_0x4fbbfd){return _0x4fbbfd[_0x1ef8('0x29')](_0x4cc399)[_0x1ef8('0x2a')](function(_0x1967b3){return _0x1967b3;});}return null;};}function removeEntity(_0x4ae23d,_0x12603b){return function(_0xa0f472){if(_0xa0f472){return _0xa0f472[_0x1ef8('0x2b')]()[_0x1ef8('0x2a')](function(){_0x4ae23d[_0x1ef8('0x1f')](0xcc)[_0x1ef8('0x20')]();});}};}function handleEntityNotFound(_0x3af5d3,_0x1a55aa){return function(_0x40ff9d){if(!_0x40ff9d){_0x3af5d3['sendStatus'](0x194);}return _0x40ff9d;};}function handleError(_0xbe2e34,_0x4825af){_0x4825af=_0x4825af||0x1f4;return function(_0x117ec5){logger[_0x1ef8('0x2c')](_0x117ec5[_0x1ef8('0x2d')]);if(_0x117ec5[_0x1ef8('0x2e')]){delete _0x117ec5[_0x1ef8('0x2e')];}_0xbe2e34[_0x1ef8('0x1f')](_0x4825af)[_0x1ef8('0x2f')](_0x117ec5);};}exports[_0x1ef8('0x30')]=function(_0x206bc7,_0x24737e){var _0x4e7f1c={},_0x4a6ec4={},_0x55a561={'count':0x0,'rows':[]};var _0x270c3b=_[_0x1ef8('0x31')](db[_0x1ef8('0x32')][_0x1ef8('0x33')],function(_0x1b85f9){return{'name':_0x1b85f9[_0x1ef8('0x34')],'type':_0x1b85f9[_0x1ef8('0x35')][_0x1ef8('0x36')]};});_0x4a6ec4[_0x1ef8('0x37')]=_[_0x1ef8('0x31')](_0x270c3b,_0x1ef8('0x2e'));_0x4a6ec4['query']=_[_0x1ef8('0x38')](_0x206bc7['query']);_0x4a6ec4['filters']=_[_0x1ef8('0x39')](_0x4a6ec4[_0x1ef8('0x37')],_0x4a6ec4[_0x1ef8('0x3a')]);_0x4e7f1c[_0x1ef8('0x3b')]=_['intersection'](_0x4a6ec4['model'],qs[_0x1ef8('0x3c')](_0x206bc7[_0x1ef8('0x3a')][_0x1ef8('0x3c')]));_0x4e7f1c[_0x1ef8('0x3b')]=_0x4e7f1c[_0x1ef8('0x3b')][_0x1ef8('0x3d')]?_0x4e7f1c[_0x1ef8('0x3b')]:_0x4a6ec4[_0x1ef8('0x37')];if(!_0x206bc7[_0x1ef8('0x3a')]['hasOwnProperty'](_0x1ef8('0x3e'))){_0x4e7f1c[_0x1ef8('0x23')]=qs[_0x1ef8('0x23')](_0x206bc7[_0x1ef8('0x3a')][_0x1ef8('0x23')]);_0x4e7f1c[_0x1ef8('0x22')]=qs[_0x1ef8('0x22')](_0x206bc7['query'][_0x1ef8('0x22')]);}_0x4e7f1c['order']=qs[_0x1ef8('0x3f')](_0x206bc7[_0x1ef8('0x3a')]['sort']);_0x4e7f1c[_0x1ef8('0x40')]=qs[_0x1ef8('0x41')](_[_0x1ef8('0x42')](_0x206bc7[_0x1ef8('0x3a')],_0x4a6ec4[_0x1ef8('0x41')]),_0x270c3b);if(_0x206bc7['query'][_0x1ef8('0x43')]){_0x4e7f1c[_0x1ef8('0x40')]=_[_0x1ef8('0x44')](_0x4e7f1c[_0x1ef8('0x40')],{'$or':_[_0x1ef8('0x31')](_0x270c3b,function(_0x374a4f){if(_0x374a4f[_0x1ef8('0x35')]!==_0x1ef8('0x45')){var _0x12b20e={};_0x12b20e[_0x374a4f[_0x1ef8('0x2e')]]={'$like':'%'+_0x206bc7['query'][_0x1ef8('0x43')]+'%'};return _0x12b20e;}})});}_0x4e7f1c=_[_0x1ef8('0x44')]({},_0x4e7f1c,_0x206bc7['options']);var _0x24950e={'where':_0x4e7f1c['where']};return db[_0x1ef8('0x32')][_0x1ef8('0x25')](_0x24950e)[_0x1ef8('0x2a')](function(_0x395366){_0x55a561['count']=_0x395366;if(_0x206bc7[_0x1ef8('0x3a')][_0x1ef8('0x46')]){_0x4e7f1c[_0x1ef8('0x47')]=[{'all':!![]}];}return db[_0x1ef8('0x32')][_0x1ef8('0x48')](_0x4e7f1c);})['then'](function(_0x2af45d){_0x55a561[_0x1ef8('0x49')]=_0x2af45d;return _0x55a561;})[_0x1ef8('0x2a')](respondWithFilteredResult(_0x24737e,_0x4e7f1c))[_0x1ef8('0x4a')](handleError(_0x24737e,null));};exports[_0x1ef8('0x4b')]=function(_0x50acda,_0x2ccd11){var _0x1de05d={'raw':![],'where':{'id':_0x50acda[_0x1ef8('0x4c')]['id']}},_0xa9b690={};_0xa9b690[_0x1ef8('0x37')]=_['keys'](db[_0x1ef8('0x32')]['rawAttributes']);_0xa9b690[_0x1ef8('0x3a')]=_[_0x1ef8('0x38')](_0x50acda[_0x1ef8('0x3a')]);_0xa9b690[_0x1ef8('0x41')]=_[_0x1ef8('0x39')](_0xa9b690[_0x1ef8('0x37')],_0xa9b690[_0x1ef8('0x3a')]);_0x1de05d['attributes']=_[_0x1ef8('0x39')](_0xa9b690[_0x1ef8('0x37')],qs[_0x1ef8('0x3c')](_0x50acda[_0x1ef8('0x3a')][_0x1ef8('0x3c')]));_0x1de05d['attributes']=_0x1de05d['attributes'][_0x1ef8('0x3d')]?_0x1de05d[_0x1ef8('0x3b')]:_0xa9b690['model'];if(_0x50acda[_0x1ef8('0x3a')][_0x1ef8('0x46')]){_0x1de05d[_0x1ef8('0x47')]=[{'all':!![]}];}_0x1de05d=_[_0x1ef8('0x44')]({},_0x1de05d,_0x50acda[_0x1ef8('0x4d')]);return db[_0x1ef8('0x32')][_0x1ef8('0x4e')](_0x1de05d)['then'](handleEntityNotFound(_0x2ccd11,null))[_0x1ef8('0x2a')](respondWithResult(_0x2ccd11,null))[_0x1ef8('0x4a')](handleError(_0x2ccd11,null));};exports['create']=function(_0x5a4a22,_0x1c9f9e){return db[_0x1ef8('0x32')]['create'](_0x5a4a22[_0x1ef8('0x4f')],{})[_0x1ef8('0x2a')](respondWithResult(_0x1c9f9e,0xc9))[_0x1ef8('0x4a')](handleError(_0x1c9f9e,null));};exports[_0x1ef8('0x29')]=function(_0x15a31b,_0x78504f){if(_0x15a31b[_0x1ef8('0x4f')]['id']){delete _0x15a31b[_0x1ef8('0x4f')]['id'];}return db[_0x1ef8('0x32')][_0x1ef8('0x4e')]({'where':{'id':_0x15a31b['params']['id']}})[_0x1ef8('0x2a')](handleEntityNotFound(_0x78504f,null))[_0x1ef8('0x2a')](saveUpdates(_0x15a31b[_0x1ef8('0x4f')],null))[_0x1ef8('0x2a')](respondWithResult(_0x78504f,null))[_0x1ef8('0x4a')](handleError(_0x78504f,null));};exports[_0x1ef8('0x2b')]=function(_0x48e13f,_0x4ec893){return db[_0x1ef8('0x32')]['find']({'where':{'id':_0x48e13f[_0x1ef8('0x4c')]['id']}})[_0x1ef8('0x2a')](handleEntityNotFound(_0x4ec893,null))[_0x1ef8('0x2a')](removeEntity(_0x4ec893,null))[_0x1ef8('0x4a')](handleError(_0x4ec893,null));};exports[_0x1ef8('0x50')]=function(_0xf44b8e,_0x321ec5){return db[_0x1ef8('0x32')][_0x1ef8('0x50')]()[_0x1ef8('0x2a')](respondWithResult(_0x321ec5,null))[_0x1ef8('0x4a')](handleError(_0x321ec5,null));};exports[_0x1ef8('0x51')]=function(_0x33fd18,_0x4150fd){var _0x114f08={},_0x2592fa={},_0x494c45={'count':0x0,'rows':[]};_0x2592fa[_0x1ef8('0x37')]=_['keys'](db['VoiceQueueReport'][_0x1ef8('0x33')]);_0x2592fa[_0x1ef8('0x3a')]=_[_0x1ef8('0x38')](_0x33fd18[_0x1ef8('0x3a')]);_0x2592fa[_0x1ef8('0x41')]=_[_0x1ef8('0x39')](_0x2592fa['model'],_0x2592fa[_0x1ef8('0x3a')]);_0x114f08['attributes']=_[_0x1ef8('0x39')](_0x2592fa[_0x1ef8('0x37')],qs['fields'](_0x33fd18[_0x1ef8('0x3a')]['fields']));_0x114f08[_0x1ef8('0x3b')]=_0x114f08[_0x1ef8('0x3b')][_0x1ef8('0x3d')]?_0x114f08[_0x1ef8('0x3b')]:_0x2592fa[_0x1ef8('0x37')];if(!_0x33fd18[_0x1ef8('0x3a')][_0x1ef8('0x52')](_0x1ef8('0x3e'))){_0x114f08[_0x1ef8('0x23')]=qs[_0x1ef8('0x23')](_0x33fd18[_0x1ef8('0x3a')][_0x1ef8('0x23')]);_0x114f08[_0x1ef8('0x22')]=qs['offset'](_0x33fd18[_0x1ef8('0x3a')]['offset']);}_0x114f08['order']=qs['sort'](_0x33fd18[_0x1ef8('0x3a')][_0x1ef8('0x3f')]);_0x114f08[_0x1ef8('0x40')]=qs[_0x1ef8('0x41')](_['pick'](_0x33fd18['query'],_0x2592fa[_0x1ef8('0x41')]));if(_0x33fd18[_0x1ef8('0x3a')]['filter']){_0x114f08[_0x1ef8('0x40')]=_[_0x1ef8('0x44')](_0x114f08['where'],{'$or':_[_0x1ef8('0x31')](_0x114f08[_0x1ef8('0x3b')],function(_0x565826){var _0x4df1aa={};_0x4df1aa[_0x565826]={'$like':'%'+_0x33fd18['query'][_0x1ef8('0x43')]+'%'};return _0x4df1aa;})});}_0x114f08=_['merge']({},_0x114f08,_0x33fd18[_0x1ef8('0x4d')]);var _0x23dbef={'where':_0x114f08['where']};return db['VoiceQueueReport'][_0x1ef8('0x25')](_0x23dbef)['then'](function(_0x550605){_0x494c45[_0x1ef8('0x25')]=_0x550605;if(_0x33fd18[_0x1ef8('0x3a')][_0x1ef8('0x46')]){_0x114f08['include']=[{'all':!![]}];}return db[_0x1ef8('0x32')][_0x1ef8('0x48')](_0x114f08);})[_0x1ef8('0x2a')](function(_0x2f6685){_0x494c45[_0x1ef8('0x49')]=_0x2f6685;return _0x494c45;})[_0x1ef8('0x2a')](respondWithFilteredResult(_0x4150fd,_0x114f08,'getVoiceQueuesReport'))[_0x1ef8('0x4a')](handleError(_0x4150fd,null,_0x1ef8('0x51')));}; \ No newline at end of file +var _0xc35f=['VoiceQueueReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','destroy','describe','getVoiceQueuesReport','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options'];(function(_0x2ac1d2,_0xd46a50){var _0x332e14=function(_0x49c4f3){while(--_0x49c4f3){_0x2ac1d2['push'](_0x2ac1d2['shift']());}};_0x332e14(++_0xd46a50);}(_0xc35f,0x64));var _0xfc35=function(_0x72a99b,_0xfd0c65){_0x72a99b=_0x72a99b-0x0;var _0x5bee30=_0xc35f[_0x72a99b];return _0x5bee30;};'use strict';var emlformat=require(_0xfc35('0x0'));var rimraf=require(_0xfc35('0x1'));var zipdir=require(_0xfc35('0x2'));var jsonpatch=require(_0xfc35('0x3'));var rp=require(_0xfc35('0x4'));var moment=require(_0xfc35('0x5'));var BPromise=require(_0xfc35('0x6'));var Mustache=require(_0xfc35('0x7'));var util=require(_0xfc35('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfc35('0x9'));var ejs=require(_0xfc35('0xa'));var fs=require('fs');var fs_extra=require(_0xfc35('0xb'));var _=require('lodash');var squel=require(_0xfc35('0xc'));var crypto=require('crypto');var jsforce=require(_0xfc35('0xd'));var deskjs=require(_0xfc35('0xe'));var toCsv=require(_0xfc35('0x9'));var querystring=require(_0xfc35('0xf'));var Papa=require(_0xfc35('0x10'));var Redis=require(_0xfc35('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc35('0x12'));var as=require(_0xfc35('0x13'));var hardwareService=require(_0xfc35('0x14'));var logger=require(_0xfc35('0x15'))(_0xfc35('0x16'));var utils=require(_0xfc35('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc35('0x18'));var db=require('../../mysqldb')['db'];config[_0xfc35('0x19')]=_[_0xfc35('0x1a')](config['redis'],{'host':_0xfc35('0x1b'),'port':0x18eb});var socket=require(_0xfc35('0x1c'))(new Redis(config[_0xfc35('0x19')]));require('./voiceQueueReport.socket')[_0xfc35('0x1d')](socket);function respondWithStatusCode(_0x1798fd,_0x38c5f5){_0x38c5f5=_0x38c5f5||0xcc;return function(_0x2cf435){if(_0x2cf435){return _0x1798fd['sendStatus'](_0x38c5f5);}return _0x1798fd['status'](_0x38c5f5)[_0xfc35('0x1e')]();};}function respondWithResult(_0x407929,_0x1aa1ea){_0x1aa1ea=_0x1aa1ea||0xc8;return function(_0x3d3f04){if(_0x3d3f04){return _0x407929[_0xfc35('0x1f')](_0x1aa1ea)[_0xfc35('0x20')](_0x3d3f04);}};}function respondWithFilteredResult(_0xd9c39f,_0x239a40){return function(_0x5280f5){if(_0x5280f5){var _0x3650b9=typeof _0x239a40[_0xfc35('0x21')]==='undefined'&&typeof _0x239a40[_0xfc35('0x22')]===_0xfc35('0x23');var _0x4f93f1=_0x5280f5[_0xfc35('0x24')];var _0x5da4c4=_0x3650b9?0x0:_0x239a40[_0xfc35('0x21')];var _0x59daea=_0x3650b9?_0x5280f5[_0xfc35('0x24')]:_0x239a40[_0xfc35('0x21')]+_0x239a40[_0xfc35('0x22')];var _0x39dc85;if(_0x59daea>=_0x4f93f1){_0x59daea=_0x4f93f1;_0x39dc85=0xc8;}else{_0x39dc85=0xce;}_0xd9c39f['status'](_0x39dc85);return _0xd9c39f['set'](_0xfc35('0x25'),_0x5da4c4+'-'+_0x59daea+'/'+_0x4f93f1)[_0xfc35('0x20')](_0x5280f5);}return null;};}function patchUpdates(_0x158d59){return function(_0x2c929d){try{jsonpatch[_0xfc35('0x26')](_0x2c929d,_0x158d59,!![]);}catch(_0x606be5){return BPromise[_0xfc35('0x27')](_0x606be5);}return _0x2c929d[_0xfc35('0x28')]();};}function saveUpdates(_0x30957f,_0x46aeb5){return function(_0x59d79a){if(_0x59d79a){return _0x59d79a[_0xfc35('0x29')](_0x30957f)['then'](function(_0x41b0c8){return _0x41b0c8;});}return null;};}function removeEntity(_0xc46baa,_0x34b836){return function(_0x304681){if(_0x304681){return _0x304681['destroy']()[_0xfc35('0x2a')](function(){_0xc46baa[_0xfc35('0x1f')](0xcc)[_0xfc35('0x1e')]();});}};}function handleEntityNotFound(_0x3817dd,_0x1b9350){return function(_0x1e1eba){if(!_0x1e1eba){_0x3817dd[_0xfc35('0x2b')](0x194);}return _0x1e1eba;};}function handleError(_0x198e0e,_0x46d6fa){_0x46d6fa=_0x46d6fa||0x1f4;return function(_0x3c96e6){logger[_0xfc35('0x2c')](_0x3c96e6[_0xfc35('0x2d')]);if(_0x3c96e6[_0xfc35('0x2e')]){delete _0x3c96e6['name'];}_0x198e0e['status'](_0x46d6fa)['send'](_0x3c96e6);};}exports[_0xfc35('0x2f')]=function(_0x41e08d,_0x406789){var _0x55964d={},_0x1b3adf={},_0x53fe8c={'count':0x0,'rows':[]};var _0x39f30d=_['map'](db['VoiceQueueReport'][_0xfc35('0x30')],function(_0x47489d){return{'name':_0x47489d[_0xfc35('0x31')],'type':_0x47489d[_0xfc35('0x32')][_0xfc35('0x33')]};});_0x1b3adf[_0xfc35('0x34')]=_[_0xfc35('0x35')](_0x39f30d,'name');_0x1b3adf[_0xfc35('0x36')]=_[_0xfc35('0x37')](_0x41e08d[_0xfc35('0x36')]);_0x1b3adf[_0xfc35('0x38')]=_[_0xfc35('0x39')](_0x1b3adf['model'],_0x1b3adf['query']);_0x55964d[_0xfc35('0x3a')]=_[_0xfc35('0x39')](_0x1b3adf['model'],qs[_0xfc35('0x3b')](_0x41e08d[_0xfc35('0x36')][_0xfc35('0x3b')]));_0x55964d[_0xfc35('0x3a')]=_0x55964d['attributes']['length']?_0x55964d[_0xfc35('0x3a')]:_0x1b3adf[_0xfc35('0x34')];if(!_0x41e08d[_0xfc35('0x36')][_0xfc35('0x3c')](_0xfc35('0x3d'))){_0x55964d[_0xfc35('0x22')]=qs['limit'](_0x41e08d[_0xfc35('0x36')][_0xfc35('0x22')]);_0x55964d[_0xfc35('0x21')]=qs[_0xfc35('0x21')](_0x41e08d[_0xfc35('0x36')][_0xfc35('0x21')]);}_0x55964d['order']=qs[_0xfc35('0x3e')](_0x41e08d[_0xfc35('0x36')][_0xfc35('0x3e')]);_0x55964d[_0xfc35('0x3f')]=qs[_0xfc35('0x38')](_[_0xfc35('0x40')](_0x41e08d['query'],_0x1b3adf[_0xfc35('0x38')]),_0x39f30d);if(_0x41e08d[_0xfc35('0x36')][_0xfc35('0x41')]){_0x55964d[_0xfc35('0x3f')]=_[_0xfc35('0x42')](_0x55964d['where'],{'$or':_[_0xfc35('0x35')](_0x39f30d,function(_0x25b9fd){if(_0x25b9fd['type']!=='VIRTUAL'){var _0x63d6a2={};_0x63d6a2[_0x25b9fd[_0xfc35('0x2e')]]={'$like':'%'+_0x41e08d['query']['filter']+'%'};return _0x63d6a2;}})});}_0x55964d=_[_0xfc35('0x42')]({},_0x55964d,_0x41e08d[_0xfc35('0x43')]);var _0x2d6848={'where':_0x55964d['where']};return db[_0xfc35('0x44')][_0xfc35('0x24')](_0x2d6848)[_0xfc35('0x2a')](function(_0x2600c9){_0x53fe8c[_0xfc35('0x24')]=_0x2600c9;if(_0x41e08d[_0xfc35('0x36')][_0xfc35('0x45')]){_0x55964d[_0xfc35('0x46')]=[{'all':!![]}];}return db[_0xfc35('0x44')][_0xfc35('0x47')](_0x55964d);})[_0xfc35('0x2a')](function(_0x329135){_0x53fe8c[_0xfc35('0x48')]=_0x329135;return _0x53fe8c;})[_0xfc35('0x2a')](respondWithFilteredResult(_0x406789,_0x55964d))['catch'](handleError(_0x406789,null));};exports[_0xfc35('0x49')]=function(_0x46eb3c,_0x5cc09b){var _0xbc2aa7={'raw':![],'where':{'id':_0x46eb3c[_0xfc35('0x4a')]['id']}},_0x193019={};_0x193019[_0xfc35('0x34')]=_[_0xfc35('0x37')](db[_0xfc35('0x44')]['rawAttributes']);_0x193019['query']=_['keys'](_0x46eb3c[_0xfc35('0x36')]);_0x193019[_0xfc35('0x38')]=_[_0xfc35('0x39')](_0x193019[_0xfc35('0x34')],_0x193019[_0xfc35('0x36')]);_0xbc2aa7['attributes']=_['intersection'](_0x193019[_0xfc35('0x34')],qs['fields'](_0x46eb3c[_0xfc35('0x36')][_0xfc35('0x3b')]));_0xbc2aa7[_0xfc35('0x3a')]=_0xbc2aa7[_0xfc35('0x3a')][_0xfc35('0x4b')]?_0xbc2aa7['attributes']:_0x193019[_0xfc35('0x34')];if(_0x46eb3c[_0xfc35('0x36')][_0xfc35('0x45')]){_0xbc2aa7['include']=[{'all':!![]}];}_0xbc2aa7=_[_0xfc35('0x42')]({},_0xbc2aa7,_0x46eb3c['options']);return db['VoiceQueueReport'][_0xfc35('0x4c')](_0xbc2aa7)['then'](handleEntityNotFound(_0x5cc09b,null))[_0xfc35('0x2a')](respondWithResult(_0x5cc09b,null))[_0xfc35('0x4d')](handleError(_0x5cc09b,null));};exports[_0xfc35('0x4e')]=function(_0x102347,_0x43284d){return db[_0xfc35('0x44')]['create'](_0x102347[_0xfc35('0x4f')],{})[_0xfc35('0x2a')](respondWithResult(_0x43284d,0xc9))['catch'](handleError(_0x43284d,null));};exports[_0xfc35('0x29')]=function(_0x466351,_0x17c525){if(_0x466351['body']['id']){delete _0x466351['body']['id'];}return db[_0xfc35('0x44')][_0xfc35('0x4c')]({'where':{'id':_0x466351[_0xfc35('0x4a')]['id']}})[_0xfc35('0x2a')](handleEntityNotFound(_0x17c525,null))[_0xfc35('0x2a')](saveUpdates(_0x466351[_0xfc35('0x4f')],null))[_0xfc35('0x2a')](respondWithResult(_0x17c525,null))[_0xfc35('0x4d')](handleError(_0x17c525,null));};exports[_0xfc35('0x50')]=function(_0x7b2239,_0x2f6e44){return db[_0xfc35('0x44')][_0xfc35('0x4c')]({'where':{'id':_0x7b2239[_0xfc35('0x4a')]['id']}})[_0xfc35('0x2a')](handleEntityNotFound(_0x2f6e44,null))[_0xfc35('0x2a')](removeEntity(_0x2f6e44,null))[_0xfc35('0x4d')](handleError(_0x2f6e44,null));};exports[_0xfc35('0x51')]=function(_0x66eb79,_0x2d9fd5){return db['VoiceQueueReport']['describe']()[_0xfc35('0x2a')](respondWithResult(_0x2d9fd5,null))[_0xfc35('0x4d')](handleError(_0x2d9fd5,null));};exports[_0xfc35('0x52')]=function(_0x51d680,_0x492846){var _0x3aa42e={},_0x55ad6b={},_0x85c70d={'count':0x0,'rows':[]};_0x55ad6b['model']=_['keys'](db[_0xfc35('0x44')][_0xfc35('0x30')]);_0x55ad6b['query']=_[_0xfc35('0x37')](_0x51d680[_0xfc35('0x36')]);_0x55ad6b[_0xfc35('0x38')]=_[_0xfc35('0x39')](_0x55ad6b[_0xfc35('0x34')],_0x55ad6b[_0xfc35('0x36')]);_0x3aa42e[_0xfc35('0x3a')]=_[_0xfc35('0x39')](_0x55ad6b['model'],qs['fields'](_0x51d680[_0xfc35('0x36')]['fields']));_0x3aa42e['attributes']=_0x3aa42e['attributes'][_0xfc35('0x4b')]?_0x3aa42e[_0xfc35('0x3a')]:_0x55ad6b['model'];if(!_0x51d680['query']['hasOwnProperty'](_0xfc35('0x3d'))){_0x3aa42e[_0xfc35('0x22')]=qs[_0xfc35('0x22')](_0x51d680[_0xfc35('0x36')][_0xfc35('0x22')]);_0x3aa42e['offset']=qs[_0xfc35('0x21')](_0x51d680[_0xfc35('0x36')][_0xfc35('0x21')]);}_0x3aa42e[_0xfc35('0x53')]=qs[_0xfc35('0x3e')](_0x51d680[_0xfc35('0x36')][_0xfc35('0x3e')]);_0x3aa42e[_0xfc35('0x3f')]=qs['filters'](_['pick'](_0x51d680[_0xfc35('0x36')],_0x55ad6b[_0xfc35('0x38')]));if(_0x51d680[_0xfc35('0x36')]['filter']){_0x3aa42e[_0xfc35('0x3f')]=_[_0xfc35('0x42')](_0x3aa42e['where'],{'$or':_[_0xfc35('0x35')](_0x3aa42e[_0xfc35('0x3a')],function(_0x5c563b){var _0x7e4608={};_0x7e4608[_0x5c563b]={'$like':'%'+_0x51d680[_0xfc35('0x36')][_0xfc35('0x41')]+'%'};return _0x7e4608;})});}_0x3aa42e=_['merge']({},_0x3aa42e,_0x51d680[_0xfc35('0x43')]);var _0x4bb076={'where':_0x3aa42e[_0xfc35('0x3f')]};return db[_0xfc35('0x44')][_0xfc35('0x24')](_0x4bb076)[_0xfc35('0x2a')](function(_0x4cdd35){_0x85c70d[_0xfc35('0x24')]=_0x4cdd35;if(_0x51d680[_0xfc35('0x36')][_0xfc35('0x45')]){_0x3aa42e[_0xfc35('0x46')]=[{'all':!![]}];}return db[_0xfc35('0x44')][_0xfc35('0x47')](_0x3aa42e);})[_0xfc35('0x2a')](function(_0xcb2e5e){_0x85c70d[_0xfc35('0x48')]=_0xcb2e5e;return _0x85c70d;})[_0xfc35('0x2a')](respondWithFilteredResult(_0x492846,_0x3aa42e,_0xfc35('0x52')))[_0xfc35('0x4d')](handleError(_0x492846,null,_0xfc35('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index fbe0452..12c2ab4 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 _0x1fe5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x1fe5,0x1dc));var _0x51fe=function(_0x38a792,_0x5a21a5){_0x38a792=_0x38a792-0x0;var _0x2cee7b=_0x1fe5[_0x38a792];return _0x2cee7b;};'use strict';var EventEmitter=require(_0x51fe('0x0'));var VoiceQueueReport=require(_0x51fe('0x1'))['db'][_0x51fe('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x51fe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x51fe('0x4'),'afterDestroy':_0x51fe('0x5')};function emitEvent(_0x4db736){return function(_0x33fd35,_0x331092,_0x485883){VoiceQueueReportEvents[_0x51fe('0x6')](_0x4db736+':'+_0x33fd35['id'],_0x33fd35);VoiceQueueReportEvents[_0x51fe('0x6')](_0x4db736,_0x33fd35);_0x485883(null);};}for(var e in events){if(events[_0x51fe('0x7')](e)){var event=events[e];VoiceQueueReport[_0x51fe('0x8')](e,emitEvent(event));}}module[_0x51fe('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x8bda=['VoiceQueueReport','setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x1a2d1c,_0x453573){var _0x2f8091=function(_0x5791d8){while(--_0x5791d8){_0x1a2d1c['push'](_0x1a2d1c['shift']());}};_0x2f8091(++_0x453573);}(_0x8bda,0x85));var _0xa8bd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x8bda[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0xa8bd('0x0'));var VoiceQueueReport=require(_0xa8bd('0x1'))['db'][_0xa8bd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa8bd('0x3')](0x0);var events={'afterCreate':_0xa8bd('0x4'),'afterUpdate':_0xa8bd('0x5'),'afterDestroy':'remove'};function emitEvent(_0x11f530){return function(_0x1c9f85,_0xc92078,_0x511aef){VoiceQueueReportEvents[_0xa8bd('0x6')](_0x11f530+':'+_0x1c9f85['id'],_0x1c9f85);VoiceQueueReportEvents[_0xa8bd('0x6')](_0x11f530,_0x1c9f85);_0x511aef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xa8bd('0x7')](e,emitEvent(event));}}module[_0xa8bd('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3ebbe7e..dc0c6b0 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 _0xbccb=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1807bd,_0x387eaf){var _0x492858=function(_0x5201b6){while(--_0x5201b6){_0x1807bd['push'](_0x1807bd['shift']());}};_0x492858(++_0x387eaf);}(_0xbccb,0x157));var _0xbbcc=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0xbccb[_0x18ea8a];return _0x19c99a;};'use strict';var _=require(_0xbbcc('0x0'));var util=require(_0xbbcc('0x1'));var logger=require(_0xbbcc('0x2'))(_0xbbcc('0x3'));var moment=require('moment');var BPromise=require(_0xbbcc('0x4'));var rp=require(_0xbbcc('0x5'));var fs=require('fs');var path=require(_0xbbcc('0x6'));var rimraf=require(_0xbbcc('0x7'));var config=require(_0xbbcc('0x8'));var attributes=require(_0xbbcc('0x9'));module[_0xbbcc('0xa')]=function(_0x2ddc03,_0x57f169){return _0x2ddc03[_0xbbcc('0xb')](_0xbbcc('0xc'),attributes,{'tableName':_0xbbcc('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbbcc('0xe')]},{'fields':[_0xbbcc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfd8=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x3d4e79,_0x63311b){var _0x208381=function(_0x1f15fd){while(--_0x1f15fd){_0x3d4e79['push'](_0x3d4e79['shift']());}};_0x208381(++_0x63311b);}(_0xbfd8,0x78));var _0x8bfd=function(_0x4f68ac,_0x26c135){_0x4f68ac=_0x4f68ac-0x0;var _0x44a1ff=_0xbfd8[_0x4f68ac];return _0x44a1ff;};'use strict';var _=require(_0x8bfd('0x0'));var util=require('util');var logger=require(_0x8bfd('0x1'))('api');var moment=require(_0x8bfd('0x2'));var BPromise=require(_0x8bfd('0x3'));var rp=require(_0x8bfd('0x4'));var fs=require('fs');var path=require(_0x8bfd('0x5'));var rimraf=require('rimraf');var config=require(_0x8bfd('0x6'));var attributes=require(_0x8bfd('0x7'));module[_0x8bfd('0x8')]=function(_0x164002,_0x52a4c0){return _0x164002[_0x8bfd('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x8bfd('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index edec43f..6c22c9f 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 _0x9258=['update','limit','lodash','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport'];(function(_0x85af20,_0xa1f51a){var _0x47c494=function(_0x2369fe){while(--_0x2369fe){_0x85af20['push'](_0x85af20['shift']());}};_0x47c494(++_0xa1f51a);}(_0x9258,0x158));var _0x8925=function(_0x216162,_0x5bec9e){_0x216162=_0x216162-0x0;var _0x32898c=_0x9258[_0x216162];return _0x32898c;};'use strict';var _=require(_0x8925('0x0'));var util=require('util');var moment=require(_0x8925('0x1'));var BPromise=require('bluebird');var rs=require(_0x8925('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8925('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8925('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8925('0x5'));var client=jayson[_0x8925('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8925('0x7')](config[_0x8925('0x8')],{'host':_0x8925('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8925('0x8')]));require(_0x8925('0xa'))[_0x8925('0xb')](socket);function respondWithRpcPromise(_0x462392,_0x511092,_0x2a43fa){return new BPromise(function(_0x52cf13,_0x23e316){return client[_0x8925('0xc')](_0x462392,_0x2a43fa)[_0x8925('0xd')](function(_0x53f5ab){logger[_0x8925('0xe')](_0x8925('0xf'),_0x511092,_0x8925('0x10'));logger[_0x8925('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x511092,_0x8925('0x10'),JSON['stringify'](_0x53f5ab));if(_0x53f5ab[_0x8925('0x12')]){if(_0x53f5ab[_0x8925('0x12')][_0x8925('0x13')]===0x1f4){logger[_0x8925('0x12')](_0x8925('0xf'),_0x511092,_0x53f5ab[_0x8925('0x12')][_0x8925('0x14')]);return _0x23e316(_0x53f5ab['error'][_0x8925('0x14')]);}logger[_0x8925('0x12')](_0x8925('0xf'),_0x511092,_0x53f5ab[_0x8925('0x12')][_0x8925('0x14')]);return _0x52cf13(_0x53f5ab[_0x8925('0x12')][_0x8925('0x14')]);}else{logger[_0x8925('0xe')](_0x8925('0xf'),_0x511092,'request\x20sent');_0x52cf13(_0x53f5ab[_0x8925('0x15')][_0x8925('0x14')]);}})[_0x8925('0x16')](function(_0x551fe4){logger[_0x8925('0x12')](_0x8925('0xf'),_0x511092,_0x551fe4);_0x23e316(_0x551fe4);});});}exports[_0x8925('0x17')]=function(_0x93400f){var _0xfc8a24=this;return new Promise(function(_0x26da9c,_0x117408){return db[_0x8925('0x18')][_0x8925('0x19')]({'raw':_0x93400f['options']?_0x93400f[_0x8925('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x93400f[_0x8925('0x1a')]?_0x93400f[_0x8925('0x1a')][_0x8925('0x1b')]||null:null,'attributes':_0x93400f['options']?_0x93400f['options'][_0x8925('0x1c')]||null:null,'limit':_0x93400f[_0x8925('0x1a')]?_0x93400f[_0x8925('0x1a')]['limit']||null:null,'include':_0x93400f[_0x8925('0x1a')]?_0x93400f[_0x8925('0x1a')][_0x8925('0x1d')]?_[_0x8925('0x1e')](_0x93400f['options']['include'],function(_0x2a9662){return{'model':db[_0x2a9662['model']],'as':_0x2a9662['as'],'attributes':_0x2a9662[_0x8925('0x1c')],'include':_0x2a9662[_0x8925('0x1d')]?_[_0x8925('0x1e')](_0x2a9662[_0x8925('0x1d')],function(_0x4d9161){return{'model':db[_0x4d9161[_0x8925('0x1f')]],'as':_0x4d9161['as'],'attributes':_0x4d9161[_0x8925('0x1c')],'include':_0x4d9161['include']?_['map'](_0x4d9161[_0x8925('0x1d')],function(_0xdfd962){return{'model':db[_0xdfd962['model']],'as':_0xdfd962['as'],'attributes':_0xdfd962[_0x8925('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8925('0xd')](function(_0x584629){logger[_0x8925('0xe')]('GetVoiceQueueReport',_0x93400f);logger[_0x8925('0x11')](_0x8925('0x17'),_0x93400f,JSON['stringify'](_0x584629));_0x26da9c(_0x584629);})[_0x8925('0x16')](function(_0x5966e7){logger[_0x8925('0x12')](_0x8925('0x17'),_0x5966e7[_0x8925('0x14')],_0x93400f);_0x117408(_0xfc8a24[_0x8925('0x12')](0x1f4,_0x5966e7[_0x8925('0x14')]));});});};exports[_0x8925('0x20')]=function(_0x5aae07){var _0x55c482=this;return new Promise(function(_0x173ec5,_0x1e289e){return db[_0x8925('0x18')][_0x8925('0x21')](_0x5aae07[_0x8925('0x22')],{'raw':_0x5aae07[_0x8925('0x1a')]?_0x5aae07[_0x8925('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8925('0xd')](function(_0x154d51){logger[_0x8925('0xe')](_0x8925('0x20'),_0x5aae07);logger[_0x8925('0x11')](_0x8925('0x20'),_0x5aae07,JSON['stringify'](_0x154d51));_0x173ec5(_0x154d51);})[_0x8925('0x16')](function(_0x47fa83){logger[_0x8925('0x12')](_0x8925('0x20'),_0x47fa83[_0x8925('0x14')],_0x5aae07);_0x1e289e(_0x55c482[_0x8925('0x12')](0x1f4,_0x47fa83[_0x8925('0x14')]));});});};exports[_0x8925('0x23')]=function(_0x3f386a){var _0x4498b4=this;return new Promise(function(_0xf27b90,_0x3d1931){return db[_0x8925('0x18')][_0x8925('0x24')](_0x3f386a[_0x8925('0x22')],{'raw':_0x3f386a[_0x8925('0x1a')]?_0x3f386a[_0x8925('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f386a['options']?_0x3f386a[_0x8925('0x1a')][_0x8925('0x1b')]||null:null,'attributes':_0x3f386a['options']?_0x3f386a[_0x8925('0x1a')][_0x8925('0x1c')]||null:null,'limit':_0x3f386a['options']?_0x3f386a[_0x8925('0x1a')][_0x8925('0x25')]||null:null})[_0x8925('0xd')](function(_0x53d8ec){logger['info'](_0x8925('0x23'),_0x3f386a);logger['debug']('UpdateVoiceQueueReport',_0x3f386a,JSON['stringify'](_0x53d8ec));_0xf27b90(_0x53d8ec);})['catch'](function(_0x20c987){logger[_0x8925('0x12')]('UpdateVoiceQueueReport',_0x20c987[_0x8925('0x14')],_0x3f386a);_0x3d1931(_0x4498b4[_0x8925('0x12')](0x1f4,_0x20c987['message']));});});}; \ No newline at end of file +var _0x7ee3=['VoiceQueueReport','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./voiceQueueReport.socket','register','request','then','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x40e83c,_0xec0246){var _0x3fbbea=function(_0x4a0535){while(--_0x4a0535){_0x40e83c['push'](_0x40e83c['shift']());}};_0x3fbbea(++_0xec0246);}(_0x7ee3,0x1bd));var _0x37ee=function(_0x434e6a,_0x21339b){_0x434e6a=_0x434e6a-0x0;var _0x154b69=_0x7ee3[_0x434e6a];return _0x154b69;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37ee('0x0'));var BPromise=require('bluebird');var rs=require(_0x37ee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x37ee('0x2'));var logger=require(_0x37ee('0x3'))(_0x37ee('0x4'));var config=require(_0x37ee('0x5'));var jayson=require(_0x37ee('0x6'));var client=jayson[_0x37ee('0x7')]['http']({'port':0x232a});config[_0x37ee('0x8')]=_[_0x37ee('0x9')](config[_0x37ee('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37ee('0x8')]));require(_0x37ee('0xa'))[_0x37ee('0xb')](socket);function respondWithRpcPromise(_0x512f1e,_0x1b020c,_0x1608b6){return new BPromise(function(_0x368a1d,_0x39066f){return client[_0x37ee('0xc')](_0x512f1e,_0x1608b6)[_0x37ee('0xd')](function(_0x43c59d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x1b020c,_0x37ee('0xe'));logger[_0x37ee('0xf')](_0x37ee('0x10'),_0x1b020c,_0x37ee('0xe'),JSON[_0x37ee('0x11')](_0x43c59d));if(_0x43c59d[_0x37ee('0x12')]){if(_0x43c59d[_0x37ee('0x12')][_0x37ee('0x13')]===0x1f4){logger[_0x37ee('0x12')](_0x37ee('0x14'),_0x1b020c,_0x43c59d[_0x37ee('0x12')][_0x37ee('0x15')]);return _0x39066f(_0x43c59d[_0x37ee('0x12')]['message']);}logger['error'](_0x37ee('0x14'),_0x1b020c,_0x43c59d[_0x37ee('0x12')][_0x37ee('0x15')]);return _0x368a1d(_0x43c59d['error'][_0x37ee('0x15')]);}else{logger[_0x37ee('0x16')](_0x37ee('0x14'),_0x1b020c,_0x37ee('0xe'));_0x368a1d(_0x43c59d[_0x37ee('0x17')][_0x37ee('0x15')]);}})[_0x37ee('0x18')](function(_0x5827c4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1b020c,_0x5827c4);_0x39066f(_0x5827c4);});});}exports[_0x37ee('0x19')]=function(_0x338014){var _0x37775d=this;return new Promise(function(_0x51ccd7,_0x4062f2){return db['VoiceQueueReport'][_0x37ee('0x1a')]({'raw':_0x338014[_0x37ee('0x1b')]?_0x338014['options'][_0x37ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x338014['options']?_0x338014[_0x37ee('0x1b')][_0x37ee('0x1d')]||null:null,'attributes':_0x338014['options']?_0x338014[_0x37ee('0x1b')][_0x37ee('0x1e')]||null:null,'limit':_0x338014[_0x37ee('0x1b')]?_0x338014['options'][_0x37ee('0x1f')]||null:null,'include':_0x338014[_0x37ee('0x1b')]?_0x338014['options'][_0x37ee('0x20')]?_[_0x37ee('0x21')](_0x338014[_0x37ee('0x1b')][_0x37ee('0x20')],function(_0x3f489f){return{'model':db[_0x3f489f[_0x37ee('0x22')]],'as':_0x3f489f['as'],'attributes':_0x3f489f[_0x37ee('0x1e')],'include':_0x3f489f[_0x37ee('0x20')]?_[_0x37ee('0x21')](_0x3f489f['include'],function(_0x32863f){return{'model':db[_0x32863f['model']],'as':_0x32863f['as'],'attributes':_0x32863f[_0x37ee('0x1e')],'include':_0x32863f['include']?_[_0x37ee('0x21')](_0x32863f['include'],function(_0x309f7f){return{'model':db[_0x309f7f[_0x37ee('0x22')]],'as':_0x309f7f['as'],'attributes':_0x309f7f[_0x37ee('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x37ee('0xd')](function(_0x4f4679){logger[_0x37ee('0x16')](_0x37ee('0x19'),_0x338014);logger[_0x37ee('0xf')](_0x37ee('0x19'),_0x338014,JSON[_0x37ee('0x11')](_0x4f4679));_0x51ccd7(_0x4f4679);})[_0x37ee('0x18')](function(_0x31962f){logger[_0x37ee('0x12')](_0x37ee('0x19'),_0x31962f[_0x37ee('0x15')],_0x338014);_0x4062f2(_0x37775d[_0x37ee('0x12')](0x1f4,_0x31962f[_0x37ee('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0xfa99bb){var _0x37d94d=this;return new Promise(function(_0x36fafa,_0x3ca6c7){return db[_0x37ee('0x23')]['create'](_0xfa99bb[_0x37ee('0x24')],{'raw':_0xfa99bb['options']?_0xfa99bb[_0x37ee('0x1b')][_0x37ee('0x1c')]===undefined?!![]:![]:!![]})[_0x37ee('0xd')](function(_0x3750f7){logger[_0x37ee('0x16')]('CreateVoiceQueueReport',_0xfa99bb);logger['debug'](_0x37ee('0x25'),_0xfa99bb,JSON[_0x37ee('0x11')](_0x3750f7));_0x36fafa(_0x3750f7);})[_0x37ee('0x18')](function(_0x18715a){logger[_0x37ee('0x12')](_0x37ee('0x25'),_0x18715a['message'],_0xfa99bb);_0x3ca6c7(_0x37d94d[_0x37ee('0x12')](0x1f4,_0x18715a['message']));});});};exports[_0x37ee('0x26')]=function(_0x548bdf){var _0x354fe7=this;return new Promise(function(_0x34bf70,_0x1bf9f9){return db[_0x37ee('0x23')][_0x37ee('0x27')](_0x548bdf[_0x37ee('0x24')],{'raw':_0x548bdf['options']?_0x548bdf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x548bdf[_0x37ee('0x1b')]?_0x548bdf[_0x37ee('0x1b')]['where']||null:null,'attributes':_0x548bdf[_0x37ee('0x1b')]?_0x548bdf[_0x37ee('0x1b')]['attributes']||null:null,'limit':_0x548bdf[_0x37ee('0x1b')]?_0x548bdf[_0x37ee('0x1b')][_0x37ee('0x1f')]||null:null})['then'](function(_0x3ee110){logger[_0x37ee('0x16')](_0x37ee('0x26'),_0x548bdf);logger['debug'](_0x37ee('0x26'),_0x548bdf,JSON['stringify'](_0x3ee110));_0x34bf70(_0x3ee110);})[_0x37ee('0x18')](function(_0x1ae9ce){logger[_0x37ee('0x12')](_0x37ee('0x26'),_0x1ae9ce['message'],_0x548bdf);_0x1bf9f9(_0x354fe7[_0x37ee('0x12')](0x1f4,_0x1ae9ce[_0x37ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1d2d2cc..afa6438 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 _0x8b2d=['voiceQueueReport:','remove','emit','removeListener','register','length'];(function(_0x53be3a,_0x2b02d5){var _0x5e347e=function(_0x2f94ba){while(--_0x2f94ba){_0x53be3a['push'](_0x53be3a['shift']());}};_0x5e347e(++_0x2b02d5);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x240ad5,_0x5e125b){_0x240ad5=_0x240ad5-0x0;var _0x9cc8f5=_0x8b2d[_0x240ad5];return _0x9cc8f5;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xd8b2('0x0'),'update'];function createListener(_0x3007a6,_0x429708){return function(_0x4d922e){_0x429708[_0xd8b2('0x1')](_0x3007a6,_0x4d922e);};}function removeListener(_0x3a7304,_0x55a03c){return function(){VoiceQueueReportEvents[_0xd8b2('0x2')](_0x3a7304,_0x55a03c);};}exports[_0xd8b2('0x3')]=function(_0x36eb23){for(var _0x282a58=0x0,_0x1c78f6=events[_0xd8b2('0x4')];_0x282a58<_0x1c78f6;_0x282a58++){var _0x42fe49=events[_0x282a58];var _0x210fe2=createListener(_0xd8b2('0x5')+_0x42fe49,_0x36eb23);VoiceQueueReportEvents['on'](_0x42fe49,_0x210fe2);}}; \ No newline at end of file +var _0x9491=['./voiceQueueReport.events','save','remove','update','emit','register','voiceQueueReport:'];(function(_0x3537ca,_0x12d0a4){var _0x20233e=function(_0x439557){while(--_0x439557){_0x3537ca['push'](_0x3537ca['shift']());}};_0x20233e(++_0x12d0a4);}(_0x9491,0xb6));var _0x1949=function(_0x46983d,_0x48398e){_0x46983d=_0x46983d-0x0;var _0x2c960e=_0x9491[_0x46983d];return _0x2c960e;};'use strict';var VoiceQueueReportEvents=require(_0x1949('0x0'));var events=[_0x1949('0x1'),_0x1949('0x2'),_0x1949('0x3')];function createListener(_0x46e060,_0x1f05db){return function(_0x28621a){_0x1f05db[_0x1949('0x4')](_0x46e060,_0x28621a);};}function removeListener(_0x4270d7,_0x358907){return function(){VoiceQueueReportEvents['removeListener'](_0x4270d7,_0x358907);};}exports[_0x1949('0x5')]=function(_0x5b01b9){for(var _0x14c30e=0x0,_0x2d39a3=events['length'];_0x14c30e<_0x2d39a3;_0x14c30e++){var _0x28b2b6=events[_0x14c30e];var _0x3665b6=createListener(_0x1949('0x6')+_0x28b2b6,_0x5b01b9);VoiceQueueReportEvents['on'](_0x28b2b6,_0x3665b6);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 42e8b0f..b69e4e1 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 _0xb6b5=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xb6b5,0x1d5));var _0x5b6b=function(_0x5833e7,_0x3d3958){_0x5833e7=_0x5833e7-0x0;var _0x5778a5=_0xb6b5[_0x5833e7];return _0x5778a5;};'use strict';var multer=require(_0x5b6b('0x0'));var util=require(_0x5b6b('0x1'));var path=require(_0x5b6b('0x2'));var timeout=require(_0x5b6b('0x3'));var express=require(_0x5b6b('0x4'));var router=express[_0x5b6b('0x5')]();var fs_extra=require(_0x5b6b('0x6'));var auth=require(_0x5b6b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5b6b('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x5b6b('0x9')]('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b6b('0xc')]);router['post']('/',auth[_0x5b6b('0xa')](),controller[_0x5b6b('0xd')]);router[_0x5b6b('0xe')](_0x5b6b('0xf'),auth[_0x5b6b('0xa')](),controller[_0x5b6b('0x10')]);router[_0x5b6b('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5b6b('0x12')]=router; \ No newline at end of file +var _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','create','put','update','destroy','util'];(function(_0x264659,_0x3d244d){var _0x208738=function(_0xe5ae37){while(--_0xe5ae37){_0x264659['push'](_0x264659['shift']());}};_0x208738(++_0x3d244d);}(_0x958a,0x192));var _0xa958=function(_0x1402eb,_0x401a43){_0x1402eb=_0x1402eb-0x0;var _0xeed810=_0x958a[_0x1402eb];return _0xeed810;};'use strict';var multer=require('multer');var util=require(_0xa958('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa958('0x1')]();var fs_extra=require(_0xa958('0x2'));var auth=require(_0xa958('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x4'));var controller=require(_0xa958('0x5'));router[_0xa958('0x6')]('/',auth[_0xa958('0x7')](),controller['index']);router[_0xa958('0x6')](_0xa958('0x8'),auth[_0xa958('0x7')](),controller['show']);router['post']('/',auth[_0xa958('0x7')](),controller[_0xa958('0x9')]);router[_0xa958('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa958('0xb')]);router['delete']('/:id',auth[_0xa958('0x7')](),controller[_0xa958('0xc')]);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 feba245..384ab2f 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 _0x6eed=['sequelize','moment','exports','STRING','DATE'];(function(_0x5b81b5,_0x4c67e0){var _0x40a175=function(_0x12cb43){while(--_0x12cb43){_0x5b81b5['push'](_0x5b81b5['shift']());}};_0x40a175(++_0x4c67e0);}(_0x6eed,0xff));var _0xd6ee=function(_0x2b3567,_0x4beff3){_0x2b3567=_0x2b3567-0x0;var _0x29f24a=_0x6eed[_0x2b3567];return _0x29f24a;};'use strict';var Sequelize=require(_0xd6ee('0x0'));var moment=require(_0xd6ee('0x1'));module[_0xd6ee('0x2')]={'time':{'type':Sequelize[_0xd6ee('0x3')]},'callid':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd6ee('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd6ee('0x4')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0xf59d=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf59d,0x95));var _0xdf59=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xf59d[_0x142ec2];return _0x45ef4e;};'use strict';var Sequelize=require(_0xdf59('0x0'));var moment=require(_0xdf59('0x1'));module[_0xdf59('0x2')]={'time':{'type':Sequelize[_0xdf59('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xdf59('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xdf59('0x4')],'allowNull':![],'defaultValue':moment()[_0xdf59('0x5')](_0xdf59('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b0a76a6..460469a 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 _0x1691=['fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','create','body','catch','update','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../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','save','destroy','then','stack','send','index','map','VoiceQueuesLog','rawAttributes'];(function(_0x82e71a,_0x2f5f68){var _0x34a5d4=function(_0x5eaec6){while(--_0x5eaec6){_0x82e71a['push'](_0x82e71a['shift']());}};_0x34a5d4(++_0x2f5f68);}(_0x1691,0xf6));var _0x1169=function(_0x13e6a7,_0x292781){_0x13e6a7=_0x13e6a7-0x0;var _0x2f9454=_0x1691[_0x13e6a7];return _0x2f9454;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1169('0x0'));var zipdir=require(_0x1169('0x1'));var jsonpatch=require(_0x1169('0x2'));var rp=require('request-promise');var moment=require(_0x1169('0x3'));var BPromise=require(_0x1169('0x4'));var Mustache=require('mustache');var util=require(_0x1169('0x5'));var path=require(_0x1169('0x6'));var sox=require('sox');var csv=require(_0x1169('0x7'));var ejs=require(_0x1169('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1169('0x9'));var crypto=require(_0x1169('0xa'));var jsforce=require(_0x1169('0xb'));var deskjs=require(_0x1169('0xc'));var toCsv=require(_0x1169('0x7'));var querystring=require('querystring');var Papa=require(_0x1169('0xd'));var Redis=require(_0x1169('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1169('0xf'));var as=require(_0x1169('0x10'));var hardwareService=require(_0x1169('0x11'));var logger=require(_0x1169('0x12'))(_0x1169('0x13'));var utils=require('../../config/utils');var config=require(_0x1169('0x14'));var licenseUtil=require(_0x1169('0x15'));var db=require(_0x1169('0x16'))['db'];function respondWithStatusCode(_0x419554,_0x2d2821){_0x2d2821=_0x2d2821||0xcc;return function(_0x391e26){if(_0x391e26){return _0x419554[_0x1169('0x17')](_0x2d2821);}return _0x419554['status'](_0x2d2821)[_0x1169('0x18')]();};}function respondWithResult(_0xb3314c,_0x3af9dd){_0x3af9dd=_0x3af9dd||0xc8;return function(_0x1ebc92){if(_0x1ebc92){return _0xb3314c[_0x1169('0x19')](_0x3af9dd)[_0x1169('0x1a')](_0x1ebc92);}};}function respondWithFilteredResult(_0x5904a3,_0x335c88){return function(_0x836986){if(_0x836986){var _0x3ca35d=typeof _0x335c88[_0x1169('0x1b')]===_0x1169('0x1c')&&typeof _0x335c88['limit']===_0x1169('0x1c');var _0x4e62a1=_0x836986[_0x1169('0x1d')];var _0x3f076a=_0x3ca35d?0x0:_0x335c88[_0x1169('0x1b')];var _0x3fcbc0=_0x3ca35d?_0x836986[_0x1169('0x1d')]:_0x335c88[_0x1169('0x1b')]+_0x335c88[_0x1169('0x1e')];var _0x3dded1;if(_0x3fcbc0>=_0x4e62a1){_0x3fcbc0=_0x4e62a1;_0x3dded1=0xc8;}else{_0x3dded1=0xce;}_0x5904a3[_0x1169('0x19')](_0x3dded1);return _0x5904a3[_0x1169('0x1f')](_0x1169('0x20'),_0x3f076a+'-'+_0x3fcbc0+'/'+_0x4e62a1)['json'](_0x836986);}return null;};}function patchUpdates(_0x2ddd9d){return function(_0x178692){try{jsonpatch['apply'](_0x178692,_0x2ddd9d,!![]);}catch(_0x48b63f){return BPromise['reject'](_0x48b63f);}return _0x178692[_0x1169('0x21')]();};}function saveUpdates(_0x4c8f3,_0x2ad4d6){return function(_0x2625c7){if(_0x2625c7){return _0x2625c7['update'](_0x4c8f3)['then'](function(_0x43510b){return _0x43510b;});}return null;};}function removeEntity(_0x3a5234,_0x4fe948){return function(_0x327da4){if(_0x327da4){return _0x327da4[_0x1169('0x22')]()[_0x1169('0x23')](function(){_0x3a5234[_0x1169('0x19')](0xcc)[_0x1169('0x18')]();});}};}function handleEntityNotFound(_0x5725ac,_0x2596c2){return function(_0x1184c9){if(!_0x1184c9){_0x5725ac[_0x1169('0x17')](0x194);}return _0x1184c9;};}function handleError(_0x2489a0,_0x5771c9){_0x5771c9=_0x5771c9||0x1f4;return function(_0xfd5054){logger['error'](_0xfd5054[_0x1169('0x24')]);if(_0xfd5054['name']){delete _0xfd5054['name'];}_0x2489a0[_0x1169('0x19')](_0x5771c9)[_0x1169('0x25')](_0xfd5054);};}exports[_0x1169('0x26')]=function(_0x14b0c6,_0x36d806){var _0x5e77cf={},_0x570b24={},_0x10b632={'count':0x0,'rows':[]};var _0x3592a8=_[_0x1169('0x27')](db[_0x1169('0x28')][_0x1169('0x29')],function(_0x305648){return{'name':_0x305648[_0x1169('0x2a')],'type':_0x305648[_0x1169('0x2b')][_0x1169('0x2c')]};});_0x570b24[_0x1169('0x2d')]=_['map'](_0x3592a8,_0x1169('0x2e'));_0x570b24[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x14b0c6[_0x1169('0x2f')]);_0x570b24[_0x1169('0x31')]=_[_0x1169('0x32')](_0x570b24['model'],_0x570b24[_0x1169('0x2f')]);_0x5e77cf[_0x1169('0x33')]=_[_0x1169('0x32')](_0x570b24['model'],qs[_0x1169('0x34')](_0x14b0c6[_0x1169('0x2f')][_0x1169('0x34')]));_0x5e77cf[_0x1169('0x33')]=_0x5e77cf['attributes']['length']?_0x5e77cf[_0x1169('0x33')]:_0x570b24[_0x1169('0x2d')];if(!_0x14b0c6[_0x1169('0x2f')]['hasOwnProperty'](_0x1169('0x35'))){_0x5e77cf[_0x1169('0x1e')]=qs[_0x1169('0x1e')](_0x14b0c6['query']['limit']);_0x5e77cf[_0x1169('0x1b')]=qs[_0x1169('0x1b')](_0x14b0c6['query']['offset']);}_0x5e77cf['order']=qs[_0x1169('0x36')](_0x14b0c6[_0x1169('0x2f')][_0x1169('0x36')]);_0x5e77cf[_0x1169('0x37')]=qs['filters'](_[_0x1169('0x38')](_0x14b0c6['query'],_0x570b24[_0x1169('0x31')]),_0x3592a8);if(_0x14b0c6[_0x1169('0x2f')][_0x1169('0x39')]){_0x5e77cf[_0x1169('0x37')]=_[_0x1169('0x3a')](_0x5e77cf[_0x1169('0x37')],{'$or':_[_0x1169('0x27')](_0x3592a8,function(_0x30a8ec){if(_0x30a8ec[_0x1169('0x2b')]!==_0x1169('0x3b')){var _0x376ada={};_0x376ada[_0x30a8ec['name']]={'$like':'%'+_0x14b0c6[_0x1169('0x2f')][_0x1169('0x39')]+'%'};return _0x376ada;}})});}_0x5e77cf=_['merge']({},_0x5e77cf,_0x14b0c6[_0x1169('0x3c')]);var _0x9aaa86={'where':_0x5e77cf[_0x1169('0x37')]};return db[_0x1169('0x28')][_0x1169('0x1d')](_0x9aaa86)['then'](function(_0x172520){_0x10b632[_0x1169('0x1d')]=_0x172520;if(_0x14b0c6[_0x1169('0x2f')]['includeAll']){_0x5e77cf[_0x1169('0x3d')]=[{'all':!![]}];}return db[_0x1169('0x28')][_0x1169('0x3e')](_0x5e77cf);})['then'](function(_0x493e60){_0x10b632['rows']=_0x493e60;return _0x10b632;})[_0x1169('0x23')](respondWithFilteredResult(_0x36d806,_0x5e77cf))['catch'](handleError(_0x36d806,null));};exports[_0x1169('0x3f')]=function(_0x43e240,_0xb73415){var _0x399d73={'raw':!![],'where':{'id':_0x43e240[_0x1169('0x40')]['id']}},_0x133fc2={};_0x133fc2[_0x1169('0x2d')]=_['keys'](db['VoiceQueuesLog'][_0x1169('0x29')]);_0x133fc2[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x43e240['query']);_0x133fc2[_0x1169('0x31')]=_['intersection'](_0x133fc2['model'],_0x133fc2[_0x1169('0x2f')]);_0x399d73[_0x1169('0x33')]=_['intersection'](_0x133fc2['model'],qs[_0x1169('0x34')](_0x43e240[_0x1169('0x2f')]['fields']));_0x399d73[_0x1169('0x33')]=_0x399d73[_0x1169('0x33')][_0x1169('0x41')]?_0x399d73['attributes']:_0x133fc2[_0x1169('0x2d')];if(_0x43e240[_0x1169('0x2f')][_0x1169('0x42')]){_0x399d73['include']=[{'all':!![]}];}_0x399d73=_[_0x1169('0x3a')]({},_0x399d73,_0x43e240[_0x1169('0x3c')]);return db[_0x1169('0x28')][_0x1169('0x43')](_0x399d73)[_0x1169('0x23')](handleEntityNotFound(_0xb73415,null))['then'](respondWithResult(_0xb73415,null))['catch'](handleError(_0xb73415,null));};exports['create']=function(_0x5dd8a5,_0x4af2a4){return db[_0x1169('0x28')][_0x1169('0x44')](_0x5dd8a5[_0x1169('0x45')],{})[_0x1169('0x23')](respondWithResult(_0x4af2a4,0xc9))[_0x1169('0x46')](handleError(_0x4af2a4,null));};exports[_0x1169('0x47')]=function(_0x55f437,_0x54e627){if(_0x55f437[_0x1169('0x45')]['id']){delete _0x55f437[_0x1169('0x45')]['id'];}return db[_0x1169('0x28')]['find']({'where':{'id':_0x55f437[_0x1169('0x40')]['id']}})['then'](handleEntityNotFound(_0x54e627,null))[_0x1169('0x23')](saveUpdates(_0x55f437[_0x1169('0x45')],null))[_0x1169('0x23')](respondWithResult(_0x54e627,null))[_0x1169('0x46')](handleError(_0x54e627,null));};exports[_0x1169('0x22')]=function(_0x178fc5,_0x470216){return db['VoiceQueuesLog'][_0x1169('0x43')]({'where':{'id':_0x178fc5['params']['id']}})[_0x1169('0x23')](handleEntityNotFound(_0x470216,null))['then'](removeEntity(_0x470216,null))[_0x1169('0x46')](handleError(_0x470216,null));}; \ No newline at end of file +var _0x6f87=['VoiceQueuesLog','includeAll','include','rows','catch','show','params','model','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','map','fieldName','key','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','type','filter','merge','options'];(function(_0x3337e1,_0x457b42){var _0x1dbff5=function(_0x3b1871){while(--_0x3b1871){_0x3337e1['push'](_0x3337e1['shift']());}};_0x1dbff5(++_0x457b42);}(_0x6f87,0x188));var _0x76f8=function(_0x16ea41,_0xbf2c3a){_0x16ea41=_0x16ea41-0x0;var _0xad8361=_0x6f87[_0x16ea41];return _0xad8361;};'use strict';var emlformat=require(_0x76f8('0x0'));var rimraf=require(_0x76f8('0x1'));var zipdir=require(_0x76f8('0x2'));var jsonpatch=require(_0x76f8('0x3'));var rp=require(_0x76f8('0x4'));var moment=require(_0x76f8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x76f8('0x6'));var util=require('util');var path=require(_0x76f8('0x7'));var sox=require(_0x76f8('0x8'));var csv=require('to-csv');var ejs=require(_0x76f8('0x9'));var fs=require('fs');var fs_extra=require(_0x76f8('0xa'));var _=require(_0x76f8('0xb'));var squel=require(_0x76f8('0xc'));var crypto=require(_0x76f8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x76f8('0xe'));var toCsv=require(_0x76f8('0xf'));var querystring=require(_0x76f8('0x10'));var Papa=require(_0x76f8('0x11'));var Redis=require(_0x76f8('0x12'));var authService=require(_0x76f8('0x13'));var qs=require(_0x76f8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x76f8('0x15'));var logger=require('../../config/logger')(_0x76f8('0x16'));var utils=require(_0x76f8('0x17'));var config=require(_0x76f8('0x18'));var licenseUtil=require(_0x76f8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e11fe,_0xb4b688){_0xb4b688=_0xb4b688||0xcc;return function(_0x24fc41){if(_0x24fc41){return _0x1e11fe[_0x76f8('0x1a')](_0xb4b688);}return _0x1e11fe['status'](_0xb4b688)[_0x76f8('0x1b')]();};}function respondWithResult(_0x153d45,_0x3b76bb){_0x3b76bb=_0x3b76bb||0xc8;return function(_0x49fefc){if(_0x49fefc){return _0x153d45[_0x76f8('0x1c')](_0x3b76bb)[_0x76f8('0x1d')](_0x49fefc);}};}function respondWithFilteredResult(_0x219615,_0x26cc9c){return function(_0x2cfb9c){if(_0x2cfb9c){var _0x54bf83=typeof _0x26cc9c[_0x76f8('0x1e')]===_0x76f8('0x1f')&&typeof _0x26cc9c[_0x76f8('0x20')]===_0x76f8('0x1f');var _0x4518a8=_0x2cfb9c[_0x76f8('0x21')];var _0x5589e7=_0x54bf83?0x0:_0x26cc9c[_0x76f8('0x1e')];var _0x4335c9=_0x54bf83?_0x2cfb9c[_0x76f8('0x21')]:_0x26cc9c['offset']+_0x26cc9c[_0x76f8('0x20')];var _0x2481b5;if(_0x4335c9>=_0x4518a8){_0x4335c9=_0x4518a8;_0x2481b5=0xc8;}else{_0x2481b5=0xce;}_0x219615['status'](_0x2481b5);return _0x219615[_0x76f8('0x22')](_0x76f8('0x23'),_0x5589e7+'-'+_0x4335c9+'/'+_0x4518a8)[_0x76f8('0x1d')](_0x2cfb9c);}return null;};}function patchUpdates(_0x140a87){return function(_0x45d040){try{jsonpatch[_0x76f8('0x24')](_0x45d040,_0x140a87,!![]);}catch(_0xf1b7f3){return BPromise['reject'](_0xf1b7f3);}return _0x45d040[_0x76f8('0x25')]();};}function saveUpdates(_0x4beed4,_0x39a59f){return function(_0x5ca835){if(_0x5ca835){return _0x5ca835[_0x76f8('0x26')](_0x4beed4)['then'](function(_0x13340f){return _0x13340f;});}return null;};}function removeEntity(_0x4eb4bd,_0x576d8c){return function(_0x4694b1){if(_0x4694b1){return _0x4694b1[_0x76f8('0x27')]()[_0x76f8('0x28')](function(){_0x4eb4bd[_0x76f8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275470,_0x8b6a77){return function(_0x20bb04){if(!_0x20bb04){_0x275470[_0x76f8('0x1a')](0x194);}return _0x20bb04;};}function handleError(_0x5b30fd,_0x16d3b1){_0x16d3b1=_0x16d3b1||0x1f4;return function(_0x1b9d6a){logger[_0x76f8('0x29')](_0x1b9d6a[_0x76f8('0x2a')]);if(_0x1b9d6a[_0x76f8('0x2b')]){delete _0x1b9d6a['name'];}_0x5b30fd['status'](_0x16d3b1)[_0x76f8('0x2c')](_0x1b9d6a);};}exports['index']=function(_0x18bd55,_0x26409a){var _0x4c69fb={},_0x21bfa2={},_0x38ed27={'count':0x0,'rows':[]};var _0x354b55=_[_0x76f8('0x2d')](db['VoiceQueuesLog']['rawAttributes'],function(_0x18a758){return{'name':_0x18a758[_0x76f8('0x2e')],'type':_0x18a758['type'][_0x76f8('0x2f')]};});_0x21bfa2['model']=_[_0x76f8('0x2d')](_0x354b55,_0x76f8('0x2b'));_0x21bfa2[_0x76f8('0x30')]=_[_0x76f8('0x31')](_0x18bd55[_0x76f8('0x30')]);_0x21bfa2['filters']=_[_0x76f8('0x32')](_0x21bfa2['model'],_0x21bfa2[_0x76f8('0x30')]);_0x4c69fb['attributes']=_[_0x76f8('0x32')](_0x21bfa2['model'],qs[_0x76f8('0x33')](_0x18bd55[_0x76f8('0x30')]['fields']));_0x4c69fb[_0x76f8('0x34')]=_0x4c69fb['attributes'][_0x76f8('0x35')]?_0x4c69fb[_0x76f8('0x34')]:_0x21bfa2['model'];if(!_0x18bd55[_0x76f8('0x30')][_0x76f8('0x36')]('nolimit')){_0x4c69fb[_0x76f8('0x20')]=qs[_0x76f8('0x20')](_0x18bd55[_0x76f8('0x30')]['limit']);_0x4c69fb[_0x76f8('0x1e')]=qs[_0x76f8('0x1e')](_0x18bd55[_0x76f8('0x30')]['offset']);}_0x4c69fb[_0x76f8('0x37')]=qs[_0x76f8('0x38')](_0x18bd55[_0x76f8('0x30')][_0x76f8('0x38')]);_0x4c69fb[_0x76f8('0x39')]=qs['filters'](_[_0x76f8('0x3a')](_0x18bd55[_0x76f8('0x30')],_0x21bfa2[_0x76f8('0x3b')]),_0x354b55);if(_0x18bd55[_0x76f8('0x30')]['filter']){_0x4c69fb[_0x76f8('0x39')]=_['merge'](_0x4c69fb[_0x76f8('0x39')],{'$or':_[_0x76f8('0x2d')](_0x354b55,function(_0x4ee0c7){if(_0x4ee0c7[_0x76f8('0x3c')]!=='VIRTUAL'){var _0x450473={};_0x450473[_0x4ee0c7[_0x76f8('0x2b')]]={'$like':'%'+_0x18bd55['query'][_0x76f8('0x3d')]+'%'};return _0x450473;}})});}_0x4c69fb=_[_0x76f8('0x3e')]({},_0x4c69fb,_0x18bd55[_0x76f8('0x3f')]);var _0xfaeb9b={'where':_0x4c69fb[_0x76f8('0x39')]};return db[_0x76f8('0x40')][_0x76f8('0x21')](_0xfaeb9b)['then'](function(_0x437d95){_0x38ed27['count']=_0x437d95;if(_0x18bd55[_0x76f8('0x30')][_0x76f8('0x41')]){_0x4c69fb[_0x76f8('0x42')]=[{'all':!![]}];}return db[_0x76f8('0x40')]['findAll'](_0x4c69fb);})[_0x76f8('0x28')](function(_0x27a593){_0x38ed27[_0x76f8('0x43')]=_0x27a593;return _0x38ed27;})[_0x76f8('0x28')](respondWithFilteredResult(_0x26409a,_0x4c69fb))[_0x76f8('0x44')](handleError(_0x26409a,null));};exports[_0x76f8('0x45')]=function(_0x538e6a,_0x3a3e40){var _0x4595c3={'raw':!![],'where':{'id':_0x538e6a[_0x76f8('0x46')]['id']}},_0x38b568={};_0x38b568[_0x76f8('0x47')]=_[_0x76f8('0x31')](db[_0x76f8('0x40')][_0x76f8('0x48')]);_0x38b568[_0x76f8('0x30')]=_['keys'](_0x538e6a[_0x76f8('0x30')]);_0x38b568[_0x76f8('0x3b')]=_[_0x76f8('0x32')](_0x38b568[_0x76f8('0x47')],_0x38b568['query']);_0x4595c3[_0x76f8('0x34')]=_[_0x76f8('0x32')](_0x38b568[_0x76f8('0x47')],qs['fields'](_0x538e6a[_0x76f8('0x30')]['fields']));_0x4595c3[_0x76f8('0x34')]=_0x4595c3[_0x76f8('0x34')][_0x76f8('0x35')]?_0x4595c3[_0x76f8('0x34')]:_0x38b568[_0x76f8('0x47')];if(_0x538e6a[_0x76f8('0x30')][_0x76f8('0x41')]){_0x4595c3['include']=[{'all':!![]}];}_0x4595c3=_[_0x76f8('0x3e')]({},_0x4595c3,_0x538e6a[_0x76f8('0x3f')]);return db['VoiceQueuesLog'][_0x76f8('0x49')](_0x4595c3)[_0x76f8('0x28')](handleEntityNotFound(_0x3a3e40,null))[_0x76f8('0x28')](respondWithResult(_0x3a3e40,null))[_0x76f8('0x44')](handleError(_0x3a3e40,null));};exports[_0x76f8('0x4a')]=function(_0x3d4163,_0x271d46){return db[_0x76f8('0x40')][_0x76f8('0x4a')](_0x3d4163[_0x76f8('0x4b')],{})[_0x76f8('0x28')](respondWithResult(_0x271d46,0xc9))[_0x76f8('0x44')](handleError(_0x271d46,null));};exports[_0x76f8('0x26')]=function(_0x2d9db5,_0x1a60c4){if(_0x2d9db5[_0x76f8('0x4b')]['id']){delete _0x2d9db5[_0x76f8('0x4b')]['id'];}return db[_0x76f8('0x40')][_0x76f8('0x49')]({'where':{'id':_0x2d9db5[_0x76f8('0x46')]['id']}})[_0x76f8('0x28')](handleEntityNotFound(_0x1a60c4,null))[_0x76f8('0x28')](saveUpdates(_0x2d9db5['body'],null))['then'](respondWithResult(_0x1a60c4,null))[_0x76f8('0x44')](handleError(_0x1a60c4,null));};exports[_0x76f8('0x27')]=function(_0x50c69f,_0x3cd511){return db[_0x76f8('0x40')][_0x76f8('0x49')]({'where':{'id':_0x50c69f[_0x76f8('0x46')]['id']}})[_0x76f8('0x28')](handleEntityNotFound(_0x3cd511,null))[_0x76f8('0x28')](removeEntity(_0x3cd511,null))[_0x76f8('0x44')](handleError(_0x3cd511,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 42a17c1..849acf4 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 _0x802c=['dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x5515e6,_0x41ae15){var _0x15af53=function(_0x361dc1){while(--_0x361dc1){_0x5515e6['push'](_0x5515e6['shift']());}};_0x15af53(++_0x41ae15);}(_0x802c,0xd1));var _0xc802=function(_0x4958fe,_0x34eaa0){_0x4958fe=_0x4958fe-0x0;var _0x51ff32=_0x802c[_0x4958fe];return _0x51ff32;};'use strict';var _=require(_0xc802('0x0'));var util=require(_0xc802('0x1'));var logger=require(_0xc802('0x2'))(_0xc802('0x3'));var moment=require(_0xc802('0x4'));var BPromise=require(_0xc802('0x5'));var rp=require(_0xc802('0x6'));var fs=require('fs');var path=require(_0xc802('0x7'));var rimraf=require(_0xc802('0x8'));var config=require('../../config/environment');var attributes=require(_0xc802('0x9'));module[_0xc802('0xa')]=function(_0x45da20,_0x450195){return _0x45da20['define'](_0xc802('0xb'),attributes,{'tableName':_0xc802('0xc'),'paranoid':![],'indexes':[{'name':_0xc802('0xd'),'fields':[_0xc802('0xe'),_0xc802('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x32d1=['request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','lodash','util','../../config/logger','api','bluebird'];(function(_0x2e684f,_0x82e184){var _0x46f806=function(_0x5422d7){while(--_0x5422d7){_0x2e684f['push'](_0x2e684f['shift']());}};_0x46f806(++_0x82e184);}(_0x32d1,0x1ae));var _0x132d=function(_0x2e4c5b,_0xae6e84){_0x2e4c5b=_0x2e4c5b-0x0;var _0x2860a2=_0x32d1[_0x2e4c5b];return _0x2860a2;};'use strict';var _=require(_0x132d('0x0'));var util=require(_0x132d('0x1'));var logger=require(_0x132d('0x2'))(_0x132d('0x3'));var moment=require('moment');var BPromise=require(_0x132d('0x4'));var rp=require(_0x132d('0x5'));var fs=require('fs');var path=require(_0x132d('0x6'));var rimraf=require(_0x132d('0x7'));var config=require('../../config/environment');var attributes=require(_0x132d('0x8'));module[_0x132d('0x9')]=function(_0x34f7d7,_0x1937bf){return _0x34f7d7[_0x132d('0xa')](_0x132d('0xb'),attributes,{'tableName':_0x132d('0xc'),'paranoid':![],'indexes':[{'name':_0x132d('0xd'),'fields':[_0x132d('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index e75332c..99d9941 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 _0xd1d7=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xd1d7,0x144));var _0x7d1d=function(_0x5a3018,_0xe6f19a){_0x5a3018=_0x5a3018-0x0;var _0x53399d=_0xd1d7[_0x5a3018];return _0x53399d;};'use strict';var _=require(_0x7d1d('0x0'));var util=require(_0x7d1d('0x1'));var moment=require(_0x7d1d('0x2'));var BPromise=require(_0x7d1d('0x3'));var rs=require(_0x7d1d('0x4'));var fs=require('fs');var Redis=require(_0x7d1d('0x5'));var db=require(_0x7d1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d1d('0x7'))(_0x7d1d('0x8'));var config=require(_0x7d1d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7d1d('0xa')][_0x7d1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b7d44,_0x458b26,_0x31c346){return new BPromise(function(_0x3ee0be,_0x3351e5){return client['request'](_0x3b7d44,_0x31c346)['then'](function(_0x31b835){logger[_0x7d1d('0xc')](_0x7d1d('0xd'),_0x458b26,_0x7d1d('0xe'));logger['debug'](_0x7d1d('0xf'),_0x458b26,_0x7d1d('0xe'),JSON[_0x7d1d('0x10')](_0x31b835));if(_0x31b835[_0x7d1d('0x11')]){if(_0x31b835[_0x7d1d('0x11')][_0x7d1d('0x12')]===0x1f4){logger[_0x7d1d('0x11')](_0x7d1d('0xd'),_0x458b26,_0x31b835[_0x7d1d('0x11')]['message']);return _0x3351e5(_0x31b835['error']['message']);}logger['error'](_0x7d1d('0xd'),_0x458b26,_0x31b835[_0x7d1d('0x11')][_0x7d1d('0x13')]);return _0x3ee0be(_0x31b835['error']['message']);}else{logger[_0x7d1d('0xc')](_0x7d1d('0xd'),_0x458b26,_0x7d1d('0xe'));_0x3ee0be(_0x31b835[_0x7d1d('0x14')][_0x7d1d('0x13')]);}})[_0x7d1d('0x15')](function(_0xbf0a9b){logger[_0x7d1d('0x11')](_0x7d1d('0xd'),_0x458b26,_0xbf0a9b);_0x3351e5(_0xbf0a9b);});});} \ No newline at end of file +var _0xdd89=['client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3786bd,_0x2bb68b){var _0x2a43c5=function(_0x1218b5){while(--_0x1218b5){_0x3786bd['push'](_0x3786bd['shift']());}};_0x2a43c5(++_0x2bb68b);}(_0xdd89,0xc5));var _0x9dd8=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xdd89[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var moment=require(_0x9dd8('0x2'));var BPromise=require(_0x9dd8('0x3'));var rs=require(_0x9dd8('0x4'));var fs=require('fs');var Redis=require(_0x9dd8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9dd8('0x6'))(_0x9dd8('0x7'));var config=require(_0x9dd8('0x8'));var jayson=require(_0x9dd8('0x9'));var client=jayson[_0x9dd8('0xa')][_0x9dd8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ebe31,_0x166b60,_0x4198fe){return new BPromise(function(_0xd2480b,_0x4e5e9a){return client[_0x9dd8('0xc')](_0x3ebe31,_0x4198fe)[_0x9dd8('0xd')](function(_0x2192fb){logger[_0x9dd8('0xe')](_0x9dd8('0xf'),_0x166b60,_0x9dd8('0x10'));logger[_0x9dd8('0x11')](_0x9dd8('0x12'),_0x166b60,'request\x20sent',JSON[_0x9dd8('0x13')](_0x2192fb));if(_0x2192fb[_0x9dd8('0x14')]){if(_0x2192fb[_0x9dd8('0x14')]['code']===0x1f4){logger[_0x9dd8('0x14')](_0x9dd8('0xf'),_0x166b60,_0x2192fb[_0x9dd8('0x14')]['message']);return _0x4e5e9a(_0x2192fb['error']['message']);}logger[_0x9dd8('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x166b60,_0x2192fb['error'][_0x9dd8('0x15')]);return _0xd2480b(_0x2192fb[_0x9dd8('0x14')][_0x9dd8('0x15')]);}else{logger[_0x9dd8('0xe')](_0x9dd8('0xf'),_0x166b60,_0x9dd8('0x10'));_0xd2480b(_0x2192fb['result'][_0x9dd8('0x15')]);}})[_0x9dd8('0x16')](function(_0x238354){logger[_0x9dd8('0x14')](_0x9dd8('0xf'),_0x166b60,_0x238354);_0x4e5e9a(_0x238354);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1d04c65..f7b3430 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 _0x3c52=['/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','/:id','show','download'];(function(_0x49699b,_0x21c516){var _0x3a80dc=function(_0x3c6520){while(--_0x3c6520){_0x49699b['push'](_0x49699b['shift']());}};_0x3a80dc(++_0x21c516);}(_0x3c52,0x8c));var _0x23c5=function(_0xd541ad,_0x4ea677){_0xd541ad=_0xd541ad-0x0;var _0x1d0375=_0x3c52[_0xd541ad];return _0x1d0375;};'use strict';var multer=require(_0x23c5('0x0'));var util=require(_0x23c5('0x1'));var path=require('path');var timeout=require(_0x23c5('0x2'));var express=require(_0x23c5('0x3'));var router=express['Router']();var fs_extra=require(_0x23c5('0x4'));var auth=require(_0x23c5('0x5'));var interaction=require(_0x23c5('0x6'));var config=require(_0x23c5('0x7'));var controller=require(_0x23c5('0x8'));router['get']('/',auth[_0x23c5('0x9')](),controller[_0x23c5('0xa')]);router[_0x23c5('0xb')](_0x23c5('0xc'),auth[_0x23c5('0x9')](),controller['describe']);router[_0x23c5('0xb')](_0x23c5('0xd'),auth[_0x23c5('0x9')](),controller[_0x23c5('0xe')]);router['get']('/:id/download',auth[_0x23c5('0x9')](),controller[_0x23c5('0xf')]);router[_0x23c5('0xb')](_0x23c5('0x10'),controller['downloads']);router[_0x23c5('0xb')](_0x23c5('0x11'),auth[_0x23c5('0x9')](),controller[_0x23c5('0x12')]);router[_0x23c5('0x13')]('/',auth['isAuthenticated'](),controller[_0x23c5('0x14')]);router[_0x23c5('0x13')]('/:id/transcribe',auth[_0x23c5('0x9')](),controller[_0x23c5('0x15')]);router[_0x23c5('0x16')](_0x23c5('0xd'),auth[_0x23c5('0x9')](),controller['update']);router[_0x23c5('0x17')](_0x23c5('0xd'),auth[_0x23c5('0x9')](),controller[_0x23c5('0x18')]);module[_0x23c5('0x19')]=router; \ No newline at end of file +var _0x5d01=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','post','runTranscribe','put','update','delete','destroy','exports','util','path'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x5d01,0x140));var _0x15d0=function(_0x22ba3a,_0x1a1dbb){_0x22ba3a=_0x22ba3a-0x0;var _0xbf259b=_0x5d01[_0x22ba3a];return _0xbf259b;};'use strict';var multer=require('multer');var util=require(_0x15d0('0x0'));var path=require(_0x15d0('0x1'));var timeout=require(_0x15d0('0x2'));var express=require(_0x15d0('0x3'));var router=express[_0x15d0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x15d0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x15d0('0x6')]('/',auth[_0x15d0('0x7')](),controller['index']);router[_0x15d0('0x6')](_0x15d0('0x8'),auth[_0x15d0('0x7')](),controller[_0x15d0('0x9')]);router[_0x15d0('0x6')](_0x15d0('0xa'),auth[_0x15d0('0x7')](),controller[_0x15d0('0xb')]);router['get'](_0x15d0('0xc'),auth[_0x15d0('0x7')](),controller['download']);router[_0x15d0('0x6')](_0x15d0('0xd'),controller[_0x15d0('0xe')]);router[_0x15d0('0x6')](_0x15d0('0xf'),auth[_0x15d0('0x7')](),controller['downloadTranscribe']);router[_0x15d0('0x10')]('/',auth[_0x15d0('0x7')](),controller['create']);router[_0x15d0('0x10')](_0x15d0('0xf'),auth[_0x15d0('0x7')](),controller[_0x15d0('0x11')]);router[_0x15d0('0x12')](_0x15d0('0xa'),auth[_0x15d0('0x7')](),controller[_0x15d0('0x13')]);router[_0x15d0('0x14')](_0x15d0('0xa'),auth['isAuthenticated'](),controller[_0x15d0('0x15')]);module[_0x15d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index dd0c3f6..df3031e 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(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 6ed51c5..818237d 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 _0x95c2=['crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','describe','download','uniqueid','decryptFile','secrets','recording','value','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','sequelize','MD5','col','token','$and','push','existsSync','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5f4254,_0x5e6fef){var _0x371cd2=function(_0x1e8824){while(--_0x1e8824){_0x5f4254['push'](_0x5f4254['shift']());}};_0x371cd2(++_0x5e6fef);}(_0x95c2,0x129));var _0x295c=function(_0x4f8c5e,_0x5bf7ba){_0x4f8c5e=_0x4f8c5e-0x0;var _0x40ff5a=_0x95c2[_0x4f8c5e];return _0x40ff5a;};'use strict';var emlformat=require(_0x295c('0x0'));var rimraf=require(_0x295c('0x1'));var zipdir=require(_0x295c('0x2'));var jsonpatch=require(_0x295c('0x3'));var rp=require(_0x295c('0x4'));var moment=require('moment');var BPromise=require(_0x295c('0x5'));var Mustache=require(_0x295c('0x6'));var util=require(_0x295c('0x7'));var path=require(_0x295c('0x8'));var sox=require(_0x295c('0x9'));var csv=require(_0x295c('0xa'));var ejs=require(_0x295c('0xb'));var fs=require('fs');var fs_extra=require(_0x295c('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x295c('0xd'));var jsforce=require(_0x295c('0xe'));var deskjs=require(_0x295c('0xf'));var toCsv=require(_0x295c('0xa'));var querystring=require(_0x295c('0x10'));var Papa=require(_0x295c('0x11'));var AWS=require(_0x295c('0x12'));var uuidv4=require(_0x295c('0x13'));var Redis=require(_0x295c('0x14'));var authService=require(_0x295c('0x15'));var qs=require(_0x295c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x295c('0x17'));var logger=require(_0x295c('0x18'))(_0x295c('0x19'));var utils=require('../../config/utils');var config=require(_0x295c('0x1a'));var licenseUtil=require(_0x295c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7e07ed,_0x106cac){_0x106cac=_0x106cac||0xcc;return function(_0x11486e){if(_0x11486e){return _0x7e07ed[_0x295c('0x1c')](_0x106cac);}return _0x7e07ed[_0x295c('0x1d')](_0x106cac)[_0x295c('0x1e')]();};}function respondWithResult(_0xc777c3,_0x5ce1b8){_0x5ce1b8=_0x5ce1b8||0xc8;return function(_0x48300e){if(_0x48300e){return _0xc777c3['status'](_0x5ce1b8)[_0x295c('0x1f')](_0x48300e);}};}function respondWithFilteredResult(_0x27eadf,_0x3a377e){return function(_0x2f29c0){if(_0x2f29c0){var _0x5c0235=typeof _0x3a377e[_0x295c('0x20')]===_0x295c('0x21')&&typeof _0x3a377e[_0x295c('0x22')]===_0x295c('0x21');var _0x257eb1=_0x2f29c0['count'];var _0x5b2ae0=_0x5c0235?0x0:_0x3a377e[_0x295c('0x20')];var _0x393b12=_0x5c0235?_0x2f29c0['count']:_0x3a377e[_0x295c('0x20')]+_0x3a377e[_0x295c('0x22')];var _0x2f8135;if(_0x393b12>=_0x257eb1){_0x393b12=_0x257eb1;_0x2f8135=0xc8;}else{_0x2f8135=0xce;}_0x27eadf[_0x295c('0x1d')](_0x2f8135);return _0x27eadf[_0x295c('0x23')](_0x295c('0x24'),_0x5b2ae0+'-'+_0x393b12+'/'+_0x257eb1)[_0x295c('0x1f')](_0x2f29c0);}return null;};}function patchUpdates(_0x15f626){return function(_0xa19d1d){try{jsonpatch[_0x295c('0x25')](_0xa19d1d,_0x15f626,!![]);}catch(_0x4adbe3){return BPromise[_0x295c('0x26')](_0x4adbe3);}return _0xa19d1d[_0x295c('0x27')]();};}function saveUpdates(_0x8ecea,_0x3642ef){return function(_0x158237){if(_0x158237){return _0x158237[_0x295c('0x28')](_0x8ecea)[_0x295c('0x29')](function(_0x554397){return _0x554397;});}return null;};}function removeEntity(_0x3fbf1a,_0x2ab246){return function(_0x1d65b6){if(_0x1d65b6){return _0x1d65b6[_0x295c('0x2a')]()[_0x295c('0x29')](function(){_0x3fbf1a[_0x295c('0x1d')](0xcc)[_0x295c('0x1e')]();});}};}function handleEntityNotFound(_0x33f7c0,_0x526c32){return function(_0x41fd43){if(!_0x41fd43){_0x33f7c0[_0x295c('0x1c')](0x194);}return _0x41fd43;};}function handleError(_0x4377ff,_0x4cabe7){_0x4cabe7=_0x4cabe7||0x1f4;return function(_0x2e35a7){logger[_0x295c('0x2b')](_0x2e35a7['stack']);if(_0x2e35a7[_0x295c('0x2c')]){delete _0x2e35a7[_0x295c('0x2c')];}_0x4377ff[_0x295c('0x1d')](_0x4cabe7)['send'](_0x2e35a7);};}exports[_0x295c('0x2d')]=function(_0x3da624,_0x49fa88){var _0x5d2301={},_0x5ab4d3={},_0x8be460={'count':0x0,'rows':[]};var _0x574b50=_[_0x295c('0x2e')](db[_0x295c('0x2f')][_0x295c('0x30')],function(_0xb09472){return{'name':_0xb09472[_0x295c('0x31')],'type':_0xb09472[_0x295c('0x32')][_0x295c('0x33')]};});_0x5ab4d3[_0x295c('0x34')]=_[_0x295c('0x35')](_['map'](_0x574b50,_0x295c('0x2c')),[_0x295c('0x36')]);_0x5ab4d3[_0x295c('0x37')]=_[_0x295c('0x38')](_0x3da624[_0x295c('0x37')]);_0x5ab4d3[_0x295c('0x39')]=_[_0x295c('0x3a')](_0x5ab4d3[_0x295c('0x34')],_0x5ab4d3[_0x295c('0x37')]);_0x5d2301[_0x295c('0x3b')]=_[_0x295c('0x3a')](_0x5ab4d3[_0x295c('0x34')],qs[_0x295c('0x3c')](_0x3da624[_0x295c('0x37')][_0x295c('0x3c')]));_0x5d2301[_0x295c('0x3b')]=_0x5d2301['attributes'][_0x295c('0x3d')]?_0x5d2301['attributes']:_0x5ab4d3[_0x295c('0x34')];if(!_0x3da624[_0x295c('0x37')]['hasOwnProperty'](_0x295c('0x3e'))){_0x5d2301['limit']=qs[_0x295c('0x22')](_0x3da624[_0x295c('0x37')][_0x295c('0x22')]);_0x5d2301[_0x295c('0x20')]=qs[_0x295c('0x20')](_0x3da624['query'][_0x295c('0x20')]);}_0x5d2301[_0x295c('0x3f')]=qs[_0x295c('0x40')](_0x3da624[_0x295c('0x37')][_0x295c('0x40')]);_0x5d2301[_0x295c('0x41')]=qs[_0x295c('0x39')](_[_0x295c('0x42')](_0x3da624[_0x295c('0x37')],_0x5ab4d3[_0x295c('0x39')]),_0x574b50);if(_0x3da624[_0x295c('0x37')][_0x295c('0x43')]){_0x5d2301[_0x295c('0x41')]=_[_0x295c('0x44')](_0x5d2301[_0x295c('0x41')],{'$or':_[_0x295c('0x2e')](_0x574b50,function(_0xfba3b){if(_0xfba3b[_0x295c('0x32')]!==_0x295c('0x45')){var _0x4f9437={};_0x4f9437[_0xfba3b[_0x295c('0x2c')]]={'$like':'%'+_0x3da624['query']['filter']+'%'};return _0x4f9437;}})});}_0x5d2301=_[_0x295c('0x44')]({},_0x5d2301,_0x3da624[_0x295c('0x46')]);var _0xbe4e5e={'where':_0x5d2301[_0x295c('0x41')]};return db[_0x295c('0x2f')]['count'](_0xbe4e5e)[_0x295c('0x29')](function(_0x1d5f78){_0x8be460[_0x295c('0x47')]=_0x1d5f78;if(_0x3da624[_0x295c('0x37')][_0x295c('0x48')]){_0x5d2301[_0x295c('0x49')]=[{'all':!![]}];}return db[_0x295c('0x2f')]['findAll'](_0x5d2301);})[_0x295c('0x29')](function(_0xc6bf2e){_0x8be460[_0x295c('0x4a')]=_0xc6bf2e;return _0x8be460;})[_0x295c('0x29')](respondWithFilteredResult(_0x49fa88,_0x5d2301))[_0x295c('0x4b')](handleError(_0x49fa88,null));};exports['show']=function(_0x378c16,_0x4546bf){var _0x561eaa={'raw':![],'where':{'id':_0x378c16[_0x295c('0x4c')]['id']}},_0x3edca6={};_0x3edca6[_0x295c('0x34')]=_[_0x295c('0x38')](db['VoiceRecording']['rawAttributes']);_0x3edca6['query']=_[_0x295c('0x38')](_0x378c16[_0x295c('0x37')]);_0x3edca6[_0x295c('0x39')]=_['intersection'](_0x3edca6['model'],_0x3edca6[_0x295c('0x37')]);_0x561eaa[_0x295c('0x3b')]=_[_0x295c('0x3a')](_0x3edca6[_0x295c('0x34')],qs[_0x295c('0x3c')](_0x378c16[_0x295c('0x37')]['fields']));_0x561eaa[_0x295c('0x3b')]=_0x561eaa['attributes']['length']?_0x561eaa['attributes']:_0x3edca6[_0x295c('0x34')];if(_0x378c16[_0x295c('0x37')][_0x295c('0x48')]){_0x561eaa[_0x295c('0x49')]=[{'all':!![]}];}_0x561eaa=_['merge']({},_0x561eaa,_0x378c16[_0x295c('0x46')]);return db[_0x295c('0x2f')][_0x295c('0x4d')](_0x561eaa)[_0x295c('0x29')](handleEntityNotFound(_0x4546bf,null))['then'](respondWithResult(_0x4546bf,null))[_0x295c('0x4b')](handleError(_0x4546bf,null));};exports[_0x295c('0x4e')]=function(_0x12462b,_0x4f6847){return db[_0x295c('0x2f')][_0x295c('0x4e')](_0x12462b['body'],{})[_0x295c('0x29')](respondWithResult(_0x4f6847,0xc9))[_0x295c('0x4b')](handleError(_0x4f6847,null));};exports[_0x295c('0x28')]=function(_0x4d2392,_0x11b14a){if(_0x4d2392[_0x295c('0x4f')]['id']){delete _0x4d2392['body']['id'];}return db[_0x295c('0x2f')]['find']({'where':{'id':_0x4d2392['params']['id']}})[_0x295c('0x29')](handleEntityNotFound(_0x11b14a,null))['then'](saveUpdates(_0x4d2392[_0x295c('0x4f')],null))[_0x295c('0x29')](respondWithResult(_0x11b14a,null))[_0x295c('0x4b')](handleError(_0x11b14a,null));};exports['describe']=function(_0x214fa2,_0x21a032){return db[_0x295c('0x2f')][_0x295c('0x50')]()[_0x295c('0x29')](respondWithResult(_0x21a032,null))[_0x295c('0x4b')](handleError(_0x21a032,null));};exports[_0x295c('0x51')]=function(_0x427e5f,_0xf6071,_0x53c9c4){var _0x5268ed=require('../../components/encryptor');var _0x35d6eb=![];var _0x2e6bf2={};if(_0x427e5f[_0x295c('0x37')][_0x295c('0x32')]&&_0x427e5f[_0x295c('0x37')][_0x295c('0x32')]===_0x295c('0x52')){_0x2e6bf2[_0x295c('0x52')]=_0x427e5f[_0x295c('0x4c')]['id'];}else{_0x2e6bf2['id']=_0x427e5f['params']['id'];}return db[_0x295c('0x2f')][_0x295c('0x4d')]({'where':_0x2e6bf2,'attributes':['id','value'],'raw':!![]})[_0x295c('0x29')](handleEntityNotFound(_0xf6071,null))['then'](function(_0x729bd){if(_0x729bd){var _0x46b730=_0x729bd['value'];var _0x377aa9=util['format']('%s.cypher',_0x46b730);if(fs['existsSync'](_0x377aa9)){_0x35d6eb=!![];return _0x5268ed[_0x295c('0x53')](_0x377aa9,_0x46b730,config[_0x295c('0x54')][_0x295c('0x55')])[_0x295c('0x29')](function(){return _0x729bd;});}return _0x729bd;}})['then'](function(_0xbb0d08){if(_0xbb0d08){var _0x5d7721=_0xbb0d08[_0x295c('0x56')];if(!fs['existsSync'](_0x5d7721)){throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))](_0x295c('0x59'));}if(_0xbb0d08[_0x295c('0x5a')]){return _0xf6071[_0x295c('0x51')](_0x5d7721,_0xbb0d08[_0x295c('0x5a')]+path[_0x295c('0x5b')](_0x5d7721),function(){if(_0x35d6eb){fs[_0x295c('0x5c')](_0x5d7721);}});}else{return _0xf6071[_0x295c('0x51')](_0x5d7721,function(_0x164fc3){if(_0x35d6eb){fs[_0x295c('0x5c')](_0x5d7721);}});}}})[_0x295c('0x4b')](function(_0x46fb62){if(_0x46fb62[_0x295c('0x5d')]===_0x295c('0x59')){_0xf6071[_0x295c('0x1d')](0x194)[_0x295c('0x5e')](_0x295c('0x5f'));}else{return handleError(_0xf6071,null);}});};exports['downloads']=function(_0x2a9988,_0x7fa8b9,_0x47de31){var _0x3e3319=require('../../components/encryptor');var _0xd335f4=![];var _0x5a787d={'$and':[db[_0x295c('0x60')][_0x295c('0x41')](db[_0x295c('0x60')]['fn'](_0x295c('0x61'),db[_0x295c('0x60')][_0x295c('0x62')](_0x295c('0x52'))),_0x2a9988[_0x295c('0x37')][_0x295c('0x63')])]};if(_0x2a9988[_0x295c('0x37')]['type']&&_0x2a9988[_0x295c('0x37')]['type']==='uniqueid'){_0x5a787d[_0x295c('0x64')][_0x295c('0x65')]({'uniqueid':_0x2a9988['params']['id']});}else{_0x5a787d[_0x295c('0x64')]['push']({'id':_0x2a9988[_0x295c('0x4c')]['id']});}return db[_0x295c('0x2f')][_0x295c('0x4d')]({'where':_0x5a787d,'attributes':['id','value'],'raw':!![]})[_0x295c('0x29')](handleEntityNotFound(_0x7fa8b9,null))[_0x295c('0x29')](function(_0x5946b5){if(_0x5946b5){var _0x3e38c7=util[_0x295c('0x36')]('%s.cypher',_0x5946b5[_0x295c('0x56')]);if(fs[_0x295c('0x66')](_0x3e38c7)){_0xd335f4=!![];return _0x3e3319[_0x295c('0x53')](_0x3e38c7,_0x5946b5['value'],config[_0x295c('0x54')][_0x295c('0x55')])[_0x295c('0x29')](function(){return _0x5946b5;});}return _0x5946b5;}})[_0x295c('0x29')](function(_0x3fe8c2){if(_0x3fe8c2){if(!fs[_0x295c('0x66')](_0x3fe8c2[_0x295c('0x56')])){throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))](_0x295c('0x59'));}if(_0x3fe8c2['filename']){return _0x7fa8b9[_0x295c('0x51')](_0x3fe8c2[_0x295c('0x56')],_0x3fe8c2['filename']+path['extname'](_0x3fe8c2[_0x295c('0x56')]),function(){if(_0xd335f4){fs['unlink'](_0x3fe8c2['value']);}});}else{return _0x7fa8b9[_0x295c('0x51')](_0x3fe8c2[_0x295c('0x56')],function(_0x224aa5){if(_0xd335f4){fs['unlink'](_0x3fe8c2[_0x295c('0x56')]);}});}}})[_0x295c('0x4b')](handleError(_0x7fa8b9,null));};exports['destroy']=function(_0x588842,_0x2e29ee){return db[_0x295c('0x2f')]['find']({'where':{'id':_0x588842[_0x295c('0x4c')]['id']}})[_0x295c('0x29')](function(_0x1b8052){if(_[_0x295c('0x67')](_0x1b8052)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1b8052;})['then'](function(_0x2024b6){var _0x4ccd47=_0x2024b6[_0x295c('0x56')];logger[_0x295c('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x4ccd47);if(!_[_0x295c('0x67')](_0x2024b6[_0x295c('0x56')])&&fs[_0x295c('0x66')](_0x4ccd47)){logger[_0x295c('0x68')](_0x295c('0x69')+_0x4ccd47+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x295c('0x6a')](_0x4ccd47);}_0x4ccd47=_0x4ccd47+_0x295c('0x6b');if(!_[_0x295c('0x67')](_0x2024b6['value'])&&fs[_0x295c('0x66')](_0x4ccd47)){logger[_0x295c('0x68')](_0x295c('0x69')+_0x4ccd47+_0x295c('0x6c'));fs[_0x295c('0x6a')](_0x4ccd47);}return _0x2024b6;})[_0x295c('0x29')](function(_0x423199){if(!_0x423199)throw new InternalError();return _0x423199[_0x295c('0x2a')]();})[_0x295c('0x29')](function(){_0x2e29ee[_0x295c('0x1d')](0xcc)['end']();})[_0x295c('0x4b')](handleError(_0x2e29ee,null));};function getBucketslist(_0x370940,_0x14041d,_0x2c32e8){return new Promise(function(_0xaecd83,_0x121ead){var _0x4aa693=new AWS['S3']({'accessKeyId':_0x14041d,'secretAccessKey':_0x370940,'region':_0x2c32e8});_0x4aa693[_0x295c('0x6d')]({},function(_0x7f6125,_0x373989){if(_0x7f6125){return _0x121ead(_0x7f6125);}else{return _0xaecd83(_0x373989);}});});}function createBucket(_0x4ce0d6,_0x3a6cba,_0x427855,_0x1d60ad){return new Promise(function(_0x431867,_0x5cc34c){var _0x32e571=new AWS['S3']({'accessKeyId':_0x3a6cba,'secretAccessKey':_0x4ce0d6,'region':_0x427855});_0x32e571[_0x295c('0x6e')]({'Bucket':_0x1d60ad},function(_0x4cce57,_0x230f63){if(_0x4cce57){return _0x5cc34c(_0x4cce57);}else{return _0x431867(_0x230f63);}});});}function uploadFile(_0x314cf8,_0x4f44b4,_0x3ef5eb,_0x1273be,_0xc86978,_0x23e0fb){return new Promise(function(_0x391d9c,_0x41bf88){var _0xf6b0bd=new AWS['S3']({'accessKeyId':_0x4f44b4,'secretAccessKey':_0x314cf8,'region':_0x3ef5eb});_0xf6b0bd[_0x295c('0x6f')]({'Bucket':_0x1273be,'Key':_0xc86978,'Body':_0x23e0fb},function(_0x587694,_0x3b36d9){if(_0x587694){return _0x41bf88(_0x587694);}else{return _0x391d9c(_0x3b36d9);}});});}function startTranscribe(_0x466c24,_0x16ee29,_0x175e9a,_0x5547b0,_0x5c7a57,_0x2049d5){return new Promise(function(_0x5f3fa4,_0x818555){var _0x54f803=new AWS[(_0x295c('0x70'))]({'accessKeyId':_0x16ee29,'secretAccessKey':_0x466c24,'region':_0x175e9a});_0x54f803['startTranscriptionJob']({'TranscriptionJobName':_0x5547b0,'LanguageCode':_0x5c7a57,'Media':{'MediaFileUri':_0x2049d5}},function(_0x52e447,_0x2fee98){if(_0x52e447){return _0x818555(_0x52e447);}else{return _0x5f3fa4(_0x2fee98);}});});}function transcribe(_0x549ac3,_0x26cdbd,_0x3c72b4,_0x5db23f,_0x1f4090,_0xd56fb2,_0x3b840c){return new Promise(function(_0x45a388,_0x2a07b7){var _0x270af9={};logger[_0x295c('0x68')](util[_0x295c('0x36')](_0x295c('0x71'),_0x549ac3,_0x1f4090));return uploadFile(_0x26cdbd,_0x3c72b4,_0x5db23f,_0x1f4090,path['basename'](_0xd56fb2),fs[_0x295c('0x72')](_0xd56fb2))[_0x295c('0x29')](function(_0x331c35){logger[_0x295c('0x68')](util[_0x295c('0x36')](_0x295c('0x73'),_0x549ac3,_0x1f4090,_0x331c35[_0x295c('0x74')]));_0x270af9[_0x295c('0x75')]=_0x331c35[_0x295c('0x76')];_0x270af9[_0x295c('0x77')]=_0x331c35[_0x295c('0x74')];logger[_0x295c('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x549ac3));return startTranscribe(_0x26cdbd,_0x3c72b4,_0x5db23f,uuidv4(),_0x3b840c,_0x331c35[_0x295c('0x74')]);})[_0x295c('0x29')](function(_0x4ce111){logger[_0x295c('0x68')](util[_0x295c('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x549ac3,_0x4ce111[_0x295c('0x78')][_0x295c('0x79')]));_0x270af9[_0x295c('0x7a')]=_0x4ce111[_0x295c('0x78')][_0x295c('0x79')];_0x270af9[_0x295c('0x7b')]=_0x4ce111[_0x295c('0x78')][_0x295c('0x7c')];return _0x45a388(_0x270af9);})['catch'](function(_0x1cb927){return _0x2a07b7(_0x1cb927);});});}exports[_0x295c('0x7d')]=function(_0x3f7ce3,_0x8509a,_0x34d55e){var _0x10638d;var _0x63b35a;var _0x302535;var _0x33e6ec=require(_0x295c('0x7e'));return db['VoiceRecording'][_0x295c('0x7f')]({'where':{'id':_0x3f7ce3[_0x295c('0x4c')]['id']}})['then'](function(_0x751154){if(_0x751154){var _0x57ba5a=util['format']('%s.cypher',_0x751154['value']);if(fs['existsSync'](_0x57ba5a)){cypher=!![];return _0x33e6ec[_0x295c('0x53')](_0x57ba5a,_0x751154['value'],config[_0x295c('0x54')]['recording'])[_0x295c('0x29')](function(){return _0x751154;});}return _0x751154;}})['then'](function(_0x1302d5){if(!_0x1302d5){throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))](_0x295c('0x80'));}_0x63b35a=_0x1302d5;return db[_0x295c('0x81')][_0x295c('0x7f')]({'where':{'id':0x1}});})[_0x295c('0x29')](handleEntityNotFound(_0x8509a,null))[_0x295c('0x29')](function(_0x4ecde3){if(_0x4ecde3){_0x10638d=_0x4ecde3;if(!_0x10638d[_0x295c('0x82')]||!_0x10638d[_0x295c('0x83')]||!_0x10638d[_0x295c('0x84')]||!_0x10638d[_0x295c('0x85')]||!_0x10638d[_0x295c('0x75')]){throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))](_0x295c('0x86'));}if(_0x3f7ce3[_0x295c('0x4f')]['runSentiment']&&(!_0x10638d[_0x295c('0x87')]||!_0x10638d['sentimentAccountId']||!_0x10638d[_0x295c('0x88')]||!_0x10638d[_0x295c('0x85')]||!_0x10638d[_0x295c('0x75')])){throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))](_0x295c('0x89'));}return db[_0x295c('0x8a')][_0x295c('0x7f')]({'where':{'id':_0x10638d[_0x295c('0x83')]}});}})[_0x295c('0x29')](function(_0x12225d){if(!_0x12225d){throw new db[(_0x295c('0x57'))]['ValidationError'](_0x295c('0x8b'));}if(!_0x12225d[_0x295c('0x8c')]||!_0x12225d[_0x295c('0x8d')]){throw new db[(_0x295c('0x57'))]['ValidationError'](_0x295c('0x8e'));}_0x302535=_0x12225d;return getBucketslist(_0x302535['data1'],_0x302535[_0x295c('0x8d')],_0x10638d[_0x295c('0x84')]);})['then'](function(_0x4821ca){if(_0x4821ca&&_0x4821ca[_0x295c('0x8f')]){var _0x832034=_['find'](_0x4821ca[_0x295c('0x8f')],function(_0xf00fee){return _0xf00fee['Name']===_0x10638d[_0x295c('0x75')];});if(!_0x832034){logger[_0x295c('0x68')](util['format'](_0x295c('0x90'),_0x3f7ce3[_0x295c('0x4c')]['id'],_0x10638d['bucket']));return createBucket(_0x302535['data1'],_0x302535[_0x295c('0x8d')],_0x10638d[_0x295c('0x84')],_0x10638d[_0x295c('0x75')]);}logger['info'](util[_0x295c('0x36')](_0x295c('0x91'),_0x3f7ce3[_0x295c('0x4c')]['id'],_0x10638d[_0x295c('0x75')]));return;}})['then'](function(_0x56c29b){if(_0x63b35a[_0x295c('0x7b')]===_0x295c('0x92')){return transcribe(_0x3f7ce3[_0x295c('0x4c')]['id'],_0x302535[_0x295c('0x8c')],_0x302535[_0x295c('0x8d')],_0x10638d[_0x295c('0x84')],_0x10638d['bucket'],_0x63b35a[_0x295c('0x56')],_0x10638d[_0x295c('0x85')]);}else{logger[_0x295c('0x68')](util['format'](_0x295c('0x93'),_0x3f7ce3[_0x295c('0x4c')]['id']));return{'transcribeStatus':_0x295c('0x94')};}})[_0x295c('0x29')](function(_0x4ea756){if(_0x4ea756){_0x4ea756[_0x295c('0x95')]=_0x3f7ce3['body']['runSentiment'];return _0x63b35a['updateAttributes'](_0x4ea756);}})[_0x295c('0x29')](respondWithResult(_0x8509a,null))['catch'](handleError(_0x8509a,null));};function writeFile(_0x268332,_0x1e33f2){return new Promise(function(_0x4e3ddb,_0x1f5063){fs['writeFile'](_0x1e33f2,_0x268332,function(_0x4a4387,_0xcea00d){if(_0x4a4387){return _0x1f5063(_0x4a4387);}else{return _0x4e3ddb(_0xcea00d);}});});}exports[_0x295c('0x96')]=function(_0x122f34,_0x18ce06,_0x3d89e5){return db[_0x295c('0x2f')][_0x295c('0x7f')]({'where':{'id':_0x122f34[_0x295c('0x4c')]['id']}})[_0x295c('0x29')](handleEntityNotFound(_0x18ce06))['then'](function(_0x4daa45){if(_0x4daa45&&_0x4daa45[_0x295c('0x97')]){var _0x9e7486=_0x4daa45[_0x295c('0x97')];var _0x171e1f=config[_0x295c('0x98')]+_0x295c('0x99')+_0x4daa45['id']+_0x295c('0x9a');if(fs[_0x295c('0x66')](_0x171e1f)){return _0x171e1f;}return writeFile(_0x9e7486,_0x171e1f)[_0x295c('0x29')](function(){return _0x171e1f;});}else{throw new db[(_0x295c('0x57'))][(_0x295c('0x58'))]('Transcript\x20not\x20available');}})[_0x295c('0x29')](function(_0x3c39b4){return _0x18ce06['download'](_0x3c39b4);})[_0x295c('0x4b')](handleError(_0x18ce06));}; \ No newline at end of file +var _0x6c58=['json','offset','undefined','limit','count','set','reject','save','update','then','name','send','index','VoiceRecording','fieldName','differenceBy','map','format','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','describe','type','uniqueid','value','%s.cypher','existsSync','decryptFile','Sequelize','filename','download','unlink','message','downloads','sequelize','col','token','$and','push','recording','VoiceRecording\x20not\x20found','extname','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','secrets','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','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','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c58,0x7c));var _0x86c5=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x6c58[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86c5('0x0'));var zipdir=require(_0x86c5('0x1'));var jsonpatch=require(_0x86c5('0x2'));var rp=require(_0x86c5('0x3'));var moment=require(_0x86c5('0x4'));var BPromise=require(_0x86c5('0x5'));var Mustache=require(_0x86c5('0x6'));var util=require(_0x86c5('0x7'));var path=require(_0x86c5('0x8'));var sox=require(_0x86c5('0x9'));var csv=require('to-csv');var ejs=require(_0x86c5('0xa'));var fs=require('fs');var fs_extra=require(_0x86c5('0xb'));var _=require(_0x86c5('0xc'));var squel=require(_0x86c5('0xd'));var crypto=require(_0x86c5('0xe'));var jsforce=require(_0x86c5('0xf'));var deskjs=require(_0x86c5('0x10'));var toCsv=require(_0x86c5('0x11'));var querystring=require(_0x86c5('0x12'));var Papa=require('papaparse');var AWS=require(_0x86c5('0x13'));var uuidv4=require(_0x86c5('0x14'));var Redis=require(_0x86c5('0x15'));var authService=require(_0x86c5('0x16'));var qs=require(_0x86c5('0x17'));var as=require(_0x86c5('0x18'));var hardwareService=require(_0x86c5('0x19'));var logger=require(_0x86c5('0x1a'))('api');var utils=require(_0x86c5('0x1b'));var config=require(_0x86c5('0x1c'));var licenseUtil=require(_0x86c5('0x1d'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3255fd,_0xf8a53d){_0xf8a53d=_0xf8a53d||0xcc;return function(_0x2029b6){if(_0x2029b6){return _0x3255fd['sendStatus'](_0xf8a53d);}return _0x3255fd[_0x86c5('0x1e')](_0xf8a53d)[_0x86c5('0x1f')]();};}function respondWithResult(_0x2af7fa,_0x4b1704){_0x4b1704=_0x4b1704||0xc8;return function(_0x45cdea){if(_0x45cdea){return _0x2af7fa[_0x86c5('0x1e')](_0x4b1704)[_0x86c5('0x20')](_0x45cdea);}};}function respondWithFilteredResult(_0x2443f8,_0x4c964e){return function(_0x504ed5){if(_0x504ed5){var _0x2368b5=typeof _0x4c964e[_0x86c5('0x21')]===_0x86c5('0x22')&&typeof _0x4c964e[_0x86c5('0x23')]==='undefined';var _0x5aa5fe=_0x504ed5[_0x86c5('0x24')];var _0x517ea8=_0x2368b5?0x0:_0x4c964e['offset'];var _0x406187=_0x2368b5?_0x504ed5[_0x86c5('0x24')]:_0x4c964e[_0x86c5('0x21')]+_0x4c964e[_0x86c5('0x23')];var _0x56e0e5;if(_0x406187>=_0x5aa5fe){_0x406187=_0x5aa5fe;_0x56e0e5=0xc8;}else{_0x56e0e5=0xce;}_0x2443f8[_0x86c5('0x1e')](_0x56e0e5);return _0x2443f8[_0x86c5('0x25')]('Content-Range',_0x517ea8+'-'+_0x406187+'/'+_0x5aa5fe)['json'](_0x504ed5);}return null;};}function patchUpdates(_0x16e277){return function(_0x529fbb){try{jsonpatch['apply'](_0x529fbb,_0x16e277,!![]);}catch(_0x2071de){return BPromise[_0x86c5('0x26')](_0x2071de);}return _0x529fbb[_0x86c5('0x27')]();};}function saveUpdates(_0x18caf6,_0x4fd5fa){return function(_0x30a51f){if(_0x30a51f){return _0x30a51f[_0x86c5('0x28')](_0x18caf6)[_0x86c5('0x29')](function(_0x1dd53a){return _0x1dd53a;});}return null;};}function removeEntity(_0x45bcee,_0x5c514f){return function(_0x42f7bb){if(_0x42f7bb){return _0x42f7bb['destroy']()[_0x86c5('0x29')](function(){_0x45bcee[_0x86c5('0x1e')](0xcc)[_0x86c5('0x1f')]();});}};}function handleEntityNotFound(_0x2df50e,_0x10d92d){return function(_0x572110){if(!_0x572110){_0x2df50e['sendStatus'](0x194);}return _0x572110;};}function handleError(_0x401fd0,_0x1ccfab){_0x1ccfab=_0x1ccfab||0x1f4;return function(_0x28c971){logger['error'](_0x28c971['stack']);if(_0x28c971[_0x86c5('0x2a')]){delete _0x28c971[_0x86c5('0x2a')];}_0x401fd0['status'](_0x1ccfab)[_0x86c5('0x2b')](_0x28c971);};}exports[_0x86c5('0x2c')]=function(_0x2d51cf,_0x2ee38b){var _0x4bd470={},_0x32e7c5={},_0x1b33dc={'count':0x0,'rows':[]};var _0x2317f2=_['map'](db[_0x86c5('0x2d')]['rawAttributes'],function(_0x4a0855){return{'name':_0x4a0855[_0x86c5('0x2e')],'type':_0x4a0855['type']['key']};});_0x32e7c5['model']=_[_0x86c5('0x2f')](_[_0x86c5('0x30')](_0x2317f2,_0x86c5('0x2a')),[_0x86c5('0x31')]);_0x32e7c5[_0x86c5('0x32')]=_[_0x86c5('0x33')](_0x2d51cf[_0x86c5('0x32')]);_0x32e7c5['filters']=_[_0x86c5('0x34')](_0x32e7c5[_0x86c5('0x35')],_0x32e7c5[_0x86c5('0x32')]);_0x4bd470[_0x86c5('0x36')]=_[_0x86c5('0x34')](_0x32e7c5[_0x86c5('0x35')],qs[_0x86c5('0x37')](_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x37')]));_0x4bd470[_0x86c5('0x36')]=_0x4bd470[_0x86c5('0x36')][_0x86c5('0x38')]?_0x4bd470[_0x86c5('0x36')]:_0x32e7c5[_0x86c5('0x35')];if(!_0x2d51cf['query'][_0x86c5('0x39')](_0x86c5('0x3a'))){_0x4bd470[_0x86c5('0x23')]=qs['limit'](_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x23')]);_0x4bd470[_0x86c5('0x21')]=qs[_0x86c5('0x21')](_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x21')]);}_0x4bd470[_0x86c5('0x3b')]=qs['sort'](_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x3c')]);_0x4bd470['where']=qs[_0x86c5('0x3d')](_[_0x86c5('0x3e')](_0x2d51cf['query'],_0x32e7c5['filters']),_0x2317f2);if(_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x3f')]){_0x4bd470[_0x86c5('0x40')]=_[_0x86c5('0x41')](_0x4bd470[_0x86c5('0x40')],{'$or':_[_0x86c5('0x30')](_0x2317f2,function(_0x5693ae){if(_0x5693ae['type']!==_0x86c5('0x42')){var _0x5dba4f={};_0x5dba4f[_0x5693ae[_0x86c5('0x2a')]]={'$like':'%'+_0x2d51cf[_0x86c5('0x32')][_0x86c5('0x3f')]+'%'};return _0x5dba4f;}})});}_0x4bd470=_[_0x86c5('0x41')]({},_0x4bd470,_0x2d51cf['options']);var _0x5eb029={'where':_0x4bd470[_0x86c5('0x40')]};return db['VoiceRecording'][_0x86c5('0x24')](_0x5eb029)[_0x86c5('0x29')](function(_0x347139){_0x1b33dc[_0x86c5('0x24')]=_0x347139;if(_0x2d51cf['query'][_0x86c5('0x43')]){_0x4bd470[_0x86c5('0x44')]=[{'all':!![]}];}return db[_0x86c5('0x2d')]['findAll'](_0x4bd470);})['then'](function(_0x171e6f){_0x1b33dc[_0x86c5('0x45')]=_0x171e6f;return _0x1b33dc;})[_0x86c5('0x29')](respondWithFilteredResult(_0x2ee38b,_0x4bd470))[_0x86c5('0x46')](handleError(_0x2ee38b,null));};exports[_0x86c5('0x47')]=function(_0xa9064d,_0x57c98d){var _0x37676e={'raw':![],'where':{'id':_0xa9064d[_0x86c5('0x48')]['id']}},_0x445a32={};_0x445a32[_0x86c5('0x35')]=_[_0x86c5('0x33')](db[_0x86c5('0x2d')]['rawAttributes']);_0x445a32[_0x86c5('0x32')]=_[_0x86c5('0x33')](_0xa9064d[_0x86c5('0x32')]);_0x445a32['filters']=_[_0x86c5('0x34')](_0x445a32['model'],_0x445a32[_0x86c5('0x32')]);_0x37676e[_0x86c5('0x36')]=_[_0x86c5('0x34')](_0x445a32[_0x86c5('0x35')],qs[_0x86c5('0x37')](_0xa9064d[_0x86c5('0x32')][_0x86c5('0x37')]));_0x37676e[_0x86c5('0x36')]=_0x37676e[_0x86c5('0x36')][_0x86c5('0x38')]?_0x37676e['attributes']:_0x445a32[_0x86c5('0x35')];if(_0xa9064d[_0x86c5('0x32')][_0x86c5('0x43')]){_0x37676e[_0x86c5('0x44')]=[{'all':!![]}];}_0x37676e=_[_0x86c5('0x41')]({},_0x37676e,_0xa9064d['options']);return db[_0x86c5('0x2d')][_0x86c5('0x49')](_0x37676e)['then'](handleEntityNotFound(_0x57c98d,null))[_0x86c5('0x29')](respondWithResult(_0x57c98d,null))['catch'](handleError(_0x57c98d,null));};exports[_0x86c5('0x4a')]=function(_0x4a65ad,_0x483974){return db[_0x86c5('0x2d')][_0x86c5('0x4a')](_0x4a65ad[_0x86c5('0x4b')],{})[_0x86c5('0x29')](respondWithResult(_0x483974,0xc9))[_0x86c5('0x46')](handleError(_0x483974,null));};exports[_0x86c5('0x28')]=function(_0x81ab84,_0x580480){if(_0x81ab84[_0x86c5('0x4b')]['id']){delete _0x81ab84[_0x86c5('0x4b')]['id'];}return db[_0x86c5('0x2d')][_0x86c5('0x49')]({'where':{'id':_0x81ab84['params']['id']}})['then'](handleEntityNotFound(_0x580480,null))[_0x86c5('0x29')](saveUpdates(_0x81ab84[_0x86c5('0x4b')],null))[_0x86c5('0x29')](respondWithResult(_0x580480,null))['catch'](handleError(_0x580480,null));};exports[_0x86c5('0x4c')]=function(_0x21cdf0,_0x4c8949){return db[_0x86c5('0x2d')]['describe']()[_0x86c5('0x29')](respondWithResult(_0x4c8949,null))[_0x86c5('0x46')](handleError(_0x4c8949,null));};exports['download']=function(_0x3bd14f,_0x3d32f6,_0x44d5a7){var _0x195813=require('../../components/encryptor');var _0x5621d3=![];var _0x322be1={};if(_0x3bd14f[_0x86c5('0x32')]['type']&&_0x3bd14f['query'][_0x86c5('0x4d')]===_0x86c5('0x4e')){_0x322be1['uniqueid']=_0x3bd14f['params']['id'];}else{_0x322be1['id']=_0x3bd14f[_0x86c5('0x48')]['id'];}return db['VoiceRecording'][_0x86c5('0x49')]({'where':_0x322be1,'attributes':['id',_0x86c5('0x4f')],'raw':!![]})[_0x86c5('0x29')](handleEntityNotFound(_0x3d32f6,null))[_0x86c5('0x29')](function(_0x51b78c){if(_0x51b78c){var _0x407035=_0x51b78c[_0x86c5('0x4f')];var _0x466177=util['format'](_0x86c5('0x50'),_0x407035);if(fs[_0x86c5('0x51')](_0x466177)){_0x5621d3=!![];return _0x195813[_0x86c5('0x52')](_0x466177,_0x407035,config['secrets']['recording'])[_0x86c5('0x29')](function(){return _0x51b78c;});}return _0x51b78c;}})['then'](function(_0x24a16f){if(_0x24a16f){var _0x41a519=_0x24a16f['value'];if(!fs[_0x86c5('0x51')](_0x41a519)){throw new db[(_0x86c5('0x53'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x24a16f[_0x86c5('0x54')]){return _0x3d32f6[_0x86c5('0x55')](_0x41a519,_0x24a16f[_0x86c5('0x54')]+path['extname'](_0x41a519),function(){if(_0x5621d3){fs[_0x86c5('0x56')](_0x41a519);}});}else{return _0x3d32f6['download'](_0x41a519,function(_0x121524){if(_0x5621d3){fs[_0x86c5('0x56')](_0x41a519);}});}}})[_0x86c5('0x46')](function(_0x7e0532){if(_0x7e0532[_0x86c5('0x57')]==='VoiceRecording\x20not\x20found'){_0x3d32f6[_0x86c5('0x1e')](0x194)['send']('Not\x20found');}else{return handleError(_0x3d32f6,null);}});};exports[_0x86c5('0x58')]=function(_0x3d6c99,_0x28040f,_0x3129c6){var _0x2e8e3c=require('../../components/encryptor');var _0x330a89=![];var _0x5f0e6d={'$and':[db[_0x86c5('0x59')][_0x86c5('0x40')](db[_0x86c5('0x59')]['fn']('MD5',db[_0x86c5('0x59')][_0x86c5('0x5a')](_0x86c5('0x4e'))),_0x3d6c99[_0x86c5('0x32')][_0x86c5('0x5b')])]};if(_0x3d6c99[_0x86c5('0x32')][_0x86c5('0x4d')]&&_0x3d6c99['query']['type']===_0x86c5('0x4e')){_0x5f0e6d[_0x86c5('0x5c')][_0x86c5('0x5d')]({'uniqueid':_0x3d6c99[_0x86c5('0x48')]['id']});}else{_0x5f0e6d[_0x86c5('0x5c')][_0x86c5('0x5d')]({'id':_0x3d6c99[_0x86c5('0x48')]['id']});}return db[_0x86c5('0x2d')][_0x86c5('0x49')]({'where':_0x5f0e6d,'attributes':['id',_0x86c5('0x4f')],'raw':!![]})[_0x86c5('0x29')](handleEntityNotFound(_0x28040f,null))[_0x86c5('0x29')](function(_0x5dd8a8){if(_0x5dd8a8){var _0x9eb9a9=util[_0x86c5('0x31')]('%s.cypher',_0x5dd8a8[_0x86c5('0x4f')]);if(fs[_0x86c5('0x51')](_0x9eb9a9)){_0x330a89=!![];return _0x2e8e3c[_0x86c5('0x52')](_0x9eb9a9,_0x5dd8a8[_0x86c5('0x4f')],config['secrets'][_0x86c5('0x5e')])['then'](function(){return _0x5dd8a8;});}return _0x5dd8a8;}})[_0x86c5('0x29')](function(_0x365d2a){if(_0x365d2a){if(!fs[_0x86c5('0x51')](_0x365d2a['value'])){throw new db[(_0x86c5('0x53'))]['ValidationError'](_0x86c5('0x5f'));}if(_0x365d2a['filename']){return _0x28040f[_0x86c5('0x55')](_0x365d2a[_0x86c5('0x4f')],_0x365d2a[_0x86c5('0x54')]+path[_0x86c5('0x60')](_0x365d2a[_0x86c5('0x4f')]),function(){if(_0x330a89){fs[_0x86c5('0x56')](_0x365d2a[_0x86c5('0x4f')]);}});}else{return _0x28040f[_0x86c5('0x55')](_0x365d2a[_0x86c5('0x4f')],function(_0x1b48a6){if(_0x330a89){fs['unlink'](_0x365d2a['value']);}});}}})[_0x86c5('0x46')](handleError(_0x28040f,null));};exports[_0x86c5('0x61')]=function(_0xe84851,_0x3889c7){return db[_0x86c5('0x2d')]['find']({'where':{'id':_0xe84851[_0x86c5('0x48')]['id']}})['then'](function(_0x3d8603){if(_[_0x86c5('0x62')](_0x3d8603)){throw new ReferenceError(_0x86c5('0x63'));}return _0x3d8603;})[_0x86c5('0x29')](function(_0x58676f){var _0x230045=_0x58676f[_0x86c5('0x4f')];logger[_0x86c5('0x64')](_0x86c5('0x65'),_0x230045);if(!_[_0x86c5('0x62')](_0x58676f[_0x86c5('0x4f')])&&fs['existsSync'](_0x230045)){logger[_0x86c5('0x64')](_0x86c5('0x66')+_0x230045+_0x86c5('0x67'));fs[_0x86c5('0x68')](_0x230045);}_0x230045=_0x230045+'.cypher';if(!_[_0x86c5('0x62')](_0x58676f[_0x86c5('0x4f')])&&fs['existsSync'](_0x230045)){logger[_0x86c5('0x64')](_0x86c5('0x66')+_0x230045+_0x86c5('0x67'));fs['unlinkSync'](_0x230045);}return _0x58676f;})[_0x86c5('0x29')](function(_0x2b53c8){if(!_0x2b53c8)throw new InternalError();return _0x2b53c8['destroy']();})['then'](function(){_0x3889c7[_0x86c5('0x1e')](0xcc)[_0x86c5('0x1f')]();})['catch'](handleError(_0x3889c7,null));};function getBucketslist(_0x4a76df,_0x43a263,_0x2b82c0){return new Promise(function(_0xf4b3c4,_0x2b2662){var _0x3d518a=new AWS['S3']({'accessKeyId':_0x43a263,'secretAccessKey':_0x4a76df,'region':_0x2b82c0});_0x3d518a['listBuckets']({},function(_0x4732ea,_0x22ac6e){if(_0x4732ea){return _0x2b2662(_0x4732ea);}else{return _0xf4b3c4(_0x22ac6e);}});});}function createBucket(_0x3611be,_0x18a179,_0x359874,_0x2d62b3){return new Promise(function(_0x481151,_0x15a390){var _0x5406d3=new AWS['S3']({'accessKeyId':_0x18a179,'secretAccessKey':_0x3611be,'region':_0x359874});_0x5406d3[_0x86c5('0x69')]({'Bucket':_0x2d62b3},function(_0x20c3c0,_0x324a55){if(_0x20c3c0){return _0x15a390(_0x20c3c0);}else{return _0x481151(_0x324a55);}});});}function uploadFile(_0x3780db,_0x1df83d,_0x494ba7,_0x23179a,_0x1d9cec,_0x4b7910){return new Promise(function(_0x3965ce,_0x49bfe6){var _0x363f4e=new AWS['S3']({'accessKeyId':_0x1df83d,'secretAccessKey':_0x3780db,'region':_0x494ba7});_0x363f4e['upload']({'Bucket':_0x23179a,'Key':_0x1d9cec,'Body':_0x4b7910},function(_0x5acfec,_0x3c0795){if(_0x5acfec){return _0x49bfe6(_0x5acfec);}else{return _0x3965ce(_0x3c0795);}});});}function startTranscribe(_0x47d259,_0x463604,_0x5cf8a3,_0x2a0ddd,_0x23a979,_0x21a017){return new Promise(function(_0xf9ab43,_0x1c5b4a){var _0xbe5bbb=new AWS[(_0x86c5('0x6a'))]({'accessKeyId':_0x463604,'secretAccessKey':_0x47d259,'region':_0x5cf8a3});_0xbe5bbb[_0x86c5('0x6b')]({'TranscriptionJobName':_0x2a0ddd,'LanguageCode':_0x23a979,'Media':{'MediaFileUri':_0x21a017}},function(_0x11abc8,_0x279c17){if(_0x11abc8){return _0x1c5b4a(_0x11abc8);}else{return _0xf9ab43(_0x279c17);}});});}function transcribe(_0x598039,_0x171bc0,_0x4673b7,_0x7be14e,_0x5065da,_0x22fc28,_0xff495a){return new Promise(function(_0x5238a4,_0x4f0934){var _0x5d204d={};logger[_0x86c5('0x64')](util[_0x86c5('0x31')](_0x86c5('0x6c'),_0x598039,_0x5065da));return uploadFile(_0x171bc0,_0x4673b7,_0x7be14e,_0x5065da,path[_0x86c5('0x6d')](_0x22fc28),fs[_0x86c5('0x6e')](_0x22fc28))[_0x86c5('0x29')](function(_0x325cd6){logger[_0x86c5('0x64')](util['format'](_0x86c5('0x6f'),_0x598039,_0x5065da,_0x325cd6[_0x86c5('0x70')]));_0x5d204d[_0x86c5('0x71')]=_0x325cd6['Bucket'];_0x5d204d[_0x86c5('0x72')]=_0x325cd6[_0x86c5('0x70')];logger[_0x86c5('0x64')](util['format'](_0x86c5('0x73'),_0x598039));return startTranscribe(_0x171bc0,_0x4673b7,_0x7be14e,uuidv4(),_0xff495a,_0x325cd6[_0x86c5('0x70')]);})[_0x86c5('0x29')](function(_0x44a45d){logger['info'](util[_0x86c5('0x31')](_0x86c5('0x74'),_0x598039,_0x44a45d[_0x86c5('0x75')][_0x86c5('0x76')]));_0x5d204d[_0x86c5('0x77')]=_0x44a45d[_0x86c5('0x75')][_0x86c5('0x76')];_0x5d204d[_0x86c5('0x78')]=_0x44a45d[_0x86c5('0x75')][_0x86c5('0x79')];return _0x5238a4(_0x5d204d);})['catch'](function(_0x3ff97e){return _0x4f0934(_0x3ff97e);});});}exports['runTranscribe']=function(_0x170799,_0x5bc475,_0x2f86dc){var _0x134207;var _0x1c1820;var _0x57f9f7;var _0x33de2b=require('../../components/encryptor');return db[_0x86c5('0x2d')][_0x86c5('0x7a')]({'where':{'id':_0x170799['params']['id']}})[_0x86c5('0x29')](function(_0x553cc5){if(_0x553cc5){var _0x15f47e=util[_0x86c5('0x31')](_0x86c5('0x50'),_0x553cc5[_0x86c5('0x4f')]);if(fs[_0x86c5('0x51')](_0x15f47e)){cypher=!![];return _0x33de2b[_0x86c5('0x52')](_0x15f47e,_0x553cc5['value'],config[_0x86c5('0x7b')][_0x86c5('0x5e')])[_0x86c5('0x29')](function(){return _0x553cc5;});}return _0x553cc5;}})[_0x86c5('0x29')](function(_0x2a68bd){if(!_0x2a68bd){throw new db[(_0x86c5('0x53'))][(_0x86c5('0x7c'))](_0x86c5('0x7d'));}_0x1c1820=_0x2a68bd;return db[_0x86c5('0x7e')][_0x86c5('0x7a')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5bc475,null))[_0x86c5('0x29')](function(_0x33c972){if(_0x33c972){_0x134207=_0x33c972;if(!_0x134207[_0x86c5('0x7f')]||!_0x134207[_0x86c5('0x80')]||!_0x134207[_0x86c5('0x81')]||!_0x134207[_0x86c5('0x82')]||!_0x134207[_0x86c5('0x71')]){throw new db[(_0x86c5('0x53'))][(_0x86c5('0x7c'))](_0x86c5('0x83'));}if(_0x170799[_0x86c5('0x4b')][_0x86c5('0x84')]&&(!_0x134207[_0x86c5('0x85')]||!_0x134207[_0x86c5('0x86')]||!_0x134207[_0x86c5('0x87')]||!_0x134207['language']||!_0x134207[_0x86c5('0x71')])){throw new db['Sequelize']['ValidationError'](_0x86c5('0x88'));}return db[_0x86c5('0x89')][_0x86c5('0x7a')]({'where':{'id':_0x134207[_0x86c5('0x80')]}});}})['then'](function(_0x81f884){if(!_0x81f884){throw new db[(_0x86c5('0x53'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x81f884['data1']||!_0x81f884[_0x86c5('0x8a')]){throw new db[(_0x86c5('0x53'))]['ValidationError'](_0x86c5('0x8b'));}_0x57f9f7=_0x81f884;return getBucketslist(_0x57f9f7['data1'],_0x57f9f7[_0x86c5('0x8a')],_0x134207[_0x86c5('0x81')]);})[_0x86c5('0x29')](function(_0x2aafe4){if(_0x2aafe4&&_0x2aafe4['Buckets']){var _0xae24bd=_['find'](_0x2aafe4[_0x86c5('0x8c')],function(_0xb12df0){return _0xb12df0[_0x86c5('0x8d')]===_0x134207['bucket'];});if(!_0xae24bd){logger[_0x86c5('0x64')](util[_0x86c5('0x31')](_0x86c5('0x8e'),_0x170799[_0x86c5('0x48')]['id'],_0x134207[_0x86c5('0x71')]));return createBucket(_0x57f9f7[_0x86c5('0x8f')],_0x57f9f7[_0x86c5('0x8a')],_0x134207['transcribeRegion'],_0x134207[_0x86c5('0x71')]);}logger['info'](util[_0x86c5('0x31')](_0x86c5('0x90'),_0x170799['params']['id'],_0x134207[_0x86c5('0x71')]));return;}})[_0x86c5('0x29')](function(_0x479f79){if(_0x1c1820[_0x86c5('0x78')]===_0x86c5('0x91')){return transcribe(_0x170799[_0x86c5('0x48')]['id'],_0x57f9f7[_0x86c5('0x8f')],_0x57f9f7[_0x86c5('0x8a')],_0x134207[_0x86c5('0x81')],_0x134207[_0x86c5('0x71')],_0x1c1820[_0x86c5('0x4f')],_0x134207[_0x86c5('0x82')]);}else{logger['info'](util['format'](_0x86c5('0x92'),_0x170799[_0x86c5('0x48')]['id']));return{'transcribeStatus':_0x86c5('0x93')};}})['then'](function(_0x5bb4f9){if(_0x5bb4f9){_0x5bb4f9[_0x86c5('0x94')]=_0x170799[_0x86c5('0x4b')]['runSentiment'];return _0x1c1820[_0x86c5('0x95')](_0x5bb4f9);}})['then'](respondWithResult(_0x5bc475,null))[_0x86c5('0x46')](handleError(_0x5bc475,null));};function writeFile(_0x47dc70,_0x2c8f69){return new Promise(function(_0x2838c2,_0x49daf2){fs[_0x86c5('0x96')](_0x2c8f69,_0x47dc70,function(_0x5054a1,_0x26b52d){if(_0x5054a1){return _0x49daf2(_0x5054a1);}else{return _0x2838c2(_0x26b52d);}});});}exports[_0x86c5('0x97')]=function(_0x310569,_0x340e6a,_0x24c696){return db['VoiceRecording']['findOne']({'where':{'id':_0x310569['params']['id']}})['then'](handleEntityNotFound(_0x340e6a))['then'](function(_0x1cd562){if(_0x1cd562&&_0x1cd562[_0x86c5('0x98')]){var _0x5165fc=_0x1cd562[_0x86c5('0x98')];var _0x3fa9f5=config['root']+_0x86c5('0x99')+_0x1cd562['id']+_0x86c5('0x9a');if(fs[_0x86c5('0x51')](_0x3fa9f5)){return _0x3fa9f5;}return writeFile(_0x5165fc,_0x3fa9f5)[_0x86c5('0x29')](function(){return _0x3fa9f5;});}else{throw new db[(_0x86c5('0x53'))][(_0x86c5('0x7c'))](_0x86c5('0x9b'));}})[_0x86c5('0x29')](function(_0x4bb565){return _0x340e6a['download'](_0x4bb565);})['catch'](handleError(_0x340e6a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index be7c290..27f505e 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 _0x31f1=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x14e350,_0x20acb9){var _0xf6e0f2=function(_0x3f1331){while(--_0x3f1331){_0x14e350['push'](_0x14e350['shift']());}};_0xf6e0f2(++_0x20acb9);}(_0x31f1,0x6f));var _0x131f=function(_0x270ee2,_0x11babb){_0x270ee2=_0x270ee2-0x0;var _0x1e9bdb=_0x31f1[_0x270ee2];return _0x1e9bdb;};'use strict';var _=require(_0x131f('0x0'));var util=require(_0x131f('0x1'));var logger=require(_0x131f('0x2'))(_0x131f('0x3'));var moment=require(_0x131f('0x4'));var BPromise=require('bluebird');var rp=require(_0x131f('0x5'));var fs=require('fs');var path=require(_0x131f('0x6'));var rimraf=require(_0x131f('0x7'));var config=require(_0x131f('0x8'));var attributes=require(_0x131f('0x9'));module[_0x131f('0xa')]=function(_0x49dbb0,_0x51099c){return _0x49dbb0[_0x131f('0xb')](_0x131f('0xc'),attributes,{'tableName':_0x131f('0xd'),'paranoid':![],'indexes':[{'name':_0x131f('0xe'),'fields':[_0x131f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0f4=['uniqueid','util','moment','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings'];(function(_0x1d80b6,_0x399a83){var _0x28568e=function(_0x291d85){while(--_0x291d85){_0x1d80b6['push'](_0x1d80b6['shift']());}};_0x28568e(++_0x399a83);}(_0xf0f4,0x182));var _0x4f0f=function(_0xaa7fc3,_0x6f8a9b){_0xaa7fc3=_0xaa7fc3-0x0;var _0x3f1175=_0xf0f4[_0xaa7fc3];return _0x3f1175;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4f0f('0x1'));var BPromise=require(_0x4f0f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f0f('0x3'));var rimraf=require(_0x4f0f('0x4'));var config=require(_0x4f0f('0x5'));var attributes=require(_0x4f0f('0x6'));module[_0x4f0f('0x7')]=function(_0x15e6cd,_0x3285cd){return _0x15e6cd['define'](_0x4f0f('0x8'),attributes,{'tableName':_0x4f0f('0x9'),'paranoid':![],'indexes':[{'name':_0x4f0f('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 21aa5fb..c6beddc 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 _0x2da6=['stringify','error','code','message','result','catch','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','create','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5199e6,_0x21984e){var _0x44a19b=function(_0x372eee){while(--_0x372eee){_0x5199e6['push'](_0x5199e6['shift']());}};_0x44a19b(++_0x21984e);}(_0x2da6,0x1dd));var _0x62da=function(_0x5ec78a,_0x152147){_0x5ec78a=_0x5ec78a-0x0;var _0x4ed7cd=_0x2da6[_0x5ec78a];return _0x4ed7cd;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100e73,_0x9d9139,_0x310c15){return new BPromise(function(_0x16f919,_0xbfd2b0){return client['request'](_0x100e73,_0x310c15)[_0x62da('0xc')](function(_0x2a3937){logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,'request\x20sent');logger[_0x62da('0xf')](_0x62da('0x10'),_0x9d9139,_0x62da('0x11'),JSON[_0x62da('0x12')](_0x2a3937));if(_0x2a3937[_0x62da('0x13')]){if(_0x2a3937['error'][_0x62da('0x14')]===0x1f4){logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0xbfd2b0(_0x2a3937['error']['message']);}logger[_0x62da('0x13')](_0x62da('0xe'),_0x9d9139,_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);return _0x16f919(_0x2a3937[_0x62da('0x13')][_0x62da('0x15')]);}else{logger[_0x62da('0xd')](_0x62da('0xe'),_0x9d9139,_0x62da('0x11'));_0x16f919(_0x2a3937[_0x62da('0x16')][_0x62da('0x15')]);}})[_0x62da('0x17')](function(_0x1f6bc8){logger[_0x62da('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x9d9139,_0x1f6bc8);_0xbfd2b0(_0x1f6bc8);});});}exports['UpdateVoiceRecording']=function(_0xa7050b){var _0x4ae4fb=this;return new Promise(function(_0x4d6482,_0x264366){return db[_0x62da('0x18')]['update'](_0xa7050b[_0x62da('0x19')],{'raw':_0xa7050b['options']?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1c')]||null:null,'attributes':_0xa7050b[_0x62da('0x1a')]?_0xa7050b[_0x62da('0x1a')][_0x62da('0x1d')]||null:null,'limit':_0xa7050b[_0x62da('0x1a')]?_0xa7050b['options'][_0x62da('0x1e')]||null:null})[_0x62da('0xc')](function(_0x2fd925){logger[_0x62da('0xd')](_0x62da('0x1f'),_0xa7050b);logger[_0x62da('0xf')](_0x62da('0x1f'),_0xa7050b,JSON['stringify'](_0x2fd925));_0x4d6482(_0x2fd925);})['catch'](function(_0x509fd9){logger[_0x62da('0x13')](_0x62da('0x1f'),_0x509fd9[_0x62da('0x15')],_0xa7050b);_0x264366(_0x4ae4fb[_0x62da('0x13')](0x1f4,_0x509fd9['message']));});});};exports[_0x62da('0x20')]=function(_0x3b9c06){var _0x5f0a9c=this;return new Promise(function(_0x3ccf96,_0x195dc4){var _0x1775ea=require('../../components/encryptor');var _0x41de3a;return db[_0x62da('0x21')][_0x62da('0x22')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3c6274){_0x41de3a=_0x3c6274;return db[_0x62da('0x18')][_0x62da('0x23')](_0x3b9c06['body']);})[_0x62da('0xc')](function(_0x2a4681){if(_0x41de3a[_0x62da('0x24')]&&fs[_0x62da('0x25')](_0x2a4681[_0x62da('0x26')])){var _0x1cf765=util['format'](_0x62da('0x27'),_0x2a4681['value']);return _0x1775ea[_0x62da('0x28')](_0x2a4681[_0x62da('0x26')],_0x1cf765,config[_0x62da('0x29')][_0x62da('0x2a')])[_0x62da('0xc')](function(){fs[_0x62da('0x2b')](_0x2a4681['value']);logger[_0x62da('0xd')](_0x62da('0x2c'));return _0x2a4681;});}return _0x2a4681;})[_0x62da('0xc')](function(_0x5107b1){logger[_0x62da('0xd')](_0x62da('0x20'),_0x3b9c06);logger[_0x62da('0xf')]('CreateVoiceRecording',_0x3b9c06,JSON[_0x62da('0x12')](_0x5107b1));_0x3ccf96(_0x5107b1);})[_0x62da('0x17')](function(_0x55eda7){logger[_0x62da('0x13')](_0x62da('0x20'),_0x55eda7['message'],_0x3b9c06);_0x195dc4(_0x5f0a9c[_0x62da('0x13')](0x1f4,_0x55eda7[_0x62da('0x15')]));});});}; \ No newline at end of file +var _0x5fdc=['CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceRecording,\x20%s,\x20%s','info','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','catch'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x5fdc,0x127));var _0xc5fd=function(_0xf1ff2a,_0x25017e){_0xf1ff2a=_0xf1ff2a-0x0;var _0x43652e=_0x5fdc[_0xf1ff2a];return _0x43652e;};'use strict';var _=require(_0xc5fd('0x0'));var util=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var BPromise=require(_0xc5fd('0x3'));var rs=require(_0xc5fd('0x4'));var fs=require('fs');var Redis=require(_0xc5fd('0x5'));var db=require(_0xc5fd('0x6'))['db'];var utils=require(_0xc5fd('0x7'));var logger=require(_0xc5fd('0x8'))(_0xc5fd('0x9'));var config=require(_0xc5fd('0xa'));var jayson=require(_0xc5fd('0xb'));var client=jayson[_0xc5fd('0xc')][_0xc5fd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x15ffe7,_0x5a2eb4,_0x5d86e5){return new BPromise(function(_0x493389,_0x224801){return client[_0xc5fd('0xe')](_0x15ffe7,_0x5d86e5)[_0xc5fd('0xf')](function(_0x45c91f){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5a2eb4,_0xc5fd('0x10'));logger[_0xc5fd('0x11')](_0xc5fd('0x12'),_0x5a2eb4,_0xc5fd('0x10'),JSON[_0xc5fd('0x13')](_0x45c91f));if(_0x45c91f[_0xc5fd('0x14')]){if(_0x45c91f['error'][_0xc5fd('0x15')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x224801(_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);}logger[_0xc5fd('0x14')](_0xc5fd('0x17'),_0x5a2eb4,_0x45c91f[_0xc5fd('0x14')][_0xc5fd('0x16')]);return _0x493389(_0x45c91f['error'][_0xc5fd('0x16')]);}else{logger[_0xc5fd('0x18')](_0xc5fd('0x17'),_0x5a2eb4,_0xc5fd('0x10'));_0x493389(_0x45c91f['result']['message']);}})['catch'](function(_0x5529b3){logger['error'](_0xc5fd('0x17'),_0x5a2eb4,_0x5529b3);_0x224801(_0x5529b3);});});}exports[_0xc5fd('0x19')]=function(_0x27f611){var _0xd0a9f1=this;return new Promise(function(_0x2ee392,_0x3f981f){return db[_0xc5fd('0x1a')]['update'](_0x27f611[_0xc5fd('0x1b')],{'raw':_0x27f611[_0xc5fd('0x1c')]?_0x27f611[_0xc5fd('0x1c')][_0xc5fd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f611[_0xc5fd('0x1c')]?_0x27f611['options'][_0xc5fd('0x1e')]||null:null,'attributes':_0x27f611[_0xc5fd('0x1c')]?_0x27f611[_0xc5fd('0x1c')][_0xc5fd('0x1f')]||null:null,'limit':_0x27f611['options']?_0x27f611['options'][_0xc5fd('0x20')]||null:null})[_0xc5fd('0xf')](function(_0x3d7211){logger[_0xc5fd('0x18')](_0xc5fd('0x19'),_0x27f611);logger[_0xc5fd('0x11')]('UpdateVoiceRecording',_0x27f611,JSON[_0xc5fd('0x13')](_0x3d7211));_0x2ee392(_0x3d7211);})[_0xc5fd('0x21')](function(_0x1a5174){logger[_0xc5fd('0x14')](_0xc5fd('0x19'),_0x1a5174[_0xc5fd('0x16')],_0x27f611);_0x3f981f(_0xd0a9f1[_0xc5fd('0x14')](0x1f4,_0x1a5174['message']));});});};exports[_0xc5fd('0x22')]=function(_0x48cd1d){var _0x2ee700=this;return new Promise(function(_0x231368,_0x44681d){var _0x2bee22=require('../../components/encryptor');var _0x176313;return db[_0xc5fd('0x23')][_0xc5fd('0x24')]({'attributes':['id',_0xc5fd('0x25')],'where':{'id':0x1},'raw':!![]})[_0xc5fd('0xf')](function(_0x209975){_0x176313=_0x209975;return db['VoiceRecording'][_0xc5fd('0x26')](_0x48cd1d['body']);})['then'](function(_0x12a962){if(_0x176313[_0xc5fd('0x25')]&&fs[_0xc5fd('0x27')](_0x12a962[_0xc5fd('0x28')])){var _0x7693c4=util[_0xc5fd('0x29')](_0xc5fd('0x2a'),_0x12a962[_0xc5fd('0x28')]);return _0x2bee22['encryptFile'](_0x12a962[_0xc5fd('0x28')],_0x7693c4,config[_0xc5fd('0x2b')][_0xc5fd('0x2c')])[_0xc5fd('0xf')](function(){fs[_0xc5fd('0x2d')](_0x12a962[_0xc5fd('0x28')]);logger[_0xc5fd('0x18')](_0xc5fd('0x2e'));return _0x12a962;});}return _0x12a962;})[_0xc5fd('0xf')](function(_0x466aa1){logger[_0xc5fd('0x18')](_0xc5fd('0x22'),_0x48cd1d);logger['debug'](_0xc5fd('0x22'),_0x48cd1d,JSON[_0xc5fd('0x13')](_0x466aa1));_0x231368(_0x466aa1);})[_0xc5fd('0x21')](function(_0x1fa329){logger[_0xc5fd('0x14')](_0xc5fd('0x22'),_0x1fa329[_0xc5fd('0x16')],_0x48cd1d);_0x44681d(_0x2ee700[_0xc5fd('0x14')](0x1f4,_0x1fa329[_0xc5fd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 1fdb70f..b3dcea9 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 _0xeaf1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','path','connect-timeout','express'];(function(_0x73a42f,_0xcb2f7c){var _0x551e1b=function(_0x449c68){while(--_0x449c68){_0x73a42f['push'](_0x73a42f['shift']());}};_0x551e1b(++_0xcb2f7c);}(_0xeaf1,0x10b));var _0x1eaf=function(_0x4dd6de,_0x2ee864){_0x4dd6de=_0x4dd6de-0x0;var _0x4a7380=_0xeaf1[_0x4dd6de];return _0x4a7380;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1eaf('0x0'));var timeout=require(_0x1eaf('0x1'));var express=require(_0x1eaf('0x2'));var router=express[_0x1eaf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1eaf('0x4'));var interaction=require(_0x1eaf('0x5'));var config=require(_0x1eaf('0x6'));var controller=require(_0x1eaf('0x7'));router[_0x1eaf('0x8')]('/',auth[_0x1eaf('0x9')](),controller[_0x1eaf('0xa')]);router[_0x1eaf('0x8')]('/describe',auth[_0x1eaf('0x9')](),controller['describe']);router[_0x1eaf('0x8')](_0x1eaf('0xb'),auth[_0x1eaf('0x9')](),controller[_0x1eaf('0xc')]);router['post']('/',auth[_0x1eaf('0x9')](),controller[_0x1eaf('0xd')]);router[_0x1eaf('0xe')](_0x1eaf('0xb'),auth[_0x1eaf('0x9')](),controller['update']);router[_0x1eaf('0xf')](_0x1eaf('0xb'),auth['isAuthenticated'](),controller[_0x1eaf('0x10')]);module[_0x1eaf('0x11')]=router; \ No newline at end of file +var _0x1e3d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x323437,_0x3bc345){var _0x2da452=function(_0x1d3776){while(--_0x1d3776){_0x323437['push'](_0x323437['shift']());}};_0x2da452(++_0x3bc345);}(_0x1e3d,0xc2));var _0xd1e3=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x1e3d[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xd1e3('0x0'));var util=require(_0xd1e3('0x1'));var path=require(_0xd1e3('0x2'));var timeout=require(_0xd1e3('0x3'));var express=require(_0xd1e3('0x4'));var router=express[_0xd1e3('0x5')]();var fs_extra=require(_0xd1e3('0x6'));var auth=require(_0xd1e3('0x7'));var interaction=require(_0xd1e3('0x8'));var config=require(_0xd1e3('0x9'));var controller=require(_0xd1e3('0xa'));router['get']('/',auth[_0xd1e3('0xb')](),controller[_0xd1e3('0xc')]);router[_0xd1e3('0xd')](_0xd1e3('0xe'),auth['isAuthenticated'](),controller['describe']);router[_0xd1e3('0xd')](_0xd1e3('0xf'),auth['isAuthenticated'](),controller[_0xd1e3('0x10')]);router[_0xd1e3('0x11')]('/',auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x12')]);router['put']('/:id',auth[_0xd1e3('0xb')](),controller[_0xd1e3('0x13')]);router['delete'](_0xd1e3('0xf'),auth['isAuthenticated'](),controller[_0xd1e3('0x14')]);module[_0xd1e3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index db340e9..d913bcf 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 _0x4ffc=['attended','STRING','ENUM','sequelize','blind'];(function(_0x10a7e8,_0x478b33){var _0x3a322e=function(_0x731b7c){while(--_0x731b7c){_0x10a7e8['push'](_0x10a7e8['shift']());}};_0x3a322e(++_0x478b33);}(_0x4ffc,0x1de));var _0xc4ff=function(_0x546060,_0x4bd3a8){_0x546060=_0x546060-0x0;var _0x1c9187=_0x4ffc[_0x546060];return _0x1c9187;};'use strict';var Sequelize=require(_0xc4ff('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0xc4ff('0x1'),_0xc4ff('0x2'))},'result':{'type':Sequelize[_0xc4ff('0x3')]},'transfererchannel':{'type':Sequelize[_0xc4ff('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xc4ff('0x3')]},'transferercalleridname':{'type':Sequelize[_0xc4ff('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc4ff('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xc4ff('0x3')]},'transfereraccountcode':{'type':Sequelize[_0xc4ff('0x3')]},'transferercontext':{'type':Sequelize[_0xc4ff('0x3')]},'transfererexten':{'type':Sequelize[_0xc4ff('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xc4ff('0x3')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xc4ff('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc4ff('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc4ff('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xc4ff('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xc4ff('0x3')]},'isexternal':{'type':Sequelize[_0xc4ff('0x4')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e1f=['Yes','sequelize','moment','exports','blind','attended','STRING'];(function(_0x40ad2b,_0x4710c8){var _0x3d6881=function(_0x8313cb){while(--_0x8313cb){_0x40ad2b['push'](_0x40ad2b['shift']());}};_0x3d6881(++_0x4710c8);}(_0x0e1f,0xb0));var _0xf0e1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0e1f[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xf0e1('0x0'));var moment=require(_0xf0e1('0x1'));module[_0xf0e1('0x2')]={'type':{'type':Sequelize['ENUM'](_0xf0e1('0x3'),_0xf0e1('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xf0e1('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf0e1('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf0e1('0x5')]},'transfererexten':{'type':Sequelize[_0xf0e1('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf0e1('0x5')]},'transfereechannel':{'type':Sequelize[_0xf0e1('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf0e1('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf0e1('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf0e1('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf0e1('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xf0e1('0x5')]},'transfereecontext':{'type':Sequelize[_0xf0e1('0x5')]},'transfereeexten':{'type':Sequelize[_0xf0e1('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf0e1('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xf0e1('0x6'),'No')},'context':{'type':Sequelize[_0xf0e1('0x5')]},'extension':{'type':Sequelize[_0xf0e1('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e53e0c3..7646394 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 _0x0199=['destroy','error','stack','name','map','VoiceTransferReport','rawAttributes','key','model','keys','query','attributes','intersection','fields','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x0199,0xfa));var _0x9019=function(_0x188936,_0x58e8fe){_0x188936=_0x188936-0x0;var _0x1cfb81=_0x0199[_0x188936];return _0x1cfb81;};'use strict';var emlformat=require(_0x9019('0x0'));var rimraf=require(_0x9019('0x1'));var zipdir=require(_0x9019('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9019('0x3'));var Mustache=require(_0x9019('0x4'));var util=require(_0x9019('0x5'));var path=require(_0x9019('0x6'));var sox=require(_0x9019('0x7'));var csv=require(_0x9019('0x8'));var ejs=require(_0x9019('0x9'));var fs=require('fs');var fs_extra=require(_0x9019('0xa'));var _=require(_0x9019('0xb'));var squel=require(_0x9019('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9019('0xd'));var toCsv=require(_0x9019('0x8'));var querystring=require(_0x9019('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9019('0xf'));var qs=require(_0x9019('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9019('0x11'));var logger=require(_0x9019('0x12'))(_0x9019('0x13'));var utils=require(_0x9019('0x14'));var config=require(_0x9019('0x15'));var licenseUtil=require(_0x9019('0x16'));var db=require(_0x9019('0x17'))['db'];function respondWithStatusCode(_0x592f6b,_0x88030e){_0x88030e=_0x88030e||0xcc;return function(_0x1d9582){if(_0x1d9582){return _0x592f6b[_0x9019('0x18')](_0x88030e);}return _0x592f6b[_0x9019('0x19')](_0x88030e)[_0x9019('0x1a')]();};}function respondWithResult(_0xdf3ee2,_0x27327e){_0x27327e=_0x27327e||0xc8;return function(_0x20307c){if(_0x20307c){return _0xdf3ee2[_0x9019('0x19')](_0x27327e)[_0x9019('0x1b')](_0x20307c);}};}function respondWithFilteredResult(_0x44d1ce,_0xbc05cb){return function(_0x23f386){if(_0x23f386){var _0x57dbc6=typeof _0xbc05cb['offset']===_0x9019('0x1c')&&typeof _0xbc05cb[_0x9019('0x1d')]===_0x9019('0x1c');var _0x3a6884=_0x23f386[_0x9019('0x1e')];var _0x2247aa=_0x57dbc6?0x0:_0xbc05cb[_0x9019('0x1f')];var _0xec98c3=_0x57dbc6?_0x23f386[_0x9019('0x1e')]:_0xbc05cb['offset']+_0xbc05cb['limit'];var _0xa786b8;if(_0xec98c3>=_0x3a6884){_0xec98c3=_0x3a6884;_0xa786b8=0xc8;}else{_0xa786b8=0xce;}_0x44d1ce['status'](_0xa786b8);return _0x44d1ce[_0x9019('0x20')](_0x9019('0x21'),_0x2247aa+'-'+_0xec98c3+'/'+_0x3a6884)[_0x9019('0x1b')](_0x23f386);}return null;};}function patchUpdates(_0x136319){return function(_0x3909aa){try{jsonpatch['apply'](_0x3909aa,_0x136319,!![]);}catch(_0x21394b){return BPromise[_0x9019('0x22')](_0x21394b);}return _0x3909aa[_0x9019('0x23')]();};}function saveUpdates(_0x3176ea,_0x3f37e7){return function(_0x2c15cb){if(_0x2c15cb){return _0x2c15cb[_0x9019('0x24')](_0x3176ea)[_0x9019('0x25')](function(_0x1278bb){return _0x1278bb;});}return null;};}function removeEntity(_0x31ca33,_0xadc8c6){return function(_0xad81a3){if(_0xad81a3){return _0xad81a3[_0x9019('0x26')]()[_0x9019('0x25')](function(){_0x31ca33[_0x9019('0x19')](0xcc)[_0x9019('0x1a')]();});}};}function handleEntityNotFound(_0x4b63cc,_0x476911){return function(_0x7fb8c8){if(!_0x7fb8c8){_0x4b63cc['sendStatus'](0x194);}return _0x7fb8c8;};}function handleError(_0x49d1d6,_0x9558cf){_0x9558cf=_0x9558cf||0x1f4;return function(_0x534b12){logger[_0x9019('0x27')](_0x534b12[_0x9019('0x28')]);if(_0x534b12[_0x9019('0x29')]){delete _0x534b12[_0x9019('0x29')];}_0x49d1d6[_0x9019('0x19')](_0x9558cf)['send'](_0x534b12);};}exports['index']=function(_0x2c50d5,_0x326b90){var _0x2b190b={},_0x80f152={},_0xbc8cdb={'count':0x0,'rows':[]};var _0x23e338=_[_0x9019('0x2a')](db[_0x9019('0x2b')][_0x9019('0x2c')],function(_0x1cc76c){return{'name':_0x1cc76c['fieldName'],'type':_0x1cc76c['type'][_0x9019('0x2d')]};});_0x80f152[_0x9019('0x2e')]=_[_0x9019('0x2a')](_0x23e338,_0x9019('0x29'));_0x80f152['query']=_[_0x9019('0x2f')](_0x2c50d5['query']);_0x80f152['filters']=_['intersection'](_0x80f152[_0x9019('0x2e')],_0x80f152[_0x9019('0x30')]);_0x2b190b[_0x9019('0x31')]=_[_0x9019('0x32')](_0x80f152[_0x9019('0x2e')],qs[_0x9019('0x33')](_0x2c50d5[_0x9019('0x30')]['fields']));_0x2b190b[_0x9019('0x31')]=_0x2b190b[_0x9019('0x31')]['length']?_0x2b190b['attributes']:_0x80f152[_0x9019('0x2e')];if(!_0x2c50d5[_0x9019('0x30')]['hasOwnProperty']('nolimit')){_0x2b190b[_0x9019('0x1d')]=qs[_0x9019('0x1d')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1d')]);_0x2b190b[_0x9019('0x1f')]=qs[_0x9019('0x1f')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x1f')]);}_0x2b190b['order']=qs[_0x9019('0x34')](_0x2c50d5[_0x9019('0x30')][_0x9019('0x34')]);_0x2b190b[_0x9019('0x35')]=qs[_0x9019('0x36')](_['pick'](_0x2c50d5[_0x9019('0x30')],_0x80f152['filters']),_0x23e338);if(_0x2c50d5['query'][_0x9019('0x37')]){_0x2b190b[_0x9019('0x35')]=_[_0x9019('0x38')](_0x2b190b[_0x9019('0x35')],{'$or':_[_0x9019('0x2a')](_0x23e338,function(_0x2d1d44){if(_0x2d1d44[_0x9019('0x39')]!==_0x9019('0x3a')){var _0x519055={};_0x519055[_0x2d1d44[_0x9019('0x29')]]={'$like':'%'+_0x2c50d5[_0x9019('0x30')][_0x9019('0x37')]+'%'};return _0x519055;}})});}_0x2b190b=_[_0x9019('0x38')]({},_0x2b190b,_0x2c50d5[_0x9019('0x3b')]);var _0x5a3b2d={'where':_0x2b190b[_0x9019('0x35')]};return db[_0x9019('0x2b')][_0x9019('0x1e')](_0x5a3b2d)['then'](function(_0x518fb9){_0xbc8cdb[_0x9019('0x1e')]=_0x518fb9;if(_0x2c50d5[_0x9019('0x30')][_0x9019('0x3c')]){_0x2b190b['include']=[{'all':!![]}];}return db[_0x9019('0x2b')][_0x9019('0x3d')](_0x2b190b);})[_0x9019('0x25')](function(_0xd6cb88){_0xbc8cdb[_0x9019('0x3e')]=_0xd6cb88;return _0xbc8cdb;})[_0x9019('0x25')](respondWithFilteredResult(_0x326b90,_0x2b190b))[_0x9019('0x3f')](handleError(_0x326b90,null));};exports[_0x9019('0x40')]=function(_0x5e24fa,_0x3f9ff1){var _0x52a10e={'raw':!![],'where':{'id':_0x5e24fa[_0x9019('0x41')]['id']}},_0x5c789b={};_0x5c789b[_0x9019('0x2e')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x5c789b['query']=_[_0x9019('0x2f')](_0x5e24fa['query']);_0x5c789b['filters']=_[_0x9019('0x32')](_0x5c789b[_0x9019('0x2e')],_0x5c789b[_0x9019('0x30')]);_0x52a10e['attributes']=_[_0x9019('0x32')](_0x5c789b['model'],qs['fields'](_0x5e24fa['query'][_0x9019('0x33')]));_0x52a10e[_0x9019('0x31')]=_0x52a10e[_0x9019('0x31')][_0x9019('0x42')]?_0x52a10e['attributes']:_0x5c789b['model'];if(_0x5e24fa[_0x9019('0x30')]['includeAll']){_0x52a10e[_0x9019('0x43')]=[{'all':!![]}];}_0x52a10e=_[_0x9019('0x38')]({},_0x52a10e,_0x5e24fa[_0x9019('0x3b')]);return db[_0x9019('0x2b')][_0x9019('0x44')](_0x52a10e)[_0x9019('0x25')](handleEntityNotFound(_0x3f9ff1,null))['then'](respondWithResult(_0x3f9ff1,null))[_0x9019('0x3f')](handleError(_0x3f9ff1,null));};exports[_0x9019('0x45')]=function(_0x302121,_0x5c51a5){return db[_0x9019('0x2b')][_0x9019('0x45')](_0x302121['body'],{})['then'](respondWithResult(_0x5c51a5,0xc9))[_0x9019('0x3f')](handleError(_0x5c51a5,null));};exports[_0x9019('0x24')]=function(_0x24d547,_0x1d2080){if(_0x24d547['body']['id']){delete _0x24d547[_0x9019('0x46')]['id'];}return db[_0x9019('0x2b')][_0x9019('0x44')]({'where':{'id':_0x24d547[_0x9019('0x41')]['id']}})[_0x9019('0x25')](handleEntityNotFound(_0x1d2080,null))[_0x9019('0x25')](saveUpdates(_0x24d547[_0x9019('0x46')],null))[_0x9019('0x25')](respondWithResult(_0x1d2080,null))[_0x9019('0x3f')](handleError(_0x1d2080,null));};exports[_0x9019('0x26')]=function(_0x255029,_0x2610b9){return db[_0x9019('0x2b')]['find']({'where':{'id':_0x255029[_0x9019('0x41')]['id']}})['then'](handleEntityNotFound(_0x2610b9,null))[_0x9019('0x25')](removeEntity(_0x2610b9,null))[_0x9019('0x3f')](handleError(_0x2610b9,null));};exports[_0x9019('0x47')]=function(_0x1cc0e7,_0x1e77e6){return db['VoiceTransferReport']['describe']()[_0x9019('0x25')](respondWithResult(_0x1e77e6,null))[_0x9019('0x3f')](handleError(_0x1e77e6,null));}; \ No newline at end of file +var _0x1493=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x162a08,_0x13d79e){var _0x104b75=function(_0x1f8f45){while(--_0x1f8f45){_0x162a08['push'](_0x162a08['shift']());}};_0x104b75(++_0x13d79e);}(_0x1493,0x11f));var _0x3149=function(_0x2d364e,_0x592aef){_0x2d364e=_0x2d364e-0x0;var _0x2847bd=_0x1493[_0x2d364e];return _0x2847bd;};'use strict';var emlformat=require(_0x3149('0x0'));var rimraf=require(_0x3149('0x1'));var zipdir=require(_0x3149('0x2'));var jsonpatch=require(_0x3149('0x3'));var rp=require(_0x3149('0x4'));var moment=require(_0x3149('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3149('0x6'));var path=require(_0x3149('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3149('0x8'));var _=require(_0x3149('0x9'));var squel=require(_0x3149('0xa'));var crypto=require(_0x3149('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3149('0xc'));var toCsv=require(_0x3149('0xd'));var querystring=require(_0x3149('0xe'));var Papa=require(_0x3149('0xf'));var Redis=require('ioredis');var authService=require(_0x3149('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3149('0x11'));var hardwareService=require(_0x3149('0x12'));var logger=require(_0x3149('0x13'))(_0x3149('0x14'));var utils=require(_0x3149('0x15'));var config=require(_0x3149('0x16'));var licenseUtil=require(_0x3149('0x17'));var db=require(_0x3149('0x18'))['db'];function respondWithStatusCode(_0x5c7bc2,_0x3bdf26){_0x3bdf26=_0x3bdf26||0xcc;return function(_0x439d5e){if(_0x439d5e){return _0x5c7bc2['sendStatus'](_0x3bdf26);}return _0x5c7bc2['status'](_0x3bdf26)[_0x3149('0x19')]();};}function respondWithResult(_0x2b03de,_0x252a3e){_0x252a3e=_0x252a3e||0xc8;return function(_0x3bd369){if(_0x3bd369){return _0x2b03de[_0x3149('0x1a')](_0x252a3e)['json'](_0x3bd369);}};}function respondWithFilteredResult(_0x14f7b1,_0xb21fae){return function(_0x2e6f9e){if(_0x2e6f9e){var _0x464e8a=typeof _0xb21fae[_0x3149('0x1b')]===_0x3149('0x1c')&&typeof _0xb21fae[_0x3149('0x1d')]===_0x3149('0x1c');var _0x5661e5=_0x2e6f9e[_0x3149('0x1e')];var _0x100a30=_0x464e8a?0x0:_0xb21fae[_0x3149('0x1b')];var _0x3a7ef7=_0x464e8a?_0x2e6f9e[_0x3149('0x1e')]:_0xb21fae[_0x3149('0x1b')]+_0xb21fae['limit'];var _0x382ed0;if(_0x3a7ef7>=_0x5661e5){_0x3a7ef7=_0x5661e5;_0x382ed0=0xc8;}else{_0x382ed0=0xce;}_0x14f7b1[_0x3149('0x1a')](_0x382ed0);return _0x14f7b1[_0x3149('0x1f')](_0x3149('0x20'),_0x100a30+'-'+_0x3a7ef7+'/'+_0x5661e5)[_0x3149('0x21')](_0x2e6f9e);}return null;};}function patchUpdates(_0x410a04){return function(_0x3ebbd4){try{jsonpatch[_0x3149('0x22')](_0x3ebbd4,_0x410a04,!![]);}catch(_0x55f198){return BPromise[_0x3149('0x23')](_0x55f198);}return _0x3ebbd4['save']();};}function saveUpdates(_0x16ab1b,_0x26b0c7){return function(_0x4c72ff){if(_0x4c72ff){return _0x4c72ff['update'](_0x16ab1b)[_0x3149('0x24')](function(_0x195a20){return _0x195a20;});}return null;};}function removeEntity(_0x55cb09,_0x17f8e3){return function(_0x59d2ad){if(_0x59d2ad){return _0x59d2ad[_0x3149('0x25')]()[_0x3149('0x24')](function(){_0x55cb09[_0x3149('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3a2fd,_0x24277e){return function(_0x2177f1){if(!_0x2177f1){_0xf3a2fd['sendStatus'](0x194);}return _0x2177f1;};}function handleError(_0x508881,_0x32078d){_0x32078d=_0x32078d||0x1f4;return function(_0x3ffa37){logger[_0x3149('0x26')](_0x3ffa37[_0x3149('0x27')]);if(_0x3ffa37[_0x3149('0x28')]){delete _0x3ffa37[_0x3149('0x28')];}_0x508881[_0x3149('0x1a')](_0x32078d)[_0x3149('0x29')](_0x3ffa37);};}exports[_0x3149('0x2a')]=function(_0x99908f,_0x2995d2){var _0x34423d={},_0x44327a={},_0x349905={'count':0x0,'rows':[]};var _0x3fa453=_[_0x3149('0x2b')](db[_0x3149('0x2c')][_0x3149('0x2d')],function(_0xe82c23){return{'name':_0xe82c23[_0x3149('0x2e')],'type':_0xe82c23['type'][_0x3149('0x2f')]};});_0x44327a[_0x3149('0x30')]=_[_0x3149('0x2b')](_0x3fa453,_0x3149('0x28'));_0x44327a[_0x3149('0x31')]=_[_0x3149('0x32')](_0x99908f[_0x3149('0x31')]);_0x44327a['filters']=_[_0x3149('0x33')](_0x44327a[_0x3149('0x30')],_0x44327a[_0x3149('0x31')]);_0x34423d[_0x3149('0x34')]=_[_0x3149('0x33')](_0x44327a[_0x3149('0x30')],qs[_0x3149('0x35')](_0x99908f[_0x3149('0x31')][_0x3149('0x35')]));_0x34423d[_0x3149('0x34')]=_0x34423d[_0x3149('0x34')][_0x3149('0x36')]?_0x34423d[_0x3149('0x34')]:_0x44327a['model'];if(!_0x99908f['query'][_0x3149('0x37')](_0x3149('0x38'))){_0x34423d[_0x3149('0x1d')]=qs[_0x3149('0x1d')](_0x99908f[_0x3149('0x31')][_0x3149('0x1d')]);_0x34423d[_0x3149('0x1b')]=qs[_0x3149('0x1b')](_0x99908f['query']['offset']);}_0x34423d[_0x3149('0x39')]=qs[_0x3149('0x3a')](_0x99908f[_0x3149('0x31')][_0x3149('0x3a')]);_0x34423d[_0x3149('0x3b')]=qs[_0x3149('0x3c')](_[_0x3149('0x3d')](_0x99908f[_0x3149('0x31')],_0x44327a['filters']),_0x3fa453);if(_0x99908f[_0x3149('0x31')][_0x3149('0x3e')]){_0x34423d[_0x3149('0x3b')]=_[_0x3149('0x3f')](_0x34423d[_0x3149('0x3b')],{'$or':_[_0x3149('0x2b')](_0x3fa453,function(_0x3c2ac6){if(_0x3c2ac6[_0x3149('0x40')]!=='VIRTUAL'){var _0x291e04={};_0x291e04[_0x3c2ac6[_0x3149('0x28')]]={'$like':'%'+_0x99908f['query'][_0x3149('0x3e')]+'%'};return _0x291e04;}})});}_0x34423d=_['merge']({},_0x34423d,_0x99908f[_0x3149('0x41')]);var _0x4b5d89={'where':_0x34423d['where']};return db[_0x3149('0x2c')][_0x3149('0x1e')](_0x4b5d89)['then'](function(_0x254745){_0x349905[_0x3149('0x1e')]=_0x254745;if(_0x99908f['query'][_0x3149('0x42')]){_0x34423d[_0x3149('0x43')]=[{'all':!![]}];}return db[_0x3149('0x2c')]['findAll'](_0x34423d);})['then'](function(_0x7f363){_0x349905[_0x3149('0x44')]=_0x7f363;return _0x349905;})['then'](respondWithFilteredResult(_0x2995d2,_0x34423d))[_0x3149('0x45')](handleError(_0x2995d2,null));};exports['show']=function(_0x50d2e1,_0x30ac91){var _0x1c7f04={'raw':!![],'where':{'id':_0x50d2e1[_0x3149('0x46')]['id']}},_0xf3e22={};_0xf3e22[_0x3149('0x30')]=_[_0x3149('0x32')](db[_0x3149('0x2c')]['rawAttributes']);_0xf3e22['query']=_[_0x3149('0x32')](_0x50d2e1[_0x3149('0x31')]);_0xf3e22[_0x3149('0x3c')]=_[_0x3149('0x33')](_0xf3e22[_0x3149('0x30')],_0xf3e22['query']);_0x1c7f04['attributes']=_[_0x3149('0x33')](_0xf3e22['model'],qs[_0x3149('0x35')](_0x50d2e1['query'][_0x3149('0x35')]));_0x1c7f04[_0x3149('0x34')]=_0x1c7f04[_0x3149('0x34')][_0x3149('0x36')]?_0x1c7f04[_0x3149('0x34')]:_0xf3e22[_0x3149('0x30')];if(_0x50d2e1['query'][_0x3149('0x42')]){_0x1c7f04[_0x3149('0x43')]=[{'all':!![]}];}_0x1c7f04=_['merge']({},_0x1c7f04,_0x50d2e1['options']);return db[_0x3149('0x2c')][_0x3149('0x47')](_0x1c7f04)[_0x3149('0x24')](handleEntityNotFound(_0x30ac91,null))[_0x3149('0x24')](respondWithResult(_0x30ac91,null))[_0x3149('0x45')](handleError(_0x30ac91,null));};exports[_0x3149('0x48')]=function(_0x3b34ed,_0x3c6117){return db[_0x3149('0x2c')][_0x3149('0x48')](_0x3b34ed[_0x3149('0x49')],{})[_0x3149('0x24')](respondWithResult(_0x3c6117,0xc9))[_0x3149('0x45')](handleError(_0x3c6117,null));};exports[_0x3149('0x4a')]=function(_0x358687,_0x856760){if(_0x358687[_0x3149('0x49')]['id']){delete _0x358687[_0x3149('0x49')]['id'];}return db[_0x3149('0x2c')][_0x3149('0x47')]({'where':{'id':_0x358687[_0x3149('0x46')]['id']}})[_0x3149('0x24')](handleEntityNotFound(_0x856760,null))[_0x3149('0x24')](saveUpdates(_0x358687[_0x3149('0x49')],null))[_0x3149('0x24')](respondWithResult(_0x856760,null))[_0x3149('0x45')](handleError(_0x856760,null));};exports[_0x3149('0x25')]=function(_0x338eb6,_0x4e750e){return db[_0x3149('0x2c')][_0x3149('0x47')]({'where':{'id':_0x338eb6['params']['id']}})[_0x3149('0x24')](handleEntityNotFound(_0x4e750e,null))[_0x3149('0x24')](removeEntity(_0x4e750e,null))['catch'](handleError(_0x4e750e,null));};exports[_0x3149('0x4b')]=function(_0x50fa0a,_0x2959cb){return db[_0x3149('0x2c')][_0x3149('0x4b')]()['then'](respondWithResult(_0x2959cb,null))[_0x3149('0x45')](handleError(_0x2959cb,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 8523449..3a326b7 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 _0xa2c2=['../../config/environment','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xa2c2,0x118));var _0x2a2c=function(_0x1ef7f8,_0x404e1){_0x1ef7f8=_0x1ef7f8-0x0;var _0x2962f4=_0xa2c2[_0x1ef7f8];return _0x2962f4;};'use strict';var _=require(_0x2a2c('0x0'));var util=require(_0x2a2c('0x1'));var logger=require(_0x2a2c('0x2'))(_0x2a2c('0x3'));var moment=require(_0x2a2c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2a2c('0x5'));var config=require(_0x2a2c('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0x2a2c('0x7')]=function(_0x4cc7b5,_0x335d2c){return _0x4cc7b5[_0x2a2c('0x8')](_0x2a2c('0x9'),attributes,{'tableName':_0x2a2c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad61=['exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes'];(function(_0x1bbe54,_0xdc2c1b){var _0x1c5952=function(_0x4cfe8f){while(--_0x4cfe8f){_0x1bbe54['push'](_0x1bbe54['shift']());}};_0x1c5952(++_0xdc2c1b);}(_0xad61,0x17b));var _0x1ad6=function(_0x5bc814,_0x2f3b9b){_0x5bc814=_0x5bc814-0x0;var _0x1ce86d=_0xad61[_0x5bc814];return _0x1ce86d;};'use strict';var _=require(_0x1ad6('0x0'));var util=require(_0x1ad6('0x1'));var logger=require(_0x1ad6('0x2'))(_0x1ad6('0x3'));var moment=require(_0x1ad6('0x4'));var BPromise=require(_0x1ad6('0x5'));var rp=require(_0x1ad6('0x6'));var fs=require('fs');var path=require(_0x1ad6('0x7'));var rimraf=require(_0x1ad6('0x8'));var config=require(_0x1ad6('0x9'));var attributes=require(_0x1ad6('0xa'));module[_0x1ad6('0xb')]=function(_0x21e109,_0x53f0ec){return _0x21e109[_0x1ad6('0xc')](_0x1ad6('0xd'),attributes,{'tableName':_0x1ad6('0xe'),'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 b702271..0792dd1 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 _0xa0f2=['request\x20sent','stringify','error','message','result','VoiceTransferReport','create','options','raw','then','CreateVoiceTransferReport','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa0f2,0xd7));var _0x2a0f=function(_0x53c506,_0x1c0fe8){_0x53c506=_0x53c506-0x0;var _0x165888=_0xa0f2[_0x53c506];return _0x165888;};'use strict';var _=require(_0x2a0f('0x0'));var util=require(_0x2a0f('0x1'));var moment=require(_0x2a0f('0x2'));var BPromise=require(_0x2a0f('0x3'));var rs=require(_0x2a0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a0f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a0f('0x6'))(_0x2a0f('0x7'));var config=require(_0x2a0f('0x8'));var jayson=require(_0x2a0f('0x9'));var client=jayson[_0x2a0f('0xa')][_0x2a0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3a45,_0x4512c9,_0x4d51c3){return new BPromise(function(_0x5b26bd,_0x7173b8){return client[_0x2a0f('0xc')](_0x2e3a45,_0x4d51c3)['then'](function(_0x1d7373){logger[_0x2a0f('0xd')](_0x2a0f('0xe'),_0x4512c9,'request\x20sent');logger[_0x2a0f('0xf')](_0x2a0f('0x10'),_0x4512c9,_0x2a0f('0x11'),JSON[_0x2a0f('0x12')](_0x1d7373));if(_0x1d7373['error']){if(_0x1d7373['error']['code']===0x1f4){logger[_0x2a0f('0x13')](_0x2a0f('0xe'),_0x4512c9,_0x1d7373[_0x2a0f('0x13')][_0x2a0f('0x14')]);return _0x7173b8(_0x1d7373[_0x2a0f('0x13')][_0x2a0f('0x14')]);}logger[_0x2a0f('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4512c9,_0x1d7373[_0x2a0f('0x13')][_0x2a0f('0x14')]);return _0x5b26bd(_0x1d7373[_0x2a0f('0x13')]['message']);}else{logger['info'](_0x2a0f('0xe'),_0x4512c9,_0x2a0f('0x11'));_0x5b26bd(_0x1d7373[_0x2a0f('0x15')][_0x2a0f('0x14')]);}})['catch'](function(_0x4fd985){logger[_0x2a0f('0x13')]('VoiceTransferReport,\x20%s,\x20%s',_0x4512c9,_0x4fd985);_0x7173b8(_0x4fd985);});});}exports['CreateVoiceTransferReport']=function(_0x5c5316){var _0x27ed3d=this;return new Promise(function(_0x339e94,_0x510b64){return db[_0x2a0f('0x16')][_0x2a0f('0x17')](_0x5c5316['body'],{'raw':_0x5c5316['options']?_0x5c5316[_0x2a0f('0x18')][_0x2a0f('0x19')]===undefined?!![]:![]:!![]})[_0x2a0f('0x1a')](function(_0x559226){logger[_0x2a0f('0xd')]('CreateVoiceTransferReport',_0x5c5316);logger[_0x2a0f('0xf')](_0x2a0f('0x1b'),_0x5c5316,JSON[_0x2a0f('0x12')](_0x559226));_0x339e94(_0x559226);})[_0x2a0f('0x1c')](function(_0x39207c){logger[_0x2a0f('0x13')](_0x2a0f('0x1b'),_0x39207c['message'],_0x5c5316);_0x510b64(_0x27ed3d['error'](0x1f4,_0x39207c[_0x2a0f('0x14')]));});});}; \ No newline at end of file +var _0x4f76=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','CreateVoiceTransferReport','create','body','options','raw','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x4f76,0x16c));var _0x64f7=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x4f76[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0x64f7('0x0'));var util=require(_0x64f7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64f7('0x3'))['db'];var utils=require(_0x64f7('0x4'));var logger=require(_0x64f7('0x5'))('rpc');var config=require(_0x64f7('0x6'));var jayson=require(_0x64f7('0x7'));var client=jayson[_0x64f7('0x8')][_0x64f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x599f3,_0x39da85,_0x314e9){return new BPromise(function(_0x1aba2d,_0x15e5f2){return client[_0x64f7('0xa')](_0x599f3,_0x314e9)[_0x64f7('0xb')](function(_0xf2cd8c){logger['info'](_0x64f7('0xc'),_0x39da85,_0x64f7('0xd'));logger[_0x64f7('0xe')](_0x64f7('0xf'),_0x39da85,_0x64f7('0xd'),JSON[_0x64f7('0x10')](_0xf2cd8c));if(_0xf2cd8c['error']){if(_0xf2cd8c['error'][_0x64f7('0x11')]===0x1f4){logger[_0x64f7('0x12')](_0x64f7('0xc'),_0x39da85,_0xf2cd8c[_0x64f7('0x12')]['message']);return _0x15e5f2(_0xf2cd8c['error']['message']);}logger[_0x64f7('0x12')](_0x64f7('0xc'),_0x39da85,_0xf2cd8c[_0x64f7('0x12')][_0x64f7('0x13')]);return _0x1aba2d(_0xf2cd8c[_0x64f7('0x12')][_0x64f7('0x13')]);}else{logger[_0x64f7('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x39da85,'request\x20sent');_0x1aba2d(_0xf2cd8c['result'][_0x64f7('0x13')]);}})[_0x64f7('0x15')](function(_0x23c79e){logger[_0x64f7('0x12')](_0x64f7('0xc'),_0x39da85,_0x23c79e);_0x15e5f2(_0x23c79e);});});}exports[_0x64f7('0x16')]=function(_0x35554f){var _0x24a782=this;return new Promise(function(_0x24cec9,_0x2150fd){return db['VoiceTransferReport'][_0x64f7('0x17')](_0x35554f[_0x64f7('0x18')],{'raw':_0x35554f['options']?_0x35554f[_0x64f7('0x19')][_0x64f7('0x1a')]===undefined?!![]:![]:!![]})[_0x64f7('0xb')](function(_0x2b501a){logger[_0x64f7('0x14')](_0x64f7('0x16'),_0x35554f);logger[_0x64f7('0xe')](_0x64f7('0x16'),_0x35554f,JSON['stringify'](_0x2b501a));_0x24cec9(_0x2b501a);})[_0x64f7('0x15')](function(_0x409c2a){logger['error']('CreateVoiceTransferReport',_0x409c2a[_0x64f7('0x13')],_0x35554f);_0x2150fd(_0x24a782[_0x64f7('0x12')](0x1f4,_0x409c2a[_0x64f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a44217e..32716cd 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 _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x441f0f,_0x4c0093){var _0x1dd125=function(_0x4fa2e0){while(--_0x4fa2e0){_0x441f0f['push'](_0x441f0f['shift']());}};_0x1dd125(++_0x4c0093);}(_0xf109,0xce));var _0x9f10=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xf109[_0x25e7cb];return _0x375d92;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x336e7a,_0x211e1a){var _0x3764db=function(_0x19fdbd){while(--_0x19fdbd){_0x336e7a['push'](_0x336e7a['shift']());}};_0x3764db(++_0x211e1a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2495a4,_0x54b399){_0x2495a4=_0x2495a4-0x0;var _0x25d4b4=_0x9bde[_0x2495a4];return _0x25d4b4;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);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 a09ec69..56dac93 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 _0xa37e=['unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','transfer','transfer\x20fired:','transferNumber','../../mysqldb','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','ioredis','redis','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','request','then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','rows','sessionId','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','hangup\x20fired:','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','hold\x20executed!'];(function(_0x11c93e,_0xd3235e){var _0x3d1726=function(_0x3dc228){while(--_0x3dc228){_0x11c93e['push'](_0x11c93e['shift']());}};_0x3d1726(++_0xd3235e);}(_0xa37e,0x97));var _0xea37=function(_0x41ea6a,_0x2b9280){_0x41ea6a=_0x41ea6a-0x0;var _0x47349f=_0xa37e[_0x41ea6a];return _0x47349f;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xea37('0x0'))['db'];var config=require(_0xea37('0x1'));var util=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0xea37('0x4')]['http']({'port':0x232a});var logger=require(_0xea37('0x5'))(_0xea37('0x6'));var Redis=require(_0xea37('0x7'));config['redis']=_['defaults'](config[_0xea37('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xea37('0x8')]));var Schema=require(_0xea37('0x9'));var originateValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],_0xea37('0xb')]},'callNumber':{'type':'string','required':[!![],_0xea37('0xc')]},'callerId':{'type':_0xea37('0xd')},'callbackUrl':{'type':_0xea37('0xd')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xea37('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],_0xea37('0xb')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],_0xea37('0xb')]},'sessionId':{'type':_0xea37('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xea37('0xd'),'required':[!![],_0xea37('0xe')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xea37('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xea37('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],_0xea37('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xea37('0xa'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x18e4b8,_0x58f979,_0x49604a){logger[_0xea37('0xf')](_0x18e4b8,_0x58f979,JSON['stringify'](_0x49604a));io['to'](_0x18e4b8)[_0xea37('0x10')](_0x58f979,_0x49604a);}function handleError(_0x421f7d){return function(_0x4ef3c9){console[_0xea37('0x11')](_0xea37('0x12'),_0x4ef3c9,_0x4ef3c9 instanceof RangeError);logger['error'](_0x4ef3c9[_0xea37('0x13')]);if(_0x4ef3c9 instanceof RangeError){if(_0x4ef3c9[_0xea37('0x14')]){delete _0x4ef3c9[_0xea37('0x14')];}_0x421f7d[_0xea37('0x15')](0x194)[_0xea37('0x16')](_0x4ef3c9);}else{if(_0x4ef3c9[_0xea37('0x14')]){delete _0x4ef3c9[_0xea37('0x14')];}_0x421f7d[_0xea37('0x15')](0x1f4)[_0xea37('0x16')](_0x4ef3c9);}};}function checkError(){return function(_0x3e00cb){if(!_0x3e00cb){throw new RangeError('NotFound');}return _0x3e00cb;};}function respondWithRpcPromise(_0x23bb57,_0x2a81f5){return new BPromise(function(_0x356f04,_0x536eff){var _0x4aa2ae=amiClient;return _0x4aa2ae[_0xea37('0x17')](_0x23bb57,_0x2a81f5)[_0xea37('0x18')](function(_0x98c6de){if(_0x98c6de[_0xea37('0x19')]){if(_0x98c6de['error'][_0xea37('0x1a')]===0x1f4){return _0x536eff(_0x98c6de['error']['message']);}return _0x356f04(_0x98c6de['error'][_0xea37('0x1b')]);}else{_0x356f04(_0x98c6de['result']);}})[_0xea37('0x1c')](function(_0x11dfbb){_0x536eff(_0x11dfbb);});});}function getAgent(_0x15a0f5){return db[_0xea37('0x1d')][_0xea37('0x1e')]({'where':{'id':_0x15a0f5,'role':_0xea37('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x57a7cc,_0x55880c){return new BPromise(function(_0x477e25,_0x3e272e){var _0x4ffcf1=respondWithRpcPromise(_0xea37('0x20'));var _0x10d556=getAgent(_0x57a7cc);Promise[_0xea37('0x21')]([_0x4ffcf1,_0x10d556])['then'](function(_0xe5b07a){var _0x366acb=_0xe5b07a[0x0];var _0xc07758=_0xe5b07a[0x1];var _0x2e745c=_['filter'](_0x366acb[_0xea37('0x22')],function(_0x55388b){return _0x55388b['UserId']==_0xc07758['id']&&_0x55388b[_0xea37('0x23')]==_0x55880c;});if(_0x2e745c['length']==0x1){_0x477e25(_0xc07758);}else{_0x3e272e(new RangeError('sessionId\x20'+_0x55880c+'\x20not\x20found!'));}});});}exports[_0xea37('0x24')]=function(_0x1e4bc0,_0x3ec6af){logger[_0xea37('0xf')](_0xea37('0x25'),_0x1e4bc0[_0xea37('0x26')]);var _0x5e2526=originateValidation[_0xea37('0x9')](_0x1e4bc0[_0xea37('0x26')]);if(_0x5e2526[_0xea37('0x27')]>0x0){return _0x3ec6af[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x5e2526);}var _0x33717c=_0x1e4bc0['body'][_0xea37('0x29')];var _0x4c75d7=_0x1e4bc0[_0xea37('0x26')][_0xea37('0x2a')];var _0x1cca3e=_0x1e4bc0[_0xea37('0x26')][_0xea37('0x2b')];var _0x321200=_0x1e4bc0[_0xea37('0x26')][_0xea37('0x2c')];return getAgent(_0x33717c)['then'](function(_0x405c44){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x405c44[_0xea37('0x14')]);emit(util[_0xea37('0x2e')](_0xea37('0x2f'),_0x405c44['name']),'webbar:originate',{'callNumber':_0x4c75d7,'callerId':_0x1cca3e,'callbackUrl':_0x321200});return _0x3ec6af['status'](0xc8)[_0xea37('0x28')]({'error':![],'message':'originate\x20executed!'});})[_0xea37('0x1c')](handleError(_0x3ec6af));};exports['hangup']=function(_0x5e91ef,_0x5652a4){logger['info'](_0xea37('0x30'),_0x5e91ef[_0xea37('0x26')]);var _0x46114b=hangupValidation[_0xea37('0x9')](_0x5e91ef[_0xea37('0x26')]);if(_0x46114b[_0xea37('0x27')]>0x0){return _0x5652a4[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x46114b);}var _0x267456=_0x5e91ef['body'][_0xea37('0x29')];var _0x565c66=_0x5e91ef[_0xea37('0x26')][_0xea37('0x23')];return getAgent(_0x267456)[_0xea37('0x18')](function(_0x537f75){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x537f75[_0xea37('0x14')]);emit(util[_0xea37('0x2e')]('user:%s',_0x537f75[_0xea37('0x14')]),'webbar:hangup',{'sessionId':_0x565c66});return _0x5652a4[_0xea37('0x15')](0xc8)[_0xea37('0x28')]({'error':![],'message':_0xea37('0x31')});})[_0xea37('0x1c')](handleError(_0x5652a4));};exports[_0xea37('0x32')]=function(_0x435300,_0x57c88d){logger[_0xea37('0xf')](_0xea37('0x33'),_0x435300['body']);var _0x15de2c=answerValidation[_0xea37('0x9')](_0x435300[_0xea37('0x26')]);if(_0x15de2c[_0xea37('0x27')]>0x0){return _0x57c88d[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x15de2c);}var _0x2281d9=_0x435300[_0xea37('0x26')][_0xea37('0x29')];var _0x71760a=_0x435300[_0xea37('0x26')][_0xea37('0x23')];return getAgent(_0x2281d9)[_0xea37('0x18')](function(_0x36d053){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x36d053[_0xea37('0x14')]);emit(util['format'](_0xea37('0x2f'),_0x36d053[_0xea37('0x14')]),_0xea37('0x34'),{'sessionId':_0x71760a});return _0x57c88d[_0xea37('0x15')](0xc8)[_0xea37('0x28')]({'error':![],'message':'answer\x20executed!'});})[_0xea37('0x1c')](handleError(_0x57c88d));};exports[_0xea37('0x35')]=function(_0x9a5dd,_0x10fcd5){logger[_0xea37('0xf')](_0xea37('0x36'),_0x9a5dd['body']);var _0x422d24=holdValidation[_0xea37('0x9')](_0x9a5dd[_0xea37('0x26')]);if(_0x422d24[_0xea37('0x27')]>0x0){return _0x10fcd5[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x422d24);}var _0x2cd612=_0x9a5dd[_0xea37('0x26')]['userId'];var _0x34f2f9=_0x9a5dd[_0xea37('0x26')]['sessionId'];return getAgent(_0x2cd612)[_0xea37('0x18')](function(_0x2ff803){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x2ff803[_0xea37('0x14')]);emit(util[_0xea37('0x2e')](_0xea37('0x2f'),_0x2ff803[_0xea37('0x14')]),'webbar:hold',{'sessionId':_0x34f2f9});return _0x10fcd5[_0xea37('0x15')](0xc8)['json']({'error':![],'message':_0xea37('0x37')});})['catch'](handleError(_0x10fcd5));};exports[_0xea37('0x38')]=function(_0x14c119,_0x43e269){logger[_0xea37('0xf')](_0xea37('0x39'),_0x14c119[_0xea37('0x26')]);var _0x3628cd=unholdValidation[_0xea37('0x9')](_0x14c119['body']);if(_0x3628cd['length']>0x0){return _0x43e269[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x3628cd);}var _0x19223c=_0x14c119['body'][_0xea37('0x29')];var _0x1c1cf9=_0x14c119['body'][_0xea37('0x23')];return getAgent(_0x19223c)[_0xea37('0x18')](function(_0x32d36d){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x32d36d[_0xea37('0x14')]);emit(util[_0xea37('0x2e')](_0xea37('0x2f'),_0x32d36d[_0xea37('0x14')]),_0xea37('0x3a'),{'sessionId':_0x1c1cf9});return _0x43e269[_0xea37('0x15')](0xc8)[_0xea37('0x28')]({'error':![],'message':_0xea37('0x3b')});})[_0xea37('0x1c')](handleError(_0x43e269));};exports[_0xea37('0x3c')]=function(_0x57811b,_0x6727d5){logger[_0xea37('0xf')](_0xea37('0x3d'),_0x6727d5[_0xea37('0x26')]);var _0x40d747=callsValidation[_0xea37('0x9')](_0x57811b['body']);if(_0x40d747[_0xea37('0x27')]>0x0){return _0x6727d5[_0xea37('0x15')](0x190)[_0xea37('0x28')](_0x40d747);}var _0x150a87=_0x57811b[_0xea37('0x26')]['userId'];var _0x2d9e5e=respondWithRpcPromise(_0xea37('0x20'));var _0x57430c=getAgent(_0x150a87);return Promise['all']([_0x2d9e5e,_0x57430c])['then'](function(_0x41d730){var _0x39c8c6=_0x41d730[0x0];var _0x356e6c=_0x41d730[0x1];var _0x1d882d=_[_0xea37('0x3e')](_0x39c8c6['rows'],function(_0x2dc886){return _0x2dc886[_0xea37('0x3f')]==_0x356e6c['id'];});return _0x6727d5[_0xea37('0x15')](0xc8)[_0xea37('0x28')]({'count':_0x1d882d[_0xea37('0x27')],'rows':_0x1d882d});})[_0xea37('0x1c')](handleError(_0x6727d5));};exports[_0xea37('0x40')]=function(_0x440267,_0xb60e2f){logger[_0xea37('0xf')](_0xea37('0x41'),_0x440267[_0xea37('0x26')]);var _0x21a35e=conferenceValidation[_0xea37('0x9')](_0x440267[_0xea37('0x26')]);if(_0x21a35e[_0xea37('0x27')]>0x0){return _0xb60e2f[_0xea37('0x15')](0x190)['json'](_0x21a35e);}var _0x37c2c4=_0x440267['body'][_0xea37('0x29')];return getAgent(_0x37c2c4)[_0xea37('0x18')](function(_0x409fba){logger[_0xea37('0xf')](_0xea37('0x2d'),_0x409fba[_0xea37('0x14')]);emit(util[_0xea37('0x2e')]('user:%s',_0x409fba['name']),'webbar:conference');return _0xb60e2f[_0xea37('0x15')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0xea37('0x1c')](handleError(_0xb60e2f));};exports[_0xea37('0x42')]=function(_0x1a037f,_0x50229d){logger[_0xea37('0xf')](_0xea37('0x43'),_0x1a037f[_0xea37('0x26')]);var _0x4ffecd=transferValidation['validate'](_0x1a037f[_0xea37('0x26')]);if(_0x4ffecd[_0xea37('0x27')]>0x0){return _0x50229d[_0xea37('0x15')](0x190)['json'](_0x4ffecd);}var _0x21b3da=_0x1a037f[_0xea37('0x26')][_0xea37('0x29')];var _0xde6af6=_0x1a037f[_0xea37('0x26')]['sessionId'];var _0x29c0ed=_0x1a037f[_0xea37('0x26')][_0xea37('0x44')];return getAgent(_0x21b3da)[_0xea37('0x18')](function(_0x54eeff){logger[_0xea37('0xf')]('entityFound:',_0x54eeff[_0xea37('0x14')]);emit(util[_0xea37('0x2e')](_0xea37('0x2f'),_0x54eeff[_0xea37('0x14')]),'webbar:transfer',{'sessionId':_0xde6af6,'transferNumber':_0x29c0ed});return _0x50229d[_0xea37('0x15')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xea37('0x1c')](handleError(_0x50229d));}; \ No newline at end of file +var _0x7341=['answer\x20fired:','answer\x20executed!','webbar:hold','hold\x20executed!','unhold\x20fired:','calls','calls\x20fired:','all','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','error','status','name','NotFound','request','then','code','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x54dcf3,_0x456746){var _0x33e984=function(_0x5bf967){while(--_0x5bf967){_0x54dcf3['push'](_0x54dcf3['shift']());}};_0x33e984(++_0x456746);}(_0x7341,0xe4));var _0x1734=function(_0x11ac5f,_0x588eb5){_0x11ac5f=_0x11ac5f-0x0;var _0x1831e0=_0x7341[_0x11ac5f];return _0x1831e0;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x1734('0x0'))['db'];var config=require('../../config/environment');var util=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var jayson=require('jayson/promise');var amiClient=jayson[_0x1734('0x3')][_0x1734('0x4')]({'port':0x232a});var logger=require(_0x1734('0x5'))(_0x1734('0x6'));var Redis=require(_0x1734('0x7'));config[_0x1734('0x8')]=_[_0x1734('0x9')](config['redis'],{'host':_0x1734('0xa'),'port':0x18eb});var io=require(_0x1734('0xb'))(new Redis(config[_0x1734('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x1734('0xd')]},'callerId':{'type':_0x1734('0xe')},'callbackUrl':{'type':_0x1734('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x10')]},'transferNumber':{'type':_0x1734('0xe'),'required':[!![],_0x1734('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]},'sessionId':{'type':_0x1734('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1734('0xc'),'required':[!![],_0x1734('0xf')]}});function emit(_0x3989a6,_0x24bbf3,_0x2b375d){logger[_0x1734('0x12')](_0x3989a6,_0x24bbf3,JSON[_0x1734('0x13')](_0x2b375d));io['to'](_0x3989a6)['emit'](_0x24bbf3,_0x2b375d);}function handleError(_0x5ab895){return function(_0x1fa9c0){console[_0x1734('0x14')]('handleError:',_0x1fa9c0,_0x1fa9c0 instanceof RangeError);logger[_0x1734('0x15')](_0x1fa9c0['stack']);if(_0x1fa9c0 instanceof RangeError){if(_0x1fa9c0['name']){delete _0x1fa9c0['name'];}_0x5ab895[_0x1734('0x16')](0x194)['send'](_0x1fa9c0);}else{if(_0x1fa9c0[_0x1734('0x17')]){delete _0x1fa9c0[_0x1734('0x17')];}_0x5ab895['status'](0x1f4)['send'](_0x1fa9c0);}};}function checkError(){return function(_0x4bd526){if(!_0x4bd526){throw new RangeError(_0x1734('0x18'));}return _0x4bd526;};}function respondWithRpcPromise(_0x53f13d,_0x183f7a){return new BPromise(function(_0x5ad801,_0x215ae4){var _0x42485f=amiClient;return _0x42485f[_0x1734('0x19')](_0x53f13d,_0x183f7a)[_0x1734('0x1a')](function(_0x29bb2c){if(_0x29bb2c[_0x1734('0x15')]){if(_0x29bb2c[_0x1734('0x15')][_0x1734('0x1b')]===0x1f4){return _0x215ae4(_0x29bb2c[_0x1734('0x15')]['message']);}return _0x5ad801(_0x29bb2c[_0x1734('0x15')]['message']);}else{_0x5ad801(_0x29bb2c['result']);}})[_0x1734('0x1c')](function(_0x46b2fa){_0x215ae4(_0x46b2fa);});});}function getAgent(_0x309d3f){return db[_0x1734('0x1d')][_0x1734('0x1e')]({'where':{'id':_0x309d3f,'role':_0x1734('0x1f')}})[_0x1734('0x1a')](checkError());}function getAgentCheckSession(_0x27d6e5,_0x4a670a){return new BPromise(function(_0x381960,_0x52eaf5){var _0x17e068=respondWithRpcPromise(_0x1734('0x20'));var _0xfca2ad=getAgent(_0x27d6e5);Promise['all']([_0x17e068,_0xfca2ad])[_0x1734('0x1a')](function(_0x3f9abe){var _0xf2d136=_0x3f9abe[0x0];var _0x50efce=_0x3f9abe[0x1];var _0x2b1352=_[_0x1734('0x21')](_0xf2d136['rows'],function(_0x1bd659){return _0x1bd659[_0x1734('0x22')]==_0x50efce['id']&&_0x1bd659[_0x1734('0x23')]==_0x4a670a;});if(_0x2b1352[_0x1734('0x24')]==0x1){_0x381960(_0x50efce);}else{_0x52eaf5(new RangeError('sessionId\x20'+_0x4a670a+_0x1734('0x25')));}});});}exports[_0x1734('0x26')]=function(_0x546a94,_0x4dd04a){logger[_0x1734('0x12')](_0x1734('0x27'),_0x546a94[_0x1734('0x28')]);var _0x3903a7=originateValidation[_0x1734('0x29')](_0x546a94[_0x1734('0x28')]);if(_0x3903a7[_0x1734('0x24')]>0x0){return _0x4dd04a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x3903a7);}var _0x2921c8=_0x546a94[_0x1734('0x28')][_0x1734('0x2b')];var _0x18a0c7=_0x546a94[_0x1734('0x28')][_0x1734('0x2c')];var _0x29ccc3=_0x546a94[_0x1734('0x28')]['callerId'];var _0x1e7134=_0x546a94['body'][_0x1734('0x2d')];return getAgent(_0x2921c8)[_0x1734('0x1a')](function(_0x1f8446){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x1f8446[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x1f8446['name']),_0x1734('0x31'),{'callNumber':_0x18a0c7,'callerId':_0x29ccc3,'callbackUrl':_0x1e7134});return _0x4dd04a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x32')});})[_0x1734('0x1c')](handleError(_0x4dd04a));};exports[_0x1734('0x33')]=function(_0x26072f,_0x4db10d){logger[_0x1734('0x12')](_0x1734('0x34'),_0x26072f[_0x1734('0x28')]);var _0x3a9bcd=hangupValidation[_0x1734('0x29')](_0x26072f[_0x1734('0x28')]);if(_0x3a9bcd[_0x1734('0x24')]>0x0){return _0x4db10d[_0x1734('0x16')](0x190)['json'](_0x3a9bcd);}var _0x1f5cc6=_0x26072f['body'][_0x1734('0x2b')];var _0x2d9873=_0x26072f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1f5cc6)[_0x1734('0x1a')](function(_0x169db8){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x169db8[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x169db8['name']),_0x1734('0x35'),{'sessionId':_0x2d9873});return _0x4db10d[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x36')});})['catch'](handleError(_0x4db10d));};exports[_0x1734('0x37')]=function(_0x562be1,_0x539270){logger[_0x1734('0x12')](_0x1734('0x38'),_0x562be1[_0x1734('0x28')]);var _0x71f9c1=answerValidation['validate'](_0x562be1[_0x1734('0x28')]);if(_0x71f9c1[_0x1734('0x24')]>0x0){return _0x539270['status'](0x190)[_0x1734('0x2a')](_0x71f9c1);}var _0x1b104a=_0x562be1['body'][_0x1734('0x2b')];var _0x4bfc67=_0x562be1[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x1b104a)[_0x1734('0x1a')](function(_0x400a1f){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x400a1f[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x400a1f[_0x1734('0x17')]),'webbar:answer',{'sessionId':_0x4bfc67});return _0x539270[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x39')});})[_0x1734('0x1c')](handleError(_0x539270));};exports['hold']=function(_0x6f821f,_0x70fd09){logger[_0x1734('0x12')]('hold\x20fired:',_0x6f821f[_0x1734('0x28')]);var _0x245420=holdValidation[_0x1734('0x29')](_0x6f821f[_0x1734('0x28')]);if(_0x245420[_0x1734('0x24')]>0x0){return _0x70fd09[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x245420);}var _0x8bfed7=_0x6f821f[_0x1734('0x28')][_0x1734('0x2b')];var _0x1ef5d6=_0x6f821f[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x8bfed7)[_0x1734('0x1a')](function(_0x470110){logger[_0x1734('0x12')](_0x1734('0x2e'),_0x470110[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x470110['name']),_0x1734('0x3a'),{'sessionId':_0x1ef5d6});return _0x70fd09[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':_0x1734('0x3b')});})['catch'](handleError(_0x70fd09));};exports['unhold']=function(_0x294097,_0xe86f1f){logger['info'](_0x1734('0x3c'),_0x294097[_0x1734('0x28')]);var _0x2a71cf=unholdValidation[_0x1734('0x29')](_0x294097[_0x1734('0x28')]);if(_0x2a71cf[_0x1734('0x24')]>0x0){return _0xe86f1f[_0x1734('0x16')](0x190)['json'](_0x2a71cf);}var _0x141f68=_0x294097[_0x1734('0x28')][_0x1734('0x2b')];var _0x47cd87=_0x294097[_0x1734('0x28')][_0x1734('0x23')];return getAgent(_0x141f68)[_0x1734('0x1a')](function(_0x441c62){logger['info'](_0x1734('0x2e'),_0x441c62[_0x1734('0x17')]);emit(util[_0x1734('0x2f')](_0x1734('0x30'),_0x441c62[_0x1734('0x17')]),'webbar:unhold',{'sessionId':_0x47cd87});return _0xe86f1f[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x1734('0x1c')](handleError(_0xe86f1f));};exports[_0x1734('0x3d')]=function(_0x4ae49c,_0x4ff6a9){logger[_0x1734('0x12')](_0x1734('0x3e'),_0x4ff6a9['body']);var _0x515e39=callsValidation['validate'](_0x4ae49c[_0x1734('0x28')]);if(_0x515e39[_0x1734('0x24')]>0x0){return _0x4ff6a9[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x515e39);}var _0x54ef53=_0x4ae49c['body'][_0x1734('0x2b')];var _0x7872f5=respondWithRpcPromise('VoiceChannels');var _0x349b6a=getAgent(_0x54ef53);return Promise[_0x1734('0x3f')]([_0x7872f5,_0x349b6a])[_0x1734('0x1a')](function(_0x553daf){var _0xfcc609=_0x553daf[0x0];var _0x371a48=_0x553daf[0x1];var _0x28c467=_[_0x1734('0x21')](_0xfcc609[_0x1734('0x40')],function(_0x41469e){return _0x41469e[_0x1734('0x22')]==_0x371a48['id'];});return _0x4ff6a9[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'count':_0x28c467['length'],'rows':_0x28c467});})[_0x1734('0x1c')](handleError(_0x4ff6a9));};exports[_0x1734('0x41')]=function(_0x16bea9,_0x3a4d5b){logger[_0x1734('0x12')](_0x1734('0x42'),_0x16bea9[_0x1734('0x28')]);var _0x30848e=conferenceValidation[_0x1734('0x29')](_0x16bea9[_0x1734('0x28')]);if(_0x30848e[_0x1734('0x24')]>0x0){return _0x3a4d5b['status'](0x190)[_0x1734('0x2a')](_0x30848e);}var _0x25f2fd=_0x16bea9[_0x1734('0x28')][_0x1734('0x2b')];return getAgent(_0x25f2fd)[_0x1734('0x1a')](function(_0xa43585){logger[_0x1734('0x12')]('entityFound:',_0xa43585[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0xa43585[_0x1734('0x17')]),_0x1734('0x43'));return _0x3a4d5b[_0x1734('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x1734('0x1c')](handleError(_0x3a4d5b));};exports['transfer']=function(_0x41fdf2,_0xc91e7a){logger[_0x1734('0x12')](_0x1734('0x44'),_0x41fdf2['body']);var _0x586418=transferValidation['validate'](_0x41fdf2[_0x1734('0x28')]);if(_0x586418[_0x1734('0x24')]>0x0){return _0xc91e7a[_0x1734('0x16')](0x190)[_0x1734('0x2a')](_0x586418);}var _0x387aac=_0x41fdf2[_0x1734('0x28')][_0x1734('0x2b')];var _0x2d3a75=_0x41fdf2['body'][_0x1734('0x23')];var _0x4fd501=_0x41fdf2['body'][_0x1734('0x45')];return getAgent(_0x387aac)[_0x1734('0x1a')](function(_0x31ec5b){logger['info'](_0x1734('0x2e'),_0x31ec5b[_0x1734('0x17')]);emit(util['format'](_0x1734('0x30'),_0x31ec5b[_0x1734('0x17')]),_0x1734('0x46'),{'sessionId':_0x2d3a75,'transferNumber':_0x4fd501});return _0xc91e7a[_0x1734('0x16')](0xc8)[_0x1734('0x2a')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0xc91e7a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7e8f411..9cc0209 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 _0x4137=['get','index','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','create','/:id/dispositions','post','addAnswer','addAgents','addApplications','notify','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller'];(function(_0x4d5ced,_0x26a6b4){var _0x3ac8a9=function(_0x277a64){while(--_0x277a64){_0x4d5ced['push'](_0x4d5ced['shift']());}};_0x3ac8a9(++_0x26a6b4);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0xb')]('/:id/dispositions',auth[_0x7413('0xe')](),controller[_0x7413('0x11')]);router[_0x7413('0xb')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller['getAnswers']);router[_0x7413('0xb')](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x14')]);router[_0x7413('0xb')](_0x7413('0x15'),auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0x7413('0xe')](),controller[_0x7413('0x16')]);router['post'](_0x7413('0x17'),auth[_0x7413('0xe')](),controller['addDisposition']);router[_0x7413('0x18')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7413('0x19')]);router['post'](_0x7413('0x13'),auth['isAuthenticated'](),controller[_0x7413('0x1a')]);router[_0x7413('0x18')](_0x7413('0x15'),auth[_0x7413('0xe')](),controller[_0x7413('0x1b')]);router[_0x7413('0x18')]('/:id/notify',controller[_0x7413('0x1c')]);router[_0x7413('0x18')](_0x7413('0x1d'),auth[_0x7413('0xe')](),controller['send']);router[_0x7413('0x1e')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x1f')]);router[_0x7413('0x20')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x21')]);router['delete']('/:id/dispositions',auth[_0x7413('0xe')](),controller['removeDispositions']);router[_0x7413('0x20')](_0x7413('0x12'),auth[_0x7413('0xe')](),controller[_0x7413('0x22')]);router[_0x7413('0x20')](_0x7413('0x13'),auth[_0x7413('0xe')](),controller[_0x7413('0x23')]);module[_0x7413('0x24')]=router; \ No newline at end of file +var _0xe2fe=['removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'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('./whatsappAccount.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('0x7')](_0xee2f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xee2f('0x8')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xee2f('0x8')](),controller[_0xee2f('0xd')]);router[_0xee2f('0x7')](_0xee2f('0xe'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xf')]);router['post']('/',auth[_0xee2f('0x8')](),controller['create']);router[_0xee2f('0x10')](_0xee2f('0xc'),auth['isAuthenticated'](),controller[_0xee2f('0x11')]);router[_0xee2f('0x10')](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x13')]);router['post'](_0xee2f('0x14'),auth['isAuthenticated'](),controller[_0xee2f('0x15')]);router[_0xee2f('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee2f('0x16')]);router['post'](_0xee2f('0x17'),controller[_0xee2f('0x18')]);router[_0xee2f('0x10')]('/:id/send',auth[_0xee2f('0x8')](),controller[_0xee2f('0x19')]);router[_0xee2f('0x1a')](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['update']);router['delete'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1b')]);router[_0xee2f('0x1c')](_0xee2f('0xc'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1d')]);router['delete'](_0xee2f('0x12'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1e')]);router[_0xee2f('0x1c')](_0xee2f('0x14'),auth[_0xee2f('0x8')](),controller[_0xee2f('0x1f')]);module[_0xee2f('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d9e9f40..de57d7a 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 _0x2737=['STRING','name','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x31eeea,_0x33263a){var _0x45dc15=function(_0x582815){while(--_0x582815){_0x31eeea['push'](_0x31eeea['shift']());}};_0x45dc15(++_0x33263a);}(_0x2737,0x1da));var _0x7273=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2737[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7273('0x0'));var rs=require('randomstring');module[_0x7273('0x1')]={'name':{'type':Sequelize[_0x7273('0x2')],'unique':_0x7273('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7273('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7273('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x7273('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x7273('0x2')]},'type':{'type':Sequelize[_0x7273('0x4')](_0x7273('0x5'),_0x7273('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x7273('0x2')]},'authToken':{'type':Sequelize[_0x7273('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7273('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7273('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7273('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7273('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7273('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7273('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7273('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7273('0xa'),'set':function(_0x55159f){if(!_0x55159f){this[_0x7273('0xb')](_0x7273('0xc'),null);}this[_0x7273('0xb')](_0x7273('0xd'),_0x55159f);}},'description':{'type':Sequelize[_0x7273('0x2')]}}; \ No newline at end of file +var _0xb6bb=['mandatoryDisposition','sequelize','exports','STRING','name','twilio','sinch','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x263b1f,_0x3f2376){var _0x4aa612=function(_0x3cae79){while(--_0x3cae79){_0x263b1f['push'](_0x263b1f['shift']());}};_0x4aa612(++_0x3f2376);}(_0xb6bb,0x135));var _0xbb6b=function(_0x21cf9c,_0x3a7b56){_0x21cf9c=_0x21cf9c-0x0;var _0x49fd24=_0xb6bb[_0x21cf9c];return _0x49fd24;};'use strict';var Sequelize=require(_0xbb6b('0x0'));var rs=require('randomstring');module[_0xbb6b('0x1')]={'name':{'type':Sequelize[_0xbb6b('0x2')],'unique':_0xbb6b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xbb6b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xbb6b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xbb6b('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xbb6b('0x2')]},'type':{'type':Sequelize['ENUM'](_0xbb6b('0x4'),_0xbb6b('0x5'))},'accountSid':{'type':Sequelize[_0xbb6b('0x2')]},'baseUrl':{'type':Sequelize[_0xbb6b('0x2')]},'authToken':{'type':Sequelize[_0xbb6b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xbb6b('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb6b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb6b('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbb6b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb6b('0x7')],'comment':_0xbb6b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbb6b('0xa'),'set':function(_0x4ce6c5){if(!_0x4ce6c5){this[_0xbb6b('0xb')](_0xbb6b('0xc'),null);}this['setDataValue'](_0xbb6b('0xd'),_0x4ce6c5);}},'description':{'type':Sequelize[_0xbb6b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 723d060..cca5641 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 _0xc02d=['hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','findOne','removeAnswers','ids','addAgents','omit','spread','emit','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','messageId','MessageSid','notifications','message_id','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','get','stack','name','Pause','map','WhatsappAccount','fieldName','key','model','filters','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','rawAttributes','intersection','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','getDispositions','Disposition'];(function(_0x535844,_0x1ff128){var _0x87b2d1=function(_0x350005){while(--_0x350005){_0x535844['push'](_0x535844['shift']());}};_0x87b2d1(++_0x1ff128);}(_0xc02d,0x1e9));var _0xdc02=function(_0x105b14,_0x246c43){_0x105b14=_0x105b14-0x0;var _0x2ba487=_0xc02d[_0x105b14];return _0x2ba487;};'use strict';var emlformat=require(_0xdc02('0x0'));var rimraf=require(_0xdc02('0x1'));var zipdir=require(_0xdc02('0x2'));var jsonpatch=require(_0xdc02('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdc02('0x4'));var Mustache=require(_0xdc02('0x5'));var util=require(_0xdc02('0x6'));var path=require(_0xdc02('0x7'));var sox=require(_0xdc02('0x8'));var csv=require('to-csv');var ejs=require(_0xdc02('0x9'));var fs=require('fs');var fs_extra=require(_0xdc02('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc02('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdc02('0xc'));var toCsv=require(_0xdc02('0xd'));var querystring=require(_0xdc02('0xe'));var Papa=require(_0xdc02('0xf'));var Redis=require('ioredis');var authService=require(_0xdc02('0x10'));var qs=require(_0xdc02('0x11'));var as=require(_0xdc02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc02('0x13'))(_0xdc02('0x14'));var utils=require(_0xdc02('0x15'));var config=require(_0xdc02('0x16'));var licenseUtil=require(_0xdc02('0x17'));var db=require('../../mysqldb')['db'];config[_0xdc02('0x18')]=_['defaults'](config[_0xdc02('0x18')],{'host':_0xdc02('0x19'),'port':0x18eb});var socket=require(_0xdc02('0x1a'))(new Redis(config[_0xdc02('0x18')]));require(_0xdc02('0x1b'))[_0xdc02('0x1c')](socket);var jayson=require(_0xdc02('0x1d'));var client=jayson['client'][_0xdc02('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x126f93,_0x39368f,_0x33c2cf,_0x4c78ab){return new BPromise(function(_0x57c3d9,_0x4ec52f){var _0x3c3597=_0x4c78ab||client;return _0x3c3597[_0xdc02('0x1f')](_0x126f93,_0x33c2cf)[_0xdc02('0x20')](function(_0x5ad2ae){logger[_0xdc02('0x21')](_0xdc02('0x22'),_0x39368f,'request\x20sent');logger['debug'](_0xdc02('0x23'),_0x39368f,_0xdc02('0x24'),JSON['stringify'](_0x5ad2ae));if(_0x5ad2ae[_0xdc02('0x25')]){if(_0x5ad2ae[_0xdc02('0x25')]['code']===0x1f4){logger[_0xdc02('0x25')](_0xdc02('0x22'),_0x39368f,_0x5ad2ae[_0xdc02('0x25')]['message']);return _0x4ec52f(_0x5ad2ae[_0xdc02('0x25')]['message']);}logger[_0xdc02('0x25')](_0xdc02('0x22'),_0x39368f,_0x5ad2ae[_0xdc02('0x25')]['message']);return _0x57c3d9(_0x5ad2ae['error'][_0xdc02('0x26')]);}else{logger['info'](_0xdc02('0x22'),_0x39368f,_0xdc02('0x24'));_0x57c3d9(_0x5ad2ae[_0xdc02('0x27')][_0xdc02('0x26')]);}})[_0xdc02('0x28')](function(_0x2d99da){logger[_0xdc02('0x25')](_0xdc02('0x22'),_0x39368f,_0x2d99da);_0x4ec52f(_0x2d99da);});});}function respondWithStatusCode(_0xeb00d0,_0x28ec8e){_0x28ec8e=_0x28ec8e||0xcc;return function(_0x3b8cb8){if(_0x3b8cb8){return _0xeb00d0[_0xdc02('0x29')](_0x28ec8e);}return _0xeb00d0[_0xdc02('0x2a')](_0x28ec8e)[_0xdc02('0x2b')]();};}function respondWithResult(_0x4843ba,_0x51af51){_0x51af51=_0x51af51||0xc8;return function(_0xf835e1){if(_0xf835e1){return _0x4843ba[_0xdc02('0x2a')](_0x51af51)[_0xdc02('0x2c')](_0xf835e1);}};}function respondWithFilteredResult(_0x2543fc,_0x1e2695){return function(_0x296bab){if(_0x296bab){var _0x29c598=typeof _0x1e2695[_0xdc02('0x2d')]==='undefined'&&typeof _0x1e2695[_0xdc02('0x2e')]===_0xdc02('0x2f');var _0xcfe784=_0x296bab[_0xdc02('0x30')];var _0x231e40=_0x29c598?0x0:_0x1e2695[_0xdc02('0x2d')];var _0x2f60e9=_0x29c598?_0x296bab[_0xdc02('0x30')]:_0x1e2695[_0xdc02('0x2d')]+_0x1e2695[_0xdc02('0x2e')];var _0xc6bbfc;if(_0x2f60e9>=_0xcfe784){_0x2f60e9=_0xcfe784;_0xc6bbfc=0xc8;}else{_0xc6bbfc=0xce;}_0x2543fc[_0xdc02('0x2a')](_0xc6bbfc);return _0x2543fc[_0xdc02('0x31')](_0xdc02('0x32'),_0x231e40+'-'+_0x2f60e9+'/'+_0xcfe784)[_0xdc02('0x2c')](_0x296bab);}return null;};}function patchUpdates(_0x7a1a88){return function(_0x107077){try{jsonpatch['apply'](_0x107077,_0x7a1a88,!![]);}catch(_0x43451f){return BPromise[_0xdc02('0x33')](_0x43451f);}return _0x107077[_0xdc02('0x34')]();};}function saveUpdates(_0x21a0f9,_0x5eb583){return function(_0x4b929e){if(_0x4b929e){return _0x4b929e[_0xdc02('0x35')](_0x21a0f9)['then'](function(_0x17be1f){return _0x17be1f;});}return null;};}function removeEntity(_0x122b97,_0x4a938e){return function(_0x57eed1){if(_0x57eed1){return _0x57eed1[_0xdc02('0x36')]()['then'](function(){var _0x21808e=_0x57eed1[_0xdc02('0x37')]({'plain':!![]});var _0x51d67b='WhatsappAccounts';return db['UserProfileResource'][_0xdc02('0x36')]({'where':{'type':_0x51d67b,'resourceId':_0x21808e['id']}})[_0xdc02('0x20')](function(){return _0x57eed1;});})[_0xdc02('0x20')](function(){_0x122b97[_0xdc02('0x2a')](0xcc)[_0xdc02('0x2b')]();});}};}function handleEntityNotFound(_0x1fa5fc,_0x2e4f29){return function(_0x107274){if(!_0x107274){_0x1fa5fc[_0xdc02('0x29')](0x194);}return _0x107274;};}function handleError(_0x5051e9,_0x2d57d9){_0x2d57d9=_0x2d57d9||0x1f4;return function(_0x1ecbc5){logger[_0xdc02('0x25')](_0x1ecbc5[_0xdc02('0x38')]);if(_0x1ecbc5['name']){delete _0x1ecbc5[_0xdc02('0x39')];}_0x5051e9[_0xdc02('0x2a')](_0x2d57d9)['send'](_0x1ecbc5);};}exports['index']=function(_0x1e22b0,_0x373ffc){var _0x52f067={'include':[{'model':db[_0xdc02('0x3a')],'as':'mandatoryDispositionPause'}]},_0x3e602f={},_0x4b6483={'count':0x0,'rows':[]};var _0x24fa51=_[_0xdc02('0x3b')](db[_0xdc02('0x3c')]['rawAttributes'],function(_0x37928b){return{'name':_0x37928b[_0xdc02('0x3d')],'type':_0x37928b['type'][_0xdc02('0x3e')]};});_0x3e602f[_0xdc02('0x3f')]=_[_0xdc02('0x3b')](_0x24fa51,'name');_0x3e602f['query']=_['keys'](_0x1e22b0['query']);_0x3e602f[_0xdc02('0x40')]=_['intersection'](_0x3e602f[_0xdc02('0x3f')],_0x3e602f[_0xdc02('0x41')]);_0x52f067[_0xdc02('0x42')]=_['intersection'](_0x3e602f[_0xdc02('0x3f')],qs[_0xdc02('0x43')](_0x1e22b0['query'][_0xdc02('0x43')]));_0x52f067['attributes']=_0x52f067[_0xdc02('0x42')]['length']?_0x52f067[_0xdc02('0x42')]:_0x3e602f['model'];if(!_0x1e22b0[_0xdc02('0x41')]['hasOwnProperty'](_0xdc02('0x44'))){_0x52f067[_0xdc02('0x2e')]=qs[_0xdc02('0x2e')](_0x1e22b0[_0xdc02('0x41')][_0xdc02('0x2e')]);_0x52f067[_0xdc02('0x2d')]=qs[_0xdc02('0x2d')](_0x1e22b0[_0xdc02('0x41')][_0xdc02('0x2d')]);}_0x52f067[_0xdc02('0x45')]=qs[_0xdc02('0x46')](_0x1e22b0['query'][_0xdc02('0x46')]);_0x52f067[_0xdc02('0x47')]=qs[_0xdc02('0x40')](_[_0xdc02('0x48')](_0x1e22b0[_0xdc02('0x41')],_0x3e602f[_0xdc02('0x40')]),_0x24fa51);if(_0x1e22b0[_0xdc02('0x41')][_0xdc02('0x49')]){_0x52f067[_0xdc02('0x47')]=_[_0xdc02('0x4a')](_0x52f067[_0xdc02('0x47')],{'$or':_[_0xdc02('0x3b')](_0x24fa51,function(_0x245fa3){if(_0x245fa3[_0xdc02('0x4b')]!==_0xdc02('0x4c')){var _0x273084={};_0x273084[_0x245fa3['name']]={'$like':'%'+_0x1e22b0['query'][_0xdc02('0x49')]+'%'};return _0x273084;}})});}_0x52f067=_[_0xdc02('0x4a')]({},_0x52f067,_0x1e22b0['options']);var _0x5e21e7={'where':_0x52f067[_0xdc02('0x47')]};return db[_0xdc02('0x3c')]['count'](_0x5e21e7)[_0xdc02('0x20')](function(_0x53a73f){_0x4b6483[_0xdc02('0x30')]=_0x53a73f;if(_0x1e22b0['query'][_0xdc02('0x4d')]){_0x52f067[_0xdc02('0x4e')]=[{'all':!![]}];}return db[_0xdc02('0x3c')][_0xdc02('0x4f')](_0x52f067);})[_0xdc02('0x20')](function(_0x322250){_0x4b6483[_0xdc02('0x50')]=_0x322250;return _0x4b6483;})['then'](respondWithFilteredResult(_0x373ffc,_0x52f067))[_0xdc02('0x28')](handleError(_0x373ffc,null));};exports[_0xdc02('0x51')]=function(_0x3b84ec,_0xa45303){var _0x31ebec={'raw':![],'where':{'id':_0x3b84ec[_0xdc02('0x52')]['id']},'include':[{'model':db[_0xdc02('0x3a')],'as':_0xdc02('0x53')}]},_0x5a63d6={};_0x5a63d6[_0xdc02('0x3f')]=_[_0xdc02('0x54')](db['WhatsappAccount'][_0xdc02('0x55')]);_0x5a63d6['query']=_[_0xdc02('0x54')](_0x3b84ec[_0xdc02('0x41')]);_0x5a63d6['filters']=_[_0xdc02('0x56')](_0x5a63d6[_0xdc02('0x3f')],_0x5a63d6[_0xdc02('0x41')]);_0x31ebec[_0xdc02('0x42')]=_['intersection'](_0x5a63d6['model'],qs[_0xdc02('0x43')](_0x3b84ec[_0xdc02('0x41')][_0xdc02('0x43')]));_0x31ebec[_0xdc02('0x42')]=_0x31ebec['attributes'][_0xdc02('0x57')]?_0x31ebec[_0xdc02('0x42')]:_0x5a63d6[_0xdc02('0x3f')];if(_0x3b84ec['query'][_0xdc02('0x4d')]){_0x31ebec[_0xdc02('0x4e')]=[{'all':!![]}];}_0x31ebec=_['merge']({},_0x31ebec,_0x3b84ec[_0xdc02('0x58')]);return db['WhatsappAccount']['find'](_0x31ebec)[_0xdc02('0x20')](handleEntityNotFound(_0xa45303,null))['then'](respondWithResult(_0xa45303,null))[_0xdc02('0x28')](handleError(_0xa45303,null));};exports[_0xdc02('0x59')]=function(_0x351c4c,_0x1d2990){return db['WhatsappAccount'][_0xdc02('0x59')](_0x351c4c['body'],{})[_0xdc02('0x20')](function(_0x4bef30){var _0x1863af=_0x351c4c[_0xdc02('0x5a')][_0xdc02('0x37')]({'plain':!![]});if(!_0x1863af)throw new Error(_0xdc02('0x5b'));if(_0x1863af['role']==='user'){var _0x327c18=_0x4bef30['get']({'plain':!![]});var _0x4a6005=_0xdc02('0x5c');return db[_0xdc02('0x5d')][_0xdc02('0x5e')]({'where':{'name':_0x4a6005,'userProfileId':_0x1863af[_0xdc02('0x5f')]},'raw':!![]})[_0xdc02('0x20')](function(_0x5a6df0){if(_0x5a6df0&&_0x5a6df0[_0xdc02('0x60')]===0x0){return db[_0xdc02('0x61')][_0xdc02('0x59')]({'name':_0x327c18['name'],'resourceId':_0x327c18['id'],'type':_0x5a6df0[_0xdc02('0x39')],'sectionId':_0x5a6df0['id']},{})['then'](function(){return _0x4bef30;});}else{return _0x4bef30;}})[_0xdc02('0x28')](function(_0x322156){logger['error'](_0xdc02('0x62'),_0x322156);throw _0x322156;});}return _0x4bef30;})[_0xdc02('0x20')](respondWithResult(_0x1d2990,0xc9))[_0xdc02('0x28')](handleError(_0x1d2990,null));};exports[_0xdc02('0x35')]=function(_0x42569f,_0x5b0e1a){if(_0x42569f[_0xdc02('0x63')]['id']){delete _0x42569f['body']['id'];}return db[_0xdc02('0x3c')][_0xdc02('0x5e')]({'where':{'id':_0x42569f[_0xdc02('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xdc02('0x53')}]})[_0xdc02('0x20')](handleEntityNotFound(_0x5b0e1a,null))['then'](saveUpdates(_0x42569f[_0xdc02('0x63')],null))['then'](respondWithResult(_0x5b0e1a,null))[_0xdc02('0x28')](handleError(_0x5b0e1a,null));};exports[_0xdc02('0x36')]=function(_0x5c4a4c,_0x112500){return db[_0xdc02('0x3c')][_0xdc02('0x5e')]({'where':{'id':_0x5c4a4c[_0xdc02('0x52')]['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x112500,null))[_0xdc02('0x20')](removeEntity(_0x112500,null))[_0xdc02('0x28')](handleError(_0x112500,null));};exports[_0xdc02('0x64')]=function(_0x3e4e35,_0x395212){return db['WhatsappAccount'][_0xdc02('0x64')]()['then'](respondWithResult(_0x395212,null))['catch'](handleError(_0x395212,null));};exports[_0xdc02('0x65')]=function(_0x17181f,_0x251f51,_0x68d1cb){if(_0x17181f[_0xdc02('0x63')]['id']){delete _0x17181f[_0xdc02('0x63')]['id'];}return db[_0xdc02('0x3c')]['find']({'where':{'id':_0x17181f[_0xdc02('0x52')]['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x251f51,null))[_0xdc02('0x20')](function(_0xabc0af){if(_0xabc0af){_0x17181f[_0xdc02('0x63')][_0xdc02('0x66')]=_0xabc0af['id'];return db['Disposition'][_0xdc02('0x59')](_0x17181f[_0xdc02('0x63')]);}})['then'](respondWithResult(_0x251f51,null))['catch'](handleError(_0x251f51,null));};exports[_0xdc02('0x67')]=function(_0x4ad2e0,_0x57c1dd,_0x24faef){var _0x50504d={'raw':![],'where':{}};var _0x52821b={};var _0x2ddc88={'count':0x0,'rows':[]};return db[_0xdc02('0x3c')]['findOne']({'where':{'id':_0x4ad2e0[_0xdc02('0x52')]['id']}})['then'](handleEntityNotFound(_0x57c1dd,null))[_0xdc02('0x20')](function(_0x4ae352){if(_0x4ae352){_0x52821b[_0xdc02('0x3f')]=_[_0xdc02('0x54')](db[_0xdc02('0x68')][_0xdc02('0x55')]);_0x52821b['query']=_[_0xdc02('0x54')](_0x4ad2e0['query']);_0x52821b[_0xdc02('0x40')]=_[_0xdc02('0x56')](_0x52821b[_0xdc02('0x3f')],_0x52821b[_0xdc02('0x41')]);_0x50504d['attributes']=_[_0xdc02('0x56')](_0x52821b[_0xdc02('0x3f')],qs['fields'](_0x4ad2e0[_0xdc02('0x41')]['fields']));_0x50504d[_0xdc02('0x42')]=_0x50504d[_0xdc02('0x42')][_0xdc02('0x57')]?_0x50504d[_0xdc02('0x42')]:_0x52821b['model'];if(!_0x4ad2e0['query'][_0xdc02('0x69')]('nolimit')){_0x50504d[_0xdc02('0x2e')]=qs[_0xdc02('0x2e')](_0x4ad2e0[_0xdc02('0x41')]['limit']);_0x50504d[_0xdc02('0x2d')]=qs[_0xdc02('0x2d')](_0x4ad2e0['query'][_0xdc02('0x2d')]);}_0x50504d[_0xdc02('0x45')]=qs['sort'](_0x4ad2e0[_0xdc02('0x41')][_0xdc02('0x46')]);_0x50504d['where']=qs['filters'](_[_0xdc02('0x48')](_0x4ad2e0[_0xdc02('0x41')],_0x52821b[_0xdc02('0x40')]));_0x50504d[_0xdc02('0x47')][_0xdc02('0x66')]=_0x4ae352['id'];if(_0x4ad2e0[_0xdc02('0x41')][_0xdc02('0x49')]){_0x50504d[_0xdc02('0x47')]=_['merge'](_0x50504d[_0xdc02('0x47')],{'$or':_['map'](_0x50504d['attributes'],function(_0x3328a5){var _0x163a04={};_0x163a04[_0x3328a5]={'$like':'%'+_0x4ad2e0['query'][_0xdc02('0x49')]+'%'};return _0x163a04;})});}_0x50504d=_[_0xdc02('0x4a')]({},_0x50504d,_0x4ad2e0['options']);return db[_0xdc02('0x68')][_0xdc02('0x30')]({'where':_0x50504d['where']})[_0xdc02('0x20')](function(_0x4080ca){_0x2ddc88[_0xdc02('0x30')]=_0x4080ca;if(_0x4ad2e0['query'][_0xdc02('0x4d')]){_0x50504d[_0xdc02('0x4e')]=[{'all':!![]}];}return db[_0xdc02('0x68')]['findAll'](_0x50504d);})[_0xdc02('0x20')](function(_0xe25978){_0x2ddc88['rows']=_0xe25978;return _0x2ddc88;});}})[_0xdc02('0x20')](respondWithFilteredResult(_0x57c1dd,_0x50504d))[_0xdc02('0x28')](handleError(_0x57c1dd,null));};exports['removeDispositions']=function(_0x32dad7,_0xf99407,_0x531a75){return db[_0xdc02('0x3c')]['find']({'where':{'id':_0x32dad7['params']['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0xf99407,null))[_0xdc02('0x20')](function(_0x174b53){if(_0x174b53){return _0x174b53[_0xdc02('0x6a')](_0x32dad7[_0xdc02('0x41')]['ids']);}})[_0xdc02('0x20')](respondWithStatusCode(_0xf99407,null))[_0xdc02('0x28')](handleError(_0xf99407,null));};exports[_0xdc02('0x6b')]=function(_0x8d465e,_0x25d1ce,_0x10a0e5){if(_0x8d465e[_0xdc02('0x63')]['id']){delete _0x8d465e['body']['id'];}return db[_0xdc02('0x3c')]['find']({'where':{'id':_0x8d465e[_0xdc02('0x52')]['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x25d1ce,null))[_0xdc02('0x20')](function(_0x36614a){if(_0x36614a){_0x8d465e['body']['WhatsappAccountId']=_0x36614a['id'];return db[_0xdc02('0x6c')][_0xdc02('0x59')](_0x8d465e[_0xdc02('0x63')]);}})[_0xdc02('0x20')](respondWithResult(_0x25d1ce,null))[_0xdc02('0x28')](handleError(_0x25d1ce,null));};exports['getAnswers']=function(_0x1ce16a,_0x23583f,_0x452846){var _0xd8b453={'raw':![],'where':{}};var _0x5ca815={};var _0x2a096d={'count':0x0,'rows':[]};return db[_0xdc02('0x3c')][_0xdc02('0x6d')]({'where':{'id':_0x1ce16a[_0xdc02('0x52')]['id']}})['then'](handleEntityNotFound(_0x23583f,null))[_0xdc02('0x20')](function(_0x3f6811){if(_0x3f6811){_0x5ca815[_0xdc02('0x3f')]=_[_0xdc02('0x54')](db[_0xdc02('0x6c')][_0xdc02('0x55')]);_0x5ca815[_0xdc02('0x41')]=_[_0xdc02('0x54')](_0x1ce16a[_0xdc02('0x41')]);_0x5ca815[_0xdc02('0x40')]=_[_0xdc02('0x56')](_0x5ca815['model'],_0x5ca815[_0xdc02('0x41')]);_0xd8b453[_0xdc02('0x42')]=_['intersection'](_0x5ca815[_0xdc02('0x3f')],qs['fields'](_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x43')]));_0xd8b453['attributes']=_0xd8b453['attributes'][_0xdc02('0x57')]?_0xd8b453[_0xdc02('0x42')]:_0x5ca815[_0xdc02('0x3f')];if(!_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x69')](_0xdc02('0x44'))){_0xd8b453[_0xdc02('0x2e')]=qs[_0xdc02('0x2e')](_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x2e')]);_0xd8b453['offset']=qs[_0xdc02('0x2d')](_0x1ce16a['query']['offset']);}_0xd8b453[_0xdc02('0x45')]=qs[_0xdc02('0x46')](_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x46')]);_0xd8b453[_0xdc02('0x47')]=qs[_0xdc02('0x40')](_[_0xdc02('0x48')](_0x1ce16a[_0xdc02('0x41')],_0x5ca815['filters']));_0xd8b453[_0xdc02('0x47')]['WhatsappAccountId']=_0x3f6811['id'];if(_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x49')]){_0xd8b453[_0xdc02('0x47')]=_[_0xdc02('0x4a')](_0xd8b453[_0xdc02('0x47')],{'$or':_['map'](_0xd8b453['attributes'],function(_0x3985aa){var _0x59d33d={};_0x59d33d[_0x3985aa]={'$like':'%'+_0x1ce16a[_0xdc02('0x41')][_0xdc02('0x49')]+'%'};return _0x59d33d;})});}_0xd8b453=_[_0xdc02('0x4a')]({},_0xd8b453,_0x1ce16a[_0xdc02('0x58')]);return db['CannedAnswer'][_0xdc02('0x30')]({'where':_0xd8b453[_0xdc02('0x47')]})[_0xdc02('0x20')](function(_0x549624){_0x2a096d['count']=_0x549624;if(_0x1ce16a[_0xdc02('0x41')]['includeAll']){_0xd8b453[_0xdc02('0x4e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xd8b453);})[_0xdc02('0x20')](function(_0x24cd67){_0x2a096d[_0xdc02('0x50')]=_0x24cd67;return _0x2a096d;});}})[_0xdc02('0x20')](respondWithFilteredResult(_0x23583f,_0xd8b453))[_0xdc02('0x28')](handleError(_0x23583f,null));};exports[_0xdc02('0x6e')]=function(_0x6b40fe,_0x114e97,_0x1d8492){return db[_0xdc02('0x3c')]['find']({'where':{'id':_0x6b40fe['params']['id']}})['then'](handleEntityNotFound(_0x114e97,null))[_0xdc02('0x20')](function(_0x5b200f){if(_0x5b200f){return _0x5b200f[_0xdc02('0x6e')](_0x6b40fe['query'][_0xdc02('0x6f')]);}})[_0xdc02('0x20')](respondWithStatusCode(_0x114e97,null))[_0xdc02('0x28')](handleError(_0x114e97,null));};exports[_0xdc02('0x70')]=function(_0x2f7fd2,_0x267e75,_0x27167c){return db[_0xdc02('0x3c')][_0xdc02('0x5e')]({'where':{'id':_0x2f7fd2[_0xdc02('0x52')]['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x267e75,null))[_0xdc02('0x20')](function(_0x270f47){if(_0x270f47){return _0x270f47[_0xdc02('0x70')](_0x2f7fd2[_0xdc02('0x63')][_0xdc02('0x6f')],_[_0xdc02('0x71')](_0x2f7fd2[_0xdc02('0x63')],[_0xdc02('0x6f'),'id'])||{})[_0xdc02('0x72')](function(_0x2a806b){for(var _0x55be7a=0x0;_0x55be7a<_0x2f7fd2[_0xdc02('0x63')][_0xdc02('0x6f')][_0xdc02('0x57')];_0x55be7a+=0x1){socket[_0xdc02('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x2f7fd2['body']['ids'][_0x55be7a]),'WhatsappAccountId':Number(_0x2f7fd2[_0xdc02('0x52')]['id'])});}return _0x2a806b;});}})[_0xdc02('0x20')](respondWithResult(_0x267e75,null))[_0xdc02('0x28')](handleError(_0x267e75,null));};exports['removeAgents']=function(_0x2b7fae,_0x465764,_0x1feede){return db[_0xdc02('0x3c')][_0xdc02('0x5e')]({'where':{'id':_0x2b7fae[_0xdc02('0x52')]['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x465764,null))[_0xdc02('0x20')](function(_0x17ea52){if(_0x17ea52){return _0x17ea52['removeAgents'](_0x2b7fae['query'][_0xdc02('0x6f')])['then'](function(){if(_[_0xdc02('0x74')](_0x2b7fae['query'][_0xdc02('0x6f')])){for(var _0x3fb124=0x0;_0x3fb124<_0x2b7fae[_0xdc02('0x41')][_0xdc02('0x6f')][_0xdc02('0x57')];_0x3fb124+=0x1){socket[_0xdc02('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x2b7fae[_0xdc02('0x41')][_0xdc02('0x6f')][_0x3fb124]),'WhatsappAccountId':Number(_0x2b7fae[_0xdc02('0x52')]['id'])});}}else{socket[_0xdc02('0x73')](_0xdc02('0x75'),{'UserId':Number(_0x2b7fae[_0xdc02('0x41')]['ids']),'WhatsappAccountId':Number(_0x2b7fae[_0xdc02('0x52')]['id'])});}});}})[_0xdc02('0x20')](respondWithStatusCode(_0x465764,null))[_0xdc02('0x28')](handleError(_0x465764,null));};exports['getAgents']=function(_0x52fb4c,_0x4977dc,_0x16e922){var _0xf5bdbc={};var _0x25cbf3={};var _0x1c118f;var _0x1509ad;return db['WhatsappAccount'][_0xdc02('0x6d')]({'where':{'id':_0x52fb4c['params']['id']}})[_0xdc02('0x20')](handleEntityNotFound(_0x4977dc,null))[_0xdc02('0x20')](function(_0x77d8b0){if(_0x77d8b0){_0x1c118f=_0x77d8b0;_0x25cbf3[_0xdc02('0x3f')]=_[_0xdc02('0x54')](db['User'][_0xdc02('0x55')]);_0x25cbf3[_0xdc02('0x41')]=_[_0xdc02('0x54')](_0x52fb4c[_0xdc02('0x41')]);_0x25cbf3[_0xdc02('0x40')]=_['intersection'](_0x25cbf3['model'],_0x25cbf3[_0xdc02('0x41')]);_0xf5bdbc[_0xdc02('0x42')]=_['intersection'](_0x25cbf3['model'],qs[_0xdc02('0x43')](_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x43')]));_0xf5bdbc[_0xdc02('0x42')]=_0xf5bdbc[_0xdc02('0x42')][_0xdc02('0x57')]?_0xf5bdbc[_0xdc02('0x42')]:_0x25cbf3[_0xdc02('0x3f')];_0xf5bdbc[_0xdc02('0x45')]=qs[_0xdc02('0x46')](_0x52fb4c[_0xdc02('0x41')]['sort']);_0xf5bdbc['where']=qs[_0xdc02('0x40')](_['pick'](_0x52fb4c[_0xdc02('0x41')],_0x25cbf3[_0xdc02('0x40')]));if(_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x49')]){_0xf5bdbc[_0xdc02('0x47')]=_[_0xdc02('0x4a')](_0xf5bdbc[_0xdc02('0x47')],{'$or':_['map'](_0xf5bdbc[_0xdc02('0x42')],function(_0x34b474){var _0x4f1bf8={};_0x4f1bf8[_0x34b474]={'$like':'%'+_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x49')]+'%'};return _0x4f1bf8;})});}_0xf5bdbc=_[_0xdc02('0x4a')]({},_0xf5bdbc,_0x52fb4c['options']);return _0x1c118f['getAgents'](_0xf5bdbc);}})[_0xdc02('0x20')](function(_0x313010){if(_0x313010){_0x1509ad=_0x313010['length'];if(!_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x69')](_0xdc02('0x44'))){_0xf5bdbc[_0xdc02('0x2e')]=qs[_0xdc02('0x2e')](_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x2e')]);_0xf5bdbc[_0xdc02('0x2d')]=qs['offset'](_0x52fb4c[_0xdc02('0x41')][_0xdc02('0x2d')]);}return _0x1c118f[_0xdc02('0x76')](_0xf5bdbc);}})['then'](function(_0x25ba5d){if(_0x25ba5d){return _0x25ba5d?{'count':_0x1509ad,'rows':_0x25ba5d}:null;}})[_0xdc02('0x20')](respondWithResult(_0x4977dc,null))[_0xdc02('0x28')](handleError(_0x4977dc,null));};exports[_0xdc02('0x77')]=function(_0x402d35,_0x1d7aaf){var _0x9f0e36=_0x402d35[_0xdc02('0x52')]['id'];var _0x2dda56=_0x402d35[_0xdc02('0x63')];var _0x357f35=0xc8;var _0x44dfc4=null;return db[_0xdc02('0x78')][_0xdc02('0x79')]({'isolationLevel':db['sequelize'][_0xdc02('0x7a')][_0xdc02('0x7b')]['READ_COMMITTED']},function(_0x5ae987){return db['WhatsappAccount']['findOne']({'where':{'id':_0x9f0e36},'transaction':_0x5ae987})['then'](function(_0x4ed19b){if(_0x4ed19b){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x9f0e36},'transaction':_0x5ae987})[_0xdc02('0x20')](function(){var _0x436058=_['map'](_0x2dda56,function(_0x4d36ab){_0x4d36ab[_0xdc02('0x66')]=_0x9f0e36;return _0x4d36ab;});return db['WhatsappApplication']['bulkCreate'](_0x436058,{'transaction':_0x5ae987});});}else{_0x357f35=0x194;_0x44dfc4=[];}});})['then'](function(){if(_0x357f35!==0x194){return db[_0xdc02('0x7c')][_0xdc02('0x7d')]({'where':{'WhatsappAccountId':_0x9f0e36},'order':_0xdc02('0x7e')})['then'](function(_0x4bad0e){_0x44dfc4=_0x4bad0e;});}})[_0xdc02('0x28')](function(_0x161e50){_0x357f35=0x1f4;logger[_0xdc02('0x25')](_0x161e50[_0xdc02('0x38')]);if(_0x161e50[_0xdc02('0x39')]){delete _0x161e50[_0xdc02('0x39')];}_0x44dfc4=_0x161e50;})[_0xdc02('0x7f')](function(){if(_0x44dfc4===null){_0x1d7aaf[_0xdc02('0x29')](_0x357f35);}else{if(_0x357f35===0x1f4){_0x1d7aaf[_0xdc02('0x2a')](_0x357f35)[_0xdc02('0x80')](_0x44dfc4);}else{_0x1d7aaf[_0xdc02('0x2a')](_0x357f35)[_0xdc02('0x2c')](_0x44dfc4);}}});};exports['getApplications']=function(_0x194782,_0x5d0fcc,_0x43694e){var _0x1404d6={};var _0x437e87={};var _0x4446c9;var _0x28098f;return db[_0xdc02('0x3c')][_0xdc02('0x6d')]({'where':{'id':_0x194782['params']['id']}})['then'](handleEntityNotFound(_0x5d0fcc,null))[_0xdc02('0x20')](function(_0x1c66c8){if(_0x1c66c8){_0x4446c9=_0x1c66c8;_0x437e87[_0xdc02('0x3f')]=_['keys'](db[_0xdc02('0x7c')]['rawAttributes']);_0x437e87[_0xdc02('0x41')]=_[_0xdc02('0x54')](_0x194782[_0xdc02('0x41')]);_0x437e87['filters']=_[_0xdc02('0x56')](_0x437e87[_0xdc02('0x3f')],_0x437e87[_0xdc02('0x41')]);_0x1404d6[_0xdc02('0x42')]=_[_0xdc02('0x56')](_0x437e87[_0xdc02('0x3f')],qs[_0xdc02('0x43')](_0x194782[_0xdc02('0x41')][_0xdc02('0x43')]));_0x1404d6[_0xdc02('0x42')]=_0x1404d6[_0xdc02('0x42')][_0xdc02('0x57')]?_0x1404d6[_0xdc02('0x42')]:_0x437e87[_0xdc02('0x3f')];_0x1404d6['order']=qs[_0xdc02('0x46')](_0x194782[_0xdc02('0x41')][_0xdc02('0x46')]);_0x1404d6[_0xdc02('0x47')]=qs[_0xdc02('0x40')](_[_0xdc02('0x48')](_0x194782[_0xdc02('0x41')],_0x437e87[_0xdc02('0x40')]));if(_0x194782[_0xdc02('0x41')][_0xdc02('0x49')]){_0x1404d6[_0xdc02('0x47')]=_['merge'](_0x1404d6[_0xdc02('0x47')],{'$or':_[_0xdc02('0x3b')](_0x1404d6[_0xdc02('0x42')],function(_0x1c376c){var _0x39f000={};_0x39f000[_0x1c376c]={'$like':'%'+_0x194782['query'][_0xdc02('0x49')]+'%'};return _0x39f000;})});}_0x1404d6=_[_0xdc02('0x4a')]({},_0x1404d6,_0x194782[_0xdc02('0x58')]);return _0x4446c9[_0xdc02('0x81')](_0x1404d6);}})[_0xdc02('0x20')](function(_0x4c8776){if(_0x4c8776){_0x28098f=_0x4c8776[_0xdc02('0x57')];if(!_0x194782[_0xdc02('0x41')]['hasOwnProperty'](_0xdc02('0x44'))){_0x1404d6[_0xdc02('0x2e')]=qs[_0xdc02('0x2e')](_0x194782['query'][_0xdc02('0x2e')]);_0x1404d6[_0xdc02('0x2d')]=qs[_0xdc02('0x2d')](_0x194782['query'][_0xdc02('0x2d')]);}return _0x4446c9[_0xdc02('0x81')](_0x1404d6);}})[_0xdc02('0x20')](function(_0x443b07){if(_0x443b07){return _0x443b07?{'count':_0x28098f,'rows':_0x443b07}:null;}})['then'](respondWithResult(_0x5d0fcc,null))['catch'](handleError(_0x5d0fcc,null));};exports[_0xdc02('0x82')]=function(_0x4971c5,_0x184157,_0x20ef11){var _0x41c80a={'channel':_0xdc02('0x83')};var _0x54f320=[];var _0x24dffa=[];var _0x1a2717={};return db['WhatsappAccount'][_0xdc02('0x5e')]({'where':{'id':_0x4971c5['params']['id']},'include':[{'model':db[_0xdc02('0x7c')],'as':_0xdc02('0x84')}]})[_0xdc02('0x20')](handleEntityNotFound(_0x184157,null))[_0xdc02('0x20')](function(_0x25a686){_0x41c80a[_0xdc02('0x85')]=_0x25a686;if(_0x41c80a['account']&&_0x41c80a[_0xdc02('0x85')][_0xdc02('0x4b')]===_0xdc02('0x86')&&_0x4971c5[_0xdc02('0x63')][_0xdc02('0x87')]){if(_0x4971c5[_0xdc02('0x63')][_0xdc02('0x87')][_0xdc02('0x57')]===0x0)return;if(_0x4971c5[_0xdc02('0x63')][_0xdc02('0x87')][0x0][_0xdc02('0x88')]!==_0xdc02('0x89'))return;return db[_0xdc02('0x8a')][_0xdc02('0x35')]({'read':!![],'readAt':_0x4971c5[_0xdc02('0x63')][_0xdc02('0x87')][0x0][_0xdc02('0x8b')]},{'where':{'messageId':_0x4971c5['body'][_0xdc02('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0xdc02('0x20')](function(_0x676266){return _0x184157[_0xdc02('0x2a')](0xc8)[_0xdc02('0x2c')](_0x676266);});}_0x41c80a[_0xdc02('0x8c')]=_[_0xdc02('0x8d')](_0x25a686[_0xdc02('0x84')],['priority'],[_0xdc02('0x8e')]);if(_0x41c80a['account'][_0xdc02('0x84')]){delete _0x41c80a[_0xdc02('0x85')]['Applications'];}return db[_0xdc02('0x8f')][_0xdc02('0x64')]()['then'](function(_0xa22df6){if(!_0xa22df6){throw new db['Sequelize']['ValidationError'](_0xdc02('0x90'));}_0x54f320=_[_0xdc02('0x91')](_[_0xdc02('0x54')](_0xa22df6),[_0xdc02('0x92'),'updatedAt']);_0x24dffa=_['difference'](_[_0xdc02('0x54')](_0xa22df6),[_0xdc02('0x92'),_0xdc02('0x93'),_0xdc02('0x94'),_0xdc02('0x95')]);_0x41c80a['body']={'mapKey':_0xdc02('0x96')};if(_0x41c80a[_0xdc02('0x85')]&&_0x41c80a[_0xdc02('0x85')][_0xdc02('0x4b')]===_0xdc02('0x97')){_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')]=_0x4971c5[_0xdc02('0x63')][_0xdc02('0x99')][_0xdc02('0x9a')](_0xdc02('0x9b'),'');_0x41c80a[_0xdc02('0x63')][_0xdc02('0x63')]=_0x4971c5[_0xdc02('0x63')]['Body'];_0x41c80a['body'][_0xdc02('0x9c')]=_0x4971c5['body'][_0xdc02('0x9d')];}if(_0x41c80a[_0xdc02('0x85')]&&_0x41c80a['account'][_0xdc02('0x4b')]==='sinch'){_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')]=_0x4971c5['body'][_0xdc02('0x9e')][0x0][_0xdc02('0x98')];_0x41c80a[_0xdc02('0x63')][_0xdc02('0x63')]=_0x4971c5[_0xdc02('0x63')][_0xdc02('0x9e')][0x0][_0xdc02('0x26')]['body'];_0x41c80a[_0xdc02('0x63')][_0xdc02('0x9c')]=_0x4971c5[_0xdc02('0x63')]['notifications'][0x0][_0xdc02('0x9f')];}if(_0x41c80a[_0xdc02('0x63')]['id']){delete _0x41c80a[_0xdc02('0x63')]['id'];}if(_['isNil'](_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')])){throw new db[(_0xdc02('0xa0'))][(_0xdc02('0xa1'))](_0xdc02('0xa2'));}if(_[_0xdc02('0xa3')](_0x41c80a[_0xdc02('0x63')][_0xdc02('0x63')])||_0x41c80a['body']['body']===''){throw new db[(_0xdc02('0xa0'))]['ValidationError'](_0xdc02('0xa4'));}if(_[_0xdc02('0xa3')](_0x41c80a['body'][_0xdc02('0xa5')])){throw new db[(_0xdc02('0xa0'))][(_0xdc02('0xa1'))](_0xdc02('0xa6')+_0x24dffa);}if(!_[_0xdc02('0xa7')](_0x24dffa,_0x41c80a['body'][_0xdc02('0xa5')])){throw new db['Sequelize'][(_0xdc02('0xa1'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x24dffa);}_0x1a2717[_0x41c80a[_0xdc02('0x63')]['mapKey']]=_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')];return db[_0xdc02('0xa8')]['find']({'where':{'id':_0x41c80a['account']['ListId']},'include':[{'model':db[_0xdc02('0x8f')],'as':'Contacts','where':_0x1a2717,'limit':0x1,'order':[[_0xdc02('0x93'),_0xdc02('0xa9')]]}]});})[_0xdc02('0x20')](handleEntityNotFound(_0x184157,null))['then'](function(_0x4d59ea){if(_0x4d59ea){_0x41c80a[_0xdc02('0xaa')]=_[_0xdc02('0x71')](_0x4d59ea,[_0xdc02('0xab')]);if(_0x4d59ea['Contacts'][_0xdc02('0x57')]){return _0x4d59ea['Contacts'][0x0];}var _0x45e738=_['defaults'](_0x41c80a['body'],{'firstName':_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')],'ListId':_0x4d59ea['id']});_0x45e738[_0x41c80a[_0xdc02('0x63')][_0xdc02('0xa5')]]=_0x41c80a[_0xdc02('0x63')][_0xdc02('0x98')];return db[_0xdc02('0x8f')][_0xdc02('0x59')](_0x45e738,{'fields':_0x54f320,'raw':!![]});}})[_0xdc02('0x20')](handleEntityNotFound(_0x184157,null))[_0xdc02('0x20')](function(_0x5b0776){if(_0x5b0776){_0x41c80a[_0xdc02('0xac')]=_0x5b0776;var _0xab68aa={'ContactId':_0x5b0776['id'],'phone':_0x41c80a['body'][_0xdc02('0x98')],'WhatsappAccountId':_0x4971c5[_0xdc02('0x52')]['id']};var _0x118715={'ContactId':_0x5b0776['id'],'WhatsappAccountId':_0x4971c5[_0xdc02('0x52')]['id'],'closed':![]};return db[_0xdc02('0xad')][_0xdc02('0x5e')]({'where':_0x118715})[_0xdc02('0x20')](function(_0x49ea86){if(_0x49ea86){return[_0x49ea86,![]];}return db['WhatsappInteraction'][_0xdc02('0x59')](_0xab68aa)['then'](function(_0x2bf2ac){return[_0x2bf2ac,!![]];});});}})['spread'](function(_0x1b6929,_0x135ef9){_0x41c80a[_0xdc02('0xae')]=_0x1b6929[_0xdc02('0x37')]({'plain':!![]});_0x41c80a[_0xdc02('0xae')][_0xdc02('0xaf')]=![];if(_0x135ef9){if(_0x41c80a[_0xdc02('0x85')]['autoclose']){_0x41c80a['applications'][_0xdc02('0xb0')]({'id':0x0,'priority':_0x41c80a[_0xdc02('0x8c')][_0xdc02('0x57')]+0x1,'app':_0xdc02('0xb1'),'appdata':_0xdc02('0xb2'),'interval':_0xdc02('0xb3')});}_0x41c80a[_0xdc02('0xae')][_0xdc02('0xaf')]=!![];}return db[_0xdc02('0x8a')][_0xdc02('0x59')]({'phone':_0x41c80a[_0xdc02('0x63')]['from'],'messageId':_0x41c80a['body']['messageId'],'body':_0x41c80a[_0xdc02('0x63')][_0xdc02('0x63')],'WhatsappAccountId':_0x4971c5[_0xdc02('0x52')]['id'],'WhatsappInteractionId':_0x1b6929['id'],'direction':'in','ContactId':_0x1b6929[_0xdc02('0xb4')],'AttachmentId':_0x41c80a['body'][_0xdc02('0xb5')]});})[_0xdc02('0x20')](function(_0x5a30c6){_0x41c80a['message']=_0x5a30c6;if(_0x41c80a['interaction'][_0xdc02('0xb6')]){return db[_0xdc02('0xb7')][_0xdc02('0x5e')]({'attributes':['id',_0xdc02('0x39')],'where':{'id':_0x41c80a['interaction'][_0xdc02('0xb6')]}})['then'](function(_0x30ec3c){if(_0x30ec3c){_0x41c80a[_0xdc02('0x8c')][_0xdc02('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x30ec3c[_0xdc02('0x39')]+','+(_0x41c80a[_0xdc02('0x85')][_0xdc02('0xb9')]||0xa),'interval':_0xdc02('0xb3')});}return respondWithRpcPromise('Start','startRouting',_0x41c80a);});}return respondWithRpcPromise(_0xdc02('0xba'),'startRouting',_0x41c80a);})['then'](function(_0x3da210){if(_0x3da210){var _0x3686f0=0xc8;var _0x4b986c='receiveMessage';logger[_0xdc02('0x21')](_0xdc02('0x23'),_0x4b986c,_0x3686f0,_0xdc02('0xbb'));logger[_0xdc02('0xbc')](_0xdc02('0xbd'),_0x4b986c,_0x3686f0,_0xdc02('0xbb'),JSON[_0xdc02('0xbe')](_0x3da210));if(_0x41c80a[_0xdc02('0x85')][_0xdc02('0x4b')]==='twilio'){return _0x184157['status'](_0x3686f0)[_0xdc02('0x31')](_0xdc02('0xbf'),'text/xml')[_0xdc02('0x80')](_0xdc02('0xc0'));}else{return _0x184157[_0xdc02('0x2a')](_0x3686f0)[_0xdc02('0x2c')](_0x3da210);}}});})[_0xdc02('0x28')](handleError(_0x184157,null));};exports['send']=function(_0x1a584f,_0x428c3d,_0x4c285c){var _0x1a1f89,_0xc92f6,_0x1a1710;if(_[_0xdc02('0xa3')](_0x1a584f['body']['body'])||_0x1a584f['body'][_0xdc02('0x63')]===''){throw new db[(_0xdc02('0xa0'))][(_0xdc02('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdc02('0xa3')](_0x1a584f['body']['to'])){throw new db[(_0xdc02('0xa0'))][(_0xdc02('0xa1'))](_0xdc02('0xc1'));}_0x1a1f89=_0x1a584f['body']['to'];return db[_0xdc02('0x3c')]['find']({'where':{'id':_0x1a584f[_0xdc02('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0xdc02('0xc2'),'include':[{'model':db[_0xdc02('0x8f')],'as':'Contacts','where':{'mobile':_0x1a1f89},'limit':0x1,'order':[[_0xdc02('0x93'),_0xdc02('0xa9')]]}]}]})[_0xdc02('0x20')](handleEntityNotFound(_0x428c3d,null))[_0xdc02('0x20')](function(_0x12d3e6){if(_0x12d3e6&&_0x12d3e6[_0xdc02('0xc2')]){_0xc92f6=_0x12d3e6['get']({'plain':!![]});if(_0xc92f6[_0xdc02('0xc2')]&&_0xc92f6['List']['Contacts'][_0xdc02('0x57')]){return _0xc92f6['List']['Contacts'][0x0];}return db['CmContact'][_0xdc02('0x59')](_['defaults'](_0x1a584f['body'],{'firstName':_0x1a1f89,'mobile':_0x1a1f89,'phone':_0x1a1f89,'ListId':_0xc92f6['ListId']}));}})[_0xdc02('0x20')](handleEntityNotFound(_0x428c3d,null))['then'](function(_0x3b132a){if(_0x3b132a){_0x1a1710=_0x3b132a;return db[_0xdc02('0xad')][_0xdc02('0x5e')]({'where':{'ContactId':_0x1a1710['id'],'closed':![],'WhatsappAccountId':_0xc92f6['id']}})[_0xdc02('0x20')](function(_0x5390f8){if(_0x5390f8){return[_0x5390f8,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x1a584f[_0xdc02('0x5a')]['id'],'ContactId':_0x1a1710['id'],'WhatsappAccountId':_0xc92f6['id'],'phone':_0x1a1f89,'firstMsgDirection':_0xdc02('0xc3'),'Messages':[_[_0xdc02('0x4a')](_0x1a584f[_0xdc02('0x63')],{'read':![],'body':_0x1a584f[_0xdc02('0x63')][_0xdc02('0x63')],'phone':_0x1a1f89,'WhatsappAccountId':_0xc92f6['id'],'UserId':_0x1a584f[_0xdc02('0x5a')]['id'],'ContactId':_0x1a1710['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0xdc02('0x20')](function(_0x465d41){return[_0x465d41,!![]];});});}})[_0xdc02('0x72')](function(_0x3a6970,_0xd494c2){if(_0xd494c2){return _0x3a6970;}return db['WhatsappMessage'][_0xdc02('0x59')](_[_0xdc02('0x4a')](_0x1a584f[_0xdc02('0x63')],{'read':![],'body':_0x1a584f[_0xdc02('0x63')][_0xdc02('0x63')],'phone':_0x1a1f89,'WhatsappAccountId':_0xc92f6['id'],'WhatsappInteractionId':_0x3a6970['id'],'UserId':_0x1a584f[_0xdc02('0x5a')]['id'],'ContactId':_0x1a1710['id']}))[_0xdc02('0x20')](function(_0x3a0e0c){_0x3a6970[_0xdc02('0xc4')]['Messages']=[];_0x3a6970[_0xdc02('0xc4')][_0xdc02('0xc5')][_0xdc02('0xb0')](_0x3a0e0c['dataValues']);return _0x3a6970;});})['then'](respondWithResult(_0x428c3d,null))[_0xdc02('0x28')](handleError(_0x428c3d,null));}; \ No newline at end of file +var _0x0022=['VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','order','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','user','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','nolimit','sort','where','pick'];(function(_0x5b66c8,_0x429c0f){var _0x22a72b=function(_0x42d6b1){while(--_0x42d6b1){_0x5b66c8['push'](_0x5b66c8['shift']());}};_0x22a72b(++_0x429c0f);}(_0x0022,0x77));var _0x2002=function(_0x505e42,_0x27afb9){_0x505e42=_0x505e42-0x0;var _0xc12a34=_0x0022[_0x505e42];return _0xc12a34;};'use strict';var emlformat=require(_0x2002('0x0'));var rimraf=require(_0x2002('0x1'));var zipdir=require(_0x2002('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2002('0x3'));var moment=require(_0x2002('0x4'));var BPromise=require(_0x2002('0x5'));var Mustache=require(_0x2002('0x6'));var util=require(_0x2002('0x7'));var path=require(_0x2002('0x8'));var sox=require(_0x2002('0x9'));var csv=require(_0x2002('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2002('0xb'));var _=require(_0x2002('0xc'));var squel=require(_0x2002('0xd'));var crypto=require(_0x2002('0xe'));var jsforce=require(_0x2002('0xf'));var deskjs=require(_0x2002('0x10'));var toCsv=require(_0x2002('0xa'));var querystring=require('querystring');var Papa=require(_0x2002('0x11'));var Redis=require(_0x2002('0x12'));var authService=require(_0x2002('0x13'));var qs=require(_0x2002('0x14'));var as=require(_0x2002('0x15'));var hardwareService=require(_0x2002('0x16'));var logger=require(_0x2002('0x17'))(_0x2002('0x18'));var utils=require(_0x2002('0x19'));var config=require(_0x2002('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2002('0x1b')](config[_0x2002('0x1c')],{'host':_0x2002('0x1d'),'port':0x18eb});var socket=require(_0x2002('0x1e'))(new Redis(config[_0x2002('0x1c')]));require(_0x2002('0x1f'))[_0x2002('0x20')](socket);var jayson=require(_0x2002('0x21'));var client=jayson[_0x2002('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x2ebefe,_0x468b8e,_0x4e4ea8,_0x270959){return new BPromise(function(_0x2e627f,_0x3c53ca){var _0x4989f3=_0x270959||client;return _0x4989f3[_0x2002('0x23')](_0x2ebefe,_0x4e4ea8)[_0x2002('0x24')](function(_0x38e3a6){logger['info'](_0x2002('0x25'),_0x468b8e,_0x2002('0x26'));logger[_0x2002('0x27')](_0x2002('0x28'),_0x468b8e,'request\x20sent',JSON[_0x2002('0x29')](_0x38e3a6));if(_0x38e3a6[_0x2002('0x2a')]){if(_0x38e3a6['error'][_0x2002('0x2b')]===0x1f4){logger['error'](_0x2002('0x25'),_0x468b8e,_0x38e3a6[_0x2002('0x2a')]['message']);return _0x3c53ca(_0x38e3a6[_0x2002('0x2a')]['message']);}logger[_0x2002('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x468b8e,_0x38e3a6['error']['message']);return _0x2e627f(_0x38e3a6[_0x2002('0x2a')][_0x2002('0x2c')]);}else{logger[_0x2002('0x2d')](_0x2002('0x25'),_0x468b8e,'request\x20sent');_0x2e627f(_0x38e3a6['result'][_0x2002('0x2c')]);}})['catch'](function(_0x3738f6){logger['error'](_0x2002('0x25'),_0x468b8e,_0x3738f6);_0x3c53ca(_0x3738f6);});});}function respondWithStatusCode(_0x387ff7,_0x507667){_0x507667=_0x507667||0xcc;return function(_0x592332){if(_0x592332){return _0x387ff7[_0x2002('0x2e')](_0x507667);}return _0x387ff7['status'](_0x507667)[_0x2002('0x2f')]();};}function respondWithResult(_0x5c418d,_0x302182){_0x302182=_0x302182||0xc8;return function(_0x31ac86){if(_0x31ac86){return _0x5c418d['status'](_0x302182)[_0x2002('0x30')](_0x31ac86);}};}function respondWithFilteredResult(_0x2473b5,_0x3529ee){return function(_0x1c3fa1){if(_0x1c3fa1){var _0x849153=typeof _0x3529ee['offset']===_0x2002('0x31')&&typeof _0x3529ee[_0x2002('0x32')]===_0x2002('0x31');var _0x174963=_0x1c3fa1[_0x2002('0x33')];var _0x1e36f0=_0x849153?0x0:_0x3529ee[_0x2002('0x34')];var _0x31133b=_0x849153?_0x1c3fa1[_0x2002('0x33')]:_0x3529ee['offset']+_0x3529ee['limit'];var _0x101629;if(_0x31133b>=_0x174963){_0x31133b=_0x174963;_0x101629=0xc8;}else{_0x101629=0xce;}_0x2473b5[_0x2002('0x35')](_0x101629);return _0x2473b5['set'](_0x2002('0x36'),_0x1e36f0+'-'+_0x31133b+'/'+_0x174963)[_0x2002('0x30')](_0x1c3fa1);}return null;};}function patchUpdates(_0x35ddfd){return function(_0x36363b){try{jsonpatch['apply'](_0x36363b,_0x35ddfd,!![]);}catch(_0x3ea3fa){return BPromise['reject'](_0x3ea3fa);}return _0x36363b['save']();};}function saveUpdates(_0x583095,_0x278dfe){return function(_0x506157){if(_0x506157){return _0x506157[_0x2002('0x37')](_0x583095)[_0x2002('0x24')](function(_0x208f19){return _0x208f19;});}return null;};}function removeEntity(_0x3c0736,_0x40059d){return function(_0x421667){if(_0x421667){return _0x421667[_0x2002('0x38')]()[_0x2002('0x24')](function(){var _0x858b3a=_0x421667[_0x2002('0x39')]({'plain':!![]});var _0x4c51ff=_0x2002('0x3a');return db[_0x2002('0x3b')][_0x2002('0x38')]({'where':{'type':_0x4c51ff,'resourceId':_0x858b3a['id']}})[_0x2002('0x24')](function(){return _0x421667;});})['then'](function(){_0x3c0736[_0x2002('0x35')](0xcc)[_0x2002('0x2f')]();});}};}function handleEntityNotFound(_0x16de32,_0x20d7df){return function(_0x515bb2){if(!_0x515bb2){_0x16de32[_0x2002('0x2e')](0x194);}return _0x515bb2;};}function handleError(_0x10b2a3,_0x2baaae){_0x2baaae=_0x2baaae||0x1f4;return function(_0xbf518e){logger['error'](_0xbf518e[_0x2002('0x3c')]);if(_0xbf518e[_0x2002('0x3d')]){delete _0xbf518e[_0x2002('0x3d')];}_0x10b2a3[_0x2002('0x35')](_0x2baaae)[_0x2002('0x3e')](_0xbf518e);};}exports[_0x2002('0x3f')]=function(_0x5da0e4,_0x293137){var _0x2dead3={'include':[{'model':db[_0x2002('0x40')],'as':_0x2002('0x41')}]},_0x40bc85={},_0x28236b={'count':0x0,'rows':[]};var _0xf4877c=_[_0x2002('0x42')](db[_0x2002('0x43')][_0x2002('0x44')],function(_0xb3d3ea){return{'name':_0xb3d3ea[_0x2002('0x45')],'type':_0xb3d3ea[_0x2002('0x46')]['key']};});_0x40bc85['model']=_[_0x2002('0x42')](_0xf4877c,_0x2002('0x3d'));_0x40bc85[_0x2002('0x47')]=_[_0x2002('0x48')](_0x5da0e4['query']);_0x40bc85[_0x2002('0x49')]=_['intersection'](_0x40bc85[_0x2002('0x4a')],_0x40bc85['query']);_0x2dead3[_0x2002('0x4b')]=_['intersection'](_0x40bc85[_0x2002('0x4a')],qs[_0x2002('0x4c')](_0x5da0e4[_0x2002('0x47')][_0x2002('0x4c')]));_0x2dead3[_0x2002('0x4b')]=_0x2dead3[_0x2002('0x4b')][_0x2002('0x4d')]?_0x2dead3[_0x2002('0x4b')]:_0x40bc85[_0x2002('0x4a')];if(!_0x5da0e4[_0x2002('0x47')]['hasOwnProperty'](_0x2002('0x4e'))){_0x2dead3['limit']=qs['limit'](_0x5da0e4['query']['limit']);_0x2dead3['offset']=qs['offset'](_0x5da0e4[_0x2002('0x47')][_0x2002('0x34')]);}_0x2dead3['order']=qs[_0x2002('0x4f')](_0x5da0e4[_0x2002('0x47')][_0x2002('0x4f')]);_0x2dead3[_0x2002('0x50')]=qs['filters'](_[_0x2002('0x51')](_0x5da0e4[_0x2002('0x47')],_0x40bc85[_0x2002('0x49')]),_0xf4877c);if(_0x5da0e4[_0x2002('0x47')]['filter']){_0x2dead3[_0x2002('0x50')]=_['merge'](_0x2dead3[_0x2002('0x50')],{'$or':_['map'](_0xf4877c,function(_0x36f94c){if(_0x36f94c[_0x2002('0x46')]!==_0x2002('0x52')){var _0x437ac8={};_0x437ac8[_0x36f94c[_0x2002('0x3d')]]={'$like':'%'+_0x5da0e4[_0x2002('0x47')][_0x2002('0x53')]+'%'};return _0x437ac8;}})});}_0x2dead3=_[_0x2002('0x54')]({},_0x2dead3,_0x5da0e4['options']);var _0x5073d0={'where':_0x2dead3[_0x2002('0x50')]};return db['WhatsappAccount'][_0x2002('0x33')](_0x5073d0)['then'](function(_0x95967f){_0x28236b['count']=_0x95967f;if(_0x5da0e4[_0x2002('0x47')][_0x2002('0x55')]){_0x2dead3[_0x2002('0x56')]=[{'all':!![]}];}return db[_0x2002('0x43')][_0x2002('0x57')](_0x2dead3);})['then'](function(_0x1f6799){_0x28236b[_0x2002('0x58')]=_0x1f6799;return _0x28236b;})[_0x2002('0x24')](respondWithFilteredResult(_0x293137,_0x2dead3))[_0x2002('0x59')](handleError(_0x293137,null));};exports[_0x2002('0x5a')]=function(_0x388df9,_0x2a8fcd){var _0x5095c8={'raw':![],'where':{'id':_0x388df9[_0x2002('0x5b')]['id']},'include':[{'model':db[_0x2002('0x40')],'as':_0x2002('0x41')}]},_0x365c0e={};_0x365c0e[_0x2002('0x4a')]=_[_0x2002('0x48')](db[_0x2002('0x43')]['rawAttributes']);_0x365c0e[_0x2002('0x47')]=_[_0x2002('0x48')](_0x388df9[_0x2002('0x47')]);_0x365c0e['filters']=_[_0x2002('0x5c')](_0x365c0e[_0x2002('0x4a')],_0x365c0e[_0x2002('0x47')]);_0x5095c8[_0x2002('0x4b')]=_[_0x2002('0x5c')](_0x365c0e[_0x2002('0x4a')],qs[_0x2002('0x4c')](_0x388df9['query'][_0x2002('0x4c')]));_0x5095c8['attributes']=_0x5095c8[_0x2002('0x4b')][_0x2002('0x4d')]?_0x5095c8['attributes']:_0x365c0e[_0x2002('0x4a')];if(_0x388df9[_0x2002('0x47')][_0x2002('0x55')]){_0x5095c8[_0x2002('0x56')]=[{'all':!![]}];}_0x5095c8=_[_0x2002('0x54')]({},_0x5095c8,_0x388df9[_0x2002('0x5d')]);return db['WhatsappAccount'][_0x2002('0x5e')](_0x5095c8)['then'](handleEntityNotFound(_0x2a8fcd,null))['then'](respondWithResult(_0x2a8fcd,null))[_0x2002('0x59')](handleError(_0x2a8fcd,null));};exports[_0x2002('0x5f')]=function(_0x45e538,_0x350b01){return db['WhatsappAccount']['create'](_0x45e538[_0x2002('0x60')],{})['then'](function(_0x219f40){var _0x200a29=_0x45e538['user'][_0x2002('0x39')]({'plain':!![]});if(!_0x200a29)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x200a29[_0x2002('0x61')]==='user'){var _0x207b9b=_0x219f40[_0x2002('0x39')]({'plain':!![]});var _0x1c76a6=_0x2002('0x3a');return db[_0x2002('0x62')]['find']({'where':{'name':_0x1c76a6,'userProfileId':_0x200a29[_0x2002('0x63')]},'raw':!![]})[_0x2002('0x24')](function(_0x215e4b){if(_0x215e4b&&_0x215e4b[_0x2002('0x64')]===0x0){return db[_0x2002('0x3b')]['create']({'name':_0x207b9b[_0x2002('0x3d')],'resourceId':_0x207b9b['id'],'type':_0x215e4b[_0x2002('0x3d')],'sectionId':_0x215e4b['id']},{})[_0x2002('0x24')](function(){return _0x219f40;});}else{return _0x219f40;}})[_0x2002('0x59')](function(_0x2f6ab3){logger[_0x2002('0x2a')](_0x2002('0x65'),_0x2f6ab3);throw _0x2f6ab3;});}return _0x219f40;})['then'](respondWithResult(_0x350b01,0xc9))['catch'](handleError(_0x350b01,null));};exports[_0x2002('0x37')]=function(_0x3abc45,_0x556b48){if(_0x3abc45['body']['id']){delete _0x3abc45[_0x2002('0x60')]['id'];}return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x3abc45[_0x2002('0x5b')]['id']},'include':[{'model':db[_0x2002('0x40')],'as':_0x2002('0x41')}]})[_0x2002('0x24')](handleEntityNotFound(_0x556b48,null))[_0x2002('0x24')](saveUpdates(_0x3abc45[_0x2002('0x60')],null))[_0x2002('0x24')](respondWithResult(_0x556b48,null))['catch'](handleError(_0x556b48,null));};exports[_0x2002('0x38')]=function(_0x1d83ab,_0x2ae5d2){return db[_0x2002('0x43')]['find']({'where':{'id':_0x1d83ab[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x2ae5d2,null))[_0x2002('0x24')](removeEntity(_0x2ae5d2,null))['catch'](handleError(_0x2ae5d2,null));};exports[_0x2002('0x66')]=function(_0x1ff138,_0x340354){return db['WhatsappAccount']['describe']()[_0x2002('0x24')](respondWithResult(_0x340354,null))[_0x2002('0x59')](handleError(_0x340354,null));};exports[_0x2002('0x67')]=function(_0x4f9c48,_0x37a0c2,_0x4843cd){if(_0x4f9c48[_0x2002('0x60')]['id']){delete _0x4f9c48[_0x2002('0x60')]['id'];}return db[_0x2002('0x43')]['find']({'where':{'id':_0x4f9c48[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x37a0c2,null))[_0x2002('0x24')](function(_0x79b890){if(_0x79b890){_0x4f9c48[_0x2002('0x60')]['WhatsappAccountId']=_0x79b890['id'];return db[_0x2002('0x68')]['create'](_0x4f9c48[_0x2002('0x60')]);}})[_0x2002('0x24')](respondWithResult(_0x37a0c2,null))[_0x2002('0x59')](handleError(_0x37a0c2,null));};exports[_0x2002('0x69')]=function(_0x10ca62,_0x3b59fe,_0x1b867e){var _0x218dc0={'raw':![],'where':{}};var _0x156cfd={};var _0x43ce0c={'count':0x0,'rows':[]};return db[_0x2002('0x43')]['findOne']({'where':{'id':_0x10ca62[_0x2002('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b59fe,null))[_0x2002('0x24')](function(_0x598821){if(_0x598821){_0x156cfd[_0x2002('0x4a')]=_[_0x2002('0x48')](db[_0x2002('0x68')][_0x2002('0x44')]);_0x156cfd[_0x2002('0x47')]=_[_0x2002('0x48')](_0x10ca62[_0x2002('0x47')]);_0x156cfd[_0x2002('0x49')]=_[_0x2002('0x5c')](_0x156cfd['model'],_0x156cfd[_0x2002('0x47')]);_0x218dc0['attributes']=_[_0x2002('0x5c')](_0x156cfd['model'],qs[_0x2002('0x4c')](_0x10ca62[_0x2002('0x47')][_0x2002('0x4c')]));_0x218dc0[_0x2002('0x4b')]=_0x218dc0[_0x2002('0x4b')][_0x2002('0x4d')]?_0x218dc0[_0x2002('0x4b')]:_0x156cfd[_0x2002('0x4a')];if(!_0x10ca62[_0x2002('0x47')][_0x2002('0x6a')](_0x2002('0x4e'))){_0x218dc0['limit']=qs[_0x2002('0x32')](_0x10ca62[_0x2002('0x47')]['limit']);_0x218dc0[_0x2002('0x34')]=qs[_0x2002('0x34')](_0x10ca62['query'][_0x2002('0x34')]);}_0x218dc0[_0x2002('0x6b')]=qs['sort'](_0x10ca62[_0x2002('0x47')][_0x2002('0x4f')]);_0x218dc0['where']=qs['filters'](_[_0x2002('0x51')](_0x10ca62[_0x2002('0x47')],_0x156cfd[_0x2002('0x49')]));_0x218dc0[_0x2002('0x50')][_0x2002('0x6c')]=_0x598821['id'];if(_0x10ca62['query'][_0x2002('0x53')]){_0x218dc0[_0x2002('0x50')]=_[_0x2002('0x54')](_0x218dc0[_0x2002('0x50')],{'$or':_[_0x2002('0x42')](_0x218dc0[_0x2002('0x4b')],function(_0x546b21){var _0x2a7e68={};_0x2a7e68[_0x546b21]={'$like':'%'+_0x10ca62[_0x2002('0x47')][_0x2002('0x53')]+'%'};return _0x2a7e68;})});}_0x218dc0=_[_0x2002('0x54')]({},_0x218dc0,_0x10ca62[_0x2002('0x5d')]);return db[_0x2002('0x68')][_0x2002('0x33')]({'where':_0x218dc0[_0x2002('0x50')]})[_0x2002('0x24')](function(_0x57778b){_0x43ce0c[_0x2002('0x33')]=_0x57778b;if(_0x10ca62[_0x2002('0x47')][_0x2002('0x55')]){_0x218dc0['include']=[{'all':!![]}];}return db[_0x2002('0x68')][_0x2002('0x57')](_0x218dc0);})[_0x2002('0x24')](function(_0x12b699){_0x43ce0c[_0x2002('0x58')]=_0x12b699;return _0x43ce0c;});}})[_0x2002('0x24')](respondWithFilteredResult(_0x3b59fe,_0x218dc0))['catch'](handleError(_0x3b59fe,null));};exports[_0x2002('0x6d')]=function(_0x187849,_0x11bc69,_0x26e49d){return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x187849[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x11bc69,null))['then'](function(_0x322706){if(_0x322706){return _0x322706[_0x2002('0x6d')](_0x187849[_0x2002('0x47')][_0x2002('0x6e')]);}})[_0x2002('0x24')](respondWithStatusCode(_0x11bc69,null))[_0x2002('0x59')](handleError(_0x11bc69,null));};exports[_0x2002('0x6f')]=function(_0x4b6bd9,_0x3dcf6b,_0x3c6c23){if(_0x4b6bd9[_0x2002('0x60')]['id']){delete _0x4b6bd9[_0x2002('0x60')]['id'];}return db[_0x2002('0x43')]['find']({'where':{'id':_0x4b6bd9[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x3dcf6b,null))[_0x2002('0x24')](function(_0xc1d7c){if(_0xc1d7c){_0x4b6bd9[_0x2002('0x60')][_0x2002('0x6c')]=_0xc1d7c['id'];return db[_0x2002('0x70')][_0x2002('0x5f')](_0x4b6bd9[_0x2002('0x60')]);}})[_0x2002('0x24')](respondWithResult(_0x3dcf6b,null))[_0x2002('0x59')](handleError(_0x3dcf6b,null));};exports[_0x2002('0x71')]=function(_0x384bf6,_0x4a1c55,_0x15ba59){var _0x121f01={'raw':![],'where':{}};var _0x2fcb6e={};var _0x178b13={'count':0x0,'rows':[]};return db[_0x2002('0x43')]['findOne']({'where':{'id':_0x384bf6[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x4a1c55,null))[_0x2002('0x24')](function(_0x1bf92d){if(_0x1bf92d){_0x2fcb6e[_0x2002('0x4a')]=_[_0x2002('0x48')](db[_0x2002('0x70')]['rawAttributes']);_0x2fcb6e[_0x2002('0x47')]=_['keys'](_0x384bf6[_0x2002('0x47')]);_0x2fcb6e[_0x2002('0x49')]=_[_0x2002('0x5c')](_0x2fcb6e['model'],_0x2fcb6e[_0x2002('0x47')]);_0x121f01[_0x2002('0x4b')]=_[_0x2002('0x5c')](_0x2fcb6e[_0x2002('0x4a')],qs[_0x2002('0x4c')](_0x384bf6[_0x2002('0x47')][_0x2002('0x4c')]));_0x121f01[_0x2002('0x4b')]=_0x121f01[_0x2002('0x4b')][_0x2002('0x4d')]?_0x121f01[_0x2002('0x4b')]:_0x2fcb6e[_0x2002('0x4a')];if(!_0x384bf6[_0x2002('0x47')][_0x2002('0x6a')](_0x2002('0x4e'))){_0x121f01[_0x2002('0x32')]=qs[_0x2002('0x32')](_0x384bf6[_0x2002('0x47')][_0x2002('0x32')]);_0x121f01['offset']=qs['offset'](_0x384bf6[_0x2002('0x47')][_0x2002('0x34')]);}_0x121f01[_0x2002('0x6b')]=qs['sort'](_0x384bf6[_0x2002('0x47')][_0x2002('0x4f')]);_0x121f01[_0x2002('0x50')]=qs[_0x2002('0x49')](_[_0x2002('0x51')](_0x384bf6[_0x2002('0x47')],_0x2fcb6e[_0x2002('0x49')]));_0x121f01[_0x2002('0x50')][_0x2002('0x6c')]=_0x1bf92d['id'];if(_0x384bf6[_0x2002('0x47')][_0x2002('0x53')]){_0x121f01[_0x2002('0x50')]=_[_0x2002('0x54')](_0x121f01[_0x2002('0x50')],{'$or':_[_0x2002('0x42')](_0x121f01[_0x2002('0x4b')],function(_0x2cd869){var _0x1a201b={};_0x1a201b[_0x2cd869]={'$like':'%'+_0x384bf6[_0x2002('0x47')][_0x2002('0x53')]+'%'};return _0x1a201b;})});}_0x121f01=_['merge']({},_0x121f01,_0x384bf6[_0x2002('0x5d')]);return db['CannedAnswer']['count']({'where':_0x121f01[_0x2002('0x50')]})[_0x2002('0x24')](function(_0x3ce587){_0x178b13[_0x2002('0x33')]=_0x3ce587;if(_0x384bf6['query'][_0x2002('0x55')]){_0x121f01[_0x2002('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2002('0x57')](_0x121f01);})[_0x2002('0x24')](function(_0x272ec4){_0x178b13[_0x2002('0x58')]=_0x272ec4;return _0x178b13;});}})[_0x2002('0x24')](respondWithFilteredResult(_0x4a1c55,_0x121f01))[_0x2002('0x59')](handleError(_0x4a1c55,null));};exports['removeAnswers']=function(_0x32b455,_0x4ea624,_0x1880c3){return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x32b455[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x4ea624,null))[_0x2002('0x24')](function(_0x46bc73){if(_0x46bc73){return _0x46bc73[_0x2002('0x72')](_0x32b455[_0x2002('0x47')][_0x2002('0x6e')]);}})[_0x2002('0x24')](respondWithStatusCode(_0x4ea624,null))[_0x2002('0x59')](handleError(_0x4ea624,null));};exports['addAgents']=function(_0x3dbc7c,_0x32a2af,_0x13cc6b){return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x3dbc7c[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x32a2af,null))[_0x2002('0x24')](function(_0x279937){if(_0x279937){return _0x279937[_0x2002('0x73')](_0x3dbc7c[_0x2002('0x60')][_0x2002('0x6e')],_[_0x2002('0x74')](_0x3dbc7c[_0x2002('0x60')],[_0x2002('0x6e'),'id'])||{})[_0x2002('0x75')](function(_0x1bc902){for(var _0x526a53=0x0;_0x526a53<_0x3dbc7c[_0x2002('0x60')][_0x2002('0x6e')][_0x2002('0x4d')];_0x526a53+=0x1){socket['emit'](_0x2002('0x76'),{'UserId':Number(_0x3dbc7c['body'][_0x2002('0x6e')][_0x526a53]),'WhatsappAccountId':Number(_0x3dbc7c[_0x2002('0x5b')]['id'])});}return _0x1bc902;});}})[_0x2002('0x24')](respondWithResult(_0x32a2af,null))[_0x2002('0x59')](handleError(_0x32a2af,null));};exports[_0x2002('0x77')]=function(_0x1d72be,_0xcc64f6,_0x33dac2){return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x1d72be[_0x2002('0x5b')]['id']}})['then'](handleEntityNotFound(_0xcc64f6,null))['then'](function(_0x42262d){if(_0x42262d){return _0x42262d['removeAgents'](_0x1d72be[_0x2002('0x47')][_0x2002('0x6e')])[_0x2002('0x24')](function(){if(_[_0x2002('0x78')](_0x1d72be[_0x2002('0x47')][_0x2002('0x6e')])){for(var _0x3c9c5f=0x0;_0x3c9c5f<_0x1d72be[_0x2002('0x47')]['ids'][_0x2002('0x4d')];_0x3c9c5f+=0x1){socket[_0x2002('0x79')](_0x2002('0x7a'),{'UserId':Number(_0x1d72be['query'][_0x2002('0x6e')][_0x3c9c5f]),'WhatsappAccountId':Number(_0x1d72be[_0x2002('0x5b')]['id'])});}}else{socket[_0x2002('0x79')](_0x2002('0x7a'),{'UserId':Number(_0x1d72be['query'][_0x2002('0x6e')]),'WhatsappAccountId':Number(_0x1d72be[_0x2002('0x5b')]['id'])});}});}})[_0x2002('0x24')](respondWithStatusCode(_0xcc64f6,null))[_0x2002('0x59')](handleError(_0xcc64f6,null));};exports[_0x2002('0x7b')]=function(_0x6f63e2,_0xeaeb98,_0x2b392d){var _0x3ea91f={};var _0x26d116={};var _0x36beab;var _0x5f41a0;return db[_0x2002('0x43')]['findOne']({'where':{'id':_0x6f63e2['params']['id']}})[_0x2002('0x24')](handleEntityNotFound(_0xeaeb98,null))['then'](function(_0x29fc68){if(_0x29fc68){_0x36beab=_0x29fc68;_0x26d116[_0x2002('0x4a')]=_['keys'](db['User'][_0x2002('0x44')]);_0x26d116[_0x2002('0x47')]=_['keys'](_0x6f63e2[_0x2002('0x47')]);_0x26d116[_0x2002('0x49')]=_['intersection'](_0x26d116['model'],_0x26d116[_0x2002('0x47')]);_0x3ea91f[_0x2002('0x4b')]=_[_0x2002('0x5c')](_0x26d116[_0x2002('0x4a')],qs[_0x2002('0x4c')](_0x6f63e2[_0x2002('0x47')]['fields']));_0x3ea91f[_0x2002('0x4b')]=_0x3ea91f[_0x2002('0x4b')][_0x2002('0x4d')]?_0x3ea91f[_0x2002('0x4b')]:_0x26d116[_0x2002('0x4a')];_0x3ea91f[_0x2002('0x6b')]=qs[_0x2002('0x4f')](_0x6f63e2[_0x2002('0x47')]['sort']);_0x3ea91f[_0x2002('0x50')]=qs['filters'](_[_0x2002('0x51')](_0x6f63e2[_0x2002('0x47')],_0x26d116[_0x2002('0x49')]));if(_0x6f63e2[_0x2002('0x47')]['filter']){_0x3ea91f['where']=_[_0x2002('0x54')](_0x3ea91f[_0x2002('0x50')],{'$or':_[_0x2002('0x42')](_0x3ea91f[_0x2002('0x4b')],function(_0x861476){var _0x3bbef9={};_0x3bbef9[_0x861476]={'$like':'%'+_0x6f63e2[_0x2002('0x47')][_0x2002('0x53')]+'%'};return _0x3bbef9;})});}_0x3ea91f=_[_0x2002('0x54')]({},_0x3ea91f,_0x6f63e2[_0x2002('0x5d')]);return _0x36beab['getAgents'](_0x3ea91f);}})[_0x2002('0x24')](function(_0x306ff3){if(_0x306ff3){_0x5f41a0=_0x306ff3[_0x2002('0x4d')];if(!_0x6f63e2[_0x2002('0x47')][_0x2002('0x6a')](_0x2002('0x4e'))){_0x3ea91f[_0x2002('0x32')]=qs['limit'](_0x6f63e2[_0x2002('0x47')][_0x2002('0x32')]);_0x3ea91f[_0x2002('0x34')]=qs[_0x2002('0x34')](_0x6f63e2[_0x2002('0x47')][_0x2002('0x34')]);}return _0x36beab[_0x2002('0x7b')](_0x3ea91f);}})[_0x2002('0x24')](function(_0x2f2cdc){if(_0x2f2cdc){return _0x2f2cdc?{'count':_0x5f41a0,'rows':_0x2f2cdc}:null;}})['then'](respondWithResult(_0xeaeb98,null))[_0x2002('0x59')](handleError(_0xeaeb98,null));};exports[_0x2002('0x7c')]=function(_0x47f490,_0x56d916){var _0xbf4982=_0x47f490[_0x2002('0x5b')]['id'];var _0x349753=_0x47f490[_0x2002('0x60')];var _0x458754=0xc8;var _0x180db6=null;return db[_0x2002('0x7d')][_0x2002('0x7e')]({'isolationLevel':db['sequelize'][_0x2002('0x7f')]['ISOLATION_LEVELS'][_0x2002('0x80')]},function(_0x285731){return db['WhatsappAccount'][_0x2002('0x81')]({'where':{'id':_0xbf4982},'transaction':_0x285731})[_0x2002('0x24')](function(_0x2d7e57){if(_0x2d7e57){return db[_0x2002('0x82')][_0x2002('0x38')]({'where':{'WhatsappAccountId':_0xbf4982},'transaction':_0x285731})[_0x2002('0x24')](function(){var _0x54970a=_[_0x2002('0x42')](_0x349753,function(_0x32d9f5){_0x32d9f5['WhatsappAccountId']=_0xbf4982;return _0x32d9f5;});return db[_0x2002('0x82')][_0x2002('0x83')](_0x54970a,{'transaction':_0x285731});});}else{_0x458754=0x194;_0x180db6=[];}});})[_0x2002('0x24')](function(){if(_0x458754!==0x194){return db['WhatsappApplication'][_0x2002('0x84')]({'where':{'WhatsappAccountId':_0xbf4982},'order':_0x2002('0x85')})['then'](function(_0x3ea638){_0x180db6=_0x3ea638;});}})['catch'](function(_0x40975f){_0x458754=0x1f4;logger[_0x2002('0x2a')](_0x40975f['stack']);if(_0x40975f[_0x2002('0x3d')]){delete _0x40975f['name'];}_0x180db6=_0x40975f;})[_0x2002('0x86')](function(){if(_0x180db6===null){_0x56d916['sendStatus'](_0x458754);}else{if(_0x458754===0x1f4){_0x56d916['status'](_0x458754)[_0x2002('0x3e')](_0x180db6);}else{_0x56d916[_0x2002('0x35')](_0x458754)[_0x2002('0x30')](_0x180db6);}}});};exports[_0x2002('0x87')]=function(_0x299953,_0x51cb71,_0x24e836){var _0x2258ac={};var _0x1a6176={};var _0x22fc88;var _0x5d1132;return db[_0x2002('0x43')][_0x2002('0x81')]({'where':{'id':_0x299953[_0x2002('0x5b')]['id']}})[_0x2002('0x24')](handleEntityNotFound(_0x51cb71,null))[_0x2002('0x24')](function(_0xe593ad){if(_0xe593ad){_0x22fc88=_0xe593ad;_0x1a6176[_0x2002('0x4a')]=_['keys'](db[_0x2002('0x82')][_0x2002('0x44')]);_0x1a6176[_0x2002('0x47')]=_[_0x2002('0x48')](_0x299953[_0x2002('0x47')]);_0x1a6176[_0x2002('0x49')]=_[_0x2002('0x5c')](_0x1a6176[_0x2002('0x4a')],_0x1a6176[_0x2002('0x47')]);_0x2258ac[_0x2002('0x4b')]=_['intersection'](_0x1a6176[_0x2002('0x4a')],qs[_0x2002('0x4c')](_0x299953[_0x2002('0x47')][_0x2002('0x4c')]));_0x2258ac[_0x2002('0x4b')]=_0x2258ac[_0x2002('0x4b')]['length']?_0x2258ac[_0x2002('0x4b')]:_0x1a6176['model'];_0x2258ac['order']=qs[_0x2002('0x4f')](_0x299953[_0x2002('0x47')][_0x2002('0x4f')]);_0x2258ac['where']=qs[_0x2002('0x49')](_[_0x2002('0x51')](_0x299953[_0x2002('0x47')],_0x1a6176[_0x2002('0x49')]));if(_0x299953[_0x2002('0x47')][_0x2002('0x53')]){_0x2258ac[_0x2002('0x50')]=_[_0x2002('0x54')](_0x2258ac['where'],{'$or':_[_0x2002('0x42')](_0x2258ac[_0x2002('0x4b')],function(_0xb95aa7){var _0x1bd2c0={};_0x1bd2c0[_0xb95aa7]={'$like':'%'+_0x299953[_0x2002('0x47')]['filter']+'%'};return _0x1bd2c0;})});}_0x2258ac=_[_0x2002('0x54')]({},_0x2258ac,_0x299953[_0x2002('0x5d')]);return _0x22fc88[_0x2002('0x87')](_0x2258ac);}})[_0x2002('0x24')](function(_0x4bb933){if(_0x4bb933){_0x5d1132=_0x4bb933[_0x2002('0x4d')];if(!_0x299953['query']['hasOwnProperty'](_0x2002('0x4e'))){_0x2258ac[_0x2002('0x32')]=qs['limit'](_0x299953['query']['limit']);_0x2258ac[_0x2002('0x34')]=qs[_0x2002('0x34')](_0x299953[_0x2002('0x47')][_0x2002('0x34')]);}return _0x22fc88[_0x2002('0x87')](_0x2258ac);}})[_0x2002('0x24')](function(_0x48f543){if(_0x48f543){return _0x48f543?{'count':_0x5d1132,'rows':_0x48f543}:null;}})['then'](respondWithResult(_0x51cb71,null))[_0x2002('0x59')](handleError(_0x51cb71,null));};exports[_0x2002('0x88')]=function(_0x4db1b9,_0x181b76,_0x1efcc3){var _0x5ad163={'channel':_0x2002('0x89')};var _0x187f5d=[];var _0x4cb363=[];var _0x15df8d={};return db['WhatsappAccount']['find']({'where':{'id':_0x4db1b9[_0x2002('0x5b')]['id']},'include':[{'model':db[_0x2002('0x82')],'as':_0x2002('0x8a')}]})[_0x2002('0x24')](handleEntityNotFound(_0x181b76,null))[_0x2002('0x24')](function(_0x3bb0ea){_0x5ad163['account']=_0x3bb0ea;if(_0x5ad163[_0x2002('0x8b')]&&_0x5ad163[_0x2002('0x8b')][_0x2002('0x46')]===_0x2002('0x8c')&&_0x4db1b9[_0x2002('0x60')][_0x2002('0x8d')]){if(_0x4db1b9[_0x2002('0x60')][_0x2002('0x8d')][_0x2002('0x4d')]===0x0)return;if(_0x4db1b9[_0x2002('0x60')][_0x2002('0x8d')][0x0][_0x2002('0x8e')]!==_0x2002('0x8f'))return;return db[_0x2002('0x90')][_0x2002('0x37')]({'read':!![],'readAt':_0x4db1b9['body']['statuses'][0x0][_0x2002('0x91')]},{'where':{'messageId':_0x4db1b9[_0x2002('0x60')][_0x2002('0x8d')][0x0][_0x2002('0x92')]},'individualHooks':!![]})[_0x2002('0x24')](function(_0xf73ca1){return _0x181b76[_0x2002('0x35')](0xc8)['json'](_0xf73ca1);});}_0x5ad163[_0x2002('0x93')]=_[_0x2002('0x94')](_0x3bb0ea[_0x2002('0x8a')],['priority'],[_0x2002('0x95')]);if(_0x5ad163[_0x2002('0x8b')][_0x2002('0x8a')]){delete _0x5ad163['account'][_0x2002('0x8a')];}return db[_0x2002('0x96')]['describe']()['then'](function(_0x50605b){if(!_0x50605b){throw new db[(_0x2002('0x97'))]['ValidationError'](_0x2002('0x98'));}_0x187f5d=_[_0x2002('0x99')](_[_0x2002('0x48')](_0x50605b),[_0x2002('0x9a'),_0x2002('0x9b')]);_0x4cb363=_[_0x2002('0x99')](_[_0x2002('0x48')](_0x50605b),['createdAt',_0x2002('0x9b'),_0x2002('0x9c'),_0x2002('0x9d')]);_0x5ad163[_0x2002('0x60')]={'mapKey':_0x2002('0x9e')};if(_0x5ad163['account']&&_0x5ad163[_0x2002('0x8b')][_0x2002('0x46')]===_0x2002('0x9f')){_0x5ad163['body'][_0x2002('0xa0')]=_0x4db1b9['body'][_0x2002('0xa1')][_0x2002('0xa2')]('whatsapp:','');_0x5ad163[_0x2002('0x60')][_0x2002('0x60')]=_0x4db1b9[_0x2002('0x60')][_0x2002('0xa3')];_0x5ad163[_0x2002('0x60')][_0x2002('0xa4')]=_0x4db1b9[_0x2002('0x60')][_0x2002('0xa5')];}if(_0x5ad163['account']&&_0x5ad163[_0x2002('0x8b')][_0x2002('0x46')]===_0x2002('0x8c')){_0x5ad163['body']['from']=_0x4db1b9[_0x2002('0x60')]['notifications'][0x0][_0x2002('0xa0')];_0x5ad163[_0x2002('0x60')][_0x2002('0x60')]=_0x4db1b9['body']['notifications'][0x0][_0x2002('0x2c')]['body'];_0x5ad163['body'][_0x2002('0xa4')]=_0x4db1b9[_0x2002('0x60')]['notifications'][0x0][_0x2002('0x92')];}if(_0x5ad163[_0x2002('0x60')]['id']){delete _0x5ad163[_0x2002('0x60')]['id'];}if(_[_0x2002('0xa6')](_0x5ad163[_0x2002('0x60')][_0x2002('0xa0')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x2002('0xa6')](_0x5ad163[_0x2002('0x60')][_0x2002('0x60')])||_0x5ad163['body']['body']===''){throw new db[(_0x2002('0x97'))][(_0x2002('0xa7'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2002('0xa6')](_0x5ad163[_0x2002('0x60')][_0x2002('0xa8')])){throw new db[(_0x2002('0x97'))][(_0x2002('0xa7'))](_0x2002('0xa9')+_0x4cb363);}if(!_[_0x2002('0xaa')](_0x4cb363,_0x5ad163['body'][_0x2002('0xa8')])){throw new db[(_0x2002('0x97'))][(_0x2002('0xa7'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4cb363);}_0x15df8d[_0x5ad163[_0x2002('0x60')][_0x2002('0xa8')]]=_0x5ad163['body'][_0x2002('0xa0')];return db['CmList'][_0x2002('0x5e')]({'where':{'id':_0x5ad163['account'][_0x2002('0x9d')]},'include':[{'model':db[_0x2002('0x96')],'as':_0x2002('0xab'),'where':_0x15df8d,'limit':0x1,'order':[[_0x2002('0x9b'),_0x2002('0xac')]]}]});})[_0x2002('0x24')](handleEntityNotFound(_0x181b76,null))['then'](function(_0x4dffc3){if(_0x4dffc3){_0x5ad163['list']=_[_0x2002('0x74')](_0x4dffc3,['Contacts']);if(_0x4dffc3[_0x2002('0xab')][_0x2002('0x4d')]){return _0x4dffc3[_0x2002('0xab')][0x0];}var _0x708cf2=_[_0x2002('0x1b')](_0x5ad163[_0x2002('0x60')],{'firstName':_0x5ad163['body'][_0x2002('0xa0')],'ListId':_0x4dffc3['id']});_0x708cf2[_0x5ad163[_0x2002('0x60')]['mapKey']]=_0x5ad163['body'][_0x2002('0xa0')];return db[_0x2002('0x96')]['create'](_0x708cf2,{'fields':_0x187f5d,'raw':!![]});}})[_0x2002('0x24')](handleEntityNotFound(_0x181b76,null))[_0x2002('0x24')](function(_0x37337b){if(_0x37337b){_0x5ad163[_0x2002('0xad')]=_0x37337b;var _0x1125df={'ContactId':_0x37337b['id'],'phone':_0x5ad163[_0x2002('0x60')]['from'],'WhatsappAccountId':_0x4db1b9[_0x2002('0x5b')]['id']};var _0x27c058={'ContactId':_0x37337b['id'],'WhatsappAccountId':_0x4db1b9[_0x2002('0x5b')]['id'],'closed':![]};return db[_0x2002('0xae')][_0x2002('0x5e')]({'where':_0x27c058})[_0x2002('0x24')](function(_0x2f6bec){if(_0x2f6bec){return[_0x2f6bec,![]];}return db['WhatsappInteraction'][_0x2002('0x5f')](_0x1125df)[_0x2002('0x24')](function(_0x5b625a){return[_0x5b625a,!![]];});});}})[_0x2002('0x75')](function(_0x16e951,_0x429eca){_0x5ad163['interaction']=_0x16e951[_0x2002('0x39')]({'plain':!![]});_0x5ad163[_0x2002('0xaf')][_0x2002('0xb0')]=![];if(_0x429eca){if(_0x5ad163[_0x2002('0x8b')][_0x2002('0xb1')]){_0x5ad163[_0x2002('0x93')][_0x2002('0xb2')]({'id':0x0,'priority':_0x5ad163[_0x2002('0x93')][_0x2002('0x4d')]+0x1,'app':_0x2002('0xb3'),'appdata':_0x2002('0xb4'),'interval':'*,*,*,*'});}_0x5ad163[_0x2002('0xaf')]['created']=!![];}return db['WhatsappMessage'][_0x2002('0x5f')]({'phone':_0x5ad163[_0x2002('0x60')][_0x2002('0xa0')],'messageId':_0x5ad163[_0x2002('0x60')][_0x2002('0xa4')],'body':_0x5ad163['body']['body'],'WhatsappAccountId':_0x4db1b9[_0x2002('0x5b')]['id'],'WhatsappInteractionId':_0x16e951['id'],'direction':'in','ContactId':_0x16e951[_0x2002('0xb5')],'AttachmentId':_0x5ad163['body'][_0x2002('0xb6')]});})['then'](function(_0x5d5eff){_0x5ad163[_0x2002('0x2c')]=_0x5d5eff;if(_0x5ad163[_0x2002('0xaf')]['UserId']){return db[_0x2002('0xb7')][_0x2002('0x5e')]({'attributes':['id',_0x2002('0x3d')],'where':{'id':_0x5ad163[_0x2002('0xaf')]['UserId']}})[_0x2002('0x24')](function(_0x5a69c0){if(_0x5a69c0){_0x5ad163['applications'][_0x2002('0xb8')]({'id':0x0,'priority':0x0,'app':_0x2002('0xb9'),'appdata':_0x5a69c0['name']+','+(_0x5ad163[_0x2002('0x8b')][_0x2002('0xba')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2002('0xbb'),_0x2002('0xbc'),_0x5ad163);});}return respondWithRpcPromise('Start',_0x2002('0xbc'),_0x5ad163);})['then'](function(_0x568d76){if(_0x568d76){var _0x400ab0=0xc8;var _0x29d5f0=_0x2002('0xbd');logger[_0x2002('0x2d')](_0x2002('0x28'),_0x29d5f0,_0x400ab0,_0x2002('0xbe'));logger[_0x2002('0x27')](_0x2002('0xbf'),_0x29d5f0,_0x400ab0,'entity\x20found',JSON[_0x2002('0x29')](_0x568d76));if(_0x5ad163[_0x2002('0x8b')][_0x2002('0x46')]===_0x2002('0x9f')){return _0x181b76[_0x2002('0x35')](_0x400ab0)[_0x2002('0xc0')]('Content-Type',_0x2002('0xc1'))['send'](_0x2002('0xc2'));}else{return _0x181b76[_0x2002('0x35')](_0x400ab0)[_0x2002('0x30')](_0x568d76);}}});})['catch'](handleError(_0x181b76,null));};exports['send']=function(_0x1a3400,_0x7cfc85,_0x2aa45a){var _0x328491,_0x3ae5d9,_0x4164e2;if(_[_0x2002('0xa6')](_0x1a3400[_0x2002('0x60')][_0x2002('0x60')])||_0x1a3400[_0x2002('0x60')][_0x2002('0x60')]===''){throw new db[(_0x2002('0x97'))][(_0x2002('0xa7'))](_0x2002('0xc3'));}if(_[_0x2002('0xa6')](_0x1a3400['body']['to'])){throw new db[(_0x2002('0x97'))][(_0x2002('0xa7'))](_0x2002('0xc4'));}_0x328491=_0x1a3400[_0x2002('0x60')]['to'];return db[_0x2002('0x43')][_0x2002('0x5e')]({'where':{'id':_0x1a3400['params']['id']},'include':[{'model':db['CmList'],'as':_0x2002('0xc5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x328491},'limit':0x1,'order':[[_0x2002('0x9b'),_0x2002('0xac')]]}]}]})['then'](handleEntityNotFound(_0x7cfc85,null))[_0x2002('0x24')](function(_0x38a4df){if(_0x38a4df&&_0x38a4df[_0x2002('0xc5')]){_0x3ae5d9=_0x38a4df[_0x2002('0x39')]({'plain':!![]});if(_0x3ae5d9['List']&&_0x3ae5d9[_0x2002('0xc5')][_0x2002('0xab')]['length']){return _0x3ae5d9[_0x2002('0xc5')][_0x2002('0xab')][0x0];}return db['CmContact']['create'](_[_0x2002('0x1b')](_0x1a3400['body'],{'firstName':_0x328491,'mobile':_0x328491,'phone':_0x328491,'ListId':_0x3ae5d9[_0x2002('0x9d')]}));}})['then'](handleEntityNotFound(_0x7cfc85,null))[_0x2002('0x24')](function(_0x960834){if(_0x960834){_0x4164e2=_0x960834;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x4164e2['id'],'closed':![],'WhatsappAccountId':_0x3ae5d9['id']}})[_0x2002('0x24')](function(_0xea6572){if(_0xea6572){return[_0xea6572,![]];}return db[_0x2002('0xae')]['create']({'UserId':_0x1a3400[_0x2002('0xc6')]['id'],'ContactId':_0x4164e2['id'],'WhatsappAccountId':_0x3ae5d9['id'],'phone':_0x328491,'firstMsgDirection':'out','Messages':[_['merge'](_0x1a3400['body'],{'read':![],'body':_0x1a3400[_0x2002('0x60')][_0x2002('0x60')],'phone':_0x328491,'WhatsappAccountId':_0x3ae5d9['id'],'UserId':_0x1a3400[_0x2002('0xc6')]['id'],'ContactId':_0x4164e2['id']})]},{'include':[{'model':db[_0x2002('0x90')],'as':_0x2002('0xc7')}]})[_0x2002('0x24')](function(_0x32afd5){return[_0x32afd5,!![]];});});}})[_0x2002('0x75')](function(_0x2c66f2,_0x1e8572){if(_0x1e8572){return _0x2c66f2;}return db['WhatsappMessage'][_0x2002('0x5f')](_['merge'](_0x1a3400['body'],{'read':![],'body':_0x1a3400['body'][_0x2002('0x60')],'phone':_0x328491,'WhatsappAccountId':_0x3ae5d9['id'],'WhatsappInteractionId':_0x2c66f2['id'],'UserId':_0x1a3400[_0x2002('0xc6')]['id'],'ContactId':_0x4164e2['id']}))[_0x2002('0x24')](function(_0x3fc2aa){_0x2c66f2['dataValues'][_0x2002('0xc7')]=[];_0x2c66f2['dataValues'][_0x2002('0xc7')][_0x2002('0xb2')](_0x3fc2aa[_0x2002('0xc8')]);return _0x2c66f2;});})[_0x2002('0x24')](respondWithResult(_0x7cfc85,null))[_0x2002('0x59')](handleError(_0x7cfc85,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 507e13b..6ea0b93 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 _0x3fb9=['setMaxListeners','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x502137,_0x372ad2){var _0x443ecf=function(_0x4baaad){while(--_0x4baaad){_0x502137['push'](_0x502137['shift']());}};_0x443ecf(++_0x372ad2);}(_0x3fb9,0x1be));var _0x93fb=function(_0x317582,_0x4805d6){_0x317582=_0x317582-0x0;var _0x572a79=_0x3fb9[_0x317582];return _0x572a79;};'use strict';var EventEmitter=require(_0x93fb('0x0'));var WhatsappAccount=require(_0x93fb('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x93fb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x93fb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3534df){return function(_0x31718a,_0x2bbc66,_0x53f2d4){WhatsappAccountEvents[_0x93fb('0x4')](_0x3534df+':'+_0x31718a['id'],_0x31718a);WhatsappAccountEvents[_0x93fb('0x4')](_0x3534df,_0x31718a);_0x53f2d4(null);};}for(var e in events){if(events[_0x93fb('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x93fb('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x6fae=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x13eebf,_0x5c12b4){var _0x5e05a8=function(_0x91b2f5){while(--_0x91b2f5){_0x13eebf['push'](_0x13eebf['shift']());}};_0x5e05a8(++_0x5c12b4);}(_0x6fae,0x73));var _0xe6fa=function(_0x5d9978,_0x3fb455){_0x5d9978=_0x5d9978-0x0;var _0x3e0bb4=_0x6fae[_0x5d9978];return _0x3e0bb4;};'use strict';var EventEmitter=require(_0xe6fa('0x0'));var WhatsappAccount=require(_0xe6fa('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe6fa('0x2')](0x0);var events={'afterCreate':_0xe6fa('0x3'),'afterUpdate':_0xe6fa('0x4'),'afterDestroy':_0xe6fa('0x5')};function emitEvent(_0x40dd78){return function(_0x2d2136,_0x59f12b,_0x4eca04){WhatsappAccountEvents[_0xe6fa('0x6')](_0x40dd78+':'+_0x2d2136['id'],_0x2d2136);WhatsappAccountEvents[_0xe6fa('0x6')](_0x40dd78,_0x2d2136);_0x4eca04(null);};}for(var e in events){if(events[_0xe6fa('0x7')](e)){var event=events[e];WhatsappAccount[_0xe6fa('0x8')](e,emitEvent(event));}}module[_0xe6fa('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 65f7e7a..4792a73 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 _0x2ead=['../../config/environment','exports','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x2ead,0x18a));var _0xd2ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ead[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd2ea('0x0'));var util=require(_0xd2ea('0x1'));var logger=require(_0xd2ea('0x2'))(_0xd2ea('0x3'));var moment=require(_0xd2ea('0x4'));var BPromise=require(_0xd2ea('0x5'));var rp=require(_0xd2ea('0x6'));var fs=require('fs');var path=require(_0xd2ea('0x7'));var rimraf=require(_0xd2ea('0x8'));var config=require(_0xd2ea('0x9'));var attributes=require('./whatsappAccount.attributes');module[_0xd2ea('0xa')]=function(_0x141de0,_0x38f6ed){return _0x141de0[_0xd2ea('0xb')]('WhatsappAccount',attributes,{'tableName':_0xd2ea('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd33=['define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x1e3e63,_0x5a22ba){var _0x4bd98c=function(_0x54e83d){while(--_0x54e83d){_0x1e3e63['push'](_0x1e3e63['shift']());}};_0x4bd98c(++_0x5a22ba);}(_0xdd33,0x15f));var _0x3dd3=function(_0x3a1518,_0x14604b){_0x3a1518=_0x3a1518-0x0;var _0x4c67c1=_0xdd33[_0x3a1518];return _0x4c67c1;};'use strict';var _=require(_0x3dd3('0x0'));var util=require(_0x3dd3('0x1'));var logger=require(_0x3dd3('0x2'))(_0x3dd3('0x3'));var moment=require(_0x3dd3('0x4'));var BPromise=require('bluebird');var rp=require(_0x3dd3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3dd3('0x6'));var config=require(_0x3dd3('0x7'));var attributes=require(_0x3dd3('0x8'));module['exports']=function(_0x14dd0d,_0x103d9f){return _0x14dd0d[_0x3dd3('0x9')](_0x3dd3('0xa'),attributes,{'tableName':_0x3dd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index f39cd7a..20eafa2 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 _0xc75f=['WhatsappAccount,\x20%s,\x20%s','message','catch','WhatsappAccount','find','options','raw','where','attributes','map','include','model','then','ShowWhatsappAccount','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','./whatsappAccount.socket','register','request','info','request\x20sent','stringify','error','code'];(function(_0x386bf3,_0xea13d5){var _0x589a39=function(_0x47fc23){while(--_0x47fc23){_0x386bf3['push'](_0x386bf3['shift']());}};_0x589a39(++_0xea13d5);}(_0xc75f,0xb8));var _0xfc75=function(_0x15e82c,_0x202b4c){_0x15e82c=_0x15e82c-0x0;var _0x505d95=_0xc75f[_0x15e82c];return _0x505d95;};'use strict';var _=require(_0xfc75('0x0'));var util=require('util');var moment=require(_0xfc75('0x1'));var BPromise=require(_0xfc75('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc75('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc75('0x4'));var logger=require(_0xfc75('0x5'))(_0xfc75('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc75('0x7')][_0xfc75('0x8')]({'port':0x232a});config['redis']=_[_0xfc75('0x9')](config[_0xfc75('0xa')],{'host':_0xfc75('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfc75('0xc'))[_0xfc75('0xd')](socket);function respondWithRpcPromise(_0x42952e,_0x290588,_0x32cbe1){return new BPromise(function(_0x168557,_0x8d2069){return client[_0xfc75('0xe')](_0x42952e,_0x32cbe1)['then'](function(_0x145193){logger[_0xfc75('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x290588,_0xfc75('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x290588,_0xfc75('0x10'),JSON[_0xfc75('0x11')](_0x145193));if(_0x145193[_0xfc75('0x12')]){if(_0x145193[_0xfc75('0x12')][_0xfc75('0x13')]===0x1f4){logger[_0xfc75('0x12')](_0xfc75('0x14'),_0x290588,_0x145193[_0xfc75('0x12')][_0xfc75('0x15')]);return _0x8d2069(_0x145193[_0xfc75('0x12')][_0xfc75('0x15')]);}logger[_0xfc75('0x12')](_0xfc75('0x14'),_0x290588,_0x145193[_0xfc75('0x12')][_0xfc75('0x15')]);return _0x168557(_0x145193[_0xfc75('0x12')][_0xfc75('0x15')]);}else{logger[_0xfc75('0xf')](_0xfc75('0x14'),_0x290588,_0xfc75('0x10'));_0x168557(_0x145193['result'][_0xfc75('0x15')]);}})[_0xfc75('0x16')](function(_0x42f712){logger[_0xfc75('0x12')](_0xfc75('0x14'),_0x290588,_0x42f712);_0x8d2069(_0x42f712);});});}exports['ShowWhatsappAccount']=function(_0x3a5740){var _0x347ed4=this;return new Promise(function(_0x46adca,_0x4d1c75){return db[_0xfc75('0x17')][_0xfc75('0x18')]({'raw':_0x3a5740[_0xfc75('0x19')]?_0x3a5740[_0xfc75('0x19')][_0xfc75('0x1a')]===undefined?!![]:![]:!![],'where':_0x3a5740['options']?_0x3a5740[_0xfc75('0x19')][_0xfc75('0x1b')]||null:null,'attributes':_0x3a5740[_0xfc75('0x19')]?_0x3a5740['options'][_0xfc75('0x1c')]||null:null,'include':_0x3a5740[_0xfc75('0x19')]?_0x3a5740['options']['include']?_[_0xfc75('0x1d')](_0x3a5740[_0xfc75('0x19')][_0xfc75('0x1e')],function(_0x46ffbe){return{'model':db[_0x46ffbe[_0xfc75('0x1f')]],'as':_0x46ffbe['as'],'attributes':_0x46ffbe[_0xfc75('0x1c')],'include':_0x46ffbe[_0xfc75('0x1e')]?_[_0xfc75('0x1d')](_0x46ffbe[_0xfc75('0x1e')],function(_0x319b6a){return{'model':db[_0x319b6a[_0xfc75('0x1f')]],'as':_0x319b6a['as'],'attributes':_0x319b6a[_0xfc75('0x1c')],'include':_0x319b6a['include']?_[_0xfc75('0x1d')](_0x319b6a['include'],function(_0xc73ac8){return{'model':db[_0xc73ac8[_0xfc75('0x1f')]],'as':_0xc73ac8['as'],'attributes':_0xc73ac8[_0xfc75('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfc75('0x20')](function(_0x2ae0fe){logger[_0xfc75('0xf')](_0xfc75('0x21'),_0x3a5740);logger['debug'](_0xfc75('0x21'),_0x3a5740,JSON[_0xfc75('0x11')](_0x2ae0fe));_0x46adca(_0x2ae0fe);})['catch'](function(_0xe3d8a7){logger['error'](_0xfc75('0x21'),_0xe3d8a7[_0xfc75('0x15')],_0x3a5740);_0x4d1c75(_0x347ed4[_0xfc75('0x12')](0x1f4,_0xe3d8a7[_0xfc75('0x15')]));});});}; \ No newline at end of file +var _0x5612=['code','WhatsappAccount,\x20%s,\x20%s','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x248ac0,_0x14f3bf){var _0x5dd8ad=function(_0x521599){while(--_0x521599){_0x248ac0['push'](_0x248ac0['shift']());}};_0x5dd8ad(++_0x14f3bf);}(_0x5612,0x149));var _0x2561=function(_0x3550c3,_0x6b3eb1){_0x3550c3=_0x3550c3-0x0;var _0x4b7418=_0x5612[_0x3550c3];return _0x4b7418;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var moment=require(_0x2561('0x1'));var BPromise=require(_0x2561('0x2'));var rs=require(_0x2561('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2561('0x4'))['db'];var utils=require(_0x2561('0x5'));var logger=require(_0x2561('0x6'))(_0x2561('0x7'));var config=require('../../config/environment');var jayson=require(_0x2561('0x8'));var client=jayson[_0x2561('0x9')][_0x2561('0xa')]({'port':0x232a});config[_0x2561('0xb')]=_['defaults'](config[_0x2561('0xb')],{'host':_0x2561('0xc'),'port':0x18eb});var socket=require(_0x2561('0xd'))(new Redis(config[_0x2561('0xb')]));require(_0x2561('0xe'))[_0x2561('0xf')](socket);function respondWithRpcPromise(_0x4973ec,_0x1dfa41,_0x3526cf){return new BPromise(function(_0x1644c9,_0x4b1e05){return client[_0x2561('0x10')](_0x4973ec,_0x3526cf)['then'](function(_0x1b2f57){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1dfa41,_0x2561('0x11'));logger[_0x2561('0x12')](_0x2561('0x13'),_0x1dfa41,_0x2561('0x11'),JSON[_0x2561('0x14')](_0x1b2f57));if(_0x1b2f57[_0x2561('0x15')]){if(_0x1b2f57[_0x2561('0x15')][_0x2561('0x16')]===0x1f4){logger['error'](_0x2561('0x17'),_0x1dfa41,_0x1b2f57[_0x2561('0x15')][_0x2561('0x18')]);return _0x4b1e05(_0x1b2f57[_0x2561('0x15')][_0x2561('0x18')]);}logger[_0x2561('0x15')](_0x2561('0x17'),_0x1dfa41,_0x1b2f57[_0x2561('0x15')]['message']);return _0x1644c9(_0x1b2f57[_0x2561('0x15')]['message']);}else{logger[_0x2561('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x1dfa41,_0x2561('0x11'));_0x1644c9(_0x1b2f57[_0x2561('0x1a')][_0x2561('0x18')]);}})[_0x2561('0x1b')](function(_0x2fb9e9){logger[_0x2561('0x15')](_0x2561('0x17'),_0x1dfa41,_0x2fb9e9);_0x4b1e05(_0x2fb9e9);});});}exports[_0x2561('0x1c')]=function(_0x4c0565){var _0x3211db=this;return new Promise(function(_0x79bbb7,_0x59c824){return db[_0x2561('0x1d')][_0x2561('0x1e')]({'raw':_0x4c0565[_0x2561('0x1f')]?_0x4c0565[_0x2561('0x1f')][_0x2561('0x20')]===undefined?!![]:![]:!![],'where':_0x4c0565['options']?_0x4c0565[_0x2561('0x1f')][_0x2561('0x21')]||null:null,'attributes':_0x4c0565[_0x2561('0x1f')]?_0x4c0565[_0x2561('0x1f')][_0x2561('0x22')]||null:null,'include':_0x4c0565[_0x2561('0x1f')]?_0x4c0565[_0x2561('0x1f')][_0x2561('0x23')]?_['map'](_0x4c0565[_0x2561('0x1f')]['include'],function(_0x399860){return{'model':db[_0x399860['model']],'as':_0x399860['as'],'attributes':_0x399860['attributes'],'include':_0x399860[_0x2561('0x23')]?_[_0x2561('0x24')](_0x399860['include'],function(_0x4d6c49){return{'model':db[_0x4d6c49[_0x2561('0x25')]],'as':_0x4d6c49['as'],'attributes':_0x4d6c49[_0x2561('0x22')],'include':_0x4d6c49[_0x2561('0x23')]?_[_0x2561('0x24')](_0x4d6c49[_0x2561('0x23')],function(_0x3b6a41){return{'model':db[_0x3b6a41[_0x2561('0x25')]],'as':_0x3b6a41['as'],'attributes':_0x3b6a41[_0x2561('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2561('0x26')](function(_0x46c276){logger[_0x2561('0x19')](_0x2561('0x1c'),_0x4c0565);logger[_0x2561('0x12')](_0x2561('0x1c'),_0x4c0565,JSON[_0x2561('0x14')](_0x46c276));_0x79bbb7(_0x46c276);})['catch'](function(_0xae7bc6){logger[_0x2561('0x15')](_0x2561('0x1c'),_0xae7bc6[_0x2561('0x18')],_0x4c0565);_0x59c824(_0x3211db[_0x2561('0x15')](0x1f4,_0xae7bc6[_0x2561('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3fa096c..62a1c6e 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 _0xdb90=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','removeListener','register'];(function(_0x91a5e4,_0x5af9a2){var _0x5b4aaf=function(_0x555674){while(--_0x555674){_0x91a5e4['push'](_0x91a5e4['shift']());}};_0x5b4aaf(++_0x5af9a2);}(_0xdb90,0x14a));var _0x0db9=function(_0x67cfa6,_0x528438){_0x67cfa6=_0x67cfa6-0x0;var _0x529112=_0xdb90[_0x67cfa6];return _0x529112;};'use strict';var WhatsappAccountEvents=require(_0x0db9('0x0'));var events=[_0x0db9('0x1'),_0x0db9('0x2'),_0x0db9('0x3')];function createListener(_0x3d5293,_0x250c99){return function(_0x5ce250){_0x250c99['emit'](_0x3d5293,_0x5ce250);};}function removeListener(_0x17e2f1,_0x2287ff){return function(){WhatsappAccountEvents[_0x0db9('0x4')](_0x17e2f1,_0x2287ff);};}exports[_0x0db9('0x5')]=function(_0x14cc32){for(var _0x165ef1=0x0,_0x45b600=events[_0x0db9('0x6')];_0x165ef1<_0x45b600;_0x165ef1++){var _0xd93d5a=events[_0x165ef1];var _0x3fedf8=createListener(_0x0db9('0x7')+_0xd93d5a,_0x14cc32);WhatsappAccountEvents['on'](_0xd93d5a,_0x3fedf8);}}; \ No newline at end of file +var _0x9b82=['removeListener','register','length','./whatsappAccount.events','save','remove','update','emit'];(function(_0x284b0c,_0x2dbcd8){var _0x2e48ea=function(_0x5028be){while(--_0x5028be){_0x284b0c['push'](_0x284b0c['shift']());}};_0x2e48ea(++_0x2dbcd8);}(_0x9b82,0x153));var _0x29b8=function(_0x5dedb9,_0x22498e){_0x5dedb9=_0x5dedb9-0x0;var _0x531b86=_0x9b82[_0x5dedb9];return _0x531b86;};'use strict';var WhatsappAccountEvents=require(_0x29b8('0x0'));var events=[_0x29b8('0x1'),_0x29b8('0x2'),_0x29b8('0x3')];function createListener(_0x2e52f8,_0x12a120){return function(_0x371bf3){_0x12a120[_0x29b8('0x4')](_0x2e52f8,_0x371bf3);};}function removeListener(_0x49a70b,_0xb4975a){return function(){WhatsappAccountEvents[_0x29b8('0x5')](_0x49a70b,_0xb4975a);};}exports[_0x29b8('0x6')]=function(_0x6b9d9a){for(var _0x27bec0=0x0,_0x21cf01=events[_0x29b8('0x7')];_0x27bec0<_0x21cf01;_0x27bec0++){var _0x1c503c=events[_0x27bec0];var _0x3c5894=createListener('whatsappAccount:'+_0x1c503c,_0x6b9d9a);WhatsappAccountEvents['on'](_0x1c503c,_0x3c5894);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 9ab1274..f70d8e8 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 _0x59d0=['show','post','create','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x1f899c,_0x351176){var _0x331a96=function(_0x4cd5ad){while(--_0x4cd5ad){_0x1f899c['push'](_0x1f899c['shift']());}};_0x331a96(++_0x351176);}(_0x59d0,0x196));var _0x059d=function(_0x5ddb3a,_0x46b3ec){_0x5ddb3a=_0x5ddb3a-0x0;var _0x137021=_0x59d0[_0x5ddb3a];return _0x137021;};'use strict';var multer=require('multer');var util=require(_0x059d('0x0'));var path=require(_0x059d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x059d('0x2'));var auth=require(_0x059d('0x3'));var interaction=require(_0x059d('0x4'));var config=require(_0x059d('0x5'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x059d('0x6')](),controller[_0x059d('0x7')]);router[_0x059d('0x8')](_0x059d('0x9'),auth[_0x059d('0x6')](),controller[_0x059d('0xa')]);router[_0x059d('0xb')]('/',auth[_0x059d('0x6')](),controller[_0x059d('0xc')]);router['put'](_0x059d('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x059d('0xd')](_0x059d('0x9'),auth['isAuthenticated'](),controller[_0x059d('0xe')]);module[_0x059d('0xf')]=router; \ No newline at end of file +var _0xda59=['show','post','create','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','isAuthenticated'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda59,0x185));var _0x9da5=function(_0x1ee7bf,_0xd36273){_0x1ee7bf=_0x1ee7bf-0x0;var _0x30ed8e=_0xda59[_0x1ee7bf];return _0x30ed8e;};'use strict';var multer=require(_0x9da5('0x0'));var util=require('util');var path=require(_0x9da5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da5('0x2'));var router=express['Router']();var fs_extra=require(_0x9da5('0x3'));var auth=require(_0x9da5('0x4'));var interaction=require(_0x9da5('0x5'));var config=require(_0x9da5('0x6'));var controller=require(_0x9da5('0x7'));router[_0x9da5('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9da5('0x8')](_0x9da5('0x9'),auth[_0x9da5('0xa')](),controller[_0x9da5('0xb')]);router[_0x9da5('0xc')]('/',auth[_0x9da5('0xa')](),controller[_0x9da5('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9da5('0xe')]);router['delete'](_0x9da5('0x9'),auth[_0x9da5('0xa')](),controller['destroy']);module[_0x9da5('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index edba523..df0cb6d 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 _0x268d=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xfc0451,_0x39180e){var _0x3e39e5=function(_0x538c07){while(--_0x538c07){_0xfc0451['push'](_0xfc0451['shift']());}};_0x3e39e5(++_0x39180e);}(_0x268d,0x117));var _0xd268=function(_0xc6792e,_0x2e77c4){_0xc6792e=_0xc6792e-0x0;var _0x5a0717=_0x268d[_0xc6792e];return _0x5a0717;};'use strict';var Sequelize=require('sequelize');module[_0xd268('0x0')]={'priority':{'type':Sequelize[_0xd268('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd268('0x2')],'allowNull':![],'defaultValue':_0xd268('0x3')},'appdata':{'type':Sequelize[_0xd268('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd268('0x2')],'defaultValue':_0xd268('0x5')}}; \ No newline at end of file +var _0xf750=['STRING','noop','TEXT','*,*,*,*','exports'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xf750,0x117));var _0x0f75=function(_0xbc6566,_0x32d463){_0xbc6566=_0xbc6566-0x0;var _0x4ed128=_0xf750[_0xbc6566];return _0x4ed128;};'use strict';var Sequelize=require('sequelize');module[_0x0f75('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0f75('0x1')],'allowNull':![],'defaultValue':_0x0f75('0x2')},'appdata':{'type':Sequelize[_0x0f75('0x3')]()},'description':{'type':Sequelize[_0x0f75('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0f75('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bd801d5..0fdabed 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 _0x5232=['includeAll','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','include','WhatsappApplication','findAll','show','params'];(function(_0x544b58,_0x205040){var _0x203b81=function(_0x2d91f4){while(--_0x2d91f4){_0x544b58['push'](_0x544b58['shift']());}};_0x203b81(++_0x205040);}(_0x5232,0x1c9));var _0x2523=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x5232[_0x4704dc];return _0x254d81;};'use strict';var emlformat=require(_0x2523('0x0'));var rimraf=require(_0x2523('0x1'));var zipdir=require(_0x2523('0x2'));var jsonpatch=require(_0x2523('0x3'));var rp=require(_0x2523('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2523('0x5'));var util=require(_0x2523('0x6'));var path=require('path');var sox=require(_0x2523('0x7'));var csv=require(_0x2523('0x8'));var ejs=require(_0x2523('0x9'));var fs=require('fs');var fs_extra=require(_0x2523('0xa'));var _=require(_0x2523('0xb'));var squel=require(_0x2523('0xc'));var crypto=require(_0x2523('0xd'));var jsforce=require(_0x2523('0xe'));var deskjs=require(_0x2523('0xf'));var toCsv=require(_0x2523('0x8'));var querystring=require(_0x2523('0x10'));var Papa=require(_0x2523('0x11'));var Redis=require('ioredis');var authService=require(_0x2523('0x12'));var qs=require(_0x2523('0x13'));var as=require(_0x2523('0x14'));var hardwareService=require(_0x2523('0x15'));var logger=require(_0x2523('0x16'))(_0x2523('0x17'));var utils=require('../../config/utils');var config=require(_0x2523('0x18'));var licenseUtil=require(_0x2523('0x19'));var db=require(_0x2523('0x1a'))['db'];function respondWithStatusCode(_0x99685a,_0x5176d5){_0x5176d5=_0x5176d5||0xcc;return function(_0x37f270){if(_0x37f270){return _0x99685a[_0x2523('0x1b')](_0x5176d5);}return _0x99685a['status'](_0x5176d5)[_0x2523('0x1c')]();};}function respondWithResult(_0x2cd6e1,_0xc9898b){_0xc9898b=_0xc9898b||0xc8;return function(_0xc09a01){if(_0xc09a01){return _0x2cd6e1['status'](_0xc9898b)[_0x2523('0x1d')](_0xc09a01);}};}function respondWithFilteredResult(_0x5974a6,_0x3f9b51){return function(_0x1ac5d3){if(_0x1ac5d3){var _0x173218=typeof _0x3f9b51[_0x2523('0x1e')]==='undefined'&&typeof _0x3f9b51[_0x2523('0x1f')]===_0x2523('0x20');var _0x108159=_0x1ac5d3[_0x2523('0x21')];var _0x1ce828=_0x173218?0x0:_0x3f9b51[_0x2523('0x1e')];var _0x4f2a85=_0x173218?_0x1ac5d3[_0x2523('0x21')]:_0x3f9b51[_0x2523('0x1e')]+_0x3f9b51['limit'];var _0x2819aa;if(_0x4f2a85>=_0x108159){_0x4f2a85=_0x108159;_0x2819aa=0xc8;}else{_0x2819aa=0xce;}_0x5974a6[_0x2523('0x22')](_0x2819aa);return _0x5974a6[_0x2523('0x23')](_0x2523('0x24'),_0x1ce828+'-'+_0x4f2a85+'/'+_0x108159)['json'](_0x1ac5d3);}return null;};}function patchUpdates(_0x4f94c9){return function(_0x4e9498){try{jsonpatch['apply'](_0x4e9498,_0x4f94c9,!![]);}catch(_0x1d52dc){return BPromise[_0x2523('0x25')](_0x1d52dc);}return _0x4e9498[_0x2523('0x26')]();};}function saveUpdates(_0x3baae5,_0x1c39d8){return function(_0x578a83){if(_0x578a83){return _0x578a83['update'](_0x3baae5)['then'](function(_0x50e34e){return _0x50e34e;});}return null;};}function removeEntity(_0x14a685,_0x4847c1){return function(_0x4fc304){if(_0x4fc304){return _0x4fc304['destroy']()[_0x2523('0x27')](function(){_0x14a685[_0x2523('0x22')](0xcc)[_0x2523('0x1c')]();});}};}function handleEntityNotFound(_0x393956,_0xd47858){return function(_0x5495f4){if(!_0x5495f4){_0x393956[_0x2523('0x1b')](0x194);}return _0x5495f4;};}function handleError(_0x45366f,_0x3a8b48){_0x3a8b48=_0x3a8b48||0x1f4;return function(_0x1a8b0c){logger[_0x2523('0x28')](_0x1a8b0c[_0x2523('0x29')]);if(_0x1a8b0c[_0x2523('0x2a')]){delete _0x1a8b0c[_0x2523('0x2a')];}_0x45366f[_0x2523('0x22')](_0x3a8b48)['send'](_0x1a8b0c);};}exports[_0x2523('0x2b')]=function(_0x1565a8,_0x53b772){var _0x304dd4={},_0x52b25d={},_0x4cb11f={'count':0x0,'rows':[]};var _0x5e0ada=_[_0x2523('0x2c')](db['WhatsappApplication'][_0x2523('0x2d')],function(_0x577c90){return{'name':_0x577c90[_0x2523('0x2e')],'type':_0x577c90[_0x2523('0x2f')]['key']};});_0x52b25d[_0x2523('0x30')]=_['map'](_0x5e0ada,_0x2523('0x2a'));_0x52b25d[_0x2523('0x31')]=_[_0x2523('0x32')](_0x1565a8[_0x2523('0x31')]);_0x52b25d[_0x2523('0x33')]=_[_0x2523('0x34')](_0x52b25d['model'],_0x52b25d[_0x2523('0x31')]);_0x304dd4[_0x2523('0x35')]=_[_0x2523('0x34')](_0x52b25d['model'],qs[_0x2523('0x36')](_0x1565a8['query'][_0x2523('0x36')]));_0x304dd4[_0x2523('0x35')]=_0x304dd4[_0x2523('0x35')][_0x2523('0x37')]?_0x304dd4[_0x2523('0x35')]:_0x52b25d[_0x2523('0x30')];if(!_0x1565a8[_0x2523('0x31')]['hasOwnProperty'](_0x2523('0x38'))){_0x304dd4[_0x2523('0x1f')]=qs[_0x2523('0x1f')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1f')]);_0x304dd4['offset']=qs[_0x2523('0x1e')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1e')]);}_0x304dd4[_0x2523('0x39')]=qs['sort'](_0x1565a8[_0x2523('0x31')]['sort']);_0x304dd4[_0x2523('0x3a')]=qs['filters'](_[_0x2523('0x3b')](_0x1565a8[_0x2523('0x31')],_0x52b25d[_0x2523('0x33')]),_0x5e0ada);if(_0x1565a8[_0x2523('0x31')][_0x2523('0x3c')]){_0x304dd4[_0x2523('0x3a')]=_[_0x2523('0x3d')](_0x304dd4[_0x2523('0x3a')],{'$or':_['map'](_0x5e0ada,function(_0x24aea8){if(_0x24aea8[_0x2523('0x2f')]!==_0x2523('0x3e')){var _0x2cd540={};_0x2cd540[_0x24aea8[_0x2523('0x2a')]]={'$like':'%'+_0x1565a8['query'][_0x2523('0x3c')]+'%'};return _0x2cd540;}})});}_0x304dd4=_[_0x2523('0x3d')]({},_0x304dd4,_0x1565a8['options']);var _0x4a5171={'where':_0x304dd4[_0x2523('0x3a')]};return db['WhatsappApplication'][_0x2523('0x21')](_0x4a5171)[_0x2523('0x27')](function(_0x200a6d){_0x4cb11f[_0x2523('0x21')]=_0x200a6d;if(_0x1565a8['query']['includeAll']){_0x304dd4[_0x2523('0x3f')]=[{'all':!![]}];}return db[_0x2523('0x40')][_0x2523('0x41')](_0x304dd4);})[_0x2523('0x27')](function(_0x14104c){_0x4cb11f['rows']=_0x14104c;return _0x4cb11f;})['then'](respondWithFilteredResult(_0x53b772,_0x304dd4))['catch'](handleError(_0x53b772,null));};exports[_0x2523('0x42')]=function(_0x19f453,_0xceff81){var _0x574e6e={'raw':!![],'where':{'id':_0x19f453[_0x2523('0x43')]['id']}},_0x24e0e1={};_0x24e0e1['model']=_[_0x2523('0x32')](db[_0x2523('0x40')][_0x2523('0x2d')]);_0x24e0e1[_0x2523('0x31')]=_[_0x2523('0x32')](_0x19f453['query']);_0x24e0e1[_0x2523('0x33')]=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],_0x24e0e1[_0x2523('0x31')]);_0x574e6e['attributes']=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],qs[_0x2523('0x36')](_0x19f453[_0x2523('0x31')]['fields']));_0x574e6e['attributes']=_0x574e6e[_0x2523('0x35')]['length']?_0x574e6e[_0x2523('0x35')]:_0x24e0e1[_0x2523('0x30')];if(_0x19f453[_0x2523('0x31')][_0x2523('0x44')]){_0x574e6e[_0x2523('0x3f')]=[{'all':!![]}];}_0x574e6e=_['merge']({},_0x574e6e,_0x19f453[_0x2523('0x45')]);return db[_0x2523('0x40')]['find'](_0x574e6e)[_0x2523('0x27')](handleEntityNotFound(_0xceff81,null))[_0x2523('0x27')](respondWithResult(_0xceff81,null))[_0x2523('0x46')](handleError(_0xceff81,null));};exports['create']=function(_0x337993,_0x1a1268){return db[_0x2523('0x40')][_0x2523('0x47')](_0x337993[_0x2523('0x48')],{})['then'](respondWithResult(_0x1a1268,0xc9))[_0x2523('0x46')](handleError(_0x1a1268,null));};exports[_0x2523('0x49')]=function(_0x4d0727,_0x569caa){if(_0x4d0727['body']['id']){delete _0x4d0727['body']['id'];}return db[_0x2523('0x40')][_0x2523('0x4a')]({'where':{'id':_0x4d0727[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x569caa,null))[_0x2523('0x27')](saveUpdates(_0x4d0727[_0x2523('0x48')],null))[_0x2523('0x27')](respondWithResult(_0x569caa,null))['catch'](handleError(_0x569caa,null));};exports['destroy']=function(_0x5ec3e2,_0x66d07c){return db[_0x2523('0x40')]['find']({'where':{'id':_0x5ec3e2[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x66d07c,null))[_0x2523('0x27')](removeEntity(_0x66d07c,null))['catch'](handleError(_0x66d07c,null));}; \ No newline at end of file +var _0x14a0=['moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1ea0e4,_0x28ea81){var _0x5993ca=function(_0x490d3f){while(--_0x490d3f){_0x1ea0e4['push'](_0x1ea0e4['shift']());}};_0x5993ca(++_0x28ea81);}(_0x14a0,0x8e));var _0x014a=function(_0x45f0c3,_0x3c5a8e){_0x45f0c3=_0x45f0c3-0x0;var _0x30eb89=_0x14a0[_0x45f0c3];return _0x30eb89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['WhatsappApplication'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['WhatsappApplication'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b3a3cde..969a7b3 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 _0x79a8=['request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','lodash','../../config/logger','api','moment'];(function(_0x18ff0c,_0x2e9948){var _0x1174f0=function(_0x3a5095){while(--_0x3a5095){_0x18ff0c['push'](_0x18ff0c['shift']());}};_0x1174f0(++_0x2e9948);}(_0x79a8,0x1d0));var _0x879a=function(_0x4d8b8e,_0x12fb10){_0x4d8b8e=_0x4d8b8e-0x0;var _0x3103ba=_0x79a8[_0x4d8b8e];return _0x3103ba;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var logger=require(_0x879a('0x1'))(_0x879a('0x2'));var moment=require(_0x879a('0x3'));var BPromise=require('bluebird');var rp=require(_0x879a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var attributes=require(_0x879a('0x7'));module[_0x879a('0x8')]=function(_0x1808f1,_0x3cb89c){return _0x1808f1[_0x879a('0x9')](_0x879a('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x879a('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x21d1=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x21d1,0x1c9));var _0x121d=function(_0x551344,_0x34e9b3){_0x551344=_0x551344-0x0;var _0x34e26d=_0x21d1[_0x551344];return _0x34e26d;};'use strict';var _=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var logger=require(_0x121d('0x2'))(_0x121d('0x3'));var moment=require(_0x121d('0x4'));var BPromise=require(_0x121d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var attributes=require(_0x121d('0x8'));module[_0x121d('0x9')]=function(_0x2f3987,_0x4c47ee){return _0x2f3987[_0x121d('0xa')](_0x121d('0xb'),attributes,{'tableName':_0x121d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x121d('0xd'),'collate':_0x121d('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2b6a880..98a9acf 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','WhatsappApplication,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x4aaee5,_0x2c3aa6){var _0x2aa2f8=function(_0x5e32da){while(--_0x5e32da){_0x4aaee5['push'](_0x4aaee5['shift']());}};_0x2aa2f8(++_0x2c3aa6);}(_0x3e74,0x175));var _0x43e7=function(_0xd69719,_0x35dcd2){_0xd69719=_0xd69719-0x0;var _0x167fd7=_0x3e74[_0xd69719];return _0x167fd7;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x98a8=['request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x545d69,_0x227550){var _0x411d07=function(_0x3537a1){while(--_0x3537a1){_0x545d69['push'](_0x545d69['shift']());}};_0x411d07(++_0x227550);}(_0x98a8,0x12c));var _0x898a=function(_0xb92fc6,_0x51b68f){_0xb92fc6=_0xb92fc6-0x0;var _0x57dbf8=_0x98a8[_0xb92fc6];return _0x57dbf8;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aadc2,_0x564583,_0xfa8c50){return new BPromise(function(_0x4fbce5,_0x42021d){return client[_0x898a('0xc')](_0x3aadc2,_0xfa8c50)[_0x898a('0xd')](function(_0x96b636){logger[_0x898a('0xe')](_0x898a('0xf'),_0x564583,_0x898a('0x10'));logger[_0x898a('0x11')](_0x898a('0x12'),_0x564583,'request\x20sent',JSON[_0x898a('0x13')](_0x96b636));if(_0x96b636['error']){if(_0x96b636[_0x898a('0x14')]['code']===0x1f4){logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')]['message']);return _0x42021d(_0x96b636['error']['message']);}logger[_0x898a('0x14')](_0x898a('0xf'),_0x564583,_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);return _0x4fbce5(_0x96b636[_0x898a('0x14')][_0x898a('0x15')]);}else{logger['info'](_0x898a('0xf'),_0x564583,'request\x20sent');_0x4fbce5(_0x96b636[_0x898a('0x16')]['message']);}})[_0x898a('0x17')](function(_0x4fb05b){logger[_0x898a('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x564583,_0x4fb05b);_0x42021d(_0x4fb05b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f4961b9..56329f2 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 _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0xa1f6[_0x5e238b];return _0x389bea;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x4c60=['update','delete','destroy','/:id/tags','multer','util','path','connect-timeout','Router','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0x4c60,0xc1));var _0x04c6=function(_0x486c74,_0x1c10bc){_0x486c74=_0x486c74-0x0;var _0x406124=_0x4c60[_0x486c74];return _0x406124;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['get'](_0x04c6('0xd'),auth[_0x04c6('0x7')](),controller['download']);router[_0x04c6('0xe')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0xf')]);router[_0x04c6('0xe')]('/:id/messages',auth[_0x04c6('0x7')](),controller[_0x04c6('0x10')]);router[_0x04c6('0xe')]('/:id/tags',auth[_0x04c6('0x7')](),interaction[_0x04c6('0x11')](_0x04c6('0x12'),_0x04c6('0x13')),controller[_0x04c6('0x14')]);router[_0x04c6('0x15')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),interaction['tracked'](_0x04c6('0x12'),_0x04c6('0x16')),controller[_0x04c6('0x17')]);router[_0x04c6('0x18')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),interaction[_0x04c6('0x11')](_0x04c6('0x12'),'whatsappinteraction:destroy'),controller[_0x04c6('0x19')]);router[_0x04c6('0x18')](_0x04c6('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d6413cd..0101ae4 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 _0x6379=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x5476fd,_0x481a11){var _0x34f57f=function(_0x4aeb04){while(--_0x4aeb04){_0x5476fd['push'](_0x5476fd['shift']());}};_0x34f57f(++_0x481a11);}(_0x6379,0x84));var _0x9637=function(_0x123e6f,_0x3a0ccb){_0x123e6f=_0x123e6f-0x0;var _0x2e0627=_0x6379[_0x123e6f];return _0x2e0627;};'use strict';var Sequelize=require(_0x9637('0x0'));var moment=require(_0x9637('0x1'));module[_0x9637('0x2')]={'closed':{'type':Sequelize[_0x9637('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9637('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9637('0x5')]},'thirdDisposition':{'type':Sequelize[_0x9637('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9637('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9637('0x6')]('in',_0x9637('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9637('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9637('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x45d1=['DATE','STRING','ENUM','out','sequelize','moment','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x45d1,0x1cb));var _0x145d=function(_0xdeffe6,_0x198150){_0xdeffe6=_0xdeffe6-0x0;var _0x5baeb=_0x45d1[_0xdeffe6];return _0x5baeb;};'use strict';var Sequelize=require(_0x145d('0x0'));var moment=require(_0x145d('0x1'));module['exports']={'closed':{'type':Sequelize[_0x145d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x145d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x145d('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x145d('0x4')]},'phone':{'type':Sequelize[_0x145d('0x4')]},'read1stAt':{'type':Sequelize[_0x145d('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x145d('0x5')]('in',_0x145d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x145d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x145d('0x5')]('in',_0x145d('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x145d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index aeea296..7de8371 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 _0x9bdb=['c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','WhatsappMessage','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','fullname','get','mkdirSync','Account','N.A.','closedAt','basename','existsSync','createReadStream','pipe','out','System','lastName','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','WhatsappInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','value','find','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','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)','unreadMessages','DESC','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','getWhatsappAccounts','user','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName'];(function(_0x347e41,_0x50a59c){var _0x304634=function(_0x510043){while(--_0x510043){_0x347e41['push'](_0x347e41['shift']());}};_0x304634(++_0x50a59c);}(_0x9bdb,0x13c));var _0xb9bd=function(_0x31c97b,_0xd798bb){_0x31c97b=_0x31c97b-0x0;var _0x5758db=_0x9bdb[_0x31c97b];return _0x5758db;};'use strict';var emlformat=require(_0xb9bd('0x0'));var rimraf=require(_0xb9bd('0x1'));var zipdir=require(_0xb9bd('0x2'));var jsonpatch=require(_0xb9bd('0x3'));var rp=require('request-promise');var moment=require(_0xb9bd('0x4'));var BPromise=require(_0xb9bd('0x5'));var Mustache=require(_0xb9bd('0x6'));var util=require(_0xb9bd('0x7'));var path=require(_0xb9bd('0x8'));var sox=require(_0xb9bd('0x9'));var csv=require(_0xb9bd('0xa'));var ejs=require(_0xb9bd('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb9bd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb9bd('0xd'));var deskjs=require(_0xb9bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb9bd('0xf'));var Papa=require(_0xb9bd('0x10'));var Redis=require(_0xb9bd('0x11'));var authService=require(_0xb9bd('0x12'));var qs=require(_0xb9bd('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0xb9bd('0x14'));var logger=require(_0xb9bd('0x15'))(_0xb9bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb9bd('0x17'));var db=require(_0xb9bd('0x18'))['db'];config['redis']=_[_0xb9bd('0x19')](config[_0xb9bd('0x1a')],{'host':_0xb9bd('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9bd('0x1a')]));require(_0xb9bd('0x1c'))[_0xb9bd('0x1d')](socket);function respondWithStatusCode(_0x559855,_0x56450d){_0x56450d=_0x56450d||0xcc;return function(_0x1f74da){if(_0x1f74da){return _0x559855['sendStatus'](_0x56450d);}return _0x559855[_0xb9bd('0x1e')](_0x56450d)['end']();};}function respondWithResult(_0x1e0c3a,_0x1ad774){_0x1ad774=_0x1ad774||0xc8;return function(_0x33488e){if(_0x33488e){return _0x1e0c3a[_0xb9bd('0x1e')](_0x1ad774)[_0xb9bd('0x1f')](_0x33488e);}};}function respondWithFilteredResult(_0x15dc9f,_0x2f6edc){return function(_0xd65adc){if(_0xd65adc){var _0x2c5bee=typeof _0x2f6edc[_0xb9bd('0x20')]===_0xb9bd('0x21')&&typeof _0x2f6edc['limit']==='undefined';var _0x1b1103=_0xd65adc[_0xb9bd('0x22')];var _0x3abcf9=_0x2c5bee?0x0:_0x2f6edc[_0xb9bd('0x20')];var _0x1f1ac6=_0x2c5bee?_0xd65adc['count']:_0x2f6edc[_0xb9bd('0x20')]+_0x2f6edc[_0xb9bd('0x23')];var _0x2f8196;if(_0x1f1ac6>=_0x1b1103){_0x1f1ac6=_0x1b1103;_0x2f8196=0xc8;}else{_0x2f8196=0xce;}_0x15dc9f[_0xb9bd('0x1e')](_0x2f8196);return _0x15dc9f[_0xb9bd('0x24')](_0xb9bd('0x25'),_0x3abcf9+'-'+_0x1f1ac6+'/'+_0x1b1103)[_0xb9bd('0x1f')](_0xd65adc);}return null;};}function patchUpdates(_0x3162b7){return function(_0x89d5fb){try{jsonpatch['apply'](_0x89d5fb,_0x3162b7,!![]);}catch(_0x2c8e16){return BPromise[_0xb9bd('0x26')](_0x2c8e16);}return _0x89d5fb['save']();};}function saveUpdates(_0x50dced,_0x4b3940){return function(_0x136930){if(_0x136930){return _0x136930[_0xb9bd('0x27')](_0x50dced)['then'](function(_0x9f087d){return _0x9f087d;});}return null;};}function removeEntity(_0x18f4c1,_0x3b9846){return function(_0x2b7fad){if(_0x2b7fad){return _0x2b7fad[_0xb9bd('0x28')]()[_0xb9bd('0x29')](function(){_0x18f4c1[_0xb9bd('0x1e')](0xcc)[_0xb9bd('0x2a')]();});}};}function handleEntityNotFound(_0x2647a5,_0x364e2f){return function(_0x768bfd){if(!_0x768bfd){_0x2647a5[_0xb9bd('0x2b')](0x194);}return _0x768bfd;};}function handleError(_0x5d09c9,_0x4f8248){_0x4f8248=_0x4f8248||0x1f4;return function(_0x2b81c4){logger[_0xb9bd('0x2c')](_0x2b81c4[_0xb9bd('0x2d')]);if(_0x2b81c4[_0xb9bd('0x2e')]){delete _0x2b81c4[_0xb9bd('0x2e')];}_0x5d09c9[_0xb9bd('0x1e')](_0x4f8248)[_0xb9bd('0x2f')](_0x2b81c4);};}function getInteractionUsers(_0x42ffc1,_0x28fd26){return new BPromise(function(_0x5881ec,_0x2521c0){try{if(_0x28fd26[_0x42ffc1['id']]){_0x42ffc1[_0xb9bd('0x30')]=_[_0xb9bd('0x31')](_0x28fd26[_0x42ffc1['id']],function(_0xa9acb4){return{'id':_0xa9acb4['id'],'fullname':_0xa9acb4['fullname']};});}}catch(_0x2c0fdc){_0x2521c0(_0x2c0fdc);}_0x5881ec(_0x42ffc1);});}function getInteractionTags(_0x58b67f,_0x23d9d5){return new BPromise(function(_0x111bc9,_0x235a99){try{if(_0x58b67f[_0xb9bd('0x32')]){_0x58b67f[_0xb9bd('0x33')]=[];_0x58b67f[_0xb9bd('0x32')][_0xb9bd('0x34')](',')[_0xb9bd('0x35')](function(_0x28a2ec){_0x58b67f[_0xb9bd('0x33')][_0xb9bd('0x36')](_0x23d9d5[_0x28a2ec]);});}delete _0x58b67f[_0xb9bd('0x32')];}catch(_0xde03a0){_0x235a99(_0xde03a0);}_0x111bc9(_0x58b67f);});}function updateWhatsappInteraction(_0x350f87,_0x481309,_0x502e02){return new BPromise(function(_0x16254a,_0x5a6f20){return getInteractionUsers(_0x350f87,_0x502e02)['then'](function(_0x438b23){return getInteractionTags(_0x438b23,_0x481309);})[_0xb9bd('0x29')](function(_0x3666ba){return getStateInteraction(_0x3666ba);})[_0xb9bd('0x29')](function(_0x352339){_0x16254a(_0x352339);})[_0xb9bd('0x37')](function(_0x239009){_0x5a6f20(_0x239009);});});}function getStateInteraction(_0x32a4b0){return new BPromise(function(_0x37469c){_0x32a4b0[_0xb9bd('0x38')]=0x0;_0x32a4b0[_0xb9bd('0x39')]=0x0;_0x32a4b0['answered']=0x0;_0x32a4b0[_0xb9bd('0x3a')]=0x0;_0x32a4b0[_0xb9bd('0x3b')]=0x0;if(!_0x32a4b0[_0xb9bd('0x3c')]&&!_0x32a4b0[_0xb9bd('0x3d')]){_0x32a4b0['waiting']+=0x1;}if(!_0x32a4b0['closed']&&_0x32a4b0[_0xb9bd('0x3d')]){_0x32a4b0[_0xb9bd('0x39')]+=0x1;if(_0x32a4b0[_0xb9bd('0x38')]){_0x32a4b0['waiting']-=0x1;}}if(_0x32a4b0[_0xb9bd('0x3c')]&&_0x32a4b0['UserId']){_0x32a4b0[_0xb9bd('0x3e')]+=0x1;if(_0x32a4b0[_0xb9bd('0x39')]){_0x32a4b0[_0xb9bd('0x39')]-=0x1;}}if(_0x32a4b0[_0xb9bd('0x3c')]&&!_0x32a4b0[_0xb9bd('0x3d')]){_0x32a4b0[_0xb9bd('0x3a')]+=0x1;if(_0x32a4b0['waiting']){_0x32a4b0[_0xb9bd('0x38')]-=0x1;}}_0x32a4b0[_0xb9bd('0x3b')]+=0x1;_0x37469c(_0x32a4b0);});}exports[_0xb9bd('0x3f')]=function(_0x11da60,_0x89e03d){var _0x2e4226={},_0x358dd3={},_0x42e19d={'count':0x0,'rows':[]};var _0x50b603=_[_0xb9bd('0x31')](db[_0xb9bd('0x40')][_0xb9bd('0x41')],function(_0x594e9c){return{'name':_0x594e9c[_0xb9bd('0x42')],'type':_0x594e9c['type'][_0xb9bd('0x43')]};});_0x358dd3[_0xb9bd('0x44')]=_[_0xb9bd('0x31')](_0x50b603,_0xb9bd('0x2e'));_0x358dd3['query']=_[_0xb9bd('0x45')](_0x11da60[_0xb9bd('0x46')]);_0x358dd3[_0xb9bd('0x47')]=_[_0xb9bd('0x48')](_0x358dd3['model'],_0x358dd3[_0xb9bd('0x46')]);_0x2e4226['attributes']=_[_0xb9bd('0x48')](_0x358dd3[_0xb9bd('0x44')],qs[_0xb9bd('0x49')](_0x11da60[_0xb9bd('0x46')]['fields']));_0x2e4226[_0xb9bd('0x4a')]=_0x2e4226['attributes']['length']?_0x2e4226[_0xb9bd('0x4a')]:_0x358dd3['model'];if(!_0x11da60[_0xb9bd('0x46')]['hasOwnProperty'](_0xb9bd('0x4b'))){_0x2e4226[_0xb9bd('0x23')]=qs['limit'](_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x23')]);_0x2e4226[_0xb9bd('0x20')]=qs[_0xb9bd('0x20')](_0x11da60['query'][_0xb9bd('0x20')]);}_0x2e4226[_0xb9bd('0x4c')]=qs[_0xb9bd('0x4d')](_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x4d')]);_0x2e4226[_0xb9bd('0x4e')]=qs['filters'](_[_0xb9bd('0x4f')](_0x11da60[_0xb9bd('0x46')],_0x358dd3[_0xb9bd('0x47')]),_0x50b603);var _0x31ef15=[];var _0x4e1a1d=squel[_0xb9bd('0x50')]()[_0xb9bd('0x51')]('id')[_0xb9bd('0x51')](_0xb9bd('0x2e'))[_0xb9bd('0x51')](_0xb9bd('0x52'))[_0xb9bd('0x53')](_0xb9bd('0x54'));var _0x1550d5=squel[_0xb9bd('0x50')]()[_0xb9bd('0x51')](_0xb9bd('0x55'))[_0xb9bd('0x51')]('u.fullname')[_0xb9bd('0x51')]('ui.WhatsappInteractionId')[_0xb9bd('0x53')]('user_has_whatsapp_interactions','ui')[_0xb9bd('0x56')](_0xb9bd('0x57'),'u',_0xb9bd('0x58'));var _0x56e7e5=squel[_0xb9bd('0x50')]()['from'](_0xb9bd('0x59'),'i')[_0xb9bd('0x56')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb9bd('0x57'),'o',_0xb9bd('0x5a'))[_0xb9bd('0x56')](_0xb9bd('0x5b'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb9bd('0x56')](_0xb9bd('0x5c'),'me',_0xb9bd('0x5d'))['left_join'](_0xb9bd('0x5e'),'it',_0xb9bd('0x5f'))['left_join'](_0xb9bd('0x54'),'t',_0xb9bd('0x60'));var _0x583a34=squel['expr']();var _0x5314ba=[];var _0x2b682e=squel[_0xb9bd('0x61')]();var _0x580f52;if(_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x62')]){_0x580f52=as[_0xb9bd('0x63')](_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x62')]);var _0x557f3d=_0x580f52['sqlOperator'];for(var _0x3e57b3=0x0;_0x3e57b3<_0x580f52[_0xb9bd('0x64')][_0xb9bd('0x65')];_0x3e57b3++){var _0x2c5c32=_0x580f52['conditions'][_0x3e57b3];var _0x5c4164='i';var _0x101414=_['find'](_0x50b603,[_0xb9bd('0x2e'),_0x2c5c32[_0xb9bd('0x51')]]);if(!_0x101414){switch(_0x2c5c32['field']){case'unreadMessages':if(_0x2c5c32['value']==0x1){_0x56e7e5[_0xb9bd('0x66')]('`'+_0x2c5c32[_0xb9bd('0x51')]+'`\x20=\x200');}else{_0x56e7e5['having']('`'+_0x2c5c32[_0xb9bd('0x51')]+_0xb9bd('0x67'));}break;case _0xb9bd('0x68'):if(_0x2c5c32[_0xb9bd('0x69')]===_0xb9bd('0x6a')){if(_0x2c5c32['value']['split']('\x20')[_0xb9bd('0x65')]>0x1){_0x583a34[_0x557f3d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb9bd('0x6b')](_0x2c5c32[_0xb9bd('0x6c')]),null);}else{var _0x1410fb='%'+_0x2c5c32[_0xb9bd('0x6c')]+'%';_0x583a34[_0x557f3d]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1410fb,_0x1410fb,_0x1410fb);}}else{_0x101414=_[_0xb9bd('0x6d')](_0x50b603,[_0xb9bd('0x2e'),'ContactId']);_0x2c5c32[_0xb9bd('0x51')]=_0xb9bd('0x6e');_0x36df35=as[_0xb9bd('0x6f')](_0x5c4164,_0x101414[_0xb9bd('0x70')],_0x2c5c32);_0x583a34[_0x557f3d](_0x36df35[_0xb9bd('0x71')],_0x36df35['value']['start'],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x2a')]);}break;case _0xb9bd('0x72'):var _0x39689f=_0x2c5c32[_0xb9bd('0x6c')]['split'](',')[_0xb9bd('0x31')](function(_0x5e42d8){return Number(_0x5e42d8);});_0x39689f[_0xb9bd('0x35')](function(_0x519efd){_0x2b682e['or'](_0xb9bd('0x73'),'%,'+_0x519efd+',%');});_0x5314ba=_[_0xb9bd('0x74')](_0x5314ba,_0x39689f);break;case _0xb9bd('0x75'):if(_0x2c5c32[_0xb9bd('0x69')]===_0xb9bd('0x6a')){_0x583a34[_0x557f3d](_0xb9bd('0x76'),'%'+_0x2c5c32['value']+'%',null);}else{_0x101414=_[_0xb9bd('0x6d')](_0x50b603,[_0xb9bd('0x2e'),_0xb9bd('0x3d')]);_0x2c5c32[_0xb9bd('0x51')]=_0xb9bd('0x3d');_0x36df35=as['buildExpression'](_0x5c4164,_0x101414[_0xb9bd('0x70')],_0x2c5c32);_0x583a34[_0x557f3d](_0x36df35[_0xb9bd('0x71')],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x77')],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x2a')]);}break;case'body':_0x36df35=as[_0xb9bd('0x6f')]('me',null,_0x2c5c32);_0x583a34[_0x557f3d](_0x36df35[_0xb9bd('0x71')],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x77')],_0x36df35['value'][_0xb9bd('0x2a')]);break;}}else{var _0x36df35=as[_0xb9bd('0x6f')](_0x5c4164,_0x101414[_0xb9bd('0x70')],_0x2c5c32);_0x583a34[_0x557f3d](_0x36df35['text'],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x77')],_0x36df35[_0xb9bd('0x6c')][_0xb9bd('0x2a')]);}}}else{var _0x582c3b=_(_0x11da60['query'])[_0xb9bd('0x45')]()[_0xb9bd('0x31')](function(_0xbca498){return _[_0xb9bd('0x78')](_0x50b603,[_0xb9bd('0x2e'),_0xbca498])?_0xbca498:undefined;})['compact']()[_0xb9bd('0x6c')]();if(!_['isEmpty'](_0x582c3b)){_0x582c3b[_0xb9bd('0x35')](function(_0x1ac1a0){if(_0x1ac1a0===_0xb9bd('0x79')){_0x56e7e5[_0xb9bd('0x4e')](_0xb9bd('0x7a'),[]['concat'](_0x11da60['query'][_0x1ac1a0]));}else if(_0x1ac1a0===_0xb9bd('0x7b')){var _0x2216de=JSON[_0xb9bd('0x7c')](_0x11da60[_0xb9bd('0x46')][_0x1ac1a0])[_0xb9bd('0x7d')];var _0x39ae3a=JSON[_0xb9bd('0x7c')](_0x11da60[_0xb9bd('0x46')][_0x1ac1a0])[_0xb9bd('0x7e')];_0x56e7e5['where'](_0xb9bd('0x7f'),_0x2216de,_0x39ae3a);}else{if(_0x11da60[_0xb9bd('0x46')][_0x1ac1a0]===_0xb9bd('0x80')){_0x56e7e5['where']('i.'+_0x1ac1a0+_0xb9bd('0x81'));}else{_0x56e7e5[_0xb9bd('0x4e')]('i.'+_0x1ac1a0+_0xb9bd('0x82'),_0x11da60[_0xb9bd('0x46')][_0x1ac1a0]);}}});}if(_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x83')]){if(_0x11da60['query'][_0xb9bd('0x83')]==0x1){_0x56e7e5[_0xb9bd('0x66')]('`unreadMessages`\x20=\x200');}else{_0x56e7e5['having'](_0xb9bd('0x84'));}}if(_0x11da60['query'][_0xb9bd('0x85')]){_0x5314ba=_[_0xb9bd('0x86')](_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x85')])?_0x11da60['query'][_0xb9bd('0x85')]:new Array(_0x11da60[_0xb9bd('0x46')]['tag']);_0x5314ba['forEach'](function(_0x233574){_0x2b682e['or'](_0xb9bd('0x73'),'%,'+_0x233574+',%');});}if(_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x87')]){var _0x2b46d0=_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x87')][_0xb9bd('0x88')]('\x5c','\x5c\x5c')[_0xb9bd('0x88')](/'/g,'\x27\x27');if(qs[_0xb9bd('0x89')](_0x2b46d0)){_0x583a34['or']('i.id\x20LIKE\x20?',_0x2b46d0+'%')['or'](_0xb9bd('0x8a'),_0x2b46d0+'%');}else{_0x583a34['or'](_0xb9bd('0x8b'),qs[_0xb9bd('0x6b')](_0x2b46d0))['or'](_0xb9bd('0x8c'),_0x2b46d0+'%');}}}_0x56e7e5['where'](_0x583a34);_0x56e7e5[_0xb9bd('0x8d')](_0xb9bd('0x8e'));var _0x3a5878={'type':db[_0xb9bd('0x8f')][_0xb9bd('0x90')]['SELECT'],'raw':!![]};var _0x422ed0=_0x56e7e5[_0xb9bd('0x91')]();_0x422ed0['field'](_0xb9bd('0x8e'));_0x422ed0[_0xb9bd('0x51')](_0xb9bd('0x92'),_0xb9bd('0x93'));if(_0x2e4226['order']){_0x2e4226['order'][_0xb9bd('0x35')](function(_0x17b959){var _0x9d3dc4=_0x17b959[0x0]==='contactName'?_0x17b959[0x0]:'i.'+_0x17b959[0x0];_0x56e7e5[_0xb9bd('0x4c')](_0x9d3dc4,_0x17b959[0x1]===_0xb9bd('0x94')?![]:!![]);});}if(!_[_0xb9bd('0x95')](_0x5314ba)){_0x56e7e5[_0xb9bd('0x66')](_0x2b682e);_0x422ed0[_0xb9bd('0x4e')]('t.id\x20IN\x20?',_0x5314ba);}BPromise[_0xb9bd('0x96')]()['then'](function(){if(!_0x580f52){if(_0x11da60[_0xb9bd('0x46')][_0xb9bd('0x79')])return;_0x422ed0[_0xb9bd('0x4e')](_0xb9bd('0x97'));_0x56e7e5[_0xb9bd('0x4e')](_0xb9bd('0x97'));return;}if(_0x11da60['user'][_0xb9bd('0x98')]!=='agent')return;return _0x11da60['user'][_0xb9bd('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x146821){if(_[_0xb9bd('0x95')](_0x146821)){_0x422ed0['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x56e7e5[_0xb9bd('0x4e')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x422ed0[_0xb9bd('0x4e')](_0xb9bd('0x7a'),_[_0xb9bd('0x31')](_0x146821,'id'));_0x56e7e5['where'](_0xb9bd('0x7a'),_[_0xb9bd('0x31')](_0x146821,'id'));}});})['then'](function(){if(_0x11da60[_0xb9bd('0x9a')][_0xb9bd('0x98')]===_0xb9bd('0x9b')&&!_0x580f52&&!_0x11da60['query']['WhatsappAccountId'])return[];return db[_0xb9bd('0x9c')][_0xb9bd('0x46')](_0x422ed0['toString'](),_0x3a5878);})['then'](function(_0x463e63){_0x42e19d[_0xb9bd('0x22')]=_0x463e63[_0xb9bd('0x65')];if(_0x42e19d[_0xb9bd('0x22')]===0x0)return[];return db[_0xb9bd('0x9c')][_0xb9bd('0x46')](_0x4e1a1d[_0xb9bd('0x9d')](),_0x3a5878)[_0xb9bd('0x29')](function(_0x851b7){_0x31ef15=_['keyBy'](_0x851b7,'id');_0x3a5878=_[_0xb9bd('0x9e')](_0x3a5878,{'model':db[_0xb9bd('0x40')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x11da60['query'][_0xb9bd('0x49')]){_0x2e4226[_0xb9bd('0x4a')][_0xb9bd('0x35')](function(_0x4c6afd){_0x56e7e5[_0xb9bd('0x51')]('i.'+_0x4c6afd);});}else{_0x56e7e5[_0xb9bd('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x56e7e5['field'](_0xb9bd('0x9f'),_0xb9bd('0xa0'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xa1'),_0xb9bd('0xa2'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xa3'),_0xb9bd('0xa4'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xa5'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xa6'),_0xb9bd('0xa7'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xa8'),_0xb9bd('0xa9'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xaa'),_0xb9bd('0xab'));_0x56e7e5[_0xb9bd('0x51')]('c.phone',_0xb9bd('0xac'));_0x56e7e5['field'](_0xb9bd('0xad'),_0xb9bd('0xae'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xaf'),_0xb9bd('0xb0'));_0x56e7e5[_0xb9bd('0x51')]('o.fullname','Owner.fullname');_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xb1'),_0xb9bd('0xb2'));_0x56e7e5[_0xb9bd('0x51')](_0xb9bd('0xb3'),_0xb9bd('0x32'));}if(_0x2e4226[_0xb9bd('0x23')])_0x56e7e5[_0xb9bd('0x23')](_0x2e4226['limit']);if(_0x2e4226[_0xb9bd('0x20')])_0x56e7e5['offset'](_0x2e4226[_0xb9bd('0x20')]);return db[_0xb9bd('0x9c')][_0xb9bd('0x46')](_0x56e7e5[_0xb9bd('0x9d')](),_0x3a5878);})[_0xb9bd('0x29')](function(_0x1ed7fc){if(_0x1ed7fc[_0xb9bd('0x65')]>0x0)_0x1550d5[_0xb9bd('0x4e')](_0xb9bd('0xb4'),_[_0xb9bd('0x31')](_0x1ed7fc,'id'));return db[_0xb9bd('0x9c')][_0xb9bd('0x46')](_0x1550d5[_0xb9bd('0x9d')](),_0x3a5878)['then'](function(_0x2b9cb2){var _0x140a6e=_[_0xb9bd('0xb5')](_0x2b9cb2,_0xb9bd('0xb6'));var _0x3ed6ab=[];_0x1ed7fc[_0xb9bd('0x35')](function(_0x20149d){_0x3ed6ab[_0xb9bd('0x36')](updateWhatsappInteraction(_0x20149d,_0x31ef15,_0x140a6e));});return BPromise['all'](_0x3ed6ab);});});})[_0xb9bd('0x29')](function(_0x5519cf){_0x42e19d[_0xb9bd('0xb7')]=_0x5519cf;return _0x42e19d;})[_0xb9bd('0x29')](respondWithFilteredResult(_0x89e03d,_0x2e4226))[_0xb9bd('0x37')](handleError(_0x89e03d,null));};exports[_0xb9bd('0xb8')]=function(_0x5bda50,_0x1683f8){var _0x5b06ee={'raw':![],'where':{'id':_0x5bda50[_0xb9bd('0xb9')]['id']}},_0x235c0d={};_0x235c0d[_0xb9bd('0x44')]=_[_0xb9bd('0x45')](db['WhatsappInteraction'][_0xb9bd('0x41')]);_0x235c0d[_0xb9bd('0x46')]=_[_0xb9bd('0x45')](_0x5bda50[_0xb9bd('0x46')]);_0x235c0d[_0xb9bd('0x47')]=_[_0xb9bd('0x48')](_0x235c0d['model'],_0x235c0d[_0xb9bd('0x46')]);_0x5b06ee['attributes']=_['intersection'](_0x235c0d[_0xb9bd('0x44')],qs[_0xb9bd('0x49')](_0x5bda50[_0xb9bd('0x46')]['fields']));_0x5b06ee[_0xb9bd('0x4a')]=_0x5b06ee[_0xb9bd('0x4a')][_0xb9bd('0x65')]?_0x5b06ee[_0xb9bd('0x4a')]:_0x235c0d['model'];if(_0x5bda50[_0xb9bd('0x46')][_0xb9bd('0xba')]){_0x5b06ee[_0xb9bd('0xbb')]=[{'all':!![]}];}_0x5b06ee=_[_0xb9bd('0x9e')]({},_0x5b06ee,_0x5bda50[_0xb9bd('0xbc')]);return db[_0xb9bd('0x40')][_0xb9bd('0x6d')](_0x5b06ee)[_0xb9bd('0x29')](handleEntityNotFound(_0x1683f8,null))[_0xb9bd('0x29')](respondWithResult(_0x1683f8,null))[_0xb9bd('0x37')](handleError(_0x1683f8,null));};exports[_0xb9bd('0xbd')]=function(_0x129f9e,_0x3793f5){return db[_0xb9bd('0x40')]['create'](_0x129f9e['body'],{})[_0xb9bd('0x29')](respondWithResult(_0x3793f5,0xc9))[_0xb9bd('0x37')](handleError(_0x3793f5,null));};exports[_0xb9bd('0x27')]=function(_0x29d08c,_0x1d3fd5){if(_0x29d08c[_0xb9bd('0xbe')]['id']){delete _0x29d08c[_0xb9bd('0xbe')]['id'];}return db['WhatsappInteraction'][_0xb9bd('0x6d')]({'where':{'id':_0x29d08c[_0xb9bd('0xb9')]['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x1d3fd5,null))[_0xb9bd('0x29')](saveUpdates(_0x29d08c[_0xb9bd('0xbe')],null))['then'](respondWithResult(_0x1d3fd5,null))[_0xb9bd('0x37')](handleError(_0x1d3fd5,null));};exports[_0xb9bd('0x28')]=function(_0x19d83e,_0x37e26e){return db[_0xb9bd('0x40')][_0xb9bd('0x6d')]({'where':{'id':_0x19d83e['params']['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x37e26e,null))['then'](removeEntity(_0x37e26e,null))[_0xb9bd('0x37')](handleError(_0x37e26e,null));};exports[_0xb9bd('0xbf')]=function(_0x5cd364,_0x4a248f){return db['WhatsappInteraction'][_0xb9bd('0xbf')]()['then'](respondWithResult(_0x4a248f,null))[_0xb9bd('0x37')](handleError(_0x4a248f,null));};exports[_0xb9bd('0xc0')]=function(_0x599cb1,_0x3bea7f,_0x5938d8){return db['WhatsappMessage'][_0xb9bd('0x6d')]({'where':{'id':_0x599cb1[_0xb9bd('0xb9')]['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x3bea7f,null))[_0xb9bd('0x29')](function(_0x19fd0f){if(_0x19fd0f){return _0x19fd0f[_0xb9bd('0xc0')](_0x599cb1['body'][_0xb9bd('0xc1')],_[_0xb9bd('0xc2')](_0x599cb1[_0xb9bd('0xbe')],['ids','id'])||{});}})[_0xb9bd('0x29')](respondWithResult(_0x3bea7f,null))[_0xb9bd('0x37')](handleError(_0x3bea7f,null));};exports[_0xb9bd('0xc3')]=function(_0x4b0690,_0x1035bb,_0x213691){var _0x1a4185={'raw':![],'where':{}};var _0x391bd5={};var _0x11946c={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x4b0690['params']['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x1035bb,null))['then'](function(_0x19e19a){if(_0x19e19a){_0x391bd5[_0xb9bd('0x44')]=_[_0xb9bd('0x45')](db['WhatsappMessage']['rawAttributes']);_0x391bd5['query']=_['keys'](_0x4b0690[_0xb9bd('0x46')]);_0x391bd5[_0xb9bd('0x47')]=_[_0xb9bd('0x48')](_0x391bd5[_0xb9bd('0x44')],_0x391bd5['query']);_0x1a4185[_0xb9bd('0x4a')]=_[_0xb9bd('0x48')](_0x391bd5[_0xb9bd('0x44')],qs[_0xb9bd('0x49')](_0x4b0690['query']['fields']));_0x1a4185[_0xb9bd('0x4a')]=_0x1a4185['attributes'][_0xb9bd('0x65')]?_0x1a4185['attributes']:_0x391bd5[_0xb9bd('0x44')];if(!_0x4b0690[_0xb9bd('0x46')]['hasOwnProperty'](_0xb9bd('0x4b'))){_0x1a4185[_0xb9bd('0x23')]=qs[_0xb9bd('0x23')](_0x4b0690['query'][_0xb9bd('0x23')]);_0x1a4185['offset']=qs[_0xb9bd('0x20')](_0x4b0690[_0xb9bd('0x46')][_0xb9bd('0x20')]);}_0x1a4185[_0xb9bd('0x4c')]=qs[_0xb9bd('0x4d')](_0x4b0690[_0xb9bd('0x46')][_0xb9bd('0x4d')]);_0x1a4185[_0xb9bd('0x4e')]=qs[_0xb9bd('0x47')](_[_0xb9bd('0x4f')](_0x4b0690[_0xb9bd('0x46')],_0x391bd5[_0xb9bd('0x47')]));_0x1a4185['where']['WhatsappInteractionId']=_0x19e19a['id'];if(_0x4b0690[_0xb9bd('0x46')]['filter']){_0x1a4185[_0xb9bd('0x4e')]=_[_0xb9bd('0x9e')](_0x1a4185['where'],{'$or':_[_0xb9bd('0x31')](_0x1a4185[_0xb9bd('0x4a')],function(_0x532b8f){var _0x4ffff6={};_0x4ffff6[_0x532b8f]={'$like':'%'+_0x4b0690[_0xb9bd('0x46')][_0xb9bd('0x87')]+'%'};return _0x4ffff6;})});}if(_0x4b0690[_0xb9bd('0x46')][_0xb9bd('0x7d')]){var _0x2ce86a=_0x4b0690[_0xb9bd('0x46')][_0xb9bd('0x7d')]['split'](',');var _0x30c055={};_0x30c055[_0x2ce86a[0x0]]={'$gte':moment(_0x2ce86a[0x1])[_0xb9bd('0xc4')](_0xb9bd('0xc5'))};_0x1a4185[_0xb9bd('0x4e')]=_[_0xb9bd('0x9e')](_0x1a4185[_0xb9bd('0x4e')],_0x30c055);}_0x1a4185=_[_0xb9bd('0x9e')]({},_0x1a4185,_0x4b0690['options']);return db[_0xb9bd('0xc6')][_0xb9bd('0x22')]({'where':_0x1a4185[_0xb9bd('0x4e')]})[_0xb9bd('0x29')](function(_0xed6e07){_0x11946c['count']=_0xed6e07;if(_0x4b0690['query'][_0xb9bd('0xba')]){_0x1a4185[_0xb9bd('0xbb')]=[{'all':!![]}];}return db[_0xb9bd('0xc6')][_0xb9bd('0xc7')](_0x1a4185);})['then'](function(_0x17c670){_0x11946c['rows']=_0x17c670;return _0x11946c;});}})[_0xb9bd('0x29')](respondWithFilteredResult(_0x1035bb,_0x1a4185))[_0xb9bd('0x37')](handleError(_0x1035bb,null));};exports[_0xb9bd('0xc8')]=function(_0x518ef2,_0x1caa4c,_0x51447a){return db['WhatsappInteraction'][_0xb9bd('0x6d')]({'where':{'id':_0x518ef2[_0xb9bd('0xb9')]['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x1caa4c,null))['then'](function(_0x1cdd0d){if(_0x1cdd0d){return _0x1cdd0d[_0xb9bd('0xc9')](_0x518ef2[_0xb9bd('0xbe')][_0xb9bd('0xc1')],_[_0xb9bd('0xc2')](_0x518ef2[_0xb9bd('0xbe')],[_0xb9bd('0xc1'),'id'])||{})[_0xb9bd('0xca')](function(){return db['Tag'][_0xb9bd('0xc7')]({'attributes':['id',_0xb9bd('0x2e'),'color'],'where':{'id':_0x518ef2[_0xb9bd('0xbe')]['ids']}});})[_0xb9bd('0x29')](function(_0xd6bceb){socket[_0xb9bd('0xcb')](_0xb9bd('0xcc'),{'id':Number(_0x518ef2[_0xb9bd('0xb9')]['id']),'tags':_0xd6bceb||[]});return{'id':Number(_0x518ef2[_0xb9bd('0xb9')]['id']),'tags':_0xd6bceb||[]};});}})['then'](respondWithResult(_0x1caa4c,null))['catch'](handleError(_0x1caa4c,null));};exports[_0xb9bd('0xcd')]=function(_0x2160da,_0x19e2e9,_0x4dd127){return db[_0xb9bd('0x40')][_0xb9bd('0x6d')]({'where':{'id':_0x2160da[_0xb9bd('0xb9')]['id']}})[_0xb9bd('0x29')](handleEntityNotFound(_0x19e2e9,null))['then'](function(_0x53b519){if(_0x53b519){return _0x53b519[_0xb9bd('0xcd')](_0x2160da[_0xb9bd('0x46')][_0xb9bd('0xc1')]);}})[_0xb9bd('0x29')](respondWithStatusCode(_0x19e2e9,null))[_0xb9bd('0x37')](handleError(_0x19e2e9,null));};exports['download']=function(_0x194141,_0x289b76){var _0x174e4e=moment()['unix']()[_0xb9bd('0x9d')]();var _0x572191=path[_0xb9bd('0xce')](config[_0xb9bd('0xcf')],_0xb9bd('0xd0'),_0xb9bd('0xd1'),_0xb9bd('0xd2'));var _0x560a55=path[_0xb9bd('0xce')](config[_0xb9bd('0xcf')],_0xb9bd('0xd0'),'files',_0xb9bd('0xd3'));var _0x10ee50=path['join'](_0x572191,_0x174e4e);var _0x39a78f=util[_0xb9bd('0xc4')](_0xb9bd('0xd4'),_0x194141['params']['id'],_0x174e4e);var _0x2fd30f=path[_0xb9bd('0xce')](_0x572191,_0x39a78f);var _0x41089d=[];_0x41089d[_0xb9bd('0x36')]({'model':db[_0xb9bd('0x75')],'as':_0xb9bd('0x75'),'attributes':['id','fullname'],'raw':!![]});_0x41089d[_0xb9bd('0x36')]({'model':db[_0xb9bd('0xd5')],'as':_0xb9bd('0x68'),'attributes':['id',_0xb9bd('0xd6'),'lastName'],'raw':!![]});if(_0x194141[_0xb9bd('0x46')][_0xb9bd('0xd3')]){_0x41089d['push']({'model':db[_0xb9bd('0xd7')],'as':_0xb9bd('0xd7'),'raw':!![]});}var _0x4d9c79=[{'model':db['WhatsappMessage'],'as':_0xb9bd('0xd8'),'attributes':['id',_0xb9bd('0xbe'),_0xb9bd('0x7b'),_0xb9bd('0xd9'),_0xb9bd('0xda'),'read'],'include':_0x41089d}];_0x4d9c79[_0xb9bd('0x36')]({'model':db[_0xb9bd('0xdb')],'as':'Account','attributes':['id',_0xb9bd('0x2e')]});_0x4d9c79[_0xb9bd('0x36')]({'model':db['User'],'as':_0xb9bd('0xdc'),'attributes':['id',_0xb9bd('0xdd')]});return db['WhatsappInteraction'][_0xb9bd('0x6d')]({'where':{'id':_0x194141[_0xb9bd('0xb9')]['id']},'include':_0x4d9c79})[_0xb9bd('0x29')](handleEntityNotFound(_0x289b76,null))[_0xb9bd('0x29')](function(_0x453066){if(_0x453066){var _0x9b8cef=_0x453066[_0xb9bd('0xde')]({'plain':!![]});fs[_0xb9bd('0xdf')](_0x10ee50);var _0x432d73={'channel':'Whatsapp','account':_0x9b8cef[_0xb9bd('0xe0')]['name'],'agent':_0x9b8cef['Owner']?_0x9b8cef[_0xb9bd('0xdc')][_0xb9bd('0xdd')]:_0xb9bd('0xe1'),'createdAt':moment(_0x9b8cef['createdAt'])['format'](_0xb9bd('0xc5'))[_0xb9bd('0x9d')](),'closedAt':_0x9b8cef[_0xb9bd('0x3c')]?moment(_0x9b8cef[_0xb9bd('0xe2')])[_0xb9bd('0xc4')](_0xb9bd('0xc5'))[_0xb9bd('0x9d')]():'','disposition':_0x9b8cef['disposition'],'messages':_(_0x9b8cef['Messages'])['filter']({'secret':![]})[_0xb9bd('0x31')](function(_0x3288d0){if(_0x3288d0[_0xb9bd('0xd7')]){var _0x4cfd71=path[_0xb9bd('0xce')](_0x560a55,_0x3288d0[_0xb9bd('0xd7')][_0xb9bd('0xe3')]);if(fs[_0xb9bd('0xe4')](_0x4cfd71)){fs[_0xb9bd('0xe5')](_0x4cfd71)[_0xb9bd('0xe6')](fs['createWriteStream'](path['join'](_0x10ee50,_0x3288d0[_0xb9bd('0xd7')][_0xb9bd('0xe3')])));}}return{'date':moment(_0x3288d0[_0xb9bd('0x7b')])['format'](_0xb9bd('0xc5'))[_0xb9bd('0x9d')](),'sender':_0x3288d0['direction']===_0xb9bd('0xe7')?_0x3288d0[_0xb9bd('0x75')]?_0x3288d0['User'][_0xb9bd('0xdd')]:_0xb9bd('0xe8'):_0x3288d0[_0xb9bd('0x68')][_0xb9bd('0xd6')]+(_0x3288d0[_0xb9bd('0x68')][_0xb9bd('0xe9')]?'\x20'+_0x3288d0[_0xb9bd('0x68')][_0xb9bd('0xe9')]:''),'body':_0x3288d0[_0xb9bd('0xd7')]?_0x3288d0[_0xb9bd('0xd7')][_0xb9bd('0xe3')]:_0x3288d0[_0xb9bd('0xbe')],'direction':_0x3288d0['direction']==='out'?'A':'C','secret':_0x3288d0[_0xb9bd('0xda')],'read':_0x3288d0[_0xb9bd('0x83')],'attachment':_0x3288d0[_0xb9bd('0xd7')]};})[_0xb9bd('0x6c')]()};return ejs['renderFile'](path[_0xb9bd('0xce')](config[_0xb9bd('0xcf')],_0xb9bd('0xd0'),_0xb9bd('0xea'),_0xb9bd('0xeb')),{'interaction':_0x432d73})[_0xb9bd('0x29')](function(_0x19ce77){var _0x4c61f8=path['join'](_0x10ee50,_0xb9bd('0xec')+_0x9b8cef['id']+'-'+_0x174e4e+_0xb9bd('0xed'));var _0x22d963={'path':_0x4c61f8,'channel':_0xb9bd('0xee'),'interactionId':_0x9b8cef['id']};return pdf['createPdfFromHTML'](_0x19ce77,_0x22d963);})[_0xb9bd('0x29')](function(){return new BPromise(function(_0x50ad80,_0x20e9cf){zipdir(_0x10ee50,{'saveTo':_0x2fd30f},function(_0x32954a,_0x45e840){if(_0x32954a)return _0x20e9cf(_0x32954a);return _0x50ad80(_0x45e840);});})[_0xb9bd('0x29')](function(){return new BPromise(function(_0x3da944,_0x53527b){rimraf(_0x10ee50,function(_0x1259dd){if(_0x1259dd)_0x53527b(_0x1259dd);return _0x3da944();});});})[_0xb9bd('0x29')](function(){return _0x289b76[_0xb9bd('0xef')](_0x2fd30f,_0x39a78f,function(_0x36b217){if(_0x36b217){console[_0xb9bd('0xf0')](_0xb9bd('0xf1'),_0x36b217);}else{fs[_0xb9bd('0xf2')](_0x2fd30f);}});});});}else{return _0x289b76[_0xb9bd('0x2b')](0xc8);}})[_0xb9bd('0x37')](handleError(_0x289b76,null));}; \ No newline at end of file +var _0xd448=['find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','WhatsappInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','include','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','color','emit','whatsappInteractionTags:save','removeTags','download','join','files','root','server','transcript-%d-%s.zip','User','fullname','CmContact','lastName','attachments','Attachment','direction','secret','WhatsappAccount','Account','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','Messages','basename','createReadStream','pipe','out','System','Contact','firstName','views','transcript-','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','TagIds','split','forEach','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','from','tools_tags','select','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator'];(function(_0x1252e4,_0x20e0ee){var _0x31dbc3=function(_0x509d93){while(--_0x509d93){_0x1252e4['push'](_0x1252e4['shift']());}};_0x31dbc3(++_0x20e0ee);}(_0xd448,0x172));var _0x8d44=function(_0x31a116,_0x5b75b0){_0x31a116=_0x31a116-0x0;var _0x5f31ce=_0xd448[_0x31a116];return _0x5f31ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d44('0x0'));var zipdir=require(_0x8d44('0x1'));var jsonpatch=require(_0x8d44('0x2'));var rp=require(_0x8d44('0x3'));var moment=require(_0x8d44('0x4'));var BPromise=require(_0x8d44('0x5'));var Mustache=require(_0x8d44('0x6'));var util=require(_0x8d44('0x7'));var path=require(_0x8d44('0x8'));var sox=require(_0x8d44('0x9'));var csv=require('to-csv');var ejs=require(_0x8d44('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d44('0xb'));var crypto=require(_0x8d44('0xc'));var jsforce=require(_0x8d44('0xd'));var deskjs=require(_0x8d44('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d44('0xf'));var Papa=require(_0x8d44('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d44('0x11'));var as=require(_0x8d44('0x12'));var pdf=require(_0x8d44('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d44('0x14'))(_0x8d44('0x15'));var utils=require(_0x8d44('0x16'));var config=require(_0x8d44('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d44('0x18'))['db'];config[_0x8d44('0x19')]=_[_0x8d44('0x1a')](config[_0x8d44('0x19')],{'host':_0x8d44('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d44('0x19')]));require(_0x8d44('0x1c'))[_0x8d44('0x1d')](socket);function respondWithStatusCode(_0x87a133,_0x72252e){_0x72252e=_0x72252e||0xcc;return function(_0x59746c){if(_0x59746c){return _0x87a133[_0x8d44('0x1e')](_0x72252e);}return _0x87a133[_0x8d44('0x1f')](_0x72252e)[_0x8d44('0x20')]();};}function respondWithResult(_0x604e6,_0x29244e){_0x29244e=_0x29244e||0xc8;return function(_0x2e7d11){if(_0x2e7d11){return _0x604e6[_0x8d44('0x1f')](_0x29244e)[_0x8d44('0x21')](_0x2e7d11);}};}function respondWithFilteredResult(_0x21c04d,_0x1f29cb){return function(_0x4947f9){if(_0x4947f9){var _0x10d801=typeof _0x1f29cb[_0x8d44('0x22')]==='undefined'&&typeof _0x1f29cb[_0x8d44('0x23')]===_0x8d44('0x24');var _0x3a9a17=_0x4947f9['count'];var _0x5f6fcb=_0x10d801?0x0:_0x1f29cb[_0x8d44('0x22')];var _0x2924e6=_0x10d801?_0x4947f9[_0x8d44('0x25')]:_0x1f29cb['offset']+_0x1f29cb[_0x8d44('0x23')];var _0x1ae2ad;if(_0x2924e6>=_0x3a9a17){_0x2924e6=_0x3a9a17;_0x1ae2ad=0xc8;}else{_0x1ae2ad=0xce;}_0x21c04d[_0x8d44('0x1f')](_0x1ae2ad);return _0x21c04d['set'](_0x8d44('0x26'),_0x5f6fcb+'-'+_0x2924e6+'/'+_0x3a9a17)[_0x8d44('0x21')](_0x4947f9);}return null;};}function patchUpdates(_0x3d5215){return function(_0x119998){try{jsonpatch[_0x8d44('0x27')](_0x119998,_0x3d5215,!![]);}catch(_0x4b5eb8){return BPromise[_0x8d44('0x28')](_0x4b5eb8);}return _0x119998[_0x8d44('0x29')]();};}function saveUpdates(_0x2b304c,_0x4e8e66){return function(_0x5b0d68){if(_0x5b0d68){return _0x5b0d68[_0x8d44('0x2a')](_0x2b304c)[_0x8d44('0x2b')](function(_0x325a5a){return _0x325a5a;});}return null;};}function removeEntity(_0x22a9a7,_0x3187a7){return function(_0x288994){if(_0x288994){return _0x288994[_0x8d44('0x2c')]()['then'](function(){_0x22a9a7['status'](0xcc)[_0x8d44('0x20')]();});}};}function handleEntityNotFound(_0x178f96,_0x3fdad7){return function(_0x232c6b){if(!_0x232c6b){_0x178f96[_0x8d44('0x1e')](0x194);}return _0x232c6b;};}function handleError(_0x8995be,_0x41e47a){_0x41e47a=_0x41e47a||0x1f4;return function(_0x4ce131){logger[_0x8d44('0x2d')](_0x4ce131['stack']);if(_0x4ce131['name']){delete _0x4ce131[_0x8d44('0x2e')];}_0x8995be[_0x8d44('0x1f')](_0x41e47a)[_0x8d44('0x2f')](_0x4ce131);};}function getInteractionUsers(_0xbf7e54,_0x42266e){return new BPromise(function(_0x15f214,_0x2d034d){try{if(_0x42266e[_0xbf7e54['id']]){_0xbf7e54['Users']=_[_0x8d44('0x30')](_0x42266e[_0xbf7e54['id']],function(_0x4c5bb0){return{'id':_0x4c5bb0['id'],'fullname':_0x4c5bb0['fullname']};});}}catch(_0x4cfa97){_0x2d034d(_0x4cfa97);}_0x15f214(_0xbf7e54);});}function getInteractionTags(_0x4dbfe8,_0x3b7c2d){return new BPromise(function(_0x34dc01,_0x909df9){try{if(_0x4dbfe8[_0x8d44('0x31')]){_0x4dbfe8['Tags']=[];_0x4dbfe8[_0x8d44('0x31')][_0x8d44('0x32')](',')[_0x8d44('0x33')](function(_0x234848){_0x4dbfe8['Tags'][_0x8d44('0x34')](_0x3b7c2d[_0x234848]);});}delete _0x4dbfe8[_0x8d44('0x31')];}catch(_0x343846){_0x909df9(_0x343846);}_0x34dc01(_0x4dbfe8);});}function updateWhatsappInteraction(_0x3d6a47,_0xc43830,_0x3c71ad){return new BPromise(function(_0x58f3f0,_0x271100){return getInteractionUsers(_0x3d6a47,_0x3c71ad)['then'](function(_0x736b80){return getInteractionTags(_0x736b80,_0xc43830);})[_0x8d44('0x2b')](function(_0x887c2f){return getStateInteraction(_0x887c2f);})[_0x8d44('0x2b')](function(_0x6cb259){_0x58f3f0(_0x6cb259);})[_0x8d44('0x35')](function(_0x234100){_0x271100(_0x234100);});});}function getStateInteraction(_0x343d48){return new BPromise(function(_0x467b64){_0x343d48[_0x8d44('0x36')]=0x0;_0x343d48[_0x8d44('0x37')]=0x0;_0x343d48[_0x8d44('0x38')]=0x0;_0x343d48[_0x8d44('0x39')]=0x0;_0x343d48[_0x8d44('0x3a')]=0x0;if(!_0x343d48['closed']&&!_0x343d48['UserId']){_0x343d48[_0x8d44('0x36')]+=0x1;}if(!_0x343d48['closed']&&_0x343d48[_0x8d44('0x3b')]){_0x343d48[_0x8d44('0x37')]+=0x1;if(_0x343d48[_0x8d44('0x36')]){_0x343d48[_0x8d44('0x36')]-=0x1;}}if(_0x343d48[_0x8d44('0x3c')]&&_0x343d48[_0x8d44('0x3b')]){_0x343d48[_0x8d44('0x38')]+=0x1;if(_0x343d48[_0x8d44('0x37')]){_0x343d48[_0x8d44('0x37')]-=0x1;}}if(_0x343d48[_0x8d44('0x3c')]&&!_0x343d48['UserId']){_0x343d48[_0x8d44('0x39')]+=0x1;if(_0x343d48[_0x8d44('0x36')]){_0x343d48['waiting']-=0x1;}}_0x343d48['total']+=0x1;_0x467b64(_0x343d48);});}exports[_0x8d44('0x3d')]=function(_0x3d0c93,_0x58c41e){var _0x23cc9f={},_0x30b744={},_0x295f48={'count':0x0,'rows':[]};var _0x206f96=_['map'](db['WhatsappInteraction']['rawAttributes'],function(_0x2aad31){return{'name':_0x2aad31['fieldName'],'type':_0x2aad31[_0x8d44('0x3e')]['key']};});_0x30b744[_0x8d44('0x3f')]=_[_0x8d44('0x30')](_0x206f96,_0x8d44('0x2e'));_0x30b744[_0x8d44('0x40')]=_[_0x8d44('0x41')](_0x3d0c93[_0x8d44('0x40')]);_0x30b744['filters']=_[_0x8d44('0x42')](_0x30b744[_0x8d44('0x3f')],_0x30b744[_0x8d44('0x40')]);_0x23cc9f[_0x8d44('0x43')]=_[_0x8d44('0x42')](_0x30b744[_0x8d44('0x3f')],qs[_0x8d44('0x44')](_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x44')]));_0x23cc9f[_0x8d44('0x43')]=_0x23cc9f['attributes'][_0x8d44('0x45')]?_0x23cc9f[_0x8d44('0x43')]:_0x30b744['model'];if(!_0x3d0c93['query'][_0x8d44('0x46')](_0x8d44('0x47'))){_0x23cc9f[_0x8d44('0x23')]=qs[_0x8d44('0x23')](_0x3d0c93['query'][_0x8d44('0x23')]);_0x23cc9f['offset']=qs[_0x8d44('0x22')](_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x22')]);}_0x23cc9f[_0x8d44('0x48')]=qs['sort'](_0x3d0c93['query'][_0x8d44('0x49')]);_0x23cc9f[_0x8d44('0x4a')]=qs[_0x8d44('0x4b')](_[_0x8d44('0x4c')](_0x3d0c93[_0x8d44('0x40')],_0x30b744[_0x8d44('0x4b')]),_0x206f96);var _0x44655a=[];var _0x29b30f=squel['select']()['field']('id')[_0x8d44('0x4d')](_0x8d44('0x2e'))[_0x8d44('0x4d')]('color')[_0x8d44('0x4e')](_0x8d44('0x4f'));var _0x3e3680=squel[_0x8d44('0x50')]()[_0x8d44('0x4d')](_0x8d44('0x51'))['field']('u.fullname')[_0x8d44('0x4d')](_0x8d44('0x52'))['from'](_0x8d44('0x53'),'ui')[_0x8d44('0x54')]('users','u',_0x8d44('0x55'));var _0x54ab7e=squel[_0x8d44('0x50')]()[_0x8d44('0x4e')](_0x8d44('0x56'),'i')[_0x8d44('0x54')]('cm_contacts','c',_0x8d44('0x57'))[_0x8d44('0x54')](_0x8d44('0x58'),'o',_0x8d44('0x59'))[_0x8d44('0x54')](_0x8d44('0x5a'),'a',_0x8d44('0x5b'))[_0x8d44('0x54')](_0x8d44('0x5c'),'me',_0x8d44('0x5d'))[_0x8d44('0x54')](_0x8d44('0x5e'),'it',_0x8d44('0x5f'))[_0x8d44('0x54')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1a031f=squel[_0x8d44('0x60')]();var _0x3ca432=[];var _0x403967=squel[_0x8d44('0x60')]();var _0x323d64;if(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x61')]){_0x323d64=as[_0x8d44('0x62')](_0x3d0c93[_0x8d44('0x40')]['search']);var _0x3e4ff0=_0x323d64[_0x8d44('0x63')];for(var _0x4cbd64=0x0;_0x4cbd64<_0x323d64['conditions'][_0x8d44('0x45')];_0x4cbd64++){var _0x12abc4=_0x323d64['conditions'][_0x4cbd64];var _0x567b3f='i';var _0x11006a=_[_0x8d44('0x64')](_0x206f96,['name',_0x12abc4[_0x8d44('0x4d')]]);if(!_0x11006a){switch(_0x12abc4[_0x8d44('0x4d')]){case _0x8d44('0x65'):if(_0x12abc4[_0x8d44('0x66')]==0x1){_0x54ab7e[_0x8d44('0x67')]('`'+_0x12abc4[_0x8d44('0x4d')]+_0x8d44('0x68'));}else{_0x54ab7e['having']('`'+_0x12abc4[_0x8d44('0x4d')]+_0x8d44('0x69'));}break;case'Contact':if(_0x12abc4[_0x8d44('0x6a')]==='$substring'){if(_0x12abc4[_0x8d44('0x66')]['split']('\x20')[_0x8d44('0x45')]>0x1){_0x1a031f[_0x3e4ff0](_0x8d44('0x6b'),qs[_0x8d44('0x6c')](_0x12abc4[_0x8d44('0x66')]),null);}else{var _0x405a3c='%'+_0x12abc4[_0x8d44('0x66')]+'%';_0x1a031f[_0x3e4ff0](_0x8d44('0x6d'),_0x405a3c,_0x405a3c,_0x405a3c);}}else{_0x11006a=_[_0x8d44('0x64')](_0x206f96,[_0x8d44('0x2e'),_0x8d44('0x6e')]);_0x12abc4[_0x8d44('0x4d')]=_0x8d44('0x6e');_0x859601=as[_0x8d44('0x6f')](_0x567b3f,_0x11006a[_0x8d44('0x3e')],_0x12abc4);_0x1a031f[_0x3e4ff0](_0x859601[_0x8d44('0x70')],_0x859601[_0x8d44('0x66')][_0x8d44('0x71')],_0x859601['value'][_0x8d44('0x20')]);}break;case _0x8d44('0x72'):var _0x593eb3=_0x12abc4[_0x8d44('0x66')][_0x8d44('0x32')](',')['map'](function(_0x2e1ec2){return Number(_0x2e1ec2);});_0x593eb3[_0x8d44('0x33')](function(_0x189017){_0x403967['or'](_0x8d44('0x73'),'%,'+_0x189017+',%');});_0x3ca432=_[_0x8d44('0x74')](_0x3ca432,_0x593eb3);break;case'User':if(_0x12abc4['operator']===_0x8d44('0x75')){_0x1a031f[_0x3e4ff0](_0x8d44('0x76'),'%'+_0x12abc4[_0x8d44('0x66')]+'%',null);}else{_0x11006a=_[_0x8d44('0x64')](_0x206f96,[_0x8d44('0x2e'),_0x8d44('0x3b')]);_0x12abc4[_0x8d44('0x4d')]=_0x8d44('0x3b');_0x859601=as[_0x8d44('0x6f')](_0x567b3f,_0x11006a[_0x8d44('0x3e')],_0x12abc4);_0x1a031f[_0x3e4ff0](_0x859601[_0x8d44('0x70')],_0x859601[_0x8d44('0x66')][_0x8d44('0x71')],_0x859601['value']['end']);}break;case'body':_0x859601=as['buildExpression']('me',null,_0x12abc4);_0x1a031f[_0x3e4ff0](_0x859601[_0x8d44('0x70')],_0x859601[_0x8d44('0x66')][_0x8d44('0x71')],_0x859601[_0x8d44('0x66')][_0x8d44('0x20')]);break;}}else{var _0x859601=as[_0x8d44('0x6f')](_0x567b3f,_0x11006a['type'],_0x12abc4);_0x1a031f[_0x3e4ff0](_0x859601['text'],_0x859601[_0x8d44('0x66')]['start'],_0x859601[_0x8d44('0x66')][_0x8d44('0x20')]);}}}else{var _0x3c1586=_(_0x3d0c93[_0x8d44('0x40')])[_0x8d44('0x41')]()['map'](function(_0x11f3a4){return _[_0x8d44('0x77')](_0x206f96,[_0x8d44('0x2e'),_0x11f3a4])?_0x11f3a4:undefined;})[_0x8d44('0x78')]()[_0x8d44('0x66')]();if(!_[_0x8d44('0x79')](_0x3c1586)){_0x3c1586[_0x8d44('0x33')](function(_0x1ca381){if(_0x1ca381==='WhatsappAccountId'){_0x54ab7e['where'](_0x8d44('0x7a'),[]['concat'](_0x3d0c93[_0x8d44('0x40')][_0x1ca381]));}else if(_0x1ca381===_0x8d44('0x7b')){var _0x8b82fc=JSON[_0x8d44('0x7c')](_0x3d0c93['query'][_0x1ca381])[_0x8d44('0x7d')];var _0x5cd301=JSON[_0x8d44('0x7c')](_0x3d0c93[_0x8d44('0x40')][_0x1ca381])['$lte'];_0x54ab7e[_0x8d44('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x8b82fc,_0x5cd301);}else{if(_0x3d0c93[_0x8d44('0x40')][_0x1ca381]==='null'){_0x54ab7e[_0x8d44('0x4a')]('i.'+_0x1ca381+'\x20IS\x20NULL');}else{_0x54ab7e['where']('i.'+_0x1ca381+_0x8d44('0x7e'),_0x3d0c93[_0x8d44('0x40')][_0x1ca381]);}}});}if(_0x3d0c93['query'][_0x8d44('0x7f')]){if(_0x3d0c93[_0x8d44('0x40')]['read']==0x1){_0x54ab7e[_0x8d44('0x67')](_0x8d44('0x80'));}else{_0x54ab7e['having'](_0x8d44('0x81'));}}if(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x82')]){_0x3ca432=_[_0x8d44('0x83')](_0x3d0c93['query'][_0x8d44('0x82')])?_0x3d0c93[_0x8d44('0x40')]['tag']:new Array(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x82')]);_0x3ca432['forEach'](function(_0x41f271){_0x403967['or'](_0x8d44('0x73'),'%,'+_0x41f271+',%');});}if(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x84')]){var _0x13a7b0=_0x3d0c93['query'][_0x8d44('0x84')]['replace']('\x5c','\x5c\x5c')[_0x8d44('0x85')](/'/g,'\x27\x27');if(qs[_0x8d44('0x86')](_0x13a7b0)){_0x1a031f['or'](_0x8d44('0x87'),_0x13a7b0+'%')['or'](_0x8d44('0x88'),_0x13a7b0+'%');}else{_0x1a031f['or'](_0x8d44('0x89'),qs[_0x8d44('0x6c')](_0x13a7b0))['or'](_0x8d44('0x8a'),_0x13a7b0+'%');}}}_0x54ab7e[_0x8d44('0x4a')](_0x1a031f);_0x54ab7e['group']('i.id');var _0x213545={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x4dfd25=_0x54ab7e[_0x8d44('0x8b')]();_0x4dfd25[_0x8d44('0x4d')](_0x8d44('0x8c'));_0x4dfd25[_0x8d44('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8d44('0x65'));if(_0x23cc9f[_0x8d44('0x48')]){_0x23cc9f['order'][_0x8d44('0x33')](function(_0x3ea4d6){var _0x4aab8f=_0x3ea4d6[0x0]===_0x8d44('0x8d')?_0x3ea4d6[0x0]:'i.'+_0x3ea4d6[0x0];_0x54ab7e['order'](_0x4aab8f,_0x3ea4d6[0x1]===_0x8d44('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x3ca432)){_0x54ab7e[_0x8d44('0x67')](_0x403967);_0x4dfd25[_0x8d44('0x4a')](_0x8d44('0x8f'),_0x3ca432);}BPromise[_0x8d44('0x90')]()[_0x8d44('0x2b')](function(){if(!_0x323d64){if(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x91')])return;_0x4dfd25['where'](_0x8d44('0x92'));_0x54ab7e[_0x8d44('0x4a')](_0x8d44('0x92'));return;}if(_0x3d0c93[_0x8d44('0x93')][_0x8d44('0x94')]!==_0x8d44('0x95'))return;return _0x3d0c93[_0x8d44('0x93')][_0x8d44('0x96')]({'attributes':['id'],'raw':!![]})[_0x8d44('0x2b')](function(_0x65961f){if(_[_0x8d44('0x79')](_0x65961f)){_0x4dfd25[_0x8d44('0x4a')]('i.WhatsappAccountId\x20IS\x20NULL');_0x54ab7e[_0x8d44('0x4a')](_0x8d44('0x97'));}else{_0x4dfd25['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x8d44('0x30')](_0x65961f,'id'));_0x54ab7e['where'](_0x8d44('0x7a'),_[_0x8d44('0x30')](_0x65961f,'id'));}});})[_0x8d44('0x2b')](function(){if(_0x3d0c93[_0x8d44('0x93')][_0x8d44('0x94')]===_0x8d44('0x95')&&!_0x323d64&&!_0x3d0c93[_0x8d44('0x40')]['WhatsappAccountId'])return[];return db['sequelize']['query'](_0x4dfd25['toString'](),_0x213545);})['then'](function(_0xb9ecd9){_0x295f48[_0x8d44('0x25')]=_0xb9ecd9[_0x8d44('0x45')];if(_0x295f48[_0x8d44('0x25')]===0x0)return[];return db[_0x8d44('0x98')][_0x8d44('0x40')](_0x29b30f[_0x8d44('0x99')](),_0x213545)[_0x8d44('0x2b')](function(_0x556d64){_0x44655a=_[_0x8d44('0x9a')](_0x556d64,'id');_0x213545=_[_0x8d44('0x9b')](_0x213545,{'model':db[_0x8d44('0x9c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d0c93[_0x8d44('0x40')][_0x8d44('0x44')]){_0x23cc9f[_0x8d44('0x43')]['forEach'](function(_0x4ba2d0){_0x54ab7e['field']('i.'+_0x4ba2d0);});}else{_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0x9d'),_0x8d44('0x65'));_0x54ab7e[_0x8d44('0x4d')]('a.key',_0x8d44('0x9e'));_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0x9f'),'Account.mandatoryDisposition');_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xa0'),_0x8d44('0x8d'));_0x54ab7e[_0x8d44('0x4d')]('i.*');_0x54ab7e['field'](_0x8d44('0xa1'),_0x8d44('0xa2'));_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xa3'),'Contact.lastName');_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xa4'),_0x8d44('0xa5'));_0x54ab7e['field'](_0x8d44('0xa6'),'Contact.phone');_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xa7'),'Contact.mobile');_0x54ab7e[_0x8d44('0x4d')]('c.fax',_0x8d44('0xa8'));_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xa9'),_0x8d44('0xaa'));_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xab'),_0x8d44('0xac'));_0x54ab7e[_0x8d44('0x4d')](_0x8d44('0xad'),_0x8d44('0x31'));}if(_0x23cc9f[_0x8d44('0x23')])_0x54ab7e[_0x8d44('0x23')](_0x23cc9f[_0x8d44('0x23')]);if(_0x23cc9f[_0x8d44('0x22')])_0x54ab7e['offset'](_0x23cc9f[_0x8d44('0x22')]);return db[_0x8d44('0x98')]['query'](_0x54ab7e[_0x8d44('0x99')](),_0x213545);})[_0x8d44('0x2b')](function(_0x4c01e3){if(_0x4c01e3[_0x8d44('0x45')]>0x0)_0x3e3680[_0x8d44('0x4a')](_0x8d44('0xae'),_[_0x8d44('0x30')](_0x4c01e3,'id'));return db[_0x8d44('0x98')][_0x8d44('0x40')](_0x3e3680[_0x8d44('0x99')](),_0x213545)[_0x8d44('0x2b')](function(_0x1d73f8){var _0x5f42ac=_[_0x8d44('0xaf')](_0x1d73f8,_0x8d44('0xb0'));var _0x49c6d1=[];_0x4c01e3[_0x8d44('0x33')](function(_0x439c28){_0x49c6d1[_0x8d44('0x34')](updateWhatsappInteraction(_0x439c28,_0x44655a,_0x5f42ac));});return BPromise[_0x8d44('0xb1')](_0x49c6d1);});});})['then'](function(_0x403087){_0x295f48[_0x8d44('0xb2')]=_0x403087;return _0x295f48;})[_0x8d44('0x2b')](respondWithFilteredResult(_0x58c41e,_0x23cc9f))['catch'](handleError(_0x58c41e,null));};exports[_0x8d44('0xb3')]=function(_0x5c6130,_0x4c0f99){var _0x5b3d6d={'raw':![],'where':{'id':_0x5c6130[_0x8d44('0xb4')]['id']}},_0x4e0844={};_0x4e0844[_0x8d44('0x3f')]=_[_0x8d44('0x41')](db[_0x8d44('0x9c')][_0x8d44('0xb5')]);_0x4e0844[_0x8d44('0x40')]=_[_0x8d44('0x41')](_0x5c6130[_0x8d44('0x40')]);_0x4e0844[_0x8d44('0x4b')]=_['intersection'](_0x4e0844[_0x8d44('0x3f')],_0x4e0844[_0x8d44('0x40')]);_0x5b3d6d['attributes']=_[_0x8d44('0x42')](_0x4e0844[_0x8d44('0x3f')],qs[_0x8d44('0x44')](_0x5c6130['query'][_0x8d44('0x44')]));_0x5b3d6d[_0x8d44('0x43')]=_0x5b3d6d[_0x8d44('0x43')]['length']?_0x5b3d6d[_0x8d44('0x43')]:_0x4e0844[_0x8d44('0x3f')];if(_0x5c6130['query']['includeAll']){_0x5b3d6d[_0x8d44('0xb6')]=[{'all':!![]}];}_0x5b3d6d=_['merge']({},_0x5b3d6d,_0x5c6130[_0x8d44('0xb7')]);return db[_0x8d44('0x9c')][_0x8d44('0x64')](_0x5b3d6d)['then'](handleEntityNotFound(_0x4c0f99,null))['then'](respondWithResult(_0x4c0f99,null))['catch'](handleError(_0x4c0f99,null));};exports[_0x8d44('0xb8')]=function(_0x3aeabe,_0x1e0611){return db[_0x8d44('0x9c')][_0x8d44('0xb8')](_0x3aeabe[_0x8d44('0xb9')],{})[_0x8d44('0x2b')](respondWithResult(_0x1e0611,0xc9))['catch'](handleError(_0x1e0611,null));};exports['update']=function(_0x3e4a20,_0x2548e4){if(_0x3e4a20[_0x8d44('0xb9')]['id']){delete _0x3e4a20[_0x8d44('0xb9')]['id'];}return db[_0x8d44('0x9c')][_0x8d44('0x64')]({'where':{'id':_0x3e4a20['params']['id']}})[_0x8d44('0x2b')](handleEntityNotFound(_0x2548e4,null))[_0x8d44('0x2b')](saveUpdates(_0x3e4a20[_0x8d44('0xb9')],null))[_0x8d44('0x2b')](respondWithResult(_0x2548e4,null))[_0x8d44('0x35')](handleError(_0x2548e4,null));};exports[_0x8d44('0x2c')]=function(_0x46591e,_0x357478){return db['WhatsappInteraction'][_0x8d44('0x64')]({'where':{'id':_0x46591e[_0x8d44('0xb4')]['id']}})['then'](handleEntityNotFound(_0x357478,null))[_0x8d44('0x2b')](removeEntity(_0x357478,null))[_0x8d44('0x35')](handleError(_0x357478,null));};exports[_0x8d44('0xba')]=function(_0x1e22de,_0x4dd0c5){return db[_0x8d44('0x9c')]['describe']()['then'](respondWithResult(_0x4dd0c5,null))[_0x8d44('0x35')](handleError(_0x4dd0c5,null));};exports[_0x8d44('0xbb')]=function(_0x531ee8,_0x23f404,_0x4ed8e8){return db[_0x8d44('0xbc')][_0x8d44('0x64')]({'where':{'id':_0x531ee8[_0x8d44('0xb4')]['id']}})[_0x8d44('0x2b')](handleEntityNotFound(_0x23f404,null))[_0x8d44('0x2b')](function(_0x46d4c6){if(_0x46d4c6){return _0x46d4c6[_0x8d44('0xbb')](_0x531ee8['body'][_0x8d44('0xbd')],_[_0x8d44('0xbe')](_0x531ee8[_0x8d44('0xb9')],[_0x8d44('0xbd'),'id'])||{});}})[_0x8d44('0x2b')](respondWithResult(_0x23f404,null))[_0x8d44('0x35')](handleError(_0x23f404,null));};exports[_0x8d44('0xbf')]=function(_0x264936,_0x53d07a,_0x268e1e){var _0x244fb5={'raw':![],'where':{}};var _0x3cf069={};var _0x4ccc88={'count':0x0,'rows':[]};return db[_0x8d44('0x9c')]['findOne']({'where':{'id':_0x264936[_0x8d44('0xb4')]['id']}})[_0x8d44('0x2b')](handleEntityNotFound(_0x53d07a,null))[_0x8d44('0x2b')](function(_0x22b8f9){if(_0x22b8f9){_0x3cf069['model']=_[_0x8d44('0x41')](db['WhatsappMessage'][_0x8d44('0xb5')]);_0x3cf069[_0x8d44('0x40')]=_[_0x8d44('0x41')](_0x264936[_0x8d44('0x40')]);_0x3cf069[_0x8d44('0x4b')]=_['intersection'](_0x3cf069[_0x8d44('0x3f')],_0x3cf069[_0x8d44('0x40')]);_0x244fb5[_0x8d44('0x43')]=_[_0x8d44('0x42')](_0x3cf069['model'],qs['fields'](_0x264936[_0x8d44('0x40')][_0x8d44('0x44')]));_0x244fb5['attributes']=_0x244fb5['attributes']['length']?_0x244fb5['attributes']:_0x3cf069[_0x8d44('0x3f')];if(!_0x264936['query'][_0x8d44('0x46')]('nolimit')){_0x244fb5['limit']=qs[_0x8d44('0x23')](_0x264936[_0x8d44('0x40')][_0x8d44('0x23')]);_0x244fb5['offset']=qs[_0x8d44('0x22')](_0x264936[_0x8d44('0x40')]['offset']);}_0x244fb5['order']=qs[_0x8d44('0x49')](_0x264936[_0x8d44('0x40')]['sort']);_0x244fb5[_0x8d44('0x4a')]=qs[_0x8d44('0x4b')](_[_0x8d44('0x4c')](_0x264936['query'],_0x3cf069[_0x8d44('0x4b')]));_0x244fb5[_0x8d44('0x4a')][_0x8d44('0xb0')]=_0x22b8f9['id'];if(_0x264936[_0x8d44('0x40')][_0x8d44('0x84')]){_0x244fb5['where']=_[_0x8d44('0x9b')](_0x244fb5[_0x8d44('0x4a')],{'$or':_[_0x8d44('0x30')](_0x244fb5['attributes'],function(_0x2dfcb0){var _0x42de1a={};_0x42de1a[_0x2dfcb0]={'$like':'%'+_0x264936[_0x8d44('0x40')][_0x8d44('0x84')]+'%'};return _0x42de1a;})});}if(_0x264936[_0x8d44('0x40')][_0x8d44('0x7d')]){var _0x3da2e5=_0x264936[_0x8d44('0x40')][_0x8d44('0x7d')][_0x8d44('0x32')](',');var _0x452e9e={};_0x452e9e[_0x3da2e5[0x0]]={'$gte':moment(_0x3da2e5[0x1])[_0x8d44('0xc0')](_0x8d44('0xc1'))};_0x244fb5['where']=_[_0x8d44('0x9b')](_0x244fb5[_0x8d44('0x4a')],_0x452e9e);}_0x244fb5=_[_0x8d44('0x9b')]({},_0x244fb5,_0x264936[_0x8d44('0xb7')]);return db[_0x8d44('0xbc')][_0x8d44('0x25')]({'where':_0x244fb5['where']})['then'](function(_0x5e75ab){_0x4ccc88['count']=_0x5e75ab;if(_0x264936[_0x8d44('0x40')]['includeAll']){_0x244fb5[_0x8d44('0xb6')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8d44('0xc2')](_0x244fb5);})[_0x8d44('0x2b')](function(_0x1d138d){_0x4ccc88['rows']=_0x1d138d;return _0x4ccc88;});}})['then'](respondWithFilteredResult(_0x53d07a,_0x244fb5))['catch'](handleError(_0x53d07a,null));};exports['addTags']=function(_0x3552d1,_0x1effe4,_0x29afe5){return db[_0x8d44('0x9c')][_0x8d44('0x64')]({'where':{'id':_0x3552d1[_0x8d44('0xb4')]['id']}})[_0x8d44('0x2b')](handleEntityNotFound(_0x1effe4,null))[_0x8d44('0x2b')](function(_0xc9c8a5){if(_0xc9c8a5){return _0xc9c8a5[_0x8d44('0xc3')](_0x3552d1[_0x8d44('0xb9')][_0x8d44('0xbd')],_[_0x8d44('0xbe')](_0x3552d1[_0x8d44('0xb9')],[_0x8d44('0xbd'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x8d44('0x2e'),_0x8d44('0xc4')],'where':{'id':_0x3552d1[_0x8d44('0xb9')]['ids']}});})[_0x8d44('0x2b')](function(_0x51f926){socket[_0x8d44('0xc5')](_0x8d44('0xc6'),{'id':Number(_0x3552d1[_0x8d44('0xb4')]['id']),'tags':_0x51f926||[]});return{'id':Number(_0x3552d1['params']['id']),'tags':_0x51f926||[]};});}})['then'](respondWithResult(_0x1effe4,null))[_0x8d44('0x35')](handleError(_0x1effe4,null));};exports[_0x8d44('0xc7')]=function(_0x774524,_0x2b2d64,_0x394001){return db[_0x8d44('0x9c')]['find']({'where':{'id':_0x774524['params']['id']}})[_0x8d44('0x2b')](handleEntityNotFound(_0x2b2d64,null))['then'](function(_0x2293c4){if(_0x2293c4){return _0x2293c4[_0x8d44('0xc7')](_0x774524[_0x8d44('0x40')][_0x8d44('0xbd')]);}})[_0x8d44('0x2b')](respondWithStatusCode(_0x2b2d64,null))['catch'](handleError(_0x2b2d64,null));};exports[_0x8d44('0xc8')]=function(_0x30365,_0x70308f){var _0x411c15=moment()['unix']()['toString']();var _0x26f979=path[_0x8d44('0xc9')](config['root'],'server',_0x8d44('0xca'),'tmp');var _0x5e08ce=path['join'](config[_0x8d44('0xcb')],_0x8d44('0xcc'),'files','attachments');var _0x41c44b=path[_0x8d44('0xc9')](_0x26f979,_0x411c15);var _0x5f062d=util['format'](_0x8d44('0xcd'),_0x30365['params']['id'],_0x411c15);var _0x5b3ebf=path[_0x8d44('0xc9')](_0x26f979,_0x5f062d);var _0x4c62e6=[];_0x4c62e6[_0x8d44('0x34')]({'model':db[_0x8d44('0xce')],'as':_0x8d44('0xce'),'attributes':['id',_0x8d44('0xcf')],'raw':!![]});_0x4c62e6['push']({'model':db[_0x8d44('0xd0')],'as':'Contact','attributes':['id','firstName',_0x8d44('0xd1')],'raw':!![]});if(_0x30365[_0x8d44('0x40')][_0x8d44('0xd2')]){_0x4c62e6[_0x8d44('0x34')]({'model':db[_0x8d44('0xd3')],'as':'Attachment','raw':!![]});}var _0x3075a3=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x8d44('0xb9'),'createdAt',_0x8d44('0xd4'),_0x8d44('0xd5'),_0x8d44('0x7f')],'include':_0x4c62e6}];_0x3075a3[_0x8d44('0x34')]({'model':db[_0x8d44('0xd6')],'as':_0x8d44('0xd7'),'attributes':['id',_0x8d44('0x2e')]});_0x3075a3[_0x8d44('0x34')]({'model':db[_0x8d44('0xce')],'as':'Owner','attributes':['id',_0x8d44('0xcf')]});return db['WhatsappInteraction'][_0x8d44('0x64')]({'where':{'id':_0x30365[_0x8d44('0xb4')]['id']},'include':_0x3075a3})[_0x8d44('0x2b')](handleEntityNotFound(_0x70308f,null))[_0x8d44('0x2b')](function(_0x4cb9ac){if(_0x4cb9ac){var _0xe81635=_0x4cb9ac['get']({'plain':!![]});fs[_0x8d44('0xd8')](_0x41c44b);var _0x2dfe5a={'channel':_0x8d44('0xd9'),'account':_0xe81635[_0x8d44('0xd7')][_0x8d44('0x2e')],'agent':_0xe81635[_0x8d44('0xda')]?_0xe81635[_0x8d44('0xda')]['fullname']:_0x8d44('0xdb'),'createdAt':moment(_0xe81635[_0x8d44('0x7b')])[_0x8d44('0xc0')](_0x8d44('0xc1'))['toString'](),'closedAt':_0xe81635[_0x8d44('0x3c')]?moment(_0xe81635[_0x8d44('0xdc')])[_0x8d44('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8d44('0x99')]():'','disposition':_0xe81635[_0x8d44('0xdd')],'messages':_(_0xe81635[_0x8d44('0xde')])['filter']({'secret':![]})[_0x8d44('0x30')](function(_0x3232d4){if(_0x3232d4['Attachment']){var _0x256833=path[_0x8d44('0xc9')](_0x5e08ce,_0x3232d4[_0x8d44('0xd3')][_0x8d44('0xdf')]);if(fs['existsSync'](_0x256833)){fs[_0x8d44('0xe0')](_0x256833)[_0x8d44('0xe1')](fs['createWriteStream'](path['join'](_0x41c44b,_0x3232d4[_0x8d44('0xd3')][_0x8d44('0xdf')])));}}return{'date':moment(_0x3232d4[_0x8d44('0x7b')])['format'](_0x8d44('0xc1'))[_0x8d44('0x99')](),'sender':_0x3232d4[_0x8d44('0xd4')]===_0x8d44('0xe2')?_0x3232d4['User']?_0x3232d4[_0x8d44('0xce')][_0x8d44('0xcf')]:_0x8d44('0xe3'):_0x3232d4[_0x8d44('0xe4')][_0x8d44('0xe5')]+(_0x3232d4[_0x8d44('0xe4')][_0x8d44('0xd1')]?'\x20'+_0x3232d4['Contact']['lastName']:''),'body':_0x3232d4['Attachment']?_0x3232d4[_0x8d44('0xd3')][_0x8d44('0xdf')]:_0x3232d4['body'],'direction':_0x3232d4[_0x8d44('0xd4')]==='out'?'A':'C','secret':_0x3232d4[_0x8d44('0xd5')],'read':_0x3232d4[_0x8d44('0x7f')],'attachment':_0x3232d4[_0x8d44('0xd3')]};})[_0x8d44('0x66')]()};return ejs['renderFile'](path['join'](config['root'],_0x8d44('0xcc'),_0x8d44('0xe6'),'downloadInteraction.ejs'),{'interaction':_0x2dfe5a})[_0x8d44('0x2b')](function(_0x28a20c){var _0x5dd743=path[_0x8d44('0xc9')](_0x41c44b,_0x8d44('0xe7')+_0xe81635['id']+'-'+_0x411c15+'.pdf');var _0x3a0aea={'path':_0x5dd743,'channel':_0x8d44('0xd9'),'interactionId':_0xe81635['id']};return pdf[_0x8d44('0xe8')](_0x28a20c,_0x3a0aea);})[_0x8d44('0x2b')](function(){return new BPromise(function(_0x3faae1,_0x320817){zipdir(_0x41c44b,{'saveTo':_0x5b3ebf},function(_0x35dd38,_0x3838bd){if(_0x35dd38)return _0x320817(_0x35dd38);return _0x3faae1(_0x3838bd);});})['then'](function(){return new BPromise(function(_0x2af327,_0x537172){rimraf(_0x41c44b,function(_0x2c34dd){if(_0x2c34dd)_0x537172(_0x2c34dd);return _0x2af327();});});})[_0x8d44('0x2b')](function(){return _0x70308f['download'](_0x5b3ebf,_0x5f062d,function(_0x46f6bc){if(_0x46f6bc){console[_0x8d44('0xe9')]('err',_0x46f6bc);}else{fs[_0x8d44('0xea')](_0x5b3ebf);}});});});}else{return _0x70308f[_0x8d44('0x1e')](0xc8);}})[_0x8d44('0x35')](handleError(_0x70308f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index db6dcff..5d66448 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 _0x97c1=['hasOwnProperty','hook','events','../../mysqldb','save','update','remove','getUsers','then','setDataValue','unreadMessages','emit','catch'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0x97c1,0xdf));var _0x197c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x97c1[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x197c('0x0'));var WhatsappInteraction=require(_0x197c('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x197c('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x197c('0x2'),'afterUpdate':_0x197c('0x3'),'afterDestroy':_0x197c('0x4')};function emitEvent(_0x37ac05){return function(_0x40863c,_0x4a6f09,_0x5cbff6){_0x40863c[_0x197c('0x5')]({'attributes':['id'],'raw':!![]})[_0x197c('0x6')](function(_0x60fab2){_0x40863c[_0x197c('0x7')]('Users',_0x60fab2['map'](function(_0x4e126e){return{'id':_0x4e126e['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x40863c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x197c('0x6')](function(_0x3e83e6){_0x40863c[_0x197c('0x7')](_0x197c('0x8'),_0x3e83e6['length']);WhatsappInteractionEvents[_0x197c('0x9')](_0x37ac05+':'+_0x40863c['id'],_0x40863c);WhatsappInteractionEvents[_0x197c('0x9')](_0x37ac05,_0x40863c);_0x5cbff6(null);})[_0x197c('0xa')](_0x5cbff6(null));};}for(var e in events){if(events[_0x197c('0xb')](e)){var event=events[e];WhatsappInteraction[_0x197c('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2f68=['WhatsappMessage','save','remove','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','../../mysqldb','WhatsappInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f68,0x9a));var _0x82f6=function(_0x192775,_0x364489){_0x192775=_0x192775-0x0;var _0x28f393=_0x2f68[_0x192775];return _0x28f393;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x82f6('0x0'))['db'][_0x82f6('0x1')];var WhatsappMessage=require(_0x82f6('0x0'))['db'][_0x82f6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82f6('0x3'),'afterUpdate':'update','afterDestroy':_0x82f6('0x4')};function emitEvent(_0x2ab73d){return function(_0x5dad09,_0x3ad120,_0x2c4302){_0x5dad09['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1bc0be){_0x5dad09['setDataValue']('Users',_0x1bc0be[_0x82f6('0x5')](function(_0xbd30d5){return{'id':_0xbd30d5['id']};}));return WhatsappMessage[_0x82f6('0x6')]({'where':{'WhatsappInteractionId':_0x5dad09['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x27db58){_0x5dad09[_0x82f6('0x7')]('unreadMessages',_0x27db58[_0x82f6('0x8')]);WhatsappInteractionEvents[_0x82f6('0x9')](_0x2ab73d+':'+_0x5dad09['id'],_0x5dad09);WhatsappInteractionEvents[_0x82f6('0x9')](_0x2ab73d,_0x5dad09);_0x2c4302(null);})[_0x82f6('0xa')](_0x2c4302(null));};}for(var e in events){if(events[_0x82f6('0xb')](e)){var event=events[e];WhatsappInteraction[_0x82f6('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index ecfa29b..b8e8e73 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 _0x0e9c=['whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','WhatsappInteraction'];(function(_0x27a708,_0x55f6cc){var _0xcf516f=function(_0x344ab7){while(--_0x344ab7){_0x27a708['push'](_0x27a708['shift']());}};_0xcf516f(++_0x55f6cc);}(_0x0e9c,0x1d6));var _0xc0e9=function(_0xbebce0,_0x3bb745){_0xbebce0=_0xbebce0-0x0;var _0x3ac9b6=_0x0e9c[_0xbebce0];return _0x3ac9b6;};'use strict';var _=require(_0xc0e9('0x0'));var util=require(_0xc0e9('0x1'));var logger=require(_0xc0e9('0x2'))(_0xc0e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0e9('0x4'));var fs=require('fs');var path=require(_0xc0e9('0x5'));var rimraf=require('rimraf');var config=require(_0xc0e9('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0xc0e9('0x7')]=function(_0x3644fd,_0x43b5ac){return _0x3644fd[_0xc0e9('0x8')](_0xc0e9('0x9'),attributes,{'tableName':_0xc0e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x556c9f,_0x194cb7,_0x81141b){if(_0x556c9f[_0xc0e9('0xb')](_0xc0e9('0xc'))){_0x556c9f[_0xc0e9('0xd')]=moment()['format'](_0xc0e9('0xe'));}_0x81141b(null,_0x556c9f);}}});}; \ No newline at end of file +var _0x0aaa=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x0aaa,0x160));var _0xa0aa=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0x0aaa[_0x121886];return _0x20ca01;};'use strict';var _=require(_0xa0aa('0x0'));var util=require(_0xa0aa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0aa('0x2'));var BPromise=require(_0xa0aa('0x3'));var rp=require(_0xa0aa('0x4'));var fs=require('fs');var path=require(_0xa0aa('0x5'));var rimraf=require(_0xa0aa('0x6'));var config=require(_0xa0aa('0x7'));var attributes=require(_0xa0aa('0x8'));module['exports']=function(_0xc40bc,_0x5f3aeb){return _0xc40bc[_0xa0aa('0x9')]('WhatsappInteraction',attributes,{'tableName':_0xa0aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e523c,_0x258bbf,_0x1a2e65){if(_0x4e523c[_0xa0aa('0xb')](_0xa0aa('0xc'))){_0x4e523c[_0xa0aa('0xd')]=moment()[_0xa0aa('0xe')](_0xa0aa('0xf'));}_0x1a2e65(null,_0x4e523c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 1698023..5013625 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 _0xde29=['options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','update','body'];(function(_0x16cac5,_0x28ea09){var _0x12a470=function(_0x97edcd){while(--_0x97edcd){_0x16cac5['push'](_0x16cac5['shift']());}};_0x12a470(++_0x28ea09);}(_0xde29,0x175));var _0x9de2=function(_0x277ffd,_0x4c8062){_0x277ffd=_0x277ffd-0x0;var _0x5ca156=_0xde29[_0x277ffd];return _0x5ca156;};'use strict';var _=require(_0x9de2('0x0'));var util=require(_0x9de2('0x1'));var moment=require(_0x9de2('0x2'));var BPromise=require(_0x9de2('0x3'));var rs=require(_0x9de2('0x4'));var fs=require('fs');var Redis=require(_0x9de2('0x5'));var db=require(_0x9de2('0x6'))['db'];var utils=require(_0x9de2('0x7'));var logger=require(_0x9de2('0x8'))(_0x9de2('0x9'));var config=require('../../config/environment');var jayson=require(_0x9de2('0xa'));var client=jayson['client'][_0x9de2('0xb')]({'port':0x232a});config['redis']=_[_0x9de2('0xc')](config[_0x9de2('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de2('0xe'))(new Redis(config['redis']));require(_0x9de2('0xf'))[_0x9de2('0x10')](socket);function respondWithRpcPromise(_0x462bb4,_0x148a99,_0x20717c){return new BPromise(function(_0x19d817,_0x44d236){return client[_0x9de2('0x11')](_0x462bb4,_0x20717c)[_0x9de2('0x12')](function(_0x3bbd8d){logger[_0x9de2('0x13')](_0x9de2('0x14'),_0x148a99,_0x9de2('0x15'));logger['debug'](_0x9de2('0x16'),_0x148a99,_0x9de2('0x15'),JSON[_0x9de2('0x17')](_0x3bbd8d));if(_0x3bbd8d[_0x9de2('0x18')]){if(_0x3bbd8d[_0x9de2('0x18')][_0x9de2('0x19')]===0x1f4){logger[_0x9de2('0x18')](_0x9de2('0x14'),_0x148a99,_0x3bbd8d[_0x9de2('0x18')][_0x9de2('0x1a')]);return _0x44d236(_0x3bbd8d[_0x9de2('0x18')]['message']);}logger[_0x9de2('0x18')](_0x9de2('0x14'),_0x148a99,_0x3bbd8d[_0x9de2('0x18')][_0x9de2('0x1a')]);return _0x19d817(_0x3bbd8d[_0x9de2('0x18')][_0x9de2('0x1a')]);}else{logger[_0x9de2('0x13')](_0x9de2('0x14'),_0x148a99,_0x9de2('0x15'));_0x19d817(_0x3bbd8d[_0x9de2('0x1b')][_0x9de2('0x1a')]);}})[_0x9de2('0x1c')](function(_0x220e6e){logger[_0x9de2('0x18')](_0x9de2('0x14'),_0x148a99,_0x220e6e);_0x44d236(_0x220e6e);});});}exports[_0x9de2('0x1d')]=function(_0x23fab2){var _0x56d92b=this;return new Promise(function(_0x3ab1ed,_0x5caa30){return db['WhatsappInteraction'][_0x9de2('0x1e')](_0x23fab2[_0x9de2('0x1f')],{'raw':_0x23fab2[_0x9de2('0x20')]?_0x23fab2[_0x9de2('0x20')][_0x9de2('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fab2['options']?_0x23fab2[_0x9de2('0x20')][_0x9de2('0x22')]||null:null,'attributes':_0x23fab2['options']?_0x23fab2['options'][_0x9de2('0x23')]||null:null,'limit':_0x23fab2['options']?_0x23fab2[_0x9de2('0x20')][_0x9de2('0x24')]||null:null})[_0x9de2('0x12')](function(_0x1f4c4a){logger[_0x9de2('0x13')](_0x9de2('0x1d'),_0x23fab2);logger[_0x9de2('0x25')]('UpdateWhatsappInteraction',_0x23fab2,JSON[_0x9de2('0x17')](_0x1f4c4a));_0x3ab1ed(_0x1f4c4a);})['catch'](function(_0x321474){logger[_0x9de2('0x18')](_0x9de2('0x1d'),_0x321474[_0x9de2('0x1a')],_0x23fab2);_0x5caa30(_0x56d92b[_0x9de2('0x18')](0x1f4,_0x321474[_0x9de2('0x1a')]));});});};exports[_0x9de2('0x26')]=function(_0x10a43b){return new Promise(function(_0x2fb2f2,_0x16b052){return db[_0x9de2('0x27')]['find']({'where':_0x10a43b[_0x9de2('0x20')]?_0x10a43b[_0x9de2('0x20')][_0x9de2('0x22')]||null:null})['then'](function(_0xcad11d){if(_0xcad11d){return _0xcad11d[_0x9de2('0x28')](_0x10a43b[_0x9de2('0x1f')]['ids'],_[_0x9de2('0x29')](_0x10a43b[_0x9de2('0x1f')],[_0x9de2('0x2a'),'id'])||{});}})[_0x9de2('0x2b')](function(_0x4b7e5d){logger[_0x9de2('0x13')](_0x9de2('0x2c'),_0x10a43b);logger[_0x9de2('0x25')](_0x9de2('0x2c'),_0x10a43b,JSON[_0x9de2('0x17')](_0x4b7e5d));_0x2fb2f2(_0x4b7e5d);})[_0x9de2('0x1c')](function(_0x259111){logger[_0x9de2('0x18')]('AddTags',_0x259111['message'],_0x10a43b);_0x16b052(_this[_0x9de2('0x18')](0x1f4,_0x259111[_0x9de2('0x1a')]));});});}; \ No newline at end of file +var _0x4047=['info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','WhatsappInteraction','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','stringify','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then'];(function(_0x20dbd7,_0x308f69){var _0xec1ab1=function(_0x1e4b5b){while(--_0x1e4b5b){_0x20dbd7['push'](_0x20dbd7['shift']());}};_0xec1ab1(++_0x308f69);}(_0x4047,0x9c));var _0x7404=function(_0x3d8291,_0x560e85){_0x3d8291=_0x3d8291-0x0;var _0x2bad5c=_0x4047[_0x3d8291];return _0x2bad5c;};'use strict';var _=require(_0x7404('0x0'));var util=require(_0x7404('0x1'));var moment=require(_0x7404('0x2'));var BPromise=require(_0x7404('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7404('0x4'));var db=require(_0x7404('0x5'))['db'];var utils=require(_0x7404('0x6'));var logger=require(_0x7404('0x7'))(_0x7404('0x8'));var config=require(_0x7404('0x9'));var jayson=require(_0x7404('0xa'));var client=jayson[_0x7404('0xb')][_0x7404('0xc')]({'port':0x232a});config[_0x7404('0xd')]=_[_0x7404('0xe')](config['redis'],{'host':_0x7404('0xf'),'port':0x18eb});var socket=require(_0x7404('0x10'))(new Redis(config[_0x7404('0xd')]));require(_0x7404('0x11'))[_0x7404('0x12')](socket);function respondWithRpcPromise(_0x296d00,_0x2c99f3,_0x540c53){return new BPromise(function(_0x5c7d1f,_0x304984){return client['request'](_0x296d00,_0x540c53)[_0x7404('0x13')](function(_0x5253c4){logger[_0x7404('0x14')](_0x7404('0x15'),_0x2c99f3,'request\x20sent');logger[_0x7404('0x16')](_0x7404('0x17'),_0x2c99f3,_0x7404('0x18'),JSON['stringify'](_0x5253c4));if(_0x5253c4['error']){if(_0x5253c4['error'][_0x7404('0x19')]===0x1f4){logger[_0x7404('0x1a')](_0x7404('0x15'),_0x2c99f3,_0x5253c4[_0x7404('0x1a')][_0x7404('0x1b')]);return _0x304984(_0x5253c4['error']['message']);}logger[_0x7404('0x1a')](_0x7404('0x15'),_0x2c99f3,_0x5253c4[_0x7404('0x1a')][_0x7404('0x1b')]);return _0x5c7d1f(_0x5253c4['error'][_0x7404('0x1b')]);}else{logger['info'](_0x7404('0x15'),_0x2c99f3,_0x7404('0x18'));_0x5c7d1f(_0x5253c4['result'][_0x7404('0x1b')]);}})[_0x7404('0x1c')](function(_0x4b3153){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x2c99f3,_0x4b3153);_0x304984(_0x4b3153);});});}exports['UpdateWhatsappInteraction']=function(_0xcc1ace){var _0x431565=this;return new Promise(function(_0x2f52a7,_0x55ce08){return db[_0x7404('0x1d')]['update'](_0xcc1ace[_0x7404('0x1e')],{'raw':_0xcc1ace[_0x7404('0x1f')]?_0xcc1ace[_0x7404('0x1f')][_0x7404('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcc1ace['options']?_0xcc1ace[_0x7404('0x1f')][_0x7404('0x21')]||null:null,'attributes':_0xcc1ace['options']?_0xcc1ace[_0x7404('0x1f')][_0x7404('0x22')]||null:null,'limit':_0xcc1ace['options']?_0xcc1ace['options'][_0x7404('0x23')]||null:null})['then'](function(_0x2b1564){logger['info'](_0x7404('0x24'),_0xcc1ace);logger[_0x7404('0x16')](_0x7404('0x24'),_0xcc1ace,JSON[_0x7404('0x25')](_0x2b1564));_0x2f52a7(_0x2b1564);})[_0x7404('0x1c')](function(_0x6223f9){logger[_0x7404('0x1a')]('UpdateWhatsappInteraction',_0x6223f9[_0x7404('0x1b')],_0xcc1ace);_0x55ce08(_0x431565[_0x7404('0x1a')](0x1f4,_0x6223f9[_0x7404('0x1b')]));});});};exports[_0x7404('0x26')]=function(_0x11c5ea){return new Promise(function(_0x28efc1,_0x169ea7){return db['WhatsappInteraction']['find']({'where':_0x11c5ea['options']?_0x11c5ea[_0x7404('0x1f')][_0x7404('0x21')]||null:null})[_0x7404('0x13')](function(_0x4f1d15){if(_0x4f1d15){return _0x4f1d15[_0x7404('0x27')](_0x11c5ea[_0x7404('0x1e')][_0x7404('0x28')],_[_0x7404('0x29')](_0x11c5ea['body'],[_0x7404('0x28'),'id'])||{});}})[_0x7404('0x2a')](function(_0x271fbd){logger[_0x7404('0x14')](_0x7404('0x2b'),_0x11c5ea);logger['debug'](_0x7404('0x2b'),_0x11c5ea,JSON[_0x7404('0x25')](_0x271fbd));_0x28efc1(_0x271fbd);})[_0x7404('0x1c')](function(_0x9dced8){logger[_0x7404('0x1a')]('AddTags',_0x9dced8[_0x7404('0x1b')],_0x11c5ea);_0x169ea7(_this[_0x7404('0x1a')](0x1f4,_0x9dced8[_0x7404('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 9842615..cc59296 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 _0x5db8=['save','update','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5db8,0x125));var _0x85db=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x5db8[_0x38c699];return _0x3b1ded;};'use strict';var WhatsappInteractionEvents=require(_0x85db('0x0'));var events=[_0x85db('0x1'),'remove',_0x85db('0x2')];function createListener(_0x5bc54a,_0x5815f7){return function(_0x4ee17f){_0x5815f7['emit'](_0x5bc54a,_0x4ee17f);};}function removeListener(_0x2f4f30,_0x9df87a){return function(){WhatsappInteractionEvents[_0x85db('0x3')](_0x2f4f30,_0x9df87a);};}exports[_0x85db('0x4')]=function(_0x7becad){for(var _0x26713a=0x0,_0x84df4a=events[_0x85db('0x5')];_0x26713a<_0x84df4a;_0x26713a++){var _0x33bad3=events[_0x26713a];var _0xbab987=createListener(_0x85db('0x6')+_0x33bad3,_0x7becad);WhatsappInteractionEvents['on'](_0x33bad3,_0xbab987);}}; \ No newline at end of file +var _0xb9ad=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x534fcd,_0x12a909){var _0x39fa16=function(_0x149f80){while(--_0x149f80){_0x534fcd['push'](_0x534fcd['shift']());}};_0x39fa16(++_0x12a909);}(_0xb9ad,0xc8));var _0xdb9a=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb9ad[_0x6c993a];return _0x27f547;};'use strict';var WhatsappInteractionEvents=require(_0xdb9a('0x0'));var events=[_0xdb9a('0x1'),_0xdb9a('0x2'),_0xdb9a('0x3')];function createListener(_0x27c9bd,_0x272655){return function(_0x2ef3a9){_0x272655[_0xdb9a('0x4')](_0x27c9bd,_0x2ef3a9);};}function removeListener(_0x499b5f,_0x178f0d){return function(){WhatsappInteractionEvents[_0xdb9a('0x5')](_0x499b5f,_0x178f0d);};}exports[_0xdb9a('0x6')]=function(_0x1e268){for(var _0x181b66=0x0,_0xca0ecd=events[_0xdb9a('0x7')];_0x181b66<_0xca0ecd;_0x181b66++){var _0xd1602d=events[_0x181b66];var _0x5c8962=createListener(_0xdb9a('0x8')+_0xd1602d,_0x1e268);WhatsappInteractionEvents['on'](_0xd1602d,_0x5c8962);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 8c01387..a97ff79 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 _0x6378=['exports','util','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','destroy'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x6378,0x161));var _0x8637=function(_0x324503,_0x479da1){_0x324503=_0x324503-0x0;var _0x426b1c=_0x6378[_0x324503];return _0x426b1c;};'use strict';var multer=require('multer');var util=require(_0x8637('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8637('0x1'));var config=require('../../config/environment');var controller=require(_0x8637('0x2'));router[_0x8637('0x3')]('/',auth[_0x8637('0x4')](),controller[_0x8637('0x5')]);router[_0x8637('0x3')]('/describe',auth[_0x8637('0x4')](),controller[_0x8637('0x6')]);router['get'](_0x8637('0x7'),auth[_0x8637('0x4')](),controller[_0x8637('0x8')]);router[_0x8637('0x9')]('/',auth[_0x8637('0x4')](),interaction['tracked'](_0x8637('0xa'),_0x8637('0xb')),controller[_0x8637('0xc')]);router[_0x8637('0x9')](_0x8637('0xd'),controller['status']);router[_0x8637('0xe')](_0x8637('0x7'),auth[_0x8637('0x4')](),controller[_0x8637('0xf')]);router[_0x8637('0xe')](_0x8637('0x10'),auth[_0x8637('0x4')](),controller[_0x8637('0x11')]);router[_0x8637('0xe')](_0x8637('0x12'),auth[_0x8637('0x4')](),controller[_0x8637('0x13')]);router['delete'](_0x8637('0x7'),auth[_0x8637('0x4')](),controller[_0x8637('0x14')]);module[_0x8637('0x15')]=router; \ No newline at end of file +var _0x8902=['accept','put','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','/:id/accept'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8902,0x131));var _0x2890=function(_0x1a0fca,_0x5d7228){_0x1a0fca=_0x1a0fca-0x0;var _0x276316=_0x8902[_0x1a0fca];return _0x276316;};'use strict';var multer=require(_0x2890('0x0'));var util=require('util');var path=require(_0x2890('0x1'));var timeout=require(_0x2890('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2890('0x3'));var auth=require(_0x2890('0x4'));var interaction=require(_0x2890('0x5'));var config=require(_0x2890('0x6'));var controller=require('./whatsappMessage.controller');router[_0x2890('0x7')]('/',auth[_0x2890('0x8')](),controller['index']);router[_0x2890('0x7')](_0x2890('0x9'),auth[_0x2890('0x8')](),controller['describe']);router['get'](_0x2890('0xa'),auth['isAuthenticated'](),controller[_0x2890('0xb')]);router[_0x2890('0xc')]('/',auth[_0x2890('0x8')](),interaction[_0x2890('0xd')](_0x2890('0xe'),_0x2890('0xf')),controller[_0x2890('0x10')]);router[_0x2890('0xc')](_0x2890('0x11'),controller[_0x2890('0x12')]);router['put'](_0x2890('0xa'),auth[_0x2890('0x8')](),controller['update']);router['put'](_0x2890('0x13'),auth['isAuthenticated'](),controller[_0x2890('0x14')]);router[_0x2890('0x15')]('/:id/reject',auth[_0x2890('0x8')](),controller['reject']);router[_0x2890('0x16')]('/:id',auth[_0x2890('0x8')](),controller[_0x2890('0x17')]);module[_0x2890('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 1498eab..48383e5 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 _0xf883=['ENUM','out','STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium'];(function(_0x4c6c90,_0xefb5e8){var _0x33afc2=function(_0x481954){while(--_0x481954){_0x4c6c90['push'](_0x4c6c90['shift']());}};_0x33afc2(++_0xefb5e8);}(_0xf883,0x177));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3f88('0x0'));module[_0x3f88('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3f88('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3f88('0x3')]('in',_0x3f88('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3f88('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3f88('0x5')]},'readAt':{'type':Sequelize[_0x3f88('0x6')]},'secret':{'type':Sequelize[_0x3f88('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x3f88('0x5')]},'providerResponse':{'type':Sequelize[_0x3f88('0x8')]}}; \ No newline at end of file +var _0x8eba=['ENUM','out','STRING','sequelize','exports','TEXT','BOOLEAN'];(function(_0x55ae99,_0x5ab789){var _0x4297e1=function(_0x33ee69){while(--_0x33ee69){_0x55ae99['push'](_0x55ae99['shift']());}};_0x4297e1(++_0x5ab789);}(_0x8eba,0x1ae));var _0xa8eb=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0x8eba[_0x2842b4];return _0x2b9521;};'use strict';var Sequelize=require(_0xa8eb('0x0'));module[_0xa8eb('0x1')]={'body':{'type':Sequelize[_0xa8eb('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa8eb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa8eb('0x4')]('in',_0xa8eb('0x5')),'defaultValue':_0xa8eb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa8eb('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa8eb('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xa8eb('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa8eb('0x6')]},'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 f10ab7c..070b04b 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 _0x9a21=['result','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','WhatsappMessage','findAll','rows','catch','show','params','includeAll','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','role','null','AcceptMessage','sequelize','Sequelize','SELECT','contact','User','email','internal','motionChannel','channel','event','EventManager','acceptmessage','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','interface','SIP/%s','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0x9a21,0xeb));var _0x19a2=function(_0x40d40d,_0x4eb01f){_0x40d40d=_0x40d40d-0x0;var _0x37b1e0=_0x9a21[_0x40d40d];return _0x37b1e0;};'use strict';var emlformat=require(_0x19a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19a2('0x1'));var moment=require(_0x19a2('0x2'));var BPromise=require(_0x19a2('0x3'));var Mustache=require(_0x19a2('0x4'));var util=require(_0x19a2('0x5'));var path=require(_0x19a2('0x6'));var sox=require(_0x19a2('0x7'));var csv=require(_0x19a2('0x8'));var ejs=require(_0x19a2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x19a2('0xa'));var crypto=require(_0x19a2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x19a2('0xc'));var Papa=require(_0x19a2('0xd'));var Redis=require('ioredis');var authService=require(_0x19a2('0xe'));var qs=require(_0x19a2('0xf'));var as=require(_0x19a2('0x10'));var hardwareService=require(_0x19a2('0x11'));var logger=require('../../config/logger')(_0x19a2('0x12'));var utils=require(_0x19a2('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x19a2('0x14'))['db'];config[_0x19a2('0x15')]=_['defaults'](config['redis'],{'host':_0x19a2('0x16'),'port':0x18eb});var socket=require(_0x19a2('0x17'))(new Redis(config[_0x19a2('0x15')]));require(_0x19a2('0x18'))[_0x19a2('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x19a2('0x1a')][_0x19a2('0x1b')]({'port':0x232c});var client9002=jayson[_0x19a2('0x1a')][_0x19a2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf0026a,_0x5d791f,_0x1414f3,_0x23bd09){return new BPromise(function(_0x57d32a,_0x3cea6e){var _0x7c29f9=_0x23bd09||client;return _0x7c29f9[_0x19a2('0x1c')](_0xf0026a,_0x1414f3)[_0x19a2('0x1d')](function(_0xf2722e){logger[_0x19a2('0x1e')](_0x19a2('0x1f'),_0x5d791f,_0x19a2('0x20'));logger[_0x19a2('0x21')](_0x19a2('0x22'),_0x5d791f,_0x19a2('0x20'),JSON[_0x19a2('0x23')](_0xf2722e));if(_0xf2722e[_0x19a2('0x24')]){if(_0xf2722e[_0x19a2('0x24')][_0x19a2('0x25')]===0x1f4){logger[_0x19a2('0x24')](_0x19a2('0x1f'),_0x5d791f,_0xf2722e[_0x19a2('0x24')][_0x19a2('0x26')]);return _0x3cea6e(_0xf2722e[_0x19a2('0x24')][_0x19a2('0x26')]);}logger['error'](_0x19a2('0x1f'),_0x5d791f,_0xf2722e[_0x19a2('0x24')][_0x19a2('0x26')]);return _0x57d32a(_0xf2722e[_0x19a2('0x24')][_0x19a2('0x26')]);}else{logger[_0x19a2('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x5d791f,_0x19a2('0x20'));_0x57d32a(_0xf2722e[_0x19a2('0x27')][_0x19a2('0x26')]);}})['catch'](function(_0x25845a){logger[_0x19a2('0x24')](_0x19a2('0x1f'),_0x5d791f,_0x25845a);_0x3cea6e(_0x25845a);});});}function respondWithStatusCode(_0xf859c6,_0x122593){_0x122593=_0x122593||0xcc;return function(_0x17b16d){if(_0x17b16d){return _0xf859c6[_0x19a2('0x28')](_0x122593);}return _0xf859c6[_0x19a2('0x29')](_0x122593)[_0x19a2('0x2a')]();};}function respondWithResult(_0x27dd06,_0x499578){_0x499578=_0x499578||0xc8;return function(_0x55f223){if(_0x55f223){return _0x27dd06[_0x19a2('0x29')](_0x499578)[_0x19a2('0x2b')](_0x55f223);}};}function respondWithFilteredResult(_0x116c54,_0x39441c){return function(_0x40c727){if(_0x40c727){var _0x30389d=typeof _0x39441c['offset']===_0x19a2('0x2c')&&typeof _0x39441c[_0x19a2('0x2d')]===_0x19a2('0x2c');var _0x42d96d=_0x40c727[_0x19a2('0x2e')];var _0x421864=_0x30389d?0x0:_0x39441c[_0x19a2('0x2f')];var _0x3ed9fb=_0x30389d?_0x40c727['count']:_0x39441c[_0x19a2('0x2f')]+_0x39441c[_0x19a2('0x2d')];var _0x417eac;if(_0x3ed9fb>=_0x42d96d){_0x3ed9fb=_0x42d96d;_0x417eac=0xc8;}else{_0x417eac=0xce;}_0x116c54[_0x19a2('0x29')](_0x417eac);return _0x116c54[_0x19a2('0x30')]('Content-Range',_0x421864+'-'+_0x3ed9fb+'/'+_0x42d96d)[_0x19a2('0x2b')](_0x40c727);}return null;};}function patchUpdates(_0x159878){return function(_0x4c8ea7){try{jsonpatch[_0x19a2('0x31')](_0x4c8ea7,_0x159878,!![]);}catch(_0x338967){return BPromise[_0x19a2('0x32')](_0x338967);}return _0x4c8ea7[_0x19a2('0x33')]();};}function saveUpdates(_0x2641c2,_0x5adace){return function(_0x4cc878){if(_0x4cc878){return _0x4cc878[_0x19a2('0x34')](_0x2641c2)[_0x19a2('0x1d')](function(_0x32ee88){return _0x32ee88;});}return null;};}function removeEntity(_0x2cd6a7,_0x3e1be9){return function(_0x990b9c){if(_0x990b9c){return _0x990b9c[_0x19a2('0x35')]()[_0x19a2('0x1d')](function(){_0x2cd6a7[_0x19a2('0x29')](0xcc)[_0x19a2('0x2a')]();});}};}function handleEntityNotFound(_0x3ae241,_0x409f92){return function(_0x4fb571){if(!_0x4fb571){_0x3ae241[_0x19a2('0x28')](0x194);}return _0x4fb571;};}function handleError(_0x358d78,_0x42ecf3){_0x42ecf3=_0x42ecf3||0x1f4;return function(_0x26a259){logger['error'](_0x26a259[_0x19a2('0x36')]);if(_0x26a259[_0x19a2('0x37')]){delete _0x26a259['name'];}_0x358d78[_0x19a2('0x29')](_0x42ecf3)[_0x19a2('0x38')](_0x26a259);};}exports[_0x19a2('0x39')]=function(_0x5f10f3,_0xfb1852){var _0x3a1901={},_0x3f2f9f={},_0xd7e8f={'count':0x0,'rows':[]};var _0x3ce03b=_[_0x19a2('0x3a')](db['WhatsappMessage'][_0x19a2('0x3b')],function(_0x1bf50b){return{'name':_0x1bf50b['fieldName'],'type':_0x1bf50b[_0x19a2('0x3c')]['key']};});_0x3f2f9f['model']=_[_0x19a2('0x3a')](_0x3ce03b,_0x19a2('0x37'));_0x3f2f9f[_0x19a2('0x3d')]=_[_0x19a2('0x3e')](_0x5f10f3['query']);_0x3f2f9f[_0x19a2('0x3f')]=_[_0x19a2('0x40')](_0x3f2f9f['model'],_0x3f2f9f[_0x19a2('0x3d')]);_0x3a1901['attributes']=_[_0x19a2('0x40')](_0x3f2f9f['model'],qs[_0x19a2('0x41')](_0x5f10f3[_0x19a2('0x3d')][_0x19a2('0x41')]));_0x3a1901[_0x19a2('0x42')]=_0x3a1901['attributes'][_0x19a2('0x43')]?_0x3a1901[_0x19a2('0x42')]:_0x3f2f9f[_0x19a2('0x44')];if(!_0x5f10f3['query'][_0x19a2('0x45')](_0x19a2('0x46'))){_0x3a1901[_0x19a2('0x2d')]=qs[_0x19a2('0x2d')](_0x5f10f3[_0x19a2('0x3d')][_0x19a2('0x2d')]);_0x3a1901[_0x19a2('0x2f')]=qs[_0x19a2('0x2f')](_0x5f10f3[_0x19a2('0x3d')][_0x19a2('0x2f')]);}_0x3a1901[_0x19a2('0x47')]=qs['sort'](_0x5f10f3[_0x19a2('0x3d')]['sort']);_0x3a1901[_0x19a2('0x48')]=qs[_0x19a2('0x3f')](_[_0x19a2('0x49')](_0x5f10f3[_0x19a2('0x3d')],_0x3f2f9f['filters']),_0x3ce03b);if(_0x5f10f3['query'][_0x19a2('0x4a')]){_0x3a1901[_0x19a2('0x48')]=_[_0x19a2('0x4b')](_0x3a1901[_0x19a2('0x48')],{'$or':_['map'](_0x3ce03b,function(_0x14b333){if(_0x14b333[_0x19a2('0x3c')]!==_0x19a2('0x4c')){var _0x1a05b0={};_0x1a05b0[_0x14b333['name']]={'$like':'%'+_0x5f10f3[_0x19a2('0x3d')][_0x19a2('0x4a')]+'%'};return _0x1a05b0;}})});}_0x3a1901=_[_0x19a2('0x4b')]({},_0x3a1901,_0x5f10f3['options']);var _0x5706c4={'where':_0x3a1901['where']};return db['WhatsappMessage'][_0x19a2('0x2e')](_0x5706c4)[_0x19a2('0x1d')](function(_0x18f89f){_0xd7e8f[_0x19a2('0x2e')]=_0x18f89f;if(_0x5f10f3[_0x19a2('0x3d')]['includeAll']){_0x3a1901[_0x19a2('0x4d')]=[{'all':!![]}];}return db[_0x19a2('0x4e')][_0x19a2('0x4f')](_0x3a1901);})[_0x19a2('0x1d')](function(_0x4fd257){_0xd7e8f[_0x19a2('0x50')]=_0x4fd257;return _0xd7e8f;})[_0x19a2('0x1d')](respondWithFilteredResult(_0xfb1852,_0x3a1901))[_0x19a2('0x51')](handleError(_0xfb1852,null));};exports[_0x19a2('0x52')]=function(_0x4d77a4,_0x44b6c5){var _0x3a9036={'raw':!![],'where':{'id':_0x4d77a4[_0x19a2('0x53')]['id']}},_0x10f208={};_0x10f208['model']=_[_0x19a2('0x3e')](db['WhatsappMessage'][_0x19a2('0x3b')]);_0x10f208[_0x19a2('0x3d')]=_[_0x19a2('0x3e')](_0x4d77a4[_0x19a2('0x3d')]);_0x10f208['filters']=_[_0x19a2('0x40')](_0x10f208['model'],_0x10f208[_0x19a2('0x3d')]);_0x3a9036['attributes']=_['intersection'](_0x10f208[_0x19a2('0x44')],qs['fields'](_0x4d77a4[_0x19a2('0x3d')][_0x19a2('0x41')]));_0x3a9036[_0x19a2('0x42')]=_0x3a9036['attributes']['length']?_0x3a9036[_0x19a2('0x42')]:_0x10f208[_0x19a2('0x44')];if(_0x4d77a4[_0x19a2('0x3d')][_0x19a2('0x54')]){_0x3a9036['include']=[{'all':!![]}];}_0x3a9036=_[_0x19a2('0x4b')]({},_0x3a9036,_0x4d77a4['options']);return db['WhatsappMessage'][_0x19a2('0x55')](_0x3a9036)['then'](handleEntityNotFound(_0x44b6c5,null))[_0x19a2('0x1d')](respondWithResult(_0x44b6c5,null))['catch'](handleError(_0x44b6c5,null));};exports[_0x19a2('0x56')]=function(_0x561f63,_0xdafeef){return db[_0x19a2('0x4e')][_0x19a2('0x56')](_0x561f63[_0x19a2('0x57')],{})['then'](respondWithResult(_0xdafeef,0xc9))[_0x19a2('0x51')](handleError(_0xdafeef,null));};exports[_0x19a2('0x34')]=function(_0x480cff,_0x22519e){if(_0x480cff[_0x19a2('0x57')]['id']){delete _0x480cff[_0x19a2('0x57')]['id'];}return db[_0x19a2('0x4e')][_0x19a2('0x55')]({'where':{'id':_0x480cff[_0x19a2('0x53')]['id']}})[_0x19a2('0x1d')](handleEntityNotFound(_0x22519e,null))['then'](saveUpdates(_0x480cff[_0x19a2('0x57')],null))[_0x19a2('0x1d')](respondWithResult(_0x22519e,null))[_0x19a2('0x51')](handleError(_0x22519e,null));};exports['destroy']=function(_0x4e5321,_0x30e3ef){return db[_0x19a2('0x4e')]['find']({'where':{'id':_0x4e5321[_0x19a2('0x53')]['id']}})['then'](handleEntityNotFound(_0x30e3ef,null))[_0x19a2('0x1d')](removeEntity(_0x30e3ef,null))[_0x19a2('0x51')](handleError(_0x30e3ef,null));};exports[_0x19a2('0x58')]=function(_0x465fd9,_0x14cc02){return db[_0x19a2('0x4e')]['describe']()['then'](respondWithResult(_0x14cc02,null))[_0x19a2('0x51')](handleError(_0x14cc02,null));};var interaction_log=require(_0x19a2('0x59'))(_0x19a2('0x5a'));exports[_0x19a2('0x5b')]=function(_0x4fbf17,_0xb4e936,_0x3c967c){var _0x1b457f={'agent':{},'channel':_0x19a2('0x5c')};if(_0x4fbf17['body']['id']){delete _0x4fbf17[_0x19a2('0x57')]['id'];}_0x4fbf17['body']['read']=!![];_0x4fbf17['body'][_0x19a2('0x5d')]=moment()[_0x19a2('0x5e')](_0x19a2('0x5f'));_0x4fbf17[_0x19a2('0x57')][_0x19a2('0x60')]=_0x4fbf17['body'][_0x19a2('0x60')]||_0x4fbf17[_0x19a2('0x61')]['id'];_0x1b457f[_0x19a2('0x62')]['id']=_0x4fbf17[_0x19a2('0x57')][_0x19a2('0x60')];return db[_0x19a2('0x4e')][_0x19a2('0x55')]({'where':{'id':_0x4fbf17[_0x19a2('0x53')]['id'],'UserId':null}})[_0x19a2('0x1d')](handleEntityNotFound(_0xb4e936,null))[_0x19a2('0x1d')](saveUpdates(_0x4fbf17['body'],null))[_0x19a2('0x1d')](function(_0xb08d06){if(_0xb08d06){_0x1b457f[_0x19a2('0x26')]=_0xb08d06[_0x19a2('0x63')]({'plain':!![]});return db[_0x19a2('0x64')][_0x19a2('0x55')]({'where':{'id':_0xb08d06[_0x19a2('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xb4e936,null))['then'](function(_0x52c807){if(_0x52c807){return _0x52c807[_0x19a2('0x34')]({'UserId':_0x4fbf17[_0x19a2('0x57')][_0x19a2('0x60')],'read1stAt':_['isNil'](_0x52c807['read1stAt'])?moment()[_0x19a2('0x5e')](_0x19a2('0x5f')):undefined});}return null;})['then'](function(_0x3eeda7){if(_0x3eeda7){_0x1b457f['interaction']=_0x3eeda7[_0x19a2('0x63')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fbf17[_0x19a2('0x61')]['id'],_0x4fbf17[_0x19a2('0x61')]['name'],_0x4fbf17[_0x19a2('0x61')][_0x19a2('0x66')],_0x1b457f['interaction']['id'],_0x4fbf17[_0x19a2('0x57')]?JSON[_0x19a2('0x23')](_0x4fbf17[_0x19a2('0x57')]):_0x19a2('0x67'));return respondWithRpcPromise(_0x19a2('0x68'),'acceptMessage',_0x1b457f);}return null;})[_0x19a2('0x1d')](function(_0xdb0f65){var _0xd02db1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xdb0f65[_0x19a2('0x26')]['ContactId'];return db[_0x19a2('0x69')][_0x19a2('0x3d')](_0xd02db1,{'type':db[_0x19a2('0x6a')]['QueryTypes'][_0x19a2('0x6b')],'raw':!![]})['then'](function(_0x1b324f){return _0x1b324f;});})['then'](function(_0x3f2a3e){if(_0x3f2a3e){_0x1b457f[_0x19a2('0x26')][_0x19a2('0x6c')]=_0x3f2a3e[0x0];if(!_0x4fbf17[_0x19a2('0x57')][_0x19a2('0x60')])return;return db[_0x19a2('0x6d')][_0x19a2('0x55')]({'where':{'id':_0x4fbf17[_0x19a2('0x57')][_0x19a2('0x60')],'role':_0x19a2('0x62')},'attributes':['id','name','fullname',_0x19a2('0x6e'),_0x19a2('0x6f')],'raw':!![]});}return null;})[_0x19a2('0x1d')](function(_0x22d3e0){if(!_0x22d3e0)return null;_0x1b457f['message'][_0x19a2('0x62')]=_0x22d3e0;return _0x1b457f;})['then'](function(_0x499923){if(_0x499923){if(_0x4fbf17['body']['manual']){_0x1b457f[_0x19a2('0x26')]['interface']=util[_0x19a2('0x5e')]('SIP/%s',_0x4fbf17[_0x19a2('0x61')][_0x19a2('0x37')]);_0x1b457f[_0x19a2('0x26')]['channel']=_0x1b457f['channel'];_0x1b457f[_0x19a2('0x26')][_0x19a2('0x70')]=_0x1b457f[_0x19a2('0x71')];_0x1b457f[_0x19a2('0x26')][_0x19a2('0x72')]=_0x19a2('0x5b');return respondWithRpcPromise('EventManager',_0x19a2('0x73'),{'event':_0x19a2('0x74'),'message':_0x1b457f['message']},client9002)[_0x19a2('0x1d')](function(){return _0x1b457f;});}return _0x1b457f;}return null;})[_0x19a2('0x1d')](respondWithResult(_0xb4e936,null))[_0x19a2('0x51')](handleError(_0xb4e936,null));};var interaction_log=require(_0x19a2('0x59'))(_0x19a2('0x5a'));exports[_0x19a2('0x32')]=function(_0x405531,_0xf7b9a3,_0x5e9e8b){var _0x204d7d={'agent':{},'channel':_0x19a2('0x5c')};if(_0x405531[_0x19a2('0x57')]['id']){delete _0x405531[_0x19a2('0x57')]['id'];}_0x405531[_0x19a2('0x57')]['UserId']=_0x405531[_0x19a2('0x57')][_0x19a2('0x60')]||_0x405531[_0x19a2('0x61')]['id'];_0x204d7d[_0x19a2('0x62')]['id']=_0x405531[_0x19a2('0x57')][_0x19a2('0x60')];return db[_0x19a2('0x4e')][_0x19a2('0x55')]({'where':{'id':_0x405531[_0x19a2('0x53')]['id'],'UserId':null}})[_0x19a2('0x1d')](handleEntityNotFound(_0xf7b9a3,null))[_0x19a2('0x1d')](function(_0x491238){if(_0x491238){_0x204d7d['message']=_0x491238[_0x19a2('0x63')]({'plain':!![]});return db[_0x19a2('0x64')][_0x19a2('0x55')]({'where':{'id':_0x491238[_0x19a2('0x65')]}});}return null;})[_0x19a2('0x1d')](handleEntityNotFound(_0xf7b9a3,null))[_0x19a2('0x1d')](function(_0x1bbd3e){if(_0x1bbd3e){_0x204d7d[_0x19a2('0x75')]=_0x1bbd3e[_0x19a2('0x63')]({'plain':!![]});interaction_log[_0x19a2('0x1e')](_0x19a2('0x76'),_0x405531[_0x19a2('0x61')]['id'],_0x405531[_0x19a2('0x61')][_0x19a2('0x37')],_0x405531[_0x19a2('0x61')]['role'],_0x204d7d['interaction']['id'],_0x405531[_0x19a2('0x57')]?JSON['stringify'](_0x405531[_0x19a2('0x57')]):'null');return respondWithRpcPromise(_0x19a2('0x77'),_0x19a2('0x78'),_0x204d7d);}return null;})[_0x19a2('0x1d')](function(_0x308eb4){var _0x206941=_0x19a2('0x79')+_0x308eb4['message'][_0x19a2('0x7a')];return db[_0x19a2('0x69')][_0x19a2('0x3d')](_0x206941,{'type':db[_0x19a2('0x6a')]['QueryTypes'][_0x19a2('0x6b')],'raw':!![]})[_0x19a2('0x1d')](function(_0x5e3c78){return _0x5e3c78;});})['then'](function(_0x23d460){if(_0x23d460){_0x204d7d[_0x19a2('0x26')][_0x19a2('0x6c')]=_0x23d460[0x0];if(!_0x405531[_0x19a2('0x57')][_0x19a2('0x60')])return;return db[_0x19a2('0x6d')][_0x19a2('0x55')]({'where':{'id':_0x405531[_0x19a2('0x57')][_0x19a2('0x60')],'role':_0x19a2('0x62')},'attributes':['id',_0x19a2('0x37'),_0x19a2('0x7b'),_0x19a2('0x6e'),_0x19a2('0x6f')],'raw':!![]});}return null;})[_0x19a2('0x1d')](function(_0x22254e){if(!_0x22254e)return null;_0x204d7d[_0x19a2('0x26')][_0x19a2('0x62')]=_0x22254e;return _0x204d7d;})['then'](function(_0x200c2b){if(_0x200c2b){_0x200c2b[_0x19a2('0x26')][_0x19a2('0x7c')]=util[_0x19a2('0x5e')](_0x19a2('0x7d'),_0x405531[_0x19a2('0x61')][_0x19a2('0x37')]);_0x200c2b[_0x19a2('0x26')][_0x19a2('0x71')]=_0x204d7d['channel'];_0x200c2b[_0x19a2('0x26')][_0x19a2('0x70')]=_0x204d7d[_0x19a2('0x71')];_0x200c2b['message']['event']=_0x19a2('0x32');respondWithRpcPromise('EventManager',_0x19a2('0x73'),{'event':'rejectmessage','message':_0x200c2b['message']},client9002);return _0x204d7d;}return null;})['then'](respondWithResult(_0xf7b9a3,null))[_0x19a2('0x51')](handleError(_0xf7b9a3,null));};exports['status']=function(_0x781e37,_0x47eb73,_0x19605a){if(_0x781e37[_0x19a2('0x57')]['id']){delete _0x781e37['body']['id'];}var _0x314bac;return db[_0x19a2('0x4e')][_0x19a2('0x55')]({'where':{'id':_0x781e37['params']['id']}})['then'](handleEntityNotFound(_0x47eb73,null))[_0x19a2('0x1d')](function(_0x2e9330){if(_0x2e9330){_0x314bac=_0x2e9330;return db[_0x19a2('0x7e')][_0x19a2('0x55')]({'where':{'id':_0x2e9330[_0x19a2('0x7f')]}});}})[_0x19a2('0x1d')](handleEntityNotFound(_0x47eb73,null))[_0x19a2('0x1d')](function(_0x3ffb73){if(_0x3ffb73){logger[_0x19a2('0x21')](_0x19a2('0x80'),_0x19a2('0x29'),_0x19a2('0x81'),_0x3ffb73[_0x19a2('0x3c')],util[_0x19a2('0x82')](_0x781e37[_0x19a2('0x57')],{'showHidden':![],'depth':null}));switch(_0x3ffb73[_0x19a2('0x3c')]){case _0x19a2('0x83'):if(_0x781e37[_0x19a2('0x57')][_0x19a2('0x84')]&&_0x781e37[_0x19a2('0x57')]['MessageSid']===_0x314bac[_0x19a2('0x85')]&&_0x781e37[_0x19a2('0x57')]['MessageStatus']&&_0x781e37[_0x19a2('0x57')][_0x19a2('0x86')]===_0x19a2('0x87')){return _0x314bac['update']({'read':!![]});}else{logger[_0x19a2('0x24')](_0x19a2('0x88'),'status',_0x19a2('0x83'),util[_0x19a2('0x82')](_0x781e37[_0x19a2('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x314bac;}})['then'](respondWithResult(_0x47eb73,null))[_0x19a2('0x51')](handleError(_0x47eb73,null));}; \ No newline at end of file +var _0x8d04=['socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','include','rows','show','includeAll','find','create','body','params','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','acceptmessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','internal','SIP/%s','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageStatus','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost'];(function(_0x38a162,_0x4396b2){var _0x1f622b=function(_0x3b3a60){while(--_0x3b3a60){_0x38a162['push'](_0x38a162['shift']());}};_0x1f622b(++_0x4396b2);}(_0x8d04,0x183));var _0x48d0=function(_0x2cc7f5,_0x4b362e){_0x2cc7f5=_0x2cc7f5-0x0;var _0x38732e=_0x8d04[_0x2cc7f5];return _0x38732e;};'use strict';var emlformat=require(_0x48d0('0x0'));var rimraf=require(_0x48d0('0x1'));var zipdir=require(_0x48d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x48d0('0x3'));var moment=require(_0x48d0('0x4'));var BPromise=require(_0x48d0('0x5'));var Mustache=require(_0x48d0('0x6'));var util=require(_0x48d0('0x7'));var path=require(_0x48d0('0x8'));var sox=require(_0x48d0('0x9'));var csv=require(_0x48d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48d0('0xb'));var _=require(_0x48d0('0xc'));var squel=require(_0x48d0('0xd'));var crypto=require(_0x48d0('0xe'));var jsforce=require(_0x48d0('0xf'));var deskjs=require(_0x48d0('0x10'));var toCsv=require(_0x48d0('0xa'));var querystring=require(_0x48d0('0x11'));var Papa=require('papaparse');var Redis=require(_0x48d0('0x12'));var authService=require(_0x48d0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x48d0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48d0('0x15'))('api');var utils=require(_0x48d0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x48d0('0x17'));var db=require(_0x48d0('0x18'))['db'];config['redis']=_['defaults'](config[_0x48d0('0x19')],{'host':_0x48d0('0x1a'),'port':0x18eb});var socket=require(_0x48d0('0x1b'))(new Redis(config[_0x48d0('0x19')]));require(_0x48d0('0x1c'))[_0x48d0('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x48d0('0x1e')][_0x48d0('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x48d0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5a304d,_0x5ce404,_0x5730ce,_0x2af494){return new BPromise(function(_0xdd1282,_0x58f0b3){var _0xe12c2b=_0x2af494||client;return _0xe12c2b[_0x48d0('0x20')](_0x5a304d,_0x5730ce)[_0x48d0('0x21')](function(_0x81d846){logger[_0x48d0('0x22')](_0x48d0('0x23'),_0x5ce404,_0x48d0('0x24'));logger[_0x48d0('0x25')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5ce404,'request\x20sent',JSON[_0x48d0('0x26')](_0x81d846));if(_0x81d846[_0x48d0('0x27')]){if(_0x81d846['error'][_0x48d0('0x28')]===0x1f4){logger[_0x48d0('0x27')](_0x48d0('0x23'),_0x5ce404,_0x81d846[_0x48d0('0x27')]['message']);return _0x58f0b3(_0x81d846[_0x48d0('0x27')][_0x48d0('0x29')]);}logger[_0x48d0('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5ce404,_0x81d846[_0x48d0('0x27')][_0x48d0('0x29')]);return _0xdd1282(_0x81d846['error'][_0x48d0('0x29')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5ce404,_0x48d0('0x24'));_0xdd1282(_0x81d846[_0x48d0('0x2a')][_0x48d0('0x29')]);}})[_0x48d0('0x2b')](function(_0x355c90){logger[_0x48d0('0x27')](_0x48d0('0x23'),_0x5ce404,_0x355c90);_0x58f0b3(_0x355c90);});});}function respondWithStatusCode(_0x528fef,_0x2b40ea){_0x2b40ea=_0x2b40ea||0xcc;return function(_0x123bba){if(_0x123bba){return _0x528fef[_0x48d0('0x2c')](_0x2b40ea);}return _0x528fef[_0x48d0('0x2d')](_0x2b40ea)['end']();};}function respondWithResult(_0x4fbad3,_0x20fab4){_0x20fab4=_0x20fab4||0xc8;return function(_0x1ae35d){if(_0x1ae35d){return _0x4fbad3[_0x48d0('0x2d')](_0x20fab4)['json'](_0x1ae35d);}};}function respondWithFilteredResult(_0x105a96,_0x2ec29e){return function(_0x37930b){if(_0x37930b){var _0x1edf61=typeof _0x2ec29e[_0x48d0('0x2e')]===_0x48d0('0x2f')&&typeof _0x2ec29e[_0x48d0('0x30')]===_0x48d0('0x2f');var _0x56550e=_0x37930b['count'];var _0x288569=_0x1edf61?0x0:_0x2ec29e[_0x48d0('0x2e')];var _0x336f29=_0x1edf61?_0x37930b[_0x48d0('0x31')]:_0x2ec29e['offset']+_0x2ec29e[_0x48d0('0x30')];var _0x1dd169;if(_0x336f29>=_0x56550e){_0x336f29=_0x56550e;_0x1dd169=0xc8;}else{_0x1dd169=0xce;}_0x105a96[_0x48d0('0x2d')](_0x1dd169);return _0x105a96[_0x48d0('0x32')](_0x48d0('0x33'),_0x288569+'-'+_0x336f29+'/'+_0x56550e)[_0x48d0('0x34')](_0x37930b);}return null;};}function patchUpdates(_0x7446cf){return function(_0x29f28e){try{jsonpatch[_0x48d0('0x35')](_0x29f28e,_0x7446cf,!![]);}catch(_0x521e7e){return BPromise[_0x48d0('0x36')](_0x521e7e);}return _0x29f28e[_0x48d0('0x37')]();};}function saveUpdates(_0x2ed874,_0x2f843e){return function(_0x830796){if(_0x830796){return _0x830796[_0x48d0('0x38')](_0x2ed874)[_0x48d0('0x21')](function(_0x2194c1){return _0x2194c1;});}return null;};}function removeEntity(_0x29dc5a,_0x474a59){return function(_0x4fd95c){if(_0x4fd95c){return _0x4fd95c[_0x48d0('0x39')]()[_0x48d0('0x21')](function(){_0x29dc5a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efb90,_0x104ac2){return function(_0x12cbf2){if(!_0x12cbf2){_0x5efb90[_0x48d0('0x2c')](0x194);}return _0x12cbf2;};}function handleError(_0x40f86b,_0xafa66){_0xafa66=_0xafa66||0x1f4;return function(_0xb0764d){logger[_0x48d0('0x27')](_0xb0764d[_0x48d0('0x3a')]);if(_0xb0764d[_0x48d0('0x3b')]){delete _0xb0764d[_0x48d0('0x3b')];}_0x40f86b[_0x48d0('0x2d')](_0xafa66)['send'](_0xb0764d);};}exports[_0x48d0('0x3c')]=function(_0x7b039b,_0x260e9b){var _0x7d4e9={},_0x4c668d={},_0x5ae444={'count':0x0,'rows':[]};var _0x4c27ed=_['map'](db[_0x48d0('0x3d')][_0x48d0('0x3e')],function(_0xfbac46){return{'name':_0xfbac46['fieldName'],'type':_0xfbac46[_0x48d0('0x3f')][_0x48d0('0x40')]};});_0x4c668d[_0x48d0('0x41')]=_[_0x48d0('0x42')](_0x4c27ed,_0x48d0('0x3b'));_0x4c668d['query']=_[_0x48d0('0x43')](_0x7b039b[_0x48d0('0x44')]);_0x4c668d[_0x48d0('0x45')]=_['intersection'](_0x4c668d[_0x48d0('0x41')],_0x4c668d[_0x48d0('0x44')]);_0x7d4e9['attributes']=_[_0x48d0('0x46')](_0x4c668d[_0x48d0('0x41')],qs[_0x48d0('0x47')](_0x7b039b[_0x48d0('0x44')][_0x48d0('0x47')]));_0x7d4e9[_0x48d0('0x48')]=_0x7d4e9[_0x48d0('0x48')][_0x48d0('0x49')]?_0x7d4e9[_0x48d0('0x48')]:_0x4c668d[_0x48d0('0x41')];if(!_0x7b039b['query'][_0x48d0('0x4a')]('nolimit')){_0x7d4e9[_0x48d0('0x30')]=qs['limit'](_0x7b039b[_0x48d0('0x44')][_0x48d0('0x30')]);_0x7d4e9[_0x48d0('0x2e')]=qs[_0x48d0('0x2e')](_0x7b039b['query']['offset']);}_0x7d4e9[_0x48d0('0x4b')]=qs['sort'](_0x7b039b['query'][_0x48d0('0x4c')]);_0x7d4e9['where']=qs[_0x48d0('0x45')](_[_0x48d0('0x4d')](_0x7b039b[_0x48d0('0x44')],_0x4c668d[_0x48d0('0x45')]),_0x4c27ed);if(_0x7b039b[_0x48d0('0x44')][_0x48d0('0x4e')]){_0x7d4e9['where']=_[_0x48d0('0x4f')](_0x7d4e9[_0x48d0('0x50')],{'$or':_[_0x48d0('0x42')](_0x4c27ed,function(_0x1f4f9f){if(_0x1f4f9f['type']!==_0x48d0('0x51')){var _0x36d402={};_0x36d402[_0x1f4f9f['name']]={'$like':'%'+_0x7b039b['query'][_0x48d0('0x4e')]+'%'};return _0x36d402;}})});}_0x7d4e9=_[_0x48d0('0x4f')]({},_0x7d4e9,_0x7b039b['options']);var _0x3a8ab8={'where':_0x7d4e9[_0x48d0('0x50')]};return db[_0x48d0('0x3d')][_0x48d0('0x31')](_0x3a8ab8)[_0x48d0('0x21')](function(_0x16632c){_0x5ae444['count']=_0x16632c;if(_0x7b039b[_0x48d0('0x44')]['includeAll']){_0x7d4e9[_0x48d0('0x52')]=[{'all':!![]}];}return db[_0x48d0('0x3d')]['findAll'](_0x7d4e9);})['then'](function(_0x1d6503){_0x5ae444[_0x48d0('0x53')]=_0x1d6503;return _0x5ae444;})[_0x48d0('0x21')](respondWithFilteredResult(_0x260e9b,_0x7d4e9))['catch'](handleError(_0x260e9b,null));};exports[_0x48d0('0x54')]=function(_0x36a533,_0x5c141b){var _0x4fb844={'raw':!![],'where':{'id':_0x36a533['params']['id']}},_0x2fc259={};_0x2fc259['model']=_[_0x48d0('0x43')](db['WhatsappMessage'][_0x48d0('0x3e')]);_0x2fc259[_0x48d0('0x44')]=_[_0x48d0('0x43')](_0x36a533[_0x48d0('0x44')]);_0x2fc259[_0x48d0('0x45')]=_['intersection'](_0x2fc259['model'],_0x2fc259[_0x48d0('0x44')]);_0x4fb844[_0x48d0('0x48')]=_['intersection'](_0x2fc259[_0x48d0('0x41')],qs[_0x48d0('0x47')](_0x36a533[_0x48d0('0x44')]['fields']));_0x4fb844[_0x48d0('0x48')]=_0x4fb844[_0x48d0('0x48')][_0x48d0('0x49')]?_0x4fb844[_0x48d0('0x48')]:_0x2fc259['model'];if(_0x36a533[_0x48d0('0x44')][_0x48d0('0x55')]){_0x4fb844[_0x48d0('0x52')]=[{'all':!![]}];}_0x4fb844=_[_0x48d0('0x4f')]({},_0x4fb844,_0x36a533['options']);return db[_0x48d0('0x3d')][_0x48d0('0x56')](_0x4fb844)['then'](handleEntityNotFound(_0x5c141b,null))[_0x48d0('0x21')](respondWithResult(_0x5c141b,null))[_0x48d0('0x2b')](handleError(_0x5c141b,null));};exports[_0x48d0('0x57')]=function(_0x53dc60,_0x1fce8f){return db[_0x48d0('0x3d')]['create'](_0x53dc60[_0x48d0('0x58')],{})[_0x48d0('0x21')](respondWithResult(_0x1fce8f,0xc9))[_0x48d0('0x2b')](handleError(_0x1fce8f,null));};exports[_0x48d0('0x38')]=function(_0x3d6a7b,_0x20cf47){if(_0x3d6a7b[_0x48d0('0x58')]['id']){delete _0x3d6a7b[_0x48d0('0x58')]['id'];}return db[_0x48d0('0x3d')][_0x48d0('0x56')]({'where':{'id':_0x3d6a7b[_0x48d0('0x59')]['id']}})[_0x48d0('0x21')](handleEntityNotFound(_0x20cf47,null))['then'](saveUpdates(_0x3d6a7b[_0x48d0('0x58')],null))['then'](respondWithResult(_0x20cf47,null))[_0x48d0('0x2b')](handleError(_0x20cf47,null));};exports[_0x48d0('0x39')]=function(_0x369a99,_0x2ce23){return db[_0x48d0('0x3d')][_0x48d0('0x56')]({'where':{'id':_0x369a99[_0x48d0('0x59')]['id']}})[_0x48d0('0x21')](handleEntityNotFound(_0x2ce23,null))[_0x48d0('0x21')](removeEntity(_0x2ce23,null))[_0x48d0('0x2b')](handleError(_0x2ce23,null));};exports[_0x48d0('0x5a')]=function(_0x43d43f,_0x21251e){return db[_0x48d0('0x3d')][_0x48d0('0x5a')]()[_0x48d0('0x21')](respondWithResult(_0x21251e,null))[_0x48d0('0x2b')](handleError(_0x21251e,null));};var interaction_log=require(_0x48d0('0x15'))('whatsapp-interactions');exports[_0x48d0('0x5b')]=function(_0x22bc97,_0x6034b8,_0x547ce2){var _0x3f58da={'agent':{},'channel':_0x48d0('0x5c')};if(_0x22bc97['body']['id']){delete _0x22bc97[_0x48d0('0x58')]['id'];}_0x22bc97[_0x48d0('0x58')][_0x48d0('0x5d')]=!![];_0x22bc97[_0x48d0('0x58')][_0x48d0('0x5e')]=moment()[_0x48d0('0x5f')](_0x48d0('0x60'));_0x22bc97[_0x48d0('0x58')][_0x48d0('0x61')]=_0x22bc97[_0x48d0('0x58')][_0x48d0('0x61')]||_0x22bc97[_0x48d0('0x62')]['id'];_0x3f58da[_0x48d0('0x63')]['id']=_0x22bc97['body'][_0x48d0('0x61')];return db[_0x48d0('0x3d')][_0x48d0('0x56')]({'where':{'id':_0x22bc97[_0x48d0('0x59')]['id'],'UserId':null}})[_0x48d0('0x21')](handleEntityNotFound(_0x6034b8,null))[_0x48d0('0x21')](saveUpdates(_0x22bc97[_0x48d0('0x58')],null))[_0x48d0('0x21')](function(_0x1c3a8c){if(_0x1c3a8c){_0x3f58da[_0x48d0('0x29')]=_0x1c3a8c[_0x48d0('0x64')]({'plain':!![]});return db[_0x48d0('0x65')][_0x48d0('0x56')]({'where':{'id':_0x1c3a8c[_0x48d0('0x66')]}});}return null;})[_0x48d0('0x21')](handleEntityNotFound(_0x6034b8,null))[_0x48d0('0x21')](function(_0x4b95ed){if(_0x4b95ed){return _0x4b95ed['update']({'UserId':_0x22bc97[_0x48d0('0x58')][_0x48d0('0x61')],'read1stAt':_[_0x48d0('0x67')](_0x4b95ed[_0x48d0('0x68')])?moment()[_0x48d0('0x5f')](_0x48d0('0x60')):undefined});}return null;})[_0x48d0('0x21')](function(_0xd40a){if(_0xd40a){_0x3f58da[_0x48d0('0x69')]=_0xd40a['get']({'plain':!![]});interaction_log[_0x48d0('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x22bc97[_0x48d0('0x62')]['id'],_0x22bc97[_0x48d0('0x62')][_0x48d0('0x3b')],_0x22bc97[_0x48d0('0x62')][_0x48d0('0x6a')],_0x3f58da[_0x48d0('0x69')]['id'],_0x22bc97['body']?JSON['stringify'](_0x22bc97[_0x48d0('0x58')]):_0x48d0('0x6b'));return respondWithRpcPromise(_0x48d0('0x6c'),_0x48d0('0x6d'),_0x3f58da);}return null;})[_0x48d0('0x21')](function(_0xc7bc0c){var _0x13c300='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xc7bc0c[_0x48d0('0x29')][_0x48d0('0x6e')];return db['sequelize'][_0x48d0('0x44')](_0x13c300,{'type':db[_0x48d0('0x6f')][_0x48d0('0x70')][_0x48d0('0x71')],'raw':!![]})['then'](function(_0x534327){return _0x534327;});})[_0x48d0('0x21')](function(_0x117e35){if(_0x117e35){_0x3f58da[_0x48d0('0x29')][_0x48d0('0x72')]=_0x117e35[0x0];if(!_0x22bc97['body'][_0x48d0('0x61')])return;return db[_0x48d0('0x73')][_0x48d0('0x56')]({'where':{'id':_0x22bc97[_0x48d0('0x58')]['UserId'],'role':_0x48d0('0x63')},'attributes':['id','name',_0x48d0('0x74'),_0x48d0('0x75'),'internal'],'raw':!![]});}return null;})[_0x48d0('0x21')](function(_0x521c3e){if(!_0x521c3e)return null;_0x3f58da[_0x48d0('0x29')]['agent']=_0x521c3e;return _0x3f58da;})['then'](function(_0x1419ae){if(_0x1419ae){if(_0x22bc97['body'][_0x48d0('0x76')]){_0x3f58da[_0x48d0('0x29')][_0x48d0('0x77')]=util['format']('SIP/%s',_0x22bc97[_0x48d0('0x62')][_0x48d0('0x3b')]);_0x3f58da[_0x48d0('0x29')][_0x48d0('0x78')]=_0x3f58da[_0x48d0('0x78')];_0x3f58da[_0x48d0('0x29')][_0x48d0('0x79')]=_0x3f58da[_0x48d0('0x78')];_0x3f58da[_0x48d0('0x29')][_0x48d0('0x7a')]=_0x48d0('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x48d0('0x7b'),'message':_0x3f58da['message']},client9002)[_0x48d0('0x21')](function(){return _0x3f58da;});}return _0x3f58da;}return null;})[_0x48d0('0x21')](respondWithResult(_0x6034b8,null))[_0x48d0('0x2b')](handleError(_0x6034b8,null));};var interaction_log=require(_0x48d0('0x15'))('whatsapp-interactions');exports['reject']=function(_0x38d0fb,_0x47a3cf,_0x1ab20c){var _0x4bc56d={'agent':{},'channel':'whatsapp'};if(_0x38d0fb[_0x48d0('0x58')]['id']){delete _0x38d0fb['body']['id'];}_0x38d0fb[_0x48d0('0x58')]['UserId']=_0x38d0fb[_0x48d0('0x58')][_0x48d0('0x61')]||_0x38d0fb['user']['id'];_0x4bc56d[_0x48d0('0x63')]['id']=_0x38d0fb[_0x48d0('0x58')][_0x48d0('0x61')];return db[_0x48d0('0x3d')]['find']({'where':{'id':_0x38d0fb[_0x48d0('0x59')]['id'],'UserId':null}})[_0x48d0('0x21')](handleEntityNotFound(_0x47a3cf,null))[_0x48d0('0x21')](function(_0x167f5a){if(_0x167f5a){_0x4bc56d[_0x48d0('0x29')]=_0x167f5a['get']({'plain':!![]});return db[_0x48d0('0x65')]['find']({'where':{'id':_0x167f5a[_0x48d0('0x66')]}});}return null;})[_0x48d0('0x21')](handleEntityNotFound(_0x47a3cf,null))['then'](function(_0x24b3f8){if(_0x24b3f8){_0x4bc56d['interaction']=_0x24b3f8['get']({'plain':!![]});interaction_log[_0x48d0('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x38d0fb[_0x48d0('0x62')]['id'],_0x38d0fb['user'][_0x48d0('0x3b')],_0x38d0fb['user'][_0x48d0('0x6a')],_0x4bc56d[_0x48d0('0x69')]['id'],_0x38d0fb[_0x48d0('0x58')]?JSON[_0x48d0('0x26')](_0x38d0fb[_0x48d0('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x48d0('0x7c'),_0x4bc56d);}return null;})['then'](function(_0x563662){var _0x4fb2e3=_0x48d0('0x7d')+_0x563662[_0x48d0('0x29')][_0x48d0('0x6e')];return db[_0x48d0('0x7e')][_0x48d0('0x44')](_0x4fb2e3,{'type':db['Sequelize'][_0x48d0('0x70')][_0x48d0('0x71')],'raw':!![]})[_0x48d0('0x21')](function(_0x5045eb){return _0x5045eb;});})[_0x48d0('0x21')](function(_0x545883){if(_0x545883){_0x4bc56d[_0x48d0('0x29')]['contact']=_0x545883[0x0];if(!_0x38d0fb['body'][_0x48d0('0x61')])return;return db[_0x48d0('0x73')]['find']({'where':{'id':_0x38d0fb[_0x48d0('0x58')][_0x48d0('0x61')],'role':_0x48d0('0x63')},'attributes':['id',_0x48d0('0x3b'),_0x48d0('0x74'),_0x48d0('0x75'),_0x48d0('0x7f')],'raw':!![]});}return null;})[_0x48d0('0x21')](function(_0x29e227){if(!_0x29e227)return null;_0x4bc56d[_0x48d0('0x29')][_0x48d0('0x63')]=_0x29e227;return _0x4bc56d;})[_0x48d0('0x21')](function(_0x2f4439){if(_0x2f4439){_0x2f4439['message'][_0x48d0('0x77')]=util['format'](_0x48d0('0x80'),_0x38d0fb[_0x48d0('0x62')]['name']);_0x2f4439[_0x48d0('0x29')]['channel']=_0x4bc56d[_0x48d0('0x78')];_0x2f4439[_0x48d0('0x29')][_0x48d0('0x79')]=_0x4bc56d['channel'];_0x2f4439['message'][_0x48d0('0x7a')]=_0x48d0('0x36');respondWithRpcPromise(_0x48d0('0x81'),_0x48d0('0x81'),{'event':_0x48d0('0x82'),'message':_0x2f4439['message']},client9002);return _0x4bc56d;}return null;})['then'](respondWithResult(_0x47a3cf,null))['catch'](handleError(_0x47a3cf,null));};exports[_0x48d0('0x2d')]=function(_0x3cc7eb,_0x451f10,_0x2f7b34){if(_0x3cc7eb[_0x48d0('0x58')]['id']){delete _0x3cc7eb['body']['id'];}var _0x51aa89;return db['WhatsappMessage'][_0x48d0('0x56')]({'where':{'id':_0x3cc7eb['params']['id']}})[_0x48d0('0x21')](handleEntityNotFound(_0x451f10,null))[_0x48d0('0x21')](function(_0x247a2f){if(_0x247a2f){_0x51aa89=_0x247a2f;return db[_0x48d0('0x83')][_0x48d0('0x56')]({'where':{'id':_0x247a2f[_0x48d0('0x84')]}});}})[_0x48d0('0x21')](handleEntityNotFound(_0x451f10,null))[_0x48d0('0x21')](function(_0x5c1b74){if(_0x5c1b74){logger[_0x48d0('0x25')](_0x48d0('0x85'),_0x48d0('0x2d'),_0x48d0('0x86'),_0x5c1b74[_0x48d0('0x3f')],util[_0x48d0('0x87')](_0x3cc7eb['body'],{'showHidden':![],'depth':null}));switch(_0x5c1b74[_0x48d0('0x3f')]){case _0x48d0('0x88'):if(_0x3cc7eb['body']['MessageSid']&&_0x3cc7eb['body']['MessageSid']===_0x51aa89['messageId']&&_0x3cc7eb[_0x48d0('0x58')][_0x48d0('0x89')]&&_0x3cc7eb[_0x48d0('0x58')][_0x48d0('0x89')]==='read'){return _0x51aa89[_0x48d0('0x38')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x48d0('0x2d'),_0x48d0('0x88'),util[_0x48d0('0x87')](_0x3cc7eb[_0x48d0('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x51aa89;}})[_0x48d0('0x21')](respondWithResult(_0x451f10,null))['catch'](handleError(_0x451f10,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 31c8fc5..09f3b34 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 _0xde2c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x4314d7,_0x355218){var _0x5c599b=function(_0x556354){while(--_0x556354){_0x4314d7['push'](_0x4314d7['shift']());}};_0x5c599b(++_0x355218);}(_0xde2c,0x7f));var _0xcde2=function(_0xe5b349,_0x5f06e4){_0xe5b349=_0xe5b349-0x0;var _0x26b0ad=_0xde2c[_0xe5b349];return _0x26b0ad;};'use strict';var EventEmitter=require(_0xcde2('0x0'));var WhatsappMessage=require(_0xcde2('0x1'))['db'][_0xcde2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xcde2('0x3')](0x0);var events={'afterCreate':_0xcde2('0x4'),'afterUpdate':_0xcde2('0x5'),'afterDestroy':_0xcde2('0x6')};function emitEvent(_0x3a309f){return function(_0x55c175,_0x4353c8,_0x196898){WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f+':'+_0x55c175['id'],_0x55c175);WhatsappMessageEvents[_0xcde2('0x7')](_0x3a309f,_0x55c175);_0x196898(null);};}for(var e in events){if(events[_0xcde2('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xcde2('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x5eb1=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappMessage'];(function(_0x17bc70,_0x4b1e96){var _0x166b8b=function(_0x184473){while(--_0x184473){_0x17bc70['push'](_0x17bc70['shift']());}};_0x166b8b(++_0x4b1e96);}(_0x5eb1,0x7c));var _0x15eb=function(_0x1feb65,_0x59d59b){_0x1feb65=_0x1feb65-0x0;var _0xb2dbb3=_0x5eb1[_0x1feb65];return _0xb2dbb3;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x15eb('0x0'))['db'][_0x15eb('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x15eb('0x2')](0x0);var events={'afterCreate':_0x15eb('0x3'),'afterUpdate':_0x15eb('0x4'),'afterDestroy':_0x15eb('0x5')};function emitEvent(_0x5e1142){return function(_0x3ba774,_0x19d816,_0x1f38c6){WhatsappMessageEvents[_0x15eb('0x6')](_0x5e1142+':'+_0x3ba774['id'],_0x3ba774);WhatsappMessageEvents['emit'](_0x5e1142,_0x3ba774);_0x1f38c6(null);};}for(var e in events){if(events[_0x15eb('0x7')](e)){var event=events[e];WhatsappMessage[_0x15eb('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 75c12b2..5d4d77f 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 _0x7326=['WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','statuses','message_id','catch','err','WhatsappMessage,\x20%s','utf8mb4','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error'];(function(_0x5c9b8f,_0x13e545){var _0x41e270=function(_0x2b8f7f){while(--_0x2b8f7f){_0x5c9b8f['push'](_0x5c9b8f['shift']());}};_0x41e270(++_0x13e545);}(_0x7326,0xc7));var _0x6732=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7326[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6732('0x0'))('api');var moment=require(_0x6732('0x1'));var BPromise=require(_0x6732('0x2'));var rp=require(_0x6732('0x3'));var fetch=require(_0x6732('0x4'));var fs=require('fs');var path=require(_0x6732('0x5'));var rimraf=require(_0x6732('0x6'));var config=require(_0x6732('0x7'));var attributes=require(_0x6732('0x8'));module[_0x6732('0x9')]=function(_0x46372b,_0x5114ee){return _0x46372b[_0x6732('0xa')](_0x6732('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x6732('0xc'),'fields':[_0x6732('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x6732('0xd')],'type':_0x6732('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x82c63d,_0x31e964,_0x40d4fc){var _0x33a929=_0x46372b[_0x6732('0xf')];var _0x5db2c0=_0x82c63d[_0x6732('0x10')]({'plain':!![]});if(_0x5db2c0['direction'][_0x6732('0x11')]()==='in'||_0x5db2c0[_0x6732('0x12')][_0x6732('0x11')]()==='out'&&!_0x5db2c0[_0x6732('0x13')]&&!_[_0x6732('0x14')](_0x5db2c0[_0x6732('0x15')])){_0x33a929[_0x6732('0x16')][_0x6732('0x17')]({'where':{'id':_0x5db2c0[_0x6732('0x18')]}})[_0x6732('0x19')](function(_0x26a7f6){if(_0x26a7f6){_0x26a7f6[_0x6732('0x1a')]({'lastMsgAt':_0x5db2c0[_0x6732('0x1b')],'lastMsgDirection':_0x5db2c0['direction'][_0x6732('0x11')]()});}})['catch'](function(_0x3a3f58){console[_0x6732('0x1c')](_0x3a3f58);});}if(_0x5db2c0[_0x6732('0x12')]==='out'&&!_0x5db2c0[_0x6732('0x13')]){var _0x5dec8c;_0x33a929[_0x6732('0x1d')]['find']({'where':{'id':_0x5db2c0[_0x6732('0x1e')]},'raw':!![]})[_0x6732('0x19')](function(_0x526857){_0x5dec8c=_0x526857;if(_0x5dec8c&&_0x5dec8c[_0x6732('0x1f')]){switch(_0x5dec8c[_0x6732('0x1f')]){case _0x6732('0x20'):var _0x10921f=require(_0x6732('0x20'));if(_0x5dec8c[_0x6732('0x21')]&&_0x5dec8c[_0x6732('0x22')]&&_0x5dec8c[_0x6732('0x23')]){var _0x24a1a7=new _0x10921f(_0x5dec8c[_0x6732('0x21')],_0x5dec8c[_0x6732('0x22')]);_0x24a1a7[_0x6732('0x24')][_0x6732('0x25')]({'body':_0x5db2c0['body'],'to':'whatsapp:'+_0x5db2c0[_0x6732('0x23')],'from':_0x6732('0x26')+_0x5dec8c['phone'],'statusCallback':_0x5dec8c['remote']+'/api/whatsapp/messages/'+_0x5db2c0['id']+_0x6732('0x27')+_0x5dec8c[_0x6732('0x28')]})[_0x6732('0x19')](function(_0x3b29bd){if(_0x3b29bd['sid']){return _0x82c63d[_0x6732('0x1a')]({'messageId':_0x3b29bd[_0x6732('0x29')]});}})['catch'](function(_0x2d3e1f){logger[_0x6732('0x1c')](_0x6732('0x2a'),_0x6732('0x2b'),'twilio',util['inspect'](_0x2d3e1f,{'showHidden':![],'depth':null}));});}else{logger[_0x6732('0x1c')](_0x6732('0x2a'),_0x6732('0x2b'),'twilio',_0x6732('0x2c'));}break;case _0x6732('0x2d'):var _0x232650=_0x5dec8c[_0x6732('0x21')];var _0x39aeee=_0x5dec8c[_0x6732('0x22')];var _0x6da91e=_0x5dec8c[_0x6732('0x2e')]+_0x6732('0x2f')+_0x232650+_0x6732('0x30');var _0x37af6f={'to':[_0x5db2c0[_0x6732('0x23')]],'message':{'type':_0x6732('0x31'),'text':_0x5db2c0[_0x6732('0xd')]}};var _0x154205={'method':_0x6732('0x32'),'uri':_0x6da91e,'headers':{'Authorization':'Bearer\x20'+_0x39aeee,'Content-Type':'application/json'},'body':_0x37af6f,'json':!![]};rp(_0x154205)[_0x6732('0x19')](function(_0x5f0fde){if(_0x5f0fde[_0x6732('0x33')][0x0][_0x6732('0x34')]){return _0x82c63d[_0x6732('0x1a')]({'messageId':_0x5f0fde[_0x6732('0x33')][0x0]['message_id']});}})[_0x6732('0x35')](function(_0x5617e7){logger[_0x6732('0x36')](_0x6732('0x37'),_0x5617e7);});break;}}})['finally'](function(){_0x40d4fc();});}else{_0x40d4fc();}}},'charset':_0x6732('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6f33=['models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','error','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','sinch','/whatsapp/v1/','/messages/','POST','application/json','message_id','catch','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT'];(function(_0x5a63f0,_0x16d346){var _0x5a42ac=function(_0x5569c5){while(--_0x5569c5){_0x5a63f0['push'](_0x5a63f0['shift']());}};_0x5a42ac(++_0x16d346);}(_0x6f33,0x169));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x36f3('0x0'));var logger=require(_0x36f3('0x1'))(_0x36f3('0x2'));var moment=require(_0x36f3('0x3'));var BPromise=require(_0x36f3('0x4'));var rp=require(_0x36f3('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x36f3('0x6'));var rimraf=require(_0x36f3('0x7'));var config=require(_0x36f3('0x8'));var attributes=require(_0x36f3('0x9'));module['exports']=function(_0x5105d3,_0x740a4){return _0x5105d3[_0x36f3('0xa')](_0x36f3('0xb'),attributes,{'tableName':_0x36f3('0xc'),'paranoid':![],'indexes':[{'name':_0x36f3('0xd'),'fields':['messageId']},{'name':_0x36f3('0xe'),'fields':[_0x36f3('0xf')],'type':_0x36f3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34d90b,_0x751db0,_0x1c149f){var _0x4e9cbf=_0x5105d3[_0x36f3('0x11')];var _0x25f539=_0x34d90b[_0x36f3('0x12')]({'plain':!![]});if(_0x25f539[_0x36f3('0x13')]['toLowerCase']()==='in'||_0x25f539[_0x36f3('0x13')][_0x36f3('0x14')]()===_0x36f3('0x15')&&!_0x25f539[_0x36f3('0x16')]&&!_[_0x36f3('0x17')](_0x25f539[_0x36f3('0x18')])){_0x4e9cbf[_0x36f3('0x19')][_0x36f3('0x1a')]({'where':{'id':_0x25f539['WhatsappInteractionId']}})[_0x36f3('0x1b')](function(_0x4fad32){if(_0x4fad32){_0x4fad32['update']({'lastMsgAt':_0x25f539[_0x36f3('0x1c')],'lastMsgDirection':_0x25f539['direction']['toLowerCase']()});}})['catch'](function(_0x210aee){console[_0x36f3('0x1d')](_0x210aee);});}if(_0x25f539[_0x36f3('0x13')]===_0x36f3('0x15')&&!_0x25f539[_0x36f3('0x16')]){var _0x51addc;_0x4e9cbf['WhatsappAccount']['find']({'where':{'id':_0x25f539[_0x36f3('0x1e')]},'raw':!![]})[_0x36f3('0x1b')](function(_0x1bb06c){_0x51addc=_0x1bb06c;if(_0x51addc&&_0x51addc[_0x36f3('0x1f')]){switch(_0x51addc['type']){case'twilio':var _0x98dfd0=require(_0x36f3('0x20'));if(_0x51addc[_0x36f3('0x21')]&&_0x51addc[_0x36f3('0x22')]&&_0x51addc[_0x36f3('0x23')]){var _0x395ed4=new _0x98dfd0(_0x51addc[_0x36f3('0x21')],_0x51addc['authToken']);_0x395ed4[_0x36f3('0x24')]['create']({'body':_0x25f539[_0x36f3('0xf')],'to':_0x36f3('0x25')+_0x25f539['phone'],'from':_0x36f3('0x25')+_0x51addc[_0x36f3('0x23')],'statusCallback':_0x51addc['remote']+_0x36f3('0x26')+_0x25f539['id']+_0x36f3('0x27')+_0x51addc['token']})['then'](function(_0x4cd8b5){if(_0x4cd8b5[_0x36f3('0x28')]){return _0x34d90b[_0x36f3('0x29')]({'messageId':_0x4cd8b5[_0x36f3('0x28')]});}})['catch'](function(_0x5767b8){logger[_0x36f3('0x1d')](_0x36f3('0x2a'),'afterCreate',_0x36f3('0x20'),util[_0x36f3('0x2b')](_0x5767b8,{'showHidden':![],'depth':null}));});}else{logger[_0x36f3('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x36f3('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x36f3('0x2c'):var _0x263305=_0x51addc[_0x36f3('0x21')];var _0x57c5d5=_0x51addc[_0x36f3('0x22')];var _0x3a13aa=_0x51addc['baseUrl']+_0x36f3('0x2d')+_0x263305+_0x36f3('0x2e');var _0x1e1f35={'to':[_0x25f539['phone']],'message':{'type':'text','text':_0x25f539['body']}};var _0x503d8b={'method':_0x36f3('0x2f'),'uri':_0x3a13aa,'headers':{'Authorization':'Bearer\x20'+_0x57c5d5,'Content-Type':_0x36f3('0x30')},'body':_0x1e1f35,'json':!![]};rp(_0x503d8b)[_0x36f3('0x1b')](function(_0x45b1c7){if(_0x45b1c7['statuses'][0x0]['message_id']){return _0x34d90b[_0x36f3('0x29')]({'messageId':_0x45b1c7['statuses'][0x0][_0x36f3('0x31')]});}})[_0x36f3('0x32')](function(_0xf0ccb0){logger['err'](_0x36f3('0x33'),_0xf0ccb0);});break;}}})[_0x36f3('0x34')](function(){_0x1c149f();});}else{_0x1c149f();}}},'charset':'utf8mb4','collate':_0x36f3('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 1f305b1..8e722e2 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 _0x16c3=['result','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x16c3,0x13f));var _0x316c=function(_0x394702,_0x2f43fd){_0x394702=_0x394702-0x0;var _0x1473fd=_0x16c3[_0x394702];return _0x1473fd;};'use strict';var _=require(_0x316c('0x0'));var util=require(_0x316c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x316c('0x2'));var fs=require('fs');var Redis=require(_0x316c('0x3'));var db=require(_0x316c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x316c('0x5'))(_0x316c('0x6'));var config=require(_0x316c('0x7'));var jayson=require(_0x316c('0x8'));var client=jayson[_0x316c('0x9')][_0x316c('0xa')]({'port':0x232a});config[_0x316c('0xb')]=_[_0x316c('0xc')](config[_0x316c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x316c('0xb')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x537a78,_0x454d76,_0x2c8a1c){return new BPromise(function(_0x394b97,_0xc067d8){return client[_0x316c('0xd')](_0x537a78,_0x2c8a1c)[_0x316c('0xe')](function(_0x253372){logger[_0x316c('0xf')](_0x316c('0x10'),_0x454d76,_0x316c('0x11'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x454d76,'request\x20sent',JSON[_0x316c('0x12')](_0x253372));if(_0x253372['error']){if(_0x253372[_0x316c('0x13')][_0x316c('0x14')]===0x1f4){logger['error'](_0x316c('0x10'),_0x454d76,_0x253372[_0x316c('0x13')][_0x316c('0x15')]);return _0xc067d8(_0x253372[_0x316c('0x13')]['message']);}logger[_0x316c('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x454d76,_0x253372['error']['message']);return _0x394b97(_0x253372[_0x316c('0x13')][_0x316c('0x15')]);}else{logger['info'](_0x316c('0x10'),_0x454d76,_0x316c('0x11'));_0x394b97(_0x253372[_0x316c('0x16')]['message']);}})['catch'](function(_0x51ae67){logger[_0x316c('0x13')](_0x316c('0x10'),_0x454d76,_0x51ae67);_0xc067d8(_0x51ae67);});});}exports[_0x316c('0x17')]=function(_0x1afa09){var _0x344e85=this;return new Promise(function(_0x32e9e0,_0x87abec){return db[_0x316c('0x18')][_0x316c('0x19')](_0x1afa09[_0x316c('0x1a')],{'raw':_0x1afa09[_0x316c('0x1b')]?_0x1afa09[_0x316c('0x1b')][_0x316c('0x1c')]===undefined?!![]:![]:!![]})[_0x316c('0xe')](function(_0x41325f){logger['info'](_0x316c('0x17'),_0x1afa09);logger[_0x316c('0x1d')]('CreateWhatsappMessage',_0x1afa09,JSON['stringify'](_0x41325f));_0x32e9e0(_0x41325f);})[_0x316c('0x1e')](function(_0x597f07){logger['error']('CreateWhatsappMessage',_0x597f07[_0x316c('0x15')],_0x1afa09);_0x87abec(_0x344e85[_0x316c('0x13')](0x1f4,_0x597f07[_0x316c('0x15')]));});});}; \ No newline at end of file +var _0x7b71=['WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','debug'];(function(_0x3dddd8,_0x4a2afc){var _0xda5a01=function(_0x54757a){while(--_0x54757a){_0x3dddd8['push'](_0x3dddd8['shift']());}};_0xda5a01(++_0x4a2afc);}(_0x7b71,0xcd));var _0x17b7=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0x7b71[_0x49d280];return _0x25274a;};'use strict';var _=require(_0x17b7('0x0'));var util=require(_0x17b7('0x1'));var moment=require('moment');var BPromise=require(_0x17b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17b7('0x4'))('rpc');var config=require(_0x17b7('0x5'));var jayson=require(_0x17b7('0x6'));var client=jayson[_0x17b7('0x7')][_0x17b7('0x8')]({'port':0x232a});config[_0x17b7('0x9')]=_[_0x17b7('0xa')](config[_0x17b7('0x9')],{'host':_0x17b7('0xb'),'port':0x18eb});var socket=require(_0x17b7('0xc'))(new Redis(config[_0x17b7('0x9')]));require(_0x17b7('0xd'))[_0x17b7('0xe')](socket);function respondWithRpcPromise(_0x206f75,_0x1942ba,_0x17ea21){return new BPromise(function(_0x48ba1b,_0x3a397c){return client[_0x17b7('0xf')](_0x206f75,_0x17ea21)[_0x17b7('0x10')](function(_0x52e127){logger['info'](_0x17b7('0x11'),_0x1942ba,'request\x20sent');logger[_0x17b7('0x12')](_0x17b7('0x13'),_0x1942ba,_0x17b7('0x14'),JSON[_0x17b7('0x15')](_0x52e127));if(_0x52e127[_0x17b7('0x16')]){if(_0x52e127['error'][_0x17b7('0x17')]===0x1f4){logger[_0x17b7('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x1942ba,_0x52e127[_0x17b7('0x16')][_0x17b7('0x18')]);return _0x3a397c(_0x52e127['error'][_0x17b7('0x18')]);}logger[_0x17b7('0x16')](_0x17b7('0x11'),_0x1942ba,_0x52e127[_0x17b7('0x16')][_0x17b7('0x18')]);return _0x48ba1b(_0x52e127[_0x17b7('0x16')]['message']);}else{logger[_0x17b7('0x19')](_0x17b7('0x11'),_0x1942ba,_0x17b7('0x14'));_0x48ba1b(_0x52e127['result'][_0x17b7('0x18')]);}})[_0x17b7('0x1a')](function(_0xf7c8b6){logger[_0x17b7('0x16')](_0x17b7('0x11'),_0x1942ba,_0xf7c8b6);_0x3a397c(_0xf7c8b6);});});}exports[_0x17b7('0x1b')]=function(_0x2e0c3d){var _0x14e9cb=this;return new Promise(function(_0x393a51,_0x50085c){return db[_0x17b7('0x1c')][_0x17b7('0x1d')](_0x2e0c3d[_0x17b7('0x1e')],{'raw':_0x2e0c3d['options']?_0x2e0c3d[_0x17b7('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x563c74){logger[_0x17b7('0x19')](_0x17b7('0x1b'),_0x2e0c3d);logger[_0x17b7('0x12')]('CreateWhatsappMessage',_0x2e0c3d,JSON[_0x17b7('0x15')](_0x563c74));_0x393a51(_0x563c74);})[_0x17b7('0x1a')](function(_0x570281){logger[_0x17b7('0x16')](_0x17b7('0x1b'),_0x570281[_0x17b7('0x18')],_0x2e0c3d);_0x50085c(_0x14e9cb[_0x17b7('0x16')](0x1f4,_0x570281[_0x17b7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7a8e27b..68d1906 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 _0xe2dc=['length','./whatsappMessage.events','save','update','emit','register'];(function(_0x3769c1,_0x4a05b5){var _0x5838f3=function(_0x104926){while(--_0x104926){_0x3769c1['push'](_0x3769c1['shift']());}};_0x5838f3(++_0x4a05b5);}(_0xe2dc,0x6d));var _0xce2d=function(_0x32751f,_0x1b5f4c){_0x32751f=_0x32751f-0x0;var _0x59f585=_0xe2dc[_0x32751f];return _0x59f585;};'use strict';var WhatsappMessageEvents=require(_0xce2d('0x0'));var events=[_0xce2d('0x1'),'remove',_0xce2d('0x2')];function createListener(_0x44649c,_0x53ebf6){return function(_0x37fdb5){_0x53ebf6[_0xce2d('0x3')](_0x44649c,_0x37fdb5);};}function removeListener(_0x4e52a1,_0x45aa6c){return function(){WhatsappMessageEvents['removeListener'](_0x4e52a1,_0x45aa6c);};}exports[_0xce2d('0x4')]=function(_0x1f5825){for(var _0x5ce49c=0x0,_0x420c6c=events[_0xce2d('0x5')];_0x5ce49c<_0x420c6c;_0x5ce49c++){var _0x29da9d=events[_0x5ce49c];var _0x3b9cf9=createListener('whatsappMessage:'+_0x29da9d,_0x1f5825);WhatsappMessageEvents['on'](_0x29da9d,_0x3b9cf9);}}; \ No newline at end of file +var _0x813c=['removeListener','length','whatsappMessage:','./whatsappMessage.events','remove','update','emit'];(function(_0x2722d1,_0xbb1eeb){var _0x3efed8=function(_0x27b88e){while(--_0x27b88e){_0x2722d1['push'](_0x2722d1['shift']());}};_0x3efed8(++_0xbb1eeb);}(_0x813c,0xce));var _0xc813=function(_0x1cc695,_0x41bced){_0x1cc695=_0x1cc695-0x0;var _0xa2eb4=_0x813c[_0x1cc695];return _0xa2eb4;};'use strict';var WhatsappMessageEvents=require(_0xc813('0x0'));var events=['save',_0xc813('0x1'),_0xc813('0x2')];function createListener(_0x17f986,_0xa7ec70){return function(_0x3a5422){_0xa7ec70[_0xc813('0x3')](_0x17f986,_0x3a5422);};}function removeListener(_0x4353e0,_0xdc5fbe){return function(){WhatsappMessageEvents[_0xc813('0x4')](_0x4353e0,_0xdc5fbe);};}exports['register']=function(_0x29f725){for(var _0x24ebdf=0x0,_0x392c21=events[_0xc813('0x5')];_0x24ebdf<_0x392c21;_0x24ebdf++){var _0xb972bd=events[_0x24ebdf];var _0x24ef78=createListener(_0xc813('0x6')+_0xb972bd,_0x29f725);WhatsappMessageEvents['on'](_0xb972bd,_0x24ef78);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 8e0f3af..fcd2cfc 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 _0x02b4=['/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x5bdcf9,_0x16ab7b){var _0x1c188d=function(_0x16dc42){while(--_0x16dc42){_0x5bdcf9['push'](_0x5bdcf9['shift']());}};_0x1c188d(++_0x16ab7b);}(_0x02b4,0xc5));var _0x402b=function(_0x5433c6,_0x3c7824){_0x5433c6=_0x5433c6-0x0;var _0x40e25f=_0x02b4[_0x5433c6];return _0x40e25f;};'use strict';var multer=require(_0x402b('0x0'));var util=require('util');var path=require(_0x402b('0x1'));var timeout=require(_0x402b('0x2'));var express=require(_0x402b('0x3'));var router=express[_0x402b('0x4')]();var fs_extra=require(_0x402b('0x5'));var auth=require(_0x402b('0x6'));var interaction=require(_0x402b('0x7'));var config=require(_0x402b('0x8'));var controller=require(_0x402b('0x9'));router[_0x402b('0xa')]('/',auth[_0x402b('0xb')](),controller[_0x402b('0xc')]);router['get'](_0x402b('0xd'),auth['isAuthenticated'](),controller[_0x402b('0xe')]);router[_0x402b('0xa')](_0x402b('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x402b('0x10'),auth['isAuthenticated'](),controller[_0x402b('0x11')]);router['get'](_0x402b('0x12'),auth[_0x402b('0xb')](),controller[_0x402b('0x13')]);router[_0x402b('0xa')](_0x402b('0x14'),auth[_0x402b('0xb')](),controller[_0x402b('0x15')]);router[_0x402b('0x16')]('/',auth[_0x402b('0xb')](),controller['create']);router['post'](_0x402b('0x12'),auth[_0x402b('0xb')](),controller[_0x402b('0x17')]);router[_0x402b('0x16')](_0x402b('0x14'),auth[_0x402b('0xb')](),controller[_0x402b('0x18')]);router[_0x402b('0x19')](_0x402b('0xf'),auth[_0x402b('0xb')](),controller[_0x402b('0x1a')]);router['delete'](_0x402b('0xf'),auth[_0x402b('0xb')](),controller[_0x402b('0x1b')]);router['delete'](_0x402b('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x402b('0x1c')]('/:id/users',auth[_0x402b('0xb')](),controller[_0x402b('0x1d')]);module[_0x402b('0x1e')]=router; \ No newline at end of file +var _0x74e8=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x422bf9,_0xf80fd0){var _0x38333a=function(_0x5ca047){while(--_0x5ca047){_0x422bf9['push'](_0x422bf9['shift']());}};_0x38333a(++_0xf80fd0);}(_0x74e8,0x165));var _0x874e=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x74e8[_0x2d4065];return _0xef6016;};'use strict';var multer=require(_0x874e('0x0'));var util=require('util');var path=require(_0x874e('0x1'));var timeout=require(_0x874e('0x2'));var express=require(_0x874e('0x3'));var router=express['Router']();var fs_extra=require(_0x874e('0x4'));var auth=require(_0x874e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x874e('0x6'));var controller=require(_0x874e('0x7'));router[_0x874e('0x8')]('/',auth[_0x874e('0x9')](),controller[_0x874e('0xa')]);router[_0x874e('0x8')](_0x874e('0xb'),auth['isAuthenticated'](),controller[_0x874e('0xc')]);router['get'](_0x874e('0xd'),auth[_0x874e('0x9')](),controller[_0x874e('0xe')]);router[_0x874e('0x8')](_0x874e('0xf'),auth[_0x874e('0x9')](),controller[_0x874e('0x10')]);router[_0x874e('0x8')](_0x874e('0x11'),auth[_0x874e('0x9')](),controller[_0x874e('0x12')]);router[_0x874e('0x8')](_0x874e('0x13'),auth[_0x874e('0x9')](),controller[_0x874e('0x14')]);router['post']('/',auth[_0x874e('0x9')](),controller[_0x874e('0x15')]);router[_0x874e('0x16')](_0x874e('0x11'),auth[_0x874e('0x9')](),controller[_0x874e('0x17')]);router[_0x874e('0x16')](_0x874e('0x13'),auth['isAuthenticated'](),controller[_0x874e('0x18')]);router[_0x874e('0x19')](_0x874e('0xd'),auth['isAuthenticated'](),controller[_0x874e('0x1a')]);router[_0x874e('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x874e('0x1c')]);router[_0x874e('0x1b')](_0x874e('0x11'),auth[_0x874e('0x9')](),controller[_0x874e('0x1d')]);router[_0x874e('0x1b')]('/:id/users',auth[_0x874e('0x9')](),controller['removeAgents']);module[_0x874e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9fb058b..afae4ed 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 _0x152f=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x152f,0x144));var _0xf152=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x152f[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'name':{'type':Sequelize[_0xf152('0x2')],'unique':_0xf152('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xf152('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf152('0x5'),_0xf152('0x6'),_0xf152('0x7'))},'description':{'type':Sequelize[_0xf152('0x2')]}}; \ No newline at end of file +var _0x39cb=['roundrobin','exports','STRING','INTEGER','ENUM','beepall'];(function(_0x205168,_0x4eb4ee){var _0x329b7e=function(_0x4a2398){while(--_0x4a2398){_0x205168['push'](_0x205168['shift']());}};_0x329b7e(++_0x4eb4ee);}(_0x39cb,0x1bd));var _0xb39c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x39cb[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0xb39c('0x0')]={'name':{'type':Sequelize[_0xb39c('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xb39c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb39c('0x3')]('rrmemory',_0xb39c('0x4'),_0xb39c('0x5'))},'description':{'type':Sequelize[_0xb39c('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index bb06f98..4701347 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 _0x69a4=['undefined','limit','offset','count','set','reject','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','describe','pick','WhatsappQueueId','UserWhatsappQueue','findAll','User','UserId','whatsappPause','updatedAt','%s/%s','SIP','createdAt','getTeams','findOne','Team','rawAttributes','ids','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json'];(function(_0x36838d,_0x5bd85b){var _0x2e0400=function(_0x124711){while(--_0x124711){_0x36838d['push'](_0x36838d['shift']());}};_0x2e0400(++_0x5bd85b);}(_0x69a4,0x69));var _0x469a=function(_0x4ad6c8,_0x2efa20){_0x4ad6c8=_0x4ad6c8-0x0;var _0x5c00a0=_0x69a4[_0x4ad6c8];return _0x5c00a0;};'use strict';var emlformat=require(_0x469a('0x0'));var rimraf=require(_0x469a('0x1'));var zipdir=require(_0x469a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x469a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x469a('0x4'));var path=require(_0x469a('0x5'));var sox=require(_0x469a('0x6'));var csv=require(_0x469a('0x7'));var ejs=require(_0x469a('0x8'));var fs=require('fs');var fs_extra=require(_0x469a('0x9'));var _=require(_0x469a('0xa'));var squel=require(_0x469a('0xb'));var crypto=require(_0x469a('0xc'));var jsforce=require(_0x469a('0xd'));var deskjs=require(_0x469a('0xe'));var toCsv=require(_0x469a('0x7'));var querystring=require(_0x469a('0xf'));var Papa=require(_0x469a('0x10'));var Redis=require('ioredis');var authService=require(_0x469a('0x11'));var qs=require(_0x469a('0x12'));var as=require(_0x469a('0x13'));var hardwareService=require(_0x469a('0x14'));var logger=require(_0x469a('0x15'))('api');var utils=require(_0x469a('0x16'));var config=require(_0x469a('0x17'));var licenseUtil=require(_0x469a('0x18'));var db=require(_0x469a('0x19'))['db'];config[_0x469a('0x1a')]=_[_0x469a('0x1b')](config[_0x469a('0x1a')],{'host':_0x469a('0x1c'),'port':0x18eb});var socket=require(_0x469a('0x1d'))(new Redis(config[_0x469a('0x1a')]));require(_0x469a('0x1e'))[_0x469a('0x1f')](socket);function respondWithStatusCode(_0x5a379f,_0x1d76cb){_0x1d76cb=_0x1d76cb||0xcc;return function(_0x14fb3c){if(_0x14fb3c){return _0x5a379f[_0x469a('0x20')](_0x1d76cb);}return _0x5a379f[_0x469a('0x21')](_0x1d76cb)[_0x469a('0x22')]();};}function respondWithResult(_0x1b4c62,_0x4db594){_0x4db594=_0x4db594||0xc8;return function(_0x171ea4){if(_0x171ea4){return _0x1b4c62[_0x469a('0x21')](_0x4db594)[_0x469a('0x23')](_0x171ea4);}};}function respondWithFilteredResult(_0x4db78d,_0x4cbc60){return function(_0x265978){if(_0x265978){var _0x243877=typeof _0x4cbc60['offset']===_0x469a('0x24')&&typeof _0x4cbc60[_0x469a('0x25')]===_0x469a('0x24');var _0x3f9258=_0x265978['count'];var _0x531848=_0x243877?0x0:_0x4cbc60[_0x469a('0x26')];var _0x482b56=_0x243877?_0x265978[_0x469a('0x27')]:_0x4cbc60['offset']+_0x4cbc60['limit'];var _0x1a80cd;if(_0x482b56>=_0x3f9258){_0x482b56=_0x3f9258;_0x1a80cd=0xc8;}else{_0x1a80cd=0xce;}_0x4db78d[_0x469a('0x21')](_0x1a80cd);return _0x4db78d[_0x469a('0x28')]('Content-Range',_0x531848+'-'+_0x482b56+'/'+_0x3f9258)[_0x469a('0x23')](_0x265978);}return null;};}function patchUpdates(_0x41784e){return function(_0x3b3d1f){try{jsonpatch['apply'](_0x3b3d1f,_0x41784e,!![]);}catch(_0x41a30f){return BPromise[_0x469a('0x29')](_0x41a30f);}return _0x3b3d1f[_0x469a('0x2a')]();};}function saveUpdates(_0x247457,_0xbe2066){return function(_0x1eb8e0){if(_0x1eb8e0){return _0x1eb8e0['update'](_0x247457)[_0x469a('0x2b')](function(_0x56e909){return _0x56e909;});}return null;};}function removeEntity(_0x4eef3e,_0xcc6052){return function(_0x2a5ccc){if(_0x2a5ccc){return _0x2a5ccc[_0x469a('0x2c')]()[_0x469a('0x2b')](function(){var _0xb9830b=_0x2a5ccc[_0x469a('0x2d')]({'plain':!![]});var _0x960380=_0x469a('0x2e');return db[_0x469a('0x2f')][_0x469a('0x2c')]({'where':{'type':_0x960380,'resourceId':_0xb9830b['id']}})[_0x469a('0x2b')](function(){return _0x2a5ccc;});})[_0x469a('0x2b')](function(){_0x4eef3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44eb43,_0x9453d6){return function(_0x56a5ef){if(!_0x56a5ef){_0x44eb43['sendStatus'](0x194);}return _0x56a5ef;};}function handleError(_0xf57583,_0x1d713d){_0x1d713d=_0x1d713d||0x1f4;return function(_0xe7b89b){logger[_0x469a('0x30')](_0xe7b89b[_0x469a('0x31')]);if(_0xe7b89b['name']){delete _0xe7b89b[_0x469a('0x32')];}_0xf57583['status'](_0x1d713d)[_0x469a('0x33')](_0xe7b89b);};}exports[_0x469a('0x34')]=function(_0x26e2b5,_0x4bc8a7){var _0x4e8304={},_0x2babd7={},_0x137840={'count':0x0,'rows':[]};var _0x55fff7=_[_0x469a('0x35')](db[_0x469a('0x36')]['rawAttributes'],function(_0x444ad2){return{'name':_0x444ad2[_0x469a('0x37')],'type':_0x444ad2[_0x469a('0x38')]['key']};});_0x2babd7['model']=_['map'](_0x55fff7,_0x469a('0x32'));_0x2babd7[_0x469a('0x39')]=_[_0x469a('0x3a')](_0x26e2b5[_0x469a('0x39')]);_0x2babd7[_0x469a('0x3b')]=_[_0x469a('0x3c')](_0x2babd7[_0x469a('0x3d')],_0x2babd7['query']);_0x4e8304[_0x469a('0x3e')]=_[_0x469a('0x3c')](_0x2babd7['model'],qs['fields'](_0x26e2b5[_0x469a('0x39')][_0x469a('0x3f')]));_0x4e8304[_0x469a('0x3e')]=_0x4e8304['attributes'][_0x469a('0x40')]?_0x4e8304[_0x469a('0x3e')]:_0x2babd7[_0x469a('0x3d')];if(!_0x26e2b5[_0x469a('0x39')][_0x469a('0x41')](_0x469a('0x42'))){_0x4e8304[_0x469a('0x25')]=qs['limit'](_0x26e2b5[_0x469a('0x39')][_0x469a('0x25')]);_0x4e8304[_0x469a('0x26')]=qs[_0x469a('0x26')](_0x26e2b5[_0x469a('0x39')]['offset']);}_0x4e8304[_0x469a('0x43')]=qs['sort'](_0x26e2b5[_0x469a('0x39')][_0x469a('0x44')]);_0x4e8304[_0x469a('0x45')]=qs[_0x469a('0x3b')](_['pick'](_0x26e2b5['query'],_0x2babd7[_0x469a('0x3b')]),_0x55fff7);if(_0x26e2b5['query'][_0x469a('0x46')]){_0x4e8304[_0x469a('0x45')]=_[_0x469a('0x47')](_0x4e8304[_0x469a('0x45')],{'$or':_[_0x469a('0x35')](_0x55fff7,function(_0x22a895){if(_0x22a895['type']!==_0x469a('0x48')){var _0x484d24={};_0x484d24[_0x22a895['name']]={'$like':'%'+_0x26e2b5[_0x469a('0x39')][_0x469a('0x46')]+'%'};return _0x484d24;}})});}_0x4e8304=_[_0x469a('0x47')]({},_0x4e8304,_0x26e2b5[_0x469a('0x49')]);var _0x40ac6a={'where':_0x4e8304[_0x469a('0x45')]};return db[_0x469a('0x36')][_0x469a('0x27')](_0x40ac6a)['then'](function(_0x57d3a8){_0x137840[_0x469a('0x27')]=_0x57d3a8;if(_0x26e2b5['query'][_0x469a('0x4a')]){_0x4e8304['include']=[{'all':!![]}];}return db[_0x469a('0x36')]['findAll'](_0x4e8304);})['then'](function(_0x1150c5){_0x137840[_0x469a('0x4b')]=_0x1150c5;return _0x137840;})[_0x469a('0x2b')](respondWithFilteredResult(_0x4bc8a7,_0x4e8304))[_0x469a('0x4c')](handleError(_0x4bc8a7,null));};exports[_0x469a('0x4d')]=function(_0xf5c3cf,_0x261404){var _0x285b18={'raw':!![],'where':{'id':_0xf5c3cf[_0x469a('0x4e')]['id']}},_0x211e59={};_0x211e59['model']=_[_0x469a('0x3a')](db[_0x469a('0x36')]['rawAttributes']);_0x211e59['query']=_['keys'](_0xf5c3cf[_0x469a('0x39')]);_0x211e59['filters']=_[_0x469a('0x3c')](_0x211e59[_0x469a('0x3d')],_0x211e59['query']);_0x285b18['attributes']=_[_0x469a('0x3c')](_0x211e59[_0x469a('0x3d')],qs['fields'](_0xf5c3cf['query'][_0x469a('0x3f')]));_0x285b18[_0x469a('0x3e')]=_0x285b18['attributes'][_0x469a('0x40')]?_0x285b18[_0x469a('0x3e')]:_0x211e59[_0x469a('0x3d')];if(_0xf5c3cf[_0x469a('0x39')][_0x469a('0x4a')]){_0x285b18[_0x469a('0x4f')]=[{'all':!![]}];}_0x285b18=_[_0x469a('0x47')]({},_0x285b18,_0xf5c3cf[_0x469a('0x49')]);return db[_0x469a('0x36')]['find'](_0x285b18)[_0x469a('0x2b')](handleEntityNotFound(_0x261404,null))[_0x469a('0x2b')](respondWithResult(_0x261404,null))[_0x469a('0x4c')](handleError(_0x261404,null));};exports[_0x469a('0x50')]=function(_0x4aadfc,_0x3296a5){return db[_0x469a('0x36')][_0x469a('0x50')](_0x4aadfc[_0x469a('0x51')],{})[_0x469a('0x2b')](function(_0x5d406e){var _0x53e2c4=_0x4aadfc['user'][_0x469a('0x2d')]({'plain':!![]});if(!_0x53e2c4)throw new Error(_0x469a('0x52'));if(_0x53e2c4[_0x469a('0x53')]==='user'){var _0x4c3fb4=_0x5d406e[_0x469a('0x2d')]({'plain':!![]});var _0x5f4e3d='WhatsappQueues';return db[_0x469a('0x54')][_0x469a('0x55')]({'where':{'name':_0x5f4e3d,'userProfileId':_0x53e2c4[_0x469a('0x56')]},'raw':!![]})['then'](function(_0x5cfb40){if(_0x5cfb40&&_0x5cfb40[_0x469a('0x57')]===0x0){return db['UserProfileResource'][_0x469a('0x50')]({'name':_0x4c3fb4[_0x469a('0x32')],'resourceId':_0x4c3fb4['id'],'type':_0x5cfb40[_0x469a('0x32')],'sectionId':_0x5cfb40['id']},{})[_0x469a('0x2b')](function(){return _0x5d406e;});}else{return _0x5d406e;}})[_0x469a('0x4c')](function(_0x563fa5){logger[_0x469a('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x563fa5);throw _0x563fa5;});}return _0x5d406e;})[_0x469a('0x2b')](respondWithResult(_0x3296a5,0xc9))['catch'](handleError(_0x3296a5,null));};exports[_0x469a('0x58')]=function(_0x3cdb25,_0x3f3bf8){if(_0x3cdb25[_0x469a('0x51')]['id']){delete _0x3cdb25[_0x469a('0x51')]['id'];}return db[_0x469a('0x36')][_0x469a('0x55')]({'where':{'id':_0x3cdb25[_0x469a('0x4e')]['id']}})[_0x469a('0x2b')](handleEntityNotFound(_0x3f3bf8,null))['then'](saveUpdates(_0x3cdb25[_0x469a('0x51')],null))[_0x469a('0x2b')](respondWithResult(_0x3f3bf8,null))[_0x469a('0x4c')](handleError(_0x3f3bf8,null));};exports[_0x469a('0x2c')]=function(_0x1e461a,_0x97709b){return db[_0x469a('0x36')][_0x469a('0x55')]({'where':{'id':_0x1e461a[_0x469a('0x4e')]['id']}})[_0x469a('0x2b')](handleEntityNotFound(_0x97709b,null))['then'](removeEntity(_0x97709b,null))[_0x469a('0x4c')](handleError(_0x97709b,null));};exports[_0x469a('0x59')]=function(_0x4d6b1e,_0x43fa9f){return db[_0x469a('0x36')][_0x469a('0x59')]()[_0x469a('0x2b')](respondWithResult(_0x43fa9f,null))[_0x469a('0x4c')](handleError(_0x43fa9f,null));};exports['getMembers']=function(_0x45b7e5,_0x39f7ed,_0x20e94d){var _0x5186e9={'raw':!![],'where':{}},_0x157b4d={},_0xf0042a;return db[_0x469a('0x36')]['findOne']({'where':{'id':_0x45b7e5[_0x469a('0x4e')]['id']}})[_0x469a('0x2b')](handleEntityNotFound(_0x39f7ed,null))['then'](function(_0x5c99dc){if(_0x5c99dc){_0xf0042a=_0x5c99dc['get']({'plain':!![]});_0x157b4d[_0x469a('0x3d')]=_[_0x469a('0x3a')](db['UserWhatsappQueue']['rawAttributes']);_0x157b4d[_0x469a('0x39')]=_[_0x469a('0x3a')](_0x45b7e5[_0x469a('0x39')]);_0x157b4d[_0x469a('0x3b')]=_[_0x469a('0x3c')](_0x157b4d['model'],_0x157b4d[_0x469a('0x39')]);_0x5186e9[_0x469a('0x3e')]=_['intersection'](_0x157b4d['model'],qs[_0x469a('0x3f')](_0x45b7e5[_0x469a('0x39')][_0x469a('0x3f')]));_0x5186e9[_0x469a('0x3e')]=_0x5186e9[_0x469a('0x3e')][_0x469a('0x40')]?_0x5186e9['attributes']:_0x157b4d[_0x469a('0x3d')];if(!_0x45b7e5[_0x469a('0x39')][_0x469a('0x41')](_0x469a('0x42'))){_0x5186e9['limit']=qs[_0x469a('0x25')](_0x45b7e5[_0x469a('0x39')]['limit']);_0x5186e9['offset']=qs[_0x469a('0x26')](_0x45b7e5[_0x469a('0x39')][_0x469a('0x26')]);}_0x5186e9[_0x469a('0x43')]=qs[_0x469a('0x44')](_0x45b7e5[_0x469a('0x39')][_0x469a('0x44')]);_0x5186e9['where']=qs[_0x469a('0x3b')](_[_0x469a('0x5a')](_0x45b7e5['query'],_0x157b4d[_0x469a('0x3b')]));_0x5186e9[_0x469a('0x45')][_0x469a('0x5b')]=_0x5c99dc['id'];if(_0x45b7e5[_0x469a('0x39')][_0x469a('0x46')]){_0x5186e9[_0x469a('0x45')]=_[_0x469a('0x47')](_0x5186e9[_0x469a('0x45')],{'$or':_['map'](_0x5186e9[_0x469a('0x3e')],function(_0x32a093){var _0x31f3fc={};_0x31f3fc[_0x32a093]={'$like':'%'+_0x45b7e5[_0x469a('0x39')][_0x469a('0x46')]+'%'};return _0x31f3fc;})});}_0x5186e9=_[_0x469a('0x47')]({},_0x5186e9,_0x45b7e5[_0x469a('0x49')]);return db[_0x469a('0x5c')][_0x469a('0x5d')](_0x5186e9);}})[_0x469a('0x2b')](function(_0x4cb24c){if(_0x4cb24c){return db[_0x469a('0x5e')]['findAndCountAll']({'where':{'id':_[_0x469a('0x35')](_0x4cb24c,_0x469a('0x5f')),'role':'agent'},'attributes':['id','name',_0x469a('0x60'),_0x469a('0x61'),'createdAt']});}})['then'](function(_0x29c5d4){if(_0x29c5d4){return{'count':_0x29c5d4[_0x469a('0x27')],'rows':_[_0x469a('0x35')](_0x29c5d4[_0x469a('0x4b')],function(_0x1e29a9){return{'membername':_0x1e29a9[_0x469a('0x32')],'UserId':_0x1e29a9['id'],'queue_name':_0xf0042a[_0x469a('0x32')],'WhatsappQueueId':_0xf0042a['id'],'interface':util['format'](_0x469a('0x62'),_0x469a('0x63'),_0x1e29a9[_0x469a('0x32')]),'penalty':0x0,'paused':_0x1e29a9['whatsappPause'],'createdAt':_0x1e29a9[_0x469a('0x64')],'updatedAt':_0x1e29a9[_0x469a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x469a('0x2b')](respondWithFilteredResult(_0x39f7ed,_0x5186e9))['catch'](handleError(_0x39f7ed,null));};exports[_0x469a('0x65')]=function(_0x304faa,_0xd93e50,_0x2d271c){var _0x3c830b={};var _0x3a7aff={};var _0x4ed9e4;var _0x10b899;return db[_0x469a('0x36')][_0x469a('0x66')]({'where':{'id':_0x304faa['params']['id']}})[_0x469a('0x2b')](handleEntityNotFound(_0xd93e50,null))[_0x469a('0x2b')](function(_0x485208){if(_0x485208){_0x4ed9e4=_0x485208;_0x3a7aff[_0x469a('0x3d')]=_['keys'](db[_0x469a('0x67')][_0x469a('0x68')]);_0x3a7aff[_0x469a('0x39')]=_[_0x469a('0x3a')](_0x304faa[_0x469a('0x39')]);_0x3a7aff['filters']=_[_0x469a('0x3c')](_0x3a7aff[_0x469a('0x3d')],_0x3a7aff[_0x469a('0x39')]);_0x3c830b[_0x469a('0x3e')]=_[_0x469a('0x3c')](_0x3a7aff[_0x469a('0x3d')],qs[_0x469a('0x3f')](_0x304faa['query'][_0x469a('0x3f')]));_0x3c830b[_0x469a('0x3e')]=_0x3c830b[_0x469a('0x3e')][_0x469a('0x40')]?_0x3c830b[_0x469a('0x3e')]:_0x3a7aff[_0x469a('0x3d')];_0x3c830b[_0x469a('0x43')]=qs[_0x469a('0x44')](_0x304faa[_0x469a('0x39')][_0x469a('0x44')]);_0x3c830b['where']=qs[_0x469a('0x3b')](_[_0x469a('0x5a')](_0x304faa['query'],_0x3a7aff[_0x469a('0x3b')]));if(_0x304faa[_0x469a('0x39')]['filter']){_0x3c830b[_0x469a('0x45')]=_[_0x469a('0x47')](_0x3c830b[_0x469a('0x45')],{'$or':_[_0x469a('0x35')](_0x3c830b[_0x469a('0x3e')],function(_0x43e367){var _0x5997e3={};_0x5997e3[_0x43e367]={'$like':'%'+_0x304faa[_0x469a('0x39')][_0x469a('0x46')]+'%'};return _0x5997e3;})});}_0x3c830b=_[_0x469a('0x47')]({},_0x3c830b,_0x304faa[_0x469a('0x49')]);return _0x4ed9e4[_0x469a('0x65')](_0x3c830b);}})[_0x469a('0x2b')](function(_0x33d08a){if(_0x33d08a){_0x10b899=_0x33d08a[_0x469a('0x40')];if(!_0x304faa['query'][_0x469a('0x41')]('nolimit')){_0x3c830b[_0x469a('0x25')]=qs[_0x469a('0x25')](_0x304faa[_0x469a('0x39')][_0x469a('0x25')]);_0x3c830b['offset']=qs[_0x469a('0x26')](_0x304faa[_0x469a('0x39')][_0x469a('0x26')]);}return _0x4ed9e4[_0x469a('0x65')](_0x3c830b);}})[_0x469a('0x2b')](function(_0x44ed17){if(_0x44ed17){return _0x44ed17?{'count':_0x10b899,'rows':_0x44ed17}:null;}})[_0x469a('0x2b')](respondWithResult(_0xd93e50,null))[_0x469a('0x4c')](handleError(_0xd93e50,null));};exports['addTeams']=function(_0x4d3759,_0x5691ad,_0x50f053){var _0x2bbc94=_0x4d3759['body'][_0x469a('0x69')];return db[_0x469a('0x67')]['findAll']({'where':{'id':_0x2bbc94},'attributes':['id'],'include':[{'model':db[_0x469a('0x5e')],'as':_0x469a('0x6a'),'attributes':['id',_0x469a('0x32'),'online',_0x469a('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x5e1617){if(_0x5e1617){var _0x24b23c=_[_0x469a('0x6c')](_0x5e1617,function(_0x5bc4b0){var _0x2b69d8=_0x5bc4b0[_0x469a('0x2d')]({'plain':!![]});return _0x2b69d8[_0x469a('0x6a')];});return db['WhatsappQueue'][_0x469a('0x55')]({'where':{'id':_0x4d3759[_0x469a('0x4e')]['id']}})[_0x469a('0x2b')](function(_0xd82809){return db[_0x469a('0x6d')][_0x469a('0x6e')](function(_0x237824){return _0xd82809[_0x469a('0x6f')](_0x2bbc94,{'transaction':_0x237824})[_0x469a('0x2b')](function(){return BPromise[_0x469a('0x70')](_0x24b23c,function(_0x14fd90){return db[_0x469a('0x5c')]['findOrCreate']({'where':{'UserId':_0x14fd90['id'],'WhatsappQueueId':_0x4d3759[_0x469a('0x4e')]['id']},'transaction':_0x237824});});})[_0x469a('0x2b')](function(){_0x24b23c[_0x469a('0x71')](function(_0x26ae87){socket[_0x469a('0x72')](_0x469a('0x73'),{'UserId':_0x26ae87['id'],'WhatsappQueueId':_0xd82809['id']});});});});});}})[_0x469a('0x2b')](respondWithStatusCode(_0x5691ad,null))[_0x469a('0x4c')](handleError(_0x5691ad,null));};exports[_0x469a('0x74')]=function(_0x167c42,_0xacda72,_0x5a3876){return db['Team']['findAll']({'where':{'id':_0x167c42['query'][_0x469a('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x469a('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xacda72,null))[_0x469a('0x2b')](function(_0x26a3fa){var _0x387c22=_[_0x469a('0x35')](_0x26a3fa,'id');var _0x5f5919=[];var _0x3d186f=[];var _0x589f27=squel[_0x469a('0x75')]();_0x589f27[_0x469a('0x76')]('tq.TeamId')[_0x469a('0x77')](_0x469a('0x78'),'tq')[_0x469a('0x79')](_0x469a('0x7a'),'ut',_0x469a('0x7b'))[_0x469a('0x45')](_0x469a('0x7c'),_0x167c42[_0x469a('0x4e')]['id']);for(var _0x2f0ab6=0x0;_0x2f0ab6<_0x26a3fa[_0x469a('0x40')];_0x2f0ab6+=0x1){let _0x2c7738=_0x26a3fa[_0x2f0ab6];for(var _0x4f8e6c=0x0;_0x4f8e6c<_0x2c7738[_0x469a('0x6a')][_0x469a('0x40')];_0x4f8e6c+=0x1){let _0x1cc2f7=_0x2c7738[_0x469a('0x6a')][_0x4f8e6c];var _0x472c9b=_0x589f27['clone']();_0x472c9b[_0x469a('0x45')]('ut.UserId\x20=\x20?',_0x1cc2f7['id']);_0x3d186f[_0x469a('0x7d')](db[_0x469a('0x6d')][_0x469a('0x39')](_0x472c9b['toString'](),{'type':db[_0x469a('0x6d')][_0x469a('0x7e')][_0x469a('0x7f')]})['then'](function(_0x3323a2){if(_0x3323a2[_0x469a('0x40')]===0x1){return _0x1cc2f7['id'];}else{var _0x20c3e3=_[_0x469a('0x80')](_[_0x469a('0x35')](_0x3323a2,'TeamId'),function(_0x2ad605){return _[_0x469a('0x81')](_0x387c22,_0x2ad605);});if(_0x20c3e3){return _0x1cc2f7['id'];}}}));}}return BPromise['all'](_0x3d186f)[_0x469a('0x2b')](function(_0x5529ec){_0x5f5919=_(_0x5f5919)[_0x469a('0x82')](_0x5529ec)[_0x469a('0x83')]()[_0x469a('0x84')]();return db[_0x469a('0x36')]['find']({'where':{'id':_0x167c42['params']['id']}})['then'](function(_0x34e6cd){return db[_0x469a('0x6d')]['transaction'](function(_0x35406e){return _0x34e6cd[_0x469a('0x74')](_0x167c42[_0x469a('0x39')][_0x469a('0x69')],{'transaction':_0x35406e})[_0x469a('0x2b')](function(){if(!_[_0x469a('0x85')](_0x5f5919)){return _0x34e6cd[_0x469a('0x86')](_0x5f5919,{'transaction':_0x35406e});}})[_0x469a('0x2b')](function(){_0x5f5919['forEach'](function(_0xbde3fb){socket['emit'](_0x469a('0x87'),{'UserId':_0xbde3fb,'WhatsappQueueId':_0x34e6cd['id']});});});});});});})[_0x469a('0x2b')](respondWithStatusCode(_0xacda72,null))[_0x469a('0x4c')](handleError(_0xacda72,null));};exports[_0x469a('0x88')]=function(_0x488c1e,_0x4b3516,_0x122411){return db[_0x469a('0x36')][_0x469a('0x55')]({'where':{'id':_0x488c1e[_0x469a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4b3516,null))[_0x469a('0x2b')](function(_0x158e02){if(_0x158e02){return _0x158e02[_0x469a('0x88')](_0x488c1e['body'][_0x469a('0x69')],_[_0x469a('0x89')](_0x488c1e[_0x469a('0x51')],[_0x469a('0x69'),'id'])||{})[_0x469a('0x8a')](function(_0x2955c6){for(var _0x434ca0=0x0;_0x434ca0<_0x488c1e[_0x469a('0x51')][_0x469a('0x69')]['length'];_0x434ca0+=0x1){socket[_0x469a('0x72')]('userWhatsappQueue:save',{'UserId':Number(_0x488c1e[_0x469a('0x51')][_0x469a('0x69')][_0x434ca0]),'WhatsappQueueId':Number(_0x488c1e[_0x469a('0x4e')]['id'])});}return _0x2955c6;});}})['then'](respondWithResult(_0x4b3516,null))[_0x469a('0x4c')](handleError(_0x4b3516,null));};exports['removeAgents']=function(_0x5eb6a3,_0x3761b7,_0x13ea3c){return db[_0x469a('0x36')][_0x469a('0x55')]({'where':{'id':_0x5eb6a3[_0x469a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3761b7,null))[_0x469a('0x2b')](function(_0x2f34f1){if(_0x2f34f1){return _0x2f34f1['removeAgents'](_0x5eb6a3[_0x469a('0x39')][_0x469a('0x69')])['then'](function(){if(_[_0x469a('0x8b')](_0x5eb6a3[_0x469a('0x39')][_0x469a('0x69')])){for(var _0x5e79f5=0x0;_0x5e79f5<_0x5eb6a3['query']['ids'][_0x469a('0x40')];_0x5e79f5+=0x1){socket['emit'](_0x469a('0x87'),{'UserId':Number(_0x5eb6a3['query']['ids'][_0x5e79f5]),'WhatsappQueueId':Number(_0x5eb6a3[_0x469a('0x4e')]['id'])});}}else{socket[_0x469a('0x72')](_0x469a('0x87'),{'UserId':Number(_0x5eb6a3[_0x469a('0x39')][_0x469a('0x69')]),'WhatsappQueueId':Number(_0x5eb6a3[_0x469a('0x4e')]['id'])});}});}})[_0x469a('0x2b')](respondWithStatusCode(_0x3761b7,null))[_0x469a('0x4c')](handleError(_0x3761b7,null));};exports[_0x469a('0x8c')]=function(_0x525d63,_0x227998,_0x2c1d44){var _0x5451ed={};var _0x2bf358={};var _0x382fdf;var _0x422778;return db[_0x469a('0x36')][_0x469a('0x66')]({'where':{'id':_0x525d63[_0x469a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x227998,null))['then'](function(_0x3ce686){if(_0x3ce686){_0x382fdf=_0x3ce686;_0x2bf358['model']=_['keys'](db[_0x469a('0x5e')][_0x469a('0x68')]);_0x2bf358[_0x469a('0x39')]=_[_0x469a('0x3a')](_0x525d63[_0x469a('0x39')]);_0x2bf358[_0x469a('0x3b')]=_['intersection'](_0x2bf358[_0x469a('0x3d')],_0x2bf358[_0x469a('0x39')]);_0x5451ed['attributes']=_[_0x469a('0x3c')](_0x2bf358[_0x469a('0x3d')],qs[_0x469a('0x3f')](_0x525d63[_0x469a('0x39')][_0x469a('0x3f')]));_0x5451ed['attributes']=_0x5451ed[_0x469a('0x3e')][_0x469a('0x40')]?_0x5451ed[_0x469a('0x3e')]:_0x2bf358[_0x469a('0x3d')];_0x5451ed[_0x469a('0x43')]=qs[_0x469a('0x44')](_0x525d63['query']['sort']);_0x5451ed[_0x469a('0x45')]=qs[_0x469a('0x3b')](_[_0x469a('0x5a')](_0x525d63['query'],_0x2bf358[_0x469a('0x3b')]));if(_0x525d63[_0x469a('0x39')][_0x469a('0x46')]){_0x5451ed[_0x469a('0x45')]=_[_0x469a('0x47')](_0x5451ed[_0x469a('0x45')],{'$or':_[_0x469a('0x35')](_0x5451ed[_0x469a('0x3e')],function(_0x1739b1){var _0x5ad13d={};_0x5ad13d[_0x1739b1]={'$like':'%'+_0x525d63['query'][_0x469a('0x46')]+'%'};return _0x5ad13d;})});}_0x5451ed=_[_0x469a('0x47')]({},_0x5451ed,_0x525d63[_0x469a('0x49')]);return _0x382fdf[_0x469a('0x8c')](_0x5451ed);}})['then'](function(_0x3db5d4){if(_0x3db5d4){_0x422778=_0x3db5d4[_0x469a('0x40')];if(!_0x525d63[_0x469a('0x39')][_0x469a('0x41')]('nolimit')){_0x5451ed['limit']=qs['limit'](_0x525d63[_0x469a('0x39')][_0x469a('0x25')]);_0x5451ed[_0x469a('0x26')]=qs[_0x469a('0x26')](_0x525d63['query']['offset']);}return _0x382fdf[_0x469a('0x8c')](_0x5451ed);}})[_0x469a('0x2b')](function(_0x183328){if(_0x183328){return _0x183328?{'count':_0x422778,'rows':_0x183328}:null;}})[_0x469a('0x2b')](respondWithResult(_0x227998,null))[_0x469a('0x4c')](handleError(_0x227998,null));}; \ No newline at end of file +var _0x79d4=['Content-Range','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','params','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','whatsappPause','createdAt','rows','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset'];(function(_0x4917be,_0x57a1e4){var _0x5e5167=function(_0x5701af){while(--_0x5701af){_0x4917be['push'](_0x4917be['shift']());}};_0x5e5167(++_0x57a1e4);}(_0x79d4,0xef));var _0x479d=function(_0x3859c3,_0x58096b){_0x3859c3=_0x3859c3-0x0;var _0x1c66fb=_0x79d4[_0x3859c3];return _0x1c66fb;};'use strict';var emlformat=require(_0x479d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x479d('0x1'));var jsonpatch=require(_0x479d('0x2'));var rp=require(_0x479d('0x3'));var moment=require('moment');var BPromise=require(_0x479d('0x4'));var Mustache=require(_0x479d('0x5'));var util=require(_0x479d('0x6'));var path=require(_0x479d('0x7'));var sox=require(_0x479d('0x8'));var csv=require(_0x479d('0x9'));var ejs=require(_0x479d('0xa'));var fs=require('fs');var fs_extra=require(_0x479d('0xb'));var _=require(_0x479d('0xc'));var squel=require(_0x479d('0xd'));var crypto=require(_0x479d('0xe'));var jsforce=require(_0x479d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x479d('0x9'));var querystring=require(_0x479d('0x10'));var Papa=require('papaparse');var Redis=require(_0x479d('0x11'));var authService=require(_0x479d('0x12'));var qs=require(_0x479d('0x13'));var as=require(_0x479d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x479d('0x15'))(_0x479d('0x16'));var utils=require(_0x479d('0x17'));var config=require(_0x479d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x479d('0x19'))['db'];config[_0x479d('0x1a')]=_[_0x479d('0x1b')](config['redis'],{'host':_0x479d('0x1c'),'port':0x18eb});var socket=require(_0x479d('0x1d'))(new Redis(config[_0x479d('0x1a')]));require(_0x479d('0x1e'))[_0x479d('0x1f')](socket);function respondWithStatusCode(_0x321bf9,_0x40e1a4){_0x40e1a4=_0x40e1a4||0xcc;return function(_0x408509){if(_0x408509){return _0x321bf9[_0x479d('0x20')](_0x40e1a4);}return _0x321bf9['status'](_0x40e1a4)['end']();};}function respondWithResult(_0xbd41e6,_0x5025c2){_0x5025c2=_0x5025c2||0xc8;return function(_0x1da547){if(_0x1da547){return _0xbd41e6[_0x479d('0x21')](_0x5025c2)[_0x479d('0x22')](_0x1da547);}};}function respondWithFilteredResult(_0x3ce05e,_0x1c312c){return function(_0x2456f4){if(_0x2456f4){var _0x10fb5a=typeof _0x1c312c['offset']===_0x479d('0x23')&&typeof _0x1c312c[_0x479d('0x24')]===_0x479d('0x23');var _0x4bc3ce=_0x2456f4[_0x479d('0x25')];var _0x285a0b=_0x10fb5a?0x0:_0x1c312c[_0x479d('0x26')];var _0x498f11=_0x10fb5a?_0x2456f4[_0x479d('0x25')]:_0x1c312c[_0x479d('0x26')]+_0x1c312c[_0x479d('0x24')];var _0x77dd98;if(_0x498f11>=_0x4bc3ce){_0x498f11=_0x4bc3ce;_0x77dd98=0xc8;}else{_0x77dd98=0xce;}_0x3ce05e[_0x479d('0x21')](_0x77dd98);return _0x3ce05e['set'](_0x479d('0x27'),_0x285a0b+'-'+_0x498f11+'/'+_0x4bc3ce)[_0x479d('0x22')](_0x2456f4);}return null;};}function patchUpdates(_0x14bcab){return function(_0x507e3b){try{jsonpatch['apply'](_0x507e3b,_0x14bcab,!![]);}catch(_0x3dc08f){return BPromise[_0x479d('0x28')](_0x3dc08f);}return _0x507e3b['save']();};}function saveUpdates(_0x5a4309,_0xebe4e2){return function(_0x5b70b0){if(_0x5b70b0){return _0x5b70b0[_0x479d('0x29')](_0x5a4309)[_0x479d('0x2a')](function(_0x3ba31e){return _0x3ba31e;});}return null;};}function removeEntity(_0x4897e2,_0x1f31fc){return function(_0x5e170a){if(_0x5e170a){return _0x5e170a[_0x479d('0x2b')]()[_0x479d('0x2a')](function(){var _0x1b8be3=_0x5e170a[_0x479d('0x2c')]({'plain':!![]});var _0xa1eda5=_0x479d('0x2d');return db[_0x479d('0x2e')][_0x479d('0x2b')]({'where':{'type':_0xa1eda5,'resourceId':_0x1b8be3['id']}})[_0x479d('0x2a')](function(){return _0x5e170a;});})[_0x479d('0x2a')](function(){_0x4897e2[_0x479d('0x21')](0xcc)[_0x479d('0x2f')]();});}};}function handleEntityNotFound(_0x467f77,_0x39923c){return function(_0x12a089){if(!_0x12a089){_0x467f77[_0x479d('0x20')](0x194);}return _0x12a089;};}function handleError(_0x424863,_0x3f11f4){_0x3f11f4=_0x3f11f4||0x1f4;return function(_0x4b7fc3){logger['error'](_0x4b7fc3[_0x479d('0x30')]);if(_0x4b7fc3[_0x479d('0x31')]){delete _0x4b7fc3['name'];}_0x424863[_0x479d('0x21')](_0x3f11f4)[_0x479d('0x32')](_0x4b7fc3);};}exports[_0x479d('0x33')]=function(_0x46e129,_0x5c1f54){var _0x241549={},_0x46a806={},_0x358444={'count':0x0,'rows':[]};var _0x416d9a=_[_0x479d('0x34')](db[_0x479d('0x35')][_0x479d('0x36')],function(_0x189e13){return{'name':_0x189e13['fieldName'],'type':_0x189e13[_0x479d('0x37')][_0x479d('0x38')]};});_0x46a806[_0x479d('0x39')]=_[_0x479d('0x34')](_0x416d9a,_0x479d('0x31'));_0x46a806[_0x479d('0x3a')]=_[_0x479d('0x3b')](_0x46e129[_0x479d('0x3a')]);_0x46a806[_0x479d('0x3c')]=_['intersection'](_0x46a806['model'],_0x46a806[_0x479d('0x3a')]);_0x241549['attributes']=_[_0x479d('0x3d')](_0x46a806[_0x479d('0x39')],qs[_0x479d('0x3e')](_0x46e129[_0x479d('0x3a')][_0x479d('0x3e')]));_0x241549['attributes']=_0x241549[_0x479d('0x3f')][_0x479d('0x40')]?_0x241549['attributes']:_0x46a806[_0x479d('0x39')];if(!_0x46e129['query'][_0x479d('0x41')](_0x479d('0x42'))){_0x241549[_0x479d('0x24')]=qs[_0x479d('0x24')](_0x46e129['query'][_0x479d('0x24')]);_0x241549[_0x479d('0x26')]=qs[_0x479d('0x26')](_0x46e129[_0x479d('0x3a')]['offset']);}_0x241549[_0x479d('0x43')]=qs[_0x479d('0x44')](_0x46e129['query'][_0x479d('0x44')]);_0x241549[_0x479d('0x45')]=qs[_0x479d('0x3c')](_[_0x479d('0x46')](_0x46e129[_0x479d('0x3a')],_0x46a806[_0x479d('0x3c')]),_0x416d9a);if(_0x46e129[_0x479d('0x3a')][_0x479d('0x47')]){_0x241549[_0x479d('0x45')]=_[_0x479d('0x48')](_0x241549[_0x479d('0x45')],{'$or':_[_0x479d('0x34')](_0x416d9a,function(_0x1b4806){if(_0x1b4806[_0x479d('0x37')]!==_0x479d('0x49')){var _0x5bc63a={};_0x5bc63a[_0x1b4806[_0x479d('0x31')]]={'$like':'%'+_0x46e129['query'][_0x479d('0x47')]+'%'};return _0x5bc63a;}})});}_0x241549=_[_0x479d('0x48')]({},_0x241549,_0x46e129[_0x479d('0x4a')]);var _0x1f464b={'where':_0x241549[_0x479d('0x45')]};return db['WhatsappQueue'][_0x479d('0x25')](_0x1f464b)[_0x479d('0x2a')](function(_0x14cb38){_0x358444[_0x479d('0x25')]=_0x14cb38;if(_0x46e129[_0x479d('0x3a')]['includeAll']){_0x241549[_0x479d('0x4b')]=[{'all':!![]}];}return db[_0x479d('0x35')]['findAll'](_0x241549);})[_0x479d('0x2a')](function(_0x3f7787){_0x358444['rows']=_0x3f7787;return _0x358444;})[_0x479d('0x2a')](respondWithFilteredResult(_0x5c1f54,_0x241549))[_0x479d('0x4c')](handleError(_0x5c1f54,null));};exports['show']=function(_0x22fa97,_0x85c64d){var _0x1b6dea={'raw':!![],'where':{'id':_0x22fa97['params']['id']}},_0x260381={};_0x260381['model']=_[_0x479d('0x3b')](db[_0x479d('0x35')][_0x479d('0x36')]);_0x260381[_0x479d('0x3a')]=_[_0x479d('0x3b')](_0x22fa97[_0x479d('0x3a')]);_0x260381[_0x479d('0x3c')]=_[_0x479d('0x3d')](_0x260381['model'],_0x260381[_0x479d('0x3a')]);_0x1b6dea[_0x479d('0x3f')]=_[_0x479d('0x3d')](_0x260381[_0x479d('0x39')],qs[_0x479d('0x3e')](_0x22fa97[_0x479d('0x3a')][_0x479d('0x3e')]));_0x1b6dea[_0x479d('0x3f')]=_0x1b6dea[_0x479d('0x3f')][_0x479d('0x40')]?_0x1b6dea[_0x479d('0x3f')]:_0x260381[_0x479d('0x39')];if(_0x22fa97[_0x479d('0x3a')]['includeAll']){_0x1b6dea[_0x479d('0x4b')]=[{'all':!![]}];}_0x1b6dea=_[_0x479d('0x48')]({},_0x1b6dea,_0x22fa97[_0x479d('0x4a')]);return db[_0x479d('0x35')][_0x479d('0x4d')](_0x1b6dea)[_0x479d('0x2a')](handleEntityNotFound(_0x85c64d,null))[_0x479d('0x2a')](respondWithResult(_0x85c64d,null))[_0x479d('0x4c')](handleError(_0x85c64d,null));};exports[_0x479d('0x4e')]=function(_0x56eb0f,_0x3930be){return db['WhatsappQueue'][_0x479d('0x4e')](_0x56eb0f['body'],{})[_0x479d('0x2a')](function(_0x2a6e3e){var _0x309165=_0x56eb0f['user']['get']({'plain':!![]});if(!_0x309165)throw new Error(_0x479d('0x4f'));if(_0x309165[_0x479d('0x50')]==='user'){var _0x36b388=_0x2a6e3e[_0x479d('0x2c')]({'plain':!![]});var _0x4c8cc5='WhatsappQueues';return db[_0x479d('0x51')][_0x479d('0x4d')]({'where':{'name':_0x4c8cc5,'userProfileId':_0x309165[_0x479d('0x52')]},'raw':!![]})[_0x479d('0x2a')](function(_0x2de497){if(_0x2de497&&_0x2de497['autoAssociation']===0x0){return db[_0x479d('0x2e')][_0x479d('0x4e')]({'name':_0x36b388[_0x479d('0x31')],'resourceId':_0x36b388['id'],'type':_0x2de497['name'],'sectionId':_0x2de497['id']},{})[_0x479d('0x2a')](function(){return _0x2a6e3e;});}else{return _0x2a6e3e;}})[_0x479d('0x4c')](function(_0x1ba77d){logger[_0x479d('0x53')](_0x479d('0x54'),_0x1ba77d);throw _0x1ba77d;});}return _0x2a6e3e;})[_0x479d('0x2a')](respondWithResult(_0x3930be,0xc9))[_0x479d('0x4c')](handleError(_0x3930be,null));};exports[_0x479d('0x29')]=function(_0x2ffb27,_0x2510a8){if(_0x2ffb27[_0x479d('0x55')]['id']){delete _0x2ffb27[_0x479d('0x55')]['id'];}return db[_0x479d('0x35')][_0x479d('0x4d')]({'where':{'id':_0x2ffb27['params']['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0x2510a8,null))[_0x479d('0x2a')](saveUpdates(_0x2ffb27[_0x479d('0x55')],null))[_0x479d('0x2a')](respondWithResult(_0x2510a8,null))['catch'](handleError(_0x2510a8,null));};exports[_0x479d('0x2b')]=function(_0xa865b9,_0x19bdd9){return db['WhatsappQueue'][_0x479d('0x4d')]({'where':{'id':_0xa865b9['params']['id']}})['then'](handleEntityNotFound(_0x19bdd9,null))[_0x479d('0x2a')](removeEntity(_0x19bdd9,null))[_0x479d('0x4c')](handleError(_0x19bdd9,null));};exports[_0x479d('0x56')]=function(_0x32ad70,_0x6b4733){return db['WhatsappQueue'][_0x479d('0x56')]()[_0x479d('0x2a')](respondWithResult(_0x6b4733,null))[_0x479d('0x4c')](handleError(_0x6b4733,null));};exports[_0x479d('0x57')]=function(_0x2682c6,_0x244bec,_0xf392ca){var _0x3f324f={'raw':!![],'where':{}},_0x4d29e9={},_0x53b9f7;return db[_0x479d('0x35')][_0x479d('0x58')]({'where':{'id':_0x2682c6[_0x479d('0x59')]['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0x244bec,null))[_0x479d('0x2a')](function(_0x120eb7){if(_0x120eb7){_0x53b9f7=_0x120eb7['get']({'plain':!![]});_0x4d29e9['model']=_[_0x479d('0x3b')](db['UserWhatsappQueue'][_0x479d('0x36')]);_0x4d29e9[_0x479d('0x3a')]=_['keys'](_0x2682c6['query']);_0x4d29e9[_0x479d('0x3c')]=_[_0x479d('0x3d')](_0x4d29e9[_0x479d('0x39')],_0x4d29e9['query']);_0x3f324f[_0x479d('0x3f')]=_['intersection'](_0x4d29e9['model'],qs[_0x479d('0x3e')](_0x2682c6[_0x479d('0x3a')][_0x479d('0x3e')]));_0x3f324f['attributes']=_0x3f324f[_0x479d('0x3f')]['length']?_0x3f324f[_0x479d('0x3f')]:_0x4d29e9['model'];if(!_0x2682c6[_0x479d('0x3a')][_0x479d('0x41')]('nolimit')){_0x3f324f[_0x479d('0x24')]=qs['limit'](_0x2682c6['query'][_0x479d('0x24')]);_0x3f324f[_0x479d('0x26')]=qs[_0x479d('0x26')](_0x2682c6['query'][_0x479d('0x26')]);}_0x3f324f[_0x479d('0x43')]=qs[_0x479d('0x44')](_0x2682c6[_0x479d('0x3a')]['sort']);_0x3f324f['where']=qs[_0x479d('0x3c')](_[_0x479d('0x46')](_0x2682c6[_0x479d('0x3a')],_0x4d29e9[_0x479d('0x3c')]));_0x3f324f[_0x479d('0x45')]['WhatsappQueueId']=_0x120eb7['id'];if(_0x2682c6[_0x479d('0x3a')][_0x479d('0x47')]){_0x3f324f[_0x479d('0x45')]=_[_0x479d('0x48')](_0x3f324f[_0x479d('0x45')],{'$or':_[_0x479d('0x34')](_0x3f324f[_0x479d('0x3f')],function(_0x42eee0){var _0xa1f0da={};_0xa1f0da[_0x42eee0]={'$like':'%'+_0x2682c6[_0x479d('0x3a')][_0x479d('0x47')]+'%'};return _0xa1f0da;})});}_0x3f324f=_[_0x479d('0x48')]({},_0x3f324f,_0x2682c6[_0x479d('0x4a')]);return db[_0x479d('0x5a')][_0x479d('0x5b')](_0x3f324f);}})['then'](function(_0x1fb2b2){if(_0x1fb2b2){return db[_0x479d('0x5c')][_0x479d('0x5d')]({'where':{'id':_[_0x479d('0x34')](_0x1fb2b2,_0x479d('0x5e')),'role':'agent'},'attributes':['id',_0x479d('0x31'),_0x479d('0x5f'),'updatedAt',_0x479d('0x60')]});}})[_0x479d('0x2a')](function(_0x3761e4){if(_0x3761e4){return{'count':_0x3761e4['count'],'rows':_[_0x479d('0x34')](_0x3761e4[_0x479d('0x61')],function(_0x5d4595){return{'membername':_0x5d4595[_0x479d('0x31')],'UserId':_0x5d4595['id'],'queue_name':_0x53b9f7[_0x479d('0x31')],'WhatsappQueueId':_0x53b9f7['id'],'interface':util[_0x479d('0x62')](_0x479d('0x63'),_0x479d('0x64'),_0x5d4595[_0x479d('0x31')]),'penalty':0x0,'paused':_0x5d4595['whatsappPause'],'createdAt':_0x5d4595[_0x479d('0x60')],'updatedAt':_0x5d4595['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x479d('0x2a')](respondWithFilteredResult(_0x244bec,_0x3f324f))['catch'](handleError(_0x244bec,null));};exports[_0x479d('0x65')]=function(_0x4d3fe8,_0x2bfc0c,_0x21ebdb){var _0x369536={};var _0x32b23e={};var _0x31af33;var _0x508fe2;return db[_0x479d('0x35')][_0x479d('0x58')]({'where':{'id':_0x4d3fe8[_0x479d('0x59')]['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0x2bfc0c,null))[_0x479d('0x2a')](function(_0x3e21a2){if(_0x3e21a2){_0x31af33=_0x3e21a2;_0x32b23e[_0x479d('0x39')]=_[_0x479d('0x3b')](db['Team'][_0x479d('0x36')]);_0x32b23e[_0x479d('0x3a')]=_[_0x479d('0x3b')](_0x4d3fe8[_0x479d('0x3a')]);_0x32b23e[_0x479d('0x3c')]=_[_0x479d('0x3d')](_0x32b23e[_0x479d('0x39')],_0x32b23e[_0x479d('0x3a')]);_0x369536['attributes']=_[_0x479d('0x3d')](_0x32b23e[_0x479d('0x39')],qs[_0x479d('0x3e')](_0x4d3fe8[_0x479d('0x3a')][_0x479d('0x3e')]));_0x369536[_0x479d('0x3f')]=_0x369536[_0x479d('0x3f')][_0x479d('0x40')]?_0x369536[_0x479d('0x3f')]:_0x32b23e[_0x479d('0x39')];_0x369536[_0x479d('0x43')]=qs[_0x479d('0x44')](_0x4d3fe8[_0x479d('0x3a')]['sort']);_0x369536[_0x479d('0x45')]=qs['filters'](_[_0x479d('0x46')](_0x4d3fe8[_0x479d('0x3a')],_0x32b23e['filters']));if(_0x4d3fe8['query'][_0x479d('0x47')]){_0x369536[_0x479d('0x45')]=_['merge'](_0x369536[_0x479d('0x45')],{'$or':_['map'](_0x369536['attributes'],function(_0x45c1d2){var _0x2af4b1={};_0x2af4b1[_0x45c1d2]={'$like':'%'+_0x4d3fe8['query'][_0x479d('0x47')]+'%'};return _0x2af4b1;})});}_0x369536=_['merge']({},_0x369536,_0x4d3fe8[_0x479d('0x4a')]);return _0x31af33['getTeams'](_0x369536);}})['then'](function(_0x41b94e){if(_0x41b94e){_0x508fe2=_0x41b94e[_0x479d('0x40')];if(!_0x4d3fe8['query'][_0x479d('0x41')](_0x479d('0x42'))){_0x369536[_0x479d('0x24')]=qs[_0x479d('0x24')](_0x4d3fe8[_0x479d('0x3a')][_0x479d('0x24')]);_0x369536[_0x479d('0x26')]=qs[_0x479d('0x26')](_0x4d3fe8[_0x479d('0x3a')]['offset']);}return _0x31af33[_0x479d('0x65')](_0x369536);}})[_0x479d('0x2a')](function(_0x15b0fa){if(_0x15b0fa){return _0x15b0fa?{'count':_0x508fe2,'rows':_0x15b0fa}:null;}})[_0x479d('0x2a')](respondWithResult(_0x2bfc0c,null))[_0x479d('0x4c')](handleError(_0x2bfc0c,null));};exports[_0x479d('0x66')]=function(_0x56d3c9,_0xfab78f,_0x4c4a16){var _0x250a14=_0x56d3c9[_0x479d('0x55')][_0x479d('0x67')];return db[_0x479d('0x68')][_0x479d('0x5b')]({'where':{'id':_0x250a14},'attributes':['id'],'include':[{'model':db[_0x479d('0x5c')],'as':_0x479d('0x69'),'attributes':['id','name',_0x479d('0x6a'),_0x479d('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x1c19f7){if(_0x1c19f7){var _0x20c9b5=_[_0x479d('0x6c')](_0x1c19f7,function(_0x2481d8){var _0x159682=_0x2481d8[_0x479d('0x2c')]({'plain':!![]});return _0x159682[_0x479d('0x69')];});return db[_0x479d('0x35')][_0x479d('0x4d')]({'where':{'id':_0x56d3c9['params']['id']}})[_0x479d('0x2a')](function(_0x1115a3){return db[_0x479d('0x6d')][_0x479d('0x6e')](function(_0x111b5d){return _0x1115a3[_0x479d('0x66')](_0x250a14,{'transaction':_0x111b5d})[_0x479d('0x2a')](function(){return BPromise[_0x479d('0x6f')](_0x20c9b5,function(_0x3728a4){return db['UserWhatsappQueue'][_0x479d('0x70')]({'where':{'UserId':_0x3728a4['id'],'WhatsappQueueId':_0x56d3c9[_0x479d('0x59')]['id']},'transaction':_0x111b5d});});})[_0x479d('0x2a')](function(){_0x20c9b5[_0x479d('0x71')](function(_0x13ad92){socket[_0x479d('0x72')](_0x479d('0x73'),{'UserId':_0x13ad92['id'],'WhatsappQueueId':_0x1115a3['id']});});});});});}})[_0x479d('0x2a')](respondWithStatusCode(_0xfab78f,null))[_0x479d('0x4c')](handleError(_0xfab78f,null));};exports['removeTeams']=function(_0x591a30,_0x1d2387,_0x44b150){return db['Team'][_0x479d('0x5b')]({'where':{'id':_0x591a30[_0x479d('0x3a')][_0x479d('0x67')]},'attributes':['id'],'include':[{'model':db[_0x479d('0x5c')],'as':_0x479d('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1d2387,null))[_0x479d('0x2a')](function(_0x4a7325){var _0x26a085=_[_0x479d('0x34')](_0x4a7325,'id');var _0x581e8c=[];var _0x107c7f=[];var _0x18cd73=squel[_0x479d('0x74')]();_0x18cd73[_0x479d('0x75')]('tq.TeamId')['from'](_0x479d('0x76'),'tq')[_0x479d('0x77')](_0x479d('0x78'),'ut',_0x479d('0x79'))['where']('WhatsappQueueId\x20=\x20?',_0x591a30[_0x479d('0x59')]['id']);for(var _0x1613e6=0x0;_0x1613e6<_0x4a7325[_0x479d('0x40')];_0x1613e6+=0x1){let _0x419da1=_0x4a7325[_0x1613e6];for(var _0x325d75=0x0;_0x325d75<_0x419da1[_0x479d('0x69')][_0x479d('0x40')];_0x325d75+=0x1){let _0x3feeaf=_0x419da1[_0x479d('0x69')][_0x325d75];var _0x29d91b=_0x18cd73[_0x479d('0x7a')]();_0x29d91b[_0x479d('0x45')](_0x479d('0x7b'),_0x3feeaf['id']);_0x107c7f['push'](db[_0x479d('0x6d')][_0x479d('0x3a')](_0x29d91b[_0x479d('0x7c')](),{'type':db[_0x479d('0x6d')][_0x479d('0x7d')][_0x479d('0x7e')]})[_0x479d('0x2a')](function(_0x4a549e){if(_0x4a549e[_0x479d('0x40')]===0x1){return _0x3feeaf['id'];}else{var _0x502b10=_[_0x479d('0x7f')](_[_0x479d('0x34')](_0x4a549e,'TeamId'),function(_0x7f59b5){return _[_0x479d('0x80')](_0x26a085,_0x7f59b5);});if(_0x502b10){return _0x3feeaf['id'];}}}));}}return BPromise[_0x479d('0x81')](_0x107c7f)[_0x479d('0x2a')](function(_0x338cdd){_0x581e8c=_(_0x581e8c)[_0x479d('0x82')](_0x338cdd)[_0x479d('0x83')]()[_0x479d('0x84')]();return db[_0x479d('0x35')][_0x479d('0x4d')]({'where':{'id':_0x591a30[_0x479d('0x59')]['id']}})['then'](function(_0x1b01cc){return db[_0x479d('0x6d')][_0x479d('0x6e')](function(_0x4e46af){return _0x1b01cc[_0x479d('0x85')](_0x591a30[_0x479d('0x3a')][_0x479d('0x67')],{'transaction':_0x4e46af})[_0x479d('0x2a')](function(){if(!_['isEmpty'](_0x581e8c)){return _0x1b01cc['removeAgents'](_0x581e8c,{'transaction':_0x4e46af});}})[_0x479d('0x2a')](function(){_0x581e8c[_0x479d('0x71')](function(_0x89b468){socket[_0x479d('0x72')]('userWhatsappQueue:remove',{'UserId':_0x89b468,'WhatsappQueueId':_0x1b01cc['id']});});});});});});})[_0x479d('0x2a')](respondWithStatusCode(_0x1d2387,null))['catch'](handleError(_0x1d2387,null));};exports['addAgents']=function(_0x1ecd61,_0x387e2e,_0x3866cc){return db['WhatsappQueue'][_0x479d('0x4d')]({'where':{'id':_0x1ecd61[_0x479d('0x59')]['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0x387e2e,null))['then'](function(_0x40cf84){if(_0x40cf84){return _0x40cf84['addAgents'](_0x1ecd61[_0x479d('0x55')][_0x479d('0x67')],_[_0x479d('0x86')](_0x1ecd61[_0x479d('0x55')],[_0x479d('0x67'),'id'])||{})[_0x479d('0x87')](function(_0x4a1500){for(var _0x144d82=0x0;_0x144d82<_0x1ecd61[_0x479d('0x55')][_0x479d('0x67')][_0x479d('0x40')];_0x144d82+=0x1){socket[_0x479d('0x72')](_0x479d('0x73'),{'UserId':Number(_0x1ecd61[_0x479d('0x55')]['ids'][_0x144d82]),'WhatsappQueueId':Number(_0x1ecd61[_0x479d('0x59')]['id'])});}return _0x4a1500;});}})['then'](respondWithResult(_0x387e2e,null))['catch'](handleError(_0x387e2e,null));};exports[_0x479d('0x88')]=function(_0x217b23,_0xea68bd,_0x188c82){return db[_0x479d('0x35')][_0x479d('0x4d')]({'where':{'id':_0x217b23[_0x479d('0x59')]['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0xea68bd,null))['then'](function(_0x143563){if(_0x143563){return _0x143563[_0x479d('0x88')](_0x217b23[_0x479d('0x3a')][_0x479d('0x67')])['then'](function(){if(_['isArray'](_0x217b23['query']['ids'])){for(var _0xf899c4=0x0;_0xf899c4<_0x217b23[_0x479d('0x3a')][_0x479d('0x67')][_0x479d('0x40')];_0xf899c4+=0x1){socket[_0x479d('0x72')](_0x479d('0x89'),{'UserId':Number(_0x217b23['query']['ids'][_0xf899c4]),'WhatsappQueueId':Number(_0x217b23[_0x479d('0x59')]['id'])});}}else{socket['emit'](_0x479d('0x89'),{'UserId':Number(_0x217b23[_0x479d('0x3a')][_0x479d('0x67')]),'WhatsappQueueId':Number(_0x217b23[_0x479d('0x59')]['id'])});}});}})[_0x479d('0x2a')](respondWithStatusCode(_0xea68bd,null))['catch'](handleError(_0xea68bd,null));};exports[_0x479d('0x8a')]=function(_0x4c8a91,_0x32e1e4,_0x507912){var _0x7eb773={};var _0x40bfc3={};var _0xfc9f40;var _0x7df576;return db[_0x479d('0x35')]['findOne']({'where':{'id':_0x4c8a91[_0x479d('0x59')]['id']}})[_0x479d('0x2a')](handleEntityNotFound(_0x32e1e4,null))[_0x479d('0x2a')](function(_0x366ef3){if(_0x366ef3){_0xfc9f40=_0x366ef3;_0x40bfc3[_0x479d('0x39')]=_['keys'](db['User'][_0x479d('0x36')]);_0x40bfc3[_0x479d('0x3a')]=_[_0x479d('0x3b')](_0x4c8a91[_0x479d('0x3a')]);_0x40bfc3[_0x479d('0x3c')]=_[_0x479d('0x3d')](_0x40bfc3['model'],_0x40bfc3[_0x479d('0x3a')]);_0x7eb773[_0x479d('0x3f')]=_[_0x479d('0x3d')](_0x40bfc3[_0x479d('0x39')],qs['fields'](_0x4c8a91[_0x479d('0x3a')][_0x479d('0x3e')]));_0x7eb773[_0x479d('0x3f')]=_0x7eb773[_0x479d('0x3f')][_0x479d('0x40')]?_0x7eb773['attributes']:_0x40bfc3[_0x479d('0x39')];_0x7eb773['order']=qs[_0x479d('0x44')](_0x4c8a91[_0x479d('0x3a')][_0x479d('0x44')]);_0x7eb773[_0x479d('0x45')]=qs[_0x479d('0x3c')](_[_0x479d('0x46')](_0x4c8a91[_0x479d('0x3a')],_0x40bfc3[_0x479d('0x3c')]));if(_0x4c8a91['query']['filter']){_0x7eb773[_0x479d('0x45')]=_['merge'](_0x7eb773[_0x479d('0x45')],{'$or':_['map'](_0x7eb773[_0x479d('0x3f')],function(_0x573fe1){var _0x13c11a={};_0x13c11a[_0x573fe1]={'$like':'%'+_0x4c8a91['query'][_0x479d('0x47')]+'%'};return _0x13c11a;})});}_0x7eb773=_[_0x479d('0x48')]({},_0x7eb773,_0x4c8a91[_0x479d('0x4a')]);return _0xfc9f40[_0x479d('0x8a')](_0x7eb773);}})[_0x479d('0x2a')](function(_0x30d8b9){if(_0x30d8b9){_0x7df576=_0x30d8b9[_0x479d('0x40')];if(!_0x4c8a91[_0x479d('0x3a')][_0x479d('0x41')]('nolimit')){_0x7eb773[_0x479d('0x24')]=qs[_0x479d('0x24')](_0x4c8a91['query'][_0x479d('0x24')]);_0x7eb773[_0x479d('0x26')]=qs[_0x479d('0x26')](_0x4c8a91['query'][_0x479d('0x26')]);}return _0xfc9f40[_0x479d('0x8a')](_0x7eb773);}})[_0x479d('0x2a')](function(_0x15735b){if(_0x15735b){return _0x15735b?{'count':_0x7df576,'rows':_0x15735b}:null;}})[_0x479d('0x2a')](respondWithResult(_0x32e1e4,null))['catch'](handleError(_0x32e1e4,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 83efd31..955e340 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 _0x29e8=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x46131d,_0x4e701d){var _0x301c71=function(_0x1ce369){while(--_0x1ce369){_0x46131d['push'](_0x46131d['shift']());}};_0x301c71(++_0x4e701d);}(_0x29e8,0x87));var _0x829e=function(_0x799fc4,_0x25aeb7){_0x799fc4=_0x799fc4-0x0;var _0xbf2e3e=_0x29e8[_0x799fc4];return _0xbf2e3e;};'use strict';var EventEmitter=require(_0x829e('0x0'));var WhatsappQueue=require(_0x829e('0x1'))['db'][_0x829e('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x829e('0x3')](0x0);var events={'afterCreate':_0x829e('0x4'),'afterUpdate':_0x829e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2831cc){return function(_0x2f4ab4,_0x16913f,_0x39ff11){WhatsappQueueEvents[_0x829e('0x6')](_0x2831cc+':'+_0x2f4ab4['id'],_0x2f4ab4);WhatsappQueueEvents[_0x829e('0x6')](_0x2831cc,_0x2f4ab4);_0x39ff11(null);};}for(var e in events){if(events[_0x829e('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x829e('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xdf45=['emit','exports','events','../../mysqldb','save','update','remove'];(function(_0x5eea00,_0x59bf6e){var _0xe049b5=function(_0x59840a){while(--_0x59840a){_0x5eea00['push'](_0x5eea00['shift']());}};_0xe049b5(++_0x59bf6e);}(_0xdf45,0x10c));var _0x5df4=function(_0x40d5cc,_0xf9d2c7){_0x40d5cc=_0x40d5cc-0x0;var _0x6950af=_0xdf45[_0x40d5cc];return _0x6950af;};'use strict';var EventEmitter=require(_0x5df4('0x0'));var WhatsappQueue=require(_0x5df4('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5df4('0x2'),'afterUpdate':_0x5df4('0x3'),'afterDestroy':_0x5df4('0x4')};function emitEvent(_0x56f43e){return function(_0x2fdfae,_0x29738a,_0x238252){WhatsappQueueEvents[_0x5df4('0x5')](_0x56f43e+':'+_0x2fdfae['id'],_0x2fdfae);WhatsappQueueEvents[_0x5df4('0x5')](_0x56f43e,_0x2fdfae);_0x238252(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5df4('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d797844..92ddb49 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 _0x0dee=['exports','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x16fab3,_0x371c8d){var _0x1e69cc=function(_0x435bac){while(--_0x435bac){_0x16fab3['push'](_0x16fab3['shift']());}};_0x1e69cc(++_0x371c8d);}(_0x0dee,0x18f));var _0xe0de=function(_0x44f24d,_0x4dbb8e){_0x44f24d=_0x44f24d-0x0;var _0x594c92=_0x0dee[_0x44f24d];return _0x594c92;};'use strict';var _=require('lodash');var util=require(_0xe0de('0x0'));var logger=require(_0xe0de('0x1'))(_0xe0de('0x2'));var moment=require(_0xe0de('0x3'));var BPromise=require(_0xe0de('0x4'));var rp=require(_0xe0de('0x5'));var fs=require('fs');var path=require(_0xe0de('0x6'));var rimraf=require(_0xe0de('0x7'));var config=require(_0xe0de('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xe0de('0x9')]=function(_0x22422b,_0x5cdf24){return _0x22422b['define'](_0xe0de('0xa'),attributes,{'tableName':_0xe0de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4379=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x4379,0xdf));var _0x9437=function(_0x19e5ae,_0x7c7b2b){_0x19e5ae=_0x19e5ae-0x0;var _0x7b114c=_0x4379[_0x19e5ae];return _0x7b114c;};'use strict';var _=require(_0x9437('0x0'));var util=require(_0x9437('0x1'));var logger=require(_0x9437('0x2'))(_0x9437('0x3'));var moment=require(_0x9437('0x4'));var BPromise=require(_0x9437('0x5'));var rp=require(_0x9437('0x6'));var fs=require('fs');var path=require(_0x9437('0x7'));var rimraf=require(_0x9437('0x8'));var config=require(_0x9437('0x9'));var attributes=require(_0x9437('0xa'));module[_0x9437('0xb')]=function(_0x2ce09f,_0x19ee88){return _0x2ce09f[_0x9437('0xc')](_0x9437('0xd'),attributes,{'tableName':_0x9437('0xe'),'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 af16dfa..d1954df 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 _0x4a8b=['debug','catch','raw','ShowWhatsappQueue','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappQueue.socket','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','include','map','model','then'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x4a8b,0x135));var _0xb4a8=function(_0x49258d,_0x2d4acf){_0x49258d=_0x49258d-0x0;var _0x4a406b=_0x4a8b[_0x49258d];return _0x4a406b;};'use strict';var _=require('lodash');var util=require(_0xb4a8('0x0'));var moment=require(_0xb4a8('0x1'));var BPromise=require(_0xb4a8('0x2'));var rs=require(_0xb4a8('0x3'));var fs=require('fs');var Redis=require(_0xb4a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4a8('0x5'));var logger=require(_0xb4a8('0x6'))(_0xb4a8('0x7'));var config=require(_0xb4a8('0x8'));var jayson=require(_0xb4a8('0x9'));var client=jayson[_0xb4a8('0xa')]['http']({'port':0x232a});config[_0xb4a8('0xb')]=_[_0xb4a8('0xc')](config[_0xb4a8('0xb')],{'host':_0xb4a8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4a8('0xb')]));require(_0xb4a8('0xe'))[_0xb4a8('0xf')](socket);function respondWithRpcPromise(_0xb2b61e,_0x437ced,_0x56900b){return new BPromise(function(_0x155d81,_0xd47873){return client['request'](_0xb2b61e,_0x56900b)['then'](function(_0x396601){logger[_0xb4a8('0x10')](_0xb4a8('0x11'),_0x437ced,_0xb4a8('0x12'));logger['debug'](_0xb4a8('0x13'),_0x437ced,'request\x20sent',JSON['stringify'](_0x396601));if(_0x396601[_0xb4a8('0x14')]){if(_0x396601[_0xb4a8('0x14')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x437ced,_0x396601['error'][_0xb4a8('0x15')]);return _0xd47873(_0x396601[_0xb4a8('0x14')]['message']);}logger[_0xb4a8('0x14')](_0xb4a8('0x11'),_0x437ced,_0x396601[_0xb4a8('0x14')][_0xb4a8('0x15')]);return _0x155d81(_0x396601[_0xb4a8('0x14')][_0xb4a8('0x15')]);}else{logger['info'](_0xb4a8('0x11'),_0x437ced,_0xb4a8('0x12'));_0x155d81(_0x396601[_0xb4a8('0x16')][_0xb4a8('0x15')]);}})['catch'](function(_0x2b298e){logger[_0xb4a8('0x14')](_0xb4a8('0x11'),_0x437ced,_0x2b298e);_0xd47873(_0x2b298e);});});}exports[_0xb4a8('0x17')]=function(_0xc8309b){var _0x3c4490=this;return new Promise(function(_0x572ac4,_0x278dca){return db[_0xb4a8('0x18')]['findAll']({'raw':_0xc8309b[_0xb4a8('0x19')]?_0xc8309b[_0xb4a8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xc8309b[_0xb4a8('0x19')]?_0xc8309b['options'][_0xb4a8('0x1a')]||null:null,'attributes':_0xc8309b[_0xb4a8('0x19')]?_0xc8309b['options'][_0xb4a8('0x1b')]||null:null,'limit':_0xc8309b[_0xb4a8('0x19')]?_0xc8309b[_0xb4a8('0x19')][_0xb4a8('0x1c')]||null:null,'include':_0xc8309b[_0xb4a8('0x19')]?_0xc8309b[_0xb4a8('0x19')][_0xb4a8('0x1d')]?_[_0xb4a8('0x1e')](_0xc8309b['options'][_0xb4a8('0x1d')],function(_0x28c33e){return{'model':db[_0x28c33e[_0xb4a8('0x1f')]],'as':_0x28c33e['as'],'attributes':_0x28c33e[_0xb4a8('0x1b')],'include':_0x28c33e[_0xb4a8('0x1d')]?_[_0xb4a8('0x1e')](_0x28c33e['include'],function(_0x429721){return{'model':db[_0x429721[_0xb4a8('0x1f')]],'as':_0x429721['as'],'attributes':_0x429721[_0xb4a8('0x1b')],'include':_0x429721['include']?_[_0xb4a8('0x1e')](_0x429721['include'],function(_0x5cad3e){return{'model':db[_0x5cad3e[_0xb4a8('0x1f')]],'as':_0x5cad3e['as'],'attributes':_0x5cad3e[_0xb4a8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb4a8('0x20')](function(_0x577ee1){logger[_0xb4a8('0x10')]('GetWhatsappQueue',_0xc8309b);logger[_0xb4a8('0x21')](_0xb4a8('0x17'),_0xc8309b,JSON['stringify'](_0x577ee1));_0x572ac4(_0x577ee1);})[_0xb4a8('0x22')](function(_0x5d591d){logger[_0xb4a8('0x14')]('GetWhatsappQueue',_0x5d591d[_0xb4a8('0x15')],_0xc8309b);_0x278dca(_0x3c4490[_0xb4a8('0x14')](0x1f4,_0x5d591d[_0xb4a8('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x594830){var _0x4b7794=this;return new Promise(function(_0x492648,_0x5568bb){return db[_0xb4a8('0x18')]['find']({'raw':_0x594830[_0xb4a8('0x19')]?_0x594830[_0xb4a8('0x19')][_0xb4a8('0x23')]===undefined?!![]:![]:!![],'where':_0x594830[_0xb4a8('0x19')]?_0x594830[_0xb4a8('0x19')]['where']||null:null,'attributes':_0x594830[_0xb4a8('0x19')]?_0x594830[_0xb4a8('0x19')][_0xb4a8('0x1b')]||null:null,'include':_0x594830['options']?_0x594830[_0xb4a8('0x19')][_0xb4a8('0x1d')]?_[_0xb4a8('0x1e')](_0x594830[_0xb4a8('0x19')][_0xb4a8('0x1d')],function(_0x589094){return{'model':db[_0x589094[_0xb4a8('0x1f')]],'as':_0x589094['as'],'attributes':_0x589094['attributes'],'include':_0x589094[_0xb4a8('0x1d')]?_['map'](_0x589094[_0xb4a8('0x1d')],function(_0x10fdd4){return{'model':db[_0x10fdd4[_0xb4a8('0x1f')]],'as':_0x10fdd4['as'],'attributes':_0x10fdd4[_0xb4a8('0x1b')],'include':_0x10fdd4['include']?_[_0xb4a8('0x1e')](_0x10fdd4['include'],function(_0xbf363a){return{'model':db[_0xbf363a['model']],'as':_0xbf363a['as'],'attributes':_0xbf363a[_0xb4a8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb4a8('0x20')](function(_0x1dbf91){logger[_0xb4a8('0x10')]('ShowWhatsappQueue',_0x594830);logger[_0xb4a8('0x21')](_0xb4a8('0x24'),_0x594830,JSON[_0xb4a8('0x25')](_0x1dbf91));_0x492648(_0x1dbf91);})[_0xb4a8('0x22')](function(_0x160daa){logger['error'](_0xb4a8('0x24'),_0x160daa['message'],_0x594830);_0x5568bb(_0x4b7794[_0xb4a8('0x14')](0x1f4,_0x160daa[_0xb4a8('0x15')]));});});}; \ No newline at end of file +var _0x7c28=['map','model','GetWhatsappQueue','stringify','WhatsappQueue','find','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','findAll','options','raw','where','attributes','limit','include'];(function(_0x180be3,_0x5699ac){var _0xcffc57=function(_0x45dcce){while(--_0x45dcce){_0x180be3['push'](_0x180be3['shift']());}};_0xcffc57(++_0x5699ac);}(_0x7c28,0x7f));var _0x87c2=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x7c28[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0x87c2('0x0'));var util=require('util');var moment=require(_0x87c2('0x1'));var BPromise=require(_0x87c2('0x2'));var rs=require(_0x87c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x87c2('0x4'));var logger=require(_0x87c2('0x5'))(_0x87c2('0x6'));var config=require('../../config/environment');var jayson=require(_0x87c2('0x7'));var client=jayson[_0x87c2('0x8')][_0x87c2('0x9')]({'port':0x232a});config['redis']=_[_0x87c2('0xa')](config[_0x87c2('0xb')],{'host':_0x87c2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87c2('0xb')]));require(_0x87c2('0xd'))[_0x87c2('0xe')](socket);function respondWithRpcPromise(_0x2740f7,_0x2f86ed,_0x3f2fbd){return new BPromise(function(_0x474a7e,_0x5a2fa7){return client[_0x87c2('0xf')](_0x2740f7,_0x3f2fbd)[_0x87c2('0x10')](function(_0x26bd6a){logger[_0x87c2('0x11')](_0x87c2('0x12'),_0x2f86ed,_0x87c2('0x13'));logger[_0x87c2('0x14')](_0x87c2('0x15'),_0x2f86ed,_0x87c2('0x13'),JSON['stringify'](_0x26bd6a));if(_0x26bd6a[_0x87c2('0x16')]){if(_0x26bd6a[_0x87c2('0x16')]['code']===0x1f4){logger[_0x87c2('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2f86ed,_0x26bd6a[_0x87c2('0x16')][_0x87c2('0x17')]);return _0x5a2fa7(_0x26bd6a[_0x87c2('0x16')][_0x87c2('0x17')]);}logger[_0x87c2('0x16')](_0x87c2('0x12'),_0x2f86ed,_0x26bd6a[_0x87c2('0x16')][_0x87c2('0x17')]);return _0x474a7e(_0x26bd6a['error'][_0x87c2('0x17')]);}else{logger[_0x87c2('0x11')](_0x87c2('0x12'),_0x2f86ed,_0x87c2('0x13'));_0x474a7e(_0x26bd6a[_0x87c2('0x18')][_0x87c2('0x17')]);}})[_0x87c2('0x19')](function(_0x21bc6f){logger[_0x87c2('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x2f86ed,_0x21bc6f);_0x5a2fa7(_0x21bc6f);});});}exports['GetWhatsappQueue']=function(_0x4320eb){var _0x2a3041=this;return new Promise(function(_0x4a8a31,_0xa717e){return db['WhatsappQueue'][_0x87c2('0x1a')]({'raw':_0x4320eb[_0x87c2('0x1b')]?_0x4320eb[_0x87c2('0x1b')][_0x87c2('0x1c')]===undefined?!![]:![]:!![],'where':_0x4320eb['options']?_0x4320eb[_0x87c2('0x1b')][_0x87c2('0x1d')]||null:null,'attributes':_0x4320eb['options']?_0x4320eb[_0x87c2('0x1b')][_0x87c2('0x1e')]||null:null,'limit':_0x4320eb[_0x87c2('0x1b')]?_0x4320eb['options'][_0x87c2('0x1f')]||null:null,'include':_0x4320eb['options']?_0x4320eb['options'][_0x87c2('0x20')]?_[_0x87c2('0x21')](_0x4320eb['options'][_0x87c2('0x20')],function(_0x4785c8){return{'model':db[_0x4785c8[_0x87c2('0x22')]],'as':_0x4785c8['as'],'attributes':_0x4785c8[_0x87c2('0x1e')],'include':_0x4785c8[_0x87c2('0x20')]?_['map'](_0x4785c8[_0x87c2('0x20')],function(_0x18121e){return{'model':db[_0x18121e['model']],'as':_0x18121e['as'],'attributes':_0x18121e[_0x87c2('0x1e')],'include':_0x18121e['include']?_[_0x87c2('0x21')](_0x18121e[_0x87c2('0x20')],function(_0x3e03cc){return{'model':db[_0x3e03cc[_0x87c2('0x22')]],'as':_0x3e03cc['as'],'attributes':_0x3e03cc[_0x87c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x87c2('0x10')](function(_0x4b4f68){logger[_0x87c2('0x11')](_0x87c2('0x23'),_0x4320eb);logger['debug']('GetWhatsappQueue',_0x4320eb,JSON[_0x87c2('0x24')](_0x4b4f68));_0x4a8a31(_0x4b4f68);})[_0x87c2('0x19')](function(_0x3de85b){logger[_0x87c2('0x16')](_0x87c2('0x23'),_0x3de85b[_0x87c2('0x17')],_0x4320eb);_0xa717e(_0x2a3041['error'](0x1f4,_0x3de85b['message']));});});};exports['ShowWhatsappQueue']=function(_0x5a2b92){var _0x5d6cb0=this;return new Promise(function(_0x435b49,_0x187015){return db[_0x87c2('0x25')][_0x87c2('0x26')]({'raw':_0x5a2b92[_0x87c2('0x1b')]?_0x5a2b92['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a2b92[_0x87c2('0x1b')]?_0x5a2b92['options'][_0x87c2('0x1d')]||null:null,'attributes':_0x5a2b92[_0x87c2('0x1b')]?_0x5a2b92[_0x87c2('0x1b')][_0x87c2('0x1e')]||null:null,'include':_0x5a2b92[_0x87c2('0x1b')]?_0x5a2b92[_0x87c2('0x1b')][_0x87c2('0x20')]?_[_0x87c2('0x21')](_0x5a2b92[_0x87c2('0x1b')][_0x87c2('0x20')],function(_0x433bfd){return{'model':db[_0x433bfd[_0x87c2('0x22')]],'as':_0x433bfd['as'],'attributes':_0x433bfd[_0x87c2('0x1e')],'include':_0x433bfd[_0x87c2('0x20')]?_[_0x87c2('0x21')](_0x433bfd[_0x87c2('0x20')],function(_0x1b3230){return{'model':db[_0x1b3230['model']],'as':_0x1b3230['as'],'attributes':_0x1b3230[_0x87c2('0x1e')],'include':_0x1b3230['include']?_[_0x87c2('0x21')](_0x1b3230[_0x87c2('0x20')],function(_0x26452a){return{'model':db[_0x26452a[_0x87c2('0x22')]],'as':_0x26452a['as'],'attributes':_0x26452a[_0x87c2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x87c2('0x10')](function(_0x13ccd3){logger[_0x87c2('0x11')]('ShowWhatsappQueue',_0x5a2b92);logger['debug'](_0x87c2('0x27'),_0x5a2b92,JSON[_0x87c2('0x24')](_0x13ccd3));_0x435b49(_0x13ccd3);})['catch'](function(_0x4387a2){logger[_0x87c2('0x16')](_0x87c2('0x27'),_0x4387a2[_0x87c2('0x17')],_0x5a2b92);_0x187015(_0x5d6cb0['error'](0x1f4,_0x4387a2[_0x87c2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 2d3ea05..d533134 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 _0x0c1b=['length','whatsappQueue:','./whatsappQueue.events','emit','removeListener','register'];(function(_0x44a181,_0x26891e){var _0x3a3043=function(_0x4c8e7){while(--_0x4c8e7){_0x44a181['push'](_0x44a181['shift']());}};_0x3a3043(++_0x26891e);}(_0x0c1b,0x1a6));var _0xb0c1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0c1b[_0x40a045];return _0x1a687c;};'use strict';var WhatsappQueueEvents=require(_0xb0c1('0x0'));var events=['save','remove','update'];function createListener(_0x173563,_0x55cb2a){return function(_0x17c676){_0x55cb2a[_0xb0c1('0x1')](_0x173563,_0x17c676);};}function removeListener(_0x446fd5,_0x1eed40){return function(){WhatsappQueueEvents[_0xb0c1('0x2')](_0x446fd5,_0x1eed40);};}exports[_0xb0c1('0x3')]=function(_0x5330b1){for(var _0xd21bd=0x0,_0x38b1bc=events[_0xb0c1('0x4')];_0xd21bd<_0x38b1bc;_0xd21bd++){var _0x19bb54=events[_0xd21bd];var _0x97d552=createListener(_0xb0c1('0x5')+_0x19bb54,_0x5330b1);WhatsappQueueEvents['on'](_0x19bb54,_0x97d552);}}; \ No newline at end of file +var _0xf4cf=['length','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener','register'];(function(_0x26851d,_0xc385fb){var _0x3ec9a8=function(_0x46237c){while(--_0x46237c){_0x26851d['push'](_0x26851d['shift']());}};_0x3ec9a8(++_0xc385fb);}(_0xf4cf,0x7a));var _0xff4c=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf4cf[_0x2fc012];return _0x2891f9;};'use strict';var WhatsappQueueEvents=require(_0xff4c('0x0'));var events=['save',_0xff4c('0x1'),_0xff4c('0x2')];function createListener(_0x4d52d2,_0x39ef1e){return function(_0x123fbf){_0x39ef1e[_0xff4c('0x3')](_0x4d52d2,_0x123fbf);};}function removeListener(_0x27e197,_0x54cf0a){return function(){WhatsappQueueEvents[_0xff4c('0x4')](_0x27e197,_0x54cf0a);};}exports[_0xff4c('0x5')]=function(_0x59d90a){for(var _0x259ef0=0x0,_0x78f86a=events[_0xff4c('0x6')];_0x259ef0<_0x78f86a;_0x259ef0++){var _0x4ad50f=events[_0x259ef0];var _0x475997=createListener(_0xff4c('0x7')+_0x4ad50f,_0x59d90a);WhatsappQueueEvents['on'](_0x4ad50f,_0x475997);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 81d96d8..e66fd04 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 _0x59df=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','destroy','multer','util','path','connect-timeout'];(function(_0x39ac3c,_0x3bb81d){var _0x1609d2=function(_0x5d1d1f){while(--_0x5d1d1f){_0x39ac3c['push'](_0x39ac3c['shift']());}};_0x1609d2(++_0x3bb81d);}(_0x59df,0x81));var _0xf59d=function(_0x558c73,_0x459bca){_0x558c73=_0x558c73-0x0;var _0x497bd6=_0x59df[_0x558c73];return _0x497bd6;};'use strict';var multer=require(_0xf59d('0x0'));var util=require(_0xf59d('0x1'));var path=require(_0xf59d('0x2'));var timeout=require(_0xf59d('0x3'));var express=require(_0xf59d('0x4'));var router=express[_0xf59d('0x5')]();var fs_extra=require(_0xf59d('0x6'));var auth=require(_0xf59d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf59d('0x8'));var controller=require(_0xf59d('0x9'));router[_0xf59d('0xa')]('/',auth[_0xf59d('0xb')](),controller[_0xf59d('0xc')]);router['get']('/describe',auth[_0xf59d('0xb')](),controller[_0xf59d('0xd')]);router[_0xf59d('0xa')](_0xf59d('0xe'),auth[_0xf59d('0xb')](),controller[_0xf59d('0xf')]);router['post']('/',auth[_0xf59d('0xb')](),controller[_0xf59d('0x10')]);router[_0xf59d('0x11')](_0xf59d('0xe'),auth[_0xf59d('0xb')](),controller['update']);router['delete'](_0xf59d('0xe'),auth[_0xf59d('0xb')](),controller[_0xf59d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xeb16=['exports','multer','path','connect-timeout','express','Router','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy'];(function(_0x2d4a8f,_0x1c60c7){var _0x76dfcf=function(_0x50f39d){while(--_0x50f39d){_0x2d4a8f['push'](_0x2d4a8f['shift']());}};_0x76dfcf(++_0x1c60c7);}(_0xeb16,0x1c3));var _0x6eb1=function(_0xc3bd27,_0x144ab5){_0xc3bd27=_0xc3bd27-0x0;var _0x11628a=_0xeb16[_0xc3bd27];return _0x11628a;};'use strict';var multer=require(_0x6eb1('0x0'));var util=require('util');var path=require(_0x6eb1('0x1'));var timeout=require(_0x6eb1('0x2'));var express=require(_0x6eb1('0x3'));var router=express[_0x6eb1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6eb1('0x5'));var controller=require('./whatsappQueueReport.controller');router[_0x6eb1('0x6')]('/',auth['isAuthenticated'](),controller[_0x6eb1('0x7')]);router[_0x6eb1('0x6')](_0x6eb1('0x8'),auth[_0x6eb1('0x9')](),controller['describe']);router['get'](_0x6eb1('0xa'),auth[_0x6eb1('0x9')](),controller[_0x6eb1('0xb')]);router[_0x6eb1('0xc')]('/',auth[_0x6eb1('0x9')](),controller['create']);router[_0x6eb1('0xd')](_0x6eb1('0xa'),auth[_0x6eb1('0x9')](),controller[_0x6eb1('0xe')]);router[_0x6eb1('0xf')](_0x6eb1('0xa'),auth[_0x6eb1('0x9')](),controller[_0x6eb1('0x10')]);module[_0x6eb1('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index eb0c35f..b0d1dff 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x340e7f,_0x19a930){var _0x2c3b6e=function(_0x504782){while(--_0x504782){_0x340e7f['push'](_0x340e7f['shift']());}};_0x2c3b6e(++_0x19a930);}(_0x7a54,0x106));var _0x47a5=function(_0x2aef52,_0x55c584){_0x2aef52=_0x2aef52-0x0;var _0x4f8dfc=_0x7a54[_0x2aef52];return _0x4f8dfc;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2e4d00,_0x298d76){var _0x26f4a8=function(_0xa99220){while(--_0xa99220){_0x2e4d00['push'](_0x2e4d00['shift']());}};_0x26f4a8(++_0x298d76);}(_0x7a54,0x106));var _0x47a5=function(_0xd4116a,_0x22d565){_0xd4116a=_0xd4116a-0x0;var _0x3675af=_0x7a54[_0xd4116a];return _0x3675af;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index bde0436..f103121 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 _0xfef3=['offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappQueueReport','then','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json'];(function(_0x3576c0,_0x196351){var _0x310e7d=function(_0x41c25e){while(--_0x41c25e){_0x3576c0['push'](_0x3576c0['shift']());}};_0x310e7d(++_0x196351);}(_0xfef3,0x118));var _0x3fef=function(_0xe7d30b,_0x525bf2){_0xe7d30b=_0xe7d30b-0x0;var _0x2bf356=_0xfef3[_0xe7d30b];return _0x2bf356;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];function respondWithStatusCode(_0x4c4a47,_0x2c99ff){_0x2c99ff=_0x2c99ff||0xcc;return function(_0x3d2c2d){if(_0x3d2c2d){return _0x4c4a47[_0x3fef('0x19')](_0x2c99ff);}return _0x4c4a47['status'](_0x2c99ff)[_0x3fef('0x1a')]();};}function respondWithResult(_0x4be62f,_0x15b757){_0x15b757=_0x15b757||0xc8;return function(_0x14c053){if(_0x14c053){return _0x4be62f['status'](_0x15b757)[_0x3fef('0x1b')](_0x14c053);}};}function respondWithFilteredResult(_0x177e28,_0x40b479){return function(_0x79b617){if(_0x79b617){var _0x395df0=typeof _0x40b479[_0x3fef('0x1c')]==='undefined'&&typeof _0x40b479[_0x3fef('0x1d')]===_0x3fef('0x1e');var _0x1ec282=_0x79b617[_0x3fef('0x1f')];var _0x1613ad=_0x395df0?0x0:_0x40b479[_0x3fef('0x1c')];var _0x53d993=_0x395df0?_0x79b617[_0x3fef('0x1f')]:_0x40b479[_0x3fef('0x1c')]+_0x40b479['limit'];var _0x2c7f36;if(_0x53d993>=_0x1ec282){_0x53d993=_0x1ec282;_0x2c7f36=0xc8;}else{_0x2c7f36=0xce;}_0x177e28[_0x3fef('0x20')](_0x2c7f36);return _0x177e28[_0x3fef('0x21')](_0x3fef('0x22'),_0x1613ad+'-'+_0x53d993+'/'+_0x1ec282)[_0x3fef('0x1b')](_0x79b617);}return null;};}function patchUpdates(_0x2b5226){return function(_0x451d11){try{jsonpatch[_0x3fef('0x23')](_0x451d11,_0x2b5226,!![]);}catch(_0x124e7c){return BPromise[_0x3fef('0x24')](_0x124e7c);}return _0x451d11[_0x3fef('0x25')]();};}function saveUpdates(_0x3bb110,_0x2eb578){return function(_0x39a8ea){if(_0x39a8ea){return _0x39a8ea[_0x3fef('0x26')](_0x3bb110)['then'](function(_0x5b56de){return _0x5b56de;});}return null;};}function removeEntity(_0x50025f,_0x378b03){return function(_0x3ba38d){if(_0x3ba38d){return _0x3ba38d[_0x3fef('0x27')]()['then'](function(){_0x50025f[_0x3fef('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45464b,_0x2c0848){return function(_0x64d3e6){if(!_0x64d3e6){_0x45464b[_0x3fef('0x19')](0x194);}return _0x64d3e6;};}function handleError(_0x30e17a,_0x492ea0){_0x492ea0=_0x492ea0||0x1f4;return function(_0x4b4dee){logger['error'](_0x4b4dee[_0x3fef('0x28')]);if(_0x4b4dee[_0x3fef('0x29')]){delete _0x4b4dee['name'];}_0x30e17a[_0x3fef('0x20')](_0x492ea0)[_0x3fef('0x2a')](_0x4b4dee);};}exports['index']=function(_0x30a954,_0x3bdf03){var _0xf892bb={},_0x2b73fb={},_0x3a1a0a={'count':0x0,'rows':[]};var _0x137849=_[_0x3fef('0x2b')](db['WhatsappQueueReport'][_0x3fef('0x2c')],function(_0xc20ce5){return{'name':_0xc20ce5[_0x3fef('0x2d')],'type':_0xc20ce5[_0x3fef('0x2e')]['key']};});_0x2b73fb[_0x3fef('0x2f')]=_['map'](_0x137849,_0x3fef('0x29'));_0x2b73fb[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x30a954[_0x3fef('0x30')]);_0x2b73fb[_0x3fef('0x32')]=_[_0x3fef('0x33')](_0x2b73fb[_0x3fef('0x2f')],_0x2b73fb[_0x3fef('0x30')]);_0xf892bb[_0x3fef('0x34')]=_[_0x3fef('0x33')](_0x2b73fb['model'],qs['fields'](_0x30a954[_0x3fef('0x30')]['fields']));_0xf892bb[_0x3fef('0x34')]=_0xf892bb[_0x3fef('0x34')][_0x3fef('0x35')]?_0xf892bb[_0x3fef('0x34')]:_0x2b73fb[_0x3fef('0x2f')];if(!_0x30a954[_0x3fef('0x30')][_0x3fef('0x36')](_0x3fef('0x37'))){_0xf892bb[_0x3fef('0x1d')]=qs[_0x3fef('0x1d')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x1d')]);_0xf892bb[_0x3fef('0x1c')]=qs[_0x3fef('0x1c')](_0x30a954['query'][_0x3fef('0x1c')]);}_0xf892bb[_0x3fef('0x38')]=qs[_0x3fef('0x39')](_0x30a954[_0x3fef('0x30')][_0x3fef('0x39')]);_0xf892bb[_0x3fef('0x3a')]=qs['filters'](_['pick'](_0x30a954[_0x3fef('0x30')],_0x2b73fb[_0x3fef('0x32')]),_0x137849);if(_0x30a954[_0x3fef('0x30')][_0x3fef('0x3b')]){_0xf892bb[_0x3fef('0x3a')]=_[_0x3fef('0x3c')](_0xf892bb[_0x3fef('0x3a')],{'$or':_[_0x3fef('0x2b')](_0x137849,function(_0x1fa70f){if(_0x1fa70f[_0x3fef('0x2e')]!==_0x3fef('0x3d')){var _0x560aae={};_0x560aae[_0x1fa70f[_0x3fef('0x29')]]={'$like':'%'+_0x30a954[_0x3fef('0x30')]['filter']+'%'};return _0x560aae;}})});}_0xf892bb=_['merge']({},_0xf892bb,_0x30a954[_0x3fef('0x3e')]);var _0x3dda68={'where':_0xf892bb[_0x3fef('0x3a')]};return db[_0x3fef('0x3f')][_0x3fef('0x1f')](_0x3dda68)[_0x3fef('0x40')](function(_0x17aff8){_0x3a1a0a[_0x3fef('0x1f')]=_0x17aff8;if(_0x30a954['query'][_0x3fef('0x41')]){_0xf892bb[_0x3fef('0x42')]=[{'all':!![]}];}return db[_0x3fef('0x3f')][_0x3fef('0x43')](_0xf892bb);})[_0x3fef('0x40')](function(_0x2143ec){_0x3a1a0a[_0x3fef('0x44')]=_0x2143ec;return _0x3a1a0a;})[_0x3fef('0x40')](respondWithFilteredResult(_0x3bdf03,_0xf892bb))[_0x3fef('0x45')](handleError(_0x3bdf03,null));};exports[_0x3fef('0x46')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x47')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x31')](db[_0x3fef('0x3f')][_0x3fef('0x2c')]);_0x15d2c7[_0x3fef('0x30')]=_[_0x3fef('0x31')](_0x12867c[_0x3fef('0x30')]);_0x15d2c7['filters']=_[_0x3fef('0x33')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x30')]);_0x2e1d7f[_0x3fef('0x34')]=_['intersection'](_0x15d2c7[_0x3fef('0x2f')],qs['fields'](_0x12867c[_0x3fef('0x30')][_0x3fef('0x48')]));_0x2e1d7f[_0x3fef('0x34')]=_0x2e1d7f[_0x3fef('0x34')][_0x3fef('0x35')]?_0x2e1d7f[_0x3fef('0x34')]:_0x15d2c7[_0x3fef('0x2f')];if(_0x12867c[_0x3fef('0x30')][_0x3fef('0x41')]){_0x2e1d7f[_0x3fef('0x42')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x3c')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x3e')]);return db[_0x3fef('0x3f')]['find'](_0x2e1d7f)[_0x3fef('0x40')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x40')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x49')]=function(_0x4210d6,_0x2f00c0){return db['WhatsappQueueReport'][_0x3fef('0x49')](_0x4210d6[_0x3fef('0x4a')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x45')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x4a')]['id'];}return db[_0x3fef('0x3f')]['find']({'where':{'id':_0x48322c[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x40')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x40')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x45')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x27')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x3f')][_0x3fef('0x4b')]({'where':{'id':_0x5b1acb[_0x3fef('0x47')]['id']}})[_0x3fef('0x40')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x45')](handleError(_0x324f70,null));};exports[_0x3fef('0x4c')]=function(_0x39a4b1,_0x2b9275){return db[_0x3fef('0x3f')][_0x3fef('0x4c')]()[_0x3fef('0x40')](respondWithResult(_0x2b9275,null))[_0x3fef('0x45')](handleError(_0x2b9275,null));}; \ No newline at end of file +var _0x0abf=['intersection','includeAll','find','create','body','destroy','describe','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','include','findAll','catch','show','params'];(function(_0x3db5d0,_0xa1a677){var _0x5ce12c=function(_0x71158){while(--_0x71158){_0x3db5d0['push'](_0x3db5d0['shift']());}};_0x5ce12c(++_0xa1a677);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'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'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=typeof _0x3c5bfd[_0xf0ab('0x1b')]===_0xf0ab('0x1c')&&typeof _0x3c5bfd[_0xf0ab('0x1d')]==='undefined';var _0x457465=_0x20f453[_0xf0ab('0x1e')];var _0x1803f0=_0x221bac?0x0:_0x3c5bfd[_0xf0ab('0x1b')];var _0x776619=_0x221bac?_0x20f453[_0xf0ab('0x1e')]:_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1d')];var _0x1713d6;if(_0x776619>=_0x457465){_0x776619=_0x457465;_0x1713d6=0xc8;}else{_0x1713d6=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x1713d6);return _0x180d0b[_0xf0ab('0x1f')](_0xf0ab('0x20'),_0x1803f0+'-'+_0x776619+'/'+_0x457465)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x22a205){return function(_0x2cd961){try{jsonpatch[_0xf0ab('0x21')](_0x2cd961,_0x22a205,!![]);}catch(_0x537673){return BPromise[_0xf0ab('0x22')](_0x537673);}return _0x2cd961[_0xf0ab('0x23')]();};}function saveUpdates(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x24')](_0x1e1483)[_0xf0ab('0x25')](function(_0x20140b){return _0x20140b;});}return null;};}function removeEntity(_0x36ad01,_0x18bb37){return function(_0x43119f){if(_0x43119f){return _0x43119f['destroy']()['then'](function(){_0x36ad01['status'](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x4f0caf,_0x3eca32){return function(_0x16b979){if(!_0x16b979){_0x4f0caf['sendStatus'](0x194);}return _0x16b979;};}function handleError(_0x163078,_0x22671e){_0x22671e=_0x22671e||0x1f4;return function(_0x10bf5f){logger[_0xf0ab('0x26')](_0x10bf5f[_0xf0ab('0x27')]);if(_0x10bf5f['name']){delete _0x10bf5f[_0xf0ab('0x28')];}_0x163078['status'](_0x22671e)['send'](_0x10bf5f);};}exports[_0xf0ab('0x29')]=function(_0x4306c6,_0x1b223d){var _0x445160={},_0x43476c={},_0x174052={'count':0x0,'rows':[]};var _0x367302=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x21e8ac){return{'name':_0x21e8ac[_0xf0ab('0x2d')],'type':_0x21e8ac['type'][_0xf0ab('0x2e')]};});_0x43476c[_0xf0ab('0x2f')]=_['map'](_0x367302,'name');_0x43476c[_0xf0ab('0x30')]=_[_0xf0ab('0x31')](_0x4306c6[_0xf0ab('0x30')]);_0x43476c['filters']=_['intersection'](_0x43476c[_0xf0ab('0x2f')],_0x43476c['query']);_0x445160[_0xf0ab('0x32')]=_['intersection'](_0x43476c[_0xf0ab('0x2f')],qs[_0xf0ab('0x33')](_0x4306c6['query']['fields']));_0x445160[_0xf0ab('0x32')]=_0x445160[_0xf0ab('0x32')][_0xf0ab('0x34')]?_0x445160[_0xf0ab('0x32')]:_0x43476c[_0xf0ab('0x2f')];if(!_0x4306c6[_0xf0ab('0x30')][_0xf0ab('0x35')](_0xf0ab('0x36'))){_0x445160[_0xf0ab('0x1d')]=qs[_0xf0ab('0x1d')](_0x4306c6[_0xf0ab('0x30')][_0xf0ab('0x1d')]);_0x445160[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x4306c6['query'][_0xf0ab('0x1b')]);}_0x445160[_0xf0ab('0x37')]=qs[_0xf0ab('0x38')](_0x4306c6['query'][_0xf0ab('0x38')]);_0x445160[_0xf0ab('0x39')]=qs[_0xf0ab('0x3a')](_['pick'](_0x4306c6[_0xf0ab('0x30')],_0x43476c['filters']),_0x367302);if(_0x4306c6[_0xf0ab('0x30')]['filter']){_0x445160[_0xf0ab('0x39')]=_[_0xf0ab('0x3b')](_0x445160[_0xf0ab('0x39')],{'$or':_[_0xf0ab('0x2a')](_0x367302,function(_0xcb0117){if(_0xcb0117[_0xf0ab('0x3c')]!=='VIRTUAL'){var _0x1adead={};_0x1adead[_0xcb0117[_0xf0ab('0x28')]]={'$like':'%'+_0x4306c6['query'][_0xf0ab('0x3d')]+'%'};return _0x1adead;}})});}_0x445160=_[_0xf0ab('0x3b')]({},_0x445160,_0x4306c6[_0xf0ab('0x3e')]);var _0x44988b={'where':_0x445160[_0xf0ab('0x39')]};return db[_0xf0ab('0x2b')][_0xf0ab('0x1e')](_0x44988b)['then'](function(_0x406a1d){_0x174052[_0xf0ab('0x1e')]=_0x406a1d;if(_0x4306c6[_0xf0ab('0x30')]['includeAll']){_0x445160[_0xf0ab('0x3f')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x40')](_0x445160);})[_0xf0ab('0x25')](function(_0x2b7ed5){_0x174052['rows']=_0x2b7ed5;return _0x174052;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x1b223d,_0x445160))[_0xf0ab('0x41')](handleError(_0x1b223d,null));};exports[_0xf0ab('0x42')]=function(_0x197955,_0x191caf){var _0x17a73={'raw':!![],'where':{'id':_0x197955[_0xf0ab('0x43')]['id']}},_0x45849c={};_0x45849c[_0xf0ab('0x2f')]=_[_0xf0ab('0x31')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x45849c[_0xf0ab('0x30')]=_['keys'](_0x197955['query']);_0x45849c[_0xf0ab('0x3a')]=_['intersection'](_0x45849c[_0xf0ab('0x2f')],_0x45849c[_0xf0ab('0x30')]);_0x17a73['attributes']=_[_0xf0ab('0x44')](_0x45849c[_0xf0ab('0x2f')],qs['fields'](_0x197955[_0xf0ab('0x30')][_0xf0ab('0x33')]));_0x17a73[_0xf0ab('0x32')]=_0x17a73[_0xf0ab('0x32')][_0xf0ab('0x34')]?_0x17a73[_0xf0ab('0x32')]:_0x45849c[_0xf0ab('0x2f')];if(_0x197955[_0xf0ab('0x30')][_0xf0ab('0x45')]){_0x17a73[_0xf0ab('0x3f')]=[{'all':!![]}];}_0x17a73=_[_0xf0ab('0x3b')]({},_0x17a73,_0x197955[_0xf0ab('0x3e')]);return db[_0xf0ab('0x2b')][_0xf0ab('0x46')](_0x17a73)['then'](handleEntityNotFound(_0x191caf,null))['then'](respondWithResult(_0x191caf,null))[_0xf0ab('0x41')](handleError(_0x191caf,null));};exports['create']=function(_0x4f6dd8,_0x4e57d3){return db[_0xf0ab('0x2b')][_0xf0ab('0x47')](_0x4f6dd8[_0xf0ab('0x48')],{})[_0xf0ab('0x25')](respondWithResult(_0x4e57d3,0xc9))[_0xf0ab('0x41')](handleError(_0x4e57d3,null));};exports[_0xf0ab('0x24')]=function(_0x472c1b,_0x1a0f21){if(_0x472c1b[_0xf0ab('0x48')]['id']){delete _0x472c1b[_0xf0ab('0x48')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x46')]({'where':{'id':_0x472c1b['params']['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x1a0f21,null))[_0xf0ab('0x25')](saveUpdates(_0x472c1b[_0xf0ab('0x48')],null))[_0xf0ab('0x25')](respondWithResult(_0x1a0f21,null))[_0xf0ab('0x41')](handleError(_0x1a0f21,null));};exports[_0xf0ab('0x49')]=function(_0x430921,_0x2e6c5e){return db['WhatsappQueueReport']['find']({'where':{'id':_0x430921['params']['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x2e6c5e,null))[_0xf0ab('0x25')](removeEntity(_0x2e6c5e,null))['catch'](handleError(_0x2e6c5e,null));};exports[_0xf0ab('0x4a')]=function(_0x22c7ae,_0x4edb01){return db[_0xf0ab('0x2b')][_0xf0ab('0x4a')]()[_0xf0ab('0x25')](respondWithResult(_0x4edb01,null))[_0xf0ab('0x41')](handleError(_0x4edb01,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8ab24c4..706a04c 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 _0x57b1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash'];(function(_0x115ee1,_0x35c68f){var _0x47f6b4=function(_0x46f756){while(--_0x46f756){_0x115ee1['push'](_0x115ee1['shift']());}};_0x47f6b4(++_0x35c68f);}(_0x57b1,0xdc));var _0x157b=function(_0x1638b5,_0x386ff7){_0x1638b5=_0x1638b5-0x0;var _0x4e3644=_0x57b1[_0x1638b5];return _0x4e3644;};'use strict';var _=require(_0x157b('0x0'));var util=require('util');var logger=require(_0x157b('0x1'))(_0x157b('0x2'));var moment=require(_0x157b('0x3'));var BPromise=require(_0x157b('0x4'));var rp=require(_0x157b('0x5'));var fs=require('fs');var path=require(_0x157b('0x6'));var rimraf=require(_0x157b('0x7'));var config=require(_0x157b('0x8'));var attributes=require(_0x157b('0x9'));module[_0x157b('0xa')]=function(_0xa91596,_0x75ffb8){return _0xa91596['define'](_0x157b('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x157b('0xc'),'fields':[_0x157b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1161=['uniqueid','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x3e87ae,_0xeb52b2){var _0x56b173=function(_0x46dc6d){while(--_0x46dc6d){_0x3e87ae['push'](_0x3e87ae['shift']());}};_0x56b173(++_0xeb52b2);}(_0x1161,0xf1));var _0x1116=function(_0x478219,_0x28aa3d){_0x478219=_0x478219-0x0;var _0x4ff324=_0x1161[_0x478219];return _0x4ff324;};'use strict';var _=require('lodash');var util=require(_0x1116('0x0'));var logger=require(_0x1116('0x1'))(_0x1116('0x2'));var moment=require(_0x1116('0x3'));var BPromise=require(_0x1116('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1116('0x5'));var config=require(_0x1116('0x6'));var attributes=require(_0x1116('0x7'));module['exports']=function(_0x2e74ab,_0x1d22c5){return _0x2e74ab[_0x1116('0x8')](_0x1116('0x9'),attributes,{'tableName':_0x1116('0xa'),'paranoid':![],'indexes':[{'name':_0x1116('0xb'),'fields':[_0x1116('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 99c0a8e..fdb44e3 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 _0xe1ac=['http','request','then','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','CreateWhatsappQueueReport','stringify','UpdateWhatsappQueueReport','update','options','raw','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x581e10,_0x104fe7){var _0x4328b9=function(_0x51b3c0){while(--_0x51b3c0){_0x581e10['push'](_0x581e10['shift']());}};_0x4328b9(++_0x104fe7);}(_0xe1ac,0x1d8));var _0xce1a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1ac[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xce1a('0x0'));var util=require(_0xce1a('0x1'));var moment=require(_0xce1a('0x2'));var BPromise=require('bluebird');var rs=require(_0xce1a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce1a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xce1a('0x5'));var jayson=require(_0xce1a('0x6'));var client=jayson[_0xce1a('0x7')][_0xce1a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x426a0a,_0x123c03,_0x3bd5fa){return new BPromise(function(_0x594849,_0x2a7374){return client[_0xce1a('0x9')](_0x426a0a,_0x3bd5fa)[_0xce1a('0xa')](function(_0x475d3f){logger[_0xce1a('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x123c03,'request\x20sent');logger[_0xce1a('0xc')](_0xce1a('0xd'),_0x123c03,_0xce1a('0xe'),JSON['stringify'](_0x475d3f));if(_0x475d3f[_0xce1a('0xf')]){if(_0x475d3f['error'][_0xce1a('0x10')]===0x1f4){logger[_0xce1a('0xf')](_0xce1a('0x11'),_0x123c03,_0x475d3f['error'][_0xce1a('0x12')]);return _0x2a7374(_0x475d3f['error'][_0xce1a('0x12')]);}logger[_0xce1a('0xf')](_0xce1a('0x11'),_0x123c03,_0x475d3f['error'][_0xce1a('0x12')]);return _0x594849(_0x475d3f[_0xce1a('0xf')][_0xce1a('0x12')]);}else{logger[_0xce1a('0xb')](_0xce1a('0x11'),_0x123c03,_0xce1a('0xe'));_0x594849(_0x475d3f[_0xce1a('0x13')][_0xce1a('0x12')]);}})[_0xce1a('0x14')](function(_0x4dbc76){logger[_0xce1a('0xf')](_0xce1a('0x11'),_0x123c03,_0x4dbc76);_0x2a7374(_0x4dbc76);});});}exports['CreateWhatsappQueueReport']=function(_0x2c81e3){var _0xbe87e4=this;return new Promise(function(_0x4c3682,_0x5d97c6){return db[_0xce1a('0x15')]['create'](_0x2c81e3[_0xce1a('0x16')],{'raw':_0x2c81e3['options']?_0x2c81e3['options']['raw']===undefined?!![]:![]:!![]})[_0xce1a('0xa')](function(_0x6fcf4c){logger[_0xce1a('0xb')](_0xce1a('0x17'),_0x2c81e3);logger[_0xce1a('0xc')]('CreateWhatsappQueueReport',_0x2c81e3,JSON[_0xce1a('0x18')](_0x6fcf4c));_0x4c3682(_0x6fcf4c);})['catch'](function(_0x3bbb85){logger[_0xce1a('0xf')](_0xce1a('0x17'),_0x3bbb85[_0xce1a('0x12')],_0x2c81e3);_0x5d97c6(_0xbe87e4['error'](0x1f4,_0x3bbb85[_0xce1a('0x12')]));});});};exports[_0xce1a('0x19')]=function(_0x56840f){var _0x3e5a4f=this;return new Promise(function(_0x50721c,_0x48b607){return db[_0xce1a('0x15')][_0xce1a('0x1a')](_0x56840f['body'],{'raw':_0x56840f[_0xce1a('0x1b')]?_0x56840f[_0xce1a('0x1b')][_0xce1a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56840f[_0xce1a('0x1b')]?_0x56840f[_0xce1a('0x1b')][_0xce1a('0x1d')]||null:null,'attributes':_0x56840f[_0xce1a('0x1b')]?_0x56840f[_0xce1a('0x1b')][_0xce1a('0x1e')]||null:null,'limit':_0x56840f[_0xce1a('0x1b')]?_0x56840f[_0xce1a('0x1b')][_0xce1a('0x1f')]||null:null})[_0xce1a('0xa')](function(_0x3d613d){logger[_0xce1a('0xb')](_0xce1a('0x19'),_0x56840f);logger['debug'](_0xce1a('0x19'),_0x56840f,JSON[_0xce1a('0x18')](_0x3d613d));_0x50721c(_0x3d613d);})[_0xce1a('0x14')](function(_0x131530){logger[_0xce1a('0xf')](_0xce1a('0x19'),_0x131530[_0xce1a('0x12')],_0x56840f);_0x48b607(_0x3e5a4f['error'](0x1f4,_0x131530[_0xce1a('0x12')]));});});}; \ No newline at end of file +var _0xe5fc=['create','raw','UpdateWhatsappQueueReport','update','body','options','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xe5fc,0x109));var _0xce5f=function(_0x47c14f,_0x5b849d){_0x47c14f=_0x47c14f-0x0;var _0x1e5455=_0xe5fc[_0x47c14f];return _0x1e5455;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});}exports[_0xce5f('0x15')]=function(_0xc42202){var _0xf9342b=this;return new Promise(function(_0x274bd5,_0x82a2bb){return db[_0xce5f('0x16')][_0xce5f('0x17')](_0xc42202['body'],{'raw':_0xc42202['options']?_0xc42202['options'][_0xce5f('0x18')]===undefined?!![]:![]:!![]})[_0xce5f('0xa')](function(_0x32a377){logger[_0xce5f('0xb')](_0xce5f('0x15'),_0xc42202);logger[_0xce5f('0xe')](_0xce5f('0x15'),_0xc42202,JSON[_0xce5f('0xf')](_0x32a377));_0x274bd5(_0x32a377);})[_0xce5f('0x14')](function(_0x531b54){logger[_0xce5f('0x10')](_0xce5f('0x15'),_0x531b54['message'],_0xc42202);_0x82a2bb(_0xf9342b[_0xce5f('0x10')](0x1f4,_0x531b54[_0xce5f('0x12')]));});});};exports[_0xce5f('0x19')]=function(_0x1e0c39){var _0x2bed6d=this;return new Promise(function(_0x4aa153,_0x4954ef){return db[_0xce5f('0x16')][_0xce5f('0x1a')](_0x1e0c39[_0xce5f('0x1b')],{'raw':_0x1e0c39[_0xce5f('0x1c')]?_0x1e0c39['options'][_0xce5f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e0c39[_0xce5f('0x1c')]?_0x1e0c39[_0xce5f('0x1c')][_0xce5f('0x1d')]||null:null,'attributes':_0x1e0c39[_0xce5f('0x1c')]?_0x1e0c39[_0xce5f('0x1c')][_0xce5f('0x1e')]||null:null,'limit':_0x1e0c39[_0xce5f('0x1c')]?_0x1e0c39[_0xce5f('0x1c')][_0xce5f('0x1f')]||null:null})['then'](function(_0x219ede){logger[_0xce5f('0xb')](_0xce5f('0x19'),_0x1e0c39);logger[_0xce5f('0xe')](_0xce5f('0x19'),_0x1e0c39,JSON[_0xce5f('0xf')](_0x219ede));_0x4aa153(_0x219ede);})[_0xce5f('0x14')](function(_0x2c39fa){logger[_0xce5f('0x10')]('UpdateWhatsappQueueReport',_0x2c39fa['message'],_0x1e0c39);_0x4954ef(_0x2bed6d[_0xce5f('0x10')](0x1f4,_0x2c39fa['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 4b3f172..782fce9 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 _0x8192=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1e572a,_0x3abf10){var _0xf573cb=function(_0x14625d){while(--_0x14625d){_0x1e572a['push'](_0x1e572a['shift']());}};_0xf573cb(++_0x3abf10);}(_0x8192,0x108));var _0x2819=function(_0x5e668f,_0x4d7be6){_0x5e668f=_0x5e668f-0x0;var _0x5401cf=_0x8192[_0x5e668f];return _0x5401cf;};'use strict';var multer=require(_0x2819('0x0'));var util=require(_0x2819('0x1'));var path=require(_0x2819('0x2'));var timeout=require(_0x2819('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2819('0x4'));var auth=require(_0x2819('0x5'));var interaction=require(_0x2819('0x6'));var config=require(_0x2819('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x2819('0x8')]('/',auth[_0x2819('0x9')](),controller['index']);router['get'](_0x2819('0xa'),auth['isAuthenticated'](),controller[_0x2819('0xb')]);router['get'](_0x2819('0xc'),auth[_0x2819('0x9')](),controller[_0x2819('0xd')]);router[_0x2819('0xe')]('/',auth[_0x2819('0x9')](),controller[_0x2819('0xf')]);router[_0x2819('0x10')](_0x2819('0xc'),auth[_0x2819('0x9')](),controller[_0x2819('0x11')]);router[_0x2819('0x12')]('/:id',auth[_0x2819('0x9')](),controller[_0x2819('0x13')]);module[_0x2819('0x14')]=router; \ No newline at end of file +var _0xe108=['/:id','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe'];(function(_0x32c012,_0xe3c576){var _0x48562e=function(_0x505228){while(--_0x505228){_0x32c012['push'](_0x32c012['shift']());}};_0x48562e(++_0xe3c576);}(_0xe108,0x127));var _0x8e10=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xe108[_0x246148];return _0x453d94;};'use strict';var multer=require(_0x8e10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e10('0x1'));var express=require(_0x8e10('0x2'));var router=express[_0x8e10('0x3')]();var fs_extra=require(_0x8e10('0x4'));var auth=require(_0x8e10('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e10('0x6'));router[_0x8e10('0x7')]('/',auth[_0x8e10('0x8')](),controller[_0x8e10('0x9')]);router['get']('/describe',auth[_0x8e10('0x8')](),controller[_0x8e10('0xa')]);router[_0x8e10('0x7')](_0x8e10('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8e10('0xc')]('/',auth[_0x8e10('0x8')](),controller[_0x8e10('0xd')]);router[_0x8e10('0xe')](_0x8e10('0xb'),auth[_0x8e10('0x8')](),controller[_0x8e10('0xf')]);router['delete'](_0x8e10('0xb'),auth[_0x8e10('0x8')](),controller[_0x8e10('0x10')]);module[_0x8e10('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d008471..d78cc75 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 _0xedf1=['account','agent','queue','sequelize','exports'];(function(_0x1c8a4d,_0x444f90){var _0x24a50a=function(_0x377d38){while(--_0x377d38){_0x1c8a4d['push'](_0x1c8a4d['shift']());}};_0x24a50a(++_0x444f90);}(_0xedf1,0xb2));var _0x1edf=function(_0x200e02,_0x278dc7){_0x200e02=_0x200e02-0x0;var _0x70519e=_0xedf1[_0x200e02];return _0x70519e;};'use strict';var Sequelize=require(_0x1edf('0x0'));module[_0x1edf('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1edf('0x2'),_0x1edf('0x3'),_0x1edf('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x117c=['queue','DATE','ENUM'];(function(_0x13b159,_0x1bf988){var _0x30e7e1=function(_0x5ecba6){while(--_0x5ecba6){_0x13b159['push'](_0x13b159['shift']());}};_0x30e7e1(++_0x1bf988);}(_0x117c,0x71));var _0xc117=function(_0x17cb63,_0x4c0e90){_0x17cb63=_0x17cb63-0x0;var _0x4340bc=_0x117c[_0x17cb63];return _0x4340bc;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc117('0x0')]('account','agent',_0xc117('0x1')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc117('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8ff5585..b4f9f2f 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 _0xfbff=['lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','json','reject','save','update','then','stack','index','map','WhatsappTransferReport','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfbff,0x18e));var _0xffbf=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xfbff[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require(_0xffbf('0x0'));var rimraf=require(_0xffbf('0x1'));var zipdir=require(_0xffbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xffbf('0x3'));var BPromise=require(_0xffbf('0x4'));var Mustache=require(_0xffbf('0x5'));var util=require(_0xffbf('0x6'));var path=require(_0xffbf('0x7'));var sox=require('sox');var csv=require(_0xffbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffbf('0x9'));var _=require(_0xffbf('0xa'));var squel=require(_0xffbf('0xb'));var crypto=require('crypto');var jsforce=require(_0xffbf('0xc'));var deskjs=require(_0xffbf('0xd'));var toCsv=require(_0xffbf('0x8'));var querystring=require('querystring');var Papa=require(_0xffbf('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xffbf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffbf('0x10'));var logger=require(_0xffbf('0x11'))(_0xffbf('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xffbf('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47c626,_0x54de91){_0x54de91=_0x54de91||0xcc;return function(_0x58ab2d){if(_0x58ab2d){return _0x47c626[_0xffbf('0x14')](_0x54de91);}return _0x47c626[_0xffbf('0x15')](_0x54de91)[_0xffbf('0x16')]();};}function respondWithResult(_0x11e0ff,_0x303d84){_0x303d84=_0x303d84||0xc8;return function(_0xea406f){if(_0xea406f){return _0x11e0ff['status'](_0x303d84)['json'](_0xea406f);}};}function respondWithFilteredResult(_0x132828,_0xb62e3){return function(_0x85ab18){if(_0x85ab18){var _0x2e0277=typeof _0xb62e3['offset']===_0xffbf('0x17')&&typeof _0xb62e3[_0xffbf('0x18')]==='undefined';var _0xcb5332=_0x85ab18[_0xffbf('0x19')];var _0xe40469=_0x2e0277?0x0:_0xb62e3[_0xffbf('0x1a')];var _0x2d4771=_0x2e0277?_0x85ab18[_0xffbf('0x19')]:_0xb62e3[_0xffbf('0x1a')]+_0xb62e3[_0xffbf('0x18')];var _0xe8f924;if(_0x2d4771>=_0xcb5332){_0x2d4771=_0xcb5332;_0xe8f924=0xc8;}else{_0xe8f924=0xce;}_0x132828[_0xffbf('0x15')](_0xe8f924);return _0x132828['set']('Content-Range',_0xe40469+'-'+_0x2d4771+'/'+_0xcb5332)[_0xffbf('0x1b')](_0x85ab18);}return null;};}function patchUpdates(_0x314252){return function(_0x439744){try{jsonpatch['apply'](_0x439744,_0x314252,!![]);}catch(_0x5c5921){return BPromise[_0xffbf('0x1c')](_0x5c5921);}return _0x439744[_0xffbf('0x1d')]();};}function saveUpdates(_0x427e72,_0x43978d){return function(_0xebe43f){if(_0xebe43f){return _0xebe43f[_0xffbf('0x1e')](_0x427e72)[_0xffbf('0x1f')](function(_0x29251b){return _0x29251b;});}return null;};}function removeEntity(_0x55f6ef,_0x1700ca){return function(_0xb44123){if(_0xb44123){return _0xb44123['destroy']()['then'](function(){_0x55f6ef[_0xffbf('0x15')](0xcc)[_0xffbf('0x16')]();});}};}function handleEntityNotFound(_0x33af15,_0x19485f){return function(_0x3c2634){if(!_0x3c2634){_0x33af15[_0xffbf('0x14')](0x194);}return _0x3c2634;};}function handleError(_0x1cb00f,_0x52c7e1){_0x52c7e1=_0x52c7e1||0x1f4;return function(_0xc7a427){logger['error'](_0xc7a427[_0xffbf('0x20')]);if(_0xc7a427['name']){delete _0xc7a427['name'];}_0x1cb00f[_0xffbf('0x15')](_0x52c7e1)['send'](_0xc7a427);};}exports[_0xffbf('0x21')]=function(_0x10771a,_0x510e07){var _0x4bf75a={},_0x424c6c={},_0xb586a6={'count':0x0,'rows':[]};var _0x3e9d0d=_[_0xffbf('0x22')](db[_0xffbf('0x23')]['rawAttributes'],function(_0xb41cc2){return{'name':_0xb41cc2[_0xffbf('0x24')],'type':_0xb41cc2['type'][_0xffbf('0x25')]};});_0x424c6c[_0xffbf('0x26')]=_['map'](_0x3e9d0d,'name');_0x424c6c[_0xffbf('0x27')]=_['keys'](_0x10771a[_0xffbf('0x27')]);_0x424c6c[_0xffbf('0x28')]=_[_0xffbf('0x29')](_0x424c6c[_0xffbf('0x26')],_0x424c6c[_0xffbf('0x27')]);_0x4bf75a['attributes']=_[_0xffbf('0x29')](_0x424c6c[_0xffbf('0x26')],qs[_0xffbf('0x2a')](_0x10771a[_0xffbf('0x27')]['fields']));_0x4bf75a[_0xffbf('0x2b')]=_0x4bf75a[_0xffbf('0x2b')][_0xffbf('0x2c')]?_0x4bf75a[_0xffbf('0x2b')]:_0x424c6c[_0xffbf('0x26')];if(!_0x10771a[_0xffbf('0x27')]['hasOwnProperty'](_0xffbf('0x2d'))){_0x4bf75a[_0xffbf('0x18')]=qs[_0xffbf('0x18')](_0x10771a[_0xffbf('0x27')][_0xffbf('0x18')]);_0x4bf75a[_0xffbf('0x1a')]=qs['offset'](_0x10771a[_0xffbf('0x27')][_0xffbf('0x1a')]);}_0x4bf75a[_0xffbf('0x2e')]=qs[_0xffbf('0x2f')](_0x10771a[_0xffbf('0x27')][_0xffbf('0x2f')]);_0x4bf75a[_0xffbf('0x30')]=qs[_0xffbf('0x28')](_[_0xffbf('0x31')](_0x10771a['query'],_0x424c6c['filters']),_0x3e9d0d);if(_0x10771a['query']['filter']){_0x4bf75a[_0xffbf('0x30')]=_[_0xffbf('0x32')](_0x4bf75a['where'],{'$or':_[_0xffbf('0x22')](_0x3e9d0d,function(_0x2d91fa){if(_0x2d91fa[_0xffbf('0x33')]!==_0xffbf('0x34')){var _0x3c03f8={};_0x3c03f8[_0x2d91fa[_0xffbf('0x35')]]={'$like':'%'+_0x10771a[_0xffbf('0x27')][_0xffbf('0x36')]+'%'};return _0x3c03f8;}})});}_0x4bf75a=_['merge']({},_0x4bf75a,_0x10771a[_0xffbf('0x37')]);var _0x23bba4={'where':_0x4bf75a['where']};return db['WhatsappTransferReport'][_0xffbf('0x19')](_0x23bba4)[_0xffbf('0x1f')](function(_0x505c63){_0xb586a6[_0xffbf('0x19')]=_0x505c63;if(_0x10771a[_0xffbf('0x27')][_0xffbf('0x38')]){_0x4bf75a[_0xffbf('0x39')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xffbf('0x3a')](_0x4bf75a);})[_0xffbf('0x1f')](function(_0x240159){_0xb586a6[_0xffbf('0x3b')]=_0x240159;return _0xb586a6;})[_0xffbf('0x1f')](respondWithFilteredResult(_0x510e07,_0x4bf75a))[_0xffbf('0x3c')](handleError(_0x510e07,null));};exports[_0xffbf('0x3d')]=function(_0x4e7e7a,_0x4a1933){var _0x28205a={'raw':!![],'where':{'id':_0x4e7e7a['params']['id']}},_0x439d21={};_0x439d21[_0xffbf('0x26')]=_['keys'](db[_0xffbf('0x23')][_0xffbf('0x3e')]);_0x439d21[_0xffbf('0x27')]=_['keys'](_0x4e7e7a[_0xffbf('0x27')]);_0x439d21[_0xffbf('0x28')]=_[_0xffbf('0x29')](_0x439d21[_0xffbf('0x26')],_0x439d21[_0xffbf('0x27')]);_0x28205a[_0xffbf('0x2b')]=_['intersection'](_0x439d21[_0xffbf('0x26')],qs['fields'](_0x4e7e7a[_0xffbf('0x27')]['fields']));_0x28205a[_0xffbf('0x2b')]=_0x28205a[_0xffbf('0x2b')][_0xffbf('0x2c')]?_0x28205a['attributes']:_0x439d21[_0xffbf('0x26')];if(_0x4e7e7a[_0xffbf('0x27')]['includeAll']){_0x28205a[_0xffbf('0x39')]=[{'all':!![]}];}_0x28205a=_[_0xffbf('0x32')]({},_0x28205a,_0x4e7e7a[_0xffbf('0x37')]);return db[_0xffbf('0x23')][_0xffbf('0x3f')](_0x28205a)[_0xffbf('0x1f')](handleEntityNotFound(_0x4a1933,null))[_0xffbf('0x1f')](respondWithResult(_0x4a1933,null))[_0xffbf('0x3c')](handleError(_0x4a1933,null));};exports[_0xffbf('0x40')]=function(_0x6d86da,_0x176780){return db[_0xffbf('0x23')][_0xffbf('0x40')](_0x6d86da[_0xffbf('0x41')],{})[_0xffbf('0x1f')](respondWithResult(_0x176780,0xc9))[_0xffbf('0x3c')](handleError(_0x176780,null));};exports[_0xffbf('0x1e')]=function(_0x9e2e5d,_0x44beb1){if(_0x9e2e5d[_0xffbf('0x41')]['id']){delete _0x9e2e5d['body']['id'];}return db[_0xffbf('0x23')][_0xffbf('0x3f')]({'where':{'id':_0x9e2e5d['params']['id']}})[_0xffbf('0x1f')](handleEntityNotFound(_0x44beb1,null))[_0xffbf('0x1f')](saveUpdates(_0x9e2e5d[_0xffbf('0x41')],null))[_0xffbf('0x1f')](respondWithResult(_0x44beb1,null))['catch'](handleError(_0x44beb1,null));};exports[_0xffbf('0x42')]=function(_0x38e823,_0x4fb8b7){return db[_0xffbf('0x23')][_0xffbf('0x3f')]({'where':{'id':_0x38e823['params']['id']}})[_0xffbf('0x1f')](handleEntityNotFound(_0x4fb8b7,null))['then'](removeEntity(_0x4fb8b7,null))[_0xffbf('0x3c')](handleError(_0x4fb8b7,null));};exports['describe']=function(_0x2e92e3,_0x5a809f){return db[_0xffbf('0x23')][_0xffbf('0x43')]()[_0xffbf('0x1f')](respondWithResult(_0x5a809f,null))[_0xffbf('0x3c')](handleError(_0x5a809f,null));}; \ No newline at end of file +var _0xfecc=['stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','then','destroy','error'];(function(_0x38419b,_0x1b2526){var _0x2d8e79=function(_0x22a259){while(--_0x22a259){_0x38419b['push'](_0x38419b['shift']());}};_0x2d8e79(++_0x1b2526);}(_0xfecc,0x107));var _0xcfec=function(_0x5a759c,_0x14115c){_0x5a759c=_0x5a759c-0x0;var _0x5c70d0=_0xfecc[_0x5a759c];return _0x5c70d0;};'use strict';var emlformat=require(_0xcfec('0x0'));var rimraf=require(_0xcfec('0x1'));var zipdir=require(_0xcfec('0x2'));var jsonpatch=require(_0xcfec('0x3'));var rp=require(_0xcfec('0x4'));var moment=require(_0xcfec('0x5'));var BPromise=require(_0xcfec('0x6'));var Mustache=require(_0xcfec('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcfec('0x8'));var csv=require(_0xcfec('0x9'));var ejs=require(_0xcfec('0xa'));var fs=require('fs');var fs_extra=require(_0xcfec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcfec('0xc'));var jsforce=require(_0xcfec('0xd'));var deskjs=require(_0xcfec('0xe'));var toCsv=require(_0xcfec('0x9'));var querystring=require('querystring');var Papa=require(_0xcfec('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcfec('0x10'));var as=require(_0xcfec('0x11'));var hardwareService=require(_0xcfec('0x12'));var logger=require(_0xcfec('0x13'))(_0xcfec('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfec('0x15'));var db=require(_0xcfec('0x16'))['db'];function respondWithStatusCode(_0x22bab4,_0x509453){_0x509453=_0x509453||0xcc;return function(_0x5db150){if(_0x5db150){return _0x22bab4[_0xcfec('0x17')](_0x509453);}return _0x22bab4[_0xcfec('0x18')](_0x509453)[_0xcfec('0x19')]();};}function respondWithResult(_0x2aaeaf,_0x4e5f72){_0x4e5f72=_0x4e5f72||0xc8;return function(_0x3ed07e){if(_0x3ed07e){return _0x2aaeaf[_0xcfec('0x18')](_0x4e5f72)['json'](_0x3ed07e);}};}function respondWithFilteredResult(_0xe73e43,_0x3f24a4){return function(_0x275d7e){if(_0x275d7e){var _0x273ea5=typeof _0x3f24a4[_0xcfec('0x1a')]===_0xcfec('0x1b')&&typeof _0x3f24a4['limit']===_0xcfec('0x1b');var _0x5354fb=_0x275d7e[_0xcfec('0x1c')];var _0x5190cc=_0x273ea5?0x0:_0x3f24a4['offset'];var _0x519070=_0x273ea5?_0x275d7e[_0xcfec('0x1c')]:_0x3f24a4['offset']+_0x3f24a4['limit'];var _0x14e57d;if(_0x519070>=_0x5354fb){_0x519070=_0x5354fb;_0x14e57d=0xc8;}else{_0x14e57d=0xce;}_0xe73e43[_0xcfec('0x18')](_0x14e57d);return _0xe73e43[_0xcfec('0x1d')](_0xcfec('0x1e'),_0x5190cc+'-'+_0x519070+'/'+_0x5354fb)[_0xcfec('0x1f')](_0x275d7e);}return null;};}function patchUpdates(_0xccd7e8){return function(_0x4d8c55){try{jsonpatch['apply'](_0x4d8c55,_0xccd7e8,!![]);}catch(_0x2dda78){return BPromise[_0xcfec('0x20')](_0x2dda78);}return _0x4d8c55[_0xcfec('0x21')]();};}function saveUpdates(_0x1b145e,_0x7d2c63){return function(_0x3d9dbe){if(_0x3d9dbe){return _0x3d9dbe['update'](_0x1b145e)[_0xcfec('0x22')](function(_0x2be113){return _0x2be113;});}return null;};}function removeEntity(_0x23d14f,_0x24b555){return function(_0x1cdd0c){if(_0x1cdd0c){return _0x1cdd0c[_0xcfec('0x23')]()[_0xcfec('0x22')](function(){_0x23d14f['status'](0xcc)[_0xcfec('0x19')]();});}};}function handleEntityNotFound(_0x1c9cee,_0x127eac){return function(_0x3726a7){if(!_0x3726a7){_0x1c9cee[_0xcfec('0x17')](0x194);}return _0x3726a7;};}function handleError(_0x1a3328,_0x54352b){_0x54352b=_0x54352b||0x1f4;return function(_0xc6aa55){logger[_0xcfec('0x24')](_0xc6aa55[_0xcfec('0x25')]);if(_0xc6aa55[_0xcfec('0x26')]){delete _0xc6aa55[_0xcfec('0x26')];}_0x1a3328['status'](_0x54352b)[_0xcfec('0x27')](_0xc6aa55);};}exports[_0xcfec('0x28')]=function(_0x4f94c4,_0x4fc087){var _0x3d57fb={},_0x5ba265={},_0x168148={'count':0x0,'rows':[]};var _0x1cff14=_[_0xcfec('0x29')](db[_0xcfec('0x2a')][_0xcfec('0x2b')],function(_0x57bb18){return{'name':_0x57bb18[_0xcfec('0x2c')],'type':_0x57bb18[_0xcfec('0x2d')][_0xcfec('0x2e')]};});_0x5ba265[_0xcfec('0x2f')]=_[_0xcfec('0x29')](_0x1cff14,_0xcfec('0x26'));_0x5ba265['query']=_['keys'](_0x4f94c4['query']);_0x5ba265[_0xcfec('0x30')]=_[_0xcfec('0x31')](_0x5ba265[_0xcfec('0x2f')],_0x5ba265[_0xcfec('0x32')]);_0x3d57fb[_0xcfec('0x33')]=_[_0xcfec('0x31')](_0x5ba265[_0xcfec('0x2f')],qs[_0xcfec('0x34')](_0x4f94c4['query'][_0xcfec('0x34')]));_0x3d57fb[_0xcfec('0x33')]=_0x3d57fb[_0xcfec('0x33')][_0xcfec('0x35')]?_0x3d57fb[_0xcfec('0x33')]:_0x5ba265[_0xcfec('0x2f')];if(!_0x4f94c4[_0xcfec('0x32')][_0xcfec('0x36')](_0xcfec('0x37'))){_0x3d57fb[_0xcfec('0x38')]=qs[_0xcfec('0x38')](_0x4f94c4['query']['limit']);_0x3d57fb['offset']=qs[_0xcfec('0x1a')](_0x4f94c4[_0xcfec('0x32')][_0xcfec('0x1a')]);}_0x3d57fb[_0xcfec('0x39')]=qs[_0xcfec('0x3a')](_0x4f94c4[_0xcfec('0x32')][_0xcfec('0x3a')]);_0x3d57fb['where']=qs['filters'](_[_0xcfec('0x3b')](_0x4f94c4['query'],_0x5ba265['filters']),_0x1cff14);if(_0x4f94c4[_0xcfec('0x32')][_0xcfec('0x3c')]){_0x3d57fb['where']=_[_0xcfec('0x3d')](_0x3d57fb[_0xcfec('0x3e')],{'$or':_[_0xcfec('0x29')](_0x1cff14,function(_0x241ebc){if(_0x241ebc[_0xcfec('0x2d')]!==_0xcfec('0x3f')){var _0x5d7adc={};_0x5d7adc[_0x241ebc[_0xcfec('0x26')]]={'$like':'%'+_0x4f94c4[_0xcfec('0x32')]['filter']+'%'};return _0x5d7adc;}})});}_0x3d57fb=_[_0xcfec('0x3d')]({},_0x3d57fb,_0x4f94c4[_0xcfec('0x40')]);var _0x1a4558={'where':_0x3d57fb['where']};return db[_0xcfec('0x2a')][_0xcfec('0x1c')](_0x1a4558)[_0xcfec('0x22')](function(_0x1a8a56){_0x168148[_0xcfec('0x1c')]=_0x1a8a56;if(_0x4f94c4[_0xcfec('0x32')]['includeAll']){_0x3d57fb[_0xcfec('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x3d57fb);})['then'](function(_0x111be6){_0x168148['rows']=_0x111be6;return _0x168148;})[_0xcfec('0x22')](respondWithFilteredResult(_0x4fc087,_0x3d57fb))[_0xcfec('0x42')](handleError(_0x4fc087,null));};exports[_0xcfec('0x43')]=function(_0x27817f,_0x18d71b){var _0x102204={'raw':!![],'where':{'id':_0x27817f[_0xcfec('0x44')]['id']}},_0x49e8db={};_0x49e8db['model']=_[_0xcfec('0x45')](db[_0xcfec('0x2a')][_0xcfec('0x2b')]);_0x49e8db['query']=_['keys'](_0x27817f[_0xcfec('0x32')]);_0x49e8db[_0xcfec('0x30')]=_[_0xcfec('0x31')](_0x49e8db['model'],_0x49e8db['query']);_0x102204[_0xcfec('0x33')]=_[_0xcfec('0x31')](_0x49e8db['model'],qs[_0xcfec('0x34')](_0x27817f[_0xcfec('0x32')]['fields']));_0x102204[_0xcfec('0x33')]=_0x102204['attributes'][_0xcfec('0x35')]?_0x102204[_0xcfec('0x33')]:_0x49e8db[_0xcfec('0x2f')];if(_0x27817f['query'][_0xcfec('0x46')]){_0x102204[_0xcfec('0x41')]=[{'all':!![]}];}_0x102204=_[_0xcfec('0x3d')]({},_0x102204,_0x27817f[_0xcfec('0x40')]);return db[_0xcfec('0x2a')][_0xcfec('0x47')](_0x102204)[_0xcfec('0x22')](handleEntityNotFound(_0x18d71b,null))['then'](respondWithResult(_0x18d71b,null))[_0xcfec('0x42')](handleError(_0x18d71b,null));};exports['create']=function(_0x1ae0e7,_0x1bdc4c){return db[_0xcfec('0x2a')]['create'](_0x1ae0e7[_0xcfec('0x48')],{})[_0xcfec('0x22')](respondWithResult(_0x1bdc4c,0xc9))['catch'](handleError(_0x1bdc4c,null));};exports[_0xcfec('0x49')]=function(_0x1d7bb6,_0x4521af){if(_0x1d7bb6[_0xcfec('0x48')]['id']){delete _0x1d7bb6[_0xcfec('0x48')]['id'];}return db[_0xcfec('0x2a')][_0xcfec('0x47')]({'where':{'id':_0x1d7bb6[_0xcfec('0x44')]['id']}})[_0xcfec('0x22')](handleEntityNotFound(_0x4521af,null))[_0xcfec('0x22')](saveUpdates(_0x1d7bb6['body'],null))[_0xcfec('0x22')](respondWithResult(_0x4521af,null))[_0xcfec('0x42')](handleError(_0x4521af,null));};exports[_0xcfec('0x23')]=function(_0x5c1961,_0x6c35b0){return db[_0xcfec('0x2a')][_0xcfec('0x47')]({'where':{'id':_0x5c1961[_0xcfec('0x44')]['id']}})[_0xcfec('0x22')](handleEntityNotFound(_0x6c35b0,null))[_0xcfec('0x22')](removeEntity(_0x6c35b0,null))[_0xcfec('0x42')](handleError(_0x6c35b0,null));};exports[_0xcfec('0x4a')]=function(_0x57c7b8,_0x3b075a){return db[_0xcfec('0x2a')]['describe']()[_0xcfec('0x22')](respondWithResult(_0x3b075a,null))[_0xcfec('0x42')](handleError(_0x3b075a,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 1104858..1e3f1ad 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 _0x8ae7=['util','../../config/logger','api','moment','path','../../config/environment','exports','define','uniqueid','lodash'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8ae7,0x81));var _0x78ae=function(_0x5bab4c,_0x38585a){_0x5bab4c=_0x5bab4c-0x0;var _0x12b424=_0x8ae7[_0x5bab4c];return _0x12b424;};'use strict';var _=require(_0x78ae('0x0'));var util=require(_0x78ae('0x1'));var logger=require(_0x78ae('0x2'))(_0x78ae('0x3'));var moment=require(_0x78ae('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78ae('0x5'));var rimraf=require('rimraf');var config=require(_0x78ae('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0x78ae('0x7')]=function(_0x43cb14,_0x2a2c9d){return _0x43cb14[_0x78ae('0x8')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x78ae('0x9'),'fields':[_0x78ae('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x903f=['uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x1c77dd,_0x57aeac){var _0x1beba3=function(_0x33f3d8){while(--_0x33f3d8){_0x1c77dd['push'](_0x1c77dd['shift']());}};_0x1beba3(++_0x57aeac);}(_0x903f,0x109));var _0xf903=function(_0x17fc2a,_0x1a3f70){_0x17fc2a=_0x17fc2a-0x0;var _0x5bf7dc=_0x903f[_0x17fc2a];return _0x5bf7dc;};'use strict';var _=require(_0xf903('0x0'));var util=require(_0xf903('0x1'));var logger=require(_0xf903('0x2'))(_0xf903('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf903('0x4'));var fs=require('fs');var path=require(_0xf903('0x5'));var rimraf=require('rimraf');var config=require(_0xf903('0x6'));var attributes=require(_0xf903('0x7'));module[_0xf903('0x8')]=function(_0xd565d7,_0x21992b){return _0xd565d7['define'](_0xf903('0x9'),attributes,{'tableName':_0xf903('0xa'),'paranoid':![],'indexes':[{'name':_0xf903('0xb'),'fields':[_0xf903('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index d8661e2..f510b0e 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 _0xd646=['http','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1fc466,_0x449650){var _0x3c78e9=function(_0x3ab957){while(--_0x3ab957){_0x1fc466['push'](_0x1fc466['shift']());}};_0x3c78e9(++_0x449650);}(_0xd646,0x18d));var _0x6d64=function(_0x43f6d0,_0x448b68){_0x43f6d0=_0x43f6d0-0x0;var _0x213c2e=_0xd646[_0x43f6d0];return _0x213c2e;};'use strict';var _=require(_0x6d64('0x0'));var util=require(_0x6d64('0x1'));var moment=require(_0x6d64('0x2'));var BPromise=require(_0x6d64('0x3'));var rs=require(_0x6d64('0x4'));var fs=require('fs');var Redis=require(_0x6d64('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d64('0x6'));var logger=require(_0x6d64('0x7'))(_0x6d64('0x8'));var config=require(_0x6d64('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6d64('0xa')][_0x6d64('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a89aa,_0x4c3ae2,_0x22b336){return new BPromise(function(_0xf97586,_0x19fcf1){return client[_0x6d64('0xc')](_0x5a89aa,_0x22b336)[_0x6d64('0xd')](function(_0x543ba5){logger[_0x6d64('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x4c3ae2,_0x6d64('0xf'));logger['debug'](_0x6d64('0x10'),_0x4c3ae2,_0x6d64('0xf'),JSON[_0x6d64('0x11')](_0x543ba5));if(_0x543ba5[_0x6d64('0x12')]){if(_0x543ba5[_0x6d64('0x12')][_0x6d64('0x13')]===0x1f4){logger[_0x6d64('0x12')](_0x6d64('0x14'),_0x4c3ae2,_0x543ba5[_0x6d64('0x12')][_0x6d64('0x15')]);return _0x19fcf1(_0x543ba5[_0x6d64('0x12')]['message']);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x4c3ae2,_0x543ba5[_0x6d64('0x12')][_0x6d64('0x15')]);return _0xf97586(_0x543ba5[_0x6d64('0x12')][_0x6d64('0x15')]);}else{logger[_0x6d64('0xe')](_0x6d64('0x14'),_0x4c3ae2,_0x6d64('0xf'));_0xf97586(_0x543ba5[_0x6d64('0x16')][_0x6d64('0x15')]);}})[_0x6d64('0x17')](function(_0x3bc86b){logger[_0x6d64('0x12')](_0x6d64('0x14'),_0x4c3ae2,_0x3bc86b);_0x19fcf1(_0x3bc86b);});});} \ No newline at end of file +var _0xc3cf=['error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2c32fb,_0x45b9a8){var _0x1f2836=function(_0x277504){while(--_0x277504){_0x2c32fb['push'](_0x2c32fb['shift']());}};_0x1f2836(++_0x45b9a8);}(_0xc3cf,0x1e7));var _0xfc3c=function(_0x19cfd9,_0x163ae2){_0x19cfd9=_0x19cfd9-0x0;var _0x445dd2=_0xc3cf[_0x19cfd9];return _0x445dd2;};'use strict';var _=require(_0xfc3c('0x0'));var util=require(_0xfc3c('0x1'));var moment=require(_0xfc3c('0x2'));var BPromise=require(_0xfc3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc3c('0x4'));var db=require(_0xfc3c('0x5'))['db'];var utils=require(_0xfc3c('0x6'));var logger=require(_0xfc3c('0x7'))(_0xfc3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xfc3c('0x9'));var client=jayson[_0xfc3c('0xa')][_0xfc3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45da6a,_0xbce0ce,_0x886bf8){return new BPromise(function(_0x46bb91,_0x1b2d56){return client[_0xfc3c('0xc')](_0x45da6a,_0x886bf8)['then'](function(_0x880833){logger[_0xfc3c('0xd')](_0xfc3c('0xe'),_0xbce0ce,'request\x20sent');logger[_0xfc3c('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xbce0ce,_0xfc3c('0x10'),JSON['stringify'](_0x880833));if(_0x880833[_0xfc3c('0x11')]){if(_0x880833['error']['code']===0x1f4){logger[_0xfc3c('0x11')](_0xfc3c('0xe'),_0xbce0ce,_0x880833[_0xfc3c('0x11')][_0xfc3c('0x12')]);return _0x1b2d56(_0x880833['error']['message']);}logger[_0xfc3c('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0xbce0ce,_0x880833[_0xfc3c('0x11')][_0xfc3c('0x12')]);return _0x46bb91(_0x880833[_0xfc3c('0x11')][_0xfc3c('0x12')]);}else{logger[_0xfc3c('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0xbce0ce,'request\x20sent');_0x46bb91(_0x880833[_0xfc3c('0x13')]['message']);}})[_0xfc3c('0x14')](function(_0x187e8e){logger[_0xfc3c('0x11')](_0xfc3c('0xe'),_0xbce0ce,_0x187e8e);_0x1b2d56(_0x187e8e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a737c39..7fc4453 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5c7=['status','online','None','log','App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','default','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','join','Offline\x20apps:'];(function(_0x1a574b,_0x105427){var _0x2f9cc9=function(_0x308f3a){while(--_0x308f3a){_0x1a574b['push'](_0x1a574b['shift']());}};_0x2f9cc9(++_0x105427);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x53a207,_0x2e8e4b){_0x53a207=_0x53a207-0x0;var _0x2efb83=_0xc5c7[_0x53a207];return _0x2efb83;};'use strict';var _=require('lodash');var db=require(_0x7c5c('0x0'))['db'];var seedDb=require(_0x7c5c('0x1'));var checkLicense=require(_0x7c5c('0x2'));var rpc=require(_0x7c5c('0x3'));var config=require(_0x7c5c('0x4'));var logger=require(_0x7c5c('0x5'))('app');var pm2=require(_0x7c5c('0x6'));var pm2Config=require(_0x7c5c('0x7'));var schedule=require(_0x7c5c('0x8'));var chat=require(_0x7c5c('0x9'));var whatsapp=require(_0x7c5c('0xa'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x7c5c('0xb')]['sync']()[_0x7c5c('0xc')](function(){if(config['seedDB']){return seedDb[_0x7c5c('0xd')]();}})[_0x7c5c('0xc')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x7c5c('0xe')]();})[_0x7c5c('0xc')](function(_0x5c7073){logger[_0x7c5c('0xf')](_0x5c7073);return chat['start']();})[_0x7c5c('0xc')](function(){return whatsapp['start']();})[_0x7c5c('0xc')](function(){return schedule[_0x7c5c('0x10')]();})['then'](function(){return transcribe[_0x7c5c('0x10')]();})[_0x7c5c('0xc')](function(){return provider[_0x7c5c('0x10')]();})[_0x7c5c('0xc')](function(_0x3d5a9d){logger[_0x7c5c('0xf')](_0x3d5a9d);return pm2[_0x7c5c('0x10')](pm2Config);})[_0x7c5c('0xc')](function(_0x2f2285){var _0x461124=_0x2f2285[_0x7c5c('0x11')](function(_0x31bfdb){return typeof _0x31bfdb[_0x7c5c('0x12')]===_0x7c5c('0x13')&&_0x31bfdb['exitCode']>=0x0;});if(_0x461124['length']>0x0){throw new Error(_0x461124[_0x7c5c('0x14')]+_0x7c5c('0x15')+_[_0x7c5c('0x16')](_0x461124,function(_0x266aea){return'\x22'+_0x266aea['pm2_env'][_0x7c5c('0x17')]+'\x22';}));}logger[_0x7c5c('0xf')](_0x7c5c('0x18'),_[_0x7c5c('0x16')](_[_0x7c5c('0x11')](_0x2f2285,{'status':'online'}),'name')[_0x7c5c('0x19')]());logger[_0x7c5c('0xf')](_0x7c5c('0x1a'),_['map'](_[_0x7c5c('0x11')](_0x2f2285,function(_0x1bf163){return _0x1bf163[_0x7c5c('0x1b')]!==_0x7c5c('0x1c');}),_0x7c5c('0x17'))['join']()||_0x7c5c('0x1d'));console[_0x7c5c('0x1e')](_0x7c5c('0x1f'));})['catch'](function(_0x3ec07b){console[_0x7c5c('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3ec07b);logger[_0x7c5c('0x20')](_0x7c5c('0x21'),_0x3ec07b);process[_0x7c5c('0x22')](0x1);});}main(); \ No newline at end of file +var _0x503a=['filter','exitCode','number','length','map','pm2_env','name','online','join','Offline\x20apps:','status','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start'];(function(_0x505e7f,_0x50f73c){var _0x4fc3c0=function(_0x3dfb1e){while(--_0x3dfb1e){_0x505e7f['push'](_0x505e7f['shift']());}};_0x4fc3c0(++_0x50f73c);}(_0x503a,0x19d));var _0xa503=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0x503a[_0x1f8053];return _0x174fd8;};'use strict';var _=require(_0xa503('0x0'));var db=require(_0xa503('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xa503('0x2'));var rpc=require('./rpc');var config=require(_0xa503('0x3'));var logger=require(_0xa503('0x4'))(_0xa503('0x5'));var pm2=require(_0xa503('0x6'));var pm2Config=require(_0xa503('0x7'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa503('0x8'));var provider=require(_0xa503('0x9'));function main(){return db['sequelize'][_0xa503('0xa')]()[_0xa503('0xb')](function(){if(config[_0xa503('0xc')]){return seedDb[_0xa503('0xd')]();}})[_0xa503('0xb')](function(){return checkLicense[_0xa503('0xd')]();})[_0xa503('0xb')](function(){return rpc['listen']();})[_0xa503('0xb')](function(_0x1f85e3){logger[_0xa503('0xe')](_0x1f85e3);return chat['start']();})[_0xa503('0xb')](function(){return whatsapp['start']();})[_0xa503('0xb')](function(){return schedule['start']();})[_0xa503('0xb')](function(){return transcribe[_0xa503('0xf')]();})['then'](function(){return provider['start']();})[_0xa503('0xb')](function(_0x1a84ba){logger[_0xa503('0xe')](_0x1a84ba);return pm2[_0xa503('0xf')](pm2Config);})[_0xa503('0xb')](function(_0x1c1971){var _0xfa3e18=_0x1c1971[_0xa503('0x10')](function(_0x3ae1b0){return typeof _0x3ae1b0[_0xa503('0x11')]===_0xa503('0x12')&&_0x3ae1b0[_0xa503('0x11')]>=0x0;});if(_0xfa3e18[_0xa503('0x13')]>0x0){throw new Error(_0xfa3e18[_0xa503('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xa503('0x14')](_0xfa3e18,function(_0x2a9557){return'\x22'+_0x2a9557[_0xa503('0x15')][_0xa503('0x16')]+'\x22';}));}logger[_0xa503('0xe')]('Online\x20apps:',_[_0xa503('0x14')](_['filter'](_0x1c1971,{'status':_0xa503('0x17')}),_0xa503('0x16'))[_0xa503('0x18')]());logger[_0xa503('0xe')](_0xa503('0x19'),_[_0xa503('0x14')](_[_0xa503('0x10')](_0x1c1971,function(_0x10486f){return _0x10486f[_0xa503('0x1a')]!==_0xa503('0x17');}),_0xa503('0x16'))[_0xa503('0x18')]()||'None');console['log'](_0xa503('0x1b'));})[_0xa503('0x1c')](function(_0x1f7abe){console[_0xa503('0x1d')](_0xa503('0x1e'),_0x1f7abe);logger['error'](_0xa503('0x1f'),_0x1f7abe);process[_0xa503('0x20')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 0361fa0..80cdfb6 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 _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3c6ce8,_0x186cb1){_0x3c6ce8=_0x3c6ce8-0x0;var _0x4612cc=_0xb43b[_0x3c6ce8];return _0x4612cc;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file +var _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x35cf3d,_0x5b755c){var _0x507252=function(_0x256ef1){while(--_0x256ef1){_0x35cf3d['push'](_0x35cf3d['shift']());}};_0x507252(++_0x5b755c);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b0690,_0x4f742f){_0x2b0690=_0x2b0690-0x0;var _0x82be1=_0xf3cd[_0x2b0690];return _0x82be1;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b622fcc..6a57ca7 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 _0x9050=['write','end','final','close','decryptFile','createDecipher','unlink','encryptString','secret','createCipher','utf8','base64','crypto','../../config/environment','app','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary'];(function(_0x1b8359,_0x1e8543){var _0x25d76f=function(_0x96278e){while(--_0x96278e){_0x1b8359['push'](_0x1b8359['shift']());}};_0x25d76f(++_0x1e8543);}(_0x9050,0x198));var _0x0905=function(_0x734e2f,_0x35dc28){_0x734e2f=_0x734e2f-0x0;var _0x267c86=_0x9050[_0x734e2f];return _0x267c86;};'use strict';var crypto=require(_0x0905('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x0905('0x1'));var logger=require('../../config/logger')(_0x0905('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x0905('0x3')],'algorithm':_0x0905('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0x0905('0x5')]&&config[_0x0905('0x5')][_0x0905('0x6')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x0905('0x6')]);if(isSupported){fileOptions[_0x0905('0x6')]=config[_0x0905('0x5')][_0x0905('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x0905('0x7')](',\x20');logger[_0x0905('0x8')](config[_0x0905('0x5')][_0x0905('0x6')],_0x0905('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x448b9a){return AES_SUPPORTED_RX[_0x0905('0xa')](_0x448b9a);}function getSupportedCiphers(){return crypto[_0x0905('0xb')]()[_0x0905('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x59f88a){return getSupportedCiphers()[_0x0905('0xd')](_0x59f88a)>-0x1;}function combineOptions(_0x4b7d09){var _0xbd69ec={};for(var _0x371d52 in fileOptions){if(fileOptions['hasOwnProperty'](_0x371d52)){_0xbd69ec[_0x371d52]=fileOptions[_0x371d52];}}if(_0x4b7d09){for(var _0x1312f4 in _0x4b7d09){if(_0x4b7d09[_0x0905('0xe')](_0x1312f4)){_0xbd69ec[_0x1312f4]=_0x4b7d09[_0x1312f4];}}}return _0xbd69ec;}exports[_0x0905('0xf')]=function(_0x49568f,_0x18598d,_0x456936,_0x1d4783){return new BPromise(function(_0x4ead39,_0x5b2c6a){_0x1d4783=combineOptions(_0x1d4783);var _0x40b7e1=new Buffer(_0x456936);var _0x2d6720=fs[_0x0905('0x10')](_0x49568f);var _0x13d2ec=fs[_0x0905('0x11')](_0x18598d);var _0x576381=crypto['createCipher'](_0x1d4783[_0x0905('0x6')],_0x40b7e1);_0x2d6720['on'](_0x0905('0x12'),function(_0x3d1dd7){var _0x34d301=new Buffer(_0x576381[_0x0905('0x13')](_0x3d1dd7),_0x0905('0x14'));_0x13d2ec[_0x0905('0x15')](_0x34d301);});_0x2d6720['on'](_0x0905('0x16'),function(){try{var _0x6f3e58=new Buffer(_0x576381[_0x0905('0x17')]('binary'),_0x0905('0x14'));_0x13d2ec[_0x0905('0x15')](_0x6f3e58);_0x13d2ec[_0x0905('0x16')]();_0x13d2ec['on'](_0x0905('0x18'),function(){return _0x4ead39(_0x18598d);});}catch(_0x17f36c){fs['unlink'](_0x18598d);return _0x5b2c6a(_0x17f36c);}});});};exports[_0x0905('0x19')]=function(_0x13c021,_0x284f83,_0x555ab1,_0x235c25){return new BPromise(function(_0x28166d,_0x2487cb){_0x235c25=combineOptions(_0x235c25);var _0x3e977c=new Buffer(_0x555ab1);var _0x16ca07=fs[_0x0905('0x10')](_0x13c021);var _0x588766=fs[_0x0905('0x11')](_0x284f83);var _0x58b8ee=crypto[_0x0905('0x1a')](_0x235c25[_0x0905('0x6')],_0x3e977c);_0x16ca07['on']('data',function(_0xb13217){var _0x328702=new Buffer(_0x58b8ee[_0x0905('0x13')](_0xb13217),'binary');_0x588766[_0x0905('0x15')](_0x328702);});_0x16ca07['on'](_0x0905('0x16'),function(){try{var _0x102900=new Buffer(_0x58b8ee[_0x0905('0x17')](_0x0905('0x14')),'binary');_0x588766[_0x0905('0x15')](_0x102900);_0x588766['end']();_0x588766['on'](_0x0905('0x18'),function(){return _0x28166d(_0x284f83);});}catch(_0xbb55f4){fs[_0x0905('0x1b')](_0x284f83);return _0x2487cb(_0xbb55f4);}});});};exports[_0x0905('0x1c')]=function(_0x33b044,_0x5743fa,_0x14cd9a){var _0x2304c0=_0x14cd9a||stringOptions['algorithm'];var _0x5ae333=_0x5743fa||stringOptions[_0x0905('0x1d')];var _0x57ddc3=crypto[_0x0905('0x1e')](_0x2304c0,_0x5ae333);var _0x54fc6d=_0x57ddc3['update'](_0x33b044,_0x0905('0x1f'),_0x0905('0x20'));_0x54fc6d+=_0x57ddc3[_0x0905('0x17')](_0x0905('0x20'));return _0x54fc6d;};exports['decryptString']=function(_0x175d86,_0x3bde85,_0x45db1d){var _0x45b567=_0x45db1d||stringOptions[_0x0905('0x6')];var _0x21c187=_0x3bde85||stringOptions[_0x0905('0x1d')];var _0x20d92e=crypto['createDecipher'](_0x45b567,_0x21c187);var _0x464751=_0x20d92e[_0x0905('0x13')](_0x175d86,_0x0905('0x20'),_0x0905('0x1f'));_0x464751+=_0x20d92e[_0x0905('0x17')](_0x0905('0x1f'));return _0x464751;}; \ No newline at end of file +var _0x694e=['decryptString','secret','createDecipher','bluebird','lodash','../../config/environment','secrets','session','aes192','encrypt','algorithm','join','error','test','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write','end','final','binary','close','unlink','encryptString','utf8'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x694e,0x7b));var _0xe694=function(_0x16a92d,_0x3485ce){_0x16a92d=_0x16a92d-0x0;var _0xb16912=_0x694e[_0x16a92d];return _0xb16912;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xe694('0x0'));var _=require(_0xe694('0x1'));var config=require(_0xe694('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe694('0x3')][_0xe694('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xe694('0x5')};if(config[_0xe694('0x6')]&&config[_0xe694('0x6')][_0xe694('0x7')]){var isSupported=isAlgorithmSupported(config[_0xe694('0x6')][_0xe694('0x7')]);if(isSupported){fileOptions[_0xe694('0x7')]=config[_0xe694('0x6')][_0xe694('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe694('0x8')](',\x20');logger[_0xe694('0x9')](config[_0xe694('0x6')][_0xe694('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x208443){return AES_SUPPORTED_RX[_0xe694('0xa')](_0x208443);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xe694('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x1fd2bc){return getSupportedCiphers()['indexOf'](_0x1fd2bc)>-0x1;}function combineOptions(_0x20dfbe){var _0x2eee8a={};for(var _0x45ab26 in fileOptions){if(fileOptions[_0xe694('0xc')](_0x45ab26)){_0x2eee8a[_0x45ab26]=fileOptions[_0x45ab26];}}if(_0x20dfbe){for(var _0x33cc4b in _0x20dfbe){if(_0x20dfbe[_0xe694('0xc')](_0x33cc4b)){_0x2eee8a[_0x33cc4b]=_0x20dfbe[_0x33cc4b];}}}return _0x2eee8a;}exports[_0xe694('0xd')]=function(_0x48f7eb,_0x4d64c3,_0x362ccf,_0x8b7592){return new BPromise(function(_0x3bb063,_0x25345b){_0x8b7592=combineOptions(_0x8b7592);var _0x1dc1f5=new Buffer(_0x362ccf);var _0x36ee29=fs[_0xe694('0xe')](_0x48f7eb);var _0x560e4e=fs[_0xe694('0xf')](_0x4d64c3);var _0x56f9a0=crypto[_0xe694('0x10')](_0x8b7592['algorithm'],_0x1dc1f5);_0x36ee29['on'](_0xe694('0x11'),function(_0x5c0cda){var _0xb2534=new Buffer(_0x56f9a0[_0xe694('0x12')](_0x5c0cda),'binary');_0x560e4e[_0xe694('0x13')](_0xb2534);});_0x36ee29['on'](_0xe694('0x14'),function(){try{var _0x1fda43=new Buffer(_0x56f9a0[_0xe694('0x15')](_0xe694('0x16')),_0xe694('0x16'));_0x560e4e[_0xe694('0x13')](_0x1fda43);_0x560e4e[_0xe694('0x14')]();_0x560e4e['on'](_0xe694('0x17'),function(){return _0x3bb063(_0x4d64c3);});}catch(_0x2af33f){fs[_0xe694('0x18')](_0x4d64c3);return _0x25345b(_0x2af33f);}});});};exports['decryptFile']=function(_0x225e99,_0x4a87c7,_0x5bffc4,_0x54231a){return new BPromise(function(_0x4f2fb0,_0x317a4f){_0x54231a=combineOptions(_0x54231a);var _0x45cd2c=new Buffer(_0x5bffc4);var _0x125724=fs['createReadStream'](_0x225e99);var _0x4bbf43=fs[_0xe694('0xf')](_0x4a87c7);var _0x45a4e3=crypto['createDecipher'](_0x54231a[_0xe694('0x7')],_0x45cd2c);_0x125724['on']('data',function(_0x4035d5){var _0x586453=new Buffer(_0x45a4e3[_0xe694('0x12')](_0x4035d5),_0xe694('0x16'));_0x4bbf43[_0xe694('0x13')](_0x586453);});_0x125724['on'](_0xe694('0x14'),function(){try{var _0x1489d1=new Buffer(_0x45a4e3[_0xe694('0x15')](_0xe694('0x16')),_0xe694('0x16'));_0x4bbf43[_0xe694('0x13')](_0x1489d1);_0x4bbf43[_0xe694('0x14')]();_0x4bbf43['on'](_0xe694('0x17'),function(){return _0x4f2fb0(_0x4a87c7);});}catch(_0x120210){fs[_0xe694('0x18')](_0x4a87c7);return _0x317a4f(_0x120210);}});});};exports[_0xe694('0x19')]=function(_0x2d7a94,_0x1debf0,_0x31d351){var _0x262ddc=_0x31d351||stringOptions['algorithm'];var _0x3c3576=_0x1debf0||stringOptions['secret'];var _0x32bd86=crypto['createCipher'](_0x262ddc,_0x3c3576);var _0x1a08c1=_0x32bd86[_0xe694('0x12')](_0x2d7a94,_0xe694('0x1a'),'base64');_0x1a08c1+=_0x32bd86[_0xe694('0x15')]('base64');return _0x1a08c1;};exports[_0xe694('0x1b')]=function(_0x1b9031,_0x123ff0,_0x2872f4){var _0x577b9c=_0x2872f4||stringOptions[_0xe694('0x7')];var _0x5601aa=_0x123ff0||stringOptions[_0xe694('0x1c')];var _0x167c09=crypto[_0xe694('0x1d')](_0x577b9c,_0x5601aa);var _0x368f40=_0x167c09[_0xe694('0x12')](_0x1b9031,'base64',_0xe694('0x1a'));_0x368f40+=_0x167c09[_0xe694('0x15')]('utf8');return _0x368f40;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index eb0fa34..761cf65 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 _0x9049=['zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.csv','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync'];(function(_0x3f4065,_0x2299f7){var _0xa5de22=function(_0x2ee8c0){while(--_0x2ee8c0){_0x3f4065['push'](_0x3f4065['shift']());}};_0xa5de22(++_0x2299f7);}(_0x9049,0xd0));var _0x9904=function(_0x2bcc60,_0x4fa537){_0x2bcc60=_0x2bcc60-0x0;var _0x4541cd=_0x9049[_0x2bcc60];return _0x4541cd;};'use strict';var util=require(_0x9904('0x0'));var path=require(_0x9904('0x1'));var _=require(_0x9904('0x2'));var csv=require(_0x9904('0x3'));var fs=require('fs');var BPromise=require(_0x9904('0x4'));var zipdir=require(_0x9904('0x5'));var rimraf=require(_0x9904('0x6'));var db=require(_0x9904('0x7'))['db'];var dbH=require(_0x9904('0x7'))[_0x9904('0x8')];var logger=require(_0x9904('0x9'))(_0x9904('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9904('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3ee8c6,_0x58be6e){var _0x324b5e={'status':_0x3ee8c6};var _0x56cd0a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x58be6e){_0x324b5e['savename']=_0x58be6e;}return db[_0x9904('0xc')][_0x9904('0xd')](_0x324b5e,_0x56cd0a);}function main(){var _0x4dd6a1=0x1388;var _0xc087bd;logger[_0x9904('0xe')](util['format'](_0x9904('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x9904('0x10')][_0x9904('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9904('0x12'),_0x9904('0x13')]})[_0x9904('0x14')](function(_0x51d7ba){if(_0x51d7ba){_0xc087bd=_0x51d7ba;_0x4dd6a1=_0xc087bd['splitSizeCsv']||0x1388;}})[_0x9904('0x14')](function(){return dbH[_0x9904('0x15')]['query'](util[_0x9904('0x16')](_0x9904('0x17'),QUERY),{'type':dbH[_0x9904('0x15')]['QueryTypes']['SELECT']});})[_0x9904('0x14')](function(_0x5d9d6b){if(!_0x5d9d6b[0x0][_0x9904('0x18')]){return analyticExtractedReport(_0x9904('0x19'));}var _0x2c5c27=[];var _0x4e4b40=0x0;if(_0xc087bd[_0x9904('0x12')]){if(_0x5d9d6b&&_0x5d9d6b['length']){var _0x22779c=_[_0x9904('0x1a')](_0x5d9d6b[0x0][_0x9904('0x18')]/_0x4dd6a1);var _0x471b4e=Number['isInteger'](_0x5d9d6b[0x0][_0x9904('0x18')]/_0x4dd6a1)?_0x5d9d6b[0x0][_0x9904('0x18')]%_0x4dd6a1:0x0;_0x22779c[_0x9904('0x1b')](function(_0x570575){if(_0x570575>0x0){_0x4e4b40+=_0x4dd6a1;}_0x2c5c27[_0x9904('0x1c')](dbH['sequelize'][_0x9904('0x1d')](util[_0x9904('0x16')](_0x9904('0x1e'),QUERY,_0x4dd6a1,_0x4e4b40),{'type':dbH[_0x9904('0x15')][_0x9904('0x1f')][_0x9904('0x20')]}));});if(_0x471b4e>0x0){_0x4e4b40+=_0x4dd6a1;_0x2c5c27[_0x9904('0x1c')](dbH[_0x9904('0x15')][_0x9904('0x1d')](util[_0x9904('0x16')](_0x9904('0x1e'),QUERY,_0x471b4e,_0x4e4b40),{'type':dbH[_0x9904('0x15')][_0x9904('0x1f')][_0x9904('0x20')]}));}}}else{_0x2c5c27['push'](dbH['sequelize'][_0x9904('0x1d')](QUERY,{'type':dbH[_0x9904('0x15')][_0x9904('0x1f')][_0x9904('0x20')]}));}var _0x32299d=path[_0x9904('0x21')](PATH);var _0x4ca231=path[_0x9904('0x22')](PATH,_0x9904('0x23'));var _0x23aff2=_0xc087bd[_0x9904('0x12')]&&_0x2c5c27['length']>0x1;var _0x80672d=[];if(!fs[_0x9904('0x24')](path['join'](_0x32299d,_0x4ca231))&&_0x23aff2){fs['mkdirSync'](path['join'](_0x32299d,_0x4ca231));}return BPromise['each'](_0x2c5c27,function(_0x3961a6){_0x80672d[_0x9904('0x1c')](_0x3961a6);})[_0x9904('0x14')](function(){for(var _0x46f7ae=0x0;_0x46f7ae<_0x80672d['length'];_0x46f7ae+=0x1){var _0x367247;var _0x537fd8=_0x80672d[_0x46f7ae];if(_0x23aff2){_0x367247=path[_0x9904('0x25')](_0x32299d,_0x4ca231,util['format'](_0x9904('0x26'),_0x4ca231,_0x46f7ae,_0x9904('0x27')));}else{_0x367247=path[_0x9904('0x25')](_0x32299d,util['format'](_0x9904('0x28'),_0x4ca231,_0x9904('0x27')));}fs[_0x9904('0x29')](_0x367247,csv(_0x537fd8));}})[_0x9904('0x14')](function(){if(_0x23aff2){return new Promise(function(_0x5ea010){zipdir(path[_0x9904('0x25')](_0x32299d,_0x4ca231),{'saveTo':path[_0x9904('0x25')](_0x32299d,util['format']('%s.%s',_0x4ca231,_0x9904('0x2a')))},function(_0xa7f96c,_0x1bb47b){rimraf(path[_0x9904('0x25')](_0x32299d,_0x4ca231),function(){});_0x5ea010('zip\x20finished');});});}})[_0x9904('0x14')](function(){logger[_0x9904('0xe')](util['format'](_0x9904('0x2b'),EXTRACTED_REPORT_ID,_0x9904('0x2c')));return analyticExtractedReport(_0x9904('0x2d'),_0x23aff2?util[_0x9904('0x16')](_0x9904('0x28'),_0x4ca231,_0x23aff2?_0x9904('0x2a'):_0x9904('0x27')):null);});})[_0x9904('0x2e')](function(_0x5781a9){logger[_0x9904('0xe')](util[_0x9904('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x5781a9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9904('0x2f'));})[_0x9904('0x30')](function(){process[_0x9904('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x11d5=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','each','join','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','num'];(function(_0x20dc6b,_0x627192){var _0xe829d1=function(_0x4b28e2){while(--_0x4b28e2){_0x20dc6b['push'](_0x20dc6b['shift']());}};_0xe829d1(++_0x627192);}(_0x11d5,0x79));var _0x511d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x11d5[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x511d('0x0'));var path=require(_0x511d('0x1'));var _=require(_0x511d('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x511d('0x3'));var zipdir=require(_0x511d('0x4'));var rimraf=require(_0x511d('0x5'));var db=require(_0x511d('0x6'))['db'];var dbH=require(_0x511d('0x6'))['dbH'];var logger=require('../../config/logger')(_0x511d('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x511d('0x8')][0x2]);var QUERY=process[_0x511d('0x8')][0x3];var PATH=process[_0x511d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x47dc93,_0x5a1a45){var _0xd677e6={'status':_0x47dc93};var _0x360668={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a1a45){_0xd677e6[_0x511d('0x9')]=_0x5a1a45;}return db[_0x511d('0xa')]['update'](_0xd677e6,_0x360668);}function main(){var _0x27894f=0x1388;var _0x32141c;logger[_0x511d('0xb')](util[_0x511d('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x511d('0xd')));return db['Setting'][_0x511d('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x511d('0xf'),_0x511d('0x10')]})[_0x511d('0x11')](function(_0x336c6f){if(_0x336c6f){_0x32141c=_0x336c6f;_0x27894f=_0x32141c[_0x511d('0x10')]||0x1388;}})[_0x511d('0x11')](function(){return dbH[_0x511d('0x12')][_0x511d('0x13')](util[_0x511d('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x511d('0x12')][_0x511d('0x14')][_0x511d('0x15')]});})[_0x511d('0x11')](function(_0x1da5e9){if(!_0x1da5e9[0x0]['num']){return analyticExtractedReport(_0x511d('0x16'));}var _0x5020ef=[];var _0x278c4f=0x0;if(_0x32141c[_0x511d('0xf')]){if(_0x1da5e9&&_0x1da5e9[_0x511d('0x17')]){var _0x44dae4=_[_0x511d('0x18')](_0x1da5e9[0x0][_0x511d('0x19')]/_0x27894f);var _0xa9bfd0=Number['isInteger'](_0x1da5e9[0x0][_0x511d('0x19')]/_0x27894f)?_0x1da5e9[0x0]['num']%_0x27894f:0x0;_0x44dae4[_0x511d('0x1a')](function(_0x49402c){if(_0x49402c>0x0){_0x278c4f+=_0x27894f;}_0x5020ef[_0x511d('0x1b')](dbH[_0x511d('0x12')][_0x511d('0x13')](util['format'](_0x511d('0x1c'),QUERY,_0x27894f,_0x278c4f),{'type':dbH[_0x511d('0x12')][_0x511d('0x14')][_0x511d('0x15')]}));});if(_0xa9bfd0>0x0){_0x278c4f+=_0x27894f;_0x5020ef['push'](dbH['sequelize'][_0x511d('0x13')](util[_0x511d('0xc')](_0x511d('0x1c'),QUERY,_0xa9bfd0,_0x278c4f),{'type':dbH['sequelize'][_0x511d('0x14')][_0x511d('0x15')]}));}}}else{_0x5020ef['push'](dbH[_0x511d('0x12')][_0x511d('0x13')](QUERY,{'type':dbH['sequelize'][_0x511d('0x14')][_0x511d('0x15')]}));}var _0x1ebefb=path[_0x511d('0x1d')](PATH);var _0x24a354=path[_0x511d('0x1e')](PATH,_0x511d('0x1f'));var _0x212c06=_0x32141c['split']&&_0x5020ef[_0x511d('0x17')]>0x1;var _0x54315f=[];if(!fs[_0x511d('0x20')](path['join'](_0x1ebefb,_0x24a354))&&_0x212c06){fs['mkdirSync'](path['join'](_0x1ebefb,_0x24a354));}return BPromise[_0x511d('0x21')](_0x5020ef,function(_0x1fc689){_0x54315f[_0x511d('0x1b')](_0x1fc689);})[_0x511d('0x11')](function(){for(var _0x1a1164=0x0;_0x1a1164<_0x54315f[_0x511d('0x17')];_0x1a1164+=0x1){var _0xccf8ca;var _0x4421f6=_0x54315f[_0x1a1164];if(_0x212c06){_0xccf8ca=path[_0x511d('0x22')](_0x1ebefb,_0x24a354,util[_0x511d('0xc')](_0x511d('0x23'),_0x24a354,_0x1a1164,'csv'));}else{_0xccf8ca=path[_0x511d('0x22')](_0x1ebefb,util[_0x511d('0xc')](_0x511d('0x24'),_0x24a354,'csv'));}fs[_0x511d('0x25')](_0xccf8ca,csv(_0x4421f6));}})[_0x511d('0x11')](function(){if(_0x212c06){return new Promise(function(_0x1fe8c3){zipdir(path[_0x511d('0x22')](_0x1ebefb,_0x24a354),{'saveTo':path[_0x511d('0x22')](_0x1ebefb,util[_0x511d('0xc')](_0x511d('0x24'),_0x24a354,_0x511d('0x26')))},function(_0x44082d,_0x4ce647){rimraf(path['join'](_0x1ebefb,_0x24a354),function(){});_0x1fe8c3(_0x511d('0x27'));});});}})[_0x511d('0x11')](function(){logger[_0x511d('0xb')](util[_0x511d('0xc')](_0x511d('0x28'),EXTRACTED_REPORT_ID,_0x511d('0xd')));return analyticExtractedReport(_0x511d('0x29'),_0x212c06?util[_0x511d('0xc')](_0x511d('0x24'),_0x24a354,_0x212c06?_0x511d('0x26'):_0x511d('0x2a')):null);});})[_0x511d('0x2b')](function(_0xc0578e){logger[_0x511d('0xb')](util[_0x511d('0xc')](_0x511d('0x2c'),EXTRACTED_REPORT_ID,_0x511d('0xd')),util[_0x511d('0x2d')](_0xc0578e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x511d('0x2e'));})[_0x511d('0x2f')](function(){process[_0x511d('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 415d70b..6517ffc 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 _0x60a0=['basename','.pdf','existsSync','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','pdf','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','finish','end','catch','util','moment','zip-dir','rimraf','window','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','pageBreak','before','margin','landscape','toString','\x20/\x20','Arial','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT'];(function(_0x430cb4,_0x127fde){var _0x294523=function(_0x19288b){while(--_0x19288b){_0x430cb4['push'](_0x430cb4['shift']());}};_0x294523(++_0x127fde);}(_0x60a0,0xbe));var _0x060a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60a0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x060a('0x0'));var path=require('path');var moment=require(_0x060a('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x060a('0x2'));var rimraf=require(_0x060a('0x3'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x060a('0x4')];var BPromise=require('bluebird');var db=require(_0x060a('0x5'))['db'];var dbH=require('../../mysqldb')[_0x060a('0x6')];var logger=require(_0x060a('0x7'))(_0x060a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x060a('0x9')][0x2]);var QUERY=process[_0x060a('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x060a('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xe33f86,_0x16de59){var _0x29b801={'status':_0xe33f86};var _0x176e58={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x16de59){_0x29b801[_0x060a('0xa')]=_0x16de59;}return db[_0x060a('0xb')][_0x060a('0xc')](_0x29b801,_0x176e58);}function getHeaders(_0x3e759d){return _[_0x060a('0xd')](_0x3e759d,function(_0x45ebf7){return{'text':_0x45ebf7,'style':_0x060a('0xe')};});}function getRows(_0x229bb4,_0x129224){return _['map'](_0x129224,function(_0x27c015){return _(_0x27c015)[_0x060a('0xf')](_0x229bb4)[_0x060a('0xd')](function(_0x5d59fd){return _0x5d59fd?_['toString'](_0x5d59fd):'';})[_0x060a('0x10')]();});}function createTable(_0x3b1dfd,_0x1cd9a6){var _0x59006d={'widths':_['fill'](Array(_0x3b1dfd[_0x060a('0x11')]),0x91),'heights':function(_0x1745ec){return _0x1745ec===0x0?_0x060a('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xc0de8=getHeaders(_0x3b1dfd);_0x59006d[_0x060a('0x13')][_0x060a('0x14')](_0xc0de8);var _0x418e01=getRows(_0x3b1dfd,_0x1cd9a6);_0x59006d[_0x060a('0x13')]=_0x59006d[_0x060a('0x13')][_0x060a('0x15')](_0x418e01);return _0x59006d;}function createTables(_0x1aefb9){var _0x53cfa7=[];var _0x24e02a=_[_0x060a('0x16')](Object[_0x060a('0x17')](_0x1aefb9[0x0]),0x5);_0x24e02a[_0x060a('0x18')](function(_0x4925d4){_0x53cfa7[_0x060a('0x14')](createTable(_0x4925d4,_0x1aefb9));});return _0x53cfa7;}function getPDFDocDefinition(_0x316781){var _0x2af12d=util[_0x060a('0x19')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x060a('0x1a')],moment(EXTRACTED_REPORT[_0x060a('0x1b')])[_0x060a('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0x060a('0x1c')])[_0x060a('0x19')](FORMAT));var _0x58246d=[];for(var _0x4b1e73=0x0;_0x4b1e73<_0x316781[_0x060a('0x11')];_0x4b1e73++){var _0x147721=[];if(_0x4b1e73===0x0){_0x147721[_0x060a('0x14')]({'text':_0x2af12d,'style':'header'});}var _0x509993={'table':_0x316781[_0x4b1e73]};if(_0x4b1e73>0x0){_0x509993[_0x060a('0x1d')]=_0x060a('0x1e');_0x509993[_0x060a('0x1f')]=[0x0,0x46,0x0,0x0];}_0x147721[_0x060a('0x14')](_0x509993);_0x58246d['push'](_0x147721);}return{'pageSize':'A4','pageOrientation':_0x060a('0x20'),'content':_0x58246d,'footer':function(_0x3f2967,_0x55479e){return{'text':_0x3f2967[_0x060a('0x21')]()+_0x060a('0x22')+_0x55479e,'style':'footer'};},'defaultStyle':{'font':_0x060a('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x060a('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5103c0){var _0x103edc=0x1388;var _0x49c3cb;if(!_0x5103c0[0x0][_0x060a('0x25')]){return analyticExtractedReport(_0x060a('0x26'));}return db[_0x060a('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x060a('0x28'),_0x060a('0x29')]})['then'](function(_0x4d156f){if(_0x4d156f){_0x49c3cb=_0x4d156f;_0x103edc=_0x49c3cb['splitSizePdf']||0x3e8;}})[_0x060a('0x2a')](function(){var _0x39e728=[];var _0x1089bc=0x0;if(_0x49c3cb[_0x060a('0x28')]){if(_0x5103c0&&_0x5103c0[_0x060a('0x11')]){var _0x14505a=_[_0x060a('0x2b')](_0x5103c0[0x0]['num']/_0x103edc);var _0x470b8b=Number[_0x060a('0x2c')](_0x5103c0[0x0]['num']/_0x103edc)?_0x5103c0[0x0][_0x060a('0x25')]%_0x103edc:0x0;_0x14505a[_0x060a('0x18')](function(_0x31a5ab){if(_0x31a5ab>0x0){_0x1089bc+=_0x103edc;}_0x39e728[_0x060a('0x14')](dbH['sequelize'][_0x060a('0x2d')](util[_0x060a('0x19')](_0x060a('0x2e'),QUERY,_0x103edc,_0x1089bc),{'type':dbH[_0x060a('0x2f')][_0x060a('0x30')][_0x060a('0x31')]}));});if(_0x470b8b>0x0){_0x1089bc+=_0x103edc;_0x39e728[_0x060a('0x14')](dbH[_0x060a('0x2f')][_0x060a('0x2d')](util[_0x060a('0x19')](_0x060a('0x2e'),QUERY,_0x470b8b,_0x1089bc),{'type':dbH[_0x060a('0x2f')][_0x060a('0x30')][_0x060a('0x31')]}));}}}else{_0x39e728[_0x060a('0x14')](dbH[_0x060a('0x2f')][_0x060a('0x2d')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x060a('0x31')]}));}var _0x3b1125=path['dirname'](PATH);var _0x1109ec=path[_0x060a('0x32')](PATH,_0x060a('0x33'));var _0x1055cb=_0x49c3cb[_0x060a('0x28')]&&_0x39e728[_0x060a('0x11')]>0x1;var _0x589789=[];if(!fs[_0x060a('0x34')](path['join'](_0x3b1125,_0x1109ec))&&_0x1055cb){fs[_0x060a('0x35')](path[_0x060a('0x36')](_0x3b1125,_0x1109ec));}return BPromise[_0x060a('0x37')](_0x39e728,function(_0x163465){_0x589789['push'](_0x163465);})[_0x060a('0x2a')](function(){var _0x1cc161=[];for(var _0x48f772=0x0;_0x48f772<_0x589789[_0x060a('0x11')];_0x48f772+=0x1){var _0x3a81f4=_0x589789[_0x48f772];var _0x44d58c=createTables(_['flatten'](_0x3a81f4));var _0x2db74a;var _0x414ccb=getPDFDocDefinition(_0x44d58c);var _0x226d2f=getPDFPrinter();var _0x1f11ee=_0x226d2f[_0x060a('0x38')](_0x414ccb);if(_0x1055cb){_0x2db74a=path[_0x060a('0x36')](_0x3b1125,_0x1109ec,util[_0x060a('0x19')](_0x060a('0x39'),_0x1109ec,_0x48f772,_0x060a('0x3a')));}else{_0x2db74a=path['join'](_0x3b1125,util[_0x060a('0x19')]('%s.%s',_0x1109ec,'pdf'));}_0x1cc161[_0x060a('0x14')](writePDFDocument(_0x1f11ee,_0x2db74a));}return Promise['all'](_0x1cc161);})[_0x060a('0x2a')](function(){if(_0x1055cb){return new Promise(function(_0x1c0df2){zipdir(path[_0x060a('0x36')](_0x3b1125,_0x1109ec),{'saveTo':path['join'](_0x3b1125,util['format']('%s.%s',_0x1109ec,_0x060a('0x3b')))},function(){rimraf(path['join'](_0x3b1125,_0x1109ec),function(){});_0x1c0df2('zip\x20finished');});});}})['then'](function(){if(!_0x1055cb)return;rimraf(path[_0x060a('0x36')](_0x3b1125,_0x1109ec),function(){});})[_0x060a('0x2a')](function(){logger[_0x060a('0x3c')](util[_0x060a('0x19')](_0x060a('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x1055cb?util[_0x060a('0x19')]('%s.%s',_0x1109ec,_0x1055cb?_0x060a('0x3b'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x060a('0x19')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0x060a('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5d933c){EXTRACTED_REPORT=_0x5d933c;return dbH['sequelize']['query'](util[_0x060a('0x19')](_0x060a('0x3f'),QUERY),{'type':dbH[_0x060a('0x2f')][_0x060a('0x30')][_0x060a('0x31')]});})[_0x060a('0x2a')](extractReport)['catch'](function(_0x99230b){logger[_0x060a('0x3c')](util[_0x060a('0x19')](_0x060a('0x40'),EXTRACTED_REPORT_ID,_0x060a('0x41')),util[_0x060a('0x42')](_0x99230b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x060a('0x43'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3d4a54=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x060a('0x44'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x060a('0x45')}});return _0x3d4a54;}function getPDFDocDefinitionFromHTML(_0x5b5a30,_0x3db61d){var _0x5354ac=util[_0x060a('0x19')](_0x060a('0x46'),_0x3db61d['channel'],_0x3db61d[_0x060a('0x47')]);var _0x5a1922=moment()[_0x060a('0x19')]('YYYY-MM-DD')[_0x060a('0x21')]();var _0x58120f=htmlToPdfmake(_0x5b5a30,{'window':window,'tableAutoSize':!![]});return{'content':[_0x58120f],'defaultStyle':{'font':_0x060a('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x060a('0x48'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x060a('0x48'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x060a('0x49'),'style':_0x060a('0x4a')}];},'footer':function(_0x28fc50,_0x58a914){return[{'text':util[_0x060a('0x19')](_0x060a('0x4b'),_0x5354ac,_0x28fc50,_0x58a914,_0x5a1922),'style':_0x060a('0x4c')}];}};}function writePDFDocument(_0x4e6e0a,_0x104964){return new Promise(function(_0x3b91cc,_0x2873e4){var _0x12eec1=_0x4e6e0a['pipe'](fs['createWriteStream'](_0x104964));_0x12eec1['on'](_0x060a('0x4d'),function(){_0x3b91cc(_0x060a('0x4d'));});_0x12eec1['on']('error',function(_0x65f537){_0x2873e4(_0x65f537);});_0x4e6e0a[_0x060a('0x4e')]();});}exports['createPdfFromHTML']=function(_0x4271cd,_0x2404ac){var _0x6f0c77=getPDFPrinter();var _0x408dbf=getPDFDocDefinitionFromHTML(_0x4271cd,_0x2404ac);var _0x5ed9bc=_0x6f0c77[_0x060a('0x38')](_0x408dbf);return writePDFDocument(_0x5ed9bc,_0x2404ac['path'])[_0x060a('0x4f')](function(_0x5820b9){throw _0x5820b9;});}; \ No newline at end of file +var _0xacb5=['../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','push','body','chunk','forEach','format','name','startDate','endDate','pageBreak','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','split','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','mkdirSync','createPdfKitDocument','%s%d.%s','pdf','join','%s.%s','all','zip','zip\x20finished','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','JSDOM','window','bluebird'];(function(_0x38f8bc,_0x53566e){var _0x49e679=function(_0x5a1b8b){while(--_0x5a1b8b){_0x38f8bc['push'](_0x38f8bc['shift']());}};_0x49e679(++_0x53566e);}(_0xacb5,0x1af));var _0x5acb=function(_0x5aa373,_0x54c7f4){_0x5aa373=_0x5aa373-0x0;var _0x590e8e=_0xacb5[_0x5aa373];return _0x590e8e;};'use strict';var _=require(_0x5acb('0x0'));var fs=require('fs');var util=require(_0x5acb('0x1'));var path=require('path');var moment=require(_0x5acb('0x2'));var htmlToPdfmake=require(_0x5acb('0x3'));var PdfPrinter=require(_0x5acb('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x5acb('0x5'));var JSDOM=require('jsdom')[_0x5acb('0x6')];var window=new JSDOM('')[_0x5acb('0x7')];var BPromise=require(_0x5acb('0x8'));var db=require(_0x5acb('0x9'))['db'];var dbH=require(_0x5acb('0x9'))['dbH'];var logger=require(_0x5acb('0xa'))(_0x5acb('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5acb('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x5acb('0xc')][0x5];var FORMAT=_0x5acb('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c6aa8,_0x102c20){var _0x3db2b0={'status':_0x4c6aa8};var _0x27b1f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x102c20){_0x3db2b0['savename']=_0x102c20;}return db[_0x5acb('0xe')][_0x5acb('0xf')](_0x3db2b0,_0x27b1f);}function getHeaders(_0x4f6a3c){return _[_0x5acb('0x10')](_0x4f6a3c,function(_0x4855fe){return{'text':_0x4855fe,'style':_0x5acb('0x11')};});}function getRows(_0x366563,_0x1a1bd0){return _[_0x5acb('0x10')](_0x1a1bd0,function(_0x1a1b75){return _(_0x1a1b75)['pick'](_0x366563)[_0x5acb('0x10')](function(_0x33bcb8){return _0x33bcb8?_[_0x5acb('0x12')](_0x33bcb8):'';})[_0x5acb('0x13')]();});}function createTable(_0x4c75fe,_0x2e70cb){var _0x2f0163={'widths':_[_0x5acb('0x14')](Array(_0x4c75fe[_0x5acb('0x15')]),0x91),'heights':function(_0x23d758){return _0x23d758===0x0?_0x5acb('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x30afc5=getHeaders(_0x4c75fe);_0x2f0163['body'][_0x5acb('0x17')](_0x30afc5);var _0x29422d=getRows(_0x4c75fe,_0x2e70cb);_0x2f0163[_0x5acb('0x18')]=_0x2f0163['body']['concat'](_0x29422d);return _0x2f0163;}function createTables(_0x255313){var _0x1c5f37=[];var _0x7f37f6=_[_0x5acb('0x19')](Object['keys'](_0x255313[0x0]),0x5);_0x7f37f6[_0x5acb('0x1a')](function(_0x2e2493){_0x1c5f37[_0x5acb('0x17')](createTable(_0x2e2493,_0x255313));});return _0x1c5f37;}function getPDFDocDefinition(_0x263d5f){var _0xdd1727=util[_0x5acb('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x5acb('0x1c')],moment(EXTRACTED_REPORT[_0x5acb('0x1d')])[_0x5acb('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x5acb('0x1e')])[_0x5acb('0x1b')](FORMAT));var _0xbcebd8=[];for(var _0x54bba3=0x0;_0x54bba3<_0x263d5f[_0x5acb('0x15')];_0x54bba3++){var _0x5689b9=[];if(_0x54bba3===0x0){_0x5689b9['push']({'text':_0xdd1727,'style':'header'});}var _0x161949={'table':_0x263d5f[_0x54bba3]};if(_0x54bba3>0x0){_0x161949[_0x5acb('0x1f')]=_0x5acb('0x20');_0x161949[_0x5acb('0x21')]=[0x0,0x46,0x0,0x0];}_0x5689b9[_0x5acb('0x17')](_0x161949);_0xbcebd8['push'](_0x5689b9);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xbcebd8,'footer':function(_0x13b857,_0x394715){return{'text':_0x13b857[_0x5acb('0x12')]()+_0x5acb('0x22')+_0x394715,'style':_0x5acb('0x23')};},'defaultStyle':{'font':_0x5acb('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5acb('0x25')},'footer':{'alignment':_0x5acb('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1fd723){var _0x258436=0x1388;var _0x405831;if(!_0x1fd723[0x0][_0x5acb('0x27')]){return analyticExtractedReport(_0x5acb('0x28'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5acb('0x29'),_0x5acb('0x2a')]})[_0x5acb('0x2b')](function(_0x4fb44a){if(_0x4fb44a){_0x405831=_0x4fb44a;_0x258436=_0x405831[_0x5acb('0x2a')]||0x3e8;}})['then'](function(){var _0xaf7598=[];var _0x28b456=0x0;if(_0x405831[_0x5acb('0x29')]){if(_0x1fd723&&_0x1fd723[_0x5acb('0x15')]){var _0x3d039b=_['range'](_0x1fd723[0x0][_0x5acb('0x27')]/_0x258436);var _0x344b31=Number[_0x5acb('0x2c')](_0x1fd723[0x0][_0x5acb('0x27')]/_0x258436)?_0x1fd723[0x0]['num']%_0x258436:0x0;_0x3d039b[_0x5acb('0x1a')](function(_0x1f9e3c){if(_0x1f9e3c>0x0){_0x28b456+=_0x258436;}_0xaf7598[_0x5acb('0x17')](dbH[_0x5acb('0x2d')][_0x5acb('0x2e')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x258436,_0x28b456),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x344b31>0x0){_0x28b456+=_0x258436;_0xaf7598['push'](dbH['sequelize'][_0x5acb('0x2e')](util['format'](_0x5acb('0x2f'),QUERY,_0x344b31,_0x28b456),{'type':dbH[_0x5acb('0x2d')]['QueryTypes'][_0x5acb('0x30')]}));}}}else{_0xaf7598[_0x5acb('0x17')](dbH[_0x5acb('0x2d')][_0x5acb('0x2e')](QUERY,{'type':dbH['sequelize'][_0x5acb('0x31')][_0x5acb('0x30')]}));}var _0x590f2f=path[_0x5acb('0x32')](PATH);var _0x5d7c61=path[_0x5acb('0x33')](PATH,_0x5acb('0x34'));var _0xed4a6a=_0x405831[_0x5acb('0x29')]&&_0xaf7598[_0x5acb('0x15')]>0x1;var _0x4b1d01=[];if(!fs[_0x5acb('0x35')](path['join'](_0x590f2f,_0x5d7c61))&&_0xed4a6a){fs[_0x5acb('0x36')](path['join'](_0x590f2f,_0x5d7c61));}return BPromise['each'](_0xaf7598,function(_0x4d8c0d){_0x4b1d01[_0x5acb('0x17')](_0x4d8c0d);})[_0x5acb('0x2b')](function(){var _0x47c991=[];for(var _0x5e8009=0x0;_0x5e8009<_0x4b1d01[_0x5acb('0x15')];_0x5e8009+=0x1){var _0x50406a=_0x4b1d01[_0x5e8009];var _0x51fc41=createTables(_['flatten'](_0x50406a));var _0x2cee76;var _0x3deaa1=getPDFDocDefinition(_0x51fc41);var _0xbaef4e=getPDFPrinter();var _0x41b916=_0xbaef4e[_0x5acb('0x37')](_0x3deaa1);if(_0xed4a6a){_0x2cee76=path['join'](_0x590f2f,_0x5d7c61,util[_0x5acb('0x1b')](_0x5acb('0x38'),_0x5d7c61,_0x5e8009,_0x5acb('0x39')));}else{_0x2cee76=path[_0x5acb('0x3a')](_0x590f2f,util[_0x5acb('0x1b')](_0x5acb('0x3b'),_0x5d7c61,_0x5acb('0x39')));}_0x47c991['push'](writePDFDocument(_0x41b916,_0x2cee76));}return Promise[_0x5acb('0x3c')](_0x47c991);})[_0x5acb('0x2b')](function(){if(_0xed4a6a){return new Promise(function(_0x2f24c3){zipdir(path['join'](_0x590f2f,_0x5d7c61),{'saveTo':path[_0x5acb('0x3a')](_0x590f2f,util[_0x5acb('0x1b')](_0x5acb('0x3b'),_0x5d7c61,_0x5acb('0x3d')))},function(){rimraf(path[_0x5acb('0x3a')](_0x590f2f,_0x5d7c61),function(){});_0x2f24c3(_0x5acb('0x3e'));});});}})[_0x5acb('0x2b')](function(){if(!_0xed4a6a)return;rimraf(path['join'](_0x590f2f,_0x5d7c61),function(){});})[_0x5acb('0x2b')](function(){logger[_0x5acb('0x3f')](util[_0x5acb('0x1b')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x5acb('0x40'),_0xed4a6a?util[_0x5acb('0x1b')]('%s.%s',_0x5d7c61,_0xed4a6a?'zip':_0x5acb('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x5acb('0x41'),EXTRACTED_REPORT_ID,_0x5acb('0x42')));return db['AnalyticExtractedReport'][_0x5acb('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5acb('0x2b')](function(_0x230f53){EXTRACTED_REPORT=_0x230f53;return dbH[_0x5acb('0x2d')][_0x5acb('0x2e')](util[_0x5acb('0x1b')](_0x5acb('0x44'),QUERY),{'type':dbH[_0x5acb('0x2d')][_0x5acb('0x31')]['SELECT']});})['then'](extractReport)[_0x5acb('0x45')](function(_0x1e3071){logger[_0x5acb('0x3f')](util[_0x5acb('0x1b')](_0x5acb('0x46'),EXTRACTED_REPORT_ID,_0x5acb('0x42')),util['inspect'](_0x1e3071,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5acb('0x47'));})[_0x5acb('0x48')](function(){process[_0x5acb('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x14d6e7=new PdfPrinter({'Arial':{'normal':__dirname+_0x5acb('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x5acb('0x4b')}});return _0x14d6e7;}function getPDFDocDefinitionFromHTML(_0x101f37,_0x8a4ca5){var _0x102dd5=util['format'](_0x5acb('0x4c'),_0x8a4ca5[_0x5acb('0x4d')],_0x8a4ca5[_0x5acb('0x4e')]);var _0x117593=moment()[_0x5acb('0x1b')](_0x5acb('0x4f'))[_0x5acb('0x12')]();var _0x37a1e9=htmlToPdfmake(_0x101f37,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37a1e9],'defaultStyle':{'font':_0x5acb('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5acb('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5acb('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x5acb('0x51'),'style':_0x5acb('0x52')}];},'footer':function(_0x3980c1,_0x5b9bee){return[{'text':util['format'](_0x5acb('0x53'),_0x102dd5,_0x3980c1,_0x5b9bee,_0x117593),'style':_0x5acb('0x23')}];}};}function writePDFDocument(_0x447ec3,_0x4e2af0){return new Promise(function(_0x224cd3,_0x390466){var _0x2407f4=_0x447ec3[_0x5acb('0x54')](fs['createWriteStream'](_0x4e2af0));_0x2407f4['on'](_0x5acb('0x55'),function(){_0x224cd3(_0x5acb('0x55'));});_0x2407f4['on'](_0x5acb('0x56'),function(_0x267e8e){_0x390466(_0x267e8e);});_0x447ec3[_0x5acb('0x57')]();});}exports['createPdfFromHTML']=function(_0x161ed2,_0x58c59a){var _0xb5b11e=getPDFPrinter();var _0x3dddd3=getPDFDocDefinitionFromHTML(_0x161ed2,_0x58c59a);var _0x209028=_0xb5b11e['createPdfKitDocument'](_0x3dddd3);return writePDFDocument(_0x209028,_0x58c59a['path'])['catch'](function(_0x15c08c){throw _0x15c08c;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0bb702a..f693433 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 _0xcd5e=['QueryTypes','SELECT','num','Empty','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize'];(function(_0x131700,_0x1f03b9){var _0x41beb7=function(_0x4d43fb){while(--_0x4d43fb){_0x131700['push'](_0x131700['shift']());}};_0x41beb7(++_0x1f03b9);}(_0xcd5e,0xb3));var _0xecd5=function(_0x2af9e0,_0x40bc78){_0x2af9e0=_0x2af9e0-0x0;var _0x36be95=_0xcd5e[_0x2af9e0];return _0x36be95;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xecd5('0x0'));var zipdir=require('zip-dir');var rimraf=require(_0xecd5('0x1'));var db=require('../../mysqldb')['db'];var dbH=require(_0xecd5('0x2'))[_0xecd5('0x3')];var logger=require(_0xecd5('0x4'))(_0xecd5('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0xecd5('0x6')][0x2]);var QUERY=process[_0xecd5('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x326d2d,_0x3ea98a){var _0x22f465={'status':_0x326d2d};var _0xe54b2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3ea98a){_0x22f465[_0xecd5('0x7')]=_0x3ea98a;}return db[_0xecd5('0x8')]['update'](_0x22f465,_0xe54b2c);}function main(){var _0x59e946=0x1388;var _0x3be1d6;logger[_0xecd5('0x9')](util[_0xecd5('0xa')](_0xecd5('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xecd5('0xc'),_0xecd5('0xd')]})[_0xecd5('0xe')](function(_0x15570d){if(_0x15570d){_0x3be1d6=_0x15570d;_0x59e946=_0x3be1d6[_0xecd5('0xd')]||0x1388;}})[_0xecd5('0xe')](function(){return dbH['sequelize']['query'](util['format'](_0xecd5('0xf'),QUERY),{'type':dbH[_0xecd5('0x10')][_0xecd5('0x11')][_0xecd5('0x12')]});})[_0xecd5('0xe')](function(_0x1e56e7){if(!_0x1e56e7[0x0][_0xecd5('0x13')]){return analyticExtractedReport(_0xecd5('0x14'));}var _0x1476a3=[];var _0x2619af=0x0;if(_0x3be1d6[_0xecd5('0xc')]){if(_0x1e56e7&&_0x1e56e7[_0xecd5('0x15')]){var _0x28657c=_[_0xecd5('0x16')](_0x1e56e7[0x0]['num']/_0x59e946);var _0x595d61=Number['isInteger'](_0x1e56e7[0x0][_0xecd5('0x13')]/_0x59e946)?_0x1e56e7[0x0][_0xecd5('0x13')]%_0x59e946:0x0;_0x28657c[_0xecd5('0x17')](function(_0x3ed019){if(_0x3ed019>0x0){_0x2619af+=_0x59e946;}_0x1476a3[_0xecd5('0x18')](dbH[_0xecd5('0x10')][_0xecd5('0x19')](util[_0xecd5('0xa')](_0xecd5('0x1a'),QUERY,_0x59e946,_0x2619af),{'type':dbH[_0xecd5('0x10')][_0xecd5('0x11')][_0xecd5('0x12')]}));});if(_0x595d61>0x0){_0x2619af+=_0x59e946;_0x1476a3['push'](dbH['sequelize'][_0xecd5('0x19')](util[_0xecd5('0xa')](_0xecd5('0x1a'),QUERY,_0x595d61,_0x2619af),{'type':dbH[_0xecd5('0x10')][_0xecd5('0x11')][_0xecd5('0x12')]}));}}}else{_0x1476a3['push'](dbH[_0xecd5('0x10')][_0xecd5('0x19')](QUERY,{'type':dbH[_0xecd5('0x10')][_0xecd5('0x11')][_0xecd5('0x12')]}));}var _0x2b8a92=path[_0xecd5('0x1b')](PATH);var _0x4d9bcd=path[_0xecd5('0x1c')](PATH,_0xecd5('0x1d'));var _0x1ea672=_0x3be1d6['split']&&_0x1476a3[_0xecd5('0x15')]>0x1;var _0x21d8f0=[];if(!fs[_0xecd5('0x1e')](path['join'](_0x2b8a92,_0x4d9bcd))&&_0x1ea672){fs[_0xecd5('0x1f')](path[_0xecd5('0x20')](_0x2b8a92,_0x4d9bcd));}return BPromise[_0xecd5('0x21')](_0x1476a3,function(_0x11c813){_0x21d8f0[_0xecd5('0x18')](_0x11c813);})[_0xecd5('0xe')](function(){for(var _0x19ea5b=0x0;_0x19ea5b<_0x21d8f0[_0xecd5('0x15')];_0x19ea5b+=0x1){var _0x848c93;var _0x2b23ef=_0x21d8f0[_0x19ea5b];if(_0x1ea672){_0x848c93=path[_0xecd5('0x20')](_0x2b8a92,_0x4d9bcd,util['format'](_0xecd5('0x22'),_0x4d9bcd,_0x19ea5b,_0xecd5('0x23')));}else{_0x848c93=path['join'](_0x2b8a92,util['format'](_0xecd5('0x24'),_0x4d9bcd,_0xecd5('0x23')));}fs[_0xecd5('0x25')](_0x848c93,json2xls(_0x2b23ef),_0xecd5('0x26'));}})[_0xecd5('0xe')](function(){if(_0x1ea672){return new Promise(function(_0x2ef427){zipdir(path[_0xecd5('0x20')](_0x2b8a92,_0x4d9bcd),{'saveTo':path['join'](_0x2b8a92,util[_0xecd5('0xa')](_0xecd5('0x24'),_0x4d9bcd,_0xecd5('0x27')))},function(_0x37b263,_0x1d8f2f){rimraf(path[_0xecd5('0x20')](_0x2b8a92,_0x4d9bcd),function(){});_0x2ef427(_0xecd5('0x28'));});});}})['then'](function(){logger[_0xecd5('0x9')](util[_0xecd5('0xa')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xecd5('0x29')));return analyticExtractedReport(_0xecd5('0x2a'),_0x1ea672?util[_0xecd5('0xa')]('%s.%s',_0x4d9bcd,_0x1ea672?'zip':_0xecd5('0x23')):null);});})[_0xecd5('0x2b')](function(_0x70e85e){logger[_0xecd5('0x9')](util[_0xecd5('0xa')](_0xecd5('0x2c'),EXTRACTED_REPORT_ID,_0xecd5('0x29')),util[_0xecd5('0x2d')](_0x70e85e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xecd5('0x2e'));})[_0xecd5('0x2f')](function(){process[_0xecd5('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xbced=['json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit'];(function(_0x40162a,_0x265b0c){var _0x488161=function(_0x9307e6){while(--_0x9307e6){_0x40162a['push'](_0x40162a['shift']());}};_0x488161(++_0x265b0c);}(_0xbced,0x1d6));var _0xdbce=function(_0x3846c7,_0x49d7d6){_0x3846c7=_0x3846c7-0x0;var _0x4c3c34=_0xbced[_0x3846c7];return _0x4c3c34;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0xdbce('0x0'));var BPromise=require(_0xdbce('0x1'));var zipdir=require(_0xdbce('0x2'));var rimraf=require(_0xdbce('0x3'));var db=require(_0xdbce('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xdbce('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xdbce('0x6')][0x2]);var QUERY=process[_0xdbce('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a24ad,_0x338ade){var _0x5cfef0={'status':_0x3a24ad};var _0x14d7e3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x338ade){_0x5cfef0[_0xdbce('0x7')]=_0x338ade;}return db[_0xdbce('0x8')][_0xdbce('0x9')](_0x5cfef0,_0x14d7e3);}function main(){var _0x232e64=0x1388;var _0xf11ad9;logger[_0xdbce('0xa')](util[_0xdbce('0xb')](_0xdbce('0xc'),EXTRACTED_REPORT_ID,_0xdbce('0xd')));return db[_0xdbce('0xe')][_0xdbce('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdbce('0x10'),_0xdbce('0x11')]})[_0xdbce('0x12')](function(_0x4dd76e){if(_0x4dd76e){_0xf11ad9=_0x4dd76e;_0x232e64=_0xf11ad9['splitSizeXlsx']||0x1388;}})[_0xdbce('0x12')](function(){return dbH[_0xdbce('0x13')][_0xdbce('0x14')](util[_0xdbce('0xb')](_0xdbce('0x15'),QUERY),{'type':dbH[_0xdbce('0x13')][_0xdbce('0x16')][_0xdbce('0x17')]});})[_0xdbce('0x12')](function(_0xbc16c0){if(!_0xbc16c0[0x0]['num']){return analyticExtractedReport('Empty');}var _0x2ec7ce=[];var _0x504e49=0x0;if(_0xf11ad9[_0xdbce('0x10')]){if(_0xbc16c0&&_0xbc16c0[_0xdbce('0x18')]){var _0x30f858=_['range'](_0xbc16c0[0x0][_0xdbce('0x19')]/_0x232e64);var _0x50b90a=Number[_0xdbce('0x1a')](_0xbc16c0[0x0][_0xdbce('0x19')]/_0x232e64)?_0xbc16c0[0x0]['num']%_0x232e64:0x0;_0x30f858['forEach'](function(_0x338ea1){if(_0x338ea1>0x0){_0x504e49+=_0x232e64;}_0x2ec7ce[_0xdbce('0x1b')](dbH[_0xdbce('0x13')][_0xdbce('0x14')](util['format'](_0xdbce('0x1c'),QUERY,_0x232e64,_0x504e49),{'type':dbH['sequelize'][_0xdbce('0x16')][_0xdbce('0x17')]}));});if(_0x50b90a>0x0){_0x504e49+=_0x232e64;_0x2ec7ce[_0xdbce('0x1b')](dbH[_0xdbce('0x13')][_0xdbce('0x14')](util[_0xdbce('0xb')](_0xdbce('0x1c'),QUERY,_0x50b90a,_0x504e49),{'type':dbH['sequelize'][_0xdbce('0x16')][_0xdbce('0x17')]}));}}}else{_0x2ec7ce['push'](dbH['sequelize']['query'](QUERY,{'type':dbH[_0xdbce('0x13')]['QueryTypes']['SELECT']}));}var _0x6d89b4=path[_0xdbce('0x1d')](PATH);var _0x46ef88=path[_0xdbce('0x1e')](PATH,'.xlsx');var _0x14807b=_0xf11ad9[_0xdbce('0x10')]&&_0x2ec7ce[_0xdbce('0x18')]>0x1;var _0x529498=[];if(!fs[_0xdbce('0x1f')](path[_0xdbce('0x20')](_0x6d89b4,_0x46ef88))&&_0x14807b){fs[_0xdbce('0x21')](path['join'](_0x6d89b4,_0x46ef88));}return BPromise[_0xdbce('0x22')](_0x2ec7ce,function(_0x22732a){_0x529498[_0xdbce('0x1b')](_0x22732a);})[_0xdbce('0x12')](function(){for(var _0x309ad6=0x0;_0x309ad6<_0x529498[_0xdbce('0x18')];_0x309ad6+=0x1){var _0x24466d;var _0x3fb750=_0x529498[_0x309ad6];if(_0x14807b){_0x24466d=path['join'](_0x6d89b4,_0x46ef88,util[_0xdbce('0xb')](_0xdbce('0x23'),_0x46ef88,_0x309ad6,_0xdbce('0x24')));}else{_0x24466d=path[_0xdbce('0x20')](_0x6d89b4,util[_0xdbce('0xb')](_0xdbce('0x25'),_0x46ef88,_0xdbce('0x24')));}fs[_0xdbce('0x26')](_0x24466d,json2xls(_0x3fb750),_0xdbce('0x27'));}})[_0xdbce('0x12')](function(){if(_0x14807b){return new Promise(function(_0x53cc25){zipdir(path[_0xdbce('0x20')](_0x6d89b4,_0x46ef88),{'saveTo':path['join'](_0x6d89b4,util[_0xdbce('0xb')]('%s.%s',_0x46ef88,_0xdbce('0x28')))},function(_0x9ca329,_0x483368){rimraf(path[_0xdbce('0x20')](_0x6d89b4,_0x46ef88),function(){});_0x53cc25(_0xdbce('0x29'));});});}})[_0xdbce('0x12')](function(){logger[_0xdbce('0xa')](util[_0xdbce('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdbce('0xd')));return analyticExtractedReport(_0xdbce('0x2a'),_0x14807b?util[_0xdbce('0xb')](_0xdbce('0x25'),_0x46ef88,_0x14807b?_0xdbce('0x28'):_0xdbce('0x24')):null);});})[_0xdbce('0x2b')](function(_0x512d22){logger[_0xdbce('0xa')](util[_0xdbce('0xb')](_0xdbce('0x2c'),EXTRACTED_REPORT_ID,_0xdbce('0xd')),util[_0xdbce('0x2d')](_0x512d22,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xdbce('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index a9102a8..1c4166c 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 _0x047f=['CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','intervals','models','VoiceExtension','findAll','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x047f,0x82));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf047('0x0'));function rewrite(_0x1990ec,_0x3943e1){var _0x3ffdca=this;return _0x1990ec['models']['Interval']['findAll']({'raw':!![]})['then'](function(_0x599cab){_0x3ffdca[_0xf047('0x1')]=_0x599cab;return _0x1990ec[_0xf047('0x2')][_0xf047('0x3')][_0xf047('0x4')]({'where':{'IntervalId':_0x3943e1[_0xf047('0x5')]},'raw':!![]});})[_0xf047('0x6')](function(_0x246c84){return _0x1990ec[_0xf047('0x2')][_0xf047('0x3')][_0xf047('0x4')]({'where':{'exten':{'$in':_[_0xf047('0x7')](_[_0xf047('0x8')](_0x246c84,_0xf047('0x9')))}},'order':[{'raw':_0xf047('0xa')}],'raw':!![]});})[_0xf047('0x6')](function(_0x40d6f5){var _0x2b2961=_[_0xf047('0xb')](_0x40d6f5,{'priority':'1'});var _0x1731dd=_[_0xf047('0xb')](_0x40d6f5,{'isApp':0x1});var _0x548835=_[_0xf047('0xc')](_0x1731dd,_0xf047('0x9'));var _0x54db82=[_0xf047('0xd'),_0xf047('0xe')];var _0x1d96e2=[];var _0xec3dc1=[];for(var _0x1e3fef in _0x548835){if(_0x548835[_0xf047('0xf')](_0x1e3fef)){_0x3ffdca[_0xf047('0x10')]=0x2;_0x3ffdca['extensions']=[];_0x3ffdca[_0xf047('0x11')]=_[_0xf047('0x12')](_0x2b2961,{'exten':_0x548835[_0x1e3fef][0x0]['exten']});_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':util[_0xf047('0x17')](_0xf047('0x18'),_0x548835[_0x1e3fef][0x0][_0xf047('0x15')]),'context':_0x548835[_0x1e3fef][0x0]['context'],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});if(_0x548835[_0x1e3fef][0x0][_0xf047('0x15')]===_0xf047('0x1a')){_0x3ffdca['extensions'][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x1b')+_0x548835[_0x1e3fef][0x0]['VoiceExtensionId'],'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});}else if(_0x548835[_0x1e3fef][0x0][_0xf047('0x15')]===_0xf047('0x1d')){if(_0x3ffdca[_0xf047('0x11')]){_0x3ffdca[_0xf047('0x13')]['push']({'type':_0x548835[_0x1e3fef][0x0]['type'],'app':_0xf047('0x16'),'appdata':_0xf047('0x1e')+(_0x3ffdca[_0xf047('0x11')][_0xf047('0x1f')]?_0xf047('0x20')+_0x3ffdca[_0xf047('0x11')][_0xf047('0x1f')]+'}':_0xf047('0x21')),'context':_0x548835[_0x1e3fef][0x0]['context'],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});}_0x3ffdca['extensions'][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x1b')+_0x548835[_0x1e3fef][0x0][_0xf047('0x19')],'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca['priority']++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});var _0x18401c=_0x3ffdca[_0xf047('0x10')]++;_0x3ffdca[_0xf047('0x13')]['push']({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':'ExecIf','appdata':_0xf047('0x22')+(_0x18401c+0x2)+_0xf047('0x23')+(_0x18401c+0x1)+')','context':_0x548835[_0x1e3fef][0x0]['context'],'exten':_0x548835[_0x1e3fef][0x0]['exten'],'priority':_0x18401c,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});if(_0x3ffdca['extension']){_0x3ffdca['extensions'][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0]['type'],'app':_0xf047('0x16'),'appdata':_0x3ffdca['extension'][_0xf047('0x1f')]?_0xf047('0x24')+_0x3ffdca[_0xf047('0x11')]['cutdigits']+'}':_0xf047('0x25'),'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca['priority']++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});}_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x26')+_0x548835[_0x1e3fef][0x0][_0xf047('0x19')],'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0]['exten'],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});if(_0x3ffdca['extension']&&_0x3ffdca[_0xf047('0x11')][_0xf047('0xf')](_0xf047('0x27'))&&_0x3ffdca[_0xf047('0x11')]['recordingFormat']!==_0xf047('0x28')){_0x3ffdca['extensions'][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x29'),'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});_0x3ffdca['extensions']['push']({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x2a')+_0x3ffdca[_0xf047('0x11')][_0xf047('0x27')]||'wav','context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});}}_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x2b'),'context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0]['type'],'app':_0xf047('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x548835[_0x1e3fef][0x0][_0xf047('0x1c')],'exten':_0x548835[_0x1e3fef][0x0]['exten'],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x2c'),'context':_0x548835[_0x1e3fef][0x0]['context'],'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'priority':_0x3ffdca[_0xf047('0x10')]++,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});for(var _0x4ba4ba=0x0,_0x37ce58=0x0;_0x4ba4ba<_0x548835[_0x1e3fef][_0xf047('0x2d')];_0x4ba4ba+=0x1,_0x37ce58=0x0){var _0x1f1499=_0x548835[_0x1e3fef][_0x4ba4ba];if(_0x1f1499[_0xf047('0x15')]){_0x1f1499['type']=_0x1f1499[_0xf047('0x15')][_0xf047('0x2e')]();}var _0xd71d19=[];var _0x3d690f=[];delete _0x1f1499['id'];delete _0x1f1499[_0xf047('0x2f')];delete _0x1f1499['updatedAt'];var _0x2b3b44=_0x1f1499[_0xf047('0x30')]!==_0xf047('0x31')?[_0x1f1499[_0xf047('0x30')]]:_0x1f1499['IntervalId']?_[_0xf047('0x8')](_[_0xf047('0xb')](_0x3ffdca['intervals'],{'IntervalId':_0x1f1499[_0xf047('0x5')]}),_0xf047('0x30')):[];if(_0x1f1499['hasOwnProperty'](_0xf047('0x32'))){if(_0x1f1499[_0xf047('0x32')]&&_0x1f1499[_0xf047('0x32')]!=='--'){_0xd71d19['push']({'type':_0x1f1499['type'],'app':_0xf047('0x16'),'appdata':_0xf047('0x33')+_0x1f1499[_0xf047('0x32')],'context':_0x1f1499[_0xf047('0x1c')],'exten':_0x1f1499[_0xf047('0x9')],'priority':_0x2b3b44[_0xf047('0x2d')]+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});}}if(_0x1f1499[_0xf047('0x15')]===_0xf047('0x1d')&&_0x1f1499['hasOwnProperty']('callerID')){if(_0x1f1499[_0xf047('0x34')]){_0xd71d19[_0xf047('0x14')]({'type':_0x1f1499[_0xf047('0x15')],'app':_0xf047('0x35'),'appdata':_0xf047('0x36')+_0x1f1499[_0xf047('0x34')]+')','context':_0x1f1499[_0xf047('0x1c')],'exten':_0x1f1499['exten'],'priority':_0x2b3b44[_0xf047('0x2d')]+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});}else{_0xd71d19[_0xf047('0x14')]({'type':_0x1f1499[_0xf047('0x15')],'app':_0xf047('0x35'),'appdata':_0xf047('0x37'),'context':_0x1f1499['context'],'exten':_0x1f1499[_0xf047('0x9')],'priority':_0x2b3b44['length']+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499['VoiceExtensionId']});}}if(_0x1f1499['hasOwnProperty'](_0xf047('0x38'))){if(_0x54db82[_0xf047('0x39')](_0x1f1499[_0xf047('0x3a')][_0xf047('0x2e')]())>=0x0&&_0x1f1499[_0xf047('0x3b')]!==_0xf047('0x3c')){if(_0x1f1499[_0xf047('0x38')]){_0xd71d19[_0xf047('0x14')]({'type':_0x1f1499['type'],'app':'ExecIf','appdata':_0xf047('0x3d'),'context':_0x1f1499[_0xf047('0x1c')],'exten':_0x1f1499['exten'],'priority':_0x2b3b44[_0xf047('0x2d')]+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});_0xd71d19['push']({'type':_0x1f1499[_0xf047('0x15')],'app':_0xf047('0x16'),'appdata':_0xf047('0x3e'),'context':_0x1f1499[_0xf047('0x1c')],'exten':_0x1f1499[_0xf047('0x9')],'priority':_0x2b3b44[_0xf047('0x2d')]+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});}else{_0xd71d19['push']({'type':_0x1f1499[_0xf047('0x15')],'app':'ExecIf','appdata':_0xf047('0x3f'),'context':_0x1f1499['context'],'exten':_0x1f1499[_0xf047('0x9')],'priority':_0x2b3b44['length']+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});_0xd71d19[_0xf047('0x14')]({'type':_0x1f1499['type'],'app':_0xf047('0x16'),'appdata':_0xf047('0x40'),'context':_0x1f1499[_0xf047('0x1c')],'exten':_0x1f1499[_0xf047('0x9')],'priority':_0x2b3b44[_0xf047('0x2d')]+_0x3ffdca[_0xf047('0x10')]+_0x37ce58++,'VoiceExtensionId':_0x1f1499[_0xf047('0x19')]});}}}for(var _0x3400cf=0x0;_0x3400cf<_0x2b3b44['length'];_0x3400cf+=0x1){var _0x4ec6bf=_0x3ffdca[_0xf047('0x10')]+_0x2b3b44['length'];var _0x186267=_0x3400cf===_0x2b3b44[_0xf047('0x2d')]-0x1?_0x3ffdca[_0xf047('0x10')]+_0xd71d19[_0xf047('0x2d')]+_0x3d690f['length']+0x2:_0x3ffdca[_0xf047('0x10')]+_0x3400cf+0x1;_0xd71d19[_0xf047('0x41')](_0x3400cf,0x0,{'type':_0x1f1499[_0xf047('0x15')],'app':'GotoIfTime','appdata':_0x2b3b44[_0x3400cf]+'?'+_0x1f1499[_0xf047('0x1c')]+',${EXTEN},'+_0x4ec6bf+':'+_0x1f1499['context']+_0xf047('0x42')+_0x186267,'exten':_0x1f1499[_0xf047('0x9')],'context':_0x1f1499['context'],'priority':_0x3ffdca['priority']+_0x3400cf,'VoiceExtensionId':_0x548835[_0x1e3fef][0x0]['VoiceExtensionId']});}_0x1f1499[_0xf047('0x10')]=_0xd71d19[_0xf047('0x2d')]?_[_0xf047('0x43')](_0xd71d19)['priority']+0x1:_0x3ffdca['priority'];_0x3ffdca['priority']=(_0x3d690f[_0xf047('0x2d')]?_[_0xf047('0x43')](_0x3d690f)[_0xf047('0x10')]:_0x1f1499['priority'])+0x1;_0x3ffdca[_0xf047('0x13')]=_[_0xf047('0x44')](_0x3ffdca[_0xf047('0x13')],_0xd71d19,[_0x1f1499],_0x3d690f);}_0x3ffdca[_0xf047('0x13')][_0xf047('0x14')]({'type':_0x548835[_0x1e3fef][0x0][_0xf047('0x15')],'app':_0xf047('0x45'),'exten':_0x548835[_0x1e3fef][0x0][_0xf047('0x9')],'context':_0x548835[_0x1e3fef][0x0]['context'],'priority':_0x3ffdca['priority'],'VoiceExtensionId':_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]});_0x1d96e2['push'](_0x548835[_0x1e3fef][0x0][_0xf047('0x19')]);_0xec3dc1=_[_0xf047('0x44')](_0xec3dc1,_0x3ffdca[_0xf047('0x13')]);}}return _0x1990ec[_0xf047('0x46')](function(_0x43e86a){return _0x1990ec['models'][_0xf047('0x3')][_0xf047('0x47')]({'where':{'VoiceExtensionId':{'$in':_0x1d96e2}},'transaction':_0x43e86a})['then'](function(_0x493743){return _0x1990ec['models'][_0xf047('0x3')][_0xf047('0x48')](_[_0xf047('0x49')](_0xec3dc1,_0xf047('0x10')),{'transaction':_0x43e86a});});});})[_0xf047('0x4a')](function(_0x489f82){console[_0xf047('0x4b')](_0x489f82);});}exports[_0xf047('0x4c')]=rewrite; \ No newline at end of file +var _0x8056=['_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','util','Interval','findAll','models','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x8056,0x18e));var _0x6805=function(_0x193551,_0x29ab95){_0x193551=_0x193551-0x0;var _0x188c8f=_0x8056[_0x193551];return _0x188c8f;};'use strict';var _=require('lodash');var util=require(_0x6805('0x0'));function rewrite(_0x4bd8d1,_0x25d500){var _0xaf4edd=this;return _0x4bd8d1['models'][_0x6805('0x1')][_0x6805('0x2')]({'raw':!![]})['then'](function(_0x350c49){_0xaf4edd['intervals']=_0x350c49;return _0x4bd8d1[_0x6805('0x3')][_0x6805('0x4')][_0x6805('0x2')]({'where':{'IntervalId':_0x25d500[_0x6805('0x5')]},'raw':!![]});})[_0x6805('0x6')](function(_0x3aac13){return _0x4bd8d1[_0x6805('0x3')][_0x6805('0x4')][_0x6805('0x2')]({'where':{'exten':{'$in':_[_0x6805('0x7')](_[_0x6805('0x8')](_0x3aac13,_0x6805('0x9')))}},'order':[{'raw':_0x6805('0xa')}],'raw':!![]});})[_0x6805('0x6')](function(_0x5d8b5e){var _0xf5634c=_[_0x6805('0xb')](_0x5d8b5e,{'priority':'1'});var _0x56cef7=_[_0x6805('0xb')](_0x5d8b5e,{'isApp':0x1});var _0x5517c1=_[_0x6805('0xc')](_0x56cef7,_0x6805('0x9'));var _0x5a57d6=[_0x6805('0xd'),_0x6805('0xe')];var _0x1f50c0=[];var _0x34ab43=[];for(var _0x413352 in _0x5517c1){if(_0x5517c1['hasOwnProperty'](_0x413352)){_0xaf4edd[_0x6805('0xf')]=0x2;_0xaf4edd['extensions']=[];_0xaf4edd[_0x6805('0x10')]=_[_0x6805('0x11')](_0xf5634c,{'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')]});_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':util[_0x6805('0x16')](_0x6805('0x17'),_0x5517c1[_0x413352][0x0][_0x6805('0x14')]),'context':_0x5517c1[_0x413352][0x0]['context'],'exten':_0x5517c1[_0x413352][0x0]['exten'],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});if(_0x5517c1[_0x413352][0x0][_0x6805('0x14')]===_0x6805('0x19')){_0xaf4edd['extensions'][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':'Set','appdata':_0x6805('0x1a')+_0x5517c1[_0x413352][0x0][_0x6805('0x18')],'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd['priority']++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});}else if(_0x5517c1[_0x413352][0x0][_0x6805('0x14')]===_0x6805('0x1c')){if(_0xaf4edd[_0x6805('0x10')]){_0xaf4edd['extensions'][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':_0x6805('0x1d')+(_0xaf4edd['extension']['cutdigits']?_0x6805('0x1e')+_0xaf4edd[_0x6805('0x10')][_0x6805('0x1f')]+'}':_0x6805('0x20')),'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd['priority']++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});}_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':'CDR(routeid)='+_0x5517c1[_0x413352][0x0]['VoiceExtensionId'],'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd['priority']++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});var _0x2003ec=_0xaf4edd['priority']++;_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2003ec+0x2)+'):Goto('+(_0x2003ec+0x1)+')','context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0x2003ec,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});if(_0xaf4edd[_0x6805('0x10')]){_0xaf4edd['extensions'][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':_0xaf4edd['extension'][_0x6805('0x1f')]?_0x6805('0x22')+_0xaf4edd[_0x6805('0x10')]['cutdigits']+'}':_0x6805('0x23'),'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});}_0xaf4edd['extensions']['push']({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':'Set','appdata':_0x6805('0x24')+_0x5517c1[_0x413352][0x0][_0x6805('0x18')],'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd['priority']++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});if(_0xaf4edd[_0x6805('0x10')]&&_0xaf4edd[_0x6805('0x10')][_0x6805('0x25')](_0x6805('0x26'))&&_0xaf4edd['extension'][_0x6805('0x26')]!==_0x6805('0x27')){_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':_0x6805('0x28'),'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0]['VoiceExtensionId']});_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xaf4edd[_0x6805('0x10')]['recordingFormat']||'wav','context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0]['exten'],'priority':_0xaf4edd['priority']++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});}}_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':_0x6805('0x29'),'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x5517c1[_0x413352][0x0]['context'],'exten':_0x5517c1[_0x413352][0x0]['exten'],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});_0xaf4edd[_0x6805('0x12')][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':_0x6805('0x2a'),'context':_0x5517c1[_0x413352][0x0][_0x6805('0x1b')],'exten':_0x5517c1[_0x413352][0x0]['exten'],'priority':_0xaf4edd[_0x6805('0xf')]++,'VoiceExtensionId':_0x5517c1[_0x413352][0x0]['VoiceExtensionId']});for(var _0xb7dafb=0x0,_0x23fc37=0x0;_0xb7dafb<_0x5517c1[_0x413352][_0x6805('0x2b')];_0xb7dafb+=0x1,_0x23fc37=0x0){var _0x5e37b8=_0x5517c1[_0x413352][_0xb7dafb];if(_0x5e37b8[_0x6805('0x14')]){_0x5e37b8['type']=_0x5e37b8[_0x6805('0x14')][_0x6805('0x2c')]();}var _0x2e8681=[];var _0x324f43=[];delete _0x5e37b8['id'];delete _0x5e37b8[_0x6805('0x2d')];delete _0x5e37b8[_0x6805('0x2e')];var _0x4f3a77=_0x5e37b8[_0x6805('0x2f')]!==_0x6805('0x30')?[_0x5e37b8[_0x6805('0x2f')]]:_0x5e37b8[_0x6805('0x5')]?_[_0x6805('0x8')](_[_0x6805('0xb')](_0xaf4edd[_0x6805('0x31')],{'IntervalId':_0x5e37b8[_0x6805('0x5')]}),'interval'):[];if(_0x5e37b8[_0x6805('0x25')](_0x6805('0x32'))){if(_0x5e37b8[_0x6805('0x32')]&&_0x5e37b8[_0x6805('0x32')]!=='--'){_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8[_0x6805('0x14')],'app':_0x6805('0x15'),'appdata':'CDR(tag)='+_0x5e37b8[_0x6805('0x32')],'context':_0x5e37b8[_0x6805('0x1b')],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});}}if(_0x5e37b8[_0x6805('0x14')]==='outbound'&&_0x5e37b8[_0x6805('0x25')](_0x6805('0x33'))){if(_0x5e37b8['callerID']){_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8['type'],'app':_0x6805('0x21'),'appdata':_0x6805('0x34')+_0x5e37b8[_0x6805('0x33')]+')','context':_0x5e37b8[_0x6805('0x1b')],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});}else{_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8[_0x6805('0x14')],'app':_0x6805('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5e37b8['context'],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});}}if(_0x5e37b8[_0x6805('0x25')](_0x6805('0x35'))){if(_0x5a57d6['indexOf'](_0x5e37b8[_0x6805('0x36')][_0x6805('0x2c')]())>=0x0&&_0x5e37b8[_0x6805('0x37')]!==_0x6805('0x38')){if(_0x5e37b8[_0x6805('0x35')]){_0x2e8681['push']({'type':_0x5e37b8[_0x6805('0x14')],'app':_0x6805('0x21'),'appdata':_0x6805('0x39'),'context':_0x5e37b8[_0x6805('0x1b')],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8[_0x6805('0x14')],'app':'Set','appdata':_0x6805('0x3a'),'context':_0x5e37b8['context'],'exten':_0x5e37b8['exten'],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});}else{_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8[_0x6805('0x14')],'app':_0x6805('0x21'),'appdata':_0x6805('0x3b'),'context':_0x5e37b8[_0x6805('0x1b')],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd[_0x6805('0xf')]+_0x23fc37++,'VoiceExtensionId':_0x5e37b8[_0x6805('0x18')]});_0x2e8681[_0x6805('0x13')]({'type':_0x5e37b8['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5e37b8[_0x6805('0x1b')],'exten':_0x5e37b8[_0x6805('0x9')],'priority':_0x4f3a77[_0x6805('0x2b')]+_0xaf4edd['priority']+_0x23fc37++,'VoiceExtensionId':_0x5e37b8['VoiceExtensionId']});}}}for(var _0x54046d=0x0;_0x54046d<_0x4f3a77[_0x6805('0x2b')];_0x54046d+=0x1){var _0x50afc2=_0xaf4edd[_0x6805('0xf')]+_0x4f3a77['length'];var _0x207bae=_0x54046d===_0x4f3a77[_0x6805('0x2b')]-0x1?_0xaf4edd[_0x6805('0xf')]+_0x2e8681[_0x6805('0x2b')]+_0x324f43[_0x6805('0x2b')]+0x2:_0xaf4edd[_0x6805('0xf')]+_0x54046d+0x1;_0x2e8681[_0x6805('0x3c')](_0x54046d,0x0,{'type':_0x5e37b8[_0x6805('0x14')],'app':_0x6805('0x3d'),'appdata':_0x4f3a77[_0x54046d]+'?'+_0x5e37b8['context']+_0x6805('0x3e')+_0x50afc2+':'+_0x5e37b8[_0x6805('0x1b')]+_0x6805('0x3e')+_0x207bae,'exten':_0x5e37b8[_0x6805('0x9')],'context':_0x5e37b8[_0x6805('0x1b')],'priority':_0xaf4edd[_0x6805('0xf')]+_0x54046d,'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});}_0x5e37b8['priority']=_0x2e8681[_0x6805('0x2b')]?_['last'](_0x2e8681)['priority']+0x1:_0xaf4edd['priority'];_0xaf4edd[_0x6805('0xf')]=(_0x324f43['length']?_[_0x6805('0x3f')](_0x324f43)[_0x6805('0xf')]:_0x5e37b8['priority'])+0x1;_0xaf4edd[_0x6805('0x12')]=_['concat'](_0xaf4edd[_0x6805('0x12')],_0x2e8681,[_0x5e37b8],_0x324f43);}_0xaf4edd['extensions'][_0x6805('0x13')]({'type':_0x5517c1[_0x413352][0x0][_0x6805('0x14')],'app':_0x6805('0x40'),'exten':_0x5517c1[_0x413352][0x0][_0x6805('0x9')],'context':_0x5517c1[_0x413352][0x0]['context'],'priority':_0xaf4edd[_0x6805('0xf')],'VoiceExtensionId':_0x5517c1[_0x413352][0x0][_0x6805('0x18')]});_0x1f50c0[_0x6805('0x13')](_0x5517c1[_0x413352][0x0][_0x6805('0x18')]);_0x34ab43=_[_0x6805('0x41')](_0x34ab43,_0xaf4edd[_0x6805('0x12')]);}}return _0x4bd8d1[_0x6805('0x42')](function(_0x51bc88){return _0x4bd8d1[_0x6805('0x3')][_0x6805('0x4')][_0x6805('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x1f50c0}},'transaction':_0x51bc88})['then'](function(_0x3a4d3c){return _0x4bd8d1[_0x6805('0x3')][_0x6805('0x4')][_0x6805('0x44')](_[_0x6805('0x45')](_0x34ab43,_0x6805('0xf')),{'transaction':_0x51bc88});});});})[_0x6805('0x46')](function(_0x11c968){console[_0x6805('0x47')](_0x11c968);});}exports[_0x6805('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2c8d063..a4f4a7a 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 _0x9f65=['onlyIfOpen','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','exit','info','CSV\x20import\x20process\x20stopped!','split','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../config/logger','redis','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','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\x20Contact','CmContact','create','keys','then','push','pick','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','createdAt','select','field','NOW()','ContactId','updatedAt','from','where','deletedAt\x20IS\x20NULL','toString','cm_hopper','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','scheduledAt','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','always','sequelize','query','VoiceQueueId','catch'];(function(_0x4a9ed8,_0x5bc715){var _0xb01dc1=function(_0x3b5db1){while(--_0x3b5db1){_0x4a9ed8['push'](_0x4a9ed8['shift']());}};_0xb01dc1(++_0x5bc715);}(_0x9f65,0xf1));var _0x59f6=function(_0x2cb7ef,_0x4dd339){_0x2cb7ef=_0x2cb7ef-0x0;var _0x5ce2e6=_0x9f65[_0x2cb7ef];return _0x5ce2e6;};'use strict';var BPromise=require(_0x59f6('0x0'));var util=require('util');var _=require(_0x59f6('0x1'));var fs=require('fs');var squel=require(_0x59f6('0x2'));var Papa=require(_0x59f6('0x3'));var Redis=require(_0x59f6('0x4'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0x59f6('0x5'))('api');config[_0x59f6('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x59f6('0x7'))(new Redis(config[_0x59f6('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x59f6('0x8')](socket);try{if(!process['argv'][0x2]||process[_0x59f6('0x9')][0x2]===_0x59f6('0xa')||process[_0x59f6('0x9')][0x2]==='null'){throw new Error(_0x59f6('0xb'));}var FILEPATH=process[_0x59f6('0x9')][0x2];if(!process[_0x59f6('0x9')][0x3]||process[_0x59f6('0x9')][0x3]===_0x59f6('0xa')||process[_0x59f6('0x9')][0x3]===_0x59f6('0xc')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0x59f6('0x9')][0x4]===_0x59f6('0xc')){throw new Error(_0x59f6('0xd'));}var FIELDS=_[_0x59f6('0xe')](process[_0x59f6('0x9')][0x3]['split'](','),process['argv'][0x4]['split'](','));if(!process[_0x59f6('0x9')][0x5]||process[_0x59f6('0x9')][0x5]===_0x59f6('0xa')||process['argv'][0x5]===_0x59f6('0xc')){throw new Error(_0x59f6('0xf'));}var LISTID=process['argv'][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x59f6('0x9')][0x6]!==_0x59f6('0xa')&&process['argv'][0x6]!==_0x59f6('0xc')?process[_0x59f6('0x9')][0x6]:null;var DUPLICATES=process[_0x59f6('0x9')][0x7]&&process[_0x59f6('0x9')][0x7]!==_0x59f6('0xa')&&process[_0x59f6('0x9')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x59f6('0x9')][0x8]||process[_0x59f6('0x9')][0x8]==='undefined'||process['argv'][0x8]==='null'){throw new Error(_0x59f6('0x10'));}var SOCKET_TIMESTAMP=process[_0x59f6('0x9')][0x8];}catch(_0x5ea17b){logger[_0x59f6('0x11')](_0x5ea17b);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(_0x9a9c57,_0x5468c0,_0x488e49,_0x330815){var _0xaf0350={'message':_0x5468c0};_0xaf0350[_0x9a9c57]=!![];if(_0x488e49){_0xaf0350[_0x59f6('0x12')]=_0x488e49;}if(_0x330815){_0xaf0350['index']=_0x330815;}return _0xaf0350;}function isEmail(_0x15e38){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'](_0x15e38);}function checkRow(_0x17bf82,_0x298c65,_0x3b0460){return new BPromise(function(_0x2dad7f,_0x5e56f3){if(_[_0x59f6('0x13')](_0x17bf82)){return _0x5e56f3(handleCheckRowError('error',_0x59f6('0x14'),null,_0x3b0460));}if(_0x17bf82[_0x59f6('0x15')]&&_0x17bf82[_0x59f6('0x15')][_0x59f6('0x16')]){var _0x4fe7d1=_['map'](_0x17bf82[_0x59f6('0x15')],_0x59f6('0x17'))['join'](';');return _0x5e56f3(handleCheckRowError('error',_0x4fe7d1,null,_0x3b0460));}var _0x2ae3b0={};for(var _0x253a2c in FIELDS){if(FIELDS[_0x59f6('0x18')](_0x253a2c)&&FIELDS[_0x253a2c]){_0x2ae3b0[_0x253a2c]=_0x17bf82[_0x59f6('0x19')][0x0][FIELDS[_0x253a2c]]||_0x17bf82['data'][0x0]['\ufeff'+FIELDS[_0x253a2c]];}}if(!_0x2ae3b0['firstName']){return _0x5e56f3(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x3b0460));}if(!_0x2ae3b0[_0x59f6('0x1a')]){return _0x5e56f3(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x3b0460));}if(_0x2ae3b0[_0x59f6('0x1b')]){var _0x27ad45=moment(_0x2ae3b0[_0x59f6('0x1b')],_0x59f6('0x1c'));if(!_0x27ad45[_0x59f6('0x1d')]()){return _0x5e56f3(handleCheckRowError(_0x59f6('0x11'),_0x59f6('0x1e'),null,_0x3b0460));}}if(_0x2ae3b0[_0x59f6('0x1f')]){if(!isEmail(_0x2ae3b0[_0x59f6('0x1f')])){return _0x5e56f3(handleCheckRowError(_0x59f6('0x11'),_0x59f6('0x20'),null,_0x3b0460));}}_0x2ae3b0[_0x59f6('0x21')]=LISTID;_0x2ae3b0[_0x59f6('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x59f6('0x16')]&&_0x298c65){var _0x46aad1={};for(var _0x4256f0=0x0,_0x1f60c7=DUPLICATES[_0x59f6('0x16')];_0x4256f0<_0x1f60c7;_0x4256f0+=0x1){_0x46aad1[DUPLICATES[_0x4256f0]]=_0x2ae3b0[DUPLICATES[_0x4256f0]];}var _0xbedc8a=_[_0x59f6('0x23')](_0x298c65,_0x46aad1);if(_0xbedc8a){return _0x5e56f3(handleCheckRowError('duplicate',_0x59f6('0x24'),_0xbedc8a,_0x3b0460));}}return db[_0x59f6('0x25')][_0x59f6('0x26')](_0x2ae3b0,{'raw':!![],'hooks':![],'fields':_[_0x59f6('0x27')](_0x2ae3b0)})[_0x59f6('0x28')](function(_0x1c5e13){if(DUPLICATES&&DUPLICATES[_0x59f6('0x16')]&&_0x298c65){_0x298c65[_0x59f6('0x29')](_[_0x59f6('0x2a')](_0x2ae3b0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1c5e13['id'];return _0x2dad7f();})['catch'](function(_0x207597){return _0x5e56f3(handleCheckRowError(_0x59f6('0x11'),'Error\x20while\x20creating\x20contact:\x20'+(_0x207597[_0x59f6('0x17')]||JSON[_0x59f6('0x2b')](_0x207597)),null,_0x3b0460));});});}function checkHopper(){function _0x5c400f(){return function(_0x16261b){logger[_0x59f6('0x11')](_0x59f6('0x2c'),_0x59f6('0x2d'),util[_0x59f6('0x2e')](_0x16261b,{'showHidden':![],'depth':null}));};}var _0x4a978a=function(_0x3690ac,_0x4bcf26){var _0x56cbc3=squel[_0x59f6('0x2f')]()[_0x59f6('0x30')]('cm_hopper')[_0x59f6('0x31')](['phone','scheduledAt','ContactId',_0x59f6('0x21'),_0x4bcf26,_0x59f6('0x32'),'updatedAt'],squel[_0x59f6('0x33')]()[_0x59f6('0x34')]('phone',_0x59f6('0x1a'))[_0x59f6('0x34')](_0x59f6('0x35'),'scheduledAt')[_0x59f6('0x34')]('id',_0x59f6('0x36'))['field'](LISTID['toString'](),_0x59f6('0x21'))['field'](_0x3690ac['id']['toString'](),_0x4bcf26)['field']('NOW()',_0x59f6('0x32'))[_0x59f6('0x34')]('NOW()',_0x59f6('0x37'))[_0x59f6('0x38')]('cm_contacts')[_0x59f6('0x39')](_0x59f6('0x3a'))[_0x59f6('0x39')]('ListId\x20=\x20?',LISTID[_0x59f6('0x3b')]())[_0x59f6('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x59f6('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x59f6('0x33')]()[_0x59f6('0x34')](_0x59f6('0x1a'))[_0x59f6('0x38')](_0x59f6('0x3c'))[_0x59f6('0x39')](_0x4bcf26+'\x20=\x20?',_0x3690ac['id'][_0x59f6('0x3b')]())))[_0x59f6('0x3b')]();return _0x56cbc3;};var _0x133379=function(_0x5a98da,_0x434e45){var _0x42c01e=squel['insert']()['into'](_0x59f6('0x3c'))[_0x59f6('0x31')]([_0x59f6('0x1a'),'scheduledAt',_0x59f6('0x36'),_0x59f6('0x21'),_0x434e45,_0x59f6('0x32'),'updatedAt'],squel['select']()[_0x59f6('0x34')](_0x59f6('0x1a'),_0x59f6('0x1a'))['field'](_0x59f6('0x35'),'scheduledAt')['field']('id',_0x59f6('0x36'))['field'](LISTID[_0x59f6('0x3b')](),_0x59f6('0x21'))[_0x59f6('0x34')](_0x5a98da['id'][_0x59f6('0x3b')](),_0x434e45)['field']('NOW()',_0x59f6('0x32'))[_0x59f6('0x34')](_0x59f6('0x35'),_0x59f6('0x37'))['from'](_0x59f6('0x3d'))['where'](_0x59f6('0x3a'))['where'](_0x59f6('0x3e'),LISTID[_0x59f6('0x3b')]())['where'](_0x59f6('0x3f'),squel[_0x59f6('0x40')](hopperContacts))[_0x59f6('0x39')](_0x59f6('0x41'))[_0x59f6('0x39')](_0x59f6('0x42'),squel[_0x59f6('0x33')]()[_0x59f6('0x34')](_0x59f6('0x43'))['from'](_0x59f6('0x44'))[_0x59f6('0x39')](_0x434e45+_0x59f6('0x45'),_0x5a98da['id'][_0x59f6('0x3b')]()))['where'](_0x59f6('0x42'),squel[_0x59f6('0x33')]()[_0x59f6('0x34')](_0x59f6('0x1a'))['from'](_0x59f6('0x3c'))['where'](_0x434e45+_0x59f6('0x45'),_0x5a98da['id']['toString']())))[_0x59f6('0x3b')]();return _0x42c01e;};function _0x518128(_0x1f440b,_0x2389b7){var _0x1acec6=squel[_0x59f6('0x2f')]()[_0x59f6('0x30')](_0x59f6('0x3c'))[_0x59f6('0x31')]([_0x59f6('0x1a'),_0x59f6('0x46'),_0x59f6('0x36'),'ListId',_0x2389b7,_0x59f6('0x32'),_0x59f6('0x37')],squel[_0x59f6('0x33')]()['field']('phone',_0x59f6('0x1a'))[_0x59f6('0x34')](_0x59f6('0x35'),'scheduledAt')['field']('id',_0x59f6('0x36'))[_0x59f6('0x34')](LISTID['toString'](),'ListId')[_0x59f6('0x34')](_0x1f440b['id'][_0x59f6('0x3b')](),_0x2389b7)[_0x59f6('0x34')]('NOW()',_0x59f6('0x32'))[_0x59f6('0x34')](_0x59f6('0x35'),_0x59f6('0x37'))[_0x59f6('0x38')](_0x59f6('0x3d'))[_0x59f6('0x39')](_0x59f6('0x3a'))['where'](_0x59f6('0x3e'),LISTID[_0x59f6('0x3b')]())[_0x59f6('0x39')](_0x59f6('0x3f'),squel[_0x59f6('0x40')](hopperContacts))[_0x59f6('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x59f6('0x3b')]();return _0x1acec6;}function _0x1b976a(_0x2f6b4c,_0x3d71d0){var _0x536873=squel[_0x59f6('0x2f')]()[_0x59f6('0x30')](_0x59f6('0x47'))[_0x59f6('0x31')]([_0x59f6('0x1a'),_0x59f6('0x36'),_0x59f6('0x21'),_0x3d71d0,_0x59f6('0x32'),_0x59f6('0x37')],squel['select']()['field'](_0x59f6('0x1a'),_0x59f6('0x1a'))['field']('id',_0x59f6('0x36'))[_0x59f6('0x34')](LISTID['toString'](),_0x59f6('0x21'))[_0x59f6('0x34')](_0x2f6b4c['id']['toString'](),_0x3d71d0)[_0x59f6('0x34')](_0x59f6('0x35'),_0x59f6('0x32'))[_0x59f6('0x34')]('NOW()',_0x59f6('0x37'))[_0x59f6('0x38')](_0x59f6('0x3d'))['where'](_0x59f6('0x3a'))[_0x59f6('0x39')](_0x59f6('0x3e'),LISTID[_0x59f6('0x3b')]())[_0x59f6('0x39')](_0x59f6('0x3f'),squel['str'](hopperContacts))[_0x59f6('0x39')](_0x59f6('0x41')))[_0x59f6('0x3b')]();return _0x536873;}return db[_0x59f6('0x48')][_0x59f6('0x49')]({'where':{'type':_0x59f6('0x4a')},'attributes':['id',_0x59f6('0x4b')],'include':[{'model':db['CmList'],'as':_0x59f6('0x4c'),'where':{'id':LISTID}}]})[_0x59f6('0x28')](function(_0x2599bb){var _0x4c4b33=[];if(_0x2599bb){var _0x11da7e;for(var _0x49fb35=0x0,_0x3fdcba;_0x49fb35<_0x2599bb[_0x59f6('0x16')];_0x49fb35+=0x1){_0x3fdcba=_0x2599bb[_0x49fb35][_0x59f6('0x4d')]({'plain':!![]});switch(_0x3fdcba[_0x59f6('0x4b')]){case _0x59f6('0x4e'):_0x4c4b33[_0x59f6('0x29')](db[_0x59f6('0x4f')][_0x59f6('0x50')](_0x133379(_0x3fdcba,_0x59f6('0x51')))[_0x59f6('0x28')](function(){})[_0x59f6('0x52')](_0x5c400f()));break;case _0x59f6('0x53'):_0x4c4b33[_0x59f6('0x29')](db['sequelize'][_0x59f6('0x50')](_0x4a978a(_0x3fdcba,_0x59f6('0x51')))[_0x59f6('0x28')](function(){})['catch'](_0x5c400f()));break;default:_0x4c4b33[_0x59f6('0x29')](db[_0x59f6('0x4f')][_0x59f6('0x50')](_0x518128(_0x3fdcba,_0x59f6('0x51')))[_0x59f6('0x28')](function(){})['catch'](_0x5c400f()));}}}return _0x4c4b33;})[_0x59f6('0x54')]()[_0x59f6('0x28')](function(){return db[_0x59f6('0x48')][_0x59f6('0x49')]({'where':{'type':_0x59f6('0x4a')},'attributes':['id'],'include':[{'model':db[_0x59f6('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x59f6('0x28')](function(_0x12ae09){var _0x598d9c=[];if(_0x12ae09){var _0x477751;for(var _0x4e4e4f=0x0,_0x1ddf5e;_0x4e4e4f<_0x12ae09[_0x59f6('0x16')];_0x4e4e4f+=0x1){_0x1ddf5e=_0x12ae09[_0x4e4e4f][_0x59f6('0x4d')]({'plain':!![]});_0x598d9c[_0x59f6('0x29')](db[_0x59f6('0x4f')][_0x59f6('0x50')](_0x1b976a(_0x1ddf5e,_0x59f6('0x51')))[_0x59f6('0x28')](function(){})[_0x59f6('0x52')](_0x5c400f()));}}return _0x598d9c;})[_0x59f6('0x54')]();})[_0x59f6('0x28')](function(){return db[_0x59f6('0x56')][_0x59f6('0x49')]({'attributes':['id',_0x59f6('0x4b')],'include':[{'model':db[_0x59f6('0x55')],'as':_0x59f6('0x4c'),'where':{'id':LISTID}}]})[_0x59f6('0x28')](function(_0x50b6d6){var _0x25bd1e=[];if(_0x50b6d6){for(var _0x42fb22=0x0,_0x51bf10;_0x42fb22<_0x50b6d6[_0x59f6('0x16')];_0x42fb22+=0x1){_0x51bf10=_0x50b6d6[_0x42fb22][_0x59f6('0x4d')]({'plain':!![]});switch(_0x51bf10['dialCheckDuplicateType']){case _0x59f6('0x4e'):_0x25bd1e[_0x59f6('0x29')](db[_0x59f6('0x4f')][_0x59f6('0x50')](_0x133379(_0x51bf10,_0x59f6('0x57')))[_0x59f6('0x28')](function(){})[_0x59f6('0x52')](_0x5c400f()));break;case _0x59f6('0x53'):_0x25bd1e[_0x59f6('0x29')](db['sequelize']['query'](_0x4a978a(_0x51bf10,_0x59f6('0x57')))[_0x59f6('0x28')](function(){})[_0x59f6('0x52')](_0x5c400f()));break;default:_0x25bd1e['push'](db['sequelize'][_0x59f6('0x50')](_0x518128(_0x51bf10,'CampaignId'))[_0x59f6('0x28')](function(){})[_0x59f6('0x52')](_0x5c400f()));}}}return _0x25bd1e;})[_0x59f6('0x54')]();})['then'](function(){return db[_0x59f6('0x56')][_0x59f6('0x49')]({'attributes':['id'],'include':[{'model':db[_0x59f6('0x55')],'as':_0x59f6('0x58'),'where':{'id':LISTID}}]})[_0x59f6('0x28')](function(_0x36905f){var _0x25c2d4=[];if(_0x36905f){for(var _0x14e0be=0x0,_0x484720;_0x14e0be<_0x36905f[_0x59f6('0x16')];_0x14e0be+=0x1){_0x484720=_0x36905f[_0x14e0be]['get']({'plain':!![]});_0x25c2d4['push'](db[_0x59f6('0x4f')][_0x59f6('0x50')](_0x1b976a(_0x484720,'CampaignId'))['then'](function(){})[_0x59f6('0x52')](_0x5c400f()));}}return _0x25c2d4;})['all']();})['catch'](function(_0x335345){logger[_0x59f6('0x11')](_0x59f6('0x59'),_0x59f6('0x5a'),_0x335345[_0x59f6('0x17')]);});}var processPromises=function(_0x13b54a){return BPromise[_0x59f6('0x54')](promises)[_0x59f6('0x28')](function(_0x52be1f){})[_0x59f6('0x52')](function(_0x678440){logger[_0x59f6('0x11')](_0x59f6('0x5b'),JSON[_0x59f6('0x2b')](_0x678440));})[_0x59f6('0x5c')](function(){socket[_0x59f6('0x5d')](_0x59f6('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x13b54a){return _0x13b54a[_0x59f6('0x5f')]();}});};var endCsv=function(){return BPromise[_0x59f6('0x60')]()[_0x59f6('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x59f6('0x28')](function(){socket[_0x59f6('0x5d')](_0x59f6('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x59f6('0x61')](FILEPATH);}catch(_0x559820){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x559820));}finally{process[_0x59f6('0x62')](0x0);}});};process['on']('SIGINT',function(){logger[_0x59f6('0x63')](_0x59f6('0x64'));endCsv();});function main(){return BPromise[_0x59f6('0x60')]()[_0x59f6('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x59f6('0x65')](',');return db[_0x59f6('0x25')][_0x59f6('0x49')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x59f6('0x28')](function(_0x183f8a){var _0x308d7d=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x59f6('0x66')](_0x308d7d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4537c6,_0x228ca1){total+=0x1;var _0xb9053d=total;promises['push'](checkRow(_0x4537c6,_0x183f8a,_0xb9053d)[_0x59f6('0x28')](function(){success+=0x1;})[_0x59f6('0x52')](function(_0x324c78){if(_0x324c78[_0x59f6('0x11')]){errors+=0x1;delete _0x324c78[_0x59f6('0x11')];}else if(_0x324c78[_0x59f6('0x67')]){duplicates+=0x1;delete _0x324c78[_0x59f6('0x67')];}rows[_0x59f6('0x29')](_0x324c78);}));if(total%0xc8===0x0){_0x228ca1[_0x59f6('0x68')]();return processPromises(_0x228ca1);}},'complete':function(){return processPromises()[_0x59f6('0x28')](function(){logger[_0x59f6('0x63')](_0x59f6('0x69'));endCsv();});},'error':function(_0xd9b67,_0x3c189c){logger[_0x59f6('0x63')](_0x59f6('0x6a'),JSON[_0x59f6('0x2b')](_0xd9b67));endCsv();}});})[_0x59f6('0x52')](function(_0x19628c){logger[_0x59f6('0x11')](_0x59f6('0x6b'),JSON['stringify'](_0x19628c));});}main(); \ No newline at end of file +var _0xfeed=['get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','ioredis','../../../mysqldb','../../../config/environment','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','ContactId','select','field','NOW()','scheduledAt','createdAt','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists'];(function(_0x5c3fcc,_0xf40dd1){var _0x25fd6c=function(_0x377eb2){while(--_0x377eb2){_0x5c3fcc['push'](_0x5c3fcc['shift']());}};_0x25fd6c(++_0xf40dd1);}(_0xfeed,0x1d8));var _0xdfee=function(_0x3990f4,_0x188878){_0x3990f4=_0x3990f4-0x0;var _0xbcdaed=_0xfeed[_0x3990f4];return _0xbcdaed;};'use strict';var BPromise=require(_0xdfee('0x0'));var util=require(_0xdfee('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xdfee('0x2'));var Papa=require('papaparse');var Redis=require(_0xdfee('0x3'));var db=require(_0xdfee('0x4'))['db'];var config=require(_0xdfee('0x5'));var logger=require('../../../config/logger')('api');config['redis']=_[_0xdfee('0x6')](config[_0xdfee('0x7')],{'host':_0xdfee('0x8'),'port':0x18eb});var socket=require(_0xdfee('0x9'))(new Redis(config['redis']));require(_0xdfee('0xa'))['register'](socket);try{if(!process[_0xdfee('0xb')][0x2]||process[_0xdfee('0xb')][0x2]===_0xdfee('0xc')||process['argv'][0x2]===_0xdfee('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xdfee('0xb')][0x2];if(!process[_0xdfee('0xb')][0x3]||process[_0xdfee('0xb')][0x3]===_0xdfee('0xc')||process[_0xdfee('0xb')][0x3]===_0xdfee('0xd')||!process['argv'][0x4]||process[_0xdfee('0xb')][0x4]===_0xdfee('0xc')||process[_0xdfee('0xb')][0x4]===_0xdfee('0xd')){throw new Error(_0xdfee('0xe'));}var FIELDS=_[_0xdfee('0xf')](process[_0xdfee('0xb')][0x3][_0xdfee('0x10')](','),process[_0xdfee('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xdfee('0xb')][0x5]===_0xdfee('0xc')||process[_0xdfee('0xb')][0x5]===_0xdfee('0xd')){throw new Error(_0xdfee('0x11'));}var LISTID=process[_0xdfee('0xb')][0x5];var COMPANYID=process[_0xdfee('0xb')][0x6]&&process[_0xdfee('0xb')][0x6]!==_0xdfee('0xc')&&process[_0xdfee('0xb')][0x6]!==_0xdfee('0xd')?process['argv'][0x6]:null;var DUPLICATES=process[_0xdfee('0xb')][0x7]&&process['argv'][0x7]!==_0xdfee('0xc')&&process[_0xdfee('0xb')][0x7]!==_0xdfee('0xd')?process[_0xdfee('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0xdfee('0xb')][0x8]==='undefined'||process[_0xdfee('0xb')][0x8]===_0xdfee('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xdfee('0xb')][0x8];}catch(_0x113c79){logger['error'](_0x113c79);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(_0x1d2510,_0x4b4bf9,_0x45582b,_0x1d9322){var _0x5e7b0b={'message':_0x4b4bf9};_0x5e7b0b[_0x1d2510]=!![];if(_0x45582b){_0x5e7b0b[_0xdfee('0x12')]=_0x45582b;}if(_0x1d9322){_0x5e7b0b[_0xdfee('0x13')]=_0x1d9322;}return _0x5e7b0b;}function isEmail(_0x3239f9){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))*$/[_0xdfee('0x14')](_0x3239f9);}function checkRow(_0x149fd2,_0x4d1b86,_0x47328a){return new BPromise(function(_0x4d3750,_0x4f7307){if(_[_0xdfee('0x15')](_0x149fd2)){return _0x4f7307(handleCheckRowError(_0xdfee('0x16'),_0xdfee('0x17'),null,_0x47328a));}if(_0x149fd2['errors']&&_0x149fd2[_0xdfee('0x18')]['length']){var _0x999324=_[_0xdfee('0x19')](_0x149fd2[_0xdfee('0x18')],'message')[_0xdfee('0x1a')](';');return _0x4f7307(handleCheckRowError('error',_0x999324,null,_0x47328a));}var _0x1583ac={};for(var _0x490e2a in FIELDS){if(FIELDS[_0xdfee('0x1b')](_0x490e2a)&&FIELDS[_0x490e2a]){_0x1583ac[_0x490e2a]=_0x149fd2[_0xdfee('0x1c')][0x0][FIELDS[_0x490e2a]]||_0x149fd2['data'][0x0]['\ufeff'+FIELDS[_0x490e2a]];}}if(!_0x1583ac['firstName']){return _0x4f7307(handleCheckRowError('error',_0xdfee('0x1d'),null,_0x47328a));}if(!_0x1583ac[_0xdfee('0x1e')]){return _0x4f7307(handleCheckRowError('error',_0xdfee('0x1f'),null,_0x47328a));}if(_0x1583ac[_0xdfee('0x20')]){var _0x3429f0=moment(_0x1583ac[_0xdfee('0x20')],_0xdfee('0x21'));if(!_0x3429f0[_0xdfee('0x22')]()){return _0x4f7307(handleCheckRowError(_0xdfee('0x16'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x47328a));}}if(_0x1583ac[_0xdfee('0x23')]){if(!isEmail(_0x1583ac[_0xdfee('0x23')])){return _0x4f7307(handleCheckRowError(_0xdfee('0x16'),_0xdfee('0x24'),null,_0x47328a));}}_0x1583ac[_0xdfee('0x25')]=LISTID;_0x1583ac[_0xdfee('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xdfee('0x27')]&&_0x4d1b86){var _0x19f606={};for(var _0x14e919=0x0,_0x1a2afb=DUPLICATES[_0xdfee('0x27')];_0x14e919<_0x1a2afb;_0x14e919+=0x1){_0x19f606[DUPLICATES[_0x14e919]]=_0x1583ac[DUPLICATES[_0x14e919]];}var _0x2aab20=_['find'](_0x4d1b86,_0x19f606);if(_0x2aab20){return _0x4f7307(handleCheckRowError(_0xdfee('0x28'),_0xdfee('0x29'),_0x2aab20,_0x47328a));}}return db[_0xdfee('0x2a')]['create'](_0x1583ac,{'raw':!![],'hooks':![],'fields':_[_0xdfee('0x2b')](_0x1583ac)})[_0xdfee('0x2c')](function(_0x465760){if(DUPLICATES&&DUPLICATES[_0xdfee('0x27')]&&_0x4d1b86){_0x4d1b86[_0xdfee('0x2d')](_[_0xdfee('0x2e')](_0x1583ac,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x465760['id'];return _0x4d3750();})[_0xdfee('0x2f')](function(_0x4e3674){return _0x4f7307(handleCheckRowError(_0xdfee('0x16'),_0xdfee('0x30')+(_0x4e3674[_0xdfee('0x31')]||JSON[_0xdfee('0x32')](_0x4e3674)),null,_0x47328a));});});}function checkHopper(){function _0x5d9ea2(){return function(_0x5b7964){logger['error'](_0xdfee('0x33'),'checkHopper',util[_0xdfee('0x34')](_0x5b7964,{'showHidden':![],'depth':null}));};}var _0x3a19f4=function(_0x248f11,_0x33b87b){var _0x4ed43d=squel[_0xdfee('0x35')]()[_0xdfee('0x36')](_0xdfee('0x37'))[_0xdfee('0x38')]([_0xdfee('0x1e'),'scheduledAt',_0xdfee('0x39'),'ListId',_0x33b87b,'createdAt','updatedAt'],squel[_0xdfee('0x3a')]()[_0xdfee('0x3b')](_0xdfee('0x1e'),'phone')[_0xdfee('0x3b')](_0xdfee('0x3c'),_0xdfee('0x3d'))[_0xdfee('0x3b')]('id',_0xdfee('0x39'))[_0xdfee('0x3b')](LISTID['toString'](),'ListId')[_0xdfee('0x3b')](_0x248f11['id']['toString'](),_0x33b87b)[_0xdfee('0x3b')]('NOW()',_0xdfee('0x3e'))[_0xdfee('0x3b')](_0xdfee('0x3c'),_0xdfee('0x3f'))[_0xdfee('0x40')](_0xdfee('0x41'))['where'](_0xdfee('0x42'))[_0xdfee('0x43')](_0xdfee('0x44'),LISTID[_0xdfee('0x45')]())[_0xdfee('0x43')](_0xdfee('0x46'))[_0xdfee('0x43')](_0xdfee('0x47'),squel[_0xdfee('0x3a')]()['field'](_0xdfee('0x1e'))[_0xdfee('0x40')](_0xdfee('0x37'))[_0xdfee('0x43')](_0x33b87b+'\x20=\x20?',_0x248f11['id']['toString']())))[_0xdfee('0x45')]();return _0x4ed43d;};var _0x1614cc=function(_0x152366,_0x50ec2d){var _0x10f5a8=squel[_0xdfee('0x35')]()[_0xdfee('0x36')]('cm_hopper')[_0xdfee('0x38')]([_0xdfee('0x1e'),_0xdfee('0x3d'),_0xdfee('0x39'),_0xdfee('0x25'),_0x50ec2d,_0xdfee('0x3e'),_0xdfee('0x3f')],squel['select']()['field'](_0xdfee('0x1e'),_0xdfee('0x1e'))[_0xdfee('0x3b')]('NOW()',_0xdfee('0x3d'))[_0xdfee('0x3b')]('id',_0xdfee('0x39'))[_0xdfee('0x3b')](LISTID['toString'](),_0xdfee('0x25'))[_0xdfee('0x3b')](_0x152366['id'][_0xdfee('0x45')](),_0x50ec2d)['field']('NOW()',_0xdfee('0x3e'))[_0xdfee('0x3b')](_0xdfee('0x3c'),'updatedAt')['from'](_0xdfee('0x41'))['where'](_0xdfee('0x42'))[_0xdfee('0x43')](_0xdfee('0x44'),LISTID['toString']())[_0xdfee('0x43')](_0xdfee('0x48'),squel[_0xdfee('0x49')](hopperContacts))[_0xdfee('0x43')](_0xdfee('0x46'))[_0xdfee('0x43')](_0xdfee('0x47'),squel[_0xdfee('0x3a')]()[_0xdfee('0x3b')](_0xdfee('0x4a'))[_0xdfee('0x40')](_0xdfee('0x4b'))['where'](_0x50ec2d+_0xdfee('0x4c'),_0x152366['id']['toString']()))['where'](_0xdfee('0x47'),squel[_0xdfee('0x3a')]()[_0xdfee('0x3b')]('phone')['from'](_0xdfee('0x37'))[_0xdfee('0x43')](_0x50ec2d+_0xdfee('0x4c'),_0x152366['id'][_0xdfee('0x45')]())))[_0xdfee('0x45')]();return _0x10f5a8;};function _0x3767a6(_0x32015c,_0x2cda30){var _0x90eafb=squel[_0xdfee('0x35')]()[_0xdfee('0x36')](_0xdfee('0x37'))[_0xdfee('0x38')]([_0xdfee('0x1e'),'scheduledAt','ContactId','ListId',_0x2cda30,'createdAt','updatedAt'],squel[_0xdfee('0x3a')]()[_0xdfee('0x3b')](_0xdfee('0x1e'),'phone')[_0xdfee('0x3b')](_0xdfee('0x3c'),_0xdfee('0x3d'))[_0xdfee('0x3b')]('id',_0xdfee('0x39'))[_0xdfee('0x3b')](LISTID[_0xdfee('0x45')](),'ListId')[_0xdfee('0x3b')](_0x32015c['id']['toString'](),_0x2cda30)[_0xdfee('0x3b')](_0xdfee('0x3c'),'createdAt')[_0xdfee('0x3b')]('NOW()',_0xdfee('0x3f'))['from'](_0xdfee('0x41'))['where'](_0xdfee('0x42'))[_0xdfee('0x43')](_0xdfee('0x44'),LISTID[_0xdfee('0x45')]())[_0xdfee('0x43')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xdfee('0x43')](_0xdfee('0x46')))['toString']();return _0x90eafb;}function _0x496e05(_0x21a1d9,_0x47a856){var _0x515a88=squel[_0xdfee('0x35')]()[_0xdfee('0x36')](_0xdfee('0x4d'))[_0xdfee('0x38')]([_0xdfee('0x1e'),_0xdfee('0x39'),_0xdfee('0x25'),_0x47a856,_0xdfee('0x3e'),_0xdfee('0x3f')],squel['select']()['field'](_0xdfee('0x1e'),_0xdfee('0x1e'))[_0xdfee('0x3b')]('id','ContactId')[_0xdfee('0x3b')](LISTID[_0xdfee('0x45')](),'ListId')['field'](_0x21a1d9['id'][_0xdfee('0x45')](),_0x47a856)[_0xdfee('0x3b')]('NOW()',_0xdfee('0x3e'))[_0xdfee('0x3b')]('NOW()','updatedAt')[_0xdfee('0x40')](_0xdfee('0x41'))[_0xdfee('0x43')](_0xdfee('0x42'))[_0xdfee('0x43')](_0xdfee('0x44'),LISTID[_0xdfee('0x45')]())['where'](_0xdfee('0x48'),squel[_0xdfee('0x49')](hopperContacts))[_0xdfee('0x43')](_0xdfee('0x46')))[_0xdfee('0x45')]();return _0x515a88;}return db['VoiceQueue'][_0xdfee('0x4e')]({'where':{'type':_0xdfee('0x4f')},'attributes':['id',_0xdfee('0x50')],'include':[{'model':db[_0xdfee('0x51')],'as':_0xdfee('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x5a199b){var _0x4c6325=[];if(_0x5a199b){var _0x116ef1;for(var _0xef5e55=0x0,_0x41dc79;_0xef5e55<_0x5a199b[_0xdfee('0x27')];_0xef5e55+=0x1){_0x41dc79=_0x5a199b[_0xef5e55][_0xdfee('0x53')]({'plain':!![]});switch(_0x41dc79[_0xdfee('0x50')]){case _0xdfee('0x54'):_0x4c6325[_0xdfee('0x2d')](db[_0xdfee('0x55')][_0xdfee('0x56')](_0x1614cc(_0x41dc79,'VoiceQueueId'))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));break;case _0xdfee('0x57'):_0x4c6325['push'](db[_0xdfee('0x55')]['query'](_0x3a19f4(_0x41dc79,_0xdfee('0x58')))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));break;default:_0x4c6325[_0xdfee('0x2d')](db[_0xdfee('0x55')]['query'](_0x3767a6(_0x41dc79,_0xdfee('0x58')))['then'](function(){})['catch'](_0x5d9ea2()));}}}return _0x4c6325;})[_0xdfee('0x59')]()[_0xdfee('0x2c')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xdfee('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x11bbb1){var _0x1cc9eb=[];if(_0x11bbb1){var _0xfd8ac3;for(var _0x55245d=0x0,_0x5052ce;_0x55245d<_0x11bbb1[_0xdfee('0x27')];_0x55245d+=0x1){_0x5052ce=_0x11bbb1[_0x55245d][_0xdfee('0x53')]({'plain':!![]});_0x1cc9eb['push'](db[_0xdfee('0x55')]['query'](_0x496e05(_0x5052ce,_0xdfee('0x58')))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));}}return _0x1cc9eb;})[_0xdfee('0x59')]();})[_0xdfee('0x2c')](function(){return db[_0xdfee('0x5a')][_0xdfee('0x4e')]({'attributes':['id',_0xdfee('0x50')],'include':[{'model':db[_0xdfee('0x51')],'as':_0xdfee('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x3f41ec){var _0x419647=[];if(_0x3f41ec){for(var _0x135ccc=0x0,_0x524f96;_0x135ccc<_0x3f41ec['length'];_0x135ccc+=0x1){_0x524f96=_0x3f41ec[_0x135ccc][_0xdfee('0x53')]({'plain':!![]});switch(_0x524f96[_0xdfee('0x50')]){case'always':_0x419647[_0xdfee('0x2d')](db['sequelize'][_0xdfee('0x56')](_0x1614cc(_0x524f96,'CampaignId'))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));break;case _0xdfee('0x57'):_0x419647[_0xdfee('0x2d')](db[_0xdfee('0x55')][_0xdfee('0x56')](_0x3a19f4(_0x524f96,_0xdfee('0x5b')))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));break;default:_0x419647[_0xdfee('0x2d')](db[_0xdfee('0x55')][_0xdfee('0x56')](_0x3767a6(_0x524f96,_0xdfee('0x5b')))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));}}}return _0x419647;})[_0xdfee('0x59')]();})[_0xdfee('0x2c')](function(){return db[_0xdfee('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xdfee('0x51')],'as':_0xdfee('0x5c'),'where':{'id':LISTID}}]})[_0xdfee('0x2c')](function(_0x21c1be){var _0xed67f8=[];if(_0x21c1be){for(var _0x32f7ec=0x0,_0x556603;_0x32f7ec<_0x21c1be['length'];_0x32f7ec+=0x1){_0x556603=_0x21c1be[_0x32f7ec][_0xdfee('0x53')]({'plain':!![]});_0xed67f8['push'](db[_0xdfee('0x55')]['query'](_0x496e05(_0x556603,_0xdfee('0x5b')))[_0xdfee('0x2c')](function(){})[_0xdfee('0x2f')](_0x5d9ea2()));}}return _0xed67f8;})['all']();})[_0xdfee('0x2f')](function(_0x42e51d){logger[_0xdfee('0x16')](_0xdfee('0x5d'),_0xdfee('0x5e'),_0x42e51d[_0xdfee('0x31')]);});}var processPromises=function(_0x2e8ec0){return BPromise['all'](promises)[_0xdfee('0x2c')](function(_0x271606){})[_0xdfee('0x2f')](function(_0x470715){logger['error'](_0xdfee('0x5f'),JSON[_0xdfee('0x32')](_0x470715));})[_0xdfee('0x60')](function(){socket[_0xdfee('0x61')](_0xdfee('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2e8ec0){return _0x2e8ec0[_0xdfee('0x63')]();}});};var endCsv=function(){return BPromise[_0xdfee('0x64')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xdfee('0x2c')](function(){socket[_0xdfee('0x61')](_0xdfee('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xdfee('0x65')](FILEPATH);}catch(_0x5ac44f){logger[_0xdfee('0x16')](_0xdfee('0x66'),JSON[_0xdfee('0x32')](_0x5ac44f));}finally{process[_0xdfee('0x67')](0x0);}});};process['on'](_0xdfee('0x68'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xdfee('0x64')]()[_0xdfee('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xdfee('0x10')](',');return db[_0xdfee('0x2a')][_0xdfee('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xdfee('0x2c')](function(_0x4d751d){var _0x522efb=fs[_0xdfee('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xdfee('0x6a')](_0x522efb,{'header':!![],'skipEmptyLines':!![],'step':function(_0x6d8954,_0x52b3a){total+=0x1;var _0xbf01a6=total;promises[_0xdfee('0x2d')](checkRow(_0x6d8954,_0x4d751d,_0xbf01a6)['then'](function(){success+=0x1;})[_0xdfee('0x2f')](function(_0x2b2c6b){if(_0x2b2c6b['error']){errors+=0x1;delete _0x2b2c6b['error'];}else if(_0x2b2c6b[_0xdfee('0x28')]){duplicates+=0x1;delete _0x2b2c6b[_0xdfee('0x28')];}rows['push'](_0x2b2c6b);}));if(total%0xc8===0x0){_0x52b3a['pause']();return processPromises(_0x52b3a);}},'complete':function(){return processPromises()[_0xdfee('0x2c')](function(){logger['info'](_0xdfee('0x6b'));endCsv();});},'error':function(_0x1ed306,_0x1ca48e){logger[_0xdfee('0x6c')](_0xdfee('0x6d'),JSON['stringify'](_0x1ed306));endCsv();}});})[_0xdfee('0x2f')](function(_0x113ceb){logger[_0xdfee('0x16')](_0xdfee('0x6e'),JSON[_0xdfee('0x32')](_0x113ceb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index ade792d..2487f1b 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 _0x992b=['toString','cm_hopper_black','from','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','error','message','exit','errors','code','sequelize','spread','catch','campaigns.id','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','stringify','send','binding','clone','socket_timestamp','root','.csv','includes','header','ContactItemType','name','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isNaN','isNumber','agent\x20not\x20exists','email','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','itemTypeId','description','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset',',\x20scheduledAt\x20=\x20NOW()','each','contactTypeId','orderBy','VoiceQueueId','campaigns','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','all','split','push','isNil','filter','CmContactHasItem','findOne','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x992b,0x127));var _0xb992=function(_0x2de039,_0x4ad077){_0x2de039=_0x2de039-0x0;var _0x21223d=_0x992b[_0x2de039];return _0x21223d;};'use strict';var fs=require('fs');var path=require(_0xb992('0x0'));var _=require('lodash');var Papa=require(_0xb992('0x1'));var util=require(_0xb992('0x2'));var BPromise=require(_0xb992('0x3'));var moment=require(_0xb992('0x4'));var squel=require(_0xb992('0x5'));var Redis=require('ioredis');var db=require(_0xb992('0x6'))['db'];var config=require(_0xb992('0x7'));var shared=require(_0xb992('0x8'));var logger=require('../../../config/logger')(_0xb992('0x9'));config['redis']=_['defaults'](config[_0xb992('0xa')],{'host':_0xb992('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb992('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb992('0xc')](_0xb992('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xb992('0xc')](_0xb992('0xd'));function isEmail(_0x3ba371){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))*$/[_0xb992('0xe')](_0x3ba371);}function selectNotIn(_0x48bb17,_0x28a77b,_0x136d66,_0x2dcf10,_0x1af53e){return squel[_0xb992('0xf')]()[_0xb992('0x10')]('phone')['from'](_0x2dcf10)['join'](_0x28a77b,null,_0x28a77b+_0xb992('0x11')+_0x2dcf10+'.'+_0x136d66)[_0xb992('0x12')](_0x2dcf10+'.'+_0x136d66+_0xb992('0x13')+_0x48bb17+'.'+_0x136d66)['where'](_0x28a77b+_0xb992('0x14')+_0x1af53e[_0xb992('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2da6c4,_0x3afbd7){promisesAdditionalPhones=[];return db[_0xb992('0x16')][_0xb992('0x17')]({'raw':!![],'attributes':['id',_0xb992('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb992('0x19')](function(_0x6b16c7){if(_0x6b16c7!==null){var _0x276e12=[];for(var _0x2bd24a=0x0;_0x2bd24a<_0x6b16c7[_0xb992('0x1a')];_0x2bd24a++){var _0xa1c51e=_0x6b16c7[_0x2bd24a];_0x276e12['push'](insertAdditionalPhones(_0xa1c51e));}}Promise[_0xb992('0x1b')](_0x276e12)[_0xb992('0x19')](function(){_0x2da6c4({'val':0x1});});});});}function insertAdditionalPhones(_0x14e953){return new Promise(function(_0x498f61,_0x480fa1){var _0xc2f6cb=_0x14e953[_0xb992('0x18')];var _0x500975=_0xc2f6cb[_0xb992('0x1c')](';');var _0x304392=[];orderBy=0x0;for(var _0x43d8d1=0x0;_0x43d8d1<_0x500975[_0xb992('0x1a')];_0x43d8d1++){_0x304392[_0xb992('0x1d')](splitAdditionalPhone(_0x14e953['id'],_0x500975[_0x43d8d1]));}Promise[_0xb992('0x1b')](_0x304392)['then'](function(){_0x498f61({'val':_0x500975[_0xb992('0x1a')]});});});}function splitAdditionalPhone(_0x28c1e7,_0x4d51a0){return new Promise(function(_0x45fb84,_0x1785fc){var _0x2f9ee8=_0x4d51a0['split'](':');var _0x252290=_0x2f9ee8[0x0];var _0x46d46e=_0x2f9ee8[0x1];if(!_[_0xb992('0x1e')](_0x46d46e)){var _0x508b27=_0x46d46e[_0xb992('0x1c')]('|');var _0xea8a71=[];for(var _0x3fd7c3=0x0;_0x3fd7c3<_0x508b27[_0xb992('0x1a')];_0x3fd7c3++){if(_0x508b27[_0x3fd7c3]!==''){var _0x35501a=_[_0xb992('0x1f')](promisesAdditionalPhones,{'contactId':_0x28c1e7,'phone':_0x508b27[_0x3fd7c3]});if(_0x35501a[_0xb992('0x1a')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x28c1e7,'contactTypeId':_0x252290,'phone':_0x508b27[_0x3fd7c3],'orderBy':orderBy});}}}_0x45fb84({'ok':0x1});}else _0x45fb84({'res':0x0});});}function createAdditionalPhone(_0x514efc,_0x5bcf57,_0x39680f,_0xd88bf5){var _0x45c8dc='';var _0x438636='';var _0x3cb6a2=_0x39680f[_0xb992('0x1c')]('§');_0x45c8dc=_0x3cb6a2[0x0];if(_0x3cb6a2['length']==0x2)_0x438636=_0x3cb6a2[0x1];return new Promise(function(_0x2b2b14,_0x2c8d23){return db[_0xb992('0x20')][_0xb992('0x21')]({'where':{'CmContactId':_0x514efc,'item':_0x45c8dc}})[_0xb992('0x19')](function(_0xa14e7c){if(_0xa14e7c){return db[_0xb992('0x20')]['update']({'ItemTypeId':_0x5bcf57,'description':_0x438636,'OrderBy':_0xd88bf5},{'where':{'CmContactId':_0x514efc,'item':_0x45c8dc}})['then'](function(_0x5a92d8){_0x2b2b14({'res':_0xb992('0x22')});});}else{return db[_0xb992('0x20')]['create']({'CmContactId':_0x514efc,'item':_0x45c8dc,'description':_0x438636,'ItemTypeId':_0x5bcf57,'OrderBy':_0xd88bf5,'ItemClass':_0xb992('0x23')})[_0xb992('0x19')](function(_0x4f541b){_0x2b2b14({'res':_0xb992('0x24')});});}});});}function insertCmHopper(_0x206ffb,_0x3b568c,_0x368936,_0xb1fa08,_0x46289b){var _0x45270d=[_0xb992('0x25'),'cm_contacts.scheduledat',_0xb992('0x26'),_0xb992('0x27'),_0x3b568c+'.'+_0xb1fa08,_0xb992('0x28'),_0xb992('0x29'),_0xb992('0x2a'),_0xb992('0x2b'),'\x22'+_0x46289b+'\x22'];return squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x2e'))[_0xb992('0x2f')]([_0xb992('0x30'),_0xb992('0x31'),_0xb992('0x32'),_0xb992('0x33'),_0xb1fa08,_0xb992('0x34'),_0xb992('0x35'),_0xb992('0x36'),_0xb992('0x37'),_0xb992('0x38')],squel[_0xb992('0xf')]()[_0xb992('0x39')](_0x45270d)['from'](_0x3b568c)['join']('cm_contacts',null,_0xb992('0x3a')+_0x3b568c+_0xb992('0x3b'))['join'](_0x368936,null,_0x368936+_0xb992('0x11')+_0x3b568c+'.'+_0xb1fa08)[_0xb992('0x12')](_0x3b568c+_0xb992('0x3c'),_0x206ffb)[_0xb992('0x12')](_0xb992('0x3d'),NOW)[_0xb992('0x12')](_0xb992('0x3e'),selectNotIn(_0x3b568c,_0x368936,_0xb1fa08,_0xb992('0x2e'),[_0xb992('0x3f'),_0xb992('0x40')]))['where'](_0xb992('0x3e'),selectNotIn(_0x3b568c,_0x368936,_0xb1fa08,'cm_hopper',['\x22always\x22'])))[_0xb992('0x41')]();}function insertCmHopperBlack(_0x51298d,_0x142630,_0x29006e,_0x376219){var _0x1dcb61=[_0xb992('0x25'),_0xb992('0x26'),'cm_contacts.ListId',_0x142630+'.'+_0x376219,_0xb992('0x28'),_0xb992('0x29')];return squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x42'))[_0xb992('0x2f')]([_0xb992('0x30'),_0xb992('0x32'),_0xb992('0x33'),_0x376219,'createdAt',_0xb992('0x35')],squel[_0xb992('0xf')]()[_0xb992('0x39')](_0x1dcb61)[_0xb992('0x43')](_0x142630)[_0xb992('0x15')](_0xb992('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x142630+'.CmListId')[_0xb992('0x15')](_0x29006e,null,_0x29006e+'.id\x20=\x20'+_0x142630+'.'+_0x376219)[_0xb992('0x12')](_0x142630+_0xb992('0x3c'),_0x51298d)[_0xb992('0x12')](_0xb992('0x3d'),NOW)[_0xb992('0x12')](_0xb992('0x3e'),squel[_0xb992('0xf')]()['field'](_0xb992('0x30'))['from'](_0xb992('0x42'))[_0xb992('0x12')](_0xb992('0x45'),_0x51298d)['where'](_0x376219+_0xb992('0x13')+_0x142630+'.'+_0x376219)))[_0xb992('0x41')]();}function insertTzCmHopper(_0x914a7e,_0x35b02a,_0x20e642,_0x48f537,_0x38b286,_0x5ca1aa){var _0x17d6ab=['cm_contacts.phone',_0xb992('0x46')+_0x5ca1aa+'.offset-cm_contacts.utcOffset\x20minute)',_0xb992('0x26'),_0xb992('0x27'),_0x35b02a+'.'+_0x48f537,_0xb992('0x28'),_0xb992('0x29'),'cm_contacts.priority',_0xb992('0x2b'),'\x22'+_0x38b286+'\x22'];var _0xa705f4=squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x2e'))[_0xb992('0x2f')]([_0xb992('0x30'),_0xb992('0x31'),'ContactId',_0xb992('0x33'),_0x48f537,_0xb992('0x34'),_0xb992('0x35'),'priority',_0xb992('0x37'),_0xb992('0x38')],squel['select']()[_0xb992('0x39')](_0x17d6ab)[_0xb992('0x43')](_0x35b02a)[_0xb992('0x15')](_0xb992('0x44'),null,_0xb992('0x3a')+_0x35b02a+_0xb992('0x3b'))[_0xb992('0x15')](_0x20e642,null,_0x20e642+_0xb992('0x11')+_0x35b02a+'.'+_0x48f537)[_0xb992('0x15')](_0x5ca1aa,null,_0x5ca1aa+'.id\x20=\x20'+_0x35b02a+'.'+_0x48f537)[_0xb992('0x12')](_0x35b02a+'.CmListId\x20=\x20?',_0x914a7e)[_0xb992('0x12')](_0xb992('0x3d'),NOW)[_0xb992('0x12')](_0xb992('0x3e'),selectNotIn(_0x35b02a,_0x20e642,_0x48f537,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xb992('0x12')](_0xb992('0x3e'),selectNotIn(_0x35b02a,_0x20e642,_0x48f537,_0xb992('0x2e'),[_0xb992('0x3f')])))[_0xb992('0x41')]();return _0xa705f4;}function insertTzCmHopperBlack(_0x46c24e,_0x37ab08,_0x208020,_0x12f339){var _0x4bcb59=[_0xb992('0x25'),_0xb992('0x26'),_0xb992('0x27'),_0x37ab08+'.'+_0x12f339,_0xb992('0x28'),_0xb992('0x29')];return squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x42'))[_0xb992('0x2f')]([_0xb992('0x30'),_0xb992('0x32'),_0xb992('0x33'),_0x12f339,'createdAt','updatedAt'],squel[_0xb992('0xf')]()[_0xb992('0x39')](_0x4bcb59)[_0xb992('0x43')](_0x37ab08)[_0xb992('0x15')](_0xb992('0x44'),null,_0xb992('0x3a')+_0x37ab08+'.CmListId')[_0xb992('0x15')](_0x208020,null,_0x208020+_0xb992('0x11')+_0x37ab08+'.'+_0x12f339)[_0xb992('0x12')](_0x37ab08+_0xb992('0x3c'),_0x46c24e)[_0xb992('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb992('0x12')](_0xb992('0x3e'),squel[_0xb992('0xf')]()[_0xb992('0x10')](_0xb992('0x30'))[_0xb992('0x43')](_0xb992('0x42'))[_0xb992('0x12')](_0xb992('0x45'),_0x46c24e)['where'](_0x12f339+'\x20=\x20'+_0x37ab08+'.'+_0x12f339)))[_0xb992('0x41')]();}function insertCmHopperAdditionalPhones(_0x329de7){var _0x372546=[_0xb992('0x47'),_0xb992('0x48'),_0xb992('0x49'),_0xb992('0x4a'),'cm_contact_has_items.updatedAt'];return squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x4b'))['fromQuery']([_0xb992('0x4c'),_0xb992('0x30'),_0xb992('0x4d'),'createdAt',_0xb992('0x35')],squel[_0xb992('0xf')]()[_0xb992('0x39')](_0x372546)['from'](_0xb992('0x2e'))[_0xb992('0x15')](_0xb992('0x44'),null,_0xb992('0x4e'))['join'](_0xb992('0x4f'),null,_0xb992('0x50'))[_0xb992('0x12')](_0xb992('0x51'),_0x329de7)[_0xb992('0x12')](_0xb992('0x3d'),NOW))['toString']();}function insertCmContact(_0x305cc6,_0x4db6c8,_0x3a0838,_0x174ab8){var _0x400e8b=_[_0xb992('0x52')](_[_0xb992('0x53')](_0x174ab8),[_0xb992('0x33'),_0xb992('0x54'),_0xb992('0x34'),_0xb992('0x35')]);return squel[_0xb992('0x2c')]()[_0xb992('0x2d')](_0xb992('0x44'))['fromQuery'](_0x400e8b,squel[_0xb992('0xf')]()[_0xb992('0x39')](_0x400e8b)[_0xb992('0x43')](_0x4db6c8)[_0xb992('0x12')]('('+_0x3a0838[_0xb992('0x15')](',')+_0xb992('0x55'),squel['select']()[_0xb992('0x39')](_0x3a0838)[_0xb992('0x43')](_0xb992('0x44'))['where'](_0xb992('0x45'),_0x305cc6)['where'](_0xb992('0x56')))[_0xb992('0x12')](_0xb992('0x57'),squel[_0xb992('0xf')]()[_0xb992('0x10')](_0xb992('0x58'),_0xb992('0x59'))['from'](_0x4db6c8)['group'](_0x3a0838['join'](','))))[_0xb992('0x41')]();}function handleStop(){logger[_0xb992('0x5a')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x520ff7){logger[_0xb992('0x5b')](_0x520ff7[_0xb992('0x5c')]);process[_0xb992('0x5d')](0x1);}function handleError(_0x598079,_0x2340c9){stats[_0xb992('0x5e')][_0xb992('0x1d')]({'name':_0x2340c9[_0xb992('0x5f')],'message':_0x2340c9[_0xb992('0x5c')],'row':_0x598079});}function handleQuery(_0x58858a){logger[_0xb992('0x5a')](_0x58858a);return db[_0xb992('0x60')]['query'](_0x58858a)[_0xb992('0x61')](function(_0x1046c2){results['push'](_0x1046c2);})[_0xb992('0x62')](function(_0x10ad84){logger['error'](_0x10ad84[_0xb992('0x5c')]);});}function updateTzCampaigns(_0x559121){return new Promise(function(_0x2b5cf1,_0x5d9c32){var _0x228a2f=squel[_0xb992('0xf')]()[_0xb992('0x39')]([_0xb992('0x63'),'campaigns.dialTimezone'])[_0xb992('0x43')]('campaigns')[_0xb992('0x15')]('campaigns_has_cm_lists',null,_0xb992('0x64'))[_0xb992('0x12')](_0xb992('0x65')+_0x559121);db[_0xb992('0x60')][_0xb992('0x66')](_0x228a2f['toString']())[_0xb992('0x61')](function(_0x1a16cc){var _0x322235=[];for(var _0x1bb056=0x0;_0x1bb056<_0x1a16cc[_0xb992('0x1a')];_0x1bb056++){_0x322235['push'](getTimezoneData(_0x1a16cc[_0x1bb056],tmp_campaigns));}BPromise[_0xb992('0x1b')](_0x322235)['then'](function(){_0x2b5cf1({'val':0x1});});})[_0xb992('0x62')](function(_0x59bae2){logger['error'](_0x59bae2[_0xb992('0x5c')]);_0x2b5cf1({'val':0x0});});});}function updateTzVoiceQueues(_0x367e83){return new Promise(function(_0x6a9466,_0x3428f8){var _0x177601=squel[_0xb992('0xf')]()[_0xb992('0x39')]([_0xb992('0x67'),'voice_queues.dialTimezone'])['from'](_0xb992('0x68'))[_0xb992('0x15')](_0xb992('0x69'),null,_0xb992('0x6a'))[_0xb992('0x12')](_0xb992('0x6b')+_0x367e83);db['sequelize'][_0xb992('0x66')](_0x177601[_0xb992('0x41')]())['spread'](function(_0x379788){var _0x185bce=[];for(var _0x3377af=0x0;_0x3377af<_0x379788[_0xb992('0x1a')];_0x3377af++){_0x185bce['push'](getTimezoneData(_0x379788[_0x3377af],tmp_voice_queues));}BPromise[_0xb992('0x1b')](_0x185bce)['then'](function(){_0x6a9466({'val':0x1});});})[_0xb992('0x62')](function(_0x46e44d){logger[_0xb992('0x5b')](_0x46e44d[_0xb992('0x5c')]);_0x6a9466({'val':0x0});});});}function getTimezoneData(_0x139082,_0x40a635){return new Promise(function(_0x324652,_0x41fe49){var _0x1b1d59=shared[_0xb992('0x6c')];var _0x4c5ae8=_0x1b1d59[_0x139082[_0xb992('0x6d')]];if(_['isNil'](_0x4c5ae8)){_0x324652({'ret':0x1});}else{var _0x35a18d=_0x4c5ae8[_0xb992('0x6e')];var _0x983568=squel['insert']()['into'](_0x40a635)[_0xb992('0x6f')]('id',_0x139082['id'])[_0xb992('0x6f')]('offset',_0x35a18d)[_0xb992('0x6f')]('dialTimezone',_0x139082[_0xb992('0x6d')])[_0xb992('0x41')]();return db[_0xb992('0x60')][_0xb992('0x66')](_0x983568)[_0xb992('0x61')](function(_0x46eb46){_0x324652({'ret':0x1});})['catch'](function(_0x3f786e){logger[_0xb992('0x5b')](_0x3f786e[_0xb992('0x5c')]);_0x41fe49({'ret':0x1});});}});}function handleTZQuery(_0x51e55a){logger[_0xb992('0x5a')](_0x51e55a);return db[_0xb992('0x60')][_0xb992('0x66')](_0x51e55a)[_0xb992('0x61')](function(_0x2dad03){})[_0xb992('0x62')](function(_0x46bb62){logger['error'](_0x46bb62['message']);});}function main(_0x51ed5e,_0xb13291,_0xd70180,_0x219a29){logger[_0xb992('0x5a')]('main',_0x51ed5e,JSON[_0xb992('0x70')](_0xb13291));process[_0xb992('0x71')]('start');var _0xd1a98c=_0xb13291[_0xb992('0x72')];var _0x566d28=_[_0xb992('0x73')](_0xd1a98c);var _0x197a01=_0xb13291[_0xb992('0x74')];var _0x46753b=path[_0xb992('0x15')](config[_0xb992('0x75')],'server/files/tmp',_0x197a01+_0xb992('0x76'));hasTZ=_[_0xb992('0x53')](_0xd1a98c)[_0xb992('0x77')](_0xb992('0x6d'));var _0x406c50=_[_0xb992('0x53')](_0xd1a98c)[_0xb992('0x15')]();logger[_0xb992('0x5a')](_0xb992('0x78'),_0x406c50);db[_0xb992('0x79')][_0xb992('0x17')]({'raw':!![],'attributes':['id',_0xb992('0x7a')]})[_0xb992('0x19')](function(_0x2bd9f0){for(var _0x5e172d=0x0;_0x5e172d<_0x2bd9f0['length'];_0x5e172d++){if(_0x2bd9f0[_0x5e172d][_0xb992('0x7a')]in _0xd1a98c){contactItemTypes[_0xb992('0x1d')](_0x2bd9f0[_0x5e172d]);delete _0x566d28[_0x2bd9f0[_0x5e172d]['name']];hasAdditionalPhones=!![];}for(var _0x4006ee in _0xd1a98c){if(_0x2bd9f0[_0x5e172d][_0xb992('0x7a')]+'_description'===_0x4006ee){phoneDescriptions['push']({'itemTypeId':_0x2bd9f0[_0x5e172d]['id'],'description':_0x4006ee});delete _0x566d28[_0x4006ee];}}}if(hasAdditionalPhones)_0x566d28[_0xb992('0x18')]='';var _0x448398=_[_0xb992('0x53')](_0x566d28)['join']();logger['info'](_0xb992('0x78'),_0x448398);fs['writeFileSync'](_0x46753b,_0x448398+'\x0a');Papa[_0xb992('0x7b')](fs[_0xb992('0x7c')](_0x51ed5e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x48bad3,_0x48c609){try{for(var _0x34381e=0x0,_0x391306=[];_0x34381e<_0x48bad3[_0xb992('0x7d')][_0xb992('0x1a')];_0x34381e++){stats[_0xb992('0x7e')]+=0x1;if(_0x48bad3[_0xb992('0x5e')][_0x34381e]){handleError(_0x48bad3['data'][_0x34381e],_0x48bad3[_0xb992('0x5e')][_0x34381e]);}else{var _0x5c63bb=[];var _0xad46c6=[];var _0x43bd95={};for(var _0x4bd850 in _0xd1a98c){let _0x1aa8dd=contactItemTypes[_0xb992('0x7f')](_0x18c30e=>_0x18c30e['name']===_0x4bd850);let _0x18ee84=contactItemTypes[_0xb992('0x7f')](_0x2bbf40=>_0x2bbf40[_0xb992('0x7a')]+'_description'===_0x4bd850);if(_[_0xb992('0x1e')](_0x1aa8dd)&&_[_0xb992('0x1e')](_0x18ee84)){if(_0xd1a98c[_0xb992('0x80')](_0x4bd850)){if(_0x48bad3['data'][_0x34381e][_0xd1a98c[_0x4bd850]]){var _0xcb55d9=_[_0xb992('0x81')](_0x48bad3[_0xb992('0x7d')][_0x34381e][_0xd1a98c[_0x4bd850]][_0xb992('0x82')](/"/g,'\x27'));switch(_0x4bd850){case'scheduledat':var _0x219e33=moment(_0xcb55d9,_0xb992('0xd'),!![]);if(_0x219e33['isValid']()){_0x391306['push']('\x22'+_0xcb55d9+'\x22');}else{_0x5c63bb[_0xb992('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb992('0x36'):var _0xd352d1=parseInt(_0xcb55d9);_0xcb55d9=_[_0xb992('0x83')](_0xd352d1)||_0xd352d1<0x0||_0xd352d1>0x4?_0x219a29?0x3:0x2:_0xd352d1;_0x391306[_0xb992('0x1d')]('\x22'+_0xcb55d9+'\x22');break;case _0xb992('0x37'):var _0x3f4c2d=parseInt(_0xcb55d9);if(_[_0xb992('0x84')](_0x3f4c2d)&&_[_0xb992('0x77')](_0xd70180,_0x3f4c2d)){_0x391306[_0xb992('0x1d')]('\x22'+_0x3f4c2d+'\x22');}else{_0x5c63bb['push'](_0xb992('0x85'));}break;case _0xb992('0x86'):if(isEmail(_0xcb55d9)){_0x391306[_0xb992('0x1d')]('\x22'+_0xcb55d9+'\x22');}else{_0x5c63bb[_0xb992('0x1d')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x3cf0fc=moment(_0xcb55d9,_0xb992('0x87'),!![]);if(_0x3cf0fc[_0xb992('0x88')]()){_0x391306[_0xb992('0x1d')]('\x22'+_0xcb55d9+'\x22');}else{_0x5c63bb['push'](_0xb992('0x89'));}break;case _0xb992('0x6d'):var _0x5b1953=shared[_0xb992('0x6c')];var _0x23bfe1=_0x5b1953[_0xcb55d9];if(!_[_0xb992('0x1e')](_0x23bfe1)){var _0x3e042a=_0x23bfe1[_0xb992('0x6e')];_0x391306[_0xb992('0x1d')]('\x22'+_0xcb55d9+'\x22');_0x391306[_0xb992('0x1d')]('\x22'+_0x3e042a+'\x22');}break;default:_0x391306['push']('\x22'+_0xcb55d9+'\x22');}}else{switch(_0x4bd850){case'firstName':case _0xb992('0x30'):_0x5c63bb[_0xb992('0x1d')](_0x4bd850+'\x20not\x20specified');break;default:_0x391306[_0xb992('0x1d')]('\x22\x22');}}}}else{var _0x56b088='';if(!_[_0xb992('0x1e')](_0x1aa8dd)){if(!_0x43bd95[_0xb992('0x80')](_0x1aa8dd['id'])){if(!_['isNil'](_0x48bad3[_0xb992('0x7d')][_0x34381e][_0xd1a98c[_0x4bd850]])){var _0xcb55d9=_[_0xb992('0x81')](_0x48bad3[_0xb992('0x7d')][_0x34381e][_0xd1a98c[_0x4bd850]][_0xb992('0x82')](/"/g,'\x27'));var _0x58acf6=phoneDescriptions[_0xb992('0x7f')](_0x2cfef3=>_0x2cfef3[_0xb992('0x8a')]===_0x1aa8dd['id']);if(!_['isNil'](_0x58acf6)){var _0x1e2869=_[_0xb992('0x81')](_0x48bad3[_0xb992('0x7d')][_0x34381e][_0xd1a98c[_0x58acf6[_0xb992('0x8b')]]][_0xb992('0x82')](/"/g,'\x27'));if(!_[_0xb992('0x1e')](_0x1e2869))_0xcb55d9=_0xcb55d9+'§'+_0x1e2869;}if(_0x56b088=='')_0x56b088=_0xcb55d9;else _0x56b088+='|'+_0xcb55d9;}_0xad46c6[_0xb992('0x1d')](_0x1aa8dd['id']+':'+_0x56b088);_0x43bd95[_0x1aa8dd['id']]=0x1;}}}}if(hasAdditionalPhones){_0x391306['push']('\x22'+_0xad46c6[_0xb992('0x15')](';')+'\x22');}if(_0x5c63bb['length']){handleError(_0x48bad3[_0xb992('0x7d')][_0x34381e],{'code':'SystemRow','message':_0x5c63bb[_0xb992('0x15')]()});}else{fs[_0xb992('0x8c')](_0x46753b,_0x391306[_0xb992('0x15')]()+'\x0a');}_0x391306=[];}if(!(stats[_0xb992('0x7e')]%0xc8)){socket[_0xb992('0x8d')](_0xb992('0x8e')+_0x197a01,stats);stats['errors']=[];}}if(stopped){logger[_0xb992('0x5a')](_0xb992('0x8f'));_0x48c609['abort']();}}catch(_0x9c3da){handleError(_0x48bad3['data'][_0x34381e],{'code':_0xb992('0x90'),'message':_0x9c3da[_0xb992('0x5c')]});logger['error'](_0xb992('0x91'),_0x9c3da[_0xb992('0x5c')]);}},'complete':function(){try{var _0xa2a8ed=[];var _0x1a6a7a=[];var _0x5b2bef=_0xb992('0x44');if(_0xb13291[_0xb992('0x92')]&&_0xb13291[_0xb992('0x92')][_0xb992('0x1a')]){_0x5b2bef=_0xb992('0x93')+_0x197a01;_0xa2a8ed['push'](_0xb992('0x94')+_0x5b2bef+_0xb992('0x95'));}tmp_campaigns=_0xb992('0x96')+_0x197a01;tmp_voice_queues=_0xb992('0x97')+_0x197a01;_0x1a6a7a['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0xb992('0x98'));_0x1a6a7a[_0xb992('0x1d')](_0xb992('0x94')+tmp_voice_queues+_0xb992('0x98'));BPromise['each'](_0x1a6a7a,handleTZQuery)[_0xb992('0x19')](function(_0x2d72e7){updateTzCampaigns(_0xb13291[_0xb992('0x33')])['then'](function(_0x16659f){updateTzVoiceQueues(_0xb13291[_0xb992('0x33')])['then'](function(_0x335717){if(hasTZ)_0x448398=_0x448398[_0xb992('0x82')]('dialTimezone',_0xb992('0x99'));var _0x57276d=util[_0xb992('0xc')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x46753b,_0x5b2bef,_0x448398,_0xb13291['ListId'],_0xb13291[_0xb992('0x54')]||null,NOW,NOW);if(_['isNil'](_0xd1a98c[_0xb992('0x31')])){_0x57276d+=_0xb992('0x9a');}_0xa2a8ed[_0xb992('0x1d')](_0x57276d);if(_0xb13291[_0xb992('0x92')]&&_0xb13291[_0xb992('0x92')][_0xb992('0x1a')]){_0xa2a8ed['push'](insertCmContact(_0xb13291[_0xb992('0x33')],_0x5b2bef,_0xb13291[_0xb992('0x92')],_0xd1a98c));_0xa2a8ed[_0xb992('0x1d')]('DROP\x20TABLE\x20'+_0x5b2bef+';');}BPromise[_0xb992('0x9b')](_0xa2a8ed,handleQuery)[_0xb992('0x19')](function(_0x3cb5c6){BPromise[_0xb992('0x1b')]([handleAdditionalPhones()])[_0xb992('0x19')](function(){_0xa2a8ed=[];for(var _0x388cc6=0x0;_0x388cc6\x20\x20','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','SIGINT','uncaughtException','path','lodash','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.id'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xd714,0x1e4));var _0x4d71=function(_0x592307,_0x2b8719){_0x592307=_0x592307-0x0;var _0x244eb8=_0xd714[_0x592307];return _0x244eb8;};'use strict';var fs=require('fs');var path=require(_0x4d71('0x0'));var _=require(_0x4d71('0x1'));var Papa=require('papaparse');var util=require(_0x4d71('0x2'));var BPromise=require(_0x4d71('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x4d71('0x4'));var db=require(_0x4d71('0x5'))['db'];var config=require(_0x4d71('0x6'));var shared=require(_0x4d71('0x7'));var logger=require(_0x4d71('0x8'))(_0x4d71('0x9'));config[_0x4d71('0xa')]=_[_0x4d71('0xb')](config[_0x4d71('0xa')],{'host':_0x4d71('0xc'),'port':0x18eb});var socket=require(_0x4d71('0xd'))(new Redis(config[_0x4d71('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4d71('0xe')](_0x4d71('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4d71('0xe')](_0x4d71('0xf'));function isEmail(_0x4cd105){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))*$/[_0x4d71('0x10')](_0x4cd105);}function selectNotIn(_0x30d21b,_0x26babc,_0xa63f55,_0x4fb5f9,_0x2c1a57){return squel[_0x4d71('0x11')]()['field'](_0x4d71('0x12'))[_0x4d71('0x13')](_0x4fb5f9)[_0x4d71('0x14')](_0x26babc,null,_0x26babc+_0x4d71('0x15')+_0x4fb5f9+'.'+_0xa63f55)[_0x4d71('0x16')](_0x4fb5f9+'.'+_0xa63f55+_0x4d71('0x17')+_0x30d21b+'.'+_0xa63f55)['where'](_0x26babc+_0x4d71('0x18')+_0x2c1a57[_0x4d71('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x21af4c,_0x4cec7e){promisesAdditionalPhones=[];return db[_0x4d71('0x19')][_0x4d71('0x1a')]({'raw':!![],'attributes':['id',_0x4d71('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4d71('0x1c')](function(_0x4f02d1){if(_0x4f02d1!==null){var _0x484a18=[];for(var _0x511342=0x0;_0x511342<_0x4f02d1[_0x4d71('0x1d')];_0x511342++){var _0x349337=_0x4f02d1[_0x511342];_0x484a18[_0x4d71('0x1e')](insertAdditionalPhones(_0x349337));}}Promise[_0x4d71('0x1f')](_0x484a18)[_0x4d71('0x1c')](function(){_0x21af4c({'val':0x1});});});});}function insertAdditionalPhones(_0x591968){return new Promise(function(_0x9e1747,_0x2e9ccf){var _0x13bb1e=_0x591968['AdditionalPhones'];var _0x163b33=_0x13bb1e['split'](';');var _0x25ac24=[];orderBy=0x0;for(var _0x58a6f4=0x0;_0x58a6f4<_0x163b33[_0x4d71('0x1d')];_0x58a6f4++){_0x25ac24[_0x4d71('0x1e')](splitAdditionalPhone(_0x591968['id'],_0x163b33[_0x58a6f4]));}Promise[_0x4d71('0x1f')](_0x25ac24)[_0x4d71('0x1c')](function(){_0x9e1747({'val':_0x163b33[_0x4d71('0x1d')]});});});}function splitAdditionalPhone(_0x38120b,_0x26d4b1){return new Promise(function(_0x3c080d,_0x590234){var _0xe2bb99=_0x26d4b1[_0x4d71('0x20')](':');var _0x254eb0=_0xe2bb99[0x0];var _0x43f1a1=_0xe2bb99[0x1];if(!_[_0x4d71('0x21')](_0x43f1a1)){var _0x127224=_0x43f1a1[_0x4d71('0x20')]('|');var _0x57e4c4=[];for(var _0xc0e985=0x0;_0xc0e985<_0x127224[_0x4d71('0x1d')];_0xc0e985++){if(_0x127224[_0xc0e985]!==''){var _0x1cbd09=_[_0x4d71('0x22')](promisesAdditionalPhones,{'contactId':_0x38120b,'phone':_0x127224[_0xc0e985]});if(_0x1cbd09[_0x4d71('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x4d71('0x1e')]({'contactId':_0x38120b,'contactTypeId':_0x254eb0,'phone':_0x127224[_0xc0e985],'orderBy':orderBy});}}}_0x3c080d({'ok':0x1});}else _0x3c080d({'res':0x0});});}function createAdditionalPhone(_0x563cc9,_0x249540,_0x121eab,_0x37d987){var _0x274037='';var _0x378628='';var _0x370199=_0x121eab[_0x4d71('0x20')]('§');_0x274037=_0x370199[0x0];if(_0x370199[_0x4d71('0x1d')]==0x2)_0x378628=_0x370199[0x1];return new Promise(function(_0x3c4d0a,_0x21f6f2){return db[_0x4d71('0x23')][_0x4d71('0x24')]({'where':{'CmContactId':_0x563cc9,'item':_0x274037}})[_0x4d71('0x1c')](function(_0x2f673d){if(_0x2f673d){return db[_0x4d71('0x23')][_0x4d71('0x25')]({'ItemTypeId':_0x249540,'description':_0x378628,'OrderBy':_0x37d987},{'where':{'CmContactId':_0x563cc9,'item':_0x274037}})[_0x4d71('0x1c')](function(_0x4fbfcb){_0x3c4d0a({'res':_0x4d71('0x26')});});}else{return db[_0x4d71('0x23')][_0x4d71('0x27')]({'CmContactId':_0x563cc9,'item':_0x274037,'description':_0x378628,'ItemTypeId':_0x249540,'OrderBy':_0x37d987,'ItemClass':_0x4d71('0x28')})[_0x4d71('0x1c')](function(_0x4cd811){_0x3c4d0a({'res':'inserted'});});}});});}function insertCmHopper(_0x557a10,_0x13d485,_0x44895a,_0x5340cd,_0x3cb8a8){var _0x305ede=[_0x4d71('0x29'),_0x4d71('0x2a'),'cm_contacts.id',_0x4d71('0x2b'),_0x13d485+'.'+_0x5340cd,'cm_contacts.createdAt',_0x4d71('0x2c'),_0x4d71('0x2d'),_0x4d71('0x2e'),'\x22'+_0x3cb8a8+'\x22'];return squel['insert']()[_0x4d71('0x2f')](_0x4d71('0x30'))[_0x4d71('0x31')]([_0x4d71('0x12'),_0x4d71('0x32'),'ContactId',_0x4d71('0x33'),_0x5340cd,_0x4d71('0x34'),_0x4d71('0x35'),'priority',_0x4d71('0x36'),_0x4d71('0x37')],squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x305ede)[_0x4d71('0x13')](_0x13d485)['join'](_0x4d71('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x13d485+'.CmListId')[_0x4d71('0x14')](_0x44895a,null,_0x44895a+_0x4d71('0x15')+_0x13d485+'.'+_0x5340cd)[_0x4d71('0x16')](_0x13d485+'.CmListId\x20=\x20?',_0x557a10)[_0x4d71('0x16')](_0x4d71('0x3a'),NOW)[_0x4d71('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x13d485,_0x44895a,_0x5340cd,'cm_hopper',[_0x4d71('0x3b'),_0x4d71('0x3c')]))[_0x4d71('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x13d485,_0x44895a,_0x5340cd,_0x4d71('0x30'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0xd1b7a0,_0x2b3c5f,_0x2cc46e,_0x1e5620){var _0x14fd27=[_0x4d71('0x29'),_0x4d71('0x3d'),_0x4d71('0x2b'),_0x2b3c5f+'.'+_0x1e5620,_0x4d71('0x3e'),'cm_contacts.updatedAt'];return squel[_0x4d71('0x3f')]()[_0x4d71('0x2f')](_0x4d71('0x40'))[_0x4d71('0x31')]([_0x4d71('0x12'),_0x4d71('0x41'),_0x4d71('0x33'),_0x1e5620,_0x4d71('0x34'),_0x4d71('0x35')],squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x14fd27)[_0x4d71('0x13')](_0x2b3c5f)[_0x4d71('0x14')](_0x4d71('0x39'),null,_0x4d71('0x42')+_0x2b3c5f+_0x4d71('0x43'))[_0x4d71('0x14')](_0x2cc46e,null,_0x2cc46e+'.id\x20=\x20'+_0x2b3c5f+'.'+_0x1e5620)[_0x4d71('0x16')](_0x2b3c5f+_0x4d71('0x44'),_0xd1b7a0)[_0x4d71('0x16')](_0x4d71('0x3a'),NOW)['where'](_0x4d71('0x45'),squel[_0x4d71('0x11')]()[_0x4d71('0x46')](_0x4d71('0x12'))[_0x4d71('0x13')](_0x4d71('0x40'))[_0x4d71('0x16')]('ListId\x20=\x20?',_0xd1b7a0)[_0x4d71('0x16')](_0x1e5620+_0x4d71('0x17')+_0x2b3c5f+'.'+_0x1e5620)))['toString']();}function insertTzCmHopper(_0x31216b,_0x5db6ca,_0x5d23ea,_0x2f91c3,_0x41f205,_0x34e7e3){var _0x5ecd9a=[_0x4d71('0x29'),_0x4d71('0x47')+_0x34e7e3+'.offset-cm_contacts.utcOffset\x20minute)',_0x4d71('0x3d'),_0x4d71('0x2b'),_0x5db6ca+'.'+_0x2f91c3,_0x4d71('0x3e'),_0x4d71('0x2c'),_0x4d71('0x2d'),'cm_contacts.UserId','\x22'+_0x41f205+'\x22'];var _0x367596=squel[_0x4d71('0x3f')]()[_0x4d71('0x2f')]('cm_hopper')[_0x4d71('0x31')](['phone','scheduledat',_0x4d71('0x41'),_0x4d71('0x33'),_0x2f91c3,_0x4d71('0x34'),'updatedAt',_0x4d71('0x48'),_0x4d71('0x36'),_0x4d71('0x37')],squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x5ecd9a)[_0x4d71('0x13')](_0x5db6ca)[_0x4d71('0x14')](_0x4d71('0x39'),null,_0x4d71('0x42')+_0x5db6ca+_0x4d71('0x43'))[_0x4d71('0x14')](_0x5d23ea,null,_0x5d23ea+_0x4d71('0x15')+_0x5db6ca+'.'+_0x2f91c3)[_0x4d71('0x14')](_0x34e7e3,null,_0x34e7e3+_0x4d71('0x15')+_0x5db6ca+'.'+_0x2f91c3)[_0x4d71('0x16')](_0x5db6ca+_0x4d71('0x44'),_0x31216b)[_0x4d71('0x16')](_0x4d71('0x3a'),NOW)[_0x4d71('0x16')](_0x4d71('0x45'),selectNotIn(_0x5db6ca,_0x5d23ea,_0x2f91c3,_0x4d71('0x30'),['\x22always\x22',_0x4d71('0x3c')]))['where'](_0x4d71('0x45'),selectNotIn(_0x5db6ca,_0x5d23ea,_0x2f91c3,_0x4d71('0x30'),[_0x4d71('0x3b')])))[_0x4d71('0x49')]();return _0x367596;}function insertTzCmHopperBlack(_0x38e682,_0x52d002,_0xb4aa0c,_0xd5aa94){var _0x4c56aa=[_0x4d71('0x29'),'cm_contacts.id','cm_contacts.ListId',_0x52d002+'.'+_0xd5aa94,_0x4d71('0x3e'),'cm_contacts.updatedAt'];return squel[_0x4d71('0x3f')]()[_0x4d71('0x2f')]('cm_hopper_black')[_0x4d71('0x31')]([_0x4d71('0x12'),'ContactId',_0x4d71('0x33'),_0xd5aa94,_0x4d71('0x34'),_0x4d71('0x35')],squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x4c56aa)[_0x4d71('0x13')](_0x52d002)['join'](_0x4d71('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x52d002+_0x4d71('0x43'))[_0x4d71('0x14')](_0xb4aa0c,null,_0xb4aa0c+'.id\x20=\x20'+_0x52d002+'.'+_0xd5aa94)[_0x4d71('0x16')](_0x52d002+'.CmListId\x20=\x20?',_0x38e682)[_0x4d71('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x4d71('0x11')]()[_0x4d71('0x46')]('phone')[_0x4d71('0x13')]('cm_hopper_black')[_0x4d71('0x16')](_0x4d71('0x4a'),_0x38e682)[_0x4d71('0x16')](_0xd5aa94+'\x20=\x20'+_0x52d002+'.'+_0xd5aa94)))[_0x4d71('0x49')]();}function insertCmHopperAdditionalPhones(_0xf46d26){var _0x715762=[_0x4d71('0x4b'),_0x4d71('0x4c'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x4d71('0x4d')];return squel[_0x4d71('0x3f')]()[_0x4d71('0x2f')](_0x4d71('0x4e'))[_0x4d71('0x31')]([_0x4d71('0x4f'),'phone',_0x4d71('0x50'),_0x4d71('0x34'),_0x4d71('0x35')],squel['select']()['fields'](_0x715762)[_0x4d71('0x13')](_0x4d71('0x30'))[_0x4d71('0x14')](_0x4d71('0x39'),null,_0x4d71('0x51'))[_0x4d71('0x14')]('cm_contact_has_items',null,_0x4d71('0x52'))[_0x4d71('0x16')](_0x4d71('0x53'),_0xf46d26)['where'](_0x4d71('0x3a'),NOW))['toString']();}function insertCmContact(_0x3f982e,_0x325f0b,_0x5cbd3e,_0x4a9698){var _0x28afcd=_[_0x4d71('0x54')](_[_0x4d71('0x55')](_0x4a9698),[_0x4d71('0x33'),_0x4d71('0x56'),_0x4d71('0x34'),'updatedAt']);return squel['insert']()[_0x4d71('0x2f')](_0x4d71('0x39'))[_0x4d71('0x31')](_0x28afcd,squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x28afcd)['from'](_0x325f0b)[_0x4d71('0x16')]('('+_0x5cbd3e['join'](',')+_0x4d71('0x57'),squel[_0x4d71('0x11')]()[_0x4d71('0x38')](_0x5cbd3e)[_0x4d71('0x13')](_0x4d71('0x39'))[_0x4d71('0x16')](_0x4d71('0x4a'),_0x3f982e)[_0x4d71('0x16')](_0x4d71('0x58')))['where']('id\x20IN\x20?',squel[_0x4d71('0x11')]()[_0x4d71('0x46')](_0x4d71('0x59'),_0x4d71('0x5a'))[_0x4d71('0x13')](_0x325f0b)[_0x4d71('0x5b')](_0x5cbd3e[_0x4d71('0x14')](','))))[_0x4d71('0x49')]();}function handleStop(){logger[_0x4d71('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x121d30){logger['error'](_0x121d30['message']);process['exit'](0x1);}function handleError(_0x4e2f16,_0x4af555){stats['errors'][_0x4d71('0x1e')]({'name':_0x4af555[_0x4d71('0x5d')],'message':_0x4af555[_0x4d71('0x5e')],'row':_0x4e2f16});}function handleQuery(_0xab6ad7){logger[_0x4d71('0x5c')](_0xab6ad7);return db[_0x4d71('0x5f')][_0x4d71('0x60')](_0xab6ad7)[_0x4d71('0x61')](function(_0x3d6750){results['push'](_0x3d6750);})['catch'](function(_0x19dd2d){logger[_0x4d71('0x62')](_0x19dd2d[_0x4d71('0x5e')]);});}function updateTzCampaigns(_0x2a243e){return new Promise(function(_0x172a20,_0x2e2153){var _0x287cf5=squel[_0x4d71('0x11')]()[_0x4d71('0x38')]([_0x4d71('0x63'),'campaigns.dialTimezone'])[_0x4d71('0x13')]('campaigns')['join'](_0x4d71('0x64'),null,_0x4d71('0x65'))[_0x4d71('0x16')]('campaigns_has_cm_lists.CmListId='+_0x2a243e);db['sequelize'][_0x4d71('0x60')](_0x287cf5['toString']())['spread'](function(_0x2fe8d2){var _0x20a3ca=[];for(var _0x1a9c58=0x0;_0x1a9c58<_0x2fe8d2[_0x4d71('0x1d')];_0x1a9c58++){_0x20a3ca['push'](getTimezoneData(_0x2fe8d2[_0x1a9c58],tmp_campaigns));}BPromise[_0x4d71('0x1f')](_0x20a3ca)[_0x4d71('0x1c')](function(){_0x172a20({'val':0x1});});})[_0x4d71('0x66')](function(_0xdf0367){logger['error'](_0xdf0367[_0x4d71('0x5e')]);_0x172a20({'val':0x0});});});}function updateTzVoiceQueues(_0x2f1d8d){return new Promise(function(_0x380204,_0x15c890){var _0x1bff29=squel[_0x4d71('0x11')]()[_0x4d71('0x38')]([_0x4d71('0x67'),'voice_queues.dialTimezone'])[_0x4d71('0x13')](_0x4d71('0x68'))['join'](_0x4d71('0x69'),null,_0x4d71('0x6a'))['where'](_0x4d71('0x6b')+_0x2f1d8d);db[_0x4d71('0x5f')][_0x4d71('0x60')](_0x1bff29[_0x4d71('0x49')]())[_0x4d71('0x61')](function(_0x40461e){var _0x36f231=[];for(var _0x8b41ad=0x0;_0x8b41ad<_0x40461e['length'];_0x8b41ad++){_0x36f231['push'](getTimezoneData(_0x40461e[_0x8b41ad],tmp_voice_queues));}BPromise[_0x4d71('0x1f')](_0x36f231)[_0x4d71('0x1c')](function(){_0x380204({'val':0x1});});})['catch'](function(_0x31bb1d){logger[_0x4d71('0x62')](_0x31bb1d[_0x4d71('0x5e')]);_0x380204({'val':0x0});});});}function getTimezoneData(_0x49b426,_0x495ec2){return new Promise(function(_0x252c94,_0x430336){var _0x3b9f57=shared[_0x4d71('0x6c')];var _0x15f1df=_0x3b9f57[_0x49b426[_0x4d71('0x6d')]];if(_[_0x4d71('0x21')](_0x15f1df)){_0x252c94({'ret':0x1});}else{var _0x2f8ae3=_0x15f1df[_0x4d71('0x6e')];var _0x4231d9=squel['insert']()[_0x4d71('0x2f')](_0x495ec2)[_0x4d71('0x6f')]('id',_0x49b426['id'])[_0x4d71('0x6f')]('offset',_0x2f8ae3)[_0x4d71('0x6f')](_0x4d71('0x6d'),_0x49b426[_0x4d71('0x6d')])['toString']();return db[_0x4d71('0x5f')][_0x4d71('0x60')](_0x4231d9)[_0x4d71('0x61')](function(_0x59a160){_0x252c94({'ret':0x1});})['catch'](function(_0x2744e6){logger[_0x4d71('0x62')](_0x2744e6[_0x4d71('0x5e')]);_0x430336({'ret':0x1});});}});}function handleTZQuery(_0x373584){logger['info'](_0x373584);return db['sequelize'][_0x4d71('0x60')](_0x373584)[_0x4d71('0x61')](function(_0x3a2b2c){})[_0x4d71('0x66')](function(_0x2f4c91){logger[_0x4d71('0x62')](_0x2f4c91[_0x4d71('0x5e')]);});}function main(_0x1ef1a3,_0x50293d,_0x4e37ab,_0x522537){logger['info'](_0x4d71('0x70'),_0x1ef1a3,JSON[_0x4d71('0x71')](_0x50293d));process[_0x4d71('0x72')](_0x4d71('0x73'));var _0x1011d9=_0x50293d[_0x4d71('0x74')];var _0x4ce187=_[_0x4d71('0x75')](_0x1011d9);var _0x44f8ca=_0x50293d[_0x4d71('0x76')];var _0x4252c9=path[_0x4d71('0x14')](config[_0x4d71('0x77')],_0x4d71('0x78'),_0x44f8ca+_0x4d71('0x79'));hasTZ=_['keys'](_0x1011d9)[_0x4d71('0x7a')](_0x4d71('0x6d'));var _0x37d5af=_[_0x4d71('0x55')](_0x1011d9)[_0x4d71('0x14')]();logger[_0x4d71('0x5c')](_0x4d71('0x7b'),_0x37d5af);db[_0x4d71('0x7c')][_0x4d71('0x1a')]({'raw':!![],'attributes':['id',_0x4d71('0x7d')]})[_0x4d71('0x1c')](function(_0x3f25ab){for(var _0x10ffd1=0x0;_0x10ffd1<_0x3f25ab[_0x4d71('0x1d')];_0x10ffd1++){if(_0x3f25ab[_0x10ffd1][_0x4d71('0x7d')]in _0x1011d9){contactItemTypes[_0x4d71('0x1e')](_0x3f25ab[_0x10ffd1]);delete _0x4ce187[_0x3f25ab[_0x10ffd1][_0x4d71('0x7d')]];hasAdditionalPhones=!![];}for(var _0x58e319 in _0x1011d9){if(_0x3f25ab[_0x10ffd1][_0x4d71('0x7d')]+_0x4d71('0x7e')===_0x58e319){phoneDescriptions[_0x4d71('0x1e')]({'itemTypeId':_0x3f25ab[_0x10ffd1]['id'],'description':_0x58e319});delete _0x4ce187[_0x58e319];}}}if(hasAdditionalPhones)_0x4ce187['AdditionalPhones']='';var _0x345a0e=_[_0x4d71('0x55')](_0x4ce187)[_0x4d71('0x14')]();logger['info'](_0x4d71('0x7b'),_0x345a0e);fs[_0x4d71('0x7f')](_0x4252c9,_0x345a0e+'\x0a');Papa[_0x4d71('0x80')](fs[_0x4d71('0x81')](_0x1ef1a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb8c957,_0x40c609){try{for(var _0x2be61c=0x0,_0x2990fa=[];_0x2be61c<_0xb8c957[_0x4d71('0x82')][_0x4d71('0x1d')];_0x2be61c++){stats[_0x4d71('0x83')]+=0x1;if(_0xb8c957[_0x4d71('0x84')][_0x2be61c]){handleError(_0xb8c957['data'][_0x2be61c],_0xb8c957['errors'][_0x2be61c]);}else{var _0x47e8d7=[];var _0x550b37=[];var _0xd7a6cc={};for(var _0x4abd9f in _0x1011d9){let _0x1b61d1=contactItemTypes[_0x4d71('0x85')](_0x8cc2d1=>_0x8cc2d1[_0x4d71('0x7d')]===_0x4abd9f);let _0x48dd2c=contactItemTypes[_0x4d71('0x85')](_0x570529=>_0x570529[_0x4d71('0x7d')]+_0x4d71('0x7e')===_0x4abd9f);if(_['isNil'](_0x1b61d1)&&_[_0x4d71('0x21')](_0x48dd2c)){if(_0x1011d9['hasOwnProperty'](_0x4abd9f)){if(_0xb8c957[_0x4d71('0x82')][_0x2be61c][_0x1011d9[_0x4abd9f]]){var _0x481787=_[_0x4d71('0x86')](_0xb8c957[_0x4d71('0x82')][_0x2be61c][_0x1011d9[_0x4abd9f]][_0x4d71('0x87')](/"/g,'\x27'));switch(_0x4abd9f){case _0x4d71('0x32'):var _0x475638=moment(_0x481787,_0x4d71('0xf'),!![]);if(_0x475638[_0x4d71('0x88')]()){_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x481787+'\x22');}else{_0x47e8d7[_0x4d71('0x1e')](_0x4d71('0x89'));}break;case'priority':var _0x522714=parseInt(_0x481787);_0x481787=_[_0x4d71('0x8a')](_0x522714)||_0x522714<0x0||_0x522714>0x4?_0x522537?0x3:0x2:_0x522714;_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x481787+'\x22');break;case _0x4d71('0x36'):var _0x39fe52=parseInt(_0x481787);if(_['isNumber'](_0x39fe52)&&_[_0x4d71('0x7a')](_0x4e37ab,_0x39fe52)){_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x39fe52+'\x22');}else{_0x47e8d7[_0x4d71('0x1e')](_0x4d71('0x8b'));}break;case _0x4d71('0x8c'):if(isEmail(_0x481787)){_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x481787+'\x22');}else{_0x47e8d7[_0x4d71('0x1e')](_0x4d71('0x8d'));}break;case'dateOfBirth':var _0xb79fdd=moment(_0x481787,_0x4d71('0x8e'),!![]);if(_0xb79fdd['isValid']()){_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x481787+'\x22');}else{_0x47e8d7['push'](_0x4d71('0x8f'));}break;case _0x4d71('0x6d'):var _0x43a06b=shared[_0x4d71('0x6c')];var _0xafa4ad=_0x43a06b[_0x481787];if(!_['isNil'](_0xafa4ad)){var _0x7c963d=_0xafa4ad[_0x4d71('0x6e')];_0x2990fa['push']('\x22'+_0x481787+'\x22');_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x7c963d+'\x22');}break;default:_0x2990fa['push']('\x22'+_0x481787+'\x22');}}else{switch(_0x4abd9f){case _0x4d71('0x90'):case _0x4d71('0x12'):_0x47e8d7[_0x4d71('0x1e')](_0x4abd9f+_0x4d71('0x91'));break;default:_0x2990fa[_0x4d71('0x1e')]('\x22\x22');}}}}else{var _0x2edf8d='';if(!_[_0x4d71('0x21')](_0x1b61d1)){if(!_0xd7a6cc[_0x4d71('0x92')](_0x1b61d1['id'])){if(!_[_0x4d71('0x21')](_0xb8c957[_0x4d71('0x82')][_0x2be61c][_0x1011d9[_0x4abd9f]])){var _0x481787=_[_0x4d71('0x86')](_0xb8c957[_0x4d71('0x82')][_0x2be61c][_0x1011d9[_0x4abd9f]][_0x4d71('0x87')](/"/g,'\x27'));var _0x1bf0b7=phoneDescriptions[_0x4d71('0x85')](_0x39fa08=>_0x39fa08[_0x4d71('0x93')]===_0x1b61d1['id']);if(!_['isNil'](_0x1bf0b7)){var _0x4ec407=_[_0x4d71('0x86')](_0xb8c957[_0x4d71('0x82')][_0x2be61c][_0x1011d9[_0x1bf0b7[_0x4d71('0x94')]]][_0x4d71('0x87')](/"/g,'\x27'));if(!_[_0x4d71('0x21')](_0x4ec407))_0x481787=_0x481787+'§'+_0x4ec407;}if(_0x2edf8d=='')_0x2edf8d=_0x481787;else _0x2edf8d+='|'+_0x481787;}_0x550b37[_0x4d71('0x1e')](_0x1b61d1['id']+':'+_0x2edf8d);_0xd7a6cc[_0x1b61d1['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2990fa[_0x4d71('0x1e')]('\x22'+_0x550b37[_0x4d71('0x14')](';')+'\x22');}if(_0x47e8d7['length']){handleError(_0xb8c957['data'][_0x2be61c],{'code':'SystemRow','message':_0x47e8d7[_0x4d71('0x14')]()});}else{fs[_0x4d71('0x95')](_0x4252c9,_0x2990fa['join']()+'\x0a');}_0x2990fa=[];}if(!(stats['rows']%0xc8)){socket[_0x4d71('0x96')]('contact:import:'+_0x44f8ca,stats);stats[_0x4d71('0x84')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x40c609[_0x4d71('0x97')]();}}catch(_0x4efd6b){handleError(_0xb8c957[_0x4d71('0x82')][_0x2be61c],{'code':_0x4d71('0x98'),'message':_0x4efd6b[_0x4d71('0x5e')]});logger[_0x4d71('0x62')]('step',_0x4efd6b['message']);}},'complete':function(){try{var _0x392293=[];var _0x407446=[];var _0x145e51=_0x4d71('0x39');if(_0x50293d['duplicates']&&_0x50293d[_0x4d71('0x99')][_0x4d71('0x1d')]){_0x145e51=_0x4d71('0x9a')+_0x44f8ca;_0x392293[_0x4d71('0x1e')](_0x4d71('0x9b')+_0x145e51+_0x4d71('0x9c'));}tmp_campaigns='campaigns_'+_0x44f8ca;tmp_voice_queues=_0x4d71('0x9d')+_0x44f8ca;_0x407446['push']('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x407446[_0x4d71('0x1e')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x4d71('0x9e')](_0x407446,handleTZQuery)['then'](function(_0x4dd963){updateTzCampaigns(_0x50293d[_0x4d71('0x33')])['then'](function(_0x1eee3f){updateTzVoiceQueues(_0x50293d['ListId'])[_0x4d71('0x1c')](function(_0x591488){if(hasTZ)_0x345a0e=_0x345a0e['replace']('dialTimezone','dialTimezone,utcOffset');var _0x33ff81=util[_0x4d71('0xe')]('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',_0x4252c9,_0x145e51,_0x345a0e,_0x50293d['ListId'],_0x50293d[_0x4d71('0x56')]||null,NOW,NOW);if(_[_0x4d71('0x21')](_0x1011d9['scheduledat'])){_0x33ff81+=',\x20scheduledAt\x20=\x20NOW()';}_0x392293[_0x4d71('0x1e')](_0x33ff81);if(_0x50293d['duplicates']&&_0x50293d[_0x4d71('0x99')][_0x4d71('0x1d')]){_0x392293[_0x4d71('0x1e')](insertCmContact(_0x50293d[_0x4d71('0x33')],_0x145e51,_0x50293d[_0x4d71('0x99')],_0x1011d9));_0x392293['push']('DROP\x20TABLE\x20'+_0x145e51+';');}BPromise[_0x4d71('0x9e')](_0x392293,handleQuery)['then'](function(_0x3e3126){BPromise[_0x4d71('0x1f')]([handleAdditionalPhones()])[_0x4d71('0x1c')](function(){_0x392293=[];for(var _0x3dab5c=0x0;_0x3dab5c\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','bluebird'];(function(_0x1bf8b1,_0x1b11cd){var _0x37fb94=function(_0x33a62c){while(--_0x33a62c){_0x1bf8b1['push'](_0x1bf8b1['shift']());}};_0x37fb94(++_0x1b11cd);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3bc4be,_0x43adf0){_0x3bc4be=_0x3bc4be-0x0;var _0x318eac=_0xb03e[_0x3bc4be];return _0x318eac;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xeb03('0x0'));var Papa=require(_0xeb03('0x1'));var util=require(_0xeb03('0x2'));var BPromise=require(_0xeb03('0x3'));var moment=require(_0xeb03('0x4'));var squel=require(_0xeb03('0x5'));var Redis=require(_0xeb03('0x6'));var db=require(_0xeb03('0x7'))['db'];var config=require(_0xeb03('0x8'));var logger=require(_0xeb03('0x9'))(_0xeb03('0xa'));config[_0xeb03('0xb')]=_['defaults'](config[_0xeb03('0xb')],{'host':_0xeb03('0xc'),'port':0x18eb});var socket=require(_0xeb03('0xd'))(new Redis(config[_0xeb03('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xeb03('0xe')](_0xeb03('0xf'));var tempTableName='cm_contacts_temp_'+moment()[_0xeb03('0xe')](_0xeb03('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x14cfa0){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'](_0x14cfa0);}function selectNotIn(_0x31af2c,_0x48af4f,_0x2388eb,_0x218c41,_0x3de728){return squel[_0xeb03('0x11')]()[_0xeb03('0x12')](_0xeb03('0x13'))[_0xeb03('0x14')](_0x218c41)[_0xeb03('0x15')](_0x48af4f,null,_0x48af4f+_0xeb03('0x16')+_0x218c41+'.'+_0x2388eb)[_0xeb03('0x17')](_0x218c41+'.'+_0x2388eb+_0xeb03('0x18')+_0x31af2c+'.'+_0x2388eb)[_0xeb03('0x17')](_0x48af4f+'.dialCheckDuplicateType\x20IN\x20('+_0x3de728[_0xeb03('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x100bef,_0x372c71){promisesAdditionalPhones=[];promisesContact=[];return db[_0xeb03('0x19')]['query'](_0xeb03('0x1a')+tempTableName)[_0xeb03('0x1b')](function(_0x3f26ef){if(_0x3f26ef!==null){var _0x478989=[];for(var _0x7ce874=0x0;_0x7ce874<_0x3f26ef[_0xeb03('0x1c')];_0x7ce874++){var _0x4095c3=_0x3f26ef[_0x7ce874];if(!_[_0xeb03('0x1d')](_0x4095c3[_0xeb03('0x13')])){if(!_[_0xeb03('0x1d')](_0x4095c3[_0xeb03('0x1e')]))_0x478989[_0xeb03('0x1f')](insertAdditionalPhones(_0x4095c3));promisesContact[_0xeb03('0x1f')]({'contact':_0x4095c3});}}}Promise[_0xeb03('0x20')](_0x478989)[_0xeb03('0x21')](function(){_0x100bef({'val':0x1});});})[_0xeb03('0x22')](function(_0x2443d9){logger[_0xeb03('0x23')](_0x2443d9['message']);});});}function insertAdditionalPhones(_0x1bea3f){return new Promise(function(_0x3855dd,_0x413d3e){var _0x391729=_0x1bea3f[_0xeb03('0x1e')];if(_[_0xeb03('0x1d')](_0x391729))_0x413d3e({'val':0x0});else{var _0xb98dc1=_0x391729[_0xeb03('0x24')](';');var _0x3c3d09=[];orderBy=0x0;for(var _0x5a704b=0x0;_0x5a704b<_0xb98dc1[_0xeb03('0x1c')];_0x5a704b++){_0x3c3d09[_0xeb03('0x1f')](splitAdditionalPhone(_0x1bea3f['id'],_0xb98dc1[_0x5a704b]));}Promise[_0xeb03('0x20')](_0x3c3d09)[_0xeb03('0x21')](function(){_0x3855dd({'val':_0xb98dc1[_0xeb03('0x1c')]});});}});}function splitAdditionalPhone(_0x5dcda3,_0x638353){return new Promise(function(_0x406864,_0x16cd4){var _0x20efa8=_0x638353[_0xeb03('0x24')](':');var _0x119697=_0x20efa8[0x0];var _0xb04f34=_0x20efa8[0x1];if(_0xb04f34!==''){var _0x3f68f3=_0xb04f34[_0xeb03('0x24')]('|');var _0x4984f6=[];for(var _0x832372=0x0;_0x832372<_0x3f68f3[_0xeb03('0x1c')];_0x832372++){if(_0x3f68f3[_0x832372]!==''){var _0x2683f9=_[_0xeb03('0x25')](promisesAdditionalPhones,{'contactId':_0x5dcda3,'phone':_0x3f68f3[_0x832372]});if(_0x2683f9['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5dcda3,'contactTypeId':_0x119697,'phone':_0x3f68f3[_0x832372],'orderBy':orderBy});}}}_0x406864({'ok':0x1});}else _0x406864({'res':0x0});});}function createAdditionalPhone(_0x1064a5,_0x49e449,_0x31a622,_0x8bd544){var _0x160a37='';var _0x5db8bb='';var _0xd4c8ec=_0x31a622['split']('§');_0x160a37=_0xd4c8ec[0x0];if(_0xd4c8ec['length']==0x2)_0x5db8bb=_0xd4c8ec[0x1];return new Promise(function(_0x49e316,_0x538d19){return db[_0xeb03('0x26')][_0xeb03('0x27')]({'where':{'CmContactId':_0x1064a5,'item':_0x160a37}})['then'](function(_0x528479){if(_0x528479){return db['CmContactHasItem']['update']({'ItemTypeId':_0x49e449,'description':_0x5db8bb,'OrderBy':_0x8bd544},{'where':{'CmContactId':_0x1064a5,'item':_0x160a37}})[_0xeb03('0x21')](function(_0x3655c3){_0x49e316({'res':_0xeb03('0x28')});});}else{return db[_0xeb03('0x26')][_0xeb03('0x29')]({'CmContactId':_0x1064a5,'item':_0x160a37,'ItemTypeId':_0x49e449,'description':_0x5db8bb,'OrderBy':_0x8bd544,'ItemClass':'PHONE'})[_0xeb03('0x21')](function(_0x543a29){_0x49e316({'res':_0xeb03('0x2a')});});}});});}function updateContact(_0x13a016){return new Promise(function(_0x19ceae,_0x2708d0){var _0x29a584=_0x13a016['id'];delete _0x13a016['id'];return db[_0xeb03('0x2b')][_0xeb03('0x2c')](_0x13a016,{'where':{'id':_0x29a584}})[_0xeb03('0x21')](function(_0x552c86){updatedRows+=0x1;return db[_0xeb03('0x2d')]['update']({'phone':_0x13a016[_0xeb03('0x13')]},{'where':{'ContactId':_0x29a584}})[_0xeb03('0x21')](function(_0x9f6e1b){_0x19ceae({'ret':'OK'});});});});}function insertCmHopper(_0x2bf8be,_0x911b9f,_0x4375fe,_0x5a3915,_0x155b53){var _0x4bfd68=['cm_contacts.phone','cm_contacts.scheduledat',_0xeb03('0x2e'),_0xeb03('0x2f'),_0x911b9f+'.'+_0x5a3915,_0xeb03('0x30'),_0xeb03('0x31'),_0xeb03('0x32'),'cm_contacts.UserId','\x22'+_0x155b53+'\x22'];return squel[_0xeb03('0x33')]()[_0xeb03('0x34')](_0xeb03('0x35'))['fromQuery'](['phone',_0xeb03('0x36'),_0xeb03('0x37'),_0xeb03('0x38'),_0x5a3915,'createdAt',_0xeb03('0x39'),_0xeb03('0x3a'),'UserId','recallme'],squel[_0xeb03('0x11')]()[_0xeb03('0x3b')](_0x4bfd68)['from'](_0x911b9f)[_0xeb03('0x15')](_0xeb03('0x3c'),null,_0xeb03('0x3d')+_0x911b9f+_0xeb03('0x3e'))[_0xeb03('0x15')](_0x4375fe,null,_0x4375fe+_0xeb03('0x16')+_0x911b9f+'.'+_0x5a3915)[_0xeb03('0x17')](_0x911b9f+_0xeb03('0x3f'),_0x2bf8be)[_0xeb03('0x17')](_0xeb03('0x40'),NOW)[_0xeb03('0x17')](_0xeb03('0x41'),selectNotIn(_0x911b9f,_0x4375fe,_0x5a3915,_0xeb03('0x35'),[_0xeb03('0x42'),_0xeb03('0x43')]))[_0xeb03('0x17')](_0xeb03('0x41'),selectNotIn(_0x911b9f,_0x4375fe,_0x5a3915,_0xeb03('0x35'),[_0xeb03('0x42')])))[_0xeb03('0x44')]();}function insertCmHopperBlack(_0x43e530,_0x2f83c3,_0x2879b0,_0x5bb7d9){var _0x53c406=[_0xeb03('0x45'),_0xeb03('0x2e'),_0xeb03('0x2f'),_0x2f83c3+'.'+_0x5bb7d9,_0xeb03('0x30'),_0xeb03('0x31')];return squel[_0xeb03('0x33')]()[_0xeb03('0x34')](_0xeb03('0x46'))['fromQuery']([_0xeb03('0x13'),_0xeb03('0x37'),_0xeb03('0x38'),_0x5bb7d9,_0xeb03('0x47'),_0xeb03('0x39')],squel['select']()['fields'](_0x53c406)[_0xeb03('0x14')](_0x2f83c3)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x2f83c3+_0xeb03('0x3e'))[_0xeb03('0x15')](_0x2879b0,null,_0x2879b0+_0xeb03('0x16')+_0x2f83c3+'.'+_0x5bb7d9)[_0xeb03('0x17')](_0x2f83c3+_0xeb03('0x3f'),_0x43e530)[_0xeb03('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xeb03('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xeb03('0x12')](_0xeb03('0x13'))[_0xeb03('0x14')]('cm_hopper_black')[_0xeb03('0x17')](_0xeb03('0x48'),_0x43e530)[_0xeb03('0x17')](_0x5bb7d9+_0xeb03('0x49'),_0x2f83c3+'.'+_0x5bb7d9)))[_0xeb03('0x44')]();}function insertCmHopperAdditionalPhones(_0x495e26){var _0x21a121=['cm_hopper.id',_0xeb03('0x4a'),_0xeb03('0x4b'),_0xeb03('0x4c'),_0xeb03('0x4d')];return squel[_0xeb03('0x33')]()[_0xeb03('0x34')](_0xeb03('0x4e'))[_0xeb03('0x4f')]([_0xeb03('0x50'),_0xeb03('0x13'),_0xeb03('0x51'),_0xeb03('0x47'),_0xeb03('0x39')],squel[_0xeb03('0x11')]()[_0xeb03('0x3b')](_0x21a121)[_0xeb03('0x14')](_0xeb03('0x35'))[_0xeb03('0x15')](_0xeb03('0x3c'),null,_0xeb03('0x52'))[_0xeb03('0x15')](_0xeb03('0x53'),null,_0xeb03('0x54'))[_0xeb03('0x17')]('cm_hopper.ListId\x20=\x20?',_0x495e26)[_0xeb03('0x17')](_0xeb03('0x40'),NOW))[_0xeb03('0x44')]();}function insertCmContact(_0x5405b4,_0xbbb4dd,_0x3604e8,_0x3a6532){var _0xf7e2b=_[_0xeb03('0x55')](_[_0xeb03('0x56')](_0x3a6532),[_0xeb03('0x38'),_0xeb03('0x57'),_0xeb03('0x47'),_0xeb03('0x39')]);return squel[_0xeb03('0x33')]()[_0xeb03('0x34')](_0xeb03('0x3c'))[_0xeb03('0x4f')](_0xf7e2b,squel['select']()[_0xeb03('0x3b')](_0xf7e2b)[_0xeb03('0x14')](_0xbbb4dd)[_0xeb03('0x17')]('('+_0x3604e8[_0xeb03('0x15')](',')+_0xeb03('0x58'),squel[_0xeb03('0x11')]()[_0xeb03('0x3b')](_0x3604e8)[_0xeb03('0x14')](_0xeb03('0x3c'))[_0xeb03('0x17')]('ListId\x20=\x20?',_0x5405b4))[_0xeb03('0x17')](_0xeb03('0x59'),squel[_0xeb03('0x11')]()[_0xeb03('0x12')]('MIN(id)',_0xeb03('0x5a'))[_0xeb03('0x14')](_0xbbb4dd)[_0xeb03('0x5b')](_0x3604e8[_0xeb03('0x15')](','))))[_0xeb03('0x44')]();}function handleStop(){logger['info'](_0xeb03('0x5c'));stopped=!![];}function handleUncaughtException(_0x10beeb){logger[_0xeb03('0x23')](_0x10beeb['message']);process[_0xeb03('0x5d')](0x1);}function handleError(_0x45dd25,_0x4d9cfc){stats[_0xeb03('0x5e')][_0xeb03('0x1f')]({'name':_0x4d9cfc[_0xeb03('0x5f')],'message':_0x4d9cfc['message'],'row':_0x45dd25});}function handleQuery(_0x31cf3b){logger[_0xeb03('0x60')](_0x31cf3b);return db['sequelize'][_0xeb03('0x61')](_0x31cf3b)[_0xeb03('0x1b')](function(_0x1972fb){results[_0xeb03('0x1f')](_0x1972fb);})[_0xeb03('0x22')](function(_0x38618e){logger[_0xeb03('0x23')](_0x38618e[_0xeb03('0x62')]);});}function main(_0x5527d8,_0x4447b6,_0x50489b,_0xbcc043){logger[_0xeb03('0x60')](_0xeb03('0x63'),_0x5527d8,JSON['stringify'](_0x4447b6));process[_0xeb03('0x64')](_0xeb03('0x65'));var _0x14866f=_0x4447b6[_0xeb03('0x66')];var _0x47c389=_[_0xeb03('0x67')](_0x14866f);var _0x1cdf8e=_0x4447b6['socket_timestamp'];var _0x588f31=path['join'](config[_0xeb03('0x68')],_0xeb03('0x69'),_0x1cdf8e+_0xeb03('0x6a'));logger[_0xeb03('0x60')](_0xeb03('0x6b'),_0x4447b6);db[_0xeb03('0x6c')][_0xeb03('0x6d')]({'raw':!![],'attributes':['id',_0xeb03('0x6e')]})[_0xeb03('0x21')](function(_0x57c435){for(var _0x484398=0x0;_0x484398<_0x57c435[_0xeb03('0x1c')];_0x484398++){if(_0x57c435[_0x484398][_0xeb03('0x6e')]in _0x14866f){contactItemTypes['push'](_0x57c435[_0x484398]);delete _0x47c389[_0x57c435[_0x484398][_0xeb03('0x6e')]];hasAdditionalPhones=!![];}for(var _0x3e003d in _0x14866f){if(_0x57c435[_0x484398][_0xeb03('0x6e')]+_0xeb03('0x6f')===_0x3e003d){phoneDescriptions['push']({'itemTypeId':_0x57c435[_0x484398]['id'],'description':_0x3e003d});delete _0x47c389[_0x3e003d];}}}if(hasAdditionalPhones)_0x47c389['AdditionalPhones']='';var _0x21a182=_[_0xeb03('0x56')](_0x47c389)[_0xeb03('0x15')]();logger[_0xeb03('0x60')](_0xeb03('0x70'),_0x21a182);fs[_0xeb03('0x71')](_0x588f31,_0x21a182+'\x0a');Papa[_0xeb03('0x72')](fs[_0xeb03('0x73')](_0x5527d8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e67a4,_0x296138){try{for(var _0x46fba8=0x0,_0x53b7ac=[];_0x46fba8<_0x2e67a4['data'][_0xeb03('0x1c')];_0x46fba8++){stats['rows']+=0x1;if(_0x2e67a4[_0xeb03('0x5e')][_0x46fba8]){handleError(_0x2e67a4['data'][_0x46fba8],_0x2e67a4[_0xeb03('0x5e')][_0x46fba8]);}else{var _0x59837a=[];var _0x202c26=[];var _0x114109={};for(var _0x5d2e3b in _0x14866f){let _0x34927f=contactItemTypes['find'](_0x45f0aa=>_0x45f0aa['name']===_0x5d2e3b);let _0x375d5c=contactItemTypes['find'](_0x53ed45=>_0x53ed45[_0xeb03('0x6e')]+_0xeb03('0x6f')===_0x5d2e3b);if(_[_0xeb03('0x1d')](_0x34927f)&&_[_0xeb03('0x1d')](_0x375d5c)){if(_0x14866f[_0xeb03('0x74')](_0x5d2e3b)){if(_0x2e67a4[_0xeb03('0x75')][_0x46fba8][_0x14866f[_0x5d2e3b]]){var _0x215759=_['trim'](_0x2e67a4[_0xeb03('0x75')][_0x46fba8][_0x14866f[_0x5d2e3b]][_0xeb03('0x76')](/"/g,'\x27'));switch(_0x5d2e3b){case _0xeb03('0x36'):var _0x331711=moment(_0x215759,_0xeb03('0xf'),!![]);if(_0x331711[_0xeb03('0x77')]()){_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x215759+'\x22');}else{_0x59837a['push'](_0xeb03('0x78'));}break;case _0xeb03('0x3a'):var _0x2920dd=parseInt(_0x215759);_0x215759=_[_0xeb03('0x79')](_0x2920dd)||_0x2920dd<0x0||_0x2920dd>0x4?_0xbcc043?0x3:0x2:_0x2920dd;_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x215759+'\x22');break;case _0xeb03('0x7a'):var _0x3b3f90=parseInt(_0x215759);if(_[_0xeb03('0x7b')](_0x3b3f90)&&_['includes'](_0x50489b,_0x3b3f90)){_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x3b3f90+'\x22');}else{_0x59837a[_0xeb03('0x1f')](_0xeb03('0x7c'));}break;case _0xeb03('0x7d'):if(isEmail(_0x215759)){_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x215759+'\x22');}else{_0x59837a['push'](_0xeb03('0x7e'));}break;case _0xeb03('0x7f'):var _0x25226e=moment(_0x215759,_0xeb03('0x80'),!![]);if(_0x25226e[_0xeb03('0x77')]()){_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x215759+'\x22');}else{_0x59837a[_0xeb03('0x1f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x215759+'\x22');}}else{switch(_0x5d2e3b){case _0xeb03('0x81'):case _0xeb03('0x13'):_0x59837a[_0xeb03('0x1f')](_0x5d2e3b+_0xeb03('0x82'));break;default:_0x53b7ac['push']('\x22\x22');}}}}else{var _0x339bf1='';if(!_[_0xeb03('0x1d')](_0x34927f)){if(!_0x114109[_0xeb03('0x74')](_0x34927f['id'])){for(var _0x43d5f5=0x0;_0x43d5f5<_0x14866f[_0x5d2e3b][_0xeb03('0x1c')];_0x43d5f5++){var _0x215759=_[_0xeb03('0x83')](_0x2e67a4['data'][_0x46fba8][_0x14866f[_0x5d2e3b][_0x43d5f5]][_0xeb03('0x76')](/"/g,'\x27'));var _0xe517f9=phoneDescriptions[_0xeb03('0x84')](_0x433780=>_0x433780[_0xeb03('0x85')]===_0x34927f['id']);if(!_[_0xeb03('0x1d')](_0xe517f9)){var _0x5e3318=_[_0xeb03('0x83')](_0x2e67a4[_0xeb03('0x75')][_0x46fba8][_0x14866f[_0xe517f9[_0xeb03('0x86')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xeb03('0x1d')](_0x5e3318))_0x215759=_0x215759+'§'+_0x5e3318;}if(_0x339bf1=='')_0x339bf1=_0x215759;else _0x339bf1+='|'+_0x215759;}_0x202c26[_0xeb03('0x1f')](_0x34927f['id']+':'+_0x339bf1);_0x114109[_0x34927f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53b7ac[_0xeb03('0x1f')]('\x22'+_0x202c26[_0xeb03('0x15')](';')+'\x22');}if(_0x59837a[_0xeb03('0x1c')]){handleError(_0x2e67a4[_0xeb03('0x75')][_0x46fba8],{'code':_0xeb03('0x87'),'message':_0x59837a['join']()});}else{fs['appendFileSync'](_0x588f31,_0x53b7ac[_0xeb03('0x15')]()+'\x0a');}_0x53b7ac=[];}if(!(stats[_0xeb03('0x88')]%0xc8)){socket[_0xeb03('0x89')](_0xeb03('0x8a')+_0x1cdf8e,stats);stats['errors']=[];}}if(stopped){logger[_0xeb03('0x60')](_0xeb03('0x8b'));_0x296138['abort']();}}catch(_0x45fd83){handleError(_0x2e67a4[_0xeb03('0x75')][_0x46fba8],{'code':_0xeb03('0x8c'),'message':_0x45fd83[_0xeb03('0x62')]});logger[_0xeb03('0x23')](_0xeb03('0x8d'),_0x45fd83['message']);}},'complete':function(){try{var _0x3cc7b0=[];var _0x1dd965=tempTableName;_0x3cc7b0[_0xeb03('0x1f')](_0xeb03('0x8e')+_0x1dd965+_0xeb03('0x8f'));logger[_0xeb03('0x60')](_0xeb03('0x90'),contactItemTypes[_0xeb03('0x1c')]);var _0x1cec91=util[_0xeb03('0xe')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x588f31,_0x1dd965,_0x21a182,_0x4447b6[_0xeb03('0x38')],_0x4447b6[_0xeb03('0x57')]||null,NOW,NOW);if(_['isNil'](_0x14866f[_0xeb03('0x36')])){_0x1cec91+=_0xeb03('0x91');}_0x3cc7b0['push'](_0x1cec91);BPromise[_0xeb03('0x92')](_0x3cc7b0,handleQuery)[_0xeb03('0x21')](function(_0x2385e9){BPromise[_0xeb03('0x20')]([handleAdditionalPhones()])[_0xeb03('0x21')](function(){_0x3cc7b0=[];for(var _0x501a3b=0x0;_0x501a3b\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','.id\x20=\x20','\x20=\x20','where','join','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','findOne','CmContactHasItem','updated','create','PHONE','inserted','CmContact','update','CmHopper','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString'];(function(_0x93d80c,_0x5583bf){var _0x3958b0=function(_0x16bf2f){while(--_0x16bf2f){_0x93d80c['push'](_0x93d80c['shift']());}};_0x3958b0(++_0x5583bf);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x7d02('0x0'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x7d02('0x1'));var moment=require(_0x7d02('0x2'));var squel=require(_0x7d02('0x3'));var Redis=require(_0x7d02('0x4'));var db=require(_0x7d02('0x5'))['db'];var config=require(_0x7d02('0x6'));var logger=require(_0x7d02('0x7'))(_0x7d02('0x8'));config['redis']=_[_0x7d02('0x9')](config[_0x7d02('0xa')],{'host':_0x7d02('0xb'),'port':0x18eb});var socket=require(_0x7d02('0xc'))(new Redis(config[_0x7d02('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x7d02('0xd')](_0x7d02('0xe'));var tempTableName=_0x7d02('0xf')+moment()[_0x7d02('0xd')](_0x7d02('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x21abe5){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))*$/[_0x7d02('0x11')](_0x21abe5);}function selectNotIn(_0x259517,_0x55b35a,_0x30e2ec,_0x203087,_0x5eefcd){return squel[_0x7d02('0x12')]()[_0x7d02('0x13')](_0x7d02('0x14'))[_0x7d02('0x15')](_0x203087)['join'](_0x55b35a,null,_0x55b35a+_0x7d02('0x16')+_0x203087+'.'+_0x30e2ec)['where'](_0x203087+'.'+_0x30e2ec+_0x7d02('0x17')+_0x259517+'.'+_0x30e2ec)[_0x7d02('0x18')](_0x55b35a+'.dialCheckDuplicateType\x20IN\x20('+_0x5eefcd[_0x7d02('0x19')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x416849,_0x5ced89){promisesAdditionalPhones=[];promisesContact=[];return db[_0x7d02('0x1a')][_0x7d02('0x1b')](_0x7d02('0x1c')+tempTableName)['spread'](function(_0xec4879){if(_0xec4879!==null){var _0x2da312=[];for(var _0x1edbd0=0x0;_0x1edbd0<_0xec4879[_0x7d02('0x1d')];_0x1edbd0++){var _0x3c4fa9=_0xec4879[_0x1edbd0];if(!_[_0x7d02('0x1e')](_0x3c4fa9[_0x7d02('0x14')])){if(!_[_0x7d02('0x1e')](_0x3c4fa9[_0x7d02('0x1f')]))_0x2da312[_0x7d02('0x20')](insertAdditionalPhones(_0x3c4fa9));promisesContact[_0x7d02('0x20')]({'contact':_0x3c4fa9});}}}Promise[_0x7d02('0x21')](_0x2da312)[_0x7d02('0x22')](function(){_0x416849({'val':0x1});});})[_0x7d02('0x23')](function(_0x442a45){logger[_0x7d02('0x24')](_0x442a45['message']);});});}function insertAdditionalPhones(_0x41c538){return new Promise(function(_0x152291,_0x422024){var _0x54ad2c=_0x41c538[_0x7d02('0x1f')];if(_[_0x7d02('0x1e')](_0x54ad2c))_0x422024({'val':0x0});else{var _0x2fe2a9=_0x54ad2c['split'](';');var _0x163bbc=[];orderBy=0x0;for(var _0x14212d=0x0;_0x14212d<_0x2fe2a9[_0x7d02('0x1d')];_0x14212d++){_0x163bbc[_0x7d02('0x20')](splitAdditionalPhone(_0x41c538['id'],_0x2fe2a9[_0x14212d]));}Promise[_0x7d02('0x21')](_0x163bbc)[_0x7d02('0x22')](function(){_0x152291({'val':_0x2fe2a9[_0x7d02('0x1d')]});});}});}function splitAdditionalPhone(_0x241303,_0x14a74b){return new Promise(function(_0x11df3c,_0x870a68){var _0x555131=_0x14a74b[_0x7d02('0x25')](':');var _0x1f87a0=_0x555131[0x0];var _0xe81f55=_0x555131[0x1];if(_0xe81f55!==''){var _0x4e3053=_0xe81f55['split']('|');var _0x341d94=[];for(var _0x18fa77=0x0;_0x18fa77<_0x4e3053[_0x7d02('0x1d')];_0x18fa77++){if(_0x4e3053[_0x18fa77]!==''){var _0x478506=_[_0x7d02('0x26')](promisesAdditionalPhones,{'contactId':_0x241303,'phone':_0x4e3053[_0x18fa77]});if(_0x478506[_0x7d02('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x7d02('0x20')]({'contactId':_0x241303,'contactTypeId':_0x1f87a0,'phone':_0x4e3053[_0x18fa77],'orderBy':orderBy});}}}_0x11df3c({'ok':0x1});}else _0x11df3c({'res':0x0});});}function createAdditionalPhone(_0x3c57e4,_0x5a8169,_0x5b94c8,_0x4ae0c9){var _0x16f1da='';var _0x7d4706='';var _0x2d6132=_0x5b94c8[_0x7d02('0x25')]('§');_0x16f1da=_0x2d6132[0x0];if(_0x2d6132['length']==0x2)_0x7d4706=_0x2d6132[0x1];return new Promise(function(_0x356424,_0x5a8d2b){return db['CmContactHasItem'][_0x7d02('0x27')]({'where':{'CmContactId':_0x3c57e4,'item':_0x16f1da}})[_0x7d02('0x22')](function(_0x3494fd){if(_0x3494fd){return db[_0x7d02('0x28')]['update']({'ItemTypeId':_0x5a8169,'description':_0x7d4706,'OrderBy':_0x4ae0c9},{'where':{'CmContactId':_0x3c57e4,'item':_0x16f1da}})[_0x7d02('0x22')](function(_0x186dd2){_0x356424({'res':_0x7d02('0x29')});});}else{return db['CmContactHasItem'][_0x7d02('0x2a')]({'CmContactId':_0x3c57e4,'item':_0x16f1da,'ItemTypeId':_0x5a8169,'description':_0x7d4706,'OrderBy':_0x4ae0c9,'ItemClass':_0x7d02('0x2b')})[_0x7d02('0x22')](function(_0x13b131){_0x356424({'res':_0x7d02('0x2c')});});}});});}function updateContact(_0xd98f34){return new Promise(function(_0x330ff3,_0x39eb89){var _0x45a1d9=_0xd98f34['id'];delete _0xd98f34['id'];return db[_0x7d02('0x2d')][_0x7d02('0x2e')](_0xd98f34,{'where':{'id':_0x45a1d9}})[_0x7d02('0x22')](function(_0x4a09bf){updatedRows+=0x1;return db[_0x7d02('0x2f')][_0x7d02('0x2e')]({'phone':_0xd98f34[_0x7d02('0x14')]},{'where':{'ContactId':_0x45a1d9}})[_0x7d02('0x22')](function(_0x541e6b){_0x330ff3({'ret':'OK'});});});});}function insertCmHopper(_0x5b674c,_0x17948b,_0x4dfe91,_0x589515,_0x27fe8f){var _0x55c3ee=['cm_contacts.phone',_0x7d02('0x30'),'cm_contacts.id',_0x7d02('0x31'),_0x17948b+'.'+_0x589515,'cm_contacts.createdAt',_0x7d02('0x32'),'cm_contacts.priority',_0x7d02('0x33'),'\x22'+_0x27fe8f+'\x22'];return squel[_0x7d02('0x34')]()[_0x7d02('0x35')]('cm_hopper')['fromQuery']([_0x7d02('0x14'),_0x7d02('0x36'),_0x7d02('0x37'),_0x7d02('0x38'),_0x589515,_0x7d02('0x39'),_0x7d02('0x3a'),_0x7d02('0x3b'),_0x7d02('0x3c'),_0x7d02('0x3d')],squel[_0x7d02('0x12')]()[_0x7d02('0x3e')](_0x55c3ee)['from'](_0x17948b)['join']('cm_contacts',null,_0x7d02('0x3f')+_0x17948b+_0x7d02('0x40'))[_0x7d02('0x19')](_0x4dfe91,null,_0x4dfe91+_0x7d02('0x16')+_0x17948b+'.'+_0x589515)[_0x7d02('0x18')](_0x17948b+_0x7d02('0x41'),_0x5b674c)[_0x7d02('0x18')](_0x7d02('0x42'),NOW)[_0x7d02('0x18')](_0x7d02('0x43'),selectNotIn(_0x17948b,_0x4dfe91,_0x589515,_0x7d02('0x44'),[_0x7d02('0x45'),_0x7d02('0x46')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x17948b,_0x4dfe91,_0x589515,_0x7d02('0x44'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x3e048d,_0x143f8f,_0x375833,_0x1ebdda){var _0x2866d7=[_0x7d02('0x47'),_0x7d02('0x48'),'cm_contacts.ListId',_0x143f8f+'.'+_0x1ebdda,_0x7d02('0x49'),_0x7d02('0x32')];return squel['insert']()[_0x7d02('0x35')]('cm_hopper_black')['fromQuery']([_0x7d02('0x14'),_0x7d02('0x37'),_0x7d02('0x38'),_0x1ebdda,_0x7d02('0x39'),_0x7d02('0x3a')],squel[_0x7d02('0x12')]()[_0x7d02('0x3e')](_0x2866d7)['from'](_0x143f8f)[_0x7d02('0x19')](_0x7d02('0x4a'),null,_0x7d02('0x3f')+_0x143f8f+_0x7d02('0x40'))[_0x7d02('0x19')](_0x375833,null,_0x375833+'.id\x20=\x20'+_0x143f8f+'.'+_0x1ebdda)['where'](_0x143f8f+_0x7d02('0x41'),_0x3e048d)[_0x7d02('0x18')](_0x7d02('0x42'),NOW)[_0x7d02('0x18')](_0x7d02('0x43'),squel['select']()[_0x7d02('0x13')]('phone')[_0x7d02('0x15')](_0x7d02('0x4b'))[_0x7d02('0x18')](_0x7d02('0x4c'),_0x3e048d)[_0x7d02('0x18')](_0x1ebdda+_0x7d02('0x4d'),_0x143f8f+'.'+_0x1ebdda)))[_0x7d02('0x4e')]();}function insertCmHopperAdditionalPhones(_0x263b6b){var _0x108e0a=['cm_hopper.id',_0x7d02('0x4f'),_0x7d02('0x50'),_0x7d02('0x51'),_0x7d02('0x52')];return squel['insert']()[_0x7d02('0x35')](_0x7d02('0x53'))['fromQuery']([_0x7d02('0x54'),_0x7d02('0x14'),'OrderBy',_0x7d02('0x39'),_0x7d02('0x3a')],squel[_0x7d02('0x12')]()[_0x7d02('0x3e')](_0x108e0a)[_0x7d02('0x15')](_0x7d02('0x44'))['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x7d02('0x19')]('cm_contact_has_items',null,_0x7d02('0x55'))[_0x7d02('0x18')](_0x7d02('0x56'),_0x263b6b)[_0x7d02('0x18')](_0x7d02('0x42'),NOW))[_0x7d02('0x4e')]();}function insertCmContact(_0x57542f,_0xc670e0,_0x249619,_0x413423){var _0x5942ba=_[_0x7d02('0x57')](_['keys'](_0x413423),[_0x7d02('0x38'),'CompanyId','createdAt',_0x7d02('0x3a')]);return squel[_0x7d02('0x34')]()[_0x7d02('0x35')]('cm_contacts')[_0x7d02('0x58')](_0x5942ba,squel['select']()[_0x7d02('0x3e')](_0x5942ba)[_0x7d02('0x15')](_0xc670e0)['where']('('+_0x249619[_0x7d02('0x19')](',')+_0x7d02('0x59'),squel['select']()[_0x7d02('0x3e')](_0x249619)[_0x7d02('0x15')](_0x7d02('0x4a'))[_0x7d02('0x18')]('ListId\x20=\x20?',_0x57542f))['where'](_0x7d02('0x5a'),squel[_0x7d02('0x12')]()[_0x7d02('0x13')](_0x7d02('0x5b'),_0x7d02('0x5c'))['from'](_0xc670e0)[_0x7d02('0x5d')](_0x249619[_0x7d02('0x19')](','))))[_0x7d02('0x4e')]();}function handleStop(){logger[_0x7d02('0x5e')](_0x7d02('0x5f'));stopped=!![];}function handleUncaughtException(_0x3fce59){logger[_0x7d02('0x24')](_0x3fce59[_0x7d02('0x60')]);process[_0x7d02('0x61')](0x1);}function handleError(_0x4f4cbe,_0x355592){stats['errors'][_0x7d02('0x20')]({'name':_0x355592['code'],'message':_0x355592[_0x7d02('0x60')],'row':_0x4f4cbe});}function handleQuery(_0x4fa96d){logger[_0x7d02('0x5e')](_0x4fa96d);return db[_0x7d02('0x1a')][_0x7d02('0x1b')](_0x4fa96d)[_0x7d02('0x62')](function(_0x190e9e){results[_0x7d02('0x20')](_0x190e9e);})[_0x7d02('0x23')](function(_0x2f45c4){logger['error'](_0x2f45c4[_0x7d02('0x60')]);});}function main(_0x5c070c,_0x19a881,_0x517249,_0x8a5250){logger[_0x7d02('0x5e')](_0x7d02('0x63'),_0x5c070c,JSON['stringify'](_0x19a881));process[_0x7d02('0x64')](_0x7d02('0x65'));var _0x156714=_0x19a881[_0x7d02('0x66')];var _0x42be7e=_['clone'](_0x156714);var _0x1247e0=_0x19a881['socket_timestamp'];var _0x7931c9=path[_0x7d02('0x19')](config['root'],_0x7d02('0x67'),_0x1247e0+_0x7d02('0x68'));logger[_0x7d02('0x5e')](_0x7d02('0x69'),_0x19a881);db[_0x7d02('0x6a')][_0x7d02('0x6b')]({'raw':!![],'attributes':['id',_0x7d02('0x6c')]})[_0x7d02('0x22')](function(_0x6f9581){for(var _0x23dbee=0x0;_0x23dbee<_0x6f9581[_0x7d02('0x1d')];_0x23dbee++){if(_0x6f9581[_0x23dbee][_0x7d02('0x6c')]in _0x156714){contactItemTypes['push'](_0x6f9581[_0x23dbee]);delete _0x42be7e[_0x6f9581[_0x23dbee][_0x7d02('0x6c')]];hasAdditionalPhones=!![];}for(var _0x1976b6 in _0x156714){if(_0x6f9581[_0x23dbee][_0x7d02('0x6c')]+_0x7d02('0x6d')===_0x1976b6){phoneDescriptions[_0x7d02('0x20')]({'itemTypeId':_0x6f9581[_0x23dbee]['id'],'description':_0x1976b6});delete _0x42be7e[_0x1976b6];}}}if(hasAdditionalPhones)_0x42be7e['AdditionalPhones']='';var _0x57cf51=_[_0x7d02('0x6e')](_0x42be7e)[_0x7d02('0x19')]();logger['info'](_0x7d02('0x6f'),_0x57cf51);fs[_0x7d02('0x70')](_0x7931c9,_0x57cf51+'\x0a');Papa[_0x7d02('0x71')](fs[_0x7d02('0x72')](_0x5c070c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1159ab,_0x26a16d){try{for(var _0x3e236b=0x0,_0xdc1a5f=[];_0x3e236b<_0x1159ab[_0x7d02('0x73')][_0x7d02('0x1d')];_0x3e236b++){stats['rows']+=0x1;if(_0x1159ab['errors'][_0x3e236b]){handleError(_0x1159ab['data'][_0x3e236b],_0x1159ab[_0x7d02('0x74')][_0x3e236b]);}else{var _0x407e89=[];var _0x5a7e49=[];var _0x5bc0ef={};for(var _0x35a736 in _0x156714){let _0x5918df=contactItemTypes[_0x7d02('0x75')](_0x3b58a8=>_0x3b58a8[_0x7d02('0x6c')]===_0x35a736);let _0x351186=contactItemTypes[_0x7d02('0x75')](_0x5b0f93=>_0x5b0f93[_0x7d02('0x6c')]+_0x7d02('0x6d')===_0x35a736);if(_['isNil'](_0x5918df)&&_[_0x7d02('0x1e')](_0x351186)){if(_0x156714[_0x7d02('0x76')](_0x35a736)){if(_0x1159ab[_0x7d02('0x73')][_0x3e236b][_0x156714[_0x35a736]]){var _0xde17f8=_[_0x7d02('0x77')](_0x1159ab[_0x7d02('0x73')][_0x3e236b][_0x156714[_0x35a736]][_0x7d02('0x78')](/"/g,'\x27'));switch(_0x35a736){case _0x7d02('0x36'):var _0x64620a=moment(_0xde17f8,_0x7d02('0xe'),!![]);if(_0x64620a['isValid']()){_0xdc1a5f[_0x7d02('0x20')]('\x22'+_0xde17f8+'\x22');}else{_0x407e89[_0x7d02('0x20')](_0x7d02('0x79'));}break;case _0x7d02('0x3b'):var _0x6d68d3=parseInt(_0xde17f8);_0xde17f8=_[_0x7d02('0x7a')](_0x6d68d3)||_0x6d68d3<0x0||_0x6d68d3>0x4?_0x8a5250?0x3:0x2:_0x6d68d3;_0xdc1a5f[_0x7d02('0x20')]('\x22'+_0xde17f8+'\x22');break;case _0x7d02('0x3c'):var _0x4efa48=parseInt(_0xde17f8);if(_['isNumber'](_0x4efa48)&&_['includes'](_0x517249,_0x4efa48)){_0xdc1a5f['push']('\x22'+_0x4efa48+'\x22');}else{_0x407e89[_0x7d02('0x20')](_0x7d02('0x7b'));}break;case _0x7d02('0x7c'):if(isEmail(_0xde17f8)){_0xdc1a5f[_0x7d02('0x20')]('\x22'+_0xde17f8+'\x22');}else{_0x407e89[_0x7d02('0x20')]('email\x20wrong\x20format');}break;case _0x7d02('0x7d'):var _0x3ac3f2=moment(_0xde17f8,'YYYY-MM-DD',!![]);if(_0x3ac3f2[_0x7d02('0x7e')]()){_0xdc1a5f[_0x7d02('0x20')]('\x22'+_0xde17f8+'\x22');}else{_0x407e89[_0x7d02('0x20')](_0x7d02('0x7f'));}break;default:_0xdc1a5f['push']('\x22'+_0xde17f8+'\x22');}}else{switch(_0x35a736){case _0x7d02('0x80'):case _0x7d02('0x14'):_0x407e89[_0x7d02('0x20')](_0x35a736+_0x7d02('0x81'));break;default:_0xdc1a5f[_0x7d02('0x20')]('\x22\x22');}}}}else{var _0xe8d893='';if(!_[_0x7d02('0x1e')](_0x5918df)){if(!_0x5bc0ef[_0x7d02('0x76')](_0x5918df['id'])){for(var _0x58d2be=0x0;_0x58d2be<_0x156714[_0x35a736][_0x7d02('0x1d')];_0x58d2be++){var _0xde17f8=_[_0x7d02('0x77')](_0x1159ab[_0x7d02('0x73')][_0x3e236b][_0x156714[_0x35a736][_0x58d2be]]['replace'](/"/g,'\x27'));var _0x4ba48c=phoneDescriptions[_0x7d02('0x75')](_0x429c0b=>_0x429c0b[_0x7d02('0x82')]===_0x5918df['id']);if(!_[_0x7d02('0x1e')](_0x4ba48c)){var _0x24868c=_[_0x7d02('0x77')](_0x1159ab['data'][_0x3e236b][_0x156714[_0x4ba48c[_0x7d02('0x83')]][0x0]][_0x7d02('0x78')](/"/g,'\x27'));if(!_[_0x7d02('0x1e')](_0x24868c))_0xde17f8=_0xde17f8+'§'+_0x24868c;}if(_0xe8d893=='')_0xe8d893=_0xde17f8;else _0xe8d893+='|'+_0xde17f8;}_0x5a7e49[_0x7d02('0x20')](_0x5918df['id']+':'+_0xe8d893);_0x5bc0ef[_0x5918df['id']]=0x1;}}}}if(hasAdditionalPhones){_0xdc1a5f[_0x7d02('0x20')]('\x22'+_0x5a7e49['join'](';')+'\x22');}if(_0x407e89[_0x7d02('0x1d')]){handleError(_0x1159ab[_0x7d02('0x73')][_0x3e236b],{'code':_0x7d02('0x84'),'message':_0x407e89[_0x7d02('0x19')]()});}else{fs[_0x7d02('0x85')](_0x7931c9,_0xdc1a5f['join']()+'\x0a');}_0xdc1a5f=[];}if(!(stats[_0x7d02('0x86')]%0xc8)){socket[_0x7d02('0x87')](_0x7d02('0x88')+_0x1247e0,stats);stats['errors']=[];}}if(stopped){logger[_0x7d02('0x5e')](_0x7d02('0x89'));_0x26a16d['abort']();}}catch(_0x2ec1ec){handleError(_0x1159ab['data'][_0x3e236b],{'code':_0x7d02('0x8a'),'message':_0x2ec1ec['message']});logger['error'](_0x7d02('0x8b'),_0x2ec1ec[_0x7d02('0x60')]);}},'complete':function(){try{var _0x36f656=[];var _0x5f3926=tempTableName;_0x36f656[_0x7d02('0x20')](_0x7d02('0x8c')+_0x5f3926+'\x20LIKE\x20cm_contacts;');logger[_0x7d02('0x5e')](_0x7d02('0x8d'),contactItemTypes[_0x7d02('0x1d')]);var _0x21a8b8=util[_0x7d02('0xd')](_0x7d02('0x8e'),_0x7931c9,_0x5f3926,_0x57cf51,_0x19a881['ListId'],_0x19a881['CompanyId']||null,NOW,NOW);if(_[_0x7d02('0x1e')](_0x156714[_0x7d02('0x36')])){_0x21a8b8+=_0x7d02('0x8f');}_0x36f656[_0x7d02('0x20')](_0x21a8b8);BPromise[_0x7d02('0x90')](_0x36f656,handleQuery)[_0x7d02('0x22')](function(_0xb4ed75){BPromise[_0x7d02('0x21')]([handleAdditionalPhones()])['then'](function(){_0x36f656=[];for(var _0x21ce5f=0x0;_0x21ce5f=_0x41c17c){return _0x261b86[_0xb2f8('0x13')](0x193)['json']({'message':util['format'](_0xb2f8('0x14'),_0x11b1aa)});}_0x3b1aeb();})[_0xb2f8('0x15')](function(_0x1a973d){_0x3b1aeb(_0x1a973d);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xb2f8('0x16')],{'where':{'$or':[{'role':_0xb2f8('0x17')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x6b4a=['util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','isUserLimit','crypto'];(function(_0x21ba19,_0x5ee6b9){var _0x518d67=function(_0x2abc7a){while(--_0x2abc7a){_0x21ba19['push'](_0x21ba19['shift']());}};_0x518d67(++_0x5ee6b9);}(_0x6b4a,0x86));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0xa6b4('0x0'));var util=require(_0xa6b4('0x1'));var compose=require('composable-middleware');var db=require(_0xa6b4('0x2'))['db'];var config=require(_0xa6b4('0x3'));function getValueFromLicense(_0x4c3fec,_0x208c66){if(_0x4c3fec&&_0x208c66){if(_0x208c66[_0xa6b4('0x4')]&&_0x208c66[_0xa6b4('0x5')]){var _0x2d825f=_0x208c66['data1'];var _0x5c7192=_0x208c66[_0xa6b4('0x5')];var _0x41a3fb=_0x2d825f[_0xa6b4('0x6')]('-')[0x4];var _0x553cdf=_0x2d825f[_0xa6b4('0x6')]('-')[0x0];var _0x31b40a=crypto[_0xa6b4('0x7')](_0xa6b4('0x8'),util[_0xa6b4('0x9')](_0xa6b4('0xa'),_0x41a3fb,_0x2d825f,_0x553cdf));var _0x31441e=_0x31b40a[_0xa6b4('0xb')](_0x5c7192,_0xa6b4('0xc'),'utf8');_0x31441e+=_0x31b40a[_0xa6b4('0xd')](_0xa6b4('0xe'));var _0x335f20=JSON[_0xa6b4('0xf')](_0x31441e);return _0x335f20[_0xa6b4('0x10')](_0x4c3fec)?_0x335f20[_0x4c3fec]:null;}}return null;}function isLimit(_0x569812,_0x11dca3,_0x586f01,_0x364372){var _0x46c272=_0x11dca3;return compose()[_0xa6b4('0x11')](function(_0x53e8aa,_0x58fd28,_0xbdde7e){return db[_0xa6b4('0x12')][_0xa6b4('0x13')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2be6b8){var _0x3a1b84=getValueFromLicense(_0x569812,_0x2be6b8);return _0x3a1b84?_0x3a1b84:_0x46c272;})[_0xa6b4('0x14')](function(_0x4d0558){_0x46c272=_0x4d0558;return _0x586f01['count'](_0x364372);})['then'](function(_0x32b1f3){if(_0x32b1f3>=_0x46c272){return _0x58fd28[_0xa6b4('0x15')](0x193)[_0xa6b4('0x16')]({'message':util[_0xa6b4('0x9')](_0xa6b4('0x17'),_0x569812)});}_0xbdde7e();})['catch'](function(_0x1dc588){_0xbdde7e(_0x1dc588);});});}function isUserLimit(){return isLimit(_0xa6b4('0x18'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xa6b4('0x19')}]}});}exports[_0xa6b4('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2824d12..782e3cb 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 _0x8be4=['add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','<\x20?','$gt','>\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','pop','utcOffset','lodash','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','indexOf','conditions','buildExpression','DATE','operator','value','includes','$lte'];(function(_0x461faa,_0x2931cb){var _0x37d775=function(_0x471194){while(--_0x471194){_0x461faa['push'](_0x461faa['shift']());}};_0x37d775(++_0x2931cb);}(_0x8be4,0x182));var _0x48be=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0x8be4[_0x5c8827];return _0x50ffd5;};'use strict';var _=require(_0x48be('0x0'));var moment=require(_0x48be('0x1'));exports[_0x48be('0x2')]=function(_0x5a2020){var _0x450988={'conditions':[]};_0x450988['sqlOperator']=_[_0x48be('0x3')](_0x5a2020,_0x48be('0x4'))?'or':_0x48be('0x5');var _0x565a7f=_0x5a2020[_0x48be('0x6')](_0x48be('0x7'),'')['replace'](_0x48be('0x4'),'')[_0x48be('0x8')]('||');for(var _0x384ab3=0x0;_0x384ab3<_0x565a7f['length'];_0x384ab3++){var _0x2f1e3b=_0x565a7f[_0x384ab3][_0x48be('0x8')](':=');var _0xe2f143=_0x2f1e3b[0x0];var _0x410041=_0x2f1e3b[_0x48be('0x9')](0x1);_0x410041[_0x48be('0xa')](function(_0x528de6){var _0x36b6d6=_0x528de6['split']('[')[_0x48be('0xb')]();var _0x3def1c=_0x528de6[_0x48be('0xc')](/\[(.*?)\]/g);_0x3def1c[_0x48be('0xa')](function(_0x3d71e0){var _0x137ab8=_0x3d71e0[_0x48be('0x8')]('[')[_0x48be('0xd')](function(_0x57b657){return _0x57b657[_0x48be('0xe')](']')>-0x1;})['map'](function(_0x525670){return _0x525670[_0x48be('0x8')](']')[0x0];})[0x0];_0x450988[_0x48be('0xf')]['push']({'field':_0xe2f143,'operator':_0x36b6d6,'value':_0x137ab8});});});}return _0x450988;};exports[_0x48be('0x10')]=function(_0x11e203,_0x106616,_0x4cdb35){var _0x1f3819={};if(_0x106616===_0x48be('0x11')){if(_0x4cdb35[_0x48be('0x12')]==='$eq'){_0x4cdb35[_0x48be('0x12')]='$between';_0x4cdb35['value']+=','+_0x4cdb35[_0x48be('0x13')];}else if(_[_0x48be('0x14')](['$gt',_0x48be('0x15')],_0x4cdb35[_0x48be('0x12')])){_0x4cdb35[_0x48be('0x13')]=moment(_0x4cdb35[_0x48be('0x13')])[_0x48be('0x16')](0x1,_0x48be('0x17'))[_0x48be('0x18')](_0x48be('0x19'));}}if(_0x4cdb35[_0x48be('0x1a')]){_0x106616=_0x4cdb35[_0x48be('0x1a')];_0x1f3819[_0x48be('0x1b')]=_0x48be('0x1c')+_0x11e203+'.'+_0x4cdb35[_0x48be('0x1d')]+'\x20AS\x20'+_0x4cdb35[_0x48be('0x1a')]+')\x20'+parseOperator(_0x4cdb35[_0x48be('0x12')]);}else{_0x1f3819[_0x48be('0x1b')]=_0x11e203+'.'+_0x4cdb35[_0x48be('0x1d')]+'\x20'+parseOperator(_0x4cdb35[_0x48be('0x12')]);}if(_['includes']([_0x48be('0x1e'),_0x48be('0x1f')],_0x4cdb35['operator']))_0x1f3819[_0x48be('0x1b')]='('+_0x1f3819[_0x48be('0x1b')]+_0x48be('0x20')+_0x11e203+'.'+_0x4cdb35[_0x48be('0x1d')]+_0x48be('0x21');_0x1f3819[_0x48be('0x13')]=parseValue(_0x106616,_0x4cdb35[_0x48be('0x12')],_0x4cdb35[_0x48be('0x13')]);return _0x1f3819;};function parseOperator(_0x1e4a22){var _0x45685a;switch(_0x1e4a22){case _0x48be('0x22'):_0x45685a=_0x48be('0x23');break;case'$notIn':_0x45685a=_0x48be('0x24');break;case _0x48be('0x25'):_0x45685a=_0x48be('0x26');break;case _0x48be('0x1e'):_0x45685a=_0x48be('0x27');break;case _0x48be('0x28'):case'$startsWith':case'$endsWith':_0x45685a='LIKE\x20?';break;case'$lt':_0x45685a=_0x48be('0x29');break;case _0x48be('0x2a'):_0x45685a=_0x48be('0x2b');break;case _0x48be('0x15'):_0x45685a='<=\x20?';break;case'$gte':_0x45685a='>=\x20?';break;case _0x48be('0x2c'):_0x45685a=_0x48be('0x2d');break;}return _0x45685a;}function parseValue(_0x4081de,_0x2c64fb,_0x236a1d){var _0x57c01b={'start':undefined,'end':undefined};switch(_0x2c64fb){case _0x48be('0x22'):case _0x48be('0x1f'):_0x57c01b[_0x48be('0x2e')]=_0x236a1d[_0x48be('0x8')](',');break;case _0x48be('0x28'):_0x57c01b[_0x48be('0x2e')]='%'+_0x236a1d+'%';break;case _0x48be('0x2f'):_0x57c01b[_0x48be('0x2e')]=_0x236a1d+'%';break;case _0x48be('0x30'):_0x57c01b[_0x48be('0x2e')]='%'+_0x236a1d;break;case _0x48be('0x2c'):var _0x10dca4=_0x236a1d[_0x48be('0x8')](',');var _0x236a1d=_0x10dca4['shift']();var _0x37fc6c=_0x10dca4[_0x48be('0x31')]();if(_0x4081de===_0x48be('0x11')){_0x236a1d=moment(_0x236a1d)['utcOffset'](0x0,!![])[_0x48be('0x18')]();_0x37fc6c=moment(_0x37fc6c)[_0x48be('0x32')](0x0,!![])[_0x48be('0x16')](0x17,'hours')[_0x48be('0x16')](0x3b,'minutes')['add'](0x3b,'seconds')[_0x48be('0x18')]();}_0x57c01b={'start':_0x236a1d,'end':_0x37fc6c};break;default:_0x57c01b[_0x48be('0x2e')]=_0x236a1d;break;}return _0x57c01b;} \ No newline at end of file +var _0x04f7=['seconds','lodash','moment','sqlOperator','[$or]','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD','castTo','text','$ne','$notIn','\x20OR\x20','field','NOT\x20IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$startsWith','pop','utcOffset','format','add','hours','minutes'];(function(_0x22574a,_0x15cb6d){var _0x2e0991=function(_0x3e4efb){while(--_0x3e4efb){_0x22574a['push'](_0x22574a['shift']());}};_0x2e0991(++_0x15cb6d);}(_0x04f7,0x71));var _0x704f=function(_0x39c1cd,_0x514ed7){_0x39c1cd=_0x39c1cd-0x0;var _0x348bb7=_0x04f7[_0x39c1cd];return _0x348bb7;};'use strict';var _=require(_0x704f('0x0'));var moment=require(_0x704f('0x1'));exports['parseSearch']=function(_0x3bbe2e){var _0xd7fe09={'conditions':[]};_0xd7fe09[_0x704f('0x2')]=_['startsWith'](_0x3bbe2e,_0x704f('0x3'))?'or':_0x704f('0x4');var _0x40c071=_0x3bbe2e[_0x704f('0x5')](_0x704f('0x6'),'')['replace']('[$or]','')[_0x704f('0x7')]('||');for(var _0x24ddf4=0x0;_0x24ddf4<_0x40c071[_0x704f('0x8')];_0x24ddf4++){var _0x19880a=_0x40c071[_0x24ddf4][_0x704f('0x7')](':=');var _0x21e0f6=_0x19880a[0x0];var _0xf01f1=_0x19880a[_0x704f('0x9')](0x1);_0xf01f1['forEach'](function(_0x48fd60){var _0x2ef818=_0x48fd60[_0x704f('0x7')]('[')[_0x704f('0xa')]();var _0x442b74=_0x48fd60[_0x704f('0xb')](/\[(.*?)\]/g);_0x442b74[_0x704f('0xc')](function(_0x1546ed){var _0x50f861=_0x1546ed[_0x704f('0x7')]('[')[_0x704f('0xd')](function(_0x29cb2a){return _0x29cb2a[_0x704f('0xe')](']')>-0x1;})[_0x704f('0xf')](function(_0x218982){return _0x218982[_0x704f('0x7')](']')[0x0];})[0x0];_0xd7fe09[_0x704f('0x10')][_0x704f('0x11')]({'field':_0x21e0f6,'operator':_0x2ef818,'value':_0x50f861});});});}return _0xd7fe09;};exports[_0x704f('0x12')]=function(_0x43ac51,_0x57f506,_0x6c0be5){var _0x42e311={};if(_0x57f506===_0x704f('0x13')){if(_0x6c0be5[_0x704f('0x14')]===_0x704f('0x15')){_0x6c0be5[_0x704f('0x14')]=_0x704f('0x16');_0x6c0be5[_0x704f('0x17')]+=','+_0x6c0be5[_0x704f('0x17')];}else if(_[_0x704f('0x18')]([_0x704f('0x19'),_0x704f('0x1a')],_0x6c0be5[_0x704f('0x14')])){_0x6c0be5['value']=moment(_0x6c0be5[_0x704f('0x17')])['add'](0x1,_0x704f('0x1b'))['format'](_0x704f('0x1c'));}}if(_0x6c0be5[_0x704f('0x1d')]){_0x57f506=_0x6c0be5['castTo'];_0x42e311[_0x704f('0x1e')]='CAST('+_0x43ac51+'.'+_0x6c0be5['field']+'\x20AS\x20'+_0x6c0be5[_0x704f('0x1d')]+')\x20'+parseOperator(_0x6c0be5[_0x704f('0x14')]);}else{_0x42e311[_0x704f('0x1e')]=_0x43ac51+'.'+_0x6c0be5['field']+'\x20'+parseOperator(_0x6c0be5[_0x704f('0x14')]);}if(_[_0x704f('0x18')]([_0x704f('0x1f'),_0x704f('0x20')],_0x6c0be5[_0x704f('0x14')]))_0x42e311['text']='('+_0x42e311[_0x704f('0x1e')]+_0x704f('0x21')+_0x43ac51+'.'+_0x6c0be5[_0x704f('0x22')]+'\x20IS\x20NULL)';_0x42e311['value']=parseValue(_0x57f506,_0x6c0be5[_0x704f('0x14')],_0x6c0be5['value']);return _0x42e311;};function parseOperator(_0x40cdf3){var _0x9d8fd4;switch(_0x40cdf3){case'$in':_0x9d8fd4='IN\x20?';break;case _0x704f('0x20'):_0x9d8fd4=_0x704f('0x23');break;case _0x704f('0x15'):_0x9d8fd4=_0x704f('0x24');break;case _0x704f('0x1f'):_0x9d8fd4=_0x704f('0x25');break;case'$substring':case'$startsWith':case _0x704f('0x26'):_0x9d8fd4=_0x704f('0x27');break;case _0x704f('0x28'):_0x9d8fd4=_0x704f('0x29');break;case _0x704f('0x19'):_0x9d8fd4='>\x20?';break;case _0x704f('0x1a'):_0x9d8fd4='<=\x20?';break;case _0x704f('0x2a'):_0x9d8fd4=_0x704f('0x2b');break;case _0x704f('0x16'):_0x9d8fd4=_0x704f('0x2c');break;}return _0x9d8fd4;}function parseValue(_0x3e3672,_0x494cce,_0xa09963){var _0xd4aa3c={'start':undefined,'end':undefined};switch(_0x494cce){case _0x704f('0x2d'):case _0x704f('0x20'):_0xd4aa3c[_0x704f('0x2e')]=_0xa09963[_0x704f('0x7')](',');break;case _0x704f('0x2f'):_0xd4aa3c[_0x704f('0x2e')]='%'+_0xa09963+'%';break;case _0x704f('0x30'):_0xd4aa3c[_0x704f('0x2e')]=_0xa09963+'%';break;case'$endsWith':_0xd4aa3c[_0x704f('0x2e')]='%'+_0xa09963;break;case _0x704f('0x16'):var _0x36790d=_0xa09963['split'](',');var _0xa09963=_0x36790d[_0x704f('0xa')]();var _0x2c318d=_0x36790d[_0x704f('0x31')]();if(_0x3e3672===_0x704f('0x13')){_0xa09963=moment(_0xa09963)[_0x704f('0x32')](0x0,!![])[_0x704f('0x33')]();_0x2c318d=moment(_0x2c318d)['utcOffset'](0x0,!![])[_0x704f('0x34')](0x17,_0x704f('0x35'))[_0x704f('0x34')](0x3b,_0x704f('0x36'))[_0x704f('0x34')](0x3b,_0x704f('0x37'))['format']();}_0xd4aa3c={'start':_0xa09963,'end':_0x2c318d};break;default:_0xd4aa3c['start']=_0xa09963;break;}return _0xd4aa3c;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 89aa7c6..63c0d1c 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 _0x0faf=['value','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','isEmpty','forOwn','type','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','filters','intersection','attributes','fields','length','offset','order','pick','filter','object','columns'];(function(_0x5a7bfc,_0x5eea0b){var _0x6961e4=function(_0x230ecf){while(--_0x230ecf){_0x5a7bfc['push'](_0x5a7bfc['shift']());}};_0x6961e4(++_0x5eea0b);}(_0x0faf,0x132));var _0xf0fa=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x0faf[_0x1e17eb];return _0x4de4c7;};'use strict';var _=require(_0xf0fa('0x0'));var sequelize=require('sequelize');var moment=require(_0xf0fa('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b4763){var _0x2c6207=['ne'];try{var _0x35a260=JSON[_0xf0fa('0x2')](_0x1b4763);var _0xdc9ce3=Object[_0xf0fa('0x3')](_0x35a260)[0x0];return _0x2c6207[_0xf0fa('0x4')](_0xdc9ce3);}catch(_0x283f04){return![];}}function getOperatorValue(_0x5d9b58){var _0x3637a3=JSON[_0xf0fa('0x2')](_0x5d9b58);var _0x25b5c4=Object[_0xf0fa('0x3')](_0x3637a3)[0x0];var _0x2db1d9=_0x3637a3[_0x25b5c4];return{['$'+_0x25b5c4]:_0x2db1d9};}exports['fields']=function(_0x42f7fd){var _0x18db40=null;if(_0x42f7fd){_0x18db40=_0x42f7fd['split'](',');}return _0x18db40;};exports['filters']=function(_0x3bda51,_0x1e8cc0){var _0x25dfec={};if(!_[_0xf0fa('0x5')](_0x3bda51)){_[_0xf0fa('0x6')](_0x3bda51,function(_0x1151ea,_0x379ff6){try{if(_0x1e8cc0){var _0x20fd09=_['find'](_0x1e8cc0,{'name':_0x379ff6})||{};if(hasSequelizeOperator(_0x1151ea)){_0x25dfec[_0x379ff6]=getOperatorValue(_0x1151ea);}else if(_0x20fd09[_0xf0fa('0x7')]==='DATE'&&_[_0xf0fa('0x8')](_0x1151ea)){var _0x521034=JSON[_0xf0fa('0x2')](_0x1151ea);var _0x17326f={'$gte':moment(moment(_0x521034[_0xf0fa('0x9')])['format']('YYYY-MM-DD'))[_0xf0fa('0xa')]()['format'](),'$lte':moment(moment(_0x521034[_0xf0fa('0xb')])[_0xf0fa('0xc')](_0xf0fa('0xd')))[_0xf0fa('0xa')]()[_0xf0fa('0xe')](0x1,'s')[_0xf0fa('0xc')]()};_0x25dfec[_0x379ff6]=_0x17326f;}else if(_0x20fd09[_0xf0fa('0xf')]===_0xf0fa('0x10')){_0x25dfec[_0x379ff6]=_0x1151ea;}else{_0x25dfec[_0x379ff6]=_['isArray'](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}else{_0x25dfec[_0x379ff6]=_[_0xf0fa('0x11')](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}catch(_0x1d3c22){_0x25dfec[_0x379ff6]=_0x1151ea[_0xf0fa('0x12')](',');}});}return _0x25dfec;};exports[_0xf0fa('0x13')]=function(_0x5ba2eb){_0x5ba2eb=parseInt(_0x5ba2eb,0xa);if(!_0x5ba2eb||_0x5ba2eb<0x0){_0x5ba2eb=LIMIT_VALUE;}return _0x5ba2eb;};exports['offset']=function(_0x2f376d){_0x2f376d=parseInt(_0x2f376d,0xa);if(!_0x2f376d||_0x2f376d<0x0){_0x2f376d=0x0;}return _0x2f376d;};exports[_0xf0fa('0x14')]=function(_0x151d09){var _0x2385e2,_0x1a3620=null;if(_0x151d09){_0x2385e2=_0x151d09[_0xf0fa('0x12')](',');_0x1a3620=_[_0xf0fa('0x15')](_0x2385e2,function(_0x3de639){if(_0x3de639[_0xf0fa('0x16')]('-')===0x0){return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize['col'](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639[_0xf0fa('0x1a')](0x1),_0xf0fa('0x1b')];}else{return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize[_0xf0fa('0x1c')](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639,'ASC'];}});}return _0x1a3620;};exports[_0xf0fa('0x1d')]=function(_0x19e392,_0x56134e){if(_[_0xf0fa('0x5')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x11')](_0x19e392)){for(var _0x2efe88=0x0;_0x2efe88<_0x19e392['length'];_0x2efe88+=0x1){_0x19e392[_0x2efe88]=this[_0xf0fa('0x1d')](_0x19e392[_0x2efe88],_0x56134e);}return _0x19e392;}if(!_[_0xf0fa('0x1e')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x1f')](_0x56134e)){_0x56134e=[_0x56134e];}if(!_[_0xf0fa('0x11')](_0x56134e)){return _0x19e392;}for(var _0x4e6eef=0x0;_0x4e6eef<_0x56134e['length'];_0x4e6eef+=0x1){_[_0xf0fa('0x20')](_0x19e392,_0x56134e[_0x4e6eef]);}for(var _0x1c5eaf in _0x19e392){if(_0x19e392[_0xf0fa('0x21')](_0x1c5eaf)){_0x19e392[_0x1c5eaf]=this[_0xf0fa('0x1d')](_0x19e392[_0x1c5eaf],_0x56134e);}}return _0x19e392;};exports['isNumeric']=function(_0x4058d6){return _0x4058d6[_0xf0fa('0x22')](RegExp(_0xf0fa('0x23')))?!![]:![];};exports['isEmail']=function(_0x9ad0e3){return _0x9ad0e3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf0fa('0x24')]=function(_0x1e3875){var _0x28e057=[];_0x1e3875['split'](/[ ,]+/)[_0xf0fa('0x25')](function(_0x33cc64){_0x33cc64=_0x33cc64[_0xf0fa('0x26')](/([^:]")"+/g,'$1');_0x33cc64='+'+_0x33cc64+'*';var _0x212986=/[ `!@#$%^&*()_\-?~]/;if(_0x33cc64[_0xf0fa('0x22')](_0x212986))_0x33cc64='\x22'+_0x33cc64+'\x22';_0x28e057[_0xf0fa('0x27')](_0x33cc64);});return _0x28e057['join']('\x20');};exports['getOptions']=function(_0x36173a,_0x255f9d,_0x485fe2){var _0x38cf8c={},_0x50e0bd={};if(_0x255f9d['query']['$id']){_0x255f9d[_0xf0fa('0x28')]['id']=_0x255f9d['query'][_0xf0fa('0x29')];delete _0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x29')];}_0x38cf8c[_0xf0fa('0x2a')]=_[_0xf0fa('0x15')](_0x36173a,_0xf0fa('0xf'));_0x38cf8c[_0xf0fa('0x28')]=_[_0xf0fa('0x3')](_0x255f9d['query']);_0x38cf8c[_0xf0fa('0x2b')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],_0x38cf8c['query']);_0x50e0bd[_0xf0fa('0x2d')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],this[_0xf0fa('0x2e')](_0x255f9d['query']['fields']));_0x50e0bd[_0xf0fa('0x2d')]=_0x50e0bd[_0xf0fa('0x2d')][_0xf0fa('0x2f')]?_0x50e0bd[_0xf0fa('0x2d')]:_0x38cf8c[_0xf0fa('0x2a')];if(!_0x255f9d['query']['hasOwnProperty']('nolimit')){_0x50e0bd['limit']=this[_0xf0fa('0x13')](_0x255f9d[_0xf0fa('0x28')]['limit']);_0x50e0bd['offset']=this[_0xf0fa('0x30')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x30')]);}_0x50e0bd[_0xf0fa('0x31')]=this[_0xf0fa('0x14')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x14')]);_0x50e0bd['where']=this['filters'](_[_0xf0fa('0x32')](_0x255f9d[_0xf0fa('0x28')],_0x38cf8c[_0xf0fa('0x2b')]),_0x36173a);if(_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]){var _0x1d0129=_0x36173a;var _0x5acfa4=_0x255f9d[_0xf0fa('0x28')]['filter'];if(typeof _0x5acfa4===_0xf0fa('0x34')){_0x1d0129=_[_0xf0fa('0x33')](_0x36173a,function(_0x6e1fd9){return _[_0xf0fa('0x4')](_0x5acfa4[_0xf0fa('0x35')],_0x6e1fd9[_0xf0fa('0xf')]);});_0x5acfa4=_0x5acfa4[_0xf0fa('0x36')];}_0x50e0bd[_0xf0fa('0x37')]=_[_0xf0fa('0x38')](_0x50e0bd['where'],{'$or':_['map'](_0x1d0129,function(_0x52221a){if(_0x52221a[_0xf0fa('0x7')]!==_0xf0fa('0x39')){if(_0x485fe2){return sequelize['where'](sequelize['fn'](_0xf0fa('0x3a'),sequelize[_0xf0fa('0x1c')](_0x52221a[_0xf0fa('0xf')])),{'$like':sequelize['fn'](_0xf0fa('0x3a'),'%'+_0x255f9d['query'][_0xf0fa('0x33')]+'%')});}else{var _0x1f3916={};_0x1f3916[_0x52221a[_0xf0fa('0xf')]]={'$like':'%'+_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]+'%'};return _0x1f3916;}}})});}_0x50e0bd=_[_0xf0fa('0x38')]({},_0x50e0bd,_0x255f9d[_0xf0fa('0x3b')]);return _0x50e0bd;}; \ 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(_0x19d944,_0xff0758){var _0x4703a1=function(_0x14a456){while(--_0x14a456){_0x19d944['push'](_0x19d944['shift']());}};_0x4703a1(++_0xff0758);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x249555,_0x4ed382){_0x249555=_0x249555-0x0;var _0x34d2a5=_0x9c5a[_0x249555];return _0x34d2a5;};'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 0960c62..d47b3c7 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(_0x522df5,_0x3364ae){var _0x3fffd4=function(_0xc2fed3){while(--_0xc2fed3){_0x522df5['push'](_0x522df5['shift']());}};_0x3fffd4(++_0x3364ae);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x8f7d2b,_0x1bebaf){var _0x13c298=function(_0x54717e){while(--_0x54717e){_0x8f7d2b['push'](_0x8f7d2b['shift']());}};_0x13c298(++_0x1bebaf);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 573ce70..9bc8229 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 _0xb4ce=['execSync','length','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','model','join','createHash','md5','update','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','digest','hex','substring','crypto','bimedia-machine-uuid','child_process'];(function(_0x58bcc4,_0xd97bce){var _0x827fc9=function(_0x9ac155){while(--_0x9ac155){_0x58bcc4['push'](_0x58bcc4['shift']());}};_0x827fc9(++_0xd97bce);}(_0xb4ce,0x152));var _0xeb4c=function(_0x4a873c,_0x29a35b){_0x4a873c=_0x4a873c-0x0;var _0x4f5762=_0xb4ce[_0x4a873c];return _0x4f5762;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xeb4c('0x0'));var machine=require(_0xeb4c('0x1'));var exec=require(_0xeb4c('0x2'))[_0xeb4c('0x3')];var config=require('../environment');function getInterfaces(){var _0x2a1e0a=[];var _0x1091d1=os['networkInterfaces']();var _0x4a909b=_['orderBy'](_['keys'](_0x1091d1));for(var _0x58ed46=0x0;_0x58ed46<_0x4a909b[_0xeb4c('0x4')];_0x58ed46++){var _0x4d54a1=_0x1091d1[_0x4a909b[_0x58ed46]]['filter'](function(_0x32a24a){return _0x32a24a['family']===_0xeb4c('0x5')&&_0x32a24a[_0xeb4c('0x6')]===![];});_0x2a1e0a=_0x2a1e0a['concat'](_0x4d54a1);}return _0x2a1e0a;}function getFirstInterface(){var _0x348003=_['head'](getInterfaces());return{'macAddress':_0x348003&&_0x348003[_0xeb4c('0x7')]?_0x348003[_0xeb4c('0x7')]:_0xeb4c('0x8'),'ipAddress':_0x348003&&_0x348003[_0xeb4c('0x9')]?_0x348003[_0xeb4c('0x9')]:_0xeb4c('0xa')};}exports[_0xeb4c('0xb')]=getFirstInterface;function getCPUhash(){var _0x4d920d=_[_0xeb4c('0xc')](os[_0xeb4c('0xd')]()['map'](function(_0x52e174){return _0x52e174[_0xeb4c('0xe')];}))[_0xeb4c('0xf')](':');return crypto[_0xeb4c('0x10')](_0xeb4c('0x11'))[_0xeb4c('0x12')](_0x4d920d)['digest']('hex');}exports[_0xeb4c('0x13')]=function(){var _0x22a5da=os[_0xeb4c('0x14')]();var _0x450feb=/[0-9a-f-]{36}/;if(config[_0xeb4c('0x15')]&&_0x450feb[_0xeb4c('0x16')](config['licenseToken'])){return config[_0xeb4c('0x15')];}else if(_0x22a5da===_0xeb4c('0x17')){return exec(_0xeb4c('0x18'),{'encoding':_0xeb4c('0x19')})[_0xeb4c('0x1a')]('\x0d\x0a','');}else{var _0x3324b6=getFirstInterface();var _0x1d4318=getCPUhash();var _0x594005=_0x1d4318+'|'+os[_0xeb4c('0x1b')]()+'|'+_0x3324b6['macAddress']+'|'+_0x3324b6['ipAddress'];var _0x31f768=crypto[_0xeb4c('0x10')]('md5')[_0xeb4c('0x12')](_0x594005)[_0xeb4c('0x1c')](_0xeb4c('0x1d'));return _0x31f768['substring'](0x0,0x8)+'-'+_0x31f768['substring'](0x8,0xc)+'-'+_0x31f768[_0xeb4c('0x1e')](0xc,0x10)+'-'+_0x31f768[_0xeb4c('0x1e')](0x10,0x14)+'-'+_0x31f768[_0xeb4c('0x1e')](0x14);}}; \ No newline at end of file +var _0xcc4b=['127.0.0.1','getFirstInterface','cpus','join','createHash','md5','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','family','IPv4','concat','head','mac','00:00:00:00:00:00'];(function(_0x3f7616,_0x4898e8){var _0x59c0c3=function(_0x5e5fa1){while(--_0x5e5fa1){_0x3f7616['push'](_0x3f7616['shift']());}};_0x59c0c3(++_0x4898e8);}(_0xcc4b,0x197));var _0xbcc4=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xcc4b[_0x1a6363];return _0xd22157;};'use strict';var _=require(_0xbcc4('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0xbcc4('0x1'));var exec=require(_0xbcc4('0x2'))[_0xbcc4('0x3')];var config=require('../environment');function getInterfaces(){var _0x584ac4=[];var _0x500200=os[_0xbcc4('0x4')]();var _0x43109e=_[_0xbcc4('0x5')](_['keys'](_0x500200));for(var _0x518232=0x0;_0x518232<_0x43109e[_0xbcc4('0x6')];_0x518232++){var _0x551b35=_0x500200[_0x43109e[_0x518232]]['filter'](function(_0xef115b){return _0xef115b[_0xbcc4('0x7')]===_0xbcc4('0x8')&&_0xef115b['internal']===![];});_0x584ac4=_0x584ac4[_0xbcc4('0x9')](_0x551b35);}return _0x584ac4;}function getFirstInterface(){var _0x15ffd8=_[_0xbcc4('0xa')](getInterfaces());return{'macAddress':_0x15ffd8&&_0x15ffd8[_0xbcc4('0xb')]?_0x15ffd8[_0xbcc4('0xb')]:_0xbcc4('0xc'),'ipAddress':_0x15ffd8&&_0x15ffd8['address']?_0x15ffd8['address']:_0xbcc4('0xd')};}exports[_0xbcc4('0xe')]=getFirstInterface;function getCPUhash(){var _0xe146e9=_[_0xbcc4('0x5')](os[_0xbcc4('0xf')]()['map'](function(_0x2a65ee){return _0x2a65ee['model'];}))[_0xbcc4('0x10')](':');return crypto[_0xbcc4('0x11')](_0xbcc4('0x12'))['update'](_0xe146e9)['digest'](_0xbcc4('0x13'));}exports[_0xbcc4('0x14')]=function(){var _0x129535=os['platform']();var _0x5de046=/[0-9a-f-]{36}/;if(config[_0xbcc4('0x15')]&&_0x5de046['test'](config[_0xbcc4('0x15')])){return config[_0xbcc4('0x15')];}else if(_0x129535===_0xbcc4('0x16')){return exec(_0xbcc4('0x17'),{'encoding':_0xbcc4('0x18')})['replace']('\x0d\x0a','');}else{var _0x4bfff7=getFirstInterface();var _0x32854f=getCPUhash();var _0x2b8351=_0x32854f+'|'+os[_0xbcc4('0x19')]()+'|'+_0x4bfff7[_0xbcc4('0x1a')]+'|'+_0x4bfff7[_0xbcc4('0x1b')];var _0x4b57a8=crypto['createHash']('md5')[_0xbcc4('0x1c')](_0x2b8351)['digest'](_0xbcc4('0x13'));return _0x4b57a8[_0xbcc4('0x1d')](0x0,0x8)+'-'+_0x4b57a8[_0xbcc4('0x1d')](0x8,0xc)+'-'+_0x4b57a8[_0xbcc4('0x1d')](0xc,0x10)+'-'+_0x4b57a8[_0xbcc4('0x1d')](0x10,0x14)+'-'+_0x4b57a8[_0xbcc4('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3a57420..a7dc5c5 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 _0xe19a=['catch','get','data2','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe19a,0x158));var _0xae19=function(_0x36fa31,_0x33ddeb){_0x36fa31=_0x36fa31-0x0;var _0x191e7d=_0xe19a[_0x36fa31];return _0x191e7d;};'use strict';var util=require(_0xae19('0x0'));var moment=require(_0xae19('0x1'));var rp=require('request-promise');var BPromise=require(_0xae19('0x2'));var pkginfo=require(_0xae19('0x3'))(module,_0xae19('0x4'));var db=require(_0xae19('0x5'))['db'];var encryptor=require(_0xae19('0x6'));var hardware=require(_0xae19('0x7'));var logger=require(_0xae19('0x8'))(_0xae19('0x9'));var HOST=_0xae19('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x27fc90){return new BPromise(function(_0x353747,_0x382000){var _0x7b2c1=util['format'](_0xae19('0xb'),HOST,_0x27fc90,module[_0xae19('0xc')][_0xae19('0x4')]);if(oldToken){_0x7b2c1=util['format'](_0xae19('0xd'),HOST,_0x27fc90,module[_0xae19('0xc')][_0xae19('0x4')],oldToken);}var _0x124a56={'uri':_0x7b2c1,'method':_0xae19('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x124a56)[_0xae19('0xf')](function(_0x20b82e){_0x353747(_0x20b82e);})[_0xae19('0x10')](function(_0x50de9c){_0x382000(_0x50de9c);});});}function manageLicense(_0x8b9193,_0x35c843){var _0x20b85a=_0x35c843[_0xae19('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x20b85a['data1']!==_0x8b9193&&!_0x20b85a[_0xae19('0x12')]){oldToken=_0x20b85a[_0xae19('0x13')];}httpRequest(_0x8b9193)['then'](function(_0x1860dd){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1860dd[_0xae19('0x14')]){isOldTokenSent=![];if(!_0x20b85a[_0xae19('0x9')]&&_0x20b85a[_0xae19('0x9')]!=_0x1860dd[_0xae19('0x9')]||_0x20b85a[_0xae19('0x9')]&&_0x20b85a[_0xae19('0x12')]){logger[_0xae19('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x20b85a[_0xae19('0x9')]&&!_0x20b85a[_0xae19('0x12')]&&_0x20b85a['license']!=_0x1860dd[_0xae19('0x9')]){logger[_0xae19('0x15')](_0xae19('0x16'));}if(_0x20b85a[_0xae19('0x9')]&&!_0x20b85a['data2']&&_0x20b85a['license']==_0x1860dd['license']){return _0x35c843;}return _0x35c843[_0xae19('0x17')]({'data1':_0x8b9193,'data2':null,'license':_0x1860dd[_0xae19('0x9')]});}else{if(_0x1860dd[_0xae19('0x9')]||_0x20b85a['license']){if(!_0x20b85a[_0xae19('0x12')]){if(_0x20b85a['data1']==_0x8b9193){GRAY_PERIOD_REASON=_0xae19('0x18');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xae19('0x19');logger['info'](_0xae19('0x1a'),_0x20b85a[_0xae19('0x13')],_0x8b9193);}logger[_0xae19('0x15')](_0xae19('0x1b'),GRAY_PERIOD_REASON[_0xae19('0x1c')](),moment()[_0xae19('0x1d')](_0xae19('0x1e')));return _0x35c843['update']({'data2':encryptor[_0xae19('0x1f')](moment()['format'](_0xae19('0x1e')))});}else{if(moment()[_0xae19('0x20')](encryptor[_0xae19('0x21')](_0x20b85a['data2']),_0xae19('0x22'))>DAYS){logger[_0xae19('0x15')](_0xae19('0x23'),moment()['format'](_0xae19('0x1e')));isOldTokenSent=![];return _0x35c843[_0xae19('0x17')]({'data1':_0x8b9193,'data2':null,'license':null});}}}else{if(_0x20b85a[_0xae19('0x13')]!=_0x8b9193){logger[_0xae19('0x15')](_0xae19('0x1a'),_0x20b85a['data1'],_0x8b9193);return _0x35c843['update']({'data1':_0x8b9193,'data2':null,'license':null});}}}return _0x35c843;})[_0xae19('0xf')](function(_0x42026c){_0x35c843=_0x42026c;})[_0xae19('0x10')](function(_0x562331){logger[_0xae19('0x24')](_0x562331['message']);})[_0xae19('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xae19('0x26')](),_0x35c843);},TIME);});}function defaultLicense(){var _0x390963=hardware[_0xae19('0x26')]();if(_0x390963){return db[_0xae19('0x27')][_0xae19('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x390963}})[_0xae19('0x29')](function(_0x2494ee,_0x38cdcf){logger[_0xae19('0x15')](_0xae19('0x2a'),_0x390963);manageLicense(_0x390963,_0x2494ee);})[_0xae19('0x10')](function(_0x467221){logger['error'](_0x467221[_0xae19('0x2b')]);});}}exports[_0xae19('0x2c')]=defaultLicense; \ No newline at end of file +var _0x9ecf=['../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','bluebird','version','../../mysqldb'];(function(_0x43e75e,_0x324f5f){var _0x159ee9=function(_0x2b61fa){while(--_0x2b61fa){_0x43e75e['push'](_0x43e75e['shift']());}};_0x159ee9(++_0x324f5f);}(_0x9ecf,0x143));var _0xf9ec=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0x9ecf[_0xd07e81];return _0x379364;};'use strict';var util=require(_0xf9ec('0x0'));var moment=require(_0xf9ec('0x1'));var rp=require('request-promise');var BPromise=require(_0xf9ec('0x2'));var pkginfo=require('pkginfo')(module,_0xf9ec('0x3'));var db=require(_0xf9ec('0x4'))['db'];var encryptor=require(_0xf9ec('0x5'));var hardware=require('./hardware');var logger=require(_0xf9ec('0x6'))(_0xf9ec('0x7'));var HOST=_0xf9ec('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4f42af){return new BPromise(function(_0x1e29fb,_0x320860){var _0x22ae11=util[_0xf9ec('0x9')](_0xf9ec('0xa'),HOST,_0x4f42af,module[_0xf9ec('0xb')][_0xf9ec('0x3')]);if(oldToken){_0x22ae11=util['format'](_0xf9ec('0xc'),HOST,_0x4f42af,module[_0xf9ec('0xb')][_0xf9ec('0x3')],oldToken);}var _0x4b6e3a={'uri':_0x22ae11,'method':_0xf9ec('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4b6e3a)[_0xf9ec('0xe')](function(_0x1f46d2){_0x1e29fb(_0x1f46d2);})[_0xf9ec('0xf')](function(_0x51b87b){_0x320860(_0x51b87b);});});}function manageLicense(_0x5b2cd0,_0x242c7a){var _0x3b125e=_0x242c7a[_0xf9ec('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x3b125e[_0xf9ec('0x11')]!==_0x5b2cd0&&!_0x3b125e['data2']){oldToken=_0x3b125e['data1'];}httpRequest(_0x5b2cd0)[_0xf9ec('0xe')](function(_0x2047b3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2047b3[_0xf9ec('0x12')]){isOldTokenSent=![];if(!_0x3b125e[_0xf9ec('0x7')]&&_0x3b125e[_0xf9ec('0x7')]!=_0x2047b3[_0xf9ec('0x7')]||_0x3b125e[_0xf9ec('0x7')]&&_0x3b125e[_0xf9ec('0x13')]){logger[_0xf9ec('0x14')](_0xf9ec('0x15'));}if(_0x3b125e[_0xf9ec('0x7')]&&!_0x3b125e[_0xf9ec('0x13')]&&_0x3b125e[_0xf9ec('0x7')]!=_0x2047b3[_0xf9ec('0x7')]){logger[_0xf9ec('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x3b125e[_0xf9ec('0x7')]&&!_0x3b125e[_0xf9ec('0x13')]&&_0x3b125e['license']==_0x2047b3[_0xf9ec('0x7')]){return _0x242c7a;}return _0x242c7a[_0xf9ec('0x16')]({'data1':_0x5b2cd0,'data2':null,'license':_0x2047b3[_0xf9ec('0x7')]});}else{if(_0x2047b3[_0xf9ec('0x7')]||_0x3b125e[_0xf9ec('0x7')]){if(!_0x3b125e[_0xf9ec('0x13')]){if(_0x3b125e[_0xf9ec('0x11')]==_0x5b2cd0){GRAY_PERIOD_REASON=_0xf9ec('0x17');logger[_0xf9ec('0x14')](_0xf9ec('0x18'));}else{GRAY_PERIOD_REASON=_0xf9ec('0x19');logger[_0xf9ec('0x14')](_0xf9ec('0x1a'),_0x3b125e['data1'],_0x5b2cd0);}logger[_0xf9ec('0x14')](_0xf9ec('0x1b'),GRAY_PERIOD_REASON[_0xf9ec('0x1c')](),moment()['format'](_0xf9ec('0x1d')));return _0x242c7a[_0xf9ec('0x16')]({'data2':encryptor[_0xf9ec('0x1e')](moment()[_0xf9ec('0x9')](_0xf9ec('0x1d')))});}else{if(moment()[_0xf9ec('0x1f')](encryptor['decryptString'](_0x3b125e['data2']),_0xf9ec('0x20'))>DAYS){logger['info'](_0xf9ec('0x21'),moment()['format'](_0xf9ec('0x1d')));isOldTokenSent=![];return _0x242c7a['update']({'data1':_0x5b2cd0,'data2':null,'license':null});}}}else{if(_0x3b125e['data1']!=_0x5b2cd0){logger[_0xf9ec('0x14')](_0xf9ec('0x1a'),_0x3b125e[_0xf9ec('0x11')],_0x5b2cd0);return _0x242c7a[_0xf9ec('0x16')]({'data1':_0x5b2cd0,'data2':null,'license':null});}}}return _0x242c7a;})[_0xf9ec('0xe')](function(_0x25bc80){_0x242c7a=_0x25bc80;})[_0xf9ec('0xf')](function(_0x5b85b7){logger[_0xf9ec('0x22')](_0x5b85b7[_0xf9ec('0x23')]);})[_0xf9ec('0x24')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x242c7a);},TIME);});}function defaultLicense(){var _0x3149a8=hardware[_0xf9ec('0x25')]();if(_0x3149a8){return db[_0xf9ec('0x26')][_0xf9ec('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x3149a8}})['spread'](function(_0x5e41eb,_0x1578ba){logger[_0xf9ec('0x14')](_0xf9ec('0x28'),_0x3149a8);manageLicense(_0x3149a8,_0x5e41eb);})['catch'](function(_0x26f85e){logger[_0xf9ec('0x22')](_0x26f85e[_0xf9ec('0x23')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index eaaaa8a..c1c7387 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 _0x343a=['user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','days','format','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','telephone','users','telephones','forEach','count','catch','pick','countBy'];(function(_0x90aa55,_0x2838de){var _0x187e8b=function(_0x3715dd){while(--_0x3715dd){_0x90aa55['push'](_0x90aa55['shift']());}};_0x187e8b(++_0x2838de);}(_0x343a,0x12f));var _0xa343=function(_0x3f3d9b,_0x27f7cc){_0x3f3d9b=_0x3f3d9b-0x0;var _0x3c5010=_0x343a[_0x3f3d9b];return _0x3c5010;};'use strict';var util=require('util');var _=require(_0xa343('0x0'));var moment=require(_0xa343('0x1'));var BPromise=require(_0xa343('0x2'));var hardware=require(_0xa343('0x3'));var encryptor=require(_0xa343('0x4'));var db=require(_0xa343('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa343('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xa343('0x7'),'machineUuid':hardware[_0xa343('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xa343('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xa343('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x19abc2){return new BPromise(function(_0x4e3f45,_0x312036){return db[_0xa343('0xa')][_0xa343('0xb')](_[_0xa343('0xc')](_0x19abc2,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3189c3){return checkLicense(_0x3189c3,null);})[_0xa343('0xd')](function(_0x4461cf){_0x4e3f45(_0x4461cf);return;})['catch'](function(_0x1b37ff){_0x312036(_0x1b37ff);});});}function checkLicense(_0x550b31,_0x3e6e74){if(!_0x550b31){demoLicense[_0xa343('0xe')]=_0x550b31[_0xa343('0xf')];return demoLicense;}try{var _0x1acc3a=_0x3e6e74||_0x550b31[_0xa343('0x10')];if(_[_0xa343('0x11')](_0x1acc3a)){throw new Error(_0xa343('0x12'));}var _0x46b16b=_0x550b31['data1'];var _0x5d2dc9=_0x550b31[_0xa343('0x13')];var _0x18ee89=_0x46b16b[_0xa343('0x14')]('-')[0x4];var _0x1b8fb2=_0x46b16b[_0xa343('0x14')]('-')[0x0];var _0x3e450f=encryptor[_0xa343('0x15')](_0x1acc3a,util['format'](_0xa343('0x16'),_0x18ee89,_0x46b16b,_0x1b8fb2));var _0x3ad2dd=JSON[_0xa343('0x17')](_0x3e450f);_0x3ad2dd[_0xa343('0x18')]=![];_0x3ad2dd['uuid']=_0x46b16b;_0x3ad2dd[_0xa343('0x19')]=hardware['getUuid']();if(_0x5d2dc9){var _0xaf19db=encryptor[_0xa343('0x15')](_0x5d2dc9);_0x3ad2dd[_0xa343('0x1a')]=_0xaf19db;_0x3ad2dd['deadline']=moment(_0xaf19db)['add'](0x7,_0xa343('0x1b'))[_0xa343('0x1c')]();_0x3ad2dd[_0xa343('0x1d')]=_0x3ad2dd[_0xa343('0xe')]!=_0x3ad2dd['machineUuid']?'changed':_0xa343('0x1e');}return _0x3ad2dd;}catch(_0x1ea5d2){breakingLicense[_0xa343('0xe')]=_0x550b31[_0xa343('0xf')];breakingLicense[_0xa343('0x1f')]=_0x1ea5d2[_0xa343('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1cfd9c,_0x2e9258){getLicense()['then'](function(_0x2f4608){return db[_0xa343('0x20')][_0xa343('0x21')]({'attributes':[_0xa343('0x22'),[db[_0xa343('0x23')]['fn'](_0xa343('0x24'),db[_0xa343('0x23')][_0xa343('0x25')](_0xa343('0x22'))),'count']],'group':_0xa343('0x22'),'where':{'role':{'$or':[_0xa343('0x26'),'user',_0xa343('0x27')]}},'raw':!![]})[_0xa343('0xd')](function(_0x3debf2){var _0x3eb93e={'user':_0x2f4608[_0xa343('0x28')]||0x0,'telephone':_0x2f4608[_0xa343('0x29')]||0x0};_0x3debf2[_0xa343('0x2a')](function(_0xe2ae20){var _0x2b92c9=_0xe2ae20['role']===_0xa343('0x26')?'user':_0xe2ae20[_0xa343('0x22')];_0x3eb93e[_0x2b92c9]-=_0xe2ae20[_0xa343('0x2b')];if(_0x3eb93e[_0x2b92c9]<0x0)_0x3eb93e[_0x2b92c9]=0x0;});_0x1cfd9c(_0x3eb93e);return;});})[_0xa343('0x2c')](function(_0x3ae723){_0x2e9258(_0x3ae723);});});}function checkUserLimits(_0x570774){return new BPromise(function(_0x340f19,_0x12c9bf){getLimits()[_0xa343('0xd')](function(_0x24875f){var _0x24016e=_[_0xa343('0x2d')](_[_0xa343('0x2e')](_0x570774,'role'),[_0xa343('0x26'),_0xa343('0x2f'),_0xa343('0x27')]);var _0x1eefce=(_0x24016e[_0xa343('0x26')]||0x0)+(_0x24016e[_0xa343('0x2f')]||0x0);var _0x402981=_0x24016e[_0xa343('0x27')]||0x0;if(_0x1eefce>_0x24875f[_0xa343('0x2f')])return _0x12c9bf(_0xa343('0x30'));if(_0x402981>_0x24875f['telephone'])return _0x12c9bf(_0xa343('0x31'));return _0x340f19();})[_0xa343('0x2c')](function(_0x54196f){_0x12c9bf(_0x54196f);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x960f=['telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','License','find','defaults','then','catch','data1','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','uuid','getUuid','gray','deadline','add','days','grayReason','machineUuid','message','User','findAll','sequelize','COUNT','role','count','admin','user','users','telephones','forEach','pick','countBy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x960f,0x1b3));var _0xf960=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x960f[_0x1d4449];return _0x4dcde3;};'use strict';var util=require(_0xf960('0x0'));var _=require(_0xf960('0x1'));var moment=require(_0xf960('0x2'));var BPromise=require(_0xf960('0x3'));var hardware=require(_0xf960('0x4'));var encryptor=require(_0xf960('0x5'));var db=require(_0xf960('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xf960('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xf960('0x8'),'machineUuid':hardware['getUuid'](),'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':_0xf960('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x27a8ba){return new BPromise(function(_0x575901,_0x5c9df9){return db[_0xf960('0xa')][_0xf960('0xb')](_[_0xf960('0xc')](_0x27a8ba,{'raw':!![],'where':{'id':0x1}}))[_0xf960('0xd')](function(_0xe54e38){return checkLicense(_0xe54e38,null);})['then'](function(_0x26b1b6){_0x575901(_0x26b1b6);return;})[_0xf960('0xe')](function(_0x10810f){_0x5c9df9(_0x10810f);});});}function checkLicense(_0x4e69c0,_0x513f14){if(!_0x4e69c0){demoLicense['uuid']=_0x4e69c0[_0xf960('0xf')];return demoLicense;}try{var _0x4f8465=_0x513f14||_0x4e69c0['license'];if(_[_0xf960('0x10')](_0x4f8465)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3f88eb=_0x4e69c0[_0xf960('0xf')];var _0x15a1c7=_0x4e69c0[_0xf960('0x11')];var _0x51eb45=_0x3f88eb[_0xf960('0x12')]('-')[0x4];var _0x14c8d5=_0x3f88eb['split']('-')[0x0];var _0x1e17dc=encryptor[_0xf960('0x13')](_0x4f8465,util[_0xf960('0x14')](_0xf960('0x15'),_0x51eb45,_0x3f88eb,_0x14c8d5));var _0x5ef7e2=JSON[_0xf960('0x16')](_0x1e17dc);_0x5ef7e2['demo']=![];_0x5ef7e2[_0xf960('0x17')]=_0x3f88eb;_0x5ef7e2['machineUuid']=hardware[_0xf960('0x18')]();if(_0x15a1c7){var _0x4436f6=encryptor['decryptString'](_0x15a1c7);_0x5ef7e2[_0xf960('0x19')]=_0x4436f6;_0x5ef7e2[_0xf960('0x1a')]=moment(_0x4436f6)[_0xf960('0x1b')](0x7,_0xf960('0x1c'))[_0xf960('0x14')]();_0x5ef7e2[_0xf960('0x1d')]=_0x5ef7e2[_0xf960('0x17')]!=_0x5ef7e2[_0xf960('0x1e')]?'changed':'disabled';}return _0x5ef7e2;}catch(_0x6b9106){breakingLicense[_0xf960('0x17')]=_0x4e69c0[_0xf960('0xf')];breakingLicense[_0xf960('0x1f')]=_0x6b9106[_0xf960('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x42ccc2,_0x6d1dc5){getLicense()['then'](function(_0x1d659b){return db[_0xf960('0x20')][_0xf960('0x21')]({'attributes':['role',[db[_0xf960('0x22')]['fn'](_0xf960('0x23'),db[_0xf960('0x22')]['col'](_0xf960('0x24'))),_0xf960('0x25')]],'group':_0xf960('0x24'),'where':{'role':{'$or':[_0xf960('0x26'),_0xf960('0x27'),'telephone']}},'raw':!![]})[_0xf960('0xd')](function(_0x2dac62){var _0x209302={'user':_0x1d659b[_0xf960('0x28')]||0x0,'telephone':_0x1d659b[_0xf960('0x29')]||0x0};_0x2dac62[_0xf960('0x2a')](function(_0x170b6d){var _0x506df0=_0x170b6d[_0xf960('0x24')]===_0xf960('0x26')?'user':_0x170b6d[_0xf960('0x24')];_0x209302[_0x506df0]-=_0x170b6d[_0xf960('0x25')];if(_0x209302[_0x506df0]<0x0)_0x209302[_0x506df0]=0x0;});_0x42ccc2(_0x209302);return;});})['catch'](function(_0xfc8a27){_0x6d1dc5(_0xfc8a27);});});}function checkUserLimits(_0x154fd9){return new BPromise(function(_0x26510a,_0x10e8a4){getLimits()[_0xf960('0xd')](function(_0x569850){var _0x272dbb=_[_0xf960('0x2b')](_[_0xf960('0x2c')](_0x154fd9,'role'),[_0xf960('0x26'),_0xf960('0x27'),_0xf960('0x2d')]);var _0x3967dc=(_0x272dbb[_0xf960('0x26')]||0x0)+(_0x272dbb['user']||0x0);var _0x4b3630=_0x272dbb['telephone']||0x0;if(_0x3967dc>_0x569850[_0xf960('0x27')])return _0x10e8a4('License\x20limit\x20reached\x20for\x20users');if(_0x4b3630>_0x569850['telephone'])return _0x10e8a4(_0xf960('0x2e'));return _0x26510a();})[_0xf960('0xe')](function(_0x3d0707){_0x10e8a4(_0x3d0707);});});}module[_0xf960('0x2f')]={'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 6c9f17c..00e9644 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfb11[_0x3b380d];return _0x54502b;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5204=['http://localhost:9000','app-id','secret','exports'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0x5204,0xdf));var _0x4520=function(_0x3c2166,_0x41fc16){_0x3c2166=_0x3c2166-0x0;var _0x30ccc3=_0x5204[_0x3c2166];return _0x30ccc3;};'use strict';module[_0x4520('0x0')]={'DOMAIN':_0x4520('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4520('0x2'),'GOOGLE_SECRET':_0x4520('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3b48477..7334e5a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dfb=['../utils/loggers','fileLogger','exports'];(function(_0x1fd1c5,_0x4182e9){var _0x4517f2=function(_0x370476){while(--_0x370476){_0x1fd1c5['push'](_0x1fd1c5['shift']());}};_0x4517f2(++_0x4182e9);}(_0x6dfb,0x150));var _0xb6df=function(_0x354892,_0xc85e){_0x354892=_0x354892-0x0;var _0x3cda3b=_0x6dfb[_0x354892];return _0x3cda3b;};'use strict';var fileLogger=require(_0xb6df('0x0'))[_0xb6df('0x1')];module[_0xb6df('0x2')]=fileLogger; \ No newline at end of file +var _0xbd90=['../utils/loggers'];(function(_0x1bb58c,_0x2c8a4d){var _0x277586=function(_0x11fd4c){while(--_0x11fd4c){_0x1bb58c['push'](_0x1bb58c['shift']());}};_0x277586(++_0x2c8a4d);}(_0xbd90,0x138));var _0x0bd9=function(_0x4966fa,_0x266da6){_0x4966fa=_0x4966fa-0x0;var _0x1a2acb=_0xbd90[_0x4966fa];return _0x1a2acb;};'use strict';var fileLogger=require(_0x0bd9('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index d4d6a27..a0f04c5 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 _0x9a14=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x41c02c,_0x27b180){var _0x19b098=function(_0x2b89ba){while(--_0x2b89ba){_0x41c02c['push'](_0x41c02c['shift']());}};_0x19b098(++_0x27b180);}(_0x9a14,0x17e));var _0x49a1=function(_0x6d21d8,_0x1097ae){_0x6d21d8=_0x6d21d8-0x0;var _0x1d8caa=_0x9a14[_0x6d21d8];return _0x1d8caa;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path[_0x49a1('0x0')](__dirname,_0x49a1('0x1'))},{'name':_0x49a1('0x2'),'script':path[_0x49a1('0x0')](__dirname,_0x49a1('0x3'))},{'name':_0x49a1('0x4'),'script':path[_0x49a1('0x0')](__dirname,_0x49a1('0x5'))},{'name':_0x49a1('0x6'),'script':path['join'](__dirname,_0x49a1('0x7'))},{'name':_0x49a1('0x8'),'script':path[_0x49a1('0x0')](__dirname,_0x49a1('0x9'))},{'name':_0x49a1('0xa'),'script':path[_0x49a1('0x0')](__dirname,_0x49a1('0xb'))}]};module[_0x49a1('0xc')]=config; \ No newline at end of file +var _0xd5e9=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','agi','../../services/agi/index.js'];(function(_0xd27275,_0x582ea7){var _0x23523e=function(_0x569b30){while(--_0x569b30){_0xd27275['push'](_0xd27275['shift']());}};_0x23523e(++_0x582ea7);}(_0xd5e9,0x72));var _0x9d5e=function(_0x449b2a,_0x5154c4){_0x449b2a=_0x449b2a-0x0;var _0x5c0ec2=_0xd5e9[_0x449b2a];return _0x5c0ec2;};'use strict';var path=require(_0x9d5e('0x0'));var os=require('os');var config={'apps':[{'name':_0x9d5e('0x1'),'script':path[_0x9d5e('0x2')](__dirname,_0x9d5e('0x3'))},{'name':'ami','script':path[_0x9d5e('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x9d5e('0x4'),'script':path[_0x9d5e('0x2')](__dirname,_0x9d5e('0x5'))},{'name':_0x9d5e('0x6'),'script':path['join'](__dirname,_0x9d5e('0x7'))},{'name':_0x9d5e('0x8'),'script':path[_0x9d5e('0x2')](__dirname,_0x9d5e('0x9'))},{'name':_0x9d5e('0xa'),'script':path['join'](__dirname,_0x9d5e('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3b2bd97..3ef76d0 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 _0x5988=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x57296a,_0x1a632d){var _0x2cb082=function(_0x2eeb17){while(--_0x2eeb17){_0x57296a['push'](_0x57296a['shift']());}};_0x2cb082(++_0x1a632d);}(_0x5988,0x154));var _0x8598=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5988[_0x465028];return _0xb783d4;};'use strict';var pm2=require(_0x8598('0x0'));var BPromise=require(_0x8598('0x1'));var config=require(_0x8598('0x2'));function connect(){return new BPromise(function(_0x2b472a,_0x51acf8){return pm2[_0x8598('0x3')](function(_0x2dfc5e){if(_0x2dfc5e){return _0x51acf8(_0x2dfc5e);}return _0x2b472a(_0x8598('0x4'));});});};exports[_0x8598('0x5')]=function(_0x5bee93){return connect()[_0x8598('0x6')](function(){return new BPromise(function(_0x12b58f,_0x14340d){return pm2[_0x8598('0x5')](_0x5bee93,function(_0x14ca10,_0x925ad4){if(_0x14ca10){return _0x14340d(_0x14ca10);}pm2[_0x8598('0x7')]();return _0x12b58f(_0x925ad4);});});});};exports[_0x8598('0x8')]=function(_0xbe8dc5){return connect()['then'](function(){return new BPromise(function(_0x343f25,_0x54aa35){return pm2[_0x8598('0x8')](_0xbe8dc5,function(_0x3a4620,_0x2fd4fa){if(_0x3a4620){return _0x54aa35(_0x3a4620);}pm2[_0x8598('0x7')]();return _0x343f25(_0x2fd4fa);});});});};exports[_0x8598('0x9')]=function(_0x25efd9){return connect()[_0x8598('0x6')](function(){return new BPromise(function(_0x494668,_0x1b9fd1){return pm2[_0x8598('0x9')](_0x25efd9,function(_0x1a87b4,_0x489339){if(_0x1a87b4){return _0x1b9fd1(_0x1a87b4);}pm2[_0x8598('0x7')]();return _0x494668(_0x489339);});});});};exports[_0x8598('0xa')]=function(){return connect()[_0x8598('0x6')](function(){return new BPromise(function(_0x5ca370,_0x1e68d0){return pm2[_0x8598('0xa')](function(_0x5103ad,_0x59fe9e){if(_0x5103ad){return _0x1e68d0(_0x5103ad);}pm2[_0x8598('0x7')]();return _0x5ca370(_0x59fe9e);});});});};exports[_0x8598('0xb')]=function(_0x55b0e6){return connect()['then'](function(){return new BPromise(function(_0x55450d,_0x5487e3){return pm2['describe'](_0x55b0e6,function(_0x3d5128,_0x1b5c5a){if(_0x3d5128){return _0x5487e3(_0x3d5128);}pm2[_0x8598('0x7')]();return _0x55450d(_0x1b5c5a);});});});};exports['delete']=function(_0x1e368a){return connect()[_0x8598('0x6')](function(){return new BPromise(function(_0x433ff4,_0x486980){return pm2[_0x8598('0xc')](_0x1e368a,function(_0xce9fe3,_0x425fe4){if(_0xce9fe3){return _0x486980(_0xce9fe3);}pm2[_0x8598('0x7')]();return _0x433ff4(_0x425fe4);});});});};exports['dump']=function(){return connect()[_0x8598('0x6')](function(){return new BPromise(function(_0x4cc7fa,_0x124401){return pm2[_0x8598('0xd')](function(_0x4b2163){if(_0x4b2163){return _0x124401(_0x4b2163);}return _0x4cc7fa(_0x8598('0xe'));});});});}; \ No newline at end of file +var _0x9078=['then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config','connected','start'];(function(_0x32c50c,_0x3a56d8){var _0x4721fb=function(_0x3f673b){while(--_0x3f673b){_0x32c50c['push'](_0x32c50c['shift']());}};_0x4721fb(++_0x3a56d8);}(_0x9078,0x141));var _0x8907=function(_0x5dfda6,_0x56eb9c){_0x5dfda6=_0x5dfda6-0x0;var _0x27c9f1=_0x9078[_0x5dfda6];return _0x27c9f1;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8907('0x0'));var config=require(_0x8907('0x1'));function connect(){return new BPromise(function(_0x4060c9,_0x20b401){return pm2['connect'](function(_0x21bcdf){if(_0x21bcdf){return _0x20b401(_0x21bcdf);}return _0x4060c9(_0x8907('0x2'));});});};exports[_0x8907('0x3')]=function(_0x27022a){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x34756c,_0x4233f8){return pm2['start'](_0x27022a,function(_0x3c79fa,_0x2373c7){if(_0x3c79fa){return _0x4233f8(_0x3c79fa);}pm2[_0x8907('0x5')]();return _0x34756c(_0x2373c7);});});});};exports[_0x8907('0x6')]=function(_0x512b1b){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x165dc6,_0x53b7cd){return pm2[_0x8907('0x6')](_0x512b1b,function(_0x6e064e,_0x49669b){if(_0x6e064e){return _0x53b7cd(_0x6e064e);}pm2[_0x8907('0x5')]();return _0x165dc6(_0x49669b);});});});};exports['restart']=function(_0x267704){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x1c553d,_0x3eb98c){return pm2[_0x8907('0x7')](_0x267704,function(_0x2a427a,_0x525fbb){if(_0x2a427a){return _0x3eb98c(_0x2a427a);}pm2['disconnect']();return _0x1c553d(_0x525fbb);});});});};exports[_0x8907('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x174c6c,_0x4a66d4){return pm2['list'](function(_0x5749c9,_0x2752f6){if(_0x5749c9){return _0x4a66d4(_0x5749c9);}pm2['disconnect']();return _0x174c6c(_0x2752f6);});});});};exports[_0x8907('0x9')]=function(_0xe2a7c7){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x393667,_0xde7a0f){return pm2[_0x8907('0x9')](_0xe2a7c7,function(_0x52c09b,_0x2d1968){if(_0x52c09b){return _0xde7a0f(_0x52c09b);}pm2[_0x8907('0x5')]();return _0x393667(_0x2d1968);});});});};exports[_0x8907('0xa')]=function(_0x956164){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x36798d,_0x36b0d4){return pm2[_0x8907('0xa')](_0x956164,function(_0x4d87bc,_0x155350){if(_0x4d87bc){return _0x36b0d4(_0x4d87bc);}pm2['disconnect']();return _0x36798d(_0x155350);});});});};exports[_0x8907('0xb')]=function(){return connect()[_0x8907('0x4')](function(){return new BPromise(function(_0x4a5de0,_0x2b44d0){return pm2[_0x8907('0xb')](function(_0x4cdf10){if(_0x4cdf10){return _0x2b44d0(_0x4cdf10);}return _0x4a5de0(_0x8907('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c5aebea..91d31c8 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 _0x21c5=['inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout','findAll','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','catch','error','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x201ccf,_0x1fd8b6){var _0x294142=function(_0x1f746a){while(--_0x1f746a){_0x201ccf['push'](_0x201ccf['shift']());}};_0x294142(++_0x1fd8b6);}(_0x21c5,0x1ef));var _0x521c=function(_0x4177a2,_0x476c18){_0x4177a2=_0x4177a2-0x0;var _0x4e1124=_0x21c5[_0x4177a2];return _0x4e1124;};'use strict';var _=require(_0x521c('0x0'));var moment=require('moment');var Redis=require(_0x521c('0x1'));var util=require(_0x521c('0x2'));var config=require(_0x521c('0x3'));var db=require(_0x521c('0x4'))['db'];var logger=require('../logger')(_0x521c('0x5'));config[_0x521c('0x6')]=_[_0x521c('0x7')](config[_0x521c('0x6')],{'host':_0x521c('0x8'),'port':0x18eb});var io=require(_0x521c('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x487898=0x0;var _0x313bf6=[];return db['Setting'][_0x521c('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x521c('0xb')](function(_0x2feb9f){_0x487898=_0x2feb9f[_0x521c('0xc')];if(_0x487898){return db['ChatInteraction'][_0x521c('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2feb9f[_0x521c('0xc')],'minutes')}}});}else{return[];}})[_0x521c('0xb')](function(_0x19ea20){if(_0x19ea20&&_0x19ea20[_0x521c('0xe')]){_0x313bf6=_[_0x521c('0xf')](_0x19ea20||[],'id');logger[_0x521c('0x10')](_0x521c('0x11'),_0x313bf6[_0x521c('0x12')]());return db['ChatInteraction']['update']({'closeReason':_0x521c('0x13'),'disposition':_0x521c('0x14'),'closed':!![],'closedAt':moment()[_0x521c('0x15')](_0x521c('0x16'))},{'where':{'id':_0x313bf6}});}})[_0x521c('0xb')](function(){if(_0x313bf6&&_0x313bf6[_0x521c('0xe')]){logger[_0x521c('0x10')](_0x521c('0x17'),_0x313bf6[_0x521c('0x12')]());for(var _0x3e1076=0x0;_0x3e1076<_0x313bf6['length'];_0x3e1076++){io['emit']('chatInteraction:update',{'id':_0x313bf6[_0x3e1076],'closed':!![]});}}})[_0x521c('0x18')](function(_0x3e66d8){logger[_0x521c('0x19')](_0x521c('0x1a'),_0x3e66d8?util[_0x521c('0x1b')](_0x3e66d8,{'showHidden':![],'depth':null}):'');});}exports[_0x521c('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa52a=['[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','ChatInteraction','findAll','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','join','emit','chatInteraction:update','catch','error'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa52a,0x1b5));var _0xaa52=function(_0x34520d,_0x31419e){_0x34520d=_0x34520d-0x0;var _0x8b8eb=_0xa52a[_0x34520d];return _0x8b8eb;};'use strict';var _=require('lodash');var moment=require(_0xaa52('0x0'));var Redis=require(_0xaa52('0x1'));var util=require(_0xaa52('0x2'));var config=require(_0xaa52('0x3'));var db=require(_0xaa52('0x4'))['db'];var logger=require(_0xaa52('0x5'))(_0xaa52('0x6'));config[_0xaa52('0x7')]=_[_0xaa52('0x8')](config[_0xaa52('0x7')],{'host':_0xaa52('0x9'),'port':0x18eb});var io=require(_0xaa52('0xa'))(new Redis(config[_0xaa52('0x7')]));function closeInteractions(){var _0x252017=0x0;var _0x1a3d59=[];return db['Setting'][_0xaa52('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x520951){_0x252017=_0x520951['chatTimeout'];if(_0x252017){return db[_0xaa52('0xc')][_0xaa52('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xaa52('0xe')](_0x520951['chatTimeout'],_0xaa52('0xf'))}}});}else{return[];}})[_0xaa52('0x10')](function(_0x37e0a0){if(_0x37e0a0&&_0x37e0a0[_0xaa52('0x11')]){_0x1a3d59=_['map'](_0x37e0a0||[],'id');logger[_0xaa52('0x12')](_0xaa52('0x13'),_0x1a3d59['join']());return db[_0xaa52('0xc')][_0xaa52('0x14')]({'closeReason':_0xaa52('0x15'),'disposition':_0xaa52('0x16'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1a3d59}});}})[_0xaa52('0x10')](function(){if(_0x1a3d59&&_0x1a3d59[_0xaa52('0x11')]){logger[_0xaa52('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x1a3d59[_0xaa52('0x17')]());for(var _0x2309e6=0x0;_0x2309e6<_0x1a3d59[_0xaa52('0x11')];_0x2309e6++){io[_0xaa52('0x18')](_0xaa52('0x19'),{'id':_0x1a3d59[_0x2309e6],'closed':!![]});}}})[_0xaa52('0x1a')](function(_0x6c7aac){logger[_0xaa52('0x1b')](_0xaa52('0x1c'),_0x6c7aac?util[_0xaa52('0x1d')](_0x6c7aac,{'showHidden':![],'depth':null}):'');});}exports[_0xaa52('0x1e')]=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 18eb6bc..78c6be8 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 _0x1879=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x3bbeba,_0x4b4392){var _0x568fc=function(_0x202d78){while(--_0x202d78){_0x3bbeba['push'](_0x3bbeba['shift']());}};_0x568fc(++_0x4b4392);}(_0x1879,0x101));var _0x9187=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x1879[_0x2468b5];return _0x1056e4;};'use strict';function start(){var _0xcc444=require(_0x9187('0x0'));return _0xcc444[_0x9187('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x12e6=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x45d418,_0x42febe){var _0x539d71=function(_0xf51a3f){while(--_0xf51a3f){_0x45d418['push'](_0x45d418['shift']());}};_0x539d71(++_0x42febe);}(_0x12e6,0x88));var _0x612e=function(_0xebadef,_0x49aa2e){_0xebadef=_0xebadef-0x0;var _0x4b40ac=_0x12e6[_0xebadef];return _0x4b40ac;};'use strict';function start(){var _0x1ea014=require(_0x612e('0x0'));return _0x1ea014[_0x612e('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 6af5dfb..a2bca2b 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 _0x8f4c=['YYYY-MM-DD\x20HH:mm:ss','output','isNil','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','update\x20cron','stop\x20cron','run','util','path','lodash','moment','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x8f4c,0x127));var _0xc8f4=function(_0x3f458e,_0x5da270){_0x3f458e=_0x3f458e-0x0;var _0x54e438=_0x8f4c[_0x3f458e];return _0x54e438;};'use strict';var fs=require('fs');var util=require(_0xc8f4('0x0'));var path=require(_0xc8f4('0x1'));var _=require(_0xc8f4('0x2'));var moment=require(_0xc8f4('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0xc8f4('0x4'));var logger=require('../logger')(_0xc8f4('0x5'));var db=require(_0xc8f4('0x6'))['db'];var analyticCustomReportController=require(_0xc8f4('0x7'));var analyticDefaultReportController=require(_0xc8f4('0x8'));var client=jayson[_0xc8f4('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x563902,_0x2cf8d9){return function(){logger['info'](_0xc8f4('0xa'),_0x563902['email']);var _0xbc6d58=!![];var _0x2af213=_0x563902[_0xc8f4('0xb')][_0xc8f4('0xc')]();var _0x2fd31a={'account':_0x2af213,'message':{'from':util[_0xc8f4('0xd')](_0xc8f4('0xe'),_0x563902['MailAccount'][_0xc8f4('0xf')],_0x563902['MailAccount'][_0xc8f4('0x10')]||_0x563902[_0xc8f4('0xb')][_0xc8f4('0x11')][_0xc8f4('0x12')]),'to':_0x563902[_0xc8f4('0x10')],'cc':_0x563902['cc'],'bcc':_0x563902['bcc'],'subject':util[_0xc8f4('0xd')](_0xc8f4('0x13'),_0x2cf8d9[_0xc8f4('0xf')],_0x563902['subtractNumber'],_0x563902[_0xc8f4('0x14')])}};var _0x459f94=path[_0xc8f4('0x15')](__dirname,_0xc8f4('0x16'));var _0x37fbd1=_0x2cf8d9[_0xc8f4('0x17')];var _0x36be2d=util[_0xc8f4('0xd')](_0xc8f4('0x18'),path['basename'](_0x2cf8d9['savename'],path[_0xc8f4('0x19')](_0x2cf8d9[_0xc8f4('0x17')])),'zip');var _0x4939fe=path[_0xc8f4('0x15')](_0x459f94,_0x37fbd1);var _0x46907b=path[_0xc8f4('0x15')](_0x459f94,_0x36be2d);if(fs[_0xc8f4('0x1a')](_0x4939fe)){_0x2cf8d9[_0xc8f4('0x1b')]=_0xc8f4('0x1c');_0x2fd31a[_0xc8f4('0x1d')][_0xc8f4('0x1e')]=[{'filename':_0x37fbd1,'path':_0x4939fe}];_0x2fd31a[_0xc8f4('0x1d')]['text']=util[_0xc8f4('0xd')](_0xc8f4('0x1f'),JSON[_0xc8f4('0x20')](_0x2cf8d9,null,0x2));}else if(fs[_0xc8f4('0x1a')](_0x46907b)){_0x2cf8d9['status']=_0xc8f4('0x1c');_0x2fd31a['message'][_0xc8f4('0x1e')]=[{'filename':_0x36be2d,'path':_0x46907b}];}else{_0x2fd31a['message'][_0xc8f4('0x21')]=_0xc8f4('0x22');if(!_0x563902[_0xc8f4('0x23')]){_0xbc6d58=![];logger[_0xc8f4('0x24')](_0xc8f4('0x25'));}}if(_0xbc6d58){return client[_0xc8f4('0x26')]('SendMail',_0x2fd31a)[_0xc8f4('0x27')](function(_0x3704c1){if(_0x3704c1[_0xc8f4('0x28')]){return logger[_0xc8f4('0x28')](_0xc8f4('0x29'),JSON['stringify'](_0x3704c1));}return logger[_0xc8f4('0x24')](_0xc8f4('0x2a'));})[_0xc8f4('0x2b')](function(_0x26e0b1){return logger[_0xc8f4('0x28')](_0xc8f4('0x29'),JSON[_0xc8f4('0x20')](_0x26e0b1));});}};}function handleError(){return function(_0x436b04){return logger['error'](JSON['stringify'](_0x436b04));};}function handleResult(_0x26289b){return function(_0x2314fc){logger[_0xc8f4('0x24')](_0xc8f4('0x2c'),JSON[_0xc8f4('0x20')](_0x2314fc));if(_0x26289b[_0xc8f4('0xb')]&&_0x26289b['MailAccount'][_0xc8f4('0x11')]&&!_['isNil'](_0x26289b[_0xc8f4('0x10')])){setTimeout(handleSendEmail(_0x26289b,_0x2314fc),0x3c*0x3e8);}};}function handleJob(_0x1ca2ae){return function(){try{if(_['isNil'](_0x1ca2ae[_0xc8f4('0x2d')])){return logger['info'](_0xc8f4('0x2e'));}if(_['isNil'](_0x1ca2ae[_0xc8f4('0x14')])){return logger[_0xc8f4('0x24')](_0xc8f4('0x2f'));}var _0x9d4a4e={'startDate':moment()[_0xc8f4('0x30')](_0x1ca2ae[_0xc8f4('0x2d')],_0x1ca2ae[_0xc8f4('0x14')])['format'](_0xc8f4('0x31')),'endDate':moment()[_0xc8f4('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x1ca2ae[_0xc8f4('0x32')],'name':_0x1ca2ae['name']};if(!_[_0xc8f4('0x33')](_0x1ca2ae['DefaultReportId'])){logger[_0xc8f4('0x24')]('exec\x20defaul\x20report\x20id:%s',_0x1ca2ae[_0xc8f4('0x34')]);return analyticDefaultReportController[_0xc8f4('0x35')]({'id':_0x1ca2ae[_0xc8f4('0x34')]},_0x9d4a4e)[_0xc8f4('0x27')](handleResult(_0x1ca2ae))['catch'](handleError());}if(!_['isNil'](_0x1ca2ae[_0xc8f4('0x36')])){logger['info'](_0xc8f4('0x37'),_0x1ca2ae[_0xc8f4('0x36')]);return analyticCustomReportController['runReport']({'id':_0x1ca2ae[_0xc8f4('0x36')]},_0x9d4a4e)[_0xc8f4('0x27')](handleResult(_0x1ca2ae))[_0xc8f4('0x2b')](handleError());}}catch(_0x2b749b){logger[_0xc8f4('0x28')](JSON[_0xc8f4('0x20')](_0x2b749b));}return logger[_0xc8f4('0x24')]('no\x20report\x20id');};}function getJobs(_0x2d2400){var _0x5c766f={};if(_0x2d2400){_0x5c766f['id']=_0x2d2400;}return db[_0xc8f4('0x38')][_0xc8f4('0x39')]({'where':_0x5c766f,'include':[{'model':db[_0xc8f4('0xb')],'attributes':['id',_0xc8f4('0xf'),_0xc8f4('0x10')],'include':[{'model':db[_0xc8f4('0x3a')],'as':_0xc8f4('0x11'),'include':[{'model':db[_0xc8f4('0x3b')],'as':'CloudProvider'}]}]}]})[_0xc8f4('0x27')](function(_0x37877a){var _0x418d15=_[_0xc8f4('0x3c')](manager[_0xc8f4('0x3d')]);var _0x3f5912=_[_0xc8f4('0x3e')](_0x37877a,function(_0x32aaad){return _0x32aaad['id'][_0xc8f4('0x3f')]();});var _0x451cc5=_[_0xc8f4('0x40')](_0x37877a,function(_0x542a18){return _0x542a18['id'][_0xc8f4('0x3f')]();});var _0x202b65=_0x2d2400?_0x3f5912:_[_0xc8f4('0x41')](_0x3f5912,_0x418d15);var _0x293aa7=_[_0xc8f4('0x42')](_0x3f5912,_0x418d15);var _0x17befa=_[_0xc8f4('0x41')](_0x418d15,_0x3f5912);var _0x555c08;var _0x26f2b2;for(_0x555c08=0x0;_0x555c08<_0x17befa[_0xc8f4('0x43')]&&!_0x2d2400;_0x555c08+=0x1){_0x26f2b2=_0x17befa[_0x555c08][_0xc8f4('0x3f')]();if(manager[_0xc8f4('0x44')](_0x26f2b2)){manager[_0xc8f4('0x45')](_0x26f2b2);manager[_0xc8f4('0x46')](_0x26f2b2);logger[_0xc8f4('0x24')](_0xc8f4('0x47'),_0x26f2b2);}}logger[_0xc8f4('0x24')](_0xc8f4('0x48'),JSON[_0xc8f4('0x20')](_0x202b65));for(_0x555c08=0x0;_0x555c08<_0x202b65[_0xc8f4('0x43')];_0x555c08+=0x1){_0x26f2b2=_0x202b65[_0x555c08][_0xc8f4('0x3f')]();logger[_0xc8f4('0x24')](_0xc8f4('0x49'),_0x26f2b2);if(_0x2d2400){logger[_0xc8f4('0x24')](_0xc8f4('0x4a'),_0x2d2400);logger['info'](JSON[_0xc8f4('0x20')](_0x451cc5[_0x26f2b2]));BPromise[_0xc8f4('0x4b')]()[_0xc8f4('0x27')](handleJob(_0x451cc5[_0x26f2b2]));logger['info'](_0xc8f4('0x4c'),_0x451cc5[_0x26f2b2][_0xc8f4('0xf')],_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]);}else if(_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]&&_0x451cc5[_0x26f2b2][_0xc8f4('0x4e')]&&moment()[_0xc8f4('0x4f')](_0x451cc5[_0x26f2b2]['startAt'],_0x451cc5[_0x26f2b2][_0xc8f4('0x50')])){manager[_0xc8f4('0x51')](_0x26f2b2,_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')],handleJob(_0x451cc5[_0x26f2b2]));manager[_0xc8f4('0x52')](_0x26f2b2);logger[_0xc8f4('0x24')]('add\x20cron',_0x451cc5[_0x26f2b2]['name'],_0x451cc5[_0x26f2b2]['cron']);}else if(manager['exists'](_0x26f2b2)){manager[_0xc8f4('0x45')](_0x26f2b2);manager[_0xc8f4('0x46')](_0x26f2b2);logger['info']('stop\x20cron',_0x451cc5[_0x26f2b2]['name'],_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]);}}for(_0x555c08=0x0,_0x26f2b2;_0x555c08<_0x293aa7[_0xc8f4('0x43')]&&!_0x2d2400;_0x555c08+=0x1){_0x26f2b2=_0x293aa7[_0x555c08][_0xc8f4('0x3f')]();if(manager['exists'](_0x26f2b2)){if(_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]&&_0x451cc5[_0x26f2b2][_0xc8f4('0x4e')]&&moment()['isBetween'](_0x451cc5[_0x26f2b2]['startAt'],_0x451cc5[_0x26f2b2][_0xc8f4('0x50')])){manager['update'](_0x26f2b2,_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')],handleJob(_0x451cc5[_0x26f2b2]));logger[_0xc8f4('0x24')](_0xc8f4('0x53'),_0x451cc5[_0x26f2b2]['name'],_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]);}else{manager[_0xc8f4('0x45')](_0x26f2b2);manager['deleteJob'](_0x26f2b2);logger[_0xc8f4('0x24')](_0xc8f4('0x54'),_0x451cc5[_0x26f2b2][_0xc8f4('0xf')],_0x451cc5[_0x26f2b2][_0xc8f4('0x4d')]);}}}})['catch'](function(_0x49aadd){logger['error'](JSON[_0xc8f4('0x20')](_0x49aadd));});}exports[_0xc8f4('0x55')]=function(_0x355dfe){return getJobs(_0x355dfe);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3a8b=['stop\x20cron','update','update\x20cron','stop','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','format','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','data','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron'];(function(_0x573951,_0x39034b){var _0x44a540=function(_0x15ff8d){while(--_0x15ff8d){_0x573951['push'](_0x573951['shift']());}};_0x44a540(++_0x39034b);}(_0x3a8b,0x116));var _0xb3a8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3a8b[_0x2c91e9];return _0x13f0ff;};'use strict';var fs=require('fs');var util=require(_0xb3a8('0x0'));var path=require(_0xb3a8('0x1'));var _=require(_0xb3a8('0x2'));var moment=require(_0xb3a8('0x3'));var CronJobManager=require(_0xb3a8('0x4'));var jayson=require(_0xb3a8('0x5'));var BPromise=require(_0xb3a8('0x6'));var logger=require(_0xb3a8('0x7'))(_0xb3a8('0x8'));var db=require(_0xb3a8('0x9'))['db'];var analyticCustomReportController=require(_0xb3a8('0xa'));var analyticDefaultReportController=require(_0xb3a8('0xb'));var client=jayson[_0xb3a8('0xc')][_0xb3a8('0xd')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1ed9c9,_0x5e550e){return function(){logger['info'](_0xb3a8('0xe'),_0x1ed9c9[_0xb3a8('0xf')]);var _0x2d1ce9=!![];var _0xb6d70e=_0x1ed9c9[_0xb3a8('0x10')][_0xb3a8('0x11')]();var _0x41d973={'account':_0xb6d70e,'message':{'from':util['format'](_0xb3a8('0x12'),_0x1ed9c9[_0xb3a8('0x10')][_0xb3a8('0x13')],_0x1ed9c9[_0xb3a8('0x10')][_0xb3a8('0xf')]||_0x1ed9c9[_0xb3a8('0x10')]['Smtp'][_0xb3a8('0x14')]),'to':_0x1ed9c9[_0xb3a8('0xf')],'cc':_0x1ed9c9['cc'],'bcc':_0x1ed9c9[_0xb3a8('0x15')],'subject':util['format'](_0xb3a8('0x16'),_0x5e550e[_0xb3a8('0x13')],_0x1ed9c9[_0xb3a8('0x17')],_0x1ed9c9[_0xb3a8('0x18')])}};var _0x5e14ca=path[_0xb3a8('0x19')](__dirname,_0xb3a8('0x1a'));var _0x148d6f=_0x5e550e[_0xb3a8('0x1b')];var _0x337447=util[_0xb3a8('0x1c')](_0xb3a8('0x1d'),path[_0xb3a8('0x1e')](_0x5e550e['savename'],path[_0xb3a8('0x1f')](_0x5e550e[_0xb3a8('0x1b')])),_0xb3a8('0x20'));var _0x11b27e=path[_0xb3a8('0x19')](_0x5e14ca,_0x148d6f);var _0x2490cb=path[_0xb3a8('0x19')](_0x5e14ca,_0x337447);if(fs[_0xb3a8('0x21')](_0x11b27e)){_0x5e550e[_0xb3a8('0x22')]=_0xb3a8('0x23');_0x41d973[_0xb3a8('0x24')]['attachments']=[{'filename':_0x148d6f,'path':_0x11b27e}];_0x41d973[_0xb3a8('0x24')][_0xb3a8('0x25')]=util[_0xb3a8('0x1c')](_0xb3a8('0x26'),JSON['stringify'](_0x5e550e,null,0x2));}else if(fs[_0xb3a8('0x21')](_0x2490cb)){_0x5e550e['status']='Sent';_0x41d973[_0xb3a8('0x24')][_0xb3a8('0x27')]=[{'filename':_0x337447,'path':_0x2490cb}];}else{_0x41d973[_0xb3a8('0x24')]['text']=_0xb3a8('0x28');if(!_0x1ed9c9[_0xb3a8('0x29')]){_0x2d1ce9=![];logger[_0xb3a8('0x2a')](_0xb3a8('0x2b'));}}if(_0x2d1ce9){return client['request'](_0xb3a8('0x2c'),_0x41d973)[_0xb3a8('0x2d')](function(_0xacfa4d){if(_0xacfa4d[_0xb3a8('0x2e')]){return logger['error'](_0xb3a8('0x2f'),JSON[_0xb3a8('0x30')](_0xacfa4d));}return logger['info'](_0xb3a8('0x31'));})[_0xb3a8('0x32')](function(_0x396333){return logger[_0xb3a8('0x2e')](_0xb3a8('0x2f'),JSON[_0xb3a8('0x30')](_0x396333));});}};}function handleError(){return function(_0x5a2cda){return logger['error'](JSON[_0xb3a8('0x30')](_0x5a2cda));};}function handleResult(_0x5ac400){return function(_0x4f8cce){logger[_0xb3a8('0x2a')](_0xb3a8('0x33'),JSON['stringify'](_0x4f8cce));if(_0x5ac400['MailAccount']&&_0x5ac400[_0xb3a8('0x10')][_0xb3a8('0x34')]&&!_[_0xb3a8('0x35')](_0x5ac400['email'])){setTimeout(handleSendEmail(_0x5ac400,_0x4f8cce),0x3c*0x3e8);}};}function handleJob(_0x6fd8eb){return function(){try{if(_[_0xb3a8('0x35')](_0x6fd8eb[_0xb3a8('0x17')])){return logger[_0xb3a8('0x2a')](_0xb3a8('0x36'));}if(_[_0xb3a8('0x35')](_0x6fd8eb['subtractUnit'])){return logger[_0xb3a8('0x2a')](_0xb3a8('0x37'));}var _0x4240ef={'startDate':moment()['subtract'](_0x6fd8eb[_0xb3a8('0x17')],_0x6fd8eb['subtractUnit'])[_0xb3a8('0x1c')](_0xb3a8('0x38')),'endDate':moment()[_0xb3a8('0x1c')](_0xb3a8('0x38')),'type':'scheduled','output':_0x6fd8eb[_0xb3a8('0x39')],'name':_0x6fd8eb[_0xb3a8('0x13')]};if(!_['isNil'](_0x6fd8eb[_0xb3a8('0x3a')])){logger[_0xb3a8('0x2a')](_0xb3a8('0x3b'),_0x6fd8eb[_0xb3a8('0x3a')]);return analyticDefaultReportController['runReport']({'id':_0x6fd8eb[_0xb3a8('0x3a')]},_0x4240ef)[_0xb3a8('0x2d')](handleResult(_0x6fd8eb))['catch'](handleError());}if(!_[_0xb3a8('0x35')](_0x6fd8eb[_0xb3a8('0x3c')])){logger[_0xb3a8('0x2a')]('exec\x20custom\x20report\x20id:%s',_0x6fd8eb[_0xb3a8('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x6fd8eb[_0xb3a8('0x3c')]},_0x4240ef)[_0xb3a8('0x2d')](handleResult(_0x6fd8eb))['catch'](handleError());}}catch(_0x2877b7){logger[_0xb3a8('0x2e')](JSON[_0xb3a8('0x30')](_0x2877b7));}return logger[_0xb3a8('0x2a')](_0xb3a8('0x3d'));};}function getJobs(_0x287d1e){var _0x463047={};if(_0x287d1e){_0x463047['id']=_0x287d1e;}return db[_0xb3a8('0x3e')][_0xb3a8('0x3f')]({'where':_0x463047,'include':[{'model':db[_0xb3a8('0x10')],'attributes':['id','name',_0xb3a8('0xf')],'include':[{'model':db[_0xb3a8('0x40')],'as':_0xb3a8('0x34'),'include':[{'model':db[_0xb3a8('0x41')],'as':'CloudProvider'}]}]}]})[_0xb3a8('0x2d')](function(_0x1d7057){var _0x54eefa=_['keys'](manager[_0xb3a8('0x42')]);var _0xb62a4b=_[_0xb3a8('0x43')](_0x1d7057,function(_0x3cc657){return _0x3cc657['id'][_0xb3a8('0x44')]();});var _0x4e66a0=_[_0xb3a8('0x45')](_0x1d7057,function(_0x28d205){return _0x28d205['id'][_0xb3a8('0x44')]();});var _0x1ea8ca=_0x287d1e?_0xb62a4b:_[_0xb3a8('0x46')](_0xb62a4b,_0x54eefa);var _0x20aced=_[_0xb3a8('0x47')](_0xb62a4b,_0x54eefa);var _0x4d3f63=_['difference'](_0x54eefa,_0xb62a4b);var _0x25fdda;var _0x2f1408;for(_0x25fdda=0x0;_0x25fdda<_0x4d3f63[_0xb3a8('0x48')]&&!_0x287d1e;_0x25fdda+=0x1){_0x2f1408=_0x4d3f63[_0x25fdda]['toString']();if(manager[_0xb3a8('0x49')](_0x2f1408)){manager['stop'](_0x2f1408);manager[_0xb3a8('0x4a')](_0x2f1408);logger[_0xb3a8('0x2a')]('delete\x20cron',_0x2f1408);}}logger[_0xb3a8('0x2a')](_0xb3a8('0x4b'),JSON[_0xb3a8('0x30')](_0x1ea8ca));for(_0x25fdda=0x0;_0x25fdda<_0x1ea8ca[_0xb3a8('0x48')];_0x25fdda+=0x1){_0x2f1408=_0x1ea8ca[_0x25fdda][_0xb3a8('0x44')]();logger[_0xb3a8('0x2a')](_0xb3a8('0x4c'),_0x2f1408);if(_0x287d1e){logger['info'](_0xb3a8('0x4d'),_0x287d1e);logger[_0xb3a8('0x2a')](JSON[_0xb3a8('0x30')](_0x4e66a0[_0x2f1408]));BPromise['resolve']()[_0xb3a8('0x2d')](handleJob(_0x4e66a0[_0x2f1408]));logger['info'](_0xb3a8('0x4e'),_0x4e66a0[_0x2f1408][_0xb3a8('0x13')],_0x4e66a0[_0x2f1408]['cron']);}else if(_0x4e66a0[_0x2f1408][_0xb3a8('0x4f')]&&_0x4e66a0[_0x2f1408][_0xb3a8('0x50')]&&moment()[_0xb3a8('0x51')](_0x4e66a0[_0x2f1408][_0xb3a8('0x52')],_0x4e66a0[_0x2f1408][_0xb3a8('0x53')])){manager['add'](_0x2f1408,_0x4e66a0[_0x2f1408][_0xb3a8('0x4f')],handleJob(_0x4e66a0[_0x2f1408]));manager[_0xb3a8('0x54')](_0x2f1408);logger[_0xb3a8('0x2a')](_0xb3a8('0x55'),_0x4e66a0[_0x2f1408]['name'],_0x4e66a0[_0x2f1408]['cron']);}else if(manager[_0xb3a8('0x49')](_0x2f1408)){manager['stop'](_0x2f1408);manager[_0xb3a8('0x4a')](_0x2f1408);logger[_0xb3a8('0x2a')](_0xb3a8('0x56'),_0x4e66a0[_0x2f1408][_0xb3a8('0x13')],_0x4e66a0[_0x2f1408][_0xb3a8('0x4f')]);}}for(_0x25fdda=0x0,_0x2f1408;_0x25fdda<_0x20aced[_0xb3a8('0x48')]&&!_0x287d1e;_0x25fdda+=0x1){_0x2f1408=_0x20aced[_0x25fdda][_0xb3a8('0x44')]();if(manager[_0xb3a8('0x49')](_0x2f1408)){if(_0x4e66a0[_0x2f1408][_0xb3a8('0x4f')]&&_0x4e66a0[_0x2f1408][_0xb3a8('0x50')]&&moment()['isBetween'](_0x4e66a0[_0x2f1408][_0xb3a8('0x52')],_0x4e66a0[_0x2f1408][_0xb3a8('0x53')])){manager[_0xb3a8('0x57')](_0x2f1408,_0x4e66a0[_0x2f1408]['cron'],handleJob(_0x4e66a0[_0x2f1408]));logger[_0xb3a8('0x2a')](_0xb3a8('0x58'),_0x4e66a0[_0x2f1408][_0xb3a8('0x13')],_0x4e66a0[_0x2f1408][_0xb3a8('0x4f')]);}else{manager[_0xb3a8('0x59')](_0x2f1408);manager[_0xb3a8('0x4a')](_0x2f1408);logger[_0xb3a8('0x2a')](_0xb3a8('0x56'),_0x4e66a0[_0x2f1408][_0xb3a8('0x13')],_0x4e66a0[_0x2f1408]['cron']);}}}})['catch'](function(_0x36c977){logger[_0xb3a8('0x2e')](JSON[_0xb3a8('0x30')](_0x36c977));});}exports[_0xb3a8('0x5a')]=function(_0x51b573){return getJobs(_0x51b573);};exports[_0xb3a8('0x54')]=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 09235c4..91ca51c 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 _0xbff2=['transcribeName','data1','data2','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','language','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','resolve','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','all','catch','name','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)'];(function(_0x257faf,_0x239f04){var _0xae0712=function(_0x2ec0a6){while(--_0x2ec0a6){_0x257faf['push'](_0x257faf['shift']());}};_0xae0712(++_0x239f04);}(_0xbff2,0x10e));var _0x2bff=function(_0x1d7e03,_0x28ddfc){_0x1d7e03=_0x1d7e03-0x0;var _0x102e30=_0xbff2[_0x1d7e03];return _0x102e30;};var _=require(_0x2bff('0x0'));var AWS=require(_0x2bff('0x1'));var rp=require(_0x2bff('0x2'));var util=require(_0x2bff('0x3'));var BPromise=require(_0x2bff('0x4'));var db=require(_0x2bff('0x5'))['db'];var logger=require(_0x2bff('0x6'))(_0x2bff('0x7'));function getTranscriptionJob(_0x1b4d39,_0x4f2bec,_0x22ae61,_0x14a617){return new Promise(function(_0x4e36a2,_0x5df472){var _0x48838e=new AWS[(_0x2bff('0x8'))]({'accessKeyId':_0x4f2bec,'secretAccessKey':_0x1b4d39,'region':_0x22ae61});_0x48838e[_0x2bff('0x9')]({'TranscriptionJobName':_0x14a617},function(_0x4f5537,_0x1aa341){if(_0x4f5537){return _0x5df472(_0x4f5537);}else{return _0x4e36a2(_0x1aa341);}});});}function sentiment(_0x4f1ba7,_0x530547,_0x172498,_0x5a0865,_0x52563f){return new Promise(function(_0x540c71,_0x19f231){var _0x4d820b=new AWS[(_0x2bff('0xa'))]({'accessKeyId':_0x530547,'secretAccessKey':_0x4f1ba7,'region':_0x172498});_0x4d820b[_0x2bff('0xb')]({'Text':_0x5a0865,'LanguageCode':_0x52563f['substring'](0x0,0x2)},function(_0x9b94f0,_0x306ab4){if(_0x9b94f0){return _0x19f231(_0x9b94f0);}else{return _0x540c71(_0x306ab4);}});});}function checkTranscribeJob(_0x4a53a2,_0x47f83e,_0x1498e0){var _0x2ff7ec;return new BPromise(function(_0x56e0b0,_0x224858){logger[_0x2bff('0xc')](util['format'](_0x2bff('0xd'),_0x4a53a2['id'],_0x4a53a2[_0x2bff('0xe')]));return getTranscriptionJob(_0x1498e0[_0x2bff('0xf')],_0x1498e0[_0x2bff('0x10')],_0x47f83e['transcribeRegion'],_0x4a53a2[_0x2bff('0xe')])[_0x2bff('0x11')](function(_0x25f978){logger[_0x2bff('0xc')](util[_0x2bff('0x12')](_0x2bff('0x13'),_0x4a53a2['id'],_0x4a53a2['transcribeName'],_0x25f978[_0x2bff('0x14')][_0x2bff('0x15')]));if(!_0x4a53a2[_0x2bff('0x16')]){switch(_0x25f978['TranscriptionJob'][_0x2bff('0x15')]){case _0x2bff('0x17'):var _0x5bacd1={'transcribeStatus':_0x25f978[_0x2bff('0x14')][_0x2bff('0x15')],'fileUri':_0x25f978[_0x2bff('0x14')]['Transcript']['TranscriptFileUri']};logger[_0x2bff('0xc')](util[_0x2bff('0x12')]('[RECORDING:%d]\x20Get\x20transcript',_0x4a53a2['id']));return rp({'uri':_0x25f978[_0x2bff('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0x2bff('0x11')](function(_0x26c836){logger[_0x2bff('0xc')](util[_0x2bff('0x12')](_0x2bff('0x18'),_0x4a53a2['id']));if(_0x26c836&&_0x26c836[_0x2bff('0x19')]&&_0x26c836[_0x2bff('0x19')][_0x2bff('0x1a')]&&_0x26c836[_0x2bff('0x19')][_0x2bff('0x1a')][_0x2bff('0x1b')]){_0x5bacd1[_0x2bff('0x16')]='';for(var _0x567c09=0x0;_0x567c09<_0x26c836['results'][_0x2bff('0x1a')][_0x2bff('0x1b')];_0x567c09++){_0x5bacd1[_0x2bff('0x16')]+=_0x26c836[_0x2bff('0x19')]['transcripts'][_0x567c09][_0x2bff('0x1c')]+'';}}return _0x4a53a2['update'](_0x5bacd1);})[_0x2bff('0x11')](function(){logger[_0x2bff('0xc')](util['format'](_0x2bff('0x1d'),_0x4a53a2['id']));if(!_0x4a53a2[_0x2bff('0x1e')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x21'));}if(!_0x47f83e[_0x2bff('0x22')]||!_0x47f83e['sentimentAccountId']||!_0x47f83e['sentimentRegion']||!_0x47f83e['language']||!_0x47f83e[_0x2bff('0x23')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x24'));}if(!_0x5bacd1[_0x2bff('0x16')]){throw new Error('Transcript\x20not\x20available');}if(_0x47f83e['sentimentAccountId']===_0x1498e0['id']){return _0x1498e0;}else{return db['CloudProvider'][_0x2bff('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4e51c6){if(!_0x4e51c6){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x26'));}if(!_0x4e51c6[_0x2bff('0xf')]||!_0x4e51c6[_0x2bff('0x10')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x27'));}_0x2ff7ec=_0x4e51c6;logger[_0x2bff('0xc')](util[_0x2bff('0x12')](_0x2bff('0x28'),_0x4a53a2['id']));return sentiment(_0x2ff7ec[_0x2bff('0xf')],_0x2ff7ec[_0x2bff('0x10')],_0x47f83e[_0x2bff('0x29')],_0x5bacd1['fileText'],_0x47f83e[_0x2bff('0x2a')]);})[_0x2bff('0x11')](function(_0x423e40){logger['info'](util[_0x2bff('0x12')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4a53a2['id']));return _0x4a53a2[_0x2bff('0x2b')]({'sentiment':_0x423e40[_0x2bff('0x2c')],'sPositive':_0x423e40[_0x2bff('0x2d')][_0x2bff('0x2e')],'sNegative':_0x423e40[_0x2bff('0x2d')]['Negative'],'sMixed':_0x423e40[_0x2bff('0x2d')][_0x2bff('0x2f')],'sNeutral':_0x423e40[_0x2bff('0x2d')][_0x2bff('0x30')]});})['then'](function(){logger[_0x2bff('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4a53a2['id']));_0x56e0b0();});case _0x2bff('0x31'):return _0x4a53a2['update']({'transcribeStatus':'FAILED','failureReason':_0x25f978[_0x2bff('0x14')][_0x2bff('0x32')]})[_0x2bff('0x11')](function(){logger[_0x2bff('0xc')](util['format'](_0x2bff('0x1d'),_0x4a53a2['id']));_0x56e0b0();});default:logger[_0x2bff('0xc')](util[_0x2bff('0x12')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4a53a2['id']));break;}}else{return BPromise[_0x2bff('0x33')]()[_0x2bff('0x11')](function(){if(!_0x4a53a2[_0x2bff('0x1e')]){throw new db[(_0x2bff('0x1f'))]['ValidationError'](_0x2bff('0x21'));}if(!_0x47f83e[_0x2bff('0x22')]||!_0x47f83e['sentimentAccountId']||!_0x47f83e[_0x2bff('0x29')]||!_0x47f83e[_0x2bff('0x2a')]||!_0x47f83e[_0x2bff('0x23')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x24'));}if(!_0x4a53a2[_0x2bff('0x16')]){throw new Error(_0x2bff('0x34'));}if(_0x47f83e[_0x2bff('0x35')]===_0x1498e0['id']){return _0x1498e0;}else{return db[_0x2bff('0x36')][_0x2bff('0x25')]({'where':{'id':_settings[_0x2bff('0x35')]}});}})[_0x2bff('0x11')](function(_0x14939e){if(!_0x14939e){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x26'));}if(!_0x14939e[_0x2bff('0xf')]||!_0x14939e[_0x2bff('0x10')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x2ff7ec=_0x14939e;logger[_0x2bff('0xc')](util[_0x2bff('0x12')](_0x2bff('0x28'),_0x4a53a2['id']));return sentiment(_0x2ff7ec[_0x2bff('0xf')],_0x2ff7ec[_0x2bff('0x10')],_0x47f83e[_0x2bff('0x29')],_0x4a53a2[_0x2bff('0x16')],_0x47f83e[_0x2bff('0x2a')]);})[_0x2bff('0x11')](function(_0x5eabcf){logger['info'](util[_0x2bff('0x12')](_0x2bff('0x37'),_0x4a53a2['id']));return _0x4a53a2[_0x2bff('0x2b')]({'sentiment':_0x5eabcf[_0x2bff('0x2c')],'sPositive':_0x5eabcf['SentimentScore'][_0x2bff('0x2e')],'sNegative':_0x5eabcf[_0x2bff('0x2d')][_0x2bff('0x38')],'sMixed':_0x5eabcf[_0x2bff('0x2d')][_0x2bff('0x2f')],'sNeutral':_0x5eabcf['SentimentScore'][_0x2bff('0x30')],'transcribeStatus':'COMPLETED'});})[_0x2bff('0x11')](function(){logger[_0x2bff('0xc')](util[_0x2bff('0x12')](_0x2bff('0x1d'),_0x4a53a2['id']));_0x56e0b0();});}})['catch'](function(_0x585297){if(_0x585297){if(!_0x585297['name']||_0x585297['name']!==_0x2bff('0x39')){logger[_0x2bff('0x3a')](util[_0x2bff('0x12')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x4a53a2['id']),util[_0x2bff('0x3b')](_0x585297,{'showHidden':![],'depth':null}));}}_0x56e0b0();});});}function checkTranscribe(){var _0x4390f9;var _0x46fa30;var _0x286beb;return db[_0x2bff('0x3c')][_0x2bff('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x2bff('0x11')](function(_0x1df0b1){if(!_0x1df0b1||!_0x1df0b1[_0x2bff('0x1b')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x3e'));}_0x4390f9=_0x1df0b1;return db[_0x2bff('0x3f')]['findOne']({'where':{'id':0x1}});})[_0x2bff('0x11')](function(_0x5d681b){if(!_0x5d681b){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))](_0x2bff('0x40'));}_0x46fa30=_0x5d681b;if(!_0x46fa30['transcribe']||!_0x46fa30[_0x2bff('0x41')]||!_0x46fa30['transcribeRegion']||!_0x46fa30['language']||!_0x46fa30[_0x2bff('0x23')]){throw new db[(_0x2bff('0x1f'))][(_0x2bff('0x20'))]('Transcribe\x20not\x20configured');}return db[_0x2bff('0x36')]['findOne']({'where':{'id':_0x46fa30[_0x2bff('0x41')]}});})[_0x2bff('0x11')](function(_0x5a8dfa){if(!_0x5a8dfa){throw new db['Sequelize'][(_0x2bff('0x20'))](_0x2bff('0x26'));}if(!_0x5a8dfa[_0x2bff('0xf')]||!_0x5a8dfa[_0x2bff('0x10')]){throw new db[(_0x2bff('0x1f'))]['ValidationError'](_0x2bff('0x27'));}_0x286beb=_0x5a8dfa;var _0x4012ef=[];_0x4390f9[_0x2bff('0x42')](function(_0x2c6c1e){_0x4012ef['push'](checkTranscribeJob(_0x2c6c1e,_0x46fa30,_0x286beb));});return BPromise[_0x2bff('0x43')](_0x4012ef);})[_0x2bff('0x44')](function(_0x450278){if(_0x450278){if(!_0x450278['name']||_0x450278[_0x2bff('0x45')]!==_0x2bff('0x39')){logger['error'](util[_0x2bff('0x3b')](_0x450278,{'showHidden':![],'depth':null}));}}});}exports[_0x2bff('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0102=['CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','sentimentRegion','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','catch','start','aws-sdk','request-promise','util','bluebird','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Transcript\x20not\x20available'];(function(_0x1cb74c,_0x248486){var _0x511253=function(_0x5bc85c){while(--_0x5bc85c){_0x1cb74c['push'](_0x1cb74c['shift']());}};_0x511253(++_0x248486);}(_0x0102,0x186));var _0x2010=function(_0x1319ca,_0x1f8fac){_0x1319ca=_0x1319ca-0x0;var _0x6e1672=_0x0102[_0x1319ca];return _0x6e1672;};var _=require('lodash');var AWS=require(_0x2010('0x0'));var rp=require(_0x2010('0x1'));var util=require(_0x2010('0x2'));var BPromise=require(_0x2010('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4e30b3,_0x59082d,_0x22e49f,_0x3e25fb){return new Promise(function(_0x130725,_0x304264){var _0x4eeb67=new AWS[(_0x2010('0x4'))]({'accessKeyId':_0x59082d,'secretAccessKey':_0x4e30b3,'region':_0x22e49f});_0x4eeb67['getTranscriptionJob']({'TranscriptionJobName':_0x3e25fb},function(_0x4728c0,_0x160e41){if(_0x4728c0){return _0x304264(_0x4728c0);}else{return _0x130725(_0x160e41);}});});}function sentiment(_0x48dd91,_0x1f94ca,_0x3c2d98,_0x3d34d4,_0x3acdbb){return new Promise(function(_0x1aedbb,_0x2a27b0){var _0x289ad4=new AWS[(_0x2010('0x5'))]({'accessKeyId':_0x1f94ca,'secretAccessKey':_0x48dd91,'region':_0x3c2d98});_0x289ad4[_0x2010('0x6')]({'Text':_0x3d34d4,'LanguageCode':_0x3acdbb[_0x2010('0x7')](0x0,0x2)},function(_0x1d3b39,_0x32fe2e){if(_0x1d3b39){return _0x2a27b0(_0x1d3b39);}else{return _0x1aedbb(_0x32fe2e);}});});}function checkTranscribeJob(_0x2d09c5,_0x3f307c,_0x3e8624){var _0x388991;return new BPromise(function(_0x528a38,_0x579340){logger[_0x2010('0x8')](util[_0x2010('0x9')](_0x2010('0xa'),_0x2d09c5['id'],_0x2d09c5[_0x2010('0xb')]));return getTranscriptionJob(_0x3e8624[_0x2010('0xc')],_0x3e8624[_0x2010('0xd')],_0x3f307c['transcribeRegion'],_0x2d09c5[_0x2010('0xb')])[_0x2010('0xe')](function(_0x5ad412){logger[_0x2010('0x8')](util[_0x2010('0x9')](_0x2010('0xf'),_0x2d09c5['id'],_0x2d09c5[_0x2010('0xb')],_0x5ad412[_0x2010('0x10')][_0x2010('0x11')]));if(!_0x2d09c5[_0x2010('0x12')]){switch(_0x5ad412[_0x2010('0x10')][_0x2010('0x11')]){case'COMPLETED':var _0x559ed6={'transcribeStatus':_0x5ad412[_0x2010('0x10')][_0x2010('0x11')],'fileUri':_0x5ad412[_0x2010('0x10')][_0x2010('0x13')]['TranscriptFileUri']};logger['info'](util[_0x2010('0x9')](_0x2010('0x14'),_0x2d09c5['id']));return rp({'uri':_0x5ad412[_0x2010('0x10')][_0x2010('0x13')][_0x2010('0x15')],'json':!![]})[_0x2010('0xe')](function(_0x4f621c){logger[_0x2010('0x8')](util[_0x2010('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2d09c5['id']));if(_0x4f621c&&_0x4f621c['results']&&_0x4f621c['results'][_0x2010('0x16')]&&_0x4f621c['results'][_0x2010('0x16')]['length']){_0x559ed6['fileText']='';for(var _0xdb57be=0x0;_0xdb57be<_0x4f621c[_0x2010('0x17')]['transcripts'][_0x2010('0x18')];_0xdb57be++){_0x559ed6['fileText']+=_0x4f621c[_0x2010('0x17')][_0x2010('0x16')][_0xdb57be][_0x2010('0x19')]+'';}}return _0x2d09c5[_0x2010('0x1a')](_0x559ed6);})[_0x2010('0xe')](function(){logger[_0x2010('0x8')](util[_0x2010('0x9')](_0x2010('0x1b'),_0x2d09c5['id']));if(!_0x2d09c5[_0x2010('0x1c')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x1f'));}if(!_0x3f307c['sentiment']||!_0x3f307c[_0x2010('0x20')]||!_0x3f307c['sentimentRegion']||!_0x3f307c[_0x2010('0x21')]||!_0x3f307c[_0x2010('0x22')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x559ed6['fileText']){throw new Error(_0x2010('0x23'));}if(_0x3f307c['sentimentAccountId']===_0x3e8624['id']){return _0x3e8624;}else{return db[_0x2010('0x24')][_0x2010('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2010('0xe')](function(_0x14d1dc){if(!_0x14d1dc){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x26'));}if(!_0x14d1dc['data1']||!_0x14d1dc[_0x2010('0xd')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))]('Cloud\x20Provider\x20not\x20configured');}_0x388991=_0x14d1dc;logger['info'](util[_0x2010('0x9')](_0x2010('0x27'),_0x2d09c5['id']));return sentiment(_0x388991[_0x2010('0xc')],_0x388991['data2'],_0x3f307c['sentimentRegion'],_0x559ed6[_0x2010('0x12')],_0x3f307c[_0x2010('0x21')]);})[_0x2010('0xe')](function(_0x339fd2){logger[_0x2010('0x8')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x2d09c5['id']));return _0x2d09c5['update']({'sentiment':_0x339fd2[_0x2010('0x28')],'sPositive':_0x339fd2[_0x2010('0x29')][_0x2010('0x2a')],'sNegative':_0x339fd2['SentimentScore'][_0x2010('0x2b')],'sMixed':_0x339fd2[_0x2010('0x29')][_0x2010('0x2c')],'sNeutral':_0x339fd2[_0x2010('0x29')]['Neutral']});})[_0x2010('0xe')](function(){logger[_0x2010('0x8')](util[_0x2010('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2d09c5['id']));_0x528a38();});case _0x2010('0x2d'):return _0x2d09c5['update']({'transcribeStatus':_0x2010('0x2d'),'failureReason':_0x5ad412[_0x2010('0x10')][_0x2010('0x2e')]})[_0x2010('0xe')](function(){logger[_0x2010('0x8')](util[_0x2010('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2d09c5['id']));_0x528a38();});default:logger[_0x2010('0x8')](util['format'](_0x2010('0x2f'),_0x2d09c5['id']));break;}}else{return BPromise[_0x2010('0x30')]()[_0x2010('0xe')](function(){if(!_0x2d09c5[_0x2010('0x1c')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x1f'));}if(!_0x3f307c[_0x2010('0x31')]||!_0x3f307c[_0x2010('0x20')]||!_0x3f307c[_0x2010('0x32')]||!_0x3f307c[_0x2010('0x21')]||!_0x3f307c[_0x2010('0x22')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x2d09c5['fileText']){throw new Error(_0x2010('0x23'));}if(_0x3f307c[_0x2010('0x20')]===_0x3e8624['id']){return _0x3e8624;}else{return db[_0x2010('0x24')][_0x2010('0x25')]({'where':{'id':_settings[_0x2010('0x20')]}});}})[_0x2010('0xe')](function(_0x2ae88e){if(!_0x2ae88e){throw new db['Sequelize'][(_0x2010('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ae88e[_0x2010('0xc')]||!_0x2ae88e[_0x2010('0xd')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x33'));}_0x388991=_0x2ae88e;logger['info'](util[_0x2010('0x9')](_0x2010('0x27'),_0x2d09c5['id']));return sentiment(_0x388991[_0x2010('0xc')],_0x388991[_0x2010('0xd')],_0x3f307c['sentimentRegion'],_0x2d09c5[_0x2010('0x12')],_0x3f307c['language']);})['then'](function(_0x550222){logger[_0x2010('0x8')](util[_0x2010('0x9')](_0x2010('0x34'),_0x2d09c5['id']));return _0x2d09c5[_0x2010('0x1a')]({'sentiment':_0x550222[_0x2010('0x28')],'sPositive':_0x550222[_0x2010('0x29')]['Positive'],'sNegative':_0x550222[_0x2010('0x29')][_0x2010('0x2b')],'sMixed':_0x550222[_0x2010('0x29')]['Mixed'],'sNeutral':_0x550222['SentimentScore'][_0x2010('0x35')],'transcribeStatus':'COMPLETED'});})[_0x2010('0xe')](function(){logger[_0x2010('0x8')](util[_0x2010('0x9')](_0x2010('0x1b'),_0x2d09c5['id']));_0x528a38();});}})['catch'](function(_0x36acbe){if(_0x36acbe){if(!_0x36acbe[_0x2010('0x36')]||_0x36acbe[_0x2010('0x36')]!==_0x2010('0x37')){logger[_0x2010('0x38')](util[_0x2010('0x9')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x2d09c5['id']),util[_0x2010('0x39')](_0x36acbe,{'showHidden':![],'depth':null}));}}_0x528a38();});});}function checkTranscribe(){var _0x6eee92;var _0x3e2fcd;var _0x4dc0cf;return db[_0x2010('0x3a')][_0x2010('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x2010('0xe')](function(_0x3fd468){if(!_0x3fd468||!_0x3fd468[_0x2010('0x18')]){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x3c'));}_0x6eee92=_0x3fd468;return db[_0x2010('0x3d')][_0x2010('0x25')]({'where':{'id':0x1}});})['then'](function(_0x5258b9){if(!_0x5258b9){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))]('Settings\x20not\x20available');}_0x3e2fcd=_0x5258b9;if(!_0x3e2fcd[_0x2010('0x3e')]||!_0x3e2fcd[_0x2010('0x3f')]||!_0x3e2fcd[_0x2010('0x40')]||!_0x3e2fcd[_0x2010('0x21')]||!_0x3e2fcd[_0x2010('0x22')]){throw new db['Sequelize']['ValidationError'](_0x2010('0x41'));}return db[_0x2010('0x24')][_0x2010('0x25')]({'where':{'id':_0x3e2fcd[_0x2010('0x3f')]}});})[_0x2010('0xe')](function(_0x2d8164){if(!_0x2d8164){throw new db[(_0x2010('0x1d'))][(_0x2010('0x1e'))](_0x2010('0x26'));}if(!_0x2d8164[_0x2010('0xc')]||!_0x2d8164[_0x2010('0xd')]){throw new db['Sequelize'][(_0x2010('0x1e'))](_0x2010('0x33'));}_0x4dc0cf=_0x2d8164;var _0x56555e=[];_0x6eee92[_0x2010('0x42')](function(_0x43d529){_0x56555e[_0x2010('0x43')](checkTranscribeJob(_0x43d529,_0x3e2fcd,_0x4dc0cf));});return BPromise[_0x2010('0x44')](_0x56555e);})[_0x2010('0x45')](function(_0x7263b9){if(_0x7263b9){if(!_0x7263b9[_0x2010('0x36')]||_0x7263b9[_0x2010('0x36')]!==_0x2010('0x37')){logger[_0x2010('0x38')](util[_0x2010('0x39')](_0x7263b9,{'showHidden':![],'depth':null}));}}});}exports[_0x2010('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ef46b78..495c025 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 _0x7771=['update','timeout','format','emit','catch','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','redis','defaults','localhost','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7771,0x1b0));var _0x1777=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x7771[_0x35a779];return _0xca723b;};'use strict';var _=require(_0x1777('0x0'));var moment=require(_0x1777('0x1'));var Redis=require(_0x1777('0x2'));var util=require('util');var config=require(_0x1777('0x3'));var db=require(_0x1777('0x4'))['db'];var logger=require('../logger')('schedule');config[_0x1777('0x5')]=_[_0x1777('0x6')](config[_0x1777('0x5')],{'host':_0x1777('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1777('0x5')]));function closeInteractions(){var _0x9cdf75=[];return db['WhatsappInteraction'][_0x1777('0x8')]({'raw':!![],'attributes':['id',_0x1777('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x1777('0xa'))}}})[_0x1777('0xb')](function(_0x59d4da){if(_0x59d4da&&_0x59d4da[_0x1777('0xc')]){_0x9cdf75=_[_0x1777('0xd')](_0x59d4da||[],'id');logger[_0x1777('0xe')](_0x1777('0xf'),_0x9cdf75[_0x1777('0x10')]());return db[_0x1777('0x11')][_0x1777('0x12')]({'closeReason':'system','disposition':_0x1777('0x13'),'closed':!![],'closedAt':moment()[_0x1777('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x9cdf75}});}})['then'](function(){if(_0x9cdf75&&_0x9cdf75['length']){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x9cdf75[_0x1777('0x10')]());for(var _0x3f3dda=0x0;_0x3f3dda<_0x9cdf75['length'];_0x3f3dda++){io[_0x1777('0x15')]('whatsappInteraction:update',{'id':_0x9cdf75[_0x3f3dda],'closed':!![]});}}})[_0x1777('0x16')](function(_0x4cfc20){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4cfc20?util[_0x1777('0x17')](_0x4cfc20,{'showHidden':![],'depth':null}):'');});}exports[_0x1777('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x559f=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','timeout','format','join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter','findAll','subtract','hours','then'];(function(_0x56e063,_0x453233){var _0x766fcf=function(_0x59415a){while(--_0x59415a){_0x56e063['push'](_0x56e063['shift']());}};_0x766fcf(++_0x453233);}(_0x559f,0x102));var _0xf559=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x559f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf559('0x0'));var moment=require('moment');var Redis=require(_0xf559('0x1'));var util=require('util');var config=require(_0xf559('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xf559('0x3'))(_0xf559('0x4'));config[_0xf559('0x5')]=_[_0xf559('0x6')](config[_0xf559('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf559('0x7'))(new Redis(config[_0xf559('0x5')]));function closeInteractions(){var _0x532520=[];return db['WhatsappInteraction'][_0xf559('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf559('0x9')](0x18,_0xf559('0xa'))}}})[_0xf559('0xb')](function(_0x39cd3c){if(_0x39cd3c&&_0x39cd3c[_0xf559('0xc')]){_0x532520=_[_0xf559('0xd')](_0x39cd3c||[],'id');logger[_0xf559('0xe')](_0xf559('0xf'),_0x532520['join']());return db[_0xf559('0x10')][_0xf559('0x11')]({'closeReason':'system','disposition':_0xf559('0x12'),'closed':!![],'closedAt':moment()[_0xf559('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x532520}});}})[_0xf559('0xb')](function(){if(_0x532520&&_0x532520[_0xf559('0xc')]){logger[_0xf559('0xe')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x532520[_0xf559('0x14')]());for(var _0x2ed91b=0x0;_0x2ed91b<_0x532520[_0xf559('0xc')];_0x2ed91b++){io[_0xf559('0x15')](_0xf559('0x16'),{'id':_0x532520[_0x2ed91b],'closed':!![]});}}})[_0xf559('0x17')](function(_0x56efed){logger[_0xf559('0x18')](_0xf559('0x19'),_0x56efed?util[_0xf559('0x1a')](_0x56efed,{'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 5d44299..6af37b3 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefaf=['catch','util','../mysqldb','Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','CmHopper','bulkCreate','hopper1','hopper2'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xefaf,0x1d5));var _0xfefa=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xefaf[_0x23b655];return _0x364b32;};'use strict';var util=require(_0xfefa('0x0'));var db=require(_0xfefa('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xfefa('0x2')+i,'lastName':_0xfefa('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xfefa('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xfefa('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xfefa('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xfefa('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xfefa('0x2')+i,'lastName':_0xfefa('0x3')+i,'phone':0xf879fb460+i,'email':_0xfefa('0x7')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xfefa('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xfefa('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xfefa('0x6')]()});}db[_0xfefa('0x8')][_0xfefa('0x9')]({'where':{}})[_0xfefa('0xa')](function(){return db[_0xfefa('0x8')]['bulkCreate'](contacts);})[_0xfefa('0xa')](function(){console[_0xfefa('0xb')](_0xfefa('0xc'),'contacts1');return db['CmHopper'][_0xfefa('0x9')]({'where':{}});})['then'](function(){return db[_0xfefa('0xd')][_0xfefa('0xe')](hopper);})[_0xfefa('0xa')](function(){console[_0xfefa('0xb')](_0xfefa('0xc'),_0xfefa('0xf'));return db['CmContact']['bulkCreate'](contacts2);})[_0xfefa('0xa')](function(){console['log']('finished\x20populating','contacts2');return db['CmHopper'][_0xfefa('0xe')](hopper2);})['then'](function(){console[_0xfefa('0xb')](_0xfefa('0xc'),_0xfefa('0x10'));})[_0xfefa('0x11')](function(_0x29e471){console['log'](_0x29e471);}); \ No newline at end of file +var _0xf99a=['contacts1','CmHopper','finished\x20populating','hopper1','log','hopper2','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','bulkCreate','then'];(function(_0x271c16,_0x1396f7){var _0x2bdcf5=function(_0x44ddc4){while(--_0x44ddc4){_0x271c16['push'](_0x271c16['shift']());}};_0x2bdcf5(++_0x1396f7);}(_0xf99a,0x166));var _0xaf99=function(_0x1ac515,_0xaa400e){_0x1ac515=_0x1ac515-0x0;var _0x4e8014=_0xf99a[_0x1ac515];return _0x4e8014;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xaf99('0x0')]({'id':i,'firstName':_0xaf99('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaf99('0x2')+i+_0xaf99('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xaf99('0x0')]({'id':i,'active':![],'scheduledat':Date[_0xaf99('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf99('0x4')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaf99('0x0')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xaf99('0x5')+i,'phone':0xf879fb460+i,'email':_0xaf99('0x2')+i+_0xaf99('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xaf99('0x0')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf99('0x4')](),'updatedAt':Date[_0xaf99('0x4')]()});}db[_0xaf99('0x6')][_0xaf99('0x7')]({'where':{}})['then'](function(){return db[_0xaf99('0x6')][_0xaf99('0x8')](contacts);})[_0xaf99('0x9')](function(){console['log']('finished\x20populating',_0xaf99('0xa'));return db[_0xaf99('0xb')][_0xaf99('0x7')]({'where':{}});})['then'](function(){return db[_0xaf99('0xb')][_0xaf99('0x8')](hopper);})[_0xaf99('0x9')](function(){console['log'](_0xaf99('0xc'),_0xaf99('0xd'));return db[_0xaf99('0x6')][_0xaf99('0x8')](contacts2);})[_0xaf99('0x9')](function(){console[_0xaf99('0xe')](_0xaf99('0xc'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0xaf99('0x9')](function(){console[_0xaf99('0xe')](_0xaf99('0xc'),_0xaf99('0xf'));})['catch'](function(_0x210b74){console[_0xaf99('0xe')](_0x210b74);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1bdfc4a..fe35b97 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe69d=['/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util','push','format','%s%s','agent','%s%s@xcally.com','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x35f7d9,_0x502bef){var _0x471196=function(_0x2f2928){while(--_0x2f2928){_0x35f7d9['push'](_0x35f7d9['shift']());}};_0x471196(++_0x502bef);}(_0xe69d,0xff));var _0xde69=function(_0x4f40dc,_0x420953){_0x4f40dc=_0x4f40dc-0x0;var _0x20cb0e=_0xe69d[_0x4f40dc];return _0x20cb0e;};'use strict';var util=require(_0xde69('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xde69('0x1')]({'name':util[_0xde69('0x2')](_0xde69('0x3'),_0xde69('0x4'),i),'fullname':util[_0xde69('0x2')](_0xde69('0x3'),'agent',i),'email':util['format'](_0xde69('0x5'),_0xde69('0x4'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xde69('0x6'),'ws',_0xde69('0x7')],'disallow':[_0xde69('0x8')],'allow':['ulaw'],'defaultuser':util['format'](_0xde69('0x3'),'agent',i),'encryption':_0xde69('0x9'),'avpf':_0xde69('0x9'),'force_avp':_0xde69('0x9'),'icesupport':_0xde69('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xde69('0xa'),'dtlsprivatekey':_0xde69('0xb'),'dtlssetup':_0xde69('0xc'),'callerid':util['format'](_0xde69('0xd'),util[_0xde69('0x2')]('%s%s',_0xde69('0x4'),i),0xfa0+i)});}db[_0xde69('0xe')][_0xde69('0xf')](users)[_0xde69('0x10')](function(){console[_0xde69('0x11')]('add\x20user');})[_0xde69('0x12')](function(_0x1f28fd){console[_0xde69('0x11')](_0x1f28fd);}); \ No newline at end of file +var _0x8915=['agent','format','%s%s@xcally.com','password','friend','wss','ulaw','yes','actpass','bulkCreate','then','catch','log','util','../mysqldb','push','%s%s'];(function(_0x237b6c,_0x43235d){var _0x1f2172=function(_0x44dc74){while(--_0x44dc74){_0x237b6c['push'](_0x237b6c['shift']());}};_0x1f2172(++_0x43235d);}(_0x8915,0x73));var _0x5891=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8915[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x5891('0x0'));var db=require(_0x5891('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5891('0x2')]({'name':util['format'](_0x5891('0x3'),_0x5891('0x4'),i),'fullname':util[_0x5891('0x5')](_0x5891('0x3'),_0x5891('0x4'),i),'email':util[_0x5891('0x5')](_0x5891('0x6'),_0x5891('0x4'),i),'role':_0x5891('0x4'),'password':_0x5891('0x7'),'internal':0xfa0+i,'type':_0x5891('0x8'),'transport':['udp','ws',_0x5891('0x9')],'disallow':['all'],'allow':[_0x5891('0xa')],'defaultuser':util[_0x5891('0x5')](_0x5891('0x3'),_0x5891('0x4'),i),'encryption':_0x5891('0xb'),'avpf':_0x5891('0xb'),'force_avp':_0x5891('0xb'),'icesupport':_0x5891('0xb'),'dtlsenable':_0x5891('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x5891('0xc'),'callerid':util[_0x5891('0x5')]('\x22%s\x22\x20<%s>',util['format'](_0x5891('0x3'),_0x5891('0x4'),i),0xfa0+i)});}db['User'][_0x5891('0xd')](users)[_0x5891('0xe')](function(){console['log']('add\x20user');})[_0x5891('0xf')](function(_0x396479){console[_0x5891('0x10')](_0x396479);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index fd76d21..c5c023e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb422=['openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','../mysqldb','Agents','name','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','UserProfileResource','resourceId','map','User','role','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','SmsQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','fax','mail'];(function(_0x5ecca0,_0x7cf3c){var _0x150a20=function(_0x50e11b){while(--_0x50e11b){_0x5ecca0['push'](_0x5ecca0['shift']());}};_0x150a20(++_0x7cf3c);}(_0xb422,0x85));var _0x2b42=function(_0x21ca2a,_0x469aee){_0x21ca2a=_0x21ca2a-0x0;var _0x1ba7fd=_0xb422[_0x21ca2a];return _0x1ba7fd;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var db=require(_0x2b42('0x0'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x2b42('0x1'),'model':db['User'],'attributes':['id',_0x2b42('0x2'),'role'],'raw':!![],'where':{'role':_0x2b42('0x3')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2b42('0x4')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2b42('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x2b42('0x2')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2b42('0x2'),_0x2b42('0x5')],'where':{'type':_0x2b42('0x6')}};function getAssociatedResources(_0x48d9b5,_0x59448e,_0x4174e8){return db['UserProfileSection'][_0x2b42('0x7')]({'where':{'name':_0x48d9b5,'userProfileId':_0x59448e},'raw':!![]})[_0x2b42('0x8')](function(_0x1dcab0){if(_0x1dcab0){if(_0x1dcab0[_0x2b42('0x9')]){switch(_0x48d9b5){case'VoiceQueues':case _0x2b42('0xa'):case _0x2b42('0xb'):case'SmsQueues':case _0x2b42('0xc'):case _0x2b42('0xd'):case _0x2b42('0xe'):return db[_0x4174e8][_0x2b42('0xf')](queryQueues);case'Telephones':return db[_0x4174e8]['findAll'](queryTelephones);case _0x2b42('0x10'):return db[_0x4174e8][_0x2b42('0xf')](queryTrunks);case'IvrCampaigns':return db[_0x4174e8][_0x2b42('0xf')](queryCampaigns);}}else{return db[_0x2b42('0x11')][_0x2b42('0xf')]({'attributes':[_0x2b42('0x12')],'where':{'sectionId':_0x1dcab0['id']},'raw':!![]})[_0x2b42('0x8')](function(_0xc7e610){if(_0xc7e610){var _0x84b092={'where':{'id':_[_0x2b42('0x13')](_0xc7e610,_0x2b42('0x12'))},'raw':!![]};switch(_0x4174e8){case _0x2b42('0x14'):_0x84b092['where'][_0x2b42('0x15')]=_0x2b42('0x4');break;case _0x2b42('0x16'):_0x84b092[_0x2b42('0x17')][_0x2b42('0x5')]=_0x2b42('0x6');break;}return db[_0x4174e8][_0x2b42('0xf')](_0x84b092);}else{return[];}});}}else{return[];}})[_0x2b42('0x8')](function(_0x490053){return _0x490053;});}function joinOrLeaveQueues(_0x22b8d6,_0x27d80a,_0x4d8f3e,_0x732f9c){_0x22b8d6[_0x27d80a](util['format'](_0x2b42('0x18'),_0x4d8f3e,_0x732f9c[_0x2b42('0x2')]));if(_0x732f9c[_0x2b42('0x1')]){for(var _0x50fd94=0x0;_0x50fd94<_0x732f9c['Agents'][_0x2b42('0x19')];_0x50fd94+=0x1){_0x22b8d6[_0x27d80a](util[_0x2b42('0x1a')](_0x2b42('0x1b'),_0x732f9c[_0x2b42('0x1')][_0x50fd94]['name']));}}}function joinOrLeave(_0x386fc5,_0x355859,_0x5063b6){var _0x2b9531;if(_0x386fc5[_0x2b42('0x1c')][_0x2b42('0x1d')]['id']){db[_0x2b42('0x14')][_0x2b42('0x1e')]({'attributes':['id',_0x2b42('0x2'),'role',_0x2b42('0x1f')],'where':{'id':_0x386fc5[_0x2b42('0x1c')][_0x2b42('0x1d')]['id']},'include':[{'model':db[_0x2b42('0x20')],'as':_0x2b42('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x2b42('0x22')],'as':_0x2b42('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2b42('0x24')],'as':_0x2b42('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2b42('0x26')],'as':_0x2b42('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2b42('0x28')],'as':_0x2b42('0x29'),'attributes':['id'],'raw':!![]}]})[_0x2b42('0x8')](function(_0x352ef7){if(_0x352ef7){_0x2b9531=_0x352ef7;_0x386fc5[_0x355859](util['format'](_0x2b42('0x1b'),_0x352ef7[_0x2b42('0x2')]));var _0x12477c=[];switch(_0x352ef7['role']){case'admin':_0x386fc5[_0x355859](_0x2b42('0x2a'));_0x386fc5[_0x355859](_0x2b42('0x2b'));if(queryQueues[_0x2b42('0x2c')](_0x2b42('0x2d'))){delete queryQueues['include'];}_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x2f')][_0x2b42('0xf')](queryQueues));_0x12477c['push'](db[_0x2b42('0x30')][_0x2b42('0xf')](queryQueues));_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x31')][_0x2b42('0xf')](queryQueues));_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x32')][_0x2b42('0xf')](queryQueues));_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x33')][_0x2b42('0xf')](queryQueues));_0x12477c['push'](db[_0x2b42('0x34')]['findAll'](queryQueues));_0x12477c['push'](db[_0x2b42('0x35')][_0x2b42('0xf')](queryQueues));_0x12477c['push'](db['User']['findAll'](queryTelephones));_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x36')][_0x2b42('0xf')](queryTrunks));_0x12477c['push'](db[_0x2b42('0x16')][_0x2b42('0xf')](queryCampaigns));_0x12477c['push'](db['User'][_0x2b42('0xf')](queryAgents));break;case _0x2b42('0x37'):_0x386fc5[_0x355859](_0x2b42('0x2a'));_0x386fc5[_0x355859]('voice:outbound');_0x12477c[_0x2b42('0x2e')](getAssociatedResources(_0x2b42('0x38'),_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x2f')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources('ChatQueues',_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x30')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources(_0x2b42('0xb'),_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x31')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources(_0x2b42('0x39'),_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x32')));_0x12477c['push'](getAssociatedResources('MailQueues',_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x33')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources(_0x2b42('0xd'),_0x352ef7['userProfileId'],_0x2b42('0x34')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources(_0x2b42('0xe'),_0x352ef7[_0x2b42('0x1f')],_0x2b42('0x35')));_0x12477c['push'](getAssociatedResources(_0x2b42('0x3a'),_0x352ef7['userProfileId'],_0x2b42('0x14')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources('Trunks',_0x352ef7['userProfileId'],_0x2b42('0x36')));_0x12477c[_0x2b42('0x2e')](getAssociatedResources('IvrCampaigns',_0x352ef7['userProfileId'],_0x2b42('0x16')));_0x12477c[_0x2b42('0x2e')](db[_0x2b42('0x14')][_0x2b42('0xf')](queryAgents));break;case _0x2b42('0x3'):_0x386fc5[_0x355859](_0x2b42('0x2a'));_0x386fc5[_0x355859]('voice:outbound');_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x3b')]({'attributes':['id','name']}));_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x3c')]({'attributes':['id',_0x2b42('0x2')]}));_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x3d')]({'attributes':['id',_0x2b42('0x2')]}));_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x3e')]({'attributes':['id',_0x2b42('0x2')]}));_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x3f')]({'attributes':['id',_0x2b42('0x2')]}));_0x12477c[_0x2b42('0x2e')](_0x352ef7[_0x2b42('0x40')]({'attributes':['id',_0x2b42('0x2')]}));_0x12477c['push'](_0x352ef7['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x2b42('0x41')](_0x12477c);}})[_0x2b42('0x8')](function(_0x117bad){if(_0x117bad&&_0x117bad[_0x2b42('0x19')]){for(var _0x328607=0x0;_0x328607<_0x117bad[_0x2b42('0x19')];_0x328607+=0x1){for(var _0x4d9912=0x0;_0x4d9912<_0x117bad[_0x328607][_0x2b42('0x19')];_0x4d9912+=0x1){switch(_0x328607){case 0x0:joinOrLeaveQueues(_0x386fc5,_0x355859,_0x2b42('0x42'),_0x117bad[_0x328607][_0x4d9912]);break;case 0x1:joinOrLeaveQueues(_0x386fc5,_0x355859,'chat',_0x117bad[_0x328607][_0x4d9912]);break;case 0x2:joinOrLeaveQueues(_0x386fc5,_0x355859,_0x2b42('0x43'),_0x117bad[_0x328607][_0x4d9912]);break;case 0x3:joinOrLeaveQueues(_0x386fc5,_0x355859,'sms',_0x117bad[_0x328607][_0x4d9912]);break;case 0x4:joinOrLeaveQueues(_0x386fc5,_0x355859,_0x2b42('0x44'),_0x117bad[_0x328607][_0x4d9912]);break;case 0x5:joinOrLeaveQueues(_0x386fc5,_0x355859,_0x2b42('0x45'),_0x117bad[_0x328607][_0x4d9912]);break;case 0x6:joinOrLeaveQueues(_0x386fc5,_0x355859,_0x2b42('0x46'),_0x117bad[_0x328607][_0x4d9912]);break;case 0x7:if(_0x2b9531[_0x2b42('0x15')]!==_0x2b42('0x3'))_0x386fc5[_0x355859](util[_0x2b42('0x1a')](_0x2b42('0x47'),_0x117bad[_0x328607][_0x4d9912][_0x2b42('0x2')]));break;case 0x8:if(_0x2b9531['role']!==_0x2b42('0x3'))_0x386fc5[_0x355859](util['format'](_0x2b42('0x48'),_0x117bad[_0x328607][_0x4d9912][_0x2b42('0x2')]));break;case 0x9:if(_0x2b9531[_0x2b42('0x15')]!=='agent')_0x386fc5[_0x355859](util[_0x2b42('0x1a')](_0x2b42('0x49'),_0x117bad[_0x328607][_0x4d9912][_0x2b42('0x5')],_0x117bad[_0x328607][_0x4d9912][_0x2b42('0x2')]));break;case 0xa:_0x386fc5[_0x355859](util['format']('user:%s',_0x117bad[_0x328607][_0x4d9912][_0x2b42('0x2')]));break;}}}}})[_0x2b42('0x8')](function(){if(_0x355859===_0x2b42('0x4a')){var _0x147d4a=_['map'](_0x2b9531[_0x2b42('0x21')],'id');return _0x2b9531[_0x2b42('0x4b')](_0x147d4a)[_0x2b42('0x8')](function(){for(var _0xe2abc=0x0;_0xe2abc<_0x147d4a[_0x2b42('0x19')];_0xe2abc+=0x1){_0x5063b6['emit'](_0x2b42('0x4c'),{'ChatInteractionId':Number(_0x147d4a[_0xe2abc]),'UserId':Number(_0x2b9531['id'])});}});}})[_0x2b42('0x8')](function(){if(_0x355859===_0x2b42('0x4a')){var _0x7e2575=_[_0x2b42('0x13')](_0x2b9531[_0x2b42('0x23')],'id');return _0x2b9531[_0x2b42('0x4d')](_0x7e2575)[_0x2b42('0x8')](function(){for(var _0x2741c9=0x0;_0x2741c9<_0x7e2575['length'];_0x2741c9+=0x1){_0x5063b6[_0x2b42('0x4e')](_0x2b42('0x4f'),{'MailInteractionId':Number(_0x7e2575[_0x2741c9]),'UserId':Number(_0x2b9531['id'])});}});}})[_0x2b42('0x8')](function(){if(_0x355859===_0x2b42('0x4a')){var _0x595d91=_['map'](_0x2b9531[_0x2b42('0x25')],'id');return _0x2b9531[_0x2b42('0x50')](_0x595d91)[_0x2b42('0x8')](function(){for(var _0x2f3416=0x0;_0x2f3416<_0x595d91[_0x2b42('0x19')];_0x2f3416+=0x1){_0x5063b6[_0x2b42('0x4e')](_0x2b42('0x51'),{'FaxInteractionId':Number(_0x595d91[_0x2f3416]),'UserId':Number(_0x2b9531['id'])});}});}})[_0x2b42('0x8')](function(){if(_0x355859===_0x2b42('0x4a')){var _0x546bf4=_[_0x2b42('0x13')](_0x2b9531['SmsInteractions'],'id');return _0x2b9531[_0x2b42('0x52')](_0x546bf4)[_0x2b42('0x8')](function(){for(var _0x325312=0x0;_0x325312<_0x546bf4['length'];_0x325312+=0x1){_0x5063b6['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x546bf4[_0x325312]),'UserId':Number(_0x2b9531['id'])});}});}})[_0x2b42('0x8')](function(){if(_0x355859===_0x2b42('0x4a')){var _0x4e7413=_[_0x2b42('0x13')](_0x2b9531[_0x2b42('0x53')],'id');return _0x2b9531[_0x2b42('0x54')](_0x4e7413)[_0x2b42('0x8')](function(){for(var _0x5f2f6f=0x0;_0x5f2f6f<_0x4e7413[_0x2b42('0x19')];_0x5f2f6f+=0x1){_0x5063b6['emit'](_0x2b42('0x55'),{'OpenchannelInteractionId':Number(_0x4e7413[_0x5f2f6f]),'UserId':Number(_0x2b9531['id'])});}});}})['then'](function(){if(_0x355859===_0x2b42('0x4a')){var _0x69131f=_['map'](_0x2b9531[_0x2b42('0x29')],'id');return _0x2b9531[_0x2b42('0x56')](_0x69131f)[_0x2b42('0x8')](function(){for(var _0x280ca7=0x0;_0x280ca7<_0x69131f['length'];_0x280ca7+=0x1){_0x5063b6[_0x2b42('0x4e')](_0x2b42('0x57'),{'WhatsappInteractionId':Number(_0x69131f[_0x280ca7]),'UserId':Number(_0x2b9531['id'])});}});}})[_0x2b42('0x58')](function(_0x3ad603){_0x386fc5['log'](_0x3ad603);});}}function onDisconnect(_0x6cefc0,_0x42c664){joinOrLeave(_0x6cefc0,_0x2b42('0x4a'),_0x42c664);}function onConnect(_0x23cf83){joinOrLeave(_0x23cf83,'join');}exports[_0x2b42('0x59')]=function(_0xff9fa0){_0xff9fa0['on']('connection',function(_0x1faf30){_0x1faf30[_0x2b42('0x5a')](0x0);_0x1faf30[_0x2b42('0x5b')]=_0x1faf30[_0x2b42('0x5c')][_0x2b42('0x5d')][_0x2b42('0x5e')]+':'+_0x1faf30[_0x2b42('0x5c')]['connection'][_0x2b42('0x5f')];_0x1faf30[_0x2b42('0x60')]=new Date();_0x1faf30[_0x2b42('0x61')]=function(_0x3a1df9){console[_0x2b42('0x61')](_0x2b42('0x62')+_0x1faf30[_0x2b42('0x63')][_0x2b42('0x2')]+'['+_0x1faf30[_0x2b42('0x5b')]+']',_0x3a1df9);};_0x1faf30['on']('disconnect',function(){onDisconnect(_0x1faf30,_0xff9fa0);_0x1faf30[_0x2b42('0x61')](_0x2b42('0x64'));});onConnect(_0x1faf30);_0x1faf30['log']('CONNECTED');});}; \ No newline at end of file +var _0xb36b=['map','User','where','Campaign','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','type','findOne','then','autoAssociation','VoiceQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId'];(function(_0x2eb687,_0x2c12eb){var _0x1df91b=function(_0x32807b){while(--_0x32807b){_0x2eb687['push'](_0x2eb687['shift']());}};_0x1df91b(++_0x2c12eb);}(_0xb36b,0xac));var _0xbb36=function(_0x127d0d,_0x455fa0){_0x127d0d=_0x127d0d-0x0;var _0x582a9e=_0xb36b[_0x127d0d];return _0x582a9e;};'use strict';var _=require(_0xbb36('0x0'));var util=require('util');var BPromise=require(_0xbb36('0x1'));var db=require(_0xbb36('0x2'))['db'];var config=require(_0xbb36('0x3'));var queryQueues={'attributes':['id',_0xbb36('0x4')],'include':[{'as':_0xbb36('0x5'),'model':db['User'],'attributes':['id',_0xbb36('0x4'),_0xbb36('0x6')],'raw':!![],'where':{'role':_0xbb36('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbb36('0x4')],'where':{'role':_0xbb36('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbb36('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xbb36('0x4')],'where':{'role':_0xbb36('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xbb36('0x4'),_0xbb36('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x54d526,_0x4218d3,_0x4cc282){return db['UserProfileSection'][_0xbb36('0xa')]({'where':{'name':_0x54d526,'userProfileId':_0x4218d3},'raw':!![]})[_0xbb36('0xb')](function(_0x3ca4b2){if(_0x3ca4b2){if(_0x3ca4b2[_0xbb36('0xc')]){switch(_0x54d526){case _0xbb36('0xd'):case'ChatQueues':case _0xbb36('0xe'):case _0xbb36('0xf'):case _0xbb36('0x10'):case _0xbb36('0x11'):case'WhatsappQueues':return db[_0x4cc282][_0xbb36('0x12')](queryQueues);case _0xbb36('0x13'):return db[_0x4cc282][_0xbb36('0x12')](queryTelephones);case _0xbb36('0x14'):return db[_0x4cc282][_0xbb36('0x12')](queryTrunks);case _0xbb36('0x15'):return db[_0x4cc282][_0xbb36('0x12')](queryCampaigns);}}else{return db[_0xbb36('0x16')][_0xbb36('0x12')]({'attributes':[_0xbb36('0x17')],'where':{'sectionId':_0x3ca4b2['id']},'raw':!![]})[_0xbb36('0xb')](function(_0x4d022e){if(_0x4d022e){var _0x595c49={'where':{'id':_[_0xbb36('0x18')](_0x4d022e,_0xbb36('0x17'))},'raw':!![]};switch(_0x4cc282){case _0xbb36('0x19'):_0x595c49[_0xbb36('0x1a')][_0xbb36('0x6')]=_0xbb36('0x8');break;case _0xbb36('0x1b'):_0x595c49[_0xbb36('0x1a')][_0xbb36('0x9')]='ivr';break;}return db[_0x4cc282]['findAll'](_0x595c49);}else{return[];}});}}else{return[];}})[_0xbb36('0xb')](function(_0x1acaca){return _0x1acaca;});}function joinOrLeaveQueues(_0x156918,_0x35f390,_0x3bc201,_0x17a97b){_0x156918[_0x35f390](util[_0xbb36('0x1c')](_0xbb36('0x1d'),_0x3bc201,_0x17a97b[_0xbb36('0x4')]));if(_0x17a97b['Agents']){for(var _0x617822=0x0;_0x617822<_0x17a97b[_0xbb36('0x5')]['length'];_0x617822+=0x1){_0x156918[_0x35f390](util[_0xbb36('0x1c')](_0xbb36('0x1e'),_0x17a97b[_0xbb36('0x5')][_0x617822][_0xbb36('0x4')]));}}}function joinOrLeave(_0x39cd69,_0x1e688b,_0x5033e5){var _0x523db7;if(_0x39cd69[_0xbb36('0x1f')]['query']['id']){db[_0xbb36('0x19')][_0xbb36('0x20')]({'attributes':['id',_0xbb36('0x4'),_0xbb36('0x6'),_0xbb36('0x21')],'where':{'id':_0x39cd69['handshake'][_0xbb36('0x22')]['id']},'include':[{'model':db[_0xbb36('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbb36('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbb36('0x25')],'as':_0xbb36('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xbb36('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xbb36('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xbb36('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x1f6059){if(_0x1f6059){_0x523db7=_0x1f6059;_0x39cd69[_0x1e688b](util['format'](_0xbb36('0x1e'),_0x1f6059['name']));var _0x516bd7=[];switch(_0x1f6059[_0xbb36('0x6')]){case _0xbb36('0x2a'):_0x39cd69[_0x1e688b](_0xbb36('0x2b'));_0x39cd69[_0x1e688b](_0xbb36('0x2c'));if(queryQueues[_0xbb36('0x2d')]('include')){delete queryQueues[_0xbb36('0x2e')];}_0x516bd7['push'](db[_0xbb36('0x2f')]['findAll'](queryQueues));_0x516bd7[_0xbb36('0x30')](db['ChatQueue'][_0xbb36('0x12')](queryQueues));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x31')][_0xbb36('0x12')](queryQueues));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x32')][_0xbb36('0x12')](queryQueues));_0x516bd7['push'](db[_0xbb36('0x33')]['findAll'](queryQueues));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x34')]['findAll'](queryQueues));_0x516bd7['push'](db[_0xbb36('0x35')][_0xbb36('0x12')](queryQueues));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x19')][_0xbb36('0x12')](queryTelephones));_0x516bd7['push'](db[_0xbb36('0x36')][_0xbb36('0x12')](queryTrunks));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x1b')]['findAll'](queryCampaigns));_0x516bd7[_0xbb36('0x30')](db[_0xbb36('0x19')][_0xbb36('0x12')](queryAgents));break;case'user':_0x39cd69[_0x1e688b](_0xbb36('0x2b'));_0x39cd69[_0x1e688b](_0xbb36('0x2c'));_0x516bd7['push'](getAssociatedResources('VoiceQueues',_0x1f6059[_0xbb36('0x21')],_0xbb36('0x2f')));_0x516bd7['push'](getAssociatedResources('ChatQueues',_0x1f6059['userProfileId'],'ChatQueue'));_0x516bd7[_0xbb36('0x30')](getAssociatedResources(_0xbb36('0xe'),_0x1f6059['userProfileId'],'FaxQueue'));_0x516bd7[_0xbb36('0x30')](getAssociatedResources('SmsQueues',_0x1f6059[_0xbb36('0x21')],'SmsQueue'));_0x516bd7[_0xbb36('0x30')](getAssociatedResources(_0xbb36('0x10'),_0x1f6059['userProfileId'],_0xbb36('0x33')));_0x516bd7[_0xbb36('0x30')](getAssociatedResources('OpenchannelQueues',_0x1f6059[_0xbb36('0x21')],_0xbb36('0x34')));_0x516bd7[_0xbb36('0x30')](getAssociatedResources('WhatsappQueues',_0x1f6059[_0xbb36('0x21')],'WhatsappQueue'));_0x516bd7[_0xbb36('0x30')](getAssociatedResources(_0xbb36('0x13'),_0x1f6059[_0xbb36('0x21')],'User'));_0x516bd7[_0xbb36('0x30')](getAssociatedResources('Trunks',_0x1f6059['userProfileId'],_0xbb36('0x36')));_0x516bd7['push'](getAssociatedResources(_0xbb36('0x15'),_0x1f6059[_0xbb36('0x21')],_0xbb36('0x1b')));_0x516bd7[_0xbb36('0x30')](db['User'][_0xbb36('0x12')](queryAgents));break;case _0xbb36('0x7'):_0x39cd69[_0x1e688b]('voice:inbound');_0x39cd69[_0x1e688b](_0xbb36('0x2c'));_0x516bd7['push'](_0x1f6059[_0xbb36('0x37')]({'attributes':['id',_0xbb36('0x4')]}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x38')]({'attributes':['id',_0xbb36('0x4')]}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x39')]({'attributes':['id','name']}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x3a')]({'attributes':['id','name']}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x3b')]({'attributes':['id',_0xbb36('0x4')]}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x3c')]({'attributes':['id',_0xbb36('0x4')]}));_0x516bd7[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x3d')]({'attributes':['id','name']}));break;}return BPromise[_0xbb36('0x3e')](_0x516bd7);}})[_0xbb36('0xb')](function(_0x384395){if(_0x384395&&_0x384395[_0xbb36('0x3f')]){for(var _0x112556=0x0;_0x112556<_0x384395[_0xbb36('0x3f')];_0x112556+=0x1){for(var _0x48c989=0x0;_0x48c989<_0x384395[_0x112556]['length'];_0x48c989+=0x1){switch(_0x112556){case 0x0:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x40'),_0x384395[_0x112556][_0x48c989]);break;case 0x1:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x41'),_0x384395[_0x112556][_0x48c989]);break;case 0x2:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x42'),_0x384395[_0x112556][_0x48c989]);break;case 0x3:joinOrLeaveQueues(_0x39cd69,_0x1e688b,'sms',_0x384395[_0x112556][_0x48c989]);break;case 0x4:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x43'),_0x384395[_0x112556][_0x48c989]);break;case 0x5:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x44'),_0x384395[_0x112556][_0x48c989]);break;case 0x6:joinOrLeaveQueues(_0x39cd69,_0x1e688b,_0xbb36('0x45'),_0x384395[_0x112556][_0x48c989]);break;case 0x7:if(_0x523db7[_0xbb36('0x6')]!==_0xbb36('0x7'))_0x39cd69[_0x1e688b](util['format'](_0xbb36('0x46'),_0x384395[_0x112556][_0x48c989]['name']));break;case 0x8:if(_0x523db7['role']!=='agent')_0x39cd69[_0x1e688b](util[_0xbb36('0x1c')](_0xbb36('0x47'),_0x384395[_0x112556][_0x48c989][_0xbb36('0x4')]));break;case 0x9:if(_0x523db7[_0xbb36('0x6')]!=='agent')_0x39cd69[_0x1e688b](util[_0xbb36('0x1c')]('campaign:%s:%s',_0x384395[_0x112556][_0x48c989]['type'],_0x384395[_0x112556][_0x48c989]['name']));break;case 0xa:_0x39cd69[_0x1e688b](util[_0xbb36('0x1c')](_0xbb36('0x1e'),_0x384395[_0x112556][_0x48c989][_0xbb36('0x4')]));break;}}}}})[_0xbb36('0xb')](function(){if(_0x1e688b===_0xbb36('0x48')){var _0x442da1=_['map'](_0x523db7[_0xbb36('0x49')],'id');return _0x523db7[_0xbb36('0x4a')](_0x442da1)[_0xbb36('0xb')](function(){for(var _0x236c1a=0x0;_0x236c1a<_0x442da1[_0xbb36('0x3f')];_0x236c1a+=0x1){_0x5033e5['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x442da1[_0x236c1a]),'UserId':Number(_0x523db7['id'])});}});}})['then'](function(){if(_0x1e688b===_0xbb36('0x48')){var _0x48737e=_['map'](_0x523db7['MailInteractions'],'id');return _0x523db7['removeMailInteractions'](_0x48737e)[_0xbb36('0xb')](function(){for(var _0x114d13=0x0;_0x114d13<_0x48737e['length'];_0x114d13+=0x1){_0x5033e5[_0xbb36('0x4b')](_0xbb36('0x4c'),{'MailInteractionId':Number(_0x48737e[_0x114d13]),'UserId':Number(_0x523db7['id'])});}});}})[_0xbb36('0xb')](function(){if(_0x1e688b==='leave'){var _0x3c003b=_['map'](_0x523db7[_0xbb36('0x26')],'id');return _0x523db7[_0xbb36('0x4d')](_0x3c003b)[_0xbb36('0xb')](function(){for(var _0xcf045f=0x0;_0xcf045f<_0x3c003b[_0xbb36('0x3f')];_0xcf045f+=0x1){_0x5033e5[_0xbb36('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3c003b[_0xcf045f]),'UserId':Number(_0x523db7['id'])});}});}})['then'](function(){if(_0x1e688b===_0xbb36('0x48')){var _0x2b525d=_['map'](_0x523db7[_0xbb36('0x27')],'id');return _0x523db7[_0xbb36('0x4e')](_0x2b525d)[_0xbb36('0xb')](function(){for(var _0x566138=0x0;_0x566138<_0x2b525d['length'];_0x566138+=0x1){_0x5033e5[_0xbb36('0x4b')](_0xbb36('0x4f'),{'SmsInteractionId':Number(_0x2b525d[_0x566138]),'UserId':Number(_0x523db7['id'])});}});}})[_0xbb36('0xb')](function(){if(_0x1e688b===_0xbb36('0x48')){var _0x6e9a30=_[_0xbb36('0x18')](_0x523db7[_0xbb36('0x28')],'id');return _0x523db7['removeOpenchannelInteractions'](_0x6e9a30)[_0xbb36('0xb')](function(){for(var _0x5a4193=0x0;_0x5a4193<_0x6e9a30['length'];_0x5a4193+=0x1){_0x5033e5['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x6e9a30[_0x5a4193]),'UserId':Number(_0x523db7['id'])});}});}})[_0xbb36('0xb')](function(){if(_0x1e688b===_0xbb36('0x48')){var _0x4d2169=_['map'](_0x523db7[_0xbb36('0x50')],'id');return _0x523db7[_0xbb36('0x51')](_0x4d2169)[_0xbb36('0xb')](function(){for(var _0x5efdb5=0x0;_0x5efdb5<_0x4d2169[_0xbb36('0x3f')];_0x5efdb5+=0x1){_0x5033e5[_0xbb36('0x4b')](_0xbb36('0x52'),{'WhatsappInteractionId':Number(_0x4d2169[_0x5efdb5]),'UserId':Number(_0x523db7['id'])});}});}})[_0xbb36('0x53')](function(_0x59df3c){_0x39cd69[_0xbb36('0x54')](_0x59df3c);});}}function onDisconnect(_0xdff353,_0x57719d){joinOrLeave(_0xdff353,_0xbb36('0x48'),_0x57719d);}function onConnect(_0x4a8eca){joinOrLeave(_0x4a8eca,_0xbb36('0x55'));}exports[_0xbb36('0x56')]=function(_0x11be68){_0x11be68['on']('connection',function(_0x4b427a){_0x4b427a[_0xbb36('0x57')](0x0);_0x4b427a[_0xbb36('0x58')]=_0x4b427a[_0xbb36('0x59')][_0xbb36('0x5a')][_0xbb36('0x5b')]+':'+_0x4b427a[_0xbb36('0x59')][_0xbb36('0x5a')][_0xbb36('0x5c')];_0x4b427a['connectedAt']=new Date();_0x4b427a['log']=function(_0x3ea141){console[_0xbb36('0x54')](_0xbb36('0x5d')+_0x4b427a[_0xbb36('0x5e')][_0xbb36('0x4')]+'['+_0x4b427a[_0xbb36('0x58')]+']',_0x3ea141);};_0x4b427a['on'](_0xbb36('0x5f'),function(){onDisconnect(_0x4b427a,_0x11be68);_0x4b427a[_0xbb36('0x54')](_0xbb36('0x60'));});onConnect(_0x4b427a);_0x4b427a[_0xbb36('0x54')](_0xbb36('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d1f0131..0cca2f1 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 _0xde9b=['catch','channel','motionChannel','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','AfterCreateMessage','get','event','Sequelize','AfterCreate','closed','changed','substatus','AfterUpdate','User','fullname','default','length','hasOwnProperty','model','callback','toLowerCase','util','../../mysqldb','jayson/promise','triggers','client','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','newinteraction','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','Trigger,\x20%s','error','code','EventManager'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde9b,0x182));var _0xbde9=function(_0x2e3444,_0x29e15c){_0x2e3444=_0x2e3444-0x0;var _0x5e5266=_0xde9b[_0x2e3444];return _0x5e5266;};'use strict';var util=require(_0xbde9('0x0'));var db=require(_0xbde9('0x1'))['db'];var jayson=require(_0xbde9('0x2'));var logger=require('../logger')(_0xbde9('0x3'));var client=jayson[_0xbde9('0x4')][_0xbde9('0x5')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xbde9('0x6'),'event':_0xbde9('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xbde9('0x8'),'model':_0xbde9('0x6'),'event':_0xbde9('0x9'),'condition':_0xbde9('0xa'),'callback':afterUpdate},{'channel':_0xbde9('0x8'),'model':_0xbde9('0xb'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xbde9('0xd'),'event':_0xbde9('0x7'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0xbde9('0x7'),'condition':_0xbde9('0xe'),'callback':afterCreate},{'channel':_0xbde9('0xf'),'model':_0xbde9('0x10'),'event':_0xbde9('0x9'),'condition':_0xbde9('0xa'),'callback':afterUpdate},{'channel':'Sms','model':_0xbde9('0x11'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xc'),'callback':afterCreateMessage},{'channel':_0xbde9('0x12'),'model':_0xbde9('0x13'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xe'),'callback':afterCreate},{'channel':_0xbde9('0x12'),'model':'WhatsappInteraction','event':_0xbde9('0x9'),'condition':_0xbde9('0xa'),'callback':afterUpdate},{'channel':_0xbde9('0x12'),'model':_0xbde9('0x14'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xc'),'callback':afterCreateMessage},{'channel':_0xbde9('0x15'),'model':'FaxInteraction','event':_0xbde9('0x7'),'condition':_0xbde9('0xe'),'callback':afterCreate},{'channel':_0xbde9('0x15'),'model':_0xbde9('0x16'),'event':_0xbde9('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbde9('0x15'),'model':_0xbde9('0x17'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xc'),'callback':afterCreateMessage},{'channel':_0xbde9('0x18'),'model':_0xbde9('0x19'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xe'),'callback':afterCreate},{'channel':_0xbde9('0x18'),'model':_0xbde9('0x19'),'event':_0xbde9('0x9'),'condition':_0xbde9('0xa'),'callback':afterUpdate},{'channel':_0xbde9('0x18'),'model':'MailMessage','event':'afterCreate','condition':_0xbde9('0xc'),'callback':afterCreateMessage},{'channel':_0xbde9('0x1a'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0xbde9('0xe'),'callback':afterCreate},{'channel':_0xbde9('0x1a'),'model':_0xbde9('0x1b'),'event':_0xbde9('0x9'),'condition':_0xbde9('0xa'),'callback':afterUpdate},{'channel':_0xbde9('0x1a'),'model':_0xbde9('0x1c'),'event':_0xbde9('0x7'),'condition':_0xbde9('0xc'),'callback':afterCreateMessage}];function request(_0x18ef58){return client['request']('EventManager',_0x18ef58)[_0xbde9('0x1d')](function(_0x2d4064){logger['info'](_0xbde9('0x1e'),'EventManager',_0x2d4064);if(_0x2d4064[_0xbde9('0x1f')]){if(_0x2d4064['error'][_0xbde9('0x20')]===0x1f4){logger[_0xbde9('0x1f')](_0xbde9('0x1e'),_0xbde9('0x21'),_0x2d4064[_0xbde9('0x1f')]);}}})[_0xbde9('0x22')](function(_0x55f02b){logger[_0xbde9('0x1f')](_0xbde9('0x1e'),_0xbde9('0x21'),_0x55f02b);});}function afterCreateMessage(_0x57dea6){return function(_0x46ac1b){_0x46ac1b=_0x46ac1b['get']({'plain':!![]});_0x46ac1b[_0xbde9('0x23')]=_0x57dea6;_0x46ac1b[_0xbde9('0x24')]=_0x57dea6;_0x46ac1b['event']=_0x46ac1b['direction'];Promise[_0xbde9('0x25')]()['then'](function(){if(typeof _0x46ac1b[_0xbde9('0x26')]===_0xbde9('0x27'))return null;var _0x3f8e51=_0xbde9('0x28')+_0x46ac1b[_0xbde9('0x26')];return db[_0xbde9('0x29')][_0xbde9('0x2a')](_0x3f8e51,{'type':db['Sequelize'][_0xbde9('0x2b')][_0xbde9('0x2c')],'raw':!![]});})[_0xbde9('0x1d')](function(_0x2d1d7f){if(_0x2d1d7f){_0x46ac1b[_0xbde9('0x2d')]=_0x2d1d7f[0x0];}if(typeof _0x46ac1b[_0xbde9('0x2e')]==='undefined')return;return getAgent(_0x46ac1b['UserId']);})[_0xbde9('0x1d')](function(_0x503b01){if(_0x503b01){_0x46ac1b[_0xbde9('0x2f')]=util[_0xbde9('0x30')](_0xbde9('0x31'),_0x503b01[_0xbde9('0x32')]);_0x46ac1b[_0xbde9('0x33')]=_0x503b01;_0x46ac1b[_0xbde9('0x23')]=_0x57dea6;return request({'event':_0xbde9('0x34'),'message':_0x46ac1b});}else{return request({'event':'outgoingmessage','message':_0x46ac1b});}})['catch'](function(_0x5943ac){logger[_0xbde9('0x1f')](_0xbde9('0x1e'),_0xbde9('0x35'),_0x5943ac);});};}function afterCreateOfflineMessage(_0x36bc58){return function(_0x566e17){_0x566e17=_0x566e17[_0xbde9('0x36')]({'plain':!![]});_0x566e17[_0xbde9('0x23')]=_0x36bc58;_0x566e17[_0xbde9('0x24')]=_0x36bc58;_0x566e17[_0xbde9('0x37')]='offlineMessage';return request({'event':_0x566e17['event'],'message':_0x566e17});};}function afterCreate(_0x5c1cfc,_0x72623d){return function(_0x512598){_0x512598=_0x512598[_0xbde9('0x36')]({'plain':!![]});_0x512598[_0xbde9('0x23')]=_0x5c1cfc;_0x512598[_0xbde9('0x24')]=_0x5c1cfc;_0x512598[_0xbde9('0x37')]='opened';Promise[_0xbde9('0x25')]()[_0xbde9('0x1d')](function(){var _0x282f4c=_0xbde9('0x28')+_0x512598['ContactId'];return db[_0xbde9('0x29')][_0xbde9('0x2a')](_0x282f4c,{'type':db[_0xbde9('0x38')][_0xbde9('0x2b')]['SELECT'],'raw':!![]});})[_0xbde9('0x1d')](function(_0x5c44ac){if(_0x5c44ac){_0x512598[_0xbde9('0x2d')]=_0x5c44ac[0x0];}if(typeof _0x512598[_0xbde9('0x2e')]===_0xbde9('0x27'))return;return getAgent(_0x512598['UserId']);})[_0xbde9('0x1d')](function(_0x18a47d){if(_0x18a47d){_0x512598[_0xbde9('0x2f')]=util[_0xbde9('0x30')](_0xbde9('0x31'),_0x18a47d[_0xbde9('0x32')]);_0x512598['agent']=_0x18a47d;}return request({'event':_0x72623d,'message':_0x512598});})[_0xbde9('0x22')](function(_0x3b808f){logger[_0xbde9('0x1f')](_0xbde9('0x1e'),_0xbde9('0x39'),_0x3b808f);});};}function afterUpdate(_0x5372e1){return function(_0x3f343b){var _0x32fed9=_0x3f343b['changed'](_0xbde9('0x3a'))&&_0x3f343b[_0xbde9('0x3a')];var _0x6bc86=_0x3f343b[_0xbde9('0x3b')]('substatus');if(_0x32fed9||_0x6bc86){var _0x505f1e=_0x32fed9?_0xbde9('0xa'):_0xbde9('0x3c');var _0x54df6e=_0x3f343b[_0xbde9('0x36')]({'plain':!![]});_0x54df6e['channel']=_0x5372e1;_0x54df6e[_0xbde9('0x24')]=_0x5372e1;_0x54df6e[_0xbde9('0x37')]=_0x32fed9?_0xbde9('0x3a'):_0xbde9('0x3c');var _0x2757dc=_0xbde9('0x28')+_0x54df6e[_0xbde9('0x26')];return db['sequelize'][_0xbde9('0x2a')](_0x2757dc,{'type':db['Sequelize'][_0xbde9('0x2b')][_0xbde9('0x2c')],'raw':!![]})[_0xbde9('0x1d')](function(_0x2f73ec){if(_0x2f73ec){_0x54df6e[_0xbde9('0x2d')]=_0x2f73ec[0x0];}if(typeof _0x54df6e[_0xbde9('0x2e')]===_0xbde9('0x27'))return;return getAgent(_0x54df6e['UserId']);})[_0xbde9('0x1d')](function(_0x819fc5){if(_0x819fc5){_0x54df6e[_0xbde9('0x2f')]=util[_0xbde9('0x30')](_0xbde9('0x31'),_0x819fc5[_0xbde9('0x32')]);_0x54df6e[_0xbde9('0x33')]=_0x819fc5;}return request({'event':_0x505f1e,'message':_0x54df6e});})[_0xbde9('0x22')](function(_0x13fca4){logger['error'](_0xbde9('0x1e'),_0xbde9('0x3d'),_0x13fca4);});}};}function getAgent(_0x75467){return db[_0xbde9('0x3e')]['find']({'where':{'id':_0x75467},'attributes':['id',_0xbde9('0x32'),_0xbde9('0x3f'),'email','internal'],'raw':!![]})['then'](function(_0xc36d46){return _0xc36d46;});}exports[_0xbde9('0x40')]=function(){for(var _0x40722d=0x0;_0x40722d=_0x6eccc1[_0x8113('0xf')]){throw Error(_0x8113('0x10'));}_0x51ad32(_0x2146ff);})[_0x8113('0x11')](function(_0x5d6fe3){_0x51e3e0(_0x5d6fe3);});});}; \ No newline at end of file +var _0xde16=['updateAttributes','getLicense','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','mail','chat','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt'];(function(_0x3a2d68,_0x4942cb){var _0x3831c6=function(_0x2b8f0e){while(--_0x2b8f0e){_0x3a2d68['push'](_0x3a2d68['shift']());}};_0x3831c6(++_0x4942cb);}(_0xde16,0xc5));var _0x6de1=function(_0x104ad0,_0x5468b4){_0x104ad0=_0x104ad0-0x0;var _0xc0f7c4=_0xde16[_0x104ad0];return _0xc0f7c4;};'use strict';var _=require(_0x6de1('0x0'));var BPromise=require(_0x6de1('0x1'));var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0x6de1('0x2'),_0x6de1('0x3'),'fax','sms',_0x6de1('0x4'),_0x6de1('0x5')];exports[_0x6de1('0x6')]=function(){return channels;};exports[_0x6de1('0x7')]=function(_0x11acba){_0x11acba=_0x11acba[_0x6de1('0x8')]();return _[_0x6de1('0x9')](channels,_0x11acba);};exports[_0x6de1('0xa')]=function(_0x3e18d0,_0x2a6d9b,_0x2ffbec,_0xd10025){var _0x696111={'loginAttempts':_0x2a6d9b,'blocked':_0x2ffbec};if(!_[_0x6de1('0xb')](_0xd10025)){_0x696111[_0x6de1('0xc')]=_0xd10025;}return _0x3e18d0[_0x6de1('0xd')](_0x696111);};exports[_0x6de1('0xe')]=function(_0xe47101){return new BPromise(function(_0x2d89dd,_0x2370d1){var _0x10aaee=0x0;if(_0xe47101['role']!=='agent'){_0x2d89dd(_0xe47101);}db['User'][_0x6de1('0xf')]({'where':{'role':_0x6de1('0x10'),'online':!![],'id':{'$ne':_0xe47101['id']}}})[_0x6de1('0x11')](function(_0x19c3b9){_0x10aaee=_0x19c3b9;return util[_0x6de1('0xe')]();})[_0x6de1('0x11')](function(_0xe1b12a){if(_0xe1b12a&&_0xe1b12a[_0x6de1('0x12')]&&_0x10aaee>=_0xe1b12a[_0x6de1('0x12')]){throw Error(_0x6de1('0x13'));}_0x2d89dd(_0xe47101);})[_0x6de1('0x14')](function(_0x806af8){_0x2370d1(_0x806af8);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 6f9120d..6232648 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['exports','../config/logger','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','OutOfInterval','error','stack','send'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1453b8,_0x398d09){_0x1453b8=_0x1453b8-0x0;var _0x31cd64=_0x9bde[_0x1453b8];return _0x31cd64;};'use strict';var util=require('util');var logger=require(_0xe9bd('0x0'))('api');var APIError=function(_0xc79e0b,_0x4c63ca){this[_0xe9bd('0x1')]=_0xc79e0b||_0xe9bd('0x2');this[_0xe9bd('0x3')]=_0x4c63ca||_0xe9bd('0x4');util[_0xe9bd('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1a4d14){this[_0xe9bd('0x1')]=_0x1a4d14||'Bad\x20Request';this[_0xe9bd('0x3')]=_0xe9bd('0x6');util[_0xe9bd('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xa66ae2){this[_0xe9bd('0x1')]=_0xa66ae2||_0xe9bd('0x7');this[_0xe9bd('0x3')]=_0xe9bd('0x8');util[_0xe9bd('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x45c7ba){switch(_0x45c7ba){case'Bad\x20Request':return 0x190;case'Forbidden',_0xe9bd('0x9'):return 0x193;case _0xe9bd('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0x2601ac){return function(_0x581ab9){logger[_0xe9bd('0xa')](_0x581ab9[_0xe9bd('0xb')]);var _0x3339f9=getStatusCode(_0x581ab9[_0xe9bd('0x3')]);if(_0x581ab9['name'])delete _0x581ab9[_0xe9bd('0x3')];return _0x2601ac['status'](_0x3339f9)[_0xe9bd('0xc')](_0x581ab9);};}module[_0xe9bd('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x8986b9,_0x2b9158){var _0xffe154=function(_0xc2a473){while(--_0xc2a473){_0x8986b9['push'](_0x8986b9['shift']());}};_0xffe154(++_0x2b9158);}(_0x91a7,0xe7));var _0x791a=function(_0x3ac5c0,_0x19b8cf){_0x3ac5c0=_0x3ac5c0-0x0;var _0x4a5ac5=_0x91a7[_0x3ac5c0];return _0x4a5ac5;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index dcab7e7..d01347b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x287b=['exports','404','status','render','json','send'];(function(_0x191575,_0xd910e1){var _0x35650c=function(_0x4022b5){while(--_0x4022b5){_0x191575['push'](_0x191575['shift']());}};_0x35650c(++_0xd910e1);}(_0x287b,0x96));var _0xb287=function(_0x479b99,_0x1e5bec){_0x479b99=_0x479b99-0x0;var _0x1e7eb7=_0x287b[_0x479b99];return _0x1e7eb7;};'use strict';module[_0xb287('0x0')][0x194]=function pageNotFound(_0x5d0c58,_0x46cac7){var _0x259abb=_0xb287('0x1');var _0x5bd0fc=0x194;var _0x485a03={'status':_0x5bd0fc};_0x46cac7[_0xb287('0x2')](_0x485a03['status']);_0x46cac7[_0xb287('0x3')](_0x259abb,{},function(_0x48c25e,_0x450df6){if(_0x48c25e){return _0x46cac7[_0xb287('0x2')](_0x485a03[_0xb287('0x2')])[_0xb287('0x4')](_0x485a03);}_0x46cac7[_0xb287('0x5')](_0x450df6);});}; \ No newline at end of file +var _0x13f7=['exports','status','render','json'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x13f7,0x164));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';module[_0x713f('0x0')][0x194]=function pageNotFound(_0x2b9ad7,_0x25b7b3){var _0x1adbdb='404';var _0x979621=0x194;var _0x485551={'status':_0x979621};_0x25b7b3[_0x713f('0x1')](_0x485551[_0x713f('0x1')]);_0x25b7b3[_0x713f('0x2')](_0x1adbdb,{},function(_0x4e4685,_0x592f0e){if(_0x4e4685){return _0x25b7b3['status'](_0x485551[_0x713f('0x1')])[_0x713f('0x3')](_0x485551);}_0x25b7b3['send'](_0x592f0e);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b27338a..c5d7d2c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a93=['../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPauseId','Agents','Teams','TeamVoiceQueue','BlackLists','Messages','mailboxuser','mailbox','VoiceMailMessage','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','List','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatOfflineMessageId','TagId','MailQueueReport','Dashboard','Items','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','ThroughTags','user_has_fax_interactions','Attachment','team_has_fax_queues','SmsAccountId','ListId','mandatoryDispositionPause','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','user_has_chat_websites','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','JscriptySessionReport','MailInteractions','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Agent','Campaign','OwnerId','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','MailApplications','ChatApplications','SmsApplications','DefaultReportId','Schedule','Mohs','moh_has_sounds','sms_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','CustomReportId','Fields','MetricId','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmConfiguration','Descriptions','DeskConfiguration','Configurations','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','FreshsalesAccount','ChatQueueReport','ToId','SessionId','JscriptyAnswerReport','ProjectId','JscriptyProject','VoiceQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','FromChatWebsiteId','FromUserId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication'];(function(_0x148e39,_0x157a51){var _0x1c20cf=function(_0x297137){while(--_0x297137){_0x148e39['push'](_0x148e39['shift']());}};_0x1c20cf(++_0x157a51);}(_0x9a93,0x1b4));var _0x39a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a93[_0x3dd15e];return _0x231fd0;};'use strict';var config=require('../config/environment');var Sequelize=require(_0x39a9('0x0'));var _=require(_0x39a9('0x1'));var jstz=require(_0x39a9('0x2'));var timezone=jstz[_0x39a9('0x3')]();config[_0x39a9('0x0')]=_[_0x39a9('0x4')](config[_0x39a9('0x0')],{'database':_0x39a9('0x5'),'username':_0x39a9('0x6'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x39a9('0x7'),'dialectOptions':{'charset':_0x39a9('0x8')},'logging':![],'timezone':timezone[_0x39a9('0x9')](),'define':{'charset':_0x39a9('0xa'),'collate':_0x39a9('0xb')}}});config[_0x39a9('0xc')]=_['defaultsDeep'](config[_0x39a9('0xc')],{'database':'motion2','username':'xcall','password':_0x39a9('0xd'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x39a9('0x7'),'dialectOptions':{'charset':_0x39a9('0x8')},'logging':![],'timezone':timezone[_0x39a9('0x9')](),'define':{'charset':_0x39a9('0xa'),'collate':_0x39a9('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x39a9('0xe')],config[_0x39a9('0x0')][_0x39a9('0xf')],config[_0x39a9('0x0')][_0x39a9('0x10')],config[_0x39a9('0x0')][_0x39a9('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x39a9('0xc')][_0x39a9('0xe')],config[_0x39a9('0xc')][_0x39a9('0xf')],config[_0x39a9('0xc')][_0x39a9('0x10')],config[_0x39a9('0xc')]['options'])};db[_0x39a9('0x12')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x13'));db[_0x39a9('0x14')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x16'));db['VoiceContext']=db[_0x39a9('0x0')]['import'](_0x39a9('0x17'));db[_0x39a9('0x18')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x19'));db[_0x39a9('0x1a')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x1b'));db[_0x39a9('0x1c')]=db['sequelize']['import'](_0x39a9('0x1d'));db[_0x39a9('0x1e')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x1f'));db[_0x39a9('0x20')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x21'));db['VoiceMailMessage']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x39a9('0x22')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x23'));db['VoiceDialReport']=db['sequelize'][_0x39a9('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x39a9('0x24')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x25'));db['VoiceQueueReport']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x39a9('0x26')]=db[_0x39a9('0x0')]['import']('../api/memberReport/memberReport.model');db[_0x39a9('0x27')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x28'));db[_0x39a9('0x29')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x2a'));db['UserVoiceQueueRt']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x2b'));db[_0x39a9('0x2c')]=db[_0x39a9('0x0')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x39a9('0x2d')]=db['sequelize']['import']('../api/userChatQueue/userChatQueue.model');db[_0x39a9('0x2e')]=db[_0x39a9('0x0')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x39a9('0x2f')]=db[_0x39a9('0x0')]['import']('../api/userFaxQueue/userFaxQueue.model');db[_0x39a9('0x30')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x31'));db['UserOpenchannelQueue']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x32'));db[_0x39a9('0x33')]=db['sequelize']['import'](_0x39a9('0x34'));db['MailServerIn']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/mailServerIn/mailServerIn.model');db[_0x39a9('0x35')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x36'));db[_0x39a9('0x37')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x38'));db['MailQueue']=db['sequelize']['import'](_0x39a9('0x39'));db['MailSubstatus']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x3a'));db['MailInteraction']=db[_0x39a9('0x0')]['import'](_0x39a9('0x3b'));db[_0x39a9('0x3c')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/mailMessage/mailMessage.model');db[_0x39a9('0x3d')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x3e'));db['MailQueueReport']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x3f'));db[_0x39a9('0x40')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x41'));db[_0x39a9('0x42')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x43'));db[_0x39a9('0x44')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x45'));db[_0x39a9('0x46')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x47'));db[_0x39a9('0x48')]=db['sequelize'][_0x39a9('0x15')]('../api/faxMessage/faxMessage.model');db[_0x39a9('0x49')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x4a'));db[_0x39a9('0x4b')]=db[_0x39a9('0x0')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x39a9('0x4c')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x4d'));db[_0x39a9('0x4e')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x4f'));db[_0x39a9('0x50')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x51'));db[_0x39a9('0x52')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x53'));db['SmsQueue']=db['sequelize'][_0x39a9('0x15')]('../api/smsQueue/smsQueue.model');db[_0x39a9('0x54')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x55'));db[_0x39a9('0x56')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x57'));db[_0x39a9('0x58')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x59'));db[_0x39a9('0x5a')]=db[_0x39a9('0x0')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x5b'));db[_0x39a9('0x5c')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x5d'));db[_0x39a9('0x5e')]=db['sequelize']['import'](_0x39a9('0x5f'));db[_0x39a9('0x60')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/chatApplication/chatApplication.model');db[_0x39a9('0x61')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x62'));db['ChatMessage']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x63'));db[_0x39a9('0x64')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x65'));db[_0x39a9('0x66')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x67'));db[_0x39a9('0x68')]=db[_0x39a9('0x0')]['import']('../api/chatGroup/chatGroup.model');db[_0x39a9('0x69')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x6a'));db['CmCompany']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x6b'));db[_0x39a9('0x6c')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/cmContact/cmContact.model');db[_0x39a9('0x6d')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x6e'));db['CmHopperFinal']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x6f'));db[_0x39a9('0x70')]=db['sequelize']['import'](_0x39a9('0x71'));db[_0x39a9('0x72')]=db[_0x39a9('0x0')]['import']('../api/reportAgentPreview/reportAgentPreview.model');db[_0x39a9('0x73')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0x39a9('0x74')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x75'));db[_0x39a9('0x76')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x77'));db[_0x39a9('0x78')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x79'));db[_0x39a9('0x7a')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x7b'));db[_0x39a9('0x7c')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x7d'));db[_0x39a9('0x7e')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x7f'));db[_0x39a9('0x80')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x81'));db[_0x39a9('0x82')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x83'));db[_0x39a9('0x84')]=db['sequelize']['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x85'));db[_0x39a9('0x86')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/sound/sound.model');db[_0x39a9('0x87')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/tag/tag.model');db[_0x39a9('0x88')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x89'));db[_0x39a9('0x8a')]=db['sequelize']['import']('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x8b'));db[_0x39a9('0x8c')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x8d'));db[_0x39a9('0x8e')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x8f'));db['Variable']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x90'));db[_0x39a9('0x91')]=db['sequelize']['import'](_0x39a9('0x92'));db[_0x39a9('0x93')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x94'));db[_0x39a9('0x95')]=db[_0x39a9('0x0')]['import'](_0x39a9('0x96'));db[_0x39a9('0x97')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x98'));db[_0x39a9('0x99')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x9a'));db[_0x39a9('0x9b')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x9c'));db[_0x39a9('0x9d')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x9e'));db[_0x39a9('0x9f')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xa0'));db[_0x39a9('0xa1')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xa2'));db[_0x39a9('0xa3')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xa4'));db[_0x39a9('0xa5')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xa6'));db['SugarcrmAccount']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xa7'));db['SugarcrmConfiguration']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xa8'));db[_0x39a9('0xa9')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xaa'));db[_0x39a9('0xab')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xac'));db['DeskConfiguration']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xad'));db[_0x39a9('0xae')]=db['sequelize']['import']('../api/intDeskField/intDeskField.model');db[_0x39a9('0xaf')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xb0'));db[_0x39a9('0xb1')]=db['sequelize'][_0x39a9('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x39a9('0xb2')]=db['sequelize']['import'](_0x39a9('0xb3'));db[_0x39a9('0xb4')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xb5'));db['ZendeskConfiguration']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x39a9('0xb6')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0x39a9('0xb7')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xb8'));db[_0x39a9('0xb9')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xba'));db[_0x39a9('0xbb')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xbc'));db[_0x39a9('0xbd')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xbe'));db[_0x39a9('0xbf')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xc0'));db['VtigerField']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xc1'));db[_0x39a9('0xc2')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xc3'));db[_0x39a9('0xc4')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xc5'));db[_0x39a9('0xc6')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/intServicenowField/intServicenowField.model');db[_0x39a9('0xc7')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xc8'));db[_0x39a9('0xc9')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xca'));db[_0x39a9('0xcb')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xcc'));db['FreshsalesAccount']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xcd'));db[_0x39a9('0xce')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xcf'));db[_0x39a9('0xd0')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xd1'));db[_0x39a9('0x91')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/integration/integration.model');db[_0x39a9('0xd2')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xd3'));db['ChatQueueReport']=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x39a9('0xd4')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xd5'));db['JscriptyAnswerReport']=db['sequelize']['import'](_0x39a9('0xd6'));db[_0x39a9('0xd7')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xd8'));db[_0x39a9('0xd9')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xda'));db[_0x39a9('0xdb')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xdc'));db[_0x39a9('0xdd')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xde'));db['JscriptyProject']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xdf'));db['Setting']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xe0'));db[_0x39a9('0xe1')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xe2'));db['SquareProject']=db[_0x39a9('0x0')]['import']('../api/squareProject/squareProject.model');db[_0x39a9('0xe3')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xe4'));db[_0x39a9('0xe5')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xe6'));db[_0x39a9('0xe7')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xe8'));db[_0x39a9('0xe9')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xea'));db['Campaign']=db[_0x39a9('0x0')]['import'](_0x39a9('0xeb'));db[_0x39a9('0xec')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xed'));db['Attachment']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xee'));db['Plugin']=db['sequelize'][_0x39a9('0x15')](_0x39a9('0xef'));db[_0x39a9('0xf0')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0x39a9('0xf1')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xf2'));db[_0x39a9('0xf3')]=db[_0x39a9('0x0')]['import'](_0x39a9('0xf4'));db[_0x39a9('0xf5')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xf6'));db[_0x39a9('0xf7')]=db['sequelize'][_0x39a9('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x39a9('0xf8')]=db[_0x39a9('0x0')][_0x39a9('0x15')]('../api/cmList/cmList.model');db[_0x39a9('0xf9')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xfa'));db[_0x39a9('0xfb')]=db[_0x39a9('0x0')]['import']('../api/userProfile/userProfile.model');db[_0x39a9('0xfc')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xfd'));db[_0x39a9('0xfe')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0xff'));db[_0x39a9('0x100')]=db['sequelize']['import']('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x101'));db['WhatsappApplication']=db['sequelize'][_0x39a9('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0x39a9('0x102')]=db['sequelize']['import'](_0x39a9('0x103'));db[_0x39a9('0x104')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x105'));db[_0x39a9('0x106')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x107'));db[_0x39a9('0x108')]=db[_0x39a9('0x0')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x39a9('0x109')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x10a'));db['CloudProvider']=db['sequelize'][_0x39a9('0x15')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db[_0x39a9('0x0')]['import'](_0x39a9('0x10b'));db[_0x39a9('0x10c')]=db[_0x39a9('0x0')][_0x39a9('0x15')](_0x39a9('0x10d'));db[_0x39a9('0x10e')]=db['sequelize'][_0x39a9('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x39a9('0x10f')]=db['sequelize'][_0x39a9('0x15')](_0x39a9('0x110'));db[_0x39a9('0x12')][_0x39a9('0x111')](db[_0x39a9('0x112')],{'as':_0x39a9('0x112'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x12')][_0x39a9('0x111')](db['UserSetting'],{'as':_0x39a9('0x115'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x12')][_0x39a9('0x116')](db[_0x39a9('0x1e')],{'as':'Recordings','foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x117')],{'as':_0x39a9('0x118'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x12')]['hasMany'](db[_0x39a9('0x18')],{'as':_0x39a9('0x119'),'onDelete':'cascade','hooks':!![]});db['User'][_0x39a9('0x116')](db['CmHopperFinal'],{'as':_0x39a9('0x11a'),'foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x70')],{'as':'HopperHistory','foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x72')],{'as':_0x39a9('0x72'),'foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x58')],{'as':_0x39a9('0x11b'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x12')]['hasMany'](db[_0x39a9('0x61')],{'as':_0x39a9('0x11c'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x12')][_0x39a9('0x116')](db[_0x39a9('0x50')],{'as':_0x39a9('0x11d'),'foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db['FaxInteraction'],{'as':_0x39a9('0x11e'),'foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x11f')],{'as':'MailInteractions','foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x102')],{'as':'WhatsappInteractions','foreignKey':_0x39a9('0x114')});db['User'][_0x39a9('0x116')](db[_0x39a9('0x100')],{'as':_0x39a9('0x120'),'foreignKey':_0x39a9('0x121')});db['User'][_0x39a9('0x122')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x39a9('0x123')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x68')],{'as':_0x39a9('0x125'),'through':_0x39a9('0x126')});db[_0x39a9('0x12')]['belongsToMany'](db[_0x39a9('0x6c')],{'as':_0x39a9('0x127'),'through':_0x39a9('0x128')});db[_0x39a9('0x12')]['belongsToMany'](db[_0x39a9('0xf8')],{'as':_0x39a9('0x129'),'through':_0x39a9('0x12a')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x12b')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x11f')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x39a9('0x12')][_0x39a9('0x124')](db['ChatInteraction'],{'as':_0x39a9('0x11c'),'through':_0x39a9('0x12c')});db[_0x39a9('0x12')][_0x39a9('0x124')](db['FaxInteraction'],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x50')],{'as':_0x39a9('0x11d'),'through':_0x39a9('0x12d')});db['User']['belongsToMany'](db[_0x39a9('0x58')],{'as':_0x39a9('0x11b'),'through':_0x39a9('0x12e')});db[_0x39a9('0x12')]['belongsToMany'](db[_0x39a9('0x102')],{'as':'WhatsappInteractions','through':_0x39a9('0x12f')});db[_0x39a9('0x12')]['belongsToMany'](db[_0x39a9('0x1c')],{'as':'VoiceQueues','through':_0x39a9('0x2c'),'required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db['VoicePrefix'],{'as':_0x39a9('0x130'),'through':_0x39a9('0x10e'),'required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x131')],{'as':_0x39a9('0x132'),'through':_0x39a9('0x2e'),'required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x66')],{'as':_0x39a9('0x133'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x39a9('0x124')](db[_0x39a9('0x49')],{'as':_0x39a9('0x134'),'through':'UserFaxQueue','required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x135')],{'as':_0x39a9('0x136'),'through':_0x39a9('0x30'),'required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x137')],{'as':_0x39a9('0x138'),'through':_0x39a9('0x139'),'required':![]});db[_0x39a9('0x12')]['belongsToMany'](db[_0x39a9('0x109')],{'as':'WhatsappQueues','through':_0x39a9('0x33'),'required':![]});db[_0x39a9('0x12')][_0x39a9('0x124')](db['CmList'],{'through':_0x39a9('0x12a')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x5c')],{'as':_0x39a9('0x13a'),'through':'user_has_chat_websites'});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x42')],{'as':_0x39a9('0x13b'),'through':_0x39a9('0x13c')});db[_0x39a9('0x12')][_0x39a9('0x124')](db['MailAccount'],{'as':_0x39a9('0x13d'),'through':_0x39a9('0x13e')});db['User']['belongsToMany'](db[_0x39a9('0x54')],{'as':_0x39a9('0x13f'),'through':_0x39a9('0x140')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x4c')],{'as':'SmsAccounts','through':_0x39a9('0x141')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x142')],{'as':_0x39a9('0x143'),'through':_0x39a9('0x144')});db[_0x39a9('0x12')][_0x39a9('0x124')](db[_0x39a9('0x145')],{'as':_0x39a9('0x146'),'through':_0x39a9('0x147')});db[_0x39a9('0x14')][_0x39a9('0x116')](db[_0x39a9('0x18')],{'as':_0x39a9('0x148'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x149')});db['VoiceContext']['hasMany'](db['VoiceExtension'],{'onDelete':_0x39a9('0x113')});db[_0x39a9('0x18')][_0x39a9('0x116')](db['VoiceExtension'],{'as':_0x39a9('0x14a'),'onDelete':_0x39a9('0x113')});db['VoiceMusicOnHold'][_0x39a9('0x124')](db[_0x39a9('0x86')],{'as':_0x39a9('0x14b'),'through':'moh_has_sounds'});db[_0x39a9('0x1c')][_0x39a9('0x116')](db['UserVoiceQueueRt'],{'as':_0x39a9('0x14c'),'foreignKey':_0x39a9('0x14d')});db['VoiceQueue'][_0x39a9('0x116')](db[_0x39a9('0x6d')],{'as':_0x39a9('0x14e'),'foreignKey':_0x39a9('0x14d')});db[_0x39a9('0x1c')]['hasMany'](db[_0x39a9('0x14f')],{'as':_0x39a9('0x11a'),'foreignKey':_0x39a9('0x14d')});db['VoiceQueue'][_0x39a9('0x116')](db['CmHopperHistory'],{'as':_0x39a9('0x150'),'foreignKey':_0x39a9('0x14d')});db[_0x39a9('0x1c')][_0x39a9('0x116')](db['ReportAgentPreview'],{'as':_0x39a9('0x72'),'foreignKey':_0x39a9('0x14d')});db[_0x39a9('0x1c')]['hasMany'](db[_0x39a9('0x151')],{'as':_0x39a9('0x152'),'foreignKey':_0x39a9('0x14d')});db[_0x39a9('0x1c')][_0x39a9('0x116')](db['JscriptySessionReport'],{'as':_0x39a9('0x153'),'foreignKey':_0x39a9('0x14d')});db['VoiceQueue'][_0x39a9('0x122')](db[_0x39a9('0x27')],{'as':_0x39a9('0x27'),'foreignKey':_0x39a9('0x154')});db[_0x39a9('0x1c')][_0x39a9('0x122')](db[_0x39a9('0x27')],{'as':_0x39a9('0x155'),'foreignKey':'TrunkBackupId'});db[_0x39a9('0x1c')][_0x39a9('0x122')](db[_0x39a9('0x7e')],{'as':_0x39a9('0x7e'),'foreignKey':_0x39a9('0x156')});db[_0x39a9('0x1c')][_0x39a9('0x122')](db[_0x39a9('0x80')],{'as':'mandatoryDispositionPause','foreignKey':_0x39a9('0x157')});db[_0x39a9('0x1c')][_0x39a9('0x124')](db[_0x39a9('0xf8')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x39a9('0x1c')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x2c')});db[_0x39a9('0x1c')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'as':_0x39a9('0x159'),'through':_0x39a9('0x15a')});db[_0x39a9('0x1c')]['belongsToMany'](db[_0x39a9('0xf8')],{'as':_0x39a9('0x15b'),'through':'voice_queues_has_cm_blacklists'});db[_0x39a9('0x1e')]['belongsTo'](db[_0x39a9('0x12')],{'as':_0x39a9('0x12'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x20')][_0x39a9('0x122')](db['User'],{'as':_0x39a9('0x12'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x112')]['hasMany'](db['VoiceMailMessage'],{'as':_0x39a9('0x15c'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x15d'),'sourceKey':_0x39a9('0x15e')});db[_0x39a9('0x15f')][_0x39a9('0x122')](db[_0x39a9('0x112')],{'foreignKey':'mailboxuser','targetKey':_0x39a9('0x15e')});db[_0x39a9('0x22')]['hasMany'](db[_0x39a9('0x160')],{'as':_0x39a9('0x161'),'foreignKey':_0x39a9('0x162'),'constraints':![]});db[_0x39a9('0x22')][_0x39a9('0x116')](db[_0x39a9('0x24')],{'as':_0x39a9('0x163'),'foreignKey':_0x39a9('0x162'),'constraints':![]});db[_0x39a9('0x22')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x12'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x22')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db['MailServerIn'][_0x39a9('0x122')](db[_0x39a9('0x37')],{'as':_0x39a9('0x37'),'foreignKey':_0x39a9('0x166')});db[_0x39a9('0x167')]['belongsTo'](db[_0x39a9('0x168')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':_0x39a9('0x169')});db[_0x39a9('0x35')][_0x39a9('0x122')](db[_0x39a9('0x37')],{'as':_0x39a9('0x37'),'foreignKey':_0x39a9('0x166')});db['MailServerOut']['belongsTo'](db[_0x39a9('0x168')],{'as':_0x39a9('0x168'),'foreignKey':_0x39a9('0x16a'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x37')][_0x39a9('0x111')](db[_0x39a9('0x167')],{'as':_0x39a9('0x16b'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x37')][_0x39a9('0x111')](db['MailServerOut'],{'as':_0x39a9('0x16c'),'onDelete':_0x39a9('0x113')});db['MailAccount'][_0x39a9('0x116')](db[_0x39a9('0x7a')],{'as':_0x39a9('0x16d'),'foreignKey':_0x39a9('0x166'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x37')][_0x39a9('0x116')](db[_0x39a9('0x78')],{'as':_0x39a9('0x16e'),'foreignKey':_0x39a9('0x166')});db['MailAccount'][_0x39a9('0x116')](db[_0x39a9('0x3c')],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x39a9('0x37')][_0x39a9('0x116')](db[_0x39a9('0x11f')],{'as':'Interactions'});db[_0x39a9('0x37')][_0x39a9('0x116')](db[_0x39a9('0x3d')],{'as':'Applications'});db[_0x39a9('0x37')][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':_0x39a9('0x16f'),'foreignKey':'ListId'});db[_0x39a9('0x37')][_0x39a9('0x122')](db['Template'],{'as':_0x39a9('0x8c'),'foreignKey':_0x39a9('0x170')});db[_0x39a9('0x37')][_0x39a9('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x39a9('0x157')});db[_0x39a9('0x37')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x13e')});db[_0x39a9('0x131')][_0x39a9('0x124')](db['User'],{'as':'Agents','through':_0x39a9('0x2e')});db[_0x39a9('0x131')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x171'),'as':_0x39a9('0x159')});db['MailInteraction'][_0x39a9('0x116')](db[_0x39a9('0x3c')],{'as':_0x39a9('0x15c'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x172')});db[_0x39a9('0x11f')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0x39a9('0x166')});db[_0x39a9('0x11f')][_0x39a9('0x122')](db['CmContact'],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x11f')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x173'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x11f')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x174'),'as':_0x39a9('0x175')});db['MailInteraction'][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x174'),'as':'ThroughTags'});db[_0x39a9('0x11f')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x176'),'through':_0x39a9('0x177'),'foreignKey':_0x39a9('0x172')});db[_0x39a9('0x3c')][_0x39a9('0x116')](db['Attachment'],{'as':_0x39a9('0x178'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x3c')]['belongsTo'](db['User'],{'as':_0x39a9('0x12')});db[_0x39a9('0x3c')][_0x39a9('0x122')](db['CmContact'],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x164')});db[_0x39a9('0x3c')]['belongsTo'](db[_0x39a9('0x11f')],{'as':_0x39a9('0x179'),'foreignKey':_0x39a9('0x172')});db[_0x39a9('0x3c')][_0x39a9('0x122')](db['MailAccount'],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x166')});db[_0x39a9('0x3c')][_0x39a9('0x122')](db[_0x39a9('0x5c')],{'as':_0x39a9('0x5c'),'foreignKey':'ChatWebsiteId'});db[_0x39a9('0x3c')][_0x39a9('0x122')](db['ChatOfflineMessage'],{'as':_0x39a9('0x64'),'foreignKey':_0x39a9('0x17b')});db[_0x39a9('0x3d')]['belongsTo'](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x3d')][_0x39a9('0x122')](db['MailQueue'],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x3d')][_0x39a9('0x122')](db[_0x39a9('0x37')],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x3d')][_0x39a9('0x122')](db['Interval'],{'onDelete':_0x39a9('0x169'),'foreignKey':'IntervalId'});db[_0x39a9('0x3d')]['belongsTo'](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x17c')});db[_0x39a9('0x17d')][_0x39a9('0x122')](db[_0x39a9('0x37')],{});db[_0x39a9('0x17d')][_0x39a9('0x122')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x39a9('0x17d')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db['MailQueueReport'][_0x39a9('0x122')](db[_0x39a9('0x11f')],{});db['MailQueueReport'][_0x39a9('0x122')](db[_0x39a9('0x3c')],{});db['MailQueueReport'][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db[_0x39a9('0x17d')][_0x39a9('0x122')](db[_0x39a9('0x131')],{});db[_0x39a9('0x17e')][_0x39a9('0x116')](db[_0x39a9('0x40')],{'as':_0x39a9('0x17f'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x42')][_0x39a9('0x116')](db['Disposition'],{'as':_0x39a9('0x16d'),'foreignKey':_0x39a9('0x180'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x42')][_0x39a9('0x116')](db[_0x39a9('0x78')],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x39a9('0x116')](db[_0x39a9('0x46')],{'as':_0x39a9('0x181')});db['FaxAccount'][_0x39a9('0x116')](db[_0x39a9('0x44')],{'as':_0x39a9('0x14a')});db[_0x39a9('0x42')][_0x39a9('0x116')](db['VoiceExtension'],{'as':_0x39a9('0x182'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x42')][_0x39a9('0x116')](db[_0x39a9('0x48')],{'as':_0x39a9('0x15c')});db[_0x39a9('0x42')][_0x39a9('0x122')](db['Trunk'],{'as':_0x39a9('0x27')});db[_0x39a9('0x42')][_0x39a9('0x122')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x39a9('0x42')][_0x39a9('0x122')](db[_0x39a9('0x80')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x39a9('0x42')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':'user_has_fax_accounts'});db[_0x39a9('0x44')]['belongsTo'](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x169')});db['FaxApplication'][_0x39a9('0x122')](db[_0x39a9('0x49')],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x44')][_0x39a9('0x122')](db['FaxAccount'],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x44')][_0x39a9('0x122')](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x17c')});db[_0x39a9('0x46')][_0x39a9('0x116')](db[_0x39a9('0x48')],{'as':_0x39a9('0x15c'),'onDelete':'cascade','foreignKey':_0x39a9('0x183')});db['FaxInteraction'][_0x39a9('0x122')](db[_0x39a9('0x42')],{'as':'Account','foreignKey':_0x39a9('0x180')});db['FaxInteraction'][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x46')][_0x39a9('0x122')](db['User'],{'as':'Owner','foreignKey':_0x39a9('0x114')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x39a9('0x184'),'as':'Tags'});db[_0x39a9('0x46')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x184'),'as':_0x39a9('0x185')});db[_0x39a9('0x46')]['belongsToMany'](db['User'],{'as':_0x39a9('0x176'),'through':_0x39a9('0x186'),'foreignKey':_0x39a9('0x183')});db[_0x39a9('0x48')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x113'),'as':'User'});db['FaxMessage'][_0x39a9('0x122')](db[_0x39a9('0x46')],{'as':_0x39a9('0x179'),'foreignKey':_0x39a9('0x183')});db[_0x39a9('0x48')][_0x39a9('0x122')](db['CmContact'],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x164')});db[_0x39a9('0x48')][_0x39a9('0x122')](db[_0x39a9('0x187')],{'as':_0x39a9('0x187'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0x39a9('0x122')](db[_0x39a9('0x42')],{'as':'Account','foreignKey':_0x39a9('0x180')});db[_0x39a9('0x49')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':'UserFaxQueue'});db[_0x39a9('0x49')]['belongsToMany'](db[_0x39a9('0xe7')],{'through':_0x39a9('0x188'),'as':'Teams'});db['FaxQueueReport'][_0x39a9('0x122')](db['FaxAccount'],{});db[_0x39a9('0x4b')][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':'List','foreignKey':'ListId'});db['FaxQueueReport'][_0x39a9('0x122')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x39a9('0x4b')][_0x39a9('0x122')](db[_0x39a9('0x46')],{});db[_0x39a9('0x4b')][_0x39a9('0x122')](db[_0x39a9('0x48')],{});db['FaxQueueReport'][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db[_0x39a9('0x4b')]['belongsTo'](db[_0x39a9('0x49')],{});db[_0x39a9('0x4c')]['hasMany'](db[_0x39a9('0x7a')],{'as':_0x39a9('0x16d'),'foreignKey':_0x39a9('0x189'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x4c')][_0x39a9('0x116')](db[_0x39a9('0x78')],{'as':_0x39a9('0x16e'),'foreignKey':_0x39a9('0x189')});db['SmsAccount']['hasMany'](db[_0x39a9('0x52')],{'as':'Messages','foreignKey':_0x39a9('0x189')});db['SmsAccount'][_0x39a9('0x116')](db['SmsInteraction'],{'as':_0x39a9('0x181')});db['SmsAccount'][_0x39a9('0x116')](db[_0x39a9('0x4e')],{'as':_0x39a9('0x14a')});db['SmsAccount'][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':'List','foreignKey':_0x39a9('0x18a')});db['SmsAccount']['belongsTo'](db[_0x39a9('0x80')],{'as':_0x39a9('0x18b'),'foreignKey':_0x39a9('0x157')});db[_0x39a9('0x4c')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x141')});db[_0x39a9('0x4e')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x4e')][_0x39a9('0x122')](db['SmsQueue'],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x4e')]['belongsTo'](db[_0x39a9('0x4c')],{'onDelete':'restrict'});db[_0x39a9('0x4e')][_0x39a9('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x39a9('0x156')});db[_0x39a9('0x4e')][_0x39a9('0x122')](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x17c')});db[_0x39a9('0x50')][_0x39a9('0x116')](db['SmsMessage'],{'as':_0x39a9('0x15c'),'onDelete':'cascade','foreignKey':_0x39a9('0x18c')});db['SmsInteraction'][_0x39a9('0x122')](db[_0x39a9('0x4c')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x189')});db[_0x39a9('0x50')]['belongsTo'](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':'ContactId'});db[_0x39a9('0x50')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x173'),'foreignKey':_0x39a9('0x114')});db['SmsInteraction'][_0x39a9('0x124')](db['Tag'],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x39a9('0x50')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':'sms_interaction_has_tags','as':_0x39a9('0x185')});db['SmsInteraction'][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x176'),'through':_0x39a9('0x12d'),'foreignKey':'SmsInteractionId'});db[_0x39a9('0x52')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x12')});db[_0x39a9('0x52')][_0x39a9('0x122')](db['CmContact'],{'onDelete':_0x39a9('0x113'),'as':'Contact'});db[_0x39a9('0x52')][_0x39a9('0x122')](db['SmsInteraction'],{'onDelete':_0x39a9('0x113'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x39a9('0x52')][_0x39a9('0x122')](db[_0x39a9('0x4c')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x189')});db[_0x39a9('0x135')][_0x39a9('0x124')](db['User'],{'as':'Agents','through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0x39a9('0x135')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x18d'),'as':_0x39a9('0x159')});db[_0x39a9('0x54')][_0x39a9('0x116')](db[_0x39a9('0x7a')],{'as':'Dispositions','foreignKey':_0x39a9('0x18e'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x54')][_0x39a9('0x116')](db[_0x39a9('0x78')],{'as':_0x39a9('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x39a9('0x54')][_0x39a9('0x116')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':_0x39a9('0x18e')});db[_0x39a9('0x54')][_0x39a9('0x116')](db[_0x39a9('0x5a')],{'as':_0x39a9('0x15c'),'foreignKey':_0x39a9('0x18e')});db[_0x39a9('0x54')][_0x39a9('0x116')](db[_0x39a9('0x56')],{'as':_0x39a9('0x14a'),'foreignKey':_0x39a9('0x18e')});db[_0x39a9('0x54')][_0x39a9('0x122')](db['CmList'],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0x54')][_0x39a9('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x39a9('0x54')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x140')});db['OpenchannelApplication'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'onDelete':'restrict'});db[_0x39a9('0x56')][_0x39a9('0x122')](db[_0x39a9('0x137')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x18f')});db['OpenchannelApplication'][_0x39a9('0x122')](db[_0x39a9('0x54')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x18e')});db['OpenchannelApplication'][_0x39a9('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x39a9('0x156')});db['OpenchannelApplication']['belongsTo'](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x17c')});db[_0x39a9('0x58')]['hasMany'](db[_0x39a9('0x5a')],{'as':_0x39a9('0x15c'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x190')});db['OpenchannelInteraction'][_0x39a9('0x122')](db['OpenchannelAccount'],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x18e')});db[_0x39a9('0x58')]['belongsTo'](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x58')]['belongsTo'](db[_0x39a9('0x12')],{'as':_0x39a9('0x173'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x58')]['belongsToMany'](db['Tag'],{'through':_0x39a9('0x191'),'as':_0x39a9('0x175')});db[_0x39a9('0x58')]['belongsToMany'](db[_0x39a9('0x87')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x39a9('0x58')][_0x39a9('0x124')](db['User'],{'as':_0x39a9('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x39a9('0x190')});db[_0x39a9('0x5a')][_0x39a9('0x122')](db['User'],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x12')});db[_0x39a9('0x5a')]['belongsTo'](db[_0x39a9('0x6c')],{'onDelete':_0x39a9('0x113'),'as':'Contact'});db[_0x39a9('0x5a')][_0x39a9('0x122')](db[_0x39a9('0x58')],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x179'),'foreignKey':_0x39a9('0x190')});db[_0x39a9('0x5a')][_0x39a9('0x122')](db[_0x39a9('0x187')],{'as':_0x39a9('0x187'),'foreignKey':_0x39a9('0x192')});db[_0x39a9('0x5a')][_0x39a9('0x122')](db[_0x39a9('0x54')],{'as':'Account','foreignKey':_0x39a9('0x18e')});db[_0x39a9('0x137')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':'UserOpenchannelQueue','foreignKey':_0x39a9('0x18f')});db[_0x39a9('0x137')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x193'),'as':_0x39a9('0x159')});db[_0x39a9('0x5c')][_0x39a9('0x116')](db['Disposition'],{'as':_0x39a9('0x16d'),'foreignKey':_0x39a9('0x194'),'onDelete':'cascade'});db[_0x39a9('0x5c')]['hasMany'](db[_0x39a9('0x78')],{'as':_0x39a9('0x16e'),'foreignKey':_0x39a9('0x194')});db[_0x39a9('0x5c')][_0x39a9('0x116')](db[_0x39a9('0x69')],{'as':_0x39a9('0x195')});db[_0x39a9('0x5c')]['hasMany'](db[_0x39a9('0x61')],{'as':'Interactions'});db[_0x39a9('0x5c')][_0x39a9('0x116')](db[_0x39a9('0x60')],{'as':_0x39a9('0x14a')});db[_0x39a9('0x5c')][_0x39a9('0x116')](db[_0x39a9('0x196')],{'as':_0x39a9('0x15c')});db[_0x39a9('0x5c')]['belongsTo'](db['CmList'],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a')});db['ChatWebsite'][_0x39a9('0x122')](db[_0x39a9('0x7e')],{'as':_0x39a9('0x7e'),'foreignKey':'IntervalId'});db[_0x39a9('0x5c')][_0x39a9('0x122')](db[_0x39a9('0x37')],{'as':_0x39a9('0x37'),'foreignKey':_0x39a9('0x166')});db[_0x39a9('0x5c')][_0x39a9('0x122')](db[_0x39a9('0x80')],{'as':_0x39a9('0x18b'),'foreignKey':_0x39a9('0x157')});db[_0x39a9('0x5c')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x197')});db[_0x39a9('0x5e')][_0x39a9('0x122')](db[_0x39a9('0x54')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x39a9('0xf8')],{'as':'List','foreignKey':_0x39a9('0x18a')});db[_0x39a9('0x5e')][_0x39a9('0x122')](db['CmContact'],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x5e')][_0x39a9('0x122')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x39a9('0x122')](db['OpenchannelMessage'],{});db[_0x39a9('0x5e')][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x39a9('0x137')],{});db[_0x39a9('0x60')][_0x39a9('0x122')](db['User'],{'as':'Agent','foreignKey':_0x39a9('0x114'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x60')][_0x39a9('0x122')](db['ChatQueue'],{'as':_0x39a9('0x198'),'foreignKey':_0x39a9('0x199'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':_0x39a9('0x19a'),'foreignKey':_0x39a9('0x194'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x60')]['belongsTo'](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x17c')});db[_0x39a9('0x61')][_0x39a9('0x116')](db[_0x39a9('0x196')],{'as':_0x39a9('0x15c'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x19b')});db[_0x39a9('0x61')][_0x39a9('0x122')](db[_0x39a9('0x5c')],{'as':_0x39a9('0x17a'),'foreignKey':'ChatWebsiteId'});db[_0x39a9('0x61')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':'Contact','foreignKey':_0x39a9('0x165')});db[_0x39a9('0x61')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x173'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x61')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x19c'),'as':'Tags'});db[_0x39a9('0x61')][_0x39a9('0x124')](db['Tag'],{'through':_0x39a9('0x19c'),'as':_0x39a9('0x185')});db[_0x39a9('0x61')][_0x39a9('0x124')](db['User'],{'as':'Users','through':_0x39a9('0x12c'),'foreignKey':_0x39a9('0x19b')});db['ChatMessage'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'onDelete':'cascade','as':_0x39a9('0x12')});db[_0x39a9('0x196')]['belongsTo'](db[_0x39a9('0x6c')],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db['ChatMessage'][_0x39a9('0x122')](db['ChatInteraction'],{'onDelete':_0x39a9('0x113'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x39a9('0x196')][_0x39a9('0x122')](db['Attachment'],{'as':_0x39a9('0x187'),'foreignKey':_0x39a9('0x192')});db[_0x39a9('0x196')]['belongsTo'](db[_0x39a9('0x5c')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x194')});db[_0x39a9('0x64')][_0x39a9('0x116')](db[_0x39a9('0x187')],{'as':_0x39a9('0x178'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x39a9('0x113'),'hooks':!![]});db[_0x39a9('0x64')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'onDelete':'cascade','as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x64')][_0x39a9('0x122')](db[_0x39a9('0x5c')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x194')});db['ChatQueue'][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':'UserChatQueue','hooks':!![]});db[_0x39a9('0x66')][_0x39a9('0x124')](db['Team'],{'through':_0x39a9('0x19d'),'as':_0x39a9('0x159')});db[_0x39a9('0x68')][_0x39a9('0x116')](db['ChatInternalMessage'],{'as':_0x39a9('0x15c'),'foreignKey':_0x39a9('0x19e'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x68')]['belongsToMany'](db[_0x39a9('0x12')],{'as':_0x39a9('0x14c'),'through':_0x39a9('0x126')});db[_0x39a9('0x69')][_0x39a9('0x122')](db[_0x39a9('0x5c')],{'as':_0x39a9('0x19a'),'foreignKey':_0x39a9('0x194')});db[_0x39a9('0x19f')][_0x39a9('0x116')](db['CmContact'],{'as':'Contacts','foreignKey':_0x39a9('0x1a0')});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x8a')],{'as':_0x39a9('0x1a1'),'foreignKey':_0x39a9('0x1a2')});db['CmContact'][_0x39a9('0x116')](db[_0x39a9('0x6d')],{'as':_0x39a9('0x14e'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x14f')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x70')],{'as':_0x39a9('0x150'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x72')],{'as':'ReportAgentPreview','foreignKey':_0x39a9('0x165')});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x1a3')],{'as':_0x39a9('0x153'),'foreignKey':_0x39a9('0x165')});db['CmContact'][_0x39a9('0x116')](db[_0x39a9('0x58')],{'as':_0x39a9('0x11b'),'foreignKey':_0x39a9('0x165'),'onDelete':'restrict'});db['CmContact'][_0x39a9('0x116')](db[_0x39a9('0x61')],{'as':_0x39a9('0x11c'),'foreignKey':_0x39a9('0x165'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x6c')][_0x39a9('0x116')](db[_0x39a9('0x50')],{'as':_0x39a9('0x11d'),'foreignKey':'ContactId','onDelete':_0x39a9('0x169')});db['CmContact'][_0x39a9('0x116')](db[_0x39a9('0x46')],{'as':'FaxInteractions','foreignKey':_0x39a9('0x165'),'onDelete':'restrict'});db[_0x39a9('0x6c')][_0x39a9('0x116')](db['MailInteraction'],{'as':_0x39a9('0x1a4'),'foreignKey':_0x39a9('0x165'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x6c')][_0x39a9('0x122')](db['CmCompany'],{'as':_0x39a9('0x1a5'),'foreignKey':_0x39a9('0x1a0')});db[_0x39a9('0x6c')]['belongsTo'](db[_0x39a9('0xf8')],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x6c')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x176'),'through':'cm_user_has_contacts'});db[_0x39a9('0x6c')][_0x39a9('0x124')](db['Tag'],{'as':_0x39a9('0x175'),'through':_0x39a9('0x1a6')});db['CmContact'][_0x39a9('0x124')](db['Tag'],{'through':_0x39a9('0x1a6'),'as':_0x39a9('0x185')});db[_0x39a9('0x6d')][_0x39a9('0x116')](db[_0x39a9('0x1a7')],{'as':_0x39a9('0x1a8'),'foreignKey':_0x39a9('0x1a9')});db[_0x39a9('0x6d')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x39a9('0x6d')][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':'List','foreignKey':_0x39a9('0x18a'),'onDelete':_0x39a9('0x113')});db['CmHopper'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x1aa'),'foreignKey':'UserId'});db[_0x39a9('0x6d')][_0x39a9('0x122')](db[_0x39a9('0x1c')],{'as':_0x39a9('0x198'),'foreignKey':_0x39a9('0x14d'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x6d')][_0x39a9('0x122')](db[_0x39a9('0x1ab')],{'as':_0x39a9('0x1ab'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x39a9('0x6d')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':'Owner','foreignKey':_0x39a9('0x1ac')});db[_0x39a9('0x151')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165'),'onDelete':'cascade'});db[_0x39a9('0x151')][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':'List','foreignKey':_0x39a9('0x18a'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x151')][_0x39a9('0x122')](db[_0x39a9('0x1c')],{'as':_0x39a9('0x198'),'foreignKey':_0x39a9('0x14d'),'onDelete':'cascade'});db['CmHopperBlack'][_0x39a9('0x122')](db[_0x39a9('0x1ab')],{'as':_0x39a9('0x1ab'),'foreignKey':_0x39a9('0x1ad'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x76')][_0x39a9('0x116')](db[_0x39a9('0x7c')],{'as':{'plural':_0x39a9('0x1ae'),'singular':_0x39a9('0x1af')},'foreignKey':_0x39a9('0x1b0'),'onDelete':_0x39a9('0x113'),'hooks':!![]});db[_0x39a9('0x76')][_0x39a9('0x116')](db['Condition'],{'as':{'plural':_0x39a9('0x1b1'),'singular':_0x39a9('0x1b2')},'foreignKey':_0x39a9('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0x39a9('0x76')]['hasMany'](db[_0x39a9('0x74')],{'as':_0x39a9('0x1b4'),'foreignKey':'AutomationId','onDelete':_0x39a9('0x113'),'hooks':!![]});db[_0x39a9('0x7a')][_0x39a9('0x116')](db[_0x39a9('0x7a')],{'as':'Dispositions','foreignKey':_0x39a9('0x1b5'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x7e')]['hasMany'](db['Interval'],{'as':'Intervals','foreignKey':_0x39a9('0x156'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x39a9('0x7e')]['hasMany'](db[_0x39a9('0x18')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0x39a9('0x169')});db[_0x39a9('0x7e')][_0x39a9('0x116')](db[_0x39a9('0x3d')],{'as':_0x39a9('0x1b6'),'foreignKey':_0x39a9('0x156')});db[_0x39a9('0x7e')][_0x39a9('0x116')](db[_0x39a9('0x60')],{'as':_0x39a9('0x1b7'),'foreignKey':_0x39a9('0x156')});db[_0x39a9('0x7e')][_0x39a9('0x116')](db[_0x39a9('0x44')],{'as':'FaxApplications','foreignKey':_0x39a9('0x156')});db[_0x39a9('0x7e')][_0x39a9('0x116')](db['SmsApplication'],{'as':_0x39a9('0x1b8'),'foreignKey':_0x39a9('0x156')});db['Schedule'][_0x39a9('0x122')](db[_0x39a9('0x37')],{});db['Schedule'][_0x39a9('0x122')](db['AnalyticDefaultReport'],{'foreignKey':_0x39a9('0x1b9')});db[_0x39a9('0x1ba')][_0x39a9('0x122')](db[_0x39a9('0x95')],{'foreignKey':'CustomReportId'});db[_0x39a9('0x86')][_0x39a9('0x124')](db[_0x39a9('0x1a')],{'as':_0x39a9('0x1bb'),'through':_0x39a9('0x1bc'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x87')][_0x39a9('0x124')](db[_0x39a9('0x6c')],{'through':_0x39a9('0x1a6')});db[_0x39a9('0x87')]['belongsToMany'](db[_0x39a9('0x61')],{'through':_0x39a9('0x19c')});db['Tag'][_0x39a9('0x124')](db[_0x39a9('0x11f')],{'through':_0x39a9('0x174')});db[_0x39a9('0x87')][_0x39a9('0x124')](db['SmsInteraction'],{'through':_0x39a9('0x1bd')});db[_0x39a9('0x87')][_0x39a9('0x124')](db[_0x39a9('0x46')],{'through':_0x39a9('0x184')});db[_0x39a9('0x87')]['belongsToMany'](db[_0x39a9('0x58')],{'through':_0x39a9('0x191')});db[_0x39a9('0x87')]['belongsToMany'](db[_0x39a9('0x102')],{'through':_0x39a9('0x1be')});db[_0x39a9('0x8a')][_0x39a9('0x122')](db['ContactItemType'],{'as':_0x39a9('0x1bf'),'foreignKey':_0x39a9('0x1c0')});db[_0x39a9('0x1a7')][_0x39a9('0x122')](db[_0x39a9('0x6d')],{'as':_0x39a9('0x1c1'),'foreignKey':_0x39a9('0x1a9')});db[_0x39a9('0x8a')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':'Contact','foreignKey':'CmContactId'});db[_0x39a9('0x8e')][_0x39a9('0x116')](db[_0x39a9('0x7c')],{'as':{'plural':_0x39a9('0x1c2'),'singular':_0x39a9('0x1c3')},'foreignKey':_0x39a9('0x1c4'),'onDelete':'cascade','hooks':!![]});db[_0x39a9('0x8e')][_0x39a9('0x116')](db['Condition'],{'as':{'plural':_0x39a9('0x1c5'),'singular':_0x39a9('0x1c6')},'foreignKey':_0x39a9('0x1c7'),'onDelete':_0x39a9('0x113'),'hooks':!![]});db[_0x39a9('0x8e')][_0x39a9('0x116')](db[_0x39a9('0x74')],{'as':'Actions','foreignKey':_0x39a9('0x1c8'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x39a9('0x116')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1c9'),'hooks':!![]});db[_0x39a9('0x97')][_0x39a9('0x116')](db[_0x39a9('0x9d')],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1b9')});db[_0x39a9('0x9b')][_0x39a9('0x116')](db[_0x39a9('0x9d')],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cb')});db[_0x39a9('0x9d')][_0x39a9('0x122')](db[_0x39a9('0x9b')],{'foreignKey':_0x39a9('0x1cb')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xa3')][_0x39a9('0x116')](db['SalesforceField'],{'as':_0x39a9('0x1cd'),'onDelete':'cascade','foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xa3')][_0x39a9('0x116')](db[_0x39a9('0xa5')],{'as':'Descriptions','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xa3')]['hasMany'](db[_0x39a9('0xa5')],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xa3')][_0x39a9('0x122')](db[_0x39a9('0xa1')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xa5')][_0x39a9('0x116')](db[_0x39a9('0xa5')],{'as':_0x39a9('0x1d1'),'foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xa5')][_0x39a9('0x116')](db[_0x39a9('0xa5')],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xa5')][_0x39a9('0x116')](db[_0x39a9('0xa5')],{'as':_0x39a9('0x1d3'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xa5')][_0x39a9('0x122')](db['Variable'],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db['SugarcrmAccount'][_0x39a9('0x116')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0x1d6')][_0x39a9('0x116')](db['SugarcrmField'],{'as':_0x39a9('0x1cd'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1ce')});db['SugarcrmConfiguration'][_0x39a9('0x116')](db[_0x39a9('0xa9')],{'as':_0x39a9('0x1d7'),'onDelete':'cascade','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0x1d6')][_0x39a9('0x116')](db['SugarcrmField'],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':'FieldId'});db[_0x39a9('0x1d6')][_0x39a9('0x122')](db['SugarcrmAccount'],{'as':_0x39a9('0x17a'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x39a9('0x116')](db[_0x39a9('0xa9')],{'as':'Subject','foreignKey':'SubjectId'});db['SugarcrmField'][_0x39a9('0x116')](db[_0x39a9('0xa9')],{'as':'Description','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xa9')]['hasMany'](db['SugarcrmField'],{'as':_0x39a9('0x1d3'),'foreignKey':_0x39a9('0x1d0')});db['SugarcrmField']['belongsTo'](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db[_0x39a9('0xab')][_0x39a9('0x116')](db[_0x39a9('0x1d8')],{'as':_0x39a9('0x1d9'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0x1d8')]['hasMany'](db['DeskField'],{'as':_0x39a9('0x1cd'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0x1d8')]['hasMany'](db['DeskField'],{'as':_0x39a9('0x1d7'),'onDelete':'cascade','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0x1d8')][_0x39a9('0x116')](db[_0x39a9('0xae')],{'as':_0x39a9('0x1ca'),'onDelete':'cascade','foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0x1d8')][_0x39a9('0x122')](db[_0x39a9('0xab')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0x1d8')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x1da')});db[_0x39a9('0xae')]['hasMany'](db['DeskField'],{'as':_0x39a9('0x1d1'),'foreignKey':'SubjectId'});db['DeskField'][_0x39a9('0x116')](db[_0x39a9('0xae')],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db['DeskField'][_0x39a9('0x116')](db['DeskField'],{'as':'Field','foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xae')][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db['ZohoAccount']['hasMany'](db[_0x39a9('0xb1')],{'as':'Configurations','onDelete':_0x39a9('0x113'),'foreignKey':'AccountId'});db[_0x39a9('0xb1')][_0x39a9('0x116')](db[_0x39a9('0xb2')],{'as':_0x39a9('0x1cd'),'onDelete':_0x39a9('0x113'),'foreignKey':'SubjectId'});db[_0x39a9('0xb1')][_0x39a9('0x116')](db['ZohoField'],{'as':_0x39a9('0x1d7'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cf')});db['ZohoConfiguration'][_0x39a9('0x116')](db[_0x39a9('0xb2')],{'as':'Fields','onDelete':_0x39a9('0x113'),'foreignKey':'FieldId'});db[_0x39a9('0xb1')][_0x39a9('0x122')](db['ZohoAccount'],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x1cc')});db['ZohoField']['hasMany'](db[_0x39a9('0xb2')],{'as':_0x39a9('0x1d1'),'foreignKey':_0x39a9('0x1ce')});db['ZohoField'][_0x39a9('0x116')](db['ZohoField'],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xb2')][_0x39a9('0x116')](db[_0x39a9('0xb2')],{'as':_0x39a9('0x1d3'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xb2')][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db[_0x39a9('0xb4')][_0x39a9('0x116')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x39a9('0x113'),'foreignKey':'AccountId'});db[_0x39a9('0x1db')][_0x39a9('0x116')](db[_0x39a9('0xb6')],{'as':_0x39a9('0x1cd'),'foreignKey':_0x39a9('0x1ce')});db['ZendeskConfiguration']['hasMany'](db[_0x39a9('0xb6')],{'as':'Descriptions','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0x1db')][_0x39a9('0x116')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x39a9('0x1db')][_0x39a9('0x122')](db[_0x39a9('0xb4')],{'as':_0x39a9('0x17a'),'foreignKey':'AccountId'});db[_0x39a9('0x1db')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x1dc')});db[_0x39a9('0xb6')][_0x39a9('0x116')](db['ZendeskField'],{'as':_0x39a9('0x1d1'),'foreignKey':_0x39a9('0x1ce')});db['ZendeskField'][_0x39a9('0x116')](db[_0x39a9('0xb6')],{'as':'Description','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xb6')][_0x39a9('0x116')](db[_0x39a9('0xb6')],{'as':_0x39a9('0x1d3'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xb6')]['belongsTo'](db['Variable'],{'as':_0x39a9('0x1d4'),'foreignKey':'VariableId'});db['FreshdeskAccount'][_0x39a9('0x116')](db[_0x39a9('0xb9')],{'as':'Configurations','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cc')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x39a9('0x1cd'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xb9')][_0x39a9('0x116')](db[_0x39a9('0xbb')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x39a9('0x1cf')});db['FreshdeskConfiguration']['hasMany'](db[_0x39a9('0xbb')],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xb9')]['belongsTo'](db[_0x39a9('0xb7')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xb9')][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x1dd')});db[_0x39a9('0xbb')][_0x39a9('0x116')](db[_0x39a9('0xbb')],{'as':_0x39a9('0x1d1'),'foreignKey':_0x39a9('0x1ce')});db['FreshdeskField'][_0x39a9('0x116')](db[_0x39a9('0xbb')],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xbb')][_0x39a9('0x116')](db[_0x39a9('0xbb')],{'as':_0x39a9('0x1d3'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xbb')][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db[_0x39a9('0xbd')][_0x39a9('0x116')](db['VtigerConfiguration'],{'as':_0x39a9('0x1d9'),'onDelete':'cascade','foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xbf')][_0x39a9('0x116')](db[_0x39a9('0x1de')],{'as':_0x39a9('0x1cd'),'foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xbf')]['hasMany'](db[_0x39a9('0x1de')],{'as':_0x39a9('0x1d7'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xbf')][_0x39a9('0x116')](db['VtigerField'],{'as':'Fields','foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xbf')]['belongsTo'](db[_0x39a9('0xbd')],{'as':'Account','foreignKey':'AccountId'});db[_0x39a9('0x1de')][_0x39a9('0x116')](db[_0x39a9('0x1de')],{'as':_0x39a9('0x1d1'),'foreignKey':'SubjectId'});db[_0x39a9('0x1de')][_0x39a9('0x116')](db[_0x39a9('0x1de')],{'as':'Description','foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0x1de')][_0x39a9('0x116')](db['VtigerField'],{'as':_0x39a9('0x1d3'),'foreignKey':'FieldId'});db['VtigerField'][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db['ServicenowAccount'][_0x39a9('0x116')](db[_0x39a9('0xc4')],{'as':_0x39a9('0x1d9'),'onDelete':'cascade','foreignKey':_0x39a9('0x1cc')});db['ServicenowConfiguration'][_0x39a9('0x116')](db[_0x39a9('0xc6')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x39a9('0xc4')][_0x39a9('0x116')](db[_0x39a9('0xc6')],{'as':_0x39a9('0x1d7'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xc4')][_0x39a9('0x116')](db['ServicenowField'],{'as':_0x39a9('0x1ca'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xc4')][_0x39a9('0x122')](db[_0x39a9('0xc2')],{'as':'Account','foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xc6')][_0x39a9('0x116')](db[_0x39a9('0xc6')],{'as':'Subject','foreignKey':_0x39a9('0x1ce')});db['ServicenowField'][_0x39a9('0x116')](db['ServicenowField'],{'as':_0x39a9('0x1d2'),'foreignKey':'DescriptionId'});db[_0x39a9('0xc6')][_0x39a9('0x116')](db[_0x39a9('0xc6')],{'as':'Field','foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xc6')][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':'VariableId'});db['Dynamics365Account']['hasMany'](db[_0x39a9('0xc9')],{'as':_0x39a9('0x1d9'),'onDelete':'cascade','foreignKey':_0x39a9('0x1cc')});db['Dynamics365Account'][_0x39a9('0x122')](db[_0x39a9('0x168')],{'as':_0x39a9('0x168'),'foreignKey':_0x39a9('0x16a')});db[_0x39a9('0xc9')][_0x39a9('0x116')](db[_0x39a9('0xcb')],{'as':_0x39a9('0x1cd'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x39a9('0x116')](db['Dynamics365Field'],{'as':_0x39a9('0x1d7'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xc9')][_0x39a9('0x116')](db['Dynamics365Field'],{'as':_0x39a9('0x1ca'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xc9')][_0x39a9('0x122')](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x39a9('0xcb')][_0x39a9('0x116')](db['Dynamics365Field'],{'as':_0x39a9('0x1d1'),'foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xcb')][_0x39a9('0x116')](db[_0x39a9('0xcb')],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xcb')][_0x39a9('0x116')](db[_0x39a9('0xcb')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db[_0x39a9('0x1d4')],{'as':'Variable','foreignKey':_0x39a9('0x1d5')});db[_0x39a9('0x1df')]['hasMany'](db[_0x39a9('0xce')],{'as':_0x39a9('0x1d9'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1cc')});db[_0x39a9('0xce')][_0x39a9('0x116')](db['FreshsalesField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x39a9('0xce')][_0x39a9('0x116')](db['FreshsalesField'],{'as':_0x39a9('0x1d7'),'foreignKey':_0x39a9('0x1cf')});db['FreshsalesConfiguration'][_0x39a9('0x116')](db[_0x39a9('0xd0')],{'as':_0x39a9('0x1ca'),'foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xce')]['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x39a9('0xd0')][_0x39a9('0x116')](db[_0x39a9('0xd0')],{'as':'Subject','foreignKey':_0x39a9('0x1ce')});db[_0x39a9('0xd0')][_0x39a9('0x116')](db[_0x39a9('0xd0')],{'as':_0x39a9('0x1d2'),'foreignKey':_0x39a9('0x1cf')});db[_0x39a9('0xd0')][_0x39a9('0x116')](db[_0x39a9('0xd0')],{'as':'Field','foreignKey':_0x39a9('0x1d0')});db[_0x39a9('0xd0')][_0x39a9('0x122')](db[_0x39a9('0x1d4')],{'as':_0x39a9('0x1d4'),'foreignKey':_0x39a9('0x1d5')});db[_0x39a9('0x1e0')][_0x39a9('0x122')](db[_0x39a9('0x5c')],{});db[_0x39a9('0x1e0')]['belongsTo'](db[_0x39a9('0xf8')],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0x1e0')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db['ChatQueueReport']['belongsTo'](db[_0x39a9('0x61')],{});db['ChatQueueReport'][_0x39a9('0x122')](db['ChatMessage'],{});db[_0x39a9('0x1e0')][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db[_0x39a9('0x1e0')]['belongsTo'](db[_0x39a9('0x66')],{});db[_0x39a9('0xd4')]['belongsTo'](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x113'),'foreignKey':'FromId'});db[_0x39a9('0xd4')][_0x39a9('0x122')](db['User'],{'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x1e1')});db[_0x39a9('0x1a3')][_0x39a9('0x116')](db[_0x39a9('0xd7')],{'foreignKey':_0x39a9('0x1e2'),'onDelete':'cascade'});db[_0x39a9('0x1a3')][_0x39a9('0x116')](db[_0x39a9('0x1e3')],{'foreignKey':'SessionId','onDelete':_0x39a9('0x113')});db[_0x39a9('0xd9')][_0x39a9('0x122')](db[_0x39a9('0x4c')],{});db[_0x39a9('0xd9')]['belongsTo'](db[_0x39a9('0xf8')],{'as':'List','foreignKey':_0x39a9('0x18a')});db[_0x39a9('0xd9')][_0x39a9('0x122')](db['CmContact'],{'as':_0x39a9('0x164'),'foreignKey':'ContactId'});db[_0x39a9('0xd9')]['belongsTo'](db['SmsInteraction'],{});db[_0x39a9('0xd9')][_0x39a9('0x122')](db[_0x39a9('0x52')],{});db[_0x39a9('0xd9')][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db[_0x39a9('0xd9')]['belongsTo'](db[_0x39a9('0x135')],{});db['JscriptyProject'][_0x39a9('0x116')](db[_0x39a9('0x1a3')],{'foreignKey':_0x39a9('0x1e4')});db[_0x39a9('0x1e5')][_0x39a9('0x116')](db['JscriptyQuestionReport'],{'foreignKey':_0x39a9('0x1e4')});db[_0x39a9('0x1e5')][_0x39a9('0x116')](db[_0x39a9('0x1e3')],{'foreignKey':_0x39a9('0x1e4')});db[_0x39a9('0x145')][_0x39a9('0x124')](db['User'],{'as':_0x39a9('0x176'),'through':_0x39a9('0x147')});db[_0x39a9('0xe7')]['belongsToMany'](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x12b')});db[_0x39a9('0xe7')][_0x39a9('0x124')](db[_0x39a9('0x1c')],{'through':_0x39a9('0x15a'),'as':_0x39a9('0x1e6')});db[_0x39a9('0xe7')][_0x39a9('0x124')](db[_0x39a9('0x131')],{'through':_0x39a9('0x171'),'as':_0x39a9('0x132')});db['Team'][_0x39a9('0x124')](db[_0x39a9('0x66')],{'through':_0x39a9('0x19d'),'as':'ChatQueues'});db[_0x39a9('0xe7')][_0x39a9('0x124')](db[_0x39a9('0x49')],{'through':_0x39a9('0x188'),'as':_0x39a9('0x134')});db['Team']['belongsToMany'](db[_0x39a9('0x135')],{'through':'team_has_sms_queues','as':_0x39a9('0x136')});db[_0x39a9('0xe7')][_0x39a9('0x124')](db['OpenchannelQueue'],{'through':_0x39a9('0x193'),'as':_0x39a9('0x138')});db[_0x39a9('0xe7')][_0x39a9('0x124')](db[_0x39a9('0x109')],{'through':_0x39a9('0x1e7'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0x39a9('0x10c'),'as':_0x39a9('0x130')});db[_0x39a9('0x1ab')][_0x39a9('0x116')](db[_0x39a9('0x6d')],{'as':_0x39a9('0x14e'),'foreignKey':'CampaignId'});db[_0x39a9('0x1ab')][_0x39a9('0x116')](db[_0x39a9('0x14f')],{'as':_0x39a9('0x11a'),'foreignKey':_0x39a9('0x1ad')});db[_0x39a9('0x1ab')][_0x39a9('0x116')](db[_0x39a9('0x70')],{'as':_0x39a9('0x150'),'foreignKey':_0x39a9('0x1ad')});db[_0x39a9('0x1ab')]['hasMany'](db[_0x39a9('0x151')],{'as':'HopperBlacks','foreignKey':_0x39a9('0x1ad')});db['Campaign'][_0x39a9('0x122')](db[_0x39a9('0x27')],{'as':_0x39a9('0x27'),'foreignKey':_0x39a9('0x154')});db[_0x39a9('0x1ab')][_0x39a9('0x122')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x39a9('0x1e8')});db[_0x39a9('0x1ab')][_0x39a9('0x122')](db[_0x39a9('0x7e')],{'as':_0x39a9('0x7e'),'foreignKey':_0x39a9('0x156')});db[_0x39a9('0x1ab')]['belongsTo'](db['SquareProject'],{'as':_0x39a9('0x145'),'foreignKey':_0x39a9('0x1e9')});db[_0x39a9('0x1ab')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x39a9('0x1ea')});db[_0x39a9('0x1ab')][_0x39a9('0x124')](db[_0x39a9('0xf8')],{'as':_0x39a9('0x15b'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x39a9('0x122')](db['ChatOfflineMessage'],{'as':_0x39a9('0x64'),'foreignKey':_0x39a9('0x17b')});db['MailTransferReport']['belongsTo'](db[_0x39a9('0x3c')],{});db[_0x39a9('0xf0')]['belongsTo'](db[_0x39a9('0x11f')],{});db['MailTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x37')],{'foreignKey':_0x39a9('0x1eb'),'as':_0x39a9('0x1ec')});db[_0x39a9('0xf0')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':'FromUserId','as':_0x39a9('0x1ed')});db[_0x39a9('0xf0')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':'ToUserId','as':_0x39a9('0x1ee')});db['MailTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x131')],{'foreignKey':_0x39a9('0x1ef'),'as':_0x39a9('0x1f0')});db[_0x39a9('0xf0')][_0x39a9('0x122')](db[_0x39a9('0x37')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x39a9('0xf1')][_0x39a9('0x122')](db[_0x39a9('0x196')],{});db['ChatTransferReport'][_0x39a9('0x122')](db['ChatInteraction'],{});db[_0x39a9('0xf1')]['belongsTo'](db[_0x39a9('0x5c')],{'foreignKey':_0x39a9('0x1f1'),'as':_0x39a9('0x1ec')});db[_0x39a9('0xf1')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':_0x39a9('0x1f2'),'as':_0x39a9('0x1ed')});db[_0x39a9('0xf1')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':_0x39a9('0x1f3'),'as':_0x39a9('0x1ee')});db[_0x39a9('0xf1')][_0x39a9('0x122')](db[_0x39a9('0x66')],{'foreignKey':_0x39a9('0x1f4'),'as':_0x39a9('0x1f0')});db[_0x39a9('0xf1')]['belongsTo'](db[_0x39a9('0x5c')],{'foreignKey':_0x39a9('0x1f5'),'as':'ToAccount'});db[_0x39a9('0xf3')]['belongsTo'](db[_0x39a9('0x48')],{});db['FaxTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x46')],{});db['FaxTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x42')],{'foreignKey':_0x39a9('0x1f6'),'as':'FromAccount'});db[_0x39a9('0xf3')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':_0x39a9('0x1f2'),'as':'FromAgent'});db[_0x39a9('0xf3')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':_0x39a9('0x1f3'),'as':_0x39a9('0x1ee')});db[_0x39a9('0xf3')][_0x39a9('0x122')](db['FaxQueue'],{'foreignKey':_0x39a9('0x1f7'),'as':_0x39a9('0x1f0')});db['FaxTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x42')],{'foreignKey':_0x39a9('0x1f8'),'as':_0x39a9('0x1f9')});db[_0x39a9('0xf5')][_0x39a9('0x122')](db['OpenchannelMessage'],{});db[_0x39a9('0xf5')][_0x39a9('0x122')](db[_0x39a9('0x58')],{});db[_0x39a9('0xf5')][_0x39a9('0x122')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x39a9('0x1ec')});db[_0x39a9('0xf5')][_0x39a9('0x122')](db['User'],{'foreignKey':_0x39a9('0x1f2'),'as':_0x39a9('0x1ed')});db[_0x39a9('0xf5')]['belongsTo'](db[_0x39a9('0x12')],{'foreignKey':_0x39a9('0x1f3'),'as':_0x39a9('0x1ee')});db['OpenchannelTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x137')],{'foreignKey':_0x39a9('0x1fa'),'as':_0x39a9('0x1f0')});db['OpenchannelTransferReport']['belongsTo'](db[_0x39a9('0x54')],{'foreignKey':_0x39a9('0x1fb'),'as':_0x39a9('0x1f9')});db[_0x39a9('0xf7')][_0x39a9('0x122')](db[_0x39a9('0x52')],{});db['SmsTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x50')],{});db['SmsTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x4c')],{'foreignKey':_0x39a9('0x1fc'),'as':'FromAccount'});db['SmsTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':'FromUserId','as':_0x39a9('0x1ed')});db['SmsTransferReport'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'foreignKey':'ToUserId','as':_0x39a9('0x1ee')});db[_0x39a9('0xf7')][_0x39a9('0x122')](db[_0x39a9('0x135')],{'foreignKey':_0x39a9('0x1fd'),'as':_0x39a9('0x1f0')});db[_0x39a9('0xf7')][_0x39a9('0x122')](db['SmsAccount'],{'foreignKey':_0x39a9('0x1fe'),'as':_0x39a9('0x1f9')});db[_0x39a9('0xf8')]['hasMany'](db[_0x39a9('0x7a')],{'as':_0x39a9('0x16d'),'foreignKey':_0x39a9('0x18a'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0xf8')][_0x39a9('0x116')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0x39a9('0xf8')]['hasMany'](db[_0x39a9('0x6c')],{'as':_0x39a9('0x127'),'onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0xf8')]['hasMany'](db[_0x39a9('0x14f')],{'as':_0x39a9('0x11a'),'foreignKey':_0x39a9('0x18a')});db['CmList'][_0x39a9('0x116')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x39a9('0x18a')});db['CmList'][_0x39a9('0x116')](db['ReportAgentPreview'],{'as':_0x39a9('0x72'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0xf8')][_0x39a9('0x124')](db[_0x39a9('0x1c')],{'as':_0x39a9('0x1ff'),'through':_0x39a9('0x200')});db[_0x39a9('0xf8')][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':'cm_user_has_lists'});db[_0x39a9('0xf9')][_0x39a9('0x116')](db[_0x39a9('0x18')],{'as':_0x39a9('0x119'),'onDelete':_0x39a9('0x113')});db['VoicePrefix'][_0x39a9('0x124')](db['User'],{'as':_0x39a9('0x158'),'through':_0x39a9('0x10e')});db['VoicePrefix'][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x10c'),'as':_0x39a9('0x159')});db[_0x39a9('0xfb')][_0x39a9('0x116')](db[_0x39a9('0x12')],{'as':_0x39a9('0x176'),'foreignKey':'userProfileId'});db[_0x39a9('0xfb')]['hasMany'](db[_0x39a9('0xfc')],{'as':_0x39a9('0x201'),'foreignKey':'userProfileId','onDelete':_0x39a9('0x113')});db[_0x39a9('0xfc')][_0x39a9('0x116')](db[_0x39a9('0xfe')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x39a9('0x113')});db[_0x39a9('0x142')]['hasMany'](db[_0x39a9('0x7a')],{'as':'Dispositions','foreignKey':_0x39a9('0x202'),'onDelete':_0x39a9('0x113')});db[_0x39a9('0x142')][_0x39a9('0x116')](db[_0x39a9('0x78')],{'as':_0x39a9('0x16e'),'foreignKey':_0x39a9('0x202')});db[_0x39a9('0x142')][_0x39a9('0x116')](db[_0x39a9('0x104')],{'as':_0x39a9('0x15c'),'foreignKey':'WhatsappAccountId'});db[_0x39a9('0x142')]['hasMany'](db[_0x39a9('0x102')],{'as':_0x39a9('0x181')});db[_0x39a9('0x142')][_0x39a9('0x116')](db[_0x39a9('0x203')],{'as':_0x39a9('0x14a')});db[_0x39a9('0x142')]['belongsTo'](db['CmList'],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0x142')][_0x39a9('0x122')](db['Pause'],{'as':_0x39a9('0x18b'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x39a9('0x124')](db['User'],{'as':_0x39a9('0x158'),'through':_0x39a9('0x144')});db[_0x39a9('0x203')]['belongsTo'](db[_0x39a9('0x12')],{'onDelete':_0x39a9('0x169')});db[_0x39a9('0x203')][_0x39a9('0x122')](db[_0x39a9('0x109')],{'onDelete':'restrict'});db[_0x39a9('0x203')][_0x39a9('0x122')](db[_0x39a9('0x142')],{'onDelete':'restrict'});db[_0x39a9('0x203')][_0x39a9('0x122')](db[_0x39a9('0x7e')],{'onDelete':_0x39a9('0x169'),'foreignKey':_0x39a9('0x156')});db[_0x39a9('0x203')][_0x39a9('0x122')](db[_0x39a9('0x87')],{'onDelete':_0x39a9('0x169'),'foreignKey':'TagId'});db[_0x39a9('0x102')]['hasMany'](db[_0x39a9('0x104')],{'as':'Messages','onDelete':_0x39a9('0x113'),'foreignKey':_0x39a9('0x204')});db[_0x39a9('0x102')][_0x39a9('0x122')](db[_0x39a9('0x142')],{'as':_0x39a9('0x17a'),'foreignKey':_0x39a9('0x202')});db[_0x39a9('0x102')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':'ContactId'});db[_0x39a9('0x102')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x173'),'foreignKey':_0x39a9('0x114')});db[_0x39a9('0x102')]['belongsToMany'](db[_0x39a9('0x87')],{'through':_0x39a9('0x1be'),'as':'Tags'});db['WhatsappInteraction'][_0x39a9('0x124')](db[_0x39a9('0x87')],{'through':_0x39a9('0x1be'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x39a9('0x124')](db['User'],{'as':_0x39a9('0x176'),'through':_0x39a9('0x12f'),'foreignKey':_0x39a9('0x204')});db['WhatsappMessage'][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x12')});db[_0x39a9('0x104')]['belongsTo'](db[_0x39a9('0x6c')],{'onDelete':_0x39a9('0x113'),'as':_0x39a9('0x164')});db[_0x39a9('0x104')][_0x39a9('0x122')](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x39a9('0x204')});db[_0x39a9('0x104')][_0x39a9('0x122')](db[_0x39a9('0x142')],{'as':_0x39a9('0x17a'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport'][_0x39a9('0x122')](db['WhatsappAccount'],{});db['WhatsappQueueReport'][_0x39a9('0x122')](db[_0x39a9('0xf8')],{'as':_0x39a9('0x16f'),'foreignKey':_0x39a9('0x18a')});db[_0x39a9('0x106')][_0x39a9('0x122')](db[_0x39a9('0x6c')],{'as':_0x39a9('0x164'),'foreignKey':_0x39a9('0x165')});db[_0x39a9('0x106')]['belongsTo'](db[_0x39a9('0x102')],{});db[_0x39a9('0x106')][_0x39a9('0x122')](db[_0x39a9('0x109')],{});db[_0x39a9('0x106')]['belongsTo'](db[_0x39a9('0x104')],{});db[_0x39a9('0x106')][_0x39a9('0x122')](db[_0x39a9('0x12')],{});db[_0x39a9('0x108')][_0x39a9('0x122')](db['WhatsappMessage'],{});db[_0x39a9('0x108')][_0x39a9('0x122')](db['WhatsappInteraction'],{});db[_0x39a9('0x108')][_0x39a9('0x122')](db[_0x39a9('0x142')],{'foreignKey':_0x39a9('0x205'),'as':_0x39a9('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db[_0x39a9('0x142')],{'foreignKey':_0x39a9('0x206'),'as':_0x39a9('0x1f9')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x39a9('0x207'),'as':_0x39a9('0x1f0')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x39a9('0x1ed')});db[_0x39a9('0x108')][_0x39a9('0x122')](db['User'],{'foreignKey':'ToUserId','as':_0x39a9('0x1ee')});db['WhatsappQueue'][_0x39a9('0x124')](db[_0x39a9('0x12')],{'as':_0x39a9('0x158'),'through':_0x39a9('0x33'),'foreignKey':_0x39a9('0x208')});db[_0x39a9('0x109')][_0x39a9('0x124')](db[_0x39a9('0xe7')],{'through':_0x39a9('0x1e7'),'as':_0x39a9('0x159')});db[_0x39a9('0x10f')][_0x39a9('0x122')](db[_0x39a9('0x12')],{'as':_0x39a9('0x209'),'foreignKey':'UserId','onDelete':_0x39a9('0x113'),'hooks':!![]});db[_0x39a9('0x168')][_0x39a9('0x111')](db['Dynamics365Account'],{'as':_0x39a9('0xc7'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x168')][_0x39a9('0x111')](db[_0x39a9('0x167')],{'as':_0x39a9('0x16b'),'onDelete':_0x39a9('0x169')});db[_0x39a9('0x168')][_0x39a9('0x111')](db[_0x39a9('0x35')],{'as':_0x39a9('0x16c'),'onDelete':_0x39a9('0x169')});module[_0x39a9('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x49a1=['../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','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','cascade','UserId','hasOne','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','CmList','Team','MailInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','VoicePrefixes','MailQueues','FaxQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','VoiceContext','Applications','Sound','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','Interval','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','UserVoiceQueue','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','mailboxuser','VoiceQueueReport','uniqueid','Contact','ContactId','CloudProviderId','restrict','Dispositions','Answers','MailAccountId','ListId','Template','TemplateId','mandatoryDispositionPauseId','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatWebsiteId','TagId','MailQueueReport','List','Items','Disposition','FaxAccountId','Interactions','Exntensions','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','SmsAccountId','IntervalId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','UserOpenchannelQueue','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Phones','CmContactId','Hoppers','CmHopperFinal','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','OneAny','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','Hopper','AllConditions','TriggerAllId','AnyConditions','AnyCondition','Fields','MetricId','Configurations','AccountId','SubjectId','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','Subjects','Descriptions','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Account','FreshsalesAccount','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','JscriptyAnswerReport','ProjectId','user_has_teams','ChatQueues','team_has_fax_queues','team_has_openchannel_queues','WhatsappQueue','team_has_whatsapp_queues','TeamVoicePrefix','TrunkBackup','TrunkBackupId','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','FromUserId','FromAgent','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FromAccount','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappQueueReport','FromWhatsappAccountId','WhatsappQueueId','UserSetting','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','defaultsDeep','sequelizeHistory','name','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/disposition/disposition.model','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/template/template.model','Trigger','Integration','../api/integration/integration.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model'];(function(_0x3bfdb0,_0x30de35){var _0x7c3113=function(_0x11fa22){while(--_0x11fa22){_0x3bfdb0['push'](_0x3bfdb0['shift']());}};_0x7c3113(++_0x30de35);}(_0x49a1,0x15b));var _0x149a=function(_0x4fdfbe,_0x198a28){_0x4fdfbe=_0x4fdfbe-0x0;var _0x585ad8=_0x49a1[_0x4fdfbe];return _0x585ad8;};'use strict';var config=require(_0x149a('0x0'));var Sequelize=require(_0x149a('0x1'));var _=require(_0x149a('0x2'));var jstz=require('jstz');var timezone=jstz[_0x149a('0x3')]();config[_0x149a('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x149a('0x4'),'username':_0x149a('0x5'),'password':_0x149a('0x6'),'options':{'host':_0x149a('0x7'),'port':0xcea,'dialect':_0x149a('0x8'),'dialectOptions':{'charset':_0x149a('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x149a('0xa'),'collate':_0x149a('0xb')}}});config['sequelizeHistory']=_[_0x149a('0xc')](config[_0x149a('0xd')],{'database':_0x149a('0x4'),'username':_0x149a('0x5'),'password':_0x149a('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x149a('0x8'),'dialectOptions':{'charset':_0x149a('0x9')},'logging':![],'timezone':timezone[_0x149a('0xe')](),'define':{'charset':_0x149a('0xa'),'collate':_0x149a('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x149a('0xf')],config[_0x149a('0x1')]['username'],config[_0x149a('0x1')]['password'],config[_0x149a('0x1')][_0x149a('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x149a('0xd')][_0x149a('0xf')],config['sequelizeHistory'][_0x149a('0x11')],config[_0x149a('0xd')][_0x149a('0x12')],config[_0x149a('0xd')]['options'])};db[_0x149a('0x13')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x15'));db[_0x149a('0x16')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x17'));db['VoiceContext']=db['sequelize']['import'](_0x149a('0x18'));db['VoiceExtension']=db[_0x149a('0x1')]['import'](_0x149a('0x19'));db[_0x149a('0x1a')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x1b'));db[_0x149a('0x1c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x1d'));db[_0x149a('0x1e')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x149a('0x1f')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/screenRecording/screenRecording.model');db[_0x149a('0x20')]=db[_0x149a('0x1')]['import'](_0x149a('0x21'));db['VoiceMailMessage']=db['sequelize'][_0x149a('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x149a('0x22')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x23'));db[_0x149a('0x24')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x25'));db[_0x149a('0x26')]=db['sequelize']['import'](_0x149a('0x27'));db['VoiceQueueReport']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x28'));db[_0x149a('0x29')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x2a'));db[_0x149a('0x2b')]=db['sequelize']['import'](_0x149a('0x2c'));db['VoiceTransferReport']=db[_0x149a('0x1')][_0x149a('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x149a('0x2d')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x2e'));db['UserVoiceQueue']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x2f'));db[_0x149a('0x30')]=db[_0x149a('0x1')]['import'](_0x149a('0x31'));db[_0x149a('0x32')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x33'));db[_0x149a('0x34')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x35'));db['UserSmsQueue']=db[_0x149a('0x1')]['import'](_0x149a('0x36'));db['UserOpenchannelQueue']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x37'));db[_0x149a('0x38')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x39'));db[_0x149a('0x3a')]=db['sequelize']['import'](_0x149a('0x3b'));db[_0x149a('0x3c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x3d'));db[_0x149a('0x3e')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x3f'));db[_0x149a('0x40')]=db[_0x149a('0x1')]['import'](_0x149a('0x41'));db[_0x149a('0x42')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x149a('0x43')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x44'));db[_0x149a('0x45')]=db['sequelize']['import']('../api/mailMessage/mailMessage.model');db[_0x149a('0x46')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x47'));db['MailQueueReport']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x48'));db[_0x149a('0x49')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x4a'));db[_0x149a('0x4b')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0x149a('0x4c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x4d'));db['FaxApplication']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x4e'));db[_0x149a('0x4f')]=db['sequelize']['import'](_0x149a('0x50'));db[_0x149a('0x51')]=db[_0x149a('0x1')]['import'](_0x149a('0x52'));db['FaxQueue']=db['sequelize'][_0x149a('0x14')]('../api/faxQueue/faxQueue.model');db[_0x149a('0x53')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x54'));db['SmsAccount']=db['sequelize'][_0x149a('0x14')](_0x149a('0x55'));db[_0x149a('0x56')]=db['sequelize']['import'](_0x149a('0x57'));db[_0x149a('0x58')]=db[_0x149a('0x1')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x149a('0x59')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x5a'));db[_0x149a('0x5b')]=db['sequelize']['import'](_0x149a('0x5c'));db[_0x149a('0x5d')]=db[_0x149a('0x1')]['import'](_0x149a('0x5e'));db[_0x149a('0x5f')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x60'));db[_0x149a('0x61')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize']['import'](_0x149a('0x62'));db['OpenchannelQueue']=db['sequelize'][_0x149a('0x14')](_0x149a('0x63'));db[_0x149a('0x64')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x65'));db[_0x149a('0x66')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x67'));db[_0x149a('0x68')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x69'));db[_0x149a('0x6a')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x6b'));db[_0x149a('0x6c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x6d'));db[_0x149a('0x6e')]=db['sequelize']['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x149a('0x6f')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x70'));db[_0x149a('0x71')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x72'));db[_0x149a('0x73')]=db[_0x149a('0x1')]['import'](_0x149a('0x74'));db[_0x149a('0x75')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x76'));db['CmContact']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x77'));db[_0x149a('0x78')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x79'));db[_0x149a('0x7a')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x7b'));db[_0x149a('0x7c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x7d'));db['ReportAgentPreview']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x7e'));db[_0x149a('0x7f')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x80'));db['Action']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x81'));db[_0x149a('0x82')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x83'));db[_0x149a('0x84')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0x149a('0x1')]['import'](_0x149a('0x85'));db['Condition']=db[_0x149a('0x1')]['import'](_0x149a('0x86'));db['Interval']=db[_0x149a('0x1')][_0x149a('0x14')]('../api/interval/interval.model');db[_0x149a('0x87')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x88'));db[_0x149a('0x89')]=db[_0x149a('0x1')]['import'](_0x149a('0x8a'));db[_0x149a('0x8b')]=db[_0x149a('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x149a('0x8c')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x8d'));db['Sound']=db[_0x149a('0x1')][_0x149a('0x14')]('../api/sound/sound.model');db[_0x149a('0x8e')]=db[_0x149a('0x1')]['import']('../api/tag/tag.model');db[_0x149a('0x8f')]=db[_0x149a('0x1')]['import']('../api/contactItemType/contactItemType.model');db[_0x149a('0x90')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x91'));db['CmHopperAdditionalPhone']=db[_0x149a('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x92'));db[_0x149a('0x93')]=db[_0x149a('0x1')]['import']('../api/trigger/trigger.model');db['Variable']=db[_0x149a('0x1')]['import']('../api/variable/variable.model');db[_0x149a('0x94')]=db[_0x149a('0x1')]['import'](_0x149a('0x95'));db['IntegrationReport']=db[_0x149a('0x1')]['import']('../api/integrationReport/integrationReport.model');db[_0x149a('0x96')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x149a('0x97')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x98'));db['AnalyticExtractedReport']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x99'));db[_0x149a('0x9a')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0x149a('0x9b')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x9c'));db['AnalyticTreeReport']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x9d'));db[_0x149a('0x9e')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x9f'));db[_0x149a('0xa0')]=db[_0x149a('0x1')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x149a('0xa1')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xa2'));db[_0x149a('0xa3')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xa4'));db[_0x149a('0xa5')]=db[_0x149a('0x1')]['import'](_0x149a('0xa6'));db[_0x149a('0xa7')]=db['sequelize'][_0x149a('0x14')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x149a('0xa8')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xa9'));db[_0x149a('0xaa')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xab'));db[_0x149a('0xac')]=db[_0x149a('0x1')]['import'](_0x149a('0xad'));db[_0x149a('0xae')]=db['sequelize'][_0x149a('0x14')](_0x149a('0xaf'));db[_0x149a('0xb0')]=db[_0x149a('0x1')]['import'](_0x149a('0xb1'));db['ZohoField']=db[_0x149a('0x1')]['import'](_0x149a('0xb2'));db['ZendeskAccount']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xb3'));db[_0x149a('0xb4')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xb5'));db[_0x149a('0xb6')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xb7'));db[_0x149a('0xb8')]=db['sequelize'][_0x149a('0x14')](_0x149a('0xb9'));db['FreshdeskConfiguration']=db['sequelize'][_0x149a('0x14')](_0x149a('0xba'));db['FreshdeskField']=db[_0x149a('0x1')]['import'](_0x149a('0xbb'));db['VtigerAccount']=db[_0x149a('0x1')]['import'](_0x149a('0xbc'));db[_0x149a('0xbd')]=db[_0x149a('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x149a('0xbe')]=db['sequelize']['import'](_0x149a('0xbf'));db[_0x149a('0xc0')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xc1'));db[_0x149a('0xc2')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x149a('0xc3')]=db[_0x149a('0x1')]['import'](_0x149a('0xc4'));db['Dynamics365Account']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xc5'));db[_0x149a('0xc6')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xc7'));db[_0x149a('0xc8')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xc9'));db['FreshsalesAccount']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xca'));db[_0x149a('0xcb')]=db['sequelize'][_0x149a('0x14')](_0x149a('0xcc'));db['FreshsalesField']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xcd'));db['Integration']=db[_0x149a('0x1')]['import'](_0x149a('0x95'));db[_0x149a('0xce')]=db['sequelize'][_0x149a('0x14')](_0x149a('0xcf'));db[_0x149a('0xd0')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xd1'));db['ChatInternalMessage']=db[_0x149a('0x1')]['import'](_0x149a('0xd2'));db['JscriptyAnswerReport']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xd3'));db['JscriptyQuestionReport']=db[_0x149a('0x1')][_0x149a('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x149a('0xd4')]=db['sequelize'][_0x149a('0x14')](_0x149a('0xd5'));db[_0x149a('0xd6')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xd7'));db[_0x149a('0xd8')]=db[_0x149a('0x1')]['import'](_0x149a('0xd9'));db[_0x149a('0xda')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xdb'));db[_0x149a('0xdc')]=db[_0x149a('0x1')]['import'](_0x149a('0xdd'));db['Setting']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xde'));db[_0x149a('0xdf')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xe0'));db[_0x149a('0xe1')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xe2'));db[_0x149a('0xe3')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xe4'));db[_0x149a('0xe5')]=db[_0x149a('0x1')][_0x149a('0x14')]('../api/squareMessage/squareMessage.model');db['Team']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xe6'));db['License']=db['sequelize']['import'](_0x149a('0xe7'));db[_0x149a('0xe8')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xe9'));db['Migration']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xea'));db[_0x149a('0xeb')]=db['sequelize'][_0x149a('0x14')]('../api/attachment/attachment.model');db[_0x149a('0xec')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xed'));db[_0x149a('0xee')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xef'));db[_0x149a('0xf0')]=db['sequelize']['import'](_0x149a('0xf1'));db[_0x149a('0xf2')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xf3'));db[_0x149a('0xf4')]=db['sequelize'][_0x149a('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x149a('0xf5')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xf6'));db['CmList']=db['sequelize'][_0x149a('0x14')](_0x149a('0xf7'));db[_0x149a('0xf8')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xf9'));db[_0x149a('0xfa')]=db[_0x149a('0x1')]['import'](_0x149a('0xfb'));db[_0x149a('0xfc')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xfd'));db[_0x149a('0xfe')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0xff'));db[_0x149a('0x100')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x101'));db[_0x149a('0x102')]=db[_0x149a('0x1')]['import'](_0x149a('0x103'));db[_0x149a('0x104')]=db['sequelize']['import'](_0x149a('0x105'));db[_0x149a('0x106')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x107'));db[_0x149a('0x108')]=db['sequelize'][_0x149a('0x14')](_0x149a('0x109'));db['WhatsappQueueReport']=db[_0x149a('0x1')][_0x149a('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x149a('0x10a')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x10b'));db['WhatsappQueue']=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x10c'));db[_0x149a('0x10d')]=db[_0x149a('0x1')]['import'](_0x149a('0x10e'));db[_0x149a('0x10f')]=db[_0x149a('0x1')]['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db['TeamVoicePrefix']=db['sequelize'][_0x149a('0x14')](_0x149a('0x110'));db[_0x149a('0x111')]=db[_0x149a('0x1')][_0x149a('0x14')](_0x149a('0x112'));db['UserSetting']=db['sequelize'][_0x149a('0x14')]('../api/user-setting/user-setting.model');db[_0x149a('0x13')]['hasOne'](db[_0x149a('0x20')],{'as':_0x149a('0x20'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x115')](db['UserSetting'],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x1e')],{'as':_0x149a('0x117'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x2d')],{'as':_0x149a('0x118'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')]['hasMany'](db[_0x149a('0x119')],{'as':_0x149a('0x11a'),'onDelete':'cascade','hooks':!![]});db[_0x149a('0x13')][_0x149a('0x116')](db['CmHopperFinal'],{'as':_0x149a('0x11b'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x7c')],{'as':_0x149a('0x11c'),'foreignKey':_0x149a('0x114')});db['User']['hasMany'](db[_0x149a('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db['OpenchannelInteraction'],{'as':_0x149a('0x11e'),'foreignKey':_0x149a('0x114')});db['User']['hasMany'](db[_0x149a('0x6a')],{'as':_0x149a('0x11f'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x58')],{'as':_0x149a('0x120'),'foreignKey':'UserId'});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x4f')],{'as':'FaxInteractions','foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x43')],{'as':'MailInteractions','foreignKey':_0x149a('0x114')});db['User'][_0x149a('0x116')](db['WhatsappInteraction'],{'as':_0x149a('0x121'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x13')][_0x149a('0x116')](db[_0x149a('0x100')],{'as':_0x149a('0x122'),'foreignKey':_0x149a('0x123')});db[_0x149a('0x13')][_0x149a('0x124')](db[_0x149a('0xfa')],{'as':_0x149a('0xfa'),'foreignKey':_0x149a('0x125')});db[_0x149a('0x13')][_0x149a('0x126')](db['ChatGroup'],{'as':_0x149a('0x127'),'through':_0x149a('0x128')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x129')],{'as':_0x149a('0x12a'),'through':_0x149a('0x12b')});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x12c')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x12d')],{'through':'user_has_teams'});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x43')],{'as':_0x149a('0x12e'),'through':'user_has_mail_interactions'});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x6a')],{'as':_0x149a('0x11f'),'through':_0x149a('0x12f')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x4f')],{'as':_0x149a('0x130'),'through':_0x149a('0x131')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x58')],{'as':_0x149a('0x120'),'through':_0x149a('0x132')});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x61')],{'as':_0x149a('0x11e'),'through':_0x149a('0x133')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x106')],{'as':_0x149a('0x121'),'through':'user_has_whatsapp_interactions'});db[_0x149a('0x13')][_0x149a('0x126')](db['VoiceQueue'],{'as':_0x149a('0x134'),'through':'UserVoiceQueue','required':![]});db[_0x149a('0x13')][_0x149a('0x126')](db['VoicePrefix'],{'as':_0x149a('0x135'),'through':_0x149a('0x111'),'required':![]});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x40')],{'as':_0x149a('0x136'),'through':_0x149a('0x32'),'required':![]});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x6f')],{'as':'ChatQueues','through':_0x149a('0x30'),'required':![],'hooks':!![]});db['User'][_0x149a('0x126')](db[_0x149a('0x137')],{'as':_0x149a('0x138'),'through':_0x149a('0x34'),'required':![]});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x5b')],{'as':_0x149a('0x139'),'through':_0x149a('0x13a'),'required':![]});db['User']['belongsToMany'](db[_0x149a('0x13b')],{'as':_0x149a('0x13c'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0x149a('0x126')](db['WhatsappQueue'],{'as':_0x149a('0x13d'),'through':'UserWhatsappQueue','required':![]});db[_0x149a('0x13')][_0x149a('0x126')](db['CmList'],{'through':_0x149a('0x13e')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x64')],{'as':'ChatWebsites','through':_0x149a('0x13f')});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0x4c')],{'as':_0x149a('0x140'),'through':_0x149a('0x141')});db['User'][_0x149a('0x126')](db['MailAccount'],{'as':_0x149a('0x142'),'through':'user_has_mail_accounts'});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x5d')],{'as':_0x149a('0x143'),'through':_0x149a('0x144')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x145')],{'as':_0x149a('0x146'),'through':_0x149a('0x147')});db[_0x149a('0x13')][_0x149a('0x126')](db[_0x149a('0x102')],{'as':_0x149a('0x148'),'through':_0x149a('0x149')});db[_0x149a('0x13')]['belongsToMany'](db[_0x149a('0xe1')],{'as':_0x149a('0x14a'),'through':_0x149a('0x14b')});db[_0x149a('0x16')][_0x149a('0x116')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x14c')});db[_0x149a('0x14d')][_0x149a('0x116')](db[_0x149a('0x119')],{'onDelete':_0x149a('0x113')});db[_0x149a('0x119')][_0x149a('0x116')](db[_0x149a('0x119')],{'as':_0x149a('0x14e'),'onDelete':_0x149a('0x113')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x149a('0x14f')],{'as':'Sounds','through':_0x149a('0x150')});db['VoiceQueue'][_0x149a('0x116')](db[_0x149a('0x2d')],{'as':_0x149a('0x151'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')][_0x149a('0x116')](db[_0x149a('0x78')],{'as':'Hoppers','foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')]['hasMany'](db['CmHopperFinal'],{'as':_0x149a('0x11b'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')][_0x149a('0x116')](db[_0x149a('0x7c')],{'as':_0x149a('0x153'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')][_0x149a('0x116')](db[_0x149a('0x11d')],{'as':_0x149a('0x11d'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')]['hasMany'](db[_0x149a('0x7a')],{'as':_0x149a('0x154'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')][_0x149a('0x116')](db[_0x149a('0xd4')],{'as':_0x149a('0x155'),'foreignKey':_0x149a('0x152')});db[_0x149a('0x1c')][_0x149a('0x124')](db[_0x149a('0x2b')],{'as':_0x149a('0x2b'),'foreignKey':_0x149a('0x156')});db[_0x149a('0x1c')][_0x149a('0x124')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x149a('0x1c')][_0x149a('0x124')](db[_0x149a('0x157')],{'as':_0x149a('0x157'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0x149a('0x124')](db['Pause'],{'as':_0x149a('0x158'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x149a('0x1c')][_0x149a('0x126')](db[_0x149a('0x12c')],{'as':'Lists','through':_0x149a('0x159')});db[_0x149a('0x1c')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x15b')});db[_0x149a('0x1c')][_0x149a('0x126')](db['Team'],{'as':_0x149a('0x15c'),'through':_0x149a('0x10f')});db[_0x149a('0x1c')][_0x149a('0x126')](db[_0x149a('0x12c')],{'as':_0x149a('0x15d'),'through':_0x149a('0x15e')});db['VoiceRecording'][_0x149a('0x124')](db[_0x149a('0x13')],{'as':_0x149a('0x13'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x1f')][_0x149a('0x124')](db['User'],{'as':'User','foreignKey':_0x149a('0x114')});db['VoiceMail'][_0x149a('0x116')](db[_0x149a('0x15f')],{'as':_0x149a('0x160'),'onDelete':_0x149a('0x113'),'foreignKey':'mailboxuser','sourceKey':_0x149a('0x161')});db[_0x149a('0x15f')][_0x149a('0x124')](db[_0x149a('0x20')],{'foreignKey':_0x149a('0x162'),'targetKey':_0x149a('0x161')});db[_0x149a('0x22')]['hasMany'](db[_0x149a('0x163')],{'as':'QueueCalls','foreignKey':_0x149a('0x164'),'constraints':![]});db['VoiceCallReport'][_0x149a('0x116')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x149a('0x164'),'constraints':![]});db[_0x149a('0x22')]['belongsTo'](db['User'],{'as':_0x149a('0x13'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x22')][_0x149a('0x124')](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x3a')][_0x149a('0x124')](db[_0x149a('0x3e')],{'as':_0x149a('0x3e'),'foreignKey':'MailAccountId'});db['MailServerIn']['belongsTo'](db[_0x149a('0x10d')],{'as':_0x149a('0x10d'),'foreignKey':_0x149a('0x167'),'onDelete':_0x149a('0x168')});db[_0x149a('0x3c')][_0x149a('0x124')](db[_0x149a('0x3e')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x149a('0x3c')][_0x149a('0x124')](db[_0x149a('0x10d')],{'as':_0x149a('0x10d'),'foreignKey':'CloudProviderId','onDelete':_0x149a('0x168')});db['MailAccount'][_0x149a('0x115')](db[_0x149a('0x3a')],{'as':'Imap','onDelete':_0x149a('0x113')});db[_0x149a('0x3e')][_0x149a('0x115')](db[_0x149a('0x3c')],{'as':'Smtp','onDelete':_0x149a('0x113')});db[_0x149a('0x3e')][_0x149a('0x116')](db['Disposition'],{'as':_0x149a('0x169'),'foreignKey':'MailAccountId','onDelete':_0x149a('0x113')});db[_0x149a('0x3e')][_0x149a('0x116')](db[_0x149a('0x84')],{'as':_0x149a('0x16a'),'foreignKey':'MailAccountId'});db[_0x149a('0x3e')]['hasMany'](db[_0x149a('0x45')],{'as':_0x149a('0x160'),'foreignKey':_0x149a('0x16b')});db['MailAccount'][_0x149a('0x116')](db[_0x149a('0x43')],{'as':'Interactions'});db[_0x149a('0x3e')][_0x149a('0x116')](db[_0x149a('0x46')],{'as':_0x149a('0x14e')});db[_0x149a('0x3e')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':'List','foreignKey':_0x149a('0x16c')});db[_0x149a('0x3e')][_0x149a('0x124')](db[_0x149a('0x16d')],{'as':_0x149a('0x16d'),'foreignKey':_0x149a('0x16e')});db[_0x149a('0x3e')][_0x149a('0x124')](db[_0x149a('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x149a('0x16f')});db['MailAccount'][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x170')});db[_0x149a('0x40')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':'UserMailQueue'});db['MailQueue'][_0x149a('0x126')](db[_0x149a('0x12d')],{'through':_0x149a('0x171'),'as':_0x149a('0x15c')});db[_0x149a('0x43')][_0x149a('0x116')](db['MailMessage'],{'as':_0x149a('0x160'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x172')});db[_0x149a('0x43')][_0x149a('0x124')](db[_0x149a('0x3e')],{'as':_0x149a('0x173'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x149a('0x124')](db[_0x149a('0x129')],{'as':'Contact','foreignKey':_0x149a('0x166')});db[_0x149a('0x43')]['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x174'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x43')][_0x149a('0x126')](db['Tag'],{'through':_0x149a('0x175'),'as':_0x149a('0x176')});db[_0x149a('0x43')][_0x149a('0x126')](db['Tag'],{'through':_0x149a('0x175'),'as':_0x149a('0x177')});db[_0x149a('0x43')]['belongsToMany'](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'through':_0x149a('0x179'),'foreignKey':'MailInteractionId'});db[_0x149a('0x45')][_0x149a('0x116')](db[_0x149a('0xeb')],{'as':_0x149a('0x17a'),'onDelete':'cascade'});db[_0x149a('0x45')][_0x149a('0x124')](db[_0x149a('0x13')],{'as':'User'});db[_0x149a('0x45')][_0x149a('0x124')](db[_0x149a('0x129')],{'onDelete':'cascade','as':_0x149a('0x165')});db[_0x149a('0x45')][_0x149a('0x124')](db[_0x149a('0x43')],{'as':'Interaction','foreignKey':_0x149a('0x172')});db[_0x149a('0x45')][_0x149a('0x124')](db[_0x149a('0x3e')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x16b')});db[_0x149a('0x45')][_0x149a('0x124')](db['ChatWebsite'],{'as':_0x149a('0x64'),'foreignKey':_0x149a('0x17b')});db[_0x149a('0x45')][_0x149a('0x124')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0x149a('0x46')]['belongsTo'](db[_0x149a('0x13')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x46')][_0x149a('0x124')](db[_0x149a('0x40')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x46')][_0x149a('0x124')](db[_0x149a('0x3e')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x46')][_0x149a('0x124')](db[_0x149a('0x157')],{'onDelete':_0x149a('0x168'),'foreignKey':'IntervalId'});db[_0x149a('0x46')][_0x149a('0x124')](db[_0x149a('0x8e')],{'onDelete':'restrict','foreignKey':_0x149a('0x17c')});db['MailQueueReport'][_0x149a('0x124')](db[_0x149a('0x3e')],{});db[_0x149a('0x17d')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x17d')][_0x149a('0x124')](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x17d')]['belongsTo'](db['MailInteraction'],{});db[_0x149a('0x17d')]['belongsTo'](db['MailMessage'],{});db[_0x149a('0x17d')]['belongsTo'](db['User'],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x149a('0x49')][_0x149a('0x116')](db[_0x149a('0x4b')],{'as':_0x149a('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0x149a('0x116')](db[_0x149a('0x180')],{'as':'Dispositions','foreignKey':_0x149a('0x181'),'onDelete':'cascade'});db[_0x149a('0x4c')][_0x149a('0x116')](db[_0x149a('0x84')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x149a('0x4c')]['hasMany'](db[_0x149a('0x4f')],{'as':_0x149a('0x182')});db[_0x149a('0x4c')][_0x149a('0x116')](db['FaxApplication'],{'as':'Applications'});db[_0x149a('0x4c')][_0x149a('0x116')](db[_0x149a('0x119')],{'as':_0x149a('0x183'),'onDelete':_0x149a('0x113')});db[_0x149a('0x4c')][_0x149a('0x116')](db['FaxMessage'],{'as':'Messages'});db[_0x149a('0x4c')][_0x149a('0x124')](db[_0x149a('0x2b')],{'as':'Trunk'});db[_0x149a('0x4c')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x4c')][_0x149a('0x124')](db[_0x149a('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x149a('0x16f')});db[_0x149a('0x4c')]['belongsToMany'](db[_0x149a('0x13')],{'as':'Agents','through':_0x149a('0x141')});db[_0x149a('0x184')][_0x149a('0x124')](db[_0x149a('0x13')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x184')][_0x149a('0x124')](db[_0x149a('0x137')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x184')][_0x149a('0x124')](db['FaxAccount'],{'onDelete':_0x149a('0x168')});db[_0x149a('0x184')][_0x149a('0x124')](db[_0x149a('0x8e')],{'onDelete':_0x149a('0x168'),'foreignKey':_0x149a('0x17c')});db['FaxInteraction'][_0x149a('0x116')](db[_0x149a('0x51')],{'as':'Messages','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x185')});db['FaxInteraction'][_0x149a('0x124')](db[_0x149a('0x4c')],{'as':'Account','foreignKey':_0x149a('0x181')});db[_0x149a('0x4f')]['belongsTo'](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':'ContactId'});db[_0x149a('0x4f')][_0x149a('0x124')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x149a('0x4f')]['belongsToMany'](db[_0x149a('0x8e')],{'through':_0x149a('0x186'),'as':_0x149a('0x176')});db['FaxInteraction'][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x186'),'as':_0x149a('0x177')});db[_0x149a('0x4f')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0x149a('0x185')});db[_0x149a('0x51')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x149a('0x13')});db[_0x149a('0x51')][_0x149a('0x124')](db['FaxInteraction'],{'as':_0x149a('0x187'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x149a('0x124')](db[_0x149a('0x129')],{'onDelete':_0x149a('0x113'),'as':'Contact'});db[_0x149a('0x51')][_0x149a('0x124')](db['Attachment'],{'as':_0x149a('0xeb'),'foreignKey':_0x149a('0x188')});db[_0x149a('0x51')]['belongsTo'](db[_0x149a('0x4c')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x181')});db[_0x149a('0x137')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x34')});db[_0x149a('0x137')][_0x149a('0x126')](db['Team'],{'through':'team_has_fax_queues','as':_0x149a('0x15c')});db['FaxQueueReport']['belongsTo'](db[_0x149a('0x4c')],{});db['FaxQueueReport'][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x53')]['belongsTo'](db[_0x149a('0x129')],{'as':'Contact','foreignKey':_0x149a('0x166')});db[_0x149a('0x53')][_0x149a('0x124')](db[_0x149a('0x4f')],{});db[_0x149a('0x53')][_0x149a('0x124')](db[_0x149a('0x51')],{});db[_0x149a('0x53')][_0x149a('0x124')](db[_0x149a('0x13')],{});db[_0x149a('0x53')][_0x149a('0x124')](db[_0x149a('0x137')],{});db[_0x149a('0x145')][_0x149a('0x116')](db[_0x149a('0x180')],{'as':_0x149a('0x169'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x149a('0x145')]['hasMany'](db[_0x149a('0x84')],{'as':_0x149a('0x16a'),'foreignKey':_0x149a('0x189')});db[_0x149a('0x145')][_0x149a('0x116')](db[_0x149a('0x59')],{'as':_0x149a('0x160'),'foreignKey':_0x149a('0x189')});db[_0x149a('0x145')][_0x149a('0x116')](db[_0x149a('0x58')],{'as':_0x149a('0x182')});db['SmsAccount']['hasMany'](db[_0x149a('0x56')],{'as':_0x149a('0x14e')});db['SmsAccount'][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x145')][_0x149a('0x124')](db[_0x149a('0x87')],{'as':_0x149a('0x158'),'foreignKey':_0x149a('0x16f')});db[_0x149a('0x145')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x147')});db['SmsApplication']['belongsTo'](db[_0x149a('0x13')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x56')][_0x149a('0x124')](db[_0x149a('0x5b')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x56')][_0x149a('0x124')](db[_0x149a('0x145')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x56')]['belongsTo'](db[_0x149a('0x157')],{'onDelete':_0x149a('0x168'),'foreignKey':_0x149a('0x18a')});db[_0x149a('0x56')][_0x149a('0x124')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x149a('0x17c')});db[_0x149a('0x58')]['hasMany'](db[_0x149a('0x59')],{'as':'Messages','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x18b')});db['SmsInteraction'][_0x149a('0x124')](db[_0x149a('0x145')],{'as':_0x149a('0x173'),'foreignKey':'SmsAccountId'});db[_0x149a('0x58')][_0x149a('0x124')](db[_0x149a('0x129')],{'as':'Contact','foreignKey':_0x149a('0x166')});db[_0x149a('0x58')][_0x149a('0x124')](db['User'],{'as':_0x149a('0x174'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x58')][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x18c'),'as':_0x149a('0x176')});db[_0x149a('0x58')][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x18c'),'as':_0x149a('0x177')});db[_0x149a('0x58')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'through':_0x149a('0x132'),'foreignKey':'SmsInteractionId'});db[_0x149a('0x59')]['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x13')});db[_0x149a('0x59')]['belongsTo'](db[_0x149a('0x129')],{'onDelete':'cascade','as':'Contact'});db['SmsMessage']['belongsTo'](db[_0x149a('0x58')],{'onDelete':'cascade','as':_0x149a('0x187'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x149a('0x124')](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x149a('0x5b')]['belongsToMany'](db[_0x149a('0x13')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x149a('0x18d')});db[_0x149a('0x5b')][_0x149a('0x126')](db[_0x149a('0x12d')],{'through':_0x149a('0x18e'),'as':'Teams'});db['OpenchannelAccount'][_0x149a('0x116')](db[_0x149a('0x180')],{'as':_0x149a('0x169'),'foreignKey':_0x149a('0x18f'),'onDelete':'cascade'});db[_0x149a('0x5d')][_0x149a('0x116')](db[_0x149a('0x84')],{'as':_0x149a('0x16a'),'foreignKey':_0x149a('0x18f')});db[_0x149a('0x5d')][_0x149a('0x116')](db[_0x149a('0x61')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0x149a('0x5d')]['hasMany'](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x149a('0x18f')});db[_0x149a('0x5d')][_0x149a('0x116')](db[_0x149a('0x5f')],{'as':_0x149a('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0x149a('0x5d')]['belongsTo'](db[_0x149a('0x12c')],{'as':'List','foreignKey':_0x149a('0x16c')});db['OpenchannelAccount'][_0x149a('0x124')](db[_0x149a('0x87')],{'as':_0x149a('0x158'),'foreignKey':_0x149a('0x16f')});db[_0x149a('0x5d')]['belongsToMany'](db[_0x149a('0x13')],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0x149a('0x5f')][_0x149a('0x124')](db['User'],{'onDelete':_0x149a('0x168')});db[_0x149a('0x5f')][_0x149a('0x124')](db[_0x149a('0x13b')],{'onDelete':_0x149a('0x168'),'foreignKey':'OpenchannelQueueId'});db[_0x149a('0x5f')][_0x149a('0x124')](db['OpenchannelAccount'],{'onDelete':_0x149a('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x149a('0x5f')][_0x149a('0x124')](db[_0x149a('0x157')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x149a('0x124')](db['Tag'],{'onDelete':_0x149a('0x168'),'foreignKey':_0x149a('0x17c')});db[_0x149a('0x61')][_0x149a('0x116')](db[_0x149a('0x190')],{'as':_0x149a('0x160'),'onDelete':_0x149a('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x149a('0x61')][_0x149a('0x124')](db[_0x149a('0x5d')],{'as':'Account','foreignKey':_0x149a('0x18f')});db['OpenchannelInteraction'][_0x149a('0x124')](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x61')][_0x149a('0x124')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x149a('0x61')][_0x149a('0x126')](db['Tag'],{'through':_0x149a('0x191'),'as':_0x149a('0x176')});db['OpenchannelInteraction']['belongsToMany'](db[_0x149a('0x8e')],{'through':'openchannel_interaction_has_tags','as':_0x149a('0x177')});db[_0x149a('0x61')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'through':_0x149a('0x133'),'foreignKey':'OpenchannelInteractionId'});db[_0x149a('0x190')][_0x149a('0x124')](db['User'],{'onDelete':'cascade','as':_0x149a('0x13')});db[_0x149a('0x190')][_0x149a('0x124')](db['CmContact'],{'onDelete':_0x149a('0x113'),'as':'Contact'});db[_0x149a('0x190')][_0x149a('0x124')](db[_0x149a('0x61')],{'onDelete':_0x149a('0x113'),'as':'Interaction','foreignKey':_0x149a('0x192')});db[_0x149a('0x190')][_0x149a('0x124')](db[_0x149a('0xeb')],{'as':_0x149a('0xeb'),'foreignKey':_0x149a('0x188')});db[_0x149a('0x190')][_0x149a('0x124')](db[_0x149a('0x5d')],{'as':'Account','foreignKey':_0x149a('0x18f')});db[_0x149a('0x13b')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x193'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0x149a('0x126')](db[_0x149a('0x12d')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x149a('0x64')]['hasMany'](db[_0x149a('0x180')],{'as':_0x149a('0x169'),'foreignKey':_0x149a('0x17b'),'onDelete':_0x149a('0x113')});db[_0x149a('0x64')][_0x149a('0x116')](db[_0x149a('0x84')],{'as':_0x149a('0x16a'),'foreignKey':'ChatWebsiteId'});db[_0x149a('0x64')][_0x149a('0x116')](db[_0x149a('0x73')],{'as':_0x149a('0x194')});db[_0x149a('0x64')][_0x149a('0x116')](db[_0x149a('0x6a')],{'as':'Interactions'});db[_0x149a('0x64')][_0x149a('0x116')](db[_0x149a('0x68')],{'as':'Applications'});db['ChatWebsite'][_0x149a('0x116')](db[_0x149a('0x6c')],{'as':_0x149a('0x160')});db[_0x149a('0x64')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':'ListId'});db[_0x149a('0x64')][_0x149a('0x124')](db['Interval'],{'as':'Interval','foreignKey':_0x149a('0x18a')});db[_0x149a('0x64')][_0x149a('0x124')](db[_0x149a('0x3e')],{'as':_0x149a('0x3e'),'foreignKey':'MailAccountId'});db[_0x149a('0x64')][_0x149a('0x124')](db[_0x149a('0x87')],{'as':_0x149a('0x158'),'foreignKey':_0x149a('0x16f')});db[_0x149a('0x64')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x149a('0x124')](db[_0x149a('0x5d')],{});db[_0x149a('0x66')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x66')][_0x149a('0x124')](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db['OpenchannelQueueReport'][_0x149a('0x124')](db[_0x149a('0x61')],{});db[_0x149a('0x66')]['belongsTo'](db[_0x149a('0x190')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x149a('0x13')],{});db[_0x149a('0x66')]['belongsTo'](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x195'),'foreignKey':_0x149a('0x114'),'onDelete':'restrict'});db['ChatApplication'][_0x149a('0x124')](db['ChatQueue'],{'as':_0x149a('0x196'),'foreignKey':_0x149a('0x197'),'onDelete':_0x149a('0x168')});db[_0x149a('0x68')]['belongsTo'](db[_0x149a('0x64')],{'as':'Website','foreignKey':_0x149a('0x17b'),'onDelete':_0x149a('0x168')});db['ChatApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x149a('0x17c')});db[_0x149a('0x6a')]['hasMany'](db[_0x149a('0x6c')],{'as':_0x149a('0x160'),'onDelete':'cascade','foreignKey':_0x149a('0x198')});db['ChatInteraction']['belongsTo'](db[_0x149a('0x64')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x149a('0x124')](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':'ContactId'});db[_0x149a('0x6a')]['belongsTo'](db['User'],{'as':_0x149a('0x174'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0x149a('0x8e')],{'through':_0x149a('0x199'),'as':'Tags'});db[_0x149a('0x6a')]['belongsToMany'](db[_0x149a('0x8e')],{'through':'chat_interaction_has_tags','as':_0x149a('0x177')});db[_0x149a('0x6a')]['belongsToMany'](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'through':'user_has_chat_interactions','foreignKey':_0x149a('0x198')});db[_0x149a('0x6c')][_0x149a('0x124')](db[_0x149a('0x13')],{'onDelete':_0x149a('0x113'),'as':_0x149a('0x13')});db[_0x149a('0x6c')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x6c')][_0x149a('0x124')](db[_0x149a('0x6a')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x149a('0x198')});db[_0x149a('0x6c')]['belongsTo'](db[_0x149a('0xeb')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x149a('0x6c')]['belongsTo'](db[_0x149a('0x64')],{'as':'Account','foreignKey':_0x149a('0x17b')});db[_0x149a('0x6e')][_0x149a('0x116')](db[_0x149a('0xeb')],{'as':_0x149a('0x17a'),'foreignKey':_0x149a('0x19a'),'onDelete':_0x149a('0x113'),'hooks':!![]});db[_0x149a('0x6e')][_0x149a('0x124')](db[_0x149a('0x129')],{'onDelete':_0x149a('0x113'),'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x6e')][_0x149a('0x124')](db[_0x149a('0x64')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x17b')});db[_0x149a('0x6f')][_0x149a('0x126')](db['User'],{'as':_0x149a('0x15a'),'through':_0x149a('0x30'),'hooks':!![]});db[_0x149a('0x6f')][_0x149a('0x126')](db['Team'],{'through':_0x149a('0x19b'),'as':_0x149a('0x15c')});db['ChatGroup'][_0x149a('0x116')](db[_0x149a('0x19c')],{'as':'Messages','foreignKey':_0x149a('0x19d'),'onDelete':_0x149a('0x113')});db[_0x149a('0x71')]['belongsToMany'](db[_0x149a('0x13')],{'as':'Members','through':_0x149a('0x128')});db['ChatProactiveAction'][_0x149a('0x124')](db[_0x149a('0x64')],{'as':'Website','foreignKey':_0x149a('0x17b')});db[_0x149a('0x75')][_0x149a('0x116')](db[_0x149a('0x129')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x149a('0x129')]['hasMany'](db[_0x149a('0x90')],{'as':_0x149a('0x19e'),'foreignKey':_0x149a('0x19f')});db[_0x149a('0x129')][_0x149a('0x116')](db[_0x149a('0x78')],{'as':_0x149a('0x1a0'),'foreignKey':'ContactId'});db[_0x149a('0x129')]['hasMany'](db[_0x149a('0x1a1')],{'as':_0x149a('0x11b'),'foreignKey':_0x149a('0x166')});db['CmContact'][_0x149a('0x116')](db['CmHopperHistory'],{'as':_0x149a('0x153'),'foreignKey':_0x149a('0x166')});db['CmContact']['hasMany'](db[_0x149a('0x11d')],{'as':_0x149a('0x11d'),'foreignKey':_0x149a('0x166')});db[_0x149a('0x129')][_0x149a('0x116')](db[_0x149a('0xd4')],{'as':_0x149a('0x155'),'foreignKey':_0x149a('0x166')});db['CmContact']['hasMany'](db['OpenchannelInteraction'],{'as':_0x149a('0x11e'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x168')});db[_0x149a('0x129')]['hasMany'](db[_0x149a('0x6a')],{'as':'ChatInteractions','foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x168')});db[_0x149a('0x129')][_0x149a('0x116')](db['SmsInteraction'],{'as':_0x149a('0x120'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x168')});db[_0x149a('0x129')]['hasMany'](db[_0x149a('0x4f')],{'as':_0x149a('0x130'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x168')});db[_0x149a('0x129')][_0x149a('0x116')](db['MailInteraction'],{'as':_0x149a('0x12e'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x168')});db[_0x149a('0x129')][_0x149a('0x124')](db['CmCompany'],{'as':_0x149a('0x1a2'),'foreignKey':_0x149a('0x1a3')});db[_0x149a('0x129')][_0x149a('0x124')](db['CmList'],{'as':_0x149a('0x17e'),'foreignKey':'ListId','onDelete':_0x149a('0x113')});db[_0x149a('0x129')]['belongsToMany'](db[_0x149a('0x13')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x149a('0x129')]['belongsToMany'](db[_0x149a('0x8e')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x149a('0x129')]['belongsToMany'](db[_0x149a('0x8e')],{'through':_0x149a('0x1a4'),'as':_0x149a('0x177')});db['CmHopper'][_0x149a('0x116')](db[_0x149a('0x1a5')],{'as':_0x149a('0x1a6'),'foreignKey':_0x149a('0x1a7')});db[_0x149a('0x78')][_0x149a('0x124')](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x113')});db[_0x149a('0x78')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':'ListId','onDelete':_0x149a('0x113')});db[_0x149a('0x78')]['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x195'),'foreignKey':_0x149a('0x114')});db[_0x149a('0x78')][_0x149a('0x124')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x149a('0x152'),'onDelete':_0x149a('0x113')});db[_0x149a('0x78')][_0x149a('0x124')](db['Campaign'],{'as':_0x149a('0xe8'),'foreignKey':_0x149a('0x1a8'),'onDelete':_0x149a('0x113')});db['CmHopper']['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x174'),'foreignKey':_0x149a('0x1a9')});db[_0x149a('0x7a')]['belongsTo'](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166'),'onDelete':_0x149a('0x113')});db[_0x149a('0x7a')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c'),'onDelete':_0x149a('0x113')});db[_0x149a('0x7a')][_0x149a('0x124')](db[_0x149a('0x1c')],{'as':_0x149a('0x196'),'foreignKey':_0x149a('0x152'),'onDelete':'cascade'});db[_0x149a('0x7a')][_0x149a('0x124')](db['Campaign'],{'as':_0x149a('0xe8'),'foreignKey':_0x149a('0x1a8'),'onDelete':_0x149a('0x113')});db[_0x149a('0x82')][_0x149a('0x116')](db[_0x149a('0x1aa')],{'as':{'plural':_0x149a('0x1ab'),'singular':_0x149a('0x1ac')},'foreignKey':_0x149a('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0x149a('0x82')][_0x149a('0x116')](db[_0x149a('0x1aa')],{'as':{'plural':_0x149a('0x1ae'),'singular':_0x149a('0x1af')},'foreignKey':'AutomationAnyId','onDelete':_0x149a('0x113'),'hooks':!![]});db['Automation'][_0x149a('0x116')](db[_0x149a('0x1b0')],{'as':_0x149a('0x1b1'),'foreignKey':_0x149a('0x1b2'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x149a('0x116')](db[_0x149a('0x180')],{'as':_0x149a('0x169'),'foreignKey':_0x149a('0x1b3'),'onDelete':_0x149a('0x113')});db[_0x149a('0x157')][_0x149a('0x116')](db['Interval'],{'as':_0x149a('0x1b4'),'foreignKey':_0x149a('0x18a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x149a('0x157')]['hasMany'](db[_0x149a('0x119')],{'as':_0x149a('0x11a'),'foreignKey':_0x149a('0x18a'),'onDelete':_0x149a('0x168')});db['Interval'][_0x149a('0x116')](db[_0x149a('0x46')],{'as':_0x149a('0x1b5'),'foreignKey':_0x149a('0x18a')});db[_0x149a('0x157')][_0x149a('0x116')](db['ChatApplication'],{'as':_0x149a('0x1b6'),'foreignKey':'IntervalId'});db[_0x149a('0x157')]['hasMany'](db['FaxApplication'],{'as':_0x149a('0x1b7'),'foreignKey':_0x149a('0x18a')});db[_0x149a('0x157')]['hasMany'](db['SmsApplication'],{'as':_0x149a('0x1b8'),'foreignKey':_0x149a('0x18a')});db['Schedule'][_0x149a('0x124')](db[_0x149a('0x3e')],{});db['Schedule'][_0x149a('0x124')](db[_0x149a('0x97')],{'foreignKey':_0x149a('0x1b9')});db[_0x149a('0x8c')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x149a('0x1ba')});db[_0x149a('0x14f')]['belongsToMany'](db[_0x149a('0x1a')],{'as':_0x149a('0x1bb'),'through':_0x149a('0x150'),'onDelete':_0x149a('0x168')});db[_0x149a('0x8e')][_0x149a('0x126')](db['CmContact'],{'through':_0x149a('0x1a4')});db['Tag'][_0x149a('0x126')](db[_0x149a('0x6a')],{'through':_0x149a('0x199')});db[_0x149a('0x8e')][_0x149a('0x126')](db[_0x149a('0x43')],{'through':_0x149a('0x175')});db['Tag'][_0x149a('0x126')](db[_0x149a('0x58')],{'through':_0x149a('0x18c')});db['Tag'][_0x149a('0x126')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db['Tag'][_0x149a('0x126')](db[_0x149a('0x61')],{'through':_0x149a('0x191')});db[_0x149a('0x8e')][_0x149a('0x126')](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem'][_0x149a('0x124')](db[_0x149a('0x8f')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0x149a('0x1a5')][_0x149a('0x124')](db[_0x149a('0x78')],{'as':_0x149a('0x1bc'),'foreignKey':_0x149a('0x1a7')});db[_0x149a('0x90')]['belongsTo'](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x19f')});db[_0x149a('0x93')]['hasMany'](db[_0x149a('0x1aa')],{'as':{'plural':_0x149a('0x1bd'),'singular':'AllCondition'},'foreignKey':_0x149a('0x1be'),'onDelete':'cascade','hooks':!![]});db[_0x149a('0x93')][_0x149a('0x116')](db[_0x149a('0x1aa')],{'as':{'plural':_0x149a('0x1bf'),'singular':_0x149a('0x1c0')},'foreignKey':'TriggerAnyId','onDelete':_0x149a('0x113'),'hooks':!![]});db[_0x149a('0x93')]['hasMany'](db[_0x149a('0x1b0')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x149a('0x113'),'hooks':!![]});db[_0x149a('0x96')][_0x149a('0x116')](db['AnalyticFieldReport'],{'as':_0x149a('0x1c1'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1ba'),'hooks':!![]});db['AnalyticDefaultReport'][_0x149a('0x116')](db[_0x149a('0x9b')],{'as':'Fields','onDelete':_0x149a('0x113'),'foreignKey':'DefaultReportId'});db[_0x149a('0x9a')][_0x149a('0x116')](db[_0x149a('0x9b')],{'as':_0x149a('0x1c1'),'onDelete':_0x149a('0x113'),'foreignKey':'MetricId'});db[_0x149a('0x9b')][_0x149a('0x124')](db[_0x149a('0x9a')],{'foreignKey':_0x149a('0x1c2')});db[_0x149a('0x9e')][_0x149a('0x116')](db[_0x149a('0xa0')],{'as':_0x149a('0x1c3'),'onDelete':'cascade','foreignKey':_0x149a('0x1c4')});db['SalesforceConfiguration'][_0x149a('0x116')](db[_0x149a('0xa1')],{'as':'Subjects','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c5')});db['SalesforceConfiguration'][_0x149a('0x116')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x149a('0x1c6')});db[_0x149a('0xa0')][_0x149a('0x116')](db[_0x149a('0xa1')],{'as':_0x149a('0x1c1'),'onDelete':'cascade','foreignKey':_0x149a('0x1c7')});db[_0x149a('0xa0')][_0x149a('0x124')](db[_0x149a('0x9e')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db['SalesforceField'][_0x149a('0x116')](db[_0x149a('0xa1')],{'as':_0x149a('0x1c8'),'foreignKey':'SubjectId'});db['SalesforceField'][_0x149a('0x116')](db[_0x149a('0xa1')],{'as':_0x149a('0x1c9'),'foreignKey':'DescriptionId'});db[_0x149a('0xa1')][_0x149a('0x116')](db[_0x149a('0xa1')],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db['SalesforceField']['belongsTo'](db['Variable'],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0xa3')][_0x149a('0x116')](db['SugarcrmConfiguration'],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x149a('0x116')](db[_0x149a('0xa7')],{'as':_0x149a('0x1cd'),'onDelete':'cascade','foreignKey':_0x149a('0x1c5')});db[_0x149a('0xa5')][_0x149a('0x116')](db[_0x149a('0xa7')],{'as':_0x149a('0x1ce'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xa5')][_0x149a('0x116')](db[_0x149a('0xa7')],{'as':_0x149a('0x1c1'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xa5')][_0x149a('0x124')](db[_0x149a('0xa3')],{'as':'Account','foreignKey':_0x149a('0x1c4')});db[_0x149a('0xa7')][_0x149a('0x116')](db[_0x149a('0xa7')],{'as':_0x149a('0x1c8'),'foreignKey':'SubjectId'});db['SugarcrmField'][_0x149a('0x116')](db[_0x149a('0xa7')],{'as':_0x149a('0x1c9'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xa7')][_0x149a('0x116')](db['SugarcrmField'],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xa7')][_0x149a('0x124')](db['Variable'],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0xa8')][_0x149a('0x116')](db['DeskConfiguration'],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0xaa')][_0x149a('0x116')](db['DeskField'],{'as':_0x149a('0x1cd'),'onDelete':'cascade','foreignKey':_0x149a('0x1c5')});db[_0x149a('0xaa')]['hasMany'](db[_0x149a('0xac')],{'as':_0x149a('0x1ce'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xaa')][_0x149a('0x116')](db[_0x149a('0xac')],{'as':_0x149a('0x1c1'),'onDelete':'cascade','foreignKey':_0x149a('0x1c7')});db['DeskConfiguration'][_0x149a('0x124')](db[_0x149a('0xa8')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0xaa')][_0x149a('0x126')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0x149a('0xac')][_0x149a('0x116')](db[_0x149a('0xac')],{'as':_0x149a('0x1c8'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xac')][_0x149a('0x116')](db['DeskField'],{'as':_0x149a('0x1c9'),'foreignKey':'DescriptionId'});db[_0x149a('0xac')][_0x149a('0x116')](db[_0x149a('0xac')],{'as':'Field','foreignKey':_0x149a('0x1c7')});db['DeskField']['belongsTo'](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0xae')][_0x149a('0x116')](db[_0x149a('0xb0')],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db['ZohoConfiguration'][_0x149a('0x116')](db[_0x149a('0x1cf')],{'as':_0x149a('0x1cd'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c5')});db['ZohoConfiguration'][_0x149a('0x116')](db[_0x149a('0x1cf')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x149a('0x1c6')});db[_0x149a('0xb0')][_0x149a('0x116')](db[_0x149a('0x1cf')],{'as':_0x149a('0x1c1'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c7')});db['ZohoConfiguration'][_0x149a('0x124')](db[_0x149a('0xae')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0x1cf')][_0x149a('0x116')](db[_0x149a('0x1cf')],{'as':_0x149a('0x1c8'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0x1cf')][_0x149a('0x116')](db['ZohoField'],{'as':_0x149a('0x1c9'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0x1cf')]['hasMany'](db[_0x149a('0x1cf')],{'as':'Field','foreignKey':_0x149a('0x1c7')});db['ZohoField'][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':'Variable','foreignKey':'VariableId'});db[_0x149a('0x1d0')][_0x149a('0x116')](db[_0x149a('0xb4')],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':'AccountId'});db[_0x149a('0xb4')][_0x149a('0x116')](db[_0x149a('0xb6')],{'as':_0x149a('0x1cd'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xb4')][_0x149a('0x116')](db['ZendeskField'],{'as':_0x149a('0x1ce'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xb4')][_0x149a('0x116')](db[_0x149a('0xb6')],{'as':_0x149a('0x1c1'),'foreignKey':_0x149a('0x1c7')});db['ZendeskConfiguration'][_0x149a('0x124')](db[_0x149a('0x1d0')],{'as':_0x149a('0x173'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x1d1')});db['ZendeskField'][_0x149a('0x116')](db[_0x149a('0xb6')],{'as':_0x149a('0x1c8'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xb6')][_0x149a('0x116')](db[_0x149a('0xb6')],{'as':_0x149a('0x1c9'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x149a('0x116')](db['ZendeskField'],{'as':'Field','foreignKey':_0x149a('0x1c7')});db[_0x149a('0xb6')][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0xb8')]['hasMany'](db[_0x149a('0x1d2')],{'as':'Configurations','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0x1d2')]['hasMany'](db['FreshdeskField'],{'as':_0x149a('0x1cd'),'onDelete':_0x149a('0x113'),'foreignKey':'SubjectId'});db[_0x149a('0x1d2')][_0x149a('0x116')](db[_0x149a('0x1d3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x149a('0x116')](db[_0x149a('0x1d3')],{'as':_0x149a('0x1c1'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0x1d2')][_0x149a('0x124')](db[_0x149a('0xb8')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db['FreshdeskConfiguration'][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x1d4')});db[_0x149a('0x1d3')][_0x149a('0x116')](db[_0x149a('0x1d3')],{'as':_0x149a('0x1c8'),'foreignKey':'SubjectId'});db[_0x149a('0x1d3')][_0x149a('0x116')](db[_0x149a('0x1d3')],{'as':_0x149a('0x1c9'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0x1d3')][_0x149a('0x116')](db[_0x149a('0x1d3')],{'as':'Field','foreignKey':_0x149a('0x1c7')});db['FreshdeskField'][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':'Variable','foreignKey':'VariableId'});db[_0x149a('0x1d5')][_0x149a('0x116')](db[_0x149a('0xbd')],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0xbd')][_0x149a('0x116')](db[_0x149a('0xbe')],{'as':_0x149a('0x1cd'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xbd')]['hasMany'](db[_0x149a('0xbe')],{'as':_0x149a('0x1ce'),'foreignKey':'DescriptionId'});db[_0x149a('0xbd')][_0x149a('0x116')](db['VtigerField'],{'as':_0x149a('0x1c1'),'foreignKey':'FieldId'});db[_0x149a('0xbd')][_0x149a('0x124')](db['VtigerAccount'],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db['VtigerField'][_0x149a('0x116')](db[_0x149a('0xbe')],{'as':'Subject','foreignKey':_0x149a('0x1c5')});db['VtigerField']['hasMany'](db[_0x149a('0xbe')],{'as':'Description','foreignKey':_0x149a('0x1c6')});db[_0x149a('0xbe')][_0x149a('0x116')](db[_0x149a('0xbe')],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xbe')][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':'VariableId'});db['ServicenowAccount'][_0x149a('0x116')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x149a('0x1c4')});db[_0x149a('0xc2')]['hasMany'](db[_0x149a('0xc3')],{'as':_0x149a('0x1cd'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xc2')][_0x149a('0x116')](db['ServicenowField'],{'as':_0x149a('0x1ce'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xc2')][_0x149a('0x116')](db[_0x149a('0xc3')],{'as':_0x149a('0x1c1'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xc2')][_0x149a('0x124')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x149a('0x1c4')});db[_0x149a('0xc3')][_0x149a('0x116')](db[_0x149a('0xc3')],{'as':_0x149a('0x1c8'),'foreignKey':_0x149a('0x1c5')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x149a('0x1c9'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xc3')]['hasMany'](db[_0x149a('0xc3')],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xc3')][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0x1d6')][_0x149a('0x116')](db[_0x149a('0xc6')],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0x1d6')][_0x149a('0x124')](db['CloudProvider'],{'as':_0x149a('0x10d'),'foreignKey':_0x149a('0x167')});db[_0x149a('0xc6')][_0x149a('0x116')](db[_0x149a('0xc8')],{'as':'Subjects','onDelete':_0x149a('0x113'),'foreignKey':'SubjectId'});db[_0x149a('0xc6')][_0x149a('0x116')](db[_0x149a('0xc8')],{'as':_0x149a('0x1ce'),'onDelete':'cascade','foreignKey':_0x149a('0x1c6')});db[_0x149a('0xc6')]['hasMany'](db[_0x149a('0xc8')],{'as':'Fields','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xc6')]['belongsTo'](db['Dynamics365Account'],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0xc8')][_0x149a('0x116')](db[_0x149a('0xc8')],{'as':_0x149a('0x1c8'),'foreignKey':'SubjectId'});db[_0x149a('0xc8')][_0x149a('0x116')](db[_0x149a('0xc8')],{'as':_0x149a('0x1c9'),'foreignKey':'DescriptionId'});db[_0x149a('0xc8')][_0x149a('0x116')](db[_0x149a('0xc8')],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xc8')][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0x1d7')][_0x149a('0x116')](db[_0x149a('0xcb')],{'as':_0x149a('0x1c3'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1c4')});db[_0x149a('0xcb')][_0x149a('0x116')](db[_0x149a('0x1d8')],{'as':_0x149a('0x1cd'),'foreignKey':_0x149a('0x1c5')});db[_0x149a('0xcb')]['hasMany'](db[_0x149a('0x1d8')],{'as':_0x149a('0x1ce'),'foreignKey':_0x149a('0x1c6')});db[_0x149a('0xcb')][_0x149a('0x116')](db[_0x149a('0x1d8')],{'as':_0x149a('0x1c1'),'foreignKey':_0x149a('0x1c7')});db[_0x149a('0xcb')][_0x149a('0x124')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x149a('0x1c4')});db['FreshsalesField'][_0x149a('0x116')](db[_0x149a('0x1d8')],{'as':'Subject','foreignKey':_0x149a('0x1c5')});db[_0x149a('0x1d8')][_0x149a('0x116')](db['FreshsalesField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0x149a('0x1d8')][_0x149a('0x116')](db['FreshsalesField'],{'as':_0x149a('0x1ca'),'foreignKey':_0x149a('0x1c7')});db['FreshsalesField'][_0x149a('0x124')](db[_0x149a('0x1cb')],{'as':_0x149a('0x1cb'),'foreignKey':_0x149a('0x1cc')});db[_0x149a('0xd0')][_0x149a('0x124')](db['ChatWebsite'],{});db[_0x149a('0xd0')]['belongsTo'](db['CmList'],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db['ChatQueueReport'][_0x149a('0x124')](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db[_0x149a('0xd0')][_0x149a('0x124')](db[_0x149a('0x6a')],{});db[_0x149a('0xd0')][_0x149a('0x124')](db['ChatMessage'],{});db[_0x149a('0xd0')][_0x149a('0x124')](db[_0x149a('0x13')],{});db['ChatQueueReport'][_0x149a('0x124')](db[_0x149a('0x6f')],{});db['ChatInternalMessage'][_0x149a('0x124')](db['User'],{'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1d9')});db[_0x149a('0x19c')][_0x149a('0x124')](db['User'],{'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x1da')});db[_0x149a('0xd4')][_0x149a('0x116')](db[_0x149a('0x1db')],{'foreignKey':_0x149a('0x1dc'),'onDelete':_0x149a('0x113')});db['JscriptySessionReport'][_0x149a('0x116')](db[_0x149a('0x1dd')],{'foreignKey':_0x149a('0x1dc'),'onDelete':_0x149a('0x113')});db[_0x149a('0xd6')]['belongsTo'](db[_0x149a('0x145')],{});db[_0x149a('0xd6')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0xd6')]['belongsTo'](db[_0x149a('0x129')],{'as':_0x149a('0x165'),'foreignKey':_0x149a('0x166')});db['SmsQueueReport'][_0x149a('0x124')](db[_0x149a('0x58')],{});db[_0x149a('0xd6')]['belongsTo'](db[_0x149a('0x59')],{});db[_0x149a('0xd6')][_0x149a('0x124')](db[_0x149a('0x13')],{});db[_0x149a('0xd6')][_0x149a('0x124')](db[_0x149a('0x5b')],{});db['JscriptyProject'][_0x149a('0x116')](db[_0x149a('0xd4')],{'foreignKey':_0x149a('0x1de')});db[_0x149a('0xdc')][_0x149a('0x116')](db[_0x149a('0x1db')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x149a('0x116')](db[_0x149a('0x1dd')],{'foreignKey':_0x149a('0x1de')});db['SquareProject'][_0x149a('0x126')](db['User'],{'as':_0x149a('0x178'),'through':'user_has_square_projects'});db[_0x149a('0x12d')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x1df')});db['Team'][_0x149a('0x126')](db[_0x149a('0x1c')],{'through':_0x149a('0x10f'),'as':'VoiceQueues'});db[_0x149a('0x12d')]['belongsToMany'](db['MailQueue'],{'through':_0x149a('0x171'),'as':_0x149a('0x136')});db[_0x149a('0x12d')][_0x149a('0x126')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0x149a('0x1e0')});db[_0x149a('0x12d')]['belongsToMany'](db[_0x149a('0x137')],{'through':_0x149a('0x1e1'),'as':_0x149a('0x138')});db['Team']['belongsToMany'](db[_0x149a('0x5b')],{'through':_0x149a('0x18e'),'as':'SmsQueues'});db[_0x149a('0x12d')]['belongsToMany'](db[_0x149a('0x13b')],{'through':_0x149a('0x1e2'),'as':'OpenchannelQueues'});db[_0x149a('0x12d')]['belongsToMany'](db[_0x149a('0x1e3')],{'through':_0x149a('0x1e4'),'as':_0x149a('0x13d')});db['Team']['belongsToMany'](db[_0x149a('0xf8')],{'through':_0x149a('0x1e5'),'as':'VoicePrefixes'});db[_0x149a('0xe8')][_0x149a('0x116')](db[_0x149a('0x78')],{'as':_0x149a('0x1a0'),'foreignKey':'CampaignId'});db[_0x149a('0xe8')][_0x149a('0x116')](db[_0x149a('0x1a1')],{'as':'HopperFinals','foreignKey':_0x149a('0x1a8')});db['Campaign'][_0x149a('0x116')](db[_0x149a('0x7c')],{'as':_0x149a('0x153'),'foreignKey':_0x149a('0x1a8')});db[_0x149a('0xe8')][_0x149a('0x116')](db['CmHopperBlack'],{'as':_0x149a('0x154'),'foreignKey':_0x149a('0x1a8')});db['Campaign'][_0x149a('0x124')](db[_0x149a('0x2b')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x149a('0xe8')][_0x149a('0x124')](db['Trunk'],{'as':_0x149a('0x1e6'),'foreignKey':_0x149a('0x1e7')});db[_0x149a('0xe8')][_0x149a('0x124')](db[_0x149a('0x157')],{'as':_0x149a('0x157'),'foreignKey':_0x149a('0x18a')});db[_0x149a('0xe8')][_0x149a('0x124')](db[_0x149a('0xe1')],{'as':_0x149a('0xe1'),'foreignKey':_0x149a('0x1e8')});db[_0x149a('0xe8')][_0x149a('0x126')](db[_0x149a('0x12c')],{'as':_0x149a('0x1e9'),'through':_0x149a('0x1ea')});db[_0x149a('0xe8')][_0x149a('0x126')](db[_0x149a('0x12c')],{'as':'BlackLists','through':_0x149a('0x1eb')});db[_0x149a('0xeb')][_0x149a('0x124')](db['ChatOfflineMessage'],{'as':_0x149a('0x6e'),'foreignKey':_0x149a('0x19a')});db[_0x149a('0xee')]['belongsTo'](db['MailMessage'],{});db[_0x149a('0xee')][_0x149a('0x124')](db[_0x149a('0x43')],{});db['MailTransferReport'][_0x149a('0x124')](db['MailAccount'],{'foreignKey':_0x149a('0x1ec'),'as':'FromAccount'});db[_0x149a('0xee')]['belongsTo'](db[_0x149a('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x149a('0xee')]['belongsTo'](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1ed'),'as':_0x149a('0x1ee')});db[_0x149a('0xee')][_0x149a('0x124')](db['MailQueue'],{'foreignKey':_0x149a('0x1ef'),'as':'ToQueue'});db[_0x149a('0xee')][_0x149a('0x124')](db[_0x149a('0x3e')],{'foreignKey':'ToMailAccountId','as':_0x149a('0x1f0')});db[_0x149a('0xf0')]['belongsTo'](db['ChatMessage'],{});db[_0x149a('0xf0')][_0x149a('0x124')](db['ChatInteraction'],{});db[_0x149a('0xf0')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x149a('0x1f1'),'as':'FromAccount'});db[_0x149a('0xf0')][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1f2'),'as':_0x149a('0x1f3')});db['ChatTransferReport'][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1ed'),'as':_0x149a('0x1ee')});db[_0x149a('0xf0')][_0x149a('0x124')](db[_0x149a('0x6f')],{'foreignKey':_0x149a('0x1f4'),'as':_0x149a('0x1f5')});db['ChatTransferReport'][_0x149a('0x124')](db[_0x149a('0x64')],{'foreignKey':_0x149a('0x1f6'),'as':_0x149a('0x1f0')});db[_0x149a('0xf2')]['belongsTo'](db[_0x149a('0x51')],{});db[_0x149a('0xf2')][_0x149a('0x124')](db[_0x149a('0x4f')],{});db[_0x149a('0xf2')][_0x149a('0x124')](db[_0x149a('0x4c')],{'foreignKey':_0x149a('0x1f7'),'as':_0x149a('0x1f8')});db[_0x149a('0xf2')]['belongsTo'](db[_0x149a('0x13')],{'foreignKey':'FromUserId','as':_0x149a('0x1f3')});db[_0x149a('0xf2')][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1ed'),'as':_0x149a('0x1ee')});db[_0x149a('0xf2')][_0x149a('0x124')](db[_0x149a('0x137')],{'foreignKey':_0x149a('0x1f9'),'as':_0x149a('0x1f5')});db[_0x149a('0xf2')][_0x149a('0x124')](db[_0x149a('0x4c')],{'foreignKey':'ToFaxAccountId','as':_0x149a('0x1f0')});db['OpenchannelTransferReport'][_0x149a('0x124')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x149a('0x61')],{});db['OpenchannelTransferReport'][_0x149a('0x124')](db[_0x149a('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0x149a('0x1f8')});db['OpenchannelTransferReport'][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1f2'),'as':_0x149a('0x1f3')});db[_0x149a('0xf4')][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x149a('0xf4')][_0x149a('0x124')](db[_0x149a('0x13b')],{'foreignKey':_0x149a('0x1fa'),'as':_0x149a('0x1f5')});db[_0x149a('0xf4')][_0x149a('0x124')](db[_0x149a('0x5d')],{'foreignKey':_0x149a('0x1fb'),'as':_0x149a('0x1f0')});db[_0x149a('0xf5')][_0x149a('0x124')](db[_0x149a('0x59')],{});db[_0x149a('0xf5')]['belongsTo'](db[_0x149a('0x58')],{});db[_0x149a('0xf5')][_0x149a('0x124')](db[_0x149a('0x145')],{'foreignKey':_0x149a('0x1fc'),'as':_0x149a('0x1f8')});db[_0x149a('0xf5')][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1f2'),'as':_0x149a('0x1f3')});db[_0x149a('0xf5')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x149a('0xf5')][_0x149a('0x124')](db[_0x149a('0x5b')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0x149a('0x124')](db[_0x149a('0x145')],{'foreignKey':'ToSmsAccountId','as':_0x149a('0x1f0')});db[_0x149a('0x12c')][_0x149a('0x116')](db[_0x149a('0x180')],{'as':'Dispositions','foreignKey':_0x149a('0x16c'),'onDelete':_0x149a('0x113')});db[_0x149a('0x12c')][_0x149a('0x116')](db[_0x149a('0x7f')],{'as':_0x149a('0x1fd'),'foreignKey':_0x149a('0x16c')});db['CmList'][_0x149a('0x116')](db[_0x149a('0x129')],{'as':_0x149a('0x12a'),'onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x16c')});db['CmList'][_0x149a('0x116')](db[_0x149a('0x1a1')],{'as':_0x149a('0x11b'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x12c')][_0x149a('0x116')](db[_0x149a('0x7c')],{'as':_0x149a('0x11c'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x12c')]['hasMany'](db[_0x149a('0x11d')],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0x149a('0x12c')][_0x149a('0x126')](db['VoiceQueue'],{'as':'Queues','through':'voice_queues_has_cm_lists'});db['CmList'][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':_0x149a('0x13e')});db[_0x149a('0xf8')][_0x149a('0x116')](db[_0x149a('0x119')],{'as':_0x149a('0x11a'),'onDelete':_0x149a('0x113')});db[_0x149a('0xf8')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':'Agents','through':_0x149a('0x111')});db['VoicePrefix'][_0x149a('0x126')](db[_0x149a('0x12d')],{'through':_0x149a('0x1e5'),'as':_0x149a('0x15c')});db[_0x149a('0xfa')][_0x149a('0x116')](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'foreignKey':_0x149a('0x125')});db['UserProfile']['hasMany'](db[_0x149a('0xfc')],{'as':_0x149a('0x1fe'),'foreignKey':'userProfileId','onDelete':_0x149a('0x113')});db[_0x149a('0xfc')][_0x149a('0x116')](db[_0x149a('0xfe')],{'as':_0x149a('0x1ff'),'foreignKey':_0x149a('0x200'),'onDelete':'cascade'});db[_0x149a('0x102')]['hasMany'](db[_0x149a('0x180')],{'as':_0x149a('0x169'),'foreignKey':_0x149a('0x201'),'onDelete':'cascade'});db['WhatsappAccount'][_0x149a('0x116')](db[_0x149a('0x84')],{'as':'Answers','foreignKey':_0x149a('0x201')});db['WhatsappAccount'][_0x149a('0x116')](db[_0x149a('0x108')],{'as':_0x149a('0x160'),'foreignKey':_0x149a('0x201')});db[_0x149a('0x102')][_0x149a('0x116')](db['WhatsappInteraction'],{'as':_0x149a('0x182')});db[_0x149a('0x102')][_0x149a('0x116')](db[_0x149a('0x104')],{'as':'Applications'});db[_0x149a('0x102')]['belongsTo'](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':_0x149a('0x16c')});db[_0x149a('0x102')]['belongsTo'](db['Pause'],{'as':_0x149a('0x158'),'foreignKey':_0x149a('0x16f')});db['WhatsappAccount']['belongsToMany'](db[_0x149a('0x13')],{'as':_0x149a('0x15a'),'through':'user_has_whatsapp_accounts'});db['WhatsappApplication'][_0x149a('0x124')](db[_0x149a('0x13')],{'onDelete':_0x149a('0x168')});db['WhatsappApplication'][_0x149a('0x124')](db[_0x149a('0x1e3')],{'onDelete':_0x149a('0x168')});db[_0x149a('0x104')][_0x149a('0x124')](db[_0x149a('0x102')],{'onDelete':'restrict'});db[_0x149a('0x104')][_0x149a('0x124')](db[_0x149a('0x157')],{'onDelete':_0x149a('0x168'),'foreignKey':_0x149a('0x18a')});db[_0x149a('0x104')]['belongsTo'](db[_0x149a('0x8e')],{'onDelete':_0x149a('0x168'),'foreignKey':'TagId'});db[_0x149a('0x106')][_0x149a('0x116')](db[_0x149a('0x108')],{'as':'Messages','onDelete':_0x149a('0x113'),'foreignKey':_0x149a('0x202')});db[_0x149a('0x106')]['belongsTo'](db[_0x149a('0x102')],{'as':_0x149a('0x173'),'foreignKey':_0x149a('0x201')});db[_0x149a('0x106')][_0x149a('0x124')](db[_0x149a('0x129')],{'as':'Contact','foreignKey':_0x149a('0x166')});db[_0x149a('0x106')]['belongsTo'](db[_0x149a('0x13')],{'as':_0x149a('0x174'),'foreignKey':'UserId'});db[_0x149a('0x106')][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x203'),'as':_0x149a('0x176')});db[_0x149a('0x106')][_0x149a('0x126')](db[_0x149a('0x8e')],{'through':_0x149a('0x203'),'as':_0x149a('0x177')});db[_0x149a('0x106')][_0x149a('0x126')](db[_0x149a('0x13')],{'as':_0x149a('0x178'),'through':_0x149a('0x204'),'foreignKey':_0x149a('0x202')});db[_0x149a('0x108')][_0x149a('0x124')](db[_0x149a('0x13')],{'as':_0x149a('0x13')});db['WhatsappMessage'][_0x149a('0x124')](db['CmContact'],{'onDelete':_0x149a('0x113'),'as':'Contact'});db[_0x149a('0x108')][_0x149a('0x124')](db['WhatsappInteraction'],{'onDelete':_0x149a('0x113'),'as':_0x149a('0x187'),'foreignKey':'WhatsappInteractionId'});db[_0x149a('0x108')][_0x149a('0x124')](db[_0x149a('0x102')],{'as':_0x149a('0x173'),'foreignKey':'WhatsappAccountId'});db[_0x149a('0x205')]['belongsTo'](db[_0x149a('0x102')],{});db[_0x149a('0x205')][_0x149a('0x124')](db[_0x149a('0x12c')],{'as':_0x149a('0x17e'),'foreignKey':'ListId'});db[_0x149a('0x205')][_0x149a('0x124')](db['CmContact'],{'as':_0x149a('0x165'),'foreignKey':'ContactId'});db[_0x149a('0x205')]['belongsTo'](db[_0x149a('0x106')],{});db[_0x149a('0x205')][_0x149a('0x124')](db[_0x149a('0x1e3')],{});db[_0x149a('0x205')]['belongsTo'](db['WhatsappMessage'],{});db[_0x149a('0x205')][_0x149a('0x124')](db['User'],{});db[_0x149a('0x10a')]['belongsTo'](db[_0x149a('0x108')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x149a('0x10a')]['belongsTo'](db[_0x149a('0x102')],{'foreignKey':_0x149a('0x206'),'as':_0x149a('0x1f8')});db[_0x149a('0x10a')][_0x149a('0x124')](db[_0x149a('0x102')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0x149a('0x10a')]['belongsTo'](db[_0x149a('0x1e3')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x149a('0x10a')][_0x149a('0x124')](db[_0x149a('0x13')],{'foreignKey':_0x149a('0x1f2'),'as':_0x149a('0x1f3')});db[_0x149a('0x10a')][_0x149a('0x124')](db['User'],{'foreignKey':'ToUserId','as':_0x149a('0x1ee')});db['WhatsappQueue'][_0x149a('0x126')](db[_0x149a('0x13')],{'as':'Agents','through':_0x149a('0x38'),'foreignKey':_0x149a('0x207')});db[_0x149a('0x1e3')][_0x149a('0x126')](db[_0x149a('0x12d')],{'through':_0x149a('0x1e4'),'as':'Teams'});db[_0x149a('0x208')][_0x149a('0x124')](db[_0x149a('0x13')],{'as':_0x149a('0x209'),'foreignKey':_0x149a('0x114'),'onDelete':_0x149a('0x113'),'hooks':!![]});db['CloudProvider']['hasOne'](db[_0x149a('0x1d6')],{'as':_0x149a('0x1d6'),'onDelete':'restrict'});db[_0x149a('0x10d')][_0x149a('0x115')](db[_0x149a('0x3a')],{'as':_0x149a('0x20a'),'onDelete':_0x149a('0x168')});db['CloudProvider']['hasOne'](db[_0x149a('0x3c')],{'as':_0x149a('0x20b'),'onDelete':_0x149a('0x168')});module[_0x149a('0x20c')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index cf77288..de076ae 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22c9=['./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/fax/reports/transfer','/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/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/version','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','/api/logs','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x22c9,0xb1));var _0x922c=function(_0x35c4c9,_0x2cdabb){_0x35c4c9=_0x35c4c9-0x0;var _0x36e68b=_0x22c9[_0x35c4c9];return _0x36e68b;};'use strict';var path=require('path');var express=require(_0x922c('0x0'));var errors=require(_0x922c('0x1'));var config=require(_0x922c('0x2'));var setupLoggers=require(_0x922c('0x3'))[_0x922c('0x4')];var clientSideLogs=require(_0x922c('0x5'));exports['default']=function(_0x4b2301){return setupLoggers(_0x4b2301)['then'](function(){_0x4b2301['use']('/api/users',require('./api/user'));_0x4b2301[_0x922c('0x6')](_0x922c('0x7'),require(_0x922c('0x8')));_0x4b2301[_0x922c('0x6')]('/api/voice/contexts',require(_0x922c('0x9')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa'),require(_0x922c('0xb')));_0x4b2301['use'](_0x922c('0xc'),require(_0x922c('0xd')));_0x4b2301[_0x922c('0x6')]('/api/voice/queues',require(_0x922c('0xe')));_0x4b2301[_0x922c('0x6')](_0x922c('0xf'),require('./api/voiceRecording'));_0x4b2301[_0x922c('0x6')](_0x922c('0x10'),require('./api/screenRecording'));_0x4b2301[_0x922c('0x6')](_0x922c('0x11'),require(_0x922c('0x12')));_0x4b2301[_0x922c('0x6')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x4b2301[_0x922c('0x6')]('/api/voice/calls/reports',require(_0x922c('0x13')));_0x4b2301[_0x922c('0x6')](_0x922c('0x14'),require('./api/voiceDialReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0x15'),require(_0x922c('0x16')));_0x4b2301[_0x922c('0x6')](_0x922c('0x17'),require('./api/voiceQueueReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0x18'),require(_0x922c('0x19')));_0x4b2301[_0x922c('0x6')](_0x922c('0x1a'),require(_0x922c('0x1b')));_0x4b2301[_0x922c('0x6')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0x1c'),require(_0x922c('0x1d')));_0x4b2301[_0x922c('0x6')](_0x922c('0x1e'),require(_0x922c('0x1f')));_0x4b2301[_0x922c('0x6')](_0x922c('0x20'),require(_0x922c('0x21')));_0x4b2301['use'](_0x922c('0x22'),require('./api/mailSubstatus'));_0x4b2301[_0x922c('0x6')]('/api/mail/interactions',require(_0x922c('0x23')));_0x4b2301['use'](_0x922c('0x24'),require(_0x922c('0x25')));_0x4b2301['use'](_0x922c('0x26'),require('./api/mailApplication'));_0x4b2301[_0x922c('0x6')](_0x922c('0x27'),require(_0x922c('0x28')));_0x4b2301[_0x922c('0x6')](_0x922c('0x29'),require(_0x922c('0x2a')));_0x4b2301[_0x922c('0x6')]('/api/dashboards/items',require(_0x922c('0x2b')));_0x4b2301[_0x922c('0x6')](_0x922c('0x2c'),require(_0x922c('0x2d')));_0x4b2301[_0x922c('0x6')](_0x922c('0x2e'),require(_0x922c('0x2f')));_0x4b2301['use']('/api/fax/interactions',require(_0x922c('0x30')));_0x4b2301[_0x922c('0x6')](_0x922c('0x31'),require(_0x922c('0x32')));_0x4b2301[_0x922c('0x6')](_0x922c('0x33'),require('./api/faxQueue'));_0x4b2301[_0x922c('0x6')]('/api/fax/reports/queue',require(_0x922c('0x34')));_0x4b2301[_0x922c('0x6')](_0x922c('0x35'),require(_0x922c('0x36')));_0x4b2301['use'](_0x922c('0x37'),require('./api/smsApplication'));_0x4b2301[_0x922c('0x6')](_0x922c('0x38'),require(_0x922c('0x39')));_0x4b2301[_0x922c('0x6')]('/api/sms/messages',require(_0x922c('0x3a')));_0x4b2301[_0x922c('0x6')](_0x922c('0x3b'),require('./api/smsQueue'));_0x4b2301[_0x922c('0x6')](_0x922c('0x3c'),require(_0x922c('0x3d')));_0x4b2301[_0x922c('0x6')](_0x922c('0x3e'),require(_0x922c('0x3f')));_0x4b2301['use'](_0x922c('0x40'),require(_0x922c('0x41')));_0x4b2301[_0x922c('0x6')](_0x922c('0x42'),require(_0x922c('0x43')));_0x4b2301[_0x922c('0x6')]('/api/openchannel/queues',require(_0x922c('0x44')));_0x4b2301[_0x922c('0x6')](_0x922c('0x45'),require('./api/chatWebsite'));_0x4b2301[_0x922c('0x6')](_0x922c('0x46'),require(_0x922c('0x47')));_0x4b2301[_0x922c('0x6')](_0x922c('0x48'),require(_0x922c('0x49')));_0x4b2301[_0x922c('0x6')](_0x922c('0x4a'),require(_0x922c('0x4b')));_0x4b2301[_0x922c('0x6')](_0x922c('0x4c'),require(_0x922c('0x4d')));_0x4b2301[_0x922c('0x6')]('/api/chat/offline_messages',require(_0x922c('0x4e')));_0x4b2301[_0x922c('0x6')](_0x922c('0x4f'),require('./api/chatQueue'));_0x4b2301[_0x922c('0x6')](_0x922c('0x50'),require('./api/chatGroup'));_0x4b2301['use'](_0x922c('0x51'),require(_0x922c('0x52')));_0x4b2301[_0x922c('0x6')](_0x922c('0x53'),require(_0x922c('0x54')));_0x4b2301[_0x922c('0x6')](_0x922c('0x55'),require(_0x922c('0x56')));_0x4b2301['use'](_0x922c('0x57'),require(_0x922c('0x58')));_0x4b2301['use'](_0x922c('0x59'),require(_0x922c('0x5a')));_0x4b2301[_0x922c('0x6')](_0x922c('0x5b'),require(_0x922c('0x5c')));_0x4b2301['use'](_0x922c('0x5d'),require('./api/cmHopperHistory'));_0x4b2301[_0x922c('0x6')](_0x922c('0x5e'),require(_0x922c('0x5f')));_0x4b2301['use'](_0x922c('0x60'),require(_0x922c('0x61')));_0x4b2301['use']('/api/automations',require('./api/automation'));_0x4b2301[_0x922c('0x6')](_0x922c('0x62'),require(_0x922c('0x63')));_0x4b2301[_0x922c('0x6')](_0x922c('0x64'),require(_0x922c('0x65')));_0x4b2301[_0x922c('0x6')]('/api/conditions',require(_0x922c('0x66')));_0x4b2301['use'](_0x922c('0x67'),require(_0x922c('0x68')));_0x4b2301[_0x922c('0x6')](_0x922c('0x69'),require('./api/pause'));_0x4b2301[_0x922c('0x6')](_0x922c('0x6a'),require(_0x922c('0x6b')));_0x4b2301[_0x922c('0x6')]('/api/voiceQueuesLog',require(_0x922c('0x6c')));_0x4b2301['use'](_0x922c('0x6d'),require(_0x922c('0x6e')));_0x4b2301[_0x922c('0x6')](_0x922c('0x6f'),require(_0x922c('0x70')));_0x4b2301['use'](_0x922c('0x71'),require(_0x922c('0x72')));_0x4b2301['use'](_0x922c('0x73'),require(_0x922c('0x74')));_0x4b2301[_0x922c('0x6')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x4b2301['use']('/api/cm_hopper_additional_phones',require(_0x922c('0x75')));_0x4b2301[_0x922c('0x6')](_0x922c('0x76'),require('./api/template'));_0x4b2301[_0x922c('0x6')](_0x922c('0x77'),require('./api/trigger'));_0x4b2301[_0x922c('0x6')](_0x922c('0x78'),require(_0x922c('0x79')));_0x4b2301['use'](_0x922c('0x7a'),require(_0x922c('0x7b')));_0x4b2301[_0x922c('0x6')]('/api/integrations/reports',require(_0x922c('0x7c')));_0x4b2301['use'](_0x922c('0x7d'),require(_0x922c('0x7e')));_0x4b2301[_0x922c('0x6')](_0x922c('0x7f'),require(_0x922c('0x80')));_0x4b2301[_0x922c('0x6')](_0x922c('0x81'),require('./api/analyticExtractedReport'));_0x4b2301[_0x922c('0x6')]('/api/analytics/metrics',require(_0x922c('0x82')));_0x4b2301[_0x922c('0x6')](_0x922c('0x83'),require(_0x922c('0x84')));_0x4b2301[_0x922c('0x6')](_0x922c('0x85'),require(_0x922c('0x86')));_0x4b2301[_0x922c('0x6')](_0x922c('0x87'),require(_0x922c('0x88')));_0x4b2301[_0x922c('0x6')]('/api/integrations/salesforce/configurations',require(_0x922c('0x89')));_0x4b2301[_0x922c('0x6')](_0x922c('0x8a'),require('./api/intSalesforceField'));_0x4b2301['use']('/api/integrations/sugarcrm/accounts',require(_0x922c('0x8b')));_0x4b2301[_0x922c('0x6')](_0x922c('0x8c'),require('./api/intSugarcrmConfiguration'));_0x4b2301[_0x922c('0x6')](_0x922c('0x8d'),require(_0x922c('0x8e')));_0x4b2301[_0x922c('0x6')](_0x922c('0x8f'),require('./api/intDeskAccount'));_0x4b2301[_0x922c('0x6')](_0x922c('0x90'),require('./api/intDeskConfiguration'));_0x4b2301[_0x922c('0x6')](_0x922c('0x91'),require(_0x922c('0x92')));_0x4b2301[_0x922c('0x6')](_0x922c('0x93'),require(_0x922c('0x94')));_0x4b2301[_0x922c('0x6')]('/api/integrations/zoho/configurations',require(_0x922c('0x95')));_0x4b2301['use']('/api/integrations/zoho/fields',require(_0x922c('0x96')));_0x4b2301[_0x922c('0x6')](_0x922c('0x97'),require(_0x922c('0x98')));_0x4b2301[_0x922c('0x6')](_0x922c('0x99'),require(_0x922c('0x9a')));_0x4b2301[_0x922c('0x6')](_0x922c('0x9b'),require(_0x922c('0x9c')));_0x4b2301[_0x922c('0x6')](_0x922c('0x9d'),require('./api/intFreshdeskAccount'));_0x4b2301[_0x922c('0x6')](_0x922c('0x9e'),require(_0x922c('0x9f')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa0'),require(_0x922c('0xa1')));_0x4b2301['use']('/api/integrations/vtiger/accounts',require(_0x922c('0xa2')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa3'),require(_0x922c('0xa4')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa5'),require(_0x922c('0xa6')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa7'),require(_0x922c('0xa8')));_0x4b2301[_0x922c('0x6')](_0x922c('0xa9'),require('./api/intServicenowConfiguration'));_0x4b2301[_0x922c('0x6')](_0x922c('0xaa'),require('./api/intServicenowField'));_0x4b2301[_0x922c('0x6')](_0x922c('0xab'),require(_0x922c('0xac')));_0x4b2301[_0x922c('0x6')](_0x922c('0xad'),require(_0x922c('0xae')));_0x4b2301['use']('/api/integrations/dynamics365/fields',require(_0x922c('0xaf')));_0x4b2301[_0x922c('0x6')](_0x922c('0xb0'),require(_0x922c('0xb1')));_0x4b2301[_0x922c('0x6')](_0x922c('0xb2'),require(_0x922c('0xb3')));_0x4b2301['use'](_0x922c('0xb4'),require(_0x922c('0xb5')));_0x4b2301[_0x922c('0x6')]('/api/networks',require(_0x922c('0xb6')));_0x4b2301[_0x922c('0x6')](_0x922c('0xb7'),require('./api/chatQueueReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0xb8'),require(_0x922c('0xb9')));_0x4b2301[_0x922c('0x6')](_0x922c('0xba'),require(_0x922c('0xbb')));_0x4b2301['use'](_0x922c('0xbc'),require(_0x922c('0xbd')));_0x4b2301['use'](_0x922c('0xbe'),require('./api/jscriptySessionReport'));_0x4b2301['use'](_0x922c('0xbf'),require(_0x922c('0xc0')));_0x4b2301['use']('/api/square/reports',require(_0x922c('0xc1')));_0x4b2301['use']('/api/square/details/reports',require('./api/squareReportDetail'));_0x4b2301[_0x922c('0x6')](_0x922c('0xc2'),require(_0x922c('0xc3')));_0x4b2301['use'](_0x922c('0xc4'),require('./api/setting'));_0x4b2301[_0x922c('0x6')](_0x922c('0xc5'),require(_0x922c('0xc6')));_0x4b2301[_0x922c('0x6')](_0x922c('0xc7'),require(_0x922c('0xc8')));_0x4b2301[_0x922c('0x6')](_0x922c('0xc9'),require(_0x922c('0xca')));_0x4b2301[_0x922c('0x6')](_0x922c('0xcb'),require(_0x922c('0xcc')));_0x4b2301[_0x922c('0x6')]('/api/teams',require(_0x922c('0xcd')));_0x4b2301[_0x922c('0x6')](_0x922c('0xce'),require(_0x922c('0xcf')));_0x4b2301[_0x922c('0x6')](_0x922c('0xd0'),require(_0x922c('0xd1')));_0x4b2301[_0x922c('0x6')](_0x922c('0xd2'),require(_0x922c('0xd3')));_0x4b2301[_0x922c('0x6')](_0x922c('0xd4'),require(_0x922c('0xd5')));_0x4b2301[_0x922c('0x6')](_0x922c('0xd6'),require('./api/plugin'));_0x4b2301[_0x922c('0x6')]('/api/mail/reports/transfer',require(_0x922c('0xd7')));_0x4b2301['use']('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0xd8'),require('./api/faxTransferReport'));_0x4b2301[_0x922c('0x6')](_0x922c('0xd9'),require(_0x922c('0xda')));_0x4b2301[_0x922c('0x6')](_0x922c('0xdb'),require(_0x922c('0xdc')));_0x4b2301['use'](_0x922c('0xdd'),require('./api/cmList'));_0x4b2301[_0x922c('0x6')](_0x922c('0xde'),require(_0x922c('0xdf')));_0x4b2301['use'](_0x922c('0xe0'),require(_0x922c('0xe1')));_0x4b2301[_0x922c('0x6')]('/api/userProfile/sections',require(_0x922c('0xe2')));_0x4b2301[_0x922c('0x6')](_0x922c('0xe3'),require(_0x922c('0xe4')));_0x4b2301[_0x922c('0x6')](_0x922c('0xe5'),require(_0x922c('0xe6')));_0x4b2301['use'](_0x922c('0xe7'),require(_0x922c('0xe8')));_0x4b2301[_0x922c('0x6')](_0x922c('0xe9'),require('./api/whatsappApplication'));_0x4b2301[_0x922c('0x6')]('/api/whatsapp/interactions',require(_0x922c('0xea')));_0x4b2301[_0x922c('0x6')](_0x922c('0xeb'),require('./api/whatsappMessage'));_0x4b2301[_0x922c('0x6')](_0x922c('0xec'),require(_0x922c('0xed')));_0x4b2301[_0x922c('0x6')](_0x922c('0xee'),require('./api/whatsappTransferReport'));_0x4b2301['use'](_0x922c('0xef'),require(_0x922c('0xf0')));_0x4b2301[_0x922c('0x6')](_0x922c('0xf1'),require(_0x922c('0xf2')));_0x4b2301[_0x922c('0x6')](_0x922c('0xf3'),require(_0x922c('0xf4')));_0x4b2301[_0x922c('0x6')]('/api/user-settings',require(_0x922c('0xf5')));_0x4b2301[_0x922c('0x6')](_0x922c('0xf6'),require(_0x922c('0xf7')));_0x4b2301[_0x922c('0x6')](_0x922c('0xf8'),require(_0x922c('0xf9')));_0x4b2301[_0x922c('0x6')](_0x922c('0xfa'),require(_0x922c('0xfb')));_0x4b2301[_0x922c('0x6')](_0x922c('0xfc'),require(_0x922c('0xfd')));_0x4b2301[_0x922c('0x6')]('/api/rpc',require('./api/rpc'));_0x4b2301[_0x922c('0x6')](_0x922c('0xfe'),require(_0x922c('0xff')));_0x4b2301[_0x922c('0x6')](_0x922c('0x100'),require(_0x922c('0x101')));_0x4b2301[_0x922c('0x6')](_0x922c('0x102'),require('./api/pm2'));_0x4b2301[_0x922c('0x6')](_0x922c('0x103'),require('./api/webbar'));_0x4b2301[_0x922c('0x6')](_0x922c('0x104'),clientSideLogs);_0x4b2301[_0x922c('0x6')]('/apidoc',express[_0x922c('0x105')](path[_0x922c('0x106')](config[_0x922c('0x107')],'/apidoc')));_0x4b2301[_0x922c('0x6')](_0x922c('0x108'),express['static'](path[_0x922c('0x106')](config[_0x922c('0x107')],_0x922c('0x108'))));_0x4b2301[_0x922c('0x6')](_0x922c('0x109'),express[_0x922c('0x105')](path['join'](config[_0x922c('0x107')],'/demo')));_0x4b2301[_0x922c('0x6')](_0x922c('0x10a'),express['static'](path[_0x922c('0x106')](config['root'],_0x922c('0x10b'),'3.0.0')));_0x4b2301['use'](_0x922c('0x10c'),express[_0x922c('0x105')](path['join'](config[_0x922c('0x107')],_0x922c('0x10d'))));_0x4b2301[_0x922c('0x10e')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x4b2301[_0x922c('0x10e')]('/*')[_0x922c('0x10f')](function(_0x4eca28,_0x2dfbcb){_0x2dfbcb[_0x922c('0x110')](path[_0x922c('0x111')](_0x4b2301[_0x922c('0x10f')](_0x922c('0x112'))+_0x922c('0x113')));});return _0x4b2301;});}; \ No newline at end of file +var _0x7b2e=['/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/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/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','static','join','root','/apidoc','/demo','/snippet','snippet','3.0.0','/server/files/plugins','get','route','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./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/voiceCallReport','./api/voiceDialReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/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/integrations/sugarcrm/accounts'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7b2e,0x87));var _0xe7b2=function(_0x366ce0,_0x4c3fad){_0x366ce0=_0x366ce0-0x0;var _0x5ae1c0=_0x7b2e[_0x366ce0];return _0x5ae1c0;};'use strict';var path=require(_0xe7b2('0x0'));var express=require(_0xe7b2('0x1'));var errors=require(_0xe7b2('0x2'));var config=require(_0xe7b2('0x3'));var setupLoggers=require(_0xe7b2('0x4'))[_0xe7b2('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0xe7b2('0x6')]=function(_0x399697){return setupLoggers(_0x399697)[_0xe7b2('0x7')](function(){_0x399697[_0xe7b2('0x8')](_0xe7b2('0x9'),require(_0xe7b2('0xa')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb'),require(_0xe7b2('0xc')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd'),require('./api/voiceContext'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xe'),require('./api/voiceExtension'));_0x399697[_0xe7b2('0x8')]('/api/voice/mohs',require(_0xe7b2('0xf')));_0x399697['use'](_0xe7b2('0x10'),require(_0xe7b2('0x11')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x12'),require(_0xe7b2('0x13')));_0x399697['use'](_0xe7b2('0x14'),require(_0xe7b2('0x15')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x16'),require(_0xe7b2('0x17')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x18'),require(_0xe7b2('0x19')));_0x399697[_0xe7b2('0x8')]('/api/voice/calls/reports',require(_0xe7b2('0x1a')));_0x399697[_0xe7b2('0x8')]('/api/voice/dials/reports',require(_0xe7b2('0x1b')));_0x399697[_0xe7b2('0x8')]('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x399697[_0xe7b2('0x8')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x1c'),require(_0xe7b2('0x1d')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x1e'),require('./api/trunk'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x1f'),require('./api/voiceTransferReport'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x20'),require('./api/mailServerOut'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x21'),require(_0xe7b2('0x22')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x23'),require(_0xe7b2('0x24')));_0x399697['use'](_0xe7b2('0x25'),require('./api/mailSubstatus'));_0x399697[_0xe7b2('0x8')]('/api/mail/interactions',require(_0xe7b2('0x26')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x27'),require(_0xe7b2('0x28')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x29'),require(_0xe7b2('0x2a')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x2b'),require('./api/mailQueueReport'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x2c'),require('./api/dashboard'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x2d'),require(_0xe7b2('0x2e')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x2f'),require('./api/faxAccount'));_0x399697['use'](_0xe7b2('0x30'),require(_0xe7b2('0x31')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x32'),require(_0xe7b2('0x33')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x34'),require(_0xe7b2('0x35')));_0x399697['use'](_0xe7b2('0x36'),require(_0xe7b2('0x37')));_0x399697['use'](_0xe7b2('0x38'),require(_0xe7b2('0x39')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x3a'),require('./api/smsAccount'));_0x399697['use']('/api/sms/applications',require(_0xe7b2('0x3b')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x3c'),require('./api/smsInteraction'));_0x399697['use'](_0xe7b2('0x3d'),require(_0xe7b2('0x3e')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x3f'),require('./api/smsQueue'));_0x399697[_0xe7b2('0x8')]('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x40'),require('./api/openchannelApplication'));_0x399697['use'](_0xe7b2('0x41'),require(_0xe7b2('0x42')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x43'),require(_0xe7b2('0x44')));_0x399697['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x399697['use']('/api/chat/websites',require(_0xe7b2('0x45')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x46'),require(_0xe7b2('0x47')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x48'),require('./api/chatApplication'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x49'),require(_0xe7b2('0x4a')));_0x399697[_0xe7b2('0x8')]('/api/chat/messages',require(_0xe7b2('0x4b')));_0x399697['use']('/api/chat/offline_messages',require(_0xe7b2('0x4c')));_0x399697['use'](_0xe7b2('0x4d'),require(_0xe7b2('0x4e')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x4f'),require(_0xe7b2('0x50')));_0x399697[_0xe7b2('0x8')]('/api/chat/proactive_actions',require(_0xe7b2('0x51')));_0x399697['use'](_0xe7b2('0x52'),require(_0xe7b2('0x53')));_0x399697['use']('/api/cm/contacts',require(_0xe7b2('0x54')));_0x399697[_0xe7b2('0x8')]('/api/cm/hopper',require(_0xe7b2('0x55')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x56'),require('./api/cmHopperBlack'));_0x399697['use'](_0xe7b2('0x57'),require(_0xe7b2('0x58')));_0x399697[_0xe7b2('0x8')]('/api/cm/hopper_history',require(_0xe7b2('0x59')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x5a'),require(_0xe7b2('0x5b')));_0x399697[_0xe7b2('0x8')]('/api/actions',require(_0xe7b2('0x5c')));_0x399697[_0xe7b2('0x8')]('/api/automations',require('./api/automation'));_0x399697['use'](_0xe7b2('0x5d'),require(_0xe7b2('0x5e')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x5f'),require('./api/disposition'));_0x399697['use'](_0xe7b2('0x60'),require(_0xe7b2('0x61')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x62'),require(_0xe7b2('0x63')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x64'),require(_0xe7b2('0x65')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x66'),require(_0xe7b2('0x67')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x68'),require(_0xe7b2('0x69')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x6a'),require(_0xe7b2('0x6b')));_0x399697[_0xe7b2('0x8')]('/api/sounds',require(_0xe7b2('0x6c')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x6d'),require('./api/tag'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x6e'),require('./api/contactItemType'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x6f'),require(_0xe7b2('0x70')));_0x399697[_0xe7b2('0x8')]('/api/cm_hopper_additional_phones',require(_0xe7b2('0x71')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x72'),require(_0xe7b2('0x73')));_0x399697['use']('/api/triggers',require(_0xe7b2('0x74')));_0x399697[_0xe7b2('0x8')]('/api/variables',require(_0xe7b2('0x75')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x76'),require(_0xe7b2('0x77')));_0x399697[_0xe7b2('0x8')]('/api/integrations/reports',require(_0xe7b2('0x78')));_0x399697[_0xe7b2('0x8')]('/api/analytics/custom_reports',require(_0xe7b2('0x79')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x7a'),require(_0xe7b2('0x7b')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x7c'),require('./api/analyticExtractedReport'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x7d'),require('./api/analyticMetric'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x7e'),require(_0xe7b2('0x7f')));_0x399697['use'](_0xe7b2('0x80'),require(_0xe7b2('0x81')));_0x399697['use'](_0xe7b2('0x82'),require(_0xe7b2('0x83')));_0x399697['use'](_0xe7b2('0x84'),require('./api/intSalesforceConfiguration'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x85'),require('./api/intSalesforceField'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x86'),require('./api/intSugarcrmAccount'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x87'),require(_0xe7b2('0x88')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x89'),require(_0xe7b2('0x8a')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x8b'),require(_0xe7b2('0x8c')));_0x399697['use'](_0xe7b2('0x8d'),require(_0xe7b2('0x8e')));_0x399697['use'](_0xe7b2('0x8f'),require(_0xe7b2('0x90')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x91'),require(_0xe7b2('0x92')));_0x399697[_0xe7b2('0x8')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x93'),require(_0xe7b2('0x94')));_0x399697[_0xe7b2('0x8')]('/api/integrations/zendesk/accounts',require(_0xe7b2('0x95')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x96'),require('./api/intZendeskConfiguration'));_0x399697['use'](_0xe7b2('0x97'),require(_0xe7b2('0x98')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x99'),require(_0xe7b2('0x9a')));_0x399697[_0xe7b2('0x8')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x399697['use'](_0xe7b2('0x9b'),require(_0xe7b2('0x9c')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x9d'),require('./api/intVtigerAccount'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x9e'),require('./api/intVtigerConfiguration'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x9f'),require(_0xe7b2('0xa0')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xa1'),require(_0xe7b2('0xa2')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xa3'),require(_0xe7b2('0xa4')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xa5'),require(_0xe7b2('0xa6')));_0x399697['use'](_0xe7b2('0xa7'),require('./api/intDynamics365Account'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xa8'),require(_0xe7b2('0xa9')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xaa'),require(_0xe7b2('0xab')));_0x399697['use'](_0xe7b2('0xac'),require(_0xe7b2('0xad')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xae'),require(_0xe7b2('0xaf')));_0x399697[_0xe7b2('0x8')]('/api/integrations/freshsales/fields',require(_0xe7b2('0xb0')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb1'),require(_0xe7b2('0xb2')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb3'),require(_0xe7b2('0xb4')));_0x399697['use'](_0xe7b2('0xb5'),require('./api/chatInternalMessage'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb6'),require('./api/jscriptyAnswerReport'));_0x399697['use']('/api/jscripty/questions/reports',require(_0xe7b2('0xb7')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb8'),require('./api/jscriptySessionReport'));_0x399697['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xb9'),require(_0xe7b2('0xba')));_0x399697[_0xe7b2('0x8')]('/api/square/details/reports',require(_0xe7b2('0xbb')));_0x399697[_0xe7b2('0x8')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xbc'),require(_0xe7b2('0xbd')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xbe'),require(_0xe7b2('0xbf')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xc0'),require(_0xe7b2('0xc1')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xc2'),require(_0xe7b2('0xc3')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xc4'),require(_0xe7b2('0xc5')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xc6'),require(_0xe7b2('0xc7')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xc8'),require(_0xe7b2('0xc9')));_0x399697['use'](_0xe7b2('0xca'),require(_0xe7b2('0xcb')));_0x399697['use'](_0xe7b2('0xcc'),require(_0xe7b2('0xcd')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xce'),require(_0xe7b2('0xcf')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd0'),require(_0xe7b2('0xd1')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd2'),require(_0xe7b2('0xd3')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd4'),require(_0xe7b2('0xd5')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd6'),require(_0xe7b2('0xd7')));_0x399697['use']('/api/openchannel/reports/transfer',require(_0xe7b2('0xd8')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xd9'),require(_0xe7b2('0xda')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xdb'),require(_0xe7b2('0xdc')));_0x399697['use'](_0xe7b2('0xdd'),require(_0xe7b2('0xde')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xdf'),require(_0xe7b2('0xe0')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xe1'),require(_0xe7b2('0xe2')));_0x399697['use'](_0xe7b2('0xe3'),require(_0xe7b2('0xe4')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xe5'),require(_0xe7b2('0xe6')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xe7'),require(_0xe7b2('0xe8')));_0x399697[_0xe7b2('0x8')]('/api/whatsapp/applications',require(_0xe7b2('0xe9')));_0x399697[_0xe7b2('0x8')]('/api/whatsapp/interactions',require(_0xe7b2('0xea')));_0x399697['use'](_0xe7b2('0xeb'),require(_0xe7b2('0xec')));_0x399697[_0xe7b2('0x8')]('/api/whatsapp/reports/queue',require(_0xe7b2('0xed')));_0x399697['use'](_0xe7b2('0xee'),require('./api/whatsappTransferReport'));_0x399697['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xef'),require(_0xe7b2('0xf0')));_0x399697['use'](_0xe7b2('0xf1'),require('./api/realtime'));_0x399697[_0xe7b2('0x8')]('/api/user-settings',require(_0xe7b2('0xf2')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xf3'),require('./api/authLocal'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xf4'),require(_0xe7b2('0xf5')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xf6'),require(_0xe7b2('0xf7')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xf8'),require(_0xe7b2('0xf9')));_0x399697[_0xe7b2('0x8')]('/api/rpc',require(_0xe7b2('0xfa')));_0x399697['use'](_0xe7b2('0xfb'),require(_0xe7b2('0xfc')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xfd'),require('./api/system'));_0x399697[_0xe7b2('0x8')](_0xe7b2('0xfe'),require(_0xe7b2('0xff')));_0x399697[_0xe7b2('0x8')]('/api/webbar',require(_0xe7b2('0x100')));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x101'),clientSideLogs);_0x399697[_0xe7b2('0x8')]('/apidoc',express[_0xe7b2('0x102')](path[_0xe7b2('0x103')](config[_0xe7b2('0x104')],_0xe7b2('0x105'))));_0x399697[_0xe7b2('0x8')]('/www',express[_0xe7b2('0x102')](path[_0xe7b2('0x103')](config[_0xe7b2('0x104')],'/www')));_0x399697['use']('/demo',express[_0xe7b2('0x102')](path[_0xe7b2('0x103')](config[_0xe7b2('0x104')],_0xe7b2('0x106'))));_0x399697[_0xe7b2('0x8')](_0xe7b2('0x107'),express['static'](path['join'](config[_0xe7b2('0x104')],_0xe7b2('0x108'),_0xe7b2('0x109'))));_0x399697['use']('/plugins',express[_0xe7b2('0x102')](path[_0xe7b2('0x103')](config[_0xe7b2('0x104')],_0xe7b2('0x10a'))));_0x399697['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0xe7b2('0x10b')](errors[0x194]);_0x399697[_0xe7b2('0x10c')]('/*')[_0xe7b2('0x10b')](function(_0x42d07c,_0x3c029e){_0x3c029e['sendFile'](path[_0xe7b2('0x10d')](_0x399697[_0xe7b2('0x10b')]('appPath')+'/index.html'));});return _0x399697;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index bdf271f..b25999a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37cc=['lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','jayson/promise'];(function(_0xb89931,_0x461b9e){var _0x324b86=function(_0x4be23d){while(--_0x4be23d){_0xb89931['push'](_0xb89931['shift']());}};_0x324b86(++_0x461b9e);}(_0x37cc,0x185));var _0xc37c=function(_0x1edf37,_0xd7c2fd){_0x1edf37=_0x1edf37-0x0;var _0x4d6ac9=_0x37cc[_0x1edf37];return _0x4d6ac9;};'use strict';var jayson=require(_0xc37c('0x0'));var _=require(_0xc37c('0x1'));var config=require(_0xc37c('0x2'));exports[_0xc37c('0x3')]=function(){return new Promise(function(_0x198089,_0x2bc194){var _0x48bba7={};_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x4')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x6')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x7')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x8')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x9')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0xa')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0xb')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0xc')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0xd')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0xe')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0xf')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x10')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x11')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x12')));_0x48bba7=_['merge'](_0x48bba7,require('../api/mailQueue/mailQueue.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x13')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x14')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x15')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x16')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x17')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x18')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x19')));_0x48bba7=_['merge'](_0x48bba7,require('../api/faxMessage/faxMessage.rpc'));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x1a')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x1b')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/smsAccount/smsAccount.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x1c')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x1d')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x1e')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x1f')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x20')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x21')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x22')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x23')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x24')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x25')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x26')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x27')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x28')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x29')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x2a')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x2b')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x2c')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x2d')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x2e')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x2f')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x30')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x31')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x32')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x33')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x34')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x35')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x36')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x37')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x38')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x39')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x3a')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x3b')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x3c')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x3d')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x3e')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x3f')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/squareProject/squareProject.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x40')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/squareMessage/squareMessage.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x41')));_0x48bba7=_['merge'](_0x48bba7,require(_0xc37c('0x42')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require('../api/plugin/plugin.rpc'));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x43')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x44')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x45')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x46')));_0x48bba7=_[_0xc37c('0x5')](_0x48bba7,require(_0xc37c('0x47')));var _0x167b50=jayson[_0xc37c('0x48')](_0x48bba7)[_0xc37c('0x49')]();var _0x33bf83=config[_0xc37c('0x4a')][_0xc37c('0x4b')]||config[_0xc37c('0x4b')]+0x1;var _0x5234fb=config[_0xc37c('0x4a')]['ip']||_0xc37c('0x4c');_0x167b50['on'](_0xc37c('0x4d'),function(_0x4f73e2){return _0x2bc194(_0x4f73e2);});_0x167b50[_0xc37c('0x3')](_0x33bf83,_0x5234fb,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5234fb,_0x33bf83);require('../config/triggers')['default']();return _0x198089('RPC\x20listening\x20on\x20'+_0x5234fb+':'+_0x33bf83);});});}; \ No newline at end of file +var _0x9342=['../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x9342,0xaa));var _0x2934=function(_0x45fbe7,_0x3bfca6){_0x45fbe7=_0x45fbe7-0x0;var _0x342dac=_0x9342[_0x45fbe7];return _0x342dac;};'use strict';var jayson=require(_0x2934('0x0'));var _=require(_0x2934('0x1'));var config=require(_0x2934('0x2'));exports[_0x2934('0x3')]=function(){return new Promise(function(_0x56df8e,_0x537fcd){var _0x2f1216={};_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x5')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/voiceExtension/voiceExtension.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x6')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x7')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x8')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x9')));_0x2f1216=_['merge'](_0x2f1216,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xa')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xb')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xc')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xd')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xe')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0xf')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x10')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/mailInteraction/mailInteraction.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x11')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x12')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x13')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x14')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x15')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x16')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x17')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x18')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2f1216=_['merge'](_0x2f1216,require('../api/smsAccount/smsAccount.rpc'));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x19')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x1a')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/smsQueue/smsQueue.rpc'));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x1b')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x1c')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2f1216=_['merge'](_0x2f1216,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/chatInteraction/chatInteraction.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/chatMessage/chatMessage.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x1d')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x1e')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x1f')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x20')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x21')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x22')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x23')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x24')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x25')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x26')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x27')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x28')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x29')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x2a')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x2b')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x2c')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x2d')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2f1216=_['merge'](_0x2f1216,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x2e')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x2f')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x30')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x31')));_0x2f1216=_['merge'](_0x2f1216,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x32')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x33')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x34')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x35')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x36')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x37')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x38')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x39')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x3a')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x3b')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x3c')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x3d')));_0x2f1216=_[_0x2934('0x4')](_0x2f1216,require(_0x2934('0x3e')));_0x2f1216=_['merge'](_0x2f1216,require(_0x2934('0x3f')));var _0x1eb55d=jayson[_0x2934('0x40')](_0x2f1216)['http']();var _0x4ae146=config['rpc'][_0x2934('0x41')]||config[_0x2934('0x41')]+0x1;var _0x3c0948=config[_0x2934('0x42')]['ip']||_0x2934('0x43');_0x1eb55d['on'](_0x2934('0x44'),function(_0x4103da){return _0x537fcd(_0x4103da);});_0x1eb55d[_0x2934('0x3')](_0x4ae146,_0x3c0948,function(){console[_0x2934('0x45')](_0x2934('0x46'),_0x3c0948,_0x4ae146);require(_0x2934('0x47'))[_0x2934('0x48')]();return _0x56df8e(_0x2934('0x49')+_0x3c0948+':'+_0x4ae146);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e0508da..959d37f 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 _0x0eea=['exports','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','ready','line','toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x534ef0,_0x1c9245){var _0x91e43a=function(_0x507bde){while(--_0x507bde){_0x534ef0['push'](_0x534ef0['shift']());}};_0x91e43a(++_0x1c9245);}(_0x0eea,0xdc));var _0xa0ee=function(_0x342fc0,_0x584072){_0x342fc0=_0x342fc0-0x0;var _0x58f7a9=_0x0eea[_0x342fc0];return _0x58f7a9;};'use strict';var util=require('util');var _=require(_0xa0ee('0x0'));var EventEmitter=require(_0xa0ee('0x1'))[_0xa0ee('0x2')];var AGIReply=require(_0xa0ee('0x3'));var AGIError=require('./error');function AGIChannel(_0x4d88d1){var _0x121e6d=this,_0xd77ec5=new AGIReply(),_0xa24ef5=![],_0x353920={};EventEmitter[_0xa0ee('0x4')](_0x121e6d);_0x4d88d1[_0xa0ee('0x5')](_0xa0ee('0x6'));_0x4d88d1['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0xd77ec5['setEncoding'](_0xa0ee('0x6'));_0xd77ec5['on']('headers',function(_0x2cf6e1){for(var _0x21f6be in _0x2cf6e1){_0x121e6d[_0x21f6be]=_0x2cf6e1[_0x21f6be];}_0x121e6d['emit'](_0xa0ee('0x7'));});_0xd77ec5['on'](_0xa0ee('0x8'),function(_0x14c85d){if(_0x14c85d[_0xa0ee('0x9')]()==_0xa0ee('0xa')){_0x121e6d[_0xa0ee('0xb')](_0xa0ee('0xa'));return;}if(_0x14c85d[_0xa0ee('0xc')](0x0,0xb)=='520-Invalid'){_0xa24ef5=!![];}if(_0xa24ef5){_0x353920['rx']+=_0x14c85d+'\x0a';if(_0x14c85d[_0xa0ee('0xd')](_0xa0ee('0xe'))!=-0x1){_0xa24ef5=![];}}else{_0x353920['rx']=_0x14c85d;}if(_0xa24ef5){return;}if(typeof _0x353920['cb']==_0xa0ee('0xf')){var _0x5570f7=_0x353920['rx'][_0xa0ee('0xc')](0x0,0x3),_0x2d3add=null,_0x2a2130=null;_0x5570f7=parseInt(_0x5570f7);if(isNaN(_0x5570f7)){_0x353920['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa0ee('0x10')});return;}if(_0x5570f7!=0xc8){_0x353920['cb'](null,{'code':_0x5570f7,'result':-0x1,'extra':'KO'});return;}_0x2d3add=_0x353920['rx'][_0xa0ee('0xc')](0x4)[_0xa0ee('0x11')](_0xa0ee('0x12'),'');if(_0x2d3add[_0xa0ee('0x13')]('\x20')!=-0x1){_0x2d3add=_0x2d3add[_0xa0ee('0x14')](0x0,_0x2d3add[_0xa0ee('0x13')]('\x20'));}if(_[_0xa0ee('0x15')](_0x2d3add,'-1')){_0x2d3add=parseInt(_0x2d3add);}_0x2a2130=_0x353920['rx'][_0xa0ee('0x16')]('\x20');if(_0x2a2130[_0xa0ee('0x17')]==0x3){_0x2a2130=_0x2a2130[0x2]['substring'](0x1,_0x2a2130[0x2]['length']-0x1);}else if(_0x2a2130[_0xa0ee('0x17')]>0x3){var _0x3626af=/\((.+)\)/;var _0x117ab9=_0x353920['rx'][_0xa0ee('0x18')](_0x3626af);if(_0x117ab9){_0x2a2130=_0x117ab9[0x1];}else{_0x2a2130=null;}}else{_0x2a2130=null;}_0x353920['cb'](null,{'code':_0x5570f7,'result':_0x2d3add,'extra':_0x2a2130});}});_0x4d88d1['on'](_0xa0ee('0x19'),function(_0x47d0dc){_0x121e6d[_0xa0ee('0xb')](_0xa0ee('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x47d0dc['code']));});_0x4d88d1['on'](_0xa0ee('0x1a'),function(){_0x121e6d[_0xa0ee('0xb')](_0xa0ee('0x1a'),new AGIError(_0xa0ee('0x1b')));});_0x4d88d1['on'](_0xa0ee('0x1c'),function(){_0x121e6d['emit'](_0xa0ee('0x1c'),new AGIError(_0xa0ee('0x1d')));_0x4d88d1['destroy']();});_0x4d88d1[_0xa0ee('0x1e')](_0xd77ec5);this[_0xa0ee('0x1f')]=function(_0x42a427,_0x4f710d){var _0x42a427=_0x42a427||'',_0x4f710d=typeof _0x4f710d==_0xa0ee('0xf')?_0x4f710d:new Function();_0x353920={'tx':_0x42a427,'rx':'','cb':_0x4f710d};_0x4d88d1[_0xa0ee('0x20')](_0x42a427+'\x0a');},this['close']=function(){_0x4d88d1[_0xa0ee('0x21')]();};}util[_0xa0ee('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xa0ee('0x23')]['sendRequest']=function(_0x40581c){return this['command'][_0xa0ee('0x24')](this,_0x40581c);};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x25')]=function(){return this[_0xa0ee('0x26')](_0xa0ee('0x27'));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x28')]=function(_0x174937,_0x300a41,_0x43bd1a){_0x174937=_0x174937===undefined?_0xa0ee('0x29'):_0x174937;_0x300a41=_0x300a41===undefined?'5':_0x300a41;_0x43bd1a=_0x43bd1a===undefined?'1':_0x43bd1a;return this[_0xa0ee('0x26')](util['format'](_0xa0ee('0x2a'),_0x174937,_0x300a41*0x3e8,_0x43bd1a));};AGIChannel['prototype']['noop']=function(_0x4a5e3b){_0x4a5e3b=_0x4a5e3b||_0xa0ee('0x2b');return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')]('VERBOSE\x20\x22%s\x22',_0x4a5e3b));};AGIChannel['prototype'][_0xa0ee('0x2d')]=function(_0x267a81,_0xf05d2e){if(_[_0xa0ee('0x2e')](_0xf05d2e)){return this['sendRequest'](util[_0xa0ee('0x2c')](_0xa0ee('0x2f'),_0x267a81,_0xf05d2e[_0xa0ee('0x30')](',')));}return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')]('EXEC\x20%s\x20%s',_0x267a81,_0xf05d2e));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x31')]=function(_0x3f82e2){return this['sendRequest'](util[_0xa0ee('0x2c')](_0xa0ee('0x32'),_0x3f82e2));};AGIChannel[_0xa0ee('0x23')]['setExtension']=function(_0x2019a4){return this['sendRequest'](util['format']('SET\x20EXTENSION\x20%s',_0x2019a4));};AGIChannel[_0xa0ee('0x23')]['setPriority']=function(_0x3fb0c4){return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')]('SET\x20PRIORITY\x20%s',_0x3fb0c4));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0xa')]=function(){return this['sendRequest'](_0xa0ee('0x33'));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x34')]=function(_0x4bb721,_0x44c40d){var _0x26b502=_[_0xa0ee('0x35')](_0x44c40d)||_['isNumber'](_0x44c40d)?_0x44c40d['toString']():_0x44c40d;return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')](_0xa0ee('0x36'),_0x4bb721,_0x26b502?_0x26b502['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa0ee('0x23')]['sayNumber']=function(_0x5eae0d,_0x5972d4){return this['sendRequest'](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x5eae0d,_0x5972d4));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x37')]=function(_0x14def7,_0x5699a2){return this['sendRequest'](util[_0xa0ee('0x2c')](_0xa0ee('0x38'),_0x14def7,_0x5699a2));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x39')]=function(_0x563b30,_0x18334d){return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')](_0xa0ee('0x3a'),_0x563b30,_0x18334d));};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x3b')]=function(_0x34ac29,_0x34147e,_0x4c4b5e){_0x34147e=_0x34147e||this[_0xa0ee('0x3c')];_0x4c4b5e=_0x4c4b5e||0x1;this[_0xa0ee('0x31')](_0x34ac29);this['setExtension'](_0x34147e);this[_0xa0ee('0x3d')](_0x4c4b5e);return this['noop'](util[_0xa0ee('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x34ac29,_0x34147e,_0x4c4b5e));};AGIChannel['prototype']['getVariable']=function(_0x4ba694){return this[_0xa0ee('0x26')](util[_0xa0ee('0x2c')](_0xa0ee('0x3e'),_0x4ba694));};AGIChannel['prototype'][_0xa0ee('0x3f')]=function(_0x17536d,_0x1a8604,_0x64b127,_0x4b90b5,_0xb9e133,_0x102d84){_0x1a8604=_0x1a8604||_0xa0ee('0x40');_0x64b127=_0x64b127||'';_0x4b90b5=_0x4b90b5===undefined?-0x1:_0x4b90b5==='-1'?-0x1:_0x4b90b5*0x3e8;_0xb9e133=_0xb9e133===undefined?'':'s='+_0xb9e133;_0x102d84=_0x102d84?_0xa0ee('0x41'):'';return this['sendRequest'](util[_0xa0ee('0x2c')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x17536d,_0x1a8604,_0x64b127,_0x4b90b5,_0x102d84,_0xb9e133));};AGIChannel['prototype']['streamFile']=function(_0x2249cb,_0x43943d){_0x43943d=_0x43943d||'';return this['sendRequest'](util[_0xa0ee('0x2c')](_0xa0ee('0x42'),_0x2249cb,_0x43943d));};AGIChannel[_0xa0ee('0x23')]['agi']=function(_0x4f98f1){return this[_0xa0ee('0x2d')](_0xa0ee('0x43'),_0x4f98f1);};AGIChannel[_0xa0ee('0x23')][_0xa0ee('0x44')]=function(_0x465467){return this[_0xa0ee('0x2d')](_0xa0ee('0x45'),_0x465467);};AGIChannel['prototype']['error']=function(_0x11d897,_0x1420b9){this[_0xa0ee('0x46')](util['format'](_0xa0ee('0x47'),_0x11d897['id'],_0x11d897['label'],_0x1420b9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa0ee('0x48')]=AGIChannel; \ No newline at end of file +var _0x3e24=['substring','no\x20code','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','hangup','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','search','520\x20End\x20of\x20proper','function'];(function(_0x2cf93f,_0x13d8b0){var _0xbcd0c3=function(_0x206ed9){while(--_0x206ed9){_0x2cf93f['push'](_0x2cf93f['shift']());}};_0xbcd0c3(++_0x13d8b0);}(_0x3e24,0x167));var _0x43e2=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x3e24[_0x4a45b4];return _0x1a99c9;};'use strict';var util=require(_0x43e2('0x0'));var _=require(_0x43e2('0x1'));var EventEmitter=require(_0x43e2('0x2'))[_0x43e2('0x3')];var AGIReply=require(_0x43e2('0x4'));var AGIError=require('./error');function AGIChannel(_0x2f7153){var _0x1ff04b=this,_0x5d2806=new AGIReply(),_0x1dd127=![],_0x18629c={};EventEmitter[_0x43e2('0x5')](_0x1ff04b);_0x2f7153[_0x43e2('0x6')](_0x43e2('0x7'));_0x2f7153[_0x43e2('0x8')](0x8*0x3c*0x3c*0x3e8);_0x5d2806[_0x43e2('0x6')]('utf8');_0x5d2806['on'](_0x43e2('0x9'),function(_0x2357bc){for(var _0x4bd2ce in _0x2357bc){_0x1ff04b[_0x4bd2ce]=_0x2357bc[_0x4bd2ce];}_0x1ff04b[_0x43e2('0xa')](_0x43e2('0xb'));});_0x5d2806['on']('line',function(_0x2ed387){if(_0x2ed387[_0x43e2('0xc')]()=='hangup'){_0x1ff04b[_0x43e2('0xa')]('hangup');return;}if(_0x2ed387['substring'](0x0,0xb)=='520-Invalid'){_0x1dd127=!![];}if(_0x1dd127){_0x18629c['rx']+=_0x2ed387+'\x0a';if(_0x2ed387[_0x43e2('0xd')](_0x43e2('0xe'))!=-0x1){_0x1dd127=![];}}else{_0x18629c['rx']=_0x2ed387;}if(_0x1dd127){return;}if(typeof _0x18629c['cb']==_0x43e2('0xf')){var _0x44781a=_0x18629c['rx'][_0x43e2('0x10')](0x0,0x3),_0x43ba14=null,_0x68e82d=null;_0x44781a=parseInt(_0x44781a);if(isNaN(_0x44781a)){_0x18629c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43e2('0x11')});return;}if(_0x44781a!=0xc8){_0x18629c['cb'](null,{'code':_0x44781a,'result':-0x1,'extra':'KO'});return;}_0x43ba14=_0x18629c['rx'][_0x43e2('0x10')](0x4)[_0x43e2('0x12')](_0x43e2('0x13'),'');if(_0x43ba14[_0x43e2('0x14')]('\x20')!=-0x1){_0x43ba14=_0x43ba14['substr'](0x0,_0x43ba14[_0x43e2('0x14')]('\x20'));}if(_[_0x43e2('0x15')](_0x43ba14,'-1')){_0x43ba14=parseInt(_0x43ba14);}_0x68e82d=_0x18629c['rx'][_0x43e2('0x16')]('\x20');if(_0x68e82d[_0x43e2('0x17')]==0x3){_0x68e82d=_0x68e82d[0x2]['substring'](0x1,_0x68e82d[0x2]['length']-0x1);}else if(_0x68e82d[_0x43e2('0x17')]>0x3){var _0x417ce5=/\((.+)\)/;var _0x27aa89=_0x18629c['rx'][_0x43e2('0x18')](_0x417ce5);if(_0x27aa89){_0x68e82d=_0x27aa89[0x1];}else{_0x68e82d=null;}}else{_0x68e82d=null;}_0x18629c['cb'](null,{'code':_0x44781a,'result':_0x43ba14,'extra':_0x68e82d});}});_0x2f7153['on'](_0x43e2('0x19'),function(_0x1b7cde){_0x1ff04b[_0x43e2('0xa')](_0x43e2('0x19'),new AGIError(_0x43e2('0x1a'),_0x1b7cde[_0x43e2('0x1b')]));});_0x2f7153['on']('close',function(){_0x1ff04b[_0x43e2('0xa')](_0x43e2('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x2f7153['on'](_0x43e2('0x1d'),function(){_0x1ff04b['emit'](_0x43e2('0x1d'),new AGIError(_0x43e2('0x1e')));_0x2f7153[_0x43e2('0x1f')]();});_0x2f7153[_0x43e2('0x20')](_0x5d2806);this[_0x43e2('0x21')]=function(_0x5ae97b,_0x3b0357){var _0x5ae97b=_0x5ae97b||'',_0x3b0357=typeof _0x3b0357=='function'?_0x3b0357:new Function();_0x18629c={'tx':_0x5ae97b,'rx':'','cb':_0x3b0357};_0x2f7153[_0x43e2('0x22')](_0x5ae97b+'\x0a');},this[_0x43e2('0x1c')]=function(){_0x2f7153[_0x43e2('0x1f')]();};}util[_0x43e2('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x43e2('0x24')]=function(_0xc717d8){return this[_0x43e2('0x21')][_0x43e2('0x25')](this,_0xc717d8);};AGIChannel[_0x43e2('0x26')][_0x43e2('0x27')]=function(){return this[_0x43e2('0x24')](_0x43e2('0x28'));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x29')]=function(_0x1ea844,_0x1de7e1,_0x52ed49){_0x1ea844=_0x1ea844===undefined?_0x43e2('0x2a'):_0x1ea844;_0x1de7e1=_0x1de7e1===undefined?'5':_0x1de7e1;_0x52ed49=_0x52ed49===undefined?'1':_0x52ed49;return this[_0x43e2('0x24')](util['format'](_0x43e2('0x2b'),_0x1ea844,_0x1de7e1*0x3e8,_0x52ed49));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x2c')]=function(_0x404483){_0x404483=_0x404483||_0x43e2('0x2d');return this['sendRequest'](util[_0x43e2('0x2e')](_0x43e2('0x2f'),_0x404483));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x30')]=function(_0x3316d6,_0x30bdcb){if(_['isArray'](_0x30bdcb)){return this['sendRequest'](util[_0x43e2('0x2e')](_0x43e2('0x31'),_0x3316d6,_0x30bdcb[_0x43e2('0x32')](',')));}return this[_0x43e2('0x24')](util[_0x43e2('0x2e')]('EXEC\x20%s\x20%s',_0x3316d6,_0x30bdcb));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x33')]=function(_0x8e220){return this[_0x43e2('0x24')](util[_0x43e2('0x2e')](_0x43e2('0x34'),_0x8e220));};AGIChannel[_0x43e2('0x26')]['setExtension']=function(_0x5c2eac){return this[_0x43e2('0x24')](util[_0x43e2('0x2e')]('SET\x20EXTENSION\x20%s',_0x5c2eac));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x35')]=function(_0x4e79ed){return this[_0x43e2('0x24')](util['format']('SET\x20PRIORITY\x20%s',_0x4e79ed));};AGIChannel['prototype'][_0x43e2('0x36')]=function(){return this['sendRequest'](_0x43e2('0x37'));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x38')]=function(_0x3bb911,_0x44670b){var _0x1f2bea=_[_0x43e2('0x39')](_0x44670b)||_[_0x43e2('0x3a')](_0x44670b)?_0x44670b[_0x43e2('0x3b')]():_0x44670b;return this[_0x43e2('0x24')](util[_0x43e2('0x2e')](_0x43e2('0x3c'),_0x3bb911,_0x1f2bea?_0x1f2bea[_0x43e2('0x3b')]()[_0x43e2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x3d')]=function(_0x16fac0,_0x47f74c){return this['sendRequest'](util['format'](_0x43e2('0x3e'),_0x16fac0,_0x47f74c));};AGIChannel[_0x43e2('0x26')]['sayDigits']=function(_0x5cfde9,_0x2b5fce){return this[_0x43e2('0x24')](util[_0x43e2('0x2e')](_0x43e2('0x3f'),_0x5cfde9,_0x2b5fce));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x40')]=function(_0x2afcdd,_0x3f03e5){return this[_0x43e2('0x24')](util[_0x43e2('0x2e')](_0x43e2('0x41'),_0x2afcdd,_0x3f03e5));};AGIChannel[_0x43e2('0x26')][_0x43e2('0x42')]=function(_0x280074,_0x5e0673,_0xf6b2ae){_0x5e0673=_0x5e0673||this['extension'];_0xf6b2ae=_0xf6b2ae||0x1;this[_0x43e2('0x33')](_0x280074);this['setExtension'](_0x5e0673);this[_0x43e2('0x35')](_0xf6b2ae);return this[_0x43e2('0x2c')](util[_0x43e2('0x2e')]('GOTO\x20%s\x20%s\x20%s',_0x280074,_0x5e0673,_0xf6b2ae));};AGIChannel[_0x43e2('0x26')]['getVariable']=function(_0x1ba4cf){return this[_0x43e2('0x24')](util[_0x43e2('0x2e')](_0x43e2('0x43'),_0x1ba4cf));};AGIChannel['prototype']['recordFile']=function(_0x95b22f,_0x464a8c,_0x2f71e0,_0x3eb498,_0x4a849d,_0x2422b0){_0x464a8c=_0x464a8c||_0x43e2('0x44');_0x2f71e0=_0x2f71e0||'';_0x3eb498=_0x3eb498===undefined?-0x1:_0x3eb498==='-1'?-0x1:_0x3eb498*0x3e8;_0x4a849d=_0x4a849d===undefined?'':'s='+_0x4a849d;_0x2422b0=_0x2422b0?_0x43e2('0x45'):'';return this[_0x43e2('0x24')](util[_0x43e2('0x2e')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x95b22f,_0x464a8c,_0x2f71e0,_0x3eb498,_0x2422b0,_0x4a849d));};AGIChannel[_0x43e2('0x26')]['streamFile']=function(_0x15ea87,_0x37e6b0){_0x37e6b0=_0x37e6b0||'';return this['sendRequest'](util[_0x43e2('0x2e')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x15ea87,_0x37e6b0));};AGIChannel['prototype'][_0x43e2('0x46')]=function(_0x3f61c6){return this[_0x43e2('0x30')](_0x43e2('0x47'),_0x3f61c6);};AGIChannel[_0x43e2('0x26')]['wait']=function(_0x1b001d){return this[_0x43e2('0x30')](_0x43e2('0x48'),_0x1b001d);};AGIChannel[_0x43e2('0x26')][_0x43e2('0x19')]=function(_0x4114ce,_0x29a9ef){this[_0x43e2('0x2c')](util['format'](_0x43e2('0x49'),_0x4114ce['id'],_0x4114ce[_0x43e2('0x4a')],_0x29a9ef));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 45a2d99..2ccad21 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 _0xcabe=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x17262f,_0x3c7ef2){var _0x28d050=function(_0x211f88){while(--_0x211f88){_0x17262f['push'](_0x17262f['shift']());}};_0x28d050(++_0x3c7ef2);}(_0xcabe,0x137));var _0xecab=function(_0x4e7244,_0x1f45c3){_0x4e7244=_0x4e7244-0x0;var _0x5b7108=_0xcabe[_0x4e7244];return _0x5b7108;};'use strict';var util=require(_0xecab('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xecab('0x1'),'E_AGI_SERVER_ERROR':_0xecab('0x2'),'E_AGI_SERVER_CLOSE':_0xecab('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xecab('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xecab('0x5'),'E_AGI_SOCKET_ERROR':_0xecab('0x6'),'E_AGI_SOCKET_CLOSE':_0xecab('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xecab('0x8'),'E_AGI_COMMAND_EMPTY':_0xecab('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xecab('0xa'),'E_AGI_IVR_ENTRY':_0xecab('0xb')};function AGIError(_0x355463){var _0x355463=_0x355463||null,_0x1e01a1=_0x1e01a1||[],_0x5129aa=0x1,_0x513371='';if(!error[_0x355463]){_0x355463=_0xecab('0xc');}_0x1e01a1[_0xecab('0xd')](error[_0x355463]);while(arguments[_0x5129aa]){_0x1e01a1['push'](arguments[_0x5129aa]);_0x5129aa++;}_0x513371=util['format']['apply'](util,_0x1e01a1);this['message']=_0x513371;this[_0xecab('0xe')]=_0x355463;}module[_0xecab('0xf')]=AGIError; \ No newline at end of file +var _0xfeff=['exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','E_AGI_UNDEFINED','push','format','apply','message','name'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xfeff,0x15a));var _0xffef=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xfeff[_0x6cf19c];return _0xce14f3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xffef('0x0'),'E_AGI_ARGUMENT_PORT':_0xffef('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xffef('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xffef('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xffef('0x4'),'E_AGI_SOCKET_ERROR':_0xffef('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xffef('0x6'),'E_AGI_COMMAND_EMPTY':_0xffef('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x59a99e){var _0x59a99e=_0x59a99e||null,_0x2ba061=_0x2ba061||[],_0x5702c6=0x1,_0x57a873='';if(!error[_0x59a99e]){_0x59a99e=_0xffef('0x8');}_0x2ba061[_0xffef('0x9')](error[_0x59a99e]);while(arguments[_0x5702c6]){_0x2ba061['push'](arguments[_0x5702c6]);_0x5702c6++;}_0x57a873=util[_0xffef('0xa')][_0xffef('0xb')](util,_0x2ba061);this[_0xffef('0xc')]=_0x57a873;this[_0xffef('0xd')]=_0x59a99e;}module[_0xffef('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 0cc37b5..45daa42 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e47=['error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','emit'];(function(_0x1e3f0a,_0xe6f64c){var _0x4b4663=function(_0x5df9e0){while(--_0x5df9e0){_0x1e3f0a['push'](_0x1e3f0a['shift']());}};_0x4b4663(++_0xe6f64c);}(_0x5e47,0x147));var _0x75e4=function(_0x38c7e3,_0x34b4bc){_0x38c7e3=_0x38c7e3-0x0;var _0x34b66f=_0x5e47[_0x38c7e3];return _0x34b66f;};'use strict';var _=require(_0x75e4('0x0'));var EventEmitter=require(_0x75e4('0x1'))[_0x75e4('0x2')];var Redis=require(_0x75e4('0x3'));var AGIError=require(_0x75e4('0x4'));var config=require('../../config/environment');config[_0x75e4('0x5')]=_[_0x75e4('0x6')](config[_0x75e4('0x5')],{'host':_0x75e4('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x75e4('0x5')]);sub['subscribe']('agi',function(_0x276eb1){if(_0x276eb1)return eventEmitter[_0x75e4('0x8')](_0x75e4('0x9'),new AGIError(_0x75e4('0xa'),_0x276eb1));});sub['on'](_0x75e4('0xb'),function(_0x115580,_0x2550dd){if(_0x115580!==_0x75e4('0xc'))return;try{var _0x4058e4=JSON[_0x75e4('0xd')](_0x2550dd);eventEmitter[_0x75e4('0x8')](_0x75e4('0xe'),_0x4058e4);}catch(_0x32faa1){eventEmitter['emit']('error',new AGIError(_0x75e4('0xa'),_0x32faa1));}});module[_0x75e4('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x341a=['agi','emit','error','message','parse','E_AGI_SERVER_ERROR','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x341a,0x1ba));var _0xa341=function(_0x5d78ee,_0x135767){_0x5d78ee=_0x5d78ee-0x0;var _0x20ab3d=_0x341a[_0x5d78ee];return _0x20ab3d;};'use strict';var _=require(_0xa341('0x0'));var EventEmitter=require('events')[_0xa341('0x1')];var Redis=require(_0xa341('0x2'));var AGIError=require(_0xa341('0x3'));var config=require(_0xa341('0x4'));config[_0xa341('0x5')]=_['defaults'](config['redis'],{'host':_0xa341('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa341('0x5')]);sub[_0xa341('0x7')](_0xa341('0x8'),function(_0x2b9f2c){if(_0x2b9f2c)return eventEmitter[_0xa341('0x9')](_0xa341('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x2b9f2c));});sub['on'](_0xa341('0xb'),function(_0x28ea2a,_0x2a9212){if(_0x28ea2a!==_0xa341('0x8'))return;try{var _0x5ed29d=JSON[_0xa341('0xc')](_0x2a9212);eventEmitter[_0xa341('0x9')]('projectUpdate',_0x5ed29d);}catch(_0x57197d){eventEmitter[_0xa341('0x9')](_0xa341('0xa'),new AGIError(_0xa341('0xd'),_0x57197d));}});module[_0xa341('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f64af62..4e11710 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 _0xfc47=['getdigits','vertices','edges','numberOfEdges','addVertex','addEdge','size','prototype','relations','getVertex','traverseBFS','info','stop\x20traverse','length','condition','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xfc47,0x192));var _0x7fc4=function(_0x174ac2,_0xa91d82){_0x174ac2=_0x174ac2-0x0;var _0x28ca76=_0xfc47[_0x174ac2];return _0x28ca76;};'use strict';var _=require(_0x7fc4('0x0'));var logger=require('../../../config/logger')(_0x7fc4('0x1'));var verticesWithRetry=[_0x7fc4('0x2'),_0x7fc4('0x3'),'getsecretdigits'];var Graph=function(){this[_0x7fc4('0x4')]={};this[_0x7fc4('0x5')]={};this[_0x7fc4('0x6')]=0x0;};Graph['prototype'][_0x7fc4('0x7')]=function(_0x449e9f){this[_0x7fc4('0x4')][_0x449e9f['id']]=_0x449e9f;this[_0x7fc4('0x5')][_0x449e9f['id']]=[];};Graph['prototype'][_0x7fc4('0x8')]=function(_0x20cff6,_0x525332,_0x3053e8){this[_0x7fc4('0x5')][_0x20cff6]['push']({'target':_0x525332,'condition':_0x3053e8});this[_0x7fc4('0x6')]+=0x1;};Graph['prototype'][_0x7fc4('0x9')]=function(){return _['size'](this[_0x7fc4('0x4')]);};Graph[_0x7fc4('0xa')][_0x7fc4('0xb')]=function(){return this[_0x7fc4('0x6')];};Graph['prototype'][_0x7fc4('0xc')]=function(_0x3712c2){return this['vertices'][_0x3712c2];};Graph[_0x7fc4('0xa')][_0x7fc4('0xd')]=function(_0x4490f4,_0x79d1a4){if(!this['vertices'][_0x4490f4]){return logger['info']('no\x20vertex\x20found');}var _0x25894b=_0x79d1a4(this[_0x7fc4('0x4')][_0x4490f4]);if(!_0x25894b){return logger[_0x7fc4('0xe')](_0x7fc4('0xf'));}if(this[_0x7fc4('0x5')][_0x4490f4]['length']===0x0){return logger[_0x7fc4('0xe')]('no\x20edge/s\x20available');}for(var _0x4dc2c1=0x0,_0x4f721d=[],_0x3392a8=![];_0x4dc2c1\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','evtHangup','then','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','find','handleNotFound','handleUnpublished','initialize','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','connection','close'];(function(_0x1331d3,_0x5e22be){var _0x2e04c7=function(_0x33dadc){while(--_0x33dadc){_0x1331d3['push'](_0x1331d3['shift']());}};_0x2e04c7(++_0x5e22be);}(_0x36d9,0x12c));var _0x936d=function(_0x5c3223,_0x195e56){_0x5c3223=_0x5c3223-0x0;var _0x5ede2d=_0x36d9[_0x5c3223];return _0x5ede2d;};'use strict';var _=require('lodash');var syncho=require('syncho');var util=require('util');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x936d('0x0'));var utilLicense=require(_0x936d('0x1'));var rpc=require(_0x936d('0x2'));var Project=require('./project');var AGIEmitter=require(_0x936d('0x3'))['EventEmitter'];var projects=[];config[_0x936d('0x0')]=_[_0x936d('0x4')](config['agi'],{'ip':_0x936d('0x5'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4fca62){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4fca62);agiHandler(_0x4fca62);}catch(_0x23ec56){logger[_0x936d('0x6')](_0x23ec56['stack']);}});});}function projectUpdateHandler(_0x206334){try{var _0x49748b=_[_0x936d('0x7')](projects,['id',_0x206334['id']]);if(_0x49748b>-0x1){if(_0x206334[_0x936d('0x8')]===!![]){projects[_0x936d('0x9')](_0x49748b,0x1);}else{projects[_0x49748b]=_0x206334;}}else{projects[_0x936d('0xa')](_0x206334);}}catch(_0x2c3bec){logger[_0x936d('0x6')](_0x2c3bec[_0x936d('0xb')]);}}function listeningHandler(){console[_0x936d('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x936d('0x0')][_0x936d('0xd')]);logger[_0x936d('0xe')](util[_0x936d('0xf')](_0x936d('0x10'),config[_0x936d('0x0')]['ip'],config['agi'][_0x936d('0xd')]));}function errorHandler(_0x40c994){if(_0x40c994&&_0x40c994[_0x936d('0x11')]&&_0x40c994['message']){logger['error'](util[_0x936d('0xf')](_0x936d('0x12'),_0x40c994[_0x936d('0x11')],_0x40c994[_0x936d('0x13')]));}else{logger[_0x936d('0x6')](util[_0x936d('0xf')]('[ERROR]\x20%s',_0x40c994[_0x936d('0xb')]));}}function closeHandler(){logger[_0x936d('0xe')](util[_0x936d('0xf')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x936d('0x14')],this[_0x936d('0x15')],this[_0x936d('0x16')],this[_0x936d('0x17')],this['uniqueid']));try{createSquareReport(this);}catch(_0x534479){logger[_0x936d('0x6')](_0x534479['stack']);}}function timeoutHandler(){logger['info'](util[_0x936d('0xf')](_0x936d('0x18'),this[_0x936d('0x14')],this[_0x936d('0x15')],this[_0x936d('0x16')],this[_0x936d('0x17')],this['uniqueid']));}function hangupHandler(){logger[_0x936d('0xe')](util[_0x936d('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x936d('0x14')],this[_0x936d('0x15')],this['callerid'],this[_0x936d('0x17')],this[_0x936d('0x19')]));this[_0x936d('0x1a')]=!![];}function createSquareReport(_0x40ff2a,_0x1ab8b3){rpc['createSquareReport'](_0x40ff2a)[_0x936d('0x1b')](function(_0x58d13a){if(_0x1ab8b3){_0x1ab8b3(null,_0x58d13a);}})['catch'](function(_0x57007a){if(_0x1ab8b3){_0x1ab8b3(null,_0x57007a);}});}function setChannelVariables(_0x1acd56){for(var _0x489718 in _0x1acd56){if(_0x1acd56[_0x936d('0x1c')](_0x489718)){if(_0x489718[_0x936d('0x1d')](_0x936d('0x1e'))===0x0){_0x1acd56[_0x489718[_0x936d('0x1f')](0x4)]=_0x1acd56[_0x489718];delete _0x1acd56[_0x489718];}}}}function agiHandler(_0x4aaef8){logger['debug'](_0x936d('0x20'),JSON[_0x936d('0x21')](_0x4aaef8,null,0x2));logger[_0x936d('0xe')](util[_0x936d('0xf')](_0x936d('0x22'),_0x4aaef8[_0x936d('0x14')],_0x4aaef8[_0x936d('0x15')],_0x4aaef8['callerid'],_0x4aaef8['dnid'],_0x4aaef8[_0x936d('0x19')]));_0x4aaef8['on'](_0x936d('0x6'),errorHandler);_0x4aaef8['on']('close',closeHandler);_0x4aaef8['on']('timeout',timeoutHandler);_0x4aaef8['evtHangup']=![];_0x4aaef8['on'](_0x936d('0x23'),hangupHandler);var _0x512514=_[_0x936d('0x24')](projects,[_0x936d('0x11'),_0x4aaef8['arg_1']]);if(!_0x512514)return Project[_0x936d('0x25')](_0x4aaef8);if(!_0x512514['production'])return Project[_0x936d('0x26')](_0x4aaef8);return Project[_0x936d('0x27')](_0x512514,_0x4aaef8);}function main(){var _0x2923cb;return utilLicense['getLicense']()['then'](function(_0x45149b){if(!_0x45149b)return;if(_0x45149b[_0x936d('0x28')]){if(_0x45149b['callysquare']&&_0x45149b['callysquare']>0x0){logger[_0x936d('0xe')](util[_0x936d('0xf')](_0x936d('0x29'),_0x45149b[_0x936d('0x2a')]));_0x2923cb=_0x45149b[_0x936d('0x2a')];}else{logger[_0x936d('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x936d('0x2b'));_0x2923cb=-0x1;}})[_0x936d('0x1b')](function(){return Project[_0x936d('0x2c')]();})[_0x936d('0x1b')](function(_0x46c9e2){projects=_0x46c9e2;return;})['catch'](function(_0x227bc8){logger[_0x936d('0x6')](_0x936d('0x2d'),_0x227bc8['stack']);})[_0x936d('0x2e')](function(){var _0x217e4b=require(_0x936d('0x2f'))(config['agi']['port'],config['agi']['ip'],_0x2923cb);_0x217e4b['on'](_0x936d('0x6'),errorHandler);_0x217e4b['on']('listening',listeningHandler);_0x217e4b['on'](_0x936d('0x30'),connectionHandler);_0x217e4b['on'](_0x936d('0x31'),closeHandler);});}main(); \ No newline at end of file +var _0x4cad=['info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','format','[%s]\x20%s','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','createSquareReport','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','close','timeout','evtHangup','hangup','find','production','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','connection','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port'];(function(_0x4bd976,_0x1e37e9){var _0x324359=function(_0x317a36){while(--_0x317a36){_0x4bd976['push'](_0x4bd976['shift']());}};_0x324359(++_0x1e37e9);}(_0x4cad,0x105));var _0xd4ca=function(_0x561a57,_0x100c64){_0x561a57=_0x561a57-0x0;var _0x30761b=_0x4cad[_0x561a57];return _0x30761b;};'use strict';var _=require('lodash');var syncho=require(_0xd4ca('0x0'));var util=require('util');var config=require(_0xd4ca('0x1'));var logger=require(_0xd4ca('0x2'))(_0xd4ca('0x3'));var utilLicense=require(_0xd4ca('0x4'));var rpc=require(_0xd4ca('0x5'));var Project=require('./project');var AGIEmitter=require(_0xd4ca('0x6'))[_0xd4ca('0x7')];var projects=[];config[_0xd4ca('0x3')]=_[_0xd4ca('0x8')](config[_0xd4ca('0x3')],{'ip':_0xd4ca('0x9'),'port':0x11dd});AGIEmitter['on'](_0xd4ca('0xa'),projectUpdateHandler);function connectionHandler(_0x454cc7){process[_0xd4ca('0xb')](function(){syncho(function(){try{setChannelVariables(_0x454cc7);agiHandler(_0x454cc7);}catch(_0x21e7b6){logger[_0xd4ca('0xc')](_0x21e7b6[_0xd4ca('0xd')]);}});});}function projectUpdateHandler(_0x49292c){try{var _0x5e603c=_['findIndex'](projects,['id',_0x49292c['id']]);if(_0x5e603c>-0x1){if(_0x49292c[_0xd4ca('0xe')]===!![]){projects[_0xd4ca('0xf')](_0x5e603c,0x1);}else{projects[_0x5e603c]=_0x49292c;}}else{projects[_0xd4ca('0x10')](_0x49292c);}}catch(_0x49beff){logger['error'](_0x49beff[_0xd4ca('0xd')]);}}function listeningHandler(){console['log'](_0xd4ca('0x11'),config['agi'][_0xd4ca('0x12')]);logger[_0xd4ca('0x13')](util['format'](_0xd4ca('0x14'),config[_0xd4ca('0x3')]['ip'],config[_0xd4ca('0x3')][_0xd4ca('0x12')]));}function errorHandler(_0x44ca13){if(_0x44ca13&&_0x44ca13[_0xd4ca('0x15')]&&_0x44ca13['message']){logger[_0xd4ca('0xc')](util[_0xd4ca('0x16')](_0xd4ca('0x17'),_0x44ca13[_0xd4ca('0x15')],_0x44ca13[_0xd4ca('0x18')]));}else{logger[_0xd4ca('0xc')](util[_0xd4ca('0x16')]('[ERROR]\x20%s',_0x44ca13[_0xd4ca('0xd')]));}}function closeHandler(){logger[_0xd4ca('0x13')](util[_0xd4ca('0x16')](_0xd4ca('0x19'),this['arg_1'],this[_0xd4ca('0x1a')],this[_0xd4ca('0x1b')],this[_0xd4ca('0x1c')],this[_0xd4ca('0x1d')]));try{createSquareReport(this);}catch(_0x24a38f){logger[_0xd4ca('0xc')](_0x24a38f['stack']);}}function timeoutHandler(){logger[_0xd4ca('0x13')](util[_0xd4ca('0x16')](_0xd4ca('0x1e'),this[_0xd4ca('0x1f')],this[_0xd4ca('0x1a')],this[_0xd4ca('0x1b')],this['dnid'],this[_0xd4ca('0x1d')]));}function hangupHandler(){logger[_0xd4ca('0x13')](util[_0xd4ca('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd4ca('0x1f')],this[_0xd4ca('0x1a')],this[_0xd4ca('0x1b')],this[_0xd4ca('0x1c')],this[_0xd4ca('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x465cc9,_0x4c5d81){rpc[_0xd4ca('0x20')](_0x465cc9)['then'](function(_0x200d1c){if(_0x4c5d81){_0x4c5d81(null,_0x200d1c);}})[_0xd4ca('0x21')](function(_0x3ec50f){if(_0x4c5d81){_0x4c5d81(null,_0x3ec50f);}});}function setChannelVariables(_0x5739cf){for(var _0xfa883d in _0x5739cf){if(_0x5739cf[_0xd4ca('0x22')](_0xfa883d)){if(_0xfa883d['indexOf'](_0xd4ca('0x23'))===0x0){_0x5739cf[_0xfa883d[_0xd4ca('0x24')](0x4)]=_0x5739cf[_0xfa883d];delete _0x5739cf[_0xfa883d];}}}}function agiHandler(_0x5864e7){logger[_0xd4ca('0x25')](_0xd4ca('0x26'),JSON[_0xd4ca('0x27')](_0x5864e7,null,0x2));logger['info'](util[_0xd4ca('0x16')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5864e7[_0xd4ca('0x1f')],_0x5864e7[_0xd4ca('0x1a')],_0x5864e7[_0xd4ca('0x1b')],_0x5864e7[_0xd4ca('0x1c')],_0x5864e7['uniqueid']));_0x5864e7['on'](_0xd4ca('0xc'),errorHandler);_0x5864e7['on'](_0xd4ca('0x28'),closeHandler);_0x5864e7['on'](_0xd4ca('0x29'),timeoutHandler);_0x5864e7[_0xd4ca('0x2a')]=![];_0x5864e7['on'](_0xd4ca('0x2b'),hangupHandler);var _0x46012b=_[_0xd4ca('0x2c')](projects,[_0xd4ca('0x15'),_0x5864e7[_0xd4ca('0x1f')]]);if(!_0x46012b)return Project['handleNotFound'](_0x5864e7);if(!_0x46012b[_0xd4ca('0x2d')])return Project['handleUnpublished'](_0x5864e7);return Project[_0xd4ca('0x2e')](_0x46012b,_0x5864e7);}function main(){var _0xce3093;return utilLicense['getLicense']()[_0xd4ca('0x2f')](function(_0x1af74a){if(!_0x1af74a)return;if(_0x1af74a[_0xd4ca('0x30')]){if(_0x1af74a[_0xd4ca('0x31')]&&_0x1af74a['callysquare']>0x0){logger[_0xd4ca('0x13')](util[_0xd4ca('0x16')]('[LICENSE]\x20CHANNELS:\x20%s',_0x1af74a[_0xd4ca('0x31')]));_0xce3093=_0x1af74a[_0xd4ca('0x31')];}else{logger['info'](_0xd4ca('0x32'));}}else{logger['info'](_0xd4ca('0x33'));_0xce3093=-0x1;}})['then'](function(){return Project['getAll']();})['then'](function(_0x5a84f6){projects=_0x5a84f6;return;})[_0xd4ca('0x21')](function(_0x3d7f22){logger[_0xd4ca('0xc')](_0xd4ca('0x34'),_0x3d7f22[_0xd4ca('0xd')]);})[_0xd4ca('0x35')](function(){var _0x42a9b8=require(_0xd4ca('0x36'))(config[_0xd4ca('0x3')][_0xd4ca('0x12')],config['agi']['ip'],_0xce3093);_0x42a9b8['on'](_0xd4ca('0xc'),errorHandler);_0x42a9b8['on']('listening',listeningHandler);_0x42a9b8['on'](_0xd4ca('0x37'),connectionHandler);_0x42a9b8['on'](_0xd4ca('0x28'),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 51cdf4f..d04710b 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 _0x6310=['result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6310,0xf6));var _0x0631=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x6310[_0x50aa2e];return _0x5e07f0;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0631('0x0'));var client=jayson[_0x0631('0x1')][_0x0631('0x2')]({'port':0x232b});function request(_0x5650d4,_0x5a81c7){return new BPromise(function(_0x4d06a0,_0x5632cf){return client[_0x0631('0x3')](_0x5650d4,_0x5a81c7)[_0x0631('0x4')](function(_0x2d974c){if(_0x2d974c['error']){return _0x5632cf(_0x2d974c[_0x0631('0x5')][_0x0631('0x6')]);}else{return _0x4d06a0(_0x2d974c[_0x0631('0x7')]);}})[_0x0631('0x8')](function(_0x53caad){return _0x5632cf(_0x53caad);});});}exports[_0x0631('0x9')]=function(_0x4c5e3b,_0x4378a4){return request(_0x0631('0xa'),{'account':_0x4c5e3b,'message':_0x4378a4});}; \ No newline at end of file +var _0x009e=['sendMailMessage','bluebird','jayson/promise','client','http','request','then','error','message','result','catch'];(function(_0x411075,_0x355a0e){var _0x4139f8=function(_0x487455){while(--_0x487455){_0x411075['push'](_0x411075['shift']());}};_0x4139f8(++_0x355a0e);}(_0x009e,0xe8));var _0xe009=function(_0x3137c1,_0x535382){_0x3137c1=_0x3137c1-0x0;var _0x195276=_0x009e[_0x3137c1];return _0x195276;};'use strict';var BPromise=require(_0xe009('0x0'));var jayson=require(_0xe009('0x1'));var client=jayson[_0xe009('0x2')][_0xe009('0x3')]({'port':0x232b});function request(_0x28666d,_0x43a551){return new BPromise(function(_0xce0409,_0x9e4bc7){return client[_0xe009('0x4')](_0x28666d,_0x43a551)[_0xe009('0x5')](function(_0x4fe7cb){if(_0x4fe7cb['error']){return _0x9e4bc7(_0x4fe7cb[_0xe009('0x6')][_0xe009('0x7')]);}else{return _0xce0409(_0x4fe7cb[_0xe009('0x8')]);}})[_0xe009('0x9')](function(_0xd91626){return _0x9e4bc7(_0xd91626);});});}exports[_0xe009('0xa')]=function(_0x8e2861,_0x4bb037){return request('SendMail',{'account':_0x8e2861,'message':_0x4bb037});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 01c3340..3a7e366 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07e1=['catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','context','priority','code','result','evtHangup','response','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','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','close','Project\x20%s\x20not\x20published','exports','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects'];(function(_0x402261,_0x4c3ac8){var _0x15c841=function(_0x27694d){while(--_0x27694d){_0x402261['push'](_0x402261['shift']());}};_0x15c841(++_0x4c3ac8);}(_0x07e1,0x160));var _0x107e=function(_0x347b68,_0xeba5f7){_0x347b68=_0x347b68-0x0;var _0x2504ce=_0x07e1[_0x347b68];return _0x2504ce;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x107e('0x0'));var util=require(_0x107e('0x1'));var logger=require(_0x107e('0x2'))(_0x107e('0x3'));var rpc=require(_0x107e('0x4'));var mailRpc=require('./mailRpc');var Graph=require(_0x107e('0x5'));var Vertices=require(_0x107e('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x107e('0x7')]()[_0x107e('0x8')](function(_0x5ee722){logger[_0x107e('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x5ee722[_0x107e('0xa')]);return[];});}function addVertex(_0x5b37e5,_0x1f3ea3,_0x3760c1){_0x1f3ea3[_0x107e('0xb')]=_0x3760c1;if(_0x1f3ea3[_0x107e('0xc')](_0x107e('0xd'))){_0x1f3ea3[_0x107e('0xe')]=parseInt(_0x1f3ea3['retry'],0xa);}_0x5b37e5[_0x107e('0xf')](_[_0x107e('0x10')](_0x1f3ea3,_0x107e('0x11')));}function initGraph(_0x4100f0,_0x1a8804){var _0x402314=new Graph();for(var _0x2536d4 in _0x4100f0){if(_0x4100f0['hasOwnProperty'](_0x2536d4)){if(_[_0x107e('0x12')](_0x4100f0[_0x2536d4])){for(var _0x437f0a=0x0;_0x437f0a<_0x4100f0[_0x2536d4][_0x107e('0x13')];_0x437f0a+=0x1){addVertex(_0x402314,_0x4100f0[_0x2536d4][_0x437f0a],_0x2536d4);}}else{addVertex(_0x402314,_0x4100f0[_0x2536d4],_0x2536d4);}}}for(var _0x1255f0=0x0;_0x1255f0<_0x1a8804[_0x107e('0x13')];_0x1255f0+=0x1){if(_0x1a8804[_0x1255f0][_0x107e('0x14')]&&_0x1a8804[_0x1255f0]['target']){_0x402314[_0x107e('0x15')](_0x1a8804[_0x1255f0]['source'],_0x1a8804[_0x1255f0]['target'],_0x1a8804[_0x1255f0][_0x107e('0x16')]);}}return _0x402314;}function getRoot(_0x2ac92b){return parser[_0x107e('0x17')](_0x2ac92b,{'object':!![]})[_0x107e('0x18')]['root'];}function inspect(_0x3ba0ad){return util[_0x107e('0x19')](_0x3ba0ad,{'showHidden':![],'depth':null});}function initialize(_0x145fa2,_0x5cf01e){var _0x5b233f=getRoot(_0x145fa2[_0x107e('0x1a')]);if(!_0x5b233f||!_0x5b233f[_0x107e('0x1b')])return;var _0x1703eb,_0x170495,_0x372cc3;logger[_0x107e('0x1c')]('root',JSON[_0x107e('0x1d')](_0x5b233f,null,0x2));_0x5cf01e[_0x107e('0x1e')]=moment()[_0x107e('0x1f')](_0x107e('0x20'));_0x1703eb=initGraph(_[_0x107e('0x10')](_0x5b233f,_0x107e('0x11')),_0x5b233f['mxCell']);_0x170495=new Vertices(_0x5cf01e,rpc,mailRpc);logger[_0x107e('0x21')](util[_0x107e('0x1f')](_0x107e('0x22'),_0x5cf01e[_0x107e('0x23')],_0x5cf01e[_0x107e('0x24')],_0x5cf01e[_0x107e('0x25')],_0x5cf01e[_0x107e('0x26')],_0x5cf01e[_0x107e('0x27')]));_0x1703eb[_0x107e('0x28')](_0x5b233f[_0x107e('0x1b')]['id'],function(_0x46c93f){try{_0x46c93f=_0x170495[_0x107e('0x29')](_0x46c93f);logger[_0x107e('0x1c')](_0x107e('0x2a'),JSON['stringify'](_0x46c93f,null,0x2));if(_0x46c93f[_0x107e('0xb')]==='gotoc'){logger[_0x107e('0x21')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5cf01e[_0x107e('0x2b')]=_0x46c93f[_0x107e('0x2b')]||_0x5cf01e['context'];_0x5cf01e['extension']=_0x46c93f['extension'];_0x5cf01e[_0x107e('0x2c')]=_0x46c93f['priority']?_0x46c93f[_0x107e('0x2c')]-0x1:0x1;return null;}else if(_0x46c93f&&_0x170495[_0x46c93f[_0x107e('0xb')]]){_0x372cc3=_0x170495[_0x46c93f[_0x107e('0xb')]](_0x46c93f);logger[_0x107e('0x21')]('response',JSON[_0x107e('0x1d')](_0x372cc3,null,0x2));if(_0x372cc3&&_0x372cc3[_0x107e('0x2d')]===AGI_CODE_SUCCESS&&_0x372cc3[_0x107e('0x2e')]!==AGI_RESULT_ERROR&&!_0x5cf01e[_0x107e('0x2f')]){logger[_0x107e('0x1c')](_0x107e('0x30'),inspect(_0x372cc3));return _[_0x107e('0x31')](_0x372cc3[_0x107e('0x2e')])?null:_0x372cc3[_0x107e('0x2e')][_0x107e('0x32')]();}else{logger[_0x107e('0x9')](_0x107e('0x30'),inspect(_0x372cc3));return null;}}else{logger['error'](_0x107e('0x33'));return null;}}catch(_0x32c522){logger[_0x107e('0x9')](_0x32c522[_0x107e('0xa')]);return null;}});if(_0x5b233f[_0x107e('0x34')]){logger[_0x107e('0x21')](util['format'](_0x107e('0x35'),_0x5cf01e[_0x107e('0x23')],_0x5cf01e[_0x107e('0x24')],_0x5cf01e[_0x107e('0x25')],_0x5cf01e[_0x107e('0x26')],_0x5cf01e['uniqueid']));_0x1703eb[_0x107e('0x28')](_0x5b233f[_0x107e('0x34')]['id'],function(_0x568f37){try{_0x568f37=_0x170495[_0x107e('0x29')](_0x568f37);logger[_0x107e('0x1c')](_0x107e('0x2a'),JSON[_0x107e('0x1d')](_0x568f37,null,0x2));if(_0x568f37&&_0x170495[_0x568f37[_0x107e('0xb')]]){_0x372cc3=_0x170495[_0x568f37[_0x107e('0xb')]](_0x568f37);if(_0x372cc3){logger[_0x107e('0x1c')](_0x107e('0x30'),inspect(_0x372cc3));return _['isUndefined'](_0x372cc3[_0x107e('0x2e')])?null:_0x372cc3['result'][_0x107e('0x32')]();}else{logger[_0x107e('0x9')]('response',inspect(_0x372cc3));return null;}}else{logger[_0x107e('0x9')](_0x107e('0x33'));return null;}}catch(_0x5500e6){logger[_0x107e('0x9')](_0x5500e6[_0x107e('0xa')]);return null;}});}logger[_0x107e('0x21')](util[_0x107e('0x1f')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5cf01e[_0x107e('0x23')],_0x5cf01e['calleridname'],_0x5cf01e[_0x107e('0x25')],_0x5cf01e[_0x107e('0x26')],_0x5cf01e[_0x107e('0x27')]));logger[_0x107e('0x21')](util[_0x107e('0x1f')](_0x107e('0x36'),_0x5cf01e[_0x107e('0x2b')],_0x5cf01e[_0x107e('0x37')],parseInt(_0x5cf01e[_0x107e('0x2c')],0xa)+0x1));_0x5cf01e[_0x107e('0x38')](_0x5cf01e[_0x107e('0x2b')],_0x5cf01e[_0x107e('0x37')],parseInt(_0x5cf01e[_0x107e('0x2c')],0xa)+0x1);_0x5cf01e[_0x107e('0x39')]();}function handleNotFound(_0xf6d2ca){logger[_0x107e('0x9')](util[_0x107e('0x1f')]('Project\x20%s\x20not\x20found',_0xf6d2ca['arg_1']));_0xf6d2ca[_0x107e('0x38')](_0xf6d2ca[_0x107e('0x2b')],_0xf6d2ca['extension'],parseInt(_0xf6d2ca[_0x107e('0x2c')],0xa)+0x1);_0xf6d2ca['close']();}function handleUnpublished(_0x5d6c99){logger['error'](util[_0x107e('0x1f')](_0x107e('0x3a'),_0x5d6c99['arg_1']));_0x5d6c99[_0x107e('0x38')](_0x5d6c99['context'],_0x5d6c99[_0x107e('0x37')],parseInt(_0x5d6c99['priority'],0xa)+0x1);_0x5d6c99[_0x107e('0x39')]();}module[_0x107e('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7cac=['debug','isUndefined','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','agi','./mailRpc','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','maxRetry','retry','mxCell','isArray','length','source','target','value','root','production','start','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','evtHangup'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x7cac,0xb7));var _0xc7ca=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x7cac[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var moment=require(_0xc7ca('0x0'));var parser=require(_0xc7ca('0x1'));var util=require(_0xc7ca('0x2'));var logger=require('../../config/logger')(_0xc7ca('0x3'));var rpc=require('./rpc');var mailRpc=require(_0xc7ca('0x4'));var Graph=require('./graph');var Vertices=require(_0xc7ca('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc7ca('0x6')]()['catch'](function(_0x3b2749){logger[_0xc7ca('0x7')](_0xc7ca('0x8'),_0x3b2749[_0xc7ca('0x9')]);return[];});}function addVertex(_0x2b48a8,_0x445085,_0x4f1180){_0x445085['agicommand']=_0x4f1180;if(_0x445085[_0xc7ca('0xa')]('retry')){_0x445085[_0xc7ca('0xb')]=parseInt(_0x445085[_0xc7ca('0xc')],0xa);}_0x2b48a8['addVertex'](_['omit'](_0x445085,_0xc7ca('0xd')));}function initGraph(_0x287b61,_0x16419e){var _0x33fba1=new Graph();for(var _0x39ec8a in _0x287b61){if(_0x287b61[_0xc7ca('0xa')](_0x39ec8a)){if(_[_0xc7ca('0xe')](_0x287b61[_0x39ec8a])){for(var _0x5ec96e=0x0;_0x5ec96e<_0x287b61[_0x39ec8a][_0xc7ca('0xf')];_0x5ec96e+=0x1){addVertex(_0x33fba1,_0x287b61[_0x39ec8a][_0x5ec96e],_0x39ec8a);}}else{addVertex(_0x33fba1,_0x287b61[_0x39ec8a],_0x39ec8a);}}}for(var _0x494178=0x0;_0x494178<_0x16419e[_0xc7ca('0xf')];_0x494178+=0x1){if(_0x16419e[_0x494178][_0xc7ca('0x10')]&&_0x16419e[_0x494178][_0xc7ca('0x11')]){_0x33fba1['addEdge'](_0x16419e[_0x494178][_0xc7ca('0x10')],_0x16419e[_0x494178]['target'],_0x16419e[_0x494178][_0xc7ca('0x12')]);}}return _0x33fba1;}function getRoot(_0x1ea1bf){return parser['toJson'](_0x1ea1bf,{'object':!![]})['mxGraphModel'][_0xc7ca('0x13')];}function inspect(_0x33cf14){return util['inspect'](_0x33cf14,{'showHidden':![],'depth':null});}function initialize(_0x1aa049,_0x571c5f){var _0x500c6a=getRoot(_0x1aa049[_0xc7ca('0x14')]);if(!_0x500c6a||!_0x500c6a[_0xc7ca('0x15')])return;var _0x2f8f3d,_0x5c9496,_0xd0ddb;logger['debug']('root',JSON[_0xc7ca('0x16')](_0x500c6a,null,0x2));_0x571c5f[_0xc7ca('0x17')]=moment()[_0xc7ca('0x18')](_0xc7ca('0x19'));_0x2f8f3d=initGraph(_['omit'](_0x500c6a,_0xc7ca('0xd')),_0x500c6a['mxCell']);_0x5c9496=new Vertices(_0x571c5f,rpc,mailRpc);logger[_0xc7ca('0x1a')](util[_0xc7ca('0x18')](_0xc7ca('0x1b'),_0x571c5f[_0xc7ca('0x1c')],_0x571c5f[_0xc7ca('0x1d')],_0x571c5f[_0xc7ca('0x1e')],_0x571c5f[_0xc7ca('0x1f')],_0x571c5f[_0xc7ca('0x20')]));_0x2f8f3d[_0xc7ca('0x21')](_0x500c6a[_0xc7ca('0x15')]['id'],function(_0x86c82d){try{_0x86c82d=_0x5c9496[_0xc7ca('0x22')](_0x86c82d);logger['debug'](_0xc7ca('0x23'),JSON[_0xc7ca('0x16')](_0x86c82d,null,0x2));if(_0x86c82d['agicommand']==='gotoc'){logger[_0xc7ca('0x1a')](_0xc7ca('0x24'));_0x571c5f['context']=_0x86c82d[_0xc7ca('0x25')]||_0x571c5f['context'];_0x571c5f[_0xc7ca('0x26')]=_0x86c82d[_0xc7ca('0x26')];_0x571c5f[_0xc7ca('0x27')]=_0x86c82d[_0xc7ca('0x27')]?_0x86c82d['priority']-0x1:0x1;return null;}else if(_0x86c82d&&_0x5c9496[_0x86c82d['agicommand']]){_0xd0ddb=_0x5c9496[_0x86c82d[_0xc7ca('0x28')]](_0x86c82d);logger[_0xc7ca('0x1a')](_0xc7ca('0x29'),JSON[_0xc7ca('0x16')](_0xd0ddb,null,0x2));if(_0xd0ddb&&_0xd0ddb[_0xc7ca('0x2a')]===AGI_CODE_SUCCESS&&_0xd0ddb[_0xc7ca('0x2b')]!==AGI_RESULT_ERROR&&!_0x571c5f[_0xc7ca('0x2c')]){logger[_0xc7ca('0x2d')](_0xc7ca('0x29'),inspect(_0xd0ddb));return _[_0xc7ca('0x2e')](_0xd0ddb[_0xc7ca('0x2b')])?null:_0xd0ddb[_0xc7ca('0x2b')]['toString']();}else{logger[_0xc7ca('0x7')](_0xc7ca('0x29'),inspect(_0xd0ddb));return null;}}else{logger[_0xc7ca('0x7')]('agicommand\x20not\x20found');return null;}}catch(_0x1756a3){logger[_0xc7ca('0x7')](_0x1756a3[_0xc7ca('0x9')]);return null;}});if(_0x500c6a['finally']){logger[_0xc7ca('0x1a')](util[_0xc7ca('0x18')](_0xc7ca('0x2f'),_0x571c5f[_0xc7ca('0x1c')],_0x571c5f[_0xc7ca('0x1d')],_0x571c5f[_0xc7ca('0x1e')],_0x571c5f[_0xc7ca('0x1f')],_0x571c5f[_0xc7ca('0x20')]));_0x2f8f3d[_0xc7ca('0x21')](_0x500c6a['finally']['id'],function(_0x378aa4){try{_0x378aa4=_0x5c9496[_0xc7ca('0x22')](_0x378aa4);logger[_0xc7ca('0x2d')](_0xc7ca('0x23'),JSON[_0xc7ca('0x16')](_0x378aa4,null,0x2));if(_0x378aa4&&_0x5c9496[_0x378aa4[_0xc7ca('0x28')]]){_0xd0ddb=_0x5c9496[_0x378aa4[_0xc7ca('0x28')]](_0x378aa4);if(_0xd0ddb){logger[_0xc7ca('0x2d')]('response',inspect(_0xd0ddb));return _[_0xc7ca('0x2e')](_0xd0ddb[_0xc7ca('0x2b')])?null:_0xd0ddb[_0xc7ca('0x2b')][_0xc7ca('0x30')]();}else{logger[_0xc7ca('0x7')](_0xc7ca('0x29'),inspect(_0xd0ddb));return null;}}else{logger[_0xc7ca('0x7')](_0xc7ca('0x31'));return null;}}catch(_0x814962){logger['error'](_0x814962[_0xc7ca('0x9')]);return null;}});}logger['info'](util[_0xc7ca('0x18')](_0xc7ca('0x32'),_0x571c5f[_0xc7ca('0x1c')],_0x571c5f['calleridname'],_0x571c5f[_0xc7ca('0x1e')],_0x571c5f[_0xc7ca('0x1f')],_0x571c5f[_0xc7ca('0x20')]));logger[_0xc7ca('0x1a')](util[_0xc7ca('0x18')](_0xc7ca('0x33'),_0x571c5f['context'],_0x571c5f[_0xc7ca('0x26')],parseInt(_0x571c5f[_0xc7ca('0x27')],0xa)+0x1));_0x571c5f['continueAt'](_0x571c5f[_0xc7ca('0x25')],_0x571c5f[_0xc7ca('0x26')],parseInt(_0x571c5f[_0xc7ca('0x27')],0xa)+0x1);_0x571c5f[_0xc7ca('0x34')]();}function handleNotFound(_0x393c54){logger[_0xc7ca('0x7')](util['format'](_0xc7ca('0x35'),_0x393c54['arg_1']));_0x393c54[_0xc7ca('0x36')](_0x393c54[_0xc7ca('0x25')],_0x393c54[_0xc7ca('0x26')],parseInt(_0x393c54[_0xc7ca('0x27')],0xa)+0x1);_0x393c54[_0xc7ca('0x34')]();}function handleUnpublished(_0x1a99d8){logger[_0xc7ca('0x7')](util['format'](_0xc7ca('0x37'),_0x1a99d8[_0xc7ca('0x1c')]));_0x1a99d8[_0xc7ca('0x36')](_0x1a99d8['context'],_0x1a99d8['extension'],parseInt(_0x1a99d8['priority'],0xa)+0x1);_0x1a99d8[_0xc7ca('0x34')]();}module[_0xc7ca('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 7b0c0ae..3e602fe 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 _0x9643=['toString','indexOf','substring','split','slice','trim','headers','emit','line','util','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x9643,0x119));var _0x3964=function(_0xa99202,_0xca104b){_0xa99202=_0xa99202-0x0;var _0x9ba6d2=_0x9643[_0xa99202];return _0x9ba6d2;};'use strict';var util=require(_0x3964('0x0'));var Transform=require('stream')[_0x3964('0x1')];function AGIReply(_0x3b52a7){Transform[_0x3964('0x2')](this,_0x3b52a7);this[_0x3964('0x3')]='';this[_0x3964('0x4')]=![];}util[_0x3964('0x5')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x532139,_0x44a6f4,_0x20a2b6){var _0x296b6a='\x0a',_0x4a264a=['\x0a\x0a',_0x3964('0x6')],_0x2dd199=-0x1,_0x2406a4=-0x1,_0x53c312='',_0x5bece1=0x0,_0x193a70='',_0x29e1d4='';this[_0x3964('0x3')]+=_0x532139[_0x3964('0x7')]();_0x193a70=this[_0x3964('0x3')];if(!this[_0x3964('0x4')]){_0x5bece1=0x0;while(_0x4a264a[_0x5bece1]){while((_0x2406a4=_0x193a70[_0x3964('0x8')](_0x4a264a[_0x5bece1]))!=-0x1){_0x53c312=_0x4a264a[_0x5bece1];_0x29e1d4=_0x193a70['substring'](0x0,_0x2406a4);_0x193a70=_0x193a70[_0x3964('0x9')](_0x2406a4+_0x53c312['length']);var _0x38c836=_0x29e1d4[_0x3964('0xa')](_0x296b6a),_0x540689=0x0,_0x467d28={},_0x7d1de3='',_0x8397f='',_0xcfd859=-0x1;while(_0x38c836[_0x540689]){_0xcfd859=_0x38c836[_0x540689]['indexOf'](':');if(_0xcfd859!=-0x1){_0x7d1de3=_0x38c836[_0x540689]['slice'](0x0,_0xcfd859)['trim']();_0x8397f=_0x38c836[_0x540689][_0x3964('0xb')](_0xcfd859+0x1)[_0x3964('0xc')]();if(_0x7d1de3['length']>0x0){_0x467d28[_0x7d1de3]=_0x8397f;}}else{}_0x540689++;}this['emit'](_0x3964('0xd'),_0x467d28);this['_inBody']=!![];}_0x5bece1++;}this['_localBuffer']=_0x193a70;}else{while((_0x2dd199=_0x193a70[_0x3964('0x8')](_0x296b6a))!=-0x1){_0x29e1d4=_0x193a70[_0x3964('0x9')](0x0,_0x2dd199);this[_0x3964('0xe')](_0x3964('0xf'),_0x29e1d4);_0x193a70=_0x193a70[_0x3964('0x9')](_0x2dd199+_0x296b6a['length']);}this['_localBuffer']=_0x193a70;}_0x20a2b6();};module['exports']=AGIReply; \ No newline at end of file +var _0xe605=['emit','line','util','stream','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim'];(function(_0x59d141,_0x39d2b3){var _0x539c04=function(_0x5c0806){while(--_0x5c0806){_0x59d141['push'](_0x59d141['shift']());}};_0x539c04(++_0x39d2b3);}(_0xe605,0x92));var _0x5e60=function(_0x2c1cb4,_0x570417){_0x2c1cb4=_0x2c1cb4-0x0;var _0x2f894c=_0xe605[_0x2c1cb4];return _0x2f894c;};'use strict';var util=require(_0x5e60('0x0'));var Transform=require(_0x5e60('0x1'))['Transform'];function AGIReply(_0x36add0){Transform[_0x5e60('0x2')](this,_0x36add0);this[_0x5e60('0x3')]='';this[_0x5e60('0x4')]=![];}util[_0x5e60('0x5')](AGIReply,Transform);AGIReply[_0x5e60('0x6')][_0x5e60('0x7')]=function(_0x30d8fb,_0x297ab2,_0xc41535){var _0x1d4a08='\x0a',_0x168a14=['\x0a\x0a',_0x5e60('0x8')],_0x4e3501=-0x1,_0x1c5a6f=-0x1,_0x55ff5c='',_0x593118=0x0,_0x53dccb='',_0x43f7eb='';this[_0x5e60('0x3')]+=_0x30d8fb[_0x5e60('0x9')]();_0x53dccb=this[_0x5e60('0x3')];if(!this[_0x5e60('0x4')]){_0x593118=0x0;while(_0x168a14[_0x593118]){while((_0x1c5a6f=_0x53dccb['indexOf'](_0x168a14[_0x593118]))!=-0x1){_0x55ff5c=_0x168a14[_0x593118];_0x43f7eb=_0x53dccb[_0x5e60('0xa')](0x0,_0x1c5a6f);_0x53dccb=_0x53dccb['substring'](_0x1c5a6f+_0x55ff5c[_0x5e60('0xb')]);var _0x15035f=_0x43f7eb[_0x5e60('0xc')](_0x1d4a08),_0xcf1188=0x0,_0x51e7f6={},_0x371df7='',_0x178782='',_0x1f4e14=-0x1;while(_0x15035f[_0xcf1188]){_0x1f4e14=_0x15035f[_0xcf1188][_0x5e60('0xd')](':');if(_0x1f4e14!=-0x1){_0x371df7=_0x15035f[_0xcf1188][_0x5e60('0xe')](0x0,_0x1f4e14)['trim']();_0x178782=_0x15035f[_0xcf1188][_0x5e60('0xe')](_0x1f4e14+0x1)[_0x5e60('0xf')]();if(_0x371df7[_0x5e60('0xb')]>0x0){_0x51e7f6[_0x371df7]=_0x178782;}}else{}_0xcf1188++;}this[_0x5e60('0x10')]('headers',_0x51e7f6);this[_0x5e60('0x4')]=!![];}_0x593118++;}this['_localBuffer']=_0x53dccb;}else{while((_0x4e3501=_0x53dccb[_0x5e60('0xd')](_0x1d4a08))!=-0x1){_0x43f7eb=_0x53dccb[_0x5e60('0xa')](0x0,_0x4e3501);this['emit'](_0x5e60('0x11'),_0x43f7eb);_0x53dccb=_0x53dccb[_0x5e60('0xa')](_0x4e3501+_0x1d4a08[_0x5e60('0xb')]);}this[_0x5e60('0x3')]=_0x53dccb;}_0xc41535();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b8593fb..4e9277a 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 _0x330c=['merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then','message','result','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x330c,0x186));var _0xc330=function(_0x1b6c38,_0xeb1680){_0x1b6c38=_0x1b6c38-0x0;var _0x138d79=_0x330c[_0x1b6c38];return _0x138d79;};'use strict';var _=require(_0xc330('0x0'));var moment=require(_0xc330('0x1'));var jayson=require(_0xc330('0x2'));var client=jayson[_0xc330('0x3')]['http']({'port':0x2329});function request(_0x17e47c,_0x197a49){return new Promise(function(_0x4552ee,_0x207daa){return client[_0xc330('0x4')](_0x17e47c,_0x197a49)[_0xc330('0x5')](function(_0x4f0e9f){if(_0x4f0e9f['error']){return _0x207daa(_0x4f0e9f['error'][_0xc330('0x6')]);}else{return _0x4552ee(_0x4f0e9f[_0xc330('0x7')]);}})[_0xc330('0x8')](function(_0x114bf0){return _0x207daa(_0x114bf0);});});}exports[_0xc330('0x9')]=function(){return request(_0xc330('0xa'),{'options':{'raw':![],'attributes':['id',_0xc330('0xb'),'production']}});};exports[_0xc330('0xc')]=function(_0x4c1a5f){return request(_0xc330('0xd'),{'options':{'raw':![],'where':{'name':_0x4c1a5f},'attributes':['production']}});};exports[_0xc330('0xe')]=function(_0xb39533){return request(_0xc330('0xf'),{'options':{'raw':![],'where':{'id':_0xb39533},'include':[{'model':_0xc330('0x10'),'as':_0xc330('0x11'),'include':[{'model':_0xc330('0x12'),'as':_0xc330('0x12')}]}],'attributes':['id',_0xc330('0xb'),_0xc330('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x514344){return request(_0xc330('0xd'),{'options':{'where':{'id':_0x514344},'attributes':[_0xc330('0xb')]}});};exports['getVoiceQueueById']=function(_0x425c1a){return request(_0xc330('0x14'),{'options':{'where':{'id':_0x425c1a},'attributes':[_0xc330('0xb')]}});};exports[_0xc330('0x15')]=function(_0x37675c){return request(_0xc330('0x16'),{'options':{'where':{'id':_0x37675c},'attributes':[_0xc330('0xb')]}});};exports[_0xc330('0x17')]=function(_0xd2c004){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xd2c004},'attributes':[_0xc330('0x18')]}});};exports[_0xc330('0x19')]=function(_0x50dc06){return request(_0xc330('0x1a'),{'options':{'where':{'id':_0x50dc06},'attributes':[_0xc330('0xb')]}});};exports[_0xc330('0x1b')]=function(_0x259adc){return request(_0xc330('0x1c'),{'options':{'where':{'phone':_0x259adc['phone']},'attributes':['id']}});};exports[_0xc330('0x1d')]=function(_0x4a4b30){return request(_0xc330('0x1e'),{'options':{'where':{'id':_0x4a4b30},'attributes':[_0xc330('0xb')]}});};exports[_0xc330('0x1f')]=function(_0x2e0e68){return request(_0xc330('0x20'),{'options':{'where':{'id':_0x2e0e68},'attributes':[_0xc330('0x21')]}});};exports[_0xc330('0x22')]=function(_0xf685c7){return request(_0xc330('0x23'),{'options':{'raw':![],'where':{'id':_0xf685c7},'include':[{'model':_0xc330('0x24'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x379b64){return request(_0xc330('0x25'),{'options':{'where':{'id':_0x379b64},'attributes':['id',_0xc330('0xb')]}});};exports[_0xc330('0x26')]=function(_0x162107){return request(_0xc330('0x27'),{'body':_0x162107});};exports[_0xc330('0x28')]=function(_0x93d52c){return request(_0xc330('0x29'),{'body':_0x93d52c});};exports[_0xc330('0x2a')]=function(_0x38cd32){return request(_0xc330('0x2b'),{'body':_[_0xc330('0x2c')](_0x38cd32,{'project_name':_0x38cd32['arg_1'],'prev_project_name':_0x38cd32[_0xc330('0x2d')]||'','is_subproject':_0x38cd32['arg_2']?!![]:![],'leaveAt':moment()[_0xc330('0x2e')](_0xc330('0x2f'))})});};exports[_0xc330('0x30')]=function(_0x4c53eb){return request('CreateSquareRecording',{'body':_0x4c53eb});};exports['createSquareMessage']=function(_0x5b9d4d){return request('CreateSquareMessage',{'body':_0x5b9d4d});};exports[_0xc330('0x31')]=function(_0x25784c){return request(_0xc330('0x32'),{'options':{'raw':![],'where':{'phone':_0x25784c[_0xc330('0x33')],'ListId':_0x25784c[_0xc330('0x34')]}}})[_0xc330('0x5')](function(_0x47e836){if(_0x47e836){return _0x47e836;}return request(_0xc330('0x35'),{'body':_0x25784c});});};exports['getPauseById']=function(_0x171d7b){return request(_0xc330('0x36'),{'options':{'where':{'id':_0x171d7b},'attributes':[_0xc330('0xb')]}});};exports[_0xc330('0x37')]=function(_0x5870fe,_0x2e372a){return request(_0xc330('0x38'),{'body':{'interface':_0x2e372a},'options':{'where':_0x5870fe}});};exports[_0xc330('0x39')]=function(_0x515dfe,_0x112f04,_0x19981d){return request('PauseUser',{'body':{'type':_0x112f04,'uniqueid':_0x19981d},'options':{'where':_0x515dfe}});};exports[_0xc330('0x3a')]=function(_0x140461){return request(_0xc330('0x3b'),{'body':{},'options':{'where':_0x140461}});};exports[_0xc330('0x3c')]=function(_0x2bb7fc){return request(_0xc330('0x3d'),{'body':{},'options':{'where':_0x2bb7fc}});}; \ No newline at end of file +var _0x867f=['message','result','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','CloudProvider','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','GetContactByPhone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','lodash','moment','jayson/promise','client','http','error'];(function(_0x56456,_0x3bbe46){var _0xb7756c=function(_0x106319){while(--_0x106319){_0x56456['push'](_0x56456['shift']());}};_0xb7756c(++_0x3bbe46);}(_0x867f,0xe6));var _0xf867=function(_0x51921f,_0x42bde0){_0x51921f=_0x51921f-0x0;var _0x41743a=_0x867f[_0x51921f];return _0x41743a;};'use strict';var _=require(_0xf867('0x0'));var moment=require(_0xf867('0x1'));var jayson=require(_0xf867('0x2'));var client=jayson[_0xf867('0x3')][_0xf867('0x4')]({'port':0x2329});function request(_0x35da23,_0x28e708){return new Promise(function(_0x394856,_0x333d91){return client['request'](_0x35da23,_0x28e708)['then'](function(_0x31de37){if(_0x31de37[_0xf867('0x5')]){return _0x333d91(_0x31de37[_0xf867('0x5')][_0xf867('0x6')]);}else{return _0x394856(_0x31de37[_0xf867('0x7')]);}})['catch'](function(_0x583f87){return _0x333d91(_0x583f87);});});}exports[_0xf867('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xf867('0x9'),_0xf867('0xa')]}});};exports[_0xf867('0xb')]=function(_0xb26c33){return request(_0xf867('0xc'),{'options':{'raw':![],'where':{'name':_0xb26c33},'attributes':[_0xf867('0xa')]}});};exports[_0xf867('0xd')]=function(_0x3c9a3f){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3c9a3f},'include':[{'model':_0xf867('0xe'),'as':'Smtp','include':[{'model':'CloudProvider','as':_0xf867('0xf')}]}],'attributes':['id',_0xf867('0x9'),_0xf867('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x509378){return request(_0xf867('0xc'),{'options':{'where':{'id':_0x509378},'attributes':['name']}});};exports[_0xf867('0x11')]=function(_0x49ff40){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x49ff40},'attributes':[_0xf867('0x9')]}});};exports[_0xf867('0x12')]=function(_0x7a143e){return request(_0xf867('0x13'),{'options':{'where':{'id':_0x7a143e},'attributes':[_0xf867('0x9')]}});};exports[_0xf867('0x14')]=function(_0x1b02e5){return request(_0xf867('0x15'),{'options':{'where':{'id':_0x1b02e5},'attributes':[_0xf867('0x16')]}});};exports['getUserById']=function(_0x44f6f1){return request('ShowUser',{'options':{'where':{'id':_0x44f6f1},'attributes':[_0xf867('0x9')]}});};exports['getContactByPhone']=function(_0x51bdb3){return request(_0xf867('0x17'),{'options':{'where':{'phone':_0x51bdb3['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x2092af){return request(_0xf867('0x18'),{'options':{'where':{'id':_0x2092af},'attributes':['name']}});};exports['getSoundById']=function(_0xd503ca){return request(_0xf867('0x19'),{'options':{'where':{'id':_0xd503ca},'attributes':[_0xf867('0x1a')]}});};exports[_0xf867('0x1b')]=function(_0x419f75){return request(_0xf867('0x1c'),{'options':{'raw':![],'where':{'id':_0x419f75},'include':[{'model':_0xf867('0x1d'),'as':_0xf867('0x1e')}]}});};exports['getSmsAccountById']=function(_0x568aba){return request(_0xf867('0x1f'),{'options':{'where':{'id':_0x568aba},'attributes':['id','name']}});};exports[_0xf867('0x20')]=function(_0x3fc971){return request('CreateSmsMessage',{'body':_0x3fc971});};exports[_0xf867('0x21')]=function(_0x169f15){return request('CreateSquareDetailsReport',{'body':_0x169f15});};exports[_0xf867('0x22')]=function(_0x42a431){return request(_0xf867('0x23'),{'body':_[_0xf867('0x24')](_0x42a431,{'project_name':_0x42a431[_0xf867('0x25')],'prev_project_name':_0x42a431[_0xf867('0x26')]||'','is_subproject':_0x42a431[_0xf867('0x26')]?!![]:![],'leaveAt':moment()[_0xf867('0x27')](_0xf867('0x28'))})});};exports[_0xf867('0x29')]=function(_0x28b44a){return request(_0xf867('0x2a'),{'body':_0x28b44a});};exports[_0xf867('0x2b')]=function(_0x234fa0){return request(_0xf867('0x2c'),{'body':_0x234fa0});};exports[_0xf867('0x2d')]=function(_0x57bf28){return request(_0xf867('0x2e'),{'options':{'raw':![],'where':{'phone':_0x57bf28[_0xf867('0x2f')],'ListId':_0x57bf28[_0xf867('0x30')]}}})[_0xf867('0x31')](function(_0x350d6d){if(_0x350d6d){return _0x350d6d;}return request(_0xf867('0x32'),{'body':_0x57bf28});});};exports[_0xf867('0x33')]=function(_0x517b9c){return request(_0xf867('0x34'),{'options':{'where':{'id':_0x517b9c},'attributes':[_0xf867('0x9')]}});};exports[_0xf867('0x35')]=function(_0x36ed62,_0x40517f){return request(_0xf867('0x36'),{'body':{'interface':_0x40517f},'options':{'where':_0x36ed62}});};exports[_0xf867('0x37')]=function(_0x450f09,_0x4ffce9,_0x4552f8){return request('PauseUser',{'body':{'type':_0x4ffce9,'uniqueid':_0x4552f8},'options':{'where':_0x450f09}});};exports[_0xf867('0x38')]=function(_0x481c50){return request(_0xf867('0x39'),{'body':{},'options':{'where':_0x481c50}});};exports[_0xf867('0x3a')]=function(_0x346fb7){return request('LogoutUser',{'body':{},'options':{'where':_0x346fb7}});}; \ 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 5e5a7a4..cc76cde 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 _0xe08b=['./polly','exports'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xe08b,0x10e));var _0xbe08=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xe08b[_0x35d4e9];return _0x5c2770;};var polly=require(_0xbe08('0x0'));var lex=require('./lex');module[_0xbe08('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xbedb=['./polly','exports'];(function(_0x2ff026,_0x419a5a){var _0x327889=function(_0x106474){while(--_0x106474){_0x2ff026['push'](_0x2ff026['shift']());}};_0x327889(++_0x419a5a);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};var polly=require(_0xbbed('0x0'));var lex=require('./lex');module[_0xbbed('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9387176..d9810ee 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 _0x91a7=['exports'];(function(_0xe08054,_0x22c584){var _0x5c3e9d=function(_0x3e461a){while(--_0x3e461a){_0xe08054['push'](_0xe08054['shift']());}};_0x5c3e9d(++_0x22c584);}(_0x91a7,0xe7));var _0x791a=function(_0x594122,_0xbdd7a){_0x594122=_0x594122-0x0;var _0x4f3a2d=_0x91a7[_0x594122];return _0x4f3a2d;};'use strict';var lex=require('./lib/api');module[_0x791a('0x0')]=function(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392){return lex(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392);}; \ No newline at end of file +var _0xaa88=['exports','./lib/api'];(function(_0x1fddc6,_0x5885f3){var _0xa7cf0e=function(_0x5658b6){while(--_0x5658b6){_0x1fddc6['push'](_0x1fddc6['shift']());}};_0xa7cf0e(++_0x5885f3);}(_0xaa88,0x137));var _0x8aa8=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xaa88[_0x57b432];return _0x2edf2a;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ 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 b87181d..c9e00eb 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(_0x4bf99b,_0x4b2f68){var _0x3852e6=function(_0x4c6bcf){while(--_0x4c6bcf){_0x4bf99b['push'](_0x4bf99b['shift']());}};_0x3852e6(++_0x4b2f68);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x48dae1,_0x5ed7ce){var _0x48fee6=function(_0x24405d){while(--_0x24405d){_0x48dae1['push'](_0x48dae1['shift']());}};_0x48fee6(++_0x5ed7ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 4da773d..87341be 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 _0xa309=['exports','./lib/api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa309,0xcb));var _0x9a30=function(_0x1199fe,_0x276fd8){_0x1199fe=_0x1199fe-0x0;var _0x444ed3=_0xa309[_0x1199fe];return _0x444ed3;};'use strict';var polly=require(_0x9a30('0x0'));module[_0x9a30('0x1')]=function(_0x1619ee,_0xbbee3d,_0x139453,_0x36166f,_0x14534e,_0x2bbfb4,_0x46d93d){return polly(_0x1619ee,_0xbbee3d,_0x139453,_0x36166f,_0x14534e,_0x2bbfb4,_0x46d93d);}; \ No newline at end of file +var _0x9591=['./lib/api'];(function(_0x40e48a,_0x5b7b5f){var _0x4bc0b3=function(_0x3ecb42){while(--_0x3ecb42){_0x40e48a['push'](_0x40e48a['shift']());}};_0x4bc0b3(++_0x5b7b5f);}(_0x9591,0x64));var _0x1959=function(_0x456eb9,_0x1c225d){_0x456eb9=_0x456eb9-0x0;var _0x32b5ef=_0x9591[_0x456eb9];return _0x32b5ef;};'use strict';var polly=require(_0x1959('0x0'));module['exports']=function(_0x2d50e5,_0x5a2fb2,_0xf27dcb,_0x191267,_0xc8f65d,_0x59176c,_0x9f981e){return polly(_0x2d50e5,_0x5a2fb2,_0xf27dcb,_0x191267,_0xc8f65d,_0x59176c,_0x9f981e);}; \ 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 e161647..0ad263e 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 _0x272a=['mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x1c993a,_0x5148e5){var _0x24b359=function(_0x26abf9){while(--_0x26abf9){_0x1c993a['push'](_0x1c993a['shift']());}};_0x24b359(++_0x5148e5);}(_0x272a,0xc7));var _0xa272=function(_0x5e2faf,_0x9b09a1){_0x5e2faf=_0x5e2faf-0x0;var _0x4a56e7=_0x272a[_0x5e2faf];return _0x4a56e7;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa272('0x0'));var rs=require(_0xa272('0x1'));var AWS=require(_0xa272('0x2'));function pollyResult(_0x155640,_0x4275c3,_0x1ffd3c){return new BPromise(function(_0x2d5fe8,_0x31226f){_0x155640[_0xa272('0x3')](_0x4275c3,function(_0x14bae8,_0x2672c8){if(_0x14bae8){_0x31226f(_0x14bae8);}else if(_0x2672c8){if(_0x2672c8['AudioStream']instanceof Buffer){fs[_0xa272('0x4')](_0x1ffd3c,_0x2672c8[_0xa272('0x5')],function(_0x214b8e){if(_0x214b8e){_0x31226f(_0x214b8e);}else{_0x2d5fe8();}});}else{_0x31226f(new Error(_0xa272('0x6')));}}else{_0x31226f(new Error(_0xa272('0x7')));}});});}module[_0xa272('0x8')]=function(_0x1a12bd,_0x1adb85,_0x40b4fa,_0x4d2973,_0xc72bb6,_0xa97a23,_0x3e4f27){var _0x47d25a=new AWS['Polly']({'accessKeyId':_0x1a12bd,'secretAccessKey':_0x1adb85,'region':_0x40b4fa});var _0x25e8cf={'Text':_0xc72bb6,'TextType':_0xa97a23||_0xa272('0x9'),'OutputFormat':_0xa272('0xa'),'VoiceId':_0x4d2973};return pollyResult(_0x47d25a,_0x25e8cf,_0x3e4f27);}; \ No newline at end of file +var _0x0c7a=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x0c7a,0x108));var _0xa0c7=function(_0xc82985,_0x29f779){_0xc82985=_0xc82985-0x0;var _0x125130=_0x0c7a[_0xc82985];return _0x125130;};'use strict';var fs=require('fs');var path=require(_0xa0c7('0x0'));var BPromise=require(_0xa0c7('0x1'));var rs=require('randomstring');var AWS=require(_0xa0c7('0x2'));function pollyResult(_0x35dff0,_0x97567,_0x32e3d1){return new BPromise(function(_0xdf1bd6,_0x12d321){_0x35dff0['synthesizeSpeech'](_0x97567,function(_0x44850a,_0x20fe77){if(_0x44850a){_0x12d321(_0x44850a);}else if(_0x20fe77){if(_0x20fe77[_0xa0c7('0x3')]instanceof Buffer){fs[_0xa0c7('0x4')](_0x32e3d1,_0x20fe77[_0xa0c7('0x3')],function(_0x1a91ca){if(_0x1a91ca){_0x12d321(_0x1a91ca);}else{_0xdf1bd6();}});}else{_0x12d321(new Error(_0xa0c7('0x5')));}}else{_0x12d321(new Error(_0xa0c7('0x6')));}});});}module[_0xa0c7('0x7')]=function(_0x39c73e,_0x8ce03e,_0x4f9601,_0x4ebc27,_0x594681,_0x306bd4,_0x4d4a2d){var _0x4a42c1=new AWS[(_0xa0c7('0x8'))]({'accessKeyId':_0x39c73e,'secretAccessKey':_0x8ce03e,'region':_0x4f9601});var _0x5d7778={'Text':_0x594681,'TextType':_0x306bd4||'text','OutputFormat':'mp3','VoiceId':_0x4ebc27};return pollyResult(_0x4a42c1,_0x5d7778,_0x4d4a2d);}; \ 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 2941a36..55d3904 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x5396ae,_0x4f6c61,_0x55173d,_0x2bab31){return asr(_0x5396ae,_0x4f6c61,_0x55173d);}; \ No newline at end of file +var _0x28dc=['./lib/api'];(function(_0x23f51b,_0x45d29d){var _0x109a48=function(_0x58d2c5){while(--_0x58d2c5){_0x23f51b['push'](_0x23f51b['shift']());}};_0x109a48(++_0x45d29d);}(_0x28dc,0x75));var _0xc28d=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x28dc[_0x581f8e];return _0x18aec;};'use strict';var asr=require(_0xc28d('0x0'));module['exports']=function(_0x4eb8a3,_0x3f34a2,_0xef4483,_0x45f665){return asr(_0x4eb8a3,_0x3f34a2,_0xef4483);}; \ 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 0433db7..d84d07c 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 _0x07c3=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x1edf1d,_0xf161ae){var _0x2afd23=function(_0x146211){while(--_0x146211){_0x1edf1d['push'](_0x1edf1d['shift']());}};_0x2afd23(++_0xf161ae);}(_0x07c3,0x1bf));var _0x307c=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0x07c3[_0x537c37];return _0x241f84;};'use strict';var url=require(_0x307c('0x0'));var BPromise=require(_0x307c('0x1'));var fs=require('fs');var host=_0x307c('0x2');module[_0x307c('0x3')]=function(_0x39fd38,_0x8b0b1c,_0x3b8f6e){return new BPromise(function(_0x186b09,_0x52cf54){var _0x37adf4;if(typeof _0x39fd38!==_0x307c('0x4')||_0x39fd38[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x6'));}if(typeof _0x8b0b1c!==_0x307c('0x4')||_0x8b0b1c[_0x307c('0x5')]===0x0){return _0x52cf54(_0x307c('0x7'));}if(typeof _0x3b8f6e!==_0x307c('0x8')&&(typeof _0x3b8f6e!==_0x307c('0x4')||_0x3b8f6e[_0x307c('0x5')]===0x0)){return _0x52cf54(_0x307c('0x9'));}try{_0x37adf4=fs[_0x307c('0xa')](_0x39fd38)[_0x307c('0xb')](_0x307c('0xc'));}catch(_0x3c4a4c){return _0x52cf54(_0x3c4a4c);}return _0x186b09({'method':'POST','uri':host+_0x307c('0xd')+_0x8b0b1c,'body':{'config':{'encoding':_0x307c('0xe'),'sampleRateHertz':_0x307c('0xf'),'languageCode':_0x3b8f6e},'audio':{'content':_0x37adf4}},'json':!![]});});}; \ No newline at end of file +var _0x22fb=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com'];(function(_0x3c9df8,_0x387a5d){var _0x3c8cd3=function(_0x4a0541){while(--_0x4a0541){_0x3c9df8['push'](_0x3c9df8['shift']());}};_0x3c8cd3(++_0x387a5d);}(_0x22fb,0x192));var _0xb22f=function(_0x107b30,_0x3cf675){_0x107b30=_0x107b30-0x0;var _0x420186=_0x22fb[_0x107b30];return _0x420186;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xb22f('0x0');module['exports']=function(_0x3f643d,_0x306b6e,_0x2221f1){return new BPromise(function(_0x10d2c4,_0x201512){var _0x50cdab;if(typeof _0x3f643d!==_0xb22f('0x1')||_0x3f643d[_0xb22f('0x2')]===0x0){return _0x201512(_0xb22f('0x3'));}if(typeof _0x306b6e!==_0xb22f('0x1')||_0x306b6e[_0xb22f('0x2')]===0x0){return _0x201512(_0xb22f('0x4'));}if(typeof _0x2221f1!=='undefined'&&(typeof _0x2221f1!==_0xb22f('0x1')||_0x2221f1[_0xb22f('0x2')]===0x0)){return _0x201512(_0xb22f('0x5'));}try{_0x50cdab=fs[_0xb22f('0x6')](_0x3f643d)[_0xb22f('0x7')](_0xb22f('0x8'));}catch(_0x188cea){return _0x201512(_0x188cea);}return _0x10d2c4({'method':_0xb22f('0x9'),'uri':host+_0xb22f('0xa')+_0x306b6e,'body':{'config':{'encoding':_0xb22f('0xb'),'sampleRateHertz':_0xb22f('0xc'),'languageCode':_0x2221f1},'audio':{'content':_0x50cdab}},'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 2706b44..1902562 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 _0x9939=['exports','./asr'];(function(_0x117150,_0x17e83b){var _0x44fcc0=function(_0x5316ed){while(--_0x5316ed){_0x117150['push'](_0x117150['shift']());}};_0x44fcc0(++_0x17e83b);}(_0x9939,0x1f1));var _0x9993=function(_0x566b3d,_0x66ee7){_0x566b3d=_0x566b3d-0x0;var _0x22eee3=_0x9939[_0x566b3d];return _0x22eee3;};var asr=require(_0x9993('0x0'));module[_0x9993('0x1')]={'asr':asr}; \ No newline at end of file +var _0x108f=['exports'];(function(_0x330f4c,_0x1eaec7){var _0x27f43a=function(_0x53494a){while(--_0x53494a){_0x330f4c['push'](_0x330f4c['shift']());}};_0x27f43a(++_0x1eaec7);}(_0x108f,0x1c5));var _0xf108=function(_0x502033,_0x5c4ba4){_0x502033=_0x502033-0x0;var _0x2f0936=_0x108f[_0x502033];return _0x2f0936;};var asr=require('./asr');module[_0xf108('0x0')]={'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 5782c40..c3f11ac 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 _0xc730=['message','textRequest','source','resolvedQuery','result','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','https','md5','path','querystring','randomstring','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','end','data','transcode','wav','start','resolve','tmp','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','generate','.mp3','from','audioContent','writeFile','.wav','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name'];(function(_0x56f979,_0x55f74c){var _0x32ac3e=function(_0x2b4b70){while(--_0x2b4b70){_0x56f979['push'](_0x56f979['shift']());}};_0x32ac3e(++_0x55f74c);}(_0xc730,0x141));var _0x0c73=function(_0x1ca0db,_0x45a54b){_0x1ca0db=_0x1ca0db-0x0;var _0x5b1a21=_0xc730[_0x1ca0db];return _0x5b1a21;};'use strict';var apiai=require(_0x0c73('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x0c73('0x1'));var md5=require(_0x0c73('0x2'));var path=require(_0x0c73('0x3'));var querystring=require(_0x0c73('0x4'));var rp=require('request-promise');var rs=require(_0x0c73('0x5'));var sox=require('sox');var tts=require(_0x0c73('0x6'));var urlParse=require(_0x0c73('0x7'))['parse'];var util=require(_0x0c73('0x8'));var aws=require(_0x0c73('0x9'));var google=require(_0x0c73('0xa'));var sestek=require(_0x0c73('0xb'));var tilde=require(_0x0c73('0xc'));var logger=require('../../../config/logger')(_0x0c73('0xd'));var ISPEECH_API=_0x0c73('0xe');function downloadFile(_0xaf2e29,_0x252051){return new BPromise(function(_0x56a642,_0x488a33){var _0x473ed7=urlParse(_0xaf2e29);var _0x37abdf=_0x473ed7[_0x0c73('0xf')]===_0x0c73('0x10')?https:http;var _0x531b2c={'host':_0x473ed7[_0x0c73('0x11')],'path':_0x473ed7[_0x0c73('0x3')],'headers':{'user-agent':_0x0c73('0x12')}};_0x37abdf[_0x0c73('0x13')](_0x531b2c,function(_0x22e700){if(_0x22e700[_0x0c73('0x14')]!==0xc8){logger[_0x0c73('0x15')]('request\x20to\x20'+_0xaf2e29+_0x0c73('0x16')+_0x22e700[_0x0c73('0x14')]+'\x20('+_0x22e700[_0x0c73('0x17')]+')');_0x488a33(new Error(_0x0c73('0x18')+_0xaf2e29+_0x0c73('0x16')+_0x22e700[_0x0c73('0x14')]+'\x20('+_0x22e700[_0x0c73('0x17')]+')'));return;}var _0x31a9e6=fs[_0x0c73('0x19')](_0x252051);_0x31a9e6['on'](_0x0c73('0x1a'),function(){logger[_0x0c73('0x1b')](_0x0c73('0x1c'));_0x31a9e6[_0x0c73('0x1d')](_0x56a642);});_0x31a9e6['on'](_0x0c73('0x15'),function(_0x41ded6){fs['unlink'](_0x252051);logger[_0x0c73('0x15')](_0x0c73('0x1e'),_0x41ded6);_0x488a33(_0x41ded6);});_0x22e700['pipe'](_0x31a9e6);})['on'](_0x0c73('0x15'),function(_0x592c0c){logger[_0x0c73('0x15')](_0x592c0c);_0x488a33(_0x592c0c);})[_0x0c73('0x1f')]();});}function uploadFile(_0x535478){return new BPromise(function(_0x219439,_0x221b1c){var _0x51f5e0=urlParse(_0x535478);var _0x11afae=_0x51f5e0[_0x0c73('0xf')]==='https:'?https:http;var _0x4ec168={'host':_0x51f5e0[_0x0c73('0x11')],'path':_0x51f5e0[_0x0c73('0x3')],'headers':{'user-agent':_0x0c73('0x12')}};_0x11afae[_0x0c73('0x13')](_0x4ec168,function(_0xeff432){if(_0xeff432[_0x0c73('0x14')]!==0xc8){_0x221b1c(new Error(_0x0c73('0x18')+_0x535478+_0x0c73('0x16')+_0xeff432[_0x0c73('0x14')]+'\x20('+_0xeff432[_0x0c73('0x17')]+')'));return;}var _0x5c1771='';_0xeff432['on'](_0x0c73('0x20'),function(_0x13e318){_0x5c1771+=_0x13e318;});_0xeff432['on'](_0x0c73('0x1f'),function(){_0x219439(_0x5c1771);});})['on'](_0x0c73('0x15'),function(_0x55fa57){_0x221b1c(_0x55fa57);})[_0x0c73('0x1f')]();});}function convertFile(_0x2e7166,_0x494df3){return new BPromise(function(_0x555110,_0x492b67){var _0x55e40f=sox[_0x0c73('0x21')](_0x2e7166,_0x494df3,{'sampleRate':0x1f40,'format':_0x0c73('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55e40f['on']('error',function(_0x3a9e52){logger[_0x0c73('0x15')]('error\x20convert',_0x3a9e52);_0x492b67(_0x3a9e52);});_0x55e40f['on']('end',function(){logger[_0x0c73('0x1b')]('finish\x20to\x20convert');_0x555110();});_0x55e40f[_0x0c73('0x23')]();});}function base64Decode(_0x73d457,_0x12f108){var _0x58fe55=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs['generate'](0x4)+'.wav');fs[_0x0c73('0x26')](_0x58fe55,_0x73d457,'base64');return convertFile(_0x58fe55,_0x12f108)[_0x0c73('0x27')](function(){try{fs[_0x0c73('0x28')](_0x58fe55);fs[_0x0c73('0x29')](_0x12f108,_0x0c73('0x2a'));}catch(_0x236a5d){logger[_0x0c73('0x15')](_0x236a5d);}return _0x12f108[_0x0c73('0x2b')]('.')[0x0];});}function base64Encode(_0x4cf1d5){var _0x1cff51=fs[_0x0c73('0x2c')](_0x4cf1d5);return new Buffer(_0x1cff51)[_0x0c73('0x2d')](_0x0c73('0x2e'));}exports[_0x0c73('0x2f')]=function(_0x2cf741,_0x37e9b8,_0x5ee867,_0x21d32a,_0x1293e7,_0x2cd60a){var _0x393eb3,_0x3a5692;var _0x285e6b=_0x0c73('0x30');var _0x5da727=_0x0c73('0x31')+_0x2cf741;var _0x232533={};if(_0x37e9b8===_0x0c73('0x32')){_0x232533['input']={'ssml':_0x5ee867};}else{_0x232533[_0x0c73('0x33')]={'text':_0x5ee867};};_0x232533[_0x0c73('0x34')]={'languageCode':_0x21d32a,'ssmlGender':_0x1293e7};_0x232533[_0x0c73('0x35')]={'audioEncoding':_0x0c73('0x36'),'sampleRateHertz':0x1f40};var _0x294139={'url':_0x285e6b+'text:synthesize'+_0x5da727,'method':'POST','json':!![],'body':_0x232533};return rp(_0x294139)[_0x0c73('0x27')](function(_0x2a4489){return new BPromise(function(_0x572af6,_0x580130){_0x393eb3=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs[_0x0c73('0x37')](0x4)+_0x0c73('0x38'));var _0x453bad=Buffer[_0x0c73('0x39')](_0x2a4489[_0x0c73('0x3a')],'base64');return fs[_0x0c73('0x3b')](_0x393eb3,_0x453bad,function(_0x2f0601){_0x580130(_0x2f0601);},function(_0xb02415){fs[_0x0c73('0x29')](_0x393eb3,_0x0c73('0x2a'));_0x572af6(_0xb02415);});});})[_0x0c73('0x27')](function(_0x3a59e8){_0x3a5692=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs[_0x0c73('0x37')](0x4)+_0x0c73('0x3c'));return convertFile(_0x393eb3,_0x3a5692);})[_0x0c73('0x27')](function(){try{fs[_0x0c73('0x28')](_0x393eb3);fs[_0x0c73('0x29')](_0x3a5692,_0x0c73('0x2a'));}catch(_0x8ad97){logger['error'](_0x8ad97);}logger[_0x0c73('0x1b')]('googleCloudTTS\x20path',_0x3a5692[_0x0c73('0x2b')]('.')[0x0]);return _0x3a5692['split']('.')[0x0];});};exports['googleTTS']=function(_0x28b87c,_0x58b609){var _0x2764ee=_0x0c73('0x3d');var _0xc36fab,_0x2fa743;var _0x1f1f25;var _0x3b3b72={'encoding':_0x0c73('0x3e'),'method':_0x0c73('0x3f'),'timeout':0x2710,'url':_0x2764ee,'headers':{'Content-Type':_0x0c73('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0x0c73('0x41')]([[[_0x0c73('0x42'),JSON[_0x0c73('0x41')]([_0x28b87c,_0x58b609||'en',![],'null']),null,_0x0c73('0x43')]]]))};return rp(_0x3b3b72)[_0x0c73('0x27')](function(_0x11ac7c){try{_0x1f1f25=eval(_0x11ac7c[_0x0c73('0x44')](0x5))[0x0][0x2];}catch(_0x3edb4b){throw new Error(_0x0c73('0x45')+_0x11ac7c[_0x0c73('0x20')]);}if(!_0x1f1f25){if(_0x28b87c[_0x0c73('0x46')]>0xc8){throw new Error(_0x0c73('0x47'));}else{throw new Error(_0x0c73('0x48')+_0x58b609+_0x0c73('0x49'));}}try{_0x1f1f25=eval(_0x1f1f25)[0x0];}catch(_0x3dfafd){throw new Error(_0x0c73('0x45')+res[_0x0c73('0x20')]);}const _0x48fdbf=_0x1f1f25;_0xc36fab=path['resolve'](__dirname,_0x0c73('0x25'),rs[_0x0c73('0x37')](0x4)+_0x0c73('0x38'));fs[_0x0c73('0x26')](_0xc36fab,_0x1f1f25,{'encoding':_0x0c73('0x2e')});_0x2fa743=path['resolve'](__dirname,_0x0c73('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0xc36fab,_0x2fa743);})[_0x0c73('0x27')](function(){try{fs['unlink'](_0xc36fab);fs[_0x0c73('0x29')](_0x2fa743,'777');}catch(_0x3d2662){logger['error'](_0x3d2662);}logger[_0x0c73('0x1b')](_0x0c73('0x4a'),_0x2fa743[_0x0c73('0x2b')]('.')[0x0]);return _0x2fa743[_0x0c73('0x2b')]('.')[0x0];});};exports[_0x0c73('0x4b')]=function(_0x695000,_0x5799cc,_0x2c174b){return google[_0x0c73('0x4c')](_0x695000,_0x5799cc,_0x2c174b)['then'](function(_0x5b9ada){logger[_0x0c73('0x1b')](_0x5b9ada['uri']);return rp(_0x5b9ada);})['then'](function(_0x3d46b8){var _0x3fc6b3='';var _0x47cc9d=0x0;try{fs[_0x0c73('0x28')](_0x695000);}catch(_0x877660){logger[_0x0c73('0x15')](_0x877660);}if(_0x3d46b8&&_0x3d46b8['results']){_0x3fc6b3=_0x3d46b8[_0x0c73('0x4d')][_0x0c73('0x4e')](function(_0x310852){return _0x310852&&_0x310852['alternatives'][0x0]&&_0x310852[_0x0c73('0x4f')][0x0][_0x0c73('0x50')]?_0x310852[_0x0c73('0x4f')][0x0]['transcript']:'';})[_0x0c73('0x51')]('\x0a');_0x47cc9d=_0x3d46b8[_0x0c73('0x4d')][_0x0c73('0x4e')](function(_0x2e669b){return _0x2e669b&&_0x2e669b['alternatives'][0x0]&&_0x2e669b[_0x0c73('0x4f')][0x0][_0x0c73('0x52')]?_0x2e669b[_0x0c73('0x4f')][0x0][_0x0c73('0x52')]:0x0;})[_0x0c73('0x51')]('\x0a');}logger[_0x0c73('0x1b')](_0x0c73('0x53'),_0x3fc6b3);logger['info'](_0x0c73('0x54'),_0x47cc9d);return{'transcript':_0x3fc6b3,'confidence':_0x47cc9d};})['catch'](function(_0x30ffbf){logger[_0x0c73('0x15')](_0x0c73('0x55'),_0x30ffbf[_0x0c73('0x14')],_0x30ffbf[_0x0c73('0x56')],_0x30ffbf[_0x0c73('0x57')]);});};exports['googleDialogflow']=function(_0x1d1225,_0xddfd9a,_0x531bdc,_0x2e2a5c){var _0x30abc7=apiai(_0xddfd9a,{'language':_0x2e2a5c||'en'});return _0x30abc7[_0x0c73('0x58')](_0x531bdc,{'sessionId':md5(_0x1d1225)})[_0x0c73('0x27')](function(_0x593952){logger[_0x0c73('0x1b')](JSON[_0x0c73('0x41')](_0x593952));return{'source':_0x593952['result'][_0x0c73('0x59')],'resolvedQuery':_0x593952['result'][_0x0c73('0x5a')],'action':_0x593952[_0x0c73('0x5b')][_0x0c73('0x5c')],'actionIncomplete':_0x593952['result'][_0x0c73('0x5d')],'speech':_0x593952[_0x0c73('0x5b')][_0x0c73('0x5e')][_0x0c73('0x5f')],'score':_0x593952['result'][_0x0c73('0x60')],'statusCode':_0x593952[_0x0c73('0x61')]['code'],'endConversation':_0x593952[_0x0c73('0x5b')][_0x0c73('0x62')][_0x0c73('0x63')]||![],'isFallbackIntent':_0x593952[_0x0c73('0x5b')][_0x0c73('0x62')][_0x0c73('0x64')]};});};exports['googleDialogflowV2']=function(_0x388080,_0x2b09b2,_0x5e77f7,_0x2340cc,_0x393019,_0x18c6c4){var _0x3f70c2=_0x2340cc[_0x0c73('0x65')](/\\n/g,'\x0a');var _0xc42dff={'credentials':{'private_key':_0x3f70c2,'client_email':_0x5e77f7}};var _0x37d804=new dialogflow[(_0x0c73('0x66'))](_0xc42dff);var _0x311954=_0x37d804[_0x0c73('0x67')](_0x2b09b2,md5(_0x388080));var _0x2a6ab2={'session':_0x311954,'queryInput':{'text':{'text':_0x393019,'languageCode':_0x18c6c4}}};return _0x37d804[_0x0c73('0x68')](_0x2a6ab2)[_0x0c73('0x27')](function(_0x24b8c7){if(_0x24b8c7&&_0x24b8c7[_0x0c73('0x46')]){logger[_0x0c73('0x1b')](_0x0c73('0x69'),JSON[_0x0c73('0x41')](_0x24b8c7));var _0x3bad9c=_0x24b8c7[0x0];if(_0x3bad9c){var _0x56774e={'action':_0x3bad9c['queryResult'][_0x0c73('0x5c')],'allRequiredParamsPresent':_0x3bad9c[_0x0c73('0x6a')][_0x0c73('0x6b')],'endConversation':_0x3bad9c[_0x0c73('0x6a')]['diagnosticInfo']&&_0x3bad9c['queryResult']['diagnosticInfo'][_0x0c73('0x6c')]?_0x3bad9c[_0x0c73('0x6a')][_0x0c73('0x6d')][_0x0c73('0x6c')][_0x0c73('0x6e')][_0x0c73('0x6f')]:![],'fulfillmentText':_0x3bad9c[_0x0c73('0x6a')][_0x0c73('0x70')],'intentName':_0x3bad9c['queryResult'][_0x0c73('0x71')][_0x0c73('0x56')],'intentDisplayName':_0x3bad9c[_0x0c73('0x6a')]['intent']['displayName'],'isFallbackIntent':_0x3bad9c['queryResult'][_0x0c73('0x71')][_0x0c73('0x72')],'languageCode':_0x3bad9c[_0x0c73('0x6a')]['languageCode'],'queryText':_0x3bad9c[_0x0c73('0x6a')]['queryText'],'responseId':_0x3bad9c[_0x0c73('0x73')],'score':_0x3bad9c[_0x0c73('0x6a')][_0x0c73('0x74')],'speech':_0x3bad9c['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x0c73('0x41')](_0x24b8c7)};return _0x56774e;}}});};exports[_0x0c73('0x75')]=function(_0x25702a,_0x292f22,_0x5bb2ee,_0x3b09a1){return tilde[_0x0c73('0x4c')](_0x25702a,_0x292f22,_0x5bb2ee,_0x3b09a1)[_0x0c73('0x27')](function(_0x153e28){try{fs[_0x0c73('0x28')](_0x25702a);}catch(_0x15ad58){logger[_0x0c73('0x15')](_0x15ad58);}logger[_0x0c73('0x1b')](_0x0c73('0x76'),_0x153e28[_0x0c73('0x50')]);logger[_0x0c73('0x1b')]('Tilde\x20ASR\x20confidence',_0x153e28[_0x0c73('0x52')]);return _0x153e28;});};exports[_0x0c73('0x77')]=function(_0x3b1161,_0x55a9d3,_0x4f873a,_0x15900a,_0x533b89,_0x3fe891){var _0x2855d7=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs['generate'](0x4)+_0x0c73('0x38'));var _0x899bdf;return aws[_0x0c73('0x78')](_0x3b1161,_0x55a9d3,_0x4f873a,_0x15900a,_0x533b89,_0x3fe891,_0x2855d7)[_0x0c73('0x27')](function(){_0x899bdf=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs[_0x0c73('0x37')](0x4)+_0x0c73('0x3c'));return convertFile(_0x2855d7,_0x899bdf);})['then'](function(){try{fs['unlink'](_0x2855d7);fs[_0x0c73('0x29')](_0x899bdf,_0x0c73('0x2a'));}catch(_0x21743e){logger['error'](_0x21743e);}return _0x899bdf['split']('.')[0x0];});};exports[_0x0c73('0x79')]=function(_0x4836a2,_0x462a89,_0xfa0f23,_0x3fe93b,_0x1a3276,_0x3a4132){return aws[_0x0c73('0x7a')](_0x4836a2,_0x462a89,_0xfa0f23,_0x3fe93b,_0x1a3276,_0x3a4132)[_0x0c73('0x27')](function(_0x90de8){logger['info'](JSON[_0x0c73('0x41')](_0x90de8));return _0x90de8;});};exports['ispeechTTS']=function(_0x10d1a2,_0x11d154,_0x2a28ac,_0x3834df){var _0x4f8834=util[_0x0c73('0x7b')](_0x0c73('0x7c'),ISPEECH_API,_0x10d1a2,encodeURIComponent(_0x11d154),_0x2a28ac,_0x3834df);var _0x1c6d19=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs[_0x0c73('0x37')](0x4)+_0x0c73('0x38'));var _0x5a614d;return downloadFile(_0x4f8834,_0x1c6d19)[_0x0c73('0x27')](function(){_0x5a614d=path[_0x0c73('0x24')](__dirname,_0x0c73('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x1c6d19,_0x5a614d);})[_0x0c73('0x27')](function(){try{fs[_0x0c73('0x28')](_0x1c6d19);fs[_0x0c73('0x29')](_0x5a614d,'777');}catch(_0x8c5894){logger[_0x0c73('0x15')](_0x8c5894);}return _0x5a614d[_0x0c73('0x2b')]('.')[0x0];});};exports['ispeechASR']=function(_0x2f6722,_0x3208d1,_0x55bb51,_0x382555){var _0x42d5a6=util[_0x0c73('0x7b')](_0x0c73('0x7d'),ISPEECH_API,_0x3208d1,_0x55bb51,base64Encode(_0x2f6722),_0x382555?util[_0x0c73('0x7b')](_0x0c73('0x7e'),encodeURIComponent(_0x382555)):_0x0c73('0x7f'));return uploadFile(_0x42d5a6)[_0x0c73('0x27')](function(_0x181021){return querystring['parse'](_0x181021);});};exports[_0x0c73('0x80')]=function(_0x4a0077,_0x55b8f1){return sestek[_0x0c73('0x81')](_0x4a0077,_0x55b8f1)['then'](function(_0x484bf4){logger[_0x0c73('0x1b')](JSON[_0x0c73('0x41')](_0x484bf4));var _0x292aec={'speech':_0x484bf4['text'],'action':_0x484bf4[_0x0c73('0x82')]?_0x484bf4['channelData']['CustomAction']:undefined,'actiondata':_0x484bf4[_0x0c73('0x82')]?_0x484bf4['channelData'][_0x0c73('0x83')]:undefined};if(_0x484bf4[_0x0c73('0x82')]&&_0x484bf4[_0x0c73('0x82')][_0x0c73('0x84')]){return base64Decode(_0x484bf4['channelData'][_0x0c73('0x84')][_0x0c73('0x85')],path[_0x0c73('0x24')](__dirname,'tmp',rs['generate'](0x4)+'.wav'))[_0x0c73('0x27')](function(_0x5ccdfc){_0x292aec[_0x0c73('0x86')]=_0x5ccdfc;return _0x292aec;});}return _0x292aec;});};exports[_0x0c73('0x87')]=function(){return __dirname;}; \ No newline at end of file +var _0x3d06=['speech','score','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','querystring','randomstring','google-tts-api','url','parse','util','./google','./sestek','./tilde','../../../config/logger','agi','protocol','https:','host','path','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','then','777','split','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','chmodSync','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','textRequest','result','source','resolvedQuery','action','fulfillment'];(function(_0x40f79f,_0x5b4711){var _0x3fdce7=function(_0x3c8b98){while(--_0x3c8b98){_0x40f79f['push'](_0x40f79f['shift']());}};_0x3fdce7(++_0x5b4711);}(_0x3d06,0xba));var _0x63d0=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x3d06[_0x1ccbcc];return _0x1e873f;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x63d0('0x0'));var dialogflow=require(_0x63d0('0x1'));var fs=require('fs');var http=require(_0x63d0('0x2'));var https=require(_0x63d0('0x3'));var md5=require(_0x63d0('0x4'));var path=require('path');var querystring=require(_0x63d0('0x5'));var rp=require('request-promise');var rs=require(_0x63d0('0x6'));var sox=require('sox');var tts=require(_0x63d0('0x7'));var urlParse=require(_0x63d0('0x8'))[_0x63d0('0x9')];var util=require(_0x63d0('0xa'));var aws=require('./aws');var google=require(_0x63d0('0xb'));var sestek=require(_0x63d0('0xc'));var tilde=require(_0x63d0('0xd'));var logger=require(_0x63d0('0xe'))(_0x63d0('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0xcab584,_0x273155){return new BPromise(function(_0x51e8d7,_0x125d32){var _0x5df226=urlParse(_0xcab584);var _0x138d10=_0x5df226[_0x63d0('0x10')]===_0x63d0('0x11')?https:http;var _0x1b0bfd={'host':_0x5df226[_0x63d0('0x12')],'path':_0x5df226[_0x63d0('0x13')],'headers':{'user-agent':_0x63d0('0x14')}};_0x138d10[_0x63d0('0x15')](_0x1b0bfd,function(_0x217b54){if(_0x217b54['statusCode']!==0xc8){logger[_0x63d0('0x16')](_0x63d0('0x17')+_0xcab584+_0x63d0('0x18')+_0x217b54[_0x63d0('0x19')]+'\x20('+_0x217b54[_0x63d0('0x1a')]+')');_0x125d32(new Error(_0x63d0('0x17')+_0xcab584+'\x20failed,\x20status\x20code\x20=\x20'+_0x217b54[_0x63d0('0x19')]+'\x20('+_0x217b54[_0x63d0('0x1a')]+')'));return;}var _0x4c03a7=fs[_0x63d0('0x1b')](_0x273155);_0x4c03a7['on'](_0x63d0('0x1c'),function(){logger[_0x63d0('0x1d')](_0x63d0('0x1e'));_0x4c03a7['close'](_0x51e8d7);});_0x4c03a7['on'](_0x63d0('0x16'),function(_0x8db692){fs[_0x63d0('0x1f')](_0x273155);logger[_0x63d0('0x16')](_0x63d0('0x20'),_0x8db692);_0x125d32(_0x8db692);});_0x217b54[_0x63d0('0x21')](_0x4c03a7);})['on']('error',function(_0x17d3c3){logger[_0x63d0('0x16')](_0x17d3c3);_0x125d32(_0x17d3c3);})[_0x63d0('0x22')]();});}function uploadFile(_0x2eaea6){return new BPromise(function(_0x4895d4,_0x1782c4){var _0x2e157f=urlParse(_0x2eaea6);var _0x5fe534=_0x2e157f[_0x63d0('0x10')]===_0x63d0('0x11')?https:http;var _0x4a823f={'host':_0x2e157f[_0x63d0('0x12')],'path':_0x2e157f[_0x63d0('0x13')],'headers':{'user-agent':_0x63d0('0x14')}};_0x5fe534[_0x63d0('0x15')](_0x4a823f,function(_0x3fcd0c){if(_0x3fcd0c[_0x63d0('0x19')]!==0xc8){_0x1782c4(new Error(_0x63d0('0x17')+_0x2eaea6+_0x63d0('0x18')+_0x3fcd0c[_0x63d0('0x19')]+'\x20('+_0x3fcd0c['statusMessage']+')'));return;}var _0x3aebbc='';_0x3fcd0c['on']('data',function(_0x4609ae){_0x3aebbc+=_0x4609ae;});_0x3fcd0c['on'](_0x63d0('0x22'),function(){_0x4895d4(_0x3aebbc);});})['on'](_0x63d0('0x16'),function(_0x46ce92){_0x1782c4(_0x46ce92);})['end']();});}function convertFile(_0xfe774a,_0x503341){return new BPromise(function(_0x252a77,_0x22e79e){var _0x5013ba=sox[_0x63d0('0x23')](_0xfe774a,_0x503341,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5013ba['on'](_0x63d0('0x16'),function(_0x11e141){logger[_0x63d0('0x16')](_0x63d0('0x24'),_0x11e141);_0x22e79e(_0x11e141);});_0x5013ba['on']('end',function(){logger[_0x63d0('0x1d')](_0x63d0('0x25'));_0x252a77();});_0x5013ba[_0x63d0('0x26')]();});}function base64Decode(_0x59bfb0,_0x1f7375){var _0x4a740c=path[_0x63d0('0x27')](__dirname,_0x63d0('0x28'),rs[_0x63d0('0x29')](0x4)+'.wav');fs[_0x63d0('0x2a')](_0x4a740c,_0x59bfb0,'base64');return convertFile(_0x4a740c,_0x1f7375)[_0x63d0('0x2b')](function(){try{fs[_0x63d0('0x1f')](_0x4a740c);fs['chmodSync'](_0x1f7375,_0x63d0('0x2c'));}catch(_0x54746b){logger[_0x63d0('0x16')](_0x54746b);}return _0x1f7375[_0x63d0('0x2d')]('.')[0x0];});}function base64Encode(_0x158d74){var _0x35f33c=fs['readFileSync'](_0x158d74);return new Buffer(_0x35f33c)[_0x63d0('0x2e')](_0x63d0('0x2f'));}exports[_0x63d0('0x30')]=function(_0x395342,_0x144097,_0x2ce50b,_0x3dac41,_0x217e26,_0x28bf05){var _0x4ce8e0,_0x43d571;var _0x598274=_0x63d0('0x31');var _0x598aad=_0x63d0('0x32')+_0x395342;var _0x4a357f={};if(_0x144097==='ssml'){_0x4a357f[_0x63d0('0x33')]={'ssml':_0x2ce50b};}else{_0x4a357f[_0x63d0('0x33')]={'text':_0x2ce50b};};_0x4a357f['voice']={'languageCode':_0x3dac41,'ssmlGender':_0x217e26};_0x4a357f[_0x63d0('0x34')]={'audioEncoding':_0x63d0('0x35'),'sampleRateHertz':0x1f40};var _0x503bdd={'url':_0x598274+'text:synthesize'+_0x598aad,'method':_0x63d0('0x36'),'json':!![],'body':_0x4a357f};return rp(_0x503bdd)['then'](function(_0x11d0e7){return new BPromise(function(_0x430064,_0x186c15){_0x4ce8e0=path[_0x63d0('0x27')](__dirname,'tmp',rs[_0x63d0('0x29')](0x4)+_0x63d0('0x37'));var _0x58ddd6=Buffer[_0x63d0('0x38')](_0x11d0e7[_0x63d0('0x39')],_0x63d0('0x2f'));return fs[_0x63d0('0x3a')](_0x4ce8e0,_0x58ddd6,function(_0x4fd0c8){_0x186c15(_0x4fd0c8);},function(_0x5d28af){fs[_0x63d0('0x3b')](_0x4ce8e0,_0x63d0('0x2c'));_0x430064(_0x5d28af);});});})[_0x63d0('0x2b')](function(_0x503da6){_0x43d571=path[_0x63d0('0x27')](__dirname,_0x63d0('0x28'),rs[_0x63d0('0x29')](0x4)+_0x63d0('0x3c'));return convertFile(_0x4ce8e0,_0x43d571);})['then'](function(){try{fs[_0x63d0('0x1f')](_0x4ce8e0);fs[_0x63d0('0x3b')](_0x43d571,_0x63d0('0x2c'));}catch(_0x27dbb8){logger[_0x63d0('0x16')](_0x27dbb8);}logger[_0x63d0('0x1d')](_0x63d0('0x3d'),_0x43d571[_0x63d0('0x2d')]('.')[0x0]);return _0x43d571[_0x63d0('0x2d')]('.')[0x0];});};exports[_0x63d0('0x3e')]=function(_0x31daac,_0x402203){var _0x3643a9=_0x63d0('0x3f');var _0x2bdc4f,_0x81e30f;var _0x348948;var _0x590643={'encoding':_0x63d0('0x40'),'method':_0x63d0('0x36'),'timeout':0x2710,'url':_0x3643a9,'headers':{'Content-Type':_0x63d0('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x63d0('0x42')]([[[_0x63d0('0x43'),JSON[_0x63d0('0x42')]([_0x31daac,_0x402203||'en',![],_0x63d0('0x44')]),null,_0x63d0('0x45')]]]))};return rp(_0x590643)[_0x63d0('0x2b')](function(_0x3b4109){try{_0x348948=eval(_0x3b4109['slice'](0x5))[0x0][0x2];}catch(_0x37bc44){throw new Error(_0x63d0('0x46')+_0x3b4109[_0x63d0('0x47')]);}if(!_0x348948){if(_0x31daac[_0x63d0('0x48')]>0xc8){throw new Error(_0x63d0('0x49'));}else{throw new Error(_0x63d0('0x4a')+_0x402203+_0x63d0('0x4b'));}}try{_0x348948=eval(_0x348948)[0x0];}catch(_0x1da3a6){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0xd4c583=_0x348948;_0x2bdc4f=path[_0x63d0('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x63d0('0x37'));fs[_0x63d0('0x2a')](_0x2bdc4f,_0x348948,{'encoding':'base64'});_0x81e30f=path[_0x63d0('0x27')](__dirname,'tmp',rs[_0x63d0('0x29')](0x4)+'.wav');return convertFile(_0x2bdc4f,_0x81e30f);})[_0x63d0('0x2b')](function(){try{fs['unlink'](_0x2bdc4f);fs[_0x63d0('0x3b')](_0x81e30f,_0x63d0('0x2c'));}catch(_0x118e3c){logger['error'](_0x118e3c);}logger['info']('goggleTTS\x20path',_0x81e30f[_0x63d0('0x2d')]('.')[0x0]);return _0x81e30f[_0x63d0('0x2d')]('.')[0x0];});};exports[_0x63d0('0x4c')]=function(_0x3b3441,_0x3e6806,_0x25d892){return google[_0x63d0('0x4d')](_0x3b3441,_0x3e6806,_0x25d892)[_0x63d0('0x2b')](function(_0x1f631){logger[_0x63d0('0x1d')](_0x1f631[_0x63d0('0x4e')]);return rp(_0x1f631);})[_0x63d0('0x2b')](function(_0x53bfbc){var _0x5e44b9='';var _0x48fc11=0x0;try{fs[_0x63d0('0x1f')](_0x3b3441);}catch(_0x4c0782){logger[_0x63d0('0x16')](_0x4c0782);}if(_0x53bfbc&&_0x53bfbc[_0x63d0('0x4f')]){_0x5e44b9=_0x53bfbc['results'][_0x63d0('0x50')](function(_0x108bab){return _0x108bab&&_0x108bab['alternatives'][0x0]&&_0x108bab[_0x63d0('0x51')][0x0]['transcript']?_0x108bab[_0x63d0('0x51')][0x0][_0x63d0('0x52')]:'';})[_0x63d0('0x53')]('\x0a');_0x48fc11=_0x53bfbc[_0x63d0('0x4f')][_0x63d0('0x50')](function(_0x4dd3f3){return _0x4dd3f3&&_0x4dd3f3[_0x63d0('0x51')][0x0]&&_0x4dd3f3['alternatives'][0x0][_0x63d0('0x54')]?_0x4dd3f3['alternatives'][0x0][_0x63d0('0x54')]:0x0;})[_0x63d0('0x53')]('\x0a');}logger[_0x63d0('0x1d')](_0x63d0('0x55'),_0x5e44b9);logger[_0x63d0('0x1d')](_0x63d0('0x56'),_0x48fc11);return{'transcript':_0x5e44b9,'confidence':_0x48fc11};})[_0x63d0('0x57')](function(_0x1f5a98){logger[_0x63d0('0x16')]('[%s]\x20%s:%s',_0x1f5a98[_0x63d0('0x19')],_0x1f5a98[_0x63d0('0x58')],_0x1f5a98[_0x63d0('0x59')]);});};exports['googleDialogflow']=function(_0x5ce339,_0x37e382,_0x4d7828,_0x19079c){var _0x2422c3=apiai(_0x37e382,{'language':_0x19079c||'en'});return _0x2422c3[_0x63d0('0x5a')](_0x4d7828,{'sessionId':md5(_0x5ce339)})['then'](function(_0x19850f){logger[_0x63d0('0x1d')](JSON['stringify'](_0x19850f));return{'source':_0x19850f[_0x63d0('0x5b')][_0x63d0('0x5c')],'resolvedQuery':_0x19850f['result'][_0x63d0('0x5d')],'action':_0x19850f['result'][_0x63d0('0x5e')],'actionIncomplete':_0x19850f['result']['actionIncomplete'],'speech':_0x19850f[_0x63d0('0x5b')][_0x63d0('0x5f')][_0x63d0('0x60')],'score':_0x19850f[_0x63d0('0x5b')][_0x63d0('0x61')],'statusCode':_0x19850f['status']['code'],'endConversation':_0x19850f[_0x63d0('0x5b')][_0x63d0('0x62')]['endConversation']||![],'isFallbackIntent':_0x19850f['result'][_0x63d0('0x62')][_0x63d0('0x63')]};});};exports[_0x63d0('0x64')]=function(_0x2f7cd5,_0x25a6c0,_0x430255,_0x22fa9c,_0x18d7a4,_0x1da144){var _0x34425d=_0x22fa9c[_0x63d0('0x65')](/\\n/g,'\x0a');var _0x46f309={'credentials':{'private_key':_0x34425d,'client_email':_0x430255}};var _0x56e4fa=new dialogflow[(_0x63d0('0x66'))](_0x46f309);var _0x2e6bf1=_0x56e4fa[_0x63d0('0x67')](_0x25a6c0,md5(_0x2f7cd5));var _0x282ddf={'session':_0x2e6bf1,'queryInput':{'text':{'text':_0x18d7a4,'languageCode':_0x1da144}}};return _0x56e4fa[_0x63d0('0x68')](_0x282ddf)['then'](function(_0x3f3543){if(_0x3f3543&&_0x3f3543[_0x63d0('0x48')]){logger[_0x63d0('0x1d')](_0x63d0('0x69'),JSON[_0x63d0('0x42')](_0x3f3543));var _0x3e10eb=_0x3f3543[0x0];if(_0x3e10eb){var _0x1ab1df={'action':_0x3e10eb['queryResult'][_0x63d0('0x5e')],'allRequiredParamsPresent':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x6b')],'endConversation':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x6c')]&&_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x6c')][_0x63d0('0x6d')]?_0x3e10eb[_0x63d0('0x6a')]['diagnosticInfo'][_0x63d0('0x6d')][_0x63d0('0x6e')][_0x63d0('0x6f')]:![],'fulfillmentText':_0x3e10eb['queryResult'][_0x63d0('0x70')],'intentName':_0x3e10eb['queryResult'][_0x63d0('0x71')][_0x63d0('0x58')],'intentDisplayName':_0x3e10eb[_0x63d0('0x6a')]['intent'][_0x63d0('0x72')],'isFallbackIntent':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x71')][_0x63d0('0x73')],'languageCode':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x74')],'queryText':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x75')],'responseId':_0x3e10eb['responseId'],'score':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x76')],'speech':_0x3e10eb[_0x63d0('0x6a')][_0x63d0('0x70')],'providerResponse':JSON[_0x63d0('0x42')](_0x3f3543)};return _0x1ab1df;}}});};exports[_0x63d0('0x77')]=function(_0x2f44bf,_0x214e4b,_0x55ba0f,_0x2186b5){return tilde['asr'](_0x2f44bf,_0x214e4b,_0x55ba0f,_0x2186b5)[_0x63d0('0x2b')](function(_0x4250dd){try{fs[_0x63d0('0x1f')](_0x2f44bf);}catch(_0x2c92a1){logger[_0x63d0('0x16')](_0x2c92a1);}logger[_0x63d0('0x1d')](_0x63d0('0x78'),_0x4250dd[_0x63d0('0x52')]);logger[_0x63d0('0x1d')](_0x63d0('0x79'),_0x4250dd['confidence']);return _0x4250dd;});};exports[_0x63d0('0x7a')]=function(_0x3e3c47,_0x2d1c5c,_0x1db001,_0x18394a,_0x223389,_0x90961c){var _0xde1ad6=path[_0x63d0('0x27')](__dirname,'tmp',rs[_0x63d0('0x29')](0x4)+'.mp3');var _0x4cd4eb;return aws[_0x63d0('0x7b')](_0x3e3c47,_0x2d1c5c,_0x1db001,_0x18394a,_0x223389,_0x90961c,_0xde1ad6)[_0x63d0('0x2b')](function(){_0x4cd4eb=path[_0x63d0('0x27')](__dirname,_0x63d0('0x28'),rs['generate'](0x4)+_0x63d0('0x3c'));return convertFile(_0xde1ad6,_0x4cd4eb);})[_0x63d0('0x2b')](function(){try{fs[_0x63d0('0x1f')](_0xde1ad6);fs[_0x63d0('0x3b')](_0x4cd4eb,'777');}catch(_0x3bdb43){logger['error'](_0x3bdb43);}return _0x4cd4eb[_0x63d0('0x2d')]('.')[0x0];});};exports[_0x63d0('0x7c')]=function(_0x484980,_0xf2a60b,_0x270719,_0x216cdd,_0x418800,_0x5b68ad){return aws[_0x63d0('0x7d')](_0x484980,_0xf2a60b,_0x270719,_0x216cdd,_0x418800,_0x5b68ad)['then'](function(_0x2e32cc){logger['info'](JSON[_0x63d0('0x42')](_0x2e32cc));return _0x2e32cc;});};exports[_0x63d0('0x7e')]=function(_0x1fecd4,_0x158949,_0x194d9c,_0x5f0cdf){var _0x5b63bd=util['format'](_0x63d0('0x7f'),ISPEECH_API,_0x1fecd4,encodeURIComponent(_0x158949),_0x194d9c,_0x5f0cdf);var _0x30f50e=path[_0x63d0('0x27')](__dirname,'tmp',rs[_0x63d0('0x29')](0x4)+_0x63d0('0x37'));var _0x136d1a;return downloadFile(_0x5b63bd,_0x30f50e)[_0x63d0('0x2b')](function(){_0x136d1a=path['resolve'](__dirname,_0x63d0('0x28'),rs[_0x63d0('0x29')](0x4)+'.wav');return convertFile(_0x30f50e,_0x136d1a);})[_0x63d0('0x2b')](function(){try{fs[_0x63d0('0x1f')](_0x30f50e);fs[_0x63d0('0x3b')](_0x136d1a,_0x63d0('0x2c'));}catch(_0x13b159){logger[_0x63d0('0x16')](_0x13b159);}return _0x136d1a[_0x63d0('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x5f4dcc,_0x58ba63,_0x4ab5ad,_0x233f5c){var _0x56bec3=util[_0x63d0('0x80')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x58ba63,_0x4ab5ad,base64Encode(_0x5f4dcc),_0x233f5c?util[_0x63d0('0x80')](_0x63d0('0x81'),encodeURIComponent(_0x233f5c)):_0x63d0('0x82'));return uploadFile(_0x56bec3)[_0x63d0('0x2b')](function(_0x1fa5da){return querystring[_0x63d0('0x9')](_0x1fa5da);});};exports[_0x63d0('0x83')]=function(_0x5e0ad3,_0x21d575){return sestek[_0x63d0('0x84')](_0x5e0ad3,_0x21d575)[_0x63d0('0x2b')](function(_0x14d6ab){logger[_0x63d0('0x1d')](JSON[_0x63d0('0x42')](_0x14d6ab));var _0x1782e1={'speech':_0x14d6ab[_0x63d0('0x85')],'action':_0x14d6ab[_0x63d0('0x86')]?_0x14d6ab[_0x63d0('0x86')][_0x63d0('0x87')]:undefined,'actiondata':_0x14d6ab[_0x63d0('0x86')]?_0x14d6ab['channelData'][_0x63d0('0x88')]:undefined};if(_0x14d6ab['channelData']&&_0x14d6ab[_0x63d0('0x86')]['AudioFromTts']){return base64Decode(_0x14d6ab[_0x63d0('0x86')][_0x63d0('0x89')][_0x63d0('0x8a')],path['resolve'](__dirname,_0x63d0('0x28'),rs[_0x63d0('0x29')](0x4)+_0x63d0('0x3c')))[_0x63d0('0x2b')](function(_0x3e57c7){_0x1782e1[_0x63d0('0x8b')]=_0x3e57c7;return _0x1782e1;});}return _0x1782e1;});};exports[_0x63d0('0x8c')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index ca01cc3..7d9653f 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 _0x9986=['exports','./nda'];(function(_0x5e8951,_0x127487){var _0x4e3e30=function(_0x431b97){while(--_0x431b97){_0x5e8951['push'](_0x5e8951['shift']());}};_0x4e3e30(++_0x127487);}(_0x9986,0x1e3));var _0x6998=function(_0x226d33,_0x523d25){_0x226d33=_0x226d33-0x0;var _0x13c901=_0x9986[_0x226d33];return _0x13c901;};var nda=require(_0x6998('0x0'));module[_0x6998('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc4da=['exports'];(function(_0x4f2e9e,_0x21fc36){var _0x1ec515=function(_0x755ed7){while(--_0x755ed7){_0x4f2e9e['push'](_0x4f2e9e['shift']());}};_0x1ec515(++_0x21fc36);}(_0xc4da,0x181));var _0xac4d=function(_0x1af8b2,_0x33630b){_0x1af8b2=_0x1af8b2-0x0;var _0x26dd66=_0xc4da[_0x1af8b2];return _0x26dd66;};var nda=require('./nda');module[_0xac4d('0x0')]={'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 5c4d33d..c9fb7e6 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 _0x2182=['ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x2182,0xea));var _0x2218=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2182[_0x5b644e];return _0x49c6bf;};'use strict';var rp=require(_0x2218('0x0'));var url=require(_0x2218('0x1'));var logger=require(_0x2218('0x2'))(_0x2218('0x3'));module['exports']=function(_0x41395e,_0x591036){var _0x2fdb57={'method':_0x2218('0x4'),'uri':url[_0x2218('0x5')](_0x591036[_0x2218('0x6')],_0x2218('0x7')),'form':{'grant_type':_0x2218('0x8'),'username':_0x591036[_0x2218('0x9')],'password':_0x591036[_0x2218('0x8')]},'json':!![]};return rp(_0x2fdb57)[_0x2218('0xa')](function(_0x29e762){var _0x4b3bd1={'method':_0x2218('0x4'),'uri':url[_0x2218('0x5')](_0x591036[_0x2218('0xb')],_0x2218('0xc')),'body':{'type':_0x591036['ndaactivity_type']||_0x2218('0xd'),'channelId':_0x2218('0xe'),'conversation':{'id':_0x41395e[_0x2218('0xf')]},'from':{'id':_0x41395e[_0x2218('0x10')],'name':_0x41395e['calleridname']},'recipient':{'id':_0x41395e[_0x2218('0x11')],'name':_0x41395e[_0x2218('0x12')]},'text':_0x591036[_0x2218('0x13')],'channelData':{}},'headers':{'Authorization':_0x2218('0x14')+_0x29e762[_0x2218('0x15')]},'json':!![]};if(_0x591036['project']){_0x4b3bd1[_0x2218('0x16')]['channelData'][_0x2218('0x17')]=_0x591036[_0x2218('0x18')];}if(_0x591036[_0x2218('0x19')]=='1'){_0x4b3bd1[_0x2218('0x16')][_0x2218('0x1a')][_0x2218('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2218('0x1c')};}if(_0x591036[_0x2218('0x1d')]){_0x4b3bd1[_0x2218('0x16')][_0x2218('0x1a')][_0x2218('0x1e')]=_0x591036[_0x2218('0x1d')];if(_0x591036[_0x2218('0x1f')]){_0x4b3bd1[_0x2218('0x16')][_0x2218('0x1a')][_0x2218('0x20')]=_0x591036[_0x2218('0x1f')];}}logger[_0x2218('0x21')](JSON[_0x2218('0x22')](_0x4b3bd1));return rp(_0x4b3bd1);});}; \ No newline at end of file +var _0xcc73=['ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','url','../../../../../config/logger','ndauth_url','/token','password','username','POST','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','text','access_token','project','body','channelData','ProjectName'];(function(_0x594627,_0x1abb75){var _0x1bd85a=function(_0x1433b3){while(--_0x1433b3){_0x594627['push'](_0x594627['shift']());}};_0x1bd85a(++_0x1abb75);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcc73[_0x501510];return _0x1e6ee5;};'use strict';var rp=require('request-promise');var url=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('agi');module['exports']=function(_0x11b326,_0x571514){var _0x445dce={'method':'POST','uri':url['resolve'](_0x571514[_0x3cc7('0x2')],_0x3cc7('0x3')),'form':{'grant_type':_0x3cc7('0x4'),'username':_0x571514[_0x3cc7('0x5')],'password':_0x571514[_0x3cc7('0x4')]},'json':!![]};return rp(_0x445dce)['then'](function(_0x416c48){var _0x37c184={'method':_0x3cc7('0x6'),'uri':url[_0x3cc7('0x7')](_0x571514['ndassistant_url'],_0x3cc7('0x8')),'body':{'type':_0x571514[_0x3cc7('0x9')]||_0x3cc7('0xa'),'channelId':_0x3cc7('0xb'),'conversation':{'id':_0x11b326[_0x3cc7('0xc')]},'from':{'id':_0x11b326[_0x3cc7('0xd')],'name':_0x11b326[_0x3cc7('0xe')]},'recipient':{'id':_0x11b326['dnid'],'name':_0x11b326['extension']},'text':_0x571514[_0x3cc7('0xf')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x416c48[_0x3cc7('0x10')]},'json':!![]};if(_0x571514[_0x3cc7('0x11')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x14')]=_0x571514[_0x3cc7('0x11')];}if(_0x571514[_0x3cc7('0x15')]=='1'){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3cc7('0x17')};}if(_0x571514[_0x3cc7('0x18')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x19')]=_0x571514[_0x3cc7('0x18')];if(_0x571514[_0x3cc7('0x1a')]){_0x37c184[_0x3cc7('0x12')][_0x3cc7('0x13')][_0x3cc7('0x1b')]=_0x571514[_0x3cc7('0x1a')];}}logger[_0x3cc7('0x1c')](JSON[_0x3cc7('0x1d')](_0x37c184));return rp(_0x37c184);});}; \ 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 ad8e2e8..d06407e 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 _0xe93c=['./lib/api','exports'];(function(_0x2f5fbc,_0x5c1fb4){var _0x55a581=function(_0x3e8ba5){while(--_0x3e8ba5){_0x2f5fbc['push'](_0x2f5fbc['shift']());}};_0x55a581(++_0x5c1fb4);}(_0xe93c,0x1b8));var _0xce93=function(_0x5a1ad7,_0x3d2160){_0x5a1ad7=_0x5a1ad7-0x0;var _0x4b04dd=_0xe93c[_0x5a1ad7];return _0x4b04dd;};'use strict';var asr=require(_0xce93('0x0'));module[_0xce93('0x1')]=function(_0x59849a,_0x330c2c,_0x203586,_0x123f61){return asr(_0x59849a,_0x330c2c,_0x203586,_0x123f61);}; \ No newline at end of file +var _0xb91d=['./lib/api','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb91d,0x1c6));var _0xdb91=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xb91d[_0x120376];return _0x28c529;};'use strict';var asr=require(_0xdb91('0x0'));module[_0xdb91('0x1')]=function(_0x40dbd9,_0x2da0cc,_0x2bb75e,_0x57e163){return asr(_0x40dbd9,_0x2da0cc,_0x2bb75e,_0x57e163);}; \ 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 4deb40c..3d83244 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 _0x9dc1=['agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','result','final','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','../../../../../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9dc1,0xdb));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x19dc('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x19dc('0x1'));var crypto=require('crypto');var logger=require(_0x19dc('0x2'))(_0x19dc('0x3'));module[_0x19dc('0x4')]=function(_0xe92807,_0x4096cf,_0xb166a6,_0x25c92d){return new BPromise(function(_0x276e9b,_0x5ef7c0){logger[_0x19dc('0x5')](_0x19dc('0x6'),_0x25c92d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x2981cc=new WebSocket(_0x25c92d||_0x19dc('0x7'),{'perMessageDeflate':![]});var _0x521243='';var _0x3c9626='0';var _0x2034f4='1';var _0x3d8559=_0x19dc('0x8');function _0x256270(_0x318d04){var _0x499889=crypto[_0x19dc('0x9')]('sha1');_0x499889[_0x19dc('0xa')](_0x318d04);return _0x499889[_0x19dc('0xb')](_0x19dc('0xc'));}function _0x4cab7b(){try{logger[_0x19dc('0x5')](_0x19dc('0xd'));var _0x3635e8=moment()[_0x19dc('0xe')]();var _0x2425d0=_0x256270(_0x3635e8+_0x4096cf+_0xb166a6);_0x2981cc['send'](JSON[_0x19dc('0xf')]({'appID':_0x4096cf,'timestamp':_0x3635e8,'appKey':_0x2425d0}));var _0x5beed6=fs['createReadStream'](_0xe92807);_0x5beed6['on'](_0x19dc('0x10'),function(_0x121d8d){_0x2981cc[_0x19dc('0x11')](_0x121d8d);});_0x5beed6['on'](_0x19dc('0x12'),function(){_0x2981cc[_0x19dc('0x11')](_0x19dc('0x13'));});}catch(_0x41d1aa){logger[_0x19dc('0x14')](_0x19dc('0x15'),JSON[_0x19dc('0xf')](_0x41d1aa));_0x2981cc[_0x19dc('0x16')]();}}function _0x65c5a1(_0x2b4946){try{if(_0x2b4946){var _0xf575=JSON['parse'](_0x2b4946);switch(_0xf575['status']){case 0x0:if(_0xf575[_0x19dc('0x17')]){if(_0xf575[_0x19dc('0x17')][_0x19dc('0x18')]){logger[_0x19dc('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0xf575['result'][_0x19dc('0x19')]));_0x521243=_0xf575[_0x19dc('0x17')][_0x19dc('0x19')][0x0]['transcript'];_0x3c9626=_0xf575[_0x19dc('0x17')][_0x19dc('0x19')][0x0][_0x19dc('0x1a')];_0x2034f4='0';_0x3d8559='Success.';_0x2981cc[_0x19dc('0x16')]();}}break;case 0x1:logger['info'](_0x19dc('0x8'));_0x2034f4='1';_0x3d8559=_0x19dc('0x8');break;case 0x2:logger[_0x19dc('0x5')](_0x19dc('0x1b'));_0x2034f4='2';_0x3d8559=_0x19dc('0x1b');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2034f4='9';_0x3d8559=_0x19dc('0x1c');break;case 0xa:logger[_0x19dc('0x5')](_0x19dc('0x1d'));_0x2034f4='10';_0x3d8559=_0x19dc('0x1d');break;case 0xb:logger[_0x19dc('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x2034f4='11';_0x3d8559=_0x19dc('0x1e');}}}catch(_0x1ebb99){logger['error'](_0x19dc('0x1f'),JSON[_0x19dc('0xf')](_0x1ebb99));_0x2981cc[_0x19dc('0x16')]();}}function _0x91e1a1(){logger['info'](_0x19dc('0x20'));_0x276e9b({'transcript':_0x521243,'confidence':_0x3c9626,'status':_0x2034f4,'status_message':_0x3d8559});}function _0x381091(_0x4d849b){logger[_0x19dc('0x14')](_0x19dc('0x21'));if(!_[_0x19dc('0x22')](_0x4d849b)){logger[_0x19dc('0x14')](_['isObject'](_0x4d849b)?JSON[_0x19dc('0xf')](_0x4d849b):_0x4d849b);}}_0x2981cc['on'](_0x19dc('0x23'),_0x4cab7b);_0x2981cc['on'](_0x19dc('0x24'),_0x65c5a1);_0x2981cc['on'](_0x19dc('0x12'),_0x91e1a1);_0x2981cc['on'](_0x19dc('0x14'),_0x381091);});}; \ No newline at end of file +var _0xb74f=['unix','stringify','createReadStream','data','send','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','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.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket'];(function(_0x120d21,_0x41786c){var _0x18cc0b=function(_0x4ad018){while(--_0x4ad018){_0x120d21['push'](_0x120d21['shift']());}};_0x18cc0b(++_0x41786c);}(_0xb74f,0x97));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xfb74('0x0'));var _=require(_0xfb74('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfb74('0x2'));var crypto=require(_0xfb74('0x3'));var logger=require(_0xfb74('0x4'))(_0xfb74('0x5'));module[_0xfb74('0x6')]=function(_0x15fef3,_0x49cb84,_0x32cf6a,_0x4de05e){return new BPromise(function(_0xd23535,_0x195986){logger[_0xfb74('0x7')](_0xfb74('0x8'),_0x4de05e||_0xfb74('0x9'));var _0x25b81f=new WebSocket(_0x4de05e||_0xfb74('0x9'),{'perMessageDeflate':![]});var _0x12da0f='';var _0x3ac90d='0';var _0x549b55='1';var _0x1fed5a=_0xfb74('0xa');function _0x5a250a(_0x32765b){var _0x14b51e=crypto[_0xfb74('0xb')](_0xfb74('0xc'));_0x14b51e[_0xfb74('0xd')](_0x32765b);return _0x14b51e[_0xfb74('0xe')](_0xfb74('0xf'));}function _0x5d2b9b(){try{logger[_0xfb74('0x7')](_0xfb74('0x10'));var _0x5e09dd=moment()[_0xfb74('0x11')]();var _0x4227ac=_0x5a250a(_0x5e09dd+_0x49cb84+_0x32cf6a);_0x25b81f['send'](JSON[_0xfb74('0x12')]({'appID':_0x49cb84,'timestamp':_0x5e09dd,'appKey':_0x4227ac}));var _0x155d38=fs[_0xfb74('0x13')](_0x15fef3);_0x155d38['on'](_0xfb74('0x14'),function(_0x113b1a){_0x25b81f[_0xfb74('0x15')](_0x113b1a);});_0x155d38['on']('close',function(){_0x25b81f['send'](_0xfb74('0x16'));});}catch(_0x41fe88){logger['error'](_0xfb74('0x17'),JSON['stringify'](_0x41fe88));_0x25b81f[_0xfb74('0x18')]();}}function _0x3bccb1(_0x4bb759){try{if(_0x4bb759){var _0x340738=JSON[_0xfb74('0x19')](_0x4bb759);switch(_0x340738['status']){case 0x0:if(_0x340738['result']){if(_0x340738[_0xfb74('0x1a')]['final']){logger[_0xfb74('0x7')](_0xfb74('0x1b'),JSON[_0xfb74('0x12')](_0x340738[_0xfb74('0x1a')][_0xfb74('0x1c')]));_0x12da0f=_0x340738['result'][_0xfb74('0x1c')][0x0]['transcript'];_0x3ac90d=_0x340738[_0xfb74('0x1a')][_0xfb74('0x1c')][0x0][_0xfb74('0x1d')];_0x549b55='0';_0x1fed5a=_0xfb74('0x1e');_0x25b81f[_0xfb74('0x18')]();}}break;case 0x1:logger[_0xfb74('0x7')](_0xfb74('0xa'));_0x549b55='1';_0x1fed5a='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xfb74('0x7')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x549b55='2';_0x1fed5a=_0xfb74('0x1f');break;case 0x9:logger['info'](_0xfb74('0x20'));_0x549b55='9';_0x1fed5a=_0xfb74('0x20');break;case 0xa:logger[_0xfb74('0x7')](_0xfb74('0x21'));_0x549b55='10';_0x1fed5a=_0xfb74('0x21');break;case 0xb:logger[_0xfb74('0x7')](_0xfb74('0x22'));_0x549b55='11';_0x1fed5a=_0xfb74('0x22');}}}catch(_0x308d9f){logger[_0xfb74('0x23')](_0xfb74('0x24'),JSON['stringify'](_0x308d9f));_0x25b81f['terminate']();}}function _0x1782d7(){logger[_0xfb74('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0xd23535({'transcript':_0x12da0f,'confidence':_0x3ac90d,'status':_0x549b55,'status_message':_0x1fed5a});}function _0x385d4f(_0x41296b){logger[_0xfb74('0x23')](_0xfb74('0x25'));if(!_[_0xfb74('0x26')](_0x41296b)){logger[_0xfb74('0x23')](_[_0xfb74('0x27')](_0x41296b)?JSON[_0xfb74('0x12')](_0x41296b):_0x41296b);}}_0x25b81f['on']('open',_0x5d2b9b);_0x25b81f['on'](_0xfb74('0x28'),_0x3bccb1);_0x25b81f['on'](_0xfb74('0x29'),_0x1782d7);_0x25b81f['on'](_0xfb74('0x23'),_0x385d4f);});}; \ 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 a7213b7..8e20ea1 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 _0xd41f=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd41f,0x1ee));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};var asr=require(_0xfd41('0x0'));module[_0xfd41('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5ca8=['exports'];(function(_0x1f7c09,_0x22c795){var _0xff6a71=function(_0x771642){while(--_0x771642){_0x1f7c09['push'](_0x1f7c09['shift']());}};_0xff6a71(++_0x22c795);}(_0x5ca8,0x1b2));var _0x85ca=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ca8[_0x4a9fb1];return _0x348672;};var asr=require('./asr');module[_0x85ca('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 97e376c..7b78df6 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x541a55,_0x6edd1c){var _0x3706cc=function(_0x7ef6f8){while(--_0x7ef6f8){_0x541a55['push'](_0x541a55['shift']());}};_0x3706cc(++_0x6edd1c);}(_0x34e8,0x12c));var _0x834e=function(_0xe72bd6,_0x14a118){_0xe72bd6=_0xe72bd6-0x0;var _0x7cc7ec=_0x34e8[_0xe72bd6];return _0x7cc7ec;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x51255f,_0x449b9a){var _0x3de01e=function(_0x154a91){while(--_0x154a91){_0x51255f['push'](_0x51255f['shift']());}};_0x3de01e(++_0x449b9a);}(_0x34e8,0x12c));var _0x834e=function(_0x553b17,_0x4757e6){_0x553b17=_0x553b17-0x0;var _0x414b52=_0x34e8[_0x553b17];return _0x414b52;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2f8e014..ec62ede 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 _0x7497=['private_key','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','dialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','response','maxdigit','mindigit','hiddendigitsnum','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','generate','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','getSound','no\x20file\x20audio\x20found','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','macro','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','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','host','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','dsn','getUser','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','isNil','agentLogout','agentLogin','internal','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','parse','headers','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','dialogflowV2_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','delay','add','minutes','phone','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','query','no\x20query\x20configured','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured'];(function(_0x8576c1,_0x43b71a){var _0x1b6684=function(_0x31ac7a){while(--_0x31ac7a){_0x8576c1['push'](_0x8576c1['shift']());}};_0x1b6684(++_0x43b71a);}(_0x7497,0xd0));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require(_0x7749('0x0'));var _=require(_0x7749('0x1'));var sh=require(_0x7749('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x7749('0x3'));var rp=require(_0x7749('0x4'));var logger=require('../../config/logger')(_0x7749('0x5'));var config=require(_0x7749('0x6'));var shared=require(_0x7749('0x7'));var scripts=require(_0x7749('0x8'));var FILES_PATH=_0x7749('0x9');var recursiveMapAttributes=[_0x7749('0xa'),_0x7749('0xb')];var verticesWithRetry=[_0x7749('0xc'),_0x7749('0xd'),_0x7749('0xe')];var AGIVertices=function(_0x2400ea,_0x5aac6f,_0xb58b29){this['channel']=_0x2400ea;this[_0x7749('0xf')]=_0x5aac6f;this[_0x7749('0x10')]=_0xb58b29;};AGIVertices[_0x7749('0x11')][_0x7749('0x12')]=function(_0x35ff9,_0x3feb69){this[_0x7749('0xf')][_0x7749('0x13')](_0x35ff9)[_0x7749('0x14')](function(_0x51b2d7){_0x3feb69(null,_0x51b2d7?_0x51b2d7['name']:![]);})[_0x7749('0x15')](function(_0x5b5ac5){_0x3feb69(_0x5b5ac5);});};AGIVertices['prototype'][_0x7749('0x16')]=function(_0x406ed2,_0x165837){this[_0x7749('0xf')][_0x7749('0x17')](_0x406ed2)[_0x7749('0x14')](function(_0x49ef77){_0x165837(null,_0x49ef77?_0x49ef77['name']:![]);})[_0x7749('0x15')](function(_0x427943){_0x165837(_0x427943);});};AGIVertices['prototype'][_0x7749('0x18')]=function(_0x4786e7,_0x42c942){this[_0x7749('0xf')][_0x7749('0x19')](_0x4786e7)[_0x7749('0x14')](function(_0x46e548){_0x42c942(null,_0x46e548?_0x46e548[_0x7749('0x1a')]:![]);})[_0x7749('0x15')](function(_0x3c6ed3){_0x42c942(_0x3c6ed3);});};AGIVertices['prototype'][_0x7749('0x1b')]=function(_0x16f276,_0x576ede){this[_0x7749('0xf')]['getSquareOdbcById'](_0x16f276)[_0x7749('0x14')](function(_0x11013a){_0x576ede(null,_0x11013a?_0x11013a[_0x7749('0x1c')]:![]);})[_0x7749('0x15')](function(_0x356f3b){_0x576ede(_0x356f3b);});};AGIVertices[_0x7749('0x11')][_0x7749('0x1d')]=function(_0x397a24,_0x4366a8){this[_0x7749('0xf')]['getUserById'](_0x397a24)[_0x7749('0x14')](function(_0x9a2283){_0x4366a8(null,_0x9a2283?_0x9a2283['name']:![]);})['catch'](function(_0x413eae){_0x4366a8(_0x413eae);});};AGIVertices['prototype'][_0x7749('0x1e')]=function(_0x2c9879,_0x46c66f){this[_0x7749('0xf')]['getTrunkById'](_0x2c9879)[_0x7749('0x14')](function(_0x4e5f3a){_0x46c66f(null,_0x4e5f3a?_0x4e5f3a['name']:![]);})['catch'](function(_0x493cec){_0x46c66f(_0x493cec);});};AGIVertices['prototype']['getSound']=function(_0x1b9353,_0x3e3698){var _0x48d509=this;this[_0x7749('0xf')][_0x7749('0x1f')](_0x1b9353)[_0x7749('0x14')](function(_0x274c77){_0x3e3698(null,_0x274c77?_0x48d509[_0x7749('0x20')](_0x274c77[_0x7749('0x21')]):![]);})['catch'](function(_0x1d7454){_0x3e3698(_0x1d7454);});};AGIVertices[_0x7749('0x11')][_0x7749('0x22')]=function(_0x51216e,_0xfda033){this[_0x7749('0xf')][_0x7749('0x23')](_0x51216e)[_0x7749('0x14')](function(_0x38ea3d){_0xfda033(null,_0x38ea3d?_0x38ea3d:![]);})[_0x7749('0x15')](function(_0x265e83){_0xfda033(_0x265e83);});};AGIVertices[_0x7749('0x11')][_0x7749('0x24')]=function(_0x1f17d4,_0x2980bd,_0x8247f9){this[_0x7749('0x10')][_0x7749('0x24')](_0x1f17d4,_0x2980bd)[_0x7749('0x14')](function(){_0x8247f9(null);})[_0x7749('0x15')](function(_0x3fbcac){_0x8247f9(_0x3fbcac);});};AGIVertices['prototype'][_0x7749('0x25')]=function(_0x11911e,_0x13e50f){this[_0x7749('0xf')]['getIntervalById'](_0x11911e)['then'](function(_0x5a2cc1){if(_0x5a2cc1){if(_0x5a2cc1[_0x7749('0x26')]){_0x13e50f(null,[_0x5a2cc1[_0x7749('0x27')]]);}else{_0x13e50f(null,_[_0x7749('0x28')](_0x5a2cc1[_0x7749('0x29')],'interval'));}}else{_0x13e50f(null,![]);}})[_0x7749('0x15')](function(_0x2eae2f){_0x13e50f(_0x2eae2f);});};AGIVertices[_0x7749('0x11')]['getSoundPath']=function(_0x3181d4){return util[_0x7749('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x3181d4);};AGIVertices[_0x7749('0x11')]['getQueryOdbc']=function(_0x21d95d,_0x3c535b,_0x459fd4){odbc['open'](_0x21d95d,function(_0x44c7f8){if(_0x44c7f8){logger[_0x7749('0x2b')](_0x7749('0x2c'),_0x44c7f8);_0x459fd4(_0x44c7f8);}else{logger[_0x7749('0x2d')]('ODBC\x20connection\x20successfully');odbc['query'](_0x3c535b,function(_0x5bf936,_0x3826d5){if(_0x5bf936){logger[_0x7749('0x2d')](_0x7749('0x2e'),_0x3c535b);_0x459fd4(_0x5bf936);}else{logger[_0x7749('0x2d')](_0x7749('0x2f'),_0x3c535b);odbc[_0x7749('0x30')](function(_0x32fcf6){if(_0x32fcf6){logger[_0x7749('0x2b')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x32fcf6);}_0x459fd4(null,_0x3826d5);});}});}});};AGIVertices[_0x7749('0x11')][_0x7749('0x31')]=function(_0x2317b8,_0x42fc31){this[_0x7749('0xf')][_0x7749('0x32')](_0x2317b8)[_0x7749('0x14')](function(_0x31dacc){_0x42fc31(null,_0x31dacc?_0x31dacc:![]);})[_0x7749('0x15')](function(_0xf13593){_0x42fc31(_0xf13593);});};AGIVertices[_0x7749('0x11')][_0x7749('0x33')]=function(_0xa6bd7,_0xda6645){this[_0x7749('0xf')]['createSmsMessage'](_0xa6bd7)[_0x7749('0x14')](function(_0x2cfd7a){_0xda6645(null,_0x2cfd7a);})['catch'](function(_0x5e6c74){_0xda6645(_0x5e6c74);});};AGIVertices[_0x7749('0x11')][_0x7749('0x34')]=function(_0x183cdd,_0x10056a,_0x4b20c5){this[_0x7749('0xf')][_0x7749('0x34')]({'uniqueid':this[_0x7749('0x35')]['uniqueid'],'node':_0x183cdd[_0x7749('0x36')],'application':_0x183cdd[_0x7749('0x37')],'data':_0x10056a||null,'project_name':this['channel'][_0x7749('0x38')],'callerid':this[_0x7749('0x35')][_0x7749('0x39')]})[_0x7749('0x14')](function(_0x554e59){if(_0x4b20c5){_0x4b20c5(null,_0x554e59);}})[_0x7749('0x15')](function(_0x2d8e4d){if(_0x4b20c5){_0x4b20c5(_0x2d8e4d);}});};AGIVertices[_0x7749('0x11')][_0x7749('0x3a')]=function(_0x1c4c89,_0x56bea1,_0x5b761f,_0x5e5cd5){this['rpc'][_0x7749('0x3a')]({'uniqueid':this[_0x7749('0x35')][_0x7749('0x3b')],'callerid':this['channel'][_0x7749('0x39')],'calleridname':this[_0x7749('0x35')][_0x7749('0x3c')],'context':this[_0x7749('0x35')][_0x7749('0x3d')],'extension':this[_0x7749('0x35')][_0x7749('0x3e')],'priority':this[_0x7749('0x35')][_0x7749('0x3f')],'accountcode':this[_0x7749('0x35')]['accountcode'],'dnid':this[_0x7749('0x35')][_0x7749('0x40')],'projectName':this[_0x7749('0x35')][_0x7749('0x38')],'saveName':_0x56bea1,'filename':_0x1c4c89[_0x7749('0x41')]||_0x56bea1,'savePath':_0x5b761f})[_0x7749('0x14')](function(_0x53f224){_0x5e5cd5(null,_0x53f224);})[_0x7749('0x15')](function(_0x3595c3){_0x5e5cd5(_0x3595c3);});};AGIVertices[_0x7749('0x11')][_0x7749('0x42')]=function(_0x604575,_0x9b58f4,_0x20e9e4,_0x39dd83,_0x3ed57b){this['rpc'][_0x7749('0x42')]({'uniqueid':this[_0x7749('0x35')][_0x7749('0x3b')],'body':_0x604575,'direction':_0x9b58f4,'providerName':_0x20e9e4,'providerResponse':_0x39dd83})['then'](function(_0x3b2b51){if(_0x3ed57b){_0x3ed57b(null,_0x3b2b51);}})[_0x7749('0x15')](function(_0x2872b7){if(_0x3ed57b){_0x3ed57b(_0x2872b7);}});};AGIVertices[_0x7749('0x11')][_0x7749('0x43')]=function(_0x464a18,_0x2a0a48){this[_0x7749('0xf')][_0x7749('0x43')]({'firstName':_[_0x7749('0x44')](_0x464a18[_0x7749('0x1a')])||_['isNil'](_0x464a18[_0x7749('0x1a')])?_0x7749('0x45')+Math[_0x7749('0x46')]():_0x464a18[_0x7749('0x1a')],'lastName':_['isEmpty'](_0x464a18['lastName'])||_['isNil'](_0x464a18['lastName'])?null:_0x464a18[_0x7749('0x47')],'phone':_0x464a18['phone'],'ListId':_0x464a18[_0x7749('0x48')],'scheduledat':_0x464a18[_0x7749('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x7749('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x464a18[_0x7749('0x49')][_0x7749('0x4b')](),'priority':_0x464a18[_0x7749('0x4c')]})[_0x7749('0x14')](function(_0xf8bee5){_0x2a0a48(null,_0xf8bee5);})[_0x7749('0x15')](function(_0x11e21f){_0x2a0a48(_0x11e21f);});};AGIVertices['prototype']['getPause']=function(_0xefc337,_0x1d1e50){this[_0x7749('0xf')][_0x7749('0x4d')](_0xefc337)[_0x7749('0x14')](function(_0x43a2b6){_0x1d1e50(null,_0x43a2b6?_0x43a2b6[_0x7749('0x1a')]:![]);})[_0x7749('0x15')](function(_0x35aaa9){_0x1d1e50(_0x35aaa9);});};AGIVertices[_0x7749('0x11')][_0x7749('0x4e')]=function(_0x4b9fdc,_0x429adf,_0x20dec0){var _0x23eff0={'role':_0x7749('0x4f')};_0x23eff0[_0x4b9fdc]=this[_0x7749('0x35')][_0x7749('0x39')];this[_0x7749('0xf')][_0x7749('0x4e')](_0x23eff0,_0x429adf,this[_0x7749('0x35')]['uniqueid'])[_0x7749('0x14')](function(_0x31f234){_0x20dec0(null,_['isNil'](_0x31f234)?![]:!![]);})[_0x7749('0x15')](function(_0x2a6f14){logger[_0x7749('0x2b')](_0x2a6f14);_0x20dec0(null,![]);});};AGIVertices['prototype'][_0x7749('0x50')]=function(_0x44a66d,_0x67418e){var _0x4a2722={'role':_0x7749('0x4f')};_0x4a2722[_0x44a66d]=this[_0x7749('0x35')]['callerid'];this[_0x7749('0xf')][_0x7749('0x50')](_0x4a2722)[_0x7749('0x14')](function(_0x5d8529){_0x67418e(null,_[_0x7749('0x51')](_0x5d8529)?![]:!![]);})[_0x7749('0x15')](function(_0x84b131){logger[_0x7749('0x2b')](_0x84b131);_0x67418e(null,![]);});};AGIVertices['prototype'][_0x7749('0x52')]=function(_0x2a17cd,_0x560bf2){var _0xa93d84={'role':'agent'};_0xa93d84[_0x2a17cd]=this[_0x7749('0x35')][_0x7749('0x39')];this[_0x7749('0xf')]['agentLogout'](_0xa93d84)['then'](function(_0x2cb349){_0x560bf2(null,_[_0x7749('0x51')](_0x2cb349)?![]:!![]);})[_0x7749('0x15')](function(_0x349814){logger[_0x7749('0x2b')](_0x349814);_0x560bf2(null,![]);});};AGIVertices[_0x7749('0x11')][_0x7749('0x53')]=function(_0x3df9e0,_0xaf7ea7){var _0x5cc018={'role':_0x7749('0x4f')};_0x5cc018[_0x3df9e0]=this[_0x7749('0x35')][_0x7749('0x39')];var _0x287d8e=_0x3df9e0!=_0x7749('0x54')?util[_0x7749('0x2a')]('%s/%s@from-sip/n',_0x7749('0x55'),this['channel'][_0x7749('0x39')]):undefined;this[_0x7749('0xf')][_0x7749('0x53')](_0x5cc018,_0x287d8e)[_0x7749('0x14')](function(_0x2a03b0){_0xaf7ea7(null,_[_0x7749('0x51')](_0x2a03b0)?![]:!![]);})[_0x7749('0x15')](function(_0x330414){logger[_0x7749('0x2b')](_0x330414);_0xaf7ea7(null,![]);});};AGIVertices[_0x7749('0x11')][_0x7749('0x56')]=function(_0x13724,_0x484a43){sh[_0x7749('0x57')](_[_0x7749('0x58')](_0x13724),function(_0x5c00ed,_0x46338b){var _0x1a4ffe=_0x46338b[_0x7749('0x59')](/(\r\n|\n|\r)/gm,'');_0x484a43(null,_0x1a4ffe);});};AGIVertices[_0x7749('0x11')]['googleCloudTTS']=function(_0xeb4bea,_0xe54e0e){scripts[_0x7749('0x5a')](_0xeb4bea[_0x7749('0x5b')],_0xeb4bea[_0x7749('0x5c')]||_0x7749('0x5d'),_0xeb4bea[_0x7749('0x5d')],_0xeb4bea[_0x7749('0x5e')]||_0x7749('0x5f'),_0xeb4bea[_0x7749('0x60')]||_0x7749('0x61'),_0xeb4bea['audioEncoding']||_0x7749('0x62'))[_0x7749('0x14')](function(_0x562b8c){_0xe54e0e(null,_0x562b8c);})['catch'](function(_0x3d958d){_0xe54e0e(_0x3d958d);});};AGIVertices[_0x7749('0x11')][_0x7749('0x63')]=function(_0x5ab069,_0x34f125){scripts[_0x7749('0x63')](_0x5ab069[_0x7749('0x5d')],_0x5ab069[_0x7749('0x64')]||'en',0x1)[_0x7749('0x14')](function(_0x2e596f){_0x34f125(null,_0x2e596f);})[_0x7749('0x15')](function(_0x4f585d){_0x34f125(_0x4f585d);});};AGIVertices[_0x7749('0x11')][_0x7749('0x65')]=function(_0xcb191f,_0x3f996a){var _0x2d11b9={'uri':_0xcb191f[_0x7749('0x66')],'method':_0xcb191f[_0x7749('0x67')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xcb191f[_0x7749('0x68')])===_0x7749('0x69')&&parseInt(_0xcb191f[_0x7749('0x68')])>=0x1?parseInt(_0xcb191f['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x7749('0x6a')](['POST',_0x7749('0x6b')],_0x2d11b9['method'][_0x7749('0x6c')]())){try{_0x2d11b9[_0x7749('0x6d')]=_0xcb191f[_0x7749('0xb')]?JSON[_0x7749('0x6e')](_0xcb191f[_0x7749('0xb')]):{};}catch(_0x2656b2){logger[_0x7749('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2656b2);}}try{_0x2d11b9[_0x7749('0x6f')]=_0xcb191f[_0x7749('0xa')]?JSON[_0x7749('0x6e')](_0xcb191f[_0x7749('0xa')]):{};}catch(_0x487d80){logger[_0x7749('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x487d80);}if(_0xcb191f[_0x7749('0x70')]){try{var _0x3526c3=require(_0xcb191f[_0x7749('0x70')])['sync'](this,_0x2d11b9);_0x2d11b9[_0x7749('0x71')]=Mustache[_0x7749('0x72')](_0xcb191f['url'],_0x3526c3,{},['$$','$$']);if(_0x2d11b9[_0x7749('0x6f')]){_0x2d11b9['headers']=JSON[_0x7749('0x6e')](Mustache[_0x7749('0x72')](JSON[_0x7749('0x73')](_0x2d11b9['headers']),_0x3526c3,{},['$$','$$']));}if(_0x2d11b9[_0x7749('0x6d')]){_0x2d11b9[_0x7749('0x6d')]=JSON[_0x7749('0x6e')](Mustache['render'](JSON['stringify'](_0x2d11b9[_0x7749('0x6d')]),_0x3526c3,{},['$$','$$']));}}catch(_0x2f177a){logger[_0x7749('0x2b')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2f177a);}}rp(_0x2d11b9)[_0x7749('0x14')](function(_0x10426b){var _0xfd99c7={'statusCode':_0x10426b[_0x7749('0x74')]||0xc8,'statusMessage':_0x10426b[_0x7749('0x75')]||'OK','headers':_0x10426b[_0x7749('0x6f')]||{},'body':_0x10426b[_0x7749('0x6d')]||{}};_0x3f996a(null,_0xfd99c7);})['catch'](function(_0x3dfe83){var _0x1ebb7f={'statusCode':_0x3dfe83[_0x7749('0x74')]||0x1f4,'statusMessage':_0x3dfe83[_0x7749('0x76')]||_0x7749('0x77'),'headers':_0x3dfe83['options']['headers']||{},'body':_0x3dfe83[_0x7749('0x78')][_0x7749('0x6d')]||{}};_0x3f996a(null,_0x1ebb7f);});};AGIVertices[_0x7749('0x11')]['googleDialogflow']=function(_0x3f90ec,_0x10e33f){scripts[_0x7749('0x79')](this['channel'][_0x7749('0x3b')],_0x3f90ec[_0x7749('0x7a')],_0x3f90ec[_0x7749('0x5d')],_0x3f90ec[_0x7749('0x7b')]||'en')[_0x7749('0x14')](function(_0x2bb667){_0x10e33f(null,_0x2bb667);})['catch'](function(_0x1276b7){_0x10e33f(_0x1276b7);});};AGIVertices[_0x7749('0x11')]['googleDialogflowV2']=function(_0xbdba69,_0x5335ba){scripts['googleDialogflowV2'](this[_0x7749('0x35')][_0x7749('0x3b')],_0xbdba69[_0x7749('0x7c')],_0xbdba69['client_email'],_0xbdba69['private_key'],_0xbdba69[_0x7749('0x5d')],_0xbdba69[_0x7749('0x7d')]||'en')[_0x7749('0x14')](function(_0x2f116f){_0x5335ba(null,_0x2f116f);})[_0x7749('0x15')](function(_0x52d1b0){_0x5335ba(_0x52d1b0);});};AGIVertices['prototype'][_0x7749('0x7e')]=function(_0x2a72f9,_0x54061c){scripts[_0x7749('0x7e')](this['channel'],_0x2a72f9)[_0x7749('0x14')](function(_0x1d2914){_0x54061c(null,_0x1d2914);})[_0x7749('0x15')](function(_0x431568){_0x54061c(_0x431568);});};AGIVertices['prototype'][_0x7749('0x7f')]=function(_0x18868b,_0x1ce749){scripts[_0x7749('0x7f')](_0x18868b['key'],_0x18868b[_0x7749('0x5d')],_0x18868b['ispeech_tts_language']||_0x7749('0x5f'),_0x18868b[_0x7749('0x80')])[_0x7749('0x14')](function(_0x1fc17e){_0x1ce749(null,_0x1fc17e);})[_0x7749('0x15')](function(_0x40c787){_0x1ce749(_0x40c787);});};AGIVertices[_0x7749('0x11')]['ispeechASR']=function(_0x4d3a16,_0x2fc2ab,_0x58aad3){scripts[_0x7749('0x81')](_0x2fc2ab,_0x4d3a16[_0x7749('0x7a')],_0x4d3a16[_0x7749('0x82')]||_0x7749('0x5f'),this['isConfigured'](_0x4d3a16[_0x7749('0x83')])?_0x4d3a16['model']:undefined)['then'](function(_0x44cb03){_0x58aad3(null,_0x44cb03);})[_0x7749('0x15')](function(_0x2fd26d){_0x58aad3(_0x2fd26d);});};AGIVertices[_0x7749('0x11')]['awsPolly']=function(_0x35783a,_0x476e98){scripts[_0x7749('0x84')](_0x35783a[_0x7749('0x85')],_0x35783a[_0x7749('0x86')],_0x35783a['aws_polly_region'],_0x35783a[_0x7749('0x87')]||_0x7749('0x88'),_0x35783a['text'],_0x35783a[_0x7749('0x89')]||_0x7749('0x5d'))['then'](function(_0x4df4ad){_0x476e98(null,_0x4df4ad);})[_0x7749('0x15')](function(_0x288e89){_0x476e98(_0x288e89);});};AGIVertices[_0x7749('0x11')][_0x7749('0x8a')]=function(_0x516612,_0x3b9051){scripts[_0x7749('0x8a')](this[_0x7749('0x35')][_0x7749('0x3b')],_0x516612[_0x7749('0x85')],_0x516612['aws_secret_access_key'],_0x516612[_0x7749('0x8b')],_0x516612[_0x7749('0x5d')],_0x516612['aws_bot_name'])[_0x7749('0x14')](function(_0x30220f){_0x3b9051(null,_0x30220f);})[_0x7749('0x15')](function(_0xfc6b60){_0x3b9051(_0xfc6b60);});};AGIVertices['prototype'][_0x7749('0x8c')]=function(_0x3152bd,_0xd9355c,_0x2e873a){scripts[_0x7749('0x8c')](_0xd9355c,_0x3152bd[_0x7749('0x7a')],_0x3152bd[_0x7749('0x8d')]||_0x7749('0x5f'))[_0x7749('0x14')](function(_0x2b1e3f){_0x2e873a(null,_0x2b1e3f);})[_0x7749('0x15')](function(_0xb6d4f5){_0x2e873a(_0xb6d4f5);});};AGIVertices[_0x7749('0x11')][_0x7749('0x8e')]=function(_0xb83145,_0x165850,_0x5116eb){scripts['tildeASR'](_0x165850,_0xb83145['appid'],_0xb83145[_0x7749('0x8f')],_0xb83145[_0x7749('0x71')])[_0x7749('0x14')](function(_0x2b67a7){_0x5116eb(null,_0x2b67a7);})[_0x7749('0x15')](function(_0x38125f){_0x5116eb(_0x38125f);});};AGIVertices['prototype'][_0x7749('0x90')]=function(_0x5ba996){var _0x22c91f=_[_0x7749('0x6a')](verticesWithRetry,_0x5ba996[_0x7749('0x37')])?_0x5ba996:_[_0x7749('0x91')](_0x5ba996);for(var _0x1ec4e3 in _0x22c91f){if(_0x22c91f[_0x7749('0x92')](_0x1ec4e3)){if(_0x22c91f[_0x1ec4e3]&&_[_0x7749('0x93')](_0x22c91f[_0x1ec4e3])){if(_[_0x7749('0x6a')](recursiveMapAttributes,_0x1ec4e3)){_0x22c91f[_0x1ec4e3]=this[_0x7749('0x94')](_0x22c91f[_0x1ec4e3]);}else{_0x22c91f[_0x1ec4e3]=this[_0x7749('0x95')](_0x22c91f[_0x1ec4e3]);}}}}return _0x22c91f;};AGIVertices[_0x7749('0x11')][_0x7749('0x96')]=function(_0x2a2441){for(var _0x1dbe3f in _0x2a2441){if(_0x2a2441[_0x7749('0x92')](_0x1dbe3f)){if(_[_0x7749('0x97')](_0x2a2441[_0x1dbe3f])){this[_0x7749('0x96')](_0x2a2441[_0x1dbe3f]);}else if(_[_0x7749('0x98')](_0x2a2441[_0x1dbe3f])){for(var _0x1dae1a=0x0;_0x1dae1a<_0x2a2441[_0x1dbe3f][_0x7749('0x99')];_0x1dae1a++){this[_0x7749('0x96')](_0x2a2441[_0x1dbe3f][_0x1dae1a]);}}else if(_['isString'](_0x2a2441[_0x1dbe3f])){_0x2a2441[_0x1dbe3f]=this[_0x7749('0x95')](_0x2a2441[_0x1dbe3f]);}}}};AGIVertices[_0x7749('0x11')][_0x7749('0x9a')]=function(_0x2ecb78,_0x2e48c7){for(var _0x2a5eb0 in _0x2ecb78){if(_0x2ecb78[_0x7749('0x92')](_0x2a5eb0)){if(_['isPlainObject'](_0x2ecb78[_0x2a5eb0])){if(!_[_0x7749('0x44')](_0x2ecb78[_0x2a5eb0])){this[_0x7749('0x9a')](_0x2ecb78[_0x2a5eb0],util[_0x7749('0x2a')]('%s.%s',_0x2e48c7,_0x2a5eb0));}}else if(_[_0x7749('0x98')](_0x2ecb78[_0x2a5eb0])){for(var _0x2c61d6=0x0;_0x2c61d6<_0x2ecb78[_0x2a5eb0][_0x7749('0x99')];_0x2c61d6++){this[_0x7749('0x9a')](_0x2ecb78[_0x2a5eb0][_0x2c61d6],util[_0x7749('0x2a')](_0x7749('0x9b'),_0x2e48c7,_0x2a5eb0+'['+_0x2c61d6+']'));}}else{if(!_[_0x7749('0x51')](_0x2ecb78[_0x2a5eb0])){this[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')](_0x7749('0x9b'),_0x2e48c7,_0x2a5eb0),_0x2ecb78[_0x2a5eb0]);}}}}};AGIVertices[_0x7749('0x11')]['replaceObjectAllVariables']=function(_0x18c95d){try{var _0x622963=JSON['parse'](_0x18c95d);this[_0x7749('0x96')](_0x622963);return JSON[_0x7749('0x73')](_0x622963);}catch(_0x11c793){return this[_0x7749('0x95')](_0x18c95d);}};AGIVertices[_0x7749('0x11')][_0x7749('0x95')]=function(_0x2d997d){var _0x2ac630=_0x2d997d['split']('{');for(var _0x1377e1=0x1;_0x1377e1<_0x2ac630[_0x7749('0x99')];_0x1377e1+=0x1){var _0x558888=_0x2ac630[_0x1377e1][_0x7749('0x9d')]('}');if(_0x558888[_0x7749('0x99')]>0x1){_0x2d997d=_0x2d997d[_0x7749('0x9e')]('{'+_0x558888[0x0]+'}',this[_0x7749('0x35')][_0x7749('0x12')](_0x558888[0x0])[_0x7749('0x9f')]||_0x558888[0x0]);}}if(_0x2ac630[_0x7749('0x99')]===0x1){return _0x2d997d[_0x7749('0x4b')]();}return this[_0x7749('0x95')](_0x2d997d);};AGIVertices['prototype'][_0x7749('0xa0')]=function(_0x33fc1e,_0x5bc192){var _0x1bf414=this[_0x7749('0x35')]['getVariable'](_0x33fc1e);if(_0x1bf414[_0x7749('0xa1')]===-0x1){return _0x1bf414;}logger['info'](util[_0x7749('0x2a')](_0x7749('0xa2'),_0x5bc192,_0x1bf414[_0x7749('0x9f')]));return this[_0x7749('0x35')][_0x7749('0x9c')](_0x5bc192,_0x1bf414['extra']);};AGIVertices[_0x7749('0x11')]['isConfigured']=function(_0x520726){return _0x520726&&_0x520726!=='0'&&_0x520726!=='-1'&&_0x520726!=='';};AGIVertices['prototype'][_0x7749('0xa3')]=function(_0x3491b0){this['createSquareDetailsReport'][_0x7749('0xa4')](this,_0x3491b0,'-');_0x3491b0[_0x7749('0xa5')]=_0x3491b0[_0x7749('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7749('0x11')][_0x7749('0xa6')]=function(_0x3a8be2){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0xa7'),_0x3a8be2[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x3a8be2[_0x7749('0x5d')])){return this['channel'][_0x7749('0xa9')](_0x7749('0xaa'));}var _0x31de4d='\x22'+_0x3a8be2[_0x7749('0x5d')]+'\x22';if(this[_0x7749('0xa8')](_0x3a8be2[_0x7749('0x78')])){_0x31de4d+=','+_0x3a8be2[_0x7749('0x78')];}var _0x2d94b5=this[_0x7749('0x35')]['exec']('MRCPSynth',_0x31de4d);if(_0x2d94b5['result']===-0x1){return _0x2d94b5;}return this[_0x7749('0x35')][_0x7749('0xa9')](util['format'](_0x7749('0xab'),_0x31de4d));};AGIVertices[_0x7749('0x11')]['mrcprecog']=function(_0x5d6010){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5d6010[_0x7749('0x36')]));if(!this['isConfigured'](_0x5d6010['grammar'])){return this[_0x7749('0x35')]['noop'](_0x7749('0xac'));}var _0x17a3f0=_0x5d6010[_0x7749('0xad')];if(this[_0x7749('0xa8')](_0x5d6010[_0x7749('0x78')])){_0x17a3f0+=','+_0x5d6010[_0x7749('0x78')];}var _0x3e8246=this['channel'][_0x7749('0x57')](_0x7749('0xae'),_0x17a3f0);if(_0x3e8246['result']===-0x1){return _0x3e8246;}var _0x5823dd=this[_0x7749('0xa0')](_0x7749('0xaf'),'MRCP_RECOG_CONFIDENCE');if(_0x5823dd['result']===-0x1){return _0x5823dd;}var _0x5933f1=this[_0x7749('0xa0')]('RECOG_INPUT()',_0x7749('0xb0'));if(_0x5933f1[_0x7749('0xa1')]===-0x1){return _0x5933f1;}var _0x5d2f94=this[_0x7749('0xa0')]('RECOG_INSTANCE()',_0x7749('0xb1'));if(_0x5d2f94[_0x7749('0xa1')]===-0x1){return _0x5d2f94;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xb2'),_0x17a3f0));};AGIVertices[_0x7749('0x11')][_0x7749('0x5')]=function(_0x246f39){logger['info'](util[_0x7749('0x2a')](_0x7749('0xb3'),_0x246f39[_0x7749('0x36')]));return this[_0x7749('0x35')][_0x7749('0x5')]([_0x246f39[_0x7749('0xb4')],_0x246f39['args']]);};AGIVertices['prototype'][_0x7749('0xb5')]=function(_0x4e8746){logger[_0x7749('0x2d')](util['format'](_0x7749('0xb6'),_0x4e8746[_0x7749('0x36')]));if(this[_0x7749('0xa8')](_0x4e8746[_0x7749('0x68')])){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0xb7'),_0x4e8746[_0x7749('0x68')]));var _0x55fb53=this['channel']['wait'](_0x4e8746['timeout']);if(_0x55fb53['result']===-0x1){return _0x55fb53;}}return this['channel']['answer']();};AGIVertices[_0x7749('0x11')][_0x7749('0x4a')]=function(_0x11708f){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x11708f[_0x7749('0x36')]));if(!this['isConfigured'](_0x11708f[_0x7749('0x48')])){return this['channel'][_0x7749('0x2b')](_0x11708f,_0x7749('0xb8'));}_0x11708f[_0x7749('0x49')]=moment();if(this[_0x7749('0xa8')](_0x11708f[_0x7749('0xb9')])){_0x11708f[_0x7749('0x49')]=moment()[_0x7749('0xba')](_0x11708f['delay'],_0x7749('0xbb'));}if(!this[_0x7749('0xa8')](_0x11708f[_0x7749('0x4c')])){_0x11708f[_0x7749('0x4c')]=0x2;}this[_0x7749('0x43')][_0x7749('0xa4')](this,_0x11708f);return this[_0x7749('0x35')][_0x7749('0xa9')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x11708f[_0x7749('0xbc')],_0x11708f[_0x7749('0x48')],_0x11708f[_0x7749('0x49')]));};AGIVertices[_0x7749('0x11')][_0x7749('0xbd')]=function(_0x2b1ba0){logger[_0x7749('0x2d')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2b1ba0[_0x7749('0x36')]));var _0x2d0a79=this['channel'][_0x7749('0x57')](_0x2b1ba0[_0x7749('0xbe')],_0x2b1ba0['options']);if(_0x2d0a79['result']===-0x1){return _0x2d0a79;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xbf'),_0x2b1ba0[_0x7749('0xbe')],_0x2b1ba0[_0x7749('0x78')]));};AGIVertices[_0x7749('0x11')][_0x7749('0xc0')]=function(_0x57f0c8){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x57f0c8[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x57f0c8[_0x7749('0x5d')])){return this[_0x7749('0x35')]['noop'](_0x7749('0xaa'));}var _0x540f82='\x22'+_0x57f0c8[_0x7749('0x5d')]+'\x22';if(this[_0x7749('0xa8')](_0x57f0c8[_0x7749('0x78')])){_0x540f82+=','+_0x57f0c8[_0x7749('0x78')];}var _0xe4400e=this[_0x7749('0x35')][_0x7749('0x57')](_0x7749('0xc1'),_0x540f82);if(_0xe4400e[_0x7749('0xa1')]===-0x1){return _0xe4400e;}return this[_0x7749('0x35')][_0x7749('0xa9')](util['format'](_0x7749('0xab'),_0x540f82));};AGIVertices[_0x7749('0x11')][_0x7749('0xc2')]=function(_0x5234ca){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0xc3'),_0x5234ca['label']));if(!this['isConfigured'](_0x5234ca[_0x7749('0x5d')])){return this[_0x7749('0x35')]['noop'](_0x7749('0xaa'));}var _0x413172='\x22'+_0x5234ca[_0x7749('0x5d')]+'\x22';if(this[_0x7749('0xa8')](_0x5234ca[_0x7749('0x78')])){_0x413172+=','+_0x5234ca[_0x7749('0x78')];}var _0x2802b6=this['channel']['exec'](_0x7749('0xc1'),_0x413172);if(_0x2802b6[_0x7749('0xa1')]===-0x1){return _0x2802b6;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xab'),_0x413172));};AGIVertices[_0x7749('0x11')][_0x7749('0xc4')]=function(_0x434914){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x434914[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x434914['grammar'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xac'));}var _0x1392ff=_0x434914['grammar'];if(this[_0x7749('0xa8')](_0x434914['options'])){_0x1392ff+=','+_0x434914['options'];}var _0x104d47=this[_0x7749('0x35')][_0x7749('0x57')](_0x7749('0xae'),_0x1392ff);if(_0x104d47[_0x7749('0xa1')]===-0x1){return _0x104d47;}var _0x26f5c8=this[_0x7749('0xa0')](_0x7749('0xaf'),_0x7749('0xc5'));if(_0x26f5c8[_0x7749('0xa1')]===-0x1){return _0x26f5c8;}var _0xf0639f=this[_0x7749('0xa0')](_0x7749('0xc6'),_0x7749('0xc7'));if(_0xf0639f[_0x7749('0xa1')]===-0x1){return _0xf0639f;}var _0x1ef48d=this[_0x7749('0xa0')]('RECOG_INSTANCE()',_0x7749('0xc8'));if(_0x1ef48d[_0x7749('0xa1')]===-0x1){return _0x1ef48d;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1392ff));};AGIVertices[_0x7749('0x11')][_0x7749('0xc9')]=function(_0x222821){logger['info'](util[_0x7749('0x2a')](_0x7749('0xca'),_0x222821[_0x7749('0x36')]));if(!this['isConfigured'](_0x222821['grammar'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xac'));}var _0x5d803a=_0x222821[_0x7749('0xad')];if(this[_0x7749('0xa8')](_0x222821['options'])){_0x5d803a+=','+_0x222821['options'];}var _0x4f7235=this[_0x7749('0x35')][_0x7749('0x57')](_0x7749('0xae'),_0x5d803a);if(_0x4f7235[_0x7749('0xa1')]===-0x1){return _0x4f7235;}var _0xc32b40=this[_0x7749('0xa0')](_0x7749('0xaf'),_0x7749('0xcb'));if(_0xc32b40[_0x7749('0xa1')]===-0x1){return _0xc32b40;}var _0x3c9068=this[_0x7749('0xa0')](_0x7749('0xc6'),_0x7749('0xcc'));if(_0x3c9068['result']===-0x1){return _0x3c9068;}var _0x407b1e=this[_0x7749('0xa0')]('RECOG_INSTANCE()',_0x7749('0xcd'));if(_0x407b1e[_0x7749('0xa1')]===-0x1){return _0x407b1e;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xb2'),_0x5d803a));};AGIVertices[_0x7749('0x11')][_0x7749('0xce')]=function(_0x3c5563){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3c5563['label']));if(!this['isConfigured'](_0x3c5563[_0x7749('0xcf')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x3c5563,_0x7749('0xd0'));}var _0x495696=this['getSquareOdbc'][_0x7749('0xa4')](this,_0x3c5563[_0x7749('0xcf')]);if(!_0x495696){return this['channel']['error'](_0x3c5563,'no\x20odbc\x20database\x20found');}if(!this[_0x7749('0xa8')](_0x3c5563[_0x7749('0xd1')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x3c5563,_0x7749('0xd2'));}var _0x5bc78b=_0x3c5563['query'][_0x7749('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('query:\x20%s',_0x5bc78b));var _0x589a6d=this[_0x7749('0xd3')][_0x7749('0xa4')](this,_0x495696,_0x5bc78b);this['createSquareDetailsReport'][_0x7749('0xa4')](this,_0x3c5563,_0x5bc78b);if(!this[_0x7749('0xa8')](_0x3c5563[_0x7749('0xd4')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xd5'));}var _0x561b6c=this[_0x7749('0x12')][_0x7749('0xa4')](this,_0x3c5563[_0x7749('0xd4')]);if(!_0x561b6c){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x3c5563,_0x7749('0xd6'));}var _0x43e0ab=this;_0x589a6d[_0x7749('0xd7')](function(_0x5ee289,_0xe08804){Object[_0x7749('0xd8')](_0x5ee289)[_0x7749('0xd7')](function(_0x2d8e26){_0x43e0ab[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')](_0x7749('0xd9'),_0x561b6c,_0xe08804,_0x2d8e26),_0x5ee289[_0x2d8e26]);});});this[_0x7749('0x35')]['setVariable'](util[_0x7749('0x2a')](_0x7749('0xda'),_0x561b6c),_0x589a6d['length']);return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('variable\x20%s\x20set',_0x561b6c));};AGIVertices[_0x7749('0x11')][_0x7749('0xdb')]=function(_0x558602){logger[_0x7749('0xdc')](util[_0x7749('0x2a')](_0x7749('0xdd'),_0x558602[_0x7749('0x36')]));if(!this['isConfigured'](_0x558602[_0x7749('0xde')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x558602,_0x7749('0xdf'));}var _0x46b852=this[_0x7749('0x1d')][_0x7749('0xa4')](this,_0x558602[_0x7749('0xde')]);if(!_0x46b852){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x558602,'no\x20user\x20found');}var _0x4afc70=this['channel'][_0x7749('0x57')](_0x7749('0xe0'),[util[_0x7749('0x2a')](_0x7749('0xe1'),_0x46b852),_0x558602[_0x7749('0x68')],_0x558602['opts'],_0x558602[_0x7749('0x66')]]);if(_0x4afc70['result']===-0x1){return _0x4afc70;}return this[_0x7749('0x35')][_0x7749('0xa9')](util['format'](_0x7749('0xe2'),_0x7749('0xe0')));};AGIVertices[_0x7749('0x11')][_0x7749('0xe3')]=function(_0x449212){logger[_0x7749('0x2d')](util['format'](_0x7749('0xe4'),_0x449212['label']));if(!this['isConfigured'](_0x449212['key'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xe5'));}if(!this[_0x7749('0xa8')](_0x449212[_0x7749('0x5d')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this[_0x7749('0x35')][_0x7749('0xe6')]=!![];this['createSquareDetailsReport'](_0x449212);this[_0x7749('0x42')](_0x449212[_0x7749('0x5d')],'in','','');this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('Trying\x20Dialogflow:\x20%s',_0x449212['text']));var _0x848159=this[_0x7749('0x79')]['sync'](this,_0x449212);if(_0x848159){for(var _0x236158 in _0x848159){if(_0x848159[_0x7749('0x92')](_0x236158)){this[_0x7749('0x35')]['setVariable'](util[_0x7749('0x2a')](_0x7749('0xe7'),_0x236158['toUpperCase']()),_0x848159[_0x236158]);}}this[_0x7749('0x42')](_0x848159[_0x7749('0xe8')],_0x7749('0xe9'),'dialogflow','');return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xea'),_0x848159[_0x7749('0xe8')]));}return this[_0x7749('0x35')][_0x7749('0x2b')](_0x449212,_0x7749('0xeb'));};AGIVertices[_0x7749('0x11')]['dialogflowV2']=function(_0x2493d0){logger['info'](util[_0x7749('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2493d0[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x2493d0[_0x7749('0x7c')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xec'));}if(!this['isConfigured'](_0x2493d0[_0x7749('0xed')])){return this['channel']['noop'](_0x7749('0xee'));}if(!this[_0x7749('0xa8')](_0x2493d0[_0x7749('0xef')])){return this['channel'][_0x7749('0xa9')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x2493d0[_0x7749('0x7d')])){return this[_0x7749('0x35')][_0x7749('0xa9')]('no\x20anguage\x20configured');}if(!this[_0x7749('0xa8')](_0x2493d0['text'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this['channel'][_0x7749('0xe6')]=!![];this[_0x7749('0x34')](_0x2493d0);this[_0x7749('0x42')](_0x2493d0[_0x7749('0x5d')],'in','','');this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0xf0'),_0x2493d0[_0x7749('0x5d')]));var _0x435904=this[_0x7749('0xf1')][_0x7749('0xa4')](this,_0x2493d0);if(_0x435904){for(var _0x49abec in _0x435904){if(_0x435904[_0x7749('0x92')](_0x49abec)){if(_0x49abec!=='providerResponse'){this[_0x7749('0x35')]['setVariable'](util[_0x7749('0x2a')](_0x7749('0xe7'),_0x49abec[_0x7749('0x6c')]()),_0x435904[_0x49abec]);}}}this['createSquareMessage'](_0x435904[_0x7749('0xe8')],'out',_0x7749('0xf2'),_0x435904[_0x7749('0xf3')]);return this[_0x7749('0x35')][_0x7749('0xa9')](util['format']('DialogflowV2\x20Result\x20%s',_0x435904[_0x7749('0xe8')]));}return this[_0x7749('0x35')][_0x7749('0x2b')](_0x2493d0,_0x7749('0xf4'));};AGIVertices[_0x7749('0x11')]['sesteknda']=function(_0x51baf7){logger['info'](util[_0x7749('0x2a')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x51baf7[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x51baf7['ndauth_url'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xf5'));}if(!this[_0x7749('0xa8')](_0x51baf7[_0x7749('0xf6')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xf7'));}if(!this[_0x7749('0xa8')](_0x51baf7[_0x7749('0xf8')])){return this['channel'][_0x7749('0xa9')](_0x7749('0xf9'));}if(!this[_0x7749('0xa8')](_0x51baf7[_0x7749('0xfa')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this[_0x7749('0x35')]['bot']=!![];this[_0x7749('0x34')](_0x51baf7);this[_0x7749('0x42')](_0x51baf7[_0x7749('0x5d')],'in','','');this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0xfb'),_0x51baf7[_0x7749('0x5d')]));var _0x48a43d=this[_0x7749('0x7e')][_0x7749('0xa4')](this,_0x51baf7);if(_0x48a43d){for(var _0x1ef363 in _0x48a43d){if(_0x48a43d['hasOwnProperty'](_0x1ef363)){this[_0x7749('0x35')][_0x7749('0x9c')](util['format'](_0x7749('0xfc'),_0x1ef363[_0x7749('0x6c')]()),_0x48a43d[_0x1ef363]);}}this[_0x7749('0x42')](_0x48a43d[_0x7749('0xe8')],_0x7749('0xe9'),_0x7749('0xfd'),'');if(_0x48a43d[_0x7749('0xfe')]){this[_0x7749('0x35')][_0x7749('0xa9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x48a43d['audiofile']));var _0x487df6=this[_0x7749('0x35')][_0x7749('0xff')](_0x48a43d[_0x7749('0xfe')]);try{fs['unlink'](_0x48a43d[_0x7749('0xfe')]+_0x7749('0x100'));}catch(_0x224d3b){logger[_0x7749('0x2b')](_0x224d3b);}return _0x487df6;}else{return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x101'),_0x48a43d['speech']));}}return this[_0x7749('0x35')][_0x7749('0x2b')](_0x51baf7,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7749('0x11')]['end']=function(_0x34757){logger['info'](util[_0x7749('0x2a')]('Enter\x20in\x20END\x20(%s)\x20block',_0x34757[_0x7749('0x36')]));return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x102'));};AGIVertices[_0x7749('0x11')][_0x7749('0x103')]=function(_0x127bf4){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x104'),_0x127bf4['label']));var _0x3b239d='';if(_0x127bf4[_0x7749('0x105')]){if(!this[_0x7749('0xa8')](_0x127bf4['trunk_id'])){return this[_0x7749('0x35')]['error'](_0x127bf4,_0x7749('0x106'));}else{var _0x534a51=parseInt(_0x127bf4[_0x7749('0x105')],0xa);if(isNaN(_0x534a51)){_0x3b239d=_0x127bf4[_0x7749('0x105')];}else{_0x3b239d=this[_0x7749('0x1e')][_0x7749('0xa4')](this,_0x127bf4[_0x7749('0x105')]);if(!_0x3b239d){return this['channel'][_0x7749('0x2b')](_0x127bf4,_0x7749('0x107'));}}}}else if(_0x127bf4[_0x7749('0x108')]){_0x3b239d=_0x127bf4[_0x7749('0x108')];}else{return this[_0x7749('0x35')][_0x7749('0x2b')](_0x127bf4,_0x7749('0x106'));}var _0x4b1b1e=this[_0x7749('0x35')]['exec'](_0x7749('0xe0'),[util['format'](_0x7749('0x109'),_0x3b239d,_0x127bf4[_0x7749('0xbc')]),_0x127bf4['timeout'],_0x127bf4[_0x7749('0x10a')],_0x127bf4[_0x7749('0x66')]]);if(_0x4b1b1e['result']===-0x1){return _0x4b1b1e;}return this['channel'][_0x7749('0xa9')](util['format'](_0x7749('0xe2'),_0x7749('0xe0')));};AGIVertices['prototype'][_0x7749('0x10b')]=function(_0x274f20){logger['info'](util[_0x7749('0x2a')](_0x7749('0x10c'),_0x274f20[_0x7749('0x36')]));return this[_0x7749('0x35')]['noop']('finally');};AGIVertices[_0x7749('0x11')][_0x7749('0xd')]=function(_0xbed830){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xbed830['label']));if(_0xbed830[_0x7749('0xa5')]===0x0){return this['maxRetry'](_0xbed830);}_0xbed830[_0x7749('0xa5')]-=0x1;if(!this['isConfigured'](_0xbed830['file_id'])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0xbed830,_0x7749('0x10d'));}var _0x1c94f9=this['getSound'][_0x7749('0xa4')](this,_0xbed830[_0x7749('0x10e')]);if(!_0x1c94f9){return this['channel'][_0x7749('0x2b')](_0xbed830,'no\x20file\x20audio\x20found');}if(!this[_0x7749('0xa8')](_0xbed830['variable_id'])){return this['channel']['error'](_0x7749('0xd5'));}var _0xf38aaa=this['channel']['getData'](_0x1c94f9,_0xbed830[_0x7749('0x10f')],_0xbed830[_0x7749('0x110')]);var _0x147079=_0xf38aaa[_0x7749('0xa1')]?_0xf38aaa[_0x7749('0xa1')][_0x7749('0x4b')]():'';logger[_0x7749('0x2d')]('test',JSON[_0x7749('0x73')](_0xf38aaa));if(_0xf38aaa[_0x7749('0xa1')]===-0x1){this[_0x7749('0x34')][_0x7749('0xa4')](this,_0xbed830,_0x147079);return _0xf38aaa;}else if(_0xf38aaa['extra']==='timeout'){_0xf38aaa['result']=_0x147079[_0x7749('0x99')]>=parseInt(_0xbed830[_0x7749('0x111')])?'x':'i';}else{_0xf38aaa[_0x7749('0xa1')]=_0x147079['length']>=parseInt(_0xbed830['mindigit'])&&_0x147079[_0x7749('0x99')]<=parseInt(_0xbed830[_0x7749('0x110')])?'x':'i';}var _0x3747e6=this[_0x7749('0x12')][_0x7749('0xa4')](this,_0xbed830[_0x7749('0xd4')]);if(!_0x3747e6){return this['channel'][_0x7749('0x2b')](_0xbed830,_0x7749('0xd6'));}this[_0x7749('0x35')][_0x7749('0x9c')](_0x3747e6,_0x147079);if(this[_0x7749('0xa8')](_0xbed830[_0x7749('0x112')])){var _0x5b1c64=parseInt(_0xbed830[_0x7749('0x112')],0xa);var _0x195e82=rs['generate']({'charset':'*','length':_0x5b1c64});var _0x25bd2d=_0x147079[_0x7749('0x99')];if(_0x25bd2d>0x0){if(_0x25bd2d>_0x5b1c64){this['createSquareDetailsReport']['sync'](this,_0xbed830,_0xbed830['hiddendigitspos']==='first'?_0x195e82+_0x147079[_0x7749('0x113')](_0x5b1c64):_0x147079[_0x7749('0x113')](0x0,_0x25bd2d-_0x5b1c64)+_0x195e82);}else{this[_0x7749('0x34')]['sync'](this,_0xbed830,rs['generate']({'charset':'*','length':_0x25bd2d}));}}else{this['createSquareDetailsReport'][_0x7749('0xa4')](this,_0xbed830,'');}}else{this[_0x7749('0x34')][_0x7749('0xa4')](this,_0xbed830,_0x147079);}return _0xf38aaa;};AGIVertices[_0x7749('0x11')][_0x7749('0xe')]=function(_0x124b49){logger['info'](util[_0x7749('0x2a')](_0x7749('0x114'),_0x124b49[_0x7749('0x36')]));return this[_0x7749('0xd')](_0x124b49);};AGIVertices[_0x7749('0x11')][_0x7749('0x115')]=function(_0x35f4d6){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x116'),_0x35f4d6[_0x7749('0x36')]));this[_0x7749('0x34')][_0x7749('0xa4')](this,_0x35f4d6,_0x35f4d6[_0x7749('0x117')]);return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x118'),_0x35f4d6[_0x7749('0x117')]));};AGIVertices['prototype'][_0x7749('0x119')]=function(_0x21aefe){logger['info'](util['format'](_0x7749('0x11a'),_0x21aefe[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x21aefe['aws_access_key_id'])||!this[_0x7749('0xa8')](_0x21aefe['aws_secret_access_key'])){return this[_0x7749('0x35')]['noop'](_0x7749('0x11b'));}if(!this['isConfigured'](_0x21aefe[_0x7749('0x5d')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x11c'),_0x21aefe[_0x7749('0x5d')]));var _0x16baad=this['awsPolly'][_0x7749('0xa4')](this,_0x21aefe);if(_0x16baad){this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0x11d'),_0x16baad));var _0x377b5f=this[_0x7749('0x35')][_0x7749('0xff')](_0x16baad);try{fs[_0x7749('0x11e')](_0x16baad+_0x7749('0x100'));}catch(_0x3f91da){logger[_0x7749('0x2b')](_0x3f91da);}return _0x377b5f;}return this[_0x7749('0x35')]['error'](_0x21aefe,_0x7749('0x11f'));};AGIVertices[_0x7749('0x11')][_0x7749('0x120')]=function(_0x42839b){logger['info'](util[_0x7749('0x2a')](_0x7749('0x121'),_0x42839b[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x42839b[_0x7749('0x85')])||!this[_0x7749('0xa8')](_0x42839b[_0x7749('0x86')])){return this[_0x7749('0x35')]['noop'](_0x7749('0x11b'));}if(!this['isConfigured'](_0x42839b[_0x7749('0x122')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x123'));}if(!this[_0x7749('0xa8')](_0x42839b[_0x7749('0x5d')])){return this['channel']['noop'](_0x7749('0xaa'));}this['channel'][_0x7749('0xe6')]=!![];this[_0x7749('0x34')](_0x42839b);this[_0x7749('0x42')](_0x42839b['text'],'in','','');this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x124'),_0x42839b[_0x7749('0x5d')]));var _0x10609c=this[_0x7749('0x8a')][_0x7749('0xa4')](this,_0x42839b);if(_0x10609c){for(var _0x25ea41 in _0x10609c){if(_0x10609c[_0x7749('0x92')](_0x25ea41)&&_[_0x7749('0x93')](_0x10609c[_0x25ea41])){this[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')](_0x7749('0x125'),_0x25ea41[_0x7749('0x6c')]()),_0x10609c[_0x25ea41]);}}if(_[_0x7749('0x51')](_0x10609c[_0x7749('0x76')])){return this['channel'][_0x7749('0xa9')](_0x7749('0x126'));}else{this[_0x7749('0x42')](_0x10609c[_0x7749('0x76')],'out',_0x7749('0x127'),'');return this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x128'),_0x10609c[_0x7749('0x76')]));}}return this[_0x7749('0x35')]['error'](_0x42839b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7749('0x11')]['googleasr']=function(_0x58b4e9){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x58b4e9['label'],_0x58b4e9[_0x7749('0x68')]));if(!this[_0x7749('0xa8')](_0x58b4e9[_0x7749('0x7a')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xe5'));}var _0x4f92ad=_0x7749('0x129');var _0x2fcf98=util['format'](_0x7749('0x12a'),FILES_PATH,rs['generate'](0x4));var _0x259ea4=util[_0x7749('0x2a')]('%s.%s',_0x2fcf98,_0x4f92ad);var _0x1e8567=!![];if(_0x58b4e9[_0x7749('0x12b')]===_0x7749('0x12c')){_0x1e8567=![];}var _0x5ebb3c=this[_0x7749('0x35')][_0x7749('0x12d')](_0x2fcf98,_0x4f92ad,_0x58b4e9[_0x7749('0x12e')],_0x58b4e9[_0x7749('0x68')],undefined,_0x1e8567);if(_0x5ebb3c[_0x7749('0xa1')]!==-0x1){this[_0x7749('0x35')][_0x7749('0xa9')](util['format'](_0x7749('0x12f'),_0x259ea4));var _0x35b9f3=this[_0x7749('0x8c')][_0x7749('0xa4')](this,_0x58b4e9,_0x259ea4);if(_0x35b9f3){for(var _0x406fa3 in _0x35b9f3){if(_0x35b9f3['hasOwnProperty'](_0x406fa3)){this[_0x7749('0x35')][_0x7749('0x9c')](util['format'](_0x7749('0x130'),_0x406fa3[_0x7749('0x6c')]()),_0x35b9f3[_0x406fa3]);}}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x131'),JSON[_0x7749('0x73')](_0x35b9f3)));}}return _0x5ebb3c;};AGIVertices[_0x7749('0x11')][_0x7749('0x132')]=function(_0x48e326){logger[_0x7749('0x2d')](util['format'](_0x7749('0x133'),_0x48e326[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x48e326['appid'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x134'));}if(!this['isConfigured'](_0x48e326[_0x7749('0x8f')])){return this[_0x7749('0x35')][_0x7749('0xa9')]('no\x20appsecret\x20configured');}var _0x4dcccd=_0x7749('0x129');var _0x35aa38=util[_0x7749('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x7749('0x135')](0x4));var _0x698821=util[_0x7749('0x2a')]('%s.%s',_0x35aa38,_0x4dcccd);var _0x1dd3f7=!![];if(_0x48e326[_0x7749('0x12b')]==='NOBEEP'){_0x1dd3f7=![];}var _0x4710b4=this[_0x7749('0x35')]['recordFile'](_0x35aa38,_0x4dcccd,_0x48e326[_0x7749('0x12e')],_0x48e326['timeout'],undefined,_0x1dd3f7);if(_0x4710b4[_0x7749('0xa1')]!==-0x1){this['channel']['noop'](util[_0x7749('0x2a')](_0x7749('0x136'),_0x698821));var _0x1f3843=this[_0x7749('0x8e')][_0x7749('0xa4')](this,_0x48e326,_0x698821);if(_0x1f3843){for(var _0x23333b in _0x1f3843){if(_0x1f3843[_0x7749('0x92')](_0x23333b)){this[_0x7749('0x35')]['setVariable'](util['format'](_0x7749('0x137'),_0x23333b[_0x7749('0x6c')]()),_0x1f3843[_0x23333b]);}}return this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0x138'),JSON[_0x7749('0x73')](_0x1f3843)));}}return _0x4710b4;};AGIVertices[_0x7749('0x11')]['gotoc']=function(_0x4f0863){logger[_0x7749('0x2d')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4f0863[_0x7749('0x36')]));return this['channel'][_0x7749('0x139')](_0x4f0863[_0x7749('0x3d')],_0x4f0863[_0x7749('0x3e')],_0x4f0863[_0x7749('0x3f')]);};AGIVertices[_0x7749('0x11')]['gotoif']=function(_0xd34076){logger['info'](util[_0x7749('0x2a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0xd34076[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0xd34076[_0x7749('0x13a')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0xd34076,'no\x20condition\x20configured');}try{var _0x4c3e7f=eval(_0xd34076[_0x7749('0x13a')])?_0x7749('0x13b'):'false';this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('EVAL\x20CONDITION\x20%s\x20%s',_0xd34076[_0x7749('0x13a')],_0x4c3e7f));return{'code':0xc8,'result':_0x4c3e7f};}catch(_0x19a299){return{'code':0xc8,'result':_0x7749('0x13c')};}};AGIVertices[_0x7749('0x11')][_0x7749('0x13d')]=function(_0x912599){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x13e'),_0x912599[_0x7749('0x36')]));if(!this['isConfigured'](_0x912599['interval_id'])){return this[_0x7749('0x35')]['error'](_0x912599,_0x7749('0x13f'));}var _0x5563b1=this['getIntervals'][_0x7749('0xa4')](this,_0x912599[_0x7749('0x140')]);if(!_0x5563b1){return this['channel'][_0x7749('0x2b')](_0x912599,_0x7749('0x141'));}for(var _0x4a5030=0x0;_0x4a5030<_0x5563b1[_0x7749('0x99')];_0x4a5030+=0x1){var _0x41e8af=this[_0x7749('0x35')]['getVariable'](util['format'](_0x7749('0x142'),_0x5563b1[_0x4a5030]));if(_0x41e8af[_0x7749('0xa1')]===-0x1){return _0x41e8af;}logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('IFTIME\x20%s\x20%s',_0x5563b1[_0x4a5030],_0x41e8af[_0x7749('0x9f')]));if(_0x41e8af['extra']===_0x7749('0x13b')){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x143'),_0x5563b1[_0x4a5030],_0x7749('0x13b')));this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x143'),_0x5563b1[_0x4a5030],_0x7749('0x13b')));return{'code':0xc8,'result':_0x7749('0x13b')};}else{logger[_0x7749('0x2d')](util['format'](_0x7749('0x143'),_0x5563b1[_0x4a5030],_0x7749('0x13c')));this[_0x7749('0x35')][_0x7749('0xa9')](util['format']('IFTIME\x20%s\x20%s',_0x5563b1[_0x4a5030],_0x7749('0x13c')));}}return{'code':0xc8,'result':_0x7749('0x13c')};};AGIVertices[_0x7749('0x11')][_0x7749('0x144')]=function(_0x37299c){logger['info'](util[_0x7749('0x2a')](_0x7749('0x145'),_0x37299c[_0x7749('0x36')]));return this[_0x7749('0x35')][_0x7749('0x144')]();};AGIVertices[_0x7749('0x11')][_0x7749('0x146')]=function(_0x54629e){logger['info'](util['format'](_0x7749('0x147'),_0x54629e[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x54629e[_0x7749('0x7a')])){return this['channel'][_0x7749('0xa9')]('no\x20key\x20configured');}var _0x58e48f=_0x7749('0x129');var _0x348472=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x7749('0x135')](0x4));var _0x36dad7=util[_0x7749('0x2a')](_0x7749('0x9b'),_0x348472,_0x58e48f);var _0x123f80=!![];if(_0x54629e[_0x7749('0x12b')]===_0x7749('0x12c')){_0x123f80=![];}var _0x18e7e2=this[_0x7749('0x35')][_0x7749('0x12d')](_0x348472,_0x58e48f,_0x54629e[_0x7749('0x12e')],_0x54629e[_0x7749('0x68')],undefined,_0x123f80);if(_0x18e7e2[_0x7749('0xa1')]!==-0x1){this[_0x7749('0x35')][_0x7749('0xa9')](util['format']('ispeech\x20%s\x20file\x20created',_0x36dad7));var _0x20cfcb=this[_0x7749('0x81')][_0x7749('0xa4')](this,_0x54629e,_0x36dad7);if(_0x20cfcb){for(var _0x5944b9 in _0x20cfcb){if(_0x20cfcb[_0x7749('0x92')](_0x5944b9)){this[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')](_0x7749('0x148'),_0x5944b9['toUpperCase']()),_0x20cfcb[_0x5944b9]);}}return this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x20cfcb)));}}return _0x18e7e2;};AGIVertices[_0x7749('0x11')][_0x7749('0x149')]=function(_0x3e7c5b){logger[_0x7749('0x2d')](util['format'](_0x7749('0x14a'),_0x3e7c5b[_0x7749('0x36')]));if(!this['isConfigured'](_0x3e7c5b[_0x7749('0x7a')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xe5'));}if(!this[_0x7749('0xa8')](_0x3e7c5b['text'])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x14b'),_0x3e7c5b[_0x7749('0x5d')]));var _0x1a2cba=this[_0x7749('0x7f')][_0x7749('0xa4')](this,_0x3e7c5b);if(_0x1a2cba){this['channel']['noop'](util[_0x7749('0x2a')](_0x7749('0x14c'),_0x1a2cba));var _0x3511ba=this[_0x7749('0x35')][_0x7749('0xff')](_0x1a2cba,_0x3e7c5b[_0x7749('0x12e')]);try{fs[_0x7749('0x11e')](_0x1a2cba+_0x7749('0x100'));}catch(_0x215530){logger[_0x7749('0x2b')](_0x215530);}return _0x3511ba;}return this['channel']['error'](_0x3e7c5b,_0x7749('0x14d'));};AGIVertices[_0x7749('0x11')]['login']=function(_0xa646e8){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x14e'),_0xa646e8['label']));if(!this[_0x7749('0xa8')](_0xa646e8[_0x7749('0x14f')])){return this['channel']['error'](_0xa646e8,'no\x20find\x20by\x20configured');}logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7749('0x35')][_0x7749('0x39')],_0xa646e8['findBy']));var _0x2e955a=this['agentLogin'][_0x7749('0xa4')](this,_0xa646e8[_0x7749('0x14f')]);if(_0x2e955a){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x150'),this[_0x7749('0x35')][_0x7749('0x39')],_0xa646e8[_0x7749('0x14f')]));this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x150'),this['channel'][_0x7749('0x39')],_0xa646e8[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x151')};}else{logger['info'](util[_0x7749('0x2a')](_0x7749('0x152'),this[_0x7749('0x35')][_0x7749('0x39')],_0xa646e8['findBy']));this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x152'),this[_0x7749('0x35')][_0x7749('0x39')],_0xa646e8[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x153')};}};AGIVertices['prototype'][_0x7749('0x154')]=function(_0x593cba){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x155'),_0x593cba[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x593cba[_0x7749('0x14f')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x593cba,'no\x20find\x20by\x20configured');}logger[_0x7749('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x7749('0x39')],_0x593cba[_0x7749('0x14f')]));var _0x1a929d=this['agentLogout'][_0x7749('0xa4')](this,_0x593cba[_0x7749('0x14f')]);if(_0x1a929d){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x150'),this[_0x7749('0x35')]['callerid'],_0x593cba[_0x7749('0x14f')]));this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7749('0x35')][_0x7749('0x39')],_0x593cba[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x151')};}else{logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x152'),this[_0x7749('0x35')][_0x7749('0x39')],_0x593cba[_0x7749('0x14f')]));this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0x152'),this['channel']['callerid'],_0x593cba[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x153')};}};AGIVertices[_0x7749('0x11')][_0x7749('0x156')]=function(_0x45fb9b){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x157'),_0x45fb9b['label']));if(!this[_0x7749('0xa8')](_0x45fb9b[_0x7749('0x158')])){return this[_0x7749('0x35')]['error'](_0x45fb9b,_0x7749('0x159'));}this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')]('math\x20%s',_0x45fb9b[_0x7749('0x158')]));var _0x194e78=eval(_0x45fb9b[_0x7749('0x158')]);if(!this['isConfigured'](_0x45fb9b[_0x7749('0xd4')])){return this[_0x7749('0x35')][_0x7749('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3215a1=this['getVariable'][_0x7749('0xa4')](this,_0x45fb9b[_0x7749('0xd4')]);if(!_0x3215a1){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x45fb9b,_0x7749('0xd6'));}if(_[_0x7749('0x98')](_0x194e78)){var _0x2185b4=this;_0x194e78['forEach'](function(_0x2b940e,_0x4643e8){_0x2185b4[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')](_0x7749('0x15a'),_0x3215a1,_0x4643e8),_0x2b940e);});return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x15b'),_0x3215a1));}else{return this[_0x7749('0x35')][_0x7749('0x9c')](_0x3215a1,_0x194e78);}};AGIVertices[_0x7749('0x11')][_0x7749('0xc')]=function(_0x565df5){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x565df5[_0x7749('0x36')]));if(_0x565df5[_0x7749('0xa5')]===0x0){return this['maxRetry'](_0x565df5);}_0x565df5[_0x7749('0xa5')]-=0x1;if(!this[_0x7749('0xa8')](_0x565df5[_0x7749('0x10e')])){return this[_0x7749('0x35')]['error'](_0x565df5,'no\x20file\x20audio\x20selected');}var _0x4b1474=this[_0x7749('0x15c')]['sync'](this,_0x565df5[_0x7749('0x10e')]);if(!_0x4b1474){return this['channel'][_0x7749('0x2b')](_0x565df5,_0x7749('0x15d'));}var _0x4c7594=this[_0x7749('0x35')][_0x7749('0x15e')](_0x4b1474,_0x565df5['response'],_0x565df5[_0x7749('0x15f')]);var _0x484292=_0x4c7594[_0x7749('0xa1')];if(_0x4c7594[_0x7749('0xa1')]===-0x1){this[_0x7749('0x34')]['sync'](this,_0x565df5,'-1');return _0x4c7594;}else if(_0x4c7594[_0x7749('0x9f')]===_0x7749('0x68')){_0x4c7594[_0x7749('0xa1')]=_0x4c7594[_0x7749('0xa1')][_0x7749('0x99')]>0x0?_0x4c7594[_0x7749('0xa1')]:'t';}else if(_[_0x7749('0x44')](_0x4c7594[_0x7749('0xa1')])){_0x4c7594['result']='#';_0x484292='#';}if(!this[_0x7749('0xa8')](_0x565df5[_0x7749('0xd4')])){this[_0x7749('0x35')][_0x7749('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x14153a=this[_0x7749('0x12')][_0x7749('0xa4')](this,_0x565df5[_0x7749('0xd4')]);if(!_0x14153a){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x565df5,'no\x20variable\x20found');}this['channel']['setVariable'](_0x14153a,_0x484292);}this[_0x7749('0x34')][_0x7749('0xa4')](this,_0x565df5,_0x484292);return _0x4c7594;};AGIVertices[_0x7749('0x11')][_0x7749('0xa9')]=function(_0x4a63c2){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x160'),_0x4a63c2[_0x7749('0x36')]));return this['channel']['noop'](_0x4a63c2[_0x7749('0x161')]||_0x4a63c2[_0x7749('0x36')]);};AGIVertices[_0x7749('0x11')][_0x7749('0x162')]=function(_0x541fc5){logger[_0x7749('0x2d')](util['format'](_0x7749('0x163'),_0x541fc5[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x541fc5[_0x7749('0x14f')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x541fc5,_0x7749('0x164'));}logger['info'](util['format'](_0x7749('0x165'),this[_0x7749('0x35')][_0x7749('0x39')],_0x541fc5[_0x7749('0x14f')]));var _0x43d74a=this[_0x7749('0x166')][_0x7749('0xa4')](this,_0x541fc5['pause_id']);var _0x4e1b55=this[_0x7749('0x4e')][_0x7749('0xa4')](this,_0x541fc5[_0x7749('0x14f')],_0x43d74a);if(_0x4e1b55){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x150'),this[_0x7749('0x35')][_0x7749('0x39')],_0x541fc5[_0x7749('0x14f')]));this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7749('0x39')],_0x541fc5[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x151')};}else{logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x152'),this[_0x7749('0x35')][_0x7749('0x39')],_0x541fc5[_0x7749('0x14f')]));this['channel'][_0x7749('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7749('0x35')][_0x7749('0x39')],_0x541fc5[_0x7749('0x14f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7749('0x11')][_0x7749('0x167')]=function(_0x45fa08){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x168'),_0x45fa08[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x45fa08[_0x7749('0x10e')])){return this[_0x7749('0x35')]['error'](_0x45fa08,'no\x20file\x20audio\x20selected');}var _0x25c56a=this[_0x7749('0x15c')][_0x7749('0xa4')](this,_0x45fa08[_0x7749('0x10e')]);if(!_0x25c56a){return this['channel'][_0x7749('0x2b')](_0x45fa08,'no\x20file\x20audio\x20found');}var _0x1913e3=this['channel'][_0x7749('0x57')](_0x7749('0x169'),[_0x25c56a,_0x45fa08[_0x7749('0x10a')]]);if(_0x1913e3['result']===-0x1){return _0x1913e3;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xbf'),_0x7749('0x169'),_0x25c56a));};AGIVertices[_0x7749('0x11')][_0x7749('0x16a')]=function(_0x3e62d9){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x16b'),_0x3e62d9['label']));if(!this['isConfigured'](_0x3e62d9[_0x7749('0x16c')])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x3e62d9,_0x7749('0x16d'));}var _0x192ba0='';var _0x5455ae=parseInt(_0x3e62d9[_0x7749('0x16c')],0xa);if(isNaN(_0x5455ae)){_0x192ba0=_0x3e62d9[_0x7749('0x16c')];}else{_0x192ba0=this['getVoiceQueue'][_0x7749('0xa4')](this,_0x3e62d9[_0x7749('0x16c')]);if(!_0x192ba0){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x3e62d9,_0x7749('0x16e'));}}var _0x1c0b6c='';if(this[_0x7749('0xa8')](_0x3e62d9[_0x7749('0x10e')])){var _0x49c70d=this['getSound'][_0x7749('0xa4')](this,_0x3e62d9[_0x7749('0x10e')]);if(_0x49c70d){_0x1c0b6c=_0x49c70d;}}this[_0x7749('0x34')]['sync'](this,_0x3e62d9,_0x192ba0);if(_0x3e62d9[_0x7749('0x10a')][_0x7749('0x16f')]('x')<0x0){_0x3e62d9[_0x7749('0x10a')]+='x';}if(_0x3e62d9[_0x7749('0x10a')][_0x7749('0x16f')]('X')<0x0){_0x3e62d9[_0x7749('0x10a')]+='X';}this[_0x7749('0x35')][_0x7749('0x9c')]('XMCS-QUEUE',_0x192ba0?_0x192ba0[_0x7749('0x170')]():'');var _0x366b42=this[_0x7749('0x35')][_0x7749('0x57')]('QUEUE',[_0x192ba0,_0x3e62d9[_0x7749('0x10a')],_0x3e62d9[_0x7749('0x66')],_0x1c0b6c,_0x3e62d9['timeout'],_0x3e62d9[_0x7749('0x5')],_0x3e62d9[_0x7749('0x171')],_0x3e62d9['gosub'],'',_0x3e62d9[_0x7749('0x172')]]);if(_0x366b42[_0x7749('0xa1')]===-0x1){return _0x366b42;}return this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0xbf'),_0x7749('0x173'),_0x192ba0));};AGIVertices['prototype'][_0x7749('0x174')]=function(_0x67949b){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x175'),_0x67949b[_0x7749('0x36')]));var _0xb71fd9=_0x67949b['recordingFormat']||_0x7749('0x129');var _0x382af7=util[_0x7749('0x2a')](_0x7749('0x176'),this['channel'][_0x7749('0x3b')],rs[_0x7749('0x135')](0x5));var _0x280d3e=util['format'](_0x7749('0x177'),FILES_PATH,_0x382af7,_0xb71fd9);var _0x342775=util[_0x7749('0x2a')](_0x7749('0x12a'),FILES_PATH,_0x382af7);this[_0x7749('0x3a')]['sync'](this,_0x67949b,_0x382af7,_0x280d3e);this[_0x7749('0x35')][_0x7749('0x9c')](_0x7749('0x178'),_0x382af7);logger['info'](_0x7749('0x179'),_0x342775,_0xb71fd9,_0x67949b['escape_digits'],_0x67949b[_0x7749('0x68')]);return this[_0x7749('0x35')]['recordFile'](_0x342775,_0xb71fd9,_0x67949b[_0x7749('0x17a')],_0x67949b['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x7749('0x17b')]=function(_0x1f1ba6){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x17c'),_0x1f1ba6['label']));if(!this[_0x7749('0xa8')](_0x1f1ba6['url'])){return this[_0x7749('0x35')]['noop']('no\x20url\x20configured');}var _0x4fdd69=this[_0x7749('0x65')][_0x7749('0xa4')](this,_0x1f1ba6);logger['info'](util['format']('Response:',util['inspect'](_0x4fdd69,{'showHidden':![],'depth':null})));if(!this[_0x7749('0xa8')](_0x1f1ba6[_0x7749('0xd4')])){return this[_0x7749('0x35')]['noop'](_0x7749('0x17d'));}var _0x2689c5=this['getVariable'][_0x7749('0xa4')](this,_0x1f1ba6[_0x7749('0xd4')]);if(!_0x2689c5){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x1f1ba6,_0x7749('0xd6'));}this[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')]('%s_STATUS_CODE',_0x2689c5),_0x4fdd69[_0x7749('0x74')]?_0x4fdd69[_0x7749('0x74')]:_0x7749('0x17e'));this[_0x7749('0x35')][_0x7749('0x9c')](util[_0x7749('0x2a')]('%s_STATUS_MESSAGE',_0x2689c5),_0x4fdd69[_0x7749('0x75')]?_0x4fdd69[_0x7749('0x75')]:'OK');if(_0x4fdd69[_0x7749('0x6d')]){try{this[_0x7749('0x9a')](_0x4fdd69['body'],_0x2689c5);}catch(_0xa057ee){logger[_0x7749('0x2b')](util['format'](_0x7749('0x17f'),_0x2689c5));}}return this['channel'][_0x7749('0xa9')](util['format']('variable\x20%s\x20set',_0x2689c5));};AGIVertices['prototype'][_0x7749('0x180')]=function(_0x576fbc){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x576fbc[_0x7749('0x36')]));return this['channel'][_0x7749('0x181')](_0x576fbc[_0x7749('0x182')][_0x7749('0x59')](/\s+/g,''),_0x576fbc[_0x7749('0x17a')]);};AGIVertices[_0x7749('0x11')][_0x7749('0x183')]=function(_0x5d358a){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x184'),_0x5d358a['label']));return this[_0x7749('0x35')][_0x7749('0x185')](_0x5d358a[_0x7749('0x69')][_0x7749('0x59')](/\s+/g,''),_0x5d358a['escape_digits']);};AGIVertices[_0x7749('0x11')][_0x7749('0x186')]=function(_0x1b3d8b){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1b3d8b[_0x7749('0x36')]));return this[_0x7749('0x35')][_0x7749('0x187')](_0x1b3d8b['text'],_0x1b3d8b[_0x7749('0x17a')]);};AGIVertices[_0x7749('0x11')][_0x7749('0x188')]=function(_0x477638){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x189'),_0x477638[_0x7749('0x36')]));if(!this['isConfigured'](_0x477638[_0x7749('0x18a')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x18b'));}var _0x470ba1=this[_0x7749('0x22')][_0x7749('0xa4')](this,_0x477638[_0x7749('0x18a')]);if(!_0x470ba1||!_0x470ba1[_0x7749('0x18c')]){return this[_0x7749('0x35')][_0x7749('0x2b')](_0x477638,_0x7749('0x18d'));}var _0x1633c6={'from':util['format']('\x22%s\x22\x20<%s>',_0x470ba1[_0x7749('0x1a')],_0x470ba1[_0x7749('0x18e')]||_0x470ba1[_0x7749('0x18c')][_0x7749('0x18f')]),'to':_0x477638['to']||'','cc':_0x477638['cc']||'','bcc':_0x477638[_0x7749('0x190')]||'','subject':_0x477638[_0x7749('0x191')],'html':_0x477638['text'],'text':_0x477638['text']};if(this[_0x7749('0xa8')](_0x477638['template_id'])){}logger[_0x7749('0xdc')](_0x7749('0x192'),JSON[_0x7749('0x73')](_0x1633c6));this[_0x7749('0x34')][_0x7749('0xa4')](this,_0x477638,_0x477638[_0x7749('0x18a')]);this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x193'),_0x470ba1['name']));this[_0x7749('0x24')][_0x7749('0xa4')](this,_0x470ba1['smtpOptions'],_0x1633c6);return this[_0x7749('0x35')]['noop'](_0x7749('0x194'));};AGIVertices[_0x7749('0x11')][_0x7749('0x195')]=function(_0x4481dc){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x4481dc[_0x7749('0x36')]));return this[_0x7749('0x35')][_0x7749('0xa9')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7749('0x11')][_0x7749('0x196')]=function(_0x39172f){logger['info'](util[_0x7749('0x2a')](_0x7749('0x197'),_0x39172f[_0x7749('0x36')]));if(!this[_0x7749('0xa8')](_0x39172f[_0x7749('0x198')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x199'));}var _0x8959c6=this[_0x7749('0x31')][_0x7749('0xa4')](this,_0x39172f[_0x7749('0x198')]);if(!_0x8959c6){return this[_0x7749('0x35')]['error'](_0x39172f,_0x7749('0x19a'));}var _0x44b5ce={'body':_0x39172f[_0x7749('0x19b')],'phone':_0x39172f['to']||'','SmsAccountId':_0x8959c6['id']};logger['debug'](_0x7749('0x19c'),JSON[_0x7749('0x73')](_0x44b5ce));this[_0x7749('0x34')][_0x7749('0xa4')](this,_0x39172f,_0x39172f[_0x7749('0x198')]);this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x19d'),_0x8959c6[_0x7749('0x1a')]));this[_0x7749('0x33')][_0x7749('0xa4')](this,_0x44b5ce);return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x19e'));};AGIVertices[_0x7749('0x11')]['set']=function(_0x53adba){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x53adba[_0x7749('0x36')]));if(!this['isConfigured'](_0x53adba[_0x7749('0xd4')])){return this['channel'][_0x7749('0x2b')](_0x53adba,_0x7749('0x19f'));}var _0x368c64=this[_0x7749('0x12')][_0x7749('0xa4')](this,_0x53adba[_0x7749('0xd4')]);if(!_0x368c64){return this['channel']['error'](_0x53adba,'no\x20variable\x20found');}return this[_0x7749('0x35')][_0x7749('0x9c')](_0x368c64,_0x53adba[_0x7749('0x1a0')]);};AGIVertices[_0x7749('0x11')][_0x7749('0x1a1')]=function(_0x25d833){logger['info'](util[_0x7749('0x2a')](_0x7749('0x1a2'),_0x25d833[_0x7749('0x36')]));this[_0x7749('0x35')]['noop'](_0x7749('0x1a3'));if(_0x25d833[_0x7749('0xb5')]===_0x7749('0x1a4')){this[_0x7749('0x35')][_0x7749('0xa9')]('Answer');return this[_0x7749('0x35')][_0x7749('0xb5')]();}return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0x1a5'));};AGIVertices['prototype'][_0x7749('0x1a6')]=function(_0xc98750){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xc98750['label']));if(!this[_0x7749('0xa8')](_0xc98750['project_id'])){return this[_0x7749('0x35')][_0x7749('0x2b')](_0xc98750,'no\x20subproject\x20selected');}var _0x269e1a=this[_0x7749('0x18')][_0x7749('0xa4')](this,_0xc98750['project_id']);if(!this[_0x7749('0xa8')](_0x269e1a)){return this[_0x7749('0x35')][_0x7749('0x2b')](_0xc98750,util['format'](_0x7749('0x1a7'),_0xc98750['project_id']));}if(_0x269e1a===this['channel'][_0x7749('0x38')]){return this[_0x7749('0x35')]['error'](_0xc98750,_0x7749('0x1a8'));}this[_0x7749('0x34')][_0x7749('0xa4')](this,_0xc98750,_0x269e1a);var _0x23b216=this[_0x7749('0x35')][_0x7749('0x57')](_0x7749('0x1a9'),util[_0x7749('0x2a')](_0x7749('0x1aa'),config[_0x7749('0x5')][_0x7749('0x1ab')]||'127.0.0.1',_0x269e1a,this['channel'][_0x7749('0x38')]));if(_0x23b216[_0x7749('0xa1')]===-0x1){return _0x23b216;}return this[_0x7749('0x35')]['noop'](util[_0x7749('0x2a')](_0x7749('0xbf'),_0x7749('0x1a9'),_0x269e1a));};AGIVertices[_0x7749('0x11')]['system']=function(_0x2aeb64){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x1ac'),_0x2aeb64['label']));var _0x494bd9=this['shellCommand']['sync'](this,_0x2aeb64['command']);this[_0x7749('0x34')][_0x7749('0xa4')](this,_0x2aeb64,_0x2aeb64[_0x7749('0xb4')]);if(this[_0x7749('0xa8')](_0x2aeb64[_0x7749('0xd4')])){var _0x5aafb7=this['getVariable'][_0x7749('0xa4')](this,_0x2aeb64[_0x7749('0xd4')]);if(_0x5aafb7){this['channel'][_0x7749('0x9c')](_0x5aafb7,_0x494bd9);return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x1ad'),_0x2aeb64['command'],_0x5aafb7));}}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x1ae'),_0x2aeb64[_0x7749('0xb4')]));};AGIVertices[_0x7749('0x11')][_0x7749('0x1af')]=function(_0x3289bd){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x1b0'),_0x3289bd['label']));_0x3289bd[_0x7749('0x5d')]=_0x3289bd[_0x7749('0x5d')][_0x7749('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7749('0xa8')](_0x3289bd[_0x7749('0x5b')])){return this['channel'][_0x7749('0xa9')](_0x7749('0x1b1'));}if(!this['isConfigured'](_0x3289bd[_0x7749('0x5d')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x1b2'),_0x3289bd[_0x7749('0x5d')]));var _0x15f781=this[_0x7749('0x5a')][_0x7749('0xa4')](this,_0x3289bd);if(_0x15f781){this['channel'][_0x7749('0xa9')](util['format'](_0x7749('0x1b3'),_0x15f781));var _0x15cb15=this[_0x7749('0x35')]['streamFile'](_0x15f781);try{fs['unlink'](_0x15f781+_0x7749('0x100'));}catch(_0x1952fc){logger[_0x7749('0x2b')](_0x1952fc);}return _0x15cb15;}return this[_0x7749('0x35')]['error'](_0x3289bd,_0x7749('0x1b4'));};AGIVertices[_0x7749('0x11')][_0x7749('0x1b5')]=function(_0x28d3d1){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x28d3d1[_0x7749('0x36')]));_0x28d3d1['text']=_0x28d3d1[_0x7749('0x5d')][_0x7749('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7749('0xa8')](_0x28d3d1[_0x7749('0x5d')])){return this[_0x7749('0x35')][_0x7749('0xa9')](_0x7749('0xaa'));}this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')]('Trying\x20Google\x20TTS\x20%s',_0x28d3d1[_0x7749('0x5d')]));var _0x23cf56=this[_0x7749('0x63')]['sync'](this,_0x28d3d1);if(_0x23cf56){this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x1b6'),_0x23cf56));var _0x5cd4b9=this[_0x7749('0x35')][_0x7749('0xff')](_0x23cf56);try{fs['unlink'](_0x23cf56+'.wav');}catch(_0x1d2eb6){logger[_0x7749('0x2b')](_0x1d2eb6);}return _0x5cd4b9;}return this[_0x7749('0x35')][_0x7749('0x2b')](_0x28d3d1,_0x7749('0x1b7'));};AGIVertices[_0x7749('0x11')][_0x7749('0x1b8')]=function(_0x250bf7){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x250bf7[_0x7749('0x36')]));if(!this['isConfigured'](_0x250bf7[_0x7749('0x14f')])){return this[_0x7749('0x35')]['error'](_0x250bf7,_0x7749('0x164'));}logger['info'](util[_0x7749('0x2a')](_0x7749('0x165'),this['channel']['callerid'],_0x250bf7[_0x7749('0x14f')]));var _0x3e9cfb=this[_0x7749('0x50')]['sync'](this,_0x250bf7[_0x7749('0x14f')]);if(_0x3e9cfb){logger['info'](util[_0x7749('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x7749('0x35')][_0x7749('0x39')],_0x250bf7[_0x7749('0x14f')]));this['channel'][_0x7749('0xa9')](util[_0x7749('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x7749('0x39')],_0x250bf7['findBy']));return{'code':0xc8,'result':_0x7749('0x151')};}else{logger['info'](util[_0x7749('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7749('0x35')]['callerid'],_0x250bf7[_0x7749('0x14f')]));this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0x152'),this[_0x7749('0x35')][_0x7749('0x39')],_0x250bf7[_0x7749('0x14f')]));return{'code':0xc8,'result':_0x7749('0x153')};}};AGIVertices[_0x7749('0x11')]['voicemail']=function(_0x21b0bb){logger[_0x7749('0x2d')](util[_0x7749('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x21b0bb['label']));var _0x297dca=this['channel'][_0x7749('0x57')]('VOICEMAIL',[_0x21b0bb[_0x7749('0x1b9')],_0x21b0bb[_0x7749('0x78')]]);if(_0x297dca[_0x7749('0xa1')]===-0x1){return _0x297dca;}return this[_0x7749('0x35')][_0x7749('0xa9')](util[_0x7749('0x2a')](_0x7749('0xbf'),_0x7749('0x1ba'),_0x21b0bb[_0x7749('0x1b9')]));};AGIVertices[_0x7749('0x11')][_0x7749('0x1bb')]=function(_0x9d5e0){logger[_0x7749('0x2d')](util[_0x7749('0x2a')](_0x7749('0x1bc'),_0x9d5e0[_0x7749('0x36')]));if(!this['isConfigured'](_0x9d5e0[_0x7749('0xd4')])){return this[_0x7749('0x35')]['error'](_0x9d5e0,_0x7749('0x19f'));}var _0x3a1a41=this[_0x7749('0x12')][_0x7749('0xa4')](this,_0x9d5e0[_0x7749('0xd4')]);if(!_0x3a1a41){return this['channel'][_0x7749('0x2b')](_0x9d5e0,_0x7749('0xd6'));}var _0x442e6c=this[_0x7749('0x35')]['getVariable'](_0x3a1a41);return{'code':0xc8,'result':_0x442e6c[_0x7749('0x9f')]?_0x442e6c['extra']:'-'};};String[_0x7749('0x11')][_0x7749('0x9e')]=function(_0x336802,_0x2af7da){return this['split'](_0x336802)[_0x7749('0x1bd')](_0x2af7da);};module[_0x7749('0x1be')]=AGIVertices; \ No newline at end of file +var _0x6594=['Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','ndassistant_url','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','no\x20condition\x20configured','condition','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','true','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','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','file_id','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','macro','gosub','QUEUE','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','debug','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','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','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','streamFile','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','name','catch','getVoiceQueue','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','audioEncoding','MP3','googleTTS','restAPI','url','timeout','number','includes','PUT','toUpperCase','rawBody','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','sip_id','no\x20user\x20selected','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','sesteknda'];(function(_0x3f4e4d,_0xc65937){var _0x564861=function(_0x3c3ace){while(--_0x3c3ace){_0x3f4e4d['push'](_0x3f4e4d['shift']());}};_0x564861(++_0xc65937);}(_0x6594,0xcb));var _0x4659=function(_0x39e740,_0x3a3084){_0x39e740=_0x39e740-0x0;var _0x49d5fc=_0x6594[_0x39e740];return _0x49d5fc;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x4659('0x0'));var moment=require(_0x4659('0x1'));var Mustache=require(_0x4659('0x2'));var rp=require(_0x4659('0x3'));var logger=require(_0x4659('0x4'))('agi');var config=require('../../config/environment');var shared=require(_0x4659('0x5'));var scripts=require(_0x4659('0x6'));var FILES_PATH=_0x4659('0x7');var recursiveMapAttributes=[_0x4659('0x8'),'rawBody'];var verticesWithRetry=[_0x4659('0x9'),_0x4659('0xa'),_0x4659('0xb')];var AGIVertices=function(_0x16e287,_0x11d442,_0x27a2ea){this['channel']=_0x16e287;this[_0x4659('0xc')]=_0x11d442;this[_0x4659('0xd')]=_0x27a2ea;};AGIVertices[_0x4659('0xe')][_0x4659('0xf')]=function(_0x3a1c89,_0x27d129){this[_0x4659('0xc')]['getVariableById'](_0x3a1c89)['then'](function(_0x1a2e04){_0x27d129(null,_0x1a2e04?_0x1a2e04[_0x4659('0x10')]:![]);})[_0x4659('0x11')](function(_0x5389a0){_0x27d129(_0x5389a0);});};AGIVertices[_0x4659('0xe')][_0x4659('0x12')]=function(_0x5c2bc7,_0x5d303e){this[_0x4659('0xc')]['getVoiceQueueById'](_0x5c2bc7)[_0x4659('0x13')](function(_0x22b87f){_0x5d303e(null,_0x22b87f?_0x22b87f[_0x4659('0x10')]:![]);})['catch'](function(_0x3d9a17){_0x5d303e(_0x3d9a17);});};AGIVertices[_0x4659('0xe')][_0x4659('0x14')]=function(_0x29a208,_0x59cacd){this[_0x4659('0xc')][_0x4659('0x15')](_0x29a208)[_0x4659('0x13')](function(_0x2fdd7a){_0x59cacd(null,_0x2fdd7a?_0x2fdd7a['name']:![]);})[_0x4659('0x11')](function(_0x3049ba){_0x59cacd(_0x3049ba);});};AGIVertices['prototype'][_0x4659('0x16')]=function(_0x3c7bd0,_0x6b8d07){this[_0x4659('0xc')]['getSquareOdbcById'](_0x3c7bd0)['then'](function(_0x494261){_0x6b8d07(null,_0x494261?_0x494261[_0x4659('0x17')]:![]);})[_0x4659('0x11')](function(_0xd6012e){_0x6b8d07(_0xd6012e);});};AGIVertices[_0x4659('0xe')][_0x4659('0x18')]=function(_0x428e2c,_0x2e773b){this[_0x4659('0xc')]['getUserById'](_0x428e2c)['then'](function(_0x31273d){_0x2e773b(null,_0x31273d?_0x31273d['name']:![]);})[_0x4659('0x11')](function(_0x47c73d){_0x2e773b(_0x47c73d);});};AGIVertices[_0x4659('0xe')][_0x4659('0x19')]=function(_0x155903,_0x269762){this[_0x4659('0xc')][_0x4659('0x1a')](_0x155903)[_0x4659('0x13')](function(_0x1d1cba){_0x269762(null,_0x1d1cba?_0x1d1cba[_0x4659('0x10')]:![]);})['catch'](function(_0x428dd5){_0x269762(_0x428dd5);});};AGIVertices[_0x4659('0xe')][_0x4659('0x1b')]=function(_0x3642c5,_0x317be0){var _0x1d17c5=this;this[_0x4659('0xc')][_0x4659('0x1c')](_0x3642c5)[_0x4659('0x13')](function(_0x479a2e){_0x317be0(null,_0x479a2e?_0x1d17c5['getSoundPath'](_0x479a2e[_0x4659('0x1d')]):![]);})[_0x4659('0x11')](function(_0x5c5a31){_0x317be0(_0x5c5a31);});};AGIVertices['prototype'][_0x4659('0x1e')]=function(_0x47b219,_0x4843f4){this[_0x4659('0xc')][_0x4659('0x1f')](_0x47b219)['then'](function(_0x18aa39){_0x4843f4(null,_0x18aa39?_0x18aa39:![]);})[_0x4659('0x11')](function(_0x2edb51){_0x4843f4(_0x2edb51);});};AGIVertices[_0x4659('0xe')][_0x4659('0x20')]=function(_0x12ded6,_0x1ab79e,_0x5e705e){this[_0x4659('0xd')][_0x4659('0x20')](_0x12ded6,_0x1ab79e)[_0x4659('0x13')](function(){_0x5e705e(null);})[_0x4659('0x11')](function(_0x52bd53){_0x5e705e(_0x52bd53);});};AGIVertices[_0x4659('0xe')][_0x4659('0x21')]=function(_0x51bb54,_0x1fa1a1){this[_0x4659('0xc')][_0x4659('0x22')](_0x51bb54)['then'](function(_0x4e52f2){if(_0x4e52f2){if(_0x4e52f2['IntervalId']){_0x1fa1a1(null,[_0x4e52f2[_0x4659('0x23')]]);}else{_0x1fa1a1(null,_[_0x4659('0x24')](_0x4e52f2['Intervals'],_0x4659('0x23')));}}else{_0x1fa1a1(null,![]);}})[_0x4659('0x11')](function(_0x5af9f7){_0x1fa1a1(_0x5af9f7);});};AGIVertices[_0x4659('0xe')][_0x4659('0x25')]=function(_0x5f029a){return util['format'](_0x4659('0x26'),FILES_PATH,_0x5f029a);};AGIVertices[_0x4659('0xe')][_0x4659('0x27')]=function(_0x3d193b,_0x2f0c76,_0x263f4d){odbc[_0x4659('0x28')](_0x3d193b,function(_0x1f3259){if(_0x1f3259){logger[_0x4659('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1f3259);_0x263f4d(_0x1f3259);}else{logger[_0x4659('0x2a')](_0x4659('0x2b'));odbc['query'](_0x2f0c76,function(_0x559316,_0x490d0b){if(_0x559316){logger['info'](_0x4659('0x2c'),_0x2f0c76);_0x263f4d(_0x559316);}else{logger[_0x4659('0x2a')](_0x4659('0x2d'),_0x2f0c76);odbc['close'](function(_0x37d6a0){if(_0x37d6a0){logger[_0x4659('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x37d6a0);}_0x263f4d(null,_0x490d0b);});}});}});};AGIVertices[_0x4659('0xe')]['getSmsAccount']=function(_0x1f5298,_0x27a42f){this['rpc']['getSmsAccountById'](_0x1f5298)[_0x4659('0x13')](function(_0x391879){_0x27a42f(null,_0x391879?_0x391879:![]);})[_0x4659('0x11')](function(_0x5c1b16){_0x27a42f(_0x5c1b16);});};AGIVertices[_0x4659('0xe')][_0x4659('0x2e')]=function(_0x5cc7f4,_0x36e662){this[_0x4659('0xc')][_0x4659('0x2e')](_0x5cc7f4)[_0x4659('0x13')](function(_0x111b7a){_0x36e662(null,_0x111b7a);})[_0x4659('0x11')](function(_0x5a051c){_0x36e662(_0x5a051c);});};AGIVertices[_0x4659('0xe')][_0x4659('0x2f')]=function(_0xd38f94,_0x9f120a,_0x49bbe8){this['rpc'][_0x4659('0x2f')]({'uniqueid':this[_0x4659('0x30')][_0x4659('0x31')],'node':_0xd38f94[_0x4659('0x32')],'application':_0xd38f94[_0x4659('0x33')],'data':_0x9f120a||null,'project_name':this[_0x4659('0x30')][_0x4659('0x34')],'callerid':this['channel'][_0x4659('0x35')]})[_0x4659('0x13')](function(_0x13ad71){if(_0x49bbe8){_0x49bbe8(null,_0x13ad71);}})[_0x4659('0x11')](function(_0x5ce08d){if(_0x49bbe8){_0x49bbe8(_0x5ce08d);}});};AGIVertices[_0x4659('0xe')]['createSquareRecording']=function(_0x57e56d,_0x4a0fdf,_0x5ad30b,_0x5eba31){this[_0x4659('0xc')][_0x4659('0x36')]({'uniqueid':this[_0x4659('0x30')][_0x4659('0x31')],'callerid':this[_0x4659('0x30')]['callerid'],'calleridname':this[_0x4659('0x30')][_0x4659('0x37')],'context':this[_0x4659('0x30')][_0x4659('0x38')],'extension':this['channel'][_0x4659('0x39')],'priority':this[_0x4659('0x30')][_0x4659('0x3a')],'accountcode':this[_0x4659('0x30')][_0x4659('0x3b')],'dnid':this['channel'][_0x4659('0x3c')],'projectName':this[_0x4659('0x30')]['arg_1'],'saveName':_0x4a0fdf,'filename':_0x57e56d[_0x4659('0x3d')]||_0x4a0fdf,'savePath':_0x5ad30b})['then'](function(_0x452154){_0x5eba31(null,_0x452154);})['catch'](function(_0x3bb487){_0x5eba31(_0x3bb487);});};AGIVertices['prototype'][_0x4659('0x3e')]=function(_0x4458ef,_0x2cd106,_0x146594,_0x3a042d,_0x114272){this[_0x4659('0xc')][_0x4659('0x3e')]({'uniqueid':this[_0x4659('0x30')]['uniqueid'],'body':_0x4458ef,'direction':_0x2cd106,'providerName':_0x146594,'providerResponse':_0x3a042d})[_0x4659('0x13')](function(_0x6bbfc6){if(_0x114272){_0x114272(null,_0x6bbfc6);}})[_0x4659('0x11')](function(_0xf2020){if(_0x114272){_0x114272(_0xf2020);}});};AGIVertices['prototype'][_0x4659('0x3f')]=function(_0x4a8a0d,_0x1d8b61){this[_0x4659('0xc')][_0x4659('0x3f')]({'firstName':_[_0x4659('0x40')](_0x4a8a0d['name'])||_[_0x4659('0x41')](_0x4a8a0d[_0x4659('0x10')])?_0x4659('0x42')+Math[_0x4659('0x43')]():_0x4a8a0d['name'],'lastName':_[_0x4659('0x40')](_0x4a8a0d[_0x4659('0x44')])||_[_0x4659('0x41')](_0x4a8a0d[_0x4659('0x44')])?null:_0x4a8a0d[_0x4659('0x44')],'phone':_0x4a8a0d[_0x4659('0x45')],'ListId':_0x4a8a0d[_0x4659('0x46')],'scheduledat':_0x4a8a0d[_0x4659('0x47')],'callbackUniqueid':this[_0x4659('0x30')][_0x4659('0x31')],'tags':_0x4659('0x48'),'description':_0x4659('0x49')+_0x4a8a0d[_0x4659('0x47')][_0x4659('0x4a')](),'priority':_0x4a8a0d['callback_priority']})[_0x4659('0x13')](function(_0x75b381){_0x1d8b61(null,_0x75b381);})['catch'](function(_0x27dafc){_0x1d8b61(_0x27dafc);});};AGIVertices[_0x4659('0xe')][_0x4659('0x4b')]=function(_0x15fe11,_0x22026d){this[_0x4659('0xc')][_0x4659('0x4c')](_0x15fe11)['then'](function(_0x3f2334){_0x22026d(null,_0x3f2334?_0x3f2334[_0x4659('0x10')]:![]);})[_0x4659('0x11')](function(_0x42575c){_0x22026d(_0x42575c);});};AGIVertices[_0x4659('0xe')][_0x4659('0x4d')]=function(_0x1111f3,_0x55e3b3,_0x45e4c8){var _0xb94e3d={'role':'agent'};_0xb94e3d[_0x1111f3]=this[_0x4659('0x30')][_0x4659('0x35')];this[_0x4659('0xc')]['agentPause'](_0xb94e3d,_0x55e3b3,this[_0x4659('0x30')][_0x4659('0x31')])['then'](function(_0x2c9636){_0x45e4c8(null,_['isNil'](_0x2c9636)?![]:!![]);})[_0x4659('0x11')](function(_0x1b3418){logger[_0x4659('0x29')](_0x1b3418);_0x45e4c8(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x209af2,_0x5c87a1){var _0x43efc1={'role':_0x4659('0x4e')};_0x43efc1[_0x209af2]=this[_0x4659('0x30')]['callerid'];this['rpc'][_0x4659('0x4f')](_0x43efc1)[_0x4659('0x13')](function(_0x346448){_0x5c87a1(null,_['isNil'](_0x346448)?![]:!![]);})['catch'](function(_0x4e2d00){logger[_0x4659('0x29')](_0x4e2d00);_0x5c87a1(null,![]);});};AGIVertices[_0x4659('0xe')][_0x4659('0x50')]=function(_0xa6c11a,_0x2746dc){var _0x1b874d={'role':'agent'};_0x1b874d[_0xa6c11a]=this[_0x4659('0x30')]['callerid'];this[_0x4659('0xc')]['agentLogout'](_0x1b874d)[_0x4659('0x13')](function(_0xdb2a53){_0x2746dc(null,_[_0x4659('0x41')](_0xdb2a53)?![]:!![]);})['catch'](function(_0x47a3ac){logger[_0x4659('0x29')](_0x47a3ac);_0x2746dc(null,![]);});};AGIVertices[_0x4659('0xe')][_0x4659('0x51')]=function(_0x1b3bec,_0x3c9389){var _0x39222c={'role':_0x4659('0x4e')};_0x39222c[_0x1b3bec]=this[_0x4659('0x30')][_0x4659('0x35')];var _0x4289ab=_0x1b3bec!=_0x4659('0x52')?util[_0x4659('0x53')]('%s/%s@from-sip/n',_0x4659('0x54'),this['channel'][_0x4659('0x35')]):undefined;this[_0x4659('0xc')]['agentLogin'](_0x39222c,_0x4289ab)[_0x4659('0x13')](function(_0x365fe2){_0x3c9389(null,_[_0x4659('0x41')](_0x365fe2)?![]:!![]);})['catch'](function(_0xb76f16){logger[_0x4659('0x29')](_0xb76f16);_0x3c9389(null,![]);});};AGIVertices[_0x4659('0xe')]['shellCommand']=function(_0x28bb1b,_0x4825a4){sh[_0x4659('0x55')](_[_0x4659('0x56')](_0x28bb1b),function(_0x52a759,_0x324d78){var _0x460d58=_0x324d78[_0x4659('0x57')](/(\r\n|\n|\r)/gm,'');_0x4825a4(null,_0x460d58);});};AGIVertices[_0x4659('0xe')][_0x4659('0x58')]=function(_0x482dc9,_0x26a336){scripts[_0x4659('0x58')](_0x482dc9[_0x4659('0x59')],_0x482dc9[_0x4659('0x5a')]||_0x4659('0x5b'),_0x482dc9[_0x4659('0x5b')],_0x482dc9['languageCode']||'en-US',_0x482dc9['ssmlGender']||'MALE',_0x482dc9[_0x4659('0x5c')]||_0x4659('0x5d'))[_0x4659('0x13')](function(_0x532492){_0x26a336(null,_0x532492);})['catch'](function(_0x5758b0){_0x26a336(_0x5758b0);});};AGIVertices[_0x4659('0xe')][_0x4659('0x5e')]=function(_0x15d709,_0x403e14){scripts[_0x4659('0x5e')](_0x15d709['text'],_0x15d709['google_tts_language']||'en',0x1)['then'](function(_0x5f401f){_0x403e14(null,_0x5f401f);})['catch'](function(_0x59b9d1){_0x403e14(_0x59b9d1);});};AGIVertices[_0x4659('0xe')][_0x4659('0x5f')]=function(_0x115740,_0xcfa33f){var _0x35ce47={'uri':_0x115740[_0x4659('0x60')],'method':_0x115740['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x115740[_0x4659('0x61')])===_0x4659('0x62')&&parseInt(_0x115740['timeout'])>=0x1?parseInt(_0x115740[_0x4659('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x4659('0x63')](['POST',_0x4659('0x64')],_0x35ce47['method'][_0x4659('0x65')]())){try{_0x35ce47['body']=_0x115740[_0x4659('0x66')]?JSON[_0x4659('0x67')](_0x115740[_0x4659('0x66')]):{};}catch(_0x2f1771){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2f1771);}}try{_0x35ce47[_0x4659('0x68')]=_0x115740[_0x4659('0x8')]?JSON[_0x4659('0x67')](_0x115740[_0x4659('0x8')]):{};}catch(_0x226545){logger[_0x4659('0x29')](_0x4659('0x69'),_0x226545);}if(_0x115740[_0x4659('0x6a')]){try{var _0x2794be=require(_0x115740['computedVariables'])[_0x4659('0x6b')](this,_0x35ce47);_0x35ce47[_0x4659('0x6c')]=Mustache['render'](_0x115740[_0x4659('0x60')],_0x2794be,{},['$$','$$']);if(_0x35ce47[_0x4659('0x68')]){_0x35ce47[_0x4659('0x68')]=JSON['parse'](Mustache[_0x4659('0x6d')](JSON['stringify'](_0x35ce47[_0x4659('0x68')]),_0x2794be,{},['$$','$$']));}if(_0x35ce47[_0x4659('0x6e')]){_0x35ce47[_0x4659('0x6e')]=JSON['parse'](Mustache[_0x4659('0x6d')](JSON[_0x4659('0x6f')](_0x35ce47[_0x4659('0x6e')]),_0x2794be,{},['$$','$$']));}}catch(_0xf11bf3){logger[_0x4659('0x29')](_0x4659('0x70'),_0xf11bf3);}}rp(_0x35ce47)[_0x4659('0x13')](function(_0x381cda){var _0x48c46c={'statusCode':_0x381cda[_0x4659('0x71')]||0xc8,'statusMessage':_0x381cda[_0x4659('0x72')]||'OK','headers':_0x381cda[_0x4659('0x68')]||{},'body':_0x381cda[_0x4659('0x6e')]||{}};_0xcfa33f(null,_0x48c46c);})[_0x4659('0x11')](function(_0x3fa10d){var _0x5c232a={'statusCode':_0x3fa10d[_0x4659('0x71')]||0x1f4,'statusMessage':_0x3fa10d[_0x4659('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x3fa10d[_0x4659('0x74')]['headers']||{},'body':_0x3fa10d[_0x4659('0x74')]['body']||{}};_0xcfa33f(null,_0x5c232a);});};AGIVertices[_0x4659('0xe')][_0x4659('0x75')]=function(_0xc59b01,_0x4773ba){scripts[_0x4659('0x75')](this[_0x4659('0x30')][_0x4659('0x31')],_0xc59b01[_0x4659('0x76')],_0xc59b01[_0x4659('0x5b')],_0xc59b01[_0x4659('0x77')]||'en')[_0x4659('0x13')](function(_0x5e8ceb){_0x4773ba(null,_0x5e8ceb);})[_0x4659('0x11')](function(_0x5eca47){_0x4773ba(_0x5eca47);});};AGIVertices[_0x4659('0xe')][_0x4659('0x78')]=function(_0x4f21ce,_0x28967){scripts['googleDialogflowV2'](this[_0x4659('0x30')][_0x4659('0x31')],_0x4f21ce[_0x4659('0x79')],_0x4f21ce[_0x4659('0x7a')],_0x4f21ce['private_key'],_0x4f21ce[_0x4659('0x5b')],_0x4f21ce[_0x4659('0x7b')]||'en')[_0x4659('0x13')](function(_0x39e387){_0x28967(null,_0x39e387);})[_0x4659('0x11')](function(_0x261c7e){_0x28967(_0x261c7e);});};AGIVertices[_0x4659('0xe')][_0x4659('0x7c')]=function(_0x291d95,_0x14b144){scripts[_0x4659('0x7c')](this[_0x4659('0x30')],_0x291d95)[_0x4659('0x13')](function(_0x3cb873){_0x14b144(null,_0x3cb873);})['catch'](function(_0x265c62){_0x14b144(_0x265c62);});};AGIVertices[_0x4659('0xe')]['ispeechTTS']=function(_0x4c4865,_0x2d2890){scripts[_0x4659('0x7d')](_0x4c4865[_0x4659('0x76')],_0x4c4865['text'],_0x4c4865[_0x4659('0x7e')]||_0x4659('0x7f'),_0x4c4865[_0x4659('0x80')])[_0x4659('0x13')](function(_0x19ed59){_0x2d2890(null,_0x19ed59);})[_0x4659('0x11')](function(_0xc5c49e){_0x2d2890(_0xc5c49e);});};AGIVertices['prototype'][_0x4659('0x81')]=function(_0xb4c445,_0x4b1026,_0x5a9342){scripts[_0x4659('0x81')](_0x4b1026,_0xb4c445['key'],_0xb4c445['ispeech_asr_language']||_0x4659('0x7f'),this[_0x4659('0x82')](_0xb4c445['model'])?_0xb4c445[_0x4659('0x83')]:undefined)[_0x4659('0x13')](function(_0x5f39b2){_0x5a9342(null,_0x5f39b2);})[_0x4659('0x11')](function(_0x503f7a){_0x5a9342(_0x503f7a);});};AGIVertices[_0x4659('0xe')][_0x4659('0x84')]=function(_0x5ccd9b,_0x2fdee7){scripts[_0x4659('0x84')](_0x5ccd9b[_0x4659('0x85')],_0x5ccd9b[_0x4659('0x86')],_0x5ccd9b[_0x4659('0x87')],_0x5ccd9b[_0x4659('0x88')]||_0x4659('0x89'),_0x5ccd9b[_0x4659('0x5b')],_0x5ccd9b[_0x4659('0x8a')]||_0x4659('0x5b'))[_0x4659('0x13')](function(_0x1fa258){_0x2fdee7(null,_0x1fa258);})[_0x4659('0x11')](function(_0x9cc53b){_0x2fdee7(_0x9cc53b);});};AGIVertices['prototype'][_0x4659('0x8b')]=function(_0x155a3c,_0x54bc93){scripts[_0x4659('0x8b')](this[_0x4659('0x30')][_0x4659('0x31')],_0x155a3c[_0x4659('0x85')],_0x155a3c[_0x4659('0x86')],_0x155a3c[_0x4659('0x8c')],_0x155a3c[_0x4659('0x5b')],_0x155a3c[_0x4659('0x8d')])[_0x4659('0x13')](function(_0xe2be8c){_0x54bc93(null,_0xe2be8c);})[_0x4659('0x11')](function(_0xaffa49){_0x54bc93(_0xaffa49);});};AGIVertices[_0x4659('0xe')][_0x4659('0x8e')]=function(_0x573f88,_0x249ccc,_0x136032){scripts[_0x4659('0x8e')](_0x249ccc,_0x573f88['key'],_0x573f88[_0x4659('0x8f')]||'en-US')['then'](function(_0x22ba74){_0x136032(null,_0x22ba74);})[_0x4659('0x11')](function(_0x2f0630){_0x136032(_0x2f0630);});};AGIVertices[_0x4659('0xe')][_0x4659('0x90')]=function(_0x393945,_0x2d6ae2,_0x198114){scripts['tildeASR'](_0x2d6ae2,_0x393945['appid'],_0x393945[_0x4659('0x91')],_0x393945[_0x4659('0x6c')])[_0x4659('0x13')](function(_0x2857fd){_0x198114(null,_0x2857fd);})[_0x4659('0x11')](function(_0x2d7617){_0x198114(_0x2d7617);});};AGIVertices[_0x4659('0xe')]['clear']=function(_0x22bae9){var _0x8a6c0d=_[_0x4659('0x63')](verticesWithRetry,_0x22bae9[_0x4659('0x33')])?_0x22bae9:_['clone'](_0x22bae9);for(var _0x476648 in _0x8a6c0d){if(_0x8a6c0d[_0x4659('0x92')](_0x476648)){if(_0x8a6c0d[_0x476648]&&_[_0x4659('0x93')](_0x8a6c0d[_0x476648])){if(_['includes'](recursiveMapAttributes,_0x476648)){_0x8a6c0d[_0x476648]=this[_0x4659('0x94')](_0x8a6c0d[_0x476648]);}else{_0x8a6c0d[_0x476648]=this[_0x4659('0x95')](_0x8a6c0d[_0x476648]);}}}}return _0x8a6c0d;};AGIVertices['prototype'][_0x4659('0x96')]=function(_0x4090fd){for(var _0x22b824 in _0x4090fd){if(_0x4090fd['hasOwnProperty'](_0x22b824)){if(_[_0x4659('0x97')](_0x4090fd[_0x22b824])){this[_0x4659('0x96')](_0x4090fd[_0x22b824]);}else if(_[_0x4659('0x98')](_0x4090fd[_0x22b824])){for(var _0x135153=0x0;_0x135153<_0x4090fd[_0x22b824]['length'];_0x135153++){this['recursiveNodeIndex'](_0x4090fd[_0x22b824][_0x135153]);}}else if(_[_0x4659('0x93')](_0x4090fd[_0x22b824])){_0x4090fd[_0x22b824]=this[_0x4659('0x95')](_0x4090fd[_0x22b824]);}}}};AGIVertices[_0x4659('0xe')]['saveRestApiResult']=function(_0x375869,_0x316d33){for(var _0x18b166 in _0x375869){if(_0x375869[_0x4659('0x92')](_0x18b166)){if(_[_0x4659('0x97')](_0x375869[_0x18b166])){if(!_[_0x4659('0x40')](_0x375869[_0x18b166])){this['saveRestApiResult'](_0x375869[_0x18b166],util[_0x4659('0x53')]('%s.%s',_0x316d33,_0x18b166));}}else if(_[_0x4659('0x98')](_0x375869[_0x18b166])){for(var _0x3b25b8=0x0;_0x3b25b8<_0x375869[_0x18b166][_0x4659('0x99')];_0x3b25b8++){this[_0x4659('0x9a')](_0x375869[_0x18b166][_0x3b25b8],util[_0x4659('0x53')](_0x4659('0x9b'),_0x316d33,_0x18b166+'['+_0x3b25b8+']'));}}else{if(!_[_0x4659('0x41')](_0x375869[_0x18b166])){this[_0x4659('0x30')][_0x4659('0x9c')](util[_0x4659('0x53')](_0x4659('0x9b'),_0x316d33,_0x18b166),_0x375869[_0x18b166]);}}}}};AGIVertices[_0x4659('0xe')][_0x4659('0x94')]=function(_0x3c6e60){try{var _0x14074e=JSON[_0x4659('0x67')](_0x3c6e60);this[_0x4659('0x96')](_0x14074e);return JSON[_0x4659('0x6f')](_0x14074e);}catch(_0x1fd7b4){return this[_0x4659('0x95')](_0x3c6e60);}};AGIVertices['prototype'][_0x4659('0x95')]=function(_0x6c09b4){var _0xaf79b2=_0x6c09b4['split']('{');for(var _0x3ff259=0x1;_0x3ff259<_0xaf79b2[_0x4659('0x99')];_0x3ff259+=0x1){var _0x2c0fc3=_0xaf79b2[_0x3ff259][_0x4659('0x9d')]('}');if(_0x2c0fc3[_0x4659('0x99')]>0x1){_0x6c09b4=_0x6c09b4[_0x4659('0x9e')]('{'+_0x2c0fc3[0x0]+'}',this['channel'][_0x4659('0xf')](_0x2c0fc3[0x0])[_0x4659('0x9f')]||_0x2c0fc3[0x0]);}}if(_0xaf79b2[_0x4659('0x99')]===0x1){return _0x6c09b4[_0x4659('0x4a')]();}return this[_0x4659('0x95')](_0x6c09b4);};AGIVertices[_0x4659('0xe')][_0x4659('0xa0')]=function(_0x52baef,_0x40489a){var _0xa6c7f0=this[_0x4659('0x30')][_0x4659('0xf')](_0x52baef);if(_0xa6c7f0['result']===-0x1){return _0xa6c7f0;}logger['info'](util[_0x4659('0x53')](_0x4659('0xa1'),_0x40489a,_0xa6c7f0['extra']));return this[_0x4659('0x30')][_0x4659('0x9c')](_0x40489a,_0xa6c7f0[_0x4659('0x9f')]);};AGIVertices[_0x4659('0xe')][_0x4659('0x82')]=function(_0x29aa6e){return _0x29aa6e&&_0x29aa6e!=='0'&&_0x29aa6e!=='-1'&&_0x29aa6e!=='';};AGIVertices[_0x4659('0xe')][_0x4659('0xa2')]=function(_0x3c2121){this['createSquareDetailsReport'][_0x4659('0x6b')](this,_0x3c2121,'-');_0x3c2121[_0x4659('0xa3')]=_0x3c2121['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4659('0xe')]['mrcpsynth']=function(_0x4f1316){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xa4'),_0x4f1316[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x4f1316['text'])){return this[_0x4659('0x30')]['noop']('no\x20text\x20configured');}var _0x2c40de='\x22'+_0x4f1316[_0x4659('0x5b')]+'\x22';if(this['isConfigured'](_0x4f1316['options'])){_0x2c40de+=','+_0x4f1316[_0x4659('0x74')];}var _0x5d9d3c=this['channel'][_0x4659('0x55')](_0x4659('0xa5'),_0x2c40de);if(_0x5d9d3c[_0x4659('0xa6')]===-0x1){return _0x5d9d3c;}return this['channel'][_0x4659('0xa7')](util['format'](_0x4659('0xa8'),_0x2c40de));};AGIVertices[_0x4659('0xe')]['mrcprecog']=function(_0x2b0a71){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xa9'),_0x2b0a71['label']));if(!this[_0x4659('0x82')](_0x2b0a71['grammar'])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xaa'));}var _0x548ef5=_0x2b0a71['grammar'];if(this[_0x4659('0x82')](_0x2b0a71['options'])){_0x548ef5+=','+_0x2b0a71[_0x4659('0x74')];}var _0x4de9a2=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0xab'),_0x548ef5);if(_0x4de9a2['result']===-0x1){return _0x4de9a2;}var _0x42122c=this[_0x4659('0xa0')](_0x4659('0xac'),_0x4659('0xad'));if(_0x42122c['result']===-0x1){return _0x42122c;}var _0x2bb160=this[_0x4659('0xa0')](_0x4659('0xae'),_0x4659('0xaf'));if(_0x2bb160[_0x4659('0xa6')]===-0x1){return _0x2bb160;}var _0x4336db=this['getAndSetVariable']('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x4336db['result']===-0x1){return _0x4336db;}return this['channel'][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xb0'),_0x548ef5));};AGIVertices[_0x4659('0xe')][_0x4659('0xb1')]=function(_0x1e59eb){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xb2'),_0x1e59eb['label']));return this[_0x4659('0x30')][_0x4659('0xb1')]([_0x1e59eb[_0x4659('0xb3')],_0x1e59eb['args']]);};AGIVertices[_0x4659('0xe')][_0x4659('0xb4')]=function(_0x3b3748){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x3b3748[_0x4659('0x32')]));if(this[_0x4659('0x82')](_0x3b3748['timeout'])){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3b3748[_0x4659('0x61')]));var _0xc82f3f=this[_0x4659('0x30')][_0x4659('0xb5')](_0x3b3748['timeout']);if(_0xc82f3f[_0x4659('0xa6')]===-0x1){return _0xc82f3f;}}return this['channel'][_0x4659('0xb4')]();};AGIVertices[_0x4659('0xe')][_0x4659('0x48')]=function(_0x2ded60){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xb6'),_0x2ded60['label']));if(!this[_0x4659('0x82')](_0x2ded60['list_id'])){return this[_0x4659('0x30')]['error'](_0x2ded60,'no\x20list\x20selected');}_0x2ded60[_0x4659('0x47')]=moment();if(this[_0x4659('0x82')](_0x2ded60[_0x4659('0xb7')])){_0x2ded60['scheduledAt']=moment()[_0x4659('0xb8')](_0x2ded60[_0x4659('0xb7')],_0x4659('0xb9'));}if(!this[_0x4659('0x82')](_0x2ded60[_0x4659('0xba')])){_0x2ded60[_0x4659('0xba')]=0x2;}this[_0x4659('0x3f')]['sync'](this,_0x2ded60);return this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0xbb'),_0x2ded60[_0x4659('0x45')],_0x2ded60[_0x4659('0x46')],_0x2ded60[_0x4659('0x47')]));};AGIVertices['prototype']['custom_app']=function(_0x1f2bfe){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xbc'),_0x1f2bfe[_0x4659('0x32')]));var _0x29b1de=this[_0x4659('0x30')][_0x4659('0x55')](_0x1f2bfe[_0x4659('0xbd')],_0x1f2bfe[_0x4659('0x74')]);if(_0x29b1de[_0x4659('0xa6')]===-0x1){return _0x29b1de;}return this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0xbe'),_0x1f2bfe[_0x4659('0xbd')],_0x1f2bfe[_0x4659('0x74')]));};AGIVertices[_0x4659('0xe')]['lumenvoxtts']=function(_0x239b63){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xbf'),_0x239b63[_0x4659('0x32')]));if(!this['isConfigured'](_0x239b63['text'])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20text\x20configured');}var _0x29cb8a='\x22'+_0x239b63[_0x4659('0x5b')]+'\x22';if(this[_0x4659('0x82')](_0x239b63[_0x4659('0x74')])){_0x29cb8a+=','+_0x239b63[_0x4659('0x74')];}var _0x4562e8=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0xa5'),_0x29cb8a);if(_0x4562e8['result']===-0x1){return _0x4562e8;}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xa8'),_0x29cb8a));};AGIVertices[_0x4659('0xe')][_0x4659('0xc0')]=function(_0x32736b){logger[_0x4659('0x2a')](util['format'](_0x4659('0xc1'),_0x32736b['label']));if(!this[_0x4659('0x82')](_0x32736b[_0x4659('0x5b')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20text\x20configured');}var _0x571df3='\x22'+_0x32736b['text']+'\x22';if(this[_0x4659('0x82')](_0x32736b[_0x4659('0x74')])){_0x571df3+=','+_0x32736b['options'];}var _0x2a015d=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0xa5'),_0x571df3);if(_0x2a015d[_0x4659('0xa6')]===-0x1){return _0x2a015d;}return this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')]('Executed\x20command\x20MRCPSynth\x20%s',_0x571df3));};AGIVertices[_0x4659('0xe')][_0x4659('0xc2')]=function(_0x4cdb21){logger[_0x4659('0x2a')](util['format'](_0x4659('0xc3'),_0x4cdb21[_0x4659('0x32')]));if(!this['isConfigured'](_0x4cdb21[_0x4659('0xc4')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20grammar\x20configured');}var _0x438781=_0x4cdb21[_0x4659('0xc4')];if(this[_0x4659('0x82')](_0x4cdb21[_0x4659('0x74')])){_0x438781+=','+_0x4cdb21[_0x4659('0x74')];}var _0x3fc5bb=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0xab'),_0x438781);if(_0x3fc5bb[_0x4659('0xa6')]===-0x1){return _0x3fc5bb;}var _0x2e3772=this[_0x4659('0xa0')](_0x4659('0xac'),_0x4659('0xc5'));if(_0x2e3772[_0x4659('0xa6')]===-0x1){return _0x2e3772;}var _0x255480=this[_0x4659('0xa0')]('RECOG_INPUT()',_0x4659('0xc6'));if(_0x255480['result']===-0x1){return _0x255480;}var _0x584ae6=this[_0x4659('0xa0')](_0x4659('0xc7'),_0x4659('0xc8'));if(_0x584ae6['result']===-0x1){return _0x584ae6;}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xb0'),_0x438781));};AGIVertices[_0x4659('0xe')][_0x4659('0xc9')]=function(_0x8a6fd9){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x8a6fd9[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x8a6fd9[_0x4659('0xc4')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xaa'));}var _0x1e4751=_0x8a6fd9[_0x4659('0xc4')];if(this[_0x4659('0x82')](_0x8a6fd9[_0x4659('0x74')])){_0x1e4751+=','+_0x8a6fd9[_0x4659('0x74')];}var _0x50fcc1=this['channel']['exec'](_0x4659('0xab'),_0x1e4751);if(_0x50fcc1['result']===-0x1){return _0x50fcc1;}var _0x2a7d03=this[_0x4659('0xa0')](_0x4659('0xac'),_0x4659('0xca'));if(_0x2a7d03[_0x4659('0xa6')]===-0x1){return _0x2a7d03;}var _0x3621d9=this[_0x4659('0xa0')](_0x4659('0xae'),_0x4659('0xcb'));if(_0x3621d9[_0x4659('0xa6')]===-0x1){return _0x3621d9;}var _0x299a72=this[_0x4659('0xa0')]('RECOG_INSTANCE()',_0x4659('0xcc'));if(_0x299a72[_0x4659('0xa6')]===-0x1){return _0x299a72;}return this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0xb0'),_0x1e4751));};AGIVertices[_0x4659('0xe')][_0x4659('0xcd')]=function(_0x2ac6b7){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xce'),_0x2ac6b7['label']));if(!this[_0x4659('0x82')](_0x2ac6b7[_0x4659('0xcf')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2ac6b7,_0x4659('0xd0'));}var _0x90dc3a=this['getSquareOdbc'][_0x4659('0x6b')](this,_0x2ac6b7[_0x4659('0xcf')]);if(!_0x90dc3a){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2ac6b7,_0x4659('0xd1'));}if(!this[_0x4659('0x82')](_0x2ac6b7['query'])){return this[_0x4659('0x30')]['error'](_0x2ac6b7,_0x4659('0xd2'));}var _0xfdb89c=_0x2ac6b7[_0x4659('0xd3')][_0x4659('0x57')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0xd4'),_0xfdb89c));var _0x13d386=this[_0x4659('0x27')][_0x4659('0x6b')](this,_0x90dc3a,_0xfdb89c);this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x2ac6b7,_0xfdb89c);if(!this[_0x4659('0x82')](_0x2ac6b7[_0x4659('0xd5')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xd6'));}var _0x1935d4=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x2ac6b7[_0x4659('0xd5')]);if(!_0x1935d4){return this[_0x4659('0x30')]['error'](_0x2ac6b7,_0x4659('0xd7'));}var _0x26251b=this;_0x13d386[_0x4659('0xd8')](function(_0x3c7d27,_0x2dccff){Object['keys'](_0x3c7d27)['forEach'](function(_0x29e7b9){_0x26251b[_0x4659('0x30')][_0x4659('0x9c')](util['format'](_0x4659('0xd9'),_0x1935d4,_0x2dccff,_0x29e7b9),_0x3c7d27[_0x29e7b9]);});});this[_0x4659('0x30')][_0x4659('0x9c')](util[_0x4659('0x53')]('%s_ROWS_COUNT',_0x1935d4),_0x13d386[_0x4659('0x99')]);return this['channel']['noop'](util[_0x4659('0x53')](_0x4659('0xda'),_0x1935d4));};AGIVertices[_0x4659('0xe')][_0x4659('0xdb')]=function(_0x1be9e7){logger['debug'](util[_0x4659('0x53')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1be9e7[_0x4659('0x32')]));if(!this['isConfigured'](_0x1be9e7[_0x4659('0xdc')])){return this[_0x4659('0x30')]['error'](_0x1be9e7,_0x4659('0xdd'));}var _0x633c2e=this[_0x4659('0x18')][_0x4659('0x6b')](this,_0x1be9e7['sip_id']);if(!_0x633c2e){return this[_0x4659('0x30')][_0x4659('0x29')](_0x1be9e7,'no\x20user\x20found');}var _0x1ccaa4=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0xde'),[util[_0x4659('0x53')]('SIP/%s',_0x633c2e),_0x1be9e7['timeout'],_0x1be9e7['opts'],_0x1be9e7[_0x4659('0x60')]]);if(_0x1ccaa4[_0x4659('0xa6')]===-0x1){return _0x1ccaa4;}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xdf'),'DIAL'));};AGIVertices['prototype'][_0x4659('0xe0')]=function(_0x406038){logger['info'](util[_0x4659('0x53')](_0x4659('0xe1'),_0x406038[_0x4659('0x32')]));if(!this['isConfigured'](_0x406038[_0x4659('0x76')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xe2'));}if(!this[_0x4659('0x82')](_0x406038[_0x4659('0x5b')])){return this['channel']['noop'](_0x4659('0xe3'));}this['channel'][_0x4659('0xe4')]=!![];this['createSquareDetailsReport'](_0x406038);this[_0x4659('0x3e')](_0x406038[_0x4659('0x5b')],'in','','');this[_0x4659('0x30')]['noop'](util['format'](_0x4659('0xe5'),_0x406038[_0x4659('0x5b')]));var _0x3573e3=this[_0x4659('0x75')][_0x4659('0x6b')](this,_0x406038);if(_0x3573e3){for(var _0x1e6340 in _0x3573e3){if(_0x3573e3[_0x4659('0x92')](_0x1e6340)){this[_0x4659('0x30')][_0x4659('0x9c')](util[_0x4659('0x53')]('DIALOGFLOW_%s',_0x1e6340[_0x4659('0x65')]()),_0x3573e3[_0x1e6340]);}}this[_0x4659('0x3e')](_0x3573e3[_0x4659('0xe6')],_0x4659('0xe7'),_0x4659('0xe0'),'');return this['channel'][_0x4659('0xa7')](util['format'](_0x4659('0xe8'),_0x3573e3[_0x4659('0xe6')]));}return this['channel'][_0x4659('0x29')](_0x406038,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x4659('0xe')][_0x4659('0xe9')]=function(_0x56595f){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xea'),_0x56595f[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x56595f[_0x4659('0x79')])){return this['channel']['noop'](_0x4659('0xeb'));}if(!this[_0x4659('0x82')](_0x56595f[_0x4659('0x7a')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20client_email\x20configured');}if(!this[_0x4659('0x82')](_0x56595f[_0x4659('0xec')])){return this['channel'][_0x4659('0xa7')](_0x4659('0xed'));}if(!this['isConfigured'](_0x56595f[_0x4659('0x7b')])){return this[_0x4659('0x30')]['noop'](_0x4659('0xee'));}if(!this[_0x4659('0x82')](_0x56595f[_0x4659('0x5b')])){return this[_0x4659('0x30')]['noop']('no\x20text\x20configured');}this[_0x4659('0x30')][_0x4659('0xe4')]=!![];this['createSquareDetailsReport'](_0x56595f);this[_0x4659('0x3e')](_0x56595f[_0x4659('0x5b')],'in','','');this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xef'),_0x56595f[_0x4659('0x5b')]));var _0x282079=this[_0x4659('0x78')][_0x4659('0x6b')](this,_0x56595f);if(_0x282079){for(var _0x46181e in _0x282079){if(_0x282079[_0x4659('0x92')](_0x46181e)){if(_0x46181e!==_0x4659('0xf0')){this['channel'][_0x4659('0x9c')](util['format'](_0x4659('0xf1'),_0x46181e[_0x4659('0x65')]()),_0x282079[_0x46181e]);}}}this[_0x4659('0x3e')](_0x282079['speech'],'out','dialogflowV2',_0x282079[_0x4659('0xf0')]);return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('DialogflowV2\x20Result\x20%s',_0x282079[_0x4659('0xe6')]));}return this[_0x4659('0x30')][_0x4659('0x29')](_0x56595f,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x4659('0xe')][_0x4659('0xf2')]=function(_0x487389){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0xf3'),_0x487389[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x487389[_0x4659('0xf4')])){return this[_0x4659('0x30')]['noop'](_0x4659('0xf5'));}if(!this[_0x4659('0x82')](_0x487389[_0x4659('0xf6')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xf7'));}if(!this['isConfigured'](_0x487389['password'])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20password\x20configured');}if(!this[_0x4659('0x82')](_0x487389[_0x4659('0xf8')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x4659('0x30')][_0x4659('0xe4')]=!![];this['createSquareDetailsReport'](_0x487389);this[_0x4659('0x3e')](_0x487389[_0x4659('0x5b')],'in','','');this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('Trying\x20SestekNDA:\x20%s',_0x487389[_0x4659('0x5b')]));var _0x44df72=this['sestekNDA'][_0x4659('0x6b')](this,_0x487389);if(_0x44df72){for(var _0x323345 in _0x44df72){if(_0x44df72[_0x4659('0x92')](_0x323345)){this[_0x4659('0x30')][_0x4659('0x9c')](util[_0x4659('0x53')](_0x4659('0xf9'),_0x323345['toUpperCase']()),_0x44df72[_0x323345]);}}this[_0x4659('0x3e')](_0x44df72[_0x4659('0xe6')],'out',_0x4659('0xf2'),'');if(_0x44df72['audiofile']){this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0xfa'),_0x44df72[_0x4659('0xfb')]));var _0x3286a6=this[_0x4659('0x30')]['streamFile'](_0x44df72['audiofile']);try{fs[_0x4659('0xfc')](_0x44df72[_0x4659('0xfb')]+_0x4659('0xfd'));}catch(_0x378bf0){logger['error'](_0x378bf0);}return _0x3286a6;}else{return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xfe'),_0x44df72[_0x4659('0xe6')]));}}return this[_0x4659('0x30')][_0x4659('0x29')](_0x487389,_0x4659('0xff'));};AGIVertices['prototype'][_0x4659('0x100')]=function(_0x57b2a1){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20END\x20(%s)\x20block',_0x57b2a1[_0x4659('0x32')]));return this[_0x4659('0x30')][_0x4659('0xa7')]('end');};AGIVertices[_0x4659('0xe')]['ext_dial']=function(_0x583b9c){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x101'),_0x583b9c[_0x4659('0x32')]));var _0x20928a='';if(_0x583b9c[_0x4659('0x102')]){if(!this['isConfigured'](_0x583b9c[_0x4659('0x102')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x583b9c,_0x4659('0x103'));}else{var _0x13a29e=parseInt(_0x583b9c[_0x4659('0x102')],0xa);if(isNaN(_0x13a29e)){_0x20928a=_0x583b9c['trunk_id'];}else{_0x20928a=this[_0x4659('0x19')][_0x4659('0x6b')](this,_0x583b9c['trunk_id']);if(!_0x20928a){return this[_0x4659('0x30')][_0x4659('0x29')](_0x583b9c,'no\x20trunk\x20found');}}}}else if(_0x583b9c[_0x4659('0x104')]){_0x20928a=_0x583b9c[_0x4659('0x104')];}else{return this[_0x4659('0x30')]['error'](_0x583b9c,_0x4659('0x103'));}var _0x27437e=this[_0x4659('0x30')][_0x4659('0x55')]('DIAL',[util['format']('SIP/%s/%s',_0x20928a,_0x583b9c[_0x4659('0x45')]),_0x583b9c[_0x4659('0x61')],_0x583b9c[_0x4659('0x105')],_0x583b9c['url']]);if(_0x27437e[_0x4659('0xa6')]===-0x1){return _0x27437e;}return this[_0x4659('0x30')]['noop'](util['format'](_0x4659('0xdf'),_0x4659('0xde')));};AGIVertices[_0x4659('0xe')][_0x4659('0x106')]=function(_0x364d68){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x364d68[_0x4659('0x32')]));return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x106'));};AGIVertices[_0x4659('0xe')][_0x4659('0xa')]=function(_0x4b6338){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x107'),_0x4b6338[_0x4659('0x32')]));if(_0x4b6338[_0x4659('0xa3')]===0x0){return this[_0x4659('0xa2')](_0x4b6338);}_0x4b6338[_0x4659('0xa3')]-=0x1;if(!this['isConfigured'](_0x4b6338['file_id'])){return this[_0x4659('0x30')]['error'](_0x4b6338,_0x4659('0x108'));}var _0x58ec87=this['getSound']['sync'](this,_0x4b6338['file_id']);if(!_0x58ec87){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4b6338,_0x4659('0x109'));}if(!this[_0x4659('0x82')](_0x4b6338[_0x4659('0xd5')])){return this['channel']['error'](_0x4659('0xd6'));}var _0x24b4de=this[_0x4659('0x30')][_0x4659('0x10a')](_0x58ec87,_0x4b6338[_0x4659('0x10b')],_0x4b6338[_0x4659('0x10c')]);var _0x3e8a6c=_0x24b4de[_0x4659('0xa6')]?_0x24b4de[_0x4659('0xa6')]['toString']():'';logger['info']('test',JSON[_0x4659('0x6f')](_0x24b4de));if(_0x24b4de[_0x4659('0xa6')]===-0x1){this['createSquareDetailsReport'][_0x4659('0x6b')](this,_0x4b6338,_0x3e8a6c);return _0x24b4de;}else if(_0x24b4de[_0x4659('0x9f')]===_0x4659('0x61')){_0x24b4de[_0x4659('0xa6')]=_0x3e8a6c[_0x4659('0x99')]>=parseInt(_0x4b6338[_0x4659('0x10d')])?'x':'i';}else{_0x24b4de[_0x4659('0xa6')]=_0x3e8a6c['length']>=parseInt(_0x4b6338['mindigit'])&&_0x3e8a6c[_0x4659('0x99')]<=parseInt(_0x4b6338[_0x4659('0x10c')])?'x':'i';}var _0x3b4de4=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x4b6338['variable_id']);if(!_0x3b4de4){return this['channel']['error'](_0x4b6338,_0x4659('0xd7'));}this[_0x4659('0x30')][_0x4659('0x9c')](_0x3b4de4,_0x3e8a6c);if(this[_0x4659('0x82')](_0x4b6338[_0x4659('0x10e')])){var _0x20cdaf=parseInt(_0x4b6338[_0x4659('0x10e')],0xa);var _0x270169=rs[_0x4659('0x10f')]({'charset':'*','length':_0x20cdaf});var _0x3b0006=_0x3e8a6c[_0x4659('0x99')];if(_0x3b0006>0x0){if(_0x3b0006>_0x20cdaf){this['createSquareDetailsReport']['sync'](this,_0x4b6338,_0x4b6338[_0x4659('0x110')]===_0x4659('0x111')?_0x270169+_0x3e8a6c[_0x4659('0x112')](_0x20cdaf):_0x3e8a6c[_0x4659('0x112')](0x0,_0x3b0006-_0x20cdaf)+_0x270169);}else{this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x4b6338,rs[_0x4659('0x10f')]({'charset':'*','length':_0x3b0006}));}}else{this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x4b6338,'');}}else{this[_0x4659('0x2f')]['sync'](this,_0x4b6338,_0x3e8a6c);}return _0x24b4de;};AGIVertices['prototype'][_0x4659('0xb')]=function(_0x5d9266){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x113'),_0x5d9266[_0x4659('0x32')]));return this[_0x4659('0xa')](_0x5d9266);};AGIVertices[_0x4659('0xe')][_0x4659('0x114')]=function(_0x482bbe){logger['info'](util[_0x4659('0x53')](_0x4659('0x115'),_0x482bbe[_0x4659('0x32')]));this['createSquareDetailsReport'][_0x4659('0x6b')](this,_0x482bbe,_0x482bbe[_0x4659('0x116')]);return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('GOAL\x20%s',_0x482bbe[_0x4659('0x116')]));};AGIVertices[_0x4659('0xe')][_0x4659('0x117')]=function(_0x726bff){logger[_0x4659('0x2a')](util['format'](_0x4659('0x118'),_0x726bff[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x726bff[_0x4659('0x85')])||!this[_0x4659('0x82')](_0x726bff[_0x4659('0x86')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4659('0x82')](_0x726bff[_0x4659('0x5b')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xe3'));}this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x119'),_0x726bff[_0x4659('0x5b')]));var _0x167a4=this[_0x4659('0x84')][_0x4659('0x6b')](this,_0x726bff);if(_0x167a4){this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x11a'),_0x167a4));var _0x515cf0=this['channel']['streamFile'](_0x167a4);try{fs['unlink'](_0x167a4+_0x4659('0xfd'));}catch(_0x18e68a){logger[_0x4659('0x29')](_0x18e68a);}return _0x515cf0;}return this[_0x4659('0x30')][_0x4659('0x29')](_0x726bff,_0x4659('0x11b'));};AGIVertices['prototype'][_0x4659('0x11c')]=function(_0xc87f38){logger['info'](util[_0x4659('0x53')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xc87f38['label']));if(!this[_0x4659('0x82')](_0xc87f38['aws_access_key_id'])||!this[_0x4659('0x82')](_0xc87f38[_0x4659('0x86')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x11d'));}if(!this[_0x4659('0x82')](_0xc87f38[_0x4659('0x8d')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x11e'));}if(!this[_0x4659('0x82')](_0xc87f38[_0x4659('0x5b')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xe3'));}this['channel'][_0x4659('0xe4')]=!![];this['createSquareDetailsReport'](_0xc87f38);this[_0x4659('0x3e')](_0xc87f38[_0x4659('0x5b')],'in','','');this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0x11f'),_0xc87f38['text']));var _0x94654a=this[_0x4659('0x8b')][_0x4659('0x6b')](this,_0xc87f38);if(_0x94654a){for(var _0x3ae4a8 in _0x94654a){if(_0x94654a[_0x4659('0x92')](_0x3ae4a8)&&_[_0x4659('0x93')](_0x94654a[_0x3ae4a8])){this[_0x4659('0x30')][_0x4659('0x9c')](util[_0x4659('0x53')](_0x4659('0x120'),_0x3ae4a8['toUpperCase']()),_0x94654a[_0x3ae4a8]);}}if(_[_0x4659('0x41')](_0x94654a[_0x4659('0x73')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x121'));}else{this[_0x4659('0x3e')](_0x94654a[_0x4659('0x73')],_0x4659('0xe7'),'amazonlex','');return this[_0x4659('0x30')]['noop'](util['format'](_0x4659('0x122'),_0x94654a[_0x4659('0x73')]));}}return this[_0x4659('0x30')][_0x4659('0x29')](_0xc87f38,_0x4659('0x123'));};AGIVertices[_0x4659('0xe')]['googleasr']=function(_0x4c1b5b){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x124'),_0x4c1b5b[_0x4659('0x32')],_0x4c1b5b[_0x4659('0x61')]));if(!this[_0x4659('0x82')](_0x4c1b5b[_0x4659('0x76')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xe2'));}var _0x17e04e=_0x4659('0x125');var _0xbf137f=util[_0x4659('0x53')](_0x4659('0x126'),FILES_PATH,rs[_0x4659('0x10f')](0x4));var _0x40bbc1=util[_0x4659('0x53')](_0x4659('0x9b'),_0xbf137f,_0x17e04e);var _0x2aff35=!![];if(_0x4c1b5b[_0x4659('0x127')]==='NOBEEP'){_0x2aff35=![];}var _0x4d495b=this['channel'][_0x4659('0x128')](_0xbf137f,_0x17e04e,_0x4c1b5b['intKey'],_0x4c1b5b[_0x4659('0x61')],undefined,_0x2aff35);if(_0x4d495b[_0x4659('0xa6')]!==-0x1){this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x129'),_0x40bbc1));var _0x485f6f=this['googleASR'][_0x4659('0x6b')](this,_0x4c1b5b,_0x40bbc1);if(_0x485f6f){for(var _0x54cb50 in _0x485f6f){if(_0x485f6f[_0x4659('0x92')](_0x54cb50)){this[_0x4659('0x30')][_0x4659('0x9c')](util['format'](_0x4659('0x12a'),_0x54cb50[_0x4659('0x65')]()),_0x485f6f[_0x54cb50]);}}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x12b'),JSON[_0x4659('0x6f')](_0x485f6f)));}}return _0x4d495b;};AGIVertices['prototype'][_0x4659('0x12c')]=function(_0x3cef48){logger['info'](util[_0x4659('0x53')](_0x4659('0x12d'),_0x3cef48[_0x4659('0x32')]));if(!this['isConfigured'](_0x3cef48[_0x4659('0x12e')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x12f'));}if(!this[_0x4659('0x82')](_0x3cef48[_0x4659('0x91')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x130'));}var _0x532f89=_0x4659('0x125');var _0x506ae7=util[_0x4659('0x53')](_0x4659('0x126'),FILES_PATH,rs[_0x4659('0x10f')](0x4));var _0x8693f2=util[_0x4659('0x53')](_0x4659('0x9b'),_0x506ae7,_0x532f89);var _0x58d1fb=!![];if(_0x3cef48[_0x4659('0x127')]==='NOBEEP'){_0x58d1fb=![];}var _0x58e06a=this[_0x4659('0x30')][_0x4659('0x128')](_0x506ae7,_0x532f89,_0x3cef48[_0x4659('0x131')],_0x3cef48[_0x4659('0x61')],undefined,_0x58d1fb);if(_0x58e06a[_0x4659('0xa6')]!==-0x1){this[_0x4659('0x30')][_0x4659('0xa7')](util['format']('tilde\x20%s\x20file\x20created',_0x8693f2));var _0x53cced=this[_0x4659('0x90')][_0x4659('0x6b')](this,_0x3cef48,_0x8693f2);if(_0x53cced){for(var _0x3069e6 in _0x53cced){if(_0x53cced[_0x4659('0x92')](_0x3069e6)){this['channel']['setVariable'](util[_0x4659('0x53')](_0x4659('0x132'),_0x3069e6[_0x4659('0x65')]()),_0x53cced[_0x3069e6]);}}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x133'),JSON[_0x4659('0x6f')](_0x53cced)));}}return _0x58e06a;};AGIVertices['prototype']['gotoc']=function(_0x5b2066){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x134'),_0x5b2066[_0x4659('0x32')]));return this['channel'][_0x4659('0x135')](_0x5b2066[_0x4659('0x38')],_0x5b2066['extension'],_0x5b2066[_0x4659('0x3a')]);};AGIVertices[_0x4659('0xe')]['gotoif']=function(_0x325764){logger['info'](util[_0x4659('0x53')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x325764[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x325764['condition'])){return this['channel'][_0x4659('0x29')](_0x325764,_0x4659('0x136'));}try{var _0x6439bb=eval(_0x325764[_0x4659('0x137')])?'true':_0x4659('0x138');this['channel']['noop'](util[_0x4659('0x53')]('EVAL\x20CONDITION\x20%s\x20%s',_0x325764['condition'],_0x6439bb));return{'code':0xc8,'result':_0x6439bb};}catch(_0x379949){return{'code':0xc8,'result':_0x4659('0x138')};}};AGIVertices[_0x4659('0xe')][_0x4659('0x139')]=function(_0x270dc5){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x13a'),_0x270dc5[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x270dc5[_0x4659('0x13b')])){return this['channel']['error'](_0x270dc5,_0x4659('0x13c'));}var _0x19d852=this[_0x4659('0x21')][_0x4659('0x6b')](this,_0x270dc5[_0x4659('0x13b')]);if(!_0x19d852){return this[_0x4659('0x30')][_0x4659('0x29')](_0x270dc5,_0x4659('0x13d'));}for(var _0x53c9de=0x0;_0x53c9de<_0x19d852[_0x4659('0x99')];_0x53c9de+=0x1){var _0x26eeb6=this[_0x4659('0x30')]['getVariable'](util[_0x4659('0x53')](_0x4659('0x13e'),_0x19d852[_0x53c9de]));if(_0x26eeb6[_0x4659('0xa6')]===-0x1){return _0x26eeb6;}logger['info'](util[_0x4659('0x53')](_0x4659('0x13f'),_0x19d852[_0x53c9de],_0x26eeb6[_0x4659('0x9f')]));if(_0x26eeb6[_0x4659('0x9f')]===_0x4659('0x140')){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('IFTIME\x20%s\x20%s',_0x19d852[_0x53c9de],_0x4659('0x140')));this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x13f'),_0x19d852[_0x53c9de],_0x4659('0x140')));return{'code':0xc8,'result':_0x4659('0x140')};}else{logger['info'](util[_0x4659('0x53')](_0x4659('0x13f'),_0x19d852[_0x53c9de],_0x4659('0x138')));this['channel'][_0x4659('0xa7')](util['format']('IFTIME\x20%s\x20%s',_0x19d852[_0x53c9de],_0x4659('0x138')));}}return{'code':0xc8,'result':_0x4659('0x138')};};AGIVertices[_0x4659('0xe')][_0x4659('0x141')]=function(_0x2b1d25){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x142'),_0x2b1d25['label']));return this['channel'][_0x4659('0x141')]();};AGIVertices[_0x4659('0xe')][_0x4659('0x143')]=function(_0x5d2200){logger[_0x4659('0x2a')](util['format'](_0x4659('0x144'),_0x5d2200['label']));if(!this[_0x4659('0x82')](_0x5d2200['key'])){return this['channel'][_0x4659('0xa7')](_0x4659('0xe2'));}var _0x55f4f5=_0x4659('0x125');var _0x6da4eb=util[_0x4659('0x53')](_0x4659('0x126'),FILES_PATH,rs[_0x4659('0x10f')](0x4));var _0xe338fa=util[_0x4659('0x53')]('%s.%s',_0x6da4eb,_0x55f4f5);var _0xa1a50a=!![];if(_0x5d2200[_0x4659('0x127')]==='NOBEEP'){_0xa1a50a=![];}var _0x3ec785=this[_0x4659('0x30')][_0x4659('0x128')](_0x6da4eb,_0x55f4f5,_0x5d2200[_0x4659('0x131')],_0x5d2200['timeout'],undefined,_0xa1a50a);if(_0x3ec785[_0x4659('0xa6')]!==-0x1){this['channel'][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x145'),_0xe338fa));var _0x16e3dc=this[_0x4659('0x81')][_0x4659('0x6b')](this,_0x5d2200,_0xe338fa);if(_0x16e3dc){for(var _0xed168a in _0x16e3dc){if(_0x16e3dc['hasOwnProperty'](_0xed168a)){this[_0x4659('0x30')][_0x4659('0x9c')](util['format'](_0x4659('0x146'),_0xed168a[_0x4659('0x65')]()),_0x16e3dc[_0xed168a]);}}return this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0x147'),JSON[_0x4659('0x6f')](_0x16e3dc)));}}return _0x3ec785;};AGIVertices[_0x4659('0xe')][_0x4659('0x148')]=function(_0x268ea4){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x149'),_0x268ea4[_0x4659('0x32')]));if(!this['isConfigured'](_0x268ea4[_0x4659('0x76')])){return this['channel'][_0x4659('0xa7')](_0x4659('0xe2'));}if(!this['isConfigured'](_0x268ea4[_0x4659('0x5b')])){return this[_0x4659('0x30')]['noop'](_0x4659('0xe3'));}this['channel'][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x14a'),_0x268ea4[_0x4659('0x5b')]));var _0x287b85=this[_0x4659('0x7d')][_0x4659('0x6b')](this,_0x268ea4);if(_0x287b85){this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x145'),_0x287b85));var _0x1cda4d=this[_0x4659('0x30')]['streamFile'](_0x287b85,_0x268ea4[_0x4659('0x131')]);try{fs[_0x4659('0xfc')](_0x287b85+'.wav');}catch(_0x3f04f2){logger['error'](_0x3f04f2);}return _0x1cda4d;}return this['channel'][_0x4659('0x29')](_0x268ea4,_0x4659('0x14b'));};AGIVertices[_0x4659('0xe')][_0x4659('0x14c')]=function(_0x171f5a){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x14d'),_0x171f5a['label']));if(!this[_0x4659('0x82')](_0x171f5a[_0x4659('0x14e')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x171f5a,'no\x20find\x20by\x20configured');}logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x14f'),this['channel'][_0x4659('0x35')],_0x171f5a['findBy']));var _0x3c511d=this['agentLogin']['sync'](this,_0x171f5a[_0x4659('0x14e')]);if(_0x3c511d){logger['info'](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x171f5a[_0x4659('0x14e')]));this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x171f5a[_0x4659('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x151'),this['channel']['callerid'],_0x171f5a[_0x4659('0x14e')]));this['channel']['noop'](util[_0x4659('0x53')](_0x4659('0x151'),this[_0x4659('0x30')][_0x4659('0x35')],_0x171f5a[_0x4659('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4659('0xe')][_0x4659('0x152')]=function(_0x189333){logger['info'](util[_0x4659('0x53')](_0x4659('0x153'),_0x189333['label']));if(!this[_0x4659('0x82')](_0x189333[_0x4659('0x14e')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x189333,'no\x20find\x20by\x20configured');}logger[_0x4659('0x2a')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x189333[_0x4659('0x14e')]));var _0x239dd4=this[_0x4659('0x50')][_0x4659('0x6b')](this,_0x189333[_0x4659('0x14e')]);if(_0x239dd4){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x189333[_0x4659('0x14e')]));this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4659('0x30')]['callerid'],_0x189333['findBy']));return{'code':0xc8,'result':_0x4659('0x154')};}else{logger['info'](util[_0x4659('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4659('0x30')]['callerid'],_0x189333['findBy']));this[_0x4659('0x30')]['noop'](util['format'](_0x4659('0x151'),this['channel']['callerid'],_0x189333[_0x4659('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x2863c7){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x155'),_0x2863c7[_0x4659('0x32')]));if(!this['isConfigured'](_0x2863c7[_0x4659('0x156')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2863c7,_0x4659('0x157'));}this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0x158'),_0x2863c7[_0x4659('0x156')]));var _0x1637b0=eval(_0x2863c7[_0x4659('0x156')]);if(!this['isConfigured'](_0x2863c7[_0x4659('0xd5')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a1a74=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x2863c7[_0x4659('0xd5')]);if(!_0x2a1a74){return this['channel'][_0x4659('0x29')](_0x2863c7,_0x4659('0xd7'));}if(_[_0x4659('0x98')](_0x1637b0)){var _0x14b6f5=this;_0x1637b0[_0x4659('0xd8')](function(_0x3e7477,_0x460f10){_0x14b6f5['channel'][_0x4659('0x9c')](util[_0x4659('0x53')](_0x4659('0x159'),_0x2a1a74,_0x460f10),_0x3e7477);});return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x15a'),_0x2a1a74));}else{return this[_0x4659('0x30')][_0x4659('0x9c')](_0x2a1a74,_0x1637b0);}};AGIVertices[_0x4659('0xe')]['menu']=function(_0x4408b3){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4408b3[_0x4659('0x32')]));if(_0x4408b3[_0x4659('0xa3')]===0x0){return this[_0x4659('0xa2')](_0x4408b3);}_0x4408b3['retry']-=0x1;if(!this['isConfigured'](_0x4408b3[_0x4659('0x15b')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4408b3,_0x4659('0x108'));}var _0x3f4157=this['getSound'][_0x4659('0x6b')](this,_0x4408b3[_0x4659('0x15b')]);if(!_0x3f4157){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4408b3,_0x4659('0x109'));}var _0x2819f8=this[_0x4659('0x30')][_0x4659('0x10a')](_0x3f4157,_0x4408b3[_0x4659('0x10b')],_0x4408b3['digit']);var _0x57edda=_0x2819f8[_0x4659('0xa6')];if(_0x2819f8['result']===-0x1){this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x4408b3,'-1');return _0x2819f8;}else if(_0x2819f8['extra']===_0x4659('0x61')){_0x2819f8[_0x4659('0xa6')]=_0x2819f8[_0x4659('0xa6')][_0x4659('0x99')]>0x0?_0x2819f8['result']:'t';}else if(_['isEmpty'](_0x2819f8[_0x4659('0xa6')])){_0x2819f8['result']='#';_0x57edda='#';}if(!this[_0x4659('0x82')](_0x4408b3[_0x4659('0xd5')])){this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xd6'));}else{var _0x4b1f17=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x4408b3[_0x4659('0xd5')]);if(!_0x4b1f17){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4408b3,_0x4659('0xd7'));}this['channel'][_0x4659('0x9c')](_0x4b1f17,_0x57edda);}this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x4408b3,_0x57edda);return _0x2819f8;};AGIVertices[_0x4659('0xe')]['noop']=function(_0x21cb90){logger['info'](util[_0x4659('0x53')](_0x4659('0x15c'),_0x21cb90[_0x4659('0x32')]));return this[_0x4659('0x30')]['noop'](_0x21cb90['output']||_0x21cb90[_0x4659('0x32')]);};AGIVertices[_0x4659('0xe')][_0x4659('0x15d')]=function(_0x5e72d4){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x15e'),_0x5e72d4[_0x4659('0x32')]));if(!this['isConfigured'](_0x5e72d4['findBy'])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x5e72d4,_0x4659('0x15f'));}logger[_0x4659('0x2a')](util[_0x4659('0x53')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4659('0x30')]['callerid'],_0x5e72d4[_0x4659('0x14e')]));var _0xef6a08=this[_0x4659('0x4b')][_0x4659('0x6b')](this,_0x5e72d4[_0x4659('0x160')]);var _0x3123af=this[_0x4659('0x4d')][_0x4659('0x6b')](this,_0x5e72d4[_0x4659('0x14e')],_0xef6a08);if(_0x3123af){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x5e72d4[_0x4659('0x14e')]));this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x5e72d4[_0x4659('0x14e')]));return{'code':0xc8,'result':_0x4659('0x154')};}else{logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x151'),this[_0x4659('0x30')]['callerid'],_0x5e72d4[_0x4659('0x14e')]));this['channel'][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')]['callerid'],_0x5e72d4['findBy']));return{'code':0xc8,'result':_0x4659('0x161')};}};AGIVertices[_0x4659('0xe')][_0x4659('0x162')]=function(_0x5c9f33){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x163'),_0x5c9f33[_0x4659('0x32')]));if(!this['isConfigured'](_0x5c9f33['file_id'])){return this[_0x4659('0x30')]['error'](_0x5c9f33,_0x4659('0x108'));}var _0x235da3=this[_0x4659('0x1b')][_0x4659('0x6b')](this,_0x5c9f33[_0x4659('0x15b')]);if(!_0x235da3){return this['channel']['error'](_0x5c9f33,_0x4659('0x109'));}var _0x31eb82=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0x164'),[_0x235da3,_0x5c9f33['opts']]);if(_0x31eb82[_0x4659('0xa6')]===-0x1){return _0x31eb82;}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('Executed\x20command\x20%s\x20%s',_0x4659('0x164'),_0x235da3));};AGIVertices[_0x4659('0xe')][_0x4659('0x165')]=function(_0x2f8839){logger[_0x4659('0x2a')](util['format'](_0x4659('0x166'),_0x2f8839[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x2f8839[_0x4659('0x167')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2f8839,'no\x20queue\x20selected');}var _0x218f63='';var _0x26e278=parseInt(_0x2f8839[_0x4659('0x167')],0xa);if(isNaN(_0x26e278)){_0x218f63=_0x2f8839[_0x4659('0x167')];}else{_0x218f63=this[_0x4659('0x12')]['sync'](this,_0x2f8839[_0x4659('0x167')]);if(!_0x218f63){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2f8839,'no\x20queue\x20found');}}var _0x4f9bfe='';if(this[_0x4659('0x82')](_0x2f8839[_0x4659('0x15b')])){var _0x58ec45=this['getSound'][_0x4659('0x6b')](this,_0x2f8839[_0x4659('0x15b')]);if(_0x58ec45){_0x4f9bfe=_0x58ec45;}}this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x2f8839,_0x218f63);if(_0x2f8839[_0x4659('0x105')][_0x4659('0x168')]('x')<0x0){_0x2f8839[_0x4659('0x105')]+='x';}if(_0x2f8839[_0x4659('0x105')][_0x4659('0x168')]('X')<0x0){_0x2f8839[_0x4659('0x105')]+='X';}this[_0x4659('0x30')][_0x4659('0x9c')](_0x4659('0x169'),_0x218f63?_0x218f63['toLowerCase']():'');var _0x2c3d5f=this[_0x4659('0x30')][_0x4659('0x55')]('QUEUE',[_0x218f63,_0x2f8839[_0x4659('0x105')],_0x2f8839['url'],_0x4f9bfe,_0x2f8839[_0x4659('0x61')],_0x2f8839[_0x4659('0xb1')],_0x2f8839[_0x4659('0x16a')],_0x2f8839[_0x4659('0x16b')],'',_0x2f8839['position']]);if(_0x2c3d5f[_0x4659('0xa6')]===-0x1){return _0x2c3d5f;}return this['channel'][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xbe'),_0x4659('0x16c'),_0x218f63));};AGIVertices[_0x4659('0xe')][_0x4659('0x16d')]=function(_0x471d5e){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x16e'),_0x471d5e['label']));var _0x4b1f57=_0x471d5e[_0x4659('0x16f')]||'wav';var _0x625efa=util['format'](_0x4659('0x170'),this['channel'][_0x4659('0x31')],rs[_0x4659('0x10f')](0x5));var _0x26b95b=util['format'](_0x4659('0x171'),FILES_PATH,_0x625efa,_0x4b1f57);var _0x319ff0=util[_0x4659('0x53')](_0x4659('0x126'),FILES_PATH,_0x625efa);this[_0x4659('0x36')]['sync'](this,_0x471d5e,_0x625efa,_0x26b95b);this['channel']['setVariable'](_0x4659('0x172'),_0x625efa);logger[_0x4659('0x2a')](_0x4659('0x173'),_0x319ff0,_0x4b1f57,_0x471d5e[_0x4659('0x174')],_0x471d5e[_0x4659('0x61')]);return this[_0x4659('0x30')]['recordFile'](_0x319ff0,_0x4b1f57,_0x471d5e[_0x4659('0x174')],_0x471d5e[_0x4659('0x61')],undefined,!![]);};AGIVertices['prototype'][_0x4659('0x175')]=function(_0x45fdd0){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x176'),_0x45fdd0[_0x4659('0x32')]));if(!this['isConfigured'](_0x45fdd0[_0x4659('0x60')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20url\x20configured');}var _0x2fa155=this['restAPI'][_0x4659('0x6b')](this,_0x45fdd0);logger[_0x4659('0x2a')](util['format'](_0x4659('0x177'),util[_0x4659('0x178')](_0x2fa155,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x45fdd0[_0x4659('0xd5')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x179'));}var _0x49a521=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x45fdd0[_0x4659('0xd5')]);if(!_0x49a521){return this[_0x4659('0x30')]['error'](_0x45fdd0,_0x4659('0xd7'));}this[_0x4659('0x30')][_0x4659('0x9c')](util['format'](_0x4659('0x17a'),_0x49a521),_0x2fa155[_0x4659('0x71')]?_0x2fa155[_0x4659('0x71')]:_0x4659('0x17b'));this[_0x4659('0x30')]['setVariable'](util['format'](_0x4659('0x17c'),_0x49a521),_0x2fa155[_0x4659('0x72')]?_0x2fa155[_0x4659('0x72')]:'OK');if(_0x2fa155['body']){try{this[_0x4659('0x9a')](_0x2fa155[_0x4659('0x6e')],_0x49a521);}catch(_0x1a1602){logger[_0x4659('0x29')](util[_0x4659('0x53')](_0x4659('0x17d'),_0x49a521));}}return this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0xda'),_0x49a521));};AGIVertices[_0x4659('0xe')][_0x4659('0x17e')]=function(_0x4464ca){logger['info'](util[_0x4659('0x53')](_0x4659('0x17f'),_0x4464ca[_0x4659('0x32')]));return this[_0x4659('0x30')][_0x4659('0x180')](_0x4464ca['digits'][_0x4659('0x57')](/\s+/g,''),_0x4464ca[_0x4659('0x174')]);};AGIVertices[_0x4659('0xe')]['saynumber']=function(_0xaa6ed7){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x181'),_0xaa6ed7[_0x4659('0x32')]));return this[_0x4659('0x30')][_0x4659('0x182')](_0xaa6ed7['number'][_0x4659('0x57')](/\s+/g,''),_0xaa6ed7[_0x4659('0x174')]);};AGIVertices['prototype'][_0x4659('0x183')]=function(_0x3cd7ef){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x184'),_0x3cd7ef[_0x4659('0x32')]));return this['channel'][_0x4659('0x185')](_0x3cd7ef[_0x4659('0x5b')],_0x3cd7ef[_0x4659('0x174')]);};AGIVertices[_0x4659('0xe')][_0x4659('0x186')]=function(_0x359d38){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x359d38[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x359d38[_0x4659('0x187')])){return this[_0x4659('0x30')][_0x4659('0xa7')]('no\x20mail\x20account\x20configured');}var _0x3c985b=this[_0x4659('0x1e')][_0x4659('0x6b')](this,_0x359d38[_0x4659('0x187')]);if(!_0x3c985b||!_0x3c985b[_0x4659('0x188')]){return this[_0x4659('0x30')][_0x4659('0x29')](_0x359d38,_0x4659('0x189'));}var _0x473619={'from':util['format'](_0x4659('0x18a'),_0x3c985b[_0x4659('0x10')],_0x3c985b['email']||_0x3c985b[_0x4659('0x188')][_0x4659('0x18b')]),'to':_0x359d38['to']||'','cc':_0x359d38['cc']||'','bcc':_0x359d38[_0x4659('0x18c')]||'','subject':_0x359d38[_0x4659('0x18d')],'html':_0x359d38[_0x4659('0x5b')],'text':_0x359d38[_0x4659('0x5b')]};if(this['isConfigured'](_0x359d38[_0x4659('0x18e')])){}logger[_0x4659('0x18f')]('sendMail\x20message',JSON[_0x4659('0x6f')](_0x473619));this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x359d38,_0x359d38[_0x4659('0x187')]);this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0x190'),_0x3c985b[_0x4659('0x10')]));this[_0x4659('0x20')][_0x4659('0x6b')](this,_0x3c985b[_0x4659('0x191')],_0x473619);return this[_0x4659('0x30')][_0x4659('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4659('0xe')]['sendFax']=function(_0x448e7f){logger['info'](util[_0x4659('0x53')](_0x4659('0x192'),_0x448e7f['label']));return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x193'));};AGIVertices[_0x4659('0xe')]['sendSMS']=function(_0x1ffbf7){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x194'),_0x1ffbf7['label']));if(!this['isConfigured'](_0x1ffbf7['sms_account_id'])){return this['channel'][_0x4659('0xa7')](_0x4659('0x195'));}var _0x49e2e1=this[_0x4659('0x196')][_0x4659('0x6b')](this,_0x1ffbf7[_0x4659('0x197')]);if(!_0x49e2e1){return this[_0x4659('0x30')][_0x4659('0x29')](_0x1ffbf7,_0x4659('0x198'));}var _0x39e70c={'body':_0x1ffbf7[_0x4659('0x199')],'phone':_0x1ffbf7['to']||'','SmsAccountId':_0x49e2e1['id']};logger['debug'](_0x4659('0x19a'),JSON[_0x4659('0x6f')](_0x39e70c));this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x1ffbf7,_0x1ffbf7[_0x4659('0x197')]);this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x49e2e1[_0x4659('0x10')]));this[_0x4659('0x2e')][_0x4659('0x6b')](this,_0x39e70c);return this['channel'][_0x4659('0xa7')](_0x4659('0x19b'));};AGIVertices[_0x4659('0xe')]['set']=function(_0x4cc7e2){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x19c'),_0x4cc7e2[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x4cc7e2[_0x4659('0xd5')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4cc7e2,'no\x20variable\x20selected');}var _0x46d11e=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x4cc7e2[_0x4659('0xd5')]);if(!_0x46d11e){return this['channel'][_0x4659('0x29')](_0x4cc7e2,_0x4659('0xd7'));}return this['channel'][_0x4659('0x9c')](_0x46d11e,_0x4cc7e2[_0x4659('0x19d')]);};AGIVertices['prototype']['start']=function(_0x240315){logger[_0x4659('0x2a')](util[_0x4659('0x53')]('Enter\x20in\x20START\x20(%s)\x20block',_0x240315[_0x4659('0x32')]));this[_0x4659('0x30')][_0x4659('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x240315[_0x4659('0xb4')]===_0x4659('0x19e')){this['channel'][_0x4659('0xa7')]('Answer');return this[_0x4659('0x30')][_0x4659('0xb4')]();}return this[_0x4659('0x30')]['noop'](_0x4659('0x19f'));};AGIVertices['prototype'][_0x4659('0x1a0')]=function(_0x4ef93d){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x1a1'),_0x4ef93d[_0x4659('0x32')]));if(!this[_0x4659('0x82')](_0x4ef93d[_0x4659('0x1a2')])){return this[_0x4659('0x30')][_0x4659('0x29')](_0x4ef93d,_0x4659('0x1a3'));}var _0x3be07b=this[_0x4659('0x14')]['sync'](this,_0x4ef93d['project_id']);if(!this[_0x4659('0x82')](_0x3be07b)){return this['channel'][_0x4659('0x29')](_0x4ef93d,util[_0x4659('0x53')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4ef93d[_0x4659('0x1a2')]));}if(_0x3be07b===this[_0x4659('0x30')][_0x4659('0x34')]){return this[_0x4659('0x30')]['error'](_0x4ef93d,_0x4659('0x1a4'));}this[_0x4659('0x2f')][_0x4659('0x6b')](this,_0x4ef93d,_0x3be07b);var _0x205478=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0x1a5'),util[_0x4659('0x53')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4659('0xb1')][_0x4659('0x1a6')]||_0x4659('0x1a7'),_0x3be07b,this[_0x4659('0x30')][_0x4659('0x34')]));if(_0x205478['result']===-0x1){return _0x205478;}return this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0xbe'),_0x4659('0x1a5'),_0x3be07b));};AGIVertices[_0x4659('0xe')][_0x4659('0x1a8')]=function(_0x5689a3){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x1a9'),_0x5689a3[_0x4659('0x32')]));var _0x255f7d=this['shellCommand'][_0x4659('0x6b')](this,_0x5689a3[_0x4659('0xb3')]);this['createSquareDetailsReport'][_0x4659('0x6b')](this,_0x5689a3,_0x5689a3[_0x4659('0xb3')]);if(this[_0x4659('0x82')](_0x5689a3[_0x4659('0xd5')])){var _0x322566=this[_0x4659('0xf')]['sync'](this,_0x5689a3[_0x4659('0xd5')]);if(_0x322566){this[_0x4659('0x30')]['setVariable'](_0x322566,_0x255f7d);return this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0x1aa'),_0x5689a3[_0x4659('0xb3')],_0x322566));}}return this[_0x4659('0x30')][_0x4659('0xa7')](util['format'](_0x4659('0x1ab'),_0x5689a3[_0x4659('0xb3')]));};AGIVertices[_0x4659('0xe')][_0x4659('0x1ac')]=function(_0x27edfe){logger['info'](util['format'](_0x4659('0x1ad'),_0x27edfe['label']));_0x27edfe[_0x4659('0x5b')]=_0x27edfe[_0x4659('0x5b')][_0x4659('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4659('0x82')](_0x27edfe[_0x4659('0x59')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0x1ae'));}if(!this[_0x4659('0x82')](_0x27edfe[_0x4659('0x5b')])){return this['channel'][_0x4659('0xa7')](_0x4659('0xe3'));}this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x1af'),_0x27edfe[_0x4659('0x5b')]));var _0x440b41=this[_0x4659('0x58')]['sync'](this,_0x27edfe);if(_0x440b41){this[_0x4659('0x30')][_0x4659('0xa7')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x440b41));var _0x3739b3=this['channel'][_0x4659('0x1b0')](_0x440b41);try{fs[_0x4659('0xfc')](_0x440b41+_0x4659('0xfd'));}catch(_0x126e57){logger[_0x4659('0x29')](_0x126e57);}return _0x3739b3;}return this['channel']['error'](_0x27edfe,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4659('0xe')]['tts']=function(_0x257fd7){logger['info'](util[_0x4659('0x53')](_0x4659('0x1b1'),_0x257fd7[_0x4659('0x32')]));_0x257fd7[_0x4659('0x5b')]=_0x257fd7[_0x4659('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4659('0x82')](_0x257fd7[_0x4659('0x5b')])){return this[_0x4659('0x30')][_0x4659('0xa7')](_0x4659('0xe3'));}this[_0x4659('0x30')]['noop'](util['format'](_0x4659('0x1b2'),_0x257fd7[_0x4659('0x5b')]));var _0x3eb010=this[_0x4659('0x5e')]['sync'](this,_0x257fd7);if(_0x3eb010){this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')]('Google\x20TTS\x20%s\x20file\x20created',_0x3eb010));var _0x36fb9b=this[_0x4659('0x30')][_0x4659('0x1b0')](_0x3eb010);try{fs[_0x4659('0xfc')](_0x3eb010+_0x4659('0xfd'));}catch(_0x228023){logger[_0x4659('0x29')](_0x228023);}return _0x36fb9b;}return this[_0x4659('0x30')]['error'](_0x257fd7,_0x4659('0x1b3'));};AGIVertices[_0x4659('0xe')][_0x4659('0x1b4')]=function(_0x334313){logger['info'](util[_0x4659('0x53')](_0x4659('0x1b5'),_0x334313['label']));if(!this[_0x4659('0x82')](_0x334313['findBy'])){return this['channel'][_0x4659('0x29')](_0x334313,'no\x20find\x20by\x20configured');}logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x14f'),this[_0x4659('0x30')][_0x4659('0x35')],_0x334313[_0x4659('0x14e')]));var _0x597141=this['agentUnpause']['sync'](this,_0x334313[_0x4659('0x14e')]);if(_0x597141){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')]['callerid'],_0x334313['findBy']));this[_0x4659('0x30')][_0x4659('0xa7')](util[_0x4659('0x53')](_0x4659('0x150'),this[_0x4659('0x30')][_0x4659('0x35')],_0x334313[_0x4659('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4659('0x2a')](util[_0x4659('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4659('0x30')][_0x4659('0x35')],_0x334313[_0x4659('0x14e')]));this[_0x4659('0x30')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4659('0x30')][_0x4659('0x35')],_0x334313[_0x4659('0x14e')]));return{'code':0xc8,'result':_0x4659('0x161')};}};AGIVertices[_0x4659('0xe')][_0x4659('0x1b6')]=function(_0x519780){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x1b7'),_0x519780[_0x4659('0x32')]));var _0x2f6330=this[_0x4659('0x30')][_0x4659('0x55')](_0x4659('0x1b8'),[_0x519780[_0x4659('0x1b9')],_0x519780['options']]);if(_0x2f6330[_0x4659('0xa6')]===-0x1){return _0x2f6330;}return this[_0x4659('0x30')]['noop'](util[_0x4659('0x53')](_0x4659('0xbe'),_0x4659('0x1b8'),_0x519780[_0x4659('0x1b9')]));};AGIVertices['prototype']['vswitch']=function(_0x2f7d5c){logger[_0x4659('0x2a')](util[_0x4659('0x53')](_0x4659('0x1ba'),_0x2f7d5c['label']));if(!this[_0x4659('0x82')](_0x2f7d5c[_0x4659('0xd5')])){return this['channel'][_0x4659('0x29')](_0x2f7d5c,_0x4659('0x1bb'));}var _0x33186d=this[_0x4659('0xf')][_0x4659('0x6b')](this,_0x2f7d5c[_0x4659('0xd5')]);if(!_0x33186d){return this[_0x4659('0x30')][_0x4659('0x29')](_0x2f7d5c,'no\x20variable\x20found');}var _0x4671b2=this[_0x4659('0x30')][_0x4659('0xf')](_0x33186d);return{'code':0xc8,'result':_0x4671b2[_0x4659('0x9f')]?_0x4671b2['extra']:'-'};};String[_0x4659('0xe')][_0x4659('0x9e')]=function(_0x347aa2,_0x1c538c){return this[_0x4659('0x9d')](_0x347aa2)[_0x4659('0x1bc')](_0x1c538c);};module[_0x4659('0x1bd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3e91497..9fbf380 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 _0xbcd9=['[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','catch','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update'];(function(_0x279b0a,_0x5cc389){var _0x5632cc=function(_0x1e14aa){while(--_0x1e14aa){_0x279b0a['push'](_0x279b0a['shift']());}};_0x5632cc(++_0x5cc389);}(_0xbcd9,0x167));var _0x9bcd=function(_0x5a903c,_0x5aeb10){_0x5a903c=_0x5a903c-0x0;var _0xa1b150=_0xbcd9[_0x5a903c];return _0xa1b150;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var ami=require(_0x9bcd('0x0'));var logger=require('../../../config/logger')(_0x9bcd('0x1'));var RpcUser=require(_0x9bcd('0x2'));var RpcVoiceAgentReport=require(_0x9bcd('0x3'));function Acw(_0x269a55){this[_0x9bcd('0x4')]=_0x269a55[_0x9bcd('0x4')];this[_0x9bcd('0x5')]=_0x269a55['agents'];this[_0x9bcd('0x6')]=_0x269a55[_0x9bcd('0x6')];this[_0x9bcd('0x7')]={};ami['on']('agentconnect',this[_0x9bcd('0x8')][_0x9bcd('0x9')](this));ami['on']('hanguprequest',this[_0x9bcd('0xa')][_0x9bcd('0x9')](this));ami['on'](_0x9bcd('0xb'),this[_0x9bcd('0xc')][_0x9bcd('0x9')](this));ami['on'](_0x9bcd('0xd'),this[_0x9bcd('0xe')][_0x9bcd('0x9')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9bcd('0xf'),this[_0x9bcd('0x10')][_0x9bcd('0x9')](this));ami['on'](_0x9bcd('0x11'),this[_0x9bcd('0x12')][_0x9bcd('0x9')](this));}function getDiff(_0xf78510){var _0x46d532=moment()[_0x9bcd('0x13')](0x0);var _0x2dfe83=moment(_0xf78510)[_0x9bcd('0x13')](0x0);return _0x46d532[_0x9bcd('0x14')](_0x2dfe83,'seconds');}Acw['prototype']['startAcw']=function(_0x9e6562){try{var _0x467e0e=this;var _0x2d6d13=this[_0x9bcd('0x7')][_0x9e6562]['interface'];var _0x413a66=this['channels'][_0x9e6562][_0x9bcd('0x15')];var _0x45872b=this[_0x9bcd('0x4')][_0x413a66];var _0x4dedf2=![];var _0x47055c=_0x9bcd('0x16');if(_0x45872b[_0x9bcd('0x17')]){if(_0x45872b[_0x9bcd('0x18')][_0x9bcd('0x19')]){_0x4dedf2=!![];_0x47055c=_0x45872b[_0x9bcd('0x18')]['name'];}}ami[_0x9bcd('0x1a')]({'action':_0x9bcd('0x1b'),'interface':_0x2d6d13,'paused':!![],'reason':_0x47055c})['then'](function(_0x1a17d5){if(_0x467e0e[_0x9bcd('0x5')][_0x2d6d13]){return RpcUser[_0x9bcd('0x1c')](_0x467e0e[_0x9bcd('0x5')][_0x2d6d13]['id'])[_0x9bcd('0x1d')](function(_0xa49ded){if(_0xa49ded&&!_0xa49ded[_0x9bcd('0x1e')]){logger[_0x9bcd('0x1f')](_0x9bcd('0x20'),_0x9e6562,_0x2d6d13,_0x413a66);var _0x56f3cf=_0x467e0e[_0x9bcd('0x7')][_0x9e6562][_0x9bcd('0x21')]&&_0x467e0e['channels'][_0x9e6562][_0x9bcd('0x22')]?_0x467e0e[_0x9bcd('0x7')][_0x9e6562]['destlinkedid']:_0x9e6562;return RpcUser[_0x9bcd('0x23')](_0x467e0e[_0x9bcd('0x5')][_0x2d6d13],_0x47055c,_0x56f3cf)[_0x9bcd('0x1d')](function(_0x241fd0){if(!_0x4dedf2){_0x467e0e[_0x9bcd('0x6')][_0x2d6d13]={};logger[_0x9bcd('0x1f')](_0x9bcd('0x24'),_0x9e6562,_0x467e0e[_0x9bcd('0x4')][_0x413a66]['acwTimeout'],_0x2d6d13,_0x413a66);_0x467e0e[_0x9bcd('0x6')][_0x2d6d13]['timer']=setTimeout(_0x467e0e[_0x9bcd('0x25')]['bind'](_0x467e0e,_0x2d6d13),_0x467e0e[_0x9bcd('0x4')][_0x413a66][_0x9bcd('0x26')]*0x3e8);_0x467e0e['timers'][_0x2d6d13][_0x9bcd('0x27')]=moment()[_0x9bcd('0x28')](_0x9bcd('0x29'));_0x467e0e['timers'][_0x2d6d13][_0x9bcd('0x2a')]=_0x9e6562;_0x467e0e[_0x9bcd('0x6')][_0x2d6d13][_0x9bcd('0x15')]=_0x413a66;_0x467e0e['timers'][_0x2d6d13][_0x9bcd('0x2b')]=function(){var _0x95ec1f=getDiff(_0x467e0e[_0x9bcd('0x6')][_0x2d6d13][_0x9bcd('0x27')]);clearTimeout(_0x467e0e[_0x9bcd('0x6')][_0x2d6d13][_0x9bcd('0x2c')]);_0x467e0e[_0x9bcd('0x6')][_0x2d6d13][_0x9bcd('0x2c')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x95ec1f},_0x467e0e['timers'][_0x2d6d13][_0x9bcd('0x2a')],_0x2d6d13)[_0x9bcd('0x1d')](function(_0x2637dc){logger[_0x9bcd('0x1f')](_0x9bcd('0x2d'),_0x9e6562,_0x95ec1f,_0x2637dc);})['catch'](function(_0x44eeaf){logger[_0x9bcd('0x2e')](_0x9bcd('0x2f'),_0x9e6562,_0x44eeaf);});delete _0x467e0e[_0x9bcd('0x6')][_0x2d6d13];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x9e6562,_0x2d6d13,_0x413a66);}});}})[_0x9bcd('0x30')](function(_0x61aae6){logger['error'](_0x9bcd('0x24'),_0x9e6562,_0x467e0e['voiceQueues'][_0x413a66]['acwTimeout'],_0x2d6d13,_0x413a66);})[_0x9bcd('0x31')](function(){delete _0x467e0e[_0x9bcd('0x7')][_0x9e6562];});}catch(_0x4fe556){logger[_0x9bcd('0x2e')](_0x9bcd('0x32'),_0x4fe556[_0x9bcd('0x33')]);}};Acw[_0x9bcd('0x34')][_0x9bcd('0x25')]=function(_0x54ea04){try{var _0x47a118=this;if(_0x47a118[_0x9bcd('0x6')][_0x54ea04]){_0x47a118['timers'][_0x54ea04][_0x9bcd('0x2c')]=![];var _0x3eaa08=_0x47a118[_0x9bcd('0x6')][_0x54ea04][_0x9bcd('0x2a')];var _0x126c93=_0x47a118[_0x9bcd('0x6')][_0x54ea04][_0x9bcd('0x15')];var _0x49f0cc=_0x47a118[_0x9bcd('0x4')][_0x126c93][_0x9bcd('0x26')];logger['info'](_0x9bcd('0x35'),_0x3eaa08,_0x54ea04);RpcUser[_0x9bcd('0x36')](this[_0x9bcd('0x5')][_0x54ea04]);RpcVoiceAgentReport[_0x9bcd('0x37')]({'acwtime':_0x49f0cc,'agentacw':!![]},_0x3eaa08,_0x54ea04)[_0x9bcd('0x1d')](function(_0xe4050b){logger[_0x9bcd('0x1f')](_0x9bcd('0x2d'),_0x3eaa08,_0x49f0cc,_0xe4050b);})[_0x9bcd('0x30')](function(_0x363a22){logger[_0x9bcd('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x3eaa08,_0x363a22);});}else{logger['error'](_0x9bcd('0x38'),_0x54ea04);if(_0x47a118['timers']){logger[_0x9bcd('0x1f')]('[ACW][TIMERS]',JSON[_0x9bcd('0x39')](_0x47a118[_0x9bcd('0x6')]));}}}catch(_0x57563b){logger[_0x9bcd('0x2e')](_0x9bcd('0x3a'),_0x57563b['message']);}};Acw['prototype'][_0x9bcd('0x8')]=function(_0x360e17){try{if(this['voiceQueues'][_0x360e17[_0x9bcd('0x15')]]&&(this[_0x9bcd('0x4')][_0x360e17[_0x9bcd('0x15')]]['acw']||this['voiceQueues'][_0x360e17['queue']]['mandatoryDisposition'])){if(this['agents'][_0x360e17[_0x9bcd('0x3b')]]){this[_0x9bcd('0x7')][_0x360e17['uniqueid']]={'queue':_0x360e17[_0x9bcd('0x15')],'interface':_0x360e17['interface'],'destlinkedid':_0x360e17[_0x9bcd('0x22')]};}}}catch(_0xb4a1a){logger['error'](_0x9bcd('0x3c'),_0xb4a1a['message']);}};Acw['prototype'][_0x9bcd('0x12')]=function(_0x505162){try{if(this[_0x9bcd('0x4')][_0x505162['queue']]&&(this[_0x9bcd('0x4')][_0x505162[_0x9bcd('0x15')]]['acw']||this[_0x9bcd('0x4')][_0x505162[_0x9bcd('0x15')]][_0x9bcd('0x17')])){if(this[_0x9bcd('0x5')][_0x505162['interface']]){this[_0x9bcd('0x7')][_0x505162[_0x9bcd('0x2a')]]={'queue':_0x505162['queue'],'interface':_0x505162['interface']};}}}catch(_0x266b8c){logger[_0x9bcd('0x2e')](_0x9bcd('0x3d'),_0x266b8c['message']);}};Acw[_0x9bcd('0x34')]['syncHangupRequest']=function(_0x1948b7){try{if(this[_0x9bcd('0x7')][_0x1948b7[_0x9bcd('0x2a')]]&&_[_0x9bcd('0x3e')](this[_0x9bcd('0x7')][_0x1948b7[_0x9bcd('0x2a')]][_0x9bcd('0x21')])){logger[_0x9bcd('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x1948b7[_0x9bcd('0x2a')]);this[_0x9bcd('0x3f')](_0x1948b7[_0x9bcd('0x2a')]);}else if(this['channels'][_0x1948b7[_0x9bcd('0x40')]]&&_['isUndefined'](this[_0x9bcd('0x7')][_0x1948b7[_0x9bcd('0x40')]]['attended'])){logger[_0x9bcd('0x1f')](_0x9bcd('0x41'),_0x1948b7[_0x9bcd('0x40')]);this[_0x9bcd('0x3f')](_0x1948b7[_0x9bcd('0x40')]);}}catch(_0x5bf36a){logger[_0x9bcd('0x2e')](_0x9bcd('0x42'),_0x5bf36a[_0x9bcd('0x33')]);}};Acw[_0x9bcd('0x34')][_0x9bcd('0xc')]=function(_0x326fd3){try{if(this[_0x9bcd('0x7')][_0x326fd3[_0x9bcd('0x2a')]]&&this[_0x9bcd('0x7')][_0x326fd3[_0x9bcd('0x2a')]][_0x9bcd('0x21')]){logger[_0x9bcd('0x1f')](_0x9bcd('0x43'),_0x326fd3[_0x9bcd('0x2a')]);this[_0x9bcd('0x3f')](_0x326fd3[_0x9bcd('0x2a')]);}else if(this[_0x9bcd('0x7')][_0x326fd3[_0x9bcd('0x40')]]&&this[_0x9bcd('0x7')][_0x326fd3[_0x9bcd('0x40')]][_0x9bcd('0x21')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x326fd3[_0x9bcd('0x40')]);this[_0x9bcd('0x3f')](_0x326fd3[_0x9bcd('0x40')]);}}catch(_0x15f3be){logger[_0x9bcd('0x2e')](_0x9bcd('0x44'),_0x15f3be['message']);}};Acw[_0x9bcd('0x34')][_0x9bcd('0x45')]=function(_0xd67a39){try{if(!_['isNil'](this[_0x9bcd('0x7')][_0xd67a39['transfereeuniqueid']])){this[_0x9bcd('0x3f')](_0xd67a39[_0x9bcd('0x46')]);if(this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x47')]]){this['channels'][_0xd67a39['secondtransfereruniqueid']][_0x9bcd('0x21')]=!![];this['channels'][_0xd67a39[_0x9bcd('0x48')]]=this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x47')]];delete this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x47')]];}}else if(!_['isNil'](this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x48')]])){this[_0x9bcd('0x3f')](_0xd67a39[_0x9bcd('0x48')]);if(this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x49')]]){this[_0x9bcd('0x7')][_0xd67a39[_0x9bcd('0x49')]][_0x9bcd('0x21')]=!![];this['channels'][_0xd67a39[_0x9bcd('0x46')]]=this['channels'][_0xd67a39[_0x9bcd('0x49')]];delete this[_0x9bcd('0x7')][_0xd67a39['origtransfereruniqueid']];}}}catch(_0x19be88){logger[_0x9bcd('0x2e')]('[ACW][syncAttendedTransfer]\x20%s',_0x19be88['message']);}};Acw['prototype'][_0x9bcd('0x10')]=function(_0x138945){try{if(this[_0x9bcd('0x7')][_0x138945['transfereruniqueid']]){logger[_0x9bcd('0x1f')](_0x9bcd('0x4a'),JSON[_0x9bcd('0x39')](_0x138945[_0x9bcd('0x4b')]));this[_0x9bcd('0x3f')](_0x138945['transfereruniqueid']);}else if(this['channels'][_0x138945['transfererlinkedid']]){logger[_0x9bcd('0x1f')](_0x9bcd('0x4c'),JSON[_0x9bcd('0x39')](_0x138945[_0x9bcd('0x4d')]));this[_0x9bcd('0x3f')](_0x138945[_0x9bcd('0x4d')]);}}catch(_0x1b213b){logger[_0x9bcd('0x2e')](_0x9bcd('0x4e'),_0x1b213b[_0x9bcd('0x33')]);}};Acw[_0x9bcd('0x34')]['syncAgentRingNoAnswer']=function(_0x527e5b){try{if(this[_0x9bcd('0x4')][_0x527e5b[_0x9bcd('0x15')]]&&this[_0x9bcd('0x4')][_0x527e5b[_0x9bcd('0x15')]]['autopause']==='all'){if(this[_0x9bcd('0x5')][_0x527e5b[_0x9bcd('0x3b')]]){logger[_0x9bcd('0x1f')](_0x9bcd('0x4f'),_0x527e5b[_0x9bcd('0x2a')],_0x527e5b[_0x9bcd('0x3b')],_0x527e5b[_0x9bcd('0x15')]);return RpcUser['savePause'](this[_0x9bcd('0x5')][_0x527e5b[_0x9bcd('0x3b')]],_0x9bcd('0x50'),_0x527e5b[_0x9bcd('0x2a')]);}}}catch(_0x422dc7){logger[_0x9bcd('0x2e')](_0x9bcd('0x51'),_0x422dc7[_0x9bcd('0x33')]);}};module[_0x9bcd('0x52')]=Acw; \ No newline at end of file +var _0x6058=['attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','then','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6058,0x98));var _0x8605=function(_0x1a4cfc,_0x53a1af){_0x1a4cfc=_0x1a4cfc-0x0;var _0x1bb003=_0x6058[_0x1a4cfc];return _0x1bb003;};'use strict';var util=require(_0x8605('0x0'));var _=require('lodash');var moment=require(_0x8605('0x1'));var ami=require(_0x8605('0x2'));var logger=require(_0x8605('0x3'))(_0x8605('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x8605('0x5'));function Acw(_0x48fd30){this[_0x8605('0x6')]=_0x48fd30['voiceQueues'];this[_0x8605('0x7')]=_0x48fd30[_0x8605('0x7')];this[_0x8605('0x8')]=_0x48fd30['timers'];this[_0x8605('0x9')]={};ami['on'](_0x8605('0xa'),this['syncAgentConnect'][_0x8605('0xb')](this));ami['on'](_0x8605('0xc'),this[_0x8605('0xd')]['bind'](this));ami['on']('hangup',this[_0x8605('0xe')]['bind'](this));ami['on'](_0x8605('0xf'),this['syncAgentRingNoAnswer'][_0x8605('0xb')](this));ami['on'](_0x8605('0x10'),this[_0x8605('0x11')][_0x8605('0xb')](this));ami['on']('blindtransfer',this[_0x8605('0x12')][_0x8605('0xb')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x20aa00){var _0x432b0e=moment()[_0x8605('0x13')](0x0);var _0x54c662=moment(_0x20aa00)[_0x8605('0x13')](0x0);return _0x432b0e[_0x8605('0x14')](_0x54c662,_0x8605('0x15'));}Acw[_0x8605('0x16')][_0x8605('0x17')]=function(_0x39e5e0){try{var _0x310f0f=this;var _0x5d722c=this['channels'][_0x39e5e0][_0x8605('0x18')];var _0x6f385b=this[_0x8605('0x9')][_0x39e5e0][_0x8605('0x19')];var _0x4b9102=this[_0x8605('0x6')][_0x6f385b];var _0x10a1e6=![];var _0x5a2c2e=_0x8605('0x1a');if(_0x4b9102[_0x8605('0x1b')]){if(_0x4b9102[_0x8605('0x1c')][_0x8605('0x1d')]){_0x10a1e6=!![];_0x5a2c2e=_0x4b9102[_0x8605('0x1c')]['name'];}}ami[_0x8605('0x1e')]({'action':_0x8605('0x1f'),'interface':_0x5d722c,'paused':!![],'reason':_0x5a2c2e})['then'](function(_0x2aff09){if(_0x310f0f[_0x8605('0x7')][_0x5d722c]){return RpcUser[_0x8605('0x20')](_0x310f0f[_0x8605('0x7')][_0x5d722c]['id'])['then'](function(_0x2493ca){if(_0x2493ca&&!_0x2493ca[_0x8605('0x21')]){logger[_0x8605('0x22')](_0x8605('0x23'),_0x39e5e0,_0x5d722c,_0x6f385b);var _0x4dca44=_0x310f0f[_0x8605('0x9')][_0x39e5e0][_0x8605('0x24')]&&_0x310f0f[_0x8605('0x9')][_0x39e5e0][_0x8605('0x25')]?_0x310f0f[_0x8605('0x9')][_0x39e5e0][_0x8605('0x25')]:_0x39e5e0;return RpcUser['savePause'](_0x310f0f['agents'][_0x5d722c],_0x5a2c2e,_0x4dca44)['then'](function(_0x51c8e1){if(!_0x10a1e6){_0x310f0f['timers'][_0x5d722c]={};logger[_0x8605('0x22')](_0x8605('0x26'),_0x39e5e0,_0x310f0f[_0x8605('0x6')][_0x6f385b][_0x8605('0x27')],_0x5d722c,_0x6f385b);_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x28')]=setTimeout(_0x310f0f[_0x8605('0x29')][_0x8605('0xb')](_0x310f0f,_0x5d722c),_0x310f0f['voiceQueues'][_0x6f385b]['acwTimeout']*0x3e8);_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x2a')]=moment()[_0x8605('0x2b')](_0x8605('0x2c'));_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x2d')]=_0x39e5e0;_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x19')]=_0x6f385b;_0x310f0f[_0x8605('0x8')][_0x5d722c]['updateAcw']=function(){var _0x4bfab1=getDiff(_0x310f0f['timers'][_0x5d722c][_0x8605('0x2a')]);clearTimeout(_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x28')]);_0x310f0f['timers'][_0x5d722c][_0x8605('0x28')]=![];RpcVoiceAgentReport[_0x8605('0x2e')]({'acwtime':_0x4bfab1},_0x310f0f[_0x8605('0x8')][_0x5d722c][_0x8605('0x2d')],_0x5d722c)[_0x8605('0x2f')](function(_0x29e6ac){logger[_0x8605('0x22')](_0x8605('0x30'),_0x39e5e0,_0x4bfab1,_0x29e6ac);})[_0x8605('0x31')](function(_0x9a8949){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x39e5e0,_0x9a8949);});delete _0x310f0f[_0x8605('0x8')][_0x5d722c];};}});}else{logger[_0x8605('0x22')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x39e5e0,_0x5d722c,_0x6f385b);}});}})[_0x8605('0x31')](function(_0x14e432){logger[_0x8605('0x32')](_0x8605('0x26'),_0x39e5e0,_0x310f0f['voiceQueues'][_0x6f385b][_0x8605('0x27')],_0x5d722c,_0x6f385b);})[_0x8605('0x33')](function(){delete _0x310f0f['channels'][_0x39e5e0];});}catch(_0x3a23ef){logger[_0x8605('0x32')]('[ACW][START]\x20%s',_0x3a23ef[_0x8605('0x34')]);}};Acw[_0x8605('0x16')][_0x8605('0x29')]=function(_0x323705){try{var _0x2cad05=this;if(_0x2cad05[_0x8605('0x8')][_0x323705]){_0x2cad05[_0x8605('0x8')][_0x323705][_0x8605('0x28')]=![];var _0x332c7c=_0x2cad05[_0x8605('0x8')][_0x323705][_0x8605('0x2d')];var _0x20d3f1=_0x2cad05[_0x8605('0x8')][_0x323705][_0x8605('0x19')];var _0x431f4c=_0x2cad05['voiceQueues'][_0x20d3f1][_0x8605('0x27')];logger['info'](_0x8605('0x35'),_0x332c7c,_0x323705);RpcUser[_0x8605('0x36')](this[_0x8605('0x7')][_0x323705]);RpcVoiceAgentReport[_0x8605('0x2e')]({'acwtime':_0x431f4c,'agentacw':!![]},_0x332c7c,_0x323705)[_0x8605('0x2f')](function(_0x9ec685){logger[_0x8605('0x22')](_0x8605('0x30'),_0x332c7c,_0x431f4c,_0x9ec685);})[_0x8605('0x31')](function(_0x5a14ca){logger[_0x8605('0x32')](_0x8605('0x37'),_0x332c7c,_0x5a14ca);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x323705);if(_0x2cad05[_0x8605('0x8')]){logger[_0x8605('0x22')](_0x8605('0x38'),JSON[_0x8605('0x39')](_0x2cad05[_0x8605('0x8')]));}}}catch(_0x2d169d){logger[_0x8605('0x32')](_0x8605('0x3a'),_0x2d169d[_0x8605('0x34')]);}};Acw['prototype'][_0x8605('0x3b')]=function(_0x20b2f7){try{if(this[_0x8605('0x6')][_0x20b2f7[_0x8605('0x19')]]&&(this['voiceQueues'][_0x20b2f7[_0x8605('0x19')]][_0x8605('0x4')]||this[_0x8605('0x6')][_0x20b2f7['queue']][_0x8605('0x1b')])){if(this[_0x8605('0x7')][_0x20b2f7['interface']]){this[_0x8605('0x9')][_0x20b2f7[_0x8605('0x2d')]]={'queue':_0x20b2f7['queue'],'interface':_0x20b2f7[_0x8605('0x18')],'destlinkedid':_0x20b2f7['destlinkedid']};}}}catch(_0x34e8eb){logger[_0x8605('0x32')](_0x8605('0x3c'),_0x34e8eb['message']);}};Acw['prototype'][_0x8605('0x3d')]=function(_0x1333c4){try{if(this[_0x8605('0x6')][_0x1333c4[_0x8605('0x19')]]&&(this[_0x8605('0x6')][_0x1333c4[_0x8605('0x19')]]['acw']||this[_0x8605('0x6')][_0x1333c4['queue']][_0x8605('0x1b')])){if(this[_0x8605('0x7')][_0x1333c4['interface']]){this[_0x8605('0x9')][_0x1333c4[_0x8605('0x2d')]]={'queue':_0x1333c4['queue'],'interface':_0x1333c4[_0x8605('0x18')]};}}}catch(_0x14762d){logger[_0x8605('0x32')](_0x8605('0x3e'),_0x14762d[_0x8605('0x34')]);}};Acw[_0x8605('0x16')][_0x8605('0xd')]=function(_0xa18478){try{if(this['channels'][_0xa18478[_0x8605('0x2d')]]&&_[_0x8605('0x3f')](this[_0x8605('0x9')][_0xa18478[_0x8605('0x2d')]]['attended'])){logger[_0x8605('0x22')]('[%s][HANGUP:UNIQUEID]',_0xa18478['uniqueid']);this['startAcw'](_0xa18478[_0x8605('0x2d')]);}else if(this['channels'][_0xa18478[_0x8605('0x40')]]&&_[_0x8605('0x3f')](this[_0x8605('0x9')][_0xa18478[_0x8605('0x40')]][_0x8605('0x24')])){logger[_0x8605('0x22')]('[%s][HANGUP:LINKEDID]',_0xa18478[_0x8605('0x40')]);this[_0x8605('0x17')](_0xa18478['linkedid']);}}catch(_0x58d0f2){logger[_0x8605('0x32')](_0x8605('0x41'),_0x58d0f2[_0x8605('0x34')]);}};Acw['prototype'][_0x8605('0xe')]=function(_0x1acbc5){try{if(this['channels'][_0x1acbc5['uniqueid']]&&this['channels'][_0x1acbc5[_0x8605('0x2d')]][_0x8605('0x24')]){logger[_0x8605('0x22')](_0x8605('0x42'),_0x1acbc5[_0x8605('0x2d')]);this['startAcw'](_0x1acbc5[_0x8605('0x2d')]);}else if(this[_0x8605('0x9')][_0x1acbc5['linkedid']]&&this['channels'][_0x1acbc5[_0x8605('0x40')]][_0x8605('0x24')]){logger[_0x8605('0x22')](_0x8605('0x43'),_0x1acbc5['linkedid']);this['startAcw'](_0x1acbc5[_0x8605('0x40')]);}}catch(_0x283395){logger['error'](_0x8605('0x44'),_0x283395[_0x8605('0x34')]);}};Acw[_0x8605('0x16')][_0x8605('0x11')]=function(_0x17eea1){try{if(!_[_0x8605('0x45')](this['channels'][_0x17eea1[_0x8605('0x46')]])){this[_0x8605('0x17')](_0x17eea1[_0x8605('0x46')]);if(this[_0x8605('0x9')][_0x17eea1[_0x8605('0x47')]]){this[_0x8605('0x9')][_0x17eea1[_0x8605('0x47')]][_0x8605('0x24')]=!![];this[_0x8605('0x9')][_0x17eea1['transfertargetuniqueid']]=this[_0x8605('0x9')][_0x17eea1['secondtransfereruniqueid']];delete this['channels'][_0x17eea1[_0x8605('0x47')]];}}else if(!_[_0x8605('0x45')](this[_0x8605('0x9')][_0x17eea1[_0x8605('0x48')]])){this[_0x8605('0x17')](_0x17eea1[_0x8605('0x48')]);if(this[_0x8605('0x9')][_0x17eea1['origtransfereruniqueid']]){this[_0x8605('0x9')][_0x17eea1['origtransfereruniqueid']][_0x8605('0x24')]=!![];this[_0x8605('0x9')][_0x17eea1[_0x8605('0x46')]]=this['channels'][_0x17eea1[_0x8605('0x49')]];delete this['channels'][_0x17eea1[_0x8605('0x49')]];}}}catch(_0x484b4a){logger[_0x8605('0x32')](_0x8605('0x4a'),_0x484b4a[_0x8605('0x34')]);}};Acw[_0x8605('0x16')][_0x8605('0x12')]=function(_0x30ed1b){try{if(this[_0x8605('0x9')][_0x30ed1b[_0x8605('0x4b')]]){logger[_0x8605('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x8605('0x39')](_0x30ed1b[_0x8605('0x4b')]));this[_0x8605('0x17')](_0x30ed1b[_0x8605('0x4b')]);}else if(this[_0x8605('0x9')][_0x30ed1b[_0x8605('0x4c')]]){logger[_0x8605('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x8605('0x39')](_0x30ed1b[_0x8605('0x4c')]));this[_0x8605('0x17')](_0x30ed1b[_0x8605('0x4c')]);}}catch(_0xb7166b){logger[_0x8605('0x32')](_0x8605('0x4d'),_0xb7166b['message']);}};Acw[_0x8605('0x16')][_0x8605('0x4e')]=function(_0xe4aab1){try{if(this[_0x8605('0x6')][_0xe4aab1['queue']]&&this['voiceQueues'][_0xe4aab1[_0x8605('0x19')]][_0x8605('0x4f')]==='all'){if(this[_0x8605('0x7')][_0xe4aab1[_0x8605('0x18')]]){logger[_0x8605('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xe4aab1[_0x8605('0x2d')],_0xe4aab1['interface'],_0xe4aab1['queue']);return RpcUser[_0x8605('0x50')](this[_0x8605('0x7')][_0xe4aab1[_0x8605('0x18')]],_0x8605('0x51'),_0xe4aab1[_0x8605('0x2d')]);}}}catch(_0x2f4ec7){logger['error'](_0x8605('0x52'),_0x2f4ec7[_0x8605('0x34')]);}};module[_0x8605('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b37c495..7d29f89 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 _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(_0x465186,_0x19bdc6){var _0x64bdd=function(_0x888da9){while(--_0x888da9){_0x465186['push'](_0x465186['shift']());}};_0x64bdd(++_0x19bdc6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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 +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s'];(function(_0x5abd5c,_0x56c1fc){var _0x452d72=function(_0x57ca01){while(--_0x57ca01){_0x5abd5c['push'](_0x5abd5c['shift']());}};_0x452d72(++_0x56c1fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xb7e7[_0x50aa2e];return _0x5e07f0;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9fc0ee9..c7982ba 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xac4a,0x13f));var _0xaac4=function(_0xbbc72f,_0x338d52){_0xbbc72f=_0xbbc72f-0x0;var _0x3dcbe8=_0xac4a[_0xbbc72f];return _0x3dcbe8;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xe706,0xa3));var _0x6e70=function(_0x2377e3,_0x2c0352){_0x2377e3=_0x2377e3-0x0;var _0x2a6d1b=_0xe706[_0x2377e3];return _0x2a6d1b;};'use strict';var jayson=require(_0x6e70('0x0'));var BPromise=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('ami');var client=jayson[_0x6e70('0x3')][_0x6e70('0x4')]({'port':0x2329});client[_0x6e70('0x5')]=function(_0x7dfbc3,_0x142c27){return new BPromise(function(_0x2164a4,_0x376a8d){return client[_0x6e70('0x6')](_0x7dfbc3,_0x142c27)[_0x6e70('0x7')](function(_0x4381d1){logger[_0x6e70('0x8')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x142c27,_0x4381d1);if(_0x4381d1[_0x6e70('0xb')]){logger[_0x6e70('0xb')](_0x6e70('0x9'),_0x6e70('0xa'),_0x7dfbc3,_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')],_0x142c27);return _0x376a8d(_0x4381d1[_0x6e70('0xb')][_0x6e70('0xc')]);}else{return _0x2164a4(_0x4381d1[_0x6e70('0xd')]);}})[_0x6e70('0xe')](function(_0x4600f9){logger['error']('rpc',_0x6e70('0xa'),_0x7dfbc3,_0x4600f9,_0x142c27);return _0x376a8d(_0x4600f9);});});};module[_0x6e70('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index fb1b9aa..fb3b01d 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 _0xf600=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','name','dialCutDigit','number','substring','getQueue','exports','util','lodash','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','active','type','dialQueueTimeout','scheduledat','countbusyretry'];(function(_0x3428a8,_0x4859c7){var _0x538873=function(_0x4ef089){while(--_0x4ef089){_0x3428a8['push'](_0x3428a8['shift']());}};_0x538873(++_0x4859c7);}(_0xf600,0x196));var _0x0f60=function(_0x49ef66,_0x312668){_0x49ef66=_0x49ef66-0x0;var _0x2407ed=_0xf600[_0x49ef66];return _0x2407ed;};'use strict';var util=require(_0x0f60('0x0'));var _=require(_0x0f60('0x1'));var moment=require('moment');function checkNameSurname(_0x436c0d,_0x33aba8,_0xa26e61){var _0x30dc8a='';if(!_['isNil'](_0x33aba8)&&_0x0f60('0x2')===typeof _0x33aba8){_0x30dc8a+=_0x33aba8;}if(!_['isNil'](_0xa26e61)&&'string'===typeof _0xa26e61){_0x30dc8a+='\x20'+_0xa26e61;}if(_0x30dc8a!==''){return _0x30dc8a;}return _0x436c0d;}function Action(_0x31d11c,_0x127d68,_0x35ca69){this[_0x0f60('0x3')]=_0x31d11c;this[_0x0f60('0x4')]=_0x35ca69||undefined;this['name']=checkNameSurname(_0x127d68[_0x0f60('0x5')][_0x0f60('0x6')],_0x127d68['Contact'][_0x0f60('0x7')],_0x127d68['Contact'][_0x0f60('0x8')]);this['number']=_0x127d68[_0x0f60('0x6')];this['queue']=_0x31d11c['name'];this[_0x0f60('0x9')]=_0x127d68[_0x0f60('0x9')]||![];this[_0x0f60('0xa')]=_0x31d11c[_0x0f60('0xa')];this[_0x0f60('0xb')]=_0x31d11c['dialQueueTimeout']||0x3;this[_0x0f60('0xc')]=_0x127d68[_0x0f60('0xc')];this[_0x0f60('0xd')]=_0x127d68[_0x0f60('0xd')];this[_0x0f60('0xe')]=_0x127d68['countcongestionretry'];this[_0x0f60('0xf')]=_0x127d68[_0x0f60('0xf')];this[_0x0f60('0x10')]=_0x127d68[_0x0f60('0x10')];this[_0x0f60('0x11')]=_0x127d68[_0x0f60('0x11')];this['countabandonedretry']=_0x127d68['countabandonedretry'];this[_0x0f60('0x12')]=_0x127d68[_0x0f60('0x12')];this['countagentrejectretry']=_0x127d68[_0x0f60('0x13')];this[_0x0f60('0x14')]=_0x127d68['ContactId'];this[_0x0f60('0x15')]=_0x127d68[_0x0f60('0x15')];this[_0x0f60('0x16')]=_0x127d68[_0x0f60('0x16')];this[_0x0f60('0x17')]=_0x127d68[_0x0f60('0x17')];this[_0x0f60('0x18')]=_0x127d68[_0x0f60('0x18')];this['idHopper']=_0x127d68['id'];this['ContactFirstName']=_0x127d68[_0x0f60('0x5')]['firstName']||'';this[_0x0f60('0x19')]=moment()[_0x0f60('0x1a')](_0x0f60('0x1b'));this[_0x0f60('0x1c')]=_0x127d68[_0x0f60('0x1c')];this[_0x0f60('0x1d')]=_0x127d68[_0x0f60('0x1d')];this[_0x0f60('0x1e')]=_0x127d68[_0x0f60('0x1e')];this[_0x0f60('0x1f')]=_0x127d68[_0x0f60('0x1f')];this[_0x0f60('0x20')]='';this[_0x0f60('0x21')]='';}Action[_0x0f60('0x22')][_0x0f60('0x23')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x0f60('0x24')],this[_0x0f60('0x3')][_0x0f60('0x25')]>0x0?this[_0x0f60('0x26')][_0x0f60('0x27')](this[_0x0f60('0x3')]['dialCutDigit']):this[_0x0f60('0x26')]);};Action[_0x0f60('0x22')][_0x0f60('0x28')]=function(){return this['queue'];};module[_0x0f60('0x29')]=Action; \ No newline at end of file +var _0x34ee=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','util','lodash','isNil','string','voiceQueue','name','Contact','phone','firstName','lastName','number','queue','active','type'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0x34ee,0x1b4));var _0xe34e=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x34ee[_0x5d6e30];return _0x3d3f3b;};'use strict';var util=require(_0xe34e('0x0'));var _=require(_0xe34e('0x1'));var moment=require('moment');function checkNameSurname(_0x3df5c0,_0x483e85,_0x220b4d){var _0x37c1d4='';if(!_[_0xe34e('0x2')](_0x483e85)&&_0xe34e('0x3')===typeof _0x483e85){_0x37c1d4+=_0x483e85;}if(!_['isNil'](_0x220b4d)&&_0xe34e('0x3')===typeof _0x220b4d){_0x37c1d4+='\x20'+_0x220b4d;}if(_0x37c1d4!==''){return _0x37c1d4;}return _0x3df5c0;}function Action(_0x4a1b71,_0x53e00d,_0x7ee4f9){this[_0xe34e('0x4')]=_0x4a1b71;this['uniqueid']=_0x7ee4f9||undefined;this[_0xe34e('0x5')]=checkNameSurname(_0x53e00d[_0xe34e('0x6')][_0xe34e('0x7')],_0x53e00d['Contact'][_0xe34e('0x8')],_0x53e00d['Contact'][_0xe34e('0x9')]);this[_0xe34e('0xa')]=_0x53e00d['phone'];this[_0xe34e('0xb')]=_0x4a1b71[_0xe34e('0x5')];this[_0xe34e('0xc')]=_0x53e00d[_0xe34e('0xc')]||![];this[_0xe34e('0xd')]=_0x4a1b71[_0xe34e('0xd')];this['dialQueueTimeout']=_0x4a1b71[_0xe34e('0xe')]||0x3;this[_0xe34e('0xf')]=_0x53e00d[_0xe34e('0xf')];this[_0xe34e('0x10')]=_0x53e00d[_0xe34e('0x10')];this[_0xe34e('0x11')]=_0x53e00d['countcongestionretry'];this[_0xe34e('0x12')]=_0x53e00d[_0xe34e('0x12')];this[_0xe34e('0x13')]=_0x53e00d[_0xe34e('0x13')];this[_0xe34e('0x14')]=_0x53e00d[_0xe34e('0x14')];this['countabandonedretry']=_0x53e00d[_0xe34e('0x15')];this[_0xe34e('0x16')]=_0x53e00d['countmachineretry'];this[_0xe34e('0x17')]=_0x53e00d[_0xe34e('0x17')];this[_0xe34e('0x18')]=_0x53e00d['ContactId'];this['ListId']=_0x53e00d[_0xe34e('0x19')];this[_0xe34e('0x1a')]=_0x53e00d[_0xe34e('0x1a')];this[_0xe34e('0x1b')]=_0x53e00d[_0xe34e('0x1b')];this[_0xe34e('0x1c')]=_0x53e00d[_0xe34e('0x1c')];this[_0xe34e('0x1d')]=_0x53e00d['id'];this['ContactFirstName']=_0x53e00d[_0xe34e('0x6')][_0xe34e('0x8')]||'';this[_0xe34e('0x1e')]=moment()[_0xe34e('0x1f')](_0xe34e('0x20'));this[_0xe34e('0x21')]=_0x53e00d[_0xe34e('0x21')];this[_0xe34e('0x22')]=_0x53e00d[_0xe34e('0x22')];this[_0xe34e('0x23')]=_0x53e00d[_0xe34e('0x23')];this[_0xe34e('0x24')]=_0x53e00d['recallme'];this[_0xe34e('0x25')]='';this[_0xe34e('0x26')]='';}Action['prototype'][_0xe34e('0x27')]=function(){return util['format'](_0xe34e('0x28'),this['name'],this[_0xe34e('0x4')][_0xe34e('0x29')]>0x0?this[_0xe34e('0xa')][_0xe34e('0x2a')](this[_0xe34e('0x4')]['dialCutDigit']):this[_0xe34e('0xa')]);};Action[_0xe34e('0x2b')][_0xe34e('0x2c')]=function(){return this[_0xe34e('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9ccfbbb..05b59f6 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 _0x1258=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1258,0x1bc));var _0x8125=function(_0x45eb7d,_0x56d108){_0x45eb7d=_0x45eb7d-0x0;var _0x4fdb26=_0x1258[_0x45eb7d];return _0x4fdb26;};'use strict';var util=require(_0x8125('0x0'));var _=require('lodash');var moment=require(_0x8125('0x1'));function getSeconds(_0x55ca8e,_0xcc407d){var _0x5bc3fc=moment(_0x55ca8e)[_0x8125('0x2')](0x0);var _0x5242d0=moment(_0xcc407d)[_0x8125('0x2')](0x0);return _0x5bc3fc[_0x8125('0x3')](_0x5242d0,_0x8125('0x4'));}function AgentComplete(_0x69789b,_0x33af61){this[_0x8125('0x5')]=0x4;this[_0x8125('0x6')]=_0x8125('0x7');this['scheduledat']=_0x69789b[_0x8125('0x8')];this['type']=_0x69789b[_0x8125('0x9')];this[_0x8125('0xa')]=_0x69789b[_0x8125('0x9')]===_0x8125('0xb')?'queue':_0x69789b[_0x8125('0x9')];this[_0x8125('0xc')]=_0x69789b[_0x8125('0xc')];this[_0x8125('0xd')]=_0x69789b[_0x8125('0xd')];this[_0x8125('0xe')]=_0x69789b[_0x8125('0xe')];this[_0x8125('0xf')]=_0x69789b[_0x8125('0xc')]+_0x69789b['countcongestionretry']+_0x69789b['countnoanswerretry']+_0x69789b[_0x8125('0x10')]+_0x69789b[_0x8125('0x11')]+_0x69789b[_0x8125('0x12')]+_0x69789b[_0x8125('0x13')]+_0x69789b[_0x8125('0x14')];this[_0x8125('0x10')]=_0x69789b[_0x8125('0x10')];this['countdropretry']=_0x69789b[_0x8125('0x11')];this[_0x8125('0x12')]=_0x69789b[_0x8125('0x12')];this[_0x8125('0x13')]=_0x69789b[_0x8125('0x13')];this[_0x8125('0x14')]=_0x69789b[_0x8125('0x14')];this['uniqueid']=_0x33af61[_0x8125('0x15')];this[_0x8125('0x16')]=_0x69789b[_0x8125('0x17')];this[_0x8125('0x18')]=_0x69789b[_0x8125('0x19')];this[_0x8125('0x1a')]=_0x69789b[_0x8125('0x1a')];this[_0x8125('0x1b')]=_0x69789b[_0x8125('0x1b')];this[_0x8125('0x1c')]=_0x69789b[_0x8125('0x1c')];this[_0x8125('0x1d')]=moment()['format'](_0x8125('0x1e'));this[_0x8125('0x1f')]=getSeconds(_0x69789b['responsetime'],_0x69789b[_0x8125('0x1a')]);this[_0x8125('0x20')]=getSeconds(_0x69789b[_0x8125('0x1c')],_0x69789b['responsetime']);this[_0x8125('0x21')]=getSeconds(this['endtime'],_0x69789b[_0x8125('0x1c')]);this[_0x8125('0x22')]=_0x33af61[_0x8125('0x22')];this[_0x8125('0x23')]=_0x33af61[_0x8125('0x23')];this['reason']=_0x33af61[_0x8125('0x24')];this[_0x8125('0x25')]=_0x69789b['callback'];this[_0x8125('0x26')]=_0x69789b[_0x8125('0x26')];this['callbackat']=_0x69789b['callbackat'];this['recallme']=_0x69789b[_0x8125('0x27')];this[_0x8125('0x28')]=_0x69789b[_0x8125('0x28')];this[_0x8125('0x29')]=_0x69789b[_0x8125('0x29')];this[_0x8125('0x2a')]=_0x69789b[_0x8125('0x2a')];this[_0x8125('0x2b')]=_0x69789b[_0x8125('0x2b')];this[_0x8125('0x2c')]=_0x69789b[_0x8125('0x2c')];this[_0x8125('0x2d')]=_0x69789b[_0x8125('0x2d')]||'';this['originatecalleridname']=_0x69789b[_0x8125('0x2e')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x8b7e=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x8b7e,0x1c2));var _0xe8b7=function(_0x4dff63,_0x3e4244){_0x4dff63=_0x4dff63-0x0;var _0x1cea0d=_0x8b7e[_0x4dff63];return _0x1cea0d;};'use strict';var util=require(_0xe8b7('0x0'));var _=require(_0xe8b7('0x1'));var moment=require(_0xe8b7('0x2'));function getSeconds(_0xadb69e,_0x1d1e30){var _0x179083=moment(_0xadb69e)['milliseconds'](0x0);var _0x28c356=moment(_0x1d1e30)[_0xe8b7('0x3')](0x0);return _0x179083[_0xe8b7('0x4')](_0x28c356,_0xe8b7('0x5'));}function AgentComplete(_0x35b53b,_0x4f2b97){this[_0xe8b7('0x6')]=0x4;this['statedesc']='Answer';this[_0xe8b7('0x7')]=_0x35b53b[_0xe8b7('0x7')];this['type']=_0x35b53b[_0xe8b7('0x8')];this[_0xe8b7('0x9')]=_0x35b53b[_0xe8b7('0x8')]===_0xe8b7('0xa')?'queue':_0x35b53b[_0xe8b7('0x8')];this[_0xe8b7('0xb')]=_0x35b53b[_0xe8b7('0xb')];this[_0xe8b7('0xc')]=_0x35b53b['countcongestionretry'];this[_0xe8b7('0xd')]=_0x35b53b[_0xe8b7('0xd')];this[_0xe8b7('0xe')]=_0x35b53b[_0xe8b7('0xb')]+_0x35b53b[_0xe8b7('0xc')]+_0x35b53b[_0xe8b7('0xd')]+_0x35b53b[_0xe8b7('0xf')]+_0x35b53b[_0xe8b7('0x10')]+_0x35b53b[_0xe8b7('0x11')]+_0x35b53b[_0xe8b7('0x12')]+_0x35b53b['countagentrejectretry'];this[_0xe8b7('0xf')]=_0x35b53b[_0xe8b7('0xf')];this['countdropretry']=_0x35b53b[_0xe8b7('0x10')];this[_0xe8b7('0x11')]=_0x35b53b['countabandonedretry'];this[_0xe8b7('0x12')]=_0x35b53b[_0xe8b7('0x12')];this[_0xe8b7('0x13')]=_0x35b53b[_0xe8b7('0x13')];this[_0xe8b7('0x14')]=_0x4f2b97[_0xe8b7('0x14')];this[_0xe8b7('0x15')]=_0x35b53b[_0xe8b7('0x16')];this['calleridnum']=_0x35b53b[_0xe8b7('0x17')];this['starttime']=_0x35b53b[_0xe8b7('0x18')];this[_0xe8b7('0x19')]=_0x35b53b[_0xe8b7('0x19')];this[_0xe8b7('0x1a')]=_0x35b53b[_0xe8b7('0x1a')];this[_0xe8b7('0x1b')]=moment()[_0xe8b7('0x1c')](_0xe8b7('0x1d'));this['ringtime']=getSeconds(_0x35b53b['responsetime'],_0x35b53b['starttime']);this[_0xe8b7('0x1e')]=getSeconds(_0x35b53b[_0xe8b7('0x1a')],_0x35b53b[_0xe8b7('0x19')]);this[_0xe8b7('0x1f')]=getSeconds(this['endtime'],_0x35b53b['answertime']);this[_0xe8b7('0x20')]=_0x4f2b97[_0xe8b7('0x20')];this[_0xe8b7('0x21')]=_0x4f2b97[_0xe8b7('0x21')];this['reason']=_0x4f2b97[_0xe8b7('0x22')];this[_0xe8b7('0x23')]=_0x35b53b[_0xe8b7('0x23')];this[_0xe8b7('0x24')]=_0x35b53b['callbackuniqueid'];this[_0xe8b7('0x25')]=_0x35b53b[_0xe8b7('0x25')];this[_0xe8b7('0x26')]=_0x35b53b[_0xe8b7('0x26')];this[_0xe8b7('0x27')]=_0x35b53b['ContactId'];this['ListId']=_0x35b53b[_0xe8b7('0x28')];this[_0xe8b7('0x29')]=_0x35b53b[_0xe8b7('0x29')];this['VoiceQueueId']=_0x35b53b['VoiceQueueId'];this[_0xe8b7('0x2a')]=_0x35b53b[_0xe8b7('0x2a')];this['originatecalleridnum']=_0x35b53b[_0xe8b7('0x2b')]||'';this[_0xe8b7('0x2c')]=_0x35b53b['originatecalleridname']||'';}module[_0xe8b7('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 122230d..782747f 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 _0xd0bb=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x414ff1,_0xf0462b){var _0x29c53f=function(_0x1dab72){while(--_0x1dab72){_0x414ff1['push'](_0x414ff1['shift']());}};_0x29c53f(++_0xf0462b);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x260e29,_0x1d8d60){_0x260e29=_0x260e29-0x0;var _0x263384=_0xd0bb[_0x260e29];return _0x263384;};'use strict';var util=require(_0xbd0b('0x0'));var _=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));function getSeconds(_0x5793c9,_0x68ea36){var _0x4ab08f=moment(_0x5793c9)[_0xbd0b('0x3')](0x0);var _0x1f6ec3=moment(_0x68ea36)['milliseconds'](0x0);return _0x4ab08f[_0xbd0b('0x4')](_0x1f6ec3,'seconds');}function Final(_0x2236ce){this[_0xbd0b('0x5')]=_0x2236ce[_0xbd0b('0x5')];this[_0xbd0b('0x6')]=_0x2236ce[_0xbd0b('0x6')];this['type']=_0x2236ce[_0xbd0b('0x7')];this[_0xbd0b('0x8')]=_0x2236ce[_0xbd0b('0x7')]===_0xbd0b('0x9')?_0xbd0b('0xa'):_0x2236ce['type'];this['countbusyretry']=_0x2236ce[_0xbd0b('0xb')];this[_0xbd0b('0xc')]=_0x2236ce['countcongestionretry'];this[_0xbd0b('0xd')]=_0x2236ce[_0xbd0b('0xd')];this['countglobal']=_0x2236ce[_0xbd0b('0xb')]+_0x2236ce[_0xbd0b('0xc')]+_0x2236ce[_0xbd0b('0xd')]+_0x2236ce[_0xbd0b('0xe')]+_0x2236ce[_0xbd0b('0xf')]+_0x2236ce[_0xbd0b('0x10')]+_0x2236ce[_0xbd0b('0x11')]+_0x2236ce[_0xbd0b('0x12')];this[_0xbd0b('0xe')]=_0x2236ce[_0xbd0b('0xe')];this[_0xbd0b('0xf')]=_0x2236ce['countdropretry'];this[_0xbd0b('0x10')]=_0x2236ce['countabandonedretry'];this['countmachineretry']=_0x2236ce[_0xbd0b('0x11')];this[_0xbd0b('0x12')]=_0x2236ce[_0xbd0b('0x12')];this[_0xbd0b('0xa')]=_0x2236ce[_0xbd0b('0xa')];this['calleridname']=_0x2236ce['calleridname'];this[_0xbd0b('0x13')]=_0x2236ce[_0xbd0b('0x13')];this[_0xbd0b('0x14')]=_0x2236ce[_0xbd0b('0x14')];this[_0xbd0b('0x15')]=_0x2236ce[_0xbd0b('0x15')];this['endtime']=_0x2236ce[_0xbd0b('0x15')];this['ringtime']=_0x2236ce[_0xbd0b('0x16')]||0x0;this[_0xbd0b('0x17')]=_0x2236ce[_0xbd0b('0x17')]||0x0;this[_0xbd0b('0x18')]=_0x2236ce['talktime']||0x0;this[_0xbd0b('0x19')]=_0x2236ce[_0xbd0b('0x19')];this[_0xbd0b('0x1a')]=_0x2236ce['callbackuniqueid'];this[_0xbd0b('0x1b')]=_0x2236ce['callbackat'];this[_0xbd0b('0x1c')]=_0x2236ce[_0xbd0b('0x1c')];this[_0xbd0b('0x1d')]=_0x2236ce[_0xbd0b('0x1d')];this[_0xbd0b('0x1e')]=_0x2236ce['ListId'];this[_0xbd0b('0x1f')]=_0x2236ce['UserId'];this[_0xbd0b('0x20')]=_0x2236ce[_0xbd0b('0x20')];this[_0xbd0b('0x21')]=_0x2236ce[_0xbd0b('0x21')];this[_0xbd0b('0x22')]=_0x2236ce[_0xbd0b('0x22')]||'';this['originatecalleridname']=_0x2236ce[_0xbd0b('0x23')]||'';}module[_0xbd0b('0x24')]=Final; \ No newline at end of file +var _0xee14=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xee14,0x13a));var _0x4ee1=function(_0x368b37,_0x526a35){_0x368b37=_0x368b37-0x0;var _0x380a7b=_0xee14[_0x368b37];return _0x380a7b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4ee1('0x0'));function getSeconds(_0x674696,_0x34e49d){var _0x1fa407=moment(_0x674696)[_0x4ee1('0x1')](0x0);var _0x236ccd=moment(_0x34e49d)[_0x4ee1('0x1')](0x0);return _0x1fa407[_0x4ee1('0x2')](_0x236ccd,_0x4ee1('0x3'));}function Final(_0x4bc729){this[_0x4ee1('0x4')]=_0x4bc729['uniqueid'];this[_0x4ee1('0x5')]=_0x4bc729[_0x4ee1('0x5')];this[_0x4ee1('0x6')]=_0x4bc729[_0x4ee1('0x6')];this[_0x4ee1('0x7')]=_0x4bc729[_0x4ee1('0x6')]==='outbound'?_0x4ee1('0x8'):_0x4bc729[_0x4ee1('0x6')];this['countbusyretry']=_0x4bc729[_0x4ee1('0x9')];this[_0x4ee1('0xa')]=_0x4bc729[_0x4ee1('0xa')];this[_0x4ee1('0xb')]=_0x4bc729['countnoanswerretry'];this[_0x4ee1('0xc')]=_0x4bc729[_0x4ee1('0x9')]+_0x4bc729[_0x4ee1('0xa')]+_0x4bc729[_0x4ee1('0xb')]+_0x4bc729[_0x4ee1('0xd')]+_0x4bc729[_0x4ee1('0xe')]+_0x4bc729['countabandonedretry']+_0x4bc729[_0x4ee1('0xf')]+_0x4bc729[_0x4ee1('0x10')];this[_0x4ee1('0xd')]=_0x4bc729[_0x4ee1('0xd')];this[_0x4ee1('0xe')]=_0x4bc729[_0x4ee1('0xe')];this[_0x4ee1('0x11')]=_0x4bc729[_0x4ee1('0x11')];this[_0x4ee1('0xf')]=_0x4bc729['countmachineretry'];this[_0x4ee1('0x10')]=_0x4bc729[_0x4ee1('0x10')];this[_0x4ee1('0x8')]=_0x4bc729[_0x4ee1('0x8')];this[_0x4ee1('0x12')]=_0x4bc729[_0x4ee1('0x12')];this[_0x4ee1('0x13')]=_0x4bc729[_0x4ee1('0x13')];this[_0x4ee1('0x14')]=_0x4bc729[_0x4ee1('0x14')];this[_0x4ee1('0x15')]=_0x4bc729['responsetime'];this[_0x4ee1('0x16')]=_0x4bc729[_0x4ee1('0x15')];this[_0x4ee1('0x17')]=_0x4bc729[_0x4ee1('0x17')]||0x0;this[_0x4ee1('0x18')]=_0x4bc729[_0x4ee1('0x18')]||0x0;this['talktime']=_0x4bc729[_0x4ee1('0x19')]||0x0;this[_0x4ee1('0x1a')]=_0x4bc729[_0x4ee1('0x1a')];this[_0x4ee1('0x1b')]=_0x4bc729[_0x4ee1('0x1b')];this[_0x4ee1('0x1c')]=_0x4bc729[_0x4ee1('0x1c')];this[_0x4ee1('0x1d')]=_0x4bc729[_0x4ee1('0x1d')];this[_0x4ee1('0x1e')]=_0x4bc729['ContactId'];this['ListId']=_0x4bc729[_0x4ee1('0x1f')];this[_0x4ee1('0x20')]=_0x4bc729[_0x4ee1('0x20')];this[_0x4ee1('0x21')]=_0x4bc729[_0x4ee1('0x21')];this[_0x4ee1('0x22')]=_0x4bc729['CampaignId'];this['originatecalleridnum']=_0x4bc729[_0x4ee1('0x23')]||'';this[_0x4ee1('0x24')]=_0x4bc729['originatecalleridname']||'';}module[_0x4ee1('0x25')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 2adcae5..b8e3c1c 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 _0x578e=['endtime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','moment','milliseconds','diff','seconds','state','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime'];(function(_0x162319,_0x36fa88){var _0x55b140=function(_0x290cf8){while(--_0x290cf8){_0x162319['push'](_0x162319['shift']());}};_0x55b140(++_0x36fa88);}(_0x578e,0xfc));var _0xe578=function(_0x3e02a4,_0x362c89){_0x3e02a4=_0x3e02a4-0x0;var _0xaf9824=_0x578e[_0x3e02a4];return _0xaf9824;};'use strict';var util=require(_0xe578('0x0'));var _=require('lodash');var moment=require(_0xe578('0x1'));function getSeconds(_0x4f5bfd,_0x4fc2af){var _0x5e96ad=moment(_0x4f5bfd)[_0xe578('0x2')](0x0);var _0x57db25=moment(_0x4fc2af)['milliseconds'](0x0);return _0x5e96ad[_0xe578('0x3')](_0x57db25,_0xe578('0x4'));}function Hangup(_0xa395b9,_0x5caef8){this[_0xe578('0x5')]=0x4;this['statedesc']='Answer';this[_0xe578('0x6')]=_0xa395b9[_0xe578('0x6')];this['type']=_0xa395b9[_0xe578('0x7')];this['campaigntype']=_0xa395b9[_0xe578('0x7')]===_0xe578('0x8')?_0xe578('0x9'):_0xa395b9['type'];this[_0xe578('0xa')]=_0xa395b9[_0xe578('0xa')];this['countcongestionretry']=_0xa395b9[_0xe578('0xb')];this[_0xe578('0xc')]=_0xa395b9[_0xe578('0xc')];this[_0xe578('0xd')]=_0xa395b9['countbusyretry']+_0xa395b9[_0xe578('0xb')]+_0xa395b9[_0xe578('0xc')]+_0xa395b9[_0xe578('0xe')]+_0xa395b9['countdropretry']+_0xa395b9[_0xe578('0xf')]+_0xa395b9[_0xe578('0x10')]+_0xa395b9[_0xe578('0x11')];this[_0xe578('0xe')]=_0xa395b9[_0xe578('0xe')];this[_0xe578('0x12')]=_0xa395b9['countdropretry'];this[_0xe578('0xf')]=_0xa395b9['countabandonedretry'];this[_0xe578('0x10')]=_0xa395b9[_0xe578('0x10')];this[_0xe578('0x11')]=_0xa395b9[_0xe578('0x11')];this[_0xe578('0x13')]=_0x5caef8[_0xe578('0x13')];this['calleridname']=_0xa395b9[_0xe578('0x14')];this[_0xe578('0x15')]=_0xa395b9['number'];this[_0xe578('0x16')]=_0xa395b9[_0xe578('0x16')];this[_0xe578('0x17')]=_0xa395b9[_0xe578('0x17')];this['endtime']=moment()[_0xe578('0x18')](_0xe578('0x19'));this[_0xe578('0x1a')]=getSeconds(_0xa395b9[_0xe578('0x17')],_0xa395b9[_0xe578('0x16')]);this['holdtime']=0x0;this[_0xe578('0x1b')]=getSeconds(this[_0xe578('0x1c')],_0xa395b9[_0xe578('0x17')]);this['queue']=_0xa395b9[_0xe578('0x9')];this[_0xe578('0x1d')]='IVR';this['reason']=_0x5caef8[_0xe578('0x1e')];this['callback']=_0xa395b9[_0xe578('0x1f')];this[_0xe578('0x20')]=_0xa395b9['callbackuniqueid'];this[_0xe578('0x21')]=_0xa395b9[_0xe578('0x21')];this['recallme']=_0xa395b9[_0xe578('0x22')];this[_0xe578('0x23')]=_0xa395b9[_0xe578('0x23')];this[_0xe578('0x24')]=_0xa395b9[_0xe578('0x24')];this[_0xe578('0x25')]=_0xa395b9[_0xe578('0x25')];this['VoiceQueueId']=_0xa395b9['VoiceQueueId'];this[_0xe578('0x26')]=_0xa395b9[_0xe578('0x26')];}module[_0xe578('0x27')]=Hangup; \ No newline at end of file +var _0x7342=['ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x210910,_0x387f40){var _0x4c6484=function(_0x4fb8f2){while(--_0x4fb8f2){_0x210910['push'](_0x210910['shift']());}};_0x4c6484(++_0x387f40);}(_0x7342,0x16f));var _0x2734=function(_0x6ceea7,_0x5a7e5f){_0x6ceea7=_0x6ceea7-0x0;var _0x1d6611=_0x7342[_0x6ceea7];return _0x1d6611;};'use strict';var util=require(_0x2734('0x0'));var _=require(_0x2734('0x1'));var moment=require('moment');function getSeconds(_0x1f22fe,_0x547242){var _0x2b1989=moment(_0x1f22fe)[_0x2734('0x2')](0x0);var _0x21d30b=moment(_0x547242)[_0x2734('0x2')](0x0);return _0x2b1989[_0x2734('0x3')](_0x21d30b,_0x2734('0x4'));}function Hangup(_0x461572,_0x213a6e){this[_0x2734('0x5')]=0x4;this['statedesc']=_0x2734('0x6');this[_0x2734('0x7')]=_0x461572[_0x2734('0x7')];this['type']=_0x461572[_0x2734('0x8')];this[_0x2734('0x9')]=_0x461572[_0x2734('0x8')]===_0x2734('0xa')?_0x2734('0xb'):_0x461572['type'];this['countbusyretry']=_0x461572['countbusyretry'];this['countcongestionretry']=_0x461572[_0x2734('0xc')];this[_0x2734('0xd')]=_0x461572[_0x2734('0xd')];this[_0x2734('0xe')]=_0x461572['countbusyretry']+_0x461572['countcongestionretry']+_0x461572[_0x2734('0xd')]+_0x461572[_0x2734('0xf')]+_0x461572[_0x2734('0x10')]+_0x461572[_0x2734('0x11')]+_0x461572[_0x2734('0x12')]+_0x461572[_0x2734('0x13')];this[_0x2734('0xf')]=_0x461572[_0x2734('0xf')];this[_0x2734('0x10')]=_0x461572[_0x2734('0x10')];this['countabandonedretry']=_0x461572[_0x2734('0x11')];this[_0x2734('0x12')]=_0x461572[_0x2734('0x12')];this['countagentrejectretry']=_0x461572[_0x2734('0x13')];this[_0x2734('0x14')]=_0x213a6e[_0x2734('0x14')];this[_0x2734('0x15')]=_0x461572[_0x2734('0x16')];this[_0x2734('0x17')]=_0x461572[_0x2734('0x18')];this['starttime']=_0x461572[_0x2734('0x19')];this[_0x2734('0x1a')]=_0x461572[_0x2734('0x1a')];this[_0x2734('0x1b')]=moment()['format'](_0x2734('0x1c'));this[_0x2734('0x1d')]=getSeconds(_0x461572['responsetime'],_0x461572[_0x2734('0x19')]);this[_0x2734('0x1e')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x461572['responsetime']);this[_0x2734('0xb')]=_0x461572['queue'];this[_0x2734('0x1f')]=_0x2734('0x20');this[_0x2734('0x21')]=_0x213a6e[_0x2734('0x22')];this[_0x2734('0x23')]=_0x461572[_0x2734('0x23')];this['callbackuniqueid']=_0x461572[_0x2734('0x24')];this['callbackat']=_0x461572[_0x2734('0x25')];this['recallme']=_0x461572[_0x2734('0x26')];this[_0x2734('0x27')]=_0x461572[_0x2734('0x27')];this[_0x2734('0x28')]=_0x461572['ListId'];this[_0x2734('0x29')]=_0x461572['UserId'];this[_0x2734('0x2a')]=_0x461572['VoiceQueueId'];this['CampaignId']=_0x461572[_0x2734('0x2b')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index d53b327..0b2e375 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 _0x31a0=['countabandonedretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry'];(function(_0x5aa4e7,_0x47dece){var _0x59135a=function(_0x2c3759){while(--_0x2c3759){_0x5aa4e7['push'](_0x5aa4e7['shift']());}};_0x59135a(++_0x47dece);}(_0x31a0,0x68));var _0x031a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x31a0[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x031a('0x0'));var _=require(_0x031a('0x1'));var moment=require(_0x031a('0x2'));function getSeconds(_0xb4166c,_0x1ccff1){var _0xc9dee4=moment(_0xb4166c)[_0x031a('0x3')](0x0);var _0x38eaa6=moment(_0x1ccff1)[_0x031a('0x3')](0x0);return _0xc9dee4[_0x031a('0x4')](_0x38eaa6,_0x031a('0x5'));}function History(_0x3561ea){this[_0x031a('0x6')]=_0x3561ea[_0x031a('0x6')];this[_0x031a('0x7')]=_0x3561ea[_0x031a('0x7')]||undefined;this[_0x031a('0x8')]=_0x3561ea[_0x031a('0x8')];this[_0x031a('0x9')]=_0x3561ea[_0x031a('0x8')]===_0x031a('0xa')?_0x031a('0xb'):_0x3561ea[_0x031a('0x8')];this[_0x031a('0xc')]=_0x3561ea[_0x031a('0xc')];this[_0x031a('0xd')]=_0x3561ea[_0x031a('0xd')];this[_0x031a('0xe')]=_0x3561ea['countnoanswerretry'];this[_0x031a('0xf')]=_0x3561ea['countbusyretry']+_0x3561ea[_0x031a('0xd')]+_0x3561ea['countnoanswerretry']+_0x3561ea[_0x031a('0x10')]+_0x3561ea[_0x031a('0x11')]+_0x3561ea['countabandonedretry']+_0x3561ea['countmachineretry']+_0x3561ea[_0x031a('0x12')];this[_0x031a('0x10')]=_0x3561ea[_0x031a('0x10')];this[_0x031a('0x11')]=_0x3561ea[_0x031a('0x11')];this[_0x031a('0x13')]=_0x3561ea[_0x031a('0x13')];this['countmachineretry']=_0x3561ea[_0x031a('0x14')];this[_0x031a('0x12')]=_0x3561ea['countagentrejectretry'];this[_0x031a('0xb')]=_0x3561ea['queue'];this[_0x031a('0x15')]=_0x3561ea[_0x031a('0x16')];this[_0x031a('0x17')]=_0x3561ea[_0x031a('0x18')];this[_0x031a('0x19')]=_0x3561ea[_0x031a('0x19')];this[_0x031a('0x1a')]=_0x3561ea[_0x031a('0x1a')];this[_0x031a('0x1b')]=_0x3561ea[_0x031a('0x1a')];this[_0x031a('0x1c')]=getSeconds(_0x3561ea[_0x031a('0x1a')],_0x3561ea[_0x031a('0x19')]);this[_0x031a('0x1d')]=0x0;this['talktime']=0x0;this[_0x031a('0x1e')]=_0x3561ea[_0x031a('0x1e')];this[_0x031a('0x1f')]=_0x3561ea['callbackuniqueid'];this[_0x031a('0x20')]=_0x3561ea[_0x031a('0x20')];this[_0x031a('0x21')]=_0x3561ea[_0x031a('0x21')];this[_0x031a('0x22')]=_0x3561ea[_0x031a('0x22')];this[_0x031a('0x23')]=_0x3561ea[_0x031a('0x23')];this[_0x031a('0x24')]=_0x3561ea['UserId'];this[_0x031a('0x25')]=_0x3561ea[_0x031a('0x25')];this['CampaignId']=_0x3561ea['CampaignId'];this[_0x031a('0x26')]=_0x3561ea['originatecalleridnum']||'';this[_0x031a('0x27')]=_0x3561ea['originatecalleridname']||'';}module[_0x031a('0x28')]=History; \ No newline at end of file +var _0x4641=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x49196e,_0x4c818d){var _0x411bef=function(_0x16a7ad){while(--_0x16a7ad){_0x49196e['push'](_0x49196e['shift']());}};_0x411bef(++_0x4c818d);}(_0x4641,0x185));var _0x1464=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4641[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require(_0x1464('0x0'));var moment=require(_0x1464('0x1'));function getSeconds(_0x37de1d,_0x452d0b){var _0x15e77b=moment(_0x37de1d)[_0x1464('0x2')](0x0);var _0x21ab6d=moment(_0x452d0b)[_0x1464('0x2')](0x0);return _0x15e77b['diff'](_0x21ab6d,_0x1464('0x3'));}function History(_0x4b9d04){this[_0x1464('0x4')]=_0x4b9d04[_0x1464('0x4')];this[_0x1464('0x5')]=_0x4b9d04['scheduledat']||undefined;this[_0x1464('0x6')]=_0x4b9d04[_0x1464('0x6')];this[_0x1464('0x7')]=_0x4b9d04[_0x1464('0x6')]===_0x1464('0x8')?_0x1464('0x9'):_0x4b9d04[_0x1464('0x6')];this['countbusyretry']=_0x4b9d04[_0x1464('0xa')];this[_0x1464('0xb')]=_0x4b9d04['countcongestionretry'];this['countnoanswerretry']=_0x4b9d04[_0x1464('0xc')];this[_0x1464('0xd')]=_0x4b9d04[_0x1464('0xa')]+_0x4b9d04[_0x1464('0xb')]+_0x4b9d04['countnoanswerretry']+_0x4b9d04['countnosuchnumberretry']+_0x4b9d04[_0x1464('0xe')]+_0x4b9d04['countabandonedretry']+_0x4b9d04[_0x1464('0xf')]+_0x4b9d04[_0x1464('0x10')];this[_0x1464('0x11')]=_0x4b9d04[_0x1464('0x11')];this[_0x1464('0xe')]=_0x4b9d04['countdropretry'];this[_0x1464('0x12')]=_0x4b9d04[_0x1464('0x12')];this['countmachineretry']=_0x4b9d04['countmachineretry'];this[_0x1464('0x10')]=_0x4b9d04[_0x1464('0x10')];this['queue']=_0x4b9d04['queue'];this[_0x1464('0x13')]=_0x4b9d04[_0x1464('0x14')];this[_0x1464('0x15')]=_0x4b9d04[_0x1464('0x16')];this[_0x1464('0x17')]=_0x4b9d04[_0x1464('0x17')];this[_0x1464('0x18')]=_0x4b9d04['responsetime'];this[_0x1464('0x19')]=_0x4b9d04['responsetime'];this['ringtime']=getSeconds(_0x4b9d04[_0x1464('0x18')],_0x4b9d04['starttime']);this[_0x1464('0x1a')]=0x0;this[_0x1464('0x1b')]=0x0;this['callback']=_0x4b9d04[_0x1464('0x1c')];this['callbackuniqueid']=_0x4b9d04[_0x1464('0x1d')];this[_0x1464('0x1e')]=_0x4b9d04[_0x1464('0x1e')];this[_0x1464('0x1f')]=_0x4b9d04['recallme'];this[_0x1464('0x20')]=_0x4b9d04[_0x1464('0x20')];this[_0x1464('0x21')]=_0x4b9d04['ListId'];this[_0x1464('0x22')]=_0x4b9d04[_0x1464('0x22')];this['VoiceQueueId']=_0x4b9d04[_0x1464('0x23')];this[_0x1464('0x24')]=_0x4b9d04[_0x1464('0x24')];this[_0x1464('0x25')]=_0x4b9d04['originatecalleridnum']||'';this[_0x1464('0x26')]=_0x4b9d04[_0x1464('0x26')]||'';}module[_0x1464('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 28302b3..1682f18 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 _0xa9e0=['reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countbusyretry','countnosuchnumberretry','countdropretry','stateGlobal','rescheduleContact','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','stateinterface','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','inspect','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','paused','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','push','command','iftime\x20%s,%s','timezones','indexOf','true','content','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','reachable','map','syncCampaigns','checkIfTime','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','originate','voiceQueue\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','outbound','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','TrunkBackup','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','phone','variables','trim','substring','SIP/%s/%s%s','dialCutDigit','from-sip','[originate][error]','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','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(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','getDataPredictiveOld','loggedIn','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','[countReScheduled]\x20','emptyContact','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','RUNNING','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','p\x20=\x20','[abandonmentRate]','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','ivrOriginated','agentconnect','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','milliseconds','seconds','type','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','md5','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','uniqueId','[uniqueid]','clearZombieChannels','[actions]','sequence','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','statedesc','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var rr=require('rr');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var ut=require('../preview/util/util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerBooked=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var loggerPredictive=require('../../../config/logger')(_0x0a9e('0x8'));var loggerPredictiveCalls=require(_0x0a9e('0x5'))(_0x0a9e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':_0x0a9e('0xc'),'port':0x18eb});var io=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xb')]));var cmHopper=require(_0x0a9e('0xe'));var cmHopperHistory=require(_0x0a9e('0xf'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Action=require(_0x0a9e('0x10'));var History=require(_0x0a9e('0x11'));var Final=require(_0x0a9e('0x12'));var AgentComplete=require(_0x0a9e('0x13'));var QueueCallerAbandon=require(_0x0a9e('0x14'));var Hangup=require(_0x0a9e('0x15'));var ipAgi=process['env'][_0x0a9e('0x16')]||_0x0a9e('0x17');var strategy={'rrmemory':_0x0a9e('0x18'),'roundrobin':_0x0a9e('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0a9e('0x1a')][_0x0a9e('0x1b')]=function(_0x52a03d){this[_0x0a9e('0x1c')]=this['tail']?this[_0x0a9e('0x1c')]['finally'](_0x52a03d):_0x52a03d();};function Dialer(_0x16033c,_0x12066b){this['sequence']=new Sequence();this[_0x0a9e('0x1d')]=_0x12066b;this['voiceQueues']=_0x16033c[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x16033c[_0x0a9e('0x1f')];this[_0x0a9e('0x20')]=_0x16033c[_0x0a9e('0x20')];this[_0x0a9e('0x21')]=_0x16033c[_0x0a9e('0x21')];this[_0x0a9e('0x22')]=config[_0x0a9e('0x22')]||0x2;this[_0x0a9e('0x23')]={};this[_0x0a9e('0x24')]={};this[_0x0a9e('0x25')]={};this['uniqueId']={};this[_0x0a9e('0x26')]={};this[_0x0a9e('0x27')]={};this['startProgressive']={};this[_0x0a9e('0x28')]={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x0a9e('0x29'),this[_0x0a9e('0x2a')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2c'),this['syncQueueCallerAbandon'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2d'),this[_0x0a9e('0x2e')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2f'),this[_0x0a9e('0x30')][_0x0a9e('0x2b')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x31'),this[_0x0a9e('0x32')][_0x0a9e('0x2b')](this));ami['on']('hangup',this[_0x0a9e('0x33')]['bind'](this));ami['on'](_0x0a9e('0x34'),this['syncNewExten'][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x35'),this[_0x0a9e('0x36')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x37'),this[_0x0a9e('0x38')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x39'),this['syncQueueStatusComplete'][_0x0a9e('0x2b')](this));this[_0x0a9e('0x3a')]();this[_0x0a9e('0x3b')]();RpcSetting[_0x0a9e('0x3c')]()['then'](function(_0x15b200){previewRecallmeReminderInterval=_0x15b200[_0x0a9e('0x3d')];});}function isNotNull(_0x1843b2){return _0x1843b2!==null&&!_[_0x0a9e('0x3e')](_0x1843b2);}function checkIsLoggedIn(_0x58b06f,_0x563b45){return function(){if(_0x563b45<=0x0){_0x58b06f[_0x0a9e('0x3f')]=_0x0a9e('0x40');throw _0x58b06f[_0x0a9e('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x426950){return _0x426950;}function checkIsActive(_0x5d1e0e,_0x2407f9){return function(){if(!isActive(_0x2407f9)){_0x5d1e0e[_0x0a9e('0x3f')]=_0x0a9e('0x42');throw _0x5d1e0e[_0x0a9e('0x41')]+_0x0a9e('0x43');}};}function checkInterval(_0x5180f1){return function(){if(!isNotNull(_0x5180f1[_0x0a9e('0x44')])){_0x5180f1[_0x0a9e('0x3f')]=_0x0a9e('0x45');throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}if(!isNotNull(_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')])){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0a9e('0x48')](_0x5180f1[_0x0a9e('0x44')][_0x0a9e('0x47')]))){_0x5180f1[_0x0a9e('0x3f')]='INTERVAL_IS_NULL';throw _0x5180f1[_0x0a9e('0x41')]+_0x0a9e('0x46');}};}function msgResponse(_0x1fa90d,_0x15de0e,_0x4853b1){return{'action':_0x1fa90d,'response':_0x15de0e,'message':_0x4853b1,'stack':_0x4853b1};}function myreject(_0x54135e){return function(_0x1e8694){return _0x54135e(msgResponse('[ifTime][Action]',_0x0a9e('0x49'),JSON[_0x0a9e('0x4a')](_0x1e8694)));};}function getSeconds(_0x381c37,_0x1ef87a){var _0x4f41ae=moment(_0x381c37)[_0x0a9e('0x4b')](0x0);var _0x3bfce8=moment(_0x1ef87a)[_0x0a9e('0x4b')](0x0);return _0x4f41ae['diff'](_0x3bfce8,_0x0a9e('0x4c'));}function emit(_0x1a180b,_0x289467,_0x4c1c0e){io['to'](_0x1a180b)['emit'](_0x289467,_0x4c1c0e);}function emitVoiceQueueSummary(_0x11b61d){if(_0x11b61d[_0x0a9e('0x4d')]==='outbound'){var _0x2b814e={'id':_0x11b61d['id'],'name':_0x11b61d[_0x0a9e('0x41')],'strategy':_0x11b61d[_0x0a9e('0x4e')],'answered':_0x11b61d[_0x0a9e('0x4f')],'available':_0x11b61d['available'],'loggedIn':_0x11b61d['loggedIn'],'pTalking':_0x11b61d[_0x0a9e('0x50')],'sumBillable':_0x11b61d[_0x0a9e('0x51')],'sumDuration':_0x11b61d['sumDuration'],'sumHoldTime':_0x11b61d[_0x0a9e('0x52')]||0x0,'talking':_0x11b61d[_0x0a9e('0x53')],'total':_0x11b61d[_0x0a9e('0x54')],'type':_0x11b61d['type'],'unmanaged':_0x11b61d[_0x0a9e('0x55')],'abandoned':_0x11b61d[_0x0a9e('0x56')],'waiting':_0x11b61d[_0x0a9e('0x57')],'loggedInDb':_0x11b61d[_0x0a9e('0x58')],'dialActive':_0x11b61d[_0x0a9e('0x59')],'dialMethod':_0x11b61d[_0x0a9e('0x5a')],'dialOriginateCallerIdName':_0x11b61d[_0x0a9e('0x5b')],'dialOriginateCallerIdNumber':_0x11b61d[_0x0a9e('0x5c')],'dialOriginateTimeout':_0x11b61d[_0x0a9e('0x5d')],'dialPrefix':_0x11b61d[_0x0a9e('0x5e')],'outboundAnswerAgiCallsDay':_0x11b61d[_0x0a9e('0x5f')],'outboundAnswerCallsDay':_0x11b61d[_0x0a9e('0x60')],'outboundBlacklistCallsDay':_0x11b61d[_0x0a9e('0x61')],'outboundBusyCallsDay':_0x11b61d[_0x0a9e('0x62')],'outboundCongestionCallsDay':_0x11b61d[_0x0a9e('0x63')],'outboundDropCallsDayACS':_0x11b61d['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x11b61d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x11b61d[_0x0a9e('0x64')],'outboundNoAnswerCallsDay':_0x11b61d[_0x0a9e('0x65')],'outboundNoSuchCallsDay':_0x11b61d[_0x0a9e('0x66')],'outboundOriginateFailureCallsDay':_0x11b61d[_0x0a9e('0x67')],'outboundReCallsDay':_0x11b61d[_0x0a9e('0x68')],'outboundRejectCallsDay':_0x11b61d[_0x0a9e('0x69')],'outboundUnknownCallsDay':_0x11b61d[_0x0a9e('0x6a')],'predictiveIntervalAnsweredCalls':_0x11b61d[_0x0a9e('0x6b')],'predictiveIntervalAvgHoldtime':_0x11b61d[_0x0a9e('0x6c')],'predictiveIntervalAvgTalktime':_0x11b61d[_0x0a9e('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x11b61d[_0x0a9e('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x11b61d[_0x0a9e('0x6f')],'predictiveIntervalErlangCalls':_0x11b61d['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x11b61d[_0x0a9e('0x70')],'predictiveIntervalHitRate':_0x11b61d[_0x0a9e('0x71')],'predictiveIntervalMultiplicativeFactor':_0x11b61d[_0x0a9e('0x72')],'predictiveIntervalPauses':_0x11b61d[_0x0a9e('0x73')],'predictiveIntervalAvailable':_0x11b61d[_0x0a9e('0x74')],'predictiveIntervalTotalCalls':_0x11b61d[_0x0a9e('0x75')],'message':_0x11b61d[_0x0a9e('0x3f')],'originated':_0x11b61d[_0x0a9e('0x76')],'erlangCalls':_0x11b61d['erlangCalls'],'erlangCallToSecond':_0x11b61d[_0x0a9e('0x77')],'erlangAbandonmentRate':_0x11b61d['erlangAbandonmentRate'],'erlangBusyFactor':_0x11b61d[_0x0a9e('0x78')],'startPredictive':_0x11b61d[_0x0a9e('0x27')],'startProgressive':_0x11b61d[_0x0a9e('0x79')]};if(_0x11b61d['Trunk']){_0x2b814e[_0x0a9e('0x7a')]={'id':_0x11b61d[_0x0a9e('0x7a')]['id'],'name':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x41')],'active':_0x11b61d[_0x0a9e('0x7a')][_0x0a9e('0x7b')],'callerid':_0x11b61d[_0x0a9e('0x7a')]['callerid']};}if(_0x11b61d[_0x0a9e('0x44')]){_0x2b814e[_0x0a9e('0x44')]={'id':_0x11b61d[_0x0a9e('0x44')]['id'],'name':_0x11b61d[_0x0a9e('0x44')][_0x0a9e('0x41')]};}var _0x992c77=md5(JSON[_0x0a9e('0x4a')](_0x2b814e));if(_0x11b61d[_0x0a9e('0x7c')]!==_0x992c77){_0x11b61d[_0x0a9e('0x7c')]=_0x992c77;emit(util['format'](_0x0a9e('0x7d'),_0x2b814e[_0x0a9e('0x41')]),'voice_queue:save',_0x2b814e);}}}function emitCampaignSummary(_0x4ae14b){if(_0x4ae14b['type']===_0x0a9e('0x7e')){emit(util[_0x0a9e('0x7f')](_0x0a9e('0x80'),_0x4ae14b[_0x0a9e('0x41')]),_0x0a9e('0x81'),_0x4ae14b);}}function checkGetDataPredictive(_0x30decb){if(isNotNull(_0x30decb)&&!_[_0x0a9e('0x48')](_0x30decb)){loggerPredictive[_0x0a9e('0x82')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x75')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x83'),_0x30decb['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x84'),_0x30decb['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x0a9e('0x85'),_0x30decb['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x0a9e('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30decb[_0x0a9e('0x6c')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x86'),_0x30decb['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));if(_0x30decb['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6d')])&&_0x30decb[_0x0a9e('0x6d')]>0x0){return!![];}loggerPredictive['info'](_0x0a9e('0x88'));if(!_['isUndefined'](_0x30decb[_0x0a9e('0x6c')])&&_0x30decb['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0a9e('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0a9e('0x82')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x2f7092){return function(_0x65432){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x89'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8a'),_0x65432[_0x0a9e('0x8b')]);loggerPredictive[_0x0a9e('0x82')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x65432[_0x0a9e('0x77')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432[_0x0a9e('0x8d')]);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8e'),_0x65432['erlangBusyFactor']);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x8c'),_0x65432['erlangAbandonmentRate']);loggerPredictive[_0x0a9e('0x82')]('---------------------------');_[_0x0a9e('0x8f')](_0x2f7092,_0x65432);};}function getDiff(_0x5ba1f9){var _0x4b3c1a=moment()['milliseconds'](0x0);var _0x273cb5=moment(_0x5ba1f9)['milliseconds'](0x0);return _0x4b3c1a[_0x0a9e('0x90')](_0x273cb5,_0x0a9e('0x4c'));}function ifInterval(_0x261adb,_0x7be420){if(_[_0x0a9e('0x3e')](_0x7be420)){return![];}return getDiff(_0x7be420)<_0x261adb*0x3c;}function freeVariablesPredictive(_0x26d7db){if(isNotNull(_0x26d7db)){if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x79')])){_0x26d7db['startProgressive']=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x91'));}if(!_['isUndefined'](_0x26d7db[_0x0a9e('0x27')])){_0x26d7db[_0x0a9e('0x27')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0a9e('0x3e')](_0x26d7db[_0x0a9e('0x92')])){clearInterval(_0x26d7db['handlePredictive']);_0x26d7db[_0x0a9e('0x92')]=undefined;loggerPredictive[_0x0a9e('0x82')](_0x26d7db[_0x0a9e('0x41')],_0x0a9e('0x93'));}}}function erlangb(_0x401837,_0x4d4a35){if(_0x4d4a35===0x0){return 0x0;}var _0x176840=0x1;for(var _0x2937e0=0x1;_0x2937e0<=_0x4d4a35;_0x2937e0+=0x1){_0x176840=0x1+_0x176840*_0x2937e0/_0x401837;}return 0x1/_0x176840;}function isVoiceQueueOutbound(_0x281c7d){return _0x281c7d==='outbound';}function isNotPreview(_0x3528b7){return _0x3528b7!=='preview';}function isCampaignIvr(_0x5211e3){return _0x5211e3===_0x0a9e('0x7e');}function getCallerId(_0x4556c5,_0x9375fb,_0x19c995){if(!_[_0x0a9e('0x3e')](_0x19c995)&&typeof _0x19c995===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x19c995)){if(!_[_0x0a9e('0x3e')](_0x9375fb)&&typeof _0x9375fb===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x9375fb)){return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x9375fb,_0x19c995);}return util[_0x0a9e('0x7f')](_0x0a9e('0x95'),_0x19c995,_0x19c995);}if(!_[_0x0a9e('0x3e')](_0x4556c5)&&typeof _0x4556c5===_0x0a9e('0x94')&&!_[_0x0a9e('0x48')](_0x4556c5)){return _0x4556c5;}return _0x0a9e('0x96');}function loggerCatchQueueSummary(_0x5150a4,_0x1b0b98){return function(_0x295763){freeVariablesPredictive(_0x1b0b98);emitVoiceQueueSummary(_0x1b0b98);emitCampaignSummary(_0x1b0b98);loggerSyncQueueSummary[_0x0a9e('0x97')](_0x5150a4,util['inspect'](_0x295763,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1148a1,_0x30944e){return function(_0x4b341d){loggerPredictive[_0x0a9e('0x98')](_0x30944e[_0x0a9e('0x41')],_0x1148a1);loggerPredictive[_0x0a9e('0x98')](_0x4b341d[_0x0a9e('0x99')]);freeVariablesPredictive(_0x30944e);};}function loggerCatch(_0x13b5c0){return function(_0x4a43a8){logger['error'](_0x13b5c0,util['inspect'](_0x4a43a8,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x40fb85){return _0x40fb85&&!_[_0x0a9e('0x3e')](_0x40fb85)&&_0x40fb85[_0x0a9e('0x9a')]>0x0;}function decremetOriginate(_0x23a7d3){if(!_[_0x0a9e('0x3e')](_0x23a7d3)&&_0x23a7d3!==null){if(typeof _0x23a7d3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x23a7d3[_0x0a9e('0x76')]>0x0){_0x23a7d3['originated']-=0x1;}else{logger[_0x0a9e('0x98')](_0x0a9e('0x9c'));}}}else{logger[_0x0a9e('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x2bdc44,_0x583b2e,_0x4437ff){if(_0x583b2e>_0x4437ff){for(var _0x44351d=0x0;_0x44351d<_0x583b2e-_0x4437ff;_0x44351d+=0x1){decremetOriginate(_0x2bdc44);}}}function loggerGetContactDialer(_0x4c46c1,_0x2ed01e,_0x75912a){return function(_0x2cc7a7){checkContactLowerLimitOriginate(_0x2ed01e,_0x75912a,0x0);logger[_0x0a9e('0x98')](_0x4c46c1,util['inspect'](_0x2cc7a7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1d442c){return function(_0x2e9552){if(isNotNull(_0x2e9552)&&isNotNull(_0x2e9552[0x0])){if(_0x2e9552[0x0][_0x0a9e('0x9d')]>0x0){_0x1d442c[_0x0a9e('0x3f')]='RESCHEDULED_CONTACTS';logger[_0x0a9e('0x82')](_0x0a9e('0x9e')+_0x1d442c[_0x0a9e('0x41')],_0x2e9552[0x0][_0x0a9e('0x9d')],'contacts');}else{_0x1d442c[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger[_0x0a9e('0x82')](_0x0a9e('0xa0')+_0x1d442c[_0x0a9e('0x41')]);}}};}function notSendMessagesQueue(_0xdb98ca){if(_0xdb98ca[_0x0a9e('0xa1')]){freeVariablesPredictive(_0xdb98ca);if(_0xdb98ca[_0x0a9e('0x76')]===0x0&&_0xdb98ca[_0x0a9e('0x53')]===0x0&&_0xdb98ca[_0x0a9e('0x57')]===0x0&&(_0xdb98ca[_0x0a9e('0x50')]||0x0)===0x0){_0xdb98ca[_0x0a9e('0xa1')]=![];_0xdb98ca[_0x0a9e('0xa2')]=0x0;_0xdb98ca[_0x0a9e('0x3f')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca[_0x0a9e('0x41')],'is\x20not\x20active');}else{_0xdb98ca[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa3'),_0xdb98ca['name'],'is\x20disactive');}emitVoiceQueueSummary(_0xdb98ca);}}function notSendMessagesCampaign(_0x7ebea8){if(_0x7ebea8[_0x0a9e('0xa1')]){if(_0x7ebea8['originated']===0x0){_0x7ebea8[_0x0a9e('0xa1')]=![];_0x7ebea8['message']=_0x0a9e('0x42');loggerSyncQueueSummary[_0x0a9e('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x7ebea8[_0x0a9e('0x41')],_0x0a9e('0xa5'));}else{_0x7ebea8[_0x0a9e('0x3f')]=_0x0a9e('0xa4');loggerSyncQueueSummary[_0x0a9e('0x97')](_0x0a9e('0xa6'),_0x7ebea8[_0x0a9e('0x41')],'is\x20disactive');}emitCampaignSummary(_0x7ebea8);}}function createObjHistory(_0x2973d3,_0x3ca9b9,_0x45c109,_0x16e5b9,_0x492543){_0x2973d3[_0x0a9e('0x3f')]=_0x45c109;var _0xf0db1=new Action(_0x2973d3,_0x3ca9b9);var _0x4bf3a5=new History(_0xf0db1);_0x4bf3a5[_0x0a9e('0xa7')]=_0x16e5b9;_0x4bf3a5['statedesc']=_0x492543;_0x4bf3a5[_0x0a9e('0xa8')]=_0xf0db1[_0x0a9e('0xa9')];return _0x4bf3a5;}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x3b')]=function(){var _0x5af453=this;setInterval(function(){_0x5af453['clearZombieChannels'](_0x5af453[_0x0a9e('0xaa')],_0x0a9e('0xab'));_0x5af453[_0x0a9e('0xac')](_0x5af453['actions'],_0x0a9e('0xad'));},0x32c8);};Dialer[_0x0a9e('0x1a')]['clearZombieChannels']=function(_0x4e46b2,_0xf0a802){var _0x56acca=this;for(var _0x5ea541 in _0x4e46b2){if(typeof _0x4e46b2[_0x5ea541]!=='undefined'){this[_0x0a9e('0xae')][_0x0a9e('0x1b')](function(){if(!_[_0x0a9e('0xaf')](_0x4e46b2[_0x5ea541])){return ami[_0x0a9e('0xb0')]({'action':_0x0a9e('0xb1'),'channel':_0x4e46b2[_0x5ea541][_0x0a9e('0xb2')]})['catch'](function(_0x5fd5db){if(_0x5fd5db['message']===_0x0a9e('0xb3')){setTimeout(function(){if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca['voiceQueues'][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb6'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541]['queue']);delete _0x4e46b2[_0x5ea541];}if(_0x4e46b2[_0x5ea541]&&_0x4e46b2[_0x5ea541][_0x0a9e('0x4d')]===_0x0a9e('0x7e')){_0x56acca[_0x0a9e('0xb4')](_0x56acca[_0x0a9e('0x1f')][_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]]);logger[_0x0a9e('0x98')](_0x0a9e('0xb7'),_0xf0a802,_0x5ea541,_0x4e46b2[_0x5ea541][_0x0a9e('0xb5')]);delete _0x4e46b2[_0x5ea541];}},0x2328);}});}});}}};Dialer['prototype'][_0x0a9e('0xb8')]=function(_0x3325c5){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xb8')](_0x3325c5))[_0x0a9e('0xba')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x0a9e('0x1a')]['checkIsBlackList']=function(_0x8c8fbe){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack[_0x0a9e('0xbc')](_0x8c8fbe))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbd')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xbe')]=function(_0x501050,_0x329d88,_0x31d25a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperAdditionalPhone[_0x0a9e('0xbe')](_0x501050,_0x329d88,_0x31d25a))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xbf')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc0')]=function(_0x31af8c,_0x151956,_0x3754e2){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperAdditionalPhone[_0x0a9e('0xc0')](_0x31af8c,_0x151956,_0x3754e2))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xc1')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc2')]=function(_0x5d9ddb){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperBlack['checkIsBlackListIvr'](_0x5d9ddb))[_0x0a9e('0xba')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc3')]=function(_0x1d93b1){return Promise[_0x0a9e('0xbb')]()['then'](cmHopperHistory[_0x0a9e('0xc4')](_0x1d93b1))['catch'](loggerCatch(_0x0a9e('0xc5')));};Dialer[_0x0a9e('0x1a')]['rescheduleContact']=function(_0x231c6a){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['rescheduleContact'](_0x231c6a))['catch'](loggerCatch(_0x0a9e('0xc6')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xc7')]=function(_0x413190,_0x3f2f40,_0x2450a8){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc7')](_0x413190,_0x3f2f40,_0x2450a8))['catch'](loggerCatch(_0x0a9e('0xc8')));};Dialer['prototype'][_0x0a9e('0xc9')]=function(_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5,_0x4e7273){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0xc9')](_0x2f7791,_0x34e745,_0x28ce92,_0x1b61d5))[_0x0a9e('0xba')](function(_0x2263f1){_0x4e7273['temp']-=_0x28ce92;_0x4e7273['temp']=_0x4e7273[_0x0a9e('0xca')]>0x0?_0x4e7273['temp']:0x0;loggerCatch(_0x0a9e('0xcb'))(_0x2263f1);});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcc')]=function(_0x16313e,_0x2ad54b,_0x213e5d,_0x596312){return Promise['resolve']()[_0x0a9e('0xb9')](cmHopper['getContactDialerIvr'](_0x16313e,_0x2ad54b,_0x213e5d))[_0x0a9e('0xba')](function(_0x5c689c){_0x596312[_0x0a9e('0xca')]-=_0x2ad54b;_0x596312['temp']=_0x596312['temp']>0x0?_0x596312[_0x0a9e('0xca')]:0x0;loggerCatch(_0x0a9e('0xcd'))(_0x5c689c);});};Dialer['prototype'][_0x0a9e('0xce')]=function(_0x17cb30){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](voiceQueueRt[_0x0a9e('0xce')](_0x17cb30))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xcf')]=function(_0x41c8cd){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper['moveContactManagedDialer'](_0x41c8cd))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd0')));};Dialer['prototype'][_0x0a9e('0xd1')]=function(_0x19fd11){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopperHistory[_0x0a9e('0xd1')](_0x19fd11))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xd2')));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xb4')]=function(_0x16afb3){if(!_['isUndefined'](_0x16afb3)&&_0x16afb3!==null){if(typeof _0x16afb3[_0x0a9e('0x76')]!==_0x0a9e('0x9b')){if(_0x16afb3[_0x0a9e('0x76')]>0x0){_0x16afb3[_0x0a9e('0x76')]-=0x1;}else{logger[_0x0a9e('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x0a9e('0xd3'));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd4')]=function(_0x2fea95,_0x34f7b5){var _0x59e46f=this;return function(_0x1339d0){_0x59e46f[_0x0a9e('0xb4')](_0x34f7b5);logger[_0x0a9e('0x98')](_0x2fea95,util['inspect'](_0x1339d0,{'showHidden':![],'depth':null}));};};Dialer[_0x0a9e('0x1a')]['emptyContact']=function(_0x2144ca,_0x4799d4,_0x25b745){var _0x42b833={'state':0x19,'statedesc':_0x0a9e('0xd5')};this['updateOriginated'](_0x4799d4);this[_0x0a9e('0xd6')](_['merge'](_0x42b833,_[_0x0a9e('0xd7')](_0x25b745,[_0x0a9e('0xd8'),_0x0a9e('0xd9'),_0x0a9e('0xda'),_0x0a9e('0xdb'),_0x0a9e('0xdc')])),_0x0a9e('0xdd'),_0x0a9e('0xde'));logger[_0x0a9e('0x98')](_0x2144ca);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xdf')]=function(_0xc876d4){return _0xc876d4===_0x0a9e('0xe0');};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xe1')]=function(_0x248368){return!_['isUndefined'](_0x248368)&&_0x248368&&!_['isUndefined'](_0x248368[_0x0a9e('0x41')])&&!_['isUndefined'](_0x248368[_0x0a9e('0x7b')])&&_0x248368[_0x0a9e('0x7b')]&&(this['trunks'][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])][_0x0a9e('0xb1')]==='reachable'||this[_0x0a9e('0x21')][util[_0x0a9e('0x7f')](_0x0a9e('0xe2'),_0x248368[_0x0a9e('0x41')])]['status']===_0x0a9e('0xe3'));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xd6')]=function(_0x5c838b,_0x2650eb,_0x270df8){this[_0x0a9e('0xd1')](_0x5c838b)['catch'](loggerCatch(_0x2650eb));this[_0x0a9e('0xcf')](_0x5c838b)[_0x0a9e('0xba')](loggerCatch(_0x270df8));};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x36')]=function(_0x2394d3){var _0x555780=this;var _0x3211d2=this[_0x0a9e('0xaa')][_0x2394d3['uniqueid']];var _0x3bab3e;if(!_[_0x0a9e('0xaf')](_0x2394d3)&&!_[_0x0a9e('0xaf')](_0x2394d3['variable'])&&!_['isNil'](_0x2394d3['variable'][_0x0a9e('0xe4')])&&_0x2394d3[_0x0a9e('0xe5')]==='xcally-motion-dialer'&&_0x3211d2){if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xe8')){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x3211d2['queue']][_0x0a9e('0x60')]+=0x1;this['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e[_0x0a9e('0xea')]=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]='AMD';ami[_0x0a9e('0xed')](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0xf1'),_0x0a9e('0xf2'));}if(_0x3211d2[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&this[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x3539b7,_0x57f0ad){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780[_0x0a9e('0xb4')](_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780[_0x0a9e('0x1e')][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x1a9ef1=_0x555780['voiceQueues'][_0x3211d2[_0x0a9e('0xb5')]];var _0x41e446=new Hangup(_0x3211d2,_0x2394d3);_0x41e446[_0x0a9e('0xa7')]=0x13;_0x41e446[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0x41e446[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0x41e446[_0x0a9e('0xf6')]+=0x1;_0x41e446[_0x0a9e('0xf7')]+=0x1;_0x41e446[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x41e446,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0x41e446)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x41e446['countbusyretry']+_0x41e446[_0x0a9e('0xf9')]+_0x41e446['countnoanswerretry']+_0x41e446['countnosuchnumberretry']+_0x41e446['countdropretry']+_0x41e446[_0x0a9e('0xfa')]+_0x41e446[_0x0a9e('0xf6')]+_0x41e446[_0x0a9e('0xfb')]>=_0x1a9ef1[_0x0a9e('0xfc')]){_0x555780['stateGlobal'](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0xfd'));}else{if(_0x41e446[_0x0a9e('0xf6')]>=_0x1a9ef1[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0x41e446,_0x3539b7,_0x57f0ad,_0x0a9e('0x100'));}else{_0x555780['rescheduleContact']({'active':![],'countmachineretry':_0x41e446['countmachineretry'],'scheduledat':moment()[_0x0a9e('0x101')](_0x1a9ef1[_0x0a9e('0x102')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x41e446[_0x0a9e('0xd8')],'ListId':_0x41e446[_0x0a9e('0xd9')],'VoiceQueueId':_0x41e446['VoiceQueueId']||undefined,'CampaignId':_0x41e446[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x3539b7({'reschedule':0x1});}}});}if(_0x3211d2['type']===_0x0a9e('0x7e')&&this[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]['dialAMDActive']&&_0x2394d3['value']==='HANGUP'){delete this[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1f')][_0x3211d2['queue']]);_0x3bab3e=new Hangup(_0x3211d2,_0x2394d3);_0x3bab3e[_0x0a9e('0xa7')]=0x12;_0x3bab3e['statedesc']=_0x0a9e('0xeb');_0x3bab3e[_0x0a9e('0xec')]=_0x0a9e('0xf5');ami['emit'](_0x0a9e('0xee'),ut[_0x0a9e('0xef')](_0x3bab3e,_0x0a9e('0xf0')));this['saveInDb'](_0x3bab3e,_0x0a9e('0x106'),'[syncHangupInAMDIvr]');}if(_0x3211d2[_0x0a9e('0x4d')]==='ivr'&&this[_0x0a9e('0x1f')][_0x3211d2['queue']][_0x0a9e('0xe6')]&&_0x2394d3[_0x0a9e('0xe7')]===_0x0a9e('0xf3')){return new Promise(function(_0x10ace8,_0x1e306c){delete _0x555780[_0x0a9e('0xaa')][_0x2394d3[_0x0a9e('0xe9')]];_0x555780['updateOriginated'](_0x555780[_0x0a9e('0x1f')][_0x3211d2[_0x0a9e('0xb5')]]);_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x60')]+=0x1;_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;var _0x16b578=_0x555780['campaigns'][_0x3211d2[_0x0a9e('0xb5')]];var _0xf49ed4=new Hangup(_0x3211d2,_0x2394d3);_0xf49ed4[_0x0a9e('0xa7')]=0x13;_0xf49ed4[_0x0a9e('0xea')]=_0x0a9e('0xf4');_0xf49ed4[_0x0a9e('0xec')]=_0x0a9e('0xf5');_0xf49ed4[_0x0a9e('0xf6')]+=0x1;_0xf49ed4[_0x0a9e('0xf7')]+=0x1;_0xf49ed4[_0x0a9e('0xf0')]=!![];ami['emit'](_0x0a9e('0xee'),ut['buildObj'](_0xf49ed4,_0x0a9e('0xf0')));_0x555780[_0x0a9e('0xd1')](_0xf49ed4)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0xf49ed4[_0x0a9e('0x107')]+_0xf49ed4[_0x0a9e('0xf9')]+_0xf49ed4['countnoanswerretry']+_0xf49ed4[_0x0a9e('0x108')]+_0xf49ed4[_0x0a9e('0x109')]+_0xf49ed4[_0x0a9e('0xfa')]+_0xf49ed4['countmachineretry']+_0xf49ed4[_0x0a9e('0xfb')]>=_0x16b578[_0x0a9e('0xfc')]){_0x555780[_0x0a9e('0x10a')](_0xf49ed4,_0x10ace8,_0x1e306c,_0x0a9e('0xfd'));}else{if(_0xf49ed4[_0x0a9e('0xf6')]>=_0x16b578[_0x0a9e('0xfe')]){_0x555780[_0x0a9e('0xff')](_0xf49ed4,_0x10ace8,_0x1e306c,'reason\x2019\x20machine....');}else{_0x555780[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0xf49ed4[_0x0a9e('0xf6')],'scheduledat':moment()[_0x0a9e('0x101')](_0x16b578[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0xf49ed4['ContactId'],'ListId':_0xf49ed4['ListId'],'VoiceQueueId':_0xf49ed4[_0x0a9e('0xdb')]||undefined,'CampaignId':_0xf49ed4[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));_0x10ace8({'reschedule':0x1});}}});}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x33')]=function(_0x609711){var _0x584854=this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];var _0x2d8e91;if(_0x584854&&_0x584854[_0x0a9e('0x4d')]===_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x609711[_0x0a9e('0xe9')]];this['updateOriginated'](this[_0x0a9e('0x1f')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1f')][_0x584854['queue']][_0x0a9e('0x10c')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this['moveContactManagedDialer'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this[_0x0a9e('0xaa')][_0x609711['uniqueid']];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x5f')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0x10;_0x2d8e91[_0x0a9e('0xea')]=_0x0a9e('0x110');_0x2d8e91['membername']=_0x0a9e('0x111');this['createHistory'](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x2d8e91)['catch'](loggerCatch(_0x0a9e('0x10e')));}if(_0x584854&&_0x584854[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')&&!isNotNull(this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x10f')])){delete this['uniqueId'][_0x609711[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]]);this[_0x0a9e('0x1e')][_0x584854[_0x0a9e('0xb5')]][_0x0a9e('0x6a')]+=0x1;_0x2d8e91=new Hangup(_0x584854,_0x609711);_0x2d8e91['state']=0xc;_0x2d8e91['statedesc']=_0x609711[_0x0a9e('0x112')];_0x2d8e91['membername']=_0x0a9e('0x113');this[_0x0a9e('0xd1')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x10d')));this[_0x0a9e('0xcf')](_0x2d8e91)[_0x0a9e('0xba')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x0a9e('0x1a')]['syncAgentComplete']=function(_0x50e32a){var _0x504403=this['uniqueId'][_0x50e32a[_0x0a9e('0xe9')]];if(this['voiceQueues'][_0x50e32a['queue']]){if(_0x504403&&_0x504403[_0x0a9e('0x4d')]!=='ivr'){delete this[_0x0a9e('0xaa')][_0x50e32a[_0x0a9e('0xe9')]];this[_0x0a9e('0x1e')][_0x50e32a['queue']][_0x0a9e('0x60')]+=0x1;var _0x1209c4=new AgentComplete(_0x504403,_0x50e32a);if(_0x50e32a[_0x0a9e('0x114')]==='agent'){_0x1209c4['agiafterat']=this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x115')]&&this[_0x0a9e('0x1e')][_0x50e32a[_0x0a9e('0xb5')]][_0x0a9e('0x116')]?moment()[_0x0a9e('0x7f')](_0x0a9e('0x104')):undefined;}this[_0x0a9e('0xd1')](_0x1209c4)[_0x0a9e('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1209c4)['catch'](loggerCatch(_0x0a9e('0x117')));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x2a')]=function(_0x2d21c7){if(this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]){if(this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]]&&this['uniqueId'][_0x2d21c7['uniqueid']][_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){this['updateOriginated'](this[_0x0a9e('0x1e')][_0x2d21c7[_0x0a9e('0xb5')]]);this[_0x0a9e('0xaa')][_0x2d21c7[_0x0a9e('0xe9')]][_0x0a9e('0x118')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));}}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x119')]=function(_0x400800,_0xbd1af3){this[_0x0a9e('0xd1')](_0x400800)['catch'](loggerCatch(_0x0a9e('0x11a')));if(_0xbd1af3==0x0){this[_0x0a9e('0xcf')](_0x400800)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x11b')));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x11c')]=function(_0x292e67){var _0x23bec3=this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];var _0x6b048e=this;var _0x3ba472=![];var _0x4e6eb9;var _0x572a72;if(this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]){if(_0x23bec3&&_0x23bec3[_0x0a9e('0x4d')]!==_0x0a9e('0x7e')){delete this[_0x0a9e('0xaa')][_0x292e67[_0x0a9e('0xe9')]];this[_0x0a9e('0xb4')](this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]);_0x23bec3['droptime']=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0x1e9f9f=new QueueCallerAbandon(_0x23bec3,_0x292e67);if(getSeconds(_0x23bec3[_0x0a9e('0x11d')],_0x23bec3[_0x0a9e('0x11e')])>=_0x23bec3[_0x0a9e('0x11f')]){this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x6f')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x64')]+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x70')]+=0x1;_0x1e9f9f[_0x0a9e('0xa7')]=0xa;_0x1e9f9f['statedesc']='Drop';_0x1e9f9f[_0x0a9e('0x120')]=_0x0a9e('0x121');_0x1e9f9f['agiafterat']=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x115')]?moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x1e9f9f[_0x0a9e('0x109')]+=0x1;_0x1e9f9f['countglobal']+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']][_0x0a9e('0x122')];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f['state'],_0x23bec3[_0x0a9e('0x124')])['then'](function(_0x505ffd){_0x3ba472=_0x505ffd[_0x0a9e('0x125')]==0x1;if(_0x1e9f9f[_0x0a9e('0x109')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x126')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x505ffd[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countdropretry':_0x1e9f9f[_0x0a9e('0x109')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x122')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));var _0x543b30=new History(_0x1e9f9f);_0x543b30[_0x0a9e('0xa7')]=0xa;_0x543b30['statedesc']='Drop';_0x543b30['starttime']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x543b30[_0x0a9e('0xa8')]=_0x543b30[_0x0a9e('0xa9')];_0x543b30[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x543b30[_0x0a9e('0x129')]=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x543b30)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12a')));}})[_0x0a9e('0xb9')](function(){if(_0x3ba472)_0x6b048e['swapAdditionalPhones'](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}else{this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12b')]+=0x1;_0x1e9f9f['state']=0xb;_0x1e9f9f[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x1e9f9f['dropreason']='CALLEREXIT';_0x1e9f9f[_0x0a9e('0xfa')]+=0x1;_0x1e9f9f[_0x0a9e('0xf7')]+=0x1;_0x4e6eb9=this[_0x0a9e('0x1e')][_0x292e67['queue']]['dialAbandonedRetryFrequency'];_0x572a72=this['voiceQueues'][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x123')];_0x6b048e[_0x0a9e('0xbe')](_0x1e9f9f,_0x1e9f9f[_0x0a9e('0xa7')],_0x23bec3[_0x0a9e('0x124')])[_0x0a9e('0xb9')](function(_0x183b9b){if(_0x1e9f9f[_0x0a9e('0xfa')]>=_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]][_0x0a9e('0x12d')]){_0x6b048e[_0x0a9e('0x119')](_0x1e9f9f,_0x183b9b[_0x0a9e('0x125')]);}else{_0x6b048e[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x1e9f9f[_0x0a9e('0xfa')],'scheduledat':moment()[_0x0a9e('0x101')](_0x6b048e[_0x0a9e('0x1e')][_0x292e67[_0x0a9e('0xb5')]]['dialAbandonedRetryFrequency'],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x23bec3[_0x0a9e('0xd8')],'ListId':_0x23bec3[_0x0a9e('0xd9')],'VoiceQueueId':_0x23bec3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x23bec3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x12e')));var _0x3a14d7=new History(_0x1e9f9f);_0x3a14d7[_0x0a9e('0xa7')]=0xb;_0x3a14d7[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x3a14d7[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x3a14d7['endtime']=_0x3a14d7['starttime'];_0x3a14d7[_0x0a9e('0x128')]=_0x1e9f9f[_0x0a9e('0x128')];_0x3a14d7['calleridnum']=_0x1e9f9f[_0x0a9e('0x129')];_0x6b048e[_0x0a9e('0xd1')](_0x3a14d7)['catch'](loggerCatch(_0x0a9e('0x12f')));}})['then'](function(){if(_0x3ba472)_0x6b048e[_0x0a9e('0xc0')](_0x1e9f9f,_0x4e6eb9,_0x572a72)[_0x0a9e('0xb9')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x0a9e('0x130')]=function(_0x31ab12){if(this['actions'][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0x24')][_0x31ab12['uniqueid']][_0x0a9e('0xb2')]=_0x31ab12[_0x0a9e('0xb2')];}if(this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]){this[_0x0a9e('0xaa')][_0x31ab12[_0x0a9e('0xe9')]]['channel']=_0x31ab12[_0x0a9e('0xb2')];}};Dialer[_0x0a9e('0x1a')]['syncQueueMember']=function(_0x3d63aa){if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x3d63aa['actionid']]&&_['isNil'](this['actions'][_0x3d63aa['actionid']][_0x0a9e('0x132')])&&_0x3d63aa[_0x0a9e('0xb1')]==='1'&&_0x3d63aa['paused']==='0'){if(this['agents'][_0x3d63aa[_0x0a9e('0x133')]]){if(!this['agents'][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]){this[_0x0a9e('0x20')][_0x3d63aa[_0x0a9e('0x133')]][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x132')]=!![];this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0x133')]=_0x3d63aa[_0x0a9e('0x133')];}}}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]||'rrmemory')===_0x0a9e('0x18')){if(this['actions'][_0x3d63aa[_0x0a9e('0x131')]]){if(this[_0x0a9e('0x20')][_0x3d63aa['stateinterface']]){this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]]['stateinterface']=_0x3d63aa[_0x0a9e('0x133')];if(_['isNil'](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa['actionid']][_0x0a9e('0xb5')]])){this['queueBooked'][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]=[];}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['push'](_[_0x0a9e('0x8f')](_[_0x0a9e('0xd7')](this[_0x0a9e('0x24')][_0x3d63aa[_0x0a9e('0x131')]],[_0x0a9e('0x135'),'stateinterface']),{'status':_0x3d63aa[_0x0a9e('0xb1')],'paused':_0x3d63aa['paused']}));}}}};function unlockQueueStatus(_0x5d1159,_0x3a459c){setTimeout(function(){if(_['isUndefined'](_0x5d1159[_0x0a9e('0x136')])){loggerBooked[_0x0a9e('0x98')]('[unlockQueueStatus][undefined]',_0x3a459c);}_0x5d1159[_0x0a9e('0x136')]=!![];loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x137'),_0x3a459c,JSON[_0x0a9e('0x4a')](_[_0x0a9e('0xd7')](_0x5d1159,[_0x0a9e('0x41'),_0x0a9e('0x136')])));},0x1f3);}Dialer[_0x0a9e('0x1a')][_0x0a9e('0x138')]=function(_0x5871d7){var _0x26f1c6=this;var _0x421b6c=_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]];if(strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]][_0x0a9e('0x4e')]]===_0x0a9e('0x19')){if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]){this[_0x0a9e('0x1d')][_0x0a9e('0x139')](this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x135')],this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')])[_0x0a9e('0xba')](function(_0x14444e){logger[_0x0a9e('0x98')](_0x0a9e('0x13a'),util[_0x0a9e('0x13b')](_0x14444e,{'showHidden':![],'depth':null}));})[_0x0a9e('0x13c')](function(){_0x26f1c6[_0x0a9e('0xb4')](_0x26f1c6[_0x0a9e('0x1e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]);_0x26f1c6[_0x0a9e('0x20')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0x133')]][_0x0a9e('0x132')]=![];delete _0x26f1c6[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]];unlockQueueStatus(_0x421b6c);});}else{this[_0x0a9e('0xb4')](this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]);this[_0x0a9e('0x10b')]({'active':![],'ContactId':this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xd8')],'ListId':this['actions'][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xd9')],'VoiceQueueId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdb')]||undefined,'CampaignId':this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x13d')));delete this[_0x0a9e('0x24')][_0x5871d7['actionid']];unlockQueueStatus(_0x421b6c);}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']][_0x0a9e('0x4e')]]||_0x0a9e('0x18'))===_0x0a9e('0x18')){var _0x1bf053;if(this['actions'][_0x5871d7[_0x0a9e('0x131')]]&&!_[_0x0a9e('0x48')](this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]]['queue']])){if(this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]){this[_0x0a9e('0x13e')][_0x26f1c6[_0x0a9e('0x24')][_0x5871d7['actionid']]['queue']]=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]?this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]:this['queueBooked'][this['actions'][_0x5871d7[_0x0a9e('0x131')]]['queue']]?this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]]['_rr']||0x0:0x0;}this[_0x0a9e('0x134')][this[_0x0a9e('0x24')][_0x5871d7['actionid']][_0x0a9e('0xb5')]]['_rr']=this[_0x0a9e('0x13e')][this[_0x0a9e('0x24')][_0x5871d7[_0x0a9e('0x131')]][_0x0a9e('0xb5')]];for(var _0x223e19=0x0;_0x223e19=0x0;})[_0x0a9e('0xba')](myreject(_0x1e30bc)));}}else{_0x1ebf20[_0x0a9e('0x150')](ami[_0x0a9e('0xb0')]({'action':'command','command':util[_0x0a9e('0x7f')](_0x0a9e('0x152'),_0x4ad6fc,!_[_0x0a9e('0x3e')](config['timezones'][_0xaa43da])?_0xaa43da:'')})[_0x0a9e('0xb9')](function(_0x4f8949){return _0x4f8949[_0x0a9e('0x156')][_0x0a9e('0x154')](_0x0a9e('0x155'))>=0x0;})['catch'](myreject(_0x1e30bc)));}Promise[_0x0a9e('0x157')](_0x1ebf20)[_0x0a9e('0xb9')](function(_0x310f89){var _0x1ecb3b=_[_0x0a9e('0x158')](_0x310f89);if(_0x1ecb3b){return _0xcdd954(_0x1ecb3b);}else{_0x2bc6a3[_0x0a9e('0x3f')]=_0x5174c5?'GLOBAL_INTERVAL_IS_OVERTIME':_0x0a9e('0x159');return _0x1e30bc(msgResponse(_0x0a9e('0x15a'),_0x0a9e('0x14c'),_0x0a9e('0x15b')+_0x5174c5+'\x20'+_0x2ee2fc+_0x0a9e('0x15c')+util[_0x0a9e('0x13b')](_0x4ad6fc,{'showHidden':![],'depth':null})+_0x0a9e('0x15d')+_0xaa43da));}})[_0x0a9e('0xba')](function(_0x597e99){return _0x1e30bc(msgResponse(_0x0a9e('0x14a'),_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0x597e99)));});});};Dialer[_0x0a9e('0x1a')]['checkDialMethod']=function(_0x388b9c){var _0x57c3c4=this;return function(){switch(_0x388b9c[_0x0a9e('0x5a')]){case _0x0a9e('0x15e'):freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;case'power':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,_0x388b9c[_0x0a9e('0x160')]);break;case _0x0a9e('0x8'):_0x57c3c4[_0x0a9e('0x8')](_0x388b9c);break;case'booked':freeVariablesPredictive(_0x388b9c);_0x57c3c4[_0x0a9e('0x15f')](_0x388b9c,0x1);break;default:freeVariablesPredictive(_0x388b9c);logger[_0x0a9e('0x98')](_0x0a9e('0x161'),_0x388b9c[_0x0a9e('0x41')],_0x0a9e('0x162'));}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x163')]=function(_0x5af336){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_0x5af336['id'],previewRecallmeReminderInterval))[_0x0a9e('0xb9')](function(_0x52cdf4){for(var _0x1b6dde=0x0;_0x1b6dde<_0x52cdf4['length'];_0x1b6dde++){var _0x2b8f51=_0x52cdf4[_0x1b6dde][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x2b8f51)io['to'](util[_0x0a9e('0x7f')](_0x0a9e('0x166'),_0x2b8f51))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x52cdf4[_0x1b6dde]});}})['catch'](function(){});};Dialer[_0x0a9e('0x1a')]['launchHandleIvr']=function(_0x382412){var _0x1612d8=this;return function(){_0x1612d8['handleIvr'](_0x382412);};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x168')]=function(_0x46f728){var _0x3b2dd9=this;if(isNotPreview(_0x46f728['dialMethod'])){if(isVoiceQueueOutbound(_0x46f728[_0x0a9e('0x4d')])&&isActive(_0x46f728[_0x0a9e('0x59')])){_0x46f728['sendMessageOneNotActive']=!![];Promise[_0x0a9e('0xbb')]()['then'](checkIsLoggedIn(_0x46f728,_0x46f728['loggedIn']))['then'](checkIsActive(_0x46f728,_0x46f728[_0x0a9e('0x59')]))[_0x0a9e('0xb9')](checkInterval(_0x46f728))['then'](_0x3b2dd9[_0x0a9e('0x147')](_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkIfTime'](_0x46f728[_0x0a9e('0x169')],_0x46f728[_0x0a9e('0x16a')],_0x46f728[_0x0a9e('0x41')],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9[_0x0a9e('0x14b')](_0x46f728[_0x0a9e('0x44')],_0x46f728[_0x0a9e('0x16a')],_0x46f728['name'],_0x46f728))[_0x0a9e('0xb9')](_0x3b2dd9['checkDialMethod'](_0x46f728))[_0x0a9e('0xba')](loggerCatchQueueSummary(_0x0a9e('0x16b'),_0x46f728));}else{notSendMessagesQueue(_0x46f728);}}else{freeVariablesPredictive(_0x46f728);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x32')]=_[_0x0a9e('0x16c')](function(){var _0x184453=_['filter'](this[_0x0a9e('0x1e')],function(_0x2af0c6){return _0x2af0c6[_0x0a9e('0x16d')];});var _0x53e92b=_[_0x0a9e('0x16e')](this[_0x0a9e('0x20')],function(_0xd886e5){return _0xd886e5[_0x0a9e('0x16f')]&&_0xd886e5[_0x0a9e('0xb1')]===_0x0a9e('0x170');});if(_0x184453[_0x0a9e('0x9a')]>0x0&&_0x53e92b[_0x0a9e('0x9a')]>0x0){return Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](cmHopper[_0x0a9e('0x164')](_[_0x0a9e('0x171')](_0x184453,'id'),previewRecallmeReminderInterval,_[_0x0a9e('0x171')](_0x53e92b,'id')))[_0x0a9e('0xb9')](function(_0x3e31dc){for(var _0x2efc65=0x0;_0x2efc65<_0x3e31dc['length'];_0x2efc65++){var _0x20ebd0=_0x3e31dc[_0x2efc65][_0x0a9e('0x165')][_0x0a9e('0x41')];if(_0x20ebd0)io['to'](util['format'](_0x0a9e('0x166'),_0x20ebd0))[_0x0a9e('0xed')](_0x0a9e('0x167'),{'hopper':_0x3e31dc[_0x2efc65]});}})[_0x0a9e('0xba')](function(_0x56f175){logger[_0x0a9e('0x98')](_0x0a9e('0x163'),_0x56f175);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0a9e('0x1a')][_0x0a9e('0x172')]=function(){var _0x4e8eb9=this;var _0x2b263b;for(var _0x1634cc in this[_0x0a9e('0x1f')]){if(typeof this[_0x0a9e('0x1f')][_0x1634cc]!=='undefined'){_0x2b263b=this['campaigns'][_0x1634cc];if(isCampaignIvr(_0x2b263b[_0x0a9e('0x4d')])&&isActive(_0x2b263b[_0x0a9e('0x7b')])){_0x2b263b[_0x0a9e('0xa1')]=!![];Promise[_0x0a9e('0xbb')]()[_0x0a9e('0xb9')](checkIsActive(_0x2b263b,_0x2b263b[_0x0a9e('0x7b')]))[_0x0a9e('0xb9')](checkInterval(_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x147')](_0x2b263b))[_0x0a9e('0xb9')](_0x4e8eb9[_0x0a9e('0x173')](_0x2b263b[_0x0a9e('0x169')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b[_0x0a9e('0x41')],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x14b')](_0x2b263b[_0x0a9e('0x44')],_0x2b263b[_0x0a9e('0x16a')],_0x2b263b['name'],_0x2b263b))['then'](_0x4e8eb9[_0x0a9e('0x174')](_0x2b263b))['catch'](loggerCatchQueueSummary(_0x0a9e('0x175'),_0x2b263b));}else{notSendMessagesCampaign(_0x2b263b);}}}};function getCallerIdRandom(_0xe81ac2,_0x2e3df6){var _0x12a7e;var _0x56caca;var _0x59ce14;if(_0x2e3df6<=0x0){_0x2e3df6=0x1;}_0x12a7e=new RegExp(_0x0a9e('0x176')+_0x2e3df6+'}$');_0x56caca=Math[_0x0a9e('0x177')](0xa,_0x2e3df6-0x1);_0x59ce14=Math[_0x0a9e('0x177')](0xa,_0x2e3df6)-0x1;return util[_0x0a9e('0x7f')]('%s',_['replace'](_0xe81ac2,_0x12a7e,_[_0x0a9e('0x178')](_0x56caca,_0x59ce14)));}function extractCalleridName(_0xc1811b){var _0xa64f55=_0xc1811b[_0x0a9e('0x179')](/"(.*?)"/);return _0xa64f55?_0xa64f55[0x1]:_0xc1811b;}Dialer[_0x0a9e('0x1a')]['actionOriginate']=function(_0x5cfe15,_0x35b0e6){var _0x3cfcc3=this;var _0x45aa98=uuid['v4']();this[_0x0a9e('0x24')][_0x45aa98]=new Action(_0x5cfe15,_0x35b0e6,_0x45aa98);return new Promise(function(_0x126620,_0x25f447){if(_[_0x0a9e('0x3e')](_0x5cfe15)&&typeof _0x5cfe15!=='object'){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),_0x0a9e('0x17b')));}if(_['isUndefined'](_0x35b0e6['phone'])||_0x35b0e6['phone']===null){return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x14c'),'contact\x20is\x20undefine'));}var _0x419d9e={'XMD-CALLERID':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AGI':_0x5cfe15['dialQueueProject']?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15[_0x0a9e('0x10f')]):_0x0a9e('0x17e'),'XMD-AGIAFTER':_0x5cfe15[_0x0a9e('0x115')]?util['format'](_0x0a9e('0x17d'),ipAgi,_0x5cfe15['dialQueueProject2']):'NONE','XMD-QUEUE':_0x5cfe15[_0x0a9e('0x4d')]==='outbound'?util[_0x0a9e('0x7f')](_0x0a9e('0x17f'),_0x5cfe15[_0x0a9e('0x41')],_0x5cfe15['dialQueueOptions']||'',_0x5cfe15[_0x0a9e('0x116')]?'c':'',_0x5cfe15[_0x0a9e('0x11f')]||0x3):_0x0a9e('0x17e'),'XMD-CONTACTID':_0x35b0e6['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x17c')](),'XMD-AMD':_0x5cfe15[_0x0a9e('0xe6')]?_0x0a9e('0x180'):_0x0a9e('0x17e'),'XMD-DESTINATION':_0x0a9e('0x181')};if(_0x5cfe15['dialAMDActive']){_0x419d9e['XMD-AMDINITIALSILENCE']=_0x5cfe15[_0x0a9e('0x182')]||0x9c4;_0x419d9e[_0x0a9e('0x183')]=_0x5cfe15['dialAMDGreeting']||0x5dc;_0x419d9e['XMD-AMDAFTERGREETINGSILENCE']=_0x5cfe15['dialAMDAfterGreetingSilence']||0x320;_0x419d9e['XMD-AMDTOTALANALYSISTIME']=_0x5cfe15['dialAMDTotalAnalysisTime']||0x1388;_0x419d9e['XMD-AMDMINWORDLENGTH']=_0x5cfe15[_0x0a9e('0x184')]||0x64;_0x419d9e['XMD-AMDBETWEENWORDSSILENCE']=_0x5cfe15[_0x0a9e('0x185')]||0x32;_0x419d9e[_0x0a9e('0x186')]=_0x5cfe15[_0x0a9e('0x187')]||0x3;_0x419d9e[_0x0a9e('0x188')]=_0x5cfe15[_0x0a9e('0x189')]||0x100;_0x419d9e[_0x0a9e('0x18a')]=_0x5cfe15[_0x0a9e('0x18b')]||0x1388;}if(_0x5cfe15['type']===_0x0a9e('0x18c')){_0x419d9e[_0x0a9e('0x18d')]=_0x35b0e6[_0x0a9e('0xdb')];}else{_0x419d9e[_0x0a9e('0x18e')]=_0x35b0e6[_0x0a9e('0xdc')];}for(var _0x3d2589 in _0x35b0e6[_0x0a9e('0x18f')]){if(typeof _0x35b0e6[_0x0a9e('0x18f')][_0x3d2589]!==_0x0a9e('0x9b')){if(isNotNull(_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589])&&_0x3d2589!=='id'&&_0x3d2589!==_0x0a9e('0x190')&&_0x3d2589!=='createdAt'&&_0x3d2589!==_0x0a9e('0x191')){_0x419d9e[util[_0x0a9e('0x7f')]('%s%s',_0x0a9e('0x192'),_['toUpper'](_0x3d2589))]=_0x35b0e6[_0x0a9e('0x18f')][_0x3d2589];}}}var _0x34b3d8=_0x3cfcc3['isTrunkReachable'](_0x5cfe15['Trunk'])?getCallerId(_0x5cfe15[_0x0a9e('0x7a')]['callerid'],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15[_0x0a9e('0x193')]):_0x5cfe15[_0x0a9e('0x5c')]):getCallerId(_['isNil'](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15['Trunk']['callerid']:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x195')],_0x5cfe15[_0x0a9e('0x5b')],_0x5cfe15[_0x0a9e('0x193')]>0x0?getCallerIdRandom(_0x5cfe15[_0x0a9e('0x5c')],_0x5cfe15['dialRandomLastDigitCallerIdNumber']):_0x5cfe15[_0x0a9e('0x5c')]);if(_0x34b3d8){_0x419d9e[_0x0a9e('0x196')]=_0x3cfcc3[_0x0a9e('0x24')][_0x45aa98][_0x0a9e('0x197')]=extractCalleridName(_0x34b3d8);_0x419d9e['XMD-ORIGINATECALLERIDNUM']=_0x35b0e6[_0x0a9e('0x198')];}_0x5cfe15[_0x0a9e('0x199')]=_0x419d9e;return ami['Action']({'actionid':_0x45aa98,'action':_0x0a9e('0x17a'),'channel':_0x3cfcc3[_0x0a9e('0xe1')](_0x5cfe15[_0x0a9e('0x7a')])?util[_0x0a9e('0x7f')]('SIP/%s/%s%s',_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15['dialCutDigit']>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15['dialCutDigit']):_0x35b0e6[_0x0a9e('0x198')]):util['format'](_0x0a9e('0x19c'),_[_0x0a9e('0xaf')](_0x5cfe15[_0x0a9e('0x194')])?_0x5cfe15[_0x0a9e('0x7a')][_0x0a9e('0x41')]:_0x5cfe15[_0x0a9e('0x194')][_0x0a9e('0x41')],isNotNull(_0x5cfe15[_0x0a9e('0x5e')])?_0x5cfe15[_0x0a9e('0x5e')][_0x0a9e('0x19a')]()||'':'',_0x5cfe15[_0x0a9e('0x19d')]>0x0?_0x35b0e6[_0x0a9e('0x198')][_0x0a9e('0x19b')](_0x5cfe15[_0x0a9e('0x19d')]):_0x35b0e6[_0x0a9e('0x198')]),'callerid':_0x34b3d8,'Exten':'xcally-motion-dialer','Context':_0x0a9e('0x19e'),'Priority':'1','variable':_0x419d9e,'timeout':(_0x5cfe15[_0x0a9e('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x45aa98})[_0x0a9e('0xb9')](function(_0xf35801){return _0x126620(_0xf35801);})[_0x0a9e('0xba')](function(_0x3d7d73){_0x5cfe15[_0x0a9e('0x67')]+=0x1;var _0x1fbf62=new History(_0x3cfcc3['actions'][_0x45aa98]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x0a9e('0x4a')](_0x3d7d73)));_0x1fbf62['state']=0xe;_0x1fbf62['statedesc']='OriginateError';_0x1fbf62[_0x0a9e('0xa9')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));_0x1fbf62[_0x0a9e('0xa8')]=_0x1fbf62['starttime'];_0x3cfcc3['createHistory'](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x19f')));_0x3cfcc3[_0x0a9e('0xcf')](_0x1fbf62)[_0x0a9e('0xba')](loggerCatch('[originate][error]'))[_0x0a9e('0x13c')](function(){delete _0x3cfcc3[_0x0a9e('0x24')][_0x45aa98];return _0x25f447(msgResponse(_0x0a9e('0x17a'),_0x0a9e('0x49'),_0x0a9e('0x1a0')));});});});};Dialer[_0x0a9e('0x1a')]['syncOriginateResponse']=function(_0x298a78){var _0x5056d5=this['actions'][_0x298a78[_0x0a9e('0x131')]];if(_0x5056d5){delete this['actions'][_0x298a78[_0x0a9e('0x131')]];_0x5056d5[_0x0a9e('0x11e')]=moment()[_0x0a9e('0x7f')](_0x0a9e('0x104'));var _0xe87eb3=_0x5056d5[_0x0a9e('0x4d')]===_0x0a9e('0x7e')?this[_0x0a9e('0x1f')][_0x5056d5[_0x0a9e('0xb5')]]:this['voiceQueues'][_0x5056d5[_0x0a9e('0x1a1')]()];if(!this[_0x0a9e('0xdf')](_0x298a78['response'])){this[_0x0a9e('0xb4')](_0xe87eb3);return this[_0x0a9e('0x1a2')](_0x5056d5,_0xe87eb3,_0x298a78)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a3')));}this['uniqueId'][_0x298a78[_0x0a9e('0xe9')]]=_0x5056d5;}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1a4')]=function(_0x44b14c,_0x1aa179,_0x5840d5){var _0x4c08b3=new History(_0x1aa179);if(_0x4c08b3[_0x0a9e('0x107')]+_0x4c08b3['countcongestionretry']+_0x4c08b3[_0x0a9e('0x1a5')]+_0x4c08b3['countnosuchnumberretry']+_0x4c08b3[_0x0a9e('0x109')]+_0x4c08b3['countabandonedretry']+_0x4c08b3[_0x0a9e('0xf6')]+_0x4c08b3['countagentrejectretry']>=_0x5840d5[_0x0a9e('0xfc')]-0x1){return!![];}switch(_0x44b14c){case 0x3:if(_0x4c08b3[_0x0a9e('0x1a5')]>=_0x5840d5[_0x0a9e('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4c08b3['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5['dialNoAnswerRetryFrequency'],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1a7')));break;case 0x5:if(_0x4c08b3[_0x0a9e('0x107')]>=_0x5840d5[_0x0a9e('0x1a8')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countbusyretry':_0x4c08b3[_0x0a9e('0x107')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1a9')],_0x0a9e('0x103'))['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4c08b3[_0x0a9e('0xf9')]>=_0x5840d5['dialCongestionMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countcongestionretry':_0x4c08b3['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1aa')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3['CampaignId']||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ab')));break;case 0x0:if(_0x4c08b3['countnosuchnumberretry']>=_0x5840d5[_0x0a9e('0x1ac')]-0x1){return!![];}else{this[_0x0a9e('0x10b')]({'active':![],'countnosuchnumberretry':_0x4c08b3[_0x0a9e('0x108')]+=0x1,'scheduledat':moment()['add'](_0x5840d5['dialNoSuchNumberRetryFrequency'],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1ad')));}break;case 0xa:if(_0x4c08b3['countdropretry']>=_0x5840d5[_0x0a9e('0x126')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4c08b3['countdropretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x122')],'minutes')['format'](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3['VoiceQueueId']||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x127')));break;case 0xb:if(_0x4c08b3['countabandonedretry']>=_0x5840d5['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countabandonedretry':_0x4c08b3[_0x0a9e('0xfa')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1ae')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3['ContactId'],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x12e')));break;case 0x13:if(_0x4c08b3[_0x0a9e('0xf6')]>=_0x5840d5[_0x0a9e('0xfe')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countmachineretry':_0x4c08b3[_0x0a9e('0xf6')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x102')],_0x0a9e('0x103'))[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3[_0x0a9e('0xd9')],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x105')));break;case 0x14:if(_0x4c08b3[_0x0a9e('0xfb')]>=_0x5840d5[_0x0a9e('0x1af')]-0x1){return!![];}this[_0x0a9e('0x10b')]({'active':![],'countagentrejectretry':_0x4c08b3[_0x0a9e('0xfb')]+=0x1,'scheduledat':moment()[_0x0a9e('0x101')](_0x5840d5[_0x0a9e('0x1b0')],'minutes')[_0x0a9e('0x7f')](_0x0a9e('0x104')),'ContactId':_0x4c08b3[_0x0a9e('0xd8')],'ListId':_0x4c08b3['ListId'],'VoiceQueueId':_0x4c08b3[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c08b3[_0x0a9e('0xdc')]||undefined})[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1b1')));break;default:return!![];}};Dialer['prototype'][_0x0a9e('0x1a2')]=function(_0x174487,_0x5cacc0,_0x15f892){var _0x22b47b=this;var _0x57d648=new History(_0x174487);var _0x4b24bd=![];var _0x5a7379;var _0x34f612;return new Promise(function(_0x2d6673,_0x25bc80){if(_['isUndefined'](_0x5cacc0)&&typeof _0x5cacc0!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0x14c'),_0x0a9e('0x1b3')));}if(_[_0x0a9e('0x3e')](_0x15f892)&&typeof _0x15f892!=='object'){return _0x25bc80(msgResponse(_0x0a9e('0x1b2'),'Failure','evt\x20is\x20undefine'));}_0x22b47b[_0x0a9e('0xbe')](_0x57d648,_0x15f892[_0x0a9e('0x114')],_0x5cacc0)[_0x0a9e('0xb9')](function(_0x5763cb){if(_0x5763cb[_0x0a9e('0x125')]==0x1)_0x4b24bd=!![];switch(_0x15f892[_0x0a9e('0x114')]){case'0':_0x5cacc0[_0x0a9e('0x66')]+=0x1;_0x57d648['state']=0x0;_0x57d648['statedesc']=_0x0a9e('0x1b4');_0x57d648[_0x0a9e('0x108')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x0a9e('0xef')](_0x174487,'nosuchnumber'));_0x5a7379=_0x5cacc0['dialNoSuchNumberRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0xf8')));if(_0x22b47b['checkRetriveMax'](0x0,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x108')]>=_0x5cacc0[_0x0a9e('0x1ac')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1b5'));}}break;case'3':_0x5cacc0[_0x0a9e('0x65')]+=0x1;_0x57d648['state']=0x3;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1b6');_0x57d648[_0x0a9e('0x1a5')]+=0x1;_0x57d648['countglobal']+=0x1;var _0x10f9fe=ut[_0x0a9e('0x1b7')](_0x174487,_0x5cacc0);ami[_0x0a9e('0xed')]('custom:agentnoanswer',_0x10f9fe);_0x5a7379=_0x5cacc0[_0x0a9e('0x1b8')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1b9')));if(_0x22b47b[_0x0a9e('0x1a4')](0x3,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x1a5')]>=_0x5cacc0[_0x0a9e('0x1a6')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1ba'));}}break;case'5':_0x5cacc0['outboundBusyCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x5;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1bb');_0x57d648[_0x0a9e('0x107')]+=0x1;_0x57d648['countglobal']+=0x1;ami[_0x0a9e('0xed')](_0x0a9e('0x1bc'),ut['buildObj'](_0x174487,_0x0a9e('0x1bd')));_0x5a7379=_0x5cacc0[_0x0a9e('0x1a9')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1be')));if(_0x22b47b[_0x0a9e('0x1a4')](0x5,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]>=_0x5cacc0['dialBusyMaxRetry']){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x205\x20busy');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1bf'));}}break;case'8':_0x5cacc0['outboundCongestionCallsDay']+=0x1;_0x57d648[_0x0a9e('0xa7')]=0x8;_0x57d648[_0x0a9e('0xea')]='Congestion';_0x57d648[_0x0a9e('0xf9')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0['dialCongestionRetryFrequency'];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x174487,_0x0a9e('0x1c0')));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x1c1')));if(_0x22b47b[_0x0a9e('0x1a4')](0x8,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648['countcongestionretry']>=_0x5cacc0[_0x0a9e('0x1c2')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,'reason\x208\x20congestion');}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c3'));}}break;case'11':_0x5cacc0[_0x0a9e('0x1c4')]+=0x1;_0x57d648['state']=0xb;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x12c');_0x57d648[_0x0a9e('0xfa')]+=0x1;_0x57d648[_0x0a9e('0xf7')]+=0x1;_0x5a7379=_0x5cacc0[_0x0a9e('0x1ae')];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)['catch'](loggerCatch(_0x0a9e('0x12f')));if(_0x22b47b[_0x0a9e('0x1a4')](0xb,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfa')]>=_0x5cacc0[_0x0a9e('0x12d')]){_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}else{_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c5'));}}break;case'20':_0x5cacc0[_0x0a9e('0x69')]+=0x1;_0x57d648['state']=0x14;_0x57d648[_0x0a9e('0xea')]=_0x0a9e('0x1c6');_0x57d648[_0x0a9e('0xfb')]+=0x1;_0x57d648['countglobal']+=0x1;_0x5a7379=_0x5cacc0['dialAgentRejectRetryFrequency'];_0x34f612=_0x5cacc0['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0x0a9e('0xef')](_0x174487,'agentreject'));_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c7')));if(_0x22b47b[_0x0a9e('0x1a4')](0x14,_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0x1af')]){_0x22b47b['createStateFinal'](_0x57d648,_0x2d6673,_0x25bc80,_0x0a9e('0x1c8'));}else{_0x22b47b['stateGlobal'](_0x57d648,_0x2d6673,_0x25bc80,'reason\x2020\x20agentreject');}}break;default:_0x5cacc0[_0x0a9e('0x6a')]+=0x1;_0x57d648['state']=0xc;_0x57d648[_0x0a9e('0xea')]=_0x15f892['reason'];_0x5a7379=_0x5cacc0[_0x0a9e('0x1b0')];_0x34f612=_0x5cacc0[_0x0a9e('0x123')];_0x22b47b[_0x0a9e('0xd1')](_0x57d648)[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x1c9')));if(_0x22b47b['checkRetriveMax'](_0x15f892[_0x0a9e('0x114')],_0x174487,_0x5cacc0)&&!_0x4b24bd){if(_0x57d648[_0x0a9e('0x107')]+_0x57d648['countcongestionretry']+_0x57d648[_0x0a9e('0x1a5')]+_0x57d648[_0x0a9e('0x108')]+_0x57d648['countdropretry']+_0x57d648[_0x0a9e('0xfa')]+_0x57d648[_0x0a9e('0xf6')]+_0x57d648[_0x0a9e('0xfb')]>=_0x5cacc0[_0x0a9e('0xfc')]){_0x22b47b[_0x0a9e('0x10a')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892[_0x0a9e('0x114')]);}else{_0x22b47b[_0x0a9e('0xff')](_0x57d648,_0x2d6673,_0x25bc80,_0x15f892['reason']);}}}})[_0x0a9e('0xb9')](function(){if(_0x4b24bd){_0x22b47b[_0x0a9e('0xc0')](_0x57d648,_0x5a7379,_0x34f612)[_0x0a9e('0xb9')](function(){return _0x2d6673(0x1);});}});});};Dialer[_0x0a9e('0x1a')]['stateGlobal']=function(_0x19e176,_0x300474,_0x189e15,_0x12bc40){var _0x32c53e=new Final(_0x19e176);_0x32c53e[_0x0a9e('0xa7')]=0xf;_0x32c53e[_0x0a9e('0xea')]=_0x0a9e('0x1ca');this['createStateFinal'](_0x32c53e,_0x300474,_0x189e15,_0x12bc40);};Dialer[_0x0a9e('0x1a')][_0x0a9e('0xff')]=function(_0x315236,_0x4a80a0,_0x3da853,_0x101e33){this[_0x0a9e('0xcf')](_0x315236)[_0x0a9e('0xb9')](function(){return _0x4a80a0(msgResponse(_0x0a9e('0x1b2'),_0x0a9e('0xe0'),_0x101e33));})[_0x0a9e('0xba')](function(){return _0x3da853(msgResponse(_0x0a9e('0x1cb'),_0x0a9e('0x14c'),_0x0a9e('0x1cc')));});};Dialer['prototype'][_0x0a9e('0x8')]=function(_0x3a87e7){var _0x21f245=_0x3a87e7['dialPredictiveOptimizationPercentage']/0x64;var _0x4d473a=_0x3a87e7[_0x0a9e('0x64')]/(_0x3a87e7[_0x0a9e('0x64')]+_0x3a87e7[_0x0a9e('0x60')]);var _0x73014f=Math[_0x0a9e('0x1cd')](_0x3a87e7[_0x0a9e('0x74')]*(_0x3a87e7[_0x0a9e('0x1ce')]/0x64));var _0x236a28=Math[_0x0a9e('0x1cd')](_0x3a87e7['predictiveIntervalAvailable']*(_0x3a87e7[_0x0a9e('0x1cf')]/0x64));var _0x41ae51=_0x3a87e7['available']+_0x3a87e7[_0x0a9e('0x53')];var _0xa0ec15=Math['floor'](_0x3a87e7['erlangCalls']*_0x3a87e7[_0x0a9e('0x8d')]*_0x3a87e7[_0x0a9e('0x71')]*_0x3a87e7[_0x0a9e('0x72')]);if(_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){if(!_['isUndefined'](_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7['startPredictive']=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x0a9e('0x1d0'));}if(!_['isUndefined'](_0x3a87e7['handlePredictive'])){loggerPredictive['error'](_0x0a9e('0x1d1'),_0x0a9e('0x1d2'));clearInterval(_0x3a87e7[_0x0a9e('0x92')]);_0x3a87e7[_0x0a9e('0x92')]=undefined;}_0x3a87e7['startProgressive']=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1d3'),_0x3a87e7[_0x0a9e('0x79')]);this['handlePower'](_0x3a87e7,0x1);}else if(ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7['startProgressive'])){this[_0x0a9e('0x15f')](_0x3a87e7,0x1);loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x1d4'),_0x3a87e7[_0x0a9e('0x79')],_0x3a87e7[_0x0a9e('0x41')]);_0x3a87e7['erlangCalls']=0x0;_0x3a87e7[_0x0a9e('0x70')]=0x0;}else if(_0x21f245<_0x4d473a&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d7'),_0x0a9e('0x1d8'),_0x4d473a,'startProgressive',_0x3a87e7[_0x0a9e('0x41')]);}else if(_0xa0ec15<_0x3a87e7[_0x0a9e('0x70')]&&_0x3a87e7[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x1d9'),_0x0a9e('0x1da'),_0xa0ec15,_0x0a9e('0x1db'),_0x3a87e7[_0x0a9e('0x70')],_0x0a9e('0x79'),_0x3a87e7[_0x0a9e('0x41')]);}else if(!ifInterval(_0x3a87e7[_0x0a9e('0x1dc')],_0x3a87e7[_0x0a9e('0x79')])&&_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x27')])&&!_[_0x0a9e('0x3e')](_0x3a87e7[_0x0a9e('0x79')])){_0x3a87e7[_0x0a9e('0x27')]=moment()['format'](_0x0a9e('0x104'));loggerPredictive[_0x0a9e('0x82')](_0x3a87e7['name'],'started\x20in\x20predictive\x20at',_0x3a87e7['startPredictive']);this[_0x0a9e('0xc3')](_0x3a87e7[_0x0a9e('0x1dc')])['then'](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))['then'](this[_0x0a9e('0x1de')](_0x3a87e7))['catch'](loggerCatchPredictive(_0x0a9e('0x1df'),_0x3a87e7));}else if(!ifInterval(_0x3a87e7['dialPredictiveInterval'],_0x3a87e7[_0x0a9e('0x27')])){_0x3a87e7[_0x0a9e('0x70')]=0x0;_0x3a87e7[_0x0a9e('0x27')]=moment()[_0x0a9e('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e0'),_0x3a87e7['startPredictive']);clearInterval(_0x3a87e7['handlePredictive']);_0x3a87e7['handlePredictive']=undefined;this['averageHandleTime'](_0x3a87e7[_0x0a9e('0x1dc')])[_0x0a9e('0xb9')](this[_0x0a9e('0x1dd')](_0x3a87e7))[_0x0a9e('0xb9')](mergeDataErlangB(_0x3a87e7))[_0x0a9e('0xb9')](this['startMethodPredictive'](_0x3a87e7))[_0x0a9e('0xba')](loggerCatchPredictive(_0x0a9e('0x1e1'),_0x3a87e7));}else if(_0x3a87e7[_0x0a9e('0x74')]&&_0x41ae51<_0x3a87e7[_0x0a9e('0x74')]-_0x236a28){freeVariablesPredictive(_0x3a87e7);loggerPredictive['info'](_0x3a87e7[_0x0a9e('0x41')],_0x0a9e('0x1e2'),_0x41ae51,_0x0a9e('0x1e3'),_0x3a87e7[_0x0a9e('0x74')],'-',_0x236a28,'=',_0x3a87e7[_0x0a9e('0x74')]-_0x236a28,')');}else if(_0x3a87e7['predictiveIntervalAvailable']&&_0x41ae51>_0x3a87e7[_0x0a9e('0x74')]+_0x73014f){freeVariablesPredictive(_0x3a87e7);loggerPredictive[_0x0a9e('0x82')](_0x3a87e7[_0x0a9e('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x41ae51,_0x0a9e('0x1e4'),_0x3a87e7['predictiveIntervalAvailable'],'+',_0x73014f,'=',_0x3a87e7[_0x0a9e('0x74')]+_0x73014f,')');}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1dd')]=function(_0xda737b){var _0x415fce=this;return function(_0x59f11d){return new Promise(function(_0x4bacf7,_0x1428a7){_[_0x0a9e('0x8f')](_0xda737b,_0x59f11d[0x0]);if(checkGetDataPredictive(_0x59f11d[0x0])){var _0x44b401=_0xda737b[_0x0a9e('0x74')]=_0xda737b['talking']+_0xda737b[_0x0a9e('0xa2')];var _0x706802=_0xda737b[_0x0a9e('0x1dc')]*0x3c;var _0x5bba8b=_0x59f11d[0x0][_0x0a9e('0x6d')]+_0x59f11d[0x0]['predictiveIntervalAvgHoldtime'];var _0x479441=(_0x59f11d[0x0][_0x0a9e('0x6b')]+_0x59f11d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59f11d[0x0][_0x0a9e('0x6e')])/_0x59f11d[0x0][_0x0a9e('0x75')];_0xda737b[_0x0a9e('0x71')]=_0x479441>0x0?_0x479441:0x1;switch(_0xda737b['dialPredictiveOptimization']){case _0x0a9e('0x1d6'):var _0x25d456=_0xda737b[_0x0a9e('0x1e5')]/0x64;return _0x415fce[_0x0a9e('0x1e6')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x25d456)[_0x0a9e('0xb9')](function(_0x26fd45){return _0x4bacf7(_0x26fd45);});case _0x0a9e('0x1e7'):var _0x1c3f66=_0xda737b['dialPredictiveOptimizationPercentage']/0x64;return _0x415fce[_0x0a9e('0x1e8')](_0x44b401,_0x706802,_0x5bba8b,_0x479441,_0x1c3f66)[_0x0a9e('0xb9')](function(_0x3ea9f1){return _0x4bacf7(_0x3ea9f1);});default:return _0x1428a7(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),'Unknown\x20Predictive'));}}else{return _0x1428a7(msgResponse('[getDataPredictive]',_0x0a9e('0x14c'),'check\x20failure'));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1ea')]=function(_0x58b3f3){var _0x2eb471=this;return function(_0x239eef){return new Promise(function(_0xc91243,_0x49973b){_[_0x0a9e('0x8f')](_0x58b3f3,_0x239eef[0x0]);if(checkGetDataPredictive(_0x239eef[0x0])){loggerPredictive[_0x0a9e('0x82')](JSON[_0x0a9e('0x4a')](_0x239eef[0x0]));if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1d6')){return _0x2eb471[_0x0a9e('0xce')](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x305a4b){var _0x5695b6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x305a4b[0x0][_0x0a9e('0x1ec')];var _0x459efc=_0x58b3f3[_0x0a9e('0x1dc')]*0x3c;var _0x727652=_0x239eef[0x0]['predictiveIntervalAvgTalktime']+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x4fb1ea=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0][_0x0a9e('0x6f')]+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x43ff93=_0x58b3f3['dialPredictiveOptimizationPercentage']/0x64;_0x58b3f3[_0x0a9e('0x73')]=_0x305a4b[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x4fb1ea>0x0?_0x4fb1ea:0x1;return _0x2eb471[_0x0a9e('0x1e6')](_0x5695b6,_0x459efc,_0x727652,_0x4fb1ea,_0x43ff93);})['then'](function(_0x323936){return _0xc91243(_0x323936);})['catch'](function(_0x334e91){return _0x49973b(msgResponse(_0x0a9e('0x1ed'),'Failure',JSON[_0x0a9e('0x4a')](_0x334e91)));});}if(_0x58b3f3[_0x0a9e('0x1d5')]===_0x0a9e('0x1e7')){return _0x2eb471['getVoiceQueueRtPauses'](_0x58b3f3['id'])[_0x0a9e('0xb9')](function(_0x5608ed){var _0xdbcd6=_0x58b3f3[_0x0a9e('0x1eb')]-_0x5608ed[0x0]['outboundQueuePauses'];var _0x4df5cc=_0x58b3f3['dialPredictiveInterval']*0x3c;var _0x495820=_0x239eef[0x0][_0x0a9e('0x6d')]+_0x239eef[0x0][_0x0a9e('0x6c')];var _0x3d7fb6=(_0x239eef[0x0][_0x0a9e('0x6b')]+_0x239eef[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x239eef[0x0][_0x0a9e('0x6e')])/_0x239eef[0x0]['predictiveIntervalTotalCalls'];var _0x400b85=_0x58b3f3[_0x0a9e('0x1e5')]/0x64;_0x58b3f3['predictiveIntervalPauses']=_0x5608ed[0x0][_0x0a9e('0x1ec')]||0x0;_0x58b3f3[_0x0a9e('0x71')]=_0x3d7fb6>0x0?_0x3d7fb6:0x1;return _0x2eb471[_0x0a9e('0x1e8')](_0xdbcd6,_0x4df5cc,_0x495820,_0x3d7fb6,_0x400b85);})[_0x0a9e('0xb9')](function(_0x37c272){return _0xc91243(_0x37c272);})[_0x0a9e('0xba')](function(_0xf01ef8){return _0x49973b(msgResponse('[CatchErlangB]',_0x0a9e('0x14c'),JSON[_0x0a9e('0x4a')](_0xf01ef8)));});}}else{return _0x49973b(msgResponse(_0x0a9e('0x1e9'),_0x0a9e('0x14c'),_0x0a9e('0x1ee')));}});};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1de')]=function(_0xd66cc3){var _0x2dc3df=this;return function(){var _0x43fd4c=0x0;var _0x10e1b9=Math['floor'](_0xd66cc3[_0x0a9e('0x77')]*0x3e8);if(_0x10e1b9>0x0){_0x10e1b9=_0x10e1b9<0x64?0x64:_0x10e1b9;loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],_0x0a9e('0x1ef'),_0x10e1b9,_0x0a9e('0x4b'));_0xd66cc3[_0x0a9e('0x92')]=setInterval(function(){_0x2dc3df[_0x0a9e('0x92')](_0xd66cc3);loggerPredictiveCalls['info'](_0x0a9e('0x1f0'),_0x43fd4c+=0x1);},_0x10e1b9);}else{loggerPredictive[_0x0a9e('0x82')](_0xd66cc3[_0x0a9e('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1f1')]=function(_0x2e082a,_0x4c7e3b){var _0x5d3ad3=this;return function(_0x23b67e){if(_[_0x0a9e('0x48')](_0x23b67e)){if(_[_0x0a9e('0xaf')](_0x4c7e3b[_0x0a9e('0xda')])||!_0x4c7e3b[_0x0a9e('0x1f2')]){if(_0x2e082a['dialMethod']===_0x0a9e('0x7')){_0x2e082a['queueStatusComplete']=_[_0x0a9e('0x3e')](_0x2e082a[_0x0a9e('0x136')])?!![]:_0x2e082a['queueStatusComplete'];var _0x449dd9=uuid['v4']();_0x5d3ad3['actions'][_0x449dd9]=new Action(_0x2e082a,_0x4c7e3b,_0x449dd9);loggerBooked[_0x0a9e('0x82')](_0x0a9e('0x1f3'),_0x449dd9,'queueStatusComplete:\x20',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a['name']);if(_0x2e082a[_0x0a9e('0x136')]){_0x2e082a[_0x0a9e('0x136')]=![];_0x5d3ad3[_0x0a9e('0x134')][_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xb5')]]=[];ami[_0x0a9e('0xb0')]({'actionid':_0x449dd9,'action':'queuestatus','queue':_0x2e082a[_0x0a9e('0x41')]})[_0x0a9e('0xba')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3[_0x0a9e('0x10b')]({'active':![],'ContactId':_0x5d3ad3['actions'][_0x449dd9]['ContactId'],'ListId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9]['VoiceQueueId']||undefined,'CampaignId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];});}else{loggerBooked[_0x0a9e('0x82')]('[booked][checkContactBlack][else]',JSON[_0x0a9e('0x4a')](_0x2e082a[_0x0a9e('0x136')]),_0x0a9e('0x1f4'),_0x2e082a[_0x0a9e('0x41')]);_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);_0x5d3ad3['rescheduleContact']({'active':![],'ContactId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xd8')],'ListId':_0x5d3ad3['actions'][_0x449dd9][_0x0a9e('0xd9')],'VoiceQueueId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdb')]||undefined,'CampaignId':_0x5d3ad3[_0x0a9e('0x24')][_0x449dd9][_0x0a9e('0xdc')]||undefined})['catch'](loggerCatch(_0x0a9e('0x1f5')));delete _0x5d3ad3[_0x0a9e('0x24')][_0x449dd9];}}else{return _0x5d3ad3['actionOriginate'](_0x2e082a,_0x4c7e3b);}}else{if(getDiff(_0x4c7e3b['scheduledat'])<_0x2e082a[_0x0a9e('0x1f6')]*0x3c){if(_0x4c7e3b[_0x0a9e('0x165')]&&!_0x4c7e3b['Agent']['voicePause']){_0x5d3ad3[_0x0a9e('0x1d')][_0x0a9e('0x139')](_0x4c7e3b['id'])[_0x0a9e('0x13c')](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}else{_0x5d3ad3[_0x0a9e('0xc7')]({'active':![]},_0x4c7e3b['id'],0x1)['finally'](function(){_0x5d3ad3[_0x0a9e('0xb4')](_0x2e082a);});}}else{_0x2e082a['outboundReCallsDay']+=0x1;_0x5d3ad3['updateOriginated'](_0x2e082a);if(_0x2e082a[_0x0a9e('0x1f7')]){_0x5d3ad3['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c7e3b[_0x0a9e('0xd8')],'ListId':_0x4c7e3b['ListId'],'VoiceQueueId':_0x4c7e3b[_0x0a9e('0xdb')]||undefined,'CampaignId':_0x4c7e3b['CampaignId']||undefined})['catch'](loggerCatch(_0x0a9e('0x1f8')));_0x5d3ad3[_0x0a9e('0xd1')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1f9'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x5d3ad3[_0x0a9e('0xd6')](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fa'),0x16,'RecallFailedTimeout'),_0x0a9e('0x1fb'),'[Originate][HistoryRecallClose]');}}}}else{_0x2e082a[_0x0a9e('0x61')]+=0x1;_0x5d3ad3['saveInDb'](createObjHistory(_0x2e082a,_0x4c7e3b,_0x0a9e('0x1fc'),0xd,_0x0a9e('0x1fd')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1fe')]=function(_0x149a5d){var _0x2f8a0a=this;var _0x311544=_0x149a5d[_0x0a9e('0x1ff')]-_0x149a5d[_0x0a9e('0x76')]-_0x149a5d[_0x0a9e('0xca')];emitCampaignSummary(_0x149a5d);if(_0x311544>0x0){if(_0x311544>this[_0x0a9e('0x22')]){_0x311544=this[_0x0a9e('0x22')];}_0x149a5d[_0x0a9e('0xca')]+=_0x311544;this[_0x0a9e('0xcc')](_0x149a5d['id'],_0x311544,_0x149a5d[_0x0a9e('0x200')],_0x149a5d)[_0x0a9e('0xb9')](function(_0x2e8669){_0x149a5d['temp']-=_0x311544;_0x149a5d['temp']=_0x149a5d[_0x0a9e('0xca')]>0x0?_0x149a5d[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x2e8669)){_0x149a5d[_0x0a9e('0x3f')]=_0x0a9e('0x9f');logger['info'](_0x0a9e('0x201')+_0x149a5d['name']);}else{_0x149a5d[_0x0a9e('0x76')]+=_0x2e8669['length'];_0x149a5d[_0x0a9e('0x3f')]='RUNNING';for(var _0x50985c=0x0;_0x50985c<_0x2e8669[_0x0a9e('0x9a')];_0x50985c+=0x1){_0x149a5d[_0x0a9e('0x202')]+=0x1;if(_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c])||_[_0x0a9e('0xaf')](_0x2e8669[_0x50985c]['Contact'])||_['isNil'](_0x2e8669[_0x50985c][_0x0a9e('0x198')])){_0x2f8a0a['emptyContact'](_0x0a9e('0x203'),_0x149a5d,_0x2e8669[_0x50985c]);}else{_0x2f8a0a[_0x0a9e('0xc2')](_['pick'](_0x2e8669[_0x50985c],[_0x0a9e('0xdc'),'Contact.phone']))[_0x0a9e('0xb9')](_0x2f8a0a[_0x0a9e('0x1f1')](_0x149a5d,_0x2e8669[_0x50985c]))[_0x0a9e('0xba')](_0x2f8a0a[_0x0a9e('0xd4')](_0x0a9e('0x204'),_0x149a5d));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x205'),_0x149a5d,_0x311544));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x15f')]=function(_0x342861,_0x2d4b26){var _0x2070da=this;var _0x29930d=[];var _0x68d005=_0x2d4b26>=0x1?_0x2d4b26:0x1;if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x68d005=0x1;}var _0x5b42ef=Math[_0x0a9e('0x206')](_0x342861[_0x0a9e('0xa2')]*_0x68d005)-_0x342861[_0x0a9e('0x76')]-_0x342861['temp'];emitVoiceQueueSummary(_0x342861);if(_0x342861[_0x0a9e('0x207')]>0x0){var _0x312cf5=_0x342861[_0x0a9e('0x207')]-_0x342861[_0x0a9e('0x76')]-_0x342861[_0x0a9e('0x53')]-_0x342861[_0x0a9e('0xca')]-_0x342861[_0x0a9e('0x50')];if(_0x5b42ef>_0x312cf5){_0x5b42ef=_0x312cf5;}}if(_0x5b42ef>0x0){if(_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')){_0x5b42ef=0x1;}if(_0x5b42ef>this[_0x0a9e('0x22')]){_0x5b42ef=this[_0x0a9e('0x22')];}_0x342861['temp']+=_0x5b42ef;for(var _0x189849 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x189849]!=='undefined'){if(this[_0x0a9e('0x20')][_0x189849]['state']==='not_inuse'&&this[_0x0a9e('0x20')][_0x189849]['status']===_0x0a9e('0x170')){_0x29930d['push'](this[_0x0a9e('0x20')][_0x189849]['id']);}}}this[_0x0a9e('0xc9')](_0x342861['id'],_0x29930d,_0x5b42ef,_0x342861[_0x0a9e('0x200')],_0x342861)['then'](function(_0x1676f3){_0x342861['temp']-=_0x5b42ef;_0x342861['temp']=_0x342861[_0x0a9e('0xca')]>0x0?_0x342861[_0x0a9e('0xca')]:0x0;if(!checkContactEmpty(_0x1676f3)){_0x2070da[_0x0a9e('0xb8')](_0x342861)[_0x0a9e('0xb9')](sendMessageReschedule(_0x342861))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x342861['originated']+=_0x1676f3[_0x0a9e('0x9a')];_0x342861[_0x0a9e('0x3f')]=_0x342861[_0x0a9e('0x5a')]===_0x0a9e('0x7')?_0x0a9e('0x180'):'RUNNING';for(var _0xda6cd8=0x0;_0xda6cd8<_0x1676f3[_0x0a9e('0x9a')];_0xda6cd8+=0x1){if(_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x1676f3[_0xda6cd8][_0x0a9e('0x198')])){_0x2070da[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x342861,_0x1676f3[_0xda6cd8]);}else{_0x2070da[_0x0a9e('0xbc')](_[_0x0a9e('0xd7')](_0x1676f3[_0xda6cd8],[_0x0a9e('0xdb'),_0x0a9e('0x20a')]))['then'](_0x2070da['checkContactBlack'](_0x342861,_0x1676f3[_0xda6cd8]))[_0x0a9e('0xba')](_0x2070da[_0x0a9e('0xd4')]('[actionOriginate]\x20',_0x342861));}}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x20b'),_0x342861,_0x5b42ef));}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x92')]=function(_0x2fdb67){if(_0x2fdb67['dialLimitQueue']>0x0){var _0x5d85ab=_0x2fdb67['dialLimitQueue']-_0x2fdb67[_0x0a9e('0x76')]-_0x2fdb67[_0x0a9e('0x53')];if(_0x5d85ab>0x0){this[_0x0a9e('0x20c')](_0x2fdb67);}else{loggerPredictiveCalls[_0x0a9e('0x82')](_0x0a9e('0x20d'));}}else{this[_0x0a9e('0x20c')](_0x2fdb67);}};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x20c')]=function(_0x44c694){var _0x4ee67f=this;var _0x4a0c23=[];_0x44c694[_0x0a9e('0x76')]+=0x1;for(var _0x45fac7 in this[_0x0a9e('0x20')]){if(typeof this[_0x0a9e('0x20')][_0x45fac7]!==_0x0a9e('0x9b')){if(this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xa7')]===_0x0a9e('0x20e')&&this[_0x0a9e('0x20')][_0x45fac7][_0x0a9e('0xb1')]==='reachable'){_0x4a0c23[_0x0a9e('0x150')](this['agents'][_0x45fac7]['id']);}}}this['getContactDialer'](_0x44c694['id'],_0x4a0c23,0x1,_0x44c694[_0x0a9e('0x200')],_0x44c694)[_0x0a9e('0xb9')](function(_0x115423){if(!checkContactEmpty(_0x115423)){checkContactLowerLimitOriginate(_0x44c694,0x1,0x0);_0x4ee67f[_0x0a9e('0xb8')](_0x44c694)[_0x0a9e('0xb9')](sendMessageReschedule(_0x44c694))[_0x0a9e('0xba')](loggerCatch(_0x0a9e('0x208')));}else{_0x44c694[_0x0a9e('0x3f')]=_0x0a9e('0x20f');if(_['isNil'](_0x115423[0x0])||_[_0x0a9e('0xaf')](_0x115423[0x0][_0x0a9e('0x18f')])||_[_0x0a9e('0xaf')](_0x115423[0x0]['phone'])){_0x4ee67f[_0x0a9e('0x209')](_0x0a9e('0x203'),_0x44c694,_0x115423[0x0]);}else{_0x4ee67f['checkIsBlackList'](_['pick'](_0x115423[0x0],['VoiceQueueId','Contact.phone']))[_0x0a9e('0xb9')](_0x4ee67f[_0x0a9e('0x1f1')](_0x44c694,_0x115423[0x0]))['catch'](_0x4ee67f[_0x0a9e('0xd4')]('[actionOriginatePredictive]\x20',_0x44c694));}}})[_0x0a9e('0xba')](loggerGetContactDialer(_0x0a9e('0x210'),_0x44c694,0x1));emitVoiceQueueSummary(_0x44c694);};Dialer[_0x0a9e('0x1a')]['abandonmentRate']=function(_0x5976d2,_0x4165be,_0x14c011,_0xb68b,_0x42d9ca,_0x1a1cb2){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x211'));loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x212'),_0x5976d2);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x213'),_0x4165be);loggerPredictive['info'](_0x0a9e('0x214'),_0x14c011);loggerPredictive[_0x0a9e('0x82')]('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',_0xb68b);loggerPredictive['info'](_0x0a9e('0x215'),_0x42d9ca);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x3366f2,_0x31981e){if(_0x5976d2<=0x0||isNaN(_0x5976d2)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),_0x0a9e('0x216')+_0x5976d2));}if(_0x14c011<=0x0||isNaN(_0x14c011)){return _0x31981e(msgResponse('[abandonmentRate]',_0x0a9e('0x49'),'Ts\x20=\x20'+_0x14c011));}if(_0xb68b<=0x0||isNaN(_0xb68b)){return _0x31981e(msgResponse('[abandonmentRate]','Error',_0x0a9e('0x217')+_0xb68b));}if(_0x4165be<=0x0||isNaN(_0x4165be)){return _0x31981e(msgResponse(_0x0a9e('0x218'),'Error','interval\x20=\x20'+_0x4165be));}if(_0x42d9ca<=0x0||isNaN(_0x42d9ca)){return _0x31981e(msgResponse(_0x0a9e('0x218'),_0x0a9e('0x49'),_0x0a9e('0x219')+_0x42d9ca));}_0x1a1cb2=_0x1a1cb2||0x0;var _0x1682dc=0x1/_0x14c011;var _0x5db09e=0x0;var _0xe9bc8e=0x0;var _0x3eac52=0x0;var _0x12d833=0x0;for(var _0x483d88=0x0;_0x3eac52<_0x42d9ca;_0x483d88+=0x1){_0xe9bc8e=_0x483d88/_0x4165be;_0x5db09e=(_0xb68b*_0xe9bc8e+_0x1a1cb2)/_0x1682dc;_0x3eac52=erlangb(_0x5db09e,_0x5976d2);_0x12d833=_0x5db09e/_0x5976d2*(0x1-erlangb(_0x5db09e,_0x5976d2));}return _0x3366f2({'erlangCalls':_0x483d88,'erlangCallToSecond':_0x4165be/_0x483d88,'erlangAbandonmentRate':_0x3eac52,'erlangBusyFactor':_0x12d833});});};Dialer[_0x0a9e('0x1a')][_0x0a9e('0x1e8')]=function(_0x400f7a,_0x3a1953,_0x2cdbbf,_0x5a240f,_0x5b862a,_0x171660){loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21a'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x400f7a);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a1953);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x214'),_0x2cdbbf);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x21b'),_0x5a240f);loggerPredictive[_0x0a9e('0x82')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b862a);loggerPredictive[_0x0a9e('0x82')](_0x0a9e('0x87'));return new Promise(function(_0x34f39f,_0x2e40a9){if(_0x400f7a<=0x0||isNaN(_0x400f7a)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x216')+_0x400f7a));}if(_0x2cdbbf<=0x0||isNaN(_0x2cdbbf)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),_0x0a9e('0x49'),_0x0a9e('0x21d')+_0x2cdbbf));}if(_0x5a240f<=0x0||isNaN(_0x5a240f)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error',_0x0a9e('0x217')+_0x5a240f));}if(_0x3a1953<=0x0||isNaN(_0x3a1953)){return _0x2e40a9(msgResponse(_0x0a9e('0x21c'),'Error','interval\x20=\x20'+_0x3a1953));}if(_0x5b862a<=0x0||isNaN(_0x5b862a)){return _0x2e40a9(msgResponse('[busyFactor]',_0x0a9e('0x49'),_0x0a9e('0x21e')+_0x5b862a));}_0x171660=_0x171660||0x0;var _0x4dafc8=0x1/_0x2cdbbf;var _0x23fc30=0x0;var _0x5e2a11=0x0;var _0x58503f=0x0;var _0x4b1969=0x0;for(var _0x4e0508=0x0;_0x4b1969<_0x5b862a;_0x4e0508+=0x1){_0x5e2a11=_0x4e0508/_0x3a1953;_0x23fc30=(_0x5a240f*_0x5e2a11+_0x171660)/_0x4dafc8;_0x58503f=erlangb(_0x23fc30,_0x400f7a);_0x4b1969=_0x23fc30/_0x400f7a*(0x1-erlangb(_0x23fc30,_0x400f7a));}return _0x34f39f({'erlangCalls':_0x4e0508,'erlangCallToSecond':_0x3a1953/_0x4e0508,'erlangAbandonmentRate':_0x58503f,'erlangBusyFactor':_0x4b1969});});};module[_0x0a9e('0x21f')]=Dialer; \ No newline at end of file +var _0xb10b=['[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countdropretry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','dropreason','TIMEOUT','agiafterat','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','calleridnum','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','queueBooked','queueStatusComplete','[booked][unlockQueueStatus]','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','push','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','filter','online','map','Agent','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dropRate','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','Contact.phone','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\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\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','statedesc','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','value','state','HangupInAMD'];(function(_0x5bf259,_0x567c19){var _0x52b213=function(_0x8abb6a){while(--_0x8abb6a){_0x5bf259['push'](_0x5bf259['shift']());}};_0x52b213(++_0x567c19);}(_0xb10b,0x12a));var _0xbb10=function(_0x2272d7,_0x694f20){_0x2272d7=_0x2272d7-0x0;var _0x42697c=_0xb10b[_0x2272d7];return _0x42697c;};'use strict';var util=require(_0xbb10('0x0'));var _=require('lodash');var uuid=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var rr=require('rr');var md5=require(_0xbb10('0x3'));var Redis=require('ioredis');var ut=require(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var loggerBooked=require(_0xbb10('0x6'))(_0xbb10('0x8'));var loggerPredictive=require('../../../config/logger')(_0xbb10('0x9'));var loggerPredictiveCalls=require(_0xbb10('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbb10('0x6'))(_0xbb10('0xa'));var ami=require(_0xbb10('0xb'));config[_0xbb10('0xc')]=_[_0xbb10('0xd')](config[_0xbb10('0xc')],{'host':_0xbb10('0xe'),'port':0x18eb});var io=require(_0xbb10('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xbb10('0x10'));var cmHopperAdditionalPhone=require(_0xbb10('0x11'));var cmHopperBlack=require(_0xbb10('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xbb10('0x13'));var Action=require('./action');var History=require(_0xbb10('0x14'));var Final=require(_0xbb10('0x15'));var AgentComplete=require(_0xbb10('0x16'));var QueueCallerAbandon=require(_0xbb10('0x17'));var Hangup=require(_0xbb10('0x18'));var ipAgi=process[_0xbb10('0x19')]['XCALLY_IP_AGI']||_0xbb10('0x1a');var strategy={'rrmemory':_0xbb10('0x1b'),'roundrobin':_0xbb10('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbb10('0x1d')][_0xbb10('0x1e')]=function(_0x2f2ebf){this[_0xbb10('0x1f')]=this[_0xbb10('0x1f')]?this[_0xbb10('0x1f')][_0xbb10('0x20')](_0x2f2ebf):_0x2f2ebf();};function Dialer(_0x4a2bfc,_0x2eca0f){this[_0xbb10('0x21')]=new Sequence();this[_0xbb10('0x22')]=_0x2eca0f;this[_0xbb10('0x23')]=_0x4a2bfc[_0xbb10('0x23')];this[_0xbb10('0x24')]=_0x4a2bfc[_0xbb10('0x24')];this[_0xbb10('0x25')]=_0x4a2bfc[_0xbb10('0x25')];this[_0xbb10('0x26')]=_0x4a2bfc['trunks'];this[_0xbb10('0x27')]=config[_0xbb10('0x27')]||0x2;this[_0xbb10('0x28')]={};this[_0xbb10('0x29')]={};this[_0xbb10('0x2a')]={};this[_0xbb10('0x2b')]={};this['optionPredictive']={};this[_0xbb10('0x2c')]={};this[_0xbb10('0x2d')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xbb10('0x2e')]={};ami['on'](_0xbb10('0x2f'),this[_0xbb10('0x30')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x32'),this[_0xbb10('0x33')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x34'),this[_0xbb10('0x35')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x36'),this[_0xbb10('0x37')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x38'),this[_0xbb10('0x39')]['bind'](this));ami['on'](_0xbb10('0x3a'),this[_0xbb10('0x3b')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3c'),this[_0xbb10('0x3d')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3e'),this['syncVarSet'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3f'),this[_0xbb10('0x40')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x41'),this[_0xbb10('0x42')]['bind'](this));this[_0xbb10('0x43')]();this['loopClearZombieChannels']();RpcSetting[_0xbb10('0x44')]()['then'](function(_0x16ad2a){previewRecallmeReminderInterval=_0x16ad2a[_0xbb10('0x45')];});}function isNotNull(_0x1b59f9){return _0x1b59f9!==null&&!_['isUndefined'](_0x1b59f9);}function checkIsLoggedIn(_0x518d47,_0x4c3744){return function(){if(_0x4c3744<=0x0){_0x518d47[_0xbb10('0x46')]='AGENTS_NOT_LOGGED';throw _0x518d47[_0xbb10('0x47')]+_0xbb10('0x48');}};}function isActive(_0x2f653f){return _0x2f653f;}function checkIsActive(_0x1c0b57,_0x37a83f){return function(){if(!isActive(_0x37a83f)){_0x1c0b57[_0xbb10('0x46')]=_0xbb10('0x49');throw _0x1c0b57['name']+_0xbb10('0x4a');}};}function checkInterval(_0x1da9c9){return function(){if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')])){_0x1da9c9[_0xbb10('0x46')]=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')][_0xbb10('0x4e')])){_0x1da9c9['message']=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_[_0xbb10('0x4f')](_0x1da9c9['Interval'][_0xbb10('0x4e')]))){_0x1da9c9['message']='INTERVAL_IS_NULL';throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}};}function msgResponse(_0x26e76a,_0x120d21,_0x15d895){return{'action':_0x26e76a,'response':_0x120d21,'message':_0x15d895,'stack':_0x15d895};}function myreject(_0x29d11a){return function(_0x547062){return _0x29d11a(msgResponse(_0xbb10('0x50'),_0xbb10('0x51'),JSON['stringify'](_0x547062)));};}function getSeconds(_0x5e3fbd,_0x5cd55f){var _0x31bee3=moment(_0x5e3fbd)[_0xbb10('0x52')](0x0);var _0x2b658a=moment(_0x5cd55f)['milliseconds'](0x0);return _0x31bee3[_0xbb10('0x53')](_0x2b658a,_0xbb10('0x54'));}function emit(_0x4345f3,_0x4d1a83,_0x17b6c5){io['to'](_0x4345f3)[_0xbb10('0x55')](_0x4d1a83,_0x17b6c5);}function emitVoiceQueueSummary(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x56')]==='outbound'){var _0xd238e9={'id':_0x1dcd38['id'],'name':_0x1dcd38[_0xbb10('0x47')],'strategy':_0x1dcd38['strategy'],'answered':_0x1dcd38[_0xbb10('0x57')],'available':_0x1dcd38[_0xbb10('0x58')],'loggedIn':_0x1dcd38[_0xbb10('0x59')],'pTalking':_0x1dcd38[_0xbb10('0x5a')],'sumBillable':_0x1dcd38[_0xbb10('0x5b')],'sumDuration':_0x1dcd38[_0xbb10('0x5c')],'sumHoldTime':_0x1dcd38['sumHoldTime']||0x0,'talking':_0x1dcd38[_0xbb10('0x5d')],'total':_0x1dcd38[_0xbb10('0x5e')],'type':_0x1dcd38[_0xbb10('0x56')],'unmanaged':_0x1dcd38[_0xbb10('0x5f')],'abandoned':_0x1dcd38['abandoned'],'waiting':_0x1dcd38[_0xbb10('0x60')],'loggedInDb':_0x1dcd38[_0xbb10('0x61')],'dialActive':_0x1dcd38[_0xbb10('0x62')],'dialMethod':_0x1dcd38[_0xbb10('0x63')],'dialOriginateCallerIdName':_0x1dcd38['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1dcd38[_0xbb10('0x64')],'dialOriginateTimeout':_0x1dcd38[_0xbb10('0x65')],'dialPrefix':_0x1dcd38['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1dcd38['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1dcd38[_0xbb10('0x66')],'outboundBlacklistCallsDay':_0x1dcd38['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1dcd38[_0xbb10('0x67')],'outboundCongestionCallsDay':_0x1dcd38[_0xbb10('0x68')],'outboundDropCallsDayACS':_0x1dcd38['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1dcd38[_0xbb10('0x69')],'outboundDropCallsDayTimeout':_0x1dcd38[_0xbb10('0x6a')],'outboundNoAnswerCallsDay':_0x1dcd38[_0xbb10('0x6b')],'outboundNoSuchCallsDay':_0x1dcd38['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1dcd38[_0xbb10('0x6c')],'outboundReCallsDay':_0x1dcd38[_0xbb10('0x6d')],'outboundRejectCallsDay':_0x1dcd38[_0xbb10('0x6e')],'outboundUnknownCallsDay':_0x1dcd38[_0xbb10('0x6f')],'predictiveIntervalAnsweredCalls':_0x1dcd38[_0xbb10('0x70')],'predictiveIntervalAvgHoldtime':_0x1dcd38[_0xbb10('0x71')],'predictiveIntervalAvgTalktime':_0x1dcd38[_0xbb10('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x1dcd38[_0xbb10('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x1dcd38[_0xbb10('0x74')],'predictiveIntervalErlangCalls':_0x1dcd38[_0xbb10('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x1dcd38[_0xbb10('0x76')],'predictiveIntervalHitRate':_0x1dcd38[_0xbb10('0x77')],'predictiveIntervalMultiplicativeFactor':_0x1dcd38['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1dcd38[_0xbb10('0x78')],'predictiveIntervalAvailable':_0x1dcd38[_0xbb10('0x79')],'predictiveIntervalTotalCalls':_0x1dcd38['predictiveIntervalTotalCalls'],'message':_0x1dcd38[_0xbb10('0x46')],'originated':_0x1dcd38[_0xbb10('0x7a')],'erlangCalls':_0x1dcd38[_0xbb10('0x7b')],'erlangCallToSecond':_0x1dcd38[_0xbb10('0x7c')],'erlangAbandonmentRate':_0x1dcd38[_0xbb10('0x7d')],'erlangBusyFactor':_0x1dcd38[_0xbb10('0x7e')],'startPredictive':_0x1dcd38[_0xbb10('0x2c')],'startProgressive':_0x1dcd38['startProgressive']};if(_0x1dcd38['Trunk']){_0xd238e9[_0xbb10('0x7f')]={'id':_0x1dcd38[_0xbb10('0x7f')]['id'],'name':_0x1dcd38[_0xbb10('0x7f')]['name'],'active':_0x1dcd38['Trunk'][_0xbb10('0x80')],'callerid':_0x1dcd38[_0xbb10('0x7f')][_0xbb10('0x81')]};}if(_0x1dcd38[_0xbb10('0x4b')]){_0xd238e9[_0xbb10('0x4b')]={'id':_0x1dcd38[_0xbb10('0x4b')]['id'],'name':_0x1dcd38[_0xbb10('0x4b')][_0xbb10('0x47')]};}var _0x2626d8=md5(JSON[_0xbb10('0x82')](_0xd238e9));if(_0x1dcd38['md5']!==_0x2626d8){_0x1dcd38['md5']=_0x2626d8;emit(util[_0xbb10('0x83')](_0xbb10('0x84'),_0xd238e9[_0xbb10('0x47')]),_0xbb10('0x85'),_0xd238e9);}}}function emitCampaignSummary(_0x36aa7d){if(_0x36aa7d[_0xbb10('0x56')]===_0xbb10('0x86')){emit(util[_0xbb10('0x83')](_0xbb10('0x87'),_0x36aa7d[_0xbb10('0x47')]),_0xbb10('0x88'),_0x36aa7d);}}function checkGetDataPredictive(_0x20e18a){if(isNotNull(_0x20e18a)&&!_[_0xbb10('0x4f')](_0x20e18a)){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8a'));loggerPredictive['info'](_0xbb10('0x8b'),_0x20e18a['predictiveIntervalTotalCalls']);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8c'),_0x20e18a[_0xbb10('0x70')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8d'),_0x20e18a[_0xbb10('0x74')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8e'),_0x20e18a[_0xbb10('0x73')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8f'),_0x20e18a[_0xbb10('0x71')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x90'),_0x20e18a[_0xbb10('0x72')]);loggerPredictive['info'](_0xbb10('0x91'));if(_0x20e18a[_0xbb10('0x92')]>0x0){if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x72')])&&_0x20e18a[_0xbb10('0x72')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x71')])&&_0x20e18a[_0xbb10('0x71')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')](_0xbb10('0x94'));}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x95'));}}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x96'));}return![];}function mergeDataErlangB(_0x40c4fb){return function(_0x2eb05a){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x97'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7b')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x98'),_0x2eb05a[_0xbb10('0x7c')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x99'),_0x2eb05a[_0xbb10('0x7e')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x9a'),_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive['info'](_0xbb10('0x91'));_[_0xbb10('0x9b')](_0x40c4fb,_0x2eb05a);};}function getDiff(_0x4917a5){var _0x5e03cb=moment()['milliseconds'](0x0);var _0x32c1e8=moment(_0x4917a5)[_0xbb10('0x52')](0x0);return _0x5e03cb[_0xbb10('0x53')](_0x32c1e8,'seconds');}function ifInterval(_0x4e6e7c,_0x5846d1){if(_[_0xbb10('0x93')](_0x5846d1)){return![];}return getDiff(_0x5846d1)<_0x4e6e7c*0x3c;}function freeVariablesPredictive(_0x249b33){if(isNotNull(_0x249b33)){if(!_[_0xbb10('0x93')](_0x249b33['startProgressive'])){_0x249b33[_0xbb10('0x2d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x2c')])){_0x249b33[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],_0xbb10('0x9c'));}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x9d')])){clearInterval(_0x249b33['handlePredictive']);_0x249b33[_0xbb10('0x9d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33[_0xbb10('0x47')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x2ca491,_0x31e85e){if(_0x31e85e===0x0){return 0x0;}var _0x3b0f08=0x1;for(var _0x37b65f=0x1;_0x37b65f<=_0x31e85e;_0x37b65f+=0x1){_0x3b0f08=0x1+_0x3b0f08*_0x37b65f/_0x2ca491;}return 0x1/_0x3b0f08;}function isVoiceQueueOutbound(_0x5e4a6e){return _0x5e4a6e===_0xbb10('0x9e');}function isNotPreview(_0x258e55){return _0x258e55!==_0xbb10('0x22');}function isCampaignIvr(_0x2d0f4b){return _0x2d0f4b==='ivr';}function getCallerId(_0x354ea7,_0x277fe7,_0x2a166e){if(!_[_0xbb10('0x93')](_0x2a166e)&&typeof _0x2a166e===_0xbb10('0x9f')&&!_[_0xbb10('0x4f')](_0x2a166e)){if(!_[_0xbb10('0x93')](_0x277fe7)&&typeof _0x277fe7==='string'&&!_['isEmpty'](_0x277fe7)){return util['format'](_0xbb10('0xa0'),_0x277fe7,_0x2a166e);}return util[_0xbb10('0x83')](_0xbb10('0xa0'),_0x2a166e,_0x2a166e);}if(!_['isUndefined'](_0x354ea7)&&typeof _0x354ea7==='string'&&!_[_0xbb10('0x4f')](_0x354ea7)){return _0x354ea7;}return _0xbb10('0xa1');}function loggerCatchQueueSummary(_0xd9e743,_0x3a9677){return function(_0x260e06){freeVariablesPredictive(_0x3a9677);emitVoiceQueueSummary(_0x3a9677);emitCampaignSummary(_0x3a9677);loggerSyncQueueSummary[_0xbb10('0xa2')](_0xd9e743,util['inspect'](_0x260e06,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a5ca5,_0x15fae2){return function(_0x270fdb){loggerPredictive[_0xbb10('0xa3')](_0x15fae2[_0xbb10('0x47')],_0x1a5ca5);loggerPredictive['error'](_0x270fdb['stack']);freeVariablesPredictive(_0x15fae2);};}function loggerCatch(_0x5ad6ad){return function(_0x329da7){logger[_0xbb10('0xa3')](_0x5ad6ad,util[_0xbb10('0xa4')](_0x329da7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x21459e){return _0x21459e&&!_[_0xbb10('0x93')](_0x21459e)&&_0x21459e[_0xbb10('0xa5')]>0x0;}function decremetOriginate(_0x5d942d){if(!_[_0xbb10('0x93')](_0x5d942d)&&_0x5d942d!==null){if(typeof _0x5d942d['originated']!=='undefined'){if(_0x5d942d['originated']>0x0){_0x5d942d[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xa6'));}}}else{logger[_0xbb10('0xa3')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x122d38,_0x5c583b,_0x576179){if(_0x5c583b>_0x576179){for(var _0x165fe9=0x0;_0x165fe9<_0x5c583b-_0x576179;_0x165fe9+=0x1){decremetOriginate(_0x122d38);}}}function loggerGetContactDialer(_0xfe3db0,_0x29529c,_0x2bd2ab){return function(_0xfa3c7c){checkContactLowerLimitOriginate(_0x29529c,_0x2bd2ab,0x0);logger['error'](_0xfe3db0,util[_0xbb10('0xa4')](_0xfa3c7c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x19fcec){return function(_0x2c6429){if(isNotNull(_0x2c6429)&&isNotNull(_0x2c6429[0x0])){if(_0x2c6429[0x0][_0xbb10('0xa7')]>0x0){_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xa8');logger[_0xbb10('0x89')]('[getContactDialer2][ReScheduled]'+_0x19fcec[_0xbb10('0x47')],_0x2c6429[0x0][_0xbb10('0xa7')],_0xbb10('0xa9'));}else{_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0xab')+_0x19fcec[_0xbb10('0x47')]);}}};}function notSendMessagesQueue(_0x5a4429){if(_0x5a4429[_0xbb10('0xac')]){freeVariablesPredictive(_0x5a4429);if(_0x5a4429[_0xbb10('0x7a')]===0x0&&_0x5a4429[_0xbb10('0x5d')]===0x0&&_0x5a4429['waiting']===0x0&&(_0x5a4429['pTalking']||0x0)===0x0){_0x5a4429['sendMessageOneNotActive']=![];_0x5a4429[_0xbb10('0x58')]=0x0;_0x5a4429['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x5a4429[_0xbb10('0x46')]=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a4429);}}function notSendMessagesCampaign(_0x318a14){if(_0x318a14[_0xbb10('0xac')]){if(_0x318a14[_0xbb10('0x7a')]===0x0){_0x318a14[_0xbb10('0xac')]=![];_0x318a14['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x318a14['message']=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xb1'));}emitCampaignSummary(_0x318a14);}}function createObjHistory(_0x517185,_0x5f0691,_0x372636,_0x53c698,_0x22c030){_0x517185['message']=_0x372636;var _0x256b35=new Action(_0x517185,_0x5f0691);var _0x13e2ab=new History(_0x256b35);_0x13e2ab['state']=_0x53c698;_0x13e2ab['statedesc']=_0x22c030;_0x13e2ab[_0xbb10('0xb2')]=_0x256b35[_0xbb10('0xb3')];return _0x13e2ab;}Dialer[_0xbb10('0x1d')]['loopClearZombieChannels']=function(){var _0x32d5a5=this;setInterval(function(){_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x2b')],_0xbb10('0xb5'));_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x29')],_0xbb10('0xb6'));},0x32c8);};Dialer[_0xbb10('0x1d')][_0xbb10('0xb4')]=function(_0x479d51,_0x3367d4){var _0x28cc46=this;for(var _0x412fbf in _0x479d51){if(typeof _0x479d51[_0x412fbf]!==_0xbb10('0xb7')){this[_0xbb10('0x21')][_0xbb10('0x1e')](function(){if(!_[_0xbb10('0xb8')](_0x479d51[_0x412fbf])){return ami[_0xbb10('0xb9')]({'action':_0xbb10('0xba'),'channel':_0x479d51[_0x412fbf][_0xbb10('0xbb')]})[_0xbb10('0xbc')](function(_0x2a4278){if(_0x2a4278['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]!==_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x23')][_0x479d51[_0x412fbf][_0xbb10('0xbe')]]);logger['error'](_0xbb10('0xbf'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf][_0xbb10('0xbe')]);delete _0x479d51[_0x412fbf];}if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]===_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x24')][_0x479d51[_0x412fbf]['queue']]);logger[_0xbb10('0xa3')](_0xbb10('0xc0'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf]['queue']);delete _0x479d51[_0x412fbf];}},0x2328);}});}});}}};Dialer[_0xbb10('0x1d')]['countReScheduled']=function(_0xc53c87){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xc3')](_0xc53c87))[_0xbb10('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbb10('0x1d')]['checkIsBlackList']=function(_0x3fcc55){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack['checkIsBlackList'](_0x3fcc55))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc4')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc5')]=function(_0x18d18d,_0x1cb22f,_0x1b6ebc){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc5')](_0x18d18d,_0x1cb22f,_0x1b6ebc))[_0xbb10('0xbc')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc6')]=function(_0x1b0a6c,_0xcd5d35,_0xfe02f5){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc6')](_0x1b0a6c,_0xcd5d35,_0xfe02f5))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc7')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc8')]=function(_0x499b9d){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack[_0xbb10('0xc8')](_0x499b9d))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc9')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xca')]=function(_0x5371d4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xcb')](_0x5371d4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xcc')));};Dialer[_0xbb10('0x1d')]['rescheduleContact']=function(_0x4bd470){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xcd')](_0x4bd470))['catch'](loggerCatch(_0xbb10('0xce')));};Dialer[_0xbb10('0x1d')]['unlockContact']=function(_0x2831de,_0xaede56,_0x5642c3){return Promise[_0xbb10('0xc1')]()['then'](cmHopper[_0xbb10('0xcf')](_0x2831de,_0xaede56,_0x5642c3))[_0xbb10('0xbc')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd0')]=function(_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83,_0x3e0e34){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper['getContactDialer'](_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83))[_0xbb10('0xbc')](function(_0x9f2e0f){_0x3e0e34[_0xbb10('0xd1')]-=_0xea6bf2;_0x3e0e34['temp']=_0x3e0e34[_0xbb10('0xd1')]>0x0?_0x3e0e34[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd2'))(_0x9f2e0f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd3')]=function(_0xf5b08a,_0x1f55d3,_0x189f07,_0x2010d4){return Promise['resolve']()['then'](cmHopper[_0xbb10('0xd3')](_0xf5b08a,_0x1f55d3,_0x189f07))[_0xbb10('0xbc')](function(_0x293f3f){_0x2010d4[_0xbb10('0xd1')]-=_0x1f55d3;_0x2010d4[_0xbb10('0xd1')]=_0x2010d4[_0xbb10('0xd1')]>0x0?_0x2010d4[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd4'))(_0x293f3f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd5')]=function(_0xcbaf69){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](voiceQueueRt['getVoiceQueueRtPauses'](_0xcbaf69))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd6')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd7')]=function(_0x29eff4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xd7')](_0x29eff4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd8')));};Dialer[_0xbb10('0x1d')]['createHistory']=function(_0x2c2ad7){return Promise['resolve']()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xd9')](_0x2c2ad7))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xda')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xbd')]=function(_0x4e9cad){if(!_[_0xbb10('0x93')](_0x4e9cad)&&_0x4e9cad!==null){if(typeof _0x4e9cad['originated']!==_0xbb10('0xb7')){if(_0x4e9cad[_0xbb10('0x7a')]>0x0){_0x4e9cad[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xdb'));}}}else{logger[_0xbb10('0xa3')](_0xbb10('0xdc'));}};Dialer[_0xbb10('0x1d')][_0xbb10('0xdd')]=function(_0xf4fd1,_0x13efa1){var _0xa09041=this;return function(_0x589565){_0xa09041[_0xbb10('0xbd')](_0x13efa1);logger['error'](_0xf4fd1,util[_0xbb10('0xa4')](_0x589565,{'showHidden':![],'depth':null}));};};Dialer[_0xbb10('0x1d')][_0xbb10('0xde')]=function(_0x7673a0,_0x44c229,_0x40271f){var _0x185ec9={'state':0x19,'statedesc':'notFound'};this[_0xbb10('0xbd')](_0x44c229);this['saveInDb'](_['merge'](_0x185ec9,_[_0xbb10('0xdf')](_0x40271f,[_0xbb10('0xe0'),_0xbb10('0xe1'),_0xbb10('0xe2'),_0xbb10('0xe3'),_0xbb10('0xe4')])),'[emptyContact][createHistory]',_0xbb10('0xe5'));logger[_0xbb10('0xa3')](_0x7673a0);};Dialer[_0xbb10('0x1d')][_0xbb10('0xe6')]=function(_0x136520){return _0x136520===_0xbb10('0xe7');};Dialer['prototype'][_0xbb10('0xe8')]=function(_0x4093a4){return!_[_0xbb10('0x93')](_0x4093a4)&&_0x4093a4&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x47')])&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x80')])&&_0x4093a4['active']&&(this[_0xbb10('0x26')][util['format'](_0xbb10('0xe9'),_0x4093a4['name'])]['status']===_0xbb10('0xea')||this[_0xbb10('0x26')][util[_0xbb10('0x83')](_0xbb10('0xe9'),_0x4093a4[_0xbb10('0x47')])]['status']===_0xbb10('0xeb'));};Dialer['prototype']['saveInDb']=function(_0x4dd138,_0xa00798,_0x207e76){this[_0xbb10('0xd9')](_0x4dd138)[_0xbb10('0xbc')](loggerCatch(_0xa00798));this[_0xbb10('0xd7')](_0x4dd138)['catch'](loggerCatch(_0x207e76));};Dialer[_0xbb10('0x1d')][_0xbb10('0xec')]=function(_0x352de4){var _0x1bd1c1=this;var _0x4b3b21=this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];var _0x485c1a;if(!_['isNil'](_0x352de4)&&!_['isNil'](_0x352de4[_0xbb10('0xee')])&&!_[_0xbb10('0xb8')](_0x352de4[_0xbb10('0xee')][_0xbb10('0xef')])&&_0x352de4[_0xbb10('0xf0')]===_0xbb10('0xf1')&&_0x4b3b21){if(_0x4b3b21[_0xbb10('0x56')]!==_0xbb10('0x86')&&this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['dialAMDActive']&&_0x352de4['value']==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a['state']=0x12;_0x485c1a[_0xbb10('0xf2')]='HangupInAMD';_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut[_0xbb10('0xf6')](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0xf9'),_0xbb10('0xfa'));}if(_0x4b3b21[_0xbb10('0x56')]!=='ivr'&&this[_0xbb10('0x23')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4['value']===_0xbb10('0xfc')){return new Promise(function(_0x2cd825,_0x2adbbc){delete _0x1bd1c1[_0xbb10('0x2b')][_0x352de4['uniqueid']];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x18a44f=_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]];var _0x56ddaa=new Hangup(_0x4b3b21,_0x352de4);_0x56ddaa['state']=0x13;_0x56ddaa['statedesc']=_0xbb10('0xfe');_0x56ddaa['membername']=_0xbb10('0xf4');_0x56ddaa['countmachineretry']+=0x1;_0x56ddaa[_0xbb10('0xff')]+=0x1;_0x56ddaa[_0xbb10('0xf7')]=!![];ami[_0xbb10('0x55')]('custom:amd',ut['buildObj'](_0x56ddaa,_0xbb10('0xf7')));_0x1bd1c1[_0xbb10('0xd9')](_0x56ddaa)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56ddaa[_0xbb10('0x100')]+_0x56ddaa[_0xbb10('0x101')]+_0x56ddaa[_0xbb10('0x102')]+_0x56ddaa['countnosuchnumberretry']+_0x56ddaa['countdropretry']+_0x56ddaa['countabandonedretry']+_0x56ddaa[_0xbb10('0x103')]+_0x56ddaa['countagentrejectretry']>=_0x18a44f[_0xbb10('0x104')]){_0x1bd1c1[_0xbb10('0x105')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x106'));}else{if(_0x56ddaa[_0xbb10('0x103')]>=_0x18a44f[_0xbb10('0x107')]){_0x1bd1c1[_0xbb10('0x108')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x109'));}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x56ddaa[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x18a44f[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x56ddaa['ContactId'],'ListId':_0x56ddaa[_0xbb10('0xe1')],'VoiceQueueId':_0x56ddaa['VoiceQueueId']||undefined,'CampaignId':_0x56ddaa['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x2cd825({'reschedule':0x1});}}});}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this[_0xbb10('0x24')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4[_0xbb10('0x10e')]==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a[_0xbb10('0x10f')]=0x12;_0x485c1a[_0xbb10('0xf2')]=_0xbb10('0x110');_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut['buildObj'](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0x111'),_0xbb10('0x112'));}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this['campaigns'][_0x4b3b21['queue']]['dialAMDActive']&&_0x352de4[_0xbb10('0x10e')]===_0xbb10('0xfc')){return new Promise(function(_0x3e1a86,_0x243dc0){delete _0x1bd1c1['uniqueId'][_0x352de4[_0xbb10('0xed')]];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x1bd1c1['campaigns'][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x42276f=_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]];var _0x1fe250=new Hangup(_0x4b3b21,_0x352de4);_0x1fe250['state']=0x13;_0x1fe250[_0xbb10('0xf2')]=_0xbb10('0xfe');_0x1fe250['membername']=_0xbb10('0xf4');_0x1fe250[_0xbb10('0x103')]+=0x1;_0x1fe250[_0xbb10('0xff')]+=0x1;_0x1fe250['amd']=!![];ami['emit']('custom:amd',ut[_0xbb10('0xf6')](_0x1fe250,_0xbb10('0xf7')));_0x1bd1c1['createHistory'](_0x1fe250)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x113')));if(_0x1fe250[_0xbb10('0x100')]+_0x1fe250[_0xbb10('0x101')]+_0x1fe250[_0xbb10('0x102')]+_0x1fe250[_0xbb10('0x114')]+_0x1fe250[_0xbb10('0x115')]+_0x1fe250['countabandonedretry']+_0x1fe250[_0xbb10('0x103')]+_0x1fe250['countagentrejectretry']>=_0x42276f['dialGlobalMaxRetry']){_0x1bd1c1['stateGlobal'](_0x1fe250,_0x3e1a86,_0x243dc0,_0xbb10('0x106'));}else{if(_0x1fe250[_0xbb10('0x103')]>=_0x42276f['dialMachineMaxRetry']){_0x1bd1c1[_0xbb10('0x108')](_0x1fe250,_0x3e1a86,_0x243dc0,'reason\x2019\x20machine....');}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x1fe250[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x42276f['dialMachineRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1fe250[_0xbb10('0xe0')],'ListId':_0x1fe250[_0xbb10('0xe1')],'VoiceQueueId':_0x1fe250['VoiceQueueId']||undefined,'CampaignId':_0x1fe250['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x3e1a86({'reschedule':0x1});}}});}}};Dialer[_0xbb10('0x1d')]['syncHangup']=function(_0x4f4aa8){var _0x426a4f=this[_0xbb10('0x2b')][_0x4f4aa8['uniqueid']];var _0x414066;if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]===_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x116')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr]'));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&isNotNull(this[_0xbb10('0x23')][_0x426a4f['queue']][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x426a4f['queue']]);this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066['state']=0x10;_0x414066[_0xbb10('0xf2')]=_0xbb10('0x118');_0x414066['membername']=_0xbb10('0x119');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11b')));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&!isNotNull(this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x426a4f['queue']]['outboundUnknownCallsDay']+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066[_0xbb10('0x10f')]=0xc;_0x414066[_0xbb10('0xf2')]=_0x4f4aa8[_0xbb10('0x11c')];_0x414066[_0xbb10('0xf3')]=_0xbb10('0x11d');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x4f147c){var _0x5d42b1=this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];if(this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]){if(_0x5d42b1&&_0x5d42b1['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];this[_0xbb10('0x23')][_0x4f147c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3057b4=new AgentComplete(_0x5d42b1,_0x4f147c);if(_0x4f147c[_0xbb10('0x11e')]==='agent'){_0x3057b4['agiafterat']=this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]][_0xbb10('0x11f')]&&this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]['dialAgiAfterHangupAgent']?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x120')));this[_0xbb10('0xd7')](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x121')));}}};Dialer[_0xbb10('0x1d')]['syncAgentConnect']=function(_0x9c1581){if(this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]){if(this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]]&&this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x56')]!==_0xbb10('0x86')){this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]);this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x122')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));}}};Dialer[_0xbb10('0x1d')][_0xbb10('0x123')]=function(_0x43a203,_0x1ca43e){this[_0xbb10('0xd9')](_0x43a203)['catch'](loggerCatch(_0xbb10('0x120')));if(_0x1ca43e==0x0){this['moveContactManagedDialer'](_0x43a203)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x124')));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x33')]=function(_0x40bbf1){var _0x4f5689=this['uniqueId'][_0x40bbf1['uniqueid']];var _0x36be49=this;var _0x2fac6c=![];var _0x482f7d;var _0x31b7f9;if(this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]){if(_0x4f5689&&_0x4f5689['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x40bbf1[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x23')][_0x40bbf1['queue']]);_0x4f5689[_0xbb10('0x125')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x559e46=new QueueCallerAbandon(_0x4f5689,_0x40bbf1);if(getSeconds(_0x4f5689['droptime'],_0x4f5689['responsetime'])>=_0x4f5689['dialQueueTimeout']){this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x74')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x6a')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x76')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xa;_0x559e46[_0xbb10('0xf2')]=_0xbb10('0x126');_0x559e46[_0xbb10('0x127')]=_0xbb10('0x128');_0x559e46[_0xbb10('0x129')]=this['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x11f')]?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x559e46[_0xbb10('0x115')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['dialDropRetryFrequency'];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x1c0529){_0x2fac6c=_0x1c0529[_0xbb10('0x12c')]==0x1;if(_0x559e46[_0xbb10('0x115')]>=_0x36be49[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12d')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x1c0529['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countdropretry':_0x559e46[_0xbb10('0x115')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12e')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0xaeaa51=new History(_0x559e46);_0xaeaa51['state']=0xa;_0xaeaa51[_0xbb10('0xf2')]='Drop';_0xaeaa51['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0xaeaa51[_0xbb10('0xb2')]=_0xaeaa51[_0xbb10('0xb3')];_0xaeaa51[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0xaeaa51['calleridnum']=_0x559e46['calleridnum'];_0x36be49['createHistory'](_0xaeaa51)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x130')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}else{this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x69')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xb;_0x559e46['statedesc']=_0xbb10('0x131');_0x559e46['dropreason']='CALLEREXIT';_0x559e46[_0xbb10('0x132')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x527d8d){if(_0x559e46[_0xbb10('0x132')]>=_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x134')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x527d8d['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countabandonedretry':_0x559e46[_0xbb10('0x132')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a01cd=new History(_0x559e46);_0x4a01cd[_0xbb10('0x10f')]=0xb;_0x4a01cd[_0xbb10('0xf2')]=_0xbb10('0x131');_0x4a01cd[_0xbb10('0xb3')]=moment()['format'](_0xbb10('0x10c'));_0x4a01cd['endtime']=_0x4a01cd[_0xbb10('0xb3')];_0x4a01cd[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0x4a01cd[_0xbb10('0x136')]=_0x559e46[_0xbb10('0x136')];_0x36be49[_0xbb10('0xd9')](_0x4a01cd)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}}}};Dialer[_0xbb10('0x1d')]['syncNewExten']=function(_0x1bd6db){if(this[_0xbb10('0x29')][_0x1bd6db[_0xbb10('0xed')]]){this['actions'][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db[_0xbb10('0xbb')];}if(this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]){this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db['channel'];}};Dialer[_0xbb10('0x1d')]['syncQueueMember']=function(_0x553bb8){if(strategy[this[_0xbb10('0x23')][this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]&&_[_0xbb10('0xb8')](this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0x13a')])&&_0x553bb8['status']==='1'&&_0x553bb8[_0xbb10('0x13b')]==='0'){if(this['agents'][_0x553bb8[_0xbb10('0x13c')]]){if(!this[_0xbb10('0x25')][_0x553bb8['stateinterface']][_0xbb10('0x13a')]){this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]['locked']=!![];this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13a')]=!![];this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13c')]=_0x553bb8[_0xbb10('0x13c')];}}}}else if((strategy[this['voiceQueues'][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]][_0xbb10('0x139')]]||_0xbb10('0x1b'))===_0xbb10('0x1b')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]){if(this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]){this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]['stateinterface']=_0x553bb8['stateinterface'];if(_[_0xbb10('0xb8')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]])){this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]=[];}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]['push'](_[_0xbb10('0x9b')](_[_0xbb10('0xdf')](this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]],['idHopper',_0xbb10('0x13c')]),{'status':_0x553bb8[_0xbb10('0xba')],'paused':_0x553bb8[_0xbb10('0x13b')]}));}}}};function unlockQueueStatus(_0x59fef2,_0x59f9b2){setTimeout(function(){if(_[_0xbb10('0x93')](_0x59fef2['queueStatusComplete'])){loggerBooked[_0xbb10('0xa3')]('[unlockQueueStatus][undefined]',_0x59f9b2);}_0x59fef2[_0xbb10('0x13e')]=!![];loggerBooked[_0xbb10('0x89')](_0xbb10('0x13f'),_0x59f9b2,JSON[_0xbb10('0x82')](_[_0xbb10('0xdf')](_0x59fef2,[_0xbb10('0x47'),_0xbb10('0x13e')])));},0x1f3);}Dialer['prototype'][_0xbb10('0x42')]=function(_0x439d9a){var _0x28271e=this;var _0x2807d2=_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]];if(strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this['actions'][_0x439d9a[_0xbb10('0x138')]]&&this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']){this[_0xbb10('0x22')]['run'](this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0x140')],this['actions'][_0x439d9a['actionid']][_0xbb10('0x13c')])[_0xbb10('0xbc')](function(_0xbb410e){logger[_0xbb10('0xa3')](_0xbb10('0x141'),util[_0xbb10('0xa4')](_0xbb410e,{'showHidden':![],'depth':null}));})[_0xbb10('0x20')](function(){_0x28271e[_0xbb10('0xbd')](_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);_0x28271e['agents'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']]['locked']=![];delete _0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);});}else{this[_0xbb10('0xbd')](this['voiceQueues'][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);this[_0xbb10('0xcd')]({'active':![],'ContactId':this[_0xbb10('0x29')][_0x439d9a['actionid']]['ContactId'],'ListId':this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xe1')],'VoiceQueueId':this['actions'][_0x439d9a['actionid']][_0xbb10('0xe3')]||undefined,'CampaignId':this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);}}else if((strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]]['strategy']]||_0xbb10('0x1b'))===_0xbb10('0x1b')){var _0x2aaf70;if(this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]&&!_[_0xbb10('0x4f')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]])){if(this[_0xbb10('0x2e')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]){this['queueBookedRR'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]=this[_0xbb10('0x2e')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this['queueBookedRR'][this[_0xbb10('0x29')][_0x439d9a['actionid']]['queue']]:this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this[_0xbb10('0x13d')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]||0x0:0x0;}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]=this[_0xbb10('0x2e')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]];for(var _0x74ca46=0x0;_0x74ca46=0x0;})['catch'](myreject(_0x4aa311)));}}else{_0x7e9e52[_0xbb10('0x162')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x3d2e5f,!_[_0xbb10('0x93')](config[_0xbb10('0x15a')][_0x33a92a])?_0x33a92a:'')})[_0xbb10('0xc2')](function(_0x1f0938){return _0x1f0938[_0xbb10('0x160')]['indexOf'](_0xbb10('0x163'))>=0x0;})[_0xbb10('0xbc')](myreject(_0x4aa311)));}Promise[_0xbb10('0x164')](_0x7e9e52)['then'](function(_0x11a61a){var _0x188766=_[_0xbb10('0x165')](_0x11a61a);if(_0x188766){return _0x1b3783(_0x188766);}else{_0x4fa8a2[_0xbb10('0x46')]=_0x4688f8?_0xbb10('0x166'):_0xbb10('0x167');return _0x4aa311(msgResponse(_0xbb10('0x168'),_0xbb10('0x156'),_0xbb10('0x169')+_0x4688f8+'\x20'+_0x374e5d+_0xbb10('0x16a')+util[_0xbb10('0xa4')](_0x3d2e5f,{'showHidden':![],'depth':null})+_0xbb10('0x16b')+_0x33a92a));}})[_0xbb10('0xbc')](function(_0x2dc633){return _0x4aa311(msgResponse(_0xbb10('0x155'),'Failure',JSON['stringify'](_0x2dc633)));});});};Dialer['prototype'][_0xbb10('0x16c')]=function(_0x58fbef){var _0x1ae32c=this;return function(){switch(_0x58fbef['dialMethod']){case _0xbb10('0x16d'):freeVariablesPredictive(_0x58fbef);_0x1ae32c['handlePower'](_0x58fbef,0x1);break;case'power':freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,_0x58fbef[_0xbb10('0x16f')]);break;case'predictive':_0x1ae32c[_0xbb10('0x9')](_0x58fbef);break;case _0xbb10('0x8'):freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,0x1);break;default:freeVariablesPredictive(_0x58fbef);logger[_0xbb10('0xa3')]('Queue',_0x58fbef['name'],_0xbb10('0x170'));}};};Dialer[_0xbb10('0x1d')][_0xbb10('0x171')]=function(_0x53f3c2){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_0x53f3c2['id'],previewRecallmeReminderInterval))['then'](function(_0x5414f9){for(var _0x51cdbd=0x0;_0x51cdbd<_0x5414f9['length'];_0x51cdbd++){var _0xd11ff7=_0x5414f9[_0x51cdbd]['Agent'][_0xbb10('0x47')];if(_0xd11ff7)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0xd11ff7))[_0xbb10('0x55')](_0xbb10('0x174'),{'hopper':_0x5414f9[_0x51cdbd]});}})['catch'](function(){});};Dialer[_0xbb10('0x1d')][_0xbb10('0x175')]=function(_0xf6f7ed){var _0x2701e8=this;return function(){_0x2701e8[_0xbb10('0x176')](_0xf6f7ed);};};Dialer[_0xbb10('0x1d')]['syncQueueSummary']=function(_0x568fb9){var _0x1e394c=this;if(isNotPreview(_0x568fb9[_0xbb10('0x63')])){if(isVoiceQueueOutbound(_0x568fb9[_0xbb10('0x56')])&&isActive(_0x568fb9[_0xbb10('0x62')])){_0x568fb9[_0xbb10('0xac')]=!![];Promise['resolve']()['then'](checkIsLoggedIn(_0x568fb9,_0x568fb9[_0xbb10('0x59')]))[_0xbb10('0xc2')](checkIsActive(_0x568fb9,_0x568fb9['dialActive']))['then'](checkInterval(_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x150')](_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x153')](_0x568fb9[_0xbb10('0x177')],_0x568fb9[_0xbb10('0x178')],_0x568fb9['name'],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x154')](_0x568fb9[_0xbb10('0x4b')],_0x568fb9[_0xbb10('0x178')],_0x568fb9[_0xbb10('0x47')],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x16c')](_0x568fb9))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x179'),_0x568fb9));}else{notSendMessagesQueue(_0x568fb9);}}else{freeVariablesPredictive(_0x568fb9);}};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x111c15=_[_0xbb10('0x17a')](this[_0xbb10('0x23')],function(_0x270853){return _0x270853['dialPreviewRecallmeReminder'];});var _0x548c7d=_['filter'](this[_0xbb10('0x25')],function(_0x43440f){return _0x43440f[_0xbb10('0x17b')]&&_0x43440f[_0xbb10('0xba')]===_0xbb10('0xea');});if(_0x111c15[_0xbb10('0xa5')]>0x0&&_0x548c7d[_0xbb10('0xa5')]>0x0){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_[_0xbb10('0x17c')](_0x111c15,'id'),previewRecallmeReminderInterval,_[_0xbb10('0x17c')](_0x548c7d,'id')))[_0xbb10('0xc2')](function(_0x21905e){for(var _0x5f074d=0x0;_0x5f074d<_0x21905e[_0xbb10('0xa5')];_0x5f074d++){var _0x139eac=_0x21905e[_0x5f074d][_0xbb10('0x17d')][_0xbb10('0x47')];if(_0x139eac)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0x139eac))['emit'](_0xbb10('0x174'),{'hopper':_0x21905e[_0x5f074d]});}})[_0xbb10('0xbc')](function(_0x46da44){logger[_0xbb10('0xa3')](_0xbb10('0x171'),_0x46da44);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbb10('0x1d')][_0xbb10('0x14f')]=function(){var _0x29ab90=this;var _0x6c67b7;for(var _0x504279 in this[_0xbb10('0x24')]){if(typeof this[_0xbb10('0x24')][_0x504279]!==_0xbb10('0xb7')){_0x6c67b7=this[_0xbb10('0x24')][_0x504279];if(isCampaignIvr(_0x6c67b7[_0xbb10('0x56')])&&isActive(_0x6c67b7[_0xbb10('0x80')])){_0x6c67b7[_0xbb10('0xac')]=!![];Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](checkIsActive(_0x6c67b7,_0x6c67b7['active']))[_0xbb10('0xc2')](checkInterval(_0x6c67b7))['then'](_0x29ab90[_0xbb10('0x150')](_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90['checkIfTime'](_0x6c67b7['dialGlobalInterval'],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x154')](_0x6c67b7[_0xbb10('0x4b')],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x175')](_0x6c67b7))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x17e'),_0x6c67b7));}else{notSendMessagesCampaign(_0x6c67b7);}}}};function getCallerIdRandom(_0x2b0a37,_0x3f632e){var _0x2f76;var _0x18c40e;var _0x5eba7e;if(_0x3f632e<=0x0){_0x3f632e=0x1;}_0x2f76=new RegExp(_0xbb10('0x17f')+_0x3f632e+'}$');_0x18c40e=Math['pow'](0xa,_0x3f632e-0x1);_0x5eba7e=Math[_0xbb10('0x180')](0xa,_0x3f632e)-0x1;return util[_0xbb10('0x83')]('%s',_[_0xbb10('0x181')](_0x2b0a37,_0x2f76,_[_0xbb10('0x182')](_0x18c40e,_0x5eba7e)));}function extractCalleridName(_0x3033b0){var _0x2b332b=_0x3033b0[_0xbb10('0x183')](/"(.*?)"/);return _0x2b332b?_0x2b332b[0x1]:_0x3033b0;}Dialer[_0xbb10('0x1d')][_0xbb10('0x184')]=function(_0x4b274c,_0x4b7bdb){var _0x3f10c4=this;var _0x3bb8f9=uuid['v4']();this[_0xbb10('0x29')][_0x3bb8f9]=new Action(_0x4b274c,_0x4b7bdb,_0x3bb8f9);return new Promise(function(_0x54c61c,_0x21b00e){if(_['isUndefined'](_0x4b274c)&&typeof _0x4b274c!==_0xbb10('0x185')){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x187')));}if(_[_0xbb10('0x93')](_0x4b7bdb[_0xbb10('0x188')])||_0x4b7bdb[_0xbb10('0x188')]===null){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x189')));}var _0x1a21fd={'XMD-CALLERID':_0x3f10c4['actions'][_0x3bb8f9][_0xbb10('0x18a')](),'XMD-AGI':_0x4b274c[_0xbb10('0x117')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x117')]):_0xbb10('0x18c'),'XMD-AGIAFTER':_0x4b274c[_0xbb10('0x11f')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x11f')]):_0xbb10('0x18c'),'XMD-QUEUE':_0x4b274c['type']==='outbound'?util[_0xbb10('0x83')](_0xbb10('0x18d'),_0x4b274c[_0xbb10('0x47')],_0x4b274c[_0xbb10('0x18e')]||'',_0x4b274c['dialAgiAfterHangupAgent']?'c':'',_0x4b274c[_0xbb10('0x18f')]||0x3):_0xbb10('0x18c'),'XMD-CONTACTID':_0x4b7bdb[_0xbb10('0xe0')],'XMD-CDRTYPE':_0xbb10('0x7'),'CALLERID(all)':_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]['getCaller'](),'XMD-AMD':_0x4b274c['dialAMDActive']?_0xbb10('0x190'):_0xbb10('0x18c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4b274c['dialAMDActive']){_0x1a21fd[_0xbb10('0x191')]=_0x4b274c[_0xbb10('0x192')]||0x9c4;_0x1a21fd[_0xbb10('0x193')]=_0x4b274c[_0xbb10('0x194')]||0x5dc;_0x1a21fd[_0xbb10('0x195')]=_0x4b274c[_0xbb10('0x196')]||0x320;_0x1a21fd['XMD-AMDTOTALANALYSISTIME']=_0x4b274c['dialAMDTotalAnalysisTime']||0x1388;_0x1a21fd[_0xbb10('0x197')]=_0x4b274c[_0xbb10('0x198')]||0x64;_0x1a21fd[_0xbb10('0x199')]=_0x4b274c[_0xbb10('0x19a')]||0x32;_0x1a21fd[_0xbb10('0x19b')]=_0x4b274c[_0xbb10('0x19c')]||0x3;_0x1a21fd['XMD-AMDSILENCETHRESHOLD']=_0x4b274c[_0xbb10('0x19d')]||0x100;_0x1a21fd[_0xbb10('0x19e')]=_0x4b274c[_0xbb10('0x19f')]||0x1388;}if(_0x4b274c[_0xbb10('0x56')]==='outbound'){_0x1a21fd[_0xbb10('0x1a0')]=_0x4b7bdb[_0xbb10('0xe3')];}else{_0x1a21fd[_0xbb10('0x1a1')]=_0x4b7bdb[_0xbb10('0xe4')];}for(var _0x416c01 in _0x4b7bdb[_0xbb10('0x1a2')]){if(typeof _0x4b7bdb[_0xbb10('0x1a2')][_0x416c01]!==_0xbb10('0xb7')){if(isNotNull(_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01])&&_0x416c01!=='id'&&_0x416c01!==_0xbb10('0x1a3')&&_0x416c01!==_0xbb10('0x1a4')&&_0x416c01!==_0xbb10('0x1a5')){_0x1a21fd[util['format'](_0xbb10('0x1a6'),_0xbb10('0x1a7'),_['toUpper'](_0x416c01))]=_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01];}}}var _0x284645=_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?getCallerId(_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')],_0x4b274c[_0xbb10('0x1a8')],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c[_0xbb10('0x1a9')]):_0x4b274c['dialOriginateCallerIdNumber']):getCallerId(_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x81')],_0x4b274c['dialOriginateCallerIdName'],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c['dialRandomLastDigitCallerIdNumber']):_0x4b274c[_0xbb10('0x64')]);if(_0x284645){_0x1a21fd['XMD-ORIGINATECALLERIDNAME']=_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9][_0xbb10('0x1aa')]=extractCalleridName(_0x284645);_0x1a21fd[_0xbb10('0x1ab')]=_0x4b7bdb[_0xbb10('0x188')];}_0x4b274c[_0xbb10('0x1ac')]=_0x1a21fd;return ami[_0xbb10('0xb9')]({'actionid':_0x3bb8f9,'action':_0xbb10('0x186'),'channel':_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?util['format'](_0xbb10('0x1ad'),_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]):util['format'](_0xbb10('0x1ad'),_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]),'callerid':_0x284645,'Exten':_0xbb10('0xf1'),'Context':_0xbb10('0x1b2'),'Priority':'1','variable':_0x1a21fd,'timeout':(_0x4b274c[_0xbb10('0x65')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3bb8f9})[_0xbb10('0xc2')](function(_0x3a37d4){return _0x54c61c(_0x3a37d4);})[_0xbb10('0xbc')](function(_0x451ae9){_0x4b274c[_0xbb10('0x6c')]+=0x1;var _0x23707c=new History(_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]);logger['error'](util[_0xbb10('0x83')](_0xbb10('0x1b3'),JSON[_0xbb10('0x82')](_0x451ae9)));_0x23707c['state']=0xe;_0x23707c['statedesc']=_0xbb10('0x1b4');_0x23707c['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0x23707c[_0xbb10('0xb2')]=_0x23707c[_0xbb10('0xb3')];_0x3f10c4[_0xbb10('0xd9')](_0x23707c)['catch'](loggerCatch(_0xbb10('0x1b5')));_0x3f10c4[_0xbb10('0xd7')](_0x23707c)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1b5')))[_0xbb10('0x20')](function(){delete _0x3f10c4[_0xbb10('0x29')][_0x3bb8f9];return _0x21b00e(msgResponse(_0xbb10('0x186'),'Error',_0xbb10('0x1b6')));});});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x35')]=function(_0x178bc0){var _0x128ecc=this['actions'][_0x178bc0[_0xbb10('0x138')]];if(_0x128ecc){delete this[_0xbb10('0x29')][_0x178bc0[_0xbb10('0x138')]];_0x128ecc[_0xbb10('0x1b7')]=moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2d8da3=_0x128ecc[_0xbb10('0x56')]===_0xbb10('0x86')?this[_0xbb10('0x24')][_0x128ecc[_0xbb10('0xbe')]]:this[_0xbb10('0x23')][_0x128ecc[_0xbb10('0x1b8')]()];if(!this['isSuccess'](_0x178bc0['response'])){this[_0xbb10('0xbd')](_0x2d8da3);return this[_0xbb10('0x1b9')](_0x128ecc,_0x2d8da3,_0x178bc0)['catch'](loggerCatch(_0xbb10('0x1ba')));}this[_0xbb10('0x2b')][_0x178bc0[_0xbb10('0xed')]]=_0x128ecc;}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1bb')]=function(_0xf96e32,_0x49f94b,_0xe1ce37){var _0x33dac1=new History(_0x49f94b);if(_0x33dac1[_0xbb10('0x100')]+_0x33dac1[_0xbb10('0x101')]+_0x33dac1['countnoanswerretry']+_0x33dac1['countnosuchnumberretry']+_0x33dac1[_0xbb10('0x115')]+_0x33dac1[_0xbb10('0x132')]+_0x33dac1[_0xbb10('0x103')]+_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x104')]-0x1){return!![];}switch(_0xf96e32){case 0x3:if(_0x33dac1[_0xbb10('0x102')]>=_0xe1ce37[_0xbb10('0x1bd')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countnoanswerretry':_0x33dac1[_0xbb10('0x102')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1be')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1bf')));break;case 0x5:if(_0x33dac1[_0xbb10('0x100')]>=_0xe1ce37['dialBusyMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countbusyretry':_0x33dac1[_0xbb10('0x100')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialBusyRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c0')));break;case 0x8:if(_0x33dac1['countcongestionretry']>=_0xe1ce37[_0xbb10('0x1c1')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countcongestionretry':_0x33dac1[_0xbb10('0x101')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x1c2')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x1c3')));break;case 0x0:if(_0x33dac1[_0xbb10('0x114')]>=_0xe1ce37[_0xbb10('0x1c4')]-0x1){return!![];}else{this[_0xbb10('0xcd')]({'active':![],'countnosuchnumberretry':_0x33dac1[_0xbb10('0x114')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c5')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x33dac1[_0xbb10('0x115')]>=_0xe1ce37[_0xbb10('0x12d')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countdropretry':_0x33dac1[_0xbb10('0x115')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x12e')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c6')));break;case 0xb:if(_0x33dac1[_0xbb10('0x132')]>=_0xe1ce37[_0xbb10('0x134')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countabandonedretry':_0x33dac1[_0xbb10('0x132')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialAbandonedRetryFrequency'],_0xbb10('0x135'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x33dac1[_0xbb10('0x103')]>=_0xe1ce37['dialMachineMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x33dac1[_0xbb10('0x103')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x10d')));break;case 0x14:if(_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x1c7')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countagentrejectretry':_0x33dac1[_0xbb10('0x1bc')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c8')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1b9')]=function(_0x5e3903,_0x3a27ef,_0x836686){var _0x3a3d86=this;var _0x3b484e=new History(_0x5e3903);var _0x29fa42=![];var _0x969f63;var _0x7df075;return new Promise(function(_0x25d557,_0x3d693a){if(_['isUndefined'](_0x3a27ef)&&typeof _0x3a27ef!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1ca')));}if(_['isUndefined'](_0x836686)&&typeof _0x836686!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1cb')));}_0x3a3d86[_0xbb10('0xc5')](_0x3b484e,_0x836686[_0xbb10('0x11e')],_0x3a27ef)[_0xbb10('0xc2')](function(_0x173949){if(_0x173949['additional']==0x1)_0x29fa42=!![];switch(_0x836686[_0xbb10('0x11e')]){case'0':_0x3a27ef['outboundNoSuchCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x0;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1cc');_0x3b484e['countnosuchnumberretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami[_0xbb10('0x55')](_0xbb10('0x1cd'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1ce')));_0x969f63=_0x3a27ef[_0xbb10('0x1c5')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3a3d86[_0xbb10('0x1bb')](0x0,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countnosuchnumberretry']>=_0x3a27ef[_0xbb10('0x1c4')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1cf'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3a27ef[_0xbb10('0x6b')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x3;_0x3b484e['statedesc']=_0xbb10('0x1d0');_0x3b484e[_0xbb10('0x102')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;var _0x3ec649=ut['buildNoAnswerEventPayload'](_0x5e3903,_0x3a27ef);ami[_0xbb10('0x55')]('custom:agentnoanswer',_0x3ec649);_0x969f63=_0x3a27ef[_0xbb10('0x1be')];_0x7df075=_0x3a27ef['callAdditionalPhoneAfterMin'];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d1')));if(_0x3a3d86[_0xbb10('0x1bb')](0x3,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x102')]>=_0x3a27ef[_0xbb10('0x1bd')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}}break;case'5':_0x3a27ef[_0xbb10('0x67')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x5;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1d3');_0x3b484e['countbusyretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami['emit'](_0xbb10('0x1d4'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d5')));_0x969f63=_0x3a27ef['dialBusyRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d6')));if(_0x3a3d86['checkRetriveMax'](0x5,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']>=_0x3a27ef[_0xbb10('0x1d7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d8'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x205\x20busy');}}break;case'8':_0x3a27ef[_0xbb10('0x68')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x8;_0x3b484e[_0xbb10('0xf2')]='Congestion';_0x3b484e['countcongestionretry']+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef['dialCongestionRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')]('custom:agentcongestion',ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d9')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3a3d86['checkRetriveMax'](0x8,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x101')]>=_0x3a27ef[_0xbb10('0x1c1')]){_0x3a3d86['createStateFinal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}}break;case'11':_0x3a27ef[_0xbb10('0x1db')]+=0x1;_0x3b484e['state']=0xb;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x131');_0x3b484e[_0xbb10('0x132')]+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef[_0xbb10('0x133')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));if(_0x3a3d86[_0xbb10('0x1bb')](0xb,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countabandonedretry']>=_0x3a27ef['dialAbandonedMaxRetry']){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2011\x20abandoned');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1dc'));}}break;case'20':_0x3a27ef[_0xbb10('0x6e')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x14;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1dd');_0x3b484e[_0xbb10('0x1bc')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')](_0xbb10('0x1de'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1df')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e0')));if(_0x3a3d86[_0xbb10('0x1bb')](0x14,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x1c7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2020\x20agentreject');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1e1'));}}break;default:_0x3a27ef['outboundUnknownCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0xc;_0x3b484e[_0xbb10('0xf2')]=_0x836686['reason'];_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e2')));if(_0x3a3d86[_0xbb10('0x1bb')](_0x836686[_0xbb10('0x11e')],_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']+_0x3b484e[_0xbb10('0x101')]+_0x3b484e[_0xbb10('0x102')]+_0x3b484e[_0xbb10('0x114')]+_0x3b484e[_0xbb10('0x115')]+_0x3b484e['countabandonedretry']+_0x3b484e['countmachineretry']+_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x104')]){_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}else{_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}}}})['then'](function(){if(_0x29fa42){_0x3a3d86['swapAdditionalPhones'](_0x3b484e,_0x969f63,_0x7df075)[_0xbb10('0xc2')](function(){return _0x25d557(0x1);});}});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x105')]=function(_0x468568,_0x58e537,_0x463d0f,_0xb2d651){var _0x32379b=new Final(_0x468568);_0x32379b[_0xbb10('0x10f')]=0xf;_0x32379b[_0xbb10('0xf2')]=_0xbb10('0x1e3');this[_0xbb10('0x108')](_0x32379b,_0x58e537,_0x463d0f,_0xb2d651);};Dialer['prototype'][_0xbb10('0x108')]=function(_0x185940,_0x26f413,_0x43584b,_0x313072){this[_0xbb10('0xd7')](_0x185940)[_0xbb10('0xc2')](function(){return _0x26f413(msgResponse(_0xbb10('0x1c9'),'Success',_0x313072));})[_0xbb10('0xbc')](function(){return _0x43584b(msgResponse(_0xbb10('0x1e4'),_0xbb10('0x156'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xbb10('0x9')]=function(_0x2d81db){var _0x28ee28=_0x2d81db[_0xbb10('0x1e5')]/0x64;var _0x5db829=_0x2d81db[_0xbb10('0x6a')]/(_0x2d81db[_0xbb10('0x6a')]+_0x2d81db[_0xbb10('0x66')]);var _0xb7f2fa=Math['round'](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db[_0xbb10('0x1e6')]/0x64));var _0x385374=Math[_0xbb10('0x1e7')](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db['predictiveIntervalMinThreshold']/0x64));var _0x21ae70=_0x2d81db[_0xbb10('0x58')]+_0x2d81db[_0xbb10('0x5d')];var _0x5273ef=Math['floor'](_0x2d81db[_0xbb10('0x7b')]*_0x2d81db['erlangAbandonmentRate']*_0x2d81db[_0xbb10('0x77')]*_0x2d81db['predictiveIntervalMultiplicativeFactor']);if(_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){if(!_[_0xbb10('0x93')](_0x2d81db['startPredictive'])){_0x2d81db[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0xa3')]('[startMethodPredictive][StartProgressive]',_0xbb10('0x1e8'));}if(!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x9d')])){loggerPredictive['error'](_0xbb10('0x1e9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db[_0xbb10('0x9d')]=undefined;}_0x2d81db[_0xbb10('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2d81db[_0xbb10('0x47')],'collection\x20data\x20in\x20progressive\x20at',_0x2d81db[_0xbb10('0x2d')]);this['handlePower'](_0x2d81db,0x1);}else if(ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])){this['handlePower'](_0x2d81db,0x1);loggerPredictiveCalls['info'](_0xbb10('0x1eb'),_0x2d81db[_0xbb10('0x2d')],_0x2d81db['name']);_0x2d81db[_0xbb10('0x7b')]=0x0;_0x2d81db[_0xbb10('0x76')]=0x0;}else if(_0x28ee28<_0x5db829&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ed'),_0xbb10('0x1ee'),_0x5db829,_0xbb10('0x2d'),_0x2d81db[_0xbb10('0x47')]);}else if(_0x5273ef<_0x2d81db[_0xbb10('0x76')]&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ef'),_0xbb10('0x1f0'),_0x5273ef,'Drop\x20in\x20this\x20interval',_0x2d81db[_0xbb10('0x76')],_0xbb10('0x2d'),_0x2d81db['name']);}else if(!ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])&&_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2c')])&&!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){_0x2d81db[_0xbb10('0x2c')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f1'),_0x2d81db[_0xbb10('0x2c')]);this['averageHandleTime'](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this['getDataPredictive'](_0x2d81db))['then'](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this[_0xbb10('0x1f2')](_0x2d81db))[_0xbb10('0xbc')](loggerCatchPredictive(_0xbb10('0x1f3'),_0x2d81db));}else if(!ifInterval(_0x2d81db['dialPredictiveInterval'],_0x2d81db[_0xbb10('0x2c')])){_0x2d81db['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2d81db['startPredictive']=moment()['format'](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f4'),_0x2d81db['startPredictive']);clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db['handlePredictive']=undefined;this[_0xbb10('0xca')](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this[_0xbb10('0x1f5')](_0x2d81db))[_0xbb10('0xc2')](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this['startMethodPredictive'](_0x2d81db))['catch'](loggerCatchPredictive(_0xbb10('0x1f6'),_0x2d81db));}else if(_0x2d81db['predictiveIntervalAvailable']&&_0x21ae70<_0x2d81db[_0xbb10('0x79')]-_0x385374){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f7'),_0x2d81db[_0xbb10('0x79')],'-',_0x385374,'=',_0x2d81db[_0xbb10('0x79')]-_0x385374,')');}else if(_0x2d81db[_0xbb10('0x79')]&&_0x21ae70>_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f8'),_0x2d81db['predictiveIntervalAvailable'],'+',_0xb7f2fa,'=',_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa,')');}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f5')]=function(_0x21139c){var _0x4276d6=this;return function(_0x2d5931){return new Promise(function(_0x550911,_0x2ddf65){_[_0xbb10('0x9b')](_0x21139c,_0x2d5931[0x0]);if(checkGetDataPredictive(_0x2d5931[0x0])){var _0x117375=_0x21139c['predictiveIntervalAvailable']=_0x21139c['talking']+_0x21139c[_0xbb10('0x58')];var _0x3134a6=_0x21139c['dialPredictiveInterval']*0x3c;var _0x51f8f3=_0x2d5931[0x0][_0xbb10('0x72')]+_0x2d5931[0x0][_0xbb10('0x71')];var _0xeb8dd3=(_0x2d5931[0x0][_0xbb10('0x70')]+_0x2d5931[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d5931[0x0][_0xbb10('0x73')])/_0x2d5931[0x0][_0xbb10('0x92')];_0x21139c[_0xbb10('0x77')]=_0xeb8dd3>0x0?_0xeb8dd3:0x1;switch(_0x21139c[_0xbb10('0x1ec')]){case'dropRate':var _0x5a4172=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6[_0xbb10('0x1f9')](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x5a4172)[_0xbb10('0xc2')](function(_0x98e790){return _0x550911(_0x98e790);});case _0xbb10('0x1fa'):var _0x1df852=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6['busyFactor'](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x1df852)[_0xbb10('0xc2')](function(_0x30fe12){return _0x550911(_0x30fe12);});default:return _0x2ddf65(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),'Unknown\x20Predictive'));}}else{return _0x2ddf65(msgResponse('[getDataPredictive]',_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1fd')]=function(_0x4cf6ab){var _0x3ca88f=this;return function(_0x37bd6d){return new Promise(function(_0x66a0b8,_0x2df4dd){_[_0xbb10('0x9b')](_0x4cf6ab,_0x37bd6d[0x0]);if(checkGetDataPredictive(_0x37bd6d[0x0])){loggerPredictive[_0xbb10('0x89')](JSON['stringify'](_0x37bd6d[0x0]));if(_0x4cf6ab[_0xbb10('0x1ec')]===_0xbb10('0x1fe')){return _0x3ca88f[_0xbb10('0xd5')](_0x4cf6ab['id'])[_0xbb10('0xc2')](function(_0x3b156c){var _0x5c2c1c=_0x4cf6ab[_0xbb10('0x59')]-_0x3b156c[0x0][_0xbb10('0x1ff')];var _0x228027=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x2553ec=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x1e87e3=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x37bd6d[0x0][_0xbb10('0x73')])/_0x37bd6d[0x0]['predictiveIntervalTotalCalls'];var _0x3c4abf=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3b156c[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x1e87e3>0x0?_0x1e87e3:0x1;return _0x3ca88f[_0xbb10('0x1f9')](_0x5c2c1c,_0x228027,_0x2553ec,_0x1e87e3,_0x3c4abf);})['then'](function(_0xdf2955){return _0x66a0b8(_0xdf2955);})[_0xbb10('0xbc')](function(_0x6350a6){return _0x2df4dd(msgResponse(_0xbb10('0x200'),_0xbb10('0x156'),JSON[_0xbb10('0x82')](_0x6350a6)));});}if(_0x4cf6ab['dialPredictiveOptimization']===_0xbb10('0x1fa')){return _0x3ca88f['getVoiceQueueRtPauses'](_0x4cf6ab['id'])['then'](function(_0x3f346b){var _0x54d70f=_0x4cf6ab[_0xbb10('0x59')]-_0x3f346b[0x0][_0xbb10('0x1ff')];var _0x5441c8=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x7c1f83=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x3a3912=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0][_0xbb10('0x74')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x37bd6d[0x0][_0xbb10('0x92')];var _0x21c4dd=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3f346b[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x3a3912>0x0?_0x3a3912:0x1;return _0x3ca88f[_0xbb10('0x201')](_0x54d70f,_0x5441c8,_0x7c1f83,_0x3a3912,_0x21c4dd);})['then'](function(_0x56d89c){return _0x66a0b8(_0x56d89c);})[_0xbb10('0xbc')](function(_0x3ec298){return _0x2df4dd(msgResponse(_0xbb10('0x200'),'Failure',JSON[_0xbb10('0x82')](_0x3ec298)));});}}else{return _0x2df4dd(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f2')]=function(_0x4f162d){var _0x3a6a8b=this;return function(){var _0x48a25d=0x0;var _0x14a786=Math[_0xbb10('0x202')](_0x4f162d['erlangCallToSecond']*0x3e8);if(_0x14a786>0x0){_0x14a786=_0x14a786<0x64?0x64:_0x14a786;loggerPredictive['info'](_0x4f162d['name'],_0xbb10('0x203'),_0x14a786,_0xbb10('0x52'));_0x4f162d[_0xbb10('0x9d')]=setInterval(function(){_0x3a6a8b[_0xbb10('0x9d')](_0x4f162d);loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x204'),_0x48a25d+=0x1);},_0x14a786);}else{loggerPredictive[_0xbb10('0x89')](_0x4f162d[_0xbb10('0x47')],_0xbb10('0x205'));}};};Dialer[_0xbb10('0x1d')]['checkContactBlack']=function(_0x1ab3d1,_0x175398){var _0x5b3340=this;return function(_0x8c06ed){if(_['isEmpty'](_0x8c06ed)){if(_['isNil'](_0x175398['UserId'])||!_0x175398[_0xbb10('0x206')]){if(_0x1ab3d1[_0xbb10('0x63')]==='booked'){_0x1ab3d1[_0xbb10('0x13e')]=_[_0xbb10('0x93')](_0x1ab3d1[_0xbb10('0x13e')])?!![]:_0x1ab3d1[_0xbb10('0x13e')];var _0x3cb207=uuid['v4']();_0x5b3340[_0xbb10('0x29')][_0x3cb207]=new Action(_0x1ab3d1,_0x175398,_0x3cb207);loggerBooked[_0xbb10('0x89')]('[booked][checkContactBlack]',_0x3cb207,_0xbb10('0x207'),JSON['stringify'](_0x1ab3d1['queueStatusComplete']),'Queue:\x20',_0x1ab3d1['name']);if(_0x1ab3d1[_0xbb10('0x13e')]){_0x1ab3d1[_0xbb10('0x13e')]=![];_0x5b3340[_0xbb10('0x13d')][_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xbe')]]=[];ami['Action']({'actionid':_0x3cb207,'action':'queuestatus','queue':_0x1ab3d1[_0xbb10('0x47')]})[_0xbb10('0xbc')](function(){_0x5b3340['updateOriginated'](_0x1ab3d1);_0x5b3340['rescheduleContact']({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe0')],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x208')));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];});}else{loggerBooked[_0xbb10('0x89')](_0xbb10('0x209'),JSON[_0xbb10('0x82')](_0x1ab3d1[_0xbb10('0x13e')]),_0xbb10('0x20a'),_0x1ab3d1[_0xbb10('0x47')]);_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);_0x5b3340[_0xbb10('0xcd')]({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207]['ContactId'],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];}}else{return _0x5b3340[_0xbb10('0x184')](_0x1ab3d1,_0x175398);}}else{if(getDiff(_0x175398[_0xbb10('0x20b')])<_0x1ab3d1[_0xbb10('0x20c')]*0x3c){if(_0x175398[_0xbb10('0x17d')]&&!_0x175398[_0xbb10('0x17d')]['voicePause']){_0x5b3340[_0xbb10('0x22')]['run'](_0x175398['id'])[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}else{_0x5b3340[_0xbb10('0xcf')]({'active':![]},_0x175398['id'],0x1)[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}}else{_0x1ab3d1[_0xbb10('0x6d')]+=0x1;_0x5b3340['updateOriginated'](_0x1ab3d1);if(_0x1ab3d1[_0xbb10('0x20d')]){_0x5b3340['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x175398[_0xbb10('0xe0')],'ListId':_0x175398[_0xbb10('0xe1')],'VoiceQueueId':_0x175398['VoiceQueueId']||undefined,'CampaignId':_0x175398['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x20e')));_0x5b3340[_0xbb10('0xd9')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x20f'),0x17,_0xbb10('0x210')))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x211')));}else{_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x212'),0x16,_0xbb10('0x213')),_0xbb10('0x214'),_0xbb10('0x215'));}}}}else{_0x1ab3d1['outboundBlacklistCallsDay']+=0x1;_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x216'),0xd,_0xbb10('0x217')),_0xbb10('0x218'),_0xbb10('0x219'));throw _0xbb10('0x21a');}};};Dialer[_0xbb10('0x1d')]['handleIvr']=function(_0x555140){var _0xc65a96=this;var _0x4e00a7=_0x555140[_0xbb10('0x21b')]-_0x555140['originated']-_0x555140[_0xbb10('0xd1')];emitCampaignSummary(_0x555140);if(_0x4e00a7>0x0){if(_0x4e00a7>this['maxNumberOriginate']){_0x4e00a7=this[_0xbb10('0x27')];}_0x555140[_0xbb10('0xd1')]+=_0x4e00a7;this['getContactDialerIvr'](_0x555140['id'],_0x4e00a7,_0x555140['dialOrderByScheduledAt'],_0x555140)[_0xbb10('0xc2')](function(_0x4be84b){_0x555140[_0xbb10('0xd1')]-=_0x4e00a7;_0x555140[_0xbb10('0xd1')]=_0x555140[_0xbb10('0xd1')]>0x0?_0x555140['temp']:0x0;if(!checkContactEmpty(_0x4be84b)){_0x555140['message']=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0x21c')+_0x555140[_0xbb10('0x47')]);}else{_0x555140['originated']+=_0x4be84b['length'];_0x555140[_0xbb10('0x46')]=_0xbb10('0x21d');for(var _0x434b54=0x0;_0x434b54<_0x4be84b['length'];_0x434b54+=0x1){_0x555140[_0xbb10('0x21e')]+=0x1;if(_[_0xbb10('0xb8')](_0x4be84b[_0x434b54])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54]['Contact'])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54][_0xbb10('0x188')])){_0xc65a96[_0xbb10('0xde')]('[actionOriginate]\x20',_0x555140,_0x4be84b[_0x434b54]);}else{_0xc65a96[_0xbb10('0xc8')](_[_0xbb10('0xdf')](_0x4be84b[_0x434b54],['CampaignId','Contact.phone']))[_0xbb10('0xc2')](_0xc65a96[_0xbb10('0x21f')](_0x555140,_0x4be84b[_0x434b54]))[_0xbb10('0xbc')](_0xc65a96['loggerHandler'](_0xbb10('0x220'),_0x555140));}}}})[_0xbb10('0xbc')](loggerGetContactDialer(_0xbb10('0x221'),_0x555140,_0x4e00a7));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x16e')]=function(_0x55d0a9,_0x35a95a){var _0x14ecd7=this;var _0x1ca18a=[];var _0x3b9ab7=_0x35a95a>=0x1?_0x35a95a:0x1;if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x3b9ab7=0x1;}var _0x196bc0=Math[_0xbb10('0x202')](_0x55d0a9[_0xbb10('0x58')]*_0x3b9ab7)-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9[_0xbb10('0xd1')];emitVoiceQueueSummary(_0x55d0a9);if(_0x55d0a9[_0xbb10('0x222')]>0x0){var _0x439322=_0x55d0a9['dialLimitQueue']-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9['talking']-_0x55d0a9['temp']-_0x55d0a9[_0xbb10('0x5a')];if(_0x196bc0>_0x439322){_0x196bc0=_0x439322;}}if(_0x196bc0>0x0){if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x196bc0=0x1;}if(_0x196bc0>this['maxNumberOriginate']){_0x196bc0=this[_0xbb10('0x27')];}_0x55d0a9[_0xbb10('0xd1')]+=_0x196bc0;for(var _0x160b82 in this[_0xbb10('0x25')]){if(typeof this[_0xbb10('0x25')][_0x160b82]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x160b82]['state']==='not_inuse'&&this[_0xbb10('0x25')][_0x160b82][_0xbb10('0xba')]===_0xbb10('0xea')){_0x1ca18a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x160b82]['id']);}}}this[_0xbb10('0xd0')](_0x55d0a9['id'],_0x1ca18a,_0x196bc0,_0x55d0a9[_0xbb10('0x223')],_0x55d0a9)[_0xbb10('0xc2')](function(_0x264837){_0x55d0a9[_0xbb10('0xd1')]-=_0x196bc0;_0x55d0a9['temp']=_0x55d0a9[_0xbb10('0xd1')]>0x0?_0x55d0a9[_0xbb10('0xd1')]:0x0;if(!checkContactEmpty(_0x264837)){_0x14ecd7[_0xbb10('0xc3')](_0x55d0a9)[_0xbb10('0xc2')](sendMessageReschedule(_0x55d0a9))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x55d0a9[_0xbb10('0x7a')]+=_0x264837['length'];_0x55d0a9[_0xbb10('0x46')]=_0x55d0a9[_0xbb10('0x63')]==='booked'?_0xbb10('0x190'):'RUNNING';for(var _0xb427a4=0x0;_0xb427a4<_0x264837[_0xbb10('0xa5')];_0xb427a4+=0x1){if(_['isNil'](_0x264837[_0xb427a4])||_['isNil'](_0x264837[_0xb427a4]['Contact'])||_[_0xbb10('0xb8')](_0x264837[_0xb427a4]['phone'])){_0x14ecd7['emptyContact']('[actionOriginate]\x20',_0x55d0a9,_0x264837[_0xb427a4]);}else{_0x14ecd7['checkIsBlackList'](_[_0xbb10('0xdf')](_0x264837[_0xb427a4],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x14ecd7[_0xbb10('0x21f')](_0x55d0a9,_0x264837[_0xb427a4]))[_0xbb10('0xbc')](_0x14ecd7[_0xbb10('0xdd')](_0xbb10('0x226'),_0x55d0a9));}}}})[_0xbb10('0xbc')](loggerGetContactDialer('[getContactDialer2]',_0x55d0a9,_0x196bc0));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x9d')]=function(_0x32b778){if(_0x32b778[_0xbb10('0x222')]>0x0){var _0x3152b0=_0x32b778[_0xbb10('0x222')]-_0x32b778['originated']-_0x32b778[_0xbb10('0x5d')];if(_0x3152b0>0x0){this[_0xbb10('0x227')](_0x32b778);}else{loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x228'));}}else{this[_0xbb10('0x227')](_0x32b778);}};Dialer[_0xbb10('0x1d')][_0xbb10('0x227')]=function(_0x260715){var _0x50fce7=this;var _0x23855a=[];_0x260715['originated']+=0x1;for(var _0x474af7 in this['agents']){if(typeof this['agents'][_0x474af7]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x474af7][_0xbb10('0x10f')]==='not_inuse'&&this['agents'][_0x474af7]['status']==='reachable'){_0x23855a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x474af7]['id']);}}}this['getContactDialer'](_0x260715['id'],_0x23855a,0x1,_0x260715['dialOrderByScheduledAt'],_0x260715)[_0xbb10('0xc2')](function(_0x37b4b2){if(!checkContactEmpty(_0x37b4b2)){checkContactLowerLimitOriginate(_0x260715,0x1,0x0);_0x50fce7['countReScheduled'](_0x260715)[_0xbb10('0xc2')](sendMessageReschedule(_0x260715))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x260715[_0xbb10('0x46')]=_0xbb10('0x21d');if(_[_0xbb10('0xb8')](_0x37b4b2[0x0])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x1a2')])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x188')])){_0x50fce7[_0xbb10('0xde')]('[actionOriginate]\x20',_0x260715,_0x37b4b2[0x0]);}else{_0x50fce7[_0xbb10('0x229')](_[_0xbb10('0xdf')](_0x37b4b2[0x0],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x50fce7[_0xbb10('0x21f')](_0x260715,_0x37b4b2[0x0]))[_0xbb10('0xbc')](_0x50fce7['loggerHandler'](_0xbb10('0x22a'),_0x260715));}}})['catch'](loggerGetContactDialer(_0xbb10('0x22b'),_0x260715,0x1));emitVoiceQueueSummary(_0x260715);};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f9')]=function(_0x2e34ea,_0x298e18,_0xbd394f,_0xf39c0d,_0x37be00,_0x11b9f7){loggerPredictive['info'](_0xbb10('0x22c'));loggerPredictive[_0xbb10('0x89')]('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',_0x2e34ea);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x22d'),_0x298e18);loggerPredictive[_0xbb10('0x89')]('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',_0xbd394f);loggerPredictive[_0xbb10('0x89')]('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',_0xf39c0d);loggerPredictive['info'](_0xbb10('0x22e'),_0x37be00);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x5153ef,_0x434580){if(_0x2e34ea<=0x0||isNaN(_0x2e34ea)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x230')+_0x2e34ea));}if(_0xbd394f<=0x0||isNaN(_0xbd394f)){return _0x434580(msgResponse(_0xbb10('0x22f'),'Error',_0xbb10('0x231')+_0xbd394f));}if(_0xf39c0d<=0x0||isNaN(_0xf39c0d)){return _0x434580(msgResponse('[abandonmentRate]',_0xbb10('0x51'),_0xbb10('0x232')+_0xf39c0d));}if(_0x298e18<=0x0||isNaN(_0x298e18)){return _0x434580(msgResponse('[abandonmentRate]','Error',_0xbb10('0x233')+_0x298e18));}if(_0x37be00<=0x0||isNaN(_0x37be00)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x234')+_0x37be00));}_0x11b9f7=_0x11b9f7||0x0;var _0x55e1eb=0x1/_0xbd394f;var _0x385a49=0x0;var _0x174892=0x0;var _0x45be3b=0x0;var _0x4269c9=0x0;for(var _0x1e7f42=0x0;_0x45be3b<_0x37be00;_0x1e7f42+=0x1){_0x174892=_0x1e7f42/_0x298e18;_0x385a49=(_0xf39c0d*_0x174892+_0x11b9f7)/_0x55e1eb;_0x45be3b=erlangb(_0x385a49,_0x2e34ea);_0x4269c9=_0x385a49/_0x2e34ea*(0x1-erlangb(_0x385a49,_0x2e34ea));}return _0x5153ef({'erlangCalls':_0x1e7f42,'erlangCallToSecond':_0x298e18/_0x1e7f42,'erlangAbandonmentRate':_0x45be3b,'erlangBusyFactor':_0x4269c9});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x201')]=function(_0x397c33,_0x4e3f92,_0xf2ab83,_0x1ad4ec,_0x2cb4be,_0x2f66ba){loggerPredictive['info'](_0xbb10('0x235'));loggerPredictive[_0xbb10('0x89')](_0xbb10('0x236'),_0x397c33);loggerPredictive[_0xbb10('0x89')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e3f92);loggerPredictive[_0xbb10('0x89')]('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',_0xf2ab83);loggerPredictive[_0xbb10('0x89')]('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',_0x1ad4ec);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x237'),_0x2cb4be);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x27adad,_0x5a6b68){if(_0x397c33<=0x0||isNaN(_0x397c33)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error','m\x20=\x20'+_0x397c33));}if(_0xf2ab83<=0x0||isNaN(_0xf2ab83)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),_0xbb10('0x51'),_0xbb10('0x231')+_0xf2ab83));}if(_0x1ad4ec<=0x0||isNaN(_0x1ad4ec)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error',_0xbb10('0x232')+_0x1ad4ec));}if(_0x4e3f92<=0x0||isNaN(_0x4e3f92)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x233')+_0x4e3f92));}if(_0x2cb4be<=0x0||isNaN(_0x2cb4be)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x239')+_0x2cb4be));}_0x2f66ba=_0x2f66ba||0x0;var _0xb998a1=0x1/_0xf2ab83;var _0x248c5c=0x0;var _0x456ecb=0x0;var _0x1391b7=0x0;var _0x4d5ac5=0x0;for(var _0x366f17=0x0;_0x4d5ac5<_0x2cb4be;_0x366f17+=0x1){_0x456ecb=_0x366f17/_0x4e3f92;_0x248c5c=(_0x1ad4ec*_0x456ecb+_0x2f66ba)/_0xb998a1;_0x1391b7=erlangb(_0x248c5c,_0x397c33);_0x4d5ac5=_0x248c5c/_0x397c33*(0x1-erlangb(_0x248c5c,_0x397c33));}return _0x27adad({'erlangCalls':_0x366f17,'erlangCallToSecond':_0x4e3f92/_0x366f17,'erlangAbandonmentRate':_0x1391b7,'erlangBusyFactor':_0x4d5ac5});});};module[_0xbb10('0x23a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 0af69a9..e4205db 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 _0xb682=['exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x3ed251,_0x281111){var _0x2795c9=function(_0x4fc72f){while(--_0x4fc72f){_0x3ed251['push'](_0x3ed251['shift']());}};_0x2795c9(++_0x281111);}(_0xb682,0x79));var _0x2b68=function(_0x4046b6,_0x238c36){_0x4046b6=_0x4046b6-0x0;var _0x1443be=_0xb682[_0x4046b6];return _0x1443be;};'use strict';var util=require('util');var _=require(_0x2b68('0x0'));var moment=require(_0x2b68('0x1'));function getSeconds(_0x14fb26,_0x27c2e6){var _0x1a6ced=moment(_0x14fb26)['milliseconds'](0x0);var _0x15b2dc=moment(_0x27c2e6)[_0x2b68('0x2')](0x0);return _0x1a6ced[_0x2b68('0x3')](_0x15b2dc,_0x2b68('0x4'));}function QueueCallerAbandon(_0x1f1cf5,_0x59c69c){this['scheduledat']=_0x1f1cf5[_0x2b68('0x5')];this[_0x2b68('0x6')]=_0x1f1cf5[_0x2b68('0x6')];this['campaigntype']=_0x1f1cf5[_0x2b68('0x6')]===_0x2b68('0x7')?_0x2b68('0x8'):_0x1f1cf5[_0x2b68('0x6')];this[_0x2b68('0x9')]=_0x1f1cf5[_0x2b68('0x9')];this[_0x2b68('0xa')]=_0x1f1cf5[_0x2b68('0xa')];this['countnoanswerretry']=_0x1f1cf5[_0x2b68('0xb')];this[_0x2b68('0xc')]=_0x1f1cf5[_0x2b68('0x9')]+_0x1f1cf5[_0x2b68('0xa')]+_0x1f1cf5['countnoanswerretry']+_0x1f1cf5[_0x2b68('0xd')]+_0x1f1cf5[_0x2b68('0xe')]+_0x1f1cf5[_0x2b68('0xf')]+_0x1f1cf5['countmachineretry']+_0x1f1cf5[_0x2b68('0x10')];this[_0x2b68('0xd')]=_0x1f1cf5[_0x2b68('0xd')];this['countdropretry']=_0x1f1cf5[_0x2b68('0xe')];this[_0x2b68('0xf')]=_0x1f1cf5[_0x2b68('0xf')];this['countmachineretry']=_0x1f1cf5['countmachineretry'];this[_0x2b68('0x10')]=_0x1f1cf5[_0x2b68('0x10')];this[_0x2b68('0x11')]=_0x59c69c[_0x2b68('0x11')];this[_0x2b68('0x12')]=_0x1f1cf5['name'];this[_0x2b68('0x13')]=_0x1f1cf5[_0x2b68('0x14')];this[_0x2b68('0x15')]=_0x1f1cf5[_0x2b68('0x15')];this[_0x2b68('0x16')]=_0x1f1cf5[_0x2b68('0x16')];this[_0x2b68('0x17')]=_0x1f1cf5[_0x2b68('0x17')];this[_0x2b68('0x18')]=this[_0x2b68('0x17')];this['ringtime']=getSeconds(_0x1f1cf5[_0x2b68('0x16')],_0x1f1cf5['starttime']);this[_0x2b68('0x19')]=getSeconds(this[_0x2b68('0x17')],_0x1f1cf5['responsetime']);this[_0x2b68('0x1a')]=0x0;this[_0x2b68('0x8')]=_0x59c69c[_0x2b68('0x8')];this['membername']=_0x59c69c['connectedlinename'];this[_0x2b68('0x1b')]=_0x59c69c[_0x2b68('0x1b')];this[_0x2b68('0x1c')]=_0x1f1cf5[_0x2b68('0x1c')];this[_0x2b68('0x1d')]=_0x1f1cf5['callbackuniqueid'];this['callbackat']=_0x1f1cf5[_0x2b68('0x1e')];this[_0x2b68('0x1f')]=_0x1f1cf5[_0x2b68('0x1f')];this['ContactId']=_0x1f1cf5[_0x2b68('0x20')];this[_0x2b68('0x21')]=_0x1f1cf5[_0x2b68('0x21')];this[_0x2b68('0x22')]=_0x1f1cf5['UserId'];this[_0x2b68('0x23')]=_0x1f1cf5[_0x2b68('0x23')];this[_0x2b68('0x24')]=_0x1f1cf5['CampaignId'];this[_0x2b68('0x25')]=_0x1f1cf5[_0x2b68('0x25')]||'';this[_0x2b68('0x26')]=_0x1f1cf5[_0x2b68('0x26')]||'';}module[_0x2b68('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0xfe01=['util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports'];(function(_0x259670,_0x5f11c2){var _0x340ece=function(_0x1755d7){while(--_0x1755d7){_0x259670['push'](_0x259670['shift']());}};_0x340ece(++_0x5f11c2);}(_0xfe01,0x126));var _0x1fe0=function(_0x20d819,_0x2fe23b){_0x20d819=_0x20d819-0x0;var _0x305fbe=_0xfe01[_0x20d819];return _0x305fbe;};'use strict';var util=require(_0x1fe0('0x0'));var _=require(_0x1fe0('0x1'));var moment=require(_0x1fe0('0x2'));function getSeconds(_0x400b93,_0x3f6936){var _0x33ef1b=moment(_0x400b93)[_0x1fe0('0x3')](0x0);var _0x37238d=moment(_0x3f6936)[_0x1fe0('0x3')](0x0);return _0x33ef1b[_0x1fe0('0x4')](_0x37238d,_0x1fe0('0x5'));}function QueueCallerAbandon(_0x23d409,_0x53d4b7){this[_0x1fe0('0x6')]=_0x23d409[_0x1fe0('0x6')];this[_0x1fe0('0x7')]=_0x23d409[_0x1fe0('0x7')];this[_0x1fe0('0x8')]=_0x23d409[_0x1fe0('0x7')]==='outbound'?_0x1fe0('0x9'):_0x23d409[_0x1fe0('0x7')];this['countbusyretry']=_0x23d409[_0x1fe0('0xa')];this[_0x1fe0('0xb')]=_0x23d409[_0x1fe0('0xb')];this[_0x1fe0('0xc')]=_0x23d409[_0x1fe0('0xc')];this[_0x1fe0('0xd')]=_0x23d409[_0x1fe0('0xa')]+_0x23d409[_0x1fe0('0xb')]+_0x23d409[_0x1fe0('0xc')]+_0x23d409['countnosuchnumberretry']+_0x23d409[_0x1fe0('0xe')]+_0x23d409['countabandonedretry']+_0x23d409[_0x1fe0('0xf')]+_0x23d409['countagentrejectretry'];this['countnosuchnumberretry']=_0x23d409[_0x1fe0('0x10')];this[_0x1fe0('0xe')]=_0x23d409['countdropretry'];this[_0x1fe0('0x11')]=_0x23d409['countabandonedretry'];this[_0x1fe0('0xf')]=_0x23d409[_0x1fe0('0xf')];this['countagentrejectretry']=_0x23d409['countagentrejectretry'];this[_0x1fe0('0x12')]=_0x53d4b7[_0x1fe0('0x12')];this['calleridname']=_0x23d409[_0x1fe0('0x13')];this[_0x1fe0('0x14')]=_0x23d409[_0x1fe0('0x15')];this[_0x1fe0('0x16')]=_0x23d409[_0x1fe0('0x16')];this[_0x1fe0('0x17')]=_0x23d409[_0x1fe0('0x17')];this['droptime']=_0x23d409[_0x1fe0('0x18')];this[_0x1fe0('0x19')]=this[_0x1fe0('0x18')];this[_0x1fe0('0x1a')]=getSeconds(_0x23d409['responsetime'],_0x23d409[_0x1fe0('0x16')]);this[_0x1fe0('0x1b')]=getSeconds(this['droptime'],_0x23d409['responsetime']);this[_0x1fe0('0x1c')]=0x0;this[_0x1fe0('0x9')]=_0x53d4b7['queue'];this[_0x1fe0('0x1d')]=_0x53d4b7[_0x1fe0('0x1e')];this['reason']=_0x53d4b7[_0x1fe0('0x1f')];this['callback']=_0x23d409[_0x1fe0('0x20')];this[_0x1fe0('0x21')]=_0x23d409[_0x1fe0('0x21')];this[_0x1fe0('0x22')]=_0x23d409['callbackat'];this['recallme']=_0x23d409[_0x1fe0('0x23')];this[_0x1fe0('0x24')]=_0x23d409[_0x1fe0('0x24')];this[_0x1fe0('0x25')]=_0x23d409['ListId'];this[_0x1fe0('0x26')]=_0x23d409[_0x1fe0('0x26')];this[_0x1fe0('0x27')]=_0x23d409[_0x1fe0('0x27')];this[_0x1fe0('0x28')]=_0x23d409['CampaignId'];this['originatecalleridnum']=_0x23d409['originatecalleridnum']||'';this['originatecalleridname']=_0x23d409['originatecalleridname']||'';}module[_0x1fe0('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 8fb699c..70f33fc 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(_0x5673b7,_0x173b1){var _0x127a88=function(_0x2ea319){while(--_0x2ea319){_0x5673b7['push'](_0x5673b7['shift']());}};_0x127a88(++_0x173b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x492420,_0x4536ee){var _0xd8f3be=function(_0x10f20f){while(--_0x10f20f){_0x492420['push'](_0x492420['shift']());}};_0xd8f3be(++_0x4536ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 d9b789e..fda453d 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 _0x374e=['value','prototype','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','syncOriginateResponse','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','Trunk','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','context','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty'];(function(_0x586642,_0x3b2e5d){var _0xef997a=function(_0x31839a){while(--_0x31839a){_0x586642['push'](_0x586642['shift']());}};_0xef997a(++_0x3b2e5d);}(_0x374e,0x121));var _0xe374=function(_0xeeee40,_0x3a3887){_0xeeee40=_0xeeee40-0x0;var _0xb85f1c=_0x374e[_0xeeee40];return _0xb85f1c;};'use strict';var util=require(_0xe374('0x0'));var _=require(_0xe374('0x1'));var BPromise=require(_0xe374('0x2'));var uuid=require(_0xe374('0x3'));var moment=require('moment');var path=require(_0xe374('0x4'));var tiff2pdf=require(_0xe374('0x5'));var gs=require(_0xe374('0x6'));var logger=require(_0xe374('0x7'))(_0xe374('0x8'));var ami=require('../ami');var rpcDb=require(_0xe374('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xe374('0xa'));var faxAccount=require(_0xe374('0xb'));var attachment=require(_0xe374('0xc'));var faxMessage=require(_0xe374('0xd'));function Fax(_0x1062d4){this[_0xe374('0xe')]={};this[_0xe374('0xf')]=_0x1062d4[_0xe374('0xf')];this[_0xe374('0x10')]=_0x1062d4['trunks'];this[_0xe374('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0xe374('0x12')](this));ami['on']('varset',this['syncVarSet'][_0xe374('0x12')](this));ami['on'](_0xe374('0x13'),this[_0xe374('0x14')][_0xe374('0x12')](this));ami['on'](_0xe374('0x15'),this[_0xe374('0x16')][_0xe374('0x12')](this));ami['on'](_0xe374('0x17'),this[_0xe374('0x18')][_0xe374('0x12')](this));ami['on'](_0xe374('0x19'),this[_0xe374('0x1a')][_0xe374('0x12')](this));ami['on'](_0xe374('0x1b'),this[_0xe374('0x1c')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xe374('0x12')](this));}Fax['prototype']['syncNewchannel']=function(_0x5ca8c1){if(_0x5ca8c1[_0xe374('0x1d')]==='from-voip-provider'){for(var _0x1a1bbc in this['faxAccounts']){if(this[_0xe374('0xf')]['hasOwnProperty'](_0x1a1bbc)){if(_0x5ca8c1['exten']===this['faxAccounts'][_0x1a1bbc][_0xe374('0x1e')]){this[_0xe374('0xe')][_0x5ca8c1[_0xe374('0x1f')]]={};this['channels'][_0x5ca8c1[_0xe374('0x1f')]]['channel']=_0x5ca8c1[_0xe374('0x20')];this[_0xe374('0xe')][_0x5ca8c1['uniqueid']]['id']=this[_0xe374('0xf')][_0x1a1bbc]['id'];this['channels'][_0x5ca8c1['uniqueid']][_0xe374('0x21')]=this[_0xe374('0xf')][_0x1a1bbc][_0xe374('0x21')];logger[_0xe374('0x22')](_0x5ca8c1[_0xe374('0x1f')],_0xe374('0x23'));}}}}if(this[_0xe374('0x11')][_0x5ca8c1[_0xe374('0x1f')]]){this[_0xe374('0xe')][_0x5ca8c1['uniqueid']]={};this[_0xe374('0xe')][_0x5ca8c1[_0xe374('0x1f')]][_0xe374('0x20')]=_0x5ca8c1[_0xe374('0x20')];logger[_0xe374('0x22')](_0x5ca8c1[_0xe374('0x1f')],_0xe374('0x23'));}};Fax['prototype']['syncVarSet']=function(_0x4c07ce){if(this[_0xe374('0xe')][_0x4c07ce[_0xe374('0x1f')]]){for(var _0x3d0920 in _0x4c07ce[_0xe374('0x24')]){if(_0x4c07ce[_0xe374('0x24')][_0xe374('0x25')](_0x3d0920)){this[_0xe374('0xe')][_0x4c07ce['uniqueid']][_0x3d0920]=_0x4c07ce[_0xe374('0x26')];}}}};Fax[_0xe374('0x27')]['syncNewState']=function(_0x3e9e43){if(this[_0xe374('0xe')][_0x3e9e43[_0xe374('0x1f')]]){this[_0xe374('0xe')][_0x3e9e43[_0xe374('0x1f')]][_0xe374('0x28')]=_0x3e9e43[_0xe374('0x28')];this[_0xe374('0xe')][_0x3e9e43[_0xe374('0x1f')]][_0xe374('0x29')]=_0x3e9e43[_0xe374('0x29')];}};Fax['prototype']['syncNewExten']=function(_0x399a5a){if(this[_0xe374('0xe')][_0x399a5a[_0xe374('0x1f')]]){for(var _0x274b83 in _0x399a5a[_0xe374('0x24')]){if(_0x399a5a[_0xe374('0x24')][_0xe374('0x25')](_0x274b83)){this[_0xe374('0xe')][_0x399a5a[_0xe374('0x1f')]][_0x274b83]=_0x399a5a['value'];}}}};Fax['prototype'][_0xe374('0x18')]=function(_0x4153b8){if(this[_0xe374('0xe')][_0x4153b8[_0xe374('0x1f')]]){this['channels'][_0x4153b8['uniqueid']][_0xe374('0x2a')]=_0x4153b8[_0xe374('0x2a')];this[_0xe374('0xe')][_0x4153b8['uniqueid']][_0xe374('0x2b')]=_0x4153b8[_0xe374('0x2b')];this[_0xe374('0xe')][_0x4153b8[_0xe374('0x1f')]][_0xe374('0x1e')]=_0x4153b8[_0xe374('0x1e')];this['channels'][_0x4153b8['uniqueid']]['filename']=_0x4153b8['filename'];logger['info'](_0x4153b8[_0xe374('0x1f')],_0xe374('0x2c'));}};Fax[_0xe374('0x27')][_0xe374('0x1a')]=function(_0x5cbf04){var _0x3b408d=this;if(this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]]){var _0x2b98bb=this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]]['id'];this[_0xe374('0xe')][_0x5cbf04['uniqueid']]['remotestationid']=_0x5cbf04['remotestationid'];this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]]['pagestransferred']=_0x5cbf04[_0xe374('0x2d')];this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]][_0xe374('0x1e')]=_0x5cbf04[_0xe374('0x1e')];this['channels'][_0x5cbf04[_0xe374('0x1f')]][_0xe374('0x2e')]=_0x5cbf04['resolution'];this[_0xe374('0xe')][_0x5cbf04['uniqueid']][_0xe374('0x2f')]=_0x5cbf04[_0xe374('0x2f')];this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]]['filename']=_0x5cbf04[_0xe374('0x30')];this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]][_0xe374('0x31')]=_0x5cbf04[_0xe374('0x31')];if(this[_0xe374('0xe')][_0x5cbf04[_0xe374('0x1f')]][_0xe374('0x2d')]>0x0){tiff2pdf(_0x5cbf04[_0xe374('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x463ede){logger[_0xe374('0x22')](_0x5cbf04[_0xe374('0x1f')],_0xe374('0x32'),_0x463ede[_0xe374('0x33')]);attachment['create']({'name':path[_0xe374('0x34')](_0x5cbf04[_0xe374('0x30')])[_0xe374('0x21')],'basename':path['parse'](_0x5cbf04[_0xe374('0x30')])[_0xe374('0x21')]+'.pdf','type':_0xe374('0x35')})[_0xe374('0x36')](function(_0x53035c){faxAccount[_0xe374('0x37')](_0x2b98bb,{'from':_0x5cbf04['calleridnum'],'mapKey':_0xe374('0x8'),'body':path[_0xe374('0x34')](_0x5cbf04[_0xe374('0x30')])[_0xe374('0x21')]+'.pdf','AttachmentId':_0x53035c['id']})[_0xe374('0x38')](function(_0x38d805){logger[_0xe374('0x39')](_0x5cbf04[_0xe374('0x1f')],'\x20notify\x20',JSON[_0xe374('0x3a')](_0x38d805));});})[_0xe374('0x38')](function(_0x11fa8a){logger[_0xe374('0x39')](_0x5cbf04[_0xe374('0x1f')],_0xe374('0x3b'),JSON[_0xe374('0x3a')](_0x11fa8a));});});}logger[_0xe374('0x22')](_0x5cbf04[_0xe374('0x1f')],_0xe374('0x3b'));}};Fax[_0xe374('0x27')][_0xe374('0x3c')]=function(_0xfd86ba){if(this[_0xe374('0x11')][_0xfd86ba['uniqueid']]){_['merge'](this[_0xe374('0xe')][_0xfd86ba[_0xe374('0x1f')]],_[_0xe374('0x3d')](_0xfd86ba,[_0xe374('0x3e'),_0xe374('0x3f')]));}};function updateStatus(_0x42313e){if(_0x42313e[_0xe374('0x40')]){faxMessage[_0xe374('0x41')](_0x42313e[_0xe374('0x40')],{'failMessage':_0xe374('0x42')})[_0xe374('0x36')](function(_0xe50700){ut[_0xe374('0x43')](_0xe374('0x44'),_0xe50700);})[_0xe374('0x38')](function(_0x3371f8){ut[_0xe374('0x43')](_0xe374('0x45'),_0x3371f8);});}else{ut[_0xe374('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xe374('0x27')][_0xe374('0x46')]=function(_0x132941,_0x514cc1,_0x4959c8){var _0x2f16a3=this;var _0x539fd6={};if(_0x514cc1){_0x539fd6={'read':_0x514cc1};}else{_0x539fd6={'failMessage':_0x4959c8};}if(this['actions'][_0x132941][_0xe374('0x40')]){faxMessage[_0xe374('0x41')](this[_0xe374('0x11')][_0x132941][_0xe374('0x40')],_0x539fd6)[_0xe374('0x36')](function(_0x43316b){ut['logger'](_0xe374('0x47'),_0x43316b);})[_0xe374('0x38')](function(_0x2bd943){ut[_0xe374('0x43')](_0xe374('0x48'),_0x2bd943);})[_0xe374('0x49')](function(){delete _0x2f16a3[_0xe374('0xe')][_0x132941];delete _0x2f16a3['actions'][_0x132941];});}else{ut[_0xe374('0x43')]('[Fax][Message][NoUpdate2]');delete this[_0xe374('0xe')][_0x132941];delete this[_0xe374('0x11')][_0x132941];}};Fax[_0xe374('0x27')][_0xe374('0x1c')]=function(_0x31e360){var _0x45c573=this;if(this['channels'][_0x31e360['uniqueid']]){if(this[_0xe374('0x11')][_0x31e360['uniqueid']]){this[_0xe374('0xe')][_0x31e360['uniqueid']]['id']=this[_0xe374('0x11')][_0x31e360[_0xe374('0x1f')]]['id'];this[_0xe374('0xe')][_0x31e360[_0xe374('0x1f')]][_0xe374('0x21')]=this[_0xe374('0x11')][_0x31e360[_0xe374('0x1f')]]['name'];}logger[_0xe374('0x22')](_0x31e360[_0xe374('0x1f')],this['actions'][_0x31e360[_0xe374('0x1f')]]?_0xe374('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0xe374('0x3a')](this[_0xe374('0xe')][_0x31e360[_0xe374('0x1f')]]));if(this[_0xe374('0x11')][_0x31e360[_0xe374('0x1f')]]){if(this[_0xe374('0xe')][_0x31e360[_0xe374('0x1f')]]['faxpages']>0x0&&this[_0xe374('0xe')][_0x31e360[_0xe374('0x1f')]][_0xe374('0x17')]===_0xe374('0x4b')){this[_0xe374('0x46')](_0x31e360[_0xe374('0x1f')],!![]);}else{this[_0xe374('0x46')](_0x31e360[_0xe374('0x1f')],![],this['channels'][_0x31e360[_0xe374('0x1f')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0xe374('0xe')][_0x31e360[_0xe374('0x1f')]][_0xe374('0x4c')]:_0xe374('0x4d'));}}}};Fax[_0xe374('0x27')][_0xe374('0x4e')]=function(_0x58e0a1){var _0x18d83f=this;return new BPromise(function(_0x31b357,_0x54fe12){_0x18d83f['execOriginate'](_0x58e0a1,_0x18d83f['faxAccounts'][_0x58e0a1[_0xe374('0x4f')]])[_0xe374('0x36')](function(_0x84012a){ut[_0xe374('0x43')](_0xe374('0x50'),_0x84012a);_0x31b357(ut[_0xe374('0x33')](_0xe374('0x51')));})[_0xe374('0x38')](function(_0x41c151){ut[_0xe374('0x43')](_0xe374('0x52'),_0x41c151);updateStatus(_0x58e0a1);_0x54fe12(ut[_0xe374('0x33')]('Fax\x20failed'));});});};Fax[_0xe374('0x27')][_0xe374('0x53')]=function(_0x5a1fa4){var _0x55cdeb=this;return new BPromise(function(_0x5380ee,_0x2a43ea){var _0x5ac396=_0x55cdeb['checkTrunk'](_0x55cdeb['faxAccounts'][_0x5a1fa4[_0xe374('0x4f')]][_0xe374('0x54')],_0x5a1fa4);if(_0x5ac396['isValid']){_0x5380ee(ut['message']('Trunk\x20Reachable'));}else{_0x2a43ea(ut[_0xe374('0x33')](_0x5ac396[_0xe374('0x33')]));}});};function originate(_0x2d9dfb,_0x56f8e3,_0x22542d){return new BPromise(function(_0x1e6423,_0x6f4e11){if(_0x22542d){var _0x1622fe=util[_0xe374('0x55')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x2d9dfb[_0xe374('0x4')])[_0xe374('0x21')],_0x2d9dfb['path']);gs[_0xe374('0x56')](_0x1622fe)[_0xe374('0x36')](function(){_0x2d9dfb[_0xe374('0x4')]=util[_0xe374('0x55')](_0xe374('0x57'),path[_0xe374('0x34')](_0x2d9dfb[_0xe374('0x4')])[_0xe374('0x58')],path[_0xe374('0x34')](_0x2d9dfb[_0xe374('0x4')])[_0xe374('0x21')]);_0x56f8e3[_0xe374('0x59')]=_0x2d9dfb[_0xe374('0x4')];ut[_0xe374('0x43')](_0xe374('0x5a'),'');ami[_0xe374('0x5b')](ut[_0xe374('0x5c')](_0x2d9dfb,_0x56f8e3))['then'](function(_0x91f62a){_0x1e6423(_0x91f62a);})['catch'](function(_0x239d15){_0x6f4e11(_0x239d15);});})[_0xe374('0x38')](function(_0x3ce42a){_0x6f4e11(_0x3ce42a);});}else{ami[_0xe374('0x5b')](ut[_0xe374('0x5c')](_0x2d9dfb,_0x56f8e3))[_0xe374('0x36')](function(_0x346e5){_0x1e6423(_0x346e5);})[_0xe374('0x38')](function(_0x2392c1){_0x6f4e11(_0x2392c1);});}});}Fax[_0xe374('0x27')][_0xe374('0x5d')]=function(_0x2ee65d,_0x4c511f){var _0x23d62c=this;return new BPromise(function(_0x19f33f,_0x3bf986){var _0x48316c=uuid['v4']();var _0x2a05ad=ut[_0xe374('0x5e')](_0x2ee65d,_0x4c511f);_0x23d62c['actions'][_0x48316c]=new Action(_0x48316c,_0x4c511f,_0x2ee65d);var _0x568b56=_0x23d62c[_0xe374('0x11')][_0x48316c];if(path[_0xe374('0x34')](_0x2ee65d[_0xe374('0x4')])[_0xe374('0x5f')]===_0xe374('0x60')){originate(_0x568b56,_0x2a05ad,!![])['then'](function(_0x535bfc){_0x19f33f(_0x535bfc);})['catch'](function(_0x4fa0da){_0x3bf986(_0x4fa0da);});}else{originate(_0x568b56,_0x2a05ad,![])[_0xe374('0x36')](function(_0x40f7b3){_0x19f33f(_0x40f7b3);})[_0xe374('0x38')](function(_0x3668ad){_0x3bf986(_0x3668ad);});}});};Fax[_0xe374('0x27')][_0xe374('0x61')]=function(_0x59a7ac){return!_[_0xe374('0x62')](_0x59a7ac)&&!_[_0xe374('0x62')](_0x59a7ac[_0xe374('0x21')])&&!_[_0xe374('0x62')](_0x59a7ac[_0xe374('0x63')])&&_0x59a7ac[_0xe374('0x63')]&&!_[_0xe374('0x62')](this['trunks'][util['format'](_0xe374('0x64'),_0x59a7ac[_0xe374('0x21')])])&&!_[_0xe374('0x62')](this[_0xe374('0x10')][util[_0xe374('0x55')](_0xe374('0x64'),_0x59a7ac[_0xe374('0x21')])][_0xe374('0x2b')])&&(this[_0xe374('0x10')][util[_0xe374('0x55')](_0xe374('0x64'),_0x59a7ac[_0xe374('0x21')])][_0xe374('0x2b')]===_0xe374('0x65')||this[_0xe374('0x10')][util['format'](_0xe374('0x64'),_0x59a7ac[_0xe374('0x21')])][_0xe374('0x2b')]==='unmonitored');};Fax[_0xe374('0x27')][_0xe374('0x66')]=function(_0x3bf9b6,_0x4b8b05){if(!this[_0xe374('0x61')](_0x3bf9b6)){ut[_0xe374('0x43')](_0xe374('0x67'),_['isNil'](_0x3bf9b6)?'':_0x3bf9b6[_0xe374('0x21')]+_0xe374('0x68'));return{'isValid':![],'message':_0xe374('0x69')};}if(_['isNil'](_0x4b8b05[_0xe374('0x8')])){ut['logger'](_0xe374('0x6a'),JSON[_0xe374('0x3a')](_0x4b8b05));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xe374('0x62')](_0x4b8b05[_0xe374('0x4')])){ut[_0xe374('0x43')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xe374('0x3a')](_0x4b8b05));return{'isValid':![],'message':_0xe374('0x6b')};}return{'isValid':!![],'message':_0xe374('0x6c')};};module['exports']=Fax; \ No newline at end of file +var _0x8989=['addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','\x20notify\x20','error','stringify','\x20receiveFax\x20','pick','response','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction'];(function(_0x2580be,_0x11e696){var _0x4f2518=function(_0x28b3bb){while(--_0x28b3bb){_0x2580be['push'](_0x2580be['shift']());}};_0x4f2518(++_0x11e696);}(_0x8989,0x8b));var _0x9898=function(_0x58f00c,_0x46fe69){_0x58f00c=_0x58f00c-0x0;var _0x1799a2=_0x8989[_0x58f00c];return _0x1799a2;};'use strict';var util=require(_0x9898('0x0'));var _=require(_0x9898('0x1'));var BPromise=require(_0x9898('0x2'));var uuid=require(_0x9898('0x3'));var moment=require(_0x9898('0x4'));var path=require(_0x9898('0x5'));var tiff2pdf=require(_0x9898('0x6'));var gs=require(_0x9898('0x7'));var logger=require(_0x9898('0x8'))(_0x9898('0x9'));var ami=require(_0x9898('0xa'));var rpcDb=require('./rpcDb');var Channel=require(_0x9898('0xb'));var ut=require(_0x9898('0xc'));var Action=require(_0x9898('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x283e0a){this[_0x9898('0xe')]={};this[_0x9898('0xf')]=_0x283e0a[_0x9898('0xf')];this[_0x9898('0x10')]=_0x283e0a[_0x9898('0x10')];this[_0x9898('0x11')]={};ami['on'](_0x9898('0x12'),this[_0x9898('0x13')][_0x9898('0x14')](this));ami['on'](_0x9898('0x15'),this[_0x9898('0x16')][_0x9898('0x14')](this));ami['on'](_0x9898('0x17'),this[_0x9898('0x18')][_0x9898('0x14')](this));ami['on'](_0x9898('0x19'),this[_0x9898('0x1a')][_0x9898('0x14')](this));ami['on'](_0x9898('0x1b'),this[_0x9898('0x1c')]['bind'](this));ami['on'](_0x9898('0x1d'),this['syncReceiveFax']['bind'](this));ami['on'](_0x9898('0x1e'),this[_0x9898('0x1f')][_0x9898('0x14')](this));ami['on'](_0x9898('0x20'),this[_0x9898('0x21')][_0x9898('0x14')](this));}Fax[_0x9898('0x22')][_0x9898('0x13')]=function(_0x3e7491){if(_0x3e7491[_0x9898('0x23')]==='from-voip-provider'){for(var _0x23756e in this['faxAccounts']){if(this[_0x9898('0xf')][_0x9898('0x24')](_0x23756e)){if(_0x3e7491['exten']===this['faxAccounts'][_0x23756e]['localstationid']){this['channels'][_0x3e7491[_0x9898('0x25')]]={};this['channels'][_0x3e7491[_0x9898('0x25')]][_0x9898('0x26')]=_0x3e7491['channel'];this[_0x9898('0xe')][_0x3e7491[_0x9898('0x25')]]['id']=this[_0x9898('0xf')][_0x23756e]['id'];this['channels'][_0x3e7491[_0x9898('0x25')]][_0x9898('0x27')]=this['faxAccounts'][_0x23756e][_0x9898('0x27')];logger[_0x9898('0x28')](_0x3e7491[_0x9898('0x25')],_0x9898('0x29'));}}}}if(this['actions'][_0x3e7491[_0x9898('0x25')]]){this[_0x9898('0xe')][_0x3e7491[_0x9898('0x25')]]={};this[_0x9898('0xe')][_0x3e7491[_0x9898('0x25')]][_0x9898('0x26')]=_0x3e7491[_0x9898('0x26')];logger[_0x9898('0x28')](_0x3e7491[_0x9898('0x25')],_0x9898('0x29'));}};Fax[_0x9898('0x22')]['syncVarSet']=function(_0x32936d){if(this[_0x9898('0xe')][_0x32936d[_0x9898('0x25')]]){for(var _0x6e8591 in _0x32936d[_0x9898('0x2a')]){if(_0x32936d['variable']['hasOwnProperty'](_0x6e8591)){this[_0x9898('0xe')][_0x32936d[_0x9898('0x25')]][_0x6e8591]=_0x32936d['value'];}}}};Fax[_0x9898('0x22')][_0x9898('0x18')]=function(_0x4199a9){if(this[_0x9898('0xe')][_0x4199a9[_0x9898('0x25')]]){this[_0x9898('0xe')][_0x4199a9[_0x9898('0x25')]][_0x9898('0x2b')]=_0x4199a9['channelstate'];this[_0x9898('0xe')][_0x4199a9['uniqueid']][_0x9898('0x2c')]=_0x4199a9[_0x9898('0x2c')];}};Fax[_0x9898('0x22')][_0x9898('0x1a')]=function(_0x5df2c6){if(this[_0x9898('0xe')][_0x5df2c6[_0x9898('0x25')]]){for(var _0x427827 in _0x5df2c6[_0x9898('0x2a')]){if(_0x5df2c6[_0x9898('0x2a')][_0x9898('0x24')](_0x427827)){this['channels'][_0x5df2c6[_0x9898('0x25')]][_0x427827]=_0x5df2c6[_0x9898('0x2d')];}}}};Fax[_0x9898('0x22')]['syncFaxStatus']=function(_0x333e67){if(this[_0x9898('0xe')][_0x333e67[_0x9898('0x25')]]){this[_0x9898('0xe')][_0x333e67[_0x9898('0x25')]][_0x9898('0x2e')]=_0x333e67['operation'];this[_0x9898('0xe')][_0x333e67[_0x9898('0x25')]][_0x9898('0x2f')]=_0x333e67[_0x9898('0x2f')];this[_0x9898('0xe')][_0x333e67[_0x9898('0x25')]]['localstationid']=_0x333e67[_0x9898('0x30')];this[_0x9898('0xe')][_0x333e67[_0x9898('0x25')]][_0x9898('0x31')]=_0x333e67[_0x9898('0x31')];logger['info'](_0x333e67[_0x9898('0x25')],_0x9898('0x32'));}};Fax[_0x9898('0x22')][_0x9898('0x33')]=function(_0x2f0c02){var _0x451eeb=this;if(this[_0x9898('0xe')][_0x2f0c02['uniqueid']]){var _0x1d9e8d=this[_0x9898('0xe')][_0x2f0c02[_0x9898('0x25')]]['id'];this[_0x9898('0xe')][_0x2f0c02['uniqueid']][_0x9898('0x34')]=_0x2f0c02[_0x9898('0x34')];this[_0x9898('0xe')][_0x2f0c02[_0x9898('0x25')]][_0x9898('0x35')]=_0x2f0c02['pagestransferred'];this[_0x9898('0xe')][_0x2f0c02[_0x9898('0x25')]][_0x9898('0x30')]=_0x2f0c02[_0x9898('0x30')];this[_0x9898('0xe')][_0x2f0c02[_0x9898('0x25')]]['resolution']=_0x2f0c02[_0x9898('0x36')];this[_0x9898('0xe')][_0x2f0c02['uniqueid']][_0x9898('0x37')]=_0x2f0c02[_0x9898('0x37')];this['channels'][_0x2f0c02['uniqueid']]['filename']=_0x2f0c02[_0x9898('0x31')];this['channels'][_0x2f0c02[_0x9898('0x25')]]['calleridnum']=_0x2f0c02[_0x9898('0x38')];if(this['channels'][_0x2f0c02[_0x9898('0x25')]][_0x9898('0x35')]>0x0){tiff2pdf(_0x2f0c02[_0x9898('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x15ed7b){logger['info'](_0x2f0c02[_0x9898('0x25')],_0x9898('0x39'),_0x15ed7b[_0x9898('0x3a')]);attachment[_0x9898('0x3b')]({'name':path[_0x9898('0x3c')](_0x2f0c02[_0x9898('0x31')])[_0x9898('0x27')],'basename':path[_0x9898('0x3c')](_0x2f0c02['filename'])[_0x9898('0x27')]+_0x9898('0x3d'),'type':_0x9898('0x3e')})['then'](function(_0x7485b){faxAccount[_0x9898('0x3f')](_0x1d9e8d,{'from':_0x2f0c02[_0x9898('0x38')],'mapKey':'fax','body':path['parse'](_0x2f0c02[_0x9898('0x31')])['name']+_0x9898('0x3d'),'AttachmentId':_0x7485b['id']})[_0x9898('0x40')](function(_0x29a837){logger['error'](_0x2f0c02['uniqueid'],_0x9898('0x41'),JSON['stringify'](_0x29a837));});})[_0x9898('0x40')](function(_0x22f876){logger[_0x9898('0x42')](_0x2f0c02[_0x9898('0x25')],'\x20receiveFax\x20',JSON[_0x9898('0x43')](_0x22f876));});});}logger[_0x9898('0x28')](_0x2f0c02[_0x9898('0x25')],_0x9898('0x44'));}};Fax[_0x9898('0x22')][_0x9898('0x21')]=function(_0x4c339f){if(this[_0x9898('0x11')][_0x4c339f[_0x9898('0x25')]]){_['merge'](this['channels'][_0x4c339f[_0x9898('0x25')]],_[_0x9898('0x45')](_0x4c339f,[_0x9898('0x46'),'reason']));}};function updateStatus(_0x4d03fe){if(_0x4d03fe['AttachmentId']){faxMessage['update'](_0x4d03fe[_0x9898('0x47')],{'failMessage':_0x9898('0x48')})[_0x9898('0x49')](function(_0x4b1c20){ut[_0x9898('0x4a')](_0x9898('0x4b'),_0x4b1c20);})[_0x9898('0x40')](function(_0x4068d9){ut['logger'](_0x9898('0x4c'),_0x4068d9);});}else{ut[_0x9898('0x4a')](_0x9898('0x4d'));}}Fax[_0x9898('0x22')][_0x9898('0x4e')]=function(_0x3cd4e1,_0x516563,_0x5299fe){var _0x250b75=this;var _0x51e7ba={};if(_0x516563){_0x51e7ba={'read':_0x516563};}else{_0x51e7ba={'failMessage':_0x5299fe};}if(this[_0x9898('0x11')][_0x3cd4e1][_0x9898('0x47')]){faxMessage['update'](this[_0x9898('0x11')][_0x3cd4e1][_0x9898('0x47')],_0x51e7ba)['then'](function(_0x27cd55){ut['logger'](_0x9898('0x4f'),_0x27cd55);})[_0x9898('0x40')](function(_0x2c7d62){ut[_0x9898('0x4a')]('[Fax][Message][NoUpdate1]',_0x2c7d62);})[_0x9898('0x50')](function(){delete _0x250b75[_0x9898('0xe')][_0x3cd4e1];delete _0x250b75[_0x9898('0x11')][_0x3cd4e1];});}else{ut['logger'](_0x9898('0x51'));delete this[_0x9898('0xe')][_0x3cd4e1];delete this[_0x9898('0x11')][_0x3cd4e1];}};Fax[_0x9898('0x22')][_0x9898('0x1f')]=function(_0x5bd2dc){var _0x4326a4=this;if(this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]]){if(this[_0x9898('0x11')][_0x5bd2dc[_0x9898('0x25')]]){this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]]['id']=this[_0x9898('0x11')][_0x5bd2dc[_0x9898('0x25')]]['id'];this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]][_0x9898('0x27')]=this[_0x9898('0x11')][_0x5bd2dc[_0x9898('0x25')]]['name'];}logger['info'](_0x5bd2dc[_0x9898('0x25')],this[_0x9898('0x11')][_0x5bd2dc[_0x9898('0x25')]]?_0x9898('0x52'):_0x9898('0x53'),JSON['stringify'](this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]]));if(this[_0x9898('0x11')][_0x5bd2dc[_0x9898('0x25')]]){if(this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]][_0x9898('0x54')]>0x0&&this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]][_0x9898('0x1b')]===_0x9898('0x55')){this[_0x9898('0x4e')](_0x5bd2dc[_0x9898('0x25')],!![]);}else{this[_0x9898('0x4e')](_0x5bd2dc[_0x9898('0x25')],![],this[_0x9898('0xe')][_0x5bd2dc[_0x9898('0x25')]][_0x9898('0x56')]?_0x9898('0x57')+this[_0x9898('0xe')][_0x5bd2dc['uniqueid']][_0x9898('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0x9898('0x22')][_0x9898('0x58')]=function(_0x42a7db){var _0x1595d5=this;return new BPromise(function(_0x4426af,_0x4c3838){_0x1595d5[_0x9898('0x59')](_0x42a7db,_0x1595d5[_0x9898('0xf')][_0x42a7db[_0x9898('0x5a')]])[_0x9898('0x49')](function(_0x1d7089){ut[_0x9898('0x4a')](_0x9898('0x5b'),_0x1d7089);_0x4426af(ut[_0x9898('0x3a')](_0x9898('0x5c')));})[_0x9898('0x40')](function(_0x40aba4){ut[_0x9898('0x4a')](_0x9898('0x5d'),_0x40aba4);updateStatus(_0x42a7db);_0x4c3838(ut[_0x9898('0x3a')](_0x9898('0x5e')));});});};Fax['prototype'][_0x9898('0x5f')]=function(_0x40720b){var _0x4cd48e=this;return new BPromise(function(_0xea97b5,_0x298451){var _0x138128=_0x4cd48e['checkTrunk'](_0x4cd48e[_0x9898('0xf')][_0x40720b[_0x9898('0x5a')]]['Trunk'],_0x40720b);if(_0x138128[_0x9898('0x60')]){_0xea97b5(ut[_0x9898('0x3a')](_0x9898('0x61')));}else{_0x298451(ut[_0x9898('0x3a')](_0x138128[_0x9898('0x3a')]));}});};function originate(_0x401ec4,_0x3bb44f,_0x3641ff){return new BPromise(function(_0x5bc0d5,_0x584842){if(_0x3641ff){var _0x4def4e=util[_0x9898('0x62')](_0x9898('0x63'),path[_0x9898('0x3c')](_0x401ec4['path'])['name'],_0x401ec4['path']);gs[_0x9898('0x64')](_0x4def4e)[_0x9898('0x49')](function(){_0x401ec4['path']=util[_0x9898('0x62')](_0x9898('0x65'),path['parse'](_0x401ec4['path'])[_0x9898('0x66')],path[_0x9898('0x3c')](_0x401ec4[_0x9898('0x5')])[_0x9898('0x27')]);_0x3bb44f[_0x9898('0x67')]=_0x401ec4[_0x9898('0x5')];ut[_0x9898('0x4a')](_0x9898('0x68'),'');ami[_0x9898('0x69')](ut[_0x9898('0x6a')](_0x401ec4,_0x3bb44f))[_0x9898('0x49')](function(_0x46a58d){_0x5bc0d5(_0x46a58d);})[_0x9898('0x40')](function(_0x2742e1){_0x584842(_0x2742e1);});})['catch'](function(_0x43a27a){_0x584842(_0x43a27a);});}else{ami[_0x9898('0x69')](ut[_0x9898('0x6a')](_0x401ec4,_0x3bb44f))[_0x9898('0x49')](function(_0xbf263b){_0x5bc0d5(_0xbf263b);})[_0x9898('0x40')](function(_0x2966aa){_0x584842(_0x2966aa);});}});}Fax[_0x9898('0x22')][_0x9898('0x59')]=function(_0x42e859,_0x5258f8){var _0x45fac2=this;return new BPromise(function(_0x3adaf5,_0x5b8604){var _0x3d6911=uuid['v4']();var _0xc4dd8d=ut[_0x9898('0x6b')](_0x42e859,_0x5258f8);_0x45fac2[_0x9898('0x11')][_0x3d6911]=new Action(_0x3d6911,_0x5258f8,_0x42e859);var _0x5609bf=_0x45fac2[_0x9898('0x11')][_0x3d6911];if(path[_0x9898('0x3c')](_0x42e859[_0x9898('0x5')])[_0x9898('0x6c')]==='.pdf'){originate(_0x5609bf,_0xc4dd8d,!![])['then'](function(_0x16316a){_0x3adaf5(_0x16316a);})[_0x9898('0x40')](function(_0x2af564){_0x5b8604(_0x2af564);});}else{originate(_0x5609bf,_0xc4dd8d,![])[_0x9898('0x49')](function(_0x5bca0f){_0x3adaf5(_0x5bca0f);})[_0x9898('0x40')](function(_0x265fc9){_0x5b8604(_0x265fc9);});}});};Fax['prototype']['isTrunkReachable']=function(_0x1748cb){return!_['isNil'](_0x1748cb)&&!_[_0x9898('0x6d')](_0x1748cb['name'])&&!_[_0x9898('0x6d')](_0x1748cb['active'])&&_0x1748cb[_0x9898('0x6e')]&&!_[_0x9898('0x6d')](this[_0x9898('0x10')][util[_0x9898('0x62')](_0x9898('0x6f'),_0x1748cb[_0x9898('0x27')])])&&!_[_0x9898('0x6d')](this[_0x9898('0x10')][util[_0x9898('0x62')](_0x9898('0x6f'),_0x1748cb[_0x9898('0x27')])][_0x9898('0x2f')])&&(this[_0x9898('0x10')][util['format'](_0x9898('0x6f'),_0x1748cb[_0x9898('0x27')])][_0x9898('0x2f')]===_0x9898('0x70')||this[_0x9898('0x10')][util[_0x9898('0x62')]('SIP/%s',_0x1748cb[_0x9898('0x27')])][_0x9898('0x2f')]===_0x9898('0x71'));};Fax[_0x9898('0x22')]['checkTrunk']=function(_0x54ead1,_0x35b713){if(!this[_0x9898('0x72')](_0x54ead1)){ut[_0x9898('0x4a')](_0x9898('0x73'),_[_0x9898('0x6d')](_0x54ead1)?'':_0x54ead1['name']+_0x9898('0x74'));return{'isValid':![],'message':_0x9898('0x75')};}if(_[_0x9898('0x6d')](_0x35b713[_0x9898('0x9')])){ut[_0x9898('0x4a')](_0x9898('0x76'),JSON[_0x9898('0x43')](_0x35b713));return{'isValid':![],'message':_0x9898('0x77')};}if(_['isNil'](_0x35b713[_0x9898('0x5')])){ut['logger'](_0x9898('0x78'),JSON['stringify'](_0x35b713));return{'isValid':![],'message':_0x9898('0x79')};}return{'isValid':!![],'message':_0x9898('0x7a')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index dcb6672..f8d2ac8 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 _0xbf68=['[Notify]\x20','bluebird','../../../config/logger','../rpc/faxAccount','error','then','notify','catch'];(function(_0x91cb4b,_0x4d5abc){var _0x1f5969=function(_0x4981c8){while(--_0x4981c8){_0x91cb4b['push'](_0x91cb4b['shift']());}};_0x1f5969(++_0x4d5abc);}(_0xbf68,0xd9));var _0x8bf6=function(_0x1ac002,_0x1f8b3d){_0x1ac002=_0x1ac002-0x0;var _0x5118d5=_0xbf68[_0x1ac002];return _0x5118d5;};'use strict';var util=require('util');var BPromise=require(_0x8bf6('0x0'));var logger=require(_0x8bf6('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0x8bf6('0x2'));function loggerCatch(_0x1454ba){return function(_0x4f4b2d){logger[_0x8bf6('0x3')](_0x1454ba,util['inspect'](_0x4f4b2d,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x557136,_0x26cc99){return BPromise['resolve']()[_0x8bf6('0x4')](faxAccount[_0x8bf6('0x5')](_0x557136,_0x26cc99))[_0x8bf6('0x6')](loggerCatch(_0x8bf6('0x7')));}; \ No newline at end of file +var _0x86a8=['../../../config/logger','preview','../rpc/faxAccount','inspect','notify','then','[Notify]\x20','util'];(function(_0x2a0a15,_0x8da545){var _0x1fbacb=function(_0x278df0){while(--_0x278df0){_0x2a0a15['push'](_0x2a0a15['shift']());}};_0x1fbacb(++_0x8da545);}(_0x86a8,0x1ef));var _0x886a=function(_0x57218c,_0x319e4f){_0x57218c=_0x57218c-0x0;var _0x22df37=_0x86a8[_0x57218c];return _0x22df37;};'use strict';var util=require(_0x886a('0x0'));var BPromise=require('bluebird');var logger=require(_0x886a('0x1'))(_0x886a('0x2'));var _=require('lodash');var faxAccount=require(_0x886a('0x3'));function loggerCatch(_0xda5168){return function(_0x6ca9aa){logger['error'](_0xda5168,util[_0x886a('0x4')](_0x6ca9aa,{'showHidden':![],'depth':null}));};}exports[_0x886a('0x5')]=function(_0x1c25ff,_0x5b730b){return BPromise['resolve']()[_0x886a('0x6')](faxAccount['notify'](_0x1c25ff,_0x5b730b))['catch'](loggerCatch(_0x886a('0x7')));}; \ 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 14788ec..9897907 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 _0xae2a=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','info'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xae2a,0x1ed));var _0xaae2=function(_0x16d5c7,_0x4488a5){_0x16d5c7=_0x16d5c7-0x0;var _0x3522b9=_0xae2a[_0x16d5c7];return _0x3522b9;};'use strict';var util=require(_0xaae2('0x0'));var logger=require(_0xaae2('0x1'))(_0xaae2('0x2'));var BPromise=require(_0xaae2('0x3'));var exec=require(_0xaae2('0x4'))[_0xaae2('0x5')];exports['execute']=function(_0x20c81d){return new BPromise(function(_0x119a87,_0x3405ba){exec(_0x20c81d,function(_0xcf1aa7,_0x141bd3,_0x1c0cca){logger[_0xaae2('0x6')](_0xaae2('0x7'),_0x141bd3);if(_0xcf1aa7){logger[_0xaae2('0x6')](_0xaae2('0x7'),_0xaae2('0x8'),util[_0xaae2('0x9')](_0xcf1aa7,{'showHidden':![],'depth':null}),_0x141bd3,_0x1c0cca);_0x3405ba(_0xcf1aa7);}_0x119a87(_0x141bd3);});});}; \ No newline at end of file +var _0xec6c=['exec','info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xec6c,0x9b));var _0xcec6=function(_0xdf1858,_0x5692d0){_0xdf1858=_0xdf1858-0x0;var _0x3e64f0=_0xec6c[_0xdf1858];return _0x3e64f0;};'use strict';var util=require(_0xcec6('0x0'));var logger=require(_0xcec6('0x1'))(_0xcec6('0x2'));var BPromise=require(_0xcec6('0x3'));var exec=require(_0xcec6('0x4'))[_0xcec6('0x5')];exports['execute']=function(_0xe9cf04){return new BPromise(function(_0x1e71e2,_0x173380){exec(_0xe9cf04,function(_0x2a0630,_0x36d2ba,_0x6ac0a6){logger[_0xcec6('0x6')](_0xcec6('0x7'),_0x36d2ba);if(_0x2a0630){logger[_0xcec6('0x6')](_0xcec6('0x7'),'\x20Error\x20:',util['inspect'](_0x2a0630,{'showHidden':![],'depth':null}),_0x36d2ba,_0x6ac0a6);_0x173380(_0x2a0630);}_0x1e71e2(_0x36d2ba);});});}; \ 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 806bfd5..4fdbab7 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 _0x465b=['localstationid','util','lodash','../../../../config/logger','fax','logger','info','addVariables','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','variablesAction','originate','channel','xcally-motion-fax','headerinfo'];(function(_0x11f850,_0x3c03c0){var _0x435359=function(_0x561b01){while(--_0x561b01){_0x11f850['push'](_0x11f850['shift']());}};_0x435359(++_0x3c03c0);}(_0x465b,0x1cd));var _0xb465=function(_0x562e1c,_0x31cbe3){_0x562e1c=_0x562e1c-0x0;var _0x199dfb=_0x465b[_0x562e1c];return _0x199dfb;};'use strict';var util=require(_0xb465('0x0'));var _=require(_0xb465('0x1'));var moment=require('moment');var logger=require(_0xb465('0x2'))(_0xb465('0x3'));exports['message']=function(_0x45a94c){return{'message':_0x45a94c};};exports[_0xb465('0x4')]=function(_0x25d6f9,_0x3838c2){logger[_0xb465('0x5')](_0x25d6f9,util['inspect'](_0x3838c2,{'showHidden':![],'depth':null}));};exports[_0xb465('0x6')]=function(_0x597632,_0xb8f38b){var _0x2dff43={'XMF-ECM':_0xb8f38b['ecm'],'XMF-HEADERINFO':_0xb8f38b['headerinfo'],'XMF-MINRATE':_0xb8f38b[_0xb465('0x7')],'XMF-MAXRATE':_0xb8f38b[_0xb465('0x8')],'XMF-MODEM':util[_0xb465('0x9')]('\x22%s\x22',_0xb8f38b[_0xb465('0xa')]),'XMF-GATEWAY':_0xb8f38b[_0xb465('0xb')],'XMF-FAXDETECT':_0xb8f38b[_0xb465('0xc')],'XMF-T38TIMEOUT':_0xb8f38b[_0xb465('0xd')],'XMF-LOCALSTATIONID':_0xb8f38b['localstationid'],'XMF-PATH':_0x597632['path']};return _0x2dff43;};exports[_0xb465('0xe')]=function(_0x48706f,_0x4359d5){return{'actionid':_0x48706f['uniqueid'],'action':_0xb465('0xf'),'channel':_0x48706f[_0xb465('0x10')],'Exten':_0xb465('0x11'),'Context':'from-sip','Priority':'1','callerid':util[_0xb465('0x9')]('\x22%s\x22\x20<%s>',_0x48706f[_0xb465('0x12')]?_0x48706f[_0xb465('0x12')]:'',_0x48706f[_0xb465('0x13')]),'variable':_0x4359d5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x48706f['uniqueid']};}; \ No newline at end of file +var _0xaed3=['inspect','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','info'];(function(_0x4ffff7,_0x9093f5){var _0x1d7fc9=function(_0x46c4fc){while(--_0x46c4fc){_0x4ffff7['push'](_0x4ffff7['shift']());}};_0x1d7fc9(++_0x9093f5);}(_0xaed3,0x1f4));var _0x3aed=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xaed3[_0x408e38];return _0x426b0e;};'use strict';var util=require(_0x3aed('0x0'));var _=require(_0x3aed('0x1'));var moment=require(_0x3aed('0x2'));var logger=require(_0x3aed('0x3'))(_0x3aed('0x4'));exports['message']=function(_0x121e24){return{'message':_0x121e24};};exports['logger']=function(_0x547319,_0x4c00a7){logger[_0x3aed('0x5')](_0x547319,util[_0x3aed('0x6')](_0x4c00a7,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x4ca418,_0x3a27d6){var _0x58b0a9={'XMF-ECM':_0x3a27d6[_0x3aed('0x7')],'XMF-HEADERINFO':_0x3a27d6[_0x3aed('0x8')],'XMF-MINRATE':_0x3a27d6[_0x3aed('0x9')],'XMF-MAXRATE':_0x3a27d6[_0x3aed('0xa')],'XMF-MODEM':util['format'](_0x3aed('0xb'),_0x3a27d6[_0x3aed('0xc')]),'XMF-GATEWAY':_0x3a27d6[_0x3aed('0xd')],'XMF-FAXDETECT':_0x3a27d6[_0x3aed('0xe')],'XMF-T38TIMEOUT':_0x3a27d6['t38timeout'],'XMF-LOCALSTATIONID':_0x3a27d6[_0x3aed('0xf')],'XMF-PATH':_0x4ca418[_0x3aed('0x10')]};return _0x58b0a9;};exports['variablesAction']=function(_0x29ea11,_0x14e196){return{'actionid':_0x29ea11[_0x3aed('0x11')],'action':_0x3aed('0x12'),'channel':_0x29ea11['channel'],'Exten':_0x3aed('0x13'),'Context':_0x3aed('0x14'),'Priority':'1','callerid':util['format'](_0x3aed('0x15'),_0x29ea11['headerinfo']?_0x29ea11['headerinfo']:'',_0x29ea11[_0x3aed('0xf')]),'variable':_0x14e196,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29ea11[_0x3aed('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8f3266f..bc7249e 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 _0x9e66=['getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','inspect','listen','sync','[index.js][main]','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9e66,0x6f));var _0x69e6=function(_0x779390,_0x381833){_0x779390=_0x779390-0x0;var _0x51eec5=_0x9e66[_0x779390];return _0x51eec5;};'use strict';var BPromise=require(_0x69e6('0x0'));var util=require('util');var moment=require(_0x69e6('0x1'));var server=require('./server');var Realtime=require(_0x69e6('0x2'));var Report=require(_0x69e6('0x3'));var Acw=require(_0x69e6('0x4'));var Trigger=require(_0x69e6('0x5'));var Dialer=require(_0x69e6('0x6'));var Preview=require(_0x69e6('0x7'));var Fax=require(_0x69e6('0x8'));var user=require(_0x69e6('0x9'));var voiceQueue=require(_0x69e6('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x69e6('0xb'));var trunk=require(_0x69e6('0xc'));var trigger=require(_0x69e6('0xd'));var template=require('./rpc/template');var cmHopperHistory=require(_0x69e6('0xe'));var campaign=require(_0x69e6('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x69e6('0x10'));var zendesk=require(_0x69e6('0x11'));var salesforce=require(_0x69e6('0x12'));var sugarcrm=require(_0x69e6('0x13'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x69e6('0x14'));var zoho=require(_0x69e6('0x15'));var vtiger=require(_0x69e6('0x16'));var freshsales=require(_0x69e6('0x17'));var servicenow=require(_0x69e6('0x18'));var dynamics365=require(_0x69e6('0x19'));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(_0x69e6('0x1a'))(_0x69e6('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x69e6('0x1c')](_0x69e6('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x69e6('0x1c')](_0x69e6('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x69e6('0x1e')]()[_0x69e6('0x1f')](user[_0x69e6('0x20')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x21')]())[_0x69e6('0x1f')](user[_0x69e6('0x22')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x23')]())['then'](trunk[_0x69e6('0x24')]())['then'](realtime['initTrunks']())[_0x69e6('0x1f')](voiceQueue[_0x69e6('0x25')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x26')]())['then'](trigger[_0x69e6('0x27')]())['then'](realtime[_0x69e6('0x28')]())[_0x69e6('0x1f')](template[_0x69e6('0x29')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x2a')]())[_0x69e6('0x1f')](zendesk[_0x69e6('0x2b')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x2c')]())[_0x69e6('0x1f')](salesforce['getSalesforceAccounts']())[_0x69e6('0x1f')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x69e6('0x2d')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x2e')]())[_0x69e6('0x1f')](freshdesk[_0x69e6('0x2f')]())[_0x69e6('0x1f')](realtime['initFreshdeskAccounts']())[_0x69e6('0x1f')](desk[_0x69e6('0x30')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x31')]())[_0x69e6('0x1f')](zoho['getZohoAccounts']())['then'](realtime[_0x69e6('0x32')]())[_0x69e6('0x1f')](vtiger['getVtigerAccounts']())[_0x69e6('0x1f')](realtime['initVtigerAccounts']())[_0x69e6('0x1f')](freshsales[_0x69e6('0x33')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x34')]())[_0x69e6('0x1f')](servicenow[_0x69e6('0x35')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x36')]())[_0x69e6('0x1f')](dynamics365[_0x69e6('0x37')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x38')]())['then'](campaign['getCampaigns']())['then'](realtime[_0x69e6('0x39')]())[_0x69e6('0x1f')](voiceExtension[_0x69e6('0x3a')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x3b')]())['then'](faxAccount[_0x69e6('0x3c')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x3d')]())[_0x69e6('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x69e6('0x1e')]()[_0x69e6('0x1f')](voiceQueueReport[_0x69e6('0x3e')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x3f')]())[_0x69e6('0x1f')](cmHopperHistory[_0x69e6('0x40')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x69e6('0x1f')](cmHopperHistory[_0x69e6('0x41')]())[_0x69e6('0x1f')](realtime[_0x69e6('0x42')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x69e6('0x1f')](realtime[_0x69e6('0x43')]())[_0x69e6('0x44')](function(_0x47eee1){logger[_0x69e6('0x45')]('[index.js][initParams]',util[_0x69e6('0x46')](_0x47eee1,{'showHidden':![],'depth':null}));});}function main(){return server[_0x69e6('0x47')](realtime,preview,fax)['then'](function(_0x44e7d8){return initRealtime();})[_0x69e6('0x1f')](function(){return initParams();})[_0x69e6('0x1f')](function(){report[_0x69e6('0x48')]();setInterval(initRealtime,0x1388);})[_0x69e6('0x44')](function(_0x3505e6){logger['error'](_0x69e6('0x49'),util[_0x69e6('0x46')](_0x3505e6,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x5cba=['util','moment','./realtime','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./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','../../config/logger','get','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','sync','[index.js][main]','inspect','bluebird'];(function(_0x57efcc,_0x22a954){var _0x38ee5a=function(_0x353980){while(--_0x353980){_0x57efcc['push'](_0x57efcc['shift']());}};_0x38ee5a(++_0x22a954);}(_0x5cba,0x1cd));var _0xa5cb=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x5cba[_0x4b055c];return _0x4b62bb;};'use strict';var BPromise=require(_0xa5cb('0x0'));var util=require(_0xa5cb('0x1'));var moment=require(_0xa5cb('0x2'));var server=require('./server');var Realtime=require(_0xa5cb('0x3'));var Report=require(_0xa5cb('0x4'));var Acw=require(_0xa5cb('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0xa5cb('0x6'));var Fax=require(_0xa5cb('0x7'));var user=require(_0xa5cb('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xa5cb('0x9'));var voiceCallReport=require(_0xa5cb('0xa'));var trunk=require(_0xa5cb('0xb'));var trigger=require(_0xa5cb('0xc'));var template=require(_0xa5cb('0xd'));var cmHopperHistory=require(_0xa5cb('0xe'));var campaign=require(_0xa5cb('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xa5cb('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xa5cb('0x11'));var sugarcrm=require(_0xa5cb('0x12'));var freshdesk=require(_0xa5cb('0x13'));var desk=require(_0xa5cb('0x14'));var zoho=require(_0xa5cb('0x15'));var vtiger=require(_0xa5cb('0x16'));var freshsales=require(_0xa5cb('0x17'));var servicenow=require(_0xa5cb('0x18'));var dynamics365=require(_0xa5cb('0x19'));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(_0xa5cb('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa5cb('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa5cb('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa5cb('0x1c')]()[_0xa5cb('0x1d')](user[_0xa5cb('0x1e')]())[_0xa5cb('0x1d')](realtime['initAgents']())['then'](user[_0xa5cb('0x1f')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x20')]())['then'](trunk['getTrunks']())['then'](realtime[_0xa5cb('0x21')]())[_0xa5cb('0x1d')](voiceQueue[_0xa5cb('0x22')]())['then'](realtime[_0xa5cb('0x23')]())['then'](trigger['getTriggers']())[_0xa5cb('0x1d')](realtime['initTriggers']())[_0xa5cb('0x1d')](template[_0xa5cb('0x24')]())['then'](realtime[_0xa5cb('0x25')]())['then'](zendesk['getZendeskAccounts']())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x26')]())[_0xa5cb('0x1d')](salesforce[_0xa5cb('0x27')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x28')]())[_0xa5cb('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x29')]())[_0xa5cb('0x1d')](freshdesk['getFreshdeskAccounts']())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x2a')]())[_0xa5cb('0x1d')](desk['getDeskAccounts']())[_0xa5cb('0x1d')](realtime['initDeskAccounts']())[_0xa5cb('0x1d')](zoho[_0xa5cb('0x2b')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x2c')]())[_0xa5cb('0x1d')](vtiger['getVtigerAccounts']())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x2d')]())[_0xa5cb('0x1d')](freshsales['getFreshsalesAccounts']())[_0xa5cb('0x1d')](realtime['initFreshsalesAccounts']())[_0xa5cb('0x1d')](servicenow[_0xa5cb('0x2e')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x2f')]())[_0xa5cb('0x1d')](dynamics365[_0xa5cb('0x30')]())['then'](realtime[_0xa5cb('0x31')]())['then'](campaign[_0xa5cb('0x32')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x33')]())[_0xa5cb('0x1d')](voiceExtension[_0xa5cb('0x34')]())['then'](realtime[_0xa5cb('0x35')]())[_0xa5cb('0x1d')](faxAccount[_0xa5cb('0x36')]())[_0xa5cb('0x1d')](realtime['initFaxAccounts']())[_0xa5cb('0x1d')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xa5cb('0x1d')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xa5cb('0x37')]())[_0xa5cb('0x1d')](cmHopperHistory[_0xa5cb('0x38')]())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x39')]())[_0xa5cb('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0xa5cb('0x1d')](realtime[_0xa5cb('0x3a')]())['then'](voiceCallReport[_0xa5cb('0x3b')]())['then'](realtime['initVoiceCallReports']())[_0xa5cb('0x3c')](function(_0xcc7189){logger[_0xa5cb('0x3d')](_0xa5cb('0x3e'),util['inspect'](_0xcc7189,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xa5cb('0x1d')](function(_0x16b6ad){return initRealtime();})[_0xa5cb('0x1d')](function(){return initParams();})[_0xa5cb('0x1d')](function(){report[_0xa5cb('0x3f')]();setInterval(initRealtime,0x1388);})[_0xa5cb('0x3c')](function(_0x523003){logger[_0xa5cb('0x3d')](_0xa5cb('0x40'),util[_0xa5cb('0x41')](_0x523003,{'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 6454f25..59ad6da 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(_0x147eff,_0x2531e6){var _0x4e5df6=function(_0x24de98){while(--_0x24de98){_0x147eff['push'](_0x147eff['shift']());}};_0x4e5df6(++_0x2531e6);}(_0x70e0,0x17b));var _0x070e=function(_0x5c3ea4,_0x3939a9){_0x5c3ea4=_0x5c3ea4-0x0;var _0x217b91=_0x70e0[_0x5c3ea4];return _0x217b91;};'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 _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x377fb1,_0x5ee538){var _0x3248e9=function(_0x4e6ed5){while(--_0x4e6ed5){_0x377fb1['push'](_0x377fb1['shift']());}};_0x3248e9(++_0x5ee538);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 8c06171..d12be89 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 _0xc11d=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x1e09d3,_0x36247c){var _0x11efb9=function(_0x53e456){while(--_0x53e456){_0x1e09d3['push'](_0x1e09d3['shift']());}};_0x11efb9(++_0x36247c);}(_0xc11d,0x1ae));var _0xdc11=function(_0x3554b6,_0x5c957c){_0x3554b6=_0x3554b6-0x0;var _0x3a2b37=_0xc11d[_0x3554b6];return _0x3a2b37;};'use strict';function Campaign(_0x4817a3){this['id']=_0x4817a3['id']||0x0;this[_0xdc11('0x0')]=_0x4817a3['name']||'';this[_0xdc11('0x1')]=_0x4817a3['type']||_0xdc11('0x2');this['originated']=0x0;this[_0xdc11('0x3')]=0x0;this[_0xdc11('0x4')]=0x0;this[_0xdc11('0x5')]=0x0;this['message']='';this[_0xdc11('0x6')]=!![];this['active']=_0x4817a3[_0xdc11('0x7')];this['limitCalls']=_0x4817a3[_0xdc11('0x8')];this[_0xdc11('0x9')]=_0x4817a3[_0xdc11('0x9')]||null;this[_0xdc11('0xa')]=_0x4817a3[_0xdc11('0xa')]?_0x4817a3[_0xdc11('0xa')]:null;this[_0xdc11('0xb')]=_0x4817a3[_0xdc11('0xb')];this['dialOriginateCallerIdNumber']=_0x4817a3[_0xdc11('0xc')];this['dialOriginateTimeout']=_0x4817a3['dialOriginateTimeout']||0x1e;this[_0xdc11('0xd')]=_0x4817a3[_0xdc11('0xd')];this[_0xdc11('0xe')]=_0x4817a3[_0xdc11('0xe')];this[_0xdc11('0xf')]=_0x4817a3[_0xdc11('0xf')];this[_0xdc11('0x10')]=_0x4817a3['dialBusyRetryFrequency'];this[_0xdc11('0x11')]=_0x4817a3[_0xdc11('0x11')];this[_0xdc11('0x12')]=_0x4817a3[_0xdc11('0x12')];this[_0xdc11('0x13')]=_0x4817a3[_0xdc11('0x13')];this[_0xdc11('0x14')]=_0x4817a3[_0xdc11('0x14')]||0x3;this[_0xdc11('0x15')]=_0x4817a3[_0xdc11('0x15')]||0x96;this[_0xdc11('0x16')]=_0x4817a3[_0xdc11('0x16')]||0x3;this[_0xdc11('0x17')]=_0x4817a3[_0xdc11('0x17')]||0x96;this[_0xdc11('0x18')]=_0x4817a3[_0xdc11('0x18')]||0x3;this[_0xdc11('0x19')]=_0x4817a3[_0xdc11('0x19')]||0x96;this[_0xdc11('0x1a')]=_0x4817a3[_0xdc11('0x1a')]||0x3;this[_0xdc11('0x1b')]=_0x4817a3[_0xdc11('0x1b')]||0x96;this['dialAgentRejectMaxRetry']=_0x4817a3[_0xdc11('0x1c')]||0x3;this[_0xdc11('0x1d')]=_0x4817a3[_0xdc11('0x1d')]||0x96;this[_0xdc11('0x1e')]=_0x4817a3[_0xdc11('0x1e')]||'DESC';this[_0xdc11('0x1f')]=_0x4817a3[_0xdc11('0x1f')]||undefined;this[_0xdc11('0x20')]=_0x4817a3[_0xdc11('0x20')]||undefined;this[_0xdc11('0x21')]=_0x4817a3['dialCutDigit']||undefined;this['TrunkBackup']=_0x4817a3[_0xdc11('0x22')]?_0x4817a3[_0xdc11('0x22')]:undefined;this[_0xdc11('0x23')]=_0x4817a3['Trunk']?_0x4817a3[_0xdc11('0x23')]:undefined;this[_0xdc11('0x24')]=_0x4817a3['Interval']?_0x4817a3['Interval']:undefined;this[_0xdc11('0x25')]=_0x4817a3[_0xdc11('0x25')]?_0x4817a3['SquareProject']:undefined;this[_0xdc11('0x26')]=_0x4817a3[_0xdc11('0x25')]?_0x4817a3['SquareProject'][_0xdc11('0x0')]:undefined;this[_0xdc11('0x27')]=_0x4817a3[_0xdc11('0x27')]||![];this[_0xdc11('0x28')]=_0x4817a3['dialAMDInitialSilence'];this[_0xdc11('0x29')]=_0x4817a3[_0xdc11('0x29')];this['dialAMDAfterGreetingSilence']=_0x4817a3[_0xdc11('0x2a')];this[_0xdc11('0x2b')]=_0x4817a3[_0xdc11('0x2b')];this[_0xdc11('0x2c')]=_0x4817a3[_0xdc11('0x2c')];this['dialAMDBetweenWordsSilence']=_0x4817a3[_0xdc11('0x2d')];this[_0xdc11('0x2e')]=_0x4817a3['dialAMDMaximumNumberOfWords'];this[_0xdc11('0x2f')]=_0x4817a3[_0xdc11('0x2f')];this[_0xdc11('0x30')]=_0x4817a3[_0xdc11('0x30')];}module[_0xdc11('0x31')]=Campaign; \ No newline at end of file +var _0xf68b=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x1b9903,_0x8c7342){var _0x1a2fc6=function(_0x254d6a){while(--_0x254d6a){_0x1b9903['push'](_0x1b9903['shift']());}};_0x1a2fc6(++_0x8c7342);}(_0xf68b,0x13d));var _0xbf68=function(_0x409664,_0x2a9a34){_0x409664=_0x409664-0x0;var _0x1dff95=_0xf68b[_0x409664];return _0x1dff95;};'use strict';function Campaign(_0x1b469d){this['id']=_0x1b469d['id']||0x0;this[_0xbf68('0x0')]=_0x1b469d['name']||'';this[_0xbf68('0x1')]=_0x1b469d['type']||_0xbf68('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xbf68('0x3')]=0x0;this[_0xbf68('0x4')]=0x0;this[_0xbf68('0x5')]='';this[_0xbf68('0x6')]=!![];this[_0xbf68('0x7')]=_0x1b469d[_0xbf68('0x7')];this['limitCalls']=_0x1b469d[_0xbf68('0x8')];this[_0xbf68('0x9')]=_0x1b469d[_0xbf68('0x9')]||null;this[_0xbf68('0xa')]=_0x1b469d[_0xbf68('0xa')]?_0x1b469d[_0xbf68('0xa')]:null;this[_0xbf68('0xb')]=_0x1b469d[_0xbf68('0xb')];this[_0xbf68('0xc')]=_0x1b469d['dialOriginateCallerIdNumber'];this[_0xbf68('0xd')]=_0x1b469d['dialOriginateTimeout']||0x1e;this[_0xbf68('0xe')]=_0x1b469d[_0xbf68('0xe')];this[_0xbf68('0xf')]=_0x1b469d[_0xbf68('0xf')];this[_0xbf68('0x10')]=_0x1b469d[_0xbf68('0x10')];this[_0xbf68('0x11')]=_0x1b469d[_0xbf68('0x11')];this['dialNoAnswerMaxRetry']=_0x1b469d[_0xbf68('0x12')];this['dialNoAnswerRetryFrequency']=_0x1b469d[_0xbf68('0x13')];this['dialGlobalMaxRetry']=_0x1b469d[_0xbf68('0x14')];this[_0xbf68('0x15')]=_0x1b469d[_0xbf68('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1b469d['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbf68('0x16')]=_0x1b469d[_0xbf68('0x16')]||0x3;this[_0xbf68('0x17')]=_0x1b469d[_0xbf68('0x17')]||0x96;this[_0xbf68('0x18')]=_0x1b469d[_0xbf68('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x1b469d[_0xbf68('0x19')]||0x96;this[_0xbf68('0x1a')]=_0x1b469d[_0xbf68('0x1a')]||0x3;this[_0xbf68('0x1b')]=_0x1b469d['dialMachineRetryFrequency']||0x96;this[_0xbf68('0x1c')]=_0x1b469d[_0xbf68('0x1c')]||0x3;this[_0xbf68('0x1d')]=_0x1b469d[_0xbf68('0x1d')]||0x96;this[_0xbf68('0x1e')]=_0x1b469d['dialOrderByScheduledAt']||_0xbf68('0x1f');this[_0xbf68('0x20')]=_0x1b469d[_0xbf68('0x20')]||undefined;this[_0xbf68('0x21')]=_0x1b469d[_0xbf68('0x21')]||undefined;this['dialCutDigit']=_0x1b469d[_0xbf68('0x22')]||undefined;this['TrunkBackup']=_0x1b469d[_0xbf68('0x23')]?_0x1b469d[_0xbf68('0x23')]:undefined;this[_0xbf68('0x24')]=_0x1b469d[_0xbf68('0x24')]?_0x1b469d['Trunk']:undefined;this[_0xbf68('0x25')]=_0x1b469d[_0xbf68('0x25')]?_0x1b469d[_0xbf68('0x25')]:undefined;this[_0xbf68('0x26')]=_0x1b469d[_0xbf68('0x26')]?_0x1b469d[_0xbf68('0x26')]:undefined;this[_0xbf68('0x27')]=_0x1b469d[_0xbf68('0x26')]?_0x1b469d['SquareProject']['name']:undefined;this[_0xbf68('0x28')]=_0x1b469d[_0xbf68('0x28')]||![];this['dialAMDInitialSilence']=_0x1b469d[_0xbf68('0x29')];this['dialAMDGreeting']=_0x1b469d[_0xbf68('0x2a')];this['dialAMDAfterGreetingSilence']=_0x1b469d['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x1b469d[_0xbf68('0x2b')];this['dialAMDMinWordLength']=_0x1b469d[_0xbf68('0x2c')];this[_0xbf68('0x2d')]=_0x1b469d[_0xbf68('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x1b469d['dialAMDMaximumNumberOfWords'];this[_0xbf68('0x2e')]=_0x1b469d[_0xbf68('0x2e')];this[_0xbf68('0x2f')]=_0x1b469d['dialAMDMaximumWordLength'];}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 a8c5866..d84b6db 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 _0x9e6b=['accountcode','context','uniqueid','exten','answered','answertime','unmanaged','duration','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinename'];(function(_0x48c819,_0xdeffc5){var _0xc92de9=function(_0x105cca){while(--_0x105cca){_0x48c819['push'](_0x48c819['shift']());}};_0xc92de9(++_0xdeffc5);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9e6b[_0x8c43de];return _0xa6591b;};'use strict';function Channel(){this[_0xb9e6('0x0')]=null;this[_0xb9e6('0x1')]='';this['destinationchannel']='';this[_0xb9e6('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xb9e6('0x3')]=undefined;this[_0xb9e6('0x4')]=0x0;this[_0xb9e6('0x5')]='';this[_0xb9e6('0x6')]=0x0;this['linkedid']=0x0;this[_0xb9e6('0x7')]=0x0;this[_0xb9e6('0x8')]=![];this[_0xb9e6('0x9')]=null;this['endtime']=null;this[_0xb9e6('0xa')]=![];this['abandoned']=![];this['lastapplication']='';this['lastdata']='';this[_0xb9e6('0xb')]=0x0;this['billableseconds']=0x0;this[_0xb9e6('0xc')]=0x0;this[_0xb9e6('0xd')]=null;this[_0xb9e6('0xe')]=null;this[_0xb9e6('0xf')]=null;this[_0xb9e6('0x10')]=![];this[_0xb9e6('0x11')]=null;this[_0xb9e6('0x12')]=null;this[_0xb9e6('0x13')]=[];this[_0xb9e6('0x14')]=undefined;this[_0xb9e6('0x15')]=undefined;this['transferType']=undefined;this[_0xb9e6('0x16')]=0x0;}module[_0xb9e6('0x17')]=Channel; \ No newline at end of file +var _0x6b47=['tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferType','mohtime','exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x6b47,0xe9));var _0x76b4=function(_0xad9b66,_0x4a6b2c){_0xad9b66=_0xad9b66-0x0;var _0x3e4c3f=_0x6b47[_0xad9b66];return _0x3e4c3f;};'use strict';function Channel(){this['starttime']=null;this[_0x76b4('0x0')]='';this['destinationchannel']='';this[_0x76b4('0x1')]=0x0;this[_0x76b4('0x2')]='';this[_0x76b4('0x3')]=undefined;this[_0x76b4('0x4')]=undefined;this['accountcode']=0x0;this[_0x76b4('0x5')]='';this[_0x76b4('0x6')]=0x0;this[_0x76b4('0x7')]=0x0;this[_0x76b4('0x8')]=0x0;this[_0x76b4('0x9')]=![];this['answertime']=null;this[_0x76b4('0xa')]=null;this[_0x76b4('0xb')]=![];this[_0x76b4('0xc')]=![];this[_0x76b4('0xd')]='';this[_0x76b4('0xe')]='';this[_0x76b4('0xf')]=0x0;this[_0x76b4('0x10')]=0x0;this[_0x76b4('0x11')]=0x0;this[_0x76b4('0x12')]=null;this[_0x76b4('0x13')]=null;this[_0x76b4('0x14')]=null;this[_0x76b4('0x15')]=![];this[_0x76b4('0x16')]=null;this['queue']=null;this[_0x76b4('0x17')]=[];this[_0x76b4('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x76b4('0x19')]=undefined;this[_0x76b4('0x1a')]=0x0;}module[_0x76b4('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 6dec98a..8b2c6c6 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 _0xf21f=['exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0xcacc7c,_0x2aa477){var _0x4754eb=function(_0x1b9271){while(--_0x1b9271){_0xcacc7c['push'](_0xcacc7c['shift']());}};_0x4754eb(++_0x2aa477);}(_0xf21f,0x1a5));var _0xff21=function(_0x282c88,_0x595f0e){_0x282c88=_0x282c88-0x0;var _0x48ec5c=_0xf21f[_0x282c88];return _0x48ec5c;};'use strict';function DeskAccount(_0x4f16a3){this['id']=_0x4f16a3['id']||0x0;this['name']=_0x4f16a3['name']||'';this[_0xff21('0x0')]=_0x4f16a3['username']||'';this[_0xff21('0x1')]=_0x4f16a3[_0xff21('0x1')]||'';this['authType']=_0x4f16a3[_0xff21('0x2')]||'';this['password']=_0x4f16a3[_0xff21('0x3')]||'';this[_0xff21('0x4')]=_0x4f16a3[_0xff21('0x4')]||'';this[_0xff21('0x5')]=_0x4f16a3[_0xff21('0x5')]||'';this[_0xff21('0x6')]=_0x4f16a3[_0xff21('0x6')]||'';this[_0xff21('0x7')]=_0x4f16a3[_0xff21('0x7')]||'';this[_0xff21('0x8')]=_0x4f16a3['type']||'';this['serverUrl']=_0x4f16a3[_0xff21('0x9')]||'';this[_0xff21('0xa')]=_0x4f16a3[_0xff21('0xa')]||{};}module[_0xff21('0xb')]=DeskAccount; \ No newline at end of file +var _0xa36e=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name'];(function(_0x93a6ee,_0x253344){var _0xb5ee31=function(_0x41cc23){while(--_0x41cc23){_0x93a6ee['push'](_0x93a6ee['shift']());}};_0xb5ee31(++_0x253344);}(_0xa36e,0x107));var _0xea36=function(_0x1aadb1,_0x413635){_0x1aadb1=_0x1aadb1-0x0;var _0x318da9=_0xa36e[_0x1aadb1];return _0x318da9;};'use strict';function DeskAccount(_0xd8080b){this['id']=_0xd8080b['id']||0x0;this[_0xea36('0x0')]=_0xd8080b[_0xea36('0x0')]||'';this[_0xea36('0x1')]=_0xd8080b[_0xea36('0x1')]||'';this[_0xea36('0x2')]=_0xd8080b[_0xea36('0x2')]||'';this[_0xea36('0x3')]=_0xd8080b['authType']||'';this[_0xea36('0x4')]=_0xd8080b[_0xea36('0x4')]||'';this[_0xea36('0x5')]=_0xd8080b[_0xea36('0x5')]||'';this[_0xea36('0x6')]=_0xd8080b[_0xea36('0x6')]||'';this[_0xea36('0x7')]=_0xd8080b[_0xea36('0x7')]||'';this['tokenSecret']=_0xd8080b[_0xea36('0x8')]||'';this[_0xea36('0x9')]=_0xd8080b[_0xea36('0x9')]||'';this[_0xea36('0xa')]=_0xd8080b[_0xea36('0xa')]||'';this[_0xea36('0xb')]=_0xd8080b['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 9c5d781..5abe975 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 _0xbcbf=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x55de19,_0x28f0b0){var _0x4250c0=function(_0x2af076){while(--_0x2af076){_0x55de19['push'](_0x55de19['shift']());}};_0x4250c0(++_0x28f0b0);}(_0xbcbf,0x14c));var _0xfbcb=function(_0x1adbdc,_0x50d9bd){_0x1adbdc=_0x1adbdc-0x0;var _0x40205c=_0xbcbf[_0x1adbdc];return _0x40205c;};'use strict';function Dynamics365Account(_0x1357f7){this['id']=_0x1357f7['id']||0x0;this[_0xfbcb('0x0')]=_0x1357f7[_0xfbcb('0x0')]||'';this['username']=_0x1357f7[_0xfbcb('0x1')]||'';this[_0xfbcb('0x2')]=_0x1357f7['password']||'';this[_0xfbcb('0x3')]=_0x1357f7[_0xfbcb('0x3')]||'';this[_0xfbcb('0x4')]=_0x1357f7[_0xfbcb('0x4')]||'';this[_0xfbcb('0x5')]=_0x1357f7[_0xfbcb('0x5')]||'';this['clientSecret']=_0x1357f7[_0xfbcb('0x6')]||{};this[_0xfbcb('0x7')]=_0x1357f7[_0xfbcb('0x7')]||'';this[_0xfbcb('0x8')]=_0x1357f7[_0xfbcb('0x8')]||![];this[_0xfbcb('0x9')]=_0x1357f7['Configurations']||{};this[_0xfbcb('0xa')]=_0x1357f7['CloudProvider']||{};}module[_0xfbcb('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x34e8=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x343493,_0x2b85bc){var _0x11776a=function(_0xad85b7){while(--_0xad85b7){_0x343493['push'](_0x343493['shift']());}};_0x11776a(++_0x2b85bc);}(_0x34e8,0x1f3));var _0x834e=function(_0x1baffa,_0x2b3ecc){_0x1baffa=_0x1baffa-0x0;var _0x568163=_0x34e8[_0x1baffa];return _0x568163;};'use strict';function Dynamics365Account(_0x2b35b0){this['id']=_0x2b35b0['id']||0x0;this[_0x834e('0x0')]=_0x2b35b0[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x2b35b0[_0x834e('0x1')]||'';this[_0x834e('0x2')]=_0x2b35b0[_0x834e('0x2')]||'';this[_0x834e('0x3')]=_0x2b35b0[_0x834e('0x3')]||'';this[_0x834e('0x4')]=_0x2b35b0[_0x834e('0x4')]||'';this['clientId']=_0x2b35b0[_0x834e('0x5')]||'';this[_0x834e('0x6')]=_0x2b35b0['clientSecret']||{};this['serverUrl']=_0x2b35b0[_0x834e('0x7')]||'';this['modernAuthentication']=_0x2b35b0[_0x834e('0x8')]||![];this[_0x834e('0x9')]=_0x2b35b0[_0x834e('0x9')]||{};this[_0x834e('0xa')]=_0x2b35b0[_0x834e('0xa')]||{};}module[_0x834e('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 767a97f..bed57fe 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 _0x0df0=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0x0df0,0x13c));var _0x00df=function(_0x2046dd,_0x40a9ab){_0x2046dd=_0x2046dd-0x0;var _0x2eb055=_0x0df0[_0x2046dd];return _0x2eb055;};'use strict';function FaxAccount(_0x764692){this['id']=_0x764692['id']||0x0;this['name']=_0x764692[_0x00df('0x0')]||'';this[_0x00df('0x1')]=_0x764692[_0x00df('0x1')];this['ecm']=_0x764692[_0x00df('0x2')];this['headerinfo']=_0x764692[_0x00df('0x3')];this[_0x00df('0x4')]=_0x764692[_0x00df('0x4')];this[_0x00df('0x5')]=_0x764692[_0x00df('0x5')]||0x960;this[_0x00df('0x6')]=_0x764692[_0x00df('0x6')]||0x3840;this[_0x00df('0x7')]=_0x764692[_0x00df('0x7')]||_0x00df('0x8');this['gateway']=_0x764692[_0x00df('0x9')]||'no';this[_0x00df('0xa')]=_0x764692[_0x00df('0xa')]||'no';this['t38timeout']=_0x764692[_0x00df('0xb')]||0x1388;this[_0x00df('0xc')]=_0x764692[_0x00df('0xc')]||'SIP';this[_0x00df('0xd')]=_0x764692['Trunk']?_0x764692[_0x00df('0xd')]:undefined;this[_0x00df('0xe')]=_0x764692[_0x00df('0xe')];this['key']=_0x764692[_0x00df('0xf')];}module[_0x00df('0x10')]=FaxAccount; \ No newline at end of file +var _0x60f7=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x5f3df3,_0x4b6f74){var _0x37219c=function(_0x2816f6){while(--_0x2816f6){_0x5f3df3['push'](_0x5f3df3['shift']());}};_0x37219c(++_0x4b6f74);}(_0x60f7,0x149));var _0x760f=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x60f7[_0x5f3f88];return _0xd08119;};'use strict';function FaxAccount(_0x1d19b3){this['id']=_0x1d19b3['id']||0x0;this[_0x760f('0x0')]=_0x1d19b3[_0x760f('0x0')]||'';this[_0x760f('0x1')]=_0x1d19b3[_0x760f('0x1')];this[_0x760f('0x2')]=_0x1d19b3['ecm'];this['headerinfo']=_0x1d19b3[_0x760f('0x3')];this[_0x760f('0x4')]=_0x1d19b3[_0x760f('0x4')];this[_0x760f('0x5')]=_0x1d19b3[_0x760f('0x5')]||0x960;this[_0x760f('0x6')]=_0x1d19b3['maxrate']||0x3840;this[_0x760f('0x7')]=_0x1d19b3[_0x760f('0x7')]||_0x760f('0x8');this[_0x760f('0x9')]=_0x1d19b3[_0x760f('0x9')]||'no';this[_0x760f('0xa')]=_0x1d19b3[_0x760f('0xa')]||'no';this[_0x760f('0xb')]=_0x1d19b3[_0x760f('0xb')]||0x1388;this[_0x760f('0xc')]=_0x1d19b3['tech']||_0x760f('0xd');this[_0x760f('0xe')]=_0x1d19b3[_0x760f('0xe')]?_0x1d19b3[_0x760f('0xe')]:undefined;this[_0x760f('0xf')]=_0x1d19b3[_0x760f('0xf')];this[_0x760f('0x10')]=_0x1d19b3[_0x760f('0x10')];}module[_0x760f('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index de937b8..c196d03 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 _0x8ea7=['Configurations','name','username','token','remoteUri','serverUrl'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0x8ea7,0x1f3));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x1079b9){this['id']=_0x1079b9['id']||0x0;this[_0x78ea('0x0')]=_0x1079b9[_0x78ea('0x0')]||'';this[_0x78ea('0x1')]=_0x1079b9[_0x78ea('0x1')]||'';this['apiKey']=_0x1079b9[_0x78ea('0x2')]||'';this[_0x78ea('0x3')]=_0x1079b9[_0x78ea('0x3')]||'';this[_0x78ea('0x4')]=_0x1079b9['serverUrl']||'';this[_0x78ea('0x5')]=_0x1079b9[_0x78ea('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x952b=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x952b,0x6a));var _0xb952=function(_0x5cd0ca,_0xa4cf16){_0x5cd0ca=_0x5cd0ca-0x0;var _0x4e8c4c=_0x952b[_0x5cd0ca];return _0x4e8c4c;};'use strict';function FreshdeskAccount(_0x16c9b7){this['id']=_0x16c9b7['id']||0x0;this[_0xb952('0x0')]=_0x16c9b7['name']||'';this[_0xb952('0x1')]=_0x16c9b7['username']||'';this['apiKey']=_0x16c9b7[_0xb952('0x2')]||'';this[_0xb952('0x3')]=_0x16c9b7['remoteUri']||'';this[_0xb952('0x4')]=_0x16c9b7['serverUrl']||'';this[_0xb952('0x5')]=_0x16c9b7[_0xb952('0x5')]||{};}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 6e7fed5..fe4da01 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 _0x212b=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xe11ea1,_0x21f88){var _0x1c2616=function(_0x17b2af){while(--_0x17b2af){_0xe11ea1['push'](_0xe11ea1['shift']());}};_0x1c2616(++_0x21f88);}(_0x212b,0x148));var _0xb212=function(_0x1a0987,_0x16fb5b){_0x1a0987=_0x1a0987-0x0;var _0x5e7b7b=_0x212b[_0x1a0987];return _0x5e7b7b;};'use strict';function FreshsalesAccount(_0x4fab1b){this['id']=_0x4fab1b['id']||0x0;this['name']=_0x4fab1b[_0xb212('0x0')]||'';this[_0xb212('0x1')]=_0x4fab1b[_0xb212('0x1')]||'';this[_0xb212('0x2')]=_0x4fab1b['token']||'';this[_0xb212('0x3')]=_0x4fab1b[_0xb212('0x3')]||'';this[_0xb212('0x4')]=_0x4fab1b['serverUrl']||'';this[_0xb212('0x5')]=_0x4fab1b[_0xb212('0x5')]||{};}module[_0xb212('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x1f75=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x2ffd90,_0x45ee66){var _0x313de7=function(_0x4eab3f){while(--_0x4eab3f){_0x2ffd90['push'](_0x2ffd90['shift']());}};_0x313de7(++_0x45ee66);}(_0x1f75,0x12c));var _0x51f7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1f75[_0xbca1b1];return _0x4e1686;};'use strict';function FreshsalesAccount(_0x212fbd){this['id']=_0x212fbd['id']||0x0;this[_0x51f7('0x0')]=_0x212fbd[_0x51f7('0x0')]||'';this['username']=_0x212fbd[_0x51f7('0x1')]||'';this[_0x51f7('0x2')]=_0x212fbd[_0x51f7('0x3')]||'';this[_0x51f7('0x4')]=_0x212fbd[_0x51f7('0x4')]||'';this[_0x51f7('0x5')]=_0x212fbd[_0x51f7('0x5')]||'';this[_0x51f7('0x6')]=_0x212fbd[_0x51f7('0x6')]||{};}module[_0x51f7('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 5f69911..c013e7d 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 _0x3906=['mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','motionChannel'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3906,0xe8));var _0x6390=function(_0x50e222,_0x2f2252){_0x50e222=_0x50e222-0x0;var _0x4767a3=_0x3906[_0x50e222];return _0x4767a3;};'use strict';function QueueReport(){this[_0x6390('0x0')]=_0x6390('0x1');this[_0x6390('0x2')]='';this[_0x6390('0x3')]='';this[_0x6390('0x4')]='';this[_0x6390('0x5')]='';this[_0x6390('0x6')]=null;this[_0x6390('0x7')]=null;this[_0x6390('0x8')]=0x1;this['count']=0x1;this[_0x6390('0x9')]=![];this[_0x6390('0xa')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x6390('0xb')]=![];this['queuecallerexitAt']=null;this[_0x6390('0xc')]=0x1;this[_0x6390('0xd')]='';this[_0x6390('0xe')]='';this[_0x6390('0xf')]='';this[_0x6390('0x10')]='';this[_0x6390('0x11')]='';this[_0x6390('0x12')]='';this[_0x6390('0x13')]='';this['holdtime']=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x6390('0x14')]='voice';this[_0x6390('0x15')]=0x0;this['variables']={};}module[_0x6390('0x16')]=QueueReport; \ No newline at end of file +var _0x50cb=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound'];(function(_0x760e4b,_0x420e6c){var _0x2e4fb2=function(_0x55e310){while(--_0x55e310){_0x760e4b['push'](_0x760e4b['shift']());}};_0x2e4fb2(++_0x420e6c);}(_0x50cb,0x136));var _0xb50c=function(_0x42f4d7,_0x11401d){_0x42f4d7=_0x42f4d7-0x0;var _0x3447e6=_0x50cb[_0x42f4d7];return _0x3447e6;};'use strict';function QueueReport(){this[_0xb50c('0x0')]=_0xb50c('0x1');this[_0xb50c('0x2')]='';this[_0xb50c('0x3')]='';this[_0xb50c('0x4')]='';this[_0xb50c('0x5')]='';this[_0xb50c('0x6')]=null;this['queuecallerleaveAt']=null;this[_0xb50c('0x7')]=0x1;this[_0xb50c('0x8')]=0x1;this[_0xb50c('0x9')]=![];this[_0xb50c('0xa')]=null;this[_0xb50c('0xb')]=![];this['queuecallercompleteAt']=null;this[_0xb50c('0xc')]=![];this['queuecallerexitAt']=null;this[_0xb50c('0xd')]=0x1;this['channel']='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xb50c('0xe')]='';this[_0xb50c('0xf')]='';this[_0xb50c('0x10')]='';this[_0xb50c('0x11')]='';this[_0xb50c('0x12')]=0x0;this[_0xb50c('0x13')]=![];this[_0xb50c('0x14')]='';this[_0xb50c('0x15')]=_0xb50c('0x16');this[_0xb50c('0x17')]=0x0;this[_0xb50c('0x18')]={};}module[_0xb50c('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9faf8db..31505b6 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 _0x88c7=['password','clientId','clientSecret','securityToken','integrationTab','serverUrl','Configurations','username'];(function(_0xccc9e6,_0x14d222){var _0xd24f8d=function(_0x50c1a1){while(--_0x50c1a1){_0xccc9e6['push'](_0xccc9e6['shift']());}};_0xd24f8d(++_0x14d222);}(_0x88c7,0x6f));var _0x788c=function(_0x37a1ec,_0x27ef6d){_0x37a1ec=_0x37a1ec-0x0;var _0x2448cc=_0x88c7[_0x37a1ec];return _0x2448cc;};'use strict';function SalesforceAccount(_0x259bee){this['id']=_0x259bee['id']||0x0;this['name']=_0x259bee['name']||'';this[_0x788c('0x0')]=_0x259bee[_0x788c('0x0')]||'';this['remoteUri']=_0x259bee['remoteUri']||'';this[_0x788c('0x1')]=_0x259bee[_0x788c('0x1')]||'';this['clientId']=_0x259bee[_0x788c('0x2')]||'';this[_0x788c('0x3')]=_0x259bee['clientSecret']||'';this[_0x788c('0x4')]=_0x259bee[_0x788c('0x4')]||'';this['type']=_0x259bee['type']||_0x788c('0x5');this[_0x788c('0x6')]=_0x259bee[_0x788c('0x6')]||'';this[_0x788c('0x7')]=_0x259bee[_0x788c('0x7')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0x1ec4=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x429362,_0x1438f8){var _0x4d9eee=function(_0x4e6b6d){while(--_0x4e6b6d){_0x429362['push'](_0x429362['shift']());}};_0x4d9eee(++_0x1438f8);}(_0x1ec4,0xb9));var _0x41ec=function(_0x481f94,_0x1ec6a2){_0x481f94=_0x481f94-0x0;var _0x5dfc0c=_0x1ec4[_0x481f94];return _0x5dfc0c;};'use strict';function SalesforceAccount(_0x34096f){this['id']=_0x34096f['id']||0x0;this[_0x41ec('0x0')]=_0x34096f[_0x41ec('0x0')]||'';this[_0x41ec('0x1')]=_0x34096f[_0x41ec('0x1')]||'';this[_0x41ec('0x2')]=_0x34096f[_0x41ec('0x2')]||'';this[_0x41ec('0x3')]=_0x34096f[_0x41ec('0x3')]||'';this[_0x41ec('0x4')]=_0x34096f[_0x41ec('0x4')]||'';this[_0x41ec('0x5')]=_0x34096f[_0x41ec('0x5')]||'';this[_0x41ec('0x6')]=_0x34096f[_0x41ec('0x6')]||'';this[_0x41ec('0x7')]=_0x34096f[_0x41ec('0x7')]||_0x41ec('0x8');this[_0x41ec('0x9')]=_0x34096f[_0x41ec('0x9')]||'';this[_0x41ec('0xa')]=_0x34096f['Configurations']||{};}module[_0x41ec('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 70743b0..a3db906 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 _0xd0ba=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x54f9cc,_0x4a03b0){var _0x45315c=function(_0x44c245){while(--_0x44c245){_0x54f9cc['push'](_0x54f9cc['shift']());}};_0x45315c(++_0x4a03b0);}(_0xd0ba,0x11d));var _0xad0b=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xd0ba[_0x1d1d09];return _0x8827e;};'use strict';function ServicenowAccount(_0x238f31){this['id']=_0x238f31['id']||0x0;this[_0xad0b('0x0')]=_0x238f31['name']||'';this[_0xad0b('0x1')]=_0x238f31['username']||'';this[_0xad0b('0x2')]=_0x238f31['password']||'';this[_0xad0b('0x3')]=_0x238f31[_0xad0b('0x3')]||'';this[_0xad0b('0x4')]=_0x238f31[_0xad0b('0x4')]||'';this['Configurations']=_0x238f31[_0xad0b('0x5')]||{};}module[_0xad0b('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xa275=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa275,0x1ad));var _0x5a27=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa275[_0x57b54c];return _0x59cc19;};'use strict';function ServicenowAccount(_0x1ea3e9){this['id']=_0x1ea3e9['id']||0x0;this[_0x5a27('0x0')]=_0x1ea3e9[_0x5a27('0x0')]||'';this[_0x5a27('0x1')]=_0x1ea3e9[_0x5a27('0x1')]||'';this['password']=_0x1ea3e9[_0x5a27('0x2')]||'';this[_0x5a27('0x3')]=_0x1ea3e9[_0x5a27('0x3')]||'';this[_0x5a27('0x4')]=_0x1ea3e9['serverUrl']||'';this[_0x5a27('0x5')]=_0x1ea3e9[_0x5a27('0x5')]||{};}module[_0x5a27('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index bc67e9d..c2bca93 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 _0x6ea5=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x579245,_0x19b58b){var _0x15da10=function(_0x7ab6fb){while(--_0x7ab6fb){_0x579245['push'](_0x579245['shift']());}};_0x15da10(++_0x19b58b);}(_0x6ea5,0xa5));var _0x56ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ea5[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x5900a7){this['id']=_0x5900a7['id']||0x0;this[_0x56ea('0x0')]=_0x5900a7['name']||'';this[_0x56ea('0x1')]=_0x5900a7[_0x56ea('0x1')]||'';this['password']=_0x5900a7[_0x56ea('0x2')]||'';this[_0x56ea('0x3')]=_0x5900a7['remoteUri']||'';this[_0x56ea('0x4')]=_0x5900a7['serverUrl']||'';this[_0x56ea('0x5')]=_0x5900a7[_0x56ea('0x5')]||{};}module[_0x56ea('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xf7f0=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xaf5836,_0x4ddd0e){var _0x3abb8c=function(_0x188dd3){while(--_0x188dd3){_0xaf5836['push'](_0xaf5836['shift']());}};_0x3abb8c(++_0x4ddd0e);}(_0xf7f0,0xcb));var _0x0f7f=function(_0x2b2d5b,_0x4a2fb1){_0x2b2d5b=_0x2b2d5b-0x0;var _0x80b73f=_0xf7f0[_0x2b2d5b];return _0x80b73f;};'use strict';function SugarcrmAccount(_0x52cee6){this['id']=_0x52cee6['id']||0x0;this[_0x0f7f('0x0')]=_0x52cee6['name']||'';this[_0x0f7f('0x1')]=_0x52cee6[_0x0f7f('0x1')]||'';this[_0x0f7f('0x2')]=_0x52cee6[_0x0f7f('0x2')]||'';this['remoteUri']=_0x52cee6[_0x0f7f('0x3')]||'';this[_0x0f7f('0x4')]=_0x52cee6[_0x0f7f('0x4')]||'';this[_0x0f7f('0x5')]=_0x52cee6[_0x0f7f('0x5')]||{};}module[_0x0f7f('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index bf96be4..bb2bd8e 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 _0x0b37=['address','exports','name','accountcode','unknown','stateTime','status'];(function(_0x14a887,_0xadb93c){var _0x56f6ab=function(_0x5b5902){while(--_0x5b5902){_0x14a887['push'](_0x14a887['shift']());}};_0x56f6ab(++_0xadb93c);}(_0x0b37,0x1d7));var _0x70b3=function(_0x1f6031,_0x3d3c8b){_0x1f6031=_0x1f6031-0x0;var _0x1adb7e=_0x0b37[_0x1f6031];return _0x1adb7e;};'use strict';function Telephone(_0x6bdeb0){this['id']=_0x6bdeb0['id']||0x0;this[_0x70b3('0x0')]=_0x6bdeb0[_0x70b3('0x0')]||'';this[_0x70b3('0x1')]=_0x6bdeb0[_0x70b3('0x1')]||'';this['state']=_0x70b3('0x2');this[_0x70b3('0x3')]=0x0;this[_0x70b3('0x4')]=_0x70b3('0x2');this[_0x70b3('0x5')]='';}module[_0x70b3('0x6')]=Telephone; \ No newline at end of file +var _0x5c00=['unknown','stateTime','status','exports','name','accountcode'];(function(_0x38b2d9,_0x19fd42){var _0x23a3e1=function(_0xd8192f){while(--_0xd8192f){_0x38b2d9['push'](_0x38b2d9['shift']());}};_0x23a3e1(++_0x19fd42);}(_0x5c00,0x17e));var _0x05c0=function(_0x555479,_0x3aa2b4){_0x555479=_0x555479-0x0;var _0x560c8e=_0x5c00[_0x555479];return _0x560c8e;};'use strict';function Telephone(_0x29fe0e){this['id']=_0x29fe0e['id']||0x0;this[_0x05c0('0x0')]=_0x29fe0e[_0x05c0('0x0')]||'';this['accountcode']=_0x29fe0e[_0x05c0('0x1')]||'';this['state']=_0x05c0('0x2');this[_0x05c0('0x3')]=0x0;this[_0x05c0('0x4')]=_0x05c0('0x2');this['address']='';}module[_0x05c0('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 78be971..40f8fd6 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(_0x3b59d6,_0x45623d){var _0x2d3a64=function(_0x31b132){while(--_0x31b132){_0x3b59d6['push'](_0x3b59d6['shift']());}};_0x2d3a64(++_0x45623d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x2c1a77,_0x525ee8){var _0x36e726=function(_0x33b536){while(--_0x33b536){_0x2c1a77['push'](_0x2c1a77['shift']());}};_0x36e726(++_0x525ee8);}(_0xb10b,0x12a));var _0xbb10=function(_0x170310,_0x31acf9){_0x170310=_0x170310-0x0;var _0x1b6006=_0xb10b[_0x170310];return _0x1b6006;};'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 c9d17ff..3e16671 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x53bea5,_0xfbebf2){var _0x10e9bc=function(_0x565ef6){while(--_0x565ef6){_0x53bea5['push'](_0x53bea5['shift']());}};_0x10e9bc(++_0xfbebf2);}(_0x14a0,0x8e));var _0x014a=function(_0x5e7767,_0x327e8f){_0x5e7767=_0x5e7767-0x0;var _0x5994bc=_0x14a0[_0x5e7767];return _0x5994bc;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b8539d5..afe4c9b 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 _0xc89f=['defaultuser','exports','active','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','refresh','stateRegistry','address'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xc89f,0x145));var _0xfc89=function(_0x124601,_0x3b187b){_0x124601=_0x124601-0x0;var _0x2b20fb=_0xc89f[_0x124601];return _0x2b20fb;};'use strict';function Trunk(_0x471934){this['id']=_0x471934['id']||0x0;this[_0xfc89('0x0')]=_0x471934[_0xfc89('0x0')]||![];this[_0xfc89('0x1')]=_0x471934[_0xfc89('0x1')]||'';this[_0xfc89('0x2')]='unknown';this[_0xfc89('0x3')]=0x0;this[_0xfc89('0x4')]=_0xfc89('0x5');this['registry']=_0x471934[_0xfc89('0x6')]&&_0x471934[_0xfc89('0x6')][_0xfc89('0x7')](':')?_0x471934[_0xfc89('0x6')][_0xfc89('0x8')](':')[0x0]:'';this[_0xfc89('0x9')]='';this[_0xfc89('0xa')]='';this[_0xfc89('0xb')]='';this['domainport']='';this[_0xfc89('0xc')]='';this[_0xfc89('0xd')]=_0xfc89('0x5');this['registrationtime']='';this[_0xfc89('0xe')]='';this[_0xfc89('0xf')]=_0x471934['defaultuser']||'';}module[_0xfc89('0x10')]=Trunk; \ No newline at end of file +var _0x0b8a=['registrationtime','address','exports','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x0b8a,0x1e3));var _0xa0b8=function(_0x492b62,_0x1087f2){_0x492b62=_0x492b62-0x0;var _0xc17e88=_0x0b8a[_0x492b62];return _0xc17e88;};'use strict';function Trunk(_0x2f0440){this['id']=_0x2f0440['id']||0x0;this[_0xa0b8('0x0')]=_0x2f0440[_0xa0b8('0x0')]||![];this[_0xa0b8('0x1')]=_0x2f0440[_0xa0b8('0x1')]||'';this['state']=_0xa0b8('0x2');this[_0xa0b8('0x3')]=0x0;this[_0xa0b8('0x4')]='unknown';this['registry']=_0x2f0440['registry']&&_0x2f0440[_0xa0b8('0x5')][_0xa0b8('0x6')](':')?_0x2f0440[_0xa0b8('0x5')][_0xa0b8('0x7')](':')[0x0]:'';this[_0xa0b8('0x8')]='';this[_0xa0b8('0x9')]='';this[_0xa0b8('0xa')]='';this[_0xa0b8('0xb')]='';this[_0xa0b8('0xc')]='';this['stateRegistry']=_0xa0b8('0x2');this[_0xa0b8('0xd')]='';this[_0xa0b8('0xe')]='';this['defaultuser']=_0x2f0440['defaultuser']||'';}module[_0xa0b8('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4234337..b7d0ab8 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 _0xb76f=['mandatoryDisposition','exten','recordingFormat'];(function(_0x42c97f,_0x273509){var _0x386d2d=function(_0x35b025){while(--_0x35b025){_0x42c97f['push'](_0x42c97f['shift']());}};_0x386d2d(++_0x273509);}(_0xb76f,0x1de));var _0xfb76=function(_0x480a7d,_0x409497){_0x480a7d=_0x480a7d-0x0;var _0x31fb9e=_0xb76f[_0x480a7d];return _0x31fb9e;};'use strict';function voiceExtension(_0x1cc465){this['id']=_0x1cc465['id']||0x0;this[_0xfb76('0x0')]=_0x1cc465[_0xfb76('0x0')]||'';this[_0xfb76('0x1')]=_0x1cc465['recordingFormat']||'none';this[_0xfb76('0x2')]=_0x1cc465[_0xfb76('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xccf1=['mandatoryDisposition','recordingFormat','none'];(function(_0x39e1f0,_0x560848){var _0x240e82=function(_0x3976b1){while(--_0x3976b1){_0x39e1f0['push'](_0x39e1f0['shift']());}};_0x240e82(++_0x560848);}(_0xccf1,0x19c));var _0x1ccf=function(_0x188fbd,_0x4e662b){_0x188fbd=_0x188fbd-0x0;var _0x17745b=_0xccf1[_0x188fbd];return _0x17745b;};'use strict';function voiceExtension(_0x2bc0c3){this['id']=_0x2bc0c3['id']||0x0;this['exten']=_0x2bc0c3['exten']||'';this[_0x1ccf('0x0')]=_0x2bc0c3['recordingFormat']||_0x1ccf('0x1');this[_0x1ccf('0x2')]=_0x2bc0c3[_0x1ccf('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 bdf3e34..1d4f9ad 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 _0x9726=['outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x479fdc,_0x334c42){var _0x2e601c=function(_0x1a5cb2){while(--_0x1a5cb2){_0x479fdc['push'](_0x479fdc['shift']());}};_0x2e601c(++_0x334c42);}(_0x9726,0x18e));var _0x6972=function(_0x21b6cf,_0x3afb3e){_0x21b6cf=_0x21b6cf-0x0;var _0x420450=_0x9726[_0x21b6cf];return _0x420450;};'use strict';var statusDesc=[_0x6972('0x0'),_0x6972('0x1'),'inuse',_0x6972('0x2'),_0x6972('0x3'),_0x6972('0x4'),_0x6972('0x5'),_0x6972('0x6'),_0x6972('0x7')];var monitorFormat={'wav':'wav','wav49':_0x6972('0x8'),'gsm':_0x6972('0x9')};var strategy={'rrmemory':_0x6972('0xa'),'roundrobin':_0x6972('0xb')};function VoiceQueue(_0x666e76){this['id']=_0x666e76['id']||0x0;this[_0x6972('0xc')]=_0x666e76[_0x6972('0xc')]||'';this[_0x6972('0xd')]=_0x666e76['monitor_format']||'';this['type']=_0x666e76[_0x6972('0xe')]||_0x6972('0xf');this['waiting']=0x0;this[_0x6972('0x10')]=0x0;this[_0x6972('0x11')]=0x0;this[_0x6972('0x12')]=0x0;this[_0x6972('0x13')]=0x0;this[_0x6972('0x14')]=0x0;this['sumBillable']=0x0;this[_0x6972('0x15')]=0x0;this[_0x6972('0x16')]=0x0;this[_0x6972('0x17')]=0x0;this[_0x6972('0x18')]=0x0;this['acw']=_0x666e76[_0x6972('0x19')]||![];this[_0x6972('0x1a')]=_0x666e76[_0x6972('0x1a')]||0xa;this[_0x6972('0x1b')]=_0x666e76[_0x6972('0x1b')]||'no';this[_0x6972('0x1c')]=!![];this[_0x6972('0x1d')]='';this[_0x6972('0x1e')]=0x0;this[_0x6972('0x1f')]=0x0;this[_0x6972('0x20')]=_0x666e76[_0x6972('0x20')]||null;this[_0x6972('0x21')]=_0x666e76['dialGlobalInterval']?_0x666e76[_0x6972('0x21')]:null;this[_0x6972('0x22')]=_0x666e76[_0x6972('0x22')];this['dialMethod']=_0x666e76['dialMethod']||'progressive';this[_0x6972('0x23')]=_0x666e76['dialLimitChannel']||0x0;this[_0x6972('0x24')]=_0x666e76[_0x6972('0x24')]||0x0;this[_0x6972('0x25')]=_0x666e76[_0x6972('0x25')]||0x1;this[_0x6972('0x26')]=_0x666e76['dialPredictiveOptimization']||_0x6972('0x27');this[_0x6972('0x28')]=_0x666e76['dialPredictiveOptimizationPercentage']||0.03;this[_0x6972('0x29')]=_0x666e76[_0x6972('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x666e76[_0x6972('0x2a')]||_0x6972('0x2b');this[_0x6972('0x2c')]=_0x666e76[_0x6972('0x2c')]||_0x6972('0x2b');this['dialOriginateTimeout']=_0x666e76[_0x6972('0x2d')]||0x1e;this[_0x6972('0x2e')]=_0x666e76[_0x6972('0x2e')]||_0x6972('0x2f');this[_0x6972('0x30')]=_0x666e76[_0x6972('0x30')]||0x3;this[_0x6972('0x31')]=_0x666e76['dialQueueProject']||undefined;this[_0x6972('0x32')]=_0x666e76['dialCongestionMaxRetry']||0x3;this[_0x6972('0x33')]=_0x666e76['dialCongestionRetryFrequency']||0x96;this[_0x6972('0x34')]=_0x666e76[_0x6972('0x34')]||0x3;this['dialBusyRetryFrequency']=_0x666e76[_0x6972('0x35')]||0x96;this[_0x6972('0x36')]=_0x666e76[_0x6972('0x36')]||0x3;this[_0x6972('0x37')]=_0x666e76[_0x6972('0x37')]||0x96;this[_0x6972('0x38')]=_0x666e76[_0x6972('0x38')]||0x3;this[_0x6972('0x39')]=_0x666e76[_0x6972('0x39')]||0x96;this[_0x6972('0x3a')]=_0x666e76[_0x6972('0x3a')]||0x3;this[_0x6972('0x3b')]=_0x666e76['dialDropRetryFrequency']||0x96;this[_0x6972('0x3c')]=_0x666e76['dialAbandonedMaxRetry']||0x3;this[_0x6972('0x3d')]=_0x666e76[_0x6972('0x3d')]||0x96;this[_0x6972('0x3e')]=_0x666e76[_0x6972('0x3e')]||0x3;this[_0x6972('0x3f')]=_0x666e76[_0x6972('0x3f')]||0x96;this[_0x6972('0x40')]=_0x666e76[_0x6972('0x40')]||0x3;this[_0x6972('0x41')]=_0x666e76[_0x6972('0x41')]||0x96;this[_0x6972('0x42')]=_0x666e76[_0x6972('0x42')]||0x3;this['dialGlobalMaxRetry']=_0x666e76[_0x6972('0x43')]||0x4;this[_0x6972('0x44')]=_0x666e76['Trunk']?_0x666e76[_0x6972('0x44')]:undefined;this[_0x6972('0x45')]=_0x666e76[_0x6972('0x45')]?_0x666e76[_0x6972('0x45')]:undefined;this[_0x6972('0x46')]=_0x666e76[_0x6972('0x46')]||undefined;this[_0x6972('0x47')]=_0x666e76['Interval']?_0x666e76[_0x6972('0x47')]:undefined;this[_0x6972('0x48')]=_0x666e76['dialOrderByScheduledAt']||'DESC';this[_0x6972('0x49')]=_0x666e76[_0x6972('0x49')]||undefined;this[_0x6972('0x4a')]=_0x666e76[_0x6972('0x4a')]||undefined;this['strategy']=strategy[_0x666e76[_0x6972('0x4b')]]||_0x6972('0xa');this[_0x6972('0x4c')]=!![];this['dialAMDActive']=_0x666e76['dialAMDActive']||![];this[_0x6972('0x4d')]=_0x666e76[_0x6972('0x4d')];this['dialAMDGreeting']=_0x666e76[_0x6972('0x4e')];this[_0x6972('0x4f')]=_0x666e76[_0x6972('0x4f')];this[_0x6972('0x50')]=_0x666e76[_0x6972('0x50')];this[_0x6972('0x51')]=_0x666e76[_0x6972('0x51')];this[_0x6972('0x52')]=_0x666e76[_0x6972('0x52')];this['dialAMDMaximumNumberOfWords']=_0x666e76[_0x6972('0x53')];this['dialAMDSilenceThreshold']=_0x666e76[_0x6972('0x54')];this['dialAMDMaximumWordLength']=_0x666e76[_0x6972('0x55')];this['outboundRejectCallsDay']=0x0;this[_0x6972('0x56')]=0x0;this[_0x6972('0x57')]=_0x666e76[_0x6972('0x57')];this[_0x6972('0x58')]=0x0;this[_0x6972('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x6972('0x5a')]=0x0;this[_0x6972('0x5b')]=0x0;this[_0x6972('0x5c')]=0x0;this[_0x6972('0x5d')]=0x0;this[_0x6972('0x5e')]=0x0;this[_0x6972('0x5f')]=0x0;this[_0x6972('0x60')]=0x0;this[_0x6972('0x61')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6972('0x62')]=0x0;this[_0x6972('0x63')]=0x0;this[_0x6972('0x64')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x6972('0x65')]=1.05;this[_0x6972('0x66')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x6972('0x67')]=0x0;this[_0x6972('0x68')]=0x0;this[_0x6972('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x6972('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x666e76[_0x6972('0x6b')]||0x14;this[_0x6972('0x6c')]=_0x666e76[_0x6972('0x6b')]||0xa;this[_0x6972('0x6d')]=0x0;this[_0x6972('0x6e')]=0x0;this[_0x6972('0x6f')]=0x1;this['erlangCalls']=0x0;this[_0x6972('0x70')]=0x0;this[_0x6972('0x71')]=0x0;this[_0x6972('0x72')]=0x0;this['dialRecallMeTimeout']=_0x666e76[_0x6972('0x73')]||0x1e;this['dialRecallInQueue']=_0x666e76['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x666e76[_0x6972('0x74')]||![];this[_0x6972('0x75')]=!!_0x666e76[_0x6972('0x75')]||![];this[_0x6972('0x76')]=_0x666e76[_0x6972('0x76')]||undefined;this[_0x6972('0x77')]=_0x666e76['dialAgiAfterHangupClient']||![];this[_0x6972('0x78')]=_0x666e76[_0x6972('0x78')]||![];this[_0x6972('0xd')]=monitorFormat[_0x666e76[_0x6972('0xd')]]?monitorFormat[_0x666e76[_0x6972('0xd')]]:undefined;this['mandatoryDisposition']=_0x666e76[_0x6972('0x79')]||![];this['mandatoryDispositionPause']=_0x666e76[_0x6972('0x7a')]?_0x666e76[_0x6972('0x7a')]:undefined;}module[_0x6972('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x6122=['sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','talking','total','sumDuration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6122,0x69));var _0x2612=function(_0x4838df,_0x1e8c8d){_0x4838df=_0x4838df-0x0;var _0x1a41b3=_0x6122[_0x4838df];return _0x1a41b3;};'use strict';var statusDesc=[_0x2612('0x0'),_0x2612('0x1'),_0x2612('0x2'),_0x2612('0x3'),_0x2612('0x4'),_0x2612('0x5'),_0x2612('0x6'),_0x2612('0x7'),_0x2612('0x8')];var monitorFormat={'wav':_0x2612('0x9'),'wav49':_0x2612('0xa'),'gsm':'gsm'};var strategy={'rrmemory':_0x2612('0xb'),'roundrobin':_0x2612('0xc')};function VoiceQueue(_0x4886c9){this['id']=_0x4886c9['id']||0x0;this[_0x2612('0xd')]=_0x4886c9[_0x2612('0xd')]||'';this[_0x2612('0xe')]=_0x4886c9[_0x2612('0xe')]||'';this['type']=_0x4886c9[_0x2612('0xf')]||_0x2612('0x10');this['waiting']=0x0;this[_0x2612('0x11')]=0x0;this[_0x2612('0x12')]=0x0;this['answered']=0x0;this[_0x2612('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0x2612('0x14')]=0x0;this[_0x2612('0x15')]=0x0;this[_0x2612('0x16')]=0x0;this[_0x2612('0x17')]=0x0;this['available']=0x0;this['acw']=_0x4886c9[_0x2612('0x18')]||![];this['acwTimeout']=_0x4886c9[_0x2612('0x19')]||0xa;this[_0x2612('0x1a')]=_0x4886c9['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x2612('0x1b')]=0x0;this[_0x2612('0x1c')]=0x0;this[_0x2612('0x1d')]=_0x4886c9[_0x2612('0x1d')]||null;this[_0x2612('0x1e')]=_0x4886c9['dialGlobalInterval']?_0x4886c9[_0x2612('0x1e')]:null;this['dialActive']=_0x4886c9['dialActive'];this[_0x2612('0x1f')]=_0x4886c9[_0x2612('0x1f')]||_0x2612('0x20');this[_0x2612('0x21')]=_0x4886c9['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x4886c9[_0x2612('0x22')]||0x0;this[_0x2612('0x23')]=_0x4886c9[_0x2612('0x23')]||0x1;this[_0x2612('0x24')]=_0x4886c9[_0x2612('0x24')]||_0x2612('0x25');this[_0x2612('0x26')]=_0x4886c9[_0x2612('0x26')]||0.03;this[_0x2612('0x27')]=_0x4886c9[_0x2612('0x27')]||0x258;this['dialOriginateCallerIdName']=_0x4886c9[_0x2612('0x28')]||_0x2612('0x29');this[_0x2612('0x2a')]=_0x4886c9[_0x2612('0x2a')]||_0x2612('0x29');this[_0x2612('0x2b')]=_0x4886c9[_0x2612('0x2b')]||0x1e;this[_0x2612('0x2c')]=_0x4886c9[_0x2612('0x2c')]||'tTxX';this[_0x2612('0x2d')]=_0x4886c9['dialQueueTimeout']||0x3;this[_0x2612('0x2e')]=_0x4886c9[_0x2612('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x4886c9[_0x2612('0x2f')]||0x3;this[_0x2612('0x30')]=_0x4886c9[_0x2612('0x30')]||0x96;this[_0x2612('0x31')]=_0x4886c9[_0x2612('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x4886c9[_0x2612('0x32')]||0x96;this[_0x2612('0x33')]=_0x4886c9[_0x2612('0x33')]||0x3;this[_0x2612('0x34')]=_0x4886c9[_0x2612('0x34')]||0x96;this[_0x2612('0x35')]=_0x4886c9['dialNoSuchNumberMaxRetry']||0x3;this[_0x2612('0x36')]=_0x4886c9['dialNoSuchNumberRetryFrequency']||0x96;this[_0x2612('0x37')]=_0x4886c9['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x4886c9[_0x2612('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x4886c9[_0x2612('0x39')]||0x3;this[_0x2612('0x3a')]=_0x4886c9[_0x2612('0x3a')]||0x96;this[_0x2612('0x3b')]=_0x4886c9[_0x2612('0x3b')]||0x3;this[_0x2612('0x3c')]=_0x4886c9[_0x2612('0x3c')]||0x96;this[_0x2612('0x3d')]=_0x4886c9['dialAgentRejectMaxRetry']||0x3;this[_0x2612('0x3e')]=_0x4886c9[_0x2612('0x3e')]||0x96;this[_0x2612('0x3f')]=_0x4886c9[_0x2612('0x3f')]||0x3;this[_0x2612('0x40')]=_0x4886c9[_0x2612('0x40')]||0x4;this['Trunk']=_0x4886c9[_0x2612('0x41')]?_0x4886c9[_0x2612('0x41')]:undefined;this[_0x2612('0x42')]=_0x4886c9['TrunkBackup']?_0x4886c9[_0x2612('0x42')]:undefined;this[_0x2612('0x43')]=_0x4886c9['dialPrefix']||undefined;this[_0x2612('0x44')]=_0x4886c9[_0x2612('0x44')]?_0x4886c9['Interval']:undefined;this[_0x2612('0x45')]=_0x4886c9['dialOrderByScheduledAt']||_0x2612('0x46');this[_0x2612('0x47')]=_0x4886c9[_0x2612('0x47')]||undefined;this[_0x2612('0x48')]=_0x4886c9[_0x2612('0x48')]||undefined;this[_0x2612('0x49')]=strategy[_0x4886c9[_0x2612('0x49')]]||_0x2612('0xb');this['queueStatusComplete']=!![];this['dialAMDActive']=_0x4886c9[_0x2612('0x4a')]||![];this[_0x2612('0x4b')]=_0x4886c9[_0x2612('0x4b')];this[_0x2612('0x4c')]=_0x4886c9[_0x2612('0x4c')];this[_0x2612('0x4d')]=_0x4886c9[_0x2612('0x4d')];this['dialAMDTotalAnalysisTime']=_0x4886c9['dialAMDTotalAnalysisTime'];this[_0x2612('0x4e')]=_0x4886c9[_0x2612('0x4e')];this[_0x2612('0x4f')]=_0x4886c9[_0x2612('0x4f')];this[_0x2612('0x50')]=_0x4886c9[_0x2612('0x50')];this['dialAMDSilenceThreshold']=_0x4886c9[_0x2612('0x51')];this[_0x2612('0x52')]=_0x4886c9[_0x2612('0x52')];this[_0x2612('0x53')]=0x0;this[_0x2612('0x54')]=0x0;this[_0x2612('0x55')]=_0x4886c9['timeout'];this[_0x2612('0x56')]=0x0;this[_0x2612('0x57')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x2612('0x58')]=0x0;this[_0x2612('0x59')]=0x0;this[_0x2612('0x5a')]=0x0;this[_0x2612('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2612('0x5c')]=0x0;this[_0x2612('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2612('0x5e')]=0x0;this[_0x2612('0x5f')]=0x0;this['startProgressive']=undefined;this[_0x2612('0x60')]=undefined;this[_0x2612('0x61')]=undefined;this[_0x2612('0x62')]=1.05;this[_0x2612('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x2612('0x64')]=0x0;this[_0x2612('0x65')]=0x0;this[_0x2612('0x66')]=0x0;this[_0x2612('0x67')]=0x0;this[_0x2612('0x68')]=0x0;this[_0x2612('0x69')]=0x0;this[_0x2612('0x6a')]=_0x4886c9[_0x2612('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x4886c9[_0x2612('0x6b')]||0xa;this[_0x2612('0x6c')]=0x0;this[_0x2612('0x6d')]=0x0;this[_0x2612('0x6e')]=0x1;this[_0x2612('0x6f')]=0x0;this[_0x2612('0x70')]=0x0;this[_0x2612('0x71')]=0x0;this[_0x2612('0x72')]=0x0;this[_0x2612('0x73')]=_0x4886c9[_0x2612('0x73')]||0x1e;this[_0x2612('0x74')]=_0x4886c9[_0x2612('0x74')]||![];this['dialPreviewAutoRecallMe']=!!_0x4886c9[_0x2612('0x75')]||![];this[_0x2612('0x76')]=!!_0x4886c9[_0x2612('0x76')]||![];this[_0x2612('0x77')]=_0x4886c9[_0x2612('0x77')]||undefined;this[_0x2612('0x78')]=_0x4886c9[_0x2612('0x78')]||![];this['dialAgiAfterHangupAgent']=_0x4886c9[_0x2612('0x79')]||![];this[_0x2612('0xe')]=monitorFormat[_0x4886c9[_0x2612('0xe')]]?monitorFormat[_0x4886c9[_0x2612('0xe')]]:undefined;this[_0x2612('0x7a')]=_0x4886c9[_0x2612('0x7a')]||![];this['mandatoryDispositionPause']=_0x4886c9[_0x2612('0x7b')]?_0x4886c9[_0x2612('0x7b')]:undefined;}module[_0x2612('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5c18ff7..47995d5 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 _0x3162=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x38b97b,_0x515d2e){var _0x316eb4=function(_0x2a1b9f){while(--_0x2a1b9f){_0x38b97b['push'](_0x38b97b['shift']());}};_0x316eb4(++_0x515d2e);}(_0x3162,0xa8));var _0x2316=function(_0x5e8602,_0x2ce012){_0x5e8602=_0x5e8602-0x0;var _0x4434fb=_0x3162[_0x5e8602];return _0x4434fb;};'use strict';function VtigerAccount(_0x158868){this['id']=_0x158868['id']||0x0;this[_0x2316('0x0')]=_0x158868[_0x2316('0x0')]||'';this[_0x2316('0x1')]=_0x158868[_0x2316('0x1')]||'';this[_0x2316('0x2')]=_0x158868[_0x2316('0x2')]||'';this['remoteUri']=_0x158868[_0x2316('0x3')]||'';this['serverUrl']=_0x158868[_0x2316('0x4')]||'';this[_0x2316('0x5')]=_0x158868[_0x2316('0x5')]||{};}module[_0x2316('0x6')]=VtigerAccount; \ No newline at end of file +var _0x626d=['exports','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x619bb,_0x3fe7ab){var _0x3e2e82=function(_0xc58ad){while(--_0xc58ad){_0x619bb['push'](_0x619bb['shift']());}};_0x3e2e82(++_0x3fe7ab);}(_0x626d,0x15f));var _0xd626=function(_0x3a5bd3,_0x29696b){_0x3a5bd3=_0x3a5bd3-0x0;var _0x57cb99=_0x626d[_0x3a5bd3];return _0x57cb99;};'use strict';function VtigerAccount(_0x2db6f0){this['id']=_0x2db6f0['id']||0x0;this['name']=_0x2db6f0['name']||'';this['username']=_0x2db6f0['username']||'';this[_0xd626('0x0')]=_0x2db6f0['accessKey']||'';this['remoteUri']=_0x2db6f0[_0xd626('0x1')]||'';this[_0xd626('0x2')]=_0x2db6f0[_0xd626('0x2')]||'';this['Configurations']=_0x2db6f0[_0xd626('0x3')]||{};}module[_0xd626('0x4')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 091ef3d..1b28281 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 _0xaa0d=['name','username','password','token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xaa0d,0xf0));var _0xdaa0=function(_0x1e1ddb,_0x396f7a){_0x1e1ddb=_0x1e1ddb-0x0;var _0x1defb3=_0xaa0d[_0x1e1ddb];return _0x1defb3;};'use strict';function ZendeskAccount(_0x176967){this['id']=_0x176967['id']||0x0;this['name']=_0x176967[_0xdaa0('0x0')]||'';this[_0xdaa0('0x1')]=_0x176967[_0xdaa0('0x1')]||'';this[_0xdaa0('0x2')]=_0x176967[_0xdaa0('0x2')]||'';this['token']=_0x176967[_0xdaa0('0x3')]||'';this[_0xdaa0('0x4')]=_0x176967['remoteUri']||'';this[_0xdaa0('0x5')]=_0x176967[_0xdaa0('0x5')]||'';this['type']=_0x176967['type']||_0xdaa0('0x6');this[_0xdaa0('0x7')]=_0x176967[_0xdaa0('0x7')]||'';this['Configurations']=_0x176967[_0xdaa0('0x8')]||{};}module[_0xdaa0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x90ed=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x59b0c3,_0x37b575){var _0x402c21=function(_0x3570e6){while(--_0x3570e6){_0x59b0c3['push'](_0x59b0c3['shift']());}};_0x402c21(++_0x37b575);}(_0x90ed,0x8b));var _0xd90e=function(_0x164383,_0x14c550){_0x164383=_0x164383-0x0;var _0x3f1f76=_0x90ed[_0x164383];return _0x3f1f76;};'use strict';function ZendeskAccount(_0x54452c){this['id']=_0x54452c['id']||0x0;this['name']=_0x54452c[_0xd90e('0x0')]||'';this['username']=_0x54452c[_0xd90e('0x1')]||'';this[_0xd90e('0x2')]=_0x54452c[_0xd90e('0x2')]||'';this[_0xd90e('0x3')]=_0x54452c['token']||'';this[_0xd90e('0x4')]=_0x54452c[_0xd90e('0x4')]||'';this[_0xd90e('0x5')]=_0x54452c[_0xd90e('0x5')]||'';this[_0xd90e('0x6')]=_0x54452c['type']||_0xd90e('0x7');this[_0xd90e('0x8')]=_0x54452c[_0xd90e('0x8')]||'';this[_0xd90e('0x9')]=_0x54452c[_0xd90e('0x9')]||{};}module[_0xd90e('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 4d2f4b8..5a92d1e 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 _0x4716=['code','refreshToken','Configurations','exports','name','description','zone','clientId','serverUrl'];(function(_0x30d637,_0x198847){var _0x101b47=function(_0x2c24c6){while(--_0x2c24c6){_0x30d637['push'](_0x30d637['shift']());}};_0x101b47(++_0x198847);}(_0x4716,0x13f));var _0x6471=function(_0x45e56c,_0x4235d0){_0x45e56c=_0x45e56c-0x0;var _0x4826ef=_0x4716[_0x45e56c];return _0x4826ef;};'use strict';function ZohoAccount(_0x23a4ff){this['id']=_0x23a4ff['id']||0x0;this[_0x6471('0x0')]=_0x23a4ff[_0x6471('0x0')]||'';this[_0x6471('0x1')]=_0x23a4ff[_0x6471('0x1')]||'';this['host']=_0x23a4ff['host']||'';this[_0x6471('0x2')]=_0x23a4ff[_0x6471('0x2')]||'';this[_0x6471('0x3')]=_0x23a4ff['clientId']||'';this['clientSecret']=_0x23a4ff['clientSecret']||'';this['serverUrl']=_0x23a4ff[_0x6471('0x4')]||'';this[_0x6471('0x5')]=_0x23a4ff['code']||'';this[_0x6471('0x6')]=_0x23a4ff['refreshToken']||'';this[_0x6471('0x7')]=_0x23a4ff[_0x6471('0x7')]||{};}module[_0x6471('0x8')]=ZohoAccount; \ No newline at end of file +var _0xe848=['zone','clientSecret','serverUrl','code','refreshToken','Configurations','exports','description'];(function(_0x3dfb30,_0x698294){var _0x5f2fe6=function(_0x164ba1){while(--_0x164ba1){_0x3dfb30['push'](_0x3dfb30['shift']());}};_0x5f2fe6(++_0x698294);}(_0xe848,0xdf));var _0x8e84=function(_0x239297,_0x22664e){_0x239297=_0x239297-0x0;var _0x196c95=_0xe848[_0x239297];return _0x196c95;};'use strict';function ZohoAccount(_0x1bb330){this['id']=_0x1bb330['id']||0x0;this['name']=_0x1bb330['name']||'';this[_0x8e84('0x0')]=_0x1bb330['description']||'';this['host']=_0x1bb330['host']||'';this[_0x8e84('0x1')]=_0x1bb330[_0x8e84('0x1')]||'';this['clientId']=_0x1bb330['clientId']||'';this[_0x8e84('0x2')]=_0x1bb330[_0x8e84('0x2')]||'';this[_0x8e84('0x3')]=_0x1bb330[_0x8e84('0x3')]||'';this[_0x8e84('0x4')]=_0x1bb330[_0x8e84('0x4')]||'';this[_0x8e84('0x5')]=_0x1bb330[_0x8e84('0x5')]||'';this[_0x8e84('0x6')]=_0x1bb330[_0x8e84('0x6')]||{};}module[_0x8e84('0x7')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7678499..17ef93b 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 _0x3266=['callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','callback'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x3266,0x6a));var _0x6326=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x3266[_0x2642cb];return _0xe6e41;};'use strict';var util=require(_0x6326('0x0'));var _=require(_0x6326('0x1'));var moment=require(_0x6326('0x2'));function checkNameSurname(_0x2bed83,_0x545df7,_0x6b67c0){var _0x29aef3='';if(!_[_0x6326('0x3')](_0x545df7)&&_0x6326('0x4')===typeof _0x545df7){_0x29aef3+=_0x545df7;}if(!_['isNil'](_0x6b67c0)&&_0x6326('0x4')===typeof _0x6b67c0){_0x29aef3+='\x20'+_0x6b67c0;}if(_0x29aef3!==''){return _0x29aef3;}return _0x2bed83;}function Action(_0x5f38a3,_0x25ecd8,_0x44460c,_0x14208e,_0x5402e5){this[_0x6326('0x5')]=_0x44460c||undefined;this['idContact']=_0x5f38a3['id'];this[_0x6326('0x6')]=_0x25ecd8[_0x6326('0x7')];this[_0x6326('0x8')]=_0x25ecd8[_0x6326('0x8')];this[_0x6326('0x9')]='queue';this[_0x6326('0xa')]=![];this[_0x6326('0xb')]=_[_0x6326('0x3')](_0x5f38a3[_0x6326('0xc')])?undefined:_0x5f38a3[_0x6326('0xc')][_0x6326('0x7')];this[_0x6326('0xd')]=this[_0x6326('0xb')]?util[_0x6326('0xe')](_0x6326('0xf'),this['membername']):_0x14208e||undefined;this['calleridname']=checkNameSurname(_0x5f38a3[_0x6326('0x10')][_0x6326('0x11')],_0x5f38a3['Contact'][_0x6326('0x12')],_0x5f38a3['Contact'][_0x6326('0x13')]);this[_0x6326('0x14')]=_0x5f38a3[_0x6326('0x14')]||![];this[_0x6326('0x15')]=_0x5f38a3[_0x6326('0x11')];this[_0x6326('0x16')]=_0x5f38a3['scheduledat'];this[_0x6326('0x17')]=_0x5f38a3['countbusyretry']||0x0;this['countcongestionretry']=_0x5f38a3['countcongestionretry']||0x0;this['countnoanswerretry']=_0x5f38a3['countnoanswerretry']||0x0;this['countglobal']=(_0x5f38a3[_0x6326('0x17')]||0x0)+(_0x5f38a3[_0x6326('0x18')]||0x0)+(_0x5f38a3[_0x6326('0x19')]||0x0)+(_0x5f38a3['countnosuchnumberretry']||0x0)+(_0x5f38a3['countdropretry']||0x0)+(_0x5f38a3[_0x6326('0x1a')]||0x0)+(_0x5f38a3[_0x6326('0x1b')]||0x0)+(_0x5f38a3[_0x6326('0x1c')]||0x0);this[_0x6326('0x1d')]=_0x5f38a3[_0x6326('0x1d')]||0x0;this[_0x6326('0x1e')]=_0x5f38a3[_0x6326('0x1e')]||0x0;this['countabandonedretry']=_0x5f38a3[_0x6326('0x1a')]||0x0;this['countmachineretry']=_0x5f38a3[_0x6326('0x1b')]||0x0;this[_0x6326('0x1c')]=_0x5f38a3[_0x6326('0x1c')]||0x0;this[_0x6326('0x1f')]=_0x5f38a3[_0x6326('0x1f')];this[_0x6326('0x20')]=_0x5f38a3[_0x6326('0x20')];this[_0x6326('0x21')]=_0x5f38a3[_0x6326('0x21')];this[_0x6326('0x22')]=_0x5f38a3[_0x6326('0x22')];this['ContactId']=_0x5f38a3[_0x6326('0x23')];this[_0x6326('0x24')]=_0x5f38a3['ListId'];this['UserId']=_['isNil'](_0x5f38a3[_0x6326('0xc')])?_0x5f38a3['UserId']:_0x5f38a3[_0x6326('0xc')]['id'];this[_0x6326('0x25')]=_0x5f38a3['VoiceQueueId'];this[_0x6326('0x26')]='';this[_0x6326('0x27')]='';}Action[_0x6326('0x28')][_0x6326('0x29')]=function(){return util[_0x6326('0xe')](_0x6326('0x2a'),this[_0x6326('0x2b')],this[_0x6326('0x2c')]);};module[_0x6326('0x2d')]=Action; \ No newline at end of file +var _0x4325=['type','membername','Agent','format','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','util','lodash','string','isNil','idContact','queue','name'];(function(_0x330d8e,_0x2dd774){var _0x503e0d=function(_0x37110a){while(--_0x37110a){_0x330d8e['push'](_0x330d8e['shift']());}};_0x503e0d(++_0x2dd774);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0x5432('0x0'));var _=require(_0x5432('0x1'));var moment=require('moment');function checkNameSurname(_0x3f491f,_0x533c92,_0x12c8d8){var _0x480fb7='';if(!_['isNil'](_0x533c92)&&_0x5432('0x2')===typeof _0x533c92){_0x480fb7+=_0x533c92;}if(!_[_0x5432('0x3')](_0x12c8d8)&&_0x5432('0x2')===typeof _0x12c8d8){_0x480fb7+='\x20'+_0x12c8d8;}if(_0x480fb7!==''){return _0x480fb7;}return _0x3f491f;}function Action(_0x4acbe4,_0x209e2e,_0xbb0075,_0x4a6e76,_0x106ec9){this['uniqueid']=_0xbb0075||undefined;this[_0x5432('0x4')]=_0x4acbe4['id'];this[_0x5432('0x5')]=_0x209e2e[_0x5432('0x6')];this[_0x5432('0x7')]=_0x209e2e[_0x5432('0x7')];this['campaigntype']=_0x5432('0x5');this['dialAnswer']=![];this[_0x5432('0x8')]=_[_0x5432('0x3')](_0x4acbe4[_0x5432('0x9')])?undefined:_0x4acbe4[_0x5432('0x9')]['name'];this['channelAgent']=this[_0x5432('0x8')]?util[_0x5432('0xa')]('SIP/%s',this[_0x5432('0x8')]):_0x4a6e76||undefined;this[_0x5432('0xb')]=checkNameSurname(_0x4acbe4[_0x5432('0xc')][_0x5432('0xd')],_0x4acbe4[_0x5432('0xc')][_0x5432('0xe')],_0x4acbe4['Contact']['lastName']);this[_0x5432('0xf')]=_0x4acbe4[_0x5432('0xf')]||![];this[_0x5432('0x10')]=_0x4acbe4[_0x5432('0xd')];this[_0x5432('0x11')]=_0x4acbe4[_0x5432('0x11')];this['countbusyretry']=_0x4acbe4[_0x5432('0x12')]||0x0;this['countcongestionretry']=_0x4acbe4[_0x5432('0x13')]||0x0;this[_0x5432('0x14')]=_0x4acbe4[_0x5432('0x14')]||0x0;this[_0x5432('0x15')]=(_0x4acbe4[_0x5432('0x12')]||0x0)+(_0x4acbe4['countcongestionretry']||0x0)+(_0x4acbe4[_0x5432('0x14')]||0x0)+(_0x4acbe4[_0x5432('0x16')]||0x0)+(_0x4acbe4[_0x5432('0x17')]||0x0)+(_0x4acbe4[_0x5432('0x18')]||0x0)+(_0x4acbe4[_0x5432('0x19')]||0x0)+(_0x4acbe4[_0x5432('0x1a')]||0x0);this[_0x5432('0x16')]=_0x4acbe4['countnosuchnumberretry']||0x0;this[_0x5432('0x17')]=_0x4acbe4[_0x5432('0x17')]||0x0;this[_0x5432('0x18')]=_0x4acbe4[_0x5432('0x18')]||0x0;this[_0x5432('0x19')]=_0x4acbe4['countmachineretry']||0x0;this['countagentrejectretry']=_0x4acbe4['countagentrejectretry']||0x0;this[_0x5432('0x1b')]=_0x4acbe4[_0x5432('0x1b')];this[_0x5432('0x1c')]=_0x4acbe4[_0x5432('0x1c')];this['callbackat']=_0x4acbe4['callbackat'];this[_0x5432('0x1d')]=_0x4acbe4[_0x5432('0x1d')];this['ContactId']=_0x4acbe4[_0x5432('0x1e')];this[_0x5432('0x1f')]=_0x4acbe4[_0x5432('0x1f')];this['UserId']=_[_0x5432('0x3')](_0x4acbe4[_0x5432('0x9')])?_0x4acbe4[_0x5432('0x20')]:_0x4acbe4['Agent']['id'];this['VoiceQueueId']=_0x4acbe4[_0x5432('0x21')];this[_0x5432('0x22')]='';this['originatecalleridname']='';}Action[_0x5432('0x23')][_0x5432('0x24')]=function(){return util[_0x5432('0xa')]('\x22%s\x22\x20<%s>',this[_0x5432('0xb')],this['number']);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index d16dc54..83e6eff 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 _0x8477=['outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','Interval','stringify','md5','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','info','[action]','size','clearZombieChannel','length','getDiff','scheduledat','Agent','[RecallMe]','logger2','disableContact','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','then','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[callProgressDetectingCustomer][logAnswer]','talktime','uniqueid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','activeContact','incrementPreviewCounters','swapAdditionalPhones','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','\x20Queue','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','called','Calling','[Preview][execCall][failure]','Call\x20failed','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','VoiceQueueId','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','substring','dialCutDigit','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','extractCalleridNumber','addVariables','starttime','variables','Action','[originated][increment]','actionid','logLookAgent','clone','isFailure','rejected','callProgressDetectingAgent','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','syncHangupRequest','addVariable','filterKey','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS'];(function(_0x542195,_0x45dba2){var _0x150ba8=function(_0x961a6d){while(--_0x961a6d){_0x542195['push'](_0x542195['shift']());}};_0x150ba8(++_0x45dba2);}(_0x8477,0x112));var _0x7847=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0x8477[_0x386b03];return _0xd3d524;};'use strict';var util=require(_0x7847('0x0'));var _=require(_0x7847('0x1'));var uuid=require('uuid');var moment=require(_0x7847('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x7847('0x3'));var logger=require(_0x7847('0x4'))(_0x7847('0x5'));var loggerAction=require('../../../config/logger')(_0x7847('0x6'));var ami=require('../ami');var rpcDb=require(_0x7847('0x7'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x7847('0x8'));var ut=require('./util/util');config['redis']=_[_0x7847('0x9')](config[_0x7847('0xa')],{'host':_0x7847('0xb'),'port':0x18eb});var io=require(_0x7847('0xc'))(new Redis(config[_0x7847('0xa')]));var Sequence=function(){};Sequence[_0x7847('0xd')][_0x7847('0xe')]=function(_0x5a454d){this[_0x7847('0xf')]=this[_0x7847('0xf')]?this[_0x7847('0xf')][_0x7847('0x10')](_0x5a454d):_0x5a454d();};function Preview(_0x510325){this[_0x7847('0x11')]=new Sequence();this[_0x7847('0x12')]=_0x510325[_0x7847('0x13')];this[_0x7847('0x14')]=_0x510325[_0x7847('0x14')];this[_0x7847('0x15')]={};this['agents']=_0x510325[_0x7847('0x16')];this[_0x7847('0x17')]=0x0;ami['on'](_0x7847('0x18'),this[_0x7847('0x19')][_0x7847('0x1a')](this));ami['on']('hangup',this[_0x7847('0x1b')][_0x7847('0x1a')](this));ami['on'](_0x7847('0x1c'),this['syncHangupRequest'][_0x7847('0x1a')](this));ami['on'](_0x7847('0x1d'),this[_0x7847('0x1e')][_0x7847('0x1a')](this));ami['on'](_0x7847('0x1f'),this[_0x7847('0x20')][_0x7847('0x1a')](this));ami['on']('varset',this[_0x7847('0x21')][_0x7847('0x1a')](this));ami['on']('attendedtransfer',this[_0x7847('0x22')]['bind'](this));ami['on']('blindtransfer',this[_0x7847('0x23')][_0x7847('0x1a')](this));this[_0x7847('0x24')](this[_0x7847('0x12')]);}function emit(_0x3d7867,_0x472ae2,_0x3a3ec7){io['to'](_0x3d7867)[_0x7847('0x25')](_0x472ae2,_0x3a3ec7);}function emitCampaignPreview(_0x48e7e1){if(_0x48e7e1[_0x7847('0x26')]==='outbound'){var _0x3c030b={'id':_0x48e7e1['id'],'name':_0x48e7e1[_0x7847('0x27')],'strategy':_0x48e7e1[_0x7847('0x28')],'answered':_0x48e7e1[_0x7847('0x29')],'available':_0x48e7e1[_0x7847('0x2a')],'loggedIn':_0x48e7e1[_0x7847('0x2b')],'pTalking':_0x48e7e1[_0x7847('0x2c')],'sumBillable':_0x48e7e1[_0x7847('0x2d')],'sumDuration':_0x48e7e1[_0x7847('0x2e')],'sumHoldTime':_0x48e7e1[_0x7847('0x2f')]||0x0,'talking':_0x48e7e1[_0x7847('0x30')],'total':_0x48e7e1[_0x7847('0x31')],'type':_0x48e7e1[_0x7847('0x26')],'unmanaged':_0x48e7e1[_0x7847('0x32')],'abandoned':_0x48e7e1[_0x7847('0x33')],'waiting':_0x48e7e1[_0x7847('0x34')],'loggedInDb':_0x48e7e1[_0x7847('0x35')],'dialActive':_0x48e7e1[_0x7847('0x36')],'dialMethod':_0x48e7e1[_0x7847('0x37')],'dialOriginateCallerIdName':_0x48e7e1[_0x7847('0x38')],'dialOriginateCallerIdNumber':_0x48e7e1[_0x7847('0x39')],'dialOriginateTimeout':_0x48e7e1[_0x7847('0x3a')],'dialPrefix':_0x48e7e1[_0x7847('0x3b')],'outboundAnswerAgiCallsDay':_0x48e7e1[_0x7847('0x3c')],'outboundAnswerCallsDay':_0x48e7e1[_0x7847('0x3d')],'outboundBlacklistCallsDay':_0x48e7e1[_0x7847('0x3e')],'outboundBusyCallsDay':_0x48e7e1['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x48e7e1[_0x7847('0x3f')],'outboundDropCallsDayACS':_0x48e7e1[_0x7847('0x40')],'outboundDropCallsDayCallersExit':_0x48e7e1[_0x7847('0x41')],'outboundDropCallsDayTimeout':_0x48e7e1[_0x7847('0x42')],'outboundNoAnswerCallsDay':_0x48e7e1[_0x7847('0x43')],'outboundNoSuchCallsDay':_0x48e7e1[_0x7847('0x44')],'outboundOriginateFailureCallsDay':_0x48e7e1['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x48e7e1['outboundReCallsDay'],'outboundRejectCallsDay':_0x48e7e1['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x48e7e1[_0x7847('0x45')],'outboundAbandonedCallsDay':_0x48e7e1[_0x7847('0x46')],'predictiveIntervalAnsweredCalls':_0x48e7e1[_0x7847('0x47')],'predictiveIntervalAvgHoldtime':_0x48e7e1[_0x7847('0x48')],'predictiveIntervalAvgTalktime':_0x48e7e1['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x48e7e1[_0x7847('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x48e7e1['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x48e7e1['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x48e7e1[_0x7847('0x4a')],'predictiveIntervalHitRate':_0x48e7e1[_0x7847('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x48e7e1[_0x7847('0x4c')],'predictiveIntervalPauses':_0x48e7e1['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x48e7e1[_0x7847('0x4d')],'predictiveIntervalTotalCalls':_0x48e7e1[_0x7847('0x4e')],'message':_0x48e7e1[_0x7847('0x4f')],'originated':_0x48e7e1['originated'],'erlangCalls':_0x48e7e1[_0x7847('0x50')],'erlangCallToSecond':_0x48e7e1[_0x7847('0x51')],'erlangAbandonmentRate':_0x48e7e1[_0x7847('0x52')],'erlangBusyFactor':_0x48e7e1[_0x7847('0x53')],'startPredictive':_0x48e7e1['startPredictive'],'startProgressive':_0x48e7e1[_0x7847('0x54')]};if(_0x48e7e1['Trunk']){_0x3c030b[_0x7847('0x55')]={'id':_0x48e7e1[_0x7847('0x55')]['id'],'name':_0x48e7e1[_0x7847('0x55')][_0x7847('0x27')],'active':_0x48e7e1[_0x7847('0x55')]['active'],'callerid':_0x48e7e1['Trunk']['callerid']};}if(_0x48e7e1[_0x7847('0x56')]){_0x3c030b['Interval']={'id':_0x48e7e1[_0x7847('0x56')]['id'],'name':_0x48e7e1[_0x7847('0x56')][_0x7847('0x27')]};}var _0x101aaa=md5(JSON[_0x7847('0x57')](_0x3c030b));if(_0x48e7e1[_0x7847('0x58')]!==_0x101aaa){_0x48e7e1['md5']=_0x101aaa;emit(util['format'](_0x7847('0x59'),_0x3c030b[_0x7847('0x27')]),_0x7847('0x5a'),_0x3c030b);}}}function emitVoiceQueueChannelRemove(_0x28097c){logger['info'](_0x7847('0x5b'),JSON[_0x7847('0x57')](_0x28097c));emit(util['format'](_0x7847('0x59'),_0x28097c[_0x7847('0x27')]),_0x7847('0x5c'),_0x28097c);io[_0x7847('0x25')](_0x7847('0x5d'),_0x28097c);}function notSendMessagesQueue(_0xc8169e){if(_0xc8169e[_0x7847('0x5e')]){if(_0xc8169e[_0x7847('0x5f')]===0x0&&_0xc8169e[_0x7847('0x2c')]===0x0){_0xc8169e['sendMessageOneNotActive']=![];_0xc8169e['available']=0x0;_0xc8169e['paused']=0x0;_0xc8169e[_0x7847('0x4f')]=_0x7847('0x60');ut[_0x7847('0x61')](_0x7847('0x62'),_0xc8169e[_0x7847('0x27')]+'\x20is\x20not\x20active');}else{_0xc8169e['message']='DEACTIVATED';ut[_0x7847('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xc8169e[_0x7847('0x27')]+'\x20is\x20deactivated');}emitCampaignPreview(_0xc8169e);}}Preview[_0x7847('0xd')][_0x7847('0x24')]=function(){var _0x1fd253=this;setInterval(function(){_0x1fd253[_0x7847('0x63')]();},0x7cf);};Preview['prototype'][_0x7847('0x63')]=function(){var _0x461b7d=this['campaignsPreview'];this[_0x7847('0x17')]+=0x1;for(var _0x4585be in _0x461b7d){if(_0x461b7d[_0x7847('0x64')](_0x4585be)&&(_0x461b7d[_0x4585be]['dialMethod']===_0x7847('0x5')||_0x461b7d[_0x4585be]['dialMethod']===_0x7847('0x65'))&&_0x461b7d[_0x4585be][_0x7847('0x26')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x7847('0x66')]();}}if(_0x461b7d[_0x7847('0x64')](_0x4585be)&&_0x461b7d[_0x4585be][_0x7847('0x37')]===_0x7847('0x5')&&_0x461b7d[_0x4585be]['type']===_0x7847('0x67')){if(_0x461b7d[_0x4585be][_0x7847('0x36')]){this[_0x7847('0x68')](_0x461b7d[_0x4585be]);if(_0x461b7d[_0x4585be][_0x7847('0x69')])this[_0x7847('0x6a')](_0x461b7d[_0x4585be]);}else{notSendMessagesQueue(_0x461b7d[_0x4585be]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x26c239){var _0x3d2aec=this;this['sequence'][_0x7847('0xe')](function(){if(!_[_0x7847('0x6b')](_0x3d2aec[_0x7847('0x15')][_0x26c239])){loggerAction['info']('[clearZombieChannels][talking]',_0x26c239,_0x7847('0x6c'),_0x3d2aec['actions'][_0x26c239][_0x7847('0x6d')],_0x7847('0x6e'),JSON[_0x7847('0x57')](_0x3d2aec[_0x7847('0x12')][_0x3d2aec['actions'][_0x26c239]['queue']][_0x7847('0x5f')]),'pTalking:\x20',JSON['stringify'](_0x3d2aec[_0x7847('0x12')][_0x3d2aec[_0x7847('0x15')][_0x26c239][_0x7847('0x6d')]][_0x7847('0x2c')]),JSON[_0x7847('0x57')](_0x3d2aec[_0x7847('0x15')][_0x26c239][_0x7847('0x6f')]),JSON[_0x7847('0x57')](_[_0x7847('0x70')](_0x3d2aec['actions'][_0x26c239],[_0x7847('0x71'),_0x7847('0x72'),'VoiceQueueId',_0x7847('0x73')])));return ami['Action']({'action':_0x7847('0x74'),'channel':_0x3d2aec[_0x7847('0x15')][_0x26c239][_0x7847('0x75')]})[_0x7847('0x76')](function(_0x16620e){if(_0x16620e[_0x7847('0x4f')]===_0x7847('0x77')){setTimeout(function(){if(_0x3d2aec['actions'][_0x26c239]){ut['updateOriginated'](_0x3d2aec['campaignsPreview'][_0x3d2aec[_0x7847('0x15')][_0x26c239]['queue']],_0x7847('0x78'));if(_0x3d2aec['actions'][_0x26c239][_0x7847('0x6f')]===!![]){ut[_0x7847('0x79')](_0x3d2aec['campaignsPreview'][_0x3d2aec['actions'][_0x26c239]['queue']],_0x7847('0x78'));ut[_0x7847('0x7a')](_0x7847('0x7b')+_0x26c239,_0x3d2aec['actions'][_0x26c239]['queue']);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x26c239,_0x3d2aec[_0x7847('0x15')][_0x26c239][_0x7847('0x6d')]);delete _0x3d2aec[_0x7847('0x15')][_0x26c239];}},0x2328);}});}});};Preview[_0x7847('0xd')]['clearZombieChannels']=function(){var _0x2ae29f=this;loggerAction[_0x7847('0x7c')](_0x7847('0x7d'),_[_0x7847('0x7e')](this[_0x7847('0x15')]));for(var _0x5c40fc in this[_0x7847('0x15')]){if(_0x2ae29f[_0x7847('0x15')]['hasOwnProperty'](_0x5c40fc)){_0x2ae29f[_0x7847('0x7f')](_0x5c40fc);}}};Preview[_0x7847('0xd')][_0x7847('0x6a')]=function(_0x49ca30){var _0x22f348=this;rpcDb['getContactRecallMe'](_0x49ca30['id'],ut['agentReadyId'](this['agents']))['then'](function(_0x2631a7){if(!_[_0x7847('0x6b')](_0x2631a7)){for(var _0x2226e4=0x0;_0x2226e4<_0x2631a7[_0x7847('0x80')];_0x2226e4+=0x1){if(ut[_0x7847('0x81')](_0x2631a7[_0x2226e4][_0x7847('0x82')])<_0x49ca30['dialRecallMeTimeout']*0x3c){if(_0x2631a7[_0x2226e4][_0x7847('0x83')]&&!_0x2631a7[_0x2226e4][_0x7847('0x83')]['voicePause']){_0x22f348['run'](_0x2631a7[_0x2226e4]['id'])['then'](ut['logger2'](_0x7847('0x84')))['catch'](ut[_0x7847('0x85')]('[RecallMe]'));}else{rpcDb[_0x7847('0x86')](_0x2631a7[_0x2226e4]['id']);}}else{var _0x2be68d=new Action(_0x2631a7[_0x2226e4],_0x49ca30);_0x2be68d['starttime']=moment()[_0x7847('0x87')](_0x7847('0x88'));_0x49ca30[_0x7847('0x89')]+=0x1;ut[_0x7847('0x8a')](_0x2be68d,0x17,_0x7847('0x8b'));if(_0x49ca30[_0x7847('0x8c')]){rpcDb[_0x7847('0x8d')](ut[_0x7847('0x8e')](_0x2631a7[_0x2226e4]));rpcDb[_0x7847('0x8f')](_0x2be68d,_0x7847('0x90'));}else{ut[_0x7847('0x8a')](_0x2be68d,0x16,_0x7847('0x91'));rpcDb[_0x7847('0x8f')](_0x2be68d,_0x7847('0x92'));rpcDb[_0x7847('0x93')](_0x2be68d,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x7847('0x85')]('[getContactRecallMe]'));};Preview[_0x7847('0xd')][_0x7847('0x68')]=function(_0x2db721){_0x2db721[_0x7847('0x5e')]=!![];if(ut[_0x7847('0x94')](_0x2db721[_0x7847('0x2b')])){_0x2db721[_0x7847('0x4f')]=_0x7847('0x95');}else if(!ut['isActive'](_0x2db721['dialActive'])){_0x2db721['message']=_0x7847('0x60');}else if(!this[_0x7847('0x96')](_0x2db721[_0x7847('0x55')])){if(!this['isTrunkReachable'](_0x2db721['TrunkBackup'])){_0x2db721[_0x7847('0x4f')]=_0x7847('0x97');}else{_0x2db721[_0x7847('0x4f')]='ACTIVE';}}else{_0x2db721[_0x7847('0x4f')]=_0x7847('0x98');}emitCampaignPreview(_0x2db721);};Preview[_0x7847('0xd')][_0x7847('0x99')]=function(_0x21b984,_0x18481c,_0xb8e5f){var _0x3fd09f=this;var _0x2c1bfc=this[_0x7847('0x15')][_0x18481c];var _0x59df92=this['campaignsPreview'][_0x2c1bfc[_0x7847('0x6d')]];var _0x21aefb;var _0x135372=![];var _0x5d8538=0x2;var _0x4403f5=0x3;if(_0x59df92){switch(_0xb8e5f){case'1':_0x59df92[_0x7847('0x44')]+=0x1;_0x2c1bfc[_0x7847('0x9a')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0x0,'NoSuchNumber');ami[_0x7847('0x25')](_0x7847('0x9d'),ut[_0x7847('0x9e')](_0x2c1bfc,_0x7847('0x9f')));rpcDb['createCustomerHistory'](_0x2c1bfc,_0x7847('0xa0'));_0x3fd09f['verifyAdditionalPhones'](_0x2c1bfc,'0',_0x59df92)[_0x7847('0xa1')](function(_0x52b7ab){_0x135372=_0x52b7ab[_0x7847('0xa2')]==0x1;_0x5d8538=_0x59df92['dialNoSuchNumberRetryFrequency'];_0x4403f5=_0x59df92[_0x7847('0xa3')];if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut['cloneAction'](_0x2c1bfc,0xf,_0x7847('0xa5'));rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xa6'));}else{if(_0x2c1bfc[_0x7847('0x9a')]>=_0x59df92['dialNoSuchNumberMaxRetry']){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xa6'));}else{rpcDb[_0x7847('0xa7')](ut[_0x7847('0xa8')](_0x2c1bfc,_0x7847('0x9a'),_0x59df92[_0x7847('0xa9')]),_0x2c1bfc['unlockAgent'],_0x2c1bfc['activeContact']);}}delete this[_0x7847('0x15')][_0x21b984[_0x7847('0xaa')]];}else{_0x2c1bfc['countnosuchnumberretry']++;logger[_0x7847('0x7c')](_0x7847('0xab'),_0x2c1bfc['countnosuchnumberretry']);logger[_0x7847('0x7c')]('id',_0x2c1bfc[_0x7847('0xac')]);_0x3fd09f['incrementPreviewCounters']({'id':_0x2c1bfc[_0x7847('0xac')],'field':{'countnosuchnumberretry':_0x2c1bfc[_0x7847('0x9a')]}})[_0x7847('0xa1')](function(){_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});break;case _0x7847('0xad'):var _0xf47ff4=moment()[_0x7847('0x87')](_0x7847('0x88'));_0x2c1bfc[_0x7847('0xae')]=_0xf47ff4;_0x2c1bfc[_0x7847('0xaf')]=_0xf47ff4;_0x2c1bfc['dialAnswer']=!![];_0x59df92[_0x7847('0x2c')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x2c1bfc['uniqueid'],'\x20Queue',_0x59df92['name'],_0x7847('0xb0'),_0x59df92['pTalking']);ami[_0x7847('0x25')](_0x7847('0xb1'),ut[_0x7847('0x9e')](_0x2c1bfc,_0x7847('0xb2'),this['campaignsPreview'][_0x2c1bfc['queue']]));if(_0x59df92[_0x7847('0xb3')]){ami[_0x7847('0x25')](_0x7847('0xb4'),ut[_0x7847('0xb5')](_0x2c1bfc));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x7847('0x9e')](_0x2c1bfc,_0x7847('0xb6'),this[_0x7847('0x12')][_0x2c1bfc['queue']]));emitVoiceQueueChannelRemove(ut[_0x7847('0x9e')](_0x2c1bfc,_0x7847('0xb6')));_0x59df92[_0x7847('0x3d')]+=0x1;_0x59df92[_0x7847('0x31')]+=0x1;_0x59df92[_0x7847('0x29')]+=0x1;ut[_0x7847('0x79')](_0x59df92,'[16]');_0x2c1bfc['countglobal']=ut[_0x7847('0x9c')](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0x4,'Answer');rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xb7'));rpcDb[_0x7847('0x93')](_0x2c1bfc,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x2c1bfc);_0x59df92[_0x7847('0x2e')]+=_0x2c1bfc[_0x7847('0xb8')];_0x59df92[_0x7847('0x2d')]+=_0x2c1bfc['talktime'];logger[_0x7847('0x7c')]('[syncHangup][talking][decrement]',_0x2c1bfc[_0x7847('0xb9')],'\x20Queue',_0x59df92[_0x7847('0x27')],_0x7847('0xb0'),_0x59df92['pTalking']);delete this[_0x7847('0x15')][_0x21b984['linkedid']];break;case _0x7847('0xba'):_0x59df92[_0x7847('0xbb')]+=0x1;_0x2c1bfc[_0x7847('0xbc')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut['totalGlobal'](_0x2c1bfc);ut['logCustomer'](_0x2c1bfc,0x5,_0x7847('0xbd'));_0x5d8538=_0x59df92['dialBusyRetryFrequency'];_0x4403f5=_0x59df92[_0x7847('0xa3')];ami[_0x7847('0x25')](_0x7847('0xbe'),ut['buildObj'](_0x2c1bfc,_0x7847('0xbf')));rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xc0'));_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'5',_0x59df92)['then'](function(_0xcce82){_0x135372=_0xcce82['additional']==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0xf,'Global');rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xc3'));}else{if(_0x2c1bfc[_0x7847('0xbc')]>=_0x59df92[_0x7847('0xc4')]){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xc0'));}else{rpcDb[_0x7847('0xa7')](ut[_0x7847('0xa8')](_0x2c1bfc,_0x7847('0xbc'),_0x59df92[_0x7847('0xc5')]),_0x2c1bfc[_0x7847('0xc6')],_0x2c1bfc[_0x7847('0xc7')]);}}}else{_0x2c1bfc[_0x7847('0xbc')]++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc['idContact'],'field':{'countbusyretry':_0x2c1bfc[_0x7847('0xbc')]}})[_0x7847('0xa1')](function(){_0x3fd09f[_0x7847('0xc9')](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});break;case'NOANSWER':_0x59df92[_0x7847('0x43')]+=0x1;_0x2c1bfc[_0x7847('0xca')]+=0x1;_0x2c1bfc['countglobal']=ut[_0x7847('0x9c')](_0x2c1bfc);ut['logCustomer'](_0x2c1bfc,0x3,_0x7847('0xcb'));_0x5d8538=_0x59df92[_0x7847('0xcc')];_0x4403f5=_0x59df92[_0x7847('0xa3')];var _0x596648=ut[_0x7847('0xcd')](_0x2c1bfc,_0x59df92);ami['emit'](_0x7847('0xce'),_0x596648);rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xcf'));_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'3',_0x59df92)['then'](function(_0x447a02){_0x135372=_0x447a02[_0x7847('0xa2')]==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0xf,_0x7847('0xa5'));rpcDb['createCustomerFinal'](_0x21aefb,_0x7847('0xd0'));}else{if(_0x2c1bfc['countnoanswerretry']>=_0x59df92[_0x7847('0xd1')]){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xcf'));}else{rpcDb[_0x7847('0xa7')](ut[_0x7847('0xa8')](_0x2c1bfc,_0x7847('0xca'),_0x59df92[_0x7847('0xcc')]),_0x2c1bfc[_0x7847('0xc6')],_0x2c1bfc[_0x7847('0xc7')]);}}}else{_0x2c1bfc[_0x7847('0xca')]++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc[_0x7847('0xac')],'field':{'countnoanswerretry':_0x2c1bfc[_0x7847('0xca')]}})[_0x7847('0xa1')](function(){_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});break;case _0x7847('0xd2'):_0x59df92[_0x7847('0x3f')]+=0x1;_0x2c1bfc[_0x7847('0xd3')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut['totalGlobal'](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0x8,'Congestion');_0x5d8538=_0x59df92[_0x7847('0xd4')];_0x4403f5=_0x59df92['callAdditionalPhoneAfterMin'];ami['emit'](_0x7847('0xd5'),ut['buildObj'](_0x2c1bfc,_0x7847('0xd6')));rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xd7'));_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'8',_0x59df92)[_0x7847('0xa1')](function(_0x46e20a){_0x135372=_0x46e20a[_0x7847('0xa2')]==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0xf,'Global');rpcDb['createCustomerFinal'](_0x21aefb,_0x7847('0xd8'));}else{if(_0x2c1bfc['countcongestionretry']>=_0x59df92['dialCongestionMaxRetry']){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xd7'));}else{rpcDb[_0x7847('0xa7')](ut[_0x7847('0xa8')](_0x2c1bfc,_0x7847('0xd3'),_0x59df92[_0x7847('0xc5')]),_0x2c1bfc['unlockAgent'],_0x2c1bfc[_0x7847('0xc7')]);}}}else{_0x2c1bfc[_0x7847('0xd3')]++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc['idContact'],'field':{'countcongestionretry':_0x2c1bfc[_0x7847('0xd3')]}})[_0x7847('0xa1')](function(){_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});break;case'CANCEL':_0x59df92[_0x7847('0xd9')]+=0x1;_0x2c1bfc[_0x7847('0xda')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0x14,'AgentReject');_0x5d8538=_0x59df92[_0x7847('0xdb')];_0x4403f5=_0x59df92[_0x7847('0xa3')];ami[_0x7847('0x25')](_0x7847('0xdc'),ut['buildObj'](_0x2c1bfc,_0x7847('0xdd')));rpcDb[_0x7847('0x8f')](_0x2c1bfc,'[syncHangupRequest][logAgentReject]');_0x3fd09f['verifyAdditionalPhones'](_0x2c1bfc,'20',_0x59df92)[_0x7847('0xa1')](function(_0xb6fef4){_0x135372=_0xb6fef4[_0x7847('0xa2')]==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92['dialGlobalMaxRetry']){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0x14,_0x7847('0xde'));rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xdf'));}else{if(_0x2c1bfc[_0x7847('0xda')]>=_0x59df92['dialAgentRejectMaxRetry']){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xdf'));}else{rpcDb[_0x7847('0xa7')](ut['scheduledAt'](_0x2c1bfc,'countagentrejectretry',_0x59df92[_0x7847('0xdb')]),_0x2c1bfc[_0x7847('0xc6')],_0x2c1bfc[_0x7847('0xc7')]);}}}else{_0x2c1bfc[_0x7847('0xca')]++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc['idContact'],'field':{'countnoanswerretry':_0x2c1bfc[_0x7847('0xca')]}})[_0x7847('0xa1')](function(){_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)['then'](function(){});});}});break;case'ABANDONED':_0x59df92[_0x7847('0x46')]+=0x1;_0x2c1bfc[_0x7847('0xe0')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0xb,'Abandoned');rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xe1'));_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'11',_0x59df92)['then'](function(_0x345415){_0x135372=_0x345415['additional']==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92['dialGlobalMaxRetry']){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0xf,_0x7847('0xa5'));rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xe1'));}else{if(_0x2c1bfc[_0x7847('0xe2')]>=_0x59df92[_0x7847('0xe3')]){rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0x7847('0xa8')](_0x2c1bfc,_0x7847('0xe0'),_0x59df92[_0x7847('0xe4')]),_0x2c1bfc['unlockAgent'],_0x2c1bfc['activeContact']);}}}else{_0x2c1bfc['countnoanswerretry']++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc[_0x7847('0xac')],'field':{'countnoanswerretry':_0x2c1bfc['countnoanswerretry']}})[_0x7847('0xa1')](function(){_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});break;case'18':_0x59df92[_0x7847('0x45')]+=0x1;_0x2c1bfc['countmachineretry']+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut['logCustomer'](_0x2c1bfc,0x12,_0x21b984[_0x7847('0xe5')]||_0x21b984[_0x7847('0xe6')]);ami[_0x7847('0x25')](_0x7847('0xe7'),ut[_0x7847('0x9e')](_0x2c1bfc,'amd'));rpcDb[_0x7847('0x8f')](_0x2c1bfc,_0x7847('0xe8'));_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'18',_0x59df92)[_0x7847('0xa1')](function(_0x26c7de){_0x135372=_0x26c7de[_0x7847('0xa2')]==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92['dialGlobalMaxRetry']){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0x12,'Global');rpcDb['createCustomerFinal'](_0x21aefb,_0x7847('0xe8'));}else{rpcDb[_0x7847('0x93')](_0x2c1bfc,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2c1bfc['countnoanswerretry']++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc['idContact'],'field':{'countnoanswerretry':_0x2c1bfc[_0x7847('0xca')]}})[_0x7847('0xa1')](function(){_0x3fd09f[_0x7847('0xc9')](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});delete this['actions'][_0x21b984['linkedid']];break;case'19':_0x59df92[_0x7847('0x45')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut[_0x7847('0x8a')](_0x2c1bfc,0x13,_0x21b984[_0x7847('0xe5')]||_0x21b984[_0x7847('0xe6')]);ami[_0x7847('0x25')](_0x7847('0xe7'),ut[_0x7847('0x9e')](_0x2c1bfc,_0x7847('0xe9')));rpcDb['createCustomerHistory'](_0x2c1bfc,'[callProgressDetectingCustomer][machine]');_0x3fd09f[_0x7847('0xc1')](_0x2c1bfc,'18',_0x59df92)[_0x7847('0xa1')](function(_0x22f0a7){_0x135372=_0x22f0a7['additional']==0x1;if(!_0x135372){if(ut['totalGlobal'](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut[_0x7847('0xc2')](_0x2c1bfc,0xf,'Global');rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xea'));}else{rpcDb[_0x7847('0x93')](_0x2c1bfc,_0x7847('0xea'));}}else{_0x2c1bfc[_0x7847('0xca')]++;_0x3fd09f[_0x7847('0xc8')]({'id':_0x2c1bfc['idContact'],'field':{'countnoanswerretry':_0x2c1bfc['countnoanswerretry']}})[_0x7847('0xa1')](function(){_0x3fd09f[_0x7847('0xc9')](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});});}});delete this[_0x7847('0x15')][_0x21b984[_0x7847('0xaa')]];break;default:if(_0x2c1bfc[_0x7847('0x6f')]){ut[_0x7847('0x79')](_0x59df92,_0x7847('0xeb'));ut[_0x7847('0x7a')](_0x7847('0xec')+_0x59df92[_0x7847('0x27')],_0x21b984);}_0x59df92[_0x7847('0x45')]+=0x1;_0x2c1bfc[_0x7847('0x9b')]=ut[_0x7847('0x9c')](_0x2c1bfc);ut['logCustomer'](_0x2c1bfc,0xc,_0x21b984[_0x7847('0xe5')]||_0x21b984[_0x7847('0xe6')]);_0x5d8538=_0x59df92[_0x7847('0xdb')];_0x4403f5=_0x59df92[_0x7847('0xa3')];rpcDb['createCustomerHistory'](_0x2c1bfc,_0x7847('0xed'));_0x3fd09f['verifyAdditionalPhones'](_0x2c1bfc,'20',_0x59df92)['then'](function(_0x38be85){_0x135372=_0x38be85[_0x7847('0xa2')]==0x1;if(!_0x135372){if(ut[_0x7847('0x9c')](_0x2c1bfc)>=_0x59df92[_0x7847('0xa4')]){_0x21aefb=ut['cloneAction'](_0x2c1bfc,0xf,_0x7847('0xa5'));rpcDb[_0x7847('0x93')](_0x21aefb,_0x7847('0xee'));}else{rpcDb['createCustomerFinal'](_0x2c1bfc,_0x7847('0xee'));}delete this[_0x7847('0x15')][_0x21b984[_0x7847('0xaa')]];}else{_0x3fd09f['swapAdditionalPhones'](_0x2c1bfc,_0x5d8538,_0x4403f5)[_0x7847('0xa1')](function(){});}});}if(!(_0x2c1bfc[_0x7847('0x6f')]&&_0xb8e5f==='16')){ut['updateOriginated'](_0x59df92,_0x7847('0xef'));logger[_0x7847('0x7c')](_0x7847('0xf0'),_0x2c1bfc['uniqueid'],'\x20Queue',_0x59df92[_0x7847('0x27')],_0x7847('0x6e'),_0x59df92[_0x7847('0x5f')]);}if(_0xb8e5f!==_0x7847('0xad')){delete this[_0x7847('0x15')][_0x21b984[_0x7847('0xaa')]];delete this[_0x7847('0x15')][_0x21b984[_0x7847('0xf1')]];}}};Preview[_0x7847('0xd')]['callProgressDetectingAgent']=function(_0x547e94,_0x199145,_0x43e6ee){if(_[_0x7847('0xf2')](_0x199145)&&_0x7847('0xf3')!==typeof _0x199145){return;}if(_[_0x7847('0xf2')](_0x43e6ee)&&_0x7847('0xf3')!==typeof _0x43e6ee){return;}switch(_0x43e6ee[_0x7847('0xf4')]){case'0':ut[_0x7847('0xf5')](_0x547e94,0x0,_0x7847('0xf6'));rpcDb[_0x7847('0xf7')](_0x547e94,_0x7847('0xf8'));break;case'3':ut[_0x7847('0xf5')](_0x547e94,0x3,_0x7847('0xcb'));rpcDb[_0x7847('0xf7')](_0x547e94,_0x7847('0xf9'));break;case'5':ut[_0x7847('0xf5')](_0x547e94,0x5,_0x7847('0xbd'));rpcDb['createAgentHistory'](_0x547e94,_0x7847('0xfa'));break;case'8':ut['logAgent'](_0x547e94,0x8,'Congestion');rpcDb['createAgentHistory'](_0x547e94,_0x7847('0xfb'));break;case'22':ut[_0x7847('0xf5')](_0x547e94,0x16,_0x7847('0xfc'));rpcDb[_0x7847('0xf7')](_0x547e94,_0x7847('0xfd'));break;default:ut[_0x7847('0xf5')](_0x547e94,0xc,_0x43e6ee[_0x7847('0xf4')]);rpcDb[_0x7847('0xf7')](_0x547e94,_0x7847('0xfb'));}ut['updateOriginated'](_0x199145,_0x7847('0xfe'));logger[_0x7847('0x7c')]('[originated][decrement][callProgressDetectingAgent]',_0x547e94[_0x7847('0xb9')],_0x7847('0xff'),_0x199145[_0x7847('0x27')],_0x7847('0x6e'),_0x199145['originated']);delete this[_0x7847('0x15')][_0x547e94[_0x7847('0xb9')]];};Preview[_0x7847('0xd')]['verifyAdditionalPhones']=function(_0x50eefa,_0x5de364,_0x1bb71c){return Promise['resolve']()[_0x7847('0xa1')](cmHopperAdditionalPhone[_0x7847('0xc1')](_0x50eefa,_0x5de364,_0x1bb71c))[_0x7847('0x76')](logger[_0x7847('0x7c')](_0x7847('0x100')));};Preview[_0x7847('0xd')]['swapAdditionalPhones']=function(_0x184c4a,_0x477833,_0x183517){return Promise[_0x7847('0x101')]()[_0x7847('0xa1')](cmHopperAdditionalPhone[_0x7847('0xc9')](_0x184c4a,_0x477833,_0x183517))[_0x7847('0x76')](logger['info'](_0x7847('0x102')));};Preview[_0x7847('0xd')][_0x7847('0xc8')]=function(_0x2e5c4f){return Promise[_0x7847('0x101')]()[_0x7847('0xa1')](cmHopperAdditionalPhone[_0x7847('0xc8')](_0x2e5c4f))[_0x7847('0x76')](logger[_0x7847('0x7c')](_0x7847('0x103')));};Preview[_0x7847('0xd')][_0x7847('0x104')]=function(_0x4601bb,_0xfc51f3,_0x6eaabf,_0x230fe3,_0x1dc244){var _0x5b3954=this;return new Promise(function(_0x10d3d6,_0x49376b){if(_[_0x7847('0x6b')](_0xfc51f3)||_[_0x7847('0x6b')](_0xfc51f3[_0x7847('0x105')])||_[_0x7847('0x6b')](_0xfc51f3['phone'])||_['isNil'](_0xfc51f3['VoiceQueueId'])){_0x49376b(ut[_0x7847('0x4f')](_0x7847('0x106'),_0x230fe3,_0x1dc244));return;}var _0x3b28b6=uuid['v4']();var _0x25bbc4=_0x5b3954['campaignsPreview'][_0xfc51f3[_0x7847('0x6c')][_0x7847('0x27')]];var _0x2f9dfb=_0x6eaabf?_0x5b3954[_0x7847('0x16')][_0x6eaabf]['id']:undefined;_0x5b3954[_0x7847('0x15')][_0x3b28b6]=new Action(_0xfc51f3,_0x25bbc4,_0x3b28b6,_0x6eaabf,_0x2f9dfb);var _0x26007b=_0x5b3954['actions'][_0x3b28b6];_0x26007b[_0x7847('0xc6')]=_0x230fe3;_0x26007b[_0x7847('0xc7')]=_0x1dc244;_0x26007b[_0x7847('0x107')]=_0x6eaabf;if(_[_0x7847('0x108')](_0x4601bb)){_0x5b3954[_0x7847('0x109')](_0x26007b,_0x25bbc4,_0xfc51f3,_0x6eaabf)['then'](function(_0x21ea71){logger[_0x7847('0x7c')]('[Preview][execCall][success]',_0x7847('0x10a')+_0x26007b[_0x7847('0x6d')]+_0x7847('0x10b')+_0x26007b[_0x7847('0xac')],JSON['stringify'](_0x21ea71));ami[_0x7847('0x25')]('custom:agentcalled',ut[_0x7847('0x9e')](_0x26007b,_0x7847('0x10c'),_0x5b3954[_0x7847('0x12')][_0x26007b[_0x7847('0x6d')]]));_0x10d3d6(ut['message'](_0x7847('0x10d')));})['catch'](function(_0x4f33fa){ut[_0x7847('0x61')](_0x7847('0x10e'),_0x4f33fa);_0x49376b(ut['message'](_0x7847('0x10f'),_0x230fe3,_0x1dc244));});}else{_0x25bbc4[_0x7847('0x3e')]+=0x1;ut['logBlacklist'](_0x26007b);rpcDb['createHistory'](_0x26007b,'[Blacklist][error]');delete _0x5b3954[_0x7847('0x15')][_0x3b28b6];_0x49376b(ut['message'](_0x7847('0x110'),_0x230fe3,_0x1dc244));}});};Preview[_0x7847('0xd')][_0x7847('0x96')]=function(_0x370d71){return!_[_0x7847('0x6b')](_0x370d71)&&!_[_0x7847('0x6b')](_0x370d71[_0x7847('0x27')])&&!_[_0x7847('0x6b')](_0x370d71[_0x7847('0x111')])&&_0x370d71['active']&&!_[_0x7847('0x6b')](this['trunks'][util[_0x7847('0x87')](_0x7847('0x112'),_0x370d71['name'])])&&!_[_0x7847('0x6b')](this[_0x7847('0x14')][util[_0x7847('0x87')]('SIP/%s',_0x370d71['name'])][_0x7847('0x74')])&&(this[_0x7847('0x14')][util[_0x7847('0x87')](_0x7847('0x112'),_0x370d71['name'])][_0x7847('0x74')]==='reachable'||this[_0x7847('0x14')][util[_0x7847('0x87')](_0x7847('0x112'),_0x370d71[_0x7847('0x27')])]['status']===_0x7847('0x113'));};Preview['prototype'][_0x7847('0x114')]=function(_0x4aa515,_0x168c9b){var _0x3419fe=this;return new Promise(function(_0x499d3b,_0x3b21e4){_0x3419fe[_0x7847('0x115')](_0x4aa515,_0x168c9b)[_0x7847('0xa1')](function(_0x5b4e99){_0x499d3b(_['pick'](_0x5b4e99,[_0x7847('0x4f')]));})[_0x7847('0x76')](function(_0x30a11d){if(_0x30a11d[_0x7847('0x116')]){rpcDb[_0x7847('0x117')](_0x4aa515);}if(_0x30a11d[_0x7847('0x111')]){rpcDb[_0x7847('0x86')](_0x4aa515);}_0x3b21e4(_[_0x7847('0x70')](_0x30a11d,[_0x7847('0x4f')]));});});};Preview[_0x7847('0xd')][_0x7847('0x115')]=function(_0xeda821,_0x3132e3){var _0x1bbe37=this;return new Promise(function(_0x5ae5b4,_0x46ec46){var _0x20ac77,_0x5d44f0;rpcDb[_0x7847('0x118')](_0xeda821)['then'](function(_0x37ab02){if(!_['isNil'](_0x37ab02[0x0])){_0x5d44f0=_0x37ab02[0x0][_0x7847('0x119')]?![]:!![];_0x20ac77=_0x37ab02[0x0][_0x7847('0x119')]?!![]:![];_0x20ac77=_0x3132e3?!![]:_0x20ac77;}var _0x101422=_0x1bbe37[_0x7847('0x11a')](_0x37ab02);if(_0x101422[_0x7847('0x11b')]){rpcDb['checkIsBlackList'](_[_0x7847('0x70')](_0x37ab02[0x0],[_0x7847('0x11c'),_0x7847('0x11d')]))[_0x7847('0xa1')](function(_0x3b85f8){_0x1bbe37['checkInBlack'](_0x3b85f8,_0x37ab02[0x0],_0x3132e3,_0x5d44f0,_0x20ac77)[_0x7847('0xa1')](function(_0x533408){_0x5ae5b4(_0x533408);})['catch'](function(_0x4bdec9){_0x46ec46(_0x4bdec9);});})[_0x7847('0x76')](function(_0x579ebe){ut['logger'](_0x7847('0x11e'),_0x579ebe);_0x46ec46(ut[_0x7847('0x4f')](_0x7847('0x11f'),_0x5d44f0,_0x20ac77));});}else{_0x46ec46(ut[_0x7847('0x4f')](_0x101422[_0x7847('0x4f')],_0x5d44f0,_0x20ac77));}})[_0x7847('0x76')](function(_0xd9d868){ut[_0x7847('0x61')](_0x7847('0x120'),_0xd9d868);_0x46ec46(ut[_0x7847('0x4f')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0x7847('0x11a')]=function(_0x242929){if(_[_0x7847('0x6b')](_0x242929)||_[_0x7847('0x108')](_0x242929)||!_['isNil'](_0x242929[0x0][_0x7847('0x83')])&&_['isNil'](_0x242929[0x0][_0x7847('0x83')][_0x7847('0x27')])){ut[_0x7847('0x61')]('[Preview][validateContact][Empty\x20Contact]',_0x242929);return{'isValid':![],'message':_0x7847('0x121')};}var _0xed6b48=this[_0x7847('0x12')][_0x242929[0x0][_0x7847('0x6c')][_0x7847('0x27')]];_0xed6b48[_0x7847('0x4f')]=_0x7847('0x98');if(_[_0x7847('0x6b')](_0xed6b48)){ut[_0x7847('0x61')](_0x7847('0x122'),_0xed6b48);return{'isValid':![],'message':_0x7847('0x123')};}if(!this[_0x7847('0x96')](_0xed6b48[_0x7847('0x55')])){ut[_0x7847('0x61')](_0x7847('0x124'),_0x7847('0x125')+_0xed6b48[_0x7847('0x27')]+_0x7847('0x126'));if(!this[_0x7847('0x96')](_0xed6b48[_0x7847('0x127')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xed6b48['name']+_0x7847('0x128'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x7847('0x129')](_0xed6b48['dialActive'])){ut[_0x7847('0x61')](_0x7847('0x12a'),_0xed6b48['name']+_0x7847('0x12b'));return{'isValid':![],'message':_0x7847('0x125')+_0xed6b48[_0x7847('0x27')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x7847('0x12c')};};Preview[_0x7847('0xd')][_0x7847('0x109')]=function(_0x356217,_0x4951e0,_0x1d3e93,_0x586601){var _0x2423e9=this;return new Promise(function(_0x5229eb,_0x35acae){var _0x2796e4=_0x356217['uniqueid'];var _0x120820=_0x2423e9[_0x7847('0x96')](_0x4951e0[_0x7847('0x55')])?util[_0x7847('0x87')](_0x7847('0x12d'),_0x4951e0[_0x7847('0x55')][_0x7847('0x27')],_[_0x7847('0x6b')](_0x4951e0[_0x7847('0x3b')])?'':_0x4951e0[_0x7847('0x3b')][_0x7847('0x12e')]()||'',_0x4951e0['dialCutDigit']>0x0?_0x1d3e93[_0x7847('0x11d')][_0x7847('0x12f')](_0x4951e0[_0x7847('0x130')]):_0x1d3e93[_0x7847('0x11d')]):util['format'](_0x7847('0x12d'),_[_0x7847('0x6b')](_0x4951e0['TrunkBackup'])?_0x4951e0[_0x7847('0x55')][_0x7847('0x27')]:_0x4951e0[_0x7847('0x127')][_0x7847('0x27')],_[_0x7847('0x6b')](_0x4951e0[_0x7847('0x3b')])?'':_0x4951e0[_0x7847('0x3b')][_0x7847('0x12e')]()||'',_0x4951e0[_0x7847('0x130')]>0x0?_0x1d3e93['phone']['substring'](_0x4951e0[_0x7847('0x130')]):_0x1d3e93[_0x7847('0x11d')]);var _0x1c856a=_0x2423e9[_0x7847('0x96')](_0x4951e0['Trunk'])?ut['getCallerId'](_0x4951e0['Trunk'][_0x7847('0x131')],_0x4951e0[_0x7847('0x38')],_0x4951e0[_0x7847('0x132')]>0x0?ut[_0x7847('0x133')](_0x4951e0[_0x7847('0x39')],_0x4951e0[_0x7847('0x132')]):_0x4951e0[_0x7847('0x39')]):ut['getCallerId'](_['isNil'](_0x4951e0[_0x7847('0x127')])?_0x4951e0[_0x7847('0x55')]['callerid']:_0x4951e0[_0x7847('0x127')][_0x7847('0x131')],_0x4951e0['dialOriginateCallerIdName'],_0x4951e0[_0x7847('0x132')]>0x0?ut[_0x7847('0x133')](_0x4951e0['dialOriginateCallerIdNumber'],_0x4951e0[_0x7847('0x132')]):_0x4951e0['dialOriginateCallerIdNumber']);if(_0x1c856a){_0x356217['originatecalleridname']=ut[_0x7847('0x134')](_0x1c856a);_0x356217['originatecalleridnum']=ut[_0x7847('0x135')](_0x1c856a);}var _0xe1b485=ut[_0x7847('0x136')](_0x4951e0,_0x1d3e93,_0x120820,_0x1c856a,_0x2796e4,_0x356217);_['merge'](_0x356217,ut['toLowerVariables'](_0xe1b485));_0x356217[_0x7847('0x137')]=moment()['format'](_0x7847('0x88'));_0x4951e0[_0x7847('0x138')]=_0xe1b485;ami[_0x7847('0x139')](ut['variablesAction'](_0x356217,_0x4951e0,_0xe1b485,_0x356217[_0x7847('0xc7')],_0x586601))['then'](function(_0x1e73d5){_0x4951e0['originated']+=0x1;logger[_0x7847('0x7c')](_0x7847('0x13a'),_0x2796e4,_0x7847('0xff'),_0x4951e0['name'],_0x7847('0x6e'),_0x4951e0[_0x7847('0x5f')]);_0x5229eb(_0x1e73d5);})['catch'](function(_0x2ae361){ut['logAgent'](_0x356217,0xe,'OriginateError');rpcDb[_0x7847('0xf7')](_0x356217,'[originateFailure][logOriginateFailure]');_0x35acae(_0x2ae361);});});};Preview[_0x7847('0xd')]['syncNewExten']=function(_0x5a1717){if(this[_0x7847('0x15')][_0x5a1717[_0x7847('0xaa')]]){this['actions'][_0x5a1717[_0x7847('0xaa')]][_0x7847('0x75')]=_0x5a1717[_0x7847('0x75')];}};Preview[_0x7847('0xd')][_0x7847('0x19')]=function(_0x25ed69){var _0x705e06=this;var _0x2c73fb=this['actions'][_0x25ed69[_0x7847('0x13b')]];if(_0x2c73fb){if(_0x2c73fb['lookAgent']&&this['agents'][_0x2c73fb[_0x7847('0x107')]]){ut[_0x7847('0x13c')](_0x2c73fb,this[_0x7847('0x16')][_0x2c73fb[_0x7847('0x107')]][_0x7847('0x27')],this[_0x7847('0x16')][_0x2c73fb[_0x7847('0x107')]]['id']);}var _0xc70beb=_[_0x7847('0x13d')](_0x2c73fb);_0xc70beb[_0x7847('0xae')]=moment()[_0x7847('0x87')]('YYYY-MM-DD\x20HH:mm:ss');var _0x108eeb=_0x705e06[_0x7847('0x12')][_0x2c73fb[_0x7847('0x6d')]];if(ut[_0x7847('0x13e')](_0x25ed69['response'])){if(_0x2c73fb['unlockAgent']){rpcDb[_0x7847('0x117')](_0x2c73fb[_0x7847('0xac')]);}if(_0x2c73fb[_0x7847('0xc7')]){rpcDb[_0x7847('0x86')](_0x2c73fb['idContact']);}ami[_0x7847('0x25')]('custom:agentringnoanswer',ut['buildObj'](_0x2c73fb,_0x7847('0x13f'),this['campaignsPreview'][_0x2c73fb[_0x7847('0x6d')]]));this[_0x7847('0x140')](_0xc70beb,_0x108eeb,_0x25ed69);}else{_0x2c73fb[_0x7847('0x137')]=moment()['format'](_0x7847('0x88'));ut['logAgent'](_0xc70beb,0x4,_0x7847('0x141'));rpcDb[_0x7847('0xf7')](_0xc70beb,_0x7847('0x142'));}}};Preview[_0x7847('0xd')][_0x7847('0x1b')]=function(_0x3ba2bd){var _0x309aa9=this['actions'][_0x3ba2bd['linkedid']];var _0x2c391d;if(_0x309aa9){_0x2c391d=this[_0x7847('0x12')][_0x309aa9[_0x7847('0x6d')]];logger[_0x7847('0x7c')](_0x7847('0x143'),_0x3ba2bd[_0x7847('0xaa')],'\x20Queue',_0x2c391d[_0x7847('0x27')],_0x7847('0xb0'),_0x2c391d[_0x7847('0x2c')]);}if(this[_0x7847('0x15')][_0x3ba2bd[_0x7847('0xaa')]]&&_0x3ba2bd[_0x7847('0xaa')]!==_0x3ba2bd[_0x7847('0xb9')]){if(_0x3ba2bd[_0x7847('0x144')]==='16'&&this[_0x7847('0x15')][_0x3ba2bd[_0x7847('0xaa')]]['dialAnswer']){this[_0x7847('0x99')](_0x3ba2bd,_0x3ba2bd[_0x7847('0xaa')],_0x3ba2bd[_0x7847('0x144')]);}else if(this[_0x7847('0x15')][_0x3ba2bd[_0x7847('0xaa')]][_0x7847('0x6f')]){logger['info'](_0x7847('0x145'),_0x3ba2bd[_0x7847('0xaa')],_0x3ba2bd[_0x7847('0x144')],'\x20Queue',_0x2c391d[_0x7847('0x27')],'pTalking:\x20',_0x2c391d[_0x7847('0x2c')]);this[_0x7847('0x99')](_0x3ba2bd,_0x3ba2bd[_0x7847('0xaa')],_0x3ba2bd['cause']);}}else if(_0x309aa9&&_['isNil'](_0x309aa9[_0x7847('0x146')])&&_0x2c391d['dialQueueProject']&&_0x3ba2bd[_0x7847('0xaa')]===_0x3ba2bd['uniqueid']&&_[_0x7847('0x6b')](_0x3ba2bd[_0x7847('0xf4')])&&_0x3ba2bd[_0x7847('0x144')]==='16'&&_0x3ba2bd[_0x7847('0x147')]==='6'&&_[_0x7847('0xf2')](_0x309aa9[_0x7847('0x148')])){if(_0x309aa9['unlockAgent']){rpcDb[_0x7847('0x117')](_0x309aa9['idContact']);}if(_0x309aa9['activeContact']){rpcDb[_0x7847('0x86')](_0x309aa9['idContact']);}_0x3ba2bd[_0x7847('0xf4')]='22';this[_0x7847('0x140')](_0x309aa9,_0x2c391d,_0x3ba2bd);}else if(_0x309aa9&&_0x309aa9[_0x7847('0x148')]){if(_0x3ba2bd['cause']==='16'&&this[_0x7847('0x15')][_0x3ba2bd[_0x7847('0xaa')]][_0x7847('0x6f')]){logger[_0x7847('0x7c')]('[syncHangup][talking][transfer]',_0x3ba2bd[_0x7847('0xaa')],_0x3ba2bd['cause'],_0x7847('0xff'),_0x2c391d[_0x7847('0x27')],_0x7847('0xb0'),_0x2c391d[_0x7847('0x2c')]);this['callProgressDetectingCustomer'](_0x3ba2bd,_0x3ba2bd['linkedid'],_0x3ba2bd['cause']);}else if(this['actions'][_0x3ba2bd['linkedid']][_0x7847('0x6f')]){logger[_0x7847('0x7c')](_0x7847('0x145'),_0x3ba2bd[_0x7847('0xaa')],_0x3ba2bd[_0x7847('0x144')],_0x7847('0xff'),_0x2c391d[_0x7847('0x27')],_0x7847('0xb0'),_0x2c391d[_0x7847('0x2c')]);this[_0x7847('0x99')](_0x3ba2bd,_0x3ba2bd['linkedid'],_0x3ba2bd[_0x7847('0x144')]);}}};Preview[_0x7847('0xd')][_0x7847('0x1e')]=function(_0x5e012f){if(this[_0x7847('0x15')][_0x5e012f[_0x7847('0xf1')]]&&_0x5e012f['destlinkedid']!==_0x5e012f['destuniqueid']){this[_0x7847('0x99')](_0x5e012f,_0x5e012f[_0x7847('0xf1')],_0x5e012f[_0x7847('0xe6')]);}};Preview[_0x7847('0xd')][_0x7847('0x149')]=function(_0x1775c9){if(this[_0x7847('0x15')][_0x1775c9[_0x7847('0xaa')]]&&_0x1775c9[_0x7847('0xaa')]!==_0x1775c9[_0x7847('0xb9')]&&!this['actions'][_0x1775c9[_0x7847('0xaa')]][_0x7847('0x6f')]){if(_0x1775c9[_0x7847('0x144')]==='1'){this['callProgressDetectingCustomer'](_0x1775c9,_0x1775c9[_0x7847('0xaa')],_0x1775c9['cause']);}}};Preview[_0x7847('0xd')][_0x7847('0x14a')]=function(_0x4b76dc,_0x51f7b9,_0x502138){if(this[_0x7847('0x15')][_0x4b76dc]){if(_['isNil'](this[_0x7847('0x15')][_0x4b76dc]['variables'])){this[_0x7847('0x15')][_0x4b76dc][_0x7847('0x138')]={};}this['actions'][_0x4b76dc]['variables'][_0x51f7b9]=_0x502138;}};Preview[_0x7847('0xd')][_0x7847('0x21')]=function(_0x3ce138){try{if(!_['isNil'](_0x3ce138)){if(ut[_0x7847('0x14b')](_[_0x7847('0x14c')](_0x3ce138[_0x7847('0x14d')])[0x0])){this['addVariable'](_0x3ce138['uniqueid'],_['keys'](_0x3ce138[_0x7847('0x14d')])[0x0],_0x3ce138[_0x7847('0x14e')]);}}}catch(_0xd5b21){logger['error']('[syncVarSet][Preview]',util[_0x7847('0x14f')](_0xd5b21,{'showHidden':![],'depth':null}));}};Preview[_0x7847('0xd')][_0x7847('0x22')]=function(_0x3b4b9d){if(_0x3b4b9d){if(this[_0x7847('0x15')][_0x3b4b9d[_0x7847('0x150')]]){this[_0x7847('0x15')][_0x3b4b9d[_0x7847('0x150')]][_0x7847('0x148')]=!![];}}};Preview[_0x7847('0xd')][_0x7847('0x23')]=function(_0xae595){if(_0xae595){if(this['actions'][_0xae595[_0x7847('0x151')]]){this[_0x7847('0x15')][_0xae595['transfererlinkedid']][_0x7847('0x148')]=!![];}}};module[_0x7847('0x152')]=Preview; \ No newline at end of file +var _0x7f40=['format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','message','updateOriginated','dialAnswer','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','pTalking:\x20','acw','custom:agentConnectPreview','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','uniqueid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','Global','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','disableContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','TrunkBackup','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','md5','ioredis','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify'];(function(_0x135fcb,_0x20c1c3){var _0x2c139a=function(_0x2bdd46){while(--_0x2bdd46){_0x135fcb['push'](_0x135fcb['shift']());}};_0x2c139a(++_0x20c1c3);}(_0x7f40,0x10c));var _0x07f4=function(_0x4cbb67,_0x5208fd){_0x4cbb67=_0x4cbb67-0x0;var _0x189ea3=_0x7f40[_0x4cbb67];return _0x189ea3;};'use strict';var util=require('util');var _=require(_0x07f4('0x0'));var uuid=require(_0x07f4('0x1'));var moment=require(_0x07f4('0x2'));var md5=require(_0x07f4('0x3'));var Redis=require(_0x07f4('0x4'));var config=require(_0x07f4('0x5'));var logger=require('../../../config/logger')(_0x07f4('0x6'));var loggerAction=require(_0x07f4('0x7'))(_0x07f4('0x8'));var ami=require(_0x07f4('0x9'));var rpcDb=require(_0x07f4('0xa'));var cmHopperAdditionalPhone=require(_0x07f4('0xb'));var Action=require(_0x07f4('0xc'));var ut=require(_0x07f4('0xd'));config['redis']=_[_0x07f4('0xe')](config[_0x07f4('0xf')],{'host':_0x07f4('0x10'),'port':0x18eb});var io=require(_0x07f4('0x11'))(new Redis(config[_0x07f4('0xf')]));var Sequence=function(){};Sequence[_0x07f4('0x12')]['enqueue']=function(_0x508840){this[_0x07f4('0x13')]=this[_0x07f4('0x13')]?this[_0x07f4('0x13')][_0x07f4('0x14')](_0x508840):_0x508840();};function Preview(_0x199c29){this[_0x07f4('0x15')]=new Sequence();this[_0x07f4('0x16')]=_0x199c29[_0x07f4('0x17')];this[_0x07f4('0x18')]=_0x199c29[_0x07f4('0x18')];this['actions']={};this[_0x07f4('0x19')]=_0x199c29['agents'];this[_0x07f4('0x1a')]=0x0;ami['on'](_0x07f4('0x1b'),this['syncOriginateResponse'][_0x07f4('0x1c')](this));ami['on'](_0x07f4('0x1d'),this[_0x07f4('0x1e')]['bind'](this));ami['on'](_0x07f4('0x1f'),this[_0x07f4('0x20')][_0x07f4('0x1c')](this));ami['on'](_0x07f4('0x21'),this[_0x07f4('0x22')][_0x07f4('0x1c')](this));ami['on'](_0x07f4('0x23'),this['syncNewExten'][_0x07f4('0x1c')](this));ami['on']('varset',this[_0x07f4('0x24')][_0x07f4('0x1c')](this));ami['on'](_0x07f4('0x25'),this['syncAttendedTransfer'][_0x07f4('0x1c')](this));ami['on']('blindtransfer',this[_0x07f4('0x26')][_0x07f4('0x1c')](this));this[_0x07f4('0x27')](this[_0x07f4('0x16')]);}function emit(_0x3ba684,_0x5af13c,_0x1255f9){io['to'](_0x3ba684)['emit'](_0x5af13c,_0x1255f9);}function emitCampaignPreview(_0x1d4f0f){if(_0x1d4f0f[_0x07f4('0x28')]===_0x07f4('0x29')){var _0x1e683a={'id':_0x1d4f0f['id'],'name':_0x1d4f0f[_0x07f4('0x2a')],'strategy':_0x1d4f0f[_0x07f4('0x2b')],'answered':_0x1d4f0f[_0x07f4('0x2c')],'available':_0x1d4f0f[_0x07f4('0x2d')],'loggedIn':_0x1d4f0f['loggedIn'],'pTalking':_0x1d4f0f[_0x07f4('0x2e')],'sumBillable':_0x1d4f0f[_0x07f4('0x2f')],'sumDuration':_0x1d4f0f[_0x07f4('0x30')],'sumHoldTime':_0x1d4f0f[_0x07f4('0x31')]||0x0,'talking':_0x1d4f0f['talking'],'total':_0x1d4f0f[_0x07f4('0x32')],'type':_0x1d4f0f['type'],'unmanaged':_0x1d4f0f[_0x07f4('0x33')],'abandoned':_0x1d4f0f[_0x07f4('0x34')],'waiting':_0x1d4f0f[_0x07f4('0x35')],'loggedInDb':_0x1d4f0f[_0x07f4('0x36')],'dialActive':_0x1d4f0f[_0x07f4('0x37')],'dialMethod':_0x1d4f0f[_0x07f4('0x38')],'dialOriginateCallerIdName':_0x1d4f0f[_0x07f4('0x39')],'dialOriginateCallerIdNumber':_0x1d4f0f[_0x07f4('0x3a')],'dialOriginateTimeout':_0x1d4f0f['dialOriginateTimeout'],'dialPrefix':_0x1d4f0f[_0x07f4('0x3b')],'outboundAnswerAgiCallsDay':_0x1d4f0f[_0x07f4('0x3c')],'outboundAnswerCallsDay':_0x1d4f0f[_0x07f4('0x3d')],'outboundBlacklistCallsDay':_0x1d4f0f[_0x07f4('0x3e')],'outboundBusyCallsDay':_0x1d4f0f[_0x07f4('0x3f')],'outboundCongestionCallsDay':_0x1d4f0f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1d4f0f[_0x07f4('0x40')],'outboundDropCallsDayCallersExit':_0x1d4f0f[_0x07f4('0x41')],'outboundDropCallsDayTimeout':_0x1d4f0f[_0x07f4('0x42')],'outboundNoAnswerCallsDay':_0x1d4f0f[_0x07f4('0x43')],'outboundNoSuchCallsDay':_0x1d4f0f[_0x07f4('0x44')],'outboundOriginateFailureCallsDay':_0x1d4f0f[_0x07f4('0x45')],'outboundReCallsDay':_0x1d4f0f[_0x07f4('0x46')],'outboundRejectCallsDay':_0x1d4f0f[_0x07f4('0x47')],'outboundUnknownCallsDay':_0x1d4f0f[_0x07f4('0x48')],'outboundAbandonedCallsDay':_0x1d4f0f['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1d4f0f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1d4f0f[_0x07f4('0x49')],'predictiveIntervalAvgTalktime':_0x1d4f0f[_0x07f4('0x4a')],'predictiveIntervalDroppedCallsCallersExit':_0x1d4f0f[_0x07f4('0x4b')],'predictiveIntervalDroppedCallsTimeout':_0x1d4f0f[_0x07f4('0x4c')],'predictiveIntervalErlangCalls':_0x1d4f0f[_0x07f4('0x4d')],'predictiveIntervalErlangCallsDroppedCalls':_0x1d4f0f[_0x07f4('0x4e')],'predictiveIntervalHitRate':_0x1d4f0f[_0x07f4('0x4f')],'predictiveIntervalMultiplicativeFactor':_0x1d4f0f[_0x07f4('0x50')],'predictiveIntervalPauses':_0x1d4f0f[_0x07f4('0x51')],'predictiveIntervalAvailable':_0x1d4f0f['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x1d4f0f[_0x07f4('0x52')],'message':_0x1d4f0f['message'],'originated':_0x1d4f0f[_0x07f4('0x53')],'erlangCalls':_0x1d4f0f[_0x07f4('0x54')],'erlangCallToSecond':_0x1d4f0f[_0x07f4('0x55')],'erlangAbandonmentRate':_0x1d4f0f['erlangAbandonmentRate'],'erlangBusyFactor':_0x1d4f0f[_0x07f4('0x56')],'startPredictive':_0x1d4f0f[_0x07f4('0x57')],'startProgressive':_0x1d4f0f[_0x07f4('0x58')]};if(_0x1d4f0f['Trunk']){_0x1e683a[_0x07f4('0x59')]={'id':_0x1d4f0f[_0x07f4('0x59')]['id'],'name':_0x1d4f0f['Trunk'][_0x07f4('0x2a')],'active':_0x1d4f0f[_0x07f4('0x59')][_0x07f4('0x5a')],'callerid':_0x1d4f0f[_0x07f4('0x59')][_0x07f4('0x5b')]};}if(_0x1d4f0f[_0x07f4('0x5c')]){_0x1e683a[_0x07f4('0x5c')]={'id':_0x1d4f0f[_0x07f4('0x5c')]['id'],'name':_0x1d4f0f[_0x07f4('0x5c')][_0x07f4('0x2a')]};}var _0x4ad525=md5(JSON[_0x07f4('0x5d')](_0x1e683a));if(_0x1d4f0f[_0x07f4('0x3')]!==_0x4ad525){_0x1d4f0f[_0x07f4('0x3')]=_0x4ad525;emit(util[_0x07f4('0x5e')](_0x07f4('0x5f'),_0x1e683a[_0x07f4('0x2a')]),_0x07f4('0x60'),_0x1e683a);}}}function emitVoiceQueueChannelRemove(_0x2433e5){logger[_0x07f4('0x61')](_0x07f4('0x62'),JSON[_0x07f4('0x5d')](_0x2433e5));emit(util[_0x07f4('0x5e')](_0x07f4('0x5f'),_0x2433e5[_0x07f4('0x2a')]),_0x07f4('0x63'),_0x2433e5);io[_0x07f4('0x64')](_0x07f4('0x65'),_0x2433e5);}function notSendMessagesQueue(_0x92cf8a){if(_0x92cf8a[_0x07f4('0x66')]){if(_0x92cf8a['originated']===0x0&&_0x92cf8a[_0x07f4('0x2e')]===0x0){_0x92cf8a['sendMessageOneNotActive']=![];_0x92cf8a[_0x07f4('0x2d')]=0x0;_0x92cf8a[_0x07f4('0x67')]=0x0;_0x92cf8a['message']=_0x07f4('0x68');ut[_0x07f4('0x69')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x92cf8a['name']+_0x07f4('0x6a'));}else{_0x92cf8a['message']=_0x07f4('0x6b');ut[_0x07f4('0x69')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x92cf8a[_0x07f4('0x2a')]+_0x07f4('0x6c'));}emitCampaignPreview(_0x92cf8a);}}Preview[_0x07f4('0x12')]['loopCampaigns']=function(){var _0x108f36=this;setInterval(function(){_0x108f36[_0x07f4('0x6d')]();},0x7cf);};Preview[_0x07f4('0x12')][_0x07f4('0x6d')]=function(){var _0x5d17e7=this[_0x07f4('0x16')];this[_0x07f4('0x1a')]+=0x1;for(var _0x506040 in _0x5d17e7){if(_0x5d17e7[_0x07f4('0x6e')](_0x506040)&&(_0x5d17e7[_0x506040][_0x07f4('0x38')]===_0x07f4('0x6')||_0x5d17e7[_0x506040]['dialMethod']===_0x07f4('0x6f'))&&_0x5d17e7[_0x506040][_0x07f4('0x28')]===_0x07f4('0x29')){if(this[_0x07f4('0x1a')]>0x7){this[_0x07f4('0x1a')]=0x0;this['clearZombieChannels']();}}if(_0x5d17e7['hasOwnProperty'](_0x506040)&&_0x5d17e7[_0x506040][_0x07f4('0x38')]===_0x07f4('0x6')&&_0x5d17e7[_0x506040][_0x07f4('0x28')]===_0x07f4('0x29')){if(_0x5d17e7[_0x506040][_0x07f4('0x37')]){this[_0x07f4('0x70')](_0x5d17e7[_0x506040]);if(_0x5d17e7[_0x506040][_0x07f4('0x71')])this[_0x07f4('0x72')](_0x5d17e7[_0x506040]);}else{notSendMessagesQueue(_0x5d17e7[_0x506040]);}}}};Preview[_0x07f4('0x12')][_0x07f4('0x73')]=function(_0x3f739e){var _0x1d21f7=this;this[_0x07f4('0x15')][_0x07f4('0x74')](function(){if(!_['isNil'](_0x1d21f7[_0x07f4('0x75')][_0x3f739e])){loggerAction[_0x07f4('0x61')](_0x07f4('0x76'),_0x3f739e,_0x07f4('0x77'),_0x1d21f7[_0x07f4('0x75')][_0x3f739e][_0x07f4('0x78')],_0x07f4('0x79'),JSON[_0x07f4('0x5d')](_0x1d21f7[_0x07f4('0x16')][_0x1d21f7[_0x07f4('0x75')][_0x3f739e][_0x07f4('0x78')]][_0x07f4('0x53')]),'pTalking:\x20',JSON['stringify'](_0x1d21f7[_0x07f4('0x16')][_0x1d21f7[_0x07f4('0x75')][_0x3f739e][_0x07f4('0x78')]][_0x07f4('0x2e')]),JSON[_0x07f4('0x5d')](_0x1d21f7['actions'][_0x3f739e]['dialAnswer']),JSON[_0x07f4('0x5d')](_[_0x07f4('0x7a')](_0x1d21f7[_0x07f4('0x75')][_0x3f739e],[_0x07f4('0x7b'),_0x07f4('0x7c'),_0x07f4('0x7d'),_0x07f4('0x7e')])));return ami[_0x07f4('0x7f')]({'action':'status','channel':_0x1d21f7['actions'][_0x3f739e][_0x07f4('0x80')]})[_0x07f4('0x81')](function(_0x398d36){if(_0x398d36[_0x07f4('0x82')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1d21f7[_0x07f4('0x75')][_0x3f739e]){ut[_0x07f4('0x83')](_0x1d21f7[_0x07f4('0x16')][_0x1d21f7[_0x07f4('0x75')][_0x3f739e]['queue']],'[clearZombieChannel]');if(_0x1d21f7[_0x07f4('0x75')][_0x3f739e][_0x07f4('0x84')]===!![]){ut['decrementTalkink'](_0x1d21f7[_0x07f4('0x16')][_0x1d21f7['actions'][_0x3f739e]['queue']],'[clearZombieChannel]');ut[_0x07f4('0x85')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3f739e,_0x1d21f7['actions'][_0x3f739e]['queue']);}ut[_0x07f4('0x85')](_0x07f4('0x86')+_0x3f739e,_0x1d21f7[_0x07f4('0x75')][_0x3f739e][_0x07f4('0x78')]);delete _0x1d21f7['actions'][_0x3f739e];}},0x2328);}});}});};Preview['prototype'][_0x07f4('0x87')]=function(){var _0x47d5cf=this;loggerAction[_0x07f4('0x61')](_0x07f4('0x88'),_[_0x07f4('0x89')](this[_0x07f4('0x75')]));for(var _0x562d8d in this[_0x07f4('0x75')]){if(_0x47d5cf[_0x07f4('0x75')]['hasOwnProperty'](_0x562d8d)){_0x47d5cf[_0x07f4('0x73')](_0x562d8d);}}};Preview[_0x07f4('0x12')][_0x07f4('0x72')]=function(_0x39ea89){var _0xadfb29=this;rpcDb[_0x07f4('0x8a')](_0x39ea89['id'],ut[_0x07f4('0x8b')](this[_0x07f4('0x19')]))['then'](function(_0x4a5dde){if(!_[_0x07f4('0x8c')](_0x4a5dde)){for(var _0x101129=0x0;_0x101129<_0x4a5dde[_0x07f4('0x8d')];_0x101129+=0x1){if(ut[_0x07f4('0x8e')](_0x4a5dde[_0x101129][_0x07f4('0x8f')])<_0x39ea89['dialRecallMeTimeout']*0x3c){if(_0x4a5dde[_0x101129][_0x07f4('0x90')]&&!_0x4a5dde[_0x101129][_0x07f4('0x90')][_0x07f4('0x91')]){_0xadfb29[_0x07f4('0x92')](_0x4a5dde[_0x101129]['id'])[_0x07f4('0x93')](ut[_0x07f4('0x94')](_0x07f4('0x95')))['catch'](ut[_0x07f4('0x94')](_0x07f4('0x95')));}else{rpcDb['disableContact'](_0x4a5dde[_0x101129]['id']);}}else{var _0xa62724=new Action(_0x4a5dde[_0x101129],_0x39ea89);_0xa62724[_0x07f4('0x96')]=moment()[_0x07f4('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x39ea89['outboundReCallsDay']+=0x1;ut[_0x07f4('0x97')](_0xa62724,0x17,_0x07f4('0x98'));if(_0x39ea89['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x07f4('0x99')](_0x4a5dde[_0x101129]));rpcDb[_0x07f4('0x9a')](_0xa62724,_0x07f4('0x9b'));}else{ut[_0x07f4('0x97')](_0xa62724,0x16,_0x07f4('0x9c'));rpcDb[_0x07f4('0x9a')](_0xa62724,_0x07f4('0x9d'));rpcDb['createCustomerFinal'](_0xa62724,_0x07f4('0x9d'));}}}}})[_0x07f4('0x81')](ut[_0x07f4('0x94')](_0x07f4('0x9e')));};Preview['prototype'][_0x07f4('0x70')]=function(_0x3e9914){_0x3e9914['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3e9914[_0x07f4('0x9f')])){_0x3e9914[_0x07f4('0x82')]=_0x07f4('0xa0');}else if(!ut[_0x07f4('0xa1')](_0x3e9914['dialActive'])){_0x3e9914[_0x07f4('0x82')]=_0x07f4('0x68');}else if(!this[_0x07f4('0xa2')](_0x3e9914[_0x07f4('0x59')])){if(!this[_0x07f4('0xa2')](_0x3e9914['TrunkBackup'])){_0x3e9914[_0x07f4('0x82')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3e9914[_0x07f4('0x82')]=_0x07f4('0xa3');}}else{_0x3e9914[_0x07f4('0x82')]=_0x07f4('0xa3');}emitCampaignPreview(_0x3e9914);};Preview[_0x07f4('0x12')][_0x07f4('0xa4')]=function(_0x522772,_0x32dc7f,_0x2d1a68){var _0x28c530=this;var _0x398bd0=this[_0x07f4('0x75')][_0x32dc7f];var _0x5999e6=this['campaignsPreview'][_0x398bd0['queue']];var _0x5782d3;var _0xe1f824=![];var _0x2b70dc=0x2;var _0x59e3af=0x3;if(_0x5999e6){switch(_0x2d1a68){case'1':_0x5999e6[_0x07f4('0x44')]+=0x1;_0x398bd0[_0x07f4('0xa5')]+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut['totalGlobal'](_0x398bd0);ut['logCustomer'](_0x398bd0,0x0,'NoSuchNumber');ami[_0x07f4('0x64')](_0x07f4('0xa7'),ut[_0x07f4('0xa8')](_0x398bd0,_0x07f4('0xa9')));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xaa'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'0',_0x5999e6)[_0x07f4('0x93')](function(_0x6c15ce){_0xe1f824=_0x6c15ce[_0x07f4('0xac')]==0x1;_0x2b70dc=_0x5999e6[_0x07f4('0xad')];_0x59e3af=_0x5999e6[_0x07f4('0xae')];if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6['dialGlobalMaxRetry']){_0x5782d3=ut[_0x07f4('0xb0')](_0x398bd0,0xf,'Global');rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xb2'));}else{if(_0x398bd0[_0x07f4('0xa5')]>=_0x5999e6['dialNoSuchNumberMaxRetry']){rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xb2'));}else{rpcDb[_0x07f4('0xb3')](ut['scheduledAt'](_0x398bd0,'countnosuchnumberretry',_0x5999e6[_0x07f4('0xad')]),_0x398bd0['unlockAgent'],_0x398bd0[_0x07f4('0xb4')]);}}delete this[_0x07f4('0x75')][_0x522772[_0x07f4('0xb5')]];}else{_0x398bd0[_0x07f4('0xa5')]++;logger[_0x07f4('0x61')](_0x07f4('0xb6'),_0x398bd0[_0x07f4('0xa5')]);logger[_0x07f4('0x61')]('id',_0x398bd0[_0x07f4('0xb7')]);_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countnosuchnumberretry':_0x398bd0[_0x07f4('0xa5')]}})[_0x07f4('0x93')](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});break;case _0x07f4('0xba'):var _0x6bc57e=moment()[_0x07f4('0x5e')](_0x07f4('0xbb'));_0x398bd0[_0x07f4('0xbc')]=_0x6bc57e;_0x398bd0[_0x07f4('0xbd')]=_0x6bc57e;_0x398bd0['dialAnswer']=!![];_0x5999e6[_0x07f4('0x2e')]+=0x1;logger[_0x07f4('0x61')](_0x07f4('0xbe'),_0x398bd0['uniqueid'],_0x07f4('0xbf'),_0x5999e6[_0x07f4('0x2a')],_0x07f4('0xc0'),_0x5999e6['pTalking']);ami[_0x07f4('0x64')]('custom:agentconnect',ut['buildObj'](_0x398bd0,'connect',this[_0x07f4('0x16')][_0x398bd0['queue']]));if(_0x5999e6[_0x07f4('0xc1')]){ami['emit'](_0x07f4('0xc2'),ut['buildAcw'](_0x398bd0));}break;case'16':ami[_0x07f4('0x64')](_0x07f4('0xc3'),ut[_0x07f4('0xa8')](_0x398bd0,_0x07f4('0xc4'),this['campaignsPreview'][_0x398bd0[_0x07f4('0x78')]]));emitVoiceQueueChannelRemove(ut[_0x07f4('0xa8')](_0x398bd0,_0x07f4('0xc4')));_0x5999e6[_0x07f4('0x3d')]+=0x1;_0x5999e6['total']+=0x1;_0x5999e6[_0x07f4('0x2c')]+=0x1;ut[_0x07f4('0xc5')](_0x5999e6,_0x07f4('0xc6'));_0x398bd0['countglobal']=ut[_0x07f4('0xaf')](_0x398bd0);ut['logCustomer'](_0x398bd0,0x4,_0x07f4('0xc7'));rpcDb['createCustomerHistory'](_0x398bd0,_0x07f4('0xc8'));rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xc9'));rpcDb[_0x07f4('0xca')](_0x398bd0);_0x5999e6[_0x07f4('0x30')]+=_0x398bd0[_0x07f4('0xcb')];_0x5999e6[_0x07f4('0x2f')]+=_0x398bd0[_0x07f4('0xcb')];logger['info']('[syncHangup][talking][decrement]',_0x398bd0[_0x07f4('0xcc')],_0x07f4('0xbf'),_0x5999e6['name'],_0x07f4('0xc0'),_0x5999e6[_0x07f4('0x2e')]);delete this[_0x07f4('0x75')][_0x522772['linkedid']];break;case _0x07f4('0xcd'):_0x5999e6['outboundBusyCallsDay']+=0x1;_0x398bd0[_0x07f4('0xce')]+=0x1;_0x398bd0['countglobal']=ut[_0x07f4('0xaf')](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0x5,_0x07f4('0xcf'));_0x2b70dc=_0x5999e6['dialBusyRetryFrequency'];_0x59e3af=_0x5999e6[_0x07f4('0xae')];ami[_0x07f4('0x64')](_0x07f4('0xd0'),ut[_0x07f4('0xa8')](_0x398bd0,_0x07f4('0xd1')));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xd2'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'5',_0x5999e6)[_0x07f4('0x93')](function(_0x554630){_0xe1f824=_0x554630[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut[_0x07f4('0xb0')](_0x398bd0,0xf,'Global');rpcDb['createCustomerFinal'](_0x5782d3,_0x07f4('0xd4'));}else{if(_0x398bd0[_0x07f4('0xce')]>=_0x5999e6[_0x07f4('0xd5')]){rpcDb['createCustomerFinal'](_0x398bd0,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x07f4('0xb3')](ut[_0x07f4('0xd6')](_0x398bd0,_0x07f4('0xce'),_0x5999e6['dialBusyRetryFrequency']),_0x398bd0[_0x07f4('0xd7')],_0x398bd0[_0x07f4('0xb4')]);}}}else{_0x398bd0[_0x07f4('0xce')]++;_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countbusyretry':_0x398bd0['countbusyretry']}})[_0x07f4('0x93')](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});break;case _0x07f4('0xd8'):_0x5999e6['outboundNoAnswerCallsDay']+=0x1;_0x398bd0[_0x07f4('0xd9')]+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut[_0x07f4('0xaf')](_0x398bd0);ut['logCustomer'](_0x398bd0,0x3,_0x07f4('0xda'));_0x2b70dc=_0x5999e6[_0x07f4('0xdb')];_0x59e3af=_0x5999e6['callAdditionalPhoneAfterMin'];var _0x3a6616=ut['buildNoAnswerEventPayload'](_0x398bd0,_0x5999e6);ami[_0x07f4('0x64')](_0x07f4('0xdc'),_0x3a6616);rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xdd'));_0x28c530['verifyAdditionalPhones'](_0x398bd0,'3',_0x5999e6)[_0x07f4('0x93')](function(_0x734c6d){_0xe1f824=_0x734c6d[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6['dialGlobalMaxRetry']){_0x5782d3=ut['cloneAction'](_0x398bd0,0xf,'Global');rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xde'));}else{if(_0x398bd0[_0x07f4('0xd9')]>=_0x5999e6[_0x07f4('0xdf')]){rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xdd'));}else{rpcDb[_0x07f4('0xb3')](ut[_0x07f4('0xd6')](_0x398bd0,_0x07f4('0xd9'),_0x5999e6[_0x07f4('0xdb')]),_0x398bd0[_0x07f4('0xd7')],_0x398bd0['activeContact']);}}}else{_0x398bd0[_0x07f4('0xd9')]++;_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countnoanswerretry':_0x398bd0[_0x07f4('0xd9')]}})[_0x07f4('0x93')](function(){_0x28c530['swapAdditionalPhones'](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});break;case _0x07f4('0xe0'):_0x5999e6[_0x07f4('0xe1')]+=0x1;_0x398bd0['countcongestionretry']+=0x1;_0x398bd0['countglobal']=ut[_0x07f4('0xaf')](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0x8,'Congestion');_0x2b70dc=_0x5999e6[_0x07f4('0xe2')];_0x59e3af=_0x5999e6[_0x07f4('0xae')];ami[_0x07f4('0x64')](_0x07f4('0xe3'),ut['buildObj'](_0x398bd0,_0x07f4('0xe4')));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xe5'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'8',_0x5999e6)['then'](function(_0x1b8f58){_0xe1f824=_0x1b8f58['additional']==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut['cloneAction'](_0x398bd0,0xf,_0x07f4('0xe6'));rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xe7'));}else{if(_0x398bd0[_0x07f4('0xe8')]>=_0x5999e6[_0x07f4('0xe9')]){rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xe5'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x398bd0,'countcongestionretry',_0x5999e6[_0x07f4('0xea')]),_0x398bd0['unlockAgent'],_0x398bd0[_0x07f4('0xb4')]);}}}else{_0x398bd0['countcongestionretry']++;_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countcongestionretry':_0x398bd0[_0x07f4('0xe8')]}})[_0x07f4('0x93')](function(){_0x28c530['swapAdditionalPhones'](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});break;case _0x07f4('0xeb'):_0x5999e6['outboundRejectCallsDay']+=0x1;_0x398bd0[_0x07f4('0xec')]+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut[_0x07f4('0xaf')](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0x14,_0x07f4('0xed'));_0x2b70dc=_0x5999e6['dialAgentRejectRetryFrequency'];_0x59e3af=_0x5999e6[_0x07f4('0xae')];ami['emit']('custom:agentreject',ut['buildObj'](_0x398bd0,_0x07f4('0xee')));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xef'));_0x28c530['verifyAdditionalPhones'](_0x398bd0,'20',_0x5999e6)[_0x07f4('0x93')](function(_0x349dac){_0xe1f824=_0x349dac[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut[_0x07f4('0xb0')](_0x398bd0,0x14,_0x07f4('0xed'));rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xf0'));}else{if(_0x398bd0['countagentrejectretry']>=_0x5999e6[_0x07f4('0xf1')]){rpcDb['createCustomerFinal'](_0x398bd0,_0x07f4('0xf0'));}else{rpcDb[_0x07f4('0xb3')](ut[_0x07f4('0xd6')](_0x398bd0,'countagentrejectretry',_0x5999e6[_0x07f4('0xf2')]),_0x398bd0[_0x07f4('0xd7')],_0x398bd0[_0x07f4('0xb4')]);}}}else{_0x398bd0[_0x07f4('0xd9')]++;_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countnoanswerretry':_0x398bd0[_0x07f4('0xd9')]}})[_0x07f4('0x93')](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});break;case'ABANDONED':_0x5999e6['outboundAbandonedCallsDay']+=0x1;_0x398bd0[_0x07f4('0xf3')]+=0x1;_0x398bd0['countglobal']=ut[_0x07f4('0xaf')](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0xb,_0x07f4('0xf4'));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xf5'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'11',_0x5999e6)[_0x07f4('0x93')](function(_0x35ecc9){_0xe1f824=_0x35ecc9[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6['dialGlobalMaxRetry']){_0x5782d3=ut[_0x07f4('0xb0')](_0x398bd0,0xf,_0x07f4('0xe6'));rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xf5'));}else{if(_0x398bd0[_0x07f4('0xf6')]>=_0x5999e6[_0x07f4('0xf7')]){rpcDb['createCustomerFinal'](_0x398bd0,_0x07f4('0xf5'));}else{rpcDb['rescheduleContact'](ut[_0x07f4('0xd6')](_0x398bd0,_0x07f4('0xf3'),_0x5999e6['dialAbandonedRetryFrequency']),_0x398bd0[_0x07f4('0xd7')],_0x398bd0['activeContact']);}}}else{_0x398bd0[_0x07f4('0xd9')]++;_0x28c530[_0x07f4('0xb8')]({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countnoanswerretry':_0x398bd0[_0x07f4('0xd9')]}})[_0x07f4('0x93')](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)['then'](function(){});});}});break;case'18':_0x5999e6[_0x07f4('0x48')]+=0x1;_0x398bd0[_0x07f4('0xf8')]+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut['totalGlobal'](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0x12,_0x522772[_0x07f4('0xf9')]||_0x522772[_0x07f4('0xfa')]);ami[_0x07f4('0x64')](_0x07f4('0xfb'),ut[_0x07f4('0xa8')](_0x398bd0,'amd'));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xfc'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'18',_0x5999e6)[_0x07f4('0x93')](function(_0x39fa76){_0xe1f824=_0x39fa76[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut['cloneAction'](_0x398bd0,0x12,_0x07f4('0xe6'));rpcDb[_0x07f4('0xb1')](_0x5782d3,_0x07f4('0xfc'));}else{rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xfc'));}}else{_0x398bd0[_0x07f4('0xd9')]++;_0x28c530['incrementPreviewCounters']({'id':_0x398bd0['idContact'],'field':{'countnoanswerretry':_0x398bd0[_0x07f4('0xd9')]}})['then'](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});delete this['actions'][_0x522772['linkedid']];break;case'19':_0x5999e6['outboundUnknownCallsDay']+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut[_0x07f4('0xaf')](_0x398bd0);ut['logCustomer'](_0x398bd0,0x13,_0x522772['cause-txt']||_0x522772['dialstatus']);ami[_0x07f4('0x64')](_0x07f4('0xfb'),ut['buildObj'](_0x398bd0,_0x07f4('0xfd')));rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0xfe'));_0x28c530['verifyAdditionalPhones'](_0x398bd0,'18',_0x5999e6)['then'](function(_0x426aed){_0xe1f824=_0x426aed[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut['cloneAction'](_0x398bd0,0xf,_0x07f4('0xe6'));rpcDb[_0x07f4('0xb1')](_0x5782d3,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0xfe'));}}else{_0x398bd0[_0x07f4('0xd9')]++;_0x28c530['incrementPreviewCounters']({'id':_0x398bd0[_0x07f4('0xb7')],'field':{'countnoanswerretry':_0x398bd0[_0x07f4('0xd9')]}})[_0x07f4('0x93')](function(){_0x28c530[_0x07f4('0xb9')](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});});}});delete this[_0x07f4('0x75')][_0x522772['linkedid']];break;default:if(_0x398bd0['dialAnswer']){ut[_0x07f4('0xc5')](_0x5999e6,_0x07f4('0xff'));ut[_0x07f4('0x85')](_0x07f4('0x100')+_0x5999e6[_0x07f4('0x2a')],_0x522772);}_0x5999e6[_0x07f4('0x48')]+=0x1;_0x398bd0[_0x07f4('0xa6')]=ut['totalGlobal'](_0x398bd0);ut[_0x07f4('0x97')](_0x398bd0,0xc,_0x522772[_0x07f4('0xf9')]||_0x522772[_0x07f4('0xfa')]);_0x2b70dc=_0x5999e6[_0x07f4('0xf2')];_0x59e3af=_0x5999e6['callAdditionalPhoneAfterMin'];rpcDb[_0x07f4('0x9a')](_0x398bd0,_0x07f4('0x101'));_0x28c530[_0x07f4('0xab')](_0x398bd0,'20',_0x5999e6)['then'](function(_0x2fadcd){_0xe1f824=_0x2fadcd[_0x07f4('0xac')]==0x1;if(!_0xe1f824){if(ut[_0x07f4('0xaf')](_0x398bd0)>=_0x5999e6[_0x07f4('0xd3')]){_0x5782d3=ut['cloneAction'](_0x398bd0,0xf,_0x07f4('0xe6'));rpcDb[_0x07f4('0xb1')](_0x5782d3,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x07f4('0xb1')](_0x398bd0,_0x07f4('0x102'));}delete this[_0x07f4('0x75')][_0x522772['linkedid']];}else{_0x28c530['swapAdditionalPhones'](_0x398bd0,_0x2b70dc,_0x59e3af)[_0x07f4('0x93')](function(){});}});}if(!(_0x398bd0[_0x07f4('0x84')]&&_0x2d1a68==='16')){ut[_0x07f4('0x83')](_0x5999e6,_0x07f4('0x103'));logger[_0x07f4('0x61')](_0x07f4('0x104'),_0x398bd0[_0x07f4('0xcc')],_0x07f4('0xbf'),_0x5999e6['name'],'originated:\x20',_0x5999e6[_0x07f4('0x53')]);}if(_0x2d1a68!==_0x07f4('0xba')){delete this[_0x07f4('0x75')][_0x522772[_0x07f4('0xb5')]];delete this[_0x07f4('0x75')][_0x522772[_0x07f4('0x105')]];}}};Preview['prototype'][_0x07f4('0x106')]=function(_0x474554,_0x3e8076,_0x3ff4e6){if(_['isUndefined'](_0x3e8076)&&_0x07f4('0x107')!==typeof _0x3e8076){return;}if(_[_0x07f4('0x108')](_0x3ff4e6)&&'object'!==typeof _0x3ff4e6){return;}switch(_0x3ff4e6[_0x07f4('0x109')]){case'0':ut[_0x07f4('0x10a')](_0x474554,0x0,_0x07f4('0x10b'));rpcDb[_0x07f4('0x10c')](_0x474554,_0x07f4('0x10d'));break;case'3':ut[_0x07f4('0x10a')](_0x474554,0x3,_0x07f4('0xda'));rpcDb[_0x07f4('0x10c')](_0x474554,_0x07f4('0x10e'));break;case'5':ut[_0x07f4('0x10a')](_0x474554,0x5,_0x07f4('0xcf'));rpcDb[_0x07f4('0x10c')](_0x474554,_0x07f4('0x10f'));break;case'8':ut[_0x07f4('0x10a')](_0x474554,0x8,_0x07f4('0x110'));rpcDb[_0x07f4('0x10c')](_0x474554,_0x07f4('0x111'));break;case'22':ut[_0x07f4('0x10a')](_0x474554,0x16,'AnswerAGI');rpcDb[_0x07f4('0x10c')](_0x474554,_0x07f4('0x112'));break;default:ut['logAgent'](_0x474554,0xc,_0x3ff4e6[_0x07f4('0x109')]);rpcDb[_0x07f4('0x10c')](_0x474554,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x3e8076,'[callProgressDetectingAgent]');logger[_0x07f4('0x61')](_0x07f4('0x113'),_0x474554['uniqueid'],_0x07f4('0xbf'),_0x3e8076[_0x07f4('0x2a')],'originated:\x20',_0x3e8076['originated']);delete this[_0x07f4('0x75')][_0x474554[_0x07f4('0xcc')]];};Preview[_0x07f4('0x12')][_0x07f4('0xab')]=function(_0x3093a3,_0x3e2482,_0x34692e){return Promise[_0x07f4('0x114')]()['then'](cmHopperAdditionalPhone[_0x07f4('0xab')](_0x3093a3,_0x3e2482,_0x34692e))['catch'](logger[_0x07f4('0x61')](_0x07f4('0x115')));};Preview[_0x07f4('0x12')][_0x07f4('0xb9')]=function(_0x56f744,_0x367331,_0x2ec2e2){return Promise[_0x07f4('0x114')]()['then'](cmHopperAdditionalPhone[_0x07f4('0xb9')](_0x56f744,_0x367331,_0x2ec2e2))['catch'](logger['info'](_0x07f4('0x116')));};Preview[_0x07f4('0x12')]['incrementPreviewCounters']=function(_0x39a620){return Promise[_0x07f4('0x114')]()[_0x07f4('0x93')](cmHopperAdditionalPhone[_0x07f4('0xb8')](_0x39a620))[_0x07f4('0x81')](logger[_0x07f4('0x61')](_0x07f4('0x117')));};Preview['prototype'][_0x07f4('0x118')]=function(_0x4b3e6b,_0x20c396,_0x27086d,_0x18654f,_0x5b8500){var _0x50f0e2=this;return new Promise(function(_0x25b1c4,_0x56fc07){if(_[_0x07f4('0x8c')](_0x20c396)||_[_0x07f4('0x8c')](_0x20c396[_0x07f4('0x119')])||_['isNil'](_0x20c396[_0x07f4('0x11a')])||_[_0x07f4('0x8c')](_0x20c396[_0x07f4('0x7d')])){_0x56fc07(ut[_0x07f4('0x82')](_0x07f4('0x11b'),_0x18654f,_0x5b8500));return;}var _0xc2627b=uuid['v4']();var _0x19fa3f=_0x50f0e2['campaignsPreview'][_0x20c396[_0x07f4('0x77')][_0x07f4('0x2a')]];var _0x476126=_0x27086d?_0x50f0e2[_0x07f4('0x19')][_0x27086d]['id']:undefined;_0x50f0e2['actions'][_0xc2627b]=new Action(_0x20c396,_0x19fa3f,_0xc2627b,_0x27086d,_0x476126);var _0xdbc40c=_0x50f0e2[_0x07f4('0x75')][_0xc2627b];_0xdbc40c['unlockAgent']=_0x18654f;_0xdbc40c['activeContact']=_0x5b8500;_0xdbc40c[_0x07f4('0x11c')]=_0x27086d;if(_['isEmpty'](_0x4b3e6b)){_0x50f0e2[_0x07f4('0x11d')](_0xdbc40c,_0x19fa3f,_0x20c396,_0x27086d)[_0x07f4('0x93')](function(_0x453489){logger[_0x07f4('0x61')](_0x07f4('0x11e'),_0x07f4('0x11f')+_0xdbc40c[_0x07f4('0x78')]+_0x07f4('0x120')+_0xdbc40c[_0x07f4('0xb7')],JSON['stringify'](_0x453489));ami[_0x07f4('0x64')](_0x07f4('0x121'),ut[_0x07f4('0xa8')](_0xdbc40c,_0x07f4('0x122'),_0x50f0e2[_0x07f4('0x16')][_0xdbc40c[_0x07f4('0x78')]]));_0x25b1c4(ut[_0x07f4('0x82')](_0x07f4('0x123')));})[_0x07f4('0x81')](function(_0x28c0dd){ut[_0x07f4('0x69')](_0x07f4('0x124'),_0x28c0dd);_0x56fc07(ut[_0x07f4('0x82')](_0x07f4('0x125'),_0x18654f,_0x5b8500));});}else{_0x19fa3f[_0x07f4('0x3e')]+=0x1;ut[_0x07f4('0x126')](_0xdbc40c);rpcDb['createHistory'](_0xdbc40c,'[Blacklist][error]');delete _0x50f0e2[_0x07f4('0x75')][_0xc2627b];_0x56fc07(ut['message'](_0x07f4('0x127'),_0x18654f,_0x5b8500));}});};Preview[_0x07f4('0x12')][_0x07f4('0xa2')]=function(_0x4a6e32){return!_[_0x07f4('0x8c')](_0x4a6e32)&&!_[_0x07f4('0x8c')](_0x4a6e32['name'])&&!_[_0x07f4('0x8c')](_0x4a6e32['active'])&&_0x4a6e32[_0x07f4('0x5a')]&&!_[_0x07f4('0x8c')](this['trunks'][util['format'](_0x07f4('0x128'),_0x4a6e32['name'])])&&!_[_0x07f4('0x8c')](this[_0x07f4('0x18')][util[_0x07f4('0x5e')](_0x07f4('0x128'),_0x4a6e32[_0x07f4('0x2a')])][_0x07f4('0x129')])&&(this[_0x07f4('0x18')][util[_0x07f4('0x5e')]('SIP/%s',_0x4a6e32['name'])][_0x07f4('0x129')]===_0x07f4('0x12a')||this[_0x07f4('0x18')][util[_0x07f4('0x5e')](_0x07f4('0x128'),_0x4a6e32[_0x07f4('0x2a')])][_0x07f4('0x129')]===_0x07f4('0x12b'));};Preview[_0x07f4('0x12')]['run']=function(_0x5beced,_0x2379c7){var _0x557012=this;return new Promise(function(_0x37f620,_0x12e6c6){_0x557012[_0x07f4('0x12c')](_0x5beced,_0x2379c7)['then'](function(_0x42ff6d){_0x37f620(_['pick'](_0x42ff6d,[_0x07f4('0x82')]));})[_0x07f4('0x81')](function(_0x450c6c){if(_0x450c6c[_0x07f4('0x12d')]){rpcDb['unlockContact'](_0x5beced);}if(_0x450c6c[_0x07f4('0x5a')]){rpcDb[_0x07f4('0x12e')](_0x5beced);}_0x12e6c6(_['pick'](_0x450c6c,[_0x07f4('0x82')]));});});};Preview[_0x07f4('0x12')][_0x07f4('0x12c')]=function(_0x32d1a1,_0x48f965){var _0x2423c0=this;return new Promise(function(_0x1178f2,_0x5ab3a2){var _0x5880a9,_0x44e74b;rpcDb['getContactPreview'](_0x32d1a1)['then'](function(_0x357c40){if(!_[_0x07f4('0x8c')](_0x357c40[0x0])){_0x44e74b=_0x357c40[0x0][_0x07f4('0x12f')]?![]:!![];_0x5880a9=_0x357c40[0x0]['recallme']?!![]:![];_0x5880a9=_0x48f965?!![]:_0x5880a9;}var _0xf339=_0x2423c0[_0x07f4('0x130')](_0x357c40);if(_0xf339[_0x07f4('0x131')]){rpcDb[_0x07f4('0x132')](_['pick'](_0x357c40[0x0],[_0x07f4('0x7d'),_0x07f4('0x11a')]))[_0x07f4('0x93')](function(_0x58f713){_0x2423c0[_0x07f4('0x118')](_0x58f713,_0x357c40[0x0],_0x48f965,_0x44e74b,_0x5880a9)[_0x07f4('0x93')](function(_0x4037e9){_0x1178f2(_0x4037e9);})[_0x07f4('0x81')](function(_0x545b96){_0x5ab3a2(_0x545b96);});})['catch'](function(_0xca384a){ut[_0x07f4('0x69')](_0x07f4('0x133'),_0xca384a);_0x5ab3a2(ut[_0x07f4('0x82')](_0x07f4('0x134'),_0x44e74b,_0x5880a9));});}else{_0x5ab3a2(ut[_0x07f4('0x82')](_0xf339[_0x07f4('0x82')],_0x44e74b,_0x5880a9));}})[_0x07f4('0x81')](function(_0x5510df){ut['logger'](_0x07f4('0x135'),_0x5510df);_0x5ab3a2(ut['message'](_0x07f4('0x134'),![],!![]));});});};Preview['prototype'][_0x07f4('0x130')]=function(_0x3f1ee5){if(_[_0x07f4('0x8c')](_0x3f1ee5)||_['isEmpty'](_0x3f1ee5)||!_['isNil'](_0x3f1ee5[0x0][_0x07f4('0x90')])&&_[_0x07f4('0x8c')](_0x3f1ee5[0x0]['Agent'][_0x07f4('0x2a')])){ut[_0x07f4('0x69')]('[Preview][validateContact][Empty\x20Contact]',_0x3f1ee5);return{'isValid':![],'message':_0x07f4('0x136')};}var _0x13e1be=this[_0x07f4('0x16')][_0x3f1ee5[0x0]['Queue'][_0x07f4('0x2a')]];_0x13e1be[_0x07f4('0x82')]=_0x07f4('0xa3');if(_[_0x07f4('0x8c')](_0x13e1be)){ut[_0x07f4('0x69')]('[Preview][validateContact][Empty\x20Campaign]',_0x13e1be);return{'isValid':![],'message':_0x07f4('0x137')};}if(!this['isTrunkReachable'](_0x13e1be[_0x07f4('0x59')])){ut[_0x07f4('0x69')](_0x07f4('0x138'),_0x07f4('0x139')+_0x13e1be[_0x07f4('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x07f4('0xa2')](_0x13e1be['TrunkBackup'])){ut[_0x07f4('0x69')](_0x07f4('0x138'),_0x13e1be[_0x07f4('0x2a')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x07f4('0x13a')};}}if(!ut[_0x07f4('0xa1')](_0x13e1be[_0x07f4('0x37')])){ut[_0x07f4('0x69')](_0x07f4('0x13b'),_0x13e1be['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x07f4('0x139')+_0x13e1be['name']+_0x07f4('0x13c')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x07f4('0x11d')]=function(_0x23cb86,_0x4ede20,_0x2686a3,_0x391069){var _0x490bac=this;return new Promise(function(_0x565c75,_0xd6551e){var _0x380cd8=_0x23cb86[_0x07f4('0xcc')];var _0x4089f2=_0x490bac[_0x07f4('0xa2')](_0x4ede20[_0x07f4('0x59')])?util[_0x07f4('0x5e')](_0x07f4('0x13d'),_0x4ede20[_0x07f4('0x59')][_0x07f4('0x2a')],_['isNil'](_0x4ede20['dialPrefix'])?'':_0x4ede20[_0x07f4('0x3b')][_0x07f4('0x13e')]()||'',_0x4ede20[_0x07f4('0x13f')]>0x0?_0x2686a3[_0x07f4('0x11a')][_0x07f4('0x140')](_0x4ede20[_0x07f4('0x13f')]):_0x2686a3[_0x07f4('0x11a')]):util[_0x07f4('0x5e')]('SIP/%s/%s%s',_[_0x07f4('0x8c')](_0x4ede20['TrunkBackup'])?_0x4ede20[_0x07f4('0x59')][_0x07f4('0x2a')]:_0x4ede20[_0x07f4('0x141')][_0x07f4('0x2a')],_['isNil'](_0x4ede20['dialPrefix'])?'':_0x4ede20[_0x07f4('0x3b')][_0x07f4('0x13e')]()||'',_0x4ede20[_0x07f4('0x13f')]>0x0?_0x2686a3['phone'][_0x07f4('0x140')](_0x4ede20[_0x07f4('0x13f')]):_0x2686a3[_0x07f4('0x11a')]);var _0x45d039=_0x490bac[_0x07f4('0xa2')](_0x4ede20['Trunk'])?ut[_0x07f4('0x142')](_0x4ede20[_0x07f4('0x59')][_0x07f4('0x5b')],_0x4ede20[_0x07f4('0x39')],_0x4ede20[_0x07f4('0x143')]>0x0?ut[_0x07f4('0x144')](_0x4ede20['dialOriginateCallerIdNumber'],_0x4ede20['dialRandomLastDigitCallerIdNumber']):_0x4ede20[_0x07f4('0x3a')]):ut[_0x07f4('0x142')](_[_0x07f4('0x8c')](_0x4ede20['TrunkBackup'])?_0x4ede20[_0x07f4('0x59')][_0x07f4('0x5b')]:_0x4ede20['TrunkBackup']['callerid'],_0x4ede20[_0x07f4('0x39')],_0x4ede20[_0x07f4('0x143')]>0x0?ut[_0x07f4('0x144')](_0x4ede20[_0x07f4('0x3a')],_0x4ede20[_0x07f4('0x143')]):_0x4ede20[_0x07f4('0x3a')]);if(_0x45d039){_0x23cb86[_0x07f4('0x145')]=ut[_0x07f4('0x146')](_0x45d039);_0x23cb86['originatecalleridnum']=ut[_0x07f4('0x147')](_0x45d039);}var _0x347f71=ut[_0x07f4('0x148')](_0x4ede20,_0x2686a3,_0x4089f2,_0x45d039,_0x380cd8,_0x23cb86);_[_0x07f4('0x149')](_0x23cb86,ut[_0x07f4('0x14a')](_0x347f71));_0x23cb86['starttime']=moment()[_0x07f4('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ede20[_0x07f4('0x14b')]=_0x347f71;ami['Action'](ut[_0x07f4('0x14c')](_0x23cb86,_0x4ede20,_0x347f71,_0x23cb86['activeContact'],_0x391069))[_0x07f4('0x93')](function(_0x2f021d){_0x4ede20[_0x07f4('0x53')]+=0x1;logger['info'](_0x07f4('0x14d'),_0x380cd8,_0x07f4('0xbf'),_0x4ede20[_0x07f4('0x2a')],_0x07f4('0x79'),_0x4ede20[_0x07f4('0x53')]);_0x565c75(_0x2f021d);})[_0x07f4('0x81')](function(_0x260f5a){ut[_0x07f4('0x10a')](_0x23cb86,0xe,'OriginateError');rpcDb[_0x07f4('0x10c')](_0x23cb86,_0x07f4('0x14e'));_0xd6551e(_0x260f5a);});});};Preview['prototype'][_0x07f4('0x14f')]=function(_0x248cff){if(this['actions'][_0x248cff[_0x07f4('0xb5')]]){this[_0x07f4('0x75')][_0x248cff[_0x07f4('0xb5')]][_0x07f4('0x80')]=_0x248cff['channel'];}};Preview[_0x07f4('0x12')]['syncOriginateResponse']=function(_0x35c923){var _0x104c84=this;var _0x6992a0=this[_0x07f4('0x75')][_0x35c923[_0x07f4('0x150')]];if(_0x6992a0){if(_0x6992a0['lookAgent']&&this[_0x07f4('0x19')][_0x6992a0['lookAgent']]){ut['logLookAgent'](_0x6992a0,this[_0x07f4('0x19')][_0x6992a0['lookAgent']][_0x07f4('0x2a')],this[_0x07f4('0x19')][_0x6992a0[_0x07f4('0x11c')]]['id']);}var _0x2235b0=_[_0x07f4('0x151')](_0x6992a0);_0x2235b0[_0x07f4('0xbc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x585214=_0x104c84[_0x07f4('0x16')][_0x6992a0[_0x07f4('0x78')]];if(ut['isFailure'](_0x35c923[_0x07f4('0x152')])){if(_0x6992a0[_0x07f4('0xd7')]){rpcDb[_0x07f4('0x153')](_0x6992a0[_0x07f4('0xb7')]);}if(_0x6992a0[_0x07f4('0xb4')]){rpcDb[_0x07f4('0x12e')](_0x6992a0['idContact']);}ami[_0x07f4('0x64')]('custom:agentringnoanswer',ut['buildObj'](_0x6992a0,_0x07f4('0x154'),this[_0x07f4('0x16')][_0x6992a0[_0x07f4('0x78')]]));this['callProgressDetectingAgent'](_0x2235b0,_0x585214,_0x35c923);}else{_0x6992a0[_0x07f4('0x96')]=moment()[_0x07f4('0x5e')](_0x07f4('0xbb'));ut['logAgent'](_0x2235b0,0x4,'Answer');rpcDb[_0x07f4('0x10c')](_0x2235b0,_0x07f4('0x155'));}}};Preview[_0x07f4('0x12')]['syncHangup']=function(_0x2b6f2b){var _0x40e61f=this[_0x07f4('0x75')][_0x2b6f2b[_0x07f4('0xb5')]];var _0x44c0d9;if(_0x40e61f){_0x44c0d9=this[_0x07f4('0x16')][_0x40e61f[_0x07f4('0x78')]];logger['info'](_0x07f4('0x156'),_0x2b6f2b[_0x07f4('0xb5')],_0x07f4('0xbf'),_0x44c0d9[_0x07f4('0x2a')],_0x07f4('0xc0'),_0x44c0d9[_0x07f4('0x2e')]);}if(this[_0x07f4('0x75')][_0x2b6f2b['linkedid']]&&_0x2b6f2b[_0x07f4('0xb5')]!==_0x2b6f2b[_0x07f4('0xcc')]){if(_0x2b6f2b[_0x07f4('0x157')]==='16'&&this[_0x07f4('0x75')][_0x2b6f2b['linkedid']][_0x07f4('0x84')]){this[_0x07f4('0xa4')](_0x2b6f2b,_0x2b6f2b[_0x07f4('0xb5')],_0x2b6f2b[_0x07f4('0x157')]);}else if(this[_0x07f4('0x75')][_0x2b6f2b['linkedid']][_0x07f4('0x84')]){logger[_0x07f4('0x61')](_0x07f4('0x158'),_0x2b6f2b[_0x07f4('0xb5')],_0x2b6f2b[_0x07f4('0x157')],'\x20Queue',_0x44c0d9[_0x07f4('0x2a')],_0x07f4('0xc0'),_0x44c0d9[_0x07f4('0x2e')]);this[_0x07f4('0xa4')](_0x2b6f2b,_0x2b6f2b[_0x07f4('0xb5')],_0x2b6f2b[_0x07f4('0x157')]);}}else if(_0x40e61f&&_[_0x07f4('0x8c')](_0x40e61f[_0x07f4('0x159')])&&_0x44c0d9[_0x07f4('0x15a')]&&_0x2b6f2b[_0x07f4('0xb5')]===_0x2b6f2b[_0x07f4('0xcc')]&&_['isNil'](_0x2b6f2b['reason'])&&_0x2b6f2b[_0x07f4('0x157')]==='16'&&_0x2b6f2b[_0x07f4('0x15b')]==='6'&&_['isUndefined'](_0x40e61f[_0x07f4('0x15c')])){if(_0x40e61f[_0x07f4('0xd7')]){rpcDb[_0x07f4('0x153')](_0x40e61f[_0x07f4('0xb7')]);}if(_0x40e61f['activeContact']){rpcDb['disableContact'](_0x40e61f['idContact']);}_0x2b6f2b[_0x07f4('0x109')]='22';this['callProgressDetectingAgent'](_0x40e61f,_0x44c0d9,_0x2b6f2b);}else if(_0x40e61f&&_0x40e61f[_0x07f4('0x15c')]){if(_0x2b6f2b[_0x07f4('0x157')]==='16'&&this['actions'][_0x2b6f2b[_0x07f4('0xb5')]][_0x07f4('0x84')]){logger['info'](_0x07f4('0x15d'),_0x2b6f2b['linkedid'],_0x2b6f2b[_0x07f4('0x157')],_0x07f4('0xbf'),_0x44c0d9[_0x07f4('0x2a')],'pTalking:\x20',_0x44c0d9[_0x07f4('0x2e')]);this[_0x07f4('0xa4')](_0x2b6f2b,_0x2b6f2b['linkedid'],_0x2b6f2b[_0x07f4('0x157')]);}else if(this[_0x07f4('0x75')][_0x2b6f2b['linkedid']][_0x07f4('0x84')]){logger[_0x07f4('0x61')]('[syncHangup][talking][cause]',_0x2b6f2b['linkedid'],_0x2b6f2b[_0x07f4('0x157')],_0x07f4('0xbf'),_0x44c0d9[_0x07f4('0x2a')],_0x07f4('0xc0'),_0x44c0d9[_0x07f4('0x2e')]);this[_0x07f4('0xa4')](_0x2b6f2b,_0x2b6f2b[_0x07f4('0xb5')],_0x2b6f2b[_0x07f4('0x157')]);}}};Preview[_0x07f4('0x12')][_0x07f4('0x22')]=function(_0x225997){if(this[_0x07f4('0x75')][_0x225997[_0x07f4('0x105')]]&&_0x225997[_0x07f4('0x105')]!==_0x225997['destuniqueid']){this['callProgressDetectingCustomer'](_0x225997,_0x225997[_0x07f4('0x105')],_0x225997[_0x07f4('0xfa')]);}};Preview[_0x07f4('0x12')][_0x07f4('0x20')]=function(_0x4bfbcb){if(this['actions'][_0x4bfbcb[_0x07f4('0xb5')]]&&_0x4bfbcb[_0x07f4('0xb5')]!==_0x4bfbcb[_0x07f4('0xcc')]&&!this[_0x07f4('0x75')][_0x4bfbcb[_0x07f4('0xb5')]][_0x07f4('0x84')]){if(_0x4bfbcb[_0x07f4('0x157')]==='1'){this[_0x07f4('0xa4')](_0x4bfbcb,_0x4bfbcb[_0x07f4('0xb5')],_0x4bfbcb['cause']);}}};Preview[_0x07f4('0x12')][_0x07f4('0x15e')]=function(_0x54069c,_0x2c9f93,_0x3a117a){if(this[_0x07f4('0x75')][_0x54069c]){if(_['isNil'](this[_0x07f4('0x75')][_0x54069c]['variables'])){this[_0x07f4('0x75')][_0x54069c][_0x07f4('0x14b')]={};}this[_0x07f4('0x75')][_0x54069c][_0x07f4('0x14b')][_0x2c9f93]=_0x3a117a;}};Preview[_0x07f4('0x12')]['syncVarSet']=function(_0x729bcf){try{if(!_[_0x07f4('0x8c')](_0x729bcf)){if(ut[_0x07f4('0x15f')](_[_0x07f4('0x160')](_0x729bcf['variable'])[0x0])){this['addVariable'](_0x729bcf['uniqueid'],_[_0x07f4('0x160')](_0x729bcf[_0x07f4('0x161')])[0x0],_0x729bcf[_0x07f4('0x162')]);}}}catch(_0x1a249c){logger[_0x07f4('0x163')](_0x07f4('0x164'),util[_0x07f4('0x165')](_0x1a249c,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x07f4('0x166')]=function(_0x2e790f){if(_0x2e790f){if(this[_0x07f4('0x75')][_0x2e790f[_0x07f4('0x167')]]){this[_0x07f4('0x75')][_0x2e790f[_0x07f4('0x167')]][_0x07f4('0x15c')]=!![];}}};Preview[_0x07f4('0x12')][_0x07f4('0x26')]=function(_0x2d6be8){if(_0x2d6be8){if(this[_0x07f4('0x75')][_0x2d6be8[_0x07f4('0x168')]]){this[_0x07f4('0x75')][_0x2d6be8[_0x07f4('0x168')]]['transfer']=!![];}}};module[_0x07f4('0x169')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 009a900..a1969a9 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 _0xcbc9=['context','exten','xcally-motion-preview','holdtime','assigned','membername','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','error','then','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','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'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0xcbc9,0x10f));var _0x9cbc=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xcbc9[_0x5c3c0b];return _0x52ecd2;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x9cbc('0x0'));var _=require(_0x9cbc('0x1'));var cmHopper=require(_0x9cbc('0x2'));var cmHopperFinal=require(_0x9cbc('0x3'));var cmHopperHistory=require(_0x9cbc('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9cbc('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3e1da6){return function(_0x8d56cc){logger[_0x9cbc('0x6')](_0x3e1da6,util['inspect'](_0x8d56cc,{'showHidden':![],'depth':null}));};}function create(_0x15b2e3){return BPromise['resolve']()[_0x9cbc('0x7')](cmHopperHistory['createHistory'](_0x15b2e3))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0x9')));}function createAgent(_0x41eb2c){return BPromise[_0x9cbc('0xa')]()['then'](agentReportPreview['createHistory'](_0x41eb2c))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0x9')));}function moveContact(_0x549798){return BPromise[_0x9cbc('0xa')]()[_0x9cbc('0x7')](cmHopper[_0x9cbc('0xb')](_0x549798,!![]))[_0x9cbc('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9cbc('0xc')]=function(_0x59d841){return BPromise['resolve']()[_0x9cbc('0x7')](cmHopperBlack[_0x9cbc('0xc')](_0x59d841))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0xd')));};exports[_0x9cbc('0xe')]=function(_0x27aeba){return BPromise[_0x9cbc('0xa')]()[_0x9cbc('0x7')](cmHopper[_0x9cbc('0xe')](_0x27aeba))['catch'](loggerCatch(_0x9cbc('0xf')));};exports[_0x9cbc('0x10')]=function(_0x51754f,_0x4fef1c){create(_0x51754f)['catch'](loggerCatch(_0x4fef1c));moveContact(_0x51754f)['catch'](loggerCatch(_0x4fef1c));};exports[_0x9cbc('0x11')]=function(_0x3dc6f7,_0x2c89a3){createAgent(_0x3dc6f7)[_0x9cbc('0x8')](loggerCatch(_0x2c89a3));};exports[_0x9cbc('0x12')]=function(_0xdf423c,_0x5d07a4){create(_0xdf423c)['catch'](loggerCatch(_0x5d07a4));};exports['createCustomerFinal']=function(_0x37f1d8,_0x14a27e){moveContact(_0x37f1d8)[_0x9cbc('0x8')](loggerCatch(_0x14a27e));};exports[_0x9cbc('0x13')]=function(_0x32dd98,_0x64697,_0xfad700){if(_0x64697){_0x32dd98[_0x9cbc('0x14')]=null;}if(_0xfad700){_0x32dd98[_0x9cbc('0x15')]=![];}return BPromise[_0x9cbc('0xa')]()[_0x9cbc('0x7')](cmHopper['rescheduleContact'](_0x32dd98))['catch'](loggerCatch(_0x9cbc('0x16')));};exports[_0x9cbc('0x17')]=function(_0x31874f){return BPromise[_0x9cbc('0xa')]()[_0x9cbc('0x7')](cmHopper[_0x9cbc('0x17')](_0x31874f))['catch'](loggerCatch(_0x9cbc('0x18')));};exports[_0x9cbc('0x19')]=function(_0x189bd0){return BPromise['resolve']()[_0x9cbc('0x7')](cmHopper['unlockContact']({'UserId':null},_0x189bd0,0x1))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0x1a')));};exports[_0x9cbc('0x1b')]=function(_0x55ef1a){return BPromise[_0x9cbc('0xa')]()['then'](cmHopper[_0x9cbc('0x19')]({'active':![]},_0x55ef1a,0x1))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0x1c')));};exports[_0x9cbc('0x1d')]=function(_0x291e8b){var _0x706a72={};_0x706a72['type']=_0x291e8b[_0x9cbc('0x1e')];_0x706a72[_0x9cbc('0x1f')]=_0x291e8b[_0x9cbc('0x1f')];_0x706a72[_0x9cbc('0x20')]=_0x291e8b[_0x9cbc('0x20')];_0x706a72[_0x9cbc('0x21')]=_0x291e8b[_0x9cbc('0x21')];_0x706a72['queue']=_0x291e8b[_0x9cbc('0x22')];_0x706a72[_0x9cbc('0x23')]=_0x291e8b[_0x9cbc('0x24')];_0x706a72[_0x9cbc('0x25')]=_0x291e8b[_0x9cbc('0x24')];_0x706a72[_0x9cbc('0x26')]=0x1;_0x706a72['queuecallercompleteAt']=_0x291e8b[_0x9cbc('0x27')];_0x706a72[_0x9cbc('0x28')]=_0x291e8b['membername'];_0x706a72[_0x9cbc('0x29')]='from-sip';_0x706a72[_0x9cbc('0x2a')]=_0x9cbc('0x2b');_0x706a72[_0x9cbc('0x2c')]=0x0;_0x706a72[_0x9cbc('0x2d')]=0x1;_0x706a72['lastAssignedTo']=_0x291e8b[_0x9cbc('0x2e')];_0x706a72['queuecallerexitreason']=_0x9cbc('0x2f');return BPromise['resolve']()['then'](voiceQueueReport[_0x9cbc('0x30')](_0x706a72))[_0x9cbc('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x9cbc('0x31')]=function(_0x1e91ee,_0x2d4272){return BPromise[_0x9cbc('0xa')]()['then'](cmHopper[_0x9cbc('0x31')](_0x1e91ee,_0x2d4272))[_0x9cbc('0x8')](loggerCatch(_0x9cbc('0x32')));};exports[_0x9cbc('0x33')]=function(_0x2eaca9){return BPromise[_0x9cbc('0xa')]()[_0x9cbc('0x7')](cmHopper[_0x9cbc('0x13')](_0x2eaca9,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xcfe2=['queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcfe2,0x7a));var _0x2cfe=function(_0x21d22b,_0x1ea795){_0x21d22b=_0x21d22b-0x0;var _0x3faeda=_0xcfe2[_0x21d22b];return _0x3faeda;};'use strict';var util=require(_0x2cfe('0x0'));var BPromise=require(_0x2cfe('0x1'));var logger=require('../../../config/logger')(_0x2cfe('0x2'));var _=require('lodash');var cmHopper=require(_0x2cfe('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x2cfe('0x4'));var cmHopperBlack=require(_0x2cfe('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x2cfe('0x6'));var voiceQueueReport=require(_0x2cfe('0x7'));function loggerCatch(_0x39e2ea){return function(_0x259f06){logger[_0x2cfe('0x8')](_0x39e2ea,util[_0x2cfe('0x9')](_0x259f06,{'showHidden':![],'depth':null}));};}function create(_0x3fc12f){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopperHistory['createHistory'](_0x3fc12f))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0xd')));}function createAgent(_0x271324){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](agentReportPreview['createHistory'](_0x271324))[_0x2cfe('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4d5006){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopper[_0x2cfe('0xe')](_0x4d5006,!![]))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0xf')));}exports['checkIsBlackList']=function(_0x180968){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopperBlack['checkIsBlackList'](_0x180968))['catch'](loggerCatch(_0x2cfe('0x10')));};exports[_0x2cfe('0x11')]=function(_0x4d0f1e){return BPromise[_0x2cfe('0xa')]()['then'](cmHopper[_0x2cfe('0x11')](_0x4d0f1e))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0x12')));};exports[_0x2cfe('0x13')]=function(_0x6bbd5a,_0x49a242){create(_0x6bbd5a)[_0x2cfe('0xc')](loggerCatch(_0x49a242));moveContact(_0x6bbd5a)[_0x2cfe('0xc')](loggerCatch(_0x49a242));};exports[_0x2cfe('0x14')]=function(_0x2f5b13,_0x28aea3){createAgent(_0x2f5b13)[_0x2cfe('0xc')](loggerCatch(_0x28aea3));};exports[_0x2cfe('0x15')]=function(_0x27f22a,_0x40f149){create(_0x27f22a)[_0x2cfe('0xc')](loggerCatch(_0x40f149));};exports['createCustomerFinal']=function(_0x5c9b4a,_0x47b0b7){moveContact(_0x5c9b4a)['catch'](loggerCatch(_0x47b0b7));};exports[_0x2cfe('0x16')]=function(_0x229ed5,_0x3edf6b,_0xde1afa){if(_0x3edf6b){_0x229ed5[_0x2cfe('0x17')]=null;}if(_0xde1afa){_0x229ed5[_0x2cfe('0x18')]=![];}return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopper[_0x2cfe('0x16')](_0x229ed5))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0x19')));};exports[_0x2cfe('0x1a')]=function(_0x3f2306){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopper['countReScheduled'](_0x3f2306))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x2cfe('0x1b')]=function(_0x54630c){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopper[_0x2cfe('0x1b')]({'UserId':null},_0x54630c,0x1))[_0x2cfe('0xc')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x40f009){return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](cmHopper[_0x2cfe('0x1b')]({'active':![]},_0x40f009,0x1))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0x1c')));};exports[_0x2cfe('0x1d')]=function(_0x517b37){var _0x177da7={};_0x177da7[_0x2cfe('0x1e')]=_0x517b37['type'];_0x177da7[_0x2cfe('0x1f')]=_0x517b37['uniqueid'];_0x177da7[_0x2cfe('0x20')]=_0x517b37['calleridnum'];_0x177da7[_0x2cfe('0x21')]=_0x517b37[_0x2cfe('0x21')];_0x177da7[_0x2cfe('0x22')]=_0x517b37[_0x2cfe('0x22')];_0x177da7['queuecallerjoinAt']=_0x517b37['answertime'];_0x177da7[_0x2cfe('0x23')]=_0x517b37[_0x2cfe('0x24')];_0x177da7[_0x2cfe('0x25')]=0x1;_0x177da7[_0x2cfe('0x26')]=_0x517b37[_0x2cfe('0x27')];_0x177da7[_0x2cfe('0x28')]=_0x517b37[_0x2cfe('0x29')];_0x177da7['context']=_0x2cfe('0x2a');_0x177da7['exten']=_0x2cfe('0x2b');_0x177da7['holdtime']=0x0;_0x177da7[_0x2cfe('0x2c')]=0x1;_0x177da7[_0x2cfe('0x2d')]=_0x517b37['membername'];_0x177da7[_0x2cfe('0x2e')]=_0x2cfe('0x2f');return BPromise[_0x2cfe('0xa')]()[_0x2cfe('0xb')](voiceQueueReport[_0x2cfe('0x30')](_0x177da7))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0x31')));};exports['getContactRecallMe']=function(_0x42babc,_0x13c703){return BPromise[_0x2cfe('0xa')]()['then'](cmHopper['getContactRecallMe'](_0x42babc,_0x13c703))['catch'](loggerCatch(_0x2cfe('0x32')));};exports[_0x2cfe('0x33')]=function(_0x2b17c2){return BPromise[_0x2cfe('0xa')]()['then'](cmHopper[_0x2cfe('0x16')](_0x2b17c2,!![],!![]))[_0x2cfe('0xc')](loggerCatch(_0x2cfe('0x34')));}; \ 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 72390aa..8e31463 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 _0x1fb5=['random','extractCalleridName','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','uniqueid','channelAgent','timeout','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','createBody','idContact','type','campaigntype','dialAnswer','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace'];(function(_0x4b4f59,_0x1e84b4){var _0x844cd6=function(_0x2db2ac){while(--_0x2db2ac){_0x4b4f59['push'](_0x4b4f59['shift']());}};_0x844cd6(++_0x1e84b4);}(_0x1fb5,0x91));var _0x51fb=function(_0x4c84e6,_0xc3d8e7){_0x4c84e6=_0x4c84e6-0x0;var _0x81efbd=_0x1fb5[_0x4c84e6];return _0x81efbd;};'use strict';var util=require(_0x51fb('0x0'));var _=require(_0x51fb('0x1'));var moment=require(_0x51fb('0x2'));var logger=require('../../../../config/logger')(_0x51fb('0x3'));var ipAgi=process[_0x51fb('0x4')][_0x51fb('0x5')]||'127.0.0.1';function getSeconds(_0x436670,_0x33602b){var _0x44007=moment(_0x436670)[_0x51fb('0x6')](0x0);var _0xf80083=moment(_0x33602b)['milliseconds'](0x0);return _0x44007[_0x51fb('0x7')](_0xf80083,_0x51fb('0x8'));}exports['loggerCatch']=function(_0x2aa51e){return function(_0x34c6d5){logger[_0x51fb('0x9')](_0x2aa51e,util[_0x51fb('0xa')](_0x34c6d5,{'showHidden':![],'depth':null}));};};exports[_0x51fb('0xb')]=function(_0x4987c0,_0x22a0f2){logger[_0x51fb('0xc')](_0x4987c0,util['inspect'](_0x22a0f2,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3af8d4,_0x474eb3){logger[_0x51fb('0x9')](_0x3af8d4,util[_0x51fb('0xa')](_0x474eb3,{'showHidden':![],'depth':null}));};exports[_0x51fb('0xd')]=function(_0x360eeb){return function(_0x546bfa){logger['info'](_0x360eeb,util[_0x51fb('0xa')](_0x546bfa,{'showHidden':![],'depth':null}));};};exports[_0x51fb('0xe')]=function(_0x3f6a43,_0x48f555,_0x406d68){return{'message':_0x3f6a43,'unlock':_0x48f555,'active':_0x406d68};};exports[_0x51fb('0xf')]=function(_0x46dd04,_0x5b271c,_0x3b3f48){if(!_[_0x51fb('0x10')](_0x3b3f48)&&_0x51fb('0x11')===typeof _0x3b3f48&&!_['isEmpty'](_0x3b3f48)){if(!_[_0x51fb('0x10')](_0x5b271c)&&_0x51fb('0x11')===typeof _0x5b271c&&!_[_0x51fb('0x12')](_0x5b271c)){return util[_0x51fb('0x13')](_0x51fb('0x14'),_0x5b271c,_0x3b3f48);}return util[_0x51fb('0x13')](_0x51fb('0x14'),_0x3b3f48,_0x3b3f48);}if(!_[_0x51fb('0x10')](_0x46dd04)&&_0x51fb('0x11')===typeof _0x46dd04&&!_[_0x51fb('0x12')](_0x46dd04)){return _0x46dd04;}return _0x51fb('0x15');};exports[_0x51fb('0x16')]=function(_0x55559f){if(_[_0x51fb('0x17')](_0x55559f)){return![];}return _0x55559f;};exports[_0x51fb('0x18')]=function(_0x3df0db,_0x33ff3c,_0x515dc6,_0x3d66a6,_0x371fe8,_0xb0fac5){var _0x459b24={'XMD-QUEUE':_0x33ff3c[_0x51fb('0x19')]?_0x33ff3c[_0x51fb('0x19')][_0x51fb('0x1a')]:'','XMD-CALLERID':_0x3d66a6,'XMD-CALLERID-PREVIEW':_0xb0fac5?util[_0x51fb('0x13')](_0x51fb('0x14'),_0xb0fac5[_0x51fb('0x1b')],_0xb0fac5[_0x51fb('0x1c')]):_0x3d66a6,'XMD-DIALID':_0x371fe8,'XMD-CONTACTID':_0x33ff3c[_0x51fb('0x1d')],'XMD-CDRTYPE':_0x51fb('0x1e'),'CALLERID(all)':_0x3d66a6,'XMD-VOICEQUEUEID':_0x33ff3c[_0x51fb('0x1f')],'XMD-DIALCHANNEL':_0x515dc6,'XMD-DIALTIMEOUT':_0x3df0db[_0x51fb('0x20')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x3df0db['dialQueueProject2']?'g':'',_['isEmpty'](_0x3df0db[_0x51fb('0x21')])?'':_0x51fb('0x22')),'XMD-DIALURL':_0x3df0db[_0x51fb('0x23')]||'','XMD-AGI':_0x3df0db['dialQueueProject']?util[_0x51fb('0x13')](_0x51fb('0x24'),ipAgi,_0x3df0db['dialQueueProject']):_0x51fb('0x25'),'XMD-AGIAFTER':_0x3df0db[_0x51fb('0x26')]?util[_0x51fb('0x13')](_0x51fb('0x24'),ipAgi,_0x3df0db[_0x51fb('0x26')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xb0fac5?_0xb0fac5[_0x51fb('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0xb0fac5?_0xb0fac5[_0x51fb('0x28')]:'','XMD-DESTINATION':_0x51fb('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x51fb('0x12')](_0x3df0db['monitor_format'])){_0x459b24[util[_0x51fb('0x13')]('%s',_0x51fb('0x2a'))]=_0x3df0db[_0x51fb('0x21')];_0x459b24[util['format']('%s',_0x51fb('0x2b'))]=_0x371fe8;}if(_0x33ff3c&&_0x33ff3c['Contact']){for(var _0x4caa93 in _0x33ff3c['Contact']){if(_0x33ff3c[_0x51fb('0x2c')][_0x51fb('0x2d')](_0x4caa93)){if(!_[_0x51fb('0x17')](_0x33ff3c[_0x51fb('0x2c')][_0x4caa93])&&_0x4caa93!=='id'&&_0x4caa93!==_0x51fb('0x2e')&&_0x4caa93!==_0x51fb('0x2f')&&_0x4caa93!=='updatedAt'){_0x459b24[util[_0x51fb('0x13')](_0x51fb('0x30'),_0x51fb('0x31'),_[_0x51fb('0x32')](_0x4caa93))]=_0x33ff3c[_0x51fb('0x2c')][_0x4caa93];}}}}return _0x459b24;};exports[_0x51fb('0x33')]=function(_0x370310){var _0x5cbfe1={};for(var _0x1a62e5 in _0x370310){if(_0x370310[_0x51fb('0x2d')](_0x1a62e5)){_0x5cbfe1[util[_0x51fb('0x13')]('%s',_['toLower'](_0x1a62e5))]=_0x370310[_0x1a62e5];}}return{'variables':_0x5cbfe1};};exports[_0x51fb('0x34')]=function(_0x2d251a,_0xb2eea4){if(!_['isNil'](_0x2d251a)){if(_0x2d251a[_0x51fb('0x2d')]('originated')){if(_0x2d251a[_0x51fb('0x35')]>0x0){_0x2d251a[_0x51fb('0x35')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xb2eea4);}}}else{logger[_0x51fb('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0xb2eea4);}};exports['logBlacklist']=function(_0x36f752){var _0x283fc8=moment()[_0x51fb('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x36f752[_0x51fb('0x36')]=0xd;_0x36f752[_0x51fb('0x37')]=_0x51fb('0x38');_0x36f752[_0x51fb('0x39')]=_0x283fc8;_0x36f752[_0x51fb('0x3a')]=_0x283fc8;_0x36f752[_0x51fb('0x3b')]=_0x283fc8;};exports['logAgent']=function(_0x144844,_0x39d509,_0x54ed9c){var _0x283fea=moment()[_0x51fb('0x13')](_0x51fb('0x3c'));_0x144844[_0x51fb('0x36')]=_0x39d509;_0x144844['statedesc']=_0x54ed9c;_0x144844[_0x51fb('0x3a')]=_0x283fea;_0x144844['ringtime']=getSeconds(_0x144844['responsetime'],_0x144844[_0x51fb('0x39')]);};exports[_0x51fb('0x3d')]=function(_0x18961b,_0x297b3b,_0x5156be){_0x18961b[_0x51fb('0x3e')]=_0x297b3b;_0x18961b[_0x51fb('0x3f')]=_0x5156be;};exports[_0x51fb('0x40')]=function(_0x48f03a,_0x474513,_0x3ad0e0){var _0xffb673=moment()[_0x51fb('0x13')](_0x51fb('0x3c'));_0x48f03a[_0x51fb('0x36')]=_0x474513;_0x48f03a[_0x51fb('0x37')]=_0x3ad0e0;_0x48f03a[_0x51fb('0x3a')]=_0x48f03a[_0x51fb('0x3a')]?_0x48f03a[_0x51fb('0x3a')]:_0xffb673;_0x48f03a[_0x51fb('0x3b')]=_0x48f03a[_0x51fb('0x3b')]?_0x48f03a[_0x51fb('0x3b')]:_0xffb673;_0x48f03a[_0x51fb('0x41')]=getSeconds(_0x48f03a[_0x51fb('0x3a')]||0x0,_0x48f03a[_0x51fb('0x39')]||0x0);_0x48f03a[_0x51fb('0x42')]=_0x48f03a[_0x51fb('0x43')]?getSeconds(_0x48f03a['endtime'],_0x48f03a[_0x51fb('0x43')]):0x0;};exports[_0x51fb('0x44')]=function(_0x59f75c){return _0x59f75c===_0x51fb('0x45');};exports['variablesAction']=function(_0x36f9ee,_0x37d5b2,_0x4bdd26,_0x5c620f,_0x93b4c4){var _0x8c357a=_0x5c620f?'RECALL':_0x36f9ee[_0x51fb('0x1b')];_0x8c357a=_0x93b4c4?'BOOKED':_0x8c357a;return{'actionid':_0x36f9ee[_0x51fb('0x46')],'action':'originate','channel':_0x36f9ee[_0x51fb('0x47')],'callerid':util[_0x51fb('0x13')](_0x51fb('0x14'),_0x8c357a,_0x36f9ee[_0x51fb('0x1c')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4bdd26,'timeout':(_0x37d5b2[_0x51fb('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x36f9ee[_0x51fb('0x46')]};};exports[_0x51fb('0x49')]=function(_0x40ded7){return _0x40ded7[_0x51fb('0x4a')]+_0x40ded7['countcongestionretry']+_0x40ded7['countnoanswerretry']+_0x40ded7[_0x51fb('0x4b')]+_0x40ded7[_0x51fb('0x4c')];};exports[_0x51fb('0x4d')]=function(_0x14195f){var _0x329c49=_['clone'](_0x14195f);_0x329c49[_0x51fb('0x36')]=0xf;_0x329c49[_0x51fb('0x37')]='Global';return _0x329c49;};exports[_0x51fb('0x4e')]=function(_0x451599,_0x3406df,_0xfea371){var _0x34ae6e={};_0x34ae6e[_0x3406df]=_0x451599[_0x3406df];_0x34ae6e['active']=![];_0x34ae6e[_0x51fb('0x4f')]=moment()[_0x51fb('0x50')](_0xfea371,_0x51fb('0x51'))[_0x51fb('0x13')](_0x51fb('0x3c'));_0x34ae6e['ContactId']=_0x451599[_0x51fb('0x1d')];_0x34ae6e['ListId']=_0x451599[_0x51fb('0x52')];_0x34ae6e['VoiceQueueId']=_0x451599[_0x51fb('0x1f')]||undefined;return _0x34ae6e;};exports['decrementTalkink']=function(_0x6257ec,_0x595627){if(!_['isNil'](_0x6257ec)){if(_0x6257ec[_0x51fb('0x53')]>0x0){_0x6257ec[_0x51fb('0x53')]-=0x1;}else{logger[_0x51fb('0x9')](_0x595627,_0x51fb('0x54'));}}else{logger[_0x51fb('0x9')](_0x595627,_0x51fb('0x55'));}};exports['IsNotLoggedIn']=function(_0x5e53b5){if(_0x5e53b5<=0x0){return!![];}return![];};function buildObj(_0x5d2691,_0x180e8b,_0x229e8d){_0x5d2691['lastevent']=_0x180e8b;_0x5d2691[_0x51fb('0x1a')]=_0x5d2691[_0x51fb('0x56')];_0x5d2691[_0x51fb('0x57')]=_0x5d2691[_0x51fb('0x47')];_0x5d2691['motionChannel']='voice';if(_0x229e8d){_0x5d2691['mandatoryDisposition']=_0x229e8d[_0x51fb('0x58')];}return _0x5d2691;}exports[_0x51fb('0x59')]=buildObj;exports[_0x51fb('0x5a')]=function(_0x45509){var _0x45bd75={};_0x45bd75[_0x51fb('0x56')]=_0x45509[_0x51fb('0x56')];_0x45bd75[_0x51fb('0x57')]=_0x45509[_0x51fb('0x47')];_0x45bd75[_0x51fb('0x46')]=_0x45509[_0x51fb('0x46')];return _0x45bd75;};exports[_0x51fb('0x5b')]=function(_0x4bb46b){var _0x20b16a=[];for(var _0x22d815 in _0x4bb46b){if(_0x4bb46b[_0x51fb('0x2d')](_0x22d815)){if(!_['isNil'](_0x4bb46b[_0x22d815])&&_0x4bb46b[_0x22d815]['state']===_0x51fb('0x5c')&&_0x4bb46b[_0x22d815][_0x51fb('0x5d')]===_0x51fb('0x5e')){_0x20b16a[_0x51fb('0x5f')](_0x4bb46b[_0x22d815]['id']);}}}return _0x20b16a;};exports[_0x51fb('0x60')]=function(_0x1aa8d9){var _0x2d0acc=moment()['milliseconds'](0x0);var _0x5164de=moment(_0x1aa8d9)[_0x51fb('0x6')](0x0);return _0x2d0acc['diff'](_0x5164de,'seconds');};exports[_0x51fb('0x61')]=function(_0x49fe2a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x49fe2a['ContactId'],'ListId':_0x49fe2a[_0x51fb('0x52')],'VoiceQueueId':_0x49fe2a[_0x51fb('0x1f')]||undefined,'CampaignId':_0x49fe2a['CampaignId']||undefined};};exports['filterKey']=function(_0x562288){if(_0x562288==='uniqueid'||_0x562288===_0x51fb('0x62')||_0x562288===_0x51fb('0x56')||_0x562288===_0x51fb('0x63')||_0x562288===_0x51fb('0x64')||_0x562288===_0x51fb('0x65')||_0x562288==='membername'||_0x562288==='channelAgent'||_0x562288===_0x51fb('0x1b')||_0x562288===_0x51fb('0x66')||_0x562288===_0x51fb('0x1c')||_0x562288===_0x51fb('0x4f')||_0x562288==='countbusyretry'||_0x562288===_0x51fb('0x67')||_0x562288==='countnoanswerretry'||_0x562288===_0x51fb('0x68')||_0x562288===_0x51fb('0x69')||_0x562288===_0x51fb('0x6a')||_0x562288===_0x51fb('0x6b')||_0x562288===_0x51fb('0x6c')||_0x562288===_0x51fb('0x1d')||_0x562288==='ListId'||_0x562288===_0x51fb('0x3f')||_0x562288===_0x51fb('0x1f')||_0x562288===_0x51fb('0x6d')||_0x562288===_0x51fb('0x6e')||_0x562288===_0x51fb('0x6f')||_0x562288==='xmd-phone'||_0x562288==='xmd-listid'||_0x562288==='xmd-dialurl'||_0x562288===_0x51fb('0x70')||_0x562288===_0x51fb('0x71')||_0x562288===_0x51fb('0x72')||_0x562288===_0x51fb('0x73')||_0x562288===_0x51fb('0x74')||_0x562288==='xmd-cdrtype'||_0x562288==='xmd-callerid'||_0x562288===_0x51fb('0x75')||_0x562288===_0x51fb('0x76')||_0x562288==='rtpaudioqos'||_0x562288===_0x51fb('0x77')||_0x562288==='rtpaudioqosjitter'||_0x562288===_0x51fb('0x78')||_0x562288===_0x51fb('0x79')||_0x562288===_0x51fb('0x7a')||_0x562288==='rtpaudioqosrtt'||_0x562288==='rtpaudioqosrttbridged'||_0x562288==='rtpaudioqos'||_0x562288==='rtpaudioqosbridged'||_0x562288===_0x51fb('0x7b')||_0x562288===_0x51fb('0x78')||_0x562288==='rtpaudioqosloss'||_0x562288===_0x51fb('0x7a')||_0x562288==='rtpaudioqosrtt'||_0x562288===_0x51fb('0x7c')||_0x562288===_0x51fb('0x7d')||_0x562288===_0x51fb('0x7e')||_0x562288===_0x51fb('0x36')||_0x562288===_0x51fb('0x37')){return![];}return!![];};exports[_0x51fb('0x7f')]=function(_0x5a0f3f,_0xe2c794){var _0x275c26,_0xc0798c,_0x2c688e;if(_0xe2c794<=0x0){_0xe2c794=0x1;}_0x275c26=new RegExp(_0x51fb('0x80')+_0xe2c794+'}$');_0xc0798c=Math[_0x51fb('0x81')](0xa,_0xe2c794-0x1);_0x2c688e=Math['pow'](0xa,_0xe2c794)-0x1;return util[_0x51fb('0x13')]('%s',_[_0x51fb('0x82')](_0x5a0f3f,_0x275c26,_[_0x51fb('0x83')](_0xc0798c,_0x2c688e)));};exports[_0x51fb('0x84')]=function(_0x261343){var _0x19c0da=_0x261343['match'](/"(.*?)"/);return _0x19c0da?_0x19c0da[0x1]:_0x261343;};exports['extractCalleridNumber']=function(_0x37f633){var _0x2b4ded=_0x37f633['match'](/<(.*?)>/);return _0x2b4ded?_0x2b4ded[0x1]:_0x37f633;};function buildNoAnswerEventPayload(_0xc46c75,_0x1a8cb4){var _0x15aae9=buildObj(_0xc46c75,_0x51fb('0x85'));if(!_['isEmpty'](_0x1a8cb4[_0x51fb('0x86')])){Object[_0x51fb('0x87')](_0x1a8cb4[_0x51fb('0x86')])['forEach'](function(_0x22b307){_0x15aae9[_0x22b307[_0x51fb('0x88')]()]=_0x1a8cb4['variables'][_0x22b307];});}return _0x15aae9;}exports[_0x51fb('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x3b6b=['error','logger','info','inspect','loggerError','logger2','message','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','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','ringtime','logLookAgent','UserId','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff','createBody','idContact','type','campaigntype','dialAnswer','membername','countbusyretry','countglobal','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch'];(function(_0x22abdb,_0x36ad69){var _0x5f3b8b=function(_0x2e4c6f){while(--_0x2e4c6f){_0x22abdb['push'](_0x22abdb['shift']());}};_0x5f3b8b(++_0x36ad69);}(_0x3b6b,0x8b));var _0xb3b6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b6b[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xb3b6('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xb3b6('0x1'))(_0xb3b6('0x2'));var ipAgi=process[_0xb3b6('0x3')][_0xb3b6('0x4')]||'127.0.0.1';function getSeconds(_0x43a89c,_0x3ef2c2){var _0xf0a5a8=moment(_0x43a89c)[_0xb3b6('0x5')](0x0);var _0xd0c66e=moment(_0x3ef2c2)[_0xb3b6('0x5')](0x0);return _0xf0a5a8[_0xb3b6('0x6')](_0xd0c66e,_0xb3b6('0x7'));}exports[_0xb3b6('0x8')]=function(_0x148b40){return function(_0x2fda7d){logger[_0xb3b6('0x9')](_0x148b40,util['inspect'](_0x2fda7d,{'showHidden':![],'depth':null}));};};exports[_0xb3b6('0xa')]=function(_0x350be5,_0x74264){logger[_0xb3b6('0xb')](_0x350be5,util[_0xb3b6('0xc')](_0x74264,{'showHidden':![],'depth':null}));};exports[_0xb3b6('0xd')]=function(_0x4763d0,_0x2d508f){logger['error'](_0x4763d0,util[_0xb3b6('0xc')](_0x2d508f,{'showHidden':![],'depth':null}));};exports[_0xb3b6('0xe')]=function(_0x5ad4d8){return function(_0x414de6){logger['info'](_0x5ad4d8,util[_0xb3b6('0xc')](_0x414de6,{'showHidden':![],'depth':null}));};};exports[_0xb3b6('0xf')]=function(_0x4cc87f,_0x430588,_0x56e87c){return{'message':_0x4cc87f,'unlock':_0x430588,'active':_0x56e87c};};exports['getCallerId']=function(_0x8fe9b5,_0x4f6c49,_0x15850c){if(!_[_0xb3b6('0x10')](_0x15850c)&&'string'===typeof _0x15850c&&!_[_0xb3b6('0x11')](_0x15850c)){if(!_[_0xb3b6('0x10')](_0x4f6c49)&&'string'===typeof _0x4f6c49&&!_['isEmpty'](_0x4f6c49)){return util[_0xb3b6('0x12')](_0xb3b6('0x13'),_0x4f6c49,_0x15850c);}return util[_0xb3b6('0x12')](_0xb3b6('0x13'),_0x15850c,_0x15850c);}if(!_['isUndefined'](_0x8fe9b5)&&'string'===typeof _0x8fe9b5&&!_[_0xb3b6('0x11')](_0x8fe9b5)){return _0x8fe9b5;}return _0xb3b6('0x14');};exports[_0xb3b6('0x15')]=function(_0x20d2cc){if(_[_0xb3b6('0x16')](_0x20d2cc)){return![];}return _0x20d2cc;};exports['addVariables']=function(_0xce1496,_0x39bee2,_0x5bc7eb,_0x534eaf,_0x56e7b1,_0x1de753){var _0x3b6ab5={'XMD-QUEUE':_0x39bee2[_0xb3b6('0x17')]?_0x39bee2[_0xb3b6('0x17')][_0xb3b6('0x18')]:'','XMD-CALLERID':_0x534eaf,'XMD-CALLERID-PREVIEW':_0x1de753?util['format'](_0xb3b6('0x13'),_0x1de753['calleridname'],_0x1de753[_0xb3b6('0x19')]):_0x534eaf,'XMD-DIALID':_0x56e7b1,'XMD-CONTACTID':_0x39bee2[_0xb3b6('0x1a')],'XMD-CDRTYPE':_0xb3b6('0x1b'),'CALLERID(all)':_0x534eaf,'XMD-VOICEQUEUEID':_0x39bee2[_0xb3b6('0x1c')],'XMD-DIALCHANNEL':_0x5bc7eb,'XMD-DIALTIMEOUT':_0xce1496[_0xb3b6('0x1d')]||0x1e,'XMD-DIALOPTIONS':util[_0xb3b6('0x12')](_0xb3b6('0x1e'),_0xce1496['dialQueueProject2']?'g':'',_[_0xb3b6('0x11')](_0xce1496[_0xb3b6('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xce1496[_0xb3b6('0x20')]||'','XMD-AGI':_0xce1496[_0xb3b6('0x21')]?util[_0xb3b6('0x12')](_0xb3b6('0x22'),ipAgi,_0xce1496['dialQueueProject']):_0xb3b6('0x23'),'XMD-AGIAFTER':_0xce1496[_0xb3b6('0x24')]?util['format'](_0xb3b6('0x22'),ipAgi,_0xce1496['dialQueueProject2']):_0xb3b6('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x1de753?_0x1de753['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x1de753?_0x1de753[_0xb3b6('0x25')]:'','XMD-DESTINATION':_0xb3b6('0x26'),'SIPADDHEADER':_0xb3b6('0x27')};if(!_[_0xb3b6('0x11')](_0xce1496['monitor_format'])){_0x3b6ab5[util[_0xb3b6('0x12')]('%s',_0xb3b6('0x28'))]=_0xce1496[_0xb3b6('0x1f')];_0x3b6ab5[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x56e7b1;}if(_0x39bee2&&_0x39bee2[_0xb3b6('0x29')]){for(var _0x41d77e in _0x39bee2[_0xb3b6('0x29')]){if(_0x39bee2[_0xb3b6('0x29')][_0xb3b6('0x2a')](_0x41d77e)){if(!_[_0xb3b6('0x16')](_0x39bee2[_0xb3b6('0x29')][_0x41d77e])&&_0x41d77e!=='id'&&_0x41d77e!=='tags'&&_0x41d77e!==_0xb3b6('0x2b')&&_0x41d77e!==_0xb3b6('0x2c')){_0x3b6ab5[util[_0xb3b6('0x12')](_0xb3b6('0x2d'),_0xb3b6('0x2e'),_[_0xb3b6('0x2f')](_0x41d77e))]=_0x39bee2[_0xb3b6('0x29')][_0x41d77e];}}}}return _0x3b6ab5;};exports[_0xb3b6('0x30')]=function(_0x385465){var _0x22d805={};for(var _0x49b8f5 in _0x385465){if(_0x385465['hasOwnProperty'](_0x49b8f5)){_0x22d805[util[_0xb3b6('0x12')]('%s',_[_0xb3b6('0x31')](_0x49b8f5))]=_0x385465[_0x49b8f5];}}return{'variables':_0x22d805};};exports[_0xb3b6('0x32')]=function(_0x528b38,_0x5bac13){if(!_[_0xb3b6('0x16')](_0x528b38)){if(_0x528b38[_0xb3b6('0x2a')]('originated')){if(_0x528b38[_0xb3b6('0x33')]>0x0){_0x528b38[_0xb3b6('0x33')]-=0x1;}else{logger[_0xb3b6('0x9')](_0xb3b6('0x34'),_0x5bac13);}}}else{logger[_0xb3b6('0x9')](_0xb3b6('0x35'),_0x5bac13);}};exports[_0xb3b6('0x36')]=function(_0x356e05){var _0x2ece07=moment()[_0xb3b6('0x12')](_0xb3b6('0x37'));_0x356e05[_0xb3b6('0x38')]=0xd;_0x356e05[_0xb3b6('0x39')]=_0xb3b6('0x3a');_0x356e05[_0xb3b6('0x3b')]=_0x2ece07;_0x356e05[_0xb3b6('0x3c')]=_0x2ece07;_0x356e05[_0xb3b6('0x3d')]=_0x2ece07;};exports[_0xb3b6('0x3e')]=function(_0x495bbb,_0x46de93,_0x50a515){var _0xa0360f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x495bbb[_0xb3b6('0x38')]=_0x46de93;_0x495bbb['statedesc']=_0x50a515;_0x495bbb[_0xb3b6('0x3c')]=_0xa0360f;_0x495bbb[_0xb3b6('0x3f')]=getSeconds(_0x495bbb['responsetime'],_0x495bbb['starttime']);};exports[_0xb3b6('0x40')]=function(_0x10e6a2,_0x35207e,_0x2fae3b){_0x10e6a2['membername']=_0x35207e;_0x10e6a2[_0xb3b6('0x41')]=_0x2fae3b;};exports['logCustomer']=function(_0x3ad439,_0x57a1f0,_0x35de93){var _0x30de14=moment()[_0xb3b6('0x12')](_0xb3b6('0x37'));_0x3ad439[_0xb3b6('0x38')]=_0x57a1f0;_0x3ad439[_0xb3b6('0x39')]=_0x35de93;_0x3ad439[_0xb3b6('0x3c')]=_0x3ad439['responsetime']?_0x3ad439['responsetime']:_0x30de14;_0x3ad439['endtime']=_0x3ad439['endtime']?_0x3ad439['endtime']:_0x30de14;_0x3ad439[_0xb3b6('0x3f')]=getSeconds(_0x3ad439['responsetime']||0x0,_0x3ad439[_0xb3b6('0x3b')]||0x0);_0x3ad439[_0xb3b6('0x42')]=_0x3ad439[_0xb3b6('0x43')]?getSeconds(_0x3ad439[_0xb3b6('0x3d')],_0x3ad439['answertime']):0x0;};exports[_0xb3b6('0x44')]=function(_0x3ec0b8){return _0x3ec0b8==='Failure';};exports[_0xb3b6('0x45')]=function(_0x5e3c22,_0x57ed88,_0x3e934b,_0x15da7f,_0x32d2c1){var _0x1b3741=_0x15da7f?_0xb3b6('0x46'):_0x5e3c22['calleridname'];_0x1b3741=_0x32d2c1?_0xb3b6('0x47'):_0x1b3741;return{'actionid':_0x5e3c22[_0xb3b6('0x48')],'action':_0xb3b6('0x49'),'channel':_0x5e3c22[_0xb3b6('0x4a')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x1b3741,_0x5e3c22['calleridnum']),'Exten':_0xb3b6('0x26'),'Context':_0xb3b6('0x4b'),'Priority':'1','variable':_0x3e934b,'timeout':(_0x57ed88[_0xb3b6('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5e3c22[_0xb3b6('0x48')]};};exports[_0xb3b6('0x4d')]=function(_0x36480d){return _0x36480d['countbusyretry']+_0x36480d[_0xb3b6('0x4e')]+_0x36480d['countnoanswerretry']+_0x36480d[_0xb3b6('0x4f')]+_0x36480d['countnosuchnumberretry'];};exports[_0xb3b6('0x50')]=function(_0xbfa21a){var _0x5163b9=_[_0xb3b6('0x51')](_0xbfa21a);_0x5163b9[_0xb3b6('0x38')]=0xf;_0x5163b9['statedesc']=_0xb3b6('0x52');return _0x5163b9;};exports[_0xb3b6('0x53')]=function(_0x12d503,_0x58e025,_0x195aa4){var _0x33592a={};_0x33592a[_0x58e025]=_0x12d503[_0x58e025];_0x33592a[_0xb3b6('0x54')]=![];_0x33592a[_0xb3b6('0x55')]=moment()[_0xb3b6('0x56')](_0x195aa4,'minutes')[_0xb3b6('0x12')](_0xb3b6('0x37'));_0x33592a['ContactId']=_0x12d503[_0xb3b6('0x1a')];_0x33592a[_0xb3b6('0x57')]=_0x12d503['ListId'];_0x33592a[_0xb3b6('0x1c')]=_0x12d503['VoiceQueueId']||undefined;return _0x33592a;};exports[_0xb3b6('0x58')]=function(_0x295648,_0x16f863){if(!_[_0xb3b6('0x16')](_0x295648)){if(_0x295648['pTalking']>0x0){_0x295648[_0xb3b6('0x59')]-=0x1;}else{logger[_0xb3b6('0x9')](_0x16f863,_0xb3b6('0x5a'));}}else{logger['error'](_0x16f863,_0xb3b6('0x5b'));}};exports['IsNotLoggedIn']=function(_0x1a19f4){if(_0x1a19f4<=0x0){return!![];}return![];};function buildObj(_0x1d7299,_0x2a06e7,_0x16dffc){_0x1d7299[_0xb3b6('0x5c')]=_0x2a06e7;_0x1d7299[_0xb3b6('0x18')]=_0x1d7299[_0xb3b6('0x5d')];_0x1d7299['interface']=_0x1d7299[_0xb3b6('0x4a')];_0x1d7299[_0xb3b6('0x5e')]=_0xb3b6('0x5f');if(_0x16dffc){_0x1d7299[_0xb3b6('0x60')]=_0x16dffc['mandatoryDisposition'];}return _0x1d7299;}exports[_0xb3b6('0x61')]=buildObj;exports[_0xb3b6('0x62')]=function(_0x2f222b){var _0x4b58f8={};_0x4b58f8[_0xb3b6('0x5d')]=_0x2f222b[_0xb3b6('0x5d')];_0x4b58f8['interface']=_0x2f222b[_0xb3b6('0x4a')];_0x4b58f8[_0xb3b6('0x48')]=_0x2f222b[_0xb3b6('0x48')];return _0x4b58f8;};exports[_0xb3b6('0x63')]=function(_0xe45017){var _0x35594e=[];for(var _0x2250df in _0xe45017){if(_0xe45017[_0xb3b6('0x2a')](_0x2250df)){if(!_[_0xb3b6('0x16')](_0xe45017[_0x2250df])&&_0xe45017[_0x2250df][_0xb3b6('0x38')]===_0xb3b6('0x64')&&_0xe45017[_0x2250df][_0xb3b6('0x65')]==='reachable'){_0x35594e[_0xb3b6('0x66')](_0xe45017[_0x2250df]['id']);}}}return _0x35594e;};exports[_0xb3b6('0x67')]=function(_0x298255){var _0x493c3d=moment()['milliseconds'](0x0);var _0x1a738e=moment(_0x298255)[_0xb3b6('0x5')](0x0);return _0x493c3d['diff'](_0x1a738e,_0xb3b6('0x7'));};exports[_0xb3b6('0x68')]=function(_0x52f005){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52f005[_0xb3b6('0x1a')],'ListId':_0x52f005[_0xb3b6('0x57')],'VoiceQueueId':_0x52f005[_0xb3b6('0x1c')]||undefined,'CampaignId':_0x52f005['CampaignId']||undefined};};exports['filterKey']=function(_0x584f7f){if(_0x584f7f===_0xb3b6('0x48')||_0x584f7f===_0xb3b6('0x69')||_0x584f7f===_0xb3b6('0x5d')||_0x584f7f===_0xb3b6('0x6a')||_0x584f7f===_0xb3b6('0x6b')||_0x584f7f===_0xb3b6('0x6c')||_0x584f7f===_0xb3b6('0x6d')||_0x584f7f===_0xb3b6('0x4a')||_0x584f7f==='calleridname'||_0x584f7f==='active'||_0x584f7f===_0xb3b6('0x19')||_0x584f7f==='scheduledat'||_0x584f7f===_0xb3b6('0x6e')||_0x584f7f===_0xb3b6('0x4e')||_0x584f7f==='countnoanswerretry'||_0x584f7f===_0xb3b6('0x6f')||_0x584f7f==='callback'||_0x584f7f===_0xb3b6('0x70')||_0x584f7f==='callbackat'||_0x584f7f==='recallme'||_0x584f7f===_0xb3b6('0x1a')||_0x584f7f==='ListId'||_0x584f7f===_0xb3b6('0x41')||_0x584f7f===_0xb3b6('0x1c')||_0x584f7f===_0xb3b6('0x71')||_0x584f7f===_0xb3b6('0x72')||_0x584f7f===_0xb3b6('0x73')||_0x584f7f===_0xb3b6('0x74')||_0x584f7f===_0xb3b6('0x75')||_0x584f7f===_0xb3b6('0x76')||_0x584f7f===_0xb3b6('0x77')||_0x584f7f===_0xb3b6('0x78')||_0x584f7f===_0xb3b6('0x79')||_0x584f7f===_0xb3b6('0x7a')||_0x584f7f==='xmd-contactid'||_0x584f7f===_0xb3b6('0x7b')||_0x584f7f===_0xb3b6('0x7c')||_0x584f7f==='xmd-agiafter'||_0x584f7f===_0xb3b6('0x7d')||_0x584f7f===_0xb3b6('0x7e')||_0x584f7f===_0xb3b6('0x7f')||_0x584f7f===_0xb3b6('0x80')||_0x584f7f===_0xb3b6('0x81')||_0x584f7f===_0xb3b6('0x82')||_0x584f7f===_0xb3b6('0x83')||_0x584f7f==='rtpaudioqosrtt'||_0x584f7f===_0xb3b6('0x84')||_0x584f7f===_0xb3b6('0x7e')||_0x584f7f===_0xb3b6('0x7f')||_0x584f7f===_0xb3b6('0x80')||_0x584f7f===_0xb3b6('0x81')||_0x584f7f===_0xb3b6('0x82')||_0x584f7f==='rtpaudioqoslossbridged'||_0x584f7f===_0xb3b6('0x85')||_0x584f7f==='rtpaudioqosrttbridged'||_0x584f7f===_0xb3b6('0x86')||_0x584f7f===_0xb3b6('0x87')||_0x584f7f===_0xb3b6('0x38')||_0x584f7f===_0xb3b6('0x39')){return![];}return!![];};exports[_0xb3b6('0x88')]=function(_0x4f80e3,_0x3bff5f){var _0x571767,_0x5533c5,_0x315306;if(_0x3bff5f<=0x0){_0x3bff5f=0x1;}_0x571767=new RegExp(_0xb3b6('0x89')+_0x3bff5f+'}$');_0x5533c5=Math[_0xb3b6('0x8a')](0xa,_0x3bff5f-0x1);_0x315306=Math[_0xb3b6('0x8a')](0xa,_0x3bff5f)-0x1;return util[_0xb3b6('0x12')]('%s',_[_0xb3b6('0x8b')](_0x4f80e3,_0x571767,_[_0xb3b6('0x8c')](_0x5533c5,_0x315306)));};exports[_0xb3b6('0x8d')]=function(_0x570cf8){var _0xaad86b=_0x570cf8[_0xb3b6('0x8e')](/"(.*?)"/);return _0xaad86b?_0xaad86b[0x1]:_0x570cf8;};exports[_0xb3b6('0x8f')]=function(_0x513e63){var _0x426e5a=_0x513e63[_0xb3b6('0x8e')](/<(.*?)>/);return _0x426e5a?_0x426e5a[0x1]:_0x513e63;};function buildNoAnswerEventPayload(_0x1d6303,_0x34abd4){var _0x3fe59a=buildObj(_0x1d6303,_0xb3b6('0x90'));if(!_['isEmpty'](_0x34abd4['variables'])){Object['keys'](_0x34abd4[_0xb3b6('0x91')])['forEach'](function(_0x3e904a){_0x3fe59a[_0x3e904a[_0xb3b6('0x92')]()]=_0x34abd4[_0xb3b6('0x91')][_0x3e904a];});}return _0x3fe59a;}exports[_0xb3b6('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9b8e4d8..df606e9 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 _0x6159=['boolean','queuepause','voicequeuechannel','voicechannel','queueadd','string','number'];(function(_0x363606,_0x2b836c){var _0x989729=function(_0x3ef5ad){while(--_0x3ef5ad){_0x363606['push'](_0x363606['shift']());}};_0x989729(++_0x2b836c);}(_0x6159,0x138));var _0x9615=function(_0x44a3bf,_0x5d1eb1){_0x44a3bf=_0x44a3bf-0x0;var _0x99e210=_0x6159[_0x44a3bf];return _0x99e210;};'use strict';exports[_0x9615('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9615('0x1'),'required':!![]},'membername':{'type':_0x9615('0x1'),'required':!![]},'penalty':{'type':_0x9615('0x2'),'required':![]},'paused':{'type':_0x9615('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x9615('0x1'),'required':!![]},'interface':{'type':_0x9615('0x1'),'required':!![]}};exports[_0x9615('0x4')]={'interface':{'type':_0x9615('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x9615('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x9615('0x1'),'required':![]}};exports[_0x9615('0x5')]={'uniqueid':{'type':_0x9615('0x1'),'required':!![]}};exports[_0x9615('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x9615('0x1')},'format':{'type':_0x9615('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x9615('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x9615('0x1')}}; \ No newline at end of file +var _0x0a35=['voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x6bb560,_0x431896){var _0x4bfa76=function(_0x2a68a1){while(--_0x2a68a1){_0x6bb560['push'](_0x6bb560['shift']());}};_0x4bfa76(++_0x431896);}(_0x0a35,0x18e));var _0x50a3=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0x0a35[_0x1778e1];return _0x2bc4c6;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x50a3('0x0'),'required':!![]},'penalty':{'type':_0x50a3('0x1'),'required':![]},'paused':{'type':_0x50a3('0x2'),'required':![]}};exports[_0x50a3('0x3')]={'queue':{'type':_0x50a3('0x0'),'required':!![]},'interface':{'type':_0x50a3('0x0'),'required':!![]}};exports[_0x50a3('0x4')]={'interface':{'type':_0x50a3('0x0'),'required':!![]},'paused':{'type':_0x50a3('0x2')},'reason':{'type':_0x50a3('0x0'),'required':![]}};exports[_0x50a3('0x5')]={'module':{'type':_0x50a3('0x0'),'required':![]}};exports[_0x50a3('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x50a3('0x0')},'format':{'type':_0x50a3('0x0')},'mixmonitorid':{'type':_0x50a3('0x0')}};exports[_0x50a3('0x7')]={'uniqueid':{'type':_0x50a3('0x0'),'required':!![]}};exports[_0x50a3('0x8')]={'uniqueid':{'type':_0x50a3('0x0'),'required':!![]},'exten':{'type':_0x50a3('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fdbbefc..e9bf1b2 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 _0x20de=['agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','length','isUndefined','prototype','initTrunks','trunks','initVoiceQueues','mergeFromDatabase','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','abandoned','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','diff','seconds','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','merge','initFaxAccounts','exports','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x20de,0x134));var _0xe20d=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x20de[_0xbf8ebe];return _0x1e25e8;};'use strict';var util=require(_0xe20d('0x0'));var _=require('lodash');var moment=require(_0xe20d('0x1'));var Agent=require(_0xe20d('0x2'));var Telephone=require(_0xe20d('0x3'));var Trunk=require(_0xe20d('0x4'));var VoiceQueue=require(_0xe20d('0x5'));var Trigger=require(_0xe20d('0x6'));var Template=require(_0xe20d('0x7'));var Campaign=require(_0xe20d('0x8'));var VoiceExtension=require(_0xe20d('0x9'));var ZendeskAccount=require(_0xe20d('0xa'));var SalesforceAccount=require(_0xe20d('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xe20d('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xe20d('0xd'));var Dynamics365Account=require(_0xe20d('0xe'));var FreshsalesAccount=require(_0xe20d('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xe20d('0x10')]={};this[_0xe20d('0x11')]={};this['trunks']={};this[_0xe20d('0x12')]={};this[_0xe20d('0x13')]={};this['campaigns']={};this[_0xe20d('0x14')]={};this[_0xe20d('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe20d('0x16')]={};this[_0xe20d('0x17')]={};this['queueChannels']={};this['outboundChannels']={};this[_0xe20d('0x18')]={};this[_0xe20d('0x19')]={};this[_0xe20d('0x1a')]={};this[_0xe20d('0x1b')]={};this[_0xe20d('0x1c')]={};this[_0xe20d('0x1d')]={};this[_0xe20d('0x1e')]={};this[_0xe20d('0x1f')]={};this[_0xe20d('0x20')]={};this['servicenowAccounts']={};this[_0xe20d('0x21')]={};this['freshsalesAccounts']={};this[_0xe20d('0x22')]={};};function freeIsNotKey(_0x3aa19d,_0x29b500,_0x53f8c3){var _0x1d6179=_['mapKeys'](_0x3aa19d,function(_0x1738d9,_0x1f2058){return _0x1738d9[_0x53f8c3];});for(var _0x285916 in _0x29b500){if(_0x29b500['hasOwnProperty'](_0x285916)){if(!_0x1d6179[_0x285916]){delete _0x29b500[_0x285916];}}}}function freeIsNotKeySip(_0x4353cb,_0x17a2f1){var _0xd96fa7=_[_0xe20d('0x23')](_0x4353cb,function(_0x5d93da,_0x10db76){return util[_0xe20d('0x24')](_0xe20d('0x25'),_0x5d93da[_0xe20d('0x26')]);});for(var _0x48577c in _0x17a2f1){if(_0x17a2f1[_0xe20d('0x27')](_0x48577c)){if(!_0xd96fa7[_0x48577c]){delete _0x17a2f1[_0x48577c];}}}}function freeIsNotKeyAgent(_0x5b342b,_0x4ac635){var _0x1fae60=_[_0xe20d('0x23')](_0x5b342b,function(_0x4baa28,_0x5e7237){var _0x1552d8=_[_0xe20d('0x28')](_0x4baa28['interface'])?util[_0xe20d('0x24')](_0xe20d('0x25'),_0x4baa28[_0xe20d('0x26')]):_0x4baa28[_0xe20d('0x29')];return _0x1552d8;});for(var _0x382c1d in _0x4ac635){if(_0x4ac635['hasOwnProperty'](_0x382c1d)){if(!_0x1fae60[_0x382c1d]){delete _0x4ac635[_0x382c1d];}}}}function clearVoiceCallReports(_0x1d88fd){_0x1d88fd[_0xe20d('0x2a')]=0x0;_0x1d88fd[_0xe20d('0x2b')]=0x0;_0x1d88fd[_0xe20d('0x2c')]=0x0;_0x1d88fd[_0xe20d('0x2d')]=0x0;_0x1d88fd['sumBillable']=0x0;}function clearCampaigns(_0x5f1626){if(!_[_0xe20d('0x2e')](_0x5f1626)){for(var _0x497726 in _0x5f1626){if(_0x5f1626[_0xe20d('0x27')](_0x497726)){_0x5f1626[_0x497726][_0xe20d('0x2f')]=0x0;_0x5f1626[_0x497726][_0xe20d('0x30')]=0x0;}}}}function clearVoiceQueues(_0x46fc0e){if(!_[_0xe20d('0x2e')](_0x46fc0e)){for(var _0x6a1429 in _0x46fc0e){if(_0x46fc0e[_0xe20d('0x27')](_0x6a1429)){_0x46fc0e[_0x6a1429]['total']=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x2b')]=0x0;_0x46fc0e[_0x6a1429]['unmanaged']=0x0;_0x46fc0e[_0x6a1429]['abandoned']=0x0;_0x46fc0e[_0x6a1429]['sumHoldTime']=0x0;_0x46fc0e[_0x6a1429]['sumDuration']=0x0;_0x46fc0e[_0x6a1429]['sumBillable']=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x31')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x32')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x33')]=0x0;_0x46fc0e[_0x6a1429]['outboundCongestionCallsDay']=0x0;_0x46fc0e[_0x6a1429]['outboundNoSuchCallsDay']=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x34')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x35')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x36')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x37')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x38')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x39')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x3a')]=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x31')]=0x0;_0x46fc0e[_0x6a1429]['outboundAnswerCallsDay']=0x0;_0x46fc0e[_0x6a1429][_0xe20d('0x3b')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x14c67a,_0x55aa4e){for(var _0x1da98b in _0x55aa4e){if(_0x14c67a[_0xe20d('0x27')](_0x1da98b)){_0x14c67a[_0x1da98b]=_0x55aa4e[_0x1da98b];}}};Realtime['prototype']['initAgents']=function(){var _0x4787ad=this;return function(_0x2b1867){if(_0x2b1867){freeIsNotKeyAgent(_0x2b1867,_0x4787ad[_0xe20d('0x10')]);for(var _0x378b8a=0x0,_0x972553={},_0x3448d4={};_0x378b8a<_0x2b1867[_0xe20d('0x3c')];_0x378b8a+=0x1){_0x972553=_0x2b1867[_0x378b8a];var _0x4b5a10=_[_0xe20d('0x28')](_0x972553[_0xe20d('0x29')])?util[_0xe20d('0x24')](_0xe20d('0x25'),_0x972553['name']):_0x972553[_0xe20d('0x29')];if(_[_0xe20d('0x3d')](_0x4787ad[_0xe20d('0x10')][_0x4b5a10])){_0x4787ad[_0xe20d('0x10')][_0x4b5a10]=new Agent(_0x972553);}else{_0x4787ad['mergeFromDatabase'](_0x4787ad['agents'][_0x4b5a10],_0x972553);}}}return _0x4787ad[_0xe20d('0x10')];};};Realtime[_0xe20d('0x3e')]['initTelephones']=function(){var _0x897147=this;return function(_0x709ef4){if(_0x709ef4){freeIsNotKeySip(_0x709ef4,_0x897147[_0xe20d('0x11')]);for(var _0x325827=0x0,_0x118f05={},_0x2ebd93={};_0x325827<_0x709ef4[_0xe20d('0x3c')];_0x325827+=0x1){_0x118f05=_0x709ef4[_0x325827];if(_[_0xe20d('0x3d')](_0x897147['telephones'][util['format']('SIP/%s',_0x118f05[_0xe20d('0x26')])])){_0x897147[_0xe20d('0x11')][util['format'](_0xe20d('0x25'),_0x118f05[_0xe20d('0x26')])]=new Telephone(_0x118f05);}else{_0x897147['mergeFromDatabase'](_0x897147['telephones'][util[_0xe20d('0x24')]('SIP/%s',_0x118f05[_0xe20d('0x26')])],_0x118f05);}}}return _0x897147['telephones'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x3f')]=function(){var _0x4d0716=this;return function(_0x22a41d){if(_0x22a41d){freeIsNotKeySip(_0x22a41d,_0x4d0716[_0xe20d('0x40')]);for(var _0x259870=0x0,_0x595f95={},_0x1793c1={};_0x259870<_0x22a41d[_0xe20d('0x3c')];_0x259870+=0x1){_0x595f95=_0x22a41d[_0x259870];if(_[_0xe20d('0x3d')](_0x4d0716[_0xe20d('0x40')][util[_0xe20d('0x24')](_0xe20d('0x25'),_0x595f95[_0xe20d('0x26')])])){_0x4d0716[_0xe20d('0x40')][util[_0xe20d('0x24')]('SIP/%s',_0x595f95[_0xe20d('0x26')])]=new Trunk(_0x595f95);}else{_0x4d0716['mergeFromDatabase'](_0x4d0716[_0xe20d('0x40')][util[_0xe20d('0x24')](_0xe20d('0x25'),_0x595f95[_0xe20d('0x26')])],_0x595f95);}}}return _0x4d0716[_0xe20d('0x40')];};};Realtime['prototype'][_0xe20d('0x41')]=function(){var _0xa3ff1b=this;return function(_0x1a82ee){if(_0x1a82ee){freeIsNotKey(_0x1a82ee,_0xa3ff1b[_0xe20d('0x12')],_0xe20d('0x26'));for(var _0x26d4d7=0x0,_0x4c7e3d={},_0x457910={};_0x26d4d7<_0x1a82ee[_0xe20d('0x3c')];_0x26d4d7+=0x1){_0x4c7e3d=_0x1a82ee[_0x26d4d7];if(_[_0xe20d('0x3d')](_0xa3ff1b[_0xe20d('0x12')][_0x4c7e3d[_0xe20d('0x26')]])){_0xa3ff1b['voiceQueues'][_0x4c7e3d[_0xe20d('0x26')]]=new VoiceQueue(_0x4c7e3d);}else{_0xa3ff1b[_0xe20d('0x42')](_0xa3ff1b[_0xe20d('0x12')][_0x4c7e3d['name']],_0x4c7e3d);}}}return _0xa3ff1b['voiceQueues'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x43')]=function(){var _0x355dd8=this;return function(_0xd8d29c){if(_0xd8d29c){freeIsNotKey(_0xd8d29c,_0x355dd8[_0xe20d('0x13')],'id');for(var _0xb55dac=0x0,_0x334e42={},_0x4aa0b5={};_0xb55dac<_0xd8d29c[_0xe20d('0x3c')];_0xb55dac+=0x1){_0x334e42=_0xd8d29c[_0xb55dac];if(_['isUndefined'](_0x355dd8[_0xe20d('0x13')][_0x334e42['id']])){_0x355dd8[_0xe20d('0x13')][_0x334e42['id']]=new Trigger(_0x334e42);}else{_0x355dd8[_0xe20d('0x42')](_0x355dd8[_0xe20d('0x13')][_0x334e42['id']],_0x334e42);}}}return _0x355dd8[_0xe20d('0x13')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x44')]=function(){var _0x510d50=this;return function(_0x255efe){if(_0x255efe){freeIsNotKey(_0x255efe,_0x510d50[_0xe20d('0x14')],'id');for(var _0x3b47f7=0x0,_0x51736d={},_0x3f7609={};_0x3b47f7<_0x255efe[_0xe20d('0x3c')];_0x3b47f7+=0x1){_0x51736d=_0x255efe[_0x3b47f7];if(_['isUndefined'](_0x510d50[_0xe20d('0x14')][_0x51736d['id']])){_0x510d50[_0xe20d('0x14')][_0x51736d['id']]=new Template(_0x51736d);}else{_0x510d50[_0xe20d('0x42')](_0x510d50[_0xe20d('0x14')][_0x51736d['id']],_0x51736d);}}}return _0x510d50[_0xe20d('0x14')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x45')]=function(){var _0x1677b8=this;return function(_0x408552){if(_0x408552){freeIsNotKey(_0x408552,_0x1677b8[_0xe20d('0x1a')],'id');for(var _0x5eaf1f=0x0,_0x2a3351={},_0x14854d={};_0x5eaf1f<_0x408552[_0xe20d('0x3c')];_0x5eaf1f+=0x1){_0x2a3351=_0x408552[_0x5eaf1f];if(_['isUndefined'](_0x1677b8[_0xe20d('0x1a')][_0x2a3351['id']])){_0x1677b8[_0xe20d('0x1a')][_0x2a3351['id']]=new ZendeskAccount(_0x2a3351);}else{_0x1677b8[_0xe20d('0x42')](_0x1677b8[_0xe20d('0x1a')][_0x2a3351['id']],_0x2a3351);}}}return _0x1677b8[_0xe20d('0x1a')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x46')]=function(){var _0x15d118=this;return function(_0x23c7f9){if(_0x23c7f9){freeIsNotKey(_0x23c7f9,_0x15d118[_0xe20d('0x1b')],'id');for(var _0x53494a=0x0,_0x4dfab8={},_0xbee224={};_0x53494a<_0x23c7f9[_0xe20d('0x3c')];_0x53494a+=0x1){_0x4dfab8=_0x23c7f9[_0x53494a];if(_[_0xe20d('0x3d')](_0x15d118[_0xe20d('0x1b')][_0x4dfab8['id']])){_0x15d118[_0xe20d('0x1b')][_0x4dfab8['id']]=new SalesforceAccount(_0x4dfab8);}else{_0x15d118['mergeFromDatabase'](_0x15d118[_0xe20d('0x1b')][_0x4dfab8['id']],_0x4dfab8);}}}return _0x15d118['salesforceAccounts'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x47')]=function(){var _0x239970=this;return function(_0x2bf1ee){if(_0x2bf1ee){freeIsNotKey(_0x2bf1ee,_0x239970[_0xe20d('0x1d')],'id');for(var _0x514184=0x0,_0x353366={},_0x4ba87b={};_0x514184<_0x2bf1ee[_0xe20d('0x3c')];_0x514184+=0x1){_0x353366=_0x2bf1ee[_0x514184];if(_[_0xe20d('0x3d')](_0x239970['freshdeskAccounts'][_0x353366['id']])){_0x239970[_0xe20d('0x1d')][_0x353366['id']]=new FreshdeskAccount(_0x353366);}else{_0x239970[_0xe20d('0x42')](_0x239970[_0xe20d('0x1d')][_0x353366['id']],_0x353366);}}}return _0x239970[_0xe20d('0x1d')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x48')]=function(){var _0x775943=this;return function(_0x324f94){if(_0x324f94){freeIsNotKey(_0x324f94,_0x775943[_0xe20d('0x1e')],'id');for(var _0x1bc61d=0x0,_0x267382={},_0x1da5aa={};_0x1bc61d<_0x324f94[_0xe20d('0x3c')];_0x1bc61d+=0x1){_0x267382=_0x324f94[_0x1bc61d];if(_[_0xe20d('0x3d')](_0x775943[_0xe20d('0x1e')][_0x267382['id']])){_0x775943[_0xe20d('0x1e')][_0x267382['id']]=new ZohoAccount(_0x267382);}else{_0x775943[_0xe20d('0x42')](_0x775943['zohoAccounts'][_0x267382['id']],_0x267382);}}}return _0x775943[_0xe20d('0x1e')];};};Realtime['prototype'][_0xe20d('0x49')]=function(){var _0x30bf74=this;return function(_0x37ba15){if(_0x37ba15){freeIsNotKey(_0x37ba15,_0x30bf74[_0xe20d('0x1f')],'id');for(var _0x6ea559=0x0,_0x2ecfcf={},_0x5bc10e={};_0x6ea559<_0x37ba15[_0xe20d('0x3c')];_0x6ea559+=0x1){_0x2ecfcf=_0x37ba15[_0x6ea559];if(_[_0xe20d('0x3d')](_0x30bf74[_0xe20d('0x1f')][_0x2ecfcf['id']])){_0x30bf74['deskAccounts'][_0x2ecfcf['id']]=new DeskAccount(_0x2ecfcf);}else{_0x30bf74[_0xe20d('0x42')](_0x30bf74[_0xe20d('0x1f')][_0x2ecfcf['id']],_0x2ecfcf);}}}return _0x30bf74['deskAccounts'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x4a')]=function(){var _0x579777=this;return function(_0x4bd5f0){if(_0x4bd5f0){freeIsNotKey(_0x4bd5f0,_0x579777[_0xe20d('0x1c')],'id');for(var _0x1fbedd=0x0,_0x143e9f={},_0x5d642c={};_0x1fbedd<_0x4bd5f0[_0xe20d('0x3c')];_0x1fbedd+=0x1){_0x143e9f=_0x4bd5f0[_0x1fbedd];if(_[_0xe20d('0x3d')](_0x579777[_0xe20d('0x1c')][_0x143e9f['id']])){_0x579777[_0xe20d('0x1c')][_0x143e9f['id']]=new SugarcrmAccount(_0x143e9f);}else{_0x579777[_0xe20d('0x42')](_0x579777[_0xe20d('0x1c')][_0x143e9f['id']],_0x143e9f);}}}return _0x579777[_0xe20d('0x1c')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x4b')]=function(){var _0x186bc8=this;return function(_0x290a5b){if(_0x290a5b){freeIsNotKey(_0x290a5b,_0x186bc8[_0xe20d('0x20')],'id');for(var _0x418d59=0x0,_0x538d8d={},_0x468b28={};_0x418d59<_0x290a5b[_0xe20d('0x3c')];_0x418d59+=0x1){_0x538d8d=_0x290a5b[_0x418d59];if(_[_0xe20d('0x3d')](_0x186bc8[_0xe20d('0x20')][_0x538d8d['id']])){_0x186bc8[_0xe20d('0x20')][_0x538d8d['id']]=new VtigerAccount(_0x538d8d);}else{_0x186bc8[_0xe20d('0x42')](_0x186bc8[_0xe20d('0x20')][_0x538d8d['id']],_0x538d8d);}}}return _0x186bc8['vtigerAccounts'];};};Realtime['prototype'][_0xe20d('0x4c')]=function(){var _0x1d7923=this;return function(_0x4e854d){if(_0x4e854d){freeIsNotKey(_0x4e854d,_0x1d7923[_0xe20d('0x4d')],'id');for(var _0x1dd8b6=0x0,_0x5e7fcc={},_0x1a2d09={};_0x1dd8b6<_0x4e854d[_0xe20d('0x3c')];_0x1dd8b6+=0x1){_0x5e7fcc=_0x4e854d[_0x1dd8b6];if(_[_0xe20d('0x3d')](_0x1d7923['servicenowAccounts'][_0x5e7fcc['id']])){_0x1d7923[_0xe20d('0x4d')][_0x5e7fcc['id']]=new ServicenowAccount(_0x5e7fcc);}else{_0x1d7923[_0xe20d('0x42')](_0x1d7923[_0xe20d('0x4d')][_0x5e7fcc['id']],_0x5e7fcc);}}}return _0x1d7923[_0xe20d('0x4d')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x4e')]=function(){var _0x3c97e1=this;return function(_0x4cb743){if(_0x4cb743){freeIsNotKey(_0x4cb743,_0x3c97e1[_0xe20d('0x21')],'id');for(var _0x1ec44b=0x0,_0x2a5372={},_0x2a85c5={};_0x1ec44b<_0x4cb743[_0xe20d('0x3c')];_0x1ec44b+=0x1){_0x2a5372=_0x4cb743[_0x1ec44b];if(_[_0xe20d('0x3d')](_0x3c97e1[_0xe20d('0x21')][_0x2a5372['id']])){_0x3c97e1[_0xe20d('0x21')][_0x2a5372['id']]=new Dynamics365Account(_0x2a5372);}else{_0x3c97e1[_0xe20d('0x42')](_0x3c97e1['dynamics365Accounts'][_0x2a5372['id']],_0x2a5372);}}}return _0x3c97e1['dynamics365Accounts'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x4f')]=function(){var _0x311c4e=this;return function(_0x8349c4){if(_0x8349c4){freeIsNotKey(_0x8349c4,_0x311c4e['freshsalesAccounts'],'id');for(var _0x244306=0x0,_0x15cfb3={},_0x5834ec={};_0x244306<_0x8349c4[_0xe20d('0x3c')];_0x244306+=0x1){_0x15cfb3=_0x8349c4[_0x244306];if(_[_0xe20d('0x3d')](_0x311c4e[_0xe20d('0x50')][_0x15cfb3['id']])){_0x311c4e[_0xe20d('0x50')][_0x15cfb3['id']]=new FreshsalesAccount(_0x15cfb3);}else{_0x311c4e['mergeFromDatabase'](_0x311c4e[_0xe20d('0x50')][_0x15cfb3['id']],_0x15cfb3);}}}return _0x311c4e['freshsalesAccounts'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x51')]=function(){var _0x332b7f=this;return function(_0x580fd1){for(var _0x3b8895=0x0;_0x3b8895<_0x580fd1[_0xe20d('0x3c')];_0x3b8895+=0x1){_['merge'](_0x332b7f[_0xe20d('0x12')][_0x580fd1[_0x3b8895][_0xe20d('0x26')]],_0x580fd1[_0x3b8895]);}return _0x332b7f[_0xe20d('0x12')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x52')]=function(){var _0x5807ca=this;return function(_0xe1fd12){clearVoiceQueues(_0x5807ca[_0xe20d('0x12')]);if(_0xe1fd12){_0xe1fd12=_[_0xe20d('0x53')](_0xe1fd12,_0xe20d('0x54'));for(var _0x36708c in _0xe1fd12){if(_0xe1fd12[_0xe20d('0x27')](_0x36708c)){var _0xee2e1f={};for(var _0x35787d=0x0;_0x35787d<_0xe1fd12[_0x36708c][_0xe20d('0x3c')];_0x35787d+=0x1){var _0x56928b=_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x55')];if(_0x5807ca[_0xe20d('0x12')][_0x56928b]){if(_0xe1fd12[_0x36708c][_0x35787d]['queuecallerexit']){_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x56')]+=0x1;}if(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x57')]){_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x58')]+=0x1;}_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x2c')]+=moment(_0xe1fd12[_0x36708c][_0x35787d]['queuecallerleaveAt'])['diff'](moment(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x59')]),'seconds')||0x0;if(_0x35787d===_0xe1fd12[_0x36708c][_0xe20d('0x3c')]-0x1){_0x5807ca['voiceQueues'][_0x56928b][_0xe20d('0x2d')]+=moment(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x5a')]||_0xe1fd12[_0x36708c][_0x35787d]['queuecallerabandonAt']||_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x5b')])[_0xe20d('0x5c')](moment(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x59')]),_0xe20d('0x5d'))||0x0;_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x2a')]+=0x1;if(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x5e')]){_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x2b')]+=0x1;_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x5f')]+=moment(_0xe1fd12[_0x36708c][_0x35787d][_0xe20d('0x5a')])['diff'](moment(_0xe1fd12[_0x36708c][_0x35787d]['queuecallerleaveAt']),_0xe20d('0x5d'))||0x0;}}else{_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x2d')]+=_0x5807ca[_0xe20d('0x12')][_0x56928b][_0xe20d('0x2c')]||0x0;}}}}}}return _0x5807ca[_0xe20d('0x12')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x60')]=function(){var _0x32e15f=this;return function(_0xe588be){clearVoiceCallReports(_0x32e15f[_0xe20d('0x15')]);if(_0xe588be){for(var _0x179c1f=0x0;_0x179c1f<_0xe588be['length'];_0x179c1f+=0x1){_0x32e15f[_0xe20d('0x15')][_0xe20d('0x2a')]+=0x1;_0x32e15f['outbound'][_0xe20d('0x2d')]+=_0xe588be[_0x179c1f][_0xe20d('0x61')];if(_0xe588be[_0x179c1f]['disposition']===_0xe20d('0x62')){_0x32e15f[_0xe20d('0x15')][_0xe20d('0x2b')]+=0x1;_0x32e15f[_0xe20d('0x15')][_0xe20d('0x2c')]+=_0xe588be[_0x179c1f]['duration']-_0xe588be[_0x179c1f][_0xe20d('0x63')]||0x0;_0x32e15f[_0xe20d('0x15')][_0xe20d('0x5f')]+=_0xe588be[_0x179c1f][_0xe20d('0x63')];}}}return _0x32e15f[_0xe20d('0x15')];};};Realtime['prototype'][_0xe20d('0x64')]=function(){var _0x591750=this;return function(_0x2e2e5c){if(_0x2e2e5c){freeIsNotKey(_0x2e2e5c,_0x591750[_0xe20d('0x65')],'name');for(var _0x5451d6=0x0,_0x23072d={};_0x5451d6<_0x2e2e5c[_0xe20d('0x3c')];_0x5451d6+=0x1){_0x23072d=_0x2e2e5c[_0x5451d6];if(_[_0xe20d('0x3d')](_0x591750['campaigns'][_0x23072d[_0xe20d('0x26')]])){_0x591750['campaigns'][_0x23072d['name']]=new Campaign(_0x23072d);}else{_0x591750[_0xe20d('0x42')](_0x591750[_0xe20d('0x65')][_0x23072d[_0xe20d('0x26')]],_0x23072d);_0x591750[_0xe20d('0x65')][_0x23072d['name']][_0xe20d('0x66')]=_0x23072d['SquareProject']?_0x23072d[_0xe20d('0x67')][_0xe20d('0x26')]:undefined;}}}return _0x591750[_0xe20d('0x65')];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x68')]=function(){var _0x3d2cdd=this;return function(_0x3e8aac){if(_0x3e8aac){freeIsNotKey(_0x3e8aac,_0x3d2cdd['voiceExtensions'],'id');for(var _0x51e0f4=0x0,_0x32c566={};_0x51e0f4<_0x3e8aac[_0xe20d('0x3c')];_0x51e0f4+=0x1){_0x32c566=_0x3e8aac[_0x51e0f4];if(_[_0xe20d('0x3d')](_0x3d2cdd['voiceExtensions'][_0x32c566['id']])){_0x3d2cdd[_0xe20d('0x16')][_0x32c566['id']]=new VoiceExtension(_0x32c566);}else{_0x3d2cdd[_0xe20d('0x42')](_0x3d2cdd['voiceExtensions'][_0x32c566['id']],_0x32c566);}}}return _0x3d2cdd[_0xe20d('0x16')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1d807b=this;return function(_0x180550){clearCampaigns(_0x1d807b[_0xe20d('0x65')]);for(var _0x3e31fb=0x0;_0x3e31fb<_0x180550[_0xe20d('0x3c')];_0x3e31fb+=0x1){_[_0xe20d('0x69')](_0x1d807b[_0xe20d('0x65')][_0x180550[_0x3e31fb][_0xe20d('0x26')]],_0x180550[_0x3e31fb]);}return _0x1d807b['campaigns'];};};Realtime[_0xe20d('0x3e')][_0xe20d('0x6a')]=function(){var _0x54ff25=this;return function(_0x5617e0){if(_0x5617e0){freeIsNotKey(_0x5617e0,_0x54ff25[_0xe20d('0x22')],'id');for(var _0x1dd878=0x0,_0x28606f={},_0x1d0f17={};_0x1dd878<_0x5617e0[_0xe20d('0x3c')];_0x1dd878+=0x1){_0x28606f=_0x5617e0[_0x1dd878];if(_['isUndefined'](_0x54ff25[_0xe20d('0x22')][_0x28606f['id']])){_0x54ff25[_0xe20d('0x22')][_0x28606f['id']]=new FaxAccount(_0x28606f);}else{_0x54ff25['mergeFromDatabase'](_0x54ff25[_0xe20d('0x22')][_0x28606f['id']],_0x28606f);}}}return _0x54ff25[_0xe20d('0x22')];};};module[_0xe20d('0x6b')]=Realtime; \ No newline at end of file +var _0xe1d3=['outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTrunks','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','initVoiceCallReports','duration','ANSWERED','billableseconds','initVoiceExtensions','initCampaignHopperHistory','exports','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xe1d3,0x159));var _0x3e1d=function(_0xf9dbd5,_0x3361fb){_0xf9dbd5=_0xf9dbd5-0x0;var _0x3dc112=_0xe1d3[_0xf9dbd5];return _0x3dc112;};'use strict';var util=require(_0x3e1d('0x0'));var _=require(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var Agent=require(_0x3e1d('0x3'));var Telephone=require(_0x3e1d('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x3e1d('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x3e1d('0x6'));var Campaign=require(_0x3e1d('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x3e1d('0x8'));var FreshdeskAccount=require(_0x3e1d('0x9'));var SugarcrmAccount=require(_0x3e1d('0xa'));var ZohoAccount=require(_0x3e1d('0xb'));var DeskAccount=require(_0x3e1d('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x3e1d('0xd'));var Dynamics365Account=require(_0x3e1d('0xe'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x3e1d('0xf'));var Realtime=function(){this[_0x3e1d('0x10')]={};this[_0x3e1d('0x11')]={};this[_0x3e1d('0x12')]={};this[_0x3e1d('0x13')]={};this[_0x3e1d('0x14')]={};this[_0x3e1d('0x15')]={};this[_0x3e1d('0x16')]={};this[_0x3e1d('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3e1d('0x18')]={};this[_0x3e1d('0x19')]={};this[_0x3e1d('0x1a')]={};this[_0x3e1d('0x1b')]={};this[_0x3e1d('0x1c')]={};this['settings']={};this[_0x3e1d('0x1d')]={};this[_0x3e1d('0x1e')]={};this['sugarcrmAccounts']={};this[_0x3e1d('0x1f')]={};this[_0x3e1d('0x20')]={};this['deskAccounts']={};this[_0x3e1d('0x21')]={};this[_0x3e1d('0x22')]={};this[_0x3e1d('0x23')]={};this[_0x3e1d('0x24')]={};this[_0x3e1d('0x25')]={};};function freeIsNotKey(_0x5a6513,_0x26626c,_0x2721e5){var _0x5549be=_[_0x3e1d('0x26')](_0x5a6513,function(_0x368372,_0x517b8d){return _0x368372[_0x2721e5];});for(var _0x38a13f in _0x26626c){if(_0x26626c[_0x3e1d('0x27')](_0x38a13f)){if(!_0x5549be[_0x38a13f]){delete _0x26626c[_0x38a13f];}}}}function freeIsNotKeySip(_0x2e0007,_0x201482){var _0x1064bd=_[_0x3e1d('0x26')](_0x2e0007,function(_0x4bc1a4,_0x20bfdd){return util[_0x3e1d('0x28')]('SIP/%s',_0x4bc1a4[_0x3e1d('0x29')]);});for(var _0x17a64a in _0x201482){if(_0x201482[_0x3e1d('0x27')](_0x17a64a)){if(!_0x1064bd[_0x17a64a]){delete _0x201482[_0x17a64a];}}}}function freeIsNotKeyAgent(_0x5600a1,_0x22e8f0){var _0x52cd49=_[_0x3e1d('0x26')](_0x5600a1,function(_0x2259ee,_0x296d3b){var _0x34b191=_[_0x3e1d('0x2a')](_0x2259ee[_0x3e1d('0x2b')])?util[_0x3e1d('0x28')](_0x3e1d('0x2c'),_0x2259ee[_0x3e1d('0x29')]):_0x2259ee['interface'];return _0x34b191;});for(var _0x3d7e21 in _0x22e8f0){if(_0x22e8f0[_0x3e1d('0x27')](_0x3d7e21)){if(!_0x52cd49[_0x3d7e21]){delete _0x22e8f0[_0x3d7e21];}}}}function clearVoiceCallReports(_0x2afbdf){_0x2afbdf[_0x3e1d('0x2d')]=0x0;_0x2afbdf[_0x3e1d('0x2e')]=0x0;_0x2afbdf[_0x3e1d('0x2f')]=0x0;_0x2afbdf['sumDuration']=0x0;_0x2afbdf['sumBillable']=0x0;}function clearCampaigns(_0x47fb3c){if(!_[_0x3e1d('0x30')](_0x47fb3c)){for(var _0x8d01e2 in _0x47fb3c){if(_0x47fb3c[_0x3e1d('0x27')](_0x8d01e2)){_0x47fb3c[_0x8d01e2][_0x3e1d('0x31')]=0x0;_0x47fb3c[_0x8d01e2]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x13eb37){if(!_[_0x3e1d('0x30')](_0x13eb37)){for(var _0x353b5 in _0x13eb37){if(_0x13eb37['hasOwnProperty'](_0x353b5)){_0x13eb37[_0x353b5]['total']=0x0;_0x13eb37[_0x353b5]['answered']=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x32')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x33')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x2f')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x34')]=0x0;_0x13eb37[_0x353b5]['sumBillable']=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x35')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x36')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x37')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x38')]=0x0;_0x13eb37[_0x353b5]['outboundNoSuchCallsDay']=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x39')]=0x0;_0x13eb37[_0x353b5]['outboundDropCallsDayTimeout']=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x3a')]=0x0;_0x13eb37[_0x353b5]['outboundBlacklistCallsDay']=0x0;_0x13eb37[_0x353b5]['outboundOriginateFailureCallsDay']=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x3b')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x3c')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x35')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x3d')]=0x0;_0x13eb37[_0x353b5][_0x3e1d('0x3e')]=!![];}}}}Realtime[_0x3e1d('0x3f')][_0x3e1d('0x40')]=function(_0x33d420,_0x48f64e){for(var _0xaaa54e in _0x48f64e){if(_0x33d420['hasOwnProperty'](_0xaaa54e)){_0x33d420[_0xaaa54e]=_0x48f64e[_0xaaa54e];}}};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x41')]=function(){var _0x48bfb7=this;return function(_0x33b615){if(_0x33b615){freeIsNotKeyAgent(_0x33b615,_0x48bfb7[_0x3e1d('0x10')]);for(var _0x59a004=0x0,_0x301917={},_0x37e2a1={};_0x59a004<_0x33b615[_0x3e1d('0x42')];_0x59a004+=0x1){_0x301917=_0x33b615[_0x59a004];var _0x28a789=_[_0x3e1d('0x2a')](_0x301917[_0x3e1d('0x2b')])?util['format'](_0x3e1d('0x2c'),_0x301917[_0x3e1d('0x29')]):_0x301917[_0x3e1d('0x2b')];if(_[_0x3e1d('0x43')](_0x48bfb7[_0x3e1d('0x10')][_0x28a789])){_0x48bfb7[_0x3e1d('0x10')][_0x28a789]=new Agent(_0x301917);}else{_0x48bfb7['mergeFromDatabase'](_0x48bfb7[_0x3e1d('0x10')][_0x28a789],_0x301917);}}}return _0x48bfb7[_0x3e1d('0x10')];};};Realtime['prototype']['initTelephones']=function(){var _0x4dff09=this;return function(_0xf4a2ce){if(_0xf4a2ce){freeIsNotKeySip(_0xf4a2ce,_0x4dff09[_0x3e1d('0x11')]);for(var _0x57e396=0x0,_0x53c94d={},_0x50d793={};_0x57e396<_0xf4a2ce['length'];_0x57e396+=0x1){_0x53c94d=_0xf4a2ce[_0x57e396];if(_['isUndefined'](_0x4dff09[_0x3e1d('0x11')][util[_0x3e1d('0x28')](_0x3e1d('0x2c'),_0x53c94d[_0x3e1d('0x29')])])){_0x4dff09[_0x3e1d('0x11')][util['format'](_0x3e1d('0x2c'),_0x53c94d['name'])]=new Telephone(_0x53c94d);}else{_0x4dff09[_0x3e1d('0x40')](_0x4dff09[_0x3e1d('0x11')][util[_0x3e1d('0x28')](_0x3e1d('0x2c'),_0x53c94d[_0x3e1d('0x29')])],_0x53c94d);}}}return _0x4dff09[_0x3e1d('0x11')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x44')]=function(){var _0x257ec6=this;return function(_0x4081cc){if(_0x4081cc){freeIsNotKeySip(_0x4081cc,_0x257ec6[_0x3e1d('0x12')]);for(var _0x218095=0x0,_0x19f47c={},_0x499d19={};_0x218095<_0x4081cc[_0x3e1d('0x42')];_0x218095+=0x1){_0x19f47c=_0x4081cc[_0x218095];if(_[_0x3e1d('0x43')](_0x257ec6[_0x3e1d('0x12')][util[_0x3e1d('0x28')]('SIP/%s',_0x19f47c[_0x3e1d('0x29')])])){_0x257ec6[_0x3e1d('0x12')][util['format'](_0x3e1d('0x2c'),_0x19f47c[_0x3e1d('0x29')])]=new Trunk(_0x19f47c);}else{_0x257ec6[_0x3e1d('0x40')](_0x257ec6['trunks'][util[_0x3e1d('0x28')]('SIP/%s',_0x19f47c[_0x3e1d('0x29')])],_0x19f47c);}}}return _0x257ec6[_0x3e1d('0x12')];};};Realtime[_0x3e1d('0x3f')]['initVoiceQueues']=function(){var _0x4dd7b3=this;return function(_0x34a0aa){if(_0x34a0aa){freeIsNotKey(_0x34a0aa,_0x4dd7b3['voiceQueues'],_0x3e1d('0x29'));for(var _0x1e6a21=0x0,_0x3b05bc={},_0x4355fe={};_0x1e6a21<_0x34a0aa['length'];_0x1e6a21+=0x1){_0x3b05bc=_0x34a0aa[_0x1e6a21];if(_['isUndefined'](_0x4dd7b3[_0x3e1d('0x13')][_0x3b05bc[_0x3e1d('0x29')]])){_0x4dd7b3[_0x3e1d('0x13')][_0x3b05bc[_0x3e1d('0x29')]]=new VoiceQueue(_0x3b05bc);}else{_0x4dd7b3[_0x3e1d('0x40')](_0x4dd7b3['voiceQueues'][_0x3b05bc[_0x3e1d('0x29')]],_0x3b05bc);}}}return _0x4dd7b3[_0x3e1d('0x13')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x45')]=function(){var _0x47b1ef=this;return function(_0x139c51){if(_0x139c51){freeIsNotKey(_0x139c51,_0x47b1ef[_0x3e1d('0x14')],'id');for(var _0x50d293=0x0,_0x43b896={},_0x3dce06={};_0x50d293<_0x139c51['length'];_0x50d293+=0x1){_0x43b896=_0x139c51[_0x50d293];if(_[_0x3e1d('0x43')](_0x47b1ef[_0x3e1d('0x14')][_0x43b896['id']])){_0x47b1ef[_0x3e1d('0x14')][_0x43b896['id']]=new Trigger(_0x43b896);}else{_0x47b1ef[_0x3e1d('0x40')](_0x47b1ef[_0x3e1d('0x14')][_0x43b896['id']],_0x43b896);}}}return _0x47b1ef[_0x3e1d('0x14')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x46')]=function(){var _0x1aed27=this;return function(_0xa92310){if(_0xa92310){freeIsNotKey(_0xa92310,_0x1aed27[_0x3e1d('0x16')],'id');for(var _0x20cb79=0x0,_0x87976e={},_0x59d9a5={};_0x20cb79<_0xa92310['length'];_0x20cb79+=0x1){_0x87976e=_0xa92310[_0x20cb79];if(_[_0x3e1d('0x43')](_0x1aed27['templates'][_0x87976e['id']])){_0x1aed27[_0x3e1d('0x16')][_0x87976e['id']]=new Template(_0x87976e);}else{_0x1aed27[_0x3e1d('0x40')](_0x1aed27[_0x3e1d('0x16')][_0x87976e['id']],_0x87976e);}}}return _0x1aed27[_0x3e1d('0x16')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x47')]=function(){var _0x5ed2cb=this;return function(_0x29d14f){if(_0x29d14f){freeIsNotKey(_0x29d14f,_0x5ed2cb[_0x3e1d('0x1d')],'id');for(var _0x3a4e45=0x0,_0x550329={},_0xa64def={};_0x3a4e45<_0x29d14f[_0x3e1d('0x42')];_0x3a4e45+=0x1){_0x550329=_0x29d14f[_0x3a4e45];if(_[_0x3e1d('0x43')](_0x5ed2cb[_0x3e1d('0x1d')][_0x550329['id']])){_0x5ed2cb[_0x3e1d('0x1d')][_0x550329['id']]=new ZendeskAccount(_0x550329);}else{_0x5ed2cb['mergeFromDatabase'](_0x5ed2cb[_0x3e1d('0x1d')][_0x550329['id']],_0x550329);}}}return _0x5ed2cb[_0x3e1d('0x1d')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x48')]=function(){var _0x1d9d07=this;return function(_0x1bffdb){if(_0x1bffdb){freeIsNotKey(_0x1bffdb,_0x1d9d07[_0x3e1d('0x1e')],'id');for(var _0x21a990=0x0,_0x2e8118={},_0x234c09={};_0x21a990<_0x1bffdb[_0x3e1d('0x42')];_0x21a990+=0x1){_0x2e8118=_0x1bffdb[_0x21a990];if(_[_0x3e1d('0x43')](_0x1d9d07[_0x3e1d('0x1e')][_0x2e8118['id']])){_0x1d9d07['salesforceAccounts'][_0x2e8118['id']]=new SalesforceAccount(_0x2e8118);}else{_0x1d9d07[_0x3e1d('0x40')](_0x1d9d07[_0x3e1d('0x1e')][_0x2e8118['id']],_0x2e8118);}}}return _0x1d9d07[_0x3e1d('0x1e')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x49')]=function(){var _0x446038=this;return function(_0x38eb54){if(_0x38eb54){freeIsNotKey(_0x38eb54,_0x446038[_0x3e1d('0x1f')],'id');for(var _0x1a4471=0x0,_0x1a2f95={},_0x4da111={};_0x1a4471<_0x38eb54['length'];_0x1a4471+=0x1){_0x1a2f95=_0x38eb54[_0x1a4471];if(_[_0x3e1d('0x43')](_0x446038[_0x3e1d('0x1f')][_0x1a2f95['id']])){_0x446038['freshdeskAccounts'][_0x1a2f95['id']]=new FreshdeskAccount(_0x1a2f95);}else{_0x446038[_0x3e1d('0x40')](_0x446038[_0x3e1d('0x1f')][_0x1a2f95['id']],_0x1a2f95);}}}return _0x446038[_0x3e1d('0x1f')];};};Realtime[_0x3e1d('0x3f')]['initZohoAccounts']=function(){var _0x10d215=this;return function(_0x3ee150){if(_0x3ee150){freeIsNotKey(_0x3ee150,_0x10d215[_0x3e1d('0x20')],'id');for(var _0xe9ee64=0x0,_0x30011e={},_0xd72c10={};_0xe9ee64<_0x3ee150[_0x3e1d('0x42')];_0xe9ee64+=0x1){_0x30011e=_0x3ee150[_0xe9ee64];if(_[_0x3e1d('0x43')](_0x10d215['zohoAccounts'][_0x30011e['id']])){_0x10d215[_0x3e1d('0x20')][_0x30011e['id']]=new ZohoAccount(_0x30011e);}else{_0x10d215[_0x3e1d('0x40')](_0x10d215[_0x3e1d('0x20')][_0x30011e['id']],_0x30011e);}}}return _0x10d215[_0x3e1d('0x20')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x4a')]=function(){var _0x2775a4=this;return function(_0x46c7f2){if(_0x46c7f2){freeIsNotKey(_0x46c7f2,_0x2775a4['deskAccounts'],'id');for(var _0x158958=0x0,_0x220973={},_0x2c2517={};_0x158958<_0x46c7f2[_0x3e1d('0x42')];_0x158958+=0x1){_0x220973=_0x46c7f2[_0x158958];if(_[_0x3e1d('0x43')](_0x2775a4[_0x3e1d('0x4b')][_0x220973['id']])){_0x2775a4['deskAccounts'][_0x220973['id']]=new DeskAccount(_0x220973);}else{_0x2775a4[_0x3e1d('0x40')](_0x2775a4['deskAccounts'][_0x220973['id']],_0x220973);}}}return _0x2775a4['deskAccounts'];};};Realtime['prototype'][_0x3e1d('0x4c')]=function(){var _0x5befaf=this;return function(_0x73bee0){if(_0x73bee0){freeIsNotKey(_0x73bee0,_0x5befaf[_0x3e1d('0x4d')],'id');for(var _0x3f2dc8=0x0,_0x10b255={},_0x46ff43={};_0x3f2dc8<_0x73bee0['length'];_0x3f2dc8+=0x1){_0x10b255=_0x73bee0[_0x3f2dc8];if(_[_0x3e1d('0x43')](_0x5befaf['sugarcrmAccounts'][_0x10b255['id']])){_0x5befaf[_0x3e1d('0x4d')][_0x10b255['id']]=new SugarcrmAccount(_0x10b255);}else{_0x5befaf[_0x3e1d('0x40')](_0x5befaf[_0x3e1d('0x4d')][_0x10b255['id']],_0x10b255);}}}return _0x5befaf[_0x3e1d('0x4d')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x4e')]=function(){var _0x489da1=this;return function(_0x564a20){if(_0x564a20){freeIsNotKey(_0x564a20,_0x489da1[_0x3e1d('0x21')],'id');for(var _0x3eea88=0x0,_0xf74b9f={},_0x2fdb00={};_0x3eea88<_0x564a20['length'];_0x3eea88+=0x1){_0xf74b9f=_0x564a20[_0x3eea88];if(_[_0x3e1d('0x43')](_0x489da1['vtigerAccounts'][_0xf74b9f['id']])){_0x489da1[_0x3e1d('0x21')][_0xf74b9f['id']]=new VtigerAccount(_0xf74b9f);}else{_0x489da1[_0x3e1d('0x40')](_0x489da1['vtigerAccounts'][_0xf74b9f['id']],_0xf74b9f);}}}return _0x489da1['vtigerAccounts'];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x4f')]=function(){var _0x3e76b8=this;return function(_0x2b3ae0){if(_0x2b3ae0){freeIsNotKey(_0x2b3ae0,_0x3e76b8['servicenowAccounts'],'id');for(var _0x1c68d1=0x0,_0x3a412d={},_0x8a8e7e={};_0x1c68d1<_0x2b3ae0[_0x3e1d('0x42')];_0x1c68d1+=0x1){_0x3a412d=_0x2b3ae0[_0x1c68d1];if(_[_0x3e1d('0x43')](_0x3e76b8['servicenowAccounts'][_0x3a412d['id']])){_0x3e76b8[_0x3e1d('0x22')][_0x3a412d['id']]=new ServicenowAccount(_0x3a412d);}else{_0x3e76b8['mergeFromDatabase'](_0x3e76b8[_0x3e1d('0x22')][_0x3a412d['id']],_0x3a412d);}}}return _0x3e76b8['servicenowAccounts'];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x50')]=function(){var _0x42400b=this;return function(_0x6334dd){if(_0x6334dd){freeIsNotKey(_0x6334dd,_0x42400b[_0x3e1d('0x23')],'id');for(var _0x101934=0x0,_0x10335c={},_0x25ae07={};_0x101934<_0x6334dd['length'];_0x101934+=0x1){_0x10335c=_0x6334dd[_0x101934];if(_[_0x3e1d('0x43')](_0x42400b[_0x3e1d('0x23')][_0x10335c['id']])){_0x42400b[_0x3e1d('0x23')][_0x10335c['id']]=new Dynamics365Account(_0x10335c);}else{_0x42400b[_0x3e1d('0x40')](_0x42400b[_0x3e1d('0x23')][_0x10335c['id']],_0x10335c);}}}return _0x42400b[_0x3e1d('0x23')];};};Realtime['prototype'][_0x3e1d('0x51')]=function(){var _0x29fdd5=this;return function(_0x4ac32d){if(_0x4ac32d){freeIsNotKey(_0x4ac32d,_0x29fdd5['freshsalesAccounts'],'id');for(var _0x2294bb=0x0,_0x2dde0f={},_0x14476a={};_0x2294bb<_0x4ac32d['length'];_0x2294bb+=0x1){_0x2dde0f=_0x4ac32d[_0x2294bb];if(_[_0x3e1d('0x43')](_0x29fdd5[_0x3e1d('0x24')][_0x2dde0f['id']])){_0x29fdd5[_0x3e1d('0x24')][_0x2dde0f['id']]=new FreshsalesAccount(_0x2dde0f);}else{_0x29fdd5[_0x3e1d('0x40')](_0x29fdd5[_0x3e1d('0x24')][_0x2dde0f['id']],_0x2dde0f);}}}return _0x29fdd5[_0x3e1d('0x24')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x52')]=function(){var _0x5cda36=this;return function(_0x327c41){for(var _0x5501ba=0x0;_0x5501ba<_0x327c41[_0x3e1d('0x42')];_0x5501ba+=0x1){_[_0x3e1d('0x53')](_0x5cda36[_0x3e1d('0x13')][_0x327c41[_0x5501ba][_0x3e1d('0x29')]],_0x327c41[_0x5501ba]);}return _0x5cda36['voiceQueues'];};};Realtime['prototype'][_0x3e1d('0x54')]=function(){var _0x23f606=this;return function(_0x4656de){clearVoiceQueues(_0x23f606[_0x3e1d('0x13')]);if(_0x4656de){_0x4656de=_[_0x3e1d('0x55')](_0x4656de,_0x3e1d('0x56'));for(var _0x1e0407 in _0x4656de){if(_0x4656de['hasOwnProperty'](_0x1e0407)){var _0x208839={};for(var _0xa34a5d=0x0;_0xa34a5d<_0x4656de[_0x1e0407][_0x3e1d('0x42')];_0xa34a5d+=0x1){var _0x1b2bd7=_0x4656de[_0x1e0407][_0xa34a5d]['queue'];if(_0x23f606[_0x3e1d('0x13')][_0x1b2bd7]){if(_0x4656de[_0x1e0407][_0xa34a5d]['queuecallerexit']){_0x23f606[_0x3e1d('0x13')][_0x1b2bd7][_0x3e1d('0x32')]+=0x1;}if(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x57')]){_0x23f606['voiceQueues'][_0x1b2bd7][_0x3e1d('0x33')]+=0x1;}_0x23f606[_0x3e1d('0x13')][_0x1b2bd7]['sumHoldTime']+=moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x58')])[_0x3e1d('0x59')](moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x5a')]),_0x3e1d('0x5b'))||0x0;if(_0xa34a5d===_0x4656de[_0x1e0407]['length']-0x1){_0x23f606['voiceQueues'][_0x1b2bd7][_0x3e1d('0x34')]+=moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x5c')]||_0x4656de[_0x1e0407][_0xa34a5d]['queuecallerabandonAt']||_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x5d')])['diff'](moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x5a')]),'seconds')||0x0;_0x23f606[_0x3e1d('0x13')][_0x1b2bd7][_0x3e1d('0x2d')]+=0x1;if(_0x4656de[_0x1e0407][_0xa34a5d]['queuecallercomplete']){_0x23f606[_0x3e1d('0x13')][_0x1b2bd7]['answered']+=0x1;_0x23f606['voiceQueues'][_0x1b2bd7]['sumBillable']+=moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x5c')])[_0x3e1d('0x59')](moment(_0x4656de[_0x1e0407][_0xa34a5d][_0x3e1d('0x58')]),_0x3e1d('0x5b'))||0x0;}}else{_0x23f606[_0x3e1d('0x13')][_0x1b2bd7][_0x3e1d('0x34')]+=_0x23f606['voiceQueues'][_0x1b2bd7][_0x3e1d('0x2f')]||0x0;}}}}}}return _0x23f606[_0x3e1d('0x13')];};};Realtime[_0x3e1d('0x3f')][_0x3e1d('0x5e')]=function(){var _0xae8bf0=this;return function(_0x433174){clearVoiceCallReports(_0xae8bf0['outbound']);if(_0x433174){for(var _0x4ff511=0x0;_0x4ff511<_0x433174[_0x3e1d('0x42')];_0x4ff511+=0x1){_0xae8bf0[_0x3e1d('0x17')][_0x3e1d('0x2d')]+=0x1;_0xae8bf0[_0x3e1d('0x17')]['sumDuration']+=_0x433174[_0x4ff511][_0x3e1d('0x5f')];if(_0x433174[_0x4ff511]['disposition']===_0x3e1d('0x60')){_0xae8bf0[_0x3e1d('0x17')][_0x3e1d('0x2e')]+=0x1;_0xae8bf0[_0x3e1d('0x17')][_0x3e1d('0x2f')]+=_0x433174[_0x4ff511][_0x3e1d('0x5f')]-_0x433174[_0x4ff511][_0x3e1d('0x61')]||0x0;_0xae8bf0[_0x3e1d('0x17')]['sumBillable']+=_0x433174[_0x4ff511][_0x3e1d('0x61')];}}}return _0xae8bf0[_0x3e1d('0x17')];};};Realtime['prototype']['initCampaigns']=function(){var _0x431229=this;return function(_0x2296e4){if(_0x2296e4){freeIsNotKey(_0x2296e4,_0x431229['campaigns'],_0x3e1d('0x29'));for(var _0x48ed9b=0x0,_0xf8893d={};_0x48ed9b<_0x2296e4[_0x3e1d('0x42')];_0x48ed9b+=0x1){_0xf8893d=_0x2296e4[_0x48ed9b];if(_[_0x3e1d('0x43')](_0x431229['campaigns'][_0xf8893d[_0x3e1d('0x29')]])){_0x431229['campaigns'][_0xf8893d[_0x3e1d('0x29')]]=new Campaign(_0xf8893d);}else{_0x431229[_0x3e1d('0x40')](_0x431229[_0x3e1d('0x15')][_0xf8893d[_0x3e1d('0x29')]],_0xf8893d);_0x431229['campaigns'][_0xf8893d['name']]['dialQueueProject']=_0xf8893d['SquareProject']?_0xf8893d['SquareProject'][_0x3e1d('0x29')]:undefined;}}}return _0x431229['campaigns'];};};Realtime['prototype'][_0x3e1d('0x62')]=function(){var _0x49e41c=this;return function(_0x5a43ff){if(_0x5a43ff){freeIsNotKey(_0x5a43ff,_0x49e41c[_0x3e1d('0x18')],'id');for(var _0x4ad31c=0x0,_0x30b4c9={};_0x4ad31c<_0x5a43ff[_0x3e1d('0x42')];_0x4ad31c+=0x1){_0x30b4c9=_0x5a43ff[_0x4ad31c];if(_['isUndefined'](_0x49e41c[_0x3e1d('0x18')][_0x30b4c9['id']])){_0x49e41c[_0x3e1d('0x18')][_0x30b4c9['id']]=new VoiceExtension(_0x30b4c9);}else{_0x49e41c['mergeFromDatabase'](_0x49e41c[_0x3e1d('0x18')][_0x30b4c9['id']],_0x30b4c9);}}}return _0x49e41c[_0x3e1d('0x18')];};};Realtime['prototype'][_0x3e1d('0x63')]=function(){var _0x36d63f=this;return function(_0x2e57d2){clearCampaigns(_0x36d63f[_0x3e1d('0x15')]);for(var _0x361181=0x0;_0x361181<_0x2e57d2[_0x3e1d('0x42')];_0x361181+=0x1){_[_0x3e1d('0x53')](_0x36d63f[_0x3e1d('0x15')][_0x2e57d2[_0x361181][_0x3e1d('0x29')]],_0x2e57d2[_0x361181]);}return _0x36d63f['campaigns'];};};Realtime[_0x3e1d('0x3f')]['initFaxAccounts']=function(){var _0x4ead3e=this;return function(_0x95ae43){if(_0x95ae43){freeIsNotKey(_0x95ae43,_0x4ead3e['faxAccounts'],'id');for(var _0x1c0063=0x0,_0x272e4f={},_0x351d0d={};_0x1c0063<_0x95ae43[_0x3e1d('0x42')];_0x1c0063+=0x1){_0x272e4f=_0x95ae43[_0x1c0063];if(_['isUndefined'](_0x4ead3e[_0x3e1d('0x25')][_0x272e4f['id']])){_0x4ead3e[_0x3e1d('0x25')][_0x272e4f['id']]=new FaxAccount(_0x272e4f);}else{_0x4ead3e[_0x3e1d('0x40')](_0x4ead3e['faxAccounts'][_0x272e4f['id']],_0x272e4f);}}}return _0x4ead3e[_0x3e1d('0x25')];};};module[_0x3e1d('0x64')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c5c5b8d..0b4359a 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 _0x060f=['transfererlinkedid','attendedTransfer','exports','moment','util','../../../config/environment','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','bind','custom:voiceCallReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','name','isNil','find','accountcode','interface','format','prototype','voiceQueueReport','connectedlinenum','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','getAgentByInternal','keys','length','getCallType','split','calleridnum','outbound','voiceCallReport','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor','monitorFilename','monitors','createdAt','connectedlinename','xcally-motion-dialer','create','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x060f,0x163));var _0xf060=function(_0xef4cf0,_0x16c9c3){_0xef4cf0=_0xef4cf0-0x0;var _0x497ad2=_0x060f[_0xef4cf0];return _0x497ad2;};'use strict';var _=require('lodash');var moment=require(_0xf060('0x0'));var util=require(_0xf060('0x1'));var config=require(_0xf060('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xf060('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xf060('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xf060('0x5'));var RpcVoiceTransferReport=require(_0xf060('0x6'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xf060('0x7'));var VoiceAgentReport=require(_0xf060('0x8'));var VoiceDialReport=require(_0xf060('0x9'));var UserReport=require(_0xf060('0xa'));function Report(_0x5edf17){this[_0xf060('0xb')]=_0x5edf17;this[_0xf060('0xc')]=_0x5edf17[_0xf060('0xc')];this[_0xf060('0xd')]=_0x5edf17[_0xf060('0xd')];}Report['prototype']['sync']=function(_0x4c4edd){var _0x1ff573=new VoiceQueueReport(this[_0xf060('0xb')]);var _0x332827=new VoiceAgentReport(this[_0xf060('0xb')]);var _0x56a083=new VoiceDialReport(this[_0xf060('0xb')]);var _0x561332=new VoiceCallReport(this[_0xf060('0xb')]);var _0x4803ef=new UserReport(this[_0xf060('0xb')]);if(config['xdr']&&config[_0xf060('0xe')][_0xf060('0xf')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0xf060('0x10')](this));ami['on'](_0xf060('0x11'),this['voiceCallReport'][_0xf060('0x10')](this));ami['on']('custom:voiceAgentReport',this[_0xf060('0x12')][_0xf060('0x10')](this));ami['on'](_0xf060('0x13'),this[_0xf060('0x14')][_0xf060('0x10')](this));ami['on']('blindtransfer',this[_0xf060('0x15')][_0xf060('0x10')](this));ami['on'](_0xf060('0x16'),this['attendedTransfer'][_0xf060('0x10')](this));}};Report['prototype'][_0xf060('0x17')]=function(_0x3d099f){var _0x28efd0;_0x28efd0=_['find'](this[_0xf060('0xc')],function(_0x129e4){return _0x129e4['accountcode']==_0x3d099f||_0x129e4[_0xf060('0x18')]==_0x3d099f;});if(_[_0xf060('0x19')](_0x28efd0)){var _0x4129ff=_[_0xf060('0x1a')](this['telephones'],function(_0xc2f3bf){return _0xc2f3bf[_0xf060('0x1b')]==_0x3d099f||_0xc2f3bf[_0xf060('0x18')]==_0x3d099f;});if(_0x4129ff){_0x28efd0=_[_0xf060('0x1a')](this[_0xf060('0xc')],function(_0x5d08a5){return _0x5d08a5[_0xf060('0x1c')]==util[_0xf060('0x1d')]('SIP/%s',_0x4129ff[_0xf060('0x18')]);});}}return _0x28efd0;};Report[_0xf060('0x1e')][_0xf060('0x1f')]=function(_0xa7a019){for(var _0x1d39b2=0x0;_0x1d39b2<_0xa7a019['length'];_0x1d39b2+=0x1){var _0x397265=this['findAgent'](_0xa7a019[_0x1d39b2][_0xf060('0x20')]);if(_0x397265){_0xa7a019[_0x1d39b2][_0xf060('0x1b')]=_0x397265[_0xf060('0x1b')];_0xa7a019[_0x1d39b2]['assigned']=!![];_0xa7a019[_0x1d39b2][_0xf060('0x21')]=_0x397265['name'];_0xa7a019[_0x1d39b2][_0xf060('0x1c')]=_[_0xf060('0x19')](_0x397265['interface'])?util[_0xf060('0x1d')]('SIP/%s',_0x397265[_0xf060('0x18')]):_0x397265[_0xf060('0x1c')];if(_0xa7a019[_0x1d39b2][_0xf060('0x22')]){_0xa7a019[_0x1d39b2][_0xf060('0x23')]=moment()[_0xf060('0x1d')](_0xf060('0x24'));}if(_0xa7a019[_0x1d39b2][_0xf060('0x25')]){_0xa7a019[_0x1d39b2][_0xf060('0x26')]=moment()[_0xf060('0x1d')](_0xf060('0x24'));}RpcMemberReport[_0xf060('0x1f')](_0xa7a019[_0x1d39b2]);}RpcVoiceQueueReport['create'](_0xa7a019[_0x1d39b2]);}};function extractCalleridNumber(_0xb2d661){var _0x1cb0f6=_0xb2d661[_0xf060('0x27')](/<(.*?)>/);return _0x1cb0f6?_0x1cb0f6[0x1]:_0xb2d661;}Report[_0xf060('0x1e')][_0xf060('0x28')]=function(_0x1e5bad){for(var _0x4a6335=0x0;_0x4a6335','transfers','linkedid','transfereelinkedid','getCallType','UserId','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','calleridname','membername','voiceAgentReport','isArray','forEach','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/memberReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','SIP/%s','length','assigned','lastAssignedTo','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','split','internal','voiceCallReport','destination','exten','type','queue','lastdata','from-voip-provider','callerid','context','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED'];(function(_0x330000,_0x3ded11){var _0x455e12=function(_0x2eb5c6){while(--_0x2eb5c6){_0x330000['push'](_0x330000['shift']());}};_0x455e12(++_0x3ded11);}(_0xc20f,0x181));var _0xfc20=function(_0x529cef,_0x56bbdc){_0x529cef=_0x529cef-0x0;var _0x4bde28=_0xc20f[_0x529cef];return _0x4bde28;};'use strict';var _=require(_0xfc20('0x0'));var moment=require(_0xfc20('0x1'));var util=require(_0xfc20('0x2'));var config=require(_0xfc20('0x3'));var ami=require(_0xfc20('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xfc20('0x5'));var RpcVoiceQueueReport=require(_0xfc20('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xfc20('0x7'));var VoiceCallReport=require(_0xfc20('0x8'));var VoiceAgentReport=require(_0xfc20('0x9'));var VoiceDialReport=require(_0xfc20('0xa'));var UserReport=require(_0xfc20('0xb'));function Report(_0x36a41f){this[_0xfc20('0xc')]=_0x36a41f;this['agents']=_0x36a41f['agents'];this['telephones']=_0x36a41f[_0xfc20('0xd')];}Report[_0xfc20('0xe')][_0xfc20('0xf')]=function(_0x4cb56e){var _0x256fc4=new VoiceQueueReport(this['realtime']);var _0x339404=new VoiceAgentReport(this[_0xfc20('0xc')]);var _0x1ed06e=new VoiceDialReport(this['realtime']);var _0x5c9ea1=new VoiceCallReport(this[_0xfc20('0xc')]);var _0x490e65=new UserReport(this['realtime']);if(config[_0xfc20('0x10')]&&config[_0xfc20('0x10')][_0xfc20('0x11')]){ami['on'](_0xfc20('0x12'),this[_0xfc20('0x13')][_0xfc20('0x14')](this));ami['on'](_0xfc20('0x15'),this['voiceCallReport']['bind'](this));ami['on'](_0xfc20('0x16'),this['voiceAgentReport'][_0xfc20('0x14')](this));ami['on'](_0xfc20('0x17'),this[_0xfc20('0x18')][_0xfc20('0x14')](this));ami['on']('blindtransfer',this[_0xfc20('0x19')][_0xfc20('0x14')](this));ami['on']('attendedtransfer',this[_0xfc20('0x1a')][_0xfc20('0x14')](this));}};Report[_0xfc20('0xe')][_0xfc20('0x1b')]=function(_0x5d97ff){var _0x49aae0;_0x49aae0=_[_0xfc20('0x1c')](this[_0xfc20('0x1d')],function(_0x1e6998){return _0x1e6998[_0xfc20('0x1e')]==_0x5d97ff||_0x1e6998[_0xfc20('0x1f')]==_0x5d97ff;});if(_[_0xfc20('0x20')](_0x49aae0)){var _0x179e30=_[_0xfc20('0x1c')](this[_0xfc20('0xd')],function(_0x56def4){return _0x56def4[_0xfc20('0x1e')]==_0x5d97ff||_0x56def4[_0xfc20('0x1f')]==_0x5d97ff;});if(_0x179e30){_0x49aae0=_[_0xfc20('0x1c')](this[_0xfc20('0x1d')],function(_0x436ffa){return _0x436ffa['interface']==util['format'](_0xfc20('0x21'),_0x179e30[_0xfc20('0x1f')]);});}}return _0x49aae0;};Report[_0xfc20('0xe')]['voiceQueueReport']=function(_0x52cb27){for(var _0xc63f0a=0x0;_0xc63f0a<_0x52cb27[_0xfc20('0x22')];_0xc63f0a+=0x1){var _0x4c3b6a=this['findAgent'](_0x52cb27[_0xc63f0a]['connectedlinenum']);if(_0x4c3b6a){_0x52cb27[_0xc63f0a][_0xfc20('0x1e')]=_0x4c3b6a[_0xfc20('0x1e')];_0x52cb27[_0xc63f0a][_0xfc20('0x23')]=!![];_0x52cb27[_0xc63f0a][_0xfc20('0x24')]=_0x4c3b6a[_0xfc20('0x1f')];_0x52cb27[_0xc63f0a][_0xfc20('0x25')]=_['isNil'](_0x4c3b6a['interface'])?util[_0xfc20('0x26')](_0xfc20('0x21'),_0x4c3b6a[_0xfc20('0x1f')]):_0x4c3b6a['interface'];if(_0x52cb27[_0xc63f0a][_0xfc20('0x27')]){_0x52cb27[_0xc63f0a][_0xfc20('0x28')]=moment()[_0xfc20('0x26')](_0xfc20('0x29'));}if(_0x52cb27[_0xc63f0a][_0xfc20('0x2a')]){_0x52cb27[_0xc63f0a][_0xfc20('0x2b')]=moment()[_0xfc20('0x26')](_0xfc20('0x29'));}RpcMemberReport[_0xfc20('0x13')](_0x52cb27[_0xc63f0a]);}RpcVoiceQueueReport[_0xfc20('0x2c')](_0x52cb27[_0xc63f0a]);}};function extractCalleridNumber(_0x27e99f){var _0x5df617=_0x27e99f['match'](/<(.*?)>/);return _0x5df617?_0x5df617[0x1]:_0x27e99f;}Report['prototype'][_0xfc20('0x2d')]=function(_0x1f371f){for(var _0x391b59=0x0;_0x391b590x0?_0x1538d4:0x0;this['voiceQueues'][_0x14fd06[_0xbcf6('0x5f')]][_0xbcf6('0x2f')]=this[_0xbcf6('0x10')][_0x14fd06[_0xbcf6('0x5f')]][_0xbcf6('0x2f')]>_[_0xbcf6('0x64')](_0x14fd06['loggedin'])?_[_0xbcf6('0x64')](_0x14fd06[_0xbcf6('0x65')]):this[_0xbcf6('0x10')][_0x14fd06['queue']]['talking'];this[_0xbcf6('0x4d')](this[_0xbcf6('0x10')][_0x14fd06[_0xbcf6('0x5f')]],_0xbcf6('0x14'));}logger[_0xbcf6('0x42')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xbcf6('0x3b')](this[_0xbcf6('0x10')][_0x14fd06[_0xbcf6('0x5f')]],{'showHidden':![],'depth':null}));ami[_0xbcf6('0x40')](_0xbcf6('0x66'),this[_0xbcf6('0x10')][_0x14fd06[_0xbcf6('0x5f')]]);}}}catch(_0x5652c0){logger[_0xbcf6('0x38')](_0xbcf6('0x67'),util[_0xbcf6('0x3b')](_0x5652c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcf6('0xa')][_0xbcf6('0x17')]=function(_0x6a88fb){logger[_0xbcf6('0x42')](_0xbcf6('0x68'),util['inspect'](_0x6a88fb,{'showHidden':![],'depth':null}));ami[_0xbcf6('0x40')](_0xbcf6('0x69'),{});this[_0xbcf6('0x11')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x20e9a7){try{if(this['isNotNull'](_0x20e9a7)){logger[_0xbcf6('0x42')](_0xbcf6('0x6a'),_0x20e9a7['uniqueid'],util['inspect'](_0x20e9a7,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xbcf6('0xd')][_0x20e9a7[_0xbcf6('0x4a')]]))this[_0xbcf6('0xd')][_0x20e9a7[_0xbcf6('0x4a')]]=[];if(_['isUndefined'](this[_0xbcf6('0xf')][_0x20e9a7[_0xbcf6('0x4a')]]))this[_0xbcf6('0xf')][_0x20e9a7[_0xbcf6('0x4a')]]={};var _0x350e1c=new QueueReport();_0x350e1c[_0xbcf6('0x46')]=_0x20e9a7[_0xbcf6('0x5f')];_0x350e1c[_0xbcf6('0x6b')]=this['voiceQueues'][_0x350e1c['name']]&&this[_0xbcf6('0x10')][_0x350e1c['name']][_0xbcf6('0x6b')]?this[_0xbcf6('0x10')][_0x350e1c[_0xbcf6('0x46')]][_0xbcf6('0x6b')]||_0xbcf6('0x4e'):'inbound';_0x350e1c['queue']=_0x20e9a7['queue'];_0x350e1c[_0xbcf6('0x6c')]=moment()['format'](_0xbcf6('0x6d'));_0x350e1c[_0xbcf6('0x6e')]=_0x20e9a7['position'];_0x350e1c['count']=_0x20e9a7[_0xbcf6('0x6f')];_0x350e1c[_0xbcf6('0x4a')]=_0x20e9a7['uniqueid'];_0x350e1c[_0xbcf6('0x70')]=this['channels'][_0x20e9a7['uniqueid']][_0xbcf6('0x70')];logger[_0xbcf6('0x60')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x350e1c['name'],_0x350e1c[_0xbcf6('0x6b')]);_['merge'](_0x350e1c,_['pick'](_0x20e9a7,_[_0xbcf6('0x71')](_0x350e1c)));this[_0xbcf6('0xd')][_0x20e9a7[_0xbcf6('0x4a')]][_0xbcf6('0x72')](_0x350e1c);this[_0xbcf6('0xf')][_0x20e9a7[_0xbcf6('0x4a')]]=_0x350e1c;this['emitVoiceQueueChannelSave'](_0x350e1c,'queuecallerjoin');}}catch(_0x2267c8){logger[_0xbcf6('0x38')]('[%s][voiceQueueReport][queuecallerjoin]',_0x20e9a7[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x2267c8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5a1b63){try{if(this[_0xbcf6('0x5c')](_0x5a1b63)){logger[_0xbcf6('0x42')](_0xbcf6('0x73'),_0x5a1b63[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x5a1b63,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5a1b63['uniqueid']]){var _0x112c43=_['last'](this[_0xbcf6('0xd')][_0x5a1b63[_0xbcf6('0x4a')]]);_0x112c43[_0xbcf6('0x74')]=![];_0x112c43['queuecallercompleteAt']=null;_0x112c43[_0xbcf6('0x75')]=_0x5a1b63[_0xbcf6('0x75')];_0x112c43[_0xbcf6('0x76')]=_0x5a1b63[_0xbcf6('0x76')];_0x112c43[_0xbcf6('0x77')]=!![];_0x112c43[_0xbcf6('0x78')]=moment()['format'](_0xbcf6('0x6d'));_0x112c43['queuecallerexitreason']=_0xbcf6('0x79');_0x112c43['lastAssignedTo']=null;logger['info'](_0xbcf6('0x7a'),_0x112c43['name'],_0x112c43['type']);this[_0xbcf6('0xf')][_0x5a1b63[_0xbcf6('0x4a')]]=_0x112c43;this[_0xbcf6('0x48')](_0x112c43,_0xbcf6('0x77'));}}}catch(_0x7695c4){logger[_0xbcf6('0x38')](_0xbcf6('0x73'),_0x5a1b63[_0xbcf6('0x4a')],util['inspect'](_0x7695c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbcf6('0x1a')]=function(_0x5dd689){try{if(this[_0xbcf6('0x5c')](_0x5dd689)){logger[_0xbcf6('0x42')]('[%s][voiceQueueReport][queuecallerleave]',_0x5dd689[_0xbcf6('0x4a')],util['inspect'](_0x5dd689,{'showHidden':![],'depth':null}));if(this[_0xbcf6('0xd')][_0x5dd689[_0xbcf6('0x4a')]]){var _0x5e4ed2=_['last'](this[_0xbcf6('0xd')][_0x5dd689[_0xbcf6('0x4a')]]);_0x5e4ed2['queuecallerleaveAt']=moment()[_0xbcf6('0x44')](_0xbcf6('0x6d'));_0x5e4ed2[_0xbcf6('0x7b')]=_0x5dd689['connectedlinenum'];_0x5e4ed2[_0xbcf6('0x7c')]=_0x5dd689[_0xbcf6('0x7c')];logger[_0xbcf6('0x60')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5e4ed2['name'],_0x5e4ed2['type'],_0x5dd689[_0xbcf6('0x7b')],_0x5dd689[_0xbcf6('0x7c')]);this['channels'][_0x5dd689[_0xbcf6('0x4a')]]=_0x5e4ed2;this['emitVoiceQueueChannelSave'](_0x5e4ed2,_0xbcf6('0x7d'));}}}catch(_0x4e7555){logger['error'](_0xbcf6('0x7e'),_0x5dd689[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x4e7555,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcf6('0xa')]['syncAgentConnect']=function(_0x2368ea){try{if(this[_0xbcf6('0x5c')](_0x2368ea)){logger[_0xbcf6('0x42')](_0xbcf6('0x7f'),_0x2368ea['uniqueid'],util['inspect'](_0x2368ea,{'showHidden':![],'depth':null}));if(this[_0xbcf6('0xd')][_0x2368ea[_0xbcf6('0x4a')]]){var _0x444274=_['last'](this[_0xbcf6('0xd')][_0x2368ea[_0xbcf6('0x4a')]]);_0x444274[_0xbcf6('0x74')]=!![];_0x444274[_0xbcf6('0x80')]='COMPLETEDBYAGENT';logger['info'](_0xbcf6('0x81'),_0x444274[_0xbcf6('0x46')],_0x444274[_0xbcf6('0x6b')]);}}}catch(_0x3a1b39){logger[_0xbcf6('0x38')]('[%s][voiceQueueReport][agentconnect]',_0x2368ea[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x3a1b39,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcf6('0xa')][_0xbcf6('0x82')]=function(_0x520b26){try{if(this[_0xbcf6('0x5c')](_0x520b26)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x520b26[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x520b26,{'showHidden':![],'depth':null}));if(this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x4a')]]){var _0x20c617=_[_0xbcf6('0x83')](this['queueReports'][_0x520b26['uniqueid']]);_0x20c617[_0xbcf6('0x77')]=![];_0x20c617['queuecallerabandonAt']=null;_0x20c617[_0xbcf6('0x84')]=!![];_0x20c617[_0xbcf6('0x85')]=_0x520b26['membername'];_0x20c617['holdtime']=_0x520b26[_0xbcf6('0x75')];_0x20c617['queuecallercomplete']=!![];_0x20c617[_0xbcf6('0x86')]=![];_0x20c617[_0xbcf6('0x87')]=null;if(!_0x20c617[_0xbcf6('0x88')]){if(_0x520b26[_0xbcf6('0x89')]=='transfer'){_0x20c617[_0xbcf6('0x80')]=_0xbcf6('0x8a');logger[_0xbcf6('0x60')](_0xbcf6('0x8b'),_0x20c617[_0xbcf6('0x46')],_0x20c617[_0xbcf6('0x6b')]);}else{if(_[_0xbcf6('0x8c')](_0x520b26[_0xbcf6('0x8d')][_0xbcf6('0x8e')](),_0xbcf6('0x8f'))){if(this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x90')]]){var _0x1e83c6=_[_0xbcf6('0x83')](this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x90')]]);_0x1e83c6[_0xbcf6('0x74')]=![];_0x1e83c6['queuecallerexit']=!![];_0x1e83c6[_0xbcf6('0x87')]=moment(_0x20c617[_0xbcf6('0x6c')])[_0xbcf6('0x91')](_0x520b26[_0xbcf6('0x75')],_0xbcf6('0x92'))[_0xbcf6('0x44')](_0xbcf6('0x6d'));_0x1e83c6[_0xbcf6('0x80')]=_0xbcf6('0x93');_0x1e83c6[_0xbcf6('0x88')]=!![];_0x1e83c6['transfertype']='FORWARD';_0x1e83c6[_0xbcf6('0x94')]=_0x520b26[_0xbcf6('0x95')];_0x1e83c6[_0xbcf6('0x96')]=_0x520b26[_0xbcf6('0x4a')];logger['info'](_0xbcf6('0x97'),_0x1e83c6['name'],_0x1e83c6['type']);var _0x38bdec=this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x90')]];this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x90')]]=this[_0xbcf6('0xd')][_0x520b26[_0xbcf6('0x4a')]];this[_0xbcf6('0xd')][_0x520b26['uniqueid']]=_0x38bdec;}}else{_0x20c617['queuecallerexitreason']='COMPLETEDBY'+_0x520b26['reason'][_0xbcf6('0x98')]();logger[_0xbcf6('0x60')](_0xbcf6('0x99'),_0x20c617[_0xbcf6('0x46')],_0x20c617[_0xbcf6('0x6b')],_0x20c617['queuecallerexitreason']);}}}this[_0xbcf6('0xf')][_0x520b26[_0xbcf6('0x4a')]]=_0x20c617;this[_0xbcf6('0x48')](_0x20c617,_0xbcf6('0x9a'));}}}catch(_0xa55ff){logger[_0xbcf6('0x38')](_0xbcf6('0x9b'),_0x520b26[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0xa55ff,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcf6('0xa')][_0xbcf6('0x1d')]=function(_0x548c1b){try{if(this[_0xbcf6('0x5c')](_0x548c1b)){logger['debug'](_0xbcf6('0x9c'),_0x548c1b[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x548c1b,{'showHidden':![],'depth':null}));this[_0xbcf6('0x9d')](_0x548c1b[_0xbcf6('0x4a')],_['keys'](_0x548c1b[_0xbcf6('0x9e')])[0x0],_0x548c1b[_0xbcf6('0x9f')]);if(this['queueReports'][_0x548c1b['uniqueid']]){var _0x2c58fc=_['last'](this['queueReports'][_0x548c1b[_0xbcf6('0x4a')]]);if(_0x2c58fc){if(this[_0xbcf6('0x5c')](_0x548c1b[_0xbcf6('0x9e')])&&this[_0xbcf6('0x5c')](_0x548c1b[_0xbcf6('0x9e')][_0xbcf6('0xa0')])){switch(_0x548c1b[_0xbcf6('0x9f')]){case _0xbcf6('0xa1'):_0x2c58fc[_0xbcf6('0x86')]=![];_0x2c58fc[_0xbcf6('0x87')]=null;break;case _0xbcf6('0xa2'):_0x2c58fc[_0xbcf6('0xa3')]=_0xbcf6('0xa4');_0x2c58fc[_0xbcf6('0x86')]=!![];_0x2c58fc['queuecallerexitAt']=moment()['format'](_0xbcf6('0x6d'));_0x2c58fc[_0xbcf6('0xa5')]=moment()[_0xbcf6('0x44')](_0xbcf6('0x6d'));logger[_0xbcf6('0x42')](_0xbcf6('0xa6'),_0x548c1b[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x2c58fc,{'showHidden':![],'depth':null}));ami[_0xbcf6('0x40')](_0xbcf6('0xa7'),_0x2c58fc);break;default:_0x2c58fc[_0xbcf6('0x86')]=!![];_0x2c58fc[_0xbcf6('0x87')]=moment()[_0xbcf6('0x44')](_0xbcf6('0x6d'));_0x2c58fc[_0xbcf6('0xa5')]=moment()['format'](_0xbcf6('0x6d'));}_0x2c58fc[_0xbcf6('0x77')]=![];_0x2c58fc[_0xbcf6('0x78')]=null;_0x2c58fc['queuecallerexitreason']=_0x548c1b[_0xbcf6('0x9f')];this['channels'][_0x548c1b[_0xbcf6('0x4a')]]=_0x2c58fc;this[_0xbcf6('0x48')](_0x2c58fc,'varset');}else if(this[_0xbcf6('0x5c')](_0x548c1b['variable'])&&this[_0xbcf6('0x5c')](_0x548c1b[_0xbcf6('0x9e')][_0xbcf6('0xa8')])){if(!_0x2c58fc['queuecallerabandon']){_0x2c58fc['queuecallerexit']=!![];_0x2c58fc[_0xbcf6('0x87')]=moment()[_0xbcf6('0x44')](_0xbcf6('0x6d'));_0x2c58fc['queuecallerexitreason']=_0xbcf6('0xa9');_0x2c58fc[_0xbcf6('0xa5')]=moment()[_0xbcf6('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbcf6('0xf')][_0x548c1b[_0xbcf6('0x4a')]]=_0x2c58fc;}}logger[_0xbcf6('0x60')](_0xbcf6('0xaa'),_0x548c1b['uniqueid'],_0x2c58fc['name'],_0x2c58fc['type'],_['keys'](_0x548c1b[_0xbcf6('0x9e')])[0x0],_0x548c1b[_0xbcf6('0x9f')]);_0x2c58fc[_0xbcf6('0x13')]=this[_0xbcf6('0x13')][_0x548c1b[_0xbcf6('0x4a')]];}}}}catch(_0x448f54){logger['error']('[%s][voiceQueueReport][varset]',_0x548c1b[_0xbcf6('0x4a')],util[_0xbcf6('0x3b')](_0x448f54,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcf6('0xa')][_0xbcf6('0x9d')]=function(_0x3c3c2e,_0x13ffce,_0x3388cd){var _0x70cb86=['rtpaudioqos','rtpaudioqosbridged',_0xbcf6('0xab'),_0xbcf6('0xac'),_0xbcf6('0xad'),_0xbcf6('0xae'),_0xbcf6('0xaf'),_0xbcf6('0xb0'),_0xbcf6('0xb1'),_0xbcf6('0xb2'),_0xbcf6('0xb3'),'bridgepvtcallid',_0xbcf6('0xb4'),_0xbcf6('0xb5'),_0xbcf6('0xb6'),_0xbcf6('0xb7'),_0xbcf6('0xb8'),_0xbcf6('0xb9'),_0xbcf6('0xba')];if(!_[_0xbcf6('0xbb')](_0x13ffce)&&!_[_0xbcf6('0xbc')](_0x70cb86,_0x13ffce)){if(_['isUndefined'](this[_0xbcf6('0x13')][_0x3c3c2e])){this['variables'][_0x3c3c2e]={};}this['variables'][_0x3c3c2e][_0x13ffce]=_0x3388cd;}};VoiceQueueReport[_0xbcf6('0xa')][_0xbcf6('0xbd')]=function(_0x4d3697,_0x2e265a,_0x5a6160){var _0x350ead={};for(var _0x35bd7f=0x0;_0x35bd7f0x0?_0x1ebff3:0x0;this[_0xbea5('0x11')][_0x58c91c['queue']][_0xbea5('0x65')]=this[_0xbea5('0x11')][_0x58c91c['queue']][_0xbea5('0x65')]>_['toNumber'](_0x58c91c[_0xbea5('0x66')])?_[_0xbea5('0x62')](_0x58c91c[_0xbea5('0x66')]):this['voiceQueues'][_0x58c91c[_0xbea5('0x5f')]]['talking'];this[_0xbea5('0x4a')](this[_0xbea5('0x11')][_0x58c91c['queue']],_0xbea5('0x15'));}logger[_0xbea5('0x44')](_0xbea5('0x67'),util['inspect'](this['voiceQueues'][_0x58c91c[_0xbea5('0x5f')]],{'showHidden':![],'depth':null}));ami[_0xbea5('0x3c')](_0xbea5('0x68'),this['voiceQueues'][_0x58c91c[_0xbea5('0x5f')]]);}}}catch(_0x4be399){logger[_0xbea5('0x37')]('[voiceQueueReport][queuesummary]',util[_0xbea5('0x39')](_0x4be399,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')]['syncQueueSummaryComplete']=function(_0x3cc021){logger['debug'](_0xbea5('0x69'),util[_0xbea5('0x39')](_0x3cc021,{'showHidden':![],'depth':null}));ami[_0xbea5('0x3c')](_0xbea5('0x6a'),{});this[_0xbea5('0x12')]=!![];};VoiceQueueReport['prototype'][_0xbea5('0x1a')]=function(_0x4bf071){try{if(this[_0xbea5('0x5b')](_0x4bf071)){logger[_0xbea5('0x44')](_0xbea5('0x6b'),_0x4bf071[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x4bf071,{'showHidden':![],'depth':null}));if(_[_0xbea5('0x5c')](this[_0xbea5('0xe')][_0x4bf071['uniqueid']]))this[_0xbea5('0xe')][_0x4bf071[_0xbea5('0x40')]]=[];if(_[_0xbea5('0x5c')](this[_0xbea5('0x10')][_0x4bf071[_0xbea5('0x40')]]))this[_0xbea5('0x10')][_0x4bf071[_0xbea5('0x40')]]={};var _0xc06331=new QueueReport();_0xc06331[_0xbea5('0x42')]=_0x4bf071[_0xbea5('0x5f')];_0xc06331['type']=this[_0xbea5('0x11')][_0xc06331[_0xbea5('0x42')]]&&this['voiceQueues'][_0xc06331[_0xbea5('0x42')]]['type']?this['voiceQueues'][_0xc06331[_0xbea5('0x42')]]['type']||'inbound':_0xbea5('0x4c');_0xc06331[_0xbea5('0x5f')]=_0x4bf071[_0xbea5('0x5f')];_0xc06331['queuecallerjoinAt']=moment()['format'](_0xbea5('0x6c'));_0xc06331[_0xbea5('0x6d')]=_0x4bf071[_0xbea5('0x6d')];_0xc06331[_0xbea5('0x6e')]=_0x4bf071[_0xbea5('0x6e')];_0xc06331[_0xbea5('0x40')]=_0x4bf071[_0xbea5('0x40')];_0xc06331['routealias']=this[_0xbea5('0x10')][_0x4bf071[_0xbea5('0x40')]][_0xbea5('0x6f')];logger[_0xbea5('0x70')](_0xbea5('0x71'),_0xc06331[_0xbea5('0x42')],_0xc06331['type']);_['merge'](_0xc06331,_['pick'](_0x4bf071,_[_0xbea5('0x72')](_0xc06331)));this[_0xbea5('0xe')][_0x4bf071[_0xbea5('0x40')]]['push'](_0xc06331);this['channels'][_0x4bf071['uniqueid']]=_0xc06331;this[_0xbea5('0x3d')](_0xc06331,'queuecallerjoin');}}catch(_0x18e363){logger[_0xbea5('0x37')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4bf071[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x18e363,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x1b')]=function(_0x1e8978){try{if(this['isNotNull'](_0x1e8978)){logger[_0xbea5('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1e8978[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x1e8978,{'showHidden':![],'depth':null}));if(this[_0xbea5('0xe')][_0x1e8978['uniqueid']]){var _0x4689c5=_['last'](this[_0xbea5('0xe')][_0x1e8978['uniqueid']]);_0x4689c5[_0xbea5('0x73')]=![];_0x4689c5[_0xbea5('0x74')]=null;_0x4689c5[_0xbea5('0x75')]=_0x1e8978[_0xbea5('0x75')];_0x4689c5['originalposition']=_0x1e8978[_0xbea5('0x76')];_0x4689c5[_0xbea5('0x77')]=!![];_0x4689c5['queuecallerabandonAt']=moment()[_0xbea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4689c5['queuecallerexitreason']='ABANDONED';_0x4689c5[_0xbea5('0x78')]=null;logger[_0xbea5('0x70')](_0xbea5('0x79'),_0x4689c5['name'],_0x4689c5[_0xbea5('0x4b')]);this[_0xbea5('0x10')][_0x1e8978[_0xbea5('0x40')]]=_0x4689c5;this['emitVoiceQueueChannelRemove'](_0x4689c5,_0xbea5('0x77'));}}}catch(_0x597a0a){logger['error'](_0xbea5('0x7a'),_0x1e8978[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x597a0a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x1d')]=function(_0x2aaf22){try{if(this['isNotNull'](_0x2aaf22)){logger[_0xbea5('0x44')](_0xbea5('0x7b'),_0x2aaf22[_0xbea5('0x40')],util['inspect'](_0x2aaf22,{'showHidden':![],'depth':null}));if(this[_0xbea5('0xe')][_0x2aaf22[_0xbea5('0x40')]]){var _0x5374e8=_[_0xbea5('0x7c')](this[_0xbea5('0xe')][_0x2aaf22[_0xbea5('0x40')]]);_0x5374e8[_0xbea5('0x7d')]=moment()['format'](_0xbea5('0x6c'));_0x5374e8[_0xbea5('0x7e')]=_0x2aaf22[_0xbea5('0x7e')];_0x5374e8[_0xbea5('0x7f')]=_0x2aaf22['connectedlinename'];logger[_0xbea5('0x70')](_0xbea5('0x80'),_0x5374e8['name'],_0x5374e8[_0xbea5('0x4b')],_0x2aaf22['connectedlinenum'],_0x2aaf22[_0xbea5('0x7f')]);this['channels'][_0x2aaf22['uniqueid']]=_0x5374e8;this[_0xbea5('0x3d')](_0x5374e8,'queuecallerleave');}}}catch(_0x4fb08e){logger[_0xbea5('0x37')](_0xbea5('0x7b'),_0x2aaf22[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x4fb08e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x20')]=function(_0x341345){try{if(this[_0xbea5('0x5b')](_0x341345)){logger[_0xbea5('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x341345[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x341345,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x341345[_0xbea5('0x40')]]){var _0x1471a2=_[_0xbea5('0x7c')](this[_0xbea5('0xe')][_0x341345[_0xbea5('0x40')]]);_0x1471a2[_0xbea5('0x73')]=!![];_0x1471a2[_0xbea5('0x46')]=_0xbea5('0x81');logger['info'](_0xbea5('0x82'),_0x1471a2[_0xbea5('0x42')],_0x1471a2[_0xbea5('0x4b')]);}}}catch(_0x2681d6){logger[_0xbea5('0x37')](_0xbea5('0x83'),_0x341345[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x2681d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x1e')]=function(_0x2e9966){try{if(this[_0xbea5('0x5b')](_0x2e9966)){logger[_0xbea5('0x44')](_0xbea5('0x84'),_0x2e9966['uniqueid'],util['inspect'](_0x2e9966,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2e9966[_0xbea5('0x40')]]){var _0x3d440a=_['last'](this[_0xbea5('0xe')][_0x2e9966[_0xbea5('0x40')]]);_0x3d440a[_0xbea5('0x77')]=![];_0x3d440a[_0xbea5('0x85')]=null;_0x3d440a[_0xbea5('0x86')]=!![];_0x3d440a[_0xbea5('0x78')]=_0x2e9966[_0xbea5('0x87')];_0x3d440a[_0xbea5('0x75')]=_0x2e9966[_0xbea5('0x75')];_0x3d440a['queuecallercomplete']=!![];_0x3d440a['queuecallerexit']=![];_0x3d440a[_0xbea5('0x88')]=null;if(!_0x3d440a['transfer']){if(_0x2e9966['reason']==_0xbea5('0x89')){_0x3d440a['queuecallerexitreason']='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x3d440a['name'],_0x3d440a[_0xbea5('0x4b')]);}else{if(_[_0xbea5('0x8a')](_0x2e9966[_0xbea5('0x35')][_0xbea5('0x8b')](),'local/')){if(this[_0xbea5('0xe')][_0x2e9966['linkedid']]){var _0x24006a=_[_0xbea5('0x7c')](this[_0xbea5('0xe')][_0x2e9966['linkedid']]);_0x24006a[_0xbea5('0x73')]=![];_0x24006a[_0xbea5('0x8c')]=!![];_0x24006a[_0xbea5('0x88')]=moment(_0x3d440a[_0xbea5('0x8d')])['add'](_0x2e9966[_0xbea5('0x75')],_0xbea5('0x8e'))[_0xbea5('0x47')](_0xbea5('0x6c'));_0x24006a[_0xbea5('0x46')]='FORWARDTRANSFER';_0x24006a[_0xbea5('0x89')]=!![];_0x24006a['transfertype']='FORWARD';_0x24006a['transferexten']=_0x2e9966[_0xbea5('0x8f')];_0x24006a[_0xbea5('0x90')]=_0x2e9966[_0xbea5('0x40')];logger[_0xbea5('0x70')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x24006a['name'],_0x24006a[_0xbea5('0x4b')]);var _0x1deb43=this['queueReports'][_0x2e9966['linkedid']];this[_0xbea5('0xe')][_0x2e9966[_0xbea5('0x91')]]=this[_0xbea5('0xe')][_0x2e9966['uniqueid']];this['queueReports'][_0x2e9966[_0xbea5('0x40')]]=_0x1deb43;}}else{_0x3d440a[_0xbea5('0x46')]=_0xbea5('0x92')+_0x2e9966[_0xbea5('0x93')]['toUpperCase']();logger['info'](_0xbea5('0x94'),_0x3d440a['name'],_0x3d440a['type'],_0x3d440a[_0xbea5('0x46')]);}}}this[_0xbea5('0x10')][_0x2e9966[_0xbea5('0x40')]]=_0x3d440a;this['emitVoiceQueueChannelRemove'](_0x3d440a,_0xbea5('0x95'));}}}catch(_0x861f84){logger['error'](_0xbea5('0x84'),_0x2e9966[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x861f84,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x96')]=function(_0x4bd0a2){try{if(this[_0xbea5('0x5b')](_0x4bd0a2)){logger[_0xbea5('0x44')]('[%s][voiceQueueReport][varset]',_0x4bd0a2['uniqueid'],util['inspect'](_0x4bd0a2,{'showHidden':![],'depth':null}));this[_0xbea5('0x97')](_0x4bd0a2[_0xbea5('0x40')],_[_0xbea5('0x72')](_0x4bd0a2[_0xbea5('0x98')])[0x0],_0x4bd0a2[_0xbea5('0x99')]);if(this[_0xbea5('0xe')][_0x4bd0a2['uniqueid']]){var _0x275886=_[_0xbea5('0x7c')](this['queueReports'][_0x4bd0a2['uniqueid']]);if(_0x275886){if(this['isNotNull'](_0x4bd0a2[_0xbea5('0x98')])&&this['isNotNull'](_0x4bd0a2[_0xbea5('0x98')]['queuestatus'])){switch(_0x4bd0a2[_0xbea5('0x99')]){case'CONTINUE':_0x275886[_0xbea5('0x8c')]=![];_0x275886[_0xbea5('0x88')]=null;break;case _0xbea5('0x9a'):_0x275886[_0xbea5('0x9b')]=_0xbea5('0x9c');_0x275886[_0xbea5('0x8c')]=!![];_0x275886[_0xbea5('0x88')]=moment()[_0xbea5('0x47')](_0xbea5('0x6c'));_0x275886[_0xbea5('0x7d')]=moment()[_0xbea5('0x47')](_0xbea5('0x6c'));logger[_0xbea5('0x44')](_0xbea5('0x9d'),_0x4bd0a2[_0xbea5('0x40')],util[_0xbea5('0x39')](_0x275886,{'showHidden':![],'depth':null}));ami[_0xbea5('0x3c')](_0xbea5('0x9e'),_0x275886);break;default:_0x275886[_0xbea5('0x8c')]=!![];_0x275886[_0xbea5('0x88')]=moment()[_0xbea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x275886['queuecallerleaveAt']=moment()[_0xbea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x275886[_0xbea5('0x77')]=![];_0x275886[_0xbea5('0x85')]=null;_0x275886[_0xbea5('0x46')]=_0x4bd0a2[_0xbea5('0x99')];this[_0xbea5('0x10')][_0x4bd0a2[_0xbea5('0x40')]]=_0x275886;this[_0xbea5('0x43')](_0x275886,'varset');}else if(this[_0xbea5('0x5b')](_0x4bd0a2[_0xbea5('0x98')])&&this[_0xbea5('0x5b')](_0x4bd0a2['variable']['queueposition'])){if(!_0x275886['queuecallerabandon']){_0x275886[_0xbea5('0x8c')]=!![];_0x275886[_0xbea5('0x88')]=moment()[_0xbea5('0x47')](_0xbea5('0x6c'));_0x275886[_0xbea5('0x46')]=_0xbea5('0x9f');_0x275886['queuecallerleaveAt']=moment()[_0xbea5('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4bd0a2[_0xbea5('0x40')]]=_0x275886;}}logger[_0xbea5('0x70')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x4bd0a2['uniqueid'],_0x275886['name'],_0x275886[_0xbea5('0x4b')],_[_0xbea5('0x72')](_0x4bd0a2[_0xbea5('0x98')])[0x0],_0x4bd0a2[_0xbea5('0x99')]);_0x275886[_0xbea5('0x14')]=this[_0xbea5('0x14')][_0x4bd0a2[_0xbea5('0x40')]];}}}}catch(_0x456ee3){logger[_0xbea5('0x37')]('[%s][voiceQueueReport][varset]',_0x4bd0a2[_0xbea5('0x40')],util['inspect'](_0x456ee3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbea5('0x9')][_0xbea5('0x97')]=function(_0x5d88cb,_0x598a01,_0x4bd4a5){var _0x34df2b=['rtpaudioqos',_0xbea5('0xa0'),_0xbea5('0xa1'),_0xbea5('0xa2'),_0xbea5('0xa3'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xbea5('0xa4'),_0xbea5('0xa5'),'sipuri',_0xbea5('0xa6'),_0xbea5('0xa7'),_0xbea5('0xa8'),'memberdynamic',_0xbea5('0xa9'),_0xbea5('0xaa'),'membername',_0xbea5('0xab'),_0xbea5('0xac')];if(!_[_0xbea5('0x33')](_0x598a01)&&!_[_0xbea5('0xad')](_0x34df2b,_0x598a01)){if(_[_0xbea5('0x5c')](this['variables'][_0x5d88cb])){this[_0xbea5('0x14')][_0x5d88cb]={};}this[_0xbea5('0x14')][_0x5d88cb][_0x598a01]=_0x4bd4a5;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x5d4e0e,_0x2eb2d5,_0x163b3a){var _0x430a0c={};for(var _0x15d1b8=0x0;_0x15d1b8=0x0?moment(_0x526951['endtime'])[_0x4e7f('0xe')](_0x526951[_0x4e7f('0x17')],'seconds'):null,'data1':_0x4e7f('0x1a'),'data2':_0x526951[_0x4e7f('0x12')],'data3':_0x526951[_0x4e7f('0x1b')],'data4':_0x526951['dialstring']||null,'role':_0x4e7f('0x11'),'internal':_0x526951[_0x4e7f('0x12')]?_[_0x4e7f('0x13')](_0x526951[_0x4e7f('0x12')]):undefined,'uniqueid':_0x526951['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x4b46=['CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','seconds','inbound','exten','queue','agent','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','diff','outbound','accountcode','lodash','util','../client','voiceQueueReport','Request'];(function(_0x3ad765,_0x2a4349){var _0x2124d4=function(_0x404763){while(--_0x404763){_0x3ad765['push'](_0x3ad765['shift']());}};_0x2124d4(++_0x2a4349);}(_0x4b46,0x183));var _0x64b4=function(_0x3e97f3,_0x927116){_0x3e97f3=_0x3e97f3-0x0;var _0x3ee060=_0x4b46[_0x3e97f3];return _0x3ee060;};'use strict';var moment=require('moment');var _=require(_0x64b4('0x0'));var util=require(_0x64b4('0x1'));var client=require(_0x64b4('0x2'));exports[_0x64b4('0x3')]=function(_0x3d3fa){var _0x10c3d0=_0x3d3fa['queuecallercompleteAt']||_0x3d3fa['queuecallerexitAt'];return client[_0x64b4('0x4')](_0x64b4('0x5'),{'body':{'channel':_0x64b4('0x6'),'membername':_0x3d3fa[_0x64b4('0x7')],'interface':_[_0x64b4('0x8')](_0x3d3fa[_0x64b4('0x9')])?util[_0x64b4('0xa')](_0x64b4('0xb'),_0x3d3fa[_0x64b4('0x7')]):_0x3d3fa[_0x64b4('0x9')],'type':'TALKING','enterAt':_0x3d3fa[_0x64b4('0xc')],'exitAt':_0x10c3d0,'duration':moment(_0x10c3d0)['diff'](_0x3d3fa[_0x64b4('0xc')],_0x64b4('0xd')),'data1':_0x64b4('0xe'),'data2':_0x3d3fa['calleridnum'],'data3':_0x3d3fa[_0x64b4('0xf')],'data4':null,'data5':_0x3d3fa[_0x64b4('0x10')],'role':_0x64b4('0x11'),'internal':_0x3d3fa['accountcode']?_[_0x64b4('0x12')](_0x3d3fa['accountcode']):undefined,'uniqueid':_0x3d3fa[_0x64b4('0x13')]},'log':_0x64b4('0x5')});};exports[_0x64b4('0x14')]=function(_0x27340e){return client[_0x64b4('0x4')]('CreateMemberReport',{'body':{'channel':_0x64b4('0x6'),'membername':_0x27340e[_0x64b4('0x15')],'interface':_0x27340e['interface'],'type':_0x64b4('0x16'),'enterAt':_0x27340e[_0x64b4('0x17')],'exitAt':_0x27340e[_0x64b4('0x18')],'duration':moment(_0x27340e[_0x64b4('0x18')])[_0x64b4('0x19')](_0x27340e[_0x64b4('0x17')],_0x64b4('0xd'))>=0x0?moment(_0x27340e['endtime'])[_0x64b4('0x19')](_0x27340e[_0x64b4('0x17')],'seconds'):null,'data1':_0x64b4('0x1a'),'data2':_0x27340e[_0x64b4('0x1b')],'data3':_0x27340e[_0x64b4('0xf')],'data4':_0x27340e['dialstring']||null,'role':_0x64b4('0x11'),'internal':_0x27340e['accountcode']?_[_0x64b4('0x12')](_0x27340e['accountcode']):undefined,'uniqueid':_0x27340e[_0x64b4('0x13')]},'log':_0x64b4('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 3990a8d..df13cf8 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 _0x1730=['previewRecallmeReminderInterval','GetSettings','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x95bf5d,_0x43839b){var _0x29a35f=function(_0x2e94d5){while(--_0x2e94d5){_0x95bf5d['push'](_0x95bf5d['shift']());}};_0x29a35f(++_0x43839b);}(_0x1730,0xda));var _0x0173=function(_0x259b41,_0x1e789b){_0x259b41=_0x259b41-0x0;var _0x31ab15=_0x1730[_0x259b41];return _0x31ab15;};'use strict';var client=require('../client');exports[_0x0173('0x0')]=function(){return client[_0x0173('0x1')](_0x0173('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0173('0x3'),_0x0173('0x4')]},'log':_0x0173('0x5')});}; \ No newline at end of file +var _0xc64b=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x3d13bb,_0x262a54){var _0x4b5a1b=function(_0x53417e){while(--_0x53417e){_0x3d13bb['push'](_0x3d13bb['shift']());}};_0x4b5a1b(++_0x262a54);}(_0xc64b,0xaf));var _0xbc64=function(_0x45daf0,_0x57883f){_0x45daf0=_0x45daf0-0x0;var _0x21dcbe=_0xc64b[_0x45daf0];return _0x21dcbe;};'use strict';var client=require(_0xbc64('0x0'));exports[_0xbc64('0x1')]=function(){return client[_0xbc64('0x2')](_0xbc64('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbc64('0x4'),_0xbc64('0x5')]},'log':_0xbc64('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1521238..0d87555 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 _0x5673=['html','Request','GetTemplate','name'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x5673,0x145));var _0x3567=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x5673[_0x487496];return _0x539dc8;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x185196){return function(_0xa143e7){return client[_0x3567('0x0')](_0x3567('0x1'),{'options':{'raw':!![],'attributes':['id',_0x3567('0x2'),_0x3567('0x3')]},'log':_0x3567('0x1')});};}; \ No newline at end of file +var _0x4a7b=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x4a7b,0x81));var _0xb4a7=function(_0x297b2c,_0x35bac0){_0x297b2c=_0x297b2c-0x0;var _0x189bf8=_0x4a7b[_0x297b2c];return _0x189bf8;};'use strict';var client=require(_0xb4a7('0x0'));exports[_0xb4a7('0x1')]=function(_0x38fb21){return function(_0x5210d5){return client[_0xb4a7('0x2')](_0xb4a7('0x3'),{'options':{'raw':!![],'attributes':['id',_0xb4a7('0x4'),_0xb4a7('0x5')]},'log':_0xb4a7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6b9edfe..6d0d502 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 _0x7af1=['value','AnyConditions','field','Action','Actions','action','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','status','Condition','AllConditions','operator'];(function(_0x36271b,_0x4e3807){var _0x496ac2=function(_0x2fc023){while(--_0x2fc023){_0x36271b['push'](_0x36271b['shift']());}};_0x496ac2(++_0x4e3807);}(_0x7af1,0x12b));var _0x17af=function(_0x50c9b6,_0x21d360){_0x50c9b6=_0x50c9b6-0x0;var _0x46f4a0=_0x7af1[_0x50c9b6];return _0x46f4a0;};'use strict';var client=require(_0x17af('0x0'));exports[_0x17af('0x1')]=function(_0x5d50c9){return function(_0x19930a){return client['Request'](_0x17af('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x17af('0x3')],'include':[{'model':_0x17af('0x4'),'as':_0x17af('0x5'),'attributes':['id','field',_0x17af('0x6'),_0x17af('0x7')]},{'model':_0x17af('0x4'),'as':_0x17af('0x8'),'attributes':['id',_0x17af('0x9'),_0x17af('0x6'),_0x17af('0x7')]},{'model':_0x17af('0xa'),'as':_0x17af('0xb'),'attributes':['id',_0x17af('0xc'),'data1','data2',_0x17af('0xd'),_0x17af('0xe'),_0x17af('0xf'),_0x17af('0x10'),_0x17af('0x11')]}]},'log':_0x17af('0x2')});};}; \ No newline at end of file +var _0x5b34=['value','Action','action','data1','data2','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','Condition','AllConditions','field','operator','AnyConditions'];(function(_0x360f99,_0x41087d){var _0x10a543=function(_0x1214ca){while(--_0x1214ca){_0x360f99['push'](_0x360f99['shift']());}};_0x10a543(++_0x41087d);}(_0x5b34,0x13a));var _0x45b3=function(_0x163ec9,_0x223272){_0x163ec9=_0x163ec9-0x0;var _0x31d7b5=_0x5b34[_0x163ec9];return _0x31d7b5;};'use strict';var client=require(_0x45b3('0x0'));exports[_0x45b3('0x1')]=function(_0x23e872){return function(_0x47c249){return client[_0x45b3('0x2')](_0x45b3('0x3'),{'options':{'raw':![],'attributes':['id',_0x45b3('0x4'),'channel','status'],'include':[{'model':_0x45b3('0x5'),'as':_0x45b3('0x6'),'attributes':['id',_0x45b3('0x7'),_0x45b3('0x8'),'value']},{'model':_0x45b3('0x5'),'as':_0x45b3('0x9'),'attributes':['id',_0x45b3('0x7'),_0x45b3('0x8'),_0x45b3('0xa')]},{'model':_0x45b3('0xb'),'as':'Actions','attributes':['id',_0x45b3('0xc'),_0x45b3('0xd'),_0x45b3('0xe'),'data3',_0x45b3('0xf'),_0x45b3('0x10'),'data6',_0x45b3('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 f782ee8..2a9aeb2 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 _0x7119=['getTrunks','GetTrunk','name','registry','defaultuser'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7119,0x1c7));var _0x9711=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x7119[_0x3712e2];return _0x1faff4;};'use strict';var client=require('../client');exports[_0x9711('0x0')]=function(_0x529e10){return function(_0x30d901){return client['Request'](_0x9711('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9711('0x2'),_0x9711('0x3'),_0x9711('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xb8ca=['GetTrunk','defaultuser','../client','getTrunks','Request'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0xb8ca,0x89));var _0xab8c=function(_0x38bb59,_0x1a28d8){_0x38bb59=_0x38bb59-0x0;var _0x53da6b=_0xb8ca[_0x38bb59];return _0x53da6b;};'use strict';var client=require(_0xab8c('0x0'));exports[_0xab8c('0x1')]=function(_0x29262d){return function(_0x565d58){return client[_0xab8c('0x2')](_0xab8c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xab8c('0x4')]},'log':_0xab8c('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9ad27a0..5ec4705 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x3aaea0,_0x24b149){var _0x369654=function(_0x381fda){while(--_0x381fda){_0x3aaea0['push'](_0x3aaea0['shift']());}};_0x369654(++_0x24b149);}(_0x70e0,0x17b));var _0x070e=function(_0x2f39c3,_0x1f192a){_0x2f39c3=_0x2f39c3-0x0;var _0x1b22bb=_0x70e0[_0x2f39c3];return _0x1b22bb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x35a58d,_0x11f7b4){var _0xa46555=function(_0x273135){while(--_0x273135){_0x35a58d['push'](_0x35a58d['shift']());}};_0xa46555(++_0x11f7b4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 44efc96..eae2c8a 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 _0x1ff6=['update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0x1ff6,0xf7));var _0x61ff=function(_0x8ee685,_0x2c7a1e){_0x8ee685=_0x8ee685-0x0;var _0x33187a=_0x1ff6[_0x8ee685];return _0x33187a;};'use strict';var client=require(_0x61ff('0x0'));exports[_0x61ff('0x1')]=function(_0x16f7f3){return client[_0x61ff('0x2')]('CreateVoiceAgentReport',{'body':_0x16f7f3,'log':'CreateVoiceAgentReport'});};exports[_0x61ff('0x3')]=function(_0x1162cb,_0x5e8da6,_0x3aca37){return client['Request'](_0x61ff('0x4'),{'body':_0x1162cb,'options':{'where':{'uniqueid':_0x5e8da6,'interface':_0x3aca37,'agentcomplete':!![]}},'log':_0x61ff('0x4')});}; \ No newline at end of file +var _0xc5d5=['../client','create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xc5d5,0xf6));var _0x5c5d=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xc5d5[_0x8de54f];return _0x14cba4;};'use strict';var client=require(_0x5c5d('0x0'));exports[_0x5c5d('0x1')]=function(_0x3d114f){return client['Request'](_0x5c5d('0x2'),{'body':_0x3d114f,'log':_0x5c5d('0x2')});};exports[_0x5c5d('0x3')]=function(_0x40e12f,_0x1dacea,_0x44130a){return client[_0x5c5d('0x4')](_0x5c5d('0x5'),{'body':_0x40e12f,'options':{'where':{'uniqueid':_0x1dacea,'interface':_0x44130a,'agentcomplete':!![]}},'log':_0x5c5d('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 180cba9..093700e 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 _0x2bdb=['duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x2bdb,0x1bb));var _0xb2bd=function(_0x56f7e8,_0x490efc){_0x56f7e8=_0x56f7e8-0x0;var _0x13f068=_0x2bdb[_0x56f7e8];return _0x13f068;};'use strict';var moment=require(_0xb2bd('0x0'));var util=require('util');var _=require(_0xb2bd('0x1'));var client=require(_0xb2bd('0x2'));exports[_0xb2bd('0x3')]=function(_0x4a8d8c){return client[_0xb2bd('0x4')](_0xb2bd('0x5'),{'body':_[_0xb2bd('0x6')](_0x4a8d8c,{'source':_0x4a8d8c[_0xb2bd('0x7')],'destinationcontext':_0x4a8d8c[_0xb2bd('0x8')],'callerid':_0x4a8d8c[_0xb2bd('0x9')],'amaflags':_0xb2bd('0xa')}),'log':_0xb2bd('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xb2bd('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xb2bd('0xb')],'createdAt':{'$between':[moment()[_0xb2bd('0xc')](_0xb2bd('0xd'))[_0xb2bd('0xe')](_0xb2bd('0xf')),moment()[_0xb2bd('0x10')]('day')['format'](_0xb2bd('0xf'))]}},'attributes':[_0xb2bd('0x11'),_0xb2bd('0x12'),_0xb2bd('0x13'),_0xb2bd('0x14')]},'log':_0xb2bd('0x15')});};}; \ No newline at end of file +var _0x99c5=['CreateVoiceCallReport','merge','calleridnum','context','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','moment','util','lodash','create'];(function(_0x249966,_0x347122){var _0x2c4c59=function(_0x3913aa){while(--_0x3913aa){_0x249966['push'](_0x249966['shift']());}};_0x2c4c59(++_0x347122);}(_0x99c5,0x1dc));var _0x599c=function(_0x13fdb3,_0x493557){_0x13fdb3=_0x13fdb3-0x0;var _0x212e46=_0x99c5[_0x13fdb3];return _0x212e46;};'use strict';var moment=require(_0x599c('0x0'));var util=require(_0x599c('0x1'));var _=require(_0x599c('0x2'));var client=require('../client');exports[_0x599c('0x3')]=function(_0x2ef846){return client['Request'](_0x599c('0x4'),{'body':_[_0x599c('0x5')](_0x2ef846,{'source':_0x2ef846[_0x599c('0x6')],'destinationcontext':_0x2ef846[_0x599c('0x7')],'callerid':_0x2ef846['callerid'],'amaflags':'DOCUMENTATION'}),'log':_0x599c('0x4')});};exports[_0x599c('0x8')]=function(){return function(){return client[_0x599c('0x9')](_0x599c('0xa'),{'options':{'where':{'type':[_0x599c('0xb')],'createdAt':{'$between':[moment()[_0x599c('0xc')](_0x599c('0xd'))[_0x599c('0xe')](_0x599c('0xf')),moment()[_0x599c('0x10')](_0x599c('0xd'))[_0x599c('0xe')](_0x599c('0xf'))]}},'attributes':[_0x599c('0x11'),_0x599c('0x12'),_0x599c('0x13'),'billableseconds']},'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 336ce6a..c02098b 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 _0xcb33=['CreateVoiceDialReport','../client','Request'];(function(_0x22acb4,_0x2001bc){var _0x2665fb=function(_0x56692e){while(--_0x56692e){_0x22acb4['push'](_0x22acb4['shift']());}};_0x2665fb(++_0x2001bc);}(_0xcb33,0x199));var _0x3cb3=function(_0x3a2cc2,_0x3b58f1){_0x3a2cc2=_0x3a2cc2-0x0;var _0x456970=_0xcb33[_0x3a2cc2];return _0x456970;};'use strict';var client=require(_0x3cb3('0x0'));exports['create']=function(_0x42cbb0){return client[_0x3cb3('0x1')](_0x3cb3('0x2'),{'body':_0x42cbb0,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x265e=['CreateVoiceDialReport','../client','Request'];(function(_0xfd1eba,_0x35397f){var _0x17cd21=function(_0x1e7f04){while(--_0x1e7f04){_0xfd1eba['push'](_0xfd1eba['shift']());}};_0x17cd21(++_0x35397f);}(_0x265e,0x8e));var _0xe265=function(_0x315db6,_0x2a6c0e){_0x315db6=_0x315db6-0x0;var _0x5277c6=_0x265e[_0x315db6];return _0x5277c6;};'use strict';var client=require(_0xe265('0x0'));exports['create']=function(_0x4a41b8){return client[_0xe265('0x1')](_0xe265('0x2'),{'body':_0x4a41b8,'log':_0xe265('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 686d01f..ff32f47 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 _0x98e5=['GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x488ec5,_0x3cb226){var _0x116660=function(_0x204212){while(--_0x204212){_0x488ec5['push'](_0x488ec5['shift']());}};_0x116660(++_0x3cb226);}(_0x98e5,0x8a));var _0x598e=function(_0x93f929,_0x5945b9){_0x93f929=_0x93f929-0x0;var _0x278195=_0x98e5[_0x93f929];return _0x278195;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x598e('0x0'),{'options':{'raw':!![],'attributes':['id',_0x598e('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x598e('0x2')});};}; \ No newline at end of file +var _0xa1fd=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0xa1fd[_0x187718];return _0x29ddf4;};'use strict';var client=require(_0xda1f('0x0'));exports[_0xda1f('0x1')]=function(){return function(){return client[_0xda1f('0x2')](_0xda1f('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xda1f('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xda1f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 051550d..bc50a05 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 _0x9086=['monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','active','Pause','mandatoryDispositionPause','Trunk','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','autopause'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0x9086,0xae));var _0x6908=function(_0x3acfa3,_0x13ea7a){_0x3acfa3=_0x3acfa3-0x0;var _0xcfe26e=_0x9086[_0x3acfa3];return _0xcfe26e;};'use strict';var client=require(_0x6908('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0x6908('0x1'),{'options':{'raw':![],'attributes':['id',_0x6908('0x2'),_0x6908('0x3'),_0x6908('0x4'),_0x6908('0x5'),_0x6908('0x6'),_0x6908('0x7'),'dialActive',_0x6908('0x8'),_0x6908('0x9'),_0x6908('0xa'),_0x6908('0xb'),_0x6908('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x6908('0xd'),_0x6908('0xe'),'dialOriginateTimeout',_0x6908('0xf'),'dialQueueTimeout',_0x6908('0x10'),'dialCongestionMaxRetry',_0x6908('0x11'),_0x6908('0x12'),_0x6908('0x13'),'dialNoAnswerMaxRetry',_0x6908('0x14'),_0x6908('0x15'),_0x6908('0x16'),'dialGlobalInterval',_0x6908('0x17'),_0x6908('0x18'),_0x6908('0x19'),_0x6908('0x1a'),_0x6908('0x1b'),'dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x6908('0x1c'),_0x6908('0x1d'),'dialAMDMaximumNumberOfWords',_0x6908('0x1e'),'dialAMDMaximumWordLength',_0x6908('0x1f'),'dialRecallMeTimeout',_0x6908('0x20'),_0x6908('0x21'),_0x6908('0x22'),_0x6908('0x23'),_0x6908('0x24'),'monitor_format',_0x6908('0x25'),_0x6908('0x26'),_0x6908('0x27'),'dialNoSuchNumberMaxRetry',_0x6908('0x28'),_0x6908('0x29'),_0x6908('0x2a'),_0x6908('0x2b'),'dialAbandonedRetryFrequency',_0x6908('0x2c'),'dialMachineRetryFrequency',_0x6908('0x2d'),_0x6908('0x2e'),_0x6908('0x2f'),_0x6908('0x30'),_0x6908('0x31'),_0x6908('0x32'),'dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x6908('0x2'),'callerid',_0x6908('0x33')]},{'model':_0x6908('0x34'),'as':_0x6908('0x35'),'attributes':['id','name']},{'model':_0x6908('0x36'),'as':_0x6908('0x37'),'attributes':['id','name','callerid',_0x6908('0x33')]},{'model':_0x6908('0x38'),'as':_0x6908('0x38'),'attributes':['id',_0x6908('0x2')],'include':[{'model':_0x6908('0x38'),'as':_0x6908('0x39'),'attributes':['id','name',_0x6908('0x3a')]}]}]},'log':_0x6908('0x3b')});};}; \ No newline at end of file +var _0xfa61=['dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval'];(function(_0x52a3bc,_0x58edbd){var _0x4fa9cb=function(_0x331882){while(--_0x331882){_0x52a3bc['push'](_0x52a3bc['shift']());}};_0x4fa9cb(++_0x58edbd);}(_0xfa61,0x169));var _0x1fa6=function(_0x27033e,_0x53ff3d){_0x27033e=_0x27033e-0x0;var _0x4553e5=_0xfa61[_0x27033e];return _0x4553e5;};'use strict';var client=require('../client');exports[_0x1fa6('0x0')]=function(){return function(){return client[_0x1fa6('0x1')](_0x1fa6('0x2'),{'options':{'raw':![],'attributes':['id',_0x1fa6('0x3'),_0x1fa6('0x4'),'acwTimeout',_0x1fa6('0x5'),_0x1fa6('0x6'),'type',_0x1fa6('0x7'),_0x1fa6('0x8'),_0x1fa6('0x9'),_0x1fa6('0xa'),_0x1fa6('0xb'),_0x1fa6('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName',_0x1fa6('0xd'),_0x1fa6('0xe'),_0x1fa6('0xf'),_0x1fa6('0x10'),'dialQueueProject',_0x1fa6('0x11'),_0x1fa6('0x12'),'dialBusyMaxRetry',_0x1fa6('0x13'),_0x1fa6('0x14'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x1fa6('0x15'),_0x1fa6('0x16'),_0x1fa6('0x17'),_0x1fa6('0x18'),_0x1fa6('0x19'),_0x1fa6('0x1a'),_0x1fa6('0x1b'),_0x1fa6('0x1c'),_0x1fa6('0x1d'),_0x1fa6('0x1e'),_0x1fa6('0x1f'),_0x1fa6('0x20'),_0x1fa6('0x21'),_0x1fa6('0x22'),'timeout',_0x1fa6('0x23'),_0x1fa6('0x24'),'dialOrderByScheduledAt',_0x1fa6('0x25'),_0x1fa6('0x26'),_0x1fa6('0x27'),_0x1fa6('0x6'),_0x1fa6('0x28'),_0x1fa6('0x29'),_0x1fa6('0x2a'),_0x1fa6('0x2b'),_0x1fa6('0x2c'),'dialDropMaxRetry','dialDropRetryFrequency',_0x1fa6('0x2d'),_0x1fa6('0x2e'),_0x1fa6('0x2f'),'dialMachineRetryFrequency',_0x1fa6('0x30'),_0x1fa6('0x31'),_0x1fa6('0x32'),_0x1fa6('0x33'),_0x1fa6('0x34'),_0x1fa6('0x35'),_0x1fa6('0x36'),_0x1fa6('0x37')],'include':[{'model':_0x1fa6('0x38'),'as':_0x1fa6('0x38'),'attributes':['id',_0x1fa6('0x3'),_0x1fa6('0x39'),'active']},{'model':'Pause','as':_0x1fa6('0x3a'),'attributes':['id',_0x1fa6('0x3')]},{'model':_0x1fa6('0x38'),'as':_0x1fa6('0x3b'),'attributes':['id',_0x1fa6('0x3'),_0x1fa6('0x39'),_0x1fa6('0x3c')]},{'model':_0x1fa6('0x3d'),'as':_0x1fa6('0x3d'),'attributes':['id',_0x1fa6('0x3')],'include':[{'model':_0x1fa6('0x3d'),'as':_0x1fa6('0x3e'),'attributes':['id','name',_0x1fa6('0x3f')]}]}]},'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 59bb6d6..fa4b7f7 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(_0x12b81c,_0x336119){var _0x1b3966=function(_0x4e9a57){while(--_0x4e9a57){_0x12b81c['push'](_0x12b81c['shift']());}};_0x1b3966(++_0x336119);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x1b8493,_0x298887){var _0x3580e4=function(_0x5112f9){while(--_0x5112f9){_0x1b8493['push'](_0x1b8493['shift']());}};_0x3580e4(++_0x298887);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 307af78..8faa8bf 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 _0x33fd=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x593634,_0x1518c1){var _0x53dbf1=function(_0x4c6857){while(--_0x4c6857){_0x593634['push'](_0x593634['shift']());}};_0x53dbf1(++_0x1518c1);}(_0x33fd,0x9e));var _0xd33f=function(_0x1cdd6b,_0x4fedea){_0x1cdd6b=_0x1cdd6b-0x0;var _0x512832=_0x33fd[_0x1cdd6b];return _0x512832;};'use strict';var client=require(_0xd33f('0x0'));exports[_0xd33f('0x1')]=function(_0x2e4173){return function(){return client['Request'](_0xd33f('0x2'),{'options':{'where':{'VoiceQueueId':_0x2e4173,'paused':!![]},'raw':!![]},'log':_0xd33f('0x1')});};}; \ No newline at end of file +var _0xe917=['../client','GetVoiceQueueRtPauses'];(function(_0x2b1551,_0x1776fe){var _0x2fc2a1=function(_0x5d43c8){while(--_0x5d43c8){_0x2b1551['push'](_0x2b1551['shift']());}};_0x2fc2a1(++_0x1776fe);}(_0xe917,0x19a));var _0x7e91=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xe917[_0x3c2a69];return _0x596bc8;};'use strict';var client=require(_0x7e91('0x0'));exports['getVoiceQueueRtPauses']=function(_0x539bfd){return function(){return client['Request'](_0x7e91('0x1'),{'options':{'where':{'VoiceQueueId':_0x539bfd,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6df7be4..73c4e8a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5711af,_0x1b060e){var _0x20ca91=function(_0x39befd){while(--_0x39befd){_0x5711af['push'](_0x5711af['shift']());}};_0x20ca91(++_0x1b060e);}(_0x7a54,0x106));var _0x47a5=function(_0x4ae33b,_0x2af132){_0x4ae33b=_0x4ae33b-0x0;var _0x54b015=_0x7a54[_0x4ae33b];return _0x54b015;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x4f146d,_0x431c4f){var _0x1e36d6=function(_0x376fb0){while(--_0x376fb0){_0x4f146d['push'](_0x4f146d['shift']());}};_0x1e36d6(++_0x431c4f);}(_0x7a54,0x106));var _0x47a5=function(_0x317fe0,_0x4cc27c){_0x317fe0=_0x317fe0-0x0;var _0x503233=_0x7a54[_0x317fe0];return _0x503233;};'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 dbc8db6..ae25873 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 _0x32bf=['result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x32bf,0x1f4));var _0xf32b=function(_0x14dc67,_0x4659e8){_0x14dc67=_0x14dc67-0x0;var _0x442fd7=_0x32bf[_0x14dc67];return _0x442fd7;};'use strict';var client=require('../client');exports[_0xf32b('0x0')]={};exports[_0xf32b('0x1')]=function(_0x3bc74a){return client[_0xf32b('0x2')](_0xf32b('0x3'),{'body':{'result':_0x3bc74a[_0xf32b('0x4')],'transfererchannel':_0x3bc74a[_0xf32b('0x5')],'transferercalleridnum':_0x3bc74a['transferercalleridnum'],'transferercalleridname':_0x3bc74a[_0xf32b('0x6')],'transfererconnectedlinenum':_0x3bc74a[_0xf32b('0x7')],'transfererconnectedlinename':_0x3bc74a[_0xf32b('0x8')],'transfereraccountcode':_0x3bc74a[_0xf32b('0x9')],'transferercontext':_0x3bc74a[_0xf32b('0xa')],'transfererexten':_0x3bc74a[_0xf32b('0xb')],'transfererlinkedid':_0x3bc74a[_0xf32b('0xc')],'transfereechannel':_0x3bc74a[_0xf32b('0xd')],'transfereecalleridnum':_0x3bc74a['transfereecalleridnum'],'transfereecalleridname':_0x3bc74a[_0xf32b('0xe')],'transfereeconnectedlinenum':_0x3bc74a[_0xf32b('0xf')],'transfereeconnectedlinename':_0x3bc74a[_0xf32b('0x10')],'transfereeaccountcode':_0x3bc74a[_0xf32b('0x11')],'transfereecontext':_0x3bc74a[_0xf32b('0x12')],'transfereeexten':_0x3bc74a[_0xf32b('0x13')],'transfereelinkedid':_0x3bc74a[_0xf32b('0x14')],'isexternal':_0x3bc74a[_0xf32b('0x15')],'context':_0x3bc74a[_0xf32b('0x16')],'extension':_0x3bc74a['extension'],'type':_0xf32b('0x17')},'log':_0xf32b('0x3')});};exports[_0xf32b('0x18')]=function(_0x531e71){return client['Request'](_0xf32b('0x3'),{'body':{'result':_0x531e71['result'],'transfererchannel':_0x531e71[_0xf32b('0x19')],'transferercalleridnum':_0x531e71['origtransferercalleridnum'],'transferercalleridname':_0x531e71[_0xf32b('0x1a')],'transfererconnectedlinenum':_0x531e71[_0xf32b('0x1b')],'transfererconnectedlinename':_0x531e71[_0xf32b('0x1c')],'transfereraccountcode':_0x531e71['origtransfereraccountcode'],'transferercontext':_0x531e71[_0xf32b('0x1d')],'transfererexten':_0x531e71[_0xf32b('0x1e')],'transfererlinkedid':_0x531e71[_0xf32b('0x1f')],'transfereechannel':_0x531e71[_0xf32b('0x20')],'transfereecalleridnum':_0x531e71[_0xf32b('0x21')],'transfereecalleridname':_0x531e71['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x531e71[_0xf32b('0x22')],'transfereeconnectedlinename':_0x531e71[_0xf32b('0x23')],'transfereeaccountcode':_0x531e71['transfertargetaccountcode'],'transfereecontext':_0x531e71[_0xf32b('0x24')],'transfereeexten':_0x531e71[_0xf32b('0x25')],'transfereelinkedid':_0x531e71[_0xf32b('0x26')],'isexternal':_0x531e71['isexternal'],'context':_0x531e71[_0xf32b('0x27')],'extension':_0x531e71[_0xf32b('0x28')],'type':_0xf32b('0x29')},'log':_0xf32b('0x3')});}; \ No newline at end of file +var _0xc6f8=['extension','blind','attendedTransfer','result','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereecontext','transfereeexten','isexternal','context'];(function(_0x29d64c,_0x1cfe41){var _0x387db5=function(_0xe56cf4){while(--_0xe56cf4){_0x29d64c['push'](_0x29d64c['shift']());}};_0x387db5(++_0x1cfe41);}(_0xc6f8,0x8b));var _0x8c6f=function(_0x57cc09,_0x5334df){_0x57cc09=_0x57cc09-0x0;var _0x3097c7=_0xc6f8[_0x57cc09];return _0x3097c7;};'use strict';var client=require(_0x8c6f('0x0'));exports[_0x8c6f('0x1')]={};exports[_0x8c6f('0x2')]=function(_0x5a065b){return client[_0x8c6f('0x3')](_0x8c6f('0x4'),{'body':{'result':_0x5a065b['result'],'transfererchannel':_0x5a065b['transfererchannel'],'transferercalleridnum':_0x5a065b['transferercalleridnum'],'transferercalleridname':_0x5a065b['transferercalleridname'],'transfererconnectedlinenum':_0x5a065b['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5a065b[_0x8c6f('0x5')],'transfereraccountcode':_0x5a065b[_0x8c6f('0x6')],'transferercontext':_0x5a065b[_0x8c6f('0x7')],'transfererexten':_0x5a065b['transfererexten'],'transfererlinkedid':_0x5a065b[_0x8c6f('0x8')],'transfereechannel':_0x5a065b[_0x8c6f('0x9')],'transfereecalleridnum':_0x5a065b[_0x8c6f('0xa')],'transfereecalleridname':_0x5a065b['transfereecalleridname'],'transfereeconnectedlinenum':_0x5a065b[_0x8c6f('0xb')],'transfereeconnectedlinename':_0x5a065b['transfereeconnectedlinename'],'transfereeaccountcode':_0x5a065b['transfereeaccountcode'],'transfereecontext':_0x5a065b[_0x8c6f('0xc')],'transfereeexten':_0x5a065b[_0x8c6f('0xd')],'transfereelinkedid':_0x5a065b['transfereelinkedid'],'isexternal':_0x5a065b[_0x8c6f('0xe')],'context':_0x5a065b[_0x8c6f('0xf')],'extension':_0x5a065b[_0x8c6f('0x10')],'type':_0x8c6f('0x11')},'log':_0x8c6f('0x4')});};exports[_0x8c6f('0x12')]=function(_0x52fdfc){return client[_0x8c6f('0x3')](_0x8c6f('0x4'),{'body':{'result':_0x52fdfc[_0x8c6f('0x13')],'transfererchannel':_0x52fdfc['origtransfererchannel'],'transferercalleridnum':_0x52fdfc[_0x8c6f('0x14')],'transferercalleridname':_0x52fdfc['origtransferercalleridname'],'transfererconnectedlinenum':_0x52fdfc['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x52fdfc[_0x8c6f('0x15')],'transfereraccountcode':_0x52fdfc['origtransfereraccountcode'],'transferercontext':_0x52fdfc['secondtransferercontext'],'transfererexten':_0x52fdfc[_0x8c6f('0x16')],'transfererlinkedid':_0x52fdfc[_0x8c6f('0x17')],'transfereechannel':_0x52fdfc[_0x8c6f('0x18')],'transfereecalleridnum':_0x52fdfc['transfertargetcalleridnum'],'transfereecalleridname':_0x52fdfc[_0x8c6f('0x19')],'transfereeconnectedlinenum':_0x52fdfc['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x52fdfc['transfertargetconnectedlinename'],'transfereeaccountcode':_0x52fdfc[_0x8c6f('0x1a')],'transfereecontext':_0x52fdfc[_0x8c6f('0x1b')],'transfereeexten':_0x52fdfc[_0x8c6f('0x1c')],'transfereelinkedid':_0x52fdfc['transfertargetlinkedid'],'isexternal':_0x52fdfc[_0x8c6f('0xe')],'context':_0x52fdfc['origtransferercontext'],'extension':_0x52fdfc[_0x8c6f('0x1d')],'type':_0x8c6f('0x1e')},'log':_0x8c6f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index bf66c90..0afcdb5 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 _0x90ec=['undefined','values','channels','voicechannel','map','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','Redirect','exten','context','agents','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','name','timers','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','keys','action','Action','then','message','catch','join','command','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','omit'];(function(_0x12a31b,_0x4c7508){var _0x5e0ede=function(_0x39ff08){while(--_0x39ff08){_0x12a31b['push'](_0x12a31b['shift']());}};_0x5e0ede(++_0x4c7508);}(_0x90ec,0x1d4));var _0xc90e=function(_0x24a196,_0x212f3c){_0x24a196=_0x24a196-0x0;var _0x29b84f=_0x90ec[_0x24a196];return _0x29b84f;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var jayson=require('jayson/promise');var schema=require(_0xc90e('0x2'));var BPromise=require(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var config=require(_0xc90e('0x5'));var properties=require(_0xc90e('0x6'));var ami=require('../ami');exports[_0xc90e('0x7')]=function(_0x207b98,_0x206583,_0x54a0a8){return new BPromise(function(_0x259c62,_0x48bea9){var _0x42051a={'QueuePause':function(_0x14311a){return new Promise(function(_0x48253c,_0x3bc98f){var _0xd539f6=util[_0xc90e('0x8')](_0xc90e('0x9'),_0xc90e('0xa'),_0x14311a[_0xc90e('0xb')]);if(_0x207b98[_0xc90e('0xc')]&&_0x207b98[_0xc90e('0xc')][_0xd539f6]&&_0x207b98[_0xc90e('0xc')][_0xd539f6]['timer']){_0x207b98[_0xc90e('0xc')][_0xd539f6]['updateAcw']();}if(_0x207b98['agents'][_0xd539f6]){_0x207b98['agents'][_0xd539f6]['updateStatusRealtime']({'statePause':_0x14311a[_0xc90e('0xd')]?!![]:![]});}_0x48253c({'code':0xc8,'message':_0xc90e('0xe')});});},'Reload':function(_0x5cef50){var _0x37321a=this;return new Promise(function(_0x98aa2b,_0x52beef){if(ami[_0xc90e('0xf')]()==![]){return _0x52beef(_0x37321a[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}_0x5cef50=_[_0xc90e('0x14')](_0x5cef50,_[_0xc90e('0x15')](properties['module']));_0x5cef50[_0xc90e('0x16')]='Reload';return ami[_0xc90e('0x17')](_0x5cef50)[_0xc90e('0x18')](function(_0x558b22){_0x98aa2b({'code':0xc8,'message':_0x558b22[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x17ec6b){_0x52beef(_0x37321a['error'](0x1f5,_0x17ec6b['message']));});});},'Command':function(_0x486725){var _0x161a3a=this;return new Promise(function(_0x147120,_0x25b1d7){if(ami[_0xc90e('0xf')]()==![]){return _0x25b1d7(_0x161a3a[_0xc90e('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xc90e('0x11')]['username'],_0xc90e('0x13')][_0xc90e('0x1b')]('\x20')));}_0x486725=_['pick'](_0x486725,_0xc90e('0x1c'));_0x486725[_0xc90e('0x16')]=_0xc90e('0x1d');return ami[_0xc90e('0x17')](_0x486725)[_0xc90e('0x18')](function(_0x282c53){_0x147120({'code':0xc8,'message':_0x282c53[_0xc90e('0x1e')]});})[_0xc90e('0x1a')](function(_0x1cff73){_0x25b1d7(_0x161a3a['error'](0x1f5,_0x1cff73[_0xc90e('0x19')]));});});},'VoiceQueues':function(_0x41deea){return new Promise(function(_0x25223e,_0x380f3f){var _0x3371aa=[];for(var _0x59d731 in _0x207b98[_0xc90e('0x1f')]){if(_0x207b98[_0xc90e('0x1f')][_0xc90e('0x20')](_0x59d731)){var _0x4fde04=_0x207b98[_0xc90e('0x1f')][_0x59d731];var _0x2ea6e6={'id':_0x4fde04['id'],'name':_0x4fde04[_0xc90e('0xb')],'strategy':_0x4fde04[_0xc90e('0x21')],'answered':_0x4fde04[_0xc90e('0x22')],'available':_0x4fde04[_0xc90e('0x23')],'loggedIn':_0x4fde04['loggedIn'],'pTalking':_0x4fde04['pTalking'],'sumBillable':_0x4fde04[_0xc90e('0x24')],'sumDuration':_0x4fde04['sumDuration'],'sumHoldTime':_0x4fde04[_0xc90e('0x25')]||0x0,'talking':_0x4fde04[_0xc90e('0x26')],'total':_0x4fde04[_0xc90e('0x27')],'type':_0x4fde04[_0xc90e('0x28')],'unmanaged':_0x4fde04[_0xc90e('0x29')],'abandoned':_0x4fde04[_0xc90e('0x2a')],'waiting':_0x4fde04[_0xc90e('0x2b')],'loggedInDb':_0x4fde04['loggedInDb']};if(_0x4fde04[_0xc90e('0x28')]===_0xc90e('0x2c')){_0x2ea6e6['dialActive']=_0x4fde04[_0xc90e('0x2d')];_0x2ea6e6['dialMethod']=_0x4fde04[_0xc90e('0x2e')];_0x2ea6e6[_0xc90e('0x2f')]=_0x4fde04[_0xc90e('0x2f')];_0x2ea6e6[_0xc90e('0x30')]=_0x4fde04[_0xc90e('0x30')];_0x2ea6e6[_0xc90e('0x31')]=_0x4fde04[_0xc90e('0x31')];_0x2ea6e6[_0xc90e('0x32')]=_0x4fde04[_0xc90e('0x32')];_0x2ea6e6['temp']=_0x4fde04['temp'];_0x2ea6e6[_0xc90e('0x33')]=_0x4fde04[_0xc90e('0x33')];_0x2ea6e6[_0xc90e('0x34')]=_0x4fde04[_0xc90e('0x34')];_0x2ea6e6[_0xc90e('0x35')]=_0x4fde04[_0xc90e('0x35')];_0x2ea6e6[_0xc90e('0x36')]=_0x4fde04[_0xc90e('0x36')];_0x2ea6e6[_0xc90e('0x37')]=_0x4fde04[_0xc90e('0x37')];_0x2ea6e6['outboundDropCallsDayACS']=_0x4fde04[_0xc90e('0x38')];_0x2ea6e6[_0xc90e('0x39')]=_0x4fde04[_0xc90e('0x39')];_0x2ea6e6[_0xc90e('0x3a')]=_0x4fde04['outboundDropCallsDayTimeout'];_0x2ea6e6['outboundNoAnswerCallsDay']=_0x4fde04['outboundNoAnswerCallsDay'];_0x2ea6e6[_0xc90e('0x3b')]=_0x4fde04[_0xc90e('0x3b')];_0x2ea6e6[_0xc90e('0x3c')]=_0x4fde04[_0xc90e('0x3c')];_0x2ea6e6[_0xc90e('0x3d')]=_0x4fde04['outboundReCallsDay'];_0x2ea6e6[_0xc90e('0x3e')]=_0x4fde04[_0xc90e('0x3e')];_0x2ea6e6[_0xc90e('0x3f')]=_0x4fde04[_0xc90e('0x3f')];_0x2ea6e6[_0xc90e('0x40')]=_0x4fde04[_0xc90e('0x40')];_0x2ea6e6[_0xc90e('0x41')]=_0x4fde04[_0xc90e('0x41')];_0x2ea6e6[_0xc90e('0x42')]=_0x4fde04[_0xc90e('0x42')];_0x2ea6e6[_0xc90e('0x43')]=_0x4fde04[_0xc90e('0x43')];_0x2ea6e6[_0xc90e('0x44')]=_0x4fde04['predictiveIntervalDroppedCallsTimeout'];_0x2ea6e6[_0xc90e('0x45')]=_0x4fde04[_0xc90e('0x45')];_0x2ea6e6['predictiveIntervalErlangCallsDroppedCalls']=_0x4fde04['predictiveIntervalErlangCallsDroppedCalls'];_0x2ea6e6[_0xc90e('0x46')]=_0x4fde04['predictiveIntervalHitRate'];_0x2ea6e6[_0xc90e('0x47')]=_0x4fde04[_0xc90e('0x47')];_0x2ea6e6['predictiveIntervalPauses']=_0x4fde04[_0xc90e('0x48')];_0x2ea6e6['predictiveIntervalAvailable']=_0x4fde04['predictiveIntervalAvailable'];_0x2ea6e6[_0xc90e('0x49')]=_0x4fde04['predictiveIntervalTotalCalls'];_0x2ea6e6['message']=_0x4fde04[_0xc90e('0x19')];_0x2ea6e6[_0xc90e('0x4a')]=_0x4fde04['originated'];_0x2ea6e6[_0xc90e('0x4b')]=_0x4fde04[_0xc90e('0x4b')];_0x2ea6e6[_0xc90e('0x4c')]=_0x4fde04[_0xc90e('0x4c')];_0x2ea6e6[_0xc90e('0x4d')]=_0x4fde04[_0xc90e('0x4d')];_0x2ea6e6[_0xc90e('0x4e')]=_0x4fde04[_0xc90e('0x4e')];_0x2ea6e6['startPredictive']=_0x4fde04[_0xc90e('0x4f')];_0x2ea6e6['startProgressive']=_0x4fde04['startProgressive'];}if(_0x4fde04[_0xc90e('0x50')]){_0x2ea6e6['Trunk']={'id':_0x4fde04[_0xc90e('0x50')]['id'],'name':_0x4fde04['Trunk'][_0xc90e('0xb')],'active':_0x4fde04[_0xc90e('0x50')][_0xc90e('0x51')],'callerid':_0x4fde04[_0xc90e('0x50')][_0xc90e('0x52')]};}if(_0x4fde04[_0xc90e('0x53')]){_0x2ea6e6[_0xc90e('0x53')]={'id':_0x4fde04[_0xc90e('0x53')]['id'],'name':_0x4fde04[_0xc90e('0x53')]['name']};}_0x3371aa[_0xc90e('0x54')](_0x2ea6e6);}}_0x25223e({'count':_0x3371aa[_0xc90e('0x55')],'rows':_0x3371aa});});},'UpdateVoiceQueue':function(_0x317aa7){return new Promise(function(_0x24d0ca,_0x5dd284){var _0x21408a=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x1f')],{'id':parseInt(_0x317aa7['id'])});var _0x48cb44=_[_0xc90e('0x57')](_0x317aa7,['id']);if(_0x21408a){for(var _0x49c8ab in _0x48cb44){if(typeof _0x48cb44[_0x49c8ab]!==_0xc90e('0x58')&&typeof _0x21408a[_0x49c8ab]!=='undefined'){_0x21408a[_0x49c8ab]=_0x48cb44[_0x49c8ab];}}_0x24d0ca(_0x21408a);}else{_0x5dd284();}});},'VoiceChannels':function(_0x130263){return new Promise(function(_0x55e36b,_0x18cd72){var _0x45c1e0=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x5a')]);_0x55e36b({'count':_0x45c1e0[_0xc90e('0x55')],'rows':_0x45c1e0});});},'VoiceChannelMixMonitor':function(_0x35f401){var _0x1ebe62=this;return new Promise(function(_0x1d7f6a,_0x53957d){if(ami[_0xc90e('0xf')]()==![]){return _0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xc90e('0x12')],'ami\x20disconnected'][_0xc90e('0x1b')]('\x20')));}var _0x3ae820=schema(properties[_0xc90e('0x5b')])[_0xc90e('0x2')](_0x35f401);if(_0x3ae820[_0xc90e('0x55')]>0x0){return _0x53957d(_0x1ebe62['error'](0x1f4,_[_0xc90e('0x5c')](_0x3ae820,_0xc90e('0x19'))['join'](',\x20')));}var _0x2f6d54=_['find'](_0x207b98[_0xc90e('0x5a')],{'uniqueid':_0x35f401['uniqueid']});if(_0x2f6d54&&_0x2f6d54[_0xc90e('0x5d')]){var _0x1d8bd0=util[_0xc90e('0x8')](_0xc90e('0x5e'),_0x35f401[_0xc90e('0x5f')]||_0x35f401[_0xc90e('0x60')],_0x35f401[_0xc90e('0x8')]||_0xc90e('0x61'));return ami[_0xc90e('0x17')]({'action':_0xc90e('0x62'),'channel':_0x2f6d54[_0xc90e('0x5d')],'file':_0x1d8bd0,'options':_0xc90e('0x63')})[_0xc90e('0x18')](function(_0x6d0a9d){var _0x358568=_[_0xc90e('0x56')](_0x2f6d54['monitors'],{'filename':_0xc90e('0x64')+_0x1d8bd0[_0xc90e('0x65')]()});if(_[_0xc90e('0x66')](_0x358568)){_0x2f6d54[_0xc90e('0x67')][_0xc90e('0x54')]({'filename':_0xc90e('0x64')+_0x1d8bd0[_0xc90e('0x65')](),'createdAt':moment()['format'](_0xc90e('0x68')),'mixmonitorid':_0x6d0a9d['mixmonitorid'],'status':_0xc90e('0x69')});}else{_0x358568[_0xc90e('0x6a')]=_0x6d0a9d[_0xc90e('0x6a')];_0x358568[_0xc90e('0x6b')]=_0xc90e('0x69');}_0x1d7f6a({'code':0xc8,'message':[_0x35f401['uniqueid'],_0xc90e('0x6c'),_0x6d0a9d[_0xc90e('0x6a')]]['join']('\x20'),'mixmonitorid':_0x6d0a9d[_0xc90e('0x6a')]});})[_0xc90e('0x1a')](function(_0x288571){_0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f5,[_0x35f401['uniqueid'],_0x288571['message'][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')));});}else{return _0x53957d(_0x1ebe62[_0xc90e('0x10')](0x1f5,_0xc90e('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x2cc917){var _0x4c44ea=this;return new Promise(function(_0x3e8c0d,_0x40b61e){if(ami['isConnected']()==![]){return _0x40b61e(_0x4c44ea['error'](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}var _0x33cd37=schema(properties[_0xc90e('0x5b')])[_0xc90e('0x2')](_0x2cc917);if(_0x33cd37[_0xc90e('0x55')]>0x0){return _0x40b61e(_0x4c44ea[_0xc90e('0x10')](0x1f4,_[_0xc90e('0x5c')](_0x33cd37,_0xc90e('0x19'))[_0xc90e('0x1b')](',\x20')));}var _0x57db5e=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x5a')],{'uniqueid':_0x2cc917[_0xc90e('0x60')]});if(_0x57db5e){return BPromise[_0xc90e('0x6e')]()[_0xc90e('0x18')](function(){if(_0x57db5e['channel']){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x6f'),'channel':_0x57db5e[_0xc90e('0x5d')],'mixmonitorid':_0x2cc917['mixmonitorid']})['catch'](function(_0x31bca6){});}})['then'](function(){if(_0x57db5e[_0xc90e('0x70')]){return ami['Action']({'action':_0xc90e('0x6f'),'channel':_0x57db5e[_0xc90e('0x70')],'mixmonitorid':_0x2cc917[_0xc90e('0x6a')]})[_0xc90e('0x1a')](function(_0x10d31b){});}})[_0xc90e('0x18')](function(_0xb44c95){var _0x5db362=_[_0xc90e('0x56')](_0x57db5e[_0xc90e('0x67')],{'mixmonitorid':_0x2cc917[_0xc90e('0x6a')]});if(_0x5db362){_0x5db362[_0xc90e('0x6b')]='stop';}})[_0xc90e('0x18')](function(){var _0x511e33=util['format']('%s.%s',_0x2cc917['filename']||_0x2cc917[_0xc90e('0x60')],_0x2cc917[_0xc90e('0x8')]||'wav');var _0x5c6240=_[_0xc90e('0x56')](_0x57db5e[_0xc90e('0x67')],{'filename':_0xc90e('0x64')+_0x511e33[_0xc90e('0x65')]()});if(_0x5c6240){_0x5c6240[_0xc90e('0x6b')]='stop';}})[_0xc90e('0x18')](function(){_0x3e8c0d({'code':0xc8,'message':[_0x2cc917[_0xc90e('0x60')],_0xc90e('0x71')][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x4783fb){_0x40b61e(_0x4c44ea['error'](0x1f5,[_0x2cc917[_0xc90e('0x60')],_0x4783fb['message'][_0xc90e('0x65')]()]['join']('\x20')));});}else{return _0x40b61e(_0x4c44ea['error'](0x1f5,_0xc90e('0x6d')));}});},'VoiceQueuesChannels':function(_0x2b02f1){return new Promise(function(_0x51f714,_0x441879){var _0x59765e=_['values'](_0x207b98['queueChannels']);_0x51f714({'count':_0x59765e['length'],'rows':_0x59765e});});},'VoiceQueuesChannel':function(_0xa26ec4){var _0x1ac648=this;return new Promise(function(_0x5a3fc6,_0x104288){var _0x115f53=schema(properties[_0xc90e('0x72')])[_0xc90e('0x2')](_0xa26ec4);if(_0x115f53[_0xc90e('0x55')]>0x0){return _0x104288(_0x1ac648[_0xc90e('0x10')](0x1f4,_[_0xc90e('0x5c')](_0x115f53,'message')[_0xc90e('0x1b')](',\x20')));}var _0x3e88de=_['find'](_0x207b98['queueChannels'],{'uniqueid':_0xa26ec4[_0xc90e('0x60')]});if(_0x3e88de){_0x5a3fc6(_0x3e88de);}else{return _0x104288(_0x1ac648['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1df4de){var _0x3f44f0=this;return new Promise(function(_0x3fa878,_0x16a95f){if(ami[_0xc90e('0xf')]()==![]){return _0x16a95f(_0x3f44f0[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config['asterisk'][_0xc90e('0x12')],_0xc90e('0x13')]['join']('\x20')));}var _0x29619f=schema(properties[_0xc90e('0x73')])[_0xc90e('0x2')](_0x1df4de);if(_0x29619f['length']>0x0){return _0x16a95f(_0x3f44f0['error'](0x1f4,_[_0xc90e('0x5c')](_0x29619f,'message')[_0xc90e('0x1b')](',\x20')));}var _0x2f86a6=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x74')],{'uniqueid':_0x1df4de['uniqueid']});if(_0x2f86a6&&_0x2f86a6[_0xc90e('0x5d')]){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x75'),'channel':_0x2f86a6[_0xc90e('0x5d')]})['then'](function(_0x12a7cd){_0x3fa878({'code':0xc8,'message':[_0x1df4de['uniqueid'],_0x12a7cd[_0xc90e('0x19')][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x264b7f){_0x16a95f(_0x3f44f0['error'](0x1f5,[_0x1df4de[_0xc90e('0x60')],_0x264b7f[_0xc90e('0x19')]['toLowerCase']()][_0xc90e('0x1b')]('\x20')));});}else{return _0x16a95f(_0x3f44f0[_0xc90e('0x10')](0x1f5,_0xc90e('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x387964){var _0x306002=this;return new Promise(function(_0x2915bf,_0x4b5843){if(ami['isConnected']()==![]){return _0x4b5843(_0x306002[_0xc90e('0x10')](0x1f4,[config[_0xc90e('0x11')]['ip'],config[_0xc90e('0x11')][_0xc90e('0x12')],'ami\x20disconnected'][_0xc90e('0x1b')]('\x20')));}var _0x5a3b0f=schema(properties['voicequeuechannelredirect'])[_0xc90e('0x2')](_0x387964);if(_0x5a3b0f[_0xc90e('0x55')]>0x0){return _0x4b5843(_0x306002[_0xc90e('0x10')](0x1f4,_['map'](_0x5a3b0f,_0xc90e('0x19'))[_0xc90e('0x1b')](',\x20')));}var _0xcbdef4=_[_0xc90e('0x56')](_0x207b98[_0xc90e('0x74')],{'uniqueid':_0x387964['uniqueid']});if(_0xcbdef4&&_0xcbdef4[_0xc90e('0x5d')]){return ami[_0xc90e('0x17')]({'action':_0xc90e('0x76'),'channel':_0xcbdef4[_0xc90e('0x5d')],'exten':_0x387964[_0xc90e('0x77')],'context':_0x387964['context']||_0xcbdef4[_0xc90e('0x78')],'priority':0x1})[_0xc90e('0x18')](function(_0x3926e3){_0x2915bf({'code':0xc8,'message':[_0x387964[_0xc90e('0x60')],_0x3926e3['message'][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')});})[_0xc90e('0x1a')](function(_0x7dd466){_0x4b5843(_0x306002['error'](0x1f5,[_0x387964[_0xc90e('0x60')],_0x7dd466[_0xc90e('0x19')][_0xc90e('0x65')]()][_0xc90e('0x1b')]('\x20')));});}else{return _0x4b5843(_0x306002['error'](0x1f5,_0xc90e('0x6d')));}});},'Agents':function(_0x5c844d){return new Promise(function(_0x466275,_0xa83990){var _0x58f17d=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x79')]);_0x466275({'count':_0x58f17d[_0xc90e('0x55')],'rows':_0x58f17d});});},'Telephones':function(_0x474b17){return new Promise(function(_0x169cf2,_0x51c8c5){var _0x1054dc=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7a')]);_0x169cf2({'count':_0x1054dc[_0xc90e('0x55')],'rows':_0x1054dc});});},'Trunks':function(_0x32e063){return new Promise(function(_0x9ac7e9,_0x1e3aba){var _0x20adcb=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7b')]);_0x9ac7e9({'count':_0x20adcb[_0xc90e('0x55')],'rows':_0x20adcb});});},'OutboundChannels':function(_0x5a1a79){return new Promise(function(_0x103a51,_0x1019dd){var _0x546b39=_['values'](_0x207b98[_0xc90e('0x7c')]);_0x103a51({'count':_0x546b39[_0xc90e('0x55')],'rows':_0x546b39});});},'Outbound':function(_0x4bc529){return new Promise(function(_0x5743ec,_0x49bee2){_0x5743ec(_0x207b98['outbound']);});},'Campaigns':function(_0x5f2c65){return new Promise(function(_0x1eb1b9,_0x5ba415){var _0x34ee10=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x7d')]);_0x1eb1b9({'count':_0x34ee10['length'],'rows':_0x34ee10});});},'VoiceQueuesPreview':function(_0x4fbb50){var _0x3e1e4a=this;return new Promise(function(_0x58df42,_0x2a792c){_0x206583[_0xc90e('0x7e')](_0x4fbb50['id'])[_0xc90e('0x18')](function(_0x4bad23){_0x58df42({'code':0xc8,'message':_0x4bad23[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x3810fe){_0x2a792c(_0x3e1e4a['error'](0x1f4,_0x3810fe[_0xc90e('0x19')]));});});},'EventManager':function(_0x3b2c01){var _0x46e954=this;return new Promise(function(_0x5b49fe,_0x328a92){if(!_0x3b2c01['event']){return _0x328a92(_0x46e954['error'](0x1f4,_0xc90e('0x7f')));}ami[_0xc90e('0x80')](_0xc90e('0x81')+_0x3b2c01[_0xc90e('0x82')],_0x3b2c01[_0xc90e('0x19')]);_0x5b49fe({'code':0xc8,'message':_0x3b2c01});});},'FaxAccounts':function(_0x347673){return new Promise(function(_0x247c1c,_0x322f90){var _0x1800ae=_[_0xc90e('0x59')](_0x207b98[_0xc90e('0x83')]);_0x247c1c({'count':_0x1800ae['length'],'rows':_0x1800ae});});},'SendFax':function(_0x2c01f5){var _0x5c12e2=this;return new Promise(function(_0x2e8d6a,_0x19de29){_0x54a0a8[_0xc90e('0x84')](_0x2c01f5)['then'](function(_0x1ca398){_0x2e8d6a({'code':0xc8,'message':_0x1ca398[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x349040){_0x19de29(_0x5c12e2[_0xc90e('0x10')](0x1f4,_0x349040[_0xc90e('0x19')]));});});},'CheckAfterSend':function(_0x467b3e){var _0x3784ba=this;return new Promise(function(_0x21ce32,_0x146b6e){_0x54a0a8[_0xc90e('0x85')](_0x467b3e)['then'](function(_0x104005){_0x21ce32({'code':0xc8,'message':_0x104005[_0xc90e('0x19')]});})[_0xc90e('0x1a')](function(_0x17e531){_0x146b6e(_0x3784ba[_0xc90e('0x10')](0x1f4,_0x17e531[_0xc90e('0x19')]));});});}};var _0x3922f5=jayson[_0xc90e('0x86')](_0x42051a)[_0xc90e('0x87')]();_0x3922f5['on'](_0xc90e('0x10'),function(_0x590b13){return _0x48bea9(_0x590b13);});_0x3922f5[_0xc90e('0x7')](0x232a,_0xc90e('0x88'),function(){console['log'](_0xc90e('0x89'),0x232a);return _0x259c62(_0xc90e('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xba34=['Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','catch','command','Action','content','voiceQueues','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','length','find','omit','undefined','values','channels','voicechannel','channel','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','push','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','voicequeuechannel','map','queueChannels','voicequeuechannelhangup','Hangup','Redirect','context','telephones','trunks','outboundChannels','outbound','run','event'];(function(_0x366db0,_0x5927dd){var _0x43b4ac=function(_0x6b12fd){while(--_0x6b12fd){_0x366db0['push'](_0x366db0['shift']());}};_0x43b4ac(++_0x5927dd);}(_0xba34,0x119));var _0x4ba3=function(_0x5a02c5,_0x562770){_0x5a02c5=_0x5a02c5-0x0;var _0x5f47cb=_0xba34[_0x5a02c5];return _0x5f47cb;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var jayson=require(_0x4ba3('0x2'));var schema=require(_0x4ba3('0x3'));var BPromise=require(_0x4ba3('0x4'));var moment=require('moment');var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x4ba3('0x5'));exports[_0x4ba3('0x6')]=function(_0x278101,_0x1011ec,_0x3590a1){return new BPromise(function(_0xb88621,_0xe5f99a){var _0x585f2d={'QueuePause':function(_0x6254fb){return new Promise(function(_0x368eee,_0x2df7f3){var _0x18e332=util[_0x4ba3('0x7')](_0x4ba3('0x8'),_0x4ba3('0x9'),_0x6254fb[_0x4ba3('0xa')]);if(_0x278101[_0x4ba3('0xb')]&&_0x278101[_0x4ba3('0xb')][_0x18e332]&&_0x278101[_0x4ba3('0xb')][_0x18e332]['timer']){_0x278101[_0x4ba3('0xb')][_0x18e332][_0x4ba3('0xc')]();}if(_0x278101['agents'][_0x18e332]){_0x278101[_0x4ba3('0xd')][_0x18e332]['updateStatusRealtime']({'statePause':_0x6254fb[_0x4ba3('0xe')]?!![]:![]});}_0x368eee({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x256f02){var _0x4419b4=this;return new Promise(function(_0x29e498,_0x3515e9){if(ami[_0x4ba3('0xf')]()==![]){return _0x3515e9(_0x4419b4[_0x4ba3('0x10')](0x1f4,[config[_0x4ba3('0x11')]['ip'],config[_0x4ba3('0x11')][_0x4ba3('0x12')],_0x4ba3('0x13')][_0x4ba3('0x14')]('\x20')));}_0x256f02=_[_0x4ba3('0x15')](_0x256f02,_[_0x4ba3('0x16')](properties[_0x4ba3('0x17')]));_0x256f02[_0x4ba3('0x18')]=_0x4ba3('0x19');return ami['Action'](_0x256f02)[_0x4ba3('0x1a')](function(_0x788277){_0x29e498({'code':0xc8,'message':_0x788277[_0x4ba3('0x1b')]});})[_0x4ba3('0x1c')](function(_0x556290){_0x3515e9(_0x4419b4[_0x4ba3('0x10')](0x1f5,_0x556290[_0x4ba3('0x1b')]));});});},'Command':function(_0x70c677){var _0x1e2ce5=this;return new Promise(function(_0x184332,_0x125944){if(ami['isConnected']()==![]){return _0x125944(_0x1e2ce5['error'](0x1f4,[config[_0x4ba3('0x11')]['ip'],config['asterisk'][_0x4ba3('0x12')],_0x4ba3('0x13')][_0x4ba3('0x14')]('\x20')));}_0x70c677=_[_0x4ba3('0x15')](_0x70c677,_0x4ba3('0x1d'));_0x70c677[_0x4ba3('0x18')]='Command';return ami[_0x4ba3('0x1e')](_0x70c677)[_0x4ba3('0x1a')](function(_0x5c28f9){_0x184332({'code':0xc8,'message':_0x5c28f9[_0x4ba3('0x1f')]});})['catch'](function(_0x1ae4de){_0x125944(_0x1e2ce5[_0x4ba3('0x10')](0x1f5,_0x1ae4de[_0x4ba3('0x1b')]));});});},'VoiceQueues':function(_0x37e6f3){return new Promise(function(_0x152e41,_0xe29a49){var _0x159596=[];for(var _0xe1f7d2 in _0x278101[_0x4ba3('0x20')]){if(_0x278101[_0x4ba3('0x20')]['hasOwnProperty'](_0xe1f7d2)){var _0x252f37=_0x278101[_0x4ba3('0x20')][_0xe1f7d2];var _0x2311ed={'id':_0x252f37['id'],'name':_0x252f37['name'],'strategy':_0x252f37[_0x4ba3('0x21')],'answered':_0x252f37[_0x4ba3('0x22')],'available':_0x252f37[_0x4ba3('0x23')],'loggedIn':_0x252f37['loggedIn'],'pTalking':_0x252f37[_0x4ba3('0x24')],'sumBillable':_0x252f37[_0x4ba3('0x25')],'sumDuration':_0x252f37[_0x4ba3('0x26')],'sumHoldTime':_0x252f37[_0x4ba3('0x27')]||0x0,'talking':_0x252f37['talking'],'total':_0x252f37['total'],'type':_0x252f37[_0x4ba3('0x28')],'unmanaged':_0x252f37[_0x4ba3('0x29')],'abandoned':_0x252f37[_0x4ba3('0x2a')],'waiting':_0x252f37[_0x4ba3('0x2b')],'loggedInDb':_0x252f37[_0x4ba3('0x2c')]};if(_0x252f37[_0x4ba3('0x28')]==='outbound'){_0x2311ed[_0x4ba3('0x2d')]=_0x252f37[_0x4ba3('0x2d')];_0x2311ed[_0x4ba3('0x2e')]=_0x252f37[_0x4ba3('0x2e')];_0x2311ed[_0x4ba3('0x2f')]=_0x252f37[_0x4ba3('0x2f')];_0x2311ed[_0x4ba3('0x30')]=_0x252f37[_0x4ba3('0x30')];_0x2311ed[_0x4ba3('0x31')]=_0x252f37[_0x4ba3('0x31')];_0x2311ed['dialPrefix']=_0x252f37['dialPrefix'];_0x2311ed['temp']=_0x252f37[_0x4ba3('0x32')];_0x2311ed[_0x4ba3('0x33')]=_0x252f37[_0x4ba3('0x33')];_0x2311ed[_0x4ba3('0x34')]=_0x252f37[_0x4ba3('0x34')];_0x2311ed[_0x4ba3('0x35')]=_0x252f37[_0x4ba3('0x35')];_0x2311ed[_0x4ba3('0x36')]=_0x252f37[_0x4ba3('0x36')];_0x2311ed[_0x4ba3('0x37')]=_0x252f37[_0x4ba3('0x37')];_0x2311ed[_0x4ba3('0x38')]=_0x252f37['outboundDropCallsDayACS'];_0x2311ed[_0x4ba3('0x39')]=_0x252f37[_0x4ba3('0x39')];_0x2311ed[_0x4ba3('0x3a')]=_0x252f37['outboundDropCallsDayTimeout'];_0x2311ed[_0x4ba3('0x3b')]=_0x252f37['outboundNoAnswerCallsDay'];_0x2311ed[_0x4ba3('0x3c')]=_0x252f37[_0x4ba3('0x3c')];_0x2311ed[_0x4ba3('0x3d')]=_0x252f37[_0x4ba3('0x3d')];_0x2311ed[_0x4ba3('0x3e')]=_0x252f37[_0x4ba3('0x3e')];_0x2311ed['outboundRejectCallsDay']=_0x252f37[_0x4ba3('0x3f')];_0x2311ed[_0x4ba3('0x40')]=_0x252f37[_0x4ba3('0x40')];_0x2311ed['predictiveIntervalAnsweredCalls']=_0x252f37[_0x4ba3('0x41')];_0x2311ed[_0x4ba3('0x42')]=_0x252f37['predictiveIntervalAvgHoldtime'];_0x2311ed[_0x4ba3('0x43')]=_0x252f37['predictiveIntervalAvgTalktime'];_0x2311ed['predictiveIntervalDroppedCallsCallersExit']=_0x252f37[_0x4ba3('0x44')];_0x2311ed[_0x4ba3('0x45')]=_0x252f37[_0x4ba3('0x45')];_0x2311ed[_0x4ba3('0x46')]=_0x252f37[_0x4ba3('0x46')];_0x2311ed['predictiveIntervalErlangCallsDroppedCalls']=_0x252f37[_0x4ba3('0x47')];_0x2311ed[_0x4ba3('0x48')]=_0x252f37[_0x4ba3('0x48')];_0x2311ed[_0x4ba3('0x49')]=_0x252f37[_0x4ba3('0x49')];_0x2311ed[_0x4ba3('0x4a')]=_0x252f37[_0x4ba3('0x4a')];_0x2311ed[_0x4ba3('0x4b')]=_0x252f37['predictiveIntervalAvailable'];_0x2311ed[_0x4ba3('0x4c')]=_0x252f37[_0x4ba3('0x4c')];_0x2311ed[_0x4ba3('0x1b')]=_0x252f37[_0x4ba3('0x1b')];_0x2311ed[_0x4ba3('0x4d')]=_0x252f37[_0x4ba3('0x4d')];_0x2311ed[_0x4ba3('0x4e')]=_0x252f37[_0x4ba3('0x4e')];_0x2311ed[_0x4ba3('0x4f')]=_0x252f37[_0x4ba3('0x4f')];_0x2311ed[_0x4ba3('0x50')]=_0x252f37[_0x4ba3('0x50')];_0x2311ed[_0x4ba3('0x51')]=_0x252f37[_0x4ba3('0x51')];_0x2311ed['startPredictive']=_0x252f37['startPredictive'];_0x2311ed['startProgressive']=_0x252f37['startProgressive'];}if(_0x252f37['Trunk']){_0x2311ed[_0x4ba3('0x52')]={'id':_0x252f37['Trunk']['id'],'name':_0x252f37[_0x4ba3('0x52')]['name'],'active':_0x252f37[_0x4ba3('0x52')][_0x4ba3('0x53')],'callerid':_0x252f37[_0x4ba3('0x52')][_0x4ba3('0x54')]};}if(_0x252f37[_0x4ba3('0x55')]){_0x2311ed['Interval']={'id':_0x252f37[_0x4ba3('0x55')]['id'],'name':_0x252f37['Interval'][_0x4ba3('0xa')]};}_0x159596['push'](_0x2311ed);}}_0x152e41({'count':_0x159596[_0x4ba3('0x56')],'rows':_0x159596});});},'UpdateVoiceQueue':function(_0x1665eb){return new Promise(function(_0x3392a4,_0x261a5e){var _0xc23afe=_[_0x4ba3('0x57')](_0x278101[_0x4ba3('0x20')],{'id':parseInt(_0x1665eb['id'])});var _0x5d5714=_[_0x4ba3('0x58')](_0x1665eb,['id']);if(_0xc23afe){for(var _0x13cc06 in _0x5d5714){if(typeof _0x5d5714[_0x13cc06]!==_0x4ba3('0x59')&&typeof _0xc23afe[_0x13cc06]!==_0x4ba3('0x59')){_0xc23afe[_0x13cc06]=_0x5d5714[_0x13cc06];}}_0x3392a4(_0xc23afe);}else{_0x261a5e();}});},'VoiceChannels':function(_0x24986a){return new Promise(function(_0x480668,_0x56b55d){var _0xa4bbb2=_[_0x4ba3('0x5a')](_0x278101[_0x4ba3('0x5b')]);_0x480668({'count':_0xa4bbb2['length'],'rows':_0xa4bbb2});});},'VoiceChannelMixMonitor':function(_0xd466f6){var _0xfd30a0=this;return new Promise(function(_0x1220f4,_0x58648d){if(ami['isConnected']()==![]){return _0x58648d(_0xfd30a0[_0x4ba3('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x4ba3('0x11')][_0x4ba3('0x12')],_0x4ba3('0x13')][_0x4ba3('0x14')]('\x20')));}var _0x3d7b9d=schema(properties[_0x4ba3('0x5c')])['validate'](_0xd466f6);if(_0x3d7b9d[_0x4ba3('0x56')]>0x0){return _0x58648d(_0xfd30a0[_0x4ba3('0x10')](0x1f4,_['map'](_0x3d7b9d,_0x4ba3('0x1b'))[_0x4ba3('0x14')](',\x20')));}var _0x156c2d=_[_0x4ba3('0x57')](_0x278101[_0x4ba3('0x5b')],{'uniqueid':_0xd466f6['uniqueid']});if(_0x156c2d&&_0x156c2d[_0x4ba3('0x5d')]){var _0x38de05=util['format'](_0x4ba3('0x5e'),_0xd466f6[_0x4ba3('0x5f')]||_0xd466f6[_0x4ba3('0x60')],_0xd466f6[_0x4ba3('0x7')]||_0x4ba3('0x61'));return ami[_0x4ba3('0x1e')]({'action':_0x4ba3('0x62'),'channel':_0x156c2d[_0x4ba3('0x5d')],'file':_0x38de05,'options':_0x4ba3('0x63')})[_0x4ba3('0x1a')](function(_0x6ad6aa){var _0x29161b=_[_0x4ba3('0x57')](_0x156c2d[_0x4ba3('0x64')],{'filename':_0x4ba3('0x65')+_0x38de05['toLowerCase']()});if(_['isNil'](_0x29161b)){_0x156c2d['monitors'][_0x4ba3('0x66')]({'filename':_0x4ba3('0x65')+_0x38de05[_0x4ba3('0x67')](),'createdAt':moment()[_0x4ba3('0x7')](_0x4ba3('0x68')),'mixmonitorid':_0x6ad6aa['mixmonitorid'],'status':_0x4ba3('0x69')});}else{_0x29161b[_0x4ba3('0x6a')]=_0x6ad6aa[_0x4ba3('0x6a')];_0x29161b[_0x4ba3('0x6b')]=_0x4ba3('0x69');}_0x1220f4({'code':0xc8,'message':[_0xd466f6[_0x4ba3('0x60')],_0x4ba3('0x6c'),_0x6ad6aa[_0x4ba3('0x6a')]][_0x4ba3('0x14')]('\x20'),'mixmonitorid':_0x6ad6aa[_0x4ba3('0x6a')]});})[_0x4ba3('0x1c')](function(_0x43056b){_0x58648d(_0xfd30a0[_0x4ba3('0x10')](0x1f5,[_0xd466f6[_0x4ba3('0x60')],_0x43056b['message'][_0x4ba3('0x67')]()][_0x4ba3('0x14')]('\x20')));});}else{return _0x58648d(_0xfd30a0[_0x4ba3('0x10')](0x1f5,_0x4ba3('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x22d5ca){var _0x3d3313=this;return new Promise(function(_0x40827a,_0x3f6174){if(ami['isConnected']()==![]){return _0x3f6174(_0x3d3313[_0x4ba3('0x10')](0x1f4,[config[_0x4ba3('0x11')]['ip'],config[_0x4ba3('0x11')]['username'],_0x4ba3('0x13')]['join']('\x20')));}var _0x1b7c4e=schema(properties[_0x4ba3('0x5c')])[_0x4ba3('0x3')](_0x22d5ca);if(_0x1b7c4e[_0x4ba3('0x56')]>0x0){return _0x3f6174(_0x3d3313[_0x4ba3('0x10')](0x1f4,_['map'](_0x1b7c4e,_0x4ba3('0x1b'))[_0x4ba3('0x14')](',\x20')));}var _0x2a48fe=_[_0x4ba3('0x57')](_0x278101[_0x4ba3('0x5b')],{'uniqueid':_0x22d5ca['uniqueid']});if(_0x2a48fe){return BPromise[_0x4ba3('0x6e')]()[_0x4ba3('0x1a')](function(){if(_0x2a48fe[_0x4ba3('0x5d')]){return ami[_0x4ba3('0x1e')]({'action':_0x4ba3('0x6f'),'channel':_0x2a48fe[_0x4ba3('0x5d')],'mixmonitorid':_0x22d5ca[_0x4ba3('0x6a')]})[_0x4ba3('0x1c')](function(_0x39ddf3){});}})[_0x4ba3('0x1a')](function(){if(_0x2a48fe[_0x4ba3('0x70')]){return ami['Action']({'action':_0x4ba3('0x6f'),'channel':_0x2a48fe[_0x4ba3('0x70')],'mixmonitorid':_0x22d5ca['mixmonitorid']})['catch'](function(_0x3a6386){});}})[_0x4ba3('0x1a')](function(_0x5c7c2f){var _0x220c83=_[_0x4ba3('0x57')](_0x2a48fe[_0x4ba3('0x64')],{'mixmonitorid':_0x22d5ca['mixmonitorid']});if(_0x220c83){_0x220c83[_0x4ba3('0x6b')]=_0x4ba3('0x71');}})[_0x4ba3('0x1a')](function(){var _0x11209b=util[_0x4ba3('0x7')](_0x4ba3('0x5e'),_0x22d5ca['filename']||_0x22d5ca[_0x4ba3('0x60')],_0x22d5ca[_0x4ba3('0x7')]||_0x4ba3('0x61'));var _0x4e5bd7=_[_0x4ba3('0x57')](_0x2a48fe[_0x4ba3('0x64')],{'filename':_0x4ba3('0x65')+_0x11209b[_0x4ba3('0x67')]()});if(_0x4e5bd7){_0x4e5bd7[_0x4ba3('0x6b')]=_0x4ba3('0x71');}})[_0x4ba3('0x1a')](function(){_0x40827a({'code':0xc8,'message':[_0x22d5ca[_0x4ba3('0x60')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x4ba3('0x1c')](function(_0x5d8e46){_0x3f6174(_0x3d3313[_0x4ba3('0x10')](0x1f5,[_0x22d5ca[_0x4ba3('0x60')],_0x5d8e46[_0x4ba3('0x1b')]['toLowerCase']()][_0x4ba3('0x14')]('\x20')));});}else{return _0x3f6174(_0x3d3313[_0x4ba3('0x10')](0x1f5,_0x4ba3('0x6d')));}});},'VoiceQueuesChannels':function(_0x5baf26){return new Promise(function(_0x36dca0,_0x55b660){var _0xd6ad8e=_[_0x4ba3('0x5a')](_0x278101['queueChannels']);_0x36dca0({'count':_0xd6ad8e[_0x4ba3('0x56')],'rows':_0xd6ad8e});});},'VoiceQueuesChannel':function(_0x2ed729){var _0x3e566d=this;return new Promise(function(_0x1f4d92,_0x2feb68){var _0xa9a35d=schema(properties[_0x4ba3('0x72')])[_0x4ba3('0x3')](_0x2ed729);if(_0xa9a35d[_0x4ba3('0x56')]>0x0){return _0x2feb68(_0x3e566d['error'](0x1f4,_[_0x4ba3('0x73')](_0xa9a35d,_0x4ba3('0x1b'))[_0x4ba3('0x14')](',\x20')));}var _0x4378cc=_[_0x4ba3('0x57')](_0x278101[_0x4ba3('0x74')],{'uniqueid':_0x2ed729[_0x4ba3('0x60')]});if(_0x4378cc){_0x1f4d92(_0x4378cc);}else{return _0x2feb68(_0x3e566d[_0x4ba3('0x10')](0x1f5,_0x4ba3('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x1a3180){var _0x468219=this;return new Promise(function(_0x3ab4bd,_0x4e46af){if(ami[_0x4ba3('0xf')]()==![]){return _0x4e46af(_0x468219[_0x4ba3('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x4ba3('0x11')][_0x4ba3('0x12')],'ami\x20disconnected']['join']('\x20')));}var _0x4ce27=schema(properties[_0x4ba3('0x75')])[_0x4ba3('0x3')](_0x1a3180);if(_0x4ce27[_0x4ba3('0x56')]>0x0){return _0x4e46af(_0x468219[_0x4ba3('0x10')](0x1f4,_[_0x4ba3('0x73')](_0x4ce27,_0x4ba3('0x1b'))[_0x4ba3('0x14')](',\x20')));}var _0x516c41=_[_0x4ba3('0x57')](_0x278101['queueChannels'],{'uniqueid':_0x1a3180[_0x4ba3('0x60')]});if(_0x516c41&&_0x516c41[_0x4ba3('0x5d')]){return ami[_0x4ba3('0x1e')]({'action':_0x4ba3('0x76'),'channel':_0x516c41[_0x4ba3('0x5d')]})[_0x4ba3('0x1a')](function(_0x157b32){_0x3ab4bd({'code':0xc8,'message':[_0x1a3180[_0x4ba3('0x60')],_0x157b32['message'][_0x4ba3('0x67')]()][_0x4ba3('0x14')]('\x20')});})[_0x4ba3('0x1c')](function(_0x5a1872){_0x4e46af(_0x468219[_0x4ba3('0x10')](0x1f5,[_0x1a3180[_0x4ba3('0x60')],_0x5a1872[_0x4ba3('0x1b')][_0x4ba3('0x67')]()][_0x4ba3('0x14')]('\x20')));});}else{return _0x4e46af(_0x468219[_0x4ba3('0x10')](0x1f5,_0x4ba3('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x5c70b9){var _0x498437=this;return new Promise(function(_0x42ce25,_0x5106a8){if(ami[_0x4ba3('0xf')]()==![]){return _0x5106a8(_0x498437[_0x4ba3('0x10')](0x1f4,[config[_0x4ba3('0x11')]['ip'],config[_0x4ba3('0x11')]['username'],'ami\x20disconnected'][_0x4ba3('0x14')]('\x20')));}var _0x2b2132=schema(properties['voicequeuechannelredirect'])[_0x4ba3('0x3')](_0x5c70b9);if(_0x2b2132[_0x4ba3('0x56')]>0x0){return _0x5106a8(_0x498437[_0x4ba3('0x10')](0x1f4,_[_0x4ba3('0x73')](_0x2b2132,_0x4ba3('0x1b'))[_0x4ba3('0x14')](',\x20')));}var _0x3e99e3=_['find'](_0x278101[_0x4ba3('0x74')],{'uniqueid':_0x5c70b9[_0x4ba3('0x60')]});if(_0x3e99e3&&_0x3e99e3[_0x4ba3('0x5d')]){return ami['Action']({'action':_0x4ba3('0x77'),'channel':_0x3e99e3[_0x4ba3('0x5d')],'exten':_0x5c70b9['exten'],'context':_0x5c70b9[_0x4ba3('0x78')]||_0x3e99e3[_0x4ba3('0x78')],'priority':0x1})['then'](function(_0x4f5dee){_0x42ce25({'code':0xc8,'message':[_0x5c70b9['uniqueid'],_0x4f5dee['message'][_0x4ba3('0x67')]()][_0x4ba3('0x14')]('\x20')});})[_0x4ba3('0x1c')](function(_0x219aa4){_0x5106a8(_0x498437[_0x4ba3('0x10')](0x1f5,[_0x5c70b9[_0x4ba3('0x60')],_0x219aa4[_0x4ba3('0x1b')]['toLowerCase']()][_0x4ba3('0x14')]('\x20')));});}else{return _0x5106a8(_0x498437['error'](0x1f5,_0x4ba3('0x6d')));}});},'Agents':function(_0x5180f1){return new Promise(function(_0x27298f,_0x1a37f7){var _0x88b6a2=_[_0x4ba3('0x5a')](_0x278101[_0x4ba3('0xd')]);_0x27298f({'count':_0x88b6a2['length'],'rows':_0x88b6a2});});},'Telephones':function(_0x536313){return new Promise(function(_0x377b4c,_0x3d1f35){var _0x2cf661=_[_0x4ba3('0x5a')](_0x278101[_0x4ba3('0x79')]);_0x377b4c({'count':_0x2cf661[_0x4ba3('0x56')],'rows':_0x2cf661});});},'Trunks':function(_0x7ec030){return new Promise(function(_0x3d8606,_0x2d00e3){var _0x35441e=_[_0x4ba3('0x5a')](_0x278101[_0x4ba3('0x7a')]);_0x3d8606({'count':_0x35441e['length'],'rows':_0x35441e});});},'OutboundChannels':function(_0x375c61){return new Promise(function(_0x4cdc16,_0x3f5309){var _0x44568e=_[_0x4ba3('0x5a')](_0x278101[_0x4ba3('0x7b')]);_0x4cdc16({'count':_0x44568e['length'],'rows':_0x44568e});});},'Outbound':function(_0x2a2dc2){return new Promise(function(_0x31d66d,_0x2c304e){_0x31d66d(_0x278101[_0x4ba3('0x7c')]);});},'Campaigns':function(_0x5450f1){return new Promise(function(_0x530cfe,_0x139ddf){var _0xf95a3e=_[_0x4ba3('0x5a')](_0x278101['campaigns']);_0x530cfe({'count':_0xf95a3e[_0x4ba3('0x56')],'rows':_0xf95a3e});});},'VoiceQueuesPreview':function(_0x1194a5){var _0x22a9fb=this;return new Promise(function(_0x473229,_0x3f8444){_0x1011ec[_0x4ba3('0x7d')](_0x1194a5['id'])['then'](function(_0x3b805d){_0x473229({'code':0xc8,'message':_0x3b805d['message']});})[_0x4ba3('0x1c')](function(_0xa3e849){_0x3f8444(_0x22a9fb[_0x4ba3('0x10')](0x1f4,_0xa3e849[_0x4ba3('0x1b')]));});});},'EventManager':function(_0x48cb1a){var _0x11be49=this;return new Promise(function(_0x3bbcfb,_0x4b3cc0){if(!_0x48cb1a[_0x4ba3('0x7e')]){return _0x4b3cc0(_0x11be49['error'](0x1f4,_0x4ba3('0x7f')));}ami[_0x4ba3('0x80')](_0x4ba3('0x81')+_0x48cb1a[_0x4ba3('0x7e')],_0x48cb1a[_0x4ba3('0x1b')]);_0x3bbcfb({'code':0xc8,'message':_0x48cb1a});});},'FaxAccounts':function(_0x5c6180){return new Promise(function(_0x4a8dd4,_0x16e96c){var _0x3fa969=_[_0x4ba3('0x5a')](_0x278101['faxAccounts']);_0x4a8dd4({'count':_0x3fa969[_0x4ba3('0x56')],'rows':_0x3fa969});});},'SendFax':function(_0x38a7a8){var _0x5553eb=this;return new Promise(function(_0x402ab1,_0x236603){_0x3590a1[_0x4ba3('0x82')](_0x38a7a8)[_0x4ba3('0x1a')](function(_0x67cc0c){_0x402ab1({'code':0xc8,'message':_0x67cc0c[_0x4ba3('0x1b')]});})[_0x4ba3('0x1c')](function(_0xaabf96){_0x236603(_0x5553eb['error'](0x1f4,_0xaabf96[_0x4ba3('0x1b')]));});});},'CheckAfterSend':function(_0x4654e9){var _0xfb16a6=this;return new Promise(function(_0x1fe247,_0x162c1c){_0x3590a1[_0x4ba3('0x83')](_0x4654e9)[_0x4ba3('0x1a')](function(_0x44043c){_0x1fe247({'code':0xc8,'message':_0x44043c[_0x4ba3('0x1b')]});})[_0x4ba3('0x1c')](function(_0x285a5d){_0x162c1c(_0xfb16a6[_0x4ba3('0x10')](0x1f4,_0x285a5d[_0x4ba3('0x1b')]));});});}};var _0x4e5235=jayson['server'](_0x585f2d)[_0x4ba3('0x84')]();_0x4e5235['on'](_0x4ba3('0x10'),function(_0x25fa2a){return _0xe5f99a(_0x25fa2a);});_0x4e5235[_0x4ba3('0x6')](0x232a,_0x4ba3('0x85'),function(){console[_0x4ba3('0x86')](_0x4ba3('0x87'),0x232a);return _0xb88621('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index bd3d622..d0f0f52 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 _0xbb23=['split','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','updatedAt','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','Unknown','destcalleridname','','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','data5','xmd-contactid','ListId','data3'];(function(_0x5ea5d8,_0x36b433){var _0x5987ce=function(_0x56fa77){while(--_0x56fa77){_0x5ea5d8['push'](_0x5ea5d8['shift']());}};_0x5987ce(++_0x36b433);}(_0xbb23,0x16e));var _0x3bb2=function(_0x4e1e8a,_0x4f4fef){_0x4e1e8a=_0x4e1e8a-0x0;var _0x374611=_0xbb23[_0x4e1e8a];return _0x374611;};'use strict';var _=require(_0x3bb2('0x0'));var BPromise=require(_0x3bb2('0x1'));var Redis=require(_0x3bb2('0x2'));var util=require(_0x3bb2('0x3'));var config=require(_0x3bb2('0x4'));var logger=require('../../../../config/logger')(_0x3bb2('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x3bb2('0x6')]=_['defaults'](config[_0x3bb2('0x6')],{'host':_0x3bb2('0x7'),'port':0x18eb});var io=require(_0x3bb2('0x8'))(new Redis(config['redis']));function emit(_0x4bb056,_0x6ab6d2,_0x49ca0b,_0x1fec9b,_0x39988c){logger[_0x3bb2('0x9')](_0x3bb2('0xa'),_0x4bb056,_0x6ab6d2['id'],_0x49ca0b,_0x1fec9b,JSON['stringify'](_0x39988c));io['to'](_0x49ca0b)[_0x3bb2('0xb')](_0x1fec9b,_0x39988c);}exports[_0x3bb2('0xc')]=function(_0x4de9d2,_0x2b655c,_0x13d602,_0x15acfb){var _0x3ac17a,_0x31aa80;var _0x1060b1={};var _0x4ab981;var _0x23b95c=Number(_0x13d602['data1']);var _0x57a1c1=_0x13d602[_0x3bb2('0xd')]?Boolean(Number(_0x13d602[_0x3bb2('0xd')])):![];var _0x30dea7;var _0x3de1bd=![];if(!_['isNil'](_0x13d602[_0x3bb2('0xe')])){if(_0x13d602[_0x3bb2('0xe')]=='1')_0x3de1bd=!![];}if(!_0x3de1bd){if(_0x15acfb[_0x3bb2('0xf')]){_0x1060b1['id']=_0x15acfb['xmd-contactid'];}}if(!_0x1060b1['id']){_0x1060b1[_0x3bb2('0x10')]=_0x23b95c;_0x30dea7=_0x13d602[_0x3bb2('0x11')]&&_0x13d602[_0x3bb2('0x11')]!=='0'?_0x13d602[_0x3bb2('0x11')][_0x3bb2('0x12')](','):['phone'];_0x1060b1[_0x3bb2('0x13')]=_[_0x3bb2('0x14')](_0x30dea7,function(_0x543ec2){var _0x4b63b1={};_0x4b63b1[_0x543ec2]=_0x15acfb[_0x3bb2('0x15')]?_0x15acfb['destcalleridnum']:_0x15acfb[_0x3bb2('0x16')];return _0x4b63b1;});_0x4ab981=_0x15acfb['routeId']?_0x15acfb[_0x3bb2('0x17')]:_0x15acfb['calleridnum'];}var _0xf3d5a9=['id',_0x3bb2('0x18'),_0x3bb2('0x19'),'phone',_0x3bb2('0x1a'),_0x3bb2('0x1b'),_0x3bb2('0x10'),'createdAt','scheduledAt',_0x3bb2('0x1c')];var _0x1ec50f=_['union'](_0xf3d5a9,_0x30dea7);BPromise[_0x3bb2('0x1d')]()['then'](cmContactRpc['getContacts']({'attributes':_0x1ec50f,'where':_0x1060b1,'phone':_0x4ab981}))[_0x3bb2('0x1e')](function(_0x2f4a89){_0x31aa80=_0x2f4a89;if(!_[_0x3bb2('0x1f')](_0x31aa80)){if(_0x31aa80['length']===0x1){_0x3ac17a=_0x31aa80[0x0];logger[_0x3bb2('0x9')](_0x3bb2('0x20'),_0x15acfb['uniqueid'],_0x2b655c['id'],_0x3ac17a['id']);}else{logger[_0x3bb2('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x15acfb[_0x3bb2('0x21')],_0x2b655c['id'],_[_0x3bb2('0x14')](_0x31aa80,'id')[_0x3bb2('0x22')](','));}return;}else{logger[_0x3bb2('0x9')](_0x3bb2('0x23'),_0x15acfb['uniqueid'],_0x2b655c['id']);var _0x5e41f5={'ListId':_0x23b95c};var _0xa4bc19=_0x13d602[_0x3bb2('0x24')]&&_0x13d602[_0x3bb2('0x24')]!=='0'?_0x13d602[_0x3bb2('0x24')]:_0x3bb2('0x25');if(_0x57a1c1){logger['info'](_0x3bb2('0x26'),_0x15acfb[_0x3bb2('0x21')],_0x2b655c['id']);_0x5e41f5[_0xa4bc19]=_[_0x3bb2('0x27')](_0x15acfb['routeId'])?_0x15acfb[_0x3bb2('0x16')]:_0x15acfb[_0x3bb2('0x17')];if(_[_0x3bb2('0x27')](_0x15acfb[_0x3bb2('0x15')])){_0x5e41f5[_0x3bb2('0x18')]=_0x15acfb[_0x3bb2('0x28')]&&_0x15acfb[_0x3bb2('0x28')]!==''?_0x15acfb[_0x3bb2('0x28')]:_0x3bb2('0x29');}else{_0x5e41f5[_0x3bb2('0x18')]=_0x15acfb[_0x3bb2('0x2a')]&&_0x15acfb['destcalleridname']!==_0x3bb2('0x2b')?_0x15acfb[_0x3bb2('0x2a')]:_0x3bb2('0x29');}return BPromise[_0x3bb2('0x1d')]()[_0x3bb2('0x1e')](cmContactRpc['createContact'](_0x5e41f5))[_0x3bb2('0x1e')](function(_0x2ae76f){_0x3ac17a=_0x2ae76f;_0x31aa80['push'](_0x2ae76f);if(_0x3ac17a){logger[_0x3bb2('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x15acfb[_0x3bb2('0x21')],_0x2b655c['id'],_0x3ac17a['id']);}return;});}else{logger[_0x3bb2('0x9')](_0x3bb2('0x2c'),_0x15acfb['uniqueid'],_0x2b655c['id']);_0x5e41f5[_0xa4bc19]=_[_0x3bb2('0x27')](_0x15acfb[_0x3bb2('0x15')])?_0x15acfb['calleridnum']:_0x15acfb['destcalleridnum'];if(_[_0x3bb2('0x27')](_0x15acfb[_0x3bb2('0x15')])){_0x5e41f5[_0x3bb2('0x18')]=_0x15acfb[_0x3bb2('0x28')]&&_0x15acfb['calleridname']!==_0x3bb2('0x2b')?_0x15acfb[_0x3bb2('0x28')]:'Unknown';}else{_0x5e41f5[_0x3bb2('0x18')]=_0x15acfb[_0x3bb2('0x2a')]&&_0x15acfb[_0x3bb2('0x2a')]!==''?_0x15acfb['destcalleridname']:'Unknown';}_0x3ac17a=_0x5e41f5;_0x31aa80['push'](_0x5e41f5);return;}}})[_0x3bb2('0x1e')](function(){if(_0x4de9d2){emit(_0x15acfb[_0x3bb2('0x21')],_0x2b655c,util[_0x3bb2('0x2d')]('user:%s',_0x4de9d2[_0x3bb2('0x2e')]),util['format']('trigger:%s',_0x13d602['action'][_0x3bb2('0x2f')]()),{'evt':_['merge'](_0x15acfb,{'autoCreate':_0x57a1c1}),'contact':_0x3ac17a===undefined?{}:_0x3ac17a,'contacts':_0x31aa80['length']===0x0?undefined:_0x31aa80});}});}; \ No newline at end of file +var _0xd2fc=['../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','info','exec','data1','data5','xmd-contactid','ListId','data3','$or','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','merge','bluebird','util'];(function(_0x414a33,_0x5bf179){var _0x1922bd=function(_0xa5ca9c){while(--_0xa5ca9c){_0x414a33['push'](_0x414a33['shift']());}};_0x1922bd(++_0x5bf179);}(_0xd2fc,0xf8));var _0xcd2f=function(_0x1b9752,_0x3ed4b0){_0x1b9752=_0x1b9752-0x0;var _0x3fa0c2=_0xd2fc[_0x1b9752];return _0x3fa0c2;};'use strict';var _=require('lodash');var BPromise=require(_0xcd2f('0x0'));var Redis=require('ioredis');var util=require(_0xcd2f('0x1'));var config=require(_0xcd2f('0x2'));var logger=require(_0xcd2f('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0xcd2f('0x4')]=_['defaults'](config[_0xcd2f('0x4')],{'host':_0xcd2f('0x5'),'port':0x18eb});var io=require(_0xcd2f('0x6'))(new Redis(config['redis']));function emit(_0x27edd4,_0x6e64b8,_0x5066fd,_0x109039,_0x1fbab2){logger[_0xcd2f('0x7')]('[CM][%s][%s]',_0x27edd4,_0x6e64b8['id'],_0x5066fd,_0x109039,JSON['stringify'](_0x1fbab2));io['to'](_0x5066fd)['emit'](_0x109039,_0x1fbab2);}exports[_0xcd2f('0x8')]=function(_0x52aea2,_0x1209be,_0x12375b,_0x2b53e0){var _0x32ac60,_0x560f2c;var _0x564ae9={};var _0x3bd140;var _0x58bacc=Number(_0x12375b[_0xcd2f('0x9')]);var _0x422805=_0x12375b['data2']?Boolean(Number(_0x12375b['data2'])):![];var _0x4952af;var _0x295d5c=![];if(!_['isNil'](_0x12375b['data5'])){if(_0x12375b[_0xcd2f('0xa')]=='1')_0x295d5c=!![];}if(!_0x295d5c){if(_0x2b53e0['xmd-contactid']){_0x564ae9['id']=_0x2b53e0[_0xcd2f('0xb')];}}if(!_0x564ae9['id']){_0x564ae9[_0xcd2f('0xc')]=_0x58bacc;_0x4952af=_0x12375b[_0xcd2f('0xd')]&&_0x12375b[_0xcd2f('0xd')]!=='0'?_0x12375b[_0xcd2f('0xd')]['split'](','):['phone'];_0x564ae9[_0xcd2f('0xe')]=_['map'](_0x4952af,function(_0x4d4f9f){var _0x2fdf48={};_0x2fdf48[_0x4d4f9f]=_0x2b53e0[_0xcd2f('0xf')]?_0x2b53e0[_0xcd2f('0x10')]:_0x2b53e0[_0xcd2f('0x11')];return _0x2fdf48;});_0x3bd140=_0x2b53e0[_0xcd2f('0xf')]?_0x2b53e0['destcalleridnum']:_0x2b53e0[_0xcd2f('0x11')];}var _0x5a969f=['id',_0xcd2f('0x12'),'lastName',_0xcd2f('0x13'),_0xcd2f('0x14'),'fax',_0xcd2f('0xc'),_0xcd2f('0x15'),_0xcd2f('0x16'),_0xcd2f('0x17')];var _0x2aca64=_['union'](_0x5a969f,_0x4952af);BPromise[_0xcd2f('0x18')]()[_0xcd2f('0x19')](cmContactRpc[_0xcd2f('0x1a')]({'attributes':_0x2aca64,'where':_0x564ae9,'phone':_0x3bd140}))['then'](function(_0x1ac926){_0x560f2c=_0x1ac926;if(!_[_0xcd2f('0x1b')](_0x560f2c)){if(_0x560f2c[_0xcd2f('0x1c')]===0x1){_0x32ac60=_0x560f2c[0x0];logger[_0xcd2f('0x7')](_0xcd2f('0x1d'),_0x2b53e0[_0xcd2f('0x1e')],_0x1209be['id'],_0x32ac60['id']);}else{logger['info'](_0xcd2f('0x1f'),_0x2b53e0[_0xcd2f('0x1e')],_0x1209be['id'],_[_0xcd2f('0x20')](_0x560f2c,'id')[_0xcd2f('0x21')](','));}return;}else{logger[_0xcd2f('0x7')](_0xcd2f('0x22'),_0x2b53e0['uniqueid'],_0x1209be['id']);var _0x458557={'ListId':_0x58bacc};var _0x369dcd=_0x12375b[_0xcd2f('0x23')]&&_0x12375b['data4']!=='0'?_0x12375b[_0xcd2f('0x23')]:'phone';if(_0x422805){logger[_0xcd2f('0x7')](_0xcd2f('0x24'),_0x2b53e0[_0xcd2f('0x1e')],_0x1209be['id']);_0x458557[_0x369dcd]=_[_0xcd2f('0x25')](_0x2b53e0[_0xcd2f('0xf')])?_0x2b53e0[_0xcd2f('0x11')]:_0x2b53e0[_0xcd2f('0x10')];if(_[_0xcd2f('0x25')](_0x2b53e0[_0xcd2f('0xf')])){_0x458557[_0xcd2f('0x12')]=_0x2b53e0[_0xcd2f('0x26')]&&_0x2b53e0[_0xcd2f('0x26')]!==_0xcd2f('0x27')?_0x2b53e0[_0xcd2f('0x26')]:_0xcd2f('0x28');}else{_0x458557[_0xcd2f('0x12')]=_0x2b53e0[_0xcd2f('0x29')]&&_0x2b53e0['destcalleridname']!==_0xcd2f('0x27')?_0x2b53e0[_0xcd2f('0x29')]:_0xcd2f('0x28');}return BPromise['resolve']()[_0xcd2f('0x19')](cmContactRpc[_0xcd2f('0x2a')](_0x458557))[_0xcd2f('0x19')](function(_0x225da7){_0x32ac60=_0x225da7;_0x560f2c[_0xcd2f('0x2b')](_0x225da7);if(_0x32ac60){logger[_0xcd2f('0x7')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2b53e0['uniqueid'],_0x1209be['id'],_0x32ac60['id']);}return;});}else{logger['info'](_0xcd2f('0x2c'),_0x2b53e0['uniqueid'],_0x1209be['id']);_0x458557[_0x369dcd]=_[_0xcd2f('0x25')](_0x2b53e0[_0xcd2f('0xf')])?_0x2b53e0['calleridnum']:_0x2b53e0[_0xcd2f('0x10')];if(_[_0xcd2f('0x25')](_0x2b53e0[_0xcd2f('0xf')])){_0x458557['firstName']=_0x2b53e0[_0xcd2f('0x26')]&&_0x2b53e0[_0xcd2f('0x26')]!==_0xcd2f('0x27')?_0x2b53e0[_0xcd2f('0x26')]:'Unknown';}else{_0x458557['firstName']=_0x2b53e0[_0xcd2f('0x29')]&&_0x2b53e0[_0xcd2f('0x29')]!==_0xcd2f('0x27')?_0x2b53e0[_0xcd2f('0x29')]:_0xcd2f('0x28');}_0x32ac60=_0x458557;_0x560f2c[_0xcd2f('0x2b')](_0x458557);return;}}})[_0xcd2f('0x19')](function(){if(_0x52aea2){emit(_0x2b53e0[_0xcd2f('0x1e')],_0x1209be,util[_0xcd2f('0x2d')](_0xcd2f('0x2e'),_0x52aea2[_0xcd2f('0x2f')]),util[_0xcd2f('0x2d')](_0xcd2f('0x30'),_0x12375b['action']['toLowerCase']()),{'evt':_[_0xcd2f('0x31')](_0x2b53e0,{'autoCreate':_0x422805}),'contact':_0x32ac60===undefined?{}:_0x32ac60,'contacts':_0x560f2c['length']===0x0?undefined:_0x560f2c});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b0dbe5b..7414591 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 _0x583c=['TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','data5','800','windowHeight','data6','600','winapp','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','action','contactmanager','exec','accounts','queue','routeId','script','parse','query','search','replace','every','AllConditions','checkConditions','channel','AnyConditions','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','event','agent','membername','lastevent','null','substatus','offlineMessage','created','util','lodash','url','mustache','./urlforward','./integration','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:substatus','custom:outgoingmessage','custom:rejectmessage','prototype','info','stringify','emit','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','length','Actions','toLowerCase','browser'];(function(_0x5b7399,_0x4371b1){var _0x2a4f8f=function(_0x581200){while(--_0x581200){_0x5b7399['push'](_0x5b7399['shift']());}};_0x2a4f8f(++_0x4371b1);}(_0x583c,0x12b));var _0xc583=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x583c[_0x4afac5];return _0x2404b3;};'use strict';var util=require(_0xc583('0x0'));var _=require(_0xc583('0x1'));var url=require(_0xc583('0x2'));var Mustache=require(_0xc583('0x3'));var Redis=require('ioredis');var urlforward=require(_0xc583('0x4'));var integration=require(_0xc583('0x5'));var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xc583('0x6'));var logger=require(_0xc583('0x7'))('trigger');var ami=require(_0xc583('0x8'));config[_0xc583('0x9')]=_[_0xc583('0xa')](config[_0xc583('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xc583('0xb'))(new Redis(config[_0xc583('0x9')]));var operators={'equals':function(_0x5b456e,_0x163ab2){return _0x5b456e==_0x163ab2;},'not_equals':function(_0x24ab4f,_0x25f8d3){return _0x24ab4f!=_0x25f8d3;}};var barAndWebActions=[_0xc583('0xc'),_0xc583('0x2'),'winapp'];function Trigger(_0x3437be){this[_0xc583('0xd')]=_0x3437be['triggers'];this[_0xc583('0xe')]=_0x3437be[_0xc583('0xe')];this['voiceQueues']=_0x3437be[_0xc583('0xf')];this[_0xc583('0x10')]=_0x3437be[_0xc583('0x10')];this[_0xc583('0x11')]=_0x3437be[_0xc583('0x11')];this[_0xc583('0x12')]=_0x3437be[_0xc583('0x12')];this[_0xc583('0x13')]=_0x3437be[_0xc583('0x13')];this['salesforceAccounts']=_0x3437be[_0xc583('0x14')];this['sugarcrmAccounts']=_0x3437be[_0xc583('0x15')];this[_0xc583('0x16')]=_0x3437be['zohoAccounts'];this[_0xc583('0x17')]=_0x3437be[_0xc583('0x17')];this['vtigerAccounts']=_0x3437be[_0xc583('0x18')];this[_0xc583('0x19')]=_0x3437be['servicenowAccounts'];this[_0xc583('0x1a')]=_0x3437be[_0xc583('0x1a')];this[_0xc583('0x1b')]=_0x3437be[_0xc583('0x1b')];this['accounts']={'zendesk':this[_0xc583('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xc583('0x13')],'sugarcrm':this[_0xc583('0x15')],'zoho':this[_0xc583('0x16')],'desk':this[_0xc583('0x17')],'vtiger':this[_0xc583('0x18')],'dynamics365':this[_0xc583('0x1a')],'freshsales':this[_0xc583('0x1b')],'servicenow':this[_0xc583('0x19')]};ami['on'](_0xc583('0x1c'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x1f'),this[_0xc583('0x1d')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x20'),this['syncCustomEvent'][_0xc583('0x1e')](this));ami['on'](_0xc583('0x21'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x22'),this['syncCustomEvent']['bind'](this));ami['on'](_0xc583('0x23'),this['syncCustomEvent'][_0xc583('0x1e')](this));ami['on'](_0xc583('0x24'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x25'),this['syncCustomEvent'][_0xc583('0x1e')](this));ami['on'](_0xc583('0x26'),this['syncCustomEvent'][_0xc583('0x1e')](this));ami['on']('custom:queuecallerabandon',this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x27'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x28'),this[_0xc583('0x29')]['bind'](this));ami['on'](_0xc583('0x2a'),this[_0xc583('0x29')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x2b'),this[_0xc583('0x29')][_0xc583('0x1e')](this));ami['on']('custom:newinteraction',this[_0xc583('0x1d')]['bind'](this));ami['on']('custom:closedinteraction',this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x2c'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on']('custom:incomingmessage',this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x2d'),this['syncCustomEvent'][_0xc583('0x1e')](this));ami['on']('custom:acceptmessage',this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on'](_0xc583('0x2e'),this[_0xc583('0x1d')][_0xc583('0x1e')](this));ami['on']('custom:offlineMessage',this[_0xc583('0x1d')]['bind'](this));}Trigger[_0xc583('0x2f')]['emit']=function(_0x2e96fc,_0x3a562c,_0x7d89d0){logger[_0xc583('0x30')](_0x2e96fc,_0x3a562c,JSON[_0xc583('0x31')](_0x7d89d0));io['to'](_0x2e96fc)[_0xc583('0x32')](_0x3a562c,_0x7d89d0);};Trigger['prototype']['syncCustomEvent']=function(_0x3720d6){var _0xa02621=_['clone'](_0x3720d6);if(typeof _0xa02621[_0xc583('0x33')]===_0xc583('0x34')){_0xa02621[_0xc583('0x33')]=_0xc583('0x35');}this[_0xc583('0x36')](_0xa02621);};Trigger[_0xc583('0x2f')]['syncAgentDial']=function(_0x192a11){if(this['agents'][_0x192a11[_0xc583('0x37')]]){this[_0xc583('0x1d')](_0x192a11);}};Trigger[_0xc583('0x2f')]['checkTriggers']=function(_0x51ef91){var _0x518c90;for(var _0x26a348 in this[_0xc583('0xd')]){if(this[_0xc583('0xd')][_0xc583('0x38')](_0x26a348)){if(this['triggers'][_0x26a348][_0xc583('0x39')]){_0x518c90=this[_0xc583('0x3a')](this['triggers'][_0x26a348],_0x51ef91);if(_0x518c90){_['merge'](_0x51ef91,_0x51ef91[_0xc583('0x3b')]);for(var _0x5ad3d8=0x0,_0x254592,_0x1ec6f9,_0xe73752;_0x5ad3d80x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x5fc3[_0x2c9b79];return _0x265032;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 51a56c6..8cb632b 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 _0x1f0d=['util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','password','clientSecret','then','access_token','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','substring','lastIndexOf','telephone1','\x20eq\x20\x27','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/systemusers(','Fields','callDirection','queue','/contacts(','phonecalls','odata-entityid','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise'];(function(_0x4a16ad,_0x504dce){var _0x54a562=function(_0xb9649c){while(--_0xb9649c){_0x4a16ad['push'](_0x4a16ad['shift']());}};_0x54a562(++_0x504dce);}(_0x1f0d,0xda));var _0xd1f0=function(_0x1d4f8c,_0x584fa9){_0x1d4f8c=_0x1d4f8c-0x0;var _0xb7439f=_0x1f0d[_0x1d4f8c];return _0xb7439f;};'use strict';var _=require(_0xd1f0('0x0'));var rp=require(_0xd1f0('0x1'));var util=require(_0xd1f0('0x2'));var intUtil=require('./util');var md5=require(_0xd1f0('0x3'));var Redis=require(_0xd1f0('0x4'));var logger=require(_0xd1f0('0x5'))('dynamics365');var config=require(_0xd1f0('0x6'));config[_0xd1f0('0x7')]=_[_0xd1f0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd1f0('0x9'))(new Redis(config[_0xd1f0('0x7')]));function getAuthToken(_0x19c0c3,_0xfdc79b,_0x484f37){if(_0x19c0c3[_0xd1f0('0xa')]){_0x19c0c3[_0xd1f0('0xb')]=_0x19c0c3[_0xd1f0('0xc')]['data7'];_0x19c0c3[_0xd1f0('0xd')]=_0x19c0c3[_0xd1f0('0xc')][_0xd1f0('0xe')];return Promise[_0xd1f0('0xf')](_0x19c0c3[_0xd1f0('0xc')][_0xd1f0('0x10')]);}var _0x5e360c={'method':_0xd1f0('0x11'),'uri':_0xfdc79b,'form':{'client_id':_0x19c0c3[_0xd1f0('0x12')],'resource':_0x19c0c3[_0xd1f0('0xb')],'username':_0x19c0c3['username'],'password':_0x19c0c3[_0xd1f0('0x13')],'grant_type':'password','client_secret':_0x19c0c3[_0xd1f0('0x14')]},'json':!![]};return rp(_0x5e360c)[_0xd1f0('0x15')](function(_0x428c15){return _0x428c15[_0xd1f0('0x16')];})['catch'](function(_0x148058){logger[_0xd1f0('0x17')]('['+[_0x484f37[_0xd1f0('0x18')]()]+']\x20Wrong\x20credentials!');return _0x148058[_0xd1f0('0x19')];});}function getUser(_0x492878,_0xcad442,_0x2e79f9,_0x44bbcf,_0x2b37c2,_0x3133d5){return new Promise(function(_0x435792,_0xc631c5){return getAuthToken(_0xcad442,_0x44bbcf,_0x3133d5)[_0xd1f0('0x15')](function(_0x5d4676){var _0x1e4644={'method':_0xd1f0('0x1a'),'uri':_0x2b37c2+_0xd1f0('0x1b'),'headers':{'Authorization':_0xd1f0('0x1c')+_0x5d4676,'OData-Version':_0xd1f0('0x1d')},'json':!![]};return rp(_0x1e4644);})['then'](function(_0x14fcb0){var _0x524b5d=_0x14fcb0[_0xd1f0('0x1e')];var _0x29ce2b=![];var _0x3fd9fd=null;if(!_[_0xd1f0('0x1f')](_0x2e79f9)){if(intUtil['validateEmail'](_0x2e79f9[_0xd1f0('0x20')])){_0x492878[_0xd1f0('0x21')]=_0x2e79f9[_0xd1f0('0x20')];for(_0x3fd9fd=0x0;_0x3fd9fd<_0x524b5d[_0xd1f0('0x22')];_0x3fd9fd++){if(_0x524b5d[_0x3fd9fd][_0xd1f0('0x23')]===_0x2e79f9[_0xd1f0('0x20')]&&!_0x524b5d[_0x3fd9fd]['isdisabled']){_0x29ce2b=!![];logger['info']('['+[_0x3133d5[_0xd1f0('0x18')]()]+_0xd1f0('0x24')+_0x524b5d[_0x3fd9fd][_0xd1f0('0x25')]+'!');_0x492878[_0xd1f0('0x26')]=_0x524b5d[_0x3fd9fd]['systemuserid'];}}}}if(!_0x29ce2b){logger[_0xd1f0('0x27')]('['+[_0x3133d5[_0xd1f0('0x18')]()]+_0xd1f0('0x28'));_0x492878[_0xd1f0('0x21')]=_0xcad442[_0xd1f0('0x29')];for(_0x3fd9fd=0x0;_0x3fd9fd<_0x524b5d[_0xd1f0('0x22')];_0x3fd9fd++){if(_0x524b5d[_0x3fd9fd][_0xd1f0('0x23')]===_0xcad442[_0xd1f0('0x29')]){_0x492878[_0xd1f0('0x26')]=_0x524b5d[_0x3fd9fd][_0xd1f0('0x25')];}}}_0x435792(_0x492878);})[_0xd1f0('0x2a')](function(_0x27bddc){_0xc631c5(_0x27bddc[_0xd1f0('0x19')]);});});}function createEndUser(_0x5aeadb,_0x3d54ad,_0x1e82b4,_0x238438,_0x2de107,_0x426ca0,_0x634191){return new Promise(function(_0x487c96,_0x2c4e93){return getAuthToken(_0x3d54ad,_0x1e82b4,_0x426ca0)[_0xd1f0('0x15')](function(_0x14559d){var _0x241007=_0x426ca0[_0xd1f0('0x2b')]()===_0xd1f0('0x2c')?_0x2de107[_0xd1f0('0x2d')]:_0x2de107[_0xd1f0('0x2e')];var _0x1254c1={'method':_0xd1f0('0x11'),'uri':_0x238438+_0xd1f0('0x2f'),'body':{'fullname':_0x241007,'firstname':_0x241007,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5aeadb[_0xd1f0('0x26')]+')'},'headers':{'Authorization':_0xd1f0('0x1c')+_0x14559d,'OData-Version':_0xd1f0('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x1254c1['body'][_0x634191]=_0x241007;return rp(_0x1254c1);})[_0xd1f0('0x15')](function(_0x406c4b){var _0x385203=_0x406c4b[_0xd1f0('0x30')]['odata-entityid'];var _0x5c395a=_0x385203[_0xd1f0('0x31')](_0x385203[_0xd1f0('0x32')]('(')+0x1,_0x385203['lastIndexOf'](')'));_0x5aeadb['enduserId']=_0x5c395a;_0x487c96(_0x5aeadb);})[_0xd1f0('0x2a')](function(_0x425393){_0x2c4e93(_0x425393[_0xd1f0('0x19')]);});});}function getEndUser(_0x1ccd55,_0x5a2748,_0x53d7ba,_0x38ec48,_0x13fa58,_0x32338f,_0xec1ddf,_0x513df9){var _0x1c24cb=_0x32338f[_0xd1f0('0x2b')]()===_0xd1f0('0x2c')?_0x13fa58[_0xd1f0('0x2d')]:_0x13fa58[_0xd1f0('0x2e')];return getAuthToken(_0x5a2748,_0x53d7ba,_0x32338f)[_0xd1f0('0x15')](function(_0x4e5d04){_0x513df9=_0x513df9?_0x513df9:_0xd1f0('0x33');var _0x79cf00={'method':_0xd1f0('0x1a'),'uri':_0x38ec48+'contacts?$select='+_0x513df9+'&$filter='+_0x513df9+_0xd1f0('0x34')+_0x1c24cb['replace']('+',_0xd1f0('0x35'))+'\x27','headers':{'Authorization':_0xd1f0('0x1c')+_0x4e5d04,'If-None-Match':null,'OData-Version':_0xd1f0('0x1d')},'json':!![]};return rp(_0x79cf00);})[_0xd1f0('0x15')](function(_0x6f5361){var _0xac3ccd=![];if(!_0x6f5361)return _0xac3ccd;var _0x2a37b7=_0x6f5361[_0xd1f0('0x1e')];for(var _0x1777fe=0x0;_0x1777fe<_0x2a37b7[_0xd1f0('0x22')];_0x1777fe++){if(_0x2a37b7[_0x1777fe][_0x513df9]===_0x1c24cb){_0xac3ccd=!![];_0x1ccd55[_0xd1f0('0x36')]=_0x2a37b7[_0x1777fe][_0xd1f0('0x37')];}}return _0xac3ccd;})[_0xd1f0('0x15')](function(_0x32f601){if(_0x32f601)return _0x1ccd55;if(_0xec1ddf===_0xd1f0('0x38')){logger['info']('['+[_0x32338f['toUpperCase']()]+_0xd1f0('0x39'));return _0x1ccd55;}return createEndUser(_0x1ccd55,_0x5a2748,_0x53d7ba,_0x38ec48,_0x13fa58,_0x32338f,_0x513df9)[_0xd1f0('0x15')](function(_0x4b3e05){logger[_0xd1f0('0x27')]('['+[_0x32338f[_0xd1f0('0x18')]()]+_0xd1f0('0x3a'),_0x4b3e05[_0xd1f0('0x36')]);return _0x4b3e05;});});}function getCustomFields(_0xc1ace6,_0x5c16e2,_0x360625){var _0x108d13={};if(_0xc1ace6[_0xd1f0('0x22')]>0x0){_[_0xd1f0('0x3b')](_0xc1ace6,function(_0xbdeab5){if(_[_0xd1f0('0x3c')]([_0xd1f0('0x3d'),'picklist'],_0xbdeab5[_0xd1f0('0x3e')])&&_0xbdeab5[_0xd1f0('0x3f')]&&!_0xbdeab5[_0xd1f0('0x40')]){var _0x20c54d=_0xbdeab5[_0xd1f0('0x41')][_0xd1f0('0x2b')]();var _0x4d4546=_0x20c54d['substring'](0x0,_0x20c54d[_0xd1f0('0x42')]('_'));var _0x47653e=_0x20c54d[_0xd1f0('0x31')](_0x20c54d[_0xd1f0('0x42')]('_')+0x1);if(_0x4d4546===_0x360625){_0x108d13[_0x47653e]=_0xbdeab5[_0xd1f0('0x43')];}}});}return _0x108d13;}function getTicket(_0x2356b4,_0x4448e5,_0x40f5f5,_0x688e17,_0xd6b8d5,_0x158660,_0x429c69){return new Promise(function(_0xfa68f7,_0x467a44){var _0x25f68b;return getAuthToken(_0x4448e5,_0x40f5f5,_0x429c69)[_0xd1f0('0x15')](function(_0x379ab0){if(_0x158660[_0xd1f0('0x44')]==='incident'){_0x25f68b={'method':_0xd1f0('0x11'),'uri':_0x688e17+_0xd1f0('0x45'),'body':Object[_0xd1f0('0x46')]({},{'title':intUtil[_0xd1f0('0x47')](_0x158660[_0xd1f0('0x48')],_0xd6b8d5,'\x20'),'description':intUtil[_0xd1f0('0x47')](_0x158660[_0xd1f0('0x49')],_0xd6b8d5,'\x0a'),'customerid_contact@odata.bind':_0x2356b4['enduserId']?'/contacts('+_0x2356b4['enduserId']+')':undefined,'ownerid@odata.bind':_0xd1f0('0x4a')+_0x2356b4[_0xd1f0('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x158660[_0xd1f0('0x4b')],_0xd6b8d5,_0x158660['ticketType'])),'headers':{'Authorization':_0xd1f0('0x1c')+_0x379ab0,'OData-Version':_0xd1f0('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x158660[_0xd1f0('0x44')]==='phonecall'){var _0x5e93e3=_0x2356b4['enduserId']?[{'partyid_systemuser@odata.bind':_0xd1f0('0x4a')+_0x2356b4[_0xd1f0('0x26')]+')','participationtypemask':_0x2356b4[_0xd1f0('0x4c')]===_0xd1f0('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0xd1f0('0x4e')+_0x2356b4['enduserId']+')','participationtypemask':_0x2356b4[_0xd1f0('0x4c')]===_0xd1f0('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd1f0('0x4a')+_0x2356b4['userId']+')','participationtypemask':_0x2356b4[_0xd1f0('0x4c')]===_0xd1f0('0x4d')?0x2:0x1}];_0x25f68b={'method':'POST','uri':_0x688e17+_0xd1f0('0x4f'),'body':Object['assign']({},{'subject':intUtil[_0xd1f0('0x47')](_0x158660[_0xd1f0('0x48')],_0xd6b8d5,'\x20'),'phonenumber':String(_0xd6b8d5[_0xd1f0('0x2e')]),'description':intUtil[_0xd1f0('0x47')](_0x158660[_0xd1f0('0x49')],_0xd6b8d5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2356b4[_0xd1f0('0x36')]?'/contacts('+_0x2356b4[_0xd1f0('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2356b4[_0xd1f0('0x26')]+')','directioncode':_0x2356b4[_0xd1f0('0x4c')]===_0xd1f0('0x4d')?![]:!![],'phonecall_activity_parties':_0x5e93e3},getCustomFields(_0x158660[_0xd1f0('0x4b')],_0xd6b8d5,_0x158660['ticketType'])),'headers':{'Authorization':_0xd1f0('0x1c')+_0x379ab0,'OData-Version':_0xd1f0('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x25f68b);})[_0xd1f0('0x15')](function(_0x14ece5){var _0x2ac957=_0x14ece5['headers'][_0xd1f0('0x50')];var _0x27a8ba=_0x2ac957['substring'](_0x2ac957['lastIndexOf']('(')+0x1,_0x2ac957[_0xd1f0('0x32')](')'));_0x2356b4[_0xd1f0('0x51')]=_0x27a8ba;_0xfa68f7(_0x2356b4);})['catch'](function(_0x1578a1){_0x467a44(_0x1578a1[_0xd1f0('0x19')]);});});}function emit(_0x53fc68,_0x85e107,_0x32bed9,_0x25c52d){var _0x52419c={'uri':util[_0xd1f0('0x52')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x53fc68,_0x32bed9,_0x25c52d)};io['to'](util[_0xd1f0('0x52')](_0xd1f0('0x53'),_0x85e107))[_0xd1f0('0x54')](_0xd1f0('0x55'),_0x52419c);}exports['cs']=function(_0x583b13,_0x3a133a,_0xfd12eb,_0x378098,_0xabe5a,_0x29a2c2,_0x5eb9ce,_0xca20ee){var _0x52a7d7={};_0x29a2c2[_0xd1f0('0xb')]=_0x29a2c2[_0xd1f0('0xa')]?intUtil[_0xd1f0('0x56')](_0x29a2c2[_0xd1f0('0xc')][_0xd1f0('0x57')]):intUtil[_0xd1f0('0x56')](_0x29a2c2['remoteUri']);_0x29a2c2[_0xd1f0('0x58')]=intUtil[_0xd1f0('0x56')](_0x29a2c2['serverUrl']);_0x52a7d7[_0xd1f0('0x4c')]=_0xca20ee==='queue'||_0xca20ee===_0xd1f0('0x59')?_0xd1f0('0x4d'):'outbound';var _0x34949e=_0x29a2c2[_0xd1f0('0xa')]?util[_0xd1f0('0x52')]('%s/api/data/v9.0/',_0x29a2c2[_0xd1f0('0xc')]['data7']):util[_0xd1f0('0x52')](_0xd1f0('0x5a'),_0x29a2c2['remoteUri']);var _0x3baa70=util[_0xd1f0('0x52')](_0xd1f0('0x5b'),_0x29a2c2[_0xd1f0('0xd')]);var _0x1631b5=util['format'](_0xd1f0('0x5c'),_0x29a2c2[_0xd1f0('0x58')],_0x3a133a[_0xd1f0('0x5d')],md5(_0x3a133a[_0xd1f0('0x5d')]));if(_0xabe5a&&_0xabe5a[_0xd1f0('0x5e')]){logger[_0xd1f0('0x27')](_0xd1f0('0x5f'),_0xd1f0('0x60'));_0x3a133a[_0xd1f0('0x61')]=_0x1631b5;}else if(_0x5eb9ce&&_0x5eb9ce['recordingFormat']&&_0x5eb9ce[_0xd1f0('0x62')]!==_0xd1f0('0x63')){logger['info']('[OUTBOUND]',_0xd1f0('0x60'));_0x3a133a['recordingURL']=_0x1631b5;}else{_0x3a133a[_0xd1f0('0x61')]='';}return getUser(_0x52a7d7,_0x29a2c2,_0x378098,_0x3baa70,_0x34949e,_0xca20ee)[_0xd1f0('0x15')](function(_0x1a85d6){logger['info']('['+_0xca20ee[_0xd1f0('0x18')]()+_0xd1f0('0x64'),_0x1a85d6[_0xd1f0('0x26')]);logger[_0xd1f0('0x27')]('['+_0xca20ee[_0xd1f0('0x18')]()+_0xd1f0('0x65'),_0x1a85d6[_0xd1f0('0x21')]);return getEndUser(_0x1a85d6,_0x29a2c2,_0x3baa70,_0x34949e,_0x3a133a,_0xca20ee,_0xfd12eb[_0xd1f0('0x66')],_0xfd12eb[_0xd1f0('0x67')]);})[_0xd1f0('0x15')](function(_0x331a23){logger[_0xd1f0('0x27')]('['+_0xca20ee[_0xd1f0('0x18')]()+_0xd1f0('0x68'),_0x331a23[_0xd1f0('0x36')]);logger[_0xd1f0('0x27')]('['+_0xca20ee['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x3a133a[_0xd1f0('0x2e')]);return getTicket(_0x331a23,_0x29a2c2,_0x3baa70,_0x34949e,_0x3a133a,_0xfd12eb,_0xca20ee);})[_0xd1f0('0x15')](function(_0x137e84){logger[_0xd1f0('0x27')](util[_0xd1f0('0x52')]('['+_0xca20ee[_0xd1f0('0x18')]()+_0xd1f0('0x69'),_0xfd12eb['ticketType'],_0x137e84['ticketId']));logger[_0xd1f0('0x27')](util[_0xd1f0('0x52')]('['+_0xca20ee[_0xd1f0('0x18')]()+']\x20Call\x20direction:\x20%s',_0xca20ee));if(_0xca20ee!=='unmanaged'&&_0xfd12eb[_0xd1f0('0x6a')]){logger[_0xd1f0('0x27')]('['+_0xca20ee[_0xd1f0('0x18')]()+']',_0xd1f0('0x6b'));emit(_0x29a2c2[_0xd1f0('0xb')],_0x378098[_0xd1f0('0x6c')],_0xfd12eb[_0xd1f0('0x44')],_0x137e84[_0xd1f0('0x51')]);}})[_0xd1f0('0x2a')](function(_0x378893){logger[_0xd1f0('0x17')]('['+_0xca20ee[_0xd1f0('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x378893[_0xd1f0('0x19')]);console[_0xd1f0('0x17')](_0xd1f0('0x6d'),_0x378893);});}; \ No newline at end of file +var _0xc303=['[QUEUE]','Recording\x20is\x20enabled!','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','userEmail','username','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','userId','body','headers','substring','lastIndexOf','enduserId','message','outbound','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','ticketType','incident','assign','Subjects','getString','/contacts(','phonecall','queue','phonecalls','Descriptions','callDirection','odata-entityid','format','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xc303,0x1d5));var _0x3c30=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xc303[_0x49e584];return _0x58b1be;};'use strict';var _=require(_0x3c30('0x0'));var rp=require('request-promise');var util=require(_0x3c30('0x1'));var intUtil=require(_0x3c30('0x2'));var md5=require(_0x3c30('0x3'));var Redis=require('ioredis');var logger=require(_0x3c30('0x4'))(_0x3c30('0x5'));var config=require(_0x3c30('0x6'));config[_0x3c30('0x7')]=_[_0x3c30('0x8')](config[_0x3c30('0x7')],{'host':_0x3c30('0x9'),'port':0x18eb});var io=require(_0x3c30('0xa'))(new Redis(config['redis']));function getAuthToken(_0x26d8ab,_0x1cf25d,_0x15b245){if(_0x26d8ab[_0x3c30('0xb')]){_0x26d8ab['remoteUri']=_0x26d8ab[_0x3c30('0xc')][_0x3c30('0xd')];_0x26d8ab[_0x3c30('0xe')]=_0x26d8ab[_0x3c30('0xc')][_0x3c30('0xf')];return Promise[_0x3c30('0x10')](_0x26d8ab[_0x3c30('0xc')][_0x3c30('0x11')]);}var _0x3baab3={'method':_0x3c30('0x12'),'uri':_0x1cf25d,'form':{'client_id':_0x26d8ab['clientId'],'resource':_0x26d8ab['remoteUri'],'username':_0x26d8ab['username'],'password':_0x26d8ab[_0x3c30('0x13')],'grant_type':_0x3c30('0x13'),'client_secret':_0x26d8ab[_0x3c30('0x14')]},'json':!![]};return rp(_0x3baab3)[_0x3c30('0x15')](function(_0x48260c){return _0x48260c[_0x3c30('0x16')];})[_0x3c30('0x17')](function(_0x3bc6d8){logger['error']('['+[_0x15b245[_0x3c30('0x18')]()]+_0x3c30('0x19'));return _0x3bc6d8['message'];});}function getUser(_0x14969d,_0x4b6ca9,_0x257f05,_0x5de1fe,_0x1b7a40,_0x5d63c){return new Promise(function(_0x28e7f1,_0x238d0b){return getAuthToken(_0x4b6ca9,_0x5de1fe,_0x5d63c)[_0x3c30('0x15')](function(_0x596f63){var _0x27f81d={'method':_0x3c30('0x1a'),'uri':_0x1b7a40+_0x3c30('0x1b'),'headers':{'Authorization':_0x3c30('0x1c')+_0x596f63,'OData-Version':_0x3c30('0x1d')},'json':!![]};return rp(_0x27f81d);})[_0x3c30('0x15')](function(_0x52a583){var _0x557f69=_0x52a583[_0x3c30('0x1e')];var _0x277ee0=![];var _0x62a31=null;if(!_[_0x3c30('0x1f')](_0x257f05)){if(intUtil[_0x3c30('0x20')](_0x257f05[_0x3c30('0x21')])){_0x14969d['userEmail']=_0x257f05[_0x3c30('0x21')];for(_0x62a31=0x0;_0x62a31<_0x557f69[_0x3c30('0x22')];_0x62a31++){if(_0x557f69[_0x62a31][_0x3c30('0x23')]===_0x257f05['email']&&!_0x557f69[_0x62a31][_0x3c30('0x24')]){_0x277ee0=!![];logger['info']('['+[_0x5d63c[_0x3c30('0x18')]()]+_0x3c30('0x25')+_0x557f69[_0x62a31]['systemuserid']+'!');_0x14969d['userId']=_0x557f69[_0x62a31][_0x3c30('0x26')];}}}}if(!_0x277ee0){logger[_0x3c30('0x27')]('['+[_0x5d63c[_0x3c30('0x18')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x14969d[_0x3c30('0x28')]=_0x4b6ca9[_0x3c30('0x29')];for(_0x62a31=0x0;_0x62a31<_0x557f69['length'];_0x62a31++){if(_0x557f69[_0x62a31][_0x3c30('0x23')]===_0x4b6ca9['username']){_0x14969d['userId']=_0x557f69[_0x62a31][_0x3c30('0x26')];}}}_0x28e7f1(_0x14969d);})['catch'](function(_0x21f36c){_0x238d0b(_0x21f36c['message']);});});}function createEndUser(_0x4d5df8,_0x2e866c,_0x54a8dc,_0x11466c,_0x3bddca,_0x108496,_0x2d0458){return new Promise(function(_0x45b9b1,_0x34a561){return getAuthToken(_0x2e866c,_0x54a8dc,_0x108496)['then'](function(_0xe8e68a){var _0x6b912d=_0x108496[_0x3c30('0x2a')]()==='outbound'?_0x3bddca[_0x3c30('0x2b')]:_0x3bddca[_0x3c30('0x2c')];var _0x305bb3={'method':_0x3c30('0x12'),'uri':_0x11466c+_0x3c30('0x2d'),'body':{'fullname':_0x6b912d,'firstname':_0x6b912d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3c30('0x2e')+_0x4d5df8[_0x3c30('0x2f')]+')'},'headers':{'Authorization':_0x3c30('0x1c')+_0xe8e68a,'OData-Version':_0x3c30('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x305bb3[_0x3c30('0x30')][_0x2d0458]=_0x6b912d;return rp(_0x305bb3);})[_0x3c30('0x15')](function(_0x534acc){var _0x1c7b11=_0x534acc[_0x3c30('0x31')]['odata-entityid'];var _0x54870a=_0x1c7b11[_0x3c30('0x32')](_0x1c7b11['lastIndexOf']('(')+0x1,_0x1c7b11[_0x3c30('0x33')](')'));_0x4d5df8[_0x3c30('0x34')]=_0x54870a;_0x45b9b1(_0x4d5df8);})[_0x3c30('0x17')](function(_0x37cc42){_0x34a561(_0x37cc42[_0x3c30('0x35')]);});});}function getEndUser(_0x3f5163,_0x385793,_0x2f1268,_0x57ac13,_0x3e04cd,_0x222bac,_0x507a8b,_0x3eb6e4){var _0x322f63=_0x222bac[_0x3c30('0x2a')]()===_0x3c30('0x36')?_0x3e04cd[_0x3c30('0x2b')]:_0x3e04cd[_0x3c30('0x2c')];return getAuthToken(_0x385793,_0x2f1268,_0x222bac)[_0x3c30('0x15')](function(_0x6c0bbc){_0x3eb6e4=_0x3eb6e4?_0x3eb6e4:_0x3c30('0x37');var _0x43f054={'method':_0x3c30('0x1a'),'uri':_0x57ac13+'contacts?$select='+_0x3eb6e4+_0x3c30('0x38')+_0x3eb6e4+_0x3c30('0x39')+_0x322f63[_0x3c30('0x3a')]('+',_0x3c30('0x3b'))+'\x27','headers':{'Authorization':_0x3c30('0x1c')+_0x6c0bbc,'If-None-Match':null,'OData-Version':_0x3c30('0x1d')},'json':!![]};return rp(_0x43f054);})[_0x3c30('0x15')](function(_0x47321f){var _0x430104=![];if(!_0x47321f)return _0x430104;var _0x5652c0=_0x47321f[_0x3c30('0x1e')];for(var _0x40e0ca=0x0;_0x40e0ca<_0x5652c0['length'];_0x40e0ca++){if(_0x5652c0[_0x40e0ca][_0x3eb6e4]===_0x322f63){_0x430104=!![];_0x3f5163['enduserId']=_0x5652c0[_0x40e0ca]['contactid'];}}return _0x430104;})['then'](function(_0x1740b4){if(_0x1740b4)return _0x3f5163;if(_0x507a8b===_0x3c30('0x3c')){logger[_0x3c30('0x27')]('['+[_0x222bac['toUpperCase']()]+_0x3c30('0x3d'));return _0x3f5163;}return createEndUser(_0x3f5163,_0x385793,_0x2f1268,_0x57ac13,_0x3e04cd,_0x222bac,_0x3eb6e4)[_0x3c30('0x15')](function(_0x2b5a37){logger[_0x3c30('0x27')]('['+[_0x222bac['toUpperCase']()]+_0x3c30('0x3e'),_0x2b5a37[_0x3c30('0x34')]);return _0x2b5a37;});});}function getCustomFields(_0xd29cb5,_0x3bc722,_0x3dc6f8){var _0x59ad66={};if(_0xd29cb5[_0x3c30('0x22')]>0x0){_[_0x3c30('0x3f')](_0xd29cb5,function(_0x58e463){if(_[_0x3c30('0x40')]([_0x3c30('0x41'),_0x3c30('0x42')],_0x58e463['type'])&&_0x58e463[_0x3c30('0x43')]&&!_0x58e463[_0x3c30('0x44')]){var _0x96d165=_0x58e463[_0x3c30('0x45')][_0x3c30('0x2a')]();var _0x47c6d3=_0x96d165[_0x3c30('0x32')](0x0,_0x96d165[_0x3c30('0x46')]('_'));var _0x5319c6=_0x96d165[_0x3c30('0x32')](_0x96d165[_0x3c30('0x46')]('_')+0x1);if(_0x47c6d3===_0x3dc6f8){_0x59ad66[_0x5319c6]=_0x58e463['content'];}}});}return _0x59ad66;}function getTicket(_0x274e6b,_0x13cf63,_0x55b9a9,_0xae19cc,_0x165c12,_0x5e3764,_0x4e5a79){return new Promise(function(_0x3ab9bb,_0x45931b){var _0x214570;return getAuthToken(_0x13cf63,_0x55b9a9,_0x4e5a79)[_0x3c30('0x15')](function(_0x473c0d){if(_0x5e3764[_0x3c30('0x47')]===_0x3c30('0x48')){_0x214570={'method':_0x3c30('0x12'),'uri':_0xae19cc+'incidents','body':Object[_0x3c30('0x49')]({},{'title':intUtil['getString'](_0x5e3764[_0x3c30('0x4a')],_0x165c12,'\x20'),'description':intUtil[_0x3c30('0x4b')](_0x5e3764['Descriptions'],_0x165c12,'\x0a'),'customerid_contact@odata.bind':_0x274e6b[_0x3c30('0x34')]?_0x3c30('0x4c')+_0x274e6b[_0x3c30('0x34')]+')':undefined,'ownerid@odata.bind':_0x3c30('0x2e')+_0x274e6b[_0x3c30('0x2f')]+')','caseorigincode':'1'},getCustomFields(_0x5e3764['Fields'],_0x165c12,_0x5e3764[_0x3c30('0x47')])),'headers':{'Authorization':_0x3c30('0x1c')+_0x473c0d,'OData-Version':_0x3c30('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e3764[_0x3c30('0x47')]===_0x3c30('0x4d')){var _0x1b61f7=_0x274e6b[_0x3c30('0x34')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x274e6b[_0x3c30('0x2f')]+')','participationtypemask':_0x274e6b['callDirection']===_0x3c30('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x3c30('0x4c')+_0x274e6b[_0x3c30('0x34')]+')','participationtypemask':_0x274e6b['callDirection']===_0x3c30('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x3c30('0x2e')+_0x274e6b[_0x3c30('0x2f')]+')','participationtypemask':_0x274e6b['callDirection']===_0x3c30('0x4e')?0x2:0x1}];_0x214570={'method':_0x3c30('0x12'),'uri':_0xae19cc+_0x3c30('0x4f'),'body':Object[_0x3c30('0x49')]({},{'subject':intUtil[_0x3c30('0x4b')](_0x5e3764[_0x3c30('0x4a')],_0x165c12,'\x20'),'phonenumber':String(_0x165c12[_0x3c30('0x2c')]),'description':intUtil[_0x3c30('0x4b')](_0x5e3764[_0x3c30('0x50')],_0x165c12,'\x0a'),'regardingobjectid_contact@odata.bind':_0x274e6b[_0x3c30('0x34')]?'/contacts('+_0x274e6b[_0x3c30('0x34')]+')':undefined,'ownerid@odata.bind':_0x3c30('0x2e')+_0x274e6b[_0x3c30('0x2f')]+')','directioncode':_0x274e6b[_0x3c30('0x51')]===_0x3c30('0x4e')?![]:!![],'phonecall_activity_parties':_0x1b61f7},getCustomFields(_0x5e3764['Fields'],_0x165c12,_0x5e3764[_0x3c30('0x47')])),'headers':{'Authorization':_0x3c30('0x1c')+_0x473c0d,'OData-Version':_0x3c30('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x214570);})[_0x3c30('0x15')](function(_0x3114df){var _0x8f2f6b=_0x3114df[_0x3c30('0x31')][_0x3c30('0x52')];var _0x48a2b0=_0x8f2f6b[_0x3c30('0x32')](_0x8f2f6b['lastIndexOf']('(')+0x1,_0x8f2f6b[_0x3c30('0x33')](')'));_0x274e6b['ticketId']=_0x48a2b0;_0x3ab9bb(_0x274e6b);})['catch'](function(_0x13146f){_0x45931b(_0x13146f['message']);});});}function emit(_0xb5f966,_0x56561c,_0x3e2d14,_0x52bc7f){var _0x6d1ac7={'uri':util[_0x3c30('0x53')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xb5f966,_0x3e2d14,_0x52bc7f)};io['to'](util['format'](_0x3c30('0x54'),_0x56561c))[_0x3c30('0x55')](_0x3c30('0x56'),_0x6d1ac7);}exports['cs']=function(_0x2eaadb,_0x1b36e9,_0x1b1d72,_0xfc8f3,_0x4b39d5,_0x2ef4bf,_0x11748d,_0x31ffec){var _0x40c5d7={};_0x2ef4bf[_0x3c30('0x57')]=_0x2ef4bf[_0x3c30('0xb')]?intUtil[_0x3c30('0x58')](_0x2ef4bf[_0x3c30('0xc')][_0x3c30('0xd')]):intUtil['stripTrailingSlash'](_0x2ef4bf[_0x3c30('0x57')]);_0x2ef4bf[_0x3c30('0x59')]=intUtil[_0x3c30('0x58')](_0x2ef4bf[_0x3c30('0x59')]);_0x40c5d7[_0x3c30('0x51')]=_0x31ffec===_0x3c30('0x4e')||_0x31ffec===_0x3c30('0x5a')?_0x3c30('0x4e'):_0x3c30('0x36');var _0x38bf1f=_0x2ef4bf[_0x3c30('0xb')]?util[_0x3c30('0x53')](_0x3c30('0x5b'),_0x2ef4bf[_0x3c30('0xc')][_0x3c30('0xd')]):util[_0x3c30('0x53')](_0x3c30('0x5b'),_0x2ef4bf[_0x3c30('0x57')]);var _0x2cbe24=util[_0x3c30('0x53')](_0x3c30('0x5c'),_0x2ef4bf[_0x3c30('0xe')]);var _0x548d87=util['format'](_0x3c30('0x5d'),_0x2ef4bf['serverUrl'],_0x1b36e9[_0x3c30('0x5e')],md5(_0x1b36e9[_0x3c30('0x5e')]));if(_0x4b39d5&&_0x4b39d5[_0x3c30('0x5f')]){logger[_0x3c30('0x27')](_0x3c30('0x60'),_0x3c30('0x61'));_0x1b36e9['recordingURL']=_0x548d87;}else if(_0x11748d&&_0x11748d['recordingFormat']&&_0x11748d['recordingFormat']!==_0x3c30('0x62')){logger[_0x3c30('0x27')]('[OUTBOUND]',_0x3c30('0x61'));_0x1b36e9[_0x3c30('0x63')]=_0x548d87;}else{_0x1b36e9[_0x3c30('0x63')]='';}return getUser(_0x40c5d7,_0x2ef4bf,_0xfc8f3,_0x2cbe24,_0x38bf1f,_0x31ffec)[_0x3c30('0x15')](function(_0x159a95){logger[_0x3c30('0x27')]('['+_0x31ffec[_0x3c30('0x18')]()+_0x3c30('0x64'),_0x159a95['userId']);logger['info']('['+_0x31ffec[_0x3c30('0x18')]()+_0x3c30('0x65'),_0x159a95['userEmail']);return getEndUser(_0x159a95,_0x2ef4bf,_0x2cbe24,_0x38bf1f,_0x1b36e9,_0x31ffec,_0x1b1d72[_0x3c30('0x66')],_0x1b1d72['additionalSearchContact']);})[_0x3c30('0x15')](function(_0x31c087){logger[_0x3c30('0x27')]('['+_0x31ffec[_0x3c30('0x18')]()+_0x3c30('0x67'),_0x31c087['enduserId']);logger[_0x3c30('0x27')]('['+_0x31ffec['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x1b36e9['calleridnum']);return getTicket(_0x31c087,_0x2ef4bf,_0x2cbe24,_0x38bf1f,_0x1b36e9,_0x1b1d72,_0x31ffec);})[_0x3c30('0x15')](function(_0x10f2d8){logger['info'](util[_0x3c30('0x53')]('['+_0x31ffec['toUpperCase']()+_0x3c30('0x68'),_0x1b1d72[_0x3c30('0x47')],_0x10f2d8[_0x3c30('0x69')]));logger[_0x3c30('0x27')](util[_0x3c30('0x53')]('['+_0x31ffec[_0x3c30('0x18')]()+_0x3c30('0x6a'),_0x31ffec));if(_0x31ffec!==_0x3c30('0x5a')&&_0x1b1d72[_0x3c30('0x6b')]){logger[_0x3c30('0x27')]('['+_0x31ffec[_0x3c30('0x18')]()+']',_0x3c30('0x6c'));emit(_0x2ef4bf[_0x3c30('0x57')],_0xfc8f3[_0x3c30('0x6d')],_0x1b1d72['ticketType'],_0x10f2d8[_0x3c30('0x69')]);}})[_0x3c30('0x17')](function(_0x53cde0){logger[_0x3c30('0x6e')]('['+_0x31ffec[_0x3c30('0x18')]()+_0x3c30('0x6f'),_0x53cde0['message']);console['error'](_0x3c30('0x70'),_0x53cde0);});}; \ 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 e3fa30d..b2891c1 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 _0x902c=['defaults','localhost','socket.io-emitter','application/json','emit','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','includes','idField','push','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x902c,0x162));var _0xc902=function(_0x41b107,_0x3409fa){_0x41b107=_0x41b107-0x0;var _0x574f3a=_0x902c[_0x41b107];return _0x574f3a;};'use strict';var _=require(_0xc902('0x0'));var rp=require('request-promise');var md5=require(_0xc902('0x1'));var util=require(_0xc902('0x2'));var Redis=require('ioredis');var intUtil=require(_0xc902('0x3'));var config=require(_0xc902('0x4'));var logger=require(_0xc902('0x5'))('freshdesk');config['redis']=_[_0xc902('0x6')](config['redis'],{'host':_0xc902('0x7'),'port':0x18eb});var io=require(_0xc902('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xc902('0x9')};function emit(_0x55a07d,_0x3c2550,_0x30638e){io['to'](_0x55a07d)[_0xc902('0xa')](_0x3c2550,_0x30638e);}function getTicket(_0x3f2584,_0x1dccc6,_0x27a1ab,_0x217546,_0x2fc8c9){logger['info']('Creating\x20new\x20ticket...');var _0x1a124b=_[_0xc902('0xb')]({'responder_id':_0x1dccc6['id'],'requester_id':_0x27a1ab['id'],'name':util[_0xc902('0xc')](_0xc902('0xd'),_0x2fc8c9[_0xc902('0xe')]),'phone':_0x2fc8c9[_0xc902('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x217546[_0xc902('0x10')],_0x2fc8c9,'\x20'),'description':intUtil['getString'](_0x217546[_0xc902('0x11')],_0x2fc8c9,_0xc902('0x12')),'tags':getTags(_0x217546['Tags'],_0xc902('0x13'))},getCustomFields(_0x217546[_0xc902('0x14')],_0x2fc8c9));_0x1a124b[_0xc902('0x15')]=_[_0xc902('0x16')](_['keyBy'](_0x1a124b[_0xc902('0x15')],'id'),_0xc902('0x17'));return request({'uri':util[_0xc902('0xc')](_0xc902('0x18'),_0x3f2584[_0xc902('0x19')]),'method':_0xc902('0x1a'),'body':_0x1a124b})[_0xc902('0x1b')](function(_0x3c9e86){logger[_0xc902('0x1c')](_0xc902('0x1d'));return _0x3c9e86;});}function getUser(_0x52d5b3,_0x3fa745){if(intUtil[_0xc902('0x1e')](_0x3fa745)){return request({'uri':util[_0xc902('0xc')](_0xc902('0x1f'),_0x52d5b3['remoteUri']),'qs':{'email':_0x3fa745}})[_0xc902('0x1b')](function(_0x2d576f){if(_0x2d576f[_0xc902('0x20')]){logger['info'](_0xc902('0x21'));return _['find'](_0x2d576f,function(_0x285d0d){return _0x285d0d[_0xc902('0x22')][_0xc902('0x23')]===_0x3fa745;});}else{logger[_0xc902('0x1c')](_0xc902('0x24'));return request({'uri':util[_0xc902('0xc')](_0xc902('0x25'),_0x52d5b3[_0xc902('0x19')])})[_0xc902('0x1b')](function(_0xa68a15){logger[_0xc902('0x1c')](_0xc902('0x26'));return _0xa68a15;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xc902('0xc')](_0xc902('0x25'),_0x52d5b3[_0xc902('0x19')])})[_0xc902('0x1b')](function(_0x3f5440){logger[_0xc902('0x1c')]('Admin\x20account\x20selected.');return _0x3f5440;});}}function getEndUser(_0xb1afbd,_0x3c7ad7,_0x451e10){logger['info'](_0xc902('0x27'),_0x451e10);return request({'uri':util['format'](_0xc902('0x28'),_0xb1afbd[_0xc902('0x19')]),'qs':{'phone':_0x451e10}})['then'](function(_0x4263bb){if(_0x4263bb['length']){logger['info']('Enduser\x20found!');return _['find'](_0x4263bb,{'phone':_0x451e10});}else{logger['info'](_0xc902('0x29'));return request({'uri':util['format']('%s/api/v2/contacts',_0xb1afbd[_0xc902('0x19')]),'method':'POST','body':{'name':_0x3c7ad7,'phone':_0x451e10}})['then'](function(_0x42b208){logger[_0xc902('0x1c')](_0xc902('0x2a'));return _0x42b208;});}});}function getAuth(_0x1ab0aa){return util[_0xc902('0xc')]('Basic\x20%s',new Buffer(_0x1ab0aa[_0xc902('0x2b')]+':X')[_0xc902('0x2c')]('base64'));}function request(_0x169383){logger[_0xc902('0x2d')](_0xc902('0x2e'),JSON[_0xc902('0x2f')](_0x169383));return rp(_['defaults'](_0x169383,{'method':_0xc902('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x11d9a5,_0x2287ae){var _0x31264f=[];if(_0x11d9a5&&_0x11d9a5[_0xc902('0x20')]>0x0){_0x31264f=_[_0xc902('0x31')](_0x11d9a5,_0x2287ae);}return _0x31264f;}function getCustomFields(_0x4acb31,_0x2f70cd){var _0xb5b8ec=[];var _0x1f84ab={'custom_fields':[]};if(_0x4acb31[_0xc902('0x20')]>0x0){_[_0xc902('0x32')](_0x4acb31,function(_0x91c4d9){if(_['includes']([_0xc902('0x33'),_0xc902('0x34')],_0x91c4d9[_0xc902('0x35')])&&_0x91c4d9[_0xc902('0x36')]&&!_0x91c4d9[_0xc902('0x37')]){_0x1f84ab[_0x91c4d9['nameField'][_0xc902('0x38')]()]=_0x91c4d9[_0xc902('0x39')]['toString']();}else if(_[_0xc902('0x3a')]([_0xc902('0x33'),'picklist'],_0x91c4d9[_0xc902('0x35')])&&_0x91c4d9[_0xc902('0x3b')]&&_0x91c4d9[_0xc902('0x37')]){_0x1f84ab[_0xc902('0x15')][_0xc902('0x3c')]({'id':_0x91c4d9['idField'],'value':_0x91c4d9[_0xc902('0x39')][_0xc902('0x2c')]()});}else if(_0x91c4d9[_0xc902('0x35')]===_0xc902('0x3d')&&_0x91c4d9[_0xc902('0x3e')]&&_0x91c4d9[_0xc902('0x3b')]&&_0x91c4d9[_0xc902('0x37')]){_0x2f70cd[_0x91c4d9[_0xc902('0x3e')]]&&_0x1f84ab['custom_fields'][_0xc902('0x3c')]({'id':_0x91c4d9['idField'],'value':_0x2f70cd[_0x91c4d9[_0xc902('0x3e')]][_0xc902('0x2c')]()});}else if(_0x91c4d9['type']==='customVariable'&&_0x91c4d9[_0xc902('0x3f')]&&_0x91c4d9[_0xc902('0x3f')][_0xc902('0x13')]&&_0x91c4d9[_0xc902('0x3b')]&&_0x91c4d9['customField']){_0x2f70cd[_0x91c4d9[_0xc902('0x3f')][_0xc902('0x13')][_0xc902('0x38')]()]&&_0x1f84ab[_0xc902('0x15')]['push']({'id':_0x91c4d9[_0xc902('0x3b')],'value':_0x2f70cd[_0x91c4d9[_0xc902('0x3f')][_0xc902('0x13')][_0xc902('0x38')]()][_0xc902('0x2c')]()});}});}return _0x1f84ab;}exports['queue']=function(_0x11f561,_0x5b23ef,_0x17eb2b,_0x13324f,_0x867c3b,_0x17be80){var _0x3e10d6,_0x21439d;_0x17be80[_0xc902('0x19')]=intUtil[_0xc902('0x40')](_0x17be80[_0xc902('0x19')]);_0x17be80[_0xc902('0x41')]=intUtil[_0xc902('0x40')](_0x17be80[_0xc902('0x41')]);if(_0x867c3b&&_0x867c3b[_0xc902('0x42')]){logger[_0xc902('0x1c')](_0xc902('0x43'),'Recording\x20is\x20enabled!');_0x5b23ef[_0xc902('0x44')]=util['format'](_0xc902('0x45'),_0x17be80[_0xc902('0x41')],_0x5b23ef[_0xc902('0x46')],md5(_0x5b23ef[_0xc902('0x46')]));}else{_0x5b23ef[_0xc902('0x44')]='';}headers[_0xc902('0x47')]=getAuth(_0x17be80);return getUser(_0x17be80,_0x13324f[_0xc902('0x23')])[_0xc902('0x1b')](function(_0x573c7b){_0x3e10d6=_0x573c7b;logger[_0xc902('0x1c')]('The\x20User\x20ID\x20is:',_0x3e10d6['id']);return getEndUser(_0x17be80,_0x5b23ef[_0xc902('0xe')],_0x5b23ef[_0xc902('0xf')]);})['then'](function(_0x32163c){_0x21439d=_0x32163c;logger[_0xc902('0x1c')](_0xc902('0x48'),_0x21439d['id']);return getTicket(_0x17be80,_0x3e10d6,_0x21439d,_0x17eb2b,_0x5b23ef);})[_0xc902('0x1b')](function(_0x2b3970){if(_0x2b3970&&_0x2b3970['id']){logger['info'](_0xc902('0x1d'));logger[_0xc902('0x1c')](_0xc902('0x49'),_0x2b3970['id']);logger[_0xc902('0x1c')](_0xc902('0x43'),_0xc902('0x4a'));emit(util[_0xc902('0xc')](_0xc902('0x4b'),_0x13324f['name']),_0xc902('0x4c'),{'uri':util[_0xc902('0xc')](_0xc902('0x4d'),_0x17be80[_0xc902('0x19')],_0x2b3970['id'])});}})[_0xc902('0x4e')](function(_0x3e7583){logger[_0xc902('0x4f')](_0xc902('0x43'),JSON[_0xc902('0x2f')](_0x3e7583));});};exports[_0xc902('0x50')]=function(_0x43367b,_0x4ba5eb,_0x39ab30,_0x26b681,_0x39e0a6,_0x369832,_0x3aae9f){var _0x1c6a47,_0x122bde;_0x369832[_0xc902('0x19')]=intUtil[_0xc902('0x40')](_0x369832['remoteUri']);_0x369832['serverUrl']=intUtil[_0xc902('0x40')](_0x369832[_0xc902('0x41')]);if(_0x3aae9f&&_0x3aae9f[_0xc902('0x51')]&&_0x3aae9f[_0xc902('0x51')]!=='none'){logger['info']('[OUTBOUND]',_0xc902('0x52'));_0x4ba5eb[_0xc902('0x44')]=util[_0xc902('0xc')](_0xc902('0x45'),_0x369832[_0xc902('0x41')],_0x4ba5eb[_0xc902('0x46')],md5(_0x4ba5eb[_0xc902('0x46')]));}headers['Authorization']=getAuth(_0x369832);return getUser(_0x369832,_0x26b681[_0xc902('0x23')])['then'](function(_0x197f8e){_0x1c6a47=_0x197f8e;logger[_0xc902('0x1c')](_0xc902('0x53'),_0x1c6a47['id']);return getEndUser(_0x369832,_0x4ba5eb[_0xc902('0x54')],_0x4ba5eb[_0xc902('0x55')]);})[_0xc902('0x1b')](function(_0x31601e){_0x122bde=_0x31601e;logger['info'](_0xc902('0x48'),_0x122bde['id']);return getTicket(_0x369832,_0x1c6a47,_0x122bde,_0x39ab30,_0x4ba5eb);})['then'](function(_0x3bd1de){if(_0x3bd1de&&_0x3bd1de['id']){logger['info'](_0xc902('0x1d'));logger[_0xc902('0x1c')](_0xc902('0x49'),_0x3bd1de['id']);logger[_0xc902('0x1c')]('[OUTBOUND]',_0xc902('0x4a'));emit(util[_0xc902('0xc')](_0xc902('0x4b'),_0x26b681[_0xc902('0x13')]),'trigger:browser:url',{'uri':util[_0xc902('0xc')]('%s/helpdesk/tickets/%d',_0x369832[_0xc902('0x19')],_0x3bd1de['id'])});}})['catch'](function(_0x277b45){logger[_0xc902('0x4f')](_0xc902('0x56'),JSON['stringify'](_0x277b45));});};exports[_0xc902('0x57')]=function(_0x231256,_0x590051,_0x5888af,_0x365d8a,_0x192618,_0x596a28){var _0x2dffe8,_0x7f915b;_0x596a28[_0xc902('0x19')]=intUtil[_0xc902('0x40')](_0x596a28['remoteUri']);_0x596a28[_0xc902('0x41')]=intUtil['stripTrailingSlash'](_0x596a28[_0xc902('0x41')]);if(_0x192618&&_0x192618[_0xc902('0x42')]){logger[_0xc902('0x1c')]('['+_0x590051[_0xc902('0x58')][_0xc902('0x59')]()+']',_0xc902('0x52'));_0x590051[_0xc902('0x44')]=util[_0xc902('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x596a28['serverUrl'],_0x590051['uniqueid'],md5(_0x590051[_0xc902('0x46')]));}else{_0x590051[_0xc902('0x44')]='';}headers[_0xc902('0x47')]=getAuth(_0x596a28);return getUser(_0x596a28,'')[_0xc902('0x1b')](function(_0xf4419){_0x2dffe8=_0xf4419;logger['info'](_0xc902('0x53'),_0x2dffe8['id']);return getEndUser(_0x596a28,_0x590051['calleridname'],_0x590051['calleridnum']);})[_0xc902('0x1b')](function(_0x146669){_0x7f915b=_0x146669;logger['info'](_0xc902('0x48'),_0x7f915b['id']);return getTicket(_0x596a28,_0x2dffe8,_0x7f915b,_0x5888af,_0x590051);})['then'](function(_0x48c2ce){if(_0x48c2ce){logger[_0xc902('0x1c')](_0xc902('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x48c2ce['id']);}})['catch'](function(_0x4faf77){logger[_0xc902('0x4f')]('['+_0x590051[_0xc902('0x58')]['toUpperCase']()+']',JSON['stringify'](_0x4faf77));});}; \ No newline at end of file +var _0x7b2d=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','base64','debug','stringify','defaults','length','map','string','picklist','type','nameField','customField','content','includes','toString','variable','variableName','push','idField','toLowerCase','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','Tags','name','custom_fields','keyBy','%s/api/v2/tickets','then','validateEmail','find','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Searching\x20enduser\x20with\x20phone'];(function(_0x4467cb,_0x53f36e){var _0x5121fe=function(_0x28d0fd){while(--_0x28d0fd){_0x4467cb['push'](_0x4467cb['shift']());}};_0x5121fe(++_0x53f36e);}(_0x7b2d,0x8c));var _0xd7b2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7b2d[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xd7b2('0x0'));var rp=require(_0xd7b2('0x1'));var md5=require(_0xd7b2('0x2'));var util=require(_0xd7b2('0x3'));var Redis=require(_0xd7b2('0x4'));var intUtil=require(_0xd7b2('0x5'));var config=require(_0xd7b2('0x6'));var logger=require('../../../../config/logger')(_0xd7b2('0x7'));config['redis']=_['defaults'](config[_0xd7b2('0x8')],{'host':_0xd7b2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd7b2('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xd7b2('0xa')};function emit(_0x4aa400,_0x188ffa,_0x42b526){io['to'](_0x4aa400)[_0xd7b2('0xb')](_0x188ffa,_0x42b526);}function getTicket(_0x4d5523,_0x240c66,_0x47bcc2,_0x50022d,_0x11e9ba){logger[_0xd7b2('0xc')]('Creating\x20new\x20ticket...');var _0xa96f70=_[_0xd7b2('0xd')]({'responder_id':_0x240c66['id'],'requester_id':_0x47bcc2['id'],'name':util[_0xd7b2('0xe')](_0xd7b2('0xf'),_0x11e9ba[_0xd7b2('0x10')]),'phone':_0x11e9ba[_0xd7b2('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd7b2('0x12')](_0x50022d[_0xd7b2('0x13')],_0x11e9ba,'\x20'),'description':intUtil[_0xd7b2('0x12')](_0x50022d['Descriptions'],_0x11e9ba,_0xd7b2('0x14')),'tags':getTags(_0x50022d[_0xd7b2('0x15')],_0xd7b2('0x16'))},getCustomFields(_0x50022d['Fields'],_0x11e9ba));_0xa96f70[_0xd7b2('0x17')]=_['mapValues'](_[_0xd7b2('0x18')](_0xa96f70[_0xd7b2('0x17')],'id'),'value');return request({'uri':util[_0xd7b2('0xe')](_0xd7b2('0x19'),_0x4d5523['remoteUri']),'method':'POST','body':_0xa96f70})[_0xd7b2('0x1a')](function(_0x4a2c60){logger[_0xd7b2('0xc')]('Ticket\x20created!');return _0x4a2c60;});}function getUser(_0xec1daa,_0x5319c0){if(intUtil[_0xd7b2('0x1b')](_0x5319c0)){return request({'uri':util[_0xd7b2('0xe')]('%s/api/v2/agents',_0xec1daa['remoteUri']),'qs':{'email':_0x5319c0}})['then'](function(_0x561abc){if(_0x561abc['length']){logger[_0xd7b2('0xc')]('Agent\x20found!');return _[_0xd7b2('0x1c')](_0x561abc,function(_0x5b31e4){return _0x5b31e4[_0xd7b2('0x1d')][_0xd7b2('0x1e')]===_0x5319c0;});}else{logger[_0xd7b2('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0xec1daa['remoteUri'])})[_0xd7b2('0x1a')](function(_0x51e168){logger[_0xd7b2('0xc')](_0xd7b2('0x1f'));return _0x51e168;});}});}else{logger[_0xd7b2('0xc')](_0xd7b2('0x20'));return request({'uri':util[_0xd7b2('0xe')](_0xd7b2('0x21'),_0xec1daa[_0xd7b2('0x22')])})[_0xd7b2('0x1a')](function(_0x34d3f0){logger[_0xd7b2('0xc')](_0xd7b2('0x1f'));return _0x34d3f0;});}}function getEndUser(_0x8f3f26,_0x32da4c,_0x2e2d8b){logger['info'](_0xd7b2('0x23'),_0x2e2d8b);return request({'uri':util[_0xd7b2('0xe')]('%s/api/v2/contacts',_0x8f3f26[_0xd7b2('0x22')]),'qs':{'phone':_0x2e2d8b}})[_0xd7b2('0x1a')](function(_0x57281e){if(_0x57281e['length']){logger[_0xd7b2('0xc')](_0xd7b2('0x24'));return _[_0xd7b2('0x1c')](_0x57281e,{'phone':_0x2e2d8b});}else{logger[_0xd7b2('0xc')](_0xd7b2('0x25'));return request({'uri':util[_0xd7b2('0xe')]('%s/api/v2/contacts',_0x8f3f26[_0xd7b2('0x22')]),'method':_0xd7b2('0x26'),'body':{'name':_0x32da4c,'phone':_0x2e2d8b}})[_0xd7b2('0x1a')](function(_0x521aae){logger['info'](_0xd7b2('0x27'));return _0x521aae;});}});}function getAuth(_0x15fc37){return util[_0xd7b2('0xe')]('Basic\x20%s',new Buffer(_0x15fc37[_0xd7b2('0x28')]+':X')['toString'](_0xd7b2('0x29')));}function request(_0x1901ad){logger[_0xd7b2('0x2a')]('[HTTP]',JSON[_0xd7b2('0x2b')](_0x1901ad));return rp(_[_0xd7b2('0x2c')](_0x1901ad,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x154a1f,_0x1a50fc){var _0x206829=[];if(_0x154a1f&&_0x154a1f[_0xd7b2('0x2d')]>0x0){_0x206829=_[_0xd7b2('0x2e')](_0x154a1f,_0x1a50fc);}return _0x206829;}function getCustomFields(_0x3afd91,_0x235254){var _0x54ae25=[];var _0x2f3ea1={'custom_fields':[]};if(_0x3afd91[_0xd7b2('0x2d')]>0x0){_['forEach'](_0x3afd91,function(_0x2a6db4){if(_['includes']([_0xd7b2('0x2f'),_0xd7b2('0x30')],_0x2a6db4[_0xd7b2('0x31')])&&_0x2a6db4[_0xd7b2('0x32')]&&!_0x2a6db4[_0xd7b2('0x33')]){_0x2f3ea1[_0x2a6db4[_0xd7b2('0x32')]['toLowerCase']()]=_0x2a6db4[_0xd7b2('0x34')]['toString']();}else if(_[_0xd7b2('0x35')]([_0xd7b2('0x2f'),'picklist'],_0x2a6db4[_0xd7b2('0x31')])&&_0x2a6db4['idField']&&_0x2a6db4[_0xd7b2('0x33')]){_0x2f3ea1[_0xd7b2('0x17')]['push']({'id':_0x2a6db4['idField'],'value':_0x2a6db4[_0xd7b2('0x34')][_0xd7b2('0x36')]()});}else if(_0x2a6db4['type']===_0xd7b2('0x37')&&_0x2a6db4[_0xd7b2('0x38')]&&_0x2a6db4['idField']&&_0x2a6db4['customField']){_0x235254[_0x2a6db4['variableName']]&&_0x2f3ea1[_0xd7b2('0x17')][_0xd7b2('0x39')]({'id':_0x2a6db4[_0xd7b2('0x3a')],'value':_0x235254[_0x2a6db4[_0xd7b2('0x38')]][_0xd7b2('0x36')]()});}else if(_0x2a6db4[_0xd7b2('0x31')]==='customVariable'&&_0x2a6db4['Variable']&&_0x2a6db4['Variable']['name']&&_0x2a6db4[_0xd7b2('0x3a')]&&_0x2a6db4[_0xd7b2('0x33')]){_0x235254[_0x2a6db4['Variable'][_0xd7b2('0x16')][_0xd7b2('0x3b')]()]&&_0x2f3ea1[_0xd7b2('0x17')]['push']({'id':_0x2a6db4[_0xd7b2('0x3a')],'value':_0x235254[_0x2a6db4[_0xd7b2('0x3c')][_0xd7b2('0x16')][_0xd7b2('0x3b')]()][_0xd7b2('0x36')]()});}});}return _0x2f3ea1;}exports[_0xd7b2('0x3d')]=function(_0x364dd4,_0x5bf603,_0xa8528c,_0x380f25,_0x4e2eaf,_0x296710){var _0x21f2ab,_0x231929;_0x296710[_0xd7b2('0x22')]=intUtil[_0xd7b2('0x3e')](_0x296710[_0xd7b2('0x22')]);_0x296710[_0xd7b2('0x3f')]=intUtil[_0xd7b2('0x3e')](_0x296710['serverUrl']);if(_0x4e2eaf&&_0x4e2eaf['monitor_format']){logger['info'](_0xd7b2('0x40'),_0xd7b2('0x41'));_0x5bf603[_0xd7b2('0x42')]=util[_0xd7b2('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x296710[_0xd7b2('0x3f')],_0x5bf603['uniqueid'],md5(_0x5bf603[_0xd7b2('0x43')]));}else{_0x5bf603['recordingURL']='';}headers[_0xd7b2('0x44')]=getAuth(_0x296710);return getUser(_0x296710,_0x380f25[_0xd7b2('0x1e')])['then'](function(_0x3a9946){_0x21f2ab=_0x3a9946;logger[_0xd7b2('0xc')](_0xd7b2('0x45'),_0x21f2ab['id']);return getEndUser(_0x296710,_0x5bf603['calleridname'],_0x5bf603[_0xd7b2('0x11')]);})[_0xd7b2('0x1a')](function(_0x14dfcb){_0x231929=_0x14dfcb;logger[_0xd7b2('0xc')](_0xd7b2('0x46'),_0x231929['id']);return getTicket(_0x296710,_0x21f2ab,_0x231929,_0xa8528c,_0x5bf603);})[_0xd7b2('0x1a')](function(_0x377f46){if(_0x377f46&&_0x377f46['id']){logger['info']('Ticket\x20created!');logger[_0xd7b2('0xc')]('The\x20Ticket\x20ID\x20is:',_0x377f46['id']);logger[_0xd7b2('0xc')](_0xd7b2('0x40'),_0xd7b2('0x47'));emit(util[_0xd7b2('0xe')](_0xd7b2('0x48'),_0x380f25[_0xd7b2('0x16')]),_0xd7b2('0x49'),{'uri':util[_0xd7b2('0xe')]('%s/helpdesk/tickets/%d',_0x296710['remoteUri'],_0x377f46['id'])});}})[_0xd7b2('0x4a')](function(_0x300119){logger[_0xd7b2('0x4b')](_0xd7b2('0x40'),JSON[_0xd7b2('0x2b')](_0x300119));});};exports[_0xd7b2('0x4c')]=function(_0xde8b7,_0x13a52d,_0x159a85,_0x3ad5dd,_0x483aa4,_0x2a08e7,_0x2f32cb){var _0x2833d2,_0x22aa7d;_0x2a08e7[_0xd7b2('0x22')]=intUtil[_0xd7b2('0x3e')](_0x2a08e7['remoteUri']);_0x2a08e7['serverUrl']=intUtil[_0xd7b2('0x3e')](_0x2a08e7['serverUrl']);if(_0x2f32cb&&_0x2f32cb[_0xd7b2('0x4d')]&&_0x2f32cb['recordingFormat']!==_0xd7b2('0x4e')){logger[_0xd7b2('0xc')](_0xd7b2('0x4f'),'Recording\x20is\x20enabled!');_0x13a52d[_0xd7b2('0x42')]=util[_0xd7b2('0xe')](_0xd7b2('0x50'),_0x2a08e7['serverUrl'],_0x13a52d[_0xd7b2('0x43')],md5(_0x13a52d[_0xd7b2('0x43')]));}headers[_0xd7b2('0x44')]=getAuth(_0x2a08e7);return getUser(_0x2a08e7,_0x3ad5dd['email'])['then'](function(_0x2fbe93){_0x2833d2=_0x2fbe93;logger[_0xd7b2('0xc')](_0xd7b2('0x45'),_0x2833d2['id']);return getEndUser(_0x2a08e7,_0x13a52d['destcalleridname'],_0x13a52d[_0xd7b2('0x51')]);})['then'](function(_0x104955){_0x22aa7d=_0x104955;logger[_0xd7b2('0xc')](_0xd7b2('0x46'),_0x22aa7d['id']);return getTicket(_0x2a08e7,_0x2833d2,_0x22aa7d,_0x159a85,_0x13a52d);})[_0xd7b2('0x1a')](function(_0x3be0bc){if(_0x3be0bc&&_0x3be0bc['id']){logger[_0xd7b2('0xc')](_0xd7b2('0x52'));logger[_0xd7b2('0xc')](_0xd7b2('0x53'),_0x3be0bc['id']);logger['info']('[OUTBOUND]',_0xd7b2('0x47'));emit(util['format'](_0xd7b2('0x48'),_0x3ad5dd[_0xd7b2('0x16')]),_0xd7b2('0x49'),{'uri':util[_0xd7b2('0xe')](_0xd7b2('0x54'),_0x2a08e7['remoteUri'],_0x3be0bc['id'])});}})[_0xd7b2('0x4a')](function(_0x142e92){logger['error'](_0xd7b2('0x4f'),JSON[_0xd7b2('0x2b')](_0x142e92));});};exports[_0xd7b2('0x55')]=function(_0x517493,_0x4133e8,_0x415512,_0x4a89ee,_0x71be5,_0x5a7419){var _0x39aae5,_0x4fe6ed;_0x5a7419[_0xd7b2('0x22')]=intUtil['stripTrailingSlash'](_0x5a7419[_0xd7b2('0x22')]);_0x5a7419[_0xd7b2('0x3f')]=intUtil[_0xd7b2('0x3e')](_0x5a7419[_0xd7b2('0x3f')]);if(_0x71be5&&_0x71be5['monitor_format']){logger['info']('['+_0x4133e8['lastevent'][_0xd7b2('0x56')]()+']','Recording\x20is\x20enabled!');_0x4133e8['recordingURL']=util[_0xd7b2('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a7419[_0xd7b2('0x3f')],_0x4133e8[_0xd7b2('0x43')],md5(_0x4133e8[_0xd7b2('0x43')]));}else{_0x4133e8[_0xd7b2('0x42')]='';}headers[_0xd7b2('0x44')]=getAuth(_0x5a7419);return getUser(_0x5a7419,'')[_0xd7b2('0x1a')](function(_0x1e8686){_0x39aae5=_0x1e8686;logger['info'](_0xd7b2('0x45'),_0x39aae5['id']);return getEndUser(_0x5a7419,_0x4133e8[_0xd7b2('0x10')],_0x4133e8['calleridnum']);})[_0xd7b2('0x1a')](function(_0x4e4e3c){_0x4fe6ed=_0x4e4e3c;logger['info'](_0xd7b2('0x46'),_0x4fe6ed['id']);return getTicket(_0x5a7419,_0x39aae5,_0x4fe6ed,_0x415512,_0x4133e8);})['then'](function(_0x2d2a29){if(_0x2d2a29){logger[_0xd7b2('0xc')](_0xd7b2('0x52'));logger[_0xd7b2('0xc')](_0xd7b2('0x53'),_0x2d2a29['id']);}})['catch'](function(_0x1341d7){logger[_0xd7b2('0x4b')]('['+_0x4133e8[_0xd7b2('0x57')][_0xd7b2('0x56')]()+']',JSON[_0xd7b2('0x2b')](_0x1341d7));});}; \ 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 509ac85..73f756a 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 _0x195f=['lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','&f=','then','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','ticketId','unmanaged'];(function(_0x588fa5,_0x21a82f){var _0x18bbe1=function(_0x243b78){while(--_0x243b78){_0x588fa5['push'](_0x588fa5['shift']());}};_0x18bbe1(++_0x21a82f);}(_0x195f,0x177));var _0xf195=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0x195f[_0x9fb081];return _0x43f8b0;};'use strict';var _=require(_0xf195('0x0'));var rp=require(_0xf195('0x1'));var md5=require(_0xf195('0x2'));var util=require(_0xf195('0x3'));var moment=require('moment');var Promise=require(_0xf195('0x4'));var Redis=require(_0xf195('0x5'));var intUtil=require('./util');var config=require(_0xf195('0x6'));var logger=require(_0xf195('0x7'))(_0xf195('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0xf195('0x9'),'port':0x18eb});var io=require(_0xf195('0xa'))(new Redis(config['redis']));function getAdminId(_0x1ca920,_0x30c11c,_0x42090b,_0x15a33a){return new Promise(function(_0x47947d,_0x1ac070){var _0x588715=![];var _0x4fdd30={'method':_0xf195('0xb'),'uri':_0x15a33a+_0xf195('0xc'),'json':!![]};_0x4fdd30[_0xf195('0xd')]=_0x42090b;logger[_0xf195('0xe')](_0xf195('0xf'));return rp(_0x4fdd30)['then'](function(_0x43c1fe){if(_0x43c1fe){var _0x301b53=_0x43c1fe[_0xf195('0x10')];var _0x1ac914=null;for(_0x1ac914=0x0;_0x1ac914<_0x301b53['length'];_0x1ac914++){if(_0x301b53[_0x1ac914][_0xf195('0x11')]===_0x1ca920[_0xf195('0x12')]){_0x1ca920[_0xf195('0x13')]=_0x301b53[_0x1ac914]['id'];_0x588715=!![];}}if(_0x588715){logger[_0xf195('0xe')](_0xf195('0x14'),_0x1ca920[_0xf195('0x13')]);_0x47947d(_0x1ca920);}else{_0x1ac070({'statusCode':0x194,'message':_0xf195('0x15')});}}else{_0x1ac070({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf195('0x16')](function(_0x148dc3){logger[_0xf195('0x17')]('['+[_0x30c11c[_0xf195('0x18')]()]+']',_0x148dc3[_0xf195('0x19')]);_0x1ac070(_0x148dc3);});});}function getUser(_0x395c8b,_0x291278,_0x4c1bff){return function(_0x29db64){return new Promise(function(_0x1df6aa,_0x22d75e){var _0x5dcafd={'method':_0xf195('0xb'),'uri':_0x4c1bff+_0xf195('0xc'),'json':!![]};_0x5dcafd['headers']=_0x291278;logger[_0xf195('0xe')](_0xf195('0x1a'));return rp(_0x5dcafd)['then'](function(_0x374956){if(_0x374956){var _0x9cea9f=_0x374956[_0xf195('0x10')];var _0xaaab32=![];var _0x2e0cd5=null;if(_0x29db64['agentEmail']!==null){logger[_0xf195('0xe')](_0xf195('0x1b'),_0x29db64[_0xf195('0x1c')]);_0x29db64[_0xf195('0x1d')]=_0x29db64[_0xf195('0x1c')];for(_0x2e0cd5=0x0;_0x2e0cd5<_0x9cea9f[_0xf195('0x1e')];_0x2e0cd5++){if(_0x9cea9f[_0x2e0cd5][_0xf195('0x11')]===_0x29db64[_0xf195('0x1c')]){_0xaaab32=!![];_0x29db64[_0xf195('0x1f')]=_0x9cea9f[_0x2e0cd5]['id'];logger['info'](_0xf195('0x20'),_0x29db64['userId']);}}}if(!_0xaaab32){logger['info'](_0xf195('0x21'));_0x29db64[_0xf195('0x1d')]=_0x29db64['adminEmail'];_0x29db64[_0xf195('0x1f')]=_0x29db64[_0xf195('0x13')];_0xaaab32=!![];}if(_0xaaab32){_0x1df6aa(_0x29db64);}else{_0x22d75e({'statusCode':0x194,'message':_0xf195('0x15')});}}else{_0x22d75e({'statusCode':0x194,'message':_0xf195('0x15')});}})[_0xf195('0x16')](function(_0x46ed5b){logger['error']('['+[_0x395c8b['toUpperCase']()]+']',_0x46ed5b['message']);_0x22d75e(_0x46ed5b);});});};}function searchContact(_0x28f054,_0x6d1c93,_0x24e833,_0x1442af){return new Promise(function(_0x1b278b,_0x377a79){var _0x4f6d9f={'method':_0xf195('0xb'),'headers':_0x6d1c93,'uri':_0x28f054+'/api/lookup?q='+_0x1442af+_0xf195('0x22')+_0x24e833+'&entities=contact','json':!![]};rp(_0x4f6d9f)[_0xf195('0x23')](function(_0x2bb774){var _0x2947aa=_['find'](_0x2bb774['contacts'][_0xf195('0x24')],[_0x24e833,_0x1442af]);_0x1b278b(_0x2947aa);})['catch'](function(_0x4da18a){_0x377a79(_0x4da18a);});});}function getEndUser(_0x12f507,_0x154441,_0x37a33e){return function(_0x52c171){return new Promise(function(_0x3df1f7,_0x1ee1f1){logger[_0xf195('0xe')](util[_0xf195('0x25')](_0xf195('0x26'),_0x52c171[_0xf195('0x27')]));searchContact(_0x37a33e,_0x154441,'mobile_number',_0x52c171[_0xf195('0x27')])[_0xf195('0x23')](function(_0x398d2b){if(_0x398d2b){_0x52c171['endUserId']=_0x398d2b['id'];logger[_0xf195('0xe')]('Contact\x20found\x20mobile_number:',_0x52c171[_0xf195('0x28')]);return _0x3df1f7(_0x52c171);}searchContact(_0x37a33e,_0x154441,_0xf195('0x29'),_0x52c171[_0xf195('0x27')])[_0xf195('0x23')](function(_0x1a6361){if(_0x1a6361){_0x52c171['endUserId']=_0x1a6361['id'];logger[_0xf195('0xe')](_0xf195('0x2a'),_0x52c171[_0xf195('0x28')]);return _0x3df1f7(_0x52c171);}createEndUser(_0x52c171,_0x12f507,_0x154441,_0x37a33e)['then'](function(_0x28b474){logger['info']('Contact\x20created:',_0x28b474['endUserId']);return _0x3df1f7(_0x28b474);});});})['catch'](function(_0x3a7f8c){_0x1ee1f1(_0x3a7f8c);});});};}function createEndUser(_0x5a27fa,_0x5af8c1,_0x4a07d9,_0x563ea6){return new Promise(function(_0x1d7ecd,_0x2d56fc){var _0x47902c=moment();var _0x4fd423={'method':'POST','uri':_0x563ea6+'/api/contacts','body':{'contact':{'last_name':_0x5a27fa[_0xf195('0x27')],'work_number':_0x5a27fa[_0xf195('0x27')],'mobile_number':_0x5a27fa[_0xf195('0x27')],'owner_id':_0x5a27fa['userId'],'created_at':_0x47902c[_0xf195('0x25')](_0xf195('0x2b'))}},'json':!![]};_0x4fd423[_0xf195('0xd')]=_0x4a07d9;logger[_0xf195('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x4fd423)[_0xf195('0x23')](function(_0x44d714){_0x5a27fa[_0xf195('0x28')]=_0x44d714[_0xf195('0x2c')]['id'];_0x1d7ecd(_0x5a27fa);})[_0xf195('0x16')](function(_0x235789){logger[_0xf195('0x17')]('['+[_0x5af8c1[_0xf195('0x18')]()]+']',_0x235789[_0xf195('0x19')]);_0x2d56fc(_0x235789[_0xf195('0x19')]);});});}function getTicket(_0x2c5e02,_0x5eb7a7,_0x1f648a,_0x3d8145,_0x244fb0){return function(_0x24f99d){logger[_0xf195('0xe')](_0xf195('0x2d'));return new Promise(function(_0x12fe3e,_0x2b4b6b){var _0x339961=moment();var _0x21c65f={'method':'POST','uri':_0x1f648a+_0xf195('0x2e'),'body':{'title':intUtil[_0xf195('0x2f')](_0x3d8145[_0xf195('0x30')],_0x244fb0,'\x20'),'description':intUtil[_0xf195('0x2f')](_0x3d8145[_0xf195('0x31')],_0x244fb0,'\x0a'),'owner_id':_0x24f99d[_0xf195('0x1f')],'creater_id':_0x24f99d[_0xf195('0x13')],'targetable_id':_0x24f99d[_0xf195('0x28')],'targetable_type':'Contact','created_at':_0x339961['format'](_0xf195('0x2b')),'due_date':_0x339961[_0xf195('0x32')](0x1e,'m')['format'](_0xf195('0x2b'))},'json':!![]};_0x21c65f[_0xf195('0xd')]=_0x5eb7a7;return rp(_0x21c65f)[_0xf195('0x23')](function(_0x18d0d5){_0x24f99d['ticketId']=_0x18d0d5[_0xf195('0x33')]['id'];logger[_0xf195('0xe')](_0xf195('0x34'),_0x24f99d['ticketId']);_0x12fe3e(_0x24f99d);})['catch'](function(_0x915def){logger[_0xf195('0x17')]('['+[_0x2c5e02[_0xf195('0x18')]()]+']',_0x915def[_0xf195('0x19')]);_0x2b4b6b(_0x915def[_0xf195('0x19')]);});});};}function emit(_0x1cd2e5,_0x1d66ea,_0x3c2f6b){var _0x3f4326={'uri':_0x1cd2e5+_0xf195('0x35')+_0x3c2f6b};io['to'](util[_0xf195('0x25')](_0xf195('0x36'),_0x1d66ea))['emit'](_0xf195('0x37'),_0x3f4326);}exports['cs']=function(_0x47bada,_0x3a265e,_0x4ecfd0,_0x512be3,_0x4c76c4,_0x20c9f6,_0x19b624,_0x56ab2e){var _0x337b91={};var _0x29d186={'Authorization':_0xf195('0x38')+_0x20c9f6['apiKey']};_0x20c9f6[_0xf195('0x39')]=intUtil[_0xf195('0x3a')](_0x20c9f6[_0xf195('0x39')]);_0x20c9f6['serverUrl']=intUtil[_0xf195('0x3a')](_0x20c9f6['serverUrl']);var _0x25fdf1=_0x20c9f6['remoteUri'];_0x337b91[_0xf195('0x12')]=_0x20c9f6[_0xf195('0x3b')];_0x337b91[_0xf195('0x27')]=_0x56ab2e['toLowerCase']()===_0xf195('0x3c')?_0x3a265e[_0xf195('0x3d')]:_0x3a265e['calleridnum'];_0x337b91[_0xf195('0x3e')]=_0x56ab2e===_0xf195('0x3f')||_0x56ab2e==='unmanaged'?_0xf195('0x3f'):'outbound';if(_0x512be3){_0x337b91[_0xf195('0x1c')]=_0x512be3[_0xf195('0x11')];}var _0x1ab950=util['format'](_0xf195('0x40'),_0x20c9f6[_0xf195('0x41')],_0x3a265e['uniqueid'],md5(_0x3a265e[_0xf195('0x42')]));if(_0x4c76c4&&_0x4c76c4[_0xf195('0x43')]){logger[_0xf195('0xe')](_0xf195('0x44'),_0xf195('0x45'));_0x3a265e[_0xf195('0x46')]=_0x1ab950;}else if(_0x19b624&&_0x19b624['recordingFormat']&&_0x19b624['recordingFormat']!==_0xf195('0x47')){logger[_0xf195('0xe')](_0xf195('0x48'),_0xf195('0x45'));_0x3a265e[_0xf195('0x46')]=_0x1ab950;}else{_0x3a265e[_0xf195('0x46')]='';}return getAdminId(_0x337b91,_0x56ab2e,_0x29d186,_0x25fdf1)['then'](getUser(_0x56ab2e,_0x29d186,_0x25fdf1))[_0xf195('0x23')](getEndUser(_0x56ab2e,_0x29d186,_0x25fdf1))[_0xf195('0x23')](getTicket(_0x56ab2e,_0x29d186,_0x25fdf1,_0x4ecfd0,_0x3a265e))[_0xf195('0x23')](function(_0x1682c6){logger['info'](util[_0xf195('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1682c6[_0xf195('0x49')]));if(_0x56ab2e!==_0xf195('0x4a')){logger[_0xf195('0xe')]('['+[_0x56ab2e[_0xf195('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x25fdf1,_0x512be3['name'],_0x1682c6[_0xf195('0x28')]);}})[_0xf195('0x16')](function(_0x4a682d){logger[_0xf195('0x17')]('['+[_0x56ab2e[_0xf195('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x4a682d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x927e=['/contacts/','emit','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','then','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','Admin\x20selected','userId','catch','message','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','task','Task\x20created:','ticketId'];(function(_0x427f00,_0x4e23cc){var _0x5633bd=function(_0xd6ddfb){while(--_0xd6ddfb){_0x427f00['push'](_0x427f00['shift']());}};_0x5633bd(++_0x4e23cc);}(_0x927e,0x118));var _0xe927=function(_0x56dd58,_0xb1287d){_0x56dd58=_0x56dd58-0x0;var _0x103e75=_0x927e[_0x56dd58];return _0x103e75;};'use strict';var _=require(_0xe927('0x0'));var rp=require(_0xe927('0x1'));var md5=require(_0xe927('0x2'));var util=require('util');var moment=require(_0xe927('0x3'));var Promise=require(_0xe927('0x4'));var Redis=require(_0xe927('0x5'));var intUtil=require(_0xe927('0x6'));var config=require('../../../../config/environment');var logger=require(_0xe927('0x7'))(_0xe927('0x8'));config[_0xe927('0x9')]=_[_0xe927('0xa')](config[_0xe927('0x9')],{'host':_0xe927('0xb'),'port':0x18eb});var io=require(_0xe927('0xc'))(new Redis(config[_0xe927('0x9')]));function getAdminId(_0xfe4460,_0x4578ff,_0x4e46c4,_0x2b68ab){return new Promise(function(_0xbe8d7b,_0x2911ba){var _0x508bbc=![];var _0x3e9f3f={'method':_0xe927('0xd'),'uri':_0x2b68ab+_0xe927('0xe'),'json':!![]};_0x3e9f3f[_0xe927('0xf')]=_0x4e46c4;logger['info']('Getting\x20admin\x20information');return rp(_0x3e9f3f)[_0xe927('0x10')](function(_0x4a8ed4){if(_0x4a8ed4){var _0x413efa=_0x4a8ed4[_0xe927('0x11')];var _0x4bab1e=null;for(_0x4bab1e=0x0;_0x4bab1e<_0x413efa[_0xe927('0x12')];_0x4bab1e++){if(_0x413efa[_0x4bab1e][_0xe927('0x13')]===_0xfe4460[_0xe927('0x14')]){_0xfe4460[_0xe927('0x15')]=_0x413efa[_0x4bab1e]['id'];_0x508bbc=!![];}}if(_0x508bbc){logger[_0xe927('0x16')](_0xe927('0x17'),_0xfe4460[_0xe927('0x15')]);_0xbe8d7b(_0xfe4460);}else{_0x2911ba({'statusCode':0x194,'message':_0xe927('0x18')});}}else{_0x2911ba({'statusCode':0x194,'message':_0xe927('0x18')});}})['catch'](function(_0x2c6aba){logger[_0xe927('0x19')]('['+[_0x4578ff[_0xe927('0x1a')]()]+']',_0x2c6aba['message']);_0x2911ba(_0x2c6aba);});});}function getUser(_0x4f4d00,_0x274916,_0x1940f1){return function(_0x1d5848){return new Promise(function(_0x3564e1,_0x3bd592){var _0x370818={'method':_0xe927('0xd'),'uri':_0x1940f1+_0xe927('0xe'),'json':!![]};_0x370818[_0xe927('0xf')]=_0x274916;logger[_0xe927('0x16')](_0xe927('0x1b'));return rp(_0x370818)['then'](function(_0x195283){if(_0x195283){var _0x181bd2=_0x195283['users'];var _0x16de4f=![];var _0x42065d=null;if(_0x1d5848[_0xe927('0x1c')]!==null){logger['info'](_0xe927('0x1d'),_0x1d5848[_0xe927('0x1c')]);_0x1d5848[_0xe927('0x1e')]=_0x1d5848['agentEmail'];for(_0x42065d=0x0;_0x42065d<_0x181bd2[_0xe927('0x12')];_0x42065d++){if(_0x181bd2[_0x42065d][_0xe927('0x13')]===_0x1d5848['agentEmail']){_0x16de4f=!![];_0x1d5848['userId']=_0x181bd2[_0x42065d]['id'];logger[_0xe927('0x16')](_0xe927('0x1f'),_0x1d5848['userId']);}}}if(!_0x16de4f){logger[_0xe927('0x16')](_0xe927('0x20'));_0x1d5848['userEmail']=_0x1d5848['adminEmail'];_0x1d5848[_0xe927('0x21')]=_0x1d5848[_0xe927('0x15')];_0x16de4f=!![];}if(_0x16de4f){_0x3564e1(_0x1d5848);}else{_0x3bd592({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3bd592({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xe927('0x22')](function(_0x321f55){logger[_0xe927('0x19')]('['+[_0x4f4d00[_0xe927('0x1a')]()]+']',_0x321f55[_0xe927('0x23')]);_0x3bd592(_0x321f55);});});};}function searchContact(_0xeed5c9,_0x5c921d,_0x5b3009,_0x129370){return new Promise(function(_0x1375cd,_0x3af2fb){var _0x3169eb={'method':_0xe927('0xd'),'headers':_0x5c921d,'uri':_0xeed5c9+'/api/lookup?q='+_0x129370+'&f='+_0x5b3009+_0xe927('0x24'),'json':!![]};rp(_0x3169eb)[_0xe927('0x10')](function(_0x5af4a4){var _0x64458d=_[_0xe927('0x25')](_0x5af4a4[_0xe927('0x26')][_0xe927('0x26')],[_0x5b3009,_0x129370]);_0x1375cd(_0x64458d);})[_0xe927('0x22')](function(_0x35abae){_0x3af2fb(_0x35abae);});});}function getEndUser(_0x452c6a,_0x9cc465,_0x18af4c){return function(_0x2626db){return new Promise(function(_0x424ae6,_0x271141){logger['info'](util[_0xe927('0x27')](_0xe927('0x28'),_0x2626db[_0xe927('0x29')]));searchContact(_0x18af4c,_0x9cc465,_0xe927('0x2a'),_0x2626db[_0xe927('0x29')])[_0xe927('0x10')](function(_0x4e76af){if(_0x4e76af){_0x2626db[_0xe927('0x2b')]=_0x4e76af['id'];logger[_0xe927('0x16')](_0xe927('0x2c'),_0x2626db[_0xe927('0x2b')]);return _0x424ae6(_0x2626db);}searchContact(_0x18af4c,_0x9cc465,_0xe927('0x2d'),_0x2626db[_0xe927('0x29')])[_0xe927('0x10')](function(_0x4d7a7d){if(_0x4d7a7d){_0x2626db[_0xe927('0x2b')]=_0x4d7a7d['id'];logger[_0xe927('0x16')](_0xe927('0x2e'),_0x2626db[_0xe927('0x2b')]);return _0x424ae6(_0x2626db);}createEndUser(_0x2626db,_0x452c6a,_0x9cc465,_0x18af4c)[_0xe927('0x10')](function(_0x34327c){logger[_0xe927('0x16')](_0xe927('0x2f'),_0x34327c['endUserId']);return _0x424ae6(_0x34327c);});});})[_0xe927('0x22')](function(_0x5f4391){_0x271141(_0x5f4391);});});};}function createEndUser(_0x3b60fa,_0x6b50d4,_0x215cfd,_0xc9c938){return new Promise(function(_0x3b461d,_0x369e8f){var _0x48b949=moment();var _0x3ac26c={'method':'POST','uri':_0xc9c938+_0xe927('0x30'),'body':{'contact':{'last_name':_0x3b60fa['contactNumber'],'work_number':_0x3b60fa['contactNumber'],'mobile_number':_0x3b60fa['contactNumber'],'owner_id':_0x3b60fa[_0xe927('0x21')],'created_at':_0x48b949[_0xe927('0x27')](_0xe927('0x31'))}},'json':!![]};_0x3ac26c[_0xe927('0xf')]=_0x215cfd;logger[_0xe927('0x16')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x3ac26c)[_0xe927('0x10')](function(_0x12baed){_0x3b60fa[_0xe927('0x2b')]=_0x12baed['contact']['id'];_0x3b461d(_0x3b60fa);})['catch'](function(_0x40985e){logger[_0xe927('0x19')]('['+[_0x6b50d4['toUpperCase']()]+']',_0x40985e[_0xe927('0x23')]);_0x369e8f(_0x40985e[_0xe927('0x23')]);});});}function getTicket(_0x5d52cb,_0x5c9769,_0xae99ae,_0xfdc6c1,_0x597b66){return function(_0xc6621b){logger['info'](_0xe927('0x32'));return new Promise(function(_0x16a99d,_0x38834a){var _0x16b2ae=moment();var _0xd94dce={'method':_0xe927('0x33'),'uri':_0xae99ae+_0xe927('0x34'),'body':{'title':intUtil[_0xe927('0x35')](_0xfdc6c1['Subjects'],_0x597b66,'\x20'),'description':intUtil[_0xe927('0x35')](_0xfdc6c1[_0xe927('0x36')],_0x597b66,'\x0a'),'owner_id':_0xc6621b[_0xe927('0x21')],'creater_id':_0xc6621b['adminId'],'targetable_id':_0xc6621b['endUserId'],'targetable_type':_0xe927('0x37'),'created_at':_0x16b2ae[_0xe927('0x27')](_0xe927('0x31')),'due_date':_0x16b2ae[_0xe927('0x38')](0x1e,'m')[_0xe927('0x27')](_0xe927('0x31'))},'json':!![]};_0xd94dce[_0xe927('0xf')]=_0x5c9769;return rp(_0xd94dce)['then'](function(_0x3328d5){_0xc6621b['ticketId']=_0x3328d5[_0xe927('0x39')]['id'];logger[_0xe927('0x16')](_0xe927('0x3a'),_0xc6621b[_0xe927('0x3b')]);_0x16a99d(_0xc6621b);})['catch'](function(_0x37e147){logger[_0xe927('0x19')]('['+[_0x5d52cb[_0xe927('0x1a')]()]+']',_0x37e147[_0xe927('0x23')]);_0x38834a(_0x37e147[_0xe927('0x23')]);});});};}function emit(_0x17dfd9,_0x320e57,_0x1c7575){var _0x5d9f9a={'uri':_0x17dfd9+_0xe927('0x3c')+_0x1c7575};io['to'](util[_0xe927('0x27')]('user:%s',_0x320e57))[_0xe927('0x3d')](_0xe927('0x3e'),_0x5d9f9a);}exports['cs']=function(_0x598c92,_0x2cceaa,_0x20e960,_0x424aa3,_0x13d63b,_0x22dbef,_0x4dd99c,_0x3ec94e){var _0x1dcc9e={};var _0x1e0094={'Authorization':_0xe927('0x3f')+_0x22dbef['apiKey']};_0x22dbef[_0xe927('0x40')]=intUtil['stripTrailingSlash'](_0x22dbef[_0xe927('0x40')]);_0x22dbef[_0xe927('0x41')]=intUtil[_0xe927('0x42')](_0x22dbef[_0xe927('0x41')]);var _0xc03117=_0x22dbef[_0xe927('0x40')];_0x1dcc9e[_0xe927('0x14')]=_0x22dbef[_0xe927('0x43')];_0x1dcc9e['contactNumber']=_0x3ec94e[_0xe927('0x44')]()===_0xe927('0x45')?_0x2cceaa[_0xe927('0x46')]:_0x2cceaa[_0xe927('0x47')];_0x1dcc9e['callDirection']=_0x3ec94e===_0xe927('0x48')||_0x3ec94e===_0xe927('0x49')?'queue':_0xe927('0x45');if(_0x424aa3){_0x1dcc9e[_0xe927('0x1c')]=_0x424aa3['email'];}var _0x155759=util[_0xe927('0x27')](_0xe927('0x4a'),_0x22dbef[_0xe927('0x41')],_0x2cceaa['uniqueid'],md5(_0x2cceaa[_0xe927('0x4b')]));if(_0x13d63b&&_0x13d63b['monitor_format']){logger[_0xe927('0x16')](_0xe927('0x4c'),_0xe927('0x4d'));_0x2cceaa[_0xe927('0x4e')]=_0x155759;}else if(_0x4dd99c&&_0x4dd99c[_0xe927('0x4f')]&&_0x4dd99c[_0xe927('0x4f')]!=='none'){logger['info'](_0xe927('0x50'),_0xe927('0x4d'));_0x2cceaa['recordingURL']=_0x155759;}else{_0x2cceaa[_0xe927('0x4e')]='';}return getAdminId(_0x1dcc9e,_0x3ec94e,_0x1e0094,_0xc03117)['then'](getUser(_0x3ec94e,_0x1e0094,_0xc03117))[_0xe927('0x10')](getEndUser(_0x3ec94e,_0x1e0094,_0xc03117))[_0xe927('0x10')](getTicket(_0x3ec94e,_0x1e0094,_0xc03117,_0x20e960,_0x2cceaa))[_0xe927('0x10')](function(_0x5d992d){logger[_0xe927('0x16')](util[_0xe927('0x27')](_0xe927('0x51'),_0x5d992d[_0xe927('0x3b')]));if(_0x3ec94e!==_0xe927('0x49')){logger[_0xe927('0x16')]('['+[_0x3ec94e[_0xe927('0x1a')]()]+']',_0xe927('0x52'));emit(_0xc03117,_0x424aa3['name'],_0x5d992d['endUserId']);}})[_0xe927('0x22')](function(_0x1b6ae2){logger[_0xe927('0x19')]('['+[_0x3ec94e['toUpperCase']()]+_0xe927('0x53'),util[_0xe927('0x54')](_0x1b6ae2,{'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 65ed29f..8533cf9 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 _0x2aa8=['format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','[EXEC]','lodash','./zendesk','./salesforce','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk'];(function(_0x5c29a1,_0x4a3659){var _0x8eed14=function(_0x58709c){while(--_0x58709c){_0x5c29a1['push'](_0x5c29a1['shift']());}};_0x8eed14(++_0x4a3659);}(_0x2aa8,0x1c1));var _0x82aa=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2aa8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x82aa('0x0'));var util=require('util');var zendesk=require(_0x82aa('0x1'));var salesforce=require(_0x82aa('0x2'));var sugarcrm=require(_0x82aa('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x82aa('0x4'));var desk=require(_0x82aa('0x5'));var vtiger=require(_0x82aa('0x6'));var servicenow=require(_0x82aa('0x7'));var dynamics365=require(_0x82aa('0x8'));var freshsales=require('./freshsales');var integrations=[_0x82aa('0x9'),_0x82aa('0xa'),_0x82aa('0xb'),_0x82aa('0xc'),_0x82aa('0xd'),'desk',_0x82aa('0xe'),_0x82aa('0xf'),'freshsales',_0x82aa('0x10')];exports[_0x82aa('0x11')]=function(_0x2a9df7,_0x4de1ef,_0x5f0c58,_0x302c95,_0x30de1c,_0x40f981){if(_0x5f0c58){if(_[_0x82aa('0x12')](integrations,_0x2a9df7[_0x82aa('0x13')][_0x82aa('0x14')]())){try{var _0x30506b=null;var _0x275f90='';var _0x2a2bc4=_0x5f0c58[_0x2a9df7[_0x82aa('0x13')][_0x82aa('0x14')]()];if(_0x2a2bc4){var _0x3232f1=_0x2a2bc4[_0x2a9df7[_0x82aa('0x15')]];if(_0x3232f1){var _0x338c14=_[_0x82aa('0x16')](_0x3232f1[_0x82aa('0x17')],{'id':parseInt(_0x2a9df7[_0x82aa('0x18')],0xa)});if(_0x338c14){if(_0x302c95){if(_0x30de1c&&_0x4de1ef[_0x82aa('0x19')]){_0x275f90='queue';}else if(_0x4de1ef[_0x82aa('0x1a')]){_0x275f90=_0x82aa('0x1b');}else{console[_0x82aa('0x1c')](_0x82aa('0x1d'),_0x4de1ef);}}else{_0x275f90=_0x82aa('0x1e');}switch(_0x2a9df7[_0x82aa('0x13')]['toLowerCase']()){case _0x82aa('0x9'):zendesk[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case _0x82aa('0xa'):salesforce[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case _0x82aa('0xb'):sugarcrm[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case _0x82aa('0xc'):freshdesk[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case'zoho':zoho[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case _0x82aa('0x1f'):desk[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case _0x82aa('0xe'):vtiger[_0x275f90](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981);break;case'freshsales':freshsales['cs'](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981,_0x275f90);break;case _0x82aa('0x10'):servicenow['cs'](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981,_0x275f90);break;case _0x82aa('0xf'):dynamics365['cs'](_0x2a9df7,_0x4de1ef,_0x338c14,_0x302c95,_0x30de1c,_0x3232f1,_0x40f981,_0x275f90);break;default:console['log']('unknown\x20integration');}}else{_0x30506b=require('../../../../config/logger')(_0x2a9df7['data1']['toLowerCase']());_0x30506b['error']('[EXEC]',util[_0x82aa('0x20')](_0x82aa('0x21'),_0x2a9df7['data1'][_0x82aa('0x14')](),_0x2a9df7[_0x82aa('0x18')]));}}else{_0x30506b=require(_0x82aa('0x22'))(_0x2a9df7[_0x82aa('0x13')]['toLowerCase']());_0x30506b[_0x82aa('0x23')](_0x82aa('0x24'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x2a9df7['data1']['toLowerCase'](),_0x2a9df7['data2']));}}else{}}catch(_0x191282){console['error'](_0x191282);}}}}; \ No newline at end of file +var _0xc16f=['find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','sugarcrm','vtiger','freshsales','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','servicenow','includes','data1','data2'];(function(_0x3717fc,_0x1c5cb0){var _0x3de354=function(_0x59232a){while(--_0x59232a){_0x3717fc['push'](_0x3717fc['shift']());}};_0x3de354(++_0x1c5cb0);}(_0xc16f,0x183));var _0xfc16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc16f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfc16('0x0'));var util=require(_0xfc16('0x1'));var zendesk=require(_0xfc16('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xfc16('0x3'));var freshdesk=require(_0xfc16('0x4'));var zoho=require(_0xfc16('0x5'));var desk=require('./desk');var vtiger=require(_0xfc16('0x6'));var servicenow=require(_0xfc16('0x7'));var dynamics365=require(_0xfc16('0x8'));var freshsales=require(_0xfc16('0x9'));var integrations=[_0xfc16('0xa'),_0xfc16('0xb'),'sugarcrm',_0xfc16('0xc'),_0xfc16('0xd'),_0xfc16('0xe'),'vtiger',_0xfc16('0xf'),'freshsales',_0xfc16('0x10')];exports['exec']=function(_0x217843,_0x1df11c,_0x630802,_0x35dbb5,_0x4a89da,_0x4d5c20){if(_0x630802){if(_[_0xfc16('0x11')](integrations,_0x217843['data1']['toLowerCase']())){try{var _0x18d99d=null;var _0x1fe346='';var _0x461c90=_0x630802[_0x217843[_0xfc16('0x12')]['toLowerCase']()];if(_0x461c90){var _0xb530e0=_0x461c90[_0x217843[_0xfc16('0x13')]];if(_0xb530e0){var _0x35e3ee=_[_0xfc16('0x14')](_0xb530e0[_0xfc16('0x15')],{'id':parseInt(_0x217843[_0xfc16('0x16')],0xa)});if(_0x35e3ee){if(_0x35dbb5){if(_0x4a89da&&_0x1df11c[_0xfc16('0x17')]){_0x1fe346='queue';}else if(_0x1df11c[_0xfc16('0x18')]){_0x1fe346='outbound';}else{console[_0xfc16('0x19')](_0xfc16('0x1a'),_0x1df11c);}}else{_0x1fe346=_0xfc16('0x1b');}switch(_0x217843['data1'][_0xfc16('0x1c')]()){case _0xfc16('0xa'):zendesk[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0xb'):salesforce[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0x1d'):sugarcrm[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0xc'):freshdesk[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0xd'):zoho[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0xe'):desk[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0x1e'):vtiger[_0x1fe346](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20);break;case _0xfc16('0x1f'):freshsales['cs'](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20,_0x1fe346);break;case _0xfc16('0x10'):servicenow['cs'](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20,_0x1fe346);break;case _0xfc16('0xf'):dynamics365['cs'](_0x217843,_0x1df11c,_0x35e3ee,_0x35dbb5,_0x4a89da,_0xb530e0,_0x4d5c20,_0x1fe346);break;default:console[_0xfc16('0x19')]('unknown\x20integration');}}else{_0x18d99d=require(_0xfc16('0x20'))(_0x217843[_0xfc16('0x12')][_0xfc16('0x1c')]());_0x18d99d[_0xfc16('0x21')]('[EXEC]',util[_0xfc16('0x22')](_0xfc16('0x23'),_0x217843['data1'][_0xfc16('0x1c')](),_0x217843['data3']));}}else{_0x18d99d=require(_0xfc16('0x20'))(_0x217843['data1'][_0xfc16('0x1c')]());_0x18d99d[_0xfc16('0x21')]('[EXEC]',util[_0xfc16('0x22')](_0xfc16('0x24'),_0x217843['data1'][_0xfc16('0x1c')](),_0x217843[_0xfc16('0x13')]));}}else{}}catch(_0x45897d){console[_0xfc16('0x21')](_0x45897d);}}}}; \ 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 530f10a..f5d2956 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 _0x8616=['login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','calleridname','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','newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','recordingURL',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhatId','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','Name','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','concat','securityToken','remoteUri','https://login.salesforce.com','clientSecret'];(function(_0x49c9f2,_0x1c64e7){var _0x235126=function(_0x577d99){while(--_0x577d99){_0x49c9f2['push'](_0x49c9f2['shift']());}};_0x235126(++_0x1c64e7);}(_0x8616,0x1a4));var _0x6861=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x8616[_0x2c27ed];return _0x597bd1;};'use strict';var _=require('lodash');var rp=require(_0x6861('0x0'));var moment=require(_0x6861('0x1'));var BPromise=require(_0x6861('0x2'));var md5=require('md5');var jsforce=require(_0x6861('0x3'));var util=require('util');var Redis=require(_0x6861('0x4'));var intUtil=require(_0x6861('0x5'));var config=require(_0x6861('0x6'));var logger=require(_0x6861('0x7'))('salesforce');config[_0x6861('0x8')]=_[_0x6861('0x9')](config['redis'],{'host':_0x6861('0xa'),'port':0x18eb});var io=require(_0x6861('0xb'))(new Redis(config['redis']));function emit(_0x5b6f3b,_0x5e31b6,_0x2467c0){io['to'](_0x5b6f3b)[_0x6861('0xc')](_0x5e31b6,_0x2467c0);}function getTicket(_0x7ebe69,_0x5ec320,_0xb57401,_0x4a64c1,_0x3b56d9,_0x3f90db,_0x3a666a,_0x3c30b2){var _0x58d25c=Object[_0x6861('0xd')]({},{'OwnerId':_0x5ec320['id'],'Subject':intUtil[_0x6861('0xe')](_0x4a64c1['Subjects'],_0x3b56d9,'\x20'),'Description':intUtil[_0x6861('0xe')](_0x4a64c1[_0x6861('0xf')],_0x3b56d9,'\x0a')},getCustomFields(_0x3f90db,_0x3b56d9));if(_0xb57401){if(_0x4a64c1[_0x6861('0x10')]==='Task'){_0x58d25c[_0x6861('0x11')]=moment['utc']();_0x58d25c[_0x6861('0x12')]=![];_0x58d25c[_0x6861('0x13')]=![];if(_0xb57401[_0x6861('0x14')]===_0x6861('0x15')||_0xb57401[_0x6861('0x14')]===_0x6861('0x16')){_0x58d25c['WhoId']=_0xb57401['id'];}else if(_0xb57401[_0x6861('0x14')]==='account'){_0x58d25c[_0x6861('0x17')]=_0xb57401['id'];}}else if(_0x4a64c1[_0x6861('0x10')]==='Case'){if(_0xb57401[_0x6861('0x14')]==='contact'){_0x58d25c[_0x6861('0x18')]=_0xb57401['id'];}else if(_0xb57401[_0x6861('0x14')]===_0x6861('0x19')){_0x58d25c[_0x6861('0x1a')]=_0xb57401['id'];}else if(_0xb57401[_0x6861('0x14')]===_0x6861('0x16')&&_0x4a64c1[_0x6861('0x1b')]){_0x58d25c[_0x4a64c1[_0x6861('0x1b')]]=_0xb57401['id'];}else{logger[_0x6861('0x1c')](_0x6861('0x1d'));}}}return _0x3a666a[_0x6861('0x1e')](_0x4a64c1['ticketType'])[_0x6861('0x1f')](_0x58d25c);}function getUser(_0x56b837,_0xa6a94c,_0xeecc9f){if(!_['isNil'](_0xa6a94c)&&intUtil[_0x6861('0x20')](_0xa6a94c)){var _0x9d6fef={'Email':_0xa6a94c};var _0x171f47={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xeecc9f[_0x6861('0x1e')]('User')[_0x6861('0x21')](_0x9d6fef,_0x171f47)[_0x6861('0x22')]()[_0x6861('0x23')](function(_0xd100d){if(_0xd100d[_0x6861('0x24')]){var _0x31cfcd=_[_0x6861('0x21')](_0xd100d,function(_0x20bbda){return _0x20bbda['Email']===_0xa6a94c;});if(_0x31cfcd){logger[_0x6861('0x1c')](_0x6861('0x25'),_0xa6a94c);return BPromise[_0x6861('0x26')]({'id':_0x31cfcd['Id'],'name':_0x31cfcd['Name']});}}else{logger['info'](_0x6861('0x27'),_0xa6a94c);return _0xeecc9f[_0x6861('0x28')]()[_0x6861('0x23')](function(_0xce5951){return BPromise[_0x6861('0x26')]({'id':_0xce5951[_0x6861('0x29')],'name':_0xce5951[_0x6861('0x2a')]});});}});}else{logger[_0x6861('0x1c')](_0x6861('0x27'),_0xa6a94c);return _0xeecc9f[_0x6861('0x28')]()[_0x6861('0x23')](function(_0x5869de){return BPromise[_0x6861('0x26')]({'id':_0x5869de[_0x6861('0x29')],'name':_0x5869de['display_name']});});}}function getEndUser(_0x482711,_0x56229f,_0x213aba,_0x5177c7,_0x160a52){var _0x11ea41={'$or':{'Phone':_0x5177c7}};var _0x3102b5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6861('0x26')]()[_0x6861('0x23')](function(){logger['info'](_0x6861('0x2b'),_0x5177c7,_0x56229f[_0x6861('0x2c')]);switch(_0x56229f[_0x6861('0x2c')]){case _0x6861('0x2d'):var _0xc81a65=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x2f')]){var _0xc8ad2d={};_0xc8ad2d[_0x56229f[_0x6861('0x2f')]]=_0x5177c7;_['merge'](_0xc81a65[_0x6861('0x30')],_0xc8ad2d);}return _0x160a52[_0x6861('0x1e')](_0x6861('0x31'))[_0x6861('0x21')](_0xc81a65,_0x3102b5)[_0x6861('0x22')]()['then'](function(_0x2f2941){if(_0x2f2941&&_0x2f2941[_0x6861('0x24')]){return _0x2f2941;}else{var _0x5dc917=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f['additionalSearchLead']){var _0x49f298={};_0x49f298[_0x56229f[_0x6861('0x32')]]=_0x5177c7;_[_0x6861('0x33')](_0x5dc917[_0x6861('0x30')],_0x49f298);}return _0x160a52['sobject'](_0x6861('0x34'))[_0x6861('0x21')](_0x5dc917,_0x3102b5);}});case _0x6861('0x35'):var _0x278628=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x36')]){var _0xc8ad2d={};_0xc8ad2d[_0x56229f[_0x6861('0x36')]]=_0x5177c7;_[_0x6861('0x33')](_0x278628[_0x6861('0x30')],_0xc8ad2d);}return _0x160a52['sobject']('Account')[_0x6861('0x21')](_0x278628,_0x3102b5)[_0x6861('0x22')]()[_0x6861('0x23')](function(_0x49b5eb){if(_0x49b5eb&&_0x49b5eb[_0x6861('0x24')]){return _0x49b5eb;}else{var _0x30f033=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x2f')]){var _0x3be67b={};_0x3be67b[_0x56229f['additionalSearchContact']]=_0x5177c7;_[_0x6861('0x33')](_0x30f033['$or'],_0x3be67b);}return _0x160a52[_0x6861('0x1e')](_0x6861('0x31'))[_0x6861('0x21')](_0x30f033,_0x3102b5)[_0x6861('0x23')](function(_0x419c64){if(_0x419c64&&_0x419c64[_0x6861('0x24')]){return _0x419c64;}else{var _0x15836a=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x32')]){var _0x27eb58={};_0x27eb58[_0x56229f['additionalSearchLead']]=_0x5177c7;_[_0x6861('0x33')](_0x15836a['$or'],_0x27eb58);}return _0x160a52[_0x6861('0x1e')](_0x6861('0x34'))[_0x6861('0x21')](_0x15836a,_0x3102b5);}});}});case _0x6861('0x15'):var _0xc81a65=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x2f')]){var _0xc8ad2d={};_0xc8ad2d[_0x56229f[_0x6861('0x2f')]]=_0x5177c7;_[_0x6861('0x33')](_0xc81a65['$or'],_0xc8ad2d);}return _0x160a52[_0x6861('0x1e')]('Contact')[_0x6861('0x21')](_0xc81a65,_0x3102b5)['execute']();case _0x6861('0x16'):var _0x2c2d4b=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x32')]){var _0xc8ad2d={};_0xc8ad2d[_0x56229f[_0x6861('0x32')]]=_0x5177c7;_[_0x6861('0x33')](_0x2c2d4b['$or'],_0xc8ad2d);}return _0x160a52['sobject'](_0x6861('0x34'))['find'](_0x2c2d4b,_0x3102b5);case _0x6861('0x19'):var _0x278628=_[_0x6861('0x2e')](_0x11ea41);if(_0x56229f[_0x6861('0x36')]){var _0xc8ad2d={};_0xc8ad2d[_0x56229f[_0x6861('0x36')]]=_0x5177c7;_[_0x6861('0x33')](_0x278628[_0x6861('0x30')],_0xc8ad2d);}return _0x160a52[_0x6861('0x1e')](_0x6861('0x37'))[_0x6861('0x21')](_0x278628,_0x3102b5);default:return null;}})[_0x6861('0x23')](function(_0x3c3bd8){if(_0x3c3bd8&&_0x3c3bd8[_0x6861('0x24')]){var _0x5ec424=_['first'](_0x3c3bd8);if(_0x5ec424){return BPromise[_0x6861('0x26')]({'id':_0x5ec424['Id'],'name':_0x5ec424[_0x6861('0x38')],'phone':_0x5ec424[_0x6861('0x39')],'endUserType':_0x5ec424[_0x6861('0x3a')]['type']['toLowerCase']()});}}})[_0x6861('0x23')](function(_0x1a57e8){if(_0x1a57e8){logger[_0x6861('0x1c')](_0x6861('0x3b'),_0x1a57e8[_0x6861('0x14')],_0x5177c7);return BPromise['resolve'](_0x1a57e8);}else{logger[_0x6861('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x5177c7);var _0x29252c={'Phone':_0x5177c7};if(_0x56229f[_0x6861('0x3c')]){if(_0x56229f[_0x6861('0x3c')]===_0x6861('0x15')){logger[_0x6861('0x1c')](_0x6861('0x3d'),_0x5177c7,_0x56229f[_0x6861('0x3c')]);_0x29252c[_0x6861('0x3e')]=_0x213aba!==''?_0x213aba:util[_0x6861('0x3f')](_0x6861('0x40'),_0x5177c7);}else if(_0x56229f[_0x6861('0x3c')]==='lead'){logger[_0x6861('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5177c7,_0x56229f[_0x6861('0x3c')]);_0x29252c[_0x6861('0x3e')]=_0x213aba!==_0x6861('0x41')?_0x213aba:util[_0x6861('0x3f')](_0x6861('0x40'),_0x5177c7);_0x29252c[_0x6861('0x42')]=_0x6861('0x43');}else if(_0x56229f['moduleCreate']===_0x6861('0x19')){logger['info'](_0x6861('0x3d'),_0x5177c7,_0x56229f['moduleCreate']);_0x29252c[_0x6861('0x38')]=_0x213aba!==_0x6861('0x41')?_0x213aba:util[_0x6861('0x3f')](_0x6861('0x40'),_0x5177c7);}else{return null;}}return _0x160a52[_0x6861('0x1e')](_[_0x6861('0x44')](_0x56229f[_0x6861('0x3c')]))[_0x6861('0x1f')](_0x29252c)[_0x6861('0x23')](function(_0x31a87c){return BPromise[_0x6861('0x26')]({'id':_0x31a87c['id'],'endUserType':_0x56229f[_0x6861('0x3c')]});});}});}function getCustomFields(_0x1bcc82,_0x164427){var _0x89e1d4={};if(_0x1bcc82[_0x6861('0x24')]>0x0){_[_0x6861('0x45')](_0x1bcc82,function(_0x213912){if(_[_0x6861('0x46')]([_0x6861('0x47'),_0x6861('0x48')],_0x213912[_0x6861('0x49')])&&_0x213912[_0x6861('0x4a')]){_0x89e1d4[_0x213912['idField']]=_0x213912[_0x6861('0x4b')]['toString']();}else if(_0x213912[_0x6861('0x49')]===_0x6861('0x4c')&&_0x213912['variableName']&&_0x213912['idField']){_0x164427[_0x213912[_0x6861('0x4d')]]&&(_0x89e1d4[_0x213912['idField']]=_0x164427[_0x213912[_0x6861('0x4d')]][_0x6861('0x4e')]());}else if(_0x213912[_0x6861('0x49')]===_0x6861('0x4f')&&_0x213912['Variable']&&_0x213912[_0x6861('0x50')][_0x6861('0x51')]&&_0x213912[_0x6861('0x4a')]){_0x164427[_0x213912['Variable'][_0x6861('0x51')][_0x6861('0x52')]()]&&(_0x89e1d4[_0x213912[_0x6861('0x4a')]]=_0x164427[_0x213912[_0x6861('0x50')][_0x6861('0x51')]['toLowerCase']()][_0x6861('0x4e')]());}});}return _0x89e1d4;}function getConnection(_0x3d8e61){var _0x241629=_0x3d8e61['password'][_0x6861('0x53')](_0x3d8e61[_0x6861('0x54')]);var _0x515e74=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3d8e61[_0x6861('0x55')]||_0x6861('0x56'),'clientId':_0x3d8e61['clientId'],'clientSecret':_0x3d8e61[_0x6861('0x57')]}});return _0x515e74[_0x6861('0x58')](_0x3d8e61[_0x6861('0x59')],_0x241629)[_0x6861('0x23')](function(){logger[_0x6861('0x1c')](_0x6861('0x5a'));return _0x515e74;});}exports[_0x6861('0x5b')]=function(_0x115159,_0x320331,_0x5cdaf6,_0x5bb8ca,_0x16a1a1,_0x233b30){var _0x2fb44c,_0x336968,_0x5ab347,_0x508087;_0x233b30[_0x6861('0x5c')]=intUtil[_0x6861('0x5d')](_0x233b30[_0x6861('0x5c')]);_0x233b30['remoteUri']=intUtil[_0x6861('0x5d')](_0x233b30[_0x6861('0x55')]);if(_0x16a1a1&&_0x16a1a1[_0x6861('0x5e')]){logger[_0x6861('0x1c')](_0x6861('0x5f'),_0x6861('0x60'));_0x320331['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x233b30[_0x6861('0x5c')],_0x320331[_0x6861('0x61')],md5(_0x320331[_0x6861('0x61')]));}else{_0x320331['recordingURL']='';}return getConnection(_0x233b30)[_0x6861('0x23')](function(_0x256e84){_0x508087=_0x256e84;return getUser(_0x233b30,_0x5bb8ca['email'],_0x508087);})[_0x6861('0x23')](function(_0x543b21){_0x2fb44c=_0x543b21;return getEndUser(_0x233b30,_0x5cdaf6,_0x320331[_0x6861('0x62')],_0x320331[_0x6861('0x63')],_0x508087);})['then'](function(_0x355bd7){_0x336968=_0x355bd7;return getTicket(_0x233b30,_0x2fb44c,_0x336968,_0x5cdaf6,_0x320331,_0x5cdaf6[_0x6861('0x64')],_0x508087,_0x6861('0x5b'));})[_0x6861('0x23')](function(_0x39520b){_0x5ab347=_0x39520b;logger[_0x6861('0x1c')](_0x6861('0x65'),_0x5ab347['id']);logger[_0x6861('0x1c')](_0x6861('0x66'),_0x5ab347['id'],_0x5bb8ca['name'],_0x233b30[_0x6861('0x49')]);switch(_0x233b30[_0x6861('0x49')]){case _0x6861('0x67'):emit(util[_0x6861('0x3f')](_0x6861('0x68'),_0x5bb8ca[_0x6861('0x51')]),_0x6861('0x69'),{'recordId':_0x5ab347['id']});break;case _0x6861('0x6a'):emit(util[_0x6861('0x3f')](_0x6861('0x68'),_0x5bb8ca[_0x6861('0x51')]),_0x6861('0x6b'),{'uri':util[_0x6861('0x3f')](_0x6861('0x6c'),_0x508087[_0x6861('0x6d')],_0x5ab347['id'])});break;default:logger['error'](_0x6861('0x6e'));}})[_0x6861('0x6f')](function(_0x5b2b86){logger['error']('[QUEUE]',_0x5b2b86);});};exports[_0x6861('0x70')]=function(_0x234e9e,_0xf6a61d,_0x344487,_0x31e257,_0x27b064,_0x1d3a5a,_0x699e14){var _0x318317,_0x203294,_0x398ee2,_0x24551c;_0x1d3a5a[_0x6861('0x5c')]=intUtil[_0x6861('0x5d')](_0x1d3a5a[_0x6861('0x5c')]);_0x1d3a5a[_0x6861('0x55')]=intUtil[_0x6861('0x5d')](_0x1d3a5a[_0x6861('0x55')]);if(_0x699e14&&_0x699e14['recordingFormat']&&_0x699e14[_0x6861('0x71')]!=='none'){logger[_0x6861('0x1c')](_0x6861('0x72'),_0x6861('0x60'));_0xf6a61d['recordingURL']=util[_0x6861('0x3f')](_0x6861('0x73'),_0x1d3a5a[_0x6861('0x5c')],_0xf6a61d[_0x6861('0x61')],md5(_0xf6a61d[_0x6861('0x61')]));}return getConnection(_0x1d3a5a)[_0x6861('0x23')](function(_0xf76211){_0x24551c=_0xf76211;return getUser(_0x1d3a5a,_0x31e257['email'],_0x24551c);})[_0x6861('0x23')](function(_0x5dee3d){_0x318317=_0x5dee3d;return getEndUser(_0x1d3a5a,_0x344487,_0xf6a61d[_0x6861('0x74')],_0xf6a61d[_0x6861('0x75')],_0x24551c);})[_0x6861('0x23')](function(_0x5bfe69){_0x203294=_0x5bfe69;return getTicket(_0x1d3a5a,_0x318317,_0x203294,_0x344487,_0xf6a61d,_0x344487[_0x6861('0x64')],_0x24551c,_0x6861('0x70'));})[_0x6861('0x23')](function(_0x2ea3b8){_0x398ee2=_0x2ea3b8;logger['info'](_0x6861('0x76'),_0x398ee2['id']);logger['info'](_0x6861('0x77'),_0x398ee2['id'],_0x31e257[_0x6861('0x51')],_0x1d3a5a[_0x6861('0x49')]);switch(_0x1d3a5a[_0x6861('0x49')]){case _0x6861('0x67'):emit(util[_0x6861('0x3f')](_0x6861('0x68'),_0x31e257[_0x6861('0x51')]),'trigger:salesforce:display',{'recordId':_0x398ee2['id']});break;case'newTab':emit(util[_0x6861('0x3f')](_0x6861('0x68'),_0x31e257[_0x6861('0x51')]),_0x6861('0x6b'),{'uri':util['format'](_0x6861('0x6c'),_0x24551c['instanceUrl'],_0x398ee2['id'])});break;default:logger[_0x6861('0x78')](_0x6861('0x72'),_0x6861('0x79'));}})[_0x6861('0x6f')](function(_0x3e196e){logger['error'](_0x6861('0x72'),_0x3e196e);});};exports['unmanaged']=function(_0x52429b,_0x3803e0,_0x585dc0,_0x1301c3,_0x542be2,_0x324c60){var _0x5d1f1e,_0x265650,_0x5ba626,_0x4e6aa2;_0x324c60[_0x6861('0x5c')]=intUtil[_0x6861('0x5d')](_0x324c60['serverUrl']);_0x324c60[_0x6861('0x55')]=intUtil[_0x6861('0x5d')](_0x324c60[_0x6861('0x55')]);if(_0x542be2&&_0x542be2['monitor_format']){logger[_0x6861('0x1c')]('['+_0x3803e0[_0x6861('0x7a')][_0x6861('0x7b')]()+']',_0x6861('0x60'));_0x3803e0[_0x6861('0x7c')]=util[_0x6861('0x3f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x324c60['serverUrl'],_0x3803e0['uniqueid'],md5(_0x3803e0['uniqueid']));}else{_0x3803e0[_0x6861('0x7c')]='';}return getConnection(_0x324c60)[_0x6861('0x23')](function(_0x2c4c13){_0x4e6aa2=_0x2c4c13;if(!_['isNil'](_0x1301c3)){return getUser(_0x324c60,_0x1301c3[_0x6861('0x51')],_0x4e6aa2);}else{return getUser(_0x324c60,null,_0x4e6aa2);}})['then'](function(_0x396db0){_0x5d1f1e=_0x396db0;return getEndUser(_0x324c60,_0x585dc0,_0x3803e0['calleridname'],_0x3803e0['calleridnum'],_0x4e6aa2);})[_0x6861('0x23')](function(_0x40c666){_0x265650=_0x40c666;return getTicket(_0x324c60,_0x5d1f1e,_0x265650,_0x585dc0,_0x3803e0,_0x585dc0['Fields'],_0x4e6aa2);})[_0x6861('0x23')](function(_0x3e3a15){_0x5ba626=_0x3e3a15;logger['info']('['+_0x3803e0[_0x6861('0x7a')][_0x6861('0x7b')]()+_0x6861('0x7d'),_0x5ba626['id']);logger[_0x6861('0x1c')]('['+_0x3803e0[_0x6861('0x7a')][_0x6861('0x7b')]()+_0x6861('0x7e'),_0x324c60[_0x6861('0x49')]);})[_0x6861('0x6f')](function(_0x4a0fe2){logger[_0x6861('0x78')]('['+_0x3803e0[_0x6861('0x7a')]['toUpperCase']()+']',_0x4a0fe2);});}; \ No newline at end of file +var _0x139e=['Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','WhoId','endUserType','account','WhatId','Case','ContactId','AccountId','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','then','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','concat','securityToken','Connection','clientId','clientSecret','login','username','stripTrailingSlash','serverUrl','remoteUri','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','catch','lastevent','recordingURL','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','./util','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString'];(function(_0x51463b,_0x58ddbc){var _0x5d99f1=function(_0x34169c){while(--_0x34169c){_0x51463b['push'](_0x51463b['shift']());}};_0x5d99f1(++_0x58ddbc);}(_0x139e,0x1df));var _0xe139=function(_0x407a54,_0x2b059f){_0x407a54=_0x407a54-0x0;var _0x291c48=_0x139e[_0x407a54];return _0x291c48;};'use strict';var _=require(_0xe139('0x0'));var rp=require('request-promise');var moment=require(_0xe139('0x1'));var BPromise=require('bluebird');var md5=require(_0xe139('0x2'));var jsforce=require(_0xe139('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xe139('0x4'));var config=require('../../../../config/environment');var logger=require(_0xe139('0x5'))(_0xe139('0x6'));config['redis']=_['defaults'](config[_0xe139('0x7')],{'host':_0xe139('0x8'),'port':0x18eb});var io=require(_0xe139('0x9'))(new Redis(config['redis']));function emit(_0x12b25d,_0x3aa9ce,_0x5b8cf0){io['to'](_0x12b25d)[_0xe139('0xa')](_0x3aa9ce,_0x5b8cf0);}function getTicket(_0x5578eb,_0x29bbc1,_0x42fc5d,_0x18f296,_0x49515e,_0x235592,_0x3b1c09,_0x32bef0){var _0x3ea38b=Object[_0xe139('0xb')]({},{'OwnerId':_0x29bbc1['id'],'Subject':intUtil[_0xe139('0xc')](_0x18f296['Subjects'],_0x49515e,'\x20'),'Description':intUtil['getString'](_0x18f296[_0xe139('0xd')],_0x49515e,'\x0a')},getCustomFields(_0x235592,_0x49515e));if(_0x42fc5d){if(_0x18f296[_0xe139('0xe')]===_0xe139('0xf')){_0x3ea38b[_0xe139('0x10')]=moment[_0xe139('0x11')]();_0x3ea38b['IsReminderSet']=![];_0x3ea38b[_0xe139('0x12')]=![];if(_0x42fc5d['endUserType']===_0xe139('0x13')||_0x42fc5d['endUserType']==='lead'){_0x3ea38b[_0xe139('0x14')]=_0x42fc5d['id'];}else if(_0x42fc5d[_0xe139('0x15')]===_0xe139('0x16')){_0x3ea38b[_0xe139('0x17')]=_0x42fc5d['id'];}}else if(_0x18f296[_0xe139('0xe')]===_0xe139('0x18')){if(_0x42fc5d['endUserType']===_0xe139('0x13')){_0x3ea38b[_0xe139('0x19')]=_0x42fc5d['id'];}else if(_0x42fc5d[_0xe139('0x15')]===_0xe139('0x16')){_0x3ea38b[_0xe139('0x1a')]=_0x42fc5d['id'];}else if(_0x42fc5d[_0xe139('0x15')]===_0xe139('0x1b')&&_0x18f296['leadId']){_0x3ea38b[_0x18f296[_0xe139('0x1c')]]=_0x42fc5d['id'];}else{logger['info'](_0xe139('0x1d'));}}}return _0x3b1c09[_0xe139('0x1e')](_0x18f296[_0xe139('0xe')])[_0xe139('0x1f')](_0x3ea38b);}function getUser(_0x194f8e,_0x23f9ad,_0x396916){if(!_[_0xe139('0x20')](_0x23f9ad)&&intUtil[_0xe139('0x21')](_0x23f9ad)){var _0x563bfe={'Email':_0x23f9ad};var _0x18c027={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x396916[_0xe139('0x1e')]('User')[_0xe139('0x22')](_0x563bfe,_0x18c027)[_0xe139('0x23')]()[_0xe139('0x24')](function(_0x4fcc64){if(_0x4fcc64['length']){var _0x269e4b=_[_0xe139('0x22')](_0x4fcc64,function(_0x261181){return _0x261181['Email']===_0x23f9ad;});if(_0x269e4b){logger[_0xe139('0x25')](_0xe139('0x26'),_0x23f9ad);return BPromise[_0xe139('0x27')]({'id':_0x269e4b['Id'],'name':_0x269e4b[_0xe139('0x28')]});}}else{logger[_0xe139('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x23f9ad);return _0x396916[_0xe139('0x29')]()[_0xe139('0x24')](function(_0x11791a){return BPromise[_0xe139('0x27')]({'id':_0x11791a[_0xe139('0x2a')],'name':_0x11791a['display_name']});});}});}else{logger['info'](_0xe139('0x2b'),_0x23f9ad);return _0x396916[_0xe139('0x29')]()['then'](function(_0x28f15c){return BPromise[_0xe139('0x27')]({'id':_0x28f15c['user_id'],'name':_0x28f15c[_0xe139('0x2c')]});});}}function getEndUser(_0x5d1d8d,_0x3b78cb,_0x1e5675,_0x36ec0c,_0x54ed72){var _0x5a09b2={'$or':{'Phone':_0x36ec0c}};var _0x143254={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe139('0x24')](function(){logger[_0xe139('0x25')](_0xe139('0x2d'),_0x36ec0c,_0x3b78cb['moduleSearch']);switch(_0x3b78cb[_0xe139('0x2e')]){case _0xe139('0x2f'):var _0x5c1c5e=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb[_0xe139('0x31')]){var _0x440eef={};_0x440eef[_0x3b78cb[_0xe139('0x31')]]=_0x36ec0c;_[_0xe139('0x32')](_0x5c1c5e[_0xe139('0x33')],_0x440eef);}return _0x54ed72[_0xe139('0x1e')](_0xe139('0x34'))['find'](_0x5c1c5e,_0x143254)[_0xe139('0x23')]()[_0xe139('0x24')](function(_0x414022){if(_0x414022&&_0x414022[_0xe139('0x35')]){return _0x414022;}else{var _0x53ab08=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb[_0xe139('0x36')]){var _0x461477={};_0x461477[_0x3b78cb[_0xe139('0x36')]]=_0x36ec0c;_[_0xe139('0x32')](_0x53ab08[_0xe139('0x33')],_0x461477);}return _0x54ed72[_0xe139('0x1e')]('Lead')[_0xe139('0x22')](_0x53ab08,_0x143254);}});case _0xe139('0x37'):var _0x34706b=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb[_0xe139('0x38')]){var _0x440eef={};_0x440eef[_0x3b78cb[_0xe139('0x38')]]=_0x36ec0c;_[_0xe139('0x32')](_0x34706b[_0xe139('0x33')],_0x440eef);}return _0x54ed72[_0xe139('0x1e')](_0xe139('0x39'))['find'](_0x34706b,_0x143254)[_0xe139('0x23')]()[_0xe139('0x24')](function(_0x31efa2){if(_0x31efa2&&_0x31efa2[_0xe139('0x35')]){return _0x31efa2;}else{var _0x215b35=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb['additionalSearchContact']){var _0x3429bd={};_0x3429bd[_0x3b78cb[_0xe139('0x31')]]=_0x36ec0c;_['merge'](_0x215b35[_0xe139('0x33')],_0x3429bd);}return _0x54ed72[_0xe139('0x1e')]('Contact')[_0xe139('0x22')](_0x215b35,_0x143254)[_0xe139('0x24')](function(_0x203ba1){if(_0x203ba1&&_0x203ba1['length']){return _0x203ba1;}else{var _0x403198=_['cloneDeep'](_0x5a09b2);if(_0x3b78cb[_0xe139('0x36')]){var _0x33445c={};_0x33445c[_0x3b78cb[_0xe139('0x36')]]=_0x36ec0c;_[_0xe139('0x32')](_0x403198[_0xe139('0x33')],_0x33445c);}return _0x54ed72[_0xe139('0x1e')](_0xe139('0x3a'))['find'](_0x403198,_0x143254);}});}});case _0xe139('0x13'):var _0x5c1c5e=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb[_0xe139('0x31')]){var _0x440eef={};_0x440eef[_0x3b78cb[_0xe139('0x31')]]=_0x36ec0c;_[_0xe139('0x32')](_0x5c1c5e[_0xe139('0x33')],_0x440eef);}return _0x54ed72[_0xe139('0x1e')](_0xe139('0x34'))[_0xe139('0x22')](_0x5c1c5e,_0x143254)['execute']();case _0xe139('0x1b'):var _0x219013=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb['additionalSearchLead']){var _0x440eef={};_0x440eef[_0x3b78cb[_0xe139('0x36')]]=_0x36ec0c;_[_0xe139('0x32')](_0x219013[_0xe139('0x33')],_0x440eef);}return _0x54ed72['sobject'](_0xe139('0x3a'))[_0xe139('0x22')](_0x219013,_0x143254);case _0xe139('0x16'):var _0x34706b=_[_0xe139('0x30')](_0x5a09b2);if(_0x3b78cb['additionalSearchAccount']){var _0x440eef={};_0x440eef[_0x3b78cb[_0xe139('0x38')]]=_0x36ec0c;_[_0xe139('0x32')](_0x34706b[_0xe139('0x33')],_0x440eef);}return _0x54ed72[_0xe139('0x1e')](_0xe139('0x39'))['find'](_0x34706b,_0x143254);default:return null;}})[_0xe139('0x24')](function(_0x122b97){if(_0x122b97&&_0x122b97[_0xe139('0x35')]){var _0x5b0dff=_[_0xe139('0x3b')](_0x122b97);if(_0x5b0dff){return BPromise[_0xe139('0x27')]({'id':_0x5b0dff['Id'],'name':_0x5b0dff[_0xe139('0x28')],'phone':_0x5b0dff[_0xe139('0x3c')],'endUserType':_0x5b0dff[_0xe139('0x3d')][_0xe139('0x3e')][_0xe139('0x3f')]()});}}})[_0xe139('0x24')](function(_0x2265c0){if(_0x2265c0){logger[_0xe139('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2265c0['endUserType'],_0x36ec0c);return BPromise[_0xe139('0x27')](_0x2265c0);}else{logger['info'](_0xe139('0x40'),_0x36ec0c);var _0x55f287={'Phone':_0x36ec0c};if(_0x3b78cb[_0xe139('0x41')]){if(_0x3b78cb['moduleCreate']===_0xe139('0x13')){logger[_0xe139('0x25')](_0xe139('0x42'),_0x36ec0c,_0x3b78cb['moduleCreate']);_0x55f287['LastName']=_0x1e5675!==''?_0x1e5675:util[_0xe139('0x43')](_0xe139('0x44'),_0x36ec0c);}else if(_0x3b78cb[_0xe139('0x41')]===_0xe139('0x1b')){logger[_0xe139('0x25')](_0xe139('0x42'),_0x36ec0c,_0x3b78cb[_0xe139('0x41')]);_0x55f287[_0xe139('0x45')]=_0x1e5675!==_0xe139('0x46')?_0x1e5675:util['format'](_0xe139('0x44'),_0x36ec0c);_0x55f287[_0xe139('0x47')]=_0xe139('0x48');}else if(_0x3b78cb['moduleCreate']===_0xe139('0x16')){logger[_0xe139('0x25')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x36ec0c,_0x3b78cb['moduleCreate']);_0x55f287[_0xe139('0x28')]=_0x1e5675!==''?_0x1e5675:util[_0xe139('0x43')](_0xe139('0x44'),_0x36ec0c);}else{return null;}}return _0x54ed72[_0xe139('0x1e')](_[_0xe139('0x49')](_0x3b78cb[_0xe139('0x41')]))[_0xe139('0x1f')](_0x55f287)[_0xe139('0x24')](function(_0x151983){return BPromise['resolve']({'id':_0x151983['id'],'endUserType':_0x3b78cb[_0xe139('0x41')]});});}});}function getCustomFields(_0x476749,_0x468b75){var _0x1b1a27={};if(_0x476749['length']>0x0){_[_0xe139('0x4a')](_0x476749,function(_0x53dfb0){if(_[_0xe139('0x4b')]([_0xe139('0x4c'),_0xe139('0x4d')],_0x53dfb0[_0xe139('0x3e')])&&_0x53dfb0[_0xe139('0x4e')]){_0x1b1a27[_0x53dfb0[_0xe139('0x4e')]]=_0x53dfb0[_0xe139('0x4f')]['toString']();}else if(_0x53dfb0[_0xe139('0x3e')]===_0xe139('0x50')&&_0x53dfb0[_0xe139('0x51')]&&_0x53dfb0[_0xe139('0x4e')]){_0x468b75[_0x53dfb0[_0xe139('0x51')]]&&(_0x1b1a27[_0x53dfb0['idField']]=_0x468b75[_0x53dfb0[_0xe139('0x51')]][_0xe139('0x52')]());}else if(_0x53dfb0[_0xe139('0x3e')]===_0xe139('0x53')&&_0x53dfb0['Variable']&&_0x53dfb0[_0xe139('0x54')][_0xe139('0x55')]&&_0x53dfb0['idField']){_0x468b75[_0x53dfb0[_0xe139('0x54')][_0xe139('0x55')][_0xe139('0x3f')]()]&&(_0x1b1a27[_0x53dfb0['idField']]=_0x468b75[_0x53dfb0[_0xe139('0x54')][_0xe139('0x55')]['toLowerCase']()]['toString']());}});}return _0x1b1a27;}function getConnection(_0x2d55c9){var _0x3d46a2=_0x2d55c9['password'][_0xe139('0x56')](_0x2d55c9[_0xe139('0x57')]);var _0x1f1d23=new jsforce[(_0xe139('0x58'))]({'oauth2':{'loginUrl':_0x2d55c9['remoteUri']||'https://login.salesforce.com','clientId':_0x2d55c9[_0xe139('0x59')],'clientSecret':_0x2d55c9[_0xe139('0x5a')]}});return _0x1f1d23[_0xe139('0x5b')](_0x2d55c9[_0xe139('0x5c')],_0x3d46a2)[_0xe139('0x24')](function(){logger[_0xe139('0x25')]('Connection\x20established.');return _0x1f1d23;});}exports['queue']=function(_0x229977,_0x572837,_0x955e50,_0x3f11ab,_0x37274a,_0x271ae0){var _0x530aa0,_0x3e904e,_0x3af835,_0x278bca;_0x271ae0['serverUrl']=intUtil[_0xe139('0x5d')](_0x271ae0[_0xe139('0x5e')]);_0x271ae0[_0xe139('0x5f')]=intUtil[_0xe139('0x5d')](_0x271ae0[_0xe139('0x5f')]);if(_0x37274a&&_0x37274a['monitor_format']){logger[_0xe139('0x25')]('[QUEUE]',_0xe139('0x60'));_0x572837['recordingURL']=util[_0xe139('0x43')](_0xe139('0x61'),_0x271ae0['serverUrl'],_0x572837[_0xe139('0x62')],md5(_0x572837['uniqueid']));}else{_0x572837['recordingURL']='';}return getConnection(_0x271ae0)[_0xe139('0x24')](function(_0x2b9af7){_0x278bca=_0x2b9af7;return getUser(_0x271ae0,_0x3f11ab[_0xe139('0x63')],_0x278bca);})['then'](function(_0x5d0217){_0x530aa0=_0x5d0217;return getEndUser(_0x271ae0,_0x955e50,_0x572837[_0xe139('0x64')],_0x572837['calleridnum'],_0x278bca);})[_0xe139('0x24')](function(_0x335503){_0x3e904e=_0x335503;return getTicket(_0x271ae0,_0x530aa0,_0x3e904e,_0x955e50,_0x572837,_0x955e50[_0xe139('0x65')],_0x278bca,'queue');})[_0xe139('0x24')](function(_0x10d53d){_0x3af835=_0x10d53d;logger['info'](_0xe139('0x66'),_0x3af835['id']);logger['info'](_0xe139('0x67'),_0x3af835['id'],_0x3f11ab[_0xe139('0x55')],_0x271ae0[_0xe139('0x3e')]);switch(_0x271ae0[_0xe139('0x3e')]){case _0xe139('0x68'):emit(util[_0xe139('0x43')]('user:%s',_0x3f11ab[_0xe139('0x55')]),'trigger:salesforce:display',{'recordId':_0x3af835['id']});break;case'newTab':emit(util[_0xe139('0x43')](_0xe139('0x69'),_0x3f11ab[_0xe139('0x55')]),_0xe139('0x6a'),{'uri':util[_0xe139('0x43')](_0xe139('0x6b'),_0x278bca[_0xe139('0x6c')],_0x3af835['id'])});break;default:logger[_0xe139('0x6d')](_0xe139('0x6e'));}})['catch'](function(_0xd47864){logger[_0xe139('0x6d')]('[QUEUE]',_0xd47864);});};exports['outbound']=function(_0x1b502c,_0x118f97,_0x57ca04,_0x4b3187,_0x3f7820,_0x49cdba,_0xe847ac){var _0x2b8e4d,_0x6f0eb2,_0x23c02c,_0x5138c0;_0x49cdba[_0xe139('0x5e')]=intUtil[_0xe139('0x5d')](_0x49cdba[_0xe139('0x5e')]);_0x49cdba[_0xe139('0x5f')]=intUtil[_0xe139('0x5d')](_0x49cdba['remoteUri']);if(_0xe847ac&&_0xe847ac[_0xe139('0x6f')]&&_0xe847ac[_0xe139('0x6f')]!==_0xe139('0x70')){logger[_0xe139('0x25')](_0xe139('0x71'),_0xe139('0x60'));_0x118f97['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49cdba['serverUrl'],_0x118f97[_0xe139('0x62')],md5(_0x118f97[_0xe139('0x62')]));}return getConnection(_0x49cdba)[_0xe139('0x24')](function(_0x1ef676){_0x5138c0=_0x1ef676;return getUser(_0x49cdba,_0x4b3187['email'],_0x5138c0);})[_0xe139('0x24')](function(_0x589bd5){_0x2b8e4d=_0x589bd5;return getEndUser(_0x49cdba,_0x57ca04,_0x118f97[_0xe139('0x72')],_0x118f97[_0xe139('0x73')],_0x5138c0);})[_0xe139('0x24')](function(_0xfdec9a){_0x6f0eb2=_0xfdec9a;return getTicket(_0x49cdba,_0x2b8e4d,_0x6f0eb2,_0x57ca04,_0x118f97,_0x57ca04['Fields'],_0x5138c0,'outbound');})['then'](function(_0x3c1d2a){_0x23c02c=_0x3c1d2a;logger['info'](_0xe139('0x74'),_0x23c02c['id']);logger[_0xe139('0x25')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x23c02c['id'],_0x4b3187[_0xe139('0x55')],_0x49cdba['type']);switch(_0x49cdba['type']){case _0xe139('0x68'):emit(util[_0xe139('0x43')](_0xe139('0x69'),_0x4b3187['name']),_0xe139('0x75'),{'recordId':_0x23c02c['id']});break;case'newTab':emit(util['format']('user:%s',_0x4b3187[_0xe139('0x55')]),_0xe139('0x6a'),{'uri':util['format'](_0xe139('0x6b'),_0x5138c0[_0xe139('0x6c')],_0x23c02c['id'])});break;default:logger[_0xe139('0x6d')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xe139('0x76')](function(_0x465910){logger['error'](_0xe139('0x71'),_0x465910);});};exports['unmanaged']=function(_0xba02f0,_0x11e568,_0x5ba192,_0xee894d,_0x161dc1,_0x32eef1){var _0xed5189,_0x3b26fe,_0x522b74,_0x19dc35;_0x32eef1[_0xe139('0x5e')]=intUtil[_0xe139('0x5d')](_0x32eef1[_0xe139('0x5e')]);_0x32eef1[_0xe139('0x5f')]=intUtil['stripTrailingSlash'](_0x32eef1[_0xe139('0x5f')]);if(_0x161dc1&&_0x161dc1['monitor_format']){logger[_0xe139('0x25')]('['+_0x11e568[_0xe139('0x77')]['toUpperCase']()+']',_0xe139('0x60'));_0x11e568[_0xe139('0x78')]=util['format'](_0xe139('0x61'),_0x32eef1[_0xe139('0x5e')],_0x11e568[_0xe139('0x62')],md5(_0x11e568[_0xe139('0x62')]));}else{_0x11e568[_0xe139('0x78')]='';}return getConnection(_0x32eef1)[_0xe139('0x24')](function(_0x5397af){_0x19dc35=_0x5397af;if(!_[_0xe139('0x20')](_0xee894d)){return getUser(_0x32eef1,_0xee894d[_0xe139('0x55')],_0x19dc35);}else{return getUser(_0x32eef1,null,_0x19dc35);}})[_0xe139('0x24')](function(_0x36611c){_0xed5189=_0x36611c;return getEndUser(_0x32eef1,_0x5ba192,_0x11e568[_0xe139('0x64')],_0x11e568['calleridnum'],_0x19dc35);})['then'](function(_0x2a3159){_0x3b26fe=_0x2a3159;return getTicket(_0x32eef1,_0xed5189,_0x3b26fe,_0x5ba192,_0x11e568,_0x5ba192['Fields'],_0x19dc35);})[_0xe139('0x24')](function(_0x26dcf9){_0x522b74=_0x26dcf9;logger[_0xe139('0x25')]('['+_0x11e568[_0xe139('0x77')][_0xe139('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x522b74['id']);logger[_0xe139('0x25')]('['+_0x11e568[_0xe139('0x77')][_0xe139('0x79')]()+_0xe139('0x7a'),_0x32eef1[_0xe139('0x3e')]);})[_0xe139('0x76')](function(_0x2933af){logger[_0xe139('0x6d')]('['+_0x11e568[_0xe139('0x77')][_0xe139('0x79')]()+']',_0x2933af);});}; \ 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 9c13da8..4cce5ce 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 _0x4408=['sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','sys_user?','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','endUserNumber','],\x20createEndUser\x20crm','includes','string','type','nameField','customField','picklist','idField','toLowerCase','content','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET'];(function(_0x33fb4e,_0x102487){var _0x5641f9=function(_0x56a1c0){while(--_0x56a1c0){_0x33fb4e['push'](_0x33fb4e['shift']());}};_0x5641f9(++_0x102487);}(_0x4408,0x1f3));var _0x8440=function(_0x42885c,_0x11209b){_0x42885c=_0x42885c-0x0;var _0x10b2c8=_0x4408[_0x42885c];return _0x10b2c8;};'use strict';var _=require(_0x8440('0x0'));var Promise=require(_0x8440('0x1'));var rp=require('request-promise');var util=require(_0x8440('0x2'));var md5=require(_0x8440('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8440('0x4'));var logger=require(_0x8440('0x5'))('servicenow');config[_0x8440('0x6')]=_[_0x8440('0x7')](config['redis'],{'host':_0x8440('0x8'),'port':0x18eb});var io=require(_0x8440('0x9'))(new Redis(config[_0x8440('0x6')]));function getAdminUser(_0x5c2770,_0x101e0c,_0x18d7a4,_0x11bf0e,_0x1e448f,_0x6348d5){return new Promise(function(_0x549521,_0x16518d){var _0x30696a={'method':_0x8440('0xa'),'uri':_0x11bf0e+_0x8440('0xb')+'&'+_0x1e448f+'&'+_0x6348d5,'auth':_0x101e0c,'json':!![]};return rp(_0x30696a)['then'](function(_0x46d48e){if(_0x46d48e[_0x8440('0xc')]['length']>0x0){_0x18d7a4[_0x8440('0xd')]=_0x46d48e[_0x8440('0xc')][0x0][_0x8440('0xe')];}logger[_0x8440('0xf')]('['+[_0x5c2770[_0x8440('0x10')]()]+'],\x20getAdminUser\x20crm',_0x18d7a4);_0x549521(_0x18d7a4);})[_0x8440('0x11')](function(_0x5bebef){logger[_0x8440('0x12')]('['+[_0x5c2770[_0x8440('0x10')]()]+']',_0x5bebef['message']);_0x16518d(_0x5bebef[_0x8440('0x13')]);});});}function getUser(_0x336e25,_0x3715bb,_0x420baa,_0x25104b,_0x43183b){return function(_0xcaa780){logger[_0x8440('0xf')]('['+[_0x336e25[_0x8440('0x10')]()]+_0x8440('0x14'),_0xcaa780);return new Promise(function(_0x32ac27,_0x186119){if(intUtil[_0x8440('0x15')](_0xcaa780[_0x8440('0x16')])){var _0x102e43={'method':_0x8440('0xa'),'uri':_0x420baa+_0x8440('0x17')+_0xcaa780[_0x8440('0x16')]+'&'+_0x25104b+'&'+_0x43183b,'auth':_0x3715bb,'json':!![]};logger[_0x8440('0xf')]('['+[_0x336e25['toUpperCase']()]+_0x8440('0x18'),_0x102e43);return rp(_0x102e43)['then'](function(_0x245715){logger['info']('['+[_0x336e25[_0x8440('0x10')]()]+'],\x20getUser\x20entity',_0x245715);if(_0x245715['result'][_0x8440('0x19')]>0x0&&String(_0x245715[_0x8440('0xc')][0x0][_0x8440('0x1a')])===_0x8440('0x1b')){_0xcaa780[_0x8440('0x1c')]=_0x245715[_0x8440('0xc')][0x0][_0x8440('0xe')];}else{_0xcaa780[_0x8440('0x1c')]=_0xcaa780[_0x8440('0xd')];_0xcaa780[_0x8440('0x16')]=_0xcaa780[_0x8440('0x1d')];}logger['info']('['+[_0x336e25[_0x8440('0x10')]()]+_0x8440('0x1e'),_0xcaa780);_0x32ac27(_0xcaa780);})[_0x8440('0x11')](function(_0x33c4a7){logger[_0x8440('0x12')]('['+[_0x336e25[_0x8440('0x10')]()]+']',_0x33c4a7['message']);_0x186119(_0x33c4a7[_0x8440('0x13')]);});}else{logger[_0x8440('0xf')]('['+[_0x336e25['toUpperCase']()]+_0x8440('0x1f'));_0xcaa780[_0x8440('0x1c')]=_0xcaa780[_0x8440('0xd')];_0xcaa780[_0x8440('0x16')]=_0xcaa780[_0x8440('0x1d')];_0x32ac27(_0xcaa780);}});};}function createEndUser(_0x411de9,_0x17225b,_0x150300,_0x28c3c2,_0xe7e53f){logger[_0x8440('0xf')]('['+[_0x411de9[_0x8440('0x10')]()]+'],\x20createEndUser\x20input\x20crm',_0x150300);return new Promise(function(_0x57f719,_0x225b26){var _0x5eb267={'method':'POST','uri':_0x28c3c2+_0x8440('0x20')+_0xe7e53f,'body':{'user_name':_0x150300['endUserNumber'],'roles':'user','first_name':_0x150300['endUserNumber'],'active':_0x8440('0x1b'),'date_format':_0x8440('0x21'),'phone':_0x150300['endUserNumber']},'auth':_0x17225b,'json':!![]};return rp(_0x5eb267)[_0x8440('0x22')](function(_0x5ead4d){logger['info']('['+[_0x411de9[_0x8440('0x10')]()]+_0x8440('0x23'),_0x5ead4d['result']);_0x150300[_0x8440('0x24')]=_0x5ead4d['result'][_0x8440('0xe')];_0x57f719(_0x150300);})[_0x8440('0x11')](function(_0x27ea4f){logger[_0x8440('0x12')]('['+[_0x411de9[_0x8440('0x10')]()]+']',_0x27ea4f['message']);_0x225b26(_0x27ea4f['message']);});});}function getEndUser(_0x945edc,_0x4c9bee,_0x37b12a,_0x428aee,_0x3bcd61){return function(_0x5b8a58){logger[_0x8440('0xf')]('['+[_0x945edc[_0x8440('0x10')]()]+_0x8440('0x25'),_0x5b8a58);return new Promise(function(_0x5cb8c3,_0x4416d0){var _0x4eeff7={'method':'GET','uri':_0x37b12a+'sys_user?sysparm_query=phone%3D'+_0x5b8a58[_0x8440('0x26')]+'&'+_0x428aee+'&'+_0x3bcd61,'auth':_0x4c9bee,'json':!![]};return rp(_0x4eeff7)['then'](function(_0x480401){if(_0x480401['result'][_0x8440('0x19')]>0x0){_0x5b8a58[_0x8440('0x24')]=_0x480401[_0x8440('0xc')][0x0][_0x8440('0xe')];logger[_0x8440('0xf')]('['+[_0x945edc[_0x8440('0x10')]()]+'],\x20getEndUser\x20crm',_0x5b8a58);_0x5cb8c3(_0x5b8a58);}else{return createEndUser(_0x945edc,_0x4c9bee,_0x5b8a58,_0x37b12a,_0x428aee)[_0x8440('0x22')](function(_0x10d36e){logger[_0x8440('0xf')]('['+[_0x945edc[_0x8440('0x10')]()]+_0x8440('0x27'),_0x10d36e);_0x5cb8c3(_0x10d36e);});}})[_0x8440('0x11')](function(_0x1b9d03){logger[_0x8440('0x12')]('['+[_0x945edc[_0x8440('0x10')]()]+']',_0x1b9d03['message']);_0x4416d0(_0x1b9d03['message']);});});};}function getCustomFields(_0x333d1c,_0x37da98){var _0x3c0c2b={};if(_0x333d1c['length']>0x0){_['forEach'](_0x333d1c,function(_0x1fefca){if(_[_0x8440('0x28')]([_0x8440('0x29'),'picklist'],_0x1fefca[_0x8440('0x2a')])&&_0x1fefca[_0x8440('0x2b')]&&!_0x1fefca[_0x8440('0x2c')]){_0x3c0c2b[_0x1fefca['nameField']['toLowerCase']()]=_0x1fefca['content']['toString']();}else if(_['includes']([_0x8440('0x29'),_0x8440('0x2d')],_0x1fefca[_0x8440('0x2a')])&&_0x1fefca[_0x8440('0x2e')]&&_0x1fefca[_0x8440('0x2c')]){_0x3c0c2b[_0x1fefca[_0x8440('0x2e')][_0x8440('0x2f')]()]=_0x1fefca[_0x8440('0x30')]['toString']();}else if(_0x1fefca[_0x8440('0x2a')]===_0x8440('0x31')&&_0x1fefca['variableName']&&_0x1fefca[_0x8440('0x2e')]&&_0x1fefca[_0x8440('0x2c')]){_0x3c0c2b[_0x1fefca[_0x8440('0x2e')]['toLowerCase']()]=_0x37da98[_0x1fefca[_0x8440('0x32')]][_0x8440('0x33')]();}else if(_0x1fefca[_0x8440('0x2a')]===_0x8440('0x34')&&_0x1fefca[_0x8440('0x35')]&&_0x1fefca[_0x8440('0x35')][_0x8440('0x36')]&&_0x1fefca[_0x8440('0x2e')]&&_0x1fefca[_0x8440('0x2c')]){_0x3c0c2b[_0x1fefca[_0x8440('0x2e')]['toLowerCase']()]=_0x37da98[_0x1fefca['Variable'][_0x8440('0x36')][_0x8440('0x2f')]()][_0x8440('0x33')]();}});}return _0x3c0c2b;}function getTicket(_0x39076c,_0x1e3fb1,_0x1c1348,_0x3591c0,_0x5c1cd,_0x3b25ac){return function(_0x24ca95){logger[_0x8440('0xf')]('['+[_0x39076c['toUpperCase']()]+_0x8440('0x37'),_0x24ca95);return new Promise(function(_0x4f1331,_0x4d43fd){var _0x14a5d1=_0x39076c[_0x8440('0x2f')]()===_0x8440('0x38')?_0x24ca95[_0x8440('0x1c')]:_0x24ca95[_0x8440('0x24')];var _0x549371={'method':_0x8440('0x39'),'uri':_0x1c1348+_0x8440('0x3a')+'?'+_0x3b25ac,'body':Object[_0x8440('0x3b')]({},{'active':'true','caller_id':_0x14a5d1,'assigned_to':_0x24ca95[_0x8440('0x1c')],'short_description':intUtil[_0x8440('0x3c')](_0x3591c0['Subjects'],_0x5c1cd,'\x20'),'description':intUtil[_0x8440('0x3c')](_0x3591c0['Descriptions'],_0x5c1cd,'\x0a')},getCustomFields(_0x3591c0[_0x8440('0x3d')],_0x5c1cd)),'auth':_0x1e3fb1,'json':!![]};return rp(_0x549371)[_0x8440('0x22')](function(_0xe9d0d0){logger[_0x8440('0xf')]('['+[_0x39076c[_0x8440('0x10')]()]+']\x20POST\x20incident\x20entity\x20schema',_0xe9d0d0[_0x8440('0xc')]);_0x24ca95[_0x8440('0x3e')]=_0xe9d0d0[_0x8440('0xc')][_0x8440('0xe')];_0x24ca95['ticketNumber']=_0xe9d0d0[_0x8440('0xc')][_0x8440('0x3f')];logger[_0x8440('0xf')]('['+[_0x39076c[_0x8440('0x10')]()]+_0x8440('0x40'),_0x24ca95);_0x4f1331(_0x24ca95);})['catch'](function(_0x5aff44){logger['error']('['+[_0x39076c[_0x8440('0x10')]()]+']',_0x5aff44[_0x8440('0x13')]);_0x4d43fd(_0x5aff44[_0x8440('0x13')]);});});};}function createRemoteTag(_0xacde17,_0x25b9e8,_0x32593e,_0x39113a){return new Promise(function(_0x113c79,_0x58caa0){var _0x2c2a35={'method':_0x8440('0x39'),'uri':_0x32593e+_0x8440('0x41')+'?'+_0x39113a,'body':{'short_description':_0xacde17,'global':!![],'active':!![],'name':_0xacde17},'auth':_0x25b9e8,'json':!![]};return rp(_0x2c2a35)['then'](function(_0xf3ba7a){var _0x35224b=_0xf3ba7a['result'][_0x8440('0xe')];_0x113c79(_0x35224b);});});}function getRemoteTag(_0x487a58,_0x4ebefc,_0x548ff1,_0x2ca5d8,_0x2f3040){return new Promise(function(_0x57e866,_0x271844){var _0x3f05ed={'method':_0x8440('0xa'),'uri':_0x548ff1+'label'+_0x8440('0x42')+_0x487a58+'&'+_0x2ca5d8,'auth':_0x4ebefc,'json':!![]};return rp(_0x3f05ed)[_0x8440('0x22')](function(_0x595a63){if(_0x595a63['result'][_0x8440('0x19')]>0x0){var _0x4f818c=_0x595a63['result'][0x0][_0x8440('0xe')];_0x57e866(_0x4f818c);}else{return createRemoteTag(_0x487a58,_0x4ebefc,_0x548ff1,_0x2ca5d8)[_0x8440('0x22')](function(_0x540dc4){_0x57e866(_0x540dc4);});}});});}function assignTagToIncident(_0x21c498,_0x4760dd,_0x16fcc6,_0xf92bee,_0x18c85c){return new Promise(function(_0x141514,_0x78d97){var _0x56afa8={'method':_0x8440('0x39'),'uri':_0x16fcc6+_0x8440('0x43')+'?'+_0x18c85c,'body':{'label':_0x21c498,'table':_0x8440('0x3a'),'id_type':_0x8440('0x44'),'table_key':_0xf92bee[_0x8440('0x3e')],'title':'Incident\x20-\x20'+_0xf92bee[_0x8440('0x45')],'id_display':_0xf92bee['ticketNumber']},'auth':_0x4760dd,'json':!![]};return rp(_0x56afa8)[_0x8440('0x22')](function(_0x53948e){_0x141514();})['catch'](function(){_0x141514();});});}function manageTags(_0x4198f3,_0x5b7a3a,_0x1489f6,_0x4010f1,_0x56e447,_0x5b72eb,_0x29a7d5){return new Promise(function(_0x2fe429,_0x4af3ce){var _0x3b2cd1=[];_0x5b7a3a['forEach'](function(_0x2fe2c4){_0x3b2cd1['push'](getRemoteTag(_0x2fe2c4,_0x1489f6,_0x4010f1,_0x5b72eb,_0x29a7d5));});return Promise['all'](_0x3b2cd1)[_0x8440('0x22')](function(_0x32803e){if(_0x32803e[_0x8440('0x19')]){logger[_0x8440('0xf')]('['+[_0x4198f3[_0x8440('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x32803e);var _0x3171f6=[];_0x32803e['forEach'](function(_0x2595d6){_0x3171f6['push'](assignTagToIncident(_0x2595d6,_0x1489f6,_0x4010f1,_0x56e447,_0x5b72eb));});return Promise['all'](_0x3171f6)['then'](function(){_0x2fe429();})['catch'](function(){_0x2fe429();});}else{_0x2fe429();}});});}function getTags(_0x7003e8,_0x3dc4ae,_0x418df9,_0x406d9b,_0x1d24fe,_0x53b371){return function(_0x8e12e1){return new Promise(function(_0x44b9d0,_0x5ba8a5){var _0x2f8ade=[];var _0x37af0b=_0x406d9b['Tags'];if(_0x37af0b&&_0x37af0b['length']>0x0){_0x2f8ade=_[_0x8440('0x46')](_0x37af0b,'name');}if(_0x2f8ade[_0x8440('0x19')]>0x0){return manageTags(_0x7003e8,_0x2f8ade,_0x3dc4ae,_0x418df9,_0x8e12e1,_0x1d24fe,_0x53b371)['then'](function(){_0x44b9d0(_0x8e12e1);});}else{_0x44b9d0(_0x8e12e1);}});};}function emit(_0x40dac2,_0x2cbbc0,_0x49a1b3){var _0x5bb982=_0x8440('0x47')+_0x8440('0x48')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x8440('0x49');var _0x5a92cc={'uri':_0x40dac2+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x49a1b3+_0x5bb982};io['to'](util[_0x8440('0x4a')](_0x8440('0x4b'),_0x2cbbc0))[_0x8440('0x4c')](_0x8440('0x4d'),_0x5a92cc);}exports['cs']=function(_0x99284f,_0x49fa6e,_0x5ead51,_0x551891,_0x1f92ee,_0x264a0e,_0x2891e4,_0x381532){var _0x250983={};var _0x4ad0a0={'user':_0x264a0e[_0x8440('0x4e')],'pass':_0x264a0e[_0x8440('0x4f')]};var _0x5d2356=_0x8440('0x50');var _0x207fb1='sysparm_display_value=true';_0x264a0e[_0x8440('0x51')]=intUtil[_0x8440('0x52')](_0x264a0e['remoteUri']);_0x264a0e[_0x8440('0x53')]=intUtil[_0x8440('0x52')](_0x264a0e['serverUrl']);var _0x3242d0=util[_0x8440('0x4a')](_0x8440('0x54'),_0x264a0e[_0x8440('0x51')]);_0x250983[_0x8440('0x16')]=!_['isNil'](_0x551891)?_0x551891[_0x8440('0x55')]:null;_0x250983[_0x8440('0x1d')]=_0x264a0e[_0x8440('0x55')];_0x250983[_0x8440('0x26')]=_0x381532[_0x8440('0x2f')]()===_0x8440('0x38')?_0x49fa6e[_0x8440('0x56')]:_0x49fa6e[_0x8440('0x57')];_0x250983[_0x8440('0x58')]=_0x381532===_0x8440('0x59')||_0x381532==='unmanaged'?_0x8440('0x59'):'outbound';var _0x1e9bd6=util[_0x8440('0x4a')](_0x8440('0x5a'),_0x264a0e[_0x8440('0x53')],_0x49fa6e[_0x8440('0x5b')],md5(_0x49fa6e[_0x8440('0x5b')]));if(_0x1f92ee&&_0x1f92ee[_0x8440('0x5c')]){logger[_0x8440('0xf')](_0x8440('0x5d'),_0x8440('0x5e'));_0x49fa6e[_0x8440('0x5f')]=_0x1e9bd6;}else if(_0x2891e4&&_0x2891e4[_0x8440('0x60')]&&_0x2891e4[_0x8440('0x60')]!=='none'){logger[_0x8440('0xf')](_0x8440('0x61'),'Recording\x20is\x20enabled!');_0x49fa6e[_0x8440('0x5f')]=_0x1e9bd6;}else{_0x49fa6e['recordingURL']='';}return getAdminUser(_0x381532,_0x4ad0a0,_0x250983,_0x3242d0,_0x207fb1,_0x5d2356)[_0x8440('0x22')](getUser(_0x381532,_0x4ad0a0,_0x3242d0,_0x207fb1,_0x5d2356))[_0x8440('0x22')](getEndUser(_0x381532,_0x4ad0a0,_0x3242d0,_0x207fb1,_0x5d2356))[_0x8440('0x22')](getTicket(_0x381532,_0x4ad0a0,_0x3242d0,_0x5ead51,_0x49fa6e,_0x207fb1))[_0x8440('0x22')](function(_0x552562){logger[_0x8440('0xf')](util[_0x8440('0x4a')](_0x8440('0x62'),_0x552562[_0x8440('0x3e')]));logger[_0x8440('0xf')](util[_0x8440('0x4a')](_0x8440('0x63'),_0x381532));if(_0x381532!==_0x8440('0x64')){logger[_0x8440('0xf')]('['+[_0x381532[_0x8440('0x10')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x264a0e[_0x8440('0x51')],_0x551891[_0x8440('0x36')],_0x552562[_0x8440('0x3e')]);}})['catch'](function(_0x35e984){logger[_0x8440('0x12')]('['+[_0x381532[_0x8440('0x10')]()]+_0x8440('0x65'),util['inspect'](_0x35e984,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcfb5=['emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','isNil','email','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','info','toUpperCase','],\x20getAdminUser\x20crm','catch','message','validateEmail','GET','userEmail','],\x20getUser\x20entity','active','userId','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','customField','nameField','content','toString','type','idField','toLowerCase','variableName','customVariable','Variable','name','outbound','endUserId','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcfb5,0x87));var _0x5cfb=function(_0x173b35,_0x5830a){_0x173b35=_0x173b35-0x0;var _0x5d68fb=_0xcfb5[_0x173b35];return _0x5d68fb;};'use strict';var _=require(_0x5cfb('0x0'));var Promise=require(_0x5cfb('0x1'));var rp=require('request-promise');var util=require(_0x5cfb('0x2'));var md5=require(_0x5cfb('0x3'));var Redis=require(_0x5cfb('0x4'));var intUtil=require(_0x5cfb('0x5'));var config=require(_0x5cfb('0x6'));var logger=require('../../../../config/logger')(_0x5cfb('0x7'));config[_0x5cfb('0x8')]=_[_0x5cfb('0x9')](config[_0x5cfb('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5cfb('0xa'))(new Redis(config['redis']));function getAdminUser(_0x190855,_0x12fbb4,_0x54dd9,_0x1fd20c,_0x3c1bc7,_0x26a556){return new Promise(function(_0x2f75e4,_0x298c53){var _0x10db91={'method':'GET','uri':_0x1fd20c+_0x5cfb('0xb')+'&'+_0x3c1bc7+'&'+_0x26a556,'auth':_0x12fbb4,'json':!![]};return rp(_0x10db91)[_0x5cfb('0xc')](function(_0x1d53ba){if(_0x1d53ba['result'][_0x5cfb('0xd')]>0x0){_0x54dd9[_0x5cfb('0xe')]=_0x1d53ba[_0x5cfb('0xf')][0x0]['sys_id'];}logger[_0x5cfb('0x10')]('['+[_0x190855[_0x5cfb('0x11')]()]+_0x5cfb('0x12'),_0x54dd9);_0x2f75e4(_0x54dd9);})[_0x5cfb('0x13')](function(_0x4e119a){logger['error']('['+[_0x190855[_0x5cfb('0x11')]()]+']',_0x4e119a[_0x5cfb('0x14')]);_0x298c53(_0x4e119a[_0x5cfb('0x14')]);});});}function getUser(_0x106764,_0xc35c96,_0x45cd25,_0x4caa20,_0x446dcc){return function(_0x6ccdcb){logger[_0x5cfb('0x10')]('['+[_0x106764[_0x5cfb('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x6ccdcb);return new Promise(function(_0x26c22e,_0x3deb90){if(intUtil[_0x5cfb('0x15')](_0x6ccdcb['userEmail'])){var _0x2c897e={'method':_0x5cfb('0x16'),'uri':_0x45cd25+'sys_user?sysparm_query=email%3D'+_0x6ccdcb[_0x5cfb('0x17')]+'&'+_0x4caa20+'&'+_0x446dcc,'auth':_0xc35c96,'json':!![]};logger[_0x5cfb('0x10')]('['+[_0x106764[_0x5cfb('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x2c897e);return rp(_0x2c897e)[_0x5cfb('0xc')](function(_0x55c2b0){logger['info']('['+[_0x106764[_0x5cfb('0x11')]()]+_0x5cfb('0x18'),_0x55c2b0);if(_0x55c2b0[_0x5cfb('0xf')][_0x5cfb('0xd')]>0x0&&String(_0x55c2b0[_0x5cfb('0xf')][0x0][_0x5cfb('0x19')])==='true'){_0x6ccdcb[_0x5cfb('0x1a')]=_0x55c2b0[_0x5cfb('0xf')][0x0]['sys_id'];}else{_0x6ccdcb[_0x5cfb('0x1a')]=_0x6ccdcb['adminId'];_0x6ccdcb[_0x5cfb('0x17')]=_0x6ccdcb['adminEmail'];}logger[_0x5cfb('0x10')]('['+[_0x106764['toUpperCase']()]+_0x5cfb('0x1b'),_0x6ccdcb);_0x26c22e(_0x6ccdcb);})[_0x5cfb('0x13')](function(_0x2b16de){logger[_0x5cfb('0x1c')]('['+[_0x106764[_0x5cfb('0x11')]()]+']',_0x2b16de[_0x5cfb('0x14')]);_0x3deb90(_0x2b16de['message']);});}else{logger[_0x5cfb('0x10')]('['+[_0x106764[_0x5cfb('0x11')]()]+_0x5cfb('0x1d'));_0x6ccdcb['userId']=_0x6ccdcb[_0x5cfb('0xe')];_0x6ccdcb[_0x5cfb('0x17')]=_0x6ccdcb[_0x5cfb('0x1e')];_0x26c22e(_0x6ccdcb);}});};}function createEndUser(_0x1171c4,_0x3c47a4,_0xb02463,_0x554157,_0x4f6cf9){logger[_0x5cfb('0x10')]('['+[_0x1171c4[_0x5cfb('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0xb02463);return new Promise(function(_0x55bc91,_0xd06595){var _0x367829={'method':_0x5cfb('0x1f'),'uri':_0x554157+_0x5cfb('0x20')+_0x4f6cf9,'body':{'user_name':_0xb02463[_0x5cfb('0x21')],'roles':_0x5cfb('0x22'),'first_name':_0xb02463['endUserNumber'],'active':_0x5cfb('0x23'),'date_format':_0x5cfb('0x24'),'phone':_0xb02463[_0x5cfb('0x21')]},'auth':_0x3c47a4,'json':!![]};return rp(_0x367829)[_0x5cfb('0xc')](function(_0x3dbe6f){logger[_0x5cfb('0x10')]('['+[_0x1171c4[_0x5cfb('0x11')]()]+_0x5cfb('0x25'),_0x3dbe6f[_0x5cfb('0xf')]);_0xb02463['endUserId']=_0x3dbe6f[_0x5cfb('0xf')][_0x5cfb('0x26')];_0x55bc91(_0xb02463);})[_0x5cfb('0x13')](function(_0x5b879f){logger['error']('['+[_0x1171c4['toUpperCase']()]+']',_0x5b879f[_0x5cfb('0x14')]);_0xd06595(_0x5b879f['message']);});});}function getEndUser(_0xc58cff,_0x3eac8c,_0x1235aa,_0x2a0c4c,_0x2d8c38){return function(_0x2d2d9e){logger['info']('['+[_0xc58cff[_0x5cfb('0x11')]()]+_0x5cfb('0x27'),_0x2d2d9e);return new Promise(function(_0x281596,_0x3b3645){var _0x1b2426={'method':_0x5cfb('0x16'),'uri':_0x1235aa+_0x5cfb('0x28')+_0x2d2d9e[_0x5cfb('0x21')]+'&'+_0x2a0c4c+'&'+_0x2d8c38,'auth':_0x3eac8c,'json':!![]};return rp(_0x1b2426)[_0x5cfb('0xc')](function(_0x41886a){if(_0x41886a['result'][_0x5cfb('0xd')]>0x0){_0x2d2d9e['endUserId']=_0x41886a[_0x5cfb('0xf')][0x0][_0x5cfb('0x26')];logger['info']('['+[_0xc58cff[_0x5cfb('0x11')]()]+_0x5cfb('0x29'),_0x2d2d9e);_0x281596(_0x2d2d9e);}else{return createEndUser(_0xc58cff,_0x3eac8c,_0x2d2d9e,_0x1235aa,_0x2a0c4c)[_0x5cfb('0xc')](function(_0x2c0d07){logger[_0x5cfb('0x10')]('['+[_0xc58cff[_0x5cfb('0x11')]()]+_0x5cfb('0x2a'),_0x2c0d07);_0x281596(_0x2c0d07);});}})[_0x5cfb('0x13')](function(_0x49ce32){logger['error']('['+[_0xc58cff['toUpperCase']()]+']',_0x49ce32[_0x5cfb('0x14')]);_0x3b3645(_0x49ce32[_0x5cfb('0x14')]);});});};}function getCustomFields(_0x5b7d2e,_0x10cfa8){var _0x302064={};if(_0x5b7d2e['length']>0x0){_[_0x5cfb('0x2b')](_0x5b7d2e,function(_0x1bf80a){if(_[_0x5cfb('0x2c')]([_0x5cfb('0x2d'),_0x5cfb('0x2e')],_0x1bf80a['type'])&&_0x1bf80a['nameField']&&!_0x1bf80a[_0x5cfb('0x2f')]){_0x302064[_0x1bf80a[_0x5cfb('0x30')]['toLowerCase']()]=_0x1bf80a[_0x5cfb('0x31')][_0x5cfb('0x32')]();}else if(_['includes']([_0x5cfb('0x2d'),_0x5cfb('0x2e')],_0x1bf80a[_0x5cfb('0x33')])&&_0x1bf80a['idField']&&_0x1bf80a['customField']){_0x302064[_0x1bf80a[_0x5cfb('0x34')][_0x5cfb('0x35')]()]=_0x1bf80a['content'][_0x5cfb('0x32')]();}else if(_0x1bf80a[_0x5cfb('0x33')]==='variable'&&_0x1bf80a['variableName']&&_0x1bf80a[_0x5cfb('0x34')]&&_0x1bf80a['customField']){_0x302064[_0x1bf80a[_0x5cfb('0x34')][_0x5cfb('0x35')]()]=_0x10cfa8[_0x1bf80a[_0x5cfb('0x36')]][_0x5cfb('0x32')]();}else if(_0x1bf80a[_0x5cfb('0x33')]===_0x5cfb('0x37')&&_0x1bf80a[_0x5cfb('0x38')]&&_0x1bf80a[_0x5cfb('0x38')][_0x5cfb('0x39')]&&_0x1bf80a[_0x5cfb('0x34')]&&_0x1bf80a[_0x5cfb('0x2f')]){_0x302064[_0x1bf80a['idField']['toLowerCase']()]=_0x10cfa8[_0x1bf80a[_0x5cfb('0x38')][_0x5cfb('0x39')][_0x5cfb('0x35')]()]['toString']();}});}return _0x302064;}function getTicket(_0xae01a1,_0x1affc4,_0x69e2dc,_0x472397,_0x2b6d28,_0x517ef7){return function(_0x20a103){logger['info']('['+[_0xae01a1[_0x5cfb('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x20a103);return new Promise(function(_0x5122e1,_0x5241e2){var _0x3d1bee=_0xae01a1[_0x5cfb('0x35')]()===_0x5cfb('0x3a')?_0x20a103['userId']:_0x20a103[_0x5cfb('0x3b')];var _0x21cf29={'method':_0x5cfb('0x1f'),'uri':_0x69e2dc+_0x5cfb('0x3c')+'?'+_0x517ef7,'body':Object[_0x5cfb('0x3d')]({},{'active':_0x5cfb('0x23'),'caller_id':_0x3d1bee,'assigned_to':_0x20a103[_0x5cfb('0x1a')],'short_description':intUtil[_0x5cfb('0x3e')](_0x472397['Subjects'],_0x2b6d28,'\x20'),'description':intUtil[_0x5cfb('0x3e')](_0x472397[_0x5cfb('0x3f')],_0x2b6d28,'\x0a')},getCustomFields(_0x472397[_0x5cfb('0x40')],_0x2b6d28)),'auth':_0x1affc4,'json':!![]};return rp(_0x21cf29)['then'](function(_0x4a39a0){logger[_0x5cfb('0x10')]('['+[_0xae01a1[_0x5cfb('0x11')]()]+_0x5cfb('0x41'),_0x4a39a0[_0x5cfb('0xf')]);_0x20a103['ticketId']=_0x4a39a0[_0x5cfb('0xf')]['sys_id'];_0x20a103['ticketNumber']=_0x4a39a0[_0x5cfb('0xf')][_0x5cfb('0x42')];logger['info']('['+[_0xae01a1['toUpperCase']()]+_0x5cfb('0x43'),_0x20a103);_0x5122e1(_0x20a103);})[_0x5cfb('0x13')](function(_0x2824dc){logger[_0x5cfb('0x1c')]('['+[_0xae01a1[_0x5cfb('0x11')]()]+']',_0x2824dc[_0x5cfb('0x14')]);_0x5241e2(_0x2824dc[_0x5cfb('0x14')]);});});};}function createRemoteTag(_0x6f0186,_0x3bd726,_0x5d4502,_0x3f0e62){return new Promise(function(_0x2b3cf1,_0x483acd){var _0x3cf1aa={'method':_0x5cfb('0x1f'),'uri':_0x5d4502+_0x5cfb('0x44')+'?'+_0x3f0e62,'body':{'short_description':_0x6f0186,'global':!![],'active':!![],'name':_0x6f0186},'auth':_0x3bd726,'json':!![]};return rp(_0x3cf1aa)[_0x5cfb('0xc')](function(_0x2ecf53){var _0x7efa29=_0x2ecf53[_0x5cfb('0xf')][_0x5cfb('0x26')];_0x2b3cf1(_0x7efa29);});});}function getRemoteTag(_0x15b161,_0x154e2e,_0x57b033,_0x44686c,_0x4e8c6f){return new Promise(function(_0x493399,_0x4da163){var _0x34efe2={'method':_0x5cfb('0x16'),'uri':_0x57b033+'label'+'?sysparm_query=name%3D'+_0x15b161+'&'+_0x44686c,'auth':_0x154e2e,'json':!![]};return rp(_0x34efe2)[_0x5cfb('0xc')](function(_0x48e9f1){if(_0x48e9f1[_0x5cfb('0xf')][_0x5cfb('0xd')]>0x0){var _0x306f5d=_0x48e9f1[_0x5cfb('0xf')][0x0][_0x5cfb('0x26')];_0x493399(_0x306f5d);}else{return createRemoteTag(_0x15b161,_0x154e2e,_0x57b033,_0x44686c)[_0x5cfb('0xc')](function(_0x2355fe){_0x493399(_0x2355fe);});}});});}function assignTagToIncident(_0x17b575,_0x179c57,_0x266557,_0x5d834a,_0x46f855){return new Promise(function(_0x5a639f,_0x4f9c41){var _0x264400={'method':_0x5cfb('0x1f'),'uri':_0x266557+'label_entry'+'?'+_0x46f855,'body':{'label':_0x17b575,'table':_0x5cfb('0x3c'),'id_type':_0x5cfb('0x45'),'table_key':_0x5d834a[_0x5cfb('0x46')],'title':_0x5cfb('0x47')+_0x5d834a[_0x5cfb('0x48')],'id_display':_0x5d834a[_0x5cfb('0x48')]},'auth':_0x179c57,'json':!![]};return rp(_0x264400)[_0x5cfb('0xc')](function(_0x4c8c2c){_0x5a639f();})['catch'](function(){_0x5a639f();});});}function manageTags(_0x540c19,_0x930ef,_0x109b11,_0x49ec60,_0x354e22,_0xc19137,_0x36a585){return new Promise(function(_0x562f82,_0x1c8e4a){var _0xd4de81=[];_0x930ef[_0x5cfb('0x2b')](function(_0x32f17f){_0xd4de81[_0x5cfb('0x49')](getRemoteTag(_0x32f17f,_0x109b11,_0x49ec60,_0xc19137,_0x36a585));});return Promise[_0x5cfb('0x4a')](_0xd4de81)[_0x5cfb('0xc')](function(_0x31e793){if(_0x31e793[_0x5cfb('0xd')]){logger[_0x5cfb('0x10')]('['+[_0x540c19['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x31e793);var _0x486989=[];_0x31e793[_0x5cfb('0x2b')](function(_0x35d846){_0x486989[_0x5cfb('0x49')](assignTagToIncident(_0x35d846,_0x109b11,_0x49ec60,_0x354e22,_0xc19137));});return Promise['all'](_0x486989)[_0x5cfb('0xc')](function(){_0x562f82();})[_0x5cfb('0x13')](function(){_0x562f82();});}else{_0x562f82();}});});}function getTags(_0x37ed67,_0x4ed35d,_0x1471c4,_0x38dbaa,_0x3789f6,_0x4f227d){return function(_0x3c5488){return new Promise(function(_0x73914d,_0x53020e){var _0x4750b0=[];var _0x133490=_0x38dbaa[_0x5cfb('0x4b')];if(_0x133490&&_0x133490['length']>0x0){_0x4750b0=_[_0x5cfb('0x4c')](_0x133490,_0x5cfb('0x39'));}if(_0x4750b0[_0x5cfb('0xd')]>0x0){return manageTags(_0x37ed67,_0x4750b0,_0x4ed35d,_0x1471c4,_0x3c5488,_0x3789f6,_0x4f227d)[_0x5cfb('0xc')](function(){_0x73914d(_0x3c5488);});}else{_0x73914d(_0x3c5488);}});};}function emit(_0x54946e,_0xe263a,_0x57ca05){var _0x5b1c12=_0x5cfb('0x4d')+_0x5cfb('0x4e')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x5cfb('0x4f');var _0x1356d7={'uri':_0x54946e+_0x5cfb('0x50')+_0x57ca05+_0x5b1c12};io['to'](util['format']('user:%s',_0xe263a))[_0x5cfb('0x51')](_0x5cfb('0x52'),_0x1356d7);}exports['cs']=function(_0x143d39,_0x17cd2d,_0x26d2e9,_0x29a2a0,_0x1488dd,_0x5b2973,_0x58bc1e,_0x2e3bc8){var _0x24f53d={};var _0x2c62c4={'user':_0x5b2973[_0x5cfb('0x53')],'pass':_0x5b2973[_0x5cfb('0x54')]};var _0x6d53a6='sysparm_limit=1';var _0x31a216=_0x5cfb('0x55');_0x5b2973[_0x5cfb('0x56')]=intUtil[_0x5cfb('0x57')](_0x5b2973[_0x5cfb('0x56')]);_0x5b2973[_0x5cfb('0x58')]=intUtil[_0x5cfb('0x57')](_0x5b2973[_0x5cfb('0x58')]);var _0x1075a6=util[_0x5cfb('0x59')]('%s/api/now/table/',_0x5b2973[_0x5cfb('0x56')]);_0x24f53d[_0x5cfb('0x17')]=!_[_0x5cfb('0x5a')](_0x29a2a0)?_0x29a2a0[_0x5cfb('0x5b')]:null;_0x24f53d[_0x5cfb('0x1e')]=_0x5b2973[_0x5cfb('0x5b')];_0x24f53d[_0x5cfb('0x21')]=_0x2e3bc8[_0x5cfb('0x35')]()===_0x5cfb('0x3a')?_0x17cd2d['destcalleridnum']:_0x17cd2d['calleridnum'];_0x24f53d[_0x5cfb('0x5c')]=_0x2e3bc8===_0x5cfb('0x5d')||_0x2e3bc8===_0x5cfb('0x5e')?_0x5cfb('0x5d'):_0x5cfb('0x3a');var _0xea0dd2=util[_0x5cfb('0x59')](_0x5cfb('0x5f'),_0x5b2973[_0x5cfb('0x58')],_0x17cd2d[_0x5cfb('0x60')],md5(_0x17cd2d[_0x5cfb('0x60')]));if(_0x1488dd&&_0x1488dd[_0x5cfb('0x61')]){logger[_0x5cfb('0x10')]('[QUEUE]',_0x5cfb('0x62'));_0x17cd2d[_0x5cfb('0x63')]=_0xea0dd2;}else if(_0x58bc1e&&_0x58bc1e['recordingFormat']&&_0x58bc1e[_0x5cfb('0x64')]!==_0x5cfb('0x65')){logger[_0x5cfb('0x10')](_0x5cfb('0x66'),_0x5cfb('0x62'));_0x17cd2d[_0x5cfb('0x63')]=_0xea0dd2;}else{_0x17cd2d[_0x5cfb('0x63')]='';}return getAdminUser(_0x2e3bc8,_0x2c62c4,_0x24f53d,_0x1075a6,_0x31a216,_0x6d53a6)['then'](getUser(_0x2e3bc8,_0x2c62c4,_0x1075a6,_0x31a216,_0x6d53a6))[_0x5cfb('0xc')](getEndUser(_0x2e3bc8,_0x2c62c4,_0x1075a6,_0x31a216,_0x6d53a6))[_0x5cfb('0xc')](getTicket(_0x2e3bc8,_0x2c62c4,_0x1075a6,_0x26d2e9,_0x17cd2d,_0x31a216))[_0x5cfb('0xc')](function(_0x552817){logger[_0x5cfb('0x10')](util[_0x5cfb('0x59')](_0x5cfb('0x67'),_0x552817[_0x5cfb('0x46')]));logger['info'](util[_0x5cfb('0x59')](_0x5cfb('0x68'),_0x2e3bc8));if(_0x2e3bc8!=='unmanaged'){logger[_0x5cfb('0x10')]('['+[_0x2e3bc8[_0x5cfb('0x11')]()]+']',_0x5cfb('0x69'));emit(_0x5b2973[_0x5cfb('0x56')],_0x29a2a0[_0x5cfb('0x39')],_0x552817[_0x5cfb('0x46')]);}})[_0x5cfb('0x13')](function(_0x3f2122){logger[_0x5cfb('0x1c')]('['+[_0x2e3bc8[_0x5cfb('0x11')]()]+_0x5cfb('0x6a'),util[_0x5cfb('0x6b')](_0x3f2122,{'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 2a9aa19..9a4c790 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 _0x4919=['emit','info','Creating\x20new\x20ticket...','Subjects','assigned_user_id','created_by','description','getString','Descriptions','date_start','slice','replace','duration_minutes','parent_type','parent_name','direction','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','apiKey','toString','base64','Getting\x20agent\x20with\x20name','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','then','length','find','entry_list','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','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','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','string','nameField','customField','toLowerCase','content','type','variable','custom_fields','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','recordingURL','destcalleridname','destcalleridnum','Fields','version','charAt','[OUTBOUND]','lastevent','toUpperCase','isNil','catch','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','POST'];(function(_0x54bfa9,_0x424d55){var _0x160e13=function(_0xc77cb8){while(--_0xc77cb8){_0x54bfa9['push'](_0x54bfa9['shift']());}};_0x160e13(++_0x424d55);}(_0x4919,0xec));var _0x9491=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4919[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9491('0x0'));var rp=require('request-promise');var BPromise=require(_0x9491('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x9491('0x2'));var intUtil=require('./util');var config=require(_0x9491('0x3'));var logger=require(_0x9491('0x4'))('sugarcrm');config[_0x9491('0x5')]=_[_0x9491('0x6')](config[_0x9491('0x5')],{'host':_0x9491('0x7'),'port':0x18eb});var io=require(_0x9491('0x8'))(new Redis(config['redis']));var def={'method':_0x9491('0x9'),'json':!![]};function emit(_0x5be6d4,_0x2c0bcf,_0x2d1dc4){io['to'](_0x5be6d4)[_0x9491('0xa')](_0x2c0bcf,_0x2d1dc4);}function getTicket(_0x240113,_0x2bb1b5,_0x207eaa,_0x743b37,_0x18c624,_0x537d94,_0x2e414d,_0x48f4d4){logger[_0x9491('0xb')](_0x9491('0xc'));var _0x15c6f3=new Date();var _0x89e2ef=[{'name':'name','value':intUtil['getString'](_0x743b37[_0x9491('0xd')],_0x18c624,'\x20')},{'name':_0x9491('0xe'),'value':_0x2bb1b5['id']},{'name':_0x9491('0xf'),'value':_0x2bb1b5['id']},{'name':_0x9491('0x10'),'value':intUtil[_0x9491('0x11')](_0x743b37[_0x9491('0x12')],_0x18c624,'\x0a')},{'name':_0x9491('0x13'),'value':_0x15c6f3['toISOString']()[_0x9491('0x14')](0x0,0x13)[_0x9491('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x9491('0x16'),'value':'15'},{'name':'parent_id','value':_0x207eaa['id']},{'name':_0x9491('0x17'),'value':'Contacts'},{'name':_0x9491('0x18'),'value':_0x207eaa['name']},{'name':_0x9491('0x19'),'value':_0x48f4d4}];if(_0x537d94['length']){_['forEach'](_0x537d94,function(_0x31c038){if(_0x18c624[_0x31c038[_0x9491('0x1a')]]){_0x89e2ef[_0x9491('0x1b')]({'name':_0x31c038[_0x9491('0x1c')],'value':_0x18c624[_0x31c038[_0x9491('0x1a')]]});}});}return request({'form':{'method':_0x9491('0x1d'),'input_type':_0x9491('0x1e'),'response_type':'JSON','rest_data':JSON[_0x9491('0x1f')]({'session':_0x2e414d['id'],'module_name':_0x9491('0x20'),'name_value_list':_0x89e2ef})}});}function getAuth(_0x25b4fa){return util['format'](_0x9491('0x21'),new Buffer(_0x25b4fa[_0x9491('0x22')]+':X')[_0x9491('0x23')](_0x9491('0x24')));}function getServerInfo(_0xc554c8){return request({'form':{'method':'get_server_info','input_type':_0x9491('0x1e'),'response_type':_0x9491('0x1e'),'rest_data':JSON[_0x9491('0x1f')]({'session':_0xc554c8['id']})}});}function getUser(_0x11a03a,_0x2893ee,_0x471989){if(!_['isNil'](_0x2893ee)){logger[_0x9491('0xb')](_0x9491('0x25'),_0x2893ee);return request({'form':{'method':'get_entry_list','input_type':_0x9491('0x1e'),'response_type':_0x9491('0x1e'),'rest_data':JSON[_0x9491('0x1f')]({'session':_0x471989['id'],'module_name':_0x9491('0x26'),'query':util[_0x9491('0x27')](_0x9491('0x28'),_0x2893ee),'order_by':'','offset':'0','select_fields':['id',_0x9491('0x29'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9491('0x2a')](function(_0x4fdd99){if(_0x4fdd99['entry_list'][_0x9491('0x2b')]){var _0x2f586f=_[_0x9491('0x2c')](_0x4fdd99[_0x9491('0x2d')],function(_0x4aa80b){return _0x4aa80b[_0x9491('0x2e')][_0x9491('0x2f')][_0x9491('0x30')]===_0x2893ee;});if(_0x2f586f){logger[_0x9491('0xb')](_0x9491('0x31'));return BPromise[_0x9491('0x32')]({'id':_0x2f586f['name_value_list']['id']['value'],'name':_0x2f586f[_0x9491('0x2e')][_0x9491('0x29')][_0x9491('0x30')]});}}logger[_0x9491('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9491('0x32')]({'id':_0x471989[_0x9491('0x2e')][_0x9491('0x33')][_0x9491('0x30')],'name':_0x471989[_0x9491('0x2e')][_0x9491('0x2f')][_0x9491('0x30')]});});}else{logger['info'](_0x9491('0x34'));return BPromise[_0x9491('0x32')]({'id':_0x471989[_0x9491('0x2e')][_0x9491('0x33')]['value'],'name':_0x471989[_0x9491('0x2e')][_0x9491('0x2f')][_0x9491('0x30')]});}}function getEndUser(_0xf830fd,_0x3a3e9a,_0x350da8,_0x425c10){logger['info'](_0x9491('0x35'),_0x350da8);return request({'form':{'method':_0x9491('0x36'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9491('0x1f')]({'session':_0x425c10['id'],'module_name':_0x9491('0x37'),'query':util[_0x9491('0x27')](_0x9491('0x38'),_0x350da8),'order_by':'','offset':'0','select_fields':['id','name',_0x9491('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9491('0x2a')](function(_0x2706e7){if(_0x2706e7[_0x9491('0x2d')][_0x9491('0x2b')]){var _0x2c45a2=_[_0x9491('0x2c')](_0x2706e7['entry_list'],function(_0x511e86){return _0x511e86['name_value_list']['phone_home'][_0x9491('0x30')]===_0x350da8;});if(_0x2c45a2){logger['info'](_0x9491('0x3a'));return BPromise['resolve']({'id':_0x2c45a2[_0x9491('0x2e')]['id'][_0x9491('0x30')],'name':_0x2c45a2[_0x9491('0x2e')][_0x9491('0x29')][_0x9491('0x30')],'phone':_0x2c45a2[_0x9491('0x2e')][_0x9491('0x39')][_0x9491('0x30')]});}}else{logger[_0x9491('0xb')](_0x9491('0x3b'));return request({'form':{'method':'set_entry','input_type':_0x9491('0x1e'),'response_type':_0x9491('0x1e'),'rest_data':JSON[_0x9491('0x1f')]({'session':_0x425c10['id'],'module_name':_0x9491('0x37'),'name_value_list':[{'name':_0x9491('0x3c'),'value':_0x3a3e9a!==_0x9491('0x3d')?_0x3a3e9a:util[_0x9491('0x27')](_0x9491('0x3e'),_0x350da8)},{'name':_0x9491('0x39'),'value':_0x350da8}]})}})[_0x9491('0x2a')](function(_0x1372bc){logger[_0x9491('0xb')](_0x9491('0x3f'));return BPromise[_0x9491('0x32')]({'id':_0x1372bc['id'],'name':_0x1372bc[_0x9491('0x2d')]['first_name']['value'],'phone':_0x1372bc[_0x9491('0x2d')]['phone_home'][_0x9491('0x30')]});});}});}function request(_0x1d4dc1){logger[_0x9491('0x40')](_0x9491('0x41'),JSON['stringify'](_0x1d4dc1));return rp(_[_0x9491('0x42')](def,_0x1d4dc1));}function getTags(_0x441cf1,_0x4216ee){var _0x126e0f=[];if(_0x441cf1&&_0x441cf1[_0x9491('0x2b')]>0x0){_0x126e0f=_[_0x9491('0x43')](_0x441cf1,_0x4216ee);}return _0x126e0f;}function getCustomFields(_0x519d81,_0x46ac98){var _0x157e61=[];var _0x139ee6={'custom_fields':[]};if(_0x519d81[_0x9491('0x2b')]>0x0){_[_0x9491('0x44')](_0x519d81,function(_0x2f8c7b){if(_0x2f8c7b['type']===_0x9491('0x45')&&_0x2f8c7b[_0x9491('0x46')]&&!_0x2f8c7b[_0x9491('0x47')]){_0x139ee6[_0x2f8c7b[_0x9491('0x46')][_0x9491('0x48')]()]=_0x2f8c7b[_0x9491('0x49')][_0x9491('0x23')]();}else if(_0x2f8c7b[_0x9491('0x4a')]===_0x9491('0x45')&&_0x2f8c7b[_0x9491('0x1c')]&&_0x2f8c7b['customField']){_0x139ee6['custom_fields'][_0x9491('0x1b')]({'id':_0x2f8c7b[_0x9491('0x1c')],'value':_0x2f8c7b['content'][_0x9491('0x23')]()});}else if(_0x2f8c7b['type']===_0x9491('0x4b')&&_0x2f8c7b['variableName']&&_0x2f8c7b[_0x9491('0x1c')]&&_0x2f8c7b[_0x9491('0x47')]){_0x46ac98[_0x2f8c7b[_0x9491('0x1a')]]&&_0x139ee6[_0x9491('0x4c')]['push']({'id':_0x2f8c7b[_0x9491('0x1c')],'value':_0x46ac98[_0x2f8c7b[_0x9491('0x1a')]][_0x9491('0x23')]()});}else if(_0x2f8c7b[_0x9491('0x4a')]===_0x9491('0x4d')&&_0x2f8c7b[_0x9491('0x4e')]&&_0x2f8c7b['Variable'][_0x9491('0x29')]&&_0x2f8c7b['idField']&&_0x2f8c7b['customField']){_0x46ac98[_0x2f8c7b[_0x9491('0x4e')][_0x9491('0x29')][_0x9491('0x48')]()]&&_0x139ee6[_0x9491('0x4c')][_0x9491('0x1b')]({'id':_0x2f8c7b[_0x9491('0x1c')],'value':_0x46ac98[_0x2f8c7b['Variable'][_0x9491('0x29')][_0x9491('0x48')]()]['toString']()});}});}return _0x139ee6;}function getConnection(_0x3c1a2f){return request({'method':_0x9491('0x9'),'form':{'method':_0x9491('0x4f'),'input_type':_0x9491('0x1e'),'response_type':'JSON','rest_data':JSON[_0x9491('0x1f')]({'user_auth':{'user_name':_0x3c1a2f[_0x9491('0x50')],'password':_0x3c1a2f['password'],'encryption':'PLAIN'},'application':_0x9491('0x51')})}})[_0x9491('0x2a')](function(_0x7ba61c){var _0x5be015=_0x7ba61c;if(_0x5be015['id']){def[_0x9491('0x52')]=_0x5be015['id'];return BPromise[_0x9491('0x32')](_0x5be015);}else{throw new Error(util[_0x9491('0x27')](_0x9491('0x53'),_0x3c1a2f['id']));}});}function setRelationship(_0x1a5eca,_0x580b40,_0x111e6a,_0x2bd502){return request({'form':{'method':_0x9491('0x54'),'input_type':_0x9491('0x1e'),'response_type':_0x9491('0x1e'),'rest_data':JSON[_0x9491('0x1f')]({'session':_0x1a5eca['id'],'module_name':'Calls','module_id':_0x111e6a['id'],'link_field_name':_0x2bd502,'related_ids':[_0x580b40['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4d2550,_0x36fd1e,_0x36adf7,_0x13fbac,_0xb5f528,_0x21e232){var _0x2c3ee2,_0x2310ae,_0x45214f,_0x52b4b6;_0x21e232['remoteUri']=intUtil['stripTrailingSlash'](_0x21e232[_0x9491('0x55')]);_0x21e232[_0x9491('0x56')]=intUtil[_0x9491('0x57')](_0x21e232[_0x9491('0x56')]);def[_0x9491('0x58')]=util[_0x9491('0x27')](_0x9491('0x59'),_0x21e232[_0x9491('0x55')]);if(_0xb5f528&&_0xb5f528[_0x9491('0x5a')]){logger['info']('[QUEUE]',_0x9491('0x5b'));_0x36fd1e['recordingURL']=util[_0x9491('0x27')](_0x9491('0x5c'),_0x21e232['serverUrl'],_0x36fd1e[_0x9491('0x5d')],md5(_0x36fd1e[_0x9491('0x5d')]));}else{_0x36fd1e['recordingURL']='';}return getConnection(_0x21e232)['then'](function(_0x151bdf){_0x52b4b6=_0x151bdf;return getUser(_0x21e232,_0x13fbac[_0x9491('0x29')],_0x52b4b6);})['then'](function(_0x166929){_0x2c3ee2=_0x166929;logger[_0x9491('0xb')](_0x9491('0x5e'),_0x2c3ee2['id']);return getEndUser(_0x21e232,_0x36fd1e[_0x9491('0x5f')],_0x36fd1e[_0x9491('0x60')],_0x52b4b6);})[_0x9491('0x2a')](function(_0x3bf1c7){_0x2310ae=_0x3bf1c7;logger[_0x9491('0xb')](_0x9491('0x61'),_0x2310ae['id']);return getTicket(_0x21e232,_0x2c3ee2,_0x2310ae,_0x36adf7,_0x36fd1e,_0x36adf7['Fields'],_0x52b4b6,_0x9491('0x62'));})[_0x9491('0x2a')](function(_0x369836){_0x45214f=_0x369836;logger[_0x9491('0xb')](_0x9491('0x63'));logger[_0x9491('0xb')](_0x9491('0x64'),_0x45214f['id']);return setRelationship(_0x52b4b6,_0x2c3ee2,_0x45214f,_0x9491('0x65'));})['then'](function(){return setRelationship(_0x52b4b6,_0x2310ae,_0x45214f,_0x9491('0x66'));})['then'](function(){return getServerInfo(_0x52b4b6);})['then'](function(_0x2cfaef){var _0x10421f=parseInt(_0x2cfaef['version']['charAt'](0x0));var _0x3f4904=util[_0x9491('0x27')](_0x9491('0x67'),_0x21e232[_0x9491('0x55')],_0x45214f['id']);if(_0x10421f>0x6){_0x3f4904=util[_0x9491('0x27')](_0x9491('0x68'),_0x21e232[_0x9491('0x55')],_0x45214f['id']);}logger[_0x9491('0xb')](_0x9491('0x69'),_0x9491('0x6a'));emit(util[_0x9491('0x27')](_0x9491('0x6b'),_0x13fbac[_0x9491('0x29')]),_0x9491('0x6c'),{'uri':_0x3f4904});})['catch'](function(_0x290b2f){logger[_0x9491('0x6d')](_0x9491('0x69'),JSON[_0x9491('0x1f')](_0x290b2f));});};exports[_0x9491('0x6e')]=function(_0x1ac898,_0x45ebd6,_0x3b2fe8,_0x54c9e1,_0x438921,_0x14b9b1,_0x387733){var _0x5c8260,_0xa723fe,_0x3dc8e8,_0x1fc8a1;_0x14b9b1['remoteUri']=intUtil['stripTrailingSlash'](_0x14b9b1[_0x9491('0x55')]);_0x14b9b1[_0x9491('0x56')]=intUtil[_0x9491('0x57')](_0x14b9b1[_0x9491('0x56')]);def[_0x9491('0x58')]=util[_0x9491('0x27')](_0x9491('0x59'),_0x14b9b1[_0x9491('0x55')]);if(_0x387733&&_0x387733['recordingFormat']&&_0x387733[_0x9491('0x6f')]!=='none'){logger[_0x9491('0xb')]('[OUTBOUND]',_0x9491('0x5b'));_0x45ebd6[_0x9491('0x70')]=util[_0x9491('0x27')](_0x9491('0x5c'),_0x14b9b1[_0x9491('0x56')],_0x45ebd6[_0x9491('0x5d')],md5(_0x45ebd6[_0x9491('0x5d')]));}return getConnection(_0x14b9b1)[_0x9491('0x2a')](function(_0x353b69){_0x1fc8a1=_0x353b69;return getUser(_0x14b9b1,_0x54c9e1[_0x9491('0x29')],_0x1fc8a1);})['then'](function(_0x3e8d9a){_0x5c8260=_0x3e8d9a;logger[_0x9491('0xb')](_0x9491('0x5e'),_0x5c8260['id']);return getEndUser(_0x14b9b1,_0x45ebd6[_0x9491('0x71')],_0x45ebd6[_0x9491('0x72')],_0x1fc8a1);})['then'](function(_0x117d51){_0xa723fe=_0x117d51;logger[_0x9491('0xb')]('The\x20Enduser\x20ID\x20is:',_0xa723fe['id']);return getTicket(_0x14b9b1,_0x5c8260,_0xa723fe,_0x3b2fe8,_0x45ebd6,_0x3b2fe8[_0x9491('0x73')],_0x1fc8a1,'Outbound');})[_0x9491('0x2a')](function(_0x5510b6){_0x3dc8e8=_0x5510b6;logger[_0x9491('0xb')](_0x9491('0x63'));logger[_0x9491('0xb')](_0x9491('0x64'),_0x3dc8e8['id']);return setRelationship(_0x1fc8a1,_0x5c8260,_0x3dc8e8,_0x9491('0x65'));})[_0x9491('0x2a')](function(){return setRelationship(_0x1fc8a1,_0xa723fe,_0x3dc8e8,'contacts');})[_0x9491('0x2a')](function(){return getServerInfo(_0x1fc8a1);})[_0x9491('0x2a')](function(_0x5d17ea){var _0x2c6cbd=parseInt(_0x5d17ea[_0x9491('0x74')][_0x9491('0x75')](0x0));var _0x391f3c=util[_0x9491('0x27')](_0x9491('0x67'),_0x14b9b1[_0x9491('0x55')],_0x3dc8e8['id']);if(_0x2c6cbd>0x6){_0x391f3c=util[_0x9491('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x14b9b1[_0x9491('0x55')],_0x3dc8e8['id']);}logger[_0x9491('0xb')](_0x9491('0x76'),_0x9491('0x6a'));emit(util[_0x9491('0x27')](_0x9491('0x6b'),_0x54c9e1[_0x9491('0x29')]),_0x9491('0x6c'),{'uri':_0x391f3c});})['catch'](function(_0x80f770){logger['error']('[OUTBOUND]',JSON[_0x9491('0x1f')](_0x80f770));});};exports['unmanaged']=function(_0x3a8381,_0x40a0b6,_0x1ee5c1,_0x563c67,_0x4f3092,_0x5a5397){var _0x494f34,_0x535376,_0x39ba97,_0x1b34d5;_0x5a5397[_0x9491('0x55')]=intUtil[_0x9491('0x57')](_0x5a5397['remoteUri']);_0x5a5397[_0x9491('0x56')]=intUtil['stripTrailingSlash'](_0x5a5397[_0x9491('0x56')]);def[_0x9491('0x58')]=util[_0x9491('0x27')]('%s/service/v4_1/rest.php',_0x5a5397[_0x9491('0x55')]);if(_0x4f3092&&_0x4f3092['monitor_format']){logger[_0x9491('0xb')]('['+_0x40a0b6[_0x9491('0x77')][_0x9491('0x78')]()+']',_0x9491('0x5b'));_0x40a0b6['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a5397[_0x9491('0x56')],_0x40a0b6[_0x9491('0x5d')],md5(_0x40a0b6[_0x9491('0x5d')]));}else{_0x40a0b6[_0x9491('0x70')]='';}return getConnection(_0x5a5397)[_0x9491('0x2a')](function(_0x1c9c12){_0x1b34d5=_0x1c9c12;if(!_[_0x9491('0x79')](_0x563c67)){return getUser(_0x5a5397,_0x563c67['name'],_0x1b34d5);}else{return getUser(_0x5a5397,null,_0x1b34d5);}})[_0x9491('0x2a')](function(_0x11ef70){_0x494f34=_0x11ef70;logger[_0x9491('0xb')](_0x9491('0x5e'),_0x494f34['id']);return getEndUser(_0x5a5397,_0x40a0b6[_0x9491('0x5f')],_0x40a0b6[_0x9491('0x60')],_0x1b34d5);})[_0x9491('0x2a')](function(_0x300f69){_0x535376=_0x300f69;logger[_0x9491('0xb')](_0x9491('0x61'),_0x535376['id']);return getTicket(_0x5a5397,_0x494f34,_0x535376,_0x1ee5c1,_0x40a0b6,_0x1ee5c1['Fields'],_0x1b34d5,_0x9491('0x62'));})[_0x9491('0x2a')](function(_0x1ae055){_0x39ba97=_0x1ae055;logger[_0x9491('0xb')](_0x9491('0x63'));logger[_0x9491('0xb')](_0x9491('0x64'),_0x39ba97['id']);return setRelationship(_0x1b34d5,_0x494f34,_0x39ba97,_0x9491('0x65'));})[_0x9491('0x2a')](function(){return setRelationship(_0x1b34d5,_0x535376,_0x39ba97,'contacts');})[_0x9491('0x2a')](function(){return getServerInfo(_0x1b34d5);})[_0x9491('0x7a')](function(_0x46261b){logger[_0x9491('0x6d')]('['+_0x40a0b6[_0x9491('0x77')][_0x9491('0x78')]()+']',JSON[_0x9491('0x1f')](_0x46261b));});}; \ No newline at end of file +var _0x7576=['socket.io-emitter','redis','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','info','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','customVariable','Variable','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','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','uri','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','[OUTBOUND]','user:%s','trigger:browser:url','lastevent','toUpperCase','isNil','contacts','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost'];(function(_0x58afc5,_0x54662f){var _0x4cd95e=function(_0xd54cd9){while(--_0xd54cd9){_0x58afc5['push'](_0x58afc5['shift']());}};_0x4cd95e(++_0x54662f);}(_0x7576,0xf8));var _0x6757=function(_0x37df1b,_0x5f2b7f){_0x37df1b=_0x37df1b-0x0;var _0x2004cc=_0x7576[_0x37df1b];return _0x2004cc;};'use strict';var _=require(_0x6757('0x0'));var rp=require(_0x6757('0x1'));var BPromise=require(_0x6757('0x2'));var md5=require(_0x6757('0x3'));var util=require(_0x6757('0x4'));var Redis=require(_0x6757('0x5'));var intUtil=require(_0x6757('0x6'));var config=require(_0x6757('0x7'));var logger=require(_0x6757('0x8'))(_0x6757('0x9'));config['redis']=_[_0x6757('0xa')](config['redis'],{'host':_0x6757('0xb'),'port':0x18eb});var io=require(_0x6757('0xc'))(new Redis(config[_0x6757('0xd')]));var def={'method':_0x6757('0xe'),'json':!![]};function emit(_0x386587,_0x9c140d,_0x2b930b){io['to'](_0x386587)[_0x6757('0xf')](_0x9c140d,_0x2b930b);}function getTicket(_0x212702,_0x5bc757,_0x100f0f,_0x12282a,_0x3fb70e,_0x386c71,_0x3cc87c,_0x5f08f8){logger['info'](_0x6757('0x10'));var _0x2afa7b=new Date();var _0x3ed46f=[{'name':_0x6757('0x11'),'value':intUtil[_0x6757('0x12')](_0x12282a[_0x6757('0x13')],_0x3fb70e,'\x20')},{'name':_0x6757('0x14'),'value':_0x5bc757['id']},{'name':'created_by','value':_0x5bc757['id']},{'name':_0x6757('0x15'),'value':intUtil[_0x6757('0x12')](_0x12282a[_0x6757('0x16')],_0x3fb70e,'\x0a')},{'name':_0x6757('0x17'),'value':_0x2afa7b[_0x6757('0x18')]()[_0x6757('0x19')](0x0,0x13)[_0x6757('0x1a')]('T','\x20')},{'name':_0x6757('0x1b'),'value':'0'},{'name':_0x6757('0x1c'),'value':'15'},{'name':_0x6757('0x1d'),'value':_0x100f0f['id']},{'name':_0x6757('0x1e'),'value':_0x6757('0x1f')},{'name':_0x6757('0x20'),'value':_0x100f0f['name']},{'name':_0x6757('0x21'),'value':_0x5f08f8}];if(_0x386c71[_0x6757('0x22')]){_[_0x6757('0x23')](_0x386c71,function(_0x11d9c9){if(_0x3fb70e[_0x11d9c9['variableName']]){_0x3ed46f[_0x6757('0x24')]({'name':_0x11d9c9[_0x6757('0x25')],'value':_0x3fb70e[_0x11d9c9[_0x6757('0x26')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x6757('0x27'),'response_type':_0x6757('0x27'),'rest_data':JSON[_0x6757('0x28')]({'session':_0x3cc87c['id'],'module_name':_0x6757('0x29'),'name_value_list':_0x3ed46f})}});}function getAuth(_0xb5b710){return util[_0x6757('0x2a')](_0x6757('0x2b'),new Buffer(_0xb5b710[_0x6757('0x2c')]+':X')[_0x6757('0x2d')](_0x6757('0x2e')));}function getServerInfo(_0x2a34a3){return request({'form':{'method':'get_server_info','input_type':_0x6757('0x27'),'response_type':_0x6757('0x27'),'rest_data':JSON['stringify']({'session':_0x2a34a3['id']})}});}function getUser(_0x3f7bdd,_0x3f959a,_0x2fbe5a){if(!_['isNil'](_0x3f959a)){logger['info']('Getting\x20agent\x20with\x20name',_0x3f959a);return request({'form':{'method':_0x6757('0x2f'),'input_type':_0x6757('0x27'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2fbe5a['id'],'module_name':_0x6757('0x30'),'query':util[_0x6757('0x2a')](_0x6757('0x31'),_0x3f959a),'order_by':'','offset':'0','select_fields':['id',_0x6757('0x11'),_0x6757('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6757('0x33')](function(_0x45e58f){if(_0x45e58f[_0x6757('0x34')][_0x6757('0x22')]){var _0x4c9825=_['find'](_0x45e58f['entry_list'],function(_0x4a12b1){return _0x4a12b1[_0x6757('0x35')][_0x6757('0x32')][_0x6757('0x36')]===_0x3f959a;});if(_0x4c9825){logger['info'](_0x6757('0x37'));return BPromise['resolve']({'id':_0x4c9825[_0x6757('0x35')]['id'][_0x6757('0x36')],'name':_0x4c9825[_0x6757('0x35')][_0x6757('0x11')][_0x6757('0x36')]});}}logger['info'](_0x6757('0x38'));return BPromise[_0x6757('0x39')]({'id':_0x2fbe5a['name_value_list'][_0x6757('0x3a')][_0x6757('0x36')],'name':_0x2fbe5a['name_value_list'][_0x6757('0x32')][_0x6757('0x36')]});});}else{logger['info'](_0x6757('0x3b'));return BPromise['resolve']({'id':_0x2fbe5a['name_value_list'][_0x6757('0x3a')][_0x6757('0x36')],'name':_0x2fbe5a[_0x6757('0x35')][_0x6757('0x32')]['value']});}}function getEndUser(_0x134953,_0x4a30a5,_0xbd9133,_0x5a57c5){logger[_0x6757('0x3c')](_0x6757('0x3d'),_0xbd9133);return request({'form':{'method':_0x6757('0x2f'),'input_type':_0x6757('0x27'),'response_type':_0x6757('0x27'),'rest_data':JSON[_0x6757('0x28')]({'session':_0x5a57c5['id'],'module_name':'Contacts','query':util[_0x6757('0x2a')](_0x6757('0x3e'),_0xbd9133),'order_by':'','offset':'0','select_fields':['id',_0x6757('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6757('0x33')](function(_0x40dc63){if(_0x40dc63[_0x6757('0x34')][_0x6757('0x22')]){var _0x34e1ae=_[_0x6757('0x3f')](_0x40dc63[_0x6757('0x34')],function(_0x15f2ce){return _0x15f2ce[_0x6757('0x35')][_0x6757('0x40')][_0x6757('0x36')]===_0xbd9133;});if(_0x34e1ae){logger[_0x6757('0x3c')](_0x6757('0x41'));return BPromise[_0x6757('0x39')]({'id':_0x34e1ae['name_value_list']['id']['value'],'name':_0x34e1ae[_0x6757('0x35')][_0x6757('0x11')][_0x6757('0x36')],'phone':_0x34e1ae['name_value_list'][_0x6757('0x40')][_0x6757('0x36')]});}}else{logger[_0x6757('0x3c')](_0x6757('0x42'));return request({'form':{'method':'set_entry','input_type':_0x6757('0x27'),'response_type':_0x6757('0x27'),'rest_data':JSON[_0x6757('0x28')]({'session':_0x5a57c5['id'],'module_name':'Contacts','name_value_list':[{'name':_0x6757('0x43'),'value':_0x4a30a5!==_0x6757('0x44')?_0x4a30a5:util[_0x6757('0x2a')](_0x6757('0x45'),_0xbd9133)},{'name':_0x6757('0x40'),'value':_0xbd9133}]})}})[_0x6757('0x33')](function(_0x3de31f){logger[_0x6757('0x3c')]('Enduser\x20created.');return BPromise[_0x6757('0x39')]({'id':_0x3de31f['id'],'name':_0x3de31f[_0x6757('0x34')][_0x6757('0x43')]['value'],'phone':_0x3de31f[_0x6757('0x34')][_0x6757('0x40')]['value']});});}});}function request(_0x5633eb){logger[_0x6757('0x46')](_0x6757('0x47'),JSON['stringify'](_0x5633eb));return rp(_[_0x6757('0x48')](def,_0x5633eb));}function getTags(_0x225002,_0x524d74){var _0x1b76c3=[];if(_0x225002&&_0x225002[_0x6757('0x22')]>0x0){_0x1b76c3=_[_0x6757('0x49')](_0x225002,_0x524d74);}return _0x1b76c3;}function getCustomFields(_0x1cc08f,_0x5f9d5){var _0xacae03=[];var _0x1a84c6={'custom_fields':[]};if(_0x1cc08f['length']>0x0){_[_0x6757('0x23')](_0x1cc08f,function(_0x41675d){if(_0x41675d[_0x6757('0x4a')]===_0x6757('0x4b')&&_0x41675d['nameField']&&!_0x41675d[_0x6757('0x4c')]){_0x1a84c6[_0x41675d[_0x6757('0x4d')][_0x6757('0x4e')]()]=_0x41675d[_0x6757('0x4f')][_0x6757('0x2d')]();}else if(_0x41675d[_0x6757('0x4a')]===_0x6757('0x4b')&&_0x41675d['idField']&&_0x41675d[_0x6757('0x4c')]){_0x1a84c6[_0x6757('0x50')][_0x6757('0x24')]({'id':_0x41675d[_0x6757('0x25')],'value':_0x41675d[_0x6757('0x4f')][_0x6757('0x2d')]()});}else if(_0x41675d[_0x6757('0x4a')]===_0x6757('0x51')&&_0x41675d[_0x6757('0x26')]&&_0x41675d[_0x6757('0x25')]&&_0x41675d[_0x6757('0x4c')]){_0x5f9d5[_0x41675d['variableName']]&&_0x1a84c6[_0x6757('0x50')]['push']({'id':_0x41675d[_0x6757('0x25')],'value':_0x5f9d5[_0x41675d['variableName']][_0x6757('0x2d')]()});}else if(_0x41675d[_0x6757('0x4a')]===_0x6757('0x52')&&_0x41675d[_0x6757('0x53')]&&_0x41675d[_0x6757('0x53')]['name']&&_0x41675d[_0x6757('0x25')]&&_0x41675d[_0x6757('0x4c')]){_0x5f9d5[_0x41675d['Variable'][_0x6757('0x11')][_0x6757('0x4e')]()]&&_0x1a84c6['custom_fields'][_0x6757('0x24')]({'id':_0x41675d[_0x6757('0x25')],'value':_0x5f9d5[_0x41675d[_0x6757('0x53')][_0x6757('0x11')][_0x6757('0x4e')]()]['toString']()});}});}return _0x1a84c6;}function getConnection(_0x5673bd){return request({'method':'POST','form':{'method':_0x6757('0x54'),'input_type':_0x6757('0x27'),'response_type':'JSON','rest_data':JSON[_0x6757('0x28')]({'user_auth':{'user_name':_0x5673bd[_0x6757('0x55')],'password':_0x5673bd[_0x6757('0x56')],'encryption':_0x6757('0x57')},'application':_0x6757('0x58')})}})['then'](function(_0x38f726){var _0x35c21f=_0x38f726;if(_0x35c21f['id']){def[_0x6757('0x59')]=_0x35c21f['id'];return BPromise[_0x6757('0x39')](_0x35c21f);}else{throw new Error(util['format'](_0x6757('0x5a'),_0x5673bd['id']));}});}function setRelationship(_0x11ac9a,_0x12212d,_0x28b6d7,_0x89bce3){return request({'form':{'method':_0x6757('0x5b'),'input_type':_0x6757('0x27'),'response_type':_0x6757('0x27'),'rest_data':JSON['stringify']({'session':_0x11ac9a['id'],'module_name':_0x6757('0x29'),'module_id':_0x28b6d7['id'],'link_field_name':_0x89bce3,'related_ids':[_0x12212d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6757('0x5c')]=function(_0x2fcbeb,_0x225cac,_0x1f7c51,_0x1acbb5,_0x48deb8,_0x399407){var _0x4d5679,_0x4e67c6,_0x19397d,_0x20e12c;_0x399407[_0x6757('0x5d')]=intUtil[_0x6757('0x5e')](_0x399407['remoteUri']);_0x399407[_0x6757('0x5f')]=intUtil[_0x6757('0x5e')](_0x399407[_0x6757('0x5f')]);def['uri']=util[_0x6757('0x2a')](_0x6757('0x60'),_0x399407[_0x6757('0x5d')]);if(_0x48deb8&&_0x48deb8['monitor_format']){logger['info'](_0x6757('0x61'),_0x6757('0x62'));_0x225cac[_0x6757('0x63')]=util[_0x6757('0x2a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x399407[_0x6757('0x5f')],_0x225cac[_0x6757('0x64')],md5(_0x225cac[_0x6757('0x64')]));}else{_0x225cac['recordingURL']='';}return getConnection(_0x399407)[_0x6757('0x33')](function(_0x42ddb3){_0x20e12c=_0x42ddb3;return getUser(_0x399407,_0x1acbb5[_0x6757('0x11')],_0x20e12c);})[_0x6757('0x33')](function(_0x5689ae){_0x4d5679=_0x5689ae;logger[_0x6757('0x3c')](_0x6757('0x65'),_0x4d5679['id']);return getEndUser(_0x399407,_0x225cac[_0x6757('0x66')],_0x225cac[_0x6757('0x67')],_0x20e12c);})['then'](function(_0x25c97c){_0x4e67c6=_0x25c97c;logger[_0x6757('0x3c')]('The\x20Enduser\x20ID\x20is:',_0x4e67c6['id']);return getTicket(_0x399407,_0x4d5679,_0x4e67c6,_0x1f7c51,_0x225cac,_0x1f7c51[_0x6757('0x68')],_0x20e12c,_0x6757('0x69'));})[_0x6757('0x33')](function(_0x54a2a5){_0x19397d=_0x54a2a5;logger[_0x6757('0x3c')](_0x6757('0x6a'));logger[_0x6757('0x3c')](_0x6757('0x6b'),_0x19397d['id']);return setRelationship(_0x20e12c,_0x4d5679,_0x19397d,_0x6757('0x6c'));})['then'](function(){return setRelationship(_0x20e12c,_0x4e67c6,_0x19397d,'contacts');})[_0x6757('0x33')](function(){return getServerInfo(_0x20e12c);})[_0x6757('0x33')](function(_0x4e133e){var _0x377158=parseInt(_0x4e133e[_0x6757('0x6d')][_0x6757('0x6e')](0x0));var _0x11fb10=util[_0x6757('0x2a')](_0x6757('0x6f'),_0x399407['remoteUri'],_0x19397d['id']);if(_0x377158>0x6){_0x11fb10=util[_0x6757('0x2a')](_0x6757('0x70'),_0x399407['remoteUri'],_0x19397d['id']);}logger[_0x6757('0x3c')](_0x6757('0x61'),_0x6757('0x71'));emit(util[_0x6757('0x2a')]('user:%s',_0x1acbb5['name']),'trigger:browser:url',{'uri':_0x11fb10});})[_0x6757('0x72')](function(_0x137a0f){logger[_0x6757('0x73')](_0x6757('0x61'),JSON[_0x6757('0x28')](_0x137a0f));});};exports['outbound']=function(_0x34129b,_0x2f56ff,_0x385455,_0x485a7c,_0x46aa10,_0xc8266b,_0x56dbb9){var _0x14ab08,_0x15e89d,_0x1cf99b,_0x169328;_0xc8266b[_0x6757('0x5d')]=intUtil[_0x6757('0x5e')](_0xc8266b[_0x6757('0x5d')]);_0xc8266b[_0x6757('0x5f')]=intUtil[_0x6757('0x5e')](_0xc8266b['serverUrl']);def[_0x6757('0x74')]=util[_0x6757('0x2a')]('%s/service/v4_1/rest.php',_0xc8266b[_0x6757('0x5d')]);if(_0x56dbb9&&_0x56dbb9[_0x6757('0x75')]&&_0x56dbb9[_0x6757('0x75')]!=='none'){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2f56ff['recordingURL']=util[_0x6757('0x2a')](_0x6757('0x76'),_0xc8266b[_0x6757('0x5f')],_0x2f56ff[_0x6757('0x64')],md5(_0x2f56ff[_0x6757('0x64')]));}return getConnection(_0xc8266b)[_0x6757('0x33')](function(_0x425090){_0x169328=_0x425090;return getUser(_0xc8266b,_0x485a7c[_0x6757('0x11')],_0x169328);})[_0x6757('0x33')](function(_0x303d6b){_0x14ab08=_0x303d6b;logger[_0x6757('0x3c')](_0x6757('0x65'),_0x14ab08['id']);return getEndUser(_0xc8266b,_0x2f56ff[_0x6757('0x77')],_0x2f56ff[_0x6757('0x78')],_0x169328);})[_0x6757('0x33')](function(_0x1096dd){_0x15e89d=_0x1096dd;logger[_0x6757('0x3c')](_0x6757('0x79'),_0x15e89d['id']);return getTicket(_0xc8266b,_0x14ab08,_0x15e89d,_0x385455,_0x2f56ff,_0x385455['Fields'],_0x169328,_0x6757('0x7a'));})[_0x6757('0x33')](function(_0x105edf){_0x1cf99b=_0x105edf;logger[_0x6757('0x3c')](_0x6757('0x6a'));logger[_0x6757('0x3c')](_0x6757('0x6b'),_0x1cf99b['id']);return setRelationship(_0x169328,_0x14ab08,_0x1cf99b,'users');})[_0x6757('0x33')](function(){return setRelationship(_0x169328,_0x15e89d,_0x1cf99b,'contacts');})[_0x6757('0x33')](function(){return getServerInfo(_0x169328);})[_0x6757('0x33')](function(_0x13472d){var _0x4f0f73=parseInt(_0x13472d['version']['charAt'](0x0));var _0x94a4d2=util[_0x6757('0x2a')](_0x6757('0x6f'),_0xc8266b[_0x6757('0x5d')],_0x1cf99b['id']);if(_0x4f0f73>0x6){_0x94a4d2=util['format'](_0x6757('0x70'),_0xc8266b[_0x6757('0x5d')],_0x1cf99b['id']);}logger['info'](_0x6757('0x7b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6757('0x2a')](_0x6757('0x7c'),_0x485a7c[_0x6757('0x11')]),_0x6757('0x7d'),{'uri':_0x94a4d2});})[_0x6757('0x72')](function(_0x32d940){logger[_0x6757('0x73')]('[OUTBOUND]',JSON[_0x6757('0x28')](_0x32d940));});};exports['unmanaged']=function(_0x3916a3,_0x1307d0,_0x2e4b34,_0x222b34,_0xd280f2,_0x168f7b){var _0x305a88,_0x270c08,_0x318f18,_0x7c9462;_0x168f7b[_0x6757('0x5d')]=intUtil[_0x6757('0x5e')](_0x168f7b[_0x6757('0x5d')]);_0x168f7b[_0x6757('0x5f')]=intUtil[_0x6757('0x5e')](_0x168f7b[_0x6757('0x5f')]);def[_0x6757('0x74')]=util['format'](_0x6757('0x60'),_0x168f7b[_0x6757('0x5d')]);if(_0xd280f2&&_0xd280f2['monitor_format']){logger[_0x6757('0x3c')]('['+_0x1307d0[_0x6757('0x7e')][_0x6757('0x7f')]()+']',_0x6757('0x62'));_0x1307d0['recordingURL']=util['format'](_0x6757('0x76'),_0x168f7b[_0x6757('0x5f')],_0x1307d0[_0x6757('0x64')],md5(_0x1307d0[_0x6757('0x64')]));}else{_0x1307d0[_0x6757('0x63')]='';}return getConnection(_0x168f7b)[_0x6757('0x33')](function(_0xd28e04){_0x7c9462=_0xd28e04;if(!_[_0x6757('0x80')](_0x222b34)){return getUser(_0x168f7b,_0x222b34[_0x6757('0x11')],_0x7c9462);}else{return getUser(_0x168f7b,null,_0x7c9462);}})['then'](function(_0x54077a){_0x305a88=_0x54077a;logger[_0x6757('0x3c')]('The\x20User\x20ID\x20is:',_0x305a88['id']);return getEndUser(_0x168f7b,_0x1307d0[_0x6757('0x66')],_0x1307d0[_0x6757('0x67')],_0x7c9462);})[_0x6757('0x33')](function(_0x5e4b3c){_0x270c08=_0x5e4b3c;logger[_0x6757('0x3c')](_0x6757('0x79'),_0x270c08['id']);return getTicket(_0x168f7b,_0x305a88,_0x270c08,_0x2e4b34,_0x1307d0,_0x2e4b34['Fields'],_0x7c9462,_0x6757('0x69'));})[_0x6757('0x33')](function(_0x2eecb9){_0x318f18=_0x2eecb9;logger[_0x6757('0x3c')](_0x6757('0x6a'));logger[_0x6757('0x3c')](_0x6757('0x6b'),_0x318f18['id']);return setRelationship(_0x7c9462,_0x305a88,_0x318f18,_0x6757('0x6c'));})[_0x6757('0x33')](function(){return setRelationship(_0x7c9462,_0x270c08,_0x318f18,_0x6757('0x81'));})[_0x6757('0x33')](function(){return getServerInfo(_0x7c9462);})['catch'](function(_0x188cdd){logger['error']('['+_0x1307d0[_0x6757('0x7e')][_0x6757('0x7f')]()+']',JSON['stringify'](_0x188cdd));});}; \ 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 d626b2d..c021539 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 _0xd8f9=['key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','type','string','content','variable','push','variableName','toString','customVariable','Variable','name','toLowerCase','keyType'];(function(_0xc55c68,_0x292a8b){var _0x148523=function(_0x184de9){while(--_0x184de9){_0xc55c68['push'](_0xc55c68['shift']());}};_0x148523(++_0x292a8b);}(_0xd8f9,0x1c4));var _0x9d8f=function(_0x322630,_0x10325d){_0x322630=_0x322630-0x0;var _0x50b8b2=_0xd8f9[_0x322630];return _0x50b8b2;};'use strict';var _=require(_0x9d8f('0x0'));var util=require(_0x9d8f('0x1'));exports[_0x9d8f('0x2')]=function(_0x5a490a,_0x55162e,_0x1f3251){var _0x69c545=[];if(_0x5a490a[_0x9d8f('0x3')]>0x0){var _0x9254a0=_['sortBy'](_0x5a490a,['id']);for(var _0xd1cec4=0x0;_0xd1cec4<_0x9254a0[_0x9d8f('0x3')];_0xd1cec4++){var _0x15a4a8=_0x9254a0[_0xd1cec4];if(_0x15a4a8[_0x9d8f('0x4')]===_0x9d8f('0x5')){_0x69c545['push'](_0x15a4a8[_0x9d8f('0x6')]);}else if(_0x15a4a8[_0x9d8f('0x4')]===_0x9d8f('0x7')&&_0x15a4a8['variableName']){_0x55162e[_0x15a4a8['variableName']]&&_0x69c545[_0x9d8f('0x8')](_0x55162e[_0x15a4a8[_0x9d8f('0x9')]][_0x9d8f('0xa')]());}else if(_0x15a4a8['type']===_0x9d8f('0xb')&&_0x15a4a8[_0x9d8f('0xc')]&&_0x15a4a8[_0x9d8f('0xc')][_0x9d8f('0xd')]){_0x55162e[_0x15a4a8['Variable']['name'][_0x9d8f('0xe')]()]&&_0x69c545[_0x9d8f('0x8')](_0x55162e[_0x15a4a8[_0x9d8f('0xc')][_0x9d8f('0xd')][_0x9d8f('0xe')]()][_0x9d8f('0xa')]());}else if(_0x15a4a8[_0x9d8f('0x4')]==='keyValue'){if(_0x15a4a8[_0x9d8f('0xf')]==='string'&&_0x15a4a8[_0x9d8f('0x10')]){_0x69c545['push'](util[_0x9d8f('0x11')]('%s:\x20%s',_0x15a4a8[_0x9d8f('0x10')],_0x15a4a8[_0x9d8f('0x12')]));}else if(_0x15a4a8[_0x9d8f('0xf')]===_0x9d8f('0x7')&&_0x15a4a8[_0x9d8f('0x9')]&&_0x15a4a8['key']){_0x55162e[_0x15a4a8[_0x9d8f('0x9')]]&&_0x69c545[_0x9d8f('0x8')](util['format'](_0x9d8f('0x13'),_0x15a4a8['key'],_0x55162e[_0x15a4a8[_0x9d8f('0x9')]]));}else if(_0x15a4a8[_0x9d8f('0xf')]===_0x9d8f('0xb')&&_0x15a4a8[_0x9d8f('0xc')]&&_0x15a4a8[_0x9d8f('0xc')]['name']&&_0x15a4a8[_0x9d8f('0x10')]){_0x55162e[_0x15a4a8[_0x9d8f('0xc')][_0x9d8f('0xd')]['toLowerCase']()]&&_0x69c545[_0x9d8f('0x8')](util[_0x9d8f('0x11')]('%s:\x20%s',_0x15a4a8[_0x9d8f('0x10')],_0x55162e[_0x15a4a8[_0x9d8f('0xc')][_0x9d8f('0xd')][_0x9d8f('0xe')]()]));}}}}return _0x69c545[_0x9d8f('0x14')](_0x1f3251);};exports[_0x9d8f('0x15')]=function(_0x434d28){var _0x45afbd=_0x434d28[_0x9d8f('0x16')](-0x1);if(_0x45afbd==='/'){_0x434d28=_0x434d28['substring'](0x0,_0x434d28[_0x9d8f('0x17')](_0x45afbd));}return _0x434d28;};exports[_0x9d8f('0x18')]=function(_0x523552){if(!_[_0x9d8f('0x19')](_0x523552)&&_0x523552!==''){var _0x3c62ae=/^(([^<>()\[\]\\.,;:\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 _0x3c62ae['test'](String(_0x523552)[_0x9d8f('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xb777=['key','format','%s:\x20%s','keyContent','keyType','stripTrailingSlash','slice','validateEmail','isNil','test','lodash','getString','length','sortBy','push','type','variable','variableName','customVariable','name','Variable','toLowerCase','string'];(function(_0x2d16d8,_0x295ba2){var _0x40e2bf=function(_0x45c1cf){while(--_0x45c1cf){_0x2d16d8['push'](_0x2d16d8['shift']());}};_0x40e2bf(++_0x295ba2);}(_0xb777,0xf0));var _0x7b77=function(_0x494986,_0x4debb8){_0x494986=_0x494986-0x0;var _0x1c805b=_0xb777[_0x494986];return _0x1c805b;};'use strict';var _=require(_0x7b77('0x0'));var util=require('util');exports[_0x7b77('0x1')]=function(_0x59fb0e,_0x395f41,_0x208ba1){var _0x3b007c=[];if(_0x59fb0e[_0x7b77('0x2')]>0x0){var _0x313678=_[_0x7b77('0x3')](_0x59fb0e,['id']);for(var _0x50917b=0x0;_0x50917b<_0x313678[_0x7b77('0x2')];_0x50917b++){var _0x23b0a1=_0x313678[_0x50917b];if(_0x23b0a1['type']==='string'){_0x3b007c[_0x7b77('0x4')](_0x23b0a1['content']);}else if(_0x23b0a1[_0x7b77('0x5')]===_0x7b77('0x6')&&_0x23b0a1[_0x7b77('0x7')]){_0x395f41[_0x23b0a1['variableName']]&&_0x3b007c[_0x7b77('0x4')](_0x395f41[_0x23b0a1[_0x7b77('0x7')]]['toString']());}else if(_0x23b0a1[_0x7b77('0x5')]===_0x7b77('0x8')&&_0x23b0a1['Variable']&&_0x23b0a1['Variable'][_0x7b77('0x9')]){_0x395f41[_0x23b0a1[_0x7b77('0xa')][_0x7b77('0x9')][_0x7b77('0xb')]()]&&_0x3b007c['push'](_0x395f41[_0x23b0a1[_0x7b77('0xa')][_0x7b77('0x9')]['toLowerCase']()]['toString']());}else if(_0x23b0a1[_0x7b77('0x5')]==='keyValue'){if(_0x23b0a1['keyType']===_0x7b77('0xc')&&_0x23b0a1[_0x7b77('0xd')]){_0x3b007c[_0x7b77('0x4')](util[_0x7b77('0xe')](_0x7b77('0xf'),_0x23b0a1[_0x7b77('0xd')],_0x23b0a1[_0x7b77('0x10')]));}else if(_0x23b0a1['keyType']===_0x7b77('0x6')&&_0x23b0a1['variableName']&&_0x23b0a1[_0x7b77('0xd')]){_0x395f41[_0x23b0a1['variableName']]&&_0x3b007c[_0x7b77('0x4')](util['format']('%s:\x20%s',_0x23b0a1[_0x7b77('0xd')],_0x395f41[_0x23b0a1['variableName']]));}else if(_0x23b0a1[_0x7b77('0x11')]===_0x7b77('0x8')&&_0x23b0a1[_0x7b77('0xa')]&&_0x23b0a1[_0x7b77('0xa')][_0x7b77('0x9')]&&_0x23b0a1[_0x7b77('0xd')]){_0x395f41[_0x23b0a1['Variable'][_0x7b77('0x9')][_0x7b77('0xb')]()]&&_0x3b007c['push'](util['format'](_0x7b77('0xf'),_0x23b0a1[_0x7b77('0xd')],_0x395f41[_0x23b0a1[_0x7b77('0xa')]['name'][_0x7b77('0xb')]()]));}}}}return _0x3b007c['join'](_0x208ba1);};exports[_0x7b77('0x12')]=function(_0x36ea61){var _0x2da1b2=_0x36ea61[_0x7b77('0x13')](-0x1);if(_0x2da1b2==='/'){_0x36ea61=_0x36ea61['substring'](0x0,_0x36ea61['lastIndexOf'](_0x2da1b2));}return _0x36ea61;};exports[_0x7b77('0x14')]=function(_0x15bd01){if(!_[_0x7b77('0x15')](_0x15bd01)&&_0x15bd01!==''){var _0x1095b2=/^(([^<>()\[\]\\.,;:\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 _0x1095b2[_0x7b77('0x16')](String(_0x15bd01)[_0x7b77('0xb')]());}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 8496843..bfca75a 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fad552e..194a9c4 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 _0x71ed=['base64','debug','stringify','defaults','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lodash','md5','./util','../../../../config/environment','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','%s/token:%s','username','token','Basic\x20%s','toString'];(function(_0x3c7ae4,_0x226c79){var _0x3b5401=function(_0x155324){while(--_0x155324){_0x3c7ae4['push'](_0x3c7ae4['shift']());}};_0x3b5401(++_0x226c79);}(_0x71ed,0xa3));var _0xd71e=function(_0x3db91d,_0x12ac75){_0x3db91d=_0x3db91d-0x0;var _0x5905fe=_0x71ed[_0x3db91d];return _0x5905fe;};'use strict';var _=require(_0xd71e('0x0'));var rp=require('request-promise');var md5=require(_0xd71e('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd71e('0x2'));var config=require(_0xd71e('0x3'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_['defaults'](config['redis'],{'host':_0xd71e('0x4'),'port':0x18eb});var io=require(_0xd71e('0x5'))(new Redis(config['redis']));function emit(_0x2e3307,_0x2f8e4b,_0x27212a){io['to'](_0x2e3307)[_0xd71e('0x6')](_0x2f8e4b,_0x27212a);}var headers={'Content-Type':_0xd71e('0x7'),'Accept':_0xd71e('0x7')};function getTicket(_0xbe750c,_0x435f6c,_0x129e3c,_0x474d50,_0x18d091){logger[_0xd71e('0x8')](_0xd71e('0x9'));return request({'uri':util[_0xd71e('0xa')]('%s/tickets.json',_0xbe750c[_0xd71e('0xb')]),'method':'POST','body':{'ticket':_[_0xd71e('0xc')]({'requester_id':_0x129e3c['id'],'submitter_id':_0x435f6c?_0x435f6c['id']:undefined,'assignee_id':_0x435f6c?_0x435f6c['id']:undefined,'tags':getTags(_0x474d50[_0xd71e('0xd')],_0xd71e('0xe')),'subject':intUtil['getString'](_0x474d50[_0xd71e('0xf')],_0x18d091,'\x20'),'description':intUtil['getString'](_0x474d50['Descriptions'],_0x18d091,'\x0a'),'comment':{'public':![],'body':intUtil[_0xd71e('0x10')](_0x474d50[_0xd71e('0x11')],_0x18d091,'\x0a')}},getCustomFields(_0x474d50['Fields'],_0x18d091))}})[_0xd71e('0x12')](function(_0x2c9cb9){logger[_0xd71e('0x8')](_0xd71e('0x13'));return _0x2c9cb9[_0xd71e('0x14')];});}function getUser(_0x1a9d3d,_0x4887e6){if(intUtil['validateEmail'](_0x4887e6)){logger['info'](_0xd71e('0x15'),_0x4887e6);return request({'uri':util[_0xd71e('0xa')]('%s/search.json',_0x1a9d3d[_0xd71e('0xb')]),'qs':{'query':util[_0xd71e('0xa')](_0xd71e('0x16'),_0x4887e6)}})['then'](function(_0xcc266e){if(_0xcc266e['count']){logger[_0xd71e('0x8')](_0xd71e('0x17'));return _[_0xd71e('0x18')](_0xcc266e[_0xd71e('0x19')],{'email':_0x4887e6,'role':_0xd71e('0x1a')});}else{logger['info'](_0xd71e('0x1b'));return request({'uri':util[_0xd71e('0xa')](_0xd71e('0x1c'),_0x1a9d3d[_0xd71e('0xb')])})[_0xd71e('0x12')](function(_0x292645){logger[_0xd71e('0x8')](_0xd71e('0x1d'));return _0x292645[_0xd71e('0x1e')];});}});}else{logger[_0xd71e('0x8')](_0xd71e('0x1b'));return request({'uri':util['format'](_0xd71e('0x1c'),_0x1a9d3d['remoteUri'])})[_0xd71e('0x12')](function(_0x44d2c9){logger['info']('Admin\x20account\x20selected.');return _0x44d2c9[_0xd71e('0x1e')];});}}function getEndUser(_0x107b90,_0x5d204c,_0x403d01){logger[_0xd71e('0x8')]('Searching\x20enduser\x20with\x20phone',_0x403d01);return request({'uri':util[_0xd71e('0xa')]('%s/search.json',_0x107b90[_0xd71e('0xb')]),'qs':{'query':util[_0xd71e('0xa')]('type:user\x20role:end-user\x20phone:%s',_0x403d01)}})['then'](function(_0x4368e4){var _0x31e28e;if(_0x4368e4[_0xd71e('0x19')][_0xd71e('0x1f')]){_0x4368e4[_0xd71e('0x19')]=_[_0xd71e('0x20')](_0x4368e4[_0xd71e('0x19')],{'suspended':![],'role':_0xd71e('0x21')});if(_0x4368e4['results'][_0xd71e('0x1f')]){_0x31e28e=_[_0xd71e('0x22')](_0x4368e4[_0xd71e('0x19')]);}}if(_0x31e28e){logger[_0xd71e('0x8')](_0xd71e('0x23'));return _0x31e28e;}else{logger[_0xd71e('0x8')](_0xd71e('0x24'));return request({'uri':util[_0xd71e('0xa')](_0xd71e('0x25'),_0x107b90[_0xd71e('0xb')]),'method':'POST','body':{'user':{'role':_0xd71e('0x21'),'name':util['format']('Caller\x20-\x20%s',_0x5d204c||_0x403d01),'phone':_0x403d01}}})[_0xd71e('0x12')](function(_0x3f6bad){logger[_0xd71e('0x8')](_0xd71e('0x26'));return _0x3f6bad[_0xd71e('0x1e')];});}});}function getAuth(_0x2c80e9){var _0x550dc0;if(_0x2c80e9[_0xd71e('0x27')]===_0xd71e('0x28')){_0x550dc0=util[_0xd71e('0xa')](_0xd71e('0x29'),_0x2c80e9['username'],_0x2c80e9['password']);}else if(_0x2c80e9[_0xd71e('0x27')]==='token'){_0x550dc0=util[_0xd71e('0xa')](_0xd71e('0x2a'),_0x2c80e9[_0xd71e('0x2b')],_0x2c80e9[_0xd71e('0x2c')]);}return util['format'](_0xd71e('0x2d'),new Buffer(_0x550dc0)[_0xd71e('0x2e')](_0xd71e('0x2f')));}function request(_0x58107d){logger[_0xd71e('0x30')]('[HTTP]',JSON[_0xd71e('0x31')](_0x58107d));return rp(_[_0xd71e('0x32')](_0x58107d,{'method':_0xd71e('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x57cf9e,_0x2662dc){var _0x5dc055=[];if(_0x57cf9e&&_0x57cf9e[_0xd71e('0x1f')]>0x0){_0x5dc055=_[_0xd71e('0x34')](_0x57cf9e,_0x2662dc);}return _0x5dc055;}function getCustomFields(_0x5c4f50,_0x194c05){var _0x3e2ee6=[];var _0x2f31c8={'custom_fields':[]};if(_0x5c4f50[_0xd71e('0x1f')]>0x0){_[_0xd71e('0x35')](_0x5c4f50,function(_0x58d061){if(_[_0xd71e('0x36')](['string',_0xd71e('0x37')],_0x58d061[_0xd71e('0x38')])&&_0x58d061[_0xd71e('0x39')]&&!_0x58d061[_0xd71e('0x3a')]){_0x2f31c8[_0x58d061[_0xd71e('0x39')][_0xd71e('0x3b')]()]=_0x58d061[_0xd71e('0x3c')][_0xd71e('0x2e')]();}else if(_['includes'](['string',_0xd71e('0x37')],_0x58d061['type'])&&_0x58d061['idField']&&_0x58d061[_0xd71e('0x3a')]){_0x2f31c8[_0xd71e('0x3d')][_0xd71e('0x3e')]({'id':_0x58d061[_0xd71e('0x3f')],'value':_0x58d061[_0xd71e('0x3c')]['toString']()});}else if(_0x58d061[_0xd71e('0x38')]===_0xd71e('0x40')&&_0x58d061[_0xd71e('0x41')]&&_0x58d061[_0xd71e('0x3f')]&&_0x58d061[_0xd71e('0x3a')]){_0x194c05[_0x58d061['variableName']]&&_0x2f31c8[_0xd71e('0x3d')]['push']({'id':_0x58d061[_0xd71e('0x3f')],'value':_0x194c05[_0x58d061[_0xd71e('0x41')]][_0xd71e('0x2e')]()});}else if(_0x58d061[_0xd71e('0x38')]===_0xd71e('0x42')&&_0x58d061[_0xd71e('0x43')]&&_0x58d061['Variable'][_0xd71e('0xe')]&&_0x58d061[_0xd71e('0x3f')]&&_0x58d061[_0xd71e('0x3a')]){_0x194c05[_0x58d061[_0xd71e('0x43')][_0xd71e('0xe')][_0xd71e('0x3b')]()]&&_0x2f31c8[_0xd71e('0x3d')][_0xd71e('0x3e')]({'id':_0x58d061[_0xd71e('0x3f')],'value':_0x194c05[_0x58d061[_0xd71e('0x43')][_0xd71e('0xe')][_0xd71e('0x3b')]()][_0xd71e('0x2e')]()});}});}return _0x2f31c8;}exports[_0xd71e('0x44')]=function(_0x4b7002,_0x456857,_0xdbea9f,_0x27bece,_0x6c4585,_0x343554){var _0x2c1743,_0x1136c9;_0x343554[_0xd71e('0xb')]=intUtil['stripTrailingSlash'](_0x343554[_0xd71e('0xb')]);_0x343554[_0xd71e('0x45')]=intUtil[_0xd71e('0x46')](_0x343554[_0xd71e('0x45')]);if(_0x6c4585&&_0x6c4585[_0xd71e('0x47')]){logger[_0xd71e('0x8')](_0xd71e('0x48'),'Recording\x20is\x20enabled!');_0x456857[_0xd71e('0x49')]=util[_0xd71e('0xa')](_0xd71e('0x4a'),_0x343554['serverUrl'],_0x456857[_0xd71e('0x4b')],md5(_0x456857[_0xd71e('0x4b')]));}else{_0x456857[_0xd71e('0x49')]='';}headers[_0xd71e('0x4c')]=getAuth(_0x343554);return getUser(_0x343554,_0x27bece[_0xd71e('0x4d')])[_0xd71e('0x12')](function(_0x50593a){_0x2c1743=_0x50593a;logger[_0xd71e('0x8')](_0xd71e('0x4e'),_0x2c1743['id']);return getEndUser(_0x343554,_0x456857['calleridname'],_0x456857[_0xd71e('0x4f')]);})['then'](function(_0xf8f33c){_0x1136c9=_0xf8f33c;logger[_0xd71e('0x8')](_0xd71e('0x50'),_0x1136c9['id']);return getTicket(_0x343554,_0x2c1743,_0x1136c9,_0xdbea9f,_0x456857);})[_0xd71e('0x12')](function(_0x8d02c8){if(_0x8d02c8){logger[_0xd71e('0x8')](_0xd71e('0x51'),_0x8d02c8['id']);switch(_0x343554[_0xd71e('0x38')]){case _0xd71e('0x52'):logger[_0xd71e('0x8')]('[QUEUE]',_0xd71e('0x53'));return request({'uri':util[_0xd71e('0xa')](_0xd71e('0x54'),_0x343554[_0xd71e('0xb')],_0x2c1743['id'],_0x8d02c8['id']),'method':_0xd71e('0x55')});case _0xd71e('0x56'):logger[_0xd71e('0x8')]('[QUEUE]',_0xd71e('0x57'));emit(util[_0xd71e('0xa')](_0xd71e('0x58'),_0x27bece[_0xd71e('0xe')]),'trigger:browser:url',{'uri':util[_0xd71e('0xa')](_0xd71e('0x59'),_0x343554[_0xd71e('0xb')][_0xd71e('0x5a')](_0xd71e('0x5b'),''),_0x8d02c8['id'])});break;default:logger[_0xd71e('0x5c')](_0xd71e('0x48'),_0xd71e('0x5d'));}}})[_0xd71e('0x5e')](function(_0x1a6fc4){logger[_0xd71e('0x5c')](_0xd71e('0x5f'),util[_0xd71e('0x60')](_0x1a6fc4,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4c4cd3,_0x4aa352,_0x4ff225,_0x1bf7bb,_0x1d0ddf,_0x59c833,_0x548940){var _0x3be20b,_0x4d0268;_0x59c833[_0xd71e('0xb')]=intUtil[_0xd71e('0x46')](_0x59c833[_0xd71e('0xb')]);_0x59c833[_0xd71e('0x45')]=intUtil[_0xd71e('0x46')](_0x59c833['serverUrl']);if(_0x548940&&_0x548940['recordingFormat']&&_0x548940[_0xd71e('0x61')]!==_0xd71e('0x62')){logger[_0xd71e('0x8')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4aa352[_0xd71e('0x49')]=util[_0xd71e('0xa')](_0xd71e('0x4a'),_0x59c833[_0xd71e('0x45')],_0x4aa352['uniqueid'],md5(_0x4aa352['uniqueid']));}headers[_0xd71e('0x4c')]=getAuth(_0x59c833);return getUser(_0x59c833,_0x1bf7bb[_0xd71e('0x4d')])[_0xd71e('0x12')](function(_0x3ca322){_0x3be20b=_0x3ca322;logger[_0xd71e('0x8')]('The\x20User\x20ID\x20is:',_0x3be20b['id']);return getEndUser(_0x59c833,_0x4aa352[_0xd71e('0x63')],_0x4aa352[_0xd71e('0x64')]);})['then'](function(_0x485f23){_0x4d0268=_0x485f23;logger[_0xd71e('0x8')](_0xd71e('0x50'),_0x4d0268['id']);return getTicket(_0x59c833,_0x3be20b,_0x4d0268,_0x4ff225,_0x4aa352);})[_0xd71e('0x12')](function(_0x39dc51){if(_0x39dc51){logger[_0xd71e('0x8')]('The\x20Ticket\x20ID\x20is:',_0x39dc51['id']);switch(_0x59c833[_0xd71e('0x38')]){case _0xd71e('0x52'):logger['info']('[OUTBOUND]',_0xd71e('0x53'));return request({'uri':util['format'](_0xd71e('0x54'),_0x59c833['remoteUri'],_0x3be20b['id'],_0x39dc51['id']),'method':_0xd71e('0x55')});case _0xd71e('0x56'):logger[_0xd71e('0x8')](_0xd71e('0x65'),_0xd71e('0x57'));emit(util[_0xd71e('0xa')](_0xd71e('0x58'),_0x1bf7bb[_0xd71e('0xe')]),'trigger:browser:url',{'uri':util[_0xd71e('0xa')]('%s/agent/tickets/%s',_0x59c833[_0xd71e('0xb')][_0xd71e('0x5a')](_0xd71e('0x5b'),''),_0x39dc51['id'])});break;default:logger[_0xd71e('0x5c')](_0xd71e('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xd71e('0x5e')](function(_0x46b6c5){logger[_0xd71e('0x5c')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xd71e('0x60')](_0x46b6c5,{'showHidden':!![],'depth':null}));});};exports[_0xd71e('0x66')]=function(_0x322193,_0x56d782,_0x17793b,_0x9a5aa8,_0x155a8c,_0x5a7cf7){var _0x44c6ce,_0x3f99ec;_0x5a7cf7[_0xd71e('0xb')]=intUtil['stripTrailingSlash'](_0x5a7cf7['remoteUri']);_0x5a7cf7['serverUrl']=intUtil['stripTrailingSlash'](_0x5a7cf7['serverUrl']);if(_0x155a8c&&_0x155a8c[_0xd71e('0x47')]){logger[_0xd71e('0x8')]('['+_0x56d782['lastevent'][_0xd71e('0x67')]()+']',_0xd71e('0x68'));_0x56d782['recordingURL']=util['format'](_0xd71e('0x4a'),_0x5a7cf7[_0xd71e('0x45')],_0x56d782[_0xd71e('0x4b')],md5(_0x56d782[_0xd71e('0x4b')]));}else{_0x56d782['recordingURL']='';}headers[_0xd71e('0x4c')]=getAuth(_0x5a7cf7);return getUser(_0x5a7cf7)[_0xd71e('0x12')](function(_0x5396b2){_0x44c6ce=_0x5396b2;logger[_0xd71e('0x8')](_0xd71e('0x4e'),_0x44c6ce['id']);return getEndUser(_0x5a7cf7,_0x56d782['calleridname'],_0x56d782[_0xd71e('0x4f')]);})[_0xd71e('0x12')](function(_0x484331){_0x3f99ec=_0x484331;logger[_0xd71e('0x8')](_0xd71e('0x50'),_0x3f99ec['id']);return getTicket(_0x5a7cf7,_0x44c6ce,_0x3f99ec,_0x17793b,_0x56d782);})['then'](function(_0x1509ce){if(_0x1509ce){logger[_0xd71e('0x8')](_0xd71e('0x51'),_0x1509ce['id']);}})[_0xd71e('0x5e')](function(_0x2b8f2c){logger[_0xd71e('0x5c')]('['+_0x56d782['lastevent'][_0xd71e('0x67')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xd71e('0x60')](_0x2b8f2c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3083=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','Basic\x20%s','toString','base64','stringify','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','[OUTBOUND]','destcalleridname','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','catch','lodash','request-promise','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','name','Subjects','getString','Descriptions','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','count','Agent\x20found!','find','results'];(function(_0x2bcd33,_0x28d579){var _0x53ff5f=function(_0x5ee871){while(--_0x5ee871){_0x2bcd33['push'](_0x2bcd33['shift']());}};_0x53ff5f(++_0x28d579);}(_0x3083,0x124));var _0x3308=function(_0x45f111,_0x3a1a4a){_0x45f111=_0x45f111-0x0;var _0x483508=_0x3083[_0x45f111];return _0x483508;};'use strict';var _=require(_0x3308('0x0'));var rp=require(_0x3308('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x3308('0x2'));var config=require(_0x3308('0x3'));var logger=require('../../../../config/logger')('zendesk');config[_0x3308('0x4')]=_[_0x3308('0x5')](config[_0x3308('0x4')],{'host':_0x3308('0x6'),'port':0x18eb});var io=require(_0x3308('0x7'))(new Redis(config[_0x3308('0x4')]));function emit(_0x2e5f44,_0x168e7d,_0x400cf8){io['to'](_0x2e5f44)[_0x3308('0x8')](_0x168e7d,_0x400cf8);}var headers={'Content-Type':_0x3308('0x9'),'Accept':_0x3308('0x9')};function getTicket(_0x11ac84,_0x4d2a38,_0x3d268a,_0x487029,_0x12dd55){logger[_0x3308('0xa')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x3308('0xb')](_0x3308('0xc'),_0x11ac84[_0x3308('0xd')]),'method':_0x3308('0xe'),'body':{'ticket':_[_0x3308('0xf')]({'requester_id':_0x3d268a['id'],'submitter_id':_0x4d2a38?_0x4d2a38['id']:undefined,'assignee_id':_0x4d2a38?_0x4d2a38['id']:undefined,'tags':getTags(_0x487029['Tags'],_0x3308('0x10')),'subject':intUtil['getString'](_0x487029[_0x3308('0x11')],_0x12dd55,'\x20'),'description':intUtil[_0x3308('0x12')](_0x487029[_0x3308('0x13')],_0x12dd55,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3308('0x12')](_0x487029[_0x3308('0x13')],_0x12dd55,'\x0a')}},getCustomFields(_0x487029['Fields'],_0x12dd55))}})['then'](function(_0x5cc815){logger[_0x3308('0xa')](_0x3308('0x14'));return _0x5cc815[_0x3308('0x15')];});}function getUser(_0x151f6c,_0x59f92b){if(intUtil['validateEmail'](_0x59f92b)){logger[_0x3308('0xa')](_0x3308('0x16'),_0x59f92b);return request({'uri':util[_0x3308('0xb')]('%s/search.json',_0x151f6c[_0x3308('0xd')]),'qs':{'query':util['format'](_0x3308('0x17'),_0x59f92b)}})[_0x3308('0x18')](function(_0x2c61ca){if(_0x2c61ca[_0x3308('0x19')]){logger[_0x3308('0xa')](_0x3308('0x1a'));return _[_0x3308('0x1b')](_0x2c61ca[_0x3308('0x1c')],{'email':_0x59f92b,'role':_0x3308('0x1d')});}else{logger[_0x3308('0xa')](_0x3308('0x1e'));return request({'uri':util['format'](_0x3308('0x1f'),_0x151f6c[_0x3308('0xd')])})[_0x3308('0x18')](function(_0x310eb9){logger[_0x3308('0xa')](_0x3308('0x20'));return _0x310eb9['user'];});}});}else{logger['info'](_0x3308('0x1e'));return request({'uri':util[_0x3308('0xb')](_0x3308('0x1f'),_0x151f6c[_0x3308('0xd')])})[_0x3308('0x18')](function(_0x478bc7){logger[_0x3308('0xa')](_0x3308('0x20'));return _0x478bc7[_0x3308('0x21')];});}}function getEndUser(_0x187edd,_0x399583,_0x117709){logger[_0x3308('0xa')](_0x3308('0x22'),_0x117709);return request({'uri':util['format'](_0x3308('0x23'),_0x187edd[_0x3308('0xd')]),'qs':{'query':util[_0x3308('0xb')](_0x3308('0x24'),_0x117709)}})[_0x3308('0x18')](function(_0x5d8cfa){var _0x1c9471;if(_0x5d8cfa['results'][_0x3308('0x25')]){_0x5d8cfa[_0x3308('0x1c')]=_[_0x3308('0x26')](_0x5d8cfa['results'],{'suspended':![],'role':_0x3308('0x27')});if(_0x5d8cfa[_0x3308('0x1c')][_0x3308('0x25')]){_0x1c9471=_['first'](_0x5d8cfa['results']);}}if(_0x1c9471){logger[_0x3308('0xa')](_0x3308('0x28'));return _0x1c9471;}else{logger[_0x3308('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3308('0xb')]('%s/users.json',_0x187edd['remoteUri']),'method':_0x3308('0xe'),'body':{'user':{'role':'end-user','name':util[_0x3308('0xb')](_0x3308('0x29'),_0x399583||_0x117709),'phone':_0x117709}}})[_0x3308('0x18')](function(_0x2974f6){logger[_0x3308('0xa')](_0x3308('0x2a'));return _0x2974f6[_0x3308('0x21')];});}});}function getAuth(_0x7d0fc0){var _0x43ac3a;if(_0x7d0fc0[_0x3308('0x2b')]===_0x3308('0x2c')){_0x43ac3a=util[_0x3308('0xb')](_0x3308('0x2d'),_0x7d0fc0['username'],_0x7d0fc0[_0x3308('0x2c')]);}else if(_0x7d0fc0['authType']===_0x3308('0x2e')){_0x43ac3a=util[_0x3308('0xb')](_0x3308('0x2f'),_0x7d0fc0[_0x3308('0x30')],_0x7d0fc0[_0x3308('0x2e')]);}return util['format'](_0x3308('0x31'),new Buffer(_0x43ac3a)[_0x3308('0x32')](_0x3308('0x33')));}function request(_0x4e1c26){logger['debug']('[HTTP]',JSON[_0x3308('0x34')](_0x4e1c26));return rp(_[_0x3308('0x5')](_0x4e1c26,{'method':_0x3308('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x23664b,_0x9dd56b){var _0x5d24e9=[];if(_0x23664b&&_0x23664b['length']>0x0){_0x5d24e9=_[_0x3308('0x36')](_0x23664b,_0x9dd56b);}return _0x5d24e9;}function getCustomFields(_0x5182f7,_0x4a390b){var _0x43ff97=[];var _0xa8023f={'custom_fields':[]};if(_0x5182f7[_0x3308('0x25')]>0x0){_[_0x3308('0x37')](_0x5182f7,function(_0x3b5854){if(_[_0x3308('0x38')](['string',_0x3308('0x39')],_0x3b5854[_0x3308('0x3a')])&&_0x3b5854[_0x3308('0x3b')]&&!_0x3b5854[_0x3308('0x3c')]){_0xa8023f[_0x3b5854['nameField'][_0x3308('0x3d')]()]=_0x3b5854[_0x3308('0x3e')][_0x3308('0x32')]();}else if(_[_0x3308('0x38')](['string','picklist'],_0x3b5854['type'])&&_0x3b5854[_0x3308('0x3f')]&&_0x3b5854[_0x3308('0x3c')]){_0xa8023f[_0x3308('0x40')][_0x3308('0x41')]({'id':_0x3b5854[_0x3308('0x3f')],'value':_0x3b5854[_0x3308('0x3e')][_0x3308('0x32')]()});}else if(_0x3b5854['type']===_0x3308('0x42')&&_0x3b5854['variableName']&&_0x3b5854[_0x3308('0x3f')]&&_0x3b5854['customField']){_0x4a390b[_0x3b5854[_0x3308('0x43')]]&&_0xa8023f['custom_fields']['push']({'id':_0x3b5854[_0x3308('0x3f')],'value':_0x4a390b[_0x3b5854['variableName']][_0x3308('0x32')]()});}else if(_0x3b5854['type']==='customVariable'&&_0x3b5854['Variable']&&_0x3b5854[_0x3308('0x44')][_0x3308('0x10')]&&_0x3b5854['idField']&&_0x3b5854['customField']){_0x4a390b[_0x3b5854[_0x3308('0x44')]['name'][_0x3308('0x3d')]()]&&_0xa8023f[_0x3308('0x40')][_0x3308('0x41')]({'id':_0x3b5854[_0x3308('0x3f')],'value':_0x4a390b[_0x3b5854[_0x3308('0x44')][_0x3308('0x10')][_0x3308('0x3d')]()][_0x3308('0x32')]()});}});}return _0xa8023f;}exports[_0x3308('0x45')]=function(_0x5fb16a,_0x20a074,_0x2b15e1,_0x4bd7c6,_0x150875,_0x467e10){var _0x47de0a,_0x44a902;_0x467e10[_0x3308('0xd')]=intUtil[_0x3308('0x46')](_0x467e10[_0x3308('0xd')]);_0x467e10[_0x3308('0x47')]=intUtil['stripTrailingSlash'](_0x467e10[_0x3308('0x47')]);if(_0x150875&&_0x150875[_0x3308('0x48')]){logger[_0x3308('0xa')](_0x3308('0x49'),_0x3308('0x4a'));_0x20a074['recordingURL']=util[_0x3308('0xb')](_0x3308('0x4b'),_0x467e10[_0x3308('0x47')],_0x20a074[_0x3308('0x4c')],md5(_0x20a074[_0x3308('0x4c')]));}else{_0x20a074[_0x3308('0x4d')]='';}headers[_0x3308('0x4e')]=getAuth(_0x467e10);return getUser(_0x467e10,_0x4bd7c6[_0x3308('0x4f')])['then'](function(_0x41cca2){_0x47de0a=_0x41cca2;logger['info'](_0x3308('0x50'),_0x47de0a['id']);return getEndUser(_0x467e10,_0x20a074[_0x3308('0x51')],_0x20a074[_0x3308('0x52')]);})[_0x3308('0x18')](function(_0x19ba2e){_0x44a902=_0x19ba2e;logger[_0x3308('0xa')](_0x3308('0x53'),_0x44a902['id']);return getTicket(_0x467e10,_0x47de0a,_0x44a902,_0x2b15e1,_0x20a074);})[_0x3308('0x18')](function(_0x39c7f1){if(_0x39c7f1){logger[_0x3308('0xa')](_0x3308('0x54'),_0x39c7f1['id']);switch(_0x467e10['type']){case _0x3308('0x55'):logger['info'](_0x3308('0x49'),_0x3308('0x56'));return request({'uri':util[_0x3308('0xb')](_0x3308('0x57'),_0x467e10[_0x3308('0xd')],_0x47de0a['id'],_0x39c7f1['id']),'method':_0x3308('0xe')});case'newTab':logger['info'](_0x3308('0x49'),_0x3308('0x58'));emit(util[_0x3308('0xb')](_0x3308('0x59'),_0x4bd7c6[_0x3308('0x10')]),_0x3308('0x5a'),{'uri':util['format'](_0x3308('0x5b'),_0x467e10[_0x3308('0xd')][_0x3308('0x5c')](_0x3308('0x5d'),''),_0x39c7f1['id'])});break;default:logger[_0x3308('0x5e')]('[QUEUE]',_0x3308('0x5f'));}}})['catch'](function(_0x583eab){logger[_0x3308('0x5e')](_0x3308('0x60'),util['inspect'](_0x583eab,{'showHidden':!![],'depth':null}));});};exports[_0x3308('0x61')]=function(_0x4f832e,_0x3ee9fa,_0x4255d2,_0x195b80,_0x19fb48,_0x4caf07,_0x429efc){var _0x4c4efb,_0x1c389b;_0x4caf07[_0x3308('0xd')]=intUtil[_0x3308('0x46')](_0x4caf07[_0x3308('0xd')]);_0x4caf07['serverUrl']=intUtil[_0x3308('0x46')](_0x4caf07[_0x3308('0x47')]);if(_0x429efc&&_0x429efc['recordingFormat']&&_0x429efc['recordingFormat']!=='none'){logger[_0x3308('0xa')](_0x3308('0x62'),_0x3308('0x4a'));_0x3ee9fa[_0x3308('0x4d')]=util['format'](_0x3308('0x4b'),_0x4caf07[_0x3308('0x47')],_0x3ee9fa[_0x3308('0x4c')],md5(_0x3ee9fa[_0x3308('0x4c')]));}headers[_0x3308('0x4e')]=getAuth(_0x4caf07);return getUser(_0x4caf07,_0x195b80[_0x3308('0x4f')])[_0x3308('0x18')](function(_0x201fb0){_0x4c4efb=_0x201fb0;logger[_0x3308('0xa')](_0x3308('0x50'),_0x4c4efb['id']);return getEndUser(_0x4caf07,_0x3ee9fa[_0x3308('0x63')],_0x3ee9fa['destcalleridnum']);})['then'](function(_0x1439b0){_0x1c389b=_0x1439b0;logger['info'](_0x3308('0x53'),_0x1c389b['id']);return getTicket(_0x4caf07,_0x4c4efb,_0x1c389b,_0x4255d2,_0x3ee9fa);})['then'](function(_0x1b86ec){if(_0x1b86ec){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1b86ec['id']);switch(_0x4caf07[_0x3308('0x3a')]){case _0x3308('0x55'):logger[_0x3308('0xa')](_0x3308('0x62'),_0x3308('0x56'));return request({'uri':util['format'](_0x3308('0x57'),_0x4caf07['remoteUri'],_0x4c4efb['id'],_0x1b86ec['id']),'method':_0x3308('0xe')});case _0x3308('0x64'):logger['info']('[OUTBOUND]',_0x3308('0x58'));emit(util[_0x3308('0xb')](_0x3308('0x59'),_0x195b80[_0x3308('0x10')]),_0x3308('0x5a'),{'uri':util[_0x3308('0xb')](_0x3308('0x5b'),_0x4caf07[_0x3308('0xd')][_0x3308('0x5c')](_0x3308('0x5d'),''),_0x1b86ec['id'])});break;default:logger[_0x3308('0x5e')]('[OUTBOUND]',_0x3308('0x5f'));}}})['catch'](function(_0x4e6e29){logger[_0x3308('0x5e')](_0x3308('0x65'),util[_0x3308('0x66')](_0x4e6e29,{'showHidden':!![],'depth':null}));});};exports[_0x3308('0x67')]=function(_0x48358b,_0x102ced,_0x2e039f,_0xff7321,_0x188b4d,_0x1faa82){var _0x27ba15,_0x3083de;_0x1faa82['remoteUri']=intUtil[_0x3308('0x46')](_0x1faa82['remoteUri']);_0x1faa82[_0x3308('0x47')]=intUtil['stripTrailingSlash'](_0x1faa82[_0x3308('0x47')]);if(_0x188b4d&&_0x188b4d[_0x3308('0x48')]){logger['info']('['+_0x102ced[_0x3308('0x68')][_0x3308('0x69')]()+']',_0x3308('0x4a'));_0x102ced[_0x3308('0x4d')]=util[_0x3308('0xb')](_0x3308('0x4b'),_0x1faa82[_0x3308('0x47')],_0x102ced[_0x3308('0x4c')],md5(_0x102ced[_0x3308('0x4c')]));}else{_0x102ced[_0x3308('0x4d')]='';}headers[_0x3308('0x4e')]=getAuth(_0x1faa82);return getUser(_0x1faa82)[_0x3308('0x18')](function(_0x18c2d1){_0x27ba15=_0x18c2d1;logger[_0x3308('0xa')](_0x3308('0x50'),_0x27ba15['id']);return getEndUser(_0x1faa82,_0x102ced[_0x3308('0x51')],_0x102ced[_0x3308('0x52')]);})[_0x3308('0x18')](function(_0xbf3b9f){_0x3083de=_0xbf3b9f;logger[_0x3308('0xa')](_0x3308('0x53'),_0x3083de['id']);return getTicket(_0x1faa82,_0x27ba15,_0x3083de,_0x2e039f,_0x102ced);})['then'](function(_0x333476){if(_0x333476){logger[_0x3308('0xa')]('The\x20Ticket\x20ID\x20is:',_0x333476['id']);}})[_0x3308('0x6a')](function(_0x226a03){logger[_0x3308('0x5e')]('['+_0x102ced[_0x3308('0x68')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x226a03,{'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 9cbe8f9..b274034 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 _0xa61d=['isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','name','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','Zoho-oauthtoken\x20','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','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=','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Outbound','lastevent','toUpperCase','lodash','request-promise','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','variableName','toString','Variable','toLowerCase','indexOf','split'];(function(_0x137cea,_0x20e60d){var _0x480882=function(_0x280975){while(--_0x280975){_0x137cea['push'](_0x137cea['shift']());}};_0x480882(++_0x20e60d);}(_0xa61d,0x7f));var _0xda61=function(_0x106f2d,_0x21645f){_0x106f2d=_0x106f2d-0x0;var _0x11200d=_0xa61d[_0x106f2d];return _0x11200d;};'use strict';var _=require(_0xda61('0x0'));var rp=require(_0xda61('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xda61('0x2'));var moment=require('moment');var Redis=require(_0xda61('0x3'));var BPromise=require(_0xda61('0x4'));var config=require(_0xda61('0x5'));var logger=require(_0xda61('0x6'))(_0xda61('0x7'));config[_0xda61('0x8')]=_[_0xda61('0x9')](config[_0xda61('0x8')],{'host':_0xda61('0xa'),'port':0x18eb});var io=require(_0xda61('0xb'))(new Redis(config[_0xda61('0x8')]));function emit(_0x52a63d,_0x27ef0c,_0x16ae62){io['to'](_0x52a63d)[_0xda61('0xc')](_0x27ef0c,_0x16ae62);}function request(_0x2d80d5){logger[_0xda61('0xd')](_0xda61('0xe'),JSON[_0xda61('0xf')](_0x2d80d5));return rp(_0x2d80d5);}function getCustomFields(_0x266e80,_0xf367a4){var _0x5eb186={};if(_0x266e80[_0xda61('0x10')]>0x0){_[_0xda61('0x11')](_0x266e80,function(_0x21c3e3){if(_[_0xda61('0x12')](['string',_0xda61('0x13')],_0x21c3e3[_0xda61('0x14')])&&_0x21c3e3['idField']){_0x5eb186[_0x21c3e3[_0xda61('0x15')]]=_0x21c3e3[_0xda61('0x16')]['toString']();}else if(_0x21c3e3[_0xda61('0x14')]==='variable'&&_0x21c3e3[_0xda61('0x17')]&&_0x21c3e3[_0xda61('0x15')]&&_0xf367a4[_0x21c3e3[_0xda61('0x17')]]){_0x5eb186[_0x21c3e3[_0xda61('0x15')]]=_0xf367a4[_0x21c3e3['variableName']][_0xda61('0x18')]();}else if(_0x21c3e3[_0xda61('0x14')]==='customVariable'&&_0x21c3e3[_0xda61('0x19')]&&_0x21c3e3[_0xda61('0x19')]['name']&&_0x21c3e3[_0xda61('0x15')]&&_0xf367a4[_0x21c3e3['Variable']['name']['toLowerCase']()]){_0x5eb186[_0x21c3e3[_0xda61('0x15')]]=_0xf367a4[_0x21c3e3[_0xda61('0x19')]['name'][_0xda61('0x1a')]()][_0xda61('0x18')]();}});}return _0x5eb186;}function getName(_0x2d0956){if(_0x2d0956[_0xda61('0x1b')]('\x20')>0x0){var _0x310dd0=_0x2d0956[_0xda61('0x1c')](/ (.+)/);if(_0x310dd0[0x1]){return _0x310dd0;}}return[_0x2d0956,_0x2d0956];}var accountsTokens={};function getAccessToken(_0x4f7c20){return new Promise(function(_0x4b14ec,_0xefb1b1){if(!_['isNil'](accountsTokens[_0x4f7c20['id']])&&!_[_0xda61('0x1d')](accountsTokens[_0x4f7c20['id']][_0xda61('0x1e')])){if(moment()[_0xda61('0x1f')](accountsTokens[_0x4f7c20['id']][_0xda61('0x20')])){_0x4b14ec(accountsTokens[_0x4f7c20['id']][_0xda61('0x1e')]);}}var _0x8f5eaf;switch(_0x4f7c20[_0xda61('0x21')]){case'US':_0x8f5eaf=_0xda61('0x22');break;case'AU':_0x8f5eaf=_0xda61('0x23');break;case'EU':_0x8f5eaf=_0xda61('0x24');break;case'IN':_0x8f5eaf='https://accounts.zoho.in';break;case'CN':_0x8f5eaf=_0xda61('0x25');break;default:_0x8f5eaf=_0xda61('0x24');break;}var _0x11160d={'method':_0xda61('0x26'),'uri':_0x8f5eaf+_0xda61('0x27'),'qs':{'refresh_token':_0x4f7c20['refreshToken'],'client_id':_0x4f7c20[_0xda61('0x28')],'client_secret':_0x4f7c20[_0xda61('0x29')],'grant_type':_0xda61('0x2a')},'json':!![]};return rp(_0x11160d)[_0xda61('0x2b')](function(_0x1767b0){accountsTokens[_0x4f7c20['id']]={'access_token':_0x1767b0[_0xda61('0x1e')],'expires_in':moment()['add'](_0x1767b0['expires_in'],_0xda61('0x2c'))};_0x4b14ec(_0x1767b0[_0xda61('0x1e')]);})[_0xda61('0x2d')](function(_0x5d1430){logger[_0xda61('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x5d1430['stack']);_0xefb1b1(_0x5d1430);});});}function getUser(_0x1e9329,_0x1beda5,_0x1a5c11,_0x4aa86d){logger[_0xda61('0x2f')](_0xda61('0x30'));return request({'method':_0xda61('0x31'),'uri':util[_0xda61('0x32')](_0xda61('0x33'),_0x1beda5),'qs':{'type':_0xda61('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1e9329},'json':!![]})[_0xda61('0x2b')](function(_0x377db1){if(_0x377db1[_0xda61('0x35')]){var _0x33c4bc=-0x1;if(_[_0xda61('0x36')](_0x377db1[_0xda61('0x35')])){if(!_[_0xda61('0x1d')](_0x4aa86d)){_0x33c4bc=_[_0xda61('0x37')](_0x377db1[_0xda61('0x35')],function(_0x42c0df){return _0x42c0df[_0xda61('0x38')]===_0x4aa86d;});}if(_0x33c4bc>=0x0){logger[_0xda61('0x2f')](_0xda61('0x39'));}else{logger[_0xda61('0x2f')](_0xda61('0x3a'));_0x33c4bc=_[_0xda61('0x37')](_0x377db1[_0xda61('0x35')],function(_0x138b97){return _0x138b97[_0xda61('0x3b')]['name']===_0xda61('0x3c');});}return _0x377db1[_0xda61('0x35')][_0x33c4bc];}else{if(_0x377db1[_0xda61('0x3d')][_0xda61('0x3b')][_0xda61('0x3e')]===_0xda61('0x3c')){logger['info'](_0xda61('0x3a'));user=_0x377db1['user'];return user;}else{logger[_0xda61('0x2e')](_0xda61('0x3f'),JSON[_0xda61('0xf')](_0x377db1));throw new Error(_0xda61('0x40')+JSON['stringify'](_0x377db1));}}}else{logger[_0xda61('0x2e')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x377db1));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x377db1));}})[_0xda61('0x2d')](function(_0x424a76){console[_0xda61('0x2e')](_0x424a76);});}function getZohoUser(_0x43f03f,_0x370452){return new BPromise(function(_0x32fe91,_0x41cfb6){request(_0x43f03f)[_0xda61('0x2b')](function(_0x1a9c4f){var _0x46ca44=null;if(_0x1a9c4f){_0x46ca44=_0x1a9c4f['data'][0x0];_0x46ca44[_0xda61('0x41')]=_0x370452;}_0x32fe91(_0x46ca44);})['catch'](function(_0x24cec0){_0x41cfb6(_0x24cec0);});});}function createEndUser(_0x168c3d,_0x36c644,_0xa79fad,_0x1b3b9f,_0x455a6d,_0x77d57f){var _0xa79fad=getName(_0xa79fad);return request({'method':_0xda61('0x26'),'uri':_0xda61('0x42')+_0x36c644+_0xda61('0x43')+_[_0xda61('0x44')](_0x77d57f[_0xda61('0x45')])+'s','body':{'data':[{'Last_Name':_0xa79fad[0x1],'First_Name':_0xa79fad[0x0],'Phone':_0x1b3b9f,'Owner':{'name':!_[_0xda61('0x1d')](_0x455a6d[_0xda61('0x46')][_0xda61('0x3e')])?_0x455a6d[_0xda61('0x46')]['name']:!_[_0xda61('0x1d')](_0x455a6d['first_name'])?_0x455a6d['first_name']+'\x20'+_0x455a6d[_0xda61('0x47')]:_0x455a6d[_0xda61('0x47')],'id':_0x455a6d['id']}}]},'headers':{'Authorization':_0xda61('0x48')+_0x168c3d},'json':!![]})['then'](function(_0x49943e){if(_0x49943e&&_0x49943e[_0xda61('0x49')][0x0][_0xda61('0x4a')]==='SUCCESS'){var _0x1d30c0=_0x49943e[_0xda61('0x49')][0x0][_0xda61('0x4b')];_0x1d30c0[_0xda61('0x41')]=_[_0xda61('0x44')](_0x77d57f[_0xda61('0x45')])+'s';return _0x1d30c0;}logger[_0xda61('0x2e')](_0xda61('0x3f'),JSON[_0xda61('0xf')](data));throw new Error(_0xda61('0x4c')+JSON[_0xda61('0xf')](data));})[_0xda61('0x2d')](function(_0x34cd28){console[_0xda61('0x4d')](_0xda61('0x4e'),_0x34cd28);});}function getEndUser(_0x5a14d4,_0x2fe900,_0x24fdc4,_0x47e56d,_0x2d7459,_0x51dbda,_0xdcba0b){var _0x3a751b={'method':_0xda61('0x31'),'uri':'','headers':{'Authorization':_0xda61('0x48')+_0x5a14d4},'json':!![]};switch(_0xdcba0b[_0xda61('0x4f')]){case _0xda61('0x50'):_0x3a751b['uri']='https://www.zohoapis.'+_0x2fe900+_0xda61('0x51')+_0x2d7459+'))';return getZohoUser(_0x3a751b,_0xda61('0x52'))[_0xda61('0x2b')](function(_0x1edcc6){if(_0x1edcc6)return _0x1edcc6;_0x3a751b[_0xda61('0x53')]=_0xda61('0x42')+_0x2fe900+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2d7459+'))';return getZohoUser(_0x3a751b,_0xda61('0x54'))[_0xda61('0x2b')](function(_0x41bb7e){if(_0x41bb7e)return _0x41bb7e;if(_0xdcba0b[_0xda61('0x45')]!=_0xda61('0x55')){return createEndUser(_0x5a14d4,_0x2fe900,_0x47e56d,_0x2d7459,_0x51dbda,_0xdcba0b);}else{return{};}});});break;case _0xda61('0x56'):_0x3a751b[_0xda61('0x53')]=_0xda61('0x42')+_0x2fe900+_0xda61('0x51')+_0x2d7459+'))';return getZohoUser(_0x3a751b,_0xda61('0x52'))[_0xda61('0x2b')](function(_0x3fee0d){if(_0x3fee0d)return _0x3fee0d;if(_0xdcba0b[_0xda61('0x45')]!=_0xda61('0x55')){return createEndUser(_0x5a14d4,_0x2fe900,_0x47e56d,_0x2d7459,_0x51dbda,_0xdcba0b);}else{return{};}});break;case _0xda61('0x57'):_0x3a751b[_0xda61('0x53')]=_0xda61('0x42')+_0x2fe900+_0xda61('0x58')+_0x2d7459+'))';return getZohoUser(_0x3a751b,_0xda61('0x54'))['then'](function(_0x273e13){if(_0x273e13)return _0x273e13;if(_0xdcba0b['moduleCreate']!=_0xda61('0x55')){return createEndUser(_0x5a14d4,_0x2fe900,_0x47e56d,_0x2d7459,_0x51dbda,_0xdcba0b);}else{return{};}});break;}}function getCall(_0x579b97,_0x3c0759,_0x455ced,_0x1183eb,_0x40d1b1,_0x3ae9bc,_0x2c1dad,_0x3fcf87){logger['info'](_0xda61('0x59'));var _0x1de52b={};_0x1de52b[_0xda61('0x5a')]={'name':!_[_0xda61('0x1d')](_0x1183eb['role']['name'])&&!_['isNil'](_0x1183eb['profile'][_0xda61('0x3e')])&&_0x1183eb[_0xda61('0x3b')][_0xda61('0x3e')]===_0xda61('0x5b')?_0x1183eb[_0xda61('0x46')]['name']:!_[_0xda61('0x1d')](_0x1183eb[_0xda61('0x5c')])?_0x1183eb[_0xda61('0x5c')]+'\x20'+_0x1183eb[_0xda61('0x47')]:_0x1183eb[_0xda61('0x47')],'id':_0x1183eb['id']};_0x1de52b[_0xda61('0x5d')]=intUtil['getString'](_0x3ae9bc[_0xda61('0x5e')],_0x2c1dad,'\x20');_0x1de52b[_0xda61('0x5f')]=intUtil[_0xda61('0x60')](_0x3ae9bc[_0xda61('0x61')],_0x2c1dad,'\x0a');if(_0x40d1b1[_0xda61('0x41')]===_0xda61('0x52')){_0x1de52b[_0xda61('0x62')]={'name':!_[_0xda61('0x1d')](_0x40d1b1[_0xda61('0x63')])?_0x40d1b1['Full_Name']:!_[_0xda61('0x1d')](_0x40d1b1[_0xda61('0x64')])?_0x40d1b1[_0xda61('0x64')]+'\x20'+_0x40d1b1['Last_Name']:_0x40d1b1[_0xda61('0x65')],'id':_0x40d1b1['id']};}if(_0x40d1b1[_0xda61('0x41')]===_0xda61('0x54')){_0x1de52b['What_Id']={'name':!_['isNil'](_0x40d1b1[_0xda61('0x63')])?_0x40d1b1[_0xda61('0x63')]:!_['isNil'](_0x40d1b1['First_Name'])?_0x40d1b1[_0xda61('0x64')]+'\x20'+_0x40d1b1['Last_Name']:_0x40d1b1[_0xda61('0x65')],'id':_0x40d1b1['id']};_0x1de52b[_0xda61('0x66')]=_[_0xda61('0x44')](_0x40d1b1[_0xda61('0x41')]);}if(_0x2c1dad['talktime']){_0x1de52b[_0xda61('0x67')]=moment['utc'](parseInt(_0x2c1dad[_0xda61('0x68')])*0x3e8)[_0xda61('0x32')](_0xda61('0x69'));}else if(_0x2c1dad[_0xda61('0x6a')]&&_0x2c1dad[_0xda61('0x6b')]){_0x1de52b[_0xda61('0x67')]=moment[_0xda61('0x6c')](moment(_0x2c1dad[_0xda61('0x6b')],_0xda61('0x6d'))[_0xda61('0x6e')](moment(_0x2c1dad[_0xda61('0x6f')],_0xda61('0x6d'))))['format']('mm:ss');}switch(_0x2c1dad['lastevent']){case _0xda61('0x70'):_0x1de52b[_0xda61('0x71')]='Called';break;case'complete':case'connect':_0x1de52b[_0xda61('0x71')]=_0xda61('0x72');break;case _0xda61('0x73'):_0x1de52b['Call_Result']=_0xda61('0x74');break;case _0xda61('0x75'):_0x1de52b[_0xda61('0x71')]='Abandoned';break;case _0xda61('0x76'):_0x1de52b[_0xda61('0x71')]=_0xda61('0x77');default:}_0x1de52b[_0xda61('0x78')]=(_0x3fcf87==='outbound'?moment(_0x2c1dad[_0xda61('0x6f')])[_0xda61('0x32')](_0xda61('0x6d')):moment(_0x2c1dad[_0xda61('0x79')])['format'](_0xda61('0x6d')))||moment()[_0xda61('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x1de52b[_0xda61('0x7a')]=_0x3fcf87||_0xda61('0x7b');_0x1de52b=_[_0xda61('0x7c')](_0x1de52b,getCustomFields(_0x3ae9bc['Fields'],_0x2c1dad));return request({'method':'POST','uri':_0xda61('0x42')+_0x3c0759+_0xda61('0x7d'),'headers':{'Authorization':_0xda61('0x48')+_0x579b97},'body':{'data':[_0x1de52b]},'json':!![]})[_0xda61('0x2b')](function(_0x18614c){if(_0x18614c&&_0x18614c[_0xda61('0x49')][0x0][_0xda61('0x4a')]===_0xda61('0x7e')){logger['info']('Call\x20created!');return{'id':_0x18614c[_0xda61('0x49')][0x0][_0xda61('0x4b')]['id']};}})['catch'](function(_0x53f3cd){logger[_0xda61('0x2f')](_0xda61('0x7f'),_0x53f3cd[_0xda61('0x80')]);console[_0xda61('0x4d')](_0xda61('0x7f'),_0x53f3cd);});}exports[_0xda61('0x81')]=function(_0x30023,_0x970b79,_0x258223,_0x36ca57,_0x486a65,_0x55d5b5){var _0x2a1403,_0x2680bd,_0x29316c;_0x55d5b5[_0xda61('0x82')]=intUtil[_0xda61('0x83')](_0x55d5b5[_0xda61('0x82')]);_0x55d5b5['serverUrl']=intUtil[_0xda61('0x83')](_0x55d5b5[_0xda61('0x84')]);if(_0x486a65&&_0x486a65[_0xda61('0x85')]){logger[_0xda61('0x2f')](_0xda61('0x86'),'Recording\x20is\x20enabled!');_0x970b79['recordingURL']=_0x55d5b5[_0xda61('0x84')]+'/api/voice/recordings/'+_0x970b79[_0xda61('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x970b79[_0xda61('0x87')]);}else{_0x970b79[_0xda61('0x88')]='';}var _0x58d2fa=_0x55d5b5['host']===_0xda61('0x89')?'eu':_0xda61('0x8a');return getAccessToken(_0x55d5b5)[_0xda61('0x2b')](function(_0x4748d9){_0x29316c=_0x4748d9;return getUser(_0x29316c,_0x58d2fa,_0x55d5b5,_0x36ca57[_0xda61('0x38')]);})[_0xda61('0x2b')](function(_0x5a4818){_0x2a1403=_0x5a4818;logger[_0xda61('0x2f')](_0xda61('0x8b'),_0x2a1403['id']);return getEndUser(_0x29316c,_0x58d2fa,_0x55d5b5,_0x970b79[_0xda61('0x8c')],_0x970b79[_0xda61('0x8d')],_0x2a1403,_0x258223);})[_0xda61('0x2b')](function(_0x239d43){_0x2680bd=_0x239d43;return getCall(_0x29316c,_0x58d2fa,_0x55d5b5,_0x2a1403,_0x2680bd,_0x258223,_0x970b79,_0xda61('0x7b'));})[_0xda61('0x2b')](function(_0xee1302){if(_0xee1302){logger[_0xda61('0x2f')](_0xda61('0x8e'),_0xee1302['id']);logger[_0xda61('0x2f')](_0xda61('0x86'),_0xda61('0x8f'));emit(util[_0xda61('0x32')](_0xda61('0x90'),_0x36ca57['name']),_0xda61('0x91'),{'uri':_0xda61('0x92')+_0x55d5b5[_0xda61('0x82')]+_0xda61('0x93')+_0xee1302['id']});}})[_0xda61('0x2d')](function(_0xe272e8){logger[_0xda61('0x2e')](_0xda61('0x86'),JSON[_0xda61('0xf')](_0xe272e8));});};exports[_0xda61('0x94')]=function(_0x67cdd9,_0x2016df,_0x1a572b,_0x2d70a8,_0x3eda5d,_0x1a56e5,_0x4ba0bf){var _0x24322f,_0x3fc0b7,_0x198583;_0x1a56e5[_0xda61('0x82')]=intUtil[_0xda61('0x83')](_0x1a56e5['host']);_0x1a56e5[_0xda61('0x84')]=intUtil[_0xda61('0x83')](_0x1a56e5[_0xda61('0x84')]);if(_0x4ba0bf&&_0x4ba0bf[_0xda61('0x95')]&&_0x4ba0bf[_0xda61('0x95')]!==_0xda61('0x96')){logger['info'](_0xda61('0x97'),_0xda61('0x98'));_0x2016df[_0xda61('0x88')]=_0x1a56e5['serverUrl']+'/api/voice/recordings/'+_0x2016df[_0xda61('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2016df[_0xda61('0x87')]);}var _0x2c211c=_0x1a56e5[_0xda61('0x82')]===_0xda61('0x89')?'eu':_0xda61('0x8a');return getAccessToken(_0x1a56e5)[_0xda61('0x2b')](function(_0x47b911){_0x198583=_0x47b911;return getUser(_0x198583,_0x2c211c,_0x1a56e5,_0x2d70a8[_0xda61('0x38')]);})[_0xda61('0x2b')](function(_0x2ec536){_0x24322f=_0x2ec536;logger[_0xda61('0x2f')]('The\x20User\x20ID\x20is:',_0x24322f['id']);return getEndUser(_0x198583,_0x2c211c,_0x1a56e5,_0x2016df['destcalleridname'],_0x2016df['destcalleridnum'],_0x24322f,_0x1a572b);})['then'](function(_0x5eac7a){_0x3fc0b7=_0x5eac7a;return getCall(_0x198583,_0x2c211c,_0x1a56e5,_0x24322f,_0x3fc0b7,_0x1a572b,_0x2016df,_0xda61('0x99'));})[_0xda61('0x2b')](function(_0x274eda){if(_0x274eda){logger[_0xda61('0x2f')](_0xda61('0x8e'),_0x274eda['id']);logger[_0xda61('0x2f')](_0xda61('0x97'),_0xda61('0x8f'));emit(util[_0xda61('0x32')](_0xda61('0x90'),_0x2d70a8[_0xda61('0x3e')]),_0xda61('0x91'),{'uri':_0xda61('0x92')+_0x1a56e5[_0xda61('0x82')]+_0xda61('0x93')+_0x274eda['id']});}})[_0xda61('0x2d')](function(_0x5f1463){logger[_0xda61('0x2e')]('[OUTBOUND]',JSON['stringify'](_0x5f1463));});};exports['unmanaged']=function(_0x1dff92,_0x2bf477,_0x46eff7,_0x1c25f0,_0xeb04e8,_0x5f2f3f){var _0x21ccc1,_0x1ef553,_0x1de6a6;_0x5f2f3f['host']=intUtil['stripTrailingSlash'](_0x5f2f3f[_0xda61('0x82')]);_0x5f2f3f['serverUrl']=intUtil[_0xda61('0x83')](_0x5f2f3f[_0xda61('0x84')]);if(_0xeb04e8&&_0xeb04e8['monitor_format']){logger[_0xda61('0x2f')]('['+_0x2bf477['lastevent']['toUpperCase']()+']',_0xda61('0x98'));_0x2bf477[_0xda61('0x88')]=_0x5f2f3f[_0xda61('0x84')]+'/api/voice/recordings/'+_0x2bf477[_0xda61('0x87')]+'/downloads?type=uniqueid&token='+md5(_0x2bf477['uniqueid']);}else{_0x2bf477[_0xda61('0x88')]='';}var _0x4897c5=_0x5f2f3f['host']===_0xda61('0x89')?'eu':_0xda61('0x8a');return getAccessToken(_0x5f2f3f)[_0xda61('0x2b')](function(_0x4415c1){_0x1de6a6=_0x4415c1;return getUser(_0x1de6a6,_0x4897c5,_0x5f2f3f);})[_0xda61('0x2b')](function(_0x2b0d7c){_0x21ccc1=_0x2b0d7c;logger['info']('The\x20User\x20ID\x20is:',_0x21ccc1['id']);return getEndUser(_0x1de6a6,_0x4897c5,_0x5f2f3f,_0x2bf477[_0xda61('0x8c')],_0x2bf477[_0xda61('0x8d')],_0x21ccc1,_0x46eff7);})['then'](function(_0x16f7df){_0x1ef553=_0x16f7df;return getCall(_0x1de6a6,_0x4897c5,_0x5f2f3f,_0x21ccc1,_0x1ef553,_0x46eff7,_0x2bf477,'Inbound');})[_0xda61('0x2b')](function(_0x410c4c){if(_0x410c4c){logger[_0xda61('0x2f')]('The\x20Call\x20ID\x20is:',_0x410c4c['id']);}})[_0xda61('0x2d')](function(_0x125f74){logger[_0xda61('0x2e')]('['+_0x2bf477[_0xda61('0x9a')][_0xda61('0x9b')]()+']',JSON[_0xda61('0xf')](_0x125f74));});}; \ No newline at end of file +var _0xbc7c=['Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','catch','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','Contacts','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue','host','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','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','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','findIndex','profile','user','Administrator'];(function(_0x1c55d6,_0x590163){var _0x16bdb3=function(_0x3c5069){while(--_0x3c5069){_0x1c55d6['push'](_0x1c55d6['shift']());}};_0x16bdb3(++_0x590163);}(_0xbc7c,0x1a4));var _0xcbc7=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0xbc7c[_0x25f805];return _0xf6628f;};'use strict';var _=require('lodash');var rp=require(_0xcbc7('0x0'));var md5=require('md5');var util=require(_0xcbc7('0x1'));var intUtil=require(_0xcbc7('0x2'));var moment=require(_0xcbc7('0x3'));var Redis=require(_0xcbc7('0x4'));var BPromise=require(_0xcbc7('0x5'));var config=require(_0xcbc7('0x6'));var logger=require(_0xcbc7('0x7'))(_0xcbc7('0x8'));config[_0xcbc7('0x9')]=_[_0xcbc7('0xa')](config[_0xcbc7('0x9')],{'host':_0xcbc7('0xb'),'port':0x18eb});var io=require(_0xcbc7('0xc'))(new Redis(config[_0xcbc7('0x9')]));function emit(_0x58f783,_0xbc15,_0x18b090){io['to'](_0x58f783)[_0xcbc7('0xd')](_0xbc15,_0x18b090);}function request(_0x2cf221){logger[_0xcbc7('0xe')](_0xcbc7('0xf'),JSON[_0xcbc7('0x10')](_0x2cf221));return rp(_0x2cf221);}function getCustomFields(_0x2b3713,_0x5e60f7){var _0x17b1b0={};if(_0x2b3713['length']>0x0){_[_0xcbc7('0x11')](_0x2b3713,function(_0x502182){if(_[_0xcbc7('0x12')]([_0xcbc7('0x13'),_0xcbc7('0x14')],_0x502182[_0xcbc7('0x15')])&&_0x502182[_0xcbc7('0x16')]){_0x17b1b0[_0x502182[_0xcbc7('0x16')]]=_0x502182['content'][_0xcbc7('0x17')]();}else if(_0x502182[_0xcbc7('0x15')]==='variable'&&_0x502182[_0xcbc7('0x18')]&&_0x502182['idField']&&_0x5e60f7[_0x502182['variableName']]){_0x17b1b0[_0x502182[_0xcbc7('0x16')]]=_0x5e60f7[_0x502182['variableName']][_0xcbc7('0x17')]();}else if(_0x502182[_0xcbc7('0x15')]==='customVariable'&&_0x502182[_0xcbc7('0x19')]&&_0x502182[_0xcbc7('0x19')]['name']&&_0x502182['idField']&&_0x5e60f7[_0x502182[_0xcbc7('0x19')][_0xcbc7('0x1a')]['toLowerCase']()]){_0x17b1b0[_0x502182[_0xcbc7('0x16')]]=_0x5e60f7[_0x502182['Variable'][_0xcbc7('0x1a')]['toLowerCase']()][_0xcbc7('0x17')]();}});}return _0x17b1b0;}function getName(_0x58401d){if(_0x58401d['indexOf']('\x20')>0x0){var _0x1a7b95=_0x58401d['split'](/ (.+)/);if(_0x1a7b95[0x1]){return _0x1a7b95;}}return[_0x58401d,_0x58401d];}var accountsTokens={};function getAccessToken(_0xb4c612){return new Promise(function(_0x139f7f,_0x1493c2){if(!_[_0xcbc7('0x1b')](accountsTokens[_0xb4c612['id']])&&!_[_0xcbc7('0x1b')](accountsTokens[_0xb4c612['id']][_0xcbc7('0x1c')])){if(moment()[_0xcbc7('0x1d')](accountsTokens[_0xb4c612['id']][_0xcbc7('0x1e')])){_0x139f7f(accountsTokens[_0xb4c612['id']][_0xcbc7('0x1c')]);}}var _0x1fe4fa;switch(_0xb4c612[_0xcbc7('0x1f')]){case'US':_0x1fe4fa=_0xcbc7('0x20');break;case'AU':_0x1fe4fa=_0xcbc7('0x21');break;case'EU':_0x1fe4fa=_0xcbc7('0x22');break;case'IN':_0x1fe4fa=_0xcbc7('0x23');break;case'CN':_0x1fe4fa=_0xcbc7('0x24');break;default:_0x1fe4fa=_0xcbc7('0x22');break;}var _0x532fdc={'method':'POST','uri':_0x1fe4fa+_0xcbc7('0x25'),'qs':{'refresh_token':_0xb4c612[_0xcbc7('0x26')],'client_id':_0xb4c612[_0xcbc7('0x27')],'client_secret':_0xb4c612[_0xcbc7('0x28')],'grant_type':_0xcbc7('0x29')},'json':!![]};return rp(_0x532fdc)[_0xcbc7('0x2a')](function(_0x3b7990){accountsTokens[_0xb4c612['id']]={'access_token':_0x3b7990[_0xcbc7('0x1c')],'expires_in':moment()['add'](_0x3b7990[_0xcbc7('0x1e')],_0xcbc7('0x2b'))};_0x139f7f(_0x3b7990[_0xcbc7('0x1c')]);})['catch'](function(_0x2aabf3){logger[_0xcbc7('0x2c')](_0xcbc7('0x2d'),_0x2aabf3[_0xcbc7('0x2e')]);_0x1493c2(_0x2aabf3);});});}function getUser(_0x2455e0,_0x21355f,_0x58e4e1,_0x1ca56d){logger['info'](_0xcbc7('0x2f'));return request({'method':_0xcbc7('0x30'),'uri':util[_0xcbc7('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x21355f),'qs':{'type':_0xcbc7('0x32')},'headers':{'Authorization':_0xcbc7('0x33')+_0x2455e0},'json':!![]})[_0xcbc7('0x2a')](function(_0x48c735){if(_0x48c735[_0xcbc7('0x34')]){var _0xdb9298=-0x1;if(_[_0xcbc7('0x35')](_0x48c735[_0xcbc7('0x34')])){if(!_[_0xcbc7('0x1b')](_0x1ca56d)){_0xdb9298=_['findIndex'](_0x48c735[_0xcbc7('0x34')],function(_0x2aed54){return _0x2aed54[_0xcbc7('0x36')]===_0x1ca56d;});}if(_0xdb9298>=0x0){logger[_0xcbc7('0x37')]('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0xdb9298=_[_0xcbc7('0x38')](_0x48c735[_0xcbc7('0x34')],function(_0x4d0ce5){return _0x4d0ce5[_0xcbc7('0x39')][_0xcbc7('0x1a')]==='Administrator';});}return _0x48c735[_0xcbc7('0x34')][_0xdb9298];}else{if(_0x48c735[_0xcbc7('0x3a')]['profile'][_0xcbc7('0x1a')]===_0xcbc7('0x3b')){logger[_0xcbc7('0x37')](_0xcbc7('0x3c'));user=_0x48c735[_0xcbc7('0x3a')];return user;}else{logger[_0xcbc7('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x48c735));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xcbc7('0x10')](_0x48c735));}}}else{logger[_0xcbc7('0x2c')](_0xcbc7('0x3d'),JSON['stringify'](_0x48c735));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xcbc7('0x10')](_0x48c735));}})[_0xcbc7('0x3e')](function(_0x5bdaa6){console['error'](_0x5bdaa6);});}function getZohoUser(_0x219112,_0x5e7cad){return new BPromise(function(_0x264b3e,_0x4aef70){request(_0x219112)[_0xcbc7('0x2a')](function(_0x1e38e9){var _0x5d7af2=null;if(_0x1e38e9){_0x5d7af2=_0x1e38e9['data'][0x0];_0x5d7af2[_0xcbc7('0x3f')]=_0x5e7cad;}_0x264b3e(_0x5d7af2);})[_0xcbc7('0x3e')](function(_0x17c15b){_0x4aef70(_0x17c15b);});});}function createEndUser(_0x3acbea,_0x511980,_0x6f77a,_0x14709d,_0x3f6775,_0x47b796){var _0x6f77a=getName(_0x6f77a);return request({'method':_0xcbc7('0x40'),'uri':_0xcbc7('0x41')+_0x511980+_0xcbc7('0x42')+_[_0xcbc7('0x43')](_0x47b796[_0xcbc7('0x44')])+'s','body':{'data':[{'Last_Name':_0x6f77a[0x1],'First_Name':_0x6f77a[0x0],'Phone':_0x14709d,'Owner':{'name':!_[_0xcbc7('0x1b')](_0x3f6775['role']['name'])?_0x3f6775[_0xcbc7('0x45')][_0xcbc7('0x1a')]:!_[_0xcbc7('0x1b')](_0x3f6775[_0xcbc7('0x46')])?_0x3f6775[_0xcbc7('0x46')]+'\x20'+_0x3f6775[_0xcbc7('0x47')]:_0x3f6775[_0xcbc7('0x47')],'id':_0x3f6775['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3acbea},'json':!![]})['then'](function(_0x41dd9b){if(_0x41dd9b&&_0x41dd9b[_0xcbc7('0x48')][0x0][_0xcbc7('0x49')]==='SUCCESS'){var _0x3ba382=_0x41dd9b[_0xcbc7('0x48')][0x0][_0xcbc7('0x4a')];_0x3ba382['enduserType']=_[_0xcbc7('0x43')](_0x47b796['moduleCreate'])+'s';return _0x3ba382;}logger[_0xcbc7('0x2c')](_0xcbc7('0x3d'),JSON[_0xcbc7('0x10')](data));throw new Error(_0xcbc7('0x4b')+JSON['stringify'](data));})[_0xcbc7('0x3e')](function(_0x4dc52f){console[_0xcbc7('0x4c')](_0xcbc7('0x4d'),_0x4dc52f);});}function getEndUser(_0x2c4036,_0x50bb0f,_0x386f2d,_0x49950b,_0x417869,_0x23cce0,_0xcd7b09){var _0x7e254d={'method':_0xcbc7('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2c4036},'json':!![]};switch(_0xcd7b09[_0xcbc7('0x4e')]){case'contact_lead':_0x7e254d[_0xcbc7('0x4f')]='https://www.zohoapis.'+_0x50bb0f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x417869+'))';return getZohoUser(_0x7e254d,_0xcbc7('0x50'))['then'](function(_0x945658){if(_0x945658)return _0x945658;_0x7e254d[_0xcbc7('0x4f')]=_0xcbc7('0x41')+_0x50bb0f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x417869+'))';return getZohoUser(_0x7e254d,'Leads')[_0xcbc7('0x2a')](function(_0x145713){if(_0x145713)return _0x145713;if(_0xcd7b09[_0xcbc7('0x44')]!=_0xcbc7('0x51')){return createEndUser(_0x2c4036,_0x50bb0f,_0x49950b,_0x417869,_0x23cce0,_0xcd7b09);}else{return{};}});});break;case _0xcbc7('0x52'):_0x7e254d[_0xcbc7('0x4f')]='https://www.zohoapis.'+_0x50bb0f+_0xcbc7('0x53')+_0x417869+'))';return getZohoUser(_0x7e254d,_0xcbc7('0x50'))[_0xcbc7('0x2a')](function(_0x4fa8c3){if(_0x4fa8c3)return _0x4fa8c3;if(_0xcd7b09[_0xcbc7('0x44')]!='nothing'){return createEndUser(_0x2c4036,_0x50bb0f,_0x49950b,_0x417869,_0x23cce0,_0xcd7b09);}else{return{};}});break;case _0xcbc7('0x54'):_0x7e254d[_0xcbc7('0x4f')]=_0xcbc7('0x41')+_0x50bb0f+_0xcbc7('0x55')+_0x417869+'))';return getZohoUser(_0x7e254d,_0xcbc7('0x56'))[_0xcbc7('0x2a')](function(_0x41a95d){if(_0x41a95d)return _0x41a95d;if(_0xcd7b09[_0xcbc7('0x44')]!=_0xcbc7('0x51')){return createEndUser(_0x2c4036,_0x50bb0f,_0x49950b,_0x417869,_0x23cce0,_0xcd7b09);}else{return{};}});break;}}function getCall(_0x5dbdb3,_0x2b5a70,_0x396278,_0x5ef4fc,_0x1e1a97,_0x1c9fb9,_0x588bdf,_0xb22ad5){logger[_0xcbc7('0x37')](_0xcbc7('0x57'));var _0x3584f2={};_0x3584f2['Owner']={'name':!_[_0xcbc7('0x1b')](_0x5ef4fc[_0xcbc7('0x45')]['name'])&&!_[_0xcbc7('0x1b')](_0x5ef4fc[_0xcbc7('0x39')][_0xcbc7('0x1a')])&&_0x5ef4fc[_0xcbc7('0x39')]['name']===_0xcbc7('0x58')?_0x5ef4fc['role']['name']:!_[_0xcbc7('0x1b')](_0x5ef4fc[_0xcbc7('0x46')])?_0x5ef4fc[_0xcbc7('0x46')]+'\x20'+_0x5ef4fc[_0xcbc7('0x47')]:_0x5ef4fc[_0xcbc7('0x47')],'id':_0x5ef4fc['id']};_0x3584f2[_0xcbc7('0x59')]=intUtil[_0xcbc7('0x5a')](_0x1c9fb9[_0xcbc7('0x5b')],_0x588bdf,'\x20');_0x3584f2[_0xcbc7('0x5c')]=intUtil[_0xcbc7('0x5a')](_0x1c9fb9[_0xcbc7('0x5d')],_0x588bdf,'\x0a');if(_0x1e1a97[_0xcbc7('0x3f')]==='Contacts'){_0x3584f2[_0xcbc7('0x5e')]={'name':!_[_0xcbc7('0x1b')](_0x1e1a97['Full_Name'])?_0x1e1a97['Full_Name']:!_[_0xcbc7('0x1b')](_0x1e1a97[_0xcbc7('0x5f')])?_0x1e1a97[_0xcbc7('0x5f')]+'\x20'+_0x1e1a97[_0xcbc7('0x60')]:_0x1e1a97['Last_Name'],'id':_0x1e1a97['id']};}if(_0x1e1a97[_0xcbc7('0x3f')]==='Leads'){_0x3584f2[_0xcbc7('0x61')]={'name':!_[_0xcbc7('0x1b')](_0x1e1a97[_0xcbc7('0x62')])?_0x1e1a97[_0xcbc7('0x62')]:!_[_0xcbc7('0x1b')](_0x1e1a97[_0xcbc7('0x5f')])?_0x1e1a97['First_Name']+'\x20'+_0x1e1a97['Last_Name']:_0x1e1a97['Last_Name'],'id':_0x1e1a97['id']};_0x3584f2[_0xcbc7('0x63')]=_['startCase'](_0x1e1a97[_0xcbc7('0x3f')]);}if(_0x588bdf[_0xcbc7('0x64')]){_0x3584f2[_0xcbc7('0x65')]=moment[_0xcbc7('0x66')](parseInt(_0x588bdf[_0xcbc7('0x64')])*0x3e8)[_0xcbc7('0x31')](_0xcbc7('0x67'));}else if(_0x588bdf[_0xcbc7('0x68')]&&_0x588bdf[_0xcbc7('0x69')]){_0x3584f2['Call_Duration']=moment[_0xcbc7('0x66')](moment(_0x588bdf['endtime'],_0xcbc7('0x6a'))[_0xcbc7('0x6b')](moment(_0x588bdf[_0xcbc7('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0xcbc7('0x31')]('mm:ss');}switch(_0x588bdf[_0xcbc7('0x6d')]){case _0xcbc7('0x6e'):_0x3584f2[_0xcbc7('0x6f')]=_0xcbc7('0x70');break;case _0xcbc7('0x71'):case _0xcbc7('0x72'):_0x3584f2[_0xcbc7('0x6f')]=_0xcbc7('0x73');break;case _0xcbc7('0x74'):_0x3584f2[_0xcbc7('0x6f')]=_0xcbc7('0x75');break;case _0xcbc7('0x76'):_0x3584f2['Call_Result']='Abandoned';break;case _0xcbc7('0x77'):_0x3584f2[_0xcbc7('0x6f')]='Timeout';default:}_0x3584f2[_0xcbc7('0x78')]=(_0xb22ad5===_0xcbc7('0x79')?moment(_0x588bdf[_0xcbc7('0x6c')])[_0xcbc7('0x31')](_0xcbc7('0x6a')):moment(_0x588bdf[_0xcbc7('0x7a')])[_0xcbc7('0x31')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xcbc7('0x31')](_0xcbc7('0x6a'));_0x3584f2[_0xcbc7('0x7b')]=_0xb22ad5||_0xcbc7('0x7c');_0x3584f2=_[_0xcbc7('0x7d')](_0x3584f2,getCustomFields(_0x1c9fb9['Fields'],_0x588bdf));return request({'method':_0xcbc7('0x40'),'uri':_0xcbc7('0x41')+_0x2b5a70+_0xcbc7('0x7e'),'headers':{'Authorization':_0xcbc7('0x33')+_0x5dbdb3},'body':{'data':[_0x3584f2]},'json':!![]})['then'](function(_0x16c0ed){if(_0x16c0ed&&_0x16c0ed[_0xcbc7('0x48')][0x0][_0xcbc7('0x49')]===_0xcbc7('0x7f')){logger[_0xcbc7('0x37')](_0xcbc7('0x80'));return{'id':_0x16c0ed['data'][0x0]['details']['id']};}})[_0xcbc7('0x3e')](function(_0x3e785a){logger[_0xcbc7('0x37')]('err',_0x3e785a[_0xcbc7('0x2e')]);console['log'](_0xcbc7('0x81'),_0x3e785a);});}exports[_0xcbc7('0x82')]=function(_0x5a76b5,_0x4e7720,_0x1c2046,_0x2eb0cc,_0x53259d,_0x7cde3e){var _0x5f03e4,_0x40b7b9,_0x2ccaf0;_0x7cde3e[_0xcbc7('0x83')]=intUtil[_0xcbc7('0x84')](_0x7cde3e[_0xcbc7('0x83')]);_0x7cde3e['serverUrl']=intUtil['stripTrailingSlash'](_0x7cde3e['serverUrl']);if(_0x53259d&&_0x53259d[_0xcbc7('0x85')]){logger[_0xcbc7('0x37')](_0xcbc7('0x86'),_0xcbc7('0x87'));_0x4e7720[_0xcbc7('0x88')]=_0x7cde3e[_0xcbc7('0x89')]+_0xcbc7('0x8a')+_0x4e7720[_0xcbc7('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x4e7720[_0xcbc7('0x8b')]);}else{_0x4e7720['recordingURL']='';}var _0x398468=_0x7cde3e[_0xcbc7('0x83')]===_0xcbc7('0x8c')?'eu':_0xcbc7('0x8d');return getAccessToken(_0x7cde3e)['then'](function(_0x9b0979){_0x2ccaf0=_0x9b0979;return getUser(_0x2ccaf0,_0x398468,_0x7cde3e,_0x2eb0cc[_0xcbc7('0x36')]);})[_0xcbc7('0x2a')](function(_0xb2bf68){_0x5f03e4=_0xb2bf68;logger[_0xcbc7('0x37')](_0xcbc7('0x8e'),_0x5f03e4['id']);return getEndUser(_0x2ccaf0,_0x398468,_0x7cde3e,_0x4e7720[_0xcbc7('0x8f')],_0x4e7720[_0xcbc7('0x90')],_0x5f03e4,_0x1c2046);})[_0xcbc7('0x2a')](function(_0xb6ac4){_0x40b7b9=_0xb6ac4;return getCall(_0x2ccaf0,_0x398468,_0x7cde3e,_0x5f03e4,_0x40b7b9,_0x1c2046,_0x4e7720,_0xcbc7('0x7c'));})[_0xcbc7('0x2a')](function(_0x5f1e87){if(_0x5f1e87){logger[_0xcbc7('0x37')](_0xcbc7('0x91'),_0x5f1e87['id']);logger['info'](_0xcbc7('0x86'),_0xcbc7('0x92'));emit(util[_0xcbc7('0x31')](_0xcbc7('0x93'),_0x2eb0cc['name']),_0xcbc7('0x94'),{'uri':_0xcbc7('0x95')+_0x7cde3e['host']+_0xcbc7('0x96')+_0x5f1e87['id']});}})['catch'](function(_0x42ef71){logger['error'](_0xcbc7('0x86'),JSON[_0xcbc7('0x10')](_0x42ef71));});};exports[_0xcbc7('0x79')]=function(_0x4d86a1,_0x9d94fe,_0x199198,_0x7e79f0,_0x3965e0,_0xedb0b0,_0x582f37){var _0x4418d9,_0x43a505,_0x367c9f;_0xedb0b0[_0xcbc7('0x83')]=intUtil[_0xcbc7('0x84')](_0xedb0b0['host']);_0xedb0b0[_0xcbc7('0x89')]=intUtil[_0xcbc7('0x84')](_0xedb0b0['serverUrl']);if(_0x582f37&&_0x582f37[_0xcbc7('0x97')]&&_0x582f37[_0xcbc7('0x97')]!==_0xcbc7('0x98')){logger[_0xcbc7('0x37')]('[OUTBOUND]',_0xcbc7('0x87'));_0x9d94fe[_0xcbc7('0x88')]=_0xedb0b0[_0xcbc7('0x89')]+_0xcbc7('0x8a')+_0x9d94fe[_0xcbc7('0x8b')]+_0xcbc7('0x99')+md5(_0x9d94fe[_0xcbc7('0x8b')]);}var _0x605179=_0xedb0b0[_0xcbc7('0x83')]===_0xcbc7('0x8c')?'eu':_0xcbc7('0x8d');return getAccessToken(_0xedb0b0)[_0xcbc7('0x2a')](function(_0x40fb24){_0x367c9f=_0x40fb24;return getUser(_0x367c9f,_0x605179,_0xedb0b0,_0x7e79f0[_0xcbc7('0x36')]);})[_0xcbc7('0x2a')](function(_0x579f17){_0x4418d9=_0x579f17;logger['info'](_0xcbc7('0x8e'),_0x4418d9['id']);return getEndUser(_0x367c9f,_0x605179,_0xedb0b0,_0x9d94fe[_0xcbc7('0x9a')],_0x9d94fe[_0xcbc7('0x9b')],_0x4418d9,_0x199198);})[_0xcbc7('0x2a')](function(_0x188290){_0x43a505=_0x188290;return getCall(_0x367c9f,_0x605179,_0xedb0b0,_0x4418d9,_0x43a505,_0x199198,_0x9d94fe,_0xcbc7('0x9c'));})[_0xcbc7('0x2a')](function(_0x583df0){if(_0x583df0){logger[_0xcbc7('0x37')](_0xcbc7('0x91'),_0x583df0['id']);logger[_0xcbc7('0x37')]('[OUTBOUND]',_0xcbc7('0x92'));emit(util[_0xcbc7('0x31')](_0xcbc7('0x93'),_0x7e79f0[_0xcbc7('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0xedb0b0[_0xcbc7('0x83')]+_0xcbc7('0x96')+_0x583df0['id']});}})[_0xcbc7('0x3e')](function(_0xde92aa){logger['error'](_0xcbc7('0x9d'),JSON['stringify'](_0xde92aa));});};exports[_0xcbc7('0x9e')]=function(_0x238b59,_0x113bd1,_0x1b30a6,_0x559306,_0x162e05,_0x51fa47){var _0x25693b,_0x4b37ca,_0x5aa0c6;_0x51fa47[_0xcbc7('0x83')]=intUtil['stripTrailingSlash'](_0x51fa47[_0xcbc7('0x83')]);_0x51fa47[_0xcbc7('0x89')]=intUtil[_0xcbc7('0x84')](_0x51fa47[_0xcbc7('0x89')]);if(_0x162e05&&_0x162e05['monitor_format']){logger['info']('['+_0x113bd1[_0xcbc7('0x6d')][_0xcbc7('0x9f')]()+']','Recording\x20is\x20enabled!');_0x113bd1['recordingURL']=_0x51fa47[_0xcbc7('0x89')]+_0xcbc7('0x8a')+_0x113bd1[_0xcbc7('0x8b')]+_0xcbc7('0x99')+md5(_0x113bd1[_0xcbc7('0x8b')]);}else{_0x113bd1['recordingURL']='';}var _0x304d31=_0x51fa47['host']===_0xcbc7('0x8c')?'eu':_0xcbc7('0x8d');return getAccessToken(_0x51fa47)['then'](function(_0x1b3502){_0x5aa0c6=_0x1b3502;return getUser(_0x5aa0c6,_0x304d31,_0x51fa47);})[_0xcbc7('0x2a')](function(_0xa095e4){_0x25693b=_0xa095e4;logger[_0xcbc7('0x37')](_0xcbc7('0x8e'),_0x25693b['id']);return getEndUser(_0x5aa0c6,_0x304d31,_0x51fa47,_0x113bd1[_0xcbc7('0x8f')],_0x113bd1[_0xcbc7('0x90')],_0x25693b,_0x1b30a6);})[_0xcbc7('0x2a')](function(_0xb37972){_0x4b37ca=_0xb37972;return getCall(_0x5aa0c6,_0x304d31,_0x51fa47,_0x25693b,_0x4b37ca,_0x1b30a6,_0x113bd1,_0xcbc7('0x7c'));})[_0xcbc7('0x2a')](function(_0x16d663){if(_0x16d663){logger[_0xcbc7('0x37')](_0xcbc7('0x91'),_0x16d663['id']);}})[_0xcbc7('0x3e')](function(_0x28c858){logger['error']('['+_0x113bd1[_0xcbc7('0x6d')][_0xcbc7('0x9f')]()+']',JSON[_0xcbc7('0x10')](_0x28c858));});}; \ 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 9f2ed61..0680c99 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 _0xc0d1=['Script','data3','render','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2'];(function(_0x742fd7,_0x4f6713){var _0x153a06=function(_0x56946e){while(--_0x56946e){_0x742fd7['push'](_0x742fd7['shift']());}};_0x153a06(++_0x4f6713);}(_0xc0d1,0x1b2));var _0x1c0d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc0d1[_0x4565bf];return _0x5610ba;};'use strict';var util=require(_0x1c0d('0x0'));var sh=require(_0x1c0d('0x1'));var Mustache=require(_0x1c0d('0x2'));var logger=require('../../../../config/logger')(_0x1c0d('0x3'));exports[_0x1c0d('0x4')]=function(_0x1eb7ff,_0x45caf3){var _0x43e0f9=_0x1eb7ff[_0x1c0d('0x5')]?_0x1eb7ff[_0x1c0d('0x5')]:_0x1c0d('0x6');var _0x24415e=_0x1eb7ff[_0x1c0d('0x7')]?Mustache[_0x1c0d('0x8')](_0x1eb7ff[_0x1c0d('0x7')],_0x45caf3):_0x45caf3;sh[_0x1c0d('0x4')](_0x24415e,function(_0x1e28d0,_0x282b80,_0x517adc){if(_0x1e28d0!==0x0){logger['error'](util[_0x1c0d('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x43e0f9,_0x24415e,_0x1e28d0,_0x517adc));}else{logger['info'](util[_0x1c0d('0x9')](_0x1c0d('0xa'),_0x43e0f9,_0x24415e,_0x282b80));}});}; \ No newline at end of file +var _0x0aa1=['exec','data2','Script','data3','error','info','format','shelljs','mustache','trigger'];(function(_0x1122e4,_0x5ccf86){var _0x175d66=function(_0x28dbfa){while(--_0x28dbfa){_0x1122e4['push'](_0x1122e4['shift']());}};_0x175d66(++_0x5ccf86);}(_0x0aa1,0x18d));var _0x10aa=function(_0x12d25a,_0x3d061a){_0x12d25a=_0x12d25a-0x0;var _0x238959=_0x0aa1[_0x12d25a];return _0x238959;};'use strict';var util=require('util');var sh=require(_0x10aa('0x0'));var Mustache=require(_0x10aa('0x1'));var logger=require('../../../../config/logger')(_0x10aa('0x2'));exports[_0x10aa('0x3')]=function(_0xf19a4e,_0x4620b8){var _0x1f3282=_0xf19a4e[_0x10aa('0x4')]?_0xf19a4e['data2']:_0x10aa('0x5');var _0x3f82e4=_0xf19a4e[_0x10aa('0x6')]?Mustache['render'](_0xf19a4e[_0x10aa('0x6')],_0x4620b8):_0x4620b8;sh[_0x10aa('0x3')](_0x3f82e4,function(_0x13e204,_0x1f25a7,_0x21ad00){if(_0x13e204!==0x0){logger[_0x10aa('0x7')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1f3282,_0x3f82e4,_0x13e204,_0x21ad00));}else{logger[_0x10aa('0x8')](util[_0x10aa('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x1f3282,_0x3f82e4,_0x1f25a7));}});}; \ 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 757c629..5688e8e 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 _0xac71=['%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','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','data2','data5','data6','toUpperCase','PUT','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','format'];(function(_0x38c842,_0x4d8d4d){var _0x3e555b=function(_0x29c427){while(--_0x29c427){_0x38c842['push'](_0x38c842['shift']());}};_0x3e555b(++_0x4d8d4d);}(_0xac71,0x149));var _0x1ac7=function(_0xf97eb0,_0x1578b7){_0xf97eb0=_0xf97eb0-0x0;var _0xea70f4=_0xac71[_0xf97eb0];return _0xea70f4;};'use strict';var rp=require(_0x1ac7('0x0'));var util=require(_0x1ac7('0x1'));var _=require(_0x1ac7('0x2'));var Mustache=require(_0x1ac7('0x3'));var logger=require(_0x1ac7('0x4'))('trigger');exports['exec']=function(_0x1caf2f,_0x8bb4c2){var _0x555451,_0x42d901;var _0x1eb750={'method':_0x1caf2f[_0x1ac7('0x5')]['toUpperCase'](),'uri':Mustache['render'](_0x1caf2f[_0x1ac7('0x6')],_0x8bb4c2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1caf2f['data5'])==='number'&&parseInt(_0x1caf2f['data5'])>=0x1&&parseInt(_0x1caf2f[_0x1ac7('0x7')])<=0xa?parseInt(_0x1caf2f['data5'])*0x3e8:0x5*0x3e8};try{_0x1eb750['headers']=_0x1caf2f[_0x1ac7('0x8')]?JSON['parse'](Mustache['render'](_0x1caf2f[_0x1ac7('0x8')],_0x8bb4c2)):{};}catch(_0x217b76){logger['error'](_0x217b76['stack']);}switch(_0x1caf2f[_0x1ac7('0x5')][_0x1ac7('0x9')]()){case'GET':case'DELETE':_0x555451=null;_0x1eb750['qs']=_0x8bb4c2;break;case'POST':case _0x1ac7('0xa'):if(_0x1caf2f['data7']){try{_0x555451=JSON['parse'](Mustache['render'](_0x1caf2f[_0x1ac7('0xb')],_0x8bb4c2));_0x1eb750[_0x1ac7('0xc')]=_0x555451;}catch(_0x51a2c4){logger[_0x1ac7('0xd')](_0x51a2c4[_0x1ac7('0xe')]);logger[_0x1ac7('0xd')](_0x1ac7('0xf'));}}else{_0x555451=_0x8bb4c2;_0x1eb750[_0x1ac7('0xc')]=_0x555451;}break;}logger[_0x1ac7('0x10')](util['format'](_0x1ac7('0x11'),_0x1caf2f[_0x1ac7('0x5')],_0x1caf2f[_0x1ac7('0x6')],JSON[_0x1ac7('0x12')](_0x1eb750)));rp(_0x1eb750)['then'](function(_0x2e688c){_0x555451=!_[_0x1ac7('0x13')](_0x555451)?',\x20request\x20body:\x20'+_0x555451:'';_0x42d901=typeof _0x2e688c[_0x1ac7('0xc')]===_0x1ac7('0x14')?JSON['stringify'](_0x2e688c[_0x1ac7('0xc')]):_0x2e688c[_0x1ac7('0xc')];logger[_0x1ac7('0x10')](util[_0x1ac7('0x15')](_0x1ac7('0x16'),_0x1caf2f['data1'],_0x1caf2f[_0x1ac7('0x6')],_0x2e688c[_0x1ac7('0x17')],_0x42d901));})[_0x1ac7('0x18')](function(_0x142b3f){logger[_0x1ac7('0xd')](util['format'](_0x1ac7('0x19'),_0x1caf2f[_0x1ac7('0x5')],_0x1caf2f[_0x1ac7('0x6')],_0x142b3f[_0x1ac7('0x17')],_0x142b3f['name'],_0x142b3f[_0x1ac7('0x1a')]));});}; \ No newline at end of file +var _0x8c56=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data1','then','isNil',',\x20request\x20body:\x20','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','data5','number','headers','data6','parse','error','toUpperCase','GET','DELETE','PUT','body','stack'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x8c56,0xe0));var _0x68c5=function(_0x2e067a,_0xab528c){_0x2e067a=_0x2e067a-0x0;var _0xc64976=_0x8c56[_0x2e067a];return _0xc64976;};'use strict';var rp=require(_0x68c5('0x0'));var util=require(_0x68c5('0x1'));var _=require(_0x68c5('0x2'));var Mustache=require(_0x68c5('0x3'));var logger=require(_0x68c5('0x4'))(_0x68c5('0x5'));exports[_0x68c5('0x6')]=function(_0x5f4b65,_0x16a84c){var _0x59547,_0x32b00f;var _0x2d47aa={'method':_0x5f4b65['data1']['toUpperCase'](),'uri':Mustache[_0x68c5('0x7')](_0x5f4b65[_0x68c5('0x8')],_0x16a84c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f4b65[_0x68c5('0x9')])===_0x68c5('0xa')&&parseInt(_0x5f4b65[_0x68c5('0x9')])>=0x1&&parseInt(_0x5f4b65[_0x68c5('0x9')])<=0xa?parseInt(_0x5f4b65[_0x68c5('0x9')])*0x3e8:0x5*0x3e8};try{_0x2d47aa[_0x68c5('0xb')]=_0x5f4b65[_0x68c5('0xc')]?JSON[_0x68c5('0xd')](Mustache[_0x68c5('0x7')](_0x5f4b65[_0x68c5('0xc')],_0x16a84c)):{};}catch(_0x57b424){logger[_0x68c5('0xe')](_0x57b424['stack']);}switch(_0x5f4b65['data1'][_0x68c5('0xf')]()){case _0x68c5('0x10'):case _0x68c5('0x11'):_0x59547=null;_0x2d47aa['qs']=_0x16a84c;break;case'POST':case _0x68c5('0x12'):if(_0x5f4b65['data7']){try{_0x59547=JSON[_0x68c5('0xd')](Mustache[_0x68c5('0x7')](_0x5f4b65['data7'],_0x16a84c));_0x2d47aa[_0x68c5('0x13')]=_0x59547;}catch(_0x139293){logger[_0x68c5('0xe')](_0x139293[_0x68c5('0x14')]);logger['error'](_0x68c5('0x15'));}}else{_0x59547=_0x16a84c;_0x2d47aa[_0x68c5('0x13')]=_0x59547;}break;}logger['info'](util[_0x68c5('0x16')](_0x68c5('0x17'),_0x5f4b65[_0x68c5('0x18')],_0x5f4b65[_0x68c5('0x8')],JSON['stringify'](_0x2d47aa)));rp(_0x2d47aa)[_0x68c5('0x19')](function(_0x26f44d){_0x59547=!_[_0x68c5('0x1a')](_0x59547)?_0x68c5('0x1b')+_0x59547:'';_0x32b00f=typeof _0x26f44d[_0x68c5('0x13')]==='object'?JSON[_0x68c5('0x1c')](_0x26f44d['body']):_0x26f44d[_0x68c5('0x13')];logger[_0x68c5('0x1d')](util[_0x68c5('0x16')](_0x68c5('0x1e'),_0x5f4b65[_0x68c5('0x18')],_0x5f4b65[_0x68c5('0x8')],_0x26f44d[_0x68c5('0x1f')],_0x32b00f));})[_0x68c5('0x20')](function(_0x11e871){logger[_0x68c5('0xe')](util[_0x68c5('0x16')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f4b65['data1'],_0x5f4b65[_0x68c5('0x8')],_0x11e871[_0x68c5('0x1f')],_0x11e871[_0x68c5('0x21')],_0x11e871[_0x68c5('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 91b80d2..9247429 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 _0xa159=['message','result','catch','exports','jayson/promise','../../config/logger','client','then','rpc','error','routing'];(function(_0x48ac7f,_0xb8ec44){var _0x50a9b6=function(_0x46d1fa){while(--_0x46d1fa){_0x48ac7f['push'](_0x48ac7f['shift']());}};_0x50a9b6(++_0xb8ec44);}(_0xa159,0x1b1));var _0x9a15=function(_0x4f7d06,_0x5d4289){_0x4f7d06=_0x4f7d06-0x0;var _0x4374fa=_0xa159[_0x4f7d06];return _0x4374fa;};'use strict';var jayson=require(_0x9a15('0x0'));var BPromise=require('bluebird');var logger=require(_0x9a15('0x1'))('routing');var client=jayson[_0x9a15('0x2')]['http']({'port':0x2329});client['Request']=function(_0x459264,_0x32078a){return new BPromise(function(_0x47a493,_0x49ff83){return client['request'](_0x459264,_0x32078a)[_0x9a15('0x3')](function(_0x5b57b2){logger['debug'](_0x9a15('0x4'),'routing',_0x459264,_0x32078a,_0x5b57b2);if(_0x5b57b2[_0x9a15('0x5')]){logger['error'](_0x9a15('0x4'),_0x9a15('0x6'),_0x459264,_0x5b57b2[_0x9a15('0x5')]['message'],_0x32078a);return _0x49ff83(_0x5b57b2[_0x9a15('0x5')][_0x9a15('0x7')]);}else{return _0x47a493(_0x5b57b2[_0x9a15('0x8')]);}})[_0x9a15('0x9')](function(_0x4d283e){logger[_0x9a15('0x5')]('rpc','routing',_0x459264,_0x4d283e,_0x32078a);return _0x49ff83(_0x4d283e);});});};module[_0x9a15('0xa')]=client; \ No newline at end of file +var _0x5ef3=['error','message','result','catch','exports','routing','client','http','Request','request','then','debug','rpc'];(function(_0x1b4381,_0xd30fc8){var _0x472a11=function(_0x51db40){while(--_0x51db40){_0x1b4381['push'](_0x1b4381['shift']());}};_0x472a11(++_0xd30fc8);}(_0x5ef3,0x1b2));var _0x35ef=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ef3[_0x4a9fb1];return _0x348672;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x35ef('0x0'));var client=jayson[_0x35ef('0x1')][_0x35ef('0x2')]({'port':0x2329});client[_0x35ef('0x3')]=function(_0x3a7414,_0x3d7f0f){return new BPromise(function(_0x42af50,_0x953903){return client[_0x35ef('0x4')](_0x3a7414,_0x3d7f0f)[_0x35ef('0x5')](function(_0x20596b){logger[_0x35ef('0x6')](_0x35ef('0x7'),_0x35ef('0x0'),_0x3a7414,_0x3d7f0f,_0x20596b);if(_0x20596b[_0x35ef('0x8')]){logger[_0x35ef('0x8')](_0x35ef('0x7'),_0x35ef('0x0'),_0x3a7414,_0x20596b[_0x35ef('0x8')][_0x35ef('0x9')],_0x3d7f0f);return _0x953903(_0x20596b[_0x35ef('0x8')][_0x35ef('0x9')]);}else{return _0x42af50(_0x20596b[_0x35ef('0xa')]);}})[_0x35ef('0xb')](function(_0x204043){logger[_0x35ef('0x8')]('rpc','routing',_0x3a7414,_0x204043,_0x3d7f0f);return _0x953903(_0x204043);});});};module[_0x35ef('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7fb732c..958c5c9 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 _0x34e8=['./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','error','Email\x20service\x20initialization','./server'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x34e8,0x6f));var _0x834e=function(_0x1bc780,_0x17e5db){_0x1bc780=_0x1bc780-0x0;var _0x3fd7a6=_0x34e8[_0x1bc780];return _0x3fd7a6;};'use strict';var server=require(_0x834e('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x834e('0x1'));var mailAccount=require(_0x834e('0x2'));var setting=require('./rpc/setting');var logger=require(_0x834e('0x3'))(_0x834e('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x834e('0x5')]()[_0x834e('0x6')](mailAccount[_0x834e('0x7')]())['then'](realtime[_0x834e('0x8')]())[_0x834e('0x6')](function(){email['refresh'](realtime[_0x834e('0x9')]);return realtime;});}function main(){return server[_0x834e('0xa')](realtime,email)[_0x834e('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x834e('0xb')]();})[_0x834e('0x6')](function(_0x5d8852){return setInterval(initRealtime,_0x5d8852['loginMailFrequency']*0x3e8);})['catch'](function(_0xb2ac0b){logger[_0x834e('0xc')](_0x834e('0xd'),_0xb2ac0b);});}main(); \ No newline at end of file +var _0x9160=['./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','mailAccounts','catch','error','./server','./realtime','./lib/email'];(function(_0x45df61,_0xbef6b8){var _0x50b71d=function(_0x4f92b9){while(--_0x4f92b9){_0x45df61['push'](_0x45df61['shift']());}};_0x50b71d(++_0xbef6b8);}(_0x9160,0x1d1));var _0x0916=function(_0x1fed37,_0x1ae835){_0x1fed37=_0x1fed37-0x0;var _0xf88152=_0x9160[_0x1fed37];return _0xf88152;};'use strict';var server=require(_0x0916('0x0'));var Realtime=require(_0x0916('0x1'));var EmailChannel=require(_0x0916('0x2'));var mailAccount=require(_0x0916('0x3'));var setting=require(_0x0916('0x4'));var logger=require(_0x0916('0x5'))(_0x0916('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0916('0x7')]()[_0x0916('0x8')](mailAccount[_0x0916('0x9')]())['then'](realtime['initMailAccounts']())[_0x0916('0x8')](function(){email['refresh'](realtime[_0x0916('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x0916('0x8')](function(){return setting['getSettings']();})[_0x0916('0x8')](function(_0x434974){return setInterval(initRealtime,_0x434974['loginMailFrequency']*0x3e8);})[_0x0916('0xb')](function(_0x3f3178){logger[_0x0916('0xc')]('Email\x20service\x20initialization',_0x3f3178);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 836f55e..862f146 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 _0x5fa3=['sendMail','send','Smtp','verify','then','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','stringify','refresh','hasOwnProperty','service','provider','custom','imapAccounts','handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','isNil','disabled','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync'];(function(_0x18b4e8,_0x30e9e1){var _0x4b6265=function(_0x46bc8b){while(--_0x46bc8b){_0x18b4e8['push'](_0x18b4e8['shift']());}};_0x4b6265(++_0x30e9e1);}(_0x5fa3,0x128));var _0x35fa=function(_0x37728a,_0x1a4ce9){_0x37728a=_0x37728a-0x0;var _0x29e9fc=_0x5fa3[_0x37728a];return _0x29e9fc;};'use strict';var _=require(_0x35fa('0x0'));var moment=require(_0x35fa('0x1'));var BPromise=require(_0x35fa('0x2'));var md5=require(_0x35fa('0x3'));var Redis=require(_0x35fa('0x4'));var config=require(_0x35fa('0x5'));var logger=require(_0x35fa('0x6'))(_0x35fa('0x7'));config['redis']=_[_0x35fa('0x8')](config[_0x35fa('0x9')],{'host':_0x35fa('0xa'),'port':0x18eb});var io=require(_0x35fa('0xb'))(new Redis(config['redis']));var EmailImap=require(_0x35fa('0xc'));var EmailSmtp=require(_0x35fa('0xd'));var mailAccount=require(_0x35fa('0xe'));var md5Accounts={};function EmailChannel(_0x496c54){logger['info'](_0x35fa('0xf'));this[_0x35fa('0x10')]=_0x496c54['mailAccounts'];this['imapAccounts']={};this[_0x35fa('0x11')]=new EmailSmtp();}EmailChannel[_0x35fa('0x12')][_0x35fa('0x13')]=function(_0x44fb00){var _0x5c5099=this[_0x35fa('0x10')][_0x44fb00];var _0x56360c={'id':_0x5c5099['id'],'name':_0x5c5099[_0x35fa('0x14')],'key':_0x5c5099[_0x35fa('0x15')],'active':_0x5c5099['active'],'Imap':{'status':_0x5c5099[_0x35fa('0x16')][_0x35fa('0x17')],'messageStatus':_0x5c5099['Imap'][_0x35fa('0x18')],'total':_0x5c5099[_0x35fa('0x16')][_0x35fa('0x19')]}};if(_['isNil'](md5Accounts[_0x44fb00])){md5Accounts[_0x44fb00]={};}var _0x20d710=md5(JSON[_0x35fa('0x1a')](_0x56360c));if(md5Accounts[_0x44fb00][_0x35fa('0x3')]!==_0x20d710){md5Accounts[_0x44fb00]['md5']=_0x20d710;io[_0x35fa('0x13')]('mailAccount:update',_0x56360c);}};EmailChannel[_0x35fa('0x12')][_0x35fa('0x1b')]=function(_0x1dd55b){for(var _0x402b0f in _0x1dd55b){if(_0x1dd55b[_0x35fa('0x1c')](_0x402b0f)){if(_0x1dd55b[_0x402b0f][_0x35fa('0x16')]&&_0x1dd55b[_0x402b0f]['active']){var _0x3535da=_0x1dd55b[_0x402b0f][_0x35fa('0x16')];if(!_0x3535da[_0x35fa('0x1d')]&&_0x1dd55b[_0x402b0f][_0x35fa('0x1e')]!==_0x35fa('0x1f'))_0x3535da[_0x35fa('0x1d')]=_0x1dd55b[_0x402b0f][_0x35fa('0x1e')];if(!this[_0x35fa('0x20')][_0x35fa('0x1c')](_0x3535da['id'])){this['imapAccounts'][_0x3535da['id']]=new EmailImap(_0x3535da,_0x1dd55b[_0x402b0f]['email']);this[_0x35fa('0x20')][_0x3535da['id']]['on']('box',this[_0x35fa('0x21')]['bind'](this,_0x402b0f));this[_0x35fa('0x20')][_0x3535da['id']]['on'](_0x35fa('0x7'),this[_0x35fa('0x22')][_0x35fa('0x23')](this,_0x402b0f));this[_0x35fa('0x20')][_0x3535da['id']]['on']('end',this[_0x35fa('0x24')][_0x35fa('0x23')](this,_0x402b0f));this[_0x35fa('0x20')][_0x3535da['id']]['on'](_0x35fa('0x25'),this[_0x35fa('0x26')][_0x35fa('0x23')](this,_0x402b0f));}}else{if(_[_0x35fa('0x27')](this[_0x35fa('0x10')][_0x402b0f][_0x35fa('0x16')])){this[_0x35fa('0x10')][_0x402b0f][_0x35fa('0x16')]={};}this['mailAccounts'][_0x402b0f][_0x35fa('0x16')]['status']=_0x35fa('0x28');this['mailAccounts'][_0x402b0f][_0x35fa('0x16')][_0x35fa('0x18')]='';this[_0x35fa('0x13')](_0x402b0f);}}}};EmailChannel[_0x35fa('0x12')][_0x35fa('0x21')]=function(_0x28cce2,_0x4dafcc){if(this[_0x35fa('0x10')][_0x28cce2]){this[_0x35fa('0x10')][_0x28cce2][_0x35fa('0x16')][_0x35fa('0x17')]=_0x35fa('0x29');this['mailAccounts'][_0x28cce2][_0x35fa('0x16')][_0x35fa('0x18')]=_0x4dafcc['name'];if(_0x4dafcc['messages']){this['mailAccounts'][_0x28cce2]['Imap']['total']=_0x4dafcc['messages'][_0x35fa('0x19')];}return this['emit'](_0x28cce2);}};EmailChannel[_0x35fa('0x12')][_0x35fa('0x22')]=function(_0x371056,_0x45fc17){logger['info'](_0x35fa('0x2a'),_0x45fc17[_0x35fa('0x2b')],_0x45fc17[_0x35fa('0x2c')],_0x45fc17[_0x35fa('0x2d')],_0x371056);if(this[_0x35fa('0x10')][_0x371056]){return mailAccount[_0x35fa('0x2e')](_0x371056,_0x45fc17)['then'](function(_0x2c0035){if(_0x2c0035){logger[_0x35fa('0x2f')](_0x35fa('0x30'));}})[_0x35fa('0x31')](function(_0x4c8016){logger[_0x35fa('0x25')](_0x35fa('0x32'),JSON[_0x35fa('0x1a')](_0x4c8016));});}};EmailChannel[_0x35fa('0x12')][_0x35fa('0x24')]=function(_0x21fe4d){if(this['mailAccounts'][_0x21fe4d]&&this['mailAccounts'][_0x21fe4d][_0x35fa('0x16')]){if(this[_0x35fa('0x20')][this[_0x35fa('0x10')][_0x21fe4d][_0x35fa('0x16')]['id']]){delete this[_0x35fa('0x20')][this['mailAccounts'][_0x21fe4d][_0x35fa('0x16')]['id']];}this[_0x35fa('0x10')][_0x21fe4d]['Imap'][_0x35fa('0x33')]=moment();this[_0x35fa('0x13')](_0x21fe4d);}};EmailChannel[_0x35fa('0x12')][_0x35fa('0x26')]=function(_0x75723b,_0x126ef8){if(this['mailAccounts'][_0x75723b]){this[_0x35fa('0x10')][_0x75723b][_0x35fa('0x16')][_0x35fa('0x17')]=_0x35fa('0x25');this[_0x35fa('0x10')][_0x75723b][_0x35fa('0x16')][_0x35fa('0x18')]=_0x126ef8;return this[_0x35fa('0x13')](_0x75723b);}};EmailChannel['prototype'][_0x35fa('0x34')]=function(_0x16b8ca,_0x91bd90){return this[_0x35fa('0x11')][_0x35fa('0x35')](_0x16b8ca,_0x91bd90);};EmailChannel['prototype']['verifySmtp']=function(_0x3ef790){var _0x2b4495=this;if(this[_0x35fa('0x10')][_0x3ef790['id']]){if(_[_0x35fa('0x27')](this[_0x35fa('0x10')][_0x3ef790['id']][_0x35fa('0x36')])){this[_0x35fa('0x10')][_0x3ef790['id']][_0x35fa('0x36')]={};}this[_0x35fa('0x10')][_0x3ef790['id']]['Smtp'][_0x35fa('0x33')]=moment();return new BPromise(function(_0xde7193,_0x21ab23){return _0x2b4495[_0x35fa('0x11')][_0x35fa('0x37')](_0x3ef790)[_0x35fa('0x38')](function(_0x593ce5){_0x2b4495[_0x35fa('0x10')][_0x3ef790['id']][_0x35fa('0x36')][_0x35fa('0x17')]=_0x35fa('0x39');_0x2b4495[_0x35fa('0x10')][_0x3ef790['id']][_0x35fa('0x36')]['messageStatus']='';_0x2b4495[_0x35fa('0x13')](_0x3ef790['id']);_0xde7193(_0x593ce5);})[_0x35fa('0x31')](function(_0x60f2ad){_0x2b4495[_0x35fa('0x10')][_0x3ef790['id']][_0x35fa('0x36')][_0x35fa('0x17')]='error';_0x2b4495['mailAccounts'][_0x3ef790['id']][_0x35fa('0x36')][_0x35fa('0x18')]=_0x60f2ad;_0x2b4495['emit'](_0x3ef790['id']);_0x21ab23(_0x60f2ad);});});}return this[_0x35fa('0x11')][_0x35fa('0x37')](_0x3ef790);};module['exports']=EmailChannel; \ No newline at end of file +var _0x269e=['disabled','messageStatus','connected','messages','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','md5','hasOwnProperty','service','provider','custom','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','handleImapError'];(function(_0x26c0ec,_0x212292){var _0x4312d3=function(_0x3299c7){while(--_0x3299c7){_0x26c0ec['push'](_0x26c0ec['shift']());}};_0x4312d3(++_0x212292);}(_0x269e,0x126));var _0xe269=function(_0x31c18b,_0x491aa6){_0x31c18b=_0x31c18b-0x0;var _0x463555=_0x269e[_0x31c18b];return _0x463555;};'use strict';var _=require(_0xe269('0x0'));var moment=require(_0xe269('0x1'));var BPromise=require(_0xe269('0x2'));var md5=require('md5');var Redis=require(_0xe269('0x3'));var config=require(_0xe269('0x4'));var logger=require(_0xe269('0x5'))(_0xe269('0x6'));config[_0xe269('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xe269('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xe269('0x9'));var md5Accounts={};function EmailChannel(_0x42e482){logger[_0xe269('0xa')]('start\x20email\x20channel');this[_0xe269('0xb')]=_0x42e482[_0xe269('0xb')];this[_0xe269('0xc')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xe269('0xd')][_0xe269('0xe')]=function(_0x1252b5){var _0x20cb94=this[_0xe269('0xb')][_0x1252b5];var _0x460089={'id':_0x20cb94['id'],'name':_0x20cb94[_0xe269('0xf')],'key':_0x20cb94[_0xe269('0x10')],'active':_0x20cb94[_0xe269('0x11')],'Imap':{'status':_0x20cb94[_0xe269('0x12')][_0xe269('0x13')],'messageStatus':_0x20cb94[_0xe269('0x12')]['messageStatus'],'total':_0x20cb94[_0xe269('0x12')][_0xe269('0x14')]}};if(_[_0xe269('0x15')](md5Accounts[_0x1252b5])){md5Accounts[_0x1252b5]={};}var _0x313691=md5(JSON[_0xe269('0x16')](_0x460089));if(md5Accounts[_0x1252b5][_0xe269('0x17')]!==_0x313691){md5Accounts[_0x1252b5]['md5']=_0x313691;io[_0xe269('0xe')]('mailAccount:update',_0x460089);}};EmailChannel['prototype']['refresh']=function(_0x21d7fa){for(var _0x47fca3 in _0x21d7fa){if(_0x21d7fa[_0xe269('0x18')](_0x47fca3)){if(_0x21d7fa[_0x47fca3]['Imap']&&_0x21d7fa[_0x47fca3][_0xe269('0x11')]){var _0x337058=_0x21d7fa[_0x47fca3][_0xe269('0x12')];if(!_0x337058[_0xe269('0x19')]&&_0x21d7fa[_0x47fca3][_0xe269('0x1a')]!==_0xe269('0x1b'))_0x337058[_0xe269('0x19')]=_0x21d7fa[_0x47fca3][_0xe269('0x1a')];if(!this['imapAccounts'][_0xe269('0x18')](_0x337058['id'])){this[_0xe269('0xc')][_0x337058['id']]=new EmailImap(_0x337058,_0x21d7fa[_0x47fca3][_0xe269('0x6')]);this[_0xe269('0xc')][_0x337058['id']]['on'](_0xe269('0x1c'),this[_0xe269('0x1d')]['bind'](this,_0x47fca3));this[_0xe269('0xc')][_0x337058['id']]['on']('email',this[_0xe269('0x1e')]['bind'](this,_0x47fca3));this[_0xe269('0xc')][_0x337058['id']]['on'](_0xe269('0x1f'),this[_0xe269('0x20')][_0xe269('0x21')](this,_0x47fca3));this['imapAccounts'][_0x337058['id']]['on'](_0xe269('0x22'),this[_0xe269('0x23')][_0xe269('0x21')](this,_0x47fca3));}}else{if(_[_0xe269('0x15')](this[_0xe269('0xb')][_0x47fca3][_0xe269('0x12')])){this[_0xe269('0xb')][_0x47fca3][_0xe269('0x12')]={};}this['mailAccounts'][_0x47fca3][_0xe269('0x12')]['status']=_0xe269('0x24');this[_0xe269('0xb')][_0x47fca3][_0xe269('0x12')][_0xe269('0x25')]='';this['emit'](_0x47fca3);}}}};EmailChannel[_0xe269('0xd')][_0xe269('0x1d')]=function(_0x13af75,_0x4ca203){if(this[_0xe269('0xb')][_0x13af75]){this[_0xe269('0xb')][_0x13af75][_0xe269('0x12')][_0xe269('0x13')]=_0xe269('0x26');this[_0xe269('0xb')][_0x13af75]['Imap'][_0xe269('0x25')]=_0x4ca203[_0xe269('0xf')];if(_0x4ca203[_0xe269('0x27')]){this['mailAccounts'][_0x13af75][_0xe269('0x12')]['total']=_0x4ca203['messages']['total'];}return this[_0xe269('0xe')](_0x13af75);}};EmailChannel['prototype'][_0xe269('0x1e')]=function(_0x49ba21,_0x172211){logger[_0xe269('0xa')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x172211['firstName'],_0x172211['lastName'],_0x172211[_0xe269('0x28')],_0x49ba21);if(this[_0xe269('0xb')][_0x49ba21]){return mailAccount[_0xe269('0x29')](_0x49ba21,_0x172211)[_0xe269('0x2a')](function(_0x13f22b){if(_0x13f22b){logger['info'](_0xe269('0x2b'));}})['catch'](function(_0x35c59e){logger[_0xe269('0x22')](_0xe269('0x2c'),JSON['stringify'](_0x35c59e));});}};EmailChannel[_0xe269('0xd')][_0xe269('0x20')]=function(_0x4a8477){if(this[_0xe269('0xb')][_0x4a8477]&&this[_0xe269('0xb')][_0x4a8477]['Imap']){if(this[_0xe269('0xc')][this[_0xe269('0xb')][_0x4a8477]['Imap']['id']]){delete this[_0xe269('0xc')][this[_0xe269('0xb')][_0x4a8477][_0xe269('0x12')]['id']];}this[_0xe269('0xb')][_0x4a8477][_0xe269('0x12')][_0xe269('0x2d')]=moment();this['emit'](_0x4a8477);}};EmailChannel['prototype'][_0xe269('0x23')]=function(_0x4b8a84,_0x5ede2d){if(this[_0xe269('0xb')][_0x4b8a84]){this[_0xe269('0xb')][_0x4b8a84][_0xe269('0x12')][_0xe269('0x13')]=_0xe269('0x22');this[_0xe269('0xb')][_0x4b8a84]['Imap'][_0xe269('0x25')]=_0x5ede2d;return this[_0xe269('0xe')](_0x4b8a84);}};EmailChannel[_0xe269('0xd')][_0xe269('0x2e')]=function(_0xbe2686,_0x32c416){return this[_0xe269('0x2f')][_0xe269('0x30')](_0xbe2686,_0x32c416);};EmailChannel[_0xe269('0xd')][_0xe269('0x31')]=function(_0x341115){var _0x19e319=this;if(this[_0xe269('0xb')][_0x341115['id']]){if(_[_0xe269('0x15')](this[_0xe269('0xb')][_0x341115['id']][_0xe269('0x32')])){this['mailAccounts'][_0x341115['id']]['Smtp']={};}this[_0xe269('0xb')][_0x341115['id']][_0xe269('0x32')][_0xe269('0x2d')]=moment();return new BPromise(function(_0x186eb4,_0x4807da){return _0x19e319['smtp'][_0xe269('0x33')](_0x341115)[_0xe269('0x2a')](function(_0x1d7337){_0x19e319['mailAccounts'][_0x341115['id']]['Smtp'][_0xe269('0x13')]=_0xe269('0x34');_0x19e319[_0xe269('0xb')][_0x341115['id']][_0xe269('0x32')][_0xe269('0x25')]='';_0x19e319[_0xe269('0xe')](_0x341115['id']);_0x186eb4(_0x1d7337);})[_0xe269('0x35')](function(_0x3572a0){_0x19e319[_0xe269('0xb')][_0x341115['id']]['Smtp'][_0xe269('0x13')]=_0xe269('0x22');_0x19e319[_0xe269('0xb')][_0x341115['id']][_0xe269('0x32')][_0xe269('0x25')]=_0x3572a0;_0x19e319[_0xe269('0xe')](_0x341115['id']);_0x4807da(_0x3572a0);});});}return this[_0xe269('0x2f')]['verify'](_0x341115);};module[_0xe269('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2934cca..c682bb6 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 _0x8ace=['handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','once','ready','handleReady','bind','handleEnd','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','password','host','port','tls','required','openBox','mailbox','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','error','handleFetchError','end','handleFetchEnd','handleCloseBox','body'];(function(_0x4ce0f0,_0x41a5dd){var _0xc9ce8b=function(_0x3bb605){while(--_0x3bb605){_0x4ce0f0['push'](_0x4ce0f0['shift']());}};_0xc9ce8b(++_0x41a5dd);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x7655ab,_0x18066f){_0x7655ab=_0x7655ab-0x0;var _0x2b0e88=_0x8ace[_0x7655ab];return _0x2b0e88;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var Imap=require(_0xe8ac('0x2'));var simpleParser=require(_0xe8ac('0x3'))[_0xe8ac('0x4')];var Iconv=require(_0xe8ac('0x5'))[_0xe8ac('0x6')];var EventEmitter=require(_0xe8ac('0x7'))[_0xe8ac('0x8')];var utils=require(_0xe8ac('0x9'));var logger=require(_0xe8ac('0xa'))(_0xe8ac('0xb'));function EmailImap(_0x170e14,_0x2b48ec){this['mailbox']=_0xe8ac('0xc');this[_0xe8ac('0xd')]=this['getAccount'](_0x170e14,_0x2b48ec);this['imap']=new Imap(this[_0xe8ac('0xd')]);this['imap'][_0xe8ac('0xe')](_0xe8ac('0xf'),this[_0xe8ac('0x10')][_0xe8ac('0x11')](this));this[_0xe8ac('0x2')][_0xe8ac('0xe')]('end',this[_0xe8ac('0x12')][_0xe8ac('0x11')](this));this[_0xe8ac('0x2')]['on']('error',this[_0xe8ac('0x13')][_0xe8ac('0x11')](this));this['imap'][_0xe8ac('0x14')]();}util[_0xe8ac('0x15')](EmailImap,EventEmitter);EmailImap[_0xe8ac('0x16')][_0xe8ac('0x17')]=function(_0x268f61,_0x317078){var _0x1be138={'connTimeout':_0x268f61[_0xe8ac('0x18')]?_0x268f61[_0xe8ac('0x18')]*0x3e8:0x2710,'authTimeout':_0x268f61[_0xe8ac('0x19')]?_0x268f61['authTimeout']*0x3e8:0x1388};if(_0x268f61[_0xe8ac('0x1a')]){_0x1be138[_0xe8ac('0x1b')]=_0x268f61['user'];_0x1be138[_0xe8ac('0xb')]=_0x317078||_0x268f61[_0xe8ac('0x1b')]||_0xe8ac('0x1c');if(_0x268f61[_0xe8ac('0x1d')]){_0x1be138[_0xe8ac('0x1e')]=utils[_0xe8ac('0x1f')](_0x268f61['CloudProvider']['data5'],_0x268f61['user']);}else{_0x1be138[_0xe8ac('0x20')]=_0x268f61[_0xe8ac('0x20')];}}else{if(_0x268f61['authentication']){_0x1be138[_0xe8ac('0x1b')]=_0x268f61['user'];_0x1be138[_0xe8ac('0x20')]=_0x268f61[_0xe8ac('0x20')];}}_0x1be138['host']=_0x268f61[_0xe8ac('0x21')];_0x1be138[_0xe8ac('0x22')]=_0x268f61[_0xe8ac('0x22')]||0x3e1;if(_0x268f61[_0xe8ac('0x23')]){_0x1be138['tls']=!![];}else{_0x1be138[_0xe8ac('0x23')]=![];_0x1be138['autotls']=_0xe8ac('0x24');}return _0x1be138;};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x10')]=function(){this[_0xe8ac('0x2')][_0xe8ac('0x25')](this[_0xe8ac('0x26')],![],this[_0xe8ac('0x27')]['bind'](this));};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x27')]=function(_0x183dbf,_0x7c3450){if(_0x183dbf){this[_0xe8ac('0x13')](_0x183dbf,!![]);}else{this[_0xe8ac('0x28')](_0xe8ac('0x29'),_0x7c3450);this[_0xe8ac('0x2a')]();}};EmailImap[_0xe8ac('0x16')]['handleCloseBox']=function(_0x5a1b69){if(_0x5a1b69){this[_0xe8ac('0x13')](_0x5a1b69,!![]);}else{this[_0xe8ac('0x2')]['end']();}};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x2a')]=function(){this['imap']['search']([_0xe8ac('0x2b')],this[_0xe8ac('0x2c')][_0xe8ac('0x11')](this));};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x2c')]=function(_0x41ffe8,_0x1a2ef7){if(_0x41ffe8){this['handleError'](_0x41ffe8,!![]);}else{if(_0x1a2ef7[_0xe8ac('0x2d')]){try{var _0x5459e5=this[_0xe8ac('0x2')]['fetch'](_0x1a2ef7,{'bodies':'','markSeen':!![]});_0x5459e5['on']('message',this['handleFetchMessage']['bind'](this));_0x5459e5[_0xe8ac('0xe')](_0xe8ac('0x2e'),this[_0xe8ac('0x2f')][_0xe8ac('0x11')](this));_0x5459e5[_0xe8ac('0xe')](_0xe8ac('0x30'),this[_0xe8ac('0x31')]['bind'](this));}catch(_0x1cacb0){logger['error'](_0x1cacb0);}}else{this['imap']['closeBox'](!![],this[_0xe8ac('0x32')][_0xe8ac('0x11')](this));}}};EmailImap[_0xe8ac('0x16')]['handleFetchMessage']=function(_0x4a323a){_0x4a323a['on'](_0xe8ac('0x33'),this[_0xe8ac('0x34')][_0xe8ac('0x11')](this));_0x4a323a[_0xe8ac('0xe')]('attributes',this[_0xe8ac('0x35')][_0xe8ac('0x11')](this));_0x4a323a[_0xe8ac('0xe')](_0xe8ac('0x30'),this[_0xe8ac('0x36')][_0xe8ac('0x11')](this));};EmailImap[_0xe8ac('0x16')]['handleMessageBody']=function(_0x2e5f42){simpleParser(_0x2e5f42,{'Iconv':Iconv},this[_0xe8ac('0x37')]['bind'](this));};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x35')]=function(){};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x36')]=function(){};EmailImap['prototype'][_0xe8ac('0x37')]=function(_0x5e63b3,_0x5cfcb6){if(_0x5e63b3){logger[_0xe8ac('0x2e')](_0x5e63b3);}else{var _0x21d397=this;utils[_0xe8ac('0x38')](this[_0xe8ac('0xd')],_0x5cfcb6,function(_0xbcf84a){_0x21d397[_0xe8ac('0x28')](_0xe8ac('0xb'),_0xbcf84a);});}};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x31')]=function(){this['imap']['closeBox'](!![],this[_0xe8ac('0x32')][_0xe8ac('0x11')](this));};EmailImap['prototype']['handleFetchError']=function(_0x5cd321){this[_0xe8ac('0x13')](_0x5cd321);this[_0xe8ac('0x2')][_0xe8ac('0x39')](!![],this[_0xe8ac('0x32')]['bind'](this));};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x12')]=function(){this['emit'](_0xe8ac('0x30'));};EmailImap[_0xe8ac('0x16')][_0xe8ac('0x13')]=function(_0x1fc53c,_0x5ca58e){logger['error']('handleError',this[_0xe8ac('0xd')][_0xe8ac('0xb')],JSON[_0xe8ac('0x3a')](_0x1fc53c));var _0x2670f1='';if(_0x1fc53c){if(_0x1fc53c['textCode']){_0x2670f1=_0x1fc53c['textCode'];}else{for(var _0x31080e in _0x1fc53c){if(_0x1fc53c[_0xe8ac('0x3b')](_0x31080e)){_0x2670f1+=_[_0xe8ac('0x3c')](_0x31080e)+':\x20'+_0x1fc53c[_0x31080e]+'\x0a';}}}}if(_0x5ca58e){this[_0xe8ac('0x2')][_0xe8ac('0x30')]();}else{this[_0xe8ac('0x28')](_0xe8ac('0x2e'),_0x2670f1);this[_0xe8ac('0x28')](_0xe8ac('0x30'));}};module[_0xe8ac('0x3d')]=EmailImap; \ No newline at end of file +var _0x68b3=['emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','anonymous@xcally.com','modernAuthentication','xoauth2','data5','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox'];(function(_0x39e9f4,_0x7da7be){var _0x16b495=function(_0x4e126d){while(--_0x4e126d){_0x39e9f4['push'](_0x39e9f4['shift']());}};_0x16b495(++_0x7da7be);}(_0x68b3,0x1d8));var _0x368b=function(_0x195c85,_0x276bbb){_0x195c85=_0x195c85-0x0;var _0x17ab25=_0x68b3[_0x195c85];return _0x17ab25;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var Imap=require(_0x368b('0x2'));var simpleParser=require(_0x368b('0x3'))[_0x368b('0x4')];var Iconv=require('iconv')[_0x368b('0x5')];var EventEmitter=require(_0x368b('0x6'))[_0x368b('0x7')];var utils=require(_0x368b('0x8'));var logger=require('../../../config/logger')(_0x368b('0x9'));function EmailImap(_0x41b15b,_0x104dad){this[_0x368b('0xa')]=_0x368b('0xb');this[_0x368b('0xc')]=this[_0x368b('0xd')](_0x41b15b,_0x104dad);this[_0x368b('0x2')]=new Imap(this[_0x368b('0xc')]);this[_0x368b('0x2')][_0x368b('0xe')]('ready',this[_0x368b('0xf')][_0x368b('0x10')](this));this[_0x368b('0x2')]['once'](_0x368b('0x11'),this[_0x368b('0x12')][_0x368b('0x10')](this));this['imap']['on'](_0x368b('0x13'),this[_0x368b('0x14')]['bind'](this));this[_0x368b('0x2')][_0x368b('0x15')]();}util[_0x368b('0x16')](EmailImap,EventEmitter);EmailImap[_0x368b('0x17')][_0x368b('0xd')]=function(_0x4fffe5,_0x2b326c){var _0x40faa0={'connTimeout':_0x4fffe5['connTimeout']?_0x4fffe5[_0x368b('0x18')]*0x3e8:0x2710,'authTimeout':_0x4fffe5[_0x368b('0x19')]?_0x4fffe5[_0x368b('0x19')]*0x3e8:0x1388};if(_0x4fffe5['service']){_0x40faa0[_0x368b('0x1a')]=_0x4fffe5[_0x368b('0x1a')];_0x40faa0[_0x368b('0x9')]=_0x2b326c||_0x4fffe5['user']||_0x368b('0x1b');if(_0x4fffe5[_0x368b('0x1c')]){_0x40faa0[_0x368b('0x1d')]=utils['generateXOAuth2Token'](_0x4fffe5['CloudProvider'][_0x368b('0x1e')],_0x4fffe5[_0x368b('0x1a')]);}else{_0x40faa0[_0x368b('0x1f')]=_0x4fffe5[_0x368b('0x1f')];}}else{if(_0x4fffe5[_0x368b('0x20')]){_0x40faa0['user']=_0x4fffe5[_0x368b('0x1a')];_0x40faa0[_0x368b('0x1f')]=_0x4fffe5[_0x368b('0x1f')];}}_0x40faa0[_0x368b('0x21')]=_0x4fffe5[_0x368b('0x21')];_0x40faa0[_0x368b('0x22')]=_0x4fffe5[_0x368b('0x22')]||0x3e1;if(_0x4fffe5[_0x368b('0x23')]){_0x40faa0['tls']=!![];}else{_0x40faa0[_0x368b('0x23')]=![];_0x40faa0[_0x368b('0x24')]=_0x368b('0x25');}return _0x40faa0;};EmailImap[_0x368b('0x17')][_0x368b('0xf')]=function(){this['imap'][_0x368b('0x26')](this[_0x368b('0xa')],![],this[_0x368b('0x27')][_0x368b('0x10')](this));};EmailImap[_0x368b('0x17')][_0x368b('0x27')]=function(_0x430e16,_0x11ea2d){if(_0x430e16){this[_0x368b('0x14')](_0x430e16,!![]);}else{this[_0x368b('0x28')](_0x368b('0x29'),_0x11ea2d);this[_0x368b('0x2a')]();}};EmailImap[_0x368b('0x17')][_0x368b('0x2b')]=function(_0x4636f4){if(_0x4636f4){this[_0x368b('0x14')](_0x4636f4,!![]);}else{this[_0x368b('0x2')][_0x368b('0x11')]();}};EmailImap[_0x368b('0x17')][_0x368b('0x2a')]=function(){this[_0x368b('0x2')][_0x368b('0x2c')]([_0x368b('0x2d')],this[_0x368b('0x2e')]['bind'](this));};EmailImap['prototype'][_0x368b('0x2e')]=function(_0x2f1d52,_0x3d1ceb){if(_0x2f1d52){this[_0x368b('0x14')](_0x2f1d52,!![]);}else{if(_0x3d1ceb['length']){try{var _0x12ae59=this[_0x368b('0x2')][_0x368b('0x2f')](_0x3d1ceb,{'bodies':'','markSeen':!![]});_0x12ae59['on'](_0x368b('0x30'),this[_0x368b('0x31')]['bind'](this));_0x12ae59[_0x368b('0xe')](_0x368b('0x13'),this[_0x368b('0x32')][_0x368b('0x10')](this));_0x12ae59['once']('end',this['handleFetchEnd'][_0x368b('0x10')](this));}catch(_0x2bc363){logger[_0x368b('0x13')](_0x2bc363);}}else{this[_0x368b('0x2')][_0x368b('0x33')](!![],this['handleCloseBox'][_0x368b('0x10')](this));}}};EmailImap[_0x368b('0x17')]['handleFetchMessage']=function(_0x305097){_0x305097['on'](_0x368b('0x34'),this['handleMessageBody'][_0x368b('0x10')](this));_0x305097[_0x368b('0xe')]('attributes',this[_0x368b('0x35')]['bind'](this));_0x305097['once']('end',this[_0x368b('0x36')][_0x368b('0x10')](this));};EmailImap[_0x368b('0x17')][_0x368b('0x37')]=function(_0x3b00fe){simpleParser(_0x3b00fe,{'Iconv':Iconv},this[_0x368b('0x38')][_0x368b('0x10')](this));};EmailImap[_0x368b('0x17')][_0x368b('0x35')]=function(){};EmailImap[_0x368b('0x17')]['handleMessageEnd']=function(){};EmailImap[_0x368b('0x17')][_0x368b('0x38')]=function(_0x484cc6,_0x221210){if(_0x484cc6){logger[_0x368b('0x13')](_0x484cc6);}else{var _0x37bd6f=this;utils[_0x368b('0x39')](this[_0x368b('0xc')],_0x221210,function(_0x5b4cf9){_0x37bd6f[_0x368b('0x28')](_0x368b('0x9'),_0x5b4cf9);});}};EmailImap[_0x368b('0x17')][_0x368b('0x3a')]=function(){this['imap']['closeBox'](!![],this[_0x368b('0x2b')][_0x368b('0x10')](this));};EmailImap[_0x368b('0x17')][_0x368b('0x32')]=function(_0x248487){this[_0x368b('0x14')](_0x248487);this[_0x368b('0x2')][_0x368b('0x33')](!![],this[_0x368b('0x2b')][_0x368b('0x10')](this));};EmailImap['prototype'][_0x368b('0x12')]=function(){this[_0x368b('0x28')]('end');};EmailImap[_0x368b('0x17')][_0x368b('0x14')]=function(_0x3a9b1f,_0x360a27){logger['error'](_0x368b('0x14'),this[_0x368b('0xc')]['email'],JSON[_0x368b('0x3b')](_0x3a9b1f));var _0x1e8891='';if(_0x3a9b1f){if(_0x3a9b1f[_0x368b('0x3c')]){_0x1e8891=_0x3a9b1f['textCode'];}else{for(var _0x46a72f in _0x3a9b1f){if(_0x3a9b1f[_0x368b('0x3d')](_0x46a72f)){_0x1e8891+=_[_0x368b('0x3e')](_0x46a72f)+':\x20'+_0x3a9b1f[_0x46a72f]+'\x0a';}}}}if(_0x360a27){this['imap']['end']();}else{this[_0x368b('0x28')](_0x368b('0x13'),_0x1e8891);this['emit'](_0x368b('0x11'));}};module[_0x368b('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4ecb20c..faa00e2 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 _0x0e4b=['send','createTransport','use','compile','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x486100,_0x13aa6a){var _0x111a67=function(_0x52351a){while(--_0x52351a){_0x486100['push'](_0x486100['shift']());}};_0x111a67(++_0x13aa6a);}(_0x0e4b,0x17e));var _0xb0e4=function(_0x5ec02a,_0x4acb0c){_0x5ec02a=_0x5ec02a-0x0;var _0x156133=_0x0e4b[_0x5ec02a];return _0x156133;};'use strict';var nodemailer=require(_0xb0e4('0x0'));var inlineBase64=require(_0xb0e4('0x1'));function EmailSmtp(){}EmailSmtp[_0xb0e4('0x2')][_0xb0e4('0x3')]=function(_0x27bef5,_0x14388b){return new Promise(function(_0x516f13,_0x480b43){var _0x38fac9=nodemailer[_0xb0e4('0x4')](_0x27bef5);_0x38fac9[_0xb0e4('0x5')](_0xb0e4('0x6'),inlineBase64());_0x38fac9[_0xb0e4('0x7')](_0x14388b,function(_0x52f697,_0x6bd5b5){if(_0x52f697){_0x480b43(_0x52f697[_0xb0e4('0x8')]());}else{_0x516f13(_0x6bd5b5);}});});};EmailSmtp['prototype']['verify']=function(_0x510acf){return new Promise(function(_0x1b8026,_0x3186f2){var _0x42f867=nodemailer['createTransport'](_0x510acf);_0x42f867[_0xb0e4('0x9')](function(_0x5e9d65,_0x544e57){if(_0x5e9d65){_0x3186f2(_0x5e9d65['toString']());}else{if(_0x544e57){_0x1b8026(_0x544e57);}else{_0x3186f2('Not\x20verifired');}}});});};module[_0xb0e4('0xa')]=EmailSmtp; \ No newline at end of file +var _0xb0ad=['use','sendMail','toString','prototype','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','send','createTransport'];(function(_0x1537fb,_0x47bf1d){var _0x28103b=function(_0x384609){while(--_0x384609){_0x1537fb['push'](_0x1537fb['shift']());}};_0x28103b(++_0x47bf1d);}(_0xb0ad,0xf6));var _0xdb0a=function(_0x2aa62b,_0x4d44f4){_0x2aa62b=_0x2aa62b-0x0;var _0xbd2187=_0xb0ad[_0x2aa62b];return _0xbd2187;};'use strict';var nodemailer=require(_0xdb0a('0x0'));var inlineBase64=require(_0xdb0a('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xdb0a('0x2')]=function(_0x688c8a,_0x4e8178){return new Promise(function(_0x22be91,_0x31a8a7){var _0xe3f7b4=nodemailer[_0xdb0a('0x3')](_0x688c8a);_0xe3f7b4[_0xdb0a('0x4')]('compile',inlineBase64());_0xe3f7b4[_0xdb0a('0x5')](_0x4e8178,function(_0x5ca019,_0x40af97){if(_0x5ca019){_0x31a8a7(_0x5ca019[_0xdb0a('0x6')]());}else{_0x22be91(_0x40af97);}});});};EmailSmtp[_0xdb0a('0x7')][_0xdb0a('0x8')]=function(_0x4ebe57){return new Promise(function(_0x1a59ed,_0x131cb9){var _0x43545a=nodemailer['createTransport'](_0x4ebe57);_0x43545a[_0xdb0a('0x8')](function(_0x29eb5a,_0x7c7035){if(_0x29eb5a){_0x131cb9(_0x29eb5a[_0xdb0a('0x6')]());}else{if(_0x7c7035){_0x1a59ed(_0x7c7035);}else{_0x131cb9(_0xdb0a('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index bbe37c9..fb5eeab 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 _0x28ea=['textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','BodyHTML','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','../../../config/logger','../../../config/environment','head','address','anonymous','@xcally.com','name','substring','split','length','slice','join','Anonymous','value','isEmpty','generate','test','html','includes','attachments','forEach','push','filename','replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','0x1?_0x200243[_0xa28e('0xe')](0x0,-0x1)[_0xa28e('0xf')]('\x20'):_0x13f0fe['name'];}return _0xa28e('0x10');}function getLastName(_0x3c73d6){var _0x3962e=_['head'](_0x3c73d6[_0xa28e('0x11')]);if(_0x3962e&&_0x3962e[_0xa28e('0xa')]){var _0x4ecbee=_0x3962e[_0xa28e('0xa')][_0xa28e('0xc')](/\s+/);return _0x4ecbee[_0xa28e('0xd')]>0x1?_0x4ecbee['pop']():'';}return'';}function getMails(_0x3d409b,_0x18c333){var _0x47df3a='';for(var _0x426136=0x0;_0x426136<_0x18c333[_0xa28e('0x11')][_0xa28e('0xd')];_0x426136+=0x1){if(_0x18c333['value'][_0x426136][_0xa28e('0x7')]!==_0x3d409b){if(!_[_0xa28e('0x12')](_0x47df3a)){_0x47df3a+=',';}_0x47df3a+=_0x18c333[_0xa28e('0x11')][_0x426136][_0xa28e('0xa')]||_0x18c333['value'][_0x426136][_0xa28e('0x7')]||'';_0x47df3a+='\x20<';_0x47df3a+=_0x18c333['value'][_0x426136][_0xa28e('0x7')]?_0x18c333[_0xa28e('0x11')][_0x426136]['address']:_0xa28e('0x8')+random[_0xa28e('0x13')](0x6)+_0xa28e('0x9');_0x47df3a+='>';}}return _0x47df3a;}function parseEmail(_0x4c570b,_0x329b6f,_0x24213d){if(_0x329b6f['html']){var _0xaf8209=/)<[^<]*)*<\/script>/gi;while(_0xaf8209[_0xa28e('0x14')](_0x329b6f[_0xa28e('0x15')])){_0x329b6f[_0xa28e('0x15')]=_0x329b6f[_0xa28e('0x15')]['replace'](_0xaf8209,'');}if(_0x329b6f['html'][_0xa28e('0x16')]('{_0x48ecb1[_0xa28e('0x19')](_0x43f794[_0xa28e('0x1a')]);});var _0x10fa5f=/]+>/g;var _0x27b55c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x3050db=_0x329b6f['html'][_0xa28e('0x1b')](_0x27b55c,_0xa28e('0x1c'));var _0x2c948c=_0x3050db[_0xa28e('0x1b')](_0x10fa5f,_0xa28e('0x1d'));for(let _0x372209=0x0;_0x372209<_0x48ecb1[_0xa28e('0xd')];_0x372209++){var _0x1ea305=_0x2c948c[_0xa28e('0x1b')](_0xa28e('0x1d'),_0xa28e('0x1e')+_0x48ecb1[_0x372209]+_0xa28e('0x1f'));_0x2c948c=_0x1ea305;}_0x329b6f[_0xa28e('0x15')]=_0x2c948c;}_0x24213d['body']=_0x329b6f['html'];}else{_0x24213d[_0xa28e('0x20')]=_0x329b6f['textAsHtml'];}if(_0x24213d[_0xa28e('0x20')]){_0x24213d[_0xa28e('0x20')]=_0x24213d['body']['replace'](/0x0){var _0x3ab31a=[_0xa28e('0x33'),'X-Auto-Response-Suppress:\x20All',_0xa28e('0x34')];for(var _0x475d29=0x0;_0x475d29<_0x329b6f[_0xa28e('0x32')]['length'];_0x475d29++){var _0x5b9c78=_['indexOf'](_0x3ab31a,_0x329b6f[_0xa28e('0x32')][_0x475d29][_0xa28e('0x35')]);if(_0x5b9c78>=0x0){_0x24213d[_0xa28e('0x36')]=!![];}}}return _0x24213d;}exports['parser']=function(_0x59edeb,_0x5f2aa3,_0x13050b){var _0x431e62={'from':getAddress(_0x5f2aa3[_0xa28e('0x37')]),'firstName':getFirstName(_0x5f2aa3[_0xa28e('0x37')]),'lastName':getLastName(_0x5f2aa3[_0xa28e('0x37')]),'mapKey':_0xa28e('0x23'),'message':{'from':getMails(_0x59edeb[_0xa28e('0x23')],_0x5f2aa3[_0xa28e('0x37')]),'to':_0x59edeb[_0xa28e('0x23')],'cc':'','subject':_0x5f2aa3[_0xa28e('0x38')]||'','messageId':_0x5f2aa3[_0xa28e('0x39')],'inReplyTo':_0x5f2aa3[_0xa28e('0x3a')],'sentAt':moment(_0x5f2aa3[_0xa28e('0x3b')])[_0xa28e('0x2b')](_0xa28e('0x3c')),'attach':![],'attachments':[]}};if(!_0x5f2aa3[_0xa28e('0x15')]&&!_0x5f2aa3[_0xa28e('0x3d')]){var _0x5c377e=_[_0xa28e('0x3e')](_0x5f2aa3['attachments'],{'contentType':_0xa28e('0x3f')});if(_0x5c377e[_0xa28e('0xd')]){logger['info'](util[_0xa28e('0x2b')](_0xa28e('0x40'),_0x5f2aa3[_0xa28e('0x39')]));tnef[_0xa28e('0x41')](_['first'](_0x5c377e)[_0xa28e('0x30')],function(_0x2f97bc,_0x551cad){if(_0x551cad){_0x5f2aa3[_0xa28e('0x15')]=_0x551cad[_0xa28e('0x42')]||'

Empty\x20message

';if(_0x551cad[_0xa28e('0x43')]){for(var _0xbd03a9=0x0;_0xbd03a9<_0x551cad[_0xa28e('0x43')]['length'];_0xbd03a9++){var _0x27c5b1=_0x551cad[_0xa28e('0x43')][_0xbd03a9];_0x431e62[_0xa28e('0x22')]['attachments'][_0xa28e('0x19')]({'filename':_0x27c5b1[_0xa28e('0x44')],'content':Buffer['from'](_0x27c5b1['Data'])});}}}_0x13050b(parseEmail(_0x59edeb,_0x5f2aa3,_0x431e62));});}else{_0x5f2aa3[_0xa28e('0x15')]='

Empty\x20message

';_0x13050b(parseEmail(_0x59edeb,_0x5f2aa3,_0x431e62));}}else{_0x13050b(parseEmail(_0x59edeb,_0x5f2aa3,_0x431e62));}};exports[_0xa28e('0x45')]=function(_0x179fd7,_0x3abea8){var _0x4b48c9=[_0xa28e('0x46')+(_0x3abea8||''),_0xa28e('0x47')+_0x179fd7,'',''];return Buffer['from'](_0x4b48c9[_0xa28e('0xf')](''),_0xa28e('0x48'))[_0xa28e('0x49')]('base64');}; \ No newline at end of file +var _0x5d21=['YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','moment','util','node-tnef','../../../config/logger','../../../config/environment','value','address','anonymous','name','substring','indexOf','split','length','join','Anonymous','pop','generate','@xcally.com','html','test','replace','forEach','filename','_IMG','\x20[Attachment:\x20','body','0x1?_0xadb462['slice'](0x0,-0x1)[_0x15d2('0xd')]('\x20'):_0x20c75b[_0x15d2('0x8')];}return _0x15d2('0xe');}function getLastName(_0x499dbd){var _0x7bd37d=_['head'](_0x499dbd['value']);if(_0x7bd37d&&_0x7bd37d['name']){var _0x240ccb=_0x7bd37d[_0x15d2('0x8')]['split'](/\s+/);return _0x240ccb[_0x15d2('0xc')]>0x1?_0x240ccb[_0x15d2('0xf')]():'';}return'';}function getMails(_0x1ca011,_0xf2b4b8){var _0xdf4164='';for(var _0x2a02d2=0x0;_0x2a02d2<_0xf2b4b8[_0x15d2('0x5')][_0x15d2('0xc')];_0x2a02d2+=0x1){if(_0xf2b4b8[_0x15d2('0x5')][_0x2a02d2][_0x15d2('0x6')]!==_0x1ca011){if(!_['isEmpty'](_0xdf4164)){_0xdf4164+=',';}_0xdf4164+=_0xf2b4b8[_0x15d2('0x5')][_0x2a02d2][_0x15d2('0x8')]||_0xf2b4b8[_0x15d2('0x5')][_0x2a02d2]['address']||'';_0xdf4164+='\x20<';_0xdf4164+=_0xf2b4b8[_0x15d2('0x5')][_0x2a02d2][_0x15d2('0x6')]?_0xf2b4b8[_0x15d2('0x5')][_0x2a02d2][_0x15d2('0x6')]:'anonymous'+random[_0x15d2('0x10')](0x6)+_0x15d2('0x11');_0xdf4164+='>';}}return _0xdf4164;}function parseEmail(_0x5ed39b,_0x4803f9,_0x413e48){if(_0x4803f9[_0x15d2('0x12')]){var _0x4ee3da=/)<[^<]*)*<\/script>/gi;while(_0x4ee3da[_0x15d2('0x13')](_0x4803f9[_0x15d2('0x12')])){_0x4803f9['html']=_0x4803f9[_0x15d2('0x12')][_0x15d2('0x14')](_0x4ee3da,'');}if(_0x4803f9['html']['includes']('{_0x575da5['push'](_0x5a0631[_0x15d2('0x16')]);});var _0x5665bb=/]+>/g;var _0x57e8b4=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2563a3=_0x4803f9['html'][_0x15d2('0x14')](_0x57e8b4,'_SRC');var _0x2fbb7f=_0x2563a3[_0x15d2('0x14')](_0x5665bb,_0x15d2('0x17'));for(let _0x1425c0=0x0;_0x1425c0<_0x575da5[_0x15d2('0xc')];_0x1425c0++){var _0x3bcd28=_0x2fbb7f[_0x15d2('0x14')](_0x15d2('0x17'),_0x15d2('0x18')+_0x575da5[_0x1425c0]+'\x20]');_0x2fbb7f=_0x3bcd28;}_0x4803f9['html']=_0x2fbb7f;}_0x413e48[_0x15d2('0x19')]=_0x4803f9[_0x15d2('0x12')];}else{_0x413e48[_0x15d2('0x19')]=_0x4803f9['textAsHtml'];}if(_0x413e48[_0x15d2('0x19')]){_0x413e48[_0x15d2('0x19')]=_0x413e48[_0x15d2('0x19')]['replace'](/0x0){var _0x22eb73=['Auto-Submitted:\x20auto-replied',_0x15d2('0x2d'),'Precedence:\x20auto_reply'];for(var _0x3087df=0x0;_0x3087df<_0x4803f9['headerLines'][_0x15d2('0xc')];_0x3087df++){var _0x3e573f=_[_0x15d2('0xa')](_0x22eb73,_0x4803f9['headerLines'][_0x3087df][_0x15d2('0x2e')]);if(_0x3e573f>=0x0){_0x413e48[_0x15d2('0x2f')]=!![];}}}return _0x413e48;}exports['parser']=function(_0x1d6b4b,_0x356431,_0x55ca27){var _0x1c4674={'from':getAddress(_0x356431[_0x15d2('0x30')]),'firstName':getFirstName(_0x356431[_0x15d2('0x30')]),'lastName':getLastName(_0x356431[_0x15d2('0x30')]),'mapKey':_0x15d2('0x1b'),'message':{'from':getMails(_0x1d6b4b[_0x15d2('0x1b')],_0x356431[_0x15d2('0x30')]),'to':_0x1d6b4b[_0x15d2('0x1b')],'cc':'','subject':_0x356431[_0x15d2('0x31')]||'','messageId':_0x356431[_0x15d2('0x32')],'inReplyTo':_0x356431[_0x15d2('0x33')],'sentAt':moment(_0x356431[_0x15d2('0x34')])[_0x15d2('0x35')](_0x15d2('0x36')),'attach':![],'attachments':[]}};if(!_0x356431[_0x15d2('0x12')]&&!_0x356431[_0x15d2('0x37')]){var _0x3682db=_[_0x15d2('0x38')](_0x356431['attachments'],{'contentType':'application/ms-tnef'});if(_0x3682db[_0x15d2('0xc')]){logger[_0x15d2('0x39')](util[_0x15d2('0x35')](_0x15d2('0x3a'),_0x356431[_0x15d2('0x32')]));tnef['parseBuffer'](_[_0x15d2('0x3b')](_0x3682db)['content'],function(_0x28ea8e,_0x2f0d98){if(_0x2f0d98){_0x356431[_0x15d2('0x12')]=_0x2f0d98[_0x15d2('0x3c')]||_0x15d2('0x3d');if(_0x2f0d98['Attachments']){for(var _0x45d37e=0x0;_0x45d37e<_0x2f0d98[_0x15d2('0x3e')][_0x15d2('0xc')];_0x45d37e++){var _0xf3e8a=_0x2f0d98['Attachments'][_0x45d37e];_0x1c4674[_0x15d2('0x1d')][_0x15d2('0x21')]['push']({'filename':_0xf3e8a[_0x15d2('0x3f')],'content':Buffer[_0x15d2('0x30')](_0xf3e8a['Data'])});}}}_0x55ca27(parseEmail(_0x1d6b4b,_0x356431,_0x1c4674));});}else{_0x356431['html']='

Empty\x20message

';_0x55ca27(parseEmail(_0x1d6b4b,_0x356431,_0x1c4674));}}else{_0x55ca27(parseEmail(_0x1d6b4b,_0x356431,_0x1c4674));}};exports[_0x15d2('0x40')]=function(_0x4325e4,_0x2513f1){var _0x350080=['user='+(_0x2513f1||''),_0x15d2('0x41')+_0x4325e4,'',''];return Buffer[_0x15d2('0x30')](_0x350080[_0x15d2('0xd')](''),_0x15d2('0x42'))[_0x15d2('0x43')](_0x15d2('0x44'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 6487efb..fa36b8e 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 _0x1c78=['Service','key','SERV','active','Imap','Smtp','exports','name'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x1c78,0x10f));var _0x81c7=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x1c78[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');function MailAccount(_0x265d7d){this['id']=_0x265d7d['id']||0x0;this[_0x81c7('0x0')]=_0x265d7d[_0x81c7('0x0')]||_0x81c7('0x1');this[_0x81c7('0x2')]=_0x265d7d[_0x81c7('0x2')]||_0x81c7('0x3');this[_0x81c7('0x4')]=_0x265d7d[_0x81c7('0x4')]||![];this['Imap']=_0x265d7d[_0x81c7('0x5')]||[];this[_0x81c7('0x6')]=_0x265d7d['Smtp']||[];}module[_0x81c7('0x7')]=MailAccount; \ No newline at end of file +var _0xbd44=['key','SERV','Imap','exports','lodash','name','Service'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xbd44,0x177));var _0x4bd4=function(_0x536360,_0x119953){_0x536360=_0x536360-0x0;var _0x4bce4d=_0xbd44[_0x536360];return _0x4bce4d;};'use strict';var _=require(_0x4bd4('0x0'));function MailAccount(_0xa84738){this['id']=_0xa84738['id']||0x0;this[_0x4bd4('0x1')]=_0xa84738['name']||_0x4bd4('0x2');this[_0x4bd4('0x3')]=_0xa84738[_0x4bd4('0x3')]||_0x4bd4('0x4');this['active']=_0xa84738['active']||![];this[_0x4bd4('0x5')]=_0xa84738[_0x4bd4('0x5')]||[];this['Smtp']=_0xa84738['Smtp']||[];}module[_0x4bd4('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index ac29b3b..f916cd6 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 _0xbc3c=['mergeFromDatabase','merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty','prototype'];(function(_0x210718,_0x247b55){var _0x541bfc=function(_0x5dbcad){while(--_0x5dbcad){_0x210718['push'](_0x210718['shift']());}};_0x541bfc(++_0x247b55);}(_0xbc3c,0x184));var _0xcbc3=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xbc3c[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var MailAccount=require(_0xcbc3('0x0'));var Realtime=function(){this[_0xcbc3('0x1')]={};};function freeIsNotKey(_0xe0e837,_0x3c45b2,_0x25d8c3){var _0x8b8e58=_['mapKeys'](_0xe0e837,function(_0x23bd44,_0x18f9d4){return _0x23bd44[_0x25d8c3];});for(var _0x552d57 in _0x3c45b2){if(_0x3c45b2[_0xcbc3('0x2')](_0x552d57)){if(!_0x8b8e58[_0x552d57]){delete _0x3c45b2[_0x552d57];}}}}Realtime[_0xcbc3('0x3')][_0xcbc3('0x4')]=function(_0x4effe5,_0x3efb49){for(var _0x329f74 in _0x3efb49){if(_0x4effe5[_0xcbc3('0x2')](_0x329f74)){_0x4effe5[_0x329f74]=_0x3efb49[_0x329f74];}}};Realtime[_0xcbc3('0x3')]['initMailAccounts']=function(){var _0x4e5783=this;return function(_0xd113fa){if(_0xd113fa){freeIsNotKey(_0xd113fa,_0x4e5783[_0xcbc3('0x1')],'id');for(var _0xcd0926=0x0,_0x156f92={},_0x283dc6={};_0xcd0926<_0xd113fa['length'];_0xcd0926+=0x1){_0x156f92=_0xd113fa[_0xcd0926];if(_['isUndefined'](_0x4e5783[_0xcbc3('0x1')][_0x156f92['id']])){_0x4e5783[_0xcbc3('0x1')][_0x156f92['id']]=new MailAccount(_0x156f92);}else{_[_0xcbc3('0x5')](_0x4e5783[_0xcbc3('0x1')][_0x156f92['id']],_0x156f92);}}}return _0x4e5783[_0xcbc3('0x1')];};};module[_0xcbc3('0x6')]=Realtime; \ No newline at end of file +var _0xde92=['isUndefined','exports','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','prototype','initMailAccounts','length'];(function(_0x910ad,_0x48e662){var _0x4006fe=function(_0x10ecc3){while(--_0x10ecc3){_0x910ad['push'](_0x910ad['shift']());}};_0x4006fe(++_0x48e662);}(_0xde92,0xbf));var _0x2de9=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xde92[_0x223c0d];return _0x207827;};'use strict';var _=require('lodash');var MailAccount=require(_0x2de9('0x0'));var Realtime=function(){this[_0x2de9('0x1')]={};};function freeIsNotKey(_0x17d74e,_0x1747fa,_0x36d719){var _0x51208d=_[_0x2de9('0x2')](_0x17d74e,function(_0x34a78a,_0x26147a){return _0x34a78a[_0x36d719];});for(var _0x175633 in _0x1747fa){if(_0x1747fa['hasOwnProperty'](_0x175633)){if(!_0x51208d[_0x175633]){delete _0x1747fa[_0x175633];}}}}Realtime['prototype'][_0x2de9('0x3')]=function(_0xfd1aec,_0x32f0db){for(var _0x26c088 in _0x32f0db){if(_0xfd1aec['hasOwnProperty'](_0x26c088)){_0xfd1aec[_0x26c088]=_0x32f0db[_0x26c088];}}};Realtime[_0x2de9('0x4')][_0x2de9('0x5')]=function(){var _0x4e3c95=this;return function(_0x2633c4){if(_0x2633c4){freeIsNotKey(_0x2633c4,_0x4e3c95[_0x2de9('0x1')],'id');for(var _0x16ccc6=0x0,_0x5e3e2a={},_0x2fd8d5={};_0x16ccc6<_0x2633c4[_0x2de9('0x6')];_0x16ccc6+=0x1){_0x5e3e2a=_0x2633c4[_0x16ccc6];if(_[_0x2de9('0x7')](_0x4e3c95[_0x2de9('0x1')][_0x5e3e2a['id']])){_0x4e3c95[_0x2de9('0x1')][_0x5e3e2a['id']]=new MailAccount(_0x5e3e2a);}else{_['merge'](_0x4e3c95['mailAccounts'][_0x5e3e2a['id']],_0x5e3e2a);}}}return _0x4e3c95[_0x2de9('0x1')];};};module[_0x2de9('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 39afa0d..695caad 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 _0xaf97=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','TemplateId','MailServerIn','Imap','CloudProvider','type'];(function(_0x557176,_0x5851b9){var _0x5ab2df=function(_0x3f7586){while(--_0x3f7586){_0x557176['push'](_0x557176['shift']());}};_0x5ab2df(++_0x5851b9);}(_0xaf97,0x15a));var _0x7af9=function(_0x8a6e26,_0x39cfa){_0x8a6e26=_0x8a6e26-0x0;var _0x27d7fb=_0xaf97[_0x8a6e26];return _0x27d7fb;};'use strict';var client=require(_0x7af9('0x0'));exports[_0x7af9('0x1')]=function(){return function(){return client[_0x7af9('0x2')](_0x7af9('0x3'),{'options':{'attributes':['id',_0x7af9('0x4'),'provider',_0x7af9('0x5'),_0x7af9('0x6'),_0x7af9('0x7'),_0x7af9('0x8'),'ListId',_0x7af9('0x9')],'raw':![],'include':[{'model':_0x7af9('0xa'),'as':_0x7af9('0xb'),'include':[{'model':_0x7af9('0xc'),'attributes':['id','name',_0x7af9('0x5'),_0x7af9('0xd'),_0x7af9('0xe')],'as':_0x7af9('0xc')}]},{'model':_0x7af9('0xf'),'as':_0x7af9('0x10'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x7af9('0x5'),_0x7af9('0xd'),_0x7af9('0xe')],'as':'CloudProvider'}]}]},'log':_0x7af9('0x11')});};};exports[_0x7af9('0x12')]=function(_0x2eef3c,_0x4d99f3){return client[_0x7af9('0x2')](_0x7af9('0x13'),{'account':{'id':_0x2eef3c},'body':_0x4d99f3,'log':_0x7af9('0x13')});}; \ No newline at end of file +var _0x7d10=['CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','name','provider','email','active','ListId','TemplateId','MailServerIn','Imap','service','type','data5'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x7d10,0x1ce));var _0x07d1=function(_0x3cc8ca,_0x24f5f4){_0x3cc8ca=_0x3cc8ca-0x0;var _0x117f64=_0x7d10[_0x3cc8ca];return _0x117f64;};'use strict';var client=require('../client');exports[_0x07d1('0x0')]=function(){return function(){return client[_0x07d1('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0x07d1('0x2'),_0x07d1('0x3'),'service',_0x07d1('0x4'),_0x07d1('0x5'),'key',_0x07d1('0x6'),_0x07d1('0x7')],'raw':![],'include':[{'model':_0x07d1('0x8'),'as':_0x07d1('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x07d1('0x2'),_0x07d1('0xa'),_0x07d1('0xb'),_0x07d1('0xc')],'as':_0x07d1('0xd')}]},{'model':_0x07d1('0xe'),'as':_0x07d1('0xf'),'include':[{'model':_0x07d1('0xd'),'attributes':['id',_0x07d1('0x2'),_0x07d1('0xa'),_0x07d1('0xb'),_0x07d1('0xc')],'as':_0x07d1('0xd')}]}]},'log':_0x07d1('0x10')});};};exports[_0x07d1('0x11')]=function(_0x53f610,_0x5c2860){return client[_0x07d1('0x1')](_0x07d1('0x12'),{'account':{'id':_0x53f610},'body':_0x5c2860,'log':_0x07d1('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 61265ac..ccbdcd4 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 _0xc3e8=['Request','loginMailFrequency','GetSettings','getSettings'];(function(_0x54d236,_0x5a3ea9){var _0x4de79e=function(_0x267244){while(--_0x267244){_0x54d236['push'](_0x54d236['shift']());}};_0x4de79e(++_0x5a3ea9);}(_0xc3e8,0x12f));var _0x8c3e=function(_0x5d48e8,_0x584ea){_0x5d48e8=_0x5d48e8-0x0;var _0x14f530=_0xc3e8[_0x5d48e8];return _0x14f530;};'use strict';var client=require('../client');exports[_0x8c3e('0x0')]=function(){return client[_0x8c3e('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8c3e('0x2')]},'log':_0x8c3e('0x3')});}; \ No newline at end of file +var _0x0940=['Request','ShowSetting','../client'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x0940,0xd7));var _0x0094=function(_0x3b35df,_0x1758b0){_0x3b35df=_0x3b35df-0x0;var _0x363204=_0x0940[_0x3b35df];return _0x363204;};'use strict';var client=require(_0x0094('0x0'));exports['getSettings']=function(){return client[_0x0094('0x1')](_0x0094('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'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 cc7a9fa..b08072f 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 b6966e0..671a239 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 _0xe246=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','../../config/environment','timeout','listen','port','socket.io','websocket','polling','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../routes'];(function(_0x144869,_0x578457){var _0x13b7b0=function(_0x1b435f){while(--_0x1b435f){_0x144869['push'](_0x144869['shift']());}};_0x13b7b0(++_0x578457);}(_0xe246,0x147));var _0x6e24=function(_0x408a3f,_0x8e4bb4){_0x408a3f=_0x408a3f-0x0;var _0x2b5542=_0xe246[_0x408a3f];return _0x2b5542;};'use strict';var _=require(_0x6e24('0x0'));var http=require(_0x6e24('0x1'));var express=require(_0x6e24('0x2'));var sticky=require(_0x6e24('0x3'));var Redis=require('ioredis');var config=require(_0x6e24('0x4'));var app=express();var server=http['createServer'](app);server[_0x6e24('0x5')]=0xdbba0;if(sticky[_0x6e24('0x6')](server,config[_0x6e24('0x7')])){var socketio=require(_0x6e24('0x8'))(server,{'transports':[_0x6e24('0x9'),_0x6e24('0xa')]});config['redis']=_[_0x6e24('0xb')](config[_0x6e24('0xc')],{'host':'localhost','port':0x18eb});socketio[_0x6e24('0xd')](require(_0x6e24('0xe'))({'pubClient':new Redis(config[_0x6e24('0xc')]),'subClient':new Redis(config['redis'])}));require(_0x6e24('0xf'))[_0x6e24('0x10')]();require('../../config/socketio')[_0x6e24('0x10')](socketio);require('../../config/express')[_0x6e24('0x10')](app);require(_0x6e24('0x11'))[_0x6e24('0x10')](app);}else{server[_0x6e24('0x12')](_0x6e24('0x13'),function(){console[_0x6e24('0x14')](_0x6e24('0x15'),config[_0x6e24('0x7')]);});}exports=module[_0x6e24('0x16')]=app; \ No newline at end of file +var _0xf0a0=['default','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','redis','defaults','localhost','socket.io-redis','../../config/triggers'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xf0a0,0x11f));var _0x0f0a=function(_0x1706eb,_0x58a565){_0x1706eb=_0x1706eb-0x0;var _0x1845ad=_0xf0a0[_0x1706eb];return _0x1845ad;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x0f0a('0x0'));var sticky=require(_0x0f0a('0x1'));var Redis=require(_0x0f0a('0x2'));var config=require(_0x0f0a('0x3'));var app=express();var server=http[_0x0f0a('0x4')](app);server[_0x0f0a('0x5')]=0xdbba0;if(sticky[_0x0f0a('0x6')](server,config[_0x0f0a('0x7')])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0x0f0a('0x8')]=_[_0x0f0a('0x9')](config[_0x0f0a('0x8')],{'host':_0x0f0a('0xa'),'port':0x18eb});socketio['adapter'](require(_0x0f0a('0xb'))({'pubClient':new Redis(config[_0x0f0a('0x8')]),'subClient':new Redis(config['redis'])}));require(_0x0f0a('0xc'))['default']();require('../../config/socketio')[_0x0f0a('0xd')](socketio);require(_0x0f0a('0xe'))[_0x0f0a('0xd')](app);require(_0x0f0a('0xf'))[_0x0f0a('0xd')](app);}else{server[_0x0f0a('0x10')](_0x0f0a('0x11'),function(){console['log'](_0x0f0a('0x12'),config[_0x0f0a('0x7')]);});}exports=module[_0x0f0a('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3dc4195..c595e39 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 _0x50e4=['error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','rpc'];(function(_0x4fe35d,_0x21fee1){var _0x5bb28e=function(_0x214051){while(--_0x214051){_0x4fe35d['push'](_0x4fe35d['shift']());}};_0x5bb28e(++_0x21fee1);}(_0x50e4,0x12f));var _0x450e=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x50e4[_0x2261ce];return _0x524640;};'use strict';var jayson=require(_0x450e('0x0'));var BPromise=require(_0x450e('0x1'));var logger=require(_0x450e('0x2'))(_0x450e('0x3'));var client=jayson[_0x450e('0x4')][_0x450e('0x5')]({'port':0x2329});client[_0x450e('0x6')]=function(_0x2d5dd0,_0x183df9){return new BPromise(function(_0x267793,_0x402b1){return client['request'](_0x2d5dd0,_0x183df9)[_0x450e('0x7')](function(_0x316a1d){logger['debug'](_0x450e('0x8'),_0x450e('0x3'),_0x2d5dd0,_0x183df9,_0x316a1d);if(_0x316a1d['error']){logger['error']('rpc',_0x450e('0x3'),_0x2d5dd0,_0x316a1d[_0x450e('0x9')][_0x450e('0xa')],_0x183df9);return _0x402b1(_0x316a1d[_0x450e('0x9')][_0x450e('0xa')]);}else{return _0x267793(_0x316a1d[_0x450e('0xb')]);}})[_0x450e('0xc')](function(_0x2c2813){logger[_0x450e('0x9')](_0x450e('0x8'),_0x450e('0x3'),_0x2d5dd0,_0x2c2813,_0x183df9);return _0x402b1(_0x2c2813);});});};module['exports']=client; \ No newline at end of file +var _0x727b=['client','Request','request','then','debug','rpc','routing','error','message','result','catch','jayson/promise','../../config/logger'];(function(_0x3e61ce,_0x14471){var _0x1ff457=function(_0xd501fa){while(--_0xd501fa){_0x3e61ce['push'](_0x3e61ce['shift']());}};_0x1ff457(++_0x14471);}(_0x727b,0x11c));var _0xb727=function(_0x5e4944,_0x2a6bc0){_0x5e4944=_0x5e4944-0x0;var _0x47045e=_0x727b[_0x5e4944];return _0x47045e;};'use strict';var jayson=require(_0xb727('0x0'));var BPromise=require('bluebird');var logger=require(_0xb727('0x1'))('routing');var client=jayson[_0xb727('0x2')]['http']({'port':0x2329});client[_0xb727('0x3')]=function(_0x3f2534,_0x5a1d77){return new BPromise(function(_0x3257c3,_0x46003a){return client[_0xb727('0x4')](_0x3f2534,_0x5a1d77)[_0xb727('0x5')](function(_0x144e0){logger[_0xb727('0x6')](_0xb727('0x7'),_0xb727('0x8'),_0x3f2534,_0x5a1d77,_0x144e0);if(_0x144e0[_0xb727('0x9')]){logger[_0xb727('0x9')](_0xb727('0x7'),_0xb727('0x8'),_0x3f2534,_0x144e0[_0xb727('0x9')][_0xb727('0xa')],_0x5a1d77);return _0x46003a(_0x144e0[_0xb727('0x9')][_0xb727('0xa')]);}else{return _0x3257c3(_0x144e0[_0xb727('0xb')]);}})[_0xb727('0xc')](function(_0x30bba6){logger[_0xb727('0x9')](_0xb727('0x7'),_0xb727('0x8'),_0x3f2534,_0x30bba6,_0x5a1d77);return _0x46003a(_0x30bba6);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 13278e8..66fb0de 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 _0x1ad8=['then','getAgents','initAgents','getIntervals','initIntervals','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0x1ad8,0x1ab));var _0x81ad=function(_0x5bec9f,_0x475daa){_0x5bec9f=_0x5bec9f-0x0;var _0x453a35=_0x1ad8[_0x5bec9f];return _0x453a35;};'use strict';var BPromise=require(_0x81ad('0x0'));var server=require(_0x81ad('0x1'));var Realtime=require(_0x81ad('0x2'));var user=require(_0x81ad('0x3'));var interval=require(_0x81ad('0x4'));var openchannelQueue=require(_0x81ad('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x81ad('0x6'));var mailQueue=require(_0x81ad('0x7'));var faxQueue=require(_0x81ad('0x8'));var whatsappQueue=require(_0x81ad('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x81ad('0xa')](user[_0x81ad('0xb')]())[_0x81ad('0xa')](realtime[_0x81ad('0xc')]())[_0x81ad('0xa')](interval[_0x81ad('0xd')]())['then'](realtime[_0x81ad('0xe')]())[_0x81ad('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x81ad('0xa')](realtime['initOpenchannelQueues']())[_0x81ad('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0x81ad('0xf')]())[_0x81ad('0xa')](smsQueue[_0x81ad('0x10')]())[_0x81ad('0xa')](realtime[_0x81ad('0x11')]())['then'](mailQueue['getMailQueues']())[_0x81ad('0xa')](realtime[_0x81ad('0x12')]())[_0x81ad('0xa')](faxQueue['getFaxQueues']())['then'](realtime[_0x81ad('0x13')]())[_0x81ad('0xa')](whatsappQueue[_0x81ad('0x14')]())[_0x81ad('0xa')](realtime[_0x81ad('0x15')]())[_0x81ad('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x81ad('0xa')](function(_0x37ec26){return initRealtime();})[_0x81ad('0xa')](function(_0x14cbf9){return setInterval(initRealtime,0x1388);})[_0x81ad('0x16')](function(_0x5a7e57){console['log'](_0x5a7e57);});}main(); \ No newline at end of file +var _0xdc08=['initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues'];(function(_0x5869c1,_0x2b543a){var _0xaa2c9a=function(_0x524d1c){while(--_0x524d1c){_0x5869c1['push'](_0x5869c1['shift']());}};_0xaa2c9a(++_0x2b543a);}(_0xdc08,0xac));var _0x8dc0=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xdc08[_0x46aff0];return _0x9d78cf;};'use strict';var BPromise=require(_0x8dc0('0x0'));var server=require(_0x8dc0('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x8dc0('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x8dc0('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8dc0('0x4'));var whatsappQueue=require(_0x8dc0('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8dc0('0x6')]()[_0x8dc0('0x7')](user['getAgents']())[_0x8dc0('0x7')](realtime[_0x8dc0('0x8')]())[_0x8dc0('0x7')](interval[_0x8dc0('0x9')]())[_0x8dc0('0x7')](realtime[_0x8dc0('0xa')]())['then'](openchannelQueue[_0x8dc0('0xb')]())[_0x8dc0('0x7')](realtime[_0x8dc0('0xc')]())[_0x8dc0('0x7')](chatQueue[_0x8dc0('0xd')]())[_0x8dc0('0x7')](realtime[_0x8dc0('0xe')]())[_0x8dc0('0x7')](smsQueue[_0x8dc0('0xf')]())['then'](realtime[_0x8dc0('0x10')]())[_0x8dc0('0x7')](mailQueue['getMailQueues']())[_0x8dc0('0x7')](realtime['initMailQueues']())['then'](faxQueue[_0x8dc0('0x11')]())[_0x8dc0('0x7')](realtime['initFaxQueues']())[_0x8dc0('0x7')](whatsappQueue[_0x8dc0('0x12')]())[_0x8dc0('0x7')](realtime[_0x8dc0('0x13')]())['then'](function(){return realtime;});}function main(){return server[_0x8dc0('0x14')](realtime)[_0x8dc0('0x7')](function(_0x4abacf){return initRealtime();})[_0x8dc0('0x7')](function(_0x39bc73){return setInterval(initRealtime,0x1388);})[_0x8dc0('0x15')](function(_0x3ac010){console[_0x8dc0('0x16')](_0x3ac010);});}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 39e9b3a..0f3c6ec 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x1261[_0xdb357c];return _0x5c8735;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0x1261[_0x1265ed];return _0x5ac459;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index b3faf73..08b5af3 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 _0x4c18=['message','result','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','error'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x4c18,0x9d));var _0x84c1=function(_0x31ee19,_0x435617){_0x31ee19=_0x31ee19-0x0;var _0x297cff=_0x4c18[_0x31ee19];return _0x297cff;};'use strict';var BPromise=require(_0x84c1('0x0'));var jayson=require(_0x84c1('0x1'));var client=jayson[_0x84c1('0x2')]['http']({'port':0x232b});function request(_0x3ac7b6,_0x38ba69){return new BPromise(function(_0x840727,_0x32791e){return client[_0x84c1('0x3')](_0x3ac7b6,_0x38ba69)['then'](function(_0x4962dd){if(_0x4962dd[_0x84c1('0x4')]){return _0x32791e(_0x4962dd[_0x84c1('0x4')][_0x84c1('0x5')]);}else{return _0x840727(_0x4962dd[_0x84c1('0x6')]);}})['catch'](function(_0x2aea75){return _0x32791e(_0x2aea75);});});}exports[_0x84c1('0x7')]=function(_0x33d376,_0x1f31b7){return request(_0x84c1('0x8'),{'account':_0x33d376,'message':_0x1f31b7});}; \ No newline at end of file +var _0xb06e=['error','message','sendMailMessage','SendMail','bluebird','request'];(function(_0x5b9bba,_0x457c4c){var _0x10a9da=function(_0x224005){while(--_0x224005){_0x5b9bba['push'](_0x5b9bba['shift']());}};_0x10a9da(++_0x457c4c);}(_0xb06e,0x12a));var _0xeb06=function(_0x5b36ac,_0x4767aa){_0x5b36ac=_0x5b36ac-0x0;var _0x512bc2=_0xb06e[_0x5b36ac];return _0x512bc2;};'use strict';var BPromise=require(_0xeb06('0x0'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function request(_0x4b6d0c,_0x5d2bca){return new BPromise(function(_0x371bf8,_0x3152c9){return client[_0xeb06('0x1')](_0x4b6d0c,_0x5d2bca)['then'](function(_0x432aae){if(_0x432aae['error']){return _0x3152c9(_0x432aae[_0xeb06('0x2')][_0xeb06('0x3')]);}else{return _0x371bf8(_0x432aae['result']);}})['catch'](function(_0x33fda8){return _0x3152c9(_0x33fda8);});});}exports[_0xeb06('0x4')]=function(_0x338bd6,_0x347a69){return request(_0xeb06('0x5'),{'account':_0x338bd6,'message':_0x347a69});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1f53124..e0f36bb 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 _0xdc9c=['chatStatus','chatStatusTime','chatCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','chat','openchannel','fax','whatsapp','length','StatusTime','toNumber','format','Status','voicePause','chatPause','whatsappStatus','stringify','emit','user:save','exports','ioredis','redis','defaults','localhost','name','online','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xdc9c,0xe2));var _0xcdc9=function(_0xb022cf,_0x405171){_0xb022cf=_0xb022cf-0x0;var _0x2a2d45=_0xdc9c[_0xb022cf];return _0x2a2d45;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require(_0xcdc9('0x0'));var config=require('../../../config/environment');config[_0xcdc9('0x1')]=_[_0xcdc9('0x2')](config[_0xcdc9('0x1')],{'host':_0xcdc9('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcdc9('0x1')]));function Agent(_0x50fef6){this['id']=_0x50fef6['id']||0x0;this[_0xcdc9('0x4')]=_0x50fef6[_0xcdc9('0x4')]||'';this[_0xcdc9('0x5')]=_0x50fef6[_0xcdc9('0x5')]||!![];this['voicePause']=_0x50fef6['voicePause']||![];this['chatPause']=_0x50fef6['chatPause']||![];this[_0xcdc9('0x6')]=_0x50fef6[_0xcdc9('0x6')]||![];this[_0xcdc9('0x7')]=_0x50fef6[_0xcdc9('0x7')]||![];this[_0xcdc9('0x8')]=_0x50fef6[_0xcdc9('0x8')]||![];this[_0xcdc9('0x9')]=_0x50fef6[_0xcdc9('0x9')]||![];this[_0xcdc9('0xa')]='unknown';this[_0xcdc9('0xb')]=0x0;this[_0xcdc9('0xc')]=_0x50fef6[_0xcdc9('0xc')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xcdc9('0xd')]=_0xcdc9('0xe');this[_0xcdc9('0xf')]=0x0;this[_0xcdc9('0x10')]=_0x50fef6[_0xcdc9('0x10')]||0x0;this[_0xcdc9('0x11')]=0x0;this[_0xcdc9('0x12')]=_0xcdc9('0xe');this[_0xcdc9('0x13')]=0x0;this[_0xcdc9('0x14')]=_0x50fef6[_0xcdc9('0x14')]||0x0;this[_0xcdc9('0x15')]=0x0;this[_0xcdc9('0x16')]=_0xcdc9('0xe');this[_0xcdc9('0x17')]=0x0;this['smsCapacity']=_0x50fef6[_0xcdc9('0x18')]||0x0;this[_0xcdc9('0x19')]=0x0;this['whatsappStatus']=_0xcdc9('0xe');this[_0xcdc9('0x1a')]=0x0;this[_0xcdc9('0x1b')]=_0x50fef6['whatsappCapacity']||0x0;this[_0xcdc9('0x1c')]=0x0;this[_0xcdc9('0x1d')]=_0xcdc9('0xe');this[_0xcdc9('0x1e')]=0x0;this[_0xcdc9('0x1f')]=_0x50fef6[_0xcdc9('0x1f')]||0x0;this[_0xcdc9('0x20')]=0x0;this[_0xcdc9('0x21')]=![];this[_0xcdc9('0x22')]=undefined;this[_0xcdc9('0x23')]='';this[_0xcdc9('0x24')]();}Agent[_0xcdc9('0x25')][_0xcdc9('0x26')]=function(_0x1c9143){if(this[_0x1c9143+_0xcdc9('0x27')]>0x0){if(this[_0x1c9143+_0xcdc9('0x28')]>0x0&&this[_0x1c9143+'CurrentCapacity']>=this[_0x1c9143+_0xcdc9('0x28')]){return'maxcapacity';}else{return _0xcdc9('0x29');}}else{return _0xcdc9('0x2a');}};Agent[_0xcdc9('0x25')][_0xcdc9('0x24')]=function(){var _0x2ea5d9=['mail',_0xcdc9('0x2b'),_0xcdc9('0x2c'),_0xcdc9('0x2d'),'sms',_0xcdc9('0x2e')];for(var _0x289140=0x0;_0x289140<_0x2ea5d9[_0xcdc9('0x2f')];_0x289140+=0x1){var _0xad920=this[_0xcdc9('0x26')](_0x2ea5d9[_0x289140]);if(this[_0x2ea5d9[_0x289140]+'Status']!==_0xad920){this[_0x2ea5d9[_0x289140]+_0xcdc9('0x30')]=_[_0xcdc9('0x31')](moment()[_0xcdc9('0x32')]('x'));}this[_0x2ea5d9[_0x289140]+_0xcdc9('0x33')]=_0xad920;}var _0x33bf5b={'id':this['id'],'name':this[_0xcdc9('0x4')],'online':this[_0xcdc9('0x5')],'voicePause':this[_0xcdc9('0x34')],'chatPause':this[_0xcdc9('0x35')],'mailPause':this[_0xcdc9('0x6')],'smsPause':this[_0xcdc9('0x8')],'faxPause':this['faxPause'],'openchannelPause':this[_0xcdc9('0x9')],'chatStatus':this[_0xcdc9('0xa')],'chatStatusTime':this[_0xcdc9('0xb')],'chatCapacity':this[_0xcdc9('0xc')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xcdc9('0xd')],'mailStatusTime':this[_0xcdc9('0xf')],'mailCapacity':this[_0xcdc9('0x10')],'mailCurrentCapacity':this[_0xcdc9('0x11')],'faxStatus':this[_0xcdc9('0x12')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xcdc9('0x14')],'faxCurrentCapacity':this[_0xcdc9('0x15')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xcdc9('0x18')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xcdc9('0x36')],'whatsappStatusTime':this[_0xcdc9('0x1a')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xcdc9('0x1c')],'openchannelStatus':this[_0xcdc9('0x1d')],'openchannelStatusTime':this[_0xcdc9('0x1e')],'openchannelCapacity':this[_0xcdc9('0x1f')],'openchannelCurrentCapacity':this[_0xcdc9('0x20')],'busy':this[_0xcdc9('0x21')],'busyQueue':this[_0xcdc9('0x22')]};var _0x3afb6e=md5(JSON[_0xcdc9('0x37')](_0x33bf5b));if(this[_0xcdc9('0x23')]!==_0x3afb6e){this['md5']=_0x3afb6e;io[_0xcdc9('0x38')](_0xcdc9('0x39'),_0x33bf5b);}};module[_0xcdc9('0x3a')]=Agent; \ No newline at end of file +var _0xcbf4=['length','getChannelStatus','Status','StatusTime','toNumber','format','chatStatus','chatStatusTime','busy','stringify','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','mail','fax','sms','whatsapp'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0xcbf4,0x7c));var _0x4cbf=function(_0x15f687,_0xe5bb51){_0x15f687=_0x15f687-0x0;var _0x5aca9f=_0xcbf4[_0x15f687];return _0x5aca9f;};'use strict';var _=require(_0x4cbf('0x0'));var moment=require('moment');var md5=require(_0x4cbf('0x1'));var Redis=require(_0x4cbf('0x2'));var config=require(_0x4cbf('0x3'));config[_0x4cbf('0x4')]=_[_0x4cbf('0x5')](config[_0x4cbf('0x4')],{'host':_0x4cbf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4cbf('0x4')]));function Agent(_0x133a86){this['id']=_0x133a86['id']||0x0;this[_0x4cbf('0x7')]=_0x133a86[_0x4cbf('0x7')]||'';this[_0x4cbf('0x8')]=_0x133a86[_0x4cbf('0x8')]||!![];this[_0x4cbf('0x9')]=_0x133a86[_0x4cbf('0x9')]||![];this['chatPause']=_0x133a86[_0x4cbf('0xa')]||![];this[_0x4cbf('0xb')]=_0x133a86['mailPause']||![];this[_0x4cbf('0xc')]=_0x133a86['faxPause']||![];this[_0x4cbf('0xd')]=_0x133a86[_0x4cbf('0xd')]||![];this[_0x4cbf('0xe')]=_0x133a86['openchannelPause']||![];this['chatStatus']='unknown';this['chatStatusTime']=0x0;this[_0x4cbf('0xf')]=_0x133a86[_0x4cbf('0xf')]||0x0;this[_0x4cbf('0x10')]=0x0;this[_0x4cbf('0x11')]=_0x4cbf('0x12');this[_0x4cbf('0x13')]=0x0;this['mailCapacity']=_0x133a86[_0x4cbf('0x14')]||0x0;this[_0x4cbf('0x15')]=0x0;this['faxStatus']=_0x4cbf('0x12');this[_0x4cbf('0x16')]=0x0;this[_0x4cbf('0x17')]=_0x133a86[_0x4cbf('0x17')]||0x0;this[_0x4cbf('0x18')]=0x0;this[_0x4cbf('0x19')]=_0x4cbf('0x12');this[_0x4cbf('0x1a')]=0x0;this[_0x4cbf('0x1b')]=_0x133a86[_0x4cbf('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x4cbf('0x1c')]=_0x4cbf('0x12');this[_0x4cbf('0x1d')]=0x0;this[_0x4cbf('0x1e')]=_0x133a86[_0x4cbf('0x1e')]||0x0;this[_0x4cbf('0x1f')]=0x0;this[_0x4cbf('0x20')]=_0x4cbf('0x12');this[_0x4cbf('0x21')]=0x0;this[_0x4cbf('0x22')]=_0x133a86['openchannelCapacity']||0x0;this[_0x4cbf('0x23')]=0x0;this['busy']=![];this[_0x4cbf('0x24')]=undefined;this[_0x4cbf('0x1')]='';this[_0x4cbf('0x25')]();}Agent[_0x4cbf('0x26')]['getChannelStatus']=function(_0x2fc0f2){if(this[_0x2fc0f2+_0x4cbf('0x27')]>0x0){if(this[_0x2fc0f2+_0x4cbf('0x28')]>0x0&&this[_0x2fc0f2+_0x4cbf('0x27')]>=this[_0x2fc0f2+'Capacity']){return _0x4cbf('0x29');}else{return _0x4cbf('0x2a');}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x27a0e4=[_0x4cbf('0x2b'),'chat','openchannel',_0x4cbf('0x2c'),_0x4cbf('0x2d'),_0x4cbf('0x2e')];for(var _0x1f41b2=0x0;_0x1f41b2<_0x27a0e4[_0x4cbf('0x2f')];_0x1f41b2+=0x1){var _0x177457=this[_0x4cbf('0x30')](_0x27a0e4[_0x1f41b2]);if(this[_0x27a0e4[_0x1f41b2]+_0x4cbf('0x31')]!==_0x177457){this[_0x27a0e4[_0x1f41b2]+_0x4cbf('0x32')]=_[_0x4cbf('0x33')](moment()[_0x4cbf('0x34')]('x'));}this[_0x27a0e4[_0x1f41b2]+_0x4cbf('0x31')]=_0x177457;}var _0x4c1576={'id':this['id'],'name':this['name'],'online':this[_0x4cbf('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x4cbf('0xa')],'mailPause':this[_0x4cbf('0xb')],'smsPause':this[_0x4cbf('0xd')],'faxPause':this[_0x4cbf('0xc')],'openchannelPause':this[_0x4cbf('0xe')],'chatStatus':this[_0x4cbf('0x35')],'chatStatusTime':this[_0x4cbf('0x36')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x4cbf('0x10')],'mailStatus':this[_0x4cbf('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x4cbf('0x14')],'mailCurrentCapacity':this[_0x4cbf('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x4cbf('0x17')],'faxCurrentCapacity':this[_0x4cbf('0x18')],'smsStatus':this[_0x4cbf('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x4cbf('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x4cbf('0x1c')],'whatsappStatusTime':this[_0x4cbf('0x1d')],'whatsappCapacity':this[_0x4cbf('0x1e')],'whatsappCurrentCapacity':this[_0x4cbf('0x1f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x4cbf('0x21')],'openchannelCapacity':this[_0x4cbf('0x22')],'openchannelCurrentCapacity':this[_0x4cbf('0x23')],'busy':this[_0x4cbf('0x37')],'busyQueue':this[_0x4cbf('0x24')]};var _0x51b488=md5(JSON[_0x4cbf('0x38')](_0x4c1576));if(this[_0x4cbf('0x1')]!==_0x51b488){this[_0x4cbf('0x1')]=_0x51b488;io['emit']('user:save',_0x4c1576);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 369cb91..de0b6e5 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 _0xc750=['loggedIn','paused','length','chatPause','available','stringify','format','emit','chat_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map'];(function(_0x16eab9,_0x3ce9b9){var _0x49240c=function(_0x1d9ded){while(--_0x1d9ded){_0x16eab9['push'](_0x16eab9['shift']());}};_0x49240c(++_0x3ce9b9);}(_0xc750,0xe1));var _0x0c75=function(_0x44d911,_0x41a9ca){_0x44d911=_0x44d911-0x0;var _0x3fef45=_0xc750[_0x44d911];return _0x3fef45;};'use strict';var _=require(_0x0c75('0x0'));var md5=require(_0x0c75('0x1'));var util=require(_0x0c75('0x2'));var Redis=require('ioredis');var config=require(_0x0c75('0x3'));config[_0x0c75('0x4')]=_[_0x0c75('0x5')](config[_0x0c75('0x4')],{'host':_0x0c75('0x6'),'port':0x18eb});var io=require(_0x0c75('0x7'))(new Redis(config[_0x0c75('0x4')]));function ChatQueue(_0x2e12e5){this['id']=_0x2e12e5['id']||0x0;this[_0x0c75('0x8')]=_0x2e12e5[_0x0c75('0x8')]||'';this[_0x0c75('0x9')]=_0x2e12e5[_0x0c75('0x9')]||0xa;this[_0x0c75('0xa')]=_0x2e12e5[_0x0c75('0xa')]||_0x0c75('0xb');this['Agents']=_0x2e12e5[_0x0c75('0xc')];this[_0x0c75('0xd')]={};this['waiting']=0x0;this[_0x0c75('0x1')]='';this[_0x0c75('0xe')]();this[_0x0c75('0xf')]();}ChatQueue['prototype'][_0x0c75('0xe')]=function(){var _0x13253b=this['mapAgentsId'][_0x0c75('0x10')];this[_0x0c75('0xd')]=_[_0x0c75('0x11')](this[_0x0c75('0xc')],'id');this['mapAgentsId'][_0x0c75('0x10')]=_0x13253b;};ChatQueue['prototype'][_0x0c75('0xf')]=function(){this[_0x0c75('0x12')]=0x0;this[_0x0c75('0x13')]=0x0;for(var _0xfdba2f=0x0;_0xfdba2f=0x0?this[_0x0c75('0x16')]:0x0;var _0x24aa2a={'id':this['id'],'available':this[_0x0c75('0x16')],'loggedIn':this[_0x0c75('0x12')],'name':this['name'],'paused':this[_0x0c75('0x13')],'waiting':this['waiting']};var _0x4cdf39=md5(JSON[_0x0c75('0x17')](_0x24aa2a));if(this[_0x0c75('0x1')]!==_0x4cdf39){this['md5']=_0x4cdf39;io['to'](util[_0x0c75('0x18')]('chat:queue:%s',_0x24aa2a[_0x0c75('0x8')]))[_0x0c75('0x19')](_0x0c75('0x1a'),_0x24aa2a);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa40c=['mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype'];(function(_0x588e5b,_0x5899b6){var _0x158ce0=function(_0x377248){while(--_0x377248){_0x588e5b['push'](_0x588e5b['shift']());}};_0x158ce0(++_0x5899b6);}(_0xa40c,0xf5));var _0xca40=function(_0x11d0f3,_0x2c52c7){_0x11d0f3=_0x11d0f3-0x0;var _0x1a0f83=_0xa40c[_0x11d0f3];return _0x1a0f83;};'use strict';var _=require(_0xca40('0x0'));var md5=require(_0xca40('0x1'));var util=require(_0xca40('0x2'));var Redis=require(_0xca40('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xca40('0x4')],{'host':_0xca40('0x5'),'port':0x18eb});var io=require(_0xca40('0x6'))(new Redis(config[_0xca40('0x4')]));function ChatQueue(_0x4516f5){this['id']=_0x4516f5['id']||0x0;this['name']=_0x4516f5[_0xca40('0x7')]||'';this['timeout']=_0x4516f5[_0xca40('0x8')]||0xa;this[_0xca40('0x9')]=_0x4516f5[_0xca40('0x9')]||_0xca40('0xa');this[_0xca40('0xb')]=_0x4516f5['Agents'];this['mapAgentsId']={};this[_0xca40('0xc')]=0x0;this[_0xca40('0x1')]='';this[_0xca40('0xd')]();this[_0xca40('0xe')]();}ChatQueue[_0xca40('0xf')][_0xca40('0xd')]=function(){var _0x3af357=this[_0xca40('0x10')][_0xca40('0x11')];this[_0xca40('0x10')]=_[_0xca40('0x12')](this['Agents'],'id');this[_0xca40('0x10')][_0xca40('0x11')]=_0x3af357;};ChatQueue['prototype'][_0xca40('0xe')]=function(){this[_0xca40('0x13')]=0x0;this[_0xca40('0x14')]=0x0;for(var _0x5b3e75=0x0;_0x5b3e75=0x0?this[_0xca40('0x18')]:0x0;var _0x53fc69={'id':this['id'],'available':this[_0xca40('0x18')],'loggedIn':this[_0xca40('0x13')],'name':this[_0xca40('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x2a1cdb=md5(JSON[_0xca40('0x19')](_0x53fc69));if(this['md5']!==_0x2a1cdb){this[_0xca40('0x1')]=_0x2a1cdb;io['to'](util[_0xca40('0x1a')](_0xca40('0x1b'),_0x53fc69[_0xca40('0x7')]))[_0xca40('0x1c')]('chat_queue:save',_0x53fc69);}};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 9999921..b43df49 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 _0x9f96=['map','_rr','prototype','loggedIn','length','online','faxPause','paused','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0x9f96,0xc4));var _0x69f9=function(_0x2d1752,_0x5f1eb2){_0x2d1752=_0x2d1752-0x0;var _0x4485f0=_0x9f96[_0x2d1752];return _0x4485f0;};'use strict';var _=require(_0x69f9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x69f9('0x1'));var config=require(_0x69f9('0x2'));config[_0x69f9('0x3')]=_[_0x69f9('0x4')](config[_0x69f9('0x3')],{'host':_0x69f9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x143d06){this['id']=_0x143d06['id']||0x0;this[_0x69f9('0x6')]=_0x143d06[_0x69f9('0x6')]||'';this['timeout']=_0x143d06['timeout']||0xa;this[_0x69f9('0x7')]=_0x143d06[_0x69f9('0x7')]||_0x69f9('0x8');this[_0x69f9('0x9')]=_0x143d06[_0x69f9('0x9')];this[_0x69f9('0xa')]={};this['waiting']=0x0;this[_0x69f9('0xb')]='';this[_0x69f9('0xc')]();this[_0x69f9('0xd')]();}FaxQueue['prototype'][_0x69f9('0xc')]=function(){var _0x31ce11=this['mapAgentsId']['_rr'];this[_0x69f9('0xa')]=_[_0x69f9('0xe')](this['Agents'],'id');this[_0x69f9('0xa')][_0x69f9('0xf')]=_0x31ce11;};FaxQueue[_0x69f9('0x10')][_0x69f9('0xd')]=function(){this[_0x69f9('0x11')]=0x0;this['paused']=0x0;for(var _0x445123=0x0;_0x445123=0x0?this[_0x69f9('0x16')]:0x0;var _0x41997f={'id':this['id'],'available':this[_0x69f9('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x69f9('0x6')],'paused':this[_0x69f9('0x15')],'waiting':this[_0x69f9('0x17')]};var _0x1ba5ab=md5(JSON[_0x69f9('0x18')](_0x41997f));if(this[_0x69f9('0xb')]!==_0x1ba5ab){this['md5']=_0x1ba5ab;io['to'](util[_0x69f9('0x19')](_0x69f9('0x1a'),_0x41997f[_0x69f9('0x6')]))[_0x69f9('0x1b')](_0x69f9('0x1c'),_0x41997f);}};module[_0x69f9('0x1d')]=FaxQueue; \ No newline at end of file +var _0xcf72=['loggedIn','paused','online','available','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0xee8492,_0x513e56){var _0x3d48e1=function(_0x271877){while(--_0x271877){_0xee8492['push'](_0xee8492['shift']());}};_0x3d48e1(++_0x513e56);}(_0xcf72,0x19d));var _0x2cf7=function(_0x4bc7a8,_0x3160b2){_0x4bc7a8=_0x4bc7a8-0x0;var _0x80c03a=_0xcf72[_0x4bc7a8];return _0x80c03a;};'use strict';var _=require(_0x2cf7('0x0'));var md5=require(_0x2cf7('0x1'));var util=require(_0x2cf7('0x2'));var Redis=require(_0x2cf7('0x3'));var config=require(_0x2cf7('0x4'));config['redis']=_['defaults'](config[_0x2cf7('0x5')],{'host':_0x2cf7('0x6'),'port':0x18eb});var io=require(_0x2cf7('0x7'))(new Redis(config[_0x2cf7('0x5')]));function FaxQueue(_0x9630d6){this['id']=_0x9630d6['id']||0x0;this[_0x2cf7('0x8')]=_0x9630d6['name']||'';this[_0x2cf7('0x9')]=_0x9630d6[_0x2cf7('0x9')]||0xa;this[_0x2cf7('0xa')]=_0x9630d6[_0x2cf7('0xa')]||_0x2cf7('0xb');this[_0x2cf7('0xc')]=_0x9630d6[_0x2cf7('0xc')];this[_0x2cf7('0xd')]={};this[_0x2cf7('0xe')]=0x0;this[_0x2cf7('0x1')]='';this[_0x2cf7('0xf')]();this[_0x2cf7('0x10')]();}FaxQueue[_0x2cf7('0x11')]['updateRouting']=function(){var _0x47130d=this[_0x2cf7('0xd')]['_rr'];this[_0x2cf7('0xd')]=_['map'](this[_0x2cf7('0xc')],'id');this[_0x2cf7('0xd')][_0x2cf7('0x12')]=_0x47130d;};FaxQueue['prototype']['updateRealtime']=function(){this[_0x2cf7('0x13')]=0x0;this[_0x2cf7('0x14')]=0x0;for(var _0x577599=0x0;_0x577599=0x0?this['available']:0x0;var _0x396fb9={'id':this['id'],'available':this[_0x2cf7('0x16')],'loggedIn':this[_0x2cf7('0x13')],'name':this[_0x2cf7('0x8')],'paused':this['paused'],'waiting':this[_0x2cf7('0xe')]};var _0x3fc985=md5(JSON['stringify'](_0x396fb9));if(this[_0x2cf7('0x1')]!==_0x3fc985){this[_0x2cf7('0x1')]=_0x3fc985;io['to'](util['format'](_0x2cf7('0x17'),_0x396fb9[_0x2cf7('0x8')]))[_0x2cf7('0x18')](_0x2cf7('0x19'),_0x396fb9);}};module[_0x2cf7('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 4da71b1..16eb859 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 _0x43fe=['Intervals','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x43fe,0xe3));var _0xe43f=function(_0x240965,_0x498865){_0x240965=_0x240965-0x0;var _0x3c37d7=_0x43fe[_0x240965];return _0x3c37d7;};'use strict';function Interval(_0x3f0db7){this['id']=_0x3f0db7['id']||0x0;this[_0xe43f('0x0')]=_0x3f0db7['name']||'';this['Intervals']=_0x3f0db7[_0xe43f('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xcdb2=['Intervals','exports','name'];(function(_0x1b7d3e,_0xa4cadf){var _0xe9147f=function(_0x4a5dad){while(--_0x4a5dad){_0x1b7d3e['push'](_0x1b7d3e['shift']());}};_0xe9147f(++_0xa4cadf);}(_0xcdb2,0x1eb));var _0x2cdb=function(_0x40d615,_0xb26cd2){_0x40d615=_0x40d615-0x0;var _0x28db71=_0xcdb2[_0x40d615];return _0x28db71;};'use strict';function Interval(_0x382fc9){this['id']=_0x382fc9['id']||0x0;this[_0x2cdb('0x0')]=_0x382fc9[_0x2cdb('0x0')]||'';this[_0x2cdb('0x1')]=_0x382fc9[_0x2cdb('0x1')]||{};}module[_0x2cdb('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 7730344..64eb9fb 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 _0x1aac=['util','ioredis','defaults','redis','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x1aac,0xa1));var _0xc1aa=function(_0x12828b,_0x253ec5){_0x12828b=_0x12828b-0x0;var _0x4b9741=_0x1aac[_0x12828b];return _0x4b9741;};'use strict';var _=require('lodash');var md5=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var Redis=require(_0xc1aa('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xc1aa('0x3')](config[_0xc1aa('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc1aa('0x4')]));function MailQueue(_0x576852){this['id']=_0x576852['id']||0x0;this[_0xc1aa('0x5')]=_0x576852[_0xc1aa('0x5')]||'';this[_0xc1aa('0x6')]=_0x576852[_0xc1aa('0x6')]||0xa;this[_0xc1aa('0x7')]=_0x576852[_0xc1aa('0x7')]||'beepall';this[_0xc1aa('0x8')]=_0x576852['Agents'];this['mapAgentsId']={};this[_0xc1aa('0x9')]=0x0;this['md5']='';this[_0xc1aa('0xa')]();this[_0xc1aa('0xb')]();}MailQueue[_0xc1aa('0xc')][_0xc1aa('0xa')]=function(){var _0x4c3578=this[_0xc1aa('0xd')][_0xc1aa('0xe')];this['mapAgentsId']=_['map'](this[_0xc1aa('0x8')],'id');this['mapAgentsId'][_0xc1aa('0xe')]=_0x4c3578;};MailQueue['prototype'][_0xc1aa('0xb')]=function(){this[_0xc1aa('0xf')]=0x0;this[_0xc1aa('0x10')]=0x0;for(var _0x6bfce0=0x0;_0x6bfce0=0x0?this[_0xc1aa('0x14')]:0x0;var _0x3f4cc0={'id':this['id'],'available':this[_0xc1aa('0x14')],'loggedIn':this['loggedIn'],'name':this[_0xc1aa('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x57514d=md5(JSON[_0xc1aa('0x15')](_0x3f4cc0));if(this[_0xc1aa('0x0')]!==_0x57514d){this[_0xc1aa('0x0')]=_0x57514d;io['to'](util[_0xc1aa('0x16')](_0xc1aa('0x17'),_0x3f4cc0[_0xc1aa('0x5')]))[_0xc1aa('0x18')](_0xc1aa('0x19'),_0x3f4cc0);}};module[_0xc1aa('0x1a')]=MailQueue; \ No newline at end of file +var _0x7806=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','loggedIn','paused','mailPause','available','stringify','format','mail_queue:save','lodash','md5'];(function(_0x387862,_0x3c5c4e){var _0x16d405=function(_0x113b00){while(--_0x113b00){_0x387862['push'](_0x387862['shift']());}};_0x16d405(++_0x3c5c4e);}(_0x7806,0x1c9));var _0x6780=function(_0x37dd34,_0xbb7287){_0x37dd34=_0x37dd34-0x0;var _0x2dd6e3=_0x7806[_0x37dd34];return _0x2dd6e3;};'use strict';var _=require(_0x6780('0x0'));var md5=require(_0x6780('0x1'));var util=require(_0x6780('0x2'));var Redis=require(_0x6780('0x3'));var config=require(_0x6780('0x4'));config[_0x6780('0x5')]=_[_0x6780('0x6')](config[_0x6780('0x5')],{'host':_0x6780('0x7'),'port':0x18eb});var io=require(_0x6780('0x8'))(new Redis(config[_0x6780('0x5')]));function MailQueue(_0xc4b103){this['id']=_0xc4b103['id']||0x0;this[_0x6780('0x9')]=_0xc4b103[_0x6780('0x9')]||'';this[_0x6780('0xa')]=_0xc4b103[_0x6780('0xa')]||0xa;this[_0x6780('0xb')]=_0xc4b103[_0x6780('0xb')]||_0x6780('0xc');this[_0x6780('0xd')]=_0xc4b103[_0x6780('0xd')];this[_0x6780('0xe')]={};this[_0x6780('0xf')]=0x0;this[_0x6780('0x1')]='';this[_0x6780('0x10')]();this[_0x6780('0x11')]();}MailQueue['prototype'][_0x6780('0x10')]=function(){var _0x5c74d7=this[_0x6780('0xe')][_0x6780('0x12')];this[_0x6780('0xe')]=_[_0x6780('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x6780('0x12')]=_0x5c74d7;};MailQueue['prototype'][_0x6780('0x11')]=function(){this[_0x6780('0x14')]=0x0;this[_0x6780('0x15')]=0x0;for(var _0x2dbfad=0x0;_0x2dbfad=0x0?this[_0x6780('0x17')]:0x0;var _0x188a5c={'id':this['id'],'available':this[_0x6780('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x6780('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x8a9c7=md5(JSON[_0x6780('0x18')](_0x188a5c));if(this[_0x6780('0x1')]!==_0x8a9c7){this[_0x6780('0x1')]=_0x8a9c7;io['to'](util[_0x6780('0x19')]('mail:queue:%s',_0x188a5c[_0x6780('0x9')]))['emit'](_0x6780('0x1a'),_0x188a5c);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f645400..c0ebcec 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(_0x1afabf,_0x56fdcc){var _0x497ff1=function(_0x2f6104){while(--_0x2f6104){_0x1afabf['push'](_0x1afabf['shift']());}};_0x497ff1(++_0x56fdcc);}(_0x1261,0x144));var _0x1126=function(_0x1fb6ff,_0x474709){_0x1fb6ff=_0x1fb6ff-0x0;var _0x339f61=_0x1261[_0x1fb6ff];return _0x339f61;};'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(_0x4be04a,_0x3bf896){var _0xd03915=function(_0x4b23ca){while(--_0x4b23ca){_0x4be04a['push'](_0x4be04a['shift']());}};_0xd03915(++_0x3bf896);}(_0x5fc3,0xa8));var _0x35fc=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0x5fc3[_0xc0d9bc];return _0x32ff73;};'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 d7a2f17..b67c8c5 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 _0x984b=['updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x1c721f,_0x5c079d){var _0xd7f7d5=function(_0x1dc0a1){while(--_0x1dc0a1){_0x1c721f['push'](_0x1c721f['shift']());}};_0xd7f7d5(++_0x5c079d);}(_0x984b,0xee));var _0xb984=function(_0x89e96e,_0x182b9d){_0x89e96e=_0x89e96e-0x0;var _0x341f1d=_0x984b[_0x89e96e];return _0x341f1d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0xb984('0x0'));var config=require(_0xb984('0x1'));config[_0xb984('0x2')]=_['defaults'](config['redis'],{'host':_0xb984('0x3'),'port':0x18eb});var io=require(_0xb984('0x4'))(new Redis(config['redis']));function SmsQueue(_0x4f91b1){this['id']=_0x4f91b1['id']||0x0;this[_0xb984('0x5')]=_0x4f91b1[_0xb984('0x5')]||'';this['timeout']=_0x4f91b1[_0xb984('0x6')]||0xa;this[_0xb984('0x7')]=_0x4f91b1['strategy']||_0xb984('0x8');this['Agents']=_0x4f91b1[_0xb984('0x9')];this[_0xb984('0xa')]={};this[_0xb984('0xb')]=0x0;this[_0xb984('0xc')]='';this[_0xb984('0xd')]();this[_0xb984('0xe')]();}SmsQueue[_0xb984('0xf')][_0xb984('0xd')]=function(){var _0x16d46f=this[_0xb984('0xa')][_0xb984('0x10')];this[_0xb984('0xa')]=_['map'](this[_0xb984('0x9')],'id');this['mapAgentsId'][_0xb984('0x10')]=_0x16d46f;};SmsQueue[_0xb984('0xf')]['updateRealtime']=function(){this[_0xb984('0x11')]=0x0;this[_0xb984('0x12')]=0x0;for(var _0x564d24=0x0;_0x564d24=0x0?this[_0xb984('0x16')]:0x0;var _0x35bd75={'id':this['id'],'available':this[_0xb984('0x16')],'loggedIn':this[_0xb984('0x11')],'name':this[_0xb984('0x5')],'paused':this[_0xb984('0x12')],'waiting':this['waiting']};var _0x2492f4=md5(JSON[_0xb984('0x17')](_0x35bd75));if(this[_0xb984('0xc')]!==_0x2492f4){this[_0xb984('0xc')]=_0x2492f4;io['to'](util[_0xb984('0x18')](_0xb984('0x19'),_0x35bd75['name']))[_0xb984('0x1a')](_0xb984('0x1b'),_0x35bd75);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x54f3=['sms:queue:%s','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','loggedIn','length','online','available','paused'];(function(_0x141a78,_0x69a218){var _0x2c14cc=function(_0x3747d6){while(--_0x3747d6){_0x141a78['push'](_0x141a78['shift']());}};_0x2c14cc(++_0x69a218);}(_0x54f3,0x120));var _0x354f=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x54f3[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var md5=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var Redis=require(_0x354f('0x2'));var config=require(_0x354f('0x3'));config[_0x354f('0x4')]=_['defaults'](config['redis'],{'host':_0x354f('0x5'),'port':0x18eb});var io=require(_0x354f('0x6'))(new Redis(config[_0x354f('0x4')]));function SmsQueue(_0x5bafb1){this['id']=_0x5bafb1['id']||0x0;this['name']=_0x5bafb1[_0x354f('0x7')]||'';this['timeout']=_0x5bafb1[_0x354f('0x8')]||0xa;this[_0x354f('0x9')]=_0x5bafb1[_0x354f('0x9')]||_0x354f('0xa');this['Agents']=_0x5bafb1[_0x354f('0xb')];this['mapAgentsId']={};this[_0x354f('0xc')]=0x0;this[_0x354f('0x0')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x354f('0xd')][_0x354f('0xe')]=function(){var _0x55e064=this[_0x354f('0xf')][_0x354f('0x10')];this['mapAgentsId']=_[_0x354f('0x11')](this[_0x354f('0xb')],'id');this[_0x354f('0xf')][_0x354f('0x10')]=_0x55e064;};SmsQueue[_0x354f('0xd')][_0x354f('0x12')]=function(){this[_0x354f('0x13')]=0x0;this['paused']=0x0;for(var _0xf2e013=0x0;_0xf2e013=0x0?this[_0x354f('0x16')]:0x0;var _0x1210a6={'id':this['id'],'available':this['available'],'loggedIn':this[_0x354f('0x13')],'name':this[_0x354f('0x7')],'paused':this[_0x354f('0x17')],'waiting':this['waiting']};var _0x3bb1a1=md5(JSON['stringify'](_0x1210a6));if(this[_0x354f('0x0')]!==_0x3bb1a1){this[_0x354f('0x0')]=_0x3bb1a1;io['to'](util['format'](_0x354f('0x18'),_0x1210a6[_0x354f('0x7')]))['emit']('sms_queue:save',_0x1210a6);}};module[_0x354f('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3b1b6ee..cd32b20 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 _0xdb54=['emit','whatsapp_queue:save','exports','lodash','md5','util','defaults','localhost','redis','name','timeout','strategy','beepall','Agents','waiting','prototype','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','online','available','stringify','format'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xdb54,0x111));var _0x4db5=function(_0x287f2e,_0x53cbf3){_0x287f2e=_0x287f2e-0x0;var _0x19cb48=_0xdb54[_0x287f2e];return _0x19cb48;};'use strict';var _=require(_0x4db5('0x0'));var md5=require(_0x4db5('0x1'));var util=require(_0x4db5('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x4db5('0x3')](config['redis'],{'host':_0x4db5('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4db5('0x5')]));function WhatsappQueue(_0xd5aa22){this['id']=_0xd5aa22['id']||0x0;this[_0x4db5('0x6')]=_0xd5aa22[_0x4db5('0x6')]||'';this[_0x4db5('0x7')]=_0xd5aa22[_0x4db5('0x7')]||0xa;this[_0x4db5('0x8')]=_0xd5aa22[_0x4db5('0x8')]||_0x4db5('0x9');this[_0x4db5('0xa')]=_0xd5aa22['Agents'];this['mapAgentsId']={};this[_0x4db5('0xb')]=0x0;this[_0x4db5('0x1')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x4db5('0xc')]['updateRouting']=function(){var _0x367ada=this[_0x4db5('0xd')][_0x4db5('0xe')];this[_0x4db5('0xd')]=_[_0x4db5('0xf')](this[_0x4db5('0xa')],'id');this[_0x4db5('0xd')][_0x4db5('0xe')]=_0x367ada;};WhatsappQueue['prototype'][_0x4db5('0x10')]=function(){this[_0x4db5('0x11')]=0x0;this[_0x4db5('0x12')]=0x0;for(var _0x18ab76=0x0;_0x18ab76=0x0?this['available']:0x0;var _0x5d6cc6={'id':this['id'],'available':this[_0x4db5('0x15')],'loggedIn':this[_0x4db5('0x11')],'name':this[_0x4db5('0x6')],'paused':this[_0x4db5('0x12')],'waiting':this[_0x4db5('0xb')]};var _0x473fe7=md5(JSON[_0x4db5('0x16')](_0x5d6cc6));if(this[_0x4db5('0x1')]!==_0x473fe7){this['md5']=_0x473fe7;io['to'](util[_0x4db5('0x17')]('whatsapp:queue:%s',_0x5d6cc6[_0x4db5('0x6')]))[_0x4db5('0x18')](_0x4db5('0x19'),_0x5d6cc6);}};module[_0x4db5('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xa310=['paused','available','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','defaults','redis','localhost','socket.io-emitter','name','strategy','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','whatsappPause'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa310,0xcc));var _0x0a31=function(_0x2a28de,_0x2fb80f){_0x2a28de=_0x2a28de-0x0;var _0x1821fb=_0xa310[_0x2a28de];return _0x1821fb;};'use strict';var _=require(_0x0a31('0x0'));var md5=require('md5');var util=require(_0x0a31('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x0a31('0x2')](config[_0x0a31('0x3')],{'host':_0x0a31('0x4'),'port':0x18eb});var io=require(_0x0a31('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x2e05c5){this['id']=_0x2e05c5['id']||0x0;this[_0x0a31('0x6')]=_0x2e05c5[_0x0a31('0x6')]||'';this['timeout']=_0x2e05c5['timeout']||0xa;this['strategy']=_0x2e05c5[_0x0a31('0x7')]||'beepall';this[_0x0a31('0x8')]=_0x2e05c5[_0x0a31('0x8')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0a31('0x9')]='';this[_0x0a31('0xa')]();this[_0x0a31('0xb')]();}WhatsappQueue[_0x0a31('0xc')][_0x0a31('0xa')]=function(){var _0x35304a=this[_0x0a31('0xd')][_0x0a31('0xe')];this['mapAgentsId']=_[_0x0a31('0xf')](this[_0x0a31('0x8')],'id');this[_0x0a31('0xd')]['_rr']=_0x35304a;};WhatsappQueue[_0x0a31('0xc')][_0x0a31('0xb')]=function(){this[_0x0a31('0x10')]=0x0;this['paused']=0x0;for(var _0x436f7f=0x0;_0x436f7f=0x0?this[_0x0a31('0x15')]:0x0;var _0x459d5c={'id':this['id'],'available':this[_0x0a31('0x15')],'loggedIn':this[_0x0a31('0x10')],'name':this[_0x0a31('0x6')],'paused':this['paused'],'waiting':this[_0x0a31('0x16')]};var _0x511e6d=md5(JSON[_0x0a31('0x17')](_0x459d5c));if(this[_0x0a31('0x9')]!==_0x511e6d){this[_0x0a31('0x9')]=_0x511e6d;io['to'](util[_0x0a31('0x18')](_0x0a31('0x19'),_0x459d5c[_0x0a31('0x6')]))['emit'](_0x0a31('0x1a'),_0x459d5c);}};module[_0x0a31('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 7e7349e..b0973d7 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x2296b5,_0x5efe9c){var _0x1e8ae2=function(_0x45219f){while(--_0x45219f){_0x2296b5['push'](_0x2296b5['shift']());}};_0x1e8ae2(++_0x5efe9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x24fe48,_0x10e97e){_0x24fe48=_0x24fe48-0x0;var _0x51e7d5=_0xb10b[_0x24fe48];return _0x51e7d5;};'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 39cabba..69ee1da 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 _0x73dd=['../client','update','Request','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x37023c,_0x298013){var _0x108052=function(_0x8b2037){while(--_0x8b2037){_0x37023c['push'](_0x37023c['shift']());}};_0x108052(++_0x298013);}(_0x73dd,0x126));var _0xd73d=function(_0x1e6362,_0x12bbf4){_0x1e6362=_0x1e6362-0x0;var _0x38b6a7=_0x73dd[_0x1e6362];return _0x38b6a7;};'use strict';var client=require(_0xd73d('0x0'));exports[_0xd73d('0x1')]=function(_0x41764a,_0x29911f){return client[_0xd73d('0x2')]('UpdateChatInteraction',{'body':_0x29911f,'options':{'where':{'id':_0x41764a}},'log':_0xd73d('0x3')});};exports[_0xd73d('0x4')]=function(_0x225127,_0x37b696){return client[_0xd73d('0x2')]('AddTagsToChatInteraction',{'body':_0x37b696,'options':{'where':{'id':_0x225127}},'log':_0xd73d('0x5')});}; \ No newline at end of file +var _0xef06=['addTags','Request','AddTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0xd1106d,_0x4e74e3){var _0xf834ea=function(_0x459f6c){while(--_0x459f6c){_0xd1106d['push'](_0xd1106d['shift']());}};_0xf834ea(++_0x4e74e3);}(_0xef06,0x1cb));var _0x6ef0=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0xef06[_0x562faf];return _0x22c1f6;};'use strict';var client=require(_0x6ef0('0x0'));exports[_0x6ef0('0x1')]=function(_0x26566a,_0x222ef4){return client['Request'](_0x6ef0('0x2'),{'body':_0x222ef4,'options':{'where':{'id':_0x26566a}},'log':'updateChatInteraction'});};exports[_0x6ef0('0x3')]=function(_0xa332fe,_0x27457f){return client[_0x6ef0('0x4')](_0x6ef0('0x5'),{'body':_0x27457f,'options':{'where':{'id':_0xa332fe}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 052d993..5a1ee79 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 _0x9208=['../client','create','Request'];(function(_0x48a8a8,_0x8d079a){var _0x29740c=function(_0x38ce44){while(--_0x38ce44){_0x48a8a8['push'](_0x48a8a8['shift']());}};_0x29740c(++_0x8d079a);}(_0x9208,0x13e));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x8920('0x0'));exports[_0x8920('0x1')]=function(_0x4a20e2){return client[_0x8920('0x2')]('CreateChatMessage',{'body':_0x4a20e2,'log':'createChatMessage'});}; \ No newline at end of file +var _0xb5f7=['Request','../client','create'];(function(_0xfc790,_0x20608e){var _0x203250=function(_0x138e71){while(--_0x138e71){_0xfc790['push'](_0xfc790['shift']());}};_0x203250(++_0x20608e);}(_0xb5f7,0x1c6));var _0x7b5f=function(_0x2721aa,_0x13ee5d){_0x2721aa=_0x2721aa-0x0;var _0x9cbf20=_0xb5f7[_0x2721aa];return _0x9cbf20;};'use strict';var client=require(_0x7b5f('0x0'));exports[_0x7b5f('0x1')]=function(_0x48f7ba){return client[_0x7b5f('0x2')]('CreateChatMessage',{'body':_0x48f7ba,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cadd17f..86d5c6f 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 _0x0bde=['chatPause','getChatQueues','../client','Request','GetChatQueue','timeout','strategy','User','name','online'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0xe0bd('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xe0bd('0x1')](_0xe0bd('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe0bd('0x3'),_0xe0bd('0x4')],'include':[{'model':_0xe0bd('0x5'),'as':'Agents','attributes':['id',_0xe0bd('0x6'),_0xe0bd('0x7'),_0xe0bd('0x8')]}]},'log':_0xe0bd('0x9')});};}; \ No newline at end of file +var _0x3e9d=['online','chatPause','../client','getChatQueues','GetChatQueue','name','timeout','strategy'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0xe1e68,_0x40cda9){_0xe1e68=_0xe1e68-0x0;var _0x2164cd=_0x3e9d[_0xe1e68];return _0x2164cd;};'use strict';var client=require(_0xd3e9('0x0'));exports[_0xd3e9('0x1')]=function(){return function(){return client['Request'](_0xd3e9('0x2'),{'options':{'raw':![],'attributes':['id',_0xd3e9('0x3'),_0xd3e9('0x4'),_0xd3e9('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xd3e9('0x3'),_0xd3e9('0x6'),_0xd3e9('0x7')]}]},'log':_0xd3e9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 87adee9..6242e5c 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 _0x8664=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1abefa,_0x57a073){var _0x497bc7=function(_0x156c7f){while(--_0x156c7f){_0x1abefa['push'](_0x1abefa['shift']());}};_0x497bc7(++_0x57a073);}(_0x8664,0x11a));var _0x4866=function(_0x126483,_0x1f75d6){_0x126483=_0x126483-0x0;var _0x18db55=_0x8664[_0x126483];return _0x18db55;};'use strict';var client=require(_0x4866('0x0'));exports[_0x4866('0x1')]=function(_0x45783e){return client[_0x4866('0x2')](_0x4866('0x3'),{'body':_0x45783e,'log':_0x4866('0x3')});};exports[_0x4866('0x4')]=function(_0x1187ed,_0x16a88f){return client['Request'](_0x4866('0x5'),{'body':_0x16a88f,'options':{'where':{'uniqueid':_0x1187ed},'order':[['id','DESC']],'limit':0x1},'log':_0x4866('0x5')});}; \ No newline at end of file +var _0xd845=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x58e8cf,_0x1bd020){var _0x3a9ed9=function(_0x199635){while(--_0x199635){_0x58e8cf['push'](_0x58e8cf['shift']());}};_0x3a9ed9(++_0x1bd020);}(_0xd845,0x135));var _0x5d84=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xd845[_0x3a6efd];return _0x487b9a;};'use strict';var client=require(_0x5d84('0x0'));exports[_0x5d84('0x1')]=function(_0xc6e9bc){return client[_0x5d84('0x2')]('CreateChatQueueReport',{'body':_0xc6e9bc,'log':_0x5d84('0x3')});};exports[_0x5d84('0x4')]=function(_0x918317,_0x11abe5){return client['Request'](_0x5d84('0x5'),{'body':_0x11abe5,'options':{'where':{'uniqueid':_0x918317},'order':[['id',_0x5d84('0x6')]],'limit':0x1},'log':_0x5d84('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 22da30c..5fdca85 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(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0x7a54,0x106));var _0x47a5=function(_0x294237,_0x523b55){_0x294237=_0x294237-0x0;var _0x53d413=_0x7a54[_0x294237];return _0x53d413;};'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(_0x764874,_0x3ed544){var _0x29f9d5=function(_0x152dad){while(--_0x152dad){_0x764874['push'](_0x764874['shift']());}};_0x29f9d5(++_0x3ed544);}(_0x7a54,0x106));var _0x47a5=function(_0xb43053,_0x27caec){_0xb43053=_0xb43053-0x0;var _0x57ea9e=_0x7a54[_0xb43053];return _0x57ea9e;};'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 576ea4c..42d3d6e 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 _0x6a8c=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x451217,_0x2bb4fe){var _0x5cb0f2=function(_0x1be303){while(--_0x1be303){_0x451217['push'](_0x451217['shift']());}};_0x5cb0f2(++_0x2bb4fe);}(_0x6a8c,0x1f4));var _0xc6a8=function(_0x45e37d,_0xf4392d){_0x45e37d=_0x45e37d-0x0;var _0x3b747b=_0x6a8c[_0x45e37d];return _0x3b747b;};'use strict';var client=require(_0xc6a8('0x0'));exports['create']=function(_0x29f4bc){return client[_0xc6a8('0x1')](_0xc6a8('0x2'),{'body':_0x29f4bc,'log':_0xc6a8('0x3')});}; \ No newline at end of file +var _0x2205=['Request','createFaxMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2205,0x16d));var _0x5220=function(_0x4a82bc,_0x3b2a73){_0x4a82bc=_0x4a82bc-0x0;var _0x568fb2=_0x2205[_0x4a82bc];return _0x568fb2;};'use strict';var client=require('../client');exports[_0x5220('0x0')]=function(_0x5318ed){return client[_0x5220('0x1')]('CreateFaxMessage',{'body':_0x5318ed,'log':_0x5220('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 18299db..7825218 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 _0xb08f=['getFaxQueues','../client','Request','name','timeout','strategy','User','online','faxPause'];(function(_0x48353a,_0x1d98f3){var _0x15c410=function(_0x5d0914){while(--_0x5d0914){_0x48353a['push'](_0x48353a['shift']());}};_0x15c410(++_0x1d98f3);}(_0xb08f,0xb5));var _0xfb08=function(_0x2c14fd,_0x492b6f){_0x2c14fd=_0x2c14fd-0x0;var _0xeef6ab=_0xb08f[_0x2c14fd];return _0xeef6ab;};'use strict';var client=require(_0xfb08('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xfb08('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xfb08('0x2'),_0xfb08('0x3'),_0xfb08('0x4')],'include':[{'model':_0xfb08('0x5'),'as':'Agents','attributes':['id',_0xfb08('0x2'),_0xfb08('0x6'),_0xfb08('0x7')]}]},'log':_0xfb08('0x8')});};}; \ No newline at end of file +var _0xb42e=['../client','getFaxQueues','GetFaxQueue','name','timeout','strategy','User','Agents','online'];(function(_0x128bf5,_0x8d5d38){var _0x279fc0=function(_0x192e6d){while(--_0x192e6d){_0x128bf5['push'](_0x128bf5['shift']());}};_0x279fc0(++_0x8d5d38);}(_0xb42e,0xc6));var _0xeb42=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb42e[_0x40220a];return _0x3903cc;};'use strict';var client=require(_0xeb42('0x0'));exports[_0xeb42('0x1')]=function(){return function(){return client['Request'](_0xeb42('0x2'),{'options':{'raw':![],'attributes':['id',_0xeb42('0x3'),_0xeb42('0x4'),_0xeb42('0x5')],'include':[{'model':_0xeb42('0x6'),'as':_0xeb42('0x7'),'attributes':['id',_0xeb42('0x3'),_0xeb42('0x8'),'faxPause']}]},'log':_0xeb42('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8555dda..e658a1c 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 _0x9167=['CreateFaxQueueReport','DESC','../client','create','Request'];(function(_0x447550,_0x477c3b){var _0x50ce12=function(_0x1941da){while(--_0x1941da){_0x447550['push'](_0x447550['shift']());}};_0x50ce12(++_0x477c3b);}(_0x9167,0x98));var _0x7916=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9167[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7916('0x0'));exports[_0x7916('0x1')]=function(_0x45e459){return client[_0x7916('0x2')](_0x7916('0x3'),{'body':_0x45e459,'log':'CreateFaxQueueReport'});};exports['update']=function(_0x11455b,_0x26954b){return client[_0x7916('0x2')]('UpdateFaxQueueReport',{'body':_0x26954b,'options':{'where':{'uniqueid':_0x11455b},'order':[['id',_0x7916('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x1a5c=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x1a5c,0x100));var _0xc1a5=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x1a5c[_0x3c2a69];return _0x596bc8;};'use strict';var client=require(_0xc1a5('0x0'));exports[_0xc1a5('0x1')]=function(_0x54fbc3){return client[_0xc1a5('0x2')](_0xc1a5('0x3'),{'body':_0x54fbc3,'log':'CreateFaxQueueReport'});};exports[_0xc1a5('0x4')]=function(_0x17e40c,_0x821c59){return client[_0xc1a5('0x2')](_0xc1a5('0x5'),{'body':_0x821c59,'options':{'where':{'uniqueid':_0x17e40c},'order':[['id',_0xc1a5('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index e206c30..a001cd0 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 _0xc7fd=['Request','GetInterval','name','Interval','interval','../client','getIntervals'];(function(_0x4f2966,_0x24a4fd){var _0x538588=function(_0x155690){while(--_0x155690){_0x4f2966['push'](_0x4f2966['shift']());}};_0x538588(++_0x24a4fd);}(_0xc7fd,0xe5));var _0xdc7f=function(_0x148266,_0x1d6983){_0x148266=_0x148266-0x0;var _0x2b4e0e=_0xc7fd[_0x148266];return _0x2b4e0e;};'use strict';var client=require(_0xdc7f('0x0'));exports[_0xdc7f('0x1')]=function(){return function(){return client[_0xdc7f('0x2')](_0xdc7f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xdc7f('0x4')],'include':[{'model':_0xdc7f('0x5'),'as':'Intervals','attributes':['id',_0xdc7f('0x4'),_0xdc7f('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x1ecb=['GetInterval','name','Interval','Intervals','interval','Request'];(function(_0x5abf7a,_0x4d16bb){var _0x17350f=function(_0x142f20){while(--_0x142f20){_0x5abf7a['push'](_0x5abf7a['shift']());}};_0x17350f(++_0x4d16bb);}(_0x1ecb,0x12b));var _0xb1ec=function(_0x48f2c6,_0x258b71){_0x48f2c6=_0x48f2c6-0x0;var _0x5ab993=_0x1ecb[_0x48f2c6];return _0x5ab993;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0xb1ec('0x0')](_0xb1ec('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb1ec('0x2')],'include':[{'model':_0xb1ec('0x3'),'as':_0xb1ec('0x4'),'attributes':['id',_0xb1ec('0x2'),_0xb1ec('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 98c473f..cc1a0c1 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 _0x6a55=['Request','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x4e4068,_0x122c31){var _0x2846a4=function(_0x1b9ab4){while(--_0x1b9ab4){_0x4e4068['push'](_0x4e4068['shift']());}};_0x2846a4(++_0x122c31);}(_0x6a55,0xdb));var _0x56a5=function(_0x3ead55,_0x22bc51){_0x3ead55=_0x3ead55-0x0;var _0x3ea16d=_0x6a55[_0x3ead55];return _0x3ea16d;};'use strict';var client=require(_0x56a5('0x0'));exports['update']=function(_0x5d894b,_0x4ec858){return client[_0x56a5('0x1')]('UpdateMailInteraction',{'body':_0x4ec858,'options':{'where':{'id':_0x5d894b}},'log':'updateMailInteraction'});};exports[_0x56a5('0x2')]=function(_0x5e5a32,_0x3ff76a){return client['Request'](_0x56a5('0x3'),{'body':_0x3ff76a,'options':{'where':{'id':_0x5e5a32}},'log':_0x56a5('0x4')});}; \ No newline at end of file +var _0x32b6=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0x32b6,0x1d1));var _0x632b=function(_0x105855,_0x55ff07){_0x105855=_0x105855-0x0;var _0x2a9535=_0x32b6[_0x105855];return _0x2a9535;};'use strict';var client=require(_0x632b('0x0'));exports[_0x632b('0x1')]=function(_0x4d7646,_0x1f0635){return client[_0x632b('0x2')]('UpdateMailInteraction',{'body':_0x1f0635,'options':{'where':{'id':_0x4d7646}},'log':'updateMailInteraction'});};exports[_0x632b('0x3')]=function(_0x3435e8,_0x3ba3a7){return client[_0x632b('0x2')](_0x632b('0x4'),{'body':_0x3ba3a7,'options':{'where':{'id':_0x3435e8}},'log':_0x632b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 79f3377..a6750b6 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 _0xfb7b=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xfb7b,0x14b));var _0xbfb7=function(_0x4618dd,_0x3ec169){_0x4618dd=_0x4618dd-0x0;var _0x3770fa=_0xfb7b[_0x4618dd];return _0x3770fa;};'use strict';var client=require(_0xbfb7('0x0'));exports['create']=function(_0x71618d){return client[_0xbfb7('0x1')](_0xbfb7('0x2'),{'body':_0x71618d,'log':_0xbfb7('0x3')});}; \ No newline at end of file +var _0x1958=['Request'];(function(_0x328dd1,_0x5887f8){var _0x405a1b=function(_0x4a0160){while(--_0x4a0160){_0x328dd1['push'](_0x328dd1['shift']());}};_0x405a1b(++_0x5887f8);}(_0x1958,0x18e));var _0x8195=function(_0x1ad279,_0x42d157){_0x1ad279=_0x1ad279-0x0;var _0x272861=_0x1958[_0x1ad279];return _0x272861;};'use strict';var client=require('../client');exports['create']=function(_0x31ca27){return client[_0x8195('0x0')]('CreateMailMessage',{'body':_0x31ca27,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 30e2dcb..e3ed67e 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 _0xdada=['../client','getMailQueues','GetMailQueue','name','strategy','User','Agents','mailPause'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdada,0x130));var _0xadad=function(_0x1335d4,_0x128374){_0x1335d4=_0x1335d4-0x0;var _0xc2916d=_0xdada[_0x1335d4];return _0xc2916d;};'use strict';var client=require(_0xadad('0x0'));exports[_0xadad('0x1')]=function(){return function(){return client['Request'](_0xadad('0x2'),{'options':{'raw':![],'attributes':['id',_0xadad('0x3'),'timeout',_0xadad('0x4')],'include':[{'model':_0xadad('0x5'),'as':_0xadad('0x6'),'attributes':['id','name','online',_0xadad('0x7')]}]},'log':_0xadad('0x1')});};}; \ No newline at end of file +var _0xc97e=['strategy','Agents','mailPause','../client','getMailQueues','Request','name'];(function(_0x3f679c,_0x2fae05){var _0x274b79=function(_0x12273b){while(--_0x12273b){_0x3f679c['push'](_0x3f679c['shift']());}};_0x274b79(++_0x2fae05);}(_0xc97e,0x176));var _0xec97=function(_0x2c0467,_0x1b83aa){_0x2c0467=_0x2c0467-0x0;var _0x2b999b=_0xc97e[_0x2c0467];return _0x2b999b;};'use strict';var client=require(_0xec97('0x0'));exports[_0xec97('0x1')]=function(){return function(){return client[_0xec97('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xec97('0x3'),'timeout',_0xec97('0x4')],'include':[{'model':'User','as':_0xec97('0x5'),'attributes':['id',_0xec97('0x3'),'online',_0xec97('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index fd8b2c2..c9b83ab 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 _0xd64b=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','update','DESC'];(function(_0xd41d21,_0x5a869b){var _0x2295ac=function(_0x45f59e){while(--_0x45f59e){_0xd41d21['push'](_0xd41d21['shift']());}};_0x2295ac(++_0x5a869b);}(_0xd64b,0x7f));var _0xbd64=function(_0x73a0ff,_0x3a0d2a){_0x73a0ff=_0x73a0ff-0x0;var _0x1705aa=_0xd64b[_0x73a0ff];return _0x1705aa;};'use strict';var client=require(_0xbd64('0x0'));exports['create']=function(_0x2c95e8){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'body':_0x2c95e8,'log':'CreateMailQueueReport'});};exports[_0xbd64('0x3')]=function(_0x5e7cab,_0xa362d3){return client[_0xbd64('0x1')]('UpdateMailQueueReport',{'body':_0xa362d3,'options':{'where':{'uniqueid':_0x5e7cab},'order':[['id',_0xbd64('0x4')]],'limit':0x1},'log':_0xbd64('0x5')});}; \ No newline at end of file +var _0xac9f=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client','create'];(function(_0x4c2c5c,_0xabad44){var _0x54ffb5=function(_0x47e287){while(--_0x47e287){_0x4c2c5c['push'](_0x4c2c5c['shift']());}};_0x54ffb5(++_0xabad44);}(_0xac9f,0xc4));var _0xfac9=function(_0x3ec818,_0x21a3e3){_0x3ec818=_0x3ec818-0x0;var _0x107e7c=_0xac9f[_0x3ec818];return _0x107e7c;};'use strict';var client=require(_0xfac9('0x0'));exports[_0xfac9('0x1')]=function(_0xd1aa32){return client[_0xfac9('0x2')](_0xfac9('0x3'),{'body':_0xd1aa32,'log':_0xfac9('0x3')});};exports[_0xfac9('0x4')]=function(_0x4ae0c6,_0x43394d){return client['Request']('UpdateMailQueueReport',{'body':_0x43394d,'options':{'where':{'uniqueid':_0x4ae0c6},'order':[['id','DESC']],'limit':0x1},'log':_0xfac9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index acb2a20..74c1aae 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 _0xe142=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x4526a1,_0x21fed3){var _0x113f51=function(_0x4f9577){while(--_0x4f9577){_0x4526a1['push'](_0x4526a1['shift']());}};_0x113f51(++_0x21fed3);}(_0xe142,0x11d));var _0x2e14=function(_0x228266,_0x2882ce){_0x228266=_0x228266-0x0;var _0x48a998=_0xe142[_0x228266];return _0x48a998;};'use strict';var client=require(_0x2e14('0x0'));exports[_0x2e14('0x1')]=function(_0x2b0aed,_0x461bb6){return client['Request'](_0x2e14('0x2'),{'body':_0x461bb6,'options':{'where':{'id':_0x2b0aed}},'log':_0x2e14('0x3')});};exports[_0x2e14('0x4')]=function(_0x2669ab,_0x2fa071){return client[_0x2e14('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x2fa071,'options':{'where':{'id':_0x2669ab}},'log':_0x2e14('0x6')});}; \ No newline at end of file +var _0x2a30=['update','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','../client'];(function(_0x5339de,_0x4597cc){var _0x471030=function(_0x56e6f5){while(--_0x56e6f5){_0x5339de['push'](_0x5339de['shift']());}};_0x471030(++_0x4597cc);}(_0x2a30,0x171));var _0x02a3=function(_0x55ed77,_0x49fe97){_0x55ed77=_0x55ed77-0x0;var _0x1dbc13=_0x2a30[_0x55ed77];return _0x1dbc13;};'use strict';var client=require(_0x02a3('0x0'));exports[_0x02a3('0x1')]=function(_0x3cc1b8,_0x4c4dcd){return client[_0x02a3('0x2')](_0x02a3('0x3'),{'body':_0x4c4dcd,'options':{'where':{'id':_0x3cc1b8}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x3f7a84,_0x4c641d){return client[_0x02a3('0x2')](_0x02a3('0x4'),{'body':_0x4c641d,'options':{'where':{'id':_0x3f7a84}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 94428db..88cf8aa 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 _0x7bd9=['create','Request','CreateOpenchannelMessage'];(function(_0x172031,_0x3f1c50){var _0x48796a=function(_0x236fd0){while(--_0x236fd0){_0x172031['push'](_0x172031['shift']());}};_0x48796a(++_0x3f1c50);}(_0x7bd9,0x18f));var _0x97bd=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x7bd9[_0x4bb66f];return _0xf2772f;};'use strict';var client=require('../client');exports[_0x97bd('0x0')]=function(_0x1dc2ec){return client[_0x97bd('0x1')](_0x97bd('0x2'),{'body':_0x1dc2ec,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x031e=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x031e,0x1b2));var _0xe031=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x031e[_0x4bd06e];return _0x85ebb;};'use strict';var client=require(_0xe031('0x0'));exports[_0xe031('0x1')]=function(_0x410f88){return client[_0xe031('0x2')](_0xe031('0x3'),{'body':_0x410f88,'log':_0xe031('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ff79ce3..5c88e1a 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 _0x8fe9=['name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x8fe9,0x15d));var _0x98fe=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x8fe9[_0x243217];return _0x478029;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x98fe('0x0')](_0x98fe('0x1'),{'options':{'raw':![],'attributes':['id',_0x98fe('0x2'),'timeout',_0x98fe('0x3')],'include':[{'model':_0x98fe('0x4'),'as':_0x98fe('0x5'),'attributes':['id',_0x98fe('0x2'),_0x98fe('0x6'),_0x98fe('0x7')]}]},'log':_0x98fe('0x8')});};}; \ No newline at end of file +var _0xaaf8=['User','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x20c3c2,_0x1b45e1){var _0x527149=function(_0x1b89d1){while(--_0x1b89d1){_0x20c3c2['push'](_0x20c3c2['shift']());}};_0x527149(++_0x1b45e1);}(_0xaaf8,0x1ab));var _0x8aaf=function(_0x1a9390,_0x3339e6){_0x1a9390=_0x1a9390-0x0;var _0x2b4514=_0xaaf8[_0x1a9390];return _0x2b4514;};'use strict';var client=require('../client');exports[_0x8aaf('0x0')]=function(){return function(){return client['Request'](_0x8aaf('0x1'),{'options':{'raw':![],'attributes':['id',_0x8aaf('0x2'),_0x8aaf('0x3'),_0x8aaf('0x4')],'include':[{'model':_0x8aaf('0x5'),'as':'Agents','attributes':['id',_0x8aaf('0x2'),_0x8aaf('0x6'),_0x8aaf('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 9ba749c..b5a18e9 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 _0xb1db=['update','UpdateOpenchannelQueueReport','Request','CreateOpenchannelQueueReport'];(function(_0xdbbd74,_0x386abd){var _0x6bbe4b=function(_0x345017){while(--_0x345017){_0xdbbd74['push'](_0xdbbd74['shift']());}};_0x6bbe4b(++_0x386abd);}(_0xb1db,0x1be));var _0xbb1d=function(_0x4da462,_0x2aac46){_0x4da462=_0x4da462-0x0;var _0x2a001a=_0xb1db[_0x4da462];return _0x2a001a;};'use strict';var client=require('../client');exports['create']=function(_0x4c9916){return client[_0xbb1d('0x0')](_0xbb1d('0x1'),{'body':_0x4c9916,'log':_0xbb1d('0x1')});};exports[_0xbb1d('0x2')]=function(_0x21e76e,_0x286e92){return client[_0xbb1d('0x0')](_0xbb1d('0x3'),{'body':_0x286e92,'options':{'where':{'uniqueid':_0x21e76e},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x14d0=['create','update','UpdateOpenchannelQueueReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14d0,0x127));var _0x014d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x14d0[_0xaa1b3e];return _0x454d7d;};'use strict';var client=require(_0x014d('0x0'));exports[_0x014d('0x1')]=function(_0x307458){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x307458,'log':'CreateOpenchannelQueueReport'});};exports[_0x014d('0x2')]=function(_0x590106,_0x3f02b8){return client['Request'](_0x014d('0x3'),{'body':_0x3f02b8,'options':{'where':{'uniqueid':_0x590106},'order':[['id','DESC']],'limit':0x1},'log':_0x014d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index bc198b5..2cbc641 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 _0x4853=['updateSmsInteraction','addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x50bcb0,_0x2bd716){var _0x1cf5cb=function(_0x4b6d3b){while(--_0x4b6d3b){_0x50bcb0['push'](_0x50bcb0['shift']());}};_0x1cf5cb(++_0x2bd716);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x3485('0x0')]=function(_0x503fde,_0x45a54b){return client[_0x3485('0x1')](_0x3485('0x2'),{'body':_0x45a54b,'options':{'where':{'id':_0x503fde}},'log':_0x3485('0x3')});};exports[_0x3485('0x4')]=function(_0xd1a964,_0x4ef6c0){return client['Request']('AddTagsToSmsInteraction',{'body':_0x4ef6c0,'options':{'where':{'id':_0xd1a964}},'log':_0x3485('0x5')});}; \ No newline at end of file +var _0xba6c=['AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0xba6c,0x113));var _0xcba6=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xba6c[_0x23c73d];return _0x36ba47;};'use strict';var client=require(_0xcba6('0x0'));exports['update']=function(_0x253b30,_0x1f7f77){return client[_0xcba6('0x1')](_0xcba6('0x2'),{'body':_0x1f7f77,'options':{'where':{'id':_0x253b30}},'log':_0xcba6('0x3')});};exports[_0xcba6('0x4')]=function(_0x2b34a3,_0x5c911d){return client['Request'](_0xcba6('0x5'),{'body':_0x5c911d,'options':{'where':{'id':_0x2b34a3}},'log':_0xcba6('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 18e8f1d..94dc5ab 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 _0x517b=['CreateSmsMessage','../client','create','Request'];(function(_0x52278a,_0x207ce5){var _0x4e86b8=function(_0x25fc88){while(--_0x25fc88){_0x52278a['push'](_0x52278a['shift']());}};_0x4e86b8(++_0x207ce5);}(_0x517b,0x79));var _0xb517=function(_0x113297,_0xe2c43a){_0x113297=_0x113297-0x0;var _0x1a2701=_0x517b[_0x113297];return _0x1a2701;};'use strict';var client=require(_0xb517('0x0'));exports[_0xb517('0x1')]=function(_0x2dcd7c){return client[_0xb517('0x2')](_0xb517('0x3'),{'body':_0x2dcd7c,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x04c2=['createSmsMessage','create'];(function(_0x58e877,_0x73b061){var _0x48be62=function(_0x277124){while(--_0x277124){_0x58e877['push'](_0x58e877['shift']());}};_0x48be62(++_0x73b061);}(_0x04c2,0xdf));var _0x204c=function(_0x5a9a33,_0x295345){_0x5a9a33=_0x5a9a33-0x0;var _0x3d9bf9=_0x04c2[_0x5a9a33];return _0x3d9bf9;};'use strict';var client=require('../client');exports[_0x204c('0x0')]=function(_0x4d098d){return client['Request']('CreateSmsMessage',{'body':_0x4d098d,'log':_0x204c('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index eccf26a..873e32b 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(_0x4fdbf5,_0x358b47){var _0x4076c6=function(_0x368e6b){while(--_0x368e6b){_0x4fdbf5['push'](_0x4fdbf5['shift']());}};_0x4076c6(++_0x358b47);}(_0xe706,0xa3));var _0x6e70=function(_0x37628a,_0x92e3c6){_0x37628a=_0x37628a-0x0;var _0x1cf2bf=_0xe706[_0x37628a];return _0x1cf2bf;};'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 _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2eec6a,_0xb897f5){var _0x231755=function(_0x5401f6){while(--_0x5401f6){_0x2eec6a['push'](_0x2eec6a['shift']());}};_0x231755(++_0xb897f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0xcb91[_0x2351c4];return _0x1dd3f8;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index d1f547b..8af4a78 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0xe2cb02,_0x370da6){var _0x2e4ccb=function(_0xe5fed6){while(--_0xe5fed6){_0xe2cb02['push'](_0xe2cb02['shift']());}};_0x2e4ccb(++_0x370da6);}(_0x55ca,0x126));var _0xa55c=function(_0x224436,_0x13088b){_0x224436=_0x224436-0x0;var _0x3c694a=_0x55ca[_0x224436];return _0x3c694a;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1cb62e,_0x58ea25){var _0x15275c=function(_0x5f055e){while(--_0x5f055e){_0x1cb62e['push'](_0x1cb62e['shift']());}};_0x15275c(++_0x58ea25);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 40e44f4..f15ac5b 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(_0xe3a46,_0x4f9273){var _0x5bb333=function(_0x2eedc5){while(--_0x2eedc5){_0xe3a46['push'](_0xe3a46['shift']());}};_0x5bb333(++_0x4f9273);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x37ad43,_0x1390c0){var _0x6d9068=function(_0x5585b8){while(--_0x5585b8){_0x37ad43['push'](_0x37ad43['shift']());}};_0x6d9068(++_0x1390c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 09f3f55..ec4ea82 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 _0xad5f=['UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x7dfb21,_0x54cbb5){var _0x544f45=function(_0x57d242){while(--_0x57d242){_0x7dfb21['push'](_0x7dfb21['shift']());}};_0x544f45(++_0x54cbb5);}(_0xad5f,0x1a8));var _0xfad5=function(_0x35f677,_0x4cc714){_0x35f677=_0x35f677-0x0;var _0x321dec=_0xad5f[_0x35f677];return _0x321dec;};'use strict';var client=require(_0xfad5('0x0'));exports[_0xfad5('0x1')]=function(_0x43dc84,_0x3bef21){return client[_0xfad5('0x2')](_0xfad5('0x3'),{'body':_0x3bef21,'options':{'where':{'id':_0x43dc84}},'log':'updateWhatsappInteraction'});};exports[_0xfad5('0x4')]=function(_0x316561,_0x1ae06d){return client[_0xfad5('0x2')](_0xfad5('0x5'),{'body':_0x1ae06d,'options':{'where':{'id':_0x316561}},'log':_0xfad5('0x6')});}; \ No newline at end of file +var _0xbc48=['updateWhatsappInteraction','addTags','Request','../client','update','UpdateWhatsappInteraction'];(function(_0x37e307,_0x378e6c){var _0x44a38c=function(_0x278dce){while(--_0x278dce){_0x37e307['push'](_0x37e307['shift']());}};_0x44a38c(++_0x378e6c);}(_0xbc48,0x111));var _0x8bc4=function(_0x2a3746,_0x4a8a46){_0x2a3746=_0x2a3746-0x0;var _0x1d7e9a=_0xbc48[_0x2a3746];return _0x1d7e9a;};'use strict';var client=require(_0x8bc4('0x0'));exports[_0x8bc4('0x1')]=function(_0x220359,_0x445aa4){return client['Request'](_0x8bc4('0x2'),{'body':_0x445aa4,'options':{'where':{'id':_0x220359}},'log':_0x8bc4('0x3')});};exports[_0x8bc4('0x4')]=function(_0x5971fb,_0x5468ea){return client[_0x8bc4('0x5')]('AddTagsToWhatsappInteraction',{'body':_0x5468ea,'options':{'where':{'id':_0x5971fb}},'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 c01f504..e6cf1ca 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 _0xb17c=['create','CreateWhatsappMessage','../client'];(function(_0x375544,_0x2442bc){var _0x349aa1=function(_0x44771d){while(--_0x44771d){_0x375544['push'](_0x375544['shift']());}};_0x349aa1(++_0x2442bc);}(_0xb17c,0x17f));var _0xcb17=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb17c[_0x9fd887];return _0x1a54ab;};'use strict';var client=require(_0xcb17('0x0'));exports[_0xcb17('0x1')]=function(_0x305362){return client['Request'](_0xcb17('0x2'),{'body':_0x305362,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xa6ab=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x3a2ce8,_0x44d9b5){var _0x577ced=function(_0x508d92){while(--_0x508d92){_0x3a2ce8['push'](_0x3a2ce8['shift']());}};_0x577ced(++_0x44d9b5);}(_0xa6ab,0x176));var _0xba6a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa6ab[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xba6a('0x0'));exports[_0xba6a('0x1')]=function(_0x3ce33a){return client['Request'](_0xba6a('0x2'),{'body':_0x3ce33a,'log':_0xba6a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 659b5eb..02acab4 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 _0xa0d6=['Agents','whatsappPause','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','timeout'];(function(_0x19a3bf,_0x1acf91){var _0x38f7a1=function(_0x577174){while(--_0x577174){_0x19a3bf['push'](_0x19a3bf['shift']());}};_0x38f7a1(++_0x1acf91);}(_0xa0d6,0x17b));var _0x6a0d=function(_0x2e81d6,_0x44f353){_0x2e81d6=_0x2e81d6-0x0;var _0x323295=_0xa0d6[_0x2e81d6];return _0x323295;};'use strict';var client=require(_0x6a0d('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x6a0d('0x1')](_0x6a0d('0x2'),{'options':{'raw':![],'attributes':['id',_0x6a0d('0x3'),_0x6a0d('0x4'),'strategy'],'include':[{'model':'User','as':_0x6a0d('0x5'),'attributes':['id',_0x6a0d('0x3'),'online',_0x6a0d('0x6')]}]},'log':_0x6a0d('0x7')});};}; \ No newline at end of file +var _0x2807=['online','getWhatsappQueues','../client','Request','GetWhatsappQueue','name','User','Agents'];(function(_0x20aab4,_0x996bb9){var _0x500721=function(_0x541baa){while(--_0x541baa){_0x20aab4['push'](_0x20aab4['shift']());}};_0x500721(++_0x996bb9);}(_0x2807,0xca));var _0x7280=function(_0x155b44,_0x35789b){_0x155b44=_0x155b44-0x0;var _0x554bae=_0x2807[_0x155b44];return _0x554bae;};'use strict';var client=require(_0x7280('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7280('0x1')](_0x7280('0x2'),{'options':{'raw':![],'attributes':['id',_0x7280('0x3'),'timeout','strategy'],'include':[{'model':_0x7280('0x4'),'as':_0x7280('0x5'),'attributes':['id','name',_0x7280('0x6'),'whatsappPause']}]},'log':_0x7280('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 831f006..5345d17 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 _0xda82=['DESC','UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0xda82,0x1d3));var _0x2da8=function(_0x6d37c7,_0x1ce7d1){_0x6d37c7=_0x6d37c7-0x0;var _0x44f7aa=_0xda82[_0x6d37c7];return _0x44f7aa;};'use strict';var client=require(_0x2da8('0x0'));exports['create']=function(_0x374b1d){return client[_0x2da8('0x1')]('CreateWhatsappQueueReport',{'body':_0x374b1d,'log':_0x2da8('0x2')});};exports['update']=function(_0x3bc5cb,_0x4686e2){return client[_0x2da8('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4686e2,'options':{'where':{'uniqueid':_0x3bc5cb},'order':[['id',_0x2da8('0x3')]],'limit':0x1},'log':_0x2da8('0x4')});}; \ No newline at end of file +var _0xa5b9=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x12159c,_0x291968){var _0x57f947=function(_0x2a92a6){while(--_0x2a92a6){_0x12159c['push'](_0x12159c['shift']());}};_0x57f947(++_0x291968);}(_0xa5b9,0x10c));var _0x9a5b=function(_0x5ecd64,_0x1836c2){_0x5ecd64=_0x5ecd64-0x0;var _0xe30e6=_0xa5b9[_0x5ecd64];return _0xe30e6;};'use strict';var client=require(_0x9a5b('0x0'));exports[_0x9a5b('0x1')]=function(_0x105c85){return client[_0x9a5b('0x2')](_0x9a5b('0x3'),{'body':_0x105c85,'log':_0x9a5b('0x3')});};exports[_0x9a5b('0x4')]=function(_0x39a7e9,_0x19dd98){return client[_0x9a5b('0x2')](_0x9a5b('0x5'),{'body':_0x19dd98,'options':{'where':{'uniqueid':_0x39a7e9},'order':[['id',_0x9a5b('0x6')]],'limit':0x1},'log':_0x9a5b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 9e79e64..736479c 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 _0xc965=['stack','stop','validate','lodash','util','seq-queue','routing','./strategy','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','find','agents','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0x16646f,_0x100c52){var _0x33e585=function(_0x5a4369){while(--_0x5a4369){_0x16646f['push'](_0x16646f['shift']());}};_0x33e585(++_0x100c52);}(_0xc965,0x68));var _0x5c96=function(_0x401b64,_0x5cae66){_0x401b64=_0x401b64-0x0;var _0x139aa0=_0xc965[_0x401b64];return _0x139aa0;};'use strict';var schema=require(_0x5c96('0x0'));var _=require(_0x5c96('0x1'));var util=require(_0x5c96('0x2'));var seqqueue=require(_0x5c96('0x3'));var logger=require('../../../../config/logger')(_0x5c96('0x4'));var strategy=require(_0x5c96('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2e6b99,_0x20d67d,_0x3056af){return logger[_0x5c96('0x6')](util['format'](_0x5c96('0x7'),_0x2e6b99,_0x20d67d[_0x5c96('0x8')],_0x3056af));}function handleFindAgent(_0x489a25){return function(_0x4cca92){return _0x4cca92[_0x5c96('0x8')][_0x5c96('0x9')]()===_0x489a25[_0x5c96('0x9')]();};}exports[_0x5c96('0xa')]=function(_0x12f4d4,_0x504f10,_0x50155f,_0x4a1465){return function(_0x5c38d4){try{var _0x1a1978={'name':_0x504f10[0x0],'timeout':_0x504f10[0x1]};var _0x199aa4=queue[_0x5c96('0x0')](_0x1a1978,{'typecast':!![]});if(_0x199aa4[_0x5c96('0xb')]){logger[_0x5c96('0xc')](_0x5c96('0xd'),_0x12f4d4,_[_0x5c96('0xe')](_0x199aa4,_0x5c96('0xf'))['join'](',\x20'));_0x5c38d4['stop']();}else{var _0x41a767=_[_0x5c96('0x10')](_0x50155f[_0x5c96('0x11')],handleFindAgent(_0x1a1978[_0x5c96('0x8')]));if(_0x41a767){var _0x5027c5=(_0x1a1978[_0x5c96('0x12')]||0xa)*0x3e8;var _0x3a58b1,_0x15c62f;var _0x12d0f6=seqqueue['createQueue'](_0x5027c5);_0x12d0f6['id']=_0x12f4d4;_0x12d0f6[_0x5c96('0x13')]=_0x5027c5;_0x12d0f6[_0x5c96('0x14')]=_0x4a1465[_0x5c96('0x14')];writeLog(_0x12f4d4,_0x41a767,util['format']('START:%s',_0x5027c5));_0x50155f[_0x5c96('0x15')][_0x12f4d4]['on'](_0x5c96('0x16'),function(){logger['info'](_0x5c96('0x17'),_0x12f4d4);clearTimeout(_0x15c62f);_0x15c62f=undefined;_0x12d0f6[_0x5c96('0x18')]();if(_0x50155f[_0x5c96('0x15')][_0x12f4d4]){delete _0x50155f[_0x5c96('0x15')][_0x12f4d4];}_0x5c38d4['stop']();});_0x50155f[_0x5c96('0x15')][_0x12f4d4]['on'](_0x5c96('0x19'),function(){if(_0x50155f['rules'][_0x12f4d4]){delete _0x50155f[_0x5c96('0x15')][_0x12f4d4];}});_0x15c62f=setTimeout(function(){logger['info'](_0x5c96('0x1a'),_0x12f4d4);clearTimeout(_0x15c62f);_0x12d0f6['close']();_0x5c38d4[_0x5c96('0x1b')]();},_0x5027c5);strategy[_0x5c96('0x1c')](_0x12d0f6,_0x41a767,_0x50155f,_0x4a1465);}else{logger[_0x5c96('0xc')](_0x5c96('0x1d'),_0x12f4d4,_0x1a1978[_0x5c96('0x8')]);_0x5c38d4['stop']();}}}catch(_0x170da3){console[_0x5c96('0x1e')](_0x170da3);logger[_0x5c96('0xc')](_0x5c96('0x1f'),_0x12f4d4,_0x170da3[_0x5c96('0x20')]);_0x5c38d4[_0x5c96('0x21')]();}};}; \ No newline at end of file +var _0xccf7=['rules','end','info','complete','[%s][AGENT]\x20ROUTING\x20END','close','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','format','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s'];(function(_0x28b864,_0x9ce452){var _0x1743e7=function(_0x15a56e){while(--_0x15a56e){_0x28b864['push'](_0x28b864['shift']());}};_0x1743e7(++_0x9ce452);}(_0xccf7,0x156));var _0x7ccf=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xccf7[_0x53c4f8];return _0x416458;};'use strict';var schema=require(_0x7ccf('0x0'));var _=require(_0x7ccf('0x1'));var util=require('util');var seqqueue=require(_0x7ccf('0x2'));var logger=require('../../../../config/logger')(_0x7ccf('0x3'));var strategy=require(_0x7ccf('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x7ccf('0x5')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x554c16,_0x5d1026,_0x293986){return logger['info'](util[_0x7ccf('0x6')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x554c16,_0x5d1026[_0x7ccf('0x7')],_0x293986));}function handleFindAgent(_0xa54351){return function(_0x5bc56e){return _0x5bc56e[_0x7ccf('0x7')][_0x7ccf('0x8')]()===_0xa54351[_0x7ccf('0x8')]();};}exports[_0x7ccf('0x9')]=function(_0x55484a,_0x58e6c6,_0x2da898,_0x134730){return function(_0xa0ca8c){try{var _0x1a92ca={'name':_0x58e6c6[0x0],'timeout':_0x58e6c6[0x1]};var _0x2d416f=queue[_0x7ccf('0x0')](_0x1a92ca,{'typecast':!![]});if(_0x2d416f['length']){logger['error'](_0x7ccf('0xa'),_0x55484a,_[_0x7ccf('0xb')](_0x2d416f,_0x7ccf('0xc'))['join'](',\x20'));_0xa0ca8c[_0x7ccf('0xd')]();}else{var _0xee41e3=_[_0x7ccf('0xe')](_0x2da898[_0x7ccf('0xf')],handleFindAgent(_0x1a92ca[_0x7ccf('0x7')]));if(_0xee41e3){var _0x12d79c=(_0x1a92ca[_0x7ccf('0x10')]||0xa)*0x3e8;var _0x1565c4,_0x37084c;var _0x4f5c24=seqqueue[_0x7ccf('0x11')](_0x12d79c);_0x4f5c24['id']=_0x55484a;_0x4f5c24[_0x7ccf('0x12')]=_0x12d79c;_0x4f5c24[_0x7ccf('0x13')]=_0x134730[_0x7ccf('0x13')];writeLog(_0x55484a,_0xee41e3,util[_0x7ccf('0x6')](_0x7ccf('0x14'),_0x12d79c));_0x2da898[_0x7ccf('0x15')][_0x55484a]['on'](_0x7ccf('0x16'),function(){logger[_0x7ccf('0x17')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x55484a);clearTimeout(_0x37084c);_0x37084c=undefined;_0x4f5c24['close']();if(_0x2da898[_0x7ccf('0x15')][_0x55484a]){delete _0x2da898[_0x7ccf('0x15')][_0x55484a];}_0xa0ca8c['stop']();});_0x2da898['rules'][_0x55484a]['on'](_0x7ccf('0x18'),function(){if(_0x2da898['rules'][_0x55484a]){delete _0x2da898[_0x7ccf('0x15')][_0x55484a];}});_0x37084c=setTimeout(function(){logger[_0x7ccf('0x17')](_0x7ccf('0x19'),_0x55484a);clearTimeout(_0x37084c);_0x4f5c24[_0x7ccf('0x1a')]();_0xa0ca8c['next']();},_0x12d79c);strategy[_0x7ccf('0x1b')](_0x4f5c24,_0xee41e3,_0x2da898,_0x134730);}else{logger[_0x7ccf('0x1c')](_0x7ccf('0x1d'),_0x55484a,_0x1a92ca[_0x7ccf('0x7')]);_0xa0ca8c[_0x7ccf('0xd')]();}}}catch(_0x46f528){console[_0x7ccf('0x1e')](_0x46f528);logger[_0x7ccf('0x1c')](_0x7ccf('0x1f'),_0x55484a,_0x46f528[_0x7ccf('0x20')]);_0xa0ca8c['stop']();}};}; \ 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 f54e3bb..4031468 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 _0xc579=['sms','whatsapp','interaction','phone','chat','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','toString','amazonlex','providerName','providerResponse','dialogState','Failed','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc579,0x7c));var _0x9c57=function(_0x3bd11b,_0x5198d0){_0x3bd11b=_0x3bd11b-0x0;var _0xad2985=_0xc579[_0x3bd11b];return _0xad2985;};'use strict';var _=require('lodash');var moment=require(_0x9c57('0x0'));var AWS=require('aws-sdk');var utils=require(_0x9c57('0x1'));var logger=require(_0x9c57('0x2'))(_0x9c57('0x3'));var rpc={'chatMessage':require(_0x9c57('0x4')),'openchannelMessage':require(_0x9c57('0x5')),'mailMessage':require(_0x9c57('0x6')),'smsMessage':require(_0x9c57('0x7')),'faxMessage':require(_0x9c57('0x8')),'whatsappMessage':require(_0x9c57('0x9'))};exports['consequence']=function(_0x3d4475,_0x4e5131){return function(_0x3ead16){try{if(!_[_0x9c57('0xa')](this['interaction'][_0x9c57('0xb')])){logger['info'](_0x9c57('0xc'),_0x3d4475,_0x9c57('0xd'));return _0x3ead16[_0x9c57('0xe')]();}var _0x204fca={'ContactId':this[_0x9c57('0xf')]['id'],'sentAt':moment()[_0x9c57('0x10')](_0x9c57('0x11')),'direction':_0x9c57('0x12')};if(this[_0x9c57('0x13')]===_0x9c57('0x14')||this[_0x9c57('0x13')]===_0x9c57('0x15')){_0x204fca['phone']=this[_0x9c57('0x16')][_0x9c57('0x17')];}var _0x375534=this[_0x9c57('0x13')];if(_0x375534===_0x9c57('0x18')){_0x204fca['ChatWebsiteId']=this[_0x9c57('0x19')]['id'];}else{_0x204fca[_[_0x9c57('0x1a')](_0x375534)+'AccountId']=this[_0x9c57('0x19')]['id'];}_0x204fca[_[_0x9c57('0x1a')](_0x375534)+_0x9c57('0x1b')]=this['interaction']['id'];if(this[_0x9c57('0x16')][_0x9c57('0x1c')]){var _0x41f3c9=_0x4e5131[0x4];if(!_['isEmpty'](_0x41f3c9)){_0x204fca[_0x9c57('0x1d')]=utils[_0x9c57('0x1e')](_0x41f3c9,this);return rpc[_0x375534+_0x9c57('0x1f')]['create'](_0x204fca)[_0x9c57('0x20')](function(_0x339f5a){logger['info'](_0x9c57('0xc'),_0x3d4475,_0x204fca[_0x9c57('0x1d')]);})[_0x9c57('0x21')](function(_0x26e623){logger[_0x9c57('0x22')](_0x9c57('0xc'),_0x3d4475,JSON[_0x9c57('0x23')](_0x26e623));})[_0x9c57('0x24')](function(){logger[_0x9c57('0x25')](_0x9c57('0x26'),_0x3d4475);_0x3ead16[_0x9c57('0x27')]();});}else{logger[_0x9c57('0x25')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3d4475);_0x3ead16[_0x9c57('0x27')]();}}else{var _0x1601b9=this;var _0x52953e=new AWS['LexRuntime']({'accessKeyId':_0x4e5131[0x0],'secretAccessKey':_0x4e5131[0x1],'region':_0x4e5131[0x2]});var _0x25d990={'botAlias':_0x9c57('0x28'),'botName':_0x4e5131[0x3],'inputText':this[_0x9c57('0x29')][_0x9c57('0x1d')],'userId':this[_0x9c57('0x13')]+':'+this[_0x9c57('0x16')]['id'][_0x9c57('0x2a')]()};_0x52953e['postText'](_0x25d990,function(_0x46cb2b,_0x4cadd7){if(_0x46cb2b){logger['error'](_0x9c57('0xc'),_0x3d4475,_0x46cb2b[_0x9c57('0x29')]);_0x3ead16[_0x9c57('0xe')]();}else if(_0x4cadd7&&_0x4cadd7[_0x9c57('0x29')]){_0x1601b9[_0x9c57('0x1d')][_0x9c57('0x2b')]=_0x4cadd7;_0x204fca[_0x9c57('0x1d')]=_0x4cadd7[_0x9c57('0x29')];_0x204fca[_0x9c57('0x2c')]=_0x9c57('0x2b');_0x204fca[_0x9c57('0x2d')]=JSON[_0x9c57('0x23')](_0x4cadd7);return rpc[_0x375534+'Message']['create'](_0x204fca)[_0x9c57('0x20')](function(_0x235cec){logger[_0x9c57('0x25')]('[%s][AMAZONLEX]\x20%s',_0x3d4475,_0x204fca[_0x9c57('0x1d')]);if(_0x4cadd7[_0x9c57('0x2e')]==_0x9c57('0x2f')){_0x3ead16[_0x9c57('0xe')]();}else{_0x3ead16[_0x9c57('0x27')]();}})[_0x9c57('0x21')](function(_0x4c2d10){logger[_0x9c57('0x22')](_0x9c57('0xc'),_0x3d4475,JSON[_0x9c57('0x23')](_0x4c2d10));_0x3ead16['next']();});}else{_0x3ead16[_0x9c57('0xe')]();}});}}catch(_0x193094){logger[_0x9c57('0x22')](_0x9c57('0xc'),_0x3d4475,JSON[_0x9c57('0x23')](_0x193094));_0x3ead16[_0x9c57('0x27')]();}};}; \ No newline at end of file +var _0xd923=['then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create'];(function(_0x27eea5,_0x22417b){var _0x1b55bc=function(_0x336799){while(--_0x336799){_0x27eea5['push'](_0x27eea5['shift']());}};_0x1b55bc(++_0x22417b);}(_0xd923,0x1dd));var _0x3d92=function(_0x568c64,_0x3290d5){_0x568c64=_0x568c64-0x0;var _0x313cfb=_0xd923[_0x568c64];return _0x313cfb;};'use strict';var _=require(_0x3d92('0x0'));var moment=require('moment');var AWS=require(_0x3d92('0x1'));var utils=require(_0x3d92('0x2'));var logger=require('../../../../config/logger')(_0x3d92('0x3'));var rpc={'chatMessage':require(_0x3d92('0x4')),'openchannelMessage':require(_0x3d92('0x5')),'mailMessage':require(_0x3d92('0x6')),'smsMessage':require(_0x3d92('0x7')),'faxMessage':require(_0x3d92('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3d92('0x9')]=function(_0x48b2da,_0x41abcd){return function(_0x7f48aa){try{if(!_[_0x3d92('0xa')](this['interaction'][_0x3d92('0xb')])){logger[_0x3d92('0xc')](_0x3d92('0xd'),_0x48b2da,_0x3d92('0xe'));return _0x7f48aa[_0x3d92('0xf')]();}var _0x2eab90={'ContactId':this[_0x3d92('0x10')]['id'],'sentAt':moment()[_0x3d92('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x3d92('0x12')]==='sms'||this[_0x3d92('0x12')]===_0x3d92('0x13')){_0x2eab90['phone']=this['interaction'][_0x3d92('0x14')];}var _0x23d24b=this[_0x3d92('0x12')];if(_0x23d24b===_0x3d92('0x15')){_0x2eab90[_0x3d92('0x16')]=this['account']['id'];}else{_0x2eab90[_[_0x3d92('0x17')](_0x23d24b)+_0x3d92('0x18')]=this['account']['id'];}_0x2eab90[_[_0x3d92('0x17')](_0x23d24b)+_0x3d92('0x19')]=this[_0x3d92('0x1a')]['id'];if(this[_0x3d92('0x1a')][_0x3d92('0x1b')]){var _0x1240f8=_0x41abcd[0x4];if(!_[_0x3d92('0x1c')](_0x1240f8)){_0x2eab90[_0x3d92('0x1d')]=utils[_0x3d92('0x1e')](_0x1240f8,this);return rpc[_0x23d24b+_0x3d92('0x1f')][_0x3d92('0x20')](_0x2eab90)[_0x3d92('0x21')](function(_0x101479){logger[_0x3d92('0xc')](_0x3d92('0xd'),_0x48b2da,_0x2eab90['body']);})[_0x3d92('0x22')](function(_0x2becce){logger[_0x3d92('0x23')](_0x3d92('0xd'),_0x48b2da,JSON[_0x3d92('0x24')](_0x2becce));})[_0x3d92('0x25')](function(){logger[_0x3d92('0xc')](_0x3d92('0x26'),_0x48b2da);_0x7f48aa[_0x3d92('0x27')]();});}else{logger[_0x3d92('0xc')](_0x3d92('0x28'),_0x48b2da);_0x7f48aa['stop']();}}else{var _0x114697=this;var _0x12470b=new AWS[(_0x3d92('0x29'))]({'accessKeyId':_0x41abcd[0x0],'secretAccessKey':_0x41abcd[0x1],'region':_0x41abcd[0x2]});var _0x5aefa8={'botAlias':_0x3d92('0x2a'),'botName':_0x41abcd[0x3],'inputText':this[_0x3d92('0x2b')][_0x3d92('0x1d')],'userId':this[_0x3d92('0x12')]+':'+this[_0x3d92('0x1a')]['id'][_0x3d92('0x2c')]()};_0x12470b[_0x3d92('0x2d')](_0x5aefa8,function(_0x2142a6,_0x6e24be){if(_0x2142a6){logger[_0x3d92('0x23')]('[%s][AMAZONLEX]\x20%s',_0x48b2da,_0x2142a6['message']);_0x7f48aa[_0x3d92('0xf')]();}else if(_0x6e24be&&_0x6e24be[_0x3d92('0x2b')]){_0x114697['body'][_0x3d92('0x2e')]=_0x6e24be;_0x2eab90[_0x3d92('0x1d')]=_0x6e24be[_0x3d92('0x2b')];_0x2eab90[_0x3d92('0x2f')]=_0x3d92('0x2e');_0x2eab90[_0x3d92('0x30')]=JSON[_0x3d92('0x24')](_0x6e24be);return rpc[_0x23d24b+_0x3d92('0x1f')][_0x3d92('0x20')](_0x2eab90)[_0x3d92('0x21')](function(_0x520e47){logger['info'](_0x3d92('0xd'),_0x48b2da,_0x2eab90[_0x3d92('0x1d')]);if(_0x6e24be[_0x3d92('0x31')]==_0x3d92('0x32')){_0x7f48aa['next']();}else{_0x7f48aa[_0x3d92('0x27')]();}})['catch'](function(_0x395fba){logger['error']('[%s][AMAZONLEX]\x20%s',_0x48b2da,JSON['stringify'](_0x395fba));_0x7f48aa['next']();});}else{_0x7f48aa[_0x3d92('0xf')]();}});}}catch(_0x5a029a){logger[_0x3d92('0x23')](_0x3d92('0xd'),_0x48b2da,JSON['stringify'](_0x5a029a));_0x7f48aa[_0x3d92('0x27')]();}};}; \ 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 3944690..5170152 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 _0x6aa2=['isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','out','channel','mail','getMustacheRender','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','account','smtpOptions','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next'];(function(_0x46138b,_0x3a66d0){var _0x27f78f=function(_0x32a90a){while(--_0x32a90a){_0x46138b['push'](_0x46138b['shift']());}};_0x27f78f(++_0x3a66d0);}(_0x6aa2,0x13e));var _0x26aa=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x6aa2[_0x42e4d7];return _0x346cd8;};'use strict';var _=require(_0x26aa('0x0'));var moment=require('moment');var utils=require(_0x26aa('0x1'));var logger=require(_0x26aa('0x2'))(_0x26aa('0x3'));var rpc={'chatMessage':require(_0x26aa('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x26aa('0x5')),'smsMessage':require(_0x26aa('0x6')),'faxMessage':require(_0x26aa('0x7')),'whatsappMessage':require(_0x26aa('0x8')),'chatInteraction':require(_0x26aa('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x26aa('0xa')),'smsInteraction':require(_0x26aa('0xb')),'faxInteraction':require(_0x26aa('0xc')),'whatsappInteraction':require(_0x26aa('0xd'))};var mailRpc=require(_0x26aa('0xe'));exports[_0x26aa('0xf')]=function(_0xc816c,_0x3e3e16,_0x2a2187,_0x4b8d41){return function(_0x359a93){try{var _0x224adb=this['channel'];if(_0x224adb==='mail'&&_0x4b8d41[_0x26aa('0x10')][_0x26aa('0x11')]){logger[_0x26aa('0x12')](_0x26aa('0x13'),_0xc816c,_0x26aa('0x14'));return _0x359a93[_0x26aa('0x15')]();}if(_0x3e3e16[0x0]==='1'&&(_[_0x26aa('0x16')](this[_0x26aa('0x17')][_0x26aa('0x18')])||!this['interaction'][_0x26aa('0x18')])){logger[_0x26aa('0x12')]('[%s][AUTOREPLY]\x20%s',_0xc816c,_0x26aa('0x19'));return _0x359a93[_0x26aa('0x15')]();}if(_0x3e3e16[0x0]==='2'&&this[_0x26aa('0x17')][_0x26aa('0x1a')]){logger[_0x26aa('0x12')](_0x26aa('0x1b'),_0xc816c,_0x26aa('0x1c'));return _0x359a93[_0x26aa('0x15')]();}var _0x250639={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x26aa('0x1d')};if(this[_0x26aa('0x1e')]===_0x26aa('0x1f')){_0x250639[_0x26aa('0x10')]=utils[_0x26aa('0x20')](_0x3e3e16[0x2],this);}else{_0x250639['body']=utils['getMustacheRender'](_0x3e3e16[0x1],this);}if(this[_0x26aa('0x21')]){_0x250639['to']=this[_0x26aa('0x21')]['from']||'';if(this['channel']===_0x26aa('0x1f')&&_0x3e3e16[0x1]==='1'){_0x250639['cc']=this['message']['cc']||'';}_0x250639[_0x26aa('0x22')]=this[_0x26aa('0x21')]['to']||'';_0x250639[_0x26aa('0x23')]=this[_0x26aa('0x21')][_0x26aa('0x23')]||'';_0x250639['read']=!![];if(this[_0x26aa('0x21')][_0x26aa('0x24')]){_0x250639[_0x26aa('0x24')]='';_0x250639[_0x26aa('0x24')]+=_['startsWith'](this[_0x26aa('0x21')][_0x26aa('0x24')],_0x26aa('0x25'))?'':_0x26aa('0x26');_0x250639[_0x26aa('0x24')]+=this[_0x26aa('0x21')]['subject'];}}if(this[_0x26aa('0x1e')]===_0x26aa('0x27')){_0x250639[_0x26aa('0x28')]=this['account']['id'];}else{_0x250639[_[_0x26aa('0x29')](this[_0x26aa('0x1e')])+_0x26aa('0x2a')]=this['account']['id'];}_0x250639[_['upperFirst'](this[_0x26aa('0x1e')])+'InteractionId']=this[_0x26aa('0x17')]['id'];var _0x584d60=this['interaction'];if(rpc[this[_0x26aa('0x1e')]+_0x26aa('0x2b')]){if(this[_0x26aa('0x1e')]===_0x26aa('0x1f')){_0x250639[_0x26aa('0x2c')]=this[_0x26aa('0x21')][_0x26aa('0x2d')];_0x250639[_0x26aa('0x2e')]=_0x26aa('0x2f')+_[_0x26aa('0x30')](_0x250639[_0x26aa('0x10')],''+_[_0x0b13('0x33')](_0x4c756a[_0x0b13('0x12')],_0x0b13('0x34'),_0x0b13('0x35'))+'';_0x4c756a[_0x0b13('0x36')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x0b13('0x37')};return mailRpc[_0x0b13('0x38')](this[_0x0b13('0x2c')][_0x0b13('0x39')],_0x4c756a)[_0x0b13('0x3a')](function(_0x4b43c5){logger[_0x0b13('0x14')](_0x0b13('0x3b'),_0x5c6c6c);_0x4c756a[_0x0b13('0x3c')]=_0x4b43c5[_0x0b13('0x23')][_0x0b13('0x3c')];return rpc[_0x1e1d84+'Message']['create'](_0x4c756a);})[_0x0b13('0x3a')](function(_0x27b675){logger['info'](_0x0b13('0x15'),_0x5c6c6c,JSON['stringify'](_0x27b675));})[_0x0b13('0x3d')](function(_0x11e43f){logger[_0x0b13('0x3e')](_0x0b13('0x3f'),_0x5c6c6c,JSON['stringify'](_0x11e43f));})['finally'](function(){Promise[_0x0b13('0x40')]()[_0x0b13('0x3a')](function(){if(_0x2fc63d[0x0]!=='2'||_0x3d8340['autoreplyExecuted'])return;return rpc[_0x1e1d84+_0x0b13('0x41')]['update'](_0x3d8340['id'],{'autoreplyExecuted':!![]})[_0x0b13('0x3a')](function(_0x40d22a){logger[_0x0b13('0x14')](_0x0b13('0x1d'),_0x5c6c6c,JSON['stringify'](_0x40d22a));})[_0x0b13('0x3d')](function(_0x2012c9){logger[_0x0b13('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5c6c6c,JSON['stringify'](_0x2012c9));});})[_0x0b13('0x3a')](function(){_0x1a14db[_0x0b13('0x17')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x4c756a)[_0x0b13('0x3a')](function(){logger['info'](_0x0b13('0x15'),_0x5c6c6c,_0x4c756a[_0x0b13('0x12')]);})[_0x0b13('0x3d')](function(_0x56b568){logger[_0x0b13('0x3e')](_0x0b13('0x15'),_0x5c6c6c,JSON[_0x0b13('0x42')](_0x56b568));})['finally'](function(){Promise[_0x0b13('0x40')]()[_0x0b13('0x3a')](function(){if(_0x2fc63d[0x0]!=='2'||_0x3d8340['autoreplyExecuted'])return;return rpc[_0x1e1d84+_0x0b13('0x41')][_0x0b13('0x43')](_0x3d8340['id'],{'autoreplyExecuted':!![]})[_0x0b13('0x3a')](function(_0x51e33f){logger[_0x0b13('0x14')](_0x0b13('0x1d'),_0x5c6c6c,JSON[_0x0b13('0x42')](_0x51e33f));})[_0x0b13('0x3d')](function(_0x89d003){logger[_0x0b13('0x3e')](_0x0b13('0x44'),_0x5c6c6c,JSON['stringify'](_0x89d003));});})[_0x0b13('0x3a')](function(){_0x1a14db[_0x0b13('0x17')]();});});}}}catch(_0x3c9ea6){logger[_0x0b13('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x5c6c6c,JSON[_0x0b13('0x42')](_0x3c9ea6));_0x1a14db['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 f29b9ea..77d23a1 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 _0x89ee=['then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','finally','stop','error','[%s][CLOSE]\x20%s','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','interaction'];(function(_0x2bc1fe,_0x45da98){var _0x1a47a5=function(_0x2e5053){while(--_0x2e5053){_0x2bc1fe['push'](_0x2bc1fe['shift']());}};_0x1a47a5(++_0x45da98);}(_0x89ee,0x75));var _0xe89e=function(_0x598b5f,_0x273e4f){_0x598b5f=_0x598b5f-0x0;var _0x33acbf=_0x89ee[_0x598b5f];return _0x33acbf;};'use strict';var moment=require(_0xe89e('0x0'));var logger=require(_0xe89e('0x1'))(_0xe89e('0x2'));var rpc={'chatInteraction':require(_0xe89e('0x3')),'openchannelInteraction':require(_0xe89e('0x4')),'smsInteraction':require(_0xe89e('0x5')),'mailInteraction':require(_0xe89e('0x6')),'faxInteraction':require(_0xe89e('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x5c070d,_0xb18a67,_0x579777,_0x19be56){return function(_0x2a5cd8){try{logger[_0xe89e('0x8')](_0xe89e('0x9'),_0x5c070d,_0xb18a67[0x0]);var _0x140730={'closed':0x1,'closedAt':moment()['format'](_0xe89e('0xa')),'closeReason':_0xe89e('0xb'),'disposition':_0xb18a67[0x0]};if(rpc[_0x19be56['channel']+_0xe89e('0xc')]){rpc[_0x19be56['channel']+_0xe89e('0xc')][_0xe89e('0xd')](_0x19be56[_0xe89e('0xe')]['id'],_0x140730)[_0xe89e('0xf')](function(_0x2e6cf5){logger[_0xe89e('0x8')](_0xe89e('0x10'),_0x5c070d,_0x19be56[_0xe89e('0xe')]['id']);})['catch'](function(_0x343b61){logger['error']('[%s][CLOSE]\x20%s',_0x5c070d,JSON['stringify'](_0x343b61));})[_0xe89e('0x11')](function(){_0x2a5cd8[_0xe89e('0x12')]();});}}catch(_0xe8d200){logger[_0xe89e('0x13')](_0xe89e('0x14'),_0x5c070d,JSON[_0xe89e('0x15')](_0xe8d200));_0x2a5cd8[_0xe89e('0x12')]();}};}; \ No newline at end of file +var _0x47c6=['stop','moment','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','[%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'];(function(_0x4ae6de,_0x31652f){var _0x267c26=function(_0x31cde2){while(--_0x31cde2){_0x4ae6de['push'](_0x4ae6de['shift']());}};_0x267c26(++_0x31652f);}(_0x47c6,0xf3));var _0x647c=function(_0x3a2e8c,_0x4001d3){_0x3a2e8c=_0x3a2e8c-0x0;var _0x588177=_0x47c6[_0x3a2e8c];return _0x588177;};'use strict';var moment=require(_0x647c('0x0'));var logger=require('../../../../config/logger')(_0x647c('0x1'));var rpc={'chatInteraction':require(_0x647c('0x2')),'openchannelInteraction':require(_0x647c('0x3')),'smsInteraction':require(_0x647c('0x4')),'mailInteraction':require(_0x647c('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x647c('0x6'))};exports[_0x647c('0x7')]=function(_0x3d0184,_0x4a9922,_0xacd29b,_0x57aeff){return function(_0x104e18){try{logger['info'](_0x647c('0x8'),_0x3d0184,_0x4a9922[0x0]);var _0xa3c7ed={'closed':0x1,'closedAt':moment()[_0x647c('0x9')](_0x647c('0xa')),'closeReason':_0x647c('0xb'),'disposition':_0x4a9922[0x0]};if(rpc[_0x57aeff[_0x647c('0xc')]+_0x647c('0xd')]){rpc[_0x57aeff['channel']+'Interaction'][_0x647c('0xe')](_0x57aeff[_0x647c('0xf')]['id'],_0xa3c7ed)[_0x647c('0x10')](function(_0x4a49b7){logger['info'](_0x647c('0x11'),_0x3d0184,_0x57aeff[_0x647c('0xf')]['id']);})['catch'](function(_0x182701){logger[_0x647c('0x12')](_0x647c('0x13'),_0x3d0184,JSON[_0x647c('0x14')](_0x182701));})['finally'](function(){_0x104e18[_0x647c('0x15')]();});}}catch(_0x15c9d2){logger[_0x647c('0x12')](_0x647c('0x13'),_0x3d0184,JSON[_0x647c('0x14')](_0x15c9d2));_0x104e18['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 0456e18..4789b19 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 _0x0755=['upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','info','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','then','dialogflow','fulfillment','speech','providerResponse','stringify','result','metadata','endConversation','stop','error','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','chat','ChatWebsiteId','account'];(function(_0x62153a,_0x5bfc1f){var _0x2c43ad=function(_0x121473){while(--_0x121473){_0x62153a['push'](_0x62153a['shift']());}};_0x2c43ad(++_0x5bfc1f);}(_0x0755,0x7c));var _0x5075=function(_0x521b5e,_0x28e147){_0x521b5e=_0x521b5e-0x0;var _0x2b9ded=_0x0755[_0x521b5e];return _0x2b9ded;};'use strict';var _=require(_0x5075('0x0'));var moment=require(_0x5075('0x1'));var apiai=require(_0x5075('0x2'));var md5=require(_0x5075('0x3'));var utils=require(_0x5075('0x4'));var logger=require(_0x5075('0x5'))(_0x5075('0x6'));var rpc={'chatMessage':require(_0x5075('0x7')),'openchannelMessage':require(_0x5075('0x8')),'mailMessage':require(_0x5075('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x5075('0xa')),'whatsappMessage':require(_0x5075('0xb'))};exports[_0x5075('0xc')]=function(_0x2e39f4,_0x57f9e8){return function(_0x52bb37){try{if(!_['isNil'](this[_0x5075('0xd')][_0x5075('0xe')])){logger['info'](_0x5075('0xf'),_0x2e39f4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x52bb37['next']();}var _0x2c0979={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x5075('0x10')),'direction':_0x5075('0x11')};if(this[_0x5075('0x12')]==='sms'||this[_0x5075('0x12')]==='whatsapp'){_0x2c0979[_0x5075('0x13')]=this[_0x5075('0xd')][_0x5075('0x13')];}var _0x2591a2=this[_0x5075('0x12')];if(_0x2591a2===_0x5075('0x14')){_0x2c0979[_0x5075('0x15')]=this[_0x5075('0x16')]['id'];}else{_0x2c0979[_[_0x5075('0x17')](_0x2591a2)+_0x5075('0x18')]=this[_0x5075('0x16')]['id'];}_0x2c0979[_[_0x5075('0x17')](_0x2591a2)+_0x5075('0x19')]=this['interaction']['id'];if(this[_0x5075('0xd')][_0x5075('0x1a')]){var _0xc0c5ab=_0x57f9e8[0x2];if(!_[_0x5075('0x1b')](_0xc0c5ab)){_0x2c0979[_0x5075('0x1c')]=utils['getMustacheRender'](_0xc0c5ab,this);return rpc[_0x2591a2+_0x5075('0x1d')][_0x5075('0x1e')](_0x2c0979)['then'](function(_0x2159a8){logger[_0x5075('0x1f')](_0x5075('0xf'),_0x2e39f4,_0x2c0979[_0x5075('0x1c')]);})['catch'](function(_0x42c76d){logger['error'](_0x5075('0xf'),_0x2e39f4,JSON['stringify'](_0x42c76d));})[_0x5075('0x20')](function(){logger['info'](_0x5075('0x21'),_0x2e39f4);_0x52bb37['stop']();});}else{logger[_0x5075('0x1f')](_0x5075('0x22'),_0x2e39f4);_0x52bb37['stop']();}}else{var _0x530244=this;var _0x510d4e=apiai(_0x57f9e8[0x0],{'language':_0x57f9e8[0x1]||'en'});return _0x510d4e[_0x5075('0x23')](this[_0x5075('0x24')][_0x5075('0x1c')],{'sessionId':md5(this[_0x5075('0xd')]['id'])})[_0x5075('0x25')](function(_0x4e2c16){_0x530244[_0x5075('0x1c')][_0x5075('0x26')]=_0x4e2c16;_0x2c0979[_0x5075('0x1c')]=_0x4e2c16['result'][_0x5075('0x27')][_0x5075('0x28')];_0x2c0979['providerName']=_0x5075('0x26');_0x2c0979[_0x5075('0x29')]=JSON[_0x5075('0x2a')](_0x4e2c16);return rpc[_0x2591a2+_0x5075('0x1d')]['create'](_0x2c0979)['then'](function(_0x58063c){logger[_0x5075('0x1f')](_0x5075('0xf'),_0x2e39f4,_0x2c0979['body']);if(_0x4e2c16[_0x5075('0x2b')][_0x5075('0x2c')][_0x5075('0x2d')]){_0x52bb37['next']();}else{_0x52bb37[_0x5075('0x2e')]();}})['catch'](function(_0x5d3a5c){logger[_0x5075('0x2f')](_0x5075('0xf'),_0x2e39f4,JSON[_0x5075('0x2a')](_0x5d3a5c));_0x52bb37[_0x5075('0x30')]();});})['catch'](function(_0x362711){logger[_0x5075('0x2f')](_0x5075('0xf'),_0x2e39f4,_0x362711['message']);_0x52bb37[_0x5075('0x30')]();});}}catch(_0x401d25){logger[_0x5075('0x2f')](_0x5075('0xf'),_0x2e39f4,JSON['stringify'](_0x401d25));_0x52bb37[_0x5075('0x2e')]();}};}; \ No newline at end of file +var _0x229c=['result','fulfillment','speech','providerName','dialogflow','providerResponse','create','metadata','endConversation','next','error','moment','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','info','[%s][DIALOGFLOW]\x20%s','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message'];(function(_0x412b2a,_0x11fb8a){var _0x5872e3=function(_0x202191){while(--_0x202191){_0x412b2a['push'](_0x412b2a['shift']());}};_0x5872e3(++_0x11fb8a);}(_0x229c,0xcf));var _0xc229=function(_0x5101ff,_0x5da36a){_0x5101ff=_0x5101ff-0x0;var _0x2bfe6c=_0x229c[_0x5101ff];return _0x2bfe6c;};'use strict';var _=require('lodash');var moment=require(_0xc229('0x0'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0xc229('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xc229('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc229('0x3')),'smsMessage':require(_0xc229('0x4')),'faxMessage':require(_0xc229('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc229('0x6')]=function(_0x52978a,_0x41ede5){return function(_0x14cd26){try{if(!_['isNil'](this[_0xc229('0x7')][_0xc229('0x8')])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x52978a,_0xc229('0x9'));return _0x14cd26['next']();}var _0x4abe4c={'ContactId':this[_0xc229('0xa')]['id'],'sentAt':moment()[_0xc229('0xb')](_0xc229('0xc')),'direction':_0xc229('0xd')};if(this[_0xc229('0xe')]===_0xc229('0xf')||this[_0xc229('0xe')]===_0xc229('0x10')){_0x4abe4c[_0xc229('0x11')]=this[_0xc229('0x7')][_0xc229('0x11')];}var _0x3f4ebf=this[_0xc229('0xe')];if(_0x3f4ebf==='chat'){_0x4abe4c[_0xc229('0x12')]=this['account']['id'];}else{_0x4abe4c[_[_0xc229('0x13')](_0x3f4ebf)+_0xc229('0x14')]=this[_0xc229('0x15')]['id'];}_0x4abe4c[_[_0xc229('0x13')](_0x3f4ebf)+_0xc229('0x16')]=this[_0xc229('0x7')]['id'];if(this[_0xc229('0x7')][_0xc229('0x17')]){var _0x569bdd=_0x41ede5[0x2];if(!_[_0xc229('0x18')](_0x569bdd)){_0x4abe4c[_0xc229('0x19')]=utils[_0xc229('0x1a')](_0x569bdd,this);return rpc[_0x3f4ebf+_0xc229('0x1b')]['create'](_0x4abe4c)[_0xc229('0x1c')](function(_0x10339a){logger[_0xc229('0x1d')](_0xc229('0x1e'),_0x52978a,_0x4abe4c[_0xc229('0x19')]);})[_0xc229('0x1f')](function(_0x119e07){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x52978a,JSON[_0xc229('0x20')](_0x119e07));})['finally'](function(){logger[_0xc229('0x1d')](_0xc229('0x21'),_0x52978a);_0x14cd26['stop']();});}else{logger['info'](_0xc229('0x22'),_0x52978a);_0x14cd26[_0xc229('0x23')]();}}else{var _0x3a9957=this;var _0x3b20af=apiai(_0x41ede5[0x0],{'language':_0x41ede5[0x1]||'en'});return _0x3b20af[_0xc229('0x24')](this[_0xc229('0x25')][_0xc229('0x19')],{'sessionId':md5(this['interaction']['id'])})['then'](function(_0x8c4f83){_0x3a9957[_0xc229('0x19')]['dialogflow']=_0x8c4f83;_0x4abe4c['body']=_0x8c4f83[_0xc229('0x26')][_0xc229('0x27')][_0xc229('0x28')];_0x4abe4c[_0xc229('0x29')]=_0xc229('0x2a');_0x4abe4c[_0xc229('0x2b')]=JSON['stringify'](_0x8c4f83);return rpc[_0x3f4ebf+_0xc229('0x1b')][_0xc229('0x2c')](_0x4abe4c)[_0xc229('0x1c')](function(_0x537033){logger['info'](_0xc229('0x1e'),_0x52978a,_0x4abe4c['body']);if(_0x8c4f83[_0xc229('0x26')][_0xc229('0x2d')][_0xc229('0x2e')]){_0x14cd26[_0xc229('0x2f')]();}else{_0x14cd26[_0xc229('0x23')]();}})[_0xc229('0x1f')](function(_0x1928b8){logger[_0xc229('0x30')](_0xc229('0x1e'),_0x52978a,JSON[_0xc229('0x20')](_0x1928b8));_0x14cd26[_0xc229('0x2f')]();});})[_0xc229('0x1f')](function(_0x4192d0){logger[_0xc229('0x30')](_0xc229('0x1e'),_0x52978a,_0x4192d0[_0xc229('0x25')]);_0x14cd26[_0xc229('0x2f')]();});}}catch(_0x313660){logger[_0xc229('0x30')](_0xc229('0x1e'),_0x52978a,JSON[_0xc229('0x20')](_0x313660));_0x14cd26['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 07ed341..d33980d 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 _0x81ef=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','ChatWebsiteId','upperFirst','AccountId','account','interaction','created','isEmpty','getMustacheRender','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','message','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x81ef,0xc3));var _0xf81e=function(_0x4a706c,_0x26d3e7){_0x4a706c=_0x4a706c-0x0;var _0x29fe66=_0x81ef[_0x4a706c];return _0x29fe66;};'use strict';var _=require(_0xf81e('0x0'));var dialogflow=require(_0xf81e('0x1'));var md5=require(_0xf81e('0x2'));var moment=require(_0xf81e('0x3'));var Promise=require(_0xf81e('0x4'));var logger=require(_0xf81e('0x5'))(_0xf81e('0x6'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf81e('0x7')),'mailMessage':require(_0xf81e('0x8')),'smsMessage':require(_0xf81e('0x9')),'faxMessage':require(_0xf81e('0xa')),'whatsappMessage':require(_0xf81e('0xb'))};function createMessage(_0x1f9930,_0x17c100,_0x168545,_0x1f0642){return new Promise(function(_0x4aee6f,_0xb3e980){var _0x4bbf8b=_[_0xf81e('0xc')](_0x168545);_0x4bbf8b[_0xf81e('0xd')]=_0x1f0642;return rpc[_0x17c100+'Message'][_0xf81e('0xe')](_0x4bbf8b)[_0xf81e('0xf')](function(){logger[_0xf81e('0x10')](_0xf81e('0x11'),_0x1f9930,_0x4bbf8b[_0xf81e('0xd')]);_0x4aee6f();})[_0xf81e('0x12')](function(_0x48748e){logger[_0xf81e('0x13')](_0xf81e('0x11'),_0x1f9930,JSON[_0xf81e('0x14')](_0x48748e));_0xb3e980(_0x48748e);});});}exports[_0xf81e('0x15')]=function(_0x379952,_0xa5e0){return function(_0x13ff76){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info'](_0xf81e('0x11'),_0x379952,_0xf81e('0x16'));return _0x13ff76[_0xf81e('0x17')]();}var _0x59bd8c={'ContactId':this[_0xf81e('0x18')]['id'],'sentAt':moment()[_0xf81e('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf81e('0x1a')};if(this[_0xf81e('0x1b')]===_0xf81e('0x1c')||this[_0xf81e('0x1b')]==='whatsapp'){_0x59bd8c[_0xf81e('0x1d')]=this['interaction'][_0xf81e('0x1d')];}var _0x4cf3eb=this[_0xf81e('0x1b')];if(_0x4cf3eb==='chat'){_0x59bd8c[_0xf81e('0x1e')]=this['account']['id'];}else{_0x59bd8c[_[_0xf81e('0x1f')](_0x4cf3eb)+_0xf81e('0x20')]=this[_0xf81e('0x21')]['id'];}_0x59bd8c[_[_0xf81e('0x1f')](_0x4cf3eb)+'InteractionId']=this[_0xf81e('0x22')]['id'];if(this['interaction'][_0xf81e('0x23')]){var _0x3a012c=_0xa5e0[0x4];if(!_[_0xf81e('0x24')](_0x3a012c)){_0x59bd8c[_0xf81e('0xd')]=utils[_0xf81e('0x25')](_0x3a012c,this);return rpc[_0x4cf3eb+'Message'][_0xf81e('0xe')](_0x59bd8c)[_0xf81e('0xf')](function(_0x54e769){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x379952,_0x59bd8c['body']);})[_0xf81e('0x12')](function(_0x2d365b){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x379952,JSON['stringify'](_0x2d365b));})['finally'](function(){logger[_0xf81e('0x10')](_0xf81e('0x26'),_0x379952);_0x13ff76['stop']();});}else{logger[_0xf81e('0x10')](_0xf81e('0x27'),_0x379952);_0x13ff76[_0xf81e('0x28')]();}}else{var _0x19eeb4=this;var _0x5d4065=_0xa5e0[0x2][_0xf81e('0x29')](/\\n/g,'\x0a');var _0x101ae1={'credentials':{'private_key':_0x5d4065,'client_email':_0xa5e0[0x1]}};var _0x7fa6a9=new dialogflow[(_0xf81e('0x2a'))](_0x101ae1);var _0x4354af=_0x7fa6a9['sessionPath'](_0xa5e0[0x0],md5(_0x19eeb4[_0xf81e('0x22')]['id']));var _0x12178e={'session':_0x4354af,'queryInput':{'text':{'text':_0x19eeb4[_0xf81e('0x2b')][_0xf81e('0xd')],'languageCode':_0xa5e0[0x3]||'en'}}};return _0x7fa6a9['detectIntent'](_0x12178e)[_0xf81e('0xf')](function(_0x4684bd){if(_0x4684bd&&_0x4684bd['length']){_0x19eeb4[_0xf81e('0xd')]['dialogflowV2']=_0x4684bd;var _0x29f275=_0x4684bd[0x0];var _0x17ea8c=_0x29f275['queryResult'][_0xf81e('0x2c')]&&_0x29f275[_0xf81e('0x2d')][_0xf81e('0x2c')]['fields']?_0x29f275[_0xf81e('0x2d')]['diagnosticInfo'][_0xf81e('0x2e')][_0xf81e('0x2f')]['boolValue']:![];_0x19eeb4[_0xf81e('0xd')][_0xf81e('0x30')]=_0x29f275[_0xf81e('0x2d')]['action'];_0x19eeb4[_0xf81e('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x29f275['queryResult'][_0xf81e('0x31')];_0x19eeb4[_0xf81e('0xd')][_0xf81e('0x32')]=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x2c')]&&_0x29f275[_0xf81e('0x2d')][_0xf81e('0x2c')]['fields']?_0x29f275['queryResult'][_0xf81e('0x2c')]['fields'][_0xf81e('0x2f')][_0xf81e('0x33')]:![];_0x19eeb4[_0xf81e('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x34')]['name'];_0x19eeb4[_0xf81e('0xd')][_0xf81e('0x35')]=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x34')]['displayName'];_0x19eeb4[_0xf81e('0xd')][_0xf81e('0x36')]=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x34')][_0xf81e('0x37')];_0x19eeb4['body'][_0xf81e('0x38')]=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x39')];_0x19eeb4[_0xf81e('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x3a')];_0x19eeb4[_0xf81e('0xd')][_0xf81e('0x3b')]=_0x29f275[_0xf81e('0x2d')][_0xf81e('0x3c')];_0x59bd8c[_0xf81e('0x3d')]=_0xf81e('0x3e');_0x59bd8c[_0xf81e('0x3f')]=JSON[_0xf81e('0x14')](_0x4684bd);var _0x548608=[];for(var _0x470369=0x0;_0x470369<_0x4684bd[_0xf81e('0x40')];_0x470369++){var _0x43af17=_0x4684bd[_0x470369];if(_0x43af17&&_0x43af17[_0xf81e('0x2d')]&&_0x43af17[_0xf81e('0x2d')][_0xf81e('0x41')]){_0x548608[_0xf81e('0x42')](createMessage(_0x379952,_0x4cf3eb,_0x59bd8c,_0x43af17[_0xf81e('0x2d')]['fulfillmentText']));}}return Promise[_0xf81e('0x43')](_0x548608)[_0xf81e('0xf')](function(){if(_0x17ea8c){_0x13ff76[_0xf81e('0x17')]();}else{_0x13ff76[_0xf81e('0x28')]();}})[_0xf81e('0x12')](function(_0x36d4ae){logger[_0xf81e('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x379952,JSON['stringify'](_0x36d4ae));_0x13ff76[_0xf81e('0x17')]();});}})[_0xf81e('0x12')](function(_0x239a93){logger[_0xf81e('0x13')](_0xf81e('0x11'),_0x379952,_0x239a93[_0xf81e('0x2b')]);_0x13ff76[_0xf81e('0x17')]();});}}catch(_0x3cb20e){logger[_0xf81e('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x379952,JSON['stringify'](_0x3cb20e));_0x13ff76[_0xf81e('0x28')]();}};}; \ No newline at end of file +var _0x0a9f=['sms','channel','whatsapp','phone','chat','account','upperFirst','AccountId','isEmpty','Message','then','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','length','dialogflowV2','queryResult','diagnosticInfo','fields','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','queryText','DIALOGFLOWV2_SCORE','fulfillmentText','push','all','next','message','dialogflow','md5','../../../../config/logger','./utils','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x0a9f,0x64));var _0xf0a9=function(_0x4d82e4,_0x3cf5be){_0x4d82e4=_0x4d82e4-0x0;var _0x3a3c8b=_0x0a9f[_0x4d82e4];return _0x3a3c8b;};'use strict';var _=require('lodash');var dialogflow=require(_0xf0a9('0x0'));var md5=require(_0xf0a9('0x1'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xf0a9('0x2'))('routing');var utils=require(_0xf0a9('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf0a9('0x4')),'whatsappMessage':require(_0xf0a9('0x5'))};function createMessage(_0x4e9fa6,_0x63889e,_0x4d14e0,_0x798586){return new Promise(function(_0x399cf8,_0x5f02ce){var _0x2eb01b=_[_0xf0a9('0x6')](_0x4d14e0);_0x2eb01b[_0xf0a9('0x7')]=_0x798586;return rpc[_0x63889e+'Message'][_0xf0a9('0x8')](_0x2eb01b)['then'](function(){logger[_0xf0a9('0x9')](_0xf0a9('0xa'),_0x4e9fa6,_0x2eb01b[_0xf0a9('0x7')]);_0x399cf8();})[_0xf0a9('0xb')](function(_0x4ecd0c){logger[_0xf0a9('0xc')](_0xf0a9('0xa'),_0x4e9fa6,JSON[_0xf0a9('0xd')](_0x4ecd0c));_0x5f02ce(_0x4ecd0c);});});}exports[_0xf0a9('0xe')]=function(_0x4c8877,_0x53f7bf){return function(_0x1f0d77){try{if(!_[_0xf0a9('0xf')](this[_0xf0a9('0x10')][_0xf0a9('0x11')])){logger[_0xf0a9('0x9')](_0xf0a9('0xa'),_0x4c8877,_0xf0a9('0x12'));return _0x1f0d77['next']();}var _0x18e6ce={'ContactId':this[_0xf0a9('0x13')]['id'],'sentAt':moment()[_0xf0a9('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf0a9('0x15')};if(this['channel']===_0xf0a9('0x16')||this[_0xf0a9('0x17')]===_0xf0a9('0x18')){_0x18e6ce[_0xf0a9('0x19')]=this[_0xf0a9('0x10')][_0xf0a9('0x19')];}var _0x1c4309=this[_0xf0a9('0x17')];if(_0x1c4309===_0xf0a9('0x1a')){_0x18e6ce['ChatWebsiteId']=this[_0xf0a9('0x1b')]['id'];}else{_0x18e6ce[_[_0xf0a9('0x1c')](_0x1c4309)+_0xf0a9('0x1d')]=this['account']['id'];}_0x18e6ce[_[_0xf0a9('0x1c')](_0x1c4309)+'InteractionId']=this[_0xf0a9('0x10')]['id'];if(this[_0xf0a9('0x10')]['created']){var _0x3a78f0=_0x53f7bf[0x4];if(!_[_0xf0a9('0x1e')](_0x3a78f0)){_0x18e6ce[_0xf0a9('0x7')]=utils['getMustacheRender'](_0x3a78f0,this);return rpc[_0x1c4309+_0xf0a9('0x1f')][_0xf0a9('0x8')](_0x18e6ce)[_0xf0a9('0x20')](function(_0x453307){logger[_0xf0a9('0x9')](_0xf0a9('0xa'),_0x4c8877,_0x18e6ce[_0xf0a9('0x7')]);})['catch'](function(_0x4fa02a){logger['error'](_0xf0a9('0xa'),_0x4c8877,JSON[_0xf0a9('0xd')](_0x4fa02a));})[_0xf0a9('0x21')](function(){logger['info'](_0xf0a9('0x22'),_0x4c8877);_0x1f0d77[_0xf0a9('0x23')]();});}else{logger[_0xf0a9('0x9')](_0xf0a9('0x24'),_0x4c8877);_0x1f0d77[_0xf0a9('0x23')]();}}else{var _0x215fcd=this;var _0x58e304=_0x53f7bf[0x2][_0xf0a9('0x25')](/\\n/g,'\x0a');var _0x2f6318={'credentials':{'private_key':_0x58e304,'client_email':_0x53f7bf[0x1]}};var _0x1ab18d=new dialogflow[(_0xf0a9('0x26'))](_0x2f6318);var _0x153a4e=_0x1ab18d['sessionPath'](_0x53f7bf[0x0],md5(_0x215fcd[_0xf0a9('0x10')]['id']));var _0x583427={'session':_0x153a4e,'queryInput':{'text':{'text':_0x215fcd['message']['body'],'languageCode':_0x53f7bf[0x3]||'en'}}};return _0x1ab18d['detectIntent'](_0x583427)[_0xf0a9('0x20')](function(_0xc9ee35){if(_0xc9ee35&&_0xc9ee35[_0xf0a9('0x27')]){_0x215fcd['body'][_0xf0a9('0x28')]=_0xc9ee35;var _0x5507a3=_0xc9ee35[0x0];var _0x46fdcd=_0x5507a3[_0xf0a9('0x29')]['diagnosticInfo']&&_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x2a')][_0xf0a9('0x2b')]?_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x2a')][_0xf0a9('0x2b')]['end_conversation']['boolValue']:![];_0x215fcd['body']['DIALOGFLOWV2_ACTION']=_0x5507a3[_0xf0a9('0x29')]['action'];_0x215fcd[_0xf0a9('0x7')][_0xf0a9('0x2c')]=_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x2d')];_0x215fcd[_0xf0a9('0x7')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x2a')]&&_0x5507a3[_0xf0a9('0x29')]['diagnosticInfo'][_0xf0a9('0x2b')]?_0x5507a3['queryResult'][_0xf0a9('0x2a')][_0xf0a9('0x2b')][_0xf0a9('0x2e')][_0xf0a9('0x2f')]:![];_0x215fcd[_0xf0a9('0x7')][_0xf0a9('0x30')]=_0x5507a3['queryResult'][_0xf0a9('0x31')]['name'];_0x215fcd[_0xf0a9('0x7')][_0xf0a9('0x32')]=_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x31')][_0xf0a9('0x33')];_0x215fcd[_0xf0a9('0x7')][_0xf0a9('0x34')]=_0x5507a3[_0xf0a9('0x29')]['intent']['isFallback'];_0x215fcd[_0xf0a9('0x7')]['DIALOGFLOWV2_LANGUAGECODE']=_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x35')];_0x215fcd[_0xf0a9('0x7')]['DIALOGFLOWV2_QUERYTEXT']=_0x5507a3[_0xf0a9('0x29')][_0xf0a9('0x36')];_0x215fcd[_0xf0a9('0x7')][_0xf0a9('0x37')]=_0x5507a3[_0xf0a9('0x29')]['intentDetectionConfidence'];_0x18e6ce['providerName']=_0xf0a9('0x28');_0x18e6ce['providerResponse']=JSON[_0xf0a9('0xd')](_0xc9ee35);var _0x9cd51c=[];for(var _0x1f4f4a=0x0;_0x1f4f4a<_0xc9ee35[_0xf0a9('0x27')];_0x1f4f4a++){var _0x47d097=_0xc9ee35[_0x1f4f4a];if(_0x47d097&&_0x47d097[_0xf0a9('0x29')]&&_0x47d097[_0xf0a9('0x29')][_0xf0a9('0x38')]){_0x9cd51c[_0xf0a9('0x39')](createMessage(_0x4c8877,_0x1c4309,_0x18e6ce,_0x47d097[_0xf0a9('0x29')][_0xf0a9('0x38')]));}}return Promise[_0xf0a9('0x3a')](_0x9cd51c)[_0xf0a9('0x20')](function(){if(_0x46fdcd){_0x1f0d77[_0xf0a9('0x3b')]();}else{_0x1f0d77[_0xf0a9('0x23')]();}})['catch'](function(_0x4d0f69){logger['error'](_0xf0a9('0xa'),_0x4c8877,JSON[_0xf0a9('0xd')](_0x4d0f69));_0x1f0d77[_0xf0a9('0x3b')]();});}})[_0xf0a9('0xb')](function(_0x25294c){logger[_0xf0a9('0xc')](_0xf0a9('0xa'),_0x4c8877,_0x25294c[_0xf0a9('0x3c')]);_0x1f0d77[_0xf0a9('0x3b')]();});}}catch(_0x25a55e){logger[_0xf0a9('0xc')](_0xf0a9('0xa'),_0x4c8877,JSON['stringify'](_0x25a55e));_0x1f0d77['stop']();}};}; \ 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 cf93cc1..64ba3f0 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 _0x3497=['priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','validate','length','error','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','condition','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x595fe4,_0x58e070){var _0x2fb9c6=function(_0x3be718){while(--_0x3be718){_0x595fe4['push'](_0x595fe4['shift']());}};_0x2fb9c6(++_0x58e070);}(_0x3497,0x117));var _0x7349=function(_0x3f9024,_0x48d0e5){_0x3f9024=_0x3f9024-0x0;var _0x3c931c=_0x3497[_0x3f9024];return _0x3c931c;};'use strict';var schema=require('validate');var _=require(_0x7349('0x0'));var htmlToText=require('html-to-text');var utils=require(_0x7349('0x1'));var logger=require(_0x7349('0x2'))(_0x7349('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7349('0x4')},'priorityTrue':{'type':_0x7349('0x5'),'message':_0x7349('0x6')},'priorityFalse':{'type':_0x7349('0x5'),'message':_0x7349('0x7')}});exports[_0x7349('0x8')]=function(_0x24ac99,_0x40ef3c){return function(_0x2bfd16){try{var _0x38c01a={'condition':htmlToText['fromString'](utils[_0x7349('0x9')](_0x40ef3c[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x40ef3c[0x1],'priorityFalse':_0x40ef3c[0x2]};var _0x17248e=gotoif[_0x7349('0xa')](_0x38c01a,{'typecast':!![]});if(_0x17248e[_0x7349('0xb')]){logger[_0x7349('0xc')](_0x7349('0xd'),_0x24ac99,_['map'](_0x17248e,_0x7349('0xe'))[_0x7349('0xf')](',\x20'));_0x2bfd16[_0x7349('0x10')]();}else{try{var _0x4eee1d=eval('('+_0x38c01a['condition']+')');var _0x3c71a5=_0x4eee1d?_0x38c01a[_0x7349('0x11')]:_0x38c01a['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x24ac99,_0x38c01a[_0x7349('0x12')],_0x4eee1d,_0x3c71a5||_0x7349('0x13'));if(_0x3c71a5){var _0x23d20a=_[_0x7349('0x14')](_0x2bfd16[_0x7349('0x15')](),{'p':_0x3c71a5});if(_0x23d20a>=0x0){logger[_0x7349('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x24ac99,_0x3c71a5||_0x7349('0x13'),_0x23d20a);_0x2bfd16['next'](_0x23d20a);}else{logger[_0x7349('0x16')](_0x7349('0x17'),_0x24ac99,_0x3c71a5||_0x7349('0x13'));_0x2bfd16['stop']();}}else{_0x2bfd16[_0x7349('0x13')]();}}catch(_0x45c2e6){logger[_0x7349('0xc')](_0x7349('0x18'),_0x24ac99,_0x45c2e6[_0x7349('0xe')]);_0x2bfd16[_0x7349('0x10')]();}}}catch(_0x40e4a7){logger[_0x7349('0xc')](_0x7349('0xd'),_0x24ac99,JSON[_0x7349('0x19')](_0x40e4a7));_0x2bfd16[_0x7349('0x10')]();}};}; \ No newline at end of file +var _0x7760=['error','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7760,0x184));var _0x0776=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x7760[_0x4c440b];return _0x2d48cf;};'use strict';var schema=require('validate');var _=require(_0x0776('0x0'));var htmlToText=require(_0x0776('0x1'));var utils=require(_0x0776('0x2'));var logger=require(_0x0776('0x3'))(_0x0776('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x0776('0x5')},'priorityTrue':{'type':_0x0776('0x6'),'message':_0x0776('0x7')},'priorityFalse':{'type':_0x0776('0x6'),'message':_0x0776('0x8')}});exports[_0x0776('0x9')]=function(_0x396ee2,_0x4d2a15){return function(_0x50869d){try{var _0x155c64={'condition':htmlToText[_0x0776('0xa')](utils[_0x0776('0xb')](_0x4d2a15[0x0],this),{'wordwrap':![]})[_0x0776('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4d2a15[0x1],'priorityFalse':_0x4d2a15[0x2]};var _0x1382cf=gotoif[_0x0776('0xd')](_0x155c64,{'typecast':!![]});if(_0x1382cf[_0x0776('0xe')]){logger[_0x0776('0xf')]('[%s][GOTOIF]\x20%s',_0x396ee2,_[_0x0776('0x10')](_0x1382cf,_0x0776('0x11'))[_0x0776('0x12')](',\x20'));_0x50869d[_0x0776('0x13')]();}else{try{var _0x123a83=eval('('+_0x155c64['condition']+')');var _0xb6ff9e=_0x123a83?_0x155c64[_0x0776('0x14')]:_0x155c64[_0x0776('0x15')];logger[_0x0776('0x16')](_0x0776('0x17'),_0x396ee2,_0x155c64['condition'],_0x123a83,_0xb6ff9e||'next');if(_0xb6ff9e){var _0x4b225f=_['findIndex'](_0x50869d[_0x0776('0x18')](),{'p':_0xb6ff9e});if(_0x4b225f>=0x0){logger['info'](_0x0776('0x19'),_0x396ee2,_0xb6ff9e||_0x0776('0x1a'),_0x4b225f);_0x50869d['next'](_0x4b225f);}else{logger[_0x0776('0x16')](_0x0776('0x1b'),_0x396ee2,_0xb6ff9e||_0x0776('0x1a'));_0x50869d[_0x0776('0x13')]();}}else{_0x50869d[_0x0776('0x1a')]();}}catch(_0x191f85){logger[_0x0776('0xf')](_0x0776('0x1c'),_0x396ee2,_0x191f85[_0x0776('0x11')]);_0x50869d[_0x0776('0x13')]();}}}catch(_0x5efd8b){logger[_0x0776('0xf')](_0x0776('0x1d'),_0x396ee2,JSON[_0x0776('0x1e')](_0x5efd8b));_0x50869d[_0x0776('0x13')]();}};}; \ 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 f78a2c2..4121ea8 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 _0x9012=['number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x20078a,_0x1f2481){var _0x525c0d=function(_0x40b99b){while(--_0x40b99b){_0x20078a['push'](_0x20078a['shift']());}};_0x525c0d(++_0x1f2481);}(_0x9012,0xee));var _0x2901=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x9012[_0x20845e];return _0x28cf2b;};'use strict';var schema=require(_0x2901('0x0'));var _=require(_0x2901('0x1'));var logger=require(_0x2901('0x2'))(_0x2901('0x3'));var gotop=schema({'priority':{'type':_0x2901('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2901('0x5')]=function(_0x238885,_0x58c217){return function(_0x32f2a0){try{var _0x224b0f={'priority':_0x58c217[0x0]};var _0x1762d5=gotop[_0x2901('0x0')](_0x224b0f,{'typecast':!![]});if(_0x1762d5[_0x2901('0x6')]){logger[_0x2901('0x7')](_0x2901('0x8'),_0x238885,_[_0x2901('0x9')](_0x1762d5,_0x2901('0xa'))[_0x2901('0xb')](',\x20'));_0x32f2a0[_0x2901('0xc')]();}else{logger[_0x2901('0xd')](_0x2901('0xe'),_0x238885,_0x224b0f[_0x2901('0xf')]);if(_0x224b0f[_0x2901('0xf')]){var _0x1cf713=_[_0x2901('0x10')](_0x32f2a0[_0x2901('0x11')](),{'p':_0x224b0f[_0x2901('0xf')]});if(_0x1cf713>=0x0){logger[_0x2901('0xd')](_0x2901('0x12'),_0x238885,_0x224b0f['priority']||_0x2901('0x13'),_0x1cf713);_0x32f2a0['next'](_0x1cf713);}else{logger[_0x2901('0xd')](_0x2901('0x14'),_0x238885,_0x224b0f[_0x2901('0xf')]||_0x2901('0x13'));_0x32f2a0[_0x2901('0xc')]();}}else{_0x32f2a0[_0x2901('0x13')]();}}}catch(_0x40be43){logger[_0x2901('0x7')](_0x2901('0x8'),_0x238885,JSON[_0x2901('0x15')](_0x40be43));_0x32f2a0['stop']();}};}; \ No newline at end of file +var _0xa9d0=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOP]\x20%s','stringify','validate','lodash','routing','number'];(function(_0x5b1ce7,_0x51d4c8){var _0xef8b2d=function(_0xb4c001){while(--_0xb4c001){_0x5b1ce7['push'](_0x5b1ce7['shift']());}};_0xef8b2d(++_0x51d4c8);}(_0xa9d0,0xf8));var _0x0a9d=function(_0x5c59e1,_0xebbf1b){_0x5c59e1=_0x5c59e1-0x0;var _0xebe66=_0xa9d0[_0x5c59e1];return _0xebe66;};'use strict';var schema=require(_0x0a9d('0x0'));var _=require(_0x0a9d('0x1'));var logger=require('../../../../config/logger')(_0x0a9d('0x2'));var gotop=schema({'priority':{'type':_0x0a9d('0x3'),'required':!![],'message':_0x0a9d('0x4')}});exports[_0x0a9d('0x5')]=function(_0x1c2fb1,_0x26e1d0){return function(_0x366f87){try{var _0x531be1={'priority':_0x26e1d0[0x0]};var _0x2695e9=gotop['validate'](_0x531be1,{'typecast':!![]});if(_0x2695e9[_0x0a9d('0x6')]){logger[_0x0a9d('0x7')]('[%s][GOTOP]\x20%s',_0x1c2fb1,_['map'](_0x2695e9,_0x0a9d('0x8'))[_0x0a9d('0x9')](',\x20'));_0x366f87['stop']();}else{logger['info'](_0x0a9d('0xa'),_0x1c2fb1,_0x531be1[_0x0a9d('0xb')]);if(_0x531be1[_0x0a9d('0xb')]){var _0x96ef89=_[_0x0a9d('0xc')](_0x366f87[_0x0a9d('0xd')](),{'p':_0x531be1[_0x0a9d('0xb')]});if(_0x96ef89>=0x0){logger[_0x0a9d('0xe')](_0x0a9d('0xf'),_0x1c2fb1,_0x531be1[_0x0a9d('0xb')]||_0x0a9d('0x10'),_0x96ef89);_0x366f87['next'](_0x96ef89);}else{logger[_0x0a9d('0xe')](_0x0a9d('0x11'),_0x1c2fb1,_0x531be1['priority']||_0x0a9d('0x10'));_0x366f87[_0x0a9d('0x12')]();}}else{_0x366f87[_0x0a9d('0x10')]();}}}catch(_0x55f883){logger[_0x0a9d('0x7')](_0x0a9d('0x13'),_0x1c2fb1,JSON[_0x0a9d('0x14')](_0x55f883));_0x366f87[_0x0a9d('0x12')]();}};}; \ 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 43f6e4c..b5e4cf8 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 _0x5926=['error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch'];(function(_0x294188,_0x4a177b){var _0x274e76=function(_0x38a6b2){while(--_0x38a6b2){_0x294188['push'](_0x294188['shift']());}};_0x274e76(++_0x4a177b);}(_0x5926,0xdb));var _0x6592=function(_0x3fa40c,_0x9baa70){_0x3fa40c=_0x3fa40c-0x0;var _0x5a992c=_0x5926[_0x3fa40c];return _0x5a992c;};'use strict';var _=require(_0x6592('0x0'));var utils=require(_0x6592('0x1'));var logger=require(_0x6592('0x2'))('routing');var rpc={'chatMessage':require(_0x6592('0x3')),'openchannelMessage':require(_0x6592('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6592('0x5'))};exports[_0x6592('0x6')]=function(_0x2d1d09,_0x4f1b84){return function(_0x554cb9){try{var _0x1bb90a={'body':utils['getMustacheRender'](_0x4f1b84[0x0],this),'ContactId':this[_0x6592('0x7')]['id']};if(this[_0x6592('0x8')]===_0x6592('0x9')){_0x1bb90a[_0x6592('0xa')]=this[_0x6592('0xb')]['id'];}else{_0x1bb90a[_['upperFirst'](this[_0x6592('0x8')])+_0x6592('0xc')]=this[_0x6592('0xb')]['id'];}_0x1bb90a[_[_0x6592('0xd')](this['channel'])+_0x6592('0xe')]=this[_0x6592('0xf')]['id'];if(rpc[this['channel']+_0x6592('0x10')]){return rpc[this['channel']+'Message'][_0x6592('0x11')](_0x1bb90a)[_0x6592('0x12')](function(_0x31cee0){logger[_0x6592('0x13')](_0x6592('0x14'),_0x2d1d09,_0x1bb90a[_0x6592('0x15')]);_0x554cb9[_0x6592('0x16')]();})[_0x6592('0x17')](function(_0x167d5a){logger[_0x6592('0x18')](_0x6592('0x14'),_0x2d1d09,JSON[_0x6592('0x19')](_0x167d5a));_0x554cb9[_0x6592('0x1a')]();});}}catch(_0x534f8d){logger[_0x6592('0x18')](_0x6592('0x14'),_0x2d1d09,JSON[_0x6592('0x19')](_0x534f8d));_0x554cb9[_0x6592('0x1a')]();}};}; \ No newline at end of file +var _0xccb8=['upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','ChatWebsiteId','account'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xccb8,0xd2));var _0x8ccb=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xccb8[_0x2df507];return _0x1f7167;};'use strict';var _=require(_0x8ccb('0x0'));var utils=require('./utils');var logger=require(_0x8ccb('0x1'))(_0x8ccb('0x2'));var rpc={'chatMessage':require(_0x8ccb('0x3')),'openchannelMessage':require(_0x8ccb('0x4')),'mailMessage':require(_0x8ccb('0x5')),'smsMessage':require(_0x8ccb('0x6')),'faxMessage':require(_0x8ccb('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8ccb('0x8')]=function(_0x3e4470,_0x10f9a4){return function(_0x35a24b){try{var _0xd59a4e={'body':utils[_0x8ccb('0x9')](_0x10f9a4[0x0],this),'ContactId':this[_0x8ccb('0xa')]['id']};if(this[_0x8ccb('0xb')]==='chat'){_0xd59a4e[_0x8ccb('0xc')]=this['account']['id'];}else{_0xd59a4e[_['upperFirst'](this['channel'])+'AccountId']=this[_0x8ccb('0xd')]['id'];}_0xd59a4e[_[_0x8ccb('0xe')](this[_0x8ccb('0xb')])+_0x8ccb('0xf')]=this[_0x8ccb('0x10')]['id'];if(rpc[this[_0x8ccb('0xb')]+_0x8ccb('0x11')]){return rpc[this[_0x8ccb('0xb')]+_0x8ccb('0x11')][_0x8ccb('0x12')](_0xd59a4e)[_0x8ccb('0x13')](function(_0x281ed6){logger[_0x8ccb('0x14')](_0x8ccb('0x15'),_0x3e4470,_0xd59a4e[_0x8ccb('0x16')]);_0x35a24b[_0x8ccb('0x17')]();})[_0x8ccb('0x18')](function(_0x7d7871){logger[_0x8ccb('0x19')]('[%s][MESSAGE]\x20%s',_0x3e4470,JSON[_0x8ccb('0x1a')](_0x7d7871));_0x35a24b[_0x8ccb('0x1b')]();});}}catch(_0x21bda3){logger[_0x8ccb('0x19')](_0x8ccb('0x15'),_0x3e4470,JSON[_0x8ccb('0x1a')](_0x21bda3));_0x35a24b['stop']();}};}; \ 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 069f4c3..81815bd 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 _0xacb5=['next','error','stringify','stop','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x1cc294,_0x5d677d){var _0x9af5f=function(_0x55a876){while(--_0x55a876){_0x1cc294['push'](_0x1cc294['shift']());}};_0x9af5f(++_0x5d677d);}(_0xacb5,0xf4));var _0x5acb=function(_0x47c93b,_0x5f5b8e){_0x47c93b=_0x47c93b-0x0;var _0x3d3f4f=_0xacb5[_0x47c93b];return _0x3d3f4f;};'use strict';var utils=require(_0x5acb('0x0'));var logger=require('../../../../config/logger')(_0x5acb('0x1'));exports['consequence']=function(_0x2ef0e1,_0x34a266){return function(_0x54b286){try{logger[_0x5acb('0x2')](_0x5acb('0x3'),_0x2ef0e1,utils['getMustacheRender'](_0x34a266[0x0],this));_0x54b286[_0x5acb('0x4')]();}catch(_0xc16169){logger[_0x5acb('0x5')](_0x5acb('0x3'),_0x2ef0e1,JSON[_0x5acb('0x6')](_0xc16169));_0x54b286[_0x5acb('0x7')]();}};}; \ No newline at end of file +var _0x053f=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','./utils','../../../../config/logger','routing'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x053f,0x15c));var _0xf053=function(_0x46d390,_0x36889){_0x46d390=_0x46d390-0x0;var _0x1f402f=_0x053f[_0x46d390];return _0x1f402f;};'use strict';var utils=require(_0xf053('0x0'));var logger=require(_0xf053('0x1'))(_0xf053('0x2'));exports[_0xf053('0x3')]=function(_0x1d15cf,_0x3f5952){return function(_0x30ecee){try{logger[_0xf053('0x4')](_0xf053('0x5'),_0x1d15cf,utils[_0xf053('0x6')](_0x3f5952[0x0],this));_0x30ecee[_0xf053('0x7')]();}catch(_0x5efc7b){logger[_0xf053('0x8')](_0xf053('0x5'),_0x1d15cf,JSON['stringify'](_0x5efc7b));_0x30ecee['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 99a4b50..2be52c3 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 _0xbf95=['../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','pick','../../rpc/chatQueueReport','../../rpc/smsQueueReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf95,0x7d));var _0x5bf9=function(_0xbcebfd,_0x7c71ab){_0xbcebfd=_0xbcebfd-0x0;var _0xf94b0e=_0xbf95[_0xbcebfd];return _0xf94b0e;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x5bf9('0x0'));var seqqueue=require('seq-queue');var moment=require(_0x5bf9('0x1'));var Redis=require(_0x5bf9('0x2'));var config=require(_0x5bf9('0x3'));var logger=require(_0x5bf9('0x4'))(_0x5bf9('0x5'));var strategy=require(_0x5bf9('0x6'));config[_0x5bf9('0x7')]=_['defaults'](config['redis'],{'host':_0x5bf9('0x8'),'port':0x18eb});var io=require(_0x5bf9('0x9'))(new Redis(config[_0x5bf9('0x7')]));var attributes=['id',_0x5bf9('0xa'),'account',_0x5bf9('0xb'),_0x5bf9('0xc'),_0x5bf9('0xd')];function emit(_0x59a73f,_0x40a691,_0x14cf34){io['to'](_0x59a73f)[_0x5bf9('0xe')](_0x40a691,_0x14cf34);}function emitChannelQueueInteraction(_0x5b303c,_0x49ed5e,_0x567614,_0x23f722,_0x3d02e1,_0x4fd696,_0x17f40e,_0x1876cf){var _0x99f4b1=_['clone'](_0x567614);_0x99f4b1[_0x5bf9('0xa')]=_0x1876cf;_0x99f4b1[_0x5bf9('0xb')]=_0x49ed5e;_0x99f4b1['account']=_0x23f722;_0x99f4b1['id']=_0x3d02e1;if(_0x4fd696){_0x17f40e[util[_0x5bf9('0xf')](_0x5bf9('0x10'),_0x5b303c)][_0x3d02e1]=_['pick'](_0x99f4b1,attributes);}else{delete _0x17f40e[util[_0x5bf9('0xf')](_0x5bf9('0x10'),_0x5b303c)][_0x3d02e1];}emit(util[_0x5bf9('0xf')](_0x5bf9('0x11'),_0x5b303c,_0x49ed5e),util['format'](_0x5bf9('0x12'),_0x5b303c,_0x4fd696?'save':_0x5bf9('0x13')),_[_0x5bf9('0x14')](_0x99f4b1,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x5bf9('0x15')),'smsQueueReport':require(_0x5bf9('0x16')),'faxQueueReport':require(_0x5bf9('0x17')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x5bf9('0x18')},'timeout':{'type':_0x5bf9('0x19'),'message':_0x5bf9('0x1a')}});function startRouting(_0x398910,_0x2308c0,_0x35a32d,_0x3d5765){if(_0x398910&&_0x2308c0&&_0x35a32d){_0x2308c0[_0x5bf9('0x1b')]+=0x1;var _0x24ae4c={'uniqueid':_0x398910,'from':_0x35a32d['body']?_0x35a32d[_0x5bf9('0x1c')]['from']:'','joinAt':moment()[_0x5bf9('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35a32d['contact']?_0x35a32d[_0x5bf9('0x1d')]['id']:null,'ListId':_0x35a32d[_0x5bf9('0x1e')]?_0x35a32d[_0x5bf9('0x1e')]['id']:null};_0x24ae4c[_[_0x5bf9('0x1f')](_0x35a32d[_0x5bf9('0x20')])+_0x5bf9('0x21')]=_0x2308c0['id']||null;_0x24ae4c[_['upperFirst'](_0x35a32d[_0x5bf9('0x20')])+'InteractionId']=_0x35a32d[_0x5bf9('0x22')]?_0x35a32d[_0x5bf9('0x22')]['id']:null;_0x24ae4c[_[_0x5bf9('0x1f')](_0x35a32d[_0x5bf9('0x20')])+_0x5bf9('0x23')]=_0x35a32d[_0x5bf9('0x24')]?_0x35a32d[_0x5bf9('0x24')]['id']:null;_0x24ae4c[_[_0x5bf9('0x1f')](_0x35a32d[_0x5bf9('0x20')])+(_0x35a32d[_0x5bf9('0x20')]!==_0x5bf9('0x25')?'AccountId':_0x5bf9('0x26'))]=_0x35a32d[_0x5bf9('0x27')]?_0x35a32d[_0x5bf9('0x27')]['id']:null;logger[_0x5bf9('0x28')](util[_0x5bf9('0xf')](_0x5bf9('0x29'),_0x398910,_0x2308c0[_0x5bf9('0x2a')]));emitChannelQueueInteraction(_0x35a32d['channel'],_0x2308c0[_0x5bf9('0x2a')],_0x24ae4c,_0x35a32d[_0x5bf9('0x27')]['name'],_0x35a32d[_0x5bf9('0x24')]['id'],!![],_0x3d5765,_0x2308c0['id']);if(rpc[_0x35a32d['channel']+_0x5bf9('0x2b')]){return rpc[_0x35a32d['channel']+_0x5bf9('0x2b')]['create'](_0x24ae4c)[_0x5bf9('0x2c')](function(_0x426cf5){logger['error'](_0x5bf9('0x2d'));});}}}function stopRouting(_0x1a6fdb,_0x3dd2e2,_0x3648eb,_0x364363){if(_0x1a6fdb&&_0x3dd2e2){_0x3dd2e2['waiting']-=0x1;var _0x24e4d5={'leaveAt':moment()[_0x5bf9('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x5bf9('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util[_0x5bf9('0xf')](_0x5bf9('0x2e'),_0x1a6fdb,_0x3dd2e2['name']));emitChannelQueueInteraction(_0x3648eb[_0x5bf9('0x20')],_0x3dd2e2[_0x5bf9('0x2a')],_0x3648eb[_0x5bf9('0x1c')],_0x3648eb[_0x5bf9('0x27')]['name'],_0x3648eb[_0x5bf9('0x24')]['id'],![],_0x364363,_0x3dd2e2['id']);if(rpc[_0x3648eb[_0x5bf9('0x20')]+_0x5bf9('0x2b')]){return rpc[_0x3648eb[_0x5bf9('0x20')]+_0x5bf9('0x2b')][_0x5bf9('0x2f')](_0x1a6fdb,_0x24e4d5)['catch'](function(_0x24165e){logger[_0x5bf9('0x30')](_0x5bf9('0x31'));});}}}function endRouting(_0x5a8862,_0x3a1ef8,_0x4901fb,_0x371416){if(_0x5a8862&&_0x3a1ef8){_0x3a1ef8[_0x5bf9('0x1b')]-=0x1;var _0x275ccd={'leaveAt':moment()[_0x5bf9('0xf')](_0x5bf9('0x32')),'exitAt':moment()[_0x5bf9('0xf')](_0x5bf9('0x32')),'reason':_0x5bf9('0x33')};logger[_0x5bf9('0x28')](util[_0x5bf9('0xf')](_0x5bf9('0x34'),_0x5a8862,_0x3a1ef8['name']));emitChannelQueueInteraction(_0x4901fb[_0x5bf9('0x20')],_0x3a1ef8[_0x5bf9('0x2a')],_0x4901fb[_0x5bf9('0x1c')],_0x4901fb[_0x5bf9('0x27')][_0x5bf9('0x2a')],_0x4901fb[_0x5bf9('0x24')]['id'],![],_0x371416);if(rpc[_0x4901fb['channel']+'QueueReport']){return rpc[_0x4901fb[_0x5bf9('0x20')]+_0x5bf9('0x2b')][_0x5bf9('0x2f')](_0x5a8862,_0x275ccd)[_0x5bf9('0x2c')](function(_0xcdcdb7){logger[_0x5bf9('0x30')](_0x5bf9('0x31'));});}}}function handleFindQueue(_0x4cd4a0){return function(_0x20a27a){return _0x20a27a[_0x5bf9('0x2a')][_0x5bf9('0x35')]()===_0x4cd4a0[_0x5bf9('0x35')]();};}exports[_0x5bf9('0x36')]=function(_0x539997,_0x4a5803,_0xaf0905,_0x16cdae){return function(_0x24e9ee){try{var _0xdbc013={'name':_0x4a5803[0x0],'timeout':_0x4a5803[0x1]};var _0x27af11=queue[_0x5bf9('0x37')](_0xdbc013,{'typecast':!![]});if(_0x27af11['length']){logger[_0x5bf9('0x30')](_0x5bf9('0x38'),_0x539997,_[_0x5bf9('0x39')](_0x27af11,_0x5bf9('0x24'))[_0x5bf9('0x3a')](',\x20'));_0x24e9ee[_0x5bf9('0x3b')]();}else{var _0x2384d8=_[_0x5bf9('0x3c')](_0xaf0905[_0x16cdae[_0x5bf9('0x20')]+_0x5bf9('0x3d')],handleFindQueue(_0xdbc013[_0x5bf9('0x2a')]));if(_0x2384d8){startRouting(_0x539997,_0x2384d8,_0x16cdae,_0xaf0905);var _0x58c37c=(_0x2384d8[_0x5bf9('0x33')]||0xa)*0x3e8;var _0x18cec2=(_0xdbc013[_0x5bf9('0x33')]||0x14)*0x3e8;var _0x18b1e9,_0x5d18a0;if(_0x58c37c>_0x18cec2){_0x18cec2=_0x58c37c;}var _0x273261=seqqueue[_0x5bf9('0x3e')](_0x58c37c);_0x273261['id']=_0x539997;_0x273261['atimeout']=_0x58c37c;_0x273261['qtimeout']=_0x18cec2;_0x273261[_0x5bf9('0x20')]=_0x16cdae['channel'];_0xaf0905[_0x5bf9('0x3f')][_0x539997]['on'](_0x5bf9('0x40'),function(){logger[_0x5bf9('0x28')](_0x5bf9('0x41'),_0x539997);stopRouting(_0x539997,_0x2384d8,_0x16cdae,_0xaf0905);clearTimeout(_0x18b1e9);_0x18b1e9=undefined;_0x273261[_0x5bf9('0x42')](!![]);if(_0xaf0905[_0x5bf9('0x3f')][_0x539997]){delete _0xaf0905['rules'][_0x539997];}_0x24e9ee['stop']();});_0xaf0905[_0x5bf9('0x3f')][_0x539997]['on']('complete',function(){if(_0xaf0905[_0x5bf9('0x3f')][_0x539997]){delete _0xaf0905[_0x5bf9('0x3f')][_0x539997];}});_0x18b1e9=setTimeout(function(){logger['info'](_0x5bf9('0x43'),_0x539997);endRouting(_0x539997,_0x2384d8,_0x16cdae,_0xaf0905);clearTimeout(_0x18b1e9);_0x273261[_0x5bf9('0x42')](!![]);_0x24e9ee[_0x5bf9('0x44')]();},_0x18cec2);switch(_0x2384d8[_0x5bf9('0x45')]){case _0x5bf9('0x46'):strategy[_0x5bf9('0x46')](_0x273261,_0x2384d8,_0xaf0905,_0x16cdae);break;default:strategy[_0x5bf9('0x47')](_0x273261,_0x2384d8,_0xaf0905,_0x16cdae);}}else{logger[_0x5bf9('0x30')](_0x5bf9('0x48'),_0x539997,_0xdbc013[_0x5bf9('0x2a')]);_0x24e9ee[_0x5bf9('0x3b')]();}}}catch(_0x1fc63d){console['log'](_0x1fc63d);logger['error']('[%s][QUEUE]\x20%s',_0x539997,_0x1fc63d[_0x5bf9('0x49')]);_0x24e9ee[_0x5bf9('0x3b')]();}};}; \ No newline at end of file +var _0x5b78=['update','update\x20queue\x20report','timeout','catch','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','from','joinAt','emit','queue','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','accepted','[%s][STOP:QUEUE][NAME:%s]'];(function(_0x4fc33f,_0x465067){var _0x1e6d8a=function(_0x1cb766){while(--_0x1cb766){_0x4fc33f['push'](_0x4fc33f['shift']());}};_0x1e6d8a(++_0x465067);}(_0x5b78,0x18f));var _0x85b7=function(_0x70c6fb,_0xc4a585){_0x70c6fb=_0x70c6fb-0x0;var _0x23215f=_0x5b78[_0x70c6fb];return _0x23215f;};'use strict';var schema=require(_0x85b7('0x0'));var _=require(_0x85b7('0x1'));var util=require(_0x85b7('0x2'));var seqqueue=require(_0x85b7('0x3'));var moment=require(_0x85b7('0x4'));var Redis=require(_0x85b7('0x5'));var config=require(_0x85b7('0x6'));var logger=require(_0x85b7('0x7'))('routing');var strategy=require(_0x85b7('0x8'));config[_0x85b7('0x9')]=_[_0x85b7('0xa')](config['redis'],{'host':_0x85b7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x85b7('0x9')]));var attributes=['id',_0x85b7('0xc'),_0x85b7('0xd'),'queue',_0x85b7('0xe'),_0x85b7('0xf')];function emit(_0x19372e,_0x4b5bfb,_0x54223c){io['to'](_0x19372e)[_0x85b7('0x10')](_0x4b5bfb,_0x54223c);}function emitChannelQueueInteraction(_0x5b206f,_0x535160,_0x520b91,_0x1780be,_0x1ee242,_0x3aa7f1,_0x1be444,_0x1849fa){var _0x2bd8be=_['clone'](_0x520b91);_0x2bd8be[_0x85b7('0xc')]=_0x1849fa;_0x2bd8be[_0x85b7('0x11')]=_0x535160;_0x2bd8be[_0x85b7('0xd')]=_0x1780be;_0x2bd8be['id']=_0x1ee242;if(_0x3aa7f1){_0x1be444[util[_0x85b7('0x12')]('%sQueuesWaitingInteractions',_0x5b206f)][_0x1ee242]=_['pick'](_0x2bd8be,attributes);}else{delete _0x1be444[util[_0x85b7('0x12')]('%sQueuesWaitingInteractions',_0x5b206f)][_0x1ee242];}emit(util[_0x85b7('0x12')](_0x85b7('0x13'),_0x5b206f,_0x535160),util[_0x85b7('0x12')](_0x85b7('0x14'),_0x5b206f,_0x3aa7f1?_0x85b7('0x15'):_0x85b7('0x16')),_[_0x85b7('0x17')](_0x2bd8be,attributes));}var rpc={'openchannelQueueReport':require(_0x85b7('0x18')),'mailQueueReport':require(_0x85b7('0x19')),'chatQueueReport':require(_0x85b7('0x1a')),'smsQueueReport':require(_0x85b7('0x1b')),'faxQueueReport':require(_0x85b7('0x1c')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x85b7('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x85b7('0x1e'),'message':_0x85b7('0x1f')}});function startRouting(_0x3d7989,_0x1269df,_0x7847ac,_0x1e9050){if(_0x3d7989&&_0x1269df&&_0x7847ac){_0x1269df[_0x85b7('0x20')]+=0x1;var _0x315841={'uniqueid':_0x3d7989,'from':_0x7847ac[_0x85b7('0x21')]?_0x7847ac[_0x85b7('0x21')][_0x85b7('0xe')]:'','joinAt':moment()[_0x85b7('0x12')](_0x85b7('0x22')),'ContactId':_0x7847ac[_0x85b7('0x23')]?_0x7847ac['contact']['id']:null,'ListId':_0x7847ac[_0x85b7('0x24')]?_0x7847ac['list']['id']:null};_0x315841[_[_0x85b7('0x25')](_0x7847ac['channel'])+_0x85b7('0x26')]=_0x1269df['id']||null;_0x315841[_[_0x85b7('0x25')](_0x7847ac['channel'])+_0x85b7('0x27')]=_0x7847ac[_0x85b7('0x28')]?_0x7847ac[_0x85b7('0x28')]['id']:null;_0x315841[_['upperFirst'](_0x7847ac[_0x85b7('0x29')])+'MessageId']=_0x7847ac[_0x85b7('0x2a')]?_0x7847ac[_0x85b7('0x2a')]['id']:null;_0x315841[_[_0x85b7('0x25')](_0x7847ac[_0x85b7('0x29')])+(_0x7847ac[_0x85b7('0x29')]!=='chat'?_0x85b7('0x2b'):'WebsiteId')]=_0x7847ac['account']?_0x7847ac[_0x85b7('0xd')]['id']:null;logger[_0x85b7('0x2c')](util[_0x85b7('0x12')](_0x85b7('0x2d'),_0x3d7989,_0x1269df['name']));emitChannelQueueInteraction(_0x7847ac[_0x85b7('0x29')],_0x1269df[_0x85b7('0x2e')],_0x315841,_0x7847ac[_0x85b7('0xd')][_0x85b7('0x2e')],_0x7847ac[_0x85b7('0x2a')]['id'],!![],_0x1e9050,_0x1269df['id']);if(rpc[_0x7847ac['channel']+_0x85b7('0x2f')]){return rpc[_0x7847ac[_0x85b7('0x29')]+'QueueReport']['create'](_0x315841)['catch'](function(_0x38807b){logger[_0x85b7('0x30')]('create\x20queue\x20report');});}}}function stopRouting(_0x3cb313,_0x286b46,_0x4b507b,_0x5d7dfc){if(_0x3cb313&&_0x286b46){_0x286b46[_0x85b7('0x20')]-=0x1;var _0x5d0cd5={'leaveAt':moment()[_0x85b7('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0x85b7('0x22')),'reason':_0x85b7('0x31')};logger[_0x85b7('0x2c')](util[_0x85b7('0x12')](_0x85b7('0x32'),_0x3cb313,_0x286b46[_0x85b7('0x2e')]));emitChannelQueueInteraction(_0x4b507b[_0x85b7('0x29')],_0x286b46[_0x85b7('0x2e')],_0x4b507b[_0x85b7('0x21')],_0x4b507b[_0x85b7('0xd')][_0x85b7('0x2e')],_0x4b507b[_0x85b7('0x2a')]['id'],![],_0x5d7dfc,_0x286b46['id']);if(rpc[_0x4b507b[_0x85b7('0x29')]+'QueueReport']){return rpc[_0x4b507b['channel']+_0x85b7('0x2f')][_0x85b7('0x33')](_0x3cb313,_0x5d0cd5)['catch'](function(_0x678941){logger[_0x85b7('0x30')](_0x85b7('0x34'));});}}}function endRouting(_0x432b57,_0x4ed493,_0x147598,_0x15ee2d){if(_0x432b57&&_0x4ed493){_0x4ed493['waiting']-=0x1;var _0x11d73a={'leaveAt':moment()[_0x85b7('0x12')](_0x85b7('0x22')),'exitAt':moment()[_0x85b7('0x12')](_0x85b7('0x22')),'reason':_0x85b7('0x35')};logger[_0x85b7('0x2c')](util[_0x85b7('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x432b57,_0x4ed493[_0x85b7('0x2e')]));emitChannelQueueInteraction(_0x147598['channel'],_0x4ed493[_0x85b7('0x2e')],_0x147598['body'],_0x147598[_0x85b7('0xd')][_0x85b7('0x2e')],_0x147598[_0x85b7('0x2a')]['id'],![],_0x15ee2d);if(rpc[_0x147598['channel']+_0x85b7('0x2f')]){return rpc[_0x147598[_0x85b7('0x29')]+_0x85b7('0x2f')][_0x85b7('0x33')](_0x432b57,_0x11d73a)[_0x85b7('0x36')](function(_0x1c19ea){logger['error'](_0x85b7('0x34'));});}}}function handleFindQueue(_0x6be7ab){return function(_0xeb560f){return _0xeb560f['name']['toLowerCase']()===_0x6be7ab[_0x85b7('0x37')]();};}exports[_0x85b7('0x38')]=function(_0x2f205f,_0x3661ea,_0x64c9f0,_0x18ef25){return function(_0x1c9442){try{var _0x218fa6={'name':_0x3661ea[0x0],'timeout':_0x3661ea[0x1]};var _0x3c2b78=queue[_0x85b7('0x0')](_0x218fa6,{'typecast':!![]});if(_0x3c2b78[_0x85b7('0x39')]){logger['error'](_0x85b7('0x3a'),_0x2f205f,_[_0x85b7('0x3b')](_0x3c2b78,_0x85b7('0x2a'))[_0x85b7('0x3c')](',\x20'));_0x1c9442['stop']();}else{var _0xa1ed56=_[_0x85b7('0x3d')](_0x64c9f0[_0x18ef25[_0x85b7('0x29')]+'Queues'],handleFindQueue(_0x218fa6[_0x85b7('0x2e')]));if(_0xa1ed56){startRouting(_0x2f205f,_0xa1ed56,_0x18ef25,_0x64c9f0);var _0x85f8f1=(_0xa1ed56[_0x85b7('0x35')]||0xa)*0x3e8;var _0x3119d6=(_0x218fa6[_0x85b7('0x35')]||0x14)*0x3e8;var _0x4b0729,_0x22d706;if(_0x85f8f1>_0x3119d6){_0x3119d6=_0x85f8f1;}var _0x201556=seqqueue[_0x85b7('0x3e')](_0x85f8f1);_0x201556['id']=_0x2f205f;_0x201556[_0x85b7('0x3f')]=_0x85f8f1;_0x201556['qtimeout']=_0x3119d6;_0x201556[_0x85b7('0x29')]=_0x18ef25[_0x85b7('0x29')];_0x64c9f0[_0x85b7('0x40')][_0x2f205f]['on'](_0x85b7('0x41'),function(){logger[_0x85b7('0x2c')](_0x85b7('0x42'),_0x2f205f);stopRouting(_0x2f205f,_0xa1ed56,_0x18ef25,_0x64c9f0);clearTimeout(_0x4b0729);_0x4b0729=undefined;_0x201556[_0x85b7('0x43')](!![]);if(_0x64c9f0[_0x85b7('0x40')][_0x2f205f]){delete _0x64c9f0[_0x85b7('0x40')][_0x2f205f];}_0x1c9442[_0x85b7('0x44')]();});_0x64c9f0[_0x85b7('0x40')][_0x2f205f]['on'](_0x85b7('0x45'),function(){if(_0x64c9f0['rules'][_0x2f205f]){delete _0x64c9f0[_0x85b7('0x40')][_0x2f205f];}});_0x4b0729=setTimeout(function(){logger[_0x85b7('0x2c')](_0x85b7('0x46'),_0x2f205f);endRouting(_0x2f205f,_0xa1ed56,_0x18ef25,_0x64c9f0);clearTimeout(_0x4b0729);_0x201556[_0x85b7('0x43')](!![]);_0x1c9442[_0x85b7('0x47')]();},_0x3119d6);switch(_0xa1ed56[_0x85b7('0x48')]){case _0x85b7('0x49'):strategy[_0x85b7('0x49')](_0x201556,_0xa1ed56,_0x64c9f0,_0x18ef25);break;default:strategy[_0x85b7('0x4a')](_0x201556,_0xa1ed56,_0x64c9f0,_0x18ef25);}}else{logger[_0x85b7('0x30')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2f205f,_0x218fa6['name']);_0x1c9442[_0x85b7('0x44')]();}}}catch(_0x4a8ba2){console['log'](_0x4a8ba2);logger[_0x85b7('0x30')]('[%s][QUEUE]\x20%s',_0x2f205f,_0x4a8ba2['stack']);_0x1c9442[_0x85b7('0x44')]();}};}; \ 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 542672d..195becc 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 _0x1a8e=['routing','notificationId','agent','squeue','handleRun','handleTimeout','timeout','bind','prototype','push','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','agents','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','writeLog','TIMEOUT','lodash','uuid','./util','../../../../../config/logger'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x1a8e,0x13c));var _0xe1a8=function(_0x442679,_0x4b08e2){_0x442679=_0x442679-0x0;var _0x436278=_0x1a8e[_0x442679];return _0x436278;};'use strict';var _=require(_0xe1a8('0x0'));var uuid=require(_0xe1a8('0x1'));var util=require(_0xe1a8('0x2'));var logger=require(_0xe1a8('0x3'))(_0xe1a8('0x4'));var Agent=function(_0x14933a,_0x149d74,_0x577598,_0x58757e){this[_0xe1a8('0x5')]=uuid['v4']();this['squeue']=_0x14933a;this[_0xe1a8('0x6')]=_0x149d74;this['realtime']=_0x577598;this['routing']=_0x58757e;this[_0xe1a8('0x7')]['push'](this[_0xe1a8('0x8')]['bind'](this),this[_0xe1a8('0x9')]['bind'](this));this[_0xe1a8('0x7')]['on'](_0xe1a8('0xa'),this['handleTimeout'][_0xe1a8('0xb')](this));this[_0xe1a8('0x7')]['on']('drained',this['handleDrained']['bind'](this));};Agent[_0xe1a8('0xc')][_0xe1a8('0xd')]=function(){this[_0xe1a8('0x7')][_0xe1a8('0xd')](this[_0xe1a8('0x8')]['bind'](this),this[_0xe1a8('0x9')][_0xe1a8('0xb')](this));};Agent[_0xe1a8('0xc')][_0xe1a8('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0xe1a8('0xc')]['handleRun']=function(){logger[_0xe1a8('0xf')](_0xe1a8('0x10'),this[_0xe1a8('0x7')]['id'],this[_0xe1a8('0x6')]['id']);if(_[_0xe1a8('0x11')](this[_0xe1a8('0x12')]['agents'][this[_0xe1a8('0x6')]['id']])){logger[_0xe1a8('0xf')](_0xe1a8('0x13'),this['squeue']['id'],this[_0xe1a8('0x6')]['id']);setTimeout(this[_0xe1a8('0xd')][_0xe1a8('0xb')](this),0x3e8);}else{if(this[_0xe1a8('0x4')][_0xe1a8('0x14')]||util[_0xe1a8('0x15')](this[_0xe1a8('0x7')]['id'],this[_0xe1a8('0x12')]['agents'][this[_0xe1a8('0x6')]['id']],this[_0xe1a8('0x7')][_0xe1a8('0x16')],![])){this[_0xe1a8('0x12')][_0xe1a8('0x17')][this[_0xe1a8('0x6')]['id']]['busy']=!![];this[_0xe1a8('0x12')]['agents'][this[_0xe1a8('0x6')]['id']][_0xe1a8('0x18')]=undefined;util['showNotification'](this[_0xe1a8('0x5')],this[_0xe1a8('0x7')]['id'],this[_0xe1a8('0x12')]['agents'][this['agent']['id']],null,this[_0xe1a8('0x4')]);util['writeLog'](this[_0xe1a8('0x7')]['id'],this[_0xe1a8('0x12')][_0xe1a8('0x17')][this[_0xe1a8('0x6')]['id']],_0xe1a8('0x19')+(this[_0xe1a8('0x4')][_0xe1a8('0x14')]?_0xe1a8('0x1a'):''));}else{logger[_0xe1a8('0xf')](_0xe1a8('0x1b'),this[_0xe1a8('0x7')]['id'],this['agent']['id']);setTimeout(this[_0xe1a8('0xd')][_0xe1a8('0xb')](this),0x3e8);}}};Agent[_0xe1a8('0xc')][_0xe1a8('0x9')]=function(_0x22a0cb){if(_[_0xe1a8('0x11')](this[_0xe1a8('0x12')]['agents'][this[_0xe1a8('0x6')]['id']])){return logger[_0xe1a8('0xf')](_0xe1a8('0x13'),this[_0xe1a8('0x7')]['id'],this[_0xe1a8('0x6')]['id']);}else{logger[_0xe1a8('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xe1a8('0x7')]['id'],this['agent']['id']);util[_0xe1a8('0x1c')](this[_0xe1a8('0x5')],this['squeue']['id'],this[_0xe1a8('0x12')][_0xe1a8('0x17')][this[_0xe1a8('0x6')]['id']],null,this[_0xe1a8('0x4')]);this['realtime'][_0xe1a8('0x17')][this[_0xe1a8('0x6')]['id']][_0xe1a8('0x1d')]=![];this[_0xe1a8('0x12')][_0xe1a8('0x17')][this['agent']['id']][_0xe1a8('0x18')]=undefined;util[_0xe1a8('0x1e')](this['squeue']['id'],this['realtime']['agents'][this[_0xe1a8('0x6')]['id']],_0x22a0cb?'STOP':_0xe1a8('0x1f'));}if(!_0x22a0cb){setTimeout(this[_0xe1a8('0xd')][_0xe1a8('0xb')](this),0x3e8);}};function agent(_0x54fcfc,_0x925db3,_0x14fa15,_0x67657e){return new Agent(_0x54fcfc,_0x925db3,_0x14fa15,_0x67657e);}module['exports']=agent; \ No newline at end of file +var _0x9c36=['showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','TIMEOUT','exports','lodash','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue'];(function(_0x29d440,_0x4e4159){var _0x38e340=function(_0x1145e9){while(--_0x1145e9){_0x29d440['push'](_0x29d440['shift']());}};_0x38e340(++_0x4e4159);}(_0x9c36,0x163));var _0x69c3=function(_0x161295,_0x1c0417){_0x161295=_0x161295-0x0;var _0x1fe98a=_0x9c36[_0x161295];return _0x1fe98a;};'use strict';var _=require(_0x69c3('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x69c3('0x1'))(_0x69c3('0x2'));var Agent=function(_0x577082,_0x1c373b,_0x514e17,_0x1fe5f4){this[_0x69c3('0x3')]=uuid['v4']();this[_0x69c3('0x4')]=_0x577082;this[_0x69c3('0x5')]=_0x1c373b;this[_0x69c3('0x6')]=_0x514e17;this[_0x69c3('0x2')]=_0x1fe5f4;this[_0x69c3('0x4')][_0x69c3('0x7')](this[_0x69c3('0x8')][_0x69c3('0x9')](this),this[_0x69c3('0xa')][_0x69c3('0x9')](this));this[_0x69c3('0x4')]['on'](_0x69c3('0xb'),this['handleTimeout']['bind'](this));this['squeue']['on']('drained',this['handleDrained'][_0x69c3('0x9')](this));};Agent[_0x69c3('0xc')][_0x69c3('0x7')]=function(){this[_0x69c3('0x4')]['push'](this[_0x69c3('0x8')][_0x69c3('0x9')](this),this[_0x69c3('0xa')][_0x69c3('0x9')](this));};Agent[_0x69c3('0xc')][_0x69c3('0xd')]=function(){this[_0x69c3('0xa')](!![]);};Agent[_0x69c3('0xc')]['handleRun']=function(){logger[_0x69c3('0xe')](_0x69c3('0xf'),this[_0x69c3('0x4')]['id'],this[_0x69c3('0x5')]['id']);if(_['isNil'](this[_0x69c3('0x6')][_0x69c3('0x10')][this['agent']['id']])){logger[_0x69c3('0xe')](_0x69c3('0x11'),this[_0x69c3('0x4')]['id'],this[_0x69c3('0x5')]['id']);setTimeout(this['push'][_0x69c3('0x9')](this),0x3e8);}else{if(this[_0x69c3('0x2')][_0x69c3('0x12')]||util['isAgentAvailable'](this[_0x69c3('0x4')]['id'],this[_0x69c3('0x6')]['agents'][this[_0x69c3('0x5')]['id']],this[_0x69c3('0x4')][_0x69c3('0x13')],![])){this[_0x69c3('0x6')]['agents'][this[_0x69c3('0x5')]['id']][_0x69c3('0x14')]=!![];this[_0x69c3('0x6')][_0x69c3('0x10')][this['agent']['id']][_0x69c3('0x15')]=undefined;util[_0x69c3('0x16')](this[_0x69c3('0x3')],this['squeue']['id'],this[_0x69c3('0x6')][_0x69c3('0x10')][this['agent']['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this['realtime'][_0x69c3('0x10')][this['agent']['id']],_0x69c3('0x17')+(this['routing'][_0x69c3('0x12')]?':FORCED':''));}else{logger[_0x69c3('0xe')](_0x69c3('0x18'),this[_0x69c3('0x4')]['id'],this[_0x69c3('0x5')]['id']);setTimeout(this[_0x69c3('0x7')][_0x69c3('0x9')](this),0x3e8);}}};Agent[_0x69c3('0xc')]['handleTimeout']=function(_0x4ac862){if(_[_0x69c3('0x19')](this[_0x69c3('0x6')][_0x69c3('0x10')][this[_0x69c3('0x5')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x69c3('0x4')]['id'],this[_0x69c3('0x5')]['id']);}else{logger[_0x69c3('0xe')](_0x69c3('0x1a'),this[_0x69c3('0x4')]['id'],this[_0x69c3('0x5')]['id']);util['hideNotification'](this['notificationId'],this[_0x69c3('0x4')]['id'],this[_0x69c3('0x6')]['agents'][this['agent']['id']],null,this['routing']);this[_0x69c3('0x6')][_0x69c3('0x10')][this[_0x69c3('0x5')]['id']][_0x69c3('0x14')]=![];this[_0x69c3('0x6')][_0x69c3('0x10')][this[_0x69c3('0x5')]['id']][_0x69c3('0x15')]=undefined;util['writeLog'](this['squeue']['id'],this['realtime'][_0x69c3('0x10')][this[_0x69c3('0x5')]['id']],_0x4ac862?'STOP':_0x69c3('0x1b'));}if(!_0x4ac862){setTimeout(this[_0x69c3('0x7')][_0x69c3('0x9')](this),0x3e8);}};function agent(_0x2fa10d,_0x27a11,_0x4e324e,_0x248a34){return new Agent(_0x2fa10d,_0x27a11,_0x4e324e,_0x248a34);}module[_0x69c3('0x1c')]=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 e626175..f168c85 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 _0x12c9=['./util','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','timeout','drained','bind','prototype','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','debug','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','busy','busyQueue','lodash'];(function(_0x520f9b,_0x1d53e6){var _0x3b32ab=function(_0x5423b4){while(--_0x5423b4){_0x520f9b['push'](_0x520f9b['shift']());}};_0x3b32ab(++_0x1d53e6);}(_0x12c9,0x9f));var _0x912c=function(_0x20b265,_0x4ef349){_0x20b265=_0x20b265-0x0;var _0x3b586d=_0x12c9[_0x20b265];return _0x3b586d;};'use strict';var _=require(_0x912c('0x0'));var uuid=require('uuid');var util=require(_0x912c('0x1'));var logger=require('../../../../../config/logger')(_0x912c('0x2'));var Beepall=function(_0x522495,_0x3364ce,_0x2740fa,_0x438fd6){this[_0x912c('0x3')]=uuid['v4']();this[_0x912c('0x4')]=_0x522495;this[_0x912c('0x5')]=_0x3364ce;this[_0x912c('0x6')]=_0x2740fa;this['routing']=_0x438fd6;this[_0x912c('0x4')][_0x912c('0x7')](this[_0x912c('0x8')]['bind'](this),this[_0x912c('0x9')]['bind'](this));this['squeue']['on'](_0x912c('0xa'),this['handleTimeout']['bind'](this));this['squeue']['on'](_0x912c('0xb'),this['handleDrained'][_0x912c('0xc')](this));};Beepall[_0x912c('0xd')][_0x912c('0x7')]=function(){this[_0x912c('0x4')][_0x912c('0x7')](this[_0x912c('0x8')][_0x912c('0xc')](this),this['handleTimeout'][_0x912c('0xc')](this));};Beepall[_0x912c('0xd')][_0x912c('0xe')]=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x912c('0x8')]=function(){var _0x28142d=!![];if(!_['isNil'](this[_0x912c('0x5')])&&!_[_0x912c('0xf')](this['queue']['Agents'])&&this[_0x912c('0x5')][_0x912c('0x10')][_0x912c('0x11')]>0x0){for(var _0x533f99=0x0,_0x436180;_0x533f990x0){for(var _0x5b1370=0x0,_0x231a1b;_0x5b13700x0&&_0x3b05b0[_0x2405e8+_0x35fc('0x23')]>=_0x3b05b0[_0x2405e8+_0x35fc('0x21')]){writeLog(_0x155016,_0x3b05b0,_0x2405e8['toUpperCase']()+_0x35fc('0x24'));return![];}}return!![];};exports['showNotification']=function(_0x1bf180,_0xdfab9f,_0x5cb986,_0x519264,_0x47774c){return sendNotification(!![],_0x1bf180,_0xdfab9f,_0x5cb986,_0x519264,_0x47774c);};exports['hideNotification']=function(_0x274208,_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac){return sendNotification(![],_0x274208,_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac);};exports[_0x35fc('0x25')]=writeLog; \ No newline at end of file +var _0x24ca=['remove','isAgentAvailable','BUSY','online','Pause','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','emit','user:save','split','\x20interaction','name','account','notificationShake','body','queue','msg','getMustacheRender','[%s][QUEUE]\x20%s','notification:%s'];(function(_0x4d6b46,_0x3a4769){var _0x7f642=function(_0x40dd0c){while(--_0x40dd0c){_0x4d6b46['push'](_0x4d6b46['shift']());}};_0x7f642(++_0x3a4769);}(_0x24ca,0x1bc));var _0xa24c=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x24ca[_0x224f65];return _0x3f921c;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var utils=require(_0xa24c('0x1'));var Redis=require(_0xa24c('0x2'));var config=require(_0xa24c('0x3'));var logger=require('../../../../../config/logger')(_0xa24c('0x4'));config[_0xa24c('0x5')]=_[_0xa24c('0x6')](config[_0xa24c('0x5')],{'host':_0xa24c('0x7'),'port':0x18eb});var io=require(_0xa24c('0x8'))(new Redis(config[_0xa24c('0x5')]));function sendNotification(_0x3c0aaa,_0x2dd348,_0x257264,_0x9a5013,_0x481196,_0x42d89c){io['to'](util[_0xa24c('0x9')](_0xa24c('0xa'),_0x9a5013['name']))[_0xa24c('0xb')](_0xa24c('0xc'),_0x9a5013);var _0x288f76=_0x42d89c||{};var _0x211003=_0x257264[_0xa24c('0xd')]('.');var _0x43aa5a={'uniqueid':_0x2dd348,'channel':_0x211003[0x0],'id':_0x211003[0x1],'title':_0x211003[0x0]+_0xa24c('0xe'),'interactionId':_0x211003[0x2],'queue':_0x481196?_0x481196[_0xa24c('0xf')]:null,'sound':_0x288f76[_0xa24c('0x10')]['notificationSound'],'shake':_0x288f76[_0xa24c('0x10')][_0xa24c('0x11')]};try{if(!_0x288f76[_0xa24c('0x12')]){_0x288f76[_0xa24c('0x12')]={};}if(_0x481196){_0x288f76['body'][_0xa24c('0x13')]=_0x481196;}else if(_0x288f76[_0xa24c('0x12')][_0xa24c('0x13')]){delete _0x288f76[_0xa24c('0x12')][_0xa24c('0x13')];}_0x43aa5a[_0xa24c('0x14')]=utils[_0xa24c('0x15')](_0x288f76['account']['notificationTemplate'],_0x288f76);}catch(_0xb80781){_0x43aa5a[_0xa24c('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger['error'](util[_0xa24c('0x9')](_0xa24c('0x16'),_0x2dd348,_0xb80781['message']));}io['to'](util[_0xa24c('0x9')]('user:%s',_0x9a5013[_0xa24c('0xf')]))[_0xa24c('0xb')](util[_0xa24c('0x9')](_0xa24c('0x17'),_0x3c0aaa?'save':_0xa24c('0x18')),_0x43aa5a);}function writeLog(_0x18b7e0,_0x773f70,_0x4d4bab){return logger['debug'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x18b7e0,_0x773f70[_0xa24c('0xf')],_0x4d4bab));}exports[_0xa24c('0x19')]=function(_0x26e9c3,_0x180297,_0x51a275,_0x30ec21){if(_0x180297['busy']){writeLog(_0x26e9c3,_0x180297,_0xa24c('0x1a'));return![];}if(!_0x180297[_0xa24c('0x1b')]){writeLog(_0x26e9c3,_0x180297,'OFFLINE');return![];}if(_0x180297[_0x51a275+_0xa24c('0x1c')]){writeLog(_0x26e9c3,_0x180297,_0xa24c('0x1d'));return![];}if(_0x30ec21&&_0x180297[_0xa24c('0x1e')](_0x51a275+_0xa24c('0x1f'))&&_0x180297[_0xa24c('0x1e')](_0x51a275+'CurrentCapacity')){if(_0x180297[_0x51a275+_0xa24c('0x1f')]>0x0&&_0x180297[_0x51a275+'CurrentCapacity']>=_0x180297[_0x51a275+_0xa24c('0x1f')]){writeLog(_0x26e9c3,_0x180297,_0x51a275[_0xa24c('0x20')]()+_0xa24c('0x21'));return![];}}return!![];};exports['showNotification']=function(_0x1beb55,_0x31c4d9,_0x14fd5a,_0x314121,_0x11e4e0){return sendNotification(!![],_0x1beb55,_0x31c4d9,_0x14fd5a,_0x314121,_0x11e4e0);};exports[_0xa24c('0x22')]=function(_0x39609a,_0x5b23f4,_0xa0c48e,_0x28675f,_0x152120){return sendNotification(![],_0x39609a,_0x5b23f4,_0xa0c48e,_0x28675f,_0x152120);};exports[_0xa24c('0x23')]=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 47f9f0f..3d567e7 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 _0x0463=['string','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs','lodash','./utils','routing'];(function(_0x16f1e8,_0x24ab08){var _0x54b836=function(_0x4d43d8){while(--_0x4d43d8){_0x16f1e8['push'](_0x16f1e8['shift']());}};_0x54b836(++_0x24ab08);}(_0x0463,0x7d));var _0x3046=function(_0x559f32,_0x6e1bd4){_0x559f32=_0x559f32-0x0;var _0x58ea1e=_0x0463[_0x559f32];return _0x58ea1e;};'use strict';var schema=require(_0x3046('0x0'));var sh=require(_0x3046('0x1'));var _=require(_0x3046('0x2'));var utils=require(_0x3046('0x3'));var logger=require('../../../../config/logger')(_0x3046('0x4'));var system=schema({'command':{'type':_0x3046('0x5'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x3046('0x6')]=function(_0x2cb549,_0x4e54dc){return function(_0x37d924){try{var _0x58c8d2={'command':_0x4e54dc[0x0]};var _0x4a8649=system[_0x3046('0x0')](_0x58c8d2,{'typecast':!![]});if(_0x4a8649[_0x3046('0x7')]){logger[_0x3046('0x8')](_0x3046('0x9'),_0x2cb549,_[_0x3046('0xa')](_0x4a8649,_0x3046('0xb'))['join'](',\x20'));logger[_0x3046('0xc')](_0x3046('0xd'),_0x2cb549);_0x37d924[_0x3046('0xe')]();}else{var _0x3eb82b=this;var _0x4dc1ba=utils[_0x3046('0xf')](_0x4e54dc[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x2cb549,_0x4dc1ba);sh[_0x3046('0x10')](_[_0x3046('0x11')](_0x4dc1ba),function(_0x232f9d,_0x44fd7b){logger[_0x3046('0xc')](_0x3046('0x12'),_0x2cb549,_0x232f9d);if(_0x232f9d==0x0){var _0x4649db=_0x44fd7b[_0x3046('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x3046('0x14')](_0x4e54dc[0x1])||_[_0x3046('0x15')](_0x4e54dc[0x1])){logger[_0x3046('0xc')](_0x3046('0x16'),_0x2cb549);_0x3eb82b['body'][_0x4e54dc[0x1]]=_0x4649db;}else{logger[_0x3046('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2cb549,_0x4e54dc[0x1],_0x4649db);_0x3eb82b[_0x3046('0x17')][_0x4e54dc[0x1]]=_0x4649db;}}_0x37d924[_0x3046('0xe')]();});}}catch(_0xa29d01){logger['error'](_0x3046('0x9'),_0x2cb549,_[_0x3046('0x18')](_0xa29d01)?JSON[_0x3046('0x19')](_0xa29d01):_0xa29d01);logger['info'](_0x3046('0xd'),_0x2cb549);_0x37d924[_0x3046('0xe')]();}};}; \ No newline at end of file +var _0x871e=['validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x871e,0x1b0));var _0xe871=function(_0x268aba,_0x43657a){_0x268aba=_0x268aba-0x0;var _0x147bac=_0x871e[_0x268aba];return _0x147bac;};'use strict';var schema=require(_0xe871('0x0'));var sh=require('shelljs');var _=require(_0xe871('0x1'));var utils=require(_0xe871('0x2'));var logger=require(_0xe871('0x3'))(_0xe871('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xe871('0x5')}});exports[_0xe871('0x6')]=function(_0x4550c1,_0x443d1d){return function(_0x4ec1dd){try{var _0x2c0254={'command':_0x443d1d[0x0]};var _0x1068cc=system[_0xe871('0x0')](_0x2c0254,{'typecast':!![]});if(_0x1068cc[_0xe871('0x7')]){logger[_0xe871('0x8')]('[%s][SYSTEM]\x20%s',_0x4550c1,_[_0xe871('0x9')](_0x1068cc,'message')['join'](',\x20'));logger[_0xe871('0xa')](_0xe871('0xb'),_0x4550c1);_0x4ec1dd[_0xe871('0xc')]();}else{var _0x5bdd86=this;var _0x8871ff=utils[_0xe871('0xd')](_0x443d1d[0x0],this);logger[_0xe871('0xa')](_0xe871('0xe'),_0x4550c1,_0x8871ff);sh[_0xe871('0xf')](_[_0xe871('0x10')](_0x8871ff),function(_0x32860a,_0x5f0795){logger[_0xe871('0xa')](_0xe871('0x11'),_0x4550c1,_0x32860a);if(_0x32860a==0x0){var _0x7462bb=_0x5f0795[_0xe871('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xe871('0x13')](_0x443d1d[0x1])||_[_0xe871('0x14')](_0x443d1d[0x1])){logger[_0xe871('0xa')](_0xe871('0x15'),_0x4550c1);_0x5bdd86[_0xe871('0x16')][_0x443d1d[0x1]]=_0x7462bb;}else{logger['info'](_0xe871('0x17'),_0x4550c1,_0x443d1d[0x1],_0x7462bb);_0x5bdd86['body'][_0x443d1d[0x1]]=_0x7462bb;}}_0x4ec1dd['next']();});}}catch(_0x2a5557){logger[_0xe871('0x8')](_0xe871('0x18'),_0x4550c1,_[_0xe871('0x19')](_0x2a5557)?JSON[_0xe871('0x1a')](_0x2a5557):_0x2a5557);logger[_0xe871('0xa')](_0xe871('0xb'),_0x4550c1);_0x4ec1dd[_0xe871('0xc')]();}};}; \ 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 b250a6f..bdef292 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 _0x7211=['stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','consequence','length','error','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7211,0x162));var _0x1721=function(_0x2b3605,_0x181cfb){_0x2b3605=_0x2b3605-0x0;var _0x34696e=_0x7211[_0x2b3605];return _0x34696e;};'use strict';var schema=require(_0x1721('0x0'));var _=require(_0x1721('0x1'));var rpc={'chatInteraction':require(_0x1721('0x2')),'openchannelInteraction':require(_0x1721('0x3')),'smsInteraction':require(_0x1721('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1721('0x5')),'whatsappInteraction':require(_0x1721('0x6'))};var logger=require('../../../../config/logger')(_0x1721('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x1721('0x8')]=function(_0x3c394b,_0x4ad15f,_0x37ef5a,_0x379e61){return function(_0xbf234a){try{var _0x3f4291={'tag':_0x4ad15f[0x0]};var _0x166b8a=tag[_0x1721('0x0')](_0x3f4291,{'typecast':!![]});if(_0x166b8a[_0x1721('0x9')]){logger[_0x1721('0xa')]('[%s][TAG]\x20%s',_0x3c394b,_['map'](_0x166b8a,'message')['join'](',\x20'));logger[_0x1721('0xb')](_0x1721('0xc'),_0x3c394b);_0xbf234a['next']();}else{var _0x3f9d60={'ids':[_0x4ad15f[0x0]]};if(rpc[_0x379e61[_0x1721('0xd')]+_0x1721('0xe')]){rpc[_0x379e61['channel']+_0x1721('0xe')][_0x1721('0xf')](_0x379e61[_0x1721('0x10')]['id'],_0x3f9d60)[_0x1721('0x11')](function(_0x455605){logger[_0x1721('0xb')](_0x1721('0x12'),_0x3c394b,_0x4ad15f[0x1],_0x379e61[_0x1721('0xd')],_0x379e61[_0x1721('0x10')]['id']);})[_0x1721('0x13')](function(_0x69e864){logger[_0x1721('0xa')](_0x1721('0x14'),_0x3c394b,JSON[_0x1721('0x15')](_0x69e864));logger[_0x1721('0xb')](_0x1721('0xc'),_0x3c394b);})[_0x1721('0x16')](function(){_0xbf234a[_0x1721('0x17')]();});}}}catch(_0x438e29){logger['error'](_0x1721('0x14'),_0x3c394b,_[_0x1721('0x18')](_0x438e29)?JSON['stringify'](_0x438e29):_0x438e29);logger[_0x1721('0xb')](_0x1721('0xc'),_0x3c394b);_0xbf234a['next']();}};}; \ No newline at end of file +var _0x0a6e=['isObject','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','[%s][TAG]\x20%s','map','message','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally'];(function(_0x30cf1d,_0x4f43d2){var _0x1eed74=function(_0x1c0031){while(--_0x1c0031){_0x30cf1d['push'](_0x30cf1d['shift']());}};_0x1eed74(++_0x4f43d2);}(_0x0a6e,0x189));var _0xe0a6=function(_0x163b4b,_0x34d94b){_0x163b4b=_0x163b4b-0x0;var _0x360060=_0x0a6e[_0x163b4b];return _0x360060;};'use strict';var schema=require(_0xe0a6('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe0a6('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xe0a6('0x2')),'mailInteraction':require(_0xe0a6('0x3')),'faxInteraction':require(_0xe0a6('0x4')),'whatsappInteraction':require(_0xe0a6('0x5'))};var logger=require(_0xe0a6('0x6'))(_0xe0a6('0x7'));var tag=schema({'tag':{'type':_0xe0a6('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xe0a6('0x9')]=function(_0x3009d5,_0x208c8,_0x485826,_0x5bc79e){return function(_0x5dee5a){try{var _0x9896cc={'tag':_0x208c8[0x0]};var _0x8b5dc6=tag[_0xe0a6('0x0')](_0x9896cc,{'typecast':!![]});if(_0x8b5dc6[_0xe0a6('0xa')]){logger[_0xe0a6('0xb')](_0xe0a6('0xc'),_0x3009d5,_[_0xe0a6('0xd')](_0x8b5dc6,_0xe0a6('0xe'))[_0xe0a6('0xf')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3009d5);_0x5dee5a[_0xe0a6('0x10')]();}else{var _0x367138={'ids':[_0x208c8[0x0]]};if(rpc[_0x5bc79e[_0xe0a6('0x11')]+_0xe0a6('0x12')]){rpc[_0x5bc79e[_0xe0a6('0x11')]+'Interaction'][_0xe0a6('0x13')](_0x5bc79e['interaction']['id'],_0x367138)[_0xe0a6('0x14')](function(_0x54a915){logger[_0xe0a6('0x15')](_0xe0a6('0x16'),_0x3009d5,_0x208c8[0x1],_0x5bc79e[_0xe0a6('0x11')],_0x5bc79e['interaction']['id']);})[_0xe0a6('0x17')](function(_0x256b8d){logger[_0xe0a6('0xb')]('[%s][TAG]\x20%s',_0x3009d5,JSON[_0xe0a6('0x18')](_0x256b8d));logger[_0xe0a6('0x15')](_0xe0a6('0x19'),_0x3009d5);})[_0xe0a6('0x1a')](function(){_0x5dee5a[_0xe0a6('0x10')]();});}}}catch(_0x44c2fc){logger[_0xe0a6('0xb')](_0xe0a6('0xc'),_0x3009d5,_[_0xe0a6('0x1b')](_0x44c2fc)?JSON[_0xe0a6('0x18')](_0x44c2fc):_0x44c2fc);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3009d5);_0x5dee5a[_0xe0a6('0x10')]();}};}; \ 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 bc5a530..736aae0 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 _0xe344=['routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','2.0','method','login','push','params','utf8','POST','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger'];(function(_0x3be502,_0x4e9a35){var _0x25467e=function(_0x36e682){while(--_0x36e682){_0x3be502['push'](_0x3be502['shift']());}};_0x25467e(++_0x4e9a35);}(_0xe344,0x1b9));var _0x4e34=function(_0x2bd6c9,_0x53d959){_0x2bd6c9=_0x2bd6c9-0x0;var _0x249d88=_0xe344[_0x2bd6c9];return _0x249d88;};'use strict';var rp=require('request-promise');var logger=require(_0x4e34('0x0'))(_0x4e34('0x1'));var _=require(_0x4e34('0x2'));var arr=[];exports['consequence']=function(_0x401c02,_0x1f58f5){return function(_0x3e57b9){var _0x15ea93=_0x1f58f5[0xa];var _0x39059a=_0x1f58f5[0xb];var _0x1b6025=_0x1f58f5[0xc];var _0x2d3263=_0x1f58f5[0xd];var _0x1eef0c=_0x1f58f5[0xe];var _0x873b03=_0x1f58f5[0xf][_0x4e34('0x3')](/\n/g,_0x4e34('0x4'));var _0x261630=_0x1f58f5[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x4e34('0x5')](_0x39059a)){arr['push'](_0x39059a);var _0x1012b1=_0x1f58f5[0x3];var _0x5af802=_0x1f58f5[0x4];var _0x47a52e=_0x1f58f5[0x1];var _0x1728d3=_0x1f58f5[0x0];var _0x1f60cb={};_0x1f60cb[_0x4e34('0x6')]=_0x1f58f5[0x8]+'?params='+_0x1b6025+'|'+_0x15ea93+'|'+_0x2d3263+'|'+_0x39059a+'|'+_0x1eef0c;_0x1f60cb['urlOnRing']=_0x1f58f5[0x7]+_0x4e34('0x7')+_0x1b6025+'|'+_0x15ea93+'|'+_0x2d3263+'|'+_0x39059a+'|'+_0x1eef0c+'|'+_0x873b03+'|'+_0x261630;_0x1f60cb[_0x4e34('0x8')]=_0x1f58f5[0x9];var _0x2b8962={};_0x2b8962['jsonrpc']=_0x4e34('0x9');_0x2b8962[_0x4e34('0xa')]=_0x4e34('0xb');var _0x2dbeff=[];_0x2dbeff[_0x4e34('0xc')](_0x1f58f5[0x2]);_0x2dbeff[_0x4e34('0xc')](_0x1f58f5[0x5]);_0x2dbeff[_0x4e34('0xc')](_0x1f58f5[0x6]);_0x2b8962[_0x4e34('0xd')]=_0x2dbeff;_0x2b8962['id']=0x1;var _0x156a44=JSON['stringify'](_0x2b8962);var _0x239c7e={'encoding':_0x4e34('0xe'),'method':_0x4e34('0xf'),'timeout':0x2710,'url':_0x1012b1,'headers':{'Content-Type':_0x4e34('0x10')},'body':_0x156a44};return rp(_0x239c7e)[_0x4e34('0x11')](function(_0x377f85){const _0x3f5418=JSON['parse'](_0x377f85);if(!_0x3f5418[_0x4e34('0x12')][_0x4e34('0x13')]){throw new Error(_0x4e34('0x14'));}var _0xa54db8=_0x39059a;var _0xbbe03e=_0x4e34('0x15')+_0x47a52e+_0x4e34('0x16')+_0x1728d3+'&sessionId='+_0xa54db8+_0x4e34('0x17')+JSON[_0x4e34('0x18')](_0x1f60cb);var _0x3d660e=_0x5af802+'?'+_0xbbe03e;return rp(_0x3d660e);})[_0x4e34('0x11')](function(_0x140673){logger[_0x4e34('0x19')](_0x4e34('0x1a'),_0x401c02,_0x140673);_0x3e57b9[_0x4e34('0x1b')]();})[_0x4e34('0x1c')](function(_0x365783){logger[_0x4e34('0x1d')](_0x4e34('0x1e'),_0x401c02,_[_0x4e34('0x1f')](_0x365783)?JSON[_0x4e34('0x18')](_0x365783):_0x365783);_0x3e57b9[_0x4e34('0x1b')]();});}else{logger['info'](_0x4e34('0x20'),_0x401c02);_0x3e57b9[_0x4e34('0x21')]();}};}; \ No newline at end of file +var _0x9865=['?params=','urlOnRing','title','jsonrpc','2.0','method','login','utf8','POST','then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','stringify','info','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer'];(function(_0x2e5d67,_0x564b10){var _0x5d23cb=function(_0x4ecbfc){while(--_0x4ecbfc){_0x2e5d67['push'](_0x2e5d67['shift']());}};_0x5d23cb(++_0x564b10);}(_0x9865,0x157));var _0x5986=function(_0x1036d8,_0x4d2684){_0x1036d8=_0x1036d8-0x0;var _0x4c3e7a=_0x9865[_0x1036d8];return _0x4c3e7a;};'use strict';var rp=require(_0x5986('0x0'));var logger=require('../../../../config/logger')(_0x5986('0x1'));var _=require(_0x5986('0x2'));var arr=[];exports[_0x5986('0x3')]=function(_0x41cae6,_0x515ede){return function(_0x2dcec7){var _0xafd924=_0x515ede[0xa];var _0x109a18=_0x515ede[0xb];var _0x2e37bb=_0x515ede[0xc];var _0x5b4e5e=_0x515ede[0xd];var _0x3e0901=_0x515ede[0xe];var _0x123dca=_0x515ede[0xf][_0x5986('0x4')](/\n/g,_0x5986('0x5'));var _0x4c2652=_0x515ede[0x10][_0x5986('0x4')](/\n/g,'\x20');if(!arr[_0x5986('0x6')](_0x109a18)){arr[_0x5986('0x7')](_0x109a18);var _0x3b0a92=_0x515ede[0x3];var _0xb8f71=_0x515ede[0x4];var _0x7d2112=_0x515ede[0x1];var _0x3ab54e=_0x515ede[0x0];var _0x4bd058={};_0x4bd058[_0x5986('0x8')]=_0x515ede[0x8]+_0x5986('0x9')+_0x2e37bb+'|'+_0xafd924+'|'+_0x5b4e5e+'|'+_0x109a18+'|'+_0x3e0901;_0x4bd058[_0x5986('0xa')]=_0x515ede[0x7]+_0x5986('0x9')+_0x2e37bb+'|'+_0xafd924+'|'+_0x5b4e5e+'|'+_0x109a18+'|'+_0x3e0901+'|'+_0x123dca+'|'+_0x4c2652;_0x4bd058[_0x5986('0xb')]=_0x515ede[0x9];var _0xa6edde={};_0xa6edde[_0x5986('0xc')]=_0x5986('0xd');_0xa6edde[_0x5986('0xe')]=_0x5986('0xf');var _0xc383ad=[];_0xc383ad[_0x5986('0x7')](_0x515ede[0x2]);_0xc383ad[_0x5986('0x7')](_0x515ede[0x5]);_0xc383ad[_0x5986('0x7')](_0x515ede[0x6]);_0xa6edde['params']=_0xc383ad;_0xa6edde['id']=0x1;var _0x11b093=JSON['stringify'](_0xa6edde);var _0x2ca0a3={'encoding':_0x5986('0x10'),'method':_0x5986('0x11'),'timeout':0x2710,'url':_0x3b0a92,'headers':{'Content-Type':'application/json-rpc'},'body':_0x11b093};return rp(_0x2ca0a3)[_0x5986('0x12')](function(_0x290fc9){const _0x2a2630=JSON['parse'](_0x290fc9);if(!_0x2a2630['result'][_0x5986('0x13')]){throw new Error(_0x5986('0x14'));}var _0x193f33=_0x109a18;var _0x2875ae=_0x5986('0x15')+_0x7d2112+_0x5986('0x16')+_0x3ab54e+_0x5986('0x17')+_0x193f33+'&data='+JSON[_0x5986('0x18')](_0x4bd058);var _0x1fe17c=_0xb8f71+'?'+_0x2875ae;return rp(_0x1fe17c);})[_0x5986('0x12')](function(_0x46b767){logger[_0x5986('0x19')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x41cae6,_0x46b767);_0x2dcec7['stop']();})[_0x5986('0x1a')](function(_0x525053){logger[_0x5986('0x1b')](_0x5986('0x1c'),_0x41cae6,_[_0x5986('0x1d')](_0x525053)?JSON[_0x5986('0x18')](_0x525053):_0x525053);_0x2dcec7['stop']();});}else{logger[_0x5986('0x19')](_0x5986('0x1e'),_0x41cae6);_0x2dcec7[_0x5986('0x1f')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index bb6c4b0..0f76b51 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x95b13b,_0x103049){var _0x1b5848=function(_0x677802){while(--_0x677802){_0x95b13b['push'](_0x95b13b['shift']());}};_0x1b5848(++_0x103049);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x2f4f55,_0x287210){var _0x20c3a3=function(_0x347ec1){while(--_0x347ec1){_0x2f4f55['push'](_0x2f4f55['shift']());}};_0x20c3a3(++_0x287210);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 6a76ea7..a8f8206 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 _0x4d46=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','join','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','ChatWebsiteId','ContactId','body','format','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','busy','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x20f569,_0x5197ac){var _0x14afc5=function(_0x13ba8f){while(--_0x13ba8f){_0x20f569['push'](_0x20f569['shift']());}};_0x14afc5(++_0x5197ac);}(_0x4d46,0x197));var _0x64d4=function(_0x27b7be,_0x538e2d){_0x27b7be=_0x27b7be-0x0;var _0x1aa77e=_0x4d46[_0x27b7be];return _0x1aa77e;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var path=require(_0x64d4('0x2'));var fs=require('fs');var jayson=require(_0x64d4('0x3'));var BPromise=require(_0x64d4('0x4'));var uuid=require(_0x64d4('0x5'));var utils=require('./applications/utils');var config=require(_0x64d4('0x6'));var logger=require(_0x64d4('0x7'))(_0x64d4('0x8'));var rpc={'openchannelQueueReport':require(_0x64d4('0x9')),'mailQueueReport':require(_0x64d4('0xa')),'chatQueueReport':require(_0x64d4('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x64d4('0xc')),'whatsappQueueReport':require(_0x64d4('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x45158d,_0x34d00a,_0x54f161){return util['format']('%s.%s.%s',_0x45158d,_0x34d00a||0x0,_0x54f161||0x0);}function getIntervals(_0x4ce2cf,_0x56bfd2){var _0x2811fc=[];if(!_[_0x64d4('0xe')](_0x56bfd2[_0x64d4('0xf')])&&!_[_0x64d4('0xe')](_0x4ce2cf[_0x56bfd2[_0x64d4('0xf')]])&&!_[_0x64d4('0xe')](_0x4ce2cf[_0x56bfd2[_0x64d4('0xf')]][_0x64d4('0x10')])){_0x2811fc=_[_0x64d4('0x11')](_0x4ce2cf[_0x56bfd2['IntervalId']][_0x64d4('0x10')],'interval');}else if(!_[_0x64d4('0xe')](_0x56bfd2[_0x64d4('0x12')])){_0x2811fc=[_0x56bfd2[_0x64d4('0x12')]];}return _0x2811fc;}exports[_0x64d4('0x13')]=function(_0x13b111){_0x13b111[_0x64d4('0x14')]={};return new BPromise(function(_0x518d82,_0x2ab011){var _0x433af8={'Start':function(_0x4574c2){var _0x3a25a3=this;return new Promise(function(_0x1b005a,_0x156743){if(_0x4574c2){try{var _0xa8a81e=[];var _0x4b3335=getId(_0x4574c2[_0x64d4('0x15')],_0x4574c2[_0x64d4('0x16')]?_0x4574c2['message']['id']:0x0,_0x4574c2[_0x64d4('0x17')]?_0x4574c2[_0x64d4('0x17')]['id']:0x0);if(_0x4574c2[_0x64d4('0x18')]&&_[_0x64d4('0x19')](_0x4574c2[_0x64d4('0x18')])&&_0x4574c2[_0x64d4('0x18')][_0x64d4('0x1a')]){for(var _0x2549e9=0x0;_0x2549e9<_0x4574c2['applications'][_0x64d4('0x1a')];_0x2549e9+=0x1){var _0x46e926=_0x4574c2[_0x64d4('0x18')][_0x2549e9];if(fs[_0x64d4('0x1b')](path['join'](__dirname,'applications',_0x46e926[_0x64d4('0x1c')]+_0x64d4('0x1d')))){var _0x374119=[];switch(_0x46e926['app'][_0x64d4('0x1e')]()){case _0x64d4('0x1f'):var _0x244fde=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');if(_0x4574c2[_0x64d4('0x15')]==='mail'){_0x374119[_0x64d4('0x22')](_0x244fde[0x0]);_0x374119[_0x64d4('0x22')](_0x244fde[0x1]);_0x374119[_0x64d4('0x22')](_0x244fde[_0x64d4('0x23')](0x2,_0x244fde['length'])['join'](','));}else{_0x374119['push'](_0x244fde[0x0]);_0x374119[_0x64d4('0x22')](_0x244fde['slice'](0x1,_0x244fde[_0x64d4('0x1a')])['join'](','));}break;case _0x64d4('0x24'):var _0x44eb42=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119[_0x64d4('0x22')](_0x44eb42[0x0]);_0x374119['push'](_0x44eb42[0x1]);_0x374119['push'](_0x44eb42[_0x64d4('0x23')](0x2,_0x44eb42[_0x64d4('0x1a')])[_0x64d4('0x25')](','));break;case _0x64d4('0x26'):var _0x77912e=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119['push'](_0x77912e[0x0]);_0x374119['push'](_0x77912e[0x1]);_0x374119[_0x64d4('0x22')](_0x77912e[0x2]);_0x374119[_0x64d4('0x22')](_0x77912e[0x3]);_0x374119['push'](_0x77912e[_0x64d4('0x23')](0x4,_0x77912e[_0x64d4('0x1a')])[_0x64d4('0x25')](','));break;case _0x64d4('0x27'):var _0x592825=_0x46e926['appdata'][_0x64d4('0x21')](',');_0x374119['push'](_0x592825[0x0]);_0x374119['push'](_0x592825[0x1]);_0x374119[_0x64d4('0x22')](_0x592825[0x2]);_0x374119[_0x64d4('0x22')](_0x592825[0x3]);_0x374119['push'](_0x592825[_0x64d4('0x23')](0x4,_0x592825['length'])[_0x64d4('0x25')](','));break;case _0x64d4('0x16'):_0x374119['push'](_0x46e926['appdata']);break;case _0x64d4('0x28'):_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x29')]);_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x20')]);break;case'tvox':var _0x11fa17=utils[_0x64d4('0x2a')](_0x4574c2[_0x64d4('0x2b')]['notificationTemplate'],_0x4574c2);var _0x5c0847=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119[_0x64d4('0x22')](_0x5c0847[0x0]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x1]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x2]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x3]);_0x374119['push'](_0x5c0847[0x4]);_0x374119['push'](_0x5c0847[0x5]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x6]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x7]);_0x374119['push'](_0x5c0847[0x8]);_0x374119['push'](_0x5c0847[0x9]);_0x374119[_0x64d4('0x22')](_0x5c0847[0xa]);_0x374119['push'](_0x4574c2['interaction']['id']);_0x374119['push'](_0x4574c2['message']['id']);_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x2c')]);_0x374119[_0x64d4('0x22')](_0x4574c2[_0x64d4('0x17')][_0x64d4('0x2d')]);_0x374119[_0x64d4('0x22')](_0x4574c2['body'][_0x64d4('0x2e')]);_0x374119[_0x64d4('0x22')](_0x11fa17);break;default:_0x374119=_[_0x64d4('0xe')](_0x46e926[_0x64d4('0x20')])?[]:_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');}var _0x2aeea6={'id':util[_0x64d4('0x2f')]('%s:%s:%s',_0x4b3335,_0x46e926['id'],_0x46e926[_0x64d4('0x1c')]),'condition':require('./interval')[_0x64d4('0x30')](_0x4b3335,getIntervals(_0x13b111['intervals'],_0x46e926),_0x13b111),'consequence':require(_0x64d4('0x31')+_0x46e926['app'])['consequence'](_0x4b3335,_0x374119,_0x13b111,_0x4574c2),'p':_0x46e926[_0x64d4('0x32')]||0x0};logger[_0x64d4('0x33')](_0x64d4('0x34'),_0x2aeea6['id'],_0x64d4('0x35'),getIntervals(_0x13b111[_0x64d4('0x36')],_0x46e926)[_0x64d4('0x25')](_0x64d4('0x37')));_0xa8a81e[_0x64d4('0x22')](_0x2aeea6);}else{logger[_0x64d4('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x64d4('0x25')](__dirname,_0x64d4('0x18'),_0x46e926[_0x64d4('0x1c')]+_0x64d4('0x1d')));}}_0x13b111['rules'][_0x4b3335]=new RuleEngine(_0xa8a81e);_0x13b111[_0x64d4('0x14')][_0x4b3335][_0x64d4('0x39')](_0x4574c2,function(_0x4c5857){logger['info'](_0x64d4('0x3a'),JSON['stringify'](_0x4c5857[_0x64d4('0x3b')]));if(_0x13b111['rules'][_0x4b3335]){_0x13b111[_0x64d4('0x14')][_0x4b3335][_0x64d4('0x3c')](_0x64d4('0x3d'));}});return _0x1b005a({'code':0xc8,'message':_0x4574c2});}else{logger['info'](_0x64d4('0x3e'));return _0x1b005a({'code':0xc8,'message':_0x4574c2});}}catch(_0x3cdc62){logger[_0x64d4('0x38')](_0x3cdc62[_0x64d4('0x3f')]);return _0x156743(_0x3a25a3[_0x64d4('0x38')](0x1f4,_0x3cdc62));}}return _0x156743(_0x64d4('0x40'));});},'AcceptMessage':function(_0x5d1ed1){var _0x2fd1a6=this;return new Promise(function(_0x2ba2cb,_0xb5b771){if(_0x5d1ed1[_0x64d4('0x41')]&&_0x5d1ed1['agent']['id']){if(_0x13b111[_0x64d4('0x42')][_0x5d1ed1[_0x64d4('0x41')]['id']]){_0x13b111[_0x64d4('0x42')][_0x5d1ed1[_0x64d4('0x41')]['id']]['busy']=![];_0x13b111['agents'][_0x5d1ed1[_0x64d4('0x41')]['id']][_0x64d4('0x43')]=undefined;}}if(_0x5d1ed1['message']&&_0x5d1ed1[_0x64d4('0x16')]['id']){try{var _0x24cee0=getId(_0x5d1ed1[_0x64d4('0x15')],_0x5d1ed1[_0x64d4('0x16')]?_0x5d1ed1['message']['id']:0x0,_0x5d1ed1[_0x64d4('0x17')]?_0x5d1ed1[_0x64d4('0x17')]['id']:0x0);if(_0x13b111[_0x64d4('0x14')][_0x24cee0]){_0x13b111[_0x64d4('0x14')][_0x24cee0][_0x64d4('0x3c')]('end');if(rpc[_0x5d1ed1[_0x64d4('0x15')]+_0x64d4('0x44')]){rpc[_0x5d1ed1['channel']+_0x64d4('0x44')][_0x64d4('0x45')](_0x24cee0,{'UserId':_0x5d1ed1[_0x64d4('0x16')]['UserId']})[_0x64d4('0x46')](function(_0x532f22){logger[_0x64d4('0x38')](_0x64d4('0x47'));});}}return _0x2ba2cb({'code':0xc8,'message':_0x5d1ed1});}catch(_0x26eaa8){logger[_0x64d4('0x38')](_0x26eaa8[_0x64d4('0x3f')]);return _0xb5b771(_0x2fd1a6[_0x64d4('0x38')](0x1f4,_0x26eaa8));}}logger[_0x64d4('0x38')]('message\x20is\x20empty');return _0xb5b771(_0x2fd1a6['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x146489){var _0x32a8d8=this;return new Promise(function(_0x1e22a1,_0x41f8f4){if(_0x146489[_0x64d4('0x41')]&&_0x146489[_0x64d4('0x41')]['id']){try{if(_0x13b111['agents'][_0x146489[_0x64d4('0x41')]['id']]){_0x13b111[_0x64d4('0x42')][_0x146489[_0x64d4('0x41')]['id']][_0x64d4('0x48')]=![];_0x13b111[_0x64d4('0x42')][_0x146489[_0x64d4('0x41')]['id']][_0x64d4('0x43')]=undefined;}return _0x1e22a1({'code':0xc8,'message':_0x146489});}catch(_0x1e1414){logger['error'](_0x1e1414[_0x64d4('0x3f')]);return _0x41f8f4(_0x32a8d8[_0x64d4('0x38')](0x1f4,_0x1e1414));}}logger[_0x64d4('0x38')](_0x64d4('0x49'));return _0x41f8f4(_0x32a8d8[_0x64d4('0x38')](0x1f4,_0x64d4('0x49')));});},'AbandonInteraction':function(_0x293e2a){var _0x2a7ecc=this;return new Promise(function(_0x260597,_0x3ab444){if(_0x293e2a[_0x64d4('0x15')]&&_0x293e2a[_0x64d4('0x17')]&&_0x293e2a[_0x64d4('0x17')]['id']){try{var _0x3ba14e=getId(_0x293e2a[_0x64d4('0x15')],_0x293e2a[_0x64d4('0x16')]?_0x293e2a[_0x64d4('0x16')]['id']:0x0,_0x293e2a[_0x64d4('0x17')]?_0x293e2a[_0x64d4('0x17')]['id']:0x0);if(_0x13b111[_0x64d4('0x14')][_0x3ba14e]){_0x13b111[_0x64d4('0x14')][_0x3ba14e][_0x64d4('0x3c')]('end');}return _0x260597({'code':0xc8,'message':_0x293e2a});}catch(_0x54f061){logger[_0x64d4('0x38')](_0x54f061[_0x64d4('0x3f')]);return _0x3ab444(_0x2a7ecc['error'](0x1f4,_0x54f061));}}logger['error'](_0x64d4('0x49'));return _0x3ab444(_0x2a7ecc[_0x64d4('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xe909e7){var _0x336df0=this;return new Promise(function(_0x39dc54,_0x38a7d3){if(_0x13b111[_0x64d4('0x42')]['hasOwnProperty'](_0xe909e7['id'])){for(var _0x8fe655 in _0xe909e7['capacity']){if(_0xe909e7[_0x64d4('0x4a')][_0x64d4('0x4b')](_0x8fe655)){if(_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x64d4('0x4b')](_0x8fe655+_0x64d4('0x4c'))){_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x8fe655+'CurrentCapacity']=parseInt(_0xe909e7[_0x64d4('0x4a')][_0x8fe655],0xa);}}}_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x64d4('0x4d')]();return _0x39dc54({'code':0xc8,'message':_0x13b111[_0x64d4('0x42')][_0xe909e7['id']]});}else{return _0x38a7d3(_0x336df0['error'](0x1f4,_0x64d4('0x4e')));}});},'Agents':function(_0x5470fd){return new Promise(function(_0x439be2,_0x47fc19){var _0x227215=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x42')]);_0x439be2({'count':_0x227215[_0x64d4('0x1a')],'rows':_0x227215});});},'ChatQueues':function(_0x5ea427){return new Promise(function(_0xb49558,_0x53b82c){var _0x24d0c5=[];for(var _0x4d4864 in _0x13b111['chatQueues']){if(_0x13b111[_0x64d4('0x50')][_0x64d4('0x4b')](_0x4d4864)){var _0x3fd083=_0x13b111['chatQueues'][_0x4d4864];var _0x2b71bd={'id':_0x3fd083['id'],'available':_0x3fd083[_0x64d4('0x51')],'loggedIn':_0x3fd083[_0x64d4('0x52')],'name':_0x3fd083['name'],'paused':_0x3fd083[_0x64d4('0x53')],'waiting':_0x3fd083[_0x64d4('0x54')]};_0x24d0c5['push'](_0x2b71bd);}}_0xb49558({'count':_0x24d0c5[_0x64d4('0x1a')],'rows':_0x24d0c5});});},'MailQueues':function(_0x2fc57b){return new Promise(function(_0x51267d,_0x184738){var _0x12d2ca=[];for(var _0x2785ad in _0x13b111[_0x64d4('0x55')]){if(_0x13b111['mailQueues'][_0x64d4('0x4b')](_0x2785ad)){var _0x3ce0d0=_0x13b111[_0x64d4('0x55')][_0x2785ad];var _0x566638={'id':_0x3ce0d0['id'],'available':_0x3ce0d0[_0x64d4('0x51')],'loggedIn':_0x3ce0d0[_0x64d4('0x52')],'name':_0x3ce0d0['name'],'paused':_0x3ce0d0[_0x64d4('0x53')],'waiting':_0x3ce0d0[_0x64d4('0x54')]};_0x12d2ca[_0x64d4('0x22')](_0x566638);}}_0x51267d({'count':_0x12d2ca[_0x64d4('0x1a')],'rows':_0x12d2ca});});},'OpenchannelQueues':function(_0x169d4f){return new Promise(function(_0x73c224,_0x38c832){var _0x34b022=[];for(var _0x127f17 in _0x13b111['openchannelQueues']){if(_0x13b111[_0x64d4('0x56')][_0x64d4('0x4b')](_0x127f17)){var _0x151f2d=_0x13b111[_0x64d4('0x56')][_0x127f17];var _0x41dd50={'id':_0x151f2d['id'],'available':_0x151f2d[_0x64d4('0x51')],'loggedIn':_0x151f2d[_0x64d4('0x52')],'name':_0x151f2d[_0x64d4('0x57')],'paused':_0x151f2d[_0x64d4('0x53')],'waiting':_0x151f2d['waiting']};_0x34b022[_0x64d4('0x22')](_0x41dd50);}}_0x73c224({'count':_0x34b022[_0x64d4('0x1a')],'rows':_0x34b022});});},'SmsQueues':function(_0x10c130){return new Promise(function(_0x5dc380,_0x2cc617){var _0x3d94ac=[];for(var _0x126371 in _0x13b111['smsQueues']){if(_0x13b111['smsQueues'][_0x64d4('0x4b')](_0x126371)){var _0x4b3ef9=_0x13b111[_0x64d4('0x58')][_0x126371];var _0x1c39a2={'id':_0x4b3ef9['id'],'available':_0x4b3ef9[_0x64d4('0x51')],'loggedIn':_0x4b3ef9[_0x64d4('0x52')],'name':_0x4b3ef9['name'],'paused':_0x4b3ef9[_0x64d4('0x53')],'waiting':_0x4b3ef9[_0x64d4('0x54')]};_0x3d94ac[_0x64d4('0x22')](_0x1c39a2);}}_0x5dc380({'count':_0x3d94ac[_0x64d4('0x1a')],'rows':_0x3d94ac});});},'FaxQueues':function(_0x375e60){return new Promise(function(_0x4701fc,_0x369c52){var _0x2e2189=[];for(var _0x4e9e90 in _0x13b111[_0x64d4('0x59')]){if(_0x13b111[_0x64d4('0x59')][_0x64d4('0x4b')](_0x4e9e90)){var _0x8bb4f=_0x13b111[_0x64d4('0x59')][_0x4e9e90];var _0x3bff0a={'id':_0x8bb4f['id'],'available':_0x8bb4f['available'],'loggedIn':_0x8bb4f[_0x64d4('0x52')],'name':_0x8bb4f['name'],'paused':_0x8bb4f[_0x64d4('0x53')],'waiting':_0x8bb4f['waiting']};_0x2e2189[_0x64d4('0x22')](_0x3bff0a);}}_0x4701fc({'count':_0x2e2189['length'],'rows':_0x2e2189});});},'WhatsappQueues':function(_0x46e2fa){return new Promise(function(_0x3d4b9f,_0x2a50be){var _0x543e28=[];for(var _0x2268df in _0x13b111[_0x64d4('0x5a')]){if(_0x13b111[_0x64d4('0x5a')][_0x64d4('0x4b')](_0x2268df)){var _0x4b19a6=_0x13b111['whatsappQueues'][_0x2268df];var _0x4db603={'id':_0x4b19a6['id'],'available':_0x4b19a6['available'],'loggedIn':_0x4b19a6['loggedIn'],'name':_0x4b19a6[_0x64d4('0x57')],'paused':_0x4b19a6[_0x64d4('0x53')],'waiting':_0x4b19a6[_0x64d4('0x54')]};_0x543e28['push'](_0x4db603);}}_0x3d4b9f({'count':_0x543e28[_0x64d4('0x1a')],'rows':_0x543e28});});},'ChatQueuesWaitingInteractions':function(_0x21916f){return new Promise(function(_0x3fc18f,_0x519ea5){var _0x3df418=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5b')]);_0x3fc18f({'count':_0x3df418[_0x64d4('0x1a')],'rows':_0x3df418});});},'MailQueuesWaitingInteractions':function(_0x4097bd){return new Promise(function(_0x2fa315,_0x38d716){var _0x111d4f=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5c')]);_0x2fa315({'count':_0x111d4f[_0x64d4('0x1a')],'rows':_0x111d4f});});},'OpenchannelQueuesWaitingInteractions':function(_0x48a2e3){return new Promise(function(_0x33699b,_0x448376){var _0x379c99=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5d')]);_0x33699b({'count':_0x379c99['length'],'rows':_0x379c99});});},'SmsQueuesWaitingInteractions':function(_0x48a180){return new Promise(function(_0x2b47c3,_0x5c23e5){var _0x101d5c=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5e')]);_0x2b47c3({'count':_0x101d5c['length'],'rows':_0x101d5c});});},'FaxQueuesWaitingInteractions':function(_0x1c4f03){return new Promise(function(_0x3e65b4,_0x5464b4){var _0x32037a=_[_0x64d4('0x4f')](_0x13b111['faxQueuesWaitingInteractions']);_0x3e65b4({'count':_0x32037a[_0x64d4('0x1a')],'rows':_0x32037a});});},'WhatsappQueuesWaitingInteractions':function(_0x5ab6d8){return new Promise(function(_0x2f386b,_0x504086){var _0x19a9ac=_[_0x64d4('0x4f')](_0x13b111['whatsappQueuesWaitingInteractions']);_0x2f386b({'count':_0x19a9ac[_0x64d4('0x1a')],'rows':_0x19a9ac});});}};var _0x565610=jayson[_0x64d4('0x5f')](_0x433af8)[_0x64d4('0x60')]();_0x565610['on'](_0x64d4('0x38'),function(_0x32fbb9){logger[_0x64d4('0x38')](JSON[_0x64d4('0x61')](_0x32fbb9));return _0x2ab011(_0x32fbb9);});_0x565610[_0x64d4('0x13')](0x232c,'127.0.0.1',function(){console[_0x64d4('0x62')](_0x64d4('0x63'),0x232c);return _0x518d82('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xe5b5=['stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','tag','tvox','getMustacheRender','account','ContactId','body','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','matchPath','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','emit','end','QueueReport','update','UserId','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','name','mailQueues','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http'];(function(_0x734a07,_0x2c9a39){var _0x15b45a=function(_0x5de61b){while(--_0x5de61b){_0x734a07['push'](_0x734a07['shift']());}};_0x15b45a(++_0x2c9a39);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0xe5b5[_0x207d2f];return _0x3c3498;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var fs=require('fs');var jayson=require(_0x5e5b('0x3'));var BPromise=require(_0x5e5b('0x4'));var uuid=require(_0x5e5b('0x5'));var utils=require(_0x5e5b('0x6'));var config=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var rpc={'openchannelQueueReport':require(_0x5e5b('0xa')),'mailQueueReport':require(_0x5e5b('0xb')),'chatQueueReport':require(_0x5e5b('0xc')),'smsQueueReport':require(_0x5e5b('0xd')),'faxQueueReport':require(_0x5e5b('0xe')),'whatsappQueueReport':require(_0x5e5b('0xf'))};var RuleEngine=require(_0x5e5b('0x10'));function getId(_0xcbd478,_0x258414,_0xb9d72b){return util[_0x5e5b('0x11')](_0x5e5b('0x12'),_0xcbd478,_0x258414||0x0,_0xb9d72b||0x0);}function getIntervals(_0x3f8534,_0x492a0e){var _0x300890=[];if(!_['isNil'](_0x492a0e[_0x5e5b('0x13')])&&!_[_0x5e5b('0x14')](_0x3f8534[_0x492a0e[_0x5e5b('0x13')]])&&!_[_0x5e5b('0x14')](_0x3f8534[_0x492a0e['IntervalId']]['Intervals'])){_0x300890=_['map'](_0x3f8534[_0x492a0e[_0x5e5b('0x13')]][_0x5e5b('0x15')],_0x5e5b('0x16'));}else if(!_[_0x5e5b('0x14')](_0x492a0e[_0x5e5b('0x16')])){_0x300890=[_0x492a0e[_0x5e5b('0x16')]];}return _0x300890;}exports[_0x5e5b('0x17')]=function(_0x49edd0){_0x49edd0[_0x5e5b('0x18')]={};return new BPromise(function(_0x2e92c3,_0x4ff37b){var _0x227417={'Start':function(_0x578c14){var _0x4e9509=this;return new Promise(function(_0x13a1cb,_0x444435){if(_0x578c14){try{var _0xaf9ace=[];var _0x5c7148=getId(_0x578c14[_0x5e5b('0x19')],_0x578c14['message']?_0x578c14[_0x5e5b('0x1a')]['id']:0x0,_0x578c14[_0x5e5b('0x1b')]?_0x578c14['interaction']['id']:0x0);if(_0x578c14[_0x5e5b('0x1c')]&&_[_0x5e5b('0x1d')](_0x578c14[_0x5e5b('0x1c')])&&_0x578c14['applications'][_0x5e5b('0x1e')]){for(var _0x3f1103=0x0;_0x3f1103<_0x578c14['applications'][_0x5e5b('0x1e')];_0x3f1103+=0x1){var _0x1aa0c2=_0x578c14[_0x5e5b('0x1c')][_0x3f1103];if(fs[_0x5e5b('0x1f')](path[_0x5e5b('0x20')](__dirname,_0x5e5b('0x1c'),_0x1aa0c2[_0x5e5b('0x21')]+_0x5e5b('0x22')))){var _0x4a78e3=[];switch(_0x1aa0c2['app'][_0x5e5b('0x23')]()){case _0x5e5b('0x24'):var _0x14bfaf=_0x1aa0c2[_0x5e5b('0x25')][_0x5e5b('0x26')](',');if(_0x578c14[_0x5e5b('0x19')]===_0x5e5b('0x27')){_0x4a78e3[_0x5e5b('0x28')](_0x14bfaf[0x0]);_0x4a78e3[_0x5e5b('0x28')](_0x14bfaf[0x1]);_0x4a78e3[_0x5e5b('0x28')](_0x14bfaf[_0x5e5b('0x29')](0x2,_0x14bfaf['length'])[_0x5e5b('0x20')](','));}else{_0x4a78e3[_0x5e5b('0x28')](_0x14bfaf[0x0]);_0x4a78e3[_0x5e5b('0x28')](_0x14bfaf['slice'](0x1,_0x14bfaf[_0x5e5b('0x1e')])[_0x5e5b('0x20')](','));}break;case'dialogflow':var _0x13ff91=_0x1aa0c2[_0x5e5b('0x25')][_0x5e5b('0x26')](',');_0x4a78e3[_0x5e5b('0x28')](_0x13ff91[0x0]);_0x4a78e3[_0x5e5b('0x28')](_0x13ff91[0x1]);_0x4a78e3[_0x5e5b('0x28')](_0x13ff91[_0x5e5b('0x29')](0x2,_0x13ff91[_0x5e5b('0x1e')])[_0x5e5b('0x20')](','));break;case _0x5e5b('0x2a'):var _0xcb272c=_0x1aa0c2[_0x5e5b('0x25')]['split'](',');_0x4a78e3['push'](_0xcb272c[0x0]);_0x4a78e3[_0x5e5b('0x28')](_0xcb272c[0x1]);_0x4a78e3[_0x5e5b('0x28')](_0xcb272c[0x2]);_0x4a78e3[_0x5e5b('0x28')](_0xcb272c[0x3]);_0x4a78e3[_0x5e5b('0x28')](_0xcb272c[_0x5e5b('0x29')](0x4,_0xcb272c['length'])[_0x5e5b('0x20')](','));break;case'amazonlex':var _0x3f1041=_0x1aa0c2[_0x5e5b('0x25')][_0x5e5b('0x26')](',');_0x4a78e3[_0x5e5b('0x28')](_0x3f1041[0x0]);_0x4a78e3['push'](_0x3f1041[0x1]);_0x4a78e3[_0x5e5b('0x28')](_0x3f1041[0x2]);_0x4a78e3[_0x5e5b('0x28')](_0x3f1041[0x3]);_0x4a78e3['push'](_0x3f1041[_0x5e5b('0x29')](0x4,_0x3f1041[_0x5e5b('0x1e')])[_0x5e5b('0x20')](','));break;case _0x5e5b('0x1a'):_0x4a78e3[_0x5e5b('0x28')](_0x1aa0c2[_0x5e5b('0x25')]);break;case _0x5e5b('0x2b'):_0x4a78e3[_0x5e5b('0x28')](_0x1aa0c2['TagId']);_0x4a78e3[_0x5e5b('0x28')](_0x1aa0c2[_0x5e5b('0x25')]);break;case _0x5e5b('0x2c'):var _0x34396f=utils[_0x5e5b('0x2d')](_0x578c14[_0x5e5b('0x2e')]['notificationTemplate'],_0x578c14);var _0x5b2ba5=_0x1aa0c2[_0x5e5b('0x25')][_0x5e5b('0x26')](',');_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x0]);_0x4a78e3['push'](_0x5b2ba5[0x1]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x2]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x3]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x4]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x5]);_0x4a78e3['push'](_0x5b2ba5[0x6]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x7]);_0x4a78e3[_0x5e5b('0x28')](_0x5b2ba5[0x8]);_0x4a78e3['push'](_0x5b2ba5[0x9]);_0x4a78e3['push'](_0x5b2ba5[0xa]);_0x4a78e3[_0x5e5b('0x28')](_0x578c14[_0x5e5b('0x1b')]['id']);_0x4a78e3[_0x5e5b('0x28')](_0x578c14['message']['id']);_0x4a78e3[_0x5e5b('0x28')](_0x1aa0c2['ChatWebsiteId']);_0x4a78e3['push'](_0x578c14[_0x5e5b('0x1b')][_0x5e5b('0x2f')]);_0x4a78e3[_0x5e5b('0x28')](_0x578c14[_0x5e5b('0x30')][_0x5e5b('0x30')]);_0x4a78e3[_0x5e5b('0x28')](_0x34396f);break;default:_0x4a78e3=_[_0x5e5b('0x14')](_0x1aa0c2[_0x5e5b('0x25')])?[]:_0x1aa0c2[_0x5e5b('0x25')]['split'](',');}var _0x1f1907={'id':util[_0x5e5b('0x11')]('%s:%s:%s',_0x5c7148,_0x1aa0c2['id'],_0x1aa0c2[_0x5e5b('0x21')]),'condition':require('./interval')[_0x5e5b('0x31')](_0x5c7148,getIntervals(_0x49edd0[_0x5e5b('0x32')],_0x1aa0c2),_0x49edd0),'consequence':require(_0x5e5b('0x33')+_0x1aa0c2[_0x5e5b('0x21')])[_0x5e5b('0x34')](_0x5c7148,_0x4a78e3,_0x49edd0,_0x578c14),'p':_0x1aa0c2[_0x5e5b('0x35')]||0x0};logger[_0x5e5b('0x36')](_0x5e5b('0x37'),_0x1f1907['id'],_0x5e5b('0x38'),getIntervals(_0x49edd0[_0x5e5b('0x32')],_0x1aa0c2)[_0x5e5b('0x20')]('\x20|\x20'));_0xaf9ace[_0x5e5b('0x28')](_0x1f1907);}else{logger[_0x5e5b('0x39')](_0x5e5b('0x3a'),path['join'](__dirname,_0x5e5b('0x1c'),_0x1aa0c2[_0x5e5b('0x21')]+'.js'));}}_0x49edd0[_0x5e5b('0x18')][_0x5c7148]=new RuleEngine(_0xaf9ace);_0x49edd0[_0x5e5b('0x18')][_0x5c7148]['execute'](_0x578c14,function(_0x257bb7){logger['info']('Applications\x20executed',JSON['stringify'](_0x257bb7[_0x5e5b('0x3b')]));if(_0x49edd0['rules'][_0x5c7148]){_0x49edd0[_0x5e5b('0x18')][_0x5c7148]['emit'](_0x5e5b('0x3c'));}});return _0x13a1cb({'code':0xc8,'message':_0x578c14});}else{logger[_0x5e5b('0x36')](_0x5e5b('0x3d'));return _0x13a1cb({'code':0xc8,'message':_0x578c14});}}catch(_0x16d1db){logger[_0x5e5b('0x39')](_0x16d1db[_0x5e5b('0x3e')]);return _0x444435(_0x4e9509[_0x5e5b('0x39')](0x1f4,_0x16d1db));}}return _0x444435('routing\x20is\x20empty');});},'AcceptMessage':function(_0x48b3b8){var _0x3c1ede=this;return new Promise(function(_0x5da9c0,_0x54729b){if(_0x48b3b8['agent']&&_0x48b3b8[_0x5e5b('0x3f')]['id']){if(_0x49edd0['agents'][_0x48b3b8[_0x5e5b('0x3f')]['id']]){_0x49edd0[_0x5e5b('0x40')][_0x48b3b8[_0x5e5b('0x3f')]['id']][_0x5e5b('0x41')]=![];_0x49edd0[_0x5e5b('0x40')][_0x48b3b8[_0x5e5b('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x48b3b8[_0x5e5b('0x1a')]&&_0x48b3b8[_0x5e5b('0x1a')]['id']){try{var _0x4f110f=getId(_0x48b3b8[_0x5e5b('0x19')],_0x48b3b8['message']?_0x48b3b8[_0x5e5b('0x1a')]['id']:0x0,_0x48b3b8[_0x5e5b('0x1b')]?_0x48b3b8[_0x5e5b('0x1b')]['id']:0x0);if(_0x49edd0[_0x5e5b('0x18')][_0x4f110f]){_0x49edd0['rules'][_0x4f110f][_0x5e5b('0x42')](_0x5e5b('0x43'));if(rpc[_0x48b3b8['channel']+_0x5e5b('0x44')]){rpc[_0x48b3b8[_0x5e5b('0x19')]+_0x5e5b('0x44')][_0x5e5b('0x45')](_0x4f110f,{'UserId':_0x48b3b8[_0x5e5b('0x1a')][_0x5e5b('0x46')]})['catch'](function(_0x690f8c){logger[_0x5e5b('0x39')]('error\x20update\x20queue\x20report');});}}return _0x5da9c0({'code':0xc8,'message':_0x48b3b8});}catch(_0x3c9888){logger[_0x5e5b('0x39')](_0x3c9888[_0x5e5b('0x3e')]);return _0x54729b(_0x3c1ede['error'](0x1f4,_0x3c9888));}}logger[_0x5e5b('0x39')](_0x5e5b('0x47'));return _0x54729b(_0x3c1ede[_0x5e5b('0x39')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x3877e9){var _0x2e04d6=this;return new Promise(function(_0x239804,_0x4a4e0f){if(_0x3877e9['agent']&&_0x3877e9[_0x5e5b('0x3f')]['id']){try{if(_0x49edd0['agents'][_0x3877e9['agent']['id']]){_0x49edd0[_0x5e5b('0x40')][_0x3877e9[_0x5e5b('0x3f')]['id']][_0x5e5b('0x41')]=![];_0x49edd0['agents'][_0x3877e9[_0x5e5b('0x3f')]['id']][_0x5e5b('0x48')]=undefined;}return _0x239804({'code':0xc8,'message':_0x3877e9});}catch(_0x148032){logger[_0x5e5b('0x39')](_0x148032[_0x5e5b('0x3e')]);return _0x4a4e0f(_0x2e04d6[_0x5e5b('0x39')](0x1f4,_0x148032));}}logger['error']('message\x20is\x20empty');return _0x4a4e0f(_0x2e04d6[_0x5e5b('0x39')](0x1f4,_0x5e5b('0x47')));});},'AbandonInteraction':function(_0x1cc741){var _0x357e55=this;return new Promise(function(_0x54542b,_0x477af0){if(_0x1cc741['channel']&&_0x1cc741[_0x5e5b('0x1b')]&&_0x1cc741[_0x5e5b('0x1b')]['id']){try{var _0x3911f4=getId(_0x1cc741[_0x5e5b('0x19')],_0x1cc741[_0x5e5b('0x1a')]?_0x1cc741[_0x5e5b('0x1a')]['id']:0x0,_0x1cc741[_0x5e5b('0x1b')]?_0x1cc741[_0x5e5b('0x1b')]['id']:0x0);if(_0x49edd0['rules'][_0x3911f4]){_0x49edd0[_0x5e5b('0x18')][_0x3911f4][_0x5e5b('0x42')](_0x5e5b('0x43'));}return _0x54542b({'code':0xc8,'message':_0x1cc741});}catch(_0x1aea38){logger[_0x5e5b('0x39')](_0x1aea38['stack']);return _0x477af0(_0x357e55[_0x5e5b('0x39')](0x1f4,_0x1aea38));}}logger[_0x5e5b('0x39')](_0x5e5b('0x47'));return _0x477af0(_0x357e55[_0x5e5b('0x39')](0x1f4,_0x5e5b('0x47')));});},'AgentCapacity':function(_0x5207e0){var _0x13fb51=this;return new Promise(function(_0x5d9ff9,_0x29b4e4){if(_0x49edd0['agents'][_0x5e5b('0x49')](_0x5207e0['id'])){for(var _0x33bb4a in _0x5207e0[_0x5e5b('0x4a')]){if(_0x5207e0[_0x5e5b('0x4a')][_0x5e5b('0x49')](_0x33bb4a)){if(_0x49edd0[_0x5e5b('0x40')][_0x5207e0['id']]['hasOwnProperty'](_0x33bb4a+_0x5e5b('0x4b'))){_0x49edd0[_0x5e5b('0x40')][_0x5207e0['id']][_0x33bb4a+_0x5e5b('0x4b')]=parseInt(_0x5207e0[_0x5e5b('0x4a')][_0x33bb4a],0xa);}}}_0x49edd0['agents'][_0x5207e0['id']]['updateRealtime']();return _0x5d9ff9({'code':0xc8,'message':_0x49edd0[_0x5e5b('0x40')][_0x5207e0['id']]});}else{return _0x29b4e4(_0x13fb51[_0x5e5b('0x39')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x44338f){return new Promise(function(_0x2eabcd,_0x517f76){var _0x470042=_[_0x5e5b('0x4c')](_0x49edd0['agents']);_0x2eabcd({'count':_0x470042[_0x5e5b('0x1e')],'rows':_0x470042});});},'ChatQueues':function(_0x61faf2){return new Promise(function(_0x494b1d,_0x4795a7){var _0x4a6ff6=[];for(var _0x473f20 in _0x49edd0[_0x5e5b('0x4d')]){if(_0x49edd0[_0x5e5b('0x4d')][_0x5e5b('0x49')](_0x473f20)){var _0xe8327e=_0x49edd0['chatQueues'][_0x473f20];var _0x28d834={'id':_0xe8327e['id'],'available':_0xe8327e[_0x5e5b('0x4e')],'loggedIn':_0xe8327e['loggedIn'],'name':_0xe8327e[_0x5e5b('0x4f')],'paused':_0xe8327e['paused'],'waiting':_0xe8327e['waiting']};_0x4a6ff6[_0x5e5b('0x28')](_0x28d834);}}_0x494b1d({'count':_0x4a6ff6[_0x5e5b('0x1e')],'rows':_0x4a6ff6});});},'MailQueues':function(_0x454026){return new Promise(function(_0x15b801,_0x2054fa){var _0x2d9375=[];for(var _0x2dc365 in _0x49edd0['mailQueues']){if(_0x49edd0[_0x5e5b('0x50')][_0x5e5b('0x49')](_0x2dc365)){var _0x548aa0=_0x49edd0[_0x5e5b('0x50')][_0x2dc365];var _0x3cc637={'id':_0x548aa0['id'],'available':_0x548aa0[_0x5e5b('0x4e')],'loggedIn':_0x548aa0[_0x5e5b('0x51')],'name':_0x548aa0[_0x5e5b('0x4f')],'paused':_0x548aa0[_0x5e5b('0x52')],'waiting':_0x548aa0[_0x5e5b('0x53')]};_0x2d9375[_0x5e5b('0x28')](_0x3cc637);}}_0x15b801({'count':_0x2d9375['length'],'rows':_0x2d9375});});},'OpenchannelQueues':function(_0x2c8b25){return new Promise(function(_0x1a3d7b,_0x3c57ad){var _0x271af6=[];for(var _0xc7171a in _0x49edd0['openchannelQueues']){if(_0x49edd0[_0x5e5b('0x54')][_0x5e5b('0x49')](_0xc7171a)){var _0x2d7af1=_0x49edd0[_0x5e5b('0x54')][_0xc7171a];var _0x2b69ae={'id':_0x2d7af1['id'],'available':_0x2d7af1[_0x5e5b('0x4e')],'loggedIn':_0x2d7af1['loggedIn'],'name':_0x2d7af1[_0x5e5b('0x4f')],'paused':_0x2d7af1[_0x5e5b('0x52')],'waiting':_0x2d7af1[_0x5e5b('0x53')]};_0x271af6['push'](_0x2b69ae);}}_0x1a3d7b({'count':_0x271af6[_0x5e5b('0x1e')],'rows':_0x271af6});});},'SmsQueues':function(_0x11d727){return new Promise(function(_0x4322cd,_0x2cf0d9){var _0x344c25=[];for(var _0x4639b1 in _0x49edd0[_0x5e5b('0x55')]){if(_0x49edd0[_0x5e5b('0x55')][_0x5e5b('0x49')](_0x4639b1)){var _0x4fe5fb=_0x49edd0[_0x5e5b('0x55')][_0x4639b1];var _0x587be8={'id':_0x4fe5fb['id'],'available':_0x4fe5fb[_0x5e5b('0x4e')],'loggedIn':_0x4fe5fb[_0x5e5b('0x51')],'name':_0x4fe5fb['name'],'paused':_0x4fe5fb['paused'],'waiting':_0x4fe5fb[_0x5e5b('0x53')]};_0x344c25[_0x5e5b('0x28')](_0x587be8);}}_0x4322cd({'count':_0x344c25['length'],'rows':_0x344c25});});},'FaxQueues':function(_0x42440f){return new Promise(function(_0x5edb99,_0x5d1ca4){var _0x383de8=[];for(var _0x5cb712 in _0x49edd0[_0x5e5b('0x56')]){if(_0x49edd0[_0x5e5b('0x56')][_0x5e5b('0x49')](_0x5cb712)){var _0x4ff92a=_0x49edd0[_0x5e5b('0x56')][_0x5cb712];var _0x14fd35={'id':_0x4ff92a['id'],'available':_0x4ff92a[_0x5e5b('0x4e')],'loggedIn':_0x4ff92a['loggedIn'],'name':_0x4ff92a[_0x5e5b('0x4f')],'paused':_0x4ff92a[_0x5e5b('0x52')],'waiting':_0x4ff92a['waiting']};_0x383de8[_0x5e5b('0x28')](_0x14fd35);}}_0x5edb99({'count':_0x383de8['length'],'rows':_0x383de8});});},'WhatsappQueues':function(_0x4c580a){return new Promise(function(_0x1e6f7c,_0x355793){var _0x1284d8=[];for(var _0x2f8255 in _0x49edd0[_0x5e5b('0x57')]){if(_0x49edd0['whatsappQueues'][_0x5e5b('0x49')](_0x2f8255)){var _0x38b1a1=_0x49edd0['whatsappQueues'][_0x2f8255];var _0x51449e={'id':_0x38b1a1['id'],'available':_0x38b1a1[_0x5e5b('0x4e')],'loggedIn':_0x38b1a1[_0x5e5b('0x51')],'name':_0x38b1a1[_0x5e5b('0x4f')],'paused':_0x38b1a1[_0x5e5b('0x52')],'waiting':_0x38b1a1[_0x5e5b('0x53')]};_0x1284d8[_0x5e5b('0x28')](_0x51449e);}}_0x1e6f7c({'count':_0x1284d8['length'],'rows':_0x1284d8});});},'ChatQueuesWaitingInteractions':function(_0x2f1634){return new Promise(function(_0x3b9ccf,_0x21ded8){var _0x548daf=_['values'](_0x49edd0[_0x5e5b('0x58')]);_0x3b9ccf({'count':_0x548daf[_0x5e5b('0x1e')],'rows':_0x548daf});});},'MailQueuesWaitingInteractions':function(_0x2e0b8c){return new Promise(function(_0x5aaf96,_0x19348d){var _0x39a34d=_[_0x5e5b('0x4c')](_0x49edd0['mailQueuesWaitingInteractions']);_0x5aaf96({'count':_0x39a34d[_0x5e5b('0x1e')],'rows':_0x39a34d});});},'OpenchannelQueuesWaitingInteractions':function(_0x40cc5f){return new Promise(function(_0x3836a6,_0x4d14cd){var _0x137acd=_[_0x5e5b('0x4c')](_0x49edd0[_0x5e5b('0x59')]);_0x3836a6({'count':_0x137acd[_0x5e5b('0x1e')],'rows':_0x137acd});});},'SmsQueuesWaitingInteractions':function(_0x34d3da){return new Promise(function(_0x2d4646,_0x500f7a){var _0x202d01=_[_0x5e5b('0x4c')](_0x49edd0['smsQueuesWaitingInteractions']);_0x2d4646({'count':_0x202d01[_0x5e5b('0x1e')],'rows':_0x202d01});});},'FaxQueuesWaitingInteractions':function(_0x505d48){return new Promise(function(_0x47159c,_0x263c07){var _0x1d8edf=_[_0x5e5b('0x4c')](_0x49edd0[_0x5e5b('0x5a')]);_0x47159c({'count':_0x1d8edf['length'],'rows':_0x1d8edf});});},'WhatsappQueuesWaitingInteractions':function(_0x1255a4){return new Promise(function(_0x31c762,_0x34db33){var _0x48d14=_[_0x5e5b('0x4c')](_0x49edd0[_0x5e5b('0x5b')]);_0x31c762({'count':_0x48d14['length'],'rows':_0x48d14});});}};var _0x1d5fe8=jayson['server'](_0x227417)[_0x5e5b('0x5c')]();_0x1d5fe8['on'](_0x5e5b('0x39'),function(_0x5d7a07){logger['error'](JSON[_0x5e5b('0x5d')](_0x5d7a07));return _0x4ff37b(_0x5d7a07);});_0x1d5fe8[_0x5e5b('0x17')](0x232c,_0x5e5b('0x5e'),function(){console[_0x5e5b('0x5f')](_0x5e5b('0x60'),0x232c);return _0x2e92c3(_0x5e5b('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 807f1e1..b8d16bf 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 _0xd66e=['when','log','util','bluebird','jayson/promise','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0x230e3,_0x46b246){var _0x111dbc=function(_0x247f7b){while(--_0x247f7b){_0x230e3['push'](_0x230e3['shift']());}};_0x111dbc(++_0x46b246);}(_0xd66e,0x152));var _0xed66=function(_0x4be730,_0x341fe4){_0x4be730=_0x4be730-0x0;var _0x54bbe5=_0xd66e[_0x4be730];return _0x54bbe5;};'use strict';var util=require(_0xed66('0x0'));var BPromise=require(_0xed66('0x1'));var jayson=require(_0xed66('0x2'));var _=require('lodash');var logger=require(_0xed66('0x3'))('routing');var client=jayson[_0xed66('0x4')][_0xed66('0x5')]({'port':0x232a});function request(_0x12ac67,_0x3270e1){return new BPromise(function(_0x4382d5,_0x1e2947){return client['request'](_0x12ac67,_0x3270e1)[_0xed66('0x6')](function(_0x28eca3){if(_0x28eca3[_0xed66('0x7')]){return _0x1e2947(_0x28eca3[_0xed66('0x7')][_0xed66('0x8')]);}else{return _0x4382d5(_0x28eca3[_0xed66('0x9')]);}})[_0xed66('0xa')](function(_0x2efbb9){return _0x1e2947(_0x2efbb9);});});}exports[_0xed66('0xb')]=function(_0x52bb67,_0x1427f7,_0x1cb49d){return function(_0x5e5b45){if(_0x1cb49d['rules']&&!_0x1cb49d[_0xed66('0xc')][_0x52bb67]){logger[_0xed66('0xd')](_0xed66('0xe'),_0x52bb67);return _0x5e5b45[_0xed66('0xf')]();}var _0x505d91=[];for(var _0x48c14f=0x0;_0x48c14f<_0x1427f7['length'];_0x48c14f+=0x1){_0x505d91['push'](request(_0xed66('0x10'),{'command':util[_0xed66('0x11')](_0xed66('0x12'),_0x1427f7[_0x48c14f])})[_0xed66('0x6')](function(_0x15e28f){return _0x15e28f&&_0x15e28f[_0xed66('0x8')]&&_0x15e28f[_0xed66('0x8')]['indexOf'](_0xed66('0x13'))>=0x0?!![]:![];})[_0xed66('0xa')](function(_0x14f4a3){logger[_0xed66('0x7')](_0xed66('0x14'),_0x52bb67,_0x1427f7[_0x48c14f]);}));}BPromise[_0xed66('0x15')](_0x505d91)[_0xed66('0x6')](function(_0x5cea6a){var _0x2ab52d=_[_0xed66('0x16')](_0x5cea6a);logger[_0xed66('0xd')](_0xed66('0x17'),_0x52bb67,_0x1427f7[_0xed66('0x18')](_0xed66('0x19')),_0x2ab52d);_0x5e5b45[_0xed66('0x1a')](_0x2ab52d);})[_0xed66('0xa')](function(_0x1c70d8){console[_0xed66('0x1b')](_0x1c70d8);logger[_0xed66('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x52bb67,_0x1427f7[_0xed66('0x18')](_0xed66('0x19')),_0x1c70d8['stack']);_0x5e5b45[_0xed66('0xf')]();});};}; \ No newline at end of file +var _0x116c=['join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','lodash','routing','client','http','request','then','error','result','catch','rules','info','stop','length','push','Command','message','indexOf','true','[%s][INTERVAL]\x20%s','some'];(function(_0x1e2233,_0x2db264){var _0x510318=function(_0x4e8f3d){while(--_0x4e8f3d){_0x1e2233['push'](_0x1e2233['shift']());}};_0x510318(++_0x2db264);}(_0x116c,0x11e));var _0xc116=function(_0x87f858,_0x585566){_0x87f858=_0x87f858-0x0;var _0x8a95ae=_0x116c[_0x87f858];return _0x8a95ae;};'use strict';var util=require(_0xc116('0x0'));var BPromise=require(_0xc116('0x1'));var jayson=require('jayson/promise');var _=require(_0xc116('0x2'));var logger=require('../../../config/logger')(_0xc116('0x3'));var client=jayson[_0xc116('0x4')][_0xc116('0x5')]({'port':0x232a});function request(_0x50358f,_0x1eb522){return new BPromise(function(_0x4d9354,_0x40d8e3){return client[_0xc116('0x6')](_0x50358f,_0x1eb522)[_0xc116('0x7')](function(_0x1626e7){if(_0x1626e7[_0xc116('0x8')]){return _0x40d8e3(_0x1626e7[_0xc116('0x8')]['message']);}else{return _0x4d9354(_0x1626e7[_0xc116('0x9')]);}})[_0xc116('0xa')](function(_0x4d2c76){return _0x40d8e3(_0x4d2c76);});});}exports['condition']=function(_0x456202,_0x3ac795,_0x2d971f){return function(_0x1e6ff9){if(_0x2d971f['rules']&&!_0x2d971f[_0xc116('0xb')][_0x456202]){logger[_0xc116('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x456202);return _0x1e6ff9[_0xc116('0xd')]();}var _0x4ce9d1=[];for(var _0x2ccc1c=0x0;_0x2ccc1c<_0x3ac795[_0xc116('0xe')];_0x2ccc1c+=0x1){_0x4ce9d1[_0xc116('0xf')](request(_0xc116('0x10'),{'command':util['format']('iftime\x20%s',_0x3ac795[_0x2ccc1c])})[_0xc116('0x7')](function(_0x5ac728){return _0x5ac728&&_0x5ac728[_0xc116('0x11')]&&_0x5ac728[_0xc116('0x11')][_0xc116('0x12')](_0xc116('0x13'))>=0x0?!![]:![];})[_0xc116('0xa')](function(_0x47a65b){logger[_0xc116('0x8')](_0xc116('0x14'),_0x456202,_0x3ac795[_0x2ccc1c]);}));}BPromise['all'](_0x4ce9d1)['then'](function(_0x16a9e2){var _0x47bc16=_[_0xc116('0x15')](_0x16a9e2);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x456202,_0x3ac795[_0xc116('0x16')](_0xc116('0x17')),_0x47bc16);_0x1e6ff9[_0xc116('0x18')](_0x47bc16);})[_0xc116('0xa')](function(_0x4f9c4d){console[_0xc116('0x19')](_0x4f9c4d);logger[_0xc116('0x8')](_0xc116('0x1a'),_0x456202,_0x3ac795[_0xc116('0x16')](_0xc116('0x17')),_0x4f9c4d[_0xc116('0x1b')]);_0x1e6ff9[_0xc116('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 03bed4d..7b83127 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 _0x6b20=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','transferexten','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acwtime','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','error','queuecallerabandon','forIn'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6b20,0xd1));var _0x06b2=function(_0x31913b,_0x5ba9e6){_0x31913b=_0x31913b-0x0;var _0x225e7c=_0x6b20[_0x31913b];return _0x225e7c;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x2d5e24,_0x54947c){utils[_0x06b2('0x2')](util[_0x06b2('0x3')](_0x06b2('0x4'),_0x2d5e24['uniqueid'],_0x2d5e24[_0x06b2('0x5')],_0x2d5e24[_0x06b2('0x6')],_0x2d5e24[_0x06b2('0x7')],_0x2d5e24[_0x06b2('0x8')],_0x2d5e24[_0x06b2('0x9')],_0x2d5e24[_0x06b2('0xa')],_0x2d5e24[_0x06b2('0xb')]));if(_0x2d5e24['queue']){utils[_0x06b2('0xc')](_0x2d5e24[_0x06b2('0x6')])[_0x06b2('0xd')](function(_0x58538a){if(_0x58538a){_0x2d5e24[_0x06b2('0xe')]=_0x58538a['type'];_0x2d5e24[_0x06b2('0xf')]=_0x2d5e24['agentcomplete']?_0x58538a['acw']:![];_0x2d5e24[_0x06b2('0x10')]=_0x2d5e24[_0x06b2('0xf')]?_0x58538a['acwTimeout']:0x0;}utils[_0x06b2('0x11')](_0x06b2('0x12'),_0x2d5e24);});}else{utils[_0x06b2('0x11')](_0x06b2('0x12'),_0x2d5e24);}if(_0x54947c){delete transfers[_0x2d5e24[_0x06b2('0x13')]];}else{delete agents[_0x2d5e24[_0x06b2('0x14')]];}}exports[_0x06b2('0x15')]=function(_0x926bf6){try{utils[_0x06b2('0x16')](util[_0x06b2('0x3')](_0x06b2('0x17'),_0x926bf6[_0x06b2('0x13')]),_0x926bf6);agents[_0x926bf6[_0x06b2('0x14')]]=_0x926bf6;agents[_0x926bf6['destuniqueid']][_0x06b2('0x18')]=utils[_0x06b2('0x19')]();agents[_0x926bf6[_0x06b2('0x14')]][_0x06b2('0xb')]=_0x06b2('0x1a');agents[_0x926bf6[_0x06b2('0x14')]]['connectedlinenum']=null;agents[_0x926bf6[_0x06b2('0x14')]][_0x06b2('0x1b')]=null;utils['info'](util[_0x06b2('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x926bf6['uniqueid'],agents[_0x926bf6[_0x06b2('0x14')]][_0x06b2('0x7')],_0x926bf6[_0x06b2('0x14')]));}catch(_0x2182f3){utils['error'](util[_0x06b2('0x3')](_0x06b2('0x17'),_0x926bf6[_0x06b2('0x13')]),_0x2182f3);}};exports[_0x06b2('0x1c')]=function(_0xe28985){try{if(!_[_0x06b2('0x1d')](agents[_0xe28985[_0x06b2('0x14')]])){utils['debug'](util[_0x06b2('0x3')](_0x06b2('0x1e'),_0xe28985[_0x06b2('0x13')]),_0xe28985);utils[_0x06b2('0x2')](util['format']('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0xe28985[_0x06b2('0x13')],agents[_0xe28985[_0x06b2('0x14')]]['membername'],_0xe28985[_0x06b2('0x14')]));agents[_0xe28985['destuniqueid']][_0x06b2('0x1c')]=!![];agents[_0xe28985[_0x06b2('0x14')]][_0x06b2('0x1f')]=utils['now']();agents[_0xe28985[_0x06b2('0x14')]][_0x06b2('0xb')]=_0x06b2('0x20');agents[_0xe28985[_0x06b2('0x14')]][_0x06b2('0x21')]='timeout';agents[_0xe28985[_0x06b2('0x14')]][_0x06b2('0x22')]=_0xe28985[_0x06b2('0x23')]?parseInt(_0xe28985[_0x06b2('0x23')])/0x3e8:0x0;agents[_0xe28985[_0x06b2('0x14')]][_0x06b2('0x24')]=0x0;unanswered['push'](_0xe28985[_0x06b2('0x14')]);}}catch(_0x2a3228){utils[_0x06b2('0x25')](util[_0x06b2('0x3')](_0x06b2('0x1e'),_0xe28985[_0x06b2('0x13')]),_0x2a3228);}};exports[_0x06b2('0x26')]=function(_0x51698b){try{_[_0x06b2('0x27')](agents,function(_0x32eeea,_0x1637c2){if(_0x32eeea[_0x06b2('0x13')]==_0x51698b[_0x06b2('0x13')]&&!_[_0x06b2('0x28')](unanswered,_0x32eeea[_0x06b2('0x14')])){utils[_0x06b2('0x16')](util['format'](_0x06b2('0x29'),_0x51698b[_0x06b2('0x13')]),_0x51698b);utils[_0x06b2('0x2')](util[_0x06b2('0x3')](_0x06b2('0x2a'),_0x51698b[_0x06b2('0x13')],_0x32eeea[_0x06b2('0x7')],_0x32eeea['destuniqueid']));_0x32eeea['agentringnoanswer']=!![];_0x32eeea[_0x06b2('0x1f')]=utils[_0x06b2('0x19')]();_0x32eeea[_0x06b2('0xb')]='abandoned';_0x32eeea[_0x06b2('0x21')]=_0x06b2('0x2b');_0x32eeea[_0x06b2('0x22')]=_0x51698b[_0x06b2('0x22')];_0x32eeea[_0x06b2('0x24')]=0x0;writeDB(_0x32eeea);}});}catch(_0x27f172){utils['error'](util[_0x06b2('0x3')](_0x06b2('0x29'),_0x51698b[_0x06b2('0x13')]),_0x27f172);}};exports['agentconnect']=function(_0x268780){try{if(agents[_0x268780[_0x06b2('0x14')]]){utils['debug'](util[_0x06b2('0x3')](_0x06b2('0x2c'),_0x268780[_0x06b2('0x13')]),_0x268780);utils[_0x06b2('0x2')](util[_0x06b2('0x3')](_0x06b2('0x2d'),_0x268780[_0x06b2('0x13')],agents[_0x268780[_0x06b2('0x14')]][_0x06b2('0x7')],_0x268780[_0x06b2('0x14')]));agents[_0x268780[_0x06b2('0x14')]][_0x06b2('0x2e')]=utils['now']();agents[_0x268780[_0x06b2('0x14')]]['connectedlinenum']=_0x268780['connectedlinenum'];agents[_0x268780[_0x06b2('0x14')]]['connectedlinename']=_0x268780[_0x06b2('0x1b')];agents[_0x268780['destuniqueid']][_0x06b2('0x22')]=_0x268780[_0x06b2('0x23')];agents[_0x268780[_0x06b2('0x14')]][_0x06b2('0xb')]=_0x06b2('0x2f');_['forIn'](agents,function(_0x404eab,_0xee3ec6){if(_0x404eab[_0x06b2('0x14')]!=_0x268780[_0x06b2('0x14')]&&_0x404eab[_0x06b2('0x13')]==_0x268780[_0x06b2('0x13')]){_0x404eab['talktime']=0x0;_0x404eab[_0x06b2('0x22')]=_0x268780[_0x06b2('0x23')];_0x404eab['agentringnoanswer']=!![];_0x404eab['agentringnoanswerAt']=utils[_0x06b2('0x19')]();_0x404eab[_0x06b2('0xb')]=_0x06b2('0x30');_0x404eab[_0x06b2('0x21')]=_0x06b2('0x30');_0x404eab[_0x06b2('0x31')]=_0x268780[_0x06b2('0x14')];_0x404eab[_0x06b2('0x32')]=_0x268780[_0x06b2('0x7')];writeDB(_0x404eab);}});}}catch(_0x117bf4){utils[_0x06b2('0x25')](util[_0x06b2('0x3')](_0x06b2('0x2c'),_0x268780[_0x06b2('0x13')]),_0x117bf4);}};exports[_0x06b2('0x33')]=function(_0x190781){try{if(!_[_0x06b2('0x1d')](agents[_0x190781[_0x06b2('0x14')]])){utils[_0x06b2('0x16')](util['format'](_0x06b2('0x34'),_0x190781[_0x06b2('0x13')]),_0x190781);utils[_0x06b2('0x2')](util[_0x06b2('0x3')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x190781[_0x06b2('0x13')],agents[_0x190781[_0x06b2('0x14')]]['membername'],_0x190781[_0x06b2('0x14')]));agents[_0x190781[_0x06b2('0x14')]]['agentcomplete']=!![];agents[_0x190781[_0x06b2('0x14')]][_0x06b2('0x35')]=utils['now']();agents[_0x190781['destuniqueid']]['talktime']=utils[_0x06b2('0x36')](agents[_0x190781[_0x06b2('0x14')]][_0x06b2('0x35')],agents[_0x190781[_0x06b2('0x14')]][_0x06b2('0x2e')]);agents[_0x190781['destuniqueid']]['reason']=_0x190781[_0x06b2('0x21')];agents[_0x190781[_0x06b2('0x14')]][_0x06b2('0xb')]=_0x06b2('0x37');writeDB(agents[_0x190781[_0x06b2('0x14')]]);}}catch(_0xc18216){utils['error'](util[_0x06b2('0x3')](_0x06b2('0x34'),_0x190781[_0x06b2('0x13')]),_0xc18216);}};exports[_0x06b2('0x38')]=function(_0x146c5c){try{if(!_[_0x06b2('0x1d')](agents[_0x146c5c['transfereruniqueid']])){utils[_0x06b2('0x16')](util[_0x06b2('0x3')](_0x06b2('0x39'),_0x146c5c[_0x06b2('0x13')]),_0x146c5c);utils['info'](util[_0x06b2('0x3')](_0x06b2('0x3a'),_0x146c5c[_0x06b2('0x13')],agents[_0x146c5c[_0x06b2('0x3b')]]['membername'],agents[_0x146c5c[_0x06b2('0x3b')]][_0x06b2('0x13')]));agents[_0x146c5c[_0x06b2('0x3b')]][_0x06b2('0x3c')]=!![];agents[_0x146c5c[_0x06b2('0x3b')]][_0x06b2('0x3d')]=_0x06b2('0x3e');agents[_0x146c5c[_0x06b2('0x3b')]]['transferexten']=_0x146c5c[_0x06b2('0x3f')];agents[_0x146c5c[_0x06b2('0x3b')]][_0x06b2('0x40')]=agents[_0x146c5c[_0x06b2('0x3b')]][_0x06b2('0x13')];}}catch(_0x2f75a0){utils['error'](util['format'](_0x06b2('0x39'),_0x146c5c['uniqueid']),_0x2f75a0);}};exports['attendedtransfer']=function(_0x2daf62){try{utils['debug'](util[_0x06b2('0x3')](_0x06b2('0x41'),_0x2daf62[_0x06b2('0x42')]),_0x2daf62);if(_0x2daf62[_0x06b2('0x42')]==_0x2daf62[_0x06b2('0x43')]){if(!_[_0x06b2('0x1d')](agents[_0x2daf62[_0x06b2('0x44')]])){utils[_0x06b2('0x2')](util[_0x06b2('0x3')](_0x06b2('0x45'),_0x2daf62['origtransfereruniqueid'],agents[_0x2daf62['secondtransfereruniqueid']][_0x06b2('0x7')]));agents[_0x2daf62[_0x06b2('0x44')]]['transfer']=!![];agents[_0x2daf62[_0x06b2('0x44')]][_0x06b2('0x3d')]=_0x06b2('0x46');agents[_0x2daf62[_0x06b2('0x44')]]['transferexten']=_0x2daf62['origtransfererexten'];agents[_0x2daf62['secondtransfereruniqueid']][_0x06b2('0x40')]=_0x2daf62['origtransfereruniqueid'];}if(_0x2daf62['transfereeuniqueid']&&agents[_0x2daf62[_0x06b2('0x47')]]){agents[_0x2daf62[_0x06b2('0x47')]][_0x06b2('0x48')]=0x1;transfers[_0x2daf62[_0x06b2('0x47')]]=_[_0x06b2('0x49')](agents[_0x2daf62[_0x06b2('0x47')]]);transfers[_0x2daf62['transfereeuniqueid']][_0x06b2('0x9')]=agents[_0x2daf62[_0x06b2('0x44')]]['calleridnum'];transfers[_0x2daf62[_0x06b2('0x47')]][_0x06b2('0x4a')]=agents[_0x2daf62[_0x06b2('0x44')]][_0x06b2('0x4a')];transfers[_0x2daf62[_0x06b2('0x47')]][_0x06b2('0x18')]=utils[_0x06b2('0x19')]();transfers[_0x2daf62[_0x06b2('0x47')]][_0x06b2('0x2e')]=utils[_0x06b2('0x19')]();transfers[_0x2daf62[_0x06b2('0x47')]][_0x06b2('0x22')]=0x0;transfers[_0x2daf62['transfereeuniqueid']][_0x06b2('0x48')]=0x2;}}else if(_0x2daf62[_0x06b2('0x44')]==_0x2daf62['secondtransfererlinkedid']){if(!_[_0x06b2('0x1d')](agents[_0x2daf62[_0x06b2('0x42')]])){utils[_0x06b2('0x2')](util[_0x06b2('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2daf62[_0x06b2('0x42')],agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x7')]));agents[_0x2daf62['origtransfereruniqueid']][_0x06b2('0x3c')]=!![];agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x3d')]=_0x06b2('0x46');agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x4b')]=_0x2daf62[_0x06b2('0x4c')];agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x40')]=_0x2daf62['secondtransfereruniqueid'];}if(_0x2daf62['transfertargetuniqueid']&&agents[_0x2daf62['transfertargetuniqueid']]){agents[_0x2daf62['transfertargetuniqueid']][_0x06b2('0x48')]=0x1;transfers[_0x2daf62['transfertargetuniqueid']]=_[_0x06b2('0x49')](agents[_0x2daf62[_0x06b2('0x4d')]]);transfers[_0x2daf62[_0x06b2('0x4d')]][_0x06b2('0x9')]=agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x9')];transfers[_0x2daf62['transfertargetuniqueid']]['calleridname']=agents[_0x2daf62[_0x06b2('0x42')]][_0x06b2('0x4a')];transfers[_0x2daf62['transfertargetuniqueid']][_0x06b2('0x18')]=utils[_0x06b2('0x19')]();transfers[_0x2daf62[_0x06b2('0x4d')]][_0x06b2('0x2e')]=utils[_0x06b2('0x19')]();transfers[_0x2daf62[_0x06b2('0x4d')]]['holdtime']=0x0;transfers[_0x2daf62[_0x06b2('0x4d')]]['agententerreason']=0x2;}}}catch(_0x4023b0){utils[_0x06b2('0x25')](util[_0x06b2('0x3')]('[%s][agents][attendedtransfer]',_0x2daf62[_0x06b2('0x42')]),_0x4023b0);}};exports[_0x06b2('0x4e')]=function(_0x461c4d){try{utils['debug'](util[_0x06b2('0x3')]('[%s][agents][hangup]',_0x461c4d[_0x06b2('0x13')]),_0x461c4d);if(agents[_0x461c4d[_0x06b2('0x13')]]&&agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x21')]===_0x06b2('0x20')){if(_0x461c4d[_0x06b2('0x4f')]==='21'){agents[_0x461c4d['uniqueid']][_0x06b2('0x21')]=_0x06b2('0x50');agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0xb')]='rejected';}utils[_0x06b2('0x2')](util[_0x06b2('0x3')](_0x06b2('0x51'),_0x461c4d['uniqueid'],agents[_0x461c4d['uniqueid']][_0x06b2('0x7')],agents[_0x461c4d['uniqueid']][_0x06b2('0x21')],agents[_0x461c4d['uniqueid']]['lastevent']));writeDB(agents[_0x461c4d[_0x06b2('0x13')]]);var _0x38647d=unanswered['indexOf'](_0x461c4d[_0x06b2('0x13')]);if(_0x38647d>-0x1){unanswered[_0x06b2('0x52')](_0x38647d,0x1);}}if(transfers[_0x461c4d[_0x06b2('0x13')]]){transfers[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x33')]=!![];transfers[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x35')]=utils[_0x06b2('0x19')]();transfers[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x24')]=utils[_0x06b2('0x36')](transfers[_0x461c4d['uniqueid']][_0x06b2('0x35')],transfers[_0x461c4d['uniqueid']]['agentconnectAt']);transfers[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x21')]='agent';transfers[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0xb')]=_0x06b2('0x37');utils['info'](util[_0x06b2('0x3')](_0x06b2('0x51'),_0x461c4d['uniqueid'],transfers[_0x461c4d['uniqueid']]['membername'],transfers[_0x461c4d['uniqueid']][_0x06b2('0x21')],transfers[_0x461c4d['uniqueid']][_0x06b2('0xb')]));writeDB(transfers[_0x461c4d[_0x06b2('0x13')]],!![]);}if(agents[_0x461c4d[_0x06b2('0x13')]]&&agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x2e')]){agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x33')]=!![];agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x35')]=utils[_0x06b2('0x19')]();agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x24')]=utils[_0x06b2('0x36')](agents[_0x461c4d['uniqueid']]['agentcompleteAt'],agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x2e')]);agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x21')]=agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x3c')]?'transfer':'agent';agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0xb')]=_0x06b2('0x37');utils[_0x06b2('0x2')](util[_0x06b2('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x461c4d[_0x06b2('0x13')],agents[_0x461c4d['uniqueid']]['membername'],agents[_0x461c4d[_0x06b2('0x13')]][_0x06b2('0x21')],agents[_0x461c4d['uniqueid']]['lastevent']));writeDB(agents[_0x461c4d[_0x06b2('0x13')]]);}}catch(_0x3fa469){utils['error'](util['format']('[%s][agents][hangup]',_0x461c4d['uniqueid']),_0x3fa469);}}; \ No newline at end of file +var _0x1339=['talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','error','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','clone','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x1339,0x1ed));var _0x9133=function(_0x6ff17e,_0x104c99){_0x6ff17e=_0x6ff17e-0x0;var _0x1dec4d=_0x1339[_0x6ff17e];return _0x1dec4d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x9133('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2a91b2,_0x4611be){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3'),_0x2a91b2[_0x9133('0x4')],_0x2a91b2[_0x9133('0x5')],_0x2a91b2['queue'],_0x2a91b2[_0x9133('0x6')],_0x2a91b2[_0x9133('0x7')],_0x2a91b2[_0x9133('0x8')],_0x2a91b2['connectedlinenum'],_0x2a91b2[_0x9133('0x9')]));if(_0x2a91b2[_0x9133('0xa')]){utils[_0x9133('0xb')](_0x2a91b2[_0x9133('0xa')])[_0x9133('0xc')](function(_0x3a7a80){if(_0x3a7a80){_0x2a91b2[_0x9133('0xd')]=_0x3a7a80[_0x9133('0xd')];_0x2a91b2[_0x9133('0xe')]=_0x2a91b2[_0x9133('0xf')]?_0x3a7a80['acw']:![];_0x2a91b2[_0x9133('0x10')]=_0x2a91b2[_0x9133('0xe')]?_0x3a7a80[_0x9133('0x11')]:0x0;}utils[_0x9133('0x12')](_0x9133('0x13'),_0x2a91b2);});}else{utils[_0x9133('0x12')]('CreateVoiceAgentReport',_0x2a91b2);}if(_0x4611be){delete transfers[_0x2a91b2[_0x9133('0x4')]];}else{delete agents[_0x2a91b2[_0x9133('0x14')]];}}exports['agentcalled']=function(_0x5283a3){try{utils[_0x9133('0x15')](util['format'](_0x9133('0x16'),_0x5283a3[_0x9133('0x4')]),_0x5283a3);agents[_0x5283a3[_0x9133('0x14')]]=_0x5283a3;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();agents[_0x5283a3['destuniqueid']][_0x9133('0x9')]=_0x9133('0x19');agents[_0x5283a3['destuniqueid']][_0x9133('0x1a')]=null;agents[_0x5283a3[_0x9133('0x14')]][_0x9133('0x1b')]=null;utils[_0x9133('0x1')](util['format'](_0x9133('0x1c'),_0x5283a3['uniqueid'],agents[_0x5283a3[_0x9133('0x14')]]['membername'],_0x5283a3[_0x9133('0x14')]));}catch(_0x1d6d0b){utils['error'](util[_0x9133('0x2')]('[%s][agents][agentcalled]',_0x5283a3[_0x9133('0x4')]),_0x1d6d0b);}};exports['agentringnoanswer']=function(_0x5e4f0c){try{if(!_[_0x9133('0x1d')](agents[_0x5e4f0c['destuniqueid']])){utils[_0x9133('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x5e4f0c['uniqueid']),_0x5e4f0c);utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5e4f0c[_0x9133('0x4')],agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x6')],_0x5e4f0c[_0x9133('0x14')]));agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1e')]=!![];agents[_0x5e4f0c['destuniqueid']][_0x9133('0x1f')]=utils[_0x9133('0x18')]();agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x21')]=_0x9133('0x20');agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x22')]=_0x5e4f0c['ringtime']?parseInt(_0x5e4f0c['ringtime'])/0x3e8:0x0;agents[_0x5e4f0c[_0x9133('0x14')]][_0x9133('0x23')]=0x0;unanswered[_0x9133('0x24')](_0x5e4f0c[_0x9133('0x14')]);}}catch(_0x4de894){utils['error'](util[_0x9133('0x2')](_0x9133('0x25'),_0x5e4f0c[_0x9133('0x4')]),_0x4de894);}};exports[_0x9133('0x26')]=function(_0x390f50){try{_[_0x9133('0x27')](agents,function(_0x48c713,_0x58afe0){if(_0x48c713['uniqueid']==_0x390f50[_0x9133('0x4')]&&!_['includes'](unanswered,_0x48c713[_0x9133('0x14')])){utils[_0x9133('0x15')](util['format'](_0x9133('0x28'),_0x390f50['uniqueid']),_0x390f50);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x29'),_0x390f50['uniqueid'],_0x48c713[_0x9133('0x6')],_0x48c713[_0x9133('0x14')]));_0x48c713[_0x9133('0x1e')]=!![];_0x48c713['agentringnoanswerAt']=utils[_0x9133('0x18')]();_0x48c713[_0x9133('0x9')]=_0x9133('0x2a');_0x48c713['reason']=_0x9133('0x2a');_0x48c713[_0x9133('0x22')]=_0x390f50[_0x9133('0x22')];_0x48c713[_0x9133('0x23')]=0x0;writeDB(_0x48c713);}});}catch(_0x5e4d5e){utils[_0x9133('0x2b')](util[_0x9133('0x2')]('[%s][agents][queuecallerabandon]',_0x390f50[_0x9133('0x4')]),_0x5e4d5e);}};exports[_0x9133('0x2c')]=function(_0x593fbe){try{if(agents[_0x593fbe[_0x9133('0x14')]]){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x2d'),_0x593fbe[_0x9133('0x4')]),_0x593fbe);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x2e'),_0x593fbe['uniqueid'],agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x6')],_0x593fbe['destuniqueid']));agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x2f')]=utils[_0x9133('0x18')]();agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x1a')]=_0x593fbe[_0x9133('0x1a')];agents[_0x593fbe['destuniqueid']]['connectedlinename']=_0x593fbe[_0x9133('0x1b')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x22')]=_0x593fbe[_0x9133('0x30')];agents[_0x593fbe[_0x9133('0x14')]][_0x9133('0x9')]=_0x9133('0x31');_[_0x9133('0x27')](agents,function(_0x720048,_0x5a3f73){if(_0x720048[_0x9133('0x14')]!=_0x593fbe[_0x9133('0x14')]&&_0x720048[_0x9133('0x4')]==_0x593fbe[_0x9133('0x4')]){_0x720048[_0x9133('0x23')]=0x0;_0x720048['holdtime']=_0x593fbe[_0x9133('0x30')];_0x720048[_0x9133('0x1e')]=!![];_0x720048[_0x9133('0x1f')]=utils[_0x9133('0x18')]();_0x720048['lastevent']=_0x9133('0x32');_0x720048[_0x9133('0x21')]=_0x9133('0x32');_0x720048[_0x9133('0x33')]=_0x593fbe[_0x9133('0x14')];_0x720048[_0x9133('0x34')]=_0x593fbe[_0x9133('0x6')];writeDB(_0x720048);}});}}catch(_0x4ca1a3){utils[_0x9133('0x2b')](util['format']('[%s][agents][agentconnect]',_0x593fbe[_0x9133('0x4')]),_0x4ca1a3);}};exports[_0x9133('0xf')]=function(_0x46156d){try{if(!_[_0x9133('0x1d')](agents[_0x46156d[_0x9133('0x14')]])){utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x46156d);utils['info'](util[_0x9133('0x2')](_0x9133('0x36'),_0x46156d[_0x9133('0x4')],agents[_0x46156d['destuniqueid']]['membername'],_0x46156d[_0x9133('0x14')]));agents[_0x46156d[_0x9133('0x14')]]['agentcomplete']=!![];agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x23')]=utils['diffTime'](agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x37')],agents[_0x46156d[_0x9133('0x14')]]['agentconnectAt']);agents[_0x46156d[_0x9133('0x14')]][_0x9133('0x21')]=_0x46156d['reason'];agents[_0x46156d['destuniqueid']][_0x9133('0x9')]=_0x9133('0x38');writeDB(agents[_0x46156d[_0x9133('0x14')]]);}}catch(_0x41fea9){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x35'),_0x46156d[_0x9133('0x4')]),_0x41fea9);}};exports[_0x9133('0x39')]=function(_0xf07fbb){try{if(!_[_0x9133('0x1d')](agents[_0xf07fbb[_0x9133('0x3a')]])){utils['debug'](util['format'](_0x9133('0x3b'),_0xf07fbb['uniqueid']),_0xf07fbb);utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x3c'),_0xf07fbb[_0x9133('0x4')],agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x6')],agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x4')]));agents[_0xf07fbb['transfereruniqueid']][_0x9133('0x3d')]=!![];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x3e')]='blind';agents[_0xf07fbb[_0x9133('0x3a')]]['transferexten']=_0xf07fbb[_0x9133('0x3f')];agents[_0xf07fbb[_0x9133('0x3a')]][_0x9133('0x40')]=agents[_0xf07fbb[_0x9133('0x3a')]]['uniqueid'];}}catch(_0x4a346c){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x3b'),_0xf07fbb[_0x9133('0x4')]),_0x4a346c);}};exports[_0x9133('0x41')]=function(_0x565920){try{utils['debug'](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920['origtransfereruniqueid']),_0x565920);if(_0x565920[_0x9133('0x43')]==_0x565920[_0x9133('0x44')]){if(!_['isNil'](agents[_0x565920['secondtransfereruniqueid']])){utils['info'](util[_0x9133('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x45')]][_0x9133('0x6')]));agents[_0x565920[_0x9133('0x45')]]['transfer']=!![];agents[_0x565920[_0x9133('0x45')]]['transfertype']=_0x9133('0x46');agents[_0x565920[_0x9133('0x45')]][_0x9133('0x47')]=_0x565920[_0x9133('0x48')];agents[_0x565920[_0x9133('0x45')]][_0x9133('0x40')]=_0x565920['origtransfereruniqueid'];}if(_0x565920['transfereeuniqueid']&&agents[_0x565920['transfereeuniqueid']]){agents[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x49')]]=_['clone'](agents[_0x565920[_0x9133('0x49')]]);transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x45')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x45')]]['calleridname'];transfers[_0x565920[_0x9133('0x49')]]['agentcalledAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']][_0x9133('0x2f')]=utils[_0x9133('0x18')]();transfers[_0x565920['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x565920[_0x9133('0x49')]][_0x9133('0x4a')]=0x2;}}else if(_0x565920[_0x9133('0x45')]==_0x565920[_0x9133('0x4c')]){if(!_[_0x9133('0x1d')](agents[_0x565920[_0x9133('0x43')]])){utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x4d'),_0x565920[_0x9133('0x43')],agents[_0x565920[_0x9133('0x43')]]['membername']));agents[_0x565920[_0x9133('0x43')]]['transfer']=!![];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x3e')]=_0x9133('0x46');agents[_0x565920[_0x9133('0x43')]][_0x9133('0x47')]=_0x565920['secondtransfererexten'];agents[_0x565920[_0x9133('0x43')]][_0x9133('0x40')]=_0x565920[_0x9133('0x45')];}if(_0x565920[_0x9133('0x4e')]&&agents[_0x565920['transfertargetuniqueid']]){agents[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x1;transfers[_0x565920[_0x9133('0x4e')]]=_[_0x9133('0x4f')](agents[_0x565920['transfertargetuniqueid']]);transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x8')]=agents[_0x565920[_0x9133('0x43')]][_0x9133('0x8')];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4b')]=agents[_0x565920[_0x9133('0x43')]]['calleridname'];transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x17')]=utils[_0x9133('0x18')]();transfers[_0x565920[_0x9133('0x4e')]]['agentconnectAt']=utils[_0x9133('0x18')]();transfers[_0x565920['transfertargetuniqueid']][_0x9133('0x22')]=0x0;transfers[_0x565920[_0x9133('0x4e')]][_0x9133('0x4a')]=0x2;}}}catch(_0x39b46d){utils[_0x9133('0x2b')](util[_0x9133('0x2')](_0x9133('0x42'),_0x565920[_0x9133('0x43')]),_0x39b46d);}};exports['hangup']=function(_0x23bd83){try{utils[_0x9133('0x15')](util[_0x9133('0x2')](_0x9133('0x50'),_0x23bd83[_0x9133('0x4')]),_0x23bd83);if(agents[_0x23bd83['uniqueid']]&&agents[_0x23bd83['uniqueid']]['reason']===_0x9133('0x20')){if(_0x23bd83[_0x9133('0x51')]==='21'){agents[_0x23bd83[_0x9133('0x4')]]['reason']=_0x9133('0x52');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x52');}utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83[_0x9133('0x4')],agents[_0x23bd83['uniqueid']][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]]['reason'],agents[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);var _0x439352=unanswered[_0x9133('0x54')](_0x23bd83[_0x9133('0x4')]);if(_0x439352>-0x1){unanswered[_0x9133('0x55')](_0x439352,0x1);}}if(transfers[_0x23bd83['uniqueid']]){transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')]=utils['now']();transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x23')]=utils[_0x9133('0x56')](transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x37')],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')]=_0x9133('0x57');transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')](_0x9133('0x53'),_0x23bd83['uniqueid'],transfers[_0x23bd83[_0x9133('0x4')]]['membername'],transfers[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],transfers[_0x23bd83[_0x9133('0x4')]]['lastevent']));writeDB(transfers[_0x23bd83[_0x9133('0x4')]],!![]);}if(agents[_0x23bd83[_0x9133('0x4')]]&&agents[_0x23bd83[_0x9133('0x4')]]['agentconnectAt']){agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0xf')]=!![];agents[_0x23bd83['uniqueid']][_0x9133('0x37')]=utils[_0x9133('0x18')]();agents[_0x23bd83[_0x9133('0x4')]]['talktime']=utils[_0x9133('0x56')](agents[_0x23bd83['uniqueid']][_0x9133('0x37')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x2f')]);agents[_0x23bd83['uniqueid']][_0x9133('0x21')]=agents[_0x23bd83['uniqueid']][_0x9133('0x3d')]?_0x9133('0x3d'):_0x9133('0x57');agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x9')]=_0x9133('0x38');utils[_0x9133('0x1')](util[_0x9133('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x23bd83[_0x9133('0x4')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x6')],agents[_0x23bd83[_0x9133('0x4')]][_0x9133('0x21')],agents[_0x23bd83['uniqueid']][_0x9133('0x9')]));writeDB(agents[_0x23bd83[_0x9133('0x4')]]);}}catch(_0x1b66d0){utils[_0x9133('0x2b')](util['format'](_0x9133('0x50'),_0x23bd83['uniqueid']),_0x1b66d0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9e11e8e..f7e68bd 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 _0xcd0e=['xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','application','appdata','startsWith','split','substring','lastIndexOf','includes','noop','execif','set','gotoif','toLowerCase','[%s][calls][newexten]','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','context','exten','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfereruniqueid','origtransfererchannel','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','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<'];(function(_0x1efba0,_0x323e00){var _0x490efc=function(_0x57286f){while(--_0x57286f){_0x1efba0['push'](_0x1efba0['shift']());}};_0x490efc(++_0x323e00);}(_0xcd0e,0xe9));var _0xecd0=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xcd0e[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0xecd0('0x0'));var util=require(_0xecd0('0x1'));var utils=require(_0xecd0('0x2'));var transfers=require(_0xecd0('0x3'));var dispositions=[_0xecd0('0x4'),_0xecd0('0x5'),_0xecd0('0x5'),_0xecd0('0x4'),_0xecd0('0x4'),_0xecd0('0x4'),_0xecd0('0x6'),_0xecd0('0x7'),_0xecd0('0x5'),_0xecd0('0x5'),_0xecd0('0x5')];var channels={};function writeDB(_0x4250c7){var _0xc7e3e6;if(transfers[_0xecd0('0x8')][_0x4250c7[_0xecd0('0x9')]]){_0xc7e3e6=_0x4250c7['uniqueid'];_0x4250c7[_0xecd0('0x9')]=transfers[_0xecd0('0x8')][_0x4250c7[_0xecd0('0x9')]][_0xecd0('0xa')];}utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0xd'),_0x4250c7[_0xecd0('0x9')],_0x4250c7[_0xecd0('0xe')],_0x4250c7['queue'],_0x4250c7['membername'],_0x4250c7['interface'],_0x4250c7[_0xecd0('0xf')],_0x4250c7[_0xecd0('0x10')],_0x4250c7[_0xecd0('0x11')]));if(_0x4250c7[_0xecd0('0x12')]){utils[_0xecd0('0x13')](_0x4250c7[_0xecd0('0x12')])['then'](function(_0x595dd8){if(_0x595dd8){_0x4250c7[_0xecd0('0x14')]=_0x595dd8['id'];}utils[_0xecd0('0x15')]('CreateVoiceCallReport',_0x4250c7);});}else{utils[_0xecd0('0x15')](_0xecd0('0x16'),_0x4250c7);}if(channels[_0x4250c7['uniqueid']]){delete channels[_0x4250c7['uniqueid']];}else if(_0xc7e3e6&&channels[_0xc7e3e6]){if(!transfers[_0xecd0('0x8')][_0xc7e3e6]['recording'])delete transfers[_0xecd0('0x8')][_0xc7e3e6];delete channels[_0xc7e3e6];}}exports[_0xecd0('0x17')]=function(_0x4b9506){try{utils[_0xecd0('0x18')](util[_0xecd0('0xc')](_0xecd0('0x19'),_0x4b9506['uniqueid']),_0x4b9506);if(_0x4b9506[_0xecd0('0x9')]==_0x4b9506[_0xecd0('0x1a')]&&_0x4b9506[_0xecd0('0xe')]!='OutgoingSpoolFailed'){utils[_0xecd0('0xb')](util[_0xecd0('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x4b9506[_0xecd0('0x9')],_0x4b9506[_0xecd0('0x1b')],_0x4b9506['exten']));channels[_0x4b9506[_0xecd0('0x9')]]={'uniqueid':_0x4b9506[_0xecd0('0x9')],'accountcode':_0x4b9506['accountcode'],'source':_0x4b9506['calleridnum'],'destination':_0x4b9506[_0xecd0('0x1c')],'destinationcontext':_0x4b9506['context'],'channel':_0x4b9506[_0xecd0('0xe')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x355846){utils['error'](util[_0xecd0('0xc')]('[%s][calls][newchannel]',_0x4b9506[_0xecd0('0x9')]),_0x355846);}};exports['newstate']=function(_0x47f30f){try{utils[_0xecd0('0x18')](util['format'](_0xecd0('0x1d'),_0x47f30f[_0xecd0('0x9')]),_0x47f30f);if(!_[_0xecd0('0x1e')](channels[_0x47f30f[_0xecd0('0x9')]])&&_0x47f30f[_0xecd0('0x1f')]==0x6){utils['info'](util[_0xecd0('0xc')](_0xecd0('0x20'),_0x47f30f[_0xecd0('0x9')],_0x47f30f[_0xecd0('0x1b')],_0x47f30f[_0xecd0('0xe')]));if(_['isNil'](channels[_0x47f30f[_0xecd0('0x9')]]['systemanswertime'])){channels[_0x47f30f[_0xecd0('0x9')]][_0xecd0('0x21')]=utils[_0xecd0('0x22')]();}}else if(!_[_0xecd0('0x1e')](channels[_0x47f30f['linkedid']])&&_0x47f30f['channelstate']==0x6&&_0x47f30f[_0xecd0('0x1b')]!=_0xecd0('0x23')){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x24'),_0x47f30f['uniqueid'],_0x47f30f[_0xecd0('0x1a')],_0x47f30f['context'],_0x47f30f[_0xecd0('0xe')]));channels[_0x47f30f[_0xecd0('0x1a')]][_0xecd0('0x12')]=_0x47f30f[_0xecd0('0x12')];channels[_0x47f30f['linkedid']][_0xecd0('0x25')]=_0x47f30f[_0xecd0('0xe')];if(_[_0xecd0('0x1e')](channels[_0x47f30f[_0xecd0('0x1a')]][_0xecd0('0x26')])){channels[_0x47f30f[_0xecd0('0x1a')]][_0xecd0('0x26')]=utils['now']();}channels[_0x47f30f[_0xecd0('0x1a')]][_0xecd0('0x27')]=dispositions[_[_0xecd0('0x28')](_0x47f30f['channelstate'])]||'ANSWERED';}}catch(_0x949731){utils[_0xecd0('0x29')](util[_0xecd0('0xc')](_0xecd0('0x1d'),_0x47f30f[_0xecd0('0x9')]),_0x949731);}};exports[_0xecd0('0x2a')]=function(_0x706114){try{if(!_[_0xecd0('0x1e')](channels[_0x706114[_0xecd0('0x9')]])){utils['debug'](util['format'](_0xecd0('0x2b'),_0x706114[_0xecd0('0x9')]),_0x706114);if(_[_0xecd0('0x1e')](channels[_0x706114['uniqueid']][_0xecd0('0x2c')])){channels[_0x706114[_0xecd0('0x9')]][_0xecd0('0x2c')]=_0x706114[_0xecd0('0x2d')]+'\x20<'+_0x706114[_0xecd0('0xf')]+'>';}utils[_0xecd0('0xb')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x706114[_0xecd0('0x9')],channels[_0x706114[_0xecd0('0x9')]][_0xecd0('0x2c')],_0x706114['cause-txt']));channels[_0x706114['uniqueid']][_0xecd0('0x2e')]=utils[_0xecd0('0x22')]();channels[_0x706114[_0xecd0('0x9')]][_0xecd0('0x2f')]=utils[_0xecd0('0x30')](channels[_0x706114[_0xecd0('0x9')]]['endtime'],channels[_0x706114['uniqueid']][_0xecd0('0x31')]);channels[_0x706114[_0xecd0('0x9')]]['billableseconds']=channels[_0x706114[_0xecd0('0x9')]][_0xecd0('0x26')]?utils[_0xecd0('0x30')](channels[_0x706114['uniqueid']][_0xecd0('0x2e')],channels[_0x706114[_0xecd0('0x9')]][_0xecd0('0x26')]):0x0;writeDB(channels[_0x706114[_0xecd0('0x9')]]);}}catch(_0x28888a){utils[_0xecd0('0x29')](util[_0xecd0('0xc')](_0xecd0('0x2b'),_0x706114[_0xecd0('0x9')]),_0x28888a);}};exports['attendedtransfer']=function(_0x5231d0){try{if(!_['isNil'](channels[_0x5231d0[_0xecd0('0x32')]])){utils[_0xecd0('0x18')](util[_0xecd0('0xc')](_0xecd0('0x33'),_0x5231d0['origtransfereruniqueid']),_0x5231d0);if(channels[_0x5231d0['localtwolinkedid']][_0xecd0('0xe')]==_0x5231d0[_0xecd0('0x34')]){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x35'),_0x5231d0['origtransfereruniqueid'],_0x5231d0['localtwolinkedid'],_0x5231d0['secondtransfererchannel']));channels[_0x5231d0[_0xecd0('0x32')]]['destinationchannel']=_0x5231d0[_0xecd0('0x36')];channels[_0x5231d0[_0xecd0('0x32')]][_0xecd0('0x37')]='_attended';}else if(channels[_0x5231d0[_0xecd0('0x32')]]['channel']=_0x5231d0['transfertargetchannel']){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x35'),_0x5231d0[_0xecd0('0x38')],_0x5231d0[_0xecd0('0x32')],_0x5231d0[_0xecd0('0x39')]));channels[_0x5231d0[_0xecd0('0x32')]][_0xecd0('0x25')]=_0x5231d0[_0xecd0('0x39')];channels[_0x5231d0['localtwolinkedid']][_0xecd0('0x37')]='_attended';}}}catch(_0x1a1677){utils[_0xecd0('0x29')](util['format']('[%s][calls][attendedtransfer]',_0x5231d0[_0xecd0('0x38')]),_0x1a1677);}};exports[_0xecd0('0x3a')]=function(_0x46e2d5){try{if(!_['isNil'](channels[_0x46e2d5[_0xecd0('0x9')]])){utils[_0xecd0('0x18')](util['format']('[%s][calls][musiconholdstart]',_0x46e2d5[_0xecd0('0x9')]),_0x46e2d5);channels[_0x46e2d5[_0xecd0('0x9')]][_0xecd0('0x3b')]=utils[_0xecd0('0x22')]();utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x3c'),_0x46e2d5['uniqueid'],channels[_0x46e2d5[_0xecd0('0x9')]][_0xecd0('0x3b')]));}}catch(_0x32ce48){utils[_0xecd0('0x29')](util[_0xecd0('0xc')]('[%s][calls][musiconholdstart]',_0x46e2d5[_0xecd0('0x9')]),_0x32ce48);}};exports[_0xecd0('0x3d')]=function(_0x68b90f){try{if(!_['isNil'](channels[_0x68b90f[_0xecd0('0x9')]])){utils[_0xecd0('0x18')](util['format'](_0xecd0('0x3e'),_0x68b90f['uniqueid']),_0x68b90f);if(!_[_0xecd0('0x1e')](channels[_0x68b90f[_0xecd0('0x9')]][_0xecd0('0x3b')])){channels[_0x68b90f['uniqueid']][_0xecd0('0x3f')]+=utils['diffTime'](utils[_0xecd0('0x22')](),channels[_0x68b90f['uniqueid']][_0xecd0('0x3b')]);utils[_0xecd0('0xb')](util['format'](_0xecd0('0x40'),_0x68b90f[_0xecd0('0x9')],channels[_0x68b90f[_0xecd0('0x9')]]['mohtime']));delete channels[_0x68b90f[_0xecd0('0x9')]][_0xecd0('0x3b')];}}}catch(_0x2285a3){utils['error'](util[_0xecd0('0xc')](_0xecd0('0x3e'),_0x68b90f[_0xecd0('0x9')]),_0x2285a3);}};exports['varset']=function(_0x5ec2e4){try{if(!_[_0xecd0('0x1e')](channels[_0x5ec2e4['uniqueid']])){utils['debug'](util['format'](_0xecd0('0x41'),_0x5ec2e4[_0xecd0('0x9')]),_0x5ec2e4);if(!_['isNil'](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x43')])){utils['info'](util[_0xecd0('0xc')](_0xecd0('0x44'),_0x5ec2e4[_0xecd0('0x9')],_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]]['source']=_0x5ec2e4['value'];}if(!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x46')])){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x47'),_0x5ec2e4[_0xecd0('0x9')],_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]]['destination']=_0x5ec2e4[_0xecd0('0x45')];channels[_0x5ec2e4[_0xecd0('0x9')]][_0xecd0('0x2c')]='\x22'+_0x5ec2e4[_0xecd0('0x45')]+_0xecd0('0x48')+_0x5ec2e4[_0xecd0('0x45')]+'>';}if(!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x49')])||!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x4a')])){utils['info'](util['format'](_0xecd0('0x4b'),_0x5ec2e4['uniqueid'],!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x49')])?'xmd-callerid-preview':_0xecd0('0x4a'),_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]][_0xecd0('0x2c')]=_0x5ec2e4[_0xecd0('0x45')];}if(!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x4c')])||!_[_0xecd0('0x1e')](_0x5ec2e4['variable'][_0xecd0('0x4d')])){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x4b'),_0x5ec2e4[_0xecd0('0x9')],!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')]['xmd-queue'])?_0xecd0('0x4c'):_0xecd0('0x4d'),_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]][_0xecd0('0x4e')]=_0xecd0('0x4f');channels[_0x5ec2e4[_0xecd0('0x9')]][_0xecd0('0x50')]=_0x5ec2e4[_0xecd0('0x45')];channels[_0x5ec2e4[_0xecd0('0x9')]]['queue']=!![];}if(!_['isNil'](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x51')])){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x52'),_0x5ec2e4['uniqueid'],_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]]['ContactId']=_0x5ec2e4[_0xecd0('0x45')];}if(!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x53')])){utils['info'](util[_0xecd0('0xc')](_0xecd0('0x54'),_0x5ec2e4[_0xecd0('0x9')],_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4[_0xecd0('0x9')]]['type']=_0x5ec2e4[_0xecd0('0x45')];}if(!_['isNil'](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x55')])){utils[_0xecd0('0xb')](util[_0xecd0('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5ec2e4[_0xecd0('0x9')],_0x5ec2e4['value']));channels[_0x5ec2e4[_0xecd0('0x9')]][_0xecd0('0x56')]=_0x5ec2e4[_0xecd0('0x45')];}if(!_[_0xecd0('0x1e')](_0x5ec2e4[_0xecd0('0x42')][_0xecd0('0x57')])){utils[_0xecd0('0xb')](util[_0xecd0('0xc')](_0xecd0('0x58'),_0x5ec2e4[_0xecd0('0x9')],_0x5ec2e4[_0xecd0('0x45')]));channels[_0x5ec2e4['uniqueid']][_0xecd0('0x57')]=_0x5ec2e4[_0xecd0('0x45')];}}}catch(_0x5d3ba9){utils[_0xecd0('0x29')](util['format'](_0xecd0('0x41'),_0x5ec2e4[_0xecd0('0x9')]),_0x5d3ba9);}};exports['newexten']=function(_0x350574){try{if(!_[_0xecd0('0x1e')](channels[_0x350574[_0xecd0('0x9')]])){utils[_0xecd0('0x18')](util[_0xecd0('0xc')]('[%s][calls][newexten]',_0x350574[_0xecd0('0x9')]),_0x350574);utils[_0xecd0('0xb')](util[_0xecd0('0xc')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x350574[_0xecd0('0x9')],_0x350574[_0xecd0('0x59')],_0x350574[_0xecd0('0x5a')]));if(_0x350574['application']['toLowerCase']()=='set'&&_[_0xecd0('0x5b')](_0x350574['appdata']['toLowerCase'](),'cdr')){var _0x40f83f=_0x350574[_0xecd0('0x5a')][_0xecd0('0x5c')]('=');var _0x447809=_0x40f83f[0x0][_0xecd0('0x5d')](_0x40f83f[0x0]['lastIndexOf']('(')+0x1,_0x40f83f[0x0][_0xecd0('0x5e')](')'));var _0x31260d=_0x40f83f[0x1];channels[_0x350574['uniqueid']][_0x447809]=_0x31260d;}if(!_[_0xecd0('0x5f')]([_0xecd0('0x2a'),_0xecd0('0x60'),_0xecd0('0x61'),_0xecd0('0x62'),_0xecd0('0x63')],_0x350574[_0xecd0('0x59')][_0xecd0('0x64')]())){channels[_0x350574[_0xecd0('0x9')]][_0xecd0('0x4e')]=_0x350574['application'];channels[_0x350574[_0xecd0('0x9')]][_0xecd0('0x50')]=_0x350574[_0xecd0('0x5a')];}}}catch(_0x11b552){utils['error'](util['format'](_0xecd0('0x65'),_0x350574['uniqueid']),_0x11b552);}}; \ No newline at end of file +var _0xed54=['secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','xmd-originatecalleridnum','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','queue','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','execif','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0xed54,0xfc));var _0x4ed5=function(_0x400803,_0x29b517){_0x400803=_0x400803-0x0;var _0x175dfb=_0xed54[_0x400803];return _0x175dfb;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var utils=require(_0x4ed5('0x1'));var transfers=require(_0x4ed5('0x2'));var dispositions=[_0x4ed5('0x3'),'FAILED',_0x4ed5('0x4'),_0x4ed5('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x4ed5('0x5'),_0x4ed5('0x6'),_0x4ed5('0x4'),_0x4ed5('0x4'),_0x4ed5('0x4')];var channels={};function writeDB(_0x406871){var _0x499db9;if(transfers['blinds'][_0x406871[_0x4ed5('0x7')]]){_0x499db9=_0x406871[_0x4ed5('0x7')];_0x406871[_0x4ed5('0x7')]=transfers[_0x4ed5('0x8')][_0x406871[_0x4ed5('0x7')]]['transfereeuniqueid'];}utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0xb'),_0x406871[_0x4ed5('0x7')],_0x406871[_0x4ed5('0xc')],_0x406871['queue'],_0x406871[_0x4ed5('0xd')],_0x406871[_0x4ed5('0xe')],_0x406871[_0x4ed5('0xf')],_0x406871[_0x4ed5('0x10')],_0x406871[_0x4ed5('0x11')]));if(_0x406871[_0x4ed5('0x12')]){utils[_0x4ed5('0x13')](_0x406871[_0x4ed5('0x12')])['then'](function(_0x4c9fc0){if(_0x4c9fc0){_0x406871[_0x4ed5('0x14')]=_0x4c9fc0['id'];}utils[_0x4ed5('0x15')](_0x4ed5('0x16'),_0x406871);});}else{utils[_0x4ed5('0x15')](_0x4ed5('0x16'),_0x406871);}if(channels[_0x406871[_0x4ed5('0x7')]]){delete channels[_0x406871[_0x4ed5('0x7')]];}else if(_0x499db9&&channels[_0x499db9]){if(!transfers[_0x4ed5('0x8')][_0x499db9][_0x4ed5('0x17')])delete transfers[_0x4ed5('0x8')][_0x499db9];delete channels[_0x499db9];}}exports[_0x4ed5('0x18')]=function(_0x35212c){try{utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')](_0x4ed5('0x1a'),_0x35212c[_0x4ed5('0x7')]),_0x35212c);if(_0x35212c['uniqueid']==_0x35212c[_0x4ed5('0x1b')]&&_0x35212c[_0x4ed5('0xc')]!=_0x4ed5('0x1c')){utils['info'](util[_0x4ed5('0xa')](_0x4ed5('0x1d'),_0x35212c[_0x4ed5('0x7')],_0x35212c[_0x4ed5('0x1e')],_0x35212c[_0x4ed5('0x1f')]));channels[_0x35212c[_0x4ed5('0x7')]]={'uniqueid':_0x35212c[_0x4ed5('0x7')],'accountcode':_0x35212c[_0x4ed5('0x12')],'source':_0x35212c['calleridnum'],'destination':_0x35212c[_0x4ed5('0x1f')],'destinationcontext':_0x35212c[_0x4ed5('0x1e')],'channel':_0x35212c['channel'],'starttime':utils[_0x4ed5('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x576458){utils[_0x4ed5('0x21')](util['format'](_0x4ed5('0x1a'),_0x35212c[_0x4ed5('0x7')]),_0x576458);}};exports[_0x4ed5('0x22')]=function(_0x2d59cd){try{utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')](_0x4ed5('0x23'),_0x2d59cd['uniqueid']),_0x2d59cd);if(!_[_0x4ed5('0x24')](channels[_0x2d59cd[_0x4ed5('0x7')]])&&_0x2d59cd[_0x4ed5('0x25')]==0x6){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2d59cd[_0x4ed5('0x7')],_0x2d59cd[_0x4ed5('0x1e')],_0x2d59cd[_0x4ed5('0xc')]));if(_['isNil'](channels[_0x2d59cd[_0x4ed5('0x7')]]['systemanswertime'])){channels[_0x2d59cd['uniqueid']][_0x4ed5('0x26')]=utils[_0x4ed5('0x20')]();}}else if(!_['isNil'](channels[_0x2d59cd[_0x4ed5('0x1b')]])&&_0x2d59cd[_0x4ed5('0x25')]==0x6&&_0x2d59cd['context']!='transfer'){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x27'),_0x2d59cd[_0x4ed5('0x7')],_0x2d59cd['linkedid'],_0x2d59cd[_0x4ed5('0x1e')],_0x2d59cd[_0x4ed5('0xc')]));channels[_0x2d59cd[_0x4ed5('0x1b')]][_0x4ed5('0x12')]=_0x2d59cd['accountcode'];channels[_0x2d59cd[_0x4ed5('0x1b')]]['destinationchannel']=_0x2d59cd['channel'];if(_[_0x4ed5('0x24')](channels[_0x2d59cd[_0x4ed5('0x1b')]]['answertime'])){channels[_0x2d59cd['linkedid']][_0x4ed5('0x28')]=utils[_0x4ed5('0x20')]();}channels[_0x2d59cd[_0x4ed5('0x1b')]]['disposition']=dispositions[_[_0x4ed5('0x29')](_0x2d59cd[_0x4ed5('0x25')])]||_0x4ed5('0x5');}}catch(_0x59f989){utils['error'](util['format'](_0x4ed5('0x23'),_0x2d59cd[_0x4ed5('0x7')]),_0x59f989);}};exports['hangup']=function(_0x2bae67){try{if(!_['isNil'](channels[_0x2bae67['uniqueid']])){utils[_0x4ed5('0x19')](util['format'](_0x4ed5('0x2a'),_0x2bae67[_0x4ed5('0x7')]),_0x2bae67);if(_[_0x4ed5('0x24')](channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x2b')])){channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x2b')]=_0x2bae67[_0x4ed5('0x2c')]+'\x20<'+_0x2bae67[_0x4ed5('0xf')]+'>';}utils['info'](util[_0x4ed5('0xa')](_0x4ed5('0x2d'),_0x2bae67[_0x4ed5('0x7')],channels[_0x2bae67['uniqueid']]['callerid'],_0x2bae67['cause-txt']));channels[_0x2bae67[_0x4ed5('0x7')]]['endtime']=utils['now']();channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x2e')]=utils[_0x4ed5('0x2f')](channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x30')],channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x31')]);channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x32')]=channels[_0x2bae67[_0x4ed5('0x7')]][_0x4ed5('0x28')]?utils[_0x4ed5('0x2f')](channels[_0x2bae67[_0x4ed5('0x7')]]['endtime'],channels[_0x2bae67['uniqueid']]['answertime']):0x0;writeDB(channels[_0x2bae67[_0x4ed5('0x7')]]);}}catch(_0x582874){utils[_0x4ed5('0x21')](util[_0x4ed5('0xa')]('[%s][calls][hangup]',_0x2bae67[_0x4ed5('0x7')]),_0x582874);}};exports[_0x4ed5('0x33')]=function(_0x48e588){try{if(!_[_0x4ed5('0x24')](channels[_0x48e588['localtwolinkedid']])){utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')](_0x4ed5('0x34'),_0x48e588[_0x4ed5('0x35')]),_0x48e588);if(channels[_0x48e588[_0x4ed5('0x36')]][_0x4ed5('0xc')]==_0x48e588[_0x4ed5('0x37')]){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x38'),_0x48e588[_0x4ed5('0x35')],_0x48e588['localtwolinkedid'],_0x48e588[_0x4ed5('0x39')]));channels[_0x48e588['localtwolinkedid']]['destinationchannel']=_0x48e588['secondtransfererchannel'];channels[_0x48e588[_0x4ed5('0x36')]][_0x4ed5('0x3a')]=_0x4ed5('0x3b');}else if(channels[_0x48e588[_0x4ed5('0x36')]][_0x4ed5('0xc')]=_0x48e588['transfertargetchannel']){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x38'),_0x48e588[_0x4ed5('0x35')],_0x48e588[_0x4ed5('0x36')],_0x48e588[_0x4ed5('0x3c')]));channels[_0x48e588[_0x4ed5('0x36')]]['destinationchannel']=_0x48e588[_0x4ed5('0x3c')];channels[_0x48e588[_0x4ed5('0x36')]][_0x4ed5('0x3a')]='_attended';}}}catch(_0x1bf013){utils['error'](util[_0x4ed5('0xa')](_0x4ed5('0x34'),_0x48e588[_0x4ed5('0x35')]),_0x1bf013);}};exports[_0x4ed5('0x3d')]=function(_0x4c8c1e){try{if(!_[_0x4ed5('0x24')](channels[_0x4c8c1e[_0x4ed5('0x7')]])){utils[_0x4ed5('0x19')](util['format'](_0x4ed5('0x3e'),_0x4c8c1e[_0x4ed5('0x7')]),_0x4c8c1e);channels[_0x4c8c1e[_0x4ed5('0x7')]][_0x4ed5('0x3f')]=utils[_0x4ed5('0x20')]();utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x40'),_0x4c8c1e['uniqueid'],channels[_0x4c8c1e['uniqueid']][_0x4ed5('0x3f')]));}}catch(_0x486cf4){utils[_0x4ed5('0x21')](util[_0x4ed5('0xa')](_0x4ed5('0x3e'),_0x4c8c1e[_0x4ed5('0x7')]),_0x486cf4);}};exports['musiconholdstop']=function(_0x21288b){try{if(!_[_0x4ed5('0x24')](channels[_0x21288b[_0x4ed5('0x7')]])){utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')](_0x4ed5('0x41'),_0x21288b[_0x4ed5('0x7')]),_0x21288b);if(!_[_0x4ed5('0x24')](channels[_0x21288b[_0x4ed5('0x7')]][_0x4ed5('0x3f')])){channels[_0x21288b[_0x4ed5('0x7')]][_0x4ed5('0x42')]+=utils[_0x4ed5('0x2f')](utils[_0x4ed5('0x20')](),channels[_0x21288b[_0x4ed5('0x7')]][_0x4ed5('0x3f')]);utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x21288b[_0x4ed5('0x7')],channels[_0x21288b[_0x4ed5('0x7')]][_0x4ed5('0x42')]));delete channels[_0x21288b[_0x4ed5('0x7')]]['musiconholdstartAt'];}}}catch(_0x209ffa){utils['error'](util['format'](_0x4ed5('0x41'),_0x21288b['uniqueid']),_0x209ffa);}};exports['varset']=function(_0x3153d0){try{if(!_[_0x4ed5('0x24')](channels[_0x3153d0['uniqueid']])){utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')]('[%s][calls][varset]',_0x3153d0[_0x4ed5('0x7')]),_0x3153d0);if(!_['isNil'](_0x3153d0['variable'][_0x4ed5('0x43')])){utils[_0x4ed5('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x3153d0['uniqueid'],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0['uniqueid']]['source']=_0x3153d0[_0x4ed5('0x44')];}if(!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x46')])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x47'),_0x3153d0[_0x4ed5('0x7')],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0[_0x4ed5('0x7')]][_0x4ed5('0x48')]=_0x3153d0['value'];channels[_0x3153d0[_0x4ed5('0x7')]]['callerid']='\x22'+_0x3153d0[_0x4ed5('0x44')]+'\x22\x20<'+_0x3153d0['value']+'>';}if(!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x49')])||!_[_0x4ed5('0x24')](_0x3153d0['variable']['xmd-callerid'])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3153d0[_0x4ed5('0x7')],!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')]['xmd-callerid-preview'])?_0x4ed5('0x49'):'xmd-callerid',_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0[_0x4ed5('0x7')]][_0x4ed5('0x2b')]=_0x3153d0[_0x4ed5('0x44')];}if(!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x4a')])||!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x4b')])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x4c'),_0x3153d0['uniqueid'],!_[_0x4ed5('0x24')](_0x3153d0['variable'][_0x4ed5('0x4a')])?'xmd-queue':'xmcs-queue',_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0['uniqueid']][_0x4ed5('0x4d')]='Queue';channels[_0x3153d0[_0x4ed5('0x7')]][_0x4ed5('0x4e')]=_0x3153d0[_0x4ed5('0x44')];channels[_0x3153d0['uniqueid']][_0x4ed5('0x4f')]=!![];}if(!_['isNil'](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x50')])){utils['info'](util[_0x4ed5('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x3153d0[_0x4ed5('0x7')],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0['uniqueid']]['ContactId']=_0x3153d0[_0x4ed5('0x44')];}if(!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x51')])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x52'),_0x3153d0[_0x4ed5('0x7')],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0[_0x4ed5('0x7')]][_0x4ed5('0x53')]=_0x3153d0[_0x4ed5('0x44')];}if(!_[_0x4ed5('0x24')](_0x3153d0[_0x4ed5('0x45')][_0x4ed5('0x54')])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x55'),_0x3153d0[_0x4ed5('0x7')],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0[_0x4ed5('0x7')]][_0x4ed5('0x56')]=_0x3153d0[_0x4ed5('0x44')];}if(!_['isNil'](_0x3153d0[_0x4ed5('0x45')]['sipcallid'])){utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')](_0x4ed5('0x57'),_0x3153d0[_0x4ed5('0x7')],_0x3153d0[_0x4ed5('0x44')]));channels[_0x3153d0[_0x4ed5('0x7')]]['sipcallid']=_0x3153d0[_0x4ed5('0x44')];}}}catch(_0x3281c1){utils['error'](util[_0x4ed5('0xa')](_0x4ed5('0x58'),_0x3153d0['uniqueid']),_0x3281c1);}};exports[_0x4ed5('0x59')]=function(_0x189a9c){try{if(!_['isNil'](channels[_0x189a9c[_0x4ed5('0x7')]])){utils[_0x4ed5('0x19')](util[_0x4ed5('0xa')](_0x4ed5('0x5a'),_0x189a9c[_0x4ed5('0x7')]),_0x189a9c);utils[_0x4ed5('0x9')](util[_0x4ed5('0xa')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x189a9c[_0x4ed5('0x7')],_0x189a9c[_0x4ed5('0x5b')],_0x189a9c[_0x4ed5('0x5c')]));if(_0x189a9c['application']['toLowerCase']()==_0x4ed5('0x5d')&&_[_0x4ed5('0x5e')](_0x189a9c[_0x4ed5('0x5c')][_0x4ed5('0x5f')](),_0x4ed5('0x60'))){var _0x232682=_0x189a9c[_0x4ed5('0x5c')][_0x4ed5('0x61')]('=');var _0x4309c7=_0x232682[0x0][_0x4ed5('0x62')](_0x232682[0x0][_0x4ed5('0x63')]('(')+0x1,_0x232682[0x0]['lastIndexOf'](')'));var _0xfb7b44=_0x232682[0x1];channels[_0x189a9c['uniqueid']][_0x4309c7]=_0xfb7b44;}if(!_[_0x4ed5('0x64')]([_0x4ed5('0x65'),'noop',_0x4ed5('0x66'),'set','gotoif'],_0x189a9c[_0x4ed5('0x5b')]['toLowerCase']())){channels[_0x189a9c[_0x4ed5('0x7')]]['lastapplication']=_0x189a9c[_0x4ed5('0x5b')];channels[_0x189a9c[_0x4ed5('0x7')]][_0x4ed5('0x4e')]=_0x189a9c['appdata'];}}}catch(_0x469e0f){utils[_0x4ed5('0x21')](util['format'](_0x4ed5('0x5a'),_0x189a9c[_0x4ed5('0x7')]),_0x469e0f);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index beeddd3..8dc5ac1 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 _0xdf25=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x3d8d04,_0x51536b){var _0x43b01a=function(_0x330909){while(--_0x330909){_0x3d8d04['push'](_0x3d8d04['shift']());}};_0x43b01a(++_0x51536b);}(_0xdf25,0x8e));var _0x5df2=function(_0x4acb63,_0x2e9860){_0x4acb63=_0x4acb63-0x0;var _0x3b118a=_0xdf25[_0x4acb63];return _0x3b118a;};'use strict';var utils=require(_0x5df2('0x0'));exports[_0x5df2('0x1')]=function(){utils[_0x5df2('0x2')](_0x5df2('0x3'));};exports[_0x5df2('0x4')]=function(){utils[_0x5df2('0x2')](_0x5df2('0x5'));};exports[_0x5df2('0x6')]=function(){utils[_0x5df2('0x2')](_0x5df2('0x7'));};exports[_0x5df2('0x8')]=function(_0x496e75){utils[_0x5df2('0x8')](_0x5df2('0x9'),_0x496e75);};exports[_0x5df2('0xa')]=function(){utils[_0x5df2('0x2')](_0x5df2('0xb'));};exports[_0x5df2('0xc')]=function(_0x142b8e){}; \ No newline at end of file +var _0xcc04=['[core]\x20fullybooted','error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x221367,_0xa97141){var _0x38afa2=function(_0x5bf471){while(--_0x5bf471){_0x221367['push'](_0x221367['shift']());}};_0x38afa2(++_0xa97141);}(_0xcc04,0x181));var _0x4cc0=function(_0x4c85ca,_0x2086d9){_0x4c85ca=_0x4c85ca-0x0;var _0xe08ce3=_0xcc04[_0x4c85ca];return _0xe08ce3;};'use strict';var utils=require('./utils');exports[_0x4cc0('0x0')]=function(){utils[_0x4cc0('0x1')](_0x4cc0('0x2'));};exports[_0x4cc0('0x3')]=function(){utils[_0x4cc0('0x1')](_0x4cc0('0x4'));};exports['fullybooted']=function(){utils[_0x4cc0('0x1')](_0x4cc0('0x5'));};exports['error']=function(_0x17ce2a){utils[_0x4cc0('0x6')]('[core]\x20error',_0x17ce2a);};exports[_0x4cc0('0x7')]=function(){utils['info'](_0x4cc0('0x8'));};exports[_0x4cc0('0x9')]=function(_0x1d0cfb){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d34191b..55ee62d 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 _0x2750=['debug','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','answertime','now','lastevent','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','diffTime','holdtime','endtime','[%s][dials][hangup]','util','./utils','info','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','newexten'];(function(_0x4a6b44,_0x109f4a){var _0x2ca2ad=function(_0x30b8f1){while(--_0x30b8f1){_0x4a6b44['push'](_0x4a6b44['shift']());}};_0x2ca2ad(++_0x109f4a);}(_0x2750,0xc9));var _0x0275=function(_0x1fa05e,_0x377e0e){_0x1fa05e=_0x1fa05e-0x0;var _0x24b42b=_0x2750[_0x1fa05e];return _0x24b42b;};'use strict';var _=require('lodash');var util=require(_0x0275('0x0'));var utils=require(_0x0275('0x1'));var dials={};function writeDB(_0x2d7d05){utils[_0x0275('0x2')](util['format']('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2d7d05[_0x0275('0x3')],_0x2d7d05[_0x0275('0x4')],_0x2d7d05['dialstring'],_0x2d7d05[_0x0275('0x5')],_0x2d7d05[_0x0275('0x6')],_0x2d7d05[_0x0275('0x7')]));utils['request']('CreateVoiceDialReport',_0x2d7d05);delete dials[_0x2d7d05[_0x0275('0x3')]];}exports[_0x0275('0x8')]=function(_0x4a2d06){try{utils[_0x0275('0x9')](util['format'](_0x0275('0xa'),_0x4a2d06[_0x0275('0x3')]),_0x4a2d06);utils[_0x0275('0x2')](util[_0x0275('0xb')](_0x0275('0xc'),_0x4a2d06[_0x0275('0x3')],_0x4a2d06[_0x0275('0xd')],_0x4a2d06['appdata']));if(_0x4a2d06[_0x0275('0xd')][_0x0275('0xe')]()=='set'&&_[_0x0275('0xf')](_0x4a2d06[_0x0275('0x10')][_0x0275('0xe')](),_0x0275('0x11'))){var _0x585032=_0x4a2d06['appdata']['split']('=');dials[_0x4a2d06[_0x0275('0x3')]]={'routeId':_0x585032[0x1]};}}catch(_0x295977){utils[_0x0275('0x12')](util[_0x0275('0xb')](_0x0275('0xa'),_0x4a2d06['uniqueid']),_0x295977);}};exports[_0x0275('0x13')]=function(_0x47ba7f){try{utils[_0x0275('0x9')](util[_0x0275('0xb')](_0x0275('0x14'),_0x47ba7f[_0x0275('0x3')]),_0x47ba7f);if(!_[_0x0275('0x15')](_0x47ba7f[_0x0275('0x16')]['outboundrouteid'])){utils[_0x0275('0x2')](util[_0x0275('0xb')](_0x0275('0x17'),_0x47ba7f[_0x0275('0x3')],_0x47ba7f[_0x0275('0x18')]));dials[_0x47ba7f[_0x0275('0x3')]]={'routeId':_0x47ba7f[_0x0275('0x18')]};}}catch(_0x1fe1bc){utils[_0x0275('0x12')](util['format'](_0x0275('0x14'),_0x47ba7f[_0x0275('0x3')]),_0x1fe1bc);}};exports['dialbegin']=function(_0x25ead4){try{if(!_[_0x0275('0x15')](dials[_0x25ead4[_0x0275('0x3')]])){utils[_0x0275('0x9')](util[_0x0275('0xb')](_0x0275('0x19'),_0x25ead4[_0x0275('0x3')]),_0x25ead4);dials[_0x25ead4[_0x0275('0x3')]]=_[_0x0275('0x1a')](dials[_0x25ead4[_0x0275('0x3')]],_0x25ead4);dials[_0x25ead4[_0x0275('0x3')]]['starttime']=utils['now']();dials[_0x25ead4[_0x0275('0x3')]]['lastevent']='called';utils[_0x0275('0x2')](util[_0x0275('0xb')](_0x0275('0x1b'),_0x25ead4[_0x0275('0x3')],dials[_0x25ead4[_0x0275('0x3')]][_0x0275('0x1c')]));}}catch(_0x1bd574){utils[_0x0275('0x12')](util[_0x0275('0xb')](_0x0275('0x19'),_0x25ead4[_0x0275('0x3')]),_0x1bd574);}};exports[_0x0275('0x1d')]=function(_0x4bb259){try{if(!_[_0x0275('0x15')](dials[_0x4bb259[_0x0275('0x3')]])){utils[_0x0275('0x9')](util[_0x0275('0xb')]('[%s][dials][dialend]',_0x4bb259[_0x0275('0x3')]),_0x4bb259);dials[_0x4bb259['uniqueid']][_0x0275('0x7')]=_0x4bb259[_0x0275('0x7')];if(_0x4bb259['dialstatus']==_0x0275('0x1e')){dials[_0x4bb259['uniqueid']]=_[_0x0275('0x1a')](dials[_0x4bb259[_0x0275('0x3')]],_0x4bb259);dials[_0x4bb259[_0x0275('0x3')]][_0x0275('0x1f')]=utils[_0x0275('0x20')]();dials[_0x4bb259[_0x0275('0x3')]][_0x0275('0x21')]='connect';utils[_0x0275('0x2')](util[_0x0275('0xb')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4bb259[_0x0275('0x3')],_0x4bb259[_0x0275('0x7')],dials[_0x4bb259[_0x0275('0x3')]][_0x0275('0x1f')]));}else{utils[_0x0275('0x2')](util[_0x0275('0xb')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4bb259[_0x0275('0x3')],_0x4bb259[_0x0275('0x7')]));}}}catch(_0x5ad50c){utils['error'](util['format'](_0x0275('0x22'),_0x4bb259[_0x0275('0x3')]),_0x5ad50c);}};exports[_0x0275('0x23')]=function(_0x88ee40){try{if(!_[_0x0275('0x15')](dials[_0x88ee40[_0x0275('0x3')]])){utils[_0x0275('0x9')](util[_0x0275('0xb')]('[%s][dials][hangup]',_0x88ee40[_0x0275('0x3')]),_0x88ee40);utils[_0x0275('0x2')](util['format'](_0x0275('0x24'),_0x88ee40[_0x0275('0x3')],_0x88ee40[_0x0275('0x5')],_0x88ee40[_0x0275('0x25')],_0x88ee40['cause-txt']));dials[_0x88ee40[_0x0275('0x3')]]=_[_0x0275('0x1a')](dials[_0x88ee40['uniqueid']],{'endtime':utils[_0x0275('0x20')](),'lastevent':'complete'});dials[_0x88ee40[_0x0275('0x3')]]['duration']=utils[_0x0275('0x26')](dials[_0x88ee40[_0x0275('0x3')]]['endtime'],dials[_0x88ee40[_0x0275('0x3')]][_0x0275('0x1c')]);dials[_0x88ee40[_0x0275('0x3')]][_0x0275('0x27')]=utils[_0x0275('0x26')](dials[_0x88ee40['uniqueid']]['answertime']||dials[_0x88ee40['uniqueid']]['endtime'],dials[_0x88ee40[_0x0275('0x3')]][_0x0275('0x1c')]);dials[_0x88ee40[_0x0275('0x3')]]['billableseconds']=dials[_0x88ee40['uniqueid']][_0x0275('0x1f')]?utils[_0x0275('0x26')](dials[_0x88ee40['uniqueid']][_0x0275('0x28')],dials[_0x88ee40['uniqueid']][_0x0275('0x1f')]):0x0;writeDB(dials[_0x88ee40[_0x0275('0x3')]]);}}catch(_0x3d208d){utils[_0x0275('0x12')](util[_0x0275('0xb')](_0x0275('0x29'),_0x88ee40[_0x0275('0x3')]),_0x3d208d);}}; \ No newline at end of file +var _0x7bd5=['diffTime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','endtime','holdtime'];(function(_0x281743,_0x47cf95){var _0x584af3=function(_0x50c80f){while(--_0x50c80f){_0x281743['push'](_0x281743['shift']());}};_0x584af3(++_0x47cf95);}(_0x7bd5,0x9a));var _0x57bd=function(_0x297d78,_0x1c3865){_0x297d78=_0x297d78-0x0;var _0xb30a21=_0x7bd5[_0x297d78];return _0xb30a21;};'use strict';var _=require(_0x57bd('0x0'));var util=require('util');var utils=require(_0x57bd('0x1'));var dials={};function writeDB(_0x3e2733){utils[_0x57bd('0x2')](util[_0x57bd('0x3')](_0x57bd('0x4'),_0x3e2733['uniqueid'],_0x3e2733[_0x57bd('0x5')],_0x3e2733[_0x57bd('0x6')],_0x3e2733['calleridnum'],_0x3e2733[_0x57bd('0x7')],_0x3e2733[_0x57bd('0x8')]));utils[_0x57bd('0x9')](_0x57bd('0xa'),_0x3e2733);delete dials[_0x3e2733[_0x57bd('0xb')]];}exports[_0x57bd('0xc')]=function(_0x233d91){try{utils[_0x57bd('0xd')](util[_0x57bd('0x3')](_0x57bd('0xe'),_0x233d91[_0x57bd('0xb')]),_0x233d91);utils[_0x57bd('0x2')](util['format'](_0x57bd('0xf'),_0x233d91['uniqueid'],_0x233d91[_0x57bd('0x10')],_0x233d91[_0x57bd('0x11')]));if(_0x233d91[_0x57bd('0x10')][_0x57bd('0x12')]()==_0x57bd('0x13')&&_[_0x57bd('0x14')](_0x233d91[_0x57bd('0x11')][_0x57bd('0x12')](),_0x57bd('0x15'))){var _0x165046=_0x233d91[_0x57bd('0x11')][_0x57bd('0x16')]('=');dials[_0x233d91['uniqueid']]={'routeId':_0x165046[0x1]};}}catch(_0x1b001b){utils[_0x57bd('0x17')](util[_0x57bd('0x3')](_0x57bd('0xe'),_0x233d91[_0x57bd('0xb')]),_0x1b001b);}};exports[_0x57bd('0x18')]=function(_0x4e6370){try{utils[_0x57bd('0xd')](util[_0x57bd('0x3')](_0x57bd('0x19'),_0x4e6370['uniqueid']),_0x4e6370);if(!_['isNil'](_0x4e6370[_0x57bd('0x1a')]['outboundrouteid'])){utils[_0x57bd('0x2')](util['format'](_0x57bd('0x1b'),_0x4e6370[_0x57bd('0xb')],_0x4e6370[_0x57bd('0x1c')]));dials[_0x4e6370[_0x57bd('0xb')]]={'routeId':_0x4e6370[_0x57bd('0x1c')]};}}catch(_0x405070){utils[_0x57bd('0x17')](util[_0x57bd('0x3')](_0x57bd('0x19'),_0x4e6370['uniqueid']),_0x405070);}};exports[_0x57bd('0x1d')]=function(_0x2357b1){try{if(!_[_0x57bd('0x1e')](dials[_0x2357b1['uniqueid']])){utils[_0x57bd('0xd')](util[_0x57bd('0x3')]('[%s][dials][dialbegin]',_0x2357b1['uniqueid']),_0x2357b1);dials[_0x2357b1[_0x57bd('0xb')]]=_[_0x57bd('0x1f')](dials[_0x2357b1[_0x57bd('0xb')]],_0x2357b1);dials[_0x2357b1['uniqueid']][_0x57bd('0x20')]=utils[_0x57bd('0x21')]();dials[_0x2357b1[_0x57bd('0xb')]][_0x57bd('0x22')]=_0x57bd('0x23');utils['info'](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2357b1[_0x57bd('0xb')],dials[_0x2357b1['uniqueid']]['starttime']));}}catch(_0x1e764c){utils[_0x57bd('0x17')](util[_0x57bd('0x3')](_0x57bd('0x24'),_0x2357b1[_0x57bd('0xb')]),_0x1e764c);}};exports[_0x57bd('0x25')]=function(_0x4906e7){try{if(!_['isNil'](dials[_0x4906e7[_0x57bd('0xb')]])){utils[_0x57bd('0xd')](util[_0x57bd('0x3')](_0x57bd('0x26'),_0x4906e7[_0x57bd('0xb')]),_0x4906e7);dials[_0x4906e7[_0x57bd('0xb')]][_0x57bd('0x8')]=_0x4906e7['dialstatus'];if(_0x4906e7[_0x57bd('0x8')]=='ANSWER'){dials[_0x4906e7[_0x57bd('0xb')]]=_['assign'](dials[_0x4906e7[_0x57bd('0xb')]],_0x4906e7);dials[_0x4906e7[_0x57bd('0xb')]]['answertime']=utils[_0x57bd('0x21')]();dials[_0x4906e7[_0x57bd('0xb')]][_0x57bd('0x22')]=_0x57bd('0x27');utils[_0x57bd('0x2')](util['format'](_0x57bd('0x28'),_0x4906e7[_0x57bd('0xb')],_0x4906e7['dialstatus'],dials[_0x4906e7[_0x57bd('0xb')]][_0x57bd('0x29')]));}else{utils[_0x57bd('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x4906e7[_0x57bd('0xb')],_0x4906e7[_0x57bd('0x8')]));}}}catch(_0x1f9019){utils['error'](util[_0x57bd('0x3')](_0x57bd('0x26'),_0x4906e7[_0x57bd('0xb')]),_0x1f9019);}};exports['hangup']=function(_0x3741be){try{if(!_['isNil'](dials[_0x3741be[_0x57bd('0xb')]])){utils[_0x57bd('0xd')](util[_0x57bd('0x3')](_0x57bd('0x2a'),_0x3741be[_0x57bd('0xb')]),_0x3741be);utils['info'](util[_0x57bd('0x3')](_0x57bd('0x2b'),_0x3741be[_0x57bd('0xb')],_0x3741be[_0x57bd('0x2c')],_0x3741be[_0x57bd('0x2d')],_0x3741be[_0x57bd('0x2e')]));dials[_0x3741be[_0x57bd('0xb')]]=_[_0x57bd('0x1f')](dials[_0x3741be[_0x57bd('0xb')]],{'endtime':utils['now'](),'lastevent':_0x57bd('0x2f')});dials[_0x3741be['uniqueid']]['duration']=utils['diffTime'](dials[_0x3741be[_0x57bd('0xb')]][_0x57bd('0x30')],dials[_0x3741be[_0x57bd('0xb')]][_0x57bd('0x20')]);dials[_0x3741be['uniqueid']][_0x57bd('0x31')]=utils[_0x57bd('0x32')](dials[_0x3741be[_0x57bd('0xb')]][_0x57bd('0x29')]||dials[_0x3741be['uniqueid']][_0x57bd('0x30')],dials[_0x3741be[_0x57bd('0xb')]][_0x57bd('0x20')]);dials[_0x3741be[_0x57bd('0xb')]]['billableseconds']=dials[_0x3741be['uniqueid']][_0x57bd('0x29')]?utils[_0x57bd('0x32')](dials[_0x3741be[_0x57bd('0xb')]][_0x57bd('0x30')],dials[_0x3741be['uniqueid']][_0x57bd('0x29')]):0x0;writeDB(dials[_0x3741be[_0x57bd('0xb')]]);}}catch(_0x5e527b){utils[_0x57bd('0x17')](util[_0x57bd('0x3')]('[%s][dials][hangup]',_0x3741be[_0x57bd('0xb')]),_0x5e527b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d1eef14..42d0721 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 _0xfb97=['../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','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]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager'];(function(_0x523e37,_0x4872be){var _0xe2fc15=function(_0x5e9f1f){while(--_0x5e9f1f){_0x523e37['push'](_0x523e37['shift']());}};_0xe2fc15(++_0x4872be);}(_0xfb97,0x117));var _0x7fb9=function(_0x262957,_0x34c699){_0x262957=_0x262957-0x0;var _0x27e221=_0xfb97[_0x262957];return _0x27e221;};var AsteriskManager=require(_0x7fb9('0x0'));var config=require(_0x7fb9('0x1'));var utils=require(_0x7fb9('0x2'));var util=require(_0x7fb9('0x3'));var isXDREnabled=config[_0x7fb9('0x4')]&&config[_0x7fb9('0x4')]['disabled']?!config['xdr'][_0x7fb9('0x5')]:!![];var isProduction=config[_0x7fb9('0x6')]===_0x7fb9('0x7')||![];var isLocalAsterisk=config[_0x7fb9('0x4')]&&config['xdr'][_0x7fb9('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x7fb9('0x9')]['port'],config[_0x7fb9('0x9')]['ip'],config[_0x7fb9('0x9')][_0x7fb9('0xa')],config[_0x7fb9('0x9')]['password'],!![]);ami[_0x7fb9('0xb')]();if(!isXDREnabled){utils[_0x7fb9('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x7fb9('0xd'));}else{var agents=require(_0x7fb9('0xe'));var calls=require(_0x7fb9('0xf'));var queues=require(_0x7fb9('0x10'));var recordings=require(_0x7fb9('0x11'));var members=require(_0x7fb9('0x12'));var dials=require(_0x7fb9('0x13'));var transfers=require(_0x7fb9('0x14'));var core=require(_0x7fb9('0x15'));ami['on'](_0x7fb9('0x16'),core['connect']);ami['on'](_0x7fb9('0x17'),core[_0x7fb9('0x17')]);ami['on']('fullybooted',core[_0x7fb9('0x18')]);ami['on'](_0x7fb9('0x19'),core[_0x7fb9('0x19')]);ami['on'](_0x7fb9('0x1a'),core[_0x7fb9('0x1a')]);ami['on'](_0x7fb9('0x1b'),core[_0x7fb9('0x1b')]);ami['on'](_0x7fb9('0x1c'),function(_0x2e7568){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x1f'),_0x2e7568[_0x7fb9('0x20')]),_0x2e7568);members[_0x7fb9('0x1c')](_0x2e7568);}catch(_0x37c4b0){utils['error'](util[_0x7fb9('0x1e')](_0x7fb9('0x1f'),_0x2e7568[_0x7fb9('0x20')]),_0x37c4b0);}});ami['on'](_0x7fb9('0x21'),function(_0x587687){try{utils['debug'](util['format']('[%s][index][agentcalled]',_0x587687[_0x7fb9('0x22')]),_0x587687);agents[_0x7fb9('0x21')](_0x587687);}catch(_0xdcb2ae){utils['error'](util[_0x7fb9('0x1e')]('[%s][index][agentcalled]',_0x587687[_0x7fb9('0x22')]),_0xdcb2ae);}});ami['on'](_0x7fb9('0x23'),function(_0xa1d5ba){try{utils['debug'](util[_0x7fb9('0x1e')](_0x7fb9('0x24'),_0xa1d5ba[_0x7fb9('0x22')]),_0xa1d5ba);agents[_0x7fb9('0x23')](_0xa1d5ba);}catch(_0x4f3216){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x24'),_0xa1d5ba[_0x7fb9('0x22')]),_0x4f3216);}});ami['on'](_0x7fb9('0x25'),function(_0x36357c){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x26'),_0x36357c[_0x7fb9('0x22')]),_0x36357c);agents[_0x7fb9('0x25')](_0x36357c);queues['agentconnect'](_0x36357c);}catch(_0x3a296b){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')]('[%s][index][agentconnect]',_0x36357c[_0x7fb9('0x22')]),_0x3a296b);}});ami['on']('agentcomplete',function(_0x2782a4){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x27'),_0x2782a4['uniqueid']),_0x2782a4);agents[_0x7fb9('0x28')](_0x2782a4);queues[_0x7fb9('0x28')](_0x2782a4);members[_0x7fb9('0x28')](_0x2782a4);}catch(_0x5c43e5){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x27'),_0x2782a4['uniqueid']),_0x5c43e5);}});ami['on'](_0x7fb9('0x29'),function(_0x37dadb){try{utils[_0x7fb9('0x1d')](util['format'](_0x7fb9('0x2a'),_0x37dadb['uniqueid']),_0x37dadb);agents[_0x7fb9('0x29')](_0x37dadb);queues[_0x7fb9('0x29')](_0x37dadb);}catch(_0x352296){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x2a'),_0x37dadb[_0x7fb9('0x22')]),_0x352296);}});ami['on'](_0x7fb9('0x2b'),function(_0x37314a){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x2c'),_0x37314a['uniqueid']),_0x37314a);queues[_0x7fb9('0x2b')](_0x37314a);recordings['queuecallerjoin'](_0x37314a);}catch(_0x31d701){utils[_0x7fb9('0x19')](util['format'](_0x7fb9('0x2c'),_0x37314a[_0x7fb9('0x22')]),_0x31d701);}});ami['on'](_0x7fb9('0x2d'),function(_0x821432){try{utils['debug'](util[_0x7fb9('0x1e')]('[%s][index][queuecallerleave]',_0x821432[_0x7fb9('0x22')]),_0x821432);queues[_0x7fb9('0x2d')](_0x821432);}catch(_0x2144a8){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')]('[%s][index][queuecallerleave]',_0x821432[_0x7fb9('0x22')]),_0x2144a8);}});ami['on'](_0x7fb9('0x2e'),function(_0x6e53cd){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x2f'),_0x6e53cd[_0x7fb9('0x22')]),_0x6e53cd);queues[_0x7fb9('0x2e')](_0x6e53cd);calls[_0x7fb9('0x2e')](_0x6e53cd);}catch(_0x5e6833){utils['error'](util[_0x7fb9('0x1e')](_0x7fb9('0x2f'),_0x6e53cd[_0x7fb9('0x22')]),_0x5e6833);}});ami['on'](_0x7fb9('0x30'),function(_0x8c89c0){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')]('[%s][index][musiconholdstop]',_0x8c89c0[_0x7fb9('0x22')]),_0x8c89c0);queues['musiconholdstop'](_0x8c89c0);calls[_0x7fb9('0x30')](_0x8c89c0);}catch(_0x10cc33){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x31'),_0x8c89c0['uniqueid']),_0x10cc33);}});ami['on'](_0x7fb9('0x32'),function(_0x13e4fc){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x33'),_0x13e4fc[_0x7fb9('0x22')]),_0x13e4fc);calls[_0x7fb9('0x32')](_0x13e4fc);recordings[_0x7fb9('0x32')](_0x13e4fc);}catch(_0x2da163){utils[_0x7fb9('0x19')](util['format'](_0x7fb9('0x33'),_0x13e4fc['uniqueid']),_0x2da163);}});ami['on'](_0x7fb9('0x34'),function(_0x2e6b4d){try{utils['debug'](util['format'](_0x7fb9('0x35'),_0x2e6b4d['uniqueid']),_0x2e6b4d);calls[_0x7fb9('0x34')](_0x2e6b4d);recordings['hangup'](_0x2e6b4d);dials[_0x7fb9('0x34')](_0x2e6b4d);agents['hangup'](_0x2e6b4d);queues[_0x7fb9('0x34')](_0x2e6b4d);}catch(_0x11e620){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')]('[%s][index][hangup]',_0x2e6b4d[_0x7fb9('0x22')]),_0x11e620);}});ami['on'](_0x7fb9('0x36'),function(_0x28dd59){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x37'),_0x28dd59[_0x7fb9('0x22')]),_0x28dd59);members[_0x7fb9('0x36')](_0x28dd59);}catch(_0x4657a0){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')]('[%s][index][cdr]',_0x28dd59[_0x7fb9('0x22')]),_0x4657a0);}});ami['on'](_0x7fb9('0x38'),function(_0x5d65b7){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x39'),_0x5d65b7[_0x7fb9('0x22')]),_0x5d65b7);queues['blindtransfer'](_0x5d65b7);agents[_0x7fb9('0x38')](_0x5d65b7);transfers['blindtransfer'](_0x5d65b7);recordings[_0x7fb9('0x38')](_0x5d65b7);}catch(_0x1de8b5){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x39'),_0x5d65b7['uniqueid']),_0x1de8b5);}});ami['on']('attendedtransfer',function(_0x2129eb){try{utils[_0x7fb9('0x1d')](util['format']('[%s][index][attendedtransfer]',_0x2129eb['origtransfereruniqueid']),_0x2129eb);queues[_0x7fb9('0x3a')](_0x2129eb);transfers[_0x7fb9('0x3a')](_0x2129eb);agents[_0x7fb9('0x3a')](_0x2129eb);calls[_0x7fb9('0x3a')](_0x2129eb);}catch(_0x4e4f52){utils[_0x7fb9('0x19')](util['format'](_0x7fb9('0x3b'),_0x2129eb['origtransfereruniqueid']),_0x4e4f52);}});ami['on'](_0x7fb9('0x3c'),function(_0x1e375c){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x3d'),_0x1e375c[_0x7fb9('0x22')]),_0x1e375c);queues[_0x7fb9('0x3c')](_0x1e375c);recordings[_0x7fb9('0x3c')](_0x1e375c);calls[_0x7fb9('0x3c')](_0x1e375c);dials[_0x7fb9('0x3c')](_0x1e375c);}catch(_0x48333f){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')](_0x7fb9('0x3d'),_0x1e375c['uniqueid']),_0x48333f);}});ami['on'](_0x7fb9('0x3e'),function(_0x5186b6){try{utils['debug'](util[_0x7fb9('0x1e')](_0x7fb9('0x3f'),_0x5186b6[_0x7fb9('0x22')]),_0x5186b6);calls[_0x7fb9('0x3e')](_0x5186b6);recordings[_0x7fb9('0x3e')](_0x5186b6);dials[_0x7fb9('0x3e')](_0x5186b6);}catch(_0x16e9dc){utils['error'](util[_0x7fb9('0x1e')](_0x7fb9('0x3f'),_0x5186b6[_0x7fb9('0x22')]),_0x16e9dc);}});ami['on']('newchannel',function(_0x1cf3b6){try{utils['debug'](util[_0x7fb9('0x1e')]('[%s][index][newchannel]',_0x1cf3b6[_0x7fb9('0x22')]),_0x1cf3b6);calls[_0x7fb9('0x40')](_0x1cf3b6);recordings[_0x7fb9('0x40')](_0x1cf3b6);}catch(_0x5c9dda){utils['error'](util['format'](_0x7fb9('0x41'),_0x1cf3b6['uniqueid']),_0x5c9dda);}});ami['on'](_0x7fb9('0x42'),function(_0x3f7fe2){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x43'),_0x3f7fe2[_0x7fb9('0x22')]),_0x3f7fe2);dials['dialbegin'](_0x3f7fe2);}catch(_0x3d7fab){utils[_0x7fb9('0x19')](util[_0x7fb9('0x1e')]('[%s]dialbegin',_0x3f7fe2[_0x7fb9('0x22')]),_0x3d7fab);}});ami['on'](_0x7fb9('0x44'),function(_0x3298a6){try{utils[_0x7fb9('0x1d')](util[_0x7fb9('0x1e')](_0x7fb9('0x45'),_0x3298a6['uniqueid']),_0x3298a6);dials[_0x7fb9('0x44')](_0x3298a6);}catch(_0x5a3294){utils['error'](util[_0x7fb9('0x1e')](_0x7fb9('0x45'),_0x3298a6[_0x7fb9('0x22')]),_0x5a3294);}});} \ No newline at end of file +var _0x3616=['[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production','local','asterisk','port','username','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]'];(function(_0x5f3ddf,_0x155782){var _0x14f804=function(_0x24e983){while(--_0x24e983){_0x5f3ddf['push'](_0x5f3ddf['shift']());}};_0x14f804(++_0x155782);}(_0x3616,0x129));var _0x6361=function(_0x3bd34a,_0x11e83a){_0x3bd34a=_0x3bd34a-0x0;var _0x3183ab=_0x3616[_0x3bd34a];return _0x3183ab;};var AsteriskManager=require(_0x6361('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0x6361('0x1'));var isXDREnabled=config[_0x6361('0x2')]&&config['xdr'][_0x6361('0x3')]?!config[_0x6361('0x2')][_0x6361('0x3')]:!![];var isProduction=config[_0x6361('0x4')]===_0x6361('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0x6361('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x6361('0x7')][_0x6361('0x8')],config[_0x6361('0x7')]['ip'],config[_0x6361('0x7')][_0x6361('0x9')],config[_0x6361('0x7')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x6361('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6361('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x6361('0xc'));var calls=require(_0x6361('0xd'));var queues=require(_0x6361('0xe'));var recordings=require(_0x6361('0xf'));var members=require(_0x6361('0x10'));var dials=require(_0x6361('0x11'));var transfers=require(_0x6361('0x12'));var core=require(_0x6361('0x13'));ami['on'](_0x6361('0x14'),core[_0x6361('0x14')]);ami['on'](_0x6361('0x15'),core['shutdown']);ami['on'](_0x6361('0x16'),core[_0x6361('0x16')]);ami['on'](_0x6361('0x17'),core[_0x6361('0x17')]);ami['on'](_0x6361('0x18'),core['close']);ami['on'](_0x6361('0x19'),core[_0x6361('0x19')]);ami['on'](_0x6361('0x1a'),function(_0x4c9029){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x1d'),_0x4c9029['device']),_0x4c9029);members[_0x6361('0x1a')](_0x4c9029);}catch(_0x35c317){utils[_0x6361('0x17')](util[_0x6361('0x1c')]('[%s][index][devicestatechange]',_0x4c9029[_0x6361('0x1e')]),_0x35c317);}});ami['on']('agentcalled',function(_0x195352){try{utils[_0x6361('0x1b')](util['format']('[%s][index][agentcalled]',_0x195352[_0x6361('0x1f')]),_0x195352);agents[_0x6361('0x20')](_0x195352);}catch(_0x36b42c){utils[_0x6361('0x17')](util[_0x6361('0x1c')]('[%s][index][agentcalled]',_0x195352['uniqueid']),_0x36b42c);}});ami['on'](_0x6361('0x21'),function(_0x13a1e8){try{utils[_0x6361('0x1b')](util['format'](_0x6361('0x22'),_0x13a1e8[_0x6361('0x1f')]),_0x13a1e8);agents[_0x6361('0x21')](_0x13a1e8);}catch(_0x255e6f){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x22'),_0x13a1e8[_0x6361('0x1f')]),_0x255e6f);}});ami['on'](_0x6361('0x23'),function(_0x3bfdd5){try{utils[_0x6361('0x1b')](util['format'](_0x6361('0x24'),_0x3bfdd5['uniqueid']),_0x3bfdd5);agents['agentconnect'](_0x3bfdd5);queues['agentconnect'](_0x3bfdd5);}catch(_0x2d9b6e){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x24'),_0x3bfdd5[_0x6361('0x1f')]),_0x2d9b6e);}});ami['on'](_0x6361('0x25'),function(_0x1458ac){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x26'),_0x1458ac[_0x6361('0x1f')]),_0x1458ac);agents[_0x6361('0x25')](_0x1458ac);queues[_0x6361('0x25')](_0x1458ac);members[_0x6361('0x25')](_0x1458ac);}catch(_0x323032){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x26'),_0x1458ac[_0x6361('0x1f')]),_0x323032);}});ami['on'](_0x6361('0x27'),function(_0x3e6785){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x28'),_0x3e6785[_0x6361('0x1f')]),_0x3e6785);agents[_0x6361('0x27')](_0x3e6785);queues['queuecallerabandon'](_0x3e6785);}catch(_0x3a9a67){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x28'),_0x3e6785[_0x6361('0x1f')]),_0x3a9a67);}});ami['on']('queuecallerjoin',function(_0x4e6753){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x29'),_0x4e6753['uniqueid']),_0x4e6753);queues[_0x6361('0x2a')](_0x4e6753);recordings[_0x6361('0x2a')](_0x4e6753);}catch(_0x5321c6){utils[_0x6361('0x17')](util['format'](_0x6361('0x29'),_0x4e6753[_0x6361('0x1f')]),_0x5321c6);}});ami['on']('queuecallerleave',function(_0x4fdf3c){try{utils['debug'](util[_0x6361('0x1c')]('[%s][index][queuecallerleave]',_0x4fdf3c[_0x6361('0x1f')]),_0x4fdf3c);queues['queuecallerleave'](_0x4fdf3c);}catch(_0x2481dc){utils['error'](util[_0x6361('0x1c')](_0x6361('0x2b'),_0x4fdf3c[_0x6361('0x1f')]),_0x2481dc);}});ami['on'](_0x6361('0x2c'),function(_0x4f7d20){try{utils['debug'](util[_0x6361('0x1c')](_0x6361('0x2d'),_0x4f7d20[_0x6361('0x1f')]),_0x4f7d20);queues[_0x6361('0x2c')](_0x4f7d20);calls[_0x6361('0x2c')](_0x4f7d20);}catch(_0x286b50){utils[_0x6361('0x17')](util['format'](_0x6361('0x2d'),_0x4f7d20[_0x6361('0x1f')]),_0x286b50);}});ami['on'](_0x6361('0x2e'),function(_0x4690ee){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x2f'),_0x4690ee[_0x6361('0x1f')]),_0x4690ee);queues[_0x6361('0x2e')](_0x4690ee);calls[_0x6361('0x2e')](_0x4690ee);}catch(_0x1a2f65){utils['error'](util[_0x6361('0x1c')](_0x6361('0x2f'),_0x4690ee[_0x6361('0x1f')]),_0x1a2f65);}});ami['on']('newstate',function(_0x3e585c){try{utils[_0x6361('0x1b')](util['format'](_0x6361('0x30'),_0x3e585c['uniqueid']),_0x3e585c);calls['newstate'](_0x3e585c);recordings['newstate'](_0x3e585c);}catch(_0x12a7fa){utils['error'](util[_0x6361('0x1c')]('[%s][index][newstate]',_0x3e585c[_0x6361('0x1f')]),_0x12a7fa);}});ami['on'](_0x6361('0x31'),function(_0x2fe943){try{utils['debug'](util[_0x6361('0x1c')](_0x6361('0x32'),_0x2fe943[_0x6361('0x1f')]),_0x2fe943);calls[_0x6361('0x31')](_0x2fe943);recordings[_0x6361('0x31')](_0x2fe943);dials[_0x6361('0x31')](_0x2fe943);agents[_0x6361('0x31')](_0x2fe943);queues[_0x6361('0x31')](_0x2fe943);}catch(_0x904b88){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x32'),_0x2fe943[_0x6361('0x1f')]),_0x904b88);}});ami['on'](_0x6361('0x33'),function(_0x597140){try{utils[_0x6361('0x1b')](util['format']('[%s][index][cdr]',_0x597140[_0x6361('0x1f')]),_0x597140);members['cdr'](_0x597140);}catch(_0x109c95){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x34'),_0x597140[_0x6361('0x1f')]),_0x109c95);}});ami['on'](_0x6361('0x35'),function(_0x5ecbc0){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x36'),_0x5ecbc0['uniqueid']),_0x5ecbc0);queues[_0x6361('0x35')](_0x5ecbc0);agents['blindtransfer'](_0x5ecbc0);transfers['blindtransfer'](_0x5ecbc0);recordings[_0x6361('0x35')](_0x5ecbc0);}catch(_0x36c5b0){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x36'),_0x5ecbc0[_0x6361('0x1f')]),_0x36c5b0);}});ami['on'](_0x6361('0x37'),function(_0x45769a){try{utils[_0x6361('0x1b')](util['format'](_0x6361('0x38'),_0x45769a[_0x6361('0x39')]),_0x45769a);queues[_0x6361('0x37')](_0x45769a);transfers[_0x6361('0x37')](_0x45769a);agents['attendedtransfer'](_0x45769a);calls[_0x6361('0x37')](_0x45769a);}catch(_0x4ef35a){utils['error'](util[_0x6361('0x1c')](_0x6361('0x38'),_0x45769a[_0x6361('0x39')]),_0x4ef35a);}});ami['on'](_0x6361('0x3a'),function(_0x255ba1){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x3b'),_0x255ba1[_0x6361('0x1f')]),_0x255ba1);queues[_0x6361('0x3a')](_0x255ba1);recordings[_0x6361('0x3a')](_0x255ba1);calls[_0x6361('0x3a')](_0x255ba1);dials[_0x6361('0x3a')](_0x255ba1);}catch(_0x1e2e6c){utils[_0x6361('0x17')](util['format'](_0x6361('0x3b'),_0x255ba1['uniqueid']),_0x1e2e6c);}});ami['on']('newexten',function(_0x5575e3){try{utils['debug'](util[_0x6361('0x1c')](_0x6361('0x3c'),_0x5575e3[_0x6361('0x1f')]),_0x5575e3);calls[_0x6361('0x3d')](_0x5575e3);recordings['newexten'](_0x5575e3);dials[_0x6361('0x3d')](_0x5575e3);}catch(_0x4024ce){utils['error'](util[_0x6361('0x1c')](_0x6361('0x3c'),_0x5575e3['uniqueid']),_0x4024ce);}});ami['on'](_0x6361('0x3e'),function(_0x5ebb42){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x3f'),_0x5ebb42[_0x6361('0x1f')]),_0x5ebb42);calls[_0x6361('0x3e')](_0x5ebb42);recordings['newchannel'](_0x5ebb42);}catch(_0x57ee1d){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x3f'),_0x5ebb42['uniqueid']),_0x57ee1d);}});ami['on'](_0x6361('0x40'),function(_0x53ea63){try{utils[_0x6361('0x1b')](util['format'](_0x6361('0x41'),_0x53ea63['uniqueid']),_0x53ea63);dials[_0x6361('0x40')](_0x53ea63);}catch(_0x200671){utils[_0x6361('0x17')](util['format'](_0x6361('0x42'),_0x53ea63[_0x6361('0x1f')]),_0x200671);}});ami['on'](_0x6361('0x43'),function(_0x1b6d3b){try{utils[_0x6361('0x1b')](util[_0x6361('0x1c')](_0x6361('0x44'),_0x1b6d3b[_0x6361('0x1f')]),_0x1b6d3b);dials[_0x6361('0x43')](_0x1b6d3b);}catch(_0x281dc1){utils[_0x6361('0x17')](util[_0x6361('0x1c')](_0x6361('0x44'),_0x1b6d3b[_0x6361('0x1f')]),_0x281dc1);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2e1a691..0dd8f86 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 _0xd3b4=['uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','assign','data1','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','CreateMemberReport','getUserByName','split','request','error','format','[%s][members][writeDB]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x4685e9,_0x583666){_0x4685e9=_0x4685e9-0x0;var _0x213ebd=_0xd3b4[_0x4685e9];return _0x213ebd;};'use strict';var _=require(_0x4d3b('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x4d3b('0x1'),_0x4d3b('0x2')];function writeDB(_0x2179fc){utils[_0x4d3b('0x3')](util['format'](_0x4d3b('0x4'),_0x2179fc['uniqueid'],_0x2179fc[_0x4d3b('0x5')],_0x2179fc[_0x4d3b('0x6')],_0x2179fc[_0x4d3b('0x7')],_0x2179fc[_0x4d3b('0x8')],_0x2179fc[_0x4d3b('0x9')]));if(_0x2179fc[_0x4d3b('0x5')]){utils[_0x4d3b('0xa')](_0x2179fc[_0x4d3b('0x5')])[_0x4d3b('0xb')](function(_0x1a5190){if(_0x1a5190){_0x2179fc['membername']=_0x1a5190[_0x4d3b('0xc')];_0x2179fc['internal']=_0x1a5190[_0x4d3b('0xd')];utils['request'](_0x4d3b('0xe'),_0x2179fc);}else{utils[_0x4d3b('0xf')](_0x2179fc[_0x4d3b('0x5')][_0x4d3b('0x10')]('/')[0x1])[_0x4d3b('0xb')](function(_0x3abfdb){if(_0x3abfdb){_0x2179fc[_0x4d3b('0x8')]=_0x3abfdb[_0x4d3b('0xc')];_0x2179fc[_0x4d3b('0xd')]=_0x3abfdb[_0x4d3b('0xd')];utils[_0x4d3b('0x11')](_0x4d3b('0xe'),_0x2179fc);}});}})['catch'](function(_0x2c22b2){utils[_0x4d3b('0x12')](util[_0x4d3b('0x13')](_0x4d3b('0x14'),_0x2179fc[_0x4d3b('0x15')]),_0x2c22b2);});}delete members[_0x2179fc[_0x4d3b('0x5')]];}function startsWith(_0xee1de1,_0x263268){return _[_0x4d3b('0x16')](_0xee1de1,function(_0x43a9a2){return _['startsWith'](_0x263268,_0x43a9a2);});}exports[_0x4d3b('0x17')]=function(_0x53c21a){try{utils[_0x4d3b('0x18')](util[_0x4d3b('0x13')](_0x4d3b('0x19'),members[_0x53c21a[_0x4d3b('0x1a')]]?members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x15')]:_0x53c21a[_0x4d3b('0x1a')]),_0x53c21a);utils[_0x4d3b('0x3')](util[_0x4d3b('0x13')](_0x4d3b('0x1b'),members[_0x53c21a[_0x4d3b('0x1a')]]?members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x15')]:_0x53c21a['device'],_0x53c21a[_0x4d3b('0x1c')],_0x53c21a[_0x4d3b('0x1a')]));switch(_0x53c21a[_0x4d3b('0x1c')]){case _0x4d3b('0x1d'):case _0x4d3b('0x1e'):if(!startsWith(exclude,_0x53c21a['device'])){members[_0x53c21a[_0x4d3b('0x1a')]]={'channel':_0x4d3b('0x1f'),'interface':_0x53c21a[_0x4d3b('0x1a')],'type':'TALKING','enterAt':utils[_0x4d3b('0x20')](),'role':'agent'};}break;case _0x4d3b('0x21'):if(!_[_0x4d3b('0x22')](members[_0x53c21a[_0x4d3b('0x1a')]])){members[_0x53c21a['device']][_0x4d3b('0x23')]=utils[_0x4d3b('0x20')]();members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x24')]=utils['diffTime'](members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x23')],members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x25')]);if(members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x15')]){writeDB(members[_0x53c21a[_0x4d3b('0x1a')]]);}}break;default:break;}}catch(_0x37fc9d){utils[_0x4d3b('0x12')](util['format'](_0x4d3b('0x19'),members[_0x53c21a['device']]?members[_0x53c21a[_0x4d3b('0x1a')]][_0x4d3b('0x15')]:_0x53c21a[_0x4d3b('0x1a')]),_0x37fc9d);}};exports[_0x4d3b('0x26')]=function(_0x147799){try{if(!_[_0x4d3b('0x22')](members[_0x147799['interface']])){utils['debug'](util[_0x4d3b('0x13')]('[%s][members][agentcomplete]',_0x147799['uniqueid']),_0x147799);utils[_0x4d3b('0x3')](util['format'](_0x4d3b('0x27'),_0x147799[_0x4d3b('0x15')],_0x147799[_0x4d3b('0x5')],_0x147799[_0x4d3b('0x28')]));members[_0x147799['interface']]=_['assign'](members[_0x147799['interface']],{'data4':_0x147799[_0x4d3b('0x28')],'uniqueid':_0x147799['uniqueid']});}}catch(_0x35cdfb){utils[_0x4d3b('0x12')](util[_0x4d3b('0x13')](_0x4d3b('0x29'),_0x147799[_0x4d3b('0x15')]),_0x35cdfb);}};exports[_0x4d3b('0x2a')]=function(_0x44cfd5){try{utils[_0x4d3b('0x18')](util[_0x4d3b('0x13')](_0x4d3b('0x2b'),_0x44cfd5['uniqueid']),_0x44cfd5);if(_0x44cfd5[_0x4d3b('0x6')]){var _0x4978b6=_0x44cfd5['channel'][_0x4d3b('0x10')]('-')[0x0];if(!_[_0x4d3b('0x22')](members[_0x4978b6])){members[_0x4978b6]=_[_0x4d3b('0x2c')](members[_0x4978b6],{'data1':members[_0x4978b6][_0x4d3b('0x2d')]||_0x44cfd5[_0x4d3b('0x9')],'data2':members[_0x4978b6][_0x4d3b('0x7')]||_0x44cfd5[_0x4d3b('0x2e')],'data3':members[_0x4978b6][_0x4d3b('0x2f')]||_0x44cfd5[_0x4d3b('0x30')],'uniqueid':members[_0x4978b6][_0x4d3b('0x15')]||_0x44cfd5['uniqueid']});utils[_0x4d3b('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x44cfd5[_0x4d3b('0x15')],members[_0x4978b6][_0x4d3b('0x2d')],members[_0x4978b6][_0x4d3b('0x7')],members[_0x4978b6][_0x4d3b('0x2f')]));if(members[_0x4978b6]['exitAt']){writeDB(members[_0x4978b6]);}}}if(_0x44cfd5['destinationchannel']){var _0x3f7418=_0x44cfd5[_0x4d3b('0x31')][_0x4d3b('0x10')]('-')[0x0];if(!_['isNil'](members[_0x3f7418])){members[_0x3f7418]=_[_0x4d3b('0x2c')](members[_0x3f7418],{'data1':members[_0x3f7418][_0x4d3b('0x2d')]||_0x44cfd5[_0x4d3b('0x9')],'data2':members[_0x3f7418]['data2']||_0x44cfd5[_0x4d3b('0x2e')],'data3':members[_0x3f7418][_0x4d3b('0x2f')]||_0x44cfd5[_0x4d3b('0x30')],'uniqueid':members[_0x3f7418]['uniqueid']||_0x44cfd5[_0x4d3b('0x15')]});utils[_0x4d3b('0x3')](util[_0x4d3b('0x13')](_0x4d3b('0x32'),_0x44cfd5[_0x4d3b('0x15')],members[_0x3f7418][_0x4d3b('0x2d')],members[_0x3f7418]['data2'],members[_0x3f7418][_0x4d3b('0x2f')]));if(members[_0x3f7418][_0x4d3b('0x23')]){writeDB(members[_0x3f7418]);}}}}catch(_0x4bd624){utils[_0x4d3b('0x12')](util[_0x4d3b('0x13')]('[%s][members][cdr]',_0x44cfd5['uniqueid']),_0x4bd624);}}; \ No newline at end of file +var _0xe058=['destination','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','[%s][members][cdr]','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','some','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','data1','data3'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xe058,0x109));var _0x8e05=function(_0x1f6781,_0x33d985){_0x1f6781=_0x1f6781-0x0;var _0x15682d=_0xe058[_0x1f6781];return _0x15682d;};'use strict';var _=require('lodash');var util=require(_0x8e05('0x0'));var utils=require(_0x8e05('0x1'));var members={};var exclude=[_0x8e05('0x2'),_0x8e05('0x3')];function writeDB(_0x1eb1a5){utils[_0x8e05('0x4')](util[_0x8e05('0x5')](_0x8e05('0x6'),_0x1eb1a5[_0x8e05('0x7')],_0x1eb1a5[_0x8e05('0x8')],_0x1eb1a5[_0x8e05('0x9')],_0x1eb1a5[_0x8e05('0xa')],_0x1eb1a5[_0x8e05('0xb')],_0x1eb1a5[_0x8e05('0xc')]));if(_0x1eb1a5[_0x8e05('0x8')]){utils[_0x8e05('0xd')](_0x1eb1a5[_0x8e05('0x8')])[_0x8e05('0xe')](function(_0x2c7148){if(_0x2c7148){_0x1eb1a5[_0x8e05('0xb')]=_0x2c7148[_0x8e05('0xf')];_0x1eb1a5['internal']=_0x2c7148[_0x8e05('0x10')];utils[_0x8e05('0x11')](_0x8e05('0x12'),_0x1eb1a5);}else{utils[_0x8e05('0x13')](_0x1eb1a5[_0x8e05('0x8')][_0x8e05('0x14')]('/')[0x1])[_0x8e05('0xe')](function(_0x34e4c0){if(_0x34e4c0){_0x1eb1a5[_0x8e05('0xb')]=_0x34e4c0[_0x8e05('0xf')];_0x1eb1a5[_0x8e05('0x10')]=_0x34e4c0[_0x8e05('0x10')];utils[_0x8e05('0x11')](_0x8e05('0x12'),_0x1eb1a5);}});}})['catch'](function(_0x2222af){utils[_0x8e05('0x15')](util[_0x8e05('0x5')](_0x8e05('0x16'),_0x1eb1a5['uniqueid']),_0x2222af);});}delete members[_0x1eb1a5[_0x8e05('0x8')]];}function startsWith(_0x4ac8ac,_0xdff642){return _[_0x8e05('0x17')](_0x4ac8ac,function(_0x1eac27){return _[_0x8e05('0x18')](_0xdff642,_0x1eac27);});}exports['devicestatechange']=function(_0x2a47a5){try{utils['debug'](util[_0x8e05('0x5')](_0x8e05('0x19'),members[_0x2a47a5['device']]?members[_0x2a47a5[_0x8e05('0x1a')]]['uniqueid']:_0x2a47a5[_0x8e05('0x1a')]),_0x2a47a5);utils[_0x8e05('0x4')](util['format'](_0x8e05('0x1b'),members[_0x2a47a5['device']]?members[_0x2a47a5['device']][_0x8e05('0x7')]:_0x2a47a5[_0x8e05('0x1a')],_0x2a47a5[_0x8e05('0x1c')],_0x2a47a5[_0x8e05('0x1a')]));switch(_0x2a47a5[_0x8e05('0x1c')]){case'INUSE':case _0x8e05('0x1d'):if(!startsWith(exclude,_0x2a47a5[_0x8e05('0x1a')])){members[_0x2a47a5['device']]={'channel':_0x8e05('0x1e'),'interface':_0x2a47a5[_0x8e05('0x1a')],'type':'TALKING','enterAt':utils[_0x8e05('0x1f')](),'role':_0x8e05('0x20')};}break;case _0x8e05('0x21'):if(!_[_0x8e05('0x22')](members[_0x2a47a5[_0x8e05('0x1a')]])){members[_0x2a47a5[_0x8e05('0x1a')]][_0x8e05('0x23')]=utils[_0x8e05('0x1f')]();members[_0x2a47a5[_0x8e05('0x1a')]][_0x8e05('0x24')]=utils[_0x8e05('0x25')](members[_0x2a47a5[_0x8e05('0x1a')]][_0x8e05('0x23')],members[_0x2a47a5['device']][_0x8e05('0x26')]);if(members[_0x2a47a5[_0x8e05('0x1a')]]['uniqueid']){writeDB(members[_0x2a47a5[_0x8e05('0x1a')]]);}}break;default:break;}}catch(_0x4b7ca6){utils[_0x8e05('0x15')](util['format'](_0x8e05('0x19'),members[_0x2a47a5[_0x8e05('0x1a')]]?members[_0x2a47a5['device']][_0x8e05('0x7')]:_0x2a47a5[_0x8e05('0x1a')]),_0x4b7ca6);}};exports['agentcomplete']=function(_0x4668f6){try{if(!_['isNil'](members[_0x4668f6[_0x8e05('0x8')]])){utils['debug'](util['format'](_0x8e05('0x27'),_0x4668f6[_0x8e05('0x7')]),_0x4668f6);utils[_0x8e05('0x4')](util[_0x8e05('0x5')](_0x8e05('0x28'),_0x4668f6[_0x8e05('0x7')],_0x4668f6[_0x8e05('0x8')],_0x4668f6[_0x8e05('0x29')]));members[_0x4668f6[_0x8e05('0x8')]]=_[_0x8e05('0x2a')](members[_0x4668f6[_0x8e05('0x8')]],{'data4':_0x4668f6[_0x8e05('0x29')],'uniqueid':_0x4668f6[_0x8e05('0x7')]});}}catch(_0x295e61){utils[_0x8e05('0x15')](util[_0x8e05('0x5')](_0x8e05('0x27'),_0x4668f6['uniqueid']),_0x295e61);}};exports[_0x8e05('0x2b')]=function(_0x3ff7d7){try{utils[_0x8e05('0x2c')](util[_0x8e05('0x5')]('[%s][members][cdr]',_0x3ff7d7[_0x8e05('0x7')]),_0x3ff7d7);if(_0x3ff7d7[_0x8e05('0x9')]){var _0x23383b=_0x3ff7d7['channel'][_0x8e05('0x14')]('-')[0x0];if(!_[_0x8e05('0x22')](members[_0x23383b])){members[_0x23383b]=_[_0x8e05('0x2a')](members[_0x23383b],{'data1':members[_0x23383b][_0x8e05('0x2d')]||_0x3ff7d7[_0x8e05('0xc')],'data2':members[_0x23383b][_0x8e05('0xa')]||_0x3ff7d7['source'],'data3':members[_0x23383b][_0x8e05('0x2e')]||_0x3ff7d7[_0x8e05('0x2f')],'uniqueid':members[_0x23383b]['uniqueid']||_0x3ff7d7[_0x8e05('0x7')]});utils[_0x8e05('0x4')](util[_0x8e05('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3ff7d7['uniqueid'],members[_0x23383b][_0x8e05('0x2d')],members[_0x23383b][_0x8e05('0xa')],members[_0x23383b][_0x8e05('0x2e')]));if(members[_0x23383b]['exitAt']){writeDB(members[_0x23383b]);}}}if(_0x3ff7d7[_0x8e05('0x30')]){var _0x3154f2=_0x3ff7d7['destinationchannel'][_0x8e05('0x14')]('-')[0x0];if(!_[_0x8e05('0x22')](members[_0x3154f2])){members[_0x3154f2]=_[_0x8e05('0x2a')](members[_0x3154f2],{'data1':members[_0x3154f2][_0x8e05('0x2d')]||_0x3ff7d7[_0x8e05('0xc')],'data2':members[_0x3154f2]['data2']||_0x3ff7d7[_0x8e05('0x31')],'data3':members[_0x3154f2]['data3']||_0x3ff7d7[_0x8e05('0x2f')],'uniqueid':members[_0x3154f2][_0x8e05('0x7')]||_0x3ff7d7[_0x8e05('0x7')]});utils[_0x8e05('0x4')](util[_0x8e05('0x5')](_0x8e05('0x32'),_0x3ff7d7['uniqueid'],members[_0x3154f2][_0x8e05('0x2d')],members[_0x3154f2]['data2'],members[_0x3154f2][_0x8e05('0x2e')]));if(members[_0x3154f2][_0x8e05('0x23')]){writeDB(members[_0x3154f2]);}}}}catch(_0x5d8961){utils[_0x8e05('0x15')](util[_0x8e05('0x5')](_0x8e05('0x33'),_0x3ff7d7['uniqueid']),_0x5d8961);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index b82fe62..1e666c9 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 _0x0ecb=['uniqueid','lastAssignedTo','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','isNil','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerexit','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','ATTENDED','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','diffTime','[%s][queues][musiconholdstop]','info','format'];(function(_0x1d14e3,_0xd5bfb0){var _0x5653ff=function(_0x39cc85){while(--_0x39cc85){_0x1d14e3['push'](_0x1d14e3['shift']());}};_0x5653ff(++_0xd5bfb0);}(_0x0ecb,0xc2));var _0xb0ec=function(_0x2543be,_0x19ebd6){_0x2543be=_0x2543be-0x0;var _0x4636d0=_0x0ecb[_0x2543be];return _0x4636d0;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x6c5aea){utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x6c5aea[_0xb0ec('0x2')],_0x6c5aea['channel'],_0x6c5aea['queue'],_0x6c5aea[_0xb0ec('0x3')],_0x6c5aea['calleridnum'],_0x6c5aea['accountcode'],_0x6c5aea[_0xb0ec('0x4')]));if(_0x6c5aea[_0xb0ec('0x5')]){utils[_0xb0ec('0x6')](_0x6c5aea[_0xb0ec('0x5')])[_0xb0ec('0x7')](function(_0xc84799){if(_0xc84799){_0x6c5aea[_0xb0ec('0x8')]=_0xc84799[_0xb0ec('0x8')];}utils[_0xb0ec('0x9')](_0xb0ec('0xa'),_0x6c5aea);});}else{utils['request']('CreateVoiceQueueReport',_0x6c5aea);}if(_0x6c5aea[_0xb0ec('0xb')]){delete queues[_0x6c5aea[_0xb0ec('0xb')]];}else{delete queues[_0x6c5aea[_0xb0ec('0x2')]];}}exports['queuecallerjoin']=function(_0x13af39){try{utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')](_0xb0ec('0xd'),_0x13af39['uniqueid']),_0x13af39);utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0xe'),_0x13af39[_0xb0ec('0x2')],_0x13af39[_0xb0ec('0x5')],_0x13af39[_0xb0ec('0xf')]));queues[_0x13af39[_0xb0ec('0x2')]]=_[_0xb0ec('0x10')](_0x13af39,{'originalposition':_0x13af39['position'],'queuecallerjoinAt':utils[_0xb0ec('0x11')](),'mohtime':0x0});}catch(_0x1fb914){utils['error'](util[_0xb0ec('0x1')](_0xb0ec('0xd'),_0x13af39[_0xb0ec('0x2')]),_0x1fb914);}};exports[_0xb0ec('0x12')]=function(_0x4206ef){try{if(!_['isNil'](queues[_0x4206ef[_0xb0ec('0x2')]])){utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')](_0xb0ec('0x13'),_0x4206ef[_0xb0ec('0x2')]),_0x4206ef);if(queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x14')]){if(!queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x15')]&&!queues[_0x4206ef[_0xb0ec('0x2')]]['queuecallerexit']){queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x16')]=!![];queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x17')]=utils[_0xb0ec('0x11')]();queues[_0x4206ef['uniqueid']][_0xb0ec('0x4')]=_0xb0ec('0x18');}utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x19'),_0x4206ef['uniqueid'],queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x1a')],queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x4')]));writeDB(queues[_0x4206ef[_0xb0ec('0x2')]]);}else if(queues[_0x4206ef[_0xb0ec('0x2')]]['transfereduniqueid']){utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x1b'),_0x4206ef[_0xb0ec('0x2')],queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0x1a')],queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0xb')]));queues[queues[_0x4206ef[_0xb0ec('0x2')]][_0xb0ec('0xb')]]=queues[_0x4206ef[_0xb0ec('0x2')]];queues[queues[_0x4206ef[_0xb0ec('0x2')]]['transfereduniqueid']][_0xb0ec('0x1c')]=0x2;delete queues[_0x4206ef[_0xb0ec('0x2')]];}}}catch(_0x61de41){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x13'),_0x4206ef['uniqueid']),_0x61de41);}};exports[_0xb0ec('0x1e')]=function(_0x5a73f1){try{utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')]('[%s][queues][varset]',_0x5a73f1['uniqueid']),_0x5a73f1);if(!_[_0xb0ec('0x1f')](_0x5a73f1['variable'][_0xb0ec('0x20')])&&_0x5a73f1[_0xb0ec('0x21')][_0xb0ec('0x22')]()!==_0xb0ec('0x23')){if(!_[_0xb0ec('0x1f')](queues[_0x5a73f1[_0xb0ec('0x2')]])){queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x15')]=![];queues[_0x5a73f1['uniqueid']][_0xb0ec('0x24')]=null;queues[_0x5a73f1['uniqueid']]['queuecallerexit']=!![];queues[_0x5a73f1[_0xb0ec('0x2')]]['queuecallerexitAt']=utils[_0xb0ec('0x11')]();queues[_0x5a73f1['uniqueid']][_0xb0ec('0x4')]=_0x5a73f1['value'][_0xb0ec('0x22')]();utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x25'),_0x5a73f1[_0xb0ec('0x2')],queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x1a')],_0x5a73f1[_0xb0ec('0x21')],queues[_0x5a73f1['uniqueid']][_0xb0ec('0x4')]));writeDB(queues[_0x5a73f1[_0xb0ec('0x2')]]);}}else if(!_[_0xb0ec('0x1f')](_0x5a73f1['variable'][_0xb0ec('0x26')])){if(!_[_0xb0ec('0x1f')](queues[_0x5a73f1[_0xb0ec('0x2')]])&&!queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x15')]){queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x15')]=![];queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x24')]=null;queues[_0x5a73f1[_0xb0ec('0x2')]]['queuecallerexit']=!![];queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x27')]=utils['now']();queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x4')]=_0xb0ec('0x28');utils[_0xb0ec('0x0')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x5a73f1['uniqueid'],queues[_0x5a73f1[_0xb0ec('0x2')]][_0xb0ec('0x1a')],_0x5a73f1[_0xb0ec('0x21')],queues[_0x5a73f1[_0xb0ec('0x2')]]['queuecallerexitreason']));}}}catch(_0x2d6e24){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x29'),_0x5a73f1[_0xb0ec('0x2')]),_0x2d6e24);}};exports[_0xb0ec('0x15')]=function(_0x2ff471){try{if(!_[_0xb0ec('0x1f')](queues[_0x2ff471[_0xb0ec('0x2')]])){utils[_0xb0ec('0xc')](util['format'](_0xb0ec('0x2a'),_0x2ff471[_0xb0ec('0x2')]),_0x2ff471);queues[_0x2ff471[_0xb0ec('0x2')]][_0xb0ec('0x2b')]=![];queues[_0x2ff471[_0xb0ec('0x2')]][_0xb0ec('0x27')]=null;queues[_0x2ff471['uniqueid']][_0xb0ec('0x15')]=!![];queues[_0x2ff471[_0xb0ec('0x2')]]['queuecallerabandonAt']=utils['now']();queues[_0x2ff471[_0xb0ec('0x2')]][_0xb0ec('0x4')]='ABANDONED';utils['info'](util[_0xb0ec('0x1')](_0xb0ec('0x2c'),_0x2ff471['uniqueid'],queues[_0x2ff471[_0xb0ec('0x2')]]['name'],queues[_0x2ff471[_0xb0ec('0x2')]]['queuecallerexitreason']));}}catch(_0x131b31){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x2a'),_0x2ff471['uniqueid']),_0x131b31);}};exports[_0xb0ec('0x2d')]=function(_0x2b028d){try{if(!_['isNil'](queues[_0x2b028d[_0xb0ec('0x2')]])){utils['debug'](util[_0xb0ec('0x1')](_0xb0ec('0x2e'),_0x2b028d[_0xb0ec('0x2')]),_0x2b028d);utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2b028d[_0xb0ec('0x2')],queues[_0x2b028d['uniqueid']][_0xb0ec('0x1a')],_0x2b028d[_0xb0ec('0x2f')],_0x2b028d[_0xb0ec('0x30')]));queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0x2d')]=!![];queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0x14')]=utils['now']();queues[_0x2b028d['uniqueid']][_0xb0ec('0x31')]=utils['diffTime'](queues[_0x2b028d['uniqueid']][_0xb0ec('0x14')],queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0x32')]);queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0xf')]=_0x2b028d['position'];queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0x33')]=_0x2b028d[_0xb0ec('0x33')];queues[_0x2b028d[_0xb0ec('0x2')]][_0xb0ec('0x2f')]=_0x2b028d[_0xb0ec('0x2f')];queues[_0x2b028d['uniqueid']]['connectedlinename']=_0x2b028d[_0xb0ec('0x30')];}}catch(_0x331da3){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x2e'),_0x2b028d[_0xb0ec('0x2')]),_0x331da3);}};exports[_0xb0ec('0x34')]=function(_0x149b4e){try{if(!_[_0xb0ec('0x1f')](queues[_0x149b4e[_0xb0ec('0x2')]])){utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')](_0xb0ec('0x35'),_0x149b4e[_0xb0ec('0x2')]),_0x149b4e);utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x36'),_0x149b4e['uniqueid'],queues[_0x149b4e[_0xb0ec('0x2')]]['name'],_0x149b4e[_0xb0ec('0x37')],_0x149b4e[_0xb0ec('0x38')]));queues[_0x149b4e['uniqueid']]['queuecallerabandon']=![];queues[_0x149b4e['uniqueid']]['queuecallerabandon']=![];queues[_0x149b4e[_0xb0ec('0x2')]][_0xb0ec('0x24')]=null;queues[_0x149b4e[_0xb0ec('0x2')]][_0xb0ec('0x2b')]=![];queues[_0x149b4e['uniqueid']][_0xb0ec('0x4')]=null;queues[_0x149b4e[_0xb0ec('0x2')]]['queuecallerexitAt']=null;queues[_0x149b4e['uniqueid']][_0xb0ec('0x39')]=!![];queues[_0x149b4e[_0xb0ec('0x2')]][_0xb0ec('0x3a')]=_0x149b4e[_0xb0ec('0x38')];queues[_0x149b4e[_0xb0ec('0x2')]][_0xb0ec('0x3')]=_0x149b4e['membername'];}}catch(_0x23f46a){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x35'),_0x149b4e['uniqueid']),_0x23f46a);}};exports['agentcomplete']=function(_0x53df56){try{if(!_[_0xb0ec('0x1f')](queues[_0x53df56[_0xb0ec('0x2')]])){if(queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x14')]){utils['debug'](util[_0xb0ec('0x1')](_0xb0ec('0x3b'),_0x53df56['uniqueid']),_0x53df56);queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x15')]=![];queues[_0x53df56['uniqueid']][_0xb0ec('0x15')]=![];queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x24')]=null;queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x2b')]=![];queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x27')]=null;queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x39')]=!![];queues[_0x53df56['uniqueid']][_0xb0ec('0x3')]=_0x53df56[_0xb0ec('0x37')];queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x16')]=!![];queues[_0x53df56['uniqueid']][_0xb0ec('0x17')]=utils[_0xb0ec('0x11')]();if(_0x53df56['reason']==_0xb0ec('0x3c')){if(!queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x3c')]){queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x4')]='TRANSFER';}}else{queues[_0x53df56[_0xb0ec('0x2')]]['queuecallerexitreason']=_0xb0ec('0x3d')+_0x53df56[_0xb0ec('0x3e')][_0xb0ec('0x22')]();}utils['info'](util['format'](_0xb0ec('0x3f'),_0x53df56['uniqueid'],queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x1a')],_0x53df56['membername'],queues[_0x53df56[_0xb0ec('0x2')]][_0xb0ec('0x4')]));writeDB(queues[_0x53df56[_0xb0ec('0x2')]]);}}}catch(_0x485b67){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x3b'),_0x53df56[_0xb0ec('0x2')]),_0x485b67);}};exports[_0xb0ec('0x40')]=function(_0x24f56a){try{if(!_[_0xb0ec('0x1f')](queues[_0x24f56a[_0xb0ec('0x41')]])){utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')]('[%s][queues][blindtransfer]',_0x24f56a['uniqueid']),_0x24f56a);queues[_0x24f56a['transfereeuniqueid']][_0xb0ec('0x3c')]=!![];queues[_0x24f56a['transfereeuniqueid']][_0xb0ec('0x42')]=_0xb0ec('0x43');queues[_0x24f56a['transfereeuniqueid']][_0xb0ec('0x44')]=_0x24f56a['extension'];queues[_0x24f56a[_0xb0ec('0x41')]]['transferuniqueid']=_0x24f56a[_0xb0ec('0x41')];queues[_0x24f56a[_0xb0ec('0x41')]]['queuecallerexitreason']=_0xb0ec('0x45');utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x24f56a[_0xb0ec('0x2')],queues[_0x24f56a[_0xb0ec('0x41')]][_0xb0ec('0x1a')],_0x24f56a[_0xb0ec('0x41')],_0x24f56a[_0xb0ec('0x46')]));}}catch(_0x20cc83){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')]('[%s][queues][blindtransfer]',_0x24f56a['uniqueid']),_0x20cc83);}};exports[_0xb0ec('0x47')]=function(_0x5d7ad6){try{utils['debug'](util[_0xb0ec('0x1')](_0xb0ec('0x48'),_0x5d7ad6[_0xb0ec('0x49')]),_0x5d7ad6);if(_0x5d7ad6[_0xb0ec('0x49')]==_0x5d7ad6[_0xb0ec('0x4a')]){if(!_[_0xb0ec('0x1f')](queues[_0x5d7ad6[_0xb0ec('0x4b')]])){utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x4c'),_0x5d7ad6['origtransfereruniqueid'],queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x1a')],_0x5d7ad6[_0xb0ec('0x4d')]));queues[_0x5d7ad6[_0xb0ec('0x4b')]]['transfer']=!![];queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x42')]='ATTENDED';queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x44')]=_0x5d7ad6['origtransfererexten'];queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x4e')]=_0x5d7ad6['origtransfereruniqueid'];queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x4')]=_0xb0ec('0x4f');}if(!_[_0xb0ec('0x1f')](queues[_0x5d7ad6[_0xb0ec('0x4a')]])){if(_0x5d7ad6[_0xb0ec('0x50')]&&queues[_0x5d7ad6[_0xb0ec('0x50')]]){queues[_0x5d7ad6['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x5d7ad6['transfereeuniqueid']]=_[_0xb0ec('0x51')](queues[_0x5d7ad6['transfereelinkedid']]);queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0xb')]=_0x5d7ad6[_0xb0ec('0x52')];queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x1c')]=0x2;queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x53')]=queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x53')];queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x54')]=queues[_0x5d7ad6[_0xb0ec('0x4b')]][_0xb0ec('0x54')];queues[_0x5d7ad6['transfereeuniqueid']][_0xb0ec('0x32')]=utils[_0xb0ec('0x11')]();queues[_0x5d7ad6[_0xb0ec('0x41')]]['queuecallerleaveAt']=utils[_0xb0ec('0x11')]();queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x31')]=0x0;queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x55')]=0x0;utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x56'),_0x5d7ad6[_0xb0ec('0x49')],queues[_0x5d7ad6['transfereeuniqueid']][_0xb0ec('0x1a')],queues[_0x5d7ad6[_0xb0ec('0x41')]][_0xb0ec('0x53')],queues[_0x5d7ad6['transfereeuniqueid']]['calleridname']));}else{utils[_0xb0ec('0x0')](util['format'](_0xb0ec('0x57'),_0x5d7ad6[_0xb0ec('0x49')],queues[_0x5d7ad6['origtransfererlinkedid']][_0xb0ec('0x1a')],_0x5d7ad6[_0xb0ec('0x4b')]));queues[_0x5d7ad6[_0xb0ec('0x4a')]][_0xb0ec('0xb')]=_0x5d7ad6['secondtransfererlinkedid'];}}}else if(_0x5d7ad6['secondtransfereruniqueid']==_0x5d7ad6['secondtransfererlinkedid']){if(!_[_0xb0ec('0x1f')](queues[_0x5d7ad6['origtransfererlinkedid']])){utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5d7ad6[_0xb0ec('0x49')],queues[_0x5d7ad6['origtransfererlinkedid']][_0xb0ec('0x1a')],_0x5d7ad6[_0xb0ec('0x58')],_0x5d7ad6['secondtransfererexten']));queues[_0x5d7ad6[_0xb0ec('0x4a')]]['transfer']=!![];queues[_0x5d7ad6[_0xb0ec('0x4a')]][_0xb0ec('0x42')]=_0xb0ec('0x59');queues[_0x5d7ad6[_0xb0ec('0x4a')]][_0xb0ec('0x44')]=_0x5d7ad6['secondtransfererexten'];queues[_0x5d7ad6[_0xb0ec('0x4a')]][_0xb0ec('0x4e')]=_0x5d7ad6[_0xb0ec('0x58')];queues[_0x5d7ad6['origtransfererlinkedid']]['queuecallerexitreason']=_0xb0ec('0x4f');}if(!_[_0xb0ec('0x1f')](queues[_0x5d7ad6[_0xb0ec('0x4b')]])){if(_0x5d7ad6[_0xb0ec('0x5a')]&&queues[_0x5d7ad6[_0xb0ec('0x5a')]]){queues[_0x5d7ad6[_0xb0ec('0x5a')]][_0xb0ec('0x1c')]=0x1;queues[_0x5d7ad6[_0xb0ec('0x52')]]=_[_0xb0ec('0x51')](queues[_0x5d7ad6[_0xb0ec('0x5a')]]);queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0xb')]=_0x5d7ad6[_0xb0ec('0x52')];queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x1c')]=0x2;queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x53')]=queues[_0x5d7ad6['origtransfererlinkedid']]['calleridnum'];queues[_0x5d7ad6[_0xb0ec('0x52')]]['calleridname']=queues[_0x5d7ad6[_0xb0ec('0x4a')]][_0xb0ec('0x54')];queues[_0x5d7ad6[_0xb0ec('0x52')]]['queuecallerjoinAt']=utils['now']();queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x14')]=utils[_0xb0ec('0x11')]();queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x31')]=0x0;queues[_0x5d7ad6['transfertargetuniqueid']]['mohtime']=0x0;utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x5b'),_0x5d7ad6[_0xb0ec('0x49')],queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x1a')],queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0xb')],queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x53')],queues[_0x5d7ad6[_0xb0ec('0x52')]][_0xb0ec('0x54')]));}else{utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x57'),_0x5d7ad6['origtransfereruniqueid'],queues[_0x5d7ad6[_0xb0ec('0x4b')]]['name'],_0x5d7ad6[_0xb0ec('0x4a')]));queues[_0x5d7ad6['secondtransfererlinkedid']][_0xb0ec('0xb')]=_0x5d7ad6[_0xb0ec('0x4a')];}}}}catch(_0x20a571){utils[_0xb0ec('0x1d')](util['format'](_0xb0ec('0x48'),_0x5d7ad6[_0xb0ec('0x49')]),_0x20a571);}};exports[_0xb0ec('0x5c')]=function(_0x5cde66){try{if(!_[_0xb0ec('0x1f')](queues[_0x5cde66[_0xb0ec('0x2')]])){utils[_0xb0ec('0xc')](util[_0xb0ec('0x1')](_0xb0ec('0x5d'),_0x5cde66[_0xb0ec('0x2')]),_0x5cde66);queues[_0x5cde66[_0xb0ec('0x2')]][_0xb0ec('0x5e')]=utils[_0xb0ec('0x11')]();utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')](_0xb0ec('0x5f'),_0x5cde66[_0xb0ec('0x2')],queues[_0x5cde66[_0xb0ec('0x2')]][_0xb0ec('0x1a')],queues[_0x5cde66[_0xb0ec('0x2')]][_0xb0ec('0x5e')]));}}catch(_0x3ec806){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x5d'),_0x5cde66['uniqueid']),_0x3ec806);}};exports['musiconholdstop']=function(_0x13cc22){try{if(!_[_0xb0ec('0x1f')](queues[_0x13cc22[_0xb0ec('0x2')]])){if(!_[_0xb0ec('0x1f')](queues[_0x13cc22['uniqueid']][_0xb0ec('0x5e')])){utils[_0xb0ec('0xc')](util['format']('[%s][queues][musiconholdstop]',_0x13cc22[_0xb0ec('0x2')]),_0x13cc22);queues[_0x13cc22[_0xb0ec('0x2')]][_0xb0ec('0x55')]+=utils[_0xb0ec('0x60')](utils['now'](),queues[_0x13cc22[_0xb0ec('0x2')]][_0xb0ec('0x5e')]);utils[_0xb0ec('0x0')](util[_0xb0ec('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x13cc22['uniqueid'],queues[_0x13cc22['uniqueid']][_0xb0ec('0x1a')],queues[_0x13cc22['uniqueid']][_0xb0ec('0x55')]));delete queues[_0x13cc22['uniqueid']]['musiconholdstartAt'];}}}catch(_0x40e95d){utils[_0xb0ec('0x1d')](util[_0xb0ec('0x1')](_0xb0ec('0x61'),_0x13cc22[_0xb0ec('0x2')]),_0x40e95d);}}; \ No newline at end of file +var _0xc98d=['debug','[%s][queues][queuecallerjoin]','position','assign','error','hangup','isNil','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][hangup]','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','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]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','transfer','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%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','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid'];(function(_0x1bc4e0,_0x2d3fb8){var _0xb4c533=function(_0x4e62a8){while(--_0x4e62a8){_0x1bc4e0['push'](_0x1bc4e0['shift']());}};_0xb4c533(++_0x2d3fb8);}(_0xc98d,0x121));var _0xdc98=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xc98d[_0x2d4661];return _0x42ed1e;};'use strict';var _=require(_0xdc98('0x0'));var util=require(_0xdc98('0x1'));var utils=require(_0xdc98('0x2'));var queues={};function writeDB(_0x3474c3){utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x5'),_0x3474c3['uniqueid'],_0x3474c3[_0xdc98('0x6')],_0x3474c3[_0xdc98('0x7')],_0x3474c3[_0xdc98('0x8')],_0x3474c3['calleridnum'],_0x3474c3['accountcode'],_0x3474c3[_0xdc98('0x9')]));if(_0x3474c3['queue']){utils[_0xdc98('0xa')](_0x3474c3[_0xdc98('0x7')])[_0xdc98('0xb')](function(_0x1e5094){if(_0x1e5094){_0x3474c3[_0xdc98('0xc')]=_0x1e5094[_0xdc98('0xc')];}utils[_0xdc98('0xd')](_0xdc98('0xe'),_0x3474c3);});}else{utils[_0xdc98('0xd')](_0xdc98('0xe'),_0x3474c3);}if(_0x3474c3[_0xdc98('0xf')]){delete queues[_0x3474c3['transfereduniqueid']];}else{delete queues[_0x3474c3[_0xdc98('0x10')]];}}exports['queuecallerjoin']=function(_0x3b71b2){try{utils[_0xdc98('0x11')](util[_0xdc98('0x4')](_0xdc98('0x12'),_0x3b71b2[_0xdc98('0x10')]),_0x3b71b2);utils['info'](util[_0xdc98('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x3b71b2[_0xdc98('0x10')],_0x3b71b2[_0xdc98('0x7')],_0x3b71b2[_0xdc98('0x13')]));queues[_0x3b71b2['uniqueid']]=_[_0xdc98('0x14')](_0x3b71b2,{'originalposition':_0x3b71b2[_0xdc98('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x1c6fab){utils[_0xdc98('0x15')](util[_0xdc98('0x4')](_0xdc98('0x12'),_0x3b71b2[_0xdc98('0x10')]),_0x1c6fab);}};exports[_0xdc98('0x16')]=function(_0x3e5963){try{if(!_[_0xdc98('0x17')](queues[_0x3e5963[_0xdc98('0x10')]])){utils[_0xdc98('0x11')](util[_0xdc98('0x4')]('[%s][queues][hangup]',_0x3e5963[_0xdc98('0x10')]),_0x3e5963);if(queues[_0x3e5963['uniqueid']][_0xdc98('0x18')]){if(!queues[_0x3e5963[_0xdc98('0x10')]]['queuecallerabandon']&&!queues[_0x3e5963['uniqueid']]['queuecallerexit']){queues[_0x3e5963[_0xdc98('0x10')]][_0xdc98('0x19')]=!![];queues[_0x3e5963['uniqueid']][_0xdc98('0x1a')]=utils['now']();queues[_0x3e5963['uniqueid']][_0xdc98('0x9')]=_0xdc98('0x1b');}utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x1c'),_0x3e5963['uniqueid'],queues[_0x3e5963['uniqueid']]['name'],queues[_0x3e5963[_0xdc98('0x10')]][_0xdc98('0x9')]));writeDB(queues[_0x3e5963[_0xdc98('0x10')]]);}else if(queues[_0x3e5963['uniqueid']][_0xdc98('0xf')]){utils['info'](util[_0xdc98('0x4')](_0xdc98('0x1d'),_0x3e5963[_0xdc98('0x10')],queues[_0x3e5963[_0xdc98('0x10')]]['name'],queues[_0x3e5963[_0xdc98('0x10')]][_0xdc98('0xf')]));queues[queues[_0x3e5963[_0xdc98('0x10')]][_0xdc98('0xf')]]=queues[_0x3e5963['uniqueid']];queues[queues[_0x3e5963[_0xdc98('0x10')]][_0xdc98('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x3e5963['uniqueid']];}}}catch(_0x5212bf){utils[_0xdc98('0x15')](util['format'](_0xdc98('0x1e'),_0x3e5963[_0xdc98('0x10')]),_0x5212bf);}};exports['varset']=function(_0x4ac03c){try{utils['debug'](util[_0xdc98('0x4')](_0xdc98('0x1f'),_0x4ac03c[_0xdc98('0x10')]),_0x4ac03c);if(!_['isNil'](_0x4ac03c[_0xdc98('0x20')]['queuestatus'])&&_0x4ac03c[_0xdc98('0x21')][_0xdc98('0x22')]()!==_0xdc98('0x23')){if(!_['isNil'](queues[_0x4ac03c['uniqueid']])){queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x24')]=![];queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x25')]=null;queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x26')]=!![];queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x27')]=utils[_0xdc98('0x28')]();queues[_0x4ac03c[_0xdc98('0x10')]]['queuecallerexitreason']=_0x4ac03c['value']['toUpperCase']();utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x29'),_0x4ac03c[_0xdc98('0x10')],queues[_0x4ac03c['uniqueid']][_0xdc98('0x2a')],_0x4ac03c['value'],queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x9')]));writeDB(queues[_0x4ac03c[_0xdc98('0x10')]]);}}else if(!_[_0xdc98('0x17')](_0x4ac03c['variable'][_0xdc98('0x2b')])){if(!_[_0xdc98('0x17')](queues[_0x4ac03c[_0xdc98('0x10')]])&&!queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x24')]){queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x24')]=![];queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x25')]=null;queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x26')]=!![];queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x27')]=utils[_0xdc98('0x28')]();queues[_0x4ac03c['uniqueid']][_0xdc98('0x9')]=_0xdc98('0x2c');utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x2d'),_0x4ac03c[_0xdc98('0x10')],queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x2a')],_0x4ac03c[_0xdc98('0x21')],queues[_0x4ac03c[_0xdc98('0x10')]][_0xdc98('0x9')]));}}}catch(_0x1713b0){utils['error'](util[_0xdc98('0x4')]('[%s][queues][varset]',_0x4ac03c[_0xdc98('0x10')]),_0x1713b0);}};exports[_0xdc98('0x24')]=function(_0x4b292f){try{if(!_['isNil'](queues[_0x4b292f[_0xdc98('0x10')]])){utils[_0xdc98('0x11')](util['format'](_0xdc98('0x2e'),_0x4b292f[_0xdc98('0x10')]),_0x4b292f);queues[_0x4b292f[_0xdc98('0x10')]][_0xdc98('0x26')]=![];queues[_0x4b292f['uniqueid']][_0xdc98('0x27')]=null;queues[_0x4b292f['uniqueid']][_0xdc98('0x24')]=!![];queues[_0x4b292f[_0xdc98('0x10')]][_0xdc98('0x25')]=utils[_0xdc98('0x28')]();queues[_0x4b292f[_0xdc98('0x10')]][_0xdc98('0x9')]=_0xdc98('0x2f');utils['info'](util[_0xdc98('0x4')](_0xdc98('0x30'),_0x4b292f[_0xdc98('0x10')],queues[_0x4b292f['uniqueid']][_0xdc98('0x2a')],queues[_0x4b292f['uniqueid']][_0xdc98('0x9')]));}}catch(_0x4adaab){utils[_0xdc98('0x15')](util[_0xdc98('0x4')](_0xdc98('0x2e'),_0x4b292f['uniqueid']),_0x4adaab);}};exports[_0xdc98('0x31')]=function(_0x2c7661){try{if(!_[_0xdc98('0x17')](queues[_0x2c7661[_0xdc98('0x10')]])){utils['debug'](util['format'](_0xdc98('0x32'),_0x2c7661['uniqueid']),_0x2c7661);utils['info'](util[_0xdc98('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2c7661[_0xdc98('0x10')],queues[_0x2c7661[_0xdc98('0x10')]]['name'],_0x2c7661[_0xdc98('0x33')],_0x2c7661[_0xdc98('0x34')]));queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x31')]=!![];queues[_0x2c7661['uniqueid']]['queuecallerleaveAt']=utils[_0xdc98('0x28')]();queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x35')]=utils[_0xdc98('0x36')](queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x18')],queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x37')]);queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x13')]=_0x2c7661['position'];queues[_0x2c7661[_0xdc98('0x10')]]['count']=_0x2c7661['count'];queues[_0x2c7661[_0xdc98('0x10')]][_0xdc98('0x33')]=_0x2c7661[_0xdc98('0x33')];queues[_0x2c7661[_0xdc98('0x10')]]['connectedlinename']=_0x2c7661[_0xdc98('0x34')];}}catch(_0x372dc5){utils[_0xdc98('0x15')](util[_0xdc98('0x4')](_0xdc98('0x32'),_0x2c7661[_0xdc98('0x10')]),_0x372dc5);}};exports[_0xdc98('0x38')]=function(_0xe9b258){try{if(!_[_0xdc98('0x17')](queues[_0xe9b258['uniqueid']])){utils[_0xdc98('0x11')](util[_0xdc98('0x4')]('[%s][queues][agentconnect]',_0xe9b258[_0xdc98('0x10')]),_0xe9b258);utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x39'),_0xe9b258[_0xdc98('0x10')],queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x2a')],_0xe9b258[_0xdc98('0x3a')],_0xe9b258[_0xdc98('0x3b')]));queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x24')]=![];queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x24')]=![];queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x25')]=null;queues[_0xe9b258[_0xdc98('0x10')]]['queuecallerexit']=![];queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x9')]=null;queues[_0xe9b258[_0xdc98('0x10')]][_0xdc98('0x27')]=null;queues[_0xe9b258['uniqueid']][_0xdc98('0x3c')]=!![];queues[_0xe9b258['uniqueid']]['accountcode']=_0xe9b258['destaccountcode'];queues[_0xe9b258['uniqueid']]['lastAssignedTo']=_0xe9b258[_0xdc98('0x3a')];}}catch(_0x5dbbf9){utils[_0xdc98('0x15')](util[_0xdc98('0x4')](_0xdc98('0x3d'),_0xe9b258[_0xdc98('0x10')]),_0x5dbbf9);}};exports['agentcomplete']=function(_0x544ce4){try{if(!_[_0xdc98('0x17')](queues[_0x544ce4[_0xdc98('0x10')]])){if(queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x18')]){utils[_0xdc98('0x11')](util[_0xdc98('0x4')](_0xdc98('0x3e'),_0x544ce4[_0xdc98('0x10')]),_0x544ce4);queues[_0x544ce4[_0xdc98('0x10')]]['queuecallerabandon']=![];queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x24')]=![];queues[_0x544ce4['uniqueid']][_0xdc98('0x25')]=null;queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x26')]=![];queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x27')]=null;queues[_0x544ce4['uniqueid']]['assigned']=!![];queues[_0x544ce4['uniqueid']][_0xdc98('0x8')]=_0x544ce4[_0xdc98('0x3a')];queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x19')]=!![];queues[_0x544ce4[_0xdc98('0x10')]]['queuecallercompleteAt']=utils[_0xdc98('0x28')]();if(_0x544ce4['reason']=='transfer'){if(!queues[_0x544ce4['uniqueid']][_0xdc98('0x3f')]){queues[_0x544ce4[_0xdc98('0x10')]][_0xdc98('0x9')]='TRANSFER';}}else{queues[_0x544ce4[_0xdc98('0x10')]]['queuecallerexitreason']='COMPLETEDBY'+_0x544ce4[_0xdc98('0x40')][_0xdc98('0x22')]();}utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x41'),_0x544ce4[_0xdc98('0x10')],queues[_0x544ce4[_0xdc98('0x10')]]['name'],_0x544ce4[_0xdc98('0x3a')],queues[_0x544ce4['uniqueid']][_0xdc98('0x9')]));writeDB(queues[_0x544ce4[_0xdc98('0x10')]]);}}}catch(_0x11eace){utils[_0xdc98('0x15')](util[_0xdc98('0x4')]('[%s][queues][agentcomplete]',_0x544ce4['uniqueid']),_0x11eace);}};exports[_0xdc98('0x42')]=function(_0x51c94b){try{if(!_[_0xdc98('0x17')](queues[_0x51c94b[_0xdc98('0x43')]])){utils[_0xdc98('0x11')](util[_0xdc98('0x4')](_0xdc98('0x44'),_0x51c94b[_0xdc98('0x10')]),_0x51c94b);queues[_0x51c94b[_0xdc98('0x43')]][_0xdc98('0x3f')]=!![];queues[_0x51c94b[_0xdc98('0x43')]][_0xdc98('0x45')]=_0xdc98('0x46');queues[_0x51c94b['transfereeuniqueid']][_0xdc98('0x47')]=_0x51c94b[_0xdc98('0x48')];queues[_0x51c94b['transfereeuniqueid']][_0xdc98('0x49')]=_0x51c94b['transfereeuniqueid'];queues[_0x51c94b[_0xdc98('0x43')]]['queuecallerexitreason']=_0xdc98('0x4a');utils[_0xdc98('0x3')](util[_0xdc98('0x4')](_0xdc98('0x4b'),_0x51c94b[_0xdc98('0x10')],queues[_0x51c94b['transfereeuniqueid']][_0xdc98('0x2a')],_0x51c94b[_0xdc98('0x43')],_0x51c94b[_0xdc98('0x48')]));}}catch(_0xc2bc78){utils[_0xdc98('0x15')](util['format'](_0xdc98('0x44'),_0x51c94b[_0xdc98('0x10')]),_0xc2bc78);}};exports[_0xdc98('0x4c')]=function(_0x1e2f57){try{utils[_0xdc98('0x11')](util[_0xdc98('0x4')](_0xdc98('0x4d'),_0x1e2f57[_0xdc98('0x4e')]),_0x1e2f57);if(_0x1e2f57['origtransfereruniqueid']==_0x1e2f57[_0xdc98('0x4f')]){if(!_[_0xdc98('0x17')](queues[_0x1e2f57[_0xdc98('0x50')]])){utils['info'](util[_0xdc98('0x4')](_0xdc98('0x51'),_0x1e2f57[_0xdc98('0x4e')],queues[_0x1e2f57[_0xdc98('0x50')]]['name'],_0x1e2f57['origtransfererexten']));queues[_0x1e2f57['secondtransfererlinkedid']][_0xdc98('0x3f')]=!![];queues[_0x1e2f57['secondtransfererlinkedid']][_0xdc98('0x45')]=_0xdc98('0x52');queues[_0x1e2f57[_0xdc98('0x50')]]['transferexten']=_0x1e2f57[_0xdc98('0x53')];queues[_0x1e2f57[_0xdc98('0x50')]][_0xdc98('0x49')]=_0x1e2f57[_0xdc98('0x4e')];queues[_0x1e2f57[_0xdc98('0x50')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xdc98('0x17')](queues[_0x1e2f57['origtransfererlinkedid']])){if(_0x1e2f57['transfereelinkedid']&&queues[_0x1e2f57[_0xdc98('0x54')]]){queues[_0x1e2f57[_0xdc98('0x54')]][_0xdc98('0x55')]=0x1;queues[_0x1e2f57[_0xdc98('0x43')]]=_['clone'](queues[_0x1e2f57['transfereelinkedid']]);queues[_0x1e2f57[_0xdc98('0x43')]]['transfereduniqueid']=_0x1e2f57[_0xdc98('0x56')];queues[_0x1e2f57['transfereeuniqueid']][_0xdc98('0x55')]=0x2;queues[_0x1e2f57[_0xdc98('0x43')]][_0xdc98('0x57')]=queues[_0x1e2f57[_0xdc98('0x50')]][_0xdc98('0x57')];queues[_0x1e2f57['transfereeuniqueid']][_0xdc98('0x58')]=queues[_0x1e2f57[_0xdc98('0x50')]]['calleridname'];queues[_0x1e2f57[_0xdc98('0x43')]][_0xdc98('0x37')]=utils[_0xdc98('0x28')]();queues[_0x1e2f57[_0xdc98('0x43')]][_0xdc98('0x18')]=utils[_0xdc98('0x28')]();queues[_0x1e2f57[_0xdc98('0x43')]][_0xdc98('0x35')]=0x0;queues[_0x1e2f57[_0xdc98('0x43')]]['mohtime']=0x0;utils[_0xdc98('0x3')](util['format'](_0xdc98('0x59'),_0x1e2f57['origtransfereruniqueid'],queues[_0x1e2f57['transfereeuniqueid']][_0xdc98('0x2a')],queues[_0x1e2f57[_0xdc98('0x43')]][_0xdc98('0x57')],queues[_0x1e2f57['transfereeuniqueid']]['calleridname']));}else{utils[_0xdc98('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1e2f57[_0xdc98('0x4e')],queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x2a')],_0x1e2f57[_0xdc98('0x50')]));queues[_0x1e2f57[_0xdc98('0x4f')]]['transfereduniqueid']=_0x1e2f57[_0xdc98('0x50')];}}}else if(_0x1e2f57[_0xdc98('0x5a')]==_0x1e2f57[_0xdc98('0x50')]){if(!_['isNil'](queues[_0x1e2f57[_0xdc98('0x4f')]])){utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1e2f57[_0xdc98('0x4e')],queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x2a')],_0x1e2f57['secondtransfereruniqueid'],_0x1e2f57[_0xdc98('0x5b')]));queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x3f')]=!![];queues[_0x1e2f57['origtransfererlinkedid']][_0xdc98('0x45')]=_0xdc98('0x52');queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x47')]=_0x1e2f57['secondtransfererexten'];queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x49')]=_0x1e2f57[_0xdc98('0x5a')];queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x9')]=_0xdc98('0x5c');}if(!_['isNil'](queues[_0x1e2f57['secondtransfererlinkedid']])){if(_0x1e2f57[_0xdc98('0x5d')]&&queues[_0x1e2f57[_0xdc98('0x5d')]]){queues[_0x1e2f57[_0xdc98('0x5d')]]['queuecallerenterreason']=0x1;queues[_0x1e2f57[_0xdc98('0x56')]]=_[_0xdc98('0x5e')](queues[_0x1e2f57['transfertargetlinkedid']]);queues[_0x1e2f57[_0xdc98('0x56')]]['transfereduniqueid']=_0x1e2f57['transfertargetuniqueid'];queues[_0x1e2f57[_0xdc98('0x56')]]['queuecallerenterreason']=0x2;queues[_0x1e2f57['transfertargetuniqueid']]['calleridnum']=queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x57')];queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x58')]=queues[_0x1e2f57[_0xdc98('0x4f')]][_0xdc98('0x58')];queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x37')]=utils['now']();queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x18')]=utils['now']();queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x35')]=0x0;queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x5f')]=0x0;utils[_0xdc98('0x3')](util[_0xdc98('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x1e2f57[_0xdc98('0x4e')],queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x2a')],queues[_0x1e2f57[_0xdc98('0x56')]]['transfereduniqueid'],queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x57')],queues[_0x1e2f57[_0xdc98('0x56')]][_0xdc98('0x58')]));}else{utils[_0xdc98('0x3')](util['format'](_0xdc98('0x60'),_0x1e2f57[_0xdc98('0x4e')],queues[_0x1e2f57[_0xdc98('0x50')]][_0xdc98('0x2a')],_0x1e2f57[_0xdc98('0x4f')]));queues[_0x1e2f57[_0xdc98('0x50')]][_0xdc98('0xf')]=_0x1e2f57['origtransfererlinkedid'];}}}}catch(_0x13de6b){utils[_0xdc98('0x15')](util[_0xdc98('0x4')](_0xdc98('0x4d'),_0x1e2f57['origtransfereruniqueid']),_0x13de6b);}};exports[_0xdc98('0x61')]=function(_0x12599e){try{if(!_[_0xdc98('0x17')](queues[_0x12599e[_0xdc98('0x10')]])){utils['debug'](util['format'](_0xdc98('0x62'),_0x12599e[_0xdc98('0x10')]),_0x12599e);queues[_0x12599e[_0xdc98('0x10')]]['musiconholdstartAt']=utils[_0xdc98('0x28')]();utils[_0xdc98('0x3')](util['format'](_0xdc98('0x63'),_0x12599e['uniqueid'],queues[_0x12599e[_0xdc98('0x10')]][_0xdc98('0x2a')],queues[_0x12599e['uniqueid']][_0xdc98('0x64')]));}}catch(_0x2b6b73){utils['error'](util['format'](_0xdc98('0x62'),_0x12599e['uniqueid']),_0x2b6b73);}};exports['musiconholdstop']=function(_0x554de5){try{if(!_[_0xdc98('0x17')](queues[_0x554de5[_0xdc98('0x10')]])){if(!_[_0xdc98('0x17')](queues[_0x554de5[_0xdc98('0x10')]][_0xdc98('0x64')])){utils[_0xdc98('0x11')](util[_0xdc98('0x4')]('[%s][queues][musiconholdstop]',_0x554de5[_0xdc98('0x10')]),_0x554de5);queues[_0x554de5['uniqueid']]['mohtime']+=utils[_0xdc98('0x36')](utils[_0xdc98('0x28')](),queues[_0x554de5['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xdc98('0x4')](_0xdc98('0x65'),_0x554de5['uniqueid'],queues[_0x554de5['uniqueid']][_0xdc98('0x2a')],queues[_0x554de5[_0xdc98('0x10')]][_0xdc98('0x5f')]));delete queues[_0x554de5['uniqueid']]['musiconholdstartAt'];}}}catch(_0x4fff3b){utils[_0xdc98('0x15')](util[_0xdc98('0x4')]('[%s][queues][musiconholdstop]',_0x554de5[_0xdc98('0x10')]),_0x4fff3b);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 2855e82..fdd4e0f 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 _0x797a=['set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','util','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','name','UserId','request','CreateVoiceRecording','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','error','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata'];(function(_0x1a9dd5,_0x4894d5){var _0x1738f0=function(_0x26ea46){while(--_0x26ea46){_0x1a9dd5['push'](_0x1a9dd5['shift']());}};_0x1738f0(++_0x4894d5);}(_0x797a,0xe4));var _0xa797=function(_0x571bef,_0x404091){_0x571bef=_0x571bef-0x0;var _0x22dc22=_0x797a[_0x571bef];return _0x22dc22;};'use strict';var _=require('lodash');var util=require(_0xa797('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x1e0b96){var _0x392b3d;utils[_0xa797('0x1')](util[_0xa797('0x2')](_0xa797('0x3'),_0x1e0b96[_0xa797('0x4')]));if(transfers[_0xa797('0x5')][_0x1e0b96[_0xa797('0x4')]]){_0x392b3d=_0x1e0b96[_0xa797('0x4')];_0x1e0b96[_0xa797('0x4')]=transfers[_0xa797('0x5')][_0x1e0b96['uniqueid']][_0xa797('0x6')];}if(_0x1e0b96[_0xa797('0x7')]){utils[_0xa797('0x8')](_0x1e0b96[_0xa797('0x7')])['then'](function(_0x67f6b8){if(_0x67f6b8){_0x1e0b96['membername']=_0x67f6b8[_0xa797('0x9')];_0x1e0b96[_0xa797('0xa')]=_0x67f6b8['id'];}utils[_0xa797('0xb')](_0xa797('0xc'),_0x1e0b96);});}else{utils[_0xa797('0xb')]('CreateVoiceRecording',_0x1e0b96);}if(_0x392b3d)delete transfers[_0xa797('0x5')][_0x392b3d];}exports['newchannel']=function(_0x4dba71){try{utils['debug'](util['format']('[%s][recordings][newchannel]',_0x4dba71[_0xa797('0x4')]),_0x4dba71);if(_0x4dba71[_0xa797('0x4')]==_0x4dba71[_0xa797('0xd')]){utils['info'](util[_0xa797('0x2')](_0xa797('0xe'),_0x4dba71[_0xa797('0x4')],_0x4dba71[_0xa797('0xf')],_0x4dba71['exten']));recordings[_0x4dba71[_0xa797('0x4')]]={'uniqueid':_0x4dba71[_0xa797('0x4')],'accountcode':_0x4dba71[_0xa797('0x7')],'exten':_0x4dba71[_0xa797('0x10')],'context':_0x4dba71[_0xa797('0xf')],'channel':_0x4dba71[_0xa797('0x11')],'monitors':[]};}}catch(_0x44fd48){utils['error'](util['format'](_0xa797('0x12'),_0x4dba71[_0xa797('0x4')]),_0x44fd48);}};exports['newstate']=function(_0x1f6338){try{utils[_0xa797('0x13')](util[_0xa797('0x2')](_0xa797('0x14'),_0x1f6338[_0xa797('0x4')]),_0x1f6338);if(!_[_0xa797('0x15')](recordings[_0x1f6338[_0xa797('0x4')]])&&_0x1f6338[_0xa797('0x16')]==0x6){utils[_0xa797('0x1')](util['format'](_0xa797('0x17'),_0x1f6338[_0xa797('0x4')],_0x1f6338['context'],_0x1f6338['channel']));}else if(!_[_0xa797('0x15')](recordings[_0x1f6338[_0xa797('0xd')]])&&_0x1f6338['channelstate']==0x6&&_0x1f6338[_0xa797('0xf')]!=_0xa797('0x18')){utils[_0xa797('0x1')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1f6338[_0xa797('0x4')],_0x1f6338[_0xa797('0xd')],_0x1f6338[_0xa797('0xf')],_0x1f6338[_0xa797('0x11')]));recordings[_0x1f6338[_0xa797('0xd')]][_0xa797('0x7')]=_0x1f6338['accountcode'];}}catch(_0x297d0f){utils[_0xa797('0x19')](util[_0xa797('0x2')](_0xa797('0x14'),_0x1f6338['uniqueid']),_0x297d0f);}};exports[_0xa797('0x1a')]=function(_0x208536){try{if(!_[_0xa797('0x15')](_0x208536[_0xa797('0x1b')])&&!_[_0xa797('0x15')](_0x208536['variable']['mixmonitor_filename'])){utils[_0xa797('0x13')](util[_0xa797('0x2')](_0xa797('0x1c'),_0x208536[_0xa797('0x4')]),_0x208536);utils['info'](util[_0xa797('0x2')](_0xa797('0x1d'),_0x208536['uniqueid'],_0x208536[_0xa797('0x1b')],_0x208536[_0xa797('0x1e')]));if(_[_0xa797('0x1f')](_0x208536['value'],_0xa797('0x20'))){_0x208536[_0xa797('0x1e')]=_0x208536[_0xa797('0x1e')][_0xa797('0x21')]('.wav49','.WAV');}if(recordings[_0x208536[_0xa797('0xd')]]){var _0x52f522=_[_0xa797('0x22')](recordings[_0x208536['linkedid']][_0xa797('0x23')],{'value':_0x208536[_0xa797('0x1e')]});if(_[_0xa797('0x15')](_0x52f522)){recordings[_0x208536[_0xa797('0xd')]][_0xa797('0x23')][_0xa797('0x24')]({'value':_0x208536[_0xa797('0x1e')]});}}}}catch(_0x42a0ea){utils[_0xa797('0x19')](util['format'](_0xa797('0x1c'),_0x208536[_0xa797('0x4')]),_0x42a0ea);}};exports[_0xa797('0x25')]=function(_0x14dfa7){try{if(!_[_0xa797('0x15')](recordings[_0x14dfa7[_0xa797('0x4')]])){utils['debug'](util[_0xa797('0x2')]('[%s][recordings][hangup]',_0x14dfa7[_0xa797('0x4')]),_0x14dfa7);utils['info'](util[_0xa797('0x2')](_0xa797('0x26'),_0x14dfa7[_0xa797('0x4')],_0x14dfa7[_0xa797('0x27')],_0x14dfa7['calleridname'],_0x14dfa7[_0xa797('0x28')]));recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x27')]=_0x14dfa7[_0xa797('0x27')];recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x29')]=_0x14dfa7['calleridname'];recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x2a')]=_0x14dfa7['connectedlinenum'];recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x2b')]=_0x14dfa7[_0xa797('0x2b')];if(recordings[_0x14dfa7['uniqueid']][_0xa797('0x2c')]==_0xa797('0x2d')&&recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x7')]){recordings[_0x14dfa7[_0xa797('0x4')]]['connectedlinenum']=recordings[_0x14dfa7[_0xa797('0x4')]]['accountcode'];recordings[_0x14dfa7[_0xa797('0x4')]][_0xa797('0x2b')]='';}recordings[_0x14dfa7[_0xa797('0x4')]]['monitors']['forEach'](function(_0x26ec3e){var _0x587a5d=_[_0xa797('0x2e')](recordings[_0x14dfa7[_0xa797('0x4')]]);_0x587a5d['value']=_0x26ec3e[_0xa797('0x1e')];writeDB(_0x587a5d);});delete recordings[_0x14dfa7[_0xa797('0x4')]];}}catch(_0x4a15c5){utils[_0xa797('0x19')](util['format'](_0xa797('0x2f'),_0x14dfa7[_0xa797('0x4')]),_0x4a15c5);}};exports['newexten']=function(_0x404bc6){try{if(!_[_0xa797('0x15')](recordings[_0x404bc6[_0xa797('0x4')]])){utils[_0xa797('0x13')](util[_0xa797('0x2')](_0xa797('0x30'),_0x404bc6[_0xa797('0x4')]),_0x404bc6);utils[_0xa797('0x1')](util[_0xa797('0x2')](_0xa797('0x31'),_0x404bc6['uniqueid'],_0x404bc6[_0xa797('0x32')],_0x404bc6[_0xa797('0x33')]));if(_0x404bc6[_0xa797('0x32')]['toLowerCase']()==_0xa797('0x34')&&_[_0xa797('0x35')](_0x404bc6['appdata'][_0xa797('0x36')](),_0xa797('0x37'))){var _0x41ba9b=_0x404bc6[_0xa797('0x33')][_0xa797('0x38')]('=');var _0x4516ae=_0x41ba9b[0x0][_0xa797('0x39')](_0x41ba9b[0x0]['lastIndexOf']('(')+0x1,_0x41ba9b[0x0][_0xa797('0x3a')](')'));var _0x16b34f=_0x41ba9b[0x1];recordings[_0x404bc6[_0xa797('0x4')]][_0x4516ae]=_0x16b34f;}}}catch(_0xdb3c10){utils[_0xa797('0x19')](util[_0xa797('0x2')](_0xa797('0x30'),_0x404bc6[_0xa797('0x4')]),_0xdb3c10);}};exports[_0xa797('0x3b')]=function(_0x1e3966){try{if(!_[_0xa797('0x15')](recordings[_0x1e3966[_0xa797('0x4')]])){utils[_0xa797('0x13')](util[_0xa797('0x2')](_0xa797('0x3c'),_0x1e3966['uniqueid']),_0x1e3966);utils[_0xa797('0x1')](util[_0xa797('0x2')](_0xa797('0x3d'),_0x1e3966[_0xa797('0x4')],_0x1e3966[_0xa797('0x3e')]));recordings[_0x1e3966[_0xa797('0x4')]][_0xa797('0x3e')]=_0x1e3966['queue'];}}catch(_0x56ad92){utils['error'](util[_0xa797('0x2')]('[%s][recordings][queuecallerjoin]',_0x1e3966[_0xa797('0x4')]),_0x56ad92);}};exports['blindtransfer']=function(_0x37acca){try{utils[_0xa797('0x13')](util[_0xa797('0x2')](_0xa797('0x3f'),_0x37acca[_0xa797('0x4')]),_0x37acca);utils['info'](util[_0xa797('0x2')](_0xa797('0x40'),_0x37acca['uniqueid'],_0x37acca[_0xa797('0x41')],_0x37acca[_0xa797('0x42')],_0x37acca['transfereecalleridnum'],_0x37acca[_0xa797('0x43')]));if(recordings[_0x37acca[_0xa797('0x44')]]&&transfers[_0xa797('0x5')][_0x37acca[_0xa797('0x44')]]){transfers['blinds'][_0x37acca[_0xa797('0x44')]][_0xa797('0x45')]=!![];}}catch(_0x26cf89){utils[_0xa797('0x19')](util[_0xa797('0x2')]('[%s][recordings][blindtransfer]',_0x37acca[_0xa797('0x4')]),_0x26cf89);}}; \ No newline at end of file +var _0x92cb=['channel','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','blinds','uniqueid','transfereeuniqueid','accountcode','getUserByInternal','then','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context'];(function(_0x43f4f6,_0x211510){var _0x26ac82=function(_0x454031){while(--_0x454031){_0x43f4f6['push'](_0x43f4f6['shift']());}};_0x26ac82(++_0x211510);}(_0x92cb,0x101));var _0xb92c=function(_0x6aeaf4,_0x17fd47){_0x6aeaf4=_0x6aeaf4-0x0;var _0x332904=_0x92cb[_0x6aeaf4];return _0x332904;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xb92c('0x0'));var transfers=require(_0xb92c('0x1'));var recordings={};function writeDB(_0x2ebb3a){var _0x274947;utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x4'),_0x2ebb3a['uniqueid']));if(transfers[_0xb92c('0x5')][_0x2ebb3a[_0xb92c('0x6')]]){_0x274947=_0x2ebb3a[_0xb92c('0x6')];_0x2ebb3a[_0xb92c('0x6')]=transfers[_0xb92c('0x5')][_0x2ebb3a[_0xb92c('0x6')]][_0xb92c('0x7')];}if(_0x2ebb3a[_0xb92c('0x8')]){utils[_0xb92c('0x9')](_0x2ebb3a[_0xb92c('0x8')])[_0xb92c('0xa')](function(_0x5d8dae){if(_0x5d8dae){_0x2ebb3a['membername']=_0x5d8dae['name'];_0x2ebb3a['UserId']=_0x5d8dae['id'];}utils[_0xb92c('0xb')](_0xb92c('0xc'),_0x2ebb3a);});}else{utils[_0xb92c('0xb')](_0xb92c('0xc'),_0x2ebb3a);}if(_0x274947)delete transfers[_0xb92c('0x5')][_0x274947];}exports[_0xb92c('0xd')]=function(_0x28883d){try{utils['debug'](util[_0xb92c('0x3')](_0xb92c('0xe'),_0x28883d[_0xb92c('0x6')]),_0x28883d);if(_0x28883d[_0xb92c('0x6')]==_0x28883d[_0xb92c('0xf')]){utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x10'),_0x28883d[_0xb92c('0x6')],_0x28883d['context'],_0x28883d[_0xb92c('0x11')]));recordings[_0x28883d[_0xb92c('0x6')]]={'uniqueid':_0x28883d[_0xb92c('0x6')],'accountcode':_0x28883d[_0xb92c('0x8')],'exten':_0x28883d[_0xb92c('0x11')],'context':_0x28883d[_0xb92c('0x12')],'channel':_0x28883d[_0xb92c('0x13')],'monitors':[]};}}catch(_0x29b3dc){utils[_0xb92c('0x14')](util[_0xb92c('0x3')](_0xb92c('0xe'),_0x28883d[_0xb92c('0x6')]),_0x29b3dc);}};exports[_0xb92c('0x15')]=function(_0x28d2a5){try{utils[_0xb92c('0x16')](util[_0xb92c('0x3')](_0xb92c('0x17'),_0x28d2a5['uniqueid']),_0x28d2a5);if(!_[_0xb92c('0x18')](recordings[_0x28d2a5[_0xb92c('0x6')]])&&_0x28d2a5[_0xb92c('0x19')]==0x6){utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x1a'),_0x28d2a5[_0xb92c('0x6')],_0x28d2a5[_0xb92c('0x12')],_0x28d2a5['channel']));}else if(!_['isNil'](recordings[_0x28d2a5[_0xb92c('0xf')]])&&_0x28d2a5[_0xb92c('0x19')]==0x6&&_0x28d2a5[_0xb92c('0x12')]!=_0xb92c('0x1b')){utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x1c'),_0x28d2a5['uniqueid'],_0x28d2a5[_0xb92c('0xf')],_0x28d2a5[_0xb92c('0x12')],_0x28d2a5['channel']));recordings[_0x28d2a5[_0xb92c('0xf')]][_0xb92c('0x8')]=_0x28d2a5[_0xb92c('0x8')];}}catch(_0x4f4063){utils[_0xb92c('0x14')](util[_0xb92c('0x3')](_0xb92c('0x17'),_0x28d2a5[_0xb92c('0x6')]),_0x4f4063);}};exports[_0xb92c('0x1d')]=function(_0x5c9bcc){try{if(!_[_0xb92c('0x18')](_0x5c9bcc[_0xb92c('0x1e')])&&!_[_0xb92c('0x18')](_0x5c9bcc[_0xb92c('0x1e')][_0xb92c('0x1f')])){utils[_0xb92c('0x16')](util['format'](_0xb92c('0x20'),_0x5c9bcc[_0xb92c('0x6')]),_0x5c9bcc);utils['info'](util[_0xb92c('0x3')](_0xb92c('0x21'),_0x5c9bcc['uniqueid'],_0x5c9bcc['variable'],_0x5c9bcc['value']));if(_['endsWith'](_0x5c9bcc[_0xb92c('0x22')],'.wav49')){_0x5c9bcc[_0xb92c('0x22')]=_0x5c9bcc[_0xb92c('0x22')][_0xb92c('0x23')]('.wav49',_0xb92c('0x24'));}if(recordings[_0x5c9bcc[_0xb92c('0xf')]]){var _0x38c276=_[_0xb92c('0x25')](recordings[_0x5c9bcc[_0xb92c('0xf')]][_0xb92c('0x26')],{'value':_0x5c9bcc[_0xb92c('0x22')]});if(_[_0xb92c('0x18')](_0x38c276)){recordings[_0x5c9bcc[_0xb92c('0xf')]][_0xb92c('0x26')][_0xb92c('0x27')]({'value':_0x5c9bcc[_0xb92c('0x22')]});}}}}catch(_0x30c6ff){utils[_0xb92c('0x14')](util[_0xb92c('0x3')](_0xb92c('0x20'),_0x5c9bcc[_0xb92c('0x6')]),_0x30c6ff);}};exports[_0xb92c('0x28')]=function(_0x257a2e){try{if(!_[_0xb92c('0x18')](recordings[_0x257a2e[_0xb92c('0x6')]])){utils[_0xb92c('0x16')](util[_0xb92c('0x3')]('[%s][recordings][hangup]',_0x257a2e[_0xb92c('0x6')]),_0x257a2e);utils['info'](util[_0xb92c('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x257a2e[_0xb92c('0x6')],_0x257a2e[_0xb92c('0x29')],_0x257a2e[_0xb92c('0x2a')],_0x257a2e[_0xb92c('0x2b')]));recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x29')]=_0x257a2e[_0xb92c('0x29')];recordings[_0x257a2e['uniqueid']][_0xb92c('0x2a')]=_0x257a2e['calleridname'];recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x2c')]=_0x257a2e[_0xb92c('0x2c')];recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x2d')]=_0x257a2e[_0xb92c('0x2d')];if(recordings[_0x257a2e[_0xb92c('0x6')]]['type']==_0xb92c('0x2e')&&recordings[_0x257a2e[_0xb92c('0x6')]]['accountcode']){recordings[_0x257a2e[_0xb92c('0x6')]]['connectedlinenum']=recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x8')];recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x2d')]='';}recordings[_0x257a2e[_0xb92c('0x6')]][_0xb92c('0x26')][_0xb92c('0x2f')](function(_0x255c1a){var _0xe39cab=_[_0xb92c('0x30')](recordings[_0x257a2e[_0xb92c('0x6')]]);_0xe39cab[_0xb92c('0x22')]=_0x255c1a['value'];writeDB(_0xe39cab);});delete recordings[_0x257a2e[_0xb92c('0x6')]];}}catch(_0x3e5141){utils['error'](util[_0xb92c('0x3')](_0xb92c('0x31'),_0x257a2e[_0xb92c('0x6')]),_0x3e5141);}};exports[_0xb92c('0x32')]=function(_0x73268e){try{if(!_[_0xb92c('0x18')](recordings[_0x73268e[_0xb92c('0x6')]])){utils[_0xb92c('0x16')](util['format']('[%s][recordings][newexten]',_0x73268e[_0xb92c('0x6')]),_0x73268e);utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x33'),_0x73268e['uniqueid'],_0x73268e['application'],_0x73268e[_0xb92c('0x34')]));if(_0x73268e[_0xb92c('0x35')][_0xb92c('0x36')]()==_0xb92c('0x37')&&_['startsWith'](_0x73268e[_0xb92c('0x34')]['toLowerCase'](),_0xb92c('0x38'))){var _0x1d071f=_0x73268e['appdata'][_0xb92c('0x39')]('=');var _0xb2954=_0x1d071f[0x0][_0xb92c('0x3a')](_0x1d071f[0x0][_0xb92c('0x3b')]('(')+0x1,_0x1d071f[0x0]['lastIndexOf'](')'));var _0x4c70a9=_0x1d071f[0x1];recordings[_0x73268e['uniqueid']][_0xb2954]=_0x4c70a9;}}}catch(_0x1effa9){utils[_0xb92c('0x14')](util['format']('[%s][recordings][newexten]',_0x73268e[_0xb92c('0x6')]),_0x1effa9);}};exports['queuecallerjoin']=function(_0x16fc39){try{if(!_[_0xb92c('0x18')](recordings[_0x16fc39['uniqueid']])){utils[_0xb92c('0x16')](util['format'](_0xb92c('0x3c'),_0x16fc39[_0xb92c('0x6')]),_0x16fc39);utils[_0xb92c('0x2')](util[_0xb92c('0x3')](_0xb92c('0x3d'),_0x16fc39[_0xb92c('0x6')],_0x16fc39['queue']));recordings[_0x16fc39[_0xb92c('0x6')]][_0xb92c('0x3e')]=_0x16fc39['queue'];}}catch(_0x1e3f11){utils[_0xb92c('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x16fc39[_0xb92c('0x6')]),_0x1e3f11);}};exports[_0xb92c('0x3f')]=function(_0x3d58cd){try{utils[_0xb92c('0x16')](util[_0xb92c('0x3')]('[%s][recordings][blindtransfer]',_0x3d58cd[_0xb92c('0x6')]),_0x3d58cd);utils[_0xb92c('0x2')](util[_0xb92c('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3d58cd[_0xb92c('0x6')],_0x3d58cd[_0xb92c('0x40')],_0x3d58cd[_0xb92c('0x41')],_0x3d58cd['transfereecalleridnum'],_0x3d58cd['transfereecalleridname']));if(recordings[_0x3d58cd[_0xb92c('0x42')]]&&transfers['blinds'][_0x3d58cd[_0xb92c('0x42')]]){transfers[_0xb92c('0x5')][_0x3d58cd[_0xb92c('0x42')]][_0xb92c('0x43')]=!![];}}catch(_0x3bbb54){utils[_0xb92c('0x14')](util['format'](_0xb92c('0x44'),_0x3d58cd[_0xb92c('0x6')]),_0x3bbb54);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2d36b1e..e35cf80 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 _0xfb10=['type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb10,0x144));var _0x0fb1=function(_0x366acb,_0x55a7e0){_0x366acb=_0x366acb-0x0;var _0x4597cf=_0xfb10[_0x366acb];return _0x4597cf;};'use strict';var _=require(_0x0fb1('0x0'));var util=require(_0x0fb1('0x1'));var utils=require(_0x0fb1('0x2'));function writeDB(_0x57a7a4){utils[_0x0fb1('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x57a7a4[_0x0fb1('0x4')]===_0x0fb1('0x5')?_0x57a7a4[_0x0fb1('0x6')]:_0x57a7a4[_0x0fb1('0x7')],_0x57a7a4['type']));utils['request'](_0x0fb1('0x8'),_0x57a7a4);}exports[_0x0fb1('0x9')]={};exports[_0x0fb1('0xa')]=function(_0x349b66){try{utils[_0x0fb1('0xb')](util['format']('[%s][transfers][blindtransfer]',_0x349b66['uniqueid']),_0x349b66);utils[_0x0fb1('0x3')](util[_0x0fb1('0xc')](_0x0fb1('0xd'),_0x349b66['uniqueid'],_0x349b66[_0x0fb1('0xe')],_0x349b66[_0x0fb1('0xf')],_0x349b66[_0x0fb1('0x10')],_0x349b66[_0x0fb1('0x11')]));_0x349b66[_0x0fb1('0x4')]=_0x0fb1('0x12');exports['blinds'][_0x349b66[_0x0fb1('0x13')]]=_0x349b66;writeDB(_0x349b66);}catch(_0x515c53){utils[_0x0fb1('0x14')](util['format'](_0x0fb1('0x15'),_0x349b66[_0x0fb1('0x7')]),_0x515c53);}};exports['attendedtransfer']=function(_0xa82b30){try{utils[_0x0fb1('0xb')](util[_0x0fb1('0xc')]('[%s][transfers][attendedtransfer]',_0xa82b30[_0x0fb1('0x6')]),_0xa82b30);utils[_0x0fb1('0x3')](util['format'](_0x0fb1('0x16'),_0xa82b30[_0x0fb1('0x6')],_0xa82b30['origtransferercalleridnum'],_0xa82b30[_0x0fb1('0x17')],_0xa82b30[_0x0fb1('0x18')],_0xa82b30['transfertargetcalleridname']));_0xa82b30=_['assign'](_0xa82b30,{'transfererchannel':_0xa82b30['origtransfererchannel'],'transferercalleridnum':_0xa82b30[_0x0fb1('0x19')],'transferercalleridname':_0xa82b30[_0x0fb1('0x17')],'transfererconnectedlinenum':_0xa82b30[_0x0fb1('0x1a')],'transfererconnectedlinename':_0xa82b30[_0x0fb1('0x1b')],'transfereraccountcode':_0xa82b30[_0x0fb1('0x1c')],'transferercontext':_0xa82b30[_0x0fb1('0x1d')],'transfererexten':_0xa82b30[_0x0fb1('0x1e')],'transfererlinkedid':_0xa82b30[_0x0fb1('0x1f')],'context':_0xa82b30[_0x0fb1('0x20')],'extension':_0xa82b30['origtransfererexten'],'type':'attended'});if(_[_0x0fb1('0x21')](_0xa82b30['transfereechannel'])){_0xa82b30=_['assign'](_0xa82b30,{'transfereechannel':_0xa82b30[_0x0fb1('0x22')],'transfereecalleridnum':_0xa82b30[_0x0fb1('0x18')],'transfereecalleridname':_0xa82b30[_0x0fb1('0x23')],'transfereeconnectedlinenum':_0xa82b30['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xa82b30[_0x0fb1('0x24')],'transfereeaccountcode':_0xa82b30[_0x0fb1('0x25')],'transfereecontext':_0xa82b30[_0x0fb1('0x26')],'transfereeexten':_0xa82b30[_0x0fb1('0x27')],'transfereelinkedid':_0xa82b30[_0x0fb1('0x28')]});}writeDB(_0xa82b30);}catch(_0x2791b3){utils[_0x0fb1('0x14')](util[_0x0fb1('0xc')]('[%s][transfers][attendedtransfer]',_0xa82b30[_0x0fb1('0x6')]),_0x2791b3);}}; \ No newline at end of file +var _0x9b3e=['[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info','format'];(function(_0x57c316,_0x24162a){var _0x9bf149=function(_0x1ca634){while(--_0x1ca634){_0x57c316['push'](_0x57c316['shift']());}};_0x9bf149(++_0x24162a);}(_0x9b3e,0x84));var _0xe9b3=function(_0x5ab9d2,_0x1ab5e8){_0x5ab9d2=_0x5ab9d2-0x0;var _0x14709b=_0x9b3e[_0x5ab9d2];return _0x14709b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xe9b3('0x0'));function writeDB(_0x24501a){utils[_0xe9b3('0x1')](util[_0xe9b3('0x2')](_0xe9b3('0x3'),_0x24501a[_0xe9b3('0x4')]===_0xe9b3('0x5')?_0x24501a[_0xe9b3('0x6')]:_0x24501a[_0xe9b3('0x7')],_0x24501a['type']));utils[_0xe9b3('0x8')](_0xe9b3('0x9'),_0x24501a);}exports[_0xe9b3('0xa')]={};exports[_0xe9b3('0xb')]=function(_0x3d1ace){try{utils['debug'](util[_0xe9b3('0x2')]('[%s][transfers][blindtransfer]',_0x3d1ace[_0xe9b3('0x7')]),_0x3d1ace);utils[_0xe9b3('0x1')](util['format'](_0xe9b3('0xc'),_0x3d1ace[_0xe9b3('0x7')],_0x3d1ace[_0xe9b3('0xd')],_0x3d1ace[_0xe9b3('0xe')],_0x3d1ace[_0xe9b3('0xf')],_0x3d1ace[_0xe9b3('0x10')]));_0x3d1ace[_0xe9b3('0x4')]=_0xe9b3('0x11');exports[_0xe9b3('0xa')][_0x3d1ace[_0xe9b3('0x12')]]=_0x3d1ace;writeDB(_0x3d1ace);}catch(_0x596b8c){utils[_0xe9b3('0x13')](util[_0xe9b3('0x2')](_0xe9b3('0x14'),_0x3d1ace[_0xe9b3('0x7')]),_0x596b8c);}};exports['attendedtransfer']=function(_0x301b77){try{utils[_0xe9b3('0x15')](util[_0xe9b3('0x2')](_0xe9b3('0x16'),_0x301b77['origtransfereruniqueid']),_0x301b77);utils[_0xe9b3('0x1')](util[_0xe9b3('0x2')](_0xe9b3('0x17'),_0x301b77[_0xe9b3('0x6')],_0x301b77[_0xe9b3('0x18')],_0x301b77[_0xe9b3('0x19')],_0x301b77['transfertargetcalleridnum'],_0x301b77['transfertargetcalleridname']));_0x301b77=_[_0xe9b3('0x1a')](_0x301b77,{'transfererchannel':_0x301b77[_0xe9b3('0x1b')],'transferercalleridnum':_0x301b77[_0xe9b3('0x18')],'transferercalleridname':_0x301b77[_0xe9b3('0x19')],'transfererconnectedlinenum':_0x301b77[_0xe9b3('0x1c')],'transfererconnectedlinename':_0x301b77[_0xe9b3('0x1d')],'transfereraccountcode':_0x301b77[_0xe9b3('0x1e')],'transferercontext':_0x301b77[_0xe9b3('0x1f')],'transfererexten':_0x301b77[_0xe9b3('0x20')],'transfererlinkedid':_0x301b77[_0xe9b3('0x21')],'context':_0x301b77[_0xe9b3('0x22')],'extension':_0x301b77[_0xe9b3('0x23')],'type':'attended'});if(_[_0xe9b3('0x24')](_0x301b77[_0xe9b3('0x25')])){_0x301b77=_[_0xe9b3('0x1a')](_0x301b77,{'transfereechannel':_0x301b77['transfertargetchannel'],'transfereecalleridnum':_0x301b77[_0xe9b3('0x26')],'transfereecalleridname':_0x301b77['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x301b77[_0xe9b3('0x27')],'transfereeconnectedlinename':_0x301b77[_0xe9b3('0x28')],'transfereeaccountcode':_0x301b77[_0xe9b3('0x29')],'transfereecontext':_0x301b77[_0xe9b3('0x2a')],'transfereeexten':_0x301b77[_0xe9b3('0x2b')],'transfereelinkedid':_0x301b77[_0xe9b3('0x2c')]});}writeDB(_0x301b77);}catch(_0x2c99a1){utils[_0xe9b3('0x13')](util[_0xe9b3('0x2')]('[%s][transfers][attendedtransfer]',_0x301b77[_0xe9b3('0x6')]),_0x2c99a1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index cd64251..4dbb8dd 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 _0x29b3=['found','notfound','[utils][getUserByInternal]','getUserByInterface','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','then','[utils][getUserByInternal]\x20internal:%s\x20%s'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x29b3,0x160));var _0x329b=function(_0x125251,_0x4ed503){_0x125251=_0x125251-0x0;var _0x40194b=_0x29b3[_0x125251];return _0x40194b;};'use strict';var BPromise=require(_0x329b('0x0'));var jayson=require(_0x329b('0x1'));var moment=require(_0x329b('0x2'));var util=require('util');var client=jayson[_0x329b('0x3')][_0x329b('0x4')]({'port':0x2329});var logger=require(_0x329b('0x5'))(_0x329b('0x6'));exports[_0x329b('0x7')]=function(_0x598199,_0x3d66f4){logger[_0x329b('0x7')](_0x598199,_0x3d66f4?util[_0x329b('0x8')](_0x3d66f4,{'showHidden':![],'depth':null}):'');};exports[_0x329b('0x9')]=function(_0x267eed,_0x4c0cc4){logger[_0x329b('0x9')](_0x267eed,_0x4c0cc4?util[_0x329b('0x8')](_0x4c0cc4,{'showHidden':![],'depth':null}):'');};exports[_0x329b('0xa')]=function(_0x5a4f5e,_0x1a98fc){logger['error'](_0x5a4f5e,_0x1a98fc?util[_0x329b('0x8')](_0x1a98fc,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3fa652,_0x3951d7){return client[_0x329b('0xb')](_0x3fa652,{'body':_0x3951d7})['then'](function(_0x2d2c3b){logger['debug'](_0x329b('0xc'),_0x3fa652,_0x2d2c3b?util[_0x329b('0x8')](_0x2d2c3b,{'showHidden':![],'depth':null}):'');})[_0x329b('0xd')](function(_0x57e1fd){logger[_0x329b('0xa')](_0x329b('0xc'),_0x3fa652,_0x57e1fd?util['inspect'](_0x57e1fd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2de732){return client[_0x329b('0xb')](_0x329b('0xe'),{'options':{'raw':!![],'attributes':['id',_0x329b('0xf'),_0x329b('0x10'),_0x329b('0x11')],'where':_0x2de732,'limit':0x1}})['then'](function(_0x37066b){logger['debug'](_0x329b('0x12'),JSON[_0x329b('0x13')](_0x2de732),_0x37066b?util[_0x329b('0x8')](_0x37066b,{'showHidden':![],'depth':null}):'');return _0x37066b[_0x329b('0x14')][_0x329b('0x15')]?_0x37066b[_0x329b('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0x5b90b2){return new BPromise(function(_0x2799db,_0x17e8eb){if(_0x5b90b2){return getUser({'internal':_0x5b90b2})[_0x329b('0x16')](function(_0x490630){logger[_0x329b('0x7')](_0x329b('0x17'),_0x5b90b2,_0x490630?_0x329b('0x18'):_0x329b('0x19'));return _0x2799db(_0x490630);})[_0x329b('0xd')](function(_0xfff5f3){logger[_0x329b('0xa')](_0x329b('0x1a'),_0xfff5f3?util[_0x329b('0x8')](_0xfff5f3,{'showHidden':![],'depth':null}):'');return _0x2799db(null);});}return _0x2799db(null);});};exports[_0x329b('0x1b')]=function(_0x150e8b){return new BPromise(function(_0x3678e5,_0x1907f6){if(_0x150e8b){return getUser({'interface':_0x150e8b})['then'](function(_0x130050){logger[_0x329b('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x150e8b,_0x130050?_0x329b('0x18'):'notfound');return _0x3678e5(_0x130050);})[_0x329b('0xd')](function(_0x49cc02){logger[_0x329b('0xa')]('[utils][getUserByInterface]',_0x49cc02?util['inspect'](_0x49cc02,{'showHidden':![],'depth':null}):'');return _0x3678e5(null);});}return _0x3678e5(null);});};exports[_0x329b('0x1c')]=function(_0x30f118){return new BPromise(function(_0x1008a2,_0xe20707){if(_0x30f118){return getUser({'name':_0x30f118})[_0x329b('0x16')](function(_0x4a7359){logger[_0x329b('0x7')](_0x329b('0x1d'),_0x30f118,_0x4a7359?_0x329b('0x18'):'notfound');return _0x1008a2(_0x4a7359);})[_0x329b('0xd')](function(_0x1e40da){logger[_0x329b('0xa')]('[utils][getUserByName]',_0x1e40da?util[_0x329b('0x8')](_0x1e40da,{'showHidden':![],'depth':null}):'');return _0x1008a2(null);});}return _0x1008a2(null);});};exports['getVoiceQueueByName']=function(_0x96a6f6){return new BPromise(function(_0x223db0,_0x3e7802){if(_0x96a6f6){return client[_0x329b('0xb')](_0x329b('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x329b('0x10'),_0x329b('0x1f'),_0x329b('0x20'),'acwTimeout'],'where':{'name':_0x96a6f6},'limit':0x1}})[_0x329b('0x16')](function(_0x3c29d3){logger[_0x329b('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x96a6f6,_0x3c29d3?util[_0x329b('0x8')](_0x3c29d3,{'showHidden':![],'depth':null}):'');logger[_0x329b('0x7')](_0x329b('0x21'),_0x96a6f6,_0x3c29d3?_0x329b('0x18'):_0x329b('0x19'));return _0x223db0(_0x3c29d3[_0x329b('0x14')]['length']?_0x3c29d3['result'][0x0]:null);})[_0x329b('0xd')](function(_0x238bcf){logger['error'](_0x329b('0x22'),_0x238bcf?util[_0x329b('0x8')](_0x238bcf,{'showHidden':![],'depth':null}):'');return _0x223db0(null);});}return _0x223db0(null);});};exports[_0x329b('0x23')]=function(_0x4dba70,_0x5e5fe6){return moment(_0x4dba70)[_0x329b('0x24')](_0x5e5fe6,_0x329b('0x25'))[_0x329b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x329b('0x27')]=function(_0x24c00f,_0x5202ff){return moment(_0x24c00f)[_0x329b('0x28')](_0x5202ff,_0x329b('0x25'))[_0x329b('0x26')](_0x329b('0x29'));};exports['diffTime']=function(_0x12f724,_0x2aaaa7){return moment(_0x12f724)[_0x329b('0x2a')](moment(_0x2aaaa7),_0x329b('0x25'));};exports[_0x329b('0x2b')]=function(_0x29d296,_0x3542ce){return parseInt(_0x29d296,0xa)+parseInt(_0x3542ce,0xa);};exports[_0x329b('0x2c')]=function(){return moment()[_0x329b('0x26')](_0x329b('0x29'));};exports[_0x329b('0x2d')]=function(_0x187cf5,_0x48606f){if(_0x48606f){return moment(_0x187cf5)['isAfter'](_0x48606f);}return!![];};exports[_0x329b('0x2e')]=function(_0x21d066,_0x4e0928){if(_0x4e0928){return moment(_0x21d066)[_0x329b('0x2e')](_0x4e0928);}else if(_0x21d066){return!![];}return![];}; \ No newline at end of file +var _0x3800=['GetUser','internal','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','error','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','now','moment','util','client','../../config/logger','xdr','info','inspect','request','then','debug','catch','[utils][request]\x20name:%s'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x3800,0x1a2));var _0x0380=function(_0x29574e,_0xe52624){_0x29574e=_0x29574e-0x0;var _0x326847=_0x3800[_0x29574e];return _0x326847;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x0380('0x0'));var util=require(_0x0380('0x1'));var client=jayson[_0x0380('0x2')]['http']({'port':0x2329});var logger=require(_0x0380('0x3'))(_0x0380('0x4'));exports[_0x0380('0x5')]=function(_0x395c10,_0x3060f8){logger[_0x0380('0x5')](_0x395c10,_0x3060f8?util[_0x0380('0x6')](_0x3060f8,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x301d5f,_0x15e17e){logger['debug'](_0x301d5f,_0x15e17e?util[_0x0380('0x6')](_0x15e17e,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x2e5e04,_0x2336fb){logger['error'](_0x2e5e04,_0x2336fb?util[_0x0380('0x6')](_0x2336fb,{'showHidden':![],'depth':null}):'');};exports[_0x0380('0x7')]=function(_0x555b28,_0x1f1bcb){return client[_0x0380('0x7')](_0x555b28,{'body':_0x1f1bcb})[_0x0380('0x8')](function(_0x22ba43){logger[_0x0380('0x9')]('[utils][request]\x20name:%s',_0x555b28,_0x22ba43?util[_0x0380('0x6')](_0x22ba43,{'showHidden':![],'depth':null}):'');})[_0x0380('0xa')](function(_0x36980a){logger['error'](_0x0380('0xb'),_0x555b28,_0x36980a?util[_0x0380('0x6')](_0x36980a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x51139d){return client[_0x0380('0x7')](_0x0380('0xc'),{'options':{'raw':!![],'attributes':['id',_0x0380('0xd'),'name',_0x0380('0xe')],'where':_0x51139d,'limit':0x1}})[_0x0380('0x8')](function(_0x2e593a){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x0380('0xf')](_0x51139d),_0x2e593a?util[_0x0380('0x6')](_0x2e593a,{'showHidden':![],'depth':null}):'');return _0x2e593a[_0x0380('0x10')][_0x0380('0x11')]?_0x2e593a[_0x0380('0x10')][0x0]:null;});}exports[_0x0380('0x12')]=function(_0x1483be){return new BPromise(function(_0xeac468,_0x59228d){if(_0x1483be){return getUser({'internal':_0x1483be})[_0x0380('0x8')](function(_0xd0cc52){logger[_0x0380('0x5')](_0x0380('0x13'),_0x1483be,_0xd0cc52?_0x0380('0x14'):'notfound');return _0xeac468(_0xd0cc52);})['catch'](function(_0x3e49ae){logger[_0x0380('0x15')]('[utils][getUserByInternal]',_0x3e49ae?util[_0x0380('0x6')](_0x3e49ae,{'showHidden':![],'depth':null}):'');return _0xeac468(null);});}return _0xeac468(null);});};exports[_0x0380('0x16')]=function(_0x1b55dc){return new BPromise(function(_0x265057,_0x53c479){if(_0x1b55dc){return getUser({'interface':_0x1b55dc})[_0x0380('0x8')](function(_0x55751f){logger[_0x0380('0x5')](_0x0380('0x17'),_0x1b55dc,_0x55751f?_0x0380('0x14'):_0x0380('0x18'));return _0x265057(_0x55751f);})[_0x0380('0xa')](function(_0x5f2ce3){logger[_0x0380('0x15')]('[utils][getUserByInterface]',_0x5f2ce3?util[_0x0380('0x6')](_0x5f2ce3,{'showHidden':![],'depth':null}):'');return _0x265057(null);});}return _0x265057(null);});};exports[_0x0380('0x19')]=function(_0x52163d){return new BPromise(function(_0x5e38c7,_0x2e3a0d){if(_0x52163d){return getUser({'name':_0x52163d})[_0x0380('0x8')](function(_0x70eb39){logger[_0x0380('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x52163d,_0x70eb39?_0x0380('0x14'):_0x0380('0x18'));return _0x5e38c7(_0x70eb39);})['catch'](function(_0x29aa94){logger[_0x0380('0x15')]('[utils][getUserByName]',_0x29aa94?util['inspect'](_0x29aa94,{'showHidden':![],'depth':null}):'');return _0x5e38c7(null);});}return _0x5e38c7(null);});};exports[_0x0380('0x1a')]=function(_0xb9c6bb){return new BPromise(function(_0x1889ec,_0x407f19){if(_0xb9c6bb){return client[_0x0380('0x7')](_0x0380('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x0380('0x1c'),_0x0380('0x1d'),_0x0380('0x1e'),_0x0380('0x1f')],'where':{'name':_0xb9c6bb},'limit':0x1}})['then'](function(_0x33a6c7){logger['debug'](_0x0380('0x20'),_0xb9c6bb,_0x33a6c7?util[_0x0380('0x6')](_0x33a6c7,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0xb9c6bb,_0x33a6c7?_0x0380('0x14'):'notfound');return _0x1889ec(_0x33a6c7[_0x0380('0x10')][_0x0380('0x11')]?_0x33a6c7[_0x0380('0x10')][0x0]:null);})[_0x0380('0xa')](function(_0xbe56b3){logger[_0x0380('0x15')](_0x0380('0x21'),_0xbe56b3?util[_0x0380('0x6')](_0xbe56b3,{'showHidden':![],'depth':null}):'');return _0x1889ec(null);});}return _0x1889ec(null);});};exports['addTime']=function(_0x4bb659,_0x3d822f){return moment(_0x4bb659)[_0x0380('0x22')](_0x3d822f,_0x0380('0x23'))[_0x0380('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0380('0x25')]=function(_0x59c4ab,_0x49b046){return moment(_0x59c4ab)[_0x0380('0x26')](_0x49b046,'seconds')[_0x0380('0x24')](_0x0380('0x27'));};exports[_0x0380('0x28')]=function(_0x3312d0,_0x5b220a){return moment(_0x3312d0)[_0x0380('0x29')](moment(_0x5b220a),_0x0380('0x23'));};exports['sumTime']=function(_0x17b618,_0x34cd7b){return parseInt(_0x17b618,0xa)+parseInt(_0x34cd7b,0xa);};exports[_0x0380('0x2a')]=function(){return moment()[_0x0380('0x24')](_0x0380('0x27'));};exports['isAfter']=function(_0x299308,_0x25e448){if(_0x25e448){return moment(_0x299308)['isAfter'](_0x25e448);}return!![];};exports['isBefore']=function(_0x3c938f,_0x1ea463){if(_0x1ea463){return moment(_0x3c938f)['isBefore'](_0x1ea463);}else if(_0x3c938f){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 7499881..b6edf74 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 _0x3af1=['fs-extra','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','ensureDir','catch','then','user','no-user','data','timestamp','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','setupLoggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3af1,0x8a));var _0x13af=function(_0xad3c7a,_0x57d62b){_0xad3c7a=_0xad3c7a-0x0;var _0x2385c9=_0x3af1[_0xad3c7a];return _0x2385c9;};var fs=require(_0x13af('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require(_0x13af('0x1'));var util=require(_0x13af('0x2'));var fileLogger=require(_0x13af('0x3'))[_0x13af('0x4')];var safeTemplate=require('./safe-template')[_0x13af('0x5')];var maskSensitiveData=require(_0x13af('0x6'))[_0x13af('0x7')];function ClientSideLogger(){function _0x1cee01(_0x4c10df){var _0x2d7c4f=path[_0x13af('0x8')](_0x13af('0x9'),_0x13af('0xa'),_0x13af('0xb'));var _0x5752ae=path[_0x13af('0x8')](_0x13af('0xc'),_0x4c10df['role']+'-'+_0x4c10df['name']);return fs[_0x13af('0xd')](path[_0x13af('0x8')](_0x2d7c4f,_0x5752ae))['then'](function(){var _0x3e7745=fileLogger(_0x13af('0xc'),path[_0x13af('0x8')](_0x2d7c4f,_0x5752ae));return _0x3e7745;})[_0x13af('0xe')](function(_0x10d412){throw _0x10d412;});}this['log']=function(_0x3857f8,_0xe0b4ad,_0x3d3a30,_0x219557){return _0x1cee01(_0x3857f8['user'])[_0x13af('0xf')](function(_0x6ddab5){var _0x5525b7=_0x6ddab5[_0xe0b4ad];return _0x5525b7;})[_0x13af('0xf')](function(_0x32f755){var _0xa47180=_0x3857f8[_0x13af('0x10')]?_0x3857f8[_0x13af('0x10')]['id']:_0x13af('0x11');var _0x140a8f=_0x219557[_0x13af('0x12')];var _0x35bfc4=_0x219557[_0x13af('0x13')];var _0x3386b4=new Date(Number(_0x35bfc4));return _0x32f755(_0xa47180,_0x3386b4,_0x3d3a30,_0x140a8f);})['catch'](function(_0x3ea99b){fileLogger(_0x13af('0xc'))['error'](_0x3ea99b);});};}function setupLoggers(_0x461952){return new Promise(function(_0x265678){var _0xa91430=new ClientSideLogger();var _0x826d2f=fileLogger(_0x13af('0x14'));var _0x51ae94=fileLogger(_0x13af('0x15'));_0x461952['set'](_0x13af('0x16'),_0xa91430);_0x461952[_0x13af('0x17')](ewinston['logger']({'winstonInstance':_0x826d2f,'meta':![],'statusLevels':!![],'msg':function(_0x211104,_0x346100){var _0x215e1f=_0x13af('0x18');if(!_[_0x13af('0x19')](_0x211104['body'])){_0x215e1f+=_0x13af('0x1a');var _0xc72f14=_0x211104[_0x13af('0x1b')];maskSensitiveData(_0xc72f14);}return safeTemplate(util[_0x13af('0x1c')](_0x215e1f,_0x211104[_0x13af('0x1d')],_0x211104[_0x13af('0x1e')]['x-forwarded-for']?_0x211104[_0x13af('0x1e')][_0x13af('0x1f')]:_0x211104[_0x13af('0x20')][_0x13af('0x21')]||_0x211104['ip'],_0x211104[_0x13af('0x22')],_0x346100[_0x13af('0x23')],_0x346100[_0x13af('0x24')],_0x211104[_0x13af('0x10')]?_0x211104[_0x13af('0x10')]['id']:null,_0x211104[_0x13af('0x10')]?_0x211104[_0x13af('0x10')][_0x13af('0x25')]:null,_0x211104[_0x13af('0x10')]?_0x211104[_0x13af('0x10')][_0x13af('0x26')]:null,_0xc72f14?util['inspect'](_0xc72f14,![],null):''));}}));_0x461952[_0x13af('0x17')](ewinston[_0x13af('0x27')]({'winstonInstance':_0x51ae94,'meta':![],'statusLevels':!![],'msg':function(_0x4f22f4,_0x569fc0){var _0x42499b=_0x13af('0x28');if(_0x4f22f4[_0x13af('0x1b')]&&_0x4f22f4[_0x13af('0x1b')][_0x13af('0x29')]&&_0x4f22f4[_0x13af('0x1b')][_0x13af('0x2a')]){_0x42499b=_0x13af('0x2b');}return util['format'](_0x42499b,_0x4f22f4['method'],_0x4f22f4[_0x13af('0x1e')]['x-forwarded-for']?_0x4f22f4['headers'][_0x13af('0x1f')]:_0x4f22f4['connection'][_0x13af('0x21')]||_0x4f22f4['ip'],_0x4f22f4['url'],_0x569fc0[_0x13af('0x23')],_0x569fc0[_0x13af('0x24')],_0x4f22f4[_0x13af('0x10')]?_0x4f22f4[_0x13af('0x10')]['id']:null,_0x4f22f4[_0x13af('0x10')]?_0x4f22f4[_0x13af('0x10')][_0x13af('0x25')]:null,_0x4f22f4[_0x13af('0x10')]?_0x4f22f4['user'][_0x13af('0x26')]:null,_0x4f22f4[_0x13af('0x1b')]&&_0x4f22f4[_0x13af('0x1b')][_0x13af('0x29')]?_0x4f22f4[_0x13af('0x1b')][_0x13af('0x29')]:'other',_0x4f22f4['body']&&_0x4f22f4[_0x13af('0x1b')][_0x13af('0x2a')]?_0x4f22f4['body'][_0x13af('0x2a')]:'',_0x4f22f4['body']&&_0x4f22f4['body'][_0x13af('0x2c')]?_0x4f22f4[_0x13af('0x1b')]['agent_name']:'');},'ignoreRoute':function(_0x59bf26){var _0x341173=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x341173['test'](_0x59bf26['url']);}}));return _0x265678();});}exports[_0x13af('0x2d')]=setupLoggers; \ No newline at end of file +var _0xf375=['connection','remoteAddress','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','./mask-sensitive-data','join','/var','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for'];(function(_0x392346,_0x20be0d){var _0x194cad=function(_0x114201){while(--_0x114201){_0x392346['push'](_0x392346['shift']());}};_0x194cad(++_0x20be0d);}(_0xf375,0x1d9));var _0x5f37=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf375[_0x21a9d9];return _0x46adce;};var fs=require(_0x5f37('0x0'));var _=require(_0x5f37('0x1'));var ewinston=require(_0x5f37('0x2'));var path=require(_0x5f37('0x3'));var util=require(_0x5f37('0x4'));var fileLogger=require(_0x5f37('0x5'))['fileLogger'];var safeTemplate=require(_0x5f37('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x5f37('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x3ef943(_0x1a1170){var _0x1bcc3d=path[_0x5f37('0x8')](_0x5f37('0x9'),'log',_0x5f37('0xa'));var _0x383c44=path[_0x5f37('0x8')](_0x5f37('0xb'),_0x1a1170[_0x5f37('0xc')]+'-'+_0x1a1170[_0x5f37('0xd')]);return fs[_0x5f37('0xe')](path[_0x5f37('0x8')](_0x1bcc3d,_0x383c44))[_0x5f37('0xf')](function(){var _0x25ffcc=fileLogger('client',path['join'](_0x1bcc3d,_0x383c44));return _0x25ffcc;})[_0x5f37('0x10')](function(_0x38d5a9){throw _0x38d5a9;});}this['log']=function(_0x4727e3,_0x5dbf38,_0x3a0765,_0x33faff){return _0x3ef943(_0x4727e3[_0x5f37('0x11')])['then'](function(_0x4298df){var _0x6bfcd5=_0x4298df[_0x5dbf38];return _0x6bfcd5;})['then'](function(_0x16b16e){var _0x37ffed=_0x4727e3[_0x5f37('0x11')]?_0x4727e3[_0x5f37('0x11')]['id']:_0x5f37('0x12');var _0x401e81=_0x33faff[_0x5f37('0x13')];var _0x3910fa=_0x33faff[_0x5f37('0x14')];var _0xad7cfb=new Date(Number(_0x3910fa));return _0x16b16e(_0x37ffed,_0xad7cfb,_0x3a0765,_0x401e81);})[_0x5f37('0x10')](function(_0x5b5754){fileLogger(_0x5f37('0xb'))[_0x5f37('0x15')](_0x5b5754);});};}function setupLoggers(_0x5f57cd){return new Promise(function(_0x2404a1){var _0x31f99b=new ClientSideLogger();var _0x180bbc=fileLogger(_0x5f37('0x16'));var _0x56f0b3=fileLogger(_0x5f37('0x17'));_0x5f57cd['set'](_0x5f37('0x18'),_0x31f99b);_0x5f57cd[_0x5f37('0x19')](ewinston['logger']({'winstonInstance':_0x180bbc,'meta':![],'statusLevels':!![],'msg':function(_0x38bd34,_0x1dcdf9){var _0xea55a1=_0x5f37('0x1a');if(!_[_0x5f37('0x1b')](_0x38bd34[_0x5f37('0x1c')])){_0xea55a1+='\x20body=%s';var _0x1e5568=_0x38bd34['body'];maskSensitiveData(_0x1e5568);}return safeTemplate(util[_0x5f37('0x1d')](_0xea55a1,_0x38bd34[_0x5f37('0x1e')],_0x38bd34[_0x5f37('0x1f')][_0x5f37('0x20')]?_0x38bd34[_0x5f37('0x1f')]['x-forwarded-for']:_0x38bd34[_0x5f37('0x21')][_0x5f37('0x22')]||_0x38bd34['ip'],_0x38bd34['url'],_0x1dcdf9[_0x5f37('0x23')],_0x1dcdf9[_0x5f37('0x24')],_0x38bd34[_0x5f37('0x11')]?_0x38bd34[_0x5f37('0x11')]['id']:null,_0x38bd34[_0x5f37('0x11')]?_0x38bd34[_0x5f37('0x11')][_0x5f37('0xd')]:null,_0x38bd34['user']?_0x38bd34[_0x5f37('0x11')][_0x5f37('0xc')]:null,_0x1e5568?util[_0x5f37('0x25')](_0x1e5568,![],null):''));}}));_0x5f57cd[_0x5f37('0x19')](ewinston[_0x5f37('0x26')]({'winstonInstance':_0x56f0b3,'meta':![],'statusLevels':!![],'msg':function(_0x90214e,_0x476670){var _0x2176fc=_0x5f37('0x27');if(_0x90214e[_0x5f37('0x1c')]&&_0x90214e[_0x5f37('0x1c')][_0x5f37('0x28')]&&_0x90214e[_0x5f37('0x1c')][_0x5f37('0x29')]){_0x2176fc=_0x5f37('0x2a');}return util[_0x5f37('0x1d')](_0x2176fc,_0x90214e[_0x5f37('0x1e')],_0x90214e['headers'][_0x5f37('0x20')]?_0x90214e[_0x5f37('0x1f')]['x-forwarded-for']:_0x90214e[_0x5f37('0x21')]['remoteAddress']||_0x90214e['ip'],_0x90214e[_0x5f37('0x2b')],_0x476670[_0x5f37('0x23')],_0x476670[_0x5f37('0x24')],_0x90214e[_0x5f37('0x11')]?_0x90214e['user']['id']:null,_0x90214e[_0x5f37('0x11')]?_0x90214e[_0x5f37('0x11')][_0x5f37('0xd')]:null,_0x90214e[_0x5f37('0x11')]?_0x90214e['user'][_0x5f37('0xc')]:null,_0x90214e[_0x5f37('0x1c')]&&_0x90214e[_0x5f37('0x1c')][_0x5f37('0x28')]?_0x90214e[_0x5f37('0x1c')][_0x5f37('0x28')]:'other',_0x90214e[_0x5f37('0x1c')]&&_0x90214e['body'][_0x5f37('0x29')]?_0x90214e[_0x5f37('0x1c')][_0x5f37('0x29')]:'',_0x90214e[_0x5f37('0x1c')]&&_0x90214e[_0x5f37('0x1c')][_0x5f37('0x2c')]?_0x90214e[_0x5f37('0x1c')][_0x5f37('0x2c')]:'');},'ignoreRoute':function(_0x10a730){var _0x557e5e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x557e5e['test'](_0x10a730['url']);}}));return _0x2404a1();});}exports[_0x5f37('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b84fbf5..c6df45c 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d1f=['util','moment','debugLevel','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20blue','bold\x20cyan','join','format','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','level','}}}','length','stringify','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger'];(function(_0xb0f253,_0x476cc1){var _0x25dbbe=function(_0x52a034){while(--_0x52a034){_0xb0f253['push'](_0xb0f253['shift']());}};_0x25dbbe(++_0x476cc1);}(_0x6d1f,0x14a));var _0xf6d1=function(_0x25ded1,_0x46d806){_0x25ded1=_0x25ded1-0x0;var _0x189600=_0x6d1f[_0x25ded1];return _0x189600;};'use strict';var path=require('path');var util=require(_0xf6d1('0x0'));var moment=require(_0xf6d1('0x1'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0xf6d1('0x2')]?config['debugLevel']['toLowerCase']():'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':_0xf6d1('0x3'),'error':_0xf6d1('0x4'),'warn':_0xf6d1('0x5'),'info':_0xf6d1('0x6'),'print':'bold\x20white','success':_0xf6d1('0x7'),'http':_0xf6d1('0x8'),'verbose':'bold\x20magenta','debug':_0xf6d1('0x9'),'silly':_0xf6d1('0xa')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4634c4,_0x471efd,_0xe76829){var _0x429e79=_0x4634c4||'/var/log/xcally';return path[_0xf6d1('0xb')](_0x429e79,util[_0xf6d1('0xc')](_0xf6d1('0xd'),_0x471efd,_0xe76829));}function formatter(_0x566b08,_0x29d629){_0x29d629[_0xf6d1('0xe')]=_0x29d629[_0xf6d1('0xe')][_0xf6d1('0xf')](/@@{/g,_0xf6d1('0x10'))[_0xf6d1('0xf')](/}@@/g,'}}}')[_0xf6d1('0xf')](/@{/g,'{{')[_0xf6d1('0xf')](/}@/g,'}}');return util['format'](_0xf6d1('0x11'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x29d629[_0xf6d1('0x12')]['toUpperCase'](),_0x566b08,_0x29d629[_0xf6d1('0xe')]);}function fileFormat(_0x5c108d,_0x416492){_0x416492['message']=_0x416492[_0xf6d1('0xe')]['replace'](/@@{/g,_0xf6d1('0x10'))['replace'](/}@@/g,_0xf6d1('0x13'))[_0xf6d1('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x3b0392=_0x416492['meta']&&Object['keys'](_0x416492['meta'])[_0xf6d1('0x14')]?'\x0a\x09'+JSON[_0xf6d1('0x15')](_0x416492[_0xf6d1('0x16')]):'';return util[_0xf6d1('0xc')](_0xf6d1('0x17'),moment()[_0xf6d1('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),_0x416492['level']['toUpperCase'](),_0x5c108d,_0x416492[_0xf6d1('0xe')],_0x3b0392);}function consoleLogger(){var _0x46ccc2=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d1('0x18'))][(_0xf6d1('0x19'))]({'level':_0xf6d1('0x1a'),'json':![],'formatter':function(_0x5791c7){return formatter('',_0x5791c7);}})]});return _0x46ccc2;}function fileLogger(_0x796e68,_0x1e2cfa){var _0x42c347=new winston[(_0xf6d1('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf6d1('0x18'))][(_0xf6d1('0x1c'))]({'name':util[_0xf6d1('0xc')](_0xf6d1('0x1d'),_0x796e68,_0xf6d1('0x1e')),'filename':getLogFileName(_0x1e2cfa,_0x796e68,_0xf6d1('0x1e')),'level':_0xf6d1('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19a360){return fileFormat(_0x796e68,_0x19a360);}}),new winston[(_0xf6d1('0x18'))][(_0xf6d1('0x1c'))]({'name':util[_0xf6d1('0xc')](_0xf6d1('0x1d'),_0x796e68,debugLevel),'filename':getLogFileName(_0x1e2cfa,_0x796e68,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b7e61){return fileFormat(_0x796e68,_0x2b7e61);}}),new winston[(_0xf6d1('0x18'))]['Console']({'level':_0xf6d1('0x1a'),'json':![],'formatter':function(_0x25fbc0){return fileFormat(_0x796e68,_0x25fbc0);}})]});return _0x42c347;}exports[_0xf6d1('0x1f')]=consoleLogger;exports[_0xf6d1('0x20')]=fileLogger; \ No newline at end of file +var _0x6e7a=['transports','Console','warn','File','%s-%s','error','consoleLogger','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20green','gray','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','}}}','level','{{{','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger'];(function(_0x555c44,_0x38bdb6){var _0x372e32=function(_0x159adc){while(--_0x159adc){_0x555c44['push'](_0x555c44['shift']());}};_0x372e32(++_0x38bdb6);}(_0x6e7a,0x193));var _0xa6e7=function(_0x4db40c,_0x5aebda){_0x4db40c=_0x4db40c-0x0;var _0x572a4b=_0x6e7a[_0x4db40c];return _0x572a4b;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require(_0xa6e7('0x0'));var config=require('../config/environment');var debugLevel=config[_0xa6e7('0x1')]?config[_0xa6e7('0x1')][_0xa6e7('0x2')]():_0xa6e7('0x3');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':_0xa6e7('0x4'),'error':_0xa6e7('0x5'),'warn':_0xa6e7('0x6'),'info':'white','print':'bold\x20white','success':_0xa6e7('0x7'),'http':_0xa6e7('0x8'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xa6e7('0x9')};winston[_0xa6e7('0xa')](XC_LOG_COLORS);function getLogFileName(_0x28476c,_0x523d89,_0x4e3210){var _0x42a15d=_0x28476c||_0xa6e7('0xb');return path['join'](_0x42a15d,util[_0xa6e7('0xc')](_0xa6e7('0xd'),_0x523d89,_0x4e3210));}function formatter(_0xc71a8b,_0x3f56bd){_0x3f56bd[_0xa6e7('0xe')]=_0x3f56bd[_0xa6e7('0xe')]['replace'](/@@{/g,'{{{')[_0xa6e7('0xf')](/}@@/g,_0xa6e7('0x10'))['replace'](/@{/g,'{{')[_0xa6e7('0xf')](/}@/g,'}}');return util[_0xa6e7('0xc')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xa6e7('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3f56bd[_0xa6e7('0x11')]['toUpperCase'](),_0xc71a8b,_0x3f56bd[_0xa6e7('0xe')]);}function fileFormat(_0x21e74d,_0x1f20c7){_0x1f20c7[_0xa6e7('0xe')]=_0x1f20c7[_0xa6e7('0xe')]['replace'](/@@{/g,_0xa6e7('0x12'))['replace'](/}@@/g,_0xa6e7('0x10'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1620b7=_0x1f20c7['meta']&&Object['keys'](_0x1f20c7[_0xa6e7('0x13')])[_0xa6e7('0x14')]?'\x0a\x09'+JSON[_0xa6e7('0x15')](_0x1f20c7[_0xa6e7('0x13')]):'';return util[_0xa6e7('0xc')](_0xa6e7('0x16'),moment()[_0xa6e7('0xc')](_0xa6e7('0x17')),_0x1f20c7[_0xa6e7('0x11')][_0xa6e7('0x18')](),_0x21e74d,_0x1f20c7[_0xa6e7('0xe')],_0x1620b7);}function consoleLogger(){var _0x58b528=new winston[(_0xa6e7('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa6e7('0x1a'))][(_0xa6e7('0x1b'))]({'level':_0xa6e7('0x1c'),'json':![],'formatter':function(_0x2b6de5){return formatter('',_0x2b6de5);}})]});return _0x58b528;}function fileLogger(_0x7544da,_0x3afcda){var _0x381243=new winston[(_0xa6e7('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xa6e7('0x1d'))]({'name':util['format'](_0xa6e7('0x1e'),_0x7544da,_0xa6e7('0x1f')),'filename':getLogFileName(_0x3afcda,_0x7544da,'error'),'level':_0xa6e7('0x1f'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3157ae){return fileFormat(_0x7544da,_0x3157ae);}}),new winston[(_0xa6e7('0x1a'))][(_0xa6e7('0x1d'))]({'name':util[_0xa6e7('0xc')](_0xa6e7('0x1e'),_0x7544da,debugLevel),'filename':getLogFileName(_0x3afcda,_0x7544da,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x308d12){return fileFormat(_0x7544da,_0x308d12);}}),new winston['transports'][(_0xa6e7('0x1b'))]({'level':_0xa6e7('0x1c'),'json':![],'formatter':function(_0x54c19c){return fileFormat(_0x7544da,_0x54c19c);}})]});return _0x381243;}exports[_0xa6e7('0x20')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 916dfd7..d8bf213 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(_0x197127,_0x48bbfd){var _0x558ca6=function(_0x580faf){while(--_0x580faf){_0x197127['push'](_0x197127['shift']());}};_0x558ca6(++_0x48bbfd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x25f3fe,_0x35392d){_0x25f3fe=_0x25f3fe-0x0;var _0x25a880=_0x5f2f[_0x25f3fe];return _0x25a880;};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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x0295,0x1f0));var _0x5029=function(_0x5e4a61,_0x403c59){_0x5e4a61=_0x5e4a61-0x0;var _0x1374aa=_0x0295[_0x5e4a61];return _0x1374aa;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index a44a576..66daffb 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 _0x7708=['lodash','\x20}\x20}','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x39838a,_0x5a5351){var _0x2596ac=function(_0x226c84){while(--_0x226c84){_0x39838a['push'](_0x39838a['shift']());}};_0x2596ac(++_0x5a5351);}(_0x7708,0x188));var _0x8770=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x7708[_0x318410];return _0x2898a3;};var _=require(_0x8770('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x24909b){return _0x24909b==='{{'?'{\x20{\x20':_0x8770('0x1');}function safeTemplate(_0x5a8b5b){var _0x5ca46f=_0x5a8b5b;if(typeof _0x5a8b5b==='string'){_0x5ca46f=_0x5a8b5b['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8770('0x2')](_0x5a8b5b)){_0x5ca46f=_0x5a8b5b[_0x8770('0x3')](function(_0x577b13){return safeTemplate(_0x577b13);});}else if(_[_0x8770('0x4')](_0x5a8b5b)){_0x5ca46f=Object['keys'](_0x5a8b5b)[_0x8770('0x5')](function(_0x42d305,_0x2b0295){_0x42d305[_0x2b0295]=safeTemplate(_0x5a8b5b[_0x2b0295]);return _0x42d305;},{});}return _0x5ca46f;}module[_0x8770('0x6')][_0x8770('0x7')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x8952,0x17e));var _0x2895=function(_0x5d3062,_0x282274){_0x5d3062=_0x5d3062-0x0;var _0x2519b1=_0x8952[_0x5d3062];return _0x2519b1;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file -- 1.7.1